From d11490fccab33e5dca93cd4be86273422fd38daa Mon Sep 17 00:00:00 2001 From: Justin Black Date: Thu, 2 May 2024 12:31:52 -0700 Subject: [PATCH 01/78] Adds kotlin petstore sample --- samples/client/petstore/kotlin/.gitignore | 9 + .../petstore/kotlin/.openapi-generator-ignore | 23 + .../petstore/kotlin/.openapi-generator/FILES | 2000 ++++++++ .../kotlin/.openapi-generator/VERSION | 1 + samples/client/petstore/kotlin/README.md | 474 ++ .../client/petstore/kotlin/build.gradle.kts | 64 + .../petstore/kotlin/docs/RootServerInfo.md | 65 + .../docs/apis/paths/Anotherfakedummy.md | 119 + .../docs/apis/paths/Commonparamsubdir.md | 321 ++ .../petstore/kotlin/docs/apis/paths/Fake.md | 460 ++ ...akeadditionalpropertieswitharrayofenums.md | 105 + .../docs/apis/paths/Fakebodywithfileschema.md | 119 + .../apis/paths/Fakebodywithqueryparams.md | 143 + .../apis/paths/Fakecasesensitiveparams.md | 120 + .../docs/apis/paths/Fakeclassnametest.md | 131 + .../docs/apis/paths/Fakedeletecoffeeid.md | 120 + .../kotlin/docs/apis/paths/Fakehealth.md | 103 + .../paths/Fakeinlineadditionalproperties.md | 117 + .../docs/apis/paths/Fakeinlinecomposition.md | 112 + .../docs/apis/paths/Fakejsonformdata.md | 105 + .../kotlin/docs/apis/paths/Fakejsonpatch.md | 105 + .../docs/apis/paths/Fakejsonwithcharset.md | 105 + .../Fakemultiplerequestbodycontenttypes.md | 107 + .../apis/paths/Fakemultipleresponsebodies.md | 109 + .../docs/apis/paths/Fakemultiplesecurities.md | 120 + .../kotlin/docs/apis/paths/Fakeobjinquery.md | 102 + .../Fakeparametercollisions1ababselfab.md | 128 + .../docs/apis/paths/Fakepemcontenttype.md | 105 + .../Fakepetiduploadimagewithrequiredfile.md | 128 + .../Fakequeryparamwithjsoncontenttype.md | 114 + .../kotlin/docs/apis/paths/Fakeredirection.md | 105 + .../docs/apis/paths/Fakerefobjinquery.md | 102 + .../docs/apis/paths/Fakerefsarraymodel.md | 107 + .../docs/apis/paths/Fakerefsarrayofenums.md | 105 + .../kotlin/docs/apis/paths/Fakerefsboolean.md | 107 + ...erefscomposedoneofnumberwithvalidations.md | 107 + .../kotlin/docs/apis/paths/Fakerefsenum.md | 107 + .../kotlin/docs/apis/paths/Fakerefsmammal.md | 110 + .../kotlin/docs/apis/paths/Fakerefsnumber.md | 107 + .../paths/Fakerefsobjectmodelwithrefprops.md | 107 + .../kotlin/docs/apis/paths/Fakerefsstring.md | 107 + .../apis/paths/Fakeresponsewithoutschema.md | 101 + .../docs/apis/paths/Faketestqueryparamters.md | 141 + .../docs/apis/paths/Fakeuploaddownloadfile.md | 115 + .../kotlin/docs/apis/paths/Fakeuploadfile.md | 107 + .../kotlin/docs/apis/paths/Fakeuploadfiles.md | 107 + .../docs/apis/paths/Fakewildcardresponses.md | 122 + .../petstore/kotlin/docs/apis/paths/Foo.md | 102 + .../petstore/kotlin/docs/apis/paths/Pet.md | 315 ++ .../kotlin/docs/apis/paths/Petfindbystatus.md | 137 + .../kotlin/docs/apis/paths/Petfindbytags.md | 134 + .../kotlin/docs/apis/paths/Petpetid.md | 377 ++ .../docs/apis/paths/Petpetiduploadimage.md | 128 + .../kotlin/docs/apis/paths/Solidus.md | 101 + .../kotlin/docs/apis/paths/Storeinventory.md | 117 + .../kotlin/docs/apis/paths/Storeorder.md | 137 + .../docs/apis/paths/Storeorderorderid.md | 233 + .../petstore/kotlin/docs/apis/paths/User.md | 133 + .../docs/apis/paths/Usercreatewitharray.md | 155 + .../docs/apis/paths/Usercreatewithlist.md | 155 + .../kotlin/docs/apis/paths/Userlogin.md | 129 + .../kotlin/docs/apis/paths/Userlogout.md | 103 + .../kotlin/docs/apis/paths/Userusername.md | 369 ++ .../kotlin/docs/apis/tags/Anotherfake.md | 119 + .../petstore/kotlin/docs/apis/tags/Default.md | 103 + .../petstore/kotlin/docs/apis/tags/Fake.md | 4304 +++++++++++++++++ .../docs/apis/tags/Fakeclassnametags123.md | 131 + .../petstore/kotlin/docs/apis/tags/Pet.md | 1155 +++++ .../petstore/kotlin/docs/apis/tags/Store.md | 462 ++ .../petstore/kotlin/docs/apis/tags/User.md | 980 ++++ .../headers/Int32JsonContentTypeHeader.md | 59 + .../docs/components/headers/NumberHeader.md | 40 + .../headers/RefContentSchemaHeader.md | 59 + .../components/headers/RefSchemaHeader.md | 40 + .../components/headers/RefStringHeader.md | 20 + .../docs/components/headers/StringHeader.md | 40 + .../Int32JsonContentTypeHeaderSchema.md | 49 + .../numberheader/NumberHeaderSchema.md | 49 + .../RefContentSchemaHeaderSchema.md | 19 + .../refschemaheader/RefSchemaHeaderSchema.md | 19 + .../stringheader/StringHeaderSchema.md | 49 + .../ComponentRefSchemaStringWithValidation.md | 60 + .../components/parameters/PathUserName.md | 41 + .../components/parameters/RefPathUserName.md | 20 + .../RefSchemaStringWithValidation.md | 41 + .../applicationjson/ApplicationjsonSchema.md | 19 + .../parameters/pathusername/Schema.md | 49 + .../refschemastringwithvalidation/Schema.md | 19 + .../docs/components/requestbodies/Client.md | 93 + .../docs/components/requestbodies/Pet.md | 131 + .../components/requestbodies/RefUserArray.md | 20 + .../components/requestbodies/UserArray.md | 93 + .../applicationjson/ApplicationjsonSchema.md | 19 + .../applicationjson/ApplicationjsonSchema.md | 19 + .../applicationxml/ApplicationxmlSchema.md | 19 + .../applicationjson/ApplicationjsonSchema.md | 156 + .../components/responses/HeadersWithNoBody.md | 35 + .../responses/RefSuccessDescriptionOnly.md | 20 + .../RefSuccessfulXmlAndJsonArrayOfPet.md | 20 + .../responses/SuccessDescriptionOnly.md | 35 + .../SuccessInlineContentAndHeader.md | 90 + .../responses/SuccessWithJsonApiResponse.md | 90 + .../SuccessfulXmlAndJsonArrayOfPet.md | 126 + .../HeadersWithNoBodyHeadersSchema.md | 252 + .../headers/location/LocationSchema.md | 49 + .../applicationjson/ApplicationjsonSchema.md | 162 + .../applicationxml/ApplicationxmlSchema.md | 162 + ...cessInlineContentAndHeaderHeadersSchema.md | 252 + .../applicationjson/ApplicationjsonSchema.md | 157 + .../headers/someheader/SomeHeaderSchema.md | 49 + ...SuccessWithJsonApiResponseHeadersSchema.md | 527 ++ .../applicationjson/ApplicationjsonSchema.md | 19 + .../components/schemas/AbstractStepMessage.md | 356 ++ .../schemas/AdditionalPropertiesClass.md | 1419 ++++++ .../schemas/AdditionalPropertiesSchema.md | 839 ++++ .../AdditionalPropertiesWithArrayOfEnums.md | 233 + .../kotlin/docs/components/schemas/Address.md | 162 + .../kotlin/docs/components/schemas/Animal.md | 259 + .../docs/components/schemas/AnimalFarm.md | 131 + .../components/schemas/AnyTypeAndFormat.md | 1608 ++++++ .../components/schemas/AnyTypeNotString.md | 207 + .../components/schemas/ApiResponseSchema.md | 254 + .../kotlin/docs/components/schemas/Apple.md | 318 ++ .../docs/components/schemas/AppleReq.md | 351 ++ .../components/schemas/ArrayHoldingAnyType.md | 263 + .../schemas/ArrayOfArrayOfNumberOnly.md | 392 ++ .../docs/components/schemas/ArrayOfEnums.md | 124 + .../components/schemas/ArrayOfNumberOnly.md | 282 ++ .../docs/components/schemas/ArrayTest.md | 792 +++ .../schemas/ArrayWithValidationsInItems.md | 196 + .../kotlin/docs/components/schemas/Banana.md | 188 + .../docs/components/schemas/BananaReq.md | 354 ++ .../kotlin/docs/components/schemas/Bar.md | 84 + .../docs/components/schemas/BasquePig.md | 232 + .../docs/components/schemas/BooleanEnum.md | 98 + .../docs/components/schemas/BooleanSchema.md | 52 + .../docs/components/schemas/Capitalization.md | 382 ++ .../kotlin/docs/components/schemas/Cat.md | 324 ++ .../docs/components/schemas/Category.md | 262 + .../docs/components/schemas/ChildCat.md | 324 ++ .../docs/components/schemas/ClassModel.md | 253 + .../kotlin/docs/components/schemas/Client.md | 169 + .../schemas/ComplexQuadrilateral.md | 371 ++ ...omposedAnyOfDifferentTypesNoValidations.md | 956 ++++ .../docs/components/schemas/ComposedArray.md | 260 + .../docs/components/schemas/ComposedBool.md | 217 + .../docs/components/schemas/ComposedNone.md | 217 + .../docs/components/schemas/ComposedNumber.md | 217 + .../docs/components/schemas/ComposedObject.md | 194 + .../schemas/ComposedOneOfDifferentTypes.md | 615 +++ .../docs/components/schemas/ComposedString.md | 217 + .../docs/components/schemas/Currency.md | 99 + .../docs/components/schemas/DanishPig.md | 232 + .../docs/components/schemas/DateTimeTest.md | 85 + .../schemas/DateTimeWithValidations.md | 85 + .../components/schemas/DateWithValidations.md | 85 + .../docs/components/schemas/DecimalPayload.md | 52 + .../kotlin/docs/components/schemas/Dog.md | 324 ++ .../kotlin/docs/components/schemas/Drawing.md | 277 ++ .../docs/components/schemas/EnumArrays.md | 416 ++ .../docs/components/schemas/EnumClass.md | 103 + .../docs/components/schemas/EnumTest.md | 597 +++ .../components/schemas/EquilateralTriangle.md | 371 ++ .../kotlin/docs/components/schemas/File.md | 175 + .../components/schemas/FileSchemaTestClass.md | 240 + .../kotlin/docs/components/schemas/Foo.md | 129 + .../docs/components/schemas/FormatTest.md | 1696 +++++++ .../docs/components/schemas/FromSchema.md | 214 + .../kotlin/docs/components/schemas/Fruit.md | 251 + .../docs/components/schemas/FruitReq.md | 207 + .../kotlin/docs/components/schemas/GmFruit.md | 251 + .../components/schemas/GrandparentAnimal.md | 185 + .../components/schemas/HasOnlyReadOnly.md | 211 + .../components/schemas/HealthCheckResult.md | 231 + .../docs/components/schemas/IntegerEnum.md | 142 + .../docs/components/schemas/IntegerEnumBig.md | 142 + .../components/schemas/IntegerEnumOneValue.md | 134 + .../schemas/IntegerEnumWithDefaultValue.md | 143 + .../docs/components/schemas/IntegerMax10.md | 85 + .../docs/components/schemas/IntegerMin15.md | 85 + .../components/schemas/IsoscelesTriangle.md | 371 ++ .../kotlin/docs/components/schemas/Items.md | 160 + .../docs/components/schemas/ItemsSchema.md | 253 + .../components/schemas/JSONPatchRequest.md | 282 ++ .../schemas/JSONPatchRequestAddReplaceTest.md | 678 +++ .../schemas/JSONPatchRequestMoveCopy.md | 552 +++ .../schemas/JSONPatchRequestRemove.md | 437 ++ .../kotlin/docs/components/schemas/Mammal.md | 169 + .../kotlin/docs/components/schemas/MapTest.md | 753 +++ ...dPropertiesAndAdditionalPropertiesClass.md | 345 ++ .../kotlin/docs/components/schemas/Money.md | 347 ++ .../schemas/MultiPropertiesSchema.md | 463 ++ .../docs/components/schemas/MyObjectDto.md | 293 ++ .../kotlin/docs/components/schemas/Name.md | 354 ++ .../schemas/NoAdditionalProperties.md | 357 ++ .../docs/components/schemas/NullableClass.md | 2041 ++++++++ .../docs/components/schemas/NullableShape.md | 210 + .../docs/components/schemas/NullableString.md | 110 + .../docs/components/schemas/NumberOnly.md | 172 + .../docs/components/schemas/NumberSchema.md | 52 + .../schemas/NumberWithExclusiveMinMax.md | 85 + .../schemas/NumberWithValidations.md | 85 + .../schemas/ObjWithRequiredProps.md | 186 + .../schemas/ObjWithRequiredPropsBase.md | 185 + .../components/schemas/ObjectInterface.md | 52 + .../ObjectModelWithArgAndArgsProperties.md | 259 + .../schemas/ObjectModelWithRefProps.md | 139 + ...ithAllOfWithReqTestPropFromUnsetAddProp.md | 350 ++ .../schemas/ObjectWithCollidingProperties.md | 210 + .../schemas/ObjectWithDecimalProperties.md | 187 + .../ObjectWithDifficultlyNamedProps.md | 276 ++ .../ObjectWithInlineCompositionProperty.md | 362 ++ .../ObjectWithInvalidNamedRefedProperties.md | 196 + .../ObjectWithNonIntersectingValues.md | 205 + .../schemas/ObjectWithOnlyOptionalProps.md | 478 ++ .../schemas/ObjectWithOptionalTestProp.md | 169 + .../schemas/ObjectWithValidations.md | 61 + .../kotlin/docs/components/schemas/Order.md | 438 ++ .../schemas/PaginatedResultMyObjectDto.md | 458 ++ .../docs/components/schemas/ParentPet.md | 61 + .../kotlin/docs/components/schemas/Pet.md | 652 +++ .../kotlin/docs/components/schemas/Pig.md | 169 + .../kotlin/docs/components/schemas/Player.md | 174 + .../docs/components/schemas/PublicKey.md | 172 + .../docs/components/schemas/Quadrilateral.md | 169 + .../schemas/QuadrilateralInterface.md | 386 ++ .../docs/components/schemas/ReadOnlyFirst.md | 211 + .../kotlin/docs/components/schemas/RefPet.md | 22 + .../schemas/ReqPropsFromExplicitAddProps.md | 211 + .../schemas/ReqPropsFromTrueAddProps.md | 344 ++ .../schemas/ReqPropsFromUnsetAddProps.md | 210 + .../docs/components/schemas/ReturnSchema.md | 257 + .../components/schemas/ScaleneTriangle.md | 371 ++ .../components/schemas/Schema200Response.md | 297 ++ .../schemas/SelfReferencingArrayModel.md | 119 + .../schemas/SelfReferencingObjectModel.md | 122 + .../kotlin/docs/components/schemas/Shape.md | 169 + .../docs/components/schemas/ShapeOrNull.md | 210 + .../components/schemas/SimpleQuadrilateral.md | 371 ++ .../docs/components/schemas/SomeObject.md | 169 + .../components/schemas/SpecialModelname.md | 172 + .../components/schemas/StringBooleanMap.md | 159 + .../docs/components/schemas/StringEnum.md | 143 + .../schemas/StringEnumWithDefaultValue.md | 101 + .../docs/components/schemas/StringSchema.md | 52 + .../schemas/StringWithValidation.md | 84 + .../kotlin/docs/components/schemas/Tag.md | 214 + .../docs/components/schemas/Triangle.md | 169 + .../components/schemas/TriangleInterface.md | 386 ++ .../docs/components/schemas/UUIDString.md | 85 + .../kotlin/docs/components/schemas/User.md | 1109 +++++ .../kotlin/docs/components/schemas/Whale.md | 316 ++ .../kotlin/docs/components/schemas/Zebra.md | 456 ++ .../docs/components/securityschemes/ApiKey.md | 22 + .../components/securityschemes/ApiKeyQuery.md | 22 + .../components/securityschemes/BearerTest.md | 22 + .../securityschemes/HttpBasicTest.md | 22 + .../securityschemes/HttpSignatureTest.md | 22 + .../securityschemes/OpenIdConnectTest.md | 22 + .../securityschemes/PetstoreAuth.md | 22 + .../anotherfakedummy/AnotherfakedummyPatch.md | 188 + .../patch/AnotherfakedummyPatchRequestBody.md | 17 + .../patch/AnotherfakedummyPatchResponses.md | 29 + .../AnotherfakedummyPatchCode200Response.md | 87 + .../applicationjson/ApplicationjsonSchema.md | 19 + .../CommonparamsubdirDelete.md | 189 + .../commonparamsubdir/CommonparamsubdirGet.md | 189 + .../CommonparamsubdirPost.md | 189 + ...CommonparamsubdirDeleteHeaderParameters.md | 252 + .../CommonparamsubdirDeletePathParameters.md | 269 ++ .../CommonparamsubdirDeleteResponses.md | 29 + .../delete/parameters/parameter0/Schema0.md | 49 + .../delete/parameters/parameter1/Schema1.md | 96 + .../CommonparamsubdirDeleteCode200Response.md | 17 + .../get/CommonparamsubdirGetPathParameters.md | 269 ++ .../CommonparamsubdirGetQueryParameters.md | 252 + .../get/CommonparamsubdirGetResponses.md | 29 + .../get/parameters/parameter0/Schema0.md | 49 + .../CommonparamsubdirGetCode200Response.md | 17 + .../routeparameter0/RouteParamSchema0.md | 96 + .../CommonparamsubdirPostHeaderParameters.md | 252 + .../CommonparamsubdirPostPathParameters.md | 269 ++ .../post/CommonparamsubdirPostResponses.md | 29 + .../post/parameters/parameter0/Schema0.md | 49 + .../CommonparamsubdirPostCode200Response.md | 17 + .../kotlin/docs/paths/fake/FakeDelete.md | 255 + .../kotlin/docs/paths/fake/FakeGet.md | 156 + .../kotlin/docs/paths/fake/FakePatch.md | 188 + .../kotlin/docs/paths/fake/FakePost.md | 164 + .../fake/delete/FakeDeleteHeaderParameters.md | 274 ++ .../fake/delete/FakeDeleteQueryParameters.md | 321 ++ .../paths/fake/delete/FakeDeleteResponses.md | 29 + .../fake/delete/FakeDeleteSecurityInfo.md | 40 + .../delete/parameters/parameter0/Schema0.md | 49 + .../delete/parameters/parameter1/Schema1.md | 96 + .../delete/parameters/parameter2/Schema2.md | 49 + .../delete/parameters/parameter3/Schema3.md | 49 + .../delete/parameters/parameter4/Schema4.md | 96 + .../delete/parameters/parameter5/Schema5.md | 49 + .../responses/FakeDeleteCode200Response.md | 17 + .../FakeDeleteSecurityRequirementObject0.md | 15 + .../paths/fake/get/FakeGetHeaderParameters.md | 260 + .../paths/fake/get/FakeGetQueryParameters.md | 278 ++ .../docs/paths/fake/get/FakeGetRequestBody.md | 90 + .../docs/paths/fake/get/FakeGetResponses.md | 29 + .../fake/get/parameters/parameter0/Schema0.md | 205 + .../fake/get/parameters/parameter1/Schema1.md | 98 + .../fake/get/parameters/parameter2/Schema2.md | 205 + .../fake/get/parameters/parameter3/Schema3.md | 98 + .../fake/get/parameters/parameter4/Schema4.md | 135 + .../fake/get/parameters/parameter5/Schema5.md | 109 + .../ApplicationxwwwformurlencodedSchema.md | 422 ++ .../get/responses/FakeGetCode200Response.md | 17 + .../get/responses/FakeGetCode404Response.md | 87 + .../applicationjson/ApplicationjsonSchema.md | 49 + .../paths/fake/patch/FakePatchRequestBody.md | 17 + .../paths/fake/patch/FakePatchResponses.md | 29 + .../responses/FakePatchCode200Response.md | 87 + .../applicationjson/ApplicationjsonSchema.md | 19 + .../paths/fake/post/FakePostRequestBody.md | 90 + .../docs/paths/fake/post/FakePostResponses.md | 29 + .../paths/fake/post/FakePostSecurityInfo.md | 40 + .../ApplicationxwwwformurlencodedSchema.md | 1331 +++++ .../post/responses/FakePostCode200Response.md | 17 + .../post/responses/FakePostCode404Response.md | 32 + .../FakePostSecurityRequirementObject0.md | 15 + ...additionalpropertieswitharrayofenumsGet.md | 148 + ...ropertieswitharrayofenumsGetRequestBody.md | 90 + ...lpropertieswitharrayofenumsGetResponses.md | 29 + .../applicationjson/ApplicationjsonSchema.md | 19 + ...rtieswitharrayofenumsGetCode200Response.md | 87 + .../applicationjson/ApplicationjsonSchema.md | 19 + .../FakebodywithfileschemaPut.md | 188 + .../FakebodywithfileschemaPutRequestBody.md | 90 + .../put/FakebodywithfileschemaPutResponses.md | 29 + .../applicationjson/ApplicationjsonSchema.md | 19 + ...akebodywithfileschemaPutCode200Response.md | 17 + .../FakebodywithqueryparamsPut.md | 249 + ...kebodywithqueryparamsPutQueryParameters.md | 268 + .../FakebodywithqueryparamsPutRequestBody.md | 90 + .../FakebodywithqueryparamsPutResponses.md | 29 + .../put/parameters/parameter0/Schema0.md | 49 + .../applicationjson/ApplicationjsonSchema.md | 19 + ...kebodywithqueryparamsPutCode200Response.md | 17 + .../FakecasesensitiveparamsPut.md | 189 + ...kecasesensitiveparamsPutQueryParameters.md | 375 ++ .../FakecasesensitiveparamsPutResponses.md | 29 + .../put/parameters/parameter0/Schema0.md | 49 + .../put/parameters/parameter1/Schema1.md | 49 + .../put/parameters/parameter2/Schema2.md | 49 + ...kecasesensitiveparamsPutCode200Response.md | 17 + .../FakeclassnametestPatch.md | 203 + .../FakeclassnametestPatchRequestBody.md | 17 + .../patch/FakeclassnametestPatchResponses.md | 29 + .../FakeclassnametestPatchSecurityInfo.md | 40 + .../FakeclassnametestPatchCode200Response.md | 87 + .../applicationjson/ApplicationjsonSchema.md | 19 + ...nametestPatchSecurityRequirementObject0.md | 15 + .../FakedeletecoffeeidDelete.md | 189 + .../FakedeletecoffeeidDeletePathParameters.md | 268 + .../FakedeletecoffeeidDeleteResponses.md | 40 + .../delete/parameters/parameter0/Schema0.md | 49 + ...FakedeletecoffeeidDeleteCode200Response.md | 17 + ...deletecoffeeidDeleteCodedefaultResponse.md | 32 + .../docs/paths/fakehealth/FakehealthGet.md | 144 + .../fakehealth/get/FakehealthGetResponses.md | 29 + .../responses/FakehealthGetCode200Response.md | 87 + .../applicationjson/ApplicationjsonSchema.md | 19 + .../FakeinlineadditionalpropertiesPost.md | 186 + ...lineadditionalpropertiesPostRequestBody.md | 90 + ...inlineadditionalpropertiesPostResponses.md | 29 + .../applicationjson/ApplicationjsonSchema.md | 156 + ...additionalpropertiesPostCode200Response.md | 17 + .../FakeinlinecompositionPost.md | 155 + ...akeinlinecompositionPostQueryParameters.md | 264 + .../FakeinlinecompositionPostRequestBody.md | 128 + .../FakeinlinecompositionPostResponses.md | 29 + .../post/parameters/parameter0/Schema0.md | 236 + .../post/parameters/parameter1/Schema1.md | 359 ++ .../applicationjson/ApplicationjsonSchema.md | 236 + .../MultipartformdataSchema.md | 359 ++ ...akeinlinecompositionPostCode200Response.md | 123 + .../applicationjson/ApplicationjsonSchema.md | 236 + .../MultipartformdataSchema.md | 359 ++ .../fakejsonformdata/FakejsonformdataGet.md | 146 + .../get/FakejsonformdataGetRequestBody.md | 90 + .../get/FakejsonformdataGetResponses.md | 29 + .../ApplicationxwwwformurlencodedSchema.md | 262 + .../FakejsonformdataGetCode200Response.md | 17 + .../paths/fakejsonpatch/FakejsonpatchPatch.md | 146 + .../patch/FakejsonpatchPatchRequestBody.md | 90 + .../patch/FakejsonpatchPatchResponses.md | 29 + .../ApplicationjsonpatchjsonSchema.md | 19 + .../FakejsonpatchPatchCode200Response.md | 17 + .../FakejsonwithcharsetPost.md | 148 + .../FakejsonwithcharsetPostRequestBody.md | 90 + .../post/FakejsonwithcharsetPostResponses.md | 29 + .../Applicationjsoncharsetutf8Schema.md | 144 + .../FakejsonwithcharsetPostCode200Response.md | 87 + .../Applicationjsoncharsetutf8Schema.md | 144 + ...FakemultiplerequestbodycontenttypesPost.md | 148 + ...erequestbodycontenttypesPostRequestBody.md | 128 + ...plerequestbodycontenttypesPostResponses.md | 29 + .../applicationjson/ApplicationjsonSchema.md | 166 + .../MultipartformdataSchema.md | 166 + ...uestbodycontenttypesPostCode200Response.md | 87 + .../applicationjson/ApplicationjsonSchema.md | 144 + .../FakemultipleresponsebodiesGet.md | 150 + .../FakemultipleresponsebodiesGetResponses.md | 40 + ...ultipleresponsebodiesGetCode200Response.md | 87 + ...ultipleresponsebodiesGetCode202Response.md | 87 + .../applicationjson/ApplicationjsonSchema.md | 144 + .../applicationjson/ApplicationjsonSchema.md | 144 + .../FakemultiplesecuritiesGet.md | 163 + .../get/FakemultiplesecuritiesGetResponses.md | 29 + .../FakemultiplesecuritiesGetSecurityInfo.md | 44 + ...akemultiplesecuritiesGetCode200Response.md | 87 + .../applicationjson/ApplicationjsonSchema.md | 144 + ...securitiesGetSecurityRequirementObject0.md | 15 + ...securitiesGetSecurityRequirementObject1.md | 15 + ...securitiesGetSecurityRequirementObject2.md | 15 + .../paths/fakeobjinquery/FakeobjinqueryGet.md | 145 + .../get/FakeobjinqueryGetQueryParameters.md | 258 + .../get/FakeobjinqueryGetResponses.md | 29 + .../get/parameters/parameter0/Schema0.md | 166 + .../FakeobjinqueryGetCode200Response.md | 17 + .../Fakeparametercollisions1ababselfabPost.md | 211 + ...llisions1ababselfabPostCookieParameters.md | 267 + ...llisions1ababselfabPostHeaderParameters.md | 263 + ...collisions1ababselfabPostPathParameters.md | 808 ++++ ...ollisions1ababselfabPostQueryParameters.md | 267 + ...tercollisions1ababselfabPostRequestBody.md | 90 + ...metercollisions1ababselfabPostResponses.md | 29 + .../post/parameters/parameter0/Schema0.md | 49 + .../post/parameters/parameter1/Schema1.md | 49 + .../post/parameters/parameter10/Schema10.md | 49 + .../post/parameters/parameter11/Schema11.md | 49 + .../post/parameters/parameter12/Schema12.md | 49 + .../post/parameters/parameter13/Schema13.md | 49 + .../post/parameters/parameter14/Schema14.md | 49 + .../post/parameters/parameter15/Schema15.md | 49 + .../post/parameters/parameter16/Schema16.md | 49 + .../post/parameters/parameter17/Schema17.md | 49 + .../post/parameters/parameter18/Schema18.md | 49 + .../post/parameters/parameter2/Schema2.md | 49 + .../post/parameters/parameter3/Schema3.md | 49 + .../post/parameters/parameter4/Schema4.md | 49 + .../post/parameters/parameter5/Schema5.md | 49 + .../post/parameters/parameter6/Schema6.md | 49 + .../post/parameters/parameter7/Schema7.md | 49 + .../post/parameters/parameter8/Schema8.md | 49 + .../post/parameters/parameter9/Schema9.md | 49 + .../applicationjson/ApplicationjsonSchema.md | 144 + ...ollisions1ababselfabPostCode200Response.md | 87 + .../applicationjson/ApplicationjsonSchema.md | 144 + .../FakepemcontenttypeGet.md | 148 + .../get/FakepemcontenttypeGetRequestBody.md | 90 + .../get/FakepemcontenttypeGetResponses.md | 29 + .../ApplicationxpemfileSchema.md | 49 + .../FakepemcontenttypeGetCode200Response.md | 87 + .../ApplicationxpemfileSchema.md | 49 + ...akepetiduploadimagewithrequiredfilePost.md | 203 + ...imagewithrequiredfilePostPathParameters.md | 271 ++ ...oadimagewithrequiredfilePostRequestBody.md | 90 + ...ploadimagewithrequiredfilePostResponses.md | 29 + ...adimagewithrequiredfilePostSecurityInfo.md | 40 + .../post/parameters/parameter0/Schema0.md | 49 + .../MultipartformdataSchema.md | 206 + ...magewithrequiredfilePostCode200Response.md | 87 + .../applicationjson/ApplicationjsonSchema.md | 19 + ...uiredfilePostSecurityRequirementObject0.md | 15 + .../FakequeryparamwithjsoncontenttypeGet.md | 185 + ...amwithjsoncontenttypeGetQueryParameters.md | 274 ++ ...eryparamwithjsoncontenttypeGetResponses.md | 29 + .../content/applicationjson/Schema0.md | 144 + ...amwithjsoncontenttypeGetCode200Response.md | 87 + .../applicationjson/ApplicationjsonSchema.md | 144 + .../fakeredirection/FakeredirectionGet.md | 146 + .../get/FakeredirectionGetResponses.md | 40 + .../FakeredirectionGetCode303Response.md | 32 + .../FakeredirectionGetCode3XXResponse.md | 32 + .../fakerefobjinquery/FakerefobjinqueryGet.md | 145 + .../FakerefobjinqueryGetQueryParameters.md | 258 + .../get/FakerefobjinqueryGetResponses.md | 29 + .../get/parameters/parameter0/Schema0.md | 19 + .../FakerefobjinqueryGetCode200Response.md | 17 + .../FakerefsarraymodelPost.md | 148 + .../post/FakerefsarraymodelPostRequestBody.md | 90 + .../post/FakerefsarraymodelPostResponses.md | 29 + .../applicationjson/ApplicationjsonSchema.md | 19 + .../FakerefsarraymodelPostCode200Response.md | 87 + .../applicationjson/ApplicationjsonSchema.md | 19 + .../FakerefsarrayofenumsPost.md | 148 + .../FakerefsarrayofenumsPostRequestBody.md | 90 + .../post/FakerefsarrayofenumsPostResponses.md | 29 + .../applicationjson/ApplicationjsonSchema.md | 19 + ...FakerefsarrayofenumsPostCode200Response.md | 87 + .../applicationjson/ApplicationjsonSchema.md | 19 + .../fakerefsboolean/FakerefsbooleanPost.md | 148 + .../post/FakerefsbooleanPostRequestBody.md | 90 + .../post/FakerefsbooleanPostResponses.md | 29 + .../applicationjson/ApplicationjsonSchema.md | 19 + .../FakerefsbooleanPostCode200Response.md | 87 + .../applicationjson/ApplicationjsonSchema.md | 19 + ...scomposedoneofnumberwithvalidationsPost.md | 148 + ...eofnumberwithvalidationsPostRequestBody.md | 90 + ...oneofnumberwithvalidationsPostResponses.md | 29 + .../applicationjson/ApplicationjsonSchema.md | 19 + ...umberwithvalidationsPostCode200Response.md | 87 + .../applicationjson/ApplicationjsonSchema.md | 19 + .../paths/fakerefsenum/FakerefsenumPost.md | 148 + .../post/FakerefsenumPostRequestBody.md | 90 + .../post/FakerefsenumPostResponses.md | 29 + .../applicationjson/ApplicationjsonSchema.md | 19 + .../FakerefsenumPostCode200Response.md | 87 + .../applicationjson/ApplicationjsonSchema.md | 19 + .../fakerefsmammal/FakerefsmammalPost.md | 179 + .../post/FakerefsmammalPostRequestBody.md | 90 + .../post/FakerefsmammalPostResponses.md | 29 + .../applicationjson/ApplicationjsonSchema.md | 19 + .../FakerefsmammalPostCode200Response.md | 87 + .../applicationjson/ApplicationjsonSchema.md | 19 + .../fakerefsnumber/FakerefsnumberPost.md | 148 + .../post/FakerefsnumberPostRequestBody.md | 90 + .../post/FakerefsnumberPostResponses.md | 29 + .../applicationjson/ApplicationjsonSchema.md | 19 + .../FakerefsnumberPostCode200Response.md | 87 + .../applicationjson/ApplicationjsonSchema.md | 19 + .../FakerefsobjectmodelwithrefpropsPost.md | 148 + ...sobjectmodelwithrefpropsPostRequestBody.md | 90 + ...efsobjectmodelwithrefpropsPostResponses.md | 29 + .../applicationjson/ApplicationjsonSchema.md | 19 + ...ectmodelwithrefpropsPostCode200Response.md | 87 + .../applicationjson/ApplicationjsonSchema.md | 19 + .../fakerefsstring/FakerefsstringPost.md | 148 + .../post/FakerefsstringPostRequestBody.md | 90 + .../post/FakerefsstringPostResponses.md | 29 + .../applicationjson/ApplicationjsonSchema.md | 19 + .../FakerefsstringPostCode200Response.md | 87 + .../applicationjson/ApplicationjsonSchema.md | 19 + .../FakeresponsewithoutschemaGet.md | 142 + .../FakeresponsewithoutschemaGetResponses.md | 29 + ...responsewithoutschemaGetCode200Response.md | 32 + .../FaketestqueryparamtersPut.md | 210 + ...aketestqueryparamtersPutQueryParameters.md | 1419 ++++++ .../put/FaketestqueryparamtersPutResponses.md | 29 + .../put/parameters/parameter0/Schema0.md | 156 + .../put/parameters/parameter1/Schema1.md | 156 + .../put/parameters/parameter2/Schema2.md | 156 + .../put/parameters/parameter3/Schema3.md | 156 + .../put/parameters/parameter4/Schema4.md | 156 + .../put/parameters/parameter5/Schema5.md | 19 + ...aketestqueryparamtersPutCode200Response.md | 17 + .../FakeuploaddownloadfilePost.md | 184 + .../FakeuploaddownloadfilePostRequestBody.md | 90 + .../FakeuploaddownloadfilePostResponses.md | 29 + .../ApplicationoctetstreamSchema.md | 28 + ...keuploaddownloadfilePostCode200Response.md | 87 + .../ApplicationoctetstreamSchema.md | 28 + .../fakeuploadfile/FakeuploadfilePost.md | 148 + .../post/FakeuploadfilePostRequestBody.md | 90 + .../post/FakeuploadfilePostResponses.md | 29 + .../MultipartformdataSchema.md | 206 + .../FakeuploadfilePostCode200Response.md | 87 + .../applicationjson/ApplicationjsonSchema.md | 19 + .../fakeuploadfiles/FakeuploadfilesPost.md | 148 + .../post/FakeuploadfilesPostRequestBody.md | 90 + .../post/FakeuploadfilesPostResponses.md | 29 + .../MultipartformdataSchema.md | 252 + .../FakeuploadfilesPostCode200Response.md | 87 + .../applicationjson/ApplicationjsonSchema.md | 19 + .../FakewildcardresponsesGet.md | 163 + .../get/FakewildcardresponsesGetResponses.md | 62 + ...FakewildcardresponsesGetCode1XXResponse.md | 87 + ...FakewildcardresponsesGetCode200Response.md | 87 + ...FakewildcardresponsesGetCode2XXResponse.md | 87 + ...FakewildcardresponsesGetCode3XXResponse.md | 87 + ...FakewildcardresponsesGetCode4XXResponse.md | 87 + ...FakewildcardresponsesGetCode5XXResponse.md | 87 + .../applicationjson/ApplicationjsonSchema.md | 144 + .../applicationjson/ApplicationjsonSchema.md | 144 + .../applicationjson/ApplicationjsonSchema.md | 144 + .../applicationjson/ApplicationjsonSchema.md | 144 + .../applicationjson/ApplicationjsonSchema.md | 144 + .../applicationjson/ApplicationjsonSchema.md | 144 + .../petstore/kotlin/docs/paths/foo/FooGet.md | 143 + .../docs/paths/foo/get/FooGetResponses.md | 29 + .../docs/paths/foo/get/FooGetServerInfo.md | 62 + .../responses/FooGetCodedefaultResponse.md | 87 + .../applicationjson/ApplicationjsonSchema.md | 134 + .../paths/foo/get/servers/FooGetServer0.md | 14 + .../paths/foo/get/servers/FooGetServer1.md | 16 + .../servers/server1/FooGetServer1Variables.md | 355 ++ .../petstore/kotlin/docs/paths/pet/PetPost.md | 238 + .../petstore/kotlin/docs/paths/pet/PetPut.md | 234 + .../docs/paths/pet/post/PetPostRequestBody.md | 17 + .../docs/paths/pet/post/PetPostResponses.md | 29 + .../paths/pet/post/PetPostSecurityInfo.md | 44 + .../post/responses/PetPostCode200Response.md | 17 + .../post/responses/PetPostCode405Response.md | 32 + .../PetPostSecurityRequirementObject0.md | 15 + .../PetPostSecurityRequirementObject1.md | 15 + .../PetPostSecurityRequirementObject2.md | 15 + .../docs/paths/pet/put/PetPutRequestBody.md | 17 + .../docs/paths/pet/put/PetPutResponses.md | 10 + .../docs/paths/pet/put/PetPutSecurityInfo.md | 42 + .../put/responses/PetPutCode400Response.md | 32 + .../put/responses/PetPutCode404Response.md | 32 + .../put/responses/PetPutCode405Response.md | 32 + .../PetPutSecurityRequirementObject0.md | 15 + .../PetPutSecurityRequirementObject1.md | 15 + .../petfindbystatus/PetfindbystatusGet.md | 209 + .../PetfindbystatusServerInfo.md | 62 + .../get/PetfindbystatusGetQueryParameters.md | 271 ++ .../get/PetfindbystatusGetResponses.md | 29 + .../get/PetfindbystatusGetSecurityInfo.md | 44 + .../get/parameters/parameter0/Schema0.md | 206 + .../PetfindbystatusGetCode200Response.md | 17 + .../PetfindbystatusGetCode400Response.md | 32 + ...ndbystatusGetSecurityRequirementObject0.md | 15 + ...ndbystatusGetSecurityRequirementObject1.md | 15 + ...ndbystatusGetSecurityRequirementObject2.md | 15 + .../servers/PetfindbystatusServer0.md | 14 + .../servers/PetfindbystatusServer1.md | 16 + .../PetfindbystatusServer1Variables.md | 355 ++ .../paths/petfindbytags/PetfindbytagsGet.md | 206 + .../get/PetfindbytagsGetQueryParameters.md | 271 ++ .../get/PetfindbytagsGetResponses.md | 29 + .../get/PetfindbytagsGetSecurityInfo.md | 42 + .../get/parameters/parameter0/Schema0.md | 156 + .../PetfindbytagsGetCode200Response.md | 17 + .../PetfindbytagsGetCode400Response.md | 32 + ...findbytagsGetSecurityRequirementObject0.md | 15 + ...findbytagsGetSecurityRequirementObject1.md | 15 + .../docs/paths/petpetid/PetpetidDelete.md | 207 + .../kotlin/docs/paths/petpetid/PetpetidGet.md | 211 + .../docs/paths/petpetid/PetpetidPost.md | 207 + .../delete/PetpetidDeleteHeaderParameters.md | 252 + .../delete/PetpetidDeletePathParameters.md | 271 ++ .../delete/PetpetidDeleteResponses.md | 10 + .../delete/PetpetidDeleteSecurityInfo.md | 42 + .../delete/parameters/parameter0/Schema0.md | 49 + .../delete/parameters/parameter1/Schema1.md | 49 + .../PetpetidDeleteCode400Response.md | 32 + ...etpetidDeleteSecurityRequirementObject0.md | 15 + ...etpetidDeleteSecurityRequirementObject1.md | 15 + .../petpetid/get/PetpetidGetPathParameters.md | 271 ++ .../petpetid/get/PetpetidGetResponses.md | 29 + .../petpetid/get/PetpetidGetSecurityInfo.md | 40 + .../get/parameters/parameter0/Schema0.md | 49 + .../responses/PetpetidGetCode200Response.md | 123 + .../responses/PetpetidGetCode400Response.md | 32 + .../responses/PetpetidGetCode404Response.md | 32 + .../applicationjson/ApplicationjsonSchema.md | 19 + .../applicationxml/ApplicationxmlSchema.md | 19 + .../PetpetidGetSecurityRequirementObject0.md | 15 + .../post/PetpetidPostPathParameters.md | 271 ++ .../petpetid/post/PetpetidPostRequestBody.md | 90 + .../petpetid/post/PetpetidPostResponses.md | 10 + .../petpetid/post/PetpetidPostSecurityInfo.md | 42 + .../post/parameters/parameter0/Schema0.md | 49 + .../ApplicationxwwwformurlencodedSchema.md | 214 + .../responses/PetpetidPostCode405Response.md | 32 + .../PetpetidPostSecurityRequirementObject0.md | 15 + .../PetpetidPostSecurityRequirementObject1.md | 15 + .../PetpetiduploadimagePost.md | 203 + .../PetpetiduploadimagePostPathParameters.md | 271 ++ .../PetpetiduploadimagePostRequestBody.md | 90 + .../post/PetpetiduploadimagePostResponses.md | 29 + .../PetpetiduploadimagePostSecurityInfo.md | 40 + .../post/parameters/parameter0/Schema0.md | 49 + .../MultipartformdataSchema.md | 190 + .../PetpetiduploadimagePostCode200Response.md | 17 + ...loadimagePostSecurityRequirementObject0.md | 15 + .../kotlin/docs/paths/solidus/SolidusGet.md | 142 + .../paths/solidus/get/SolidusGetResponses.md | 29 + .../responses/SolidusGetCode200Response.md | 17 + .../paths/storeinventory/StoreinventoryGet.md | 158 + .../get/StoreinventoryGetResponses.md | 29 + .../get/StoreinventoryGetSecurityInfo.md | 40 + .../StoreinventoryGetCode200Response.md | 17 + ...einventoryGetSecurityRequirementObject0.md | 15 + .../docs/paths/storeorder/StoreorderPost.md | 206 + .../post/StoreorderPostRequestBody.md | 90 + .../post/StoreorderPostResponses.md | 29 + .../applicationjson/ApplicationjsonSchema.md | 19 + .../StoreorderPostCode200Response.md | 123 + .../StoreorderPostCode400Response.md | 32 + .../applicationjson/ApplicationjsonSchema.md | 19 + .../applicationxml/ApplicationxmlSchema.md | 19 + .../StoreorderorderidDelete.md | 188 + .../storeorderorderid/StoreorderorderidGet.md | 196 + .../StoreorderorderidDeletePathParameters.md | 268 + .../StoreorderorderidDeleteResponses.md | 10 + .../delete/parameters/parameter0/Schema0.md | 49 + .../StoreorderorderidDeleteCode400Response.md | 32 + .../StoreorderorderidDeleteCode404Response.md | 32 + .../get/StoreorderorderidGetPathParameters.md | 271 ++ .../get/StoreorderorderidGetResponses.md | 29 + .../get/parameters/parameter0/Schema0.md | 83 + .../StoreorderorderidGetCode200Response.md | 123 + .../StoreorderorderidGetCode400Response.md | 32 + .../StoreorderorderidGetCode404Response.md | 32 + .../applicationjson/ApplicationjsonSchema.md | 19 + .../applicationxml/ApplicationxmlSchema.md | 19 + .../kotlin/docs/paths/user/UserPost.md | 202 + .../paths/user/post/UserPostRequestBody.md | 90 + .../docs/paths/user/post/UserPostResponses.md | 29 + .../applicationjson/ApplicationjsonSchema.md | 19 + .../responses/UserPostCodedefaultResponse.md | 32 + .../UsercreatewitharrayPost.md | 224 + .../UsercreatewitharrayPostRequestBody.md | 17 + .../post/UsercreatewitharrayPostResponses.md | 29 + ...rcreatewitharrayPostCodedefaultResponse.md | 32 + .../UsercreatewithlistPost.md | 224 + .../post/UsercreatewithlistPostRequestBody.md | 17 + .../post/UsercreatewithlistPostResponses.md | 29 + ...ercreatewithlistPostCodedefaultResponse.md | 32 + .../docs/paths/userlogin/UserloginGet.md | 198 + .../get/UserloginGetQueryParameters.md | 304 ++ .../userlogin/get/UserloginGetResponses.md | 29 + .../get/parameters/parameter0/Schema0.md | 49 + .../get/parameters/parameter1/Schema1.md | 49 + .../responses/UserloginGetCode200Response.md | 123 + .../responses/UserloginGetCode400Response.md | 32 + ...serloginGetCode200ResponseHeadersSchema.md | 389 ++ .../applicationjson/ApplicationjsonSchema.md | 49 + .../applicationxml/ApplicationxmlSchema.md | 49 + .../xexpiresafter/XExpiresAfterSchema.md | 49 + .../applicationjson/XRateLimitSchema.md | 49 + .../docs/paths/userlogout/UserlogoutGet.md | 142 + .../userlogout/get/UserlogoutGetResponses.md | 29 + .../UserlogoutGetCodedefaultResponse.md | 17 + .../paths/userusername/UserusernameDelete.md | 189 + .../paths/userusername/UserusernameGet.md | 196 + .../paths/userusername/UserusernamePut.md | 252 + .../UserusernameDeletePathParameters.md | 268 + .../delete/UserusernameDeleteResponses.md | 29 + .../UserusernameDeleteCode200Response.md | 17 + .../UserusernameDeleteCode404Response.md | 32 + .../get/UserusernameGetPathParameters.md | 268 + .../get/UserusernameGetResponses.md | 29 + .../UserusernameGetCode200Response.md | 123 + .../UserusernameGetCode400Response.md | 32 + .../UserusernameGetCode404Response.md | 32 + .../applicationjson/ApplicationjsonSchema.md | 19 + .../applicationxml/ApplicationxmlSchema.md | 19 + .../put/UserusernamePutPathParameters.md | 268 + .../put/UserusernamePutRequestBody.md | 90 + .../put/UserusernamePutResponses.md | 10 + .../applicationjson/ApplicationjsonSchema.md | 19 + .../UserusernamePutCode400Response.md | 32 + .../UserusernamePutCode404Response.md | 32 + .../kotlin/docs/servers/RootServer0.md | 22 + .../kotlin/docs/servers/RootServer1.md | 22 + .../kotlin/docs/servers/RootServer2.md | 20 + .../rootserver0/RootServer0Variables.md | 486 ++ .../rootserver1/RootServer1Variables.md | 355 ++ .../petstore/kotlin/settings.gradle.kts | 2 + .../client/RootServerInfo.kt | 77 + .../client/apiclient/ApiClient.kt | 39 + .../client/apis/paths/Anotherfakedummy.kt | 14 + .../client/apis/paths/Commonparamsubdir.kt | 18 + .../client/apis/paths/Fake.kt | 20 + ...akeadditionalpropertieswitharrayofenums.kt | 14 + .../apis/paths/Fakebodywithfileschema.kt | 14 + .../apis/paths/Fakebodywithqueryparams.kt | 14 + .../apis/paths/Fakecasesensitiveparams.kt | 14 + .../client/apis/paths/Fakeclassnametest.kt | 14 + .../client/apis/paths/Fakedeletecoffeeid.kt | 14 + .../client/apis/paths/Fakehealth.kt | 14 + .../paths/Fakeinlineadditionalproperties.kt | 14 + .../apis/paths/Fakeinlinecomposition.kt | 14 + .../client/apis/paths/Fakejsonformdata.kt | 14 + .../client/apis/paths/Fakejsonpatch.kt | 14 + .../client/apis/paths/Fakejsonwithcharset.kt | 14 + .../Fakemultiplerequestbodycontenttypes.kt | 14 + .../apis/paths/Fakemultipleresponsebodies.kt | 14 + .../apis/paths/Fakemultiplesecurities.kt | 14 + .../client/apis/paths/Fakeobjinquery.kt | 14 + .../Fakeparametercollisions1ababselfab.kt | 14 + .../client/apis/paths/Fakepemcontenttype.kt | 14 + .../Fakepetiduploadimagewithrequiredfile.kt | 14 + .../Fakequeryparamwithjsoncontenttype.kt | 14 + .../client/apis/paths/Fakeredirection.kt | 14 + .../client/apis/paths/Fakerefobjinquery.kt | 14 + .../client/apis/paths/Fakerefsarraymodel.kt | 14 + .../client/apis/paths/Fakerefsarrayofenums.kt | 14 + .../client/apis/paths/Fakerefsboolean.kt | 14 + ...erefscomposedoneofnumberwithvalidations.kt | 14 + .../client/apis/paths/Fakerefsenum.kt | 14 + .../client/apis/paths/Fakerefsmammal.kt | 14 + .../client/apis/paths/Fakerefsnumber.kt | 14 + .../paths/Fakerefsobjectmodelwithrefprops.kt | 14 + .../client/apis/paths/Fakerefsstring.kt | 14 + .../apis/paths/Fakeresponsewithoutschema.kt | 14 + .../apis/paths/Faketestqueryparamters.kt | 14 + .../apis/paths/Fakeuploaddownloadfile.kt | 14 + .../client/apis/paths/Fakeuploadfile.kt | 14 + .../client/apis/paths/Fakeuploadfiles.kt | 14 + .../apis/paths/Fakewildcardresponses.kt | 14 + .../client/apis/paths/Foo.kt | 14 + .../client/apis/paths/Pet.kt | 16 + .../client/apis/paths/Petfindbystatus.kt | 14 + .../client/apis/paths/Petfindbytags.kt | 14 + .../client/apis/paths/Petpetid.kt | 18 + .../client/apis/paths/Petpetiduploadimage.kt | 14 + .../client/apis/paths/Solidus.kt | 14 + .../client/apis/paths/Storeinventory.kt | 14 + .../client/apis/paths/Storeorder.kt | 14 + .../client/apis/paths/Storeorderorderid.kt | 16 + .../client/apis/paths/User.kt | 14 + .../client/apis/paths/Usercreatewitharray.kt | 14 + .../client/apis/paths/Usercreatewithlist.kt | 14 + .../client/apis/paths/Userlogin.kt | 14 + .../client/apis/paths/Userlogout.kt | 14 + .../client/apis/paths/Userusername.kt | 18 + .../client/apis/tags/Anotherfake.kt | 14 + .../client/apis/tags/Default.kt | 14 + .../client/apis/tags/Fake.kt | 98 + .../client/apis/tags/Fakeclassnametags123.kt | 14 + .../client/apis/tags/Pet.kt | 30 + .../client/apis/tags/Store.kt | 20 + .../client/apis/tags/User.kt | 28 + .../headers/Int32JsonContentTypeHeader.kt | 31 + .../client/components/headers/NumberHeader.kt | 18 + .../headers/RefContentSchemaHeader.kt | 31 + .../components/headers/RefSchemaHeader.kt | 18 + .../components/headers/RefStringHeader.kt | 6 + .../client/components/headers/StringHeader.kt | 18 + .../Int32JsonContentTypeHeaderSchema.kt | 19 + .../numberheader/NumberHeaderSchema.kt | 19 + .../RefContentSchemaHeaderSchema.kt | 19 + .../refschemaheader/RefSchemaHeaderSchema.kt | 19 + .../stringheader/StringHeaderSchema.kt | 19 + .../ComponentRefSchemaStringWithValidation.kt | 35 + .../components/parameters/PathUserName.kt | 23 + .../components/parameters/RefPathUserName.kt | 6 + .../RefSchemaStringWithValidation.kt | 23 + .../applicationjson/ApplicationjsonSchema.kt | 19 + .../parameters/pathusername/Schema.kt | 19 + .../refschemastringwithvalidation/Schema.kt | 19 + .../client/components/requestbodies/Client.kt | 49 + .../client/components/requestbodies/Pet.kt | 71 + .../components/requestbodies/RefUserArray.kt | 6 + .../components/requestbodies/UserArray.kt | 49 + .../applicationjson/ApplicationjsonSchema.kt | 19 + .../applicationjson/ApplicationjsonSchema.kt | 19 + .../applicationxml/ApplicationxmlSchema.kt | 20 + .../applicationjson/ApplicationjsonSchema.kt | 148 + .../components/responses/HeadersWithNoBody.kt | 47 + .../responses/RefSuccessDescriptionOnly.kt | 6 + .../RefSuccessfulXmlAndJsonArrayOfPet.kt | 6 + .../responses/SuccessDescriptionOnly.kt | 45 + .../SuccessInlineContentAndHeader.kt | 65 + .../responses/SuccessWithJsonApiResponse.kt | 65 + .../SuccessfulXmlAndJsonArrayOfPet.kt | 81 + .../responses/headerswithnobody/Headers.kt | 18 + .../HeadersWithNoBodyHeadersSchema.kt | 191 + .../headerswithnobody/headers/Location.kt | 18 + .../headers/location/LocationSchema.kt | 19 + .../applicationjson/ApplicationjsonSchema.kt | 149 + .../applicationxml/ApplicationxmlSchema.kt | 148 + .../successinlinecontentandheader/Headers.kt | 18 + ...cessInlineContentAndHeaderHeadersSchema.kt | 191 + .../applicationjson/ApplicationjsonSchema.kt | 190 + .../headers/SomeHeader.kt | 18 + .../headers/someheader/SomeHeaderSchema.kt | 19 + .../successwithjsonapiresponse/Headers.kt | 26 + ...SuccessWithJsonApiResponseHeadersSchema.kt | 528 ++ .../applicationjson/ApplicationjsonSchema.kt | 19 + .../headers/Int32.kt | 7 + .../headers/NumberHeader.kt | 3 + .../headers/Refcontentschemaheader.kt | 7 + .../headers/Refschemaheader.kt | 7 + .../headers/StringHeader.kt | 7 + .../components/schemas/AbstractStepMessage.kt | 455 ++ .../schemas/AdditionalPropertiesClass.kt | 1405 ++++++ .../schemas/AdditionalPropertiesSchema.kt | 1309 +++++ .../AdditionalPropertiesWithArrayOfEnums.kt | 310 ++ .../client/components/schemas/Address.kt | 210 + .../client/components/schemas/Animal.kt | 323 ++ .../client/components/schemas/AnimalFarm.kt | 153 + .../components/schemas/AnyTypeAndFormat.kt | 3342 +++++++++++++ .../components/schemas/AnyTypeNotString.kt | 339 ++ .../components/schemas/ApiResponseSchema.kt | 289 ++ .../client/components/schemas/Apple.kt | 412 ++ .../client/components/schemas/AppleReq.kt | 265 + .../components/schemas/ArrayHoldingAnyType.kt | 201 + .../schemas/ArrayOfArrayOfNumberOnly.kt | 467 ++ .../client/components/schemas/ArrayOfEnums.kt | 166 + .../components/schemas/ArrayOfNumberOnly.kt | 345 ++ .../client/components/schemas/ArrayTest.kt | 899 ++++ .../schemas/ArrayWithValidationsInItems.kt | 258 + .../client/components/schemas/Banana.kt | 235 + .../client/components/schemas/BananaReq.kt | 283 ++ .../client/components/schemas/Bar.kt | 103 + .../client/components/schemas/BasquePig.kt | 304 ++ .../client/components/schemas/BooleanEnum.kt | 119 + .../components/schemas/BooleanSchema.kt | 19 + .../components/schemas/Capitalization.kt | 396 ++ .../client/components/schemas/Cat.kt | 503 ++ .../client/components/schemas/Category.kt | 341 ++ .../client/components/schemas/ChildCat.kt | 503 ++ .../client/components/schemas/ClassModel.kt | 401 ++ .../client/components/schemas/Client.kt | 206 + .../schemas/ComplexQuadrilateral.kt | 589 +++ ...omposedAnyOfDifferentTypesNoValidations.kt | 693 +++ .../components/schemas/ComposedArray.kt | 201 + .../client/components/schemas/ComposedBool.kt | 111 + .../client/components/schemas/ComposedNone.kt | 109 + .../components/schemas/ComposedNumber.kt | 129 + .../components/schemas/ComposedObject.kt | 138 + .../schemas/ComposedOneOfDifferentTypes.kt | 700 +++ .../components/schemas/ComposedString.kt | 110 + .../client/components/schemas/Currency.kt | 120 + .../client/components/schemas/DanishPig.kt | 304 ++ .../client/components/schemas/DateTimeTest.kt | 105 + .../schemas/DateTimeWithValidations.kt | 101 + .../components/schemas/DateWithValidations.kt | 101 + .../components/schemas/DecimalPayload.kt | 19 + .../client/components/schemas/Dog.kt | 503 ++ .../client/components/schemas/Drawing.kt | 656 +++ .../client/components/schemas/EnumArrays.kt | 542 +++ .../client/components/schemas/EnumClass.kt | 134 + .../client/components/schemas/EnumTest.kt | 1117 +++++ .../components/schemas/EquilateralTriangle.kt | 589 +++ .../client/components/schemas/File.kt | 208 + .../components/schemas/FileSchemaTestClass.kt | 345 ++ .../client/components/schemas/Foo.kt | 194 + .../client/components/schemas/FormatTest.kt | 2038 ++++++++ .../client/components/schemas/FromSchema.kt | 263 + .../client/components/schemas/Fruit.kt | 413 ++ .../client/components/schemas/FruitReq.kt | 343 ++ .../client/components/schemas/GmFruit.kt | 413 ++ .../components/schemas/GrandparentAnimal.kt | 217 + .../components/schemas/HasOnlyReadOnly.kt | 244 + .../components/schemas/HealthCheckResult.kt | 303 ++ .../client/components/schemas/IntegerEnum.kt | 206 + .../components/schemas/IntegerEnumBig.kt | 206 + .../components/schemas/IntegerEnumOneValue.kt | 196 + .../schemas/IntegerEnumWithDefaultValue.kt | 208 + .../client/components/schemas/IntegerMax10.kt | 116 + .../client/components/schemas/IntegerMin15.kt | 116 + .../components/schemas/IsoscelesTriangle.kt | 589 +++ .../client/components/schemas/Items.kt | 167 + .../client/components/schemas/ItemsSchema.kt | 282 ++ .../components/schemas/JSONPatchRequest.kt | 490 ++ .../schemas/JSONPatchRequestAddReplaceTest.kt | 520 ++ .../schemas/JSONPatchRequestMoveCopy.kt | 473 ++ .../schemas/JSONPatchRequestRemove.kt | 373 ++ .../client/components/schemas/Mammal.kt | 331 ++ .../client/components/schemas/MapTest.kt | 979 ++++ ...dPropertiesAndAdditionalPropertiesClass.kt | 396 ++ .../client/components/schemas/Money.kt | 277 ++ .../schemas/MultiPropertiesSchema.kt | 422 ++ .../client/components/schemas/MyObjectDto.kt | 208 + .../client/components/schemas/Name.kt | 512 ++ .../schemas/NoAdditionalProperties.kt | 294 ++ .../components/schemas/NullableClass.kt | 2834 +++++++++++ .../components/schemas/NullableShape.kt | 345 ++ .../components/schemas/NullableString.kt | 127 + .../client/components/schemas/NumberOnly.kt | 224 + .../client/components/schemas/NumberSchema.kt | 19 + .../schemas/NumberWithExclusiveMinMax.kt | 116 + .../schemas/NumberWithValidations.kt | 116 + .../schemas/ObjWithRequiredProps.kt | 220 + .../schemas/ObjWithRequiredPropsBase.kt | 217 + .../components/schemas/ObjectInterface.kt | 20 + .../ObjectModelWithArgAndArgsProperties.kt | 280 ++ .../schemas/ObjectModelWithRefProps.kt | 268 + ...ithAllOfWithReqTestPropFromUnsetAddProp.kt | 589 +++ .../schemas/ObjectWithCollidingProperties.kt | 246 + .../schemas/ObjectWithDecimalProperties.kt | 260 + .../ObjectWithDifficultlyNamedProps.kt | 306 ++ .../ObjectWithInlineCompositionProperty.kt | 602 +++ .../ObjectWithInvalidNamedRefedProperties.kt | 249 + .../ObjectWithNonIntersectingValues.kt | 256 + .../schemas/ObjectWithOnlyOptionalProps.kt | 463 ++ .../schemas/ObjectWithOptionalTestProp.kt | 206 + .../schemas/ObjectWithValidations.kt | 124 + .../client/components/schemas/Order.kt | 533 ++ .../schemas/PaginatedResultMyObjectDto.kt | 416 ++ .../client/components/schemas/ParentPet.kt | 126 + .../client/components/schemas/Pet.kt | 770 +++ .../client/components/schemas/Pig.kt | 330 ++ .../client/components/schemas/Player.kt | 235 + .../client/components/schemas/PublicKey.kt | 208 + .../components/schemas/Quadrilateral.kt | 330 ++ .../schemas/QuadrilateralInterface.kt | 570 +++ .../components/schemas/ReadOnlyFirst.kt | 244 + .../client/components/schemas/RefPet.kt | 18 + .../schemas/ReqPropsFromExplicitAddProps.kt | 272 ++ .../schemas/ReqPropsFromTrueAddProps.kt | 421 ++ .../schemas/ReqPropsFromUnsetAddProps.kt | 340 ++ .../client/components/schemas/ReturnSchema.kt | 407 ++ .../components/schemas/ScaleneTriangle.kt | 589 +++ .../components/schemas/Schema200Response.kt | 446 ++ .../schemas/SelfReferencingArrayModel.kt | 152 + .../schemas/SelfReferencingObjectModel.kt | 211 + .../client/components/schemas/Shape.kt | 330 ++ .../client/components/schemas/ShapeOrNull.kt | 345 ++ .../components/schemas/SimpleQuadrilateral.kt | 589 +++ .../client/components/schemas/SomeObject.kt | 329 ++ .../components/schemas/SpecialModelname.kt | 208 + .../components/schemas/StringBooleanMap.kt | 194 + .../client/components/schemas/StringEnum.kt | 180 + .../schemas/StringEnumWithDefaultValue.kt | 130 + .../client/components/schemas/StringSchema.kt | 19 + .../schemas/StringWithValidation.kt | 96 + .../client/components/schemas/Tag.kt | 263 + .../client/components/schemas/Triangle.kt | 331 ++ .../components/schemas/TriangleInterface.kt | 570 +++ .../client/components/schemas/UUIDString.kt | 98 + .../client/components/schemas/User.kt | 1227 +++++ .../client/components/schemas/Whale.kt | 382 ++ .../client/components/schemas/Zebra.kt | 512 ++ .../components/securityschemes/ApiKey.kt | 12 + .../components/securityschemes/ApiKeyQuery.kt | 12 + .../components/securityschemes/BearerTest.kt | 12 + .../securityschemes/HttpBasicTest.kt | 12 + .../securityschemes/HttpSignatureTest.kt | 9 + .../securityschemes/OpenIdConnectTest.kt | 9 + .../securityschemes/PetstoreAuth.kt | 10 + .../client/configurations/ApiConfiguration.kt | 500 ++ .../configurations/JsonSchemaKeywordFlags.kt | 334 ++ .../configurations/SchemaConfiguration.kt | 4 + .../contenttype/ContentTypeDeserializer.kt | 18 + .../client/contenttype/ContentTypeDetector.kt | 18 + .../contenttype/ContentTypeSerializer.kt | 18 + .../client/exceptions/ApiException.kt | 13 + .../client/exceptions/BaseException.kt | 8 + .../InvalidAdditionalPropertyException.kt | 8 + .../exceptions/NotImplementedException.kt | 8 + .../exceptions/UnsetPropertyException.kt | 8 + .../client/exceptions/ValidationException.kt | 8 + .../client/header/ContentHeader.kt | 59 + .../client/header/Header.kt | 14 + .../client/header/HeaderBase.kt | 18 + .../client/header/PrefixSeparatorIterator.kt | 27 + .../client/header/Rfc6570Serializer.kt | 197 + .../client/header/SchemaHeader.kt | 97 + .../client/header/StyleSerializer.kt | 99 + .../client/mediatype/Encoding.kt | 30 + .../client/mediatype/MediaType.kt | 16 + .../client/parameter/ContentParameter.kt | 30 + .../client/parameter/CookieSerializer.kt | 36 + .../client/parameter/HeadersSerializer.kt | 32 + .../client/parameter/Parameter.kt | 10 + .../client/parameter/ParameterBase.kt | 15 + .../client/parameter/ParameterInType.kt | 8 + .../client/parameter/ParameterStyle.kt | 11 + .../client/parameter/PathSerializer.kt | 30 + .../client/parameter/QuerySerializer.kt | 48 + .../client/parameter/SchemaParameter.kt | 60 + .../client/paths/Anotherfakedummy.kt | 5 + .../client/paths/Commonparamsubdir.kt | 5 + .../client/paths/Fake.kt | 5 + ...akeadditionalpropertieswitharrayofenums.kt | 5 + .../client/paths/Fakebodywithfileschema.kt | 5 + .../client/paths/Fakebodywithqueryparams.kt | 5 + .../client/paths/Fakecasesensitiveparams.kt | 5 + .../client/paths/Fakeclassnametest.kt | 5 + .../client/paths/Fakedeletecoffeeid.kt | 5 + .../client/paths/Fakehealth.kt | 5 + .../paths/Fakeinlineadditionalproperties.kt | 5 + .../client/paths/Fakeinlinecomposition.kt | 5 + .../client/paths/Fakejsonformdata.kt | 5 + .../client/paths/Fakejsonpatch.kt | 5 + .../client/paths/Fakejsonwithcharset.kt | 5 + .../Fakemultiplerequestbodycontenttypes.kt | 5 + .../paths/Fakemultipleresponsebodies.kt | 5 + .../client/paths/Fakemultiplesecurities.kt | 5 + .../client/paths/Fakeobjinquery.kt | 5 + .../Fakeparametercollisions1ababselfab.kt | 5 + .../client/paths/Fakepemcontenttype.kt | 5 + .../Fakepetiduploadimagewithrequiredfile.kt | 5 + .../Fakequeryparamwithjsoncontenttype.kt | 5 + .../client/paths/Fakeredirection.kt | 5 + .../client/paths/Fakerefobjinquery.kt | 5 + .../client/paths/Fakerefsarraymodel.kt | 5 + .../client/paths/Fakerefsarrayofenums.kt | 5 + .../client/paths/Fakerefsboolean.kt | 5 + ...erefscomposedoneofnumberwithvalidations.kt | 5 + .../client/paths/Fakerefsenum.kt | 5 + .../client/paths/Fakerefsmammal.kt | 5 + .../client/paths/Fakerefsnumber.kt | 5 + .../paths/Fakerefsobjectmodelwithrefprops.kt | 5 + .../client/paths/Fakerefsstring.kt | 5 + .../client/paths/Fakeresponsewithoutschema.kt | 5 + .../client/paths/Faketestqueryparamters.kt | 5 + .../client/paths/Fakeuploaddownloadfile.kt | 5 + .../client/paths/Fakeuploadfile.kt | 5 + .../client/paths/Fakeuploadfiles.kt | 5 + .../client/paths/Fakewildcardresponses.kt | 5 + .../client/paths/Foo.kt | 5 + .../client/paths/Pet.kt | 5 + .../client/paths/Petfindbystatus.kt | 5 + .../client/paths/Petfindbytags.kt | 5 + .../client/paths/Petpetid.kt | 5 + .../client/paths/Petpetiduploadimage.kt | 5 + .../client/paths/Solidus.kt | 5 + .../client/paths/Storeinventory.kt | 5 + .../client/paths/Storeorder.kt | 5 + .../client/paths/Storeorderorderid.kt | 5 + .../client/paths/User.kt | 5 + .../client/paths/Usercreatewitharray.kt | 5 + .../client/paths/Usercreatewithlist.kt | 5 + .../client/paths/Userlogin.kt | 5 + .../client/paths/Userlogout.kt | 5 + .../client/paths/Userusername.kt | 5 + .../anotherfakedummy/AnotherfakedummyPatch.kt | 183 + .../patch/AnotherfakedummyPatchRequestBody.kt | 7 + .../patch/AnotherfakedummyPatchResponses.kt | 53 + .../AnotherfakedummyPatchCode200Response.kt | 63 + .../applicationjson/ApplicationjsonSchema.kt | 19 + .../CommonparamsubdirDelete.kt | 205 + .../commonparamsubdir/CommonparamsubdirGet.kt | 206 + .../CommonparamsubdirPost.kt | 205 + ...CommonparamsubdirDeleteHeaderParameters.kt | 191 + .../CommonparamsubdirDeletePathParameters.kt | 211 + .../CommonparamsubdirDeleteResponses.kt | 53 + .../commonparamsubdir/delete/Parameters.kt | 32 + .../delete/parameters/Parameter0.kt | 23 + .../delete/parameters/Parameter1.kt | 23 + .../delete/parameters/parameter0/Schema0.kt | 19 + .../delete/parameters/parameter1/Schema1.kt | 114 + .../CommonparamsubdirDeleteCode200Response.kt | 7 + .../get/CommonparamsubdirGetPathParameters.kt | 211 + .../CommonparamsubdirGetQueryParameters.kt | 191 + .../get/CommonparamsubdirGetResponses.kt | 53 + .../paths/commonparamsubdir/get/Parameters.kt | 32 + .../get/parameters/Parameter0.kt | 23 + .../get/parameters/parameter0/Schema0.kt | 19 + .../CommonparamsubdirGetCode200Response.kt | 7 + .../parameters/RouteParameter0.kt | 23 + .../routeparameter0/RouteParamSchema0.kt | 114 + .../CommonparamsubdirPostHeaderParameters.kt | 191 + .../CommonparamsubdirPostPathParameters.kt | 211 + .../post/CommonparamsubdirPostResponses.kt | 53 + .../commonparamsubdir/post/Parameters.kt | 32 + .../post/parameters/Parameter0.kt | 23 + .../post/parameters/parameter0/Schema0.kt | 19 + .../CommonparamsubdirPostCode200Response.kt | 7 + .../client/paths/fake/FakeDelete.kt | 270 ++ .../client/paths/fake/FakeGet.kt | 198 + .../client/paths/fake/FakePatch.kt | 183 + .../client/paths/fake/FakePost.kt | 180 + .../fake/delete/FakeDeleteHeaderParameters.kt | 246 + .../fake/delete/FakeDeleteQueryParameters.kt | 351 ++ .../paths/fake/delete/FakeDeleteResponses.kt | 53 + .../fake/delete/FakeDeleteSecurityInfo.kt | 24 + .../client/paths/fake/delete/Parameters.kt | 40 + .../fake/delete/parameters/Parameter0.kt | 23 + .../fake/delete/parameters/Parameter1.kt | 23 + .../fake/delete/parameters/Parameter2.kt | 23 + .../fake/delete/parameters/Parameter3.kt | 23 + .../fake/delete/parameters/Parameter4.kt | 23 + .../fake/delete/parameters/Parameter5.kt | 23 + .../delete/parameters/parameter0/Schema0.kt | 19 + .../delete/parameters/parameter1/Schema1.kt | 114 + .../delete/parameters/parameter2/Schema2.kt | 19 + .../delete/parameters/parameter3/Schema3.kt | 19 + .../delete/parameters/parameter4/Schema4.kt | 114 + .../delete/parameters/parameter5/Schema5.kt | 19 + .../responses/FakeDeleteCode200Response.kt | 7 + .../FakeDeleteSecurityRequirementObject0.kt | 24 + .../paths/fake/get/FakeGetHeaderParameters.kt | 228 + .../paths/fake/get/FakeGetQueryParameters.kt | 344 ++ .../paths/fake/get/FakeGetRequestBody.kt | 49 + .../client/paths/fake/get/FakeGetResponses.kt | 66 + .../client/paths/fake/get/Parameters.kt | 40 + .../paths/fake/get/parameters/Parameter0.kt | 23 + .../paths/fake/get/parameters/Parameter1.kt | 23 + .../paths/fake/get/parameters/Parameter2.kt | 23 + .../paths/fake/get/parameters/Parameter3.kt | 23 + .../paths/fake/get/parameters/Parameter4.kt | 23 + .../paths/fake/get/parameters/Parameter5.kt | 23 + .../fake/get/parameters/parameter0/Schema0.kt | 253 + .../fake/get/parameters/parameter1/Schema1.kt | 124 + .../fake/get/parameters/parameter2/Schema2.kt | 253 + .../fake/get/parameters/parameter3/Schema3.kt | 124 + .../fake/get/parameters/parameter4/Schema4.kt | 187 + .../fake/get/parameters/parameter5/Schema5.kt | 142 + .../ApplicationxwwwformurlencodedSchema.kt | 553 +++ .../get/responses/FakeGetCode200Response.kt | 7 + .../get/responses/FakeGetCode404Response.kt | 63 + .../applicationjson/ApplicationjsonSchema.kt | 20 + .../paths/fake/patch/FakePatchRequestBody.kt | 7 + .../paths/fake/patch/FakePatchResponses.kt | 53 + .../responses/FakePatchCode200Response.kt | 63 + .../applicationjson/ApplicationjsonSchema.kt | 19 + .../paths/fake/post/FakePostRequestBody.kt | 49 + .../paths/fake/post/FakePostResponses.kt | 66 + .../paths/fake/post/FakePostSecurityInfo.kt | 24 + .../ApplicationxwwwformurlencodedSchema.kt | 1591 ++++++ .../post/responses/FakePostCode200Response.kt | 7 + .../post/responses/FakePostCode404Response.kt | 45 + .../FakePostSecurityRequirementObject0.kt | 24 + ...additionalpropertieswitharrayofenumsGet.kt | 152 + ...ropertieswitharrayofenumsGetRequestBody.kt | 49 + ...lpropertieswitharrayofenumsGetResponses.kt | 53 + .../applicationjson/ApplicationjsonSchema.kt | 19 + ...rtieswitharrayofenumsGetCode200Response.kt | 63 + .../applicationjson/ApplicationjsonSchema.kt | 19 + .../FakebodywithfileschemaPut.kt | 183 + .../FakebodywithfileschemaPutRequestBody.kt | 49 + .../put/FakebodywithfileschemaPutResponses.kt | 53 + .../applicationjson/ApplicationjsonSchema.kt | 19 + ...akebodywithfileschemaPutCode200Response.kt | 7 + .../FakebodywithqueryparamsPut.kt | 242 + ...kebodywithqueryparamsPutQueryParameters.kt | 205 + .../FakebodywithqueryparamsPutRequestBody.kt | 49 + .../FakebodywithqueryparamsPutResponses.kt | 53 + .../fakebodywithqueryparams/put/Parameters.kt | 20 + .../put/parameters/Parameter0.kt | 23 + .../put/parameters/parameter0/Schema0.kt | 19 + .../applicationjson/ApplicationjsonSchema.kt | 19 + ...kebodywithqueryparamsPutCode200Response.kt | 7 + .../FakecasesensitiveparamsPut.kt | 180 + ...kecasesensitiveparamsPutQueryParameters.kt | 343 ++ .../FakecasesensitiveparamsPutResponses.kt | 53 + .../fakecasesensitiveparams/put/Parameters.kt | 24 + .../put/parameters/Parameter0.kt | 23 + .../put/parameters/Parameter1.kt | 23 + .../put/parameters/Parameter2.kt | 23 + .../put/parameters/parameter0/Schema0.kt | 19 + .../put/parameters/parameter1/Schema1.kt | 19 + .../put/parameters/parameter2/Schema2.kt | 19 + ...kecasesensitiveparamsPutCode200Response.kt | 7 + .../FakeclassnametestPatch.kt | 215 + .../FakeclassnametestPatchRequestBody.kt | 7 + .../patch/FakeclassnametestPatchResponses.kt | 53 + .../FakeclassnametestPatchSecurityInfo.kt | 24 + .../FakeclassnametestPatchCode200Response.kt | 63 + .../applicationjson/ApplicationjsonSchema.kt | 19 + ...nametestPatchSecurityRequirementObject0.kt | 24 + .../FakedeletecoffeeidDelete.kt | 179 + .../FakedeletecoffeeidDeletePathParameters.kt | 205 + .../FakedeletecoffeeidDeleteResponses.kt | 61 + .../fakedeletecoffeeid/delete/Parameters.kt | 20 + .../delete/parameters/Parameter0.kt | 23 + .../delete/parameters/parameter0/Schema0.kt | 19 + ...FakedeletecoffeeidDeleteCode200Response.kt | 7 + ...deletecoffeeidDeleteCodedefaultResponse.kt | 45 + .../client/paths/fakehealth/FakehealthGet.kt | 124 + .../fakehealth/get/FakehealthGetResponses.kt | 53 + .../responses/FakehealthGetCode200Response.kt | 63 + .../applicationjson/ApplicationjsonSchema.kt | 19 + .../FakeinlineadditionalpropertiesPost.kt | 183 + ...lineadditionalpropertiesPostRequestBody.kt | 49 + ...inlineadditionalpropertiesPostResponses.kt | 53 + .../applicationjson/ApplicationjsonSchema.kt | 183 + ...additionalpropertiesPostCode200Response.kt | 7 + .../FakeinlinecompositionPost.kt | 176 + ...akeinlinecompositionPostQueryParameters.kt | 270 ++ .../FakeinlinecompositionPostRequestBody.kt | 71 + .../FakeinlinecompositionPostResponses.kt | 53 + .../fakeinlinecomposition/post/Parameters.kt | 22 + .../post/parameters/Parameter0.kt | 23 + .../post/parameters/Parameter1.kt | 23 + .../post/parameters/parameter0/Schema0.kt | 393 ++ .../post/parameters/parameter1/Schema1.kt | 596 +++ .../applicationjson/ApplicationjsonSchema.kt | 393 ++ .../MultipartformdataSchema.kt | 596 +++ ...akeinlinecompositionPostCode200Response.kt | 81 + .../applicationjson/ApplicationjsonSchema.kt | 393 ++ .../MultipartformdataSchema.kt | 596 +++ .../fakejsonformdata/FakejsonformdataGet.kt | 152 + .../get/FakejsonformdataGetRequestBody.kt | 49 + .../get/FakejsonformdataGetResponses.kt | 53 + .../ApplicationxwwwformurlencodedSchema.kt | 274 ++ .../FakejsonformdataGetCode200Response.kt | 7 + .../paths/fakejsonpatch/FakejsonpatchPatch.kt | 152 + .../patch/FakejsonpatchPatchRequestBody.kt | 49 + .../patch/FakejsonpatchPatchResponses.kt | 53 + .../ApplicationjsonpatchjsonSchema.kt | 19 + .../FakejsonpatchPatchCode200Response.kt | 7 + .../FakejsonwithcharsetPost.kt | 152 + .../FakejsonwithcharsetPostRequestBody.kt | 49 + .../post/FakejsonwithcharsetPostResponses.kt | 53 + .../Applicationjsoncharsetutf8Schema.kt | 19 + .../FakejsonwithcharsetPostCode200Response.kt | 63 + .../Applicationjsoncharsetutf8Schema.kt | 19 + ...FakemultiplerequestbodycontenttypesPost.kt | 152 + ...erequestbodycontenttypesPostRequestBody.kt | 71 + ...plerequestbodycontenttypesPostResponses.kt | 53 + .../applicationjson/ApplicationjsonSchema.kt | 200 + .../MultipartformdataSchema.kt | 200 + ...uestbodycontenttypesPostCode200Response.kt | 63 + .../applicationjson/ApplicationjsonSchema.kt | 19 + .../FakemultipleresponsebodiesGet.kt | 124 + .../FakemultipleresponsebodiesGetResponses.kt | 69 + ...ultipleresponsebodiesGetCode200Response.kt | 63 + ...ultipleresponsebodiesGetCode202Response.kt | 63 + .../applicationjson/ApplicationjsonSchema.kt | 19 + .../applicationjson/ApplicationjsonSchema.kt | 19 + .../FakemultiplesecuritiesGet.kt | 152 + .../get/FakemultiplesecuritiesGetResponses.kt | 53 + .../FakemultiplesecuritiesGetSecurityInfo.kt | 39 + ...akemultiplesecuritiesGetCode200Response.kt | 63 + .../applicationjson/ApplicationjsonSchema.kt | 19 + ...securitiesGetSecurityRequirementObject0.kt | 5 + ...securitiesGetSecurityRequirementObject1.kt | 29 + ...securitiesGetSecurityRequirementObject2.kt | 24 + .../paths/fakeobjinquery/FakeobjinqueryGet.kt | 148 + .../get/FakeobjinqueryGetQueryParameters.kt | 191 + .../get/FakeobjinqueryGetResponses.kt | 53 + .../paths/fakeobjinquery/get/Parameters.kt | 20 + .../get/parameters/Parameter0.kt | 23 + .../get/parameters/parameter0/Schema0.kt | 200 + .../FakeobjinqueryGetCode200Response.kt | 7 + .../Fakeparametercollisions1ababselfabPost.kt | 291 ++ ...llisions1ababselfabPostCookieParameters.kt | 286 ++ ...llisions1ababselfabPostHeaderParameters.kt | 258 + ...collisions1ababselfabPostPathParameters.kt | 819 ++++ ...ollisions1ababselfabPostQueryParameters.kt | 286 ++ ...tercollisions1ababselfabPostRequestBody.kt | 49 + ...metercollisions1ababselfabPostResponses.kt | 53 + .../post/Parameters.kt | 86 + .../post/parameters/Parameter0.kt | 23 + .../post/parameters/Parameter1.kt | 23 + .../post/parameters/Parameter10.kt | 23 + .../post/parameters/Parameter11.kt | 23 + .../post/parameters/Parameter12.kt | 23 + .../post/parameters/Parameter13.kt | 23 + .../post/parameters/Parameter14.kt | 23 + .../post/parameters/Parameter15.kt | 23 + .../post/parameters/Parameter16.kt | 23 + .../post/parameters/Parameter17.kt | 23 + .../post/parameters/Parameter18.kt | 23 + .../post/parameters/Parameter2.kt | 23 + .../post/parameters/Parameter3.kt | 23 + .../post/parameters/Parameter4.kt | 23 + .../post/parameters/Parameter5.kt | 23 + .../post/parameters/Parameter6.kt | 23 + .../post/parameters/Parameter7.kt | 23 + .../post/parameters/Parameter8.kt | 23 + .../post/parameters/Parameter9.kt | 23 + .../post/parameters/parameter0/Schema0.kt | 19 + .../post/parameters/parameter1/Schema1.kt | 19 + .../post/parameters/parameter10/Schema10.kt | 19 + .../post/parameters/parameter11/Schema11.kt | 19 + .../post/parameters/parameter12/Schema12.kt | 19 + .../post/parameters/parameter13/Schema13.kt | 19 + .../post/parameters/parameter14/Schema14.kt | 19 + .../post/parameters/parameter15/Schema15.kt | 19 + .../post/parameters/parameter16/Schema16.kt | 19 + .../post/parameters/parameter17/Schema17.kt | 19 + .../post/parameters/parameter18/Schema18.kt | 19 + .../post/parameters/parameter2/Schema2.kt | 19 + .../post/parameters/parameter3/Schema3.kt | 19 + .../post/parameters/parameter4/Schema4.kt | 19 + .../post/parameters/parameter5/Schema5.kt | 19 + .../post/parameters/parameter6/Schema6.kt | 19 + .../post/parameters/parameter7/Schema7.kt | 19 + .../post/parameters/parameter8/Schema8.kt | 19 + .../post/parameters/parameter9/Schema9.kt | 19 + .../applicationjson/ApplicationjsonSchema.kt | 19 + ...ollisions1ababselfabPostCode200Response.kt | 63 + .../applicationjson/ApplicationjsonSchema.kt | 19 + .../FakepemcontenttypeGet.kt | 152 + .../get/FakepemcontenttypeGetRequestBody.kt | 49 + .../get/FakepemcontenttypeGetResponses.kt | 53 + .../ApplicationxpemfileSchema.kt | 19 + .../FakepemcontenttypeGetCode200Response.kt | 63 + .../ApplicationxpemfileSchema.kt | 19 + ...akepetiduploadimagewithrequiredfilePost.kt | 243 + ...imagewithrequiredfilePostPathParameters.kt | 223 + ...oadimagewithrequiredfilePostRequestBody.kt | 49 + ...ploadimagewithrequiredfilePostResponses.kt | 53 + ...adimagewithrequiredfilePostSecurityInfo.kt | 24 + .../post/Parameters.kt | 20 + .../post/parameters/Parameter0.kt | 23 + .../post/parameters/parameter0/Schema0.kt | 19 + .../MultipartformdataSchema.kt | 251 + ...magewithrequiredfilePostCode200Response.kt | 63 + .../applicationjson/ApplicationjsonSchema.kt | 19 + ...uiredfilePostSecurityRequirementObject0.kt | 24 + .../FakequeryparamwithjsoncontenttypeGet.kt | 180 + ...amwithjsoncontenttypeGetQueryParameters.kt | 253 + ...eryparamwithjsoncontenttypeGetResponses.kt | 53 + .../get/Parameters.kt | 20 + .../get/parameters/Parameter0.kt | 35 + .../content/applicationjson/Schema0.kt | 19 + ...amwithjsoncontenttypeGetCode200Response.kt | 63 + .../applicationjson/ApplicationjsonSchema.kt | 19 + .../fakeredirection/FakeredirectionGet.kt | 124 + .../get/FakeredirectionGetResponses.kt | 79 + .../FakeredirectionGetCode303Response.kt | 45 + .../FakeredirectionGetCode3XXResponse.kt | 45 + .../fakerefobjinquery/FakerefobjinqueryGet.kt | 148 + .../FakerefobjinqueryGetQueryParameters.kt | 191 + .../get/FakerefobjinqueryGetResponses.kt | 53 + .../paths/fakerefobjinquery/get/Parameters.kt | 20 + .../get/parameters/Parameter0.kt | 23 + .../get/parameters/parameter0/Schema0.kt | 19 + .../FakerefobjinqueryGetCode200Response.kt | 7 + .../FakerefsarraymodelPost.kt | 152 + .../post/FakerefsarraymodelPostRequestBody.kt | 49 + .../post/FakerefsarraymodelPostResponses.kt | 53 + .../applicationjson/ApplicationjsonSchema.kt | 19 + .../FakerefsarraymodelPostCode200Response.kt | 63 + .../applicationjson/ApplicationjsonSchema.kt | 19 + .../FakerefsarrayofenumsPost.kt | 152 + .../FakerefsarrayofenumsPostRequestBody.kt | 49 + .../post/FakerefsarrayofenumsPostResponses.kt | 53 + .../applicationjson/ApplicationjsonSchema.kt | 19 + ...FakerefsarrayofenumsPostCode200Response.kt | 63 + .../applicationjson/ApplicationjsonSchema.kt | 19 + .../fakerefsboolean/FakerefsbooleanPost.kt | 152 + .../post/FakerefsbooleanPostRequestBody.kt | 49 + .../post/FakerefsbooleanPostResponses.kt | 53 + .../applicationjson/ApplicationjsonSchema.kt | 19 + .../FakerefsbooleanPostCode200Response.kt | 63 + .../applicationjson/ApplicationjsonSchema.kt | 19 + ...scomposedoneofnumberwithvalidationsPost.kt | 152 + ...eofnumberwithvalidationsPostRequestBody.kt | 49 + ...oneofnumberwithvalidationsPostResponses.kt | 53 + .../applicationjson/ApplicationjsonSchema.kt | 19 + ...umberwithvalidationsPostCode200Response.kt | 63 + .../applicationjson/ApplicationjsonSchema.kt | 19 + .../paths/fakerefsenum/FakerefsenumPost.kt | 152 + .../post/FakerefsenumPostRequestBody.kt | 49 + .../post/FakerefsenumPostResponses.kt | 53 + .../applicationjson/ApplicationjsonSchema.kt | 19 + .../FakerefsenumPostCode200Response.kt | 63 + .../applicationjson/ApplicationjsonSchema.kt | 19 + .../fakerefsmammal/FakerefsmammalPost.kt | 183 + .../post/FakerefsmammalPostRequestBody.kt | 49 + .../post/FakerefsmammalPostResponses.kt | 53 + .../applicationjson/ApplicationjsonSchema.kt | 19 + .../FakerefsmammalPostCode200Response.kt | 63 + .../applicationjson/ApplicationjsonSchema.kt | 19 + .../fakerefsnumber/FakerefsnumberPost.kt | 152 + .../post/FakerefsnumberPostRequestBody.kt | 49 + .../post/FakerefsnumberPostResponses.kt | 53 + .../applicationjson/ApplicationjsonSchema.kt | 19 + .../FakerefsnumberPostCode200Response.kt | 63 + .../applicationjson/ApplicationjsonSchema.kt | 19 + .../FakerefsobjectmodelwithrefpropsPost.kt | 152 + ...sobjectmodelwithrefpropsPostRequestBody.kt | 49 + ...efsobjectmodelwithrefpropsPostResponses.kt | 53 + .../applicationjson/ApplicationjsonSchema.kt | 19 + ...ectmodelwithrefpropsPostCode200Response.kt | 63 + .../applicationjson/ApplicationjsonSchema.kt | 19 + .../fakerefsstring/FakerefsstringPost.kt | 152 + .../post/FakerefsstringPostRequestBody.kt | 49 + .../post/FakerefsstringPostResponses.kt | 53 + .../applicationjson/ApplicationjsonSchema.kt | 19 + .../FakerefsstringPostCode200Response.kt | 63 + .../applicationjson/ApplicationjsonSchema.kt | 19 + .../FakeresponsewithoutschemaGet.kt | 124 + .../FakeresponsewithoutschemaGetResponses.kt | 53 + ...responsewithoutschemaGetCode200Response.kt | 48 + .../FaketestqueryparamtersPut.kt | 180 + ...aketestqueryparamtersPutQueryParameters.kt | 1515 ++++++ .../put/FaketestqueryparamtersPutResponses.kt | 53 + .../faketestqueryparamters/put/Parameters.kt | 30 + .../put/parameters/Parameter0.kt | 23 + .../put/parameters/Parameter1.kt | 23 + .../put/parameters/Parameter2.kt | 23 + .../put/parameters/Parameter3.kt | 23 + .../put/parameters/Parameter4.kt | 23 + .../put/parameters/Parameter5.kt | 23 + .../put/parameters/parameter0/Schema0.kt | 157 + .../put/parameters/parameter1/Schema1.kt | 157 + .../put/parameters/parameter2/Schema2.kt | 157 + .../put/parameters/parameter3/Schema3.kt | 157 + .../put/parameters/parameter4/Schema4.kt | 157 + .../put/parameters/parameter5/Schema5.kt | 19 + ...aketestqueryparamtersPutCode200Response.kt | 7 + .../FakeuploaddownloadfilePost.kt | 183 + .../FakeuploaddownloadfilePostRequestBody.kt | 49 + .../FakeuploaddownloadfilePostResponses.kt | 53 + .../ApplicationoctetstreamSchema.kt | 20 + ...keuploaddownloadfilePostCode200Response.kt | 63 + .../ApplicationoctetstreamSchema.kt | 20 + .../fakeuploadfile/FakeuploadfilePost.kt | 152 + .../post/FakeuploadfilePostRequestBody.kt | 49 + .../post/FakeuploadfilePostResponses.kt | 53 + .../MultipartformdataSchema.kt | 251 + .../FakeuploadfilePostCode200Response.kt | 63 + .../applicationjson/ApplicationjsonSchema.kt | 19 + .../fakeuploadfiles/FakeuploadfilesPost.kt | 152 + .../post/FakeuploadfilesPostRequestBody.kt | 49 + .../post/FakeuploadfilesPostResponses.kt | 53 + .../MultipartformdataSchema.kt | 325 ++ .../FakeuploadfilesPostCode200Response.kt | 63 + .../applicationjson/ApplicationjsonSchema.kt | 19 + .../FakewildcardresponsesGet.kt | 124 + .../get/FakewildcardresponsesGetResponses.kt | 139 + ...FakewildcardresponsesGetCode1XXResponse.kt | 63 + ...FakewildcardresponsesGetCode200Response.kt | 63 + ...FakewildcardresponsesGetCode2XXResponse.kt | 63 + ...FakewildcardresponsesGetCode3XXResponse.kt | 63 + ...FakewildcardresponsesGetCode4XXResponse.kt | 63 + ...FakewildcardresponsesGetCode5XXResponse.kt | 63 + .../applicationjson/ApplicationjsonSchema.kt | 19 + .../applicationjson/ApplicationjsonSchema.kt | 19 + .../applicationjson/ApplicationjsonSchema.kt | 19 + .../applicationjson/ApplicationjsonSchema.kt | 19 + .../applicationjson/ApplicationjsonSchema.kt | 19 + .../applicationjson/ApplicationjsonSchema.kt | 19 + .../client/paths/foo/FooGet.kt | 124 + .../client/paths/foo/get/FooGetResponses.kt | 37 + .../client/paths/foo/get/FooGetServerInfo.kt | 63 + .../responses/FooGetCodedefaultResponse.kt | 63 + .../applicationjson/ApplicationjsonSchema.kt | 179 + .../paths/foo/get/servers/FooGetServer0.kt | 9 + .../paths/foo/get/servers/FooGetServer1.kt | 35 + .../servers/server1/FooGetServer1Variables.kt | 313 ++ .../client/paths/pet/PetPost.kt | 215 + .../client/paths/pet/PetPut.kt | 214 + .../paths/pet/post/PetPostRequestBody.kt | 7 + .../client/paths/pet/post/PetPostResponses.kt | 66 + .../paths/pet/post/PetPostSecurityInfo.kt | 39 + .../post/responses/PetPostCode200Response.kt | 7 + .../post/responses/PetPostCode405Response.kt | 45 + .../PetPostSecurityRequirementObject0.kt | 24 + .../PetPostSecurityRequirementObject1.kt | 24 + .../PetPostSecurityRequirementObject2.kt | 24 + .../client/paths/pet/put/PetPutRequestBody.kt | 7 + .../client/paths/pet/put/PetPutResponses.kt | 72 + .../paths/pet/put/PetPutSecurityInfo.kt | 33 + .../put/responses/PetPutCode400Response.kt | 45 + .../put/responses/PetPutCode404Response.kt | 45 + .../put/responses/PetPutCode405Response.kt | 45 + .../PetPutSecurityRequirementObject0.kt | 24 + .../PetPutSecurityRequirementObject1.kt | 24 + .../petfindbystatus/PetfindbystatusGet.kt | 212 + .../PetfindbystatusServerInfo.kt | 63 + .../paths/petfindbystatus/get/Parameters.kt | 20 + .../get/PetfindbystatusGetQueryParameters.kt | 206 + .../get/PetfindbystatusGetResponses.kt | 66 + .../get/PetfindbystatusGetSecurityInfo.kt | 39 + .../get/parameters/Parameter0.kt | 23 + .../get/parameters/parameter0/Schema0.kt | 255 + .../PetfindbystatusGetCode200Response.kt | 7 + .../PetfindbystatusGetCode400Response.kt | 45 + ...ndbystatusGetSecurityRequirementObject0.kt | 24 + ...ndbystatusGetSecurityRequirementObject1.kt | 24 + ...ndbystatusGetSecurityRequirementObject2.kt | 24 + .../servers/PetfindbystatusServer0.kt | 9 + .../servers/PetfindbystatusServer1.kt | 35 + .../PetfindbystatusServer1Variables.kt | 313 ++ .../paths/petfindbytags/PetfindbytagsGet.kt | 212 + .../paths/petfindbytags/get/Parameters.kt | 20 + .../get/PetfindbytagsGetQueryParameters.kt | 206 + .../get/PetfindbytagsGetResponses.kt | 66 + .../get/PetfindbytagsGetSecurityInfo.kt | 33 + .../get/parameters/Parameter0.kt | 23 + .../get/parameters/parameter0/Schema0.kt | 157 + .../PetfindbytagsGetCode200Response.kt | 7 + .../PetfindbytagsGetCode400Response.kt | 45 + ...findbytagsGetSecurityRequirementObject0.kt | 24 + ...findbytagsGetSecurityRequirementObject1.kt | 24 + .../client/paths/petpetid/PetpetidDelete.kt | 236 + .../client/paths/petpetid/PetpetidGet.kt | 211 + .../client/paths/petpetid/PetpetidPost.kt | 242 + .../paths/petpetid/delete/Parameters.kt | 32 + .../delete/PetpetidDeleteHeaderParameters.kt | 191 + .../delete/PetpetidDeletePathParameters.kt | 223 + .../delete/PetpetidDeleteResponses.kt | 48 + .../delete/PetpetidDeleteSecurityInfo.kt | 33 + .../petpetid/delete/parameters/Parameter0.kt | 23 + .../petpetid/delete/parameters/Parameter1.kt | 23 + .../delete/parameters/parameter0/Schema0.kt | 19 + .../delete/parameters/parameter1/Schema1.kt | 19 + .../PetpetidDeleteCode400Response.kt | 45 + ...etpetidDeleteSecurityRequirementObject0.kt | 24 + ...etpetidDeleteSecurityRequirementObject1.kt | 24 + .../client/paths/petpetid/get/Parameters.kt | 20 + .../petpetid/get/PetpetidGetPathParameters.kt | 223 + .../petpetid/get/PetpetidGetResponses.kt | 77 + .../petpetid/get/PetpetidGetSecurityInfo.kt | 24 + .../petpetid/get/parameters/Parameter0.kt | 23 + .../get/parameters/parameter0/Schema0.kt | 19 + .../responses/PetpetidGetCode200Response.kt | 81 + .../responses/PetpetidGetCode400Response.kt | 45 + .../responses/PetpetidGetCode404Response.kt | 45 + .../applicationjson/ApplicationjsonSchema.kt | 20 + .../applicationxml/ApplicationxmlSchema.kt | 19 + .../PetpetidGetSecurityRequirementObject0.kt | 24 + .../client/paths/petpetid/post/Parameters.kt | 20 + .../post/PetpetidPostPathParameters.kt | 223 + .../petpetid/post/PetpetidPostRequestBody.kt | 49 + .../petpetid/post/PetpetidPostResponses.kt | 48 + .../petpetid/post/PetpetidPostSecurityInfo.kt | 33 + .../petpetid/post/parameters/Parameter0.kt | 23 + .../post/parameters/parameter0/Schema0.kt | 19 + .../ApplicationxwwwformurlencodedSchema.kt | 238 + .../responses/PetpetidPostCode405Response.kt | 45 + .../PetpetidPostSecurityRequirementObject0.kt | 24 + .../PetpetidPostSecurityRequirementObject1.kt | 24 + .../PetpetiduploadimagePost.kt | 243 + .../petpetiduploadimage/post/Parameters.kt | 20 + .../PetpetiduploadimagePostPathParameters.kt | 223 + .../PetpetiduploadimagePostRequestBody.kt | 49 + .../post/PetpetiduploadimagePostResponses.kt | 54 + .../PetpetiduploadimagePostSecurityInfo.kt | 24 + .../post/parameters/Parameter0.kt | 23 + .../post/parameters/parameter0/Schema0.kt | 19 + .../MultipartformdataSchema.kt | 239 + .../PetpetiduploadimagePostCode200Response.kt | 7 + ...loadimagePostSecurityRequirementObject0.kt | 24 + .../client/paths/solidus/SolidusGet.kt | 124 + .../paths/solidus/get/SolidusGetResponses.kt | 53 + .../responses/SolidusGetCode200Response.kt | 7 + .../paths/storeinventory/StoreinventoryGet.kt | 152 + .../get/StoreinventoryGetResponses.kt | 54 + .../get/StoreinventoryGetSecurityInfo.kt | 24 + .../StoreinventoryGetCode200Response.kt | 7 + ...einventoryGetSecurityRequirementObject0.kt | 24 + .../client/paths/storeorder/StoreorderPost.kt | 183 + .../post/StoreorderPostRequestBody.kt | 49 + .../post/StoreorderPostResponses.kt | 66 + .../applicationjson/ApplicationjsonSchema.kt | 19 + .../StoreorderPostCode200Response.kt | 81 + .../StoreorderPostCode400Response.kt | 45 + .../applicationjson/ApplicationjsonSchema.kt | 19 + .../applicationxml/ApplicationxmlSchema.kt | 19 + .../StoreorderorderidDelete.kt | 178 + .../storeorderorderid/StoreorderorderidGet.kt | 179 + .../storeorderorderid/delete/Parameters.kt | 20 + .../StoreorderorderidDeletePathParameters.kt | 205 + .../StoreorderorderidDeleteResponses.kt | 61 + .../delete/parameters/Parameter0.kt | 23 + .../delete/parameters/parameter0/Schema0.kt | 19 + .../StoreorderorderidDeleteCode400Response.kt | 45 + .../StoreorderorderidDeleteCode404Response.kt | 45 + .../paths/storeorderorderid/get/Parameters.kt | 20 + .../get/StoreorderorderidGetPathParameters.kt | 223 + .../get/StoreorderorderidGetResponses.kt | 77 + .../get/parameters/Parameter0.kt | 23 + .../get/parameters/parameter0/Schema0.kt | 111 + .../StoreorderorderidGetCode200Response.kt | 81 + .../StoreorderorderidGetCode400Response.kt | 45 + .../StoreorderorderidGetCode404Response.kt | 45 + .../applicationjson/ApplicationjsonSchema.kt | 19 + .../applicationxml/ApplicationxmlSchema.kt | 19 + .../client/paths/user/UserPost.kt | 183 + .../paths/user/post/UserPostRequestBody.kt | 49 + .../paths/user/post/UserPostResponses.kt | 37 + .../applicationjson/ApplicationjsonSchema.kt | 19 + .../responses/UserPostCodedefaultResponse.kt | 45 + .../UsercreatewitharrayPost.kt | 183 + .../UsercreatewitharrayPostRequestBody.kt | 7 + .../post/UsercreatewitharrayPostResponses.kt | 37 + ...rcreatewitharrayPostCodedefaultResponse.kt | 45 + .../UsercreatewithlistPost.kt | 183 + .../post/UsercreatewithlistPostRequestBody.kt | 7 + .../post/UsercreatewithlistPostResponses.kt | 37 + ...ercreatewithlistPostCodedefaultResponse.kt | 45 + .../client/paths/userlogin/UserloginGet.kt | 180 + .../client/paths/userlogin/get/Parameters.kt | 22 + .../get/UserloginGetQueryParameters.kt | 255 + .../userlogin/get/UserloginGetResponses.kt | 67 + .../userlogin/get/parameters/Parameter0.kt | 23 + .../userlogin/get/parameters/Parameter1.kt | 23 + .../get/parameters/parameter0/Schema0.kt | 19 + .../get/parameters/parameter1/Schema1.kt | 19 + .../responses/UserloginGetCode200Response.kt | 83 + .../responses/UserloginGetCode400Response.kt | 45 + .../get/responses/code200response/Headers.kt | 26 + ...serloginGetCode200ResponseHeadersSchema.kt | 389 ++ .../applicationjson/ApplicationjsonSchema.kt | 19 + .../applicationxml/ApplicationxmlSchema.kt | 19 + .../code200response/headers/Int32.kt | 7 + .../code200response/headers/NumberHeader.kt | 3 + .../headers/Refcontentschemaheader.kt | 7 + .../code200response/headers/XExpiresAfter.kt | 18 + .../code200response/headers/XRateLimit.kt | 31 + .../xexpiresafter/XExpiresAfterSchema.kt | 19 + .../applicationjson/XRateLimitSchema.kt | 19 + .../client/paths/userlogout/UserlogoutGet.kt | 124 + .../userlogout/get/UserlogoutGetResponses.kt | 37 + .../UserlogoutGetCodedefaultResponse.kt | 7 + .../paths/userusername/UserusernameDelete.kt | 179 + .../paths/userusername/UserusernameGet.kt | 179 + .../paths/userusername/UserusernamePut.kt | 240 + .../paths/userusername/delete/Parameters.kt | 20 + .../UserusernameDeletePathParameters.kt | 205 + .../delete/UserusernameDeleteResponses.kt | 66 + .../delete/parameters/Parameter0.kt | 7 + .../UserusernameDeleteCode200Response.kt | 7 + .../UserusernameDeleteCode404Response.kt | 45 + .../paths/userusername/get/Parameters.kt | 20 + .../get/UserusernameGetPathParameters.kt | 205 + .../get/UserusernameGetResponses.kt | 77 + .../userusername/get/parameters/Parameter0.kt | 7 + .../UserusernameGetCode200Response.kt | 81 + .../UserusernameGetCode400Response.kt | 45 + .../UserusernameGetCode404Response.kt | 45 + .../applicationjson/ApplicationjsonSchema.kt | 19 + .../applicationxml/ApplicationxmlSchema.kt | 19 + .../paths/userusername/put/Parameters.kt | 20 + .../put/UserusernamePutPathParameters.kt | 205 + .../put/UserusernamePutRequestBody.kt | 49 + .../put/UserusernamePutResponses.kt | 61 + .../userusername/put/parameters/Parameter0.kt | 7 + .../applicationjson/ApplicationjsonSchema.kt | 19 + .../UserusernamePutCode400Response.kt | 45 + .../UserusernamePutCode404Response.kt | 45 + .../client/requestbody/GenericRequestBody.kt | 6 + .../requestbody/RequestBodySerializer.kt | 47 + .../requestbody/SerializedRequestBody.kt | 13 + .../client/response/ApiResponse.kt | 9 + .../response/DeserializedHttpResponse.kt | 6 + .../client/response/HeadersDeserializer.kt | 37 + .../client/response/ResponseDeserializer.kt | 74 + .../client/response/ResponsesDeserializer.kt | 11 + .../client/restclient/RestClient.kt | 67 + .../client/schemas/AnyTypeJsonSchema.kt | 315 ++ .../client/schemas/BooleanJsonSchema.kt | 88 + .../client/schemas/DateJsonSchema.kt | 94 + .../client/schemas/DateTimeJsonSchema.kt | 94 + .../client/schemas/DecimalJsonSchema.kt | 87 + .../client/schemas/DoubleJsonSchema.kt | 91 + .../client/schemas/FloatJsonSchema.kt | 91 + .../client/schemas/GenericBuilder.kt | 9 + .../client/schemas/Int32JsonSchema.kt | 98 + .../client/schemas/Int64JsonSchema.kt | 108 + .../client/schemas/IntJsonSchema.kt | 108 + .../client/schemas/ListJsonSchema.kt | 108 + .../client/schemas/MapJsonSchema.kt | 112 + .../client/schemas/NotAnyTypeJsonSchema.kt | 317 ++ .../client/schemas/NullJsonSchema.kt | 87 + .../client/schemas/NumberJsonSchema.kt | 107 + .../client/schemas/SetMaker.kt | 20 + .../client/schemas/StringJsonSchema.kt | 106 + .../client/schemas/UnsetAddPropsSetter.kt | 77 + .../client/schemas/UuidJsonSchema.kt | 94 + .../AdditionalPropertiesValidator.kt | 58 + .../schemas/validation/AllOfValidator.kt | 23 + .../schemas/validation/AnyOfValidator.kt | 45 + .../schemas/validation/BigDecimalValidator.kt | 21 + .../validation/BooleanEnumValidator.kt | 8 + .../validation/BooleanSchemaValidator.kt | 9 + .../schemas/validation/BooleanValueMethod.kt | 5 + .../schemas/validation/ConstValidator.kt | 33 + .../schemas/validation/ContainsValidator.kt | 30 + .../schemas/validation/CustomIsoparser.kt | 16 + .../schemas/validation/DefaultValueMethod.kt | 7 + .../validation/DependentRequiredValidator.kt | 42 + .../validation/DependentSchemasValidator.kt | 41 + .../schemas/validation/DoubleEnumValidator.kt | 8 + .../schemas/validation/DoubleValueMethod.kt | 5 + .../schemas/validation/ElseValidator.kt | 31 + .../schemas/validation/EnumValidator.kt | 43 + .../validation/ExclusiveMaximumValidator.kt | 45 + .../validation/ExclusiveMinimumValidator.kt | 45 + .../schemas/validation/FloatEnumValidator.kt | 8 + .../schemas/validation/FloatValueMethod.kt | 5 + .../schemas/validation/FormatValidator.kt | 158 + .../client/schemas/validation/FrozenList.kt | 30 + .../client/schemas/validation/FrozenMap.kt | 54 + .../client/schemas/validation/IfValidator.kt | 28 + .../validation/IntegerEnumValidator.kt | 8 + .../schemas/validation/IntegerValueMethod.kt | 5 + .../schemas/validation/ItemsValidator.kt | 45 + .../client/schemas/validation/JsonSchema.kt | 499 ++ .../schemas/validation/JsonSchemaFactory.kt | 32 + .../schemas/validation/JsonSchemaInfo.kt | 210 + .../client/schemas/validation/KeywordEntry.kt | 10 + .../schemas/validation/KeywordValidator.kt | 11 + .../schemas/validation/LengthValidator.kt | 16 + .../schemas/validation/ListSchemaValidator.kt | 12 + .../schemas/validation/LongEnumValidator.kt | 8 + .../schemas/validation/LongValueMethod.kt | 5 + .../schemas/validation/MapSchemaValidator.kt | 13 + .../client/schemas/validation/MapUtils.kt | 37 + .../validation/MaxContainsValidator.kt | 32 + .../schemas/validation/MaxItemsValidator.kt | 25 + .../schemas/validation/MaxLengthValidator.kt | 24 + .../validation/MaxPropertiesValidator.kt | 25 + .../schemas/validation/MaximumValidator.kt | 45 + .../validation/MinContainsValidator.kt | 31 + .../schemas/validation/MinItemsValidator.kt | 25 + .../schemas/validation/MinLengthValidator.kt | 24 + .../validation/MinPropertiesValidator.kt | 25 + .../schemas/validation/MinimumValidator.kt | 45 + .../schemas/validation/MultipleOfValidator.kt | 27 + .../client/schemas/validation/NotValidator.kt | 30 + .../schemas/validation/NullEnumValidator.kt | 8 + .../schemas/validation/NullSchemaValidator.kt | 9 + .../schemas/validation/NullValueMethod.kt | 5 + .../validation/NumberSchemaValidator.kt | 9 + .../schemas/validation/OneOfValidator.kt | 50 + .../schemas/validation/PathToSchemasMap.kt | 21 + .../validation/PatternPropertiesValidator.kt | 21 + .../schemas/validation/PatternValidator.kt | 23 + .../validation/PrefixItemsValidator.kt | 41 + .../schemas/validation/PropertiesValidator.kt | 56 + .../schemas/validation/PropertyEntry.kt | 10 + .../validation/PropertyNamesValidator.kt | 38 + .../schemas/validation/RequiredValidator.kt | 41 + .../schemas/validation/StringEnumValidator.kt | 8 + .../validation/StringSchemaValidator.kt | 9 + .../schemas/validation/StringValueMethod.kt | 5 + .../schemas/validation/ThenValidator.kt | 32 + .../schemas/validation/TypeValidator.kt | 34 + .../validation/UnevaluatedItemsValidator.kt | 52 + .../UnevaluatedPropertiesValidator.kt | 49 + .../validation/UniqueItemsValidator.kt | 35 + .../validation/UnsetAnyTypeJsonSchema.kt | 302 ++ .../schemas/validation/ValidationData.kt | 23 + .../schemas/validation/ValidationMetadata.kt | 26 + .../securityrequirementobjects/AuthApplier.kt | 40 + .../EmptySecurityRequirementObject.kt | 10 + .../SecurityRequirementObject.kt | 14 + .../SecurityRequirementObjectProvider.kt | 6 + .../ApiKeyCookieSecurityScheme.kt | 35 + .../ApiKeyHeaderSecurityScheme.kt | 31 + .../ApiKeyQuerySecurityScheme.kt | 33 + .../HttpBasicSecurityScheme.kt | 39 + .../HttpBearerSecurityScheme.kt | 41 + .../HttpDigestSecurityScheme.kt | 21 + .../HttpSignatureSecurityScheme.kt | 21 + .../MutualTlsSecurityScheme.kt | 20 + .../securityschemes/OAuth2SecurityScheme.kt | 21 + .../OpenIdConnectSecurityScheme.kt | 21 + .../client/securityschemes/SecurityScheme.kt | 19 + .../client/servers/RootServer0.kt | 38 + .../client/servers/RootServer1.kt | 37 + .../client/servers/RootServer2.kt | 9 + .../client/servers/Server.kt | 6 + .../client/servers/ServerProvider.kt | 6 + .../client/servers/ServerWithVariables.kt | 21 + .../client/servers/ServerWithoutVariables.kt | 14 + .../rootserver0/RootServer0Variables.kt | 471 ++ .../rootserver1/RootServer1Variables.kt | 313 ++ .../schemas/AbstractStepMessageTest.kt | 18 + .../schemas/AdditionalPropertiesClassTest.kt | 18 + .../schemas/AdditionalPropertiesSchemaTest.kt | 18 + ...dditionalPropertiesWithArrayOfEnumsTest.kt | 18 + .../client/components/schemas/AddressTest.kt | 18 + .../components/schemas/AnimalFarmTest.kt | 18 + .../client/components/schemas/AnimalTest.kt | 18 + .../schemas/AnyTypeAndFormatTest.kt | 18 + .../schemas/AnyTypeNotStringTest.kt | 18 + .../schemas/ApiResponseSchemaTest.kt | 18 + .../client/components/schemas/AppleReqTest.kt | 18 + .../client/components/schemas/AppleTest.kt | 18 + .../schemas/ArrayHoldingAnyTypeTest.kt | 18 + .../schemas/ArrayOfArrayOfNumberOnlyTest.kt | 18 + .../components/schemas/ArrayOfEnumsTest.kt | 18 + .../schemas/ArrayOfNumberOnlyTest.kt | 18 + .../components/schemas/ArrayTestTest.kt | 18 + .../ArrayWithValidationsInItemsTest.kt | 18 + .../components/schemas/BananaReqTest.kt | 18 + .../client/components/schemas/BananaTest.kt | 18 + .../client/components/schemas/BarTest.kt | 18 + .../components/schemas/BasquePigTest.kt | 18 + .../components/schemas/BooleanEnumTest.kt | 18 + .../components/schemas/BooleanSchemaTest.kt | 18 + .../components/schemas/CapitalizationTest.kt | 18 + .../client/components/schemas/CatTest.kt | 18 + .../client/components/schemas/CategoryTest.kt | 18 + .../client/components/schemas/ChildCatTest.kt | 18 + .../components/schemas/ClassModelTest.kt | 18 + .../client/components/schemas/ClientTest.kt | 18 + .../schemas/ComplexQuadrilateralTest.kt | 18 + ...sedAnyOfDifferentTypesNoValidationsTest.kt | 18 + .../components/schemas/ComposedArrayTest.kt | 18 + .../components/schemas/ComposedBoolTest.kt | 18 + .../components/schemas/ComposedNoneTest.kt | 18 + .../components/schemas/ComposedNumberTest.kt | 18 + .../components/schemas/ComposedObjectTest.kt | 18 + .../ComposedOneOfDifferentTypesTest.kt | 18 + .../components/schemas/ComposedStringTest.kt | 18 + .../client/components/schemas/CurrencyTest.kt | 18 + .../components/schemas/DanishPigTest.kt | 18 + .../components/schemas/DateTimeTestTest.kt | 18 + .../schemas/DateTimeWithValidationsTest.kt | 18 + .../schemas/DateWithValidationsTest.kt | 18 + .../components/schemas/DecimalPayloadTest.kt | 18 + .../client/components/schemas/DogTest.kt | 18 + .../client/components/schemas/DrawingTest.kt | 18 + .../components/schemas/EnumArraysTest.kt | 18 + .../components/schemas/EnumClassTest.kt | 18 + .../client/components/schemas/EnumTestTest.kt | 18 + .../schemas/EquilateralTriangleTest.kt | 18 + .../schemas/FileSchemaTestClassTest.kt | 18 + .../client/components/schemas/FileTest.kt | 18 + .../client/components/schemas/FooTest.kt | 18 + .../components/schemas/FormatTestTest.kt | 18 + .../components/schemas/FromSchemaTest.kt | 18 + .../client/components/schemas/FruitReqTest.kt | 18 + .../client/components/schemas/FruitTest.kt | 18 + .../client/components/schemas/GmFruitTest.kt | 18 + .../schemas/GrandparentAnimalTest.kt | 18 + .../components/schemas/HasOnlyReadOnlyTest.kt | 18 + .../schemas/HealthCheckResultTest.kt | 18 + .../components/schemas/IntegerEnumBigTest.kt | 18 + .../schemas/IntegerEnumOneValueTest.kt | 18 + .../components/schemas/IntegerEnumTest.kt | 18 + .../IntegerEnumWithDefaultValueTest.kt | 18 + .../components/schemas/IntegerMax10Test.kt | 18 + .../components/schemas/IntegerMin15Test.kt | 18 + .../schemas/IsoscelesTriangleTest.kt | 18 + .../components/schemas/ItemsSchemaTest.kt | 18 + .../client/components/schemas/ItemsTest.kt | 18 + .../JSONPatchRequestAddReplaceTestTest.kt | 18 + .../schemas/JSONPatchRequestMoveCopyTest.kt | 18 + .../schemas/JSONPatchRequestRemoveTest.kt | 18 + .../schemas/JSONPatchRequestTest.kt | 18 + .../client/components/schemas/MammalTest.kt | 18 + .../client/components/schemas/MapTestTest.kt | 18 + ...pertiesAndAdditionalPropertiesClassTest.kt | 18 + .../client/components/schemas/MoneyTest.kt | 18 + .../schemas/MultiPropertiesSchemaTest.kt | 18 + .../components/schemas/MyObjectDtoTest.kt | 18 + .../client/components/schemas/NameTest.kt | 18 + .../schemas/NoAdditionalPropertiesTest.kt | 18 + .../components/schemas/NullableClassTest.kt | 18 + .../components/schemas/NullableShapeTest.kt | 18 + .../components/schemas/NullableStringTest.kt | 18 + .../components/schemas/NumberOnlyTest.kt | 18 + .../components/schemas/NumberSchemaTest.kt | 18 + .../schemas/NumberWithExclusiveMinMaxTest.kt | 18 + .../schemas/NumberWithValidationsTest.kt | 18 + .../schemas/ObjWithRequiredPropsBaseTest.kt | 18 + .../schemas/ObjWithRequiredPropsTest.kt | 18 + .../components/schemas/ObjectInterfaceTest.kt | 18 + ...ObjectModelWithArgAndArgsPropertiesTest.kt | 18 + .../schemas/ObjectModelWithRefPropsTest.kt | 18 + ...llOfWithReqTestPropFromUnsetAddPropTest.kt | 18 + .../ObjectWithCollidingPropertiesTest.kt | 18 + .../ObjectWithDecimalPropertiesTest.kt | 18 + .../ObjectWithDifficultlyNamedPropsTest.kt | 18 + ...ObjectWithInlineCompositionPropertyTest.kt | 18 + ...jectWithInvalidNamedRefedPropertiesTest.kt | 18 + .../ObjectWithNonIntersectingValuesTest.kt | 18 + .../ObjectWithOnlyOptionalPropsTest.kt | 18 + .../schemas/ObjectWithOptionalTestPropTest.kt | 18 + .../schemas/ObjectWithValidationsTest.kt | 18 + .../client/components/schemas/OrderTest.kt | 18 + .../schemas/PaginatedResultMyObjectDtoTest.kt | 18 + .../components/schemas/ParentPetTest.kt | 18 + .../client/components/schemas/PetTest.kt | 18 + .../client/components/schemas/PigTest.kt | 18 + .../client/components/schemas/PlayerTest.kt | 18 + .../components/schemas/PublicKeyTest.kt | 18 + .../schemas/QuadrilateralInterfaceTest.kt | 18 + .../components/schemas/QuadrilateralTest.kt | 18 + .../components/schemas/ReadOnlyFirstTest.kt | 18 + .../client/components/schemas/RefPetTest.kt | 18 + .../ReqPropsFromExplicitAddPropsTest.kt | 18 + .../schemas/ReqPropsFromTrueAddPropsTest.kt | 18 + .../schemas/ReqPropsFromUnsetAddPropsTest.kt | 18 + .../components/schemas/ReturnSchemaTest.kt | 18 + .../components/schemas/ScaleneTriangleTest.kt | 18 + .../schemas/Schema200ResponseTest.kt | 18 + .../schemas/SelfReferencingArrayModelTest.kt | 18 + .../schemas/SelfReferencingObjectModelTest.kt | 18 + .../components/schemas/ShapeOrNullTest.kt | 18 + .../client/components/schemas/ShapeTest.kt | 18 + .../schemas/SimpleQuadrilateralTest.kt | 18 + .../components/schemas/SomeObjectTest.kt | 18 + .../schemas/SpecialModelnameTest.kt | 18 + .../schemas/StringBooleanMapTest.kt | 18 + .../components/schemas/StringEnumTest.kt | 18 + .../schemas/StringEnumWithDefaultValueTest.kt | 18 + .../components/schemas/StringSchemaTest.kt | 18 + .../schemas/StringWithValidationTest.kt | 18 + .../client/components/schemas/TagTest.kt | 18 + .../schemas/TriangleInterfaceTest.kt | 18 + .../client/components/schemas/TriangleTest.kt | 18 + .../components/schemas/UUIDStringTest.kt | 18 + .../client/components/schemas/UserTest.kt | 18 + .../client/components/schemas/WhaleTest.kt | 18 + .../client/components/schemas/ZebraTest.kt | 18 + .../JsonSchemaKeywordFlagsTest.kt | 143 + .../client/header/ContentHeaderTest.kt | 120 + .../client/header/SchemaHeaderTest.kt | 177 + .../client/parameter/CookieSerializerTest.kt | 45 + .../client/parameter/HeadersSerializerTest.kt | 49 + .../client/parameter/PathSerializerTest.kt | 46 + .../client/parameter/QuerySerializerTest.kt | 52 + .../parameter/SchemaNonQueryParameterTest.kt | 397 ++ .../parameter/SchemaQueryParameterTest.kt | 193 + .../requestbody/RequestBodySerializerTest.kt | 181 + .../response/ResponseDeserializerTest.kt | 248 + .../client/schemas/AnyTypeSchemaTest.kt | 106 + .../client/schemas/ArrayTypeSchemaTest.kt | 252 + .../client/schemas/BooleanSchemaTest.kt | 45 + .../client/schemas/ListBuilderTest.kt | 61 + .../client/schemas/ListSchemaTest.kt | 46 + .../client/schemas/MapSchemaTest.kt | 48 + .../client/schemas/NullSchemaTest.kt | 41 + .../client/schemas/NumberSchemaTest.kt | 57 + .../client/schemas/ObjectTypeSchemaTest.kt | 538 +++ .../client/schemas/RefBooleanSchemaTest.kt | 49 + .../AdditionalPropertiesValidatorTest.kt | 149 + .../schemas/validation/CustomIsoparserTest.kt | 28 + .../schemas/validation/FormatValidatorTest.kt | 363 ++ .../schemas/validation/ItemsValidatorTest.kt | 131 + .../schemas/validation/JsonSchemaTest.kt | 80 + .../validation/PropertiesValidatorTest.kt | 134 + .../validation/RequiredValidatorTest.kt | 120 + .../schemas/validation/TypeValidatorTest.kt | 56 + .../generators/KotlinClientGenerator.java | 3531 ++++++++++++++ .../generatorloader/GeneratorLoader.java | 4 +- src/main/resources/kotlin/README.hbs | 245 + .../resources/kotlin/_helper_footer_links.hbs | 1 + src/main/resources/kotlin/_helper_header.hbs | 15 + src/main/resources/kotlin/_helper_imports.hbs | 3 + src/main/resources/kotlin/build.gradle.hbs | 64 + src/main/resources/kotlin/gitignore.hbs | 9 + src/main/resources/kotlin/settings.gradle.hbs | 2 + .../packagename/apiclient/ApiClient.hbs | 39 + .../packagename/apis/apis_path_to_api.hbs | 23 + .../kotlin/packagename/apis/paths/Api.hbs | 18 + .../kotlin/packagename/apis/paths/ApiDoc.hbs | 49 + .../main/kotlin/packagename/apis/tags/Api.hbs | 18 + .../kotlin/packagename/apis/tags/ApiDoc.hbs | 49 + .../components/_helper_anchor_id.hbs | 1 + .../_helper_header_from_identifier_pieces.hbs | 1 + .../packagename/components/headers/Header.hbs | 72 + .../components/headers/HeaderDoc.hbs | 97 + .../components/parameter/Parameter.hbs | 78 + .../components/parameter/ParameterDoc.hbs | 98 + .../components/requestbodies/RequestBody.hbs | 92 + .../requestbodies/RequestBodyDoc.hbs | 133 + .../responses/HeadersDeserializer.hbs | 24 + .../components/responses/Response.hbs | 150 + .../components/responses/ResponseDoc.hbs | 140 + .../packagename/components/schemas/Schema.hbs | 20 + .../schemas/SchemaClass/SchemaClass.hbs | 66 + .../_Schema_anytypeOrMultitype.hbs | 159 + .../schemas/SchemaClass/_Schema_boolean.hbs | 68 + .../schemas/SchemaClass/_Schema_list.hbs | 86 + .../schemas/SchemaClass/_Schema_map.hbs | 92 + .../schemas/SchemaClass/_Schema_null.hbs | 68 + .../schemas/SchemaClass/_Schema_number.hbs | 86 + .../schemas/SchemaClass/_Schema_string.hbs | 88 + .../SchemaClass/_Schema_varEqualsClass.hbs | 108 + .../SchemaClass/_additionalProperties.hbs | 17 + .../components/schemas/SchemaClass/_allOf.hbs | 29 + .../components/schemas/SchemaClass/_anyOf.hbs | 29 + .../schemas/SchemaClass/_boxedBoolean.hbs | 27 + .../schemas/SchemaClass/_boxedClass.hbs | 39 + .../schemas/SchemaClass/_boxedClasses.hbs | 31 + .../schemas/SchemaClass/_boxedList.hbs | 27 + .../schemas/SchemaClass/_boxedMap.hbs | 26 + .../schemas/SchemaClass/_boxedNumber.hbs | 27 + .../schemas/SchemaClass/_boxedString.hbs | 27 + .../schemas/SchemaClass/_boxedVoid.hbs | 27 + .../components/schemas/SchemaClass/_const.hbs | 5 + .../schemas/SchemaClass/_contains.hbs | 17 + .../schemas/SchemaClass/_default.hbs | 43 + .../SchemaClass/_dependentRequired.hbs | 27 + .../schemas/SchemaClass/_dependentSchemas.hbs | 29 + .../components/schemas/SchemaClass/_else.hbs | 17 + .../components/schemas/SchemaClass/_enum.hbs | 37 + .../schemas/SchemaClass/_exclusiveMaximum.hbs | 5 + .../schemas/SchemaClass/_exclusiveMinimum.hbs | 5 + .../schemas/SchemaClass/_format.hbs | 5 + .../_getNewInstanceObject_implementor.hbs | 51 + .../components/schemas/SchemaClass/_if.hbs | 17 + .../components/schemas/SchemaClass/_items.hbs | 17 + .../schemas/SchemaClass/_maxContains.hbs | 5 + .../schemas/SchemaClass/_maxItems.hbs | 5 + .../schemas/SchemaClass/_maxLength.hbs | 5 + .../schemas/SchemaClass/_maxProperties.hbs | 5 + .../schemas/SchemaClass/_maximum.hbs | 5 + .../schemas/SchemaClass/_minContains.hbs | 5 + .../schemas/SchemaClass/_minItems.hbs | 5 + .../schemas/SchemaClass/_minLength.hbs | 5 + .../schemas/SchemaClass/_minProperties.hbs | 5 + .../schemas/SchemaClass/_minimum.hbs | 5 + .../schemas/SchemaClass/_multipleOf.hbs | 5 + .../components/schemas/SchemaClass/_not.hbs | 17 + .../components/schemas/SchemaClass/_oneOf.hbs | 29 + .../schemas/SchemaClass/_pattern.hbs | 57 + .../SchemaClass/_patternProperties.hbs | 29 + .../schemas/SchemaClass/_prefixItems.hbs | 29 + .../schemas/SchemaClass/_properties.hbs | 29 + .../schemas/SchemaClass/_propertyNames.hbs | 17 + .../schemas/SchemaClass/_required.hbs | 13 + .../components/schemas/SchemaClass/_then.hbs | 17 + .../components/schemas/SchemaClass/_types.hbs | 79 + .../schemas/SchemaClass/_unevaluatedItems.hbs | 17 + .../SchemaClass/_unevaluatedProperties.hbs | 17 + .../schemas/SchemaClass/_uniqueItems.hbs | 5 + .../schemas/SchemaClass/_validateAndBox.hbs | 99 + .../SchemaClass/_validateAndBoxBoolean.hbs | 4 + .../SchemaClass/_validateAndBoxList.hbs | 4 + .../SchemaClass/_validateAndBoxMap.hbs | 4 + .../SchemaClass/_validateAndBoxNumber.hbs | 4 + .../SchemaClass/_validateAndBoxString.hbs | 4 + .../SchemaClass/_validateAndBoxVoid.hbs | 4 + .../SchemaClass/_validate_implementor.hbs | 520 ++ .../components/schemas/Schema_doc.hbs | 330 ++ .../components/schemas/Schema_getSchemas.hbs | 53 + .../components/schemas/_arrayInputAddItem.hbs | 269 ++ .../components/schemas/_arrayInputType.hbs | 39 + .../components/schemas/_arrayOutputType.hbs | 10 + .../schemas/_containerClassName.hbs | 98 + .../schemas/_docschema_methodsInherited.hbs | 104 + .../schemas/_docschema_methodsInheritedFn | 5 + .../components/schemas/_enumTypes.hbs | 138 + .../schemas/_objectInputAddPropSetter.hbs | 324 ++ .../_objectInputAddPropUnsetSetterDocs.hbs | 9 + .../components/schemas/_objectInputSetter.hbs | 307 ++ .../components/schemas/_objectInputType.hbs | 108 + .../schemas/_objectOutputGetProperty.hbs | 31 + .../schemas/_objectOutputProperties.hbs | 78 + .../components/schemas/_objectOutputType.hbs | 51 + .../components/schemas/_sealedClassName.hbs | 43 + .../schemas/docschema_arrayInput.hbs | 33 + .../components/schemas/docschema_extends.hbs | 66 + .../docschema_extends_varEqualsClass.hbs | 88 + .../components/schemas/docschema_fields.hbs | 58 + .../schemas/docschema_fields_field.hbs | 117 + .../components/schemas/docschema_io_types.hbs | 122 + .../schemas/docschema_objectInput.hbs | 48 + .../components/schemas/helpers/notes_msg.hbs | 1 + .../schemas/helpers/payload_renderer.hbs | 96 + .../schemas/types/_schema_input_type_base.hbs | 126 + .../types/_schema_output_type_base.hbs | 158 + .../schemas/types/schema_input_type.hbs | 13 + .../schemas/types/schema_output_type.hbs | 13 + .../validateAndBoxSchemaCodeSample.hbs | 73 + .../schemas/validateSchemaCodeSample.hbs | 86 + .../securityschemes/SecurityScheme.hbs | 138 + .../securityschemes/SecurityScheme_doc.hbs | 122 + .../securityschemes/_doc_descMethods.hbs | 11 + .../configurations/ApiConfiguration.hbs | 243 + .../configurations/JsonSchemaKeywordFlags.hbs | 334 ++ .../configurations/SchemaConfiguration.hbs | 4 + .../contenttype/ContentTypeDeserializer.hbs | 18 + .../contenttype/ContentTypeDetector.hbs | 18 + .../contenttype/ContentTypeSerializer.hbs | 18 + .../packagename/exceptions/ApiException.hbs | 13 + .../packagename/exceptions/BaseException.hbs | 8 + .../InvalidAdditionalPropertyException.hbs | 8 + .../exceptions/NotImplementedException.hbs | 8 + .../exceptions/UnsetPropertyException.hbs | 8 + .../exceptions/ValidationException.hbs | 8 + .../packagename/header/ContentHeader.hbs | 59 + .../main/kotlin/packagename/header/Header.hbs | 14 + .../kotlin/packagename/header/HeaderBase.hbs | 18 + .../header/PrefixSeparatorIterator.hbs | 27 + .../packagename/header/Rfc6570Serializer.hbs | 197 + .../packagename/header/SchemaHeader.hbs | 97 + .../packagename/header/StyleSerializer.hbs | 99 + .../kotlin/packagename/mediatype/Encoding.hbs | 30 + .../packagename/mediatype/MediaType.hbs | 16 + .../parameter/ContentParameter.hbs | 30 + .../parameter/CookieSerializer.hbs | 36 + .../parameter/HeadersSerializer.hbs | 32 + .../packagename/parameter/Parameter.hbs | 10 + .../packagename/parameter/ParameterBase.hbs | 15 + .../packagename/parameter/ParameterInType.hbs | 8 + .../packagename/parameter/ParameterStyle.hbs | 11 + .../packagename/parameter/PathSerializer.hbs | 30 + .../packagename/parameter/QuerySerializer.hbs | 48 + .../packagename/parameter/SchemaParameter.hbs | 60 + .../packagename/paths/path/PathItem.hbs | 7 + .../packagename/paths/path/verb/Operation.hbs | 391 ++ .../paths/path/verb/OperationDoc.hbs | 118 + .../paths/path/verb/Parameters.hbs | 88 + .../packagename/paths/path/verb/Responses.hbs | 156 + .../paths/path/verb/ResponsesDoc.hbs | 41 + .../paths/path/verb/_FinalRequestClassDoc.hbs | 25 + .../path/verb/_OperationDocCodeSample.hbs | 270 ++ .../path/verb/_OperationDocExcCodeSample.hbs | 11 + .../verb/_OperationDocResBodyCodeSample.hbs | 21 + .../path/verb/_OperationDocSSCodeSample.hbs | 20 + .../paths/path/verb/_returnOrThrow.hbs | 17 + .../path/verb/_statusCodeDeserialization.hbs | 23 + .../verb/_wildcardCodeDeserialization.hbs | 23 + .../requestbody/GenericRequestBody.hbs | 6 + .../requestbody/RequestBodySerializer.hbs | 47 + .../requestbody/SerializedRequestBody.hbs | 13 + .../packagename/response/ApiResponse.hbs | 9 + .../response/DeserializedHttpResponse.hbs | 6 + .../response/HeadersDeserializer.hbs | 37 + .../response/ResponseDeserializer.hbs | 74 + .../response/ResponsesDeserializer.hbs | 11 + .../packagename/restclient/RestClient.hbs | 67 + .../packagename/schemas/AnyTypeJsonSchema.hbs | 315 ++ .../packagename/schemas/BooleanJsonSchema.hbs | 88 + .../packagename/schemas/DateJsonSchema.hbs | 94 + .../schemas/DateTimeJsonSchema.hbs | 94 + .../packagename/schemas/DecimalJsonSchema.hbs | 87 + .../packagename/schemas/DoubleJsonSchema.hbs | 100 + .../packagename/schemas/FloatJsonSchema.hbs | 98 + .../packagename/schemas/GenericBuilder.hbs | 9 + .../packagename/schemas/Int32JsonSchema.hbs | 98 + .../packagename/schemas/Int64JsonSchema.hbs | 108 + .../packagename/schemas/IntJsonSchema.hbs | 108 + .../packagename/schemas/ListJsonSchema.hbs | 108 + .../packagename/schemas/MapJsonSchema.hbs | 112 + .../schemas/NotAnyTypeJsonSchema.hbs | 317 ++ .../packagename/schemas/NullJsonSchema.hbs | 87 + .../packagename/schemas/NumberJsonSchema.hbs | 107 + .../kotlin/packagename/schemas/SetMaker.hbs | 20 + .../packagename/schemas/StringJsonSchema.hbs | 106 + .../schemas/UnsetAddPropsSetter.hbs | 77 + .../packagename/schemas/UuidJsonSchema.hbs | 94 + .../AdditionalPropertiesValidator.hbs | 58 + .../schemas/validation/AllOfValidator.hbs | 23 + .../schemas/validation/AnyOfValidator.hbs | 45 + .../validation/BigDecimalValidator.hbs | 21 + .../validation/BooleanEnumValidator.hbs | 8 + .../validation/BooleanSchemaValidator.hbs | 9 + .../schemas/validation/BooleanValueMethod.hbs | 5 + .../schemas/validation/ConstValidator.hbs | 33 + .../schemas/validation/ContainsValidator.hbs | 30 + .../schemas/validation/CustomIsoparser.hbs | 16 + .../schemas/validation/DefaultValueMethod.hbs | 7 + .../validation/DependentRequiredValidator.hbs | 42 + .../validation/DependentSchemasValidator.hbs | 41 + .../validation/DoubleEnumValidator.hbs | 8 + .../schemas/validation/DoubleValueMethod.hbs | 5 + .../schemas/validation/ElseValidator.hbs | 31 + .../schemas/validation/EnumValidator.hbs | 43 + .../validation/ExclusiveMaximumValidator.hbs | 45 + .../validation/ExclusiveMinimumValidator.hbs | 45 + .../schemas/validation/FloatEnumValidator.hbs | 8 + .../schemas/validation/FloatValueMethod.hbs | 5 + .../schemas/validation/FormatValidator.hbs | 158 + .../schemas/validation/FrozenList.hbs | 30 + .../schemas/validation/FrozenMap.hbs | 54 + .../schemas/validation/IfValidator.hbs | 28 + .../validation/IntegerEnumValidator.hbs | 8 + .../schemas/validation/IntegerValueMethod.hbs | 5 + .../schemas/validation/ItemsValidator.hbs | 45 + .../schemas/validation/JsonSchema.hbs | 499 ++ .../schemas/validation/JsonSchemaFactory.hbs | 32 + .../schemas/validation/JsonSchemaInfo.hbs | 210 + .../schemas/validation/KeywordEntry.hbs | 10 + .../schemas/validation/KeywordValidator.hbs | 11 + .../schemas/validation/LengthValidator.hbs | 16 + .../schemas/validation/ListMaker.hbs | 20 + .../validation/ListSchemaValidator.hbs | 12 + .../schemas/validation/LongEnumValidator.hbs | 8 + .../schemas/validation/LongValueMethod.hbs | 5 + .../schemas/validation/MapSchemaValidator.hbs | 13 + .../schemas/validation/MapUtils.hbs | 37 + .../validation/MaxContainsValidator.hbs | 32 + .../schemas/validation/MaxItemsValidator.hbs | 25 + .../schemas/validation/MaxLengthValidator.hbs | 24 + .../validation/MaxPropertiesValidator.hbs | 25 + .../schemas/validation/MaximumValidator.hbs | 45 + .../validation/MinContainsValidator.hbs | 31 + .../schemas/validation/MinItemsValidator.hbs | 25 + .../schemas/validation/MinLengthValidator.hbs | 24 + .../validation/MinPropertiesValidator.hbs | 25 + .../schemas/validation/MinimumValidator.hbs | 45 + .../validation/MultipleOfValidator.hbs | 27 + .../schemas/validation/NotValidator.hbs | 30 + .../schemas/validation/NullEnumValidator.hbs | 8 + .../validation/NullSchemaValidator.hbs | 9 + .../schemas/validation/NullValueMethod.hbs | 5 + .../validation/NumberSchemaValidator.hbs | 9 + .../schemas/validation/OneOfValidator.hbs | 50 + .../schemas/validation/PathToSchemasMap.hbs | 21 + .../validation/PatternPropertiesValidator.hbs | 21 + .../schemas/validation/PatternValidator.hbs | 23 + .../validation/PrefixItemsValidator.hbs | 41 + .../validation/PropertiesValidator.hbs | 56 + .../schemas/validation/PropertyEntry.hbs | 10 + .../validation/PropertyNamesValidator.hbs | 38 + .../schemas/validation/RequiredValidator.hbs | 41 + .../validation/StringEnumValidator.hbs | 8 + .../validation/StringSchemaValidator.hbs | 9 + .../schemas/validation/StringValueMethod.hbs | 5 + .../schemas/validation/ThenValidator.hbs | 32 + .../schemas/validation/TypeValidator.hbs | 34 + .../validation/UnevaluatedItemsValidator.hbs | 52 + .../UnevaluatedPropertiesValidator.hbs | 49 + .../validation/UniqueItemsValidator.hbs | 35 + .../validation/UnsetAnyTypeJsonSchema.hbs | 302 ++ .../schemas/validation/ValidationData.hbs | 23 + .../schemas/validation/ValidationMetadata.hbs | 26 + .../AuthApplier.hbs | 40 + .../EmptySecurityRequirementObject.hbs | 10 + .../SecurityInfo.hbs | 50 + .../SecurityInfoDoc.hbs | 44 + .../SecurityRequirementObject.hbs | 14 + .../SecurityRequirementObjectN.hbs | 34 + .../SecurityRequirementObjectNDoc.hbs | 19 + .../SecurityRequirementObjectProvider.hbs | 6 + .../_SecurityRequirementObjectSetter.hbs | 5 + .../ApiKeyCookieSecurityScheme.hbs | 35 + .../ApiKeyHeaderSecurityScheme.hbs | 31 + .../ApiKeyQuerySecurityScheme.hbs | 33 + .../HttpBasicSecurityScheme.hbs | 39 + .../HttpBearerSecurityScheme.hbs | 41 + .../HttpDigestSecurityScheme.hbs | 21 + .../HttpSignatureSecurityScheme.hbs | 21 + .../MutualTlsSecurityScheme.hbs | 20 + .../securityschemes/OAuth2SecurityScheme.hbs | 21 + .../OpenIdConnectSecurityScheme.hbs | 21 + .../securityschemes/SecurityScheme.hbs | 19 + .../kotlin/packagename/servers/Server.hbs | 6 + .../kotlin/packagename/servers/ServerDoc.hbs | 45 + .../kotlin/packagename/servers/ServerInfo.hbs | 80 + .../packagename/servers/ServerInfoDoc.hbs | 65 + .../kotlin/packagename/servers/ServerN.hbs | 63 + .../packagename/servers/ServerProvider.hbs | 6 + .../servers/ServerWithVariables.hbs | 21 + .../servers/ServerWithoutVariables.hbs | 14 + .../components/schemas/Schema_test.hbs | 56 + .../JsonSchemaKeywordFlagsTest.hbs | 143 + .../packagename/header/ContentHeaderTest.hbs | 120 + .../packagename/header/SchemaHeaderTest.hbs | 177 + .../parameter/CookieSerializerTest.hbs | 45 + .../parameter/HeadersSerializerTest.hbs | 49 + .../parameter/PathSerializerTest.hbs | 46 + .../parameter/QuerySerializerTest.hbs | 52 + .../parameter/SchemaNonQueryParameterTest.hbs | 397 ++ .../parameter/SchemaQueryParameterTest.hbs | 193 + .../requestbody/RequestBodySerializerTest.hbs | 181 + .../response/ResponseDeserializerTest.hbs | 248 + .../packagename/schemas/AnyTypeSchemaTest.hbs | 106 + .../schemas/ArrayTypeSchemaTest.hbs | 252 + .../packagename/schemas/BooleanSchemaTest.hbs | 45 + .../packagename/schemas/ListBuilderTest.hbs | 61 + .../packagename/schemas/ListSchemaTest.hbs | 46 + .../packagename/schemas/MapSchemaTest.hbs | 48 + .../packagename/schemas/NullSchemaTest.hbs | 41 + .../packagename/schemas/NumberSchemaTest.hbs | 57 + .../schemas/ObjectTypeSchemaTest.hbs | 538 +++ .../schemas/RefBooleanSchemaTest.hbs | 49 + .../AdditionalPropertiesValidatorTest.hbs | 149 + .../validation/CustomIsoparserTest.hbs | 28 + .../validation/FormatValidatorTest.hbs | 363 ++ .../schemas/validation/ItemsValidatorTest.hbs | 131 + .../schemas/validation/JsonSchemaTest.hbs | 80 + .../validation/PropertiesValidatorTest.hbs | 134 + .../validation/RequiredValidatorTest.hbs | 120 + .../schemas/validation/TypeValidatorTest.hbs | 56 + 2337 files changed, 260082 insertions(+), 1 deletion(-) create mode 100644 samples/client/petstore/kotlin/.gitignore create mode 100644 samples/client/petstore/kotlin/.openapi-generator-ignore create mode 100644 samples/client/petstore/kotlin/.openapi-generator/FILES create mode 100644 samples/client/petstore/kotlin/.openapi-generator/VERSION create mode 100644 samples/client/petstore/kotlin/README.md create mode 100644 samples/client/petstore/kotlin/build.gradle.kts create mode 100644 samples/client/petstore/kotlin/docs/RootServerInfo.md create mode 100644 samples/client/petstore/kotlin/docs/apis/paths/Anotherfakedummy.md create mode 100644 samples/client/petstore/kotlin/docs/apis/paths/Commonparamsubdir.md create mode 100644 samples/client/petstore/kotlin/docs/apis/paths/Fake.md create mode 100644 samples/client/petstore/kotlin/docs/apis/paths/Fakeadditionalpropertieswitharrayofenums.md create mode 100644 samples/client/petstore/kotlin/docs/apis/paths/Fakebodywithfileschema.md create mode 100644 samples/client/petstore/kotlin/docs/apis/paths/Fakebodywithqueryparams.md create mode 100644 samples/client/petstore/kotlin/docs/apis/paths/Fakecasesensitiveparams.md create mode 100644 samples/client/petstore/kotlin/docs/apis/paths/Fakeclassnametest.md create mode 100644 samples/client/petstore/kotlin/docs/apis/paths/Fakedeletecoffeeid.md create mode 100644 samples/client/petstore/kotlin/docs/apis/paths/Fakehealth.md create mode 100644 samples/client/petstore/kotlin/docs/apis/paths/Fakeinlineadditionalproperties.md create mode 100644 samples/client/petstore/kotlin/docs/apis/paths/Fakeinlinecomposition.md create mode 100644 samples/client/petstore/kotlin/docs/apis/paths/Fakejsonformdata.md create mode 100644 samples/client/petstore/kotlin/docs/apis/paths/Fakejsonpatch.md create mode 100644 samples/client/petstore/kotlin/docs/apis/paths/Fakejsonwithcharset.md create mode 100644 samples/client/petstore/kotlin/docs/apis/paths/Fakemultiplerequestbodycontenttypes.md create mode 100644 samples/client/petstore/kotlin/docs/apis/paths/Fakemultipleresponsebodies.md create mode 100644 samples/client/petstore/kotlin/docs/apis/paths/Fakemultiplesecurities.md create mode 100644 samples/client/petstore/kotlin/docs/apis/paths/Fakeobjinquery.md create mode 100644 samples/client/petstore/kotlin/docs/apis/paths/Fakeparametercollisions1ababselfab.md create mode 100644 samples/client/petstore/kotlin/docs/apis/paths/Fakepemcontenttype.md create mode 100644 samples/client/petstore/kotlin/docs/apis/paths/Fakepetiduploadimagewithrequiredfile.md create mode 100644 samples/client/petstore/kotlin/docs/apis/paths/Fakequeryparamwithjsoncontenttype.md create mode 100644 samples/client/petstore/kotlin/docs/apis/paths/Fakeredirection.md create mode 100644 samples/client/petstore/kotlin/docs/apis/paths/Fakerefobjinquery.md create mode 100644 samples/client/petstore/kotlin/docs/apis/paths/Fakerefsarraymodel.md create mode 100644 samples/client/petstore/kotlin/docs/apis/paths/Fakerefsarrayofenums.md create mode 100644 samples/client/petstore/kotlin/docs/apis/paths/Fakerefsboolean.md create mode 100644 samples/client/petstore/kotlin/docs/apis/paths/Fakerefscomposedoneofnumberwithvalidations.md create mode 100644 samples/client/petstore/kotlin/docs/apis/paths/Fakerefsenum.md create mode 100644 samples/client/petstore/kotlin/docs/apis/paths/Fakerefsmammal.md create mode 100644 samples/client/petstore/kotlin/docs/apis/paths/Fakerefsnumber.md create mode 100644 samples/client/petstore/kotlin/docs/apis/paths/Fakerefsobjectmodelwithrefprops.md create mode 100644 samples/client/petstore/kotlin/docs/apis/paths/Fakerefsstring.md create mode 100644 samples/client/petstore/kotlin/docs/apis/paths/Fakeresponsewithoutschema.md create mode 100644 samples/client/petstore/kotlin/docs/apis/paths/Faketestqueryparamters.md create mode 100644 samples/client/petstore/kotlin/docs/apis/paths/Fakeuploaddownloadfile.md create mode 100644 samples/client/petstore/kotlin/docs/apis/paths/Fakeuploadfile.md create mode 100644 samples/client/petstore/kotlin/docs/apis/paths/Fakeuploadfiles.md create mode 100644 samples/client/petstore/kotlin/docs/apis/paths/Fakewildcardresponses.md create mode 100644 samples/client/petstore/kotlin/docs/apis/paths/Foo.md create mode 100644 samples/client/petstore/kotlin/docs/apis/paths/Pet.md create mode 100644 samples/client/petstore/kotlin/docs/apis/paths/Petfindbystatus.md create mode 100644 samples/client/petstore/kotlin/docs/apis/paths/Petfindbytags.md create mode 100644 samples/client/petstore/kotlin/docs/apis/paths/Petpetid.md create mode 100644 samples/client/petstore/kotlin/docs/apis/paths/Petpetiduploadimage.md create mode 100644 samples/client/petstore/kotlin/docs/apis/paths/Solidus.md create mode 100644 samples/client/petstore/kotlin/docs/apis/paths/Storeinventory.md create mode 100644 samples/client/petstore/kotlin/docs/apis/paths/Storeorder.md create mode 100644 samples/client/petstore/kotlin/docs/apis/paths/Storeorderorderid.md create mode 100644 samples/client/petstore/kotlin/docs/apis/paths/User.md create mode 100644 samples/client/petstore/kotlin/docs/apis/paths/Usercreatewitharray.md create mode 100644 samples/client/petstore/kotlin/docs/apis/paths/Usercreatewithlist.md create mode 100644 samples/client/petstore/kotlin/docs/apis/paths/Userlogin.md create mode 100644 samples/client/petstore/kotlin/docs/apis/paths/Userlogout.md create mode 100644 samples/client/petstore/kotlin/docs/apis/paths/Userusername.md create mode 100644 samples/client/petstore/kotlin/docs/apis/tags/Anotherfake.md create mode 100644 samples/client/petstore/kotlin/docs/apis/tags/Default.md create mode 100644 samples/client/petstore/kotlin/docs/apis/tags/Fake.md create mode 100644 samples/client/petstore/kotlin/docs/apis/tags/Fakeclassnametags123.md create mode 100644 samples/client/petstore/kotlin/docs/apis/tags/Pet.md create mode 100644 samples/client/petstore/kotlin/docs/apis/tags/Store.md create mode 100644 samples/client/petstore/kotlin/docs/apis/tags/User.md create mode 100644 samples/client/petstore/kotlin/docs/components/headers/Int32JsonContentTypeHeader.md create mode 100644 samples/client/petstore/kotlin/docs/components/headers/NumberHeader.md create mode 100644 samples/client/petstore/kotlin/docs/components/headers/RefContentSchemaHeader.md create mode 100644 samples/client/petstore/kotlin/docs/components/headers/RefSchemaHeader.md create mode 100644 samples/client/petstore/kotlin/docs/components/headers/RefStringHeader.md create mode 100644 samples/client/petstore/kotlin/docs/components/headers/StringHeader.md create mode 100644 samples/client/petstore/kotlin/docs/components/headers/int32jsoncontenttypeheader/content/applicationjson/Int32JsonContentTypeHeaderSchema.md create mode 100644 samples/client/petstore/kotlin/docs/components/headers/numberheader/NumberHeaderSchema.md create mode 100644 samples/client/petstore/kotlin/docs/components/headers/refcontentschemaheader/content/applicationjson/RefContentSchemaHeaderSchema.md create mode 100644 samples/client/petstore/kotlin/docs/components/headers/refschemaheader/RefSchemaHeaderSchema.md create mode 100644 samples/client/petstore/kotlin/docs/components/headers/stringheader/StringHeaderSchema.md create mode 100644 samples/client/petstore/kotlin/docs/components/parameters/ComponentRefSchemaStringWithValidation.md create mode 100644 samples/client/petstore/kotlin/docs/components/parameters/PathUserName.md create mode 100644 samples/client/petstore/kotlin/docs/components/parameters/RefPathUserName.md create mode 100644 samples/client/petstore/kotlin/docs/components/parameters/RefSchemaStringWithValidation.md create mode 100644 samples/client/petstore/kotlin/docs/components/parameters/componentrefschemastringwithvalidation/content/applicationjson/ApplicationjsonSchema.md create mode 100644 samples/client/petstore/kotlin/docs/components/parameters/pathusername/Schema.md create mode 100644 samples/client/petstore/kotlin/docs/components/parameters/refschemastringwithvalidation/Schema.md create mode 100644 samples/client/petstore/kotlin/docs/components/requestbodies/Client.md create mode 100644 samples/client/petstore/kotlin/docs/components/requestbodies/Pet.md create mode 100644 samples/client/petstore/kotlin/docs/components/requestbodies/RefUserArray.md create mode 100644 samples/client/petstore/kotlin/docs/components/requestbodies/UserArray.md create mode 100644 samples/client/petstore/kotlin/docs/components/requestbodies/client/content/applicationjson/ApplicationjsonSchema.md create mode 100644 samples/client/petstore/kotlin/docs/components/requestbodies/pet/content/applicationjson/ApplicationjsonSchema.md create mode 100644 samples/client/petstore/kotlin/docs/components/requestbodies/pet/content/applicationxml/ApplicationxmlSchema.md create mode 100644 samples/client/petstore/kotlin/docs/components/requestbodies/userarray/content/applicationjson/ApplicationjsonSchema.md create mode 100644 samples/client/petstore/kotlin/docs/components/responses/HeadersWithNoBody.md create mode 100644 samples/client/petstore/kotlin/docs/components/responses/RefSuccessDescriptionOnly.md create mode 100644 samples/client/petstore/kotlin/docs/components/responses/RefSuccessfulXmlAndJsonArrayOfPet.md create mode 100644 samples/client/petstore/kotlin/docs/components/responses/SuccessDescriptionOnly.md create mode 100644 samples/client/petstore/kotlin/docs/components/responses/SuccessInlineContentAndHeader.md create mode 100644 samples/client/petstore/kotlin/docs/components/responses/SuccessWithJsonApiResponse.md create mode 100644 samples/client/petstore/kotlin/docs/components/responses/SuccessfulXmlAndJsonArrayOfPet.md create mode 100644 samples/client/petstore/kotlin/docs/components/responses/headerswithnobody/HeadersWithNoBodyHeadersSchema.md create mode 100644 samples/client/petstore/kotlin/docs/components/responses/headerswithnobody/headers/location/LocationSchema.md create mode 100644 samples/client/petstore/kotlin/docs/components/responses/successfulxmlandjsonarrayofpet/content/applicationjson/ApplicationjsonSchema.md create mode 100644 samples/client/petstore/kotlin/docs/components/responses/successfulxmlandjsonarrayofpet/content/applicationxml/ApplicationxmlSchema.md create mode 100644 samples/client/petstore/kotlin/docs/components/responses/successinlinecontentandheader/SuccessInlineContentAndHeaderHeadersSchema.md create mode 100644 samples/client/petstore/kotlin/docs/components/responses/successinlinecontentandheader/content/applicationjson/ApplicationjsonSchema.md create mode 100644 samples/client/petstore/kotlin/docs/components/responses/successinlinecontentandheader/headers/someheader/SomeHeaderSchema.md create mode 100644 samples/client/petstore/kotlin/docs/components/responses/successwithjsonapiresponse/SuccessWithJsonApiResponseHeadersSchema.md create mode 100644 samples/client/petstore/kotlin/docs/components/responses/successwithjsonapiresponse/content/applicationjson/ApplicationjsonSchema.md create mode 100644 samples/client/petstore/kotlin/docs/components/schemas/AbstractStepMessage.md create mode 100644 samples/client/petstore/kotlin/docs/components/schemas/AdditionalPropertiesClass.md create mode 100644 samples/client/petstore/kotlin/docs/components/schemas/AdditionalPropertiesSchema.md create mode 100644 samples/client/petstore/kotlin/docs/components/schemas/AdditionalPropertiesWithArrayOfEnums.md create mode 100644 samples/client/petstore/kotlin/docs/components/schemas/Address.md create mode 100644 samples/client/petstore/kotlin/docs/components/schemas/Animal.md create mode 100644 samples/client/petstore/kotlin/docs/components/schemas/AnimalFarm.md create mode 100644 samples/client/petstore/kotlin/docs/components/schemas/AnyTypeAndFormat.md create mode 100644 samples/client/petstore/kotlin/docs/components/schemas/AnyTypeNotString.md create mode 100644 samples/client/petstore/kotlin/docs/components/schemas/ApiResponseSchema.md create mode 100644 samples/client/petstore/kotlin/docs/components/schemas/Apple.md create mode 100644 samples/client/petstore/kotlin/docs/components/schemas/AppleReq.md create mode 100644 samples/client/petstore/kotlin/docs/components/schemas/ArrayHoldingAnyType.md create mode 100644 samples/client/petstore/kotlin/docs/components/schemas/ArrayOfArrayOfNumberOnly.md create mode 100644 samples/client/petstore/kotlin/docs/components/schemas/ArrayOfEnums.md create mode 100644 samples/client/petstore/kotlin/docs/components/schemas/ArrayOfNumberOnly.md create mode 100644 samples/client/petstore/kotlin/docs/components/schemas/ArrayTest.md create mode 100644 samples/client/petstore/kotlin/docs/components/schemas/ArrayWithValidationsInItems.md create mode 100644 samples/client/petstore/kotlin/docs/components/schemas/Banana.md create mode 100644 samples/client/petstore/kotlin/docs/components/schemas/BananaReq.md create mode 100644 samples/client/petstore/kotlin/docs/components/schemas/Bar.md create mode 100644 samples/client/petstore/kotlin/docs/components/schemas/BasquePig.md create mode 100644 samples/client/petstore/kotlin/docs/components/schemas/BooleanEnum.md create mode 100644 samples/client/petstore/kotlin/docs/components/schemas/BooleanSchema.md create mode 100644 samples/client/petstore/kotlin/docs/components/schemas/Capitalization.md create mode 100644 samples/client/petstore/kotlin/docs/components/schemas/Cat.md create mode 100644 samples/client/petstore/kotlin/docs/components/schemas/Category.md create mode 100644 samples/client/petstore/kotlin/docs/components/schemas/ChildCat.md create mode 100644 samples/client/petstore/kotlin/docs/components/schemas/ClassModel.md create mode 100644 samples/client/petstore/kotlin/docs/components/schemas/Client.md create mode 100644 samples/client/petstore/kotlin/docs/components/schemas/ComplexQuadrilateral.md create mode 100644 samples/client/petstore/kotlin/docs/components/schemas/ComposedAnyOfDifferentTypesNoValidations.md create mode 100644 samples/client/petstore/kotlin/docs/components/schemas/ComposedArray.md create mode 100644 samples/client/petstore/kotlin/docs/components/schemas/ComposedBool.md create mode 100644 samples/client/petstore/kotlin/docs/components/schemas/ComposedNone.md create mode 100644 samples/client/petstore/kotlin/docs/components/schemas/ComposedNumber.md create mode 100644 samples/client/petstore/kotlin/docs/components/schemas/ComposedObject.md create mode 100644 samples/client/petstore/kotlin/docs/components/schemas/ComposedOneOfDifferentTypes.md create mode 100644 samples/client/petstore/kotlin/docs/components/schemas/ComposedString.md create mode 100644 samples/client/petstore/kotlin/docs/components/schemas/Currency.md create mode 100644 samples/client/petstore/kotlin/docs/components/schemas/DanishPig.md create mode 100644 samples/client/petstore/kotlin/docs/components/schemas/DateTimeTest.md create mode 100644 samples/client/petstore/kotlin/docs/components/schemas/DateTimeWithValidations.md create mode 100644 samples/client/petstore/kotlin/docs/components/schemas/DateWithValidations.md create mode 100644 samples/client/petstore/kotlin/docs/components/schemas/DecimalPayload.md create mode 100644 samples/client/petstore/kotlin/docs/components/schemas/Dog.md create mode 100644 samples/client/petstore/kotlin/docs/components/schemas/Drawing.md create mode 100644 samples/client/petstore/kotlin/docs/components/schemas/EnumArrays.md create mode 100644 samples/client/petstore/kotlin/docs/components/schemas/EnumClass.md create mode 100644 samples/client/petstore/kotlin/docs/components/schemas/EnumTest.md create mode 100644 samples/client/petstore/kotlin/docs/components/schemas/EquilateralTriangle.md create mode 100644 samples/client/petstore/kotlin/docs/components/schemas/File.md create mode 100644 samples/client/petstore/kotlin/docs/components/schemas/FileSchemaTestClass.md create mode 100644 samples/client/petstore/kotlin/docs/components/schemas/Foo.md create mode 100644 samples/client/petstore/kotlin/docs/components/schemas/FormatTest.md create mode 100644 samples/client/petstore/kotlin/docs/components/schemas/FromSchema.md create mode 100644 samples/client/petstore/kotlin/docs/components/schemas/Fruit.md create mode 100644 samples/client/petstore/kotlin/docs/components/schemas/FruitReq.md create mode 100644 samples/client/petstore/kotlin/docs/components/schemas/GmFruit.md create mode 100644 samples/client/petstore/kotlin/docs/components/schemas/GrandparentAnimal.md create mode 100644 samples/client/petstore/kotlin/docs/components/schemas/HasOnlyReadOnly.md create mode 100644 samples/client/petstore/kotlin/docs/components/schemas/HealthCheckResult.md create mode 100644 samples/client/petstore/kotlin/docs/components/schemas/IntegerEnum.md create mode 100644 samples/client/petstore/kotlin/docs/components/schemas/IntegerEnumBig.md create mode 100644 samples/client/petstore/kotlin/docs/components/schemas/IntegerEnumOneValue.md create mode 100644 samples/client/petstore/kotlin/docs/components/schemas/IntegerEnumWithDefaultValue.md create mode 100644 samples/client/petstore/kotlin/docs/components/schemas/IntegerMax10.md create mode 100644 samples/client/petstore/kotlin/docs/components/schemas/IntegerMin15.md create mode 100644 samples/client/petstore/kotlin/docs/components/schemas/IsoscelesTriangle.md create mode 100644 samples/client/petstore/kotlin/docs/components/schemas/Items.md create mode 100644 samples/client/petstore/kotlin/docs/components/schemas/ItemsSchema.md create mode 100644 samples/client/petstore/kotlin/docs/components/schemas/JSONPatchRequest.md create mode 100644 samples/client/petstore/kotlin/docs/components/schemas/JSONPatchRequestAddReplaceTest.md create mode 100644 samples/client/petstore/kotlin/docs/components/schemas/JSONPatchRequestMoveCopy.md create mode 100644 samples/client/petstore/kotlin/docs/components/schemas/JSONPatchRequestRemove.md create mode 100644 samples/client/petstore/kotlin/docs/components/schemas/Mammal.md create mode 100644 samples/client/petstore/kotlin/docs/components/schemas/MapTest.md create mode 100644 samples/client/petstore/kotlin/docs/components/schemas/MixedPropertiesAndAdditionalPropertiesClass.md create mode 100644 samples/client/petstore/kotlin/docs/components/schemas/Money.md create mode 100644 samples/client/petstore/kotlin/docs/components/schemas/MultiPropertiesSchema.md create mode 100644 samples/client/petstore/kotlin/docs/components/schemas/MyObjectDto.md create mode 100644 samples/client/petstore/kotlin/docs/components/schemas/Name.md create mode 100644 samples/client/petstore/kotlin/docs/components/schemas/NoAdditionalProperties.md create mode 100644 samples/client/petstore/kotlin/docs/components/schemas/NullableClass.md create mode 100644 samples/client/petstore/kotlin/docs/components/schemas/NullableShape.md create mode 100644 samples/client/petstore/kotlin/docs/components/schemas/NullableString.md create mode 100644 samples/client/petstore/kotlin/docs/components/schemas/NumberOnly.md create mode 100644 samples/client/petstore/kotlin/docs/components/schemas/NumberSchema.md create mode 100644 samples/client/petstore/kotlin/docs/components/schemas/NumberWithExclusiveMinMax.md create mode 100644 samples/client/petstore/kotlin/docs/components/schemas/NumberWithValidations.md create mode 100644 samples/client/petstore/kotlin/docs/components/schemas/ObjWithRequiredProps.md create mode 100644 samples/client/petstore/kotlin/docs/components/schemas/ObjWithRequiredPropsBase.md create mode 100644 samples/client/petstore/kotlin/docs/components/schemas/ObjectInterface.md create mode 100644 samples/client/petstore/kotlin/docs/components/schemas/ObjectModelWithArgAndArgsProperties.md create mode 100644 samples/client/petstore/kotlin/docs/components/schemas/ObjectModelWithRefProps.md create mode 100644 samples/client/petstore/kotlin/docs/components/schemas/ObjectWithAllOfWithReqTestPropFromUnsetAddProp.md create mode 100644 samples/client/petstore/kotlin/docs/components/schemas/ObjectWithCollidingProperties.md create mode 100644 samples/client/petstore/kotlin/docs/components/schemas/ObjectWithDecimalProperties.md create mode 100644 samples/client/petstore/kotlin/docs/components/schemas/ObjectWithDifficultlyNamedProps.md create mode 100644 samples/client/petstore/kotlin/docs/components/schemas/ObjectWithInlineCompositionProperty.md create mode 100644 samples/client/petstore/kotlin/docs/components/schemas/ObjectWithInvalidNamedRefedProperties.md create mode 100644 samples/client/petstore/kotlin/docs/components/schemas/ObjectWithNonIntersectingValues.md create mode 100644 samples/client/petstore/kotlin/docs/components/schemas/ObjectWithOnlyOptionalProps.md create mode 100644 samples/client/petstore/kotlin/docs/components/schemas/ObjectWithOptionalTestProp.md create mode 100644 samples/client/petstore/kotlin/docs/components/schemas/ObjectWithValidations.md create mode 100644 samples/client/petstore/kotlin/docs/components/schemas/Order.md create mode 100644 samples/client/petstore/kotlin/docs/components/schemas/PaginatedResultMyObjectDto.md create mode 100644 samples/client/petstore/kotlin/docs/components/schemas/ParentPet.md create mode 100644 samples/client/petstore/kotlin/docs/components/schemas/Pet.md create mode 100644 samples/client/petstore/kotlin/docs/components/schemas/Pig.md create mode 100644 samples/client/petstore/kotlin/docs/components/schemas/Player.md create mode 100644 samples/client/petstore/kotlin/docs/components/schemas/PublicKey.md create mode 100644 samples/client/petstore/kotlin/docs/components/schemas/Quadrilateral.md create mode 100644 samples/client/petstore/kotlin/docs/components/schemas/QuadrilateralInterface.md create mode 100644 samples/client/petstore/kotlin/docs/components/schemas/ReadOnlyFirst.md create mode 100644 samples/client/petstore/kotlin/docs/components/schemas/RefPet.md create mode 100644 samples/client/petstore/kotlin/docs/components/schemas/ReqPropsFromExplicitAddProps.md create mode 100644 samples/client/petstore/kotlin/docs/components/schemas/ReqPropsFromTrueAddProps.md create mode 100644 samples/client/petstore/kotlin/docs/components/schemas/ReqPropsFromUnsetAddProps.md create mode 100644 samples/client/petstore/kotlin/docs/components/schemas/ReturnSchema.md create mode 100644 samples/client/petstore/kotlin/docs/components/schemas/ScaleneTriangle.md create mode 100644 samples/client/petstore/kotlin/docs/components/schemas/Schema200Response.md create mode 100644 samples/client/petstore/kotlin/docs/components/schemas/SelfReferencingArrayModel.md create mode 100644 samples/client/petstore/kotlin/docs/components/schemas/SelfReferencingObjectModel.md create mode 100644 samples/client/petstore/kotlin/docs/components/schemas/Shape.md create mode 100644 samples/client/petstore/kotlin/docs/components/schemas/ShapeOrNull.md create mode 100644 samples/client/petstore/kotlin/docs/components/schemas/SimpleQuadrilateral.md create mode 100644 samples/client/petstore/kotlin/docs/components/schemas/SomeObject.md create mode 100644 samples/client/petstore/kotlin/docs/components/schemas/SpecialModelname.md create mode 100644 samples/client/petstore/kotlin/docs/components/schemas/StringBooleanMap.md create mode 100644 samples/client/petstore/kotlin/docs/components/schemas/StringEnum.md create mode 100644 samples/client/petstore/kotlin/docs/components/schemas/StringEnumWithDefaultValue.md create mode 100644 samples/client/petstore/kotlin/docs/components/schemas/StringSchema.md create mode 100644 samples/client/petstore/kotlin/docs/components/schemas/StringWithValidation.md create mode 100644 samples/client/petstore/kotlin/docs/components/schemas/Tag.md create mode 100644 samples/client/petstore/kotlin/docs/components/schemas/Triangle.md create mode 100644 samples/client/petstore/kotlin/docs/components/schemas/TriangleInterface.md create mode 100644 samples/client/petstore/kotlin/docs/components/schemas/UUIDString.md create mode 100644 samples/client/petstore/kotlin/docs/components/schemas/User.md create mode 100644 samples/client/petstore/kotlin/docs/components/schemas/Whale.md create mode 100644 samples/client/petstore/kotlin/docs/components/schemas/Zebra.md create mode 100644 samples/client/petstore/kotlin/docs/components/securityschemes/ApiKey.md create mode 100644 samples/client/petstore/kotlin/docs/components/securityschemes/ApiKeyQuery.md create mode 100644 samples/client/petstore/kotlin/docs/components/securityschemes/BearerTest.md create mode 100644 samples/client/petstore/kotlin/docs/components/securityschemes/HttpBasicTest.md create mode 100644 samples/client/petstore/kotlin/docs/components/securityschemes/HttpSignatureTest.md create mode 100644 samples/client/petstore/kotlin/docs/components/securityschemes/OpenIdConnectTest.md create mode 100644 samples/client/petstore/kotlin/docs/components/securityschemes/PetstoreAuth.md create mode 100644 samples/client/petstore/kotlin/docs/paths/anotherfakedummy/AnotherfakedummyPatch.md create mode 100644 samples/client/petstore/kotlin/docs/paths/anotherfakedummy/patch/AnotherfakedummyPatchRequestBody.md create mode 100644 samples/client/petstore/kotlin/docs/paths/anotherfakedummy/patch/AnotherfakedummyPatchResponses.md create mode 100644 samples/client/petstore/kotlin/docs/paths/anotherfakedummy/patch/responses/AnotherfakedummyPatchCode200Response.md create mode 100644 samples/client/petstore/kotlin/docs/paths/anotherfakedummy/patch/responses/code200response/content/applicationjson/ApplicationjsonSchema.md create mode 100644 samples/client/petstore/kotlin/docs/paths/commonparamsubdir/CommonparamsubdirDelete.md create mode 100644 samples/client/petstore/kotlin/docs/paths/commonparamsubdir/CommonparamsubdirGet.md create mode 100644 samples/client/petstore/kotlin/docs/paths/commonparamsubdir/CommonparamsubdirPost.md create mode 100644 samples/client/petstore/kotlin/docs/paths/commonparamsubdir/delete/CommonparamsubdirDeleteHeaderParameters.md create mode 100644 samples/client/petstore/kotlin/docs/paths/commonparamsubdir/delete/CommonparamsubdirDeletePathParameters.md create mode 100644 samples/client/petstore/kotlin/docs/paths/commonparamsubdir/delete/CommonparamsubdirDeleteResponses.md create mode 100644 samples/client/petstore/kotlin/docs/paths/commonparamsubdir/delete/parameters/parameter0/Schema0.md create mode 100644 samples/client/petstore/kotlin/docs/paths/commonparamsubdir/delete/parameters/parameter1/Schema1.md create mode 100644 samples/client/petstore/kotlin/docs/paths/commonparamsubdir/delete/responses/CommonparamsubdirDeleteCode200Response.md create mode 100644 samples/client/petstore/kotlin/docs/paths/commonparamsubdir/get/CommonparamsubdirGetPathParameters.md create mode 100644 samples/client/petstore/kotlin/docs/paths/commonparamsubdir/get/CommonparamsubdirGetQueryParameters.md create mode 100644 samples/client/petstore/kotlin/docs/paths/commonparamsubdir/get/CommonparamsubdirGetResponses.md create mode 100644 samples/client/petstore/kotlin/docs/paths/commonparamsubdir/get/parameters/parameter0/Schema0.md create mode 100644 samples/client/petstore/kotlin/docs/paths/commonparamsubdir/get/responses/CommonparamsubdirGetCode200Response.md create mode 100644 samples/client/petstore/kotlin/docs/paths/commonparamsubdir/parameters/routeparameter0/RouteParamSchema0.md create mode 100644 samples/client/petstore/kotlin/docs/paths/commonparamsubdir/post/CommonparamsubdirPostHeaderParameters.md create mode 100644 samples/client/petstore/kotlin/docs/paths/commonparamsubdir/post/CommonparamsubdirPostPathParameters.md create mode 100644 samples/client/petstore/kotlin/docs/paths/commonparamsubdir/post/CommonparamsubdirPostResponses.md create mode 100644 samples/client/petstore/kotlin/docs/paths/commonparamsubdir/post/parameters/parameter0/Schema0.md create mode 100644 samples/client/petstore/kotlin/docs/paths/commonparamsubdir/post/responses/CommonparamsubdirPostCode200Response.md create mode 100644 samples/client/petstore/kotlin/docs/paths/fake/FakeDelete.md create mode 100644 samples/client/petstore/kotlin/docs/paths/fake/FakeGet.md create mode 100644 samples/client/petstore/kotlin/docs/paths/fake/FakePatch.md create mode 100644 samples/client/petstore/kotlin/docs/paths/fake/FakePost.md create mode 100644 samples/client/petstore/kotlin/docs/paths/fake/delete/FakeDeleteHeaderParameters.md create mode 100644 samples/client/petstore/kotlin/docs/paths/fake/delete/FakeDeleteQueryParameters.md create mode 100644 samples/client/petstore/kotlin/docs/paths/fake/delete/FakeDeleteResponses.md create mode 100644 samples/client/petstore/kotlin/docs/paths/fake/delete/FakeDeleteSecurityInfo.md create mode 100644 samples/client/petstore/kotlin/docs/paths/fake/delete/parameters/parameter0/Schema0.md create mode 100644 samples/client/petstore/kotlin/docs/paths/fake/delete/parameters/parameter1/Schema1.md create mode 100644 samples/client/petstore/kotlin/docs/paths/fake/delete/parameters/parameter2/Schema2.md create mode 100644 samples/client/petstore/kotlin/docs/paths/fake/delete/parameters/parameter3/Schema3.md create mode 100644 samples/client/petstore/kotlin/docs/paths/fake/delete/parameters/parameter4/Schema4.md create mode 100644 samples/client/petstore/kotlin/docs/paths/fake/delete/parameters/parameter5/Schema5.md create mode 100644 samples/client/petstore/kotlin/docs/paths/fake/delete/responses/FakeDeleteCode200Response.md create mode 100644 samples/client/petstore/kotlin/docs/paths/fake/delete/security/FakeDeleteSecurityRequirementObject0.md create mode 100644 samples/client/petstore/kotlin/docs/paths/fake/get/FakeGetHeaderParameters.md create mode 100644 samples/client/petstore/kotlin/docs/paths/fake/get/FakeGetQueryParameters.md create mode 100644 samples/client/petstore/kotlin/docs/paths/fake/get/FakeGetRequestBody.md create mode 100644 samples/client/petstore/kotlin/docs/paths/fake/get/FakeGetResponses.md create mode 100644 samples/client/petstore/kotlin/docs/paths/fake/get/parameters/parameter0/Schema0.md create mode 100644 samples/client/petstore/kotlin/docs/paths/fake/get/parameters/parameter1/Schema1.md create mode 100644 samples/client/petstore/kotlin/docs/paths/fake/get/parameters/parameter2/Schema2.md create mode 100644 samples/client/petstore/kotlin/docs/paths/fake/get/parameters/parameter3/Schema3.md create mode 100644 samples/client/petstore/kotlin/docs/paths/fake/get/parameters/parameter4/Schema4.md create mode 100644 samples/client/petstore/kotlin/docs/paths/fake/get/parameters/parameter5/Schema5.md create mode 100644 samples/client/petstore/kotlin/docs/paths/fake/get/requestbody/content/applicationxwwwformurlencoded/ApplicationxwwwformurlencodedSchema.md create mode 100644 samples/client/petstore/kotlin/docs/paths/fake/get/responses/FakeGetCode200Response.md create mode 100644 samples/client/petstore/kotlin/docs/paths/fake/get/responses/FakeGetCode404Response.md create mode 100644 samples/client/petstore/kotlin/docs/paths/fake/get/responses/code404response/content/applicationjson/ApplicationjsonSchema.md create mode 100644 samples/client/petstore/kotlin/docs/paths/fake/patch/FakePatchRequestBody.md create mode 100644 samples/client/petstore/kotlin/docs/paths/fake/patch/FakePatchResponses.md create mode 100644 samples/client/petstore/kotlin/docs/paths/fake/patch/responses/FakePatchCode200Response.md create mode 100644 samples/client/petstore/kotlin/docs/paths/fake/patch/responses/code200response/content/applicationjson/ApplicationjsonSchema.md create mode 100644 samples/client/petstore/kotlin/docs/paths/fake/post/FakePostRequestBody.md create mode 100644 samples/client/petstore/kotlin/docs/paths/fake/post/FakePostResponses.md create mode 100644 samples/client/petstore/kotlin/docs/paths/fake/post/FakePostSecurityInfo.md create mode 100644 samples/client/petstore/kotlin/docs/paths/fake/post/requestbody/content/applicationxwwwformurlencoded/ApplicationxwwwformurlencodedSchema.md create mode 100644 samples/client/petstore/kotlin/docs/paths/fake/post/responses/FakePostCode200Response.md create mode 100644 samples/client/petstore/kotlin/docs/paths/fake/post/responses/FakePostCode404Response.md create mode 100644 samples/client/petstore/kotlin/docs/paths/fake/post/security/FakePostSecurityRequirementObject0.md create mode 100644 samples/client/petstore/kotlin/docs/paths/fakeadditionalpropertieswitharrayofenums/FakeadditionalpropertieswitharrayofenumsGet.md create mode 100644 samples/client/petstore/kotlin/docs/paths/fakeadditionalpropertieswitharrayofenums/get/FakeadditionalpropertieswitharrayofenumsGetRequestBody.md create mode 100644 samples/client/petstore/kotlin/docs/paths/fakeadditionalpropertieswitharrayofenums/get/FakeadditionalpropertieswitharrayofenumsGetResponses.md create mode 100644 samples/client/petstore/kotlin/docs/paths/fakeadditionalpropertieswitharrayofenums/get/requestbody/content/applicationjson/ApplicationjsonSchema.md create mode 100644 samples/client/petstore/kotlin/docs/paths/fakeadditionalpropertieswitharrayofenums/get/responses/FakeadditionalpropertieswitharrayofenumsGetCode200Response.md create mode 100644 samples/client/petstore/kotlin/docs/paths/fakeadditionalpropertieswitharrayofenums/get/responses/code200response/content/applicationjson/ApplicationjsonSchema.md create mode 100644 samples/client/petstore/kotlin/docs/paths/fakebodywithfileschema/FakebodywithfileschemaPut.md create mode 100644 samples/client/petstore/kotlin/docs/paths/fakebodywithfileschema/put/FakebodywithfileschemaPutRequestBody.md create mode 100644 samples/client/petstore/kotlin/docs/paths/fakebodywithfileschema/put/FakebodywithfileschemaPutResponses.md create mode 100644 samples/client/petstore/kotlin/docs/paths/fakebodywithfileschema/put/requestbody/content/applicationjson/ApplicationjsonSchema.md create mode 100644 samples/client/petstore/kotlin/docs/paths/fakebodywithfileschema/put/responses/FakebodywithfileschemaPutCode200Response.md create mode 100644 samples/client/petstore/kotlin/docs/paths/fakebodywithqueryparams/FakebodywithqueryparamsPut.md create mode 100644 samples/client/petstore/kotlin/docs/paths/fakebodywithqueryparams/put/FakebodywithqueryparamsPutQueryParameters.md create mode 100644 samples/client/petstore/kotlin/docs/paths/fakebodywithqueryparams/put/FakebodywithqueryparamsPutRequestBody.md create mode 100644 samples/client/petstore/kotlin/docs/paths/fakebodywithqueryparams/put/FakebodywithqueryparamsPutResponses.md create mode 100644 samples/client/petstore/kotlin/docs/paths/fakebodywithqueryparams/put/parameters/parameter0/Schema0.md create mode 100644 samples/client/petstore/kotlin/docs/paths/fakebodywithqueryparams/put/requestbody/content/applicationjson/ApplicationjsonSchema.md create mode 100644 samples/client/petstore/kotlin/docs/paths/fakebodywithqueryparams/put/responses/FakebodywithqueryparamsPutCode200Response.md create mode 100644 samples/client/petstore/kotlin/docs/paths/fakecasesensitiveparams/FakecasesensitiveparamsPut.md create mode 100644 samples/client/petstore/kotlin/docs/paths/fakecasesensitiveparams/put/FakecasesensitiveparamsPutQueryParameters.md create mode 100644 samples/client/petstore/kotlin/docs/paths/fakecasesensitiveparams/put/FakecasesensitiveparamsPutResponses.md create mode 100644 samples/client/petstore/kotlin/docs/paths/fakecasesensitiveparams/put/parameters/parameter0/Schema0.md create mode 100644 samples/client/petstore/kotlin/docs/paths/fakecasesensitiveparams/put/parameters/parameter1/Schema1.md create mode 100644 samples/client/petstore/kotlin/docs/paths/fakecasesensitiveparams/put/parameters/parameter2/Schema2.md create mode 100644 samples/client/petstore/kotlin/docs/paths/fakecasesensitiveparams/put/responses/FakecasesensitiveparamsPutCode200Response.md create mode 100644 samples/client/petstore/kotlin/docs/paths/fakeclassnametest/FakeclassnametestPatch.md create mode 100644 samples/client/petstore/kotlin/docs/paths/fakeclassnametest/patch/FakeclassnametestPatchRequestBody.md create mode 100644 samples/client/petstore/kotlin/docs/paths/fakeclassnametest/patch/FakeclassnametestPatchResponses.md create mode 100644 samples/client/petstore/kotlin/docs/paths/fakeclassnametest/patch/FakeclassnametestPatchSecurityInfo.md create mode 100644 samples/client/petstore/kotlin/docs/paths/fakeclassnametest/patch/responses/FakeclassnametestPatchCode200Response.md create mode 100644 samples/client/petstore/kotlin/docs/paths/fakeclassnametest/patch/responses/code200response/content/applicationjson/ApplicationjsonSchema.md create mode 100644 samples/client/petstore/kotlin/docs/paths/fakeclassnametest/patch/security/FakeclassnametestPatchSecurityRequirementObject0.md create mode 100644 samples/client/petstore/kotlin/docs/paths/fakedeletecoffeeid/FakedeletecoffeeidDelete.md create mode 100644 samples/client/petstore/kotlin/docs/paths/fakedeletecoffeeid/delete/FakedeletecoffeeidDeletePathParameters.md create mode 100644 samples/client/petstore/kotlin/docs/paths/fakedeletecoffeeid/delete/FakedeletecoffeeidDeleteResponses.md create mode 100644 samples/client/petstore/kotlin/docs/paths/fakedeletecoffeeid/delete/parameters/parameter0/Schema0.md create mode 100644 samples/client/petstore/kotlin/docs/paths/fakedeletecoffeeid/delete/responses/FakedeletecoffeeidDeleteCode200Response.md create mode 100644 samples/client/petstore/kotlin/docs/paths/fakedeletecoffeeid/delete/responses/FakedeletecoffeeidDeleteCodedefaultResponse.md create mode 100644 samples/client/petstore/kotlin/docs/paths/fakehealth/FakehealthGet.md create mode 100644 samples/client/petstore/kotlin/docs/paths/fakehealth/get/FakehealthGetResponses.md create mode 100644 samples/client/petstore/kotlin/docs/paths/fakehealth/get/responses/FakehealthGetCode200Response.md create mode 100644 samples/client/petstore/kotlin/docs/paths/fakehealth/get/responses/code200response/content/applicationjson/ApplicationjsonSchema.md create mode 100644 samples/client/petstore/kotlin/docs/paths/fakeinlineadditionalproperties/FakeinlineadditionalpropertiesPost.md create mode 100644 samples/client/petstore/kotlin/docs/paths/fakeinlineadditionalproperties/post/FakeinlineadditionalpropertiesPostRequestBody.md create mode 100644 samples/client/petstore/kotlin/docs/paths/fakeinlineadditionalproperties/post/FakeinlineadditionalpropertiesPostResponses.md create mode 100644 samples/client/petstore/kotlin/docs/paths/fakeinlineadditionalproperties/post/requestbody/content/applicationjson/ApplicationjsonSchema.md create mode 100644 samples/client/petstore/kotlin/docs/paths/fakeinlineadditionalproperties/post/responses/FakeinlineadditionalpropertiesPostCode200Response.md create mode 100644 samples/client/petstore/kotlin/docs/paths/fakeinlinecomposition/FakeinlinecompositionPost.md create mode 100644 samples/client/petstore/kotlin/docs/paths/fakeinlinecomposition/post/FakeinlinecompositionPostQueryParameters.md create mode 100644 samples/client/petstore/kotlin/docs/paths/fakeinlinecomposition/post/FakeinlinecompositionPostRequestBody.md create mode 100644 samples/client/petstore/kotlin/docs/paths/fakeinlinecomposition/post/FakeinlinecompositionPostResponses.md create mode 100644 samples/client/petstore/kotlin/docs/paths/fakeinlinecomposition/post/parameters/parameter0/Schema0.md create mode 100644 samples/client/petstore/kotlin/docs/paths/fakeinlinecomposition/post/parameters/parameter1/Schema1.md create mode 100644 samples/client/petstore/kotlin/docs/paths/fakeinlinecomposition/post/requestbody/content/applicationjson/ApplicationjsonSchema.md create mode 100644 samples/client/petstore/kotlin/docs/paths/fakeinlinecomposition/post/requestbody/content/multipartformdata/MultipartformdataSchema.md create mode 100644 samples/client/petstore/kotlin/docs/paths/fakeinlinecomposition/post/responses/FakeinlinecompositionPostCode200Response.md create mode 100644 samples/client/petstore/kotlin/docs/paths/fakeinlinecomposition/post/responses/code200response/content/applicationjson/ApplicationjsonSchema.md create mode 100644 samples/client/petstore/kotlin/docs/paths/fakeinlinecomposition/post/responses/code200response/content/multipartformdata/MultipartformdataSchema.md create mode 100644 samples/client/petstore/kotlin/docs/paths/fakejsonformdata/FakejsonformdataGet.md create mode 100644 samples/client/petstore/kotlin/docs/paths/fakejsonformdata/get/FakejsonformdataGetRequestBody.md create mode 100644 samples/client/petstore/kotlin/docs/paths/fakejsonformdata/get/FakejsonformdataGetResponses.md create mode 100644 samples/client/petstore/kotlin/docs/paths/fakejsonformdata/get/requestbody/content/applicationxwwwformurlencoded/ApplicationxwwwformurlencodedSchema.md create mode 100644 samples/client/petstore/kotlin/docs/paths/fakejsonformdata/get/responses/FakejsonformdataGetCode200Response.md create mode 100644 samples/client/petstore/kotlin/docs/paths/fakejsonpatch/FakejsonpatchPatch.md create mode 100644 samples/client/petstore/kotlin/docs/paths/fakejsonpatch/patch/FakejsonpatchPatchRequestBody.md create mode 100644 samples/client/petstore/kotlin/docs/paths/fakejsonpatch/patch/FakejsonpatchPatchResponses.md create mode 100644 samples/client/petstore/kotlin/docs/paths/fakejsonpatch/patch/requestbody/content/applicationjsonpatchjson/ApplicationjsonpatchjsonSchema.md create mode 100644 samples/client/petstore/kotlin/docs/paths/fakejsonpatch/patch/responses/FakejsonpatchPatchCode200Response.md create mode 100644 samples/client/petstore/kotlin/docs/paths/fakejsonwithcharset/FakejsonwithcharsetPost.md create mode 100644 samples/client/petstore/kotlin/docs/paths/fakejsonwithcharset/post/FakejsonwithcharsetPostRequestBody.md create mode 100644 samples/client/petstore/kotlin/docs/paths/fakejsonwithcharset/post/FakejsonwithcharsetPostResponses.md create mode 100644 samples/client/petstore/kotlin/docs/paths/fakejsonwithcharset/post/requestbody/content/applicationjsoncharsetutf8/Applicationjsoncharsetutf8Schema.md create mode 100644 samples/client/petstore/kotlin/docs/paths/fakejsonwithcharset/post/responses/FakejsonwithcharsetPostCode200Response.md create mode 100644 samples/client/petstore/kotlin/docs/paths/fakejsonwithcharset/post/responses/code200response/content/applicationjsoncharsetutf8/Applicationjsoncharsetutf8Schema.md create mode 100644 samples/client/petstore/kotlin/docs/paths/fakemultiplerequestbodycontenttypes/FakemultiplerequestbodycontenttypesPost.md create mode 100644 samples/client/petstore/kotlin/docs/paths/fakemultiplerequestbodycontenttypes/post/FakemultiplerequestbodycontenttypesPostRequestBody.md create mode 100644 samples/client/petstore/kotlin/docs/paths/fakemultiplerequestbodycontenttypes/post/FakemultiplerequestbodycontenttypesPostResponses.md create mode 100644 samples/client/petstore/kotlin/docs/paths/fakemultiplerequestbodycontenttypes/post/requestbody/content/applicationjson/ApplicationjsonSchema.md create mode 100644 samples/client/petstore/kotlin/docs/paths/fakemultiplerequestbodycontenttypes/post/requestbody/content/multipartformdata/MultipartformdataSchema.md create mode 100644 samples/client/petstore/kotlin/docs/paths/fakemultiplerequestbodycontenttypes/post/responses/FakemultiplerequestbodycontenttypesPostCode200Response.md create mode 100644 samples/client/petstore/kotlin/docs/paths/fakemultiplerequestbodycontenttypes/post/responses/code200response/content/applicationjson/ApplicationjsonSchema.md create mode 100644 samples/client/petstore/kotlin/docs/paths/fakemultipleresponsebodies/FakemultipleresponsebodiesGet.md create mode 100644 samples/client/petstore/kotlin/docs/paths/fakemultipleresponsebodies/get/FakemultipleresponsebodiesGetResponses.md create mode 100644 samples/client/petstore/kotlin/docs/paths/fakemultipleresponsebodies/get/responses/FakemultipleresponsebodiesGetCode200Response.md create mode 100644 samples/client/petstore/kotlin/docs/paths/fakemultipleresponsebodies/get/responses/FakemultipleresponsebodiesGetCode202Response.md create mode 100644 samples/client/petstore/kotlin/docs/paths/fakemultipleresponsebodies/get/responses/code200response/content/applicationjson/ApplicationjsonSchema.md create mode 100644 samples/client/petstore/kotlin/docs/paths/fakemultipleresponsebodies/get/responses/code202response/content/applicationjson/ApplicationjsonSchema.md create mode 100644 samples/client/petstore/kotlin/docs/paths/fakemultiplesecurities/FakemultiplesecuritiesGet.md create mode 100644 samples/client/petstore/kotlin/docs/paths/fakemultiplesecurities/get/FakemultiplesecuritiesGetResponses.md create mode 100644 samples/client/petstore/kotlin/docs/paths/fakemultiplesecurities/get/FakemultiplesecuritiesGetSecurityInfo.md create mode 100644 samples/client/petstore/kotlin/docs/paths/fakemultiplesecurities/get/responses/FakemultiplesecuritiesGetCode200Response.md create mode 100644 samples/client/petstore/kotlin/docs/paths/fakemultiplesecurities/get/responses/code200response/content/applicationjson/ApplicationjsonSchema.md create mode 100644 samples/client/petstore/kotlin/docs/paths/fakemultiplesecurities/get/security/FakemultiplesecuritiesGetSecurityRequirementObject0.md create mode 100644 samples/client/petstore/kotlin/docs/paths/fakemultiplesecurities/get/security/FakemultiplesecuritiesGetSecurityRequirementObject1.md create mode 100644 samples/client/petstore/kotlin/docs/paths/fakemultiplesecurities/get/security/FakemultiplesecuritiesGetSecurityRequirementObject2.md create mode 100644 samples/client/petstore/kotlin/docs/paths/fakeobjinquery/FakeobjinqueryGet.md create mode 100644 samples/client/petstore/kotlin/docs/paths/fakeobjinquery/get/FakeobjinqueryGetQueryParameters.md create mode 100644 samples/client/petstore/kotlin/docs/paths/fakeobjinquery/get/FakeobjinqueryGetResponses.md create mode 100644 samples/client/petstore/kotlin/docs/paths/fakeobjinquery/get/parameters/parameter0/Schema0.md create mode 100644 samples/client/petstore/kotlin/docs/paths/fakeobjinquery/get/responses/FakeobjinqueryGetCode200Response.md create mode 100644 samples/client/petstore/kotlin/docs/paths/fakeparametercollisions1ababselfab/Fakeparametercollisions1ababselfabPost.md create mode 100644 samples/client/petstore/kotlin/docs/paths/fakeparametercollisions1ababselfab/post/Fakeparametercollisions1ababselfabPostCookieParameters.md create mode 100644 samples/client/petstore/kotlin/docs/paths/fakeparametercollisions1ababselfab/post/Fakeparametercollisions1ababselfabPostHeaderParameters.md create mode 100644 samples/client/petstore/kotlin/docs/paths/fakeparametercollisions1ababselfab/post/Fakeparametercollisions1ababselfabPostPathParameters.md create mode 100644 samples/client/petstore/kotlin/docs/paths/fakeparametercollisions1ababselfab/post/Fakeparametercollisions1ababselfabPostQueryParameters.md create mode 100644 samples/client/petstore/kotlin/docs/paths/fakeparametercollisions1ababselfab/post/Fakeparametercollisions1ababselfabPostRequestBody.md create mode 100644 samples/client/petstore/kotlin/docs/paths/fakeparametercollisions1ababselfab/post/Fakeparametercollisions1ababselfabPostResponses.md create mode 100644 samples/client/petstore/kotlin/docs/paths/fakeparametercollisions1ababselfab/post/parameters/parameter0/Schema0.md create mode 100644 samples/client/petstore/kotlin/docs/paths/fakeparametercollisions1ababselfab/post/parameters/parameter1/Schema1.md create mode 100644 samples/client/petstore/kotlin/docs/paths/fakeparametercollisions1ababselfab/post/parameters/parameter10/Schema10.md create mode 100644 samples/client/petstore/kotlin/docs/paths/fakeparametercollisions1ababselfab/post/parameters/parameter11/Schema11.md create mode 100644 samples/client/petstore/kotlin/docs/paths/fakeparametercollisions1ababselfab/post/parameters/parameter12/Schema12.md create mode 100644 samples/client/petstore/kotlin/docs/paths/fakeparametercollisions1ababselfab/post/parameters/parameter13/Schema13.md create mode 100644 samples/client/petstore/kotlin/docs/paths/fakeparametercollisions1ababselfab/post/parameters/parameter14/Schema14.md create mode 100644 samples/client/petstore/kotlin/docs/paths/fakeparametercollisions1ababselfab/post/parameters/parameter15/Schema15.md create mode 100644 samples/client/petstore/kotlin/docs/paths/fakeparametercollisions1ababselfab/post/parameters/parameter16/Schema16.md create mode 100644 samples/client/petstore/kotlin/docs/paths/fakeparametercollisions1ababselfab/post/parameters/parameter17/Schema17.md create mode 100644 samples/client/petstore/kotlin/docs/paths/fakeparametercollisions1ababselfab/post/parameters/parameter18/Schema18.md create mode 100644 samples/client/petstore/kotlin/docs/paths/fakeparametercollisions1ababselfab/post/parameters/parameter2/Schema2.md create mode 100644 samples/client/petstore/kotlin/docs/paths/fakeparametercollisions1ababselfab/post/parameters/parameter3/Schema3.md create mode 100644 samples/client/petstore/kotlin/docs/paths/fakeparametercollisions1ababselfab/post/parameters/parameter4/Schema4.md create mode 100644 samples/client/petstore/kotlin/docs/paths/fakeparametercollisions1ababselfab/post/parameters/parameter5/Schema5.md create mode 100644 samples/client/petstore/kotlin/docs/paths/fakeparametercollisions1ababselfab/post/parameters/parameter6/Schema6.md create mode 100644 samples/client/petstore/kotlin/docs/paths/fakeparametercollisions1ababselfab/post/parameters/parameter7/Schema7.md create mode 100644 samples/client/petstore/kotlin/docs/paths/fakeparametercollisions1ababselfab/post/parameters/parameter8/Schema8.md create mode 100644 samples/client/petstore/kotlin/docs/paths/fakeparametercollisions1ababselfab/post/parameters/parameter9/Schema9.md create mode 100644 samples/client/petstore/kotlin/docs/paths/fakeparametercollisions1ababselfab/post/requestbody/content/applicationjson/ApplicationjsonSchema.md create mode 100644 samples/client/petstore/kotlin/docs/paths/fakeparametercollisions1ababselfab/post/responses/Fakeparametercollisions1ababselfabPostCode200Response.md create mode 100644 samples/client/petstore/kotlin/docs/paths/fakeparametercollisions1ababselfab/post/responses/code200response/content/applicationjson/ApplicationjsonSchema.md create mode 100644 samples/client/petstore/kotlin/docs/paths/fakepemcontenttype/FakepemcontenttypeGet.md create mode 100644 samples/client/petstore/kotlin/docs/paths/fakepemcontenttype/get/FakepemcontenttypeGetRequestBody.md create mode 100644 samples/client/petstore/kotlin/docs/paths/fakepemcontenttype/get/FakepemcontenttypeGetResponses.md create mode 100644 samples/client/petstore/kotlin/docs/paths/fakepemcontenttype/get/requestbody/content/applicationxpemfile/ApplicationxpemfileSchema.md create mode 100644 samples/client/petstore/kotlin/docs/paths/fakepemcontenttype/get/responses/FakepemcontenttypeGetCode200Response.md create mode 100644 samples/client/petstore/kotlin/docs/paths/fakepemcontenttype/get/responses/code200response/content/applicationxpemfile/ApplicationxpemfileSchema.md create mode 100644 samples/client/petstore/kotlin/docs/paths/fakepetiduploadimagewithrequiredfile/FakepetiduploadimagewithrequiredfilePost.md create mode 100644 samples/client/petstore/kotlin/docs/paths/fakepetiduploadimagewithrequiredfile/post/FakepetiduploadimagewithrequiredfilePostPathParameters.md create mode 100644 samples/client/petstore/kotlin/docs/paths/fakepetiduploadimagewithrequiredfile/post/FakepetiduploadimagewithrequiredfilePostRequestBody.md create mode 100644 samples/client/petstore/kotlin/docs/paths/fakepetiduploadimagewithrequiredfile/post/FakepetiduploadimagewithrequiredfilePostResponses.md create mode 100644 samples/client/petstore/kotlin/docs/paths/fakepetiduploadimagewithrequiredfile/post/FakepetiduploadimagewithrequiredfilePostSecurityInfo.md create mode 100644 samples/client/petstore/kotlin/docs/paths/fakepetiduploadimagewithrequiredfile/post/parameters/parameter0/Schema0.md create mode 100644 samples/client/petstore/kotlin/docs/paths/fakepetiduploadimagewithrequiredfile/post/requestbody/content/multipartformdata/MultipartformdataSchema.md create mode 100644 samples/client/petstore/kotlin/docs/paths/fakepetiduploadimagewithrequiredfile/post/responses/FakepetiduploadimagewithrequiredfilePostCode200Response.md create mode 100644 samples/client/petstore/kotlin/docs/paths/fakepetiduploadimagewithrequiredfile/post/responses/code200response/content/applicationjson/ApplicationjsonSchema.md create mode 100644 samples/client/petstore/kotlin/docs/paths/fakepetiduploadimagewithrequiredfile/post/security/FakepetiduploadimagewithrequiredfilePostSecurityRequirementObject0.md create mode 100644 samples/client/petstore/kotlin/docs/paths/fakequeryparamwithjsoncontenttype/FakequeryparamwithjsoncontenttypeGet.md create mode 100644 samples/client/petstore/kotlin/docs/paths/fakequeryparamwithjsoncontenttype/get/FakequeryparamwithjsoncontenttypeGetQueryParameters.md create mode 100644 samples/client/petstore/kotlin/docs/paths/fakequeryparamwithjsoncontenttype/get/FakequeryparamwithjsoncontenttypeGetResponses.md create mode 100644 samples/client/petstore/kotlin/docs/paths/fakequeryparamwithjsoncontenttype/get/parameters/parameter0/content/applicationjson/Schema0.md create mode 100644 samples/client/petstore/kotlin/docs/paths/fakequeryparamwithjsoncontenttype/get/responses/FakequeryparamwithjsoncontenttypeGetCode200Response.md create mode 100644 samples/client/petstore/kotlin/docs/paths/fakequeryparamwithjsoncontenttype/get/responses/code200response/content/applicationjson/ApplicationjsonSchema.md create mode 100644 samples/client/petstore/kotlin/docs/paths/fakeredirection/FakeredirectionGet.md create mode 100644 samples/client/petstore/kotlin/docs/paths/fakeredirection/get/FakeredirectionGetResponses.md create mode 100644 samples/client/petstore/kotlin/docs/paths/fakeredirection/get/responses/FakeredirectionGetCode303Response.md create mode 100644 samples/client/petstore/kotlin/docs/paths/fakeredirection/get/responses/FakeredirectionGetCode3XXResponse.md create mode 100644 samples/client/petstore/kotlin/docs/paths/fakerefobjinquery/FakerefobjinqueryGet.md create mode 100644 samples/client/petstore/kotlin/docs/paths/fakerefobjinquery/get/FakerefobjinqueryGetQueryParameters.md create mode 100644 samples/client/petstore/kotlin/docs/paths/fakerefobjinquery/get/FakerefobjinqueryGetResponses.md create mode 100644 samples/client/petstore/kotlin/docs/paths/fakerefobjinquery/get/parameters/parameter0/Schema0.md create mode 100644 samples/client/petstore/kotlin/docs/paths/fakerefobjinquery/get/responses/FakerefobjinqueryGetCode200Response.md create mode 100644 samples/client/petstore/kotlin/docs/paths/fakerefsarraymodel/FakerefsarraymodelPost.md create mode 100644 samples/client/petstore/kotlin/docs/paths/fakerefsarraymodel/post/FakerefsarraymodelPostRequestBody.md create mode 100644 samples/client/petstore/kotlin/docs/paths/fakerefsarraymodel/post/FakerefsarraymodelPostResponses.md create mode 100644 samples/client/petstore/kotlin/docs/paths/fakerefsarraymodel/post/requestbody/content/applicationjson/ApplicationjsonSchema.md create mode 100644 samples/client/petstore/kotlin/docs/paths/fakerefsarraymodel/post/responses/FakerefsarraymodelPostCode200Response.md create mode 100644 samples/client/petstore/kotlin/docs/paths/fakerefsarraymodel/post/responses/code200response/content/applicationjson/ApplicationjsonSchema.md create mode 100644 samples/client/petstore/kotlin/docs/paths/fakerefsarrayofenums/FakerefsarrayofenumsPost.md create mode 100644 samples/client/petstore/kotlin/docs/paths/fakerefsarrayofenums/post/FakerefsarrayofenumsPostRequestBody.md create mode 100644 samples/client/petstore/kotlin/docs/paths/fakerefsarrayofenums/post/FakerefsarrayofenumsPostResponses.md create mode 100644 samples/client/petstore/kotlin/docs/paths/fakerefsarrayofenums/post/requestbody/content/applicationjson/ApplicationjsonSchema.md create mode 100644 samples/client/petstore/kotlin/docs/paths/fakerefsarrayofenums/post/responses/FakerefsarrayofenumsPostCode200Response.md create mode 100644 samples/client/petstore/kotlin/docs/paths/fakerefsarrayofenums/post/responses/code200response/content/applicationjson/ApplicationjsonSchema.md create mode 100644 samples/client/petstore/kotlin/docs/paths/fakerefsboolean/FakerefsbooleanPost.md create mode 100644 samples/client/petstore/kotlin/docs/paths/fakerefsboolean/post/FakerefsbooleanPostRequestBody.md create mode 100644 samples/client/petstore/kotlin/docs/paths/fakerefsboolean/post/FakerefsbooleanPostResponses.md create mode 100644 samples/client/petstore/kotlin/docs/paths/fakerefsboolean/post/requestbody/content/applicationjson/ApplicationjsonSchema.md create mode 100644 samples/client/petstore/kotlin/docs/paths/fakerefsboolean/post/responses/FakerefsbooleanPostCode200Response.md create mode 100644 samples/client/petstore/kotlin/docs/paths/fakerefsboolean/post/responses/code200response/content/applicationjson/ApplicationjsonSchema.md create mode 100644 samples/client/petstore/kotlin/docs/paths/fakerefscomposedoneofnumberwithvalidations/FakerefscomposedoneofnumberwithvalidationsPost.md create mode 100644 samples/client/petstore/kotlin/docs/paths/fakerefscomposedoneofnumberwithvalidations/post/FakerefscomposedoneofnumberwithvalidationsPostRequestBody.md create mode 100644 samples/client/petstore/kotlin/docs/paths/fakerefscomposedoneofnumberwithvalidations/post/FakerefscomposedoneofnumberwithvalidationsPostResponses.md create mode 100644 samples/client/petstore/kotlin/docs/paths/fakerefscomposedoneofnumberwithvalidations/post/requestbody/content/applicationjson/ApplicationjsonSchema.md create mode 100644 samples/client/petstore/kotlin/docs/paths/fakerefscomposedoneofnumberwithvalidations/post/responses/FakerefscomposedoneofnumberwithvalidationsPostCode200Response.md create mode 100644 samples/client/petstore/kotlin/docs/paths/fakerefscomposedoneofnumberwithvalidations/post/responses/code200response/content/applicationjson/ApplicationjsonSchema.md create mode 100644 samples/client/petstore/kotlin/docs/paths/fakerefsenum/FakerefsenumPost.md create mode 100644 samples/client/petstore/kotlin/docs/paths/fakerefsenum/post/FakerefsenumPostRequestBody.md create mode 100644 samples/client/petstore/kotlin/docs/paths/fakerefsenum/post/FakerefsenumPostResponses.md create mode 100644 samples/client/petstore/kotlin/docs/paths/fakerefsenum/post/requestbody/content/applicationjson/ApplicationjsonSchema.md create mode 100644 samples/client/petstore/kotlin/docs/paths/fakerefsenum/post/responses/FakerefsenumPostCode200Response.md create mode 100644 samples/client/petstore/kotlin/docs/paths/fakerefsenum/post/responses/code200response/content/applicationjson/ApplicationjsonSchema.md create mode 100644 samples/client/petstore/kotlin/docs/paths/fakerefsmammal/FakerefsmammalPost.md create mode 100644 samples/client/petstore/kotlin/docs/paths/fakerefsmammal/post/FakerefsmammalPostRequestBody.md create mode 100644 samples/client/petstore/kotlin/docs/paths/fakerefsmammal/post/FakerefsmammalPostResponses.md create mode 100644 samples/client/petstore/kotlin/docs/paths/fakerefsmammal/post/requestbody/content/applicationjson/ApplicationjsonSchema.md create mode 100644 samples/client/petstore/kotlin/docs/paths/fakerefsmammal/post/responses/FakerefsmammalPostCode200Response.md create mode 100644 samples/client/petstore/kotlin/docs/paths/fakerefsmammal/post/responses/code200response/content/applicationjson/ApplicationjsonSchema.md create mode 100644 samples/client/petstore/kotlin/docs/paths/fakerefsnumber/FakerefsnumberPost.md create mode 100644 samples/client/petstore/kotlin/docs/paths/fakerefsnumber/post/FakerefsnumberPostRequestBody.md create mode 100644 samples/client/petstore/kotlin/docs/paths/fakerefsnumber/post/FakerefsnumberPostResponses.md create mode 100644 samples/client/petstore/kotlin/docs/paths/fakerefsnumber/post/requestbody/content/applicationjson/ApplicationjsonSchema.md create mode 100644 samples/client/petstore/kotlin/docs/paths/fakerefsnumber/post/responses/FakerefsnumberPostCode200Response.md create mode 100644 samples/client/petstore/kotlin/docs/paths/fakerefsnumber/post/responses/code200response/content/applicationjson/ApplicationjsonSchema.md create mode 100644 samples/client/petstore/kotlin/docs/paths/fakerefsobjectmodelwithrefprops/FakerefsobjectmodelwithrefpropsPost.md create mode 100644 samples/client/petstore/kotlin/docs/paths/fakerefsobjectmodelwithrefprops/post/FakerefsobjectmodelwithrefpropsPostRequestBody.md create mode 100644 samples/client/petstore/kotlin/docs/paths/fakerefsobjectmodelwithrefprops/post/FakerefsobjectmodelwithrefpropsPostResponses.md create mode 100644 samples/client/petstore/kotlin/docs/paths/fakerefsobjectmodelwithrefprops/post/requestbody/content/applicationjson/ApplicationjsonSchema.md create mode 100644 samples/client/petstore/kotlin/docs/paths/fakerefsobjectmodelwithrefprops/post/responses/FakerefsobjectmodelwithrefpropsPostCode200Response.md create mode 100644 samples/client/petstore/kotlin/docs/paths/fakerefsobjectmodelwithrefprops/post/responses/code200response/content/applicationjson/ApplicationjsonSchema.md create mode 100644 samples/client/petstore/kotlin/docs/paths/fakerefsstring/FakerefsstringPost.md create mode 100644 samples/client/petstore/kotlin/docs/paths/fakerefsstring/post/FakerefsstringPostRequestBody.md create mode 100644 samples/client/petstore/kotlin/docs/paths/fakerefsstring/post/FakerefsstringPostResponses.md create mode 100644 samples/client/petstore/kotlin/docs/paths/fakerefsstring/post/requestbody/content/applicationjson/ApplicationjsonSchema.md create mode 100644 samples/client/petstore/kotlin/docs/paths/fakerefsstring/post/responses/FakerefsstringPostCode200Response.md create mode 100644 samples/client/petstore/kotlin/docs/paths/fakerefsstring/post/responses/code200response/content/applicationjson/ApplicationjsonSchema.md create mode 100644 samples/client/petstore/kotlin/docs/paths/fakeresponsewithoutschema/FakeresponsewithoutschemaGet.md create mode 100644 samples/client/petstore/kotlin/docs/paths/fakeresponsewithoutschema/get/FakeresponsewithoutschemaGetResponses.md create mode 100644 samples/client/petstore/kotlin/docs/paths/fakeresponsewithoutschema/get/responses/FakeresponsewithoutschemaGetCode200Response.md create mode 100644 samples/client/petstore/kotlin/docs/paths/faketestqueryparamters/FaketestqueryparamtersPut.md create mode 100644 samples/client/petstore/kotlin/docs/paths/faketestqueryparamters/put/FaketestqueryparamtersPutQueryParameters.md create mode 100644 samples/client/petstore/kotlin/docs/paths/faketestqueryparamters/put/FaketestqueryparamtersPutResponses.md create mode 100644 samples/client/petstore/kotlin/docs/paths/faketestqueryparamters/put/parameters/parameter0/Schema0.md create mode 100644 samples/client/petstore/kotlin/docs/paths/faketestqueryparamters/put/parameters/parameter1/Schema1.md create mode 100644 samples/client/petstore/kotlin/docs/paths/faketestqueryparamters/put/parameters/parameter2/Schema2.md create mode 100644 samples/client/petstore/kotlin/docs/paths/faketestqueryparamters/put/parameters/parameter3/Schema3.md create mode 100644 samples/client/petstore/kotlin/docs/paths/faketestqueryparamters/put/parameters/parameter4/Schema4.md create mode 100644 samples/client/petstore/kotlin/docs/paths/faketestqueryparamters/put/parameters/parameter5/Schema5.md create mode 100644 samples/client/petstore/kotlin/docs/paths/faketestqueryparamters/put/responses/FaketestqueryparamtersPutCode200Response.md create mode 100644 samples/client/petstore/kotlin/docs/paths/fakeuploaddownloadfile/FakeuploaddownloadfilePost.md create mode 100644 samples/client/petstore/kotlin/docs/paths/fakeuploaddownloadfile/post/FakeuploaddownloadfilePostRequestBody.md create mode 100644 samples/client/petstore/kotlin/docs/paths/fakeuploaddownloadfile/post/FakeuploaddownloadfilePostResponses.md create mode 100644 samples/client/petstore/kotlin/docs/paths/fakeuploaddownloadfile/post/requestbody/content/applicationoctetstream/ApplicationoctetstreamSchema.md create mode 100644 samples/client/petstore/kotlin/docs/paths/fakeuploaddownloadfile/post/responses/FakeuploaddownloadfilePostCode200Response.md create mode 100644 samples/client/petstore/kotlin/docs/paths/fakeuploaddownloadfile/post/responses/code200response/content/applicationoctetstream/ApplicationoctetstreamSchema.md create mode 100644 samples/client/petstore/kotlin/docs/paths/fakeuploadfile/FakeuploadfilePost.md create mode 100644 samples/client/petstore/kotlin/docs/paths/fakeuploadfile/post/FakeuploadfilePostRequestBody.md create mode 100644 samples/client/petstore/kotlin/docs/paths/fakeuploadfile/post/FakeuploadfilePostResponses.md create mode 100644 samples/client/petstore/kotlin/docs/paths/fakeuploadfile/post/requestbody/content/multipartformdata/MultipartformdataSchema.md create mode 100644 samples/client/petstore/kotlin/docs/paths/fakeuploadfile/post/responses/FakeuploadfilePostCode200Response.md create mode 100644 samples/client/petstore/kotlin/docs/paths/fakeuploadfile/post/responses/code200response/content/applicationjson/ApplicationjsonSchema.md create mode 100644 samples/client/petstore/kotlin/docs/paths/fakeuploadfiles/FakeuploadfilesPost.md create mode 100644 samples/client/petstore/kotlin/docs/paths/fakeuploadfiles/post/FakeuploadfilesPostRequestBody.md create mode 100644 samples/client/petstore/kotlin/docs/paths/fakeuploadfiles/post/FakeuploadfilesPostResponses.md create mode 100644 samples/client/petstore/kotlin/docs/paths/fakeuploadfiles/post/requestbody/content/multipartformdata/MultipartformdataSchema.md create mode 100644 samples/client/petstore/kotlin/docs/paths/fakeuploadfiles/post/responses/FakeuploadfilesPostCode200Response.md create mode 100644 samples/client/petstore/kotlin/docs/paths/fakeuploadfiles/post/responses/code200response/content/applicationjson/ApplicationjsonSchema.md create mode 100644 samples/client/petstore/kotlin/docs/paths/fakewildcardresponses/FakewildcardresponsesGet.md create mode 100644 samples/client/petstore/kotlin/docs/paths/fakewildcardresponses/get/FakewildcardresponsesGetResponses.md create mode 100644 samples/client/petstore/kotlin/docs/paths/fakewildcardresponses/get/responses/FakewildcardresponsesGetCode1XXResponse.md create mode 100644 samples/client/petstore/kotlin/docs/paths/fakewildcardresponses/get/responses/FakewildcardresponsesGetCode200Response.md create mode 100644 samples/client/petstore/kotlin/docs/paths/fakewildcardresponses/get/responses/FakewildcardresponsesGetCode2XXResponse.md create mode 100644 samples/client/petstore/kotlin/docs/paths/fakewildcardresponses/get/responses/FakewildcardresponsesGetCode3XXResponse.md create mode 100644 samples/client/petstore/kotlin/docs/paths/fakewildcardresponses/get/responses/FakewildcardresponsesGetCode4XXResponse.md create mode 100644 samples/client/petstore/kotlin/docs/paths/fakewildcardresponses/get/responses/FakewildcardresponsesGetCode5XXResponse.md create mode 100644 samples/client/petstore/kotlin/docs/paths/fakewildcardresponses/get/responses/code1xxresponse/content/applicationjson/ApplicationjsonSchema.md create mode 100644 samples/client/petstore/kotlin/docs/paths/fakewildcardresponses/get/responses/code200response/content/applicationjson/ApplicationjsonSchema.md create mode 100644 samples/client/petstore/kotlin/docs/paths/fakewildcardresponses/get/responses/code2xxresponse/content/applicationjson/ApplicationjsonSchema.md create mode 100644 samples/client/petstore/kotlin/docs/paths/fakewildcardresponses/get/responses/code3xxresponse/content/applicationjson/ApplicationjsonSchema.md create mode 100644 samples/client/petstore/kotlin/docs/paths/fakewildcardresponses/get/responses/code4xxresponse/content/applicationjson/ApplicationjsonSchema.md create mode 100644 samples/client/petstore/kotlin/docs/paths/fakewildcardresponses/get/responses/code5xxresponse/content/applicationjson/ApplicationjsonSchema.md create mode 100644 samples/client/petstore/kotlin/docs/paths/foo/FooGet.md create mode 100644 samples/client/petstore/kotlin/docs/paths/foo/get/FooGetResponses.md create mode 100644 samples/client/petstore/kotlin/docs/paths/foo/get/FooGetServerInfo.md create mode 100644 samples/client/petstore/kotlin/docs/paths/foo/get/responses/FooGetCodedefaultResponse.md create mode 100644 samples/client/petstore/kotlin/docs/paths/foo/get/responses/codedefaultresponse/content/applicationjson/ApplicationjsonSchema.md create mode 100644 samples/client/petstore/kotlin/docs/paths/foo/get/servers/FooGetServer0.md create mode 100644 samples/client/petstore/kotlin/docs/paths/foo/get/servers/FooGetServer1.md create mode 100644 samples/client/petstore/kotlin/docs/paths/foo/get/servers/server1/FooGetServer1Variables.md create mode 100644 samples/client/petstore/kotlin/docs/paths/pet/PetPost.md create mode 100644 samples/client/petstore/kotlin/docs/paths/pet/PetPut.md create mode 100644 samples/client/petstore/kotlin/docs/paths/pet/post/PetPostRequestBody.md create mode 100644 samples/client/petstore/kotlin/docs/paths/pet/post/PetPostResponses.md create mode 100644 samples/client/petstore/kotlin/docs/paths/pet/post/PetPostSecurityInfo.md create mode 100644 samples/client/petstore/kotlin/docs/paths/pet/post/responses/PetPostCode200Response.md create mode 100644 samples/client/petstore/kotlin/docs/paths/pet/post/responses/PetPostCode405Response.md create mode 100644 samples/client/petstore/kotlin/docs/paths/pet/post/security/PetPostSecurityRequirementObject0.md create mode 100644 samples/client/petstore/kotlin/docs/paths/pet/post/security/PetPostSecurityRequirementObject1.md create mode 100644 samples/client/petstore/kotlin/docs/paths/pet/post/security/PetPostSecurityRequirementObject2.md create mode 100644 samples/client/petstore/kotlin/docs/paths/pet/put/PetPutRequestBody.md create mode 100644 samples/client/petstore/kotlin/docs/paths/pet/put/PetPutResponses.md create mode 100644 samples/client/petstore/kotlin/docs/paths/pet/put/PetPutSecurityInfo.md create mode 100644 samples/client/petstore/kotlin/docs/paths/pet/put/responses/PetPutCode400Response.md create mode 100644 samples/client/petstore/kotlin/docs/paths/pet/put/responses/PetPutCode404Response.md create mode 100644 samples/client/petstore/kotlin/docs/paths/pet/put/responses/PetPutCode405Response.md create mode 100644 samples/client/petstore/kotlin/docs/paths/pet/put/security/PetPutSecurityRequirementObject0.md create mode 100644 samples/client/petstore/kotlin/docs/paths/pet/put/security/PetPutSecurityRequirementObject1.md create mode 100644 samples/client/petstore/kotlin/docs/paths/petfindbystatus/PetfindbystatusGet.md create mode 100644 samples/client/petstore/kotlin/docs/paths/petfindbystatus/PetfindbystatusServerInfo.md create mode 100644 samples/client/petstore/kotlin/docs/paths/petfindbystatus/get/PetfindbystatusGetQueryParameters.md create mode 100644 samples/client/petstore/kotlin/docs/paths/petfindbystatus/get/PetfindbystatusGetResponses.md create mode 100644 samples/client/petstore/kotlin/docs/paths/petfindbystatus/get/PetfindbystatusGetSecurityInfo.md create mode 100644 samples/client/petstore/kotlin/docs/paths/petfindbystatus/get/parameters/parameter0/Schema0.md create mode 100644 samples/client/petstore/kotlin/docs/paths/petfindbystatus/get/responses/PetfindbystatusGetCode200Response.md create mode 100644 samples/client/petstore/kotlin/docs/paths/petfindbystatus/get/responses/PetfindbystatusGetCode400Response.md create mode 100644 samples/client/petstore/kotlin/docs/paths/petfindbystatus/get/security/PetfindbystatusGetSecurityRequirementObject0.md create mode 100644 samples/client/petstore/kotlin/docs/paths/petfindbystatus/get/security/PetfindbystatusGetSecurityRequirementObject1.md create mode 100644 samples/client/petstore/kotlin/docs/paths/petfindbystatus/get/security/PetfindbystatusGetSecurityRequirementObject2.md create mode 100644 samples/client/petstore/kotlin/docs/paths/petfindbystatus/servers/PetfindbystatusServer0.md create mode 100644 samples/client/petstore/kotlin/docs/paths/petfindbystatus/servers/PetfindbystatusServer1.md create mode 100644 samples/client/petstore/kotlin/docs/paths/petfindbystatus/servers/server1/PetfindbystatusServer1Variables.md create mode 100644 samples/client/petstore/kotlin/docs/paths/petfindbytags/PetfindbytagsGet.md create mode 100644 samples/client/petstore/kotlin/docs/paths/petfindbytags/get/PetfindbytagsGetQueryParameters.md create mode 100644 samples/client/petstore/kotlin/docs/paths/petfindbytags/get/PetfindbytagsGetResponses.md create mode 100644 samples/client/petstore/kotlin/docs/paths/petfindbytags/get/PetfindbytagsGetSecurityInfo.md create mode 100644 samples/client/petstore/kotlin/docs/paths/petfindbytags/get/parameters/parameter0/Schema0.md create mode 100644 samples/client/petstore/kotlin/docs/paths/petfindbytags/get/responses/PetfindbytagsGetCode200Response.md create mode 100644 samples/client/petstore/kotlin/docs/paths/petfindbytags/get/responses/PetfindbytagsGetCode400Response.md create mode 100644 samples/client/petstore/kotlin/docs/paths/petfindbytags/get/security/PetfindbytagsGetSecurityRequirementObject0.md create mode 100644 samples/client/petstore/kotlin/docs/paths/petfindbytags/get/security/PetfindbytagsGetSecurityRequirementObject1.md create mode 100644 samples/client/petstore/kotlin/docs/paths/petpetid/PetpetidDelete.md create mode 100644 samples/client/petstore/kotlin/docs/paths/petpetid/PetpetidGet.md create mode 100644 samples/client/petstore/kotlin/docs/paths/petpetid/PetpetidPost.md create mode 100644 samples/client/petstore/kotlin/docs/paths/petpetid/delete/PetpetidDeleteHeaderParameters.md create mode 100644 samples/client/petstore/kotlin/docs/paths/petpetid/delete/PetpetidDeletePathParameters.md create mode 100644 samples/client/petstore/kotlin/docs/paths/petpetid/delete/PetpetidDeleteResponses.md create mode 100644 samples/client/petstore/kotlin/docs/paths/petpetid/delete/PetpetidDeleteSecurityInfo.md create mode 100644 samples/client/petstore/kotlin/docs/paths/petpetid/delete/parameters/parameter0/Schema0.md create mode 100644 samples/client/petstore/kotlin/docs/paths/petpetid/delete/parameters/parameter1/Schema1.md create mode 100644 samples/client/petstore/kotlin/docs/paths/petpetid/delete/responses/PetpetidDeleteCode400Response.md create mode 100644 samples/client/petstore/kotlin/docs/paths/petpetid/delete/security/PetpetidDeleteSecurityRequirementObject0.md create mode 100644 samples/client/petstore/kotlin/docs/paths/petpetid/delete/security/PetpetidDeleteSecurityRequirementObject1.md create mode 100644 samples/client/petstore/kotlin/docs/paths/petpetid/get/PetpetidGetPathParameters.md create mode 100644 samples/client/petstore/kotlin/docs/paths/petpetid/get/PetpetidGetResponses.md create mode 100644 samples/client/petstore/kotlin/docs/paths/petpetid/get/PetpetidGetSecurityInfo.md create mode 100644 samples/client/petstore/kotlin/docs/paths/petpetid/get/parameters/parameter0/Schema0.md create mode 100644 samples/client/petstore/kotlin/docs/paths/petpetid/get/responses/PetpetidGetCode200Response.md create mode 100644 samples/client/petstore/kotlin/docs/paths/petpetid/get/responses/PetpetidGetCode400Response.md create mode 100644 samples/client/petstore/kotlin/docs/paths/petpetid/get/responses/PetpetidGetCode404Response.md create mode 100644 samples/client/petstore/kotlin/docs/paths/petpetid/get/responses/code200response/content/applicationjson/ApplicationjsonSchema.md create mode 100644 samples/client/petstore/kotlin/docs/paths/petpetid/get/responses/code200response/content/applicationxml/ApplicationxmlSchema.md create mode 100644 samples/client/petstore/kotlin/docs/paths/petpetid/get/security/PetpetidGetSecurityRequirementObject0.md create mode 100644 samples/client/petstore/kotlin/docs/paths/petpetid/post/PetpetidPostPathParameters.md create mode 100644 samples/client/petstore/kotlin/docs/paths/petpetid/post/PetpetidPostRequestBody.md create mode 100644 samples/client/petstore/kotlin/docs/paths/petpetid/post/PetpetidPostResponses.md create mode 100644 samples/client/petstore/kotlin/docs/paths/petpetid/post/PetpetidPostSecurityInfo.md create mode 100644 samples/client/petstore/kotlin/docs/paths/petpetid/post/parameters/parameter0/Schema0.md create mode 100644 samples/client/petstore/kotlin/docs/paths/petpetid/post/requestbody/content/applicationxwwwformurlencoded/ApplicationxwwwformurlencodedSchema.md create mode 100644 samples/client/petstore/kotlin/docs/paths/petpetid/post/responses/PetpetidPostCode405Response.md create mode 100644 samples/client/petstore/kotlin/docs/paths/petpetid/post/security/PetpetidPostSecurityRequirementObject0.md create mode 100644 samples/client/petstore/kotlin/docs/paths/petpetid/post/security/PetpetidPostSecurityRequirementObject1.md create mode 100644 samples/client/petstore/kotlin/docs/paths/petpetiduploadimage/PetpetiduploadimagePost.md create mode 100644 samples/client/petstore/kotlin/docs/paths/petpetiduploadimage/post/PetpetiduploadimagePostPathParameters.md create mode 100644 samples/client/petstore/kotlin/docs/paths/petpetiduploadimage/post/PetpetiduploadimagePostRequestBody.md create mode 100644 samples/client/petstore/kotlin/docs/paths/petpetiduploadimage/post/PetpetiduploadimagePostResponses.md create mode 100644 samples/client/petstore/kotlin/docs/paths/petpetiduploadimage/post/PetpetiduploadimagePostSecurityInfo.md create mode 100644 samples/client/petstore/kotlin/docs/paths/petpetiduploadimage/post/parameters/parameter0/Schema0.md create mode 100644 samples/client/petstore/kotlin/docs/paths/petpetiduploadimage/post/requestbody/content/multipartformdata/MultipartformdataSchema.md create mode 100644 samples/client/petstore/kotlin/docs/paths/petpetiduploadimage/post/responses/PetpetiduploadimagePostCode200Response.md create mode 100644 samples/client/petstore/kotlin/docs/paths/petpetiduploadimage/post/security/PetpetiduploadimagePostSecurityRequirementObject0.md create mode 100644 samples/client/petstore/kotlin/docs/paths/solidus/SolidusGet.md create mode 100644 samples/client/petstore/kotlin/docs/paths/solidus/get/SolidusGetResponses.md create mode 100644 samples/client/petstore/kotlin/docs/paths/solidus/get/responses/SolidusGetCode200Response.md create mode 100644 samples/client/petstore/kotlin/docs/paths/storeinventory/StoreinventoryGet.md create mode 100644 samples/client/petstore/kotlin/docs/paths/storeinventory/get/StoreinventoryGetResponses.md create mode 100644 samples/client/petstore/kotlin/docs/paths/storeinventory/get/StoreinventoryGetSecurityInfo.md create mode 100644 samples/client/petstore/kotlin/docs/paths/storeinventory/get/responses/StoreinventoryGetCode200Response.md create mode 100644 samples/client/petstore/kotlin/docs/paths/storeinventory/get/security/StoreinventoryGetSecurityRequirementObject0.md create mode 100644 samples/client/petstore/kotlin/docs/paths/storeorder/StoreorderPost.md create mode 100644 samples/client/petstore/kotlin/docs/paths/storeorder/post/StoreorderPostRequestBody.md create mode 100644 samples/client/petstore/kotlin/docs/paths/storeorder/post/StoreorderPostResponses.md create mode 100644 samples/client/petstore/kotlin/docs/paths/storeorder/post/requestbody/content/applicationjson/ApplicationjsonSchema.md create mode 100644 samples/client/petstore/kotlin/docs/paths/storeorder/post/responses/StoreorderPostCode200Response.md create mode 100644 samples/client/petstore/kotlin/docs/paths/storeorder/post/responses/StoreorderPostCode400Response.md create mode 100644 samples/client/petstore/kotlin/docs/paths/storeorder/post/responses/code200response/content/applicationjson/ApplicationjsonSchema.md create mode 100644 samples/client/petstore/kotlin/docs/paths/storeorder/post/responses/code200response/content/applicationxml/ApplicationxmlSchema.md create mode 100644 samples/client/petstore/kotlin/docs/paths/storeorderorderid/StoreorderorderidDelete.md create mode 100644 samples/client/petstore/kotlin/docs/paths/storeorderorderid/StoreorderorderidGet.md create mode 100644 samples/client/petstore/kotlin/docs/paths/storeorderorderid/delete/StoreorderorderidDeletePathParameters.md create mode 100644 samples/client/petstore/kotlin/docs/paths/storeorderorderid/delete/StoreorderorderidDeleteResponses.md create mode 100644 samples/client/petstore/kotlin/docs/paths/storeorderorderid/delete/parameters/parameter0/Schema0.md create mode 100644 samples/client/petstore/kotlin/docs/paths/storeorderorderid/delete/responses/StoreorderorderidDeleteCode400Response.md create mode 100644 samples/client/petstore/kotlin/docs/paths/storeorderorderid/delete/responses/StoreorderorderidDeleteCode404Response.md create mode 100644 samples/client/petstore/kotlin/docs/paths/storeorderorderid/get/StoreorderorderidGetPathParameters.md create mode 100644 samples/client/petstore/kotlin/docs/paths/storeorderorderid/get/StoreorderorderidGetResponses.md create mode 100644 samples/client/petstore/kotlin/docs/paths/storeorderorderid/get/parameters/parameter0/Schema0.md create mode 100644 samples/client/petstore/kotlin/docs/paths/storeorderorderid/get/responses/StoreorderorderidGetCode200Response.md create mode 100644 samples/client/petstore/kotlin/docs/paths/storeorderorderid/get/responses/StoreorderorderidGetCode400Response.md create mode 100644 samples/client/petstore/kotlin/docs/paths/storeorderorderid/get/responses/StoreorderorderidGetCode404Response.md create mode 100644 samples/client/petstore/kotlin/docs/paths/storeorderorderid/get/responses/code200response/content/applicationjson/ApplicationjsonSchema.md create mode 100644 samples/client/petstore/kotlin/docs/paths/storeorderorderid/get/responses/code200response/content/applicationxml/ApplicationxmlSchema.md create mode 100644 samples/client/petstore/kotlin/docs/paths/user/UserPost.md create mode 100644 samples/client/petstore/kotlin/docs/paths/user/post/UserPostRequestBody.md create mode 100644 samples/client/petstore/kotlin/docs/paths/user/post/UserPostResponses.md create mode 100644 samples/client/petstore/kotlin/docs/paths/user/post/requestbody/content/applicationjson/ApplicationjsonSchema.md create mode 100644 samples/client/petstore/kotlin/docs/paths/user/post/responses/UserPostCodedefaultResponse.md create mode 100644 samples/client/petstore/kotlin/docs/paths/usercreatewitharray/UsercreatewitharrayPost.md create mode 100644 samples/client/petstore/kotlin/docs/paths/usercreatewitharray/post/UsercreatewitharrayPostRequestBody.md create mode 100644 samples/client/petstore/kotlin/docs/paths/usercreatewitharray/post/UsercreatewitharrayPostResponses.md create mode 100644 samples/client/petstore/kotlin/docs/paths/usercreatewitharray/post/responses/UsercreatewitharrayPostCodedefaultResponse.md create mode 100644 samples/client/petstore/kotlin/docs/paths/usercreatewithlist/UsercreatewithlistPost.md create mode 100644 samples/client/petstore/kotlin/docs/paths/usercreatewithlist/post/UsercreatewithlistPostRequestBody.md create mode 100644 samples/client/petstore/kotlin/docs/paths/usercreatewithlist/post/UsercreatewithlistPostResponses.md create mode 100644 samples/client/petstore/kotlin/docs/paths/usercreatewithlist/post/responses/UsercreatewithlistPostCodedefaultResponse.md create mode 100644 samples/client/petstore/kotlin/docs/paths/userlogin/UserloginGet.md create mode 100644 samples/client/petstore/kotlin/docs/paths/userlogin/get/UserloginGetQueryParameters.md create mode 100644 samples/client/petstore/kotlin/docs/paths/userlogin/get/UserloginGetResponses.md create mode 100644 samples/client/petstore/kotlin/docs/paths/userlogin/get/parameters/parameter0/Schema0.md create mode 100644 samples/client/petstore/kotlin/docs/paths/userlogin/get/parameters/parameter1/Schema1.md create mode 100644 samples/client/petstore/kotlin/docs/paths/userlogin/get/responses/UserloginGetCode200Response.md create mode 100644 samples/client/petstore/kotlin/docs/paths/userlogin/get/responses/UserloginGetCode400Response.md create mode 100644 samples/client/petstore/kotlin/docs/paths/userlogin/get/responses/code200response/UserloginGetCode200ResponseHeadersSchema.md create mode 100644 samples/client/petstore/kotlin/docs/paths/userlogin/get/responses/code200response/content/applicationjson/ApplicationjsonSchema.md create mode 100644 samples/client/petstore/kotlin/docs/paths/userlogin/get/responses/code200response/content/applicationxml/ApplicationxmlSchema.md create mode 100644 samples/client/petstore/kotlin/docs/paths/userlogin/get/responses/code200response/headers/xexpiresafter/XExpiresAfterSchema.md create mode 100644 samples/client/petstore/kotlin/docs/paths/userlogin/get/responses/code200response/headers/xratelimit/content/applicationjson/XRateLimitSchema.md create mode 100644 samples/client/petstore/kotlin/docs/paths/userlogout/UserlogoutGet.md create mode 100644 samples/client/petstore/kotlin/docs/paths/userlogout/get/UserlogoutGetResponses.md create mode 100644 samples/client/petstore/kotlin/docs/paths/userlogout/get/responses/UserlogoutGetCodedefaultResponse.md create mode 100644 samples/client/petstore/kotlin/docs/paths/userusername/UserusernameDelete.md create mode 100644 samples/client/petstore/kotlin/docs/paths/userusername/UserusernameGet.md create mode 100644 samples/client/petstore/kotlin/docs/paths/userusername/UserusernamePut.md create mode 100644 samples/client/petstore/kotlin/docs/paths/userusername/delete/UserusernameDeletePathParameters.md create mode 100644 samples/client/petstore/kotlin/docs/paths/userusername/delete/UserusernameDeleteResponses.md create mode 100644 samples/client/petstore/kotlin/docs/paths/userusername/delete/responses/UserusernameDeleteCode200Response.md create mode 100644 samples/client/petstore/kotlin/docs/paths/userusername/delete/responses/UserusernameDeleteCode404Response.md create mode 100644 samples/client/petstore/kotlin/docs/paths/userusername/get/UserusernameGetPathParameters.md create mode 100644 samples/client/petstore/kotlin/docs/paths/userusername/get/UserusernameGetResponses.md create mode 100644 samples/client/petstore/kotlin/docs/paths/userusername/get/responses/UserusernameGetCode200Response.md create mode 100644 samples/client/petstore/kotlin/docs/paths/userusername/get/responses/UserusernameGetCode400Response.md create mode 100644 samples/client/petstore/kotlin/docs/paths/userusername/get/responses/UserusernameGetCode404Response.md create mode 100644 samples/client/petstore/kotlin/docs/paths/userusername/get/responses/code200response/content/applicationjson/ApplicationjsonSchema.md create mode 100644 samples/client/petstore/kotlin/docs/paths/userusername/get/responses/code200response/content/applicationxml/ApplicationxmlSchema.md create mode 100644 samples/client/petstore/kotlin/docs/paths/userusername/put/UserusernamePutPathParameters.md create mode 100644 samples/client/petstore/kotlin/docs/paths/userusername/put/UserusernamePutRequestBody.md create mode 100644 samples/client/petstore/kotlin/docs/paths/userusername/put/UserusernamePutResponses.md create mode 100644 samples/client/petstore/kotlin/docs/paths/userusername/put/requestbody/content/applicationjson/ApplicationjsonSchema.md create mode 100644 samples/client/petstore/kotlin/docs/paths/userusername/put/responses/UserusernamePutCode400Response.md create mode 100644 samples/client/petstore/kotlin/docs/paths/userusername/put/responses/UserusernamePutCode404Response.md create mode 100644 samples/client/petstore/kotlin/docs/servers/RootServer0.md create mode 100644 samples/client/petstore/kotlin/docs/servers/RootServer1.md create mode 100644 samples/client/petstore/kotlin/docs/servers/RootServer2.md create mode 100644 samples/client/petstore/kotlin/docs/servers/rootserver0/RootServer0Variables.md create mode 100644 samples/client/petstore/kotlin/docs/servers/rootserver1/RootServer1Variables.md create mode 100644 samples/client/petstore/kotlin/settings.gradle.kts create mode 100644 samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/RootServerInfo.kt create mode 100644 samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/apiclient/ApiClient.kt create mode 100644 samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/apis/paths/Anotherfakedummy.kt create mode 100644 samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/apis/paths/Commonparamsubdir.kt create mode 100644 samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/apis/paths/Fake.kt create mode 100644 samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/apis/paths/Fakeadditionalpropertieswitharrayofenums.kt create mode 100644 samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/apis/paths/Fakebodywithfileschema.kt create mode 100644 samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/apis/paths/Fakebodywithqueryparams.kt create mode 100644 samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/apis/paths/Fakecasesensitiveparams.kt create mode 100644 samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/apis/paths/Fakeclassnametest.kt create mode 100644 samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/apis/paths/Fakedeletecoffeeid.kt create mode 100644 samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/apis/paths/Fakehealth.kt create mode 100644 samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/apis/paths/Fakeinlineadditionalproperties.kt create mode 100644 samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/apis/paths/Fakeinlinecomposition.kt create mode 100644 samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/apis/paths/Fakejsonformdata.kt create mode 100644 samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/apis/paths/Fakejsonpatch.kt create mode 100644 samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/apis/paths/Fakejsonwithcharset.kt create mode 100644 samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/apis/paths/Fakemultiplerequestbodycontenttypes.kt create mode 100644 samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/apis/paths/Fakemultipleresponsebodies.kt create mode 100644 samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/apis/paths/Fakemultiplesecurities.kt create mode 100644 samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/apis/paths/Fakeobjinquery.kt create mode 100644 samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/apis/paths/Fakeparametercollisions1ababselfab.kt create mode 100644 samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/apis/paths/Fakepemcontenttype.kt create mode 100644 samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/apis/paths/Fakepetiduploadimagewithrequiredfile.kt create mode 100644 samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/apis/paths/Fakequeryparamwithjsoncontenttype.kt create mode 100644 samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/apis/paths/Fakeredirection.kt create mode 100644 samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/apis/paths/Fakerefobjinquery.kt create mode 100644 samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/apis/paths/Fakerefsarraymodel.kt create mode 100644 samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/apis/paths/Fakerefsarrayofenums.kt create mode 100644 samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/apis/paths/Fakerefsboolean.kt create mode 100644 samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/apis/paths/Fakerefscomposedoneofnumberwithvalidations.kt create mode 100644 samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/apis/paths/Fakerefsenum.kt create mode 100644 samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/apis/paths/Fakerefsmammal.kt create mode 100644 samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/apis/paths/Fakerefsnumber.kt create mode 100644 samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/apis/paths/Fakerefsobjectmodelwithrefprops.kt create mode 100644 samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/apis/paths/Fakerefsstring.kt create mode 100644 samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/apis/paths/Fakeresponsewithoutschema.kt create mode 100644 samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/apis/paths/Faketestqueryparamters.kt create mode 100644 samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/apis/paths/Fakeuploaddownloadfile.kt create mode 100644 samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/apis/paths/Fakeuploadfile.kt create mode 100644 samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/apis/paths/Fakeuploadfiles.kt create mode 100644 samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/apis/paths/Fakewildcardresponses.kt create mode 100644 samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/apis/paths/Foo.kt create mode 100644 samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/apis/paths/Pet.kt create mode 100644 samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/apis/paths/Petfindbystatus.kt create mode 100644 samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/apis/paths/Petfindbytags.kt create mode 100644 samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/apis/paths/Petpetid.kt create mode 100644 samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/apis/paths/Petpetiduploadimage.kt create mode 100644 samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/apis/paths/Solidus.kt create mode 100644 samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/apis/paths/Storeinventory.kt create mode 100644 samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/apis/paths/Storeorder.kt create mode 100644 samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/apis/paths/Storeorderorderid.kt create mode 100644 samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/apis/paths/User.kt create mode 100644 samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/apis/paths/Usercreatewitharray.kt create mode 100644 samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/apis/paths/Usercreatewithlist.kt create mode 100644 samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/apis/paths/Userlogin.kt create mode 100644 samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/apis/paths/Userlogout.kt create mode 100644 samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/apis/paths/Userusername.kt create mode 100644 samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/apis/tags/Anotherfake.kt create mode 100644 samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/apis/tags/Default.kt create mode 100644 samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/apis/tags/Fake.kt create mode 100644 samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/apis/tags/Fakeclassnametags123.kt create mode 100644 samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/apis/tags/Pet.kt create mode 100644 samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/apis/tags/Store.kt create mode 100644 samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/apis/tags/User.kt create mode 100644 samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/headers/Int32JsonContentTypeHeader.kt create mode 100644 samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/headers/NumberHeader.kt create mode 100644 samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/headers/RefContentSchemaHeader.kt create mode 100644 samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/headers/RefSchemaHeader.kt create mode 100644 samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/headers/RefStringHeader.kt create mode 100644 samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/headers/StringHeader.kt create mode 100644 samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/headers/int32jsoncontenttypeheader/content/applicationjson/Int32JsonContentTypeHeaderSchema.kt create mode 100644 samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/headers/numberheader/NumberHeaderSchema.kt create mode 100644 samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/headers/refcontentschemaheader/content/applicationjson/RefContentSchemaHeaderSchema.kt create mode 100644 samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/headers/refschemaheader/RefSchemaHeaderSchema.kt create mode 100644 samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/headers/stringheader/StringHeaderSchema.kt create mode 100644 samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/parameters/ComponentRefSchemaStringWithValidation.kt create mode 100644 samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/parameters/PathUserName.kt create mode 100644 samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/parameters/RefPathUserName.kt create mode 100644 samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/parameters/RefSchemaStringWithValidation.kt create mode 100644 samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/parameters/componentrefschemastringwithvalidation/content/applicationjson/ApplicationjsonSchema.kt create mode 100644 samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/parameters/pathusername/Schema.kt create mode 100644 samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/parameters/refschemastringwithvalidation/Schema.kt create mode 100644 samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/requestbodies/Client.kt create mode 100644 samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/requestbodies/Pet.kt create mode 100644 samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/requestbodies/RefUserArray.kt create mode 100644 samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/requestbodies/UserArray.kt create mode 100644 samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/requestbodies/client/content/applicationjson/ApplicationjsonSchema.kt create mode 100644 samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/requestbodies/pet/content/applicationjson/ApplicationjsonSchema.kt create mode 100644 samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/requestbodies/pet/content/applicationxml/ApplicationxmlSchema.kt create mode 100644 samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/requestbodies/userarray/content/applicationjson/ApplicationjsonSchema.kt create mode 100644 samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/responses/HeadersWithNoBody.kt create mode 100644 samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/responses/RefSuccessDescriptionOnly.kt create mode 100644 samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/responses/RefSuccessfulXmlAndJsonArrayOfPet.kt create mode 100644 samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/responses/SuccessDescriptionOnly.kt create mode 100644 samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/responses/SuccessInlineContentAndHeader.kt create mode 100644 samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/responses/SuccessWithJsonApiResponse.kt create mode 100644 samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/responses/SuccessfulXmlAndJsonArrayOfPet.kt create mode 100644 samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/responses/headerswithnobody/Headers.kt create mode 100644 samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/responses/headerswithnobody/HeadersWithNoBodyHeadersSchema.kt create mode 100644 samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/responses/headerswithnobody/headers/Location.kt create mode 100644 samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/responses/headerswithnobody/headers/location/LocationSchema.kt create mode 100644 samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/responses/successfulxmlandjsonarrayofpet/content/applicationjson/ApplicationjsonSchema.kt create mode 100644 samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/responses/successfulxmlandjsonarrayofpet/content/applicationxml/ApplicationxmlSchema.kt create mode 100644 samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/responses/successinlinecontentandheader/Headers.kt create mode 100644 samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/responses/successinlinecontentandheader/SuccessInlineContentAndHeaderHeadersSchema.kt create mode 100644 samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/responses/successinlinecontentandheader/content/applicationjson/ApplicationjsonSchema.kt create mode 100644 samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/responses/successinlinecontentandheader/headers/SomeHeader.kt create mode 100644 samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/responses/successinlinecontentandheader/headers/someheader/SomeHeaderSchema.kt create mode 100644 samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/responses/successwithjsonapiresponse/Headers.kt create mode 100644 samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/responses/successwithjsonapiresponse/SuccessWithJsonApiResponseHeadersSchema.kt create mode 100644 samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/responses/successwithjsonapiresponse/content/applicationjson/ApplicationjsonSchema.kt create mode 100644 samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/responses/successwithjsonapiresponse/headers/Int32.kt create mode 100644 samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/responses/successwithjsonapiresponse/headers/NumberHeader.kt create mode 100644 samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/responses/successwithjsonapiresponse/headers/Refcontentschemaheader.kt create mode 100644 samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/responses/successwithjsonapiresponse/headers/Refschemaheader.kt create mode 100644 samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/responses/successwithjsonapiresponse/headers/StringHeader.kt create mode 100644 samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/schemas/AbstractStepMessage.kt create mode 100644 samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/schemas/AdditionalPropertiesClass.kt create mode 100644 samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/schemas/AdditionalPropertiesSchema.kt create mode 100644 samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/schemas/AdditionalPropertiesWithArrayOfEnums.kt create mode 100644 samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/schemas/Address.kt create mode 100644 samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/schemas/Animal.kt create mode 100644 samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/schemas/AnimalFarm.kt create mode 100644 samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/schemas/AnyTypeAndFormat.kt create mode 100644 samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/schemas/AnyTypeNotString.kt create mode 100644 samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/schemas/ApiResponseSchema.kt create mode 100644 samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/schemas/Apple.kt create mode 100644 samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/schemas/AppleReq.kt create mode 100644 samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/schemas/ArrayHoldingAnyType.kt create mode 100644 samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/schemas/ArrayOfArrayOfNumberOnly.kt create mode 100644 samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/schemas/ArrayOfEnums.kt create mode 100644 samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/schemas/ArrayOfNumberOnly.kt create mode 100644 samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/schemas/ArrayTest.kt create mode 100644 samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/schemas/ArrayWithValidationsInItems.kt create mode 100644 samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/schemas/Banana.kt create mode 100644 samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/schemas/BananaReq.kt create mode 100644 samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/schemas/Bar.kt create mode 100644 samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/schemas/BasquePig.kt create mode 100644 samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/schemas/BooleanEnum.kt create mode 100644 samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/schemas/BooleanSchema.kt create mode 100644 samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/schemas/Capitalization.kt create mode 100644 samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/schemas/Cat.kt create mode 100644 samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/schemas/Category.kt create mode 100644 samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/schemas/ChildCat.kt create mode 100644 samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/schemas/ClassModel.kt create mode 100644 samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/schemas/Client.kt create mode 100644 samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/schemas/ComplexQuadrilateral.kt create mode 100644 samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/schemas/ComposedAnyOfDifferentTypesNoValidations.kt create mode 100644 samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/schemas/ComposedArray.kt create mode 100644 samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/schemas/ComposedBool.kt create mode 100644 samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/schemas/ComposedNone.kt create mode 100644 samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/schemas/ComposedNumber.kt create mode 100644 samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/schemas/ComposedObject.kt create mode 100644 samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/schemas/ComposedOneOfDifferentTypes.kt create mode 100644 samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/schemas/ComposedString.kt create mode 100644 samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/schemas/Currency.kt create mode 100644 samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/schemas/DanishPig.kt create mode 100644 samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/schemas/DateTimeTest.kt create mode 100644 samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/schemas/DateTimeWithValidations.kt create mode 100644 samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/schemas/DateWithValidations.kt create mode 100644 samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/schemas/DecimalPayload.kt create mode 100644 samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/schemas/Dog.kt create mode 100644 samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/schemas/Drawing.kt create mode 100644 samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/schemas/EnumArrays.kt create mode 100644 samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/schemas/EnumClass.kt create mode 100644 samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/schemas/EnumTest.kt create mode 100644 samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/schemas/EquilateralTriangle.kt create mode 100644 samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/schemas/File.kt create mode 100644 samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/schemas/FileSchemaTestClass.kt create mode 100644 samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/schemas/Foo.kt create mode 100644 samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/schemas/FormatTest.kt create mode 100644 samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/schemas/FromSchema.kt create mode 100644 samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/schemas/Fruit.kt create mode 100644 samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/schemas/FruitReq.kt create mode 100644 samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/schemas/GmFruit.kt create mode 100644 samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/schemas/GrandparentAnimal.kt create mode 100644 samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/schemas/HasOnlyReadOnly.kt create mode 100644 samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/schemas/HealthCheckResult.kt create mode 100644 samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/schemas/IntegerEnum.kt create mode 100644 samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/schemas/IntegerEnumBig.kt create mode 100644 samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/schemas/IntegerEnumOneValue.kt create mode 100644 samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/schemas/IntegerEnumWithDefaultValue.kt create mode 100644 samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/schemas/IntegerMax10.kt create mode 100644 samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/schemas/IntegerMin15.kt create mode 100644 samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/schemas/IsoscelesTriangle.kt create mode 100644 samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/schemas/Items.kt create mode 100644 samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/schemas/ItemsSchema.kt create mode 100644 samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/schemas/JSONPatchRequest.kt create mode 100644 samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/schemas/JSONPatchRequestAddReplaceTest.kt create mode 100644 samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/schemas/JSONPatchRequestMoveCopy.kt create mode 100644 samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/schemas/JSONPatchRequestRemove.kt create mode 100644 samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/schemas/Mammal.kt create mode 100644 samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/schemas/MapTest.kt create mode 100644 samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/schemas/MixedPropertiesAndAdditionalPropertiesClass.kt create mode 100644 samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/schemas/Money.kt create mode 100644 samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/schemas/MultiPropertiesSchema.kt create mode 100644 samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/schemas/MyObjectDto.kt create mode 100644 samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/schemas/Name.kt create mode 100644 samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/schemas/NoAdditionalProperties.kt create mode 100644 samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/schemas/NullableClass.kt create mode 100644 samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/schemas/NullableShape.kt create mode 100644 samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/schemas/NullableString.kt create mode 100644 samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/schemas/NumberOnly.kt create mode 100644 samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/schemas/NumberSchema.kt create mode 100644 samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/schemas/NumberWithExclusiveMinMax.kt create mode 100644 samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/schemas/NumberWithValidations.kt create mode 100644 samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/schemas/ObjWithRequiredProps.kt create mode 100644 samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/schemas/ObjWithRequiredPropsBase.kt create mode 100644 samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/schemas/ObjectInterface.kt create mode 100644 samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/schemas/ObjectModelWithArgAndArgsProperties.kt create mode 100644 samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/schemas/ObjectModelWithRefProps.kt create mode 100644 samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/schemas/ObjectWithAllOfWithReqTestPropFromUnsetAddProp.kt create mode 100644 samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/schemas/ObjectWithCollidingProperties.kt create mode 100644 samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/schemas/ObjectWithDecimalProperties.kt create mode 100644 samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/schemas/ObjectWithDifficultlyNamedProps.kt create mode 100644 samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/schemas/ObjectWithInlineCompositionProperty.kt create mode 100644 samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/schemas/ObjectWithInvalidNamedRefedProperties.kt create mode 100644 samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/schemas/ObjectWithNonIntersectingValues.kt create mode 100644 samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/schemas/ObjectWithOnlyOptionalProps.kt create mode 100644 samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/schemas/ObjectWithOptionalTestProp.kt create mode 100644 samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/schemas/ObjectWithValidations.kt create mode 100644 samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/schemas/Order.kt create mode 100644 samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/schemas/PaginatedResultMyObjectDto.kt create mode 100644 samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/schemas/ParentPet.kt create mode 100644 samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/schemas/Pet.kt create mode 100644 samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/schemas/Pig.kt create mode 100644 samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/schemas/Player.kt create mode 100644 samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/schemas/PublicKey.kt create mode 100644 samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/schemas/Quadrilateral.kt create mode 100644 samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/schemas/QuadrilateralInterface.kt create mode 100644 samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/schemas/ReadOnlyFirst.kt create mode 100644 samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/schemas/RefPet.kt create mode 100644 samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/schemas/ReqPropsFromExplicitAddProps.kt create mode 100644 samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/schemas/ReqPropsFromTrueAddProps.kt create mode 100644 samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/schemas/ReqPropsFromUnsetAddProps.kt create mode 100644 samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/schemas/ReturnSchema.kt create mode 100644 samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/schemas/ScaleneTriangle.kt create mode 100644 samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/schemas/Schema200Response.kt create mode 100644 samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/schemas/SelfReferencingArrayModel.kt create mode 100644 samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/schemas/SelfReferencingObjectModel.kt create mode 100644 samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/schemas/Shape.kt create mode 100644 samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/schemas/ShapeOrNull.kt create mode 100644 samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/schemas/SimpleQuadrilateral.kt create mode 100644 samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/schemas/SomeObject.kt create mode 100644 samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/schemas/SpecialModelname.kt create mode 100644 samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/schemas/StringBooleanMap.kt create mode 100644 samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/schemas/StringEnum.kt create mode 100644 samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/schemas/StringEnumWithDefaultValue.kt create mode 100644 samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/schemas/StringSchema.kt create mode 100644 samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/schemas/StringWithValidation.kt create mode 100644 samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/schemas/Tag.kt create mode 100644 samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/schemas/Triangle.kt create mode 100644 samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/schemas/TriangleInterface.kt create mode 100644 samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/schemas/UUIDString.kt create mode 100644 samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/schemas/User.kt create mode 100644 samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/schemas/Whale.kt create mode 100644 samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/schemas/Zebra.kt create mode 100644 samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/securityschemes/ApiKey.kt create mode 100644 samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/securityschemes/ApiKeyQuery.kt create mode 100644 samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/securityschemes/BearerTest.kt create mode 100644 samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/securityschemes/HttpBasicTest.kt create mode 100644 samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/securityschemes/HttpSignatureTest.kt create mode 100644 samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/securityschemes/OpenIdConnectTest.kt create mode 100644 samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/securityschemes/PetstoreAuth.kt create mode 100644 samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/configurations/ApiConfiguration.kt create mode 100644 samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/configurations/JsonSchemaKeywordFlags.kt create mode 100644 samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/configurations/SchemaConfiguration.kt create mode 100644 samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/contenttype/ContentTypeDeserializer.kt create mode 100644 samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/contenttype/ContentTypeDetector.kt create mode 100644 samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/contenttype/ContentTypeSerializer.kt create mode 100644 samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/exceptions/ApiException.kt create mode 100644 samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/exceptions/BaseException.kt create mode 100644 samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/exceptions/InvalidAdditionalPropertyException.kt create mode 100644 samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/exceptions/NotImplementedException.kt create mode 100644 samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/exceptions/UnsetPropertyException.kt create mode 100644 samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/exceptions/ValidationException.kt create mode 100644 samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/header/ContentHeader.kt create mode 100644 samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/header/Header.kt create mode 100644 samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/header/HeaderBase.kt create mode 100644 samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/header/PrefixSeparatorIterator.kt create mode 100644 samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/header/Rfc6570Serializer.kt create mode 100644 samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/header/SchemaHeader.kt create mode 100644 samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/header/StyleSerializer.kt create mode 100644 samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/mediatype/Encoding.kt create mode 100644 samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/mediatype/MediaType.kt create mode 100644 samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/parameter/ContentParameter.kt create mode 100644 samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/parameter/CookieSerializer.kt create mode 100644 samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/parameter/HeadersSerializer.kt create mode 100644 samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/parameter/Parameter.kt create mode 100644 samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/parameter/ParameterBase.kt create mode 100644 samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/parameter/ParameterInType.kt create mode 100644 samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/parameter/ParameterStyle.kt create mode 100644 samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/parameter/PathSerializer.kt create mode 100644 samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/parameter/QuerySerializer.kt create mode 100644 samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/parameter/SchemaParameter.kt create mode 100644 samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/Anotherfakedummy.kt create mode 100644 samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/Commonparamsubdir.kt create mode 100644 samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/Fake.kt create mode 100644 samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/Fakeadditionalpropertieswitharrayofenums.kt create mode 100644 samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/Fakebodywithfileschema.kt create mode 100644 samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/Fakebodywithqueryparams.kt create mode 100644 samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/Fakecasesensitiveparams.kt create mode 100644 samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/Fakeclassnametest.kt create mode 100644 samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/Fakedeletecoffeeid.kt create mode 100644 samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/Fakehealth.kt create mode 100644 samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/Fakeinlineadditionalproperties.kt create mode 100644 samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/Fakeinlinecomposition.kt create mode 100644 samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/Fakejsonformdata.kt create mode 100644 samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/Fakejsonpatch.kt create mode 100644 samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/Fakejsonwithcharset.kt create mode 100644 samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/Fakemultiplerequestbodycontenttypes.kt create mode 100644 samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/Fakemultipleresponsebodies.kt create mode 100644 samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/Fakemultiplesecurities.kt create mode 100644 samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/Fakeobjinquery.kt create mode 100644 samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/Fakeparametercollisions1ababselfab.kt create mode 100644 samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/Fakepemcontenttype.kt create mode 100644 samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/Fakepetiduploadimagewithrequiredfile.kt create mode 100644 samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/Fakequeryparamwithjsoncontenttype.kt create mode 100644 samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/Fakeredirection.kt create mode 100644 samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/Fakerefobjinquery.kt create mode 100644 samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/Fakerefsarraymodel.kt create mode 100644 samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/Fakerefsarrayofenums.kt create mode 100644 samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/Fakerefsboolean.kt create mode 100644 samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/Fakerefscomposedoneofnumberwithvalidations.kt create mode 100644 samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/Fakerefsenum.kt create mode 100644 samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/Fakerefsmammal.kt create mode 100644 samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/Fakerefsnumber.kt create mode 100644 samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/Fakerefsobjectmodelwithrefprops.kt create mode 100644 samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/Fakerefsstring.kt create mode 100644 samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/Fakeresponsewithoutschema.kt create mode 100644 samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/Faketestqueryparamters.kt create mode 100644 samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/Fakeuploaddownloadfile.kt create mode 100644 samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/Fakeuploadfile.kt create mode 100644 samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/Fakeuploadfiles.kt create mode 100644 samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/Fakewildcardresponses.kt create mode 100644 samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/Foo.kt create mode 100644 samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/Pet.kt create mode 100644 samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/Petfindbystatus.kt create mode 100644 samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/Petfindbytags.kt create mode 100644 samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/Petpetid.kt create mode 100644 samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/Petpetiduploadimage.kt create mode 100644 samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/Solidus.kt create mode 100644 samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/Storeinventory.kt create mode 100644 samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/Storeorder.kt create mode 100644 samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/Storeorderorderid.kt create mode 100644 samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/User.kt create mode 100644 samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/Usercreatewitharray.kt create mode 100644 samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/Usercreatewithlist.kt create mode 100644 samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/Userlogin.kt create mode 100644 samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/Userlogout.kt create mode 100644 samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/Userusername.kt create mode 100644 samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/anotherfakedummy/AnotherfakedummyPatch.kt create mode 100644 samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/anotherfakedummy/patch/AnotherfakedummyPatchRequestBody.kt create mode 100644 samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/anotherfakedummy/patch/AnotherfakedummyPatchResponses.kt create mode 100644 samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/anotherfakedummy/patch/responses/AnotherfakedummyPatchCode200Response.kt create mode 100644 samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/anotherfakedummy/patch/responses/code200response/content/applicationjson/ApplicationjsonSchema.kt create mode 100644 samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/commonparamsubdir/CommonparamsubdirDelete.kt create mode 100644 samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/commonparamsubdir/CommonparamsubdirGet.kt create mode 100644 samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/commonparamsubdir/CommonparamsubdirPost.kt create mode 100644 samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/commonparamsubdir/delete/CommonparamsubdirDeleteHeaderParameters.kt create mode 100644 samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/commonparamsubdir/delete/CommonparamsubdirDeletePathParameters.kt create mode 100644 samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/commonparamsubdir/delete/CommonparamsubdirDeleteResponses.kt create mode 100644 samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/commonparamsubdir/delete/Parameters.kt create mode 100644 samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/commonparamsubdir/delete/parameters/Parameter0.kt create mode 100644 samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/commonparamsubdir/delete/parameters/Parameter1.kt create mode 100644 samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/commonparamsubdir/delete/parameters/parameter0/Schema0.kt create mode 100644 samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/commonparamsubdir/delete/parameters/parameter1/Schema1.kt create mode 100644 samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/commonparamsubdir/delete/responses/CommonparamsubdirDeleteCode200Response.kt create mode 100644 samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/commonparamsubdir/get/CommonparamsubdirGetPathParameters.kt create mode 100644 samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/commonparamsubdir/get/CommonparamsubdirGetQueryParameters.kt create mode 100644 samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/commonparamsubdir/get/CommonparamsubdirGetResponses.kt create mode 100644 samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/commonparamsubdir/get/Parameters.kt create mode 100644 samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/commonparamsubdir/get/parameters/Parameter0.kt create mode 100644 samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/commonparamsubdir/get/parameters/parameter0/Schema0.kt create mode 100644 samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/commonparamsubdir/get/responses/CommonparamsubdirGetCode200Response.kt create mode 100644 samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/commonparamsubdir/parameters/RouteParameter0.kt create mode 100644 samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/commonparamsubdir/parameters/routeparameter0/RouteParamSchema0.kt create mode 100644 samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/commonparamsubdir/post/CommonparamsubdirPostHeaderParameters.kt create mode 100644 samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/commonparamsubdir/post/CommonparamsubdirPostPathParameters.kt create mode 100644 samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/commonparamsubdir/post/CommonparamsubdirPostResponses.kt create mode 100644 samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/commonparamsubdir/post/Parameters.kt create mode 100644 samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/commonparamsubdir/post/parameters/Parameter0.kt create mode 100644 samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/commonparamsubdir/post/parameters/parameter0/Schema0.kt create mode 100644 samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/commonparamsubdir/post/responses/CommonparamsubdirPostCode200Response.kt create mode 100644 samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/fake/FakeDelete.kt create mode 100644 samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/fake/FakeGet.kt create mode 100644 samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/fake/FakePatch.kt create mode 100644 samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/fake/FakePost.kt create mode 100644 samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/fake/delete/FakeDeleteHeaderParameters.kt create mode 100644 samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/fake/delete/FakeDeleteQueryParameters.kt create mode 100644 samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/fake/delete/FakeDeleteResponses.kt create mode 100644 samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/fake/delete/FakeDeleteSecurityInfo.kt create mode 100644 samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/fake/delete/Parameters.kt create mode 100644 samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/fake/delete/parameters/Parameter0.kt create mode 100644 samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/fake/delete/parameters/Parameter1.kt create mode 100644 samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/fake/delete/parameters/Parameter2.kt create mode 100644 samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/fake/delete/parameters/Parameter3.kt create mode 100644 samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/fake/delete/parameters/Parameter4.kt create mode 100644 samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/fake/delete/parameters/Parameter5.kt create mode 100644 samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/fake/delete/parameters/parameter0/Schema0.kt create mode 100644 samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/fake/delete/parameters/parameter1/Schema1.kt create mode 100644 samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/fake/delete/parameters/parameter2/Schema2.kt create mode 100644 samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/fake/delete/parameters/parameter3/Schema3.kt create mode 100644 samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/fake/delete/parameters/parameter4/Schema4.kt create mode 100644 samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/fake/delete/parameters/parameter5/Schema5.kt create mode 100644 samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/fake/delete/responses/FakeDeleteCode200Response.kt create mode 100644 samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/fake/delete/security/FakeDeleteSecurityRequirementObject0.kt create mode 100644 samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/fake/get/FakeGetHeaderParameters.kt create mode 100644 samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/fake/get/FakeGetQueryParameters.kt create mode 100644 samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/fake/get/FakeGetRequestBody.kt create mode 100644 samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/fake/get/FakeGetResponses.kt create mode 100644 samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/fake/get/Parameters.kt create mode 100644 samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/fake/get/parameters/Parameter0.kt create mode 100644 samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/fake/get/parameters/Parameter1.kt create mode 100644 samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/fake/get/parameters/Parameter2.kt create mode 100644 samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/fake/get/parameters/Parameter3.kt create mode 100644 samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/fake/get/parameters/Parameter4.kt create mode 100644 samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/fake/get/parameters/Parameter5.kt create mode 100644 samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/fake/get/parameters/parameter0/Schema0.kt create mode 100644 samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/fake/get/parameters/parameter1/Schema1.kt create mode 100644 samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/fake/get/parameters/parameter2/Schema2.kt create mode 100644 samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/fake/get/parameters/parameter3/Schema3.kt create mode 100644 samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/fake/get/parameters/parameter4/Schema4.kt create mode 100644 samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/fake/get/parameters/parameter5/Schema5.kt create mode 100644 samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/fake/get/requestbody/content/applicationxwwwformurlencoded/ApplicationxwwwformurlencodedSchema.kt create mode 100644 samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/fake/get/responses/FakeGetCode200Response.kt create mode 100644 samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/fake/get/responses/FakeGetCode404Response.kt create mode 100644 samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/fake/get/responses/code404response/content/applicationjson/ApplicationjsonSchema.kt create mode 100644 samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/fake/patch/FakePatchRequestBody.kt create mode 100644 samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/fake/patch/FakePatchResponses.kt create mode 100644 samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/fake/patch/responses/FakePatchCode200Response.kt create mode 100644 samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/fake/patch/responses/code200response/content/applicationjson/ApplicationjsonSchema.kt create mode 100644 samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/fake/post/FakePostRequestBody.kt create mode 100644 samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/fake/post/FakePostResponses.kt create mode 100644 samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/fake/post/FakePostSecurityInfo.kt create mode 100644 samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/fake/post/requestbody/content/applicationxwwwformurlencoded/ApplicationxwwwformurlencodedSchema.kt create mode 100644 samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/fake/post/responses/FakePostCode200Response.kt create mode 100644 samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/fake/post/responses/FakePostCode404Response.kt create mode 100644 samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/fake/post/security/FakePostSecurityRequirementObject0.kt create mode 100644 samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/fakeadditionalpropertieswitharrayofenums/FakeadditionalpropertieswitharrayofenumsGet.kt create mode 100644 samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/fakeadditionalpropertieswitharrayofenums/get/FakeadditionalpropertieswitharrayofenumsGetRequestBody.kt create mode 100644 samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/fakeadditionalpropertieswitharrayofenums/get/FakeadditionalpropertieswitharrayofenumsGetResponses.kt create mode 100644 samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/fakeadditionalpropertieswitharrayofenums/get/requestbody/content/applicationjson/ApplicationjsonSchema.kt create mode 100644 samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/fakeadditionalpropertieswitharrayofenums/get/responses/FakeadditionalpropertieswitharrayofenumsGetCode200Response.kt create mode 100644 samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/fakeadditionalpropertieswitharrayofenums/get/responses/code200response/content/applicationjson/ApplicationjsonSchema.kt create mode 100644 samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/fakebodywithfileschema/FakebodywithfileschemaPut.kt create mode 100644 samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/fakebodywithfileschema/put/FakebodywithfileschemaPutRequestBody.kt create mode 100644 samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/fakebodywithfileschema/put/FakebodywithfileschemaPutResponses.kt create mode 100644 samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/fakebodywithfileschema/put/requestbody/content/applicationjson/ApplicationjsonSchema.kt create mode 100644 samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/fakebodywithfileschema/put/responses/FakebodywithfileschemaPutCode200Response.kt create mode 100644 samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/fakebodywithqueryparams/FakebodywithqueryparamsPut.kt create mode 100644 samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/fakebodywithqueryparams/put/FakebodywithqueryparamsPutQueryParameters.kt create mode 100644 samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/fakebodywithqueryparams/put/FakebodywithqueryparamsPutRequestBody.kt create mode 100644 samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/fakebodywithqueryparams/put/FakebodywithqueryparamsPutResponses.kt create mode 100644 samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/fakebodywithqueryparams/put/Parameters.kt create mode 100644 samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/fakebodywithqueryparams/put/parameters/Parameter0.kt create mode 100644 samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/fakebodywithqueryparams/put/parameters/parameter0/Schema0.kt create mode 100644 samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/fakebodywithqueryparams/put/requestbody/content/applicationjson/ApplicationjsonSchema.kt create mode 100644 samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/fakebodywithqueryparams/put/responses/FakebodywithqueryparamsPutCode200Response.kt create mode 100644 samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/fakecasesensitiveparams/FakecasesensitiveparamsPut.kt create mode 100644 samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/fakecasesensitiveparams/put/FakecasesensitiveparamsPutQueryParameters.kt create mode 100644 samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/fakecasesensitiveparams/put/FakecasesensitiveparamsPutResponses.kt create mode 100644 samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/fakecasesensitiveparams/put/Parameters.kt create mode 100644 samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/fakecasesensitiveparams/put/parameters/Parameter0.kt create mode 100644 samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/fakecasesensitiveparams/put/parameters/Parameter1.kt create mode 100644 samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/fakecasesensitiveparams/put/parameters/Parameter2.kt create mode 100644 samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/fakecasesensitiveparams/put/parameters/parameter0/Schema0.kt create mode 100644 samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/fakecasesensitiveparams/put/parameters/parameter1/Schema1.kt create mode 100644 samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/fakecasesensitiveparams/put/parameters/parameter2/Schema2.kt create mode 100644 samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/fakecasesensitiveparams/put/responses/FakecasesensitiveparamsPutCode200Response.kt create mode 100644 samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/fakeclassnametest/FakeclassnametestPatch.kt create mode 100644 samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/fakeclassnametest/patch/FakeclassnametestPatchRequestBody.kt create mode 100644 samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/fakeclassnametest/patch/FakeclassnametestPatchResponses.kt create mode 100644 samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/fakeclassnametest/patch/FakeclassnametestPatchSecurityInfo.kt create mode 100644 samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/fakeclassnametest/patch/responses/FakeclassnametestPatchCode200Response.kt create mode 100644 samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/fakeclassnametest/patch/responses/code200response/content/applicationjson/ApplicationjsonSchema.kt create mode 100644 samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/fakeclassnametest/patch/security/FakeclassnametestPatchSecurityRequirementObject0.kt create mode 100644 samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/fakedeletecoffeeid/FakedeletecoffeeidDelete.kt create mode 100644 samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/fakedeletecoffeeid/delete/FakedeletecoffeeidDeletePathParameters.kt create mode 100644 samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/fakedeletecoffeeid/delete/FakedeletecoffeeidDeleteResponses.kt create mode 100644 samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/fakedeletecoffeeid/delete/Parameters.kt create mode 100644 samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/fakedeletecoffeeid/delete/parameters/Parameter0.kt create mode 100644 samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/fakedeletecoffeeid/delete/parameters/parameter0/Schema0.kt create mode 100644 samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/fakedeletecoffeeid/delete/responses/FakedeletecoffeeidDeleteCode200Response.kt create mode 100644 samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/fakedeletecoffeeid/delete/responses/FakedeletecoffeeidDeleteCodedefaultResponse.kt create mode 100644 samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/fakehealth/FakehealthGet.kt create mode 100644 samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/fakehealth/get/FakehealthGetResponses.kt create mode 100644 samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/fakehealth/get/responses/FakehealthGetCode200Response.kt create mode 100644 samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/fakehealth/get/responses/code200response/content/applicationjson/ApplicationjsonSchema.kt create mode 100644 samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/fakeinlineadditionalproperties/FakeinlineadditionalpropertiesPost.kt create mode 100644 samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/fakeinlineadditionalproperties/post/FakeinlineadditionalpropertiesPostRequestBody.kt create mode 100644 samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/fakeinlineadditionalproperties/post/FakeinlineadditionalpropertiesPostResponses.kt create mode 100644 samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/fakeinlineadditionalproperties/post/requestbody/content/applicationjson/ApplicationjsonSchema.kt create mode 100644 samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/fakeinlineadditionalproperties/post/responses/FakeinlineadditionalpropertiesPostCode200Response.kt create mode 100644 samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/fakeinlinecomposition/FakeinlinecompositionPost.kt create mode 100644 samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/fakeinlinecomposition/post/FakeinlinecompositionPostQueryParameters.kt create mode 100644 samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/fakeinlinecomposition/post/FakeinlinecompositionPostRequestBody.kt create mode 100644 samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/fakeinlinecomposition/post/FakeinlinecompositionPostResponses.kt create mode 100644 samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/fakeinlinecomposition/post/Parameters.kt create mode 100644 samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/fakeinlinecomposition/post/parameters/Parameter0.kt create mode 100644 samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/fakeinlinecomposition/post/parameters/Parameter1.kt create mode 100644 samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/fakeinlinecomposition/post/parameters/parameter0/Schema0.kt create mode 100644 samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/fakeinlinecomposition/post/parameters/parameter1/Schema1.kt create mode 100644 samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/fakeinlinecomposition/post/requestbody/content/applicationjson/ApplicationjsonSchema.kt create mode 100644 samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/fakeinlinecomposition/post/requestbody/content/multipartformdata/MultipartformdataSchema.kt create mode 100644 samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/fakeinlinecomposition/post/responses/FakeinlinecompositionPostCode200Response.kt create mode 100644 samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/fakeinlinecomposition/post/responses/code200response/content/applicationjson/ApplicationjsonSchema.kt create mode 100644 samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/fakeinlinecomposition/post/responses/code200response/content/multipartformdata/MultipartformdataSchema.kt create mode 100644 samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/fakejsonformdata/FakejsonformdataGet.kt create mode 100644 samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/fakejsonformdata/get/FakejsonformdataGetRequestBody.kt create mode 100644 samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/fakejsonformdata/get/FakejsonformdataGetResponses.kt create mode 100644 samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/fakejsonformdata/get/requestbody/content/applicationxwwwformurlencoded/ApplicationxwwwformurlencodedSchema.kt create mode 100644 samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/fakejsonformdata/get/responses/FakejsonformdataGetCode200Response.kt create mode 100644 samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/fakejsonpatch/FakejsonpatchPatch.kt create mode 100644 samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/fakejsonpatch/patch/FakejsonpatchPatchRequestBody.kt create mode 100644 samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/fakejsonpatch/patch/FakejsonpatchPatchResponses.kt create mode 100644 samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/fakejsonpatch/patch/requestbody/content/applicationjsonpatchjson/ApplicationjsonpatchjsonSchema.kt create mode 100644 samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/fakejsonpatch/patch/responses/FakejsonpatchPatchCode200Response.kt create mode 100644 samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/fakejsonwithcharset/FakejsonwithcharsetPost.kt create mode 100644 samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/fakejsonwithcharset/post/FakejsonwithcharsetPostRequestBody.kt create mode 100644 samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/fakejsonwithcharset/post/FakejsonwithcharsetPostResponses.kt create mode 100644 samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/fakejsonwithcharset/post/requestbody/content/applicationjsoncharsetutf8/Applicationjsoncharsetutf8Schema.kt create mode 100644 samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/fakejsonwithcharset/post/responses/FakejsonwithcharsetPostCode200Response.kt create mode 100644 samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/fakejsonwithcharset/post/responses/code200response/content/applicationjsoncharsetutf8/Applicationjsoncharsetutf8Schema.kt create mode 100644 samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/fakemultiplerequestbodycontenttypes/FakemultiplerequestbodycontenttypesPost.kt create mode 100644 samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/fakemultiplerequestbodycontenttypes/post/FakemultiplerequestbodycontenttypesPostRequestBody.kt create mode 100644 samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/fakemultiplerequestbodycontenttypes/post/FakemultiplerequestbodycontenttypesPostResponses.kt create mode 100644 samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/fakemultiplerequestbodycontenttypes/post/requestbody/content/applicationjson/ApplicationjsonSchema.kt create mode 100644 samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/fakemultiplerequestbodycontenttypes/post/requestbody/content/multipartformdata/MultipartformdataSchema.kt create mode 100644 samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/fakemultiplerequestbodycontenttypes/post/responses/FakemultiplerequestbodycontenttypesPostCode200Response.kt create mode 100644 samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/fakemultiplerequestbodycontenttypes/post/responses/code200response/content/applicationjson/ApplicationjsonSchema.kt create mode 100644 samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/fakemultipleresponsebodies/FakemultipleresponsebodiesGet.kt create mode 100644 samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/fakemultipleresponsebodies/get/FakemultipleresponsebodiesGetResponses.kt create mode 100644 samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/fakemultipleresponsebodies/get/responses/FakemultipleresponsebodiesGetCode200Response.kt create mode 100644 samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/fakemultipleresponsebodies/get/responses/FakemultipleresponsebodiesGetCode202Response.kt create mode 100644 samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/fakemultipleresponsebodies/get/responses/code200response/content/applicationjson/ApplicationjsonSchema.kt create mode 100644 samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/fakemultipleresponsebodies/get/responses/code202response/content/applicationjson/ApplicationjsonSchema.kt create mode 100644 samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/fakemultiplesecurities/FakemultiplesecuritiesGet.kt create mode 100644 samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/fakemultiplesecurities/get/FakemultiplesecuritiesGetResponses.kt create mode 100644 samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/fakemultiplesecurities/get/FakemultiplesecuritiesGetSecurityInfo.kt create mode 100644 samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/fakemultiplesecurities/get/responses/FakemultiplesecuritiesGetCode200Response.kt create mode 100644 samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/fakemultiplesecurities/get/responses/code200response/content/applicationjson/ApplicationjsonSchema.kt create mode 100644 samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/fakemultiplesecurities/get/security/FakemultiplesecuritiesGetSecurityRequirementObject0.kt create mode 100644 samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/fakemultiplesecurities/get/security/FakemultiplesecuritiesGetSecurityRequirementObject1.kt create mode 100644 samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/fakemultiplesecurities/get/security/FakemultiplesecuritiesGetSecurityRequirementObject2.kt create mode 100644 samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/fakeobjinquery/FakeobjinqueryGet.kt create mode 100644 samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/fakeobjinquery/get/FakeobjinqueryGetQueryParameters.kt create mode 100644 samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/fakeobjinquery/get/FakeobjinqueryGetResponses.kt create mode 100644 samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/fakeobjinquery/get/Parameters.kt create mode 100644 samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/fakeobjinquery/get/parameters/Parameter0.kt create mode 100644 samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/fakeobjinquery/get/parameters/parameter0/Schema0.kt create mode 100644 samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/fakeobjinquery/get/responses/FakeobjinqueryGetCode200Response.kt create mode 100644 samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/fakeparametercollisions1ababselfab/Fakeparametercollisions1ababselfabPost.kt create mode 100644 samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/fakeparametercollisions1ababselfab/post/Fakeparametercollisions1ababselfabPostCookieParameters.kt create mode 100644 samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/fakeparametercollisions1ababselfab/post/Fakeparametercollisions1ababselfabPostHeaderParameters.kt create mode 100644 samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/fakeparametercollisions1ababselfab/post/Fakeparametercollisions1ababselfabPostPathParameters.kt create mode 100644 samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/fakeparametercollisions1ababselfab/post/Fakeparametercollisions1ababselfabPostQueryParameters.kt create mode 100644 samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/fakeparametercollisions1ababselfab/post/Fakeparametercollisions1ababselfabPostRequestBody.kt create mode 100644 samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/fakeparametercollisions1ababselfab/post/Fakeparametercollisions1ababselfabPostResponses.kt create mode 100644 samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/fakeparametercollisions1ababselfab/post/Parameters.kt create mode 100644 samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/fakeparametercollisions1ababselfab/post/parameters/Parameter0.kt create mode 100644 samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/fakeparametercollisions1ababselfab/post/parameters/Parameter1.kt create mode 100644 samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/fakeparametercollisions1ababselfab/post/parameters/Parameter10.kt create mode 100644 samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/fakeparametercollisions1ababselfab/post/parameters/Parameter11.kt create mode 100644 samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/fakeparametercollisions1ababselfab/post/parameters/Parameter12.kt create mode 100644 samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/fakeparametercollisions1ababselfab/post/parameters/Parameter13.kt create mode 100644 samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/fakeparametercollisions1ababselfab/post/parameters/Parameter14.kt create mode 100644 samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/fakeparametercollisions1ababselfab/post/parameters/Parameter15.kt create mode 100644 samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/fakeparametercollisions1ababselfab/post/parameters/Parameter16.kt create mode 100644 samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/fakeparametercollisions1ababselfab/post/parameters/Parameter17.kt create mode 100644 samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/fakeparametercollisions1ababselfab/post/parameters/Parameter18.kt create mode 100644 samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/fakeparametercollisions1ababselfab/post/parameters/Parameter2.kt create mode 100644 samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/fakeparametercollisions1ababselfab/post/parameters/Parameter3.kt create mode 100644 samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/fakeparametercollisions1ababselfab/post/parameters/Parameter4.kt create mode 100644 samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/fakeparametercollisions1ababselfab/post/parameters/Parameter5.kt create mode 100644 samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/fakeparametercollisions1ababselfab/post/parameters/Parameter6.kt create mode 100644 samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/fakeparametercollisions1ababselfab/post/parameters/Parameter7.kt create mode 100644 samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/fakeparametercollisions1ababselfab/post/parameters/Parameter8.kt create mode 100644 samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/fakeparametercollisions1ababselfab/post/parameters/Parameter9.kt create mode 100644 samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/fakeparametercollisions1ababselfab/post/parameters/parameter0/Schema0.kt create mode 100644 samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/fakeparametercollisions1ababselfab/post/parameters/parameter1/Schema1.kt create mode 100644 samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/fakeparametercollisions1ababselfab/post/parameters/parameter10/Schema10.kt create mode 100644 samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/fakeparametercollisions1ababselfab/post/parameters/parameter11/Schema11.kt create mode 100644 samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/fakeparametercollisions1ababselfab/post/parameters/parameter12/Schema12.kt create mode 100644 samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/fakeparametercollisions1ababselfab/post/parameters/parameter13/Schema13.kt create mode 100644 samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/fakeparametercollisions1ababselfab/post/parameters/parameter14/Schema14.kt create mode 100644 samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/fakeparametercollisions1ababselfab/post/parameters/parameter15/Schema15.kt create mode 100644 samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/fakeparametercollisions1ababselfab/post/parameters/parameter16/Schema16.kt create mode 100644 samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/fakeparametercollisions1ababselfab/post/parameters/parameter17/Schema17.kt create mode 100644 samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/fakeparametercollisions1ababselfab/post/parameters/parameter18/Schema18.kt create mode 100644 samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/fakeparametercollisions1ababselfab/post/parameters/parameter2/Schema2.kt create mode 100644 samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/fakeparametercollisions1ababselfab/post/parameters/parameter3/Schema3.kt create mode 100644 samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/fakeparametercollisions1ababselfab/post/parameters/parameter4/Schema4.kt create mode 100644 samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/fakeparametercollisions1ababselfab/post/parameters/parameter5/Schema5.kt create mode 100644 samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/fakeparametercollisions1ababselfab/post/parameters/parameter6/Schema6.kt create mode 100644 samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/fakeparametercollisions1ababselfab/post/parameters/parameter7/Schema7.kt create mode 100644 samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/fakeparametercollisions1ababselfab/post/parameters/parameter8/Schema8.kt create mode 100644 samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/fakeparametercollisions1ababselfab/post/parameters/parameter9/Schema9.kt create mode 100644 samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/fakeparametercollisions1ababselfab/post/requestbody/content/applicationjson/ApplicationjsonSchema.kt create mode 100644 samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/fakeparametercollisions1ababselfab/post/responses/Fakeparametercollisions1ababselfabPostCode200Response.kt create mode 100644 samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/fakeparametercollisions1ababselfab/post/responses/code200response/content/applicationjson/ApplicationjsonSchema.kt create mode 100644 samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/fakepemcontenttype/FakepemcontenttypeGet.kt create mode 100644 samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/fakepemcontenttype/get/FakepemcontenttypeGetRequestBody.kt create mode 100644 samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/fakepemcontenttype/get/FakepemcontenttypeGetResponses.kt create mode 100644 samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/fakepemcontenttype/get/requestbody/content/applicationxpemfile/ApplicationxpemfileSchema.kt create mode 100644 samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/fakepemcontenttype/get/responses/FakepemcontenttypeGetCode200Response.kt create mode 100644 samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/fakepemcontenttype/get/responses/code200response/content/applicationxpemfile/ApplicationxpemfileSchema.kt create mode 100644 samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/fakepetiduploadimagewithrequiredfile/FakepetiduploadimagewithrequiredfilePost.kt create mode 100644 samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/fakepetiduploadimagewithrequiredfile/post/FakepetiduploadimagewithrequiredfilePostPathParameters.kt create mode 100644 samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/fakepetiduploadimagewithrequiredfile/post/FakepetiduploadimagewithrequiredfilePostRequestBody.kt create mode 100644 samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/fakepetiduploadimagewithrequiredfile/post/FakepetiduploadimagewithrequiredfilePostResponses.kt create mode 100644 samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/fakepetiduploadimagewithrequiredfile/post/FakepetiduploadimagewithrequiredfilePostSecurityInfo.kt create mode 100644 samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/fakepetiduploadimagewithrequiredfile/post/Parameters.kt create mode 100644 samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/fakepetiduploadimagewithrequiredfile/post/parameters/Parameter0.kt create mode 100644 samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/fakepetiduploadimagewithrequiredfile/post/parameters/parameter0/Schema0.kt create mode 100644 samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/fakepetiduploadimagewithrequiredfile/post/requestbody/content/multipartformdata/MultipartformdataSchema.kt create mode 100644 samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/fakepetiduploadimagewithrequiredfile/post/responses/FakepetiduploadimagewithrequiredfilePostCode200Response.kt create mode 100644 samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/fakepetiduploadimagewithrequiredfile/post/responses/code200response/content/applicationjson/ApplicationjsonSchema.kt create mode 100644 samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/fakepetiduploadimagewithrequiredfile/post/security/FakepetiduploadimagewithrequiredfilePostSecurityRequirementObject0.kt create mode 100644 samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/fakequeryparamwithjsoncontenttype/FakequeryparamwithjsoncontenttypeGet.kt create mode 100644 samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/fakequeryparamwithjsoncontenttype/get/FakequeryparamwithjsoncontenttypeGetQueryParameters.kt create mode 100644 samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/fakequeryparamwithjsoncontenttype/get/FakequeryparamwithjsoncontenttypeGetResponses.kt create mode 100644 samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/fakequeryparamwithjsoncontenttype/get/Parameters.kt create mode 100644 samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/fakequeryparamwithjsoncontenttype/get/parameters/Parameter0.kt create mode 100644 samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/fakequeryparamwithjsoncontenttype/get/parameters/parameter0/content/applicationjson/Schema0.kt create mode 100644 samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/fakequeryparamwithjsoncontenttype/get/responses/FakequeryparamwithjsoncontenttypeGetCode200Response.kt create mode 100644 samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/fakequeryparamwithjsoncontenttype/get/responses/code200response/content/applicationjson/ApplicationjsonSchema.kt create mode 100644 samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/fakeredirection/FakeredirectionGet.kt create mode 100644 samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/fakeredirection/get/FakeredirectionGetResponses.kt create mode 100644 samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/fakeredirection/get/responses/FakeredirectionGetCode303Response.kt create mode 100644 samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/fakeredirection/get/responses/FakeredirectionGetCode3XXResponse.kt create mode 100644 samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/fakerefobjinquery/FakerefobjinqueryGet.kt create mode 100644 samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/fakerefobjinquery/get/FakerefobjinqueryGetQueryParameters.kt create mode 100644 samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/fakerefobjinquery/get/FakerefobjinqueryGetResponses.kt create mode 100644 samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/fakerefobjinquery/get/Parameters.kt create mode 100644 samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/fakerefobjinquery/get/parameters/Parameter0.kt create mode 100644 samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/fakerefobjinquery/get/parameters/parameter0/Schema0.kt create mode 100644 samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/fakerefobjinquery/get/responses/FakerefobjinqueryGetCode200Response.kt create mode 100644 samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/fakerefsarraymodel/FakerefsarraymodelPost.kt create mode 100644 samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/fakerefsarraymodel/post/FakerefsarraymodelPostRequestBody.kt create mode 100644 samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/fakerefsarraymodel/post/FakerefsarraymodelPostResponses.kt create mode 100644 samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/fakerefsarraymodel/post/requestbody/content/applicationjson/ApplicationjsonSchema.kt create mode 100644 samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/fakerefsarraymodel/post/responses/FakerefsarraymodelPostCode200Response.kt create mode 100644 samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/fakerefsarraymodel/post/responses/code200response/content/applicationjson/ApplicationjsonSchema.kt create mode 100644 samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/fakerefsarrayofenums/FakerefsarrayofenumsPost.kt create mode 100644 samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/fakerefsarrayofenums/post/FakerefsarrayofenumsPostRequestBody.kt create mode 100644 samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/fakerefsarrayofenums/post/FakerefsarrayofenumsPostResponses.kt create mode 100644 samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/fakerefsarrayofenums/post/requestbody/content/applicationjson/ApplicationjsonSchema.kt create mode 100644 samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/fakerefsarrayofenums/post/responses/FakerefsarrayofenumsPostCode200Response.kt create mode 100644 samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/fakerefsarrayofenums/post/responses/code200response/content/applicationjson/ApplicationjsonSchema.kt create mode 100644 samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/fakerefsboolean/FakerefsbooleanPost.kt create mode 100644 samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/fakerefsboolean/post/FakerefsbooleanPostRequestBody.kt create mode 100644 samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/fakerefsboolean/post/FakerefsbooleanPostResponses.kt create mode 100644 samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/fakerefsboolean/post/requestbody/content/applicationjson/ApplicationjsonSchema.kt create mode 100644 samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/fakerefsboolean/post/responses/FakerefsbooleanPostCode200Response.kt create mode 100644 samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/fakerefsboolean/post/responses/code200response/content/applicationjson/ApplicationjsonSchema.kt create mode 100644 samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/fakerefscomposedoneofnumberwithvalidations/FakerefscomposedoneofnumberwithvalidationsPost.kt create mode 100644 samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/fakerefscomposedoneofnumberwithvalidations/post/FakerefscomposedoneofnumberwithvalidationsPostRequestBody.kt create mode 100644 samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/fakerefscomposedoneofnumberwithvalidations/post/FakerefscomposedoneofnumberwithvalidationsPostResponses.kt create mode 100644 samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/fakerefscomposedoneofnumberwithvalidations/post/requestbody/content/applicationjson/ApplicationjsonSchema.kt create mode 100644 samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/fakerefscomposedoneofnumberwithvalidations/post/responses/FakerefscomposedoneofnumberwithvalidationsPostCode200Response.kt create mode 100644 samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/fakerefscomposedoneofnumberwithvalidations/post/responses/code200response/content/applicationjson/ApplicationjsonSchema.kt create mode 100644 samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/fakerefsenum/FakerefsenumPost.kt create mode 100644 samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/fakerefsenum/post/FakerefsenumPostRequestBody.kt create mode 100644 samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/fakerefsenum/post/FakerefsenumPostResponses.kt create mode 100644 samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/fakerefsenum/post/requestbody/content/applicationjson/ApplicationjsonSchema.kt create mode 100644 samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/fakerefsenum/post/responses/FakerefsenumPostCode200Response.kt create mode 100644 samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/fakerefsenum/post/responses/code200response/content/applicationjson/ApplicationjsonSchema.kt create mode 100644 samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/fakerefsmammal/FakerefsmammalPost.kt create mode 100644 samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/fakerefsmammal/post/FakerefsmammalPostRequestBody.kt create mode 100644 samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/fakerefsmammal/post/FakerefsmammalPostResponses.kt create mode 100644 samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/fakerefsmammal/post/requestbody/content/applicationjson/ApplicationjsonSchema.kt create mode 100644 samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/fakerefsmammal/post/responses/FakerefsmammalPostCode200Response.kt create mode 100644 samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/fakerefsmammal/post/responses/code200response/content/applicationjson/ApplicationjsonSchema.kt create mode 100644 samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/fakerefsnumber/FakerefsnumberPost.kt create mode 100644 samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/fakerefsnumber/post/FakerefsnumberPostRequestBody.kt create mode 100644 samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/fakerefsnumber/post/FakerefsnumberPostResponses.kt create mode 100644 samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/fakerefsnumber/post/requestbody/content/applicationjson/ApplicationjsonSchema.kt create mode 100644 samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/fakerefsnumber/post/responses/FakerefsnumberPostCode200Response.kt create mode 100644 samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/fakerefsnumber/post/responses/code200response/content/applicationjson/ApplicationjsonSchema.kt create mode 100644 samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/fakerefsobjectmodelwithrefprops/FakerefsobjectmodelwithrefpropsPost.kt create mode 100644 samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/fakerefsobjectmodelwithrefprops/post/FakerefsobjectmodelwithrefpropsPostRequestBody.kt create mode 100644 samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/fakerefsobjectmodelwithrefprops/post/FakerefsobjectmodelwithrefpropsPostResponses.kt create mode 100644 samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/fakerefsobjectmodelwithrefprops/post/requestbody/content/applicationjson/ApplicationjsonSchema.kt create mode 100644 samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/fakerefsobjectmodelwithrefprops/post/responses/FakerefsobjectmodelwithrefpropsPostCode200Response.kt create mode 100644 samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/fakerefsobjectmodelwithrefprops/post/responses/code200response/content/applicationjson/ApplicationjsonSchema.kt create mode 100644 samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/fakerefsstring/FakerefsstringPost.kt create mode 100644 samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/fakerefsstring/post/FakerefsstringPostRequestBody.kt create mode 100644 samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/fakerefsstring/post/FakerefsstringPostResponses.kt create mode 100644 samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/fakerefsstring/post/requestbody/content/applicationjson/ApplicationjsonSchema.kt create mode 100644 samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/fakerefsstring/post/responses/FakerefsstringPostCode200Response.kt create mode 100644 samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/fakerefsstring/post/responses/code200response/content/applicationjson/ApplicationjsonSchema.kt create mode 100644 samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/fakeresponsewithoutschema/FakeresponsewithoutschemaGet.kt create mode 100644 samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/fakeresponsewithoutschema/get/FakeresponsewithoutschemaGetResponses.kt create mode 100644 samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/fakeresponsewithoutschema/get/responses/FakeresponsewithoutschemaGetCode200Response.kt create mode 100644 samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/faketestqueryparamters/FaketestqueryparamtersPut.kt create mode 100644 samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/faketestqueryparamters/put/FaketestqueryparamtersPutQueryParameters.kt create mode 100644 samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/faketestqueryparamters/put/FaketestqueryparamtersPutResponses.kt create mode 100644 samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/faketestqueryparamters/put/Parameters.kt create mode 100644 samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/faketestqueryparamters/put/parameters/Parameter0.kt create mode 100644 samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/faketestqueryparamters/put/parameters/Parameter1.kt create mode 100644 samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/faketestqueryparamters/put/parameters/Parameter2.kt create mode 100644 samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/faketestqueryparamters/put/parameters/Parameter3.kt create mode 100644 samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/faketestqueryparamters/put/parameters/Parameter4.kt create mode 100644 samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/faketestqueryparamters/put/parameters/Parameter5.kt create mode 100644 samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/faketestqueryparamters/put/parameters/parameter0/Schema0.kt create mode 100644 samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/faketestqueryparamters/put/parameters/parameter1/Schema1.kt create mode 100644 samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/faketestqueryparamters/put/parameters/parameter2/Schema2.kt create mode 100644 samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/faketestqueryparamters/put/parameters/parameter3/Schema3.kt create mode 100644 samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/faketestqueryparamters/put/parameters/parameter4/Schema4.kt create mode 100644 samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/faketestqueryparamters/put/parameters/parameter5/Schema5.kt create mode 100644 samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/faketestqueryparamters/put/responses/FaketestqueryparamtersPutCode200Response.kt create mode 100644 samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/fakeuploaddownloadfile/FakeuploaddownloadfilePost.kt create mode 100644 samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/fakeuploaddownloadfile/post/FakeuploaddownloadfilePostRequestBody.kt create mode 100644 samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/fakeuploaddownloadfile/post/FakeuploaddownloadfilePostResponses.kt create mode 100644 samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/fakeuploaddownloadfile/post/requestbody/content/applicationoctetstream/ApplicationoctetstreamSchema.kt create mode 100644 samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/fakeuploaddownloadfile/post/responses/FakeuploaddownloadfilePostCode200Response.kt create mode 100644 samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/fakeuploaddownloadfile/post/responses/code200response/content/applicationoctetstream/ApplicationoctetstreamSchema.kt create mode 100644 samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/fakeuploadfile/FakeuploadfilePost.kt create mode 100644 samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/fakeuploadfile/post/FakeuploadfilePostRequestBody.kt create mode 100644 samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/fakeuploadfile/post/FakeuploadfilePostResponses.kt create mode 100644 samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/fakeuploadfile/post/requestbody/content/multipartformdata/MultipartformdataSchema.kt create mode 100644 samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/fakeuploadfile/post/responses/FakeuploadfilePostCode200Response.kt create mode 100644 samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/fakeuploadfile/post/responses/code200response/content/applicationjson/ApplicationjsonSchema.kt create mode 100644 samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/fakeuploadfiles/FakeuploadfilesPost.kt create mode 100644 samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/fakeuploadfiles/post/FakeuploadfilesPostRequestBody.kt create mode 100644 samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/fakeuploadfiles/post/FakeuploadfilesPostResponses.kt create mode 100644 samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/fakeuploadfiles/post/requestbody/content/multipartformdata/MultipartformdataSchema.kt create mode 100644 samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/fakeuploadfiles/post/responses/FakeuploadfilesPostCode200Response.kt create mode 100644 samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/fakeuploadfiles/post/responses/code200response/content/applicationjson/ApplicationjsonSchema.kt create mode 100644 samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/fakewildcardresponses/FakewildcardresponsesGet.kt create mode 100644 samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/fakewildcardresponses/get/FakewildcardresponsesGetResponses.kt create mode 100644 samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/fakewildcardresponses/get/responses/FakewildcardresponsesGetCode1XXResponse.kt create mode 100644 samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/fakewildcardresponses/get/responses/FakewildcardresponsesGetCode200Response.kt create mode 100644 samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/fakewildcardresponses/get/responses/FakewildcardresponsesGetCode2XXResponse.kt create mode 100644 samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/fakewildcardresponses/get/responses/FakewildcardresponsesGetCode3XXResponse.kt create mode 100644 samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/fakewildcardresponses/get/responses/FakewildcardresponsesGetCode4XXResponse.kt create mode 100644 samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/fakewildcardresponses/get/responses/FakewildcardresponsesGetCode5XXResponse.kt create mode 100644 samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/fakewildcardresponses/get/responses/code1xxresponse/content/applicationjson/ApplicationjsonSchema.kt create mode 100644 samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/fakewildcardresponses/get/responses/code200response/content/applicationjson/ApplicationjsonSchema.kt create mode 100644 samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/fakewildcardresponses/get/responses/code2xxresponse/content/applicationjson/ApplicationjsonSchema.kt create mode 100644 samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/fakewildcardresponses/get/responses/code3xxresponse/content/applicationjson/ApplicationjsonSchema.kt create mode 100644 samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/fakewildcardresponses/get/responses/code4xxresponse/content/applicationjson/ApplicationjsonSchema.kt create mode 100644 samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/fakewildcardresponses/get/responses/code5xxresponse/content/applicationjson/ApplicationjsonSchema.kt create mode 100644 samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/foo/FooGet.kt create mode 100644 samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/foo/get/FooGetResponses.kt create mode 100644 samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/foo/get/FooGetServerInfo.kt create mode 100644 samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/foo/get/responses/FooGetCodedefaultResponse.kt create mode 100644 samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/foo/get/responses/codedefaultresponse/content/applicationjson/ApplicationjsonSchema.kt create mode 100644 samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/foo/get/servers/FooGetServer0.kt create mode 100644 samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/foo/get/servers/FooGetServer1.kt create mode 100644 samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/foo/get/servers/server1/FooGetServer1Variables.kt create mode 100644 samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/pet/PetPost.kt create mode 100644 samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/pet/PetPut.kt create mode 100644 samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/pet/post/PetPostRequestBody.kt create mode 100644 samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/pet/post/PetPostResponses.kt create mode 100644 samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/pet/post/PetPostSecurityInfo.kt create mode 100644 samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/pet/post/responses/PetPostCode200Response.kt create mode 100644 samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/pet/post/responses/PetPostCode405Response.kt create mode 100644 samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/pet/post/security/PetPostSecurityRequirementObject0.kt create mode 100644 samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/pet/post/security/PetPostSecurityRequirementObject1.kt create mode 100644 samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/pet/post/security/PetPostSecurityRequirementObject2.kt create mode 100644 samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/pet/put/PetPutRequestBody.kt create mode 100644 samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/pet/put/PetPutResponses.kt create mode 100644 samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/pet/put/PetPutSecurityInfo.kt create mode 100644 samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/pet/put/responses/PetPutCode400Response.kt create mode 100644 samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/pet/put/responses/PetPutCode404Response.kt create mode 100644 samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/pet/put/responses/PetPutCode405Response.kt create mode 100644 samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/pet/put/security/PetPutSecurityRequirementObject0.kt create mode 100644 samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/pet/put/security/PetPutSecurityRequirementObject1.kt create mode 100644 samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/petfindbystatus/PetfindbystatusGet.kt create mode 100644 samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/petfindbystatus/PetfindbystatusServerInfo.kt create mode 100644 samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/petfindbystatus/get/Parameters.kt create mode 100644 samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/petfindbystatus/get/PetfindbystatusGetQueryParameters.kt create mode 100644 samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/petfindbystatus/get/PetfindbystatusGetResponses.kt create mode 100644 samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/petfindbystatus/get/PetfindbystatusGetSecurityInfo.kt create mode 100644 samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/petfindbystatus/get/parameters/Parameter0.kt create mode 100644 samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/petfindbystatus/get/parameters/parameter0/Schema0.kt create mode 100644 samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/petfindbystatus/get/responses/PetfindbystatusGetCode200Response.kt create mode 100644 samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/petfindbystatus/get/responses/PetfindbystatusGetCode400Response.kt create mode 100644 samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/petfindbystatus/get/security/PetfindbystatusGetSecurityRequirementObject0.kt create mode 100644 samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/petfindbystatus/get/security/PetfindbystatusGetSecurityRequirementObject1.kt create mode 100644 samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/petfindbystatus/get/security/PetfindbystatusGetSecurityRequirementObject2.kt create mode 100644 samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/petfindbystatus/servers/PetfindbystatusServer0.kt create mode 100644 samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/petfindbystatus/servers/PetfindbystatusServer1.kt create mode 100644 samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/petfindbystatus/servers/server1/PetfindbystatusServer1Variables.kt create mode 100644 samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/petfindbytags/PetfindbytagsGet.kt create mode 100644 samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/petfindbytags/get/Parameters.kt create mode 100644 samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/petfindbytags/get/PetfindbytagsGetQueryParameters.kt create mode 100644 samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/petfindbytags/get/PetfindbytagsGetResponses.kt create mode 100644 samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/petfindbytags/get/PetfindbytagsGetSecurityInfo.kt create mode 100644 samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/petfindbytags/get/parameters/Parameter0.kt create mode 100644 samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/petfindbytags/get/parameters/parameter0/Schema0.kt create mode 100644 samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/petfindbytags/get/responses/PetfindbytagsGetCode200Response.kt create mode 100644 samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/petfindbytags/get/responses/PetfindbytagsGetCode400Response.kt create mode 100644 samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/petfindbytags/get/security/PetfindbytagsGetSecurityRequirementObject0.kt create mode 100644 samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/petfindbytags/get/security/PetfindbytagsGetSecurityRequirementObject1.kt create mode 100644 samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/petpetid/PetpetidDelete.kt create mode 100644 samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/petpetid/PetpetidGet.kt create mode 100644 samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/petpetid/PetpetidPost.kt create mode 100644 samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/petpetid/delete/Parameters.kt create mode 100644 samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/petpetid/delete/PetpetidDeleteHeaderParameters.kt create mode 100644 samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/petpetid/delete/PetpetidDeletePathParameters.kt create mode 100644 samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/petpetid/delete/PetpetidDeleteResponses.kt create mode 100644 samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/petpetid/delete/PetpetidDeleteSecurityInfo.kt create mode 100644 samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/petpetid/delete/parameters/Parameter0.kt create mode 100644 samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/petpetid/delete/parameters/Parameter1.kt create mode 100644 samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/petpetid/delete/parameters/parameter0/Schema0.kt create mode 100644 samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/petpetid/delete/parameters/parameter1/Schema1.kt create mode 100644 samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/petpetid/delete/responses/PetpetidDeleteCode400Response.kt create mode 100644 samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/petpetid/delete/security/PetpetidDeleteSecurityRequirementObject0.kt create mode 100644 samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/petpetid/delete/security/PetpetidDeleteSecurityRequirementObject1.kt create mode 100644 samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/petpetid/get/Parameters.kt create mode 100644 samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/petpetid/get/PetpetidGetPathParameters.kt create mode 100644 samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/petpetid/get/PetpetidGetResponses.kt create mode 100644 samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/petpetid/get/PetpetidGetSecurityInfo.kt create mode 100644 samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/petpetid/get/parameters/Parameter0.kt create mode 100644 samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/petpetid/get/parameters/parameter0/Schema0.kt create mode 100644 samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/petpetid/get/responses/PetpetidGetCode200Response.kt create mode 100644 samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/petpetid/get/responses/PetpetidGetCode400Response.kt create mode 100644 samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/petpetid/get/responses/PetpetidGetCode404Response.kt create mode 100644 samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/petpetid/get/responses/code200response/content/applicationjson/ApplicationjsonSchema.kt create mode 100644 samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/petpetid/get/responses/code200response/content/applicationxml/ApplicationxmlSchema.kt create mode 100644 samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/petpetid/get/security/PetpetidGetSecurityRequirementObject0.kt create mode 100644 samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/petpetid/post/Parameters.kt create mode 100644 samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/petpetid/post/PetpetidPostPathParameters.kt create mode 100644 samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/petpetid/post/PetpetidPostRequestBody.kt create mode 100644 samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/petpetid/post/PetpetidPostResponses.kt create mode 100644 samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/petpetid/post/PetpetidPostSecurityInfo.kt create mode 100644 samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/petpetid/post/parameters/Parameter0.kt create mode 100644 samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/petpetid/post/parameters/parameter0/Schema0.kt create mode 100644 samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/petpetid/post/requestbody/content/applicationxwwwformurlencoded/ApplicationxwwwformurlencodedSchema.kt create mode 100644 samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/petpetid/post/responses/PetpetidPostCode405Response.kt create mode 100644 samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/petpetid/post/security/PetpetidPostSecurityRequirementObject0.kt create mode 100644 samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/petpetid/post/security/PetpetidPostSecurityRequirementObject1.kt create mode 100644 samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/petpetiduploadimage/PetpetiduploadimagePost.kt create mode 100644 samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/petpetiduploadimage/post/Parameters.kt create mode 100644 samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/petpetiduploadimage/post/PetpetiduploadimagePostPathParameters.kt create mode 100644 samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/petpetiduploadimage/post/PetpetiduploadimagePostRequestBody.kt create mode 100644 samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/petpetiduploadimage/post/PetpetiduploadimagePostResponses.kt create mode 100644 samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/petpetiduploadimage/post/PetpetiduploadimagePostSecurityInfo.kt create mode 100644 samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/petpetiduploadimage/post/parameters/Parameter0.kt create mode 100644 samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/petpetiduploadimage/post/parameters/parameter0/Schema0.kt create mode 100644 samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/petpetiduploadimage/post/requestbody/content/multipartformdata/MultipartformdataSchema.kt create mode 100644 samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/petpetiduploadimage/post/responses/PetpetiduploadimagePostCode200Response.kt create mode 100644 samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/petpetiduploadimage/post/security/PetpetiduploadimagePostSecurityRequirementObject0.kt create mode 100644 samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/solidus/SolidusGet.kt create mode 100644 samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/solidus/get/SolidusGetResponses.kt create mode 100644 samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/solidus/get/responses/SolidusGetCode200Response.kt create mode 100644 samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/storeinventory/StoreinventoryGet.kt create mode 100644 samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/storeinventory/get/StoreinventoryGetResponses.kt create mode 100644 samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/storeinventory/get/StoreinventoryGetSecurityInfo.kt create mode 100644 samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/storeinventory/get/responses/StoreinventoryGetCode200Response.kt create mode 100644 samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/storeinventory/get/security/StoreinventoryGetSecurityRequirementObject0.kt create mode 100644 samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/storeorder/StoreorderPost.kt create mode 100644 samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/storeorder/post/StoreorderPostRequestBody.kt create mode 100644 samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/storeorder/post/StoreorderPostResponses.kt create mode 100644 samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/storeorder/post/requestbody/content/applicationjson/ApplicationjsonSchema.kt create mode 100644 samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/storeorder/post/responses/StoreorderPostCode200Response.kt create mode 100644 samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/storeorder/post/responses/StoreorderPostCode400Response.kt create mode 100644 samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/storeorder/post/responses/code200response/content/applicationjson/ApplicationjsonSchema.kt create mode 100644 samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/storeorder/post/responses/code200response/content/applicationxml/ApplicationxmlSchema.kt create mode 100644 samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/storeorderorderid/StoreorderorderidDelete.kt create mode 100644 samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/storeorderorderid/StoreorderorderidGet.kt create mode 100644 samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/storeorderorderid/delete/Parameters.kt create mode 100644 samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/storeorderorderid/delete/StoreorderorderidDeletePathParameters.kt create mode 100644 samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/storeorderorderid/delete/StoreorderorderidDeleteResponses.kt create mode 100644 samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/storeorderorderid/delete/parameters/Parameter0.kt create mode 100644 samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/storeorderorderid/delete/parameters/parameter0/Schema0.kt create mode 100644 samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/storeorderorderid/delete/responses/StoreorderorderidDeleteCode400Response.kt create mode 100644 samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/storeorderorderid/delete/responses/StoreorderorderidDeleteCode404Response.kt create mode 100644 samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/storeorderorderid/get/Parameters.kt create mode 100644 samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/storeorderorderid/get/StoreorderorderidGetPathParameters.kt create mode 100644 samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/storeorderorderid/get/StoreorderorderidGetResponses.kt create mode 100644 samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/storeorderorderid/get/parameters/Parameter0.kt create mode 100644 samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/storeorderorderid/get/parameters/parameter0/Schema0.kt create mode 100644 samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/storeorderorderid/get/responses/StoreorderorderidGetCode200Response.kt create mode 100644 samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/storeorderorderid/get/responses/StoreorderorderidGetCode400Response.kt create mode 100644 samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/storeorderorderid/get/responses/StoreorderorderidGetCode404Response.kt create mode 100644 samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/storeorderorderid/get/responses/code200response/content/applicationjson/ApplicationjsonSchema.kt create mode 100644 samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/storeorderorderid/get/responses/code200response/content/applicationxml/ApplicationxmlSchema.kt create mode 100644 samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/user/UserPost.kt create mode 100644 samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/user/post/UserPostRequestBody.kt create mode 100644 samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/user/post/UserPostResponses.kt create mode 100644 samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/user/post/requestbody/content/applicationjson/ApplicationjsonSchema.kt create mode 100644 samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/user/post/responses/UserPostCodedefaultResponse.kt create mode 100644 samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/usercreatewitharray/UsercreatewitharrayPost.kt create mode 100644 samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/usercreatewitharray/post/UsercreatewitharrayPostRequestBody.kt create mode 100644 samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/usercreatewitharray/post/UsercreatewitharrayPostResponses.kt create mode 100644 samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/usercreatewitharray/post/responses/UsercreatewitharrayPostCodedefaultResponse.kt create mode 100644 samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/usercreatewithlist/UsercreatewithlistPost.kt create mode 100644 samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/usercreatewithlist/post/UsercreatewithlistPostRequestBody.kt create mode 100644 samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/usercreatewithlist/post/UsercreatewithlistPostResponses.kt create mode 100644 samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/usercreatewithlist/post/responses/UsercreatewithlistPostCodedefaultResponse.kt create mode 100644 samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/userlogin/UserloginGet.kt create mode 100644 samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/userlogin/get/Parameters.kt create mode 100644 samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/userlogin/get/UserloginGetQueryParameters.kt create mode 100644 samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/userlogin/get/UserloginGetResponses.kt create mode 100644 samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/userlogin/get/parameters/Parameter0.kt create mode 100644 samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/userlogin/get/parameters/Parameter1.kt create mode 100644 samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/userlogin/get/parameters/parameter0/Schema0.kt create mode 100644 samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/userlogin/get/parameters/parameter1/Schema1.kt create mode 100644 samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/userlogin/get/responses/UserloginGetCode200Response.kt create mode 100644 samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/userlogin/get/responses/UserloginGetCode400Response.kt create mode 100644 samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/userlogin/get/responses/code200response/Headers.kt create mode 100644 samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/userlogin/get/responses/code200response/UserloginGetCode200ResponseHeadersSchema.kt create mode 100644 samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/userlogin/get/responses/code200response/content/applicationjson/ApplicationjsonSchema.kt create mode 100644 samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/userlogin/get/responses/code200response/content/applicationxml/ApplicationxmlSchema.kt create mode 100644 samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/userlogin/get/responses/code200response/headers/Int32.kt create mode 100644 samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/userlogin/get/responses/code200response/headers/NumberHeader.kt create mode 100644 samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/userlogin/get/responses/code200response/headers/Refcontentschemaheader.kt create mode 100644 samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/userlogin/get/responses/code200response/headers/XExpiresAfter.kt create mode 100644 samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/userlogin/get/responses/code200response/headers/XRateLimit.kt create mode 100644 samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/userlogin/get/responses/code200response/headers/xexpiresafter/XExpiresAfterSchema.kt create mode 100644 samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/userlogin/get/responses/code200response/headers/xratelimit/content/applicationjson/XRateLimitSchema.kt create mode 100644 samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/userlogout/UserlogoutGet.kt create mode 100644 samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/userlogout/get/UserlogoutGetResponses.kt create mode 100644 samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/userlogout/get/responses/UserlogoutGetCodedefaultResponse.kt create mode 100644 samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/userusername/UserusernameDelete.kt create mode 100644 samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/userusername/UserusernameGet.kt create mode 100644 samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/userusername/UserusernamePut.kt create mode 100644 samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/userusername/delete/Parameters.kt create mode 100644 samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/userusername/delete/UserusernameDeletePathParameters.kt create mode 100644 samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/userusername/delete/UserusernameDeleteResponses.kt create mode 100644 samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/userusername/delete/parameters/Parameter0.kt create mode 100644 samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/userusername/delete/responses/UserusernameDeleteCode200Response.kt create mode 100644 samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/userusername/delete/responses/UserusernameDeleteCode404Response.kt create mode 100644 samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/userusername/get/Parameters.kt create mode 100644 samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/userusername/get/UserusernameGetPathParameters.kt create mode 100644 samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/userusername/get/UserusernameGetResponses.kt create mode 100644 samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/userusername/get/parameters/Parameter0.kt create mode 100644 samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/userusername/get/responses/UserusernameGetCode200Response.kt create mode 100644 samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/userusername/get/responses/UserusernameGetCode400Response.kt create mode 100644 samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/userusername/get/responses/UserusernameGetCode404Response.kt create mode 100644 samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/userusername/get/responses/code200response/content/applicationjson/ApplicationjsonSchema.kt create mode 100644 samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/userusername/get/responses/code200response/content/applicationxml/ApplicationxmlSchema.kt create mode 100644 samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/userusername/put/Parameters.kt create mode 100644 samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/userusername/put/UserusernamePutPathParameters.kt create mode 100644 samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/userusername/put/UserusernamePutRequestBody.kt create mode 100644 samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/userusername/put/UserusernamePutResponses.kt create mode 100644 samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/userusername/put/parameters/Parameter0.kt create mode 100644 samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/userusername/put/requestbody/content/applicationjson/ApplicationjsonSchema.kt create mode 100644 samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/userusername/put/responses/UserusernamePutCode400Response.kt create mode 100644 samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/userusername/put/responses/UserusernamePutCode404Response.kt create mode 100644 samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/requestbody/GenericRequestBody.kt create mode 100644 samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/requestbody/RequestBodySerializer.kt create mode 100644 samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/requestbody/SerializedRequestBody.kt create mode 100644 samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/response/ApiResponse.kt create mode 100644 samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/response/DeserializedHttpResponse.kt create mode 100644 samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/response/HeadersDeserializer.kt create mode 100644 samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/response/ResponseDeserializer.kt create mode 100644 samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/response/ResponsesDeserializer.kt create mode 100644 samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/restclient/RestClient.kt create mode 100644 samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/schemas/AnyTypeJsonSchema.kt create mode 100644 samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/schemas/BooleanJsonSchema.kt create mode 100644 samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/schemas/DateJsonSchema.kt create mode 100644 samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/schemas/DateTimeJsonSchema.kt create mode 100644 samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/schemas/DecimalJsonSchema.kt create mode 100644 samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/schemas/DoubleJsonSchema.kt create mode 100644 samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/schemas/FloatJsonSchema.kt create mode 100644 samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/schemas/GenericBuilder.kt create mode 100644 samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/schemas/Int32JsonSchema.kt create mode 100644 samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/schemas/Int64JsonSchema.kt create mode 100644 samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/schemas/IntJsonSchema.kt create mode 100644 samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/schemas/ListJsonSchema.kt create mode 100644 samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/schemas/MapJsonSchema.kt create mode 100644 samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/schemas/NotAnyTypeJsonSchema.kt create mode 100644 samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/schemas/NullJsonSchema.kt create mode 100644 samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/schemas/NumberJsonSchema.kt create mode 100644 samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/schemas/SetMaker.kt create mode 100644 samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/schemas/StringJsonSchema.kt create mode 100644 samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/schemas/UnsetAddPropsSetter.kt create mode 100644 samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/schemas/UuidJsonSchema.kt create mode 100644 samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/schemas/validation/AdditionalPropertiesValidator.kt create mode 100644 samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/schemas/validation/AllOfValidator.kt create mode 100644 samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/schemas/validation/AnyOfValidator.kt create mode 100644 samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/schemas/validation/BigDecimalValidator.kt create mode 100644 samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/schemas/validation/BooleanEnumValidator.kt create mode 100644 samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/schemas/validation/BooleanSchemaValidator.kt create mode 100644 samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/schemas/validation/BooleanValueMethod.kt create mode 100644 samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/schemas/validation/ConstValidator.kt create mode 100644 samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/schemas/validation/ContainsValidator.kt create mode 100644 samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/schemas/validation/CustomIsoparser.kt create mode 100644 samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/schemas/validation/DefaultValueMethod.kt create mode 100644 samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/schemas/validation/DependentRequiredValidator.kt create mode 100644 samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/schemas/validation/DependentSchemasValidator.kt create mode 100644 samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/schemas/validation/DoubleEnumValidator.kt create mode 100644 samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/schemas/validation/DoubleValueMethod.kt create mode 100644 samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/schemas/validation/ElseValidator.kt create mode 100644 samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/schemas/validation/EnumValidator.kt create mode 100644 samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/schemas/validation/ExclusiveMaximumValidator.kt create mode 100644 samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/schemas/validation/ExclusiveMinimumValidator.kt create mode 100644 samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/schemas/validation/FloatEnumValidator.kt create mode 100644 samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/schemas/validation/FloatValueMethod.kt create mode 100644 samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/schemas/validation/FormatValidator.kt create mode 100644 samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/schemas/validation/FrozenList.kt create mode 100644 samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/schemas/validation/FrozenMap.kt create mode 100644 samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/schemas/validation/IfValidator.kt create mode 100644 samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/schemas/validation/IntegerEnumValidator.kt create mode 100644 samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/schemas/validation/IntegerValueMethod.kt create mode 100644 samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/schemas/validation/ItemsValidator.kt create mode 100644 samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/schemas/validation/JsonSchema.kt create mode 100644 samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/schemas/validation/JsonSchemaFactory.kt create mode 100644 samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/schemas/validation/JsonSchemaInfo.kt create mode 100644 samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/schemas/validation/KeywordEntry.kt create mode 100644 samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/schemas/validation/KeywordValidator.kt create mode 100644 samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/schemas/validation/LengthValidator.kt create mode 100644 samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/schemas/validation/ListSchemaValidator.kt create mode 100644 samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/schemas/validation/LongEnumValidator.kt create mode 100644 samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/schemas/validation/LongValueMethod.kt create mode 100644 samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/schemas/validation/MapSchemaValidator.kt create mode 100644 samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/schemas/validation/MapUtils.kt create mode 100644 samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/schemas/validation/MaxContainsValidator.kt create mode 100644 samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/schemas/validation/MaxItemsValidator.kt create mode 100644 samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/schemas/validation/MaxLengthValidator.kt create mode 100644 samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/schemas/validation/MaxPropertiesValidator.kt create mode 100644 samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/schemas/validation/MaximumValidator.kt create mode 100644 samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/schemas/validation/MinContainsValidator.kt create mode 100644 samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/schemas/validation/MinItemsValidator.kt create mode 100644 samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/schemas/validation/MinLengthValidator.kt create mode 100644 samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/schemas/validation/MinPropertiesValidator.kt create mode 100644 samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/schemas/validation/MinimumValidator.kt create mode 100644 samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/schemas/validation/MultipleOfValidator.kt create mode 100644 samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/schemas/validation/NotValidator.kt create mode 100644 samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/schemas/validation/NullEnumValidator.kt create mode 100644 samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/schemas/validation/NullSchemaValidator.kt create mode 100644 samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/schemas/validation/NullValueMethod.kt create mode 100644 samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/schemas/validation/NumberSchemaValidator.kt create mode 100644 samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/schemas/validation/OneOfValidator.kt create mode 100644 samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/schemas/validation/PathToSchemasMap.kt create mode 100644 samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/schemas/validation/PatternPropertiesValidator.kt create mode 100644 samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/schemas/validation/PatternValidator.kt create mode 100644 samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/schemas/validation/PrefixItemsValidator.kt create mode 100644 samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/schemas/validation/PropertiesValidator.kt create mode 100644 samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/schemas/validation/PropertyEntry.kt create mode 100644 samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/schemas/validation/PropertyNamesValidator.kt create mode 100644 samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/schemas/validation/RequiredValidator.kt create mode 100644 samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/schemas/validation/StringEnumValidator.kt create mode 100644 samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/schemas/validation/StringSchemaValidator.kt create mode 100644 samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/schemas/validation/StringValueMethod.kt create mode 100644 samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/schemas/validation/ThenValidator.kt create mode 100644 samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/schemas/validation/TypeValidator.kt create mode 100644 samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/schemas/validation/UnevaluatedItemsValidator.kt create mode 100644 samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/schemas/validation/UnevaluatedPropertiesValidator.kt create mode 100644 samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/schemas/validation/UniqueItemsValidator.kt create mode 100644 samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/schemas/validation/UnsetAnyTypeJsonSchema.kt create mode 100644 samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/schemas/validation/ValidationData.kt create mode 100644 samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/schemas/validation/ValidationMetadata.kt create mode 100644 samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/securityrequirementobjects/AuthApplier.kt create mode 100644 samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/securityrequirementobjects/EmptySecurityRequirementObject.kt create mode 100644 samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/securityrequirementobjects/SecurityRequirementObject.kt create mode 100644 samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/securityrequirementobjects/SecurityRequirementObjectProvider.kt create mode 100644 samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/securityschemes/ApiKeyCookieSecurityScheme.kt create mode 100644 samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/securityschemes/ApiKeyHeaderSecurityScheme.kt create mode 100644 samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/securityschemes/ApiKeyQuerySecurityScheme.kt create mode 100644 samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/securityschemes/HttpBasicSecurityScheme.kt create mode 100644 samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/securityschemes/HttpBearerSecurityScheme.kt create mode 100644 samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/securityschemes/HttpDigestSecurityScheme.kt create mode 100644 samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/securityschemes/HttpSignatureSecurityScheme.kt create mode 100644 samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/securityschemes/MutualTlsSecurityScheme.kt create mode 100644 samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/securityschemes/OAuth2SecurityScheme.kt create mode 100644 samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/securityschemes/OpenIdConnectSecurityScheme.kt create mode 100644 samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/securityschemes/SecurityScheme.kt create mode 100644 samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/servers/RootServer0.kt create mode 100644 samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/servers/RootServer1.kt create mode 100644 samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/servers/RootServer2.kt create mode 100644 samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/servers/Server.kt create mode 100644 samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/servers/ServerProvider.kt create mode 100644 samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/servers/ServerWithVariables.kt create mode 100644 samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/servers/ServerWithoutVariables.kt create mode 100644 samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/servers/rootserver0/RootServer0Variables.kt create mode 100644 samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/servers/rootserver1/RootServer1Variables.kt create mode 100644 samples/client/petstore/kotlin/src/test/kotlin/org/openapijsonschematools/client/components/schemas/AbstractStepMessageTest.kt create mode 100644 samples/client/petstore/kotlin/src/test/kotlin/org/openapijsonschematools/client/components/schemas/AdditionalPropertiesClassTest.kt create mode 100644 samples/client/petstore/kotlin/src/test/kotlin/org/openapijsonschematools/client/components/schemas/AdditionalPropertiesSchemaTest.kt create mode 100644 samples/client/petstore/kotlin/src/test/kotlin/org/openapijsonschematools/client/components/schemas/AdditionalPropertiesWithArrayOfEnumsTest.kt create mode 100644 samples/client/petstore/kotlin/src/test/kotlin/org/openapijsonschematools/client/components/schemas/AddressTest.kt create mode 100644 samples/client/petstore/kotlin/src/test/kotlin/org/openapijsonschematools/client/components/schemas/AnimalFarmTest.kt create mode 100644 samples/client/petstore/kotlin/src/test/kotlin/org/openapijsonschematools/client/components/schemas/AnimalTest.kt create mode 100644 samples/client/petstore/kotlin/src/test/kotlin/org/openapijsonschematools/client/components/schemas/AnyTypeAndFormatTest.kt create mode 100644 samples/client/petstore/kotlin/src/test/kotlin/org/openapijsonschematools/client/components/schemas/AnyTypeNotStringTest.kt create mode 100644 samples/client/petstore/kotlin/src/test/kotlin/org/openapijsonschematools/client/components/schemas/ApiResponseSchemaTest.kt create mode 100644 samples/client/petstore/kotlin/src/test/kotlin/org/openapijsonschematools/client/components/schemas/AppleReqTest.kt create mode 100644 samples/client/petstore/kotlin/src/test/kotlin/org/openapijsonschematools/client/components/schemas/AppleTest.kt create mode 100644 samples/client/petstore/kotlin/src/test/kotlin/org/openapijsonschematools/client/components/schemas/ArrayHoldingAnyTypeTest.kt create mode 100644 samples/client/petstore/kotlin/src/test/kotlin/org/openapijsonschematools/client/components/schemas/ArrayOfArrayOfNumberOnlyTest.kt create mode 100644 samples/client/petstore/kotlin/src/test/kotlin/org/openapijsonschematools/client/components/schemas/ArrayOfEnumsTest.kt create mode 100644 samples/client/petstore/kotlin/src/test/kotlin/org/openapijsonschematools/client/components/schemas/ArrayOfNumberOnlyTest.kt create mode 100644 samples/client/petstore/kotlin/src/test/kotlin/org/openapijsonschematools/client/components/schemas/ArrayTestTest.kt create mode 100644 samples/client/petstore/kotlin/src/test/kotlin/org/openapijsonschematools/client/components/schemas/ArrayWithValidationsInItemsTest.kt create mode 100644 samples/client/petstore/kotlin/src/test/kotlin/org/openapijsonschematools/client/components/schemas/BananaReqTest.kt create mode 100644 samples/client/petstore/kotlin/src/test/kotlin/org/openapijsonschematools/client/components/schemas/BananaTest.kt create mode 100644 samples/client/petstore/kotlin/src/test/kotlin/org/openapijsonschematools/client/components/schemas/BarTest.kt create mode 100644 samples/client/petstore/kotlin/src/test/kotlin/org/openapijsonschematools/client/components/schemas/BasquePigTest.kt create mode 100644 samples/client/petstore/kotlin/src/test/kotlin/org/openapijsonschematools/client/components/schemas/BooleanEnumTest.kt create mode 100644 samples/client/petstore/kotlin/src/test/kotlin/org/openapijsonschematools/client/components/schemas/BooleanSchemaTest.kt create mode 100644 samples/client/petstore/kotlin/src/test/kotlin/org/openapijsonschematools/client/components/schemas/CapitalizationTest.kt create mode 100644 samples/client/petstore/kotlin/src/test/kotlin/org/openapijsonschematools/client/components/schemas/CatTest.kt create mode 100644 samples/client/petstore/kotlin/src/test/kotlin/org/openapijsonschematools/client/components/schemas/CategoryTest.kt create mode 100644 samples/client/petstore/kotlin/src/test/kotlin/org/openapijsonschematools/client/components/schemas/ChildCatTest.kt create mode 100644 samples/client/petstore/kotlin/src/test/kotlin/org/openapijsonschematools/client/components/schemas/ClassModelTest.kt create mode 100644 samples/client/petstore/kotlin/src/test/kotlin/org/openapijsonschematools/client/components/schemas/ClientTest.kt create mode 100644 samples/client/petstore/kotlin/src/test/kotlin/org/openapijsonschematools/client/components/schemas/ComplexQuadrilateralTest.kt create mode 100644 samples/client/petstore/kotlin/src/test/kotlin/org/openapijsonschematools/client/components/schemas/ComposedAnyOfDifferentTypesNoValidationsTest.kt create mode 100644 samples/client/petstore/kotlin/src/test/kotlin/org/openapijsonschematools/client/components/schemas/ComposedArrayTest.kt create mode 100644 samples/client/petstore/kotlin/src/test/kotlin/org/openapijsonschematools/client/components/schemas/ComposedBoolTest.kt create mode 100644 samples/client/petstore/kotlin/src/test/kotlin/org/openapijsonschematools/client/components/schemas/ComposedNoneTest.kt create mode 100644 samples/client/petstore/kotlin/src/test/kotlin/org/openapijsonschematools/client/components/schemas/ComposedNumberTest.kt create mode 100644 samples/client/petstore/kotlin/src/test/kotlin/org/openapijsonschematools/client/components/schemas/ComposedObjectTest.kt create mode 100644 samples/client/petstore/kotlin/src/test/kotlin/org/openapijsonschematools/client/components/schemas/ComposedOneOfDifferentTypesTest.kt create mode 100644 samples/client/petstore/kotlin/src/test/kotlin/org/openapijsonschematools/client/components/schemas/ComposedStringTest.kt create mode 100644 samples/client/petstore/kotlin/src/test/kotlin/org/openapijsonschematools/client/components/schemas/CurrencyTest.kt create mode 100644 samples/client/petstore/kotlin/src/test/kotlin/org/openapijsonschematools/client/components/schemas/DanishPigTest.kt create mode 100644 samples/client/petstore/kotlin/src/test/kotlin/org/openapijsonschematools/client/components/schemas/DateTimeTestTest.kt create mode 100644 samples/client/petstore/kotlin/src/test/kotlin/org/openapijsonschematools/client/components/schemas/DateTimeWithValidationsTest.kt create mode 100644 samples/client/petstore/kotlin/src/test/kotlin/org/openapijsonschematools/client/components/schemas/DateWithValidationsTest.kt create mode 100644 samples/client/petstore/kotlin/src/test/kotlin/org/openapijsonschematools/client/components/schemas/DecimalPayloadTest.kt create mode 100644 samples/client/petstore/kotlin/src/test/kotlin/org/openapijsonschematools/client/components/schemas/DogTest.kt create mode 100644 samples/client/petstore/kotlin/src/test/kotlin/org/openapijsonschematools/client/components/schemas/DrawingTest.kt create mode 100644 samples/client/petstore/kotlin/src/test/kotlin/org/openapijsonschematools/client/components/schemas/EnumArraysTest.kt create mode 100644 samples/client/petstore/kotlin/src/test/kotlin/org/openapijsonschematools/client/components/schemas/EnumClassTest.kt create mode 100644 samples/client/petstore/kotlin/src/test/kotlin/org/openapijsonschematools/client/components/schemas/EnumTestTest.kt create mode 100644 samples/client/petstore/kotlin/src/test/kotlin/org/openapijsonschematools/client/components/schemas/EquilateralTriangleTest.kt create mode 100644 samples/client/petstore/kotlin/src/test/kotlin/org/openapijsonschematools/client/components/schemas/FileSchemaTestClassTest.kt create mode 100644 samples/client/petstore/kotlin/src/test/kotlin/org/openapijsonschematools/client/components/schemas/FileTest.kt create mode 100644 samples/client/petstore/kotlin/src/test/kotlin/org/openapijsonschematools/client/components/schemas/FooTest.kt create mode 100644 samples/client/petstore/kotlin/src/test/kotlin/org/openapijsonschematools/client/components/schemas/FormatTestTest.kt create mode 100644 samples/client/petstore/kotlin/src/test/kotlin/org/openapijsonschematools/client/components/schemas/FromSchemaTest.kt create mode 100644 samples/client/petstore/kotlin/src/test/kotlin/org/openapijsonschematools/client/components/schemas/FruitReqTest.kt create mode 100644 samples/client/petstore/kotlin/src/test/kotlin/org/openapijsonschematools/client/components/schemas/FruitTest.kt create mode 100644 samples/client/petstore/kotlin/src/test/kotlin/org/openapijsonschematools/client/components/schemas/GmFruitTest.kt create mode 100644 samples/client/petstore/kotlin/src/test/kotlin/org/openapijsonschematools/client/components/schemas/GrandparentAnimalTest.kt create mode 100644 samples/client/petstore/kotlin/src/test/kotlin/org/openapijsonschematools/client/components/schemas/HasOnlyReadOnlyTest.kt create mode 100644 samples/client/petstore/kotlin/src/test/kotlin/org/openapijsonschematools/client/components/schemas/HealthCheckResultTest.kt create mode 100644 samples/client/petstore/kotlin/src/test/kotlin/org/openapijsonschematools/client/components/schemas/IntegerEnumBigTest.kt create mode 100644 samples/client/petstore/kotlin/src/test/kotlin/org/openapijsonschematools/client/components/schemas/IntegerEnumOneValueTest.kt create mode 100644 samples/client/petstore/kotlin/src/test/kotlin/org/openapijsonschematools/client/components/schemas/IntegerEnumTest.kt create mode 100644 samples/client/petstore/kotlin/src/test/kotlin/org/openapijsonschematools/client/components/schemas/IntegerEnumWithDefaultValueTest.kt create mode 100644 samples/client/petstore/kotlin/src/test/kotlin/org/openapijsonschematools/client/components/schemas/IntegerMax10Test.kt create mode 100644 samples/client/petstore/kotlin/src/test/kotlin/org/openapijsonschematools/client/components/schemas/IntegerMin15Test.kt create mode 100644 samples/client/petstore/kotlin/src/test/kotlin/org/openapijsonschematools/client/components/schemas/IsoscelesTriangleTest.kt create mode 100644 samples/client/petstore/kotlin/src/test/kotlin/org/openapijsonschematools/client/components/schemas/ItemsSchemaTest.kt create mode 100644 samples/client/petstore/kotlin/src/test/kotlin/org/openapijsonschematools/client/components/schemas/ItemsTest.kt create mode 100644 samples/client/petstore/kotlin/src/test/kotlin/org/openapijsonschematools/client/components/schemas/JSONPatchRequestAddReplaceTestTest.kt create mode 100644 samples/client/petstore/kotlin/src/test/kotlin/org/openapijsonschematools/client/components/schemas/JSONPatchRequestMoveCopyTest.kt create mode 100644 samples/client/petstore/kotlin/src/test/kotlin/org/openapijsonschematools/client/components/schemas/JSONPatchRequestRemoveTest.kt create mode 100644 samples/client/petstore/kotlin/src/test/kotlin/org/openapijsonschematools/client/components/schemas/JSONPatchRequestTest.kt create mode 100644 samples/client/petstore/kotlin/src/test/kotlin/org/openapijsonschematools/client/components/schemas/MammalTest.kt create mode 100644 samples/client/petstore/kotlin/src/test/kotlin/org/openapijsonschematools/client/components/schemas/MapTestTest.kt create mode 100644 samples/client/petstore/kotlin/src/test/kotlin/org/openapijsonschematools/client/components/schemas/MixedPropertiesAndAdditionalPropertiesClassTest.kt create mode 100644 samples/client/petstore/kotlin/src/test/kotlin/org/openapijsonschematools/client/components/schemas/MoneyTest.kt create mode 100644 samples/client/petstore/kotlin/src/test/kotlin/org/openapijsonschematools/client/components/schemas/MultiPropertiesSchemaTest.kt create mode 100644 samples/client/petstore/kotlin/src/test/kotlin/org/openapijsonschematools/client/components/schemas/MyObjectDtoTest.kt create mode 100644 samples/client/petstore/kotlin/src/test/kotlin/org/openapijsonschematools/client/components/schemas/NameTest.kt create mode 100644 samples/client/petstore/kotlin/src/test/kotlin/org/openapijsonschematools/client/components/schemas/NoAdditionalPropertiesTest.kt create mode 100644 samples/client/petstore/kotlin/src/test/kotlin/org/openapijsonschematools/client/components/schemas/NullableClassTest.kt create mode 100644 samples/client/petstore/kotlin/src/test/kotlin/org/openapijsonschematools/client/components/schemas/NullableShapeTest.kt create mode 100644 samples/client/petstore/kotlin/src/test/kotlin/org/openapijsonschematools/client/components/schemas/NullableStringTest.kt create mode 100644 samples/client/petstore/kotlin/src/test/kotlin/org/openapijsonschematools/client/components/schemas/NumberOnlyTest.kt create mode 100644 samples/client/petstore/kotlin/src/test/kotlin/org/openapijsonschematools/client/components/schemas/NumberSchemaTest.kt create mode 100644 samples/client/petstore/kotlin/src/test/kotlin/org/openapijsonschematools/client/components/schemas/NumberWithExclusiveMinMaxTest.kt create mode 100644 samples/client/petstore/kotlin/src/test/kotlin/org/openapijsonschematools/client/components/schemas/NumberWithValidationsTest.kt create mode 100644 samples/client/petstore/kotlin/src/test/kotlin/org/openapijsonschematools/client/components/schemas/ObjWithRequiredPropsBaseTest.kt create mode 100644 samples/client/petstore/kotlin/src/test/kotlin/org/openapijsonschematools/client/components/schemas/ObjWithRequiredPropsTest.kt create mode 100644 samples/client/petstore/kotlin/src/test/kotlin/org/openapijsonschematools/client/components/schemas/ObjectInterfaceTest.kt create mode 100644 samples/client/petstore/kotlin/src/test/kotlin/org/openapijsonschematools/client/components/schemas/ObjectModelWithArgAndArgsPropertiesTest.kt create mode 100644 samples/client/petstore/kotlin/src/test/kotlin/org/openapijsonschematools/client/components/schemas/ObjectModelWithRefPropsTest.kt create mode 100644 samples/client/petstore/kotlin/src/test/kotlin/org/openapijsonschematools/client/components/schemas/ObjectWithAllOfWithReqTestPropFromUnsetAddPropTest.kt create mode 100644 samples/client/petstore/kotlin/src/test/kotlin/org/openapijsonschematools/client/components/schemas/ObjectWithCollidingPropertiesTest.kt create mode 100644 samples/client/petstore/kotlin/src/test/kotlin/org/openapijsonschematools/client/components/schemas/ObjectWithDecimalPropertiesTest.kt create mode 100644 samples/client/petstore/kotlin/src/test/kotlin/org/openapijsonschematools/client/components/schemas/ObjectWithDifficultlyNamedPropsTest.kt create mode 100644 samples/client/petstore/kotlin/src/test/kotlin/org/openapijsonschematools/client/components/schemas/ObjectWithInlineCompositionPropertyTest.kt create mode 100644 samples/client/petstore/kotlin/src/test/kotlin/org/openapijsonschematools/client/components/schemas/ObjectWithInvalidNamedRefedPropertiesTest.kt create mode 100644 samples/client/petstore/kotlin/src/test/kotlin/org/openapijsonschematools/client/components/schemas/ObjectWithNonIntersectingValuesTest.kt create mode 100644 samples/client/petstore/kotlin/src/test/kotlin/org/openapijsonschematools/client/components/schemas/ObjectWithOnlyOptionalPropsTest.kt create mode 100644 samples/client/petstore/kotlin/src/test/kotlin/org/openapijsonschematools/client/components/schemas/ObjectWithOptionalTestPropTest.kt create mode 100644 samples/client/petstore/kotlin/src/test/kotlin/org/openapijsonschematools/client/components/schemas/ObjectWithValidationsTest.kt create mode 100644 samples/client/petstore/kotlin/src/test/kotlin/org/openapijsonschematools/client/components/schemas/OrderTest.kt create mode 100644 samples/client/petstore/kotlin/src/test/kotlin/org/openapijsonschematools/client/components/schemas/PaginatedResultMyObjectDtoTest.kt create mode 100644 samples/client/petstore/kotlin/src/test/kotlin/org/openapijsonschematools/client/components/schemas/ParentPetTest.kt create mode 100644 samples/client/petstore/kotlin/src/test/kotlin/org/openapijsonschematools/client/components/schemas/PetTest.kt create mode 100644 samples/client/petstore/kotlin/src/test/kotlin/org/openapijsonschematools/client/components/schemas/PigTest.kt create mode 100644 samples/client/petstore/kotlin/src/test/kotlin/org/openapijsonschematools/client/components/schemas/PlayerTest.kt create mode 100644 samples/client/petstore/kotlin/src/test/kotlin/org/openapijsonschematools/client/components/schemas/PublicKeyTest.kt create mode 100644 samples/client/petstore/kotlin/src/test/kotlin/org/openapijsonschematools/client/components/schemas/QuadrilateralInterfaceTest.kt create mode 100644 samples/client/petstore/kotlin/src/test/kotlin/org/openapijsonschematools/client/components/schemas/QuadrilateralTest.kt create mode 100644 samples/client/petstore/kotlin/src/test/kotlin/org/openapijsonschematools/client/components/schemas/ReadOnlyFirstTest.kt create mode 100644 samples/client/petstore/kotlin/src/test/kotlin/org/openapijsonschematools/client/components/schemas/RefPetTest.kt create mode 100644 samples/client/petstore/kotlin/src/test/kotlin/org/openapijsonschematools/client/components/schemas/ReqPropsFromExplicitAddPropsTest.kt create mode 100644 samples/client/petstore/kotlin/src/test/kotlin/org/openapijsonschematools/client/components/schemas/ReqPropsFromTrueAddPropsTest.kt create mode 100644 samples/client/petstore/kotlin/src/test/kotlin/org/openapijsonschematools/client/components/schemas/ReqPropsFromUnsetAddPropsTest.kt create mode 100644 samples/client/petstore/kotlin/src/test/kotlin/org/openapijsonschematools/client/components/schemas/ReturnSchemaTest.kt create mode 100644 samples/client/petstore/kotlin/src/test/kotlin/org/openapijsonschematools/client/components/schemas/ScaleneTriangleTest.kt create mode 100644 samples/client/petstore/kotlin/src/test/kotlin/org/openapijsonschematools/client/components/schemas/Schema200ResponseTest.kt create mode 100644 samples/client/petstore/kotlin/src/test/kotlin/org/openapijsonschematools/client/components/schemas/SelfReferencingArrayModelTest.kt create mode 100644 samples/client/petstore/kotlin/src/test/kotlin/org/openapijsonschematools/client/components/schemas/SelfReferencingObjectModelTest.kt create mode 100644 samples/client/petstore/kotlin/src/test/kotlin/org/openapijsonschematools/client/components/schemas/ShapeOrNullTest.kt create mode 100644 samples/client/petstore/kotlin/src/test/kotlin/org/openapijsonschematools/client/components/schemas/ShapeTest.kt create mode 100644 samples/client/petstore/kotlin/src/test/kotlin/org/openapijsonschematools/client/components/schemas/SimpleQuadrilateralTest.kt create mode 100644 samples/client/petstore/kotlin/src/test/kotlin/org/openapijsonschematools/client/components/schemas/SomeObjectTest.kt create mode 100644 samples/client/petstore/kotlin/src/test/kotlin/org/openapijsonschematools/client/components/schemas/SpecialModelnameTest.kt create mode 100644 samples/client/petstore/kotlin/src/test/kotlin/org/openapijsonschematools/client/components/schemas/StringBooleanMapTest.kt create mode 100644 samples/client/petstore/kotlin/src/test/kotlin/org/openapijsonschematools/client/components/schemas/StringEnumTest.kt create mode 100644 samples/client/petstore/kotlin/src/test/kotlin/org/openapijsonschematools/client/components/schemas/StringEnumWithDefaultValueTest.kt create mode 100644 samples/client/petstore/kotlin/src/test/kotlin/org/openapijsonschematools/client/components/schemas/StringSchemaTest.kt create mode 100644 samples/client/petstore/kotlin/src/test/kotlin/org/openapijsonschematools/client/components/schemas/StringWithValidationTest.kt create mode 100644 samples/client/petstore/kotlin/src/test/kotlin/org/openapijsonschematools/client/components/schemas/TagTest.kt create mode 100644 samples/client/petstore/kotlin/src/test/kotlin/org/openapijsonschematools/client/components/schemas/TriangleInterfaceTest.kt create mode 100644 samples/client/petstore/kotlin/src/test/kotlin/org/openapijsonschematools/client/components/schemas/TriangleTest.kt create mode 100644 samples/client/petstore/kotlin/src/test/kotlin/org/openapijsonschematools/client/components/schemas/UUIDStringTest.kt create mode 100644 samples/client/petstore/kotlin/src/test/kotlin/org/openapijsonschematools/client/components/schemas/UserTest.kt create mode 100644 samples/client/petstore/kotlin/src/test/kotlin/org/openapijsonschematools/client/components/schemas/WhaleTest.kt create mode 100644 samples/client/petstore/kotlin/src/test/kotlin/org/openapijsonschematools/client/components/schemas/ZebraTest.kt create mode 100644 samples/client/petstore/kotlin/src/test/kotlin/org/openapijsonschematools/client/configurations/JsonSchemaKeywordFlagsTest.kt create mode 100644 samples/client/petstore/kotlin/src/test/kotlin/org/openapijsonschematools/client/header/ContentHeaderTest.kt create mode 100644 samples/client/petstore/kotlin/src/test/kotlin/org/openapijsonschematools/client/header/SchemaHeaderTest.kt create mode 100644 samples/client/petstore/kotlin/src/test/kotlin/org/openapijsonschematools/client/parameter/CookieSerializerTest.kt create mode 100644 samples/client/petstore/kotlin/src/test/kotlin/org/openapijsonschematools/client/parameter/HeadersSerializerTest.kt create mode 100644 samples/client/petstore/kotlin/src/test/kotlin/org/openapijsonschematools/client/parameter/PathSerializerTest.kt create mode 100644 samples/client/petstore/kotlin/src/test/kotlin/org/openapijsonschematools/client/parameter/QuerySerializerTest.kt create mode 100644 samples/client/petstore/kotlin/src/test/kotlin/org/openapijsonschematools/client/parameter/SchemaNonQueryParameterTest.kt create mode 100644 samples/client/petstore/kotlin/src/test/kotlin/org/openapijsonschematools/client/parameter/SchemaQueryParameterTest.kt create mode 100644 samples/client/petstore/kotlin/src/test/kotlin/org/openapijsonschematools/client/requestbody/RequestBodySerializerTest.kt create mode 100644 samples/client/petstore/kotlin/src/test/kotlin/org/openapijsonschematools/client/response/ResponseDeserializerTest.kt create mode 100644 samples/client/petstore/kotlin/src/test/kotlin/org/openapijsonschematools/client/schemas/AnyTypeSchemaTest.kt create mode 100644 samples/client/petstore/kotlin/src/test/kotlin/org/openapijsonschematools/client/schemas/ArrayTypeSchemaTest.kt create mode 100644 samples/client/petstore/kotlin/src/test/kotlin/org/openapijsonschematools/client/schemas/BooleanSchemaTest.kt create mode 100644 samples/client/petstore/kotlin/src/test/kotlin/org/openapijsonschematools/client/schemas/ListBuilderTest.kt create mode 100644 samples/client/petstore/kotlin/src/test/kotlin/org/openapijsonschematools/client/schemas/ListSchemaTest.kt create mode 100644 samples/client/petstore/kotlin/src/test/kotlin/org/openapijsonschematools/client/schemas/MapSchemaTest.kt create mode 100644 samples/client/petstore/kotlin/src/test/kotlin/org/openapijsonschematools/client/schemas/NullSchemaTest.kt create mode 100644 samples/client/petstore/kotlin/src/test/kotlin/org/openapijsonschematools/client/schemas/NumberSchemaTest.kt create mode 100644 samples/client/petstore/kotlin/src/test/kotlin/org/openapijsonschematools/client/schemas/ObjectTypeSchemaTest.kt create mode 100644 samples/client/petstore/kotlin/src/test/kotlin/org/openapijsonschematools/client/schemas/RefBooleanSchemaTest.kt create mode 100644 samples/client/petstore/kotlin/src/test/kotlin/org/openapijsonschematools/client/schemas/validation/AdditionalPropertiesValidatorTest.kt create mode 100644 samples/client/petstore/kotlin/src/test/kotlin/org/openapijsonschematools/client/schemas/validation/CustomIsoparserTest.kt create mode 100644 samples/client/petstore/kotlin/src/test/kotlin/org/openapijsonschematools/client/schemas/validation/FormatValidatorTest.kt create mode 100644 samples/client/petstore/kotlin/src/test/kotlin/org/openapijsonschematools/client/schemas/validation/ItemsValidatorTest.kt create mode 100644 samples/client/petstore/kotlin/src/test/kotlin/org/openapijsonschematools/client/schemas/validation/JsonSchemaTest.kt create mode 100644 samples/client/petstore/kotlin/src/test/kotlin/org/openapijsonschematools/client/schemas/validation/PropertiesValidatorTest.kt create mode 100644 samples/client/petstore/kotlin/src/test/kotlin/org/openapijsonschematools/client/schemas/validation/RequiredValidatorTest.kt create mode 100644 samples/client/petstore/kotlin/src/test/kotlin/org/openapijsonschematools/client/schemas/validation/TypeValidatorTest.kt create mode 100644 src/main/java/org/openapijsonschematools/codegen/generators/KotlinClientGenerator.java create mode 100644 src/main/resources/kotlin/README.hbs create mode 100644 src/main/resources/kotlin/_helper_footer_links.hbs create mode 100644 src/main/resources/kotlin/_helper_header.hbs create mode 100644 src/main/resources/kotlin/_helper_imports.hbs create mode 100644 src/main/resources/kotlin/build.gradle.hbs create mode 100644 src/main/resources/kotlin/gitignore.hbs create mode 100644 src/main/resources/kotlin/settings.gradle.hbs create mode 100644 src/main/resources/kotlin/src/main/kotlin/packagename/apiclient/ApiClient.hbs create mode 100644 src/main/resources/kotlin/src/main/kotlin/packagename/apis/apis_path_to_api.hbs create mode 100644 src/main/resources/kotlin/src/main/kotlin/packagename/apis/paths/Api.hbs create mode 100644 src/main/resources/kotlin/src/main/kotlin/packagename/apis/paths/ApiDoc.hbs create mode 100644 src/main/resources/kotlin/src/main/kotlin/packagename/apis/tags/Api.hbs create mode 100644 src/main/resources/kotlin/src/main/kotlin/packagename/apis/tags/ApiDoc.hbs create mode 100644 src/main/resources/kotlin/src/main/kotlin/packagename/components/_helper_anchor_id.hbs create mode 100644 src/main/resources/kotlin/src/main/kotlin/packagename/components/_helper_header_from_identifier_pieces.hbs create mode 100644 src/main/resources/kotlin/src/main/kotlin/packagename/components/headers/Header.hbs create mode 100644 src/main/resources/kotlin/src/main/kotlin/packagename/components/headers/HeaderDoc.hbs create mode 100644 src/main/resources/kotlin/src/main/kotlin/packagename/components/parameter/Parameter.hbs create mode 100644 src/main/resources/kotlin/src/main/kotlin/packagename/components/parameter/ParameterDoc.hbs create mode 100644 src/main/resources/kotlin/src/main/kotlin/packagename/components/requestbodies/RequestBody.hbs create mode 100644 src/main/resources/kotlin/src/main/kotlin/packagename/components/requestbodies/RequestBodyDoc.hbs create mode 100644 src/main/resources/kotlin/src/main/kotlin/packagename/components/responses/HeadersDeserializer.hbs create mode 100644 src/main/resources/kotlin/src/main/kotlin/packagename/components/responses/Response.hbs create mode 100644 src/main/resources/kotlin/src/main/kotlin/packagename/components/responses/ResponseDoc.hbs create mode 100644 src/main/resources/kotlin/src/main/kotlin/packagename/components/schemas/Schema.hbs create mode 100644 src/main/resources/kotlin/src/main/kotlin/packagename/components/schemas/SchemaClass/SchemaClass.hbs create mode 100644 src/main/resources/kotlin/src/main/kotlin/packagename/components/schemas/SchemaClass/_Schema_anytypeOrMultitype.hbs create mode 100644 src/main/resources/kotlin/src/main/kotlin/packagename/components/schemas/SchemaClass/_Schema_boolean.hbs create mode 100644 src/main/resources/kotlin/src/main/kotlin/packagename/components/schemas/SchemaClass/_Schema_list.hbs create mode 100644 src/main/resources/kotlin/src/main/kotlin/packagename/components/schemas/SchemaClass/_Schema_map.hbs create mode 100644 src/main/resources/kotlin/src/main/kotlin/packagename/components/schemas/SchemaClass/_Schema_null.hbs create mode 100644 src/main/resources/kotlin/src/main/kotlin/packagename/components/schemas/SchemaClass/_Schema_number.hbs create mode 100644 src/main/resources/kotlin/src/main/kotlin/packagename/components/schemas/SchemaClass/_Schema_string.hbs create mode 100644 src/main/resources/kotlin/src/main/kotlin/packagename/components/schemas/SchemaClass/_Schema_varEqualsClass.hbs create mode 100644 src/main/resources/kotlin/src/main/kotlin/packagename/components/schemas/SchemaClass/_additionalProperties.hbs create mode 100644 src/main/resources/kotlin/src/main/kotlin/packagename/components/schemas/SchemaClass/_allOf.hbs create mode 100644 src/main/resources/kotlin/src/main/kotlin/packagename/components/schemas/SchemaClass/_anyOf.hbs create mode 100644 src/main/resources/kotlin/src/main/kotlin/packagename/components/schemas/SchemaClass/_boxedBoolean.hbs create mode 100644 src/main/resources/kotlin/src/main/kotlin/packagename/components/schemas/SchemaClass/_boxedClass.hbs create mode 100644 src/main/resources/kotlin/src/main/kotlin/packagename/components/schemas/SchemaClass/_boxedClasses.hbs create mode 100644 src/main/resources/kotlin/src/main/kotlin/packagename/components/schemas/SchemaClass/_boxedList.hbs create mode 100644 src/main/resources/kotlin/src/main/kotlin/packagename/components/schemas/SchemaClass/_boxedMap.hbs create mode 100644 src/main/resources/kotlin/src/main/kotlin/packagename/components/schemas/SchemaClass/_boxedNumber.hbs create mode 100644 src/main/resources/kotlin/src/main/kotlin/packagename/components/schemas/SchemaClass/_boxedString.hbs create mode 100644 src/main/resources/kotlin/src/main/kotlin/packagename/components/schemas/SchemaClass/_boxedVoid.hbs create mode 100644 src/main/resources/kotlin/src/main/kotlin/packagename/components/schemas/SchemaClass/_const.hbs create mode 100644 src/main/resources/kotlin/src/main/kotlin/packagename/components/schemas/SchemaClass/_contains.hbs create mode 100644 src/main/resources/kotlin/src/main/kotlin/packagename/components/schemas/SchemaClass/_default.hbs create mode 100644 src/main/resources/kotlin/src/main/kotlin/packagename/components/schemas/SchemaClass/_dependentRequired.hbs create mode 100644 src/main/resources/kotlin/src/main/kotlin/packagename/components/schemas/SchemaClass/_dependentSchemas.hbs create mode 100644 src/main/resources/kotlin/src/main/kotlin/packagename/components/schemas/SchemaClass/_else.hbs create mode 100644 src/main/resources/kotlin/src/main/kotlin/packagename/components/schemas/SchemaClass/_enum.hbs create mode 100644 src/main/resources/kotlin/src/main/kotlin/packagename/components/schemas/SchemaClass/_exclusiveMaximum.hbs create mode 100644 src/main/resources/kotlin/src/main/kotlin/packagename/components/schemas/SchemaClass/_exclusiveMinimum.hbs create mode 100644 src/main/resources/kotlin/src/main/kotlin/packagename/components/schemas/SchemaClass/_format.hbs create mode 100644 src/main/resources/kotlin/src/main/kotlin/packagename/components/schemas/SchemaClass/_getNewInstanceObject_implementor.hbs create mode 100644 src/main/resources/kotlin/src/main/kotlin/packagename/components/schemas/SchemaClass/_if.hbs create mode 100644 src/main/resources/kotlin/src/main/kotlin/packagename/components/schemas/SchemaClass/_items.hbs create mode 100644 src/main/resources/kotlin/src/main/kotlin/packagename/components/schemas/SchemaClass/_maxContains.hbs create mode 100644 src/main/resources/kotlin/src/main/kotlin/packagename/components/schemas/SchemaClass/_maxItems.hbs create mode 100644 src/main/resources/kotlin/src/main/kotlin/packagename/components/schemas/SchemaClass/_maxLength.hbs create mode 100644 src/main/resources/kotlin/src/main/kotlin/packagename/components/schemas/SchemaClass/_maxProperties.hbs create mode 100644 src/main/resources/kotlin/src/main/kotlin/packagename/components/schemas/SchemaClass/_maximum.hbs create mode 100644 src/main/resources/kotlin/src/main/kotlin/packagename/components/schemas/SchemaClass/_minContains.hbs create mode 100644 src/main/resources/kotlin/src/main/kotlin/packagename/components/schemas/SchemaClass/_minItems.hbs create mode 100644 src/main/resources/kotlin/src/main/kotlin/packagename/components/schemas/SchemaClass/_minLength.hbs create mode 100644 src/main/resources/kotlin/src/main/kotlin/packagename/components/schemas/SchemaClass/_minProperties.hbs create mode 100644 src/main/resources/kotlin/src/main/kotlin/packagename/components/schemas/SchemaClass/_minimum.hbs create mode 100644 src/main/resources/kotlin/src/main/kotlin/packagename/components/schemas/SchemaClass/_multipleOf.hbs create mode 100644 src/main/resources/kotlin/src/main/kotlin/packagename/components/schemas/SchemaClass/_not.hbs create mode 100644 src/main/resources/kotlin/src/main/kotlin/packagename/components/schemas/SchemaClass/_oneOf.hbs create mode 100644 src/main/resources/kotlin/src/main/kotlin/packagename/components/schemas/SchemaClass/_pattern.hbs create mode 100644 src/main/resources/kotlin/src/main/kotlin/packagename/components/schemas/SchemaClass/_patternProperties.hbs create mode 100644 src/main/resources/kotlin/src/main/kotlin/packagename/components/schemas/SchemaClass/_prefixItems.hbs create mode 100644 src/main/resources/kotlin/src/main/kotlin/packagename/components/schemas/SchemaClass/_properties.hbs create mode 100644 src/main/resources/kotlin/src/main/kotlin/packagename/components/schemas/SchemaClass/_propertyNames.hbs create mode 100644 src/main/resources/kotlin/src/main/kotlin/packagename/components/schemas/SchemaClass/_required.hbs create mode 100644 src/main/resources/kotlin/src/main/kotlin/packagename/components/schemas/SchemaClass/_then.hbs create mode 100644 src/main/resources/kotlin/src/main/kotlin/packagename/components/schemas/SchemaClass/_types.hbs create mode 100644 src/main/resources/kotlin/src/main/kotlin/packagename/components/schemas/SchemaClass/_unevaluatedItems.hbs create mode 100644 src/main/resources/kotlin/src/main/kotlin/packagename/components/schemas/SchemaClass/_unevaluatedProperties.hbs create mode 100644 src/main/resources/kotlin/src/main/kotlin/packagename/components/schemas/SchemaClass/_uniqueItems.hbs create mode 100644 src/main/resources/kotlin/src/main/kotlin/packagename/components/schemas/SchemaClass/_validateAndBox.hbs create mode 100644 src/main/resources/kotlin/src/main/kotlin/packagename/components/schemas/SchemaClass/_validateAndBoxBoolean.hbs create mode 100644 src/main/resources/kotlin/src/main/kotlin/packagename/components/schemas/SchemaClass/_validateAndBoxList.hbs create mode 100644 src/main/resources/kotlin/src/main/kotlin/packagename/components/schemas/SchemaClass/_validateAndBoxMap.hbs create mode 100644 src/main/resources/kotlin/src/main/kotlin/packagename/components/schemas/SchemaClass/_validateAndBoxNumber.hbs create mode 100644 src/main/resources/kotlin/src/main/kotlin/packagename/components/schemas/SchemaClass/_validateAndBoxString.hbs create mode 100644 src/main/resources/kotlin/src/main/kotlin/packagename/components/schemas/SchemaClass/_validateAndBoxVoid.hbs create mode 100644 src/main/resources/kotlin/src/main/kotlin/packagename/components/schemas/SchemaClass/_validate_implementor.hbs create mode 100644 src/main/resources/kotlin/src/main/kotlin/packagename/components/schemas/Schema_doc.hbs create mode 100644 src/main/resources/kotlin/src/main/kotlin/packagename/components/schemas/Schema_getSchemas.hbs create mode 100644 src/main/resources/kotlin/src/main/kotlin/packagename/components/schemas/_arrayInputAddItem.hbs create mode 100644 src/main/resources/kotlin/src/main/kotlin/packagename/components/schemas/_arrayInputType.hbs create mode 100644 src/main/resources/kotlin/src/main/kotlin/packagename/components/schemas/_arrayOutputType.hbs create mode 100644 src/main/resources/kotlin/src/main/kotlin/packagename/components/schemas/_containerClassName.hbs create mode 100644 src/main/resources/kotlin/src/main/kotlin/packagename/components/schemas/_docschema_methodsInherited.hbs create mode 100644 src/main/resources/kotlin/src/main/kotlin/packagename/components/schemas/_docschema_methodsInheritedFn create mode 100644 src/main/resources/kotlin/src/main/kotlin/packagename/components/schemas/_enumTypes.hbs create mode 100644 src/main/resources/kotlin/src/main/kotlin/packagename/components/schemas/_objectInputAddPropSetter.hbs create mode 100644 src/main/resources/kotlin/src/main/kotlin/packagename/components/schemas/_objectInputAddPropUnsetSetterDocs.hbs create mode 100644 src/main/resources/kotlin/src/main/kotlin/packagename/components/schemas/_objectInputSetter.hbs create mode 100644 src/main/resources/kotlin/src/main/kotlin/packagename/components/schemas/_objectInputType.hbs create mode 100644 src/main/resources/kotlin/src/main/kotlin/packagename/components/schemas/_objectOutputGetProperty.hbs create mode 100644 src/main/resources/kotlin/src/main/kotlin/packagename/components/schemas/_objectOutputProperties.hbs create mode 100644 src/main/resources/kotlin/src/main/kotlin/packagename/components/schemas/_objectOutputType.hbs create mode 100644 src/main/resources/kotlin/src/main/kotlin/packagename/components/schemas/_sealedClassName.hbs create mode 100644 src/main/resources/kotlin/src/main/kotlin/packagename/components/schemas/docschema_arrayInput.hbs create mode 100644 src/main/resources/kotlin/src/main/kotlin/packagename/components/schemas/docschema_extends.hbs create mode 100644 src/main/resources/kotlin/src/main/kotlin/packagename/components/schemas/docschema_extends_varEqualsClass.hbs create mode 100644 src/main/resources/kotlin/src/main/kotlin/packagename/components/schemas/docschema_fields.hbs create mode 100644 src/main/resources/kotlin/src/main/kotlin/packagename/components/schemas/docschema_fields_field.hbs create mode 100644 src/main/resources/kotlin/src/main/kotlin/packagename/components/schemas/docschema_io_types.hbs create mode 100644 src/main/resources/kotlin/src/main/kotlin/packagename/components/schemas/docschema_objectInput.hbs create mode 100644 src/main/resources/kotlin/src/main/kotlin/packagename/components/schemas/helpers/notes_msg.hbs create mode 100644 src/main/resources/kotlin/src/main/kotlin/packagename/components/schemas/helpers/payload_renderer.hbs create mode 100644 src/main/resources/kotlin/src/main/kotlin/packagename/components/schemas/types/_schema_input_type_base.hbs create mode 100644 src/main/resources/kotlin/src/main/kotlin/packagename/components/schemas/types/_schema_output_type_base.hbs create mode 100644 src/main/resources/kotlin/src/main/kotlin/packagename/components/schemas/types/schema_input_type.hbs create mode 100644 src/main/resources/kotlin/src/main/kotlin/packagename/components/schemas/types/schema_output_type.hbs create mode 100644 src/main/resources/kotlin/src/main/kotlin/packagename/components/schemas/validateAndBoxSchemaCodeSample.hbs create mode 100644 src/main/resources/kotlin/src/main/kotlin/packagename/components/schemas/validateSchemaCodeSample.hbs create mode 100644 src/main/resources/kotlin/src/main/kotlin/packagename/components/securityschemes/SecurityScheme.hbs create mode 100644 src/main/resources/kotlin/src/main/kotlin/packagename/components/securityschemes/SecurityScheme_doc.hbs create mode 100644 src/main/resources/kotlin/src/main/kotlin/packagename/components/securityschemes/_doc_descMethods.hbs create mode 100644 src/main/resources/kotlin/src/main/kotlin/packagename/configurations/ApiConfiguration.hbs create mode 100644 src/main/resources/kotlin/src/main/kotlin/packagename/configurations/JsonSchemaKeywordFlags.hbs create mode 100644 src/main/resources/kotlin/src/main/kotlin/packagename/configurations/SchemaConfiguration.hbs create mode 100644 src/main/resources/kotlin/src/main/kotlin/packagename/contenttype/ContentTypeDeserializer.hbs create mode 100644 src/main/resources/kotlin/src/main/kotlin/packagename/contenttype/ContentTypeDetector.hbs create mode 100644 src/main/resources/kotlin/src/main/kotlin/packagename/contenttype/ContentTypeSerializer.hbs create mode 100644 src/main/resources/kotlin/src/main/kotlin/packagename/exceptions/ApiException.hbs create mode 100644 src/main/resources/kotlin/src/main/kotlin/packagename/exceptions/BaseException.hbs create mode 100644 src/main/resources/kotlin/src/main/kotlin/packagename/exceptions/InvalidAdditionalPropertyException.hbs create mode 100644 src/main/resources/kotlin/src/main/kotlin/packagename/exceptions/NotImplementedException.hbs create mode 100644 src/main/resources/kotlin/src/main/kotlin/packagename/exceptions/UnsetPropertyException.hbs create mode 100644 src/main/resources/kotlin/src/main/kotlin/packagename/exceptions/ValidationException.hbs create mode 100644 src/main/resources/kotlin/src/main/kotlin/packagename/header/ContentHeader.hbs create mode 100644 src/main/resources/kotlin/src/main/kotlin/packagename/header/Header.hbs create mode 100644 src/main/resources/kotlin/src/main/kotlin/packagename/header/HeaderBase.hbs create mode 100644 src/main/resources/kotlin/src/main/kotlin/packagename/header/PrefixSeparatorIterator.hbs create mode 100644 src/main/resources/kotlin/src/main/kotlin/packagename/header/Rfc6570Serializer.hbs create mode 100644 src/main/resources/kotlin/src/main/kotlin/packagename/header/SchemaHeader.hbs create mode 100644 src/main/resources/kotlin/src/main/kotlin/packagename/header/StyleSerializer.hbs create mode 100644 src/main/resources/kotlin/src/main/kotlin/packagename/mediatype/Encoding.hbs create mode 100644 src/main/resources/kotlin/src/main/kotlin/packagename/mediatype/MediaType.hbs create mode 100644 src/main/resources/kotlin/src/main/kotlin/packagename/parameter/ContentParameter.hbs create mode 100644 src/main/resources/kotlin/src/main/kotlin/packagename/parameter/CookieSerializer.hbs create mode 100644 src/main/resources/kotlin/src/main/kotlin/packagename/parameter/HeadersSerializer.hbs create mode 100644 src/main/resources/kotlin/src/main/kotlin/packagename/parameter/Parameter.hbs create mode 100644 src/main/resources/kotlin/src/main/kotlin/packagename/parameter/ParameterBase.hbs create mode 100644 src/main/resources/kotlin/src/main/kotlin/packagename/parameter/ParameterInType.hbs create mode 100644 src/main/resources/kotlin/src/main/kotlin/packagename/parameter/ParameterStyle.hbs create mode 100644 src/main/resources/kotlin/src/main/kotlin/packagename/parameter/PathSerializer.hbs create mode 100644 src/main/resources/kotlin/src/main/kotlin/packagename/parameter/QuerySerializer.hbs create mode 100644 src/main/resources/kotlin/src/main/kotlin/packagename/parameter/SchemaParameter.hbs create mode 100644 src/main/resources/kotlin/src/main/kotlin/packagename/paths/path/PathItem.hbs create mode 100644 src/main/resources/kotlin/src/main/kotlin/packagename/paths/path/verb/Operation.hbs create mode 100644 src/main/resources/kotlin/src/main/kotlin/packagename/paths/path/verb/OperationDoc.hbs create mode 100644 src/main/resources/kotlin/src/main/kotlin/packagename/paths/path/verb/Parameters.hbs create mode 100644 src/main/resources/kotlin/src/main/kotlin/packagename/paths/path/verb/Responses.hbs create mode 100644 src/main/resources/kotlin/src/main/kotlin/packagename/paths/path/verb/ResponsesDoc.hbs create mode 100644 src/main/resources/kotlin/src/main/kotlin/packagename/paths/path/verb/_FinalRequestClassDoc.hbs create mode 100644 src/main/resources/kotlin/src/main/kotlin/packagename/paths/path/verb/_OperationDocCodeSample.hbs create mode 100644 src/main/resources/kotlin/src/main/kotlin/packagename/paths/path/verb/_OperationDocExcCodeSample.hbs create mode 100644 src/main/resources/kotlin/src/main/kotlin/packagename/paths/path/verb/_OperationDocResBodyCodeSample.hbs create mode 100644 src/main/resources/kotlin/src/main/kotlin/packagename/paths/path/verb/_OperationDocSSCodeSample.hbs create mode 100644 src/main/resources/kotlin/src/main/kotlin/packagename/paths/path/verb/_returnOrThrow.hbs create mode 100644 src/main/resources/kotlin/src/main/kotlin/packagename/paths/path/verb/_statusCodeDeserialization.hbs create mode 100644 src/main/resources/kotlin/src/main/kotlin/packagename/paths/path/verb/_wildcardCodeDeserialization.hbs create mode 100644 src/main/resources/kotlin/src/main/kotlin/packagename/requestbody/GenericRequestBody.hbs create mode 100644 src/main/resources/kotlin/src/main/kotlin/packagename/requestbody/RequestBodySerializer.hbs create mode 100644 src/main/resources/kotlin/src/main/kotlin/packagename/requestbody/SerializedRequestBody.hbs create mode 100644 src/main/resources/kotlin/src/main/kotlin/packagename/response/ApiResponse.hbs create mode 100644 src/main/resources/kotlin/src/main/kotlin/packagename/response/DeserializedHttpResponse.hbs create mode 100644 src/main/resources/kotlin/src/main/kotlin/packagename/response/HeadersDeserializer.hbs create mode 100644 src/main/resources/kotlin/src/main/kotlin/packagename/response/ResponseDeserializer.hbs create mode 100644 src/main/resources/kotlin/src/main/kotlin/packagename/response/ResponsesDeserializer.hbs create mode 100644 src/main/resources/kotlin/src/main/kotlin/packagename/restclient/RestClient.hbs create mode 100644 src/main/resources/kotlin/src/main/kotlin/packagename/schemas/AnyTypeJsonSchema.hbs create mode 100644 src/main/resources/kotlin/src/main/kotlin/packagename/schemas/BooleanJsonSchema.hbs create mode 100644 src/main/resources/kotlin/src/main/kotlin/packagename/schemas/DateJsonSchema.hbs create mode 100644 src/main/resources/kotlin/src/main/kotlin/packagename/schemas/DateTimeJsonSchema.hbs create mode 100644 src/main/resources/kotlin/src/main/kotlin/packagename/schemas/DecimalJsonSchema.hbs create mode 100644 src/main/resources/kotlin/src/main/kotlin/packagename/schemas/DoubleJsonSchema.hbs create mode 100644 src/main/resources/kotlin/src/main/kotlin/packagename/schemas/FloatJsonSchema.hbs create mode 100644 src/main/resources/kotlin/src/main/kotlin/packagename/schemas/GenericBuilder.hbs create mode 100644 src/main/resources/kotlin/src/main/kotlin/packagename/schemas/Int32JsonSchema.hbs create mode 100644 src/main/resources/kotlin/src/main/kotlin/packagename/schemas/Int64JsonSchema.hbs create mode 100644 src/main/resources/kotlin/src/main/kotlin/packagename/schemas/IntJsonSchema.hbs create mode 100644 src/main/resources/kotlin/src/main/kotlin/packagename/schemas/ListJsonSchema.hbs create mode 100644 src/main/resources/kotlin/src/main/kotlin/packagename/schemas/MapJsonSchema.hbs create mode 100644 src/main/resources/kotlin/src/main/kotlin/packagename/schemas/NotAnyTypeJsonSchema.hbs create mode 100644 src/main/resources/kotlin/src/main/kotlin/packagename/schemas/NullJsonSchema.hbs create mode 100644 src/main/resources/kotlin/src/main/kotlin/packagename/schemas/NumberJsonSchema.hbs create mode 100644 src/main/resources/kotlin/src/main/kotlin/packagename/schemas/SetMaker.hbs create mode 100644 src/main/resources/kotlin/src/main/kotlin/packagename/schemas/StringJsonSchema.hbs create mode 100644 src/main/resources/kotlin/src/main/kotlin/packagename/schemas/UnsetAddPropsSetter.hbs create mode 100644 src/main/resources/kotlin/src/main/kotlin/packagename/schemas/UuidJsonSchema.hbs create mode 100644 src/main/resources/kotlin/src/main/kotlin/packagename/schemas/validation/AdditionalPropertiesValidator.hbs create mode 100644 src/main/resources/kotlin/src/main/kotlin/packagename/schemas/validation/AllOfValidator.hbs create mode 100644 src/main/resources/kotlin/src/main/kotlin/packagename/schemas/validation/AnyOfValidator.hbs create mode 100644 src/main/resources/kotlin/src/main/kotlin/packagename/schemas/validation/BigDecimalValidator.hbs create mode 100644 src/main/resources/kotlin/src/main/kotlin/packagename/schemas/validation/BooleanEnumValidator.hbs create mode 100644 src/main/resources/kotlin/src/main/kotlin/packagename/schemas/validation/BooleanSchemaValidator.hbs create mode 100644 src/main/resources/kotlin/src/main/kotlin/packagename/schemas/validation/BooleanValueMethod.hbs create mode 100644 src/main/resources/kotlin/src/main/kotlin/packagename/schemas/validation/ConstValidator.hbs create mode 100644 src/main/resources/kotlin/src/main/kotlin/packagename/schemas/validation/ContainsValidator.hbs create mode 100644 src/main/resources/kotlin/src/main/kotlin/packagename/schemas/validation/CustomIsoparser.hbs create mode 100644 src/main/resources/kotlin/src/main/kotlin/packagename/schemas/validation/DefaultValueMethod.hbs create mode 100644 src/main/resources/kotlin/src/main/kotlin/packagename/schemas/validation/DependentRequiredValidator.hbs create mode 100644 src/main/resources/kotlin/src/main/kotlin/packagename/schemas/validation/DependentSchemasValidator.hbs create mode 100644 src/main/resources/kotlin/src/main/kotlin/packagename/schemas/validation/DoubleEnumValidator.hbs create mode 100644 src/main/resources/kotlin/src/main/kotlin/packagename/schemas/validation/DoubleValueMethod.hbs create mode 100644 src/main/resources/kotlin/src/main/kotlin/packagename/schemas/validation/ElseValidator.hbs create mode 100644 src/main/resources/kotlin/src/main/kotlin/packagename/schemas/validation/EnumValidator.hbs create mode 100644 src/main/resources/kotlin/src/main/kotlin/packagename/schemas/validation/ExclusiveMaximumValidator.hbs create mode 100644 src/main/resources/kotlin/src/main/kotlin/packagename/schemas/validation/ExclusiveMinimumValidator.hbs create mode 100644 src/main/resources/kotlin/src/main/kotlin/packagename/schemas/validation/FloatEnumValidator.hbs create mode 100644 src/main/resources/kotlin/src/main/kotlin/packagename/schemas/validation/FloatValueMethod.hbs create mode 100644 src/main/resources/kotlin/src/main/kotlin/packagename/schemas/validation/FormatValidator.hbs create mode 100644 src/main/resources/kotlin/src/main/kotlin/packagename/schemas/validation/FrozenList.hbs create mode 100644 src/main/resources/kotlin/src/main/kotlin/packagename/schemas/validation/FrozenMap.hbs create mode 100644 src/main/resources/kotlin/src/main/kotlin/packagename/schemas/validation/IfValidator.hbs create mode 100644 src/main/resources/kotlin/src/main/kotlin/packagename/schemas/validation/IntegerEnumValidator.hbs create mode 100644 src/main/resources/kotlin/src/main/kotlin/packagename/schemas/validation/IntegerValueMethod.hbs create mode 100644 src/main/resources/kotlin/src/main/kotlin/packagename/schemas/validation/ItemsValidator.hbs create mode 100644 src/main/resources/kotlin/src/main/kotlin/packagename/schemas/validation/JsonSchema.hbs create mode 100644 src/main/resources/kotlin/src/main/kotlin/packagename/schemas/validation/JsonSchemaFactory.hbs create mode 100644 src/main/resources/kotlin/src/main/kotlin/packagename/schemas/validation/JsonSchemaInfo.hbs create mode 100644 src/main/resources/kotlin/src/main/kotlin/packagename/schemas/validation/KeywordEntry.hbs create mode 100644 src/main/resources/kotlin/src/main/kotlin/packagename/schemas/validation/KeywordValidator.hbs create mode 100644 src/main/resources/kotlin/src/main/kotlin/packagename/schemas/validation/LengthValidator.hbs create mode 100644 src/main/resources/kotlin/src/main/kotlin/packagename/schemas/validation/ListMaker.hbs create mode 100644 src/main/resources/kotlin/src/main/kotlin/packagename/schemas/validation/ListSchemaValidator.hbs create mode 100644 src/main/resources/kotlin/src/main/kotlin/packagename/schemas/validation/LongEnumValidator.hbs create mode 100644 src/main/resources/kotlin/src/main/kotlin/packagename/schemas/validation/LongValueMethod.hbs create mode 100644 src/main/resources/kotlin/src/main/kotlin/packagename/schemas/validation/MapSchemaValidator.hbs create mode 100644 src/main/resources/kotlin/src/main/kotlin/packagename/schemas/validation/MapUtils.hbs create mode 100644 src/main/resources/kotlin/src/main/kotlin/packagename/schemas/validation/MaxContainsValidator.hbs create mode 100644 src/main/resources/kotlin/src/main/kotlin/packagename/schemas/validation/MaxItemsValidator.hbs create mode 100644 src/main/resources/kotlin/src/main/kotlin/packagename/schemas/validation/MaxLengthValidator.hbs create mode 100644 src/main/resources/kotlin/src/main/kotlin/packagename/schemas/validation/MaxPropertiesValidator.hbs create mode 100644 src/main/resources/kotlin/src/main/kotlin/packagename/schemas/validation/MaximumValidator.hbs create mode 100644 src/main/resources/kotlin/src/main/kotlin/packagename/schemas/validation/MinContainsValidator.hbs create mode 100644 src/main/resources/kotlin/src/main/kotlin/packagename/schemas/validation/MinItemsValidator.hbs create mode 100644 src/main/resources/kotlin/src/main/kotlin/packagename/schemas/validation/MinLengthValidator.hbs create mode 100644 src/main/resources/kotlin/src/main/kotlin/packagename/schemas/validation/MinPropertiesValidator.hbs create mode 100644 src/main/resources/kotlin/src/main/kotlin/packagename/schemas/validation/MinimumValidator.hbs create mode 100644 src/main/resources/kotlin/src/main/kotlin/packagename/schemas/validation/MultipleOfValidator.hbs create mode 100644 src/main/resources/kotlin/src/main/kotlin/packagename/schemas/validation/NotValidator.hbs create mode 100644 src/main/resources/kotlin/src/main/kotlin/packagename/schemas/validation/NullEnumValidator.hbs create mode 100644 src/main/resources/kotlin/src/main/kotlin/packagename/schemas/validation/NullSchemaValidator.hbs create mode 100644 src/main/resources/kotlin/src/main/kotlin/packagename/schemas/validation/NullValueMethod.hbs create mode 100644 src/main/resources/kotlin/src/main/kotlin/packagename/schemas/validation/NumberSchemaValidator.hbs create mode 100644 src/main/resources/kotlin/src/main/kotlin/packagename/schemas/validation/OneOfValidator.hbs create mode 100644 src/main/resources/kotlin/src/main/kotlin/packagename/schemas/validation/PathToSchemasMap.hbs create mode 100644 src/main/resources/kotlin/src/main/kotlin/packagename/schemas/validation/PatternPropertiesValidator.hbs create mode 100644 src/main/resources/kotlin/src/main/kotlin/packagename/schemas/validation/PatternValidator.hbs create mode 100644 src/main/resources/kotlin/src/main/kotlin/packagename/schemas/validation/PrefixItemsValidator.hbs create mode 100644 src/main/resources/kotlin/src/main/kotlin/packagename/schemas/validation/PropertiesValidator.hbs create mode 100644 src/main/resources/kotlin/src/main/kotlin/packagename/schemas/validation/PropertyEntry.hbs create mode 100644 src/main/resources/kotlin/src/main/kotlin/packagename/schemas/validation/PropertyNamesValidator.hbs create mode 100644 src/main/resources/kotlin/src/main/kotlin/packagename/schemas/validation/RequiredValidator.hbs create mode 100644 src/main/resources/kotlin/src/main/kotlin/packagename/schemas/validation/StringEnumValidator.hbs create mode 100644 src/main/resources/kotlin/src/main/kotlin/packagename/schemas/validation/StringSchemaValidator.hbs create mode 100644 src/main/resources/kotlin/src/main/kotlin/packagename/schemas/validation/StringValueMethod.hbs create mode 100644 src/main/resources/kotlin/src/main/kotlin/packagename/schemas/validation/ThenValidator.hbs create mode 100644 src/main/resources/kotlin/src/main/kotlin/packagename/schemas/validation/TypeValidator.hbs create mode 100644 src/main/resources/kotlin/src/main/kotlin/packagename/schemas/validation/UnevaluatedItemsValidator.hbs create mode 100644 src/main/resources/kotlin/src/main/kotlin/packagename/schemas/validation/UnevaluatedPropertiesValidator.hbs create mode 100644 src/main/resources/kotlin/src/main/kotlin/packagename/schemas/validation/UniqueItemsValidator.hbs create mode 100644 src/main/resources/kotlin/src/main/kotlin/packagename/schemas/validation/UnsetAnyTypeJsonSchema.hbs create mode 100644 src/main/resources/kotlin/src/main/kotlin/packagename/schemas/validation/ValidationData.hbs create mode 100644 src/main/resources/kotlin/src/main/kotlin/packagename/schemas/validation/ValidationMetadata.hbs create mode 100644 src/main/resources/kotlin/src/main/kotlin/packagename/securityrequirementobjects/AuthApplier.hbs create mode 100644 src/main/resources/kotlin/src/main/kotlin/packagename/securityrequirementobjects/EmptySecurityRequirementObject.hbs create mode 100644 src/main/resources/kotlin/src/main/kotlin/packagename/securityrequirementobjects/SecurityInfo.hbs create mode 100644 src/main/resources/kotlin/src/main/kotlin/packagename/securityrequirementobjects/SecurityInfoDoc.hbs create mode 100644 src/main/resources/kotlin/src/main/kotlin/packagename/securityrequirementobjects/SecurityRequirementObject.hbs create mode 100644 src/main/resources/kotlin/src/main/kotlin/packagename/securityrequirementobjects/SecurityRequirementObjectN.hbs create mode 100644 src/main/resources/kotlin/src/main/kotlin/packagename/securityrequirementobjects/SecurityRequirementObjectNDoc.hbs create mode 100644 src/main/resources/kotlin/src/main/kotlin/packagename/securityrequirementobjects/SecurityRequirementObjectProvider.hbs create mode 100644 src/main/resources/kotlin/src/main/kotlin/packagename/securityrequirementobjects/_SecurityRequirementObjectSetter.hbs create mode 100644 src/main/resources/kotlin/src/main/kotlin/packagename/securityschemes/ApiKeyCookieSecurityScheme.hbs create mode 100644 src/main/resources/kotlin/src/main/kotlin/packagename/securityschemes/ApiKeyHeaderSecurityScheme.hbs create mode 100644 src/main/resources/kotlin/src/main/kotlin/packagename/securityschemes/ApiKeyQuerySecurityScheme.hbs create mode 100644 src/main/resources/kotlin/src/main/kotlin/packagename/securityschemes/HttpBasicSecurityScheme.hbs create mode 100644 src/main/resources/kotlin/src/main/kotlin/packagename/securityschemes/HttpBearerSecurityScheme.hbs create mode 100644 src/main/resources/kotlin/src/main/kotlin/packagename/securityschemes/HttpDigestSecurityScheme.hbs create mode 100644 src/main/resources/kotlin/src/main/kotlin/packagename/securityschemes/HttpSignatureSecurityScheme.hbs create mode 100644 src/main/resources/kotlin/src/main/kotlin/packagename/securityschemes/MutualTlsSecurityScheme.hbs create mode 100644 src/main/resources/kotlin/src/main/kotlin/packagename/securityschemes/OAuth2SecurityScheme.hbs create mode 100644 src/main/resources/kotlin/src/main/kotlin/packagename/securityschemes/OpenIdConnectSecurityScheme.hbs create mode 100644 src/main/resources/kotlin/src/main/kotlin/packagename/securityschemes/SecurityScheme.hbs create mode 100644 src/main/resources/kotlin/src/main/kotlin/packagename/servers/Server.hbs create mode 100644 src/main/resources/kotlin/src/main/kotlin/packagename/servers/ServerDoc.hbs create mode 100644 src/main/resources/kotlin/src/main/kotlin/packagename/servers/ServerInfo.hbs create mode 100644 src/main/resources/kotlin/src/main/kotlin/packagename/servers/ServerInfoDoc.hbs create mode 100644 src/main/resources/kotlin/src/main/kotlin/packagename/servers/ServerN.hbs create mode 100644 src/main/resources/kotlin/src/main/kotlin/packagename/servers/ServerProvider.hbs create mode 100644 src/main/resources/kotlin/src/main/kotlin/packagename/servers/ServerWithVariables.hbs create mode 100644 src/main/resources/kotlin/src/main/kotlin/packagename/servers/ServerWithoutVariables.hbs create mode 100644 src/main/resources/kotlin/src/test/kotlin/packagename/components/schemas/Schema_test.hbs create mode 100644 src/main/resources/kotlin/src/test/kotlin/packagename/configurations/JsonSchemaKeywordFlagsTest.hbs create mode 100644 src/main/resources/kotlin/src/test/kotlin/packagename/header/ContentHeaderTest.hbs create mode 100644 src/main/resources/kotlin/src/test/kotlin/packagename/header/SchemaHeaderTest.hbs create mode 100644 src/main/resources/kotlin/src/test/kotlin/packagename/parameter/CookieSerializerTest.hbs create mode 100644 src/main/resources/kotlin/src/test/kotlin/packagename/parameter/HeadersSerializerTest.hbs create mode 100644 src/main/resources/kotlin/src/test/kotlin/packagename/parameter/PathSerializerTest.hbs create mode 100644 src/main/resources/kotlin/src/test/kotlin/packagename/parameter/QuerySerializerTest.hbs create mode 100644 src/main/resources/kotlin/src/test/kotlin/packagename/parameter/SchemaNonQueryParameterTest.hbs create mode 100644 src/main/resources/kotlin/src/test/kotlin/packagename/parameter/SchemaQueryParameterTest.hbs create mode 100644 src/main/resources/kotlin/src/test/kotlin/packagename/requestbody/RequestBodySerializerTest.hbs create mode 100644 src/main/resources/kotlin/src/test/kotlin/packagename/response/ResponseDeserializerTest.hbs create mode 100644 src/main/resources/kotlin/src/test/kotlin/packagename/schemas/AnyTypeSchemaTest.hbs create mode 100644 src/main/resources/kotlin/src/test/kotlin/packagename/schemas/ArrayTypeSchemaTest.hbs create mode 100644 src/main/resources/kotlin/src/test/kotlin/packagename/schemas/BooleanSchemaTest.hbs create mode 100644 src/main/resources/kotlin/src/test/kotlin/packagename/schemas/ListBuilderTest.hbs create mode 100644 src/main/resources/kotlin/src/test/kotlin/packagename/schemas/ListSchemaTest.hbs create mode 100644 src/main/resources/kotlin/src/test/kotlin/packagename/schemas/MapSchemaTest.hbs create mode 100644 src/main/resources/kotlin/src/test/kotlin/packagename/schemas/NullSchemaTest.hbs create mode 100644 src/main/resources/kotlin/src/test/kotlin/packagename/schemas/NumberSchemaTest.hbs create mode 100644 src/main/resources/kotlin/src/test/kotlin/packagename/schemas/ObjectTypeSchemaTest.hbs create mode 100644 src/main/resources/kotlin/src/test/kotlin/packagename/schemas/RefBooleanSchemaTest.hbs create mode 100644 src/main/resources/kotlin/src/test/kotlin/packagename/schemas/validation/AdditionalPropertiesValidatorTest.hbs create mode 100644 src/main/resources/kotlin/src/test/kotlin/packagename/schemas/validation/CustomIsoparserTest.hbs create mode 100644 src/main/resources/kotlin/src/test/kotlin/packagename/schemas/validation/FormatValidatorTest.hbs create mode 100644 src/main/resources/kotlin/src/test/kotlin/packagename/schemas/validation/ItemsValidatorTest.hbs create mode 100644 src/main/resources/kotlin/src/test/kotlin/packagename/schemas/validation/JsonSchemaTest.hbs create mode 100644 src/main/resources/kotlin/src/test/kotlin/packagename/schemas/validation/PropertiesValidatorTest.hbs create mode 100644 src/main/resources/kotlin/src/test/kotlin/packagename/schemas/validation/RequiredValidatorTest.hbs create mode 100644 src/main/resources/kotlin/src/test/kotlin/packagename/schemas/validation/TypeValidatorTest.hbs diff --git a/samples/client/petstore/kotlin/.gitignore b/samples/client/petstore/kotlin/.gitignore new file mode 100644 index 00000000000..3a4ec036d04 --- /dev/null +++ b/samples/client/petstore/kotlin/.gitignore @@ -0,0 +1,9 @@ +build/ +.gradle/ +.idea/ +target/ + +# gradle wrapper +gradlew +gradlew.bat +gradle/ \ No newline at end of file diff --git a/samples/client/petstore/kotlin/.openapi-generator-ignore b/samples/client/petstore/kotlin/.openapi-generator-ignore new file mode 100644 index 00000000000..d24a2da8ae5 --- /dev/null +++ b/samples/client/petstore/kotlin/.openapi-generator-ignore @@ -0,0 +1,23 @@ +# OpenAPI Generator Ignore +# Generated by openapi-generator https://github.com/openapi-json-schema-tools/openapi-json-schema-generator + +# Use this file to prevent files from being overwritten by the generator. +# The patterns follow closely to .gitignore or .dockerignore. + +# As an example, the C# client generator defines ApiClient.cs. +# You can make changes and tell OpenAPI Generator to ignore just this file by uncommenting the following line: +#ApiClient.cs + +# You can match any string of characters against a directory, file or extension with a single asterisk (*): +#foo/*/qux +# The above matches foo/bar/qux and foo/baz/qux, but not foo/bar/baz/qux + +# You can recursively match patterns against a directory, file or extension with a double asterisk (**): +#foo/**/qux +# This matches foo/bar/qux, foo/baz/qux, and foo/bar/baz/qux + +# You can also negate patterns with an exclamation (!). +# For example, you can ignore all files in a docs folder with the file extension .md: +#docs/*.md +# Then explicitly reverse the ignore rule for a single file: +#!docs/README.md diff --git a/samples/client/petstore/kotlin/.openapi-generator/FILES b/samples/client/petstore/kotlin/.openapi-generator/FILES new file mode 100644 index 00000000000..d5b741b2d06 --- /dev/null +++ b/samples/client/petstore/kotlin/.openapi-generator/FILES @@ -0,0 +1,2000 @@ +.gitignore +.openapi-generator-ignore +README.md +build.gradle.kts +docs/RootServerInfo.md +docs/apis/paths/Anotherfakedummy.md +docs/apis/paths/Commonparamsubdir.md +docs/apis/paths/Fake.md +docs/apis/paths/Fakeadditionalpropertieswitharrayofenums.md +docs/apis/paths/Fakebodywithfileschema.md +docs/apis/paths/Fakebodywithqueryparams.md +docs/apis/paths/Fakecasesensitiveparams.md +docs/apis/paths/Fakeclassnametest.md +docs/apis/paths/Fakedeletecoffeeid.md +docs/apis/paths/Fakehealth.md +docs/apis/paths/Fakeinlineadditionalproperties.md +docs/apis/paths/Fakeinlinecomposition.md +docs/apis/paths/Fakejsonformdata.md +docs/apis/paths/Fakejsonpatch.md +docs/apis/paths/Fakejsonwithcharset.md +docs/apis/paths/Fakemultiplerequestbodycontenttypes.md +docs/apis/paths/Fakemultipleresponsebodies.md +docs/apis/paths/Fakemultiplesecurities.md +docs/apis/paths/Fakeobjinquery.md +docs/apis/paths/Fakeparametercollisions1ababselfab.md +docs/apis/paths/Fakepemcontenttype.md +docs/apis/paths/Fakepetiduploadimagewithrequiredfile.md +docs/apis/paths/Fakequeryparamwithjsoncontenttype.md +docs/apis/paths/Fakeredirection.md +docs/apis/paths/Fakerefobjinquery.md +docs/apis/paths/Fakerefsarraymodel.md +docs/apis/paths/Fakerefsarrayofenums.md +docs/apis/paths/Fakerefsboolean.md +docs/apis/paths/Fakerefscomposedoneofnumberwithvalidations.md +docs/apis/paths/Fakerefsenum.md +docs/apis/paths/Fakerefsmammal.md +docs/apis/paths/Fakerefsnumber.md +docs/apis/paths/Fakerefsobjectmodelwithrefprops.md +docs/apis/paths/Fakerefsstring.md +docs/apis/paths/Fakeresponsewithoutschema.md +docs/apis/paths/Faketestqueryparamters.md +docs/apis/paths/Fakeuploaddownloadfile.md +docs/apis/paths/Fakeuploadfile.md +docs/apis/paths/Fakeuploadfiles.md +docs/apis/paths/Fakewildcardresponses.md +docs/apis/paths/Foo.md +docs/apis/paths/Pet.md +docs/apis/paths/Petfindbystatus.md +docs/apis/paths/Petfindbytags.md +docs/apis/paths/Petpetid.md +docs/apis/paths/Petpetiduploadimage.md +docs/apis/paths/Solidus.md +docs/apis/paths/Storeinventory.md +docs/apis/paths/Storeorder.md +docs/apis/paths/Storeorderorderid.md +docs/apis/paths/User.md +docs/apis/paths/Usercreatewitharray.md +docs/apis/paths/Usercreatewithlist.md +docs/apis/paths/Userlogin.md +docs/apis/paths/Userlogout.md +docs/apis/paths/Userusername.md +docs/apis/tags/Anotherfake.md +docs/apis/tags/Default.md +docs/apis/tags/Fake.md +docs/apis/tags/Fakeclassnametags123.md +docs/apis/tags/Pet.md +docs/apis/tags/Store.md +docs/apis/tags/User.md +docs/components/headers/Int32JsonContentTypeHeader.md +docs/components/headers/NumberHeader.md +docs/components/headers/RefContentSchemaHeader.md +docs/components/headers/RefSchemaHeader.md +docs/components/headers/RefStringHeader.md +docs/components/headers/StringHeader.md +docs/components/headers/int32jsoncontenttypeheader/content/applicationjson/Int32JsonContentTypeHeaderSchema.md +docs/components/headers/numberheader/NumberHeaderSchema.md +docs/components/headers/refcontentschemaheader/content/applicationjson/RefContentSchemaHeaderSchema.md +docs/components/headers/refschemaheader/RefSchemaHeaderSchema.md +docs/components/headers/stringheader/StringHeaderSchema.md +docs/components/parameters/ComponentRefSchemaStringWithValidation.md +docs/components/parameters/PathUserName.md +docs/components/parameters/RefPathUserName.md +docs/components/parameters/RefSchemaStringWithValidation.md +docs/components/parameters/componentrefschemastringwithvalidation/content/applicationjson/ApplicationjsonSchema.md +docs/components/parameters/pathusername/Schema.md +docs/components/parameters/refschemastringwithvalidation/Schema.md +docs/components/requestbodies/Client.md +docs/components/requestbodies/Pet.md +docs/components/requestbodies/RefUserArray.md +docs/components/requestbodies/UserArray.md +docs/components/requestbodies/client/content/applicationjson/ApplicationjsonSchema.md +docs/components/requestbodies/pet/content/applicationjson/ApplicationjsonSchema.md +docs/components/requestbodies/pet/content/applicationxml/ApplicationxmlSchema.md +docs/components/requestbodies/userarray/content/applicationjson/ApplicationjsonSchema.md +docs/components/responses/HeadersWithNoBody.md +docs/components/responses/RefSuccessDescriptionOnly.md +docs/components/responses/RefSuccessfulXmlAndJsonArrayOfPet.md +docs/components/responses/SuccessDescriptionOnly.md +docs/components/responses/SuccessInlineContentAndHeader.md +docs/components/responses/SuccessWithJsonApiResponse.md +docs/components/responses/SuccessfulXmlAndJsonArrayOfPet.md +docs/components/responses/headerswithnobody/HeadersWithNoBodyHeadersSchema.md +docs/components/responses/headerswithnobody/headers/location/LocationSchema.md +docs/components/responses/successfulxmlandjsonarrayofpet/content/applicationjson/ApplicationjsonSchema.md +docs/components/responses/successfulxmlandjsonarrayofpet/content/applicationxml/ApplicationxmlSchema.md +docs/components/responses/successinlinecontentandheader/SuccessInlineContentAndHeaderHeadersSchema.md +docs/components/responses/successinlinecontentandheader/content/applicationjson/ApplicationjsonSchema.md +docs/components/responses/successinlinecontentandheader/headers/someheader/SomeHeaderSchema.md +docs/components/responses/successwithjsonapiresponse/SuccessWithJsonApiResponseHeadersSchema.md +docs/components/responses/successwithjsonapiresponse/content/applicationjson/ApplicationjsonSchema.md +docs/components/schemas/AbstractStepMessage.md +docs/components/schemas/AdditionalPropertiesClass.md +docs/components/schemas/AdditionalPropertiesSchema.md +docs/components/schemas/AdditionalPropertiesWithArrayOfEnums.md +docs/components/schemas/Address.md +docs/components/schemas/Animal.md +docs/components/schemas/AnimalFarm.md +docs/components/schemas/AnyTypeAndFormat.md +docs/components/schemas/AnyTypeNotString.md +docs/components/schemas/ApiResponseSchema.md +docs/components/schemas/Apple.md +docs/components/schemas/AppleReq.md +docs/components/schemas/ArrayHoldingAnyType.md +docs/components/schemas/ArrayOfArrayOfNumberOnly.md +docs/components/schemas/ArrayOfEnums.md +docs/components/schemas/ArrayOfNumberOnly.md +docs/components/schemas/ArrayTest.md +docs/components/schemas/ArrayWithValidationsInItems.md +docs/components/schemas/Banana.md +docs/components/schemas/BananaReq.md +docs/components/schemas/Bar.md +docs/components/schemas/BasquePig.md +docs/components/schemas/BooleanEnum.md +docs/components/schemas/BooleanSchema.md +docs/components/schemas/Capitalization.md +docs/components/schemas/Cat.md +docs/components/schemas/Category.md +docs/components/schemas/ChildCat.md +docs/components/schemas/ClassModel.md +docs/components/schemas/Client.md +docs/components/schemas/ComplexQuadrilateral.md +docs/components/schemas/ComposedAnyOfDifferentTypesNoValidations.md +docs/components/schemas/ComposedArray.md +docs/components/schemas/ComposedBool.md +docs/components/schemas/ComposedNone.md +docs/components/schemas/ComposedNumber.md +docs/components/schemas/ComposedObject.md +docs/components/schemas/ComposedOneOfDifferentTypes.md +docs/components/schemas/ComposedString.md +docs/components/schemas/Currency.md +docs/components/schemas/DanishPig.md +docs/components/schemas/DateTimeTest.md +docs/components/schemas/DateTimeWithValidations.md +docs/components/schemas/DateWithValidations.md +docs/components/schemas/DecimalPayload.md +docs/components/schemas/Dog.md +docs/components/schemas/Drawing.md +docs/components/schemas/EnumArrays.md +docs/components/schemas/EnumClass.md +docs/components/schemas/EnumTest.md +docs/components/schemas/EquilateralTriangle.md +docs/components/schemas/File.md +docs/components/schemas/FileSchemaTestClass.md +docs/components/schemas/Foo.md +docs/components/schemas/FormatTest.md +docs/components/schemas/FromSchema.md +docs/components/schemas/Fruit.md +docs/components/schemas/FruitReq.md +docs/components/schemas/GmFruit.md +docs/components/schemas/GrandparentAnimal.md +docs/components/schemas/HasOnlyReadOnly.md +docs/components/schemas/HealthCheckResult.md +docs/components/schemas/IntegerEnum.md +docs/components/schemas/IntegerEnumBig.md +docs/components/schemas/IntegerEnumOneValue.md +docs/components/schemas/IntegerEnumWithDefaultValue.md +docs/components/schemas/IntegerMax10.md +docs/components/schemas/IntegerMin15.md +docs/components/schemas/IsoscelesTriangle.md +docs/components/schemas/Items.md +docs/components/schemas/ItemsSchema.md +docs/components/schemas/JSONPatchRequest.md +docs/components/schemas/JSONPatchRequestAddReplaceTest.md +docs/components/schemas/JSONPatchRequestMoveCopy.md +docs/components/schemas/JSONPatchRequestRemove.md +docs/components/schemas/Mammal.md +docs/components/schemas/MapTest.md +docs/components/schemas/MixedPropertiesAndAdditionalPropertiesClass.md +docs/components/schemas/Money.md +docs/components/schemas/MultiPropertiesSchema.md +docs/components/schemas/MyObjectDto.md +docs/components/schemas/Name.md +docs/components/schemas/NoAdditionalProperties.md +docs/components/schemas/NullableClass.md +docs/components/schemas/NullableShape.md +docs/components/schemas/NullableString.md +docs/components/schemas/NumberOnly.md +docs/components/schemas/NumberSchema.md +docs/components/schemas/NumberWithExclusiveMinMax.md +docs/components/schemas/NumberWithValidations.md +docs/components/schemas/ObjWithRequiredProps.md +docs/components/schemas/ObjWithRequiredPropsBase.md +docs/components/schemas/ObjectInterface.md +docs/components/schemas/ObjectModelWithArgAndArgsProperties.md +docs/components/schemas/ObjectModelWithRefProps.md +docs/components/schemas/ObjectWithAllOfWithReqTestPropFromUnsetAddProp.md +docs/components/schemas/ObjectWithCollidingProperties.md +docs/components/schemas/ObjectWithDecimalProperties.md +docs/components/schemas/ObjectWithDifficultlyNamedProps.md +docs/components/schemas/ObjectWithInlineCompositionProperty.md +docs/components/schemas/ObjectWithInvalidNamedRefedProperties.md +docs/components/schemas/ObjectWithNonIntersectingValues.md +docs/components/schemas/ObjectWithOnlyOptionalProps.md +docs/components/schemas/ObjectWithOptionalTestProp.md +docs/components/schemas/ObjectWithValidations.md +docs/components/schemas/Order.md +docs/components/schemas/PaginatedResultMyObjectDto.md +docs/components/schemas/ParentPet.md +docs/components/schemas/Pet.md +docs/components/schemas/Pig.md +docs/components/schemas/Player.md +docs/components/schemas/PublicKey.md +docs/components/schemas/Quadrilateral.md +docs/components/schemas/QuadrilateralInterface.md +docs/components/schemas/ReadOnlyFirst.md +docs/components/schemas/RefPet.md +docs/components/schemas/ReqPropsFromExplicitAddProps.md +docs/components/schemas/ReqPropsFromTrueAddProps.md +docs/components/schemas/ReqPropsFromUnsetAddProps.md +docs/components/schemas/ReturnSchema.md +docs/components/schemas/ScaleneTriangle.md +docs/components/schemas/Schema200Response.md +docs/components/schemas/SelfReferencingArrayModel.md +docs/components/schemas/SelfReferencingObjectModel.md +docs/components/schemas/Shape.md +docs/components/schemas/ShapeOrNull.md +docs/components/schemas/SimpleQuadrilateral.md +docs/components/schemas/SomeObject.md +docs/components/schemas/SpecialModelname.md +docs/components/schemas/StringBooleanMap.md +docs/components/schemas/StringEnum.md +docs/components/schemas/StringEnumWithDefaultValue.md +docs/components/schemas/StringSchema.md +docs/components/schemas/StringWithValidation.md +docs/components/schemas/Tag.md +docs/components/schemas/Triangle.md +docs/components/schemas/TriangleInterface.md +docs/components/schemas/UUIDString.md +docs/components/schemas/User.md +docs/components/schemas/Whale.md +docs/components/schemas/Zebra.md +docs/components/securityschemes/ApiKey.md +docs/components/securityschemes/ApiKeyQuery.md +docs/components/securityschemes/BearerTest.md +docs/components/securityschemes/HttpBasicTest.md +docs/components/securityschemes/HttpSignatureTest.md +docs/components/securityschemes/OpenIdConnectTest.md +docs/components/securityschemes/PetstoreAuth.md +docs/paths/anotherfakedummy/AnotherfakedummyPatch.md +docs/paths/anotherfakedummy/patch/AnotherfakedummyPatchRequestBody.md +docs/paths/anotherfakedummy/patch/AnotherfakedummyPatchResponses.md +docs/paths/anotherfakedummy/patch/responses/AnotherfakedummyPatchCode200Response.md +docs/paths/anotherfakedummy/patch/responses/code200response/content/applicationjson/ApplicationjsonSchema.md +docs/paths/commonparamsubdir/CommonparamsubdirDelete.md +docs/paths/commonparamsubdir/CommonparamsubdirGet.md +docs/paths/commonparamsubdir/CommonparamsubdirPost.md +docs/paths/commonparamsubdir/delete/CommonparamsubdirDeleteHeaderParameters.md +docs/paths/commonparamsubdir/delete/CommonparamsubdirDeletePathParameters.md +docs/paths/commonparamsubdir/delete/CommonparamsubdirDeleteResponses.md +docs/paths/commonparamsubdir/delete/parameters/parameter0/Schema0.md +docs/paths/commonparamsubdir/delete/parameters/parameter1/Schema1.md +docs/paths/commonparamsubdir/delete/responses/CommonparamsubdirDeleteCode200Response.md +docs/paths/commonparamsubdir/get/CommonparamsubdirGetPathParameters.md +docs/paths/commonparamsubdir/get/CommonparamsubdirGetQueryParameters.md +docs/paths/commonparamsubdir/get/CommonparamsubdirGetResponses.md +docs/paths/commonparamsubdir/get/parameters/parameter0/Schema0.md +docs/paths/commonparamsubdir/get/responses/CommonparamsubdirGetCode200Response.md +docs/paths/commonparamsubdir/parameters/routeparameter0/RouteParamSchema0.md +docs/paths/commonparamsubdir/post/CommonparamsubdirPostHeaderParameters.md +docs/paths/commonparamsubdir/post/CommonparamsubdirPostPathParameters.md +docs/paths/commonparamsubdir/post/CommonparamsubdirPostResponses.md +docs/paths/commonparamsubdir/post/parameters/parameter0/Schema0.md +docs/paths/commonparamsubdir/post/responses/CommonparamsubdirPostCode200Response.md +docs/paths/fake/FakeDelete.md +docs/paths/fake/FakeGet.md +docs/paths/fake/FakePatch.md +docs/paths/fake/FakePost.md +docs/paths/fake/delete/FakeDeleteHeaderParameters.md +docs/paths/fake/delete/FakeDeleteQueryParameters.md +docs/paths/fake/delete/FakeDeleteResponses.md +docs/paths/fake/delete/FakeDeleteSecurityInfo.md +docs/paths/fake/delete/parameters/parameter0/Schema0.md +docs/paths/fake/delete/parameters/parameter1/Schema1.md +docs/paths/fake/delete/parameters/parameter2/Schema2.md +docs/paths/fake/delete/parameters/parameter3/Schema3.md +docs/paths/fake/delete/parameters/parameter4/Schema4.md +docs/paths/fake/delete/parameters/parameter5/Schema5.md +docs/paths/fake/delete/responses/FakeDeleteCode200Response.md +docs/paths/fake/delete/security/FakeDeleteSecurityRequirementObject0.md +docs/paths/fake/get/FakeGetHeaderParameters.md +docs/paths/fake/get/FakeGetQueryParameters.md +docs/paths/fake/get/FakeGetRequestBody.md +docs/paths/fake/get/FakeGetResponses.md +docs/paths/fake/get/parameters/parameter0/Schema0.md +docs/paths/fake/get/parameters/parameter1/Schema1.md +docs/paths/fake/get/parameters/parameter2/Schema2.md +docs/paths/fake/get/parameters/parameter3/Schema3.md +docs/paths/fake/get/parameters/parameter4/Schema4.md +docs/paths/fake/get/parameters/parameter5/Schema5.md +docs/paths/fake/get/requestbody/content/applicationxwwwformurlencoded/ApplicationxwwwformurlencodedSchema.md +docs/paths/fake/get/responses/FakeGetCode200Response.md +docs/paths/fake/get/responses/FakeGetCode404Response.md +docs/paths/fake/get/responses/code404response/content/applicationjson/ApplicationjsonSchema.md +docs/paths/fake/patch/FakePatchRequestBody.md +docs/paths/fake/patch/FakePatchResponses.md +docs/paths/fake/patch/responses/FakePatchCode200Response.md +docs/paths/fake/patch/responses/code200response/content/applicationjson/ApplicationjsonSchema.md +docs/paths/fake/post/FakePostRequestBody.md +docs/paths/fake/post/FakePostResponses.md +docs/paths/fake/post/FakePostSecurityInfo.md +docs/paths/fake/post/requestbody/content/applicationxwwwformurlencoded/ApplicationxwwwformurlencodedSchema.md +docs/paths/fake/post/responses/FakePostCode200Response.md +docs/paths/fake/post/responses/FakePostCode404Response.md +docs/paths/fake/post/security/FakePostSecurityRequirementObject0.md +docs/paths/fakeadditionalpropertieswitharrayofenums/FakeadditionalpropertieswitharrayofenumsGet.md +docs/paths/fakeadditionalpropertieswitharrayofenums/get/FakeadditionalpropertieswitharrayofenumsGetRequestBody.md +docs/paths/fakeadditionalpropertieswitharrayofenums/get/FakeadditionalpropertieswitharrayofenumsGetResponses.md +docs/paths/fakeadditionalpropertieswitharrayofenums/get/requestbody/content/applicationjson/ApplicationjsonSchema.md +docs/paths/fakeadditionalpropertieswitharrayofenums/get/responses/FakeadditionalpropertieswitharrayofenumsGetCode200Response.md +docs/paths/fakeadditionalpropertieswitharrayofenums/get/responses/code200response/content/applicationjson/ApplicationjsonSchema.md +docs/paths/fakebodywithfileschema/FakebodywithfileschemaPut.md +docs/paths/fakebodywithfileschema/put/FakebodywithfileschemaPutRequestBody.md +docs/paths/fakebodywithfileschema/put/FakebodywithfileschemaPutResponses.md +docs/paths/fakebodywithfileschema/put/requestbody/content/applicationjson/ApplicationjsonSchema.md +docs/paths/fakebodywithfileschema/put/responses/FakebodywithfileschemaPutCode200Response.md +docs/paths/fakebodywithqueryparams/FakebodywithqueryparamsPut.md +docs/paths/fakebodywithqueryparams/put/FakebodywithqueryparamsPutQueryParameters.md +docs/paths/fakebodywithqueryparams/put/FakebodywithqueryparamsPutRequestBody.md +docs/paths/fakebodywithqueryparams/put/FakebodywithqueryparamsPutResponses.md +docs/paths/fakebodywithqueryparams/put/parameters/parameter0/Schema0.md +docs/paths/fakebodywithqueryparams/put/requestbody/content/applicationjson/ApplicationjsonSchema.md +docs/paths/fakebodywithqueryparams/put/responses/FakebodywithqueryparamsPutCode200Response.md +docs/paths/fakecasesensitiveparams/FakecasesensitiveparamsPut.md +docs/paths/fakecasesensitiveparams/put/FakecasesensitiveparamsPutQueryParameters.md +docs/paths/fakecasesensitiveparams/put/FakecasesensitiveparamsPutResponses.md +docs/paths/fakecasesensitiveparams/put/parameters/parameter0/Schema0.md +docs/paths/fakecasesensitiveparams/put/parameters/parameter1/Schema1.md +docs/paths/fakecasesensitiveparams/put/parameters/parameter2/Schema2.md +docs/paths/fakecasesensitiveparams/put/responses/FakecasesensitiveparamsPutCode200Response.md +docs/paths/fakeclassnametest/FakeclassnametestPatch.md +docs/paths/fakeclassnametest/patch/FakeclassnametestPatchRequestBody.md +docs/paths/fakeclassnametest/patch/FakeclassnametestPatchResponses.md +docs/paths/fakeclassnametest/patch/FakeclassnametestPatchSecurityInfo.md +docs/paths/fakeclassnametest/patch/responses/FakeclassnametestPatchCode200Response.md +docs/paths/fakeclassnametest/patch/responses/code200response/content/applicationjson/ApplicationjsonSchema.md +docs/paths/fakeclassnametest/patch/security/FakeclassnametestPatchSecurityRequirementObject0.md +docs/paths/fakedeletecoffeeid/FakedeletecoffeeidDelete.md +docs/paths/fakedeletecoffeeid/delete/FakedeletecoffeeidDeletePathParameters.md +docs/paths/fakedeletecoffeeid/delete/FakedeletecoffeeidDeleteResponses.md +docs/paths/fakedeletecoffeeid/delete/parameters/parameter0/Schema0.md +docs/paths/fakedeletecoffeeid/delete/responses/FakedeletecoffeeidDeleteCode200Response.md +docs/paths/fakedeletecoffeeid/delete/responses/FakedeletecoffeeidDeleteCodedefaultResponse.md +docs/paths/fakehealth/FakehealthGet.md +docs/paths/fakehealth/get/FakehealthGetResponses.md +docs/paths/fakehealth/get/responses/FakehealthGetCode200Response.md +docs/paths/fakehealth/get/responses/code200response/content/applicationjson/ApplicationjsonSchema.md +docs/paths/fakeinlineadditionalproperties/FakeinlineadditionalpropertiesPost.md +docs/paths/fakeinlineadditionalproperties/post/FakeinlineadditionalpropertiesPostRequestBody.md +docs/paths/fakeinlineadditionalproperties/post/FakeinlineadditionalpropertiesPostResponses.md +docs/paths/fakeinlineadditionalproperties/post/requestbody/content/applicationjson/ApplicationjsonSchema.md +docs/paths/fakeinlineadditionalproperties/post/responses/FakeinlineadditionalpropertiesPostCode200Response.md +docs/paths/fakeinlinecomposition/FakeinlinecompositionPost.md +docs/paths/fakeinlinecomposition/post/FakeinlinecompositionPostQueryParameters.md +docs/paths/fakeinlinecomposition/post/FakeinlinecompositionPostRequestBody.md +docs/paths/fakeinlinecomposition/post/FakeinlinecompositionPostResponses.md +docs/paths/fakeinlinecomposition/post/parameters/parameter0/Schema0.md +docs/paths/fakeinlinecomposition/post/parameters/parameter1/Schema1.md +docs/paths/fakeinlinecomposition/post/requestbody/content/applicationjson/ApplicationjsonSchema.md +docs/paths/fakeinlinecomposition/post/requestbody/content/multipartformdata/MultipartformdataSchema.md +docs/paths/fakeinlinecomposition/post/responses/FakeinlinecompositionPostCode200Response.md +docs/paths/fakeinlinecomposition/post/responses/code200response/content/applicationjson/ApplicationjsonSchema.md +docs/paths/fakeinlinecomposition/post/responses/code200response/content/multipartformdata/MultipartformdataSchema.md +docs/paths/fakejsonformdata/FakejsonformdataGet.md +docs/paths/fakejsonformdata/get/FakejsonformdataGetRequestBody.md +docs/paths/fakejsonformdata/get/FakejsonformdataGetResponses.md +docs/paths/fakejsonformdata/get/requestbody/content/applicationxwwwformurlencoded/ApplicationxwwwformurlencodedSchema.md +docs/paths/fakejsonformdata/get/responses/FakejsonformdataGetCode200Response.md +docs/paths/fakejsonpatch/FakejsonpatchPatch.md +docs/paths/fakejsonpatch/patch/FakejsonpatchPatchRequestBody.md +docs/paths/fakejsonpatch/patch/FakejsonpatchPatchResponses.md +docs/paths/fakejsonpatch/patch/requestbody/content/applicationjsonpatchjson/ApplicationjsonpatchjsonSchema.md +docs/paths/fakejsonpatch/patch/responses/FakejsonpatchPatchCode200Response.md +docs/paths/fakejsonwithcharset/FakejsonwithcharsetPost.md +docs/paths/fakejsonwithcharset/post/FakejsonwithcharsetPostRequestBody.md +docs/paths/fakejsonwithcharset/post/FakejsonwithcharsetPostResponses.md +docs/paths/fakejsonwithcharset/post/requestbody/content/applicationjsoncharsetutf8/Applicationjsoncharsetutf8Schema.md +docs/paths/fakejsonwithcharset/post/responses/FakejsonwithcharsetPostCode200Response.md +docs/paths/fakejsonwithcharset/post/responses/code200response/content/applicationjsoncharsetutf8/Applicationjsoncharsetutf8Schema.md +docs/paths/fakemultiplerequestbodycontenttypes/FakemultiplerequestbodycontenttypesPost.md +docs/paths/fakemultiplerequestbodycontenttypes/post/FakemultiplerequestbodycontenttypesPostRequestBody.md +docs/paths/fakemultiplerequestbodycontenttypes/post/FakemultiplerequestbodycontenttypesPostResponses.md +docs/paths/fakemultiplerequestbodycontenttypes/post/requestbody/content/applicationjson/ApplicationjsonSchema.md +docs/paths/fakemultiplerequestbodycontenttypes/post/requestbody/content/multipartformdata/MultipartformdataSchema.md +docs/paths/fakemultiplerequestbodycontenttypes/post/responses/FakemultiplerequestbodycontenttypesPostCode200Response.md +docs/paths/fakemultiplerequestbodycontenttypes/post/responses/code200response/content/applicationjson/ApplicationjsonSchema.md +docs/paths/fakemultipleresponsebodies/FakemultipleresponsebodiesGet.md +docs/paths/fakemultipleresponsebodies/get/FakemultipleresponsebodiesGetResponses.md +docs/paths/fakemultipleresponsebodies/get/responses/FakemultipleresponsebodiesGetCode200Response.md +docs/paths/fakemultipleresponsebodies/get/responses/FakemultipleresponsebodiesGetCode202Response.md +docs/paths/fakemultipleresponsebodies/get/responses/code200response/content/applicationjson/ApplicationjsonSchema.md +docs/paths/fakemultipleresponsebodies/get/responses/code202response/content/applicationjson/ApplicationjsonSchema.md +docs/paths/fakemultiplesecurities/FakemultiplesecuritiesGet.md +docs/paths/fakemultiplesecurities/get/FakemultiplesecuritiesGetResponses.md +docs/paths/fakemultiplesecurities/get/FakemultiplesecuritiesGetSecurityInfo.md +docs/paths/fakemultiplesecurities/get/responses/FakemultiplesecuritiesGetCode200Response.md +docs/paths/fakemultiplesecurities/get/responses/code200response/content/applicationjson/ApplicationjsonSchema.md +docs/paths/fakemultiplesecurities/get/security/FakemultiplesecuritiesGetSecurityRequirementObject0.md +docs/paths/fakemultiplesecurities/get/security/FakemultiplesecuritiesGetSecurityRequirementObject1.md +docs/paths/fakemultiplesecurities/get/security/FakemultiplesecuritiesGetSecurityRequirementObject2.md +docs/paths/fakeobjinquery/FakeobjinqueryGet.md +docs/paths/fakeobjinquery/get/FakeobjinqueryGetQueryParameters.md +docs/paths/fakeobjinquery/get/FakeobjinqueryGetResponses.md +docs/paths/fakeobjinquery/get/parameters/parameter0/Schema0.md +docs/paths/fakeobjinquery/get/responses/FakeobjinqueryGetCode200Response.md +docs/paths/fakeparametercollisions1ababselfab/Fakeparametercollisions1ababselfabPost.md +docs/paths/fakeparametercollisions1ababselfab/post/Fakeparametercollisions1ababselfabPostCookieParameters.md +docs/paths/fakeparametercollisions1ababselfab/post/Fakeparametercollisions1ababselfabPostHeaderParameters.md +docs/paths/fakeparametercollisions1ababselfab/post/Fakeparametercollisions1ababselfabPostPathParameters.md +docs/paths/fakeparametercollisions1ababselfab/post/Fakeparametercollisions1ababselfabPostQueryParameters.md +docs/paths/fakeparametercollisions1ababselfab/post/Fakeparametercollisions1ababselfabPostRequestBody.md +docs/paths/fakeparametercollisions1ababselfab/post/Fakeparametercollisions1ababselfabPostResponses.md +docs/paths/fakeparametercollisions1ababselfab/post/parameters/parameter0/Schema0.md +docs/paths/fakeparametercollisions1ababselfab/post/parameters/parameter1/Schema1.md +docs/paths/fakeparametercollisions1ababselfab/post/parameters/parameter10/Schema10.md +docs/paths/fakeparametercollisions1ababselfab/post/parameters/parameter11/Schema11.md +docs/paths/fakeparametercollisions1ababselfab/post/parameters/parameter12/Schema12.md +docs/paths/fakeparametercollisions1ababselfab/post/parameters/parameter13/Schema13.md +docs/paths/fakeparametercollisions1ababselfab/post/parameters/parameter14/Schema14.md +docs/paths/fakeparametercollisions1ababselfab/post/parameters/parameter15/Schema15.md +docs/paths/fakeparametercollisions1ababselfab/post/parameters/parameter16/Schema16.md +docs/paths/fakeparametercollisions1ababselfab/post/parameters/parameter17/Schema17.md +docs/paths/fakeparametercollisions1ababselfab/post/parameters/parameter18/Schema18.md +docs/paths/fakeparametercollisions1ababselfab/post/parameters/parameter2/Schema2.md +docs/paths/fakeparametercollisions1ababselfab/post/parameters/parameter3/Schema3.md +docs/paths/fakeparametercollisions1ababselfab/post/parameters/parameter4/Schema4.md +docs/paths/fakeparametercollisions1ababselfab/post/parameters/parameter5/Schema5.md +docs/paths/fakeparametercollisions1ababselfab/post/parameters/parameter6/Schema6.md +docs/paths/fakeparametercollisions1ababselfab/post/parameters/parameter7/Schema7.md +docs/paths/fakeparametercollisions1ababselfab/post/parameters/parameter8/Schema8.md +docs/paths/fakeparametercollisions1ababselfab/post/parameters/parameter9/Schema9.md +docs/paths/fakeparametercollisions1ababselfab/post/requestbody/content/applicationjson/ApplicationjsonSchema.md +docs/paths/fakeparametercollisions1ababselfab/post/responses/Fakeparametercollisions1ababselfabPostCode200Response.md +docs/paths/fakeparametercollisions1ababselfab/post/responses/code200response/content/applicationjson/ApplicationjsonSchema.md +docs/paths/fakepemcontenttype/FakepemcontenttypeGet.md +docs/paths/fakepemcontenttype/get/FakepemcontenttypeGetRequestBody.md +docs/paths/fakepemcontenttype/get/FakepemcontenttypeGetResponses.md +docs/paths/fakepemcontenttype/get/requestbody/content/applicationxpemfile/ApplicationxpemfileSchema.md +docs/paths/fakepemcontenttype/get/responses/FakepemcontenttypeGetCode200Response.md +docs/paths/fakepemcontenttype/get/responses/code200response/content/applicationxpemfile/ApplicationxpemfileSchema.md +docs/paths/fakepetiduploadimagewithrequiredfile/FakepetiduploadimagewithrequiredfilePost.md +docs/paths/fakepetiduploadimagewithrequiredfile/post/FakepetiduploadimagewithrequiredfilePostPathParameters.md +docs/paths/fakepetiduploadimagewithrequiredfile/post/FakepetiduploadimagewithrequiredfilePostRequestBody.md +docs/paths/fakepetiduploadimagewithrequiredfile/post/FakepetiduploadimagewithrequiredfilePostResponses.md +docs/paths/fakepetiduploadimagewithrequiredfile/post/FakepetiduploadimagewithrequiredfilePostSecurityInfo.md +docs/paths/fakepetiduploadimagewithrequiredfile/post/parameters/parameter0/Schema0.md +docs/paths/fakepetiduploadimagewithrequiredfile/post/requestbody/content/multipartformdata/MultipartformdataSchema.md +docs/paths/fakepetiduploadimagewithrequiredfile/post/responses/FakepetiduploadimagewithrequiredfilePostCode200Response.md +docs/paths/fakepetiduploadimagewithrequiredfile/post/responses/code200response/content/applicationjson/ApplicationjsonSchema.md +docs/paths/fakepetiduploadimagewithrequiredfile/post/security/FakepetiduploadimagewithrequiredfilePostSecurityRequirementObject0.md +docs/paths/fakequeryparamwithjsoncontenttype/FakequeryparamwithjsoncontenttypeGet.md +docs/paths/fakequeryparamwithjsoncontenttype/get/FakequeryparamwithjsoncontenttypeGetQueryParameters.md +docs/paths/fakequeryparamwithjsoncontenttype/get/FakequeryparamwithjsoncontenttypeGetResponses.md +docs/paths/fakequeryparamwithjsoncontenttype/get/parameters/parameter0/content/applicationjson/Schema0.md +docs/paths/fakequeryparamwithjsoncontenttype/get/responses/FakequeryparamwithjsoncontenttypeGetCode200Response.md +docs/paths/fakequeryparamwithjsoncontenttype/get/responses/code200response/content/applicationjson/ApplicationjsonSchema.md +docs/paths/fakeredirection/FakeredirectionGet.md +docs/paths/fakeredirection/get/FakeredirectionGetResponses.md +docs/paths/fakeredirection/get/responses/FakeredirectionGetCode303Response.md +docs/paths/fakeredirection/get/responses/FakeredirectionGetCode3XXResponse.md +docs/paths/fakerefobjinquery/FakerefobjinqueryGet.md +docs/paths/fakerefobjinquery/get/FakerefobjinqueryGetQueryParameters.md +docs/paths/fakerefobjinquery/get/FakerefobjinqueryGetResponses.md +docs/paths/fakerefobjinquery/get/parameters/parameter0/Schema0.md +docs/paths/fakerefobjinquery/get/responses/FakerefobjinqueryGetCode200Response.md +docs/paths/fakerefsarraymodel/FakerefsarraymodelPost.md +docs/paths/fakerefsarraymodel/post/FakerefsarraymodelPostRequestBody.md +docs/paths/fakerefsarraymodel/post/FakerefsarraymodelPostResponses.md +docs/paths/fakerefsarraymodel/post/requestbody/content/applicationjson/ApplicationjsonSchema.md +docs/paths/fakerefsarraymodel/post/responses/FakerefsarraymodelPostCode200Response.md +docs/paths/fakerefsarraymodel/post/responses/code200response/content/applicationjson/ApplicationjsonSchema.md +docs/paths/fakerefsarrayofenums/FakerefsarrayofenumsPost.md +docs/paths/fakerefsarrayofenums/post/FakerefsarrayofenumsPostRequestBody.md +docs/paths/fakerefsarrayofenums/post/FakerefsarrayofenumsPostResponses.md +docs/paths/fakerefsarrayofenums/post/requestbody/content/applicationjson/ApplicationjsonSchema.md +docs/paths/fakerefsarrayofenums/post/responses/FakerefsarrayofenumsPostCode200Response.md +docs/paths/fakerefsarrayofenums/post/responses/code200response/content/applicationjson/ApplicationjsonSchema.md +docs/paths/fakerefsboolean/FakerefsbooleanPost.md +docs/paths/fakerefsboolean/post/FakerefsbooleanPostRequestBody.md +docs/paths/fakerefsboolean/post/FakerefsbooleanPostResponses.md +docs/paths/fakerefsboolean/post/requestbody/content/applicationjson/ApplicationjsonSchema.md +docs/paths/fakerefsboolean/post/responses/FakerefsbooleanPostCode200Response.md +docs/paths/fakerefsboolean/post/responses/code200response/content/applicationjson/ApplicationjsonSchema.md +docs/paths/fakerefscomposedoneofnumberwithvalidations/FakerefscomposedoneofnumberwithvalidationsPost.md +docs/paths/fakerefscomposedoneofnumberwithvalidations/post/FakerefscomposedoneofnumberwithvalidationsPostRequestBody.md +docs/paths/fakerefscomposedoneofnumberwithvalidations/post/FakerefscomposedoneofnumberwithvalidationsPostResponses.md +docs/paths/fakerefscomposedoneofnumberwithvalidations/post/requestbody/content/applicationjson/ApplicationjsonSchema.md +docs/paths/fakerefscomposedoneofnumberwithvalidations/post/responses/FakerefscomposedoneofnumberwithvalidationsPostCode200Response.md +docs/paths/fakerefscomposedoneofnumberwithvalidations/post/responses/code200response/content/applicationjson/ApplicationjsonSchema.md +docs/paths/fakerefsenum/FakerefsenumPost.md +docs/paths/fakerefsenum/post/FakerefsenumPostRequestBody.md +docs/paths/fakerefsenum/post/FakerefsenumPostResponses.md +docs/paths/fakerefsenum/post/requestbody/content/applicationjson/ApplicationjsonSchema.md +docs/paths/fakerefsenum/post/responses/FakerefsenumPostCode200Response.md +docs/paths/fakerefsenum/post/responses/code200response/content/applicationjson/ApplicationjsonSchema.md +docs/paths/fakerefsmammal/FakerefsmammalPost.md +docs/paths/fakerefsmammal/post/FakerefsmammalPostRequestBody.md +docs/paths/fakerefsmammal/post/FakerefsmammalPostResponses.md +docs/paths/fakerefsmammal/post/requestbody/content/applicationjson/ApplicationjsonSchema.md +docs/paths/fakerefsmammal/post/responses/FakerefsmammalPostCode200Response.md +docs/paths/fakerefsmammal/post/responses/code200response/content/applicationjson/ApplicationjsonSchema.md +docs/paths/fakerefsnumber/FakerefsnumberPost.md +docs/paths/fakerefsnumber/post/FakerefsnumberPostRequestBody.md +docs/paths/fakerefsnumber/post/FakerefsnumberPostResponses.md +docs/paths/fakerefsnumber/post/requestbody/content/applicationjson/ApplicationjsonSchema.md +docs/paths/fakerefsnumber/post/responses/FakerefsnumberPostCode200Response.md +docs/paths/fakerefsnumber/post/responses/code200response/content/applicationjson/ApplicationjsonSchema.md +docs/paths/fakerefsobjectmodelwithrefprops/FakerefsobjectmodelwithrefpropsPost.md +docs/paths/fakerefsobjectmodelwithrefprops/post/FakerefsobjectmodelwithrefpropsPostRequestBody.md +docs/paths/fakerefsobjectmodelwithrefprops/post/FakerefsobjectmodelwithrefpropsPostResponses.md +docs/paths/fakerefsobjectmodelwithrefprops/post/requestbody/content/applicationjson/ApplicationjsonSchema.md +docs/paths/fakerefsobjectmodelwithrefprops/post/responses/FakerefsobjectmodelwithrefpropsPostCode200Response.md +docs/paths/fakerefsobjectmodelwithrefprops/post/responses/code200response/content/applicationjson/ApplicationjsonSchema.md +docs/paths/fakerefsstring/FakerefsstringPost.md +docs/paths/fakerefsstring/post/FakerefsstringPostRequestBody.md +docs/paths/fakerefsstring/post/FakerefsstringPostResponses.md +docs/paths/fakerefsstring/post/requestbody/content/applicationjson/ApplicationjsonSchema.md +docs/paths/fakerefsstring/post/responses/FakerefsstringPostCode200Response.md +docs/paths/fakerefsstring/post/responses/code200response/content/applicationjson/ApplicationjsonSchema.md +docs/paths/fakeresponsewithoutschema/FakeresponsewithoutschemaGet.md +docs/paths/fakeresponsewithoutschema/get/FakeresponsewithoutschemaGetResponses.md +docs/paths/fakeresponsewithoutschema/get/responses/FakeresponsewithoutschemaGetCode200Response.md +docs/paths/faketestqueryparamters/FaketestqueryparamtersPut.md +docs/paths/faketestqueryparamters/put/FaketestqueryparamtersPutQueryParameters.md +docs/paths/faketestqueryparamters/put/FaketestqueryparamtersPutResponses.md +docs/paths/faketestqueryparamters/put/parameters/parameter0/Schema0.md +docs/paths/faketestqueryparamters/put/parameters/parameter1/Schema1.md +docs/paths/faketestqueryparamters/put/parameters/parameter2/Schema2.md +docs/paths/faketestqueryparamters/put/parameters/parameter3/Schema3.md +docs/paths/faketestqueryparamters/put/parameters/parameter4/Schema4.md +docs/paths/faketestqueryparamters/put/parameters/parameter5/Schema5.md +docs/paths/faketestqueryparamters/put/responses/FaketestqueryparamtersPutCode200Response.md +docs/paths/fakeuploaddownloadfile/FakeuploaddownloadfilePost.md +docs/paths/fakeuploaddownloadfile/post/FakeuploaddownloadfilePostRequestBody.md +docs/paths/fakeuploaddownloadfile/post/FakeuploaddownloadfilePostResponses.md +docs/paths/fakeuploaddownloadfile/post/requestbody/content/applicationoctetstream/ApplicationoctetstreamSchema.md +docs/paths/fakeuploaddownloadfile/post/responses/FakeuploaddownloadfilePostCode200Response.md +docs/paths/fakeuploaddownloadfile/post/responses/code200response/content/applicationoctetstream/ApplicationoctetstreamSchema.md +docs/paths/fakeuploadfile/FakeuploadfilePost.md +docs/paths/fakeuploadfile/post/FakeuploadfilePostRequestBody.md +docs/paths/fakeuploadfile/post/FakeuploadfilePostResponses.md +docs/paths/fakeuploadfile/post/requestbody/content/multipartformdata/MultipartformdataSchema.md +docs/paths/fakeuploadfile/post/responses/FakeuploadfilePostCode200Response.md +docs/paths/fakeuploadfile/post/responses/code200response/content/applicationjson/ApplicationjsonSchema.md +docs/paths/fakeuploadfiles/FakeuploadfilesPost.md +docs/paths/fakeuploadfiles/post/FakeuploadfilesPostRequestBody.md +docs/paths/fakeuploadfiles/post/FakeuploadfilesPostResponses.md +docs/paths/fakeuploadfiles/post/requestbody/content/multipartformdata/MultipartformdataSchema.md +docs/paths/fakeuploadfiles/post/responses/FakeuploadfilesPostCode200Response.md +docs/paths/fakeuploadfiles/post/responses/code200response/content/applicationjson/ApplicationjsonSchema.md +docs/paths/fakewildcardresponses/FakewildcardresponsesGet.md +docs/paths/fakewildcardresponses/get/FakewildcardresponsesGetResponses.md +docs/paths/fakewildcardresponses/get/responses/FakewildcardresponsesGetCode1XXResponse.md +docs/paths/fakewildcardresponses/get/responses/FakewildcardresponsesGetCode200Response.md +docs/paths/fakewildcardresponses/get/responses/FakewildcardresponsesGetCode2XXResponse.md +docs/paths/fakewildcardresponses/get/responses/FakewildcardresponsesGetCode3XXResponse.md +docs/paths/fakewildcardresponses/get/responses/FakewildcardresponsesGetCode4XXResponse.md +docs/paths/fakewildcardresponses/get/responses/FakewildcardresponsesGetCode5XXResponse.md +docs/paths/fakewildcardresponses/get/responses/code1xxresponse/content/applicationjson/ApplicationjsonSchema.md +docs/paths/fakewildcardresponses/get/responses/code200response/content/applicationjson/ApplicationjsonSchema.md +docs/paths/fakewildcardresponses/get/responses/code2xxresponse/content/applicationjson/ApplicationjsonSchema.md +docs/paths/fakewildcardresponses/get/responses/code3xxresponse/content/applicationjson/ApplicationjsonSchema.md +docs/paths/fakewildcardresponses/get/responses/code4xxresponse/content/applicationjson/ApplicationjsonSchema.md +docs/paths/fakewildcardresponses/get/responses/code5xxresponse/content/applicationjson/ApplicationjsonSchema.md +docs/paths/foo/FooGet.md +docs/paths/foo/get/FooGetResponses.md +docs/paths/foo/get/FooGetServerInfo.md +docs/paths/foo/get/responses/FooGetCodedefaultResponse.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/FooGetServer1Variables.md +docs/paths/pet/PetPost.md +docs/paths/pet/PetPut.md +docs/paths/pet/post/PetPostRequestBody.md +docs/paths/pet/post/PetPostResponses.md +docs/paths/pet/post/PetPostSecurityInfo.md +docs/paths/pet/post/responses/PetPostCode200Response.md +docs/paths/pet/post/responses/PetPostCode405Response.md +docs/paths/pet/post/security/PetPostSecurityRequirementObject0.md +docs/paths/pet/post/security/PetPostSecurityRequirementObject1.md +docs/paths/pet/post/security/PetPostSecurityRequirementObject2.md +docs/paths/pet/put/PetPutRequestBody.md +docs/paths/pet/put/PetPutResponses.md +docs/paths/pet/put/PetPutSecurityInfo.md +docs/paths/pet/put/responses/PetPutCode400Response.md +docs/paths/pet/put/responses/PetPutCode404Response.md +docs/paths/pet/put/responses/PetPutCode405Response.md +docs/paths/pet/put/security/PetPutSecurityRequirementObject0.md +docs/paths/pet/put/security/PetPutSecurityRequirementObject1.md +docs/paths/petfindbystatus/PetfindbystatusGet.md +docs/paths/petfindbystatus/PetfindbystatusServerInfo.md +docs/paths/petfindbystatus/get/PetfindbystatusGetQueryParameters.md +docs/paths/petfindbystatus/get/PetfindbystatusGetResponses.md +docs/paths/petfindbystatus/get/PetfindbystatusGetSecurityInfo.md +docs/paths/petfindbystatus/get/parameters/parameter0/Schema0.md +docs/paths/petfindbystatus/get/responses/PetfindbystatusGetCode200Response.md +docs/paths/petfindbystatus/get/responses/PetfindbystatusGetCode400Response.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/PetfindbystatusServer1Variables.md +docs/paths/petfindbytags/PetfindbytagsGet.md +docs/paths/petfindbytags/get/PetfindbytagsGetQueryParameters.md +docs/paths/petfindbytags/get/PetfindbytagsGetResponses.md +docs/paths/petfindbytags/get/PetfindbytagsGetSecurityInfo.md +docs/paths/petfindbytags/get/parameters/parameter0/Schema0.md +docs/paths/petfindbytags/get/responses/PetfindbytagsGetCode200Response.md +docs/paths/petfindbytags/get/responses/PetfindbytagsGetCode400Response.md +docs/paths/petfindbytags/get/security/PetfindbytagsGetSecurityRequirementObject0.md +docs/paths/petfindbytags/get/security/PetfindbytagsGetSecurityRequirementObject1.md +docs/paths/petpetid/PetpetidDelete.md +docs/paths/petpetid/PetpetidGet.md +docs/paths/petpetid/PetpetidPost.md +docs/paths/petpetid/delete/PetpetidDeleteHeaderParameters.md +docs/paths/petpetid/delete/PetpetidDeletePathParameters.md +docs/paths/petpetid/delete/PetpetidDeleteResponses.md +docs/paths/petpetid/delete/PetpetidDeleteSecurityInfo.md +docs/paths/petpetid/delete/parameters/parameter0/Schema0.md +docs/paths/petpetid/delete/parameters/parameter1/Schema1.md +docs/paths/petpetid/delete/responses/PetpetidDeleteCode400Response.md +docs/paths/petpetid/delete/security/PetpetidDeleteSecurityRequirementObject0.md +docs/paths/petpetid/delete/security/PetpetidDeleteSecurityRequirementObject1.md +docs/paths/petpetid/get/PetpetidGetPathParameters.md +docs/paths/petpetid/get/PetpetidGetResponses.md +docs/paths/petpetid/get/PetpetidGetSecurityInfo.md +docs/paths/petpetid/get/parameters/parameter0/Schema0.md +docs/paths/petpetid/get/responses/PetpetidGetCode200Response.md +docs/paths/petpetid/get/responses/PetpetidGetCode400Response.md +docs/paths/petpetid/get/responses/PetpetidGetCode404Response.md +docs/paths/petpetid/get/responses/code200response/content/applicationjson/ApplicationjsonSchema.md +docs/paths/petpetid/get/responses/code200response/content/applicationxml/ApplicationxmlSchema.md +docs/paths/petpetid/get/security/PetpetidGetSecurityRequirementObject0.md +docs/paths/petpetid/post/PetpetidPostPathParameters.md +docs/paths/petpetid/post/PetpetidPostRequestBody.md +docs/paths/petpetid/post/PetpetidPostResponses.md +docs/paths/petpetid/post/PetpetidPostSecurityInfo.md +docs/paths/petpetid/post/parameters/parameter0/Schema0.md +docs/paths/petpetid/post/requestbody/content/applicationxwwwformurlencoded/ApplicationxwwwformurlencodedSchema.md +docs/paths/petpetid/post/responses/PetpetidPostCode405Response.md +docs/paths/petpetid/post/security/PetpetidPostSecurityRequirementObject0.md +docs/paths/petpetid/post/security/PetpetidPostSecurityRequirementObject1.md +docs/paths/petpetiduploadimage/PetpetiduploadimagePost.md +docs/paths/petpetiduploadimage/post/PetpetiduploadimagePostPathParameters.md +docs/paths/petpetiduploadimage/post/PetpetiduploadimagePostRequestBody.md +docs/paths/petpetiduploadimage/post/PetpetiduploadimagePostResponses.md +docs/paths/petpetiduploadimage/post/PetpetiduploadimagePostSecurityInfo.md +docs/paths/petpetiduploadimage/post/parameters/parameter0/Schema0.md +docs/paths/petpetiduploadimage/post/requestbody/content/multipartformdata/MultipartformdataSchema.md +docs/paths/petpetiduploadimage/post/responses/PetpetiduploadimagePostCode200Response.md +docs/paths/petpetiduploadimage/post/security/PetpetiduploadimagePostSecurityRequirementObject0.md +docs/paths/solidus/SolidusGet.md +docs/paths/solidus/get/SolidusGetResponses.md +docs/paths/solidus/get/responses/SolidusGetCode200Response.md +docs/paths/storeinventory/StoreinventoryGet.md +docs/paths/storeinventory/get/StoreinventoryGetResponses.md +docs/paths/storeinventory/get/StoreinventoryGetSecurityInfo.md +docs/paths/storeinventory/get/responses/StoreinventoryGetCode200Response.md +docs/paths/storeinventory/get/security/StoreinventoryGetSecurityRequirementObject0.md +docs/paths/storeorder/StoreorderPost.md +docs/paths/storeorder/post/StoreorderPostRequestBody.md +docs/paths/storeorder/post/StoreorderPostResponses.md +docs/paths/storeorder/post/requestbody/content/applicationjson/ApplicationjsonSchema.md +docs/paths/storeorder/post/responses/StoreorderPostCode200Response.md +docs/paths/storeorder/post/responses/StoreorderPostCode400Response.md +docs/paths/storeorder/post/responses/code200response/content/applicationjson/ApplicationjsonSchema.md +docs/paths/storeorder/post/responses/code200response/content/applicationxml/ApplicationxmlSchema.md +docs/paths/storeorderorderid/StoreorderorderidDelete.md +docs/paths/storeorderorderid/StoreorderorderidGet.md +docs/paths/storeorderorderid/delete/StoreorderorderidDeletePathParameters.md +docs/paths/storeorderorderid/delete/StoreorderorderidDeleteResponses.md +docs/paths/storeorderorderid/delete/parameters/parameter0/Schema0.md +docs/paths/storeorderorderid/delete/responses/StoreorderorderidDeleteCode400Response.md +docs/paths/storeorderorderid/delete/responses/StoreorderorderidDeleteCode404Response.md +docs/paths/storeorderorderid/get/StoreorderorderidGetPathParameters.md +docs/paths/storeorderorderid/get/StoreorderorderidGetResponses.md +docs/paths/storeorderorderid/get/parameters/parameter0/Schema0.md +docs/paths/storeorderorderid/get/responses/StoreorderorderidGetCode200Response.md +docs/paths/storeorderorderid/get/responses/StoreorderorderidGetCode400Response.md +docs/paths/storeorderorderid/get/responses/StoreorderorderidGetCode404Response.md +docs/paths/storeorderorderid/get/responses/code200response/content/applicationjson/ApplicationjsonSchema.md +docs/paths/storeorderorderid/get/responses/code200response/content/applicationxml/ApplicationxmlSchema.md +docs/paths/user/UserPost.md +docs/paths/user/post/UserPostRequestBody.md +docs/paths/user/post/UserPostResponses.md +docs/paths/user/post/requestbody/content/applicationjson/ApplicationjsonSchema.md +docs/paths/user/post/responses/UserPostCodedefaultResponse.md +docs/paths/usercreatewitharray/UsercreatewitharrayPost.md +docs/paths/usercreatewitharray/post/UsercreatewitharrayPostRequestBody.md +docs/paths/usercreatewitharray/post/UsercreatewitharrayPostResponses.md +docs/paths/usercreatewitharray/post/responses/UsercreatewitharrayPostCodedefaultResponse.md +docs/paths/usercreatewithlist/UsercreatewithlistPost.md +docs/paths/usercreatewithlist/post/UsercreatewithlistPostRequestBody.md +docs/paths/usercreatewithlist/post/UsercreatewithlistPostResponses.md +docs/paths/usercreatewithlist/post/responses/UsercreatewithlistPostCodedefaultResponse.md +docs/paths/userlogin/UserloginGet.md +docs/paths/userlogin/get/UserloginGetQueryParameters.md +docs/paths/userlogin/get/UserloginGetResponses.md +docs/paths/userlogin/get/parameters/parameter0/Schema0.md +docs/paths/userlogin/get/parameters/parameter1/Schema1.md +docs/paths/userlogin/get/responses/UserloginGetCode200Response.md +docs/paths/userlogin/get/responses/UserloginGetCode400Response.md +docs/paths/userlogin/get/responses/code200response/UserloginGetCode200ResponseHeadersSchema.md +docs/paths/userlogin/get/responses/code200response/content/applicationjson/ApplicationjsonSchema.md +docs/paths/userlogin/get/responses/code200response/content/applicationxml/ApplicationxmlSchema.md +docs/paths/userlogin/get/responses/code200response/headers/xexpiresafter/XExpiresAfterSchema.md +docs/paths/userlogin/get/responses/code200response/headers/xratelimit/content/applicationjson/XRateLimitSchema.md +docs/paths/userlogout/UserlogoutGet.md +docs/paths/userlogout/get/UserlogoutGetResponses.md +docs/paths/userlogout/get/responses/UserlogoutGetCodedefaultResponse.md +docs/paths/userusername/UserusernameDelete.md +docs/paths/userusername/UserusernameGet.md +docs/paths/userusername/UserusernamePut.md +docs/paths/userusername/delete/UserusernameDeletePathParameters.md +docs/paths/userusername/delete/UserusernameDeleteResponses.md +docs/paths/userusername/delete/responses/UserusernameDeleteCode200Response.md +docs/paths/userusername/delete/responses/UserusernameDeleteCode404Response.md +docs/paths/userusername/get/UserusernameGetPathParameters.md +docs/paths/userusername/get/UserusernameGetResponses.md +docs/paths/userusername/get/responses/UserusernameGetCode200Response.md +docs/paths/userusername/get/responses/UserusernameGetCode400Response.md +docs/paths/userusername/get/responses/UserusernameGetCode404Response.md +docs/paths/userusername/get/responses/code200response/content/applicationjson/ApplicationjsonSchema.md +docs/paths/userusername/get/responses/code200response/content/applicationxml/ApplicationxmlSchema.md +docs/paths/userusername/put/UserusernamePutPathParameters.md +docs/paths/userusername/put/UserusernamePutRequestBody.md +docs/paths/userusername/put/UserusernamePutResponses.md +docs/paths/userusername/put/requestbody/content/applicationjson/ApplicationjsonSchema.md +docs/paths/userusername/put/responses/UserusernamePutCode400Response.md +docs/paths/userusername/put/responses/UserusernamePutCode404Response.md +docs/servers/RootServer0.md +docs/servers/RootServer1.md +docs/servers/RootServer2.md +docs/servers/rootserver0/RootServer0Variables.md +docs/servers/rootserver1/RootServer1Variables.md +settings.gradle.kts +src/main/kotlin/org/openapijsonschematools/client/RootServerInfo.kt +src/main/kotlin/org/openapijsonschematools/client/apiclient/ApiClient.kt +src/main/kotlin/org/openapijsonschematools/client/apis/paths/Anotherfakedummy.kt +src/main/kotlin/org/openapijsonschematools/client/apis/paths/Commonparamsubdir.kt +src/main/kotlin/org/openapijsonschematools/client/apis/paths/Fake.kt +src/main/kotlin/org/openapijsonschematools/client/apis/paths/Fakeadditionalpropertieswitharrayofenums.kt +src/main/kotlin/org/openapijsonschematools/client/apis/paths/Fakebodywithfileschema.kt +src/main/kotlin/org/openapijsonschematools/client/apis/paths/Fakebodywithqueryparams.kt +src/main/kotlin/org/openapijsonschematools/client/apis/paths/Fakecasesensitiveparams.kt +src/main/kotlin/org/openapijsonschematools/client/apis/paths/Fakeclassnametest.kt +src/main/kotlin/org/openapijsonschematools/client/apis/paths/Fakedeletecoffeeid.kt +src/main/kotlin/org/openapijsonschematools/client/apis/paths/Fakehealth.kt +src/main/kotlin/org/openapijsonschematools/client/apis/paths/Fakeinlineadditionalproperties.kt +src/main/kotlin/org/openapijsonschematools/client/apis/paths/Fakeinlinecomposition.kt +src/main/kotlin/org/openapijsonschematools/client/apis/paths/Fakejsonformdata.kt +src/main/kotlin/org/openapijsonschematools/client/apis/paths/Fakejsonpatch.kt +src/main/kotlin/org/openapijsonschematools/client/apis/paths/Fakejsonwithcharset.kt +src/main/kotlin/org/openapijsonschematools/client/apis/paths/Fakemultiplerequestbodycontenttypes.kt +src/main/kotlin/org/openapijsonschematools/client/apis/paths/Fakemultipleresponsebodies.kt +src/main/kotlin/org/openapijsonschematools/client/apis/paths/Fakemultiplesecurities.kt +src/main/kotlin/org/openapijsonschematools/client/apis/paths/Fakeobjinquery.kt +src/main/kotlin/org/openapijsonschematools/client/apis/paths/Fakeparametercollisions1ababselfab.kt +src/main/kotlin/org/openapijsonschematools/client/apis/paths/Fakepemcontenttype.kt +src/main/kotlin/org/openapijsonschematools/client/apis/paths/Fakepetiduploadimagewithrequiredfile.kt +src/main/kotlin/org/openapijsonschematools/client/apis/paths/Fakequeryparamwithjsoncontenttype.kt +src/main/kotlin/org/openapijsonschematools/client/apis/paths/Fakeredirection.kt +src/main/kotlin/org/openapijsonschematools/client/apis/paths/Fakerefobjinquery.kt +src/main/kotlin/org/openapijsonschematools/client/apis/paths/Fakerefsarraymodel.kt +src/main/kotlin/org/openapijsonschematools/client/apis/paths/Fakerefsarrayofenums.kt +src/main/kotlin/org/openapijsonschematools/client/apis/paths/Fakerefsboolean.kt +src/main/kotlin/org/openapijsonschematools/client/apis/paths/Fakerefscomposedoneofnumberwithvalidations.kt +src/main/kotlin/org/openapijsonschematools/client/apis/paths/Fakerefsenum.kt +src/main/kotlin/org/openapijsonschematools/client/apis/paths/Fakerefsmammal.kt +src/main/kotlin/org/openapijsonschematools/client/apis/paths/Fakerefsnumber.kt +src/main/kotlin/org/openapijsonschematools/client/apis/paths/Fakerefsobjectmodelwithrefprops.kt +src/main/kotlin/org/openapijsonschematools/client/apis/paths/Fakerefsstring.kt +src/main/kotlin/org/openapijsonschematools/client/apis/paths/Fakeresponsewithoutschema.kt +src/main/kotlin/org/openapijsonschematools/client/apis/paths/Faketestqueryparamters.kt +src/main/kotlin/org/openapijsonschematools/client/apis/paths/Fakeuploaddownloadfile.kt +src/main/kotlin/org/openapijsonschematools/client/apis/paths/Fakeuploadfile.kt +src/main/kotlin/org/openapijsonschematools/client/apis/paths/Fakeuploadfiles.kt +src/main/kotlin/org/openapijsonschematools/client/apis/paths/Fakewildcardresponses.kt +src/main/kotlin/org/openapijsonschematools/client/apis/paths/Foo.kt +src/main/kotlin/org/openapijsonschematools/client/apis/paths/Pet.kt +src/main/kotlin/org/openapijsonschematools/client/apis/paths/Petfindbystatus.kt +src/main/kotlin/org/openapijsonschematools/client/apis/paths/Petfindbytags.kt +src/main/kotlin/org/openapijsonschematools/client/apis/paths/Petpetid.kt +src/main/kotlin/org/openapijsonschematools/client/apis/paths/Petpetiduploadimage.kt +src/main/kotlin/org/openapijsonschematools/client/apis/paths/Solidus.kt +src/main/kotlin/org/openapijsonschematools/client/apis/paths/Storeinventory.kt +src/main/kotlin/org/openapijsonschematools/client/apis/paths/Storeorder.kt +src/main/kotlin/org/openapijsonschematools/client/apis/paths/Storeorderorderid.kt +src/main/kotlin/org/openapijsonschematools/client/apis/paths/User.kt +src/main/kotlin/org/openapijsonschematools/client/apis/paths/Usercreatewitharray.kt +src/main/kotlin/org/openapijsonschematools/client/apis/paths/Usercreatewithlist.kt +src/main/kotlin/org/openapijsonschematools/client/apis/paths/Userlogin.kt +src/main/kotlin/org/openapijsonschematools/client/apis/paths/Userlogout.kt +src/main/kotlin/org/openapijsonschematools/client/apis/paths/Userusername.kt +src/main/kotlin/org/openapijsonschematools/client/apis/tags/Anotherfake.kt +src/main/kotlin/org/openapijsonschematools/client/apis/tags/Default.kt +src/main/kotlin/org/openapijsonschematools/client/apis/tags/Fake.kt +src/main/kotlin/org/openapijsonschematools/client/apis/tags/Fakeclassnametags123.kt +src/main/kotlin/org/openapijsonschematools/client/apis/tags/Pet.kt +src/main/kotlin/org/openapijsonschematools/client/apis/tags/Store.kt +src/main/kotlin/org/openapijsonschematools/client/apis/tags/User.kt +src/main/kotlin/org/openapijsonschematools/client/components/headers/Int32JsonContentTypeHeader.kt +src/main/kotlin/org/openapijsonschematools/client/components/headers/NumberHeader.kt +src/main/kotlin/org/openapijsonschematools/client/components/headers/RefContentSchemaHeader.kt +src/main/kotlin/org/openapijsonschematools/client/components/headers/RefSchemaHeader.kt +src/main/kotlin/org/openapijsonschematools/client/components/headers/RefStringHeader.kt +src/main/kotlin/org/openapijsonschematools/client/components/headers/StringHeader.kt +src/main/kotlin/org/openapijsonschematools/client/components/headers/int32jsoncontenttypeheader/content/applicationjson/Int32JsonContentTypeHeaderSchema.kt +src/main/kotlin/org/openapijsonschematools/client/components/headers/numberheader/NumberHeaderSchema.kt +src/main/kotlin/org/openapijsonschematools/client/components/headers/refcontentschemaheader/content/applicationjson/RefContentSchemaHeaderSchema.kt +src/main/kotlin/org/openapijsonschematools/client/components/headers/refschemaheader/RefSchemaHeaderSchema.kt +src/main/kotlin/org/openapijsonschematools/client/components/headers/stringheader/StringHeaderSchema.kt +src/main/kotlin/org/openapijsonschematools/client/components/parameters/ComponentRefSchemaStringWithValidation.kt +src/main/kotlin/org/openapijsonschematools/client/components/parameters/PathUserName.kt +src/main/kotlin/org/openapijsonschematools/client/components/parameters/RefPathUserName.kt +src/main/kotlin/org/openapijsonschematools/client/components/parameters/RefSchemaStringWithValidation.kt +src/main/kotlin/org/openapijsonschematools/client/components/parameters/componentrefschemastringwithvalidation/content/applicationjson/ApplicationjsonSchema.kt +src/main/kotlin/org/openapijsonschematools/client/components/parameters/pathusername/Schema.kt +src/main/kotlin/org/openapijsonschematools/client/components/parameters/refschemastringwithvalidation/Schema.kt +src/main/kotlin/org/openapijsonschematools/client/components/requestbodies/Client.kt +src/main/kotlin/org/openapijsonschematools/client/components/requestbodies/Pet.kt +src/main/kotlin/org/openapijsonschematools/client/components/requestbodies/RefUserArray.kt +src/main/kotlin/org/openapijsonschematools/client/components/requestbodies/UserArray.kt +src/main/kotlin/org/openapijsonschematools/client/components/requestbodies/client/content/applicationjson/ApplicationjsonSchema.kt +src/main/kotlin/org/openapijsonschematools/client/components/requestbodies/pet/content/applicationjson/ApplicationjsonSchema.kt +src/main/kotlin/org/openapijsonschematools/client/components/requestbodies/pet/content/applicationxml/ApplicationxmlSchema.kt +src/main/kotlin/org/openapijsonschematools/client/components/requestbodies/userarray/content/applicationjson/ApplicationjsonSchema.kt +src/main/kotlin/org/openapijsonschematools/client/components/responses/HeadersWithNoBody.kt +src/main/kotlin/org/openapijsonschematools/client/components/responses/RefSuccessDescriptionOnly.kt +src/main/kotlin/org/openapijsonschematools/client/components/responses/RefSuccessfulXmlAndJsonArrayOfPet.kt +src/main/kotlin/org/openapijsonschematools/client/components/responses/SuccessDescriptionOnly.kt +src/main/kotlin/org/openapijsonschematools/client/components/responses/SuccessInlineContentAndHeader.kt +src/main/kotlin/org/openapijsonschematools/client/components/responses/SuccessWithJsonApiResponse.kt +src/main/kotlin/org/openapijsonschematools/client/components/responses/SuccessfulXmlAndJsonArrayOfPet.kt +src/main/kotlin/org/openapijsonschematools/client/components/responses/headerswithnobody/Headers.kt +src/main/kotlin/org/openapijsonschematools/client/components/responses/headerswithnobody/HeadersWithNoBodyHeadersSchema.kt +src/main/kotlin/org/openapijsonschematools/client/components/responses/headerswithnobody/headers/Location.kt +src/main/kotlin/org/openapijsonschematools/client/components/responses/headerswithnobody/headers/location/LocationSchema.kt +src/main/kotlin/org/openapijsonschematools/client/components/responses/successfulxmlandjsonarrayofpet/content/applicationjson/ApplicationjsonSchema.kt +src/main/kotlin/org/openapijsonschematools/client/components/responses/successfulxmlandjsonarrayofpet/content/applicationxml/ApplicationxmlSchema.kt +src/main/kotlin/org/openapijsonschematools/client/components/responses/successinlinecontentandheader/Headers.kt +src/main/kotlin/org/openapijsonschematools/client/components/responses/successinlinecontentandheader/SuccessInlineContentAndHeaderHeadersSchema.kt +src/main/kotlin/org/openapijsonschematools/client/components/responses/successinlinecontentandheader/content/applicationjson/ApplicationjsonSchema.kt +src/main/kotlin/org/openapijsonschematools/client/components/responses/successinlinecontentandheader/headers/SomeHeader.kt +src/main/kotlin/org/openapijsonschematools/client/components/responses/successinlinecontentandheader/headers/someheader/SomeHeaderSchema.kt +src/main/kotlin/org/openapijsonschematools/client/components/responses/successwithjsonapiresponse/Headers.kt +src/main/kotlin/org/openapijsonschematools/client/components/responses/successwithjsonapiresponse/SuccessWithJsonApiResponseHeadersSchema.kt +src/main/kotlin/org/openapijsonschematools/client/components/responses/successwithjsonapiresponse/content/applicationjson/ApplicationjsonSchema.kt +src/main/kotlin/org/openapijsonschematools/client/components/responses/successwithjsonapiresponse/headers/Int32.kt +src/main/kotlin/org/openapijsonschematools/client/components/responses/successwithjsonapiresponse/headers/NumberHeader.kt +src/main/kotlin/org/openapijsonschematools/client/components/responses/successwithjsonapiresponse/headers/Refcontentschemaheader.kt +src/main/kotlin/org/openapijsonschematools/client/components/responses/successwithjsonapiresponse/headers/Refschemaheader.kt +src/main/kotlin/org/openapijsonschematools/client/components/responses/successwithjsonapiresponse/headers/StringHeader.kt +src/main/kotlin/org/openapijsonschematools/client/components/schemas/AbstractStepMessage.kt +src/main/kotlin/org/openapijsonschematools/client/components/schemas/AdditionalPropertiesClass.kt +src/main/kotlin/org/openapijsonschematools/client/components/schemas/AdditionalPropertiesSchema.kt +src/main/kotlin/org/openapijsonschematools/client/components/schemas/AdditionalPropertiesWithArrayOfEnums.kt +src/main/kotlin/org/openapijsonschematools/client/components/schemas/Address.kt +src/main/kotlin/org/openapijsonschematools/client/components/schemas/Animal.kt +src/main/kotlin/org/openapijsonschematools/client/components/schemas/AnimalFarm.kt +src/main/kotlin/org/openapijsonschematools/client/components/schemas/AnyTypeAndFormat.kt +src/main/kotlin/org/openapijsonschematools/client/components/schemas/AnyTypeNotString.kt +src/main/kotlin/org/openapijsonschematools/client/components/schemas/ApiResponseSchema.kt +src/main/kotlin/org/openapijsonschematools/client/components/schemas/Apple.kt +src/main/kotlin/org/openapijsonschematools/client/components/schemas/AppleReq.kt +src/main/kotlin/org/openapijsonschematools/client/components/schemas/ArrayHoldingAnyType.kt +src/main/kotlin/org/openapijsonschematools/client/components/schemas/ArrayOfArrayOfNumberOnly.kt +src/main/kotlin/org/openapijsonschematools/client/components/schemas/ArrayOfEnums.kt +src/main/kotlin/org/openapijsonschematools/client/components/schemas/ArrayOfNumberOnly.kt +src/main/kotlin/org/openapijsonschematools/client/components/schemas/ArrayTest.kt +src/main/kotlin/org/openapijsonschematools/client/components/schemas/ArrayWithValidationsInItems.kt +src/main/kotlin/org/openapijsonschematools/client/components/schemas/Banana.kt +src/main/kotlin/org/openapijsonschematools/client/components/schemas/BananaReq.kt +src/main/kotlin/org/openapijsonschematools/client/components/schemas/Bar.kt +src/main/kotlin/org/openapijsonschematools/client/components/schemas/BasquePig.kt +src/main/kotlin/org/openapijsonschematools/client/components/schemas/BooleanEnum.kt +src/main/kotlin/org/openapijsonschematools/client/components/schemas/BooleanSchema.kt +src/main/kotlin/org/openapijsonschematools/client/components/schemas/Capitalization.kt +src/main/kotlin/org/openapijsonschematools/client/components/schemas/Cat.kt +src/main/kotlin/org/openapijsonschematools/client/components/schemas/Category.kt +src/main/kotlin/org/openapijsonschematools/client/components/schemas/ChildCat.kt +src/main/kotlin/org/openapijsonschematools/client/components/schemas/ClassModel.kt +src/main/kotlin/org/openapijsonschematools/client/components/schemas/Client.kt +src/main/kotlin/org/openapijsonschematools/client/components/schemas/ComplexQuadrilateral.kt +src/main/kotlin/org/openapijsonschematools/client/components/schemas/ComposedAnyOfDifferentTypesNoValidations.kt +src/main/kotlin/org/openapijsonschematools/client/components/schemas/ComposedArray.kt +src/main/kotlin/org/openapijsonschematools/client/components/schemas/ComposedBool.kt +src/main/kotlin/org/openapijsonschematools/client/components/schemas/ComposedNone.kt +src/main/kotlin/org/openapijsonschematools/client/components/schemas/ComposedNumber.kt +src/main/kotlin/org/openapijsonschematools/client/components/schemas/ComposedObject.kt +src/main/kotlin/org/openapijsonschematools/client/components/schemas/ComposedOneOfDifferentTypes.kt +src/main/kotlin/org/openapijsonschematools/client/components/schemas/ComposedString.kt +src/main/kotlin/org/openapijsonschematools/client/components/schemas/Currency.kt +src/main/kotlin/org/openapijsonschematools/client/components/schemas/DanishPig.kt +src/main/kotlin/org/openapijsonschematools/client/components/schemas/DateTimeTest.kt +src/main/kotlin/org/openapijsonschematools/client/components/schemas/DateTimeWithValidations.kt +src/main/kotlin/org/openapijsonschematools/client/components/schemas/DateWithValidations.kt +src/main/kotlin/org/openapijsonschematools/client/components/schemas/DecimalPayload.kt +src/main/kotlin/org/openapijsonschematools/client/components/schemas/Dog.kt +src/main/kotlin/org/openapijsonschematools/client/components/schemas/Drawing.kt +src/main/kotlin/org/openapijsonschematools/client/components/schemas/EnumArrays.kt +src/main/kotlin/org/openapijsonschematools/client/components/schemas/EnumClass.kt +src/main/kotlin/org/openapijsonschematools/client/components/schemas/EnumTest.kt +src/main/kotlin/org/openapijsonschematools/client/components/schemas/EquilateralTriangle.kt +src/main/kotlin/org/openapijsonschematools/client/components/schemas/File.kt +src/main/kotlin/org/openapijsonschematools/client/components/schemas/FileSchemaTestClass.kt +src/main/kotlin/org/openapijsonschematools/client/components/schemas/Foo.kt +src/main/kotlin/org/openapijsonschematools/client/components/schemas/FormatTest.kt +src/main/kotlin/org/openapijsonschematools/client/components/schemas/FromSchema.kt +src/main/kotlin/org/openapijsonschematools/client/components/schemas/Fruit.kt +src/main/kotlin/org/openapijsonschematools/client/components/schemas/FruitReq.kt +src/main/kotlin/org/openapijsonschematools/client/components/schemas/GmFruit.kt +src/main/kotlin/org/openapijsonschematools/client/components/schemas/GrandparentAnimal.kt +src/main/kotlin/org/openapijsonschematools/client/components/schemas/HasOnlyReadOnly.kt +src/main/kotlin/org/openapijsonschematools/client/components/schemas/HealthCheckResult.kt +src/main/kotlin/org/openapijsonschematools/client/components/schemas/IntegerEnum.kt +src/main/kotlin/org/openapijsonschematools/client/components/schemas/IntegerEnumBig.kt +src/main/kotlin/org/openapijsonschematools/client/components/schemas/IntegerEnumOneValue.kt +src/main/kotlin/org/openapijsonschematools/client/components/schemas/IntegerEnumWithDefaultValue.kt +src/main/kotlin/org/openapijsonschematools/client/components/schemas/IntegerMax10.kt +src/main/kotlin/org/openapijsonschematools/client/components/schemas/IntegerMin15.kt +src/main/kotlin/org/openapijsonschematools/client/components/schemas/IsoscelesTriangle.kt +src/main/kotlin/org/openapijsonschematools/client/components/schemas/Items.kt +src/main/kotlin/org/openapijsonschematools/client/components/schemas/ItemsSchema.kt +src/main/kotlin/org/openapijsonschematools/client/components/schemas/JSONPatchRequest.kt +src/main/kotlin/org/openapijsonschematools/client/components/schemas/JSONPatchRequestAddReplaceTest.kt +src/main/kotlin/org/openapijsonschematools/client/components/schemas/JSONPatchRequestMoveCopy.kt +src/main/kotlin/org/openapijsonschematools/client/components/schemas/JSONPatchRequestRemove.kt +src/main/kotlin/org/openapijsonschematools/client/components/schemas/Mammal.kt +src/main/kotlin/org/openapijsonschematools/client/components/schemas/MapTest.kt +src/main/kotlin/org/openapijsonschematools/client/components/schemas/MixedPropertiesAndAdditionalPropertiesClass.kt +src/main/kotlin/org/openapijsonschematools/client/components/schemas/Money.kt +src/main/kotlin/org/openapijsonschematools/client/components/schemas/MultiPropertiesSchema.kt +src/main/kotlin/org/openapijsonschematools/client/components/schemas/MyObjectDto.kt +src/main/kotlin/org/openapijsonschematools/client/components/schemas/Name.kt +src/main/kotlin/org/openapijsonschematools/client/components/schemas/NoAdditionalProperties.kt +src/main/kotlin/org/openapijsonschematools/client/components/schemas/NullableClass.kt +src/main/kotlin/org/openapijsonschematools/client/components/schemas/NullableShape.kt +src/main/kotlin/org/openapijsonschematools/client/components/schemas/NullableString.kt +src/main/kotlin/org/openapijsonschematools/client/components/schemas/NumberOnly.kt +src/main/kotlin/org/openapijsonschematools/client/components/schemas/NumberSchema.kt +src/main/kotlin/org/openapijsonschematools/client/components/schemas/NumberWithExclusiveMinMax.kt +src/main/kotlin/org/openapijsonschematools/client/components/schemas/NumberWithValidations.kt +src/main/kotlin/org/openapijsonschematools/client/components/schemas/ObjWithRequiredProps.kt +src/main/kotlin/org/openapijsonschematools/client/components/schemas/ObjWithRequiredPropsBase.kt +src/main/kotlin/org/openapijsonschematools/client/components/schemas/ObjectInterface.kt +src/main/kotlin/org/openapijsonschematools/client/components/schemas/ObjectModelWithArgAndArgsProperties.kt +src/main/kotlin/org/openapijsonschematools/client/components/schemas/ObjectModelWithRefProps.kt +src/main/kotlin/org/openapijsonschematools/client/components/schemas/ObjectWithAllOfWithReqTestPropFromUnsetAddProp.kt +src/main/kotlin/org/openapijsonschematools/client/components/schemas/ObjectWithCollidingProperties.kt +src/main/kotlin/org/openapijsonschematools/client/components/schemas/ObjectWithDecimalProperties.kt +src/main/kotlin/org/openapijsonschematools/client/components/schemas/ObjectWithDifficultlyNamedProps.kt +src/main/kotlin/org/openapijsonschematools/client/components/schemas/ObjectWithInlineCompositionProperty.kt +src/main/kotlin/org/openapijsonschematools/client/components/schemas/ObjectWithInvalidNamedRefedProperties.kt +src/main/kotlin/org/openapijsonschematools/client/components/schemas/ObjectWithNonIntersectingValues.kt +src/main/kotlin/org/openapijsonschematools/client/components/schemas/ObjectWithOnlyOptionalProps.kt +src/main/kotlin/org/openapijsonschematools/client/components/schemas/ObjectWithOptionalTestProp.kt +src/main/kotlin/org/openapijsonschematools/client/components/schemas/ObjectWithValidations.kt +src/main/kotlin/org/openapijsonschematools/client/components/schemas/Order.kt +src/main/kotlin/org/openapijsonschematools/client/components/schemas/PaginatedResultMyObjectDto.kt +src/main/kotlin/org/openapijsonschematools/client/components/schemas/ParentPet.kt +src/main/kotlin/org/openapijsonschematools/client/components/schemas/Pet.kt +src/main/kotlin/org/openapijsonschematools/client/components/schemas/Pig.kt +src/main/kotlin/org/openapijsonschematools/client/components/schemas/Player.kt +src/main/kotlin/org/openapijsonschematools/client/components/schemas/PublicKey.kt +src/main/kotlin/org/openapijsonschematools/client/components/schemas/Quadrilateral.kt +src/main/kotlin/org/openapijsonschematools/client/components/schemas/QuadrilateralInterface.kt +src/main/kotlin/org/openapijsonschematools/client/components/schemas/ReadOnlyFirst.kt +src/main/kotlin/org/openapijsonschematools/client/components/schemas/RefPet.kt +src/main/kotlin/org/openapijsonschematools/client/components/schemas/ReqPropsFromExplicitAddProps.kt +src/main/kotlin/org/openapijsonschematools/client/components/schemas/ReqPropsFromTrueAddProps.kt +src/main/kotlin/org/openapijsonschematools/client/components/schemas/ReqPropsFromUnsetAddProps.kt +src/main/kotlin/org/openapijsonschematools/client/components/schemas/ReturnSchema.kt +src/main/kotlin/org/openapijsonschematools/client/components/schemas/ScaleneTriangle.kt +src/main/kotlin/org/openapijsonschematools/client/components/schemas/Schema200Response.kt +src/main/kotlin/org/openapijsonschematools/client/components/schemas/SelfReferencingArrayModel.kt +src/main/kotlin/org/openapijsonschematools/client/components/schemas/SelfReferencingObjectModel.kt +src/main/kotlin/org/openapijsonschematools/client/components/schemas/Shape.kt +src/main/kotlin/org/openapijsonschematools/client/components/schemas/ShapeOrNull.kt +src/main/kotlin/org/openapijsonschematools/client/components/schemas/SimpleQuadrilateral.kt +src/main/kotlin/org/openapijsonschematools/client/components/schemas/SomeObject.kt +src/main/kotlin/org/openapijsonschematools/client/components/schemas/SpecialModelname.kt +src/main/kotlin/org/openapijsonschematools/client/components/schemas/StringBooleanMap.kt +src/main/kotlin/org/openapijsonschematools/client/components/schemas/StringEnum.kt +src/main/kotlin/org/openapijsonschematools/client/components/schemas/StringEnumWithDefaultValue.kt +src/main/kotlin/org/openapijsonschematools/client/components/schemas/StringSchema.kt +src/main/kotlin/org/openapijsonschematools/client/components/schemas/StringWithValidation.kt +src/main/kotlin/org/openapijsonschematools/client/components/schemas/Tag.kt +src/main/kotlin/org/openapijsonschematools/client/components/schemas/Triangle.kt +src/main/kotlin/org/openapijsonschematools/client/components/schemas/TriangleInterface.kt +src/main/kotlin/org/openapijsonschematools/client/components/schemas/UUIDString.kt +src/main/kotlin/org/openapijsonschematools/client/components/schemas/User.kt +src/main/kotlin/org/openapijsonschematools/client/components/schemas/Whale.kt +src/main/kotlin/org/openapijsonschematools/client/components/schemas/Zebra.kt +src/main/kotlin/org/openapijsonschematools/client/components/securityschemes/ApiKey.kt +src/main/kotlin/org/openapijsonschematools/client/components/securityschemes/ApiKeyQuery.kt +src/main/kotlin/org/openapijsonschematools/client/components/securityschemes/BearerTest.kt +src/main/kotlin/org/openapijsonschematools/client/components/securityschemes/HttpBasicTest.kt +src/main/kotlin/org/openapijsonschematools/client/components/securityschemes/HttpSignatureTest.kt +src/main/kotlin/org/openapijsonschematools/client/components/securityschemes/OpenIdConnectTest.kt +src/main/kotlin/org/openapijsonschematools/client/components/securityschemes/PetstoreAuth.kt +src/main/kotlin/org/openapijsonschematools/client/configurations/ApiConfiguration.kt +src/main/kotlin/org/openapijsonschematools/client/configurations/JsonSchemaKeywordFlags.kt +src/main/kotlin/org/openapijsonschematools/client/configurations/SchemaConfiguration.kt +src/main/kotlin/org/openapijsonschematools/client/contenttype/ContentTypeDeserializer.kt +src/main/kotlin/org/openapijsonschematools/client/contenttype/ContentTypeDetector.kt +src/main/kotlin/org/openapijsonschematools/client/contenttype/ContentTypeSerializer.kt +src/main/kotlin/org/openapijsonschematools/client/exceptions/ApiException.kt +src/main/kotlin/org/openapijsonschematools/client/exceptions/BaseException.kt +src/main/kotlin/org/openapijsonschematools/client/exceptions/InvalidAdditionalPropertyException.kt +src/main/kotlin/org/openapijsonschematools/client/exceptions/NotImplementedException.kt +src/main/kotlin/org/openapijsonschematools/client/exceptions/UnsetPropertyException.kt +src/main/kotlin/org/openapijsonschematools/client/exceptions/ValidationException.kt +src/main/kotlin/org/openapijsonschematools/client/header/ContentHeader.kt +src/main/kotlin/org/openapijsonschematools/client/header/Header.kt +src/main/kotlin/org/openapijsonschematools/client/header/HeaderBase.kt +src/main/kotlin/org/openapijsonschematools/client/header/PrefixSeparatorIterator.kt +src/main/kotlin/org/openapijsonschematools/client/header/Rfc6570Serializer.kt +src/main/kotlin/org/openapijsonschematools/client/header/SchemaHeader.kt +src/main/kotlin/org/openapijsonschematools/client/header/StyleSerializer.kt +src/main/kotlin/org/openapijsonschematools/client/mediatype/Encoding.kt +src/main/kotlin/org/openapijsonschematools/client/mediatype/MediaType.kt +src/main/kotlin/org/openapijsonschematools/client/parameter/ContentParameter.kt +src/main/kotlin/org/openapijsonschematools/client/parameter/CookieSerializer.kt +src/main/kotlin/org/openapijsonschematools/client/parameter/HeadersSerializer.kt +src/main/kotlin/org/openapijsonschematools/client/parameter/Parameter.kt +src/main/kotlin/org/openapijsonschematools/client/parameter/ParameterBase.kt +src/main/kotlin/org/openapijsonschematools/client/parameter/ParameterInType.kt +src/main/kotlin/org/openapijsonschematools/client/parameter/ParameterStyle.kt +src/main/kotlin/org/openapijsonschematools/client/parameter/PathSerializer.kt +src/main/kotlin/org/openapijsonschematools/client/parameter/QuerySerializer.kt +src/main/kotlin/org/openapijsonschematools/client/parameter/SchemaParameter.kt +src/main/kotlin/org/openapijsonschematools/client/paths/Anotherfakedummy.kt +src/main/kotlin/org/openapijsonschematools/client/paths/Commonparamsubdir.kt +src/main/kotlin/org/openapijsonschematools/client/paths/Fake.kt +src/main/kotlin/org/openapijsonschematools/client/paths/Fakeadditionalpropertieswitharrayofenums.kt +src/main/kotlin/org/openapijsonschematools/client/paths/Fakebodywithfileschema.kt +src/main/kotlin/org/openapijsonschematools/client/paths/Fakebodywithqueryparams.kt +src/main/kotlin/org/openapijsonschematools/client/paths/Fakecasesensitiveparams.kt +src/main/kotlin/org/openapijsonschematools/client/paths/Fakeclassnametest.kt +src/main/kotlin/org/openapijsonschematools/client/paths/Fakedeletecoffeeid.kt +src/main/kotlin/org/openapijsonschematools/client/paths/Fakehealth.kt +src/main/kotlin/org/openapijsonschematools/client/paths/Fakeinlineadditionalproperties.kt +src/main/kotlin/org/openapijsonschematools/client/paths/Fakeinlinecomposition.kt +src/main/kotlin/org/openapijsonschematools/client/paths/Fakejsonformdata.kt +src/main/kotlin/org/openapijsonschematools/client/paths/Fakejsonpatch.kt +src/main/kotlin/org/openapijsonschematools/client/paths/Fakejsonwithcharset.kt +src/main/kotlin/org/openapijsonschematools/client/paths/Fakemultiplerequestbodycontenttypes.kt +src/main/kotlin/org/openapijsonschematools/client/paths/Fakemultipleresponsebodies.kt +src/main/kotlin/org/openapijsonschematools/client/paths/Fakemultiplesecurities.kt +src/main/kotlin/org/openapijsonschematools/client/paths/Fakeobjinquery.kt +src/main/kotlin/org/openapijsonschematools/client/paths/Fakeparametercollisions1ababselfab.kt +src/main/kotlin/org/openapijsonschematools/client/paths/Fakepemcontenttype.kt +src/main/kotlin/org/openapijsonschematools/client/paths/Fakepetiduploadimagewithrequiredfile.kt +src/main/kotlin/org/openapijsonschematools/client/paths/Fakequeryparamwithjsoncontenttype.kt +src/main/kotlin/org/openapijsonschematools/client/paths/Fakeredirection.kt +src/main/kotlin/org/openapijsonschematools/client/paths/Fakerefobjinquery.kt +src/main/kotlin/org/openapijsonschematools/client/paths/Fakerefsarraymodel.kt +src/main/kotlin/org/openapijsonschematools/client/paths/Fakerefsarrayofenums.kt +src/main/kotlin/org/openapijsonschematools/client/paths/Fakerefsboolean.kt +src/main/kotlin/org/openapijsonschematools/client/paths/Fakerefscomposedoneofnumberwithvalidations.kt +src/main/kotlin/org/openapijsonschematools/client/paths/Fakerefsenum.kt +src/main/kotlin/org/openapijsonschematools/client/paths/Fakerefsmammal.kt +src/main/kotlin/org/openapijsonschematools/client/paths/Fakerefsnumber.kt +src/main/kotlin/org/openapijsonschematools/client/paths/Fakerefsobjectmodelwithrefprops.kt +src/main/kotlin/org/openapijsonschematools/client/paths/Fakerefsstring.kt +src/main/kotlin/org/openapijsonschematools/client/paths/Fakeresponsewithoutschema.kt +src/main/kotlin/org/openapijsonschematools/client/paths/Faketestqueryparamters.kt +src/main/kotlin/org/openapijsonschematools/client/paths/Fakeuploaddownloadfile.kt +src/main/kotlin/org/openapijsonschematools/client/paths/Fakeuploadfile.kt +src/main/kotlin/org/openapijsonschematools/client/paths/Fakeuploadfiles.kt +src/main/kotlin/org/openapijsonschematools/client/paths/Fakewildcardresponses.kt +src/main/kotlin/org/openapijsonschematools/client/paths/Foo.kt +src/main/kotlin/org/openapijsonschematools/client/paths/Pet.kt +src/main/kotlin/org/openapijsonschematools/client/paths/Petfindbystatus.kt +src/main/kotlin/org/openapijsonschematools/client/paths/Petfindbytags.kt +src/main/kotlin/org/openapijsonschematools/client/paths/Petpetid.kt +src/main/kotlin/org/openapijsonschematools/client/paths/Petpetiduploadimage.kt +src/main/kotlin/org/openapijsonschematools/client/paths/Solidus.kt +src/main/kotlin/org/openapijsonschematools/client/paths/Storeinventory.kt +src/main/kotlin/org/openapijsonschematools/client/paths/Storeorder.kt +src/main/kotlin/org/openapijsonschematools/client/paths/Storeorderorderid.kt +src/main/kotlin/org/openapijsonschematools/client/paths/User.kt +src/main/kotlin/org/openapijsonschematools/client/paths/Usercreatewitharray.kt +src/main/kotlin/org/openapijsonschematools/client/paths/Usercreatewithlist.kt +src/main/kotlin/org/openapijsonschematools/client/paths/Userlogin.kt +src/main/kotlin/org/openapijsonschematools/client/paths/Userlogout.kt +src/main/kotlin/org/openapijsonschematools/client/paths/Userusername.kt +src/main/kotlin/org/openapijsonschematools/client/paths/anotherfakedummy/AnotherfakedummyPatch.kt +src/main/kotlin/org/openapijsonschematools/client/paths/anotherfakedummy/patch/AnotherfakedummyPatchRequestBody.kt +src/main/kotlin/org/openapijsonschematools/client/paths/anotherfakedummy/patch/AnotherfakedummyPatchResponses.kt +src/main/kotlin/org/openapijsonschematools/client/paths/anotherfakedummy/patch/responses/AnotherfakedummyPatchCode200Response.kt +src/main/kotlin/org/openapijsonschematools/client/paths/anotherfakedummy/patch/responses/code200response/content/applicationjson/ApplicationjsonSchema.kt +src/main/kotlin/org/openapijsonschematools/client/paths/commonparamsubdir/CommonparamsubdirDelete.kt +src/main/kotlin/org/openapijsonschematools/client/paths/commonparamsubdir/CommonparamsubdirGet.kt +src/main/kotlin/org/openapijsonschematools/client/paths/commonparamsubdir/CommonparamsubdirPost.kt +src/main/kotlin/org/openapijsonschematools/client/paths/commonparamsubdir/delete/CommonparamsubdirDeleteHeaderParameters.kt +src/main/kotlin/org/openapijsonschematools/client/paths/commonparamsubdir/delete/CommonparamsubdirDeletePathParameters.kt +src/main/kotlin/org/openapijsonschematools/client/paths/commonparamsubdir/delete/CommonparamsubdirDeleteResponses.kt +src/main/kotlin/org/openapijsonschematools/client/paths/commonparamsubdir/delete/Parameters.kt +src/main/kotlin/org/openapijsonschematools/client/paths/commonparamsubdir/delete/parameters/Parameter0.kt +src/main/kotlin/org/openapijsonschematools/client/paths/commonparamsubdir/delete/parameters/Parameter1.kt +src/main/kotlin/org/openapijsonschematools/client/paths/commonparamsubdir/delete/parameters/parameter0/Schema0.kt +src/main/kotlin/org/openapijsonschematools/client/paths/commonparamsubdir/delete/parameters/parameter1/Schema1.kt +src/main/kotlin/org/openapijsonschematools/client/paths/commonparamsubdir/delete/responses/CommonparamsubdirDeleteCode200Response.kt +src/main/kotlin/org/openapijsonschematools/client/paths/commonparamsubdir/get/CommonparamsubdirGetPathParameters.kt +src/main/kotlin/org/openapijsonschematools/client/paths/commonparamsubdir/get/CommonparamsubdirGetQueryParameters.kt +src/main/kotlin/org/openapijsonschematools/client/paths/commonparamsubdir/get/CommonparamsubdirGetResponses.kt +src/main/kotlin/org/openapijsonschematools/client/paths/commonparamsubdir/get/Parameters.kt +src/main/kotlin/org/openapijsonschematools/client/paths/commonparamsubdir/get/parameters/Parameter0.kt +src/main/kotlin/org/openapijsonschematools/client/paths/commonparamsubdir/get/parameters/parameter0/Schema0.kt +src/main/kotlin/org/openapijsonschematools/client/paths/commonparamsubdir/get/responses/CommonparamsubdirGetCode200Response.kt +src/main/kotlin/org/openapijsonschematools/client/paths/commonparamsubdir/parameters/RouteParameter0.kt +src/main/kotlin/org/openapijsonschematools/client/paths/commonparamsubdir/parameters/routeparameter0/RouteParamSchema0.kt +src/main/kotlin/org/openapijsonschematools/client/paths/commonparamsubdir/post/CommonparamsubdirPostHeaderParameters.kt +src/main/kotlin/org/openapijsonschematools/client/paths/commonparamsubdir/post/CommonparamsubdirPostPathParameters.kt +src/main/kotlin/org/openapijsonschematools/client/paths/commonparamsubdir/post/CommonparamsubdirPostResponses.kt +src/main/kotlin/org/openapijsonschematools/client/paths/commonparamsubdir/post/Parameters.kt +src/main/kotlin/org/openapijsonschematools/client/paths/commonparamsubdir/post/parameters/Parameter0.kt +src/main/kotlin/org/openapijsonschematools/client/paths/commonparamsubdir/post/parameters/parameter0/Schema0.kt +src/main/kotlin/org/openapijsonschematools/client/paths/commonparamsubdir/post/responses/CommonparamsubdirPostCode200Response.kt +src/main/kotlin/org/openapijsonschematools/client/paths/fake/FakeDelete.kt +src/main/kotlin/org/openapijsonschematools/client/paths/fake/FakeGet.kt +src/main/kotlin/org/openapijsonschematools/client/paths/fake/FakePatch.kt +src/main/kotlin/org/openapijsonschematools/client/paths/fake/FakePost.kt +src/main/kotlin/org/openapijsonschematools/client/paths/fake/delete/FakeDeleteHeaderParameters.kt +src/main/kotlin/org/openapijsonschematools/client/paths/fake/delete/FakeDeleteQueryParameters.kt +src/main/kotlin/org/openapijsonschematools/client/paths/fake/delete/FakeDeleteResponses.kt +src/main/kotlin/org/openapijsonschematools/client/paths/fake/delete/FakeDeleteSecurityInfo.kt +src/main/kotlin/org/openapijsonschematools/client/paths/fake/delete/Parameters.kt +src/main/kotlin/org/openapijsonschematools/client/paths/fake/delete/parameters/Parameter0.kt +src/main/kotlin/org/openapijsonschematools/client/paths/fake/delete/parameters/Parameter1.kt +src/main/kotlin/org/openapijsonschematools/client/paths/fake/delete/parameters/Parameter2.kt +src/main/kotlin/org/openapijsonschematools/client/paths/fake/delete/parameters/Parameter3.kt +src/main/kotlin/org/openapijsonschematools/client/paths/fake/delete/parameters/Parameter4.kt +src/main/kotlin/org/openapijsonschematools/client/paths/fake/delete/parameters/Parameter5.kt +src/main/kotlin/org/openapijsonschematools/client/paths/fake/delete/parameters/parameter0/Schema0.kt +src/main/kotlin/org/openapijsonschematools/client/paths/fake/delete/parameters/parameter1/Schema1.kt +src/main/kotlin/org/openapijsonschematools/client/paths/fake/delete/parameters/parameter2/Schema2.kt +src/main/kotlin/org/openapijsonschematools/client/paths/fake/delete/parameters/parameter3/Schema3.kt +src/main/kotlin/org/openapijsonschematools/client/paths/fake/delete/parameters/parameter4/Schema4.kt +src/main/kotlin/org/openapijsonschematools/client/paths/fake/delete/parameters/parameter5/Schema5.kt +src/main/kotlin/org/openapijsonschematools/client/paths/fake/delete/responses/FakeDeleteCode200Response.kt +src/main/kotlin/org/openapijsonschematools/client/paths/fake/delete/security/FakeDeleteSecurityRequirementObject0.kt +src/main/kotlin/org/openapijsonschematools/client/paths/fake/get/FakeGetHeaderParameters.kt +src/main/kotlin/org/openapijsonschematools/client/paths/fake/get/FakeGetQueryParameters.kt +src/main/kotlin/org/openapijsonschematools/client/paths/fake/get/FakeGetRequestBody.kt +src/main/kotlin/org/openapijsonschematools/client/paths/fake/get/FakeGetResponses.kt +src/main/kotlin/org/openapijsonschematools/client/paths/fake/get/Parameters.kt +src/main/kotlin/org/openapijsonschematools/client/paths/fake/get/parameters/Parameter0.kt +src/main/kotlin/org/openapijsonschematools/client/paths/fake/get/parameters/Parameter1.kt +src/main/kotlin/org/openapijsonschematools/client/paths/fake/get/parameters/Parameter2.kt +src/main/kotlin/org/openapijsonschematools/client/paths/fake/get/parameters/Parameter3.kt +src/main/kotlin/org/openapijsonschematools/client/paths/fake/get/parameters/Parameter4.kt +src/main/kotlin/org/openapijsonschematools/client/paths/fake/get/parameters/Parameter5.kt +src/main/kotlin/org/openapijsonschematools/client/paths/fake/get/parameters/parameter0/Schema0.kt +src/main/kotlin/org/openapijsonschematools/client/paths/fake/get/parameters/parameter1/Schema1.kt +src/main/kotlin/org/openapijsonschematools/client/paths/fake/get/parameters/parameter2/Schema2.kt +src/main/kotlin/org/openapijsonschematools/client/paths/fake/get/parameters/parameter3/Schema3.kt +src/main/kotlin/org/openapijsonschematools/client/paths/fake/get/parameters/parameter4/Schema4.kt +src/main/kotlin/org/openapijsonschematools/client/paths/fake/get/parameters/parameter5/Schema5.kt +src/main/kotlin/org/openapijsonschematools/client/paths/fake/get/requestbody/content/applicationxwwwformurlencoded/ApplicationxwwwformurlencodedSchema.kt +src/main/kotlin/org/openapijsonschematools/client/paths/fake/get/responses/FakeGetCode200Response.kt +src/main/kotlin/org/openapijsonschematools/client/paths/fake/get/responses/FakeGetCode404Response.kt +src/main/kotlin/org/openapijsonschematools/client/paths/fake/get/responses/code404response/content/applicationjson/ApplicationjsonSchema.kt +src/main/kotlin/org/openapijsonschematools/client/paths/fake/patch/FakePatchRequestBody.kt +src/main/kotlin/org/openapijsonschematools/client/paths/fake/patch/FakePatchResponses.kt +src/main/kotlin/org/openapijsonschematools/client/paths/fake/patch/responses/FakePatchCode200Response.kt +src/main/kotlin/org/openapijsonschematools/client/paths/fake/patch/responses/code200response/content/applicationjson/ApplicationjsonSchema.kt +src/main/kotlin/org/openapijsonschematools/client/paths/fake/post/FakePostRequestBody.kt +src/main/kotlin/org/openapijsonschematools/client/paths/fake/post/FakePostResponses.kt +src/main/kotlin/org/openapijsonschematools/client/paths/fake/post/FakePostSecurityInfo.kt +src/main/kotlin/org/openapijsonschematools/client/paths/fake/post/requestbody/content/applicationxwwwformurlencoded/ApplicationxwwwformurlencodedSchema.kt +src/main/kotlin/org/openapijsonschematools/client/paths/fake/post/responses/FakePostCode200Response.kt +src/main/kotlin/org/openapijsonschematools/client/paths/fake/post/responses/FakePostCode404Response.kt +src/main/kotlin/org/openapijsonschematools/client/paths/fake/post/security/FakePostSecurityRequirementObject0.kt +src/main/kotlin/org/openapijsonschematools/client/paths/fakeadditionalpropertieswitharrayofenums/FakeadditionalpropertieswitharrayofenumsGet.kt +src/main/kotlin/org/openapijsonschematools/client/paths/fakeadditionalpropertieswitharrayofenums/get/FakeadditionalpropertieswitharrayofenumsGetRequestBody.kt +src/main/kotlin/org/openapijsonschematools/client/paths/fakeadditionalpropertieswitharrayofenums/get/FakeadditionalpropertieswitharrayofenumsGetResponses.kt +src/main/kotlin/org/openapijsonschematools/client/paths/fakeadditionalpropertieswitharrayofenums/get/requestbody/content/applicationjson/ApplicationjsonSchema.kt +src/main/kotlin/org/openapijsonschematools/client/paths/fakeadditionalpropertieswitharrayofenums/get/responses/FakeadditionalpropertieswitharrayofenumsGetCode200Response.kt +src/main/kotlin/org/openapijsonschematools/client/paths/fakeadditionalpropertieswitharrayofenums/get/responses/code200response/content/applicationjson/ApplicationjsonSchema.kt +src/main/kotlin/org/openapijsonschematools/client/paths/fakebodywithfileschema/FakebodywithfileschemaPut.kt +src/main/kotlin/org/openapijsonschematools/client/paths/fakebodywithfileschema/put/FakebodywithfileschemaPutRequestBody.kt +src/main/kotlin/org/openapijsonschematools/client/paths/fakebodywithfileschema/put/FakebodywithfileschemaPutResponses.kt +src/main/kotlin/org/openapijsonschematools/client/paths/fakebodywithfileschema/put/requestbody/content/applicationjson/ApplicationjsonSchema.kt +src/main/kotlin/org/openapijsonschematools/client/paths/fakebodywithfileschema/put/responses/FakebodywithfileschemaPutCode200Response.kt +src/main/kotlin/org/openapijsonschematools/client/paths/fakebodywithqueryparams/FakebodywithqueryparamsPut.kt +src/main/kotlin/org/openapijsonschematools/client/paths/fakebodywithqueryparams/put/FakebodywithqueryparamsPutQueryParameters.kt +src/main/kotlin/org/openapijsonschematools/client/paths/fakebodywithqueryparams/put/FakebodywithqueryparamsPutRequestBody.kt +src/main/kotlin/org/openapijsonschematools/client/paths/fakebodywithqueryparams/put/FakebodywithqueryparamsPutResponses.kt +src/main/kotlin/org/openapijsonschematools/client/paths/fakebodywithqueryparams/put/Parameters.kt +src/main/kotlin/org/openapijsonschematools/client/paths/fakebodywithqueryparams/put/parameters/Parameter0.kt +src/main/kotlin/org/openapijsonschematools/client/paths/fakebodywithqueryparams/put/parameters/parameter0/Schema0.kt +src/main/kotlin/org/openapijsonschematools/client/paths/fakebodywithqueryparams/put/requestbody/content/applicationjson/ApplicationjsonSchema.kt +src/main/kotlin/org/openapijsonschematools/client/paths/fakebodywithqueryparams/put/responses/FakebodywithqueryparamsPutCode200Response.kt +src/main/kotlin/org/openapijsonschematools/client/paths/fakecasesensitiveparams/FakecasesensitiveparamsPut.kt +src/main/kotlin/org/openapijsonschematools/client/paths/fakecasesensitiveparams/put/FakecasesensitiveparamsPutQueryParameters.kt +src/main/kotlin/org/openapijsonschematools/client/paths/fakecasesensitiveparams/put/FakecasesensitiveparamsPutResponses.kt +src/main/kotlin/org/openapijsonschematools/client/paths/fakecasesensitiveparams/put/Parameters.kt +src/main/kotlin/org/openapijsonschematools/client/paths/fakecasesensitiveparams/put/parameters/Parameter0.kt +src/main/kotlin/org/openapijsonschematools/client/paths/fakecasesensitiveparams/put/parameters/Parameter1.kt +src/main/kotlin/org/openapijsonschematools/client/paths/fakecasesensitiveparams/put/parameters/Parameter2.kt +src/main/kotlin/org/openapijsonschematools/client/paths/fakecasesensitiveparams/put/parameters/parameter0/Schema0.kt +src/main/kotlin/org/openapijsonschematools/client/paths/fakecasesensitiveparams/put/parameters/parameter1/Schema1.kt +src/main/kotlin/org/openapijsonschematools/client/paths/fakecasesensitiveparams/put/parameters/parameter2/Schema2.kt +src/main/kotlin/org/openapijsonschematools/client/paths/fakecasesensitiveparams/put/responses/FakecasesensitiveparamsPutCode200Response.kt +src/main/kotlin/org/openapijsonschematools/client/paths/fakeclassnametest/FakeclassnametestPatch.kt +src/main/kotlin/org/openapijsonschematools/client/paths/fakeclassnametest/patch/FakeclassnametestPatchRequestBody.kt +src/main/kotlin/org/openapijsonschematools/client/paths/fakeclassnametest/patch/FakeclassnametestPatchResponses.kt +src/main/kotlin/org/openapijsonschematools/client/paths/fakeclassnametest/patch/FakeclassnametestPatchSecurityInfo.kt +src/main/kotlin/org/openapijsonschematools/client/paths/fakeclassnametest/patch/responses/FakeclassnametestPatchCode200Response.kt +src/main/kotlin/org/openapijsonschematools/client/paths/fakeclassnametest/patch/responses/code200response/content/applicationjson/ApplicationjsonSchema.kt +src/main/kotlin/org/openapijsonschematools/client/paths/fakeclassnametest/patch/security/FakeclassnametestPatchSecurityRequirementObject0.kt +src/main/kotlin/org/openapijsonschematools/client/paths/fakedeletecoffeeid/FakedeletecoffeeidDelete.kt +src/main/kotlin/org/openapijsonschematools/client/paths/fakedeletecoffeeid/delete/FakedeletecoffeeidDeletePathParameters.kt +src/main/kotlin/org/openapijsonschematools/client/paths/fakedeletecoffeeid/delete/FakedeletecoffeeidDeleteResponses.kt +src/main/kotlin/org/openapijsonschematools/client/paths/fakedeletecoffeeid/delete/Parameters.kt +src/main/kotlin/org/openapijsonschematools/client/paths/fakedeletecoffeeid/delete/parameters/Parameter0.kt +src/main/kotlin/org/openapijsonschematools/client/paths/fakedeletecoffeeid/delete/parameters/parameter0/Schema0.kt +src/main/kotlin/org/openapijsonschematools/client/paths/fakedeletecoffeeid/delete/responses/FakedeletecoffeeidDeleteCode200Response.kt +src/main/kotlin/org/openapijsonschematools/client/paths/fakedeletecoffeeid/delete/responses/FakedeletecoffeeidDeleteCodedefaultResponse.kt +src/main/kotlin/org/openapijsonschematools/client/paths/fakehealth/FakehealthGet.kt +src/main/kotlin/org/openapijsonschematools/client/paths/fakehealth/get/FakehealthGetResponses.kt +src/main/kotlin/org/openapijsonschematools/client/paths/fakehealth/get/responses/FakehealthGetCode200Response.kt +src/main/kotlin/org/openapijsonschematools/client/paths/fakehealth/get/responses/code200response/content/applicationjson/ApplicationjsonSchema.kt +src/main/kotlin/org/openapijsonschematools/client/paths/fakeinlineadditionalproperties/FakeinlineadditionalpropertiesPost.kt +src/main/kotlin/org/openapijsonschematools/client/paths/fakeinlineadditionalproperties/post/FakeinlineadditionalpropertiesPostRequestBody.kt +src/main/kotlin/org/openapijsonschematools/client/paths/fakeinlineadditionalproperties/post/FakeinlineadditionalpropertiesPostResponses.kt +src/main/kotlin/org/openapijsonschematools/client/paths/fakeinlineadditionalproperties/post/requestbody/content/applicationjson/ApplicationjsonSchema.kt +src/main/kotlin/org/openapijsonschematools/client/paths/fakeinlineadditionalproperties/post/responses/FakeinlineadditionalpropertiesPostCode200Response.kt +src/main/kotlin/org/openapijsonschematools/client/paths/fakeinlinecomposition/FakeinlinecompositionPost.kt +src/main/kotlin/org/openapijsonschematools/client/paths/fakeinlinecomposition/post/FakeinlinecompositionPostQueryParameters.kt +src/main/kotlin/org/openapijsonschematools/client/paths/fakeinlinecomposition/post/FakeinlinecompositionPostRequestBody.kt +src/main/kotlin/org/openapijsonschematools/client/paths/fakeinlinecomposition/post/FakeinlinecompositionPostResponses.kt +src/main/kotlin/org/openapijsonschematools/client/paths/fakeinlinecomposition/post/Parameters.kt +src/main/kotlin/org/openapijsonschematools/client/paths/fakeinlinecomposition/post/parameters/Parameter0.kt +src/main/kotlin/org/openapijsonschematools/client/paths/fakeinlinecomposition/post/parameters/Parameter1.kt +src/main/kotlin/org/openapijsonschematools/client/paths/fakeinlinecomposition/post/parameters/parameter0/Schema0.kt +src/main/kotlin/org/openapijsonschematools/client/paths/fakeinlinecomposition/post/parameters/parameter1/Schema1.kt +src/main/kotlin/org/openapijsonschematools/client/paths/fakeinlinecomposition/post/requestbody/content/applicationjson/ApplicationjsonSchema.kt +src/main/kotlin/org/openapijsonschematools/client/paths/fakeinlinecomposition/post/requestbody/content/multipartformdata/MultipartformdataSchema.kt +src/main/kotlin/org/openapijsonschematools/client/paths/fakeinlinecomposition/post/responses/FakeinlinecompositionPostCode200Response.kt +src/main/kotlin/org/openapijsonschematools/client/paths/fakeinlinecomposition/post/responses/code200response/content/applicationjson/ApplicationjsonSchema.kt +src/main/kotlin/org/openapijsonschematools/client/paths/fakeinlinecomposition/post/responses/code200response/content/multipartformdata/MultipartformdataSchema.kt +src/main/kotlin/org/openapijsonschematools/client/paths/fakejsonformdata/FakejsonformdataGet.kt +src/main/kotlin/org/openapijsonschematools/client/paths/fakejsonformdata/get/FakejsonformdataGetRequestBody.kt +src/main/kotlin/org/openapijsonschematools/client/paths/fakejsonformdata/get/FakejsonformdataGetResponses.kt +src/main/kotlin/org/openapijsonschematools/client/paths/fakejsonformdata/get/requestbody/content/applicationxwwwformurlencoded/ApplicationxwwwformurlencodedSchema.kt +src/main/kotlin/org/openapijsonschematools/client/paths/fakejsonformdata/get/responses/FakejsonformdataGetCode200Response.kt +src/main/kotlin/org/openapijsonschematools/client/paths/fakejsonpatch/FakejsonpatchPatch.kt +src/main/kotlin/org/openapijsonschematools/client/paths/fakejsonpatch/patch/FakejsonpatchPatchRequestBody.kt +src/main/kotlin/org/openapijsonschematools/client/paths/fakejsonpatch/patch/FakejsonpatchPatchResponses.kt +src/main/kotlin/org/openapijsonschematools/client/paths/fakejsonpatch/patch/requestbody/content/applicationjsonpatchjson/ApplicationjsonpatchjsonSchema.kt +src/main/kotlin/org/openapijsonschematools/client/paths/fakejsonpatch/patch/responses/FakejsonpatchPatchCode200Response.kt +src/main/kotlin/org/openapijsonschematools/client/paths/fakejsonwithcharset/FakejsonwithcharsetPost.kt +src/main/kotlin/org/openapijsonschematools/client/paths/fakejsonwithcharset/post/FakejsonwithcharsetPostRequestBody.kt +src/main/kotlin/org/openapijsonschematools/client/paths/fakejsonwithcharset/post/FakejsonwithcharsetPostResponses.kt +src/main/kotlin/org/openapijsonschematools/client/paths/fakejsonwithcharset/post/requestbody/content/applicationjsoncharsetutf8/Applicationjsoncharsetutf8Schema.kt +src/main/kotlin/org/openapijsonschematools/client/paths/fakejsonwithcharset/post/responses/FakejsonwithcharsetPostCode200Response.kt +src/main/kotlin/org/openapijsonschematools/client/paths/fakejsonwithcharset/post/responses/code200response/content/applicationjsoncharsetutf8/Applicationjsoncharsetutf8Schema.kt +src/main/kotlin/org/openapijsonschematools/client/paths/fakemultiplerequestbodycontenttypes/FakemultiplerequestbodycontenttypesPost.kt +src/main/kotlin/org/openapijsonschematools/client/paths/fakemultiplerequestbodycontenttypes/post/FakemultiplerequestbodycontenttypesPostRequestBody.kt +src/main/kotlin/org/openapijsonschematools/client/paths/fakemultiplerequestbodycontenttypes/post/FakemultiplerequestbodycontenttypesPostResponses.kt +src/main/kotlin/org/openapijsonschematools/client/paths/fakemultiplerequestbodycontenttypes/post/requestbody/content/applicationjson/ApplicationjsonSchema.kt +src/main/kotlin/org/openapijsonschematools/client/paths/fakemultiplerequestbodycontenttypes/post/requestbody/content/multipartformdata/MultipartformdataSchema.kt +src/main/kotlin/org/openapijsonschematools/client/paths/fakemultiplerequestbodycontenttypes/post/responses/FakemultiplerequestbodycontenttypesPostCode200Response.kt +src/main/kotlin/org/openapijsonschematools/client/paths/fakemultiplerequestbodycontenttypes/post/responses/code200response/content/applicationjson/ApplicationjsonSchema.kt +src/main/kotlin/org/openapijsonschematools/client/paths/fakemultipleresponsebodies/FakemultipleresponsebodiesGet.kt +src/main/kotlin/org/openapijsonschematools/client/paths/fakemultipleresponsebodies/get/FakemultipleresponsebodiesGetResponses.kt +src/main/kotlin/org/openapijsonschematools/client/paths/fakemultipleresponsebodies/get/responses/FakemultipleresponsebodiesGetCode200Response.kt +src/main/kotlin/org/openapijsonschematools/client/paths/fakemultipleresponsebodies/get/responses/FakemultipleresponsebodiesGetCode202Response.kt +src/main/kotlin/org/openapijsonschematools/client/paths/fakemultipleresponsebodies/get/responses/code200response/content/applicationjson/ApplicationjsonSchema.kt +src/main/kotlin/org/openapijsonschematools/client/paths/fakemultipleresponsebodies/get/responses/code202response/content/applicationjson/ApplicationjsonSchema.kt +src/main/kotlin/org/openapijsonschematools/client/paths/fakemultiplesecurities/FakemultiplesecuritiesGet.kt +src/main/kotlin/org/openapijsonschematools/client/paths/fakemultiplesecurities/get/FakemultiplesecuritiesGetResponses.kt +src/main/kotlin/org/openapijsonschematools/client/paths/fakemultiplesecurities/get/FakemultiplesecuritiesGetSecurityInfo.kt +src/main/kotlin/org/openapijsonschematools/client/paths/fakemultiplesecurities/get/responses/FakemultiplesecuritiesGetCode200Response.kt +src/main/kotlin/org/openapijsonschematools/client/paths/fakemultiplesecurities/get/responses/code200response/content/applicationjson/ApplicationjsonSchema.kt +src/main/kotlin/org/openapijsonschematools/client/paths/fakemultiplesecurities/get/security/FakemultiplesecuritiesGetSecurityRequirementObject0.kt +src/main/kotlin/org/openapijsonschematools/client/paths/fakemultiplesecurities/get/security/FakemultiplesecuritiesGetSecurityRequirementObject1.kt +src/main/kotlin/org/openapijsonschematools/client/paths/fakemultiplesecurities/get/security/FakemultiplesecuritiesGetSecurityRequirementObject2.kt +src/main/kotlin/org/openapijsonschematools/client/paths/fakeobjinquery/FakeobjinqueryGet.kt +src/main/kotlin/org/openapijsonschematools/client/paths/fakeobjinquery/get/FakeobjinqueryGetQueryParameters.kt +src/main/kotlin/org/openapijsonschematools/client/paths/fakeobjinquery/get/FakeobjinqueryGetResponses.kt +src/main/kotlin/org/openapijsonschematools/client/paths/fakeobjinquery/get/Parameters.kt +src/main/kotlin/org/openapijsonschematools/client/paths/fakeobjinquery/get/parameters/Parameter0.kt +src/main/kotlin/org/openapijsonschematools/client/paths/fakeobjinquery/get/parameters/parameter0/Schema0.kt +src/main/kotlin/org/openapijsonschematools/client/paths/fakeobjinquery/get/responses/FakeobjinqueryGetCode200Response.kt +src/main/kotlin/org/openapijsonschematools/client/paths/fakeparametercollisions1ababselfab/Fakeparametercollisions1ababselfabPost.kt +src/main/kotlin/org/openapijsonschematools/client/paths/fakeparametercollisions1ababselfab/post/Fakeparametercollisions1ababselfabPostCookieParameters.kt +src/main/kotlin/org/openapijsonschematools/client/paths/fakeparametercollisions1ababselfab/post/Fakeparametercollisions1ababselfabPostHeaderParameters.kt +src/main/kotlin/org/openapijsonschematools/client/paths/fakeparametercollisions1ababselfab/post/Fakeparametercollisions1ababselfabPostPathParameters.kt +src/main/kotlin/org/openapijsonschematools/client/paths/fakeparametercollisions1ababselfab/post/Fakeparametercollisions1ababselfabPostQueryParameters.kt +src/main/kotlin/org/openapijsonschematools/client/paths/fakeparametercollisions1ababselfab/post/Fakeparametercollisions1ababselfabPostRequestBody.kt +src/main/kotlin/org/openapijsonschematools/client/paths/fakeparametercollisions1ababselfab/post/Fakeparametercollisions1ababselfabPostResponses.kt +src/main/kotlin/org/openapijsonschematools/client/paths/fakeparametercollisions1ababselfab/post/Parameters.kt +src/main/kotlin/org/openapijsonschematools/client/paths/fakeparametercollisions1ababselfab/post/parameters/Parameter0.kt +src/main/kotlin/org/openapijsonschematools/client/paths/fakeparametercollisions1ababselfab/post/parameters/Parameter1.kt +src/main/kotlin/org/openapijsonschematools/client/paths/fakeparametercollisions1ababselfab/post/parameters/Parameter10.kt +src/main/kotlin/org/openapijsonschematools/client/paths/fakeparametercollisions1ababselfab/post/parameters/Parameter11.kt +src/main/kotlin/org/openapijsonschematools/client/paths/fakeparametercollisions1ababselfab/post/parameters/Parameter12.kt +src/main/kotlin/org/openapijsonschematools/client/paths/fakeparametercollisions1ababselfab/post/parameters/Parameter13.kt +src/main/kotlin/org/openapijsonschematools/client/paths/fakeparametercollisions1ababselfab/post/parameters/Parameter14.kt +src/main/kotlin/org/openapijsonschematools/client/paths/fakeparametercollisions1ababselfab/post/parameters/Parameter15.kt +src/main/kotlin/org/openapijsonschematools/client/paths/fakeparametercollisions1ababselfab/post/parameters/Parameter16.kt +src/main/kotlin/org/openapijsonschematools/client/paths/fakeparametercollisions1ababselfab/post/parameters/Parameter17.kt +src/main/kotlin/org/openapijsonschematools/client/paths/fakeparametercollisions1ababselfab/post/parameters/Parameter18.kt +src/main/kotlin/org/openapijsonschematools/client/paths/fakeparametercollisions1ababselfab/post/parameters/Parameter2.kt +src/main/kotlin/org/openapijsonschematools/client/paths/fakeparametercollisions1ababselfab/post/parameters/Parameter3.kt +src/main/kotlin/org/openapijsonschematools/client/paths/fakeparametercollisions1ababselfab/post/parameters/Parameter4.kt +src/main/kotlin/org/openapijsonschematools/client/paths/fakeparametercollisions1ababselfab/post/parameters/Parameter5.kt +src/main/kotlin/org/openapijsonschematools/client/paths/fakeparametercollisions1ababselfab/post/parameters/Parameter6.kt +src/main/kotlin/org/openapijsonschematools/client/paths/fakeparametercollisions1ababselfab/post/parameters/Parameter7.kt +src/main/kotlin/org/openapijsonschematools/client/paths/fakeparametercollisions1ababselfab/post/parameters/Parameter8.kt +src/main/kotlin/org/openapijsonschematools/client/paths/fakeparametercollisions1ababselfab/post/parameters/Parameter9.kt +src/main/kotlin/org/openapijsonschematools/client/paths/fakeparametercollisions1ababselfab/post/parameters/parameter0/Schema0.kt +src/main/kotlin/org/openapijsonschematools/client/paths/fakeparametercollisions1ababselfab/post/parameters/parameter1/Schema1.kt +src/main/kotlin/org/openapijsonschematools/client/paths/fakeparametercollisions1ababselfab/post/parameters/parameter10/Schema10.kt +src/main/kotlin/org/openapijsonschematools/client/paths/fakeparametercollisions1ababselfab/post/parameters/parameter11/Schema11.kt +src/main/kotlin/org/openapijsonschematools/client/paths/fakeparametercollisions1ababselfab/post/parameters/parameter12/Schema12.kt +src/main/kotlin/org/openapijsonschematools/client/paths/fakeparametercollisions1ababselfab/post/parameters/parameter13/Schema13.kt +src/main/kotlin/org/openapijsonschematools/client/paths/fakeparametercollisions1ababselfab/post/parameters/parameter14/Schema14.kt +src/main/kotlin/org/openapijsonschematools/client/paths/fakeparametercollisions1ababselfab/post/parameters/parameter15/Schema15.kt +src/main/kotlin/org/openapijsonschematools/client/paths/fakeparametercollisions1ababselfab/post/parameters/parameter16/Schema16.kt +src/main/kotlin/org/openapijsonschematools/client/paths/fakeparametercollisions1ababselfab/post/parameters/parameter17/Schema17.kt +src/main/kotlin/org/openapijsonschematools/client/paths/fakeparametercollisions1ababselfab/post/parameters/parameter18/Schema18.kt +src/main/kotlin/org/openapijsonschematools/client/paths/fakeparametercollisions1ababselfab/post/parameters/parameter2/Schema2.kt +src/main/kotlin/org/openapijsonschematools/client/paths/fakeparametercollisions1ababselfab/post/parameters/parameter3/Schema3.kt +src/main/kotlin/org/openapijsonschematools/client/paths/fakeparametercollisions1ababselfab/post/parameters/parameter4/Schema4.kt +src/main/kotlin/org/openapijsonschematools/client/paths/fakeparametercollisions1ababselfab/post/parameters/parameter5/Schema5.kt +src/main/kotlin/org/openapijsonschematools/client/paths/fakeparametercollisions1ababselfab/post/parameters/parameter6/Schema6.kt +src/main/kotlin/org/openapijsonschematools/client/paths/fakeparametercollisions1ababselfab/post/parameters/parameter7/Schema7.kt +src/main/kotlin/org/openapijsonschematools/client/paths/fakeparametercollisions1ababselfab/post/parameters/parameter8/Schema8.kt +src/main/kotlin/org/openapijsonschematools/client/paths/fakeparametercollisions1ababselfab/post/parameters/parameter9/Schema9.kt +src/main/kotlin/org/openapijsonschematools/client/paths/fakeparametercollisions1ababselfab/post/requestbody/content/applicationjson/ApplicationjsonSchema.kt +src/main/kotlin/org/openapijsonschematools/client/paths/fakeparametercollisions1ababselfab/post/responses/Fakeparametercollisions1ababselfabPostCode200Response.kt +src/main/kotlin/org/openapijsonschematools/client/paths/fakeparametercollisions1ababselfab/post/responses/code200response/content/applicationjson/ApplicationjsonSchema.kt +src/main/kotlin/org/openapijsonschematools/client/paths/fakepemcontenttype/FakepemcontenttypeGet.kt +src/main/kotlin/org/openapijsonschematools/client/paths/fakepemcontenttype/get/FakepemcontenttypeGetRequestBody.kt +src/main/kotlin/org/openapijsonschematools/client/paths/fakepemcontenttype/get/FakepemcontenttypeGetResponses.kt +src/main/kotlin/org/openapijsonschematools/client/paths/fakepemcontenttype/get/requestbody/content/applicationxpemfile/ApplicationxpemfileSchema.kt +src/main/kotlin/org/openapijsonschematools/client/paths/fakepemcontenttype/get/responses/FakepemcontenttypeGetCode200Response.kt +src/main/kotlin/org/openapijsonschematools/client/paths/fakepemcontenttype/get/responses/code200response/content/applicationxpemfile/ApplicationxpemfileSchema.kt +src/main/kotlin/org/openapijsonschematools/client/paths/fakepetiduploadimagewithrequiredfile/FakepetiduploadimagewithrequiredfilePost.kt +src/main/kotlin/org/openapijsonschematools/client/paths/fakepetiduploadimagewithrequiredfile/post/FakepetiduploadimagewithrequiredfilePostPathParameters.kt +src/main/kotlin/org/openapijsonschematools/client/paths/fakepetiduploadimagewithrequiredfile/post/FakepetiduploadimagewithrequiredfilePostRequestBody.kt +src/main/kotlin/org/openapijsonschematools/client/paths/fakepetiduploadimagewithrequiredfile/post/FakepetiduploadimagewithrequiredfilePostResponses.kt +src/main/kotlin/org/openapijsonschematools/client/paths/fakepetiduploadimagewithrequiredfile/post/FakepetiduploadimagewithrequiredfilePostSecurityInfo.kt +src/main/kotlin/org/openapijsonschematools/client/paths/fakepetiduploadimagewithrequiredfile/post/Parameters.kt +src/main/kotlin/org/openapijsonschematools/client/paths/fakepetiduploadimagewithrequiredfile/post/parameters/Parameter0.kt +src/main/kotlin/org/openapijsonschematools/client/paths/fakepetiduploadimagewithrequiredfile/post/parameters/parameter0/Schema0.kt +src/main/kotlin/org/openapijsonschematools/client/paths/fakepetiduploadimagewithrequiredfile/post/requestbody/content/multipartformdata/MultipartformdataSchema.kt +src/main/kotlin/org/openapijsonschematools/client/paths/fakepetiduploadimagewithrequiredfile/post/responses/FakepetiduploadimagewithrequiredfilePostCode200Response.kt +src/main/kotlin/org/openapijsonschematools/client/paths/fakepetiduploadimagewithrequiredfile/post/responses/code200response/content/applicationjson/ApplicationjsonSchema.kt +src/main/kotlin/org/openapijsonschematools/client/paths/fakepetiduploadimagewithrequiredfile/post/security/FakepetiduploadimagewithrequiredfilePostSecurityRequirementObject0.kt +src/main/kotlin/org/openapijsonschematools/client/paths/fakequeryparamwithjsoncontenttype/FakequeryparamwithjsoncontenttypeGet.kt +src/main/kotlin/org/openapijsonschematools/client/paths/fakequeryparamwithjsoncontenttype/get/FakequeryparamwithjsoncontenttypeGetQueryParameters.kt +src/main/kotlin/org/openapijsonschematools/client/paths/fakequeryparamwithjsoncontenttype/get/FakequeryparamwithjsoncontenttypeGetResponses.kt +src/main/kotlin/org/openapijsonschematools/client/paths/fakequeryparamwithjsoncontenttype/get/Parameters.kt +src/main/kotlin/org/openapijsonschematools/client/paths/fakequeryparamwithjsoncontenttype/get/parameters/Parameter0.kt +src/main/kotlin/org/openapijsonschematools/client/paths/fakequeryparamwithjsoncontenttype/get/parameters/parameter0/content/applicationjson/Schema0.kt +src/main/kotlin/org/openapijsonschematools/client/paths/fakequeryparamwithjsoncontenttype/get/responses/FakequeryparamwithjsoncontenttypeGetCode200Response.kt +src/main/kotlin/org/openapijsonschematools/client/paths/fakequeryparamwithjsoncontenttype/get/responses/code200response/content/applicationjson/ApplicationjsonSchema.kt +src/main/kotlin/org/openapijsonschematools/client/paths/fakeredirection/FakeredirectionGet.kt +src/main/kotlin/org/openapijsonschematools/client/paths/fakeredirection/get/FakeredirectionGetResponses.kt +src/main/kotlin/org/openapijsonschematools/client/paths/fakeredirection/get/responses/FakeredirectionGetCode303Response.kt +src/main/kotlin/org/openapijsonschematools/client/paths/fakeredirection/get/responses/FakeredirectionGetCode3XXResponse.kt +src/main/kotlin/org/openapijsonschematools/client/paths/fakerefobjinquery/FakerefobjinqueryGet.kt +src/main/kotlin/org/openapijsonschematools/client/paths/fakerefobjinquery/get/FakerefobjinqueryGetQueryParameters.kt +src/main/kotlin/org/openapijsonschematools/client/paths/fakerefobjinquery/get/FakerefobjinqueryGetResponses.kt +src/main/kotlin/org/openapijsonschematools/client/paths/fakerefobjinquery/get/Parameters.kt +src/main/kotlin/org/openapijsonschematools/client/paths/fakerefobjinquery/get/parameters/Parameter0.kt +src/main/kotlin/org/openapijsonschematools/client/paths/fakerefobjinquery/get/parameters/parameter0/Schema0.kt +src/main/kotlin/org/openapijsonschematools/client/paths/fakerefobjinquery/get/responses/FakerefobjinqueryGetCode200Response.kt +src/main/kotlin/org/openapijsonschematools/client/paths/fakerefsarraymodel/FakerefsarraymodelPost.kt +src/main/kotlin/org/openapijsonschematools/client/paths/fakerefsarraymodel/post/FakerefsarraymodelPostRequestBody.kt +src/main/kotlin/org/openapijsonschematools/client/paths/fakerefsarraymodel/post/FakerefsarraymodelPostResponses.kt +src/main/kotlin/org/openapijsonschematools/client/paths/fakerefsarraymodel/post/requestbody/content/applicationjson/ApplicationjsonSchema.kt +src/main/kotlin/org/openapijsonschematools/client/paths/fakerefsarraymodel/post/responses/FakerefsarraymodelPostCode200Response.kt +src/main/kotlin/org/openapijsonschematools/client/paths/fakerefsarraymodel/post/responses/code200response/content/applicationjson/ApplicationjsonSchema.kt +src/main/kotlin/org/openapijsonschematools/client/paths/fakerefsarrayofenums/FakerefsarrayofenumsPost.kt +src/main/kotlin/org/openapijsonschematools/client/paths/fakerefsarrayofenums/post/FakerefsarrayofenumsPostRequestBody.kt +src/main/kotlin/org/openapijsonschematools/client/paths/fakerefsarrayofenums/post/FakerefsarrayofenumsPostResponses.kt +src/main/kotlin/org/openapijsonschematools/client/paths/fakerefsarrayofenums/post/requestbody/content/applicationjson/ApplicationjsonSchema.kt +src/main/kotlin/org/openapijsonschematools/client/paths/fakerefsarrayofenums/post/responses/FakerefsarrayofenumsPostCode200Response.kt +src/main/kotlin/org/openapijsonschematools/client/paths/fakerefsarrayofenums/post/responses/code200response/content/applicationjson/ApplicationjsonSchema.kt +src/main/kotlin/org/openapijsonschematools/client/paths/fakerefsboolean/FakerefsbooleanPost.kt +src/main/kotlin/org/openapijsonschematools/client/paths/fakerefsboolean/post/FakerefsbooleanPostRequestBody.kt +src/main/kotlin/org/openapijsonschematools/client/paths/fakerefsboolean/post/FakerefsbooleanPostResponses.kt +src/main/kotlin/org/openapijsonschematools/client/paths/fakerefsboolean/post/requestbody/content/applicationjson/ApplicationjsonSchema.kt +src/main/kotlin/org/openapijsonschematools/client/paths/fakerefsboolean/post/responses/FakerefsbooleanPostCode200Response.kt +src/main/kotlin/org/openapijsonschematools/client/paths/fakerefsboolean/post/responses/code200response/content/applicationjson/ApplicationjsonSchema.kt +src/main/kotlin/org/openapijsonschematools/client/paths/fakerefscomposedoneofnumberwithvalidations/FakerefscomposedoneofnumberwithvalidationsPost.kt +src/main/kotlin/org/openapijsonschematools/client/paths/fakerefscomposedoneofnumberwithvalidations/post/FakerefscomposedoneofnumberwithvalidationsPostRequestBody.kt +src/main/kotlin/org/openapijsonschematools/client/paths/fakerefscomposedoneofnumberwithvalidations/post/FakerefscomposedoneofnumberwithvalidationsPostResponses.kt +src/main/kotlin/org/openapijsonschematools/client/paths/fakerefscomposedoneofnumberwithvalidations/post/requestbody/content/applicationjson/ApplicationjsonSchema.kt +src/main/kotlin/org/openapijsonschematools/client/paths/fakerefscomposedoneofnumberwithvalidations/post/responses/FakerefscomposedoneofnumberwithvalidationsPostCode200Response.kt +src/main/kotlin/org/openapijsonschematools/client/paths/fakerefscomposedoneofnumberwithvalidations/post/responses/code200response/content/applicationjson/ApplicationjsonSchema.kt +src/main/kotlin/org/openapijsonschematools/client/paths/fakerefsenum/FakerefsenumPost.kt +src/main/kotlin/org/openapijsonschematools/client/paths/fakerefsenum/post/FakerefsenumPostRequestBody.kt +src/main/kotlin/org/openapijsonschematools/client/paths/fakerefsenum/post/FakerefsenumPostResponses.kt +src/main/kotlin/org/openapijsonschematools/client/paths/fakerefsenum/post/requestbody/content/applicationjson/ApplicationjsonSchema.kt +src/main/kotlin/org/openapijsonschematools/client/paths/fakerefsenum/post/responses/FakerefsenumPostCode200Response.kt +src/main/kotlin/org/openapijsonschematools/client/paths/fakerefsenum/post/responses/code200response/content/applicationjson/ApplicationjsonSchema.kt +src/main/kotlin/org/openapijsonschematools/client/paths/fakerefsmammal/FakerefsmammalPost.kt +src/main/kotlin/org/openapijsonschematools/client/paths/fakerefsmammal/post/FakerefsmammalPostRequestBody.kt +src/main/kotlin/org/openapijsonschematools/client/paths/fakerefsmammal/post/FakerefsmammalPostResponses.kt +src/main/kotlin/org/openapijsonschematools/client/paths/fakerefsmammal/post/requestbody/content/applicationjson/ApplicationjsonSchema.kt +src/main/kotlin/org/openapijsonschematools/client/paths/fakerefsmammal/post/responses/FakerefsmammalPostCode200Response.kt +src/main/kotlin/org/openapijsonschematools/client/paths/fakerefsmammal/post/responses/code200response/content/applicationjson/ApplicationjsonSchema.kt +src/main/kotlin/org/openapijsonschematools/client/paths/fakerefsnumber/FakerefsnumberPost.kt +src/main/kotlin/org/openapijsonschematools/client/paths/fakerefsnumber/post/FakerefsnumberPostRequestBody.kt +src/main/kotlin/org/openapijsonschematools/client/paths/fakerefsnumber/post/FakerefsnumberPostResponses.kt +src/main/kotlin/org/openapijsonschematools/client/paths/fakerefsnumber/post/requestbody/content/applicationjson/ApplicationjsonSchema.kt +src/main/kotlin/org/openapijsonschematools/client/paths/fakerefsnumber/post/responses/FakerefsnumberPostCode200Response.kt +src/main/kotlin/org/openapijsonschematools/client/paths/fakerefsnumber/post/responses/code200response/content/applicationjson/ApplicationjsonSchema.kt +src/main/kotlin/org/openapijsonschematools/client/paths/fakerefsobjectmodelwithrefprops/FakerefsobjectmodelwithrefpropsPost.kt +src/main/kotlin/org/openapijsonschematools/client/paths/fakerefsobjectmodelwithrefprops/post/FakerefsobjectmodelwithrefpropsPostRequestBody.kt +src/main/kotlin/org/openapijsonschematools/client/paths/fakerefsobjectmodelwithrefprops/post/FakerefsobjectmodelwithrefpropsPostResponses.kt +src/main/kotlin/org/openapijsonschematools/client/paths/fakerefsobjectmodelwithrefprops/post/requestbody/content/applicationjson/ApplicationjsonSchema.kt +src/main/kotlin/org/openapijsonschematools/client/paths/fakerefsobjectmodelwithrefprops/post/responses/FakerefsobjectmodelwithrefpropsPostCode200Response.kt +src/main/kotlin/org/openapijsonschematools/client/paths/fakerefsobjectmodelwithrefprops/post/responses/code200response/content/applicationjson/ApplicationjsonSchema.kt +src/main/kotlin/org/openapijsonschematools/client/paths/fakerefsstring/FakerefsstringPost.kt +src/main/kotlin/org/openapijsonschematools/client/paths/fakerefsstring/post/FakerefsstringPostRequestBody.kt +src/main/kotlin/org/openapijsonschematools/client/paths/fakerefsstring/post/FakerefsstringPostResponses.kt +src/main/kotlin/org/openapijsonschematools/client/paths/fakerefsstring/post/requestbody/content/applicationjson/ApplicationjsonSchema.kt +src/main/kotlin/org/openapijsonschematools/client/paths/fakerefsstring/post/responses/FakerefsstringPostCode200Response.kt +src/main/kotlin/org/openapijsonschematools/client/paths/fakerefsstring/post/responses/code200response/content/applicationjson/ApplicationjsonSchema.kt +src/main/kotlin/org/openapijsonschematools/client/paths/fakeresponsewithoutschema/FakeresponsewithoutschemaGet.kt +src/main/kotlin/org/openapijsonschematools/client/paths/fakeresponsewithoutschema/get/FakeresponsewithoutschemaGetResponses.kt +src/main/kotlin/org/openapijsonschematools/client/paths/fakeresponsewithoutschema/get/responses/FakeresponsewithoutschemaGetCode200Response.kt +src/main/kotlin/org/openapijsonschematools/client/paths/faketestqueryparamters/FaketestqueryparamtersPut.kt +src/main/kotlin/org/openapijsonschematools/client/paths/faketestqueryparamters/put/FaketestqueryparamtersPutQueryParameters.kt +src/main/kotlin/org/openapijsonschematools/client/paths/faketestqueryparamters/put/FaketestqueryparamtersPutResponses.kt +src/main/kotlin/org/openapijsonschematools/client/paths/faketestqueryparamters/put/Parameters.kt +src/main/kotlin/org/openapijsonschematools/client/paths/faketestqueryparamters/put/parameters/Parameter0.kt +src/main/kotlin/org/openapijsonschematools/client/paths/faketestqueryparamters/put/parameters/Parameter1.kt +src/main/kotlin/org/openapijsonschematools/client/paths/faketestqueryparamters/put/parameters/Parameter2.kt +src/main/kotlin/org/openapijsonschematools/client/paths/faketestqueryparamters/put/parameters/Parameter3.kt +src/main/kotlin/org/openapijsonschematools/client/paths/faketestqueryparamters/put/parameters/Parameter4.kt +src/main/kotlin/org/openapijsonschematools/client/paths/faketestqueryparamters/put/parameters/Parameter5.kt +src/main/kotlin/org/openapijsonschematools/client/paths/faketestqueryparamters/put/parameters/parameter0/Schema0.kt +src/main/kotlin/org/openapijsonschematools/client/paths/faketestqueryparamters/put/parameters/parameter1/Schema1.kt +src/main/kotlin/org/openapijsonschematools/client/paths/faketestqueryparamters/put/parameters/parameter2/Schema2.kt +src/main/kotlin/org/openapijsonschematools/client/paths/faketestqueryparamters/put/parameters/parameter3/Schema3.kt +src/main/kotlin/org/openapijsonschematools/client/paths/faketestqueryparamters/put/parameters/parameter4/Schema4.kt +src/main/kotlin/org/openapijsonschematools/client/paths/faketestqueryparamters/put/parameters/parameter5/Schema5.kt +src/main/kotlin/org/openapijsonschematools/client/paths/faketestqueryparamters/put/responses/FaketestqueryparamtersPutCode200Response.kt +src/main/kotlin/org/openapijsonschematools/client/paths/fakeuploaddownloadfile/FakeuploaddownloadfilePost.kt +src/main/kotlin/org/openapijsonschematools/client/paths/fakeuploaddownloadfile/post/FakeuploaddownloadfilePostRequestBody.kt +src/main/kotlin/org/openapijsonschematools/client/paths/fakeuploaddownloadfile/post/FakeuploaddownloadfilePostResponses.kt +src/main/kotlin/org/openapijsonschematools/client/paths/fakeuploaddownloadfile/post/requestbody/content/applicationoctetstream/ApplicationoctetstreamSchema.kt +src/main/kotlin/org/openapijsonschematools/client/paths/fakeuploaddownloadfile/post/responses/FakeuploaddownloadfilePostCode200Response.kt +src/main/kotlin/org/openapijsonschematools/client/paths/fakeuploaddownloadfile/post/responses/code200response/content/applicationoctetstream/ApplicationoctetstreamSchema.kt +src/main/kotlin/org/openapijsonschematools/client/paths/fakeuploadfile/FakeuploadfilePost.kt +src/main/kotlin/org/openapijsonschematools/client/paths/fakeuploadfile/post/FakeuploadfilePostRequestBody.kt +src/main/kotlin/org/openapijsonschematools/client/paths/fakeuploadfile/post/FakeuploadfilePostResponses.kt +src/main/kotlin/org/openapijsonschematools/client/paths/fakeuploadfile/post/requestbody/content/multipartformdata/MultipartformdataSchema.kt +src/main/kotlin/org/openapijsonschematools/client/paths/fakeuploadfile/post/responses/FakeuploadfilePostCode200Response.kt +src/main/kotlin/org/openapijsonschematools/client/paths/fakeuploadfile/post/responses/code200response/content/applicationjson/ApplicationjsonSchema.kt +src/main/kotlin/org/openapijsonschematools/client/paths/fakeuploadfiles/FakeuploadfilesPost.kt +src/main/kotlin/org/openapijsonschematools/client/paths/fakeuploadfiles/post/FakeuploadfilesPostRequestBody.kt +src/main/kotlin/org/openapijsonschematools/client/paths/fakeuploadfiles/post/FakeuploadfilesPostResponses.kt +src/main/kotlin/org/openapijsonschematools/client/paths/fakeuploadfiles/post/requestbody/content/multipartformdata/MultipartformdataSchema.kt +src/main/kotlin/org/openapijsonschematools/client/paths/fakeuploadfiles/post/responses/FakeuploadfilesPostCode200Response.kt +src/main/kotlin/org/openapijsonschematools/client/paths/fakeuploadfiles/post/responses/code200response/content/applicationjson/ApplicationjsonSchema.kt +src/main/kotlin/org/openapijsonschematools/client/paths/fakewildcardresponses/FakewildcardresponsesGet.kt +src/main/kotlin/org/openapijsonschematools/client/paths/fakewildcardresponses/get/FakewildcardresponsesGetResponses.kt +src/main/kotlin/org/openapijsonschematools/client/paths/fakewildcardresponses/get/responses/FakewildcardresponsesGetCode1XXResponse.kt +src/main/kotlin/org/openapijsonschematools/client/paths/fakewildcardresponses/get/responses/FakewildcardresponsesGetCode200Response.kt +src/main/kotlin/org/openapijsonschematools/client/paths/fakewildcardresponses/get/responses/FakewildcardresponsesGetCode2XXResponse.kt +src/main/kotlin/org/openapijsonschematools/client/paths/fakewildcardresponses/get/responses/FakewildcardresponsesGetCode3XXResponse.kt +src/main/kotlin/org/openapijsonschematools/client/paths/fakewildcardresponses/get/responses/FakewildcardresponsesGetCode4XXResponse.kt +src/main/kotlin/org/openapijsonschematools/client/paths/fakewildcardresponses/get/responses/FakewildcardresponsesGetCode5XXResponse.kt +src/main/kotlin/org/openapijsonschematools/client/paths/fakewildcardresponses/get/responses/code1xxresponse/content/applicationjson/ApplicationjsonSchema.kt +src/main/kotlin/org/openapijsonschematools/client/paths/fakewildcardresponses/get/responses/code200response/content/applicationjson/ApplicationjsonSchema.kt +src/main/kotlin/org/openapijsonschematools/client/paths/fakewildcardresponses/get/responses/code2xxresponse/content/applicationjson/ApplicationjsonSchema.kt +src/main/kotlin/org/openapijsonschematools/client/paths/fakewildcardresponses/get/responses/code3xxresponse/content/applicationjson/ApplicationjsonSchema.kt +src/main/kotlin/org/openapijsonschematools/client/paths/fakewildcardresponses/get/responses/code4xxresponse/content/applicationjson/ApplicationjsonSchema.kt +src/main/kotlin/org/openapijsonschematools/client/paths/fakewildcardresponses/get/responses/code5xxresponse/content/applicationjson/ApplicationjsonSchema.kt +src/main/kotlin/org/openapijsonschematools/client/paths/foo/FooGet.kt +src/main/kotlin/org/openapijsonschematools/client/paths/foo/get/FooGetResponses.kt +src/main/kotlin/org/openapijsonschematools/client/paths/foo/get/FooGetServerInfo.kt +src/main/kotlin/org/openapijsonschematools/client/paths/foo/get/responses/FooGetCodedefaultResponse.kt +src/main/kotlin/org/openapijsonschematools/client/paths/foo/get/responses/codedefaultresponse/content/applicationjson/ApplicationjsonSchema.kt +src/main/kotlin/org/openapijsonschematools/client/paths/foo/get/servers/FooGetServer0.kt +src/main/kotlin/org/openapijsonschematools/client/paths/foo/get/servers/FooGetServer1.kt +src/main/kotlin/org/openapijsonschematools/client/paths/foo/get/servers/server1/FooGetServer1Variables.kt +src/main/kotlin/org/openapijsonschematools/client/paths/pet/PetPost.kt +src/main/kotlin/org/openapijsonschematools/client/paths/pet/PetPut.kt +src/main/kotlin/org/openapijsonschematools/client/paths/pet/post/PetPostRequestBody.kt +src/main/kotlin/org/openapijsonschematools/client/paths/pet/post/PetPostResponses.kt +src/main/kotlin/org/openapijsonschematools/client/paths/pet/post/PetPostSecurityInfo.kt +src/main/kotlin/org/openapijsonschematools/client/paths/pet/post/responses/PetPostCode200Response.kt +src/main/kotlin/org/openapijsonschematools/client/paths/pet/post/responses/PetPostCode405Response.kt +src/main/kotlin/org/openapijsonschematools/client/paths/pet/post/security/PetPostSecurityRequirementObject0.kt +src/main/kotlin/org/openapijsonschematools/client/paths/pet/post/security/PetPostSecurityRequirementObject1.kt +src/main/kotlin/org/openapijsonschematools/client/paths/pet/post/security/PetPostSecurityRequirementObject2.kt +src/main/kotlin/org/openapijsonschematools/client/paths/pet/put/PetPutRequestBody.kt +src/main/kotlin/org/openapijsonschematools/client/paths/pet/put/PetPutResponses.kt +src/main/kotlin/org/openapijsonschematools/client/paths/pet/put/PetPutSecurityInfo.kt +src/main/kotlin/org/openapijsonschematools/client/paths/pet/put/responses/PetPutCode400Response.kt +src/main/kotlin/org/openapijsonschematools/client/paths/pet/put/responses/PetPutCode404Response.kt +src/main/kotlin/org/openapijsonschematools/client/paths/pet/put/responses/PetPutCode405Response.kt +src/main/kotlin/org/openapijsonschematools/client/paths/pet/put/security/PetPutSecurityRequirementObject0.kt +src/main/kotlin/org/openapijsonschematools/client/paths/pet/put/security/PetPutSecurityRequirementObject1.kt +src/main/kotlin/org/openapijsonschematools/client/paths/petfindbystatus/PetfindbystatusGet.kt +src/main/kotlin/org/openapijsonschematools/client/paths/petfindbystatus/PetfindbystatusServerInfo.kt +src/main/kotlin/org/openapijsonschematools/client/paths/petfindbystatus/get/Parameters.kt +src/main/kotlin/org/openapijsonschematools/client/paths/petfindbystatus/get/PetfindbystatusGetQueryParameters.kt +src/main/kotlin/org/openapijsonschematools/client/paths/petfindbystatus/get/PetfindbystatusGetResponses.kt +src/main/kotlin/org/openapijsonschematools/client/paths/petfindbystatus/get/PetfindbystatusGetSecurityInfo.kt +src/main/kotlin/org/openapijsonschematools/client/paths/petfindbystatus/get/parameters/Parameter0.kt +src/main/kotlin/org/openapijsonschematools/client/paths/petfindbystatus/get/parameters/parameter0/Schema0.kt +src/main/kotlin/org/openapijsonschematools/client/paths/petfindbystatus/get/responses/PetfindbystatusGetCode200Response.kt +src/main/kotlin/org/openapijsonschematools/client/paths/petfindbystatus/get/responses/PetfindbystatusGetCode400Response.kt +src/main/kotlin/org/openapijsonschematools/client/paths/petfindbystatus/get/security/PetfindbystatusGetSecurityRequirementObject0.kt +src/main/kotlin/org/openapijsonschematools/client/paths/petfindbystatus/get/security/PetfindbystatusGetSecurityRequirementObject1.kt +src/main/kotlin/org/openapijsonschematools/client/paths/petfindbystatus/get/security/PetfindbystatusGetSecurityRequirementObject2.kt +src/main/kotlin/org/openapijsonschematools/client/paths/petfindbystatus/servers/PetfindbystatusServer0.kt +src/main/kotlin/org/openapijsonschematools/client/paths/petfindbystatus/servers/PetfindbystatusServer1.kt +src/main/kotlin/org/openapijsonschematools/client/paths/petfindbystatus/servers/server1/PetfindbystatusServer1Variables.kt +src/main/kotlin/org/openapijsonschematools/client/paths/petfindbytags/PetfindbytagsGet.kt +src/main/kotlin/org/openapijsonschematools/client/paths/petfindbytags/get/Parameters.kt +src/main/kotlin/org/openapijsonschematools/client/paths/petfindbytags/get/PetfindbytagsGetQueryParameters.kt +src/main/kotlin/org/openapijsonschematools/client/paths/petfindbytags/get/PetfindbytagsGetResponses.kt +src/main/kotlin/org/openapijsonschematools/client/paths/petfindbytags/get/PetfindbytagsGetSecurityInfo.kt +src/main/kotlin/org/openapijsonschematools/client/paths/petfindbytags/get/parameters/Parameter0.kt +src/main/kotlin/org/openapijsonschematools/client/paths/petfindbytags/get/parameters/parameter0/Schema0.kt +src/main/kotlin/org/openapijsonschematools/client/paths/petfindbytags/get/responses/PetfindbytagsGetCode200Response.kt +src/main/kotlin/org/openapijsonschematools/client/paths/petfindbytags/get/responses/PetfindbytagsGetCode400Response.kt +src/main/kotlin/org/openapijsonschematools/client/paths/petfindbytags/get/security/PetfindbytagsGetSecurityRequirementObject0.kt +src/main/kotlin/org/openapijsonschematools/client/paths/petfindbytags/get/security/PetfindbytagsGetSecurityRequirementObject1.kt +src/main/kotlin/org/openapijsonschematools/client/paths/petpetid/PetpetidDelete.kt +src/main/kotlin/org/openapijsonschematools/client/paths/petpetid/PetpetidGet.kt +src/main/kotlin/org/openapijsonschematools/client/paths/petpetid/PetpetidPost.kt +src/main/kotlin/org/openapijsonschematools/client/paths/petpetid/delete/Parameters.kt +src/main/kotlin/org/openapijsonschematools/client/paths/petpetid/delete/PetpetidDeleteHeaderParameters.kt +src/main/kotlin/org/openapijsonschematools/client/paths/petpetid/delete/PetpetidDeletePathParameters.kt +src/main/kotlin/org/openapijsonschematools/client/paths/petpetid/delete/PetpetidDeleteResponses.kt +src/main/kotlin/org/openapijsonschematools/client/paths/petpetid/delete/PetpetidDeleteSecurityInfo.kt +src/main/kotlin/org/openapijsonschematools/client/paths/petpetid/delete/parameters/Parameter0.kt +src/main/kotlin/org/openapijsonschematools/client/paths/petpetid/delete/parameters/Parameter1.kt +src/main/kotlin/org/openapijsonschematools/client/paths/petpetid/delete/parameters/parameter0/Schema0.kt +src/main/kotlin/org/openapijsonschematools/client/paths/petpetid/delete/parameters/parameter1/Schema1.kt +src/main/kotlin/org/openapijsonschematools/client/paths/petpetid/delete/responses/PetpetidDeleteCode400Response.kt +src/main/kotlin/org/openapijsonschematools/client/paths/petpetid/delete/security/PetpetidDeleteSecurityRequirementObject0.kt +src/main/kotlin/org/openapijsonschematools/client/paths/petpetid/delete/security/PetpetidDeleteSecurityRequirementObject1.kt +src/main/kotlin/org/openapijsonschematools/client/paths/petpetid/get/Parameters.kt +src/main/kotlin/org/openapijsonschematools/client/paths/petpetid/get/PetpetidGetPathParameters.kt +src/main/kotlin/org/openapijsonschematools/client/paths/petpetid/get/PetpetidGetResponses.kt +src/main/kotlin/org/openapijsonschematools/client/paths/petpetid/get/PetpetidGetSecurityInfo.kt +src/main/kotlin/org/openapijsonschematools/client/paths/petpetid/get/parameters/Parameter0.kt +src/main/kotlin/org/openapijsonschematools/client/paths/petpetid/get/parameters/parameter0/Schema0.kt +src/main/kotlin/org/openapijsonschematools/client/paths/petpetid/get/responses/PetpetidGetCode200Response.kt +src/main/kotlin/org/openapijsonschematools/client/paths/petpetid/get/responses/PetpetidGetCode400Response.kt +src/main/kotlin/org/openapijsonschematools/client/paths/petpetid/get/responses/PetpetidGetCode404Response.kt +src/main/kotlin/org/openapijsonschematools/client/paths/petpetid/get/responses/code200response/content/applicationjson/ApplicationjsonSchema.kt +src/main/kotlin/org/openapijsonschematools/client/paths/petpetid/get/responses/code200response/content/applicationxml/ApplicationxmlSchema.kt +src/main/kotlin/org/openapijsonschematools/client/paths/petpetid/get/security/PetpetidGetSecurityRequirementObject0.kt +src/main/kotlin/org/openapijsonschematools/client/paths/petpetid/post/Parameters.kt +src/main/kotlin/org/openapijsonschematools/client/paths/petpetid/post/PetpetidPostPathParameters.kt +src/main/kotlin/org/openapijsonschematools/client/paths/petpetid/post/PetpetidPostRequestBody.kt +src/main/kotlin/org/openapijsonschematools/client/paths/petpetid/post/PetpetidPostResponses.kt +src/main/kotlin/org/openapijsonschematools/client/paths/petpetid/post/PetpetidPostSecurityInfo.kt +src/main/kotlin/org/openapijsonschematools/client/paths/petpetid/post/parameters/Parameter0.kt +src/main/kotlin/org/openapijsonschematools/client/paths/petpetid/post/parameters/parameter0/Schema0.kt +src/main/kotlin/org/openapijsonschematools/client/paths/petpetid/post/requestbody/content/applicationxwwwformurlencoded/ApplicationxwwwformurlencodedSchema.kt +src/main/kotlin/org/openapijsonschematools/client/paths/petpetid/post/responses/PetpetidPostCode405Response.kt +src/main/kotlin/org/openapijsonschematools/client/paths/petpetid/post/security/PetpetidPostSecurityRequirementObject0.kt +src/main/kotlin/org/openapijsonschematools/client/paths/petpetid/post/security/PetpetidPostSecurityRequirementObject1.kt +src/main/kotlin/org/openapijsonschematools/client/paths/petpetiduploadimage/PetpetiduploadimagePost.kt +src/main/kotlin/org/openapijsonschematools/client/paths/petpetiduploadimage/post/Parameters.kt +src/main/kotlin/org/openapijsonschematools/client/paths/petpetiduploadimage/post/PetpetiduploadimagePostPathParameters.kt +src/main/kotlin/org/openapijsonschematools/client/paths/petpetiduploadimage/post/PetpetiduploadimagePostRequestBody.kt +src/main/kotlin/org/openapijsonschematools/client/paths/petpetiduploadimage/post/PetpetiduploadimagePostResponses.kt +src/main/kotlin/org/openapijsonschematools/client/paths/petpetiduploadimage/post/PetpetiduploadimagePostSecurityInfo.kt +src/main/kotlin/org/openapijsonschematools/client/paths/petpetiduploadimage/post/parameters/Parameter0.kt +src/main/kotlin/org/openapijsonschematools/client/paths/petpetiduploadimage/post/parameters/parameter0/Schema0.kt +src/main/kotlin/org/openapijsonschematools/client/paths/petpetiduploadimage/post/requestbody/content/multipartformdata/MultipartformdataSchema.kt +src/main/kotlin/org/openapijsonschematools/client/paths/petpetiduploadimage/post/responses/PetpetiduploadimagePostCode200Response.kt +src/main/kotlin/org/openapijsonschematools/client/paths/petpetiduploadimage/post/security/PetpetiduploadimagePostSecurityRequirementObject0.kt +src/main/kotlin/org/openapijsonschematools/client/paths/solidus/SolidusGet.kt +src/main/kotlin/org/openapijsonschematools/client/paths/solidus/get/SolidusGetResponses.kt +src/main/kotlin/org/openapijsonschematools/client/paths/solidus/get/responses/SolidusGetCode200Response.kt +src/main/kotlin/org/openapijsonschematools/client/paths/storeinventory/StoreinventoryGet.kt +src/main/kotlin/org/openapijsonschematools/client/paths/storeinventory/get/StoreinventoryGetResponses.kt +src/main/kotlin/org/openapijsonschematools/client/paths/storeinventory/get/StoreinventoryGetSecurityInfo.kt +src/main/kotlin/org/openapijsonschematools/client/paths/storeinventory/get/responses/StoreinventoryGetCode200Response.kt +src/main/kotlin/org/openapijsonschematools/client/paths/storeinventory/get/security/StoreinventoryGetSecurityRequirementObject0.kt +src/main/kotlin/org/openapijsonschematools/client/paths/storeorder/StoreorderPost.kt +src/main/kotlin/org/openapijsonschematools/client/paths/storeorder/post/StoreorderPostRequestBody.kt +src/main/kotlin/org/openapijsonschematools/client/paths/storeorder/post/StoreorderPostResponses.kt +src/main/kotlin/org/openapijsonschematools/client/paths/storeorder/post/requestbody/content/applicationjson/ApplicationjsonSchema.kt +src/main/kotlin/org/openapijsonschematools/client/paths/storeorder/post/responses/StoreorderPostCode200Response.kt +src/main/kotlin/org/openapijsonschematools/client/paths/storeorder/post/responses/StoreorderPostCode400Response.kt +src/main/kotlin/org/openapijsonschematools/client/paths/storeorder/post/responses/code200response/content/applicationjson/ApplicationjsonSchema.kt +src/main/kotlin/org/openapijsonschematools/client/paths/storeorder/post/responses/code200response/content/applicationxml/ApplicationxmlSchema.kt +src/main/kotlin/org/openapijsonschematools/client/paths/storeorderorderid/StoreorderorderidDelete.kt +src/main/kotlin/org/openapijsonschematools/client/paths/storeorderorderid/StoreorderorderidGet.kt +src/main/kotlin/org/openapijsonschematools/client/paths/storeorderorderid/delete/Parameters.kt +src/main/kotlin/org/openapijsonschematools/client/paths/storeorderorderid/delete/StoreorderorderidDeletePathParameters.kt +src/main/kotlin/org/openapijsonschematools/client/paths/storeorderorderid/delete/StoreorderorderidDeleteResponses.kt +src/main/kotlin/org/openapijsonschematools/client/paths/storeorderorderid/delete/parameters/Parameter0.kt +src/main/kotlin/org/openapijsonschematools/client/paths/storeorderorderid/delete/parameters/parameter0/Schema0.kt +src/main/kotlin/org/openapijsonschematools/client/paths/storeorderorderid/delete/responses/StoreorderorderidDeleteCode400Response.kt +src/main/kotlin/org/openapijsonschematools/client/paths/storeorderorderid/delete/responses/StoreorderorderidDeleteCode404Response.kt +src/main/kotlin/org/openapijsonschematools/client/paths/storeorderorderid/get/Parameters.kt +src/main/kotlin/org/openapijsonschematools/client/paths/storeorderorderid/get/StoreorderorderidGetPathParameters.kt +src/main/kotlin/org/openapijsonschematools/client/paths/storeorderorderid/get/StoreorderorderidGetResponses.kt +src/main/kotlin/org/openapijsonschematools/client/paths/storeorderorderid/get/parameters/Parameter0.kt +src/main/kotlin/org/openapijsonschematools/client/paths/storeorderorderid/get/parameters/parameter0/Schema0.kt +src/main/kotlin/org/openapijsonschematools/client/paths/storeorderorderid/get/responses/StoreorderorderidGetCode200Response.kt +src/main/kotlin/org/openapijsonschematools/client/paths/storeorderorderid/get/responses/StoreorderorderidGetCode400Response.kt +src/main/kotlin/org/openapijsonschematools/client/paths/storeorderorderid/get/responses/StoreorderorderidGetCode404Response.kt +src/main/kotlin/org/openapijsonschematools/client/paths/storeorderorderid/get/responses/code200response/content/applicationjson/ApplicationjsonSchema.kt +src/main/kotlin/org/openapijsonschematools/client/paths/storeorderorderid/get/responses/code200response/content/applicationxml/ApplicationxmlSchema.kt +src/main/kotlin/org/openapijsonschematools/client/paths/user/UserPost.kt +src/main/kotlin/org/openapijsonschematools/client/paths/user/post/UserPostRequestBody.kt +src/main/kotlin/org/openapijsonschematools/client/paths/user/post/UserPostResponses.kt +src/main/kotlin/org/openapijsonschematools/client/paths/user/post/requestbody/content/applicationjson/ApplicationjsonSchema.kt +src/main/kotlin/org/openapijsonschematools/client/paths/user/post/responses/UserPostCodedefaultResponse.kt +src/main/kotlin/org/openapijsonschematools/client/paths/usercreatewitharray/UsercreatewitharrayPost.kt +src/main/kotlin/org/openapijsonschematools/client/paths/usercreatewitharray/post/UsercreatewitharrayPostRequestBody.kt +src/main/kotlin/org/openapijsonschematools/client/paths/usercreatewitharray/post/UsercreatewitharrayPostResponses.kt +src/main/kotlin/org/openapijsonschematools/client/paths/usercreatewitharray/post/responses/UsercreatewitharrayPostCodedefaultResponse.kt +src/main/kotlin/org/openapijsonschematools/client/paths/usercreatewithlist/UsercreatewithlistPost.kt +src/main/kotlin/org/openapijsonschematools/client/paths/usercreatewithlist/post/UsercreatewithlistPostRequestBody.kt +src/main/kotlin/org/openapijsonschematools/client/paths/usercreatewithlist/post/UsercreatewithlistPostResponses.kt +src/main/kotlin/org/openapijsonschematools/client/paths/usercreatewithlist/post/responses/UsercreatewithlistPostCodedefaultResponse.kt +src/main/kotlin/org/openapijsonschematools/client/paths/userlogin/UserloginGet.kt +src/main/kotlin/org/openapijsonschematools/client/paths/userlogin/get/Parameters.kt +src/main/kotlin/org/openapijsonschematools/client/paths/userlogin/get/UserloginGetQueryParameters.kt +src/main/kotlin/org/openapijsonschematools/client/paths/userlogin/get/UserloginGetResponses.kt +src/main/kotlin/org/openapijsonschematools/client/paths/userlogin/get/parameters/Parameter0.kt +src/main/kotlin/org/openapijsonschematools/client/paths/userlogin/get/parameters/Parameter1.kt +src/main/kotlin/org/openapijsonschematools/client/paths/userlogin/get/parameters/parameter0/Schema0.kt +src/main/kotlin/org/openapijsonschematools/client/paths/userlogin/get/parameters/parameter1/Schema1.kt +src/main/kotlin/org/openapijsonschematools/client/paths/userlogin/get/responses/UserloginGetCode200Response.kt +src/main/kotlin/org/openapijsonschematools/client/paths/userlogin/get/responses/UserloginGetCode400Response.kt +src/main/kotlin/org/openapijsonschematools/client/paths/userlogin/get/responses/code200response/Headers.kt +src/main/kotlin/org/openapijsonschematools/client/paths/userlogin/get/responses/code200response/UserloginGetCode200ResponseHeadersSchema.kt +src/main/kotlin/org/openapijsonschematools/client/paths/userlogin/get/responses/code200response/content/applicationjson/ApplicationjsonSchema.kt +src/main/kotlin/org/openapijsonschematools/client/paths/userlogin/get/responses/code200response/content/applicationxml/ApplicationxmlSchema.kt +src/main/kotlin/org/openapijsonschematools/client/paths/userlogin/get/responses/code200response/headers/Int32.kt +src/main/kotlin/org/openapijsonschematools/client/paths/userlogin/get/responses/code200response/headers/NumberHeader.kt +src/main/kotlin/org/openapijsonschematools/client/paths/userlogin/get/responses/code200response/headers/Refcontentschemaheader.kt +src/main/kotlin/org/openapijsonschematools/client/paths/userlogin/get/responses/code200response/headers/XExpiresAfter.kt +src/main/kotlin/org/openapijsonschematools/client/paths/userlogin/get/responses/code200response/headers/XRateLimit.kt +src/main/kotlin/org/openapijsonschematools/client/paths/userlogin/get/responses/code200response/headers/xexpiresafter/XExpiresAfterSchema.kt +src/main/kotlin/org/openapijsonschematools/client/paths/userlogin/get/responses/code200response/headers/xratelimit/content/applicationjson/XRateLimitSchema.kt +src/main/kotlin/org/openapijsonschematools/client/paths/userlogout/UserlogoutGet.kt +src/main/kotlin/org/openapijsonschematools/client/paths/userlogout/get/UserlogoutGetResponses.kt +src/main/kotlin/org/openapijsonschematools/client/paths/userlogout/get/responses/UserlogoutGetCodedefaultResponse.kt +src/main/kotlin/org/openapijsonschematools/client/paths/userusername/UserusernameDelete.kt +src/main/kotlin/org/openapijsonschematools/client/paths/userusername/UserusernameGet.kt +src/main/kotlin/org/openapijsonschematools/client/paths/userusername/UserusernamePut.kt +src/main/kotlin/org/openapijsonschematools/client/paths/userusername/delete/Parameters.kt +src/main/kotlin/org/openapijsonschematools/client/paths/userusername/delete/UserusernameDeletePathParameters.kt +src/main/kotlin/org/openapijsonschematools/client/paths/userusername/delete/UserusernameDeleteResponses.kt +src/main/kotlin/org/openapijsonschematools/client/paths/userusername/delete/parameters/Parameter0.kt +src/main/kotlin/org/openapijsonschematools/client/paths/userusername/delete/responses/UserusernameDeleteCode200Response.kt +src/main/kotlin/org/openapijsonschematools/client/paths/userusername/delete/responses/UserusernameDeleteCode404Response.kt +src/main/kotlin/org/openapijsonschematools/client/paths/userusername/get/Parameters.kt +src/main/kotlin/org/openapijsonschematools/client/paths/userusername/get/UserusernameGetPathParameters.kt +src/main/kotlin/org/openapijsonschematools/client/paths/userusername/get/UserusernameGetResponses.kt +src/main/kotlin/org/openapijsonschematools/client/paths/userusername/get/parameters/Parameter0.kt +src/main/kotlin/org/openapijsonschematools/client/paths/userusername/get/responses/UserusernameGetCode200Response.kt +src/main/kotlin/org/openapijsonschematools/client/paths/userusername/get/responses/UserusernameGetCode400Response.kt +src/main/kotlin/org/openapijsonschematools/client/paths/userusername/get/responses/UserusernameGetCode404Response.kt +src/main/kotlin/org/openapijsonschematools/client/paths/userusername/get/responses/code200response/content/applicationjson/ApplicationjsonSchema.kt +src/main/kotlin/org/openapijsonschematools/client/paths/userusername/get/responses/code200response/content/applicationxml/ApplicationxmlSchema.kt +src/main/kotlin/org/openapijsonschematools/client/paths/userusername/put/Parameters.kt +src/main/kotlin/org/openapijsonschematools/client/paths/userusername/put/UserusernamePutPathParameters.kt +src/main/kotlin/org/openapijsonschematools/client/paths/userusername/put/UserusernamePutRequestBody.kt +src/main/kotlin/org/openapijsonschematools/client/paths/userusername/put/UserusernamePutResponses.kt +src/main/kotlin/org/openapijsonschematools/client/paths/userusername/put/parameters/Parameter0.kt +src/main/kotlin/org/openapijsonschematools/client/paths/userusername/put/requestbody/content/applicationjson/ApplicationjsonSchema.kt +src/main/kotlin/org/openapijsonschematools/client/paths/userusername/put/responses/UserusernamePutCode400Response.kt +src/main/kotlin/org/openapijsonschematools/client/paths/userusername/put/responses/UserusernamePutCode404Response.kt +src/main/kotlin/org/openapijsonschematools/client/requestbody/GenericRequestBody.kt +src/main/kotlin/org/openapijsonschematools/client/requestbody/RequestBodySerializer.kt +src/main/kotlin/org/openapijsonschematools/client/requestbody/SerializedRequestBody.kt +src/main/kotlin/org/openapijsonschematools/client/response/ApiResponse.kt +src/main/kotlin/org/openapijsonschematools/client/response/DeserializedHttpResponse.kt +src/main/kotlin/org/openapijsonschematools/client/response/HeadersDeserializer.kt +src/main/kotlin/org/openapijsonschematools/client/response/ResponseDeserializer.kt +src/main/kotlin/org/openapijsonschematools/client/response/ResponsesDeserializer.kt +src/main/kotlin/org/openapijsonschematools/client/restclient/RestClient.kt +src/main/kotlin/org/openapijsonschematools/client/schemas/AnyTypeJsonSchema.kt +src/main/kotlin/org/openapijsonschematools/client/schemas/BooleanJsonSchema.kt +src/main/kotlin/org/openapijsonschematools/client/schemas/DateJsonSchema.kt +src/main/kotlin/org/openapijsonschematools/client/schemas/DateTimeJsonSchema.kt +src/main/kotlin/org/openapijsonschematools/client/schemas/DecimalJsonSchema.kt +src/main/kotlin/org/openapijsonschematools/client/schemas/DoubleJsonSchema.kt +src/main/kotlin/org/openapijsonschematools/client/schemas/FloatJsonSchema.kt +src/main/kotlin/org/openapijsonschematools/client/schemas/GenericBuilder.kt +src/main/kotlin/org/openapijsonschematools/client/schemas/Int32JsonSchema.kt +src/main/kotlin/org/openapijsonschematools/client/schemas/Int64JsonSchema.kt +src/main/kotlin/org/openapijsonschematools/client/schemas/IntJsonSchema.kt +src/main/kotlin/org/openapijsonschematools/client/schemas/ListJsonSchema.kt +src/main/kotlin/org/openapijsonschematools/client/schemas/MapJsonSchema.kt +src/main/kotlin/org/openapijsonschematools/client/schemas/NotAnyTypeJsonSchema.kt +src/main/kotlin/org/openapijsonschematools/client/schemas/NullJsonSchema.kt +src/main/kotlin/org/openapijsonschematools/client/schemas/NumberJsonSchema.kt +src/main/kotlin/org/openapijsonschematools/client/schemas/SetMaker.kt +src/main/kotlin/org/openapijsonschematools/client/schemas/StringJsonSchema.kt +src/main/kotlin/org/openapijsonschematools/client/schemas/UnsetAddPropsSetter.kt +src/main/kotlin/org/openapijsonschematools/client/schemas/UuidJsonSchema.kt +src/main/kotlin/org/openapijsonschematools/client/schemas/validation/AdditionalPropertiesValidator.kt +src/main/kotlin/org/openapijsonschematools/client/schemas/validation/AllOfValidator.kt +src/main/kotlin/org/openapijsonschematools/client/schemas/validation/AnyOfValidator.kt +src/main/kotlin/org/openapijsonschematools/client/schemas/validation/BigDecimalValidator.kt +src/main/kotlin/org/openapijsonschematools/client/schemas/validation/BooleanEnumValidator.kt +src/main/kotlin/org/openapijsonschematools/client/schemas/validation/BooleanSchemaValidator.kt +src/main/kotlin/org/openapijsonschematools/client/schemas/validation/BooleanValueMethod.kt +src/main/kotlin/org/openapijsonschematools/client/schemas/validation/ConstValidator.kt +src/main/kotlin/org/openapijsonschematools/client/schemas/validation/ContainsValidator.kt +src/main/kotlin/org/openapijsonschematools/client/schemas/validation/CustomIsoparser.kt +src/main/kotlin/org/openapijsonschematools/client/schemas/validation/DefaultValueMethod.kt +src/main/kotlin/org/openapijsonschematools/client/schemas/validation/DependentRequiredValidator.kt +src/main/kotlin/org/openapijsonschematools/client/schemas/validation/DependentSchemasValidator.kt +src/main/kotlin/org/openapijsonschematools/client/schemas/validation/DoubleEnumValidator.kt +src/main/kotlin/org/openapijsonschematools/client/schemas/validation/DoubleValueMethod.kt +src/main/kotlin/org/openapijsonschematools/client/schemas/validation/ElseValidator.kt +src/main/kotlin/org/openapijsonschematools/client/schemas/validation/EnumValidator.kt +src/main/kotlin/org/openapijsonschematools/client/schemas/validation/ExclusiveMaximumValidator.kt +src/main/kotlin/org/openapijsonschematools/client/schemas/validation/ExclusiveMinimumValidator.kt +src/main/kotlin/org/openapijsonschematools/client/schemas/validation/FloatEnumValidator.kt +src/main/kotlin/org/openapijsonschematools/client/schemas/validation/FloatValueMethod.kt +src/main/kotlin/org/openapijsonschematools/client/schemas/validation/FormatValidator.kt +src/main/kotlin/org/openapijsonschematools/client/schemas/validation/FrozenList.kt +src/main/kotlin/org/openapijsonschematools/client/schemas/validation/FrozenMap.kt +src/main/kotlin/org/openapijsonschematools/client/schemas/validation/IfValidator.kt +src/main/kotlin/org/openapijsonschematools/client/schemas/validation/IntegerEnumValidator.kt +src/main/kotlin/org/openapijsonschematools/client/schemas/validation/IntegerValueMethod.kt +src/main/kotlin/org/openapijsonschematools/client/schemas/validation/ItemsValidator.kt +src/main/kotlin/org/openapijsonschematools/client/schemas/validation/JsonSchema.kt +src/main/kotlin/org/openapijsonschematools/client/schemas/validation/JsonSchemaFactory.kt +src/main/kotlin/org/openapijsonschematools/client/schemas/validation/JsonSchemaInfo.kt +src/main/kotlin/org/openapijsonschematools/client/schemas/validation/KeywordEntry.kt +src/main/kotlin/org/openapijsonschematools/client/schemas/validation/KeywordValidator.kt +src/main/kotlin/org/openapijsonschematools/client/schemas/validation/LengthValidator.kt +src/main/kotlin/org/openapijsonschematools/client/schemas/validation/ListSchemaValidator.kt +src/main/kotlin/org/openapijsonschematools/client/schemas/validation/LongEnumValidator.kt +src/main/kotlin/org/openapijsonschematools/client/schemas/validation/LongValueMethod.kt +src/main/kotlin/org/openapijsonschematools/client/schemas/validation/MapSchemaValidator.kt +src/main/kotlin/org/openapijsonschematools/client/schemas/validation/MapUtils.kt +src/main/kotlin/org/openapijsonschematools/client/schemas/validation/MaxContainsValidator.kt +src/main/kotlin/org/openapijsonschematools/client/schemas/validation/MaxItemsValidator.kt +src/main/kotlin/org/openapijsonschematools/client/schemas/validation/MaxLengthValidator.kt +src/main/kotlin/org/openapijsonschematools/client/schemas/validation/MaxPropertiesValidator.kt +src/main/kotlin/org/openapijsonschematools/client/schemas/validation/MaximumValidator.kt +src/main/kotlin/org/openapijsonschematools/client/schemas/validation/MinContainsValidator.kt +src/main/kotlin/org/openapijsonschematools/client/schemas/validation/MinItemsValidator.kt +src/main/kotlin/org/openapijsonschematools/client/schemas/validation/MinLengthValidator.kt +src/main/kotlin/org/openapijsonschematools/client/schemas/validation/MinPropertiesValidator.kt +src/main/kotlin/org/openapijsonschematools/client/schemas/validation/MinimumValidator.kt +src/main/kotlin/org/openapijsonschematools/client/schemas/validation/MultipleOfValidator.kt +src/main/kotlin/org/openapijsonschematools/client/schemas/validation/NotValidator.kt +src/main/kotlin/org/openapijsonschematools/client/schemas/validation/NullEnumValidator.kt +src/main/kotlin/org/openapijsonschematools/client/schemas/validation/NullSchemaValidator.kt +src/main/kotlin/org/openapijsonschematools/client/schemas/validation/NullValueMethod.kt +src/main/kotlin/org/openapijsonschematools/client/schemas/validation/NumberSchemaValidator.kt +src/main/kotlin/org/openapijsonschematools/client/schemas/validation/OneOfValidator.kt +src/main/kotlin/org/openapijsonschematools/client/schemas/validation/PathToSchemasMap.kt +src/main/kotlin/org/openapijsonschematools/client/schemas/validation/PatternPropertiesValidator.kt +src/main/kotlin/org/openapijsonschematools/client/schemas/validation/PatternValidator.kt +src/main/kotlin/org/openapijsonschematools/client/schemas/validation/PrefixItemsValidator.kt +src/main/kotlin/org/openapijsonschematools/client/schemas/validation/PropertiesValidator.kt +src/main/kotlin/org/openapijsonschematools/client/schemas/validation/PropertyEntry.kt +src/main/kotlin/org/openapijsonschematools/client/schemas/validation/PropertyNamesValidator.kt +src/main/kotlin/org/openapijsonschematools/client/schemas/validation/RequiredValidator.kt +src/main/kotlin/org/openapijsonschematools/client/schemas/validation/StringEnumValidator.kt +src/main/kotlin/org/openapijsonschematools/client/schemas/validation/StringSchemaValidator.kt +src/main/kotlin/org/openapijsonschematools/client/schemas/validation/StringValueMethod.kt +src/main/kotlin/org/openapijsonschematools/client/schemas/validation/ThenValidator.kt +src/main/kotlin/org/openapijsonschematools/client/schemas/validation/TypeValidator.kt +src/main/kotlin/org/openapijsonschematools/client/schemas/validation/UnevaluatedItemsValidator.kt +src/main/kotlin/org/openapijsonschematools/client/schemas/validation/UnevaluatedPropertiesValidator.kt +src/main/kotlin/org/openapijsonschematools/client/schemas/validation/UniqueItemsValidator.kt +src/main/kotlin/org/openapijsonschematools/client/schemas/validation/UnsetAnyTypeJsonSchema.kt +src/main/kotlin/org/openapijsonschematools/client/schemas/validation/ValidationData.kt +src/main/kotlin/org/openapijsonschematools/client/schemas/validation/ValidationMetadata.kt +src/main/kotlin/org/openapijsonschematools/client/securityrequirementobjects/AuthApplier.kt +src/main/kotlin/org/openapijsonschematools/client/securityrequirementobjects/EmptySecurityRequirementObject.kt +src/main/kotlin/org/openapijsonschematools/client/securityrequirementobjects/SecurityRequirementObject.kt +src/main/kotlin/org/openapijsonschematools/client/securityrequirementobjects/SecurityRequirementObjectProvider.kt +src/main/kotlin/org/openapijsonschematools/client/securityschemes/ApiKeyCookieSecurityScheme.kt +src/main/kotlin/org/openapijsonschematools/client/securityschemes/ApiKeyHeaderSecurityScheme.kt +src/main/kotlin/org/openapijsonschematools/client/securityschemes/ApiKeyQuerySecurityScheme.kt +src/main/kotlin/org/openapijsonschematools/client/securityschemes/HttpBasicSecurityScheme.kt +src/main/kotlin/org/openapijsonschematools/client/securityschemes/HttpBearerSecurityScheme.kt +src/main/kotlin/org/openapijsonschematools/client/securityschemes/HttpDigestSecurityScheme.kt +src/main/kotlin/org/openapijsonschematools/client/securityschemes/HttpSignatureSecurityScheme.kt +src/main/kotlin/org/openapijsonschematools/client/securityschemes/MutualTlsSecurityScheme.kt +src/main/kotlin/org/openapijsonschematools/client/securityschemes/OAuth2SecurityScheme.kt +src/main/kotlin/org/openapijsonschematools/client/securityschemes/OpenIdConnectSecurityScheme.kt +src/main/kotlin/org/openapijsonschematools/client/securityschemes/SecurityScheme.kt +src/main/kotlin/org/openapijsonschematools/client/servers/RootServer0.kt +src/main/kotlin/org/openapijsonschematools/client/servers/RootServer1.kt +src/main/kotlin/org/openapijsonschematools/client/servers/RootServer2.kt +src/main/kotlin/org/openapijsonschematools/client/servers/Server.kt +src/main/kotlin/org/openapijsonschematools/client/servers/ServerProvider.kt +src/main/kotlin/org/openapijsonschematools/client/servers/ServerWithVariables.kt +src/main/kotlin/org/openapijsonschematools/client/servers/ServerWithoutVariables.kt +src/main/kotlin/org/openapijsonschematools/client/servers/rootserver0/RootServer0Variables.kt +src/main/kotlin/org/openapijsonschematools/client/servers/rootserver1/RootServer1Variables.kt +src/test/kotlin/org/openapijsonschematools/client/components/schemas/AbstractStepMessageTest.kt +src/test/kotlin/org/openapijsonschematools/client/components/schemas/AdditionalPropertiesClassTest.kt +src/test/kotlin/org/openapijsonschematools/client/components/schemas/AdditionalPropertiesSchemaTest.kt +src/test/kotlin/org/openapijsonschematools/client/components/schemas/AdditionalPropertiesWithArrayOfEnumsTest.kt +src/test/kotlin/org/openapijsonschematools/client/components/schemas/AddressTest.kt +src/test/kotlin/org/openapijsonschematools/client/components/schemas/AnimalFarmTest.kt +src/test/kotlin/org/openapijsonschematools/client/components/schemas/AnimalTest.kt +src/test/kotlin/org/openapijsonschematools/client/components/schemas/AnyTypeAndFormatTest.kt +src/test/kotlin/org/openapijsonschematools/client/components/schemas/AnyTypeNotStringTest.kt +src/test/kotlin/org/openapijsonschematools/client/components/schemas/ApiResponseSchemaTest.kt +src/test/kotlin/org/openapijsonschematools/client/components/schemas/AppleReqTest.kt +src/test/kotlin/org/openapijsonschematools/client/components/schemas/AppleTest.kt +src/test/kotlin/org/openapijsonschematools/client/components/schemas/ArrayHoldingAnyTypeTest.kt +src/test/kotlin/org/openapijsonschematools/client/components/schemas/ArrayOfArrayOfNumberOnlyTest.kt +src/test/kotlin/org/openapijsonschematools/client/components/schemas/ArrayOfEnumsTest.kt +src/test/kotlin/org/openapijsonschematools/client/components/schemas/ArrayOfNumberOnlyTest.kt +src/test/kotlin/org/openapijsonschematools/client/components/schemas/ArrayTestTest.kt +src/test/kotlin/org/openapijsonschematools/client/components/schemas/ArrayWithValidationsInItemsTest.kt +src/test/kotlin/org/openapijsonschematools/client/components/schemas/BananaReqTest.kt +src/test/kotlin/org/openapijsonschematools/client/components/schemas/BananaTest.kt +src/test/kotlin/org/openapijsonschematools/client/components/schemas/BarTest.kt +src/test/kotlin/org/openapijsonschematools/client/components/schemas/BasquePigTest.kt +src/test/kotlin/org/openapijsonschematools/client/components/schemas/BooleanEnumTest.kt +src/test/kotlin/org/openapijsonschematools/client/components/schemas/BooleanSchemaTest.kt +src/test/kotlin/org/openapijsonschematools/client/components/schemas/CapitalizationTest.kt +src/test/kotlin/org/openapijsonschematools/client/components/schemas/CatTest.kt +src/test/kotlin/org/openapijsonschematools/client/components/schemas/CategoryTest.kt +src/test/kotlin/org/openapijsonschematools/client/components/schemas/ChildCatTest.kt +src/test/kotlin/org/openapijsonschematools/client/components/schemas/ClassModelTest.kt +src/test/kotlin/org/openapijsonschematools/client/components/schemas/ClientTest.kt +src/test/kotlin/org/openapijsonschematools/client/components/schemas/ComplexQuadrilateralTest.kt +src/test/kotlin/org/openapijsonschematools/client/components/schemas/ComposedAnyOfDifferentTypesNoValidationsTest.kt +src/test/kotlin/org/openapijsonschematools/client/components/schemas/ComposedArrayTest.kt +src/test/kotlin/org/openapijsonschematools/client/components/schemas/ComposedBoolTest.kt +src/test/kotlin/org/openapijsonschematools/client/components/schemas/ComposedNoneTest.kt +src/test/kotlin/org/openapijsonschematools/client/components/schemas/ComposedNumberTest.kt +src/test/kotlin/org/openapijsonschematools/client/components/schemas/ComposedObjectTest.kt +src/test/kotlin/org/openapijsonschematools/client/components/schemas/ComposedOneOfDifferentTypesTest.kt +src/test/kotlin/org/openapijsonschematools/client/components/schemas/ComposedStringTest.kt +src/test/kotlin/org/openapijsonschematools/client/components/schemas/CurrencyTest.kt +src/test/kotlin/org/openapijsonschematools/client/components/schemas/DanishPigTest.kt +src/test/kotlin/org/openapijsonschematools/client/components/schemas/DateTimeTestTest.kt +src/test/kotlin/org/openapijsonschematools/client/components/schemas/DateTimeWithValidationsTest.kt +src/test/kotlin/org/openapijsonschematools/client/components/schemas/DateWithValidationsTest.kt +src/test/kotlin/org/openapijsonschematools/client/components/schemas/DecimalPayloadTest.kt +src/test/kotlin/org/openapijsonschematools/client/components/schemas/DogTest.kt +src/test/kotlin/org/openapijsonschematools/client/components/schemas/DrawingTest.kt +src/test/kotlin/org/openapijsonschematools/client/components/schemas/EnumArraysTest.kt +src/test/kotlin/org/openapijsonschematools/client/components/schemas/EnumClassTest.kt +src/test/kotlin/org/openapijsonschematools/client/components/schemas/EnumTestTest.kt +src/test/kotlin/org/openapijsonschematools/client/components/schemas/EquilateralTriangleTest.kt +src/test/kotlin/org/openapijsonschematools/client/components/schemas/FileSchemaTestClassTest.kt +src/test/kotlin/org/openapijsonschematools/client/components/schemas/FileTest.kt +src/test/kotlin/org/openapijsonschematools/client/components/schemas/FooTest.kt +src/test/kotlin/org/openapijsonschematools/client/components/schemas/FormatTestTest.kt +src/test/kotlin/org/openapijsonschematools/client/components/schemas/FromSchemaTest.kt +src/test/kotlin/org/openapijsonschematools/client/components/schemas/FruitReqTest.kt +src/test/kotlin/org/openapijsonschematools/client/components/schemas/FruitTest.kt +src/test/kotlin/org/openapijsonschematools/client/components/schemas/GmFruitTest.kt +src/test/kotlin/org/openapijsonschematools/client/components/schemas/GrandparentAnimalTest.kt +src/test/kotlin/org/openapijsonschematools/client/components/schemas/HasOnlyReadOnlyTest.kt +src/test/kotlin/org/openapijsonschematools/client/components/schemas/HealthCheckResultTest.kt +src/test/kotlin/org/openapijsonschematools/client/components/schemas/IntegerEnumBigTest.kt +src/test/kotlin/org/openapijsonschematools/client/components/schemas/IntegerEnumOneValueTest.kt +src/test/kotlin/org/openapijsonschematools/client/components/schemas/IntegerEnumTest.kt +src/test/kotlin/org/openapijsonschematools/client/components/schemas/IntegerEnumWithDefaultValueTest.kt +src/test/kotlin/org/openapijsonschematools/client/components/schemas/IntegerMax10Test.kt +src/test/kotlin/org/openapijsonschematools/client/components/schemas/IntegerMin15Test.kt +src/test/kotlin/org/openapijsonschematools/client/components/schemas/IsoscelesTriangleTest.kt +src/test/kotlin/org/openapijsonschematools/client/components/schemas/ItemsSchemaTest.kt +src/test/kotlin/org/openapijsonschematools/client/components/schemas/ItemsTest.kt +src/test/kotlin/org/openapijsonschematools/client/components/schemas/JSONPatchRequestAddReplaceTestTest.kt +src/test/kotlin/org/openapijsonschematools/client/components/schemas/JSONPatchRequestMoveCopyTest.kt +src/test/kotlin/org/openapijsonschematools/client/components/schemas/JSONPatchRequestRemoveTest.kt +src/test/kotlin/org/openapijsonschematools/client/components/schemas/JSONPatchRequestTest.kt +src/test/kotlin/org/openapijsonschematools/client/components/schemas/MammalTest.kt +src/test/kotlin/org/openapijsonschematools/client/components/schemas/MapTestTest.kt +src/test/kotlin/org/openapijsonschematools/client/components/schemas/MixedPropertiesAndAdditionalPropertiesClassTest.kt +src/test/kotlin/org/openapijsonschematools/client/components/schemas/MoneyTest.kt +src/test/kotlin/org/openapijsonschematools/client/components/schemas/MultiPropertiesSchemaTest.kt +src/test/kotlin/org/openapijsonschematools/client/components/schemas/MyObjectDtoTest.kt +src/test/kotlin/org/openapijsonschematools/client/components/schemas/NameTest.kt +src/test/kotlin/org/openapijsonschematools/client/components/schemas/NoAdditionalPropertiesTest.kt +src/test/kotlin/org/openapijsonschematools/client/components/schemas/NullableClassTest.kt +src/test/kotlin/org/openapijsonschematools/client/components/schemas/NullableShapeTest.kt +src/test/kotlin/org/openapijsonschematools/client/components/schemas/NullableStringTest.kt +src/test/kotlin/org/openapijsonschematools/client/components/schemas/NumberOnlyTest.kt +src/test/kotlin/org/openapijsonschematools/client/components/schemas/NumberSchemaTest.kt +src/test/kotlin/org/openapijsonschematools/client/components/schemas/NumberWithExclusiveMinMaxTest.kt +src/test/kotlin/org/openapijsonschematools/client/components/schemas/NumberWithValidationsTest.kt +src/test/kotlin/org/openapijsonschematools/client/components/schemas/ObjWithRequiredPropsBaseTest.kt +src/test/kotlin/org/openapijsonschematools/client/components/schemas/ObjWithRequiredPropsTest.kt +src/test/kotlin/org/openapijsonschematools/client/components/schemas/ObjectInterfaceTest.kt +src/test/kotlin/org/openapijsonschematools/client/components/schemas/ObjectModelWithArgAndArgsPropertiesTest.kt +src/test/kotlin/org/openapijsonschematools/client/components/schemas/ObjectModelWithRefPropsTest.kt +src/test/kotlin/org/openapijsonschematools/client/components/schemas/ObjectWithAllOfWithReqTestPropFromUnsetAddPropTest.kt +src/test/kotlin/org/openapijsonschematools/client/components/schemas/ObjectWithCollidingPropertiesTest.kt +src/test/kotlin/org/openapijsonschematools/client/components/schemas/ObjectWithDecimalPropertiesTest.kt +src/test/kotlin/org/openapijsonschematools/client/components/schemas/ObjectWithDifficultlyNamedPropsTest.kt +src/test/kotlin/org/openapijsonschematools/client/components/schemas/ObjectWithInlineCompositionPropertyTest.kt +src/test/kotlin/org/openapijsonschematools/client/components/schemas/ObjectWithInvalidNamedRefedPropertiesTest.kt +src/test/kotlin/org/openapijsonschematools/client/components/schemas/ObjectWithNonIntersectingValuesTest.kt +src/test/kotlin/org/openapijsonschematools/client/components/schemas/ObjectWithOnlyOptionalPropsTest.kt +src/test/kotlin/org/openapijsonschematools/client/components/schemas/ObjectWithOptionalTestPropTest.kt +src/test/kotlin/org/openapijsonschematools/client/components/schemas/ObjectWithValidationsTest.kt +src/test/kotlin/org/openapijsonschematools/client/components/schemas/OrderTest.kt +src/test/kotlin/org/openapijsonschematools/client/components/schemas/PaginatedResultMyObjectDtoTest.kt +src/test/kotlin/org/openapijsonschematools/client/components/schemas/ParentPetTest.kt +src/test/kotlin/org/openapijsonschematools/client/components/schemas/PetTest.kt +src/test/kotlin/org/openapijsonschematools/client/components/schemas/PigTest.kt +src/test/kotlin/org/openapijsonschematools/client/components/schemas/PlayerTest.kt +src/test/kotlin/org/openapijsonschematools/client/components/schemas/PublicKeyTest.kt +src/test/kotlin/org/openapijsonschematools/client/components/schemas/QuadrilateralInterfaceTest.kt +src/test/kotlin/org/openapijsonschematools/client/components/schemas/QuadrilateralTest.kt +src/test/kotlin/org/openapijsonschematools/client/components/schemas/ReadOnlyFirstTest.kt +src/test/kotlin/org/openapijsonschematools/client/components/schemas/RefPetTest.kt +src/test/kotlin/org/openapijsonschematools/client/components/schemas/ReqPropsFromExplicitAddPropsTest.kt +src/test/kotlin/org/openapijsonschematools/client/components/schemas/ReqPropsFromTrueAddPropsTest.kt +src/test/kotlin/org/openapijsonschematools/client/components/schemas/ReqPropsFromUnsetAddPropsTest.kt +src/test/kotlin/org/openapijsonschematools/client/components/schemas/ReturnSchemaTest.kt +src/test/kotlin/org/openapijsonschematools/client/components/schemas/ScaleneTriangleTest.kt +src/test/kotlin/org/openapijsonschematools/client/components/schemas/Schema200ResponseTest.kt +src/test/kotlin/org/openapijsonschematools/client/components/schemas/SelfReferencingArrayModelTest.kt +src/test/kotlin/org/openapijsonschematools/client/components/schemas/SelfReferencingObjectModelTest.kt +src/test/kotlin/org/openapijsonschematools/client/components/schemas/ShapeOrNullTest.kt +src/test/kotlin/org/openapijsonschematools/client/components/schemas/ShapeTest.kt +src/test/kotlin/org/openapijsonschematools/client/components/schemas/SimpleQuadrilateralTest.kt +src/test/kotlin/org/openapijsonschematools/client/components/schemas/SomeObjectTest.kt +src/test/kotlin/org/openapijsonschematools/client/components/schemas/SpecialModelnameTest.kt +src/test/kotlin/org/openapijsonschematools/client/components/schemas/StringBooleanMapTest.kt +src/test/kotlin/org/openapijsonschematools/client/components/schemas/StringEnumTest.kt +src/test/kotlin/org/openapijsonschematools/client/components/schemas/StringEnumWithDefaultValueTest.kt +src/test/kotlin/org/openapijsonschematools/client/components/schemas/StringSchemaTest.kt +src/test/kotlin/org/openapijsonschematools/client/components/schemas/StringWithValidationTest.kt +src/test/kotlin/org/openapijsonschematools/client/components/schemas/TagTest.kt +src/test/kotlin/org/openapijsonschematools/client/components/schemas/TriangleInterfaceTest.kt +src/test/kotlin/org/openapijsonschematools/client/components/schemas/TriangleTest.kt +src/test/kotlin/org/openapijsonschematools/client/components/schemas/UUIDStringTest.kt +src/test/kotlin/org/openapijsonschematools/client/components/schemas/UserTest.kt +src/test/kotlin/org/openapijsonschematools/client/components/schemas/WhaleTest.kt +src/test/kotlin/org/openapijsonschematools/client/components/schemas/ZebraTest.kt +src/test/kotlin/org/openapijsonschematools/client/configurations/JsonSchemaKeywordFlagsTest.kt +src/test/kotlin/org/openapijsonschematools/client/header/ContentHeaderTest.kt +src/test/kotlin/org/openapijsonschematools/client/header/SchemaHeaderTest.kt +src/test/kotlin/org/openapijsonschematools/client/parameter/CookieSerializerTest.kt +src/test/kotlin/org/openapijsonschematools/client/parameter/HeadersSerializerTest.kt +src/test/kotlin/org/openapijsonschematools/client/parameter/PathSerializerTest.kt +src/test/kotlin/org/openapijsonschematools/client/parameter/QuerySerializerTest.kt +src/test/kotlin/org/openapijsonschematools/client/parameter/SchemaNonQueryParameterTest.kt +src/test/kotlin/org/openapijsonschematools/client/parameter/SchemaQueryParameterTest.kt +src/test/kotlin/org/openapijsonschematools/client/requestbody/RequestBodySerializerTest.kt +src/test/kotlin/org/openapijsonschematools/client/response/ResponseDeserializerTest.kt +src/test/kotlin/org/openapijsonschematools/client/schemas/AnyTypeSchemaTest.kt +src/test/kotlin/org/openapijsonschematools/client/schemas/ArrayTypeSchemaTest.kt +src/test/kotlin/org/openapijsonschematools/client/schemas/BooleanSchemaTest.kt +src/test/kotlin/org/openapijsonschematools/client/schemas/ListBuilderTest.kt +src/test/kotlin/org/openapijsonschematools/client/schemas/ListSchemaTest.kt +src/test/kotlin/org/openapijsonschematools/client/schemas/MapSchemaTest.kt +src/test/kotlin/org/openapijsonschematools/client/schemas/NullSchemaTest.kt +src/test/kotlin/org/openapijsonschematools/client/schemas/NumberSchemaTest.kt +src/test/kotlin/org/openapijsonschematools/client/schemas/ObjectTypeSchemaTest.kt +src/test/kotlin/org/openapijsonschematools/client/schemas/RefBooleanSchemaTest.kt +src/test/kotlin/org/openapijsonschematools/client/schemas/validation/AdditionalPropertiesValidatorTest.kt +src/test/kotlin/org/openapijsonschematools/client/schemas/validation/CustomIsoparserTest.kt +src/test/kotlin/org/openapijsonschematools/client/schemas/validation/FormatValidatorTest.kt +src/test/kotlin/org/openapijsonschematools/client/schemas/validation/ItemsValidatorTest.kt +src/test/kotlin/org/openapijsonschematools/client/schemas/validation/JsonSchemaTest.kt +src/test/kotlin/org/openapijsonschematools/client/schemas/validation/PropertiesValidatorTest.kt +src/test/kotlin/org/openapijsonschematools/client/schemas/validation/RequiredValidatorTest.kt +src/test/kotlin/org/openapijsonschematools/client/schemas/validation/TypeValidatorTest.kt diff --git a/samples/client/petstore/kotlin/.openapi-generator/VERSION b/samples/client/petstore/kotlin/.openapi-generator/VERSION new file mode 100644 index 00000000000..717311e32e3 --- /dev/null +++ b/samples/client/petstore/kotlin/.openapi-generator/VERSION @@ -0,0 +1 @@ +unset \ No newline at end of file diff --git a/samples/client/petstore/kotlin/README.md b/samples/client/petstore/kotlin/README.md new file mode 100644 index 00000000000..f52d1625b5c --- /dev/null +++ b/samples/client/petstore/kotlin/README.md @@ -0,0 +1,474 @@ +# petstore +This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. + +This Kotlin package is automatically generated by the [OpenAPI JSON Schema Generator](https://github.com/openapi-json-schema-tools/openapi-json-schema-generator) project: + +- OpenAPI document version: 1.0.0 +- Kotlin Package version: 1.0.0 +- OpenAPI JSON Schema Generator, Generator: KotlinClientGenerator + +## Requirements + +1. Kotlin 17 +2. Gradle + +## Installation + +To install the API client library to your local Maven repository, simply execute: + +```shell +gradle wrapper +gradlew clean build +``` + +### Gradle users + +Add this dependency to your project's build file: + +``` +repositories { + mavenCentral() // Needed if the 'petstore' jar has been published to maven centra + mavenLocal() // Needed if the 'petstore' jar has been published to the local maven repo +} + +dependencies { + implementation "org.openapijsonschematools:petstore:1.0.0" +} +``` + +## Usage Notes +### Validation, Immutability, and Data Type +This Kotlin code validates data to schema classes and return back an immutable instance containing the data. This ensure that +- valid data cannot be mutated and become invalid to a set of schemas + - the one exception is that files are not immutable, so schema instances storing/sending/receiving files are not immutable + +Here is the mapping from json schema types to Kotlin types: + +| Json Schema Type | Kotlin Base Class | +| ---------------- | --------------- | +| object | FrozenMap (Map) | +| array | FrozenList (List) | +| string | String | +| number | Number (int, long, float, double) | +| integer | int, long, float, double (with values equal to integers) | +| boolean | boolean | +| null | Nothing? (null) | +| AnyType (unset) | Object? | + +### Storage of Json Schema Definition in Kotlin JsonSchema Classes +In openapi v3.0.3 there are ~ 28 json schema keywords. Almost all of them can apply if +type is unset. I have chosen to separate the storage of +- json schema definition info +- output classes for validated Map (json schema type object) payloads +- output classes for validated List (json schema type array) payloads + +
+ Reason + +This json schema data is stored in each class that is written for a schema, in a component or +other openapi document location. This class is only responsible for storing schema info. +Output classes like those that store map payloads are written separately and are +returned by the JsonSchema.validate method when that method is passed in Map input. +This prevents payload property access methods from +colliding with json schema definition. +
+ +### Json Schema Type Object +Most component schemas (models) are probably of type object. Which is a map data structure. +Json schema allows string keys in this map, which means schema properties can have key names that are +invalid Kotlin variable names. Names like: +- "hi-there" +- "1variable" +- "@now" +- " " +- "from" + +To allow these use cases to work, FrozenMap (which extends AbstractMap) is used as the base class of type object schemas. +This means that one can use normal Map methods on instances of these classes. + +
+ Other Details + +- getters are written for validly named required and optional properties +- null is only allowed in as a value if type: "null" was included or nullable: true was set + - because null is an allowed property value, it is not used to represent an unset property state +- if an optional property is requested and it does not exist in the Map, an UnsetPropertyException is thrown +
+ +### Json Schema Type + Format, Validated Data Storage +N schemas can be validated on the same payload. +To allow multiple schemas to validate, the data must be stored using one base class whether or not +a json schema format constraint exists in the schema. + +In json schema, type: number with no format validates both integers and floats, +so int and float values are stored for type number. + +
+ String + Date Example + +For example the string payload '2023-12-20' is validates to both of these schemas: +1. string only +``` +- type: string +``` +2. string and date format +``` +- type: string + format: date +``` +Because of use cases like this, a LocalDate is allowed as an input to this schema, but the data +is stored as a string. +
+ +## Getting Started + +Please follow the [installation procedure](#installation) and then use the JsonSchema classes in +org.openapijsonschematools.client.components.schemas to validate input payloads and instances of validated Map and List +output classes. Json schemas allow multiple types for one schema, so a schema's validate method can have +allowed input and output types. + +## 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.servers.RootServer0; +import org.openapijsonschematools.client.servers.RootServer1; +import org.openapijsonschematools.client.servers.RootServer2; +import org.openapijsonschematools.client.paths.solidus.get.responses.SolidusGetCode200Response; +import org.openapijsonschematools.client.servers.RootServerInfo; +import org.openapijsonschematools.client.apis.tags.Fake; +import org.openapijsonschematools.client.paths.solidus.get.SolidusGetResponses; + +import java.io.IOException; +import java.util.Arrays; +import java.util.List; +import java.util.Map; +import java.util.AbstractMap; + +// if you want to use a server that is not SERVER_0 pass it in here and change the ServerIndex input below +ApiConfiguration.ServerInfo serverInfo = new ApiConfiguration.ServerInfoBuilder() + .rootServerInfo( + new RootServerInfo.RootServerInfoBuilder() + .rootServer0(new RootServer0()) + .build() + ) + .build(); +ApiConfiguration.ServerIndexInfo serverIndexInfo = new ApiConfiguration.ServerIndexInfoBuilder() + .rootServerInfoServerIndex(RootServerInfo.ServerIndex.SERVER_0) + .build(); +Duration timeout = Duration.ofSeconds(1L); +Map> defaultHeaders = Map.of("User-Agent", List.of("OpenAPI-JSON-Schema-Generator/1.0.0/java")); +ApiConfiguration apiConfiguration = new ApiConfiguration( + serverInfo + serverIndexInfo, + timeout, + defaultHeaders +); +SchemaConfiguration schemaConfiguration = new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().build()); +Fake apiClient = new Fake(apiConfiguration, schemaConfiguration); + + +var request = new SolidusGet.GetRequestBuilder().build(); + +SolidusGetResponses.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; +} +SolidusGetResponses.EndpointSolidusGetCode200Response castResponse = (SolidusGetResponses.EndpointSolidusGetCode200Response) response; +``` +## Servers +| server_index | Class | Description | +| ------------ | ----- | ----------- | +| 0 | [RootServer0](docs/servers/RootServer0.md) | petstore server | +| 1 | [RootServer1](docs/servers/RootServer1.md) | The local server | +| 2 | [RootServer2](docs/servers/RootServer2.md) | staging server with no variables | + +## Component SecuritySchemes +| Class | Description | +| ----- | ----------- | +| [ApiKey](docs/components/securityschemes/ApiKey.md) | apiKey in header | +| [ApiKeyQuery](docs/components/securityschemes/ApiKeyQuery.md) | apiKey in query | +| [BearerTest](docs/components/securityschemes/BearerTest.md) | http bearer with JWT bearer format | +| [HttpBasicTest](docs/components/securityschemes/HttpBasicTest.md) | http basic | +| [HttpSignatureTest](docs/components/securityschemes/HttpSignatureTest.md) | http + signature | +| [OpenIdConnectTest](docs/components/securityschemes/OpenIdConnectTest.md) | openIdConnect | +| [PetstoreAuth](docs/components/securityschemes/PetstoreAuth.md) | oauth2 implicit flow with two scopes | + +## Endpoints +All URIs are relative to the selected server +- The server is selected by passing in serverInfo + serverIndexInfo into configurations.ApiConfiguration +- The security info is selected by passing in securityInfo + securityIndexInfo into configurations.ApiConfiguration +- serverIndex + securityIndex can also be passed in to endpoint calls, see endpoint documentation + +| HTTP request | Methods | Description | +| ------------ | ------- | ----------- | +| / **get** | [Fake.slashRoute](docs/apis/tags/Fake.md#slashroute) [Solidus.get](docs/apis/paths/Solidus.md#get) [SolidusGet.Get.get](docs/paths/solidus/SolidusGet.md#get) | slash route | +| /another-fake/dummy **patch** | [Anotherfake.model123TestSpecialTags](docs/apis/tags/Anotherfake.md#model123testspecialtags) [Anotherfakedummy.patch](docs/apis/paths/Anotherfakedummy.md#patch) [AnotherfakedummyPatch.Patch.patch](docs/paths/anotherfakedummy/AnotherfakedummyPatch.md#patch) | To test special tags | +| /commonParam/{subDir}/ **delete** | [Fake.deleteCommonParam](docs/apis/tags/Fake.md#deletecommonparam) [Commonparamsubdir.delete](docs/apis/paths/Commonparamsubdir.md#delete) [CommonparamsubdirDelete.Delete.delete](docs/paths/commonparamsubdir/CommonparamsubdirDelete.md#delete) | | +| /commonParam/{subDir}/ **get** | [Fake.getCommonParam](docs/apis/tags/Fake.md#getcommonparam) [Commonparamsubdir.get](docs/apis/paths/Commonparamsubdir.md#get) [CommonparamsubdirGet.Get.get](docs/paths/commonparamsubdir/CommonparamsubdirGet.md#get) | | +| /commonParam/{subDir}/ **post** | [Fake.postCommonParam](docs/apis/tags/Fake.md#postcommonparam) [Commonparamsubdir.post](docs/apis/paths/Commonparamsubdir.md#post) [CommonparamsubdirPost.Post.post](docs/paths/commonparamsubdir/CommonparamsubdirPost.md#post) | | +| /fake **delete** | [Fake.groupParameters](docs/apis/tags/Fake.md#groupparameters) [Fake.delete](docs/apis/paths/Fake.md#delete) [FakeDelete.Delete.delete](docs/paths/fake/FakeDelete.md#delete) | Fake endpoint to test group parameters (optional) | +| /fake **get** | [Fake.enumParameters](docs/apis/tags/Fake.md#enumparameters) [Fake.get](docs/apis/paths/Fake.md#get) [FakeGet.Get.get](docs/paths/fake/FakeGet.md#get) | To test enum parameters | +| /fake **patch** | [Fake.clientModel](docs/apis/tags/Fake.md#clientmodel) [Fake.patch](docs/apis/paths/Fake.md#patch) [FakePatch.Patch.patch](docs/paths/fake/FakePatch.md#patch) | To test "client" model | +| /fake **post** | [Fake.endpointParameters](docs/apis/tags/Fake.md#endpointparameters) [Fake.post](docs/apis/paths/Fake.md#post) [FakePost.Post.post](docs/paths/fake/FakePost.md#post) | Fake endpoint for testing various parameters
假端點
偽のエンドポイント
가짜 엔드 포인트
| +| /fake/additional-properties-with-array-of-enums **get** | [Fake.additionalPropertiesWithArrayOfEnums](docs/apis/tags/Fake.md#additionalpropertieswitharrayofenums) [Fakeadditionalpropertieswitharrayofenums.get](docs/apis/paths/Fakeadditionalpropertieswitharrayofenums.md#get) [FakeadditionalpropertieswitharrayofenumsGet.Get.get](docs/paths/fakeadditionalpropertieswitharrayofenums/FakeadditionalpropertieswitharrayofenumsGet.md#get) | Additional Properties with Array of Enums | +| /fake/body-with-file-schema **put** | [Fake.bodyWithFileSchema](docs/apis/tags/Fake.md#bodywithfileschema) [Fakebodywithfileschema.put](docs/apis/paths/Fakebodywithfileschema.md#put) [FakebodywithfileschemaPut.Put.put](docs/paths/fakebodywithfileschema/FakebodywithfileschemaPut.md#put) | | +| /fake/body-with-query-params **put** | [Fake.bodyWithQueryParams](docs/apis/tags/Fake.md#bodywithqueryparams) [Fakebodywithqueryparams.put](docs/apis/paths/Fakebodywithqueryparams.md#put) [FakebodywithqueryparamsPut.Put.put](docs/paths/fakebodywithqueryparams/FakebodywithqueryparamsPut.md#put) | | +| /fake/case-sensitive-params **put** | [Fake.caseSensitiveParams](docs/apis/tags/Fake.md#casesensitiveparams) [Fakecasesensitiveparams.put](docs/apis/paths/Fakecasesensitiveparams.md#put) [FakecasesensitiveparamsPut.Put.put](docs/paths/fakecasesensitiveparams/FakecasesensitiveparamsPut.md#put) | | +| /fake/deleteCoffee/{id} **delete** | [Fake.deleteCoffee](docs/apis/tags/Fake.md#deletecoffee) [Fakedeletecoffeeid.delete](docs/apis/paths/Fakedeletecoffeeid.md#delete) [FakedeletecoffeeidDelete.Delete.delete](docs/paths/fakedeletecoffeeid/FakedeletecoffeeidDelete.md#delete) | Delete coffee | +| /fake/health **get** | [Fake.fakeHealthGet](docs/apis/tags/Fake.md#fakehealthget) [Fakehealth.get](docs/apis/paths/Fakehealth.md#get) [FakehealthGet.Get.get](docs/paths/fakehealth/FakehealthGet.md#get) | Health check endpoint | +| /fake/inline-additionalProperties **post** | [Fake.inlineAdditionalProperties](docs/apis/tags/Fake.md#inlineadditionalproperties) [Fakeinlineadditionalproperties.post](docs/apis/paths/Fakeinlineadditionalproperties.md#post) [FakeinlineadditionalpropertiesPost.Post.post](docs/paths/fakeinlineadditionalproperties/FakeinlineadditionalpropertiesPost.md#post) | test inline additionalProperties | +| /fake/inlineComposition/ **post** | [Fake.inlineComposition](docs/apis/tags/Fake.md#inlinecomposition) [Fakeinlinecomposition.post](docs/apis/paths/Fakeinlinecomposition.md#post) [FakeinlinecompositionPost.Post.post](docs/paths/fakeinlinecomposition/FakeinlinecompositionPost.md#post) | testing composed schemas at inline locations | +| /fake/jsonFormData **get** | [Fake.jsonFormData](docs/apis/tags/Fake.md#jsonformdata) [Fakejsonformdata.get](docs/apis/paths/Fakejsonformdata.md#get) [FakejsonformdataGet.Get.get](docs/paths/fakejsonformdata/FakejsonformdataGet.md#get) | test json serialization of form data | +| /fake/jsonPatch **patch** | [Fake.jsonPatch](docs/apis/tags/Fake.md#jsonpatch) [Fakejsonpatch.patch](docs/apis/paths/Fakejsonpatch.md#patch) [FakejsonpatchPatch.Patch.patch](docs/paths/fakejsonpatch/FakejsonpatchPatch.md#patch) | json patch | +| /fake/jsonWithCharset **post** | [Fake.jsonWithCharset](docs/apis/tags/Fake.md#jsonwithcharset) [Fakejsonwithcharset.post](docs/apis/paths/Fakejsonwithcharset.md#post) [FakejsonwithcharsetPost.Post.post](docs/paths/fakejsonwithcharset/FakejsonwithcharsetPost.md#post) | json with charset tx and rx | +| /fake/multipleRequestBodyContentTypes/ **post** | [Fake.multipleRequestBodyContentTypes](docs/apis/tags/Fake.md#multiplerequestbodycontenttypes) [Fakemultiplerequestbodycontenttypes.post](docs/apis/paths/Fakemultiplerequestbodycontenttypes.md#post) [FakemultiplerequestbodycontenttypesPost.Post.post](docs/paths/fakemultiplerequestbodycontenttypes/FakemultiplerequestbodycontenttypesPost.md#post) | testing composed schemas at inline locations | +| /fake/multipleResponseBodies **get** | [Fake.multipleResponseBodies](docs/apis/tags/Fake.md#multipleresponsebodies) [Fakemultipleresponsebodies.get](docs/apis/paths/Fakemultipleresponsebodies.md#get) [FakemultipleresponsebodiesGet.Get.get](docs/paths/fakemultipleresponsebodies/FakemultipleresponsebodiesGet.md#get) | multiple responses have response bodies | +| /fake/multipleSecurities **get** | [Fake.multipleSecurities](docs/apis/tags/Fake.md#multiplesecurities) [Fakemultiplesecurities.get](docs/apis/paths/Fakemultiplesecurities.md#get) [FakemultiplesecuritiesGet.Get.get](docs/paths/fakemultiplesecurities/FakemultiplesecuritiesGet.md#get) | multiple security requirements | +| /fake/objInQuery **get** | [Fake.objectInQuery](docs/apis/tags/Fake.md#objectinquery) [Fakeobjinquery.get](docs/apis/paths/Fakeobjinquery.md#get) [FakeobjinqueryGet.Get.get](docs/paths/fakeobjinquery/FakeobjinqueryGet.md#get) | user list | +| /fake/parameterCollisions/{1}/{aB}/{Ab}/{self}/{A-B}/ **post** | [Fake.parameterCollisions](docs/apis/tags/Fake.md#parametercollisions) [Fakeparametercollisions1ababselfab.post](docs/apis/paths/Fakeparametercollisions1ababselfab.md#post) [Fakeparametercollisions1ababselfabPost.Post.post](docs/paths/fakeparametercollisions1ababselfab/Fakeparametercollisions1ababselfabPost.md#post) | parameter collision case | +| /fake/pemContentType **get** | [Fake.pemContentType](docs/apis/tags/Fake.md#pemcontenttype) [Fakepemcontenttype.get](docs/apis/paths/Fakepemcontenttype.md#get) [FakepemcontenttypeGet.Get.get](docs/paths/fakepemcontenttype/FakepemcontenttypeGet.md#get) | route with tx and rx pem content type | +| /fake/queryParamWithJsonContentType **get** | [Fake.queryParamWithJsonContentType](docs/apis/tags/Fake.md#queryparamwithjsoncontenttype) [Fakequeryparamwithjsoncontenttype.get](docs/apis/paths/Fakequeryparamwithjsoncontenttype.md#get) [FakequeryparamwithjsoncontenttypeGet.Get.get](docs/paths/fakequeryparamwithjsoncontenttype/FakequeryparamwithjsoncontenttypeGet.md#get) | query param with json content-type | +| /fake/redirection **get** | [Fake.redirection](docs/apis/tags/Fake.md#redirection) [Fakeredirection.get](docs/apis/paths/Fakeredirection.md#get) [FakeredirectionGet.Get.get](docs/paths/fakeredirection/FakeredirectionGet.md#get) | operation with redirection responses | +| /fake/refObjInQuery **get** | [Fake.refObjectInQuery](docs/apis/tags/Fake.md#refobjectinquery) [Fakerefobjinquery.get](docs/apis/paths/Fakerefobjinquery.md#get) [FakerefobjinqueryGet.Get.get](docs/paths/fakerefobjinquery/FakerefobjinqueryGet.md#get) | user list | +| /fake/refs/array-of-enums **post** | [Fake.arrayOfEnums](docs/apis/tags/Fake.md#arrayofenums) [Fakerefsarrayofenums.post](docs/apis/paths/Fakerefsarrayofenums.md#post) [FakerefsarrayofenumsPost.Post.post](docs/paths/fakerefsarrayofenums/FakerefsarrayofenumsPost.md#post) | Array of Enums | +| /fake/refs/arraymodel **post** | [Fake.arrayModel](docs/apis/tags/Fake.md#arraymodel) [Fakerefsarraymodel.post](docs/apis/paths/Fakerefsarraymodel.md#post) [FakerefsarraymodelPost.Post.post](docs/paths/fakerefsarraymodel/FakerefsarraymodelPost.md#post) | | +| /fake/refs/boolean **post** | [Fake.modelBoolean](docs/apis/tags/Fake.md#modelboolean) [Fakerefsboolean.post](docs/apis/paths/Fakerefsboolean.md#post) [FakerefsbooleanPost.Post.post](docs/paths/fakerefsboolean/FakerefsbooleanPost.md#post) | | +| /fake/refs/composed_one_of_number_with_validations **post** | [Fake.composedOneOfDifferentTypes](docs/apis/tags/Fake.md#composedoneofdifferenttypes) [Fakerefscomposedoneofnumberwithvalidations.post](docs/apis/paths/Fakerefscomposedoneofnumberwithvalidations.md#post) [FakerefscomposedoneofnumberwithvalidationsPost.Post.post](docs/paths/fakerefscomposedoneofnumberwithvalidations/FakerefscomposedoneofnumberwithvalidationsPost.md#post) | | +| /fake/refs/enum **post** | [Fake.stringEnum](docs/apis/tags/Fake.md#stringenum) [Fakerefsenum.post](docs/apis/paths/Fakerefsenum.md#post) [FakerefsenumPost.Post.post](docs/paths/fakerefsenum/FakerefsenumPost.md#post) | | +| /fake/refs/mammal **post** | [Fake.mammal](docs/apis/tags/Fake.md#mammal) [Fakerefsmammal.post](docs/apis/paths/Fakerefsmammal.md#post) [FakerefsmammalPost.Post.post](docs/paths/fakerefsmammal/FakerefsmammalPost.md#post) | | +| /fake/refs/number **post** | [Fake.numberWithValidations](docs/apis/tags/Fake.md#numberwithvalidations) [Fakerefsnumber.post](docs/apis/paths/Fakerefsnumber.md#post) [FakerefsnumberPost.Post.post](docs/paths/fakerefsnumber/FakerefsnumberPost.md#post) | | +| /fake/refs/object_model_with_ref_props **post** | [Fake.objectModelWithRefProps](docs/apis/tags/Fake.md#objectmodelwithrefprops) [Fakerefsobjectmodelwithrefprops.post](docs/apis/paths/Fakerefsobjectmodelwithrefprops.md#post) [FakerefsobjectmodelwithrefpropsPost.Post.post](docs/paths/fakerefsobjectmodelwithrefprops/FakerefsobjectmodelwithrefpropsPost.md#post) | | +| /fake/refs/string **post** | [Fake.modelString](docs/apis/tags/Fake.md#modelstring) [Fakerefsstring.post](docs/apis/paths/Fakerefsstring.md#post) [FakerefsstringPost.Post.post](docs/paths/fakerefsstring/FakerefsstringPost.md#post) | | +| /fake/responseWithoutSchema **get** | [Fake.responseWithoutSchema](docs/apis/tags/Fake.md#responsewithoutschema) [Fakeresponsewithoutschema.get](docs/apis/paths/Fakeresponsewithoutschema.md#get) [FakeresponsewithoutschemaGet.Get.get](docs/paths/fakeresponsewithoutschema/FakeresponsewithoutschemaGet.md#get) | receives a response without schema | +| /fake/test-query-paramters **put** | [Fake.queryParameterCollectionFormat](docs/apis/tags/Fake.md#queryparametercollectionformat) [Faketestqueryparamters.put](docs/apis/paths/Faketestqueryparamters.md#put) [FaketestqueryparamtersPut.Put.put](docs/paths/faketestqueryparamters/FaketestqueryparamtersPut.md#put) | | +| /fake/uploadDownloadFile **post** | [Fake.uploadDownloadFile](docs/apis/tags/Fake.md#uploaddownloadfile) [Fakeuploaddownloadfile.post](docs/apis/paths/Fakeuploaddownloadfile.md#post) [FakeuploaddownloadfilePost.Post.post](docs/paths/fakeuploaddownloadfile/FakeuploaddownloadfilePost.md#post) | uploads a file and downloads a file using application/octet-stream | +| /fake/uploadFile **post** | [Fake.uploadFile](docs/apis/tags/Fake.md#uploadfile) [Fakeuploadfile.post](docs/apis/paths/Fakeuploadfile.md#post) [FakeuploadfilePost.Post.post](docs/paths/fakeuploadfile/FakeuploadfilePost.md#post) | uploads a file using multipart/form-data | +| /fake/uploadFiles **post** | [Fake.uploadFiles](docs/apis/tags/Fake.md#uploadfiles) [Fakeuploadfiles.post](docs/apis/paths/Fakeuploadfiles.md#post) [FakeuploadfilesPost.Post.post](docs/paths/fakeuploadfiles/FakeuploadfilesPost.md#post) | uploads files using multipart/form-data | +| /fake/wildCardResponses **get** | [Fake.wildCardResponses](docs/apis/tags/Fake.md#wildcardresponses) [Fakewildcardresponses.get](docs/apis/paths/Fakewildcardresponses.md#get) [FakewildcardresponsesGet.Get.get](docs/paths/fakewildcardresponses/FakewildcardresponsesGet.md#get) | operation with wildcard responses | +| /fake/{petId}/uploadImageWithRequiredFile **post** | [Pet.uploadFileWithRequiredFile](docs/apis/tags/Pet.md#uploadfilewithrequiredfile) [Fakepetiduploadimagewithrequiredfile.post](docs/apis/paths/Fakepetiduploadimagewithrequiredfile.md#post) [FakepetiduploadimagewithrequiredfilePost.Post.post](docs/paths/fakepetiduploadimagewithrequiredfile/FakepetiduploadimagewithrequiredfilePost.md#post) | uploads an image (required) | +| /fake_classname_test **patch** | [Fakeclassnametags123.classname](docs/apis/tags/Fakeclassnametags123.md#classname) [Fakeclassnametest.patch](docs/apis/paths/Fakeclassnametest.md#patch) [FakeclassnametestPatch.Patch.patch](docs/paths/fakeclassnametest/FakeclassnametestPatch.md#patch) | To test class name in snake case | +| /foo **get** | [Default.fooGet](docs/apis/tags/Default.md#fooget) [Foo.get](docs/apis/paths/Foo.md#get) [FooGet.Get.get](docs/paths/foo/FooGet.md#get) | | +| /pet **post** | [Pet.addPet](docs/apis/tags/Pet.md#addpet) [Pet.post](docs/apis/paths/Pet.md#post) [PetPost.Post.post](docs/paths/pet/PetPost.md#post) | Add a new pet to the store | +| /pet **put** | [Pet.updatePet](docs/apis/tags/Pet.md#updatepet) [Pet.put](docs/apis/paths/Pet.md#put) [PetPut.Put.put](docs/paths/pet/PetPut.md#put) | Update an existing pet | +| /pet/findByStatus **get** | [Pet.findPetsByStatus](docs/apis/tags/Pet.md#findpetsbystatus) [Petfindbystatus.get](docs/apis/paths/Petfindbystatus.md#get) [PetfindbystatusGet.Get.get](docs/paths/petfindbystatus/PetfindbystatusGet.md#get) | Finds Pets by status | +| /pet/findByTags **get** | [Pet.findPetsByTags](docs/apis/tags/Pet.md#findpetsbytags) [Petfindbytags.get](docs/apis/paths/Petfindbytags.md#get) [PetfindbytagsGet.Get.get](docs/paths/petfindbytags/PetfindbytagsGet.md#get) | Finds Pets by tags | +| /pet/{petId} **delete** | [Pet.deletePet](docs/apis/tags/Pet.md#deletepet) [Petpetid.delete](docs/apis/paths/Petpetid.md#delete) [PetpetidDelete.Delete.delete](docs/paths/petpetid/PetpetidDelete.md#delete) | Deletes a pet | +| /pet/{petId} **get** | [Pet.getPetById](docs/apis/tags/Pet.md#getpetbyid) [Petpetid.get](docs/apis/paths/Petpetid.md#get) [PetpetidGet.Get.get](docs/paths/petpetid/PetpetidGet.md#get) | Find pet by ID | +| /pet/{petId} **post** | [Pet.updatePetWithForm](docs/apis/tags/Pet.md#updatepetwithform) [Petpetid.post](docs/apis/paths/Petpetid.md#post) [PetpetidPost.Post.post](docs/paths/petpetid/PetpetidPost.md#post) | Updates a pet in the store with form data | +| /pet/{petId}/uploadImage **post** | [Pet.uploadImage](docs/apis/tags/Pet.md#uploadimage) [Petpetiduploadimage.post](docs/apis/paths/Petpetiduploadimage.md#post) [PetpetiduploadimagePost.Post.post](docs/paths/petpetiduploadimage/PetpetiduploadimagePost.md#post) | uploads an image | +| /store/inventory **get** | [Store.getInventory](docs/apis/tags/Store.md#getinventory) [Storeinventory.get](docs/apis/paths/Storeinventory.md#get) [StoreinventoryGet.Get.get](docs/paths/storeinventory/StoreinventoryGet.md#get) | Returns pet inventories by status | +| /store/order **post** | [Store.placeOrder](docs/apis/tags/Store.md#placeorder) [Storeorder.post](docs/apis/paths/Storeorder.md#post) [StoreorderPost.Post.post](docs/paths/storeorder/StoreorderPost.md#post) | Place an order for a pet | +| /store/order/{order_id} **delete** | [Store.deleteOrder](docs/apis/tags/Store.md#deleteorder) [Storeorderorderid.delete](docs/apis/paths/Storeorderorderid.md#delete) [StoreorderorderidDelete.Delete.delete](docs/paths/storeorderorderid/StoreorderorderidDelete.md#delete) | Delete purchase order by ID | +| /store/order/{order_id} **get** | [Store.getOrderById](docs/apis/tags/Store.md#getorderbyid) [Storeorderorderid.get](docs/apis/paths/Storeorderorderid.md#get) [StoreorderorderidGet.Get.get](docs/paths/storeorderorderid/StoreorderorderidGet.md#get) | Find purchase order by ID | +| /user **post** | [User.createUser](docs/apis/tags/User.md#createuser) [User.post](docs/apis/paths/User.md#post) [UserPost.Post.post](docs/paths/user/UserPost.md#post) | Create user | +| /user/createWithArray **post** | [User.createUsersWithArrayInput](docs/apis/tags/User.md#createuserswitharrayinput) [Usercreatewitharray.post](docs/apis/paths/Usercreatewitharray.md#post) [UsercreatewitharrayPost.Post.post](docs/paths/usercreatewitharray/UsercreatewitharrayPost.md#post) | Creates list of users with given input array | +| /user/createWithList **post** | [User.createUsersWithListInput](docs/apis/tags/User.md#createuserswithlistinput) [Usercreatewithlist.post](docs/apis/paths/Usercreatewithlist.md#post) [UsercreatewithlistPost.Post.post](docs/paths/usercreatewithlist/UsercreatewithlistPost.md#post) | Creates list of users with given input array | +| /user/login **get** | [User.loginUser](docs/apis/tags/User.md#loginuser) [Userlogin.get](docs/apis/paths/Userlogin.md#get) [UserloginGet.Get.get](docs/paths/userlogin/UserloginGet.md#get) | Logs user into the system | +| /user/logout **get** | [User.logoutUser](docs/apis/tags/User.md#logoutuser) [Userlogout.get](docs/apis/paths/Userlogout.md#get) [UserlogoutGet.Get.get](docs/paths/userlogout/UserlogoutGet.md#get) | Logs out current logged in user session | +| /user/{username} **delete** | [User.deleteUser](docs/apis/tags/User.md#deleteuser) [Userusername.delete](docs/apis/paths/Userusername.md#delete) [UserusernameDelete.Delete.delete](docs/paths/userusername/UserusernameDelete.md#delete) | Delete user | +| /user/{username} **get** | [User.getUserByName](docs/apis/tags/User.md#getuserbyname) [Userusername.get](docs/apis/paths/Userusername.md#get) [UserusernameGet.Get.get](docs/paths/userusername/UserusernameGet.md#get) | Get user by user name | +| /user/{username} **put** | [User.updateUser](docs/apis/tags/User.md#updateuser) [Userusername.put](docs/apis/paths/Userusername.md#put) [UserusernamePut.Put.put](docs/paths/userusername/UserusernamePut.md#put) | Updated user | + +## Component Schemas +| Class | Description | +| ----- | ----------- | +| [Schema200Response.Schema200Response1](docs/components/schemas/Schema200Response.md#schema200response1) | model with an invalid class name for python, starts with a number | +| [AbstractStepMessage.AbstractStepMessage1](docs/components/schemas/AbstractStepMessage.md#abstractstepmessage1) | Abstract Step | +| [AdditionalPropertiesClass.AdditionalPropertiesClass1](docs/components/schemas/AdditionalPropertiesClass.md#additionalpropertiesclass1) | | +| [AdditionalPropertiesSchema.AdditionalPropertiesSchema1](docs/components/schemas/AdditionalPropertiesSchema.md#additionalpropertiesschema1) | | +| [AdditionalPropertiesWithArrayOfEnums.AdditionalPropertiesWithArrayOfEnums1](docs/components/schemas/AdditionalPropertiesWithArrayOfEnums.md#additionalpropertieswitharrayofenums1) | | +| [Address.Address1](docs/components/schemas/Address.md#address1) | | +| [Animal.Animal1](docs/components/schemas/Animal.md#animal1) | | +| [AnimalFarm.AnimalFarm1](docs/components/schemas/AnimalFarm.md#animalfarm1) | | +| [AnyTypeAndFormat.AnyTypeAndFormat1](docs/components/schemas/AnyTypeAndFormat.md#anytypeandformat1) | | +| [AnyTypeNotString.AnyTypeNotString1](docs/components/schemas/AnyTypeNotString.md#anytypenotstring1) | | +| [ApiResponseSchema.ApiResponseSchema1](docs/components/schemas/ApiResponseSchema.md#apiresponseschema1) | | +| [ArrayHoldingAnyType.ArrayHoldingAnyType1](docs/components/schemas/ArrayHoldingAnyType.md#arrayholdinganytype1) | | +| [ArrayOfArrayOfNumberOnly.ArrayOfArrayOfNumberOnly1](docs/components/schemas/ArrayOfArrayOfNumberOnly.md#arrayofarrayofnumberonly1) | | +| [ArrayOfEnums.ArrayOfEnums1](docs/components/schemas/ArrayOfEnums.md#arrayofenums1) | | +| [ArrayOfNumberOnly.ArrayOfNumberOnly1](docs/components/schemas/ArrayOfNumberOnly.md#arrayofnumberonly1) | | +| [ArrayTest.ArrayTest1](docs/components/schemas/ArrayTest.md#arraytest1) | | +| [ArrayWithValidationsInItems.ArrayWithValidationsInItems1](docs/components/schemas/ArrayWithValidationsInItems.md#arraywithvalidationsinitems1) | | +| [Bar.Bar1](docs/components/schemas/Bar.md#bar1) | | +| [BasquePig.BasquePig1](docs/components/schemas/BasquePig.md#basquepig1) | | +| [BooleanSchema.BooleanSchema1](docs/components/schemas/BooleanSchema.md#booleanschema1) | | +| [BooleanEnum.BooleanEnum1](docs/components/schemas/BooleanEnum.md#booleanenum1) | | +| [Capitalization.Capitalization1](docs/components/schemas/Capitalization.md#capitalization1) | | +| [Cat.Cat1](docs/components/schemas/Cat.md#cat1) | | +| [Category.Category1](docs/components/schemas/Category.md#category1) | | +| [ChildCat.ChildCat1](docs/components/schemas/ChildCat.md#childcat1) | | +| [ClassModel.ClassModel1](docs/components/schemas/ClassModel.md#classmodel1) | Model for testing model with "_class" property | +| [Client.Client1](docs/components/schemas/Client.md#client1) | | +| [ComplexQuadrilateral.ComplexQuadrilateral1](docs/components/schemas/ComplexQuadrilateral.md#complexquadrilateral1) | | +| [ComposedAnyOfDifferentTypesNoValidations.ComposedAnyOfDifferentTypesNoValidations1](docs/components/schemas/ComposedAnyOfDifferentTypesNoValidations.md#composedanyofdifferenttypesnovalidations1) | | +| [ComposedArray.ComposedArray1](docs/components/schemas/ComposedArray.md#composedarray1) | | +| [ComposedBool.ComposedBool1](docs/components/schemas/ComposedBool.md#composedbool1) | | +| [ComposedNone.ComposedNone1](docs/components/schemas/ComposedNone.md#composednone1) | | +| [ComposedNumber.ComposedNumber1](docs/components/schemas/ComposedNumber.md#composednumber1) | | +| [ComposedObject.ComposedObject1](docs/components/schemas/ComposedObject.md#composedobject1) | | +| [ComposedOneOfDifferentTypes.ComposedOneOfDifferentTypes1](docs/components/schemas/ComposedOneOfDifferentTypes.md#composedoneofdifferenttypes1) | this is a model that allows payloads of type object or number | +| [ComposedString.ComposedString1](docs/components/schemas/ComposedString.md#composedstring1) | | +| [Currency.Currency1](docs/components/schemas/Currency.md#currency1) | | +| [DanishPig.DanishPig1](docs/components/schemas/DanishPig.md#danishpig1) | | +| [DateTimeTest.DateTimeTest1](docs/components/schemas/DateTimeTest.md#datetimetest1) | | +| [DateTimeWithValidations.DateTimeWithValidations1](docs/components/schemas/DateTimeWithValidations.md#datetimewithvalidations1) | | +| [DateWithValidations.DateWithValidations1](docs/components/schemas/DateWithValidations.md#datewithvalidations1) | | +| [DecimalPayload.DecimalPayload1](docs/components/schemas/DecimalPayload.md#decimalpayload1) | | +| [Dog.Dog1](docs/components/schemas/Dog.md#dog1) | | +| [Drawing.Drawing1](docs/components/schemas/Drawing.md#drawing1) | | +| [EnumArrays.EnumArrays1](docs/components/schemas/EnumArrays.md#enumarrays1) | | +| [EnumClass.EnumClass1](docs/components/schemas/EnumClass.md#enumclass1) | | +| [EnumTest.EnumTest1](docs/components/schemas/EnumTest.md#enumtest1) | | +| [EquilateralTriangle.EquilateralTriangle1](docs/components/schemas/EquilateralTriangle.md#equilateraltriangle1) | | +| [File.File1](docs/components/schemas/File.md#file1) | Must be named `File` for test. | +| [FileSchemaTestClass.FileSchemaTestClass1](docs/components/schemas/FileSchemaTestClass.md#fileschematestclass1) | | +| [Foo.Foo1](docs/components/schemas/Foo.md#foo1) | | +| [FormatTest.FormatTest1](docs/components/schemas/FormatTest.md#formattest1) | | +| [FromSchema.FromSchema1](docs/components/schemas/FromSchema.md#fromschema1) | | +| [GrandparentAnimal.GrandparentAnimal1](docs/components/schemas/GrandparentAnimal.md#grandparentanimal1) | | +| [HealthCheckResult.HealthCheckResult1](docs/components/schemas/HealthCheckResult.md#healthcheckresult1) | Just a string to inform instance is up and running. Make it nullable in hope to get it as pointer in generated model. | +| [IntegerEnum.IntegerEnum1](docs/components/schemas/IntegerEnum.md#integerenum1) | | +| [IntegerEnumBig.IntegerEnumBig1](docs/components/schemas/IntegerEnumBig.md#integerenumbig1) | | +| [IntegerEnumOneValue.IntegerEnumOneValue1](docs/components/schemas/IntegerEnumOneValue.md#integerenumonevalue1) | | +| [IntegerEnumWithDefaultValue.IntegerEnumWithDefaultValue1](docs/components/schemas/IntegerEnumWithDefaultValue.md#integerenumwithdefaultvalue1) | | +| [IntegerMax10.IntegerMax101](docs/components/schemas/IntegerMax10.md#integermax101) | | +| [IntegerMin15.IntegerMin151](docs/components/schemas/IntegerMin15.md#integermin151) | | +| [IsoscelesTriangle.IsoscelesTriangle1](docs/components/schemas/IsoscelesTriangle.md#isoscelestriangle1) | | +| [Items.Items1](docs/components/schemas/Items.md#items1) | component's name collides with the inner schema name | +| [ItemsSchema.ItemsSchema1](docs/components/schemas/ItemsSchema.md#itemsschema1) | | +| [JSONPatchRequest.JSONPatchRequest1](docs/components/schemas/JSONPatchRequest.md#jsonpatchrequest1) | | +| [JSONPatchRequestAddReplaceTest.JSONPatchRequestAddReplaceTest1](docs/components/schemas/JSONPatchRequestAddReplaceTest.md#jsonpatchrequestaddreplacetest1) | | +| [JSONPatchRequestMoveCopy.JSONPatchRequestMoveCopy1](docs/components/schemas/JSONPatchRequestMoveCopy.md#jsonpatchrequestmovecopy1) | | +| [JSONPatchRequestRemove.JSONPatchRequestRemove1](docs/components/schemas/JSONPatchRequestRemove.md#jsonpatchrequestremove1) | | +| [MapTest.MapTest1](docs/components/schemas/MapTest.md#maptest1) | | +| [MixedPropertiesAndAdditionalPropertiesClass.MixedPropertiesAndAdditionalPropertiesClass1](docs/components/schemas/MixedPropertiesAndAdditionalPropertiesClass.md#mixedpropertiesandadditionalpropertiesclass1) | | +| [Money.Money1](docs/components/schemas/Money.md#money1) | | +| [MultiPropertiesSchema.MultiPropertiesSchema1](docs/components/schemas/MultiPropertiesSchema.md#multipropertiesschema1) | | +| [MyObjectDto.MyObjectDto1](docs/components/schemas/MyObjectDto.md#myobjectdto1) | | +| [Name.Name1](docs/components/schemas/Name.md#name1) | Model for testing model name same as property name | +| [NoAdditionalProperties.NoAdditionalProperties1](docs/components/schemas/NoAdditionalProperties.md#noadditionalproperties1) | | +| [NullableClass.NullableClass1](docs/components/schemas/NullableClass.md#nullableclass1) | | +| [NullableShape.NullableShape1](docs/components/schemas/NullableShape.md#nullableshape1) | The value may be a shape or the 'null' value. For a composed schema to validate a null payload, one of its chosen oneOf schemas must be type null or nullable (introduced in OAS schema >= 3.0) | +| [NullableString.NullableString1](docs/components/schemas/NullableString.md#nullablestring1) | | +| [NumberSchema.NumberSchema1](docs/components/schemas/NumberSchema.md#numberschema1) | | +| [NumberOnly.NumberOnly1](docs/components/schemas/NumberOnly.md#numberonly1) | | +| [NumberWithExclusiveMinMax.NumberWithExclusiveMinMax1](docs/components/schemas/NumberWithExclusiveMinMax.md#numberwithexclusiveminmax1) | | +| [NumberWithValidations.NumberWithValidations1](docs/components/schemas/NumberWithValidations.md#numberwithvalidations1) | | +| [ObjWithRequiredProps.ObjWithRequiredProps1](docs/components/schemas/ObjWithRequiredProps.md#objwithrequiredprops1) | | +| [ObjWithRequiredPropsBase.ObjWithRequiredPropsBase1](docs/components/schemas/ObjWithRequiredPropsBase.md#objwithrequiredpropsbase1) | | +| [ObjectInterface.ObjectInterface1](docs/components/schemas/ObjectInterface.md#objectinterface1) | | +| [ObjectModelWithArgAndArgsProperties.ObjectModelWithArgAndArgsProperties1](docs/components/schemas/ObjectModelWithArgAndArgsProperties.md#objectmodelwithargandargsproperties1) | | +| [ObjectModelWithRefProps.ObjectModelWithRefProps1](docs/components/schemas/ObjectModelWithRefProps.md#objectmodelwithrefprops1) | a model that includes properties which should stay primitive (String + Boolean) and one which is defined as a class, NumberWithValidations | +| [ObjectWithAllOfWithReqTestPropFromUnsetAddProp.ObjectWithAllOfWithReqTestPropFromUnsetAddProp1](docs/components/schemas/ObjectWithAllOfWithReqTestPropFromUnsetAddProp.md#objectwithallofwithreqtestpropfromunsetaddprop1) | | +| [ObjectWithCollidingProperties.ObjectWithCollidingProperties1](docs/components/schemas/ObjectWithCollidingProperties.md#objectwithcollidingproperties1) | component with properties that have name collisions | +| [ObjectWithDecimalProperties.ObjectWithDecimalProperties1](docs/components/schemas/ObjectWithDecimalProperties.md#objectwithdecimalproperties1) | | +| [ObjectWithDifficultlyNamedProps.ObjectWithDifficultlyNamedProps1](docs/components/schemas/ObjectWithDifficultlyNamedProps.md#objectwithdifficultlynamedprops1) | model with properties that have invalid names for python | +| [ObjectWithInlineCompositionProperty.ObjectWithInlineCompositionProperty1](docs/components/schemas/ObjectWithInlineCompositionProperty.md#objectwithinlinecompositionproperty1) | | +| [ObjectWithInvalidNamedRefedProperties.ObjectWithInvalidNamedRefedProperties1](docs/components/schemas/ObjectWithInvalidNamedRefedProperties.md#objectwithinvalidnamedrefedproperties1) | | +| [ObjectWithNonIntersectingValues.ObjectWithNonIntersectingValues1](docs/components/schemas/ObjectWithNonIntersectingValues.md#objectwithnonintersectingvalues1) | | +| [ObjectWithOnlyOptionalProps.ObjectWithOnlyOptionalProps1](docs/components/schemas/ObjectWithOnlyOptionalProps.md#objectwithonlyoptionalprops1) | | +| [ObjectWithOptionalTestProp.ObjectWithOptionalTestProp1](docs/components/schemas/ObjectWithOptionalTestProp.md#objectwithoptionaltestprop1) | | +| [ObjectWithValidations.ObjectWithValidations1](docs/components/schemas/ObjectWithValidations.md#objectwithvalidations1) | | +| [Order.Order1](docs/components/schemas/Order.md#order1) | | +| [PaginatedResultMyObjectDto.PaginatedResultMyObjectDto1](docs/components/schemas/PaginatedResultMyObjectDto.md#paginatedresultmyobjectdto1) | | +| [ParentPet.ParentPet1](docs/components/schemas/ParentPet.md#parentpet1) | | +| [Pet.Pet1](docs/components/schemas/Pet.md#pet1) | Pet object that needs to be added to the store | +| [Pig.Pig1](docs/components/schemas/Pig.md#pig1) | | +| [Player.Player1](docs/components/schemas/Player.md#player1) | a model that includes a self reference this forces properties and additionalProperties to be lazy loaded in python models because the Player class has not fully loaded when defining properties | +| [PublicKey.PublicKey1](docs/components/schemas/PublicKey.md#publickey1) | schema that contains a property named key | +| [Quadrilateral.Quadrilateral1](docs/components/schemas/Quadrilateral.md#quadrilateral1) | | +| [QuadrilateralInterface.QuadrilateralInterface1](docs/components/schemas/QuadrilateralInterface.md#quadrilateralinterface1) | | +| [ReadOnlyFirst.ReadOnlyFirst1](docs/components/schemas/ReadOnlyFirst.md#readonlyfirst1) | | +| [RefPet.RefPet1](docs/components/schemas/RefPet.md#refpet1) | | +| [ReqPropsFromExplicitAddProps.ReqPropsFromExplicitAddProps1](docs/components/schemas/ReqPropsFromExplicitAddProps.md#reqpropsfromexplicitaddprops1) | | +| [ReqPropsFromTrueAddProps.ReqPropsFromTrueAddProps1](docs/components/schemas/ReqPropsFromTrueAddProps.md#reqpropsfromtrueaddprops1) | | +| [ReqPropsFromUnsetAddProps.ReqPropsFromUnsetAddProps1](docs/components/schemas/ReqPropsFromUnsetAddProps.md#reqpropsfromunsetaddprops1) | | +| [ReturnSchema.ReturnSchema1](docs/components/schemas/ReturnSchema.md#returnschema1) | Model for testing reserved words | +| [ScaleneTriangle.ScaleneTriangle1](docs/components/schemas/ScaleneTriangle.md#scalenetriangle1) | | +| [SelfReferencingArrayModel.SelfReferencingArrayModel1](docs/components/schemas/SelfReferencingArrayModel.md#selfreferencingarraymodel1) | | +| [SelfReferencingObjectModel.SelfReferencingObjectModel1](docs/components/schemas/SelfReferencingObjectModel.md#selfreferencingobjectmodel1) | | +| [Shape.Shape1](docs/components/schemas/Shape.md#shape1) | | +| [ShapeOrNull.ShapeOrNull1](docs/components/schemas/ShapeOrNull.md#shapeornull1) | The value may be a shape or the 'null' value. This is introduced in OAS schema >= 3.1. | +| [SimpleQuadrilateral.SimpleQuadrilateral1](docs/components/schemas/SimpleQuadrilateral.md#simplequadrilateral1) | | +| [SomeObject.SomeObject1](docs/components/schemas/SomeObject.md#someobject1) | | +| [StringSchema.StringSchema1](docs/components/schemas/StringSchema.md#stringschema1) | | +| [StringBooleanMap.StringBooleanMap1](docs/components/schemas/StringBooleanMap.md#stringbooleanmap1) | | +| [StringEnum.StringEnum1](docs/components/schemas/StringEnum.md#stringenum1) | | +| [StringEnumWithDefaultValue.StringEnumWithDefaultValue1](docs/components/schemas/StringEnumWithDefaultValue.md#stringenumwithdefaultvalue1) | | +| [StringWithValidation.StringWithValidation1](docs/components/schemas/StringWithValidation.md#stringwithvalidation1) | | +| [Tag.Tag1](docs/components/schemas/Tag.md#tag1) | | +| [Triangle.Triangle1](docs/components/schemas/Triangle.md#triangle1) | | +| [TriangleInterface.TriangleInterface1](docs/components/schemas/TriangleInterface.md#triangleinterface1) | | +| [UUIDString.UUIDString1](docs/components/schemas/UUIDString.md#uuidstring1) | | +| [User.User1](docs/components/schemas/User.md#user1) | | +| [SpecialModelname.SpecialModelname1](docs/components/schemas/SpecialModelname.md#specialmodelname1) | model with an invalid class name for python | +| [Apple.Apple1](docs/components/schemas/Apple.md#apple1) | | +| [AppleReq.AppleReq1](docs/components/schemas/AppleReq.md#applereq1) | | +| [Banana.Banana1](docs/components/schemas/Banana.md#banana1) | | +| [BananaReq.BananaReq1](docs/components/schemas/BananaReq.md#bananareq1) | | +| [Fruit.Fruit1](docs/components/schemas/Fruit.md#fruit1) | | +| [FruitReq.FruitReq1](docs/components/schemas/FruitReq.md#fruitreq1) | | +| [GmFruit.GmFruit1](docs/components/schemas/GmFruit.md#gmfruit1) | | +| [HasOnlyReadOnly.HasOnlyReadOnly1](docs/components/schemas/HasOnlyReadOnly.md#hasonlyreadonly1) | | +| [Mammal.Mammal1](docs/components/schemas/Mammal.md#mammal1) | | +| [Whale.Whale1](docs/components/schemas/Whale.md#whale1) | | +| [Zebra.Zebra1](docs/components/schemas/Zebra.md#zebra1) | | + +## Component RequestBodies +| Class | Description | +| ----- | ----------- | +| [Client.Client1](docs/components/requestbodies/Client.md#client1) | client model | +| [Pet.Pet1](docs/components/requestbodies/Pet.md#pet1) | Pet object that needs to be added to the store, multiple content types | +| [RefUserArray.RefUserArray1](docs/components/requestbodies/RefUserArray.md#refuserarray1) | | +| [UserArray.UserArray1](docs/components/requestbodies/UserArray.md#userarray1) | List of user object | + +## Component Responses +| Class | Description | +| ----- | ----------- | +| [HeadersWithNoBody.HeadersWithNoBody1](docs/components/responses/HeadersWithNoBody.md#headerswithnobody1) | A response that contains headers but no body
| +| [RefSuccessDescriptionOnly.RefSuccessDescriptionOnly1](docs/components/responses/RefSuccessDescriptionOnly.md#refsuccessdescriptiononly1) || +| [RefSuccessfulXmlAndJsonArrayOfPet.RefSuccessfulXmlAndJsonArrayOfPet1](docs/components/responses/RefSuccessfulXmlAndJsonArrayOfPet.md#refsuccessfulxmlandjsonarrayofpet1) || +| [SuccessDescriptionOnly.SuccessDescriptionOnly1](docs/components/responses/SuccessDescriptionOnly.md#successdescriptiononly1) | Success| +| [SuccessInlineContentAndHeader.SuccessInlineContentAndHeader1](docs/components/responses/SuccessInlineContentAndHeader.md#successinlinecontentandheader1) | successful operation| +| [SuccessWithJsonApiResponse.SuccessWithJsonApiResponse1](docs/components/responses/SuccessWithJsonApiResponse.md#successwithjsonapiresponse1) | successful operation| +| [SuccessfulXmlAndJsonArrayOfPet.SuccessfulXmlAndJsonArrayOfPet1](docs/components/responses/SuccessfulXmlAndJsonArrayOfPet.md#successfulxmlandjsonarrayofpet1) | successful operation, multiple content types| + +## Component Headers +| Class | Description | +| ----- | ----------- | +| [Int32JsonContentTypeHeader.Int32JsonContentTypeHeader1](docs/components/headers/Int32JsonContentTypeHeader.md#int32jsoncontenttypeheader1) | int32 JSON content-type header | +| [NumberHeader.NumberHeader1](docs/components/headers/NumberHeader.md#numberheader1) | number header description | +| [RefContentSchemaHeader.RefContentSchemaHeader1](docs/components/headers/RefContentSchemaHeader.md#refcontentschemaheader1) | int32 JSON content-type header | +| [RefSchemaHeader.RefSchemaHeader1](docs/components/headers/RefSchemaHeader.md#refschemaheader1) | header that has a ref in the schema | +| [RefStringHeader.RefStringHeader1](docs/components/headers/RefStringHeader.md#refstringheader1) | | +| [StringHeader.StringHeader1](docs/components/headers/StringHeader.md#stringheader1) | string header description | + +## Component Parameters +| Class | Description | +| ----- | ----------- | +| [ComponentRefSchemaStringWithValidation.ComponentRefSchemaStringWithValidation1](docs/components/parameters/ComponentRefSchemaStringWithValidation.md#componentrefschemastringwithvalidation1) | a path string with validation | +| [PathUserName.PathUserName1](docs/components/parameters/PathUserName.md#pathusername1) | the use name to use | +| [RefPathUserName.RefPathUserName1](docs/components/parameters/RefPathUserName.md#refpathusername1) | | +| [RefSchemaStringWithValidation.RefSchemaStringWithValidation1](docs/components/parameters/RefSchemaStringWithValidation.md#refschemastringwithvalidation1) | a path string with validation | diff --git a/samples/client/petstore/kotlin/build.gradle.kts b/samples/client/petstore/kotlin/build.gradle.kts new file mode 100644 index 00000000000..a8784c201b8 --- /dev/null +++ b/samples/client/petstore/kotlin/build.gradle.kts @@ -0,0 +1,64 @@ +import org.checkerframework.gradle.plugin.CheckerFrameworkExtension + +plugins { + `java-library` + `maven-publish` + id("org.checkerframework") version "0.6.33" +} + +repositories { + mavenLocal() + maven { + url = uri("https://repo.maven.apache.org/maven2/") + } +} + +dependencies { + implementation("org.checkerframework:checker-qual:3.42.0") + implementation("com.google.code.gson:gson:2.10.1") + testImplementation("junit:junit:4.13.2") + checkerFramework("org.checkerframework:checker:3.42.0") +} + +configure { + checkers = listOf( + "org.checkerframework.checker.nullness.NullnessChecker" + ) +} + +group = "org.openapijsonschematools" +version = "1.0.0" +description = "OpenAPI Kotlin" + +val testsJar by tasks.registering(Jar::class) { + archiveClassifier = "tests" + from(sourceSets["test"].output) +} + +java { + toolchain { + languageVersion.set(JavaLanguageVersion.of(17)) + } + withSourcesJar() + withJavadocJar() +} + +publishing { + publications.create("maven") { + from(components["java"]) + artifact(testsJar) + } +} + +tasks.wrapper { + gradleVersion = "8.7" +} + +tasks.withType() { + options.encoding = "UTF-8" +} + +tasks.withType() { + enabled = false + options.encoding = "UTF-8" +} diff --git a/samples/client/petstore/kotlin/docs/RootServerInfo.md b/samples/client/petstore/kotlin/docs/RootServerInfo.md new file mode 100644 index 00000000000..efe32cf743d --- /dev/null +++ b/samples/client/petstore/kotlin/docs/RootServerInfo.md @@ -0,0 +1,65 @@ +# RootServerInfo +RootServerInfo.java + +public class RootServerInfo + +A class that provides a server, and any needed server info classes +- a class that is a ServerProvider +- a builder for the ServerProvider +- an enum class that stores server index values + +## Nested Class Summary +| Modifier and Type | Class and Description | +| ----------------- | --------------------- | +| static class | [RootServerInfo.RootServerInfo1](#rootserverinfo1)
class that stores a server index | +| static class | [RootServerInfo.RootServerInfoBuilder](#rootserverinfobuilder)
class that stores a server index | +| enum | [RootServerInfo.ServerIndex](#serverindex)
class that stores a server index | + +## RootServerInfo1 +implements ServerProvider<[ServerIndex](#serverindex)>
+ +A class that stores servers and allows one to be returned with a ServerIndex instance + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| RootServerInfo1(@Nullable [RootServer0](servers/RootServer0.md) server0,@Nullable [RootServer1](servers/RootServer1.md) server1,@Nullable [RootServer2](servers/RootServer2.md) server2)
Creates an instance using passed in servers | + +### Field Summary +| Modifier and Type | Field and Description | +| ----------------- | --------------------- | +| [RootServer0](servers/RootServer0.md) | server0 | +| [RootServer1](servers/RootServer1.md) | server1 | +| [RootServer2](servers/RootServer2.md) | server2 | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| Server | getServer([ServerIndex](#serverindex) serverIndex) | + +## RootServerInfoBuilder + +a builder for [RootServerInfo1](#rootserverinfo1) + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| RootServerInfoBuilder()
Creates an instance | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| [RootServerInfoBuilder](#rootserverinfobuilder) | rootServer0([RootServer0](servers/RootServer0.md) server0)
sets the server | +| [RootServerInfoBuilder](#rootserverinfobuilder) | rootServer1([RootServer1](servers/RootServer1.md) server1)
sets the server | +| [RootServerInfoBuilder](#rootserverinfobuilder) | rootServer2([RootServer2](servers/RootServer2.md) server2)
sets the server | +| [RootServerInfo1](#rootserverinfo1) | build() | + +## ServerIndex +enum ServerIndex
+ +### Enum Constant Summary +| Enum Constant And Description | +| ----------------------------- | +| SERVER_0
server 0 | +| SERVER_1
server 1 | +| SERVER_2
server 2 | diff --git a/samples/client/petstore/kotlin/docs/apis/paths/Anotherfakedummy.md b/samples/client/petstore/kotlin/docs/apis/paths/Anotherfakedummy.md new file mode 100644 index 00000000000..dd44aeae181 --- /dev/null +++ b/samples/client/petstore/kotlin/docs/apis/paths/Anotherfakedummy.md @@ -0,0 +1,119 @@ +# Anotherfakedummy + +public class Anotherfakedummy extends extends ApiClient implements +[AnotherfakedummyPatch.PatchOperation](../../paths/anotherfakedummy/AnotherfakedummyPatch.md#patchoperation) + +an api client class which contains all the routes for path="/another-fake/dummy" + +## Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| [AnotherfakedummyPatchResponses.EndpointResponse](../../paths/anotherfakedummy/patch/AnotherfakedummyPatchResponses.md#endpointresponse) | [patch](#patch)([AnotherfakedummyPatch.PatchRequest](../../paths/anotherfakedummy/AnotherfakedummyPatch.md#patchrequest) request)
To test special tags and operation ID starting with number | + +## Method Detail + +### patch +public [AnotherfakedummyPatchResponses.EndpointResponse](../../paths/anotherfakedummy/patch/AnotherfakedummyPatchResponses.md#endpointresponse) patch([AnotherfakedummyPatch.PatchRequest](../../paths/anotherfakedummy/AnotherfakedummyPatch.md#patchrequest) request) + +To test special tags and operation ID starting with number + +**Parameters:**
+request - the input request + +**Returns:**
+the deserialized response + +**Throws:**
+IOException, InterruptedException - an exception happened when making the request
+ValidationException - the returned response body or header values do not conform the the schema validation requirements
+NotImplementedException - the request body serialization or deserialization has not yet been implemented
+ or the header content type deserialization has not yet been implemented for this contentType
+ApiException - server returned a response/contentType not defined in the openapi document
+ +#### 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.AnotherfakedummyPatchRequestBody; +import org.openapijsonschematools.client.components.schemas.Client; +import org.openapijsonschematools.client.servers.RootServer0; +import org.openapijsonschematools.client.servers.RootServer1; +import org.openapijsonschematools.client.servers.RootServer2; +import org.openapijsonschematools.client.paths.anotherfakedummy.patch.responses.AnotherfakedummyPatchCode200Response; +import org.openapijsonschematools.client.servers.RootServerInfo; +import org.openapijsonschematools.client.apis.paths.Anotherfakedummy; +import org.openapijsonschematools.client.paths.anotherfakedummy.patch.AnotherfakedummyPatchResponses; + +import java.io.IOException; +import java.util.Arrays; +import java.util.List; +import java.util.Map; +import java.util.AbstractMap; + +// if you want to use a server that is not SERVER_0 pass it in here and change the ServerIndex input below +ApiConfiguration.ServerInfo serverInfo = new ApiConfiguration.ServerInfoBuilder() + .rootServerInfo( + new RootServerInfo.RootServerInfoBuilder() + .rootServer0(new RootServer0()) + .build() + ) + .build(); +ApiConfiguration.ServerIndexInfo serverIndexInfo = new ApiConfiguration.ServerIndexInfoBuilder() + .rootServerInfoServerIndex(RootServerInfo.ServerIndex.SERVER_0) + .build(); +Duration timeout = Duration.ofSeconds(1L); +Map> defaultHeaders = Map.of("User-Agent", List.of("OpenAPI-JSON-Schema-Generator/1.0.0/java")); +ApiConfiguration apiConfiguration = new ApiConfiguration( + serverInfo + serverIndexInfo, + timeout, + defaultHeaders +); +SchemaConfiguration schemaConfiguration = new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().build()); +Anotherfakedummy apiClient = new Anotherfakedummy(apiConfiguration, schemaConfiguration); + + +Client1BoxedMap requestBodyPayload = + Client.Client1.validateAndBox( + new Client.ClientMapBuilder1() + .client("a") + + .build(), + schemaConfiguration +); +AnotherfakedummyPatchRequestBody.SealedRequestBody requestBody = new AnotherfakedummyPatchRequestBody.ApplicationjsonRequestBody(requestBodyPayload); + +var request = new AnotherfakedummyPatch.PatchRequestBuilder() + .requestBody(requestBody) + .build(); + +AnotherfakedummyPatchResponses.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; +} +AnotherfakedummyPatchResponses.EndpointAnotherfakedummyPatchCode200Response castResponse = (AnotherfakedummyPatchResponses.EndpointAnotherfakedummyPatchCode200Response) response; +AnotherfakedummyPatchCode200Response.ApplicationjsonResponseBody deserializedBody = (AnotherfakedummyPatchCode200Response.ApplicationjsonResponseBody) castResponse.body; +// handle deserialized body here +``` +[[Back to top]](#top) [[Back to README]](../../../README.md) diff --git a/samples/client/petstore/kotlin/docs/apis/paths/Commonparamsubdir.md b/samples/client/petstore/kotlin/docs/apis/paths/Commonparamsubdir.md new file mode 100644 index 00000000000..1d778b34d13 --- /dev/null +++ b/samples/client/petstore/kotlin/docs/apis/paths/Commonparamsubdir.md @@ -0,0 +1,321 @@ +# Commonparamsubdir + +public class Commonparamsubdir extends extends ApiClient implements +[CommonparamsubdirDelete.DeleteOperation](../../paths/commonparamsubdir/CommonparamsubdirDelete.md#deleteoperation), +[CommonparamsubdirGet.GetOperation](../../paths/commonparamsubdir/CommonparamsubdirGet.md#getoperation), +[CommonparamsubdirPost.PostOperation](../../paths/commonparamsubdir/CommonparamsubdirPost.md#postoperation) + +an api client class which contains all the routes for path="/commonParam/{subDir}/" + +## Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| [CommonparamsubdirDeleteResponses.EndpointResponse](../../paths/commonparamsubdir/delete/CommonparamsubdirDeleteResponses.md#endpointresponse) | [delete](#delete)([CommonparamsubdirDelete.DeleteRequest](../../paths/commonparamsubdir/CommonparamsubdirDelete.md#deleterequest) request)
common param is overwritten | +| [CommonparamsubdirGetResponses.EndpointResponse](../../paths/commonparamsubdir/get/CommonparamsubdirGetResponses.md#endpointresponse) | [get](#get)([CommonparamsubdirGet.GetRequest](../../paths/commonparamsubdir/CommonparamsubdirGet.md#getrequest) request) | +| [CommonparamsubdirPostResponses.EndpointResponse](../../paths/commonparamsubdir/post/CommonparamsubdirPostResponses.md#endpointresponse) | [post](#post)([CommonparamsubdirPost.PostRequest](../../paths/commonparamsubdir/CommonparamsubdirPost.md#postrequest) request) | + +## Method Detail + +### delete +public [CommonparamsubdirDeleteResponses.EndpointResponse](../../paths/commonparamsubdir/delete/CommonparamsubdirDeleteResponses.md#endpointresponse) delete([CommonparamsubdirDelete.DeleteRequest](../../paths/commonparamsubdir/CommonparamsubdirDelete.md#deleterequest) request) + +common param is overwritten + +**Parameters:**
+request - the input request + +**Returns:**
+the deserialized response + +**Throws:**
+IOException, InterruptedException - an exception happened when making the request
+ValidationException - the returned response body or header values do not conform the the schema validation requirements
+NotImplementedException - the request body serialization or deserialization has not yet been implemented
+ or the header content type deserialization has not yet been implemented for this contentType
+ApiException - server returned a response/contentType not defined in the openapi document
+ +#### 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.CommonparamsubdirDeleteHeaderParameters; +import org.openapijsonschematools.client.RootServerInfo; +import org.openapijsonschematools.client.paths.commonparamsubdir.delete.CommonparamsubdirDeletePathParameters; +import org.openapijsonschematools.client.servers.RootServer0; +import org.openapijsonschematools.client.servers.RootServer1; +import org.openapijsonschematools.client.servers.RootServer2; +import org.openapijsonschematools.client.paths.commonparamsubdir.delete.responses.CommonparamsubdirDeleteCode200Response; +import org.openapijsonschematools.client.servers.RootServerInfo; +import org.openapijsonschematools.client.apis.paths.Commonparamsubdir; +import org.openapijsonschematools.client.paths.commonparamsubdir.delete.CommonparamsubdirDeleteResponses; + +import java.io.IOException; +import java.util.Arrays; +import java.util.List; +import java.util.Map; +import java.util.AbstractMap; + +// if you want to use a server that is not SERVER_0 pass it in here and change the ServerIndex input below +ApiConfiguration.ServerInfo serverInfo = new ApiConfiguration.ServerInfoBuilder() + .rootServerInfo( + new RootServerInfo.RootServerInfoBuilder() + .rootServer0(new RootServer0()) + .build() + ) + .build(); +ApiConfiguration.ServerIndexInfo serverIndexInfo = new ApiConfiguration.ServerIndexInfoBuilder() + .rootServerInfoServerIndex(RootServerInfo.ServerIndex.SERVER_0) + .build(); +Duration timeout = Duration.ofSeconds(1L); +Map> defaultHeaders = Map.of("User-Agent", List.of("OpenAPI-JSON-Schema-Generator/1.0.0/java")); +ApiConfiguration apiConfiguration = new ApiConfiguration( + serverInfo + serverIndexInfo, + timeout, + defaultHeaders +); +SchemaConfiguration schemaConfiguration = new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().build()); +Commonparamsubdir apiClient = new Commonparamsubdir(apiConfiguration, schemaConfiguration); + + +// Map validation +CommonparamsubdirDeletePathParameters.PathParametersMap pathParameters = + CommonparamsubdirDeletePathParameters.CommonparamsubdirDeletePathParameters1.validate( + new CommonparamsubdirDeletePathParameters.PathParametersMapBuilder() + .subDir("c") + + .build(), + schemaConfiguration +); + +var request = new CommonparamsubdirDelete.DeleteRequestBuilder() + .pathParameters(pathParameters) + .build(); + +CommonparamsubdirDeleteResponses.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; +} +CommonparamsubdirDeleteResponses.EndpointCommonparamsubdirDeleteCode200Response castResponse = (CommonparamsubdirDeleteResponses.EndpointCommonparamsubdirDeleteCode200Response) response; +``` +### get +public [CommonparamsubdirGetResponses.EndpointResponse](../../paths/commonparamsubdir/get/CommonparamsubdirGetResponses.md#endpointresponse) get([CommonparamsubdirGet.GetRequest](../../paths/commonparamsubdir/CommonparamsubdirGet.md#getrequest) request) + +**Parameters:**
+request - the input request + +**Returns:**
+the deserialized response + +**Throws:**
+IOException, InterruptedException - an exception happened when making the request
+ValidationException - the returned response body or header values do not conform the the schema validation requirements
+NotImplementedException - the request body serialization or deserialization has not yet been implemented
+ or the header content type deserialization has not yet been implemented for this contentType
+ApiException - server returned a response/contentType not defined in the openapi document
+ +#### 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.get.CommonparamsubdirGetQueryParameters; +import org.openapijsonschematools.client.RootServerInfo; +import org.openapijsonschematools.client.paths.commonparamsubdir.get.CommonparamsubdirGetPathParameters; +import org.openapijsonschematools.client.servers.RootServer0; +import org.openapijsonschematools.client.servers.RootServer1; +import org.openapijsonschematools.client.servers.RootServer2; +import org.openapijsonschematools.client.paths.commonparamsubdir.get.responses.CommonparamsubdirGetCode200Response; +import org.openapijsonschematools.client.servers.RootServerInfo; +import org.openapijsonschematools.client.apis.paths.Commonparamsubdir; +import org.openapijsonschematools.client.paths.commonparamsubdir.get.CommonparamsubdirGetResponses; + +import java.io.IOException; +import java.util.Arrays; +import java.util.List; +import java.util.Map; +import java.util.AbstractMap; + +// if you want to use a server that is not SERVER_0 pass it in here and change the ServerIndex input below +ApiConfiguration.ServerInfo serverInfo = new ApiConfiguration.ServerInfoBuilder() + .rootServerInfo( + new RootServerInfo.RootServerInfoBuilder() + .rootServer0(new RootServer0()) + .build() + ) + .build(); +ApiConfiguration.ServerIndexInfo serverIndexInfo = new ApiConfiguration.ServerIndexInfoBuilder() + .rootServerInfoServerIndex(RootServerInfo.ServerIndex.SERVER_0) + .build(); +Duration timeout = Duration.ofSeconds(1L); +Map> defaultHeaders = Map.of("User-Agent", List.of("OpenAPI-JSON-Schema-Generator/1.0.0/java")); +ApiConfiguration apiConfiguration = new ApiConfiguration( + serverInfo + serverIndexInfo, + timeout, + defaultHeaders +); +SchemaConfiguration schemaConfiguration = new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().build()); +Commonparamsubdir apiClient = new Commonparamsubdir(apiConfiguration, schemaConfiguration); + + +// Map validation +CommonparamsubdirGetPathParameters.PathParametersMap pathParameters = + CommonparamsubdirGetPathParameters.CommonparamsubdirGetPathParameters1.validate( + new CommonparamsubdirGetPathParameters.PathParametersMapBuilder() + .subDir("a") + + .build(), + schemaConfiguration +); + +var request = new CommonparamsubdirGet.GetRequestBuilder() + .pathParameters(pathParameters) + .build(); + +CommonparamsubdirGetResponses.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; +} +CommonparamsubdirGetResponses.EndpointCommonparamsubdirGetCode200Response castResponse = (CommonparamsubdirGetResponses.EndpointCommonparamsubdirGetCode200Response) response; +``` +### post +public [CommonparamsubdirPostResponses.EndpointResponse](../../paths/commonparamsubdir/post/CommonparamsubdirPostResponses.md#endpointresponse) post([CommonparamsubdirPost.PostRequest](../../paths/commonparamsubdir/CommonparamsubdirPost.md#postrequest) request) + +**Parameters:**
+request - the input request + +**Returns:**
+the deserialized response + +**Throws:**
+IOException, InterruptedException - an exception happened when making the request
+ValidationException - the returned response body or header values do not conform the the schema validation requirements
+NotImplementedException - the request body serialization or deserialization has not yet been implemented
+ or the header content type deserialization has not yet been implemented for this contentType
+ApiException - server returned a response/contentType not defined in the openapi document
+ +#### 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.post.CommonparamsubdirPostHeaderParameters; +import org.openapijsonschematools.client.RootServerInfo; +import org.openapijsonschematools.client.paths.commonparamsubdir.post.CommonparamsubdirPostPathParameters; +import org.openapijsonschematools.client.servers.RootServer0; +import org.openapijsonschematools.client.servers.RootServer1; +import org.openapijsonschematools.client.servers.RootServer2; +import org.openapijsonschematools.client.paths.commonparamsubdir.post.responses.CommonparamsubdirPostCode200Response; +import org.openapijsonschematools.client.servers.RootServerInfo; +import org.openapijsonschematools.client.apis.paths.Commonparamsubdir; +import org.openapijsonschematools.client.paths.commonparamsubdir.post.CommonparamsubdirPostResponses; + +import java.io.IOException; +import java.util.Arrays; +import java.util.List; +import java.util.Map; +import java.util.AbstractMap; + +// if you want to use a server that is not SERVER_0 pass it in here and change the ServerIndex input below +ApiConfiguration.ServerInfo serverInfo = new ApiConfiguration.ServerInfoBuilder() + .rootServerInfo( + new RootServerInfo.RootServerInfoBuilder() + .rootServer0(new RootServer0()) + .build() + ) + .build(); +ApiConfiguration.ServerIndexInfo serverIndexInfo = new ApiConfiguration.ServerIndexInfoBuilder() + .rootServerInfoServerIndex(RootServerInfo.ServerIndex.SERVER_0) + .build(); +Duration timeout = Duration.ofSeconds(1L); +Map> defaultHeaders = Map.of("User-Agent", List.of("OpenAPI-JSON-Schema-Generator/1.0.0/java")); +ApiConfiguration apiConfiguration = new ApiConfiguration( + serverInfo + serverIndexInfo, + timeout, + defaultHeaders +); +SchemaConfiguration schemaConfiguration = new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().build()); +Commonparamsubdir apiClient = new Commonparamsubdir(apiConfiguration, schemaConfiguration); + + +// Map validation +CommonparamsubdirPostPathParameters.PathParametersMap pathParameters = + CommonparamsubdirPostPathParameters.CommonparamsubdirPostPathParameters1.validate( + new CommonparamsubdirPostPathParameters.PathParametersMapBuilder() + .subDir("a") + + .build(), + schemaConfiguration +); + +var request = new CommonparamsubdirPost.PostRequestBuilder() + .pathParameters(pathParameters) + .build(); + +CommonparamsubdirPostResponses.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; +} +CommonparamsubdirPostResponses.EndpointCommonparamsubdirPostCode200Response castResponse = (CommonparamsubdirPostResponses.EndpointCommonparamsubdirPostCode200Response) response; +``` +[[Back to top]](#top) [[Back to README]](../../../README.md) diff --git a/samples/client/petstore/kotlin/docs/apis/paths/Fake.md b/samples/client/petstore/kotlin/docs/apis/paths/Fake.md new file mode 100644 index 00000000000..2f0f6492dd4 --- /dev/null +++ b/samples/client/petstore/kotlin/docs/apis/paths/Fake.md @@ -0,0 +1,460 @@ +# Fake + +public class Fake extends extends ApiClient implements +[FakeDelete.DeleteOperation](../../paths/fake/FakeDelete.md#deleteoperation), +[FakeGet.GetOperation](../../paths/fake/FakeGet.md#getoperation), +[FakePatch.PatchOperation](../../paths/fake/FakePatch.md#patchoperation), +[FakePost.PostOperation](../../paths/fake/FakePost.md#postoperation) + +an api client class which contains all the routes for path="/fake" + +## Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| [FakeDeleteResponses.EndpointResponse](../../paths/fake/delete/FakeDeleteResponses.md#endpointresponse) | [delete](#delete)([FakeDelete.DeleteRequest](../../paths/fake/FakeDelete.md#deleterequest) request)
Fake endpoint to test group parameters (optional) | +| [FakeGetResponses.EndpointResponse](../../paths/fake/get/FakeGetResponses.md#endpointresponse) | [get](#get)([FakeGet.GetRequest](../../paths/fake/FakeGet.md#getrequest) request)
To test enum parameters | +| [FakePatchResponses.EndpointResponse](../../paths/fake/patch/FakePatchResponses.md#endpointresponse) | [patch](#patch)([FakePatch.PatchRequest](../../paths/fake/FakePatch.md#patchrequest) request)
To test "client" model | +| [FakePostResponses.EndpointResponse](../../paths/fake/post/FakePostResponses.md#endpointresponse) | [post](#post)([FakePost.PostRequest](../../paths/fake/FakePost.md#postrequest) request)
Fake endpoint for testing various parameters
假端點
偽のエンドポイント
가짜 엔드 포인트
| + +## Method Detail + +### delete +public [FakeDeleteResponses.EndpointResponse](../../paths/fake/delete/FakeDeleteResponses.md#endpointresponse) delete([FakeDelete.DeleteRequest](../../paths/fake/FakeDelete.md#deleterequest) request) + +Fake endpoint to test group parameters (optional) + +**Parameters:**
+request - the input request + +**Returns:**
+the deserialized response + +**Throws:**
+IOException, InterruptedException - an exception happened when making the request
+ValidationException - the returned response body or header values do not conform the the schema validation requirements
+NotImplementedException - the request body serialization or deserialization has not yet been implemented
+ or the header content type deserialization has not yet been implemented for this contentType
+ApiException - server returned a response/contentType not defined in the openapi document
+ +#### 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.fake.delete.FakeDeleteSecurityInfo; +import org.openapijsonschematools.client.paths.fake.delete.FakeDeleteHeaderParameters; +import org.openapijsonschematools.client.paths.fake.delete.FakeDeleteQueryParameters; +import org.openapijsonschematools.client.servers.RootServer0; +import org.openapijsonschematools.client.servers.RootServer1; +import org.openapijsonschematools.client.servers.RootServer2; +import org.openapijsonschematools.client.securityschemes.SecurityScheme; +import org.openapijsonschematools.client.components.securityschemes.BearerTest; +import org.openapijsonschematools.client.paths.fake.delete.responses.FakeDeleteCode200Response; +import org.openapijsonschematools.client.servers.RootServerInfo; +import org.openapijsonschematools.client.apis.paths.Fake; +import org.openapijsonschematools.client.paths.fake.delete.FakeDeleteResponses; + +import java.io.IOException; +import java.util.Arrays; +import java.util.List; +import java.util.Map; +import java.util.AbstractMap; + +// if you want to use a server that is not SERVER_0 pass it in here and change the ServerIndex input below +ApiConfiguration.ServerInfo serverInfo = new ApiConfiguration.ServerInfoBuilder() + .rootServerInfo( + new RootServerInfo.RootServerInfoBuilder() + .rootServer0(new RootServer0()) + .build() + ) + .build(); +ApiConfiguration.ServerIndexInfo serverIndexInfo = new ApiConfiguration.ServerIndexInfoBuilder() + .rootServerInfoServerIndex(RootServerInfo.ServerIndex.SERVER_0) + .build(); +List securitySchemes = new ArrayList(); +securitySchemes.add( + new BearerTest("someAccessToken"); +); +ApiConfiguration.SecurityIndexInfo securityIndexInfo = new ApiConfiguration.SecurityIndexInfoBuilder() + .fakeDeleteSecurityRequirementObject0SecurityIndex(FakeDeleteSecurityRequirementObject0.SecurityIndex.SECURITY_0) + .build(); +Duration timeout = Duration.ofSeconds(1L); +Map> defaultHeaders = Map.of("User-Agent", List.of("OpenAPI-JSON-Schema-Generator/1.0.0/java")); +ApiConfiguration apiConfiguration = new ApiConfiguration( + serverInfo + serverIndexInfo, + securitySchemes, + securityIndexInfo, + timeout, + defaultHeaders +); +SchemaConfiguration schemaConfiguration = new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().build()); +Fake apiClient = new Fake(apiConfiguration, schemaConfiguration); + + +// Map validation +FakeDeleteHeaderParameters.HeaderParametersMap headerParameters = + FakeDeleteHeaderParameters.FakeDeleteHeaderParameters1.validate( + new FakeDeleteHeaderParameters.HeaderParametersMapBuilder() + .required_boolean_group("true") + + .boolean_group("true") + + .build(), + schemaConfiguration +); + +// Map validation +FakeDeleteQueryParameters.QueryParametersMap queryParameters = + FakeDeleteQueryParameters.FakeDeleteQueryParameters1.validate( + new FakeDeleteQueryParameters.QueryParametersMapBuilder() + .required_int64_group(1L) + + .required_string_group("a") + + .int64_group(1L) + + .string_group("a") + + .build(), + schemaConfiguration +); + +var request = new FakeDelete.DeleteRequestBuilder() + .headerParameters(headerParameters) + .queryParameters(queryParameters) + .build(); + +FakeDeleteResponses.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; +} +FakeDeleteResponses.EndpointFakeDeleteCode200Response castResponse = (FakeDeleteResponses.EndpointFakeDeleteCode200Response) response; +``` +### get +public [FakeGetResponses.EndpointResponse](../../paths/fake/get/FakeGetResponses.md#endpointresponse) get([FakeGet.GetRequest](../../paths/fake/FakeGet.md#getrequest) request) + +To test enum parameters + +**Parameters:**
+request - the input request + +**Returns:**
+the deserialized response + +**Throws:**
+IOException, InterruptedException - an exception happened when making the request
+ValidationException - the returned response body or header values do not conform the the schema validation requirements
+NotImplementedException - the request body serialization or deserialization has not yet been implemented
+ or the header content type deserialization has not yet been implemented for this contentType
+ApiException - server returned a response/contentType not defined in the openapi document
+ +#### 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.fake.get.FakeGetRequestBody; +import org.openapijsonschematools.client.paths.fake.get.requestbody.content.applicationxwwwformurlencoded.ApplicationxwwwformurlencodedSchema; +import org.openapijsonschematools.client.paths.fake.get.FakeGetHeaderParameters; +import org.openapijsonschematools.client.paths.fake.get.FakeGetQueryParameters; +import org.openapijsonschematools.client.RootServerInfo; +import org.openapijsonschematools.client.servers.RootServer0; +import org.openapijsonschematools.client.servers.RootServer1; +import org.openapijsonschematools.client.servers.RootServer2; +import org.openapijsonschematools.client.paths.fake.get.responses.FakeGetCode200Response; +import org.openapijsonschematools.client.paths.fake.get.responses.FakeGetCode404Response; +import org.openapijsonschematools.client.servers.RootServerInfo; +import org.openapijsonschematools.client.apis.paths.Fake; +import org.openapijsonschematools.client.paths.fake.get.FakeGetResponses; + +import java.io.IOException; +import java.util.Arrays; +import java.util.List; +import java.util.Map; +import java.util.AbstractMap; + +// if you want to use a server that is not SERVER_0 pass it in here and change the ServerIndex input below +ApiConfiguration.ServerInfo serverInfo = new ApiConfiguration.ServerInfoBuilder() + .rootServerInfo( + new RootServerInfo.RootServerInfoBuilder() + .rootServer0(new RootServer0()) + .build() + ) + .build(); +ApiConfiguration.ServerIndexInfo serverIndexInfo = new ApiConfiguration.ServerIndexInfoBuilder() + .rootServerInfoServerIndex(RootServerInfo.ServerIndex.SERVER_0) + .build(); +Duration timeout = Duration.ofSeconds(1L); +Map> defaultHeaders = Map.of("User-Agent", List.of("OpenAPI-JSON-Schema-Generator/1.0.0/java")); +ApiConfiguration apiConfiguration = new ApiConfiguration( + serverInfo + serverIndexInfo, + timeout, + defaultHeaders +); +SchemaConfiguration schemaConfiguration = new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().build()); +Fake apiClient = new Fake(apiConfiguration, schemaConfiguration); + + +var request = new FakeGet.GetRequestBuilder().build(); + +FakeGetResponses.EndpointResponse response; +try { + response = apiClient.get(request); +} catch (FakeGetCode404Response.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; +} +FakeGetResponses.EndpointFakeGetCode200Response castResponse = (FakeGetResponses.EndpointFakeGetCode200Response) response; +``` +### patch +public [FakePatchResponses.EndpointResponse](../../paths/fake/patch/FakePatchResponses.md#endpointresponse) patch([FakePatch.PatchRequest](../../paths/fake/FakePatch.md#patchrequest) request) + +To test "client" model + +**Parameters:**
+request - the input request + +**Returns:**
+the deserialized response + +**Throws:**
+IOException, InterruptedException - an exception happened when making the request
+ValidationException - the returned response body or header values do not conform the the schema validation requirements
+NotImplementedException - the request body serialization or deserialization has not yet been implemented
+ or the header content type deserialization has not yet been implemented for this contentType
+ApiException - server returned a response/contentType not defined in the openapi document
+ +#### 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.fake.patch.FakePatchRequestBody; +import org.openapijsonschematools.client.components.schemas.Client; +import org.openapijsonschematools.client.servers.RootServer0; +import org.openapijsonschematools.client.servers.RootServer1; +import org.openapijsonschematools.client.servers.RootServer2; +import org.openapijsonschematools.client.paths.fake.patch.responses.FakePatchCode200Response; +import org.openapijsonschematools.client.servers.RootServerInfo; +import org.openapijsonschematools.client.apis.paths.Fake; +import org.openapijsonschematools.client.paths.fake.patch.FakePatchResponses; + +import java.io.IOException; +import java.util.Arrays; +import java.util.List; +import java.util.Map; +import java.util.AbstractMap; + +// if you want to use a server that is not SERVER_0 pass it in here and change the ServerIndex input below +ApiConfiguration.ServerInfo serverInfo = new ApiConfiguration.ServerInfoBuilder() + .rootServerInfo( + new RootServerInfo.RootServerInfoBuilder() + .rootServer0(new RootServer0()) + .build() + ) + .build(); +ApiConfiguration.ServerIndexInfo serverIndexInfo = new ApiConfiguration.ServerIndexInfoBuilder() + .rootServerInfoServerIndex(RootServerInfo.ServerIndex.SERVER_0) + .build(); +Duration timeout = Duration.ofSeconds(1L); +Map> defaultHeaders = Map.of("User-Agent", List.of("OpenAPI-JSON-Schema-Generator/1.0.0/java")); +ApiConfiguration apiConfiguration = new ApiConfiguration( + serverInfo + serverIndexInfo, + timeout, + defaultHeaders +); +SchemaConfiguration schemaConfiguration = new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().build()); +Fake apiClient = new Fake(apiConfiguration, schemaConfiguration); + + +Client1BoxedMap requestBodyPayload = + Client.Client1.validateAndBox( + new Client.ClientMapBuilder1() + .client("a") + + .build(), + schemaConfiguration +); +FakePatchRequestBody.SealedRequestBody requestBody = new FakePatchRequestBody.ApplicationjsonRequestBody(requestBodyPayload); + +var request = new FakePatch.PatchRequestBuilder() + .requestBody(requestBody) + .build(); + +FakePatchResponses.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; +} +FakePatchResponses.EndpointFakePatchCode200Response castResponse = (FakePatchResponses.EndpointFakePatchCode200Response) response; +FakePatchCode200Response.ApplicationjsonResponseBody deserializedBody = (FakePatchCode200Response.ApplicationjsonResponseBody) castResponse.body; +// handle deserialized body here +``` +### post +public [FakePostResponses.EndpointResponse](../../paths/fake/post/FakePostResponses.md#endpointresponse) post([FakePost.PostRequest](../../paths/fake/FakePost.md#postrequest) request) + +Fake endpoint for testing various parameters
假端點
偽のエンドポイント
가짜 엔드 포인트
+ +**Parameters:**
+request - the input request + +**Returns:**
+the deserialized response + +**Throws:**
+IOException, InterruptedException - an exception happened when making the request
+ValidationException - the returned response body or header values do not conform the the schema validation requirements
+NotImplementedException - the request body serialization or deserialization has not yet been implemented
+ or the header content type deserialization has not yet been implemented for this contentType
+ApiException - server returned a response/contentType not defined in the openapi document
+ +#### 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.fake.post.FakePostRequestBody; +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.RootServer0; +import org.openapijsonschematools.client.servers.RootServer1; +import org.openapijsonschematools.client.servers.RootServer2; +import org.openapijsonschematools.client.securityschemes.SecurityScheme; +import org.openapijsonschematools.client.components.securityschemes.HttpBasicTest; +import org.openapijsonschematools.client.paths.fake.post.responses.FakePostCode200Response; +import org.openapijsonschematools.client.paths.fake.post.responses.FakePostCode404Response; +import org.openapijsonschematools.client.servers.RootServerInfo; +import org.openapijsonschematools.client.apis.paths.Fake; +import org.openapijsonschematools.client.paths.fake.post.FakePostResponses; + +import java.io.IOException; +import java.util.Arrays; +import java.util.List; +import java.util.Map; +import java.util.AbstractMap; + +// if you want to use a server that is not SERVER_0 pass it in here and change the ServerIndex input below +ApiConfiguration.ServerInfo serverInfo = new ApiConfiguration.ServerInfoBuilder() + .rootServerInfo( + new RootServerInfo.RootServerInfoBuilder() + .rootServer0(new RootServer0()) + .build() + ) + .build(); +ApiConfiguration.ServerIndexInfo serverIndexInfo = new ApiConfiguration.ServerIndexInfoBuilder() + .rootServerInfoServerIndex(RootServerInfo.ServerIndex.SERVER_0) + .build(); +List securitySchemes = new ArrayList(); +securitySchemes.add( + new HttpBasicTest("someUserId", "somePassword"); +); +ApiConfiguration.SecurityIndexInfo securityIndexInfo = new ApiConfiguration.SecurityIndexInfoBuilder() + .fakePostSecurityRequirementObject0SecurityIndex(FakePostSecurityRequirementObject0.SecurityIndex.SECURITY_0) + .build(); +Duration timeout = Duration.ofSeconds(1L); +Map> defaultHeaders = Map.of("User-Agent", List.of("OpenAPI-JSON-Schema-Generator/1.0.0/java")); +ApiConfiguration apiConfiguration = new ApiConfiguration( + serverInfo + serverIndexInfo, + securitySchemes, + securityIndexInfo, + timeout, + defaultHeaders +); +SchemaConfiguration schemaConfiguration = new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().build()); +Fake apiClient = new Fake(apiConfiguration, schemaConfiguration); + + +var request = new FakePost.PostRequestBuilder().build(); + +FakePostResponses.EndpointResponse response; +try { + response = apiClient.post(request); +} catch (FakePostCode404Response.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; +} +FakePostResponses.EndpointFakePostCode200Response castResponse = (FakePostResponses.EndpointFakePostCode200Response) response; +``` +[[Back to top]](#top) [[Back to README]](../../../README.md) diff --git a/samples/client/petstore/kotlin/docs/apis/paths/Fakeadditionalpropertieswitharrayofenums.md b/samples/client/petstore/kotlin/docs/apis/paths/Fakeadditionalpropertieswitharrayofenums.md new file mode 100644 index 00000000000..b79b67276cb --- /dev/null +++ b/samples/client/petstore/kotlin/docs/apis/paths/Fakeadditionalpropertieswitharrayofenums.md @@ -0,0 +1,105 @@ +# Fakeadditionalpropertieswitharrayofenums + +public class Fakeadditionalpropertieswitharrayofenums extends extends ApiClient implements +[FakeadditionalpropertieswitharrayofenumsGet.GetOperation](../../paths/fakeadditionalpropertieswitharrayofenums/FakeadditionalpropertieswitharrayofenumsGet.md#getoperation) + +an api client class which contains all the routes for path="/fake/additional-properties-with-array-of-enums" + +## Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| [FakeadditionalpropertieswitharrayofenumsGetResponses.EndpointResponse](../../paths/fakeadditionalpropertieswitharrayofenums/get/FakeadditionalpropertieswitharrayofenumsGetResponses.md#endpointresponse) | [get](#get)([FakeadditionalpropertieswitharrayofenumsGet.GetRequest](../../paths/fakeadditionalpropertieswitharrayofenums/FakeadditionalpropertieswitharrayofenumsGet.md#getrequest) request) | + +## Method Detail + +### get +public [FakeadditionalpropertieswitharrayofenumsGetResponses.EndpointResponse](../../paths/fakeadditionalpropertieswitharrayofenums/get/FakeadditionalpropertieswitharrayofenumsGetResponses.md#endpointresponse) get([FakeadditionalpropertieswitharrayofenumsGet.GetRequest](../../paths/fakeadditionalpropertieswitharrayofenums/FakeadditionalpropertieswitharrayofenumsGet.md#getrequest) request) + +**Parameters:**
+request - the input request + +**Returns:**
+the deserialized response + +**Throws:**
+IOException, InterruptedException - an exception happened when making the request
+ValidationException - the returned response body or header values do not conform the the schema validation requirements
+NotImplementedException - the request body serialization or deserialization has not yet been implemented
+ or the header content type deserialization has not yet been implemented for this contentType
+ApiException - server returned a response/contentType not defined in the openapi document
+ +#### 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.fakeadditionalpropertieswitharrayofenums.get.FakeadditionalpropertieswitharrayofenumsGetRequestBody; +import org.openapijsonschematools.client.components.schemas.AdditionalPropertiesWithArrayOfEnums; +import org.openapijsonschematools.client.RootServerInfo; +import org.openapijsonschematools.client.servers.RootServer0; +import org.openapijsonschematools.client.servers.RootServer1; +import org.openapijsonschematools.client.servers.RootServer2; +import org.openapijsonschematools.client.paths.fakeadditionalpropertieswitharrayofenums.get.responses.FakeadditionalpropertieswitharrayofenumsGetCode200Response; +import org.openapijsonschematools.client.servers.RootServerInfo; +import org.openapijsonschematools.client.apis.paths.Fakeadditionalpropertieswitharrayofenums; +import org.openapijsonschematools.client.paths.fakeadditionalpropertieswitharrayofenums.get.FakeadditionalpropertieswitharrayofenumsGetResponses; + +import java.io.IOException; +import java.util.Arrays; +import java.util.List; +import java.util.Map; +import java.util.AbstractMap; + +// if you want to use a server that is not SERVER_0 pass it in here and change the ServerIndex input below +ApiConfiguration.ServerInfo serverInfo = new ApiConfiguration.ServerInfoBuilder() + .rootServerInfo( + new RootServerInfo.RootServerInfoBuilder() + .rootServer0(new RootServer0()) + .build() + ) + .build(); +ApiConfiguration.ServerIndexInfo serverIndexInfo = new ApiConfiguration.ServerIndexInfoBuilder() + .rootServerInfoServerIndex(RootServerInfo.ServerIndex.SERVER_0) + .build(); +Duration timeout = Duration.ofSeconds(1L); +Map> defaultHeaders = Map.of("User-Agent", List.of("OpenAPI-JSON-Schema-Generator/1.0.0/java")); +ApiConfiguration apiConfiguration = new ApiConfiguration( + serverInfo + serverIndexInfo, + timeout, + defaultHeaders +); +SchemaConfiguration schemaConfiguration = new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().build()); +Fakeadditionalpropertieswitharrayofenums apiClient = new Fakeadditionalpropertieswitharrayofenums(apiConfiguration, schemaConfiguration); + + +var request = new FakeadditionalpropertieswitharrayofenumsGet.GetRequestBuilder().build(); + +FakeadditionalpropertieswitharrayofenumsGetResponses.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; +} +FakeadditionalpropertieswitharrayofenumsGetResponses.EndpointFakeadditionalpropertieswitharrayofenumsGetCode200Response castResponse = (FakeadditionalpropertieswitharrayofenumsGetResponses.EndpointFakeadditionalpropertieswitharrayofenumsGetCode200Response) response; +FakeadditionalpropertieswitharrayofenumsGetCode200Response.ApplicationjsonResponseBody deserializedBody = (FakeadditionalpropertieswitharrayofenumsGetCode200Response.ApplicationjsonResponseBody) castResponse.body; +// handle deserialized body here +``` +[[Back to top]](#top) [[Back to README]](../../../README.md) diff --git a/samples/client/petstore/kotlin/docs/apis/paths/Fakebodywithfileschema.md b/samples/client/petstore/kotlin/docs/apis/paths/Fakebodywithfileschema.md new file mode 100644 index 00000000000..531b96a5ee1 --- /dev/null +++ b/samples/client/petstore/kotlin/docs/apis/paths/Fakebodywithfileschema.md @@ -0,0 +1,119 @@ +# Fakebodywithfileschema + +public class Fakebodywithfileschema extends extends ApiClient implements +[FakebodywithfileschemaPut.PutOperation](../../paths/fakebodywithfileschema/FakebodywithfileschemaPut.md#putoperation) + +an api client class which contains all the routes for path="/fake/body-with-file-schema" + +## Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| [FakebodywithfileschemaPutResponses.EndpointResponse](../../paths/fakebodywithfileschema/put/FakebodywithfileschemaPutResponses.md#endpointresponse) | [put](#put)([FakebodywithfileschemaPut.PutRequest](../../paths/fakebodywithfileschema/FakebodywithfileschemaPut.md#putrequest) request)
For this test, the body for this request much reference a schema named `File`. | + +## Method Detail + +### put +public [FakebodywithfileschemaPutResponses.EndpointResponse](../../paths/fakebodywithfileschema/put/FakebodywithfileschemaPutResponses.md#endpointresponse) put([FakebodywithfileschemaPut.PutRequest](../../paths/fakebodywithfileschema/FakebodywithfileschemaPut.md#putrequest) request) + +For this test, the body for this request much reference a schema named `File`. + +**Parameters:**
+request - the input request + +**Returns:**
+the deserialized response + +**Throws:**
+IOException, InterruptedException - an exception happened when making the request
+ValidationException - the returned response body or header values do not conform the the schema validation requirements
+NotImplementedException - the request body serialization or deserialization has not yet been implemented
+ or the header content type deserialization has not yet been implemented for this contentType
+ApiException - server returned a response/contentType not defined in the openapi document
+ +#### 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.fakebodywithfileschema.put.FakebodywithfileschemaPutRequestBody; +import org.openapijsonschematools.client.components.schemas.FileSchemaTestClass; +import org.openapijsonschematools.client.servers.RootServer0; +import org.openapijsonschematools.client.servers.RootServer1; +import org.openapijsonschematools.client.servers.RootServer2; +import org.openapijsonschematools.client.paths.fakebodywithfileschema.put.responses.FakebodywithfileschemaPutCode200Response; +import org.openapijsonschematools.client.servers.RootServerInfo; +import org.openapijsonschematools.client.apis.paths.Fakebodywithfileschema; +import org.openapijsonschematools.client.paths.fakebodywithfileschema.put.FakebodywithfileschemaPutResponses; + +import java.io.IOException; +import java.util.Arrays; +import java.util.List; +import java.util.Map; +import java.util.AbstractMap; + +// if you want to use a server that is not SERVER_0 pass it in here and change the ServerIndex input below +ApiConfiguration.ServerInfo serverInfo = new ApiConfiguration.ServerInfoBuilder() + .rootServerInfo( + new RootServerInfo.RootServerInfoBuilder() + .rootServer0(new RootServer0()) + .build() + ) + .build(); +ApiConfiguration.ServerIndexInfo serverIndexInfo = new ApiConfiguration.ServerIndexInfoBuilder() + .rootServerInfoServerIndex(RootServerInfo.ServerIndex.SERVER_0) + .build(); +Duration timeout = Duration.ofSeconds(1L); +Map> defaultHeaders = Map.of("User-Agent", List.of("OpenAPI-JSON-Schema-Generator/1.0.0/java")); +ApiConfiguration apiConfiguration = new ApiConfiguration( + serverInfo + serverIndexInfo, + timeout, + defaultHeaders +); +SchemaConfiguration schemaConfiguration = new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().build()); +Fakebodywithfileschema apiClient = new Fakebodywithfileschema(apiConfiguration, schemaConfiguration); + + +FileSchemaTestClass1BoxedMap requestBodyPayload = + FileSchemaTestClass.FileSchemaTestClass1.validateAndBox( + new FileSchemaTestClass.FileSchemaTestClassMapBuilder() + .files( + Arrays.asList( + ) + ) + .build(), + schemaConfiguration +); +FakebodywithfileschemaPut.SealedRequestBody requestBody = new FakebodywithfileschemaPut.ApplicationjsonRequestBody(requestBodyPayload); + +var request = new FakebodywithfileschemaPut.PutRequestBuilder() + .requestBody(requestBody) + .build(); + +FakebodywithfileschemaPutResponses.EndpointResponse response; +try { + response = apiClient.put(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; +} +FakebodywithfileschemaPutResponses.EndpointFakebodywithfileschemaPutCode200Response castResponse = (FakebodywithfileschemaPutResponses.EndpointFakebodywithfileschemaPutCode200Response) response; +``` +[[Back to top]](#top) [[Back to README]](../../../README.md) diff --git a/samples/client/petstore/kotlin/docs/apis/paths/Fakebodywithqueryparams.md b/samples/client/petstore/kotlin/docs/apis/paths/Fakebodywithqueryparams.md new file mode 100644 index 00000000000..62ce5e81352 --- /dev/null +++ b/samples/client/petstore/kotlin/docs/apis/paths/Fakebodywithqueryparams.md @@ -0,0 +1,143 @@ +# Fakebodywithqueryparams + +public class Fakebodywithqueryparams extends extends ApiClient implements +[FakebodywithqueryparamsPut.PutOperation](../../paths/fakebodywithqueryparams/FakebodywithqueryparamsPut.md#putoperation) + +an api client class which contains all the routes for path="/fake/body-with-query-params" + +## Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| [FakebodywithqueryparamsPutResponses.EndpointResponse](../../paths/fakebodywithqueryparams/put/FakebodywithqueryparamsPutResponses.md#endpointresponse) | [put](#put)([FakebodywithqueryparamsPut.PutRequest](../../paths/fakebodywithqueryparams/FakebodywithqueryparamsPut.md#putrequest) request) | + +## Method Detail + +### put +public [FakebodywithqueryparamsPutResponses.EndpointResponse](../../paths/fakebodywithqueryparams/put/FakebodywithqueryparamsPutResponses.md#endpointresponse) put([FakebodywithqueryparamsPut.PutRequest](../../paths/fakebodywithqueryparams/FakebodywithqueryparamsPut.md#putrequest) request) + +**Parameters:**
+request - the input request + +**Returns:**
+the deserialized response + +**Throws:**
+IOException, InterruptedException - an exception happened when making the request
+ValidationException - the returned response body or header values do not conform the the schema validation requirements
+NotImplementedException - the request body serialization or deserialization has not yet been implemented
+ or the header content type deserialization has not yet been implemented for this contentType
+ApiException - server returned a response/contentType not defined in the openapi document
+ +#### 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.fakebodywithqueryparams.put.FakebodywithqueryparamsPutRequestBody; +import org.openapijsonschematools.client.components.schemas.User; +import org.openapijsonschematools.client.paths.fakebodywithqueryparams.put.FakebodywithqueryparamsPutQueryParameters; +import org.openapijsonschematools.client.servers.RootServer0; +import org.openapijsonschematools.client.servers.RootServer1; +import org.openapijsonschematools.client.servers.RootServer2; +import org.openapijsonschematools.client.paths.fakebodywithqueryparams.put.responses.FakebodywithqueryparamsPutCode200Response; +import org.openapijsonschematools.client.servers.RootServerInfo; +import org.openapijsonschematools.client.apis.paths.Fakebodywithqueryparams; +import org.openapijsonschematools.client.paths.fakebodywithqueryparams.put.FakebodywithqueryparamsPutResponses; + +import java.io.IOException; +import java.util.Arrays; +import java.util.List; +import java.util.Map; +import java.util.AbstractMap; + +// if you want to use a server that is not SERVER_0 pass it in here and change the ServerIndex input below +ApiConfiguration.ServerInfo serverInfo = new ApiConfiguration.ServerInfoBuilder() + .rootServerInfo( + new RootServerInfo.RootServerInfoBuilder() + .rootServer0(new RootServer0()) + .build() + ) + .build(); +ApiConfiguration.ServerIndexInfo serverIndexInfo = new ApiConfiguration.ServerIndexInfoBuilder() + .rootServerInfoServerIndex(RootServerInfo.ServerIndex.SERVER_0) + .build(); +Duration timeout = Duration.ofSeconds(1L); +Map> defaultHeaders = Map.of("User-Agent", List.of("OpenAPI-JSON-Schema-Generator/1.0.0/java")); +ApiConfiguration apiConfiguration = new ApiConfiguration( + serverInfo + serverIndexInfo, + timeout, + defaultHeaders +); +SchemaConfiguration schemaConfiguration = new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().build()); +Fakebodywithqueryparams apiClient = new Fakebodywithqueryparams(apiConfiguration, schemaConfiguration); + + +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 +); +FakebodywithqueryparamsPut.SealedRequestBody requestBody = new FakebodywithqueryparamsPut.ApplicationjsonRequestBody(requestBodyPayload); + +// Map validation +FakebodywithqueryparamsPutQueryParameters.QueryParametersMap queryParameters = + FakebodywithqueryparamsPutQueryParameters.FakebodywithqueryparamsPutQueryParameters1.validate( + new FakebodywithqueryparamsPutQueryParameters.QueryParametersMapBuilder() + .query("a") + + .build(), + schemaConfiguration +); + +var request = new FakebodywithqueryparamsPut.PutRequestBuilder() + .requestBody(requestBody) + .queryParameters(queryParameters) + .build(); + +FakebodywithqueryparamsPutResponses.EndpointResponse response; +try { + response = apiClient.put(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; +} +FakebodywithqueryparamsPutResponses.EndpointFakebodywithqueryparamsPutCode200Response castResponse = (FakebodywithqueryparamsPutResponses.EndpointFakebodywithqueryparamsPutCode200Response) response; +``` +[[Back to top]](#top) [[Back to README]](../../../README.md) diff --git a/samples/client/petstore/kotlin/docs/apis/paths/Fakecasesensitiveparams.md b/samples/client/petstore/kotlin/docs/apis/paths/Fakecasesensitiveparams.md new file mode 100644 index 00000000000..81d60e9c5d1 --- /dev/null +++ b/samples/client/petstore/kotlin/docs/apis/paths/Fakecasesensitiveparams.md @@ -0,0 +1,120 @@ +# Fakecasesensitiveparams + +public class Fakecasesensitiveparams extends extends ApiClient implements +[FakecasesensitiveparamsPut.PutOperation](../../paths/fakecasesensitiveparams/FakecasesensitiveparamsPut.md#putoperation) + +an api client class which contains all the routes for path="/fake/case-sensitive-params" + +## Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| [FakecasesensitiveparamsPutResponses.EndpointResponse](../../paths/fakecasesensitiveparams/put/FakecasesensitiveparamsPutResponses.md#endpointresponse) | [put](#put)([FakecasesensitiveparamsPut.PutRequest](../../paths/fakecasesensitiveparams/FakecasesensitiveparamsPut.md#putrequest) request)
Ensures that original naming is used in endpoint params, that way we don't have collisions | + +## Method Detail + +### put +public [FakecasesensitiveparamsPutResponses.EndpointResponse](../../paths/fakecasesensitiveparams/put/FakecasesensitiveparamsPutResponses.md#endpointresponse) put([FakecasesensitiveparamsPut.PutRequest](../../paths/fakecasesensitiveparams/FakecasesensitiveparamsPut.md#putrequest) request) + +Ensures that original naming is used in endpoint params, that way we don't have collisions + +**Parameters:**
+request - the input request + +**Returns:**
+the deserialized response + +**Throws:**
+IOException, InterruptedException - an exception happened when making the request
+ValidationException - the returned response body or header values do not conform the the schema validation requirements
+NotImplementedException - the request body serialization or deserialization has not yet been implemented
+ or the header content type deserialization has not yet been implemented for this contentType
+ApiException - server returned a response/contentType not defined in the openapi document
+ +#### 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.fakecasesensitiveparams.put.FakecasesensitiveparamsPutQueryParameters; +import org.openapijsonschematools.client.servers.RootServer0; +import org.openapijsonschematools.client.servers.RootServer1; +import org.openapijsonschematools.client.servers.RootServer2; +import org.openapijsonschematools.client.paths.fakecasesensitiveparams.put.responses.FakecasesensitiveparamsPutCode200Response; +import org.openapijsonschematools.client.servers.RootServerInfo; +import org.openapijsonschematools.client.apis.paths.Fakecasesensitiveparams; +import org.openapijsonschematools.client.paths.fakecasesensitiveparams.put.FakecasesensitiveparamsPutResponses; + +import java.io.IOException; +import java.util.Arrays; +import java.util.List; +import java.util.Map; +import java.util.AbstractMap; + +// if you want to use a server that is not SERVER_0 pass it in here and change the ServerIndex input below +ApiConfiguration.ServerInfo serverInfo = new ApiConfiguration.ServerInfoBuilder() + .rootServerInfo( + new RootServerInfo.RootServerInfoBuilder() + .rootServer0(new RootServer0()) + .build() + ) + .build(); +ApiConfiguration.ServerIndexInfo serverIndexInfo = new ApiConfiguration.ServerIndexInfoBuilder() + .rootServerInfoServerIndex(RootServerInfo.ServerIndex.SERVER_0) + .build(); +Duration timeout = Duration.ofSeconds(1L); +Map> defaultHeaders = Map.of("User-Agent", List.of("OpenAPI-JSON-Schema-Generator/1.0.0/java")); +ApiConfiguration apiConfiguration = new ApiConfiguration( + serverInfo + serverIndexInfo, + timeout, + defaultHeaders +); +SchemaConfiguration schemaConfiguration = new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().build()); +Fakecasesensitiveparams apiClient = new Fakecasesensitiveparams(apiConfiguration, schemaConfiguration); + + +// Map validation +FakecasesensitiveparamsPutQueryParameters.QueryParametersMap queryParameters = + FakecasesensitiveparamsPutQueryParameters.FakecasesensitiveparamsPutQueryParameters1.validate( + new FakecasesensitiveparamsPutQueryParameters.QueryParametersMapBuilder() + .SomeVar("a") + + .someVar("a") + + .some_var("a") + + .build(), + schemaConfiguration +); + +var request = new FakecasesensitiveparamsPut.PutRequestBuilder() + .queryParameters(queryParameters) + .build(); + +FakecasesensitiveparamsPutResponses.EndpointResponse response; +try { + response = apiClient.put(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; +} +FakecasesensitiveparamsPutResponses.EndpointFakecasesensitiveparamsPutCode200Response castResponse = (FakecasesensitiveparamsPutResponses.EndpointFakecasesensitiveparamsPutCode200Response) response; +``` +[[Back to top]](#top) [[Back to README]](../../../README.md) diff --git a/samples/client/petstore/kotlin/docs/apis/paths/Fakeclassnametest.md b/samples/client/petstore/kotlin/docs/apis/paths/Fakeclassnametest.md new file mode 100644 index 00000000000..cc6495fc943 --- /dev/null +++ b/samples/client/petstore/kotlin/docs/apis/paths/Fakeclassnametest.md @@ -0,0 +1,131 @@ +# Fakeclassnametest + +public class Fakeclassnametest extends extends ApiClient implements +[FakeclassnametestPatch.PatchOperation](../../paths/fakeclassnametest/FakeclassnametestPatch.md#patchoperation) + +an api client class which contains all the routes for path="/fake_classname_test" + +## Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| [FakeclassnametestPatchResponses.EndpointResponse](../../paths/fakeclassnametest/patch/FakeclassnametestPatchResponses.md#endpointresponse) | [patch](#patch)([FakeclassnametestPatch.PatchRequest](../../paths/fakeclassnametest/FakeclassnametestPatch.md#patchrequest) request)
To test class name in snake case | + +## Method Detail + +### patch +public [FakeclassnametestPatchResponses.EndpointResponse](../../paths/fakeclassnametest/patch/FakeclassnametestPatchResponses.md#endpointresponse) patch([FakeclassnametestPatch.PatchRequest](../../paths/fakeclassnametest/FakeclassnametestPatch.md#patchrequest) request) + +To test class name in snake case + +**Parameters:**
+request - the input request + +**Returns:**
+the deserialized response + +**Throws:**
+IOException, InterruptedException - an exception happened when making the request
+ValidationException - the returned response body or header values do not conform the the schema validation requirements
+NotImplementedException - the request body serialization or deserialization has not yet been implemented
+ or the header content type deserialization has not yet been implemented for this contentType
+ApiException - server returned a response/contentType not defined in the openapi document
+ +#### 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.fakeclassnametest.patch.FakeclassnametestPatchSecurityInfo; +import org.openapijsonschematools.client.paths.fakeclassnametest.patch.FakeclassnametestPatchRequestBody; +import org.openapijsonschematools.client.components.schemas.Client; +import org.openapijsonschematools.client.servers.RootServer0; +import org.openapijsonschematools.client.servers.RootServer1; +import org.openapijsonschematools.client.servers.RootServer2; +import org.openapijsonschematools.client.securityschemes.SecurityScheme; +import org.openapijsonschematools.client.components.securityschemes.ApiKeyQuery; +import org.openapijsonschematools.client.paths.fakeclassnametest.patch.responses.FakeclassnametestPatchCode200Response; +import org.openapijsonschematools.client.servers.RootServerInfo; +import org.openapijsonschematools.client.apis.paths.Fakeclassnametest; +import org.openapijsonschematools.client.paths.fakeclassnametest.patch.FakeclassnametestPatchResponses; + +import java.io.IOException; +import java.util.Arrays; +import java.util.List; +import java.util.Map; +import java.util.AbstractMap; + +// if you want to use a server that is not SERVER_0 pass it in here and change the ServerIndex input below +ApiConfiguration.ServerInfo serverInfo = new ApiConfiguration.ServerInfoBuilder() + .rootServerInfo( + new RootServerInfo.RootServerInfoBuilder() + .rootServer0(new RootServer0()) + .build() + ) + .build(); +ApiConfiguration.ServerIndexInfo serverIndexInfo = new ApiConfiguration.ServerIndexInfoBuilder() + .rootServerInfoServerIndex(RootServerInfo.ServerIndex.SERVER_0) + .build(); +List securitySchemes = new ArrayList(); +securitySchemes.add( + new ApiKeyQuery("someApiKey"); +); +ApiConfiguration.SecurityIndexInfo securityIndexInfo = new ApiConfiguration.SecurityIndexInfoBuilder() + .fakeclassnametestPatchSecurityRequirementObject0SecurityIndex(FakeclassnametestPatchSecurityRequirementObject0.SecurityIndex.SECURITY_0) + .build(); +Duration timeout = Duration.ofSeconds(1L); +Map> defaultHeaders = Map.of("User-Agent", List.of("OpenAPI-JSON-Schema-Generator/1.0.0/java")); +ApiConfiguration apiConfiguration = new ApiConfiguration( + serverInfo + serverIndexInfo, + securitySchemes, + securityIndexInfo, + timeout, + defaultHeaders +); +SchemaConfiguration schemaConfiguration = new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().build()); +Fakeclassnametest apiClient = new Fakeclassnametest(apiConfiguration, schemaConfiguration); + + +Client1BoxedMap requestBodyPayload = + Client.Client1.validateAndBox( + new Client.ClientMapBuilder1() + .client("a") + + .build(), + schemaConfiguration +); +FakeclassnametestPatchRequestBody.SealedRequestBody requestBody = new FakeclassnametestPatchRequestBody.ApplicationjsonRequestBody(requestBodyPayload); + +var request = new FakeclassnametestPatch.PatchRequestBuilder() + .requestBody(requestBody) + .build(); + +FakeclassnametestPatchResponses.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; +} +FakeclassnametestPatchResponses.EndpointFakeclassnametestPatchCode200Response castResponse = (FakeclassnametestPatchResponses.EndpointFakeclassnametestPatchCode200Response) response; +FakeclassnametestPatchCode200Response.ApplicationjsonResponseBody deserializedBody = (FakeclassnametestPatchCode200Response.ApplicationjsonResponseBody) castResponse.body; +// handle deserialized body here +``` +[[Back to top]](#top) [[Back to README]](../../../README.md) diff --git a/samples/client/petstore/kotlin/docs/apis/paths/Fakedeletecoffeeid.md b/samples/client/petstore/kotlin/docs/apis/paths/Fakedeletecoffeeid.md new file mode 100644 index 00000000000..4e01b0caf73 --- /dev/null +++ b/samples/client/petstore/kotlin/docs/apis/paths/Fakedeletecoffeeid.md @@ -0,0 +1,120 @@ +# Fakedeletecoffeeid + +public class Fakedeletecoffeeid extends extends ApiClient implements +[FakedeletecoffeeidDelete.DeleteOperation](../../paths/fakedeletecoffeeid/FakedeletecoffeeidDelete.md#deleteoperation) + +an api client class which contains all the routes for path="/fake/deleteCoffee/{id}" + +## Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| [FakedeletecoffeeidDeleteResponses.EndpointResponse](../../paths/fakedeletecoffeeid/delete/FakedeletecoffeeidDeleteResponses.md#endpointresponse) | [delete](#delete)([FakedeletecoffeeidDelete.DeleteRequest](../../paths/fakedeletecoffeeid/FakedeletecoffeeidDelete.md#deleterequest) request)
Delete the coffee identified by the given id, (delete without request body) | + +## Method Detail + +### delete +public [FakedeletecoffeeidDeleteResponses.EndpointResponse](../../paths/fakedeletecoffeeid/delete/FakedeletecoffeeidDeleteResponses.md#endpointresponse) delete([FakedeletecoffeeidDelete.DeleteRequest](../../paths/fakedeletecoffeeid/FakedeletecoffeeidDelete.md#deleterequest) request) + +Delete the coffee identified by the given id, (delete without request body) + +**Parameters:**
+request - the input request + +**Returns:**
+the deserialized response + +**Throws:**
+IOException, InterruptedException - an exception happened when making the request
+ValidationException - the returned response body or header values do not conform the the schema validation requirements
+NotImplementedException - the request body serialization or deserialization has not yet been implemented
+ or the header content type deserialization has not yet been implemented for this contentType
+ApiException - server returned a response/contentType not defined in the openapi document
+ +#### 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.FakedeletecoffeeidDeletePathParameters; +import org.openapijsonschematools.client.servers.RootServer0; +import org.openapijsonschematools.client.servers.RootServer1; +import org.openapijsonschematools.client.servers.RootServer2; +import org.openapijsonschematools.client.paths.fakedeletecoffeeid.delete.responses.FakedeletecoffeeidDeleteCode200Response; +import org.openapijsonschematools.client.paths.fakedeletecoffeeid.delete.responses.FakedeletecoffeeidDeleteCodedefaultResponse; +import org.openapijsonschematools.client.servers.RootServerInfo; +import org.openapijsonschematools.client.apis.paths.Fakedeletecoffeeid; +import org.openapijsonschematools.client.paths.fakedeletecoffeeid.delete.FakedeletecoffeeidDeleteResponses; + +import java.io.IOException; +import java.util.Arrays; +import java.util.List; +import java.util.Map; +import java.util.AbstractMap; + +// if you want to use a server that is not SERVER_0 pass it in here and change the ServerIndex input below +ApiConfiguration.ServerInfo serverInfo = new ApiConfiguration.ServerInfoBuilder() + .rootServerInfo( + new RootServerInfo.RootServerInfoBuilder() + .rootServer0(new RootServer0()) + .build() + ) + .build(); +ApiConfiguration.ServerIndexInfo serverIndexInfo = new ApiConfiguration.ServerIndexInfoBuilder() + .rootServerInfoServerIndex(RootServerInfo.ServerIndex.SERVER_0) + .build(); +Duration timeout = Duration.ofSeconds(1L); +Map> defaultHeaders = Map.of("User-Agent", List.of("OpenAPI-JSON-Schema-Generator/1.0.0/java")); +ApiConfiguration apiConfiguration = new ApiConfiguration( + serverInfo + serverIndexInfo, + timeout, + defaultHeaders +); +SchemaConfiguration schemaConfiguration = new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().build()); +Fakedeletecoffeeid apiClient = new Fakedeletecoffeeid(apiConfiguration, schemaConfiguration); + + +// Map validation +FakedeletecoffeeidDeletePathParameters.PathParametersMap pathParameters = + FakedeletecoffeeidDeletePathParameters.FakedeletecoffeeidDeletePathParameters1.validate( + new FakedeletecoffeeidDeletePathParameters.PathParametersMapBuilder() + .id("a") + + .build(), + schemaConfiguration +); + +var request = new FakedeletecoffeeidDelete.DeleteRequestBuilder() + .pathParameters(pathParameters) + .build(); + +FakedeletecoffeeidDeleteResponses.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 FakedeletecoffeeidDeleteResponses.EndpointFakedeletecoffeeidDeleteCode200Response castResponse) { +} else { + FakedeletecoffeeidDeleteResponses.EndpointFakedeletecoffeeidDeleteCodedefaultResponse castResponse = (FakedeletecoffeeidDeleteResponses.EndpointFakedeletecoffeeidDeleteCodedefaultResponse) response; +} +``` +[[Back to top]](#top) [[Back to README]](../../../README.md) diff --git a/samples/client/petstore/kotlin/docs/apis/paths/Fakehealth.md b/samples/client/petstore/kotlin/docs/apis/paths/Fakehealth.md new file mode 100644 index 00000000000..c477de9e166 --- /dev/null +++ b/samples/client/petstore/kotlin/docs/apis/paths/Fakehealth.md @@ -0,0 +1,103 @@ +# Fakehealth + +public class Fakehealth extends extends ApiClient implements +[FakehealthGet.GetOperation](../../paths/fakehealth/FakehealthGet.md#getoperation) + +an api client class which contains all the routes for path="/fake/health" + +## Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| [FakehealthGetResponses.EndpointResponse](../../paths/fakehealth/get/FakehealthGetResponses.md#endpointresponse) | [get](#get)([FakehealthGet.GetRequest](../../paths/fakehealth/FakehealthGet.md#getrequest) request) | + +## Method Detail + +### get +public [FakehealthGetResponses.EndpointResponse](../../paths/fakehealth/get/FakehealthGetResponses.md#endpointresponse) get([FakehealthGet.GetRequest](../../paths/fakehealth/FakehealthGet.md#getrequest) request) + +**Parameters:**
+request - the input request + +**Returns:**
+the deserialized response + +**Throws:**
+IOException, InterruptedException - an exception happened when making the request
+ValidationException - the returned response body or header values do not conform the the schema validation requirements
+NotImplementedException - the request body serialization or deserialization has not yet been implemented
+ or the header content type deserialization has not yet been implemented for this contentType
+ApiException - server returned a response/contentType not defined in the openapi document
+ +#### 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.servers.RootServer0; +import org.openapijsonschematools.client.servers.RootServer1; +import org.openapijsonschematools.client.servers.RootServer2; +import org.openapijsonschematools.client.paths.fakehealth.get.responses.FakehealthGetCode200Response; +import org.openapijsonschematools.client.servers.RootServerInfo; +import org.openapijsonschematools.client.apis.paths.Fakehealth; +import org.openapijsonschematools.client.paths.fakehealth.get.FakehealthGetResponses; + +import java.io.IOException; +import java.util.Arrays; +import java.util.List; +import java.util.Map; +import java.util.AbstractMap; + +// if you want to use a server that is not SERVER_0 pass it in here and change the ServerIndex input below +ApiConfiguration.ServerInfo serverInfo = new ApiConfiguration.ServerInfoBuilder() + .rootServerInfo( + new RootServerInfo.RootServerInfoBuilder() + .rootServer0(new RootServer0()) + .build() + ) + .build(); +ApiConfiguration.ServerIndexInfo serverIndexInfo = new ApiConfiguration.ServerIndexInfoBuilder() + .rootServerInfoServerIndex(RootServerInfo.ServerIndex.SERVER_0) + .build(); +Duration timeout = Duration.ofSeconds(1L); +Map> defaultHeaders = Map.of("User-Agent", List.of("OpenAPI-JSON-Schema-Generator/1.0.0/java")); +ApiConfiguration apiConfiguration = new ApiConfiguration( + serverInfo + serverIndexInfo, + timeout, + defaultHeaders +); +SchemaConfiguration schemaConfiguration = new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().build()); +Fakehealth apiClient = new Fakehealth(apiConfiguration, schemaConfiguration); + + +var request = new FakehealthGet.GetRequestBuilder().build(); + +FakehealthGetResponses.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; +} +FakehealthGetResponses.EndpointFakehealthGetCode200Response castResponse = (FakehealthGetResponses.EndpointFakehealthGetCode200Response) response; +FakehealthGetCode200Response.ApplicationjsonResponseBody deserializedBody = (FakehealthGetCode200Response.ApplicationjsonResponseBody) castResponse.body; +// handle deserialized body here +``` +[[Back to top]](#top) [[Back to README]](../../../README.md) diff --git a/samples/client/petstore/kotlin/docs/apis/paths/Fakeinlineadditionalproperties.md b/samples/client/petstore/kotlin/docs/apis/paths/Fakeinlineadditionalproperties.md new file mode 100644 index 00000000000..4cbe6ceeb28 --- /dev/null +++ b/samples/client/petstore/kotlin/docs/apis/paths/Fakeinlineadditionalproperties.md @@ -0,0 +1,117 @@ +# Fakeinlineadditionalproperties + +public class Fakeinlineadditionalproperties extends extends ApiClient implements +[FakeinlineadditionalpropertiesPost.PostOperation](../../paths/fakeinlineadditionalproperties/FakeinlineadditionalpropertiesPost.md#postoperation) + +an api client class which contains all the routes for path="/fake/inline-additionalProperties" + +## Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| [FakeinlineadditionalpropertiesPostResponses.EndpointResponse](../../paths/fakeinlineadditionalproperties/post/FakeinlineadditionalpropertiesPostResponses.md#endpointresponse) | [post](#post)([FakeinlineadditionalpropertiesPost.PostRequest](../../paths/fakeinlineadditionalproperties/FakeinlineadditionalpropertiesPost.md#postrequest) request)
| + +## Method Detail + +### post +public [FakeinlineadditionalpropertiesPostResponses.EndpointResponse](../../paths/fakeinlineadditionalproperties/post/FakeinlineadditionalpropertiesPostResponses.md#endpointresponse) post([FakeinlineadditionalpropertiesPost.PostRequest](../../paths/fakeinlineadditionalproperties/FakeinlineadditionalpropertiesPost.md#postrequest) request) + + + +**Parameters:**
+request - the input request + +**Returns:**
+the deserialized response + +**Throws:**
+IOException, InterruptedException - an exception happened when making the request
+ValidationException - the returned response body or header values do not conform the the schema validation requirements
+NotImplementedException - the request body serialization or deserialization has not yet been implemented
+ or the header content type deserialization has not yet been implemented for this contentType
+ApiException - server returned a response/contentType not defined in the openapi document
+ +#### 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.fakeinlineadditionalproperties.post.FakeinlineadditionalpropertiesPostRequestBody; +import org.openapijsonschematools.client.paths.fakeinlineadditionalproperties.post.requestbody.content.applicationjson.ApplicationjsonSchema; +import org.openapijsonschematools.client.servers.RootServer0; +import org.openapijsonschematools.client.servers.RootServer1; +import org.openapijsonschematools.client.servers.RootServer2; +import org.openapijsonschematools.client.paths.fakeinlineadditionalproperties.post.responses.FakeinlineadditionalpropertiesPostCode200Response; +import org.openapijsonschematools.client.servers.RootServerInfo; +import org.openapijsonschematools.client.apis.paths.Fakeinlineadditionalproperties; +import org.openapijsonschematools.client.paths.fakeinlineadditionalproperties.post.FakeinlineadditionalpropertiesPostResponses; + +import java.io.IOException; +import java.util.Arrays; +import java.util.List; +import java.util.Map; +import java.util.AbstractMap; + +// if you want to use a server that is not SERVER_0 pass it in here and change the ServerIndex input below +ApiConfiguration.ServerInfo serverInfo = new ApiConfiguration.ServerInfoBuilder() + .rootServerInfo( + new RootServerInfo.RootServerInfoBuilder() + .rootServer0(new RootServer0()) + .build() + ) + .build(); +ApiConfiguration.ServerIndexInfo serverIndexInfo = new ApiConfiguration.ServerIndexInfoBuilder() + .rootServerInfoServerIndex(RootServerInfo.ServerIndex.SERVER_0) + .build(); +Duration timeout = Duration.ofSeconds(1L); +Map> defaultHeaders = Map.of("User-Agent", List.of("OpenAPI-JSON-Schema-Generator/1.0.0/java")); +ApiConfiguration apiConfiguration = new ApiConfiguration( + serverInfo + serverIndexInfo, + timeout, + defaultHeaders +); +SchemaConfiguration schemaConfiguration = new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().build()); +Fakeinlineadditionalproperties apiClient = new Fakeinlineadditionalproperties(apiConfiguration, schemaConfiguration); + + +ApplicationjsonSchema1BoxedMap requestBodyPayload = + ApplicationjsonSchema.ApplicationjsonSchema1.validateAndBox( + new ApplicationjsonSchema.ApplicationjsonSchemaMapBuilder() + .additionalProperty("someAdditionalProperty", "a") + + .build(), + schemaConfiguration +); +FakeinlineadditionalpropertiesPost.SealedRequestBody requestBody = new FakeinlineadditionalpropertiesPost.ApplicationjsonRequestBody(requestBodyPayload); + +var request = new FakeinlineadditionalpropertiesPost.PostRequestBuilder() + .requestBody(requestBody) + .build(); + +FakeinlineadditionalpropertiesPostResponses.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; +} +FakeinlineadditionalpropertiesPostResponses.EndpointFakeinlineadditionalpropertiesPostCode200Response castResponse = (FakeinlineadditionalpropertiesPostResponses.EndpointFakeinlineadditionalpropertiesPostCode200Response) response; +``` +[[Back to top]](#top) [[Back to README]](../../../README.md) diff --git a/samples/client/petstore/kotlin/docs/apis/paths/Fakeinlinecomposition.md b/samples/client/petstore/kotlin/docs/apis/paths/Fakeinlinecomposition.md new file mode 100644 index 00000000000..fe11f7b38aa --- /dev/null +++ b/samples/client/petstore/kotlin/docs/apis/paths/Fakeinlinecomposition.md @@ -0,0 +1,112 @@ +# Fakeinlinecomposition + +public class Fakeinlinecomposition extends extends ApiClient implements +[FakeinlinecompositionPost.PostOperation](../../paths/fakeinlinecomposition/FakeinlinecompositionPost.md#postoperation) + +an api client class which contains all the routes for path="/fake/inlineComposition/" + +## Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| [FakeinlinecompositionPostResponses.EndpointResponse](../../paths/fakeinlinecomposition/post/FakeinlinecompositionPostResponses.md#endpointresponse) | [post](#post)([FakeinlinecompositionPost.PostRequest](../../paths/fakeinlinecomposition/FakeinlinecompositionPost.md#postrequest) request)
composed schemas at inline locations + multiple requestBody content types | + +## Method Detail + +### post +public [FakeinlinecompositionPostResponses.EndpointResponse](../../paths/fakeinlinecomposition/post/FakeinlinecompositionPostResponses.md#endpointresponse) post([FakeinlinecompositionPost.PostRequest](../../paths/fakeinlinecomposition/FakeinlinecompositionPost.md#postrequest) request) + +composed schemas at inline locations + multiple requestBody content types + +**Parameters:**
+request - the input request + +**Returns:**
+the deserialized response + +**Throws:**
+IOException, InterruptedException - an exception happened when making the request
+ValidationException - the returned response body or header values do not conform the the schema validation requirements
+NotImplementedException - the request body serialization or deserialization has not yet been implemented
+ or the header content type deserialization has not yet been implemented for this contentType
+ApiException - server returned a response/contentType not defined in the openapi document
+ +#### 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.FakeinlinecompositionPostRequestBody; +import org.openapijsonschematools.client.paths.fakeinlinecomposition.post.requestbody.content.applicationjson.ApplicationjsonSchema; +import org.openapijsonschematools.client.paths.fakeinlinecomposition.post.FakeinlinecompositionPostQueryParameters; +import org.openapijsonschematools.client.RootServerInfo; +import org.openapijsonschematools.client.servers.RootServer0; +import org.openapijsonschematools.client.servers.RootServer1; +import org.openapijsonschematools.client.servers.RootServer2; +import org.openapijsonschematools.client.paths.fakeinlinecomposition.post.responses.FakeinlinecompositionPostCode200Response; +import org.openapijsonschematools.client.servers.RootServerInfo; +import org.openapijsonschematools.client.apis.paths.Fakeinlinecomposition; +import org.openapijsonschematools.client.paths.fakeinlinecomposition.post.FakeinlinecompositionPostResponses; + +import java.io.IOException; +import java.util.Arrays; +import java.util.List; +import java.util.Map; +import java.util.AbstractMap; + +// if you want to use a server that is not SERVER_0 pass it in here and change the ServerIndex input below +ApiConfiguration.ServerInfo serverInfo = new ApiConfiguration.ServerInfoBuilder() + .rootServerInfo( + new RootServerInfo.RootServerInfoBuilder() + .rootServer0(new RootServer0()) + .build() + ) + .build(); +ApiConfiguration.ServerIndexInfo serverIndexInfo = new ApiConfiguration.ServerIndexInfoBuilder() + .rootServerInfoServerIndex(RootServerInfo.ServerIndex.SERVER_0) + .build(); +Duration timeout = Duration.ofSeconds(1L); +Map> defaultHeaders = Map.of("User-Agent", List.of("OpenAPI-JSON-Schema-Generator/1.0.0/java")); +ApiConfiguration apiConfiguration = new ApiConfiguration( + serverInfo + serverIndexInfo, + timeout, + defaultHeaders +); +SchemaConfiguration schemaConfiguration = new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().build()); +Fakeinlinecomposition apiClient = new Fakeinlinecomposition(apiConfiguration, schemaConfiguration); + + +var request = new FakeinlinecompositionPost.PostRequestBuilder().build(); + +FakeinlinecompositionPostResponses.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; +} +FakeinlinecompositionPostResponses.EndpointFakeinlinecompositionPostCode200Response castResponse = (FakeinlinecompositionPostResponses.EndpointFakeinlinecompositionPostCode200Response) response; +if (castResponse.body instanceof FakeinlinecompositionPostCode200Response.ApplicationjsonResponseBody deserializedBody) { + // handle deserialized body here +} else { + FakeinlinecompositionPostCode200Response.MultipartformdataResponseBody deserializedBody = (FakeinlinecompositionPostCode200Response.MultipartformdataResponseBody) castResponse.body; + // handle deserialized body here +} +``` +[[Back to top]](#top) [[Back to README]](../../../README.md) diff --git a/samples/client/petstore/kotlin/docs/apis/paths/Fakejsonformdata.md b/samples/client/petstore/kotlin/docs/apis/paths/Fakejsonformdata.md new file mode 100644 index 00000000000..d39ea3d3fdb --- /dev/null +++ b/samples/client/petstore/kotlin/docs/apis/paths/Fakejsonformdata.md @@ -0,0 +1,105 @@ +# Fakejsonformdata + +public class Fakejsonformdata extends extends ApiClient implements +[FakejsonformdataGet.GetOperation](../../paths/fakejsonformdata/FakejsonformdataGet.md#getoperation) + +an api client class which contains all the routes for path="/fake/jsonFormData" + +## Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| [FakejsonformdataGetResponses.EndpointResponse](../../paths/fakejsonformdata/get/FakejsonformdataGetResponses.md#endpointresponse) | [get](#get)([FakejsonformdataGet.GetRequest](../../paths/fakejsonformdata/FakejsonformdataGet.md#getrequest) request)
| + +## Method Detail + +### get +public [FakejsonformdataGetResponses.EndpointResponse](../../paths/fakejsonformdata/get/FakejsonformdataGetResponses.md#endpointresponse) get([FakejsonformdataGet.GetRequest](../../paths/fakejsonformdata/FakejsonformdataGet.md#getrequest) request) + + + +**Parameters:**
+request - the input request + +**Returns:**
+the deserialized response + +**Throws:**
+IOException, InterruptedException - an exception happened when making the request
+ValidationException - the returned response body or header values do not conform the the schema validation requirements
+NotImplementedException - the request body serialization or deserialization has not yet been implemented
+ or the header content type deserialization has not yet been implemented for this contentType
+ApiException - server returned a response/contentType not defined in the openapi document
+ +#### 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.fakejsonformdata.get.FakejsonformdataGetRequestBody; +import org.openapijsonschematools.client.paths.fakejsonformdata.get.requestbody.content.applicationxwwwformurlencoded.ApplicationxwwwformurlencodedSchema; +import org.openapijsonschematools.client.RootServerInfo; +import org.openapijsonschematools.client.servers.RootServer0; +import org.openapijsonschematools.client.servers.RootServer1; +import org.openapijsonschematools.client.servers.RootServer2; +import org.openapijsonschematools.client.paths.fakejsonformdata.get.responses.FakejsonformdataGetCode200Response; +import org.openapijsonschematools.client.servers.RootServerInfo; +import org.openapijsonschematools.client.apis.paths.Fakejsonformdata; +import org.openapijsonschematools.client.paths.fakejsonformdata.get.FakejsonformdataGetResponses; + +import java.io.IOException; +import java.util.Arrays; +import java.util.List; +import java.util.Map; +import java.util.AbstractMap; + +// if you want to use a server that is not SERVER_0 pass it in here and change the ServerIndex input below +ApiConfiguration.ServerInfo serverInfo = new ApiConfiguration.ServerInfoBuilder() + .rootServerInfo( + new RootServerInfo.RootServerInfoBuilder() + .rootServer0(new RootServer0()) + .build() + ) + .build(); +ApiConfiguration.ServerIndexInfo serverIndexInfo = new ApiConfiguration.ServerIndexInfoBuilder() + .rootServerInfoServerIndex(RootServerInfo.ServerIndex.SERVER_0) + .build(); +Duration timeout = Duration.ofSeconds(1L); +Map> defaultHeaders = Map.of("User-Agent", List.of("OpenAPI-JSON-Schema-Generator/1.0.0/java")); +ApiConfiguration apiConfiguration = new ApiConfiguration( + serverInfo + serverIndexInfo, + timeout, + defaultHeaders +); +SchemaConfiguration schemaConfiguration = new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().build()); +Fakejsonformdata apiClient = new Fakejsonformdata(apiConfiguration, schemaConfiguration); + + +var request = new FakejsonformdataGet.GetRequestBuilder().build(); + +FakejsonformdataGetResponses.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; +} +FakejsonformdataGetResponses.EndpointFakejsonformdataGetCode200Response castResponse = (FakejsonformdataGetResponses.EndpointFakejsonformdataGetCode200Response) response; +``` +[[Back to top]](#top) [[Back to README]](../../../README.md) diff --git a/samples/client/petstore/kotlin/docs/apis/paths/Fakejsonpatch.md b/samples/client/petstore/kotlin/docs/apis/paths/Fakejsonpatch.md new file mode 100644 index 00000000000..11c9c8955d8 --- /dev/null +++ b/samples/client/petstore/kotlin/docs/apis/paths/Fakejsonpatch.md @@ -0,0 +1,105 @@ +# Fakejsonpatch + +public class Fakejsonpatch extends extends ApiClient implements +[FakejsonpatchPatch.PatchOperation](../../paths/fakejsonpatch/FakejsonpatchPatch.md#patchoperation) + +an api client class which contains all the routes for path="/fake/jsonPatch" + +## Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| [FakejsonpatchPatchResponses.EndpointResponse](../../paths/fakejsonpatch/patch/FakejsonpatchPatchResponses.md#endpointresponse) | [patch](#patch)([FakejsonpatchPatch.PatchRequest](../../paths/fakejsonpatch/FakejsonpatchPatch.md#patchrequest) request)
json patch route with a requestBody | + +## Method Detail + +### patch +public [FakejsonpatchPatchResponses.EndpointResponse](../../paths/fakejsonpatch/patch/FakejsonpatchPatchResponses.md#endpointresponse) patch([FakejsonpatchPatch.PatchRequest](../../paths/fakejsonpatch/FakejsonpatchPatch.md#patchrequest) request) + +json patch route with a requestBody + +**Parameters:**
+request - the input request + +**Returns:**
+the deserialized response + +**Throws:**
+IOException, InterruptedException - an exception happened when making the request
+ValidationException - the returned response body or header values do not conform the the schema validation requirements
+NotImplementedException - the request body serialization or deserialization has not yet been implemented
+ or the header content type deserialization has not yet been implemented for this contentType
+ApiException - server returned a response/contentType not defined in the openapi document
+ +#### 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.FakejsonpatchPatchRequestBody; +import org.openapijsonschematools.client.components.schemas.JSONPatchRequest; +import org.openapijsonschematools.client.RootServerInfo; +import org.openapijsonschematools.client.servers.RootServer0; +import org.openapijsonschematools.client.servers.RootServer1; +import org.openapijsonschematools.client.servers.RootServer2; +import org.openapijsonschematools.client.paths.fakejsonpatch.patch.responses.FakejsonpatchPatchCode200Response; +import org.openapijsonschematools.client.servers.RootServerInfo; +import org.openapijsonschematools.client.apis.paths.Fakejsonpatch; +import org.openapijsonschematools.client.paths.fakejsonpatch.patch.FakejsonpatchPatchResponses; + +import java.io.IOException; +import java.util.Arrays; +import java.util.List; +import java.util.Map; +import java.util.AbstractMap; + +// if you want to use a server that is not SERVER_0 pass it in here and change the ServerIndex input below +ApiConfiguration.ServerInfo serverInfo = new ApiConfiguration.ServerInfoBuilder() + .rootServerInfo( + new RootServerInfo.RootServerInfoBuilder() + .rootServer0(new RootServer0()) + .build() + ) + .build(); +ApiConfiguration.ServerIndexInfo serverIndexInfo = new ApiConfiguration.ServerIndexInfoBuilder() + .rootServerInfoServerIndex(RootServerInfo.ServerIndex.SERVER_0) + .build(); +Duration timeout = Duration.ofSeconds(1L); +Map> defaultHeaders = Map.of("User-Agent", List.of("OpenAPI-JSON-Schema-Generator/1.0.0/java")); +ApiConfiguration apiConfiguration = new ApiConfiguration( + serverInfo + serverIndexInfo, + timeout, + defaultHeaders +); +SchemaConfiguration schemaConfiguration = new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().build()); +Fakejsonpatch apiClient = new Fakejsonpatch(apiConfiguration, schemaConfiguration); + + +var request = new FakejsonpatchPatch.PatchRequestBuilder().build(); + +FakejsonpatchPatchResponses.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; +} +FakejsonpatchPatchResponses.EndpointFakejsonpatchPatchCode200Response castResponse = (FakejsonpatchPatchResponses.EndpointFakejsonpatchPatchCode200Response) response; +``` +[[Back to top]](#top) [[Back to README]](../../../README.md) diff --git a/samples/client/petstore/kotlin/docs/apis/paths/Fakejsonwithcharset.md b/samples/client/petstore/kotlin/docs/apis/paths/Fakejsonwithcharset.md new file mode 100644 index 00000000000..077bfa360b1 --- /dev/null +++ b/samples/client/petstore/kotlin/docs/apis/paths/Fakejsonwithcharset.md @@ -0,0 +1,105 @@ +# Fakejsonwithcharset + +public class Fakejsonwithcharset extends extends ApiClient implements +[FakejsonwithcharsetPost.PostOperation](../../paths/fakejsonwithcharset/FakejsonwithcharsetPost.md#postoperation) + +an api client class which contains all the routes for path="/fake/jsonWithCharset" + +## Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| [FakejsonwithcharsetPostResponses.EndpointResponse](../../paths/fakejsonwithcharset/post/FakejsonwithcharsetPostResponses.md#endpointresponse) | [post](#post)([FakejsonwithcharsetPost.PostRequest](../../paths/fakejsonwithcharset/FakejsonwithcharsetPost.md#postrequest) request) | + +## Method Detail + +### post +public [FakejsonwithcharsetPostResponses.EndpointResponse](../../paths/fakejsonwithcharset/post/FakejsonwithcharsetPostResponses.md#endpointresponse) post([FakejsonwithcharsetPost.PostRequest](../../paths/fakejsonwithcharset/FakejsonwithcharsetPost.md#postrequest) request) + +**Parameters:**
+request - the input request + +**Returns:**
+the deserialized response + +**Throws:**
+IOException, InterruptedException - an exception happened when making the request
+ValidationException - the returned response body or header values do not conform the the schema validation requirements
+NotImplementedException - the request body serialization or deserialization has not yet been implemented
+ or the header content type deserialization has not yet been implemented for this contentType
+ApiException - server returned a response/contentType not defined in the openapi document
+ +#### 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.FakejsonwithcharsetPostRequestBody; +import org.openapijsonschematools.client.paths.fakejsonwithcharset.post.requestbody.content.applicationjsoncharsetutf8.Applicationjsoncharsetutf8Schema; +import org.openapijsonschematools.client.RootServerInfo; +import org.openapijsonschematools.client.servers.RootServer0; +import org.openapijsonschematools.client.servers.RootServer1; +import org.openapijsonschematools.client.servers.RootServer2; +import org.openapijsonschematools.client.paths.fakejsonwithcharset.post.responses.FakejsonwithcharsetPostCode200Response; +import org.openapijsonschematools.client.servers.RootServerInfo; +import org.openapijsonschematools.client.apis.paths.Fakejsonwithcharset; +import org.openapijsonschematools.client.paths.fakejsonwithcharset.post.FakejsonwithcharsetPostResponses; + +import java.io.IOException; +import java.util.Arrays; +import java.util.List; +import java.util.Map; +import java.util.AbstractMap; + +// if you want to use a server that is not SERVER_0 pass it in here and change the ServerIndex input below +ApiConfiguration.ServerInfo serverInfo = new ApiConfiguration.ServerInfoBuilder() + .rootServerInfo( + new RootServerInfo.RootServerInfoBuilder() + .rootServer0(new RootServer0()) + .build() + ) + .build(); +ApiConfiguration.ServerIndexInfo serverIndexInfo = new ApiConfiguration.ServerIndexInfoBuilder() + .rootServerInfoServerIndex(RootServerInfo.ServerIndex.SERVER_0) + .build(); +Duration timeout = Duration.ofSeconds(1L); +Map> defaultHeaders = Map.of("User-Agent", List.of("OpenAPI-JSON-Schema-Generator/1.0.0/java")); +ApiConfiguration apiConfiguration = new ApiConfiguration( + serverInfo + serverIndexInfo, + timeout, + defaultHeaders +); +SchemaConfiguration schemaConfiguration = new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().build()); +Fakejsonwithcharset apiClient = new Fakejsonwithcharset(apiConfiguration, schemaConfiguration); + + +var request = new FakejsonwithcharsetPost.PostRequestBuilder().build(); + +FakejsonwithcharsetPostResponses.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; +} +FakejsonwithcharsetPostResponses.EndpointFakejsonwithcharsetPostCode200Response castResponse = (FakejsonwithcharsetPostResponses.EndpointFakejsonwithcharsetPostCode200Response) response; +FakejsonwithcharsetPostCode200Response.Applicationjsoncharsetutf8ResponseBody deserializedBody = (FakejsonwithcharsetPostCode200Response.Applicationjsoncharsetutf8ResponseBody) castResponse.body; +// handle deserialized body here +``` +[[Back to top]](#top) [[Back to README]](../../../README.md) diff --git a/samples/client/petstore/kotlin/docs/apis/paths/Fakemultiplerequestbodycontenttypes.md b/samples/client/petstore/kotlin/docs/apis/paths/Fakemultiplerequestbodycontenttypes.md new file mode 100644 index 00000000000..f2345495f5a --- /dev/null +++ b/samples/client/petstore/kotlin/docs/apis/paths/Fakemultiplerequestbodycontenttypes.md @@ -0,0 +1,107 @@ +# Fakemultiplerequestbodycontenttypes + +public class Fakemultiplerequestbodycontenttypes extends extends ApiClient implements +[FakemultiplerequestbodycontenttypesPost.PostOperation](../../paths/fakemultiplerequestbodycontenttypes/FakemultiplerequestbodycontenttypesPost.md#postoperation) + +an api client class which contains all the routes for path="/fake/multipleRequestBodyContentTypes/" + +## Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| [FakemultiplerequestbodycontenttypesPostResponses.EndpointResponse](../../paths/fakemultiplerequestbodycontenttypes/post/FakemultiplerequestbodycontenttypesPostResponses.md#endpointresponse) | [post](#post)([FakemultiplerequestbodycontenttypesPost.PostRequest](../../paths/fakemultiplerequestbodycontenttypes/FakemultiplerequestbodycontenttypesPost.md#postrequest) request)
composed schemas at inline locations + multiple requestBody content types | + +## Method Detail + +### post +public [FakemultiplerequestbodycontenttypesPostResponses.EndpointResponse](../../paths/fakemultiplerequestbodycontenttypes/post/FakemultiplerequestbodycontenttypesPostResponses.md#endpointresponse) post([FakemultiplerequestbodycontenttypesPost.PostRequest](../../paths/fakemultiplerequestbodycontenttypes/FakemultiplerequestbodycontenttypesPost.md#postrequest) request) + +composed schemas at inline locations + multiple requestBody content types + +**Parameters:**
+request - the input request + +**Returns:**
+the deserialized response + +**Throws:**
+IOException, InterruptedException - an exception happened when making the request
+ValidationException - the returned response body or header values do not conform the the schema validation requirements
+NotImplementedException - the request body serialization or deserialization has not yet been implemented
+ or the header content type deserialization has not yet been implemented for this contentType
+ApiException - server returned a response/contentType not defined in the openapi document
+ +#### 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.FakemultiplerequestbodycontenttypesPostRequestBody; +import org.openapijsonschematools.client.paths.fakemultiplerequestbodycontenttypes.post.requestbody.content.applicationjson.ApplicationjsonSchema; +import org.openapijsonschematools.client.RootServerInfo; +import org.openapijsonschematools.client.servers.RootServer0; +import org.openapijsonschematools.client.servers.RootServer1; +import org.openapijsonschematools.client.servers.RootServer2; +import org.openapijsonschematools.client.paths.fakemultiplerequestbodycontenttypes.post.responses.FakemultiplerequestbodycontenttypesPostCode200Response; +import org.openapijsonschematools.client.servers.RootServerInfo; +import org.openapijsonschematools.client.apis.paths.Fakemultiplerequestbodycontenttypes; +import org.openapijsonschematools.client.paths.fakemultiplerequestbodycontenttypes.post.FakemultiplerequestbodycontenttypesPostResponses; + +import java.io.IOException; +import java.util.Arrays; +import java.util.List; +import java.util.Map; +import java.util.AbstractMap; + +// if you want to use a server that is not SERVER_0 pass it in here and change the ServerIndex input below +ApiConfiguration.ServerInfo serverInfo = new ApiConfiguration.ServerInfoBuilder() + .rootServerInfo( + new RootServerInfo.RootServerInfoBuilder() + .rootServer0(new RootServer0()) + .build() + ) + .build(); +ApiConfiguration.ServerIndexInfo serverIndexInfo = new ApiConfiguration.ServerIndexInfoBuilder() + .rootServerInfoServerIndex(RootServerInfo.ServerIndex.SERVER_0) + .build(); +Duration timeout = Duration.ofSeconds(1L); +Map> defaultHeaders = Map.of("User-Agent", List.of("OpenAPI-JSON-Schema-Generator/1.0.0/java")); +ApiConfiguration apiConfiguration = new ApiConfiguration( + serverInfo + serverIndexInfo, + timeout, + defaultHeaders +); +SchemaConfiguration schemaConfiguration = new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().build()); +Fakemultiplerequestbodycontenttypes apiClient = new Fakemultiplerequestbodycontenttypes(apiConfiguration, schemaConfiguration); + + +var request = new FakemultiplerequestbodycontenttypesPost.PostRequestBuilder().build(); + +FakemultiplerequestbodycontenttypesPostResponses.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; +} +FakemultiplerequestbodycontenttypesPostResponses.EndpointFakemultiplerequestbodycontenttypesPostCode200Response castResponse = (FakemultiplerequestbodycontenttypesPostResponses.EndpointFakemultiplerequestbodycontenttypesPostCode200Response) response; +FakemultiplerequestbodycontenttypesPostCode200Response.ApplicationjsonResponseBody deserializedBody = (FakemultiplerequestbodycontenttypesPostCode200Response.ApplicationjsonResponseBody) castResponse.body; +// handle deserialized body here +``` +[[Back to top]](#top) [[Back to README]](../../../README.md) diff --git a/samples/client/petstore/kotlin/docs/apis/paths/Fakemultipleresponsebodies.md b/samples/client/petstore/kotlin/docs/apis/paths/Fakemultipleresponsebodies.md new file mode 100644 index 00000000000..8b1bd750cd5 --- /dev/null +++ b/samples/client/petstore/kotlin/docs/apis/paths/Fakemultipleresponsebodies.md @@ -0,0 +1,109 @@ +# Fakemultipleresponsebodies + +public class Fakemultipleresponsebodies extends extends ApiClient implements +[FakemultipleresponsebodiesGet.GetOperation](../../paths/fakemultipleresponsebodies/FakemultipleresponsebodiesGet.md#getoperation) + +an api client class which contains all the routes for path="/fake/multipleResponseBodies" + +## Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| [FakemultipleresponsebodiesGetResponses.EndpointResponse](../../paths/fakemultipleresponsebodies/get/FakemultipleresponsebodiesGetResponses.md#endpointresponse) | [get](#get)([FakemultipleresponsebodiesGet.GetRequest](../../paths/fakemultipleresponsebodies/FakemultipleresponsebodiesGet.md#getrequest) request) | + +## Method Detail + +### get +public [FakemultipleresponsebodiesGetResponses.EndpointResponse](../../paths/fakemultipleresponsebodies/get/FakemultipleresponsebodiesGetResponses.md#endpointresponse) get([FakemultipleresponsebodiesGet.GetRequest](../../paths/fakemultipleresponsebodies/FakemultipleresponsebodiesGet.md#getrequest) request) + +**Parameters:**
+request - the input request + +**Returns:**
+the deserialized response + +**Throws:**
+IOException, InterruptedException - an exception happened when making the request
+ValidationException - the returned response body or header values do not conform the the schema validation requirements
+NotImplementedException - the request body serialization or deserialization has not yet been implemented
+ or the header content type deserialization has not yet been implemented for this contentType
+ApiException - server returned a response/contentType not defined in the openapi document
+ +#### 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.servers.RootServer0; +import org.openapijsonschematools.client.servers.RootServer1; +import org.openapijsonschematools.client.servers.RootServer2; +import org.openapijsonschematools.client.paths.fakemultipleresponsebodies.get.responses.FakemultipleresponsebodiesGetCode200Response; +import org.openapijsonschematools.client.paths.fakemultipleresponsebodies.get.responses.FakemultipleresponsebodiesGetCode202Response; +import org.openapijsonschematools.client.servers.RootServerInfo; +import org.openapijsonschematools.client.apis.paths.Fakemultipleresponsebodies; +import org.openapijsonschematools.client.paths.fakemultipleresponsebodies.get.FakemultipleresponsebodiesGetResponses; + +import java.io.IOException; +import java.util.Arrays; +import java.util.List; +import java.util.Map; +import java.util.AbstractMap; + +// if you want to use a server that is not SERVER_0 pass it in here and change the ServerIndex input below +ApiConfiguration.ServerInfo serverInfo = new ApiConfiguration.ServerInfoBuilder() + .rootServerInfo( + new RootServerInfo.RootServerInfoBuilder() + .rootServer0(new RootServer0()) + .build() + ) + .build(); +ApiConfiguration.ServerIndexInfo serverIndexInfo = new ApiConfiguration.ServerIndexInfoBuilder() + .rootServerInfoServerIndex(RootServerInfo.ServerIndex.SERVER_0) + .build(); +Duration timeout = Duration.ofSeconds(1L); +Map> defaultHeaders = Map.of("User-Agent", List.of("OpenAPI-JSON-Schema-Generator/1.0.0/java")); +ApiConfiguration apiConfiguration = new ApiConfiguration( + serverInfo + serverIndexInfo, + timeout, + defaultHeaders +); +SchemaConfiguration schemaConfiguration = new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().build()); +Fakemultipleresponsebodies apiClient = new Fakemultipleresponsebodies(apiConfiguration, schemaConfiguration); + + +var request = new FakemultipleresponsebodiesGet.GetRequestBuilder().build(); + +FakemultipleresponsebodiesGetResponses.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; +} +if (response instanceof FakemultipleresponsebodiesGetResponses.EndpointFakemultipleresponsebodiesGetCode200Response castResponse) { + FakemultipleresponsebodiesGetCode200Response.ApplicationjsonResponseBody deserializedBody = (FakemultipleresponsebodiesGetCode200Response.ApplicationjsonResponseBody) castResponse.body; + // handle deserialized body here +} else { + FakemultipleresponsebodiesGetResponses.EndpointFakemultipleresponsebodiesGetCode202Response castResponse = (FakemultipleresponsebodiesGetResponses.EndpointFakemultipleresponsebodiesGetCode202Response) response; + FakemultipleresponsebodiesGetCode202Response.ApplicationjsonResponseBody deserializedBody = (FakemultipleresponsebodiesGetCode202Response.ApplicationjsonResponseBody) castResponse.body; + // handle deserialized body here +} +``` +[[Back to top]](#top) [[Back to README]](../../../README.md) diff --git a/samples/client/petstore/kotlin/docs/apis/paths/Fakemultiplesecurities.md b/samples/client/petstore/kotlin/docs/apis/paths/Fakemultiplesecurities.md new file mode 100644 index 00000000000..18d875440b9 --- /dev/null +++ b/samples/client/petstore/kotlin/docs/apis/paths/Fakemultiplesecurities.md @@ -0,0 +1,120 @@ +# Fakemultiplesecurities + +public class Fakemultiplesecurities extends extends ApiClient implements +[FakemultiplesecuritiesGet.GetOperation](../../paths/fakemultiplesecurities/FakemultiplesecuritiesGet.md#getoperation) + +an api client class which contains all the routes for path="/fake/multipleSecurities" + +## Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| [FakemultiplesecuritiesGetResponses.EndpointResponse](../../paths/fakemultiplesecurities/get/FakemultiplesecuritiesGetResponses.md#endpointresponse) | [get](#get)([FakemultiplesecuritiesGet.GetRequest](../../paths/fakemultiplesecurities/FakemultiplesecuritiesGet.md#getrequest) request) | + +## Method Detail + +### get +public [FakemultiplesecuritiesGetResponses.EndpointResponse](../../paths/fakemultiplesecurities/get/FakemultiplesecuritiesGetResponses.md#endpointresponse) get([FakemultiplesecuritiesGet.GetRequest](../../paths/fakemultiplesecurities/FakemultiplesecuritiesGet.md#getrequest) request) + +**Parameters:**
+request - the input request + +**Returns:**
+the deserialized response + +**Throws:**
+IOException, InterruptedException - an exception happened when making the request
+ValidationException - the returned response body or header values do not conform the the schema validation requirements
+NotImplementedException - the request body serialization or deserialization has not yet been implemented
+ or the header content type deserialization has not yet been implemented for this contentType
+ApiException - server returned a response/contentType not defined in the openapi document
+ +#### 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.fakemultiplesecurities.get.FakemultiplesecuritiesGetSecurityInfo; +import org.openapijsonschematools.client.servers.RootServer0; +import org.openapijsonschematools.client.servers.RootServer1; +import org.openapijsonschematools.client.servers.RootServer2; +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.FakemultiplesecuritiesGetCode200Response; +import org.openapijsonschematools.client.servers.RootServerInfo; +import org.openapijsonschematools.client.apis.paths.Fakemultiplesecurities; +import org.openapijsonschematools.client.paths.fakemultiplesecurities.get.FakemultiplesecuritiesGetResponses; + +import java.io.IOException; +import java.util.Arrays; +import java.util.List; +import java.util.Map; +import java.util.AbstractMap; + +// if you want to use a server that is not SERVER_0 pass it in here and change the ServerIndex input below +ApiConfiguration.ServerInfo serverInfo = new ApiConfiguration.ServerInfoBuilder() + .rootServerInfo( + new RootServerInfo.RootServerInfoBuilder() + .rootServer0(new RootServer0()) + .build() + ) + .build(); +ApiConfiguration.ServerIndexInfo serverIndexInfo = new ApiConfiguration.ServerIndexInfoBuilder() + .rootServerInfoServerIndex(RootServerInfo.ServerIndex.SERVER_0) + .build(); +List securitySchemes = new ArrayList(); +securitySchemes.add( + new HttpBasicTest("someUserId", "somePassword"); +); +securitySchemes.add( + new ApiKey("someApiKey"); +); +ApiConfiguration.SecurityIndexInfo securityIndexInfo = new ApiConfiguration.SecurityIndexInfoBuilder() + .fakemultiplesecuritiesGetSecurityRequirementObject0SecurityIndex(FakemultiplesecuritiesGetSecurityRequirementObject0.SecurityIndex.SECURITY_0) + .build(); +Duration timeout = Duration.ofSeconds(1L); +Map> defaultHeaders = Map.of("User-Agent", List.of("OpenAPI-JSON-Schema-Generator/1.0.0/java")); +ApiConfiguration apiConfiguration = new ApiConfiguration( + serverInfo + serverIndexInfo, + securitySchemes, + securityIndexInfo, + timeout, + defaultHeaders +); +SchemaConfiguration schemaConfiguration = new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().build()); +Fakemultiplesecurities apiClient = new Fakemultiplesecurities(apiConfiguration, schemaConfiguration); + + +var request = new FakemultiplesecuritiesGet.GetRequestBuilder().build(); + +FakemultiplesecuritiesGetResponses.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; +} +FakemultiplesecuritiesGetResponses.EndpointFakemultiplesecuritiesGetCode200Response castResponse = (FakemultiplesecuritiesGetResponses.EndpointFakemultiplesecuritiesGetCode200Response) response; +FakemultiplesecuritiesGetCode200Response.ApplicationjsonResponseBody deserializedBody = (FakemultiplesecuritiesGetCode200Response.ApplicationjsonResponseBody) castResponse.body; +// handle deserialized body here +``` +[[Back to top]](#top) [[Back to README]](../../../README.md) diff --git a/samples/client/petstore/kotlin/docs/apis/paths/Fakeobjinquery.md b/samples/client/petstore/kotlin/docs/apis/paths/Fakeobjinquery.md new file mode 100644 index 00000000000..f7af00866a0 --- /dev/null +++ b/samples/client/petstore/kotlin/docs/apis/paths/Fakeobjinquery.md @@ -0,0 +1,102 @@ +# Fakeobjinquery + +public class Fakeobjinquery extends extends ApiClient implements +[FakeobjinqueryGet.GetOperation](../../paths/fakeobjinquery/FakeobjinqueryGet.md#getoperation) + +an api client class which contains all the routes for path="/fake/objInQuery" + +## Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| [FakeobjinqueryGetResponses.EndpointResponse](../../paths/fakeobjinquery/get/FakeobjinqueryGetResponses.md#endpointresponse) | [get](#get)([FakeobjinqueryGet.GetRequest](../../paths/fakeobjinquery/FakeobjinqueryGet.md#getrequest) request) | + +## Method Detail + +### get +public [FakeobjinqueryGetResponses.EndpointResponse](../../paths/fakeobjinquery/get/FakeobjinqueryGetResponses.md#endpointresponse) get([FakeobjinqueryGet.GetRequest](../../paths/fakeobjinquery/FakeobjinqueryGet.md#getrequest) request) + +**Parameters:**
+request - the input request + +**Returns:**
+the deserialized response + +**Throws:**
+IOException, InterruptedException - an exception happened when making the request
+ValidationException - the returned response body or header values do not conform the the schema validation requirements
+NotImplementedException - the request body serialization or deserialization has not yet been implemented
+ or the header content type deserialization has not yet been implemented for this contentType
+ApiException - server returned a response/contentType not defined in the openapi document
+ +#### 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.fakeobjinquery.get.FakeobjinqueryGetQueryParameters; +import org.openapijsonschematools.client.RootServerInfo; +import org.openapijsonschematools.client.servers.RootServer0; +import org.openapijsonschematools.client.servers.RootServer1; +import org.openapijsonschematools.client.servers.RootServer2; +import org.openapijsonschematools.client.paths.fakeobjinquery.get.responses.FakeobjinqueryGetCode200Response; +import org.openapijsonschematools.client.servers.RootServerInfo; +import org.openapijsonschematools.client.apis.paths.Fakeobjinquery; +import org.openapijsonschematools.client.paths.fakeobjinquery.get.FakeobjinqueryGetResponses; + +import java.io.IOException; +import java.util.Arrays; +import java.util.List; +import java.util.Map; +import java.util.AbstractMap; + +// if you want to use a server that is not SERVER_0 pass it in here and change the ServerIndex input below +ApiConfiguration.ServerInfo serverInfo = new ApiConfiguration.ServerInfoBuilder() + .rootServerInfo( + new RootServerInfo.RootServerInfoBuilder() + .rootServer0(new RootServer0()) + .build() + ) + .build(); +ApiConfiguration.ServerIndexInfo serverIndexInfo = new ApiConfiguration.ServerIndexInfoBuilder() + .rootServerInfoServerIndex(RootServerInfo.ServerIndex.SERVER_0) + .build(); +Duration timeout = Duration.ofSeconds(1L); +Map> defaultHeaders = Map.of("User-Agent", List.of("OpenAPI-JSON-Schema-Generator/1.0.0/java")); +ApiConfiguration apiConfiguration = new ApiConfiguration( + serverInfo + serverIndexInfo, + timeout, + defaultHeaders +); +SchemaConfiguration schemaConfiguration = new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().build()); +Fakeobjinquery apiClient = new Fakeobjinquery(apiConfiguration, schemaConfiguration); + + +var request = new FakeobjinqueryGet.GetRequestBuilder().build(); + +FakeobjinqueryGetResponses.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; +} +FakeobjinqueryGetResponses.EndpointFakeobjinqueryGetCode200Response castResponse = (FakeobjinqueryGetResponses.EndpointFakeobjinqueryGetCode200Response) response; +``` +[[Back to top]](#top) [[Back to README]](../../../README.md) diff --git a/samples/client/petstore/kotlin/docs/apis/paths/Fakeparametercollisions1ababselfab.md b/samples/client/petstore/kotlin/docs/apis/paths/Fakeparametercollisions1ababselfab.md new file mode 100644 index 00000000000..bc2267b7934 --- /dev/null +++ b/samples/client/petstore/kotlin/docs/apis/paths/Fakeparametercollisions1ababselfab.md @@ -0,0 +1,128 @@ +# Fakeparametercollisions1ababselfab + +public class Fakeparametercollisions1ababselfab extends extends ApiClient implements +[Fakeparametercollisions1ababselfabPost.PostOperation](../../paths/fakeparametercollisions1ababselfab/Fakeparametercollisions1ababselfabPost.md#postoperation) + +an api client class which contains all the routes for path="/fake/parameterCollisions/{1}/{aB}/{Ab}/{self}/{A-B}/" + +## Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| [Fakeparametercollisions1ababselfabPostResponses.EndpointResponse](../../paths/fakeparametercollisions1ababselfab/post/Fakeparametercollisions1ababselfabPostResponses.md#endpointresponse) | [post](#post)([Fakeparametercollisions1ababselfabPost.PostRequest](../../paths/fakeparametercollisions1ababselfab/Fakeparametercollisions1ababselfabPost.md#postrequest) request) | + +## Method Detail + +### post +public [Fakeparametercollisions1ababselfabPostResponses.EndpointResponse](../../paths/fakeparametercollisions1ababselfab/post/Fakeparametercollisions1ababselfabPostResponses.md#endpointresponse) post([Fakeparametercollisions1ababselfabPost.PostRequest](../../paths/fakeparametercollisions1ababselfab/Fakeparametercollisions1ababselfabPost.md#postrequest) request) + +**Parameters:**
+request - the input request + +**Returns:**
+the deserialized response + +**Throws:**
+IOException, InterruptedException - an exception happened when making the request
+ValidationException - the returned response body or header values do not conform the the schema validation requirements
+NotImplementedException - the request body serialization or deserialization has not yet been implemented
+ or the header content type deserialization has not yet been implemented for this contentType
+ApiException - server returned a response/contentType not defined in the openapi document
+ +#### 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.fakeparametercollisions1ababselfab.post.Fakeparametercollisions1ababselfabPostRequestBody; +import org.openapijsonschematools.client.paths.fakeparametercollisions1ababselfab.post.Fakeparametercollisions1ababselfabPostHeaderParameters; +import org.openapijsonschematools.client.paths.fakeparametercollisions1ababselfab.post.Fakeparametercollisions1ababselfabPostQueryParameters; +import org.openapijsonschematools.client.paths.fakeparametercollisions1ababselfab.post.Fakeparametercollisions1ababselfabPostCookieParameters; +import org.openapijsonschematools.client.RootServerInfo; +import org.openapijsonschematools.client.paths.fakeparametercollisions1ababselfab.post.Fakeparametercollisions1ababselfabPostPathParameters; +import org.openapijsonschematools.client.servers.RootServer0; +import org.openapijsonschematools.client.servers.RootServer1; +import org.openapijsonschematools.client.servers.RootServer2; +import org.openapijsonschematools.client.paths.fakeparametercollisions1ababselfab.post.responses.Fakeparametercollisions1ababselfabPostCode200Response; +import org.openapijsonschematools.client.servers.RootServerInfo; +import org.openapijsonschematools.client.apis.paths.Fakeparametercollisions1ababselfab; +import org.openapijsonschematools.client.paths.fakeparametercollisions1ababselfab.post.Fakeparametercollisions1ababselfabPostResponses; + +import java.io.IOException; +import java.util.Arrays; +import java.util.List; +import java.util.Map; +import java.util.AbstractMap; + +// if you want to use a server that is not SERVER_0 pass it in here and change the ServerIndex input below +ApiConfiguration.ServerInfo serverInfo = new ApiConfiguration.ServerInfoBuilder() + .rootServerInfo( + new RootServerInfo.RootServerInfoBuilder() + .rootServer0(new RootServer0()) + .build() + ) + .build(); +ApiConfiguration.ServerIndexInfo serverIndexInfo = new ApiConfiguration.ServerIndexInfoBuilder() + .rootServerInfoServerIndex(RootServerInfo.ServerIndex.SERVER_0) + .build(); +Duration timeout = Duration.ofSeconds(1L); +Map> defaultHeaders = Map.of("User-Agent", List.of("OpenAPI-JSON-Schema-Generator/1.0.0/java")); +ApiConfiguration apiConfiguration = new ApiConfiguration( + serverInfo + serverIndexInfo, + timeout, + defaultHeaders +); +SchemaConfiguration schemaConfiguration = new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().build()); +Fakeparametercollisions1ababselfab apiClient = new Fakeparametercollisions1ababselfab(apiConfiguration, schemaConfiguration); + + +// Map validation +Fakeparametercollisions1ababselfabPostPathParameters.PathParametersMap pathParameters = + Fakeparametercollisions1ababselfabPostPathParameters.Fakeparametercollisions1ababselfabPostPathParameters1.validate( + new Fakeparametercollisions1ababselfabPostPathParameters.PathParametersMapBuilder() + .positive1("a") + + .aHyphenMinusB("a") + + .Ab("a") + + .aB("a") + + .self("a") + + .build(), + schemaConfiguration +); + +var request = new Fakeparametercollisions1ababselfabPost.PostRequestBuilder() + .pathParameters(pathParameters) + .build(); + +Fakeparametercollisions1ababselfabPostResponses.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; +} +Fakeparametercollisions1ababselfabPostResponses.EndpointFakeparametercollisions1ababselfabPostCode200Response castResponse = (Fakeparametercollisions1ababselfabPostResponses.EndpointFakeparametercollisions1ababselfabPostCode200Response) response; +Fakeparametercollisions1ababselfabPostCode200Response.ApplicationjsonResponseBody deserializedBody = (Fakeparametercollisions1ababselfabPostCode200Response.ApplicationjsonResponseBody) castResponse.body; +// handle deserialized body here +``` +[[Back to top]](#top) [[Back to README]](../../../README.md) diff --git a/samples/client/petstore/kotlin/docs/apis/paths/Fakepemcontenttype.md b/samples/client/petstore/kotlin/docs/apis/paths/Fakepemcontenttype.md new file mode 100644 index 00000000000..b71cd83b0f0 --- /dev/null +++ b/samples/client/petstore/kotlin/docs/apis/paths/Fakepemcontenttype.md @@ -0,0 +1,105 @@ +# Fakepemcontenttype + +public class Fakepemcontenttype extends extends ApiClient implements +[FakepemcontenttypeGet.GetOperation](../../paths/fakepemcontenttype/FakepemcontenttypeGet.md#getoperation) + +an api client class which contains all the routes for path="/fake/pemContentType" + +## Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| [FakepemcontenttypeGetResponses.EndpointResponse](../../paths/fakepemcontenttype/get/FakepemcontenttypeGetResponses.md#endpointresponse) | [get](#get)([FakepemcontenttypeGet.GetRequest](../../paths/fakepemcontenttype/FakepemcontenttypeGet.md#getrequest) request) | + +## Method Detail + +### get +public [FakepemcontenttypeGetResponses.EndpointResponse](../../paths/fakepemcontenttype/get/FakepemcontenttypeGetResponses.md#endpointresponse) get([FakepemcontenttypeGet.GetRequest](../../paths/fakepemcontenttype/FakepemcontenttypeGet.md#getrequest) request) + +**Parameters:**
+request - the input request + +**Returns:**
+the deserialized response + +**Throws:**
+IOException, InterruptedException - an exception happened when making the request
+ValidationException - the returned response body or header values do not conform the the schema validation requirements
+NotImplementedException - the request body serialization or deserialization has not yet been implemented
+ or the header content type deserialization has not yet been implemented for this contentType
+ApiException - server returned a response/contentType not defined in the openapi document
+ +#### 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.fakepemcontenttype.get.FakepemcontenttypeGetRequestBody; +import org.openapijsonschematools.client.paths.fakepemcontenttype.get.requestbody.content.applicationxpemfile.ApplicationxpemfileSchema; +import org.openapijsonschematools.client.RootServerInfo; +import org.openapijsonschematools.client.servers.RootServer0; +import org.openapijsonschematools.client.servers.RootServer1; +import org.openapijsonschematools.client.servers.RootServer2; +import org.openapijsonschematools.client.paths.fakepemcontenttype.get.responses.FakepemcontenttypeGetCode200Response; +import org.openapijsonschematools.client.servers.RootServerInfo; +import org.openapijsonschematools.client.apis.paths.Fakepemcontenttype; +import org.openapijsonschematools.client.paths.fakepemcontenttype.get.FakepemcontenttypeGetResponses; + +import java.io.IOException; +import java.util.Arrays; +import java.util.List; +import java.util.Map; +import java.util.AbstractMap; + +// if you want to use a server that is not SERVER_0 pass it in here and change the ServerIndex input below +ApiConfiguration.ServerInfo serverInfo = new ApiConfiguration.ServerInfoBuilder() + .rootServerInfo( + new RootServerInfo.RootServerInfoBuilder() + .rootServer0(new RootServer0()) + .build() + ) + .build(); +ApiConfiguration.ServerIndexInfo serverIndexInfo = new ApiConfiguration.ServerIndexInfoBuilder() + .rootServerInfoServerIndex(RootServerInfo.ServerIndex.SERVER_0) + .build(); +Duration timeout = Duration.ofSeconds(1L); +Map> defaultHeaders = Map.of("User-Agent", List.of("OpenAPI-JSON-Schema-Generator/1.0.0/java")); +ApiConfiguration apiConfiguration = new ApiConfiguration( + serverInfo + serverIndexInfo, + timeout, + defaultHeaders +); +SchemaConfiguration schemaConfiguration = new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().build()); +Fakepemcontenttype apiClient = new Fakepemcontenttype(apiConfiguration, schemaConfiguration); + + +var request = new FakepemcontenttypeGet.GetRequestBuilder().build(); + +FakepemcontenttypeGetResponses.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; +} +FakepemcontenttypeGetResponses.EndpointFakepemcontenttypeGetCode200Response castResponse = (FakepemcontenttypeGetResponses.EndpointFakepemcontenttypeGetCode200Response) response; +FakepemcontenttypeGetCode200Response.ApplicationxpemfileResponseBody deserializedBody = (FakepemcontenttypeGetCode200Response.ApplicationxpemfileResponseBody) castResponse.body; +// handle deserialized body here +``` +[[Back to top]](#top) [[Back to README]](../../../README.md) diff --git a/samples/client/petstore/kotlin/docs/apis/paths/Fakepetiduploadimagewithrequiredfile.md b/samples/client/petstore/kotlin/docs/apis/paths/Fakepetiduploadimagewithrequiredfile.md new file mode 100644 index 00000000000..371650850c3 --- /dev/null +++ b/samples/client/petstore/kotlin/docs/apis/paths/Fakepetiduploadimagewithrequiredfile.md @@ -0,0 +1,128 @@ +# Fakepetiduploadimagewithrequiredfile + +public class Fakepetiduploadimagewithrequiredfile extends extends ApiClient implements +[FakepetiduploadimagewithrequiredfilePost.PostOperation](../../paths/fakepetiduploadimagewithrequiredfile/FakepetiduploadimagewithrequiredfilePost.md#postoperation) + +an api client class which contains all the routes for path="/fake/{petId}/uploadImageWithRequiredFile" + +## Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| [FakepetiduploadimagewithrequiredfilePostResponses.EndpointResponse](../../paths/fakepetiduploadimagewithrequiredfile/post/FakepetiduploadimagewithrequiredfilePostResponses.md#endpointresponse) | [post](#post)([FakepetiduploadimagewithrequiredfilePost.PostRequest](../../paths/fakepetiduploadimagewithrequiredfile/FakepetiduploadimagewithrequiredfilePost.md#postrequest) request)
| + +## Method Detail + +### post +public [FakepetiduploadimagewithrequiredfilePostResponses.EndpointResponse](../../paths/fakepetiduploadimagewithrequiredfile/post/FakepetiduploadimagewithrequiredfilePostResponses.md#endpointresponse) post([FakepetiduploadimagewithrequiredfilePost.PostRequest](../../paths/fakepetiduploadimagewithrequiredfile/FakepetiduploadimagewithrequiredfilePost.md#postrequest) request) + + + +**Parameters:**
+request - the input request + +**Returns:**
+the deserialized response + +**Throws:**
+IOException, InterruptedException - an exception happened when making the request
+ValidationException - the returned response body or header values do not conform the the schema validation requirements
+NotImplementedException - the request body serialization or deserialization has not yet been implemented
+ or the header content type deserialization has not yet been implemented for this contentType
+ApiException - server returned a response/contentType not defined in the openapi document
+ +#### 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.FakepetiduploadimagewithrequiredfilePostRequestBody; +import org.openapijsonschematools.client.RootServerInfo; +import org.openapijsonschematools.client.paths.fakepetiduploadimagewithrequiredfile.post.FakepetiduploadimagewithrequiredfilePostSecurityInfo; +import org.openapijsonschematools.client.paths.fakepetiduploadimagewithrequiredfile.post.FakepetiduploadimagewithrequiredfilePostPathParameters; +import org.openapijsonschematools.client.servers.RootServer0; +import org.openapijsonschematools.client.servers.RootServer1; +import org.openapijsonschematools.client.servers.RootServer2; +import org.openapijsonschematools.client.securityschemes.SecurityScheme; +import org.openapijsonschematools.client.components.securityschemes.PetstoreAuth; +import org.openapijsonschematools.client.paths.fakepetiduploadimagewithrequiredfile.post.responses.FakepetiduploadimagewithrequiredfilePostCode200Response; +import org.openapijsonschematools.client.servers.RootServerInfo; +import org.openapijsonschematools.client.apis.paths.Fakepetiduploadimagewithrequiredfile; +import org.openapijsonschematools.client.paths.fakepetiduploadimagewithrequiredfile.post.FakepetiduploadimagewithrequiredfilePostResponses; + +import java.io.IOException; +import java.util.Arrays; +import java.util.List; +import java.util.Map; +import java.util.AbstractMap; + +// if you want to use a server that is not SERVER_0 pass it in here and change the ServerIndex input below +ApiConfiguration.ServerInfo serverInfo = new ApiConfiguration.ServerInfoBuilder() + .rootServerInfo( + new RootServerInfo.RootServerInfoBuilder() + .rootServer0(new RootServer0()) + .build() + ) + .build(); +ApiConfiguration.ServerIndexInfo serverIndexInfo = new ApiConfiguration.ServerIndexInfoBuilder() + .rootServerInfoServerIndex(RootServerInfo.ServerIndex.SERVER_0) + .build(); +List securitySchemes = new ArrayList(); +ApiConfiguration.SecurityIndexInfo securityIndexInfo = new ApiConfiguration.SecurityIndexInfoBuilder() + .fakepetiduploadimagewithrequiredfilePostSecurityRequirementObject0SecurityIndex(FakepetiduploadimagewithrequiredfilePostSecurityRequirementObject0.SecurityIndex.SECURITY_0) + .build(); +Duration timeout = Duration.ofSeconds(1L); +Map> defaultHeaders = Map.of("User-Agent", List.of("OpenAPI-JSON-Schema-Generator/1.0.0/java")); +ApiConfiguration apiConfiguration = new ApiConfiguration( + serverInfo + serverIndexInfo, + securitySchemes, + securityIndexInfo, + timeout, + defaultHeaders +); +SchemaConfiguration schemaConfiguration = new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().build()); +Fakepetiduploadimagewithrequiredfile apiClient = new Fakepetiduploadimagewithrequiredfile(apiConfiguration, schemaConfiguration); + + +// Map validation +FakepetiduploadimagewithrequiredfilePostPathParameters.PathParametersMap pathParameters = + FakepetiduploadimagewithrequiredfilePostPathParameters.FakepetiduploadimagewithrequiredfilePostPathParameters1.validate( + new FakepetiduploadimagewithrequiredfilePostPathParameters.PathParametersMapBuilder() + .petId(1L) + + .build(), + schemaConfiguration +); + +var request = new FakepetiduploadimagewithrequiredfilePost.PostRequestBuilder() + .pathParameters(pathParameters) + .build(); + +FakepetiduploadimagewithrequiredfilePostResponses.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; +} +FakepetiduploadimagewithrequiredfilePostResponses.EndpointFakepetiduploadimagewithrequiredfilePostCode200Response castResponse = (FakepetiduploadimagewithrequiredfilePostResponses.EndpointFakepetiduploadimagewithrequiredfilePostCode200Response) response; +FakepetiduploadimagewithrequiredfilePostCode200Response.ApplicationjsonResponseBody deserializedBody = (FakepetiduploadimagewithrequiredfilePostCode200Response.ApplicationjsonResponseBody) castResponse.body; +// handle deserialized body here +``` +[[Back to top]](#top) [[Back to README]](../../../README.md) diff --git a/samples/client/petstore/kotlin/docs/apis/paths/Fakequeryparamwithjsoncontenttype.md b/samples/client/petstore/kotlin/docs/apis/paths/Fakequeryparamwithjsoncontenttype.md new file mode 100644 index 00000000000..58ad6cb5fd2 --- /dev/null +++ b/samples/client/petstore/kotlin/docs/apis/paths/Fakequeryparamwithjsoncontenttype.md @@ -0,0 +1,114 @@ +# Fakequeryparamwithjsoncontenttype + +public class Fakequeryparamwithjsoncontenttype extends extends ApiClient implements +[FakequeryparamwithjsoncontenttypeGet.GetOperation](../../paths/fakequeryparamwithjsoncontenttype/FakequeryparamwithjsoncontenttypeGet.md#getoperation) + +an api client class which contains all the routes for path="/fake/queryParamWithJsonContentType" + +## Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| [FakequeryparamwithjsoncontenttypeGetResponses.EndpointResponse](../../paths/fakequeryparamwithjsoncontenttype/get/FakequeryparamwithjsoncontenttypeGetResponses.md#endpointresponse) | [get](#get)([FakequeryparamwithjsoncontenttypeGet.GetRequest](../../paths/fakequeryparamwithjsoncontenttype/FakequeryparamwithjsoncontenttypeGet.md#getrequest) request) | + +## Method Detail + +### get +public [FakequeryparamwithjsoncontenttypeGetResponses.EndpointResponse](../../paths/fakequeryparamwithjsoncontenttype/get/FakequeryparamwithjsoncontenttypeGetResponses.md#endpointresponse) get([FakequeryparamwithjsoncontenttypeGet.GetRequest](../../paths/fakequeryparamwithjsoncontenttype/FakequeryparamwithjsoncontenttypeGet.md#getrequest) request) + +**Parameters:**
+request - the input request + +**Returns:**
+the deserialized response + +**Throws:**
+IOException, InterruptedException - an exception happened when making the request
+ValidationException - the returned response body or header values do not conform the the schema validation requirements
+NotImplementedException - the request body serialization or deserialization has not yet been implemented
+ or the header content type deserialization has not yet been implemented for this contentType
+ApiException - server returned a response/contentType not defined in the openapi document
+ +#### 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.fakequeryparamwithjsoncontenttype.get.FakequeryparamwithjsoncontenttypeGetQueryParameters; +import org.openapijsonschematools.client.servers.RootServer0; +import org.openapijsonschematools.client.servers.RootServer1; +import org.openapijsonschematools.client.servers.RootServer2; +import org.openapijsonschematools.client.paths.fakequeryparamwithjsoncontenttype.get.responses.FakequeryparamwithjsoncontenttypeGetCode200Response; +import org.openapijsonschematools.client.servers.RootServerInfo; +import org.openapijsonschematools.client.apis.paths.Fakequeryparamwithjsoncontenttype; +import org.openapijsonschematools.client.paths.fakequeryparamwithjsoncontenttype.get.FakequeryparamwithjsoncontenttypeGetResponses; + +import java.io.IOException; +import java.util.Arrays; +import java.util.List; +import java.util.Map; +import java.util.AbstractMap; + +// if you want to use a server that is not SERVER_0 pass it in here and change the ServerIndex input below +ApiConfiguration.ServerInfo serverInfo = new ApiConfiguration.ServerInfoBuilder() + .rootServerInfo( + new RootServerInfo.RootServerInfoBuilder() + .rootServer0(new RootServer0()) + .build() + ) + .build(); +ApiConfiguration.ServerIndexInfo serverIndexInfo = new ApiConfiguration.ServerIndexInfoBuilder() + .rootServerInfoServerIndex(RootServerInfo.ServerIndex.SERVER_0) + .build(); +Duration timeout = Duration.ofSeconds(1L); +Map> defaultHeaders = Map.of("User-Agent", List.of("OpenAPI-JSON-Schema-Generator/1.0.0/java")); +ApiConfiguration apiConfiguration = new ApiConfiguration( + serverInfo + serverIndexInfo, + timeout, + defaultHeaders +); +SchemaConfiguration schemaConfiguration = new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().build()); +Fakequeryparamwithjsoncontenttype apiClient = new Fakequeryparamwithjsoncontenttype(apiConfiguration, schemaConfiguration); + + +// Map validation +FakequeryparamwithjsoncontenttypeGetQueryParameters.QueryParametersMap queryParameters = + FakequeryparamwithjsoncontenttypeGetQueryParameters.FakequeryparamwithjsoncontenttypeGetQueryParameters1.validate( + new FakequeryparamwithjsoncontenttypeGetQueryParameters.QueryParametersMapBuilder() + .build(), + schemaConfiguration +); + +var request = new FakequeryparamwithjsoncontenttypeGet.GetRequestBuilder() + .queryParameters(queryParameters) + .build(); + +FakequeryparamwithjsoncontenttypeGetResponses.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; +} +FakequeryparamwithjsoncontenttypeGetResponses.EndpointFakequeryparamwithjsoncontenttypeGetCode200Response castResponse = (FakequeryparamwithjsoncontenttypeGetResponses.EndpointFakequeryparamwithjsoncontenttypeGetCode200Response) response; +FakequeryparamwithjsoncontenttypeGetCode200Response.ApplicationjsonResponseBody deserializedBody = (FakequeryparamwithjsoncontenttypeGetCode200Response.ApplicationjsonResponseBody) castResponse.body; +// handle deserialized body here +``` +[[Back to top]](#top) [[Back to README]](../../../README.md) diff --git a/samples/client/petstore/kotlin/docs/apis/paths/Fakeredirection.md b/samples/client/petstore/kotlin/docs/apis/paths/Fakeredirection.md new file mode 100644 index 00000000000..0d2adfb058b --- /dev/null +++ b/samples/client/petstore/kotlin/docs/apis/paths/Fakeredirection.md @@ -0,0 +1,105 @@ +# Fakeredirection + +public class Fakeredirection extends extends ApiClient implements +[FakeredirectionGet.GetOperation](../../paths/fakeredirection/FakeredirectionGet.md#getoperation) + +an api client class which contains all the routes for path="/fake/redirection" + +## Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| [FakeredirectionGetResponses.EndpointResponse](../../paths/fakeredirection/get/FakeredirectionGetResponses.md#endpointresponse) | [get](#get)([FakeredirectionGet.GetRequest](../../paths/fakeredirection/FakeredirectionGet.md#getrequest) request) | + +## Method Detail + +### get +public [FakeredirectionGetResponses.EndpointResponse](../../paths/fakeredirection/get/FakeredirectionGetResponses.md#endpointresponse) get([FakeredirectionGet.GetRequest](../../paths/fakeredirection/FakeredirectionGet.md#getrequest) request) + +**Parameters:**
+request - the input request + +**Returns:**
+the deserialized response + +**Throws:**
+IOException, InterruptedException - an exception happened when making the request
+ValidationException - the returned response body or header values do not conform the the schema validation requirements
+NotImplementedException - the request body serialization or deserialization has not yet been implemented
+ or the header content type deserialization has not yet been implemented for this contentType
+ApiException - server returned a response/contentType not defined in the openapi document
+ +#### 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.servers.RootServer0; +import org.openapijsonschematools.client.servers.RootServer1; +import org.openapijsonschematools.client.servers.RootServer2; +import org.openapijsonschematools.client.paths.fakeredirection.get.responses.FakeredirectionGetCode303Response; +import org.openapijsonschematools.client.paths.fakeredirection.get.responses.FakeredirectionGetCode3XXResponse; +import org.openapijsonschematools.client.servers.RootServerInfo; +import org.openapijsonschematools.client.apis.paths.Fakeredirection; +import org.openapijsonschematools.client.paths.fakeredirection.get.FakeredirectionGetResponses; + +import java.io.IOException; +import java.util.Arrays; +import java.util.List; +import java.util.Map; +import java.util.AbstractMap; + +// if you want to use a server that is not SERVER_0 pass it in here and change the ServerIndex input below +ApiConfiguration.ServerInfo serverInfo = new ApiConfiguration.ServerInfoBuilder() + .rootServerInfo( + new RootServerInfo.RootServerInfoBuilder() + .rootServer0(new RootServer0()) + .build() + ) + .build(); +ApiConfiguration.ServerIndexInfo serverIndexInfo = new ApiConfiguration.ServerIndexInfoBuilder() + .rootServerInfoServerIndex(RootServerInfo.ServerIndex.SERVER_0) + .build(); +Duration timeout = Duration.ofSeconds(1L); +Map> defaultHeaders = Map.of("User-Agent", List.of("OpenAPI-JSON-Schema-Generator/1.0.0/java")); +ApiConfiguration apiConfiguration = new ApiConfiguration( + serverInfo + serverIndexInfo, + timeout, + defaultHeaders +); +SchemaConfiguration schemaConfiguration = new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().build()); +Fakeredirection apiClient = new Fakeredirection(apiConfiguration, schemaConfiguration); + + +var request = new FakeredirectionGet.GetRequestBuilder().build(); + +FakeredirectionGetResponses.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; +} +if (response instanceof FakeredirectionGetResponses.EndpointFakeredirectionGetCode3XXResponse castResponse) { +} else { + FakeredirectionGetResponses.EndpointFakeredirectionGetCode303Response castResponse = (FakeredirectionGetResponses.EndpointFakeredirectionGetCode303Response) response; +} +``` +[[Back to top]](#top) [[Back to README]](../../../README.md) diff --git a/samples/client/petstore/kotlin/docs/apis/paths/Fakerefobjinquery.md b/samples/client/petstore/kotlin/docs/apis/paths/Fakerefobjinquery.md new file mode 100644 index 00000000000..242cd1710c3 --- /dev/null +++ b/samples/client/petstore/kotlin/docs/apis/paths/Fakerefobjinquery.md @@ -0,0 +1,102 @@ +# Fakerefobjinquery + +public class Fakerefobjinquery extends extends ApiClient implements +[FakerefobjinqueryGet.GetOperation](../../paths/fakerefobjinquery/FakerefobjinqueryGet.md#getoperation) + +an api client class which contains all the routes for path="/fake/refObjInQuery" + +## Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| [FakerefobjinqueryGetResponses.EndpointResponse](../../paths/fakerefobjinquery/get/FakerefobjinqueryGetResponses.md#endpointresponse) | [get](#get)([FakerefobjinqueryGet.GetRequest](../../paths/fakerefobjinquery/FakerefobjinqueryGet.md#getrequest) request) | + +## Method Detail + +### get +public [FakerefobjinqueryGetResponses.EndpointResponse](../../paths/fakerefobjinquery/get/FakerefobjinqueryGetResponses.md#endpointresponse) get([FakerefobjinqueryGet.GetRequest](../../paths/fakerefobjinquery/FakerefobjinqueryGet.md#getrequest) request) + +**Parameters:**
+request - the input request + +**Returns:**
+the deserialized response + +**Throws:**
+IOException, InterruptedException - an exception happened when making the request
+ValidationException - the returned response body or header values do not conform the the schema validation requirements
+NotImplementedException - the request body serialization or deserialization has not yet been implemented
+ or the header content type deserialization has not yet been implemented for this contentType
+ApiException - server returned a response/contentType not defined in the openapi document
+ +#### 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.fakerefobjinquery.get.FakerefobjinqueryGetQueryParameters; +import org.openapijsonschematools.client.RootServerInfo; +import org.openapijsonschematools.client.servers.RootServer0; +import org.openapijsonschematools.client.servers.RootServer1; +import org.openapijsonschematools.client.servers.RootServer2; +import org.openapijsonschematools.client.paths.fakerefobjinquery.get.responses.FakerefobjinqueryGetCode200Response; +import org.openapijsonschematools.client.servers.RootServerInfo; +import org.openapijsonschematools.client.apis.paths.Fakerefobjinquery; +import org.openapijsonschematools.client.paths.fakerefobjinquery.get.FakerefobjinqueryGetResponses; + +import java.io.IOException; +import java.util.Arrays; +import java.util.List; +import java.util.Map; +import java.util.AbstractMap; + +// if you want to use a server that is not SERVER_0 pass it in here and change the ServerIndex input below +ApiConfiguration.ServerInfo serverInfo = new ApiConfiguration.ServerInfoBuilder() + .rootServerInfo( + new RootServerInfo.RootServerInfoBuilder() + .rootServer0(new RootServer0()) + .build() + ) + .build(); +ApiConfiguration.ServerIndexInfo serverIndexInfo = new ApiConfiguration.ServerIndexInfoBuilder() + .rootServerInfoServerIndex(RootServerInfo.ServerIndex.SERVER_0) + .build(); +Duration timeout = Duration.ofSeconds(1L); +Map> defaultHeaders = Map.of("User-Agent", List.of("OpenAPI-JSON-Schema-Generator/1.0.0/java")); +ApiConfiguration apiConfiguration = new ApiConfiguration( + serverInfo + serverIndexInfo, + timeout, + defaultHeaders +); +SchemaConfiguration schemaConfiguration = new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().build()); +Fakerefobjinquery apiClient = new Fakerefobjinquery(apiConfiguration, schemaConfiguration); + + +var request = new FakerefobjinqueryGet.GetRequestBuilder().build(); + +FakerefobjinqueryGetResponses.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; +} +FakerefobjinqueryGetResponses.EndpointFakerefobjinqueryGetCode200Response castResponse = (FakerefobjinqueryGetResponses.EndpointFakerefobjinqueryGetCode200Response) response; +``` +[[Back to top]](#top) [[Back to README]](../../../README.md) diff --git a/samples/client/petstore/kotlin/docs/apis/paths/Fakerefsarraymodel.md b/samples/client/petstore/kotlin/docs/apis/paths/Fakerefsarraymodel.md new file mode 100644 index 00000000000..57d5832ebc0 --- /dev/null +++ b/samples/client/petstore/kotlin/docs/apis/paths/Fakerefsarraymodel.md @@ -0,0 +1,107 @@ +# Fakerefsarraymodel + +public class Fakerefsarraymodel extends extends ApiClient implements +[FakerefsarraymodelPost.PostOperation](../../paths/fakerefsarraymodel/FakerefsarraymodelPost.md#postoperation) + +an api client class which contains all the routes for path="/fake/refs/arraymodel" + +## Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| [FakerefsarraymodelPostResponses.EndpointResponse](../../paths/fakerefsarraymodel/post/FakerefsarraymodelPostResponses.md#endpointresponse) | [post](#post)([FakerefsarraymodelPost.PostRequest](../../paths/fakerefsarraymodel/FakerefsarraymodelPost.md#postrequest) request)
Test serialization of ArrayModel | + +## Method Detail + +### post +public [FakerefsarraymodelPostResponses.EndpointResponse](../../paths/fakerefsarraymodel/post/FakerefsarraymodelPostResponses.md#endpointresponse) post([FakerefsarraymodelPost.PostRequest](../../paths/fakerefsarraymodel/FakerefsarraymodelPost.md#postrequest) request) + +Test serialization of ArrayModel + +**Parameters:**
+request - the input request + +**Returns:**
+the deserialized response + +**Throws:**
+IOException, InterruptedException - an exception happened when making the request
+ValidationException - the returned response body or header values do not conform the the schema validation requirements
+NotImplementedException - the request body serialization or deserialization has not yet been implemented
+ or the header content type deserialization has not yet been implemented for this contentType
+ApiException - server returned a response/contentType not defined in the openapi document
+ +#### 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.fakerefsarraymodel.post.FakerefsarraymodelPostRequestBody; +import org.openapijsonschematools.client.components.schemas.AnimalFarm; +import org.openapijsonschematools.client.RootServerInfo; +import org.openapijsonschematools.client.servers.RootServer0; +import org.openapijsonschematools.client.servers.RootServer1; +import org.openapijsonschematools.client.servers.RootServer2; +import org.openapijsonschematools.client.paths.fakerefsarraymodel.post.responses.FakerefsarraymodelPostCode200Response; +import org.openapijsonschematools.client.servers.RootServerInfo; +import org.openapijsonschematools.client.apis.paths.Fakerefsarraymodel; +import org.openapijsonschematools.client.paths.fakerefsarraymodel.post.FakerefsarraymodelPostResponses; + +import java.io.IOException; +import java.util.Arrays; +import java.util.List; +import java.util.Map; +import java.util.AbstractMap; + +// if you want to use a server that is not SERVER_0 pass it in here and change the ServerIndex input below +ApiConfiguration.ServerInfo serverInfo = new ApiConfiguration.ServerInfoBuilder() + .rootServerInfo( + new RootServerInfo.RootServerInfoBuilder() + .rootServer0(new RootServer0()) + .build() + ) + .build(); +ApiConfiguration.ServerIndexInfo serverIndexInfo = new ApiConfiguration.ServerIndexInfoBuilder() + .rootServerInfoServerIndex(RootServerInfo.ServerIndex.SERVER_0) + .build(); +Duration timeout = Duration.ofSeconds(1L); +Map> defaultHeaders = Map.of("User-Agent", List.of("OpenAPI-JSON-Schema-Generator/1.0.0/java")); +ApiConfiguration apiConfiguration = new ApiConfiguration( + serverInfo + serverIndexInfo, + timeout, + defaultHeaders +); +SchemaConfiguration schemaConfiguration = new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().build()); +Fakerefsarraymodel apiClient = new Fakerefsarraymodel(apiConfiguration, schemaConfiguration); + + +var request = new FakerefsarraymodelPost.PostRequestBuilder().build(); + +FakerefsarraymodelPostResponses.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; +} +FakerefsarraymodelPostResponses.EndpointFakerefsarraymodelPostCode200Response castResponse = (FakerefsarraymodelPostResponses.EndpointFakerefsarraymodelPostCode200Response) response; +FakerefsarraymodelPostCode200Response.ApplicationjsonResponseBody deserializedBody = (FakerefsarraymodelPostCode200Response.ApplicationjsonResponseBody) castResponse.body; +// handle deserialized body here +``` +[[Back to top]](#top) [[Back to README]](../../../README.md) diff --git a/samples/client/petstore/kotlin/docs/apis/paths/Fakerefsarrayofenums.md b/samples/client/petstore/kotlin/docs/apis/paths/Fakerefsarrayofenums.md new file mode 100644 index 00000000000..c4f5e5dda18 --- /dev/null +++ b/samples/client/petstore/kotlin/docs/apis/paths/Fakerefsarrayofenums.md @@ -0,0 +1,105 @@ +# Fakerefsarrayofenums + +public class Fakerefsarrayofenums extends extends ApiClient implements +[FakerefsarrayofenumsPost.PostOperation](../../paths/fakerefsarrayofenums/FakerefsarrayofenumsPost.md#postoperation) + +an api client class which contains all the routes for path="/fake/refs/array-of-enums" + +## Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| [FakerefsarrayofenumsPostResponses.EndpointResponse](../../paths/fakerefsarrayofenums/post/FakerefsarrayofenumsPostResponses.md#endpointresponse) | [post](#post)([FakerefsarrayofenumsPost.PostRequest](../../paths/fakerefsarrayofenums/FakerefsarrayofenumsPost.md#postrequest) request) | + +## Method Detail + +### post +public [FakerefsarrayofenumsPostResponses.EndpointResponse](../../paths/fakerefsarrayofenums/post/FakerefsarrayofenumsPostResponses.md#endpointresponse) post([FakerefsarrayofenumsPost.PostRequest](../../paths/fakerefsarrayofenums/FakerefsarrayofenumsPost.md#postrequest) request) + +**Parameters:**
+request - the input request + +**Returns:**
+the deserialized response + +**Throws:**
+IOException, InterruptedException - an exception happened when making the request
+ValidationException - the returned response body or header values do not conform the the schema validation requirements
+NotImplementedException - the request body serialization or deserialization has not yet been implemented
+ or the header content type deserialization has not yet been implemented for this contentType
+ApiException - server returned a response/contentType not defined in the openapi document
+ +#### 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.FakerefsarrayofenumsPostRequestBody; +import org.openapijsonschematools.client.components.schemas.ArrayOfEnums; +import org.openapijsonschematools.client.RootServerInfo; +import org.openapijsonschematools.client.servers.RootServer0; +import org.openapijsonschematools.client.servers.RootServer1; +import org.openapijsonschematools.client.servers.RootServer2; +import org.openapijsonschematools.client.paths.fakerefsarrayofenums.post.responses.FakerefsarrayofenumsPostCode200Response; +import org.openapijsonschematools.client.servers.RootServerInfo; +import org.openapijsonschematools.client.apis.paths.Fakerefsarrayofenums; +import org.openapijsonschematools.client.paths.fakerefsarrayofenums.post.FakerefsarrayofenumsPostResponses; + +import java.io.IOException; +import java.util.Arrays; +import java.util.List; +import java.util.Map; +import java.util.AbstractMap; + +// if you want to use a server that is not SERVER_0 pass it in here and change the ServerIndex input below +ApiConfiguration.ServerInfo serverInfo = new ApiConfiguration.ServerInfoBuilder() + .rootServerInfo( + new RootServerInfo.RootServerInfoBuilder() + .rootServer0(new RootServer0()) + .build() + ) + .build(); +ApiConfiguration.ServerIndexInfo serverIndexInfo = new ApiConfiguration.ServerIndexInfoBuilder() + .rootServerInfoServerIndex(RootServerInfo.ServerIndex.SERVER_0) + .build(); +Duration timeout = Duration.ofSeconds(1L); +Map> defaultHeaders = Map.of("User-Agent", List.of("OpenAPI-JSON-Schema-Generator/1.0.0/java")); +ApiConfiguration apiConfiguration = new ApiConfiguration( + serverInfo + serverIndexInfo, + timeout, + defaultHeaders +); +SchemaConfiguration schemaConfiguration = new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().build()); +Fakerefsarrayofenums apiClient = new Fakerefsarrayofenums(apiConfiguration, schemaConfiguration); + + +var request = new FakerefsarrayofenumsPost.PostRequestBuilder().build(); + +FakerefsarrayofenumsPostResponses.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; +} +FakerefsarrayofenumsPostResponses.EndpointFakerefsarrayofenumsPostCode200Response castResponse = (FakerefsarrayofenumsPostResponses.EndpointFakerefsarrayofenumsPostCode200Response) response; +FakerefsarrayofenumsPostCode200Response.ApplicationjsonResponseBody deserializedBody = (FakerefsarrayofenumsPostCode200Response.ApplicationjsonResponseBody) castResponse.body; +// handle deserialized body here +``` +[[Back to top]](#top) [[Back to README]](../../../README.md) diff --git a/samples/client/petstore/kotlin/docs/apis/paths/Fakerefsboolean.md b/samples/client/petstore/kotlin/docs/apis/paths/Fakerefsboolean.md new file mode 100644 index 00000000000..08d970ada80 --- /dev/null +++ b/samples/client/petstore/kotlin/docs/apis/paths/Fakerefsboolean.md @@ -0,0 +1,107 @@ +# Fakerefsboolean + +public class Fakerefsboolean extends extends ApiClient implements +[FakerefsbooleanPost.PostOperation](../../paths/fakerefsboolean/FakerefsbooleanPost.md#postoperation) + +an api client class which contains all the routes for path="/fake/refs/boolean" + +## Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| [FakerefsbooleanPostResponses.EndpointResponse](../../paths/fakerefsboolean/post/FakerefsbooleanPostResponses.md#endpointresponse) | [post](#post)([FakerefsbooleanPost.PostRequest](../../paths/fakerefsboolean/FakerefsbooleanPost.md#postrequest) request)
Test serialization of outer boolean types | + +## Method Detail + +### post +public [FakerefsbooleanPostResponses.EndpointResponse](../../paths/fakerefsboolean/post/FakerefsbooleanPostResponses.md#endpointresponse) post([FakerefsbooleanPost.PostRequest](../../paths/fakerefsboolean/FakerefsbooleanPost.md#postrequest) request) + +Test serialization of outer boolean types + +**Parameters:**
+request - the input request + +**Returns:**
+the deserialized response + +**Throws:**
+IOException, InterruptedException - an exception happened when making the request
+ValidationException - the returned response body or header values do not conform the the schema validation requirements
+NotImplementedException - the request body serialization or deserialization has not yet been implemented
+ or the header content type deserialization has not yet been implemented for this contentType
+ApiException - server returned a response/contentType not defined in the openapi document
+ +#### 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.FakerefsbooleanPostRequestBody; +import org.openapijsonschematools.client.components.schemas.BooleanSchema; +import org.openapijsonschematools.client.RootServerInfo; +import org.openapijsonschematools.client.servers.RootServer0; +import org.openapijsonschematools.client.servers.RootServer1; +import org.openapijsonschematools.client.servers.RootServer2; +import org.openapijsonschematools.client.paths.fakerefsboolean.post.responses.FakerefsbooleanPostCode200Response; +import org.openapijsonschematools.client.servers.RootServerInfo; +import org.openapijsonschematools.client.apis.paths.Fakerefsboolean; +import org.openapijsonschematools.client.paths.fakerefsboolean.post.FakerefsbooleanPostResponses; + +import java.io.IOException; +import java.util.Arrays; +import java.util.List; +import java.util.Map; +import java.util.AbstractMap; + +// if you want to use a server that is not SERVER_0 pass it in here and change the ServerIndex input below +ApiConfiguration.ServerInfo serverInfo = new ApiConfiguration.ServerInfoBuilder() + .rootServerInfo( + new RootServerInfo.RootServerInfoBuilder() + .rootServer0(new RootServer0()) + .build() + ) + .build(); +ApiConfiguration.ServerIndexInfo serverIndexInfo = new ApiConfiguration.ServerIndexInfoBuilder() + .rootServerInfoServerIndex(RootServerInfo.ServerIndex.SERVER_0) + .build(); +Duration timeout = Duration.ofSeconds(1L); +Map> defaultHeaders = Map.of("User-Agent", List.of("OpenAPI-JSON-Schema-Generator/1.0.0/java")); +ApiConfiguration apiConfiguration = new ApiConfiguration( + serverInfo + serverIndexInfo, + timeout, + defaultHeaders +); +SchemaConfiguration schemaConfiguration = new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().build()); +Fakerefsboolean apiClient = new Fakerefsboolean(apiConfiguration, schemaConfiguration); + + +var request = new FakerefsbooleanPost.PostRequestBuilder().build(); + +FakerefsbooleanPostResponses.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; +} +FakerefsbooleanPostResponses.EndpointFakerefsbooleanPostCode200Response castResponse = (FakerefsbooleanPostResponses.EndpointFakerefsbooleanPostCode200Response) response; +FakerefsbooleanPostCode200Response.ApplicationjsonResponseBody deserializedBody = (FakerefsbooleanPostCode200Response.ApplicationjsonResponseBody) castResponse.body; +// handle deserialized body here +``` +[[Back to top]](#top) [[Back to README]](../../../README.md) diff --git a/samples/client/petstore/kotlin/docs/apis/paths/Fakerefscomposedoneofnumberwithvalidations.md b/samples/client/petstore/kotlin/docs/apis/paths/Fakerefscomposedoneofnumberwithvalidations.md new file mode 100644 index 00000000000..56fc7d18035 --- /dev/null +++ b/samples/client/petstore/kotlin/docs/apis/paths/Fakerefscomposedoneofnumberwithvalidations.md @@ -0,0 +1,107 @@ +# Fakerefscomposedoneofnumberwithvalidations + +public class Fakerefscomposedoneofnumberwithvalidations extends extends ApiClient implements +[FakerefscomposedoneofnumberwithvalidationsPost.PostOperation](../../paths/fakerefscomposedoneofnumberwithvalidations/FakerefscomposedoneofnumberwithvalidationsPost.md#postoperation) + +an api client class which contains all the routes for path="/fake/refs/composed_one_of_number_with_validations" + +## Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| [FakerefscomposedoneofnumberwithvalidationsPostResponses.EndpointResponse](../../paths/fakerefscomposedoneofnumberwithvalidations/post/FakerefscomposedoneofnumberwithvalidationsPostResponses.md#endpointresponse) | [post](#post)([FakerefscomposedoneofnumberwithvalidationsPost.PostRequest](../../paths/fakerefscomposedoneofnumberwithvalidations/FakerefscomposedoneofnumberwithvalidationsPost.md#postrequest) request)
Test serialization of object with $refed properties | + +## Method Detail + +### post +public [FakerefscomposedoneofnumberwithvalidationsPostResponses.EndpointResponse](../../paths/fakerefscomposedoneofnumberwithvalidations/post/FakerefscomposedoneofnumberwithvalidationsPostResponses.md#endpointresponse) post([FakerefscomposedoneofnumberwithvalidationsPost.PostRequest](../../paths/fakerefscomposedoneofnumberwithvalidations/FakerefscomposedoneofnumberwithvalidationsPost.md#postrequest) request) + +Test serialization of object with $refed properties + +**Parameters:**
+request - the input request + +**Returns:**
+the deserialized response + +**Throws:**
+IOException, InterruptedException - an exception happened when making the request
+ValidationException - the returned response body or header values do not conform the the schema validation requirements
+NotImplementedException - the request body serialization or deserialization has not yet been implemented
+ or the header content type deserialization has not yet been implemented for this contentType
+ApiException - server returned a response/contentType not defined in the openapi document
+ +#### 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.FakerefscomposedoneofnumberwithvalidationsPostRequestBody; +import org.openapijsonschematools.client.components.schemas.ComposedOneOfDifferentTypes; +import org.openapijsonschematools.client.RootServerInfo; +import org.openapijsonschematools.client.servers.RootServer0; +import org.openapijsonschematools.client.servers.RootServer1; +import org.openapijsonschematools.client.servers.RootServer2; +import org.openapijsonschematools.client.paths.fakerefscomposedoneofnumberwithvalidations.post.responses.FakerefscomposedoneofnumberwithvalidationsPostCode200Response; +import org.openapijsonschematools.client.servers.RootServerInfo; +import org.openapijsonschematools.client.apis.paths.Fakerefscomposedoneofnumberwithvalidations; +import org.openapijsonschematools.client.paths.fakerefscomposedoneofnumberwithvalidations.post.FakerefscomposedoneofnumberwithvalidationsPostResponses; + +import java.io.IOException; +import java.util.Arrays; +import java.util.List; +import java.util.Map; +import java.util.AbstractMap; + +// if you want to use a server that is not SERVER_0 pass it in here and change the ServerIndex input below +ApiConfiguration.ServerInfo serverInfo = new ApiConfiguration.ServerInfoBuilder() + .rootServerInfo( + new RootServerInfo.RootServerInfoBuilder() + .rootServer0(new RootServer0()) + .build() + ) + .build(); +ApiConfiguration.ServerIndexInfo serverIndexInfo = new ApiConfiguration.ServerIndexInfoBuilder() + .rootServerInfoServerIndex(RootServerInfo.ServerIndex.SERVER_0) + .build(); +Duration timeout = Duration.ofSeconds(1L); +Map> defaultHeaders = Map.of("User-Agent", List.of("OpenAPI-JSON-Schema-Generator/1.0.0/java")); +ApiConfiguration apiConfiguration = new ApiConfiguration( + serverInfo + serverIndexInfo, + timeout, + defaultHeaders +); +SchemaConfiguration schemaConfiguration = new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().build()); +Fakerefscomposedoneofnumberwithvalidations apiClient = new Fakerefscomposedoneofnumberwithvalidations(apiConfiguration, schemaConfiguration); + + +var request = new FakerefscomposedoneofnumberwithvalidationsPost.PostRequestBuilder().build(); + +FakerefscomposedoneofnumberwithvalidationsPostResponses.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; +} +FakerefscomposedoneofnumberwithvalidationsPostResponses.EndpointFakerefscomposedoneofnumberwithvalidationsPostCode200Response castResponse = (FakerefscomposedoneofnumberwithvalidationsPostResponses.EndpointFakerefscomposedoneofnumberwithvalidationsPostCode200Response) response; +FakerefscomposedoneofnumberwithvalidationsPostCode200Response.ApplicationjsonResponseBody deserializedBody = (FakerefscomposedoneofnumberwithvalidationsPostCode200Response.ApplicationjsonResponseBody) castResponse.body; +// handle deserialized body here +``` +[[Back to top]](#top) [[Back to README]](../../../README.md) diff --git a/samples/client/petstore/kotlin/docs/apis/paths/Fakerefsenum.md b/samples/client/petstore/kotlin/docs/apis/paths/Fakerefsenum.md new file mode 100644 index 00000000000..2b6519d22b7 --- /dev/null +++ b/samples/client/petstore/kotlin/docs/apis/paths/Fakerefsenum.md @@ -0,0 +1,107 @@ +# Fakerefsenum + +public class Fakerefsenum extends extends ApiClient implements +[FakerefsenumPost.PostOperation](../../paths/fakerefsenum/FakerefsenumPost.md#postoperation) + +an api client class which contains all the routes for path="/fake/refs/enum" + +## Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| [FakerefsenumPostResponses.EndpointResponse](../../paths/fakerefsenum/post/FakerefsenumPostResponses.md#endpointresponse) | [post](#post)([FakerefsenumPost.PostRequest](../../paths/fakerefsenum/FakerefsenumPost.md#postrequest) request)
Test serialization of outer enum | + +## Method Detail + +### post +public [FakerefsenumPostResponses.EndpointResponse](../../paths/fakerefsenum/post/FakerefsenumPostResponses.md#endpointresponse) post([FakerefsenumPost.PostRequest](../../paths/fakerefsenum/FakerefsenumPost.md#postrequest) request) + +Test serialization of outer enum + +**Parameters:**
+request - the input request + +**Returns:**
+the deserialized response + +**Throws:**
+IOException, InterruptedException - an exception happened when making the request
+ValidationException - the returned response body or header values do not conform the the schema validation requirements
+NotImplementedException - the request body serialization or deserialization has not yet been implemented
+ or the header content type deserialization has not yet been implemented for this contentType
+ApiException - server returned a response/contentType not defined in the openapi document
+ +#### 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.FakerefsenumPostRequestBody; +import org.openapijsonschematools.client.components.schemas.StringEnum; +import org.openapijsonschematools.client.RootServerInfo; +import org.openapijsonschematools.client.servers.RootServer0; +import org.openapijsonschematools.client.servers.RootServer1; +import org.openapijsonschematools.client.servers.RootServer2; +import org.openapijsonschematools.client.paths.fakerefsenum.post.responses.FakerefsenumPostCode200Response; +import org.openapijsonschematools.client.servers.RootServerInfo; +import org.openapijsonschematools.client.apis.paths.Fakerefsenum; +import org.openapijsonschematools.client.paths.fakerefsenum.post.FakerefsenumPostResponses; + +import java.io.IOException; +import java.util.Arrays; +import java.util.List; +import java.util.Map; +import java.util.AbstractMap; + +// if you want to use a server that is not SERVER_0 pass it in here and change the ServerIndex input below +ApiConfiguration.ServerInfo serverInfo = new ApiConfiguration.ServerInfoBuilder() + .rootServerInfo( + new RootServerInfo.RootServerInfoBuilder() + .rootServer0(new RootServer0()) + .build() + ) + .build(); +ApiConfiguration.ServerIndexInfo serverIndexInfo = new ApiConfiguration.ServerIndexInfoBuilder() + .rootServerInfoServerIndex(RootServerInfo.ServerIndex.SERVER_0) + .build(); +Duration timeout = Duration.ofSeconds(1L); +Map> defaultHeaders = Map.of("User-Agent", List.of("OpenAPI-JSON-Schema-Generator/1.0.0/java")); +ApiConfiguration apiConfiguration = new ApiConfiguration( + serverInfo + serverIndexInfo, + timeout, + defaultHeaders +); +SchemaConfiguration schemaConfiguration = new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().build()); +Fakerefsenum apiClient = new Fakerefsenum(apiConfiguration, schemaConfiguration); + + +var request = new FakerefsenumPost.PostRequestBuilder().build(); + +FakerefsenumPostResponses.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; +} +FakerefsenumPostResponses.EndpointFakerefsenumPostCode200Response castResponse = (FakerefsenumPostResponses.EndpointFakerefsenumPostCode200Response) response; +FakerefsenumPostCode200Response.ApplicationjsonResponseBody deserializedBody = (FakerefsenumPostCode200Response.ApplicationjsonResponseBody) castResponse.body; +// handle deserialized body here +``` +[[Back to top]](#top) [[Back to README]](../../../README.md) diff --git a/samples/client/petstore/kotlin/docs/apis/paths/Fakerefsmammal.md b/samples/client/petstore/kotlin/docs/apis/paths/Fakerefsmammal.md new file mode 100644 index 00000000000..5c5dbc63e7c --- /dev/null +++ b/samples/client/petstore/kotlin/docs/apis/paths/Fakerefsmammal.md @@ -0,0 +1,110 @@ +# Fakerefsmammal + +public class Fakerefsmammal extends extends ApiClient implements +[FakerefsmammalPost.PostOperation](../../paths/fakerefsmammal/FakerefsmammalPost.md#postoperation) + +an api client class which contains all the routes for path="/fake/refs/mammal" + +## Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| [FakerefsmammalPostResponses.EndpointResponse](../../paths/fakerefsmammal/post/FakerefsmammalPostResponses.md#endpointresponse) | [post](#post)([FakerefsmammalPost.PostRequest](../../paths/fakerefsmammal/FakerefsmammalPost.md#postrequest) request)
Test serialization of mammals | + +## Method Detail + +### post +public [FakerefsmammalPostResponses.EndpointResponse](../../paths/fakerefsmammal/post/FakerefsmammalPostResponses.md#endpointresponse) post([FakerefsmammalPost.PostRequest](../../paths/fakerefsmammal/FakerefsmammalPost.md#postrequest) request) + +Test serialization of mammals + +**Parameters:**
+request - the input request + +**Returns:**
+the deserialized response + +**Throws:**
+IOException, InterruptedException - an exception happened when making the request
+ValidationException - the returned response body or header values do not conform the the schema validation requirements
+NotImplementedException - the request body serialization or deserialization has not yet been implemented
+ or the header content type deserialization has not yet been implemented for this contentType
+ApiException - server returned a response/contentType not defined in the openapi document
+ +#### 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.FakerefsmammalPostRequestBody; +import org.openapijsonschematools.client.components.schemas.Mammal; +import org.openapijsonschematools.client.servers.RootServer0; +import org.openapijsonschematools.client.servers.RootServer1; +import org.openapijsonschematools.client.servers.RootServer2; +import org.openapijsonschematools.client.paths.fakerefsmammal.post.responses.FakerefsmammalPostCode200Response; +import org.openapijsonschematools.client.servers.RootServerInfo; +import org.openapijsonschematools.client.apis.paths.Fakerefsmammal; +import org.openapijsonschematools.client.paths.fakerefsmammal.post.FakerefsmammalPostResponses; + +import java.io.IOException; +import java.util.Arrays; +import java.util.List; +import java.util.Map; +import java.util.AbstractMap; + +// if you want to use a server that is not SERVER_0 pass it in here and change the ServerIndex input below +ApiConfiguration.ServerInfo serverInfo = new ApiConfiguration.ServerInfoBuilder() + .rootServerInfo( + new RootServerInfo.RootServerInfoBuilder() + .rootServer0(new RootServer0()) + .build() + ) + .build(); +ApiConfiguration.ServerIndexInfo serverIndexInfo = new ApiConfiguration.ServerIndexInfoBuilder() + .rootServerInfoServerIndex(RootServerInfo.ServerIndex.SERVER_0) + .build(); +Duration timeout = Duration.ofSeconds(1L); +Map> defaultHeaders = Map.of("User-Agent", List.of("OpenAPI-JSON-Schema-Generator/1.0.0/java")); +ApiConfiguration apiConfiguration = new ApiConfiguration( + serverInfo + serverIndexInfo, + timeout, + defaultHeaders +); +SchemaConfiguration schemaConfiguration = new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().build()); +Fakerefsmammal apiClient = new Fakerefsmammal(apiConfiguration, schemaConfiguration); + +FakerefsmammalPost.SealedRequestBody requestBody = new FakerefsmammalPost.ApplicationjsonRequestBody(requestBodyPayload); + +var request = new FakerefsmammalPost.PostRequestBuilder() + .requestBody(requestBody) + .build(); + +FakerefsmammalPostResponses.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; +} +FakerefsmammalPostResponses.EndpointFakerefsmammalPostCode200Response castResponse = (FakerefsmammalPostResponses.EndpointFakerefsmammalPostCode200Response) response; +FakerefsmammalPostCode200Response.ApplicationjsonResponseBody deserializedBody = (FakerefsmammalPostCode200Response.ApplicationjsonResponseBody) castResponse.body; +// handle deserialized body here +``` +[[Back to top]](#top) [[Back to README]](../../../README.md) diff --git a/samples/client/petstore/kotlin/docs/apis/paths/Fakerefsnumber.md b/samples/client/petstore/kotlin/docs/apis/paths/Fakerefsnumber.md new file mode 100644 index 00000000000..c3269287ddb --- /dev/null +++ b/samples/client/petstore/kotlin/docs/apis/paths/Fakerefsnumber.md @@ -0,0 +1,107 @@ +# Fakerefsnumber + +public class Fakerefsnumber extends extends ApiClient implements +[FakerefsnumberPost.PostOperation](../../paths/fakerefsnumber/FakerefsnumberPost.md#postoperation) + +an api client class which contains all the routes for path="/fake/refs/number" + +## Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| [FakerefsnumberPostResponses.EndpointResponse](../../paths/fakerefsnumber/post/FakerefsnumberPostResponses.md#endpointresponse) | [post](#post)([FakerefsnumberPost.PostRequest](../../paths/fakerefsnumber/FakerefsnumberPost.md#postrequest) request)
Test serialization of outer number types | + +## Method Detail + +### post +public [FakerefsnumberPostResponses.EndpointResponse](../../paths/fakerefsnumber/post/FakerefsnumberPostResponses.md#endpointresponse) post([FakerefsnumberPost.PostRequest](../../paths/fakerefsnumber/FakerefsnumberPost.md#postrequest) request) + +Test serialization of outer number types + +**Parameters:**
+request - the input request + +**Returns:**
+the deserialized response + +**Throws:**
+IOException, InterruptedException - an exception happened when making the request
+ValidationException - the returned response body or header values do not conform the the schema validation requirements
+NotImplementedException - the request body serialization or deserialization has not yet been implemented
+ or the header content type deserialization has not yet been implemented for this contentType
+ApiException - server returned a response/contentType not defined in the openapi document
+ +#### 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.FakerefsnumberPostRequestBody; +import org.openapijsonschematools.client.components.schemas.NumberWithValidations; +import org.openapijsonschematools.client.RootServerInfo; +import org.openapijsonschematools.client.servers.RootServer0; +import org.openapijsonschematools.client.servers.RootServer1; +import org.openapijsonschematools.client.servers.RootServer2; +import org.openapijsonschematools.client.paths.fakerefsnumber.post.responses.FakerefsnumberPostCode200Response; +import org.openapijsonschematools.client.servers.RootServerInfo; +import org.openapijsonschematools.client.apis.paths.Fakerefsnumber; +import org.openapijsonschematools.client.paths.fakerefsnumber.post.FakerefsnumberPostResponses; + +import java.io.IOException; +import java.util.Arrays; +import java.util.List; +import java.util.Map; +import java.util.AbstractMap; + +// if you want to use a server that is not SERVER_0 pass it in here and change the ServerIndex input below +ApiConfiguration.ServerInfo serverInfo = new ApiConfiguration.ServerInfoBuilder() + .rootServerInfo( + new RootServerInfo.RootServerInfoBuilder() + .rootServer0(new RootServer0()) + .build() + ) + .build(); +ApiConfiguration.ServerIndexInfo serverIndexInfo = new ApiConfiguration.ServerIndexInfoBuilder() + .rootServerInfoServerIndex(RootServerInfo.ServerIndex.SERVER_0) + .build(); +Duration timeout = Duration.ofSeconds(1L); +Map> defaultHeaders = Map.of("User-Agent", List.of("OpenAPI-JSON-Schema-Generator/1.0.0/java")); +ApiConfiguration apiConfiguration = new ApiConfiguration( + serverInfo + serverIndexInfo, + timeout, + defaultHeaders +); +SchemaConfiguration schemaConfiguration = new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().build()); +Fakerefsnumber apiClient = new Fakerefsnumber(apiConfiguration, schemaConfiguration); + + +var request = new FakerefsnumberPost.PostRequestBuilder().build(); + +FakerefsnumberPostResponses.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; +} +FakerefsnumberPostResponses.EndpointFakerefsnumberPostCode200Response castResponse = (FakerefsnumberPostResponses.EndpointFakerefsnumberPostCode200Response) response; +FakerefsnumberPostCode200Response.ApplicationjsonResponseBody deserializedBody = (FakerefsnumberPostCode200Response.ApplicationjsonResponseBody) castResponse.body; +// handle deserialized body here +``` +[[Back to top]](#top) [[Back to README]](../../../README.md) diff --git a/samples/client/petstore/kotlin/docs/apis/paths/Fakerefsobjectmodelwithrefprops.md b/samples/client/petstore/kotlin/docs/apis/paths/Fakerefsobjectmodelwithrefprops.md new file mode 100644 index 00000000000..fc8472f4837 --- /dev/null +++ b/samples/client/petstore/kotlin/docs/apis/paths/Fakerefsobjectmodelwithrefprops.md @@ -0,0 +1,107 @@ +# Fakerefsobjectmodelwithrefprops + +public class Fakerefsobjectmodelwithrefprops extends extends ApiClient implements +[FakerefsobjectmodelwithrefpropsPost.PostOperation](../../paths/fakerefsobjectmodelwithrefprops/FakerefsobjectmodelwithrefpropsPost.md#postoperation) + +an api client class which contains all the routes for path="/fake/refs/object_model_with_ref_props" + +## Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| [FakerefsobjectmodelwithrefpropsPostResponses.EndpointResponse](../../paths/fakerefsobjectmodelwithrefprops/post/FakerefsobjectmodelwithrefpropsPostResponses.md#endpointresponse) | [post](#post)([FakerefsobjectmodelwithrefpropsPost.PostRequest](../../paths/fakerefsobjectmodelwithrefprops/FakerefsobjectmodelwithrefpropsPost.md#postrequest) request)
Test serialization of object with $refed properties | + +## Method Detail + +### post +public [FakerefsobjectmodelwithrefpropsPostResponses.EndpointResponse](../../paths/fakerefsobjectmodelwithrefprops/post/FakerefsobjectmodelwithrefpropsPostResponses.md#endpointresponse) post([FakerefsobjectmodelwithrefpropsPost.PostRequest](../../paths/fakerefsobjectmodelwithrefprops/FakerefsobjectmodelwithrefpropsPost.md#postrequest) request) + +Test serialization of object with $refed properties + +**Parameters:**
+request - the input request + +**Returns:**
+the deserialized response + +**Throws:**
+IOException, InterruptedException - an exception happened when making the request
+ValidationException - the returned response body or header values do not conform the the schema validation requirements
+NotImplementedException - the request body serialization or deserialization has not yet been implemented
+ or the header content type deserialization has not yet been implemented for this contentType
+ApiException - server returned a response/contentType not defined in the openapi document
+ +#### 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.FakerefsobjectmodelwithrefpropsPostRequestBody; +import org.openapijsonschematools.client.components.schemas.ObjectModelWithRefProps; +import org.openapijsonschematools.client.RootServerInfo; +import org.openapijsonschematools.client.servers.RootServer0; +import org.openapijsonschematools.client.servers.RootServer1; +import org.openapijsonschematools.client.servers.RootServer2; +import org.openapijsonschematools.client.paths.fakerefsobjectmodelwithrefprops.post.responses.FakerefsobjectmodelwithrefpropsPostCode200Response; +import org.openapijsonschematools.client.servers.RootServerInfo; +import org.openapijsonschematools.client.apis.paths.Fakerefsobjectmodelwithrefprops; +import org.openapijsonschematools.client.paths.fakerefsobjectmodelwithrefprops.post.FakerefsobjectmodelwithrefpropsPostResponses; + +import java.io.IOException; +import java.util.Arrays; +import java.util.List; +import java.util.Map; +import java.util.AbstractMap; + +// if you want to use a server that is not SERVER_0 pass it in here and change the ServerIndex input below +ApiConfiguration.ServerInfo serverInfo = new ApiConfiguration.ServerInfoBuilder() + .rootServerInfo( + new RootServerInfo.RootServerInfoBuilder() + .rootServer0(new RootServer0()) + .build() + ) + .build(); +ApiConfiguration.ServerIndexInfo serverIndexInfo = new ApiConfiguration.ServerIndexInfoBuilder() + .rootServerInfoServerIndex(RootServerInfo.ServerIndex.SERVER_0) + .build(); +Duration timeout = Duration.ofSeconds(1L); +Map> defaultHeaders = Map.of("User-Agent", List.of("OpenAPI-JSON-Schema-Generator/1.0.0/java")); +ApiConfiguration apiConfiguration = new ApiConfiguration( + serverInfo + serverIndexInfo, + timeout, + defaultHeaders +); +SchemaConfiguration schemaConfiguration = new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().build()); +Fakerefsobjectmodelwithrefprops apiClient = new Fakerefsobjectmodelwithrefprops(apiConfiguration, schemaConfiguration); + + +var request = new FakerefsobjectmodelwithrefpropsPost.PostRequestBuilder().build(); + +FakerefsobjectmodelwithrefpropsPostResponses.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; +} +FakerefsobjectmodelwithrefpropsPostResponses.EndpointFakerefsobjectmodelwithrefpropsPostCode200Response castResponse = (FakerefsobjectmodelwithrefpropsPostResponses.EndpointFakerefsobjectmodelwithrefpropsPostCode200Response) response; +FakerefsobjectmodelwithrefpropsPostCode200Response.ApplicationjsonResponseBody deserializedBody = (FakerefsobjectmodelwithrefpropsPostCode200Response.ApplicationjsonResponseBody) castResponse.body; +// handle deserialized body here +``` +[[Back to top]](#top) [[Back to README]](../../../README.md) diff --git a/samples/client/petstore/kotlin/docs/apis/paths/Fakerefsstring.md b/samples/client/petstore/kotlin/docs/apis/paths/Fakerefsstring.md new file mode 100644 index 00000000000..c7875ab8678 --- /dev/null +++ b/samples/client/petstore/kotlin/docs/apis/paths/Fakerefsstring.md @@ -0,0 +1,107 @@ +# Fakerefsstring + +public class Fakerefsstring extends extends ApiClient implements +[FakerefsstringPost.PostOperation](../../paths/fakerefsstring/FakerefsstringPost.md#postoperation) + +an api client class which contains all the routes for path="/fake/refs/string" + +## Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| [FakerefsstringPostResponses.EndpointResponse](../../paths/fakerefsstring/post/FakerefsstringPostResponses.md#endpointresponse) | [post](#post)([FakerefsstringPost.PostRequest](../../paths/fakerefsstring/FakerefsstringPost.md#postrequest) request)
Test serialization of outer string types | + +## Method Detail + +### post +public [FakerefsstringPostResponses.EndpointResponse](../../paths/fakerefsstring/post/FakerefsstringPostResponses.md#endpointresponse) post([FakerefsstringPost.PostRequest](../../paths/fakerefsstring/FakerefsstringPost.md#postrequest) request) + +Test serialization of outer string types + +**Parameters:**
+request - the input request + +**Returns:**
+the deserialized response + +**Throws:**
+IOException, InterruptedException - an exception happened when making the request
+ValidationException - the returned response body or header values do not conform the the schema validation requirements
+NotImplementedException - the request body serialization or deserialization has not yet been implemented
+ or the header content type deserialization has not yet been implemented for this contentType
+ApiException - server returned a response/contentType not defined in the openapi document
+ +#### 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.FakerefsstringPostRequestBody; +import org.openapijsonschematools.client.components.schemas.StringSchema; +import org.openapijsonschematools.client.RootServerInfo; +import org.openapijsonschematools.client.servers.RootServer0; +import org.openapijsonschematools.client.servers.RootServer1; +import org.openapijsonschematools.client.servers.RootServer2; +import org.openapijsonschematools.client.paths.fakerefsstring.post.responses.FakerefsstringPostCode200Response; +import org.openapijsonschematools.client.servers.RootServerInfo; +import org.openapijsonschematools.client.apis.paths.Fakerefsstring; +import org.openapijsonschematools.client.paths.fakerefsstring.post.FakerefsstringPostResponses; + +import java.io.IOException; +import java.util.Arrays; +import java.util.List; +import java.util.Map; +import java.util.AbstractMap; + +// if you want to use a server that is not SERVER_0 pass it in here and change the ServerIndex input below +ApiConfiguration.ServerInfo serverInfo = new ApiConfiguration.ServerInfoBuilder() + .rootServerInfo( + new RootServerInfo.RootServerInfoBuilder() + .rootServer0(new RootServer0()) + .build() + ) + .build(); +ApiConfiguration.ServerIndexInfo serverIndexInfo = new ApiConfiguration.ServerIndexInfoBuilder() + .rootServerInfoServerIndex(RootServerInfo.ServerIndex.SERVER_0) + .build(); +Duration timeout = Duration.ofSeconds(1L); +Map> defaultHeaders = Map.of("User-Agent", List.of("OpenAPI-JSON-Schema-Generator/1.0.0/java")); +ApiConfiguration apiConfiguration = new ApiConfiguration( + serverInfo + serverIndexInfo, + timeout, + defaultHeaders +); +SchemaConfiguration schemaConfiguration = new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().build()); +Fakerefsstring apiClient = new Fakerefsstring(apiConfiguration, schemaConfiguration); + + +var request = new FakerefsstringPost.PostRequestBuilder().build(); + +FakerefsstringPostResponses.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; +} +FakerefsstringPostResponses.EndpointFakerefsstringPostCode200Response castResponse = (FakerefsstringPostResponses.EndpointFakerefsstringPostCode200Response) response; +FakerefsstringPostCode200Response.ApplicationjsonResponseBody deserializedBody = (FakerefsstringPostCode200Response.ApplicationjsonResponseBody) castResponse.body; +// handle deserialized body here +``` +[[Back to top]](#top) [[Back to README]](../../../README.md) diff --git a/samples/client/petstore/kotlin/docs/apis/paths/Fakeresponsewithoutschema.md b/samples/client/petstore/kotlin/docs/apis/paths/Fakeresponsewithoutschema.md new file mode 100644 index 00000000000..c2d5cfb56bc --- /dev/null +++ b/samples/client/petstore/kotlin/docs/apis/paths/Fakeresponsewithoutschema.md @@ -0,0 +1,101 @@ +# Fakeresponsewithoutschema + +public class Fakeresponsewithoutschema extends extends ApiClient implements +[FakeresponsewithoutschemaGet.GetOperation](../../paths/fakeresponsewithoutschema/FakeresponsewithoutschemaGet.md#getoperation) + +an api client class which contains all the routes for path="/fake/responseWithoutSchema" + +## Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| [FakeresponsewithoutschemaGetResponses.EndpointResponse](../../paths/fakeresponsewithoutschema/get/FakeresponsewithoutschemaGetResponses.md#endpointresponse) | [get](#get)([FakeresponsewithoutschemaGet.GetRequest](../../paths/fakeresponsewithoutschema/FakeresponsewithoutschemaGet.md#getrequest) request) | + +## Method Detail + +### get +public [FakeresponsewithoutschemaGetResponses.EndpointResponse](../../paths/fakeresponsewithoutschema/get/FakeresponsewithoutschemaGetResponses.md#endpointresponse) get([FakeresponsewithoutschemaGet.GetRequest](../../paths/fakeresponsewithoutschema/FakeresponsewithoutschemaGet.md#getrequest) request) + +**Parameters:**
+request - the input request + +**Returns:**
+the deserialized response + +**Throws:**
+IOException, InterruptedException - an exception happened when making the request
+ValidationException - the returned response body or header values do not conform the the schema validation requirements
+NotImplementedException - the request body serialization or deserialization has not yet been implemented
+ or the header content type deserialization has not yet been implemented for this contentType
+ApiException - server returned a response/contentType not defined in the openapi document
+ +#### 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.servers.RootServer0; +import org.openapijsonschematools.client.servers.RootServer1; +import org.openapijsonschematools.client.servers.RootServer2; +import org.openapijsonschematools.client.paths.fakeresponsewithoutschema.get.responses.FakeresponsewithoutschemaGetCode200Response; +import org.openapijsonschematools.client.servers.RootServerInfo; +import org.openapijsonschematools.client.apis.paths.Fakeresponsewithoutschema; +import org.openapijsonschematools.client.paths.fakeresponsewithoutschema.get.FakeresponsewithoutschemaGetResponses; + +import java.io.IOException; +import java.util.Arrays; +import java.util.List; +import java.util.Map; +import java.util.AbstractMap; + +// if you want to use a server that is not SERVER_0 pass it in here and change the ServerIndex input below +ApiConfiguration.ServerInfo serverInfo = new ApiConfiguration.ServerInfoBuilder() + .rootServerInfo( + new RootServerInfo.RootServerInfoBuilder() + .rootServer0(new RootServer0()) + .build() + ) + .build(); +ApiConfiguration.ServerIndexInfo serverIndexInfo = new ApiConfiguration.ServerIndexInfoBuilder() + .rootServerInfoServerIndex(RootServerInfo.ServerIndex.SERVER_0) + .build(); +Duration timeout = Duration.ofSeconds(1L); +Map> defaultHeaders = Map.of("User-Agent", List.of("OpenAPI-JSON-Schema-Generator/1.0.0/java")); +ApiConfiguration apiConfiguration = new ApiConfiguration( + serverInfo + serverIndexInfo, + timeout, + defaultHeaders +); +SchemaConfiguration schemaConfiguration = new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().build()); +Fakeresponsewithoutschema apiClient = new Fakeresponsewithoutschema(apiConfiguration, schemaConfiguration); + + +var request = new FakeresponsewithoutschemaGet.GetRequestBuilder().build(); + +FakeresponsewithoutschemaGetResponses.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; +} +FakeresponsewithoutschemaGetResponses.EndpointFakeresponsewithoutschemaGetCode200Response castResponse = (FakeresponsewithoutschemaGetResponses.EndpointFakeresponsewithoutschemaGetCode200Response) response; +``` +[[Back to top]](#top) [[Back to README]](../../../README.md) diff --git a/samples/client/petstore/kotlin/docs/apis/paths/Faketestqueryparamters.md b/samples/client/petstore/kotlin/docs/apis/paths/Faketestqueryparamters.md new file mode 100644 index 00000000000..bf56283e144 --- /dev/null +++ b/samples/client/petstore/kotlin/docs/apis/paths/Faketestqueryparamters.md @@ -0,0 +1,141 @@ +# Faketestqueryparamters + +public class Faketestqueryparamters extends extends ApiClient implements +[FaketestqueryparamtersPut.PutOperation](../../paths/faketestqueryparamters/FaketestqueryparamtersPut.md#putoperation) + +an api client class which contains all the routes for path="/fake/test-query-paramters" + +## Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| [FaketestqueryparamtersPutResponses.EndpointResponse](../../paths/faketestqueryparamters/put/FaketestqueryparamtersPutResponses.md#endpointresponse) | [put](#put)([FaketestqueryparamtersPut.PutRequest](../../paths/faketestqueryparamters/FaketestqueryparamtersPut.md#putrequest) request)
To test the collection format in query parameters | + +## Method Detail + +### put +public [FaketestqueryparamtersPutResponses.EndpointResponse](../../paths/faketestqueryparamters/put/FaketestqueryparamtersPutResponses.md#endpointresponse) put([FaketestqueryparamtersPut.PutRequest](../../paths/faketestqueryparamters/FaketestqueryparamtersPut.md#putrequest) request) + +To test the collection format in query parameters + +**Parameters:**
+request - the input request + +**Returns:**
+the deserialized response + +**Throws:**
+IOException, InterruptedException - an exception happened when making the request
+ValidationException - the returned response body or header values do not conform the the schema validation requirements
+NotImplementedException - the request body serialization or deserialization has not yet been implemented
+ or the header content type deserialization has not yet been implemented for this contentType
+ApiException - server returned a response/contentType not defined in the openapi document
+ +#### 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.faketestqueryparamters.put.FaketestqueryparamtersPutQueryParameters; +import org.openapijsonschematools.client.servers.RootServer0; +import org.openapijsonschematools.client.servers.RootServer1; +import org.openapijsonschematools.client.servers.RootServer2; +import org.openapijsonschematools.client.paths.faketestqueryparamters.put.responses.FaketestqueryparamtersPutCode200Response; +import org.openapijsonschematools.client.servers.RootServerInfo; +import org.openapijsonschematools.client.apis.paths.Faketestqueryparamters; +import org.openapijsonschematools.client.paths.faketestqueryparamters.put.FaketestqueryparamtersPutResponses; + +import java.io.IOException; +import java.util.Arrays; +import java.util.List; +import java.util.Map; +import java.util.AbstractMap; + +// if you want to use a server that is not SERVER_0 pass it in here and change the ServerIndex input below +ApiConfiguration.ServerInfo serverInfo = new ApiConfiguration.ServerInfoBuilder() + .rootServerInfo( + new RootServerInfo.RootServerInfoBuilder() + .rootServer0(new RootServer0()) + .build() + ) + .build(); +ApiConfiguration.ServerIndexInfo serverIndexInfo = new ApiConfiguration.ServerIndexInfoBuilder() + .rootServerInfoServerIndex(RootServerInfo.ServerIndex.SERVER_0) + .build(); +Duration timeout = Duration.ofSeconds(1L); +Map> defaultHeaders = Map.of("User-Agent", List.of("OpenAPI-JSON-Schema-Generator/1.0.0/java")); +ApiConfiguration apiConfiguration = new ApiConfiguration( + serverInfo + serverIndexInfo, + timeout, + defaultHeaders +); +SchemaConfiguration schemaConfiguration = new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().build()); +Faketestqueryparamters apiClient = new Faketestqueryparamters(apiConfiguration, schemaConfiguration); + + +// Map validation +FaketestqueryparamtersPutQueryParameters.QueryParametersMap queryParameters = + FaketestqueryparamtersPutQueryParameters.FaketestqueryparamtersPutQueryParameters1.validate( + new FaketestqueryparamtersPutQueryParameters.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 +); + +var request = new FaketestqueryparamtersPut.PutRequestBuilder() + .queryParameters(queryParameters) + .build(); + +FaketestqueryparamtersPutResponses.EndpointResponse response; +try { + response = apiClient.put(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; +} +FaketestqueryparamtersPutResponses.EndpointFaketestqueryparamtersPutCode200Response castResponse = (FaketestqueryparamtersPutResponses.EndpointFaketestqueryparamtersPutCode200Response) response; +``` +[[Back to top]](#top) [[Back to README]](../../../README.md) diff --git a/samples/client/petstore/kotlin/docs/apis/paths/Fakeuploaddownloadfile.md b/samples/client/petstore/kotlin/docs/apis/paths/Fakeuploaddownloadfile.md new file mode 100644 index 00000000000..edb77f20fa0 --- /dev/null +++ b/samples/client/petstore/kotlin/docs/apis/paths/Fakeuploaddownloadfile.md @@ -0,0 +1,115 @@ +# Fakeuploaddownloadfile + +public class Fakeuploaddownloadfile extends extends ApiClient implements +[FakeuploaddownloadfilePost.PostOperation](../../paths/fakeuploaddownloadfile/FakeuploaddownloadfilePost.md#postoperation) + +an api client class which contains all the routes for path="/fake/uploadDownloadFile" + +## Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| [FakeuploaddownloadfilePostResponses.EndpointResponse](../../paths/fakeuploaddownloadfile/post/FakeuploaddownloadfilePostResponses.md#endpointresponse) | [post](#post)([FakeuploaddownloadfilePost.PostRequest](../../paths/fakeuploaddownloadfile/FakeuploaddownloadfilePost.md#postrequest) request)
| + +## Method Detail + +### post +public [FakeuploaddownloadfilePostResponses.EndpointResponse](../../paths/fakeuploaddownloadfile/post/FakeuploaddownloadfilePostResponses.md#endpointresponse) post([FakeuploaddownloadfilePost.PostRequest](../../paths/fakeuploaddownloadfile/FakeuploaddownloadfilePost.md#postrequest) request) + + + +**Parameters:**
+request - the input request + +**Returns:**
+the deserialized response + +**Throws:**
+IOException, InterruptedException - an exception happened when making the request
+ValidationException - the returned response body or header values do not conform the the schema validation requirements
+NotImplementedException - the request body serialization or deserialization has not yet been implemented
+ or the header content type deserialization has not yet been implemented for this contentType
+ApiException - server returned a response/contentType not defined in the openapi document
+ +#### 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.fakeuploaddownloadfile.post.FakeuploaddownloadfilePostRequestBody; +import org.openapijsonschematools.client.paths.fakeuploaddownloadfile.post.requestbody.content.applicationoctetstream.ApplicationoctetstreamSchema; +import org.openapijsonschematools.client.servers.RootServer0; +import org.openapijsonschematools.client.servers.RootServer1; +import org.openapijsonschematools.client.servers.RootServer2; +import org.openapijsonschematools.client.paths.fakeuploaddownloadfile.post.responses.FakeuploaddownloadfilePostCode200Response; +import org.openapijsonschematools.client.servers.RootServerInfo; +import org.openapijsonschematools.client.apis.paths.Fakeuploaddownloadfile; +import org.openapijsonschematools.client.paths.fakeuploaddownloadfile.post.FakeuploaddownloadfilePostResponses; + +import java.io.IOException; +import java.util.Arrays; +import java.util.List; +import java.util.Map; +import java.util.AbstractMap; + +// if you want to use a server that is not SERVER_0 pass it in here and change the ServerIndex input below +ApiConfiguration.ServerInfo serverInfo = new ApiConfiguration.ServerInfoBuilder() + .rootServerInfo( + new RootServerInfo.RootServerInfoBuilder() + .rootServer0(new RootServer0()) + .build() + ) + .build(); +ApiConfiguration.ServerIndexInfo serverIndexInfo = new ApiConfiguration.ServerIndexInfoBuilder() + .rootServerInfoServerIndex(RootServerInfo.ServerIndex.SERVER_0) + .build(); +Duration timeout = Duration.ofSeconds(1L); +Map> defaultHeaders = Map.of("User-Agent", List.of("OpenAPI-JSON-Schema-Generator/1.0.0/java")); +ApiConfiguration apiConfiguration = new ApiConfiguration( + serverInfo + serverIndexInfo, + timeout, + defaultHeaders +); +SchemaConfiguration schemaConfiguration = new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().build()); +Fakeuploaddownloadfile apiClient = new Fakeuploaddownloadfile(apiConfiguration, schemaConfiguration); + + +ApplicationoctetstreamSchema1BoxedString requestBodyPayload = ApplicationoctetstreamSchema.ApplicationoctetstreamSchema1.validateAndBox( + "a", + schemaConfiguration +); +FakeuploaddownloadfilePost.SealedRequestBody requestBody = new FakeuploaddownloadfilePost.ApplicationoctetstreamRequestBody(requestBodyPayload); + +var request = new FakeuploaddownloadfilePost.PostRequestBuilder() + .requestBody(requestBody) + .build(); + +FakeuploaddownloadfilePostResponses.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; +} +FakeuploaddownloadfilePostResponses.EndpointFakeuploaddownloadfilePostCode200Response castResponse = (FakeuploaddownloadfilePostResponses.EndpointFakeuploaddownloadfilePostCode200Response) response; +FakeuploaddownloadfilePostCode200Response.ApplicationoctetstreamResponseBody deserializedBody = (FakeuploaddownloadfilePostCode200Response.ApplicationoctetstreamResponseBody) castResponse.body; +// handle deserialized body here +``` +[[Back to top]](#top) [[Back to README]](../../../README.md) diff --git a/samples/client/petstore/kotlin/docs/apis/paths/Fakeuploadfile.md b/samples/client/petstore/kotlin/docs/apis/paths/Fakeuploadfile.md new file mode 100644 index 00000000000..4df05ea0937 --- /dev/null +++ b/samples/client/petstore/kotlin/docs/apis/paths/Fakeuploadfile.md @@ -0,0 +1,107 @@ +# Fakeuploadfile + +public class Fakeuploadfile extends extends ApiClient implements +[FakeuploadfilePost.PostOperation](../../paths/fakeuploadfile/FakeuploadfilePost.md#postoperation) + +an api client class which contains all the routes for path="/fake/uploadFile" + +## Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| [FakeuploadfilePostResponses.EndpointResponse](../../paths/fakeuploadfile/post/FakeuploadfilePostResponses.md#endpointresponse) | [post](#post)([FakeuploadfilePost.PostRequest](../../paths/fakeuploadfile/FakeuploadfilePost.md#postrequest) request)
| + +## Method Detail + +### post +public [FakeuploadfilePostResponses.EndpointResponse](../../paths/fakeuploadfile/post/FakeuploadfilePostResponses.md#endpointresponse) post([FakeuploadfilePost.PostRequest](../../paths/fakeuploadfile/FakeuploadfilePost.md#postrequest) request) + + + +**Parameters:**
+request - the input request + +**Returns:**
+the deserialized response + +**Throws:**
+IOException, InterruptedException - an exception happened when making the request
+ValidationException - the returned response body or header values do not conform the the schema validation requirements
+NotImplementedException - the request body serialization or deserialization has not yet been implemented
+ or the header content type deserialization has not yet been implemented for this contentType
+ApiException - server returned a response/contentType not defined in the openapi document
+ +#### 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.FakeuploadfilePostRequestBody; +import org.openapijsonschematools.client.paths.fakeuploadfile.post.requestbody.content.multipartformdata.MultipartformdataSchema; +import org.openapijsonschematools.client.RootServerInfo; +import org.openapijsonschematools.client.servers.RootServer0; +import org.openapijsonschematools.client.servers.RootServer1; +import org.openapijsonschematools.client.servers.RootServer2; +import org.openapijsonschematools.client.paths.fakeuploadfile.post.responses.FakeuploadfilePostCode200Response; +import org.openapijsonschematools.client.servers.RootServerInfo; +import org.openapijsonschematools.client.apis.paths.Fakeuploadfile; +import org.openapijsonschematools.client.paths.fakeuploadfile.post.FakeuploadfilePostResponses; + +import java.io.IOException; +import java.util.Arrays; +import java.util.List; +import java.util.Map; +import java.util.AbstractMap; + +// if you want to use a server that is not SERVER_0 pass it in here and change the ServerIndex input below +ApiConfiguration.ServerInfo serverInfo = new ApiConfiguration.ServerInfoBuilder() + .rootServerInfo( + new RootServerInfo.RootServerInfoBuilder() + .rootServer0(new RootServer0()) + .build() + ) + .build(); +ApiConfiguration.ServerIndexInfo serverIndexInfo = new ApiConfiguration.ServerIndexInfoBuilder() + .rootServerInfoServerIndex(RootServerInfo.ServerIndex.SERVER_0) + .build(); +Duration timeout = Duration.ofSeconds(1L); +Map> defaultHeaders = Map.of("User-Agent", List.of("OpenAPI-JSON-Schema-Generator/1.0.0/java")); +ApiConfiguration apiConfiguration = new ApiConfiguration( + serverInfo + serverIndexInfo, + timeout, + defaultHeaders +); +SchemaConfiguration schemaConfiguration = new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().build()); +Fakeuploadfile apiClient = new Fakeuploadfile(apiConfiguration, schemaConfiguration); + + +var request = new FakeuploadfilePost.PostRequestBuilder().build(); + +FakeuploadfilePostResponses.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; +} +FakeuploadfilePostResponses.EndpointFakeuploadfilePostCode200Response castResponse = (FakeuploadfilePostResponses.EndpointFakeuploadfilePostCode200Response) response; +FakeuploadfilePostCode200Response.ApplicationjsonResponseBody deserializedBody = (FakeuploadfilePostCode200Response.ApplicationjsonResponseBody) castResponse.body; +// handle deserialized body here +``` +[[Back to top]](#top) [[Back to README]](../../../README.md) diff --git a/samples/client/petstore/kotlin/docs/apis/paths/Fakeuploadfiles.md b/samples/client/petstore/kotlin/docs/apis/paths/Fakeuploadfiles.md new file mode 100644 index 00000000000..3727c05c983 --- /dev/null +++ b/samples/client/petstore/kotlin/docs/apis/paths/Fakeuploadfiles.md @@ -0,0 +1,107 @@ +# Fakeuploadfiles + +public class Fakeuploadfiles extends extends ApiClient implements +[FakeuploadfilesPost.PostOperation](../../paths/fakeuploadfiles/FakeuploadfilesPost.md#postoperation) + +an api client class which contains all the routes for path="/fake/uploadFiles" + +## Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| [FakeuploadfilesPostResponses.EndpointResponse](../../paths/fakeuploadfiles/post/FakeuploadfilesPostResponses.md#endpointresponse) | [post](#post)([FakeuploadfilesPost.PostRequest](../../paths/fakeuploadfiles/FakeuploadfilesPost.md#postrequest) request)
| + +## Method Detail + +### post +public [FakeuploadfilesPostResponses.EndpointResponse](../../paths/fakeuploadfiles/post/FakeuploadfilesPostResponses.md#endpointresponse) post([FakeuploadfilesPost.PostRequest](../../paths/fakeuploadfiles/FakeuploadfilesPost.md#postrequest) request) + + + +**Parameters:**
+request - the input request + +**Returns:**
+the deserialized response + +**Throws:**
+IOException, InterruptedException - an exception happened when making the request
+ValidationException - the returned response body or header values do not conform the the schema validation requirements
+NotImplementedException - the request body serialization or deserialization has not yet been implemented
+ or the header content type deserialization has not yet been implemented for this contentType
+ApiException - server returned a response/contentType not defined in the openapi document
+ +#### 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.FakeuploadfilesPostRequestBody; +import org.openapijsonschematools.client.paths.fakeuploadfiles.post.requestbody.content.multipartformdata.MultipartformdataSchema; +import org.openapijsonschematools.client.RootServerInfo; +import org.openapijsonschematools.client.servers.RootServer0; +import org.openapijsonschematools.client.servers.RootServer1; +import org.openapijsonschematools.client.servers.RootServer2; +import org.openapijsonschematools.client.paths.fakeuploadfiles.post.responses.FakeuploadfilesPostCode200Response; +import org.openapijsonschematools.client.servers.RootServerInfo; +import org.openapijsonschematools.client.apis.paths.Fakeuploadfiles; +import org.openapijsonschematools.client.paths.fakeuploadfiles.post.FakeuploadfilesPostResponses; + +import java.io.IOException; +import java.util.Arrays; +import java.util.List; +import java.util.Map; +import java.util.AbstractMap; + +// if you want to use a server that is not SERVER_0 pass it in here and change the ServerIndex input below +ApiConfiguration.ServerInfo serverInfo = new ApiConfiguration.ServerInfoBuilder() + .rootServerInfo( + new RootServerInfo.RootServerInfoBuilder() + .rootServer0(new RootServer0()) + .build() + ) + .build(); +ApiConfiguration.ServerIndexInfo serverIndexInfo = new ApiConfiguration.ServerIndexInfoBuilder() + .rootServerInfoServerIndex(RootServerInfo.ServerIndex.SERVER_0) + .build(); +Duration timeout = Duration.ofSeconds(1L); +Map> defaultHeaders = Map.of("User-Agent", List.of("OpenAPI-JSON-Schema-Generator/1.0.0/java")); +ApiConfiguration apiConfiguration = new ApiConfiguration( + serverInfo + serverIndexInfo, + timeout, + defaultHeaders +); +SchemaConfiguration schemaConfiguration = new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().build()); +Fakeuploadfiles apiClient = new Fakeuploadfiles(apiConfiguration, schemaConfiguration); + + +var request = new FakeuploadfilesPost.PostRequestBuilder().build(); + +FakeuploadfilesPostResponses.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; +} +FakeuploadfilesPostResponses.EndpointFakeuploadfilesPostCode200Response castResponse = (FakeuploadfilesPostResponses.EndpointFakeuploadfilesPostCode200Response) response; +FakeuploadfilesPostCode200Response.ApplicationjsonResponseBody deserializedBody = (FakeuploadfilesPostCode200Response.ApplicationjsonResponseBody) castResponse.body; +// handle deserialized body here +``` +[[Back to top]](#top) [[Back to README]](../../../README.md) diff --git a/samples/client/petstore/kotlin/docs/apis/paths/Fakewildcardresponses.md b/samples/client/petstore/kotlin/docs/apis/paths/Fakewildcardresponses.md new file mode 100644 index 00000000000..63b99413ddb --- /dev/null +++ b/samples/client/petstore/kotlin/docs/apis/paths/Fakewildcardresponses.md @@ -0,0 +1,122 @@ +# Fakewildcardresponses + +public class Fakewildcardresponses extends extends ApiClient implements +[FakewildcardresponsesGet.GetOperation](../../paths/fakewildcardresponses/FakewildcardresponsesGet.md#getoperation) + +an api client class which contains all the routes for path="/fake/wildCardResponses" + +## Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| [FakewildcardresponsesGetResponses.EndpointResponse](../../paths/fakewildcardresponses/get/FakewildcardresponsesGetResponses.md#endpointresponse) | [get](#get)([FakewildcardresponsesGet.GetRequest](../../paths/fakewildcardresponses/FakewildcardresponsesGet.md#getrequest) request) | + +## Method Detail + +### get +public [FakewildcardresponsesGetResponses.EndpointResponse](../../paths/fakewildcardresponses/get/FakewildcardresponsesGetResponses.md#endpointresponse) get([FakewildcardresponsesGet.GetRequest](../../paths/fakewildcardresponses/FakewildcardresponsesGet.md#getrequest) request) + +**Parameters:**
+request - the input request + +**Returns:**
+the deserialized response + +**Throws:**
+IOException, InterruptedException - an exception happened when making the request
+ValidationException - the returned response body or header values do not conform the the schema validation requirements
+NotImplementedException - the request body serialization or deserialization has not yet been implemented
+ or the header content type deserialization has not yet been implemented for this contentType
+ApiException - server returned a response/contentType not defined in the openapi document
+ +#### 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.servers.RootServer0; +import org.openapijsonschematools.client.servers.RootServer1; +import org.openapijsonschematools.client.servers.RootServer2; +import org.openapijsonschematools.client.paths.fakewildcardresponses.get.responses.FakewildcardresponsesGetCode1XXResponse; +import org.openapijsonschematools.client.paths.fakewildcardresponses.get.responses.FakewildcardresponsesGetCode200Response; +import org.openapijsonschematools.client.paths.fakewildcardresponses.get.responses.FakewildcardresponsesGetCode2XXResponse; +import org.openapijsonschematools.client.paths.fakewildcardresponses.get.responses.FakewildcardresponsesGetCode3XXResponse; +import org.openapijsonschematools.client.paths.fakewildcardresponses.get.responses.FakewildcardresponsesGetCode4XXResponse; +import org.openapijsonschematools.client.paths.fakewildcardresponses.get.responses.FakewildcardresponsesGetCode5XXResponse; +import org.openapijsonschematools.client.servers.RootServerInfo; +import org.openapijsonschematools.client.apis.paths.Fakewildcardresponses; +import org.openapijsonschematools.client.paths.fakewildcardresponses.get.FakewildcardresponsesGetResponses; + +import java.io.IOException; +import java.util.Arrays; +import java.util.List; +import java.util.Map; +import java.util.AbstractMap; + +// if you want to use a server that is not SERVER_0 pass it in here and change the ServerIndex input below +ApiConfiguration.ServerInfo serverInfo = new ApiConfiguration.ServerInfoBuilder() + .rootServerInfo( + new RootServerInfo.RootServerInfoBuilder() + .rootServer0(new RootServer0()) + .build() + ) + .build(); +ApiConfiguration.ServerIndexInfo serverIndexInfo = new ApiConfiguration.ServerIndexInfoBuilder() + .rootServerInfoServerIndex(RootServerInfo.ServerIndex.SERVER_0) + .build(); +Duration timeout = Duration.ofSeconds(1L); +Map> defaultHeaders = Map.of("User-Agent", List.of("OpenAPI-JSON-Schema-Generator/1.0.0/java")); +ApiConfiguration apiConfiguration = new ApiConfiguration( + serverInfo + serverIndexInfo, + timeout, + defaultHeaders +); +SchemaConfiguration schemaConfiguration = new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().build()); +Fakewildcardresponses apiClient = new Fakewildcardresponses(apiConfiguration, schemaConfiguration); + + +var request = new FakewildcardresponsesGet.GetRequestBuilder().build(); + +FakewildcardresponsesGetResponses.EndpointResponse response; +try { + response = apiClient.get(request); +} catch (FakewildcardresponsesGetCode4XXResponse.ResponseApiException | FakewildcardresponsesGetCode5XXResponse.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; +} +if (response instanceof FakewildcardresponsesGetResponses.EndpointFakewildcardresponsesGetCode1XXResponse castResponse) { + FakewildcardresponsesGetCode1XXResponse.ApplicationjsonResponseBody deserializedBody = (FakewildcardresponsesGetCode1XXResponse.ApplicationjsonResponseBody) castResponse.body; + // handle deserialized body here +} else if (response instanceof FakewildcardresponsesGetResponses.EndpointFakewildcardresponsesGetCode2XXResponse castResponse) { + FakewildcardresponsesGetCode2XXResponse.ApplicationjsonResponseBody deserializedBody = (FakewildcardresponsesGetCode2XXResponse.ApplicationjsonResponseBody) castResponse.body; + // handle deserialized body here +} else if (response instanceof FakewildcardresponsesGetResponses.EndpointFakewildcardresponsesGetCode200Response castResponse) { + FakewildcardresponsesGetCode200Response.ApplicationjsonResponseBody deserializedBody = (FakewildcardresponsesGetCode200Response.ApplicationjsonResponseBody) castResponse.body; + // handle deserialized body here +} else { + FakewildcardresponsesGetResponses.EndpointFakewildcardresponsesGetCode3XXResponse castResponse = (FakewildcardresponsesGetResponses.EndpointFakewildcardresponsesGetCode3XXResponse) response; + FakewildcardresponsesGetCode3XXResponse.ApplicationjsonResponseBody deserializedBody = (FakewildcardresponsesGetCode3XXResponse.ApplicationjsonResponseBody) castResponse.body; + // handle deserialized body here +} +``` +[[Back to top]](#top) [[Back to README]](../../../README.md) diff --git a/samples/client/petstore/kotlin/docs/apis/paths/Foo.md b/samples/client/petstore/kotlin/docs/apis/paths/Foo.md new file mode 100644 index 00000000000..17405cb7e38 --- /dev/null +++ b/samples/client/petstore/kotlin/docs/apis/paths/Foo.md @@ -0,0 +1,102 @@ +# Foo + +public class Foo extends extends ApiClient implements +[FooGet.GetOperation](../../paths/foo/FooGet.md#getoperation) + +an api client class which contains all the routes for path="/foo" + +## Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| [FooGetResponses.EndpointResponse](../../paths/foo/get/FooGetResponses.md#endpointresponse) | [get](#get)([FooGet.GetRequest](../../paths/foo/FooGet.md#getrequest) request) | + +## Method Detail + +### get +public [FooGetResponses.EndpointResponse](../../paths/foo/get/FooGetResponses.md#endpointresponse) get([FooGet.GetRequest](../../paths/foo/FooGet.md#getrequest) request) + +**Parameters:**
+request - the input request + +**Returns:**
+the deserialized response + +**Throws:**
+IOException, InterruptedException - an exception happened when making the request
+ValidationException - the returned response body or header values do not conform the the schema validation requirements
+NotImplementedException - the request body serialization or deserialization has not yet been implemented
+ or the header content type deserialization has not yet been implemented for this contentType
+ApiException - server returned a response/contentType not defined in the openapi document
+ +#### 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.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.FooGetCodedefaultResponse; +import org.openapijsonschematools.client.paths.foo.get.FooGetServerInfo; +import org.openapijsonschematools.client.apis.paths.Foo; +import org.openapijsonschematools.client.paths.foo.get.FooGetResponses; + +import java.io.IOException; +import java.util.Arrays; +import java.util.List; +import java.util.Map; +import java.util.AbstractMap; + +// if you want to use a server that is not SERVER_0 pass it in here and change the ServerIndex input below +ApiConfiguration.ServerInfo serverInfo = new ApiConfiguration.ServerInfoBuilder() + .fooGetServerInfo( + new FooGetServerInfo.FooGetServerInfoBuilder() + .fooGetServer0(new FooGetServer0()) + .build() + ) + .build(); +ApiConfiguration.ServerIndexInfo serverIndexInfo = new ApiConfiguration.ServerIndexInfoBuilder() + .fooGetServerInfoServerIndex(FooGetServerInfo.ServerIndex.SERVER_0) + .build(); +Duration timeout = Duration.ofSeconds(1L); +Map> defaultHeaders = Map.of("User-Agent", List.of("OpenAPI-JSON-Schema-Generator/1.0.0/java")); +ApiConfiguration apiConfiguration = new ApiConfiguration( + serverInfo + serverIndexInfo, + timeout, + defaultHeaders +); +SchemaConfiguration schemaConfiguration = new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().build()); +Foo apiClient = new Foo(apiConfiguration, schemaConfiguration); + + +var request = new FooGet.GetRequestBuilder().build(); + +FooGetResponses.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; +} +FooGetResponses.EndpointFooGetCodedefaultResponse castResponse = (FooGetResponses.EndpointFooGetCodedefaultResponse) response; +FooGetCodedefaultResponse.ApplicationjsonResponseBody deserializedBody = (FooGetCodedefaultResponse.ApplicationjsonResponseBody) castResponse.body; +// handle deserialized body here +``` +[[Back to top]](#top) [[Back to README]](../../../README.md) diff --git a/samples/client/petstore/kotlin/docs/apis/paths/Pet.md b/samples/client/petstore/kotlin/docs/apis/paths/Pet.md new file mode 100644 index 00000000000..fc0900e10c6 --- /dev/null +++ b/samples/client/petstore/kotlin/docs/apis/paths/Pet.md @@ -0,0 +1,315 @@ +# Pet + +public class Pet extends extends ApiClient implements +[PetPost.PostOperation](../../paths/pet/PetPost.md#postoperation), +[PetPut.PutOperation](../../paths/pet/PetPut.md#putoperation) + +an api client class which contains all the routes for path="/pet" + +## Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| [PetPostResponses.EndpointResponse](../../paths/pet/post/PetPostResponses.md#endpointresponse) | [post](#post)([PetPost.PostRequest](../../paths/pet/PetPost.md#postrequest) request)
Add a new pet to the store | +| Nothing? | [put](#put)([PetPut.PutRequest](../../paths/pet/PetPut.md#putrequest) request)
| + +## Method Detail + +### post +public [PetPostResponses.EndpointResponse](../../paths/pet/post/PetPostResponses.md#endpointresponse) post([PetPost.PostRequest](../../paths/pet/PetPost.md#postrequest) request) + +Add a new pet to the store + +**Parameters:**
+request - the input request + +**Returns:**
+the deserialized response + +**Throws:**
+IOException, InterruptedException - an exception happened when making the request
+ValidationException - the returned response body or header values do not conform the the schema validation requirements
+NotImplementedException - the request body serialization or deserialization has not yet been implemented
+ or the header content type deserialization has not yet been implemented for this contentType
+ApiException - server returned a response/contentType not defined in the openapi document
+ +#### 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.PetPostRequestBody; +import org.openapijsonschematools.client.components.schemas.Pet; +import org.openapijsonschematools.client.servers.RootServer0; +import org.openapijsonschematools.client.servers.RootServer1; +import org.openapijsonschematools.client.servers.RootServer2; +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.PetPostCode200Response; +import org.openapijsonschematools.client.paths.pet.post.responses.PetPostCode405Response; +import org.openapijsonschematools.client.servers.RootServerInfo; +import org.openapijsonschematools.client.apis.paths.Pet; +import org.openapijsonschematools.client.paths.pet.post.PetPostResponses; + +import java.io.IOException; +import java.util.Arrays; +import java.util.List; +import java.util.Map; +import java.util.AbstractMap; + +// if you want to use a server that is not SERVER_0 pass it in here and change the ServerIndex input below +ApiConfiguration.ServerInfo serverInfo = new ApiConfiguration.ServerInfoBuilder() + .rootServerInfo( + new RootServerInfo.RootServerInfoBuilder() + .rootServer0(new RootServer0()) + .build() + ) + .build(); +ApiConfiguration.ServerIndexInfo serverIndexInfo = new ApiConfiguration.ServerIndexInfoBuilder() + .rootServerInfoServerIndex(RootServerInfo.ServerIndex.SERVER_0) + .build(); +List securitySchemes = new ArrayList(); +securitySchemes.add( + new ApiKey("someApiKey"); +); +ApiConfiguration.SecurityIndexInfo securityIndexInfo = new ApiConfiguration.SecurityIndexInfoBuilder() + .petPostSecurityRequirementObject0SecurityIndex(PetPostSecurityRequirementObject0.SecurityIndex.SECURITY_0) + .build(); +Duration timeout = Duration.ofSeconds(1L); +Map> defaultHeaders = Map.of("User-Agent", List.of("OpenAPI-JSON-Schema-Generator/1.0.0/java")); +ApiConfiguration apiConfiguration = new ApiConfiguration( + serverInfo + serverIndexInfo, + securitySchemes, + securityIndexInfo, + timeout, + defaultHeaders +); +SchemaConfiguration schemaConfiguration = new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().build()); +Pet apiClient = new Pet(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 +); +PetPostRequestBody.SealedRequestBody requestBody = new PetPostRequestBody.ApplicationjsonRequestBody(requestBodyPayload); + +var request = new PetPost.PostRequestBuilder() + .requestBody(requestBody) + .build(); + +PetPostResponses.EndpointResponse response; +try { + response = apiClient.post(request); +} catch (PetPostCode405Response.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; +} +PetPostResponses.EndpointPetPostCode200Response castResponse = (PetPostResponses.EndpointPetPostCode200Response) response; +``` +### put +public Nothing? put([PetPut.PutRequest](../../paths/pet/PetPut.md#putrequest) request) + + + +**Parameters:**
+request - the input request + +**Returns:**
+nothing (Nothing?) + +**Throws:**
+IOException, InterruptedException - an exception happened when making the request
+ValidationException - the returned response body or header values do not conform the the schema validation requirements
+NotImplementedException - the request body serialization or deserialization has not yet been implemented
+ or the header content type deserialization has not yet been implemented for this contentType
+ApiException - server returned a response/contentType not defined in the openapi document
+ +#### 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.PetPutRequestBody; +import org.openapijsonschematools.client.components.schemas.Pet; +import org.openapijsonschematools.client.servers.RootServer0; +import org.openapijsonschematools.client.servers.RootServer1; +import org.openapijsonschematools.client.servers.RootServer2; +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.pet.put.responses.PetPutCode400Response; +import org.openapijsonschematools.client.paths.pet.put.responses.PetPutCode404Response; +import org.openapijsonschematools.client.paths.pet.put.responses.PetPutCode405Response; +import org.openapijsonschematools.client.servers.RootServerInfo; +import org.openapijsonschematools.client.apis.paths.Pet; +import org.openapijsonschematools.client.paths.pet.put.PetPutResponses; + +import java.io.IOException; +import java.util.Arrays; +import java.util.List; +import java.util.Map; +import java.util.AbstractMap; + +// if you want to use a server that is not SERVER_0 pass it in here and change the ServerIndex input below +ApiConfiguration.ServerInfo serverInfo = new ApiConfiguration.ServerInfoBuilder() + .rootServerInfo( + new RootServerInfo.RootServerInfoBuilder() + .rootServer0(new RootServer0()) + .build() + ) + .build(); +ApiConfiguration.ServerIndexInfo serverIndexInfo = new ApiConfiguration.ServerIndexInfoBuilder() + .rootServerInfoServerIndex(RootServerInfo.ServerIndex.SERVER_0) + .build(); +List securitySchemes = new ArrayList(); +ApiConfiguration.SecurityIndexInfo securityIndexInfo = new ApiConfiguration.SecurityIndexInfoBuilder() + .petPutSecurityRequirementObject0SecurityIndex(PetPutSecurityRequirementObject0.SecurityIndex.SECURITY_0) + .build(); +Duration timeout = Duration.ofSeconds(1L); +Map> defaultHeaders = Map.of("User-Agent", List.of("OpenAPI-JSON-Schema-Generator/1.0.0/java")); +ApiConfiguration apiConfiguration = new ApiConfiguration( + serverInfo + serverIndexInfo, + securitySchemes, + securityIndexInfo, + timeout, + defaultHeaders +); +SchemaConfiguration schemaConfiguration = new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().build()); +Pet apiClient = new Pet(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 +); +PetPutRequestBody.SealedRequestBody requestBody = new PetPutRequestBody.ApplicationjsonRequestBody(requestBodyPayload); + +var request = new PetPut.PutRequestBuilder() + .requestBody(requestBody) + .build(); + +Nothing? response; +try { + response = apiClient.put(request); +} catch (PetPutCode400Response.ResponseApiException | PetPutCode404Response.ResponseApiException | PetPutCode405Response.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; +} +``` +[[Back to top]](#top) [[Back to README]](../../../README.md) diff --git a/samples/client/petstore/kotlin/docs/apis/paths/Petfindbystatus.md b/samples/client/petstore/kotlin/docs/apis/paths/Petfindbystatus.md new file mode 100644 index 00000000000..475c6b547b9 --- /dev/null +++ b/samples/client/petstore/kotlin/docs/apis/paths/Petfindbystatus.md @@ -0,0 +1,137 @@ +# Petfindbystatus + +public class Petfindbystatus extends extends ApiClient implements +[PetfindbystatusGet.GetOperation](../../paths/petfindbystatus/PetfindbystatusGet.md#getoperation) + +an api client class which contains all the routes for path="/pet/findByStatus" + +## Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| [PetfindbystatusGetResponses.EndpointResponse](../../paths/petfindbystatus/get/PetfindbystatusGetResponses.md#endpointresponse) | [get](#get)([PetfindbystatusGet.GetRequest](../../paths/petfindbystatus/PetfindbystatusGet.md#getrequest) request)
Multiple status values can be provided with comma separated strings | + +## Method Detail + +### get +public [PetfindbystatusGetResponses.EndpointResponse](../../paths/petfindbystatus/get/PetfindbystatusGetResponses.md#endpointresponse) get([PetfindbystatusGet.GetRequest](../../paths/petfindbystatus/PetfindbystatusGet.md#getrequest) request) + +Multiple status values can be provided with comma separated strings + +**Parameters:**
+request - the input request + +**Returns:**
+the deserialized response + +**Throws:**
+IOException, InterruptedException - an exception happened when making the request
+ValidationException - the returned response body or header values do not conform the the schema validation requirements
+NotImplementedException - the request body serialization or deserialization has not yet been implemented
+ or the header content type deserialization has not yet been implemented for this contentType
+ApiException - server returned a response/contentType not defined in the openapi document
+ +#### 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.petfindbystatus.PetfindbystatusServerInfo; +import org.openapijsonschematools.client.paths.petfindbystatus.get.PetfindbystatusGetSecurityInfo; +import org.openapijsonschematools.client.paths.petfindbystatus.get.PetfindbystatusGetQueryParameters; +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.PetfindbystatusGetCode200Response; +import org.openapijsonschematools.client.paths.petfindbystatus.get.responses.PetfindbystatusGetCode400Response; +import org.openapijsonschematools.client.paths.petfindbystatus.PetfindbystatusServerInfo; +import org.openapijsonschematools.client.apis.paths.Petfindbystatus; +import org.openapijsonschematools.client.paths.petfindbystatus.get.PetfindbystatusGetResponses; + +import java.io.IOException; +import java.util.Arrays; +import java.util.List; +import java.util.Map; +import java.util.AbstractMap; + +// if you want to use a server that is not SERVER_0 pass it in here and change the ServerIndex input below +ApiConfiguration.ServerInfo serverInfo = new ApiConfiguration.ServerInfoBuilder() + .petfindbystatusServerInfo( + new PetfindbystatusServerInfo.PetfindbystatusServerInfoBuilder() + .petfindbystatusServer0(new PetfindbystatusServer0()) + .build() + ) + .build(); +ApiConfiguration.ServerIndexInfo serverIndexInfo = new ApiConfiguration.ServerIndexInfoBuilder() + .petfindbystatusServerInfoServerIndex(PetfindbystatusServerInfo.ServerIndex.SERVER_0) + .build(); +List securitySchemes = new ArrayList(); +securitySchemes.add( + new ApiKey("someApiKey"); +); +ApiConfiguration.SecurityIndexInfo securityIndexInfo = new ApiConfiguration.SecurityIndexInfoBuilder() + .petfindbystatusGetSecurityRequirementObject0SecurityIndex(PetfindbystatusGetSecurityRequirementObject0.SecurityIndex.SECURITY_0) + .build(); +Duration timeout = Duration.ofSeconds(1L); +Map> defaultHeaders = Map.of("User-Agent", List.of("OpenAPI-JSON-Schema-Generator/1.0.0/java")); +ApiConfiguration apiConfiguration = new ApiConfiguration( + serverInfo + serverIndexInfo, + securitySchemes, + securityIndexInfo, + timeout, + defaultHeaders +); +SchemaConfiguration schemaConfiguration = new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().build()); +Petfindbystatus apiClient = new Petfindbystatus(apiConfiguration, schemaConfiguration); + + +// Map validation +PetfindbystatusGetQueryParameters.QueryParametersMap queryParameters = + PetfindbystatusGetQueryParameters.PetfindbystatusGetQueryParameters1.validate( + new PetfindbystatusGetQueryParameters.QueryParametersMapBuilder() + .status( + Arrays.asList( + "available" + ) + ) + .build(), + schemaConfiguration +); + +var request = new PetfindbystatusGet.GetRequestBuilder() + .queryParameters(queryParameters) + .build(); + +PetfindbystatusGetResponses.EndpointResponse response; +try { + response = apiClient.get(request); +} catch (PetfindbystatusGetCode400Response.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; +} +PetfindbystatusGetResponses.EndpointPetfindbystatusGetCode200Response castResponse = (PetfindbystatusGetResponses.EndpointPetfindbystatusGetCode200Response) response; +} +``` +[[Back to top]](#top) [[Back to README]](../../../README.md) diff --git a/samples/client/petstore/kotlin/docs/apis/paths/Petfindbytags.md b/samples/client/petstore/kotlin/docs/apis/paths/Petfindbytags.md new file mode 100644 index 00000000000..b3273aa91ce --- /dev/null +++ b/samples/client/petstore/kotlin/docs/apis/paths/Petfindbytags.md @@ -0,0 +1,134 @@ +# Petfindbytags + +public class Petfindbytags extends extends ApiClient implements +[PetfindbytagsGet.GetOperation](../../paths/petfindbytags/PetfindbytagsGet.md#getoperation) + +an api client class which contains all the routes for path="/pet/findByTags" + +## Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| [PetfindbytagsGetResponses.EndpointResponse](../../paths/petfindbytags/get/PetfindbytagsGetResponses.md#endpointresponse) | [get](#get)([PetfindbytagsGet.GetRequest](../../paths/petfindbytags/PetfindbytagsGet.md#getrequest) request)
Multiple tags can be provided with comma separated strings. Use tag1, tag2, tag3 for testing. | + +## Method Detail + +### get +public [PetfindbytagsGetResponses.EndpointResponse](../../paths/petfindbytags/get/PetfindbytagsGetResponses.md#endpointresponse) get([PetfindbytagsGet.GetRequest](../../paths/petfindbytags/PetfindbytagsGet.md#getrequest) request) + +Multiple tags can be provided with comma separated strings. Use tag1, tag2, tag3 for testing. + +**Parameters:**
+request - the input request + +**Returns:**
+the deserialized response + +**Throws:**
+IOException, InterruptedException - an exception happened when making the request
+ValidationException - the returned response body or header values do not conform the the schema validation requirements
+NotImplementedException - the request body serialization or deserialization has not yet been implemented
+ or the header content type deserialization has not yet been implemented for this contentType
+ApiException - server returned a response/contentType not defined in the openapi document
+ +#### 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.petfindbytags.get.PetfindbytagsGetSecurityInfo; +import org.openapijsonschematools.client.paths.petfindbytags.get.PetfindbytagsGetQueryParameters; +import org.openapijsonschematools.client.servers.RootServer0; +import org.openapijsonschematools.client.servers.RootServer1; +import org.openapijsonschematools.client.servers.RootServer2; +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.PetfindbytagsGetCode200Response; +import org.openapijsonschematools.client.paths.petfindbytags.get.responses.PetfindbytagsGetCode400Response; +import org.openapijsonschematools.client.servers.RootServerInfo; +import org.openapijsonschematools.client.apis.paths.Petfindbytags; +import org.openapijsonschematools.client.paths.petfindbytags.get.PetfindbytagsGetResponses; + +import java.io.IOException; +import java.util.Arrays; +import java.util.List; +import java.util.Map; +import java.util.AbstractMap; + +// if you want to use a server that is not SERVER_0 pass it in here and change the ServerIndex input below +ApiConfiguration.ServerInfo serverInfo = new ApiConfiguration.ServerInfoBuilder() + .rootServerInfo( + new RootServerInfo.RootServerInfoBuilder() + .rootServer0(new RootServer0()) + .build() + ) + .build(); +ApiConfiguration.ServerIndexInfo serverIndexInfo = new ApiConfiguration.ServerIndexInfoBuilder() + .rootServerInfoServerIndex(RootServerInfo.ServerIndex.SERVER_0) + .build(); +List securitySchemes = new ArrayList(); +ApiConfiguration.SecurityIndexInfo securityIndexInfo = new ApiConfiguration.SecurityIndexInfoBuilder() + .petfindbytagsGetSecurityRequirementObject0SecurityIndex(PetfindbytagsGetSecurityRequirementObject0.SecurityIndex.SECURITY_0) + .build(); +Duration timeout = Duration.ofSeconds(1L); +Map> defaultHeaders = Map.of("User-Agent", List.of("OpenAPI-JSON-Schema-Generator/1.0.0/java")); +ApiConfiguration apiConfiguration = new ApiConfiguration( + serverInfo + serverIndexInfo, + securitySchemes, + securityIndexInfo, + timeout, + defaultHeaders +); +SchemaConfiguration schemaConfiguration = new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().build()); +Petfindbytags apiClient = new Petfindbytags(apiConfiguration, schemaConfiguration); + + +// Map validation +PetfindbytagsGetQueryParameters.QueryParametersMap queryParameters = + PetfindbytagsGetQueryParameters.PetfindbytagsGetQueryParameters1.validate( + new PetfindbytagsGetQueryParameters.QueryParametersMapBuilder() + .tags( + Arrays.asList( + "a" + ) + ) + .build(), + schemaConfiguration +); + +var request = new PetfindbytagsGet.GetRequestBuilder() + .queryParameters(queryParameters) + .build(); + +PetfindbytagsGetResponses.EndpointResponse response; +try { + response = apiClient.get(request); +} catch (PetfindbytagsGetCode400Response.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; +} +PetfindbytagsGetResponses.EndpointPetfindbytagsGetCode200Response castResponse = (PetfindbytagsGetResponses.EndpointPetfindbytagsGetCode200Response) response; +} +``` +[[Back to top]](#top) [[Back to README]](../../../README.md) diff --git a/samples/client/petstore/kotlin/docs/apis/paths/Petpetid.md b/samples/client/petstore/kotlin/docs/apis/paths/Petpetid.md new file mode 100644 index 00000000000..a7e43426511 --- /dev/null +++ b/samples/client/petstore/kotlin/docs/apis/paths/Petpetid.md @@ -0,0 +1,377 @@ +# Petpetid + +public class Petpetid extends extends ApiClient implements +[PetpetidDelete.DeleteOperation](../../paths/petpetid/PetpetidDelete.md#deleteoperation), +[PetpetidGet.GetOperation](../../paths/petpetid/PetpetidGet.md#getoperation), +[PetpetidPost.PostOperation](../../paths/petpetid/PetpetidPost.md#postoperation) + +an api client class which contains all the routes for path="/pet/{petId}" + +## Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| Nothing? | [delete](#delete)([PetpetidDelete.DeleteRequest](../../paths/petpetid/PetpetidDelete.md#deleterequest) request)
| +| [PetpetidGetResponses.EndpointResponse](../../paths/petpetid/get/PetpetidGetResponses.md#endpointresponse) | [get](#get)([PetpetidGet.GetRequest](../../paths/petpetid/PetpetidGet.md#getrequest) request)
Returns a single pet | +| Nothing? | [post](#post)([PetpetidPost.PostRequest](../../paths/petpetid/PetpetidPost.md#postrequest) request)
| + +## Method Detail + +### delete +public Nothing? delete([PetpetidDelete.DeleteRequest](../../paths/petpetid/PetpetidDelete.md#deleterequest) request) + + + +**Parameters:**
+request - the input request + +**Returns:**
+nothing (Nothing?) + +**Throws:**
+IOException, InterruptedException - an exception happened when making the request
+ValidationException - the returned response body or header values do not conform the the schema validation requirements
+NotImplementedException - the request body serialization or deserialization has not yet been implemented
+ or the header content type deserialization has not yet been implemented for this contentType
+ApiException - server returned a response/contentType not defined in the openapi document
+ +#### 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.PetpetidDeleteHeaderParameters; +import org.openapijsonschematools.client.RootServerInfo; +import org.openapijsonschematools.client.paths.petpetid.delete.PetpetidDeleteSecurityInfo; +import org.openapijsonschematools.client.paths.petpetid.delete.PetpetidDeletePathParameters; +import org.openapijsonschematools.client.servers.RootServer0; +import org.openapijsonschematools.client.servers.RootServer1; +import org.openapijsonschematools.client.servers.RootServer2; +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.PetpetidDeleteCode400Response; +import org.openapijsonschematools.client.servers.RootServerInfo; +import org.openapijsonschematools.client.apis.paths.Petpetid; +import org.openapijsonschematools.client.paths.petpetid.delete.PetpetidDeleteResponses; + +import java.io.IOException; +import java.util.Arrays; +import java.util.List; +import java.util.Map; +import java.util.AbstractMap; + +// if you want to use a server that is not SERVER_0 pass it in here and change the ServerIndex input below +ApiConfiguration.ServerInfo serverInfo = new ApiConfiguration.ServerInfoBuilder() + .rootServerInfo( + new RootServerInfo.RootServerInfoBuilder() + .rootServer0(new RootServer0()) + .build() + ) + .build(); +ApiConfiguration.ServerIndexInfo serverIndexInfo = new ApiConfiguration.ServerIndexInfoBuilder() + .rootServerInfoServerIndex(RootServerInfo.ServerIndex.SERVER_0) + .build(); +List securitySchemes = new ArrayList(); +securitySchemes.add( + new ApiKey("someApiKey"); +); +ApiConfiguration.SecurityIndexInfo securityIndexInfo = new ApiConfiguration.SecurityIndexInfoBuilder() + .petpetidDeleteSecurityRequirementObject0SecurityIndex(PetpetidDeleteSecurityRequirementObject0.SecurityIndex.SECURITY_0) + .build(); +Duration timeout = Duration.ofSeconds(1L); +Map> defaultHeaders = Map.of("User-Agent", List.of("OpenAPI-JSON-Schema-Generator/1.0.0/java")); +ApiConfiguration apiConfiguration = new ApiConfiguration( + serverInfo + serverIndexInfo, + securitySchemes, + securityIndexInfo, + timeout, + defaultHeaders +); +SchemaConfiguration schemaConfiguration = new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().build()); +Petpetid apiClient = new Petpetid(apiConfiguration, schemaConfiguration); + + +// Map validation +PetpetidDeletePathParameters.PathParametersMap pathParameters = + PetpetidDeletePathParameters.PetpetidDeletePathParameters1.validate( + new PetpetidDeletePathParameters.PathParametersMapBuilder() + .petId(1L) + + .build(), + schemaConfiguration +); + +var request = new PetpetidDelete.DeleteRequestBuilder() + .pathParameters(pathParameters) + .build(); + +Nothing? response; +try { + response = apiClient.delete(request); +} catch (PetpetidDeleteCode400Response.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; +} +``` +### get +public [PetpetidGetResponses.EndpointResponse](../../paths/petpetid/get/PetpetidGetResponses.md#endpointresponse) get([PetpetidGet.GetRequest](../../paths/petpetid/PetpetidGet.md#getrequest) request) + +Returns a single pet + +**Parameters:**
+request - the input request + +**Returns:**
+the deserialized response + +**Throws:**
+IOException, InterruptedException - an exception happened when making the request
+ValidationException - the returned response body or header values do not conform the the schema validation requirements
+NotImplementedException - the request body serialization or deserialization has not yet been implemented
+ or the header content type deserialization has not yet been implemented for this contentType
+ApiException - server returned a response/contentType not defined in the openapi document
+ +#### 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.petpetid.get.PetpetidGetSecurityInfo; +import org.openapijsonschematools.client.paths.petpetid.get.PetpetidGetPathParameters; +import org.openapijsonschematools.client.servers.RootServer0; +import org.openapijsonschematools.client.servers.RootServer1; +import org.openapijsonschematools.client.servers.RootServer2; +import org.openapijsonschematools.client.securityschemes.SecurityScheme; +import org.openapijsonschematools.client.components.securityschemes.ApiKey; +import org.openapijsonschematools.client.paths.petpetid.get.responses.PetpetidGetCode200Response; +import org.openapijsonschematools.client.paths.petpetid.get.responses.PetpetidGetCode400Response; +import org.openapijsonschematools.client.paths.petpetid.get.responses.PetpetidGetCode404Response; +import org.openapijsonschematools.client.servers.RootServerInfo; +import org.openapijsonschematools.client.apis.paths.Petpetid; +import org.openapijsonschematools.client.paths.petpetid.get.PetpetidGetResponses; + +import java.io.IOException; +import java.util.Arrays; +import java.util.List; +import java.util.Map; +import java.util.AbstractMap; + +// if you want to use a server that is not SERVER_0 pass it in here and change the ServerIndex input below +ApiConfiguration.ServerInfo serverInfo = new ApiConfiguration.ServerInfoBuilder() + .rootServerInfo( + new RootServerInfo.RootServerInfoBuilder() + .rootServer0(new RootServer0()) + .build() + ) + .build(); +ApiConfiguration.ServerIndexInfo serverIndexInfo = new ApiConfiguration.ServerIndexInfoBuilder() + .rootServerInfoServerIndex(RootServerInfo.ServerIndex.SERVER_0) + .build(); +List securitySchemes = new ArrayList(); +securitySchemes.add( + new ApiKey("someApiKey"); +); +ApiConfiguration.SecurityIndexInfo securityIndexInfo = new ApiConfiguration.SecurityIndexInfoBuilder() + .petpetidGetSecurityRequirementObject0SecurityIndex(PetpetidGetSecurityRequirementObject0.SecurityIndex.SECURITY_0) + .build(); +Duration timeout = Duration.ofSeconds(1L); +Map> defaultHeaders = Map.of("User-Agent", List.of("OpenAPI-JSON-Schema-Generator/1.0.0/java")); +ApiConfiguration apiConfiguration = new ApiConfiguration( + serverInfo + serverIndexInfo, + securitySchemes, + securityIndexInfo, + timeout, + defaultHeaders +); +SchemaConfiguration schemaConfiguration = new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().build()); +Petpetid apiClient = new Petpetid(apiConfiguration, schemaConfiguration); + + +// Map validation +PetpetidGetPathParameters.PathParametersMap pathParameters = + PetpetidGetPathParameters.PetpetidGetPathParameters1.validate( + new PetpetidGetPathParameters.PathParametersMapBuilder() + .petId(1L) + + .build(), + schemaConfiguration +); + +var request = new PetpetidGet.GetRequestBuilder() + .pathParameters(pathParameters) + .build(); + +PetpetidGetResponses.EndpointResponse response; +try { + response = apiClient.get(request); +} catch (PetpetidGetCode400Response.ResponseApiException | PetpetidGetCode404Response.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; +} +PetpetidGetResponses.EndpointPetpetidGetCode200Response castResponse = (PetpetidGetResponses.EndpointPetpetidGetCode200Response) response; +if (castResponse.body instanceof PetpetidGetCode200Response.ApplicationxmlResponseBody deserializedBody) { + // handle deserialized body here +} else { + PetpetidGetCode200Response.ApplicationjsonResponseBody deserializedBody = (PetpetidGetCode200Response.ApplicationjsonResponseBody) castResponse.body; + // handle deserialized body here +} +``` +### post +public Nothing? post([PetpetidPost.PostRequest](../../paths/petpetid/PetpetidPost.md#postrequest) request) + + + +**Parameters:**
+request - the input request + +**Returns:**
+nothing (Nothing?) + +**Throws:**
+IOException, InterruptedException - an exception happened when making the request
+ValidationException - the returned response body or header values do not conform the the schema validation requirements
+NotImplementedException - the request body serialization or deserialization has not yet been implemented
+ or the header content type deserialization has not yet been implemented for this contentType
+ApiException - server returned a response/contentType not defined in the openapi document
+ +#### 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.PetpetidPostRequestBody; +import org.openapijsonschematools.client.RootServerInfo; +import org.openapijsonschematools.client.paths.petpetid.post.PetpetidPostSecurityInfo; +import org.openapijsonschematools.client.paths.petpetid.post.PetpetidPostPathParameters; +import org.openapijsonschematools.client.servers.RootServer0; +import org.openapijsonschematools.client.servers.RootServer1; +import org.openapijsonschematools.client.servers.RootServer2; +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.PetpetidPostCode405Response; +import org.openapijsonschematools.client.servers.RootServerInfo; +import org.openapijsonschematools.client.apis.paths.Petpetid; +import org.openapijsonschematools.client.paths.petpetid.post.PetpetidPostResponses; + +import java.io.IOException; +import java.util.Arrays; +import java.util.List; +import java.util.Map; +import java.util.AbstractMap; + +// if you want to use a server that is not SERVER_0 pass it in here and change the ServerIndex input below +ApiConfiguration.ServerInfo serverInfo = new ApiConfiguration.ServerInfoBuilder() + .rootServerInfo( + new RootServerInfo.RootServerInfoBuilder() + .rootServer0(new RootServer0()) + .build() + ) + .build(); +ApiConfiguration.ServerIndexInfo serverIndexInfo = new ApiConfiguration.ServerIndexInfoBuilder() + .rootServerInfoServerIndex(RootServerInfo.ServerIndex.SERVER_0) + .build(); +List securitySchemes = new ArrayList(); +securitySchemes.add( + new ApiKey("someApiKey"); +); +ApiConfiguration.SecurityIndexInfo securityIndexInfo = new ApiConfiguration.SecurityIndexInfoBuilder() + .petpetidPostSecurityRequirementObject0SecurityIndex(PetpetidPostSecurityRequirementObject0.SecurityIndex.SECURITY_0) + .build(); +Duration timeout = Duration.ofSeconds(1L); +Map> defaultHeaders = Map.of("User-Agent", List.of("OpenAPI-JSON-Schema-Generator/1.0.0/java")); +ApiConfiguration apiConfiguration = new ApiConfiguration( + serverInfo + serverIndexInfo, + securitySchemes, + securityIndexInfo, + timeout, + defaultHeaders +); +SchemaConfiguration schemaConfiguration = new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().build()); +Petpetid apiClient = new Petpetid(apiConfiguration, schemaConfiguration); + + +// Map validation +PetpetidPostPathParameters.PathParametersMap pathParameters = + PetpetidPostPathParameters.PetpetidPostPathParameters1.validate( + new PetpetidPostPathParameters.PathParametersMapBuilder() + .petId(1L) + + .build(), + schemaConfiguration +); + +var request = new PetpetidPost.PostRequestBuilder() + .pathParameters(pathParameters) + .build(); + +Nothing? response; +try { + response = apiClient.post(request); +} catch (PetpetidPostCode405Response.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; +} +``` +[[Back to top]](#top) [[Back to README]](../../../README.md) diff --git a/samples/client/petstore/kotlin/docs/apis/paths/Petpetiduploadimage.md b/samples/client/petstore/kotlin/docs/apis/paths/Petpetiduploadimage.md new file mode 100644 index 00000000000..67614ba784c --- /dev/null +++ b/samples/client/petstore/kotlin/docs/apis/paths/Petpetiduploadimage.md @@ -0,0 +1,128 @@ +# Petpetiduploadimage + +public class Petpetiduploadimage extends extends ApiClient implements +[PetpetiduploadimagePost.PostOperation](../../paths/petpetiduploadimage/PetpetiduploadimagePost.md#postoperation) + +an api client class which contains all the routes for path="/pet/{petId}/uploadImage" + +## Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| [PetpetiduploadimagePostResponses.EndpointResponse](../../paths/petpetiduploadimage/post/PetpetiduploadimagePostResponses.md#endpointresponse) | [post](#post)([PetpetiduploadimagePost.PostRequest](../../paths/petpetiduploadimage/PetpetiduploadimagePost.md#postrequest) request)
| + +## Method Detail + +### post +public [PetpetiduploadimagePostResponses.EndpointResponse](../../paths/petpetiduploadimage/post/PetpetiduploadimagePostResponses.md#endpointresponse) post([PetpetiduploadimagePost.PostRequest](../../paths/petpetiduploadimage/PetpetiduploadimagePost.md#postrequest) request) + + + +**Parameters:**
+request - the input request + +**Returns:**
+the deserialized response + +**Throws:**
+IOException, InterruptedException - an exception happened when making the request
+ValidationException - the returned response body or header values do not conform the the schema validation requirements
+NotImplementedException - the request body serialization or deserialization has not yet been implemented
+ or the header content type deserialization has not yet been implemented for this contentType
+ApiException - server returned a response/contentType not defined in the openapi document
+ +#### 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.PetpetiduploadimagePostRequestBody; +import org.openapijsonschematools.client.RootServerInfo; +import org.openapijsonschematools.client.paths.petpetiduploadimage.post.PetpetiduploadimagePostSecurityInfo; +import org.openapijsonschematools.client.paths.petpetiduploadimage.post.PetpetiduploadimagePostPathParameters; +import org.openapijsonschematools.client.servers.RootServer0; +import org.openapijsonschematools.client.servers.RootServer1; +import org.openapijsonschematools.client.servers.RootServer2; +import org.openapijsonschematools.client.securityschemes.SecurityScheme; +import org.openapijsonschematools.client.components.securityschemes.PetstoreAuth; +import org.openapijsonschematools.client.paths.petpetiduploadimage.post.responses.PetpetiduploadimagePostCode200Response; +import org.openapijsonschematools.client.components.responses.successwithjsonapiresponse.SuccessWithJsonApiResponseHeadersSchema; +import org.openapijsonschematools.client.servers.RootServerInfo; +import org.openapijsonschematools.client.apis.paths.Petpetiduploadimage; +import org.openapijsonschematools.client.paths.petpetiduploadimage.post.PetpetiduploadimagePostResponses; + +import java.io.IOException; +import java.util.Arrays; +import java.util.List; +import java.util.Map; +import java.util.AbstractMap; + +// if you want to use a server that is not SERVER_0 pass it in here and change the ServerIndex input below +ApiConfiguration.ServerInfo serverInfo = new ApiConfiguration.ServerInfoBuilder() + .rootServerInfo( + new RootServerInfo.RootServerInfoBuilder() + .rootServer0(new RootServer0()) + .build() + ) + .build(); +ApiConfiguration.ServerIndexInfo serverIndexInfo = new ApiConfiguration.ServerIndexInfoBuilder() + .rootServerInfoServerIndex(RootServerInfo.ServerIndex.SERVER_0) + .build(); +List securitySchemes = new ArrayList(); +ApiConfiguration.SecurityIndexInfo securityIndexInfo = new ApiConfiguration.SecurityIndexInfoBuilder() + .petpetiduploadimagePostSecurityRequirementObject0SecurityIndex(PetpetiduploadimagePostSecurityRequirementObject0.SecurityIndex.SECURITY_0) + .build(); +Duration timeout = Duration.ofSeconds(1L); +Map> defaultHeaders = Map.of("User-Agent", List.of("OpenAPI-JSON-Schema-Generator/1.0.0/java")); +ApiConfiguration apiConfiguration = new ApiConfiguration( + serverInfo + serverIndexInfo, + securitySchemes, + securityIndexInfo, + timeout, + defaultHeaders +); +SchemaConfiguration schemaConfiguration = new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().build()); +Petpetiduploadimage apiClient = new Petpetiduploadimage(apiConfiguration, schemaConfiguration); + + +// Map validation +PetpetiduploadimagePostPathParameters.PathParametersMap pathParameters = + PetpetiduploadimagePostPathParameters.PetpetiduploadimagePostPathParameters1.validate( + new PetpetiduploadimagePostPathParameters.PathParametersMapBuilder() + .petId(1L) + + .build(), + schemaConfiguration +); + +var request = new PetpetiduploadimagePost.PostRequestBuilder() + .pathParameters(pathParameters) + .build(); + +PetpetiduploadimagePostResponses.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; +} +PetpetiduploadimagePostResponses.EndpointPetpetiduploadimagePostCode200Response castResponse = (PetpetiduploadimagePostResponses.EndpointPetpetiduploadimagePostCode200Response) response; +} +``` +[[Back to top]](#top) [[Back to README]](../../../README.md) diff --git a/samples/client/petstore/kotlin/docs/apis/paths/Solidus.md b/samples/client/petstore/kotlin/docs/apis/paths/Solidus.md new file mode 100644 index 00000000000..4a157001b35 --- /dev/null +++ b/samples/client/petstore/kotlin/docs/apis/paths/Solidus.md @@ -0,0 +1,101 @@ +# Solidus + +public class Solidus extends extends ApiClient implements +[SolidusGet.GetOperation](../../paths/solidus/SolidusGet.md#getoperation) + +an api client class which contains all the routes for path="/" + +## Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| [SolidusGetResponses.EndpointResponse](../../paths/solidus/get/SolidusGetResponses.md#endpointresponse) | [get](#get)([SolidusGet.GetRequest](../../paths/solidus/SolidusGet.md#getrequest) request) | + +## Method Detail + +### get +public [SolidusGetResponses.EndpointResponse](../../paths/solidus/get/SolidusGetResponses.md#endpointresponse) get([SolidusGet.GetRequest](../../paths/solidus/SolidusGet.md#getrequest) request) + +**Parameters:**
+request - the input request + +**Returns:**
+the deserialized response + +**Throws:**
+IOException, InterruptedException - an exception happened when making the request
+ValidationException - the returned response body or header values do not conform the the schema validation requirements
+NotImplementedException - the request body serialization or deserialization has not yet been implemented
+ or the header content type deserialization has not yet been implemented for this contentType
+ApiException - server returned a response/contentType not defined in the openapi document
+ +#### 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.servers.RootServer0; +import org.openapijsonschematools.client.servers.RootServer1; +import org.openapijsonschematools.client.servers.RootServer2; +import org.openapijsonschematools.client.paths.solidus.get.responses.SolidusGetCode200Response; +import org.openapijsonschematools.client.servers.RootServerInfo; +import org.openapijsonschematools.client.apis.paths.Solidus; +import org.openapijsonschematools.client.paths.solidus.get.SolidusGetResponses; + +import java.io.IOException; +import java.util.Arrays; +import java.util.List; +import java.util.Map; +import java.util.AbstractMap; + +// if you want to use a server that is not SERVER_0 pass it in here and change the ServerIndex input below +ApiConfiguration.ServerInfo serverInfo = new ApiConfiguration.ServerInfoBuilder() + .rootServerInfo( + new RootServerInfo.RootServerInfoBuilder() + .rootServer0(new RootServer0()) + .build() + ) + .build(); +ApiConfiguration.ServerIndexInfo serverIndexInfo = new ApiConfiguration.ServerIndexInfoBuilder() + .rootServerInfoServerIndex(RootServerInfo.ServerIndex.SERVER_0) + .build(); +Duration timeout = Duration.ofSeconds(1L); +Map> defaultHeaders = Map.of("User-Agent", List.of("OpenAPI-JSON-Schema-Generator/1.0.0/java")); +ApiConfiguration apiConfiguration = new ApiConfiguration( + serverInfo + serverIndexInfo, + timeout, + defaultHeaders +); +SchemaConfiguration schemaConfiguration = new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().build()); +Solidus apiClient = new Solidus(apiConfiguration, schemaConfiguration); + + +var request = new SolidusGet.GetRequestBuilder().build(); + +SolidusGetResponses.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; +} +SolidusGetResponses.EndpointSolidusGetCode200Response castResponse = (SolidusGetResponses.EndpointSolidusGetCode200Response) response; +``` +[[Back to top]](#top) [[Back to README]](../../../README.md) diff --git a/samples/client/petstore/kotlin/docs/apis/paths/Storeinventory.md b/samples/client/petstore/kotlin/docs/apis/paths/Storeinventory.md new file mode 100644 index 00000000000..c22c9ecc957 --- /dev/null +++ b/samples/client/petstore/kotlin/docs/apis/paths/Storeinventory.md @@ -0,0 +1,117 @@ +# Storeinventory + +public class Storeinventory extends extends ApiClient implements +[StoreinventoryGet.GetOperation](../../paths/storeinventory/StoreinventoryGet.md#getoperation) + +an api client class which contains all the routes for path="/store/inventory" + +## Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| [StoreinventoryGetResponses.EndpointResponse](../../paths/storeinventory/get/StoreinventoryGetResponses.md#endpointresponse) | [get](#get)([StoreinventoryGet.GetRequest](../../paths/storeinventory/StoreinventoryGet.md#getrequest) request)
Returns a map of status codes to quantities | + +## Method Detail + +### get +public [StoreinventoryGetResponses.EndpointResponse](../../paths/storeinventory/get/StoreinventoryGetResponses.md#endpointresponse) get([StoreinventoryGet.GetRequest](../../paths/storeinventory/StoreinventoryGet.md#getrequest) request) + +Returns a map of status codes to quantities + +**Parameters:**
+request - the input request + +**Returns:**
+the deserialized response + +**Throws:**
+IOException, InterruptedException - an exception happened when making the request
+ValidationException - the returned response body or header values do not conform the the schema validation requirements
+NotImplementedException - the request body serialization or deserialization has not yet been implemented
+ or the header content type deserialization has not yet been implemented for this contentType
+ApiException - server returned a response/contentType not defined in the openapi document
+ +#### 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.storeinventory.get.StoreinventoryGetSecurityInfo; +import org.openapijsonschematools.client.servers.RootServer0; +import org.openapijsonschematools.client.servers.RootServer1; +import org.openapijsonschematools.client.servers.RootServer2; +import org.openapijsonschematools.client.securityschemes.SecurityScheme; +import org.openapijsonschematools.client.components.securityschemes.ApiKey; +import org.openapijsonschematools.client.paths.storeinventory.get.responses.StoreinventoryGetCode200Response; +import org.openapijsonschematools.client.components.responses.successinlinecontentandheader.SuccessInlineContentAndHeaderHeadersSchema; +import org.openapijsonschematools.client.servers.RootServerInfo; +import org.openapijsonschematools.client.apis.paths.Storeinventory; +import org.openapijsonschematools.client.paths.storeinventory.get.StoreinventoryGetResponses; + +import java.io.IOException; +import java.util.Arrays; +import java.util.List; +import java.util.Map; +import java.util.AbstractMap; + +// if you want to use a server that is not SERVER_0 pass it in here and change the ServerIndex input below +ApiConfiguration.ServerInfo serverInfo = new ApiConfiguration.ServerInfoBuilder() + .rootServerInfo( + new RootServerInfo.RootServerInfoBuilder() + .rootServer0(new RootServer0()) + .build() + ) + .build(); +ApiConfiguration.ServerIndexInfo serverIndexInfo = new ApiConfiguration.ServerIndexInfoBuilder() + .rootServerInfoServerIndex(RootServerInfo.ServerIndex.SERVER_0) + .build(); +List securitySchemes = new ArrayList(); +securitySchemes.add( + new ApiKey("someApiKey"); +); +ApiConfiguration.SecurityIndexInfo securityIndexInfo = new ApiConfiguration.SecurityIndexInfoBuilder() + .storeinventoryGetSecurityRequirementObject0SecurityIndex(StoreinventoryGetSecurityRequirementObject0.SecurityIndex.SECURITY_0) + .build(); +Duration timeout = Duration.ofSeconds(1L); +Map> defaultHeaders = Map.of("User-Agent", List.of("OpenAPI-JSON-Schema-Generator/1.0.0/java")); +ApiConfiguration apiConfiguration = new ApiConfiguration( + serverInfo + serverIndexInfo, + securitySchemes, + securityIndexInfo, + timeout, + defaultHeaders +); +SchemaConfiguration schemaConfiguration = new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().build()); +Storeinventory apiClient = new Storeinventory(apiConfiguration, schemaConfiguration); + + +var request = new StoreinventoryGet.GetRequestBuilder().build(); + +StoreinventoryGetResponses.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; +} +StoreinventoryGetResponses.EndpointStoreinventoryGetCode200Response castResponse = (StoreinventoryGetResponses.EndpointStoreinventoryGetCode200Response) response; +} +``` +[[Back to top]](#top) [[Back to README]](../../../README.md) diff --git a/samples/client/petstore/kotlin/docs/apis/paths/Storeorder.md b/samples/client/petstore/kotlin/docs/apis/paths/Storeorder.md new file mode 100644 index 00000000000..90478bd1169 --- /dev/null +++ b/samples/client/petstore/kotlin/docs/apis/paths/Storeorder.md @@ -0,0 +1,137 @@ +# Storeorder + +public class Storeorder extends extends ApiClient implements +[StoreorderPost.PostOperation](../../paths/storeorder/StoreorderPost.md#postoperation) + +an api client class which contains all the routes for path="/store/order" + +## Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| [StoreorderPostResponses.EndpointResponse](../../paths/storeorder/post/StoreorderPostResponses.md#endpointresponse) | [post](#post)([StoreorderPost.PostRequest](../../paths/storeorder/StoreorderPost.md#postrequest) request)
| + +## Method Detail + +### post +public [StoreorderPostResponses.EndpointResponse](../../paths/storeorder/post/StoreorderPostResponses.md#endpointresponse) post([StoreorderPost.PostRequest](../../paths/storeorder/StoreorderPost.md#postrequest) request) + + + +**Parameters:**
+request - the input request + +**Returns:**
+the deserialized response + +**Throws:**
+IOException, InterruptedException - an exception happened when making the request
+ValidationException - the returned response body or header values do not conform the the schema validation requirements
+NotImplementedException - the request body serialization or deserialization has not yet been implemented
+ or the header content type deserialization has not yet been implemented for this contentType
+ApiException - server returned a response/contentType not defined in the openapi document
+ +#### 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.StoreorderPostRequestBody; +import org.openapijsonschematools.client.components.schemas.Order; +import org.openapijsonschematools.client.servers.RootServer0; +import org.openapijsonschematools.client.servers.RootServer1; +import org.openapijsonschematools.client.servers.RootServer2; +import org.openapijsonschematools.client.paths.storeorder.post.responses.StoreorderPostCode200Response; +import org.openapijsonschematools.client.paths.storeorder.post.responses.StoreorderPostCode400Response; +import org.openapijsonschematools.client.servers.RootServerInfo; +import org.openapijsonschematools.client.apis.paths.Storeorder; +import org.openapijsonschematools.client.paths.storeorder.post.StoreorderPostResponses; + +import java.io.IOException; +import java.util.Arrays; +import java.util.List; +import java.util.Map; +import java.util.AbstractMap; + +// if you want to use a server that is not SERVER_0 pass it in here and change the ServerIndex input below +ApiConfiguration.ServerInfo serverInfo = new ApiConfiguration.ServerInfoBuilder() + .rootServerInfo( + new RootServerInfo.RootServerInfoBuilder() + .rootServer0(new RootServer0()) + .build() + ) + .build(); +ApiConfiguration.ServerIndexInfo serverIndexInfo = new ApiConfiguration.ServerIndexInfoBuilder() + .rootServerInfoServerIndex(RootServerInfo.ServerIndex.SERVER_0) + .build(); +Duration timeout = Duration.ofSeconds(1L); +Map> defaultHeaders = Map.of("User-Agent", List.of("OpenAPI-JSON-Schema-Generator/1.0.0/java")); +ApiConfiguration apiConfiguration = new ApiConfiguration( + serverInfo + serverIndexInfo, + timeout, + defaultHeaders +); +SchemaConfiguration schemaConfiguration = new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().build()); +Storeorder apiClient = new Storeorder(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 +); +StoreorderPost.SealedRequestBody requestBody = new StoreorderPost.ApplicationjsonRequestBody(requestBodyPayload); + +var request = new StoreorderPost.PostRequestBuilder() + .requestBody(requestBody) + .build(); + +StoreorderPostResponses.EndpointResponse response; +try { + response = apiClient.post(request); +} catch (StoreorderPostCode400Response.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; +} +StoreorderPostResponses.EndpointStoreorderPostCode200Response castResponse = (StoreorderPostResponses.EndpointStoreorderPostCode200Response) response; +if (castResponse.body instanceof StoreorderPostCode200Response.ApplicationxmlResponseBody deserializedBody) { + // handle deserialized body here +} else { + StoreorderPostCode200Response.ApplicationjsonResponseBody deserializedBody = (StoreorderPostCode200Response.ApplicationjsonResponseBody) castResponse.body; + // handle deserialized body here +} +``` +[[Back to top]](#top) [[Back to README]](../../../README.md) diff --git a/samples/client/petstore/kotlin/docs/apis/paths/Storeorderorderid.md b/samples/client/petstore/kotlin/docs/apis/paths/Storeorderorderid.md new file mode 100644 index 00000000000..ae48b8fcea4 --- /dev/null +++ b/samples/client/petstore/kotlin/docs/apis/paths/Storeorderorderid.md @@ -0,0 +1,233 @@ +# Storeorderorderid + +public class Storeorderorderid extends extends ApiClient implements +[StoreorderorderidDelete.DeleteOperation](../../paths/storeorderorderid/StoreorderorderidDelete.md#deleteoperation), +[StoreorderorderidGet.GetOperation](../../paths/storeorderorderid/StoreorderorderidGet.md#getoperation) + +an api client class which contains all the routes for path="/store/order/{order_id}" + +## Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| Nothing? | [delete](#delete)([StoreorderorderidDelete.DeleteRequest](../../paths/storeorderorderid/StoreorderorderidDelete.md#deleterequest) request)
For valid response try integer IDs with value < 1000. Anything above 1000 or nonintegers will generate API errors | +| [StoreorderorderidGetResponses.EndpointResponse](../../paths/storeorderorderid/get/StoreorderorderidGetResponses.md#endpointresponse) | [get](#get)([StoreorderorderidGet.GetRequest](../../paths/storeorderorderid/StoreorderorderidGet.md#getrequest) request)
For valid response try integer IDs with value <= 5 or > 10. Other values will generated exceptions | + +## Method Detail + +### delete +public Nothing? delete([StoreorderorderidDelete.DeleteRequest](../../paths/storeorderorderid/StoreorderorderidDelete.md#deleterequest) request) + +For valid response try integer IDs with value < 1000. Anything above 1000 or nonintegers will generate API errors + +**Parameters:**
+request - the input request + +**Returns:**
+nothing (Nothing?) + +**Throws:**
+IOException, InterruptedException - an exception happened when making the request
+ValidationException - the returned response body or header values do not conform the the schema validation requirements
+NotImplementedException - the request body serialization or deserialization has not yet been implemented
+ or the header content type deserialization has not yet been implemented for this contentType
+ApiException - server returned a response/contentType not defined in the openapi document
+ +#### 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.StoreorderorderidDeletePathParameters; +import org.openapijsonschematools.client.servers.RootServer0; +import org.openapijsonschematools.client.servers.RootServer1; +import org.openapijsonschematools.client.servers.RootServer2; +import org.openapijsonschematools.client.paths.storeorderorderid.delete.responses.StoreorderorderidDeleteCode400Response; +import org.openapijsonschematools.client.paths.storeorderorderid.delete.responses.StoreorderorderidDeleteCode404Response; +import org.openapijsonschematools.client.servers.RootServerInfo; +import org.openapijsonschematools.client.apis.paths.Storeorderorderid; +import org.openapijsonschematools.client.paths.storeorderorderid.delete.StoreorderorderidDeleteResponses; + +import java.io.IOException; +import java.util.Arrays; +import java.util.List; +import java.util.Map; +import java.util.AbstractMap; + +// if you want to use a server that is not SERVER_0 pass it in here and change the ServerIndex input below +ApiConfiguration.ServerInfo serverInfo = new ApiConfiguration.ServerInfoBuilder() + .rootServerInfo( + new RootServerInfo.RootServerInfoBuilder() + .rootServer0(new RootServer0()) + .build() + ) + .build(); +ApiConfiguration.ServerIndexInfo serverIndexInfo = new ApiConfiguration.ServerIndexInfoBuilder() + .rootServerInfoServerIndex(RootServerInfo.ServerIndex.SERVER_0) + .build(); +Duration timeout = Duration.ofSeconds(1L); +Map> defaultHeaders = Map.of("User-Agent", List.of("OpenAPI-JSON-Schema-Generator/1.0.0/java")); +ApiConfiguration apiConfiguration = new ApiConfiguration( + serverInfo + serverIndexInfo, + timeout, + defaultHeaders +); +SchemaConfiguration schemaConfiguration = new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().build()); +Storeorderorderid apiClient = new Storeorderorderid(apiConfiguration, schemaConfiguration); + + +// Map validation +StoreorderorderidDeletePathParameters.PathParametersMap pathParameters = + StoreorderorderidDeletePathParameters.StoreorderorderidDeletePathParameters1.validate( + new StoreorderorderidDeletePathParameters.PathParametersMapBuilder() + .order_id("a") + + .build(), + schemaConfiguration +); + +var request = new StoreorderorderidDelete.DeleteRequestBuilder() + .pathParameters(pathParameters) + .build(); + +Nothing? response; +try { + response = apiClient.delete(request); +} catch (StoreorderorderidDeleteCode400Response.ResponseApiException | StoreorderorderidDeleteCode404Response.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; +} +``` +### get +public [StoreorderorderidGetResponses.EndpointResponse](../../paths/storeorderorderid/get/StoreorderorderidGetResponses.md#endpointresponse) get([StoreorderorderidGet.GetRequest](../../paths/storeorderorderid/StoreorderorderidGet.md#getrequest) request) + +For valid response try integer IDs with value <= 5 or > 10. Other values will generated exceptions + +**Parameters:**
+request - the input request + +**Returns:**
+the deserialized response + +**Throws:**
+IOException, InterruptedException - an exception happened when making the request
+ValidationException - the returned response body or header values do not conform the the schema validation requirements
+NotImplementedException - the request body serialization or deserialization has not yet been implemented
+ or the header content type deserialization has not yet been implemented for this contentType
+ApiException - server returned a response/contentType not defined in the openapi document
+ +#### 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.get.StoreorderorderidGetPathParameters; +import org.openapijsonschematools.client.servers.RootServer0; +import org.openapijsonschematools.client.servers.RootServer1; +import org.openapijsonschematools.client.servers.RootServer2; +import org.openapijsonschematools.client.paths.storeorderorderid.get.responses.StoreorderorderidGetCode200Response; +import org.openapijsonschematools.client.paths.storeorderorderid.get.responses.StoreorderorderidGetCode400Response; +import org.openapijsonschematools.client.paths.storeorderorderid.get.responses.StoreorderorderidGetCode404Response; +import org.openapijsonschematools.client.servers.RootServerInfo; +import org.openapijsonschematools.client.apis.paths.Storeorderorderid; +import org.openapijsonschematools.client.paths.storeorderorderid.get.StoreorderorderidGetResponses; + +import java.io.IOException; +import java.util.Arrays; +import java.util.List; +import java.util.Map; +import java.util.AbstractMap; + +// if you want to use a server that is not SERVER_0 pass it in here and change the ServerIndex input below +ApiConfiguration.ServerInfo serverInfo = new ApiConfiguration.ServerInfoBuilder() + .rootServerInfo( + new RootServerInfo.RootServerInfoBuilder() + .rootServer0(new RootServer0()) + .build() + ) + .build(); +ApiConfiguration.ServerIndexInfo serverIndexInfo = new ApiConfiguration.ServerIndexInfoBuilder() + .rootServerInfoServerIndex(RootServerInfo.ServerIndex.SERVER_0) + .build(); +Duration timeout = Duration.ofSeconds(1L); +Map> defaultHeaders = Map.of("User-Agent", List.of("OpenAPI-JSON-Schema-Generator/1.0.0/java")); +ApiConfiguration apiConfiguration = new ApiConfiguration( + serverInfo + serverIndexInfo, + timeout, + defaultHeaders +); +SchemaConfiguration schemaConfiguration = new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().build()); +Storeorderorderid apiClient = new Storeorderorderid(apiConfiguration, schemaConfiguration); + + +// Map validation +StoreorderorderidGetPathParameters.PathParametersMap pathParameters = + StoreorderorderidGetPathParameters.StoreorderorderidGetPathParameters1.validate( + new StoreorderorderidGetPathParameters.PathParametersMapBuilder() + .order_id(1L) + + .build(), + schemaConfiguration +); + +var request = new StoreorderorderidGet.GetRequestBuilder() + .pathParameters(pathParameters) + .build(); + +StoreorderorderidGetResponses.EndpointResponse response; +try { + response = apiClient.get(request); +} catch (StoreorderorderidGetCode400Response.ResponseApiException | StoreorderorderidGetCode404Response.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; +} +StoreorderorderidGetResponses.EndpointStoreorderorderidGetCode200Response castResponse = (StoreorderorderidGetResponses.EndpointStoreorderorderidGetCode200Response) response; +if (castResponse.body instanceof StoreorderorderidGetCode200Response.ApplicationxmlResponseBody deserializedBody) { + // handle deserialized body here +} else { + StoreorderorderidGetCode200Response.ApplicationjsonResponseBody deserializedBody = (StoreorderorderidGetCode200Response.ApplicationjsonResponseBody) castResponse.body; + // handle deserialized body here +} +``` +[[Back to top]](#top) [[Back to README]](../../../README.md) diff --git a/samples/client/petstore/kotlin/docs/apis/paths/User.md b/samples/client/petstore/kotlin/docs/apis/paths/User.md new file mode 100644 index 00000000000..3dd6a3600f9 --- /dev/null +++ b/samples/client/petstore/kotlin/docs/apis/paths/User.md @@ -0,0 +1,133 @@ +# User + +public class User extends extends ApiClient implements +[UserPost.PostOperation](../../paths/user/UserPost.md#postoperation) + +an api client class which contains all the routes for path="/user" + +## Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| [UserPostResponses.EndpointResponse](../../paths/user/post/UserPostResponses.md#endpointresponse) | [post](#post)([UserPost.PostRequest](../../paths/user/UserPost.md#postrequest) request)
This can only be done by the logged in user. | + +## Method Detail + +### post +public [UserPostResponses.EndpointResponse](../../paths/user/post/UserPostResponses.md#endpointresponse) post([UserPost.PostRequest](../../paths/user/UserPost.md#postrequest) request) + +This can only be done by the logged in user. + +**Parameters:**
+request - the input request + +**Returns:**
+the deserialized response + +**Throws:**
+IOException, InterruptedException - an exception happened when making the request
+ValidationException - the returned response body or header values do not conform the the schema validation requirements
+NotImplementedException - the request body serialization or deserialization has not yet been implemented
+ or the header content type deserialization has not yet been implemented for this contentType
+ApiException - server returned a response/contentType not defined in the openapi document
+ +#### 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.user.post.UserPostRequestBody; +import org.openapijsonschematools.client.components.schemas.User; +import org.openapijsonschematools.client.servers.RootServer0; +import org.openapijsonschematools.client.servers.RootServer1; +import org.openapijsonschematools.client.servers.RootServer2; +import org.openapijsonschematools.client.paths.user.post.responses.UserPostCodedefaultResponse; +import org.openapijsonschematools.client.servers.RootServerInfo; +import org.openapijsonschematools.client.apis.paths.User; +import org.openapijsonschematools.client.paths.user.post.UserPostResponses; + +import java.io.IOException; +import java.util.Arrays; +import java.util.List; +import java.util.Map; +import java.util.AbstractMap; + +// if you want to use a server that is not SERVER_0 pass it in here and change the ServerIndex input below +ApiConfiguration.ServerInfo serverInfo = new ApiConfiguration.ServerInfoBuilder() + .rootServerInfo( + new RootServerInfo.RootServerInfoBuilder() + .rootServer0(new RootServer0()) + .build() + ) + .build(); +ApiConfiguration.ServerIndexInfo serverIndexInfo = new ApiConfiguration.ServerIndexInfoBuilder() + .rootServerInfoServerIndex(RootServerInfo.ServerIndex.SERVER_0) + .build(); +Duration timeout = Duration.ofSeconds(1L); +Map> defaultHeaders = Map.of("User-Agent", List.of("OpenAPI-JSON-Schema-Generator/1.0.0/java")); +ApiConfiguration apiConfiguration = new ApiConfiguration( + serverInfo + serverIndexInfo, + timeout, + defaultHeaders +); +SchemaConfiguration schemaConfiguration = new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().build()); +User apiClient = new User(apiConfiguration, schemaConfiguration); + + +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 +); +UserPost.SealedRequestBody requestBody = new UserPost.ApplicationjsonRequestBody(requestBodyPayload); + +var request = new UserPost.PostRequestBuilder() + .requestBody(requestBody) + .build(); + +UserPostResponses.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; +} +UserPostResponses.EndpointUserPostCodedefaultResponse castResponse = (UserPostResponses.EndpointUserPostCodedefaultResponse) response; +``` +[[Back to top]](#top) [[Back to README]](../../../README.md) diff --git a/samples/client/petstore/kotlin/docs/apis/paths/Usercreatewitharray.md b/samples/client/petstore/kotlin/docs/apis/paths/Usercreatewitharray.md new file mode 100644 index 00000000000..a60a10c723e --- /dev/null +++ b/samples/client/petstore/kotlin/docs/apis/paths/Usercreatewitharray.md @@ -0,0 +1,155 @@ +# Usercreatewitharray + +public class Usercreatewitharray extends extends ApiClient implements +[UsercreatewitharrayPost.PostOperation](../../paths/usercreatewitharray/UsercreatewitharrayPost.md#postoperation) + +an api client class which contains all the routes for path="/user/createWithArray" + +## Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| [UsercreatewitharrayPostResponses.EndpointResponse](../../paths/usercreatewitharray/post/UsercreatewitharrayPostResponses.md#endpointresponse) | [post](#post)([UsercreatewitharrayPost.PostRequest](../../paths/usercreatewitharray/UsercreatewitharrayPost.md#postrequest) request)
| + +## Method Detail + +### post +public [UsercreatewitharrayPostResponses.EndpointResponse](../../paths/usercreatewitharray/post/UsercreatewitharrayPostResponses.md#endpointresponse) post([UsercreatewitharrayPost.PostRequest](../../paths/usercreatewitharray/UsercreatewitharrayPost.md#postrequest) request) + + + +**Parameters:**
+request - the input request + +**Returns:**
+the deserialized response + +**Throws:**
+IOException, InterruptedException - an exception happened when making the request
+ValidationException - the returned response body or header values do not conform the the schema validation requirements
+NotImplementedException - the request body serialization or deserialization has not yet been implemented
+ or the header content type deserialization has not yet been implemented for this contentType
+ApiException - server returned a response/contentType not defined in the openapi document
+ +#### 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.UsercreatewitharrayPostRequestBody; +import org.openapijsonschematools.client.components.requestbodies.userarray.content.applicationjson.ApplicationjsonSchema; +import org.openapijsonschematools.client.servers.RootServer0; +import org.openapijsonschematools.client.servers.RootServer1; +import org.openapijsonschematools.client.servers.RootServer2; +import org.openapijsonschematools.client.paths.usercreatewitharray.post.responses.UsercreatewitharrayPostCodedefaultResponse; +import org.openapijsonschematools.client.servers.RootServerInfo; +import org.openapijsonschematools.client.apis.paths.Usercreatewitharray; +import org.openapijsonschematools.client.paths.usercreatewitharray.post.UsercreatewitharrayPostResponses; + +import java.io.IOException; +import java.util.Arrays; +import java.util.List; +import java.util.Map; +import java.util.AbstractMap; + +// if you want to use a server that is not SERVER_0 pass it in here and change the ServerIndex input below +ApiConfiguration.ServerInfo serverInfo = new ApiConfiguration.ServerInfoBuilder() + .rootServerInfo( + new RootServerInfo.RootServerInfoBuilder() + .rootServer0(new RootServer0()) + .build() + ) + .build(); +ApiConfiguration.ServerIndexInfo serverIndexInfo = new ApiConfiguration.ServerIndexInfoBuilder() + .rootServerInfoServerIndex(RootServerInfo.ServerIndex.SERVER_0) + .build(); +Duration timeout = Duration.ofSeconds(1L); +Map> defaultHeaders = Map.of("User-Agent", List.of("OpenAPI-JSON-Schema-Generator/1.0.0/java")); +ApiConfiguration apiConfiguration = new ApiConfiguration( + serverInfo + serverIndexInfo, + timeout, + defaultHeaders +); +SchemaConfiguration schemaConfiguration = new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().build()); +Usercreatewitharray apiClient = new Usercreatewitharray(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 +); +UsercreatewitharrayPostRequestBody.SealedRequestBody requestBody = new UsercreatewitharrayPostRequestBody.ApplicationjsonRequestBody(requestBodyPayload); + +var request = new UsercreatewitharrayPost.PostRequestBuilder() + .requestBody(requestBody) + .build(); + +UsercreatewitharrayPostResponses.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; +} +UsercreatewitharrayPostResponses.EndpointUsercreatewitharrayPostCodedefaultResponse castResponse = (UsercreatewitharrayPostResponses.EndpointUsercreatewitharrayPostCodedefaultResponse) response; +``` +[[Back to top]](#top) [[Back to README]](../../../README.md) diff --git a/samples/client/petstore/kotlin/docs/apis/paths/Usercreatewithlist.md b/samples/client/petstore/kotlin/docs/apis/paths/Usercreatewithlist.md new file mode 100644 index 00000000000..e46aba02776 --- /dev/null +++ b/samples/client/petstore/kotlin/docs/apis/paths/Usercreatewithlist.md @@ -0,0 +1,155 @@ +# Usercreatewithlist + +public class Usercreatewithlist extends extends ApiClient implements +[UsercreatewithlistPost.PostOperation](../../paths/usercreatewithlist/UsercreatewithlistPost.md#postoperation) + +an api client class which contains all the routes for path="/user/createWithList" + +## Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| [UsercreatewithlistPostResponses.EndpointResponse](../../paths/usercreatewithlist/post/UsercreatewithlistPostResponses.md#endpointresponse) | [post](#post)([UsercreatewithlistPost.PostRequest](../../paths/usercreatewithlist/UsercreatewithlistPost.md#postrequest) request)
| + +## Method Detail + +### post +public [UsercreatewithlistPostResponses.EndpointResponse](../../paths/usercreatewithlist/post/UsercreatewithlistPostResponses.md#endpointresponse) post([UsercreatewithlistPost.PostRequest](../../paths/usercreatewithlist/UsercreatewithlistPost.md#postrequest) request) + + + +**Parameters:**
+request - the input request + +**Returns:**
+the deserialized response + +**Throws:**
+IOException, InterruptedException - an exception happened when making the request
+ValidationException - the returned response body or header values do not conform the the schema validation requirements
+NotImplementedException - the request body serialization or deserialization has not yet been implemented
+ or the header content type deserialization has not yet been implemented for this contentType
+ApiException - server returned a response/contentType not defined in the openapi document
+ +#### 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.UsercreatewithlistPostRequestBody; +import org.openapijsonschematools.client.components.requestbodies.userarray.content.applicationjson.ApplicationjsonSchema; +import org.openapijsonschematools.client.servers.RootServer0; +import org.openapijsonschematools.client.servers.RootServer1; +import org.openapijsonschematools.client.servers.RootServer2; +import org.openapijsonschematools.client.paths.usercreatewithlist.post.responses.UsercreatewithlistPostCodedefaultResponse; +import org.openapijsonschematools.client.servers.RootServerInfo; +import org.openapijsonschematools.client.apis.paths.Usercreatewithlist; +import org.openapijsonschematools.client.paths.usercreatewithlist.post.UsercreatewithlistPostResponses; + +import java.io.IOException; +import java.util.Arrays; +import java.util.List; +import java.util.Map; +import java.util.AbstractMap; + +// if you want to use a server that is not SERVER_0 pass it in here and change the ServerIndex input below +ApiConfiguration.ServerInfo serverInfo = new ApiConfiguration.ServerInfoBuilder() + .rootServerInfo( + new RootServerInfo.RootServerInfoBuilder() + .rootServer0(new RootServer0()) + .build() + ) + .build(); +ApiConfiguration.ServerIndexInfo serverIndexInfo = new ApiConfiguration.ServerIndexInfoBuilder() + .rootServerInfoServerIndex(RootServerInfo.ServerIndex.SERVER_0) + .build(); +Duration timeout = Duration.ofSeconds(1L); +Map> defaultHeaders = Map.of("User-Agent", List.of("OpenAPI-JSON-Schema-Generator/1.0.0/java")); +ApiConfiguration apiConfiguration = new ApiConfiguration( + serverInfo + serverIndexInfo, + timeout, + defaultHeaders +); +SchemaConfiguration schemaConfiguration = new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().build()); +Usercreatewithlist apiClient = new Usercreatewithlist(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 +); +UsercreatewithlistPostRequestBody.SealedRequestBody requestBody = new UsercreatewithlistPostRequestBody.ApplicationjsonRequestBody(requestBodyPayload); + +var request = new UsercreatewithlistPost.PostRequestBuilder() + .requestBody(requestBody) + .build(); + +UsercreatewithlistPostResponses.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; +} +UsercreatewithlistPostResponses.EndpointUsercreatewithlistPostCodedefaultResponse castResponse = (UsercreatewithlistPostResponses.EndpointUsercreatewithlistPostCodedefaultResponse) response; +``` +[[Back to top]](#top) [[Back to README]](../../../README.md) diff --git a/samples/client/petstore/kotlin/docs/apis/paths/Userlogin.md b/samples/client/petstore/kotlin/docs/apis/paths/Userlogin.md new file mode 100644 index 00000000000..ea65ab6d1d8 --- /dev/null +++ b/samples/client/petstore/kotlin/docs/apis/paths/Userlogin.md @@ -0,0 +1,129 @@ +# Userlogin + +public class Userlogin extends extends ApiClient implements +[UserloginGet.GetOperation](../../paths/userlogin/UserloginGet.md#getoperation) + +an api client class which contains all the routes for path="/user/login" + +## Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| [UserloginGetResponses.EndpointResponse](../../paths/userlogin/get/UserloginGetResponses.md#endpointresponse) | [get](#get)([UserloginGet.GetRequest](../../paths/userlogin/UserloginGet.md#getrequest) request)
| + +## Method Detail + +### get +public [UserloginGetResponses.EndpointResponse](../../paths/userlogin/get/UserloginGetResponses.md#endpointresponse) get([UserloginGet.GetRequest](../../paths/userlogin/UserloginGet.md#getrequest) request) + + + +**Parameters:**
+request - the input request + +**Returns:**
+the deserialized response + +**Throws:**
+IOException, InterruptedException - an exception happened when making the request
+ValidationException - the returned response body or header values do not conform the the schema validation requirements
+NotImplementedException - the request body serialization or deserialization has not yet been implemented
+ or the header content type deserialization has not yet been implemented for this contentType
+ApiException - server returned a response/contentType not defined in the openapi document
+ +#### 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.userlogin.get.UserloginGetQueryParameters; +import org.openapijsonschematools.client.servers.RootServer0; +import org.openapijsonschematools.client.servers.RootServer1; +import org.openapijsonschematools.client.servers.RootServer2; +import org.openapijsonschematools.client.paths.userlogin.get.responses.UserloginGetCode200Response; +import org.openapijsonschematools.client.paths.userlogin.get.responses.code200response.UserloginGetCode200ResponseHeadersSchema; +import org.openapijsonschematools.client.paths.userlogin.get.responses.UserloginGetCode400Response; +import org.openapijsonschematools.client.servers.RootServerInfo; +import org.openapijsonschematools.client.apis.paths.Userlogin; +import org.openapijsonschematools.client.paths.userlogin.get.UserloginGetResponses; + +import java.io.IOException; +import java.util.Arrays; +import java.util.List; +import java.util.Map; +import java.util.AbstractMap; + +// if you want to use a server that is not SERVER_0 pass it in here and change the ServerIndex input below +ApiConfiguration.ServerInfo serverInfo = new ApiConfiguration.ServerInfoBuilder() + .rootServerInfo( + new RootServerInfo.RootServerInfoBuilder() + .rootServer0(new RootServer0()) + .build() + ) + .build(); +ApiConfiguration.ServerIndexInfo serverIndexInfo = new ApiConfiguration.ServerIndexInfoBuilder() + .rootServerInfoServerIndex(RootServerInfo.ServerIndex.SERVER_0) + .build(); +Duration timeout = Duration.ofSeconds(1L); +Map> defaultHeaders = Map.of("User-Agent", List.of("OpenAPI-JSON-Schema-Generator/1.0.0/java")); +ApiConfiguration apiConfiguration = new ApiConfiguration( + serverInfo + serverIndexInfo, + timeout, + defaultHeaders +); +SchemaConfiguration schemaConfiguration = new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().build()); +Userlogin apiClient = new Userlogin(apiConfiguration, schemaConfiguration); + + +// Map validation +UserloginGetQueryParameters.QueryParametersMap queryParameters = + UserloginGetQueryParameters.UserloginGetQueryParameters1.validate( + new UserloginGetQueryParameters.QueryParametersMapBuilder() + .password("a") + + .username("a") + + .build(), + schemaConfiguration +); + +var request = new UserloginGet.GetRequestBuilder() + .queryParameters(queryParameters) + .build(); + +UserloginGetResponses.EndpointResponse response; +try { + response = apiClient.get(request); +} catch (UserloginGetCode400Response.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; +} +UserloginGetResponses.EndpointUserloginGetCode200Response castResponse = (UserloginGetResponses.EndpointUserloginGetCode200Response) response; +if (castResponse.body instanceof UserloginGetCode200Response.ApplicationxmlResponseBody deserializedBody) { + // handle deserialized body here +} else { + UserloginGetCode200Response.ApplicationjsonResponseBody deserializedBody = (UserloginGetCode200Response.ApplicationjsonResponseBody) castResponse.body; + // handle deserialized body here +} +``` +[[Back to top]](#top) [[Back to README]](../../../README.md) diff --git a/samples/client/petstore/kotlin/docs/apis/paths/Userlogout.md b/samples/client/petstore/kotlin/docs/apis/paths/Userlogout.md new file mode 100644 index 00000000000..a75e1f211ae --- /dev/null +++ b/samples/client/petstore/kotlin/docs/apis/paths/Userlogout.md @@ -0,0 +1,103 @@ +# Userlogout + +public class Userlogout extends extends ApiClient implements +[UserlogoutGet.GetOperation](../../paths/userlogout/UserlogoutGet.md#getoperation) + +an api client class which contains all the routes for path="/user/logout" + +## Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| [UserlogoutGetResponses.EndpointResponse](../../paths/userlogout/get/UserlogoutGetResponses.md#endpointresponse) | [get](#get)([UserlogoutGet.GetRequest](../../paths/userlogout/UserlogoutGet.md#getrequest) request)
| + +## Method Detail + +### get +public [UserlogoutGetResponses.EndpointResponse](../../paths/userlogout/get/UserlogoutGetResponses.md#endpointresponse) get([UserlogoutGet.GetRequest](../../paths/userlogout/UserlogoutGet.md#getrequest) request) + + + +**Parameters:**
+request - the input request + +**Returns:**
+the deserialized response + +**Throws:**
+IOException, InterruptedException - an exception happened when making the request
+ValidationException - the returned response body or header values do not conform the the schema validation requirements
+NotImplementedException - the request body serialization or deserialization has not yet been implemented
+ or the header content type deserialization has not yet been implemented for this contentType
+ApiException - server returned a response/contentType not defined in the openapi document
+ +#### 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.servers.RootServer0; +import org.openapijsonschematools.client.servers.RootServer1; +import org.openapijsonschematools.client.servers.RootServer2; +import org.openapijsonschematools.client.paths.userlogout.get.responses.UserlogoutGetCodedefaultResponse; +import org.openapijsonschematools.client.servers.RootServerInfo; +import org.openapijsonschematools.client.apis.paths.Userlogout; +import org.openapijsonschematools.client.paths.userlogout.get.UserlogoutGetResponses; + +import java.io.IOException; +import java.util.Arrays; +import java.util.List; +import java.util.Map; +import java.util.AbstractMap; + +// if you want to use a server that is not SERVER_0 pass it in here and change the ServerIndex input below +ApiConfiguration.ServerInfo serverInfo = new ApiConfiguration.ServerInfoBuilder() + .rootServerInfo( + new RootServerInfo.RootServerInfoBuilder() + .rootServer0(new RootServer0()) + .build() + ) + .build(); +ApiConfiguration.ServerIndexInfo serverIndexInfo = new ApiConfiguration.ServerIndexInfoBuilder() + .rootServerInfoServerIndex(RootServerInfo.ServerIndex.SERVER_0) + .build(); +Duration timeout = Duration.ofSeconds(1L); +Map> defaultHeaders = Map.of("User-Agent", List.of("OpenAPI-JSON-Schema-Generator/1.0.0/java")); +ApiConfiguration apiConfiguration = new ApiConfiguration( + serverInfo + serverIndexInfo, + timeout, + defaultHeaders +); +SchemaConfiguration schemaConfiguration = new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().build()); +Userlogout apiClient = new Userlogout(apiConfiguration, schemaConfiguration); + + +var request = new UserlogoutGet.GetRequestBuilder().build(); + +UserlogoutGetResponses.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; +} +UserlogoutGetResponses.EndpointUserlogoutGetCodedefaultResponse castResponse = (UserlogoutGetResponses.EndpointUserlogoutGetCodedefaultResponse) response; +``` +[[Back to top]](#top) [[Back to README]](../../../README.md) diff --git a/samples/client/petstore/kotlin/docs/apis/paths/Userusername.md b/samples/client/petstore/kotlin/docs/apis/paths/Userusername.md new file mode 100644 index 00000000000..6b2e46dbfd0 --- /dev/null +++ b/samples/client/petstore/kotlin/docs/apis/paths/Userusername.md @@ -0,0 +1,369 @@ +# Userusername + +public class Userusername extends extends ApiClient implements +[UserusernameDelete.DeleteOperation](../../paths/userusername/UserusernameDelete.md#deleteoperation), +[UserusernameGet.GetOperation](../../paths/userusername/UserusernameGet.md#getoperation), +[UserusernamePut.PutOperation](../../paths/userusername/UserusernamePut.md#putoperation) + +an api client class which contains all the routes for path="/user/{username}" + +## Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| [UserusernameDeleteResponses.EndpointResponse](../../paths/userusername/delete/UserusernameDeleteResponses.md#endpointresponse) | [delete](#delete)([UserusernameDelete.DeleteRequest](../../paths/userusername/UserusernameDelete.md#deleterequest) request)
This can only be done by the logged in user. | +| [UserusernameGetResponses.EndpointResponse](../../paths/userusername/get/UserusernameGetResponses.md#endpointresponse) | [get](#get)([UserusernameGet.GetRequest](../../paths/userusername/UserusernameGet.md#getrequest) request)
| +| Nothing? | [put](#put)([UserusernamePut.PutRequest](../../paths/userusername/UserusernamePut.md#putrequest) request)
This can only be done by the logged in user. | + +## Method Detail + +### delete +public [UserusernameDeleteResponses.EndpointResponse](../../paths/userusername/delete/UserusernameDeleteResponses.md#endpointresponse) delete([UserusernameDelete.DeleteRequest](../../paths/userusername/UserusernameDelete.md#deleterequest) request) + +This can only be done by the logged in user. + +**Parameters:**
+request - the input request + +**Returns:**
+the deserialized response + +**Throws:**
+IOException, InterruptedException - an exception happened when making the request
+ValidationException - the returned response body or header values do not conform the the schema validation requirements
+NotImplementedException - the request body serialization or deserialization has not yet been implemented
+ or the header content type deserialization has not yet been implemented for this contentType
+ApiException - server returned a response/contentType not defined in the openapi document
+ +#### 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.userusername.delete.UserusernameDeletePathParameters; +import org.openapijsonschematools.client.servers.RootServer0; +import org.openapijsonschematools.client.servers.RootServer1; +import org.openapijsonschematools.client.servers.RootServer2; +import org.openapijsonschematools.client.paths.userusername.delete.responses.UserusernameDeleteCode200Response; +import org.openapijsonschematools.client.paths.userusername.delete.responses.UserusernameDeleteCode404Response; +import org.openapijsonschematools.client.servers.RootServerInfo; +import org.openapijsonschematools.client.apis.paths.Userusername; +import org.openapijsonschematools.client.paths.userusername.delete.UserusernameDeleteResponses; + +import java.io.IOException; +import java.util.Arrays; +import java.util.List; +import java.util.Map; +import java.util.AbstractMap; + +// if you want to use a server that is not SERVER_0 pass it in here and change the ServerIndex input below +ApiConfiguration.ServerInfo serverInfo = new ApiConfiguration.ServerInfoBuilder() + .rootServerInfo( + new RootServerInfo.RootServerInfoBuilder() + .rootServer0(new RootServer0()) + .build() + ) + .build(); +ApiConfiguration.ServerIndexInfo serverIndexInfo = new ApiConfiguration.ServerIndexInfoBuilder() + .rootServerInfoServerIndex(RootServerInfo.ServerIndex.SERVER_0) + .build(); +Duration timeout = Duration.ofSeconds(1L); +Map> defaultHeaders = Map.of("User-Agent", List.of("OpenAPI-JSON-Schema-Generator/1.0.0/java")); +ApiConfiguration apiConfiguration = new ApiConfiguration( + serverInfo + serverIndexInfo, + timeout, + defaultHeaders +); +SchemaConfiguration schemaConfiguration = new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().build()); +Userusername apiClient = new Userusername(apiConfiguration, schemaConfiguration); + + +// Map validation +UserusernameDeletePathParameters.PathParametersMap pathParameters = + UserusernameDeletePathParameters.UserusernameDeletePathParameters1.validate( + new UserusernameDeletePathParameters.PathParametersMapBuilder() + .username("a") + + .build(), + schemaConfiguration +); + +var request = new UserusernameDelete.DeleteRequestBuilder() + .pathParameters(pathParameters) + .build(); + +UserusernameDeleteResponses.EndpointResponse response; +try { + response = apiClient.delete(request); +} catch (UserusernameDeleteCode404Response.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; +} +UserusernameDeleteResponses.EndpointUserusernameDeleteCode200Response castResponse = (UserusernameDeleteResponses.EndpointUserusernameDeleteCode200Response) response; +``` +### get +public [UserusernameGetResponses.EndpointResponse](../../paths/userusername/get/UserusernameGetResponses.md#endpointresponse) get([UserusernameGet.GetRequest](../../paths/userusername/UserusernameGet.md#getrequest) request) + + + +**Parameters:**
+request - the input request + +**Returns:**
+the deserialized response + +**Throws:**
+IOException, InterruptedException - an exception happened when making the request
+ValidationException - the returned response body or header values do not conform the the schema validation requirements
+NotImplementedException - the request body serialization or deserialization has not yet been implemented
+ or the header content type deserialization has not yet been implemented for this contentType
+ApiException - server returned a response/contentType not defined in the openapi document
+ +#### 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.userusername.get.UserusernameGetPathParameters; +import org.openapijsonschematools.client.servers.RootServer0; +import org.openapijsonschematools.client.servers.RootServer1; +import org.openapijsonschematools.client.servers.RootServer2; +import org.openapijsonschematools.client.paths.userusername.get.responses.UserusernameGetCode200Response; +import org.openapijsonschematools.client.paths.userusername.get.responses.UserusernameGetCode400Response; +import org.openapijsonschematools.client.paths.userusername.get.responses.UserusernameGetCode404Response; +import org.openapijsonschematools.client.servers.RootServerInfo; +import org.openapijsonschematools.client.apis.paths.Userusername; +import org.openapijsonschematools.client.paths.userusername.get.UserusernameGetResponses; + +import java.io.IOException; +import java.util.Arrays; +import java.util.List; +import java.util.Map; +import java.util.AbstractMap; + +// if you want to use a server that is not SERVER_0 pass it in here and change the ServerIndex input below +ApiConfiguration.ServerInfo serverInfo = new ApiConfiguration.ServerInfoBuilder() + .rootServerInfo( + new RootServerInfo.RootServerInfoBuilder() + .rootServer0(new RootServer0()) + .build() + ) + .build(); +ApiConfiguration.ServerIndexInfo serverIndexInfo = new ApiConfiguration.ServerIndexInfoBuilder() + .rootServerInfoServerIndex(RootServerInfo.ServerIndex.SERVER_0) + .build(); +Duration timeout = Duration.ofSeconds(1L); +Map> defaultHeaders = Map.of("User-Agent", List.of("OpenAPI-JSON-Schema-Generator/1.0.0/java")); +ApiConfiguration apiConfiguration = new ApiConfiguration( + serverInfo + serverIndexInfo, + timeout, + defaultHeaders +); +SchemaConfiguration schemaConfiguration = new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().build()); +Userusername apiClient = new Userusername(apiConfiguration, schemaConfiguration); + + +// Map validation +UserusernameGetPathParameters.PathParametersMap pathParameters = + UserusernameGetPathParameters.UserusernameGetPathParameters1.validate( + new UserusernameGetPathParameters.PathParametersMapBuilder() + .username("a") + + .build(), + schemaConfiguration +); + +var request = new UserusernameGet.GetRequestBuilder() + .pathParameters(pathParameters) + .build(); + +UserusernameGetResponses.EndpointResponse response; +try { + response = apiClient.get(request); +} catch (UserusernameGetCode400Response.ResponseApiException | UserusernameGetCode404Response.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; +} +UserusernameGetResponses.EndpointUserusernameGetCode200Response castResponse = (UserusernameGetResponses.EndpointUserusernameGetCode200Response) response; +if (castResponse.body instanceof UserusernameGetCode200Response.ApplicationxmlResponseBody deserializedBody) { + // handle deserialized body here +} else { + UserusernameGetCode200Response.ApplicationjsonResponseBody deserializedBody = (UserusernameGetCode200Response.ApplicationjsonResponseBody) castResponse.body; + // handle deserialized body here +} +``` +### put +public Nothing? put([UserusernamePut.PutRequest](../../paths/userusername/UserusernamePut.md#putrequest) request) + +This can only be done by the logged in user. + +**Parameters:**
+request - the input request + +**Returns:**
+nothing (Nothing?) + +**Throws:**
+IOException, InterruptedException - an exception happened when making the request
+ValidationException - the returned response body or header values do not conform the the schema validation requirements
+NotImplementedException - the request body serialization or deserialization has not yet been implemented
+ or the header content type deserialization has not yet been implemented for this contentType
+ApiException - server returned a response/contentType not defined in the openapi document
+ +#### 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.userusername.put.UserusernamePutRequestBody; +import org.openapijsonschematools.client.components.schemas.User; +import org.openapijsonschematools.client.paths.userusername.put.UserusernamePutPathParameters; +import org.openapijsonschematools.client.servers.RootServer0; +import org.openapijsonschematools.client.servers.RootServer1; +import org.openapijsonschematools.client.servers.RootServer2; +import org.openapijsonschematools.client.paths.userusername.put.responses.UserusernamePutCode400Response; +import org.openapijsonschematools.client.paths.userusername.put.responses.UserusernamePutCode404Response; +import org.openapijsonschematools.client.servers.RootServerInfo; +import org.openapijsonschematools.client.apis.paths.Userusername; +import org.openapijsonschematools.client.paths.userusername.put.UserusernamePutResponses; + +import java.io.IOException; +import java.util.Arrays; +import java.util.List; +import java.util.Map; +import java.util.AbstractMap; + +// if you want to use a server that is not SERVER_0 pass it in here and change the ServerIndex input below +ApiConfiguration.ServerInfo serverInfo = new ApiConfiguration.ServerInfoBuilder() + .rootServerInfo( + new RootServerInfo.RootServerInfoBuilder() + .rootServer0(new RootServer0()) + .build() + ) + .build(); +ApiConfiguration.ServerIndexInfo serverIndexInfo = new ApiConfiguration.ServerIndexInfoBuilder() + .rootServerInfoServerIndex(RootServerInfo.ServerIndex.SERVER_0) + .build(); +Duration timeout = Duration.ofSeconds(1L); +Map> defaultHeaders = Map.of("User-Agent", List.of("OpenAPI-JSON-Schema-Generator/1.0.0/java")); +ApiConfiguration apiConfiguration = new ApiConfiguration( + serverInfo + serverIndexInfo, + timeout, + defaultHeaders +); +SchemaConfiguration schemaConfiguration = new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().build()); +Userusername apiClient = new Userusername(apiConfiguration, schemaConfiguration); + + +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 +); +UserusernamePut.SealedRequestBody requestBody = new UserusernamePut.ApplicationjsonRequestBody(requestBodyPayload); + +// Map validation +UserusernamePutPathParameters.PathParametersMap pathParameters = + UserusernamePutPathParameters.UserusernamePutPathParameters1.validate( + new UserusernamePutPathParameters.PathParametersMapBuilder() + .username("a") + + .build(), + schemaConfiguration +); + +var request = new UserusernamePut.PutRequestBuilder() + .requestBody(requestBody) + .pathParameters(pathParameters) + .build(); + +Nothing? response; +try { + response = apiClient.put(request); +} catch (UserusernamePutCode400Response.ResponseApiException | UserusernamePutCode404Response.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; +} +``` +[[Back to top]](#top) [[Back to README]](../../../README.md) diff --git a/samples/client/petstore/kotlin/docs/apis/tags/Anotherfake.md b/samples/client/petstore/kotlin/docs/apis/tags/Anotherfake.md new file mode 100644 index 00000000000..b6f57d843bf --- /dev/null +++ b/samples/client/petstore/kotlin/docs/apis/tags/Anotherfake.md @@ -0,0 +1,119 @@ +# Anotherfake + +public class Anotherfake extends extends ApiClient implements +[AnotherfakedummyPatch.Model123TestSpecialTagsOperation](../../paths/anotherfakedummy/AnotherfakedummyPatch.md#model123testspecialtagsoperation) + +an api client class which contains all the routes for tag="$another-fake?" + +## Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| [AnotherfakedummyPatchResponses.EndpointResponse](../../paths/anotherfakedummy/patch/AnotherfakedummyPatchResponses.md#endpointresponse) | [model123TestSpecialTags](#model123testspecialtags)([AnotherfakedummyPatch.PatchRequest](../../paths/anotherfakedummy/AnotherfakedummyPatch.md#patchrequest) request)
To test special tags and operation ID starting with number | + +## Method Detail + +### model123TestSpecialTags +public [AnotherfakedummyPatchResponses.EndpointResponse](../../paths/anotherfakedummy/patch/AnotherfakedummyPatchResponses.md#endpointresponse) model123TestSpecialTags([AnotherfakedummyPatch.PatchRequest](../../paths/anotherfakedummy/AnotherfakedummyPatch.md#patchrequest) request) + +To test special tags and operation ID starting with number + +**Parameters:**
+request - the input request + +**Returns:**
+the deserialized response + +**Throws:**
+IOException, InterruptedException - an exception happened when making the request
+ValidationException - the returned response body or header values do not conform the the schema validation requirements
+NotImplementedException - the request body serialization or deserialization has not yet been implemented
+ or the header content type deserialization has not yet been implemented for this contentType
+ApiException - server returned a response/contentType not defined in the openapi document
+ +#### 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.AnotherfakedummyPatchRequestBody; +import org.openapijsonschematools.client.components.schemas.Client; +import org.openapijsonschematools.client.servers.RootServer0; +import org.openapijsonschematools.client.servers.RootServer1; +import org.openapijsonschematools.client.servers.RootServer2; +import org.openapijsonschematools.client.paths.anotherfakedummy.patch.responses.AnotherfakedummyPatchCode200Response; +import org.openapijsonschematools.client.servers.RootServerInfo; +import org.openapijsonschematools.client.apis.tags.Anotherfake; +import org.openapijsonschematools.client.paths.anotherfakedummy.patch.AnotherfakedummyPatchResponses; + +import java.io.IOException; +import java.util.Arrays; +import java.util.List; +import java.util.Map; +import java.util.AbstractMap; + +// if you want to use a server that is not SERVER_0 pass it in here and change the ServerIndex input below +ApiConfiguration.ServerInfo serverInfo = new ApiConfiguration.ServerInfoBuilder() + .rootServerInfo( + new RootServerInfo.RootServerInfoBuilder() + .rootServer0(new RootServer0()) + .build() + ) + .build(); +ApiConfiguration.ServerIndexInfo serverIndexInfo = new ApiConfiguration.ServerIndexInfoBuilder() + .rootServerInfoServerIndex(RootServerInfo.ServerIndex.SERVER_0) + .build(); +Duration timeout = Duration.ofSeconds(1L); +Map> defaultHeaders = Map.of("User-Agent", List.of("OpenAPI-JSON-Schema-Generator/1.0.0/java")); +ApiConfiguration apiConfiguration = new ApiConfiguration( + serverInfo + serverIndexInfo, + timeout, + defaultHeaders +); +SchemaConfiguration schemaConfiguration = new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().build()); +Anotherfake apiClient = new Anotherfake(apiConfiguration, schemaConfiguration); + + +Client1BoxedMap requestBodyPayload = + Client.Client1.validateAndBox( + new Client.ClientMapBuilder1() + .client("a") + + .build(), + schemaConfiguration +); +AnotherfakedummyPatchRequestBody.SealedRequestBody requestBody = new AnotherfakedummyPatchRequestBody.ApplicationjsonRequestBody(requestBodyPayload); + +var request = new AnotherfakedummyPatch.PatchRequestBuilder() + .requestBody(requestBody) + .build(); + +AnotherfakedummyPatchResponses.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; +} +AnotherfakedummyPatchResponses.EndpointAnotherfakedummyPatchCode200Response castResponse = (AnotherfakedummyPatchResponses.EndpointAnotherfakedummyPatchCode200Response) response; +AnotherfakedummyPatchCode200Response.ApplicationjsonResponseBody deserializedBody = (AnotherfakedummyPatchCode200Response.ApplicationjsonResponseBody) castResponse.body; +// handle deserialized body here +``` +[[Back to top]](#top) [[Back to README]](../../../README.md) diff --git a/samples/client/petstore/kotlin/docs/apis/tags/Default.md b/samples/client/petstore/kotlin/docs/apis/tags/Default.md new file mode 100644 index 00000000000..716930384b1 --- /dev/null +++ b/samples/client/petstore/kotlin/docs/apis/tags/Default.md @@ -0,0 +1,103 @@ +# Default + +public class Default extends extends ApiClient implements +[FooGet.FooGetOperation](../../paths/foo/FooGet.md#foogetoperation) + +an api client class which contains all the routes for tag="default" +operations that lack tags are assigned this default tag + +## Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| [FooGetResponses.EndpointResponse](../../paths/foo/get/FooGetResponses.md#endpointresponse) | [fooGet](#fooget)([FooGet.GetRequest](../../paths/foo/FooGet.md#getrequest) request) | + +## Method Detail + +### fooGet +public [FooGetResponses.EndpointResponse](../../paths/foo/get/FooGetResponses.md#endpointresponse) fooGet([FooGet.GetRequest](../../paths/foo/FooGet.md#getrequest) request) + +**Parameters:**
+request - the input request + +**Returns:**
+the deserialized response + +**Throws:**
+IOException, InterruptedException - an exception happened when making the request
+ValidationException - the returned response body or header values do not conform the the schema validation requirements
+NotImplementedException - the request body serialization or deserialization has not yet been implemented
+ or the header content type deserialization has not yet been implemented for this contentType
+ApiException - server returned a response/contentType not defined in the openapi document
+ +#### 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.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.FooGetCodedefaultResponse; +import org.openapijsonschematools.client.paths.foo.get.FooGetServerInfo; +import org.openapijsonschematools.client.apis.tags.Default; +import org.openapijsonschematools.client.paths.foo.get.FooGetResponses; + +import java.io.IOException; +import java.util.Arrays; +import java.util.List; +import java.util.Map; +import java.util.AbstractMap; + +// if you want to use a server that is not SERVER_0 pass it in here and change the ServerIndex input below +ApiConfiguration.ServerInfo serverInfo = new ApiConfiguration.ServerInfoBuilder() + .fooGetServerInfo( + new FooGetServerInfo.FooGetServerInfoBuilder() + .fooGetServer0(new FooGetServer0()) + .build() + ) + .build(); +ApiConfiguration.ServerIndexInfo serverIndexInfo = new ApiConfiguration.ServerIndexInfoBuilder() + .fooGetServerInfoServerIndex(FooGetServerInfo.ServerIndex.SERVER_0) + .build(); +Duration timeout = Duration.ofSeconds(1L); +Map> defaultHeaders = Map.of("User-Agent", List.of("OpenAPI-JSON-Schema-Generator/1.0.0/java")); +ApiConfiguration apiConfiguration = new ApiConfiguration( + serverInfo + serverIndexInfo, + timeout, + defaultHeaders +); +SchemaConfiguration schemaConfiguration = new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().build()); +Default apiClient = new Default(apiConfiguration, schemaConfiguration); + + +var request = new FooGet.GetRequestBuilder().build(); + +FooGetResponses.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; +} +FooGetResponses.EndpointFooGetCodedefaultResponse castResponse = (FooGetResponses.EndpointFooGetCodedefaultResponse) response; +FooGetCodedefaultResponse.ApplicationjsonResponseBody deserializedBody = (FooGetCodedefaultResponse.ApplicationjsonResponseBody) castResponse.body; +// handle deserialized body here +``` +[[Back to top]](#top) [[Back to README]](../../../README.md) diff --git a/samples/client/petstore/kotlin/docs/apis/tags/Fake.md b/samples/client/petstore/kotlin/docs/apis/tags/Fake.md new file mode 100644 index 00000000000..69b4c83b6d9 --- /dev/null +++ b/samples/client/petstore/kotlin/docs/apis/tags/Fake.md @@ -0,0 +1,4304 @@ +# Fake + +public class Fake extends extends ApiClient implements +[FakejsonpatchPatch.JsonPatchOperation](../../paths/fakejsonpatch/FakejsonpatchPatch.md#jsonpatchoperation), +[FakerefsarrayofenumsPost.ArrayOfEnumsOperation](../../paths/fakerefsarrayofenums/FakerefsarrayofenumsPost.md#arrayofenumsoperation), +[CommonparamsubdirDelete.DeleteCommonParamOperation](../../paths/commonparamsubdir/CommonparamsubdirDelete.md#deletecommonparamoperation), +[CommonparamsubdirGet.GetCommonParamOperation](../../paths/commonparamsubdir/CommonparamsubdirGet.md#getcommonparamoperation), +[CommonparamsubdirPost.PostCommonParamOperation](../../paths/commonparamsubdir/CommonparamsubdirPost.md#postcommonparamoperation), +[FakecasesensitiveparamsPut.CaseSensitiveParamsOperation](../../paths/fakecasesensitiveparams/FakecasesensitiveparamsPut.md#casesensitiveparamsoperation), +[FakewildcardresponsesGet.WildCardResponsesOperation](../../paths/fakewildcardresponses/FakewildcardresponsesGet.md#wildcardresponsesoperation), +[FakebodywithqueryparamsPut.BodyWithQueryParamsOperation](../../paths/fakebodywithqueryparams/FakebodywithqueryparamsPut.md#bodywithqueryparamsoperation), +[FakejsonwithcharsetPost.JsonWithCharsetOperation](../../paths/fakejsonwithcharset/FakejsonwithcharsetPost.md#jsonwithcharsetoperation), +[FakerefsarraymodelPost.ArrayModelOperation](../../paths/fakerefsarraymodel/FakerefsarraymodelPost.md#arraymodeloperation), +[FakehealthGet.FakeHealthGetOperation](../../paths/fakehealth/FakehealthGet.md#fakehealthgetoperation), +[FakerefscomposedoneofnumberwithvalidationsPost.ComposedOneOfDifferentTypesOperation](../../paths/fakerefscomposedoneofnumberwithvalidations/FakerefscomposedoneofnumberwithvalidationsPost.md#composedoneofdifferenttypesoperation), +[FakerefobjinqueryGet.RefObjectInQueryOperation](../../paths/fakerefobjinquery/FakerefobjinqueryGet.md#refobjectinqueryoperation), +[FakebodywithfileschemaPut.BodyWithFileSchemaOperation](../../paths/fakebodywithfileschema/FakebodywithfileschemaPut.md#bodywithfileschemaoperation), +[FakerefsenumPost.StringEnumOperation](../../paths/fakerefsenum/FakerefsenumPost.md#stringenumoperation), +[FakeredirectionGet.RedirectionOperation](../../paths/fakeredirection/FakeredirectionGet.md#redirectionoperation), +[FakeuploadfilePost.UploadFileOperation](../../paths/fakeuploadfile/FakeuploadfilePost.md#uploadfileoperation), +[FakeinlinecompositionPost.InlineCompositionOperation](../../paths/fakeinlinecomposition/FakeinlinecompositionPost.md#inlinecompositionoperation), +[FakeDelete.GroupParametersOperation](../../paths/fake/FakeDelete.md#groupparametersoperation), +[FakeGet.EnumParametersOperation](../../paths/fake/FakeGet.md#enumparametersoperation), +[FakePatch.ClientModelOperation](../../paths/fake/FakePatch.md#clientmodeloperation), +[FakePost.EndpointParametersOperation](../../paths/fake/FakePost.md#endpointparametersoperation), +[FakerefsobjectmodelwithrefpropsPost.ObjectModelWithRefPropsOperation](../../paths/fakerefsobjectmodelwithrefprops/FakerefsobjectmodelwithrefpropsPost.md#objectmodelwithrefpropsoperation), +[FakepemcontenttypeGet.PemContentTypeOperation](../../paths/fakepemcontenttype/FakepemcontenttypeGet.md#pemcontenttypeoperation), +[FakerefsnumberPost.NumberWithValidationsOperation](../../paths/fakerefsnumber/FakerefsnumberPost.md#numberwithvalidationsoperation), +[FakerefsstringPost.ModelStringOperation](../../paths/fakerefsstring/FakerefsstringPost.md#modelstringoperation), +[FakeinlineadditionalpropertiesPost.InlineAdditionalPropertiesOperation](../../paths/fakeinlineadditionalproperties/FakeinlineadditionalpropertiesPost.md#inlineadditionalpropertiesoperation), +[FakerefsmammalPost.MammalOperation](../../paths/fakerefsmammal/FakerefsmammalPost.md#mammaloperation), +[SolidusGet.SlashRouteOperation](../../paths/solidus/SolidusGet.md#slashrouteoperation), +[FakerefsbooleanPost.ModelBooleanOperation](../../paths/fakerefsboolean/FakerefsbooleanPost.md#modelbooleanoperation), +[FakejsonformdataGet.JsonFormDataOperation](../../paths/fakejsonformdata/FakejsonformdataGet.md#jsonformdataoperation), +[Fakeparametercollisions1ababselfabPost.ParameterCollisionsOperation](../../paths/fakeparametercollisions1ababselfab/Fakeparametercollisions1ababselfabPost.md#parametercollisionsoperation), +[FakequeryparamwithjsoncontenttypeGet.QueryParamWithJsonContentTypeOperation](../../paths/fakequeryparamwithjsoncontenttype/FakequeryparamwithjsoncontenttypeGet.md#queryparamwithjsoncontenttypeoperation), +[FakeobjinqueryGet.ObjectInQueryOperation](../../paths/fakeobjinquery/FakeobjinqueryGet.md#objectinqueryoperation), +[FakemultiplesecuritiesGet.MultipleSecuritiesOperation](../../paths/fakemultiplesecurities/FakemultiplesecuritiesGet.md#multiplesecuritiesoperation), +[FaketestqueryparamtersPut.QueryParameterCollectionFormatOperation](../../paths/faketestqueryparamters/FaketestqueryparamtersPut.md#queryparametercollectionformatoperation), +[FakemultipleresponsebodiesGet.MultipleResponseBodiesOperation](../../paths/fakemultipleresponsebodies/FakemultipleresponsebodiesGet.md#multipleresponsebodiesoperation), +[FakeresponsewithoutschemaGet.ResponseWithoutSchemaOperation](../../paths/fakeresponsewithoutschema/FakeresponsewithoutschemaGet.md#responsewithoutschemaoperation), +[FakemultiplerequestbodycontenttypesPost.MultipleRequestBodyContentTypesOperation](../../paths/fakemultiplerequestbodycontenttypes/FakemultiplerequestbodycontenttypesPost.md#multiplerequestbodycontenttypesoperation), +[FakeuploaddownloadfilePost.UploadDownloadFileOperation](../../paths/fakeuploaddownloadfile/FakeuploaddownloadfilePost.md#uploaddownloadfileoperation), +[FakeuploadfilesPost.UploadFilesOperation](../../paths/fakeuploadfiles/FakeuploadfilesPost.md#uploadfilesoperation), +[FakeadditionalpropertieswitharrayofenumsGet.AdditionalPropertiesWithArrayOfEnumsOperation](../../paths/fakeadditionalpropertieswitharrayofenums/FakeadditionalpropertieswitharrayofenumsGet.md#additionalpropertieswitharrayofenumsoperation), +[FakedeletecoffeeidDelete.DeleteCoffeeOperation](../../paths/fakedeletecoffeeid/FakedeletecoffeeidDelete.md#deletecoffeeoperation) + +an api client class which contains all the routes for tag="fake" + +## Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| [FakejsonpatchPatchResponses.EndpointResponse](../../paths/fakejsonpatch/patch/FakejsonpatchPatchResponses.md#endpointresponse) | [jsonPatch](#jsonpatch)([FakejsonpatchPatch.PatchRequest](../../paths/fakejsonpatch/FakejsonpatchPatch.md#patchrequest) request)
json patch route with a requestBody | +| [FakerefsarrayofenumsPostResponses.EndpointResponse](../../paths/fakerefsarrayofenums/post/FakerefsarrayofenumsPostResponses.md#endpointresponse) | [arrayOfEnums](#arrayofenums)([FakerefsarrayofenumsPost.PostRequest](../../paths/fakerefsarrayofenums/FakerefsarrayofenumsPost.md#postrequest) request) | +| [CommonparamsubdirDeleteResponses.EndpointResponse](../../paths/commonparamsubdir/delete/CommonparamsubdirDeleteResponses.md#endpointresponse) | [deleteCommonParam](#deletecommonparam)([CommonparamsubdirDelete.DeleteRequest](../../paths/commonparamsubdir/CommonparamsubdirDelete.md#deleterequest) request)
common param is overwritten | +| [CommonparamsubdirGetResponses.EndpointResponse](../../paths/commonparamsubdir/get/CommonparamsubdirGetResponses.md#endpointresponse) | [getCommonParam](#getcommonparam)([CommonparamsubdirGet.GetRequest](../../paths/commonparamsubdir/CommonparamsubdirGet.md#getrequest) request) | +| [CommonparamsubdirPostResponses.EndpointResponse](../../paths/commonparamsubdir/post/CommonparamsubdirPostResponses.md#endpointresponse) | [postCommonParam](#postcommonparam)([CommonparamsubdirPost.PostRequest](../../paths/commonparamsubdir/CommonparamsubdirPost.md#postrequest) request) | +| [FakecasesensitiveparamsPutResponses.EndpointResponse](../../paths/fakecasesensitiveparams/put/FakecasesensitiveparamsPutResponses.md#endpointresponse) | [caseSensitiveParams](#casesensitiveparams)([FakecasesensitiveparamsPut.PutRequest](../../paths/fakecasesensitiveparams/FakecasesensitiveparamsPut.md#putrequest) request)
Ensures that original naming is used in endpoint params, that way we don't have collisions | +| [FakewildcardresponsesGetResponses.EndpointResponse](../../paths/fakewildcardresponses/get/FakewildcardresponsesGetResponses.md#endpointresponse) | [wildCardResponses](#wildcardresponses)([FakewildcardresponsesGet.GetRequest](../../paths/fakewildcardresponses/FakewildcardresponsesGet.md#getrequest) request) | +| [FakebodywithqueryparamsPutResponses.EndpointResponse](../../paths/fakebodywithqueryparams/put/FakebodywithqueryparamsPutResponses.md#endpointresponse) | [bodyWithQueryParams](#bodywithqueryparams)([FakebodywithqueryparamsPut.PutRequest](../../paths/fakebodywithqueryparams/FakebodywithqueryparamsPut.md#putrequest) request) | +| [FakejsonwithcharsetPostResponses.EndpointResponse](../../paths/fakejsonwithcharset/post/FakejsonwithcharsetPostResponses.md#endpointresponse) | [jsonWithCharset](#jsonwithcharset)([FakejsonwithcharsetPost.PostRequest](../../paths/fakejsonwithcharset/FakejsonwithcharsetPost.md#postrequest) request) | +| [FakerefsarraymodelPostResponses.EndpointResponse](../../paths/fakerefsarraymodel/post/FakerefsarraymodelPostResponses.md#endpointresponse) | [arrayModel](#arraymodel)([FakerefsarraymodelPost.PostRequest](../../paths/fakerefsarraymodel/FakerefsarraymodelPost.md#postrequest) request)
Test serialization of ArrayModel | +| [FakehealthGetResponses.EndpointResponse](../../paths/fakehealth/get/FakehealthGetResponses.md#endpointresponse) | [fakeHealthGet](#fakehealthget)([FakehealthGet.GetRequest](../../paths/fakehealth/FakehealthGet.md#getrequest) request) | +| [FakerefscomposedoneofnumberwithvalidationsPostResponses.EndpointResponse](../../paths/fakerefscomposedoneofnumberwithvalidations/post/FakerefscomposedoneofnumberwithvalidationsPostResponses.md#endpointresponse) | [composedOneOfDifferentTypes](#composedoneofdifferenttypes)([FakerefscomposedoneofnumberwithvalidationsPost.PostRequest](../../paths/fakerefscomposedoneofnumberwithvalidations/FakerefscomposedoneofnumberwithvalidationsPost.md#postrequest) request)
Test serialization of object with $refed properties | +| [FakerefobjinqueryGetResponses.EndpointResponse](../../paths/fakerefobjinquery/get/FakerefobjinqueryGetResponses.md#endpointresponse) | [refObjectInQuery](#refobjectinquery)([FakerefobjinqueryGet.GetRequest](../../paths/fakerefobjinquery/FakerefobjinqueryGet.md#getrequest) request) | +| [FakebodywithfileschemaPutResponses.EndpointResponse](../../paths/fakebodywithfileschema/put/FakebodywithfileschemaPutResponses.md#endpointresponse) | [bodyWithFileSchema](#bodywithfileschema)([FakebodywithfileschemaPut.PutRequest](../../paths/fakebodywithfileschema/FakebodywithfileschemaPut.md#putrequest) request)
For this test, the body for this request much reference a schema named `File`. | +| [FakerefsenumPostResponses.EndpointResponse](../../paths/fakerefsenum/post/FakerefsenumPostResponses.md#endpointresponse) | [stringEnum](#stringenum)([FakerefsenumPost.PostRequest](../../paths/fakerefsenum/FakerefsenumPost.md#postrequest) request)
Test serialization of outer enum | +| [FakeredirectionGetResponses.EndpointResponse](../../paths/fakeredirection/get/FakeredirectionGetResponses.md#endpointresponse) | [redirection](#redirection)([FakeredirectionGet.GetRequest](../../paths/fakeredirection/FakeredirectionGet.md#getrequest) request) | +| [FakeuploadfilePostResponses.EndpointResponse](../../paths/fakeuploadfile/post/FakeuploadfilePostResponses.md#endpointresponse) | [uploadFile](#uploadfile)([FakeuploadfilePost.PostRequest](../../paths/fakeuploadfile/FakeuploadfilePost.md#postrequest) request)
| +| [FakeinlinecompositionPostResponses.EndpointResponse](../../paths/fakeinlinecomposition/post/FakeinlinecompositionPostResponses.md#endpointresponse) | [inlineComposition](#inlinecomposition)([FakeinlinecompositionPost.PostRequest](../../paths/fakeinlinecomposition/FakeinlinecompositionPost.md#postrequest) request)
composed schemas at inline locations + multiple requestBody content types | +| [FakeDeleteResponses.EndpointResponse](../../paths/fake/delete/FakeDeleteResponses.md#endpointresponse) | [groupParameters](#groupparameters)([FakeDelete.DeleteRequest](../../paths/fake/FakeDelete.md#deleterequest) request)
Fake endpoint to test group parameters (optional) | +| [FakeGetResponses.EndpointResponse](../../paths/fake/get/FakeGetResponses.md#endpointresponse) | [enumParameters](#enumparameters)([FakeGet.GetRequest](../../paths/fake/FakeGet.md#getrequest) request)
To test enum parameters | +| [FakePatchResponses.EndpointResponse](../../paths/fake/patch/FakePatchResponses.md#endpointresponse) | [clientModel](#clientmodel)([FakePatch.PatchRequest](../../paths/fake/FakePatch.md#patchrequest) request)
To test "client" model | +| [FakePostResponses.EndpointResponse](../../paths/fake/post/FakePostResponses.md#endpointresponse) | [endpointParameters](#endpointparameters)([FakePost.PostRequest](../../paths/fake/FakePost.md#postrequest) request)
Fake endpoint for testing various parameters
假端點
偽のエンドポイント
가짜 엔드 포인트
| +| [FakerefsobjectmodelwithrefpropsPostResponses.EndpointResponse](../../paths/fakerefsobjectmodelwithrefprops/post/FakerefsobjectmodelwithrefpropsPostResponses.md#endpointresponse) | [objectModelWithRefProps](#objectmodelwithrefprops)([FakerefsobjectmodelwithrefpropsPost.PostRequest](../../paths/fakerefsobjectmodelwithrefprops/FakerefsobjectmodelwithrefpropsPost.md#postrequest) request)
Test serialization of object with $refed properties | +| [FakepemcontenttypeGetResponses.EndpointResponse](../../paths/fakepemcontenttype/get/FakepemcontenttypeGetResponses.md#endpointresponse) | [pemContentType](#pemcontenttype)([FakepemcontenttypeGet.GetRequest](../../paths/fakepemcontenttype/FakepemcontenttypeGet.md#getrequest) request) | +| [FakerefsnumberPostResponses.EndpointResponse](../../paths/fakerefsnumber/post/FakerefsnumberPostResponses.md#endpointresponse) | [numberWithValidations](#numberwithvalidations)([FakerefsnumberPost.PostRequest](../../paths/fakerefsnumber/FakerefsnumberPost.md#postrequest) request)
Test serialization of outer number types | +| [FakerefsstringPostResponses.EndpointResponse](../../paths/fakerefsstring/post/FakerefsstringPostResponses.md#endpointresponse) | [modelString](#modelstring)([FakerefsstringPost.PostRequest](../../paths/fakerefsstring/FakerefsstringPost.md#postrequest) request)
Test serialization of outer string types | +| [FakeinlineadditionalpropertiesPostResponses.EndpointResponse](../../paths/fakeinlineadditionalproperties/post/FakeinlineadditionalpropertiesPostResponses.md#endpointresponse) | [inlineAdditionalProperties](#inlineadditionalproperties)([FakeinlineadditionalpropertiesPost.PostRequest](../../paths/fakeinlineadditionalproperties/FakeinlineadditionalpropertiesPost.md#postrequest) request)
| +| [FakerefsmammalPostResponses.EndpointResponse](../../paths/fakerefsmammal/post/FakerefsmammalPostResponses.md#endpointresponse) | [mammal](#mammal)([FakerefsmammalPost.PostRequest](../../paths/fakerefsmammal/FakerefsmammalPost.md#postrequest) request)
Test serialization of mammals | +| [SolidusGetResponses.EndpointResponse](../../paths/solidus/get/SolidusGetResponses.md#endpointresponse) | [slashRoute](#slashroute)([SolidusGet.GetRequest](../../paths/solidus/SolidusGet.md#getrequest) request) | +| [FakerefsbooleanPostResponses.EndpointResponse](../../paths/fakerefsboolean/post/FakerefsbooleanPostResponses.md#endpointresponse) | [modelBoolean](#modelboolean)([FakerefsbooleanPost.PostRequest](../../paths/fakerefsboolean/FakerefsbooleanPost.md#postrequest) request)
Test serialization of outer boolean types | +| [FakejsonformdataGetResponses.EndpointResponse](../../paths/fakejsonformdata/get/FakejsonformdataGetResponses.md#endpointresponse) | [jsonFormData](#jsonformdata)([FakejsonformdataGet.GetRequest](../../paths/fakejsonformdata/FakejsonformdataGet.md#getrequest) request)
| +| [Fakeparametercollisions1ababselfabPostResponses.EndpointResponse](../../paths/fakeparametercollisions1ababselfab/post/Fakeparametercollisions1ababselfabPostResponses.md#endpointresponse) | [parameterCollisions](#parametercollisions)([Fakeparametercollisions1ababselfabPost.PostRequest](../../paths/fakeparametercollisions1ababselfab/Fakeparametercollisions1ababselfabPost.md#postrequest) request) | +| [FakequeryparamwithjsoncontenttypeGetResponses.EndpointResponse](../../paths/fakequeryparamwithjsoncontenttype/get/FakequeryparamwithjsoncontenttypeGetResponses.md#endpointresponse) | [queryParamWithJsonContentType](#queryparamwithjsoncontenttype)([FakequeryparamwithjsoncontenttypeGet.GetRequest](../../paths/fakequeryparamwithjsoncontenttype/FakequeryparamwithjsoncontenttypeGet.md#getrequest) request) | +| [FakeobjinqueryGetResponses.EndpointResponse](../../paths/fakeobjinquery/get/FakeobjinqueryGetResponses.md#endpointresponse) | [objectInQuery](#objectinquery)([FakeobjinqueryGet.GetRequest](../../paths/fakeobjinquery/FakeobjinqueryGet.md#getrequest) request) | +| [FakemultiplesecuritiesGetResponses.EndpointResponse](../../paths/fakemultiplesecurities/get/FakemultiplesecuritiesGetResponses.md#endpointresponse) | [multipleSecurities](#multiplesecurities)([FakemultiplesecuritiesGet.GetRequest](../../paths/fakemultiplesecurities/FakemultiplesecuritiesGet.md#getrequest) request) | +| [FaketestqueryparamtersPutResponses.EndpointResponse](../../paths/faketestqueryparamters/put/FaketestqueryparamtersPutResponses.md#endpointresponse) | [queryParameterCollectionFormat](#queryparametercollectionformat)([FaketestqueryparamtersPut.PutRequest](../../paths/faketestqueryparamters/FaketestqueryparamtersPut.md#putrequest) request)
To test the collection format in query parameters | +| [FakemultipleresponsebodiesGetResponses.EndpointResponse](../../paths/fakemultipleresponsebodies/get/FakemultipleresponsebodiesGetResponses.md#endpointresponse) | [multipleResponseBodies](#multipleresponsebodies)([FakemultipleresponsebodiesGet.GetRequest](../../paths/fakemultipleresponsebodies/FakemultipleresponsebodiesGet.md#getrequest) request) | +| [FakeresponsewithoutschemaGetResponses.EndpointResponse](../../paths/fakeresponsewithoutschema/get/FakeresponsewithoutschemaGetResponses.md#endpointresponse) | [responseWithoutSchema](#responsewithoutschema)([FakeresponsewithoutschemaGet.GetRequest](../../paths/fakeresponsewithoutschema/FakeresponsewithoutschemaGet.md#getrequest) request) | +| [FakemultiplerequestbodycontenttypesPostResponses.EndpointResponse](../../paths/fakemultiplerequestbodycontenttypes/post/FakemultiplerequestbodycontenttypesPostResponses.md#endpointresponse) | [multipleRequestBodyContentTypes](#multiplerequestbodycontenttypes)([FakemultiplerequestbodycontenttypesPost.PostRequest](../../paths/fakemultiplerequestbodycontenttypes/FakemultiplerequestbodycontenttypesPost.md#postrequest) request)
composed schemas at inline locations + multiple requestBody content types | +| [FakeuploaddownloadfilePostResponses.EndpointResponse](../../paths/fakeuploaddownloadfile/post/FakeuploaddownloadfilePostResponses.md#endpointresponse) | [uploadDownloadFile](#uploaddownloadfile)([FakeuploaddownloadfilePost.PostRequest](../../paths/fakeuploaddownloadfile/FakeuploaddownloadfilePost.md#postrequest) request)
| +| [FakeuploadfilesPostResponses.EndpointResponse](../../paths/fakeuploadfiles/post/FakeuploadfilesPostResponses.md#endpointresponse) | [uploadFiles](#uploadfiles)([FakeuploadfilesPost.PostRequest](../../paths/fakeuploadfiles/FakeuploadfilesPost.md#postrequest) request)
| +| [FakeadditionalpropertieswitharrayofenumsGetResponses.EndpointResponse](../../paths/fakeadditionalpropertieswitharrayofenums/get/FakeadditionalpropertieswitharrayofenumsGetResponses.md#endpointresponse) | [additionalPropertiesWithArrayOfEnums](#additionalpropertieswitharrayofenums)([FakeadditionalpropertieswitharrayofenumsGet.GetRequest](../../paths/fakeadditionalpropertieswitharrayofenums/FakeadditionalpropertieswitharrayofenumsGet.md#getrequest) request) | +| [FakedeletecoffeeidDeleteResponses.EndpointResponse](../../paths/fakedeletecoffeeid/delete/FakedeletecoffeeidDeleteResponses.md#endpointresponse) | [deleteCoffee](#deletecoffee)([FakedeletecoffeeidDelete.DeleteRequest](../../paths/fakedeletecoffeeid/FakedeletecoffeeidDelete.md#deleterequest) request)
Delete the coffee identified by the given id, (delete without request body) | + +## Method Detail + +### jsonPatch +public [FakejsonpatchPatchResponses.EndpointResponse](../../paths/fakejsonpatch/patch/FakejsonpatchPatchResponses.md#endpointresponse) jsonPatch([FakejsonpatchPatch.PatchRequest](../../paths/fakejsonpatch/FakejsonpatchPatch.md#patchrequest) request) + +json patch route with a requestBody + +**Parameters:**
+request - the input request + +**Returns:**
+the deserialized response + +**Throws:**
+IOException, InterruptedException - an exception happened when making the request
+ValidationException - the returned response body or header values do not conform the the schema validation requirements
+NotImplementedException - the request body serialization or deserialization has not yet been implemented
+ or the header content type deserialization has not yet been implemented for this contentType
+ApiException - server returned a response/contentType not defined in the openapi document
+ +#### 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.FakejsonpatchPatchRequestBody; +import org.openapijsonschematools.client.components.schemas.JSONPatchRequest; +import org.openapijsonschematools.client.RootServerInfo; +import org.openapijsonschematools.client.servers.RootServer0; +import org.openapijsonschematools.client.servers.RootServer1; +import org.openapijsonschematools.client.servers.RootServer2; +import org.openapijsonschematools.client.paths.fakejsonpatch.patch.responses.FakejsonpatchPatchCode200Response; +import org.openapijsonschematools.client.servers.RootServerInfo; +import org.openapijsonschematools.client.apis.tags.Fake; +import org.openapijsonschematools.client.paths.fakejsonpatch.patch.FakejsonpatchPatchResponses; + +import java.io.IOException; +import java.util.Arrays; +import java.util.List; +import java.util.Map; +import java.util.AbstractMap; + +// if you want to use a server that is not SERVER_0 pass it in here and change the ServerIndex input below +ApiConfiguration.ServerInfo serverInfo = new ApiConfiguration.ServerInfoBuilder() + .rootServerInfo( + new RootServerInfo.RootServerInfoBuilder() + .rootServer0(new RootServer0()) + .build() + ) + .build(); +ApiConfiguration.ServerIndexInfo serverIndexInfo = new ApiConfiguration.ServerIndexInfoBuilder() + .rootServerInfoServerIndex(RootServerInfo.ServerIndex.SERVER_0) + .build(); +Duration timeout = Duration.ofSeconds(1L); +Map> defaultHeaders = Map.of("User-Agent", List.of("OpenAPI-JSON-Schema-Generator/1.0.0/java")); +ApiConfiguration apiConfiguration = new ApiConfiguration( + serverInfo + serverIndexInfo, + timeout, + defaultHeaders +); +SchemaConfiguration schemaConfiguration = new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().build()); +Fake apiClient = new Fake(apiConfiguration, schemaConfiguration); + + +var request = new FakejsonpatchPatch.PatchRequestBuilder().build(); + +FakejsonpatchPatchResponses.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; +} +FakejsonpatchPatchResponses.EndpointFakejsonpatchPatchCode200Response castResponse = (FakejsonpatchPatchResponses.EndpointFakejsonpatchPatchCode200Response) response; +``` +### arrayOfEnums +public [FakerefsarrayofenumsPostResponses.EndpointResponse](../../paths/fakerefsarrayofenums/post/FakerefsarrayofenumsPostResponses.md#endpointresponse) arrayOfEnums([FakerefsarrayofenumsPost.PostRequest](../../paths/fakerefsarrayofenums/FakerefsarrayofenumsPost.md#postrequest) request) + +**Parameters:**
+request - the input request + +**Returns:**
+the deserialized response + +**Throws:**
+IOException, InterruptedException - an exception happened when making the request
+ValidationException - the returned response body or header values do not conform the the schema validation requirements
+NotImplementedException - the request body serialization or deserialization has not yet been implemented
+ or the header content type deserialization has not yet been implemented for this contentType
+ApiException - server returned a response/contentType not defined in the openapi document
+ +#### 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.FakerefsarrayofenumsPostRequestBody; +import org.openapijsonschematools.client.components.schemas.ArrayOfEnums; +import org.openapijsonschematools.client.RootServerInfo; +import org.openapijsonschematools.client.servers.RootServer0; +import org.openapijsonschematools.client.servers.RootServer1; +import org.openapijsonschematools.client.servers.RootServer2; +import org.openapijsonschematools.client.paths.fakerefsarrayofenums.post.responses.FakerefsarrayofenumsPostCode200Response; +import org.openapijsonschematools.client.servers.RootServerInfo; +import org.openapijsonschematools.client.apis.tags.Fake; +import org.openapijsonschematools.client.paths.fakerefsarrayofenums.post.FakerefsarrayofenumsPostResponses; + +import java.io.IOException; +import java.util.Arrays; +import java.util.List; +import java.util.Map; +import java.util.AbstractMap; + +// if you want to use a server that is not SERVER_0 pass it in here and change the ServerIndex input below +ApiConfiguration.ServerInfo serverInfo = new ApiConfiguration.ServerInfoBuilder() + .rootServerInfo( + new RootServerInfo.RootServerInfoBuilder() + .rootServer0(new RootServer0()) + .build() + ) + .build(); +ApiConfiguration.ServerIndexInfo serverIndexInfo = new ApiConfiguration.ServerIndexInfoBuilder() + .rootServerInfoServerIndex(RootServerInfo.ServerIndex.SERVER_0) + .build(); +Duration timeout = Duration.ofSeconds(1L); +Map> defaultHeaders = Map.of("User-Agent", List.of("OpenAPI-JSON-Schema-Generator/1.0.0/java")); +ApiConfiguration apiConfiguration = new ApiConfiguration( + serverInfo + serverIndexInfo, + timeout, + defaultHeaders +); +SchemaConfiguration schemaConfiguration = new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().build()); +Fake apiClient = new Fake(apiConfiguration, schemaConfiguration); + + +var request = new FakerefsarrayofenumsPost.PostRequestBuilder().build(); + +FakerefsarrayofenumsPostResponses.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; +} +FakerefsarrayofenumsPostResponses.EndpointFakerefsarrayofenumsPostCode200Response castResponse = (FakerefsarrayofenumsPostResponses.EndpointFakerefsarrayofenumsPostCode200Response) response; +FakerefsarrayofenumsPostCode200Response.ApplicationjsonResponseBody deserializedBody = (FakerefsarrayofenumsPostCode200Response.ApplicationjsonResponseBody) castResponse.body; +// handle deserialized body here +``` +### deleteCommonParam +public [CommonparamsubdirDeleteResponses.EndpointResponse](../../paths/commonparamsubdir/delete/CommonparamsubdirDeleteResponses.md#endpointresponse) deleteCommonParam([CommonparamsubdirDelete.DeleteRequest](../../paths/commonparamsubdir/CommonparamsubdirDelete.md#deleterequest) request) + +common param is overwritten + +**Parameters:**
+request - the input request + +**Returns:**
+the deserialized response + +**Throws:**
+IOException, InterruptedException - an exception happened when making the request
+ValidationException - the returned response body or header values do not conform the the schema validation requirements
+NotImplementedException - the request body serialization or deserialization has not yet been implemented
+ or the header content type deserialization has not yet been implemented for this contentType
+ApiException - server returned a response/contentType not defined in the openapi document
+ +#### 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.CommonparamsubdirDeleteHeaderParameters; +import org.openapijsonschematools.client.RootServerInfo; +import org.openapijsonschematools.client.paths.commonparamsubdir.delete.CommonparamsubdirDeletePathParameters; +import org.openapijsonschematools.client.servers.RootServer0; +import org.openapijsonschematools.client.servers.RootServer1; +import org.openapijsonschematools.client.servers.RootServer2; +import org.openapijsonschematools.client.paths.commonparamsubdir.delete.responses.CommonparamsubdirDeleteCode200Response; +import org.openapijsonschematools.client.servers.RootServerInfo; +import org.openapijsonschematools.client.apis.tags.Fake; +import org.openapijsonschematools.client.paths.commonparamsubdir.delete.CommonparamsubdirDeleteResponses; + +import java.io.IOException; +import java.util.Arrays; +import java.util.List; +import java.util.Map; +import java.util.AbstractMap; + +// if you want to use a server that is not SERVER_0 pass it in here and change the ServerIndex input below +ApiConfiguration.ServerInfo serverInfo = new ApiConfiguration.ServerInfoBuilder() + .rootServerInfo( + new RootServerInfo.RootServerInfoBuilder() + .rootServer0(new RootServer0()) + .build() + ) + .build(); +ApiConfiguration.ServerIndexInfo serverIndexInfo = new ApiConfiguration.ServerIndexInfoBuilder() + .rootServerInfoServerIndex(RootServerInfo.ServerIndex.SERVER_0) + .build(); +Duration timeout = Duration.ofSeconds(1L); +Map> defaultHeaders = Map.of("User-Agent", List.of("OpenAPI-JSON-Schema-Generator/1.0.0/java")); +ApiConfiguration apiConfiguration = new ApiConfiguration( + serverInfo + serverIndexInfo, + timeout, + defaultHeaders +); +SchemaConfiguration schemaConfiguration = new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().build()); +Fake apiClient = new Fake(apiConfiguration, schemaConfiguration); + + +// Map validation +CommonparamsubdirDeletePathParameters.PathParametersMap pathParameters = + CommonparamsubdirDeletePathParameters.CommonparamsubdirDeletePathParameters1.validate( + new CommonparamsubdirDeletePathParameters.PathParametersMapBuilder() + .subDir("c") + + .build(), + schemaConfiguration +); + +var request = new CommonparamsubdirDelete.DeleteRequestBuilder() + .pathParameters(pathParameters) + .build(); + +CommonparamsubdirDeleteResponses.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; +} +CommonparamsubdirDeleteResponses.EndpointCommonparamsubdirDeleteCode200Response castResponse = (CommonparamsubdirDeleteResponses.EndpointCommonparamsubdirDeleteCode200Response) response; +``` +### getCommonParam +public [CommonparamsubdirGetResponses.EndpointResponse](../../paths/commonparamsubdir/get/CommonparamsubdirGetResponses.md#endpointresponse) getCommonParam([CommonparamsubdirGet.GetRequest](../../paths/commonparamsubdir/CommonparamsubdirGet.md#getrequest) request) + +**Parameters:**
+request - the input request + +**Returns:**
+the deserialized response + +**Throws:**
+IOException, InterruptedException - an exception happened when making the request
+ValidationException - the returned response body or header values do not conform the the schema validation requirements
+NotImplementedException - the request body serialization or deserialization has not yet been implemented
+ or the header content type deserialization has not yet been implemented for this contentType
+ApiException - server returned a response/contentType not defined in the openapi document
+ +#### 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.get.CommonparamsubdirGetQueryParameters; +import org.openapijsonschematools.client.RootServerInfo; +import org.openapijsonschematools.client.paths.commonparamsubdir.get.CommonparamsubdirGetPathParameters; +import org.openapijsonschematools.client.servers.RootServer0; +import org.openapijsonschematools.client.servers.RootServer1; +import org.openapijsonschematools.client.servers.RootServer2; +import org.openapijsonschematools.client.paths.commonparamsubdir.get.responses.CommonparamsubdirGetCode200Response; +import org.openapijsonschematools.client.servers.RootServerInfo; +import org.openapijsonschematools.client.apis.tags.Fake; +import org.openapijsonschematools.client.paths.commonparamsubdir.get.CommonparamsubdirGetResponses; + +import java.io.IOException; +import java.util.Arrays; +import java.util.List; +import java.util.Map; +import java.util.AbstractMap; + +// if you want to use a server that is not SERVER_0 pass it in here and change the ServerIndex input below +ApiConfiguration.ServerInfo serverInfo = new ApiConfiguration.ServerInfoBuilder() + .rootServerInfo( + new RootServerInfo.RootServerInfoBuilder() + .rootServer0(new RootServer0()) + .build() + ) + .build(); +ApiConfiguration.ServerIndexInfo serverIndexInfo = new ApiConfiguration.ServerIndexInfoBuilder() + .rootServerInfoServerIndex(RootServerInfo.ServerIndex.SERVER_0) + .build(); +Duration timeout = Duration.ofSeconds(1L); +Map> defaultHeaders = Map.of("User-Agent", List.of("OpenAPI-JSON-Schema-Generator/1.0.0/java")); +ApiConfiguration apiConfiguration = new ApiConfiguration( + serverInfo + serverIndexInfo, + timeout, + defaultHeaders +); +SchemaConfiguration schemaConfiguration = new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().build()); +Fake apiClient = new Fake(apiConfiguration, schemaConfiguration); + + +// Map validation +CommonparamsubdirGetPathParameters.PathParametersMap pathParameters = + CommonparamsubdirGetPathParameters.CommonparamsubdirGetPathParameters1.validate( + new CommonparamsubdirGetPathParameters.PathParametersMapBuilder() + .subDir("a") + + .build(), + schemaConfiguration +); + +var request = new CommonparamsubdirGet.GetRequestBuilder() + .pathParameters(pathParameters) + .build(); + +CommonparamsubdirGetResponses.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; +} +CommonparamsubdirGetResponses.EndpointCommonparamsubdirGetCode200Response castResponse = (CommonparamsubdirGetResponses.EndpointCommonparamsubdirGetCode200Response) response; +``` +### postCommonParam +public [CommonparamsubdirPostResponses.EndpointResponse](../../paths/commonparamsubdir/post/CommonparamsubdirPostResponses.md#endpointresponse) postCommonParam([CommonparamsubdirPost.PostRequest](../../paths/commonparamsubdir/CommonparamsubdirPost.md#postrequest) request) + +**Parameters:**
+request - the input request + +**Returns:**
+the deserialized response + +**Throws:**
+IOException, InterruptedException - an exception happened when making the request
+ValidationException - the returned response body or header values do not conform the the schema validation requirements
+NotImplementedException - the request body serialization or deserialization has not yet been implemented
+ or the header content type deserialization has not yet been implemented for this contentType
+ApiException - server returned a response/contentType not defined in the openapi document
+ +#### 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.post.CommonparamsubdirPostHeaderParameters; +import org.openapijsonschematools.client.RootServerInfo; +import org.openapijsonschematools.client.paths.commonparamsubdir.post.CommonparamsubdirPostPathParameters; +import org.openapijsonschematools.client.servers.RootServer0; +import org.openapijsonschematools.client.servers.RootServer1; +import org.openapijsonschematools.client.servers.RootServer2; +import org.openapijsonschematools.client.paths.commonparamsubdir.post.responses.CommonparamsubdirPostCode200Response; +import org.openapijsonschematools.client.servers.RootServerInfo; +import org.openapijsonschematools.client.apis.tags.Fake; +import org.openapijsonschematools.client.paths.commonparamsubdir.post.CommonparamsubdirPostResponses; + +import java.io.IOException; +import java.util.Arrays; +import java.util.List; +import java.util.Map; +import java.util.AbstractMap; + +// if you want to use a server that is not SERVER_0 pass it in here and change the ServerIndex input below +ApiConfiguration.ServerInfo serverInfo = new ApiConfiguration.ServerInfoBuilder() + .rootServerInfo( + new RootServerInfo.RootServerInfoBuilder() + .rootServer0(new RootServer0()) + .build() + ) + .build(); +ApiConfiguration.ServerIndexInfo serverIndexInfo = new ApiConfiguration.ServerIndexInfoBuilder() + .rootServerInfoServerIndex(RootServerInfo.ServerIndex.SERVER_0) + .build(); +Duration timeout = Duration.ofSeconds(1L); +Map> defaultHeaders = Map.of("User-Agent", List.of("OpenAPI-JSON-Schema-Generator/1.0.0/java")); +ApiConfiguration apiConfiguration = new ApiConfiguration( + serverInfo + serverIndexInfo, + timeout, + defaultHeaders +); +SchemaConfiguration schemaConfiguration = new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().build()); +Fake apiClient = new Fake(apiConfiguration, schemaConfiguration); + + +// Map validation +CommonparamsubdirPostPathParameters.PathParametersMap pathParameters = + CommonparamsubdirPostPathParameters.CommonparamsubdirPostPathParameters1.validate( + new CommonparamsubdirPostPathParameters.PathParametersMapBuilder() + .subDir("a") + + .build(), + schemaConfiguration +); + +var request = new CommonparamsubdirPost.PostRequestBuilder() + .pathParameters(pathParameters) + .build(); + +CommonparamsubdirPostResponses.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; +} +CommonparamsubdirPostResponses.EndpointCommonparamsubdirPostCode200Response castResponse = (CommonparamsubdirPostResponses.EndpointCommonparamsubdirPostCode200Response) response; +``` +### caseSensitiveParams +public [FakecasesensitiveparamsPutResponses.EndpointResponse](../../paths/fakecasesensitiveparams/put/FakecasesensitiveparamsPutResponses.md#endpointresponse) caseSensitiveParams([FakecasesensitiveparamsPut.PutRequest](../../paths/fakecasesensitiveparams/FakecasesensitiveparamsPut.md#putrequest) request) + +Ensures that original naming is used in endpoint params, that way we don't have collisions + +**Parameters:**
+request - the input request + +**Returns:**
+the deserialized response + +**Throws:**
+IOException, InterruptedException - an exception happened when making the request
+ValidationException - the returned response body or header values do not conform the the schema validation requirements
+NotImplementedException - the request body serialization or deserialization has not yet been implemented
+ or the header content type deserialization has not yet been implemented for this contentType
+ApiException - server returned a response/contentType not defined in the openapi document
+ +#### 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.fakecasesensitiveparams.put.FakecasesensitiveparamsPutQueryParameters; +import org.openapijsonschematools.client.servers.RootServer0; +import org.openapijsonschematools.client.servers.RootServer1; +import org.openapijsonschematools.client.servers.RootServer2; +import org.openapijsonschematools.client.paths.fakecasesensitiveparams.put.responses.FakecasesensitiveparamsPutCode200Response; +import org.openapijsonschematools.client.servers.RootServerInfo; +import org.openapijsonschematools.client.apis.tags.Fake; +import org.openapijsonschematools.client.paths.fakecasesensitiveparams.put.FakecasesensitiveparamsPutResponses; + +import java.io.IOException; +import java.util.Arrays; +import java.util.List; +import java.util.Map; +import java.util.AbstractMap; + +// if you want to use a server that is not SERVER_0 pass it in here and change the ServerIndex input below +ApiConfiguration.ServerInfo serverInfo = new ApiConfiguration.ServerInfoBuilder() + .rootServerInfo( + new RootServerInfo.RootServerInfoBuilder() + .rootServer0(new RootServer0()) + .build() + ) + .build(); +ApiConfiguration.ServerIndexInfo serverIndexInfo = new ApiConfiguration.ServerIndexInfoBuilder() + .rootServerInfoServerIndex(RootServerInfo.ServerIndex.SERVER_0) + .build(); +Duration timeout = Duration.ofSeconds(1L); +Map> defaultHeaders = Map.of("User-Agent", List.of("OpenAPI-JSON-Schema-Generator/1.0.0/java")); +ApiConfiguration apiConfiguration = new ApiConfiguration( + serverInfo + serverIndexInfo, + timeout, + defaultHeaders +); +SchemaConfiguration schemaConfiguration = new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().build()); +Fake apiClient = new Fake(apiConfiguration, schemaConfiguration); + + +// Map validation +FakecasesensitiveparamsPutQueryParameters.QueryParametersMap queryParameters = + FakecasesensitiveparamsPutQueryParameters.FakecasesensitiveparamsPutQueryParameters1.validate( + new FakecasesensitiveparamsPutQueryParameters.QueryParametersMapBuilder() + .SomeVar("a") + + .someVar("a") + + .some_var("a") + + .build(), + schemaConfiguration +); + +var request = new FakecasesensitiveparamsPut.PutRequestBuilder() + .queryParameters(queryParameters) + .build(); + +FakecasesensitiveparamsPutResponses.EndpointResponse response; +try { + response = apiClient.put(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; +} +FakecasesensitiveparamsPutResponses.EndpointFakecasesensitiveparamsPutCode200Response castResponse = (FakecasesensitiveparamsPutResponses.EndpointFakecasesensitiveparamsPutCode200Response) response; +``` +### wildCardResponses +public [FakewildcardresponsesGetResponses.EndpointResponse](../../paths/fakewildcardresponses/get/FakewildcardresponsesGetResponses.md#endpointresponse) wildCardResponses([FakewildcardresponsesGet.GetRequest](../../paths/fakewildcardresponses/FakewildcardresponsesGet.md#getrequest) request) + +**Parameters:**
+request - the input request + +**Returns:**
+the deserialized response + +**Throws:**
+IOException, InterruptedException - an exception happened when making the request
+ValidationException - the returned response body or header values do not conform the the schema validation requirements
+NotImplementedException - the request body serialization or deserialization has not yet been implemented
+ or the header content type deserialization has not yet been implemented for this contentType
+ApiException - server returned a response/contentType not defined in the openapi document
+ +#### 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.servers.RootServer0; +import org.openapijsonschematools.client.servers.RootServer1; +import org.openapijsonschematools.client.servers.RootServer2; +import org.openapijsonschematools.client.paths.fakewildcardresponses.get.responses.FakewildcardresponsesGetCode1XXResponse; +import org.openapijsonschematools.client.paths.fakewildcardresponses.get.responses.FakewildcardresponsesGetCode200Response; +import org.openapijsonschematools.client.paths.fakewildcardresponses.get.responses.FakewildcardresponsesGetCode2XXResponse; +import org.openapijsonschematools.client.paths.fakewildcardresponses.get.responses.FakewildcardresponsesGetCode3XXResponse; +import org.openapijsonschematools.client.paths.fakewildcardresponses.get.responses.FakewildcardresponsesGetCode4XXResponse; +import org.openapijsonschematools.client.paths.fakewildcardresponses.get.responses.FakewildcardresponsesGetCode5XXResponse; +import org.openapijsonschematools.client.servers.RootServerInfo; +import org.openapijsonschematools.client.apis.tags.Fake; +import org.openapijsonschematools.client.paths.fakewildcardresponses.get.FakewildcardresponsesGetResponses; + +import java.io.IOException; +import java.util.Arrays; +import java.util.List; +import java.util.Map; +import java.util.AbstractMap; + +// if you want to use a server that is not SERVER_0 pass it in here and change the ServerIndex input below +ApiConfiguration.ServerInfo serverInfo = new ApiConfiguration.ServerInfoBuilder() + .rootServerInfo( + new RootServerInfo.RootServerInfoBuilder() + .rootServer0(new RootServer0()) + .build() + ) + .build(); +ApiConfiguration.ServerIndexInfo serverIndexInfo = new ApiConfiguration.ServerIndexInfoBuilder() + .rootServerInfoServerIndex(RootServerInfo.ServerIndex.SERVER_0) + .build(); +Duration timeout = Duration.ofSeconds(1L); +Map> defaultHeaders = Map.of("User-Agent", List.of("OpenAPI-JSON-Schema-Generator/1.0.0/java")); +ApiConfiguration apiConfiguration = new ApiConfiguration( + serverInfo + serverIndexInfo, + timeout, + defaultHeaders +); +SchemaConfiguration schemaConfiguration = new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().build()); +Fake apiClient = new Fake(apiConfiguration, schemaConfiguration); + + +var request = new FakewildcardresponsesGet.GetRequestBuilder().build(); + +FakewildcardresponsesGetResponses.EndpointResponse response; +try { + response = apiClient.get(request); +} catch (FakewildcardresponsesGetCode4XXResponse.ResponseApiException | FakewildcardresponsesGetCode5XXResponse.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; +} +if (response instanceof FakewildcardresponsesGetResponses.EndpointFakewildcardresponsesGetCode1XXResponse castResponse) { + FakewildcardresponsesGetCode1XXResponse.ApplicationjsonResponseBody deserializedBody = (FakewildcardresponsesGetCode1XXResponse.ApplicationjsonResponseBody) castResponse.body; + // handle deserialized body here +} else if (response instanceof FakewildcardresponsesGetResponses.EndpointFakewildcardresponsesGetCode2XXResponse castResponse) { + FakewildcardresponsesGetCode2XXResponse.ApplicationjsonResponseBody deserializedBody = (FakewildcardresponsesGetCode2XXResponse.ApplicationjsonResponseBody) castResponse.body; + // handle deserialized body here +} else if (response instanceof FakewildcardresponsesGetResponses.EndpointFakewildcardresponsesGetCode200Response castResponse) { + FakewildcardresponsesGetCode200Response.ApplicationjsonResponseBody deserializedBody = (FakewildcardresponsesGetCode200Response.ApplicationjsonResponseBody) castResponse.body; + // handle deserialized body here +} else { + FakewildcardresponsesGetResponses.EndpointFakewildcardresponsesGetCode3XXResponse castResponse = (FakewildcardresponsesGetResponses.EndpointFakewildcardresponsesGetCode3XXResponse) response; + FakewildcardresponsesGetCode3XXResponse.ApplicationjsonResponseBody deserializedBody = (FakewildcardresponsesGetCode3XXResponse.ApplicationjsonResponseBody) castResponse.body; + // handle deserialized body here +} +``` +### bodyWithQueryParams +public [FakebodywithqueryparamsPutResponses.EndpointResponse](../../paths/fakebodywithqueryparams/put/FakebodywithqueryparamsPutResponses.md#endpointresponse) bodyWithQueryParams([FakebodywithqueryparamsPut.PutRequest](../../paths/fakebodywithqueryparams/FakebodywithqueryparamsPut.md#putrequest) request) + +**Parameters:**
+request - the input request + +**Returns:**
+the deserialized response + +**Throws:**
+IOException, InterruptedException - an exception happened when making the request
+ValidationException - the returned response body or header values do not conform the the schema validation requirements
+NotImplementedException - the request body serialization or deserialization has not yet been implemented
+ or the header content type deserialization has not yet been implemented for this contentType
+ApiException - server returned a response/contentType not defined in the openapi document
+ +#### 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.fakebodywithqueryparams.put.FakebodywithqueryparamsPutRequestBody; +import org.openapijsonschematools.client.components.schemas.User; +import org.openapijsonschematools.client.paths.fakebodywithqueryparams.put.FakebodywithqueryparamsPutQueryParameters; +import org.openapijsonschematools.client.servers.RootServer0; +import org.openapijsonschematools.client.servers.RootServer1; +import org.openapijsonschematools.client.servers.RootServer2; +import org.openapijsonschematools.client.paths.fakebodywithqueryparams.put.responses.FakebodywithqueryparamsPutCode200Response; +import org.openapijsonschematools.client.servers.RootServerInfo; +import org.openapijsonschematools.client.apis.tags.Fake; +import org.openapijsonschematools.client.paths.fakebodywithqueryparams.put.FakebodywithqueryparamsPutResponses; + +import java.io.IOException; +import java.util.Arrays; +import java.util.List; +import java.util.Map; +import java.util.AbstractMap; + +// if you want to use a server that is not SERVER_0 pass it in here and change the ServerIndex input below +ApiConfiguration.ServerInfo serverInfo = new ApiConfiguration.ServerInfoBuilder() + .rootServerInfo( + new RootServerInfo.RootServerInfoBuilder() + .rootServer0(new RootServer0()) + .build() + ) + .build(); +ApiConfiguration.ServerIndexInfo serverIndexInfo = new ApiConfiguration.ServerIndexInfoBuilder() + .rootServerInfoServerIndex(RootServerInfo.ServerIndex.SERVER_0) + .build(); +Duration timeout = Duration.ofSeconds(1L); +Map> defaultHeaders = Map.of("User-Agent", List.of("OpenAPI-JSON-Schema-Generator/1.0.0/java")); +ApiConfiguration apiConfiguration = new ApiConfiguration( + serverInfo + serverIndexInfo, + timeout, + defaultHeaders +); +SchemaConfiguration schemaConfiguration = new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().build()); +Fake apiClient = new Fake(apiConfiguration, schemaConfiguration); + + +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 +); +FakebodywithqueryparamsPut.SealedRequestBody requestBody = new FakebodywithqueryparamsPut.ApplicationjsonRequestBody(requestBodyPayload); + +// Map validation +FakebodywithqueryparamsPutQueryParameters.QueryParametersMap queryParameters = + FakebodywithqueryparamsPutQueryParameters.FakebodywithqueryparamsPutQueryParameters1.validate( + new FakebodywithqueryparamsPutQueryParameters.QueryParametersMapBuilder() + .query("a") + + .build(), + schemaConfiguration +); + +var request = new FakebodywithqueryparamsPut.PutRequestBuilder() + .requestBody(requestBody) + .queryParameters(queryParameters) + .build(); + +FakebodywithqueryparamsPutResponses.EndpointResponse response; +try { + response = apiClient.put(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; +} +FakebodywithqueryparamsPutResponses.EndpointFakebodywithqueryparamsPutCode200Response castResponse = (FakebodywithqueryparamsPutResponses.EndpointFakebodywithqueryparamsPutCode200Response) response; +``` +### jsonWithCharset +public [FakejsonwithcharsetPostResponses.EndpointResponse](../../paths/fakejsonwithcharset/post/FakejsonwithcharsetPostResponses.md#endpointresponse) jsonWithCharset([FakejsonwithcharsetPost.PostRequest](../../paths/fakejsonwithcharset/FakejsonwithcharsetPost.md#postrequest) request) + +**Parameters:**
+request - the input request + +**Returns:**
+the deserialized response + +**Throws:**
+IOException, InterruptedException - an exception happened when making the request
+ValidationException - the returned response body or header values do not conform the the schema validation requirements
+NotImplementedException - the request body serialization or deserialization has not yet been implemented
+ or the header content type deserialization has not yet been implemented for this contentType
+ApiException - server returned a response/contentType not defined in the openapi document
+ +#### 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.FakejsonwithcharsetPostRequestBody; +import org.openapijsonschematools.client.paths.fakejsonwithcharset.post.requestbody.content.applicationjsoncharsetutf8.Applicationjsoncharsetutf8Schema; +import org.openapijsonschematools.client.RootServerInfo; +import org.openapijsonschematools.client.servers.RootServer0; +import org.openapijsonschematools.client.servers.RootServer1; +import org.openapijsonschematools.client.servers.RootServer2; +import org.openapijsonschematools.client.paths.fakejsonwithcharset.post.responses.FakejsonwithcharsetPostCode200Response; +import org.openapijsonschematools.client.servers.RootServerInfo; +import org.openapijsonschematools.client.apis.tags.Fake; +import org.openapijsonschematools.client.paths.fakejsonwithcharset.post.FakejsonwithcharsetPostResponses; + +import java.io.IOException; +import java.util.Arrays; +import java.util.List; +import java.util.Map; +import java.util.AbstractMap; + +// if you want to use a server that is not SERVER_0 pass it in here and change the ServerIndex input below +ApiConfiguration.ServerInfo serverInfo = new ApiConfiguration.ServerInfoBuilder() + .rootServerInfo( + new RootServerInfo.RootServerInfoBuilder() + .rootServer0(new RootServer0()) + .build() + ) + .build(); +ApiConfiguration.ServerIndexInfo serverIndexInfo = new ApiConfiguration.ServerIndexInfoBuilder() + .rootServerInfoServerIndex(RootServerInfo.ServerIndex.SERVER_0) + .build(); +Duration timeout = Duration.ofSeconds(1L); +Map> defaultHeaders = Map.of("User-Agent", List.of("OpenAPI-JSON-Schema-Generator/1.0.0/java")); +ApiConfiguration apiConfiguration = new ApiConfiguration( + serverInfo + serverIndexInfo, + timeout, + defaultHeaders +); +SchemaConfiguration schemaConfiguration = new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().build()); +Fake apiClient = new Fake(apiConfiguration, schemaConfiguration); + + +var request = new FakejsonwithcharsetPost.PostRequestBuilder().build(); + +FakejsonwithcharsetPostResponses.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; +} +FakejsonwithcharsetPostResponses.EndpointFakejsonwithcharsetPostCode200Response castResponse = (FakejsonwithcharsetPostResponses.EndpointFakejsonwithcharsetPostCode200Response) response; +FakejsonwithcharsetPostCode200Response.Applicationjsoncharsetutf8ResponseBody deserializedBody = (FakejsonwithcharsetPostCode200Response.Applicationjsoncharsetutf8ResponseBody) castResponse.body; +// handle deserialized body here +``` +### arrayModel +public [FakerefsarraymodelPostResponses.EndpointResponse](../../paths/fakerefsarraymodel/post/FakerefsarraymodelPostResponses.md#endpointresponse) arrayModel([FakerefsarraymodelPost.PostRequest](../../paths/fakerefsarraymodel/FakerefsarraymodelPost.md#postrequest) request) + +Test serialization of ArrayModel + +**Parameters:**
+request - the input request + +**Returns:**
+the deserialized response + +**Throws:**
+IOException, InterruptedException - an exception happened when making the request
+ValidationException - the returned response body or header values do not conform the the schema validation requirements
+NotImplementedException - the request body serialization or deserialization has not yet been implemented
+ or the header content type deserialization has not yet been implemented for this contentType
+ApiException - server returned a response/contentType not defined in the openapi document
+ +#### 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.fakerefsarraymodel.post.FakerefsarraymodelPostRequestBody; +import org.openapijsonschematools.client.components.schemas.AnimalFarm; +import org.openapijsonschematools.client.RootServerInfo; +import org.openapijsonschematools.client.servers.RootServer0; +import org.openapijsonschematools.client.servers.RootServer1; +import org.openapijsonschematools.client.servers.RootServer2; +import org.openapijsonschematools.client.paths.fakerefsarraymodel.post.responses.FakerefsarraymodelPostCode200Response; +import org.openapijsonschematools.client.servers.RootServerInfo; +import org.openapijsonschematools.client.apis.tags.Fake; +import org.openapijsonschematools.client.paths.fakerefsarraymodel.post.FakerefsarraymodelPostResponses; + +import java.io.IOException; +import java.util.Arrays; +import java.util.List; +import java.util.Map; +import java.util.AbstractMap; + +// if you want to use a server that is not SERVER_0 pass it in here and change the ServerIndex input below +ApiConfiguration.ServerInfo serverInfo = new ApiConfiguration.ServerInfoBuilder() + .rootServerInfo( + new RootServerInfo.RootServerInfoBuilder() + .rootServer0(new RootServer0()) + .build() + ) + .build(); +ApiConfiguration.ServerIndexInfo serverIndexInfo = new ApiConfiguration.ServerIndexInfoBuilder() + .rootServerInfoServerIndex(RootServerInfo.ServerIndex.SERVER_0) + .build(); +Duration timeout = Duration.ofSeconds(1L); +Map> defaultHeaders = Map.of("User-Agent", List.of("OpenAPI-JSON-Schema-Generator/1.0.0/java")); +ApiConfiguration apiConfiguration = new ApiConfiguration( + serverInfo + serverIndexInfo, + timeout, + defaultHeaders +); +SchemaConfiguration schemaConfiguration = new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().build()); +Fake apiClient = new Fake(apiConfiguration, schemaConfiguration); + + +var request = new FakerefsarraymodelPost.PostRequestBuilder().build(); + +FakerefsarraymodelPostResponses.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; +} +FakerefsarraymodelPostResponses.EndpointFakerefsarraymodelPostCode200Response castResponse = (FakerefsarraymodelPostResponses.EndpointFakerefsarraymodelPostCode200Response) response; +FakerefsarraymodelPostCode200Response.ApplicationjsonResponseBody deserializedBody = (FakerefsarraymodelPostCode200Response.ApplicationjsonResponseBody) castResponse.body; +// handle deserialized body here +``` +### fakeHealthGet +public [FakehealthGetResponses.EndpointResponse](../../paths/fakehealth/get/FakehealthGetResponses.md#endpointresponse) fakeHealthGet([FakehealthGet.GetRequest](../../paths/fakehealth/FakehealthGet.md#getrequest) request) + +**Parameters:**
+request - the input request + +**Returns:**
+the deserialized response + +**Throws:**
+IOException, InterruptedException - an exception happened when making the request
+ValidationException - the returned response body or header values do not conform the the schema validation requirements
+NotImplementedException - the request body serialization or deserialization has not yet been implemented
+ or the header content type deserialization has not yet been implemented for this contentType
+ApiException - server returned a response/contentType not defined in the openapi document
+ +#### 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.servers.RootServer0; +import org.openapijsonschematools.client.servers.RootServer1; +import org.openapijsonschematools.client.servers.RootServer2; +import org.openapijsonschematools.client.paths.fakehealth.get.responses.FakehealthGetCode200Response; +import org.openapijsonschematools.client.servers.RootServerInfo; +import org.openapijsonschematools.client.apis.tags.Fake; +import org.openapijsonschematools.client.paths.fakehealth.get.FakehealthGetResponses; + +import java.io.IOException; +import java.util.Arrays; +import java.util.List; +import java.util.Map; +import java.util.AbstractMap; + +// if you want to use a server that is not SERVER_0 pass it in here and change the ServerIndex input below +ApiConfiguration.ServerInfo serverInfo = new ApiConfiguration.ServerInfoBuilder() + .rootServerInfo( + new RootServerInfo.RootServerInfoBuilder() + .rootServer0(new RootServer0()) + .build() + ) + .build(); +ApiConfiguration.ServerIndexInfo serverIndexInfo = new ApiConfiguration.ServerIndexInfoBuilder() + .rootServerInfoServerIndex(RootServerInfo.ServerIndex.SERVER_0) + .build(); +Duration timeout = Duration.ofSeconds(1L); +Map> defaultHeaders = Map.of("User-Agent", List.of("OpenAPI-JSON-Schema-Generator/1.0.0/java")); +ApiConfiguration apiConfiguration = new ApiConfiguration( + serverInfo + serverIndexInfo, + timeout, + defaultHeaders +); +SchemaConfiguration schemaConfiguration = new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().build()); +Fake apiClient = new Fake(apiConfiguration, schemaConfiguration); + + +var request = new FakehealthGet.GetRequestBuilder().build(); + +FakehealthGetResponses.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; +} +FakehealthGetResponses.EndpointFakehealthGetCode200Response castResponse = (FakehealthGetResponses.EndpointFakehealthGetCode200Response) response; +FakehealthGetCode200Response.ApplicationjsonResponseBody deserializedBody = (FakehealthGetCode200Response.ApplicationjsonResponseBody) castResponse.body; +// handle deserialized body here +``` +### composedOneOfDifferentTypes +public [FakerefscomposedoneofnumberwithvalidationsPostResponses.EndpointResponse](../../paths/fakerefscomposedoneofnumberwithvalidations/post/FakerefscomposedoneofnumberwithvalidationsPostResponses.md#endpointresponse) composedOneOfDifferentTypes([FakerefscomposedoneofnumberwithvalidationsPost.PostRequest](../../paths/fakerefscomposedoneofnumberwithvalidations/FakerefscomposedoneofnumberwithvalidationsPost.md#postrequest) request) + +Test serialization of object with $refed properties + +**Parameters:**
+request - the input request + +**Returns:**
+the deserialized response + +**Throws:**
+IOException, InterruptedException - an exception happened when making the request
+ValidationException - the returned response body or header values do not conform the the schema validation requirements
+NotImplementedException - the request body serialization or deserialization has not yet been implemented
+ or the header content type deserialization has not yet been implemented for this contentType
+ApiException - server returned a response/contentType not defined in the openapi document
+ +#### 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.FakerefscomposedoneofnumberwithvalidationsPostRequestBody; +import org.openapijsonschematools.client.components.schemas.ComposedOneOfDifferentTypes; +import org.openapijsonschematools.client.RootServerInfo; +import org.openapijsonschematools.client.servers.RootServer0; +import org.openapijsonschematools.client.servers.RootServer1; +import org.openapijsonschematools.client.servers.RootServer2; +import org.openapijsonschematools.client.paths.fakerefscomposedoneofnumberwithvalidations.post.responses.FakerefscomposedoneofnumberwithvalidationsPostCode200Response; +import org.openapijsonschematools.client.servers.RootServerInfo; +import org.openapijsonschematools.client.apis.tags.Fake; +import org.openapijsonschematools.client.paths.fakerefscomposedoneofnumberwithvalidations.post.FakerefscomposedoneofnumberwithvalidationsPostResponses; + +import java.io.IOException; +import java.util.Arrays; +import java.util.List; +import java.util.Map; +import java.util.AbstractMap; + +// if you want to use a server that is not SERVER_0 pass it in here and change the ServerIndex input below +ApiConfiguration.ServerInfo serverInfo = new ApiConfiguration.ServerInfoBuilder() + .rootServerInfo( + new RootServerInfo.RootServerInfoBuilder() + .rootServer0(new RootServer0()) + .build() + ) + .build(); +ApiConfiguration.ServerIndexInfo serverIndexInfo = new ApiConfiguration.ServerIndexInfoBuilder() + .rootServerInfoServerIndex(RootServerInfo.ServerIndex.SERVER_0) + .build(); +Duration timeout = Duration.ofSeconds(1L); +Map> defaultHeaders = Map.of("User-Agent", List.of("OpenAPI-JSON-Schema-Generator/1.0.0/java")); +ApiConfiguration apiConfiguration = new ApiConfiguration( + serverInfo + serverIndexInfo, + timeout, + defaultHeaders +); +SchemaConfiguration schemaConfiguration = new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().build()); +Fake apiClient = new Fake(apiConfiguration, schemaConfiguration); + + +var request = new FakerefscomposedoneofnumberwithvalidationsPost.PostRequestBuilder().build(); + +FakerefscomposedoneofnumberwithvalidationsPostResponses.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; +} +FakerefscomposedoneofnumberwithvalidationsPostResponses.EndpointFakerefscomposedoneofnumberwithvalidationsPostCode200Response castResponse = (FakerefscomposedoneofnumberwithvalidationsPostResponses.EndpointFakerefscomposedoneofnumberwithvalidationsPostCode200Response) response; +FakerefscomposedoneofnumberwithvalidationsPostCode200Response.ApplicationjsonResponseBody deserializedBody = (FakerefscomposedoneofnumberwithvalidationsPostCode200Response.ApplicationjsonResponseBody) castResponse.body; +// handle deserialized body here +``` +### refObjectInQuery +public [FakerefobjinqueryGetResponses.EndpointResponse](../../paths/fakerefobjinquery/get/FakerefobjinqueryGetResponses.md#endpointresponse) refObjectInQuery([FakerefobjinqueryGet.GetRequest](../../paths/fakerefobjinquery/FakerefobjinqueryGet.md#getrequest) request) + +**Parameters:**
+request - the input request + +**Returns:**
+the deserialized response + +**Throws:**
+IOException, InterruptedException - an exception happened when making the request
+ValidationException - the returned response body or header values do not conform the the schema validation requirements
+NotImplementedException - the request body serialization or deserialization has not yet been implemented
+ or the header content type deserialization has not yet been implemented for this contentType
+ApiException - server returned a response/contentType not defined in the openapi document
+ +#### 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.fakerefobjinquery.get.FakerefobjinqueryGetQueryParameters; +import org.openapijsonschematools.client.RootServerInfo; +import org.openapijsonschematools.client.servers.RootServer0; +import org.openapijsonschematools.client.servers.RootServer1; +import org.openapijsonschematools.client.servers.RootServer2; +import org.openapijsonschematools.client.paths.fakerefobjinquery.get.responses.FakerefobjinqueryGetCode200Response; +import org.openapijsonschematools.client.servers.RootServerInfo; +import org.openapijsonschematools.client.apis.tags.Fake; +import org.openapijsonschematools.client.paths.fakerefobjinquery.get.FakerefobjinqueryGetResponses; + +import java.io.IOException; +import java.util.Arrays; +import java.util.List; +import java.util.Map; +import java.util.AbstractMap; + +// if you want to use a server that is not SERVER_0 pass it in here and change the ServerIndex input below +ApiConfiguration.ServerInfo serverInfo = new ApiConfiguration.ServerInfoBuilder() + .rootServerInfo( + new RootServerInfo.RootServerInfoBuilder() + .rootServer0(new RootServer0()) + .build() + ) + .build(); +ApiConfiguration.ServerIndexInfo serverIndexInfo = new ApiConfiguration.ServerIndexInfoBuilder() + .rootServerInfoServerIndex(RootServerInfo.ServerIndex.SERVER_0) + .build(); +Duration timeout = Duration.ofSeconds(1L); +Map> defaultHeaders = Map.of("User-Agent", List.of("OpenAPI-JSON-Schema-Generator/1.0.0/java")); +ApiConfiguration apiConfiguration = new ApiConfiguration( + serverInfo + serverIndexInfo, + timeout, + defaultHeaders +); +SchemaConfiguration schemaConfiguration = new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().build()); +Fake apiClient = new Fake(apiConfiguration, schemaConfiguration); + + +var request = new FakerefobjinqueryGet.GetRequestBuilder().build(); + +FakerefobjinqueryGetResponses.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; +} +FakerefobjinqueryGetResponses.EndpointFakerefobjinqueryGetCode200Response castResponse = (FakerefobjinqueryGetResponses.EndpointFakerefobjinqueryGetCode200Response) response; +``` +### bodyWithFileSchema +public [FakebodywithfileschemaPutResponses.EndpointResponse](../../paths/fakebodywithfileschema/put/FakebodywithfileschemaPutResponses.md#endpointresponse) bodyWithFileSchema([FakebodywithfileschemaPut.PutRequest](../../paths/fakebodywithfileschema/FakebodywithfileschemaPut.md#putrequest) request) + +For this test, the body for this request much reference a schema named `File`. + +**Parameters:**
+request - the input request + +**Returns:**
+the deserialized response + +**Throws:**
+IOException, InterruptedException - an exception happened when making the request
+ValidationException - the returned response body or header values do not conform the the schema validation requirements
+NotImplementedException - the request body serialization or deserialization has not yet been implemented
+ or the header content type deserialization has not yet been implemented for this contentType
+ApiException - server returned a response/contentType not defined in the openapi document
+ +#### 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.fakebodywithfileschema.put.FakebodywithfileschemaPutRequestBody; +import org.openapijsonschematools.client.components.schemas.FileSchemaTestClass; +import org.openapijsonschematools.client.servers.RootServer0; +import org.openapijsonschematools.client.servers.RootServer1; +import org.openapijsonschematools.client.servers.RootServer2; +import org.openapijsonschematools.client.paths.fakebodywithfileschema.put.responses.FakebodywithfileschemaPutCode200Response; +import org.openapijsonschematools.client.servers.RootServerInfo; +import org.openapijsonschematools.client.apis.tags.Fake; +import org.openapijsonschematools.client.paths.fakebodywithfileschema.put.FakebodywithfileschemaPutResponses; + +import java.io.IOException; +import java.util.Arrays; +import java.util.List; +import java.util.Map; +import java.util.AbstractMap; + +// if you want to use a server that is not SERVER_0 pass it in here and change the ServerIndex input below +ApiConfiguration.ServerInfo serverInfo = new ApiConfiguration.ServerInfoBuilder() + .rootServerInfo( + new RootServerInfo.RootServerInfoBuilder() + .rootServer0(new RootServer0()) + .build() + ) + .build(); +ApiConfiguration.ServerIndexInfo serverIndexInfo = new ApiConfiguration.ServerIndexInfoBuilder() + .rootServerInfoServerIndex(RootServerInfo.ServerIndex.SERVER_0) + .build(); +Duration timeout = Duration.ofSeconds(1L); +Map> defaultHeaders = Map.of("User-Agent", List.of("OpenAPI-JSON-Schema-Generator/1.0.0/java")); +ApiConfiguration apiConfiguration = new ApiConfiguration( + serverInfo + serverIndexInfo, + timeout, + defaultHeaders +); +SchemaConfiguration schemaConfiguration = new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().build()); +Fake apiClient = new Fake(apiConfiguration, schemaConfiguration); + + +FileSchemaTestClass1BoxedMap requestBodyPayload = + FileSchemaTestClass.FileSchemaTestClass1.validateAndBox( + new FileSchemaTestClass.FileSchemaTestClassMapBuilder() + .files( + Arrays.asList( + ) + ) + .build(), + schemaConfiguration +); +FakebodywithfileschemaPut.SealedRequestBody requestBody = new FakebodywithfileschemaPut.ApplicationjsonRequestBody(requestBodyPayload); + +var request = new FakebodywithfileschemaPut.PutRequestBuilder() + .requestBody(requestBody) + .build(); + +FakebodywithfileschemaPutResponses.EndpointResponse response; +try { + response = apiClient.put(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; +} +FakebodywithfileschemaPutResponses.EndpointFakebodywithfileschemaPutCode200Response castResponse = (FakebodywithfileschemaPutResponses.EndpointFakebodywithfileschemaPutCode200Response) response; +``` +### stringEnum +public [FakerefsenumPostResponses.EndpointResponse](../../paths/fakerefsenum/post/FakerefsenumPostResponses.md#endpointresponse) stringEnum([FakerefsenumPost.PostRequest](../../paths/fakerefsenum/FakerefsenumPost.md#postrequest) request) + +Test serialization of outer enum + +**Parameters:**
+request - the input request + +**Returns:**
+the deserialized response + +**Throws:**
+IOException, InterruptedException - an exception happened when making the request
+ValidationException - the returned response body or header values do not conform the the schema validation requirements
+NotImplementedException - the request body serialization or deserialization has not yet been implemented
+ or the header content type deserialization has not yet been implemented for this contentType
+ApiException - server returned a response/contentType not defined in the openapi document
+ +#### 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.FakerefsenumPostRequestBody; +import org.openapijsonschematools.client.components.schemas.StringEnum; +import org.openapijsonschematools.client.RootServerInfo; +import org.openapijsonschematools.client.servers.RootServer0; +import org.openapijsonschematools.client.servers.RootServer1; +import org.openapijsonschematools.client.servers.RootServer2; +import org.openapijsonschematools.client.paths.fakerefsenum.post.responses.FakerefsenumPostCode200Response; +import org.openapijsonschematools.client.servers.RootServerInfo; +import org.openapijsonschematools.client.apis.tags.Fake; +import org.openapijsonschematools.client.paths.fakerefsenum.post.FakerefsenumPostResponses; + +import java.io.IOException; +import java.util.Arrays; +import java.util.List; +import java.util.Map; +import java.util.AbstractMap; + +// if you want to use a server that is not SERVER_0 pass it in here and change the ServerIndex input below +ApiConfiguration.ServerInfo serverInfo = new ApiConfiguration.ServerInfoBuilder() + .rootServerInfo( + new RootServerInfo.RootServerInfoBuilder() + .rootServer0(new RootServer0()) + .build() + ) + .build(); +ApiConfiguration.ServerIndexInfo serverIndexInfo = new ApiConfiguration.ServerIndexInfoBuilder() + .rootServerInfoServerIndex(RootServerInfo.ServerIndex.SERVER_0) + .build(); +Duration timeout = Duration.ofSeconds(1L); +Map> defaultHeaders = Map.of("User-Agent", List.of("OpenAPI-JSON-Schema-Generator/1.0.0/java")); +ApiConfiguration apiConfiguration = new ApiConfiguration( + serverInfo + serverIndexInfo, + timeout, + defaultHeaders +); +SchemaConfiguration schemaConfiguration = new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().build()); +Fake apiClient = new Fake(apiConfiguration, schemaConfiguration); + + +var request = new FakerefsenumPost.PostRequestBuilder().build(); + +FakerefsenumPostResponses.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; +} +FakerefsenumPostResponses.EndpointFakerefsenumPostCode200Response castResponse = (FakerefsenumPostResponses.EndpointFakerefsenumPostCode200Response) response; +FakerefsenumPostCode200Response.ApplicationjsonResponseBody deserializedBody = (FakerefsenumPostCode200Response.ApplicationjsonResponseBody) castResponse.body; +// handle deserialized body here +``` +### redirection +public [FakeredirectionGetResponses.EndpointResponse](../../paths/fakeredirection/get/FakeredirectionGetResponses.md#endpointresponse) redirection([FakeredirectionGet.GetRequest](../../paths/fakeredirection/FakeredirectionGet.md#getrequest) request) + +**Parameters:**
+request - the input request + +**Returns:**
+the deserialized response + +**Throws:**
+IOException, InterruptedException - an exception happened when making the request
+ValidationException - the returned response body or header values do not conform the the schema validation requirements
+NotImplementedException - the request body serialization or deserialization has not yet been implemented
+ or the header content type deserialization has not yet been implemented for this contentType
+ApiException - server returned a response/contentType not defined in the openapi document
+ +#### 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.servers.RootServer0; +import org.openapijsonschematools.client.servers.RootServer1; +import org.openapijsonschematools.client.servers.RootServer2; +import org.openapijsonschematools.client.paths.fakeredirection.get.responses.FakeredirectionGetCode303Response; +import org.openapijsonschematools.client.paths.fakeredirection.get.responses.FakeredirectionGetCode3XXResponse; +import org.openapijsonschematools.client.servers.RootServerInfo; +import org.openapijsonschematools.client.apis.tags.Fake; +import org.openapijsonschematools.client.paths.fakeredirection.get.FakeredirectionGetResponses; + +import java.io.IOException; +import java.util.Arrays; +import java.util.List; +import java.util.Map; +import java.util.AbstractMap; + +// if you want to use a server that is not SERVER_0 pass it in here and change the ServerIndex input below +ApiConfiguration.ServerInfo serverInfo = new ApiConfiguration.ServerInfoBuilder() + .rootServerInfo( + new RootServerInfo.RootServerInfoBuilder() + .rootServer0(new RootServer0()) + .build() + ) + .build(); +ApiConfiguration.ServerIndexInfo serverIndexInfo = new ApiConfiguration.ServerIndexInfoBuilder() + .rootServerInfoServerIndex(RootServerInfo.ServerIndex.SERVER_0) + .build(); +Duration timeout = Duration.ofSeconds(1L); +Map> defaultHeaders = Map.of("User-Agent", List.of("OpenAPI-JSON-Schema-Generator/1.0.0/java")); +ApiConfiguration apiConfiguration = new ApiConfiguration( + serverInfo + serverIndexInfo, + timeout, + defaultHeaders +); +SchemaConfiguration schemaConfiguration = new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().build()); +Fake apiClient = new Fake(apiConfiguration, schemaConfiguration); + + +var request = new FakeredirectionGet.GetRequestBuilder().build(); + +FakeredirectionGetResponses.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; +} +if (response instanceof FakeredirectionGetResponses.EndpointFakeredirectionGetCode3XXResponse castResponse) { +} else { + FakeredirectionGetResponses.EndpointFakeredirectionGetCode303Response castResponse = (FakeredirectionGetResponses.EndpointFakeredirectionGetCode303Response) response; +} +``` +### uploadFile +public [FakeuploadfilePostResponses.EndpointResponse](../../paths/fakeuploadfile/post/FakeuploadfilePostResponses.md#endpointresponse) uploadFile([FakeuploadfilePost.PostRequest](../../paths/fakeuploadfile/FakeuploadfilePost.md#postrequest) request) + + + +**Parameters:**
+request - the input request + +**Returns:**
+the deserialized response + +**Throws:**
+IOException, InterruptedException - an exception happened when making the request
+ValidationException - the returned response body or header values do not conform the the schema validation requirements
+NotImplementedException - the request body serialization or deserialization has not yet been implemented
+ or the header content type deserialization has not yet been implemented for this contentType
+ApiException - server returned a response/contentType not defined in the openapi document
+ +#### 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.FakeuploadfilePostRequestBody; +import org.openapijsonschematools.client.paths.fakeuploadfile.post.requestbody.content.multipartformdata.MultipartformdataSchema; +import org.openapijsonschematools.client.RootServerInfo; +import org.openapijsonschematools.client.servers.RootServer0; +import org.openapijsonschematools.client.servers.RootServer1; +import org.openapijsonschematools.client.servers.RootServer2; +import org.openapijsonschematools.client.paths.fakeuploadfile.post.responses.FakeuploadfilePostCode200Response; +import org.openapijsonschematools.client.servers.RootServerInfo; +import org.openapijsonschematools.client.apis.tags.Fake; +import org.openapijsonschematools.client.paths.fakeuploadfile.post.FakeuploadfilePostResponses; + +import java.io.IOException; +import java.util.Arrays; +import java.util.List; +import java.util.Map; +import java.util.AbstractMap; + +// if you want to use a server that is not SERVER_0 pass it in here and change the ServerIndex input below +ApiConfiguration.ServerInfo serverInfo = new ApiConfiguration.ServerInfoBuilder() + .rootServerInfo( + new RootServerInfo.RootServerInfoBuilder() + .rootServer0(new RootServer0()) + .build() + ) + .build(); +ApiConfiguration.ServerIndexInfo serverIndexInfo = new ApiConfiguration.ServerIndexInfoBuilder() + .rootServerInfoServerIndex(RootServerInfo.ServerIndex.SERVER_0) + .build(); +Duration timeout = Duration.ofSeconds(1L); +Map> defaultHeaders = Map.of("User-Agent", List.of("OpenAPI-JSON-Schema-Generator/1.0.0/java")); +ApiConfiguration apiConfiguration = new ApiConfiguration( + serverInfo + serverIndexInfo, + timeout, + defaultHeaders +); +SchemaConfiguration schemaConfiguration = new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().build()); +Fake apiClient = new Fake(apiConfiguration, schemaConfiguration); + + +var request = new FakeuploadfilePost.PostRequestBuilder().build(); + +FakeuploadfilePostResponses.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; +} +FakeuploadfilePostResponses.EndpointFakeuploadfilePostCode200Response castResponse = (FakeuploadfilePostResponses.EndpointFakeuploadfilePostCode200Response) response; +FakeuploadfilePostCode200Response.ApplicationjsonResponseBody deserializedBody = (FakeuploadfilePostCode200Response.ApplicationjsonResponseBody) castResponse.body; +// handle deserialized body here +``` +### inlineComposition +public [FakeinlinecompositionPostResponses.EndpointResponse](../../paths/fakeinlinecomposition/post/FakeinlinecompositionPostResponses.md#endpointresponse) inlineComposition([FakeinlinecompositionPost.PostRequest](../../paths/fakeinlinecomposition/FakeinlinecompositionPost.md#postrequest) request) + +composed schemas at inline locations + multiple requestBody content types + +**Parameters:**
+request - the input request + +**Returns:**
+the deserialized response + +**Throws:**
+IOException, InterruptedException - an exception happened when making the request
+ValidationException - the returned response body or header values do not conform the the schema validation requirements
+NotImplementedException - the request body serialization or deserialization has not yet been implemented
+ or the header content type deserialization has not yet been implemented for this contentType
+ApiException - server returned a response/contentType not defined in the openapi document
+ +#### 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.FakeinlinecompositionPostRequestBody; +import org.openapijsonschematools.client.paths.fakeinlinecomposition.post.requestbody.content.applicationjson.ApplicationjsonSchema; +import org.openapijsonschematools.client.paths.fakeinlinecomposition.post.FakeinlinecompositionPostQueryParameters; +import org.openapijsonschematools.client.RootServerInfo; +import org.openapijsonschematools.client.servers.RootServer0; +import org.openapijsonschematools.client.servers.RootServer1; +import org.openapijsonschematools.client.servers.RootServer2; +import org.openapijsonschematools.client.paths.fakeinlinecomposition.post.responses.FakeinlinecompositionPostCode200Response; +import org.openapijsonschematools.client.servers.RootServerInfo; +import org.openapijsonschematools.client.apis.tags.Fake; +import org.openapijsonschematools.client.paths.fakeinlinecomposition.post.FakeinlinecompositionPostResponses; + +import java.io.IOException; +import java.util.Arrays; +import java.util.List; +import java.util.Map; +import java.util.AbstractMap; + +// if you want to use a server that is not SERVER_0 pass it in here and change the ServerIndex input below +ApiConfiguration.ServerInfo serverInfo = new ApiConfiguration.ServerInfoBuilder() + .rootServerInfo( + new RootServerInfo.RootServerInfoBuilder() + .rootServer0(new RootServer0()) + .build() + ) + .build(); +ApiConfiguration.ServerIndexInfo serverIndexInfo = new ApiConfiguration.ServerIndexInfoBuilder() + .rootServerInfoServerIndex(RootServerInfo.ServerIndex.SERVER_0) + .build(); +Duration timeout = Duration.ofSeconds(1L); +Map> defaultHeaders = Map.of("User-Agent", List.of("OpenAPI-JSON-Schema-Generator/1.0.0/java")); +ApiConfiguration apiConfiguration = new ApiConfiguration( + serverInfo + serverIndexInfo, + timeout, + defaultHeaders +); +SchemaConfiguration schemaConfiguration = new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().build()); +Fake apiClient = new Fake(apiConfiguration, schemaConfiguration); + + +var request = new FakeinlinecompositionPost.PostRequestBuilder().build(); + +FakeinlinecompositionPostResponses.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; +} +FakeinlinecompositionPostResponses.EndpointFakeinlinecompositionPostCode200Response castResponse = (FakeinlinecompositionPostResponses.EndpointFakeinlinecompositionPostCode200Response) response; +if (castResponse.body instanceof FakeinlinecompositionPostCode200Response.ApplicationjsonResponseBody deserializedBody) { + // handle deserialized body here +} else { + FakeinlinecompositionPostCode200Response.MultipartformdataResponseBody deserializedBody = (FakeinlinecompositionPostCode200Response.MultipartformdataResponseBody) castResponse.body; + // handle deserialized body here +} +``` +### groupParameters +public [FakeDeleteResponses.EndpointResponse](../../paths/fake/delete/FakeDeleteResponses.md#endpointresponse) groupParameters([FakeDelete.DeleteRequest](../../paths/fake/FakeDelete.md#deleterequest) request) + +Fake endpoint to test group parameters (optional) + +**Parameters:**
+request - the input request + +**Returns:**
+the deserialized response + +**Throws:**
+IOException, InterruptedException - an exception happened when making the request
+ValidationException - the returned response body or header values do not conform the the schema validation requirements
+NotImplementedException - the request body serialization or deserialization has not yet been implemented
+ or the header content type deserialization has not yet been implemented for this contentType
+ApiException - server returned a response/contentType not defined in the openapi document
+ +#### 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.fake.delete.FakeDeleteSecurityInfo; +import org.openapijsonschematools.client.paths.fake.delete.FakeDeleteHeaderParameters; +import org.openapijsonschematools.client.paths.fake.delete.FakeDeleteQueryParameters; +import org.openapijsonschematools.client.servers.RootServer0; +import org.openapijsonschematools.client.servers.RootServer1; +import org.openapijsonschematools.client.servers.RootServer2; +import org.openapijsonschematools.client.securityschemes.SecurityScheme; +import org.openapijsonschematools.client.components.securityschemes.BearerTest; +import org.openapijsonschematools.client.paths.fake.delete.responses.FakeDeleteCode200Response; +import org.openapijsonschematools.client.servers.RootServerInfo; +import org.openapijsonschematools.client.apis.tags.Fake; +import org.openapijsonschematools.client.paths.fake.delete.FakeDeleteResponses; + +import java.io.IOException; +import java.util.Arrays; +import java.util.List; +import java.util.Map; +import java.util.AbstractMap; + +// if you want to use a server that is not SERVER_0 pass it in here and change the ServerIndex input below +ApiConfiguration.ServerInfo serverInfo = new ApiConfiguration.ServerInfoBuilder() + .rootServerInfo( + new RootServerInfo.RootServerInfoBuilder() + .rootServer0(new RootServer0()) + .build() + ) + .build(); +ApiConfiguration.ServerIndexInfo serverIndexInfo = new ApiConfiguration.ServerIndexInfoBuilder() + .rootServerInfoServerIndex(RootServerInfo.ServerIndex.SERVER_0) + .build(); +List securitySchemes = new ArrayList(); +securitySchemes.add( + new BearerTest("someAccessToken"); +); +ApiConfiguration.SecurityIndexInfo securityIndexInfo = new ApiConfiguration.SecurityIndexInfoBuilder() + .fakeDeleteSecurityRequirementObject0SecurityIndex(FakeDeleteSecurityRequirementObject0.SecurityIndex.SECURITY_0) + .build(); +Duration timeout = Duration.ofSeconds(1L); +Map> defaultHeaders = Map.of("User-Agent", List.of("OpenAPI-JSON-Schema-Generator/1.0.0/java")); +ApiConfiguration apiConfiguration = new ApiConfiguration( + serverInfo + serverIndexInfo, + securitySchemes, + securityIndexInfo, + timeout, + defaultHeaders +); +SchemaConfiguration schemaConfiguration = new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().build()); +Fake apiClient = new Fake(apiConfiguration, schemaConfiguration); + + +// Map validation +FakeDeleteHeaderParameters.HeaderParametersMap headerParameters = + FakeDeleteHeaderParameters.FakeDeleteHeaderParameters1.validate( + new FakeDeleteHeaderParameters.HeaderParametersMapBuilder() + .required_boolean_group("true") + + .boolean_group("true") + + .build(), + schemaConfiguration +); + +// Map validation +FakeDeleteQueryParameters.QueryParametersMap queryParameters = + FakeDeleteQueryParameters.FakeDeleteQueryParameters1.validate( + new FakeDeleteQueryParameters.QueryParametersMapBuilder() + .required_int64_group(1L) + + .required_string_group("a") + + .int64_group(1L) + + .string_group("a") + + .build(), + schemaConfiguration +); + +var request = new FakeDelete.DeleteRequestBuilder() + .headerParameters(headerParameters) + .queryParameters(queryParameters) + .build(); + +FakeDeleteResponses.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; +} +FakeDeleteResponses.EndpointFakeDeleteCode200Response castResponse = (FakeDeleteResponses.EndpointFakeDeleteCode200Response) response; +``` +### enumParameters +public [FakeGetResponses.EndpointResponse](../../paths/fake/get/FakeGetResponses.md#endpointresponse) enumParameters([FakeGet.GetRequest](../../paths/fake/FakeGet.md#getrequest) request) + +To test enum parameters + +**Parameters:**
+request - the input request + +**Returns:**
+the deserialized response + +**Throws:**
+IOException, InterruptedException - an exception happened when making the request
+ValidationException - the returned response body or header values do not conform the the schema validation requirements
+NotImplementedException - the request body serialization or deserialization has not yet been implemented
+ or the header content type deserialization has not yet been implemented for this contentType
+ApiException - server returned a response/contentType not defined in the openapi document
+ +#### 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.fake.get.FakeGetRequestBody; +import org.openapijsonschematools.client.paths.fake.get.requestbody.content.applicationxwwwformurlencoded.ApplicationxwwwformurlencodedSchema; +import org.openapijsonschematools.client.paths.fake.get.FakeGetHeaderParameters; +import org.openapijsonschematools.client.paths.fake.get.FakeGetQueryParameters; +import org.openapijsonschematools.client.RootServerInfo; +import org.openapijsonschematools.client.servers.RootServer0; +import org.openapijsonschematools.client.servers.RootServer1; +import org.openapijsonschematools.client.servers.RootServer2; +import org.openapijsonschematools.client.paths.fake.get.responses.FakeGetCode200Response; +import org.openapijsonschematools.client.paths.fake.get.responses.FakeGetCode404Response; +import org.openapijsonschematools.client.servers.RootServerInfo; +import org.openapijsonschematools.client.apis.tags.Fake; +import org.openapijsonschematools.client.paths.fake.get.FakeGetResponses; + +import java.io.IOException; +import java.util.Arrays; +import java.util.List; +import java.util.Map; +import java.util.AbstractMap; + +// if you want to use a server that is not SERVER_0 pass it in here and change the ServerIndex input below +ApiConfiguration.ServerInfo serverInfo = new ApiConfiguration.ServerInfoBuilder() + .rootServerInfo( + new RootServerInfo.RootServerInfoBuilder() + .rootServer0(new RootServer0()) + .build() + ) + .build(); +ApiConfiguration.ServerIndexInfo serverIndexInfo = new ApiConfiguration.ServerIndexInfoBuilder() + .rootServerInfoServerIndex(RootServerInfo.ServerIndex.SERVER_0) + .build(); +Duration timeout = Duration.ofSeconds(1L); +Map> defaultHeaders = Map.of("User-Agent", List.of("OpenAPI-JSON-Schema-Generator/1.0.0/java")); +ApiConfiguration apiConfiguration = new ApiConfiguration( + serverInfo + serverIndexInfo, + timeout, + defaultHeaders +); +SchemaConfiguration schemaConfiguration = new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().build()); +Fake apiClient = new Fake(apiConfiguration, schemaConfiguration); + + +var request = new FakeGet.GetRequestBuilder().build(); + +FakeGetResponses.EndpointResponse response; +try { + response = apiClient.get(request); +} catch (FakeGetCode404Response.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; +} +FakeGetResponses.EndpointFakeGetCode200Response castResponse = (FakeGetResponses.EndpointFakeGetCode200Response) response; +``` +### clientModel +public [FakePatchResponses.EndpointResponse](../../paths/fake/patch/FakePatchResponses.md#endpointresponse) clientModel([FakePatch.PatchRequest](../../paths/fake/FakePatch.md#patchrequest) request) + +To test "client" model + +**Parameters:**
+request - the input request + +**Returns:**
+the deserialized response + +**Throws:**
+IOException, InterruptedException - an exception happened when making the request
+ValidationException - the returned response body or header values do not conform the the schema validation requirements
+NotImplementedException - the request body serialization or deserialization has not yet been implemented
+ or the header content type deserialization has not yet been implemented for this contentType
+ApiException - server returned a response/contentType not defined in the openapi document
+ +#### 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.fake.patch.FakePatchRequestBody; +import org.openapijsonschematools.client.components.schemas.Client; +import org.openapijsonschematools.client.servers.RootServer0; +import org.openapijsonschematools.client.servers.RootServer1; +import org.openapijsonschematools.client.servers.RootServer2; +import org.openapijsonschematools.client.paths.fake.patch.responses.FakePatchCode200Response; +import org.openapijsonschematools.client.servers.RootServerInfo; +import org.openapijsonschematools.client.apis.tags.Fake; +import org.openapijsonschematools.client.paths.fake.patch.FakePatchResponses; + +import java.io.IOException; +import java.util.Arrays; +import java.util.List; +import java.util.Map; +import java.util.AbstractMap; + +// if you want to use a server that is not SERVER_0 pass it in here and change the ServerIndex input below +ApiConfiguration.ServerInfo serverInfo = new ApiConfiguration.ServerInfoBuilder() + .rootServerInfo( + new RootServerInfo.RootServerInfoBuilder() + .rootServer0(new RootServer0()) + .build() + ) + .build(); +ApiConfiguration.ServerIndexInfo serverIndexInfo = new ApiConfiguration.ServerIndexInfoBuilder() + .rootServerInfoServerIndex(RootServerInfo.ServerIndex.SERVER_0) + .build(); +Duration timeout = Duration.ofSeconds(1L); +Map> defaultHeaders = Map.of("User-Agent", List.of("OpenAPI-JSON-Schema-Generator/1.0.0/java")); +ApiConfiguration apiConfiguration = new ApiConfiguration( + serverInfo + serverIndexInfo, + timeout, + defaultHeaders +); +SchemaConfiguration schemaConfiguration = new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().build()); +Fake apiClient = new Fake(apiConfiguration, schemaConfiguration); + + +Client1BoxedMap requestBodyPayload = + Client.Client1.validateAndBox( + new Client.ClientMapBuilder1() + .client("a") + + .build(), + schemaConfiguration +); +FakePatchRequestBody.SealedRequestBody requestBody = new FakePatchRequestBody.ApplicationjsonRequestBody(requestBodyPayload); + +var request = new FakePatch.PatchRequestBuilder() + .requestBody(requestBody) + .build(); + +FakePatchResponses.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; +} +FakePatchResponses.EndpointFakePatchCode200Response castResponse = (FakePatchResponses.EndpointFakePatchCode200Response) response; +FakePatchCode200Response.ApplicationjsonResponseBody deserializedBody = (FakePatchCode200Response.ApplicationjsonResponseBody) castResponse.body; +// handle deserialized body here +``` +### endpointParameters +public [FakePostResponses.EndpointResponse](../../paths/fake/post/FakePostResponses.md#endpointresponse) endpointParameters([FakePost.PostRequest](../../paths/fake/FakePost.md#postrequest) request) + +Fake endpoint for testing various parameters
假端點
偽のエンドポイント
가짜 엔드 포인트
+ +**Parameters:**
+request - the input request + +**Returns:**
+the deserialized response + +**Throws:**
+IOException, InterruptedException - an exception happened when making the request
+ValidationException - the returned response body or header values do not conform the the schema validation requirements
+NotImplementedException - the request body serialization or deserialization has not yet been implemented
+ or the header content type deserialization has not yet been implemented for this contentType
+ApiException - server returned a response/contentType not defined in the openapi document
+ +#### 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.fake.post.FakePostRequestBody; +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.RootServer0; +import org.openapijsonschematools.client.servers.RootServer1; +import org.openapijsonschematools.client.servers.RootServer2; +import org.openapijsonschematools.client.securityschemes.SecurityScheme; +import org.openapijsonschematools.client.components.securityschemes.HttpBasicTest; +import org.openapijsonschematools.client.paths.fake.post.responses.FakePostCode200Response; +import org.openapijsonschematools.client.paths.fake.post.responses.FakePostCode404Response; +import org.openapijsonschematools.client.servers.RootServerInfo; +import org.openapijsonschematools.client.apis.tags.Fake; +import org.openapijsonschematools.client.paths.fake.post.FakePostResponses; + +import java.io.IOException; +import java.util.Arrays; +import java.util.List; +import java.util.Map; +import java.util.AbstractMap; + +// if you want to use a server that is not SERVER_0 pass it in here and change the ServerIndex input below +ApiConfiguration.ServerInfo serverInfo = new ApiConfiguration.ServerInfoBuilder() + .rootServerInfo( + new RootServerInfo.RootServerInfoBuilder() + .rootServer0(new RootServer0()) + .build() + ) + .build(); +ApiConfiguration.ServerIndexInfo serverIndexInfo = new ApiConfiguration.ServerIndexInfoBuilder() + .rootServerInfoServerIndex(RootServerInfo.ServerIndex.SERVER_0) + .build(); +List securitySchemes = new ArrayList(); +securitySchemes.add( + new HttpBasicTest("someUserId", "somePassword"); +); +ApiConfiguration.SecurityIndexInfo securityIndexInfo = new ApiConfiguration.SecurityIndexInfoBuilder() + .fakePostSecurityRequirementObject0SecurityIndex(FakePostSecurityRequirementObject0.SecurityIndex.SECURITY_0) + .build(); +Duration timeout = Duration.ofSeconds(1L); +Map> defaultHeaders = Map.of("User-Agent", List.of("OpenAPI-JSON-Schema-Generator/1.0.0/java")); +ApiConfiguration apiConfiguration = new ApiConfiguration( + serverInfo + serverIndexInfo, + securitySchemes, + securityIndexInfo, + timeout, + defaultHeaders +); +SchemaConfiguration schemaConfiguration = new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().build()); +Fake apiClient = new Fake(apiConfiguration, schemaConfiguration); + + +var request = new FakePost.PostRequestBuilder().build(); + +FakePostResponses.EndpointResponse response; +try { + response = apiClient.post(request); +} catch (FakePostCode404Response.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; +} +FakePostResponses.EndpointFakePostCode200Response castResponse = (FakePostResponses.EndpointFakePostCode200Response) response; +``` +### objectModelWithRefProps +public [FakerefsobjectmodelwithrefpropsPostResponses.EndpointResponse](../../paths/fakerefsobjectmodelwithrefprops/post/FakerefsobjectmodelwithrefpropsPostResponses.md#endpointresponse) objectModelWithRefProps([FakerefsobjectmodelwithrefpropsPost.PostRequest](../../paths/fakerefsobjectmodelwithrefprops/FakerefsobjectmodelwithrefpropsPost.md#postrequest) request) + +Test serialization of object with $refed properties + +**Parameters:**
+request - the input request + +**Returns:**
+the deserialized response + +**Throws:**
+IOException, InterruptedException - an exception happened when making the request
+ValidationException - the returned response body or header values do not conform the the schema validation requirements
+NotImplementedException - the request body serialization or deserialization has not yet been implemented
+ or the header content type deserialization has not yet been implemented for this contentType
+ApiException - server returned a response/contentType not defined in the openapi document
+ +#### 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.FakerefsobjectmodelwithrefpropsPostRequestBody; +import org.openapijsonschematools.client.components.schemas.ObjectModelWithRefProps; +import org.openapijsonschematools.client.RootServerInfo; +import org.openapijsonschematools.client.servers.RootServer0; +import org.openapijsonschematools.client.servers.RootServer1; +import org.openapijsonschematools.client.servers.RootServer2; +import org.openapijsonschematools.client.paths.fakerefsobjectmodelwithrefprops.post.responses.FakerefsobjectmodelwithrefpropsPostCode200Response; +import org.openapijsonschematools.client.servers.RootServerInfo; +import org.openapijsonschematools.client.apis.tags.Fake; +import org.openapijsonschematools.client.paths.fakerefsobjectmodelwithrefprops.post.FakerefsobjectmodelwithrefpropsPostResponses; + +import java.io.IOException; +import java.util.Arrays; +import java.util.List; +import java.util.Map; +import java.util.AbstractMap; + +// if you want to use a server that is not SERVER_0 pass it in here and change the ServerIndex input below +ApiConfiguration.ServerInfo serverInfo = new ApiConfiguration.ServerInfoBuilder() + .rootServerInfo( + new RootServerInfo.RootServerInfoBuilder() + .rootServer0(new RootServer0()) + .build() + ) + .build(); +ApiConfiguration.ServerIndexInfo serverIndexInfo = new ApiConfiguration.ServerIndexInfoBuilder() + .rootServerInfoServerIndex(RootServerInfo.ServerIndex.SERVER_0) + .build(); +Duration timeout = Duration.ofSeconds(1L); +Map> defaultHeaders = Map.of("User-Agent", List.of("OpenAPI-JSON-Schema-Generator/1.0.0/java")); +ApiConfiguration apiConfiguration = new ApiConfiguration( + serverInfo + serverIndexInfo, + timeout, + defaultHeaders +); +SchemaConfiguration schemaConfiguration = new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().build()); +Fake apiClient = new Fake(apiConfiguration, schemaConfiguration); + + +var request = new FakerefsobjectmodelwithrefpropsPost.PostRequestBuilder().build(); + +FakerefsobjectmodelwithrefpropsPostResponses.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; +} +FakerefsobjectmodelwithrefpropsPostResponses.EndpointFakerefsobjectmodelwithrefpropsPostCode200Response castResponse = (FakerefsobjectmodelwithrefpropsPostResponses.EndpointFakerefsobjectmodelwithrefpropsPostCode200Response) response; +FakerefsobjectmodelwithrefpropsPostCode200Response.ApplicationjsonResponseBody deserializedBody = (FakerefsobjectmodelwithrefpropsPostCode200Response.ApplicationjsonResponseBody) castResponse.body; +// handle deserialized body here +``` +### pemContentType +public [FakepemcontenttypeGetResponses.EndpointResponse](../../paths/fakepemcontenttype/get/FakepemcontenttypeGetResponses.md#endpointresponse) pemContentType([FakepemcontenttypeGet.GetRequest](../../paths/fakepemcontenttype/FakepemcontenttypeGet.md#getrequest) request) + +**Parameters:**
+request - the input request + +**Returns:**
+the deserialized response + +**Throws:**
+IOException, InterruptedException - an exception happened when making the request
+ValidationException - the returned response body or header values do not conform the the schema validation requirements
+NotImplementedException - the request body serialization or deserialization has not yet been implemented
+ or the header content type deserialization has not yet been implemented for this contentType
+ApiException - server returned a response/contentType not defined in the openapi document
+ +#### 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.fakepemcontenttype.get.FakepemcontenttypeGetRequestBody; +import org.openapijsonschematools.client.paths.fakepemcontenttype.get.requestbody.content.applicationxpemfile.ApplicationxpemfileSchema; +import org.openapijsonschematools.client.RootServerInfo; +import org.openapijsonschematools.client.servers.RootServer0; +import org.openapijsonschematools.client.servers.RootServer1; +import org.openapijsonschematools.client.servers.RootServer2; +import org.openapijsonschematools.client.paths.fakepemcontenttype.get.responses.FakepemcontenttypeGetCode200Response; +import org.openapijsonschematools.client.servers.RootServerInfo; +import org.openapijsonschematools.client.apis.tags.Fake; +import org.openapijsonschematools.client.paths.fakepemcontenttype.get.FakepemcontenttypeGetResponses; + +import java.io.IOException; +import java.util.Arrays; +import java.util.List; +import java.util.Map; +import java.util.AbstractMap; + +// if you want to use a server that is not SERVER_0 pass it in here and change the ServerIndex input below +ApiConfiguration.ServerInfo serverInfo = new ApiConfiguration.ServerInfoBuilder() + .rootServerInfo( + new RootServerInfo.RootServerInfoBuilder() + .rootServer0(new RootServer0()) + .build() + ) + .build(); +ApiConfiguration.ServerIndexInfo serverIndexInfo = new ApiConfiguration.ServerIndexInfoBuilder() + .rootServerInfoServerIndex(RootServerInfo.ServerIndex.SERVER_0) + .build(); +Duration timeout = Duration.ofSeconds(1L); +Map> defaultHeaders = Map.of("User-Agent", List.of("OpenAPI-JSON-Schema-Generator/1.0.0/java")); +ApiConfiguration apiConfiguration = new ApiConfiguration( + serverInfo + serverIndexInfo, + timeout, + defaultHeaders +); +SchemaConfiguration schemaConfiguration = new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().build()); +Fake apiClient = new Fake(apiConfiguration, schemaConfiguration); + + +var request = new FakepemcontenttypeGet.GetRequestBuilder().build(); + +FakepemcontenttypeGetResponses.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; +} +FakepemcontenttypeGetResponses.EndpointFakepemcontenttypeGetCode200Response castResponse = (FakepemcontenttypeGetResponses.EndpointFakepemcontenttypeGetCode200Response) response; +FakepemcontenttypeGetCode200Response.ApplicationxpemfileResponseBody deserializedBody = (FakepemcontenttypeGetCode200Response.ApplicationxpemfileResponseBody) castResponse.body; +// handle deserialized body here +``` +### numberWithValidations +public [FakerefsnumberPostResponses.EndpointResponse](../../paths/fakerefsnumber/post/FakerefsnumberPostResponses.md#endpointresponse) numberWithValidations([FakerefsnumberPost.PostRequest](../../paths/fakerefsnumber/FakerefsnumberPost.md#postrequest) request) + +Test serialization of outer number types + +**Parameters:**
+request - the input request + +**Returns:**
+the deserialized response + +**Throws:**
+IOException, InterruptedException - an exception happened when making the request
+ValidationException - the returned response body or header values do not conform the the schema validation requirements
+NotImplementedException - the request body serialization or deserialization has not yet been implemented
+ or the header content type deserialization has not yet been implemented for this contentType
+ApiException - server returned a response/contentType not defined in the openapi document
+ +#### 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.FakerefsnumberPostRequestBody; +import org.openapijsonschematools.client.components.schemas.NumberWithValidations; +import org.openapijsonschematools.client.RootServerInfo; +import org.openapijsonschematools.client.servers.RootServer0; +import org.openapijsonschematools.client.servers.RootServer1; +import org.openapijsonschematools.client.servers.RootServer2; +import org.openapijsonschematools.client.paths.fakerefsnumber.post.responses.FakerefsnumberPostCode200Response; +import org.openapijsonschematools.client.servers.RootServerInfo; +import org.openapijsonschematools.client.apis.tags.Fake; +import org.openapijsonschematools.client.paths.fakerefsnumber.post.FakerefsnumberPostResponses; + +import java.io.IOException; +import java.util.Arrays; +import java.util.List; +import java.util.Map; +import java.util.AbstractMap; + +// if you want to use a server that is not SERVER_0 pass it in here and change the ServerIndex input below +ApiConfiguration.ServerInfo serverInfo = new ApiConfiguration.ServerInfoBuilder() + .rootServerInfo( + new RootServerInfo.RootServerInfoBuilder() + .rootServer0(new RootServer0()) + .build() + ) + .build(); +ApiConfiguration.ServerIndexInfo serverIndexInfo = new ApiConfiguration.ServerIndexInfoBuilder() + .rootServerInfoServerIndex(RootServerInfo.ServerIndex.SERVER_0) + .build(); +Duration timeout = Duration.ofSeconds(1L); +Map> defaultHeaders = Map.of("User-Agent", List.of("OpenAPI-JSON-Schema-Generator/1.0.0/java")); +ApiConfiguration apiConfiguration = new ApiConfiguration( + serverInfo + serverIndexInfo, + timeout, + defaultHeaders +); +SchemaConfiguration schemaConfiguration = new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().build()); +Fake apiClient = new Fake(apiConfiguration, schemaConfiguration); + + +var request = new FakerefsnumberPost.PostRequestBuilder().build(); + +FakerefsnumberPostResponses.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; +} +FakerefsnumberPostResponses.EndpointFakerefsnumberPostCode200Response castResponse = (FakerefsnumberPostResponses.EndpointFakerefsnumberPostCode200Response) response; +FakerefsnumberPostCode200Response.ApplicationjsonResponseBody deserializedBody = (FakerefsnumberPostCode200Response.ApplicationjsonResponseBody) castResponse.body; +// handle deserialized body here +``` +### modelString +public [FakerefsstringPostResponses.EndpointResponse](../../paths/fakerefsstring/post/FakerefsstringPostResponses.md#endpointresponse) modelString([FakerefsstringPost.PostRequest](../../paths/fakerefsstring/FakerefsstringPost.md#postrequest) request) + +Test serialization of outer string types + +**Parameters:**
+request - the input request + +**Returns:**
+the deserialized response + +**Throws:**
+IOException, InterruptedException - an exception happened when making the request
+ValidationException - the returned response body or header values do not conform the the schema validation requirements
+NotImplementedException - the request body serialization or deserialization has not yet been implemented
+ or the header content type deserialization has not yet been implemented for this contentType
+ApiException - server returned a response/contentType not defined in the openapi document
+ +#### 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.FakerefsstringPostRequestBody; +import org.openapijsonschematools.client.components.schemas.StringSchema; +import org.openapijsonschematools.client.RootServerInfo; +import org.openapijsonschematools.client.servers.RootServer0; +import org.openapijsonschematools.client.servers.RootServer1; +import org.openapijsonschematools.client.servers.RootServer2; +import org.openapijsonschematools.client.paths.fakerefsstring.post.responses.FakerefsstringPostCode200Response; +import org.openapijsonschematools.client.servers.RootServerInfo; +import org.openapijsonschematools.client.apis.tags.Fake; +import org.openapijsonschematools.client.paths.fakerefsstring.post.FakerefsstringPostResponses; + +import java.io.IOException; +import java.util.Arrays; +import java.util.List; +import java.util.Map; +import java.util.AbstractMap; + +// if you want to use a server that is not SERVER_0 pass it in here and change the ServerIndex input below +ApiConfiguration.ServerInfo serverInfo = new ApiConfiguration.ServerInfoBuilder() + .rootServerInfo( + new RootServerInfo.RootServerInfoBuilder() + .rootServer0(new RootServer0()) + .build() + ) + .build(); +ApiConfiguration.ServerIndexInfo serverIndexInfo = new ApiConfiguration.ServerIndexInfoBuilder() + .rootServerInfoServerIndex(RootServerInfo.ServerIndex.SERVER_0) + .build(); +Duration timeout = Duration.ofSeconds(1L); +Map> defaultHeaders = Map.of("User-Agent", List.of("OpenAPI-JSON-Schema-Generator/1.0.0/java")); +ApiConfiguration apiConfiguration = new ApiConfiguration( + serverInfo + serverIndexInfo, + timeout, + defaultHeaders +); +SchemaConfiguration schemaConfiguration = new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().build()); +Fake apiClient = new Fake(apiConfiguration, schemaConfiguration); + + +var request = new FakerefsstringPost.PostRequestBuilder().build(); + +FakerefsstringPostResponses.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; +} +FakerefsstringPostResponses.EndpointFakerefsstringPostCode200Response castResponse = (FakerefsstringPostResponses.EndpointFakerefsstringPostCode200Response) response; +FakerefsstringPostCode200Response.ApplicationjsonResponseBody deserializedBody = (FakerefsstringPostCode200Response.ApplicationjsonResponseBody) castResponse.body; +// handle deserialized body here +``` +### inlineAdditionalProperties +public [FakeinlineadditionalpropertiesPostResponses.EndpointResponse](../../paths/fakeinlineadditionalproperties/post/FakeinlineadditionalpropertiesPostResponses.md#endpointresponse) inlineAdditionalProperties([FakeinlineadditionalpropertiesPost.PostRequest](../../paths/fakeinlineadditionalproperties/FakeinlineadditionalpropertiesPost.md#postrequest) request) + + + +**Parameters:**
+request - the input request + +**Returns:**
+the deserialized response + +**Throws:**
+IOException, InterruptedException - an exception happened when making the request
+ValidationException - the returned response body or header values do not conform the the schema validation requirements
+NotImplementedException - the request body serialization or deserialization has not yet been implemented
+ or the header content type deserialization has not yet been implemented for this contentType
+ApiException - server returned a response/contentType not defined in the openapi document
+ +#### 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.fakeinlineadditionalproperties.post.FakeinlineadditionalpropertiesPostRequestBody; +import org.openapijsonschematools.client.paths.fakeinlineadditionalproperties.post.requestbody.content.applicationjson.ApplicationjsonSchema; +import org.openapijsonschematools.client.servers.RootServer0; +import org.openapijsonschematools.client.servers.RootServer1; +import org.openapijsonschematools.client.servers.RootServer2; +import org.openapijsonschematools.client.paths.fakeinlineadditionalproperties.post.responses.FakeinlineadditionalpropertiesPostCode200Response; +import org.openapijsonschematools.client.servers.RootServerInfo; +import org.openapijsonschematools.client.apis.tags.Fake; +import org.openapijsonschematools.client.paths.fakeinlineadditionalproperties.post.FakeinlineadditionalpropertiesPostResponses; + +import java.io.IOException; +import java.util.Arrays; +import java.util.List; +import java.util.Map; +import java.util.AbstractMap; + +// if you want to use a server that is not SERVER_0 pass it in here and change the ServerIndex input below +ApiConfiguration.ServerInfo serverInfo = new ApiConfiguration.ServerInfoBuilder() + .rootServerInfo( + new RootServerInfo.RootServerInfoBuilder() + .rootServer0(new RootServer0()) + .build() + ) + .build(); +ApiConfiguration.ServerIndexInfo serverIndexInfo = new ApiConfiguration.ServerIndexInfoBuilder() + .rootServerInfoServerIndex(RootServerInfo.ServerIndex.SERVER_0) + .build(); +Duration timeout = Duration.ofSeconds(1L); +Map> defaultHeaders = Map.of("User-Agent", List.of("OpenAPI-JSON-Schema-Generator/1.0.0/java")); +ApiConfiguration apiConfiguration = new ApiConfiguration( + serverInfo + serverIndexInfo, + timeout, + defaultHeaders +); +SchemaConfiguration schemaConfiguration = new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().build()); +Fake apiClient = new Fake(apiConfiguration, schemaConfiguration); + + +ApplicationjsonSchema1BoxedMap requestBodyPayload = + ApplicationjsonSchema.ApplicationjsonSchema1.validateAndBox( + new ApplicationjsonSchema.ApplicationjsonSchemaMapBuilder() + .additionalProperty("someAdditionalProperty", "a") + + .build(), + schemaConfiguration +); +FakeinlineadditionalpropertiesPost.SealedRequestBody requestBody = new FakeinlineadditionalpropertiesPost.ApplicationjsonRequestBody(requestBodyPayload); + +var request = new FakeinlineadditionalpropertiesPost.PostRequestBuilder() + .requestBody(requestBody) + .build(); + +FakeinlineadditionalpropertiesPostResponses.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; +} +FakeinlineadditionalpropertiesPostResponses.EndpointFakeinlineadditionalpropertiesPostCode200Response castResponse = (FakeinlineadditionalpropertiesPostResponses.EndpointFakeinlineadditionalpropertiesPostCode200Response) response; +``` +### mammal +public [FakerefsmammalPostResponses.EndpointResponse](../../paths/fakerefsmammal/post/FakerefsmammalPostResponses.md#endpointresponse) mammal([FakerefsmammalPost.PostRequest](../../paths/fakerefsmammal/FakerefsmammalPost.md#postrequest) request) + +Test serialization of mammals + +**Parameters:**
+request - the input request + +**Returns:**
+the deserialized response + +**Throws:**
+IOException, InterruptedException - an exception happened when making the request
+ValidationException - the returned response body or header values do not conform the the schema validation requirements
+NotImplementedException - the request body serialization or deserialization has not yet been implemented
+ or the header content type deserialization has not yet been implemented for this contentType
+ApiException - server returned a response/contentType not defined in the openapi document
+ +#### 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.FakerefsmammalPostRequestBody; +import org.openapijsonschematools.client.components.schemas.Mammal; +import org.openapijsonschematools.client.servers.RootServer0; +import org.openapijsonschematools.client.servers.RootServer1; +import org.openapijsonschematools.client.servers.RootServer2; +import org.openapijsonschematools.client.paths.fakerefsmammal.post.responses.FakerefsmammalPostCode200Response; +import org.openapijsonschematools.client.servers.RootServerInfo; +import org.openapijsonschematools.client.apis.tags.Fake; +import org.openapijsonschematools.client.paths.fakerefsmammal.post.FakerefsmammalPostResponses; + +import java.io.IOException; +import java.util.Arrays; +import java.util.List; +import java.util.Map; +import java.util.AbstractMap; + +// if you want to use a server that is not SERVER_0 pass it in here and change the ServerIndex input below +ApiConfiguration.ServerInfo serverInfo = new ApiConfiguration.ServerInfoBuilder() + .rootServerInfo( + new RootServerInfo.RootServerInfoBuilder() + .rootServer0(new RootServer0()) + .build() + ) + .build(); +ApiConfiguration.ServerIndexInfo serverIndexInfo = new ApiConfiguration.ServerIndexInfoBuilder() + .rootServerInfoServerIndex(RootServerInfo.ServerIndex.SERVER_0) + .build(); +Duration timeout = Duration.ofSeconds(1L); +Map> defaultHeaders = Map.of("User-Agent", List.of("OpenAPI-JSON-Schema-Generator/1.0.0/java")); +ApiConfiguration apiConfiguration = new ApiConfiguration( + serverInfo + serverIndexInfo, + timeout, + defaultHeaders +); +SchemaConfiguration schemaConfiguration = new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().build()); +Fake apiClient = new Fake(apiConfiguration, schemaConfiguration); + +FakerefsmammalPost.SealedRequestBody requestBody = new FakerefsmammalPost.ApplicationjsonRequestBody(requestBodyPayload); + +var request = new FakerefsmammalPost.PostRequestBuilder() + .requestBody(requestBody) + .build(); + +FakerefsmammalPostResponses.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; +} +FakerefsmammalPostResponses.EndpointFakerefsmammalPostCode200Response castResponse = (FakerefsmammalPostResponses.EndpointFakerefsmammalPostCode200Response) response; +FakerefsmammalPostCode200Response.ApplicationjsonResponseBody deserializedBody = (FakerefsmammalPostCode200Response.ApplicationjsonResponseBody) castResponse.body; +// handle deserialized body here +``` +### slashRoute +public [SolidusGetResponses.EndpointResponse](../../paths/solidus/get/SolidusGetResponses.md#endpointresponse) slashRoute([SolidusGet.GetRequest](../../paths/solidus/SolidusGet.md#getrequest) request) + +**Parameters:**
+request - the input request + +**Returns:**
+the deserialized response + +**Throws:**
+IOException, InterruptedException - an exception happened when making the request
+ValidationException - the returned response body or header values do not conform the the schema validation requirements
+NotImplementedException - the request body serialization or deserialization has not yet been implemented
+ or the header content type deserialization has not yet been implemented for this contentType
+ApiException - server returned a response/contentType not defined in the openapi document
+ +#### 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.servers.RootServer0; +import org.openapijsonschematools.client.servers.RootServer1; +import org.openapijsonschematools.client.servers.RootServer2; +import org.openapijsonschematools.client.paths.solidus.get.responses.SolidusGetCode200Response; +import org.openapijsonschematools.client.servers.RootServerInfo; +import org.openapijsonschematools.client.apis.tags.Fake; +import org.openapijsonschematools.client.paths.solidus.get.SolidusGetResponses; + +import java.io.IOException; +import java.util.Arrays; +import java.util.List; +import java.util.Map; +import java.util.AbstractMap; + +// if you want to use a server that is not SERVER_0 pass it in here and change the ServerIndex input below +ApiConfiguration.ServerInfo serverInfo = new ApiConfiguration.ServerInfoBuilder() + .rootServerInfo( + new RootServerInfo.RootServerInfoBuilder() + .rootServer0(new RootServer0()) + .build() + ) + .build(); +ApiConfiguration.ServerIndexInfo serverIndexInfo = new ApiConfiguration.ServerIndexInfoBuilder() + .rootServerInfoServerIndex(RootServerInfo.ServerIndex.SERVER_0) + .build(); +Duration timeout = Duration.ofSeconds(1L); +Map> defaultHeaders = Map.of("User-Agent", List.of("OpenAPI-JSON-Schema-Generator/1.0.0/java")); +ApiConfiguration apiConfiguration = new ApiConfiguration( + serverInfo + serverIndexInfo, + timeout, + defaultHeaders +); +SchemaConfiguration schemaConfiguration = new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().build()); +Fake apiClient = new Fake(apiConfiguration, schemaConfiguration); + + +var request = new SolidusGet.GetRequestBuilder().build(); + +SolidusGetResponses.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; +} +SolidusGetResponses.EndpointSolidusGetCode200Response castResponse = (SolidusGetResponses.EndpointSolidusGetCode200Response) response; +``` +### modelBoolean +public [FakerefsbooleanPostResponses.EndpointResponse](../../paths/fakerefsboolean/post/FakerefsbooleanPostResponses.md#endpointresponse) modelBoolean([FakerefsbooleanPost.PostRequest](../../paths/fakerefsboolean/FakerefsbooleanPost.md#postrequest) request) + +Test serialization of outer boolean types + +**Parameters:**
+request - the input request + +**Returns:**
+the deserialized response + +**Throws:**
+IOException, InterruptedException - an exception happened when making the request
+ValidationException - the returned response body or header values do not conform the the schema validation requirements
+NotImplementedException - the request body serialization or deserialization has not yet been implemented
+ or the header content type deserialization has not yet been implemented for this contentType
+ApiException - server returned a response/contentType not defined in the openapi document
+ +#### 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.FakerefsbooleanPostRequestBody; +import org.openapijsonschematools.client.components.schemas.BooleanSchema; +import org.openapijsonschematools.client.RootServerInfo; +import org.openapijsonschematools.client.servers.RootServer0; +import org.openapijsonschematools.client.servers.RootServer1; +import org.openapijsonschematools.client.servers.RootServer2; +import org.openapijsonschematools.client.paths.fakerefsboolean.post.responses.FakerefsbooleanPostCode200Response; +import org.openapijsonschematools.client.servers.RootServerInfo; +import org.openapijsonschematools.client.apis.tags.Fake; +import org.openapijsonschematools.client.paths.fakerefsboolean.post.FakerefsbooleanPostResponses; + +import java.io.IOException; +import java.util.Arrays; +import java.util.List; +import java.util.Map; +import java.util.AbstractMap; + +// if you want to use a server that is not SERVER_0 pass it in here and change the ServerIndex input below +ApiConfiguration.ServerInfo serverInfo = new ApiConfiguration.ServerInfoBuilder() + .rootServerInfo( + new RootServerInfo.RootServerInfoBuilder() + .rootServer0(new RootServer0()) + .build() + ) + .build(); +ApiConfiguration.ServerIndexInfo serverIndexInfo = new ApiConfiguration.ServerIndexInfoBuilder() + .rootServerInfoServerIndex(RootServerInfo.ServerIndex.SERVER_0) + .build(); +Duration timeout = Duration.ofSeconds(1L); +Map> defaultHeaders = Map.of("User-Agent", List.of("OpenAPI-JSON-Schema-Generator/1.0.0/java")); +ApiConfiguration apiConfiguration = new ApiConfiguration( + serverInfo + serverIndexInfo, + timeout, + defaultHeaders +); +SchemaConfiguration schemaConfiguration = new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().build()); +Fake apiClient = new Fake(apiConfiguration, schemaConfiguration); + + +var request = new FakerefsbooleanPost.PostRequestBuilder().build(); + +FakerefsbooleanPostResponses.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; +} +FakerefsbooleanPostResponses.EndpointFakerefsbooleanPostCode200Response castResponse = (FakerefsbooleanPostResponses.EndpointFakerefsbooleanPostCode200Response) response; +FakerefsbooleanPostCode200Response.ApplicationjsonResponseBody deserializedBody = (FakerefsbooleanPostCode200Response.ApplicationjsonResponseBody) castResponse.body; +// handle deserialized body here +``` +### jsonFormData +public [FakejsonformdataGetResponses.EndpointResponse](../../paths/fakejsonformdata/get/FakejsonformdataGetResponses.md#endpointresponse) jsonFormData([FakejsonformdataGet.GetRequest](../../paths/fakejsonformdata/FakejsonformdataGet.md#getrequest) request) + + + +**Parameters:**
+request - the input request + +**Returns:**
+the deserialized response + +**Throws:**
+IOException, InterruptedException - an exception happened when making the request
+ValidationException - the returned response body or header values do not conform the the schema validation requirements
+NotImplementedException - the request body serialization or deserialization has not yet been implemented
+ or the header content type deserialization has not yet been implemented for this contentType
+ApiException - server returned a response/contentType not defined in the openapi document
+ +#### 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.fakejsonformdata.get.FakejsonformdataGetRequestBody; +import org.openapijsonschematools.client.paths.fakejsonformdata.get.requestbody.content.applicationxwwwformurlencoded.ApplicationxwwwformurlencodedSchema; +import org.openapijsonschematools.client.RootServerInfo; +import org.openapijsonschematools.client.servers.RootServer0; +import org.openapijsonschematools.client.servers.RootServer1; +import org.openapijsonschematools.client.servers.RootServer2; +import org.openapijsonschematools.client.paths.fakejsonformdata.get.responses.FakejsonformdataGetCode200Response; +import org.openapijsonschematools.client.servers.RootServerInfo; +import org.openapijsonschematools.client.apis.tags.Fake; +import org.openapijsonschematools.client.paths.fakejsonformdata.get.FakejsonformdataGetResponses; + +import java.io.IOException; +import java.util.Arrays; +import java.util.List; +import java.util.Map; +import java.util.AbstractMap; + +// if you want to use a server that is not SERVER_0 pass it in here and change the ServerIndex input below +ApiConfiguration.ServerInfo serverInfo = new ApiConfiguration.ServerInfoBuilder() + .rootServerInfo( + new RootServerInfo.RootServerInfoBuilder() + .rootServer0(new RootServer0()) + .build() + ) + .build(); +ApiConfiguration.ServerIndexInfo serverIndexInfo = new ApiConfiguration.ServerIndexInfoBuilder() + .rootServerInfoServerIndex(RootServerInfo.ServerIndex.SERVER_0) + .build(); +Duration timeout = Duration.ofSeconds(1L); +Map> defaultHeaders = Map.of("User-Agent", List.of("OpenAPI-JSON-Schema-Generator/1.0.0/java")); +ApiConfiguration apiConfiguration = new ApiConfiguration( + serverInfo + serverIndexInfo, + timeout, + defaultHeaders +); +SchemaConfiguration schemaConfiguration = new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().build()); +Fake apiClient = new Fake(apiConfiguration, schemaConfiguration); + + +var request = new FakejsonformdataGet.GetRequestBuilder().build(); + +FakejsonformdataGetResponses.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; +} +FakejsonformdataGetResponses.EndpointFakejsonformdataGetCode200Response castResponse = (FakejsonformdataGetResponses.EndpointFakejsonformdataGetCode200Response) response; +``` +### parameterCollisions +public [Fakeparametercollisions1ababselfabPostResponses.EndpointResponse](../../paths/fakeparametercollisions1ababselfab/post/Fakeparametercollisions1ababselfabPostResponses.md#endpointresponse) parameterCollisions([Fakeparametercollisions1ababselfabPost.PostRequest](../../paths/fakeparametercollisions1ababselfab/Fakeparametercollisions1ababselfabPost.md#postrequest) request) + +**Parameters:**
+request - the input request + +**Returns:**
+the deserialized response + +**Throws:**
+IOException, InterruptedException - an exception happened when making the request
+ValidationException - the returned response body or header values do not conform the the schema validation requirements
+NotImplementedException - the request body serialization or deserialization has not yet been implemented
+ or the header content type deserialization has not yet been implemented for this contentType
+ApiException - server returned a response/contentType not defined in the openapi document
+ +#### 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.fakeparametercollisions1ababselfab.post.Fakeparametercollisions1ababselfabPostRequestBody; +import org.openapijsonschematools.client.paths.fakeparametercollisions1ababselfab.post.Fakeparametercollisions1ababselfabPostHeaderParameters; +import org.openapijsonschematools.client.paths.fakeparametercollisions1ababselfab.post.Fakeparametercollisions1ababselfabPostQueryParameters; +import org.openapijsonschematools.client.paths.fakeparametercollisions1ababselfab.post.Fakeparametercollisions1ababselfabPostCookieParameters; +import org.openapijsonschematools.client.RootServerInfo; +import org.openapijsonschematools.client.paths.fakeparametercollisions1ababselfab.post.Fakeparametercollisions1ababselfabPostPathParameters; +import org.openapijsonschematools.client.servers.RootServer0; +import org.openapijsonschematools.client.servers.RootServer1; +import org.openapijsonschematools.client.servers.RootServer2; +import org.openapijsonschematools.client.paths.fakeparametercollisions1ababselfab.post.responses.Fakeparametercollisions1ababselfabPostCode200Response; +import org.openapijsonschematools.client.servers.RootServerInfo; +import org.openapijsonschematools.client.apis.tags.Fake; +import org.openapijsonschematools.client.paths.fakeparametercollisions1ababselfab.post.Fakeparametercollisions1ababselfabPostResponses; + +import java.io.IOException; +import java.util.Arrays; +import java.util.List; +import java.util.Map; +import java.util.AbstractMap; + +// if you want to use a server that is not SERVER_0 pass it in here and change the ServerIndex input below +ApiConfiguration.ServerInfo serverInfo = new ApiConfiguration.ServerInfoBuilder() + .rootServerInfo( + new RootServerInfo.RootServerInfoBuilder() + .rootServer0(new RootServer0()) + .build() + ) + .build(); +ApiConfiguration.ServerIndexInfo serverIndexInfo = new ApiConfiguration.ServerIndexInfoBuilder() + .rootServerInfoServerIndex(RootServerInfo.ServerIndex.SERVER_0) + .build(); +Duration timeout = Duration.ofSeconds(1L); +Map> defaultHeaders = Map.of("User-Agent", List.of("OpenAPI-JSON-Schema-Generator/1.0.0/java")); +ApiConfiguration apiConfiguration = new ApiConfiguration( + serverInfo + serverIndexInfo, + timeout, + defaultHeaders +); +SchemaConfiguration schemaConfiguration = new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().build()); +Fake apiClient = new Fake(apiConfiguration, schemaConfiguration); + + +// Map validation +Fakeparametercollisions1ababselfabPostPathParameters.PathParametersMap pathParameters = + Fakeparametercollisions1ababselfabPostPathParameters.Fakeparametercollisions1ababselfabPostPathParameters1.validate( + new Fakeparametercollisions1ababselfabPostPathParameters.PathParametersMapBuilder() + .positive1("a") + + .aHyphenMinusB("a") + + .Ab("a") + + .aB("a") + + .self("a") + + .build(), + schemaConfiguration +); + +var request = new Fakeparametercollisions1ababselfabPost.PostRequestBuilder() + .pathParameters(pathParameters) + .build(); + +Fakeparametercollisions1ababselfabPostResponses.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; +} +Fakeparametercollisions1ababselfabPostResponses.EndpointFakeparametercollisions1ababselfabPostCode200Response castResponse = (Fakeparametercollisions1ababselfabPostResponses.EndpointFakeparametercollisions1ababselfabPostCode200Response) response; +Fakeparametercollisions1ababselfabPostCode200Response.ApplicationjsonResponseBody deserializedBody = (Fakeparametercollisions1ababselfabPostCode200Response.ApplicationjsonResponseBody) castResponse.body; +// handle deserialized body here +``` +### queryParamWithJsonContentType +public [FakequeryparamwithjsoncontenttypeGetResponses.EndpointResponse](../../paths/fakequeryparamwithjsoncontenttype/get/FakequeryparamwithjsoncontenttypeGetResponses.md#endpointresponse) queryParamWithJsonContentType([FakequeryparamwithjsoncontenttypeGet.GetRequest](../../paths/fakequeryparamwithjsoncontenttype/FakequeryparamwithjsoncontenttypeGet.md#getrequest) request) + +**Parameters:**
+request - the input request + +**Returns:**
+the deserialized response + +**Throws:**
+IOException, InterruptedException - an exception happened when making the request
+ValidationException - the returned response body or header values do not conform the the schema validation requirements
+NotImplementedException - the request body serialization or deserialization has not yet been implemented
+ or the header content type deserialization has not yet been implemented for this contentType
+ApiException - server returned a response/contentType not defined in the openapi document
+ +#### 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.fakequeryparamwithjsoncontenttype.get.FakequeryparamwithjsoncontenttypeGetQueryParameters; +import org.openapijsonschematools.client.servers.RootServer0; +import org.openapijsonschematools.client.servers.RootServer1; +import org.openapijsonschematools.client.servers.RootServer2; +import org.openapijsonschematools.client.paths.fakequeryparamwithjsoncontenttype.get.responses.FakequeryparamwithjsoncontenttypeGetCode200Response; +import org.openapijsonschematools.client.servers.RootServerInfo; +import org.openapijsonschematools.client.apis.tags.Fake; +import org.openapijsonschematools.client.paths.fakequeryparamwithjsoncontenttype.get.FakequeryparamwithjsoncontenttypeGetResponses; + +import java.io.IOException; +import java.util.Arrays; +import java.util.List; +import java.util.Map; +import java.util.AbstractMap; + +// if you want to use a server that is not SERVER_0 pass it in here and change the ServerIndex input below +ApiConfiguration.ServerInfo serverInfo = new ApiConfiguration.ServerInfoBuilder() + .rootServerInfo( + new RootServerInfo.RootServerInfoBuilder() + .rootServer0(new RootServer0()) + .build() + ) + .build(); +ApiConfiguration.ServerIndexInfo serverIndexInfo = new ApiConfiguration.ServerIndexInfoBuilder() + .rootServerInfoServerIndex(RootServerInfo.ServerIndex.SERVER_0) + .build(); +Duration timeout = Duration.ofSeconds(1L); +Map> defaultHeaders = Map.of("User-Agent", List.of("OpenAPI-JSON-Schema-Generator/1.0.0/java")); +ApiConfiguration apiConfiguration = new ApiConfiguration( + serverInfo + serverIndexInfo, + timeout, + defaultHeaders +); +SchemaConfiguration schemaConfiguration = new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().build()); +Fake apiClient = new Fake(apiConfiguration, schemaConfiguration); + + +// Map validation +FakequeryparamwithjsoncontenttypeGetQueryParameters.QueryParametersMap queryParameters = + FakequeryparamwithjsoncontenttypeGetQueryParameters.FakequeryparamwithjsoncontenttypeGetQueryParameters1.validate( + new FakequeryparamwithjsoncontenttypeGetQueryParameters.QueryParametersMapBuilder() + .build(), + schemaConfiguration +); + +var request = new FakequeryparamwithjsoncontenttypeGet.GetRequestBuilder() + .queryParameters(queryParameters) + .build(); + +FakequeryparamwithjsoncontenttypeGetResponses.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; +} +FakequeryparamwithjsoncontenttypeGetResponses.EndpointFakequeryparamwithjsoncontenttypeGetCode200Response castResponse = (FakequeryparamwithjsoncontenttypeGetResponses.EndpointFakequeryparamwithjsoncontenttypeGetCode200Response) response; +FakequeryparamwithjsoncontenttypeGetCode200Response.ApplicationjsonResponseBody deserializedBody = (FakequeryparamwithjsoncontenttypeGetCode200Response.ApplicationjsonResponseBody) castResponse.body; +// handle deserialized body here +``` +### objectInQuery +public [FakeobjinqueryGetResponses.EndpointResponse](../../paths/fakeobjinquery/get/FakeobjinqueryGetResponses.md#endpointresponse) objectInQuery([FakeobjinqueryGet.GetRequest](../../paths/fakeobjinquery/FakeobjinqueryGet.md#getrequest) request) + +**Parameters:**
+request - the input request + +**Returns:**
+the deserialized response + +**Throws:**
+IOException, InterruptedException - an exception happened when making the request
+ValidationException - the returned response body or header values do not conform the the schema validation requirements
+NotImplementedException - the request body serialization or deserialization has not yet been implemented
+ or the header content type deserialization has not yet been implemented for this contentType
+ApiException - server returned a response/contentType not defined in the openapi document
+ +#### 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.fakeobjinquery.get.FakeobjinqueryGetQueryParameters; +import org.openapijsonschematools.client.RootServerInfo; +import org.openapijsonschematools.client.servers.RootServer0; +import org.openapijsonschematools.client.servers.RootServer1; +import org.openapijsonschematools.client.servers.RootServer2; +import org.openapijsonschematools.client.paths.fakeobjinquery.get.responses.FakeobjinqueryGetCode200Response; +import org.openapijsonschematools.client.servers.RootServerInfo; +import org.openapijsonschematools.client.apis.tags.Fake; +import org.openapijsonschematools.client.paths.fakeobjinquery.get.FakeobjinqueryGetResponses; + +import java.io.IOException; +import java.util.Arrays; +import java.util.List; +import java.util.Map; +import java.util.AbstractMap; + +// if you want to use a server that is not SERVER_0 pass it in here and change the ServerIndex input below +ApiConfiguration.ServerInfo serverInfo = new ApiConfiguration.ServerInfoBuilder() + .rootServerInfo( + new RootServerInfo.RootServerInfoBuilder() + .rootServer0(new RootServer0()) + .build() + ) + .build(); +ApiConfiguration.ServerIndexInfo serverIndexInfo = new ApiConfiguration.ServerIndexInfoBuilder() + .rootServerInfoServerIndex(RootServerInfo.ServerIndex.SERVER_0) + .build(); +Duration timeout = Duration.ofSeconds(1L); +Map> defaultHeaders = Map.of("User-Agent", List.of("OpenAPI-JSON-Schema-Generator/1.0.0/java")); +ApiConfiguration apiConfiguration = new ApiConfiguration( + serverInfo + serverIndexInfo, + timeout, + defaultHeaders +); +SchemaConfiguration schemaConfiguration = new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().build()); +Fake apiClient = new Fake(apiConfiguration, schemaConfiguration); + + +var request = new FakeobjinqueryGet.GetRequestBuilder().build(); + +FakeobjinqueryGetResponses.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; +} +FakeobjinqueryGetResponses.EndpointFakeobjinqueryGetCode200Response castResponse = (FakeobjinqueryGetResponses.EndpointFakeobjinqueryGetCode200Response) response; +``` +### multipleSecurities +public [FakemultiplesecuritiesGetResponses.EndpointResponse](../../paths/fakemultiplesecurities/get/FakemultiplesecuritiesGetResponses.md#endpointresponse) multipleSecurities([FakemultiplesecuritiesGet.GetRequest](../../paths/fakemultiplesecurities/FakemultiplesecuritiesGet.md#getrequest) request) + +**Parameters:**
+request - the input request + +**Returns:**
+the deserialized response + +**Throws:**
+IOException, InterruptedException - an exception happened when making the request
+ValidationException - the returned response body or header values do not conform the the schema validation requirements
+NotImplementedException - the request body serialization or deserialization has not yet been implemented
+ or the header content type deserialization has not yet been implemented for this contentType
+ApiException - server returned a response/contentType not defined in the openapi document
+ +#### 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.fakemultiplesecurities.get.FakemultiplesecuritiesGetSecurityInfo; +import org.openapijsonschematools.client.servers.RootServer0; +import org.openapijsonschematools.client.servers.RootServer1; +import org.openapijsonschematools.client.servers.RootServer2; +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.FakemultiplesecuritiesGetCode200Response; +import org.openapijsonschematools.client.servers.RootServerInfo; +import org.openapijsonschematools.client.apis.tags.Fake; +import org.openapijsonschematools.client.paths.fakemultiplesecurities.get.FakemultiplesecuritiesGetResponses; + +import java.io.IOException; +import java.util.Arrays; +import java.util.List; +import java.util.Map; +import java.util.AbstractMap; + +// if you want to use a server that is not SERVER_0 pass it in here and change the ServerIndex input below +ApiConfiguration.ServerInfo serverInfo = new ApiConfiguration.ServerInfoBuilder() + .rootServerInfo( + new RootServerInfo.RootServerInfoBuilder() + .rootServer0(new RootServer0()) + .build() + ) + .build(); +ApiConfiguration.ServerIndexInfo serverIndexInfo = new ApiConfiguration.ServerIndexInfoBuilder() + .rootServerInfoServerIndex(RootServerInfo.ServerIndex.SERVER_0) + .build(); +List securitySchemes = new ArrayList(); +securitySchemes.add( + new HttpBasicTest("someUserId", "somePassword"); +); +securitySchemes.add( + new ApiKey("someApiKey"); +); +ApiConfiguration.SecurityIndexInfo securityIndexInfo = new ApiConfiguration.SecurityIndexInfoBuilder() + .fakemultiplesecuritiesGetSecurityRequirementObject0SecurityIndex(FakemultiplesecuritiesGetSecurityRequirementObject0.SecurityIndex.SECURITY_0) + .build(); +Duration timeout = Duration.ofSeconds(1L); +Map> defaultHeaders = Map.of("User-Agent", List.of("OpenAPI-JSON-Schema-Generator/1.0.0/java")); +ApiConfiguration apiConfiguration = new ApiConfiguration( + serverInfo + serverIndexInfo, + securitySchemes, + securityIndexInfo, + timeout, + defaultHeaders +); +SchemaConfiguration schemaConfiguration = new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().build()); +Fake apiClient = new Fake(apiConfiguration, schemaConfiguration); + + +var request = new FakemultiplesecuritiesGet.GetRequestBuilder().build(); + +FakemultiplesecuritiesGetResponses.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; +} +FakemultiplesecuritiesGetResponses.EndpointFakemultiplesecuritiesGetCode200Response castResponse = (FakemultiplesecuritiesGetResponses.EndpointFakemultiplesecuritiesGetCode200Response) response; +FakemultiplesecuritiesGetCode200Response.ApplicationjsonResponseBody deserializedBody = (FakemultiplesecuritiesGetCode200Response.ApplicationjsonResponseBody) castResponse.body; +// handle deserialized body here +``` +### queryParameterCollectionFormat +public [FaketestqueryparamtersPutResponses.EndpointResponse](../../paths/faketestqueryparamters/put/FaketestqueryparamtersPutResponses.md#endpointresponse) queryParameterCollectionFormat([FaketestqueryparamtersPut.PutRequest](../../paths/faketestqueryparamters/FaketestqueryparamtersPut.md#putrequest) request) + +To test the collection format in query parameters + +**Parameters:**
+request - the input request + +**Returns:**
+the deserialized response + +**Throws:**
+IOException, InterruptedException - an exception happened when making the request
+ValidationException - the returned response body or header values do not conform the the schema validation requirements
+NotImplementedException - the request body serialization or deserialization has not yet been implemented
+ or the header content type deserialization has not yet been implemented for this contentType
+ApiException - server returned a response/contentType not defined in the openapi document
+ +#### 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.faketestqueryparamters.put.FaketestqueryparamtersPutQueryParameters; +import org.openapijsonschematools.client.servers.RootServer0; +import org.openapijsonschematools.client.servers.RootServer1; +import org.openapijsonschematools.client.servers.RootServer2; +import org.openapijsonschematools.client.paths.faketestqueryparamters.put.responses.FaketestqueryparamtersPutCode200Response; +import org.openapijsonschematools.client.servers.RootServerInfo; +import org.openapijsonschematools.client.apis.tags.Fake; +import org.openapijsonschematools.client.paths.faketestqueryparamters.put.FaketestqueryparamtersPutResponses; + +import java.io.IOException; +import java.util.Arrays; +import java.util.List; +import java.util.Map; +import java.util.AbstractMap; + +// if you want to use a server that is not SERVER_0 pass it in here and change the ServerIndex input below +ApiConfiguration.ServerInfo serverInfo = new ApiConfiguration.ServerInfoBuilder() + .rootServerInfo( + new RootServerInfo.RootServerInfoBuilder() + .rootServer0(new RootServer0()) + .build() + ) + .build(); +ApiConfiguration.ServerIndexInfo serverIndexInfo = new ApiConfiguration.ServerIndexInfoBuilder() + .rootServerInfoServerIndex(RootServerInfo.ServerIndex.SERVER_0) + .build(); +Duration timeout = Duration.ofSeconds(1L); +Map> defaultHeaders = Map.of("User-Agent", List.of("OpenAPI-JSON-Schema-Generator/1.0.0/java")); +ApiConfiguration apiConfiguration = new ApiConfiguration( + serverInfo + serverIndexInfo, + timeout, + defaultHeaders +); +SchemaConfiguration schemaConfiguration = new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().build()); +Fake apiClient = new Fake(apiConfiguration, schemaConfiguration); + + +// Map validation +FaketestqueryparamtersPutQueryParameters.QueryParametersMap queryParameters = + FaketestqueryparamtersPutQueryParameters.FaketestqueryparamtersPutQueryParameters1.validate( + new FaketestqueryparamtersPutQueryParameters.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 +); + +var request = new FaketestqueryparamtersPut.PutRequestBuilder() + .queryParameters(queryParameters) + .build(); + +FaketestqueryparamtersPutResponses.EndpointResponse response; +try { + response = apiClient.put(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; +} +FaketestqueryparamtersPutResponses.EndpointFaketestqueryparamtersPutCode200Response castResponse = (FaketestqueryparamtersPutResponses.EndpointFaketestqueryparamtersPutCode200Response) response; +``` +### multipleResponseBodies +public [FakemultipleresponsebodiesGetResponses.EndpointResponse](../../paths/fakemultipleresponsebodies/get/FakemultipleresponsebodiesGetResponses.md#endpointresponse) multipleResponseBodies([FakemultipleresponsebodiesGet.GetRequest](../../paths/fakemultipleresponsebodies/FakemultipleresponsebodiesGet.md#getrequest) request) + +**Parameters:**
+request - the input request + +**Returns:**
+the deserialized response + +**Throws:**
+IOException, InterruptedException - an exception happened when making the request
+ValidationException - the returned response body or header values do not conform the the schema validation requirements
+NotImplementedException - the request body serialization or deserialization has not yet been implemented
+ or the header content type deserialization has not yet been implemented for this contentType
+ApiException - server returned a response/contentType not defined in the openapi document
+ +#### 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.servers.RootServer0; +import org.openapijsonschematools.client.servers.RootServer1; +import org.openapijsonschematools.client.servers.RootServer2; +import org.openapijsonschematools.client.paths.fakemultipleresponsebodies.get.responses.FakemultipleresponsebodiesGetCode200Response; +import org.openapijsonschematools.client.paths.fakemultipleresponsebodies.get.responses.FakemultipleresponsebodiesGetCode202Response; +import org.openapijsonschematools.client.servers.RootServerInfo; +import org.openapijsonschematools.client.apis.tags.Fake; +import org.openapijsonschematools.client.paths.fakemultipleresponsebodies.get.FakemultipleresponsebodiesGetResponses; + +import java.io.IOException; +import java.util.Arrays; +import java.util.List; +import java.util.Map; +import java.util.AbstractMap; + +// if you want to use a server that is not SERVER_0 pass it in here and change the ServerIndex input below +ApiConfiguration.ServerInfo serverInfo = new ApiConfiguration.ServerInfoBuilder() + .rootServerInfo( + new RootServerInfo.RootServerInfoBuilder() + .rootServer0(new RootServer0()) + .build() + ) + .build(); +ApiConfiguration.ServerIndexInfo serverIndexInfo = new ApiConfiguration.ServerIndexInfoBuilder() + .rootServerInfoServerIndex(RootServerInfo.ServerIndex.SERVER_0) + .build(); +Duration timeout = Duration.ofSeconds(1L); +Map> defaultHeaders = Map.of("User-Agent", List.of("OpenAPI-JSON-Schema-Generator/1.0.0/java")); +ApiConfiguration apiConfiguration = new ApiConfiguration( + serverInfo + serverIndexInfo, + timeout, + defaultHeaders +); +SchemaConfiguration schemaConfiguration = new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().build()); +Fake apiClient = new Fake(apiConfiguration, schemaConfiguration); + + +var request = new FakemultipleresponsebodiesGet.GetRequestBuilder().build(); + +FakemultipleresponsebodiesGetResponses.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; +} +if (response instanceof FakemultipleresponsebodiesGetResponses.EndpointFakemultipleresponsebodiesGetCode200Response castResponse) { + FakemultipleresponsebodiesGetCode200Response.ApplicationjsonResponseBody deserializedBody = (FakemultipleresponsebodiesGetCode200Response.ApplicationjsonResponseBody) castResponse.body; + // handle deserialized body here +} else { + FakemultipleresponsebodiesGetResponses.EndpointFakemultipleresponsebodiesGetCode202Response castResponse = (FakemultipleresponsebodiesGetResponses.EndpointFakemultipleresponsebodiesGetCode202Response) response; + FakemultipleresponsebodiesGetCode202Response.ApplicationjsonResponseBody deserializedBody = (FakemultipleresponsebodiesGetCode202Response.ApplicationjsonResponseBody) castResponse.body; + // handle deserialized body here +} +``` +### responseWithoutSchema +public [FakeresponsewithoutschemaGetResponses.EndpointResponse](../../paths/fakeresponsewithoutschema/get/FakeresponsewithoutschemaGetResponses.md#endpointresponse) responseWithoutSchema([FakeresponsewithoutschemaGet.GetRequest](../../paths/fakeresponsewithoutschema/FakeresponsewithoutschemaGet.md#getrequest) request) + +**Parameters:**
+request - the input request + +**Returns:**
+the deserialized response + +**Throws:**
+IOException, InterruptedException - an exception happened when making the request
+ValidationException - the returned response body or header values do not conform the the schema validation requirements
+NotImplementedException - the request body serialization or deserialization has not yet been implemented
+ or the header content type deserialization has not yet been implemented for this contentType
+ApiException - server returned a response/contentType not defined in the openapi document
+ +#### 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.servers.RootServer0; +import org.openapijsonschematools.client.servers.RootServer1; +import org.openapijsonschematools.client.servers.RootServer2; +import org.openapijsonschematools.client.paths.fakeresponsewithoutschema.get.responses.FakeresponsewithoutschemaGetCode200Response; +import org.openapijsonschematools.client.servers.RootServerInfo; +import org.openapijsonschematools.client.apis.tags.Fake; +import org.openapijsonschematools.client.paths.fakeresponsewithoutschema.get.FakeresponsewithoutschemaGetResponses; + +import java.io.IOException; +import java.util.Arrays; +import java.util.List; +import java.util.Map; +import java.util.AbstractMap; + +// if you want to use a server that is not SERVER_0 pass it in here and change the ServerIndex input below +ApiConfiguration.ServerInfo serverInfo = new ApiConfiguration.ServerInfoBuilder() + .rootServerInfo( + new RootServerInfo.RootServerInfoBuilder() + .rootServer0(new RootServer0()) + .build() + ) + .build(); +ApiConfiguration.ServerIndexInfo serverIndexInfo = new ApiConfiguration.ServerIndexInfoBuilder() + .rootServerInfoServerIndex(RootServerInfo.ServerIndex.SERVER_0) + .build(); +Duration timeout = Duration.ofSeconds(1L); +Map> defaultHeaders = Map.of("User-Agent", List.of("OpenAPI-JSON-Schema-Generator/1.0.0/java")); +ApiConfiguration apiConfiguration = new ApiConfiguration( + serverInfo + serverIndexInfo, + timeout, + defaultHeaders +); +SchemaConfiguration schemaConfiguration = new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().build()); +Fake apiClient = new Fake(apiConfiguration, schemaConfiguration); + + +var request = new FakeresponsewithoutschemaGet.GetRequestBuilder().build(); + +FakeresponsewithoutschemaGetResponses.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; +} +FakeresponsewithoutschemaGetResponses.EndpointFakeresponsewithoutschemaGetCode200Response castResponse = (FakeresponsewithoutschemaGetResponses.EndpointFakeresponsewithoutschemaGetCode200Response) response; +``` +### multipleRequestBodyContentTypes +public [FakemultiplerequestbodycontenttypesPostResponses.EndpointResponse](../../paths/fakemultiplerequestbodycontenttypes/post/FakemultiplerequestbodycontenttypesPostResponses.md#endpointresponse) multipleRequestBodyContentTypes([FakemultiplerequestbodycontenttypesPost.PostRequest](../../paths/fakemultiplerequestbodycontenttypes/FakemultiplerequestbodycontenttypesPost.md#postrequest) request) + +composed schemas at inline locations + multiple requestBody content types + +**Parameters:**
+request - the input request + +**Returns:**
+the deserialized response + +**Throws:**
+IOException, InterruptedException - an exception happened when making the request
+ValidationException - the returned response body or header values do not conform the the schema validation requirements
+NotImplementedException - the request body serialization or deserialization has not yet been implemented
+ or the header content type deserialization has not yet been implemented for this contentType
+ApiException - server returned a response/contentType not defined in the openapi document
+ +#### 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.FakemultiplerequestbodycontenttypesPostRequestBody; +import org.openapijsonschematools.client.paths.fakemultiplerequestbodycontenttypes.post.requestbody.content.applicationjson.ApplicationjsonSchema; +import org.openapijsonschematools.client.RootServerInfo; +import org.openapijsonschematools.client.servers.RootServer0; +import org.openapijsonschematools.client.servers.RootServer1; +import org.openapijsonschematools.client.servers.RootServer2; +import org.openapijsonschematools.client.paths.fakemultiplerequestbodycontenttypes.post.responses.FakemultiplerequestbodycontenttypesPostCode200Response; +import org.openapijsonschematools.client.servers.RootServerInfo; +import org.openapijsonschematools.client.apis.tags.Fake; +import org.openapijsonschematools.client.paths.fakemultiplerequestbodycontenttypes.post.FakemultiplerequestbodycontenttypesPostResponses; + +import java.io.IOException; +import java.util.Arrays; +import java.util.List; +import java.util.Map; +import java.util.AbstractMap; + +// if you want to use a server that is not SERVER_0 pass it in here and change the ServerIndex input below +ApiConfiguration.ServerInfo serverInfo = new ApiConfiguration.ServerInfoBuilder() + .rootServerInfo( + new RootServerInfo.RootServerInfoBuilder() + .rootServer0(new RootServer0()) + .build() + ) + .build(); +ApiConfiguration.ServerIndexInfo serverIndexInfo = new ApiConfiguration.ServerIndexInfoBuilder() + .rootServerInfoServerIndex(RootServerInfo.ServerIndex.SERVER_0) + .build(); +Duration timeout = Duration.ofSeconds(1L); +Map> defaultHeaders = Map.of("User-Agent", List.of("OpenAPI-JSON-Schema-Generator/1.0.0/java")); +ApiConfiguration apiConfiguration = new ApiConfiguration( + serverInfo + serverIndexInfo, + timeout, + defaultHeaders +); +SchemaConfiguration schemaConfiguration = new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().build()); +Fake apiClient = new Fake(apiConfiguration, schemaConfiguration); + + +var request = new FakemultiplerequestbodycontenttypesPost.PostRequestBuilder().build(); + +FakemultiplerequestbodycontenttypesPostResponses.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; +} +FakemultiplerequestbodycontenttypesPostResponses.EndpointFakemultiplerequestbodycontenttypesPostCode200Response castResponse = (FakemultiplerequestbodycontenttypesPostResponses.EndpointFakemultiplerequestbodycontenttypesPostCode200Response) response; +FakemultiplerequestbodycontenttypesPostCode200Response.ApplicationjsonResponseBody deserializedBody = (FakemultiplerequestbodycontenttypesPostCode200Response.ApplicationjsonResponseBody) castResponse.body; +// handle deserialized body here +``` +### uploadDownloadFile +public [FakeuploaddownloadfilePostResponses.EndpointResponse](../../paths/fakeuploaddownloadfile/post/FakeuploaddownloadfilePostResponses.md#endpointresponse) uploadDownloadFile([FakeuploaddownloadfilePost.PostRequest](../../paths/fakeuploaddownloadfile/FakeuploaddownloadfilePost.md#postrequest) request) + + + +**Parameters:**
+request - the input request + +**Returns:**
+the deserialized response + +**Throws:**
+IOException, InterruptedException - an exception happened when making the request
+ValidationException - the returned response body or header values do not conform the the schema validation requirements
+NotImplementedException - the request body serialization or deserialization has not yet been implemented
+ or the header content type deserialization has not yet been implemented for this contentType
+ApiException - server returned a response/contentType not defined in the openapi document
+ +#### 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.fakeuploaddownloadfile.post.FakeuploaddownloadfilePostRequestBody; +import org.openapijsonschematools.client.paths.fakeuploaddownloadfile.post.requestbody.content.applicationoctetstream.ApplicationoctetstreamSchema; +import org.openapijsonschematools.client.servers.RootServer0; +import org.openapijsonschematools.client.servers.RootServer1; +import org.openapijsonschematools.client.servers.RootServer2; +import org.openapijsonschematools.client.paths.fakeuploaddownloadfile.post.responses.FakeuploaddownloadfilePostCode200Response; +import org.openapijsonschematools.client.servers.RootServerInfo; +import org.openapijsonschematools.client.apis.tags.Fake; +import org.openapijsonschematools.client.paths.fakeuploaddownloadfile.post.FakeuploaddownloadfilePostResponses; + +import java.io.IOException; +import java.util.Arrays; +import java.util.List; +import java.util.Map; +import java.util.AbstractMap; + +// if you want to use a server that is not SERVER_0 pass it in here and change the ServerIndex input below +ApiConfiguration.ServerInfo serverInfo = new ApiConfiguration.ServerInfoBuilder() + .rootServerInfo( + new RootServerInfo.RootServerInfoBuilder() + .rootServer0(new RootServer0()) + .build() + ) + .build(); +ApiConfiguration.ServerIndexInfo serverIndexInfo = new ApiConfiguration.ServerIndexInfoBuilder() + .rootServerInfoServerIndex(RootServerInfo.ServerIndex.SERVER_0) + .build(); +Duration timeout = Duration.ofSeconds(1L); +Map> defaultHeaders = Map.of("User-Agent", List.of("OpenAPI-JSON-Schema-Generator/1.0.0/java")); +ApiConfiguration apiConfiguration = new ApiConfiguration( + serverInfo + serverIndexInfo, + timeout, + defaultHeaders +); +SchemaConfiguration schemaConfiguration = new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().build()); +Fake apiClient = new Fake(apiConfiguration, schemaConfiguration); + + +ApplicationoctetstreamSchema1BoxedString requestBodyPayload = ApplicationoctetstreamSchema.ApplicationoctetstreamSchema1.validateAndBox( + "a", + schemaConfiguration +); +FakeuploaddownloadfilePost.SealedRequestBody requestBody = new FakeuploaddownloadfilePost.ApplicationoctetstreamRequestBody(requestBodyPayload); + +var request = new FakeuploaddownloadfilePost.PostRequestBuilder() + .requestBody(requestBody) + .build(); + +FakeuploaddownloadfilePostResponses.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; +} +FakeuploaddownloadfilePostResponses.EndpointFakeuploaddownloadfilePostCode200Response castResponse = (FakeuploaddownloadfilePostResponses.EndpointFakeuploaddownloadfilePostCode200Response) response; +FakeuploaddownloadfilePostCode200Response.ApplicationoctetstreamResponseBody deserializedBody = (FakeuploaddownloadfilePostCode200Response.ApplicationoctetstreamResponseBody) castResponse.body; +// handle deserialized body here +``` +### uploadFiles +public [FakeuploadfilesPostResponses.EndpointResponse](../../paths/fakeuploadfiles/post/FakeuploadfilesPostResponses.md#endpointresponse) uploadFiles([FakeuploadfilesPost.PostRequest](../../paths/fakeuploadfiles/FakeuploadfilesPost.md#postrequest) request) + + + +**Parameters:**
+request - the input request + +**Returns:**
+the deserialized response + +**Throws:**
+IOException, InterruptedException - an exception happened when making the request
+ValidationException - the returned response body or header values do not conform the the schema validation requirements
+NotImplementedException - the request body serialization or deserialization has not yet been implemented
+ or the header content type deserialization has not yet been implemented for this contentType
+ApiException - server returned a response/contentType not defined in the openapi document
+ +#### 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.FakeuploadfilesPostRequestBody; +import org.openapijsonschematools.client.paths.fakeuploadfiles.post.requestbody.content.multipartformdata.MultipartformdataSchema; +import org.openapijsonschematools.client.RootServerInfo; +import org.openapijsonschematools.client.servers.RootServer0; +import org.openapijsonschematools.client.servers.RootServer1; +import org.openapijsonschematools.client.servers.RootServer2; +import org.openapijsonschematools.client.paths.fakeuploadfiles.post.responses.FakeuploadfilesPostCode200Response; +import org.openapijsonschematools.client.servers.RootServerInfo; +import org.openapijsonschematools.client.apis.tags.Fake; +import org.openapijsonschematools.client.paths.fakeuploadfiles.post.FakeuploadfilesPostResponses; + +import java.io.IOException; +import java.util.Arrays; +import java.util.List; +import java.util.Map; +import java.util.AbstractMap; + +// if you want to use a server that is not SERVER_0 pass it in here and change the ServerIndex input below +ApiConfiguration.ServerInfo serverInfo = new ApiConfiguration.ServerInfoBuilder() + .rootServerInfo( + new RootServerInfo.RootServerInfoBuilder() + .rootServer0(new RootServer0()) + .build() + ) + .build(); +ApiConfiguration.ServerIndexInfo serverIndexInfo = new ApiConfiguration.ServerIndexInfoBuilder() + .rootServerInfoServerIndex(RootServerInfo.ServerIndex.SERVER_0) + .build(); +Duration timeout = Duration.ofSeconds(1L); +Map> defaultHeaders = Map.of("User-Agent", List.of("OpenAPI-JSON-Schema-Generator/1.0.0/java")); +ApiConfiguration apiConfiguration = new ApiConfiguration( + serverInfo + serverIndexInfo, + timeout, + defaultHeaders +); +SchemaConfiguration schemaConfiguration = new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().build()); +Fake apiClient = new Fake(apiConfiguration, schemaConfiguration); + + +var request = new FakeuploadfilesPost.PostRequestBuilder().build(); + +FakeuploadfilesPostResponses.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; +} +FakeuploadfilesPostResponses.EndpointFakeuploadfilesPostCode200Response castResponse = (FakeuploadfilesPostResponses.EndpointFakeuploadfilesPostCode200Response) response; +FakeuploadfilesPostCode200Response.ApplicationjsonResponseBody deserializedBody = (FakeuploadfilesPostCode200Response.ApplicationjsonResponseBody) castResponse.body; +// handle deserialized body here +``` +### additionalPropertiesWithArrayOfEnums +public [FakeadditionalpropertieswitharrayofenumsGetResponses.EndpointResponse](../../paths/fakeadditionalpropertieswitharrayofenums/get/FakeadditionalpropertieswitharrayofenumsGetResponses.md#endpointresponse) additionalPropertiesWithArrayOfEnums([FakeadditionalpropertieswitharrayofenumsGet.GetRequest](../../paths/fakeadditionalpropertieswitharrayofenums/FakeadditionalpropertieswitharrayofenumsGet.md#getrequest) request) + +**Parameters:**
+request - the input request + +**Returns:**
+the deserialized response + +**Throws:**
+IOException, InterruptedException - an exception happened when making the request
+ValidationException - the returned response body or header values do not conform the the schema validation requirements
+NotImplementedException - the request body serialization or deserialization has not yet been implemented
+ or the header content type deserialization has not yet been implemented for this contentType
+ApiException - server returned a response/contentType not defined in the openapi document
+ +#### 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.fakeadditionalpropertieswitharrayofenums.get.FakeadditionalpropertieswitharrayofenumsGetRequestBody; +import org.openapijsonschematools.client.components.schemas.AdditionalPropertiesWithArrayOfEnums; +import org.openapijsonschematools.client.RootServerInfo; +import org.openapijsonschematools.client.servers.RootServer0; +import org.openapijsonschematools.client.servers.RootServer1; +import org.openapijsonschematools.client.servers.RootServer2; +import org.openapijsonschematools.client.paths.fakeadditionalpropertieswitharrayofenums.get.responses.FakeadditionalpropertieswitharrayofenumsGetCode200Response; +import org.openapijsonschematools.client.servers.RootServerInfo; +import org.openapijsonschematools.client.apis.tags.Fake; +import org.openapijsonschematools.client.paths.fakeadditionalpropertieswitharrayofenums.get.FakeadditionalpropertieswitharrayofenumsGetResponses; + +import java.io.IOException; +import java.util.Arrays; +import java.util.List; +import java.util.Map; +import java.util.AbstractMap; + +// if you want to use a server that is not SERVER_0 pass it in here and change the ServerIndex input below +ApiConfiguration.ServerInfo serverInfo = new ApiConfiguration.ServerInfoBuilder() + .rootServerInfo( + new RootServerInfo.RootServerInfoBuilder() + .rootServer0(new RootServer0()) + .build() + ) + .build(); +ApiConfiguration.ServerIndexInfo serverIndexInfo = new ApiConfiguration.ServerIndexInfoBuilder() + .rootServerInfoServerIndex(RootServerInfo.ServerIndex.SERVER_0) + .build(); +Duration timeout = Duration.ofSeconds(1L); +Map> defaultHeaders = Map.of("User-Agent", List.of("OpenAPI-JSON-Schema-Generator/1.0.0/java")); +ApiConfiguration apiConfiguration = new ApiConfiguration( + serverInfo + serverIndexInfo, + timeout, + defaultHeaders +); +SchemaConfiguration schemaConfiguration = new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().build()); +Fake apiClient = new Fake(apiConfiguration, schemaConfiguration); + + +var request = new FakeadditionalpropertieswitharrayofenumsGet.GetRequestBuilder().build(); + +FakeadditionalpropertieswitharrayofenumsGetResponses.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; +} +FakeadditionalpropertieswitharrayofenumsGetResponses.EndpointFakeadditionalpropertieswitharrayofenumsGetCode200Response castResponse = (FakeadditionalpropertieswitharrayofenumsGetResponses.EndpointFakeadditionalpropertieswitharrayofenumsGetCode200Response) response; +FakeadditionalpropertieswitharrayofenumsGetCode200Response.ApplicationjsonResponseBody deserializedBody = (FakeadditionalpropertieswitharrayofenumsGetCode200Response.ApplicationjsonResponseBody) castResponse.body; +// handle deserialized body here +``` +### deleteCoffee +public [FakedeletecoffeeidDeleteResponses.EndpointResponse](../../paths/fakedeletecoffeeid/delete/FakedeletecoffeeidDeleteResponses.md#endpointresponse) deleteCoffee([FakedeletecoffeeidDelete.DeleteRequest](../../paths/fakedeletecoffeeid/FakedeletecoffeeidDelete.md#deleterequest) request) + +Delete the coffee identified by the given id, (delete without request body) + +**Parameters:**
+request - the input request + +**Returns:**
+the deserialized response + +**Throws:**
+IOException, InterruptedException - an exception happened when making the request
+ValidationException - the returned response body or header values do not conform the the schema validation requirements
+NotImplementedException - the request body serialization or deserialization has not yet been implemented
+ or the header content type deserialization has not yet been implemented for this contentType
+ApiException - server returned a response/contentType not defined in the openapi document
+ +#### 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.FakedeletecoffeeidDeletePathParameters; +import org.openapijsonschematools.client.servers.RootServer0; +import org.openapijsonschematools.client.servers.RootServer1; +import org.openapijsonschematools.client.servers.RootServer2; +import org.openapijsonschematools.client.paths.fakedeletecoffeeid.delete.responses.FakedeletecoffeeidDeleteCode200Response; +import org.openapijsonschematools.client.paths.fakedeletecoffeeid.delete.responses.FakedeletecoffeeidDeleteCodedefaultResponse; +import org.openapijsonschematools.client.servers.RootServerInfo; +import org.openapijsonschematools.client.apis.tags.Fake; +import org.openapijsonschematools.client.paths.fakedeletecoffeeid.delete.FakedeletecoffeeidDeleteResponses; + +import java.io.IOException; +import java.util.Arrays; +import java.util.List; +import java.util.Map; +import java.util.AbstractMap; + +// if you want to use a server that is not SERVER_0 pass it in here and change the ServerIndex input below +ApiConfiguration.ServerInfo serverInfo = new ApiConfiguration.ServerInfoBuilder() + .rootServerInfo( + new RootServerInfo.RootServerInfoBuilder() + .rootServer0(new RootServer0()) + .build() + ) + .build(); +ApiConfiguration.ServerIndexInfo serverIndexInfo = new ApiConfiguration.ServerIndexInfoBuilder() + .rootServerInfoServerIndex(RootServerInfo.ServerIndex.SERVER_0) + .build(); +Duration timeout = Duration.ofSeconds(1L); +Map> defaultHeaders = Map.of("User-Agent", List.of("OpenAPI-JSON-Schema-Generator/1.0.0/java")); +ApiConfiguration apiConfiguration = new ApiConfiguration( + serverInfo + serverIndexInfo, + timeout, + defaultHeaders +); +SchemaConfiguration schemaConfiguration = new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().build()); +Fake apiClient = new Fake(apiConfiguration, schemaConfiguration); + + +// Map validation +FakedeletecoffeeidDeletePathParameters.PathParametersMap pathParameters = + FakedeletecoffeeidDeletePathParameters.FakedeletecoffeeidDeletePathParameters1.validate( + new FakedeletecoffeeidDeletePathParameters.PathParametersMapBuilder() + .id("a") + + .build(), + schemaConfiguration +); + +var request = new FakedeletecoffeeidDelete.DeleteRequestBuilder() + .pathParameters(pathParameters) + .build(); + +FakedeletecoffeeidDeleteResponses.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 FakedeletecoffeeidDeleteResponses.EndpointFakedeletecoffeeidDeleteCode200Response castResponse) { +} else { + FakedeletecoffeeidDeleteResponses.EndpointFakedeletecoffeeidDeleteCodedefaultResponse castResponse = (FakedeletecoffeeidDeleteResponses.EndpointFakedeletecoffeeidDeleteCodedefaultResponse) response; +} +``` +[[Back to top]](#top) [[Back to README]](../../../README.md) diff --git a/samples/client/petstore/kotlin/docs/apis/tags/Fakeclassnametags123.md b/samples/client/petstore/kotlin/docs/apis/tags/Fakeclassnametags123.md new file mode 100644 index 00000000000..1fd6a698f2c --- /dev/null +++ b/samples/client/petstore/kotlin/docs/apis/tags/Fakeclassnametags123.md @@ -0,0 +1,131 @@ +# Fakeclassnametags123 + +public class Fakeclassnametags123 extends extends ApiClient implements +[FakeclassnametestPatch.ClassnameOperation](../../paths/fakeclassnametest/FakeclassnametestPatch.md#classnameoperation) + +an api client class which contains all the routes for tag="fake_classname_tags 123#$%^" + +## Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| [FakeclassnametestPatchResponses.EndpointResponse](../../paths/fakeclassnametest/patch/FakeclassnametestPatchResponses.md#endpointresponse) | [classname](#classname)([FakeclassnametestPatch.PatchRequest](../../paths/fakeclassnametest/FakeclassnametestPatch.md#patchrequest) request)
To test class name in snake case | + +## Method Detail + +### classname +public [FakeclassnametestPatchResponses.EndpointResponse](../../paths/fakeclassnametest/patch/FakeclassnametestPatchResponses.md#endpointresponse) classname([FakeclassnametestPatch.PatchRequest](../../paths/fakeclassnametest/FakeclassnametestPatch.md#patchrequest) request) + +To test class name in snake case + +**Parameters:**
+request - the input request + +**Returns:**
+the deserialized response + +**Throws:**
+IOException, InterruptedException - an exception happened when making the request
+ValidationException - the returned response body or header values do not conform the the schema validation requirements
+NotImplementedException - the request body serialization or deserialization has not yet been implemented
+ or the header content type deserialization has not yet been implemented for this contentType
+ApiException - server returned a response/contentType not defined in the openapi document
+ +#### 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.fakeclassnametest.patch.FakeclassnametestPatchSecurityInfo; +import org.openapijsonschematools.client.paths.fakeclassnametest.patch.FakeclassnametestPatchRequestBody; +import org.openapijsonschematools.client.components.schemas.Client; +import org.openapijsonschematools.client.servers.RootServer0; +import org.openapijsonschematools.client.servers.RootServer1; +import org.openapijsonschematools.client.servers.RootServer2; +import org.openapijsonschematools.client.securityschemes.SecurityScheme; +import org.openapijsonschematools.client.components.securityschemes.ApiKeyQuery; +import org.openapijsonschematools.client.paths.fakeclassnametest.patch.responses.FakeclassnametestPatchCode200Response; +import org.openapijsonschematools.client.servers.RootServerInfo; +import org.openapijsonschematools.client.apis.tags.Fakeclassnametags123; +import org.openapijsonschematools.client.paths.fakeclassnametest.patch.FakeclassnametestPatchResponses; + +import java.io.IOException; +import java.util.Arrays; +import java.util.List; +import java.util.Map; +import java.util.AbstractMap; + +// if you want to use a server that is not SERVER_0 pass it in here and change the ServerIndex input below +ApiConfiguration.ServerInfo serverInfo = new ApiConfiguration.ServerInfoBuilder() + .rootServerInfo( + new RootServerInfo.RootServerInfoBuilder() + .rootServer0(new RootServer0()) + .build() + ) + .build(); +ApiConfiguration.ServerIndexInfo serverIndexInfo = new ApiConfiguration.ServerIndexInfoBuilder() + .rootServerInfoServerIndex(RootServerInfo.ServerIndex.SERVER_0) + .build(); +List securitySchemes = new ArrayList(); +securitySchemes.add( + new ApiKeyQuery("someApiKey"); +); +ApiConfiguration.SecurityIndexInfo securityIndexInfo = new ApiConfiguration.SecurityIndexInfoBuilder() + .fakeclassnametestPatchSecurityRequirementObject0SecurityIndex(FakeclassnametestPatchSecurityRequirementObject0.SecurityIndex.SECURITY_0) + .build(); +Duration timeout = Duration.ofSeconds(1L); +Map> defaultHeaders = Map.of("User-Agent", List.of("OpenAPI-JSON-Schema-Generator/1.0.0/java")); +ApiConfiguration apiConfiguration = new ApiConfiguration( + serverInfo + serverIndexInfo, + securitySchemes, + securityIndexInfo, + timeout, + defaultHeaders +); +SchemaConfiguration schemaConfiguration = new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().build()); +Fakeclassnametags123 apiClient = new Fakeclassnametags123(apiConfiguration, schemaConfiguration); + + +Client1BoxedMap requestBodyPayload = + Client.Client1.validateAndBox( + new Client.ClientMapBuilder1() + .client("a") + + .build(), + schemaConfiguration +); +FakeclassnametestPatchRequestBody.SealedRequestBody requestBody = new FakeclassnametestPatchRequestBody.ApplicationjsonRequestBody(requestBodyPayload); + +var request = new FakeclassnametestPatch.PatchRequestBuilder() + .requestBody(requestBody) + .build(); + +FakeclassnametestPatchResponses.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; +} +FakeclassnametestPatchResponses.EndpointFakeclassnametestPatchCode200Response castResponse = (FakeclassnametestPatchResponses.EndpointFakeclassnametestPatchCode200Response) response; +FakeclassnametestPatchCode200Response.ApplicationjsonResponseBody deserializedBody = (FakeclassnametestPatchCode200Response.ApplicationjsonResponseBody) castResponse.body; +// handle deserialized body here +``` +[[Back to top]](#top) [[Back to README]](../../../README.md) diff --git a/samples/client/petstore/kotlin/docs/apis/tags/Pet.md b/samples/client/petstore/kotlin/docs/apis/tags/Pet.md new file mode 100644 index 00000000000..f43971759f6 --- /dev/null +++ b/samples/client/petstore/kotlin/docs/apis/tags/Pet.md @@ -0,0 +1,1155 @@ +# Pet + +public class Pet extends extends ApiClient implements +[FakepetiduploadimagewithrequiredfilePost.UploadFileWithRequiredFileOperation](../../paths/fakepetiduploadimagewithrequiredfile/FakepetiduploadimagewithrequiredfilePost.md#uploadfilewithrequiredfileoperation), +[PetPost.AddPetOperation](../../paths/pet/PetPost.md#addpetoperation), +[PetPut.UpdatePetOperation](../../paths/pet/PetPut.md#updatepetoperation), +[PetfindbytagsGet.FindPetsByTagsOperation](../../paths/petfindbytags/PetfindbytagsGet.md#findpetsbytagsoperation), +[PetfindbystatusGet.FindPetsByStatusOperation](../../paths/petfindbystatus/PetfindbystatusGet.md#findpetsbystatusoperation), +[PetpetiduploadimagePost.UploadImageOperation](../../paths/petpetiduploadimage/PetpetiduploadimagePost.md#uploadimageoperation), +[PetpetidDelete.DeletePetOperation](../../paths/petpetid/PetpetidDelete.md#deletepetoperation), +[PetpetidGet.GetPetByIdOperation](../../paths/petpetid/PetpetidGet.md#getpetbyidoperation), +[PetpetidPost.UpdatePetWithFormOperation](../../paths/petpetid/PetpetidPost.md#updatepetwithformoperation) + +an api client class which contains all the routes for tag="pet" +Everything about your Pets + +## Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| [FakepetiduploadimagewithrequiredfilePostResponses.EndpointResponse](../../paths/fakepetiduploadimagewithrequiredfile/post/FakepetiduploadimagewithrequiredfilePostResponses.md#endpointresponse) | [uploadFileWithRequiredFile](#uploadfilewithrequiredfile)([FakepetiduploadimagewithrequiredfilePost.PostRequest](../../paths/fakepetiduploadimagewithrequiredfile/FakepetiduploadimagewithrequiredfilePost.md#postrequest) request)
| +| [PetPostResponses.EndpointResponse](../../paths/pet/post/PetPostResponses.md#endpointresponse) | [addPet](#addpet)([PetPost.PostRequest](../../paths/pet/PetPost.md#postrequest) request)
Add a new pet to the store | +| Nothing? | [updatePet](#updatepet)([PetPut.PutRequest](../../paths/pet/PetPut.md#putrequest) request)
| +| [PetfindbytagsGetResponses.EndpointResponse](../../paths/petfindbytags/get/PetfindbytagsGetResponses.md#endpointresponse) | [findPetsByTags](#findpetsbytags)([PetfindbytagsGet.GetRequest](../../paths/petfindbytags/PetfindbytagsGet.md#getrequest) request)
Multiple tags can be provided with comma separated strings. Use tag1, tag2, tag3 for testing. | +| [PetfindbystatusGetResponses.EndpointResponse](../../paths/petfindbystatus/get/PetfindbystatusGetResponses.md#endpointresponse) | [findPetsByStatus](#findpetsbystatus)([PetfindbystatusGet.GetRequest](../../paths/petfindbystatus/PetfindbystatusGet.md#getrequest) request)
Multiple status values can be provided with comma separated strings | +| [PetpetiduploadimagePostResponses.EndpointResponse](../../paths/petpetiduploadimage/post/PetpetiduploadimagePostResponses.md#endpointresponse) | [uploadImage](#uploadimage)([PetpetiduploadimagePost.PostRequest](../../paths/petpetiduploadimage/PetpetiduploadimagePost.md#postrequest) request)
| +| Nothing? | [deletePet](#deletepet)([PetpetidDelete.DeleteRequest](../../paths/petpetid/PetpetidDelete.md#deleterequest) request)
| +| [PetpetidGetResponses.EndpointResponse](../../paths/petpetid/get/PetpetidGetResponses.md#endpointresponse) | [getPetById](#getpetbyid)([PetpetidGet.GetRequest](../../paths/petpetid/PetpetidGet.md#getrequest) request)
Returns a single pet | +| Nothing? | [updatePetWithForm](#updatepetwithform)([PetpetidPost.PostRequest](../../paths/petpetid/PetpetidPost.md#postrequest) request)
| + +## Method Detail + +### uploadFileWithRequiredFile +public [FakepetiduploadimagewithrequiredfilePostResponses.EndpointResponse](../../paths/fakepetiduploadimagewithrequiredfile/post/FakepetiduploadimagewithrequiredfilePostResponses.md#endpointresponse) uploadFileWithRequiredFile([FakepetiduploadimagewithrequiredfilePost.PostRequest](../../paths/fakepetiduploadimagewithrequiredfile/FakepetiduploadimagewithrequiredfilePost.md#postrequest) request) + + + +**Parameters:**
+request - the input request + +**Returns:**
+the deserialized response + +**Throws:**
+IOException, InterruptedException - an exception happened when making the request
+ValidationException - the returned response body or header values do not conform the the schema validation requirements
+NotImplementedException - the request body serialization or deserialization has not yet been implemented
+ or the header content type deserialization has not yet been implemented for this contentType
+ApiException - server returned a response/contentType not defined in the openapi document
+ +#### 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.FakepetiduploadimagewithrequiredfilePostRequestBody; +import org.openapijsonschematools.client.RootServerInfo; +import org.openapijsonschematools.client.paths.fakepetiduploadimagewithrequiredfile.post.FakepetiduploadimagewithrequiredfilePostSecurityInfo; +import org.openapijsonschematools.client.paths.fakepetiduploadimagewithrequiredfile.post.FakepetiduploadimagewithrequiredfilePostPathParameters; +import org.openapijsonschematools.client.servers.RootServer0; +import org.openapijsonschematools.client.servers.RootServer1; +import org.openapijsonschematools.client.servers.RootServer2; +import org.openapijsonschematools.client.securityschemes.SecurityScheme; +import org.openapijsonschematools.client.components.securityschemes.PetstoreAuth; +import org.openapijsonschematools.client.paths.fakepetiduploadimagewithrequiredfile.post.responses.FakepetiduploadimagewithrequiredfilePostCode200Response; +import org.openapijsonschematools.client.servers.RootServerInfo; +import org.openapijsonschematools.client.apis.tags.Pet; +import org.openapijsonschematools.client.paths.fakepetiduploadimagewithrequiredfile.post.FakepetiduploadimagewithrequiredfilePostResponses; + +import java.io.IOException; +import java.util.Arrays; +import java.util.List; +import java.util.Map; +import java.util.AbstractMap; + +// if you want to use a server that is not SERVER_0 pass it in here and change the ServerIndex input below +ApiConfiguration.ServerInfo serverInfo = new ApiConfiguration.ServerInfoBuilder() + .rootServerInfo( + new RootServerInfo.RootServerInfoBuilder() + .rootServer0(new RootServer0()) + .build() + ) + .build(); +ApiConfiguration.ServerIndexInfo serverIndexInfo = new ApiConfiguration.ServerIndexInfoBuilder() + .rootServerInfoServerIndex(RootServerInfo.ServerIndex.SERVER_0) + .build(); +List securitySchemes = new ArrayList(); +ApiConfiguration.SecurityIndexInfo securityIndexInfo = new ApiConfiguration.SecurityIndexInfoBuilder() + .fakepetiduploadimagewithrequiredfilePostSecurityRequirementObject0SecurityIndex(FakepetiduploadimagewithrequiredfilePostSecurityRequirementObject0.SecurityIndex.SECURITY_0) + .build(); +Duration timeout = Duration.ofSeconds(1L); +Map> defaultHeaders = Map.of("User-Agent", List.of("OpenAPI-JSON-Schema-Generator/1.0.0/java")); +ApiConfiguration apiConfiguration = new ApiConfiguration( + serverInfo + serverIndexInfo, + securitySchemes, + securityIndexInfo, + timeout, + defaultHeaders +); +SchemaConfiguration schemaConfiguration = new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().build()); +Pet apiClient = new Pet(apiConfiguration, schemaConfiguration); + + +// Map validation +FakepetiduploadimagewithrequiredfilePostPathParameters.PathParametersMap pathParameters = + FakepetiduploadimagewithrequiredfilePostPathParameters.FakepetiduploadimagewithrequiredfilePostPathParameters1.validate( + new FakepetiduploadimagewithrequiredfilePostPathParameters.PathParametersMapBuilder() + .petId(1L) + + .build(), + schemaConfiguration +); + +var request = new FakepetiduploadimagewithrequiredfilePost.PostRequestBuilder() + .pathParameters(pathParameters) + .build(); + +FakepetiduploadimagewithrequiredfilePostResponses.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; +} +FakepetiduploadimagewithrequiredfilePostResponses.EndpointFakepetiduploadimagewithrequiredfilePostCode200Response castResponse = (FakepetiduploadimagewithrequiredfilePostResponses.EndpointFakepetiduploadimagewithrequiredfilePostCode200Response) response; +FakepetiduploadimagewithrequiredfilePostCode200Response.ApplicationjsonResponseBody deserializedBody = (FakepetiduploadimagewithrequiredfilePostCode200Response.ApplicationjsonResponseBody) castResponse.body; +// handle deserialized body here +``` +### addPet +public [PetPostResponses.EndpointResponse](../../paths/pet/post/PetPostResponses.md#endpointresponse) addPet([PetPost.PostRequest](../../paths/pet/PetPost.md#postrequest) request) + +Add a new pet to the store + +**Parameters:**
+request - the input request + +**Returns:**
+the deserialized response + +**Throws:**
+IOException, InterruptedException - an exception happened when making the request
+ValidationException - the returned response body or header values do not conform the the schema validation requirements
+NotImplementedException - the request body serialization or deserialization has not yet been implemented
+ or the header content type deserialization has not yet been implemented for this contentType
+ApiException - server returned a response/contentType not defined in the openapi document
+ +#### 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.PetPostRequestBody; +import org.openapijsonschematools.client.components.schemas.Pet; +import org.openapijsonschematools.client.servers.RootServer0; +import org.openapijsonschematools.client.servers.RootServer1; +import org.openapijsonschematools.client.servers.RootServer2; +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.PetPostCode200Response; +import org.openapijsonschematools.client.paths.pet.post.responses.PetPostCode405Response; +import org.openapijsonschematools.client.servers.RootServerInfo; +import org.openapijsonschematools.client.apis.tags.Pet; +import org.openapijsonschematools.client.paths.pet.post.PetPostResponses; + +import java.io.IOException; +import java.util.Arrays; +import java.util.List; +import java.util.Map; +import java.util.AbstractMap; + +// if you want to use a server that is not SERVER_0 pass it in here and change the ServerIndex input below +ApiConfiguration.ServerInfo serverInfo = new ApiConfiguration.ServerInfoBuilder() + .rootServerInfo( + new RootServerInfo.RootServerInfoBuilder() + .rootServer0(new RootServer0()) + .build() + ) + .build(); +ApiConfiguration.ServerIndexInfo serverIndexInfo = new ApiConfiguration.ServerIndexInfoBuilder() + .rootServerInfoServerIndex(RootServerInfo.ServerIndex.SERVER_0) + .build(); +List securitySchemes = new ArrayList(); +securitySchemes.add( + new ApiKey("someApiKey"); +); +ApiConfiguration.SecurityIndexInfo securityIndexInfo = new ApiConfiguration.SecurityIndexInfoBuilder() + .petPostSecurityRequirementObject0SecurityIndex(PetPostSecurityRequirementObject0.SecurityIndex.SECURITY_0) + .build(); +Duration timeout = Duration.ofSeconds(1L); +Map> defaultHeaders = Map.of("User-Agent", List.of("OpenAPI-JSON-Schema-Generator/1.0.0/java")); +ApiConfiguration apiConfiguration = new ApiConfiguration( + serverInfo + serverIndexInfo, + securitySchemes, + securityIndexInfo, + timeout, + defaultHeaders +); +SchemaConfiguration schemaConfiguration = new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().build()); +Pet apiClient = new Pet(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 +); +PetPostRequestBody.SealedRequestBody requestBody = new PetPostRequestBody.ApplicationjsonRequestBody(requestBodyPayload); + +var request = new PetPost.PostRequestBuilder() + .requestBody(requestBody) + .build(); + +PetPostResponses.EndpointResponse response; +try { + response = apiClient.post(request); +} catch (PetPostCode405Response.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; +} +PetPostResponses.EndpointPetPostCode200Response castResponse = (PetPostResponses.EndpointPetPostCode200Response) response; +``` +### updatePet +public Nothing? updatePet([PetPut.PutRequest](../../paths/pet/PetPut.md#putrequest) request) + + + +**Parameters:**
+request - the input request + +**Returns:**
+nothing (Nothing?) + +**Throws:**
+IOException, InterruptedException - an exception happened when making the request
+ValidationException - the returned response body or header values do not conform the the schema validation requirements
+NotImplementedException - the request body serialization or deserialization has not yet been implemented
+ or the header content type deserialization has not yet been implemented for this contentType
+ApiException - server returned a response/contentType not defined in the openapi document
+ +#### 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.PetPutRequestBody; +import org.openapijsonschematools.client.components.schemas.Pet; +import org.openapijsonschematools.client.servers.RootServer0; +import org.openapijsonschematools.client.servers.RootServer1; +import org.openapijsonschematools.client.servers.RootServer2; +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.pet.put.responses.PetPutCode400Response; +import org.openapijsonschematools.client.paths.pet.put.responses.PetPutCode404Response; +import org.openapijsonschematools.client.paths.pet.put.responses.PetPutCode405Response; +import org.openapijsonschematools.client.servers.RootServerInfo; +import org.openapijsonschematools.client.apis.tags.Pet; +import org.openapijsonschematools.client.paths.pet.put.PetPutResponses; + +import java.io.IOException; +import java.util.Arrays; +import java.util.List; +import java.util.Map; +import java.util.AbstractMap; + +// if you want to use a server that is not SERVER_0 pass it in here and change the ServerIndex input below +ApiConfiguration.ServerInfo serverInfo = new ApiConfiguration.ServerInfoBuilder() + .rootServerInfo( + new RootServerInfo.RootServerInfoBuilder() + .rootServer0(new RootServer0()) + .build() + ) + .build(); +ApiConfiguration.ServerIndexInfo serverIndexInfo = new ApiConfiguration.ServerIndexInfoBuilder() + .rootServerInfoServerIndex(RootServerInfo.ServerIndex.SERVER_0) + .build(); +List securitySchemes = new ArrayList(); +ApiConfiguration.SecurityIndexInfo securityIndexInfo = new ApiConfiguration.SecurityIndexInfoBuilder() + .petPutSecurityRequirementObject0SecurityIndex(PetPutSecurityRequirementObject0.SecurityIndex.SECURITY_0) + .build(); +Duration timeout = Duration.ofSeconds(1L); +Map> defaultHeaders = Map.of("User-Agent", List.of("OpenAPI-JSON-Schema-Generator/1.0.0/java")); +ApiConfiguration apiConfiguration = new ApiConfiguration( + serverInfo + serverIndexInfo, + securitySchemes, + securityIndexInfo, + timeout, + defaultHeaders +); +SchemaConfiguration schemaConfiguration = new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().build()); +Pet apiClient = new Pet(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 +); +PetPutRequestBody.SealedRequestBody requestBody = new PetPutRequestBody.ApplicationjsonRequestBody(requestBodyPayload); + +var request = new PetPut.PutRequestBuilder() + .requestBody(requestBody) + .build(); + +Nothing? response; +try { + response = apiClient.put(request); +} catch (PetPutCode400Response.ResponseApiException | PetPutCode404Response.ResponseApiException | PetPutCode405Response.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; +} +``` +### findPetsByTags +public [PetfindbytagsGetResponses.EndpointResponse](../../paths/petfindbytags/get/PetfindbytagsGetResponses.md#endpointresponse) findPetsByTags([PetfindbytagsGet.GetRequest](../../paths/petfindbytags/PetfindbytagsGet.md#getrequest) request) + +Multiple tags can be provided with comma separated strings. Use tag1, tag2, tag3 for testing. + +**Parameters:**
+request - the input request + +**Returns:**
+the deserialized response + +**Throws:**
+IOException, InterruptedException - an exception happened when making the request
+ValidationException - the returned response body or header values do not conform the the schema validation requirements
+NotImplementedException - the request body serialization or deserialization has not yet been implemented
+ or the header content type deserialization has not yet been implemented for this contentType
+ApiException - server returned a response/contentType not defined in the openapi document
+ +#### 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.petfindbytags.get.PetfindbytagsGetSecurityInfo; +import org.openapijsonschematools.client.paths.petfindbytags.get.PetfindbytagsGetQueryParameters; +import org.openapijsonschematools.client.servers.RootServer0; +import org.openapijsonschematools.client.servers.RootServer1; +import org.openapijsonschematools.client.servers.RootServer2; +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.PetfindbytagsGetCode200Response; +import org.openapijsonschematools.client.paths.petfindbytags.get.responses.PetfindbytagsGetCode400Response; +import org.openapijsonschematools.client.servers.RootServerInfo; +import org.openapijsonschematools.client.apis.tags.Pet; +import org.openapijsonschematools.client.paths.petfindbytags.get.PetfindbytagsGetResponses; + +import java.io.IOException; +import java.util.Arrays; +import java.util.List; +import java.util.Map; +import java.util.AbstractMap; + +// if you want to use a server that is not SERVER_0 pass it in here and change the ServerIndex input below +ApiConfiguration.ServerInfo serverInfo = new ApiConfiguration.ServerInfoBuilder() + .rootServerInfo( + new RootServerInfo.RootServerInfoBuilder() + .rootServer0(new RootServer0()) + .build() + ) + .build(); +ApiConfiguration.ServerIndexInfo serverIndexInfo = new ApiConfiguration.ServerIndexInfoBuilder() + .rootServerInfoServerIndex(RootServerInfo.ServerIndex.SERVER_0) + .build(); +List securitySchemes = new ArrayList(); +ApiConfiguration.SecurityIndexInfo securityIndexInfo = new ApiConfiguration.SecurityIndexInfoBuilder() + .petfindbytagsGetSecurityRequirementObject0SecurityIndex(PetfindbytagsGetSecurityRequirementObject0.SecurityIndex.SECURITY_0) + .build(); +Duration timeout = Duration.ofSeconds(1L); +Map> defaultHeaders = Map.of("User-Agent", List.of("OpenAPI-JSON-Schema-Generator/1.0.0/java")); +ApiConfiguration apiConfiguration = new ApiConfiguration( + serverInfo + serverIndexInfo, + securitySchemes, + securityIndexInfo, + timeout, + defaultHeaders +); +SchemaConfiguration schemaConfiguration = new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().build()); +Pet apiClient = new Pet(apiConfiguration, schemaConfiguration); + + +// Map validation +PetfindbytagsGetQueryParameters.QueryParametersMap queryParameters = + PetfindbytagsGetQueryParameters.PetfindbytagsGetQueryParameters1.validate( + new PetfindbytagsGetQueryParameters.QueryParametersMapBuilder() + .tags( + Arrays.asList( + "a" + ) + ) + .build(), + schemaConfiguration +); + +var request = new PetfindbytagsGet.GetRequestBuilder() + .queryParameters(queryParameters) + .build(); + +PetfindbytagsGetResponses.EndpointResponse response; +try { + response = apiClient.get(request); +} catch (PetfindbytagsGetCode400Response.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; +} +PetfindbytagsGetResponses.EndpointPetfindbytagsGetCode200Response castResponse = (PetfindbytagsGetResponses.EndpointPetfindbytagsGetCode200Response) response; +} +``` +### findPetsByStatus +public [PetfindbystatusGetResponses.EndpointResponse](../../paths/petfindbystatus/get/PetfindbystatusGetResponses.md#endpointresponse) findPetsByStatus([PetfindbystatusGet.GetRequest](../../paths/petfindbystatus/PetfindbystatusGet.md#getrequest) request) + +Multiple status values can be provided with comma separated strings + +**Parameters:**
+request - the input request + +**Returns:**
+the deserialized response + +**Throws:**
+IOException, InterruptedException - an exception happened when making the request
+ValidationException - the returned response body or header values do not conform the the schema validation requirements
+NotImplementedException - the request body serialization or deserialization has not yet been implemented
+ or the header content type deserialization has not yet been implemented for this contentType
+ApiException - server returned a response/contentType not defined in the openapi document
+ +#### 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.petfindbystatus.PetfindbystatusServerInfo; +import org.openapijsonschematools.client.paths.petfindbystatus.get.PetfindbystatusGetSecurityInfo; +import org.openapijsonschematools.client.paths.petfindbystatus.get.PetfindbystatusGetQueryParameters; +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.PetfindbystatusGetCode200Response; +import org.openapijsonschematools.client.paths.petfindbystatus.get.responses.PetfindbystatusGetCode400Response; +import org.openapijsonschematools.client.paths.petfindbystatus.PetfindbystatusServerInfo; +import org.openapijsonschematools.client.apis.tags.Pet; +import org.openapijsonschematools.client.paths.petfindbystatus.get.PetfindbystatusGetResponses; + +import java.io.IOException; +import java.util.Arrays; +import java.util.List; +import java.util.Map; +import java.util.AbstractMap; + +// if you want to use a server that is not SERVER_0 pass it in here and change the ServerIndex input below +ApiConfiguration.ServerInfo serverInfo = new ApiConfiguration.ServerInfoBuilder() + .petfindbystatusServerInfo( + new PetfindbystatusServerInfo.PetfindbystatusServerInfoBuilder() + .petfindbystatusServer0(new PetfindbystatusServer0()) + .build() + ) + .build(); +ApiConfiguration.ServerIndexInfo serverIndexInfo = new ApiConfiguration.ServerIndexInfoBuilder() + .petfindbystatusServerInfoServerIndex(PetfindbystatusServerInfo.ServerIndex.SERVER_0) + .build(); +List securitySchemes = new ArrayList(); +securitySchemes.add( + new ApiKey("someApiKey"); +); +ApiConfiguration.SecurityIndexInfo securityIndexInfo = new ApiConfiguration.SecurityIndexInfoBuilder() + .petfindbystatusGetSecurityRequirementObject0SecurityIndex(PetfindbystatusGetSecurityRequirementObject0.SecurityIndex.SECURITY_0) + .build(); +Duration timeout = Duration.ofSeconds(1L); +Map> defaultHeaders = Map.of("User-Agent", List.of("OpenAPI-JSON-Schema-Generator/1.0.0/java")); +ApiConfiguration apiConfiguration = new ApiConfiguration( + serverInfo + serverIndexInfo, + securitySchemes, + securityIndexInfo, + timeout, + defaultHeaders +); +SchemaConfiguration schemaConfiguration = new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().build()); +Pet apiClient = new Pet(apiConfiguration, schemaConfiguration); + + +// Map validation +PetfindbystatusGetQueryParameters.QueryParametersMap queryParameters = + PetfindbystatusGetQueryParameters.PetfindbystatusGetQueryParameters1.validate( + new PetfindbystatusGetQueryParameters.QueryParametersMapBuilder() + .status( + Arrays.asList( + "available" + ) + ) + .build(), + schemaConfiguration +); + +var request = new PetfindbystatusGet.GetRequestBuilder() + .queryParameters(queryParameters) + .build(); + +PetfindbystatusGetResponses.EndpointResponse response; +try { + response = apiClient.get(request); +} catch (PetfindbystatusGetCode400Response.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; +} +PetfindbystatusGetResponses.EndpointPetfindbystatusGetCode200Response castResponse = (PetfindbystatusGetResponses.EndpointPetfindbystatusGetCode200Response) response; +} +``` +### uploadImage +public [PetpetiduploadimagePostResponses.EndpointResponse](../../paths/petpetiduploadimage/post/PetpetiduploadimagePostResponses.md#endpointresponse) uploadImage([PetpetiduploadimagePost.PostRequest](../../paths/petpetiduploadimage/PetpetiduploadimagePost.md#postrequest) request) + + + +**Parameters:**
+request - the input request + +**Returns:**
+the deserialized response + +**Throws:**
+IOException, InterruptedException - an exception happened when making the request
+ValidationException - the returned response body or header values do not conform the the schema validation requirements
+NotImplementedException - the request body serialization or deserialization has not yet been implemented
+ or the header content type deserialization has not yet been implemented for this contentType
+ApiException - server returned a response/contentType not defined in the openapi document
+ +#### 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.PetpetiduploadimagePostRequestBody; +import org.openapijsonschematools.client.RootServerInfo; +import org.openapijsonschematools.client.paths.petpetiduploadimage.post.PetpetiduploadimagePostSecurityInfo; +import org.openapijsonschematools.client.paths.petpetiduploadimage.post.PetpetiduploadimagePostPathParameters; +import org.openapijsonschematools.client.servers.RootServer0; +import org.openapijsonschematools.client.servers.RootServer1; +import org.openapijsonschematools.client.servers.RootServer2; +import org.openapijsonschematools.client.securityschemes.SecurityScheme; +import org.openapijsonschematools.client.components.securityschemes.PetstoreAuth; +import org.openapijsonschematools.client.paths.petpetiduploadimage.post.responses.PetpetiduploadimagePostCode200Response; +import org.openapijsonschematools.client.components.responses.successwithjsonapiresponse.SuccessWithJsonApiResponseHeadersSchema; +import org.openapijsonschematools.client.servers.RootServerInfo; +import org.openapijsonschematools.client.apis.tags.Pet; +import org.openapijsonschematools.client.paths.petpetiduploadimage.post.PetpetiduploadimagePostResponses; + +import java.io.IOException; +import java.util.Arrays; +import java.util.List; +import java.util.Map; +import java.util.AbstractMap; + +// if you want to use a server that is not SERVER_0 pass it in here and change the ServerIndex input below +ApiConfiguration.ServerInfo serverInfo = new ApiConfiguration.ServerInfoBuilder() + .rootServerInfo( + new RootServerInfo.RootServerInfoBuilder() + .rootServer0(new RootServer0()) + .build() + ) + .build(); +ApiConfiguration.ServerIndexInfo serverIndexInfo = new ApiConfiguration.ServerIndexInfoBuilder() + .rootServerInfoServerIndex(RootServerInfo.ServerIndex.SERVER_0) + .build(); +List securitySchemes = new ArrayList(); +ApiConfiguration.SecurityIndexInfo securityIndexInfo = new ApiConfiguration.SecurityIndexInfoBuilder() + .petpetiduploadimagePostSecurityRequirementObject0SecurityIndex(PetpetiduploadimagePostSecurityRequirementObject0.SecurityIndex.SECURITY_0) + .build(); +Duration timeout = Duration.ofSeconds(1L); +Map> defaultHeaders = Map.of("User-Agent", List.of("OpenAPI-JSON-Schema-Generator/1.0.0/java")); +ApiConfiguration apiConfiguration = new ApiConfiguration( + serverInfo + serverIndexInfo, + securitySchemes, + securityIndexInfo, + timeout, + defaultHeaders +); +SchemaConfiguration schemaConfiguration = new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().build()); +Pet apiClient = new Pet(apiConfiguration, schemaConfiguration); + + +// Map validation +PetpetiduploadimagePostPathParameters.PathParametersMap pathParameters = + PetpetiduploadimagePostPathParameters.PetpetiduploadimagePostPathParameters1.validate( + new PetpetiduploadimagePostPathParameters.PathParametersMapBuilder() + .petId(1L) + + .build(), + schemaConfiguration +); + +var request = new PetpetiduploadimagePost.PostRequestBuilder() + .pathParameters(pathParameters) + .build(); + +PetpetiduploadimagePostResponses.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; +} +PetpetiduploadimagePostResponses.EndpointPetpetiduploadimagePostCode200Response castResponse = (PetpetiduploadimagePostResponses.EndpointPetpetiduploadimagePostCode200Response) response; +} +``` +### deletePet +public Nothing? deletePet([PetpetidDelete.DeleteRequest](../../paths/petpetid/PetpetidDelete.md#deleterequest) request) + + + +**Parameters:**
+request - the input request + +**Returns:**
+nothing (Nothing?) + +**Throws:**
+IOException, InterruptedException - an exception happened when making the request
+ValidationException - the returned response body or header values do not conform the the schema validation requirements
+NotImplementedException - the request body serialization or deserialization has not yet been implemented
+ or the header content type deserialization has not yet been implemented for this contentType
+ApiException - server returned a response/contentType not defined in the openapi document
+ +#### 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.PetpetidDeleteHeaderParameters; +import org.openapijsonschematools.client.RootServerInfo; +import org.openapijsonschematools.client.paths.petpetid.delete.PetpetidDeleteSecurityInfo; +import org.openapijsonschematools.client.paths.petpetid.delete.PetpetidDeletePathParameters; +import org.openapijsonschematools.client.servers.RootServer0; +import org.openapijsonschematools.client.servers.RootServer1; +import org.openapijsonschematools.client.servers.RootServer2; +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.PetpetidDeleteCode400Response; +import org.openapijsonschematools.client.servers.RootServerInfo; +import org.openapijsonschematools.client.apis.tags.Pet; +import org.openapijsonschematools.client.paths.petpetid.delete.PetpetidDeleteResponses; + +import java.io.IOException; +import java.util.Arrays; +import java.util.List; +import java.util.Map; +import java.util.AbstractMap; + +// if you want to use a server that is not SERVER_0 pass it in here and change the ServerIndex input below +ApiConfiguration.ServerInfo serverInfo = new ApiConfiguration.ServerInfoBuilder() + .rootServerInfo( + new RootServerInfo.RootServerInfoBuilder() + .rootServer0(new RootServer0()) + .build() + ) + .build(); +ApiConfiguration.ServerIndexInfo serverIndexInfo = new ApiConfiguration.ServerIndexInfoBuilder() + .rootServerInfoServerIndex(RootServerInfo.ServerIndex.SERVER_0) + .build(); +List securitySchemes = new ArrayList(); +securitySchemes.add( + new ApiKey("someApiKey"); +); +ApiConfiguration.SecurityIndexInfo securityIndexInfo = new ApiConfiguration.SecurityIndexInfoBuilder() + .petpetidDeleteSecurityRequirementObject0SecurityIndex(PetpetidDeleteSecurityRequirementObject0.SecurityIndex.SECURITY_0) + .build(); +Duration timeout = Duration.ofSeconds(1L); +Map> defaultHeaders = Map.of("User-Agent", List.of("OpenAPI-JSON-Schema-Generator/1.0.0/java")); +ApiConfiguration apiConfiguration = new ApiConfiguration( + serverInfo + serverIndexInfo, + securitySchemes, + securityIndexInfo, + timeout, + defaultHeaders +); +SchemaConfiguration schemaConfiguration = new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().build()); +Pet apiClient = new Pet(apiConfiguration, schemaConfiguration); + + +// Map validation +PetpetidDeletePathParameters.PathParametersMap pathParameters = + PetpetidDeletePathParameters.PetpetidDeletePathParameters1.validate( + new PetpetidDeletePathParameters.PathParametersMapBuilder() + .petId(1L) + + .build(), + schemaConfiguration +); + +var request = new PetpetidDelete.DeleteRequestBuilder() + .pathParameters(pathParameters) + .build(); + +Nothing? response; +try { + response = apiClient.delete(request); +} catch (PetpetidDeleteCode400Response.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; +} +``` +### getPetById +public [PetpetidGetResponses.EndpointResponse](../../paths/petpetid/get/PetpetidGetResponses.md#endpointresponse) getPetById([PetpetidGet.GetRequest](../../paths/petpetid/PetpetidGet.md#getrequest) request) + +Returns a single pet + +**Parameters:**
+request - the input request + +**Returns:**
+the deserialized response + +**Throws:**
+IOException, InterruptedException - an exception happened when making the request
+ValidationException - the returned response body or header values do not conform the the schema validation requirements
+NotImplementedException - the request body serialization or deserialization has not yet been implemented
+ or the header content type deserialization has not yet been implemented for this contentType
+ApiException - server returned a response/contentType not defined in the openapi document
+ +#### 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.petpetid.get.PetpetidGetSecurityInfo; +import org.openapijsonschematools.client.paths.petpetid.get.PetpetidGetPathParameters; +import org.openapijsonschematools.client.servers.RootServer0; +import org.openapijsonschematools.client.servers.RootServer1; +import org.openapijsonschematools.client.servers.RootServer2; +import org.openapijsonschematools.client.securityschemes.SecurityScheme; +import org.openapijsonschematools.client.components.securityschemes.ApiKey; +import org.openapijsonschematools.client.paths.petpetid.get.responses.PetpetidGetCode200Response; +import org.openapijsonschematools.client.paths.petpetid.get.responses.PetpetidGetCode400Response; +import org.openapijsonschematools.client.paths.petpetid.get.responses.PetpetidGetCode404Response; +import org.openapijsonschematools.client.servers.RootServerInfo; +import org.openapijsonschematools.client.apis.tags.Pet; +import org.openapijsonschematools.client.paths.petpetid.get.PetpetidGetResponses; + +import java.io.IOException; +import java.util.Arrays; +import java.util.List; +import java.util.Map; +import java.util.AbstractMap; + +// if you want to use a server that is not SERVER_0 pass it in here and change the ServerIndex input below +ApiConfiguration.ServerInfo serverInfo = new ApiConfiguration.ServerInfoBuilder() + .rootServerInfo( + new RootServerInfo.RootServerInfoBuilder() + .rootServer0(new RootServer0()) + .build() + ) + .build(); +ApiConfiguration.ServerIndexInfo serverIndexInfo = new ApiConfiguration.ServerIndexInfoBuilder() + .rootServerInfoServerIndex(RootServerInfo.ServerIndex.SERVER_0) + .build(); +List securitySchemes = new ArrayList(); +securitySchemes.add( + new ApiKey("someApiKey"); +); +ApiConfiguration.SecurityIndexInfo securityIndexInfo = new ApiConfiguration.SecurityIndexInfoBuilder() + .petpetidGetSecurityRequirementObject0SecurityIndex(PetpetidGetSecurityRequirementObject0.SecurityIndex.SECURITY_0) + .build(); +Duration timeout = Duration.ofSeconds(1L); +Map> defaultHeaders = Map.of("User-Agent", List.of("OpenAPI-JSON-Schema-Generator/1.0.0/java")); +ApiConfiguration apiConfiguration = new ApiConfiguration( + serverInfo + serverIndexInfo, + securitySchemes, + securityIndexInfo, + timeout, + defaultHeaders +); +SchemaConfiguration schemaConfiguration = new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().build()); +Pet apiClient = new Pet(apiConfiguration, schemaConfiguration); + + +// Map validation +PetpetidGetPathParameters.PathParametersMap pathParameters = + PetpetidGetPathParameters.PetpetidGetPathParameters1.validate( + new PetpetidGetPathParameters.PathParametersMapBuilder() + .petId(1L) + + .build(), + schemaConfiguration +); + +var request = new PetpetidGet.GetRequestBuilder() + .pathParameters(pathParameters) + .build(); + +PetpetidGetResponses.EndpointResponse response; +try { + response = apiClient.get(request); +} catch (PetpetidGetCode400Response.ResponseApiException | PetpetidGetCode404Response.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; +} +PetpetidGetResponses.EndpointPetpetidGetCode200Response castResponse = (PetpetidGetResponses.EndpointPetpetidGetCode200Response) response; +if (castResponse.body instanceof PetpetidGetCode200Response.ApplicationxmlResponseBody deserializedBody) { + // handle deserialized body here +} else { + PetpetidGetCode200Response.ApplicationjsonResponseBody deserializedBody = (PetpetidGetCode200Response.ApplicationjsonResponseBody) castResponse.body; + // handle deserialized body here +} +``` +### updatePetWithForm +public Nothing? updatePetWithForm([PetpetidPost.PostRequest](../../paths/petpetid/PetpetidPost.md#postrequest) request) + + + +**Parameters:**
+request - the input request + +**Returns:**
+nothing (Nothing?) + +**Throws:**
+IOException, InterruptedException - an exception happened when making the request
+ValidationException - the returned response body or header values do not conform the the schema validation requirements
+NotImplementedException - the request body serialization or deserialization has not yet been implemented
+ or the header content type deserialization has not yet been implemented for this contentType
+ApiException - server returned a response/contentType not defined in the openapi document
+ +#### 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.PetpetidPostRequestBody; +import org.openapijsonschematools.client.RootServerInfo; +import org.openapijsonschematools.client.paths.petpetid.post.PetpetidPostSecurityInfo; +import org.openapijsonschematools.client.paths.petpetid.post.PetpetidPostPathParameters; +import org.openapijsonschematools.client.servers.RootServer0; +import org.openapijsonschematools.client.servers.RootServer1; +import org.openapijsonschematools.client.servers.RootServer2; +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.PetpetidPostCode405Response; +import org.openapijsonschematools.client.servers.RootServerInfo; +import org.openapijsonschematools.client.apis.tags.Pet; +import org.openapijsonschematools.client.paths.petpetid.post.PetpetidPostResponses; + +import java.io.IOException; +import java.util.Arrays; +import java.util.List; +import java.util.Map; +import java.util.AbstractMap; + +// if you want to use a server that is not SERVER_0 pass it in here and change the ServerIndex input below +ApiConfiguration.ServerInfo serverInfo = new ApiConfiguration.ServerInfoBuilder() + .rootServerInfo( + new RootServerInfo.RootServerInfoBuilder() + .rootServer0(new RootServer0()) + .build() + ) + .build(); +ApiConfiguration.ServerIndexInfo serverIndexInfo = new ApiConfiguration.ServerIndexInfoBuilder() + .rootServerInfoServerIndex(RootServerInfo.ServerIndex.SERVER_0) + .build(); +List securitySchemes = new ArrayList(); +securitySchemes.add( + new ApiKey("someApiKey"); +); +ApiConfiguration.SecurityIndexInfo securityIndexInfo = new ApiConfiguration.SecurityIndexInfoBuilder() + .petpetidPostSecurityRequirementObject0SecurityIndex(PetpetidPostSecurityRequirementObject0.SecurityIndex.SECURITY_0) + .build(); +Duration timeout = Duration.ofSeconds(1L); +Map> defaultHeaders = Map.of("User-Agent", List.of("OpenAPI-JSON-Schema-Generator/1.0.0/java")); +ApiConfiguration apiConfiguration = new ApiConfiguration( + serverInfo + serverIndexInfo, + securitySchemes, + securityIndexInfo, + timeout, + defaultHeaders +); +SchemaConfiguration schemaConfiguration = new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().build()); +Pet apiClient = new Pet(apiConfiguration, schemaConfiguration); + + +// Map validation +PetpetidPostPathParameters.PathParametersMap pathParameters = + PetpetidPostPathParameters.PetpetidPostPathParameters1.validate( + new PetpetidPostPathParameters.PathParametersMapBuilder() + .petId(1L) + + .build(), + schemaConfiguration +); + +var request = new PetpetidPost.PostRequestBuilder() + .pathParameters(pathParameters) + .build(); + +Nothing? response; +try { + response = apiClient.post(request); +} catch (PetpetidPostCode405Response.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; +} +``` +[[Back to top]](#top) [[Back to README]](../../../README.md) diff --git a/samples/client/petstore/kotlin/docs/apis/tags/Store.md b/samples/client/petstore/kotlin/docs/apis/tags/Store.md new file mode 100644 index 00000000000..525879f8359 --- /dev/null +++ b/samples/client/petstore/kotlin/docs/apis/tags/Store.md @@ -0,0 +1,462 @@ +# Store + +public class Store extends extends ApiClient implements +[StoreinventoryGet.GetInventoryOperation](../../paths/storeinventory/StoreinventoryGet.md#getinventoryoperation), +[StoreorderorderidDelete.DeleteOrderOperation](../../paths/storeorderorderid/StoreorderorderidDelete.md#deleteorderoperation), +[StoreorderorderidGet.GetOrderByIdOperation](../../paths/storeorderorderid/StoreorderorderidGet.md#getorderbyidoperation), +[StoreorderPost.PlaceOrderOperation](../../paths/storeorder/StoreorderPost.md#placeorderoperation) + +an api client class which contains all the routes for tag="store" +Access to Petstore orders + +## Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| [StoreinventoryGetResponses.EndpointResponse](../../paths/storeinventory/get/StoreinventoryGetResponses.md#endpointresponse) | [getInventory](#getinventory)([StoreinventoryGet.GetRequest](../../paths/storeinventory/StoreinventoryGet.md#getrequest) request)
Returns a map of status codes to quantities | +| Nothing? | [deleteOrder](#deleteorder)([StoreorderorderidDelete.DeleteRequest](../../paths/storeorderorderid/StoreorderorderidDelete.md#deleterequest) request)
For valid response try integer IDs with value < 1000. Anything above 1000 or nonintegers will generate API errors | +| [StoreorderorderidGetResponses.EndpointResponse](../../paths/storeorderorderid/get/StoreorderorderidGetResponses.md#endpointresponse) | [getOrderById](#getorderbyid)([StoreorderorderidGet.GetRequest](../../paths/storeorderorderid/StoreorderorderidGet.md#getrequest) request)
For valid response try integer IDs with value <= 5 or > 10. Other values will generated exceptions | +| [StoreorderPostResponses.EndpointResponse](../../paths/storeorder/post/StoreorderPostResponses.md#endpointresponse) | [placeOrder](#placeorder)([StoreorderPost.PostRequest](../../paths/storeorder/StoreorderPost.md#postrequest) request)
| + +## Method Detail + +### getInventory +public [StoreinventoryGetResponses.EndpointResponse](../../paths/storeinventory/get/StoreinventoryGetResponses.md#endpointresponse) getInventory([StoreinventoryGet.GetRequest](../../paths/storeinventory/StoreinventoryGet.md#getrequest) request) + +Returns a map of status codes to quantities + +**Parameters:**
+request - the input request + +**Returns:**
+the deserialized response + +**Throws:**
+IOException, InterruptedException - an exception happened when making the request
+ValidationException - the returned response body or header values do not conform the the schema validation requirements
+NotImplementedException - the request body serialization or deserialization has not yet been implemented
+ or the header content type deserialization has not yet been implemented for this contentType
+ApiException - server returned a response/contentType not defined in the openapi document
+ +#### 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.storeinventory.get.StoreinventoryGetSecurityInfo; +import org.openapijsonschematools.client.servers.RootServer0; +import org.openapijsonschematools.client.servers.RootServer1; +import org.openapijsonschematools.client.servers.RootServer2; +import org.openapijsonschematools.client.securityschemes.SecurityScheme; +import org.openapijsonschematools.client.components.securityschemes.ApiKey; +import org.openapijsonschematools.client.paths.storeinventory.get.responses.StoreinventoryGetCode200Response; +import org.openapijsonschematools.client.components.responses.successinlinecontentandheader.SuccessInlineContentAndHeaderHeadersSchema; +import org.openapijsonschematools.client.servers.RootServerInfo; +import org.openapijsonschematools.client.apis.tags.Store; +import org.openapijsonschematools.client.paths.storeinventory.get.StoreinventoryGetResponses; + +import java.io.IOException; +import java.util.Arrays; +import java.util.List; +import java.util.Map; +import java.util.AbstractMap; + +// if you want to use a server that is not SERVER_0 pass it in here and change the ServerIndex input below +ApiConfiguration.ServerInfo serverInfo = new ApiConfiguration.ServerInfoBuilder() + .rootServerInfo( + new RootServerInfo.RootServerInfoBuilder() + .rootServer0(new RootServer0()) + .build() + ) + .build(); +ApiConfiguration.ServerIndexInfo serverIndexInfo = new ApiConfiguration.ServerIndexInfoBuilder() + .rootServerInfoServerIndex(RootServerInfo.ServerIndex.SERVER_0) + .build(); +List securitySchemes = new ArrayList(); +securitySchemes.add( + new ApiKey("someApiKey"); +); +ApiConfiguration.SecurityIndexInfo securityIndexInfo = new ApiConfiguration.SecurityIndexInfoBuilder() + .storeinventoryGetSecurityRequirementObject0SecurityIndex(StoreinventoryGetSecurityRequirementObject0.SecurityIndex.SECURITY_0) + .build(); +Duration timeout = Duration.ofSeconds(1L); +Map> defaultHeaders = Map.of("User-Agent", List.of("OpenAPI-JSON-Schema-Generator/1.0.0/java")); +ApiConfiguration apiConfiguration = new ApiConfiguration( + serverInfo + serverIndexInfo, + securitySchemes, + securityIndexInfo, + timeout, + defaultHeaders +); +SchemaConfiguration schemaConfiguration = new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().build()); +Store apiClient = new Store(apiConfiguration, schemaConfiguration); + + +var request = new StoreinventoryGet.GetRequestBuilder().build(); + +StoreinventoryGetResponses.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; +} +StoreinventoryGetResponses.EndpointStoreinventoryGetCode200Response castResponse = (StoreinventoryGetResponses.EndpointStoreinventoryGetCode200Response) response; +} +``` +### deleteOrder +public Nothing? deleteOrder([StoreorderorderidDelete.DeleteRequest](../../paths/storeorderorderid/StoreorderorderidDelete.md#deleterequest) request) + +For valid response try integer IDs with value < 1000. Anything above 1000 or nonintegers will generate API errors + +**Parameters:**
+request - the input request + +**Returns:**
+nothing (Nothing?) + +**Throws:**
+IOException, InterruptedException - an exception happened when making the request
+ValidationException - the returned response body or header values do not conform the the schema validation requirements
+NotImplementedException - the request body serialization or deserialization has not yet been implemented
+ or the header content type deserialization has not yet been implemented for this contentType
+ApiException - server returned a response/contentType not defined in the openapi document
+ +#### 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.StoreorderorderidDeletePathParameters; +import org.openapijsonschematools.client.servers.RootServer0; +import org.openapijsonschematools.client.servers.RootServer1; +import org.openapijsonschematools.client.servers.RootServer2; +import org.openapijsonschematools.client.paths.storeorderorderid.delete.responses.StoreorderorderidDeleteCode400Response; +import org.openapijsonschematools.client.paths.storeorderorderid.delete.responses.StoreorderorderidDeleteCode404Response; +import org.openapijsonschematools.client.servers.RootServerInfo; +import org.openapijsonschematools.client.apis.tags.Store; +import org.openapijsonschematools.client.paths.storeorderorderid.delete.StoreorderorderidDeleteResponses; + +import java.io.IOException; +import java.util.Arrays; +import java.util.List; +import java.util.Map; +import java.util.AbstractMap; + +// if you want to use a server that is not SERVER_0 pass it in here and change the ServerIndex input below +ApiConfiguration.ServerInfo serverInfo = new ApiConfiguration.ServerInfoBuilder() + .rootServerInfo( + new RootServerInfo.RootServerInfoBuilder() + .rootServer0(new RootServer0()) + .build() + ) + .build(); +ApiConfiguration.ServerIndexInfo serverIndexInfo = new ApiConfiguration.ServerIndexInfoBuilder() + .rootServerInfoServerIndex(RootServerInfo.ServerIndex.SERVER_0) + .build(); +Duration timeout = Duration.ofSeconds(1L); +Map> defaultHeaders = Map.of("User-Agent", List.of("OpenAPI-JSON-Schema-Generator/1.0.0/java")); +ApiConfiguration apiConfiguration = new ApiConfiguration( + serverInfo + serverIndexInfo, + timeout, + defaultHeaders +); +SchemaConfiguration schemaConfiguration = new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().build()); +Store apiClient = new Store(apiConfiguration, schemaConfiguration); + + +// Map validation +StoreorderorderidDeletePathParameters.PathParametersMap pathParameters = + StoreorderorderidDeletePathParameters.StoreorderorderidDeletePathParameters1.validate( + new StoreorderorderidDeletePathParameters.PathParametersMapBuilder() + .order_id("a") + + .build(), + schemaConfiguration +); + +var request = new StoreorderorderidDelete.DeleteRequestBuilder() + .pathParameters(pathParameters) + .build(); + +Nothing? response; +try { + response = apiClient.delete(request); +} catch (StoreorderorderidDeleteCode400Response.ResponseApiException | StoreorderorderidDeleteCode404Response.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; +} +``` +### getOrderById +public [StoreorderorderidGetResponses.EndpointResponse](../../paths/storeorderorderid/get/StoreorderorderidGetResponses.md#endpointresponse) getOrderById([StoreorderorderidGet.GetRequest](../../paths/storeorderorderid/StoreorderorderidGet.md#getrequest) request) + +For valid response try integer IDs with value <= 5 or > 10. Other values will generated exceptions + +**Parameters:**
+request - the input request + +**Returns:**
+the deserialized response + +**Throws:**
+IOException, InterruptedException - an exception happened when making the request
+ValidationException - the returned response body or header values do not conform the the schema validation requirements
+NotImplementedException - the request body serialization or deserialization has not yet been implemented
+ or the header content type deserialization has not yet been implemented for this contentType
+ApiException - server returned a response/contentType not defined in the openapi document
+ +#### 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.get.StoreorderorderidGetPathParameters; +import org.openapijsonschematools.client.servers.RootServer0; +import org.openapijsonschematools.client.servers.RootServer1; +import org.openapijsonschematools.client.servers.RootServer2; +import org.openapijsonschematools.client.paths.storeorderorderid.get.responses.StoreorderorderidGetCode200Response; +import org.openapijsonschematools.client.paths.storeorderorderid.get.responses.StoreorderorderidGetCode400Response; +import org.openapijsonschematools.client.paths.storeorderorderid.get.responses.StoreorderorderidGetCode404Response; +import org.openapijsonschematools.client.servers.RootServerInfo; +import org.openapijsonschematools.client.apis.tags.Store; +import org.openapijsonschematools.client.paths.storeorderorderid.get.StoreorderorderidGetResponses; + +import java.io.IOException; +import java.util.Arrays; +import java.util.List; +import java.util.Map; +import java.util.AbstractMap; + +// if you want to use a server that is not SERVER_0 pass it in here and change the ServerIndex input below +ApiConfiguration.ServerInfo serverInfo = new ApiConfiguration.ServerInfoBuilder() + .rootServerInfo( + new RootServerInfo.RootServerInfoBuilder() + .rootServer0(new RootServer0()) + .build() + ) + .build(); +ApiConfiguration.ServerIndexInfo serverIndexInfo = new ApiConfiguration.ServerIndexInfoBuilder() + .rootServerInfoServerIndex(RootServerInfo.ServerIndex.SERVER_0) + .build(); +Duration timeout = Duration.ofSeconds(1L); +Map> defaultHeaders = Map.of("User-Agent", List.of("OpenAPI-JSON-Schema-Generator/1.0.0/java")); +ApiConfiguration apiConfiguration = new ApiConfiguration( + serverInfo + serverIndexInfo, + timeout, + defaultHeaders +); +SchemaConfiguration schemaConfiguration = new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().build()); +Store apiClient = new Store(apiConfiguration, schemaConfiguration); + + +// Map validation +StoreorderorderidGetPathParameters.PathParametersMap pathParameters = + StoreorderorderidGetPathParameters.StoreorderorderidGetPathParameters1.validate( + new StoreorderorderidGetPathParameters.PathParametersMapBuilder() + .order_id(1L) + + .build(), + schemaConfiguration +); + +var request = new StoreorderorderidGet.GetRequestBuilder() + .pathParameters(pathParameters) + .build(); + +StoreorderorderidGetResponses.EndpointResponse response; +try { + response = apiClient.get(request); +} catch (StoreorderorderidGetCode400Response.ResponseApiException | StoreorderorderidGetCode404Response.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; +} +StoreorderorderidGetResponses.EndpointStoreorderorderidGetCode200Response castResponse = (StoreorderorderidGetResponses.EndpointStoreorderorderidGetCode200Response) response; +if (castResponse.body instanceof StoreorderorderidGetCode200Response.ApplicationxmlResponseBody deserializedBody) { + // handle deserialized body here +} else { + StoreorderorderidGetCode200Response.ApplicationjsonResponseBody deserializedBody = (StoreorderorderidGetCode200Response.ApplicationjsonResponseBody) castResponse.body; + // handle deserialized body here +} +``` +### placeOrder +public [StoreorderPostResponses.EndpointResponse](../../paths/storeorder/post/StoreorderPostResponses.md#endpointresponse) placeOrder([StoreorderPost.PostRequest](../../paths/storeorder/StoreorderPost.md#postrequest) request) + + + +**Parameters:**
+request - the input request + +**Returns:**
+the deserialized response + +**Throws:**
+IOException, InterruptedException - an exception happened when making the request
+ValidationException - the returned response body or header values do not conform the the schema validation requirements
+NotImplementedException - the request body serialization or deserialization has not yet been implemented
+ or the header content type deserialization has not yet been implemented for this contentType
+ApiException - server returned a response/contentType not defined in the openapi document
+ +#### 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.StoreorderPostRequestBody; +import org.openapijsonschematools.client.components.schemas.Order; +import org.openapijsonschematools.client.servers.RootServer0; +import org.openapijsonschematools.client.servers.RootServer1; +import org.openapijsonschematools.client.servers.RootServer2; +import org.openapijsonschematools.client.paths.storeorder.post.responses.StoreorderPostCode200Response; +import org.openapijsonschematools.client.paths.storeorder.post.responses.StoreorderPostCode400Response; +import org.openapijsonschematools.client.servers.RootServerInfo; +import org.openapijsonschematools.client.apis.tags.Store; +import org.openapijsonschematools.client.paths.storeorder.post.StoreorderPostResponses; + +import java.io.IOException; +import java.util.Arrays; +import java.util.List; +import java.util.Map; +import java.util.AbstractMap; + +// if you want to use a server that is not SERVER_0 pass it in here and change the ServerIndex input below +ApiConfiguration.ServerInfo serverInfo = new ApiConfiguration.ServerInfoBuilder() + .rootServerInfo( + new RootServerInfo.RootServerInfoBuilder() + .rootServer0(new RootServer0()) + .build() + ) + .build(); +ApiConfiguration.ServerIndexInfo serverIndexInfo = new ApiConfiguration.ServerIndexInfoBuilder() + .rootServerInfoServerIndex(RootServerInfo.ServerIndex.SERVER_0) + .build(); +Duration timeout = Duration.ofSeconds(1L); +Map> defaultHeaders = Map.of("User-Agent", List.of("OpenAPI-JSON-Schema-Generator/1.0.0/java")); +ApiConfiguration apiConfiguration = new ApiConfiguration( + serverInfo + serverIndexInfo, + timeout, + defaultHeaders +); +SchemaConfiguration schemaConfiguration = new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().build()); +Store apiClient = new Store(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 +); +StoreorderPost.SealedRequestBody requestBody = new StoreorderPost.ApplicationjsonRequestBody(requestBodyPayload); + +var request = new StoreorderPost.PostRequestBuilder() + .requestBody(requestBody) + .build(); + +StoreorderPostResponses.EndpointResponse response; +try { + response = apiClient.post(request); +} catch (StoreorderPostCode400Response.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; +} +StoreorderPostResponses.EndpointStoreorderPostCode200Response castResponse = (StoreorderPostResponses.EndpointStoreorderPostCode200Response) response; +if (castResponse.body instanceof StoreorderPostCode200Response.ApplicationxmlResponseBody deserializedBody) { + // handle deserialized body here +} else { + StoreorderPostCode200Response.ApplicationjsonResponseBody deserializedBody = (StoreorderPostCode200Response.ApplicationjsonResponseBody) castResponse.body; + // handle deserialized body here +} +``` +[[Back to top]](#top) [[Back to README]](../../../README.md) diff --git a/samples/client/petstore/kotlin/docs/apis/tags/User.md b/samples/client/petstore/kotlin/docs/apis/tags/User.md new file mode 100644 index 00000000000..1d00a835cce --- /dev/null +++ b/samples/client/petstore/kotlin/docs/apis/tags/User.md @@ -0,0 +1,980 @@ +# User + +public class User extends extends ApiClient implements +[UserlogoutGet.LogoutUserOperation](../../paths/userlogout/UserlogoutGet.md#logoutuseroperation), +[UsercreatewitharrayPost.CreateUsersWithArrayInputOperation](../../paths/usercreatewitharray/UsercreatewitharrayPost.md#createuserswitharrayinputoperation), +[UserPost.CreateUserOperation](../../paths/user/UserPost.md#createuseroperation), +[UserloginGet.LoginUserOperation](../../paths/userlogin/UserloginGet.md#loginuseroperation), +[UserusernameDelete.DeleteUserOperation](../../paths/userusername/UserusernameDelete.md#deleteuseroperation), +[UserusernameGet.GetUserByNameOperation](../../paths/userusername/UserusernameGet.md#getuserbynameoperation), +[UserusernamePut.UpdateUserOperation](../../paths/userusername/UserusernamePut.md#updateuseroperation), +[UsercreatewithlistPost.CreateUsersWithListInputOperation](../../paths/usercreatewithlist/UsercreatewithlistPost.md#createuserswithlistinputoperation) + +an api client class which contains all the routes for tag="user" +Operations about user + +## Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| [UserlogoutGetResponses.EndpointResponse](../../paths/userlogout/get/UserlogoutGetResponses.md#endpointresponse) | [logoutUser](#logoutuser)([UserlogoutGet.GetRequest](../../paths/userlogout/UserlogoutGet.md#getrequest) request)
| +| [UsercreatewitharrayPostResponses.EndpointResponse](../../paths/usercreatewitharray/post/UsercreatewitharrayPostResponses.md#endpointresponse) | [createUsersWithArrayInput](#createuserswitharrayinput)([UsercreatewitharrayPost.PostRequest](../../paths/usercreatewitharray/UsercreatewitharrayPost.md#postrequest) request)
| +| [UserPostResponses.EndpointResponse](../../paths/user/post/UserPostResponses.md#endpointresponse) | [createUser](#createuser)([UserPost.PostRequest](../../paths/user/UserPost.md#postrequest) request)
This can only be done by the logged in user. | +| [UserloginGetResponses.EndpointResponse](../../paths/userlogin/get/UserloginGetResponses.md#endpointresponse) | [loginUser](#loginuser)([UserloginGet.GetRequest](../../paths/userlogin/UserloginGet.md#getrequest) request)
| +| [UserusernameDeleteResponses.EndpointResponse](../../paths/userusername/delete/UserusernameDeleteResponses.md#endpointresponse) | [deleteUser](#deleteuser)([UserusernameDelete.DeleteRequest](../../paths/userusername/UserusernameDelete.md#deleterequest) request)
This can only be done by the logged in user. | +| [UserusernameGetResponses.EndpointResponse](../../paths/userusername/get/UserusernameGetResponses.md#endpointresponse) | [getUserByName](#getuserbyname)([UserusernameGet.GetRequest](../../paths/userusername/UserusernameGet.md#getrequest) request)
| +| Nothing? | [updateUser](#updateuser)([UserusernamePut.PutRequest](../../paths/userusername/UserusernamePut.md#putrequest) request)
This can only be done by the logged in user. | +| [UsercreatewithlistPostResponses.EndpointResponse](../../paths/usercreatewithlist/post/UsercreatewithlistPostResponses.md#endpointresponse) | [createUsersWithListInput](#createuserswithlistinput)([UsercreatewithlistPost.PostRequest](../../paths/usercreatewithlist/UsercreatewithlistPost.md#postrequest) request)
| + +## Method Detail + +### logoutUser +public [UserlogoutGetResponses.EndpointResponse](../../paths/userlogout/get/UserlogoutGetResponses.md#endpointresponse) logoutUser([UserlogoutGet.GetRequest](../../paths/userlogout/UserlogoutGet.md#getrequest) request) + + + +**Parameters:**
+request - the input request + +**Returns:**
+the deserialized response + +**Throws:**
+IOException, InterruptedException - an exception happened when making the request
+ValidationException - the returned response body or header values do not conform the the schema validation requirements
+NotImplementedException - the request body serialization or deserialization has not yet been implemented
+ or the header content type deserialization has not yet been implemented for this contentType
+ApiException - server returned a response/contentType not defined in the openapi document
+ +#### 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.servers.RootServer0; +import org.openapijsonschematools.client.servers.RootServer1; +import org.openapijsonschematools.client.servers.RootServer2; +import org.openapijsonschematools.client.paths.userlogout.get.responses.UserlogoutGetCodedefaultResponse; +import org.openapijsonschematools.client.servers.RootServerInfo; +import org.openapijsonschematools.client.apis.tags.User; +import org.openapijsonschematools.client.paths.userlogout.get.UserlogoutGetResponses; + +import java.io.IOException; +import java.util.Arrays; +import java.util.List; +import java.util.Map; +import java.util.AbstractMap; + +// if you want to use a server that is not SERVER_0 pass it in here and change the ServerIndex input below +ApiConfiguration.ServerInfo serverInfo = new ApiConfiguration.ServerInfoBuilder() + .rootServerInfo( + new RootServerInfo.RootServerInfoBuilder() + .rootServer0(new RootServer0()) + .build() + ) + .build(); +ApiConfiguration.ServerIndexInfo serverIndexInfo = new ApiConfiguration.ServerIndexInfoBuilder() + .rootServerInfoServerIndex(RootServerInfo.ServerIndex.SERVER_0) + .build(); +Duration timeout = Duration.ofSeconds(1L); +Map> defaultHeaders = Map.of("User-Agent", List.of("OpenAPI-JSON-Schema-Generator/1.0.0/java")); +ApiConfiguration apiConfiguration = new ApiConfiguration( + serverInfo + serverIndexInfo, + timeout, + defaultHeaders +); +SchemaConfiguration schemaConfiguration = new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().build()); +User apiClient = new User(apiConfiguration, schemaConfiguration); + + +var request = new UserlogoutGet.GetRequestBuilder().build(); + +UserlogoutGetResponses.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; +} +UserlogoutGetResponses.EndpointUserlogoutGetCodedefaultResponse castResponse = (UserlogoutGetResponses.EndpointUserlogoutGetCodedefaultResponse) response; +``` +### createUsersWithArrayInput +public [UsercreatewitharrayPostResponses.EndpointResponse](../../paths/usercreatewitharray/post/UsercreatewitharrayPostResponses.md#endpointresponse) createUsersWithArrayInput([UsercreatewitharrayPost.PostRequest](../../paths/usercreatewitharray/UsercreatewitharrayPost.md#postrequest) request) + + + +**Parameters:**
+request - the input request + +**Returns:**
+the deserialized response + +**Throws:**
+IOException, InterruptedException - an exception happened when making the request
+ValidationException - the returned response body or header values do not conform the the schema validation requirements
+NotImplementedException - the request body serialization or deserialization has not yet been implemented
+ or the header content type deserialization has not yet been implemented for this contentType
+ApiException - server returned a response/contentType not defined in the openapi document
+ +#### 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.UsercreatewitharrayPostRequestBody; +import org.openapijsonschematools.client.components.requestbodies.userarray.content.applicationjson.ApplicationjsonSchema; +import org.openapijsonschematools.client.servers.RootServer0; +import org.openapijsonschematools.client.servers.RootServer1; +import org.openapijsonschematools.client.servers.RootServer2; +import org.openapijsonschematools.client.paths.usercreatewitharray.post.responses.UsercreatewitharrayPostCodedefaultResponse; +import org.openapijsonschematools.client.servers.RootServerInfo; +import org.openapijsonschematools.client.apis.tags.User; +import org.openapijsonschematools.client.paths.usercreatewitharray.post.UsercreatewitharrayPostResponses; + +import java.io.IOException; +import java.util.Arrays; +import java.util.List; +import java.util.Map; +import java.util.AbstractMap; + +// if you want to use a server that is not SERVER_0 pass it in here and change the ServerIndex input below +ApiConfiguration.ServerInfo serverInfo = new ApiConfiguration.ServerInfoBuilder() + .rootServerInfo( + new RootServerInfo.RootServerInfoBuilder() + .rootServer0(new RootServer0()) + .build() + ) + .build(); +ApiConfiguration.ServerIndexInfo serverIndexInfo = new ApiConfiguration.ServerIndexInfoBuilder() + .rootServerInfoServerIndex(RootServerInfo.ServerIndex.SERVER_0) + .build(); +Duration timeout = Duration.ofSeconds(1L); +Map> defaultHeaders = Map.of("User-Agent", List.of("OpenAPI-JSON-Schema-Generator/1.0.0/java")); +ApiConfiguration apiConfiguration = new ApiConfiguration( + serverInfo + serverIndexInfo, + timeout, + defaultHeaders +); +SchemaConfiguration schemaConfiguration = new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().build()); +User apiClient = new User(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 +); +UsercreatewitharrayPostRequestBody.SealedRequestBody requestBody = new UsercreatewitharrayPostRequestBody.ApplicationjsonRequestBody(requestBodyPayload); + +var request = new UsercreatewitharrayPost.PostRequestBuilder() + .requestBody(requestBody) + .build(); + +UsercreatewitharrayPostResponses.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; +} +UsercreatewitharrayPostResponses.EndpointUsercreatewitharrayPostCodedefaultResponse castResponse = (UsercreatewitharrayPostResponses.EndpointUsercreatewitharrayPostCodedefaultResponse) response; +``` +### createUser +public [UserPostResponses.EndpointResponse](../../paths/user/post/UserPostResponses.md#endpointresponse) createUser([UserPost.PostRequest](../../paths/user/UserPost.md#postrequest) request) + +This can only be done by the logged in user. + +**Parameters:**
+request - the input request + +**Returns:**
+the deserialized response + +**Throws:**
+IOException, InterruptedException - an exception happened when making the request
+ValidationException - the returned response body or header values do not conform the the schema validation requirements
+NotImplementedException - the request body serialization or deserialization has not yet been implemented
+ or the header content type deserialization has not yet been implemented for this contentType
+ApiException - server returned a response/contentType not defined in the openapi document
+ +#### 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.user.post.UserPostRequestBody; +import org.openapijsonschematools.client.components.schemas.User; +import org.openapijsonschematools.client.servers.RootServer0; +import org.openapijsonschematools.client.servers.RootServer1; +import org.openapijsonschematools.client.servers.RootServer2; +import org.openapijsonschematools.client.paths.user.post.responses.UserPostCodedefaultResponse; +import org.openapijsonschematools.client.servers.RootServerInfo; +import org.openapijsonschematools.client.apis.tags.User; +import org.openapijsonschematools.client.paths.user.post.UserPostResponses; + +import java.io.IOException; +import java.util.Arrays; +import java.util.List; +import java.util.Map; +import java.util.AbstractMap; + +// if you want to use a server that is not SERVER_0 pass it in here and change the ServerIndex input below +ApiConfiguration.ServerInfo serverInfo = new ApiConfiguration.ServerInfoBuilder() + .rootServerInfo( + new RootServerInfo.RootServerInfoBuilder() + .rootServer0(new RootServer0()) + .build() + ) + .build(); +ApiConfiguration.ServerIndexInfo serverIndexInfo = new ApiConfiguration.ServerIndexInfoBuilder() + .rootServerInfoServerIndex(RootServerInfo.ServerIndex.SERVER_0) + .build(); +Duration timeout = Duration.ofSeconds(1L); +Map> defaultHeaders = Map.of("User-Agent", List.of("OpenAPI-JSON-Schema-Generator/1.0.0/java")); +ApiConfiguration apiConfiguration = new ApiConfiguration( + serverInfo + serverIndexInfo, + timeout, + defaultHeaders +); +SchemaConfiguration schemaConfiguration = new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().build()); +User apiClient = new User(apiConfiguration, schemaConfiguration); + + +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 +); +UserPost.SealedRequestBody requestBody = new UserPost.ApplicationjsonRequestBody(requestBodyPayload); + +var request = new UserPost.PostRequestBuilder() + .requestBody(requestBody) + .build(); + +UserPostResponses.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; +} +UserPostResponses.EndpointUserPostCodedefaultResponse castResponse = (UserPostResponses.EndpointUserPostCodedefaultResponse) response; +``` +### loginUser +public [UserloginGetResponses.EndpointResponse](../../paths/userlogin/get/UserloginGetResponses.md#endpointresponse) loginUser([UserloginGet.GetRequest](../../paths/userlogin/UserloginGet.md#getrequest) request) + + + +**Parameters:**
+request - the input request + +**Returns:**
+the deserialized response + +**Throws:**
+IOException, InterruptedException - an exception happened when making the request
+ValidationException - the returned response body or header values do not conform the the schema validation requirements
+NotImplementedException - the request body serialization or deserialization has not yet been implemented
+ or the header content type deserialization has not yet been implemented for this contentType
+ApiException - server returned a response/contentType not defined in the openapi document
+ +#### 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.userlogin.get.UserloginGetQueryParameters; +import org.openapijsonschematools.client.servers.RootServer0; +import org.openapijsonschematools.client.servers.RootServer1; +import org.openapijsonschematools.client.servers.RootServer2; +import org.openapijsonschematools.client.paths.userlogin.get.responses.UserloginGetCode200Response; +import org.openapijsonschematools.client.paths.userlogin.get.responses.code200response.UserloginGetCode200ResponseHeadersSchema; +import org.openapijsonschematools.client.paths.userlogin.get.responses.UserloginGetCode400Response; +import org.openapijsonschematools.client.servers.RootServerInfo; +import org.openapijsonschematools.client.apis.tags.User; +import org.openapijsonschematools.client.paths.userlogin.get.UserloginGetResponses; + +import java.io.IOException; +import java.util.Arrays; +import java.util.List; +import java.util.Map; +import java.util.AbstractMap; + +// if you want to use a server that is not SERVER_0 pass it in here and change the ServerIndex input below +ApiConfiguration.ServerInfo serverInfo = new ApiConfiguration.ServerInfoBuilder() + .rootServerInfo( + new RootServerInfo.RootServerInfoBuilder() + .rootServer0(new RootServer0()) + .build() + ) + .build(); +ApiConfiguration.ServerIndexInfo serverIndexInfo = new ApiConfiguration.ServerIndexInfoBuilder() + .rootServerInfoServerIndex(RootServerInfo.ServerIndex.SERVER_0) + .build(); +Duration timeout = Duration.ofSeconds(1L); +Map> defaultHeaders = Map.of("User-Agent", List.of("OpenAPI-JSON-Schema-Generator/1.0.0/java")); +ApiConfiguration apiConfiguration = new ApiConfiguration( + serverInfo + serverIndexInfo, + timeout, + defaultHeaders +); +SchemaConfiguration schemaConfiguration = new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().build()); +User apiClient = new User(apiConfiguration, schemaConfiguration); + + +// Map validation +UserloginGetQueryParameters.QueryParametersMap queryParameters = + UserloginGetQueryParameters.UserloginGetQueryParameters1.validate( + new UserloginGetQueryParameters.QueryParametersMapBuilder() + .password("a") + + .username("a") + + .build(), + schemaConfiguration +); + +var request = new UserloginGet.GetRequestBuilder() + .queryParameters(queryParameters) + .build(); + +UserloginGetResponses.EndpointResponse response; +try { + response = apiClient.get(request); +} catch (UserloginGetCode400Response.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; +} +UserloginGetResponses.EndpointUserloginGetCode200Response castResponse = (UserloginGetResponses.EndpointUserloginGetCode200Response) response; +if (castResponse.body instanceof UserloginGetCode200Response.ApplicationxmlResponseBody deserializedBody) { + // handle deserialized body here +} else { + UserloginGetCode200Response.ApplicationjsonResponseBody deserializedBody = (UserloginGetCode200Response.ApplicationjsonResponseBody) castResponse.body; + // handle deserialized body here +} +``` +### deleteUser +public [UserusernameDeleteResponses.EndpointResponse](../../paths/userusername/delete/UserusernameDeleteResponses.md#endpointresponse) deleteUser([UserusernameDelete.DeleteRequest](../../paths/userusername/UserusernameDelete.md#deleterequest) request) + +This can only be done by the logged in user. + +**Parameters:**
+request - the input request + +**Returns:**
+the deserialized response + +**Throws:**
+IOException, InterruptedException - an exception happened when making the request
+ValidationException - the returned response body or header values do not conform the the schema validation requirements
+NotImplementedException - the request body serialization or deserialization has not yet been implemented
+ or the header content type deserialization has not yet been implemented for this contentType
+ApiException - server returned a response/contentType not defined in the openapi document
+ +#### 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.userusername.delete.UserusernameDeletePathParameters; +import org.openapijsonschematools.client.servers.RootServer0; +import org.openapijsonschematools.client.servers.RootServer1; +import org.openapijsonschematools.client.servers.RootServer2; +import org.openapijsonschematools.client.paths.userusername.delete.responses.UserusernameDeleteCode200Response; +import org.openapijsonschematools.client.paths.userusername.delete.responses.UserusernameDeleteCode404Response; +import org.openapijsonschematools.client.servers.RootServerInfo; +import org.openapijsonschematools.client.apis.tags.User; +import org.openapijsonschematools.client.paths.userusername.delete.UserusernameDeleteResponses; + +import java.io.IOException; +import java.util.Arrays; +import java.util.List; +import java.util.Map; +import java.util.AbstractMap; + +// if you want to use a server that is not SERVER_0 pass it in here and change the ServerIndex input below +ApiConfiguration.ServerInfo serverInfo = new ApiConfiguration.ServerInfoBuilder() + .rootServerInfo( + new RootServerInfo.RootServerInfoBuilder() + .rootServer0(new RootServer0()) + .build() + ) + .build(); +ApiConfiguration.ServerIndexInfo serverIndexInfo = new ApiConfiguration.ServerIndexInfoBuilder() + .rootServerInfoServerIndex(RootServerInfo.ServerIndex.SERVER_0) + .build(); +Duration timeout = Duration.ofSeconds(1L); +Map> defaultHeaders = Map.of("User-Agent", List.of("OpenAPI-JSON-Schema-Generator/1.0.0/java")); +ApiConfiguration apiConfiguration = new ApiConfiguration( + serverInfo + serverIndexInfo, + timeout, + defaultHeaders +); +SchemaConfiguration schemaConfiguration = new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().build()); +User apiClient = new User(apiConfiguration, schemaConfiguration); + + +// Map validation +UserusernameDeletePathParameters.PathParametersMap pathParameters = + UserusernameDeletePathParameters.UserusernameDeletePathParameters1.validate( + new UserusernameDeletePathParameters.PathParametersMapBuilder() + .username("a") + + .build(), + schemaConfiguration +); + +var request = new UserusernameDelete.DeleteRequestBuilder() + .pathParameters(pathParameters) + .build(); + +UserusernameDeleteResponses.EndpointResponse response; +try { + response = apiClient.delete(request); +} catch (UserusernameDeleteCode404Response.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; +} +UserusernameDeleteResponses.EndpointUserusernameDeleteCode200Response castResponse = (UserusernameDeleteResponses.EndpointUserusernameDeleteCode200Response) response; +``` +### getUserByName +public [UserusernameGetResponses.EndpointResponse](../../paths/userusername/get/UserusernameGetResponses.md#endpointresponse) getUserByName([UserusernameGet.GetRequest](../../paths/userusername/UserusernameGet.md#getrequest) request) + + + +**Parameters:**
+request - the input request + +**Returns:**
+the deserialized response + +**Throws:**
+IOException, InterruptedException - an exception happened when making the request
+ValidationException - the returned response body or header values do not conform the the schema validation requirements
+NotImplementedException - the request body serialization or deserialization has not yet been implemented
+ or the header content type deserialization has not yet been implemented for this contentType
+ApiException - server returned a response/contentType not defined in the openapi document
+ +#### 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.userusername.get.UserusernameGetPathParameters; +import org.openapijsonschematools.client.servers.RootServer0; +import org.openapijsonschematools.client.servers.RootServer1; +import org.openapijsonschematools.client.servers.RootServer2; +import org.openapijsonschematools.client.paths.userusername.get.responses.UserusernameGetCode200Response; +import org.openapijsonschematools.client.paths.userusername.get.responses.UserusernameGetCode400Response; +import org.openapijsonschematools.client.paths.userusername.get.responses.UserusernameGetCode404Response; +import org.openapijsonschematools.client.servers.RootServerInfo; +import org.openapijsonschematools.client.apis.tags.User; +import org.openapijsonschematools.client.paths.userusername.get.UserusernameGetResponses; + +import java.io.IOException; +import java.util.Arrays; +import java.util.List; +import java.util.Map; +import java.util.AbstractMap; + +// if you want to use a server that is not SERVER_0 pass it in here and change the ServerIndex input below +ApiConfiguration.ServerInfo serverInfo = new ApiConfiguration.ServerInfoBuilder() + .rootServerInfo( + new RootServerInfo.RootServerInfoBuilder() + .rootServer0(new RootServer0()) + .build() + ) + .build(); +ApiConfiguration.ServerIndexInfo serverIndexInfo = new ApiConfiguration.ServerIndexInfoBuilder() + .rootServerInfoServerIndex(RootServerInfo.ServerIndex.SERVER_0) + .build(); +Duration timeout = Duration.ofSeconds(1L); +Map> defaultHeaders = Map.of("User-Agent", List.of("OpenAPI-JSON-Schema-Generator/1.0.0/java")); +ApiConfiguration apiConfiguration = new ApiConfiguration( + serverInfo + serverIndexInfo, + timeout, + defaultHeaders +); +SchemaConfiguration schemaConfiguration = new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().build()); +User apiClient = new User(apiConfiguration, schemaConfiguration); + + +// Map validation +UserusernameGetPathParameters.PathParametersMap pathParameters = + UserusernameGetPathParameters.UserusernameGetPathParameters1.validate( + new UserusernameGetPathParameters.PathParametersMapBuilder() + .username("a") + + .build(), + schemaConfiguration +); + +var request = new UserusernameGet.GetRequestBuilder() + .pathParameters(pathParameters) + .build(); + +UserusernameGetResponses.EndpointResponse response; +try { + response = apiClient.get(request); +} catch (UserusernameGetCode400Response.ResponseApiException | UserusernameGetCode404Response.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; +} +UserusernameGetResponses.EndpointUserusernameGetCode200Response castResponse = (UserusernameGetResponses.EndpointUserusernameGetCode200Response) response; +if (castResponse.body instanceof UserusernameGetCode200Response.ApplicationxmlResponseBody deserializedBody) { + // handle deserialized body here +} else { + UserusernameGetCode200Response.ApplicationjsonResponseBody deserializedBody = (UserusernameGetCode200Response.ApplicationjsonResponseBody) castResponse.body; + // handle deserialized body here +} +``` +### updateUser +public Nothing? updateUser([UserusernamePut.PutRequest](../../paths/userusername/UserusernamePut.md#putrequest) request) + +This can only be done by the logged in user. + +**Parameters:**
+request - the input request + +**Returns:**
+nothing (Nothing?) + +**Throws:**
+IOException, InterruptedException - an exception happened when making the request
+ValidationException - the returned response body or header values do not conform the the schema validation requirements
+NotImplementedException - the request body serialization or deserialization has not yet been implemented
+ or the header content type deserialization has not yet been implemented for this contentType
+ApiException - server returned a response/contentType not defined in the openapi document
+ +#### 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.userusername.put.UserusernamePutRequestBody; +import org.openapijsonschematools.client.components.schemas.User; +import org.openapijsonschematools.client.paths.userusername.put.UserusernamePutPathParameters; +import org.openapijsonschematools.client.servers.RootServer0; +import org.openapijsonschematools.client.servers.RootServer1; +import org.openapijsonschematools.client.servers.RootServer2; +import org.openapijsonschematools.client.paths.userusername.put.responses.UserusernamePutCode400Response; +import org.openapijsonschematools.client.paths.userusername.put.responses.UserusernamePutCode404Response; +import org.openapijsonschematools.client.servers.RootServerInfo; +import org.openapijsonschematools.client.apis.tags.User; +import org.openapijsonschematools.client.paths.userusername.put.UserusernamePutResponses; + +import java.io.IOException; +import java.util.Arrays; +import java.util.List; +import java.util.Map; +import java.util.AbstractMap; + +// if you want to use a server that is not SERVER_0 pass it in here and change the ServerIndex input below +ApiConfiguration.ServerInfo serverInfo = new ApiConfiguration.ServerInfoBuilder() + .rootServerInfo( + new RootServerInfo.RootServerInfoBuilder() + .rootServer0(new RootServer0()) + .build() + ) + .build(); +ApiConfiguration.ServerIndexInfo serverIndexInfo = new ApiConfiguration.ServerIndexInfoBuilder() + .rootServerInfoServerIndex(RootServerInfo.ServerIndex.SERVER_0) + .build(); +Duration timeout = Duration.ofSeconds(1L); +Map> defaultHeaders = Map.of("User-Agent", List.of("OpenAPI-JSON-Schema-Generator/1.0.0/java")); +ApiConfiguration apiConfiguration = new ApiConfiguration( + serverInfo + serverIndexInfo, + timeout, + defaultHeaders +); +SchemaConfiguration schemaConfiguration = new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().build()); +User apiClient = new User(apiConfiguration, schemaConfiguration); + + +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 +); +UserusernamePut.SealedRequestBody requestBody = new UserusernamePut.ApplicationjsonRequestBody(requestBodyPayload); + +// Map validation +UserusernamePutPathParameters.PathParametersMap pathParameters = + UserusernamePutPathParameters.UserusernamePutPathParameters1.validate( + new UserusernamePutPathParameters.PathParametersMapBuilder() + .username("a") + + .build(), + schemaConfiguration +); + +var request = new UserusernamePut.PutRequestBuilder() + .requestBody(requestBody) + .pathParameters(pathParameters) + .build(); + +Nothing? response; +try { + response = apiClient.put(request); +} catch (UserusernamePutCode400Response.ResponseApiException | UserusernamePutCode404Response.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; +} +``` +### createUsersWithListInput +public [UsercreatewithlistPostResponses.EndpointResponse](../../paths/usercreatewithlist/post/UsercreatewithlistPostResponses.md#endpointresponse) createUsersWithListInput([UsercreatewithlistPost.PostRequest](../../paths/usercreatewithlist/UsercreatewithlistPost.md#postrequest) request) + + + +**Parameters:**
+request - the input request + +**Returns:**
+the deserialized response + +**Throws:**
+IOException, InterruptedException - an exception happened when making the request
+ValidationException - the returned response body or header values do not conform the the schema validation requirements
+NotImplementedException - the request body serialization or deserialization has not yet been implemented
+ or the header content type deserialization has not yet been implemented for this contentType
+ApiException - server returned a response/contentType not defined in the openapi document
+ +#### 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.UsercreatewithlistPostRequestBody; +import org.openapijsonschematools.client.components.requestbodies.userarray.content.applicationjson.ApplicationjsonSchema; +import org.openapijsonschematools.client.servers.RootServer0; +import org.openapijsonschematools.client.servers.RootServer1; +import org.openapijsonschematools.client.servers.RootServer2; +import org.openapijsonschematools.client.paths.usercreatewithlist.post.responses.UsercreatewithlistPostCodedefaultResponse; +import org.openapijsonschematools.client.servers.RootServerInfo; +import org.openapijsonschematools.client.apis.tags.User; +import org.openapijsonschematools.client.paths.usercreatewithlist.post.UsercreatewithlistPostResponses; + +import java.io.IOException; +import java.util.Arrays; +import java.util.List; +import java.util.Map; +import java.util.AbstractMap; + +// if you want to use a server that is not SERVER_0 pass it in here and change the ServerIndex input below +ApiConfiguration.ServerInfo serverInfo = new ApiConfiguration.ServerInfoBuilder() + .rootServerInfo( + new RootServerInfo.RootServerInfoBuilder() + .rootServer0(new RootServer0()) + .build() + ) + .build(); +ApiConfiguration.ServerIndexInfo serverIndexInfo = new ApiConfiguration.ServerIndexInfoBuilder() + .rootServerInfoServerIndex(RootServerInfo.ServerIndex.SERVER_0) + .build(); +Duration timeout = Duration.ofSeconds(1L); +Map> defaultHeaders = Map.of("User-Agent", List.of("OpenAPI-JSON-Schema-Generator/1.0.0/java")); +ApiConfiguration apiConfiguration = new ApiConfiguration( + serverInfo + serverIndexInfo, + timeout, + defaultHeaders +); +SchemaConfiguration schemaConfiguration = new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().build()); +User apiClient = new User(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 +); +UsercreatewithlistPostRequestBody.SealedRequestBody requestBody = new UsercreatewithlistPostRequestBody.ApplicationjsonRequestBody(requestBodyPayload); + +var request = new UsercreatewithlistPost.PostRequestBuilder() + .requestBody(requestBody) + .build(); + +UsercreatewithlistPostResponses.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; +} +UsercreatewithlistPostResponses.EndpointUsercreatewithlistPostCodedefaultResponse castResponse = (UsercreatewithlistPostResponses.EndpointUsercreatewithlistPostCodedefaultResponse) response; +``` +[[Back to top]](#top) [[Back to README]](../../../README.md) diff --git a/samples/client/petstore/kotlin/docs/components/headers/Int32JsonContentTypeHeader.md b/samples/client/petstore/kotlin/docs/components/headers/Int32JsonContentTypeHeader.md new file mode 100644 index 00000000000..f6c5519399b --- /dev/null +++ b/samples/client/petstore/kotlin/docs/components/headers/Int32JsonContentTypeHeader.md @@ -0,0 +1,59 @@ +# Int32JsonContentTypeHeader +Int32JsonContentTypeHeader.java + +public class Int32JsonContentTypeHeader + +A class that contains necessary nested header classes +- a class that implements MediaType to store content schema info +- a class that extends SchemaHeader/ContentHeader and is used to deserialize the header value + +## Nested Class Summary +| Modifier and Type | Class and Description | +| ----------------- | --------------------- | +| record | [Int32JsonContentTypeHeader.ApplicationjsonMediaType](#applicationjsonmediatype)
record storing schema + encoding for a specific contentType | +| static class | [Int32JsonContentTypeHeader.Int32JsonContentTypeHeader1](#int32jsoncontenttypeheader1)
class that deserializes a header | + + +## ApplicationjsonMediaType +public record ApplicationjsonMediaType
+implements [MediaType<[Int32JsonContentTypeHeaderSchema.Int32JsonContentTypeHeaderSchema1](../../components/headers/int32jsoncontenttypeheader/content/applicationjson/Int32JsonContentTypeHeaderSchema.md#int32jsoncontenttypeheaderschema1), Nothing?> + +class storing schema info for a specific contentType + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| ApplicationjsonMediaType()
Creates an instance | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| [Int32JsonContentTypeHeaderSchema.Int32JsonContentTypeHeaderSchema1](../../components/headers/int32jsoncontenttypeheader/content/applicationjson/Int32JsonContentTypeHeaderSchema.md#int32jsoncontenttypeheaderschema1) | schema()
the schema for this MediaType | +| Nothing? | encoding()
the encoding info | + +## Int32JsonContentTypeHeader1 +public static class Int32JsonContentTypeHeader1 implements Header
+ +a class that deserializes a header value + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| Int32JsonContentTypeHeader1()
Creates an instance | + +### Field Summary +| Modifier and Type | Field and Description | +| ----------------- | --------------------- | +| boolean | required = true
whether the header is required | +| @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 | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| HttpHeaders | serialize(@Nullable Object inData, String name, boolean validate, SchemaConfiguration configuration) | +| @Nullable Object | deserialize(List<String> inData, boolean validate, SchemaConfiguration configuration)
deserializes the header value | + +[[Back to top]](#top) [[Back to Component Headers]](../../../README.md#Component-Headers) [[Back to README]](../../../README.md) diff --git a/samples/client/petstore/kotlin/docs/components/headers/NumberHeader.md b/samples/client/petstore/kotlin/docs/components/headers/NumberHeader.md new file mode 100644 index 00000000000..256af35dc9d --- /dev/null +++ b/samples/client/petstore/kotlin/docs/components/headers/NumberHeader.md @@ -0,0 +1,40 @@ +# NumberHeader +NumberHeader.java + +public class NumberHeader + +A class that contains necessary nested header classes +- a class that extends SchemaHeader/ContentHeader and is used to deserialize the header value + +## Nested Class Summary +| Modifier and Type | Class and Description | +| ----------------- | --------------------- | +| static class | [NumberHeader.NumberHeader1](#numberheader1)
class that deserializes a header | + + +## NumberHeader1 +public static class NumberHeader1 implements Header
+ +a class that deserializes a header value + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| NumberHeader1()
Creates an instance | + +### Field Summary +| Modifier and Type | Field and Description | +| ----------------- | --------------------- | +| boolean | required = false
whether the header is required | +| @Nullable ParameterStyle | ParameterStyle.SIMPLE | +| @Nullable Boolean explode | false | +| @Nullable Boolean allowReserved | null | +| JsonSchema | schema = [NumberHeaderSchema.NumberHeaderSchema1](../../components/headers/numberheader/NumberHeaderSchema.md#numberheaderschema1)().getInstance() + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| HttpHeaders | serialize(@Nullable Object inData, String name, boolean validate, SchemaConfiguration configuration) | +| @Nullable Object | deserialize(List<String> inData, boolean validate, SchemaConfiguration configuration)
deserializes the header value | + +[[Back to top]](#top) [[Back to Component Headers]](../../../README.md#Component-Headers) [[Back to README]](../../../README.md) diff --git a/samples/client/petstore/kotlin/docs/components/headers/RefContentSchemaHeader.md b/samples/client/petstore/kotlin/docs/components/headers/RefContentSchemaHeader.md new file mode 100644 index 00000000000..9ef5b1476f2 --- /dev/null +++ b/samples/client/petstore/kotlin/docs/components/headers/RefContentSchemaHeader.md @@ -0,0 +1,59 @@ +# RefContentSchemaHeader +RefContentSchemaHeader.java + +public class RefContentSchemaHeader + +A class that contains necessary nested header classes +- a class that implements MediaType to store content schema info +- a class that extends SchemaHeader/ContentHeader and is used to deserialize the header value + +## Nested Class Summary +| Modifier and Type | Class and Description | +| ----------------- | --------------------- | +| record | [RefContentSchemaHeader.ApplicationjsonMediaType](#applicationjsonmediatype)
record storing schema + encoding for a specific contentType | +| static class | [RefContentSchemaHeader.RefContentSchemaHeader1](#refcontentschemaheader1)
class that deserializes a header | + + +## ApplicationjsonMediaType +public record ApplicationjsonMediaType
+implements [MediaType<[RefContentSchemaHeaderSchema.RefContentSchemaHeaderSchema1](../../components/headers/refcontentschemaheader/content/applicationjson/RefContentSchemaHeaderSchema.md#refcontentschemaheaderschema1), Nothing?> + +class storing schema info for a specific contentType + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| ApplicationjsonMediaType()
Creates an instance | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| [RefContentSchemaHeaderSchema.RefContentSchemaHeaderSchema1](../../components/headers/refcontentschemaheader/content/applicationjson/RefContentSchemaHeaderSchema.md#refcontentschemaheaderschema1) | schema()
the schema for this MediaType | +| Nothing? | encoding()
the encoding info | + +## RefContentSchemaHeader1 +public static class RefContentSchemaHeader1 implements Header
+ +a class that deserializes a header value + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| RefContentSchemaHeader1()
Creates an instance | + +### Field Summary +| Modifier and Type | Field and Description | +| ----------------- | --------------------- | +| boolean | required = true
whether the header is required | +| @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 | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| HttpHeaders | serialize(@Nullable Object inData, String name, boolean validate, SchemaConfiguration configuration) | +| @Nullable Object | deserialize(List<String> inData, boolean validate, SchemaConfiguration configuration)
deserializes the header value | + +[[Back to top]](#top) [[Back to Component Headers]](../../../README.md#Component-Headers) [[Back to README]](../../../README.md) diff --git a/samples/client/petstore/kotlin/docs/components/headers/RefSchemaHeader.md b/samples/client/petstore/kotlin/docs/components/headers/RefSchemaHeader.md new file mode 100644 index 00000000000..16ce5cb2b72 --- /dev/null +++ b/samples/client/petstore/kotlin/docs/components/headers/RefSchemaHeader.md @@ -0,0 +1,40 @@ +# RefSchemaHeader +RefSchemaHeader.java + +public class RefSchemaHeader + +A class that contains necessary nested header classes +- a class that extends SchemaHeader/ContentHeader and is used to deserialize the header value + +## Nested Class Summary +| Modifier and Type | Class and Description | +| ----------------- | --------------------- | +| static class | [RefSchemaHeader.RefSchemaHeader1](#refschemaheader1)
class that deserializes a header | + + +## RefSchemaHeader1 +public static class RefSchemaHeader1 implements Header
+ +a class that deserializes a header value + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| RefSchemaHeader1()
Creates an instance | + +### Field Summary +| Modifier and Type | Field and Description | +| ----------------- | --------------------- | +| boolean | required = true
whether the header is required | +| @Nullable ParameterStyle | ParameterStyle.SIMPLE | +| @Nullable Boolean explode | false | +| @Nullable Boolean allowReserved | null | +| JsonSchema | schema = [RefSchemaHeaderSchema.RefSchemaHeaderSchema1](../../components/headers/refschemaheader/RefSchemaHeaderSchema.md#refschemaheaderschema1)().getInstance() + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| HttpHeaders | serialize(@Nullable Object inData, String name, boolean validate, SchemaConfiguration configuration) | +| @Nullable Object | deserialize(List<String> inData, boolean validate, SchemaConfiguration configuration)
deserializes the header value | + +[[Back to top]](#top) [[Back to Component Headers]](../../../README.md#Component-Headers) [[Back to README]](../../../README.md) diff --git a/samples/client/petstore/kotlin/docs/components/headers/RefStringHeader.md b/samples/client/petstore/kotlin/docs/components/headers/RefStringHeader.md new file mode 100644 index 00000000000..8944cf49914 --- /dev/null +++ b/samples/client/petstore/kotlin/docs/components/headers/RefStringHeader.md @@ -0,0 +1,20 @@ +# RefStringHeader +RefStringHeader.java + +public class RefStringHeader extends [StringHeader](../../components/headers/StringHeader.md) + +A class (extended from the $ref class) that contains necessary nested header classes +- a class that extends SchemaHeader/ContentHeader and is used to deserialize header content + +## Nested Class Summary +| Modifier and Type | Class and Description | +| ----------------- | --------------------- | +| static class | [RefStringHeader.RefStringHeader1](#refstringheader1)
class that deserializes header value | + +## RefStringHeader1 +public static class RefStringHeader1 extends [StringHeader](../../components/headers/StringHeader.md#stringheader1)
+ +a class that deserializes header, extended from the $ref class + + +[[Back to top]](#top) [[Back to Component Headers]](../../../README.md#Component-Headers) [[Back to README]](../../../README.md) diff --git a/samples/client/petstore/kotlin/docs/components/headers/StringHeader.md b/samples/client/petstore/kotlin/docs/components/headers/StringHeader.md new file mode 100644 index 00000000000..f36d77eb648 --- /dev/null +++ b/samples/client/petstore/kotlin/docs/components/headers/StringHeader.md @@ -0,0 +1,40 @@ +# StringHeader +StringHeader.java + +public class StringHeader + +A class that contains necessary nested header classes +- a class that extends SchemaHeader/ContentHeader and is used to deserialize the header value + +## Nested Class Summary +| Modifier and Type | Class and Description | +| ----------------- | --------------------- | +| static class | [StringHeader.StringHeader1](#stringheader1)
class that deserializes a header | + + +## StringHeader1 +public static class StringHeader1 implements Header
+ +a class that deserializes a header value + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| StringHeader1()
Creates an instance | + +### Field Summary +| Modifier and Type | Field and Description | +| ----------------- | --------------------- | +| boolean | required = true
whether the header is required | +| @Nullable ParameterStyle | ParameterStyle.SIMPLE | +| @Nullable Boolean explode | false | +| @Nullable Boolean allowReserved | null | +| JsonSchema | schema = [StringHeaderSchema.StringHeaderSchema1](../../components/headers/stringheader/StringHeaderSchema.md#stringheaderschema1)().getInstance() + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| HttpHeaders | serialize(@Nullable Object inData, String name, boolean validate, SchemaConfiguration configuration) | +| @Nullable Object | deserialize(List<String> inData, boolean validate, SchemaConfiguration configuration)
deserializes the header value | + +[[Back to top]](#top) [[Back to Component Headers]](../../../README.md#Component-Headers) [[Back to README]](../../../README.md) diff --git a/samples/client/petstore/kotlin/docs/components/headers/int32jsoncontenttypeheader/content/applicationjson/Int32JsonContentTypeHeaderSchema.md b/samples/client/petstore/kotlin/docs/components/headers/int32jsoncontenttypeheader/content/applicationjson/Int32JsonContentTypeHeaderSchema.md new file mode 100644 index 00000000000..de1f0ba7c0b --- /dev/null +++ b/samples/client/petstore/kotlin/docs/components/headers/int32jsoncontenttypeheader/content/applicationjson/Int32JsonContentTypeHeaderSchema.md @@ -0,0 +1,49 @@ +# Int32JsonContentTypeHeaderSchema +public class Int32JsonContentTypeHeaderSchema
+ +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 + +## Nested Class Summary +| Modifier and Type | Class and Description | +| ----------------- | ---------------------- | +| sealed interface | [Int32JsonContentTypeHeaderSchema.Int32JsonContentTypeHeaderSchema1Boxed](#int32jsoncontenttypeheaderschema1boxed)
sealed interface for validated payloads | +| record | [Int32JsonContentTypeHeaderSchema.Int32JsonContentTypeHeaderSchema1BoxedNumber](#int32jsoncontenttypeheaderschema1boxednumber)
boxed class to store validated Number payloads | +| static class | [Int32JsonContentTypeHeaderSchema.Int32JsonContentTypeHeaderSchema1](#int32jsoncontenttypeheaderschema1)
schema class | + +## Int32JsonContentTypeHeaderSchema1Boxed +public sealed interface Int32JsonContentTypeHeaderSchema1Boxed
+permits
+[Int32JsonContentTypeHeaderSchema1BoxedNumber](#int32jsoncontenttypeheaderschema1boxednumber) + +sealed interface that stores validated payloads using boxed classes + +## Int32JsonContentTypeHeaderSchema1BoxedNumber +public record Int32JsonContentTypeHeaderSchema1BoxedNumber
+implements [Int32JsonContentTypeHeaderSchema1Boxed](#int32jsoncontenttypeheaderschema1boxed) + +record that stores validated Number payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| Int32JsonContentTypeHeaderSchema1BoxedNumber(Number data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| Number | data()
validated payload | +| @Nullable Object | getData()
validated payload | + +## Int32JsonContentTypeHeaderSchema1 +public static class Int32JsonContentTypeHeaderSchema1
+extends Int32JsonSchema.Int32JsonSchema1 + +A schema class that validates payloads + +| Methods Inherited from class org.openapijsonschematools.client.schemas.Int32JsonSchema.Int32JsonSchema1 | +| ------------------------------------------------------------------ | +| validate | +| validateAndBox | diff --git a/samples/client/petstore/kotlin/docs/components/headers/numberheader/NumberHeaderSchema.md b/samples/client/petstore/kotlin/docs/components/headers/numberheader/NumberHeaderSchema.md new file mode 100644 index 00000000000..95b3751f87b --- /dev/null +++ b/samples/client/petstore/kotlin/docs/components/headers/numberheader/NumberHeaderSchema.md @@ -0,0 +1,49 @@ +# NumberHeaderSchema +public class NumberHeaderSchema
+ +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 + +## Nested Class Summary +| Modifier and Type | Class and Description | +| ----------------- | ---------------------- | +| sealed interface | [NumberHeaderSchema.NumberHeaderSchema1Boxed](#numberheaderschema1boxed)
sealed interface for validated payloads | +| record | [NumberHeaderSchema.NumberHeaderSchema1BoxedString](#numberheaderschema1boxedstring)
boxed class to store validated String payloads | +| static class | [NumberHeaderSchema.NumberHeaderSchema1](#numberheaderschema1)
schema class | + +## NumberHeaderSchema1Boxed +public sealed interface NumberHeaderSchema1Boxed
+permits
+[NumberHeaderSchema1BoxedString](#numberheaderschema1boxedstring) + +sealed interface that stores validated payloads using boxed classes + +## NumberHeaderSchema1BoxedString +public record NumberHeaderSchema1BoxedString
+implements [NumberHeaderSchema1Boxed](#numberheaderschema1boxed) + +record that stores validated String payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| NumberHeaderSchema1BoxedString(String data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| String | data()
validated payload | +| @Nullable Object | getData()
validated payload | + +## NumberHeaderSchema1 +public static class NumberHeaderSchema1
+extends DecimalJsonSchema.DecimalJsonSchema1 + +A schema class that validates payloads + +| Methods Inherited from class org.openapijsonschematools.client.schemas.DecimalJsonSchema.DecimalJsonSchema1 | +| ------------------------------------------------------------------ | +| validate | +| validateAndBox | diff --git a/samples/client/petstore/kotlin/docs/components/headers/refcontentschemaheader/content/applicationjson/RefContentSchemaHeaderSchema.md b/samples/client/petstore/kotlin/docs/components/headers/refcontentschemaheader/content/applicationjson/RefContentSchemaHeaderSchema.md new file mode 100644 index 00000000000..5453288c047 --- /dev/null +++ b/samples/client/petstore/kotlin/docs/components/headers/refcontentschemaheader/content/applicationjson/RefContentSchemaHeaderSchema.md @@ -0,0 +1,19 @@ +# RefContentSchemaHeaderSchema +public class RefContentSchemaHeaderSchema
+extends [StringWithValidation1](../../../../../components/schemas/StringWithValidation.md#stringwithvalidation) + +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 + +## Nested Class Summary +| Modifier and Type | Class and Description | +| ----------------- | ---------------------- | +| static class | [RefContentSchemaHeaderSchema.RefContentSchemaHeaderSchema1](#refcontentschemaheaderschema1)
schema class | + +## RefContentSchemaHeaderSchema1 +public static class RefContentSchemaHeaderSchema1
+extends [StringWithValidation.StringWithValidation1](../../../../../components/schemas/StringWithValidation.md#stringwithvalidation1) + +A schema class that validates payloads diff --git a/samples/client/petstore/kotlin/docs/components/headers/refschemaheader/RefSchemaHeaderSchema.md b/samples/client/petstore/kotlin/docs/components/headers/refschemaheader/RefSchemaHeaderSchema.md new file mode 100644 index 00000000000..d73c936d9b6 --- /dev/null +++ b/samples/client/petstore/kotlin/docs/components/headers/refschemaheader/RefSchemaHeaderSchema.md @@ -0,0 +1,19 @@ +# RefSchemaHeaderSchema +public class RefSchemaHeaderSchema
+extends [StringWithValidation1](../../../components/schemas/StringWithValidation.md#stringwithvalidation) + +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 + +## Nested Class Summary +| Modifier and Type | Class and Description | +| ----------------- | ---------------------- | +| static class | [RefSchemaHeaderSchema.RefSchemaHeaderSchema1](#refschemaheaderschema1)
schema class | + +## RefSchemaHeaderSchema1 +public static class RefSchemaHeaderSchema1
+extends [StringWithValidation.StringWithValidation1](../../../components/schemas/StringWithValidation.md#stringwithvalidation1) + +A schema class that validates payloads diff --git a/samples/client/petstore/kotlin/docs/components/headers/stringheader/StringHeaderSchema.md b/samples/client/petstore/kotlin/docs/components/headers/stringheader/StringHeaderSchema.md new file mode 100644 index 00000000000..a62142869f9 --- /dev/null +++ b/samples/client/petstore/kotlin/docs/components/headers/stringheader/StringHeaderSchema.md @@ -0,0 +1,49 @@ +# StringHeaderSchema +public class StringHeaderSchema
+ +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 + +## Nested Class Summary +| Modifier and Type | Class and Description | +| ----------------- | ---------------------- | +| sealed interface | [StringHeaderSchema.StringHeaderSchema1Boxed](#stringheaderschema1boxed)
sealed interface for validated payloads | +| record | [StringHeaderSchema.StringHeaderSchema1BoxedString](#stringheaderschema1boxedstring)
boxed class to store validated String payloads | +| static class | [StringHeaderSchema.StringHeaderSchema1](#stringheaderschema1)
schema class | + +## StringHeaderSchema1Boxed +public sealed interface StringHeaderSchema1Boxed
+permits
+[StringHeaderSchema1BoxedString](#stringheaderschema1boxedstring) + +sealed interface that stores validated payloads using boxed classes + +## StringHeaderSchema1BoxedString +public record StringHeaderSchema1BoxedString
+implements [StringHeaderSchema1Boxed](#stringheaderschema1boxed) + +record that stores validated String payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| StringHeaderSchema1BoxedString(String data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| String | data()
validated payload | +| @Nullable Object | getData()
validated payload | + +## StringHeaderSchema1 +public static class StringHeaderSchema1
+extends StringJsonSchema.StringJsonSchema1 + +A schema class that validates payloads + +| Methods Inherited from class org.openapijsonschematools.client.schemas.StringJsonSchema.StringJsonSchema1 | +| ------------------------------------------------------------------ | +| validate | +| validateAndBox | diff --git a/samples/client/petstore/kotlin/docs/components/parameters/ComponentRefSchemaStringWithValidation.md b/samples/client/petstore/kotlin/docs/components/parameters/ComponentRefSchemaStringWithValidation.md new file mode 100644 index 00000000000..e94368970ec --- /dev/null +++ b/samples/client/petstore/kotlin/docs/components/parameters/ComponentRefSchemaStringWithValidation.md @@ -0,0 +1,60 @@ +# ComponentRefSchemaStringWithValidation +ComponentRefSchemaStringWithValidation.java + +public class ComponentRefSchemaStringWithValidation + +A class that contains necessary nested parameter classes +- a class that implements MediaType to store content schema info +- a class that extends SchemaHeader/ContentHeader and is used to deserialize the parameter value + +## Nested Class Summary +| Modifier and Type | Class and Description | +| ----------------- | --------------------- | +| record | [ComponentRefSchemaStringWithValidation.ApplicationjsonMediaType](#applicationjsonmediatype)
record storing schema + encoding for a specific contentType | +| static class | [ComponentRefSchemaStringWithValidation.ComponentRefSchemaStringWithValidation1](#componentrefschemastringwithvalidation1)
class that deserializes a parameter | + + +## ApplicationjsonMediaType +public record ApplicationjsonMediaType
+implements [MediaType<[ApplicationjsonSchema.ApplicationjsonSchema1](../../components/parameters/componentrefschemastringwithvalidation/content/applicationjson/ApplicationjsonSchema.md#applicationjsonschema1), Nothing?> + +class storing schema info for a specific contentType + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| ApplicationjsonMediaType()
Creates an instance | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| [ApplicationjsonSchema.ApplicationjsonSchema1](../../components/parameters/componentrefschemastringwithvalidation/content/applicationjson/ApplicationjsonSchema.md#applicationjsonschema1) | schema()
the schema for this MediaType | +| Nothing? | encoding()
the encoding info | + +## ComponentRefSchemaStringWithValidation1 +public static class ComponentRefSchemaStringWithValidation1 extends ContentParameter
+ +a class that deserializes a parameter value + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| ComponentRefSchemaStringWithValidation1()
Creates an instance | + +### Field Summary +| Modifier and Type | Field and Description | +| ----------------- | --------------------- | +| String | name = "CRSstringWithValidation"
the parameter name | +| ParameterInType | inType = ParameterInType.PATH
the parameter in value | +| boolean | required = true
whether the parameter is required | +| @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 | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| Map | serialize(@Nullable Object inData, boolean validate, SchemaConfiguration configuration)
deserializes the parameter value | + +[[Back to top]](#top) [[Back to Component Parameters]](../../../README.md#Component-Parameters) [[Back to README]](../../../README.md) diff --git a/samples/client/petstore/kotlin/docs/components/parameters/PathUserName.md b/samples/client/petstore/kotlin/docs/components/parameters/PathUserName.md new file mode 100644 index 00000000000..01289864ea2 --- /dev/null +++ b/samples/client/petstore/kotlin/docs/components/parameters/PathUserName.md @@ -0,0 +1,41 @@ +# PathUserName +PathUserName.java + +public class PathUserName + +A class that contains necessary nested parameter classes +- a class that extends SchemaHeader/ContentHeader and is used to deserialize the parameter value + +## Nested Class Summary +| Modifier and Type | Class and Description | +| ----------------- | --------------------- | +| static class | [PathUserName.PathUserName1](#pathusername1)
class that deserializes a parameter | + + +## PathUserName1 +public static class PathUserName1 extends SchemaParameter
+ +a class that deserializes a parameter value + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| PathUserName1()
Creates an instance | + +### Field Summary +| Modifier and Type | Field and Description | +| ----------------- | --------------------- | +| String | name = "username"
the parameter name | +| ParameterInType | inType = ParameterInType.PATH
the parameter in value | +| boolean | required = true
whether the parameter is required | +| @Nullable Boolean explode | false | +| @Nullable ParameterStyle | ParameterStyle.SIMPLE | +| @Nullable Boolean allowReserved | false | +| JsonSchema | schema = [Schema.Schema1](../../components/parameters/pathusername/Schema.md#schema1)().getInstance() + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| Map | serialize(@Nullable Object inData, boolean validate, SchemaConfiguration configuration)
deserializes the parameter value | + +[[Back to top]](#top) [[Back to Component Parameters]](../../../README.md#Component-Parameters) [[Back to README]](../../../README.md) diff --git a/samples/client/petstore/kotlin/docs/components/parameters/RefPathUserName.md b/samples/client/petstore/kotlin/docs/components/parameters/RefPathUserName.md new file mode 100644 index 00000000000..03c05b8b224 --- /dev/null +++ b/samples/client/petstore/kotlin/docs/components/parameters/RefPathUserName.md @@ -0,0 +1,20 @@ +# RefPathUserName +RefPathUserName.java + +public class RefPathUserName extends [PathUserName](../../components/parameters/PathUserName.md) + +A class (extended from the $ref class) that contains necessary nested parameter classes +- a class that extends SchemaHeader/ContentHeader and is used to deserialize parameter content + +## Nested Class Summary +| Modifier and Type | Class and Description | +| ----------------- | --------------------- | +| static class | [RefPathUserName.RefPathUserName1](#refpathusername1)
class that deserializes parameter value | + +## RefPathUserName1 +public static class RefPathUserName1 extends [PathUserName](../../components/parameters/PathUserName.md#pathusername1)
+ +a class that deserializes parameter, extended from the $ref class + + +[[Back to top]](#top) [[Back to Component Parameters]](../../../README.md#Component-Parameters) [[Back to README]](../../../README.md) diff --git a/samples/client/petstore/kotlin/docs/components/parameters/RefSchemaStringWithValidation.md b/samples/client/petstore/kotlin/docs/components/parameters/RefSchemaStringWithValidation.md new file mode 100644 index 00000000000..bd17acf394a --- /dev/null +++ b/samples/client/petstore/kotlin/docs/components/parameters/RefSchemaStringWithValidation.md @@ -0,0 +1,41 @@ +# RefSchemaStringWithValidation +RefSchemaStringWithValidation.java + +public class RefSchemaStringWithValidation + +A class that contains necessary nested parameter classes +- a class that extends SchemaHeader/ContentHeader and is used to deserialize the parameter value + +## Nested Class Summary +| Modifier and Type | Class and Description | +| ----------------- | --------------------- | +| static class | [RefSchemaStringWithValidation.RefSchemaStringWithValidation1](#refschemastringwithvalidation1)
class that deserializes a parameter | + + +## RefSchemaStringWithValidation1 +public static class RefSchemaStringWithValidation1 extends SchemaParameter
+ +a class that deserializes a parameter value + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| RefSchemaStringWithValidation1()
Creates an instance | + +### Field Summary +| Modifier and Type | Field and Description | +| ----------------- | --------------------- | +| String | name = "RSstringWithValidation"
the parameter name | +| ParameterInType | inType = ParameterInType.PATH
the parameter in value | +| boolean | required = true
whether the parameter is required | +| @Nullable Boolean explode | false | +| @Nullable ParameterStyle | ParameterStyle.SIMPLE | +| @Nullable Boolean allowReserved | false | +| JsonSchema | schema = [Schema.Schema1](../../components/parameters/refschemastringwithvalidation/Schema.md#schema1)().getInstance() + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| Map | serialize(@Nullable Object inData, boolean validate, SchemaConfiguration configuration)
deserializes the parameter value | + +[[Back to top]](#top) [[Back to Component Parameters]](../../../README.md#Component-Parameters) [[Back to README]](../../../README.md) diff --git a/samples/client/petstore/kotlin/docs/components/parameters/componentrefschemastringwithvalidation/content/applicationjson/ApplicationjsonSchema.md b/samples/client/petstore/kotlin/docs/components/parameters/componentrefschemastringwithvalidation/content/applicationjson/ApplicationjsonSchema.md new file mode 100644 index 00000000000..174f9e2adf9 --- /dev/null +++ b/samples/client/petstore/kotlin/docs/components/parameters/componentrefschemastringwithvalidation/content/applicationjson/ApplicationjsonSchema.md @@ -0,0 +1,19 @@ +# ApplicationjsonSchema +public class ApplicationjsonSchema
+extends [StringWithValidation1](../../../../../components/schemas/StringWithValidation.md#stringwithvalidation) + +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 + +## Nested Class Summary +| Modifier and Type | Class and Description | +| ----------------- | ---------------------- | +| static class | [ApplicationjsonSchema.ApplicationjsonSchema1](#applicationjsonschema1)
schema class | + +## ApplicationjsonSchema1 +public static class ApplicationjsonSchema1
+extends [StringWithValidation.StringWithValidation1](../../../../../components/schemas/StringWithValidation.md#stringwithvalidation1) + +A schema class that validates payloads diff --git a/samples/client/petstore/kotlin/docs/components/parameters/pathusername/Schema.md b/samples/client/petstore/kotlin/docs/components/parameters/pathusername/Schema.md new file mode 100644 index 00000000000..07b8e07c3a7 --- /dev/null +++ b/samples/client/petstore/kotlin/docs/components/parameters/pathusername/Schema.md @@ -0,0 +1,49 @@ +# Schema +public class Schema
+ +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 + +## Nested Class Summary +| Modifier and Type | Class and Description | +| ----------------- | ---------------------- | +| sealed interface | [Schema.Schema1Boxed](#schema1boxed)
sealed interface for validated payloads | +| record | [Schema.Schema1BoxedString](#schema1boxedstring)
boxed class to store validated String payloads | +| static class | [Schema.Schema1](#schema1)
schema class | + +## Schema1Boxed +public sealed interface Schema1Boxed
+permits
+[Schema1BoxedString](#schema1boxedstring) + +sealed interface that stores validated payloads using boxed classes + +## Schema1BoxedString +public record Schema1BoxedString
+implements [Schema1Boxed](#schema1boxed) + +record that stores validated String payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| Schema1BoxedString(String data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| String | data()
validated payload | +| @Nullable Object | getData()
validated payload | + +## Schema1 +public static class Schema1
+extends StringJsonSchema.StringJsonSchema1 + +A schema class that validates payloads + +| Methods Inherited from class org.openapijsonschematools.client.schemas.StringJsonSchema.StringJsonSchema1 | +| ------------------------------------------------------------------ | +| validate | +| validateAndBox | diff --git a/samples/client/petstore/kotlin/docs/components/parameters/refschemastringwithvalidation/Schema.md b/samples/client/petstore/kotlin/docs/components/parameters/refschemastringwithvalidation/Schema.md new file mode 100644 index 00000000000..29a01b850e9 --- /dev/null +++ b/samples/client/petstore/kotlin/docs/components/parameters/refschemastringwithvalidation/Schema.md @@ -0,0 +1,19 @@ +# Schema +public class Schema
+extends [StringWithValidation1](../../../components/schemas/StringWithValidation.md#stringwithvalidation) + +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 + +## Nested Class Summary +| Modifier and Type | Class and Description | +| ----------------- | ---------------------- | +| static class | [Schema.Schema1](#schema1)
schema class | + +## Schema1 +public static class Schema1
+extends [StringWithValidation.StringWithValidation1](../../../components/schemas/StringWithValidation.md#stringwithvalidation1) + +A schema class that validates payloads diff --git a/samples/client/petstore/kotlin/docs/components/requestbodies/Client.md b/samples/client/petstore/kotlin/docs/components/requestbodies/Client.md new file mode 100644 index 00000000000..6be7c0fca7a --- /dev/null +++ b/samples/client/petstore/kotlin/docs/components/requestbodies/Client.md @@ -0,0 +1,93 @@ +# Client +Client.java + +public class Client + +A class that contains necessary nested request body classes +- SealedMediaType, a sealed interface which contains all the schema/encoding info for each contentType +- records which implement SealedMediaType, the concrete media types +- a class that extends RequestBodySerializer and is used to serialize input SealedRequestBody instances +- SealedRequestBody, a sealed interface which contains all the contentType/schema input types +- records which implement SealedRequestBody, the concrete request body types + +## Nested Class Summary +| Modifier and Type | Class and Description | +| ----------------- | --------------------- | +| sealed interface | [Client.SealedMediaType](#sealedmediatype)
media type sealed interface | +| record | [Client.ApplicationjsonMediaType](#applicationjsonmediatype)
record storing schema + encoding for a specific contentType | +| static class | [Client.Client1](#client1)
class that serializes request bodies | +| sealed interface | [Client.SealedRequestBody](#sealedrequestbody)
request body sealed interface | +| record | [Client.ApplicationjsonRequestBody](#applicationjsonrequestbody)
implements sealed interface to store request body input | + +## SealedMediaType +public sealed interface SealedMediaType
+permits
+[ApplicationjsonMediaType](#applicationjsonmediatype) + +sealed interface that stores schema and encoding info + + +## ApplicationjsonMediaType +public record ApplicationjsonMediaType
+implements [SealedMediaType](#sealedmediatype), MediaType<[ApplicationjsonSchema.ApplicationjsonSchema1](../../components/requestbodies/client/content/applicationjson/ApplicationjsonSchema.md#applicationjsonschema1), Nothing?> + +class storing schema info for a specific contentType + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| ApplicationjsonMediaType()
Creates an instance | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| [ApplicationjsonSchema.ApplicationjsonSchema1](../../components/requestbodies/client/content/applicationjson/ApplicationjsonSchema.md#applicationjsonschema1) | schema()
the schema for this MediaType | +| Nothing? | encoding()
the encoding info | + +## Client1 +public static class Client1
+ +a class that serializes SealedRequestBody request bodies + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| Client1()
Creates an instance | + +### Field Summary +| Modifier and Type | Field and Description | +| ----------------- | --------------------- | +| boolean | required = true
whether the request body is required | +| 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 | +| ----------------- | ---------------------- | +| SerializedRequestBody | serialize([SealedRequestBody](#sealedrequestbody) requestBody)
called by endpoint when creating request body bytes | + +## SealedRequestBody +public sealed interface SealedRequestBody
+permits
+[ApplicationjsonRequestBody](#applicationjsonrequestbody) + +sealed interface that stores request contentType + validated schema data + +## ApplicationjsonRequestBody +public record ApplicationjsonRequestBody
+implements [SealedRequestBody](#sealedrequestbody),
+GenericRequestBody
+ +A record class to store request body input for contentType="application/json" + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| ApplicationjsonRequestBody(ApplicationjsonSchema.[Client1Boxed](../../components/schemas/Client.md#client1boxed) body)
Creates an instance | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| String | contentType()
always returns "application/json" | +| ApplicationjsonSchema.[Client1Boxed](../../components/schemas/Client.md#client1boxed) | body()
returns the body passed in in the constructor | + +[[Back to top]](#top) [[Back to Component RequestBodies]](../../../README.md#Component-RequestBodies) [[Back to README]](../../../README.md) diff --git a/samples/client/petstore/kotlin/docs/components/requestbodies/Pet.md b/samples/client/petstore/kotlin/docs/components/requestbodies/Pet.md new file mode 100644 index 00000000000..307e3ad1c84 --- /dev/null +++ b/samples/client/petstore/kotlin/docs/components/requestbodies/Pet.md @@ -0,0 +1,131 @@ +# Pet +Pet.java + +public class Pet + +A class that contains necessary nested request body classes +- SealedMediaType, a sealed interface which contains all the schema/encoding info for each contentType +- records which implement SealedMediaType, the concrete media types +- a class that extends RequestBodySerializer and is used to serialize input SealedRequestBody instances +- SealedRequestBody, a sealed interface which contains all the contentType/schema input types +- records which implement SealedRequestBody, the concrete request body types + +## Nested Class Summary +| Modifier and Type | Class and Description | +| ----------------- | --------------------- | +| sealed interface | [Pet.SealedMediaType](#sealedmediatype)
media type sealed interface | +| record | [Pet.ApplicationjsonMediaType](#applicationjsonmediatype)
record storing schema + encoding for a specific contentType | +| record | [Pet.ApplicationxmlMediaType](#applicationxmlmediatype)
record storing schema + encoding for a specific contentType | +| static class | [Pet.Pet1](#pet1)
class that serializes request bodies | +| sealed interface | [Pet.SealedRequestBody](#sealedrequestbody)
request body sealed interface | +| record | [Pet.ApplicationjsonRequestBody](#applicationjsonrequestbody)
implements sealed interface to store request body input | +| record | [Pet.ApplicationxmlRequestBody](#applicationxmlrequestbody)
implements sealed interface to store request body input | + +## SealedMediaType +public sealed interface SealedMediaType
+permits
+[ApplicationjsonMediaType](#applicationjsonmediatype), +[ApplicationxmlMediaType](#applicationxmlmediatype) + +sealed interface that stores schema and encoding info + + +## ApplicationjsonMediaType +public record ApplicationjsonMediaType
+implements [SealedMediaType](#sealedmediatype), MediaType<[ApplicationjsonSchema.ApplicationjsonSchema1](../../components/requestbodies/pet/content/applicationjson/ApplicationjsonSchema.md#applicationjsonschema1), Nothing?> + +class storing schema info for a specific contentType + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| ApplicationjsonMediaType()
Creates an instance | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| [ApplicationjsonSchema.ApplicationjsonSchema1](../../components/requestbodies/pet/content/applicationjson/ApplicationjsonSchema.md#applicationjsonschema1) | schema()
the schema for this MediaType | +| Nothing? | encoding()
the encoding info | + +## ApplicationxmlMediaType +public record ApplicationxmlMediaType
+implements [SealedMediaType](#sealedmediatype), MediaType<[ApplicationxmlSchema.ApplicationxmlSchema1](../../components/requestbodies/pet/content/applicationxml/ApplicationxmlSchema.md#applicationxmlschema1), Nothing?> + +class storing schema info for a specific contentType + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| ApplicationxmlMediaType()
Creates an instance | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| [ApplicationxmlSchema.ApplicationxmlSchema1](../../components/requestbodies/pet/content/applicationxml/ApplicationxmlSchema.md#applicationxmlschema1) | schema()
the schema for this MediaType | +| Nothing? | encoding()
the encoding info | + +## Pet1 +public static class Pet1
+ +a class that serializes SealedRequestBody request bodies + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| Pet1()
Creates an instance | + +### Field Summary +| Modifier and Type | Field and Description | +| ----------------- | --------------------- | +| boolean | required = true
whether the request body is required | +| Map | content = Map.ofEntries(
    new AbstractMap.SimpleEntry<>("application/json", new [ApplicationjsonMediaType](#applicationjsonmediatype)()),
    new AbstractMap.SimpleEntry<>("application/xml", new [ApplicationxmlMediaType](#applicationxmlmediatype)())
)
the contentType to schema info | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| SerializedRequestBody | serialize([SealedRequestBody](#sealedrequestbody) requestBody)
called by endpoint when creating request body bytes | + +## SealedRequestBody +public sealed interface SealedRequestBody
+permits
+[ApplicationjsonRequestBody](#applicationjsonrequestbody), +[ApplicationxmlRequestBody](#applicationxmlrequestbody) + +sealed interface that stores request contentType + validated schema data + +## ApplicationjsonRequestBody +public record ApplicationjsonRequestBody
+implements [SealedRequestBody](#sealedrequestbody),
+GenericRequestBody
+ +A record class to store request body input for contentType="application/json" + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| ApplicationjsonRequestBody(ApplicationjsonSchema.[Pet1Boxed](../../components/schemas/Pet.md#pet1boxed) body)
Creates an instance | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| String | contentType()
always returns "application/json" | +| ApplicationjsonSchema.[Pet1Boxed](../../components/schemas/Pet.md#pet1boxed) | body()
returns the body passed in in the constructor | +## ApplicationxmlRequestBody +public record ApplicationxmlRequestBody
+implements [SealedRequestBody](#sealedrequestbody),
+GenericRequestBody
+ +A record class to store request body input for contentType="application/xml" + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| ApplicationxmlRequestBody(ApplicationxmlSchema.[Pet1Boxed](../../components/schemas/Pet.md#pet1boxed) body)
Creates an instance | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| String | contentType()
always returns "application/xml" | +| ApplicationxmlSchema.[Pet1Boxed](../../components/schemas/Pet.md#pet1boxed) | body()
returns the body passed in in the constructor | + +[[Back to top]](#top) [[Back to Component RequestBodies]](../../../README.md#Component-RequestBodies) [[Back to README]](../../../README.md) diff --git a/samples/client/petstore/kotlin/docs/components/requestbodies/RefUserArray.md b/samples/client/petstore/kotlin/docs/components/requestbodies/RefUserArray.md new file mode 100644 index 00000000000..dbe40f61ba7 --- /dev/null +++ b/samples/client/petstore/kotlin/docs/components/requestbodies/RefUserArray.md @@ -0,0 +1,20 @@ +# RefUserArray +RefUserArray.java + +public class RefUserArray 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 + +## Nested Class Summary +| Modifier and Type | Class and Description | +| ----------------- | --------------------- | +| static class | [RefUserArray.RefUserArray1](#refuserarray1)
class that serializes request bodies | + +## RefUserArray1 +public static class RefUserArray1 extends [UserArray1](../../components/requestbodies/UserArray.md#userarray1)
+ +a class that serializes SealedRequestBody request bodies, extended from the $ref class + + +[[Back to top]](#top) [[Back to Component RequestBodies]](../../../README.md#Component-RequestBodies) [[Back to README]](../../../README.md) diff --git a/samples/client/petstore/kotlin/docs/components/requestbodies/UserArray.md b/samples/client/petstore/kotlin/docs/components/requestbodies/UserArray.md new file mode 100644 index 00000000000..3a401b93f55 --- /dev/null +++ b/samples/client/petstore/kotlin/docs/components/requestbodies/UserArray.md @@ -0,0 +1,93 @@ +# UserArray +UserArray.java + +public class UserArray + +A class that contains necessary nested request body classes +- SealedMediaType, a sealed interface which contains all the schema/encoding info for each contentType +- records which implement SealedMediaType, the concrete media types +- a class that extends RequestBodySerializer and is used to serialize input SealedRequestBody instances +- SealedRequestBody, a sealed interface which contains all the contentType/schema input types +- records which implement SealedRequestBody, the concrete request body types + +## Nested Class Summary +| Modifier and Type | Class and Description | +| ----------------- | --------------------- | +| sealed interface | [UserArray.SealedMediaType](#sealedmediatype)
media type sealed interface | +| record | [UserArray.ApplicationjsonMediaType](#applicationjsonmediatype)
record storing schema + encoding for a specific contentType | +| static class | [UserArray.UserArray1](#userarray1)
class that serializes request bodies | +| sealed interface | [UserArray.SealedRequestBody](#sealedrequestbody)
request body sealed interface | +| record | [UserArray.ApplicationjsonRequestBody](#applicationjsonrequestbody)
implements sealed interface to store request body input | + +## SealedMediaType +public sealed interface SealedMediaType
+permits
+[ApplicationjsonMediaType](#applicationjsonmediatype) + +sealed interface that stores schema and encoding info + + +## ApplicationjsonMediaType +public record ApplicationjsonMediaType
+implements [SealedMediaType](#sealedmediatype), MediaType<[ApplicationjsonSchema.ApplicationjsonSchema1](../../components/requestbodies/userarray/content/applicationjson/ApplicationjsonSchema.md#applicationjsonschema1), Nothing?> + +class storing schema info for a specific contentType + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| ApplicationjsonMediaType()
Creates an instance | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| [ApplicationjsonSchema.ApplicationjsonSchema1](../../components/requestbodies/userarray/content/applicationjson/ApplicationjsonSchema.md#applicationjsonschema1) | schema()
the schema for this MediaType | +| Nothing? | encoding()
the encoding info | + +## UserArray1 +public static class UserArray1
+ +a class that serializes SealedRequestBody request bodies + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| UserArray1()
Creates an instance | + +### Field Summary +| Modifier and Type | Field and Description | +| ----------------- | --------------------- | +| boolean | required = true
whether the request body is required | +| 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 | +| ----------------- | ---------------------- | +| SerializedRequestBody | serialize([SealedRequestBody](#sealedrequestbody) requestBody)
called by endpoint when creating request body bytes | + +## SealedRequestBody +public sealed interface SealedRequestBody
+permits
+[ApplicationjsonRequestBody](#applicationjsonrequestbody) + +sealed interface that stores request contentType + validated schema data + +## ApplicationjsonRequestBody +public record ApplicationjsonRequestBody
+implements [SealedRequestBody](#sealedrequestbody),
+GenericRequestBody
+ +A record class to store request body input for contentType="application/json" + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| ApplicationjsonRequestBody(ApplicationjsonSchema.[ApplicationjsonSchema1Boxed](../../components/requestbodies/userarray/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](../../components/requestbodies/userarray/content/applicationjson/ApplicationjsonSchema.md#applicationjsonschema1boxed) | body()
returns the body passed in in the constructor | + +[[Back to top]](#top) [[Back to Component RequestBodies]](../../../README.md#Component-RequestBodies) [[Back to README]](../../../README.md) diff --git a/samples/client/petstore/kotlin/docs/components/requestbodies/client/content/applicationjson/ApplicationjsonSchema.md b/samples/client/petstore/kotlin/docs/components/requestbodies/client/content/applicationjson/ApplicationjsonSchema.md new file mode 100644 index 00000000000..5a8221e0efb --- /dev/null +++ b/samples/client/petstore/kotlin/docs/components/requestbodies/client/content/applicationjson/ApplicationjsonSchema.md @@ -0,0 +1,19 @@ +# ApplicationjsonSchema +public class ApplicationjsonSchema
+extends [Client1](../../../../../components/schemas/Client.md#client) + +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 + +## Nested Class Summary +| Modifier and Type | Class and Description | +| ----------------- | ---------------------- | +| static class | [ApplicationjsonSchema.ApplicationjsonSchema1](#applicationjsonschema1)
schema class | + +## ApplicationjsonSchema1 +public static class ApplicationjsonSchema1
+extends [Client.Client1](../../../../../components/schemas/Client.md#client1) + +A schema class that validates payloads diff --git a/samples/client/petstore/kotlin/docs/components/requestbodies/pet/content/applicationjson/ApplicationjsonSchema.md b/samples/client/petstore/kotlin/docs/components/requestbodies/pet/content/applicationjson/ApplicationjsonSchema.md new file mode 100644 index 00000000000..33800a35ef7 --- /dev/null +++ b/samples/client/petstore/kotlin/docs/components/requestbodies/pet/content/applicationjson/ApplicationjsonSchema.md @@ -0,0 +1,19 @@ +# ApplicationjsonSchema +public class ApplicationjsonSchema
+extends [Pet1](../../../../../components/schemas/Pet.md#pet) + +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 + +## Nested Class Summary +| Modifier and Type | Class and Description | +| ----------------- | ---------------------- | +| static class | [ApplicationjsonSchema.ApplicationjsonSchema1](#applicationjsonschema1)
schema class | + +## ApplicationjsonSchema1 +public static class ApplicationjsonSchema1
+extends [Pet.Pet1](../../../../../components/schemas/Pet.md#pet1) + +A schema class that validates payloads diff --git a/samples/client/petstore/kotlin/docs/components/requestbodies/pet/content/applicationxml/ApplicationxmlSchema.md b/samples/client/petstore/kotlin/docs/components/requestbodies/pet/content/applicationxml/ApplicationxmlSchema.md new file mode 100644 index 00000000000..87b9e69e465 --- /dev/null +++ b/samples/client/petstore/kotlin/docs/components/requestbodies/pet/content/applicationxml/ApplicationxmlSchema.md @@ -0,0 +1,19 @@ +# ApplicationxmlSchema +public class ApplicationxmlSchema
+extends [RefPet1](../../../../../components/schemas/RefPet.md#refpet) + +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 + +## Nested Class Summary +| Modifier and Type | Class and Description | +| ----------------- | ---------------------- | +| static class | [ApplicationxmlSchema.ApplicationxmlSchema1](#applicationxmlschema1)
schema class | + +## ApplicationxmlSchema1 +public static class ApplicationxmlSchema1
+extends [RefPet.RefPet1](../../../../../components/schemas/RefPet.md#refpet1) + +A schema class that validates payloads diff --git a/samples/client/petstore/kotlin/docs/components/requestbodies/userarray/content/applicationjson/ApplicationjsonSchema.md b/samples/client/petstore/kotlin/docs/components/requestbodies/userarray/content/applicationjson/ApplicationjsonSchema.md new file mode 100644 index 00000000000..920c9d5f853 --- /dev/null +++ b/samples/client/petstore/kotlin/docs/components/requestbodies/userarray/content/applicationjson/ApplicationjsonSchema.md @@ -0,0 +1,156 @@ +# ApplicationjsonSchema +public class ApplicationjsonSchema
+ +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 list payloads, extends FrozenList +- classes to build inputs for list payloads + +## Nested Class Summary +| Modifier and Type | Class and Description | +| ----------------- | ---------------------- | +| sealed interface | [ApplicationjsonSchema.ApplicationjsonSchema1Boxed](#applicationjsonschema1boxed)
sealed interface for validated payloads | +| record | [ApplicationjsonSchema.ApplicationjsonSchema1BoxedList](#applicationjsonschema1boxedlist)
boxed class to store validated List payloads | +| static class | [ApplicationjsonSchema.ApplicationjsonSchema1](#applicationjsonschema1)
schema class | +| static class | [ApplicationjsonSchema.ApplicationjsonSchemaListBuilder](#applicationjsonschemalistbuilder)
builder for List payloads | +| static class | [ApplicationjsonSchema.ApplicationjsonSchemaList](#applicationjsonschemalist)
output class for List payloads | + +## ApplicationjsonSchema1Boxed +public sealed interface ApplicationjsonSchema1Boxed
+permits
+[ApplicationjsonSchema1BoxedList](#applicationjsonschema1boxedlist) + +sealed interface that stores validated payloads using boxed classes + +## ApplicationjsonSchema1BoxedList +public record ApplicationjsonSchema1BoxedList
+implements [ApplicationjsonSchema1Boxed](#applicationjsonschema1boxed) + +record that stores validated List payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| ApplicationjsonSchema1BoxedList([ApplicationjsonSchemaList](#applicationjsonschemalist) data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| [ApplicationjsonSchemaList](#applicationjsonschemalist) | data()
validated payload | +| @Nullable Object | getData()
validated payload | + +## ApplicationjsonSchema1 +public static class ApplicationjsonSchema1
+extends JsonSchema + +A schema class that validates payloads + +### Code Sample +``` +import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags; +import org.openapijsonschematools.client.configurations.SchemaConfiguration; +import org.openapijsonschematools.client.exceptions.ValidationException; +import org.openapijsonschematools.client.schemas.validation.MapUtils; +import org.openapijsonschematools.client.schemas.validation.FrozenList; +import org.openapijsonschematools.client.schemas.validation.FrozenMap; +import org.openapijsonschematools.client.components.requestbodies.userarray.content.applicationjson.ApplicationjsonSchema; + +import java.util.Arrays; +import java.util.List; +import java.util.AbstractMap; + +static final SchemaConfiguration configuration = new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().build()); + +// List validation +ApplicationjsonSchema.ApplicationjsonSchemaList validatedPayload = + ApplicationjsonSchema.ApplicationjsonSchema1.validate( + 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(), + configuration +); +``` + +### Field Summary +| Modifier and Type | Field and Description | +| ----------------- | ---------------------- | +| Set> | type = Set.of(List.class) | +| Class | items = [User.User1.class](../../../../../components/schemas/User.md#user1) | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| [ApplicationjsonSchemaList](#applicationjsonschemalist) | validate([List](#applicationjsonschemalistbuilder) arg, SchemaConfiguration configuration) | +| [ApplicationjsonSchema1BoxedList](#applicationjsonschema1boxedlist) | validateAndBox([List](#applicationjsonschemalistbuilder) arg, SchemaConfiguration configuration) | +| [ApplicationjsonSchema1Boxed](#applicationjsonschema1boxed) | validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) | +| @Nullable Object | validate(@Nullable Object arg, SchemaConfiguration configuration) | + +## ApplicationjsonSchemaListBuilder +public class ApplicationjsonSchemaListBuilder
+builder for `List>` + +A class that builds the List input type + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| ApplicationjsonSchemaListBuilder()
Creates an empty list | +| ApplicationjsonSchemaListBuilder(List> items)
Stores the items in a list | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| ApplicationjsonSchemaListBuilder | add(Map item) | +| List> | build()
Returns list input that should be used with Schema.validate | + +## ApplicationjsonSchemaList +public class ApplicationjsonSchemaList
+extends `FrozenList` + +A class to store validated List payloads + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| static [ApplicationjsonSchemaList](#applicationjsonschemalist) | of([List>](#applicationjsonschemalistbuilder) arg, SchemaConfiguration configuration) | diff --git a/samples/client/petstore/kotlin/docs/components/responses/HeadersWithNoBody.md b/samples/client/petstore/kotlin/docs/components/responses/HeadersWithNoBody.md new file mode 100644 index 00000000000..a23fd1569ad --- /dev/null +++ b/samples/client/petstore/kotlin/docs/components/responses/HeadersWithNoBody.md @@ -0,0 +1,35 @@ +# HeadersWithNoBody +HeadersWithNoBody.java + +public class HeadersWithNoBody + +A class that contains necessary nested response classes +- a class that extends ResponseDeserializer and is used to deserialize responses + +## Nested Class Summary +| Modifier and Type | Class and Description | +| ----------------- | --------------------- | +| static class | [HeadersWithNoBody.HeadersWithNoBody1](#headerswithnobody1)
class that deserializes responses | + +## HeadersWithNoBody1 +public static class HeadersWithNoBody1
+extends ResponseDeserializer + +a class that deserializes responses + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| HeadersWithNoBody1()
Creates an instance | + +### Field Summary +| Modifier and Type | Field and Description | +| ----------------- | --------------------- | +| Map | content = MapUtils.makeMap(
)
the contentType to schema info | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| ApiResponse | deserialize(HttpResponse response, SchemaConfiguration configuration)
called by endpoint when deserialize responses | + +[[Back to top]](#top) [[Back to Component Responses]](../../../README.md#Component-Responses) [[Back to README]](../../../README.md) diff --git a/samples/client/petstore/kotlin/docs/components/responses/RefSuccessDescriptionOnly.md b/samples/client/petstore/kotlin/docs/components/responses/RefSuccessDescriptionOnly.md new file mode 100644 index 00000000000..f3e5b549571 --- /dev/null +++ b/samples/client/petstore/kotlin/docs/components/responses/RefSuccessDescriptionOnly.md @@ -0,0 +1,20 @@ +# RefSuccessDescriptionOnly +RefSuccessDescriptionOnly.java + +public class RefSuccessDescriptionOnly extends [SuccessDescriptionOnly](../../components/responses/SuccessDescriptionOnly.md) + +A class (extended from the $ref class) that contains necessary nested response classes +- a class that extends ResponseDeserializer and is used to deserialize responses + +## Nested Class Summary +| Modifier and Type | Class and Description | +| ----------------- | --------------------- | +| static class | [RefSuccessDescriptionOnly.RefSuccessDescriptionOnly1](#refsuccessdescriptiononly1)
class that deserializes responses | + +## RefSuccessDescriptionOnly1 +public static class RefSuccessDescriptionOnly1 extends [SuccessDescriptionOnly1](../../components/responses/SuccessDescriptionOnly.md#successdescriptiononly1)
+ +a class that deserializes responses, extended from the $ref class + + +[[Back to top]](#top) [[Back to Component Responses]](../../../README.md#Component-Responses) [[Back to README]](../../../README.md) diff --git a/samples/client/petstore/kotlin/docs/components/responses/RefSuccessfulXmlAndJsonArrayOfPet.md b/samples/client/petstore/kotlin/docs/components/responses/RefSuccessfulXmlAndJsonArrayOfPet.md new file mode 100644 index 00000000000..eea32f8e387 --- /dev/null +++ b/samples/client/petstore/kotlin/docs/components/responses/RefSuccessfulXmlAndJsonArrayOfPet.md @@ -0,0 +1,20 @@ +# RefSuccessfulXmlAndJsonArrayOfPet +RefSuccessfulXmlAndJsonArrayOfPet.java + +public class RefSuccessfulXmlAndJsonArrayOfPet extends [SuccessfulXmlAndJsonArrayOfPet](../../components/responses/SuccessfulXmlAndJsonArrayOfPet.md) + +A class (extended from the $ref class) that contains necessary nested response classes +- a class that extends ResponseDeserializer and is used to deserialize responses + +## Nested Class Summary +| Modifier and Type | Class and Description | +| ----------------- | --------------------- | +| static class | [RefSuccessfulXmlAndJsonArrayOfPet.RefSuccessfulXmlAndJsonArrayOfPet1](#refsuccessfulxmlandjsonarrayofpet1)
class that deserializes responses | + +## RefSuccessfulXmlAndJsonArrayOfPet1 +public static class RefSuccessfulXmlAndJsonArrayOfPet1 extends [SuccessfulXmlAndJsonArrayOfPet1](../../components/responses/SuccessfulXmlAndJsonArrayOfPet.md#successfulxmlandjsonarrayofpet1)
+ +a class that deserializes responses, extended from the $ref class + + +[[Back to top]](#top) [[Back to Component Responses]](../../../README.md#Component-Responses) [[Back to README]](../../../README.md) diff --git a/samples/client/petstore/kotlin/docs/components/responses/SuccessDescriptionOnly.md b/samples/client/petstore/kotlin/docs/components/responses/SuccessDescriptionOnly.md new file mode 100644 index 00000000000..d2e4c226466 --- /dev/null +++ b/samples/client/petstore/kotlin/docs/components/responses/SuccessDescriptionOnly.md @@ -0,0 +1,35 @@ +# SuccessDescriptionOnly +SuccessDescriptionOnly.java + +public class SuccessDescriptionOnly + +A class that contains necessary nested response classes +- a class that extends ResponseDeserializer and is used to deserialize responses + +## Nested Class Summary +| Modifier and Type | Class and Description | +| ----------------- | --------------------- | +| static class | [SuccessDescriptionOnly.SuccessDescriptionOnly1](#successdescriptiononly1)
class that deserializes responses | + +## SuccessDescriptionOnly1 +public static class SuccessDescriptionOnly1
+extends ResponseDeserializer + +a class that deserializes responses + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| SuccessDescriptionOnly1()
Creates an instance | + +### Field Summary +| Modifier and Type | Field and Description | +| ----------------- | --------------------- | +| Map | content = MapUtils.makeMap(
)
the contentType to schema info | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| ApiResponse | deserialize(HttpResponse response, SchemaConfiguration configuration)
called by endpoint when deserialize responses | + +[[Back to top]](#top) [[Back to Component Responses]](../../../README.md#Component-Responses) [[Back to README]](../../../README.md) diff --git a/samples/client/petstore/kotlin/docs/components/responses/SuccessInlineContentAndHeader.md b/samples/client/petstore/kotlin/docs/components/responses/SuccessInlineContentAndHeader.md new file mode 100644 index 00000000000..8fc69a2de87 --- /dev/null +++ b/samples/client/petstore/kotlin/docs/components/responses/SuccessInlineContentAndHeader.md @@ -0,0 +1,90 @@ +# SuccessInlineContentAndHeader +SuccessInlineContentAndHeader.java + +public class SuccessInlineContentAndHeader + +A class that contains necessary nested response classes +- SealedMediaType, a sealed interface which contains all the schema/encoding info for each contentType +- records which implement SealedMediaType, the concrete media types +- SealedResponseBody, a sealed interface which contains all the contentType/schema types +- records which implement SealedResponseBody, the concrete response body types +- a class that extends ResponseDeserializer and is used to deserialize responses + +## Nested Class Summary +| Modifier and Type | Class and Description | +| ----------------- | --------------------- | +| sealed interface | [SuccessInlineContentAndHeader.SealedMediaType](#sealedmediatype)
media type sealed interface | +| record | [SuccessInlineContentAndHeader.ApplicationjsonMediaType](#applicationjsonmediatype)
record storing schema + encoding for a specific contentType | +| sealed interface | [SuccessInlineContentAndHeader.SealedResponseBody](#sealedresponsebody)
response body sealed interface | +| record | [SuccessInlineContentAndHeader.ApplicationjsonResponseBody](#applicationjsonresponsebody)
implements sealed interface to store response body | +| static class | [SuccessInlineContentAndHeader.SuccessInlineContentAndHeader1](#successinlinecontentandheader1)
class that deserializes responses | + +## SealedMediaType +public sealed interface SealedMediaType
+permits
+[ApplicationjsonMediaType](#applicationjsonmediatype) + +sealed interface that stores schema and encoding info + +## ApplicationjsonMediaType +public record ApplicationjsonMediaType
+implements [SealedMediaType](#sealedmediatype), MediaType<[ApplicationjsonSchema.ApplicationjsonSchema1](../../components/responses/successinlinecontentandheader/content/applicationjson/ApplicationjsonSchema.md#applicationjsonschema1), Nothing?> + +class storing schema info for a specific contentType + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| ApplicationjsonMediaType()
Creates an instance | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| [ApplicationjsonSchema.ApplicationjsonSchema1](../../components/responses/successinlinecontentandheader/content/applicationjson/ApplicationjsonSchema.md#applicationjsonschema1) | schema()
the schema for this MediaType | +| Nothing? | encoding()
the encoding info | + +## SealedResponseBody +public sealed interface SealedResponseBody
+permits
+[ApplicationjsonResponseBody](#applicationjsonresponsebody) + +sealed interface that stores response body + +## ApplicationjsonResponseBody +public record ApplicationjsonResponseBody
+implements [SealedResponseBody](#sealedresponsebody) + +A record class to store response body for contentType="application/json" + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| ApplicationjsonResponseBody(ApplicationjsonSchema.[ApplicationjsonSchema1Boxed](../../components/responses/successinlinecontentandheader/content/applicationjson/ApplicationjsonSchema.md#applicationjsonschema1boxed) body)
Creates an instance | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| ApplicationjsonSchema.[ApplicationjsonSchema1Boxed](../../components/responses/successinlinecontentandheader/content/applicationjson/ApplicationjsonSchema.md#applicationjsonschema1boxed) | body()
returns the body passed in in the constructor | + +## SuccessInlineContentAndHeader1 +public static class SuccessInlineContentAndHeader1
+extends ResponseDeserializer<[SealedResponseBody](#sealedresponsebody), [SuccessInlineContentAndHeaderHeadersSchema.SuccessInlineContentAndHeaderHeadersSchemaMap](../../components/responses/successinlinecontentandheader/SuccessInlineContentAndHeaderHeadersSchema.md#successinlinecontentandheaderheadersschemamap), [SealedMediaType](#sealedmediatype)> + +a class that deserializes responses + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| SuccessInlineContentAndHeader1()
Creates an instance | + +### Field Summary +| Modifier and Type | Field and Description | +| ----------------- | --------------------- | +| 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 | +| ----------------- | ---------------------- | +| ApiResponse<[SealedResponseBody](#sealedresponsebody), [SuccessInlineContentAndHeaderHeadersSchema.SuccessInlineContentAndHeaderHeadersSchemaMap](../../components/responses/successinlinecontentandheader/SuccessInlineContentAndHeaderHeadersSchema.md#successinlinecontentandheaderheadersschemamap)> | deserialize(HttpResponse response, SchemaConfiguration configuration)
called by endpoint when deserialize responses | + +[[Back to top]](#top) [[Back to Component Responses]](../../../README.md#Component-Responses) [[Back to README]](../../../README.md) diff --git a/samples/client/petstore/kotlin/docs/components/responses/SuccessWithJsonApiResponse.md b/samples/client/petstore/kotlin/docs/components/responses/SuccessWithJsonApiResponse.md new file mode 100644 index 00000000000..70c77499bdc --- /dev/null +++ b/samples/client/petstore/kotlin/docs/components/responses/SuccessWithJsonApiResponse.md @@ -0,0 +1,90 @@ +# SuccessWithJsonApiResponse +SuccessWithJsonApiResponse.java + +public class SuccessWithJsonApiResponse + +A class that contains necessary nested response classes +- SealedMediaType, a sealed interface which contains all the schema/encoding info for each contentType +- records which implement SealedMediaType, the concrete media types +- SealedResponseBody, a sealed interface which contains all the contentType/schema types +- records which implement SealedResponseBody, the concrete response body types +- a class that extends ResponseDeserializer and is used to deserialize responses + +## Nested Class Summary +| Modifier and Type | Class and Description | +| ----------------- | --------------------- | +| sealed interface | [SuccessWithJsonApiResponse.SealedMediaType](#sealedmediatype)
media type sealed interface | +| record | [SuccessWithJsonApiResponse.ApplicationjsonMediaType](#applicationjsonmediatype)
record storing schema + encoding for a specific contentType | +| sealed interface | [SuccessWithJsonApiResponse.SealedResponseBody](#sealedresponsebody)
response body sealed interface | +| record | [SuccessWithJsonApiResponse.ApplicationjsonResponseBody](#applicationjsonresponsebody)
implements sealed interface to store response body | +| static class | [SuccessWithJsonApiResponse.SuccessWithJsonApiResponse1](#successwithjsonapiresponse1)
class that deserializes responses | + +## SealedMediaType +public sealed interface SealedMediaType
+permits
+[ApplicationjsonMediaType](#applicationjsonmediatype) + +sealed interface that stores schema and encoding info + +## ApplicationjsonMediaType +public record ApplicationjsonMediaType
+implements [SealedMediaType](#sealedmediatype), MediaType<[ApplicationjsonSchema.ApplicationjsonSchema1](../../components/responses/successwithjsonapiresponse/content/applicationjson/ApplicationjsonSchema.md#applicationjsonschema1), Nothing?> + +class storing schema info for a specific contentType + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| ApplicationjsonMediaType()
Creates an instance | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| [ApplicationjsonSchema.ApplicationjsonSchema1](../../components/responses/successwithjsonapiresponse/content/applicationjson/ApplicationjsonSchema.md#applicationjsonschema1) | schema()
the schema for this MediaType | +| Nothing? | encoding()
the encoding info | + +## SealedResponseBody +public sealed interface SealedResponseBody
+permits
+[ApplicationjsonResponseBody](#applicationjsonresponsebody) + +sealed interface that stores response body + +## ApplicationjsonResponseBody +public record ApplicationjsonResponseBody
+implements [SealedResponseBody](#sealedresponsebody) + +A record class to store response body for contentType="application/json" + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| ApplicationjsonResponseBody(ApplicationjsonSchema.[ApiResponseSchema1Boxed](../../components/schemas/ApiResponseSchema.md#apiresponseschema1boxed) body)
Creates an instance | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| ApplicationjsonSchema.[ApiResponseSchema1Boxed](../../components/schemas/ApiResponseSchema.md#apiresponseschema1boxed) | body()
returns the body passed in in the constructor | + +## SuccessWithJsonApiResponse1 +public static class SuccessWithJsonApiResponse1
+extends ResponseDeserializer<[SealedResponseBody](#sealedresponsebody), [SuccessWithJsonApiResponseHeadersSchema.SuccessWithJsonApiResponseHeadersSchemaMap](../../components/responses/successwithjsonapiresponse/SuccessWithJsonApiResponseHeadersSchema.md#successwithjsonapiresponseheadersschemamap), [SealedMediaType](#sealedmediatype)> + +a class that deserializes responses + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| SuccessWithJsonApiResponse1()
Creates an instance | + +### Field Summary +| Modifier and Type | Field and Description | +| ----------------- | --------------------- | +| 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 | +| ----------------- | ---------------------- | +| ApiResponse<[SealedResponseBody](#sealedresponsebody), [SuccessWithJsonApiResponseHeadersSchema.SuccessWithJsonApiResponseHeadersSchemaMap](../../components/responses/successwithjsonapiresponse/SuccessWithJsonApiResponseHeadersSchema.md#successwithjsonapiresponseheadersschemamap)> | deserialize(HttpResponse response, SchemaConfiguration configuration)
called by endpoint when deserialize responses | + +[[Back to top]](#top) [[Back to Component Responses]](../../../README.md#Component-Responses) [[Back to README]](../../../README.md) diff --git a/samples/client/petstore/kotlin/docs/components/responses/SuccessfulXmlAndJsonArrayOfPet.md b/samples/client/petstore/kotlin/docs/components/responses/SuccessfulXmlAndJsonArrayOfPet.md new file mode 100644 index 00000000000..b808d0a9960 --- /dev/null +++ b/samples/client/petstore/kotlin/docs/components/responses/SuccessfulXmlAndJsonArrayOfPet.md @@ -0,0 +1,126 @@ +# SuccessfulXmlAndJsonArrayOfPet +SuccessfulXmlAndJsonArrayOfPet.java + +public class SuccessfulXmlAndJsonArrayOfPet + +A class that contains necessary nested response classes +- SealedMediaType, a sealed interface which contains all the schema/encoding info for each contentType +- records which implement SealedMediaType, the concrete media types +- SealedResponseBody, a sealed interface which contains all the contentType/schema types +- records which implement SealedResponseBody, the concrete response body types +- a class that extends ResponseDeserializer and is used to deserialize responses + +## Nested Class Summary +| Modifier and Type | Class and Description | +| ----------------- | --------------------- | +| sealed interface | [SuccessfulXmlAndJsonArrayOfPet.SealedMediaType](#sealedmediatype)
media type sealed interface | +| record | [SuccessfulXmlAndJsonArrayOfPet.ApplicationxmlMediaType](#applicationxmlmediatype)
record storing schema + encoding for a specific contentType | +| record | [SuccessfulXmlAndJsonArrayOfPet.ApplicationjsonMediaType](#applicationjsonmediatype)
record storing schema + encoding for a specific contentType | +| sealed interface | [SuccessfulXmlAndJsonArrayOfPet.SealedResponseBody](#sealedresponsebody)
response body sealed interface | +| record | [SuccessfulXmlAndJsonArrayOfPet.ApplicationxmlResponseBody](#applicationxmlresponsebody)
implements sealed interface to store response body | +| record | [SuccessfulXmlAndJsonArrayOfPet.ApplicationjsonResponseBody](#applicationjsonresponsebody)
implements sealed interface to store response body | +| static class | [SuccessfulXmlAndJsonArrayOfPet.SuccessfulXmlAndJsonArrayOfPet1](#successfulxmlandjsonarrayofpet1)
class that deserializes responses | + +## SealedMediaType +public sealed interface SealedMediaType
+permits
+[ApplicationxmlMediaType](#applicationxmlmediatype), +[ApplicationjsonMediaType](#applicationjsonmediatype) + +sealed interface that stores schema and encoding info + +## ApplicationxmlMediaType +public record ApplicationxmlMediaType
+implements [SealedMediaType](#sealedmediatype), MediaType<[ApplicationxmlSchema.ApplicationxmlSchema1](../../components/responses/successfulxmlandjsonarrayofpet/content/applicationxml/ApplicationxmlSchema.md#applicationxmlschema1), Nothing?> + +class storing schema info for a specific contentType + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| ApplicationxmlMediaType()
Creates an instance | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| [ApplicationxmlSchema.ApplicationxmlSchema1](../../components/responses/successfulxmlandjsonarrayofpet/content/applicationxml/ApplicationxmlSchema.md#applicationxmlschema1) | schema()
the schema for this MediaType | +| Nothing? | encoding()
the encoding info | + +## ApplicationjsonMediaType +public record ApplicationjsonMediaType
+implements [SealedMediaType](#sealedmediatype), MediaType<[ApplicationjsonSchema.ApplicationjsonSchema1](../../components/responses/successfulxmlandjsonarrayofpet/content/applicationjson/ApplicationjsonSchema.md#applicationjsonschema1), Nothing?> + +class storing schema info for a specific contentType + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| ApplicationjsonMediaType()
Creates an instance | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| [ApplicationjsonSchema.ApplicationjsonSchema1](../../components/responses/successfulxmlandjsonarrayofpet/content/applicationjson/ApplicationjsonSchema.md#applicationjsonschema1) | schema()
the schema for this MediaType | +| Nothing? | encoding()
the encoding info | + +## SealedResponseBody +public sealed interface SealedResponseBody
+permits
+[ApplicationxmlResponseBody](#applicationxmlresponsebody), +[ApplicationjsonResponseBody](#applicationjsonresponsebody) + +sealed interface that stores response body + +## ApplicationxmlResponseBody +public record ApplicationxmlResponseBody
+implements [SealedResponseBody](#sealedresponsebody) + +A record class to store response body for contentType="application/xml" + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| ApplicationxmlResponseBody(ApplicationxmlSchema.[ApplicationxmlSchema1Boxed](../../components/responses/successfulxmlandjsonarrayofpet/content/applicationxml/ApplicationxmlSchema.md#applicationxmlschema1boxed) body)
Creates an instance | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| ApplicationxmlSchema.[ApplicationxmlSchema1Boxed](../../components/responses/successfulxmlandjsonarrayofpet/content/applicationxml/ApplicationxmlSchema.md#applicationxmlschema1boxed) | body()
returns the body passed in in the constructor | +## ApplicationjsonResponseBody +public record ApplicationjsonResponseBody
+implements [SealedResponseBody](#sealedresponsebody) + +A record class to store response body for contentType="application/json" + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| ApplicationjsonResponseBody(ApplicationjsonSchema.[ApplicationjsonSchema1Boxed](../../components/responses/successfulxmlandjsonarrayofpet/content/applicationjson/ApplicationjsonSchema.md#applicationjsonschema1boxed) body)
Creates an instance | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| ApplicationjsonSchema.[ApplicationjsonSchema1Boxed](../../components/responses/successfulxmlandjsonarrayofpet/content/applicationjson/ApplicationjsonSchema.md#applicationjsonschema1boxed) | body()
returns the body passed in in the constructor | + +## SuccessfulXmlAndJsonArrayOfPet1 +public static class SuccessfulXmlAndJsonArrayOfPet1
+extends ResponseDeserializer<[SealedResponseBody](#sealedresponsebody), Nothing?, [SealedMediaType](#sealedmediatype)> + +a class that deserializes responses + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| SuccessfulXmlAndJsonArrayOfPet1()
Creates an instance | + +### Field Summary +| Modifier and Type | Field and Description | +| ----------------- | --------------------- | +| Map | content = Map.ofEntries(
    new AbstractMap.SimpleEntry<>("application/xml", new [ApplicationxmlMediaType](#applicationxmlmediatype)()),
    new AbstractMap.SimpleEntry<>("application/json", new [ApplicationjsonMediaType](#applicationjsonmediatype)())
)
the contentType to schema info | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| ApiResponse<[SealedResponseBody](#sealedresponsebody), Nothing?> | deserialize(HttpResponse response, SchemaConfiguration configuration)
called by endpoint when deserialize responses | + +[[Back to top]](#top) [[Back to Component Responses]](../../../README.md#Component-Responses) [[Back to README]](../../../README.md) diff --git a/samples/client/petstore/kotlin/docs/components/responses/headerswithnobody/HeadersWithNoBodyHeadersSchema.md b/samples/client/petstore/kotlin/docs/components/responses/headerswithnobody/HeadersWithNoBodyHeadersSchema.md new file mode 100644 index 00000000000..c4a9e2f60a4 --- /dev/null +++ b/samples/client/petstore/kotlin/docs/components/responses/headerswithnobody/HeadersWithNoBodyHeadersSchema.md @@ -0,0 +1,252 @@ +# HeadersWithNoBodyHeadersSchema +public class HeadersWithNoBodyHeadersSchema
+ +A class that contains necessary nested +- schema classes (which validate payloads), extends JsonSchema +- sealed interfaces which store validated payloads, java version of a sum type +- boxed classes which store validated payloads, sealed permits class implementations +- classes to store validated map payloads, extends FrozenMap +- classes to build inputs for map payloads + +## Nested Class Summary +| Modifier and Type | Class and Description | +| ----------------- | ---------------------- | +| sealed interface | [HeadersWithNoBodyHeadersSchema.HeadersWithNoBodyHeadersSchema1Boxed](#headerswithnobodyheadersschema1boxed)
sealed interface for validated payloads | +| record | [HeadersWithNoBodyHeadersSchema.HeadersWithNoBodyHeadersSchema1BoxedMap](#headerswithnobodyheadersschema1boxedmap)
boxed class to store validated Map payloads | +| static class | [HeadersWithNoBodyHeadersSchema.HeadersWithNoBodyHeadersSchema1](#headerswithnobodyheadersschema1)
schema class | +| static class | [HeadersWithNoBodyHeadersSchema.HeadersWithNoBodyHeadersSchemaMapBuilder](#headerswithnobodyheadersschemamapbuilder)
builder for Map payloads | +| static class | [HeadersWithNoBodyHeadersSchema.HeadersWithNoBodyHeadersSchemaMap](#headerswithnobodyheadersschemamap)
output class for Map payloads | +| sealed interface | [HeadersWithNoBodyHeadersSchema.HeadersWithNoBodyAdditionalPropertiesBoxed](#headerswithnobodyadditionalpropertiesboxed)
sealed interface for validated payloads | +| record | [HeadersWithNoBodyHeadersSchema.HeadersWithNoBodyAdditionalPropertiesBoxedVoid](#headerswithnobodyadditionalpropertiesboxedvoid)
boxed class to store validated null payloads | +| record | [HeadersWithNoBodyHeadersSchema.HeadersWithNoBodyAdditionalPropertiesBoxedBoolean](#headerswithnobodyadditionalpropertiesboxedboolean)
boxed class to store validated boolean payloads | +| record | [HeadersWithNoBodyHeadersSchema.HeadersWithNoBodyAdditionalPropertiesBoxedNumber](#headerswithnobodyadditionalpropertiesboxednumber)
boxed class to store validated Number payloads | +| record | [HeadersWithNoBodyHeadersSchema.HeadersWithNoBodyAdditionalPropertiesBoxedString](#headerswithnobodyadditionalpropertiesboxedstring)
boxed class to store validated String payloads | +| record | [HeadersWithNoBodyHeadersSchema.HeadersWithNoBodyAdditionalPropertiesBoxedList](#headerswithnobodyadditionalpropertiesboxedlist)
boxed class to store validated List payloads | +| record | [HeadersWithNoBodyHeadersSchema.HeadersWithNoBodyAdditionalPropertiesBoxedMap](#headerswithnobodyadditionalpropertiesboxedmap)
boxed class to store validated Map payloads | +| static class | [HeadersWithNoBodyHeadersSchema.HeadersWithNoBodyAdditionalProperties](#headerswithnobodyadditionalproperties)
schema class | + +## HeadersWithNoBodyHeadersSchema1Boxed +public sealed interface HeadersWithNoBodyHeadersSchema1Boxed
+permits
+[HeadersWithNoBodyHeadersSchema1BoxedMap](#headerswithnobodyheadersschema1boxedmap) + +sealed interface that stores validated payloads using boxed classes + +## HeadersWithNoBodyHeadersSchema1BoxedMap +public record HeadersWithNoBodyHeadersSchema1BoxedMap
+implements [HeadersWithNoBodyHeadersSchema1Boxed](#headerswithnobodyheadersschema1boxed) + +record that stores validated Map payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| HeadersWithNoBodyHeadersSchema1BoxedMap([HeadersWithNoBodyHeadersSchemaMap](#headerswithnobodyheadersschemamap) data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| [HeadersWithNoBodyHeadersSchemaMap](#headerswithnobodyheadersschemamap) | data()
validated payload | +| @Nullable Object | getData()
validated payload | + +## HeadersWithNoBodyHeadersSchema1 +public static class HeadersWithNoBodyHeadersSchema1
+extends JsonSchema + +A schema class that validates payloads + +### Code Sample +``` +import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags; +import org.openapijsonschematools.client.configurations.SchemaConfiguration; +import org.openapijsonschematools.client.exceptions.ValidationException; +import org.openapijsonschematools.client.schemas.validation.MapUtils; +import org.openapijsonschematools.client.schemas.validation.FrozenList; +import org.openapijsonschematools.client.schemas.validation.FrozenMap; +import org.openapijsonschematools.client.components.responses.headerswithnobody.HeadersWithNoBodyHeadersSchema; + +import java.util.Arrays; +import java.util.List; +import java.util.AbstractMap; + +static final SchemaConfiguration configuration = new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().build()); + +// Map validation +HeadersWithNoBodyHeadersSchema.HeadersWithNoBodyHeadersSchemaMap validatedPayload = + HeadersWithNoBodyHeadersSchema.HeadersWithNoBodyHeadersSchema1.validate( + new HeadersWithNoBodyHeadersSchema.HeadersWithNoBodyHeadersSchemaMapBuilder() + .location("a") + + .build(), + configuration +); +``` + +### Field Summary +| Modifier and Type | Field and Description | +| ----------------- | ---------------------- | +| Set> | type = Set.of(Map.class) | +| Map> | properties = Map.ofEntries(
    new PropertyEntry("location", [LocationSchema.LocationSchema1.class](../../../components/responses/headerswithnobody/headers/location/LocationSchema.md#locationschema1))
)
| +| Class | additionalProperties = [HeadersWithNoBodyAdditionalProperties.class](#headerswithnobodyadditionalproperties) | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| [HeadersWithNoBodyHeadersSchemaMap](#headerswithnobodyheadersschemamap) | validate([Map<?, ?>](#headerswithnobodyheadersschemamapbuilder) arg, SchemaConfiguration configuration) | +| [HeadersWithNoBodyHeadersSchema1BoxedMap](#headerswithnobodyheadersschema1boxedmap) | validateAndBox([Map<?, ?>](#headerswithnobodyheadersschemamapbuilder) arg, SchemaConfiguration configuration) | +| [HeadersWithNoBodyHeadersSchema1Boxed](#headerswithnobodyheadersschema1boxed) | validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) | +| @Nullable Object | validate(@Nullable Object arg, SchemaConfiguration configuration) | + +## HeadersWithNoBodyHeadersSchemaMapBuilder +public class HeadersWithNoBodyHeadersSchemaMapBuilder
+builder for `Map` + +A class that builds the Map input type + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| HeadersWithNoBodyHeadersSchemaMapBuilder()
Creates a builder that contains an empty map | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| Map | build()
Returns map input that should be used with Schema.validate | +| [HeadersWithNoBodyHeadersSchemaMapBuilder](#headerswithnobodyheadersschemamapbuilder) | location(String value) | + +## HeadersWithNoBodyHeadersSchemaMap +public static class HeadersWithNoBodyHeadersSchemaMap
+extends FrozenMap + +A class to store validated Map payloads + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| static [HeadersWithNoBodyHeadersSchemaMap](#headerswithnobodyheadersschemamap) | of([Map](#headerswithnobodyheadersschemamapbuilder) arg, SchemaConfiguration configuration) | +| String | location()
[optional] | + +## HeadersWithNoBodyAdditionalPropertiesBoxed +public sealed interface HeadersWithNoBodyAdditionalPropertiesBoxed
+permits
+[HeadersWithNoBodyAdditionalPropertiesBoxedVoid](#headerswithnobodyadditionalpropertiesboxedvoid), +[HeadersWithNoBodyAdditionalPropertiesBoxedBoolean](#headerswithnobodyadditionalpropertiesboxedboolean), +[HeadersWithNoBodyAdditionalPropertiesBoxedNumber](#headerswithnobodyadditionalpropertiesboxednumber), +[HeadersWithNoBodyAdditionalPropertiesBoxedString](#headerswithnobodyadditionalpropertiesboxedstring), +[HeadersWithNoBodyAdditionalPropertiesBoxedList](#headerswithnobodyadditionalpropertiesboxedlist), +[HeadersWithNoBodyAdditionalPropertiesBoxedMap](#headerswithnobodyadditionalpropertiesboxedmap) + +sealed interface that stores validated payloads using boxed classes + +## HeadersWithNoBodyAdditionalPropertiesBoxedVoid +public record HeadersWithNoBodyAdditionalPropertiesBoxedVoid
+implements [HeadersWithNoBodyAdditionalPropertiesBoxed](#headerswithnobodyadditionalpropertiesboxed) + +record that stores validated null payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| HeadersWithNoBodyAdditionalPropertiesBoxedVoid(Nothing? data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| Nothing? | data()
validated payload | +| @Nullable Object | getData()
validated payload | + +## HeadersWithNoBodyAdditionalPropertiesBoxedBoolean +public record HeadersWithNoBodyAdditionalPropertiesBoxedBoolean
+implements [HeadersWithNoBodyAdditionalPropertiesBoxed](#headerswithnobodyadditionalpropertiesboxed) + +record that stores validated boolean payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| HeadersWithNoBodyAdditionalPropertiesBoxedBoolean(boolean data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| boolean | data()
validated payload | +| @Nullable Object | getData()
validated payload | + +## HeadersWithNoBodyAdditionalPropertiesBoxedNumber +public record HeadersWithNoBodyAdditionalPropertiesBoxedNumber
+implements [HeadersWithNoBodyAdditionalPropertiesBoxed](#headerswithnobodyadditionalpropertiesboxed) + +record that stores validated Number payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| HeadersWithNoBodyAdditionalPropertiesBoxedNumber(Number data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| Number | data()
validated payload | +| @Nullable Object | getData()
validated payload | + +## HeadersWithNoBodyAdditionalPropertiesBoxedString +public record HeadersWithNoBodyAdditionalPropertiesBoxedString
+implements [HeadersWithNoBodyAdditionalPropertiesBoxed](#headerswithnobodyadditionalpropertiesboxed) + +record that stores validated String payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| HeadersWithNoBodyAdditionalPropertiesBoxedString(String data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| String | data()
validated payload | +| @Nullable Object | getData()
validated payload | + +## HeadersWithNoBodyAdditionalPropertiesBoxedList +public record HeadersWithNoBodyAdditionalPropertiesBoxedList
+implements [HeadersWithNoBodyAdditionalPropertiesBoxed](#headerswithnobodyadditionalpropertiesboxed) + +record that stores validated List payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| HeadersWithNoBodyAdditionalPropertiesBoxedList(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 | + +## HeadersWithNoBodyAdditionalPropertiesBoxedMap +public record HeadersWithNoBodyAdditionalPropertiesBoxedMap
+implements [HeadersWithNoBodyAdditionalPropertiesBoxed](#headerswithnobodyadditionalpropertiesboxed) + +record that stores validated Map payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| HeadersWithNoBodyAdditionalPropertiesBoxedMap(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 | + +## HeadersWithNoBodyAdditionalProperties +public static class HeadersWithNoBodyAdditionalProperties
+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/kotlin/docs/components/responses/headerswithnobody/headers/location/LocationSchema.md b/samples/client/petstore/kotlin/docs/components/responses/headerswithnobody/headers/location/LocationSchema.md new file mode 100644 index 00000000000..82bd0c2a14f --- /dev/null +++ b/samples/client/petstore/kotlin/docs/components/responses/headerswithnobody/headers/location/LocationSchema.md @@ -0,0 +1,49 @@ +# LocationSchema +public class LocationSchema
+ +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 + +## Nested Class Summary +| Modifier and Type | Class and Description | +| ----------------- | ---------------------- | +| sealed interface | [LocationSchema.LocationSchema1Boxed](#locationschema1boxed)
sealed interface for validated payloads | +| record | [LocationSchema.LocationSchema1BoxedString](#locationschema1boxedstring)
boxed class to store validated String payloads | +| static class | [LocationSchema.LocationSchema1](#locationschema1)
schema class | + +## LocationSchema1Boxed +public sealed interface LocationSchema1Boxed
+permits
+[LocationSchema1BoxedString](#locationschema1boxedstring) + +sealed interface that stores validated payloads using boxed classes + +## LocationSchema1BoxedString +public record LocationSchema1BoxedString
+implements [LocationSchema1Boxed](#locationschema1boxed) + +record that stores validated String payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| LocationSchema1BoxedString(String data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| String | data()
validated payload | +| @Nullable Object | getData()
validated payload | + +## LocationSchema1 +public static class LocationSchema1
+extends StringJsonSchema.StringJsonSchema1 + +A schema class that validates payloads + +| Methods Inherited from class org.openapijsonschematools.client.schemas.StringJsonSchema.StringJsonSchema1 | +| ------------------------------------------------------------------ | +| validate | +| validateAndBox | diff --git a/samples/client/petstore/kotlin/docs/components/responses/successfulxmlandjsonarrayofpet/content/applicationjson/ApplicationjsonSchema.md b/samples/client/petstore/kotlin/docs/components/responses/successfulxmlandjsonarrayofpet/content/applicationjson/ApplicationjsonSchema.md new file mode 100644 index 00000000000..511efbc1c6e --- /dev/null +++ b/samples/client/petstore/kotlin/docs/components/responses/successfulxmlandjsonarrayofpet/content/applicationjson/ApplicationjsonSchema.md @@ -0,0 +1,162 @@ +# ApplicationjsonSchema +public class ApplicationjsonSchema
+ +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 list payloads, extends FrozenList +- classes to build inputs for list payloads + +## Nested Class Summary +| Modifier and Type | Class and Description | +| ----------------- | ---------------------- | +| sealed interface | [ApplicationjsonSchema.ApplicationjsonSchema1Boxed](#applicationjsonschema1boxed)
sealed interface for validated payloads | +| record | [ApplicationjsonSchema.ApplicationjsonSchema1BoxedList](#applicationjsonschema1boxedlist)
boxed class to store validated List payloads | +| static class | [ApplicationjsonSchema.ApplicationjsonSchema1](#applicationjsonschema1)
schema class | +| static class | [ApplicationjsonSchema.ApplicationjsonSchemaListBuilder](#applicationjsonschemalistbuilder)
builder for List payloads | +| static class | [ApplicationjsonSchema.ApplicationjsonSchemaList](#applicationjsonschemalist)
output class for List payloads | + +## ApplicationjsonSchema1Boxed +public sealed interface ApplicationjsonSchema1Boxed
+permits
+[ApplicationjsonSchema1BoxedList](#applicationjsonschema1boxedlist) + +sealed interface that stores validated payloads using boxed classes + +## ApplicationjsonSchema1BoxedList +public record ApplicationjsonSchema1BoxedList
+implements [ApplicationjsonSchema1Boxed](#applicationjsonschema1boxed) + +record that stores validated List payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| ApplicationjsonSchema1BoxedList([ApplicationjsonSchemaList](#applicationjsonschemalist) data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| [ApplicationjsonSchemaList](#applicationjsonschemalist) | data()
validated payload | +| @Nullable Object | getData()
validated payload | + +## ApplicationjsonSchema1 +public static class ApplicationjsonSchema1
+extends JsonSchema + +A schema class that validates payloads + +### Code Sample +``` +import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags; +import org.openapijsonschematools.client.configurations.SchemaConfiguration; +import org.openapijsonschematools.client.exceptions.ValidationException; +import org.openapijsonschematools.client.schemas.validation.MapUtils; +import org.openapijsonschematools.client.schemas.validation.FrozenList; +import org.openapijsonschematools.client.schemas.validation.FrozenMap; +import org.openapijsonschematools.client.components.responses.successfulxmlandjsonarrayofpet.content.applicationjson.ApplicationjsonSchema; + +import java.util.Arrays; +import java.util.List; +import java.util.AbstractMap; + +static final SchemaConfiguration configuration = new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().build()); + +// List validation +ApplicationjsonSchema.ApplicationjsonSchemaList validatedPayload = + ApplicationjsonSchema.ApplicationjsonSchema1.validate( + new ApplicationjsonSchema.ApplicationjsonSchemaListBuilder() + .add( + MapUtils.makeMap( + new AbstractMap.SimpleEntry( + "name", + "a" + ), + new AbstractMap.SimpleEntry( + "photoUrls", + Arrays.asList( + "a" + ) + ), + new AbstractMap.SimpleEntry( + "id", + 1L + ), + new AbstractMap.SimpleEntry( + "category", + MapUtils.makeMap( + new AbstractMap.SimpleEntry( + "name", + "a" + ), + new AbstractMap.SimpleEntry( + "id", + 1L + ) + ) + ), + new AbstractMap.SimpleEntry( + "tags", + Arrays.asList( + MapUtils.makeMap( + new AbstractMap.SimpleEntry( + "name", + "a" + ) + ) + ) + ), + new AbstractMap.SimpleEntry( + "status", + "available" + ) + ) + ) + .build(), + configuration +); +``` + +### Field Summary +| Modifier and Type | Field and Description | +| ----------------- | ---------------------- | +| Set> | type = Set.of(List.class) | +| Class | items = [RefPet.RefPet1.class](../../../../../components/schemas/RefPet.md#refpet1) | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| [ApplicationjsonSchemaList](#applicationjsonschemalist) | validate([List](#applicationjsonschemalistbuilder) arg, SchemaConfiguration configuration) | +| [ApplicationjsonSchema1BoxedList](#applicationjsonschema1boxedlist) | validateAndBox([List](#applicationjsonschemalistbuilder) arg, SchemaConfiguration configuration) | +| [ApplicationjsonSchema1Boxed](#applicationjsonschema1boxed) | validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) | +| @Nullable Object | validate(@Nullable Object arg, SchemaConfiguration configuration) | + +## ApplicationjsonSchemaListBuilder +public class ApplicationjsonSchemaListBuilder
+builder for `List>` + +A class that builds the List input type + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| ApplicationjsonSchemaListBuilder()
Creates an empty list | +| ApplicationjsonSchemaListBuilder(List> items)
Stores the items in a list | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| ApplicationjsonSchemaListBuilder | add(Map item) | +| List> | build()
Returns list input that should be used with Schema.validate | + +## ApplicationjsonSchemaList +public class ApplicationjsonSchemaList
+extends `FrozenList` + +A class to store validated List payloads + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| static [ApplicationjsonSchemaList](#applicationjsonschemalist) | of([List>](#applicationjsonschemalistbuilder) arg, SchemaConfiguration configuration) | diff --git a/samples/client/petstore/kotlin/docs/components/responses/successfulxmlandjsonarrayofpet/content/applicationxml/ApplicationxmlSchema.md b/samples/client/petstore/kotlin/docs/components/responses/successfulxmlandjsonarrayofpet/content/applicationxml/ApplicationxmlSchema.md new file mode 100644 index 00000000000..cbdc472e51a --- /dev/null +++ b/samples/client/petstore/kotlin/docs/components/responses/successfulxmlandjsonarrayofpet/content/applicationxml/ApplicationxmlSchema.md @@ -0,0 +1,162 @@ +# ApplicationxmlSchema +public class ApplicationxmlSchema
+ +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 list payloads, extends FrozenList +- classes to build inputs for list payloads + +## Nested Class Summary +| Modifier and Type | Class and Description | +| ----------------- | ---------------------- | +| sealed interface | [ApplicationxmlSchema.ApplicationxmlSchema1Boxed](#applicationxmlschema1boxed)
sealed interface for validated payloads | +| record | [ApplicationxmlSchema.ApplicationxmlSchema1BoxedList](#applicationxmlschema1boxedlist)
boxed class to store validated List payloads | +| static class | [ApplicationxmlSchema.ApplicationxmlSchema1](#applicationxmlschema1)
schema class | +| static class | [ApplicationxmlSchema.ApplicationxmlSchemaListBuilder](#applicationxmlschemalistbuilder)
builder for List payloads | +| static class | [ApplicationxmlSchema.ApplicationxmlSchemaList](#applicationxmlschemalist)
output class for List payloads | + +## ApplicationxmlSchema1Boxed +public sealed interface ApplicationxmlSchema1Boxed
+permits
+[ApplicationxmlSchema1BoxedList](#applicationxmlschema1boxedlist) + +sealed interface that stores validated payloads using boxed classes + +## ApplicationxmlSchema1BoxedList +public record ApplicationxmlSchema1BoxedList
+implements [ApplicationxmlSchema1Boxed](#applicationxmlschema1boxed) + +record that stores validated List payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| ApplicationxmlSchema1BoxedList([ApplicationxmlSchemaList](#applicationxmlschemalist) data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| [ApplicationxmlSchemaList](#applicationxmlschemalist) | data()
validated payload | +| @Nullable Object | getData()
validated payload | + +## ApplicationxmlSchema1 +public static class ApplicationxmlSchema1
+extends JsonSchema + +A schema class that validates payloads + +### Code Sample +``` +import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags; +import org.openapijsonschematools.client.configurations.SchemaConfiguration; +import org.openapijsonschematools.client.exceptions.ValidationException; +import org.openapijsonschematools.client.schemas.validation.MapUtils; +import org.openapijsonschematools.client.schemas.validation.FrozenList; +import org.openapijsonschematools.client.schemas.validation.FrozenMap; +import org.openapijsonschematools.client.components.responses.successfulxmlandjsonarrayofpet.content.applicationxml.ApplicationxmlSchema; + +import java.util.Arrays; +import java.util.List; +import java.util.AbstractMap; + +static final SchemaConfiguration configuration = new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().build()); + +// List validation +ApplicationxmlSchema.ApplicationxmlSchemaList validatedPayload = + ApplicationxmlSchema.ApplicationxmlSchema1.validate( + new ApplicationxmlSchema.ApplicationxmlSchemaListBuilder() + .add( + MapUtils.makeMap( + new AbstractMap.SimpleEntry( + "name", + "a" + ), + new AbstractMap.SimpleEntry( + "photoUrls", + Arrays.asList( + "a" + ) + ), + new AbstractMap.SimpleEntry( + "id", + 1L + ), + new AbstractMap.SimpleEntry( + "category", + MapUtils.makeMap( + new AbstractMap.SimpleEntry( + "name", + "a" + ), + new AbstractMap.SimpleEntry( + "id", + 1L + ) + ) + ), + new AbstractMap.SimpleEntry( + "tags", + Arrays.asList( + MapUtils.makeMap( + new AbstractMap.SimpleEntry( + "name", + "a" + ) + ) + ) + ), + new AbstractMap.SimpleEntry( + "status", + "available" + ) + ) + ) + .build(), + configuration +); +``` + +### Field Summary +| Modifier and Type | Field and Description | +| ----------------- | ---------------------- | +| Set> | type = Set.of(List.class) | +| Class | items = [Pet.Pet1.class](../../../../../components/schemas/Pet.md#pet1) | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| [ApplicationxmlSchemaList](#applicationxmlschemalist) | validate([List](#applicationxmlschemalistbuilder) arg, SchemaConfiguration configuration) | +| [ApplicationxmlSchema1BoxedList](#applicationxmlschema1boxedlist) | validateAndBox([List](#applicationxmlschemalistbuilder) arg, SchemaConfiguration configuration) | +| [ApplicationxmlSchema1Boxed](#applicationxmlschema1boxed) | validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) | +| @Nullable Object | validate(@Nullable Object arg, SchemaConfiguration configuration) | + +## ApplicationxmlSchemaListBuilder +public class ApplicationxmlSchemaListBuilder
+builder for `List>` + +A class that builds the List input type + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| ApplicationxmlSchemaListBuilder()
Creates an empty list | +| ApplicationxmlSchemaListBuilder(List> items)
Stores the items in a list | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| ApplicationxmlSchemaListBuilder | add(Map item) | +| List> | build()
Returns list input that should be used with Schema.validate | + +## ApplicationxmlSchemaList +public class ApplicationxmlSchemaList
+extends `FrozenList` + +A class to store validated List payloads + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| static [ApplicationxmlSchemaList](#applicationxmlschemalist) | of([List>](#applicationxmlschemalistbuilder) arg, SchemaConfiguration configuration) | diff --git a/samples/client/petstore/kotlin/docs/components/responses/successinlinecontentandheader/SuccessInlineContentAndHeaderHeadersSchema.md b/samples/client/petstore/kotlin/docs/components/responses/successinlinecontentandheader/SuccessInlineContentAndHeaderHeadersSchema.md new file mode 100644 index 00000000000..4bc7610c67a --- /dev/null +++ b/samples/client/petstore/kotlin/docs/components/responses/successinlinecontentandheader/SuccessInlineContentAndHeaderHeadersSchema.md @@ -0,0 +1,252 @@ +# SuccessInlineContentAndHeaderHeadersSchema +public class SuccessInlineContentAndHeaderHeadersSchema
+ +A class that contains necessary nested +- schema classes (which validate payloads), extends JsonSchema +- sealed interfaces which store validated payloads, java version of a sum type +- boxed classes which store validated payloads, sealed permits class implementations +- classes to store validated map payloads, extends FrozenMap +- classes to build inputs for map payloads + +## Nested Class Summary +| Modifier and Type | Class and Description | +| ----------------- | ---------------------- | +| sealed interface | [SuccessInlineContentAndHeaderHeadersSchema.SuccessInlineContentAndHeaderHeadersSchema1Boxed](#successinlinecontentandheaderheadersschema1boxed)
sealed interface for validated payloads | +| record | [SuccessInlineContentAndHeaderHeadersSchema.SuccessInlineContentAndHeaderHeadersSchema1BoxedMap](#successinlinecontentandheaderheadersschema1boxedmap)
boxed class to store validated Map payloads | +| static class | [SuccessInlineContentAndHeaderHeadersSchema.SuccessInlineContentAndHeaderHeadersSchema1](#successinlinecontentandheaderheadersschema1)
schema class | +| static class | [SuccessInlineContentAndHeaderHeadersSchema.SuccessInlineContentAndHeaderHeadersSchemaMapBuilder](#successinlinecontentandheaderheadersschemamapbuilder)
builder for Map payloads | +| static class | [SuccessInlineContentAndHeaderHeadersSchema.SuccessInlineContentAndHeaderHeadersSchemaMap](#successinlinecontentandheaderheadersschemamap)
output class for Map payloads | +| sealed interface | [SuccessInlineContentAndHeaderHeadersSchema.SuccessInlineContentAndHeaderAdditionalPropertiesBoxed](#successinlinecontentandheaderadditionalpropertiesboxed)
sealed interface for validated payloads | +| record | [SuccessInlineContentAndHeaderHeadersSchema.SuccessInlineContentAndHeaderAdditionalPropertiesBoxedVoid](#successinlinecontentandheaderadditionalpropertiesboxedvoid)
boxed class to store validated null payloads | +| record | [SuccessInlineContentAndHeaderHeadersSchema.SuccessInlineContentAndHeaderAdditionalPropertiesBoxedBoolean](#successinlinecontentandheaderadditionalpropertiesboxedboolean)
boxed class to store validated boolean payloads | +| record | [SuccessInlineContentAndHeaderHeadersSchema.SuccessInlineContentAndHeaderAdditionalPropertiesBoxedNumber](#successinlinecontentandheaderadditionalpropertiesboxednumber)
boxed class to store validated Number payloads | +| record | [SuccessInlineContentAndHeaderHeadersSchema.SuccessInlineContentAndHeaderAdditionalPropertiesBoxedString](#successinlinecontentandheaderadditionalpropertiesboxedstring)
boxed class to store validated String payloads | +| record | [SuccessInlineContentAndHeaderHeadersSchema.SuccessInlineContentAndHeaderAdditionalPropertiesBoxedList](#successinlinecontentandheaderadditionalpropertiesboxedlist)
boxed class to store validated List payloads | +| record | [SuccessInlineContentAndHeaderHeadersSchema.SuccessInlineContentAndHeaderAdditionalPropertiesBoxedMap](#successinlinecontentandheaderadditionalpropertiesboxedmap)
boxed class to store validated Map payloads | +| static class | [SuccessInlineContentAndHeaderHeadersSchema.SuccessInlineContentAndHeaderAdditionalProperties](#successinlinecontentandheaderadditionalproperties)
schema class | + +## SuccessInlineContentAndHeaderHeadersSchema1Boxed +public sealed interface SuccessInlineContentAndHeaderHeadersSchema1Boxed
+permits
+[SuccessInlineContentAndHeaderHeadersSchema1BoxedMap](#successinlinecontentandheaderheadersschema1boxedmap) + +sealed interface that stores validated payloads using boxed classes + +## SuccessInlineContentAndHeaderHeadersSchema1BoxedMap +public record SuccessInlineContentAndHeaderHeadersSchema1BoxedMap
+implements [SuccessInlineContentAndHeaderHeadersSchema1Boxed](#successinlinecontentandheaderheadersschema1boxed) + +record that stores validated Map payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| SuccessInlineContentAndHeaderHeadersSchema1BoxedMap([SuccessInlineContentAndHeaderHeadersSchemaMap](#successinlinecontentandheaderheadersschemamap) data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| [SuccessInlineContentAndHeaderHeadersSchemaMap](#successinlinecontentandheaderheadersschemamap) | data()
validated payload | +| @Nullable Object | getData()
validated payload | + +## SuccessInlineContentAndHeaderHeadersSchema1 +public static class SuccessInlineContentAndHeaderHeadersSchema1
+extends JsonSchema + +A schema class that validates payloads + +### Code Sample +``` +import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags; +import org.openapijsonschematools.client.configurations.SchemaConfiguration; +import org.openapijsonschematools.client.exceptions.ValidationException; +import org.openapijsonschematools.client.schemas.validation.MapUtils; +import org.openapijsonschematools.client.schemas.validation.FrozenList; +import org.openapijsonschematools.client.schemas.validation.FrozenMap; +import org.openapijsonschematools.client.components.responses.successinlinecontentandheader.SuccessInlineContentAndHeaderHeadersSchema; + +import java.util.Arrays; +import java.util.List; +import java.util.AbstractMap; + +static final SchemaConfiguration configuration = new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().build()); + +// Map validation +SuccessInlineContentAndHeaderHeadersSchema.SuccessInlineContentAndHeaderHeadersSchemaMap validatedPayload = + SuccessInlineContentAndHeaderHeadersSchema.SuccessInlineContentAndHeaderHeadersSchema1.validate( + new SuccessInlineContentAndHeaderHeadersSchema.SuccessInlineContentAndHeaderHeadersSchemaMapBuilder() + .someHeader("a") + + .build(), + configuration +); +``` + +### Field Summary +| Modifier and Type | Field and Description | +| ----------------- | ---------------------- | +| Set> | type = Set.of(Map.class) | +| Map> | properties = Map.ofEntries(
    new PropertyEntry("someHeader", [SomeHeaderSchema.SomeHeaderSchema1.class](../../../components/responses/successinlinecontentandheader/headers/someheader/SomeHeaderSchema.md#someheaderschema1))
)
| +| Class | additionalProperties = [SuccessInlineContentAndHeaderAdditionalProperties.class](#successinlinecontentandheaderadditionalproperties) | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| [SuccessInlineContentAndHeaderHeadersSchemaMap](#successinlinecontentandheaderheadersschemamap) | validate([Map<?, ?>](#successinlinecontentandheaderheadersschemamapbuilder) arg, SchemaConfiguration configuration) | +| [SuccessInlineContentAndHeaderHeadersSchema1BoxedMap](#successinlinecontentandheaderheadersschema1boxedmap) | validateAndBox([Map<?, ?>](#successinlinecontentandheaderheadersschemamapbuilder) arg, SchemaConfiguration configuration) | +| [SuccessInlineContentAndHeaderHeadersSchema1Boxed](#successinlinecontentandheaderheadersschema1boxed) | validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) | +| @Nullable Object | validate(@Nullable Object arg, SchemaConfiguration configuration) | + +## SuccessInlineContentAndHeaderHeadersSchemaMapBuilder +public class SuccessInlineContentAndHeaderHeadersSchemaMapBuilder
+builder for `Map` + +A class that builds the Map input type + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| SuccessInlineContentAndHeaderHeadersSchemaMapBuilder()
Creates a builder that contains an empty map | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| Map | build()
Returns map input that should be used with Schema.validate | +| [SuccessInlineContentAndHeaderHeadersSchemaMapBuilder](#successinlinecontentandheaderheadersschemamapbuilder) | someHeader(String value) | + +## SuccessInlineContentAndHeaderHeadersSchemaMap +public static class SuccessInlineContentAndHeaderHeadersSchemaMap
+extends FrozenMap + +A class to store validated Map payloads + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| static [SuccessInlineContentAndHeaderHeadersSchemaMap](#successinlinecontentandheaderheadersschemamap) | of([Map](#successinlinecontentandheaderheadersschemamapbuilder) arg, SchemaConfiguration configuration) | +| String | someHeader()
[optional] | + +## SuccessInlineContentAndHeaderAdditionalPropertiesBoxed +public sealed interface SuccessInlineContentAndHeaderAdditionalPropertiesBoxed
+permits
+[SuccessInlineContentAndHeaderAdditionalPropertiesBoxedVoid](#successinlinecontentandheaderadditionalpropertiesboxedvoid), +[SuccessInlineContentAndHeaderAdditionalPropertiesBoxedBoolean](#successinlinecontentandheaderadditionalpropertiesboxedboolean), +[SuccessInlineContentAndHeaderAdditionalPropertiesBoxedNumber](#successinlinecontentandheaderadditionalpropertiesboxednumber), +[SuccessInlineContentAndHeaderAdditionalPropertiesBoxedString](#successinlinecontentandheaderadditionalpropertiesboxedstring), +[SuccessInlineContentAndHeaderAdditionalPropertiesBoxedList](#successinlinecontentandheaderadditionalpropertiesboxedlist), +[SuccessInlineContentAndHeaderAdditionalPropertiesBoxedMap](#successinlinecontentandheaderadditionalpropertiesboxedmap) + +sealed interface that stores validated payloads using boxed classes + +## SuccessInlineContentAndHeaderAdditionalPropertiesBoxedVoid +public record SuccessInlineContentAndHeaderAdditionalPropertiesBoxedVoid
+implements [SuccessInlineContentAndHeaderAdditionalPropertiesBoxed](#successinlinecontentandheaderadditionalpropertiesboxed) + +record that stores validated null payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| SuccessInlineContentAndHeaderAdditionalPropertiesBoxedVoid(Nothing? data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| Nothing? | data()
validated payload | +| @Nullable Object | getData()
validated payload | + +## SuccessInlineContentAndHeaderAdditionalPropertiesBoxedBoolean +public record SuccessInlineContentAndHeaderAdditionalPropertiesBoxedBoolean
+implements [SuccessInlineContentAndHeaderAdditionalPropertiesBoxed](#successinlinecontentandheaderadditionalpropertiesboxed) + +record that stores validated boolean payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| SuccessInlineContentAndHeaderAdditionalPropertiesBoxedBoolean(boolean data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| boolean | data()
validated payload | +| @Nullable Object | getData()
validated payload | + +## SuccessInlineContentAndHeaderAdditionalPropertiesBoxedNumber +public record SuccessInlineContentAndHeaderAdditionalPropertiesBoxedNumber
+implements [SuccessInlineContentAndHeaderAdditionalPropertiesBoxed](#successinlinecontentandheaderadditionalpropertiesboxed) + +record that stores validated Number payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| SuccessInlineContentAndHeaderAdditionalPropertiesBoxedNumber(Number data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| Number | data()
validated payload | +| @Nullable Object | getData()
validated payload | + +## SuccessInlineContentAndHeaderAdditionalPropertiesBoxedString +public record SuccessInlineContentAndHeaderAdditionalPropertiesBoxedString
+implements [SuccessInlineContentAndHeaderAdditionalPropertiesBoxed](#successinlinecontentandheaderadditionalpropertiesboxed) + +record that stores validated String payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| SuccessInlineContentAndHeaderAdditionalPropertiesBoxedString(String data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| String | data()
validated payload | +| @Nullable Object | getData()
validated payload | + +## SuccessInlineContentAndHeaderAdditionalPropertiesBoxedList +public record SuccessInlineContentAndHeaderAdditionalPropertiesBoxedList
+implements [SuccessInlineContentAndHeaderAdditionalPropertiesBoxed](#successinlinecontentandheaderadditionalpropertiesboxed) + +record that stores validated List payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| SuccessInlineContentAndHeaderAdditionalPropertiesBoxedList(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 | + +## SuccessInlineContentAndHeaderAdditionalPropertiesBoxedMap +public record SuccessInlineContentAndHeaderAdditionalPropertiesBoxedMap
+implements [SuccessInlineContentAndHeaderAdditionalPropertiesBoxed](#successinlinecontentandheaderadditionalpropertiesboxed) + +record that stores validated Map payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| SuccessInlineContentAndHeaderAdditionalPropertiesBoxedMap(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 | + +## SuccessInlineContentAndHeaderAdditionalProperties +public static class SuccessInlineContentAndHeaderAdditionalProperties
+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/kotlin/docs/components/responses/successinlinecontentandheader/content/applicationjson/ApplicationjsonSchema.md b/samples/client/petstore/kotlin/docs/components/responses/successinlinecontentandheader/content/applicationjson/ApplicationjsonSchema.md new file mode 100644 index 00000000000..63e94647f63 --- /dev/null +++ b/samples/client/petstore/kotlin/docs/components/responses/successinlinecontentandheader/content/applicationjson/ApplicationjsonSchema.md @@ -0,0 +1,157 @@ +# ApplicationjsonSchema +public class ApplicationjsonSchema
+ +A class that contains necessary nested +- schema classes (which validate payloads), extends JsonSchema +- sealed interfaces which store validated payloads, java version of a sum type +- boxed classes which store validated payloads, sealed permits class implementations +- classes to store validated map payloads, extends FrozenMap +- classes to build inputs for map payloads + +## Nested Class Summary +| Modifier and Type | Class and Description | +| ----------------- | ---------------------- | +| sealed interface | [ApplicationjsonSchema.ApplicationjsonSchema1Boxed](#applicationjsonschema1boxed)
sealed interface for validated payloads | +| record | [ApplicationjsonSchema.ApplicationjsonSchema1BoxedMap](#applicationjsonschema1boxedmap)
boxed class to store validated Map payloads | +| static class | [ApplicationjsonSchema.ApplicationjsonSchema1](#applicationjsonschema1)
schema class | +| static class | [ApplicationjsonSchema.ApplicationjsonSchemaMapBuilder](#applicationjsonschemamapbuilder)
builder for Map payloads | +| static class | [ApplicationjsonSchema.ApplicationjsonSchemaMap](#applicationjsonschemamap)
output class for Map payloads | +| sealed interface | [ApplicationjsonSchema.ApplicationjsonAdditionalPropertiesBoxed](#applicationjsonadditionalpropertiesboxed)
sealed interface for validated payloads | +| record | [ApplicationjsonSchema.ApplicationjsonAdditionalPropertiesBoxedNumber](#applicationjsonadditionalpropertiesboxednumber)
boxed class to store validated Number payloads | +| static class | [ApplicationjsonSchema.ApplicationjsonAdditionalProperties](#applicationjsonadditionalproperties)
schema class | + +## ApplicationjsonSchema1Boxed +public sealed interface ApplicationjsonSchema1Boxed
+permits
+[ApplicationjsonSchema1BoxedMap](#applicationjsonschema1boxedmap) + +sealed interface that stores validated payloads using boxed classes + +## ApplicationjsonSchema1BoxedMap +public record ApplicationjsonSchema1BoxedMap
+implements [ApplicationjsonSchema1Boxed](#applicationjsonschema1boxed) + +record that stores validated Map payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| ApplicationjsonSchema1BoxedMap([ApplicationjsonSchemaMap](#applicationjsonschemamap) data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| [ApplicationjsonSchemaMap](#applicationjsonschemamap) | data()
validated payload | +| @Nullable Object | getData()
validated payload | + +## ApplicationjsonSchema1 +public static class ApplicationjsonSchema1
+extends JsonSchema + +A schema class that validates payloads + +### Code Sample +``` +import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags; +import org.openapijsonschematools.client.configurations.SchemaConfiguration; +import org.openapijsonschematools.client.exceptions.ValidationException; +import org.openapijsonschematools.client.schemas.validation.MapUtils; +import org.openapijsonschematools.client.schemas.validation.FrozenList; +import org.openapijsonschematools.client.schemas.validation.FrozenMap; +import org.openapijsonschematools.client.components.responses.successinlinecontentandheader.content.applicationjson.ApplicationjsonSchema; + +import java.util.Arrays; +import java.util.List; +import java.util.AbstractMap; + +static final SchemaConfiguration configuration = new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().build()); + +// Map validation +ApplicationjsonSchema.ApplicationjsonSchemaMap validatedPayload = + ApplicationjsonSchema.ApplicationjsonSchema1.validate( + new ApplicationjsonSchema.ApplicationjsonSchemaMapBuilder() + .additionalProperty("someAdditionalProperty", 1) + + .build(), + configuration +); +``` + +### Field Summary +| Modifier and Type | Field and Description | +| ----------------- | ---------------------- | +| Set> | type = Set.of(Map.class) | +| Class | additionalProperties = [ApplicationjsonAdditionalProperties.class](#applicationjsonadditionalproperties) | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| [ApplicationjsonSchemaMap](#applicationjsonschemamap) | validate([Map<?, ?>](#applicationjsonschemamapbuilder) arg, SchemaConfiguration configuration) | +| [ApplicationjsonSchema1BoxedMap](#applicationjsonschema1boxedmap) | validateAndBox([Map<?, ?>](#applicationjsonschemamapbuilder) arg, SchemaConfiguration configuration) | +| [ApplicationjsonSchema1Boxed](#applicationjsonschema1boxed) | validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) | +| @Nullable Object | validate(@Nullable Object arg, SchemaConfiguration configuration) | + +## ApplicationjsonSchemaMapBuilder +public class ApplicationjsonSchemaMapBuilder
+builder for `Map` + +A class that builds the Map input type + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| ApplicationjsonSchemaMapBuilder()
Creates a builder that contains an empty map | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| Map | build()
Returns map input that should be used with Schema.validate | +| [ApplicationjsonSchemaMapBuilder](#applicationjsonschemamapbuilder) | additionalProperty(String key, int value) | +| [ApplicationjsonSchemaMapBuilder](#applicationjsonschemamapbuilder) | additionalProperty(String key, float value) | + +## ApplicationjsonSchemaMap +public static class ApplicationjsonSchemaMap
+extends FrozenMap + +A class to store validated Map payloads + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| static [ApplicationjsonSchemaMap](#applicationjsonschemamap) | of([Map](#applicationjsonschemamapbuilder) arg, SchemaConfiguration configuration) | +| Number | getAdditionalProperty(String name)
provides type safety for additional properties | + +## ApplicationjsonAdditionalPropertiesBoxed +public sealed interface ApplicationjsonAdditionalPropertiesBoxed
+permits
+[ApplicationjsonAdditionalPropertiesBoxedNumber](#applicationjsonadditionalpropertiesboxednumber) + +sealed interface that stores validated payloads using boxed classes + +## ApplicationjsonAdditionalPropertiesBoxedNumber +public record ApplicationjsonAdditionalPropertiesBoxedNumber
+implements [ApplicationjsonAdditionalPropertiesBoxed](#applicationjsonadditionalpropertiesboxed) + +record that stores validated Number payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| ApplicationjsonAdditionalPropertiesBoxedNumber(Number data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| Number | data()
validated payload | +| @Nullable Object | getData()
validated payload | + +## ApplicationjsonAdditionalProperties +public static class ApplicationjsonAdditionalProperties
+extends Int32JsonSchema.Int32JsonSchema1 + +A schema class that validates payloads + +| Methods Inherited from class org.openapijsonschematools.client.schemas.Int32JsonSchema.Int32JsonSchema1 | +| ------------------------------------------------------------------ | +| validate | +| validateAndBox | diff --git a/samples/client/petstore/kotlin/docs/components/responses/successinlinecontentandheader/headers/someheader/SomeHeaderSchema.md b/samples/client/petstore/kotlin/docs/components/responses/successinlinecontentandheader/headers/someheader/SomeHeaderSchema.md new file mode 100644 index 00000000000..752e31ffc15 --- /dev/null +++ b/samples/client/petstore/kotlin/docs/components/responses/successinlinecontentandheader/headers/someheader/SomeHeaderSchema.md @@ -0,0 +1,49 @@ +# SomeHeaderSchema +public class SomeHeaderSchema
+ +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 + +## Nested Class Summary +| Modifier and Type | Class and Description | +| ----------------- | ---------------------- | +| sealed interface | [SomeHeaderSchema.SomeHeaderSchema1Boxed](#someheaderschema1boxed)
sealed interface for validated payloads | +| record | [SomeHeaderSchema.SomeHeaderSchema1BoxedString](#someheaderschema1boxedstring)
boxed class to store validated String payloads | +| static class | [SomeHeaderSchema.SomeHeaderSchema1](#someheaderschema1)
schema class | + +## SomeHeaderSchema1Boxed +public sealed interface SomeHeaderSchema1Boxed
+permits
+[SomeHeaderSchema1BoxedString](#someheaderschema1boxedstring) + +sealed interface that stores validated payloads using boxed classes + +## SomeHeaderSchema1BoxedString +public record SomeHeaderSchema1BoxedString
+implements [SomeHeaderSchema1Boxed](#someheaderschema1boxed) + +record that stores validated String payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| SomeHeaderSchema1BoxedString(String data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| String | data()
validated payload | +| @Nullable Object | getData()
validated payload | + +## SomeHeaderSchema1 +public static class SomeHeaderSchema1
+extends StringJsonSchema.StringJsonSchema1 + +A schema class that validates payloads + +| Methods Inherited from class org.openapijsonschematools.client.schemas.StringJsonSchema.StringJsonSchema1 | +| ------------------------------------------------------------------ | +| validate | +| validateAndBox | diff --git a/samples/client/petstore/kotlin/docs/components/responses/successwithjsonapiresponse/SuccessWithJsonApiResponseHeadersSchema.md b/samples/client/petstore/kotlin/docs/components/responses/successwithjsonapiresponse/SuccessWithJsonApiResponseHeadersSchema.md new file mode 100644 index 00000000000..6f0c56b5e25 --- /dev/null +++ b/samples/client/petstore/kotlin/docs/components/responses/successwithjsonapiresponse/SuccessWithJsonApiResponseHeadersSchema.md @@ -0,0 +1,527 @@ +# SuccessWithJsonApiResponseHeadersSchema +public class SuccessWithJsonApiResponseHeadersSchema
+ +A class that contains necessary nested +- schema classes (which validate payloads), extends JsonSchema +- sealed interfaces which store validated payloads, java version of a sum type +- boxed classes which store validated payloads, sealed permits class implementations +- classes to store validated map payloads, extends FrozenMap +- classes to build inputs for map payloads + +## Nested Class Summary +| Modifier and Type | Class and Description | +| ----------------- | ---------------------- | +| sealed interface | [SuccessWithJsonApiResponseHeadersSchema.SuccessWithJsonApiResponseHeadersSchema1Boxed](#successwithjsonapiresponseheadersschema1boxed)
sealed interface for validated payloads | +| record | [SuccessWithJsonApiResponseHeadersSchema.SuccessWithJsonApiResponseHeadersSchema1BoxedMap](#successwithjsonapiresponseheadersschema1boxedmap)
boxed class to store validated Map payloads | +| static class | [SuccessWithJsonApiResponseHeadersSchema.SuccessWithJsonApiResponseHeadersSchema1](#successwithjsonapiresponseheadersschema1)
schema class | +| static class | [SuccessWithJsonApiResponseHeadersSchema.SuccessWithJsonApiResponseHeadersSchemaMapBuilder](#successwithjsonapiresponseheadersschemamapbuilder)
builder for Map payloads | +| static class | [SuccessWithJsonApiResponseHeadersSchema.SuccessWithJsonApiResponseHeadersSchemaMap](#successwithjsonapiresponseheadersschemamap)
output class for Map payloads | +| sealed interface | [SuccessWithJsonApiResponseHeadersSchema.SuccessWithJsonApiResponseAdditionalPropertiesBoxed](#successwithjsonapiresponseadditionalpropertiesboxed)
sealed interface for validated payloads | +| record | [SuccessWithJsonApiResponseHeadersSchema.SuccessWithJsonApiResponseAdditionalPropertiesBoxedVoid](#successwithjsonapiresponseadditionalpropertiesboxedvoid)
boxed class to store validated null payloads | +| record | [SuccessWithJsonApiResponseHeadersSchema.SuccessWithJsonApiResponseAdditionalPropertiesBoxedBoolean](#successwithjsonapiresponseadditionalpropertiesboxedboolean)
boxed class to store validated boolean payloads | +| record | [SuccessWithJsonApiResponseHeadersSchema.SuccessWithJsonApiResponseAdditionalPropertiesBoxedNumber](#successwithjsonapiresponseadditionalpropertiesboxednumber)
boxed class to store validated Number payloads | +| record | [SuccessWithJsonApiResponseHeadersSchema.SuccessWithJsonApiResponseAdditionalPropertiesBoxedString](#successwithjsonapiresponseadditionalpropertiesboxedstring)
boxed class to store validated String payloads | +| record | [SuccessWithJsonApiResponseHeadersSchema.SuccessWithJsonApiResponseAdditionalPropertiesBoxedList](#successwithjsonapiresponseadditionalpropertiesboxedlist)
boxed class to store validated List payloads | +| record | [SuccessWithJsonApiResponseHeadersSchema.SuccessWithJsonApiResponseAdditionalPropertiesBoxedMap](#successwithjsonapiresponseadditionalpropertiesboxedmap)
boxed class to store validated Map payloads | +| static class | [SuccessWithJsonApiResponseHeadersSchema.SuccessWithJsonApiResponseAdditionalProperties](#successwithjsonapiresponseadditionalproperties)
schema class | + +## SuccessWithJsonApiResponseHeadersSchema1Boxed +public sealed interface SuccessWithJsonApiResponseHeadersSchema1Boxed
+permits
+[SuccessWithJsonApiResponseHeadersSchema1BoxedMap](#successwithjsonapiresponseheadersschema1boxedmap) + +sealed interface that stores validated payloads using boxed classes + +## SuccessWithJsonApiResponseHeadersSchema1BoxedMap +public record SuccessWithJsonApiResponseHeadersSchema1BoxedMap
+implements [SuccessWithJsonApiResponseHeadersSchema1Boxed](#successwithjsonapiresponseheadersschema1boxed) + +record that stores validated Map payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| SuccessWithJsonApiResponseHeadersSchema1BoxedMap([SuccessWithJsonApiResponseHeadersSchemaMap](#successwithjsonapiresponseheadersschemamap) data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| [SuccessWithJsonApiResponseHeadersSchemaMap](#successwithjsonapiresponseheadersschemamap) | data()
validated payload | +| @Nullable Object | getData()
validated payload | + +## SuccessWithJsonApiResponseHeadersSchema1 +public static class SuccessWithJsonApiResponseHeadersSchema1
+extends JsonSchema + +A schema class that validates payloads + +### Code Sample +``` +import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags; +import org.openapijsonschematools.client.configurations.SchemaConfiguration; +import org.openapijsonschematools.client.exceptions.ValidationException; +import org.openapijsonschematools.client.schemas.validation.MapUtils; +import org.openapijsonschematools.client.schemas.validation.FrozenList; +import org.openapijsonschematools.client.schemas.validation.FrozenMap; +import org.openapijsonschematools.client.components.responses.successwithjsonapiresponse.SuccessWithJsonApiResponseHeadersSchema; + +import java.util.Arrays; +import java.util.List; +import java.util.AbstractMap; + +static final SchemaConfiguration configuration = new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().build()); + +// Map validation +SuccessWithJsonApiResponseHeadersSchema.SuccessWithJsonApiResponseHeadersSchemaMap validatedPayload = + SuccessWithJsonApiResponseHeadersSchema.SuccessWithJsonApiResponseHeadersSchema1.validate( + new SuccessWithJsonApiResponseHeadersSchema.SuccessWithJsonApiResponseHeadersSchemaMapBuilder() + .int32(1) + + .refHyphenMinusContentHyphenMinusSchemaHyphenMinusHeader("a") + + .stringHeader("a") + + .numberHeader("3.14") + + .build(), + configuration +); +``` + +### Field Summary +| Modifier and Type | Field and Description | +| ----------------- | ---------------------- | +| Set> | type = Set.of(Map.class) | +| Map> | properties = Map.ofEntries(
    new PropertyEntry("ref-schema-header", [StringWithValidation.StringWithValidation1.class](../../../components/schemas/StringWithValidation.md#stringwithvalidation1)),
    new PropertyEntry("int32", [Int32JsonContentTypeHeaderSchema.Int32JsonContentTypeHeaderSchema1.class](../../../components/headers/int32jsoncontenttypeheader/content/applicationjson/Int32JsonContentTypeHeaderSchema.md#int32jsoncontenttypeheaderschema1)),
    new PropertyEntry("ref-content-schema-header", [StringWithValidation.StringWithValidation1.class](../../../components/schemas/StringWithValidation.md#stringwithvalidation1)),
    new PropertyEntry("stringHeader", [StringHeaderSchema.StringHeaderSchema1.class](../../../components/headers/stringheader/StringHeaderSchema.md#stringheaderschema1)),
    new PropertyEntry("numberHeader", [NumberHeaderSchema.NumberHeaderSchema1.class](../../../components/headers/numberheader/NumberHeaderSchema.md#numberheaderschema1))
)
| +| Set | required = Set.of(
    "int32",
    "ref-content-schema-header",
    "ref-schema-header",
    "stringHeader"
)
| +| Class | additionalProperties = [SuccessWithJsonApiResponseAdditionalProperties.class](#successwithjsonapiresponseadditionalproperties) | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| [SuccessWithJsonApiResponseHeadersSchemaMap](#successwithjsonapiresponseheadersschemamap) | validate([Map<?, ?>](#successwithjsonapiresponseheadersschemamapbuilder) arg, SchemaConfiguration configuration) | +| [SuccessWithJsonApiResponseHeadersSchema1BoxedMap](#successwithjsonapiresponseheadersschema1boxedmap) | validateAndBox([Map<?, ?>](#successwithjsonapiresponseheadersschemamapbuilder) arg, SchemaConfiguration configuration) | +| [SuccessWithJsonApiResponseHeadersSchema1Boxed](#successwithjsonapiresponseheadersschema1boxed) | validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) | +| @Nullable Object | validate(@Nullable Object arg, SchemaConfiguration configuration) | + +## SuccessWithJsonApiResponseHeadersSchemaMap0000Builder +public class SuccessWithJsonApiResponseHeadersSchemaMap0000Builder
+builder for `Map` + +A class that builds the Map input type + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| SuccessWithJsonApiResponseHeadersSchemaMap0000Builder(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 | +| [SuccessWithJsonApiResponseHeadersSchemaMap0000Builder](#successwithjsonapiresponseheadersschemamap0000builder) | numberHeader(String value) | + +## SuccessWithJsonApiResponseHeadersSchemaMap0001Builder +public class SuccessWithJsonApiResponseHeadersSchemaMap0001Builder
+builder for `Map` + +A class that builds the Map input type + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| SuccessWithJsonApiResponseHeadersSchemaMap0001Builder(Map instance)
Creates a builder that contains the passed instance | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| [SuccessWithJsonApiResponseHeadersSchemaMap0000Builder](#successwithjsonapiresponseheadersschemamap0000builder) | stringHeader(String value) | + +## SuccessWithJsonApiResponseHeadersSchemaMap0010Builder +public class SuccessWithJsonApiResponseHeadersSchemaMap0010Builder
+builder for `Map` + +A class that builds the Map input type + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| SuccessWithJsonApiResponseHeadersSchemaMap0010Builder(Map instance)
Creates a builder that contains the passed instance | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| [SuccessWithJsonApiResponseHeadersSchemaMap0000Builder](#successwithjsonapiresponseheadersschemamap0000builder) | refHyphenMinusSchemaHyphenMinusHeader(String value) | + +## SuccessWithJsonApiResponseHeadersSchemaMap0011Builder +public class SuccessWithJsonApiResponseHeadersSchemaMap0011Builder
+builder for `Map` + +A class that builds the Map input type + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| SuccessWithJsonApiResponseHeadersSchemaMap0011Builder(Map instance)
Creates a builder that contains the passed instance | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| [SuccessWithJsonApiResponseHeadersSchemaMap0001Builder](#successwithjsonapiresponseheadersschemamap0001builder) | refHyphenMinusSchemaHyphenMinusHeader(String value) | +| [SuccessWithJsonApiResponseHeadersSchemaMap0010Builder](#successwithjsonapiresponseheadersschemamap0010builder) | stringHeader(String value) | + +## SuccessWithJsonApiResponseHeadersSchemaMap0100Builder +public class SuccessWithJsonApiResponseHeadersSchemaMap0100Builder
+builder for `Map` + +A class that builds the Map input type + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| SuccessWithJsonApiResponseHeadersSchemaMap0100Builder(Map instance)
Creates a builder that contains the passed instance | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| [SuccessWithJsonApiResponseHeadersSchemaMap0000Builder](#successwithjsonapiresponseheadersschemamap0000builder) | refHyphenMinusContentHyphenMinusSchemaHyphenMinusHeader(String value) | + +## SuccessWithJsonApiResponseHeadersSchemaMap0101Builder +public class SuccessWithJsonApiResponseHeadersSchemaMap0101Builder
+builder for `Map` + +A class that builds the Map input type + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| SuccessWithJsonApiResponseHeadersSchemaMap0101Builder(Map instance)
Creates a builder that contains the passed instance | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| [SuccessWithJsonApiResponseHeadersSchemaMap0001Builder](#successwithjsonapiresponseheadersschemamap0001builder) | refHyphenMinusContentHyphenMinusSchemaHyphenMinusHeader(String value) | +| [SuccessWithJsonApiResponseHeadersSchemaMap0100Builder](#successwithjsonapiresponseheadersschemamap0100builder) | stringHeader(String value) | + +## SuccessWithJsonApiResponseHeadersSchemaMap0110Builder +public class SuccessWithJsonApiResponseHeadersSchemaMap0110Builder
+builder for `Map` + +A class that builds the Map input type + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| SuccessWithJsonApiResponseHeadersSchemaMap0110Builder(Map instance)
Creates a builder that contains the passed instance | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| [SuccessWithJsonApiResponseHeadersSchemaMap0010Builder](#successwithjsonapiresponseheadersschemamap0010builder) | refHyphenMinusContentHyphenMinusSchemaHyphenMinusHeader(String value) | +| [SuccessWithJsonApiResponseHeadersSchemaMap0100Builder](#successwithjsonapiresponseheadersschemamap0100builder) | refHyphenMinusSchemaHyphenMinusHeader(String value) | + +## SuccessWithJsonApiResponseHeadersSchemaMap0111Builder +public class SuccessWithJsonApiResponseHeadersSchemaMap0111Builder
+builder for `Map` + +A class that builds the Map input type + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| SuccessWithJsonApiResponseHeadersSchemaMap0111Builder(Map instance)
Creates a builder that contains the passed instance | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| [SuccessWithJsonApiResponseHeadersSchemaMap0011Builder](#successwithjsonapiresponseheadersschemamap0011builder) | refHyphenMinusContentHyphenMinusSchemaHyphenMinusHeader(String value) | +| [SuccessWithJsonApiResponseHeadersSchemaMap0101Builder](#successwithjsonapiresponseheadersschemamap0101builder) | refHyphenMinusSchemaHyphenMinusHeader(String value) | +| [SuccessWithJsonApiResponseHeadersSchemaMap0110Builder](#successwithjsonapiresponseheadersschemamap0110builder) | stringHeader(String value) | + +## SuccessWithJsonApiResponseHeadersSchemaMap1000Builder +public class SuccessWithJsonApiResponseHeadersSchemaMap1000Builder
+builder for `Map` + +A class that builds the Map input type + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| SuccessWithJsonApiResponseHeadersSchemaMap1000Builder(Map instance)
Creates a builder that contains the passed instance | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| [SuccessWithJsonApiResponseHeadersSchemaMap0000Builder](#successwithjsonapiresponseheadersschemamap0000builder) | int32(int value) | +| [SuccessWithJsonApiResponseHeadersSchemaMap0000Builder](#successwithjsonapiresponseheadersschemamap0000builder) | int32(float value) | + +## SuccessWithJsonApiResponseHeadersSchemaMap1001Builder +public class SuccessWithJsonApiResponseHeadersSchemaMap1001Builder
+builder for `Map` + +A class that builds the Map input type + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| SuccessWithJsonApiResponseHeadersSchemaMap1001Builder(Map instance)
Creates a builder that contains the passed instance | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| [SuccessWithJsonApiResponseHeadersSchemaMap0001Builder](#successwithjsonapiresponseheadersschemamap0001builder) | int32(int value) | +| [SuccessWithJsonApiResponseHeadersSchemaMap0001Builder](#successwithjsonapiresponseheadersschemamap0001builder) | int32(float value) | +| [SuccessWithJsonApiResponseHeadersSchemaMap1000Builder](#successwithjsonapiresponseheadersschemamap1000builder) | stringHeader(String value) | + +## SuccessWithJsonApiResponseHeadersSchemaMap1010Builder +public class SuccessWithJsonApiResponseHeadersSchemaMap1010Builder
+builder for `Map` + +A class that builds the Map input type + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| SuccessWithJsonApiResponseHeadersSchemaMap1010Builder(Map instance)
Creates a builder that contains the passed instance | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| [SuccessWithJsonApiResponseHeadersSchemaMap0010Builder](#successwithjsonapiresponseheadersschemamap0010builder) | int32(int value) | +| [SuccessWithJsonApiResponseHeadersSchemaMap0010Builder](#successwithjsonapiresponseheadersschemamap0010builder) | int32(float value) | +| [SuccessWithJsonApiResponseHeadersSchemaMap1000Builder](#successwithjsonapiresponseheadersschemamap1000builder) | refHyphenMinusSchemaHyphenMinusHeader(String value) | + +## SuccessWithJsonApiResponseHeadersSchemaMap1011Builder +public class SuccessWithJsonApiResponseHeadersSchemaMap1011Builder
+builder for `Map` + +A class that builds the Map input type + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| SuccessWithJsonApiResponseHeadersSchemaMap1011Builder(Map instance)
Creates a builder that contains the passed instance | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| [SuccessWithJsonApiResponseHeadersSchemaMap0011Builder](#successwithjsonapiresponseheadersschemamap0011builder) | int32(int value) | +| [SuccessWithJsonApiResponseHeadersSchemaMap0011Builder](#successwithjsonapiresponseheadersschemamap0011builder) | int32(float value) | +| [SuccessWithJsonApiResponseHeadersSchemaMap1001Builder](#successwithjsonapiresponseheadersschemamap1001builder) | refHyphenMinusSchemaHyphenMinusHeader(String value) | +| [SuccessWithJsonApiResponseHeadersSchemaMap1010Builder](#successwithjsonapiresponseheadersschemamap1010builder) | stringHeader(String value) | + +## SuccessWithJsonApiResponseHeadersSchemaMap1100Builder +public class SuccessWithJsonApiResponseHeadersSchemaMap1100Builder
+builder for `Map` + +A class that builds the Map input type + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| SuccessWithJsonApiResponseHeadersSchemaMap1100Builder(Map instance)
Creates a builder that contains the passed instance | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| [SuccessWithJsonApiResponseHeadersSchemaMap0100Builder](#successwithjsonapiresponseheadersschemamap0100builder) | int32(int value) | +| [SuccessWithJsonApiResponseHeadersSchemaMap0100Builder](#successwithjsonapiresponseheadersschemamap0100builder) | int32(float value) | +| [SuccessWithJsonApiResponseHeadersSchemaMap1000Builder](#successwithjsonapiresponseheadersschemamap1000builder) | refHyphenMinusContentHyphenMinusSchemaHyphenMinusHeader(String value) | + +## SuccessWithJsonApiResponseHeadersSchemaMap1101Builder +public class SuccessWithJsonApiResponseHeadersSchemaMap1101Builder
+builder for `Map` + +A class that builds the Map input type + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| SuccessWithJsonApiResponseHeadersSchemaMap1101Builder(Map instance)
Creates a builder that contains the passed instance | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| [SuccessWithJsonApiResponseHeadersSchemaMap0101Builder](#successwithjsonapiresponseheadersschemamap0101builder) | int32(int value) | +| [SuccessWithJsonApiResponseHeadersSchemaMap0101Builder](#successwithjsonapiresponseheadersschemamap0101builder) | int32(float value) | +| [SuccessWithJsonApiResponseHeadersSchemaMap1001Builder](#successwithjsonapiresponseheadersschemamap1001builder) | refHyphenMinusContentHyphenMinusSchemaHyphenMinusHeader(String value) | +| [SuccessWithJsonApiResponseHeadersSchemaMap1100Builder](#successwithjsonapiresponseheadersschemamap1100builder) | stringHeader(String value) | + +## SuccessWithJsonApiResponseHeadersSchemaMap1110Builder +public class SuccessWithJsonApiResponseHeadersSchemaMap1110Builder
+builder for `Map` + +A class that builds the Map input type + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| SuccessWithJsonApiResponseHeadersSchemaMap1110Builder(Map instance)
Creates a builder that contains the passed instance | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| [SuccessWithJsonApiResponseHeadersSchemaMap0110Builder](#successwithjsonapiresponseheadersschemamap0110builder) | int32(int value) | +| [SuccessWithJsonApiResponseHeadersSchemaMap0110Builder](#successwithjsonapiresponseheadersschemamap0110builder) | int32(float value) | +| [SuccessWithJsonApiResponseHeadersSchemaMap1010Builder](#successwithjsonapiresponseheadersschemamap1010builder) | refHyphenMinusContentHyphenMinusSchemaHyphenMinusHeader(String value) | +| [SuccessWithJsonApiResponseHeadersSchemaMap1100Builder](#successwithjsonapiresponseheadersschemamap1100builder) | refHyphenMinusSchemaHyphenMinusHeader(String value) | + +## SuccessWithJsonApiResponseHeadersSchemaMapBuilder +public class SuccessWithJsonApiResponseHeadersSchemaMapBuilder
+builder for `Map` + +A class that builds the Map input type + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| SuccessWithJsonApiResponseHeadersSchemaMapBuilder()
Creates a builder that contains an empty map | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| [SuccessWithJsonApiResponseHeadersSchemaMap0111Builder](#successwithjsonapiresponseheadersschemamap0111builder) | int32(int value) | +| [SuccessWithJsonApiResponseHeadersSchemaMap0111Builder](#successwithjsonapiresponseheadersschemamap0111builder) | int32(float value) | +| [SuccessWithJsonApiResponseHeadersSchemaMap1011Builder](#successwithjsonapiresponseheadersschemamap1011builder) | refHyphenMinusContentHyphenMinusSchemaHyphenMinusHeader(String value) | +| [SuccessWithJsonApiResponseHeadersSchemaMap1101Builder](#successwithjsonapiresponseheadersschemamap1101builder) | refHyphenMinusSchemaHyphenMinusHeader(String value) | +| [SuccessWithJsonApiResponseHeadersSchemaMap1110Builder](#successwithjsonapiresponseheadersschemamap1110builder) | stringHeader(String value) | + +## SuccessWithJsonApiResponseHeadersSchemaMap +public static class SuccessWithJsonApiResponseHeadersSchemaMap
+extends FrozenMap + +A class to store validated Map payloads + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| static [SuccessWithJsonApiResponseHeadersSchemaMap](#successwithjsonapiresponseheadersschemamap) | of([Map](#successwithjsonapiresponseheadersschemamapbuilder) arg, SchemaConfiguration configuration) | +| Number | int32()
| +| String | stringHeader()
| +| String | numberHeader()
[optional] | +| @Nullable Object | get(String key)
This schema has invalid Java names so this method must be used when you access instance["ref-content-schema-header"], instance["ref-schema-header"], | + +## SuccessWithJsonApiResponseAdditionalPropertiesBoxed +public sealed interface SuccessWithJsonApiResponseAdditionalPropertiesBoxed
+permits
+[SuccessWithJsonApiResponseAdditionalPropertiesBoxedVoid](#successwithjsonapiresponseadditionalpropertiesboxedvoid), +[SuccessWithJsonApiResponseAdditionalPropertiesBoxedBoolean](#successwithjsonapiresponseadditionalpropertiesboxedboolean), +[SuccessWithJsonApiResponseAdditionalPropertiesBoxedNumber](#successwithjsonapiresponseadditionalpropertiesboxednumber), +[SuccessWithJsonApiResponseAdditionalPropertiesBoxedString](#successwithjsonapiresponseadditionalpropertiesboxedstring), +[SuccessWithJsonApiResponseAdditionalPropertiesBoxedList](#successwithjsonapiresponseadditionalpropertiesboxedlist), +[SuccessWithJsonApiResponseAdditionalPropertiesBoxedMap](#successwithjsonapiresponseadditionalpropertiesboxedmap) + +sealed interface that stores validated payloads using boxed classes + +## SuccessWithJsonApiResponseAdditionalPropertiesBoxedVoid +public record SuccessWithJsonApiResponseAdditionalPropertiesBoxedVoid
+implements [SuccessWithJsonApiResponseAdditionalPropertiesBoxed](#successwithjsonapiresponseadditionalpropertiesboxed) + +record that stores validated null payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| SuccessWithJsonApiResponseAdditionalPropertiesBoxedVoid(Nothing? data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| Nothing? | data()
validated payload | +| @Nullable Object | getData()
validated payload | + +## SuccessWithJsonApiResponseAdditionalPropertiesBoxedBoolean +public record SuccessWithJsonApiResponseAdditionalPropertiesBoxedBoolean
+implements [SuccessWithJsonApiResponseAdditionalPropertiesBoxed](#successwithjsonapiresponseadditionalpropertiesboxed) + +record that stores validated boolean payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| SuccessWithJsonApiResponseAdditionalPropertiesBoxedBoolean(boolean data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| boolean | data()
validated payload | +| @Nullable Object | getData()
validated payload | + +## SuccessWithJsonApiResponseAdditionalPropertiesBoxedNumber +public record SuccessWithJsonApiResponseAdditionalPropertiesBoxedNumber
+implements [SuccessWithJsonApiResponseAdditionalPropertiesBoxed](#successwithjsonapiresponseadditionalpropertiesboxed) + +record that stores validated Number payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| SuccessWithJsonApiResponseAdditionalPropertiesBoxedNumber(Number data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| Number | data()
validated payload | +| @Nullable Object | getData()
validated payload | + +## SuccessWithJsonApiResponseAdditionalPropertiesBoxedString +public record SuccessWithJsonApiResponseAdditionalPropertiesBoxedString
+implements [SuccessWithJsonApiResponseAdditionalPropertiesBoxed](#successwithjsonapiresponseadditionalpropertiesboxed) + +record that stores validated String payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| SuccessWithJsonApiResponseAdditionalPropertiesBoxedString(String data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| String | data()
validated payload | +| @Nullable Object | getData()
validated payload | + +## SuccessWithJsonApiResponseAdditionalPropertiesBoxedList +public record SuccessWithJsonApiResponseAdditionalPropertiesBoxedList
+implements [SuccessWithJsonApiResponseAdditionalPropertiesBoxed](#successwithjsonapiresponseadditionalpropertiesboxed) + +record that stores validated List payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| SuccessWithJsonApiResponseAdditionalPropertiesBoxedList(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 | + +## SuccessWithJsonApiResponseAdditionalPropertiesBoxedMap +public record SuccessWithJsonApiResponseAdditionalPropertiesBoxedMap
+implements [SuccessWithJsonApiResponseAdditionalPropertiesBoxed](#successwithjsonapiresponseadditionalpropertiesboxed) + +record that stores validated Map payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| SuccessWithJsonApiResponseAdditionalPropertiesBoxedMap(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 | + +## SuccessWithJsonApiResponseAdditionalProperties +public static class SuccessWithJsonApiResponseAdditionalProperties
+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/kotlin/docs/components/responses/successwithjsonapiresponse/content/applicationjson/ApplicationjsonSchema.md b/samples/client/petstore/kotlin/docs/components/responses/successwithjsonapiresponse/content/applicationjson/ApplicationjsonSchema.md new file mode 100644 index 00000000000..a340ff691f7 --- /dev/null +++ b/samples/client/petstore/kotlin/docs/components/responses/successwithjsonapiresponse/content/applicationjson/ApplicationjsonSchema.md @@ -0,0 +1,19 @@ +# ApplicationjsonSchema +public class ApplicationjsonSchema
+extends [ApiResponseSchema1](../../../../../components/schemas/ApiResponseSchema.md#apiresponseschema) + +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 + +## Nested Class Summary +| Modifier and Type | Class and Description | +| ----------------- | ---------------------- | +| static class | [ApplicationjsonSchema.ApplicationjsonSchema1](#applicationjsonschema1)
schema class | + +## ApplicationjsonSchema1 +public static class ApplicationjsonSchema1
+extends [ApiResponseSchema.ApiResponseSchema1](../../../../../components/schemas/ApiResponseSchema.md#apiresponseschema1) + +A schema class that validates payloads diff --git a/samples/client/petstore/kotlin/docs/components/schemas/AbstractStepMessage.md b/samples/client/petstore/kotlin/docs/components/schemas/AbstractStepMessage.md new file mode 100644 index 00000000000..f74184b871b --- /dev/null +++ b/samples/client/petstore/kotlin/docs/components/schemas/AbstractStepMessage.md @@ -0,0 +1,356 @@ +# AbstractStepMessage +org.openapijsonschematools.client.components.schemas.AbstractStepMessage.java +public class AbstractStepMessage
+ +A class that contains necessary nested +- schema classes (which validate payloads), extends JsonSchema +- sealed interfaces which store validated payloads, java version of a sum type +- boxed classes which store validated payloads, sealed permits class implementations +- classes to store validated map payloads, extends FrozenMap +- classes to build inputs for map payloads + +## Nested Class Summary +| Modifier and Type | Class and Description | +| ----------------- | ---------------------- | +| sealed interface | [AbstractStepMessage.AbstractStepMessage1Boxed](#abstractstepmessage1boxed)
sealed interface for validated payloads | +| record | [AbstractStepMessage.AbstractStepMessage1BoxedMap](#abstractstepmessage1boxedmap)
boxed class to store validated Map payloads | +| static class | [AbstractStepMessage.AbstractStepMessage1](#abstractstepmessage1)
schema class | +| static class | [AbstractStepMessage.AbstractStepMessageMapBuilder](#abstractstepmessagemapbuilder)
builder for Map payloads | +| static class | [AbstractStepMessage.AbstractStepMessageMap](#abstractstepmessagemap)
output class for Map payloads | +| sealed interface | [AbstractStepMessage.DiscriminatorBoxed](#discriminatorboxed)
sealed interface for validated payloads | +| record | [AbstractStepMessage.DiscriminatorBoxedString](#discriminatorboxedstring)
boxed class to store validated String payloads | +| static class | [AbstractStepMessage.Discriminator](#discriminator)
schema class | + +## AbstractStepMessage1Boxed +public sealed interface AbstractStepMessage1Boxed
+permits
+[AbstractStepMessage1BoxedMap](#abstractstepmessage1boxedmap) + +sealed interface that stores validated payloads using boxed classes + +## AbstractStepMessage1BoxedMap +public record AbstractStepMessage1BoxedMap
+implements [AbstractStepMessage1Boxed](#abstractstepmessage1boxed) + +record that stores validated Map payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| AbstractStepMessage1BoxedMap([AbstractStepMessageMap](#abstractstepmessagemap) data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| [AbstractStepMessageMap](#abstractstepmessagemap) | data()
validated payload | +| @Nullable Object | getData()
validated payload | + +## AbstractStepMessage1 +public static class AbstractStepMessage1
+extends JsonSchema + +A schema class that validates payloads + +## Description +Abstract Step + +### Code Sample +``` +import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags; +import org.openapijsonschematools.client.configurations.SchemaConfiguration; +import org.openapijsonschematools.client.exceptions.ValidationException; +import org.openapijsonschematools.client.schemas.validation.MapUtils; +import org.openapijsonschematools.client.schemas.validation.FrozenList; +import org.openapijsonschematools.client.schemas.validation.FrozenMap; +import org.openapijsonschematools.client.components.schemas.AbstractStepMessage; + +import java.util.Arrays; +import java.util.List; +import java.util.AbstractMap; + +static final SchemaConfiguration configuration = new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().build()); + +// Map validation +AbstractStepMessage.AbstractStepMessageMap validatedPayload = + AbstractStepMessage.AbstractStepMessage1.validate( + new AbstractStepMessage.AbstractStepMessageMapBuilder() + .discriminator("a") + + .build(), + configuration +); +``` + +### Field Summary +| Modifier and Type | Field and Description | +| ----------------- | ---------------------- | +| Set> | type = Set.of(Map.class) | +| Map> | properties = Map.ofEntries(
    new PropertyEntry("discriminator", [Discriminator.class](#discriminator)))
)
| +| Set | required = Set.of(
    "description",
    "discriminator",
    "sequenceNumber"
)
| +| List> | anyOf = List.of(
    [AbstractStepMessage1.class](#abstractstepmessage1)
)
| + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| [AbstractStepMessageMap](#abstractstepmessagemap) | validate([Map<?, ?>](#abstractstepmessagemapbuilder) arg, SchemaConfiguration configuration) | +| [AbstractStepMessage1BoxedMap](#abstractstepmessage1boxedmap) | validateAndBox([Map<?, ?>](#abstractstepmessagemapbuilder) arg, SchemaConfiguration configuration) | +| [AbstractStepMessage1Boxed](#abstractstepmessage1boxed) | validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) | +| @Nullable Object | validate(@Nullable Object arg, SchemaConfiguration configuration) | + +## AbstractStepMessageMap000Builder +public class AbstractStepMessageMap000Builder
+builder for `Map` + +A class that builds the Map input type + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| AbstractStepMessageMap000Builder(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 | +| [AbstractStepMessageMap000Builder](#abstractstepmessagemap000builder) | additionalProperty(String key, Nothing? value) | +| [AbstractStepMessageMap000Builder](#abstractstepmessagemap000builder) | additionalProperty(String key, boolean value) | +| [AbstractStepMessageMap000Builder](#abstractstepmessagemap000builder) | additionalProperty(String key, String value) | +| [AbstractStepMessageMap000Builder](#abstractstepmessagemap000builder) | additionalProperty(String key, int value) | +| [AbstractStepMessageMap000Builder](#abstractstepmessagemap000builder) | additionalProperty(String key, float value) | +| [AbstractStepMessageMap000Builder](#abstractstepmessagemap000builder) | additionalProperty(String key, long value) | +| [AbstractStepMessageMap000Builder](#abstractstepmessagemap000builder) | additionalProperty(String key, double value) | +| [AbstractStepMessageMap000Builder](#abstractstepmessagemap000builder) | additionalProperty(String key, List value) | +| [AbstractStepMessageMap000Builder](#abstractstepmessagemap000builder) | additionalProperty(String key, Map value) | + +## AbstractStepMessageMap001Builder +public class AbstractStepMessageMap001Builder
+builder for `Map` + +A class that builds the Map input type + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| AbstractStepMessageMap001Builder(Map instance)
Creates a builder that contains the passed instance | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| [AbstractStepMessageMap000Builder](#abstractstepmessagemap000builder) | sequenceNumber(Nothing? value) | +| [AbstractStepMessageMap000Builder](#abstractstepmessagemap000builder) | sequenceNumber(boolean value) | +| [AbstractStepMessageMap000Builder](#abstractstepmessagemap000builder) | sequenceNumber(String value) | +| [AbstractStepMessageMap000Builder](#abstractstepmessagemap000builder) | sequenceNumber(int value) | +| [AbstractStepMessageMap000Builder](#abstractstepmessagemap000builder) | sequenceNumber(float value) | +| [AbstractStepMessageMap000Builder](#abstractstepmessagemap000builder) | sequenceNumber(long value) | +| [AbstractStepMessageMap000Builder](#abstractstepmessagemap000builder) | sequenceNumber(double value) | +| [AbstractStepMessageMap000Builder](#abstractstepmessagemap000builder) | sequenceNumber(List value) | +| [AbstractStepMessageMap000Builder](#abstractstepmessagemap000builder) | sequenceNumber(Map value) | + +## AbstractStepMessageMap010Builder +public class AbstractStepMessageMap010Builder
+builder for `Map` + +A class that builds the Map input type + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| AbstractStepMessageMap010Builder(Map instance)
Creates a builder that contains the passed instance | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| [AbstractStepMessageMap000Builder](#abstractstepmessagemap000builder) | discriminator(String value) | + +## AbstractStepMessageMap011Builder +public class AbstractStepMessageMap011Builder
+builder for `Map` + +A class that builds the Map input type + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| AbstractStepMessageMap011Builder(Map instance)
Creates a builder that contains the passed instance | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| [AbstractStepMessageMap001Builder](#abstractstepmessagemap001builder) | discriminator(String value) | +| [AbstractStepMessageMap010Builder](#abstractstepmessagemap010builder) | sequenceNumber(Nothing? value) | +| [AbstractStepMessageMap010Builder](#abstractstepmessagemap010builder) | sequenceNumber(boolean value) | +| [AbstractStepMessageMap010Builder](#abstractstepmessagemap010builder) | sequenceNumber(String value) | +| [AbstractStepMessageMap010Builder](#abstractstepmessagemap010builder) | sequenceNumber(int value) | +| [AbstractStepMessageMap010Builder](#abstractstepmessagemap010builder) | sequenceNumber(float value) | +| [AbstractStepMessageMap010Builder](#abstractstepmessagemap010builder) | sequenceNumber(long value) | +| [AbstractStepMessageMap010Builder](#abstractstepmessagemap010builder) | sequenceNumber(double value) | +| [AbstractStepMessageMap010Builder](#abstractstepmessagemap010builder) | sequenceNumber(List value) | +| [AbstractStepMessageMap010Builder](#abstractstepmessagemap010builder) | sequenceNumber(Map value) | + +## AbstractStepMessageMap100Builder +public class AbstractStepMessageMap100Builder
+builder for `Map` + +A class that builds the Map input type + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| AbstractStepMessageMap100Builder(Map instance)
Creates a builder that contains the passed instance | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| [AbstractStepMessageMap000Builder](#abstractstepmessagemap000builder) | description(Nothing? value) | +| [AbstractStepMessageMap000Builder](#abstractstepmessagemap000builder) | description(boolean value) | +| [AbstractStepMessageMap000Builder](#abstractstepmessagemap000builder) | description(String value) | +| [AbstractStepMessageMap000Builder](#abstractstepmessagemap000builder) | description(int value) | +| [AbstractStepMessageMap000Builder](#abstractstepmessagemap000builder) | description(float value) | +| [AbstractStepMessageMap000Builder](#abstractstepmessagemap000builder) | description(long value) | +| [AbstractStepMessageMap000Builder](#abstractstepmessagemap000builder) | description(double value) | +| [AbstractStepMessageMap000Builder](#abstractstepmessagemap000builder) | description(List value) | +| [AbstractStepMessageMap000Builder](#abstractstepmessagemap000builder) | description(Map value) | + +## AbstractStepMessageMap101Builder +public class AbstractStepMessageMap101Builder
+builder for `Map` + +A class that builds the Map input type + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| AbstractStepMessageMap101Builder(Map instance)
Creates a builder that contains the passed instance | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| [AbstractStepMessageMap001Builder](#abstractstepmessagemap001builder) | description(Nothing? value) | +| [AbstractStepMessageMap001Builder](#abstractstepmessagemap001builder) | description(boolean value) | +| [AbstractStepMessageMap001Builder](#abstractstepmessagemap001builder) | description(String value) | +| [AbstractStepMessageMap001Builder](#abstractstepmessagemap001builder) | description(int value) | +| [AbstractStepMessageMap001Builder](#abstractstepmessagemap001builder) | description(float value) | +| [AbstractStepMessageMap001Builder](#abstractstepmessagemap001builder) | description(long value) | +| [AbstractStepMessageMap001Builder](#abstractstepmessagemap001builder) | description(double value) | +| [AbstractStepMessageMap001Builder](#abstractstepmessagemap001builder) | description(List value) | +| [AbstractStepMessageMap001Builder](#abstractstepmessagemap001builder) | description(Map value) | +| [AbstractStepMessageMap100Builder](#abstractstepmessagemap100builder) | sequenceNumber(Nothing? value) | +| [AbstractStepMessageMap100Builder](#abstractstepmessagemap100builder) | sequenceNumber(boolean value) | +| [AbstractStepMessageMap100Builder](#abstractstepmessagemap100builder) | sequenceNumber(String value) | +| [AbstractStepMessageMap100Builder](#abstractstepmessagemap100builder) | sequenceNumber(int value) | +| [AbstractStepMessageMap100Builder](#abstractstepmessagemap100builder) | sequenceNumber(float value) | +| [AbstractStepMessageMap100Builder](#abstractstepmessagemap100builder) | sequenceNumber(long value) | +| [AbstractStepMessageMap100Builder](#abstractstepmessagemap100builder) | sequenceNumber(double value) | +| [AbstractStepMessageMap100Builder](#abstractstepmessagemap100builder) | sequenceNumber(List value) | +| [AbstractStepMessageMap100Builder](#abstractstepmessagemap100builder) | sequenceNumber(Map value) | + +## AbstractStepMessageMap110Builder +public class AbstractStepMessageMap110Builder
+builder for `Map` + +A class that builds the Map input type + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| AbstractStepMessageMap110Builder(Map instance)
Creates a builder that contains the passed instance | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| [AbstractStepMessageMap010Builder](#abstractstepmessagemap010builder) | description(Nothing? value) | +| [AbstractStepMessageMap010Builder](#abstractstepmessagemap010builder) | description(boolean value) | +| [AbstractStepMessageMap010Builder](#abstractstepmessagemap010builder) | description(String value) | +| [AbstractStepMessageMap010Builder](#abstractstepmessagemap010builder) | description(int value) | +| [AbstractStepMessageMap010Builder](#abstractstepmessagemap010builder) | description(float value) | +| [AbstractStepMessageMap010Builder](#abstractstepmessagemap010builder) | description(long value) | +| [AbstractStepMessageMap010Builder](#abstractstepmessagemap010builder) | description(double value) | +| [AbstractStepMessageMap010Builder](#abstractstepmessagemap010builder) | description(List value) | +| [AbstractStepMessageMap010Builder](#abstractstepmessagemap010builder) | description(Map value) | +| [AbstractStepMessageMap100Builder](#abstractstepmessagemap100builder) | discriminator(String value) | + +## AbstractStepMessageMapBuilder +public class AbstractStepMessageMapBuilder
+builder for `Map` + +A class that builds the Map input type + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| AbstractStepMessageMapBuilder()
Creates a builder that contains an empty map | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| [AbstractStepMessageMap011Builder](#abstractstepmessagemap011builder) | description(Nothing? value) | +| [AbstractStepMessageMap011Builder](#abstractstepmessagemap011builder) | description(boolean value) | +| [AbstractStepMessageMap011Builder](#abstractstepmessagemap011builder) | description(String value) | +| [AbstractStepMessageMap011Builder](#abstractstepmessagemap011builder) | description(int value) | +| [AbstractStepMessageMap011Builder](#abstractstepmessagemap011builder) | description(float value) | +| [AbstractStepMessageMap011Builder](#abstractstepmessagemap011builder) | description(long value) | +| [AbstractStepMessageMap011Builder](#abstractstepmessagemap011builder) | description(double value) | +| [AbstractStepMessageMap011Builder](#abstractstepmessagemap011builder) | description(List value) | +| [AbstractStepMessageMap011Builder](#abstractstepmessagemap011builder) | description(Map value) | +| [AbstractStepMessageMap101Builder](#abstractstepmessagemap101builder) | discriminator(String value) | +| [AbstractStepMessageMap110Builder](#abstractstepmessagemap110builder) | sequenceNumber(Nothing? value) | +| [AbstractStepMessageMap110Builder](#abstractstepmessagemap110builder) | sequenceNumber(boolean value) | +| [AbstractStepMessageMap110Builder](#abstractstepmessagemap110builder) | sequenceNumber(String value) | +| [AbstractStepMessageMap110Builder](#abstractstepmessagemap110builder) | sequenceNumber(int value) | +| [AbstractStepMessageMap110Builder](#abstractstepmessagemap110builder) | sequenceNumber(float value) | +| [AbstractStepMessageMap110Builder](#abstractstepmessagemap110builder) | sequenceNumber(long value) | +| [AbstractStepMessageMap110Builder](#abstractstepmessagemap110builder) | sequenceNumber(double value) | +| [AbstractStepMessageMap110Builder](#abstractstepmessagemap110builder) | sequenceNumber(List value) | +| [AbstractStepMessageMap110Builder](#abstractstepmessagemap110builder) | sequenceNumber(Map value) | + +## AbstractStepMessageMap +public static class AbstractStepMessageMap
+extends FrozenMap + +A class to store validated Map payloads + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| static [AbstractStepMessageMap](#abstractstepmessagemap) | of([Map](#abstractstepmessagemapbuilder) arg, SchemaConfiguration configuration) | +| @Nullable Object | description()
| +| String | discriminator()
| +| @Nullable Object | sequenceNumber()
| +| @Nullable Object | getAdditionalProperty(String name)
provides type safety for additional properties | + +## DiscriminatorBoxed +public sealed interface DiscriminatorBoxed
+permits
+[DiscriminatorBoxedString](#discriminatorboxedstring) + +sealed interface that stores validated payloads using boxed classes + +## DiscriminatorBoxedString +public record DiscriminatorBoxedString
+implements [DiscriminatorBoxed](#discriminatorboxed) + +record that stores validated String payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| DiscriminatorBoxedString(String data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| String | data()
validated payload | +| @Nullable Object | getData()
validated payload | + +## Discriminator +public static class Discriminator
+extends StringJsonSchema.StringJsonSchema1 + +A schema class that validates payloads + +| Methods Inherited from class org.openapijsonschematools.client.schemas.StringJsonSchema.StringJsonSchema1 | +| ------------------------------------------------------------------ | +| validate | +| validateAndBox | + +[[Back to top]](#top) [[Back to Component Schemas]](../../../README.md#Component-Schemas) [[Back to README]](../../../README.md) diff --git a/samples/client/petstore/kotlin/docs/components/schemas/AdditionalPropertiesClass.md b/samples/client/petstore/kotlin/docs/components/schemas/AdditionalPropertiesClass.md new file mode 100644 index 00000000000..e8854bd5205 --- /dev/null +++ b/samples/client/petstore/kotlin/docs/components/schemas/AdditionalPropertiesClass.md @@ -0,0 +1,1419 @@ +# AdditionalPropertiesClass +org.openapijsonschematools.client.components.schemas.AdditionalPropertiesClass.java +public class AdditionalPropertiesClass
+ +A class that contains necessary nested +- schema classes (which validate payloads), extends JsonSchema +- sealed interfaces which store validated payloads, java version of a sum type +- boxed classes which store validated payloads, sealed permits class implementations +- classes to store validated map payloads, extends FrozenMap +- classes to build inputs for map payloads + +## Nested Class Summary +| Modifier and Type | Class and Description | +| ----------------- | ---------------------- | +| sealed interface | [AdditionalPropertiesClass.AdditionalPropertiesClass1Boxed](#additionalpropertiesclass1boxed)
sealed interface for validated payloads | +| record | [AdditionalPropertiesClass.AdditionalPropertiesClass1BoxedMap](#additionalpropertiesclass1boxedmap)
boxed class to store validated Map payloads | +| static class | [AdditionalPropertiesClass.AdditionalPropertiesClass1](#additionalpropertiesclass1)
schema class | +| static class | [AdditionalPropertiesClass.AdditionalPropertiesClassMapBuilder](#additionalpropertiesclassmapbuilder)
builder for Map payloads | +| static class | [AdditionalPropertiesClass.AdditionalPropertiesClassMap](#additionalpropertiesclassmap)
output class for Map payloads | +| sealed interface | [AdditionalPropertiesClass.MapWithUndeclaredPropertiesStringBoxed](#mapwithundeclaredpropertiesstringboxed)
sealed interface for validated payloads | +| record | [AdditionalPropertiesClass.MapWithUndeclaredPropertiesStringBoxedMap](#mapwithundeclaredpropertiesstringboxedmap)
boxed class to store validated Map payloads | +| static class | [AdditionalPropertiesClass.MapWithUndeclaredPropertiesString](#mapwithundeclaredpropertiesstring)
schema class | +| static class | [AdditionalPropertiesClass.MapWithUndeclaredPropertiesStringMapBuilder](#mapwithundeclaredpropertiesstringmapbuilder)
builder for Map payloads | +| static class | [AdditionalPropertiesClass.MapWithUndeclaredPropertiesStringMap](#mapwithundeclaredpropertiesstringmap)
output class for Map payloads | +| sealed interface | [AdditionalPropertiesClass.AdditionalProperties5Boxed](#additionalproperties5boxed)
sealed interface for validated payloads | +| record | [AdditionalPropertiesClass.AdditionalProperties5BoxedString](#additionalproperties5boxedstring)
boxed class to store validated String payloads | +| static class | [AdditionalPropertiesClass.AdditionalProperties5](#additionalproperties5)
schema class | +| sealed interface | [AdditionalPropertiesClass.EmptyMapBoxed](#emptymapboxed)
sealed interface for validated payloads | +| record | [AdditionalPropertiesClass.EmptyMapBoxedMap](#emptymapboxedmap)
boxed class to store validated Map payloads | +| static class | [AdditionalPropertiesClass.EmptyMap](#emptymap)
schema class | +| static class | [AdditionalPropertiesClass.EmptyMapMapBuilder](#emptymapmapbuilder)
builder for Map payloads | +| static class | [AdditionalPropertiesClass.EmptyMapMap](#emptymapmap)
output class for Map payloads | +| sealed interface | [AdditionalPropertiesClass.AdditionalProperties4Boxed](#additionalproperties4boxed)
sealed interface for validated payloads | +| record | [AdditionalPropertiesClass.AdditionalProperties4BoxedVoid](#additionalproperties4boxedvoid)
boxed class to store validated null payloads | +| record | [AdditionalPropertiesClass.AdditionalProperties4BoxedBoolean](#additionalproperties4boxedboolean)
boxed class to store validated boolean payloads | +| record | [AdditionalPropertiesClass.AdditionalProperties4BoxedNumber](#additionalproperties4boxednumber)
boxed class to store validated Number payloads | +| record | [AdditionalPropertiesClass.AdditionalProperties4BoxedString](#additionalproperties4boxedstring)
boxed class to store validated String payloads | +| record | [AdditionalPropertiesClass.AdditionalProperties4BoxedList](#additionalproperties4boxedlist)
boxed class to store validated List payloads | +| record | [AdditionalPropertiesClass.AdditionalProperties4BoxedMap](#additionalproperties4boxedmap)
boxed class to store validated Map payloads | +| static class | [AdditionalPropertiesClass.AdditionalProperties4](#additionalproperties4)
schema class | +| sealed interface | [AdditionalPropertiesClass.MapWithUndeclaredPropertiesAnytype3Boxed](#mapwithundeclaredpropertiesanytype3boxed)
sealed interface for validated payloads | +| record | [AdditionalPropertiesClass.MapWithUndeclaredPropertiesAnytype3BoxedMap](#mapwithundeclaredpropertiesanytype3boxedmap)
boxed class to store validated Map payloads | +| static class | [AdditionalPropertiesClass.MapWithUndeclaredPropertiesAnytype3](#mapwithundeclaredpropertiesanytype3)
schema class | +| static class | [AdditionalPropertiesClass.MapWithUndeclaredPropertiesAnytype3MapBuilder](#mapwithundeclaredpropertiesanytype3mapbuilder)
builder for Map payloads | +| static class | [AdditionalPropertiesClass.MapWithUndeclaredPropertiesAnytype3Map](#mapwithundeclaredpropertiesanytype3map)
output class for Map payloads | +| sealed interface | [AdditionalPropertiesClass.AdditionalProperties3Boxed](#additionalproperties3boxed)
sealed interface for validated payloads | +| record | [AdditionalPropertiesClass.AdditionalProperties3BoxedVoid](#additionalproperties3boxedvoid)
boxed class to store validated null payloads | +| record | [AdditionalPropertiesClass.AdditionalProperties3BoxedBoolean](#additionalproperties3boxedboolean)
boxed class to store validated boolean payloads | +| record | [AdditionalPropertiesClass.AdditionalProperties3BoxedNumber](#additionalproperties3boxednumber)
boxed class to store validated Number payloads | +| record | [AdditionalPropertiesClass.AdditionalProperties3BoxedString](#additionalproperties3boxedstring)
boxed class to store validated String payloads | +| record | [AdditionalPropertiesClass.AdditionalProperties3BoxedList](#additionalproperties3boxedlist)
boxed class to store validated List payloads | +| record | [AdditionalPropertiesClass.AdditionalProperties3BoxedMap](#additionalproperties3boxedmap)
boxed class to store validated Map payloads | +| static class | [AdditionalPropertiesClass.AdditionalProperties3](#additionalproperties3)
schema class | +| sealed interface | [AdditionalPropertiesClass.MapWithUndeclaredPropertiesAnytype2Boxed](#mapwithundeclaredpropertiesanytype2boxed)
sealed interface for validated payloads | +| record | [AdditionalPropertiesClass.MapWithUndeclaredPropertiesAnytype2BoxedMap](#mapwithundeclaredpropertiesanytype2boxedmap)
boxed class to store validated Map payloads | +| static class | [AdditionalPropertiesClass.MapWithUndeclaredPropertiesAnytype2](#mapwithundeclaredpropertiesanytype2)
schema class | +| sealed interface | [AdditionalPropertiesClass.MapWithUndeclaredPropertiesAnytype1Boxed](#mapwithundeclaredpropertiesanytype1boxed)
sealed interface for validated payloads | +| record | [AdditionalPropertiesClass.MapWithUndeclaredPropertiesAnytype1BoxedMap](#mapwithundeclaredpropertiesanytype1boxedmap)
boxed class to store validated Map payloads | +| static class | [AdditionalPropertiesClass.MapWithUndeclaredPropertiesAnytype1](#mapwithundeclaredpropertiesanytype1)
schema class | +| sealed interface | [AdditionalPropertiesClass.Anytype1Boxed](#anytype1boxed)
sealed interface for validated payloads | +| record | [AdditionalPropertiesClass.Anytype1BoxedVoid](#anytype1boxedvoid)
boxed class to store validated null payloads | +| record | [AdditionalPropertiesClass.Anytype1BoxedBoolean](#anytype1boxedboolean)
boxed class to store validated boolean payloads | +| record | [AdditionalPropertiesClass.Anytype1BoxedNumber](#anytype1boxednumber)
boxed class to store validated Number payloads | +| record | [AdditionalPropertiesClass.Anytype1BoxedString](#anytype1boxedstring)
boxed class to store validated String payloads | +| record | [AdditionalPropertiesClass.Anytype1BoxedList](#anytype1boxedlist)
boxed class to store validated List payloads | +| record | [AdditionalPropertiesClass.Anytype1BoxedMap](#anytype1boxedmap)
boxed class to store validated Map payloads | +| static class | [AdditionalPropertiesClass.Anytype1](#anytype1)
schema class | +| sealed interface | [AdditionalPropertiesClass.MapOfMapPropertyBoxed](#mapofmappropertyboxed)
sealed interface for validated payloads | +| record | [AdditionalPropertiesClass.MapOfMapPropertyBoxedMap](#mapofmappropertyboxedmap)
boxed class to store validated Map payloads | +| static class | [AdditionalPropertiesClass.MapOfMapProperty](#mapofmapproperty)
schema class | +| static class | [AdditionalPropertiesClass.MapOfMapPropertyMapBuilder](#mapofmappropertymapbuilder)
builder for Map payloads | +| static class | [AdditionalPropertiesClass.MapOfMapPropertyMap](#mapofmappropertymap)
output class for Map payloads | +| sealed interface | [AdditionalPropertiesClass.AdditionalProperties1Boxed](#additionalproperties1boxed)
sealed interface for validated payloads | +| record | [AdditionalPropertiesClass.AdditionalProperties1BoxedMap](#additionalproperties1boxedmap)
boxed class to store validated Map payloads | +| static class | [AdditionalPropertiesClass.AdditionalProperties1](#additionalproperties1)
schema class | +| static class | [AdditionalPropertiesClass.AdditionalPropertiesMapBuilder2](#additionalpropertiesmapbuilder2)
builder for Map payloads | +| static class | [AdditionalPropertiesClass.AdditionalPropertiesMap](#additionalpropertiesmap)
output class for Map payloads | +| sealed interface | [AdditionalPropertiesClass.AdditionalProperties2Boxed](#additionalproperties2boxed)
sealed interface for validated payloads | +| record | [AdditionalPropertiesClass.AdditionalProperties2BoxedString](#additionalproperties2boxedstring)
boxed class to store validated String payloads | +| static class | [AdditionalPropertiesClass.AdditionalProperties2](#additionalproperties2)
schema class | +| sealed interface | [AdditionalPropertiesClass.MapPropertyBoxed](#mappropertyboxed)
sealed interface for validated payloads | +| record | [AdditionalPropertiesClass.MapPropertyBoxedMap](#mappropertyboxedmap)
boxed class to store validated Map payloads | +| static class | [AdditionalPropertiesClass.MapProperty](#mapproperty)
schema class | +| static class | [AdditionalPropertiesClass.MapPropertyMapBuilder](#mappropertymapbuilder)
builder for Map payloads | +| static class | [AdditionalPropertiesClass.MapPropertyMap](#mappropertymap)
output class for Map payloads | +| sealed interface | [AdditionalPropertiesClass.AdditionalPropertiesBoxed](#additionalpropertiesboxed)
sealed interface for validated payloads | +| record | [AdditionalPropertiesClass.AdditionalPropertiesBoxedString](#additionalpropertiesboxedstring)
boxed class to store validated String payloads | +| static class | [AdditionalPropertiesClass.AdditionalProperties](#additionalproperties)
schema class | + +## AdditionalPropertiesClass1Boxed +public sealed interface AdditionalPropertiesClass1Boxed
+permits
+[AdditionalPropertiesClass1BoxedMap](#additionalpropertiesclass1boxedmap) + +sealed interface that stores validated payloads using boxed classes + +## AdditionalPropertiesClass1BoxedMap +public record AdditionalPropertiesClass1BoxedMap
+implements [AdditionalPropertiesClass1Boxed](#additionalpropertiesclass1boxed) + +record that stores validated Map payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| AdditionalPropertiesClass1BoxedMap([AdditionalPropertiesClassMap](#additionalpropertiesclassmap) data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| [AdditionalPropertiesClassMap](#additionalpropertiesclassmap) | data()
validated payload | +| @Nullable Object | getData()
validated payload | + +## AdditionalPropertiesClass1 +public static class AdditionalPropertiesClass1
+extends JsonSchema + +A schema class that validates payloads + +### Code Sample +``` +import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags; +import org.openapijsonschematools.client.configurations.SchemaConfiguration; +import org.openapijsonschematools.client.exceptions.ValidationException; +import org.openapijsonschematools.client.schemas.validation.MapUtils; +import org.openapijsonschematools.client.schemas.validation.FrozenList; +import org.openapijsonschematools.client.schemas.validation.FrozenMap; +import org.openapijsonschematools.client.components.schemas.AdditionalPropertiesClass; + +import java.util.Arrays; +import java.util.List; +import java.util.AbstractMap; + +static final SchemaConfiguration configuration = new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().build()); + +// Map validation +AdditionalPropertiesClass.AdditionalPropertiesClassMap validatedPayload = + AdditionalPropertiesClass.AdditionalPropertiesClass1.validate( + new AdditionalPropertiesClass.AdditionalPropertiesClassMapBuilder() + .map_property( + MapUtils.makeMap( + new AbstractMap.SimpleEntry( + "someAdditionalProperty", + "a" + ) + ) + ) + .map_of_map_property( + MapUtils.makeMap( + new AbstractMap.SimpleEntry>( + "someAdditionalProperty", + MapUtils.makeMap( + new AbstractMap.SimpleEntry( + "someAdditionalProperty", + "a" + ) + ) + ) + ) + ) + .map_with_undeclared_properties_anytype_3( + MapUtils.makeMap( + ) + ) + .empty_map( + MapUtils.makeMap( + ) + ) + .map_with_undeclared_properties_string( + MapUtils.makeMap( + new AbstractMap.SimpleEntry( + "someAdditionalProperty", + "a" + ) + ) + ) + .build(), + configuration +); +``` + +### Field Summary +| Modifier and Type | Field and Description | +| ----------------- | ---------------------- | +| Set> | type = Set.of(Map.class) | +| Map> | properties = Map.ofEntries(
    new PropertyEntry("map_property", [MapProperty.class](#mapproperty))),
    new PropertyEntry("map_of_map_property", [MapOfMapProperty.class](#mapofmapproperty))),
    new PropertyEntry("anytype_1", [Anytype1.class](#anytype1))),
    new PropertyEntry("map_with_undeclared_properties_anytype_1", [MapWithUndeclaredPropertiesAnytype1.class](#mapwithundeclaredpropertiesanytype1))),
    new PropertyEntry("map_with_undeclared_properties_anytype_2", [MapWithUndeclaredPropertiesAnytype2.class](#mapwithundeclaredpropertiesanytype2))),
    new PropertyEntry("map_with_undeclared_properties_anytype_3", [MapWithUndeclaredPropertiesAnytype3.class](#mapwithundeclaredpropertiesanytype3))),
    new PropertyEntry("empty_map", [EmptyMap.class](#emptymap))),
    new PropertyEntry("map_with_undeclared_properties_string", [MapWithUndeclaredPropertiesString.class](#mapwithundeclaredpropertiesstring)))
)
| + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| [AdditionalPropertiesClassMap](#additionalpropertiesclassmap) | validate([Map<?, ?>](#additionalpropertiesclassmapbuilder) arg, SchemaConfiguration configuration) | +| [AdditionalPropertiesClass1BoxedMap](#additionalpropertiesclass1boxedmap) | validateAndBox([Map<?, ?>](#additionalpropertiesclassmapbuilder) arg, SchemaConfiguration configuration) | +| [AdditionalPropertiesClass1Boxed](#additionalpropertiesclass1boxed) | validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) | +| @Nullable Object | validate(@Nullable Object arg, SchemaConfiguration configuration) | + +## AdditionalPropertiesClassMapBuilder +public class AdditionalPropertiesClassMapBuilder
+builder for `Map` + +A class that builds the Map input type + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| AdditionalPropertiesClassMapBuilder()
Creates a builder that contains an empty map | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| Map | build()
Returns map input that should be used with Schema.validate | +| [AdditionalPropertiesClassMapBuilder](#additionalpropertiesclassmapbuilder) | map_property(Map value) | +| [AdditionalPropertiesClassMapBuilder](#additionalpropertiesclassmapbuilder) | map_of_map_property(Map> value) | +| [AdditionalPropertiesClassMapBuilder](#additionalpropertiesclassmapbuilder) | anytype_1(Nothing? value) | +| [AdditionalPropertiesClassMapBuilder](#additionalpropertiesclassmapbuilder) | anytype_1(boolean value) | +| [AdditionalPropertiesClassMapBuilder](#additionalpropertiesclassmapbuilder) | anytype_1(String value) | +| [AdditionalPropertiesClassMapBuilder](#additionalpropertiesclassmapbuilder) | anytype_1(int value) | +| [AdditionalPropertiesClassMapBuilder](#additionalpropertiesclassmapbuilder) | anytype_1(float value) | +| [AdditionalPropertiesClassMapBuilder](#additionalpropertiesclassmapbuilder) | anytype_1(long value) | +| [AdditionalPropertiesClassMapBuilder](#additionalpropertiesclassmapbuilder) | anytype_1(double value) | +| [AdditionalPropertiesClassMapBuilder](#additionalpropertiesclassmapbuilder) | anytype_1(List value) | +| [AdditionalPropertiesClassMapBuilder](#additionalpropertiesclassmapbuilder) | anytype_1(Map value) | +| [AdditionalPropertiesClassMapBuilder](#additionalpropertiesclassmapbuilder) | map_with_undeclared_properties_anytype_1(Map value) | +| [AdditionalPropertiesClassMapBuilder](#additionalpropertiesclassmapbuilder) | map_with_undeclared_properties_anytype_2(Map value) | +| [AdditionalPropertiesClassMapBuilder](#additionalpropertiesclassmapbuilder) | map_with_undeclared_properties_anytype_3(Map value) | +| [AdditionalPropertiesClassMapBuilder](#additionalpropertiesclassmapbuilder) | empty_map(Map value) | +| [AdditionalPropertiesClassMapBuilder](#additionalpropertiesclassmapbuilder) | map_with_undeclared_properties_string(Map value) | +| [AdditionalPropertiesClassMapBuilder](#additionalpropertiesclassmapbuilder) | additionalProperty(String key, Nothing? value) | +| [AdditionalPropertiesClassMapBuilder](#additionalpropertiesclassmapbuilder) | additionalProperty(String key, boolean value) | +| [AdditionalPropertiesClassMapBuilder](#additionalpropertiesclassmapbuilder) | additionalProperty(String key, String value) | +| [AdditionalPropertiesClassMapBuilder](#additionalpropertiesclassmapbuilder) | additionalProperty(String key, int value) | +| [AdditionalPropertiesClassMapBuilder](#additionalpropertiesclassmapbuilder) | additionalProperty(String key, float value) | +| [AdditionalPropertiesClassMapBuilder](#additionalpropertiesclassmapbuilder) | additionalProperty(String key, long value) | +| [AdditionalPropertiesClassMapBuilder](#additionalpropertiesclassmapbuilder) | additionalProperty(String key, double value) | +| [AdditionalPropertiesClassMapBuilder](#additionalpropertiesclassmapbuilder) | additionalProperty(String key, List value) | +| [AdditionalPropertiesClassMapBuilder](#additionalpropertiesclassmapbuilder) | additionalProperty(String key, Map value) | + +## AdditionalPropertiesClassMap +public static class AdditionalPropertiesClassMap
+extends FrozenMap + +A class to store validated Map payloads + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| static [AdditionalPropertiesClassMap](#additionalpropertiesclassmap) | of([Map](#additionalpropertiesclassmapbuilder) arg, SchemaConfiguration configuration) | +| [MapPropertyMap](#mappropertymap) | map_property()
[optional] | +| [MapOfMapPropertyMap](#mapofmappropertymap) | map_of_map_property()
[optional] | +| @Nullable Object | anytype_1()
[optional] | +| FrozenMap | map_with_undeclared_properties_anytype_1()
[optional] | +| FrozenMap | map_with_undeclared_properties_anytype_2()
[optional] | +| [MapWithUndeclaredPropertiesAnytype3Map](#mapwithundeclaredpropertiesanytype3map) | map_with_undeclared_properties_anytype_3()
[optional] | +| [EmptyMapMap](#emptymapmap) | empty_map()
[optional] | +| [MapWithUndeclaredPropertiesStringMap](#mapwithundeclaredpropertiesstringmap) | map_with_undeclared_properties_string()
[optional] | +| @Nullable Object | getAdditionalProperty(String name)
provides type safety for additional properties | + +## MapWithUndeclaredPropertiesStringBoxed +public sealed interface MapWithUndeclaredPropertiesStringBoxed
+permits
+[MapWithUndeclaredPropertiesStringBoxedMap](#mapwithundeclaredpropertiesstringboxedmap) + +sealed interface that stores validated payloads using boxed classes + +## MapWithUndeclaredPropertiesStringBoxedMap +public record MapWithUndeclaredPropertiesStringBoxedMap
+implements [MapWithUndeclaredPropertiesStringBoxed](#mapwithundeclaredpropertiesstringboxed) + +record that stores validated Map payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| MapWithUndeclaredPropertiesStringBoxedMap([MapWithUndeclaredPropertiesStringMap](#mapwithundeclaredpropertiesstringmap) data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| [MapWithUndeclaredPropertiesStringMap](#mapwithundeclaredpropertiesstringmap) | data()
validated payload | +| @Nullable Object | getData()
validated payload | + +## MapWithUndeclaredPropertiesString +public static class MapWithUndeclaredPropertiesString
+extends JsonSchema + +A schema class that validates payloads + +### Code Sample +``` +import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags; +import org.openapijsonschematools.client.configurations.SchemaConfiguration; +import org.openapijsonschematools.client.exceptions.ValidationException; +import org.openapijsonschematools.client.schemas.validation.MapUtils; +import org.openapijsonschematools.client.schemas.validation.FrozenList; +import org.openapijsonschematools.client.schemas.validation.FrozenMap; +import org.openapijsonschematools.client.components.schemas.AdditionalPropertiesClass; + +import java.util.Arrays; +import java.util.List; +import java.util.AbstractMap; + +static final SchemaConfiguration configuration = new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().build()); + +// Map validation +AdditionalPropertiesClass.MapWithUndeclaredPropertiesStringMap validatedPayload = + AdditionalPropertiesClass.MapWithUndeclaredPropertiesString.validate( + new AdditionalPropertiesClass.MapWithUndeclaredPropertiesStringMapBuilder() + .additionalProperty("someAdditionalProperty", "a") + + .build(), + configuration +); +``` + +### Field Summary +| Modifier and Type | Field and Description | +| ----------------- | ---------------------- | +| Set> | type = Set.of(Map.class) | +| Class | additionalProperties = [AdditionalProperties5.class](#additionalproperties5) | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| [MapWithUndeclaredPropertiesStringMap](#mapwithundeclaredpropertiesstringmap) | validate([Map<?, ?>](#mapwithundeclaredpropertiesstringmapbuilder) arg, SchemaConfiguration configuration) | +| [MapWithUndeclaredPropertiesStringBoxedMap](#mapwithundeclaredpropertiesstringboxedmap) | validateAndBox([Map<?, ?>](#mapwithundeclaredpropertiesstringmapbuilder) arg, SchemaConfiguration configuration) | +| [MapWithUndeclaredPropertiesStringBoxed](#mapwithundeclaredpropertiesstringboxed) | validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) | +| @Nullable Object | validate(@Nullable Object arg, SchemaConfiguration configuration) | + +## MapWithUndeclaredPropertiesStringMapBuilder +public class MapWithUndeclaredPropertiesStringMapBuilder
+builder for `Map` + +A class that builds the Map input type + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| MapWithUndeclaredPropertiesStringMapBuilder()
Creates a builder that contains an empty map | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| Map | build()
Returns map input that should be used with Schema.validate | +| [MapWithUndeclaredPropertiesStringMapBuilder](#mapwithundeclaredpropertiesstringmapbuilder) | additionalProperty(String key, String value) | + +## MapWithUndeclaredPropertiesStringMap +public static class MapWithUndeclaredPropertiesStringMap
+extends FrozenMap + +A class to store validated Map payloads + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| static [MapWithUndeclaredPropertiesStringMap](#mapwithundeclaredpropertiesstringmap) | of([Map](#mapwithundeclaredpropertiesstringmapbuilder) arg, SchemaConfiguration configuration) | +| String | getAdditionalProperty(String name)
provides type safety for additional properties | + +## AdditionalProperties5Boxed +public sealed interface AdditionalProperties5Boxed
+permits
+[AdditionalProperties5BoxedString](#additionalproperties5boxedstring) + +sealed interface that stores validated payloads using boxed classes + +## AdditionalProperties5BoxedString +public record AdditionalProperties5BoxedString
+implements [AdditionalProperties5Boxed](#additionalproperties5boxed) + +record that stores validated String payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| AdditionalProperties5BoxedString(String data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| String | data()
validated payload | +| @Nullable Object | getData()
validated payload | + +## AdditionalProperties5 +public static class AdditionalProperties5
+extends StringJsonSchema.StringJsonSchema1 + +A schema class that validates payloads + +| Methods Inherited from class org.openapijsonschematools.client.schemas.StringJsonSchema.StringJsonSchema1 | +| ------------------------------------------------------------------ | +| validate | +| validateAndBox | + +## EmptyMapBoxed +public sealed interface EmptyMapBoxed
+permits
+[EmptyMapBoxedMap](#emptymapboxedmap) + +sealed interface that stores validated payloads using boxed classes + +## EmptyMapBoxedMap +public record EmptyMapBoxedMap
+implements [EmptyMapBoxed](#emptymapboxed) + +record that stores validated Map payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| EmptyMapBoxedMap([EmptyMapMap](#emptymapmap) data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| [EmptyMapMap](#emptymapmap) | data()
validated payload | +| @Nullable Object | getData()
validated payload | + +## EmptyMap +public static class EmptyMap
+extends JsonSchema + +A schema class that validates payloads + +## Description +an object with no declared properties and no undeclared properties, hence it's an empty map. + +### Code Sample +``` +import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags; +import org.openapijsonschematools.client.configurations.SchemaConfiguration; +import org.openapijsonschematools.client.exceptions.ValidationException; +import org.openapijsonschematools.client.schemas.validation.MapUtils; +import org.openapijsonschematools.client.schemas.validation.FrozenList; +import org.openapijsonschematools.client.schemas.validation.FrozenMap; +import org.openapijsonschematools.client.components.schemas.AdditionalPropertiesClass; + +import java.util.Arrays; +import java.util.List; +import java.util.AbstractMap; + +static final SchemaConfiguration configuration = new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().build()); + +// Map validation +AdditionalPropertiesClass.EmptyMapMap validatedPayload = + AdditionalPropertiesClass.EmptyMap.validate( + new AdditionalPropertiesClass.EmptyMapMapBuilder() + .build(), + configuration +); +``` + +### Field Summary +| Modifier and Type | Field and Description | +| ----------------- | ---------------------- | +| Set> | type = Set.of(Map.class) | +| Class | additionalProperties = [AdditionalProperties4.class](#additionalproperties4) | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| [EmptyMapMap](#emptymapmap) | validate([Map<?, ?>](#emptymapmapbuilder) arg, SchemaConfiguration configuration) | +| [EmptyMapBoxedMap](#emptymapboxedmap) | validateAndBox([Map<?, ?>](#emptymapmapbuilder) arg, SchemaConfiguration configuration) | +| [EmptyMapBoxed](#emptymapboxed) | validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) | +| @Nullable Object | validate(@Nullable Object arg, SchemaConfiguration configuration) | + +## EmptyMapMapBuilder +public class EmptyMapMapBuilder
+builder for `Map` + +A class that builds the Map input type + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| EmptyMapMapBuilder()
Creates a builder that contains an empty map | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| Map | build()
Returns map input that should be used with Schema.validate | + +## EmptyMapMap +public static class EmptyMapMap
+extends FrozenMap + +A class to store validated Map payloads + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| static [EmptyMapMap](#emptymapmap) | of([Map](#emptymapmapbuilder) arg, SchemaConfiguration configuration) | + +## AdditionalProperties4Boxed +public sealed interface AdditionalProperties4Boxed
+permits
+[AdditionalProperties4BoxedVoid](#additionalproperties4boxedvoid), +[AdditionalProperties4BoxedBoolean](#additionalproperties4boxedboolean), +[AdditionalProperties4BoxedNumber](#additionalproperties4boxednumber), +[AdditionalProperties4BoxedString](#additionalproperties4boxedstring), +[AdditionalProperties4BoxedList](#additionalproperties4boxedlist), +[AdditionalProperties4BoxedMap](#additionalproperties4boxedmap) + +sealed interface that stores validated payloads using boxed classes + +## AdditionalProperties4BoxedVoid +public record AdditionalProperties4BoxedVoid
+implements [AdditionalProperties4Boxed](#additionalproperties4boxed) + +record that stores validated null payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| AdditionalProperties4BoxedVoid(Nothing? data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| Nothing? | data()
validated payload | +| @Nullable Object | getData()
validated payload | + +## AdditionalProperties4BoxedBoolean +public record AdditionalProperties4BoxedBoolean
+implements [AdditionalProperties4Boxed](#additionalproperties4boxed) + +record that stores validated boolean payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| AdditionalProperties4BoxedBoolean(boolean data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| boolean | data()
validated payload | +| @Nullable Object | getData()
validated payload | + +## AdditionalProperties4BoxedNumber +public record AdditionalProperties4BoxedNumber
+implements [AdditionalProperties4Boxed](#additionalproperties4boxed) + +record that stores validated Number payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| AdditionalProperties4BoxedNumber(Number data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| Number | data()
validated payload | +| @Nullable Object | getData()
validated payload | + +## AdditionalProperties4BoxedString +public record AdditionalProperties4BoxedString
+implements [AdditionalProperties4Boxed](#additionalproperties4boxed) + +record that stores validated String payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| AdditionalProperties4BoxedString(String data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| String | data()
validated payload | +| @Nullable Object | getData()
validated payload | + +## AdditionalProperties4BoxedList +public record AdditionalProperties4BoxedList
+implements [AdditionalProperties4Boxed](#additionalproperties4boxed) + +record that stores validated List payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| AdditionalProperties4BoxedList(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 | + +## AdditionalProperties4BoxedMap +public record AdditionalProperties4BoxedMap
+implements [AdditionalProperties4Boxed](#additionalproperties4boxed) + +record that stores validated Map payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| AdditionalProperties4BoxedMap(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 | + +## AdditionalProperties4 +public static class AdditionalProperties4
+extends NotAnyTypeJsonSchema.NotAnyTypeJsonSchema1 + +A schema class that validates payloads + +| Methods Inherited from class org.openapijsonschematools.client.schemas.NotAnyTypeJsonSchema.NotAnyTypeJsonSchema1 | +| ------------------------------------------------------------------ | +| validate | +| validateAndBox | + +## MapWithUndeclaredPropertiesAnytype3Boxed +public sealed interface MapWithUndeclaredPropertiesAnytype3Boxed
+permits
+[MapWithUndeclaredPropertiesAnytype3BoxedMap](#mapwithundeclaredpropertiesanytype3boxedmap) + +sealed interface that stores validated payloads using boxed classes + +## MapWithUndeclaredPropertiesAnytype3BoxedMap +public record MapWithUndeclaredPropertiesAnytype3BoxedMap
+implements [MapWithUndeclaredPropertiesAnytype3Boxed](#mapwithundeclaredpropertiesanytype3boxed) + +record that stores validated Map payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| MapWithUndeclaredPropertiesAnytype3BoxedMap([MapWithUndeclaredPropertiesAnytype3Map](#mapwithundeclaredpropertiesanytype3map) data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| [MapWithUndeclaredPropertiesAnytype3Map](#mapwithundeclaredpropertiesanytype3map) | data()
validated payload | +| @Nullable Object | getData()
validated payload | + +## MapWithUndeclaredPropertiesAnytype3 +public static class MapWithUndeclaredPropertiesAnytype3
+extends JsonSchema + +A schema class that validates payloads + +### Code Sample +``` +import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags; +import org.openapijsonschematools.client.configurations.SchemaConfiguration; +import org.openapijsonschematools.client.exceptions.ValidationException; +import org.openapijsonschematools.client.schemas.validation.MapUtils; +import org.openapijsonschematools.client.schemas.validation.FrozenList; +import org.openapijsonschematools.client.schemas.validation.FrozenMap; +import org.openapijsonschematools.client.components.schemas.AdditionalPropertiesClass; + +import java.util.Arrays; +import java.util.List; +import java.util.AbstractMap; + +static final SchemaConfiguration configuration = new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().build()); + +// Map validation +AdditionalPropertiesClass.MapWithUndeclaredPropertiesAnytype3Map validatedPayload = + AdditionalPropertiesClass.MapWithUndeclaredPropertiesAnytype3.validate( + new AdditionalPropertiesClass.MapWithUndeclaredPropertiesAnytype3MapBuilder() + .build(), + configuration +); +``` + +### Field Summary +| Modifier and Type | Field and Description | +| ----------------- | ---------------------- | +| Set> | type = Set.of(Map.class) | +| Class | additionalProperties = [AdditionalProperties3.class](#additionalproperties3) | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| [MapWithUndeclaredPropertiesAnytype3Map](#mapwithundeclaredpropertiesanytype3map) | validate([Map<?, ?>](#mapwithundeclaredpropertiesanytype3mapbuilder) arg, SchemaConfiguration configuration) | +| [MapWithUndeclaredPropertiesAnytype3BoxedMap](#mapwithundeclaredpropertiesanytype3boxedmap) | validateAndBox([Map<?, ?>](#mapwithundeclaredpropertiesanytype3mapbuilder) arg, SchemaConfiguration configuration) | +| [MapWithUndeclaredPropertiesAnytype3Boxed](#mapwithundeclaredpropertiesanytype3boxed) | validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) | +| @Nullable Object | validate(@Nullable Object arg, SchemaConfiguration configuration) | + +## MapWithUndeclaredPropertiesAnytype3MapBuilder +public class MapWithUndeclaredPropertiesAnytype3MapBuilder
+builder for `Map` + +A class that builds the Map input type + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| MapWithUndeclaredPropertiesAnytype3MapBuilder()
Creates a builder that contains an empty map | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| Map | build()
Returns map input that should be used with Schema.validate | +| [MapWithUndeclaredPropertiesAnytype3MapBuilder](#mapwithundeclaredpropertiesanytype3mapbuilder) | additionalProperty(String key, Nothing? value) | +| [MapWithUndeclaredPropertiesAnytype3MapBuilder](#mapwithundeclaredpropertiesanytype3mapbuilder) | additionalProperty(String key, boolean value) | +| [MapWithUndeclaredPropertiesAnytype3MapBuilder](#mapwithundeclaredpropertiesanytype3mapbuilder) | additionalProperty(String key, String value) | +| [MapWithUndeclaredPropertiesAnytype3MapBuilder](#mapwithundeclaredpropertiesanytype3mapbuilder) | additionalProperty(String key, int value) | +| [MapWithUndeclaredPropertiesAnytype3MapBuilder](#mapwithundeclaredpropertiesanytype3mapbuilder) | additionalProperty(String key, float value) | +| [MapWithUndeclaredPropertiesAnytype3MapBuilder](#mapwithundeclaredpropertiesanytype3mapbuilder) | additionalProperty(String key, long value) | +| [MapWithUndeclaredPropertiesAnytype3MapBuilder](#mapwithundeclaredpropertiesanytype3mapbuilder) | additionalProperty(String key, double value) | +| [MapWithUndeclaredPropertiesAnytype3MapBuilder](#mapwithundeclaredpropertiesanytype3mapbuilder) | additionalProperty(String key, List value) | +| [MapWithUndeclaredPropertiesAnytype3MapBuilder](#mapwithundeclaredpropertiesanytype3mapbuilder) | additionalProperty(String key, Map value) | + +## MapWithUndeclaredPropertiesAnytype3Map +public static class MapWithUndeclaredPropertiesAnytype3Map
+extends FrozenMap + +A class to store validated Map payloads + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| static [MapWithUndeclaredPropertiesAnytype3Map](#mapwithundeclaredpropertiesanytype3map) | of([Map](#mapwithundeclaredpropertiesanytype3mapbuilder) arg, SchemaConfiguration configuration) | +| @Nullable Object | getAdditionalProperty(String name)
provides type safety for additional properties | + +## AdditionalProperties3Boxed +public sealed interface AdditionalProperties3Boxed
+permits
+[AdditionalProperties3BoxedVoid](#additionalproperties3boxedvoid), +[AdditionalProperties3BoxedBoolean](#additionalproperties3boxedboolean), +[AdditionalProperties3BoxedNumber](#additionalproperties3boxednumber), +[AdditionalProperties3BoxedString](#additionalproperties3boxedstring), +[AdditionalProperties3BoxedList](#additionalproperties3boxedlist), +[AdditionalProperties3BoxedMap](#additionalproperties3boxedmap) + +sealed interface that stores validated payloads using boxed classes + +## AdditionalProperties3BoxedVoid +public record AdditionalProperties3BoxedVoid
+implements [AdditionalProperties3Boxed](#additionalproperties3boxed) + +record that stores validated null payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| AdditionalProperties3BoxedVoid(Nothing? data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| Nothing? | data()
validated payload | +| @Nullable Object | getData()
validated payload | + +## AdditionalProperties3BoxedBoolean +public record AdditionalProperties3BoxedBoolean
+implements [AdditionalProperties3Boxed](#additionalproperties3boxed) + +record that stores validated boolean payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| AdditionalProperties3BoxedBoolean(boolean data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| boolean | data()
validated payload | +| @Nullable Object | getData()
validated payload | + +## AdditionalProperties3BoxedNumber +public record AdditionalProperties3BoxedNumber
+implements [AdditionalProperties3Boxed](#additionalproperties3boxed) + +record that stores validated Number payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| AdditionalProperties3BoxedNumber(Number data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| Number | data()
validated payload | +| @Nullable Object | getData()
validated payload | + +## AdditionalProperties3BoxedString +public record AdditionalProperties3BoxedString
+implements [AdditionalProperties3Boxed](#additionalproperties3boxed) + +record that stores validated String payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| AdditionalProperties3BoxedString(String data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| String | data()
validated payload | +| @Nullable Object | getData()
validated payload | + +## AdditionalProperties3BoxedList +public record AdditionalProperties3BoxedList
+implements [AdditionalProperties3Boxed](#additionalproperties3boxed) + +record that stores validated List payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| AdditionalProperties3BoxedList(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 | + +## AdditionalProperties3BoxedMap +public record AdditionalProperties3BoxedMap
+implements [AdditionalProperties3Boxed](#additionalproperties3boxed) + +record that stores validated Map payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| AdditionalProperties3BoxedMap(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 | + +## AdditionalProperties3 +public static class AdditionalProperties3
+extends AnyTypeJsonSchema.AnyTypeJsonSchema1 + +A schema class that validates payloads + +| Methods Inherited from class org.openapijsonschematools.client.schemas.AnyTypeJsonSchema.AnyTypeJsonSchema1 | +| ------------------------------------------------------------------ | +| validate | +| validateAndBox | + +## MapWithUndeclaredPropertiesAnytype2Boxed +public sealed interface MapWithUndeclaredPropertiesAnytype2Boxed
+permits
+[MapWithUndeclaredPropertiesAnytype2BoxedMap](#mapwithundeclaredpropertiesanytype2boxedmap) + +sealed interface that stores validated payloads using boxed classes + +## MapWithUndeclaredPropertiesAnytype2BoxedMap +public record MapWithUndeclaredPropertiesAnytype2BoxedMap
+implements [MapWithUndeclaredPropertiesAnytype2Boxed](#mapwithundeclaredpropertiesanytype2boxed) + +record that stores validated Map payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| MapWithUndeclaredPropertiesAnytype2BoxedMap(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 | + +## MapWithUndeclaredPropertiesAnytype2 +public static class MapWithUndeclaredPropertiesAnytype2
+extends MapJsonSchema.MapJsonSchema1 + +A schema class that validates payloads + +| Methods Inherited from class org.openapijsonschematools.client.schemas.MapJsonSchema.MapJsonSchema1 | +| ------------------------------------------------------------------ | +| validate | +| validateAndBox | + +## MapWithUndeclaredPropertiesAnytype1Boxed +public sealed interface MapWithUndeclaredPropertiesAnytype1Boxed
+permits
+[MapWithUndeclaredPropertiesAnytype1BoxedMap](#mapwithundeclaredpropertiesanytype1boxedmap) + +sealed interface that stores validated payloads using boxed classes + +## MapWithUndeclaredPropertiesAnytype1BoxedMap +public record MapWithUndeclaredPropertiesAnytype1BoxedMap
+implements [MapWithUndeclaredPropertiesAnytype1Boxed](#mapwithundeclaredpropertiesanytype1boxed) + +record that stores validated Map payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| MapWithUndeclaredPropertiesAnytype1BoxedMap(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 | + +## MapWithUndeclaredPropertiesAnytype1 +public static class MapWithUndeclaredPropertiesAnytype1
+extends MapJsonSchema.MapJsonSchema1 + +A schema class that validates payloads + +| Methods Inherited from class org.openapijsonschematools.client.schemas.MapJsonSchema.MapJsonSchema1 | +| ------------------------------------------------------------------ | +| validate | +| validateAndBox | + +## Anytype1Boxed +public sealed interface Anytype1Boxed
+permits
+[Anytype1BoxedVoid](#anytype1boxedvoid), +[Anytype1BoxedBoolean](#anytype1boxedboolean), +[Anytype1BoxedNumber](#anytype1boxednumber), +[Anytype1BoxedString](#anytype1boxedstring), +[Anytype1BoxedList](#anytype1boxedlist), +[Anytype1BoxedMap](#anytype1boxedmap) + +sealed interface that stores validated payloads using boxed classes + +## Anytype1BoxedVoid +public record Anytype1BoxedVoid
+implements [Anytype1Boxed](#anytype1boxed) + +record that stores validated null payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| Anytype1BoxedVoid(Nothing? data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| Nothing? | data()
validated payload | +| @Nullable Object | getData()
validated payload | + +## Anytype1BoxedBoolean +public record Anytype1BoxedBoolean
+implements [Anytype1Boxed](#anytype1boxed) + +record that stores validated boolean payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| Anytype1BoxedBoolean(boolean data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| boolean | data()
validated payload | +| @Nullable Object | getData()
validated payload | + +## Anytype1BoxedNumber +public record Anytype1BoxedNumber
+implements [Anytype1Boxed](#anytype1boxed) + +record that stores validated Number payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| Anytype1BoxedNumber(Number data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| Number | data()
validated payload | +| @Nullable Object | getData()
validated payload | + +## Anytype1BoxedString +public record Anytype1BoxedString
+implements [Anytype1Boxed](#anytype1boxed) + +record that stores validated String payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| Anytype1BoxedString(String data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| String | data()
validated payload | +| @Nullable Object | getData()
validated payload | + +## Anytype1BoxedList +public record Anytype1BoxedList
+implements [Anytype1Boxed](#anytype1boxed) + +record that stores validated List payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| Anytype1BoxedList(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 | + +## Anytype1BoxedMap +public record Anytype1BoxedMap
+implements [Anytype1Boxed](#anytype1boxed) + +record that stores validated Map payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| Anytype1BoxedMap(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 | + +## Anytype1 +public static class Anytype1
+extends AnyTypeJsonSchema.AnyTypeJsonSchema1 + +A schema class that validates payloads + +| Methods Inherited from class org.openapijsonschematools.client.schemas.AnyTypeJsonSchema.AnyTypeJsonSchema1 | +| ------------------------------------------------------------------ | +| validate | +| validateAndBox | + +## MapOfMapPropertyBoxed +public sealed interface MapOfMapPropertyBoxed
+permits
+[MapOfMapPropertyBoxedMap](#mapofmappropertyboxedmap) + +sealed interface that stores validated payloads using boxed classes + +## MapOfMapPropertyBoxedMap +public record MapOfMapPropertyBoxedMap
+implements [MapOfMapPropertyBoxed](#mapofmappropertyboxed) + +record that stores validated Map payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| MapOfMapPropertyBoxedMap([MapOfMapPropertyMap](#mapofmappropertymap) data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| [MapOfMapPropertyMap](#mapofmappropertymap) | data()
validated payload | +| @Nullable Object | getData()
validated payload | + +## MapOfMapProperty +public static class MapOfMapProperty
+extends JsonSchema + +A schema class that validates payloads + +### Code Sample +``` +import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags; +import org.openapijsonschematools.client.configurations.SchemaConfiguration; +import org.openapijsonschematools.client.exceptions.ValidationException; +import org.openapijsonschematools.client.schemas.validation.MapUtils; +import org.openapijsonschematools.client.schemas.validation.FrozenList; +import org.openapijsonschematools.client.schemas.validation.FrozenMap; +import org.openapijsonschematools.client.components.schemas.AdditionalPropertiesClass; + +import java.util.Arrays; +import java.util.List; +import java.util.AbstractMap; + +static final SchemaConfiguration configuration = new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().build()); + +// Map validation +AdditionalPropertiesClass.MapOfMapPropertyMap validatedPayload = + AdditionalPropertiesClass.MapOfMapProperty.validate( + new AdditionalPropertiesClass.MapOfMapPropertyMapBuilder() + .additionalProperty( + "someAdditionalProperty", + MapUtils.makeMap( + new AbstractMap.SimpleEntry( + "someAdditionalProperty", + "a" + ) + ) + ) + .build(), + configuration +); +``` + +### Field Summary +| Modifier and Type | Field and Description | +| ----------------- | ---------------------- | +| Set> | type = Set.of(Map.class) | +| Class | additionalProperties = [AdditionalProperties1.class](#additionalproperties1) | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| [MapOfMapPropertyMap](#mapofmappropertymap) | validate([Map<?, ?>](#mapofmappropertymapbuilder) arg, SchemaConfiguration configuration) | +| [MapOfMapPropertyBoxedMap](#mapofmappropertyboxedmap) | validateAndBox([Map<?, ?>](#mapofmappropertymapbuilder) arg, SchemaConfiguration configuration) | +| [MapOfMapPropertyBoxed](#mapofmappropertyboxed) | validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) | +| @Nullable Object | validate(@Nullable Object arg, SchemaConfiguration configuration) | + +## MapOfMapPropertyMapBuilder +public class MapOfMapPropertyMapBuilder
+builder for `Map>` + +A class that builds the Map input type + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| MapOfMapPropertyMapBuilder()
Creates a builder that contains an empty map | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| Map> | build()
Returns map input that should be used with Schema.validate | +| [MapOfMapPropertyMapBuilder](#mapofmappropertymapbuilder) | additionalProperty(String key, Map value) | + +## MapOfMapPropertyMap +public static class MapOfMapPropertyMap
+extends FrozenMap + +A class to store validated Map payloads + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| static [MapOfMapPropertyMap](#mapofmappropertymap) | of([Map>](#mapofmappropertymapbuilder) arg, SchemaConfiguration configuration) | +| [AdditionalPropertiesMap](#additionalpropertiesmap) | getAdditionalProperty(String name)
provides type safety for additional properties | + +## AdditionalProperties1Boxed +public sealed interface AdditionalProperties1Boxed
+permits
+[AdditionalProperties1BoxedMap](#additionalproperties1boxedmap) + +sealed interface that stores validated payloads using boxed classes + +## AdditionalProperties1BoxedMap +public record AdditionalProperties1BoxedMap
+implements [AdditionalProperties1Boxed](#additionalproperties1boxed) + +record that stores validated Map payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| AdditionalProperties1BoxedMap([AdditionalPropertiesMap](#additionalpropertiesmap) data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| [AdditionalPropertiesMap](#additionalpropertiesmap) | data()
validated payload | +| @Nullable Object | getData()
validated payload | + +## AdditionalProperties1 +public static class AdditionalProperties1
+extends JsonSchema + +A schema class that validates payloads + +### Code Sample +``` +import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags; +import org.openapijsonschematools.client.configurations.SchemaConfiguration; +import org.openapijsonschematools.client.exceptions.ValidationException; +import org.openapijsonschematools.client.schemas.validation.MapUtils; +import org.openapijsonschematools.client.schemas.validation.FrozenList; +import org.openapijsonschematools.client.schemas.validation.FrozenMap; +import org.openapijsonschematools.client.components.schemas.AdditionalPropertiesClass; + +import java.util.Arrays; +import java.util.List; +import java.util.AbstractMap; + +static final SchemaConfiguration configuration = new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().build()); + +// Map validation +AdditionalPropertiesClass.AdditionalPropertiesMap validatedPayload = + AdditionalPropertiesClass.AdditionalProperties1.validate( + new AdditionalPropertiesClass.AdditionalPropertiesMapBuilder2() + .additionalProperty("someAdditionalProperty", "a") + + .build(), + configuration +); +``` + +### Field Summary +| Modifier and Type | Field and Description | +| ----------------- | ---------------------- | +| Set> | type = Set.of(Map.class) | +| Class | additionalProperties = [AdditionalProperties2.class](#additionalproperties2) | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| [AdditionalPropertiesMap](#additionalpropertiesmap) | validate([Map<?, ?>](#additionalpropertiesmapbuilder2) arg, SchemaConfiguration configuration) | +| [AdditionalProperties1BoxedMap](#additionalproperties1boxedmap) | validateAndBox([Map<?, ?>](#additionalpropertiesmapbuilder2) arg, SchemaConfiguration configuration) | +| [AdditionalProperties1Boxed](#additionalproperties1boxed) | validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) | +| @Nullable Object | validate(@Nullable Object arg, SchemaConfiguration configuration) | + +## AdditionalPropertiesMapBuilder2 +public class AdditionalPropertiesMapBuilder2
+builder for `Map` + +A class that builds the Map input type + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| AdditionalPropertiesMapBuilder2()
Creates a builder that contains an empty map | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| Map | build()
Returns map input that should be used with Schema.validate | +| [AdditionalPropertiesMapBuilder2](#additionalpropertiesmapbuilder2) | additionalProperty(String key, String value) | + +## AdditionalPropertiesMap +public static class AdditionalPropertiesMap
+extends FrozenMap + +A class to store validated Map payloads + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| static [AdditionalPropertiesMap](#additionalpropertiesmap) | of([Map](#additionalpropertiesmapbuilder2) arg, SchemaConfiguration configuration) | +| String | getAdditionalProperty(String name)
provides type safety for additional properties | + +## AdditionalProperties2Boxed +public sealed interface AdditionalProperties2Boxed
+permits
+[AdditionalProperties2BoxedString](#additionalproperties2boxedstring) + +sealed interface that stores validated payloads using boxed classes + +## AdditionalProperties2BoxedString +public record AdditionalProperties2BoxedString
+implements [AdditionalProperties2Boxed](#additionalproperties2boxed) + +record that stores validated String payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| AdditionalProperties2BoxedString(String data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| String | data()
validated payload | +| @Nullable Object | getData()
validated payload | + +## AdditionalProperties2 +public static class AdditionalProperties2
+extends StringJsonSchema.StringJsonSchema1 + +A schema class that validates payloads + +| Methods Inherited from class org.openapijsonschematools.client.schemas.StringJsonSchema.StringJsonSchema1 | +| ------------------------------------------------------------------ | +| validate | +| validateAndBox | + +## MapPropertyBoxed +public sealed interface MapPropertyBoxed
+permits
+[MapPropertyBoxedMap](#mappropertyboxedmap) + +sealed interface that stores validated payloads using boxed classes + +## MapPropertyBoxedMap +public record MapPropertyBoxedMap
+implements [MapPropertyBoxed](#mappropertyboxed) + +record that stores validated Map payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| MapPropertyBoxedMap([MapPropertyMap](#mappropertymap) data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| [MapPropertyMap](#mappropertymap) | data()
validated payload | +| @Nullable Object | getData()
validated payload | + +## MapProperty +public static class MapProperty
+extends JsonSchema + +A schema class that validates payloads + +### Code Sample +``` +import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags; +import org.openapijsonschematools.client.configurations.SchemaConfiguration; +import org.openapijsonschematools.client.exceptions.ValidationException; +import org.openapijsonschematools.client.schemas.validation.MapUtils; +import org.openapijsonschematools.client.schemas.validation.FrozenList; +import org.openapijsonschematools.client.schemas.validation.FrozenMap; +import org.openapijsonschematools.client.components.schemas.AdditionalPropertiesClass; + +import java.util.Arrays; +import java.util.List; +import java.util.AbstractMap; + +static final SchemaConfiguration configuration = new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().build()); + +// Map validation +AdditionalPropertiesClass.MapPropertyMap validatedPayload = + AdditionalPropertiesClass.MapProperty.validate( + new AdditionalPropertiesClass.MapPropertyMapBuilder() + .additionalProperty("someAdditionalProperty", "a") + + .build(), + configuration +); +``` + +### Field Summary +| Modifier and Type | Field and Description | +| ----------------- | ---------------------- | +| Set> | type = Set.of(Map.class) | +| Class | additionalProperties = [AdditionalProperties.class](#additionalproperties) | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| [MapPropertyMap](#mappropertymap) | validate([Map<?, ?>](#mappropertymapbuilder) arg, SchemaConfiguration configuration) | +| [MapPropertyBoxedMap](#mappropertyboxedmap) | validateAndBox([Map<?, ?>](#mappropertymapbuilder) arg, SchemaConfiguration configuration) | +| [MapPropertyBoxed](#mappropertyboxed) | validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) | +| @Nullable Object | validate(@Nullable Object arg, SchemaConfiguration configuration) | + +## MapPropertyMapBuilder +public class MapPropertyMapBuilder
+builder for `Map` + +A class that builds the Map input type + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| MapPropertyMapBuilder()
Creates a builder that contains an empty map | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| Map | build()
Returns map input that should be used with Schema.validate | +| [MapPropertyMapBuilder](#mappropertymapbuilder) | additionalProperty(String key, String value) | + +## MapPropertyMap +public static class MapPropertyMap
+extends FrozenMap + +A class to store validated Map payloads + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| static [MapPropertyMap](#mappropertymap) | of([Map](#mappropertymapbuilder) arg, SchemaConfiguration configuration) | +| String | getAdditionalProperty(String name)
provides type safety for additional properties | + +## AdditionalPropertiesBoxed +public sealed interface AdditionalPropertiesBoxed
+permits
+[AdditionalPropertiesBoxedString](#additionalpropertiesboxedstring) + +sealed interface that stores validated payloads using boxed classes + +## 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 | + +## AdditionalProperties +public static class AdditionalProperties
+extends StringJsonSchema.StringJsonSchema1 + +A schema class that validates payloads + +| Methods Inherited from class org.openapijsonschematools.client.schemas.StringJsonSchema.StringJsonSchema1 | +| ------------------------------------------------------------------ | +| validate | +| validateAndBox | + +[[Back to top]](#top) [[Back to Component Schemas]](../../../README.md#Component-Schemas) [[Back to README]](../../../README.md) diff --git a/samples/client/petstore/kotlin/docs/components/schemas/AdditionalPropertiesSchema.md b/samples/client/petstore/kotlin/docs/components/schemas/AdditionalPropertiesSchema.md new file mode 100644 index 00000000000..6a2ea7c1614 --- /dev/null +++ b/samples/client/petstore/kotlin/docs/components/schemas/AdditionalPropertiesSchema.md @@ -0,0 +1,839 @@ +# AdditionalPropertiesSchema +org.openapijsonschematools.client.components.schemas.AdditionalPropertiesSchema.java +public class AdditionalPropertiesSchema
+ +A class that contains necessary nested +- schema classes (which validate payloads), extends JsonSchema +- sealed interfaces which store validated payloads, java version of a sum type +- boxed classes which store validated payloads, sealed permits class implementations +- classes to store validated map payloads, extends FrozenMap +- classes to build inputs for map payloads + +## Nested Class Summary +| Modifier and Type | Class and Description | +| ----------------- | ---------------------- | +| sealed interface | [AdditionalPropertiesSchema.AdditionalPropertiesSchema1Boxed](#additionalpropertiesschema1boxed)
sealed interface for validated payloads | +| record | [AdditionalPropertiesSchema.AdditionalPropertiesSchema1BoxedMap](#additionalpropertiesschema1boxedmap)
boxed class to store validated Map payloads | +| static class | [AdditionalPropertiesSchema.AdditionalPropertiesSchema1](#additionalpropertiesschema1)
schema class | +| sealed interface | [AdditionalPropertiesSchema.Schema2Boxed](#schema2boxed)
sealed interface for validated payloads | +| record | [AdditionalPropertiesSchema.Schema2BoxedMap](#schema2boxedmap)
boxed class to store validated Map payloads | +| static class | [AdditionalPropertiesSchema.Schema2](#schema2)
schema class | +| static class | [AdditionalPropertiesSchema.Schema2MapBuilder](#schema2mapbuilder)
builder for Map payloads | +| static class | [AdditionalPropertiesSchema.Schema2Map](#schema2map)
output class for Map payloads | +| sealed interface | [AdditionalPropertiesSchema.AdditionalProperties2Boxed](#additionalproperties2boxed)
sealed interface for validated payloads | +| record | [AdditionalPropertiesSchema.AdditionalProperties2BoxedVoid](#additionalproperties2boxedvoid)
boxed class to store validated null payloads | +| record | [AdditionalPropertiesSchema.AdditionalProperties2BoxedBoolean](#additionalproperties2boxedboolean)
boxed class to store validated boolean payloads | +| record | [AdditionalPropertiesSchema.AdditionalProperties2BoxedNumber](#additionalproperties2boxednumber)
boxed class to store validated Number payloads | +| record | [AdditionalPropertiesSchema.AdditionalProperties2BoxedString](#additionalproperties2boxedstring)
boxed class to store validated String payloads | +| record | [AdditionalPropertiesSchema.AdditionalProperties2BoxedList](#additionalproperties2boxedlist)
boxed class to store validated List payloads | +| record | [AdditionalPropertiesSchema.AdditionalProperties2BoxedMap](#additionalproperties2boxedmap)
boxed class to store validated Map payloads | +| static class | [AdditionalPropertiesSchema.AdditionalProperties2](#additionalproperties2)
schema class | +| sealed interface | [AdditionalPropertiesSchema.Schema1Boxed](#schema1boxed)
sealed interface for validated payloads | +| record | [AdditionalPropertiesSchema.Schema1BoxedMap](#schema1boxedmap)
boxed class to store validated Map payloads | +| static class | [AdditionalPropertiesSchema.Schema1](#schema1)
schema class | +| static class | [AdditionalPropertiesSchema.Schema1MapBuilder](#schema1mapbuilder)
builder for Map payloads | +| static class | [AdditionalPropertiesSchema.Schema1Map](#schema1map)
output class for Map payloads | +| sealed interface | [AdditionalPropertiesSchema.AdditionalProperties1Boxed](#additionalproperties1boxed)
sealed interface for validated payloads | +| record | [AdditionalPropertiesSchema.AdditionalProperties1BoxedVoid](#additionalproperties1boxedvoid)
boxed class to store validated null payloads | +| record | [AdditionalPropertiesSchema.AdditionalProperties1BoxedBoolean](#additionalproperties1boxedboolean)
boxed class to store validated boolean payloads | +| record | [AdditionalPropertiesSchema.AdditionalProperties1BoxedNumber](#additionalproperties1boxednumber)
boxed class to store validated Number payloads | +| record | [AdditionalPropertiesSchema.AdditionalProperties1BoxedString](#additionalproperties1boxedstring)
boxed class to store validated String payloads | +| record | [AdditionalPropertiesSchema.AdditionalProperties1BoxedList](#additionalproperties1boxedlist)
boxed class to store validated List payloads | +| record | [AdditionalPropertiesSchema.AdditionalProperties1BoxedMap](#additionalproperties1boxedmap)
boxed class to store validated Map payloads | +| static class | [AdditionalPropertiesSchema.AdditionalProperties1](#additionalproperties1)
schema class | +| sealed interface | [AdditionalPropertiesSchema.Schema0Boxed](#schema0boxed)
sealed interface for validated payloads | +| record | [AdditionalPropertiesSchema.Schema0BoxedMap](#schema0boxedmap)
boxed class to store validated Map payloads | +| static class | [AdditionalPropertiesSchema.Schema0](#schema0)
schema class | +| static class | [AdditionalPropertiesSchema.Schema0MapBuilder](#schema0mapbuilder)
builder for Map payloads | +| static class | [AdditionalPropertiesSchema.Schema0Map](#schema0map)
output class for Map payloads | +| sealed interface | [AdditionalPropertiesSchema.AdditionalPropertiesBoxed](#additionalpropertiesboxed)
sealed interface for validated payloads | +| record | [AdditionalPropertiesSchema.AdditionalPropertiesBoxedVoid](#additionalpropertiesboxedvoid)
boxed class to store validated null payloads | +| record | [AdditionalPropertiesSchema.AdditionalPropertiesBoxedBoolean](#additionalpropertiesboxedboolean)
boxed class to store validated boolean payloads | +| record | [AdditionalPropertiesSchema.AdditionalPropertiesBoxedNumber](#additionalpropertiesboxednumber)
boxed class to store validated Number payloads | +| record | [AdditionalPropertiesSchema.AdditionalPropertiesBoxedString](#additionalpropertiesboxedstring)
boxed class to store validated String payloads | +| record | [AdditionalPropertiesSchema.AdditionalPropertiesBoxedList](#additionalpropertiesboxedlist)
boxed class to store validated List payloads | +| record | [AdditionalPropertiesSchema.AdditionalPropertiesBoxedMap](#additionalpropertiesboxedmap)
boxed class to store validated Map payloads | +| static class | [AdditionalPropertiesSchema.AdditionalProperties](#additionalproperties)
schema class | + +## AdditionalPropertiesSchema1Boxed +public sealed interface AdditionalPropertiesSchema1Boxed
+permits
+[AdditionalPropertiesSchema1BoxedMap](#additionalpropertiesschema1boxedmap) + +sealed interface that stores validated payloads using boxed classes + +## AdditionalPropertiesSchema1BoxedMap +public record AdditionalPropertiesSchema1BoxedMap
+implements [AdditionalPropertiesSchema1Boxed](#additionalpropertiesschema1boxed) + +record that stores validated Map payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| AdditionalPropertiesSchema1BoxedMap(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 | + +## AdditionalPropertiesSchema1 +public static class AdditionalPropertiesSchema1
+extends JsonSchema + +A schema class that validates payloads + +### Field Summary +| Modifier and Type | Field and Description | +| ----------------- | ---------------------- | +| Set> | type = Set.of(Map.class) | +| List> | allOf = List.of(
    [Schema0.class](#schema0),
    [Schema1.class](#schema1),
    [Schema2.class](#schema2)
;)
| + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| FrozenMap | validate(Map<?, ?> arg, SchemaConfiguration configuration) | +| [AdditionalPropertiesSchema1BoxedMap](#additionalpropertiesschema1boxedmap) | validateAndBox(Map<?, ?> arg, SchemaConfiguration configuration) | +| [AdditionalPropertiesSchema1Boxed](#additionalpropertiesschema1boxed) | validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) | +| @Nullable Object | validate(@Nullable Object arg, SchemaConfiguration configuration) | + +## Schema2Boxed +public sealed interface Schema2Boxed
+permits
+[Schema2BoxedMap](#schema2boxedmap) + +sealed interface that stores validated payloads using boxed classes + +## Schema2BoxedMap +public record Schema2BoxedMap
+implements [Schema2Boxed](#schema2boxed) + +record that stores validated Map payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| Schema2BoxedMap([Schema2Map](#schema2map) data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| [Schema2Map](#schema2map) | data()
validated payload | +| @Nullable Object | getData()
validated payload | + +## Schema2 +public static class Schema2
+extends JsonSchema + +A schema class that validates payloads + +### Code Sample +``` +import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags; +import org.openapijsonschematools.client.configurations.SchemaConfiguration; +import org.openapijsonschematools.client.exceptions.ValidationException; +import org.openapijsonschematools.client.schemas.validation.MapUtils; +import org.openapijsonschematools.client.schemas.validation.FrozenList; +import org.openapijsonschematools.client.schemas.validation.FrozenMap; +import org.openapijsonschematools.client.components.schemas.AdditionalPropertiesSchema; + +import java.util.Arrays; +import java.util.List; +import java.util.AbstractMap; + +static final SchemaConfiguration configuration = new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().build()); + +// Map validation +AdditionalPropertiesSchema.Schema2Map validatedPayload = + AdditionalPropertiesSchema.Schema2.validate( + new AdditionalPropertiesSchema.Schema2MapBuilder() + .build(), + configuration +); +``` + +### Field Summary +| Modifier and Type | Field and Description | +| ----------------- | ---------------------- | +| Set> | type = Set.of(Map.class) | +| Class | additionalProperties = [AdditionalProperties2.class](#additionalproperties2) | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| [Schema2Map](#schema2map) | validate([Map<?, ?>](#schema2mapbuilder) arg, SchemaConfiguration configuration) | +| [Schema2BoxedMap](#schema2boxedmap) | validateAndBox([Map<?, ?>](#schema2mapbuilder) arg, SchemaConfiguration configuration) | +| [Schema2Boxed](#schema2boxed) | validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) | +| @Nullable Object | validate(@Nullable Object arg, SchemaConfiguration configuration) | + +## Schema2MapBuilder +public class Schema2MapBuilder
+builder for `Map` + +A class that builds the Map input type + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| Schema2MapBuilder()
Creates a builder that contains an empty map | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| Map | build()
Returns map input that should be used with Schema.validate | +| [Schema2MapBuilder](#schema2mapbuilder) | additionalProperty(String key, Nothing? value) | +| [Schema2MapBuilder](#schema2mapbuilder) | additionalProperty(String key, boolean value) | +| [Schema2MapBuilder](#schema2mapbuilder) | additionalProperty(String key, String value) | +| [Schema2MapBuilder](#schema2mapbuilder) | additionalProperty(String key, int value) | +| [Schema2MapBuilder](#schema2mapbuilder) | additionalProperty(String key, float value) | +| [Schema2MapBuilder](#schema2mapbuilder) | additionalProperty(String key, long value) | +| [Schema2MapBuilder](#schema2mapbuilder) | additionalProperty(String key, double value) | +| [Schema2MapBuilder](#schema2mapbuilder) | additionalProperty(String key, List value) | +| [Schema2MapBuilder](#schema2mapbuilder) | additionalProperty(String key, Map value) | + +## Schema2Map +public static class Schema2Map
+extends FrozenMap + +A class to store validated Map payloads + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| static [Schema2Map](#schema2map) | of([Map](#schema2mapbuilder) arg, SchemaConfiguration configuration) | +| @Nullable Object | getAdditionalProperty(String name)
provides type safety for additional properties | + +## AdditionalProperties2Boxed +public sealed interface AdditionalProperties2Boxed
+permits
+[AdditionalProperties2BoxedVoid](#additionalproperties2boxedvoid), +[AdditionalProperties2BoxedBoolean](#additionalproperties2boxedboolean), +[AdditionalProperties2BoxedNumber](#additionalproperties2boxednumber), +[AdditionalProperties2BoxedString](#additionalproperties2boxedstring), +[AdditionalProperties2BoxedList](#additionalproperties2boxedlist), +[AdditionalProperties2BoxedMap](#additionalproperties2boxedmap) + +sealed interface that stores validated payloads using boxed classes + +## AdditionalProperties2BoxedVoid +public record AdditionalProperties2BoxedVoid
+implements [AdditionalProperties2Boxed](#additionalproperties2boxed) + +record that stores validated null payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| AdditionalProperties2BoxedVoid(Nothing? data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| Nothing? | data()
validated payload | +| @Nullable Object | getData()
validated payload | + +## AdditionalProperties2BoxedBoolean +public record AdditionalProperties2BoxedBoolean
+implements [AdditionalProperties2Boxed](#additionalproperties2boxed) + +record that stores validated boolean payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| AdditionalProperties2BoxedBoolean(boolean data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| boolean | data()
validated payload | +| @Nullable Object | getData()
validated payload | + +## AdditionalProperties2BoxedNumber +public record AdditionalProperties2BoxedNumber
+implements [AdditionalProperties2Boxed](#additionalproperties2boxed) + +record that stores validated Number payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| AdditionalProperties2BoxedNumber(Number data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| Number | data()
validated payload | +| @Nullable Object | getData()
validated payload | + +## AdditionalProperties2BoxedString +public record AdditionalProperties2BoxedString
+implements [AdditionalProperties2Boxed](#additionalproperties2boxed) + +record that stores validated String payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| AdditionalProperties2BoxedString(String data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| String | data()
validated payload | +| @Nullable Object | getData()
validated payload | + +## AdditionalProperties2BoxedList +public record AdditionalProperties2BoxedList
+implements [AdditionalProperties2Boxed](#additionalproperties2boxed) + +record that stores validated List payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| AdditionalProperties2BoxedList(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 | + +## AdditionalProperties2BoxedMap +public record AdditionalProperties2BoxedMap
+implements [AdditionalProperties2Boxed](#additionalproperties2boxed) + +record that stores validated Map payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| AdditionalProperties2BoxedMap(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 | + +## AdditionalProperties2 +public static class AdditionalProperties2
+extends JsonSchema + +A schema class that validates payloads + +### Field Summary +| Modifier and Type | Field and Description | +| ----------------- | ---------------------- | +| Integer | maxLength = 5 | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| String | validate(String arg, SchemaConfiguration configuration) | +| Nothing? | validate(Nothing? arg, SchemaConfiguration configuration) | +| int | validate(int arg, SchemaConfiguration configuration) | +| long | validate(long arg, SchemaConfiguration configuration) | +| float | validate(float arg, SchemaConfiguration configuration) | +| double | validate(double arg, SchemaConfiguration configuration) | +| Number | validate(Number arg, SchemaConfiguration configuration) | +| boolean | validate(boolean arg, SchemaConfiguration configuration) | +| FrozenMap<@Nullable Object> | validate(Map<?, ?> arg, SchemaConfiguration configuration) | +| FrozenList<@Nullable Object> | validate(List arg, SchemaConfiguration configuration) | +| [AdditionalProperties2BoxedString](#additionalproperties2boxedstring) | validateAndBox(String arg, SchemaConfiguration configuration) | +| [AdditionalProperties2BoxedVoid](#additionalproperties2boxedvoid) | validateAndBox(Nothing? arg, SchemaConfiguration configuration) | +| [AdditionalProperties2BoxedNumber](#additionalproperties2boxednumber) | validateAndBox(Number arg, SchemaConfiguration configuration) | +| [AdditionalProperties2BoxedBoolean](#additionalproperties2boxedboolean) | validateAndBox(boolean arg, SchemaConfiguration configuration) | +| [AdditionalProperties2BoxedMap](#additionalproperties2boxedmap) | validateAndBox(Map<?, ?> arg, SchemaConfiguration configuration) | +| [AdditionalProperties2BoxedList](#additionalproperties2boxedlist) | validateAndBox(List arg, SchemaConfiguration configuration) | +| [AdditionalProperties2Boxed](#additionalproperties2boxed) | validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) | +| @Nullable Object | validate(@Nullable Object arg, SchemaConfiguration configuration) | + +## Schema1Boxed +public sealed interface Schema1Boxed
+permits
+[Schema1BoxedMap](#schema1boxedmap) + +sealed interface that stores validated payloads using boxed classes + +## Schema1BoxedMap +public record Schema1BoxedMap
+implements [Schema1Boxed](#schema1boxed) + +record that stores validated Map payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| Schema1BoxedMap([Schema1Map](#schema1map) data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| [Schema1Map](#schema1map) | data()
validated payload | +| @Nullable Object | getData()
validated payload | + +## Schema1 +public static class Schema1
+extends JsonSchema + +A schema class that validates payloads + +### Code Sample +``` +import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags; +import org.openapijsonschematools.client.configurations.SchemaConfiguration; +import org.openapijsonschematools.client.exceptions.ValidationException; +import org.openapijsonschematools.client.schemas.validation.MapUtils; +import org.openapijsonschematools.client.schemas.validation.FrozenList; +import org.openapijsonschematools.client.schemas.validation.FrozenMap; +import org.openapijsonschematools.client.components.schemas.AdditionalPropertiesSchema; + +import java.util.Arrays; +import java.util.List; +import java.util.AbstractMap; + +static final SchemaConfiguration configuration = new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().build()); + +// Map validation +AdditionalPropertiesSchema.Schema1Map validatedPayload = + AdditionalPropertiesSchema.Schema1.validate( + new AdditionalPropertiesSchema.Schema1MapBuilder() + .build(), + configuration +); +``` + +### Field Summary +| Modifier and Type | Field and Description | +| ----------------- | ---------------------- | +| Set> | type = Set.of(Map.class) | +| Class | additionalProperties = [AdditionalProperties1.class](#additionalproperties1) | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| [Schema1Map](#schema1map) | validate([Map<?, ?>](#schema1mapbuilder) arg, SchemaConfiguration configuration) | +| [Schema1BoxedMap](#schema1boxedmap) | validateAndBox([Map<?, ?>](#schema1mapbuilder) arg, SchemaConfiguration configuration) | +| [Schema1Boxed](#schema1boxed) | validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) | +| @Nullable Object | validate(@Nullable Object arg, SchemaConfiguration configuration) | + +## Schema1MapBuilder +public class Schema1MapBuilder
+builder for `Map` + +A class that builds the Map input type + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| Schema1MapBuilder()
Creates a builder that contains an empty map | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| Map | build()
Returns map input that should be used with Schema.validate | +| [Schema1MapBuilder](#schema1mapbuilder) | additionalProperty(String key, Nothing? value) | +| [Schema1MapBuilder](#schema1mapbuilder) | additionalProperty(String key, boolean value) | +| [Schema1MapBuilder](#schema1mapbuilder) | additionalProperty(String key, String value) | +| [Schema1MapBuilder](#schema1mapbuilder) | additionalProperty(String key, int value) | +| [Schema1MapBuilder](#schema1mapbuilder) | additionalProperty(String key, float value) | +| [Schema1MapBuilder](#schema1mapbuilder) | additionalProperty(String key, long value) | +| [Schema1MapBuilder](#schema1mapbuilder) | additionalProperty(String key, double value) | +| [Schema1MapBuilder](#schema1mapbuilder) | additionalProperty(String key, List value) | +| [Schema1MapBuilder](#schema1mapbuilder) | additionalProperty(String key, Map value) | + +## Schema1Map +public static class Schema1Map
+extends FrozenMap + +A class to store validated Map payloads + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| static [Schema1Map](#schema1map) | of([Map](#schema1mapbuilder) arg, SchemaConfiguration configuration) | +| @Nullable Object | getAdditionalProperty(String name)
provides type safety for additional properties | + +## AdditionalProperties1Boxed +public sealed interface AdditionalProperties1Boxed
+permits
+[AdditionalProperties1BoxedVoid](#additionalproperties1boxedvoid), +[AdditionalProperties1BoxedBoolean](#additionalproperties1boxedboolean), +[AdditionalProperties1BoxedNumber](#additionalproperties1boxednumber), +[AdditionalProperties1BoxedString](#additionalproperties1boxedstring), +[AdditionalProperties1BoxedList](#additionalproperties1boxedlist), +[AdditionalProperties1BoxedMap](#additionalproperties1boxedmap) + +sealed interface that stores validated payloads using boxed classes + +## AdditionalProperties1BoxedVoid +public record AdditionalProperties1BoxedVoid
+implements [AdditionalProperties1Boxed](#additionalproperties1boxed) + +record that stores validated null payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| AdditionalProperties1BoxedVoid(Nothing? data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| Nothing? | data()
validated payload | +| @Nullable Object | getData()
validated payload | + +## AdditionalProperties1BoxedBoolean +public record AdditionalProperties1BoxedBoolean
+implements [AdditionalProperties1Boxed](#additionalproperties1boxed) + +record that stores validated boolean payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| AdditionalProperties1BoxedBoolean(boolean data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| boolean | data()
validated payload | +| @Nullable Object | getData()
validated payload | + +## AdditionalProperties1BoxedNumber +public record AdditionalProperties1BoxedNumber
+implements [AdditionalProperties1Boxed](#additionalproperties1boxed) + +record that stores validated Number payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| AdditionalProperties1BoxedNumber(Number data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| Number | data()
validated payload | +| @Nullable Object | getData()
validated payload | + +## AdditionalProperties1BoxedString +public record AdditionalProperties1BoxedString
+implements [AdditionalProperties1Boxed](#additionalproperties1boxed) + +record that stores validated String payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| AdditionalProperties1BoxedString(String data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| String | data()
validated payload | +| @Nullable Object | getData()
validated payload | + +## AdditionalProperties1BoxedList +public record AdditionalProperties1BoxedList
+implements [AdditionalProperties1Boxed](#additionalproperties1boxed) + +record that stores validated List payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| AdditionalProperties1BoxedList(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 | + +## AdditionalProperties1BoxedMap +public record AdditionalProperties1BoxedMap
+implements [AdditionalProperties1Boxed](#additionalproperties1boxed) + +record that stores validated Map payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| AdditionalProperties1BoxedMap(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 | + +## AdditionalProperties1 +public static class AdditionalProperties1
+extends JsonSchema + +A schema class that validates payloads + +### Field Summary +| Modifier and Type | Field and Description | +| ----------------- | ---------------------- | +| Integer | minLength = 3 | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| String | validate(String arg, SchemaConfiguration configuration) | +| Nothing? | validate(Nothing? arg, SchemaConfiguration configuration) | +| int | validate(int arg, SchemaConfiguration configuration) | +| long | validate(long arg, SchemaConfiguration configuration) | +| float | validate(float arg, SchemaConfiguration configuration) | +| double | validate(double arg, SchemaConfiguration configuration) | +| Number | validate(Number arg, SchemaConfiguration configuration) | +| boolean | validate(boolean arg, SchemaConfiguration configuration) | +| FrozenMap<@Nullable Object> | validate(Map<?, ?> arg, SchemaConfiguration configuration) | +| FrozenList<@Nullable Object> | validate(List arg, SchemaConfiguration configuration) | +| [AdditionalProperties1BoxedString](#additionalproperties1boxedstring) | validateAndBox(String arg, SchemaConfiguration configuration) | +| [AdditionalProperties1BoxedVoid](#additionalproperties1boxedvoid) | validateAndBox(Nothing? arg, SchemaConfiguration configuration) | +| [AdditionalProperties1BoxedNumber](#additionalproperties1boxednumber) | validateAndBox(Number arg, SchemaConfiguration configuration) | +| [AdditionalProperties1BoxedBoolean](#additionalproperties1boxedboolean) | validateAndBox(boolean arg, SchemaConfiguration configuration) | +| [AdditionalProperties1BoxedMap](#additionalproperties1boxedmap) | validateAndBox(Map<?, ?> arg, SchemaConfiguration configuration) | +| [AdditionalProperties1BoxedList](#additionalproperties1boxedlist) | validateAndBox(List arg, SchemaConfiguration configuration) | +| [AdditionalProperties1Boxed](#additionalproperties1boxed) | validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) | +| @Nullable Object | validate(@Nullable Object arg, SchemaConfiguration configuration) | + +## Schema0Boxed +public sealed interface Schema0Boxed
+permits
+[Schema0BoxedMap](#schema0boxedmap) + +sealed interface that stores validated payloads using boxed classes + +## Schema0BoxedMap +public record Schema0BoxedMap
+implements [Schema0Boxed](#schema0boxed) + +record that stores validated Map payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| Schema0BoxedMap([Schema0Map](#schema0map) data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| [Schema0Map](#schema0map) | data()
validated payload | +| @Nullable Object | getData()
validated payload | + +## Schema0 +public static class Schema0
+extends JsonSchema + +A schema class that validates payloads + +### Code Sample +``` +import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags; +import org.openapijsonschematools.client.configurations.SchemaConfiguration; +import org.openapijsonschematools.client.exceptions.ValidationException; +import org.openapijsonschematools.client.schemas.validation.MapUtils; +import org.openapijsonschematools.client.schemas.validation.FrozenList; +import org.openapijsonschematools.client.schemas.validation.FrozenMap; +import org.openapijsonschematools.client.components.schemas.AdditionalPropertiesSchema; + +import java.util.Arrays; +import java.util.List; +import java.util.AbstractMap; + +static final SchemaConfiguration configuration = new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().build()); + +// Map validation +AdditionalPropertiesSchema.Schema0Map validatedPayload = + AdditionalPropertiesSchema.Schema0.validate( + new AdditionalPropertiesSchema.Schema0MapBuilder() + .build(), + configuration +); +``` + +### Field Summary +| Modifier and Type | Field and Description | +| ----------------- | ---------------------- | +| Set> | type = Set.of(Map.class) | +| Class | additionalProperties = [AdditionalProperties.class](#additionalproperties) | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| [Schema0Map](#schema0map) | validate([Map<?, ?>](#schema0mapbuilder) arg, SchemaConfiguration configuration) | +| [Schema0BoxedMap](#schema0boxedmap) | validateAndBox([Map<?, ?>](#schema0mapbuilder) arg, SchemaConfiguration configuration) | +| [Schema0Boxed](#schema0boxed) | validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) | +| @Nullable Object | validate(@Nullable Object arg, SchemaConfiguration configuration) | + +## Schema0MapBuilder +public class Schema0MapBuilder
+builder for `Map` + +A class that builds the Map input type + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| Schema0MapBuilder()
Creates a builder that contains an empty map | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| Map | build()
Returns map input that should be used with Schema.validate | +| [Schema0MapBuilder](#schema0mapbuilder) | additionalProperty(String key, Nothing? value) | +| [Schema0MapBuilder](#schema0mapbuilder) | additionalProperty(String key, boolean value) | +| [Schema0MapBuilder](#schema0mapbuilder) | additionalProperty(String key, String value) | +| [Schema0MapBuilder](#schema0mapbuilder) | additionalProperty(String key, int value) | +| [Schema0MapBuilder](#schema0mapbuilder) | additionalProperty(String key, float value) | +| [Schema0MapBuilder](#schema0mapbuilder) | additionalProperty(String key, long value) | +| [Schema0MapBuilder](#schema0mapbuilder) | additionalProperty(String key, double value) | +| [Schema0MapBuilder](#schema0mapbuilder) | additionalProperty(String key, List value) | +| [Schema0MapBuilder](#schema0mapbuilder) | additionalProperty(String key, Map value) | + +## Schema0Map +public static class Schema0Map
+extends FrozenMap + +A class to store validated Map payloads + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| static [Schema0Map](#schema0map) | of([Map](#schema0mapbuilder) arg, SchemaConfiguration configuration) | +| @Nullable Object | getAdditionalProperty(String name)
provides type safety for additional properties | + +## 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(Nothing? data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| Nothing? | 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 AnyTypeJsonSchema.AnyTypeJsonSchema1 + +A schema class that validates payloads + +| Methods Inherited from class org.openapijsonschematools.client.schemas.AnyTypeJsonSchema.AnyTypeJsonSchema1 | +| ------------------------------------------------------------------ | +| validate | +| validateAndBox | + +[[Back to top]](#top) [[Back to Component Schemas]](../../../README.md#Component-Schemas) [[Back to README]](../../../README.md) diff --git a/samples/client/petstore/kotlin/docs/components/schemas/AdditionalPropertiesWithArrayOfEnums.md b/samples/client/petstore/kotlin/docs/components/schemas/AdditionalPropertiesWithArrayOfEnums.md new file mode 100644 index 00000000000..436c7eed867 --- /dev/null +++ b/samples/client/petstore/kotlin/docs/components/schemas/AdditionalPropertiesWithArrayOfEnums.md @@ -0,0 +1,233 @@ +# AdditionalPropertiesWithArrayOfEnums +org.openapijsonschematools.client.components.schemas.AdditionalPropertiesWithArrayOfEnums.java +public class AdditionalPropertiesWithArrayOfEnums
+ +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 list payloads, extends FrozenList +- classes to build inputs for list payloads +- classes to store validated map payloads, extends FrozenMap +- classes to build inputs for map payloads + +## Nested Class Summary +| Modifier and Type | Class and Description | +| ----------------- | ---------------------- | +| sealed interface | [AdditionalPropertiesWithArrayOfEnums.AdditionalPropertiesWithArrayOfEnums1Boxed](#additionalpropertieswitharrayofenums1boxed)
sealed interface for validated payloads | +| record | [AdditionalPropertiesWithArrayOfEnums.AdditionalPropertiesWithArrayOfEnums1BoxedMap](#additionalpropertieswitharrayofenums1boxedmap)
boxed class to store validated Map payloads | +| static class | [AdditionalPropertiesWithArrayOfEnums.AdditionalPropertiesWithArrayOfEnums1](#additionalpropertieswitharrayofenums1)
schema class | +| static class | [AdditionalPropertiesWithArrayOfEnums.AdditionalPropertiesWithArrayOfEnumsMapBuilder](#additionalpropertieswitharrayofenumsmapbuilder)
builder for Map payloads | +| static class | [AdditionalPropertiesWithArrayOfEnums.AdditionalPropertiesWithArrayOfEnumsMap](#additionalpropertieswitharrayofenumsmap)
output class for Map payloads | +| sealed interface | [AdditionalPropertiesWithArrayOfEnums.AdditionalPropertiesBoxed](#additionalpropertiesboxed)
sealed interface for validated payloads | +| record | [AdditionalPropertiesWithArrayOfEnums.AdditionalPropertiesBoxedList](#additionalpropertiesboxedlist)
boxed class to store validated List payloads | +| static class | [AdditionalPropertiesWithArrayOfEnums.AdditionalProperties](#additionalproperties)
schema class | +| static class | [AdditionalPropertiesWithArrayOfEnums.AdditionalPropertiesListBuilder](#additionalpropertieslistbuilder)
builder for List payloads | +| static class | [AdditionalPropertiesWithArrayOfEnums.AdditionalPropertiesList](#additionalpropertieslist)
output class for List payloads | + +## AdditionalPropertiesWithArrayOfEnums1Boxed +public sealed interface AdditionalPropertiesWithArrayOfEnums1Boxed
+permits
+[AdditionalPropertiesWithArrayOfEnums1BoxedMap](#additionalpropertieswitharrayofenums1boxedmap) + +sealed interface that stores validated payloads using boxed classes + +## AdditionalPropertiesWithArrayOfEnums1BoxedMap +public record AdditionalPropertiesWithArrayOfEnums1BoxedMap
+implements [AdditionalPropertiesWithArrayOfEnums1Boxed](#additionalpropertieswitharrayofenums1boxed) + +record that stores validated Map payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| AdditionalPropertiesWithArrayOfEnums1BoxedMap([AdditionalPropertiesWithArrayOfEnumsMap](#additionalpropertieswitharrayofenumsmap) data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| [AdditionalPropertiesWithArrayOfEnumsMap](#additionalpropertieswitharrayofenumsmap) | data()
validated payload | +| @Nullable Object | getData()
validated payload | + +## AdditionalPropertiesWithArrayOfEnums1 +public static class AdditionalPropertiesWithArrayOfEnums1
+extends JsonSchema + +A schema class that validates payloads + +### Code Sample +``` +import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags; +import org.openapijsonschematools.client.configurations.SchemaConfiguration; +import org.openapijsonschematools.client.exceptions.ValidationException; +import org.openapijsonschematools.client.schemas.validation.MapUtils; +import org.openapijsonschematools.client.schemas.validation.FrozenList; +import org.openapijsonschematools.client.schemas.validation.FrozenMap; +import org.openapijsonschematools.client.components.schemas.AdditionalPropertiesWithArrayOfEnums; + +import java.util.Arrays; +import java.util.List; +import java.util.AbstractMap; + +static final SchemaConfiguration configuration = new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().build()); + +// Map validation +AdditionalPropertiesWithArrayOfEnums.AdditionalPropertiesWithArrayOfEnumsMap validatedPayload = + AdditionalPropertiesWithArrayOfEnums.AdditionalPropertiesWithArrayOfEnums1.validate( + new AdditionalPropertiesWithArrayOfEnums.AdditionalPropertiesWithArrayOfEnumsMapBuilder() + .additionalProperty( + "someAdditionalProperty", + Arrays.asList( + "_abc" + ) + ) + .build(), + configuration +); +``` + +### Field Summary +| Modifier and Type | Field and Description | +| ----------------- | ---------------------- | +| Set> | type = Set.of(Map.class) | +| Class | additionalProperties = [AdditionalProperties.class](#additionalproperties) | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| [AdditionalPropertiesWithArrayOfEnumsMap](#additionalpropertieswitharrayofenumsmap) | validate([Map<?, ?>](#additionalpropertieswitharrayofenumsmapbuilder) arg, SchemaConfiguration configuration) | +| [AdditionalPropertiesWithArrayOfEnums1BoxedMap](#additionalpropertieswitharrayofenums1boxedmap) | validateAndBox([Map<?, ?>](#additionalpropertieswitharrayofenumsmapbuilder) arg, SchemaConfiguration configuration) | +| [AdditionalPropertiesWithArrayOfEnums1Boxed](#additionalpropertieswitharrayofenums1boxed) | validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) | +| @Nullable Object | validate(@Nullable Object arg, SchemaConfiguration configuration) | + +## AdditionalPropertiesWithArrayOfEnumsMapBuilder +public class AdditionalPropertiesWithArrayOfEnumsMapBuilder
+builder for `Map>` + +A class that builds the Map input type + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| AdditionalPropertiesWithArrayOfEnumsMapBuilder()
Creates a builder that contains an empty map | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| Map> | build()
Returns map input that should be used with Schema.validate | +| [AdditionalPropertiesWithArrayOfEnumsMapBuilder](#additionalpropertieswitharrayofenumsmapbuilder) | additionalProperty(String key, List value) | + +## AdditionalPropertiesWithArrayOfEnumsMap +public static class AdditionalPropertiesWithArrayOfEnumsMap
+extends FrozenMap + +A class to store validated Map payloads + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| static [AdditionalPropertiesWithArrayOfEnumsMap](#additionalpropertieswitharrayofenumsmap) | of([Map>](#additionalpropertieswitharrayofenumsmapbuilder) arg, SchemaConfiguration configuration) | +| [AdditionalPropertiesList](#additionalpropertieslist) | getAdditionalProperty(String name)
provides type safety for additional properties | + +## AdditionalPropertiesBoxed +public sealed interface AdditionalPropertiesBoxed
+permits
+[AdditionalPropertiesBoxedList](#additionalpropertiesboxedlist) + +sealed interface that stores validated payloads using boxed classes + +## AdditionalPropertiesBoxedList +public record AdditionalPropertiesBoxedList
+implements [AdditionalPropertiesBoxed](#additionalpropertiesboxed) + +record that stores validated List payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| AdditionalPropertiesBoxedList([AdditionalPropertiesList](#additionalpropertieslist) data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| [AdditionalPropertiesList](#additionalpropertieslist) | data()
validated payload | +| @Nullable Object | getData()
validated payload | + +## AdditionalProperties +public static class AdditionalProperties
+extends JsonSchema + +A schema class that validates payloads + +### Code Sample +``` +import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags; +import org.openapijsonschematools.client.configurations.SchemaConfiguration; +import org.openapijsonschematools.client.exceptions.ValidationException; +import org.openapijsonschematools.client.schemas.validation.MapUtils; +import org.openapijsonschematools.client.schemas.validation.FrozenList; +import org.openapijsonschematools.client.schemas.validation.FrozenMap; +import org.openapijsonschematools.client.components.schemas.AdditionalPropertiesWithArrayOfEnums; + +import java.util.Arrays; +import java.util.List; +import java.util.AbstractMap; + +static final SchemaConfiguration configuration = new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().build()); + +// List validation +AdditionalPropertiesWithArrayOfEnums.AdditionalPropertiesList validatedPayload = + AdditionalPropertiesWithArrayOfEnums.AdditionalProperties.validate( + new AdditionalPropertiesWithArrayOfEnums.AdditionalPropertiesListBuilder() + .add("_abc") + + .build(), + configuration +); +``` + +### Field Summary +| Modifier and Type | Field and Description | +| ----------------- | ---------------------- | +| Set> | type = Set.of(List.class) | +| Class | items = [EnumClass.EnumClass1.class](../../components/schemas/EnumClass.md#enumclass1) | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| [AdditionalPropertiesList](#additionalpropertieslist) | validate([List](#additionalpropertieslistbuilder) arg, SchemaConfiguration configuration) | +| [AdditionalPropertiesBoxedList](#additionalpropertiesboxedlist) | validateAndBox([List](#additionalpropertieslistbuilder) arg, SchemaConfiguration configuration) | +| [AdditionalPropertiesBoxed](#additionalpropertiesboxed) | validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) | +| @Nullable Object | validate(@Nullable Object arg, SchemaConfiguration configuration) | + +## AdditionalPropertiesListBuilder +public class AdditionalPropertiesListBuilder
+builder for `List` + +A class that builds the List input type + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| AdditionalPropertiesListBuilder()
Creates an empty list | +| AdditionalPropertiesListBuilder(List items)
Stores the items in a list | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| AdditionalPropertiesListBuilder | add(String item) | +| AdditionalPropertiesListBuilder | add([EnumClass.StringEnumClassEnums](../../components/schemas/EnumClass.md#stringenumclassenums) item) | +| List | build()
Returns list input that should be used with Schema.validate | + +## AdditionalPropertiesList +public class AdditionalPropertiesList
+extends `FrozenList` + +A class to store validated List payloads + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| static [AdditionalPropertiesList](#additionalpropertieslist) | of([List](#additionalpropertieslistbuilder) arg, SchemaConfiguration configuration) | + +[[Back to top]](#top) [[Back to Component Schemas]](../../../README.md#Component-Schemas) [[Back to README]](../../../README.md) diff --git a/samples/client/petstore/kotlin/docs/components/schemas/Address.md b/samples/client/petstore/kotlin/docs/components/schemas/Address.md new file mode 100644 index 00000000000..a895ba52bc9 --- /dev/null +++ b/samples/client/petstore/kotlin/docs/components/schemas/Address.md @@ -0,0 +1,162 @@ +# Address +org.openapijsonschematools.client.components.schemas.Address.java +public class Address
+ +A class that contains necessary nested +- schema classes (which validate payloads), extends JsonSchema +- sealed interfaces which store validated payloads, java version of a sum type +- boxed classes which store validated payloads, sealed permits class implementations +- classes to store validated map payloads, extends FrozenMap +- classes to build inputs for map payloads + +## Nested Class Summary +| Modifier and Type | Class and Description | +| ----------------- | ---------------------- | +| sealed interface | [Address.Address1Boxed](#address1boxed)
sealed interface for validated payloads | +| record | [Address.Address1BoxedMap](#address1boxedmap)
boxed class to store validated Map payloads | +| static class | [Address.Address1](#address1)
schema class | +| static class | [Address.AddressMapBuilder](#addressmapbuilder)
builder for Map payloads | +| static class | [Address.AddressMap](#addressmap)
output class for Map payloads | +| sealed interface | [Address.AdditionalPropertiesBoxed](#additionalpropertiesboxed)
sealed interface for validated payloads | +| record | [Address.AdditionalPropertiesBoxedNumber](#additionalpropertiesboxednumber)
boxed class to store validated Number payloads | +| static class | [Address.AdditionalProperties](#additionalproperties)
schema class | + +## Address1Boxed +public sealed interface Address1Boxed
+permits
+[Address1BoxedMap](#address1boxedmap) + +sealed interface that stores validated payloads using boxed classes + +## Address1BoxedMap +public record Address1BoxedMap
+implements [Address1Boxed](#address1boxed) + +record that stores validated Map payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| Address1BoxedMap([AddressMap](#addressmap) data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| [AddressMap](#addressmap) | data()
validated payload | +| @Nullable Object | getData()
validated payload | + +## Address1 +public static class Address1
+extends JsonSchema + +A schema class that validates payloads + +### Code Sample +``` +import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags; +import org.openapijsonschematools.client.configurations.SchemaConfiguration; +import org.openapijsonschematools.client.exceptions.ValidationException; +import org.openapijsonschematools.client.schemas.validation.MapUtils; +import org.openapijsonschematools.client.schemas.validation.FrozenList; +import org.openapijsonschematools.client.schemas.validation.FrozenMap; +import org.openapijsonschematools.client.components.schemas.Address; + +import java.util.Arrays; +import java.util.List; +import java.util.AbstractMap; + +static final SchemaConfiguration configuration = new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().build()); + +// Map validation +Address.AddressMap validatedPayload = + Address.Address1.validate( + new Address.AddressMapBuilder() + .additionalProperty("someAdditionalProperty", 1) + + .build(), + configuration +); +``` + +### Field Summary +| Modifier and Type | Field and Description | +| ----------------- | ---------------------- | +| Set> | type = Set.of(Map.class) | +| Class | additionalProperties = [AdditionalProperties.class](#additionalproperties) | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| [AddressMap](#addressmap) | validate([Map<?, ?>](#addressmapbuilder) arg, SchemaConfiguration configuration) | +| [Address1BoxedMap](#address1boxedmap) | validateAndBox([Map<?, ?>](#addressmapbuilder) arg, SchemaConfiguration configuration) | +| [Address1Boxed](#address1boxed) | validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) | +| @Nullable Object | validate(@Nullable Object arg, SchemaConfiguration configuration) | + +## AddressMapBuilder +public class AddressMapBuilder
+builder for `Map` + +A class that builds the Map input type + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| AddressMapBuilder()
Creates a builder that contains an empty map | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| Map | build()
Returns map input that should be used with Schema.validate | +| [AddressMapBuilder](#addressmapbuilder) | additionalProperty(String key, int value) | +| [AddressMapBuilder](#addressmapbuilder) | additionalProperty(String key, float value) | +| [AddressMapBuilder](#addressmapbuilder) | additionalProperty(String key, long value) | +| [AddressMapBuilder](#addressmapbuilder) | additionalProperty(String key, double value) | + +## AddressMap +public static class AddressMap
+extends FrozenMap + +A class to store validated Map payloads + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| static [AddressMap](#addressmap) | of([Map](#addressmapbuilder) arg, SchemaConfiguration configuration) | +| Number | getAdditionalProperty(String name)
provides type safety for additional properties | + +## AdditionalPropertiesBoxed +public sealed interface AdditionalPropertiesBoxed
+permits
+[AdditionalPropertiesBoxedNumber](#additionalpropertiesboxednumber) + +sealed interface that stores validated payloads using boxed classes + +## 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 | + +## AdditionalProperties +public static class AdditionalProperties
+extends IntJsonSchema.IntJsonSchema1 + +A schema class that validates payloads + +| Methods Inherited from class org.openapijsonschematools.client.schemas.IntJsonSchema.IntJsonSchema1 | +| ------------------------------------------------------------------ | +| validate | +| validateAndBox | + +[[Back to top]](#top) [[Back to Component Schemas]](../../../README.md#Component-Schemas) [[Back to README]](../../../README.md) diff --git a/samples/client/petstore/kotlin/docs/components/schemas/Animal.md b/samples/client/petstore/kotlin/docs/components/schemas/Animal.md new file mode 100644 index 00000000000..c4819208107 --- /dev/null +++ b/samples/client/petstore/kotlin/docs/components/schemas/Animal.md @@ -0,0 +1,259 @@ +# Animal +org.openapijsonschematools.client.components.schemas.Animal.java +public class Animal
+ +A class that contains necessary nested +- schema classes (which validate payloads), extends JsonSchema +- sealed interfaces which store validated payloads, java version of a sum type +- boxed classes which store validated payloads, sealed permits class implementations +- classes to store validated map payloads, extends FrozenMap +- classes to build inputs for map payloads + +## Nested Class Summary +| Modifier and Type | Class and Description | +| ----------------- | ---------------------- | +| sealed interface | [Animal.Animal1Boxed](#animal1boxed)
sealed interface for validated payloads | +| record | [Animal.Animal1BoxedMap](#animal1boxedmap)
boxed class to store validated Map payloads | +| static class | [Animal.Animal1](#animal1)
schema class | +| static class | [Animal.AnimalMapBuilder](#animalmapbuilder)
builder for Map payloads | +| static class | [Animal.AnimalMap](#animalmap)
output class for Map payloads | +| sealed interface | [Animal.ColorBoxed](#colorboxed)
sealed interface for validated payloads | +| record | [Animal.ColorBoxedString](#colorboxedstring)
boxed class to store validated String payloads | +| static class | [Animal.Color](#color)
schema class | +| sealed interface | [Animal.ClassNameBoxed](#classnameboxed)
sealed interface for validated payloads | +| record | [Animal.ClassNameBoxedString](#classnameboxedstring)
boxed class to store validated String payloads | +| static class | [Animal.ClassName](#classname)
schema class | + +## Animal1Boxed +public sealed interface Animal1Boxed
+permits
+[Animal1BoxedMap](#animal1boxedmap) + +sealed interface that stores validated payloads using boxed classes + +## Animal1BoxedMap +public record Animal1BoxedMap
+implements [Animal1Boxed](#animal1boxed) + +record that stores validated Map payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| Animal1BoxedMap([AnimalMap](#animalmap) data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| [AnimalMap](#animalmap) | data()
validated payload | +| @Nullable Object | getData()
validated payload | + +## Animal1 +public static class Animal1
+extends JsonSchema + +A schema class that validates payloads + +### Code Sample +``` +import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags; +import org.openapijsonschematools.client.configurations.SchemaConfiguration; +import org.openapijsonschematools.client.exceptions.ValidationException; +import org.openapijsonschematools.client.schemas.validation.MapUtils; +import org.openapijsonschematools.client.schemas.validation.FrozenList; +import org.openapijsonschematools.client.schemas.validation.FrozenMap; +import org.openapijsonschematools.client.components.schemas.Animal; + +import java.util.Arrays; +import java.util.List; +import java.util.AbstractMap; + +static final SchemaConfiguration configuration = new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().build()); + +// Map validation +Animal.AnimalMap validatedPayload = + Animal.Animal1.validate( + new Animal.AnimalMapBuilder() + .className("a") + + .color("a") + + .build(), + configuration +); +``` + +### Field Summary +| Modifier and Type | Field and Description | +| ----------------- | ---------------------- | +| Set> | type = Set.of(Map.class) | +| Map> | properties = Map.ofEntries(
    new PropertyEntry("className", [ClassName.class](#classname))),
    new PropertyEntry("color", [Color.class](#color)))
)
| +| Set | required = Set.of(
    "className"
)
| + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| [AnimalMap](#animalmap) | validate([Map<?, ?>](#animalmapbuilder) arg, SchemaConfiguration configuration) | +| [Animal1BoxedMap](#animal1boxedmap) | validateAndBox([Map<?, ?>](#animalmapbuilder) arg, SchemaConfiguration configuration) | +| [Animal1Boxed](#animal1boxed) | validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) | +| @Nullable Object | validate(@Nullable Object arg, SchemaConfiguration configuration) | + +## AnimalMap0Builder +public class AnimalMap0Builder
+builder for `Map` + +A class that builds the Map input type + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| AnimalMap0Builder(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 | +| [AnimalMap0Builder](#animalmap0builder) | color(String value) | +| [AnimalMap0Builder](#animalmap0builder) | additionalProperty(String key, Nothing? value) | +| [AnimalMap0Builder](#animalmap0builder) | additionalProperty(String key, boolean value) | +| [AnimalMap0Builder](#animalmap0builder) | additionalProperty(String key, String value) | +| [AnimalMap0Builder](#animalmap0builder) | additionalProperty(String key, int value) | +| [AnimalMap0Builder](#animalmap0builder) | additionalProperty(String key, float value) | +| [AnimalMap0Builder](#animalmap0builder) | additionalProperty(String key, long value) | +| [AnimalMap0Builder](#animalmap0builder) | additionalProperty(String key, double value) | +| [AnimalMap0Builder](#animalmap0builder) | additionalProperty(String key, List value) | +| [AnimalMap0Builder](#animalmap0builder) | additionalProperty(String key, Map value) | + +## AnimalMapBuilder +public class AnimalMapBuilder
+builder for `Map` + +A class that builds the Map input type + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| AnimalMapBuilder()
Creates a builder that contains an empty map | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| [AnimalMap0Builder](#animalmap0builder) | className(String value) | + +## AnimalMap +public static class AnimalMap
+extends FrozenMap + +A class to store validated Map payloads + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| static [AnimalMap](#animalmap) | of([Map](#animalmapbuilder) arg, SchemaConfiguration configuration) | +| String | className()
| +| String | color()
[optional] if omitted the server will use the default value of red | +| @Nullable Object | getAdditionalProperty(String name)
provides type safety for additional properties | + +## ColorBoxed +public sealed interface ColorBoxed
+permits
+[ColorBoxedString](#colorboxedstring) + +sealed interface that stores validated payloads using boxed classes + +## ColorBoxedString +public record ColorBoxedString
+implements [ColorBoxed](#colorboxed) + +record that stores validated String payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| ColorBoxedString(String data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| String | data()
validated payload | +| @Nullable Object | getData()
validated payload | + +## Color +public static class Color
+extends JsonSchema + +A schema class that validates payloads + +### Code Sample +``` +import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags; +import org.openapijsonschematools.client.configurations.SchemaConfiguration; +import org.openapijsonschematools.client.exceptions.ValidationException; +import org.openapijsonschematools.client.schemas.validation.MapUtils; +import org.openapijsonschematools.client.schemas.validation.FrozenList; +import org.openapijsonschematools.client.schemas.validation.FrozenMap; +import org.openapijsonschematools.client.components.schemas.Animal; + +import java.util.Arrays; +import java.util.List; +import java.util.AbstractMap; + +static final SchemaConfiguration configuration = new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().build()); + +// String validation +String validatedPayload = Animal.Color.validate( + "a", + configuration +); +``` + +### Field Summary +| Modifier and Type | Field and Description | +| ----------------- | ---------------------- | +| Set> | type = Set.of(
    String.class
)
| +| @Nullable Object | defaultValue = "red" | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| String | validate(String arg, SchemaConfiguration configuration) | +| [ColorBoxedString](#colorboxedstring) | validateAndBox(String arg, SchemaConfiguration configuration) | +| [ColorBoxed](#colorboxed) | validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) | +| @Nullable Object | validate(@Nullable Object arg, SchemaConfiguration configuration) | + +## ClassNameBoxed +public sealed interface ClassNameBoxed
+permits
+[ClassNameBoxedString](#classnameboxedstring) + +sealed interface that stores validated payloads using boxed classes + +## ClassNameBoxedString +public record ClassNameBoxedString
+implements [ClassNameBoxed](#classnameboxed) + +record that stores validated String payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| ClassNameBoxedString(String data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| String | data()
validated payload | +| @Nullable Object | getData()
validated payload | + +## ClassName +public static class ClassName
+extends StringJsonSchema.StringJsonSchema1 + +A schema class that validates payloads + +| Methods Inherited from class org.openapijsonschematools.client.schemas.StringJsonSchema.StringJsonSchema1 | +| ------------------------------------------------------------------ | +| validate | +| validateAndBox | + +[[Back to top]](#top) [[Back to Component Schemas]](../../../README.md#Component-Schemas) [[Back to README]](../../../README.md) diff --git a/samples/client/petstore/kotlin/docs/components/schemas/AnimalFarm.md b/samples/client/petstore/kotlin/docs/components/schemas/AnimalFarm.md new file mode 100644 index 00000000000..c00c74501b6 --- /dev/null +++ b/samples/client/petstore/kotlin/docs/components/schemas/AnimalFarm.md @@ -0,0 +1,131 @@ +# AnimalFarm +org.openapijsonschematools.client.components.schemas.AnimalFarm.java +public class AnimalFarm
+ +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 list payloads, extends FrozenList +- classes to build inputs for list payloads + +## Nested Class Summary +| Modifier and Type | Class and Description | +| ----------------- | ---------------------- | +| sealed interface | [AnimalFarm.AnimalFarm1Boxed](#animalfarm1boxed)
sealed interface for validated payloads | +| record | [AnimalFarm.AnimalFarm1BoxedList](#animalfarm1boxedlist)
boxed class to store validated List payloads | +| static class | [AnimalFarm.AnimalFarm1](#animalfarm1)
schema class | +| static class | [AnimalFarm.AnimalFarmListBuilder](#animalfarmlistbuilder)
builder for List payloads | +| static class | [AnimalFarm.AnimalFarmList](#animalfarmlist)
output class for List payloads | + +## AnimalFarm1Boxed +public sealed interface AnimalFarm1Boxed
+permits
+[AnimalFarm1BoxedList](#animalfarm1boxedlist) + +sealed interface that stores validated payloads using boxed classes + +## AnimalFarm1BoxedList +public record AnimalFarm1BoxedList
+implements [AnimalFarm1Boxed](#animalfarm1boxed) + +record that stores validated List payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| AnimalFarm1BoxedList([AnimalFarmList](#animalfarmlist) data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| [AnimalFarmList](#animalfarmlist) | data()
validated payload | +| @Nullable Object | getData()
validated payload | + +## AnimalFarm1 +public static class AnimalFarm1
+extends JsonSchema + +A schema class that validates payloads + +### Code Sample +``` +import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags; +import org.openapijsonschematools.client.configurations.SchemaConfiguration; +import org.openapijsonschematools.client.exceptions.ValidationException; +import org.openapijsonschematools.client.schemas.validation.MapUtils; +import org.openapijsonschematools.client.schemas.validation.FrozenList; +import org.openapijsonschematools.client.schemas.validation.FrozenMap; +import org.openapijsonschematools.client.components.schemas.AnimalFarm; + +import java.util.Arrays; +import java.util.List; +import java.util.AbstractMap; + +static final SchemaConfiguration configuration = new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().build()); + +// List validation +AnimalFarm.AnimalFarmList validatedPayload = + AnimalFarm.AnimalFarm1.validate( + new AnimalFarm.AnimalFarmListBuilder() + .add( + MapUtils.makeMap( + new AbstractMap.SimpleEntry( + "className", + "a" + ), + new AbstractMap.SimpleEntry( + "color", + "a" + ) + ) + ) + .build(), + configuration +); +``` + +### Field Summary +| Modifier and Type | Field and Description | +| ----------------- | ---------------------- | +| Set> | type = Set.of(List.class) | +| Class | items = [Animal.Animal1.class](../../components/schemas/Animal.md#animal1) | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| [AnimalFarmList](#animalfarmlist) | validate([List](#animalfarmlistbuilder) arg, SchemaConfiguration configuration) | +| [AnimalFarm1BoxedList](#animalfarm1boxedlist) | validateAndBox([List](#animalfarmlistbuilder) arg, SchemaConfiguration configuration) | +| [AnimalFarm1Boxed](#animalfarm1boxed) | validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) | +| @Nullable Object | validate(@Nullable Object arg, SchemaConfiguration configuration) | + +## AnimalFarmListBuilder +public class AnimalFarmListBuilder
+builder for `List>` + +A class that builds the List input type + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| AnimalFarmListBuilder()
Creates an empty list | +| AnimalFarmListBuilder(List> items)
Stores the items in a list | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| AnimalFarmListBuilder | add(Map item) | +| List> | build()
Returns list input that should be used with Schema.validate | + +## AnimalFarmList +public class AnimalFarmList
+extends `FrozenList` + +A class to store validated List payloads + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| static [AnimalFarmList](#animalfarmlist) | of([List>](#animalfarmlistbuilder) arg, SchemaConfiguration configuration) | + +[[Back to top]](#top) [[Back to Component Schemas]](../../../README.md#Component-Schemas) [[Back to README]](../../../README.md) diff --git a/samples/client/petstore/kotlin/docs/components/schemas/AnyTypeAndFormat.md b/samples/client/petstore/kotlin/docs/components/schemas/AnyTypeAndFormat.md new file mode 100644 index 00000000000..b313ae64ea0 --- /dev/null +++ b/samples/client/petstore/kotlin/docs/components/schemas/AnyTypeAndFormat.md @@ -0,0 +1,1608 @@ +# AnyTypeAndFormat +org.openapijsonschematools.client.components.schemas.AnyTypeAndFormat.java +public class AnyTypeAndFormat
+ +A class that contains necessary nested +- schema classes (which validate payloads), extends JsonSchema +- sealed interfaces which store validated payloads, java version of a sum type +- boxed classes which store validated payloads, sealed permits class implementations +- classes to store validated map payloads, extends FrozenMap +- classes to build inputs for map payloads + +## Nested Class Summary +| Modifier and Type | Class and Description | +| ----------------- | ---------------------- | +| sealed interface | [AnyTypeAndFormat.AnyTypeAndFormat1Boxed](#anytypeandformat1boxed)
sealed interface for validated payloads | +| record | [AnyTypeAndFormat.AnyTypeAndFormat1BoxedMap](#anytypeandformat1boxedmap)
boxed class to store validated Map payloads | +| static class | [AnyTypeAndFormat.AnyTypeAndFormat1](#anytypeandformat1)
schema class | +| static class | [AnyTypeAndFormat.AnyTypeAndFormatMapBuilder](#anytypeandformatmapbuilder)
builder for Map payloads | +| static class | [AnyTypeAndFormat.AnyTypeAndFormatMap](#anytypeandformatmap)
output class for Map payloads | +| sealed interface | [AnyTypeAndFormat.FloatSchemaBoxed](#floatschemaboxed)
sealed interface for validated payloads | +| record | [AnyTypeAndFormat.FloatSchemaBoxedVoid](#floatschemaboxedvoid)
boxed class to store validated null payloads | +| record | [AnyTypeAndFormat.FloatSchemaBoxedBoolean](#floatschemaboxedboolean)
boxed class to store validated boolean payloads | +| record | [AnyTypeAndFormat.FloatSchemaBoxedNumber](#floatschemaboxednumber)
boxed class to store validated Number payloads | +| record | [AnyTypeAndFormat.FloatSchemaBoxedString](#floatschemaboxedstring)
boxed class to store validated String payloads | +| record | [AnyTypeAndFormat.FloatSchemaBoxedList](#floatschemaboxedlist)
boxed class to store validated List payloads | +| record | [AnyTypeAndFormat.FloatSchemaBoxedMap](#floatschemaboxedmap)
boxed class to store validated Map payloads | +| static class | [AnyTypeAndFormat.FloatSchema](#floatschema)
schema class | +| sealed interface | [AnyTypeAndFormat.DoubleSchemaBoxed](#doubleschemaboxed)
sealed interface for validated payloads | +| record | [AnyTypeAndFormat.DoubleSchemaBoxedVoid](#doubleschemaboxedvoid)
boxed class to store validated null payloads | +| record | [AnyTypeAndFormat.DoubleSchemaBoxedBoolean](#doubleschemaboxedboolean)
boxed class to store validated boolean payloads | +| record | [AnyTypeAndFormat.DoubleSchemaBoxedNumber](#doubleschemaboxednumber)
boxed class to store validated Number payloads | +| record | [AnyTypeAndFormat.DoubleSchemaBoxedString](#doubleschemaboxedstring)
boxed class to store validated String payloads | +| record | [AnyTypeAndFormat.DoubleSchemaBoxedList](#doubleschemaboxedlist)
boxed class to store validated List payloads | +| record | [AnyTypeAndFormat.DoubleSchemaBoxedMap](#doubleschemaboxedmap)
boxed class to store validated Map payloads | +| static class | [AnyTypeAndFormat.DoubleSchema](#doubleschema)
schema class | +| sealed interface | [AnyTypeAndFormat.Int64Boxed](#int64boxed)
sealed interface for validated payloads | +| record | [AnyTypeAndFormat.Int64BoxedVoid](#int64boxedvoid)
boxed class to store validated null payloads | +| record | [AnyTypeAndFormat.Int64BoxedBoolean](#int64boxedboolean)
boxed class to store validated boolean payloads | +| record | [AnyTypeAndFormat.Int64BoxedNumber](#int64boxednumber)
boxed class to store validated Number payloads | +| record | [AnyTypeAndFormat.Int64BoxedString](#int64boxedstring)
boxed class to store validated String payloads | +| record | [AnyTypeAndFormat.Int64BoxedList](#int64boxedlist)
boxed class to store validated List payloads | +| record | [AnyTypeAndFormat.Int64BoxedMap](#int64boxedmap)
boxed class to store validated Map payloads | +| static class | [AnyTypeAndFormat.Int64](#int64)
schema class | +| sealed interface | [AnyTypeAndFormat.Int32Boxed](#int32boxed)
sealed interface for validated payloads | +| record | [AnyTypeAndFormat.Int32BoxedVoid](#int32boxedvoid)
boxed class to store validated null payloads | +| record | [AnyTypeAndFormat.Int32BoxedBoolean](#int32boxedboolean)
boxed class to store validated boolean payloads | +| record | [AnyTypeAndFormat.Int32BoxedNumber](#int32boxednumber)
boxed class to store validated Number payloads | +| record | [AnyTypeAndFormat.Int32BoxedString](#int32boxedstring)
boxed class to store validated String payloads | +| record | [AnyTypeAndFormat.Int32BoxedList](#int32boxedlist)
boxed class to store validated List payloads | +| record | [AnyTypeAndFormat.Int32BoxedMap](#int32boxedmap)
boxed class to store validated Map payloads | +| static class | [AnyTypeAndFormat.Int32](#int32)
schema class | +| sealed interface | [AnyTypeAndFormat.BinaryBoxed](#binaryboxed)
sealed interface for validated payloads | +| record | [AnyTypeAndFormat.BinaryBoxedVoid](#binaryboxedvoid)
boxed class to store validated null payloads | +| record | [AnyTypeAndFormat.BinaryBoxedBoolean](#binaryboxedboolean)
boxed class to store validated boolean payloads | +| record | [AnyTypeAndFormat.BinaryBoxedNumber](#binaryboxednumber)
boxed class to store validated Number payloads | +| record | [AnyTypeAndFormat.BinaryBoxedString](#binaryboxedstring)
boxed class to store validated String payloads | +| record | [AnyTypeAndFormat.BinaryBoxedList](#binaryboxedlist)
boxed class to store validated List payloads | +| record | [AnyTypeAndFormat.BinaryBoxedMap](#binaryboxedmap)
boxed class to store validated Map payloads | +| static class | [AnyTypeAndFormat.Binary](#binary)
schema class | +| sealed interface | [AnyTypeAndFormat.NumberSchemaBoxed](#numberschemaboxed)
sealed interface for validated payloads | +| record | [AnyTypeAndFormat.NumberSchemaBoxedVoid](#numberschemaboxedvoid)
boxed class to store validated null payloads | +| record | [AnyTypeAndFormat.NumberSchemaBoxedBoolean](#numberschemaboxedboolean)
boxed class to store validated boolean payloads | +| record | [AnyTypeAndFormat.NumberSchemaBoxedNumber](#numberschemaboxednumber)
boxed class to store validated Number payloads | +| record | [AnyTypeAndFormat.NumberSchemaBoxedString](#numberschemaboxedstring)
boxed class to store validated String payloads | +| record | [AnyTypeAndFormat.NumberSchemaBoxedList](#numberschemaboxedlist)
boxed class to store validated List payloads | +| record | [AnyTypeAndFormat.NumberSchemaBoxedMap](#numberschemaboxedmap)
boxed class to store validated Map payloads | +| static class | [AnyTypeAndFormat.NumberSchema](#numberschema)
schema class | +| sealed interface | [AnyTypeAndFormat.DatetimeBoxed](#datetimeboxed)
sealed interface for validated payloads | +| record | [AnyTypeAndFormat.DatetimeBoxedVoid](#datetimeboxedvoid)
boxed class to store validated null payloads | +| record | [AnyTypeAndFormat.DatetimeBoxedBoolean](#datetimeboxedboolean)
boxed class to store validated boolean payloads | +| record | [AnyTypeAndFormat.DatetimeBoxedNumber](#datetimeboxednumber)
boxed class to store validated Number payloads | +| record | [AnyTypeAndFormat.DatetimeBoxedString](#datetimeboxedstring)
boxed class to store validated String payloads | +| record | [AnyTypeAndFormat.DatetimeBoxedList](#datetimeboxedlist)
boxed class to store validated List payloads | +| record | [AnyTypeAndFormat.DatetimeBoxedMap](#datetimeboxedmap)
boxed class to store validated Map payloads | +| static class | [AnyTypeAndFormat.Datetime](#datetime)
schema class | +| sealed interface | [AnyTypeAndFormat.DateBoxed](#dateboxed)
sealed interface for validated payloads | +| record | [AnyTypeAndFormat.DateBoxedVoid](#dateboxedvoid)
boxed class to store validated null payloads | +| record | [AnyTypeAndFormat.DateBoxedBoolean](#dateboxedboolean)
boxed class to store validated boolean payloads | +| record | [AnyTypeAndFormat.DateBoxedNumber](#dateboxednumber)
boxed class to store validated Number payloads | +| record | [AnyTypeAndFormat.DateBoxedString](#dateboxedstring)
boxed class to store validated String payloads | +| record | [AnyTypeAndFormat.DateBoxedList](#dateboxedlist)
boxed class to store validated List payloads | +| record | [AnyTypeAndFormat.DateBoxedMap](#dateboxedmap)
boxed class to store validated Map payloads | +| static class | [AnyTypeAndFormat.Date](#date)
schema class | +| sealed interface | [AnyTypeAndFormat.UuidSchemaBoxed](#uuidschemaboxed)
sealed interface for validated payloads | +| record | [AnyTypeAndFormat.UuidSchemaBoxedVoid](#uuidschemaboxedvoid)
boxed class to store validated null payloads | +| record | [AnyTypeAndFormat.UuidSchemaBoxedBoolean](#uuidschemaboxedboolean)
boxed class to store validated boolean payloads | +| record | [AnyTypeAndFormat.UuidSchemaBoxedNumber](#uuidschemaboxednumber)
boxed class to store validated Number payloads | +| record | [AnyTypeAndFormat.UuidSchemaBoxedString](#uuidschemaboxedstring)
boxed class to store validated String payloads | +| record | [AnyTypeAndFormat.UuidSchemaBoxedList](#uuidschemaboxedlist)
boxed class to store validated List payloads | +| record | [AnyTypeAndFormat.UuidSchemaBoxedMap](#uuidschemaboxedmap)
boxed class to store validated Map payloads | +| static class | [AnyTypeAndFormat.UuidSchema](#uuidschema)
schema class | + +## AnyTypeAndFormat1Boxed +public sealed interface AnyTypeAndFormat1Boxed
+permits
+[AnyTypeAndFormat1BoxedMap](#anytypeandformat1boxedmap) + +sealed interface that stores validated payloads using boxed classes + +## AnyTypeAndFormat1BoxedMap +public record AnyTypeAndFormat1BoxedMap
+implements [AnyTypeAndFormat1Boxed](#anytypeandformat1boxed) + +record that stores validated Map payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| AnyTypeAndFormat1BoxedMap([AnyTypeAndFormatMap](#anytypeandformatmap) data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| [AnyTypeAndFormatMap](#anytypeandformatmap) | data()
validated payload | +| @Nullable Object | getData()
validated payload | + +## AnyTypeAndFormat1 +public static class AnyTypeAndFormat1
+extends JsonSchema + +A schema class that validates payloads + +### Code Sample +``` +import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags; +import org.openapijsonschematools.client.configurations.SchemaConfiguration; +import org.openapijsonschematools.client.exceptions.ValidationException; +import org.openapijsonschematools.client.schemas.validation.MapUtils; +import org.openapijsonschematools.client.schemas.validation.FrozenList; +import org.openapijsonschematools.client.schemas.validation.FrozenMap; +import org.openapijsonschematools.client.components.schemas.AnyTypeAndFormat; + +import java.util.Arrays; +import java.util.List; +import java.util.AbstractMap; + +static final SchemaConfiguration configuration = new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().build()); + +// Map validation +AnyTypeAndFormat.AnyTypeAndFormatMap validatedPayload = + AnyTypeAndFormat.AnyTypeAndFormat1.validate( + new AnyTypeAndFormat.AnyTypeAndFormatMapBuilder() + .build(), + configuration +); +``` + +### Field Summary +| Modifier and Type | Field and Description | +| ----------------- | ---------------------- | +| Set> | type = Set.of(Map.class) | +| Map> | properties = Map.ofEntries(
    new PropertyEntry("uuid", [UuidSchema.class](#uuidschema))),
    new PropertyEntry("date", [Date.class](#date))),
    new PropertyEntry("date-time", [Datetime.class](#datetime))),
    new PropertyEntry("number", [NumberSchema.class](#numberschema))),
    new PropertyEntry("binary", [Binary.class](#binary))),
    new PropertyEntry("int32", [Int32.class](#int32))),
    new PropertyEntry("int64", [Int64.class](#int64))),
    new PropertyEntry("double", [DoubleSchema.class](#doubleschema))),
    new PropertyEntry("float", [FloatSchema.class](#floatschema)))
)
| + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| [AnyTypeAndFormatMap](#anytypeandformatmap) | validate([Map<?, ?>](#anytypeandformatmapbuilder) arg, SchemaConfiguration configuration) | +| [AnyTypeAndFormat1BoxedMap](#anytypeandformat1boxedmap) | validateAndBox([Map<?, ?>](#anytypeandformatmapbuilder) arg, SchemaConfiguration configuration) | +| [AnyTypeAndFormat1Boxed](#anytypeandformat1boxed) | validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) | +| @Nullable Object | validate(@Nullable Object arg, SchemaConfiguration configuration) | + +## AnyTypeAndFormatMapBuilder +public class AnyTypeAndFormatMapBuilder
+builder for `Map` + +A class that builds the Map input type + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| AnyTypeAndFormatMapBuilder()
Creates a builder that contains an empty map | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| Map | build()
Returns map input that should be used with Schema.validate | +| [AnyTypeAndFormatMapBuilder](#anytypeandformatmapbuilder) | setUuid(Nothing? value) | +| [AnyTypeAndFormatMapBuilder](#anytypeandformatmapbuilder) | setUuid(boolean value) | +| [AnyTypeAndFormatMapBuilder](#anytypeandformatmapbuilder) | setUuid(String value) | +| [AnyTypeAndFormatMapBuilder](#anytypeandformatmapbuilder) | setUuid(int value) | +| [AnyTypeAndFormatMapBuilder](#anytypeandformatmapbuilder) | setUuid(float value) | +| [AnyTypeAndFormatMapBuilder](#anytypeandformatmapbuilder) | setUuid(long value) | +| [AnyTypeAndFormatMapBuilder](#anytypeandformatmapbuilder) | setUuid(double value) | +| [AnyTypeAndFormatMapBuilder](#anytypeandformatmapbuilder) | setUuid(List value) | +| [AnyTypeAndFormatMapBuilder](#anytypeandformatmapbuilder) | setUuid(Map value) | +| [AnyTypeAndFormatMapBuilder](#anytypeandformatmapbuilder) | date(Nothing? value) | +| [AnyTypeAndFormatMapBuilder](#anytypeandformatmapbuilder) | date(boolean value) | +| [AnyTypeAndFormatMapBuilder](#anytypeandformatmapbuilder) | date(String value) | +| [AnyTypeAndFormatMapBuilder](#anytypeandformatmapbuilder) | date(int value) | +| [AnyTypeAndFormatMapBuilder](#anytypeandformatmapbuilder) | date(float value) | +| [AnyTypeAndFormatMapBuilder](#anytypeandformatmapbuilder) | date(long value) | +| [AnyTypeAndFormatMapBuilder](#anytypeandformatmapbuilder) | date(double value) | +| [AnyTypeAndFormatMapBuilder](#anytypeandformatmapbuilder) | date(List value) | +| [AnyTypeAndFormatMapBuilder](#anytypeandformatmapbuilder) | date(Map value) | +| [AnyTypeAndFormatMapBuilder](#anytypeandformatmapbuilder) | dateHyphenMinusTime(Nothing? value) | +| [AnyTypeAndFormatMapBuilder](#anytypeandformatmapbuilder) | dateHyphenMinusTime(boolean value) | +| [AnyTypeAndFormatMapBuilder](#anytypeandformatmapbuilder) | dateHyphenMinusTime(String value) | +| [AnyTypeAndFormatMapBuilder](#anytypeandformatmapbuilder) | dateHyphenMinusTime(int value) | +| [AnyTypeAndFormatMapBuilder](#anytypeandformatmapbuilder) | dateHyphenMinusTime(float value) | +| [AnyTypeAndFormatMapBuilder](#anytypeandformatmapbuilder) | dateHyphenMinusTime(long value) | +| [AnyTypeAndFormatMapBuilder](#anytypeandformatmapbuilder) | dateHyphenMinusTime(double value) | +| [AnyTypeAndFormatMapBuilder](#anytypeandformatmapbuilder) | dateHyphenMinusTime(List value) | +| [AnyTypeAndFormatMapBuilder](#anytypeandformatmapbuilder) | dateHyphenMinusTime(Map value) | +| [AnyTypeAndFormatMapBuilder](#anytypeandformatmapbuilder) | setNumber(Nothing? value) | +| [AnyTypeAndFormatMapBuilder](#anytypeandformatmapbuilder) | setNumber(boolean value) | +| [AnyTypeAndFormatMapBuilder](#anytypeandformatmapbuilder) | setNumber(String value) | +| [AnyTypeAndFormatMapBuilder](#anytypeandformatmapbuilder) | setNumber(int value) | +| [AnyTypeAndFormatMapBuilder](#anytypeandformatmapbuilder) | setNumber(float value) | +| [AnyTypeAndFormatMapBuilder](#anytypeandformatmapbuilder) | setNumber(long value) | +| [AnyTypeAndFormatMapBuilder](#anytypeandformatmapbuilder) | setNumber(double value) | +| [AnyTypeAndFormatMapBuilder](#anytypeandformatmapbuilder) | setNumber(List value) | +| [AnyTypeAndFormatMapBuilder](#anytypeandformatmapbuilder) | setNumber(Map value) | +| [AnyTypeAndFormatMapBuilder](#anytypeandformatmapbuilder) | binary(Nothing? value) | +| [AnyTypeAndFormatMapBuilder](#anytypeandformatmapbuilder) | binary(boolean value) | +| [AnyTypeAndFormatMapBuilder](#anytypeandformatmapbuilder) | binary(String value) | +| [AnyTypeAndFormatMapBuilder](#anytypeandformatmapbuilder) | binary(int value) | +| [AnyTypeAndFormatMapBuilder](#anytypeandformatmapbuilder) | binary(float value) | +| [AnyTypeAndFormatMapBuilder](#anytypeandformatmapbuilder) | binary(long value) | +| [AnyTypeAndFormatMapBuilder](#anytypeandformatmapbuilder) | binary(double value) | +| [AnyTypeAndFormatMapBuilder](#anytypeandformatmapbuilder) | binary(List value) | +| [AnyTypeAndFormatMapBuilder](#anytypeandformatmapbuilder) | binary(Map value) | +| [AnyTypeAndFormatMapBuilder](#anytypeandformatmapbuilder) | int32(Nothing? value) | +| [AnyTypeAndFormatMapBuilder](#anytypeandformatmapbuilder) | int32(boolean value) | +| [AnyTypeAndFormatMapBuilder](#anytypeandformatmapbuilder) | int32(String value) | +| [AnyTypeAndFormatMapBuilder](#anytypeandformatmapbuilder) | int32(int value) | +| [AnyTypeAndFormatMapBuilder](#anytypeandformatmapbuilder) | int32(float value) | +| [AnyTypeAndFormatMapBuilder](#anytypeandformatmapbuilder) | int32(long value) | +| [AnyTypeAndFormatMapBuilder](#anytypeandformatmapbuilder) | int32(double value) | +| [AnyTypeAndFormatMapBuilder](#anytypeandformatmapbuilder) | int32(List value) | +| [AnyTypeAndFormatMapBuilder](#anytypeandformatmapbuilder) | int32(Map value) | +| [AnyTypeAndFormatMapBuilder](#anytypeandformatmapbuilder) | int64(Nothing? value) | +| [AnyTypeAndFormatMapBuilder](#anytypeandformatmapbuilder) | int64(boolean value) | +| [AnyTypeAndFormatMapBuilder](#anytypeandformatmapbuilder) | int64(String value) | +| [AnyTypeAndFormatMapBuilder](#anytypeandformatmapbuilder) | int64(int value) | +| [AnyTypeAndFormatMapBuilder](#anytypeandformatmapbuilder) | int64(float value) | +| [AnyTypeAndFormatMapBuilder](#anytypeandformatmapbuilder) | int64(long value) | +| [AnyTypeAndFormatMapBuilder](#anytypeandformatmapbuilder) | int64(double value) | +| [AnyTypeAndFormatMapBuilder](#anytypeandformatmapbuilder) | int64(List value) | +| [AnyTypeAndFormatMapBuilder](#anytypeandformatmapbuilder) | int64(Map value) | +| [AnyTypeAndFormatMapBuilder](#anytypeandformatmapbuilder) | setDouble(Nothing? value) | +| [AnyTypeAndFormatMapBuilder](#anytypeandformatmapbuilder) | setDouble(boolean value) | +| [AnyTypeAndFormatMapBuilder](#anytypeandformatmapbuilder) | setDouble(String value) | +| [AnyTypeAndFormatMapBuilder](#anytypeandformatmapbuilder) | setDouble(int value) | +| [AnyTypeAndFormatMapBuilder](#anytypeandformatmapbuilder) | setDouble(float value) | +| [AnyTypeAndFormatMapBuilder](#anytypeandformatmapbuilder) | setDouble(long value) | +| [AnyTypeAndFormatMapBuilder](#anytypeandformatmapbuilder) | setDouble(double value) | +| [AnyTypeAndFormatMapBuilder](#anytypeandformatmapbuilder) | setDouble(List value) | +| [AnyTypeAndFormatMapBuilder](#anytypeandformatmapbuilder) | setDouble(Map value) | +| [AnyTypeAndFormatMapBuilder](#anytypeandformatmapbuilder) | setFloat(Nothing? value) | +| [AnyTypeAndFormatMapBuilder](#anytypeandformatmapbuilder) | setFloat(boolean value) | +| [AnyTypeAndFormatMapBuilder](#anytypeandformatmapbuilder) | setFloat(String value) | +| [AnyTypeAndFormatMapBuilder](#anytypeandformatmapbuilder) | setFloat(int value) | +| [AnyTypeAndFormatMapBuilder](#anytypeandformatmapbuilder) | setFloat(float value) | +| [AnyTypeAndFormatMapBuilder](#anytypeandformatmapbuilder) | setFloat(long value) | +| [AnyTypeAndFormatMapBuilder](#anytypeandformatmapbuilder) | setFloat(double value) | +| [AnyTypeAndFormatMapBuilder](#anytypeandformatmapbuilder) | setFloat(List value) | +| [AnyTypeAndFormatMapBuilder](#anytypeandformatmapbuilder) | setFloat(Map value) | +| [AnyTypeAndFormatMapBuilder](#anytypeandformatmapbuilder) | additionalProperty(String key, Nothing? value) | +| [AnyTypeAndFormatMapBuilder](#anytypeandformatmapbuilder) | additionalProperty(String key, boolean value) | +| [AnyTypeAndFormatMapBuilder](#anytypeandformatmapbuilder) | additionalProperty(String key, String value) | +| [AnyTypeAndFormatMapBuilder](#anytypeandformatmapbuilder) | additionalProperty(String key, int value) | +| [AnyTypeAndFormatMapBuilder](#anytypeandformatmapbuilder) | additionalProperty(String key, float value) | +| [AnyTypeAndFormatMapBuilder](#anytypeandformatmapbuilder) | additionalProperty(String key, long value) | +| [AnyTypeAndFormatMapBuilder](#anytypeandformatmapbuilder) | additionalProperty(String key, double value) | +| [AnyTypeAndFormatMapBuilder](#anytypeandformatmapbuilder) | additionalProperty(String key, List value) | +| [AnyTypeAndFormatMapBuilder](#anytypeandformatmapbuilder) | additionalProperty(String key, Map value) | + +## AnyTypeAndFormatMap +public static class AnyTypeAndFormatMap
+extends FrozenMap + +A class to store validated Map payloads + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| static [AnyTypeAndFormatMap](#anytypeandformatmap) | of([Map](#anytypeandformatmapbuilder) arg, SchemaConfiguration configuration) | +| @Nullable Object | date()
[optional] value must conform to RFC-3339 full-date YYYY-MM-DD | +| @Nullable Object | binary()
[optional] | +| @Nullable Object | int32()
[optional] value must be a 32 bit integer | +| @Nullable Object | int64()
[optional] value must be a 64 bit integer | +| @Nullable Object | get(String key)
This schema has invalid Java names so this method must be used when you access instance["uuid"], instance["date-time"], instance["number"], instance["double"], instance["float"], | +| @Nullable Object | getAdditionalProperty(String name)
provides type safety for additional properties | + +## FloatSchemaBoxed +public sealed interface FloatSchemaBoxed
+permits
+[FloatSchemaBoxedVoid](#floatschemaboxedvoid), +[FloatSchemaBoxedBoolean](#floatschemaboxedboolean), +[FloatSchemaBoxedNumber](#floatschemaboxednumber), +[FloatSchemaBoxedString](#floatschemaboxedstring), +[FloatSchemaBoxedList](#floatschemaboxedlist), +[FloatSchemaBoxedMap](#floatschemaboxedmap) + +sealed interface that stores validated payloads using boxed classes + +## FloatSchemaBoxedVoid +public record FloatSchemaBoxedVoid
+implements [FloatSchemaBoxed](#floatschemaboxed) + +record that stores validated null payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| FloatSchemaBoxedVoid(Nothing? data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| Nothing? | data()
validated payload | +| @Nullable Object | getData()
validated payload | + +## FloatSchemaBoxedBoolean +public record FloatSchemaBoxedBoolean
+implements [FloatSchemaBoxed](#floatschemaboxed) + +record that stores validated boolean payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| FloatSchemaBoxedBoolean(boolean data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| boolean | data()
validated payload | +| @Nullable Object | getData()
validated payload | + +## FloatSchemaBoxedNumber +public record FloatSchemaBoxedNumber
+implements [FloatSchemaBoxed](#floatschemaboxed) + +record that stores validated Number payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| FloatSchemaBoxedNumber(Number data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| Number | data()
validated payload | +| @Nullable Object | getData()
validated payload | + +## FloatSchemaBoxedString +public record FloatSchemaBoxedString
+implements [FloatSchemaBoxed](#floatschemaboxed) + +record that stores validated String payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| FloatSchemaBoxedString(String data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| String | data()
validated payload | +| @Nullable Object | getData()
validated payload | + +## FloatSchemaBoxedList +public record FloatSchemaBoxedList
+implements [FloatSchemaBoxed](#floatschemaboxed) + +record that stores validated List payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| FloatSchemaBoxedList(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 | + +## FloatSchemaBoxedMap +public record FloatSchemaBoxedMap
+implements [FloatSchemaBoxed](#floatschemaboxed) + +record that stores validated Map payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| FloatSchemaBoxedMap(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 | + +## FloatSchema +public static class FloatSchema
+extends JsonSchema + +A schema class that validates payloads + +### Field Summary +| Modifier and Type | Field and Description | +| ----------------- | ---------------------- | +| String | type = "float"; | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| String | validate(String arg, SchemaConfiguration configuration) | +| Nothing? | validate(Nothing? arg, SchemaConfiguration configuration) | +| int | validate(int arg, SchemaConfiguration configuration) | +| long | validate(long arg, SchemaConfiguration configuration) | +| float | validate(float arg, SchemaConfiguration configuration) | +| double | validate(double arg, SchemaConfiguration configuration) | +| Number | validate(Number arg, SchemaConfiguration configuration) | +| boolean | validate(boolean arg, SchemaConfiguration configuration) | +| FrozenMap<@Nullable Object> | validate(Map<?, ?> arg, SchemaConfiguration configuration) | +| FrozenList<@Nullable Object> | validate(List arg, SchemaConfiguration configuration) | +| [FloatSchemaBoxedString](#floatschemaboxedstring) | validateAndBox(String arg, SchemaConfiguration configuration) | +| [FloatSchemaBoxedVoid](#floatschemaboxedvoid) | validateAndBox(Nothing? arg, SchemaConfiguration configuration) | +| [FloatSchemaBoxedNumber](#floatschemaboxednumber) | validateAndBox(Number arg, SchemaConfiguration configuration) | +| [FloatSchemaBoxedBoolean](#floatschemaboxedboolean) | validateAndBox(boolean arg, SchemaConfiguration configuration) | +| [FloatSchemaBoxedMap](#floatschemaboxedmap) | validateAndBox(Map<?, ?> arg, SchemaConfiguration configuration) | +| [FloatSchemaBoxedList](#floatschemaboxedlist) | validateAndBox(List arg, SchemaConfiguration configuration) | +| [FloatSchemaBoxed](#floatschemaboxed) | validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) | +| @Nullable Object | validate(@Nullable Object arg, SchemaConfiguration configuration) | + +## DoubleSchemaBoxed +public sealed interface DoubleSchemaBoxed
+permits
+[DoubleSchemaBoxedVoid](#doubleschemaboxedvoid), +[DoubleSchemaBoxedBoolean](#doubleschemaboxedboolean), +[DoubleSchemaBoxedNumber](#doubleschemaboxednumber), +[DoubleSchemaBoxedString](#doubleschemaboxedstring), +[DoubleSchemaBoxedList](#doubleschemaboxedlist), +[DoubleSchemaBoxedMap](#doubleschemaboxedmap) + +sealed interface that stores validated payloads using boxed classes + +## DoubleSchemaBoxedVoid +public record DoubleSchemaBoxedVoid
+implements [DoubleSchemaBoxed](#doubleschemaboxed) + +record that stores validated null payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| DoubleSchemaBoxedVoid(Nothing? data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| Nothing? | data()
validated payload | +| @Nullable Object | getData()
validated payload | + +## DoubleSchemaBoxedBoolean +public record DoubleSchemaBoxedBoolean
+implements [DoubleSchemaBoxed](#doubleschemaboxed) + +record that stores validated boolean payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| DoubleSchemaBoxedBoolean(boolean data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| boolean | data()
validated payload | +| @Nullable Object | getData()
validated payload | + +## DoubleSchemaBoxedNumber +public record DoubleSchemaBoxedNumber
+implements [DoubleSchemaBoxed](#doubleschemaboxed) + +record that stores validated Number payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| DoubleSchemaBoxedNumber(Number data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| Number | data()
validated payload | +| @Nullable Object | getData()
validated payload | + +## DoubleSchemaBoxedString +public record DoubleSchemaBoxedString
+implements [DoubleSchemaBoxed](#doubleschemaboxed) + +record that stores validated String payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| DoubleSchemaBoxedString(String data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| String | data()
validated payload | +| @Nullable Object | getData()
validated payload | + +## DoubleSchemaBoxedList +public record DoubleSchemaBoxedList
+implements [DoubleSchemaBoxed](#doubleschemaboxed) + +record that stores validated List payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| DoubleSchemaBoxedList(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 | + +## DoubleSchemaBoxedMap +public record DoubleSchemaBoxedMap
+implements [DoubleSchemaBoxed](#doubleschemaboxed) + +record that stores validated Map payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| DoubleSchemaBoxedMap(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 | + +## DoubleSchema +public static class DoubleSchema
+extends JsonSchema + +A schema class that validates payloads + +### Field Summary +| Modifier and Type | Field and Description | +| ----------------- | ---------------------- | +| String | type = "double"; | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| String | validate(String arg, SchemaConfiguration configuration) | +| Nothing? | validate(Nothing? arg, SchemaConfiguration configuration) | +| int | validate(int arg, SchemaConfiguration configuration) | +| long | validate(long arg, SchemaConfiguration configuration) | +| float | validate(float arg, SchemaConfiguration configuration) | +| double | validate(double arg, SchemaConfiguration configuration) | +| Number | validate(Number arg, SchemaConfiguration configuration) | +| boolean | validate(boolean arg, SchemaConfiguration configuration) | +| FrozenMap<@Nullable Object> | validate(Map<?, ?> arg, SchemaConfiguration configuration) | +| FrozenList<@Nullable Object> | validate(List arg, SchemaConfiguration configuration) | +| [DoubleSchemaBoxedString](#doubleschemaboxedstring) | validateAndBox(String arg, SchemaConfiguration configuration) | +| [DoubleSchemaBoxedVoid](#doubleschemaboxedvoid) | validateAndBox(Nothing? arg, SchemaConfiguration configuration) | +| [DoubleSchemaBoxedNumber](#doubleschemaboxednumber) | validateAndBox(Number arg, SchemaConfiguration configuration) | +| [DoubleSchemaBoxedBoolean](#doubleschemaboxedboolean) | validateAndBox(boolean arg, SchemaConfiguration configuration) | +| [DoubleSchemaBoxedMap](#doubleschemaboxedmap) | validateAndBox(Map<?, ?> arg, SchemaConfiguration configuration) | +| [DoubleSchemaBoxedList](#doubleschemaboxedlist) | validateAndBox(List arg, SchemaConfiguration configuration) | +| [DoubleSchemaBoxed](#doubleschemaboxed) | validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) | +| @Nullable Object | validate(@Nullable Object arg, SchemaConfiguration configuration) | + +## Int64Boxed +public sealed interface Int64Boxed
+permits
+[Int64BoxedVoid](#int64boxedvoid), +[Int64BoxedBoolean](#int64boxedboolean), +[Int64BoxedNumber](#int64boxednumber), +[Int64BoxedString](#int64boxedstring), +[Int64BoxedList](#int64boxedlist), +[Int64BoxedMap](#int64boxedmap) + +sealed interface that stores validated payloads using boxed classes + +## Int64BoxedVoid +public record Int64BoxedVoid
+implements [Int64Boxed](#int64boxed) + +record that stores validated null payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| Int64BoxedVoid(Nothing? data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| Nothing? | data()
validated payload | +| @Nullable Object | getData()
validated payload | + +## Int64BoxedBoolean +public record Int64BoxedBoolean
+implements [Int64Boxed](#int64boxed) + +record that stores validated boolean payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| Int64BoxedBoolean(boolean data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| boolean | data()
validated payload | +| @Nullable Object | getData()
validated payload | + +## Int64BoxedNumber +public record Int64BoxedNumber
+implements [Int64Boxed](#int64boxed) + +record that stores validated Number payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| Int64BoxedNumber(Number data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| Number | data()
validated payload | +| @Nullable Object | getData()
validated payload | + +## Int64BoxedString +public record Int64BoxedString
+implements [Int64Boxed](#int64boxed) + +record that stores validated String payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| Int64BoxedString(String data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| String | data()
validated payload | +| @Nullable Object | getData()
validated payload | + +## Int64BoxedList +public record Int64BoxedList
+implements [Int64Boxed](#int64boxed) + +record that stores validated List payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| Int64BoxedList(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 | + +## Int64BoxedMap +public record Int64BoxedMap
+implements [Int64Boxed](#int64boxed) + +record that stores validated Map payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| Int64BoxedMap(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 | + +## Int64 +public static class Int64
+extends JsonSchema + +A schema class that validates payloads + +### Field Summary +| Modifier and Type | Field and Description | +| ----------------- | ---------------------- | +| String | type = "int64"; | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| String | validate(String arg, SchemaConfiguration configuration) | +| Nothing? | validate(Nothing? arg, SchemaConfiguration configuration) | +| int | validate(int arg, SchemaConfiguration configuration) | +| long | validate(long arg, SchemaConfiguration configuration) | +| float | validate(float arg, SchemaConfiguration configuration) | +| double | validate(double arg, SchemaConfiguration configuration) | +| Number | validate(Number arg, SchemaConfiguration configuration) | +| boolean | validate(boolean arg, SchemaConfiguration configuration) | +| FrozenMap<@Nullable Object> | validate(Map<?, ?> arg, SchemaConfiguration configuration) | +| FrozenList<@Nullable Object> | validate(List arg, SchemaConfiguration configuration) | +| [Int64BoxedString](#int64boxedstring) | validateAndBox(String arg, SchemaConfiguration configuration) | +| [Int64BoxedVoid](#int64boxedvoid) | validateAndBox(Nothing? arg, SchemaConfiguration configuration) | +| [Int64BoxedNumber](#int64boxednumber) | validateAndBox(Number arg, SchemaConfiguration configuration) | +| [Int64BoxedBoolean](#int64boxedboolean) | validateAndBox(boolean arg, SchemaConfiguration configuration) | +| [Int64BoxedMap](#int64boxedmap) | validateAndBox(Map<?, ?> arg, SchemaConfiguration configuration) | +| [Int64BoxedList](#int64boxedlist) | validateAndBox(List arg, SchemaConfiguration configuration) | +| [Int64Boxed](#int64boxed) | validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) | +| @Nullable Object | validate(@Nullable Object arg, SchemaConfiguration configuration) | + +## Int32Boxed +public sealed interface Int32Boxed
+permits
+[Int32BoxedVoid](#int32boxedvoid), +[Int32BoxedBoolean](#int32boxedboolean), +[Int32BoxedNumber](#int32boxednumber), +[Int32BoxedString](#int32boxedstring), +[Int32BoxedList](#int32boxedlist), +[Int32BoxedMap](#int32boxedmap) + +sealed interface that stores validated payloads using boxed classes + +## Int32BoxedVoid +public record Int32BoxedVoid
+implements [Int32Boxed](#int32boxed) + +record that stores validated null payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| Int32BoxedVoid(Nothing? data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| Nothing? | data()
validated payload | +| @Nullable Object | getData()
validated payload | + +## Int32BoxedBoolean +public record Int32BoxedBoolean
+implements [Int32Boxed](#int32boxed) + +record that stores validated boolean payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| Int32BoxedBoolean(boolean data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| boolean | data()
validated payload | +| @Nullable Object | getData()
validated payload | + +## Int32BoxedNumber +public record Int32BoxedNumber
+implements [Int32Boxed](#int32boxed) + +record that stores validated Number payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| Int32BoxedNumber(Number data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| Number | data()
validated payload | +| @Nullable Object | getData()
validated payload | + +## Int32BoxedString +public record Int32BoxedString
+implements [Int32Boxed](#int32boxed) + +record that stores validated String payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| Int32BoxedString(String data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| String | data()
validated payload | +| @Nullable Object | getData()
validated payload | + +## Int32BoxedList +public record Int32BoxedList
+implements [Int32Boxed](#int32boxed) + +record that stores validated List payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| Int32BoxedList(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 | + +## Int32BoxedMap +public record Int32BoxedMap
+implements [Int32Boxed](#int32boxed) + +record that stores validated Map payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| Int32BoxedMap(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 | + +## Int32 +public static class Int32
+extends JsonSchema + +A schema class that validates payloads + +### Field Summary +| Modifier and Type | Field and Description | +| ----------------- | ---------------------- | +| String | type = "int32"; | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| String | validate(String arg, SchemaConfiguration configuration) | +| Nothing? | validate(Nothing? arg, SchemaConfiguration configuration) | +| int | validate(int arg, SchemaConfiguration configuration) | +| long | validate(long arg, SchemaConfiguration configuration) | +| float | validate(float arg, SchemaConfiguration configuration) | +| double | validate(double arg, SchemaConfiguration configuration) | +| Number | validate(Number arg, SchemaConfiguration configuration) | +| boolean | validate(boolean arg, SchemaConfiguration configuration) | +| FrozenMap<@Nullable Object> | validate(Map<?, ?> arg, SchemaConfiguration configuration) | +| FrozenList<@Nullable Object> | validate(List arg, SchemaConfiguration configuration) | +| [Int32BoxedString](#int32boxedstring) | validateAndBox(String arg, SchemaConfiguration configuration) | +| [Int32BoxedVoid](#int32boxedvoid) | validateAndBox(Nothing? arg, SchemaConfiguration configuration) | +| [Int32BoxedNumber](#int32boxednumber) | validateAndBox(Number arg, SchemaConfiguration configuration) | +| [Int32BoxedBoolean](#int32boxedboolean) | validateAndBox(boolean arg, SchemaConfiguration configuration) | +| [Int32BoxedMap](#int32boxedmap) | validateAndBox(Map<?, ?> arg, SchemaConfiguration configuration) | +| [Int32BoxedList](#int32boxedlist) | validateAndBox(List arg, SchemaConfiguration configuration) | +| [Int32Boxed](#int32boxed) | validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) | +| @Nullable Object | validate(@Nullable Object arg, SchemaConfiguration configuration) | + +## BinaryBoxed +public sealed interface BinaryBoxed
+permits
+[BinaryBoxedVoid](#binaryboxedvoid), +[BinaryBoxedBoolean](#binaryboxedboolean), +[BinaryBoxedNumber](#binaryboxednumber), +[BinaryBoxedString](#binaryboxedstring), +[BinaryBoxedList](#binaryboxedlist), +[BinaryBoxedMap](#binaryboxedmap) + +sealed interface that stores validated payloads using boxed classes + +## BinaryBoxedVoid +public record BinaryBoxedVoid
+implements [BinaryBoxed](#binaryboxed) + +record that stores validated null payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| BinaryBoxedVoid(Nothing? data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| Nothing? | data()
validated payload | +| @Nullable Object | getData()
validated payload | + +## BinaryBoxedBoolean +public record BinaryBoxedBoolean
+implements [BinaryBoxed](#binaryboxed) + +record that stores validated boolean payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| BinaryBoxedBoolean(boolean data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| boolean | data()
validated payload | +| @Nullable Object | getData()
validated payload | + +## BinaryBoxedNumber +public record BinaryBoxedNumber
+implements [BinaryBoxed](#binaryboxed) + +record that stores validated Number payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| BinaryBoxedNumber(Number data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| Number | data()
validated payload | +| @Nullable Object | getData()
validated payload | + +## BinaryBoxedString +public record BinaryBoxedString
+implements [BinaryBoxed](#binaryboxed) + +record that stores validated String payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| BinaryBoxedString(String data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| String | data()
validated payload | +| @Nullable Object | getData()
validated payload | + +## BinaryBoxedList +public record BinaryBoxedList
+implements [BinaryBoxed](#binaryboxed) + +record that stores validated List payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| BinaryBoxedList(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 | + +## BinaryBoxedMap +public record BinaryBoxedMap
+implements [BinaryBoxed](#binaryboxed) + +record that stores validated Map payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| BinaryBoxedMap(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 | + +## Binary +public static class Binary
+extends JsonSchema + +A schema class that validates payloads + +### Field Summary +| Modifier and Type | Field and Description | +| ----------------- | ---------------------- | +| String | type = "binary"; | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| String | validate(String arg, SchemaConfiguration configuration) | +| Nothing? | validate(Nothing? arg, SchemaConfiguration configuration) | +| int | validate(int arg, SchemaConfiguration configuration) | +| long | validate(long arg, SchemaConfiguration configuration) | +| float | validate(float arg, SchemaConfiguration configuration) | +| double | validate(double arg, SchemaConfiguration configuration) | +| Number | validate(Number arg, SchemaConfiguration configuration) | +| boolean | validate(boolean arg, SchemaConfiguration configuration) | +| FrozenMap<@Nullable Object> | validate(Map<?, ?> arg, SchemaConfiguration configuration) | +| FrozenList<@Nullable Object> | validate(List arg, SchemaConfiguration configuration) | +| [BinaryBoxedString](#binaryboxedstring) | validateAndBox(String arg, SchemaConfiguration configuration) | +| [BinaryBoxedVoid](#binaryboxedvoid) | validateAndBox(Nothing? arg, SchemaConfiguration configuration) | +| [BinaryBoxedNumber](#binaryboxednumber) | validateAndBox(Number arg, SchemaConfiguration configuration) | +| [BinaryBoxedBoolean](#binaryboxedboolean) | validateAndBox(boolean arg, SchemaConfiguration configuration) | +| [BinaryBoxedMap](#binaryboxedmap) | validateAndBox(Map<?, ?> arg, SchemaConfiguration configuration) | +| [BinaryBoxedList](#binaryboxedlist) | validateAndBox(List arg, SchemaConfiguration configuration) | +| [BinaryBoxed](#binaryboxed) | validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) | +| @Nullable Object | validate(@Nullable Object arg, SchemaConfiguration configuration) | + +## NumberSchemaBoxed +public sealed interface NumberSchemaBoxed
+permits
+[NumberSchemaBoxedVoid](#numberschemaboxedvoid), +[NumberSchemaBoxedBoolean](#numberschemaboxedboolean), +[NumberSchemaBoxedNumber](#numberschemaboxednumber), +[NumberSchemaBoxedString](#numberschemaboxedstring), +[NumberSchemaBoxedList](#numberschemaboxedlist), +[NumberSchemaBoxedMap](#numberschemaboxedmap) + +sealed interface that stores validated payloads using boxed classes + +## NumberSchemaBoxedVoid +public record NumberSchemaBoxedVoid
+implements [NumberSchemaBoxed](#numberschemaboxed) + +record that stores validated null payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| NumberSchemaBoxedVoid(Nothing? data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| Nothing? | data()
validated payload | +| @Nullable Object | getData()
validated payload | + +## NumberSchemaBoxedBoolean +public record NumberSchemaBoxedBoolean
+implements [NumberSchemaBoxed](#numberschemaboxed) + +record that stores validated boolean payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| NumberSchemaBoxedBoolean(boolean data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| boolean | data()
validated payload | +| @Nullable Object | getData()
validated payload | + +## NumberSchemaBoxedNumber +public record NumberSchemaBoxedNumber
+implements [NumberSchemaBoxed](#numberschemaboxed) + +record that stores validated Number payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| NumberSchemaBoxedNumber(Number data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| Number | data()
validated payload | +| @Nullable Object | getData()
validated payload | + +## NumberSchemaBoxedString +public record NumberSchemaBoxedString
+implements [NumberSchemaBoxed](#numberschemaboxed) + +record that stores validated String payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| NumberSchemaBoxedString(String data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| String | data()
validated payload | +| @Nullable Object | getData()
validated payload | + +## NumberSchemaBoxedList +public record NumberSchemaBoxedList
+implements [NumberSchemaBoxed](#numberschemaboxed) + +record that stores validated List payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| NumberSchemaBoxedList(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 | + +## NumberSchemaBoxedMap +public record NumberSchemaBoxedMap
+implements [NumberSchemaBoxed](#numberschemaboxed) + +record that stores validated Map payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| NumberSchemaBoxedMap(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 | + +## NumberSchema +public static class NumberSchema
+extends JsonSchema + +A schema class that validates payloads + +### Field Summary +| Modifier and Type | Field and Description | +| ----------------- | ---------------------- | +| String | type = "number"; | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| String | validate(String arg, SchemaConfiguration configuration) | +| Nothing? | validate(Nothing? arg, SchemaConfiguration configuration) | +| int | validate(int arg, SchemaConfiguration configuration) | +| long | validate(long arg, SchemaConfiguration configuration) | +| float | validate(float arg, SchemaConfiguration configuration) | +| double | validate(double arg, SchemaConfiguration configuration) | +| Number | validate(Number arg, SchemaConfiguration configuration) | +| boolean | validate(boolean arg, SchemaConfiguration configuration) | +| FrozenMap<@Nullable Object> | validate(Map<?, ?> arg, SchemaConfiguration configuration) | +| FrozenList<@Nullable Object> | validate(List arg, SchemaConfiguration configuration) | +| [NumberSchemaBoxedString](#numberschemaboxedstring) | validateAndBox(String arg, SchemaConfiguration configuration) | +| [NumberSchemaBoxedVoid](#numberschemaboxedvoid) | validateAndBox(Nothing? arg, SchemaConfiguration configuration) | +| [NumberSchemaBoxedNumber](#numberschemaboxednumber) | validateAndBox(Number arg, SchemaConfiguration configuration) | +| [NumberSchemaBoxedBoolean](#numberschemaboxedboolean) | validateAndBox(boolean arg, SchemaConfiguration configuration) | +| [NumberSchemaBoxedMap](#numberschemaboxedmap) | validateAndBox(Map<?, ?> arg, SchemaConfiguration configuration) | +| [NumberSchemaBoxedList](#numberschemaboxedlist) | validateAndBox(List arg, SchemaConfiguration configuration) | +| [NumberSchemaBoxed](#numberschemaboxed) | validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) | +| @Nullable Object | validate(@Nullable Object arg, SchemaConfiguration configuration) | + +## DatetimeBoxed +public sealed interface DatetimeBoxed
+permits
+[DatetimeBoxedVoid](#datetimeboxedvoid), +[DatetimeBoxedBoolean](#datetimeboxedboolean), +[DatetimeBoxedNumber](#datetimeboxednumber), +[DatetimeBoxedString](#datetimeboxedstring), +[DatetimeBoxedList](#datetimeboxedlist), +[DatetimeBoxedMap](#datetimeboxedmap) + +sealed interface that stores validated payloads using boxed classes + +## DatetimeBoxedVoid +public record DatetimeBoxedVoid
+implements [DatetimeBoxed](#datetimeboxed) + +record that stores validated null payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| DatetimeBoxedVoid(Nothing? data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| Nothing? | data()
validated payload | +| @Nullable Object | getData()
validated payload | + +## DatetimeBoxedBoolean +public record DatetimeBoxedBoolean
+implements [DatetimeBoxed](#datetimeboxed) + +record that stores validated boolean payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| DatetimeBoxedBoolean(boolean data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| boolean | data()
validated payload | +| @Nullable Object | getData()
validated payload | + +## DatetimeBoxedNumber +public record DatetimeBoxedNumber
+implements [DatetimeBoxed](#datetimeboxed) + +record that stores validated Number payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| DatetimeBoxedNumber(Number data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| Number | data()
validated payload | +| @Nullable Object | getData()
validated payload | + +## DatetimeBoxedString +public record DatetimeBoxedString
+implements [DatetimeBoxed](#datetimeboxed) + +record that stores validated String payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| DatetimeBoxedString(String data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| String | data()
validated payload | +| @Nullable Object | getData()
validated payload | + +## DatetimeBoxedList +public record DatetimeBoxedList
+implements [DatetimeBoxed](#datetimeboxed) + +record that stores validated List payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| DatetimeBoxedList(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 | + +## DatetimeBoxedMap +public record DatetimeBoxedMap
+implements [DatetimeBoxed](#datetimeboxed) + +record that stores validated Map payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| DatetimeBoxedMap(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 | + +## Datetime +public static class Datetime
+extends JsonSchema + +A schema class that validates payloads + +### Field Summary +| Modifier and Type | Field and Description | +| ----------------- | ---------------------- | +| String | type = "date-time"; | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| String | validate(String arg, SchemaConfiguration configuration) | +| Nothing? | validate(Nothing? arg, SchemaConfiguration configuration) | +| int | validate(int arg, SchemaConfiguration configuration) | +| long | validate(long arg, SchemaConfiguration configuration) | +| float | validate(float arg, SchemaConfiguration configuration) | +| double | validate(double arg, SchemaConfiguration configuration) | +| Number | validate(Number arg, SchemaConfiguration configuration) | +| boolean | validate(boolean arg, SchemaConfiguration configuration) | +| FrozenMap<@Nullable Object> | validate(Map<?, ?> arg, SchemaConfiguration configuration) | +| FrozenList<@Nullable Object> | validate(List arg, SchemaConfiguration configuration) | +| [DatetimeBoxedString](#datetimeboxedstring) | validateAndBox(String arg, SchemaConfiguration configuration) | +| [DatetimeBoxedVoid](#datetimeboxedvoid) | validateAndBox(Nothing? arg, SchemaConfiguration configuration) | +| [DatetimeBoxedNumber](#datetimeboxednumber) | validateAndBox(Number arg, SchemaConfiguration configuration) | +| [DatetimeBoxedBoolean](#datetimeboxedboolean) | validateAndBox(boolean arg, SchemaConfiguration configuration) | +| [DatetimeBoxedMap](#datetimeboxedmap) | validateAndBox(Map<?, ?> arg, SchemaConfiguration configuration) | +| [DatetimeBoxedList](#datetimeboxedlist) | validateAndBox(List arg, SchemaConfiguration configuration) | +| [DatetimeBoxed](#datetimeboxed) | validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) | +| @Nullable Object | validate(@Nullable Object arg, SchemaConfiguration configuration) | + +## DateBoxed +public sealed interface DateBoxed
+permits
+[DateBoxedVoid](#dateboxedvoid), +[DateBoxedBoolean](#dateboxedboolean), +[DateBoxedNumber](#dateboxednumber), +[DateBoxedString](#dateboxedstring), +[DateBoxedList](#dateboxedlist), +[DateBoxedMap](#dateboxedmap) + +sealed interface that stores validated payloads using boxed classes + +## DateBoxedVoid +public record DateBoxedVoid
+implements [DateBoxed](#dateboxed) + +record that stores validated null payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| DateBoxedVoid(Nothing? data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| Nothing? | data()
validated payload | +| @Nullable Object | getData()
validated payload | + +## DateBoxedBoolean +public record DateBoxedBoolean
+implements [DateBoxed](#dateboxed) + +record that stores validated boolean payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| DateBoxedBoolean(boolean data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| boolean | data()
validated payload | +| @Nullable Object | getData()
validated payload | + +## DateBoxedNumber +public record DateBoxedNumber
+implements [DateBoxed](#dateboxed) + +record that stores validated Number payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| DateBoxedNumber(Number data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| Number | data()
validated payload | +| @Nullable Object | getData()
validated payload | + +## DateBoxedString +public record DateBoxedString
+implements [DateBoxed](#dateboxed) + +record that stores validated String payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| DateBoxedString(String data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| String | data()
validated payload | +| @Nullable Object | getData()
validated payload | + +## DateBoxedList +public record DateBoxedList
+implements [DateBoxed](#dateboxed) + +record that stores validated List payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| DateBoxedList(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 | + +## DateBoxedMap +public record DateBoxedMap
+implements [DateBoxed](#dateboxed) + +record that stores validated Map payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| DateBoxedMap(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 | + +## Date +public static class Date
+extends JsonSchema + +A schema class that validates payloads + +### Field Summary +| Modifier and Type | Field and Description | +| ----------------- | ---------------------- | +| String | type = "date"; | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| String | validate(String arg, SchemaConfiguration configuration) | +| Nothing? | validate(Nothing? arg, SchemaConfiguration configuration) | +| int | validate(int arg, SchemaConfiguration configuration) | +| long | validate(long arg, SchemaConfiguration configuration) | +| float | validate(float arg, SchemaConfiguration configuration) | +| double | validate(double arg, SchemaConfiguration configuration) | +| Number | validate(Number arg, SchemaConfiguration configuration) | +| boolean | validate(boolean arg, SchemaConfiguration configuration) | +| FrozenMap<@Nullable Object> | validate(Map<?, ?> arg, SchemaConfiguration configuration) | +| FrozenList<@Nullable Object> | validate(List arg, SchemaConfiguration configuration) | +| [DateBoxedString](#dateboxedstring) | validateAndBox(String arg, SchemaConfiguration configuration) | +| [DateBoxedVoid](#dateboxedvoid) | validateAndBox(Nothing? arg, SchemaConfiguration configuration) | +| [DateBoxedNumber](#dateboxednumber) | validateAndBox(Number arg, SchemaConfiguration configuration) | +| [DateBoxedBoolean](#dateboxedboolean) | validateAndBox(boolean arg, SchemaConfiguration configuration) | +| [DateBoxedMap](#dateboxedmap) | validateAndBox(Map<?, ?> arg, SchemaConfiguration configuration) | +| [DateBoxedList](#dateboxedlist) | validateAndBox(List arg, SchemaConfiguration configuration) | +| [DateBoxed](#dateboxed) | validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) | +| @Nullable Object | validate(@Nullable Object arg, SchemaConfiguration configuration) | + +## UuidSchemaBoxed +public sealed interface UuidSchemaBoxed
+permits
+[UuidSchemaBoxedVoid](#uuidschemaboxedvoid), +[UuidSchemaBoxedBoolean](#uuidschemaboxedboolean), +[UuidSchemaBoxedNumber](#uuidschemaboxednumber), +[UuidSchemaBoxedString](#uuidschemaboxedstring), +[UuidSchemaBoxedList](#uuidschemaboxedlist), +[UuidSchemaBoxedMap](#uuidschemaboxedmap) + +sealed interface that stores validated payloads using boxed classes + +## UuidSchemaBoxedVoid +public record UuidSchemaBoxedVoid
+implements [UuidSchemaBoxed](#uuidschemaboxed) + +record that stores validated null payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| UuidSchemaBoxedVoid(Nothing? data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| Nothing? | data()
validated payload | +| @Nullable Object | getData()
validated payload | + +## UuidSchemaBoxedBoolean +public record UuidSchemaBoxedBoolean
+implements [UuidSchemaBoxed](#uuidschemaboxed) + +record that stores validated boolean payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| UuidSchemaBoxedBoolean(boolean data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| boolean | data()
validated payload | +| @Nullable Object | getData()
validated payload | + +## UuidSchemaBoxedNumber +public record UuidSchemaBoxedNumber
+implements [UuidSchemaBoxed](#uuidschemaboxed) + +record that stores validated Number payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| UuidSchemaBoxedNumber(Number data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| Number | data()
validated payload | +| @Nullable Object | getData()
validated payload | + +## UuidSchemaBoxedString +public record UuidSchemaBoxedString
+implements [UuidSchemaBoxed](#uuidschemaboxed) + +record that stores validated String payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| UuidSchemaBoxedString(String data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| String | data()
validated payload | +| @Nullable Object | getData()
validated payload | + +## UuidSchemaBoxedList +public record UuidSchemaBoxedList
+implements [UuidSchemaBoxed](#uuidschemaboxed) + +record that stores validated List payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| UuidSchemaBoxedList(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 | + +## UuidSchemaBoxedMap +public record UuidSchemaBoxedMap
+implements [UuidSchemaBoxed](#uuidschemaboxed) + +record that stores validated Map payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| UuidSchemaBoxedMap(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 | + +## UuidSchema +public static class UuidSchema
+extends JsonSchema + +A schema class that validates payloads + +### Field Summary +| Modifier and Type | Field and Description | +| ----------------- | ---------------------- | +| String | type = "uuid"; | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| String | validate(String arg, SchemaConfiguration configuration) | +| Nothing? | validate(Nothing? arg, SchemaConfiguration configuration) | +| int | validate(int arg, SchemaConfiguration configuration) | +| long | validate(long arg, SchemaConfiguration configuration) | +| float | validate(float arg, SchemaConfiguration configuration) | +| double | validate(double arg, SchemaConfiguration configuration) | +| Number | validate(Number arg, SchemaConfiguration configuration) | +| boolean | validate(boolean arg, SchemaConfiguration configuration) | +| FrozenMap<@Nullable Object> | validate(Map<?, ?> arg, SchemaConfiguration configuration) | +| FrozenList<@Nullable Object> | validate(List arg, SchemaConfiguration configuration) | +| [UuidSchemaBoxedString](#uuidschemaboxedstring) | validateAndBox(String arg, SchemaConfiguration configuration) | +| [UuidSchemaBoxedVoid](#uuidschemaboxedvoid) | validateAndBox(Nothing? arg, SchemaConfiguration configuration) | +| [UuidSchemaBoxedNumber](#uuidschemaboxednumber) | validateAndBox(Number arg, SchemaConfiguration configuration) | +| [UuidSchemaBoxedBoolean](#uuidschemaboxedboolean) | validateAndBox(boolean arg, SchemaConfiguration configuration) | +| [UuidSchemaBoxedMap](#uuidschemaboxedmap) | validateAndBox(Map<?, ?> arg, SchemaConfiguration configuration) | +| [UuidSchemaBoxedList](#uuidschemaboxedlist) | validateAndBox(List arg, SchemaConfiguration configuration) | +| [UuidSchemaBoxed](#uuidschemaboxed) | validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) | +| @Nullable Object | validate(@Nullable Object arg, SchemaConfiguration configuration) | + +[[Back to top]](#top) [[Back to Component Schemas]](../../../README.md#Component-Schemas) [[Back to README]](../../../README.md) diff --git a/samples/client/petstore/kotlin/docs/components/schemas/AnyTypeNotString.md b/samples/client/petstore/kotlin/docs/components/schemas/AnyTypeNotString.md new file mode 100644 index 00000000000..a5280b79840 --- /dev/null +++ b/samples/client/petstore/kotlin/docs/components/schemas/AnyTypeNotString.md @@ -0,0 +1,207 @@ +# AnyTypeNotString +org.openapijsonschematools.client.components.schemas.AnyTypeNotString.java +public class AnyTypeNotString
+ +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 + +## Nested Class Summary +| Modifier and Type | Class and Description | +| ----------------- | ---------------------- | +| sealed interface | [AnyTypeNotString.AnyTypeNotString1Boxed](#anytypenotstring1boxed)
sealed interface for validated payloads | +| record | [AnyTypeNotString.AnyTypeNotString1BoxedVoid](#anytypenotstring1boxedvoid)
boxed class to store validated null payloads | +| record | [AnyTypeNotString.AnyTypeNotString1BoxedBoolean](#anytypenotstring1boxedboolean)
boxed class to store validated boolean payloads | +| record | [AnyTypeNotString.AnyTypeNotString1BoxedNumber](#anytypenotstring1boxednumber)
boxed class to store validated Number payloads | +| record | [AnyTypeNotString.AnyTypeNotString1BoxedString](#anytypenotstring1boxedstring)
boxed class to store validated String payloads | +| record | [AnyTypeNotString.AnyTypeNotString1BoxedList](#anytypenotstring1boxedlist)
boxed class to store validated List payloads | +| record | [AnyTypeNotString.AnyTypeNotString1BoxedMap](#anytypenotstring1boxedmap)
boxed class to store validated Map payloads | +| static class | [AnyTypeNotString.AnyTypeNotString1](#anytypenotstring1)
schema class | +| sealed interface | [AnyTypeNotString.NotBoxed](#notboxed)
sealed interface for validated payloads | +| record | [AnyTypeNotString.NotBoxedString](#notboxedstring)
boxed class to store validated String payloads | +| static class | [AnyTypeNotString.Not](#not)
schema class | + +## AnyTypeNotString1Boxed +public sealed interface AnyTypeNotString1Boxed
+permits
+[AnyTypeNotString1BoxedVoid](#anytypenotstring1boxedvoid), +[AnyTypeNotString1BoxedBoolean](#anytypenotstring1boxedboolean), +[AnyTypeNotString1BoxedNumber](#anytypenotstring1boxednumber), +[AnyTypeNotString1BoxedString](#anytypenotstring1boxedstring), +[AnyTypeNotString1BoxedList](#anytypenotstring1boxedlist), +[AnyTypeNotString1BoxedMap](#anytypenotstring1boxedmap) + +sealed interface that stores validated payloads using boxed classes + +## AnyTypeNotString1BoxedVoid +public record AnyTypeNotString1BoxedVoid
+implements [AnyTypeNotString1Boxed](#anytypenotstring1boxed) + +record that stores validated null payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| AnyTypeNotString1BoxedVoid(Nothing? data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| Nothing? | data()
validated payload | +| @Nullable Object | getData()
validated payload | + +## AnyTypeNotString1BoxedBoolean +public record AnyTypeNotString1BoxedBoolean
+implements [AnyTypeNotString1Boxed](#anytypenotstring1boxed) + +record that stores validated boolean payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| AnyTypeNotString1BoxedBoolean(boolean data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| boolean | data()
validated payload | +| @Nullable Object | getData()
validated payload | + +## AnyTypeNotString1BoxedNumber +public record AnyTypeNotString1BoxedNumber
+implements [AnyTypeNotString1Boxed](#anytypenotstring1boxed) + +record that stores validated Number payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| AnyTypeNotString1BoxedNumber(Number data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| Number | data()
validated payload | +| @Nullable Object | getData()
validated payload | + +## AnyTypeNotString1BoxedString +public record AnyTypeNotString1BoxedString
+implements [AnyTypeNotString1Boxed](#anytypenotstring1boxed) + +record that stores validated String payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| AnyTypeNotString1BoxedString(String data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| String | data()
validated payload | +| @Nullable Object | getData()
validated payload | + +## AnyTypeNotString1BoxedList +public record AnyTypeNotString1BoxedList
+implements [AnyTypeNotString1Boxed](#anytypenotstring1boxed) + +record that stores validated List payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| AnyTypeNotString1BoxedList(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 | + +## AnyTypeNotString1BoxedMap +public record AnyTypeNotString1BoxedMap
+implements [AnyTypeNotString1Boxed](#anytypenotstring1boxed) + +record that stores validated Map payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| AnyTypeNotString1BoxedMap(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 | + +## AnyTypeNotString1 +public static class AnyTypeNotString1
+extends JsonSchema + +A schema class that validates payloads + +### Field Summary +| Modifier and Type | Field and Description | +| ----------------- | ---------------------- | +| Class | not = [Not.class](#not) | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| String | validate(String arg, SchemaConfiguration configuration) | +| Nothing? | validate(Nothing? arg, SchemaConfiguration configuration) | +| int | validate(int arg, SchemaConfiguration configuration) | +| long | validate(long arg, SchemaConfiguration configuration) | +| float | validate(float arg, SchemaConfiguration configuration) | +| double | validate(double arg, SchemaConfiguration configuration) | +| Number | validate(Number arg, SchemaConfiguration configuration) | +| boolean | validate(boolean arg, SchemaConfiguration configuration) | +| FrozenMap<@Nullable Object> | validate(Map<?, ?> arg, SchemaConfiguration configuration) | +| FrozenList<@Nullable Object> | validate(List arg, SchemaConfiguration configuration) | +| [AnyTypeNotString1BoxedString](#anytypenotstring1boxedstring) | validateAndBox(String arg, SchemaConfiguration configuration) | +| [AnyTypeNotString1BoxedVoid](#anytypenotstring1boxedvoid) | validateAndBox(Nothing? arg, SchemaConfiguration configuration) | +| [AnyTypeNotString1BoxedNumber](#anytypenotstring1boxednumber) | validateAndBox(Number arg, SchemaConfiguration configuration) | +| [AnyTypeNotString1BoxedBoolean](#anytypenotstring1boxedboolean) | validateAndBox(boolean arg, SchemaConfiguration configuration) | +| [AnyTypeNotString1BoxedMap](#anytypenotstring1boxedmap) | validateAndBox(Map<?, ?> arg, SchemaConfiguration configuration) | +| [AnyTypeNotString1BoxedList](#anytypenotstring1boxedlist) | validateAndBox(List arg, SchemaConfiguration configuration) | +| [AnyTypeNotString1Boxed](#anytypenotstring1boxed) | validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) | +| @Nullable Object | validate(@Nullable Object arg, SchemaConfiguration configuration) | + +## NotBoxed +public sealed interface NotBoxed
+permits
+[NotBoxedString](#notboxedstring) + +sealed interface that stores validated payloads using boxed classes + +## NotBoxedString +public record NotBoxedString
+implements [NotBoxed](#notboxed) + +record that stores validated String payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| NotBoxedString(String data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| String | data()
validated payload | +| @Nullable Object | getData()
validated payload | + +## Not +public static class Not
+extends StringJsonSchema.StringJsonSchema1 + +A schema class that validates payloads + +| Methods Inherited from class org.openapijsonschematools.client.schemas.StringJsonSchema.StringJsonSchema1 | +| ------------------------------------------------------------------ | +| validate | +| validateAndBox | + +[[Back to top]](#top) [[Back to Component Schemas]](../../../README.md#Component-Schemas) [[Back to README]](../../../README.md) diff --git a/samples/client/petstore/kotlin/docs/components/schemas/ApiResponseSchema.md b/samples/client/petstore/kotlin/docs/components/schemas/ApiResponseSchema.md new file mode 100644 index 00000000000..187e5bb10bd --- /dev/null +++ b/samples/client/petstore/kotlin/docs/components/schemas/ApiResponseSchema.md @@ -0,0 +1,254 @@ +# ApiResponseSchema +org.openapijsonschematools.client.components.schemas.ApiResponseSchema.java +public class ApiResponseSchema
+ +A class that contains necessary nested +- schema classes (which validate payloads), extends JsonSchema +- sealed interfaces which store validated payloads, java version of a sum type +- boxed classes which store validated payloads, sealed permits class implementations +- classes to store validated map payloads, extends FrozenMap +- classes to build inputs for map payloads + +## Nested Class Summary +| Modifier and Type | Class and Description | +| ----------------- | ---------------------- | +| sealed interface | [ApiResponseSchema.ApiResponseSchema1Boxed](#apiresponseschema1boxed)
sealed interface for validated payloads | +| record | [ApiResponseSchema.ApiResponseSchema1BoxedMap](#apiresponseschema1boxedmap)
boxed class to store validated Map payloads | +| static class | [ApiResponseSchema.ApiResponseSchema1](#apiresponseschema1)
schema class | +| static class | [ApiResponseSchema.ApiResponseMapBuilder](#apiresponsemapbuilder)
builder for Map payloads | +| static class | [ApiResponseSchema.ApiResponseMap](#apiresponsemap)
output class for Map payloads | +| sealed interface | [ApiResponseSchema.MessageBoxed](#messageboxed)
sealed interface for validated payloads | +| record | [ApiResponseSchema.MessageBoxedString](#messageboxedstring)
boxed class to store validated String payloads | +| static class | [ApiResponseSchema.Message](#message)
schema class | +| sealed interface | [ApiResponseSchema.TypeBoxed](#typeboxed)
sealed interface for validated payloads | +| record | [ApiResponseSchema.TypeBoxedString](#typeboxedstring)
boxed class to store validated String payloads | +| static class | [ApiResponseSchema.Type](#type)
schema class | +| sealed interface | [ApiResponseSchema.CodeBoxed](#codeboxed)
sealed interface for validated payloads | +| record | [ApiResponseSchema.CodeBoxedNumber](#codeboxednumber)
boxed class to store validated Number payloads | +| static class | [ApiResponseSchema.Code](#code)
schema class | + +## ApiResponseSchema1Boxed +public sealed interface ApiResponseSchema1Boxed
+permits
+[ApiResponseSchema1BoxedMap](#apiresponseschema1boxedmap) + +sealed interface that stores validated payloads using boxed classes + +## ApiResponseSchema1BoxedMap +public record ApiResponseSchema1BoxedMap
+implements [ApiResponseSchema1Boxed](#apiresponseschema1boxed) + +record that stores validated Map payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| ApiResponseSchema1BoxedMap([ApiResponseMap](#apiresponsemap) data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| [ApiResponseMap](#apiresponsemap) | data()
validated payload | +| @Nullable Object | getData()
validated payload | + +## ApiResponseSchema1 +public static class ApiResponseSchema1
+extends JsonSchema + +A schema class that validates payloads + +### Code Sample +``` +import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags; +import org.openapijsonschematools.client.configurations.SchemaConfiguration; +import org.openapijsonschematools.client.exceptions.ValidationException; +import org.openapijsonschematools.client.schemas.validation.MapUtils; +import org.openapijsonschematools.client.schemas.validation.FrozenList; +import org.openapijsonschematools.client.schemas.validation.FrozenMap; +import org.openapijsonschematools.client.components.schemas.ApiResponseSchema; + +import java.util.Arrays; +import java.util.List; +import java.util.AbstractMap; + +static final SchemaConfiguration configuration = new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().build()); + +// Map validation +ApiResponseSchema.ApiResponseMap validatedPayload = + ApiResponseSchema.ApiResponseSchema1.validate( + new ApiResponseSchema.ApiResponseMapBuilder() + .code(1) + + .type("a") + + .message("a") + + .build(), + configuration +); +``` + +### Field Summary +| Modifier and Type | Field and Description | +| ----------------- | ---------------------- | +| Set> | type = Set.of(Map.class) | +| Map> | properties = Map.ofEntries(
    new PropertyEntry("code", [Code.class](#code))),
    new PropertyEntry("type", [Type.class](#type))),
    new PropertyEntry("message", [Message.class](#message)))
)
| + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| [ApiResponseMap](#apiresponsemap) | validate([Map<?, ?>](#apiresponsemapbuilder) arg, SchemaConfiguration configuration) | +| [ApiResponseSchema1BoxedMap](#apiresponseschema1boxedmap) | validateAndBox([Map<?, ?>](#apiresponsemapbuilder) arg, SchemaConfiguration configuration) | +| [ApiResponseSchema1Boxed](#apiresponseschema1boxed) | validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) | +| @Nullable Object | validate(@Nullable Object arg, SchemaConfiguration configuration) | + +## ApiResponseMapBuilder +public class ApiResponseMapBuilder
+builder for `Map` + +A class that builds the Map input type + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| ApiResponseMapBuilder()
Creates a builder that contains an empty map | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| Map | build()
Returns map input that should be used with Schema.validate | +| [ApiResponseMapBuilder](#apiresponsemapbuilder) | code(int value) | +| [ApiResponseMapBuilder](#apiresponsemapbuilder) | code(float value) | +| [ApiResponseMapBuilder](#apiresponsemapbuilder) | type(String value) | +| [ApiResponseMapBuilder](#apiresponsemapbuilder) | message(String value) | +| [ApiResponseMapBuilder](#apiresponsemapbuilder) | additionalProperty(String key, Nothing? value) | +| [ApiResponseMapBuilder](#apiresponsemapbuilder) | additionalProperty(String key, boolean value) | +| [ApiResponseMapBuilder](#apiresponsemapbuilder) | additionalProperty(String key, String value) | +| [ApiResponseMapBuilder](#apiresponsemapbuilder) | additionalProperty(String key, int value) | +| [ApiResponseMapBuilder](#apiresponsemapbuilder) | additionalProperty(String key, float value) | +| [ApiResponseMapBuilder](#apiresponsemapbuilder) | additionalProperty(String key, long value) | +| [ApiResponseMapBuilder](#apiresponsemapbuilder) | additionalProperty(String key, double value) | +| [ApiResponseMapBuilder](#apiresponsemapbuilder) | additionalProperty(String key, List value) | +| [ApiResponseMapBuilder](#apiresponsemapbuilder) | additionalProperty(String key, Map value) | + +## ApiResponseMap +public static class ApiResponseMap
+extends FrozenMap + +A class to store validated Map payloads + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| static [ApiResponseMap](#apiresponsemap) | of([Map](#apiresponsemapbuilder) arg, SchemaConfiguration configuration) | +| Number | code()
[optional] value must be a 32 bit integer | +| String | type()
[optional] | +| String | message()
[optional] | +| @Nullable Object | getAdditionalProperty(String name)
provides type safety for additional properties | + +## MessageBoxed +public sealed interface MessageBoxed
+permits
+[MessageBoxedString](#messageboxedstring) + +sealed interface that stores validated payloads using boxed classes + +## MessageBoxedString +public record MessageBoxedString
+implements [MessageBoxed](#messageboxed) + +record that stores validated String payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| MessageBoxedString(String data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| String | data()
validated payload | +| @Nullable Object | getData()
validated payload | + +## Message +public static class Message
+extends StringJsonSchema.StringJsonSchema1 + +A schema class that validates payloads + +| Methods Inherited from class org.openapijsonschematools.client.schemas.StringJsonSchema.StringJsonSchema1 | +| ------------------------------------------------------------------ | +| validate | +| validateAndBox | + +## TypeBoxed +public sealed interface TypeBoxed
+permits
+[TypeBoxedString](#typeboxedstring) + +sealed interface that stores validated payloads using boxed classes + +## TypeBoxedString +public record TypeBoxedString
+implements [TypeBoxed](#typeboxed) + +record that stores validated String payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| TypeBoxedString(String data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| String | data()
validated payload | +| @Nullable Object | getData()
validated payload | + +## Type +public static class Type
+extends StringJsonSchema.StringJsonSchema1 + +A schema class that validates payloads + +| Methods Inherited from class org.openapijsonschematools.client.schemas.StringJsonSchema.StringJsonSchema1 | +| ------------------------------------------------------------------ | +| validate | +| validateAndBox | + +## CodeBoxed +public sealed interface CodeBoxed
+permits
+[CodeBoxedNumber](#codeboxednumber) + +sealed interface that stores validated payloads using boxed classes + +## CodeBoxedNumber +public record CodeBoxedNumber
+implements [CodeBoxed](#codeboxed) + +record that stores validated Number payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| CodeBoxedNumber(Number data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| Number | data()
validated payload | +| @Nullable Object | getData()
validated payload | + +## Code +public static class Code
+extends Int32JsonSchema.Int32JsonSchema1 + +A schema class that validates payloads + +| Methods Inherited from class org.openapijsonschematools.client.schemas.Int32JsonSchema.Int32JsonSchema1 | +| ------------------------------------------------------------------ | +| validate | +| validateAndBox | + +[[Back to top]](#top) [[Back to Component Schemas]](../../../README.md#Component-Schemas) [[Back to README]](../../../README.md) diff --git a/samples/client/petstore/kotlin/docs/components/schemas/Apple.md b/samples/client/petstore/kotlin/docs/components/schemas/Apple.md new file mode 100644 index 00000000000..d04fad25dd0 --- /dev/null +++ b/samples/client/petstore/kotlin/docs/components/schemas/Apple.md @@ -0,0 +1,318 @@ +# Apple +org.openapijsonschematools.client.components.schemas.Apple.java +public class Apple
+ +A class that contains necessary nested +- schema classes (which validate payloads), extends JsonSchema +- sealed interfaces which store validated payloads, java version of a sum type +- boxed classes which store validated payloads, sealed permits class implementations +- classes to store validated map payloads, extends FrozenMap +- classes to build inputs for map payloads + +## Nested Class Summary +| Modifier and Type | Class and Description | +| ----------------- | ---------------------- | +| sealed interface | [Apple.Apple1Boxed](#apple1boxed)
sealed interface for validated payloads | +| record | [Apple.Apple1BoxedVoid](#apple1boxedvoid)
boxed class to store validated null payloads | +| record | [Apple.Apple1BoxedMap](#apple1boxedmap)
boxed class to store validated Map payloads | +| static class | [Apple.Apple1](#apple1)
schema class | +| static class | [Apple.AppleMapBuilder](#applemapbuilder)
builder for Map payloads | +| static class | [Apple.AppleMap](#applemap)
output class for Map payloads | +| sealed interface | [Apple.OriginBoxed](#originboxed)
sealed interface for validated payloads | +| record | [Apple.OriginBoxedString](#originboxedstring)
boxed class to store validated String payloads | +| static class | [Apple.Origin](#origin)
schema class | +| sealed interface | [Apple.CultivarBoxed](#cultivarboxed)
sealed interface for validated payloads | +| record | [Apple.CultivarBoxedString](#cultivarboxedstring)
boxed class to store validated String payloads | +| static class | [Apple.Cultivar](#cultivar)
schema class | + +## Apple1Boxed +public sealed interface Apple1Boxed
+permits
+[Apple1BoxedVoid](#apple1boxedvoid), +[Apple1BoxedMap](#apple1boxedmap) + +sealed interface that stores validated payloads using boxed classes + +## Apple1BoxedVoid +public record Apple1BoxedVoid
+implements [Apple1Boxed](#apple1boxed) + +record that stores validated null payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| Apple1BoxedVoid(Nothing? data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| Nothing? | data()
validated payload | +| @Nullable Object | getData()
validated payload | + +## Apple1BoxedMap +public record Apple1BoxedMap
+implements [Apple1Boxed](#apple1boxed) + +record that stores validated Map payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| Apple1BoxedMap([AppleMap](#applemap) data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| [AppleMap](#applemap) | data()
validated payload | +| @Nullable Object | getData()
validated payload | + +## Apple1 +public static class Apple1
+extends JsonSchema + +A schema class that validates payloads + +### Code Sample +``` +import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags; +import org.openapijsonschematools.client.configurations.SchemaConfiguration; +import org.openapijsonschematools.client.exceptions.ValidationException; +import org.openapijsonschematools.client.schemas.validation.MapUtils; +import org.openapijsonschematools.client.schemas.validation.FrozenList; +import org.openapijsonschematools.client.schemas.validation.FrozenMap; +import org.openapijsonschematools.client.components.schemas.Apple; + +import java.util.Arrays; +import java.util.List; +import java.util.AbstractMap; + +static final SchemaConfiguration configuration = new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().build()); + +// null validation +Nothing? validatedPayload = Apple.Apple1.validate( + (Nothing?) null, + configuration +); + +// Map validation +Apple.AppleMap validatedPayload = + Apple.Apple1.validate( + new Apple.AppleMapBuilder() + .cultivar("IaQn EaqioxT oASzjxaSH") + + .origin("IaQn EaqioxT oASzjxaSH") + + .build(), + configuration +); +``` + +### Field Summary +| Modifier and Type | Field and Description | +| ----------------- | ---------------------- | +| Set> | type = Set.of(
    Nothing?.class,
    Map.class
)
| +| Map> | properties = Map.ofEntries(
    new PropertyEntry("cultivar", [Cultivar.class](#cultivar))),
    new PropertyEntry("origin", [Origin.class](#origin)))
)
| +| Set | required = Set.of(
    "cultivar"
)
| + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| Nothing? | validate(Nothing? arg, SchemaConfiguration configuration) | +| [Apple1BoxedVoid](#apple1boxedvoid) | validateAndBox(Nothing? arg, SchemaConfiguration configuration) | +| [AppleMap](#applemap) | validate([Map<?, ?>](#applemapbuilder) arg, SchemaConfiguration configuration) | +| [Apple1BoxedMap](#apple1boxedmap) | validateAndBox([Map<?, ?>](#applemapbuilder) arg, SchemaConfiguration configuration) | +| [Apple1Boxed](#apple1boxed) | validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) | +| @Nullable Object | validate(@Nullable Object arg, SchemaConfiguration configuration) | + +## AppleMap0Builder +public class AppleMap0Builder
+builder for `Map` + +A class that builds the Map input type + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| AppleMap0Builder(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 | +| [AppleMap0Builder](#applemap0builder) | origin(String value) | +| [AppleMap0Builder](#applemap0builder) | additionalProperty(String key, Nothing? value) | +| [AppleMap0Builder](#applemap0builder) | additionalProperty(String key, boolean value) | +| [AppleMap0Builder](#applemap0builder) | additionalProperty(String key, String value) | +| [AppleMap0Builder](#applemap0builder) | additionalProperty(String key, int value) | +| [AppleMap0Builder](#applemap0builder) | additionalProperty(String key, float value) | +| [AppleMap0Builder](#applemap0builder) | additionalProperty(String key, long value) | +| [AppleMap0Builder](#applemap0builder) | additionalProperty(String key, double value) | +| [AppleMap0Builder](#applemap0builder) | additionalProperty(String key, List value) | +| [AppleMap0Builder](#applemap0builder) | additionalProperty(String key, Map value) | + +## AppleMapBuilder +public class AppleMapBuilder
+builder for `Map` + +A class that builds the Map input type + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| AppleMapBuilder()
Creates a builder that contains an empty map | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| [AppleMap0Builder](#applemap0builder) | cultivar(String value) | + +## AppleMap +public static class AppleMap
+extends FrozenMap + +A class to store validated Map payloads + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| static [AppleMap](#applemap) | of([Map](#applemapbuilder) arg, SchemaConfiguration configuration) | +| String | cultivar()
| +| String | origin()
[optional] | +| @Nullable Object | getAdditionalProperty(String name)
provides type safety for additional properties | + +## OriginBoxed +public sealed interface OriginBoxed
+permits
+[OriginBoxedString](#originboxedstring) + +sealed interface that stores validated payloads using boxed classes + +## OriginBoxedString +public record OriginBoxedString
+implements [OriginBoxed](#originboxed) + +record that stores validated String payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| OriginBoxedString(String data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| String | data()
validated payload | +| @Nullable Object | getData()
validated payload | + +## Origin +public static class Origin
+extends JsonSchema + +A schema class that validates payloads + +### Code Sample +``` +import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags; +import org.openapijsonschematools.client.configurations.SchemaConfiguration; +import org.openapijsonschematools.client.exceptions.ValidationException; +import org.openapijsonschematools.client.schemas.validation.MapUtils; +import org.openapijsonschematools.client.schemas.validation.FrozenList; +import org.openapijsonschematools.client.schemas.validation.FrozenMap; +import org.openapijsonschematools.client.components.schemas.Apple; + +import java.util.Arrays; +import java.util.List; +import java.util.AbstractMap; + +static final SchemaConfiguration configuration = new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().build()); + +// String validation +String validatedPayload = Apple.Origin.validate( + "IaQn EaqioxT oASzjxaSH", + configuration +); +``` + +### Field Summary +| Modifier and Type | Field and Description | +| ----------------- | ---------------------- | +| Set> | type = Set.of(
    String.class
)
| +| Pattern | pattern = Pattern.compile(
    "^[A-Z\\s]*$",
    Pattern.CASE_INSENSITIVE
)
| + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| String | validate(String arg, SchemaConfiguration configuration) | +| [OriginBoxedString](#originboxedstring) | validateAndBox(String arg, SchemaConfiguration configuration) | +| [OriginBoxed](#originboxed) | validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) | +| @Nullable Object | validate(@Nullable Object arg, SchemaConfiguration configuration) | + +## CultivarBoxed +public sealed interface CultivarBoxed
+permits
+[CultivarBoxedString](#cultivarboxedstring) + +sealed interface that stores validated payloads using boxed classes + +## CultivarBoxedString +public record CultivarBoxedString
+implements [CultivarBoxed](#cultivarboxed) + +record that stores validated String payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| CultivarBoxedString(String data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| String | data()
validated payload | +| @Nullable Object | getData()
validated payload | + +## Cultivar +public static class Cultivar
+extends JsonSchema + +A schema class that validates payloads + +### Code Sample +``` +import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags; +import org.openapijsonschematools.client.configurations.SchemaConfiguration; +import org.openapijsonschematools.client.exceptions.ValidationException; +import org.openapijsonschematools.client.schemas.validation.MapUtils; +import org.openapijsonschematools.client.schemas.validation.FrozenList; +import org.openapijsonschematools.client.schemas.validation.FrozenMap; +import org.openapijsonschematools.client.components.schemas.Apple; + +import java.util.Arrays; +import java.util.List; +import java.util.AbstractMap; + +static final SchemaConfiguration configuration = new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().build()); + +// String validation +String validatedPayload = Apple.Cultivar.validate( + "IaQn EaqioxT oASzjxaSH", + configuration +); +``` + +### Field Summary +| Modifier and Type | Field and Description | +| ----------------- | ---------------------- | +| Set> | type = Set.of(
    String.class
)
| +| Pattern | pattern = Pattern.compile(
    "^[a-zA-Z\\s]*$"
)
| + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| String | validate(String arg, SchemaConfiguration configuration) | +| [CultivarBoxedString](#cultivarboxedstring) | validateAndBox(String arg, SchemaConfiguration configuration) | +| [CultivarBoxed](#cultivarboxed) | validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) | +| @Nullable Object | validate(@Nullable Object arg, SchemaConfiguration configuration) | + +[[Back to top]](#top) [[Back to Component Schemas]](../../../README.md#Component-Schemas) [[Back to README]](../../../README.md) diff --git a/samples/client/petstore/kotlin/docs/components/schemas/AppleReq.md b/samples/client/petstore/kotlin/docs/components/schemas/AppleReq.md new file mode 100644 index 00000000000..c187b6e9e08 --- /dev/null +++ b/samples/client/petstore/kotlin/docs/components/schemas/AppleReq.md @@ -0,0 +1,351 @@ +# AppleReq +org.openapijsonschematools.client.components.schemas.AppleReq.java +public class AppleReq
+ +A class that contains necessary nested +- schema classes (which validate payloads), extends JsonSchema +- sealed interfaces which store validated payloads, java version of a sum type +- boxed classes which store validated payloads, sealed permits class implementations +- classes to store validated map payloads, extends FrozenMap +- classes to build inputs for map payloads + +## Nested Class Summary +| Modifier and Type | Class and Description | +| ----------------- | ---------------------- | +| sealed interface | [AppleReq.AppleReq1Boxed](#applereq1boxed)
sealed interface for validated payloads | +| record | [AppleReq.AppleReq1BoxedMap](#applereq1boxedmap)
boxed class to store validated Map payloads | +| static class | [AppleReq.AppleReq1](#applereq1)
schema class | +| static class | [AppleReq.AppleReqMapBuilder](#applereqmapbuilder)
builder for Map payloads | +| static class | [AppleReq.AppleReqMap](#applereqmap)
output class for Map payloads | +| sealed interface | [AppleReq.MealyBoxed](#mealyboxed)
sealed interface for validated payloads | +| record | [AppleReq.MealyBoxedBoolean](#mealyboxedboolean)
boxed class to store validated boolean payloads | +| static class | [AppleReq.Mealy](#mealy)
schema class | +| sealed interface | [AppleReq.CultivarBoxed](#cultivarboxed)
sealed interface for validated payloads | +| record | [AppleReq.CultivarBoxedString](#cultivarboxedstring)
boxed class to store validated String payloads | +| static class | [AppleReq.Cultivar](#cultivar)
schema class | +| sealed interface | [AppleReq.AdditionalPropertiesBoxed](#additionalpropertiesboxed)
sealed interface for validated payloads | +| record | [AppleReq.AdditionalPropertiesBoxedVoid](#additionalpropertiesboxedvoid)
boxed class to store validated null payloads | +| record | [AppleReq.AdditionalPropertiesBoxedBoolean](#additionalpropertiesboxedboolean)
boxed class to store validated boolean payloads | +| record | [AppleReq.AdditionalPropertiesBoxedNumber](#additionalpropertiesboxednumber)
boxed class to store validated Number payloads | +| record | [AppleReq.AdditionalPropertiesBoxedString](#additionalpropertiesboxedstring)
boxed class to store validated String payloads | +| record | [AppleReq.AdditionalPropertiesBoxedList](#additionalpropertiesboxedlist)
boxed class to store validated List payloads | +| record | [AppleReq.AdditionalPropertiesBoxedMap](#additionalpropertiesboxedmap)
boxed class to store validated Map payloads | +| static class | [AppleReq.AdditionalProperties](#additionalproperties)
schema class | + +## AppleReq1Boxed +public sealed interface AppleReq1Boxed
+permits
+[AppleReq1BoxedMap](#applereq1boxedmap) + +sealed interface that stores validated payloads using boxed classes + +## AppleReq1BoxedMap +public record AppleReq1BoxedMap
+implements [AppleReq1Boxed](#applereq1boxed) + +record that stores validated Map payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| AppleReq1BoxedMap([AppleReqMap](#applereqmap) data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| [AppleReqMap](#applereqmap) | data()
validated payload | +| @Nullable Object | getData()
validated payload | + +## AppleReq1 +public static class AppleReq1
+extends JsonSchema + +A schema class that validates payloads + +### Code Sample +``` +import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags; +import org.openapijsonschematools.client.configurations.SchemaConfiguration; +import org.openapijsonschematools.client.exceptions.ValidationException; +import org.openapijsonschematools.client.schemas.validation.MapUtils; +import org.openapijsonschematools.client.schemas.validation.FrozenList; +import org.openapijsonschematools.client.schemas.validation.FrozenMap; +import org.openapijsonschematools.client.components.schemas.AppleReq; + +import java.util.Arrays; +import java.util.List; +import java.util.AbstractMap; + +static final SchemaConfiguration configuration = new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().build()); + +// Map validation +AppleReq.AppleReqMap validatedPayload = + AppleReq.AppleReq1.validate( + new AppleReq.AppleReqMapBuilder() + .cultivar("a") + + .mealy(true) + + .build(), + configuration +); +``` + +### Field Summary +| Modifier and Type | Field and Description | +| ----------------- | ---------------------- | +| Set> | type = Set.of(Map.class) | +| Map> | properties = Map.ofEntries(
    new PropertyEntry("cultivar", [Cultivar.class](#cultivar))),
    new PropertyEntry("mealy", [Mealy.class](#mealy)))
)
| +| Set | required = Set.of(
    "cultivar"
)
| +| Class | additionalProperties = [AdditionalProperties.class](#additionalproperties) | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| [AppleReqMap](#applereqmap) | validate([Map<?, ?>](#applereqmapbuilder) arg, SchemaConfiguration configuration) | +| [AppleReq1BoxedMap](#applereq1boxedmap) | validateAndBox([Map<?, ?>](#applereqmapbuilder) arg, SchemaConfiguration configuration) | +| [AppleReq1Boxed](#applereq1boxed) | validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) | +| @Nullable Object | validate(@Nullable Object arg, SchemaConfiguration configuration) | + +## AppleReqMap0Builder +public class AppleReqMap0Builder
+builder for `Map` + +A class that builds the Map input type + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| AppleReqMap0Builder(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 | +| [AppleReqMap0Builder](#applereqmap0builder) | mealy(boolean value) | + +## AppleReqMapBuilder +public class AppleReqMapBuilder
+builder for `Map` + +A class that builds the Map input type + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| AppleReqMapBuilder()
Creates a builder that contains an empty map | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| [AppleReqMap0Builder](#applereqmap0builder) | cultivar(String value) | + +## AppleReqMap +public static class AppleReqMap
+extends FrozenMap + +A class to store validated Map payloads + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| static [AppleReqMap](#applereqmap) | of([Map](#applereqmapbuilder) arg, SchemaConfiguration configuration) | +| String | cultivar()
| +| boolean | mealy()
[optional] | + +## MealyBoxed +public sealed interface MealyBoxed
+permits
+[MealyBoxedBoolean](#mealyboxedboolean) + +sealed interface that stores validated payloads using boxed classes + +## MealyBoxedBoolean +public record MealyBoxedBoolean
+implements [MealyBoxed](#mealyboxed) + +record that stores validated boolean payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| MealyBoxedBoolean(boolean data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| boolean | data()
validated payload | +| @Nullable Object | getData()
validated payload | + +## Mealy +public static class Mealy
+extends BooleanJsonSchema.BooleanJsonSchema1 + +A schema class that validates payloads + +| Methods Inherited from class org.openapijsonschematools.client.schemas.BooleanJsonSchema.BooleanJsonSchema1 | +| ------------------------------------------------------------------ | +| validate | +| validateAndBox | + +## CultivarBoxed +public sealed interface CultivarBoxed
+permits
+[CultivarBoxedString](#cultivarboxedstring) + +sealed interface that stores validated payloads using boxed classes + +## CultivarBoxedString +public record CultivarBoxedString
+implements [CultivarBoxed](#cultivarboxed) + +record that stores validated String payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| CultivarBoxedString(String data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| String | data()
validated payload | +| @Nullable Object | getData()
validated payload | + +## Cultivar +public static class Cultivar
+extends StringJsonSchema.StringJsonSchema1 + +A schema class that validates payloads + +| Methods Inherited from class org.openapijsonschematools.client.schemas.StringJsonSchema.StringJsonSchema1 | +| ------------------------------------------------------------------ | +| validate | +| validateAndBox | + +## 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(Nothing? data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| Nothing? | 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 Component Schemas]](../../../README.md#Component-Schemas) [[Back to README]](../../../README.md) diff --git a/samples/client/petstore/kotlin/docs/components/schemas/ArrayHoldingAnyType.md b/samples/client/petstore/kotlin/docs/components/schemas/ArrayHoldingAnyType.md new file mode 100644 index 00000000000..27c27fc1930 --- /dev/null +++ b/samples/client/petstore/kotlin/docs/components/schemas/ArrayHoldingAnyType.md @@ -0,0 +1,263 @@ +# ArrayHoldingAnyType +org.openapijsonschematools.client.components.schemas.ArrayHoldingAnyType.java +public class ArrayHoldingAnyType
+ +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 list payloads, extends FrozenList +- classes to build inputs for list payloads + +## Nested Class Summary +| Modifier and Type | Class and Description | +| ----------------- | ---------------------- | +| sealed interface | [ArrayHoldingAnyType.ArrayHoldingAnyType1Boxed](#arrayholdinganytype1boxed)
sealed interface for validated payloads | +| record | [ArrayHoldingAnyType.ArrayHoldingAnyType1BoxedList](#arrayholdinganytype1boxedlist)
boxed class to store validated List payloads | +| static class | [ArrayHoldingAnyType.ArrayHoldingAnyType1](#arrayholdinganytype1)
schema class | +| static class | [ArrayHoldingAnyType.ArrayHoldingAnyTypeListBuilder](#arrayholdinganytypelistbuilder)
builder for List payloads | +| static class | [ArrayHoldingAnyType.ArrayHoldingAnyTypeList](#arrayholdinganytypelist)
output class for List payloads | +| sealed interface | [ArrayHoldingAnyType.ItemsBoxed](#itemsboxed)
sealed interface for validated payloads | +| record | [ArrayHoldingAnyType.ItemsBoxedVoid](#itemsboxedvoid)
boxed class to store validated null payloads | +| record | [ArrayHoldingAnyType.ItemsBoxedBoolean](#itemsboxedboolean)
boxed class to store validated boolean payloads | +| record | [ArrayHoldingAnyType.ItemsBoxedNumber](#itemsboxednumber)
boxed class to store validated Number payloads | +| record | [ArrayHoldingAnyType.ItemsBoxedString](#itemsboxedstring)
boxed class to store validated String payloads | +| record | [ArrayHoldingAnyType.ItemsBoxedList](#itemsboxedlist)
boxed class to store validated List payloads | +| record | [ArrayHoldingAnyType.ItemsBoxedMap](#itemsboxedmap)
boxed class to store validated Map payloads | +| static class | [ArrayHoldingAnyType.Items](#items)
schema class | + +## ArrayHoldingAnyType1Boxed +public sealed interface ArrayHoldingAnyType1Boxed
+permits
+[ArrayHoldingAnyType1BoxedList](#arrayholdinganytype1boxedlist) + +sealed interface that stores validated payloads using boxed classes + +## ArrayHoldingAnyType1BoxedList +public record ArrayHoldingAnyType1BoxedList
+implements [ArrayHoldingAnyType1Boxed](#arrayholdinganytype1boxed) + +record that stores validated List payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| ArrayHoldingAnyType1BoxedList([ArrayHoldingAnyTypeList](#arrayholdinganytypelist) data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| [ArrayHoldingAnyTypeList](#arrayholdinganytypelist) | data()
validated payload | +| @Nullable Object | getData()
validated payload | + +## ArrayHoldingAnyType1 +public static class ArrayHoldingAnyType1
+extends JsonSchema + +A schema class that validates payloads + +### Code Sample +``` +import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags; +import org.openapijsonschematools.client.configurations.SchemaConfiguration; +import org.openapijsonschematools.client.exceptions.ValidationException; +import org.openapijsonschematools.client.schemas.validation.MapUtils; +import org.openapijsonschematools.client.schemas.validation.FrozenList; +import org.openapijsonschematools.client.schemas.validation.FrozenMap; +import org.openapijsonschematools.client.components.schemas.ArrayHoldingAnyType; + +import java.util.Arrays; +import java.util.List; +import java.util.AbstractMap; + +static final SchemaConfiguration configuration = new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().build()); + +// List validation +ArrayHoldingAnyType.ArrayHoldingAnyTypeList validatedPayload = + ArrayHoldingAnyType.ArrayHoldingAnyType1.validate( + new ArrayHoldingAnyType.ArrayHoldingAnyTypeListBuilder() + .build(), + configuration +); +``` + +### Field Summary +| Modifier and Type | Field and Description | +| ----------------- | ---------------------- | +| Set> | type = Set.of(List.class) | +| Class | items = [Items.class](#items) | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| [ArrayHoldingAnyTypeList](#arrayholdinganytypelist) | validate([List](#arrayholdinganytypelistbuilder) arg, SchemaConfiguration configuration) | +| [ArrayHoldingAnyType1BoxedList](#arrayholdinganytype1boxedlist) | validateAndBox([List](#arrayholdinganytypelistbuilder) arg, SchemaConfiguration configuration) | +| [ArrayHoldingAnyType1Boxed](#arrayholdinganytype1boxed) | validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) | +| @Nullable Object | validate(@Nullable Object arg, SchemaConfiguration configuration) | + +## ArrayHoldingAnyTypeListBuilder +public class ArrayHoldingAnyTypeListBuilder
+builder for `List<@Nullable Object>` + +A class that builds the List input type + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| ArrayHoldingAnyTypeListBuilder()
Creates an empty list | +| ArrayHoldingAnyTypeListBuilder(List<@Nullable Object> items)
Stores the items in a list | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| ArrayHoldingAnyTypeListBuilder | add(Nothing? item) | +| ArrayHoldingAnyTypeListBuilder | add(boolean item) | +| ArrayHoldingAnyTypeListBuilder | add(String item) | +| ArrayHoldingAnyTypeListBuilder | add(int item) | +| ArrayHoldingAnyTypeListBuilder | add(float item) | +| ArrayHoldingAnyTypeListBuilder | add(long item) | +| ArrayHoldingAnyTypeListBuilder | add(double item) | +| ArrayHoldingAnyTypeListBuilder | add(List item) | +| ArrayHoldingAnyTypeListBuilder | add(Map item) | +| List<@Nullable Object> | build()
Returns list input that should be used with Schema.validate | + +## ArrayHoldingAnyTypeList +public class ArrayHoldingAnyTypeList
+extends `FrozenList<@Nullable Object>` + +A class to store validated List payloads + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| static [ArrayHoldingAnyTypeList](#arrayholdinganytypelist) | of([List](#arrayholdinganytypelistbuilder) arg, SchemaConfiguration configuration) | + +## ItemsBoxed +public sealed interface ItemsBoxed
+permits
+[ItemsBoxedVoid](#itemsboxedvoid), +[ItemsBoxedBoolean](#itemsboxedboolean), +[ItemsBoxedNumber](#itemsboxednumber), +[ItemsBoxedString](#itemsboxedstring), +[ItemsBoxedList](#itemsboxedlist), +[ItemsBoxedMap](#itemsboxedmap) + +sealed interface that stores validated payloads using boxed classes + +## ItemsBoxedVoid +public record ItemsBoxedVoid
+implements [ItemsBoxed](#itemsboxed) + +record that stores validated null payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| ItemsBoxedVoid(Nothing? data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| Nothing? | data()
validated payload | +| @Nullable Object | getData()
validated payload | + +## ItemsBoxedBoolean +public record ItemsBoxedBoolean
+implements [ItemsBoxed](#itemsboxed) + +record that stores validated boolean payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| ItemsBoxedBoolean(boolean data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| boolean | data()
validated payload | +| @Nullable Object | getData()
validated payload | + +## ItemsBoxedNumber +public record ItemsBoxedNumber
+implements [ItemsBoxed](#itemsboxed) + +record that stores validated Number payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| ItemsBoxedNumber(Number data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| Number | data()
validated payload | +| @Nullable Object | getData()
validated payload | + +## ItemsBoxedString +public record ItemsBoxedString
+implements [ItemsBoxed](#itemsboxed) + +record that stores validated String payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| ItemsBoxedString(String data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| String | data()
validated payload | +| @Nullable Object | getData()
validated payload | + +## ItemsBoxedList +public record ItemsBoxedList
+implements [ItemsBoxed](#itemsboxed) + +record that stores validated List payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| ItemsBoxedList(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 | + +## ItemsBoxedMap +public record ItemsBoxedMap
+implements [ItemsBoxed](#itemsboxed) + +record that stores validated Map payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| ItemsBoxedMap(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 | + +## Items +public static class Items
+extends AnyTypeJsonSchema.AnyTypeJsonSchema1 + +A schema class that validates payloads + +## Description +any type can be stored here + +| Methods Inherited from class org.openapijsonschematools.client.schemas.AnyTypeJsonSchema.AnyTypeJsonSchema1 | +| ------------------------------------------------------------------ | +| validate | +| validateAndBox | + +[[Back to top]](#top) [[Back to Component Schemas]](../../../README.md#Component-Schemas) [[Back to README]](../../../README.md) diff --git a/samples/client/petstore/kotlin/docs/components/schemas/ArrayOfArrayOfNumberOnly.md b/samples/client/petstore/kotlin/docs/components/schemas/ArrayOfArrayOfNumberOnly.md new file mode 100644 index 00000000000..28caa1d772e --- /dev/null +++ b/samples/client/petstore/kotlin/docs/components/schemas/ArrayOfArrayOfNumberOnly.md @@ -0,0 +1,392 @@ +# ArrayOfArrayOfNumberOnly +org.openapijsonschematools.client.components.schemas.ArrayOfArrayOfNumberOnly.java +public class ArrayOfArrayOfNumberOnly
+ +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 list payloads, extends FrozenList +- classes to build inputs for list payloads +- classes to store validated map payloads, extends FrozenMap +- classes to build inputs for map payloads + +## Nested Class Summary +| Modifier and Type | Class and Description | +| ----------------- | ---------------------- | +| sealed interface | [ArrayOfArrayOfNumberOnly.ArrayOfArrayOfNumberOnly1Boxed](#arrayofarrayofnumberonly1boxed)
sealed interface for validated payloads | +| record | [ArrayOfArrayOfNumberOnly.ArrayOfArrayOfNumberOnly1BoxedMap](#arrayofarrayofnumberonly1boxedmap)
boxed class to store validated Map payloads | +| static class | [ArrayOfArrayOfNumberOnly.ArrayOfArrayOfNumberOnly1](#arrayofarrayofnumberonly1)
schema class | +| static class | [ArrayOfArrayOfNumberOnly.ArrayOfArrayOfNumberOnlyMapBuilder](#arrayofarrayofnumberonlymapbuilder)
builder for Map payloads | +| static class | [ArrayOfArrayOfNumberOnly.ArrayOfArrayOfNumberOnlyMap](#arrayofarrayofnumberonlymap)
output class for Map payloads | +| sealed interface | [ArrayOfArrayOfNumberOnly.ArrayArrayNumberBoxed](#arrayarraynumberboxed)
sealed interface for validated payloads | +| record | [ArrayOfArrayOfNumberOnly.ArrayArrayNumberBoxedList](#arrayarraynumberboxedlist)
boxed class to store validated List payloads | +| static class | [ArrayOfArrayOfNumberOnly.ArrayArrayNumber](#arrayarraynumber)
schema class | +| static class | [ArrayOfArrayOfNumberOnly.ArrayArrayNumberListBuilder](#arrayarraynumberlistbuilder)
builder for List payloads | +| static class | [ArrayOfArrayOfNumberOnly.ArrayArrayNumberList](#arrayarraynumberlist)
output class for List payloads | +| sealed interface | [ArrayOfArrayOfNumberOnly.ItemsBoxed](#itemsboxed)
sealed interface for validated payloads | +| record | [ArrayOfArrayOfNumberOnly.ItemsBoxedList](#itemsboxedlist)
boxed class to store validated List payloads | +| static class | [ArrayOfArrayOfNumberOnly.Items](#items)
schema class | +| static class | [ArrayOfArrayOfNumberOnly.ItemsListBuilder](#itemslistbuilder)
builder for List payloads | +| static class | [ArrayOfArrayOfNumberOnly.ItemsList](#itemslist)
output class for List payloads | +| sealed interface | [ArrayOfArrayOfNumberOnly.Items1Boxed](#items1boxed)
sealed interface for validated payloads | +| record | [ArrayOfArrayOfNumberOnly.Items1BoxedNumber](#items1boxednumber)
boxed class to store validated Number payloads | +| static class | [ArrayOfArrayOfNumberOnly.Items1](#items1)
schema class | + +## ArrayOfArrayOfNumberOnly1Boxed +public sealed interface ArrayOfArrayOfNumberOnly1Boxed
+permits
+[ArrayOfArrayOfNumberOnly1BoxedMap](#arrayofarrayofnumberonly1boxedmap) + +sealed interface that stores validated payloads using boxed classes + +## ArrayOfArrayOfNumberOnly1BoxedMap +public record ArrayOfArrayOfNumberOnly1BoxedMap
+implements [ArrayOfArrayOfNumberOnly1Boxed](#arrayofarrayofnumberonly1boxed) + +record that stores validated Map payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| ArrayOfArrayOfNumberOnly1BoxedMap([ArrayOfArrayOfNumberOnlyMap](#arrayofarrayofnumberonlymap) data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| [ArrayOfArrayOfNumberOnlyMap](#arrayofarrayofnumberonlymap) | data()
validated payload | +| @Nullable Object | getData()
validated payload | + +## ArrayOfArrayOfNumberOnly1 +public static class ArrayOfArrayOfNumberOnly1
+extends JsonSchema + +A schema class that validates payloads + +### Code Sample +``` +import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags; +import org.openapijsonschematools.client.configurations.SchemaConfiguration; +import org.openapijsonschematools.client.exceptions.ValidationException; +import org.openapijsonschematools.client.schemas.validation.MapUtils; +import org.openapijsonschematools.client.schemas.validation.FrozenList; +import org.openapijsonschematools.client.schemas.validation.FrozenMap; +import org.openapijsonschematools.client.components.schemas.ArrayOfArrayOfNumberOnly; + +import java.util.Arrays; +import java.util.List; +import java.util.AbstractMap; + +static final SchemaConfiguration configuration = new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().build()); + +// Map validation +ArrayOfArrayOfNumberOnly.ArrayOfArrayOfNumberOnlyMap validatedPayload = + ArrayOfArrayOfNumberOnly.ArrayOfArrayOfNumberOnly1.validate( + new ArrayOfArrayOfNumberOnly.ArrayOfArrayOfNumberOnlyMapBuilder() + .ArrayArrayNumber( + Arrays.asList( + Arrays.asList( + 1 + ) + ) + ) + .build(), + configuration +); +``` + +### Field Summary +| Modifier and Type | Field and Description | +| ----------------- | ---------------------- | +| Set> | type = Set.of(Map.class) | +| Map> | properties = Map.ofEntries(
    new PropertyEntry("ArrayArrayNumber", [ArrayArrayNumber.class](#arrayarraynumber)))
)
| + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| [ArrayOfArrayOfNumberOnlyMap](#arrayofarrayofnumberonlymap) | validate([Map<?, ?>](#arrayofarrayofnumberonlymapbuilder) arg, SchemaConfiguration configuration) | +| [ArrayOfArrayOfNumberOnly1BoxedMap](#arrayofarrayofnumberonly1boxedmap) | validateAndBox([Map<?, ?>](#arrayofarrayofnumberonlymapbuilder) arg, SchemaConfiguration configuration) | +| [ArrayOfArrayOfNumberOnly1Boxed](#arrayofarrayofnumberonly1boxed) | validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) | +| @Nullable Object | validate(@Nullable Object arg, SchemaConfiguration configuration) | + +## ArrayOfArrayOfNumberOnlyMapBuilder +public class ArrayOfArrayOfNumberOnlyMapBuilder
+builder for `Map` + +A class that builds the Map input type + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| ArrayOfArrayOfNumberOnlyMapBuilder()
Creates a builder that contains an empty map | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| Map | build()
Returns map input that should be used with Schema.validate | +| [ArrayOfArrayOfNumberOnlyMapBuilder](#arrayofarrayofnumberonlymapbuilder) | ArrayArrayNumber(List> value) | +| [ArrayOfArrayOfNumberOnlyMapBuilder](#arrayofarrayofnumberonlymapbuilder) | additionalProperty(String key, Nothing? value) | +| [ArrayOfArrayOfNumberOnlyMapBuilder](#arrayofarrayofnumberonlymapbuilder) | additionalProperty(String key, boolean value) | +| [ArrayOfArrayOfNumberOnlyMapBuilder](#arrayofarrayofnumberonlymapbuilder) | additionalProperty(String key, String value) | +| [ArrayOfArrayOfNumberOnlyMapBuilder](#arrayofarrayofnumberonlymapbuilder) | additionalProperty(String key, int value) | +| [ArrayOfArrayOfNumberOnlyMapBuilder](#arrayofarrayofnumberonlymapbuilder) | additionalProperty(String key, float value) | +| [ArrayOfArrayOfNumberOnlyMapBuilder](#arrayofarrayofnumberonlymapbuilder) | additionalProperty(String key, long value) | +| [ArrayOfArrayOfNumberOnlyMapBuilder](#arrayofarrayofnumberonlymapbuilder) | additionalProperty(String key, double value) | +| [ArrayOfArrayOfNumberOnlyMapBuilder](#arrayofarrayofnumberonlymapbuilder) | additionalProperty(String key, List value) | +| [ArrayOfArrayOfNumberOnlyMapBuilder](#arrayofarrayofnumberonlymapbuilder) | additionalProperty(String key, Map value) | + +## ArrayOfArrayOfNumberOnlyMap +public static class ArrayOfArrayOfNumberOnlyMap
+extends FrozenMap + +A class to store validated Map payloads + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| static [ArrayOfArrayOfNumberOnlyMap](#arrayofarrayofnumberonlymap) | of([Map](#arrayofarrayofnumberonlymapbuilder) arg, SchemaConfiguration configuration) | +| [ArrayArrayNumberList](#arrayarraynumberlist) | ArrayArrayNumber()
[optional] | +| @Nullable Object | getAdditionalProperty(String name)
provides type safety for additional properties | + +## ArrayArrayNumberBoxed +public sealed interface ArrayArrayNumberBoxed
+permits
+[ArrayArrayNumberBoxedList](#arrayarraynumberboxedlist) + +sealed interface that stores validated payloads using boxed classes + +## ArrayArrayNumberBoxedList +public record ArrayArrayNumberBoxedList
+implements [ArrayArrayNumberBoxed](#arrayarraynumberboxed) + +record that stores validated List payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| ArrayArrayNumberBoxedList([ArrayArrayNumberList](#arrayarraynumberlist) data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| [ArrayArrayNumberList](#arrayarraynumberlist) | data()
validated payload | +| @Nullable Object | getData()
validated payload | + +## ArrayArrayNumber +public static class ArrayArrayNumber
+extends JsonSchema + +A schema class that validates payloads + +### Code Sample +``` +import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags; +import org.openapijsonschematools.client.configurations.SchemaConfiguration; +import org.openapijsonschematools.client.exceptions.ValidationException; +import org.openapijsonschematools.client.schemas.validation.MapUtils; +import org.openapijsonschematools.client.schemas.validation.FrozenList; +import org.openapijsonschematools.client.schemas.validation.FrozenMap; +import org.openapijsonschematools.client.components.schemas.ArrayOfArrayOfNumberOnly; + +import java.util.Arrays; +import java.util.List; +import java.util.AbstractMap; + +static final SchemaConfiguration configuration = new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().build()); + +// List validation +ArrayOfArrayOfNumberOnly.ArrayArrayNumberList validatedPayload = + ArrayOfArrayOfNumberOnly.ArrayArrayNumber.validate( + new ArrayOfArrayOfNumberOnly.ArrayArrayNumberListBuilder() + .add( + Arrays.asList( + 1 + ) + ) + .build(), + configuration +); +``` + +### Field Summary +| Modifier and Type | Field and Description | +| ----------------- | ---------------------- | +| Set> | type = Set.of(List.class) | +| Class | items = [Items.class](#items) | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| [ArrayArrayNumberList](#arrayarraynumberlist) | validate([List](#arrayarraynumberlistbuilder) arg, SchemaConfiguration configuration) | +| [ArrayArrayNumberBoxedList](#arrayarraynumberboxedlist) | validateAndBox([List](#arrayarraynumberlistbuilder) arg, SchemaConfiguration configuration) | +| [ArrayArrayNumberBoxed](#arrayarraynumberboxed) | validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) | +| @Nullable Object | validate(@Nullable Object arg, SchemaConfiguration configuration) | + +## ArrayArrayNumberListBuilder +public class ArrayArrayNumberListBuilder
+builder for `List>` + +A class that builds the List input type + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| ArrayArrayNumberListBuilder()
Creates an empty list | +| ArrayArrayNumberListBuilder(List> items)
Stores the items in a list | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| ArrayArrayNumberListBuilder | add(List item) | +| List> | build()
Returns list input that should be used with Schema.validate | + +## ArrayArrayNumberList +public class ArrayArrayNumberList
+extends `FrozenList` + +A class to store validated List payloads + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| static [ArrayArrayNumberList](#arrayarraynumberlist) | of([List>](#arrayarraynumberlistbuilder) arg, SchemaConfiguration configuration) | + +## ItemsBoxed +public sealed interface ItemsBoxed
+permits
+[ItemsBoxedList](#itemsboxedlist) + +sealed interface that stores validated payloads using boxed classes + +## ItemsBoxedList +public record ItemsBoxedList
+implements [ItemsBoxed](#itemsboxed) + +record that stores validated List payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| ItemsBoxedList([ItemsList](#itemslist) data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| [ItemsList](#itemslist) | data()
validated payload | +| @Nullable Object | getData()
validated payload | + +## Items +public static class Items
+extends JsonSchema + +A schema class that validates payloads + +### Code Sample +``` +import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags; +import org.openapijsonschematools.client.configurations.SchemaConfiguration; +import org.openapijsonschematools.client.exceptions.ValidationException; +import org.openapijsonschematools.client.schemas.validation.MapUtils; +import org.openapijsonschematools.client.schemas.validation.FrozenList; +import org.openapijsonschematools.client.schemas.validation.FrozenMap; +import org.openapijsonschematools.client.components.schemas.ArrayOfArrayOfNumberOnly; + +import java.util.Arrays; +import java.util.List; +import java.util.AbstractMap; + +static final SchemaConfiguration configuration = new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().build()); + +// List validation +ArrayOfArrayOfNumberOnly.ItemsList validatedPayload = + ArrayOfArrayOfNumberOnly.Items.validate( + new ArrayOfArrayOfNumberOnly.ItemsListBuilder() + .add(1) + + .build(), + configuration +); +``` + +### Field Summary +| Modifier and Type | Field and Description | +| ----------------- | ---------------------- | +| Set> | type = Set.of(List.class) | +| Class | items = [Items1.class](#items1) | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| [ItemsList](#itemslist) | validate([List](#itemslistbuilder) arg, SchemaConfiguration configuration) | +| [ItemsBoxedList](#itemsboxedlist) | validateAndBox([List](#itemslistbuilder) arg, SchemaConfiguration configuration) | +| [ItemsBoxed](#itemsboxed) | validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) | +| @Nullable Object | validate(@Nullable Object arg, SchemaConfiguration configuration) | + +## ItemsListBuilder +public class ItemsListBuilder
+builder for `List` + +A class that builds the List input type + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| ItemsListBuilder()
Creates an empty list | +| ItemsListBuilder(List items)
Stores the items in a list | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| ItemsListBuilder | add(int item) | +| ItemsListBuilder | add(float item) | +| ItemsListBuilder | add(long item) | +| ItemsListBuilder | add(double item) | +| List | build()
Returns list input that should be used with Schema.validate | + +## ItemsList +public class ItemsList
+extends `FrozenList` + +A class to store validated List payloads + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| static [ItemsList](#itemslist) | of([List](#itemslistbuilder) arg, SchemaConfiguration configuration) | + +## Items1Boxed +public sealed interface Items1Boxed
+permits
+[Items1BoxedNumber](#items1boxednumber) + +sealed interface that stores validated payloads using boxed classes + +## Items1BoxedNumber +public record Items1BoxedNumber
+implements [Items1Boxed](#items1boxed) + +record that stores validated Number payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| Items1BoxedNumber(Number data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| Number | data()
validated payload | +| @Nullable Object | getData()
validated payload | + +## Items1 +public static class Items1
+extends NumberJsonSchema.NumberJsonSchema1 + +A schema class that validates payloads + +| Methods Inherited from class org.openapijsonschematools.client.schemas.NumberJsonSchema.NumberJsonSchema1 | +| ------------------------------------------------------------------ | +| validate | +| validateAndBox | + +[[Back to top]](#top) [[Back to Component Schemas]](../../../README.md#Component-Schemas) [[Back to README]](../../../README.md) diff --git a/samples/client/petstore/kotlin/docs/components/schemas/ArrayOfEnums.md b/samples/client/petstore/kotlin/docs/components/schemas/ArrayOfEnums.md new file mode 100644 index 00000000000..8ed1ba8964c --- /dev/null +++ b/samples/client/petstore/kotlin/docs/components/schemas/ArrayOfEnums.md @@ -0,0 +1,124 @@ +# ArrayOfEnums +org.openapijsonschematools.client.components.schemas.ArrayOfEnums.java +public class ArrayOfEnums
+ +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 list payloads, extends FrozenList +- classes to build inputs for list payloads + +## Nested Class Summary +| Modifier and Type | Class and Description | +| ----------------- | ---------------------- | +| sealed interface | [ArrayOfEnums.ArrayOfEnums1Boxed](#arrayofenums1boxed)
sealed interface for validated payloads | +| record | [ArrayOfEnums.ArrayOfEnums1BoxedList](#arrayofenums1boxedlist)
boxed class to store validated List payloads | +| static class | [ArrayOfEnums.ArrayOfEnums1](#arrayofenums1)
schema class | +| static class | [ArrayOfEnums.ArrayOfEnumsListBuilder](#arrayofenumslistbuilder)
builder for List payloads | +| static class | [ArrayOfEnums.ArrayOfEnumsList](#arrayofenumslist)
output class for List payloads | + +## ArrayOfEnums1Boxed +public sealed interface ArrayOfEnums1Boxed
+permits
+[ArrayOfEnums1BoxedList](#arrayofenums1boxedlist) + +sealed interface that stores validated payloads using boxed classes + +## ArrayOfEnums1BoxedList +public record ArrayOfEnums1BoxedList
+implements [ArrayOfEnums1Boxed](#arrayofenums1boxed) + +record that stores validated List payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| ArrayOfEnums1BoxedList([ArrayOfEnumsList](#arrayofenumslist) data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| [ArrayOfEnumsList](#arrayofenumslist) | data()
validated payload | +| @Nullable Object | getData()
validated payload | + +## ArrayOfEnums1 +public static class ArrayOfEnums1
+extends JsonSchema + +A schema class that validates payloads + +### Code Sample +``` +import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags; +import org.openapijsonschematools.client.configurations.SchemaConfiguration; +import org.openapijsonschematools.client.exceptions.ValidationException; +import org.openapijsonschematools.client.schemas.validation.MapUtils; +import org.openapijsonschematools.client.schemas.validation.FrozenList; +import org.openapijsonschematools.client.schemas.validation.FrozenMap; +import org.openapijsonschematools.client.components.schemas.ArrayOfEnums; + +import java.util.Arrays; +import java.util.List; +import java.util.AbstractMap; + +static final SchemaConfiguration configuration = new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().build()); + +// List validation +ArrayOfEnums.ArrayOfEnumsList validatedPayload = + ArrayOfEnums.ArrayOfEnums1.validate( + new ArrayOfEnums.ArrayOfEnumsListBuilder() + .add((Nothing?) null) + + .build(), + configuration +); +``` + +### Field Summary +| Modifier and Type | Field and Description | +| ----------------- | ---------------------- | +| Set> | type = Set.of(List.class) | +| Class | items = [StringEnum.StringEnum1.class](../../components/schemas/StringEnum.md#stringenum1) | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| [ArrayOfEnumsList](#arrayofenumslist) | validate([List](#arrayofenumslistbuilder) arg, SchemaConfiguration configuration) | +| [ArrayOfEnums1BoxedList](#arrayofenums1boxedlist) | validateAndBox([List](#arrayofenumslistbuilder) arg, SchemaConfiguration configuration) | +| [ArrayOfEnums1Boxed](#arrayofenums1boxed) | validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) | +| @Nullable Object | validate(@Nullable Object arg, SchemaConfiguration configuration) | + +## ArrayOfEnumsListBuilder +public class ArrayOfEnumsListBuilder
+builder for `List<@Nullable String>` + +A class that builds the List input type + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| ArrayOfEnumsListBuilder()
Creates an empty list | +| ArrayOfEnumsListBuilder(List<@Nullable String> items)
Stores the items in a list | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| ArrayOfEnumsListBuilder | add(Nothing? item) | +| ArrayOfEnumsListBuilder | add(String item) | +| ArrayOfEnumsListBuilder | add([StringEnum.StringStringEnumEnums](../../components/schemas/StringEnum.md#stringstringenumenums) item) | +| ArrayOfEnumsListBuilder | add([StringEnum.NullStringEnumEnums](../../components/schemas/StringEnum.md#nullstringenumenums) item) | +| List<@Nullable String> | build()
Returns list input that should be used with Schema.validate | + +## ArrayOfEnumsList +public class ArrayOfEnumsList
+extends `FrozenList<@Nullable String>` + +A class to store validated List payloads + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| static [ArrayOfEnumsList](#arrayofenumslist) | of([List](#arrayofenumslistbuilder) arg, SchemaConfiguration configuration) | + +[[Back to top]](#top) [[Back to Component Schemas]](../../../README.md#Component-Schemas) [[Back to README]](../../../README.md) diff --git a/samples/client/petstore/kotlin/docs/components/schemas/ArrayOfNumberOnly.md b/samples/client/petstore/kotlin/docs/components/schemas/ArrayOfNumberOnly.md new file mode 100644 index 00000000000..a434e5d291d --- /dev/null +++ b/samples/client/petstore/kotlin/docs/components/schemas/ArrayOfNumberOnly.md @@ -0,0 +1,282 @@ +# ArrayOfNumberOnly +org.openapijsonschematools.client.components.schemas.ArrayOfNumberOnly.java +public class ArrayOfNumberOnly
+ +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 list payloads, extends FrozenList +- classes to build inputs for list payloads +- classes to store validated map payloads, extends FrozenMap +- classes to build inputs for map payloads + +## Nested Class Summary +| Modifier and Type | Class and Description | +| ----------------- | ---------------------- | +| sealed interface | [ArrayOfNumberOnly.ArrayOfNumberOnly1Boxed](#arrayofnumberonly1boxed)
sealed interface for validated payloads | +| record | [ArrayOfNumberOnly.ArrayOfNumberOnly1BoxedMap](#arrayofnumberonly1boxedmap)
boxed class to store validated Map payloads | +| static class | [ArrayOfNumberOnly.ArrayOfNumberOnly1](#arrayofnumberonly1)
schema class | +| static class | [ArrayOfNumberOnly.ArrayOfNumberOnlyMapBuilder](#arrayofnumberonlymapbuilder)
builder for Map payloads | +| static class | [ArrayOfNumberOnly.ArrayOfNumberOnlyMap](#arrayofnumberonlymap)
output class for Map payloads | +| sealed interface | [ArrayOfNumberOnly.ArrayNumberBoxed](#arraynumberboxed)
sealed interface for validated payloads | +| record | [ArrayOfNumberOnly.ArrayNumberBoxedList](#arraynumberboxedlist)
boxed class to store validated List payloads | +| static class | [ArrayOfNumberOnly.ArrayNumber](#arraynumber)
schema class | +| static class | [ArrayOfNumberOnly.ArrayNumberListBuilder](#arraynumberlistbuilder)
builder for List payloads | +| static class | [ArrayOfNumberOnly.ArrayNumberList](#arraynumberlist)
output class for List payloads | +| sealed interface | [ArrayOfNumberOnly.ItemsBoxed](#itemsboxed)
sealed interface for validated payloads | +| record | [ArrayOfNumberOnly.ItemsBoxedNumber](#itemsboxednumber)
boxed class to store validated Number payloads | +| static class | [ArrayOfNumberOnly.Items](#items)
schema class | + +## ArrayOfNumberOnly1Boxed +public sealed interface ArrayOfNumberOnly1Boxed
+permits
+[ArrayOfNumberOnly1BoxedMap](#arrayofnumberonly1boxedmap) + +sealed interface that stores validated payloads using boxed classes + +## ArrayOfNumberOnly1BoxedMap +public record ArrayOfNumberOnly1BoxedMap
+implements [ArrayOfNumberOnly1Boxed](#arrayofnumberonly1boxed) + +record that stores validated Map payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| ArrayOfNumberOnly1BoxedMap([ArrayOfNumberOnlyMap](#arrayofnumberonlymap) data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| [ArrayOfNumberOnlyMap](#arrayofnumberonlymap) | data()
validated payload | +| @Nullable Object | getData()
validated payload | + +## ArrayOfNumberOnly1 +public static class ArrayOfNumberOnly1
+extends JsonSchema + +A schema class that validates payloads + +### Code Sample +``` +import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags; +import org.openapijsonschematools.client.configurations.SchemaConfiguration; +import org.openapijsonschematools.client.exceptions.ValidationException; +import org.openapijsonschematools.client.schemas.validation.MapUtils; +import org.openapijsonschematools.client.schemas.validation.FrozenList; +import org.openapijsonschematools.client.schemas.validation.FrozenMap; +import org.openapijsonschematools.client.components.schemas.ArrayOfNumberOnly; + +import java.util.Arrays; +import java.util.List; +import java.util.AbstractMap; + +static final SchemaConfiguration configuration = new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().build()); + +// Map validation +ArrayOfNumberOnly.ArrayOfNumberOnlyMap validatedPayload = + ArrayOfNumberOnly.ArrayOfNumberOnly1.validate( + new ArrayOfNumberOnly.ArrayOfNumberOnlyMapBuilder() + .ArrayNumber( + Arrays.asList( + 1 + ) + ) + .build(), + configuration +); +``` + +### Field Summary +| Modifier and Type | Field and Description | +| ----------------- | ---------------------- | +| Set> | type = Set.of(Map.class) | +| Map> | properties = Map.ofEntries(
    new PropertyEntry("ArrayNumber", [ArrayNumber.class](#arraynumber)))
)
| + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| [ArrayOfNumberOnlyMap](#arrayofnumberonlymap) | validate([Map<?, ?>](#arrayofnumberonlymapbuilder) arg, SchemaConfiguration configuration) | +| [ArrayOfNumberOnly1BoxedMap](#arrayofnumberonly1boxedmap) | validateAndBox([Map<?, ?>](#arrayofnumberonlymapbuilder) arg, SchemaConfiguration configuration) | +| [ArrayOfNumberOnly1Boxed](#arrayofnumberonly1boxed) | validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) | +| @Nullable Object | validate(@Nullable Object arg, SchemaConfiguration configuration) | + +## ArrayOfNumberOnlyMapBuilder +public class ArrayOfNumberOnlyMapBuilder
+builder for `Map` + +A class that builds the Map input type + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| ArrayOfNumberOnlyMapBuilder()
Creates a builder that contains an empty map | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| Map | build()
Returns map input that should be used with Schema.validate | +| [ArrayOfNumberOnlyMapBuilder](#arrayofnumberonlymapbuilder) | ArrayNumber(List value) | +| [ArrayOfNumberOnlyMapBuilder](#arrayofnumberonlymapbuilder) | additionalProperty(String key, Nothing? value) | +| [ArrayOfNumberOnlyMapBuilder](#arrayofnumberonlymapbuilder) | additionalProperty(String key, boolean value) | +| [ArrayOfNumberOnlyMapBuilder](#arrayofnumberonlymapbuilder) | additionalProperty(String key, String value) | +| [ArrayOfNumberOnlyMapBuilder](#arrayofnumberonlymapbuilder) | additionalProperty(String key, int value) | +| [ArrayOfNumberOnlyMapBuilder](#arrayofnumberonlymapbuilder) | additionalProperty(String key, float value) | +| [ArrayOfNumberOnlyMapBuilder](#arrayofnumberonlymapbuilder) | additionalProperty(String key, long value) | +| [ArrayOfNumberOnlyMapBuilder](#arrayofnumberonlymapbuilder) | additionalProperty(String key, double value) | +| [ArrayOfNumberOnlyMapBuilder](#arrayofnumberonlymapbuilder) | additionalProperty(String key, List value) | +| [ArrayOfNumberOnlyMapBuilder](#arrayofnumberonlymapbuilder) | additionalProperty(String key, Map value) | + +## ArrayOfNumberOnlyMap +public static class ArrayOfNumberOnlyMap
+extends FrozenMap + +A class to store validated Map payloads + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| static [ArrayOfNumberOnlyMap](#arrayofnumberonlymap) | of([Map](#arrayofnumberonlymapbuilder) arg, SchemaConfiguration configuration) | +| [ArrayNumberList](#arraynumberlist) | ArrayNumber()
[optional] | +| @Nullable Object | getAdditionalProperty(String name)
provides type safety for additional properties | + +## ArrayNumberBoxed +public sealed interface ArrayNumberBoxed
+permits
+[ArrayNumberBoxedList](#arraynumberboxedlist) + +sealed interface that stores validated payloads using boxed classes + +## ArrayNumberBoxedList +public record ArrayNumberBoxedList
+implements [ArrayNumberBoxed](#arraynumberboxed) + +record that stores validated List payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| ArrayNumberBoxedList([ArrayNumberList](#arraynumberlist) data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| [ArrayNumberList](#arraynumberlist) | data()
validated payload | +| @Nullable Object | getData()
validated payload | + +## ArrayNumber +public static class ArrayNumber
+extends JsonSchema + +A schema class that validates payloads + +### Code Sample +``` +import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags; +import org.openapijsonschematools.client.configurations.SchemaConfiguration; +import org.openapijsonschematools.client.exceptions.ValidationException; +import org.openapijsonschematools.client.schemas.validation.MapUtils; +import org.openapijsonschematools.client.schemas.validation.FrozenList; +import org.openapijsonschematools.client.schemas.validation.FrozenMap; +import org.openapijsonschematools.client.components.schemas.ArrayOfNumberOnly; + +import java.util.Arrays; +import java.util.List; +import java.util.AbstractMap; + +static final SchemaConfiguration configuration = new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().build()); + +// List validation +ArrayOfNumberOnly.ArrayNumberList validatedPayload = + ArrayOfNumberOnly.ArrayNumber.validate( + new ArrayOfNumberOnly.ArrayNumberListBuilder() + .add(1) + + .build(), + configuration +); +``` + +### Field Summary +| Modifier and Type | Field and Description | +| ----------------- | ---------------------- | +| Set> | type = Set.of(List.class) | +| Class | items = [Items.class](#items) | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| [ArrayNumberList](#arraynumberlist) | validate([List](#arraynumberlistbuilder) arg, SchemaConfiguration configuration) | +| [ArrayNumberBoxedList](#arraynumberboxedlist) | validateAndBox([List](#arraynumberlistbuilder) arg, SchemaConfiguration configuration) | +| [ArrayNumberBoxed](#arraynumberboxed) | validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) | +| @Nullable Object | validate(@Nullable Object arg, SchemaConfiguration configuration) | + +## ArrayNumberListBuilder +public class ArrayNumberListBuilder
+builder for `List` + +A class that builds the List input type + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| ArrayNumberListBuilder()
Creates an empty list | +| ArrayNumberListBuilder(List items)
Stores the items in a list | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| ArrayNumberListBuilder | add(int item) | +| ArrayNumberListBuilder | add(float item) | +| ArrayNumberListBuilder | add(long item) | +| ArrayNumberListBuilder | add(double item) | +| List | build()
Returns list input that should be used with Schema.validate | + +## ArrayNumberList +public class ArrayNumberList
+extends `FrozenList` + +A class to store validated List payloads + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| static [ArrayNumberList](#arraynumberlist) | of([List](#arraynumberlistbuilder) arg, SchemaConfiguration configuration) | + +## ItemsBoxed +public sealed interface ItemsBoxed
+permits
+[ItemsBoxedNumber](#itemsboxednumber) + +sealed interface that stores validated payloads using boxed classes + +## ItemsBoxedNumber +public record ItemsBoxedNumber
+implements [ItemsBoxed](#itemsboxed) + +record that stores validated Number payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| ItemsBoxedNumber(Number data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| Number | data()
validated payload | +| @Nullable Object | getData()
validated payload | + +## Items +public static class Items
+extends NumberJsonSchema.NumberJsonSchema1 + +A schema class that validates payloads + +| Methods Inherited from class org.openapijsonschematools.client.schemas.NumberJsonSchema.NumberJsonSchema1 | +| ------------------------------------------------------------------ | +| validate | +| validateAndBox | + +[[Back to top]](#top) [[Back to Component Schemas]](../../../README.md#Component-Schemas) [[Back to README]](../../../README.md) diff --git a/samples/client/petstore/kotlin/docs/components/schemas/ArrayTest.md b/samples/client/petstore/kotlin/docs/components/schemas/ArrayTest.md new file mode 100644 index 00000000000..85ebfd0365a --- /dev/null +++ b/samples/client/petstore/kotlin/docs/components/schemas/ArrayTest.md @@ -0,0 +1,792 @@ +# ArrayTest +org.openapijsonschematools.client.components.schemas.ArrayTest.java +public class ArrayTest
+ +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 list payloads, extends FrozenList +- classes to build inputs for list payloads +- classes to store validated map payloads, extends FrozenMap +- classes to build inputs for map payloads + +## Nested Class Summary +| Modifier and Type | Class and Description | +| ----------------- | ---------------------- | +| sealed interface | [ArrayTest.ArrayTest1Boxed](#arraytest1boxed)
sealed interface for validated payloads | +| record | [ArrayTest.ArrayTest1BoxedMap](#arraytest1boxedmap)
boxed class to store validated Map payloads | +| static class | [ArrayTest.ArrayTest1](#arraytest1)
schema class | +| static class | [ArrayTest.ArrayTestMapBuilder](#arraytestmapbuilder)
builder for Map payloads | +| static class | [ArrayTest.ArrayTestMap](#arraytestmap)
output class for Map payloads | +| sealed interface | [ArrayTest.ArrayArrayOfModelBoxed](#arrayarrayofmodelboxed)
sealed interface for validated payloads | +| record | [ArrayTest.ArrayArrayOfModelBoxedList](#arrayarrayofmodelboxedlist)
boxed class to store validated List payloads | +| static class | [ArrayTest.ArrayArrayOfModel](#arrayarrayofmodel)
schema class | +| static class | [ArrayTest.ArrayArrayOfModelListBuilder](#arrayarrayofmodellistbuilder)
builder for List payloads | +| static class | [ArrayTest.ArrayArrayOfModelList](#arrayarrayofmodellist)
output class for List payloads | +| sealed interface | [ArrayTest.Items3Boxed](#items3boxed)
sealed interface for validated payloads | +| record | [ArrayTest.Items3BoxedList](#items3boxedlist)
boxed class to store validated List payloads | +| static class | [ArrayTest.Items3](#items3)
schema class | +| static class | [ArrayTest.ItemsListBuilder1](#itemslistbuilder1)
builder for List payloads | +| static class | [ArrayTest.ItemsList1](#itemslist1)
output class for List payloads | +| sealed interface | [ArrayTest.ArrayArrayOfIntegerBoxed](#arrayarrayofintegerboxed)
sealed interface for validated payloads | +| record | [ArrayTest.ArrayArrayOfIntegerBoxedList](#arrayarrayofintegerboxedlist)
boxed class to store validated List payloads | +| static class | [ArrayTest.ArrayArrayOfInteger](#arrayarrayofinteger)
schema class | +| static class | [ArrayTest.ArrayArrayOfIntegerListBuilder](#arrayarrayofintegerlistbuilder)
builder for List payloads | +| static class | [ArrayTest.ArrayArrayOfIntegerList](#arrayarrayofintegerlist)
output class for List payloads | +| sealed interface | [ArrayTest.Items1Boxed](#items1boxed)
sealed interface for validated payloads | +| record | [ArrayTest.Items1BoxedList](#items1boxedlist)
boxed class to store validated List payloads | +| static class | [ArrayTest.Items1](#items1)
schema class | +| static class | [ArrayTest.ItemsListBuilder](#itemslistbuilder)
builder for List payloads | +| static class | [ArrayTest.ItemsList](#itemslist)
output class for List payloads | +| sealed interface | [ArrayTest.Items2Boxed](#items2boxed)
sealed interface for validated payloads | +| record | [ArrayTest.Items2BoxedNumber](#items2boxednumber)
boxed class to store validated Number payloads | +| static class | [ArrayTest.Items2](#items2)
schema class | +| sealed interface | [ArrayTest.ArrayOfStringBoxed](#arrayofstringboxed)
sealed interface for validated payloads | +| record | [ArrayTest.ArrayOfStringBoxedList](#arrayofstringboxedlist)
boxed class to store validated List payloads | +| static class | [ArrayTest.ArrayOfString](#arrayofstring)
schema class | +| static class | [ArrayTest.ArrayOfStringListBuilder](#arrayofstringlistbuilder)
builder for List payloads | +| static class | [ArrayTest.ArrayOfStringList](#arrayofstringlist)
output class for List payloads | +| sealed interface | [ArrayTest.ItemsBoxed](#itemsboxed)
sealed interface for validated payloads | +| record | [ArrayTest.ItemsBoxedString](#itemsboxedstring)
boxed class to store validated String payloads | +| static class | [ArrayTest.Items](#items)
schema class | + +## ArrayTest1Boxed +public sealed interface ArrayTest1Boxed
+permits
+[ArrayTest1BoxedMap](#arraytest1boxedmap) + +sealed interface that stores validated payloads using boxed classes + +## ArrayTest1BoxedMap +public record ArrayTest1BoxedMap
+implements [ArrayTest1Boxed](#arraytest1boxed) + +record that stores validated Map payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| ArrayTest1BoxedMap([ArrayTestMap](#arraytestmap) data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| [ArrayTestMap](#arraytestmap) | data()
validated payload | +| @Nullable Object | getData()
validated payload | + +## ArrayTest1 +public static class ArrayTest1
+extends JsonSchema + +A schema class that validates payloads + +### Code Sample +``` +import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags; +import org.openapijsonschematools.client.configurations.SchemaConfiguration; +import org.openapijsonschematools.client.exceptions.ValidationException; +import org.openapijsonschematools.client.schemas.validation.MapUtils; +import org.openapijsonschematools.client.schemas.validation.FrozenList; +import org.openapijsonschematools.client.schemas.validation.FrozenMap; +import org.openapijsonschematools.client.components.schemas.ArrayTest; + +import java.util.Arrays; +import java.util.List; +import java.util.AbstractMap; + +static final SchemaConfiguration configuration = new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().build()); + +// Map validation +ArrayTest.ArrayTestMap validatedPayload = + ArrayTest.ArrayTest1.validate( + new ArrayTest.ArrayTestMapBuilder() + .array_of_string( + Arrays.asList( + "a" + ) + ) + .array_array_of_integer( + Arrays.asList( + Arrays.asList( + 1L + ) + ) + ) + .array_array_of_model( + Arrays.asList( + Arrays.asList( + MapUtils.makeMap( + new AbstractMap.SimpleEntry( + "bar", + "a" + ), + new AbstractMap.SimpleEntry( + "baz", + "a" + ) + ) + ) + ) + ) + .build(), + configuration +); +``` + +### Field Summary +| Modifier and Type | Field and Description | +| ----------------- | ---------------------- | +| Set> | type = Set.of(Map.class) | +| Map> | properties = Map.ofEntries(
    new PropertyEntry("array_of_string", [ArrayOfString.class](#arrayofstring))),
    new PropertyEntry("array_array_of_integer", [ArrayArrayOfInteger.class](#arrayarrayofinteger))),
    new PropertyEntry("array_array_of_model", [ArrayArrayOfModel.class](#arrayarrayofmodel)))
)
| + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| [ArrayTestMap](#arraytestmap) | validate([Map<?, ?>](#arraytestmapbuilder) arg, SchemaConfiguration configuration) | +| [ArrayTest1BoxedMap](#arraytest1boxedmap) | validateAndBox([Map<?, ?>](#arraytestmapbuilder) arg, SchemaConfiguration configuration) | +| [ArrayTest1Boxed](#arraytest1boxed) | validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) | +| @Nullable Object | validate(@Nullable Object arg, SchemaConfiguration configuration) | + +## ArrayTestMapBuilder +public class ArrayTestMapBuilder
+builder for `Map` + +A class that builds the Map input type + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| ArrayTestMapBuilder()
Creates a builder that contains an empty map | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| Map | build()
Returns map input that should be used with Schema.validate | +| [ArrayTestMapBuilder](#arraytestmapbuilder) | array_of_string(List value) | +| [ArrayTestMapBuilder](#arraytestmapbuilder) | array_array_of_integer(List> value) | +| [ArrayTestMapBuilder](#arraytestmapbuilder) | array_array_of_model(List>> value) | +| [ArrayTestMapBuilder](#arraytestmapbuilder) | additionalProperty(String key, Nothing? value) | +| [ArrayTestMapBuilder](#arraytestmapbuilder) | additionalProperty(String key, boolean value) | +| [ArrayTestMapBuilder](#arraytestmapbuilder) | additionalProperty(String key, String value) | +| [ArrayTestMapBuilder](#arraytestmapbuilder) | additionalProperty(String key, int value) | +| [ArrayTestMapBuilder](#arraytestmapbuilder) | additionalProperty(String key, float value) | +| [ArrayTestMapBuilder](#arraytestmapbuilder) | additionalProperty(String key, long value) | +| [ArrayTestMapBuilder](#arraytestmapbuilder) | additionalProperty(String key, double value) | +| [ArrayTestMapBuilder](#arraytestmapbuilder) | additionalProperty(String key, List value) | +| [ArrayTestMapBuilder](#arraytestmapbuilder) | additionalProperty(String key, Map value) | + +## ArrayTestMap +public static class ArrayTestMap
+extends FrozenMap + +A class to store validated Map payloads + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| static [ArrayTestMap](#arraytestmap) | of([Map](#arraytestmapbuilder) arg, SchemaConfiguration configuration) | +| [ArrayOfStringList](#arrayofstringlist) | array_of_string()
[optional] | +| [ArrayArrayOfIntegerList](#arrayarrayofintegerlist) | array_array_of_integer()
[optional] | +| [ArrayArrayOfModelList](#arrayarrayofmodellist) | array_array_of_model()
[optional] | +| @Nullable Object | getAdditionalProperty(String name)
provides type safety for additional properties | + +## ArrayArrayOfModelBoxed +public sealed interface ArrayArrayOfModelBoxed
+permits
+[ArrayArrayOfModelBoxedList](#arrayarrayofmodelboxedlist) + +sealed interface that stores validated payloads using boxed classes + +## ArrayArrayOfModelBoxedList +public record ArrayArrayOfModelBoxedList
+implements [ArrayArrayOfModelBoxed](#arrayarrayofmodelboxed) + +record that stores validated List payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| ArrayArrayOfModelBoxedList([ArrayArrayOfModelList](#arrayarrayofmodellist) data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| [ArrayArrayOfModelList](#arrayarrayofmodellist) | data()
validated payload | +| @Nullable Object | getData()
validated payload | + +## ArrayArrayOfModel +public static class ArrayArrayOfModel
+extends JsonSchema + +A schema class that validates payloads + +### Code Sample +``` +import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags; +import org.openapijsonschematools.client.configurations.SchemaConfiguration; +import org.openapijsonschematools.client.exceptions.ValidationException; +import org.openapijsonschematools.client.schemas.validation.MapUtils; +import org.openapijsonschematools.client.schemas.validation.FrozenList; +import org.openapijsonschematools.client.schemas.validation.FrozenMap; +import org.openapijsonschematools.client.components.schemas.ArrayTest; + +import java.util.Arrays; +import java.util.List; +import java.util.AbstractMap; + +static final SchemaConfiguration configuration = new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().build()); + +// List validation +ArrayTest.ArrayArrayOfModelList validatedPayload = + ArrayTest.ArrayArrayOfModel.validate( + new ArrayTest.ArrayArrayOfModelListBuilder() + .add( + Arrays.asList( + MapUtils.makeMap( + new AbstractMap.SimpleEntry( + "bar", + "a" + ), + new AbstractMap.SimpleEntry( + "baz", + "a" + ) + ) + ) + ) + .build(), + configuration +); +``` + +### Field Summary +| Modifier and Type | Field and Description | +| ----------------- | ---------------------- | +| Set> | type = Set.of(List.class) | +| Class | items = [Items3.class](#items3) | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| [ArrayArrayOfModelList](#arrayarrayofmodellist) | validate([List](#arrayarrayofmodellistbuilder) arg, SchemaConfiguration configuration) | +| [ArrayArrayOfModelBoxedList](#arrayarrayofmodelboxedlist) | validateAndBox([List](#arrayarrayofmodellistbuilder) arg, SchemaConfiguration configuration) | +| [ArrayArrayOfModelBoxed](#arrayarrayofmodelboxed) | validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) | +| @Nullable Object | validate(@Nullable Object arg, SchemaConfiguration configuration) | + +## ArrayArrayOfModelListBuilder +public class ArrayArrayOfModelListBuilder
+builder for `List>>` + +A class that builds the List input type + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| ArrayArrayOfModelListBuilder()
Creates an empty list | +| ArrayArrayOfModelListBuilder(List>> items)
Stores the items in a list | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| ArrayArrayOfModelListBuilder | add(List> item) | +| List>> | build()
Returns list input that should be used with Schema.validate | + +## ArrayArrayOfModelList +public class ArrayArrayOfModelList
+extends `FrozenList` + +A class to store validated List payloads + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| static [ArrayArrayOfModelList](#arrayarrayofmodellist) | of([List>>](#arrayarrayofmodellistbuilder) arg, SchemaConfiguration configuration) | + +## Items3Boxed +public sealed interface Items3Boxed
+permits
+[Items3BoxedList](#items3boxedlist) + +sealed interface that stores validated payloads using boxed classes + +## Items3BoxedList +public record Items3BoxedList
+implements [Items3Boxed](#items3boxed) + +record that stores validated List payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| Items3BoxedList([ItemsList1](#itemslist1) data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| [ItemsList1](#itemslist1) | data()
validated payload | +| @Nullable Object | getData()
validated payload | + +## Items3 +public static class Items3
+extends JsonSchema + +A schema class that validates payloads + +### Code Sample +``` +import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags; +import org.openapijsonschematools.client.configurations.SchemaConfiguration; +import org.openapijsonschematools.client.exceptions.ValidationException; +import org.openapijsonschematools.client.schemas.validation.MapUtils; +import org.openapijsonschematools.client.schemas.validation.FrozenList; +import org.openapijsonschematools.client.schemas.validation.FrozenMap; +import org.openapijsonschematools.client.components.schemas.ArrayTest; + +import java.util.Arrays; +import java.util.List; +import java.util.AbstractMap; + +static final SchemaConfiguration configuration = new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().build()); + +// List validation +ArrayTest.ItemsList1 validatedPayload = + ArrayTest.Items3.validate( + new ArrayTest.ItemsListBuilder1() + .add( + MapUtils.makeMap( + new AbstractMap.SimpleEntry( + "bar", + "a" + ), + new AbstractMap.SimpleEntry( + "baz", + "a" + ) + ) + ) + .build(), + configuration +); +``` + +### Field Summary +| Modifier and Type | Field and Description | +| ----------------- | ---------------------- | +| Set> | type = Set.of(List.class) | +| Class | items = [ReadOnlyFirst.ReadOnlyFirst1.class](../../components/schemas/ReadOnlyFirst.md#readonlyfirst1) | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| [ItemsList1](#itemslist1) | validate([List](#itemslistbuilder1) arg, SchemaConfiguration configuration) | +| [Items3BoxedList](#items3boxedlist) | validateAndBox([List](#itemslistbuilder1) arg, SchemaConfiguration configuration) | +| [Items3Boxed](#items3boxed) | validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) | +| @Nullable Object | validate(@Nullable Object arg, SchemaConfiguration configuration) | + +## ItemsListBuilder1 +public class ItemsListBuilder1
+builder for `List>` + +A class that builds the List input type + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| ItemsListBuilder1()
Creates an empty list | +| ItemsListBuilder1(List> items)
Stores the items in a list | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| ItemsListBuilder1 | add(Map item) | +| List> | build()
Returns list input that should be used with Schema.validate | + +## ItemsList1 +public class ItemsList1
+extends `FrozenList` + +A class to store validated List payloads + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| static [ItemsList1](#itemslist1) | of([List>](#itemslistbuilder1) arg, SchemaConfiguration configuration) | + +## ArrayArrayOfIntegerBoxed +public sealed interface ArrayArrayOfIntegerBoxed
+permits
+[ArrayArrayOfIntegerBoxedList](#arrayarrayofintegerboxedlist) + +sealed interface that stores validated payloads using boxed classes + +## ArrayArrayOfIntegerBoxedList +public record ArrayArrayOfIntegerBoxedList
+implements [ArrayArrayOfIntegerBoxed](#arrayarrayofintegerboxed) + +record that stores validated List payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| ArrayArrayOfIntegerBoxedList([ArrayArrayOfIntegerList](#arrayarrayofintegerlist) data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| [ArrayArrayOfIntegerList](#arrayarrayofintegerlist) | data()
validated payload | +| @Nullable Object | getData()
validated payload | + +## ArrayArrayOfInteger +public static class ArrayArrayOfInteger
+extends JsonSchema + +A schema class that validates payloads + +### Code Sample +``` +import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags; +import org.openapijsonschematools.client.configurations.SchemaConfiguration; +import org.openapijsonschematools.client.exceptions.ValidationException; +import org.openapijsonschematools.client.schemas.validation.MapUtils; +import org.openapijsonschematools.client.schemas.validation.FrozenList; +import org.openapijsonschematools.client.schemas.validation.FrozenMap; +import org.openapijsonschematools.client.components.schemas.ArrayTest; + +import java.util.Arrays; +import java.util.List; +import java.util.AbstractMap; + +static final SchemaConfiguration configuration = new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().build()); + +// List validation +ArrayTest.ArrayArrayOfIntegerList validatedPayload = + ArrayTest.ArrayArrayOfInteger.validate( + new ArrayTest.ArrayArrayOfIntegerListBuilder() + .add( + Arrays.asList( + 1L + ) + ) + .build(), + configuration +); +``` + +### Field Summary +| Modifier and Type | Field and Description | +| ----------------- | ---------------------- | +| Set> | type = Set.of(List.class) | +| Class | items = [Items1.class](#items1) | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| [ArrayArrayOfIntegerList](#arrayarrayofintegerlist) | validate([List](#arrayarrayofintegerlistbuilder) arg, SchemaConfiguration configuration) | +| [ArrayArrayOfIntegerBoxedList](#arrayarrayofintegerboxedlist) | validateAndBox([List](#arrayarrayofintegerlistbuilder) arg, SchemaConfiguration configuration) | +| [ArrayArrayOfIntegerBoxed](#arrayarrayofintegerboxed) | validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) | +| @Nullable Object | validate(@Nullable Object arg, SchemaConfiguration configuration) | + +## ArrayArrayOfIntegerListBuilder +public class ArrayArrayOfIntegerListBuilder
+builder for `List>` + +A class that builds the List input type + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| ArrayArrayOfIntegerListBuilder()
Creates an empty list | +| ArrayArrayOfIntegerListBuilder(List> items)
Stores the items in a list | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| ArrayArrayOfIntegerListBuilder | add(List item) | +| List> | build()
Returns list input that should be used with Schema.validate | + +## ArrayArrayOfIntegerList +public class ArrayArrayOfIntegerList
+extends `FrozenList` + +A class to store validated List payloads + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| static [ArrayArrayOfIntegerList](#arrayarrayofintegerlist) | of([List>](#arrayarrayofintegerlistbuilder) arg, SchemaConfiguration configuration) | + +## Items1Boxed +public sealed interface Items1Boxed
+permits
+[Items1BoxedList](#items1boxedlist) + +sealed interface that stores validated payloads using boxed classes + +## Items1BoxedList +public record Items1BoxedList
+implements [Items1Boxed](#items1boxed) + +record that stores validated List payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| Items1BoxedList([ItemsList](#itemslist) data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| [ItemsList](#itemslist) | data()
validated payload | +| @Nullable Object | getData()
validated payload | + +## Items1 +public static class Items1
+extends JsonSchema + +A schema class that validates payloads + +### Code Sample +``` +import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags; +import org.openapijsonschematools.client.configurations.SchemaConfiguration; +import org.openapijsonschematools.client.exceptions.ValidationException; +import org.openapijsonschematools.client.schemas.validation.MapUtils; +import org.openapijsonschematools.client.schemas.validation.FrozenList; +import org.openapijsonschematools.client.schemas.validation.FrozenMap; +import org.openapijsonschematools.client.components.schemas.ArrayTest; + +import java.util.Arrays; +import java.util.List; +import java.util.AbstractMap; + +static final SchemaConfiguration configuration = new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().build()); + +// List validation +ArrayTest.ItemsList validatedPayload = + ArrayTest.Items1.validate( + new ArrayTest.ItemsListBuilder() + .add(1L) + + .build(), + configuration +); +``` + +### Field Summary +| Modifier and Type | Field and Description | +| ----------------- | ---------------------- | +| Set> | type = Set.of(List.class) | +| Class | items = [Items2.class](#items2) | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| [ItemsList](#itemslist) | validate([List](#itemslistbuilder) arg, SchemaConfiguration configuration) | +| [Items1BoxedList](#items1boxedlist) | validateAndBox([List](#itemslistbuilder) arg, SchemaConfiguration configuration) | +| [Items1Boxed](#items1boxed) | validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) | +| @Nullable Object | validate(@Nullable Object arg, SchemaConfiguration configuration) | + +## ItemsListBuilder +public class ItemsListBuilder
+builder for `List` + +A class that builds the List input type + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| ItemsListBuilder()
Creates an empty list | +| ItemsListBuilder(List items)
Stores the items in a list | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| ItemsListBuilder | add(int item) | +| ItemsListBuilder | add(float item) | +| ItemsListBuilder | add(long item) | +| ItemsListBuilder | add(double item) | +| List | build()
Returns list input that should be used with Schema.validate | + +## ItemsList +public class ItemsList
+extends `FrozenList` + +A class to store validated List payloads + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| static [ItemsList](#itemslist) | of([List](#itemslistbuilder) arg, SchemaConfiguration configuration) | + +## Items2Boxed +public sealed interface Items2Boxed
+permits
+[Items2BoxedNumber](#items2boxednumber) + +sealed interface that stores validated payloads using boxed classes + +## Items2BoxedNumber +public record Items2BoxedNumber
+implements [Items2Boxed](#items2boxed) + +record that stores validated Number payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| Items2BoxedNumber(Number data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| Number | data()
validated payload | +| @Nullable Object | getData()
validated payload | + +## Items2 +public static class Items2
+extends Int64JsonSchema.Int64JsonSchema1 + +A schema class that validates payloads + +| Methods Inherited from class org.openapijsonschematools.client.schemas.Int64JsonSchema.Int64JsonSchema1 | +| ------------------------------------------------------------------ | +| validate | +| validateAndBox | + +## ArrayOfStringBoxed +public sealed interface ArrayOfStringBoxed
+permits
+[ArrayOfStringBoxedList](#arrayofstringboxedlist) + +sealed interface that stores validated payloads using boxed classes + +## ArrayOfStringBoxedList +public record ArrayOfStringBoxedList
+implements [ArrayOfStringBoxed](#arrayofstringboxed) + +record that stores validated List payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| ArrayOfStringBoxedList([ArrayOfStringList](#arrayofstringlist) data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| [ArrayOfStringList](#arrayofstringlist) | data()
validated payload | +| @Nullable Object | getData()
validated payload | + +## ArrayOfString +public static class ArrayOfString
+extends JsonSchema + +A schema class that validates payloads + +### Code Sample +``` +import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags; +import org.openapijsonschematools.client.configurations.SchemaConfiguration; +import org.openapijsonschematools.client.exceptions.ValidationException; +import org.openapijsonschematools.client.schemas.validation.MapUtils; +import org.openapijsonschematools.client.schemas.validation.FrozenList; +import org.openapijsonschematools.client.schemas.validation.FrozenMap; +import org.openapijsonschematools.client.components.schemas.ArrayTest; + +import java.util.Arrays; +import java.util.List; +import java.util.AbstractMap; + +static final SchemaConfiguration configuration = new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().build()); + +// List validation +ArrayTest.ArrayOfStringList validatedPayload = + ArrayTest.ArrayOfString.validate( + new ArrayTest.ArrayOfStringListBuilder() + .add("a") + + .build(), + configuration +); +``` + +### Field Summary +| Modifier and Type | Field and Description | +| ----------------- | ---------------------- | +| Set> | type = Set.of(List.class) | +| Class | items = [Items.class](#items) | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| [ArrayOfStringList](#arrayofstringlist) | validate([List](#arrayofstringlistbuilder) arg, SchemaConfiguration configuration) | +| [ArrayOfStringBoxedList](#arrayofstringboxedlist) | validateAndBox([List](#arrayofstringlistbuilder) arg, SchemaConfiguration configuration) | +| [ArrayOfStringBoxed](#arrayofstringboxed) | validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) | +| @Nullable Object | validate(@Nullable Object arg, SchemaConfiguration configuration) | + +## ArrayOfStringListBuilder +public class ArrayOfStringListBuilder
+builder for `List` + +A class that builds the List input type + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| ArrayOfStringListBuilder()
Creates an empty list | +| ArrayOfStringListBuilder(List items)
Stores the items in a list | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| ArrayOfStringListBuilder | add(String item) | +| List | build()
Returns list input that should be used with Schema.validate | + +## ArrayOfStringList +public class ArrayOfStringList
+extends `FrozenList` + +A class to store validated List payloads + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| static [ArrayOfStringList](#arrayofstringlist) | of([List](#arrayofstringlistbuilder) arg, SchemaConfiguration configuration) | + +## ItemsBoxed +public sealed interface ItemsBoxed
+permits
+[ItemsBoxedString](#itemsboxedstring) + +sealed interface that stores validated payloads using boxed classes + +## ItemsBoxedString +public record ItemsBoxedString
+implements [ItemsBoxed](#itemsboxed) + +record that stores validated String payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| ItemsBoxedString(String data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| String | data()
validated payload | +| @Nullable Object | getData()
validated payload | + +## Items +public static class Items
+extends StringJsonSchema.StringJsonSchema1 + +A schema class that validates payloads + +| Methods Inherited from class org.openapijsonschematools.client.schemas.StringJsonSchema.StringJsonSchema1 | +| ------------------------------------------------------------------ | +| validate | +| validateAndBox | + +[[Back to top]](#top) [[Back to Component Schemas]](../../../README.md#Component-Schemas) [[Back to README]](../../../README.md) diff --git a/samples/client/petstore/kotlin/docs/components/schemas/ArrayWithValidationsInItems.md b/samples/client/petstore/kotlin/docs/components/schemas/ArrayWithValidationsInItems.md new file mode 100644 index 00000000000..e2fc8ff7610 --- /dev/null +++ b/samples/client/petstore/kotlin/docs/components/schemas/ArrayWithValidationsInItems.md @@ -0,0 +1,196 @@ +# ArrayWithValidationsInItems +org.openapijsonschematools.client.components.schemas.ArrayWithValidationsInItems.java +public class ArrayWithValidationsInItems
+ +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 list payloads, extends FrozenList +- classes to build inputs for list payloads + +## Nested Class Summary +| Modifier and Type | Class and Description | +| ----------------- | ---------------------- | +| sealed interface | [ArrayWithValidationsInItems.ArrayWithValidationsInItems1Boxed](#arraywithvalidationsinitems1boxed)
sealed interface for validated payloads | +| record | [ArrayWithValidationsInItems.ArrayWithValidationsInItems1BoxedList](#arraywithvalidationsinitems1boxedlist)
boxed class to store validated List payloads | +| static class | [ArrayWithValidationsInItems.ArrayWithValidationsInItems1](#arraywithvalidationsinitems1)
schema class | +| static class | [ArrayWithValidationsInItems.ArrayWithValidationsInItemsListBuilder](#arraywithvalidationsinitemslistbuilder)
builder for List payloads | +| static class | [ArrayWithValidationsInItems.ArrayWithValidationsInItemsList](#arraywithvalidationsinitemslist)
output class for List payloads | +| sealed interface | [ArrayWithValidationsInItems.ItemsBoxed](#itemsboxed)
sealed interface for validated payloads | +| record | [ArrayWithValidationsInItems.ItemsBoxedNumber](#itemsboxednumber)
boxed class to store validated Number payloads | +| static class | [ArrayWithValidationsInItems.Items](#items)
schema class | + +## ArrayWithValidationsInItems1Boxed +public sealed interface ArrayWithValidationsInItems1Boxed
+permits
+[ArrayWithValidationsInItems1BoxedList](#arraywithvalidationsinitems1boxedlist) + +sealed interface that stores validated payloads using boxed classes + +## ArrayWithValidationsInItems1BoxedList +public record ArrayWithValidationsInItems1BoxedList
+implements [ArrayWithValidationsInItems1Boxed](#arraywithvalidationsinitems1boxed) + +record that stores validated List payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| ArrayWithValidationsInItems1BoxedList([ArrayWithValidationsInItemsList](#arraywithvalidationsinitemslist) data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| [ArrayWithValidationsInItemsList](#arraywithvalidationsinitemslist) | data()
validated payload | +| @Nullable Object | getData()
validated payload | + +## ArrayWithValidationsInItems1 +public static class ArrayWithValidationsInItems1
+extends JsonSchema + +A schema class that validates payloads + +### Code Sample +``` +import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags; +import org.openapijsonschematools.client.configurations.SchemaConfiguration; +import org.openapijsonschematools.client.exceptions.ValidationException; +import org.openapijsonschematools.client.schemas.validation.MapUtils; +import org.openapijsonschematools.client.schemas.validation.FrozenList; +import org.openapijsonschematools.client.schemas.validation.FrozenMap; +import org.openapijsonschematools.client.components.schemas.ArrayWithValidationsInItems; + +import java.util.Arrays; +import java.util.List; +import java.util.AbstractMap; + +static final SchemaConfiguration configuration = new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().build()); + +// List validation +ArrayWithValidationsInItems.ArrayWithValidationsInItemsList validatedPayload = + ArrayWithValidationsInItems.ArrayWithValidationsInItems1.validate( + new ArrayWithValidationsInItems.ArrayWithValidationsInItemsListBuilder() + .add(1L) + + .build(), + configuration +); +``` + +### Field Summary +| Modifier and Type | Field and Description | +| ----------------- | ---------------------- | +| Set> | type = Set.of(List.class) | +| Class | items = [Items.class](#items) | +| Integer | maxItems = 2 | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| [ArrayWithValidationsInItemsList](#arraywithvalidationsinitemslist) | validate([List](#arraywithvalidationsinitemslistbuilder) arg, SchemaConfiguration configuration) | +| [ArrayWithValidationsInItems1BoxedList](#arraywithvalidationsinitems1boxedlist) | validateAndBox([List](#arraywithvalidationsinitemslistbuilder) arg, SchemaConfiguration configuration) | +| [ArrayWithValidationsInItems1Boxed](#arraywithvalidationsinitems1boxed) | validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) | +| @Nullable Object | validate(@Nullable Object arg, SchemaConfiguration configuration) | + +## ArrayWithValidationsInItemsListBuilder +public class ArrayWithValidationsInItemsListBuilder
+builder for `List` + +A class that builds the List input type + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| ArrayWithValidationsInItemsListBuilder()
Creates an empty list | +| ArrayWithValidationsInItemsListBuilder(List items)
Stores the items in a list | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| ArrayWithValidationsInItemsListBuilder | add(int item) | +| ArrayWithValidationsInItemsListBuilder | add(float item) | +| ArrayWithValidationsInItemsListBuilder | add(long item) | +| ArrayWithValidationsInItemsListBuilder | add(double item) | +| List | build()
Returns list input that should be used with Schema.validate | + +## ArrayWithValidationsInItemsList +public class ArrayWithValidationsInItemsList
+extends `FrozenList` + +A class to store validated List payloads + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| static [ArrayWithValidationsInItemsList](#arraywithvalidationsinitemslist) | of([List](#arraywithvalidationsinitemslistbuilder) arg, SchemaConfiguration configuration) | + +## ItemsBoxed +public sealed interface ItemsBoxed
+permits
+[ItemsBoxedNumber](#itemsboxednumber) + +sealed interface that stores validated payloads using boxed classes + +## ItemsBoxedNumber +public record ItemsBoxedNumber
+implements [ItemsBoxed](#itemsboxed) + +record that stores validated Number payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| ItemsBoxedNumber(Number data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| Number | data()
validated payload | +| @Nullable Object | getData()
validated payload | + +## Items +public static class Items
+extends JsonSchema + +A schema class that validates payloads + +### Code Sample +``` +import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags; +import org.openapijsonschematools.client.configurations.SchemaConfiguration; +import org.openapijsonschematools.client.exceptions.ValidationException; +import org.openapijsonschematools.client.schemas.validation.MapUtils; +import org.openapijsonschematools.client.schemas.validation.FrozenList; +import org.openapijsonschematools.client.schemas.validation.FrozenMap; +import org.openapijsonschematools.client.components.schemas.ArrayWithValidationsInItems; + +import java.util.Arrays; +import java.util.List; +import java.util.AbstractMap; + +static final SchemaConfiguration configuration = new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().build()); + +// long validation +long validatedPayload = ArrayWithValidationsInItems.Items.validate( + 1L, + configuration +); +``` + +### Field Summary +| Modifier and Type | Field and Description | +| ----------------- | ---------------------- | +| Set> | type = Set.of(
    Integer.class,
    Long.class,
    Float.class,
    Double.class
)
| +| String | type = "int64"; | +| Number | maximum = 7 | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| long | validate(long arg, SchemaConfiguration configuration) | +| [ItemsBoxedNumber](#itemsboxednumber) | validateAndBox(Number arg, SchemaConfiguration configuration) | +| [ItemsBoxed](#itemsboxed) | validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) | +| @Nullable Object | validate(@Nullable Object arg, SchemaConfiguration configuration) | + +[[Back to top]](#top) [[Back to Component Schemas]](../../../README.md#Component-Schemas) [[Back to README]](../../../README.md) diff --git a/samples/client/petstore/kotlin/docs/components/schemas/Banana.md b/samples/client/petstore/kotlin/docs/components/schemas/Banana.md new file mode 100644 index 00000000000..e953bef7d68 --- /dev/null +++ b/samples/client/petstore/kotlin/docs/components/schemas/Banana.md @@ -0,0 +1,188 @@ +# Banana +org.openapijsonschematools.client.components.schemas.Banana.java +public class Banana
+ +A class that contains necessary nested +- schema classes (which validate payloads), extends JsonSchema +- sealed interfaces which store validated payloads, java version of a sum type +- boxed classes which store validated payloads, sealed permits class implementations +- classes to store validated map payloads, extends FrozenMap +- classes to build inputs for map payloads + +## Nested Class Summary +| Modifier and Type | Class and Description | +| ----------------- | ---------------------- | +| sealed interface | [Banana.Banana1Boxed](#banana1boxed)
sealed interface for validated payloads | +| record | [Banana.Banana1BoxedMap](#banana1boxedmap)
boxed class to store validated Map payloads | +| static class | [Banana.Banana1](#banana1)
schema class | +| static class | [Banana.BananaMapBuilder](#bananamapbuilder)
builder for Map payloads | +| static class | [Banana.BananaMap](#bananamap)
output class for Map payloads | +| sealed interface | [Banana.LengthCmBoxed](#lengthcmboxed)
sealed interface for validated payloads | +| record | [Banana.LengthCmBoxedNumber](#lengthcmboxednumber)
boxed class to store validated Number payloads | +| static class | [Banana.LengthCm](#lengthcm)
schema class | + +## Banana1Boxed +public sealed interface Banana1Boxed
+permits
+[Banana1BoxedMap](#banana1boxedmap) + +sealed interface that stores validated payloads using boxed classes + +## Banana1BoxedMap +public record Banana1BoxedMap
+implements [Banana1Boxed](#banana1boxed) + +record that stores validated Map payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| Banana1BoxedMap([BananaMap](#bananamap) data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| [BananaMap](#bananamap) | data()
validated payload | +| @Nullable Object | getData()
validated payload | + +## Banana1 +public static class Banana1
+extends JsonSchema + +A schema class that validates payloads + +### Code Sample +``` +import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags; +import org.openapijsonschematools.client.configurations.SchemaConfiguration; +import org.openapijsonschematools.client.exceptions.ValidationException; +import org.openapijsonschematools.client.schemas.validation.MapUtils; +import org.openapijsonschematools.client.schemas.validation.FrozenList; +import org.openapijsonschematools.client.schemas.validation.FrozenMap; +import org.openapijsonschematools.client.components.schemas.Banana; + +import java.util.Arrays; +import java.util.List; +import java.util.AbstractMap; + +static final SchemaConfiguration configuration = new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().build()); + +// Map validation +Banana.BananaMap validatedPayload = + Banana.Banana1.validate( + new Banana.BananaMapBuilder() + .lengthCm(1) + + .build(), + configuration +); +``` + +### Field Summary +| Modifier and Type | Field and Description | +| ----------------- | ---------------------- | +| Set> | type = Set.of(Map.class) | +| Map> | properties = Map.ofEntries(
    new PropertyEntry("lengthCm", [LengthCm.class](#lengthcm)))
)
| +| Set | required = Set.of(
    "lengthCm"
)
| + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| [BananaMap](#bananamap) | validate([Map<?, ?>](#bananamapbuilder) arg, SchemaConfiguration configuration) | +| [Banana1BoxedMap](#banana1boxedmap) | validateAndBox([Map<?, ?>](#bananamapbuilder) arg, SchemaConfiguration configuration) | +| [Banana1Boxed](#banana1boxed) | validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) | +| @Nullable Object | validate(@Nullable Object arg, SchemaConfiguration configuration) | + +## BananaMap0Builder +public class BananaMap0Builder
+builder for `Map` + +A class that builds the Map input type + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| BananaMap0Builder(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 | +| [BananaMap0Builder](#bananamap0builder) | additionalProperty(String key, Nothing? value) | +| [BananaMap0Builder](#bananamap0builder) | additionalProperty(String key, boolean value) | +| [BananaMap0Builder](#bananamap0builder) | additionalProperty(String key, String value) | +| [BananaMap0Builder](#bananamap0builder) | additionalProperty(String key, int value) | +| [BananaMap0Builder](#bananamap0builder) | additionalProperty(String key, float value) | +| [BananaMap0Builder](#bananamap0builder) | additionalProperty(String key, long value) | +| [BananaMap0Builder](#bananamap0builder) | additionalProperty(String key, double value) | +| [BananaMap0Builder](#bananamap0builder) | additionalProperty(String key, List value) | +| [BananaMap0Builder](#bananamap0builder) | additionalProperty(String key, Map value) | + +## BananaMapBuilder +public class BananaMapBuilder
+builder for `Map` + +A class that builds the Map input type + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| BananaMapBuilder()
Creates a builder that contains an empty map | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| [BananaMap0Builder](#bananamap0builder) | lengthCm(int value) | +| [BananaMap0Builder](#bananamap0builder) | lengthCm(float value) | +| [BananaMap0Builder](#bananamap0builder) | lengthCm(long value) | +| [BananaMap0Builder](#bananamap0builder) | lengthCm(double value) | + +## BananaMap +public static class BananaMap
+extends FrozenMap + +A class to store validated Map payloads + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| static [BananaMap](#bananamap) | of([Map](#bananamapbuilder) arg, SchemaConfiguration configuration) | +| Number | lengthCm()
| +| @Nullable Object | getAdditionalProperty(String name)
provides type safety for additional properties | + +## LengthCmBoxed +public sealed interface LengthCmBoxed
+permits
+[LengthCmBoxedNumber](#lengthcmboxednumber) + +sealed interface that stores validated payloads using boxed classes + +## LengthCmBoxedNumber +public record LengthCmBoxedNumber
+implements [LengthCmBoxed](#lengthcmboxed) + +record that stores validated Number payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| LengthCmBoxedNumber(Number data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| Number | data()
validated payload | +| @Nullable Object | getData()
validated payload | + +## LengthCm +public static class LengthCm
+extends NumberJsonSchema.NumberJsonSchema1 + +A schema class that validates payloads + +| Methods Inherited from class org.openapijsonschematools.client.schemas.NumberJsonSchema.NumberJsonSchema1 | +| ------------------------------------------------------------------ | +| validate | +| validateAndBox | + +[[Back to top]](#top) [[Back to Component Schemas]](../../../README.md#Component-Schemas) [[Back to README]](../../../README.md) diff --git a/samples/client/petstore/kotlin/docs/components/schemas/BananaReq.md b/samples/client/petstore/kotlin/docs/components/schemas/BananaReq.md new file mode 100644 index 00000000000..c4cbe4fc95a --- /dev/null +++ b/samples/client/petstore/kotlin/docs/components/schemas/BananaReq.md @@ -0,0 +1,354 @@ +# BananaReq +org.openapijsonschematools.client.components.schemas.BananaReq.java +public class BananaReq
+ +A class that contains necessary nested +- schema classes (which validate payloads), extends JsonSchema +- sealed interfaces which store validated payloads, java version of a sum type +- boxed classes which store validated payloads, sealed permits class implementations +- classes to store validated map payloads, extends FrozenMap +- classes to build inputs for map payloads + +## Nested Class Summary +| Modifier and Type | Class and Description | +| ----------------- | ---------------------- | +| sealed interface | [BananaReq.BananaReq1Boxed](#bananareq1boxed)
sealed interface for validated payloads | +| record | [BananaReq.BananaReq1BoxedMap](#bananareq1boxedmap)
boxed class to store validated Map payloads | +| static class | [BananaReq.BananaReq1](#bananareq1)
schema class | +| static class | [BananaReq.BananaReqMapBuilder](#bananareqmapbuilder)
builder for Map payloads | +| static class | [BananaReq.BananaReqMap](#bananareqmap)
output class for Map payloads | +| sealed interface | [BananaReq.SweetBoxed](#sweetboxed)
sealed interface for validated payloads | +| record | [BananaReq.SweetBoxedBoolean](#sweetboxedboolean)
boxed class to store validated boolean payloads | +| static class | [BananaReq.Sweet](#sweet)
schema class | +| sealed interface | [BananaReq.LengthCmBoxed](#lengthcmboxed)
sealed interface for validated payloads | +| record | [BananaReq.LengthCmBoxedNumber](#lengthcmboxednumber)
boxed class to store validated Number payloads | +| static class | [BananaReq.LengthCm](#lengthcm)
schema class | +| sealed interface | [BananaReq.AdditionalPropertiesBoxed](#additionalpropertiesboxed)
sealed interface for validated payloads | +| record | [BananaReq.AdditionalPropertiesBoxedVoid](#additionalpropertiesboxedvoid)
boxed class to store validated null payloads | +| record | [BananaReq.AdditionalPropertiesBoxedBoolean](#additionalpropertiesboxedboolean)
boxed class to store validated boolean payloads | +| record | [BananaReq.AdditionalPropertiesBoxedNumber](#additionalpropertiesboxednumber)
boxed class to store validated Number payloads | +| record | [BananaReq.AdditionalPropertiesBoxedString](#additionalpropertiesboxedstring)
boxed class to store validated String payloads | +| record | [BananaReq.AdditionalPropertiesBoxedList](#additionalpropertiesboxedlist)
boxed class to store validated List payloads | +| record | [BananaReq.AdditionalPropertiesBoxedMap](#additionalpropertiesboxedmap)
boxed class to store validated Map payloads | +| static class | [BananaReq.AdditionalProperties](#additionalproperties)
schema class | + +## BananaReq1Boxed +public sealed interface BananaReq1Boxed
+permits
+[BananaReq1BoxedMap](#bananareq1boxedmap) + +sealed interface that stores validated payloads using boxed classes + +## BananaReq1BoxedMap +public record BananaReq1BoxedMap
+implements [BananaReq1Boxed](#bananareq1boxed) + +record that stores validated Map payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| BananaReq1BoxedMap([BananaReqMap](#bananareqmap) data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| [BananaReqMap](#bananareqmap) | data()
validated payload | +| @Nullable Object | getData()
validated payload | + +## BananaReq1 +public static class BananaReq1
+extends JsonSchema + +A schema class that validates payloads + +### Code Sample +``` +import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags; +import org.openapijsonschematools.client.configurations.SchemaConfiguration; +import org.openapijsonschematools.client.exceptions.ValidationException; +import org.openapijsonschematools.client.schemas.validation.MapUtils; +import org.openapijsonschematools.client.schemas.validation.FrozenList; +import org.openapijsonschematools.client.schemas.validation.FrozenMap; +import org.openapijsonschematools.client.components.schemas.BananaReq; + +import java.util.Arrays; +import java.util.List; +import java.util.AbstractMap; + +static final SchemaConfiguration configuration = new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().build()); + +// Map validation +BananaReq.BananaReqMap validatedPayload = + BananaReq.BananaReq1.validate( + new BananaReq.BananaReqMapBuilder() + .lengthCm(1) + + .sweet(true) + + .build(), + configuration +); +``` + +### Field Summary +| Modifier and Type | Field and Description | +| ----------------- | ---------------------- | +| Set> | type = Set.of(Map.class) | +| Map> | properties = Map.ofEntries(
    new PropertyEntry("lengthCm", [LengthCm.class](#lengthcm))),
    new PropertyEntry("sweet", [Sweet.class](#sweet)))
)
| +| Set | required = Set.of(
    "lengthCm"
)
| +| Class | additionalProperties = [AdditionalProperties.class](#additionalproperties) | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| [BananaReqMap](#bananareqmap) | validate([Map<?, ?>](#bananareqmapbuilder) arg, SchemaConfiguration configuration) | +| [BananaReq1BoxedMap](#bananareq1boxedmap) | validateAndBox([Map<?, ?>](#bananareqmapbuilder) arg, SchemaConfiguration configuration) | +| [BananaReq1Boxed](#bananareq1boxed) | validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) | +| @Nullable Object | validate(@Nullable Object arg, SchemaConfiguration configuration) | + +## BananaReqMap0Builder +public class BananaReqMap0Builder
+builder for `Map` + +A class that builds the Map input type + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| BananaReqMap0Builder(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 | +| [BananaReqMap0Builder](#bananareqmap0builder) | sweet(boolean value) | + +## BananaReqMapBuilder +public class BananaReqMapBuilder
+builder for `Map` + +A class that builds the Map input type + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| BananaReqMapBuilder()
Creates a builder that contains an empty map | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| [BananaReqMap0Builder](#bananareqmap0builder) | lengthCm(int value) | +| [BananaReqMap0Builder](#bananareqmap0builder) | lengthCm(float value) | +| [BananaReqMap0Builder](#bananareqmap0builder) | lengthCm(long value) | +| [BananaReqMap0Builder](#bananareqmap0builder) | lengthCm(double value) | + +## BananaReqMap +public static class BananaReqMap
+extends FrozenMap + +A class to store validated Map payloads + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| static [BananaReqMap](#bananareqmap) | of([Map](#bananareqmapbuilder) arg, SchemaConfiguration configuration) | +| Number | lengthCm()
| +| boolean | sweet()
[optional] | + +## SweetBoxed +public sealed interface SweetBoxed
+permits
+[SweetBoxedBoolean](#sweetboxedboolean) + +sealed interface that stores validated payloads using boxed classes + +## SweetBoxedBoolean +public record SweetBoxedBoolean
+implements [SweetBoxed](#sweetboxed) + +record that stores validated boolean payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| SweetBoxedBoolean(boolean data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| boolean | data()
validated payload | +| @Nullable Object | getData()
validated payload | + +## Sweet +public static class Sweet
+extends BooleanJsonSchema.BooleanJsonSchema1 + +A schema class that validates payloads + +| Methods Inherited from class org.openapijsonschematools.client.schemas.BooleanJsonSchema.BooleanJsonSchema1 | +| ------------------------------------------------------------------ | +| validate | +| validateAndBox | + +## LengthCmBoxed +public sealed interface LengthCmBoxed
+permits
+[LengthCmBoxedNumber](#lengthcmboxednumber) + +sealed interface that stores validated payloads using boxed classes + +## LengthCmBoxedNumber +public record LengthCmBoxedNumber
+implements [LengthCmBoxed](#lengthcmboxed) + +record that stores validated Number payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| LengthCmBoxedNumber(Number data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| Number | data()
validated payload | +| @Nullable Object | getData()
validated payload | + +## LengthCm +public static class LengthCm
+extends NumberJsonSchema.NumberJsonSchema1 + +A schema class that validates payloads + +| Methods Inherited from class org.openapijsonschematools.client.schemas.NumberJsonSchema.NumberJsonSchema1 | +| ------------------------------------------------------------------ | +| validate | +| validateAndBox | + +## 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(Nothing? data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| Nothing? | 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 Component Schemas]](../../../README.md#Component-Schemas) [[Back to README]](../../../README.md) diff --git a/samples/client/petstore/kotlin/docs/components/schemas/Bar.md b/samples/client/petstore/kotlin/docs/components/schemas/Bar.md new file mode 100644 index 00000000000..5f5758b2eec --- /dev/null +++ b/samples/client/petstore/kotlin/docs/components/schemas/Bar.md @@ -0,0 +1,84 @@ +# Bar +org.openapijsonschematools.client.components.schemas.Bar.java +public class Bar
+ +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 + +## Nested Class Summary +| Modifier and Type | Class and Description | +| ----------------- | ---------------------- | +| sealed interface | [Bar.Bar1Boxed](#bar1boxed)
sealed interface for validated payloads | +| record | [Bar.Bar1BoxedString](#bar1boxedstring)
boxed class to store validated String payloads | +| static class | [Bar.Bar1](#bar1)
schema class | + +## Bar1Boxed +public sealed interface Bar1Boxed
+permits
+[Bar1BoxedString](#bar1boxedstring) + +sealed interface that stores validated payloads using boxed classes + +## Bar1BoxedString +public record Bar1BoxedString
+implements [Bar1Boxed](#bar1boxed) + +record that stores validated String payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| Bar1BoxedString(String data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| String | data()
validated payload | +| @Nullable Object | getData()
validated payload | + +## Bar1 +public static class Bar1
+extends JsonSchema + +A schema class that validates payloads + +### Code Sample +``` +import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags; +import org.openapijsonschematools.client.configurations.SchemaConfiguration; +import org.openapijsonschematools.client.exceptions.ValidationException; +import org.openapijsonschematools.client.schemas.validation.MapUtils; +import org.openapijsonschematools.client.schemas.validation.FrozenList; +import org.openapijsonschematools.client.schemas.validation.FrozenMap; +import org.openapijsonschematools.client.components.schemas.Bar; + +import java.util.Arrays; +import java.util.List; +import java.util.AbstractMap; + +static final SchemaConfiguration configuration = new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().build()); + +// String validation +String validatedPayload = Bar.Bar1.validate( + "a", + configuration +); +``` + +### Field Summary +| Modifier and Type | Field and Description | +| ----------------- | ---------------------- | +| Set> | type = Set.of(
    String.class
)
| +| @Nullable Object | defaultValue = "bar" | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| String | validate(String arg, SchemaConfiguration configuration) | +| [Bar1BoxedString](#bar1boxedstring) | validateAndBox(String arg, SchemaConfiguration configuration) | +| [Bar1Boxed](#bar1boxed) | validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) | +| @Nullable Object | validate(@Nullable Object arg, SchemaConfiguration configuration) | + +[[Back to top]](#top) [[Back to Component Schemas]](../../../README.md#Component-Schemas) [[Back to README]](../../../README.md) diff --git a/samples/client/petstore/kotlin/docs/components/schemas/BasquePig.md b/samples/client/petstore/kotlin/docs/components/schemas/BasquePig.md new file mode 100644 index 00000000000..f6c38583bea --- /dev/null +++ b/samples/client/petstore/kotlin/docs/components/schemas/BasquePig.md @@ -0,0 +1,232 @@ +# BasquePig +org.openapijsonschematools.client.components.schemas.BasquePig.java +public class BasquePig
+ +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 | [BasquePig.BasquePig1Boxed](#basquepig1boxed)
sealed interface for validated payloads | +| record | [BasquePig.BasquePig1BoxedMap](#basquepig1boxedmap)
boxed class to store validated Map payloads | +| static class | [BasquePig.BasquePig1](#basquepig1)
schema class | +| static class | [BasquePig.BasquePigMapBuilder](#basquepigmapbuilder)
builder for Map payloads | +| static class | [BasquePig.BasquePigMap](#basquepigmap)
output class for Map payloads | +| sealed interface | [BasquePig.ClassNameBoxed](#classnameboxed)
sealed interface for validated payloads | +| record | [BasquePig.ClassNameBoxedString](#classnameboxedstring)
boxed class to store validated String payloads | +| static class | [BasquePig.ClassName](#classname)
schema class | +| enum | [BasquePig.StringClassNameEnums](#stringclassnameenums)
String enum | + +## BasquePig1Boxed +public sealed interface BasquePig1Boxed
+permits
+[BasquePig1BoxedMap](#basquepig1boxedmap) + +sealed interface that stores validated payloads using boxed classes + +## BasquePig1BoxedMap +public record BasquePig1BoxedMap
+implements [BasquePig1Boxed](#basquepig1boxed) + +record that stores validated Map payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| BasquePig1BoxedMap([BasquePigMap](#basquepigmap) data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| [BasquePigMap](#basquepigmap) | data()
validated payload | +| @Nullable Object | getData()
validated payload | + +## BasquePig1 +public static class BasquePig1
+extends JsonSchema + +A schema class that validates payloads + +### Code Sample +``` +import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags; +import org.openapijsonschematools.client.configurations.SchemaConfiguration; +import org.openapijsonschematools.client.exceptions.ValidationException; +import org.openapijsonschematools.client.schemas.validation.MapUtils; +import org.openapijsonschematools.client.schemas.validation.FrozenList; +import org.openapijsonschematools.client.schemas.validation.FrozenMap; +import org.openapijsonschematools.client.components.schemas.BasquePig; + +import java.util.Arrays; +import java.util.List; +import java.util.AbstractMap; + +static final SchemaConfiguration configuration = new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().build()); + +// Map validation +BasquePig.BasquePigMap validatedPayload = + BasquePig.BasquePig1.validate( + new BasquePig.BasquePigMapBuilder() + .className("BasquePig") + + .build(), + configuration +); +``` + +### Field Summary +| Modifier and Type | Field and Description | +| ----------------- | ---------------------- | +| Set> | type = Set.of(Map.class) | +| Map> | properties = Map.ofEntries(
    new PropertyEntry("className", [ClassName.class](#classname)))
)
| +| Set | required = Set.of(
    "className"
)
| + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| [BasquePigMap](#basquepigmap) | validate([Map<?, ?>](#basquepigmapbuilder) arg, SchemaConfiguration configuration) | +| [BasquePig1BoxedMap](#basquepig1boxedmap) | validateAndBox([Map<?, ?>](#basquepigmapbuilder) arg, SchemaConfiguration configuration) | +| [BasquePig1Boxed](#basquepig1boxed) | validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) | +| @Nullable Object | validate(@Nullable Object arg, SchemaConfiguration configuration) | + +## BasquePigMap0Builder +public class BasquePigMap0Builder
+builder for `Map` + +A class that builds the Map input type + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| BasquePigMap0Builder(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 | +| [BasquePigMap0Builder](#basquepigmap0builder) | additionalProperty(String key, Nothing? value) | +| [BasquePigMap0Builder](#basquepigmap0builder) | additionalProperty(String key, boolean value) | +| [BasquePigMap0Builder](#basquepigmap0builder) | additionalProperty(String key, String value) | +| [BasquePigMap0Builder](#basquepigmap0builder) | additionalProperty(String key, int value) | +| [BasquePigMap0Builder](#basquepigmap0builder) | additionalProperty(String key, float value) | +| [BasquePigMap0Builder](#basquepigmap0builder) | additionalProperty(String key, long value) | +| [BasquePigMap0Builder](#basquepigmap0builder) | additionalProperty(String key, double value) | +| [BasquePigMap0Builder](#basquepigmap0builder) | additionalProperty(String key, List value) | +| [BasquePigMap0Builder](#basquepigmap0builder) | additionalProperty(String key, Map value) | + +## BasquePigMapBuilder +public class BasquePigMapBuilder
+builder for `Map` + +A class that builds the Map input type + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| BasquePigMapBuilder()
Creates a builder that contains an empty map | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| [BasquePigMap0Builder](#basquepigmap0builder) | className(String value) | +| [BasquePigMap0Builder](#basquepigmap0builder) | className([StringClassNameEnums](#stringclassnameenums) value) | + +## BasquePigMap +public static class BasquePigMap
+extends FrozenMap + +A class to store validated Map payloads + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| static [BasquePigMap](#basquepigmap) | of([Map](#basquepigmapbuilder) arg, SchemaConfiguration configuration) | +| String | className()
must be one of ["BasquePig"] | +| @Nullable Object | getAdditionalProperty(String name)
provides type safety for additional properties | + +## ClassNameBoxed +public sealed interface ClassNameBoxed
+permits
+[ClassNameBoxedString](#classnameboxedstring) + +sealed interface that stores validated payloads using boxed classes + +## ClassNameBoxedString +public record ClassNameBoxedString
+implements [ClassNameBoxed](#classnameboxed) + +record that stores validated String payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| ClassNameBoxedString(String data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| String | data()
validated payload | +| @Nullable Object | getData()
validated payload | + +## ClassName +public static class ClassName
+extends JsonSchema + +A schema class that validates payloads + +### Code Sample +``` +import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags; +import org.openapijsonschematools.client.configurations.SchemaConfiguration; +import org.openapijsonschematools.client.exceptions.ValidationException; +import org.openapijsonschematools.client.schemas.validation.MapUtils; +import org.openapijsonschematools.client.schemas.validation.FrozenList; +import org.openapijsonschematools.client.schemas.validation.FrozenMap; +import org.openapijsonschematools.client.components.schemas.BasquePig; + +import java.util.Arrays; +import java.util.List; +import java.util.AbstractMap; + +static final SchemaConfiguration configuration = new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().build()); + +// String validation +String validatedPayload = BasquePig.ClassName.validate( + "BasquePig", + configuration +); +``` + +### Field Summary +| Modifier and Type | Field and Description | +| ----------------- | ---------------------- | +| Set> | type = Set.of(
    String.class
)
| +| Set | enumValues = SetMaker.makeSet(
    "BasquePig"
)
| + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| String | validate(String arg, SchemaConfiguration configuration) | +| String | validate([StringClassNameEnums](#stringclassnameenums) arg, SchemaConfiguration configuration) | +| [ClassNameBoxedString](#classnameboxedstring) | validateAndBox(String arg, SchemaConfiguration configuration) | +| [ClassNameBoxed](#classnameboxed) | validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) | +| @Nullable Object | validate(@Nullable Object arg, SchemaConfiguration configuration) | + +## StringClassNameEnums +public enum StringClassNameEnums
+extends `Enum` + +A class that stores String enum values + +### Enum Constant Summary +| Enum Constant | Description | +| ------------- | ----------- | +| BASQUE_PIG | value = "BasquePig" | + +[[Back to top]](#top) [[Back to Component Schemas]](../../../README.md#Component-Schemas) [[Back to README]](../../../README.md) diff --git a/samples/client/petstore/kotlin/docs/components/schemas/BooleanEnum.md b/samples/client/petstore/kotlin/docs/components/schemas/BooleanEnum.md new file mode 100644 index 00000000000..0817b8f944a --- /dev/null +++ b/samples/client/petstore/kotlin/docs/components/schemas/BooleanEnum.md @@ -0,0 +1,98 @@ +# BooleanEnum +org.openapijsonschematools.client.components.schemas.BooleanEnum.java +public class BooleanEnum
+ +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 +- enum classes + +## Nested Class Summary +| Modifier and Type | Class and Description | +| ----------------- | ---------------------- | +| sealed interface | [BooleanEnum.BooleanEnum1Boxed](#booleanenum1boxed)
sealed interface for validated payloads | +| record | [BooleanEnum.BooleanEnum1BoxedBoolean](#booleanenum1boxedboolean)
boxed class to store validated boolean payloads | +| static class | [BooleanEnum.BooleanEnum1](#booleanenum1)
schema class | +| enum | [BooleanEnum.BooleanBooleanEnumEnums](#booleanbooleanenumenums)
boolean enum | + +## BooleanEnum1Boxed +public sealed interface BooleanEnum1Boxed
+permits
+[BooleanEnum1BoxedBoolean](#booleanenum1boxedboolean) + +sealed interface that stores validated payloads using boxed classes + +## BooleanEnum1BoxedBoolean +public record BooleanEnum1BoxedBoolean
+implements [BooleanEnum1Boxed](#booleanenum1boxed) + +record that stores validated boolean payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| BooleanEnum1BoxedBoolean(boolean data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| boolean | data()
validated payload | +| @Nullable Object | getData()
validated payload | + +## BooleanEnum1 +public static class BooleanEnum1
+extends JsonSchema + +A schema class that validates payloads + +### Code Sample +``` +import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags; +import org.openapijsonschematools.client.configurations.SchemaConfiguration; +import org.openapijsonschematools.client.exceptions.ValidationException; +import org.openapijsonschematools.client.schemas.validation.MapUtils; +import org.openapijsonschematools.client.schemas.validation.FrozenList; +import org.openapijsonschematools.client.schemas.validation.FrozenMap; +import org.openapijsonschematools.client.components.schemas.BooleanEnum; + +import java.util.Arrays; +import java.util.List; +import java.util.AbstractMap; + +static final SchemaConfiguration configuration = new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().build()); + +// boolean validation +boolean validatedPayload = BooleanEnum.BooleanEnum1.validate( + true, + configuration +); +``` + +### Field Summary +| Modifier and Type | Field and Description | +| ----------------- | ---------------------- | +| Set> | type = Set.of(Boolean.class) | +| Set | enumValues = SetMaker.makeSet(
    true
)
| + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| boolean | validate(boolean arg, SchemaConfiguration configuration) | +| boolean | validate([BooleanBooleanEnumEnums](#booleanbooleanenumenums) arg, SchemaConfiguration configuration) | +| [BooleanEnum1BoxedBoolean](#booleanenum1boxedboolean) | validateAndBox(boolean arg, SchemaConfiguration configuration) | +| [BooleanEnum1Boxed](#booleanenum1boxed) | validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) | +| @Nullable Object | validate(@Nullable Object arg, SchemaConfiguration configuration) | + +## BooleanBooleanEnumEnums +public enum BooleanBooleanEnumEnums
+extends `Enum` + +A class that stores boolean enum values + +### Enum Constant Summary +| Enum Constant | Description | +| ------------- | ----------- | +| TRUE | value = true | + +[[Back to top]](#top) [[Back to Component Schemas]](../../../README.md#Component-Schemas) [[Back to README]](../../../README.md) diff --git a/samples/client/petstore/kotlin/docs/components/schemas/BooleanSchema.md b/samples/client/petstore/kotlin/docs/components/schemas/BooleanSchema.md new file mode 100644 index 00000000000..5f8d3d2fb27 --- /dev/null +++ b/samples/client/petstore/kotlin/docs/components/schemas/BooleanSchema.md @@ -0,0 +1,52 @@ +# BooleanSchema +org.openapijsonschematools.client.components.schemas.BooleanSchema.java +public class BooleanSchema
+ +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 + +## Nested Class Summary +| Modifier and Type | Class and Description | +| ----------------- | ---------------------- | +| sealed interface | [BooleanSchema.BooleanSchema1Boxed](#booleanschema1boxed)
sealed interface for validated payloads | +| record | [BooleanSchema.BooleanSchema1BoxedBoolean](#booleanschema1boxedboolean)
boxed class to store validated boolean payloads | +| static class | [BooleanSchema.BooleanSchema1](#booleanschema1)
schema class | + +## BooleanSchema1Boxed +public sealed interface BooleanSchema1Boxed
+permits
+[BooleanSchema1BoxedBoolean](#booleanschema1boxedboolean) + +sealed interface that stores validated payloads using boxed classes + +## BooleanSchema1BoxedBoolean +public record BooleanSchema1BoxedBoolean
+implements [BooleanSchema1Boxed](#booleanschema1boxed) + +record that stores validated boolean payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| BooleanSchema1BoxedBoolean(boolean data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| boolean | data()
validated payload | +| @Nullable Object | getData()
validated payload | + +## BooleanSchema1 +public static class BooleanSchema1
+extends BooleanJsonSchema.BooleanJsonSchema1 + +A schema class that validates payloads + +| Methods Inherited from class org.openapijsonschematools.client.schemas.BooleanJsonSchema.BooleanJsonSchema1 | +| ------------------------------------------------------------------ | +| validate | +| validateAndBox | + +[[Back to top]](#top) [[Back to Component Schemas]](../../../README.md#Component-Schemas) [[Back to README]](../../../README.md) diff --git a/samples/client/petstore/kotlin/docs/components/schemas/Capitalization.md b/samples/client/petstore/kotlin/docs/components/schemas/Capitalization.md new file mode 100644 index 00000000000..716e01dcd76 --- /dev/null +++ b/samples/client/petstore/kotlin/docs/components/schemas/Capitalization.md @@ -0,0 +1,382 @@ +# Capitalization +org.openapijsonschematools.client.components.schemas.Capitalization.java +public class Capitalization
+ +A class that contains necessary nested +- schema classes (which validate payloads), extends JsonSchema +- sealed interfaces which store validated payloads, java version of a sum type +- boxed classes which store validated payloads, sealed permits class implementations +- classes to store validated map payloads, extends FrozenMap +- classes to build inputs for map payloads + +## Nested Class Summary +| Modifier and Type | Class and Description | +| ----------------- | ---------------------- | +| sealed interface | [Capitalization.Capitalization1Boxed](#capitalization1boxed)
sealed interface for validated payloads | +| record | [Capitalization.Capitalization1BoxedMap](#capitalization1boxedmap)
boxed class to store validated Map payloads | +| static class | [Capitalization.Capitalization1](#capitalization1)
schema class | +| static class | [Capitalization.CapitalizationMapBuilder](#capitalizationmapbuilder)
builder for Map payloads | +| static class | [Capitalization.CapitalizationMap](#capitalizationmap)
output class for Map payloads | +| sealed interface | [Capitalization.ATTNAMEBoxed](#attnameboxed)
sealed interface for validated payloads | +| record | [Capitalization.ATTNAMEBoxedString](#attnameboxedstring)
boxed class to store validated String payloads | +| static class | [Capitalization.ATTNAME](#attname)
schema class | +| sealed interface | [Capitalization.SCAETHFlowPointsBoxed](#scaethflowpointsboxed)
sealed interface for validated payloads | +| record | [Capitalization.SCAETHFlowPointsBoxedString](#scaethflowpointsboxedstring)
boxed class to store validated String payloads | +| static class | [Capitalization.SCAETHFlowPoints](#scaethflowpoints)
schema class | +| sealed interface | [Capitalization.CapitalSnakeBoxed](#capitalsnakeboxed)
sealed interface for validated payloads | +| record | [Capitalization.CapitalSnakeBoxedString](#capitalsnakeboxedstring)
boxed class to store validated String payloads | +| static class | [Capitalization.CapitalSnake](#capitalsnake)
schema class | +| sealed interface | [Capitalization.SmallSnakeBoxed](#smallsnakeboxed)
sealed interface for validated payloads | +| record | [Capitalization.SmallSnakeBoxedString](#smallsnakeboxedstring)
boxed class to store validated String payloads | +| static class | [Capitalization.SmallSnake](#smallsnake)
schema class | +| sealed interface | [Capitalization.CapitalCamelBoxed](#capitalcamelboxed)
sealed interface for validated payloads | +| record | [Capitalization.CapitalCamelBoxedString](#capitalcamelboxedstring)
boxed class to store validated String payloads | +| static class | [Capitalization.CapitalCamel](#capitalcamel)
schema class | +| sealed interface | [Capitalization.SmallCamelBoxed](#smallcamelboxed)
sealed interface for validated payloads | +| record | [Capitalization.SmallCamelBoxedString](#smallcamelboxedstring)
boxed class to store validated String payloads | +| static class | [Capitalization.SmallCamel](#smallcamel)
schema class | + +## Capitalization1Boxed +public sealed interface Capitalization1Boxed
+permits
+[Capitalization1BoxedMap](#capitalization1boxedmap) + +sealed interface that stores validated payloads using boxed classes + +## Capitalization1BoxedMap +public record Capitalization1BoxedMap
+implements [Capitalization1Boxed](#capitalization1boxed) + +record that stores validated Map payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| Capitalization1BoxedMap([CapitalizationMap](#capitalizationmap) data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| [CapitalizationMap](#capitalizationmap) | data()
validated payload | +| @Nullable Object | getData()
validated payload | + +## Capitalization1 +public static class Capitalization1
+extends JsonSchema + +A schema class that validates payloads + +### Code Sample +``` +import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags; +import org.openapijsonschematools.client.configurations.SchemaConfiguration; +import org.openapijsonschematools.client.exceptions.ValidationException; +import org.openapijsonschematools.client.schemas.validation.MapUtils; +import org.openapijsonschematools.client.schemas.validation.FrozenList; +import org.openapijsonschematools.client.schemas.validation.FrozenMap; +import org.openapijsonschematools.client.components.schemas.Capitalization; + +import java.util.Arrays; +import java.util.List; +import java.util.AbstractMap; + +static final SchemaConfiguration configuration = new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().build()); + +// Map validation +Capitalization.CapitalizationMap validatedPayload = + Capitalization.Capitalization1.validate( + new Capitalization.CapitalizationMapBuilder() + .smallCamel("a") + + .CapitalCamel("a") + + .small_Snake("a") + + .Capital_Snake("a") + + .SCA_ETH_Flow_Points("a") + + .ATT_NAME("a") + + .build(), + configuration +); +``` + +### Field Summary +| Modifier and Type | Field and Description | +| ----------------- | ---------------------- | +| Set> | type = Set.of(Map.class) | +| Map> | properties = Map.ofEntries(
    new PropertyEntry("smallCamel", [SmallCamel.class](#smallcamel))),
    new PropertyEntry("CapitalCamel", [CapitalCamel.class](#capitalcamel))),
    new PropertyEntry("small_Snake", [SmallSnake.class](#smallsnake))),
    new PropertyEntry("Capital_Snake", [CapitalSnake.class](#capitalsnake))),
    new PropertyEntry("SCA_ETH_Flow_Points", [SCAETHFlowPoints.class](#scaethflowpoints))),
    new PropertyEntry("ATT_NAME", [ATTNAME.class](#attname)))
)
| + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| [CapitalizationMap](#capitalizationmap) | validate([Map<?, ?>](#capitalizationmapbuilder) arg, SchemaConfiguration configuration) | +| [Capitalization1BoxedMap](#capitalization1boxedmap) | validateAndBox([Map<?, ?>](#capitalizationmapbuilder) arg, SchemaConfiguration configuration) | +| [Capitalization1Boxed](#capitalization1boxed) | validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) | +| @Nullable Object | validate(@Nullable Object arg, SchemaConfiguration configuration) | + +## CapitalizationMapBuilder +public class CapitalizationMapBuilder
+builder for `Map` + +A class that builds the Map input type + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| CapitalizationMapBuilder()
Creates a builder that contains an empty map | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| Map | build()
Returns map input that should be used with Schema.validate | +| [CapitalizationMapBuilder](#capitalizationmapbuilder) | smallCamel(String value) | +| [CapitalizationMapBuilder](#capitalizationmapbuilder) | CapitalCamel(String value) | +| [CapitalizationMapBuilder](#capitalizationmapbuilder) | small_Snake(String value) | +| [CapitalizationMapBuilder](#capitalizationmapbuilder) | Capital_Snake(String value) | +| [CapitalizationMapBuilder](#capitalizationmapbuilder) | SCA_ETH_Flow_Points(String value) | +| [CapitalizationMapBuilder](#capitalizationmapbuilder) | ATT_NAME(String value) | +| [CapitalizationMapBuilder](#capitalizationmapbuilder) | additionalProperty(String key, Nothing? value) | +| [CapitalizationMapBuilder](#capitalizationmapbuilder) | additionalProperty(String key, boolean value) | +| [CapitalizationMapBuilder](#capitalizationmapbuilder) | additionalProperty(String key, String value) | +| [CapitalizationMapBuilder](#capitalizationmapbuilder) | additionalProperty(String key, int value) | +| [CapitalizationMapBuilder](#capitalizationmapbuilder) | additionalProperty(String key, float value) | +| [CapitalizationMapBuilder](#capitalizationmapbuilder) | additionalProperty(String key, long value) | +| [CapitalizationMapBuilder](#capitalizationmapbuilder) | additionalProperty(String key, double value) | +| [CapitalizationMapBuilder](#capitalizationmapbuilder) | additionalProperty(String key, List value) | +| [CapitalizationMapBuilder](#capitalizationmapbuilder) | additionalProperty(String key, Map value) | + +## CapitalizationMap +public static class CapitalizationMap
+extends FrozenMap + +A class to store validated Map payloads + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| static [CapitalizationMap](#capitalizationmap) | of([Map](#capitalizationmapbuilder) arg, SchemaConfiguration configuration) | +| String | smallCamel()
[optional] | +| String | CapitalCamel()
[optional] | +| String | small_Snake()
[optional] | +| String | Capital_Snake()
[optional] | +| String | SCA_ETH_Flow_Points()
[optional] | +| String | ATT_NAME()
[optional] | +| @Nullable Object | getAdditionalProperty(String name)
provides type safety for additional properties | + +## ATTNAMEBoxed +public sealed interface ATTNAMEBoxed
+permits
+[ATTNAMEBoxedString](#attnameboxedstring) + +sealed interface that stores validated payloads using boxed classes + +## ATTNAMEBoxedString +public record ATTNAMEBoxedString
+implements [ATTNAMEBoxed](#attnameboxed) + +record that stores validated String payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| ATTNAMEBoxedString(String data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| String | data()
validated payload | +| @Nullable Object | getData()
validated payload | + +## ATTNAME +public static class ATTNAME
+extends StringJsonSchema.StringJsonSchema1 + +A schema class that validates payloads + +## Description +Name of the pet
+ +| Methods Inherited from class org.openapijsonschematools.client.schemas.StringJsonSchema.StringJsonSchema1 | +| ------------------------------------------------------------------ | +| validate | +| validateAndBox | + +## SCAETHFlowPointsBoxed +public sealed interface SCAETHFlowPointsBoxed
+permits
+[SCAETHFlowPointsBoxedString](#scaethflowpointsboxedstring) + +sealed interface that stores validated payloads using boxed classes + +## SCAETHFlowPointsBoxedString +public record SCAETHFlowPointsBoxedString
+implements [SCAETHFlowPointsBoxed](#scaethflowpointsboxed) + +record that stores validated String payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| SCAETHFlowPointsBoxedString(String data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| String | data()
validated payload | +| @Nullable Object | getData()
validated payload | + +## SCAETHFlowPoints +public static class SCAETHFlowPoints
+extends StringJsonSchema.StringJsonSchema1 + +A schema class that validates payloads + +| Methods Inherited from class org.openapijsonschematools.client.schemas.StringJsonSchema.StringJsonSchema1 | +| ------------------------------------------------------------------ | +| validate | +| validateAndBox | + +## CapitalSnakeBoxed +public sealed interface CapitalSnakeBoxed
+permits
+[CapitalSnakeBoxedString](#capitalsnakeboxedstring) + +sealed interface that stores validated payloads using boxed classes + +## CapitalSnakeBoxedString +public record CapitalSnakeBoxedString
+implements [CapitalSnakeBoxed](#capitalsnakeboxed) + +record that stores validated String payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| CapitalSnakeBoxedString(String data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| String | data()
validated payload | +| @Nullable Object | getData()
validated payload | + +## CapitalSnake +public static class CapitalSnake
+extends StringJsonSchema.StringJsonSchema1 + +A schema class that validates payloads + +| Methods Inherited from class org.openapijsonschematools.client.schemas.StringJsonSchema.StringJsonSchema1 | +| ------------------------------------------------------------------ | +| validate | +| validateAndBox | + +## SmallSnakeBoxed +public sealed interface SmallSnakeBoxed
+permits
+[SmallSnakeBoxedString](#smallsnakeboxedstring) + +sealed interface that stores validated payloads using boxed classes + +## SmallSnakeBoxedString +public record SmallSnakeBoxedString
+implements [SmallSnakeBoxed](#smallsnakeboxed) + +record that stores validated String payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| SmallSnakeBoxedString(String data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| String | data()
validated payload | +| @Nullable Object | getData()
validated payload | + +## SmallSnake +public static class SmallSnake
+extends StringJsonSchema.StringJsonSchema1 + +A schema class that validates payloads + +| Methods Inherited from class org.openapijsonschematools.client.schemas.StringJsonSchema.StringJsonSchema1 | +| ------------------------------------------------------------------ | +| validate | +| validateAndBox | + +## CapitalCamelBoxed +public sealed interface CapitalCamelBoxed
+permits
+[CapitalCamelBoxedString](#capitalcamelboxedstring) + +sealed interface that stores validated payloads using boxed classes + +## CapitalCamelBoxedString +public record CapitalCamelBoxedString
+implements [CapitalCamelBoxed](#capitalcamelboxed) + +record that stores validated String payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| CapitalCamelBoxedString(String data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| String | data()
validated payload | +| @Nullable Object | getData()
validated payload | + +## CapitalCamel +public static class CapitalCamel
+extends StringJsonSchema.StringJsonSchema1 + +A schema class that validates payloads + +| Methods Inherited from class org.openapijsonschematools.client.schemas.StringJsonSchema.StringJsonSchema1 | +| ------------------------------------------------------------------ | +| validate | +| validateAndBox | + +## SmallCamelBoxed +public sealed interface SmallCamelBoxed
+permits
+[SmallCamelBoxedString](#smallcamelboxedstring) + +sealed interface that stores validated payloads using boxed classes + +## SmallCamelBoxedString +public record SmallCamelBoxedString
+implements [SmallCamelBoxed](#smallcamelboxed) + +record that stores validated String payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| SmallCamelBoxedString(String data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| String | data()
validated payload | +| @Nullable Object | getData()
validated payload | + +## SmallCamel +public static class SmallCamel
+extends StringJsonSchema.StringJsonSchema1 + +A schema class that validates payloads + +| Methods Inherited from class org.openapijsonschematools.client.schemas.StringJsonSchema.StringJsonSchema1 | +| ------------------------------------------------------------------ | +| validate | +| validateAndBox | + +[[Back to top]](#top) [[Back to Component Schemas]](../../../README.md#Component-Schemas) [[Back to README]](../../../README.md) diff --git a/samples/client/petstore/kotlin/docs/components/schemas/Cat.md b/samples/client/petstore/kotlin/docs/components/schemas/Cat.md new file mode 100644 index 00000000000..d1142f0df49 --- /dev/null +++ b/samples/client/petstore/kotlin/docs/components/schemas/Cat.md @@ -0,0 +1,324 @@ +# Cat +org.openapijsonschematools.client.components.schemas.Cat.java +public class Cat
+ +A class that contains necessary nested +- schema classes (which validate payloads), extends JsonSchema +- sealed interfaces which store validated payloads, java version of a sum type +- boxed classes which store validated payloads, sealed permits class implementations +- classes to store validated map payloads, extends FrozenMap +- classes to build inputs for map payloads + +## Nested Class Summary +| Modifier and Type | Class and Description | +| ----------------- | ---------------------- | +| sealed interface | [Cat.Cat1Boxed](#cat1boxed)
sealed interface for validated payloads | +| record | [Cat.Cat1BoxedVoid](#cat1boxedvoid)
boxed class to store validated null payloads | +| record | [Cat.Cat1BoxedBoolean](#cat1boxedboolean)
boxed class to store validated boolean payloads | +| record | [Cat.Cat1BoxedNumber](#cat1boxednumber)
boxed class to store validated Number payloads | +| record | [Cat.Cat1BoxedString](#cat1boxedstring)
boxed class to store validated String payloads | +| record | [Cat.Cat1BoxedList](#cat1boxedlist)
boxed class to store validated List payloads | +| record | [Cat.Cat1BoxedMap](#cat1boxedmap)
boxed class to store validated Map payloads | +| static class | [Cat.Cat1](#cat1)
schema class | +| sealed interface | [Cat.Schema1Boxed](#schema1boxed)
sealed interface for validated payloads | +| record | [Cat.Schema1BoxedMap](#schema1boxedmap)
boxed class to store validated Map payloads | +| static class | [Cat.Schema1](#schema1)
schema class | +| static class | [Cat.Schema1MapBuilder](#schema1mapbuilder)
builder for Map payloads | +| static class | [Cat.Schema1Map](#schema1map)
output class for Map payloads | +| sealed interface | [Cat.DeclawedBoxed](#declawedboxed)
sealed interface for validated payloads | +| record | [Cat.DeclawedBoxedBoolean](#declawedboxedboolean)
boxed class to store validated boolean payloads | +| static class | [Cat.Declawed](#declawed)
schema class | + +## Cat1Boxed +public sealed interface Cat1Boxed
+permits
+[Cat1BoxedVoid](#cat1boxedvoid), +[Cat1BoxedBoolean](#cat1boxedboolean), +[Cat1BoxedNumber](#cat1boxednumber), +[Cat1BoxedString](#cat1boxedstring), +[Cat1BoxedList](#cat1boxedlist), +[Cat1BoxedMap](#cat1boxedmap) + +sealed interface that stores validated payloads using boxed classes + +## Cat1BoxedVoid +public record Cat1BoxedVoid
+implements [Cat1Boxed](#cat1boxed) + +record that stores validated null payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| Cat1BoxedVoid(Nothing? data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| Nothing? | data()
validated payload | +| @Nullable Object | getData()
validated payload | + +## Cat1BoxedBoolean +public record Cat1BoxedBoolean
+implements [Cat1Boxed](#cat1boxed) + +record that stores validated boolean payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| Cat1BoxedBoolean(boolean data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| boolean | data()
validated payload | +| @Nullable Object | getData()
validated payload | + +## Cat1BoxedNumber +public record Cat1BoxedNumber
+implements [Cat1Boxed](#cat1boxed) + +record that stores validated Number payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| Cat1BoxedNumber(Number data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| Number | data()
validated payload | +| @Nullable Object | getData()
validated payload | + +## Cat1BoxedString +public record Cat1BoxedString
+implements [Cat1Boxed](#cat1boxed) + +record that stores validated String payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| Cat1BoxedString(String data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| String | data()
validated payload | +| @Nullable Object | getData()
validated payload | + +## Cat1BoxedList +public record Cat1BoxedList
+implements [Cat1Boxed](#cat1boxed) + +record that stores validated List payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| Cat1BoxedList(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 | + +## Cat1BoxedMap +public record Cat1BoxedMap
+implements [Cat1Boxed](#cat1boxed) + +record that stores validated Map payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| Cat1BoxedMap(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 | + +## Cat1 +public static class Cat1
+extends JsonSchema + +A schema class that validates payloads + +### Field Summary +| Modifier and Type | Field and Description | +| ----------------- | ---------------------- | +| List> | allOf = List.of(
    [Animal.Animal1.class](../../components/schemas/Animal.md#animal1),
    [Schema1.class](#schema1)
;)
| + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| String | validate(String arg, SchemaConfiguration configuration) | +| Nothing? | validate(Nothing? arg, SchemaConfiguration configuration) | +| int | validate(int arg, SchemaConfiguration configuration) | +| long | validate(long arg, SchemaConfiguration configuration) | +| float | validate(float arg, SchemaConfiguration configuration) | +| double | validate(double arg, SchemaConfiguration configuration) | +| Number | validate(Number arg, SchemaConfiguration configuration) | +| boolean | validate(boolean arg, SchemaConfiguration configuration) | +| FrozenMap<@Nullable Object> | validate(Map<?, ?> arg, SchemaConfiguration configuration) | +| FrozenList<@Nullable Object> | validate(List arg, SchemaConfiguration configuration) | +| [Cat1BoxedString](#cat1boxedstring) | validateAndBox(String arg, SchemaConfiguration configuration) | +| [Cat1BoxedVoid](#cat1boxedvoid) | validateAndBox(Nothing? arg, SchemaConfiguration configuration) | +| [Cat1BoxedNumber](#cat1boxednumber) | validateAndBox(Number arg, SchemaConfiguration configuration) | +| [Cat1BoxedBoolean](#cat1boxedboolean) | validateAndBox(boolean arg, SchemaConfiguration configuration) | +| [Cat1BoxedMap](#cat1boxedmap) | validateAndBox(Map<?, ?> arg, SchemaConfiguration configuration) | +| [Cat1BoxedList](#cat1boxedlist) | validateAndBox(List arg, SchemaConfiguration configuration) | +| [Cat1Boxed](#cat1boxed) | validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) | +| @Nullable Object | validate(@Nullable Object arg, SchemaConfiguration configuration) | + +## Schema1Boxed +public sealed interface Schema1Boxed
+permits
+[Schema1BoxedMap](#schema1boxedmap) + +sealed interface that stores validated payloads using boxed classes + +## Schema1BoxedMap +public record Schema1BoxedMap
+implements [Schema1Boxed](#schema1boxed) + +record that stores validated Map payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| Schema1BoxedMap([Schema1Map](#schema1map) data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| [Schema1Map](#schema1map) | data()
validated payload | +| @Nullable Object | getData()
validated payload | + +## Schema1 +public static class Schema1
+extends JsonSchema + +A schema class that validates payloads + +### Code Sample +``` +import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags; +import org.openapijsonschematools.client.configurations.SchemaConfiguration; +import org.openapijsonschematools.client.exceptions.ValidationException; +import org.openapijsonschematools.client.schemas.validation.MapUtils; +import org.openapijsonschematools.client.schemas.validation.FrozenList; +import org.openapijsonschematools.client.schemas.validation.FrozenMap; +import org.openapijsonschematools.client.components.schemas.Cat; + +import java.util.Arrays; +import java.util.List; +import java.util.AbstractMap; + +static final SchemaConfiguration configuration = new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().build()); + +// Map validation +Cat.Schema1Map validatedPayload = + Cat.Schema1.validate( + new Cat.Schema1MapBuilder() + .declawed(true) + + .build(), + configuration +); +``` + +### Field Summary +| Modifier and Type | Field and Description | +| ----------------- | ---------------------- | +| Set> | type = Set.of(Map.class) | +| Map> | properties = Map.ofEntries(
    new PropertyEntry("declawed", [Declawed.class](#declawed)))
)
| + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| [Schema1Map](#schema1map) | validate([Map<?, ?>](#schema1mapbuilder) arg, SchemaConfiguration configuration) | +| [Schema1BoxedMap](#schema1boxedmap) | validateAndBox([Map<?, ?>](#schema1mapbuilder) arg, SchemaConfiguration configuration) | +| [Schema1Boxed](#schema1boxed) | validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) | +| @Nullable Object | validate(@Nullable Object arg, SchemaConfiguration configuration) | + +## Schema1MapBuilder +public class Schema1MapBuilder
+builder for `Map` + +A class that builds the Map input type + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| Schema1MapBuilder()
Creates a builder that contains an empty map | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| Map | build()
Returns map input that should be used with Schema.validate | +| [Schema1MapBuilder](#schema1mapbuilder) | declawed(boolean value) | +| [Schema1MapBuilder](#schema1mapbuilder) | additionalProperty(String key, Nothing? value) | +| [Schema1MapBuilder](#schema1mapbuilder) | additionalProperty(String key, boolean value) | +| [Schema1MapBuilder](#schema1mapbuilder) | additionalProperty(String key, String value) | +| [Schema1MapBuilder](#schema1mapbuilder) | additionalProperty(String key, int value) | +| [Schema1MapBuilder](#schema1mapbuilder) | additionalProperty(String key, float value) | +| [Schema1MapBuilder](#schema1mapbuilder) | additionalProperty(String key, long value) | +| [Schema1MapBuilder](#schema1mapbuilder) | additionalProperty(String key, double value) | +| [Schema1MapBuilder](#schema1mapbuilder) | additionalProperty(String key, List value) | +| [Schema1MapBuilder](#schema1mapbuilder) | additionalProperty(String key, Map value) | + +## Schema1Map +public static class Schema1Map
+extends FrozenMap + +A class to store validated Map payloads + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| static [Schema1Map](#schema1map) | of([Map](#schema1mapbuilder) arg, SchemaConfiguration configuration) | +| boolean | declawed()
[optional] | +| @Nullable Object | getAdditionalProperty(String name)
provides type safety for additional properties | + +## DeclawedBoxed +public sealed interface DeclawedBoxed
+permits
+[DeclawedBoxedBoolean](#declawedboxedboolean) + +sealed interface that stores validated payloads using boxed classes + +## DeclawedBoxedBoolean +public record DeclawedBoxedBoolean
+implements [DeclawedBoxed](#declawedboxed) + +record that stores validated boolean payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| DeclawedBoxedBoolean(boolean data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| boolean | data()
validated payload | +| @Nullable Object | getData()
validated payload | + +## Declawed +public static class Declawed
+extends BooleanJsonSchema.BooleanJsonSchema1 + +A schema class that validates payloads + +| Methods Inherited from class org.openapijsonschematools.client.schemas.BooleanJsonSchema.BooleanJsonSchema1 | +| ------------------------------------------------------------------ | +| validate | +| validateAndBox | + +[[Back to top]](#top) [[Back to Component Schemas]](../../../README.md#Component-Schemas) [[Back to README]](../../../README.md) diff --git a/samples/client/petstore/kotlin/docs/components/schemas/Category.md b/samples/client/petstore/kotlin/docs/components/schemas/Category.md new file mode 100644 index 00000000000..64eeb60b4f9 --- /dev/null +++ b/samples/client/petstore/kotlin/docs/components/schemas/Category.md @@ -0,0 +1,262 @@ +# Category +org.openapijsonschematools.client.components.schemas.Category.java +public class Category
+ +A class that contains necessary nested +- schema classes (which validate payloads), extends JsonSchema +- sealed interfaces which store validated payloads, java version of a sum type +- boxed classes which store validated payloads, sealed permits class implementations +- classes to store validated map payloads, extends FrozenMap +- classes to build inputs for map payloads + +## Nested Class Summary +| Modifier and Type | Class and Description | +| ----------------- | ---------------------- | +| sealed interface | [Category.Category1Boxed](#category1boxed)
sealed interface for validated payloads | +| record | [Category.Category1BoxedMap](#category1boxedmap)
boxed class to store validated Map payloads | +| static class | [Category.Category1](#category1)
schema class | +| static class | [Category.CategoryMapBuilder](#categorymapbuilder)
builder for Map payloads | +| static class | [Category.CategoryMap](#categorymap)
output class for Map payloads | +| sealed interface | [Category.NameBoxed](#nameboxed)
sealed interface for validated payloads | +| record | [Category.NameBoxedString](#nameboxedstring)
boxed class to store validated String payloads | +| static class | [Category.Name](#name)
schema class | +| sealed interface | [Category.IdBoxed](#idboxed)
sealed interface for validated payloads | +| record | [Category.IdBoxedNumber](#idboxednumber)
boxed class to store validated Number payloads | +| static class | [Category.Id](#id)
schema class | + +## Category1Boxed +public sealed interface Category1Boxed
+permits
+[Category1BoxedMap](#category1boxedmap) + +sealed interface that stores validated payloads using boxed classes + +## Category1BoxedMap +public record Category1BoxedMap
+implements [Category1Boxed](#category1boxed) + +record that stores validated Map payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| Category1BoxedMap([CategoryMap](#categorymap) data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| [CategoryMap](#categorymap) | data()
validated payload | +| @Nullable Object | getData()
validated payload | + +## Category1 +public static class Category1
+extends JsonSchema + +A schema class that validates payloads + +### Code Sample +``` +import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags; +import org.openapijsonschematools.client.configurations.SchemaConfiguration; +import org.openapijsonschematools.client.exceptions.ValidationException; +import org.openapijsonschematools.client.schemas.validation.MapUtils; +import org.openapijsonschematools.client.schemas.validation.FrozenList; +import org.openapijsonschematools.client.schemas.validation.FrozenMap; +import org.openapijsonschematools.client.components.schemas.Category; + +import java.util.Arrays; +import java.util.List; +import java.util.AbstractMap; + +static final SchemaConfiguration configuration = new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().build()); + +// Map validation +Category.CategoryMap validatedPayload = + Category.Category1.validate( + new Category.CategoryMapBuilder() + .name("a") + + .id(1L) + + .build(), + configuration +); +``` + +### Field Summary +| Modifier and Type | Field and Description | +| ----------------- | ---------------------- | +| Set> | type = Set.of(Map.class) | +| Map> | properties = Map.ofEntries(
    new PropertyEntry("id", [Id.class](#id))),
    new PropertyEntry("name", [Name.class](#name)))
)
| +| Set | required = Set.of(
    "name"
)
| + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| [CategoryMap](#categorymap) | validate([Map<?, ?>](#categorymapbuilder) arg, SchemaConfiguration configuration) | +| [Category1BoxedMap](#category1boxedmap) | validateAndBox([Map<?, ?>](#categorymapbuilder) arg, SchemaConfiguration configuration) | +| [Category1Boxed](#category1boxed) | validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) | +| @Nullable Object | validate(@Nullable Object arg, SchemaConfiguration configuration) | + +## CategoryMap0Builder +public class CategoryMap0Builder
+builder for `Map` + +A class that builds the Map input type + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| CategoryMap0Builder(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 | +| [CategoryMap0Builder](#categorymap0builder) | id(int value) | +| [CategoryMap0Builder](#categorymap0builder) | id(float value) | +| [CategoryMap0Builder](#categorymap0builder) | id(long value) | +| [CategoryMap0Builder](#categorymap0builder) | id(double value) | +| [CategoryMap0Builder](#categorymap0builder) | additionalProperty(String key, Nothing? value) | +| [CategoryMap0Builder](#categorymap0builder) | additionalProperty(String key, boolean value) | +| [CategoryMap0Builder](#categorymap0builder) | additionalProperty(String key, String value) | +| [CategoryMap0Builder](#categorymap0builder) | additionalProperty(String key, int value) | +| [CategoryMap0Builder](#categorymap0builder) | additionalProperty(String key, float value) | +| [CategoryMap0Builder](#categorymap0builder) | additionalProperty(String key, long value) | +| [CategoryMap0Builder](#categorymap0builder) | additionalProperty(String key, double value) | +| [CategoryMap0Builder](#categorymap0builder) | additionalProperty(String key, List value) | +| [CategoryMap0Builder](#categorymap0builder) | additionalProperty(String key, Map value) | + +## CategoryMapBuilder +public class CategoryMapBuilder
+builder for `Map` + +A class that builds the Map input type + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| CategoryMapBuilder()
Creates a builder that contains an empty map | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| [CategoryMap0Builder](#categorymap0builder) | name(String value) | + +## CategoryMap +public static class CategoryMap
+extends FrozenMap + +A class to store validated Map payloads + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| static [CategoryMap](#categorymap) | of([Map](#categorymapbuilder) arg, SchemaConfiguration configuration) | +| String | name()
if omitted the server will use the default value of default-name | +| Number | id()
[optional] value must be a 64 bit integer | +| @Nullable Object | getAdditionalProperty(String name)
provides type safety for additional properties | + +## NameBoxed +public sealed interface NameBoxed
+permits
+[NameBoxedString](#nameboxedstring) + +sealed interface that stores validated payloads using boxed classes + +## NameBoxedString +public record NameBoxedString
+implements [NameBoxed](#nameboxed) + +record that stores validated String payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| NameBoxedString(String data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| String | data()
validated payload | +| @Nullable Object | getData()
validated payload | + +## Name +public static class Name
+extends JsonSchema + +A schema class that validates payloads + +### Code Sample +``` +import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags; +import org.openapijsonschematools.client.configurations.SchemaConfiguration; +import org.openapijsonschematools.client.exceptions.ValidationException; +import org.openapijsonschematools.client.schemas.validation.MapUtils; +import org.openapijsonschematools.client.schemas.validation.FrozenList; +import org.openapijsonschematools.client.schemas.validation.FrozenMap; +import org.openapijsonschematools.client.components.schemas.Category; + +import java.util.Arrays; +import java.util.List; +import java.util.AbstractMap; + +static final SchemaConfiguration configuration = new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().build()); + +// String validation +String validatedPayload = Category.Name.validate( + "a", + configuration +); +``` + +### Field Summary +| Modifier and Type | Field and Description | +| ----------------- | ---------------------- | +| Set> | type = Set.of(
    String.class
)
| +| @Nullable Object | defaultValue = "default-name" | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| String | validate(String arg, SchemaConfiguration configuration) | +| [NameBoxedString](#nameboxedstring) | validateAndBox(String arg, SchemaConfiguration configuration) | +| [NameBoxed](#nameboxed) | validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) | +| @Nullable Object | validate(@Nullable Object arg, SchemaConfiguration configuration) | + +## IdBoxed +public sealed interface IdBoxed
+permits
+[IdBoxedNumber](#idboxednumber) + +sealed interface that stores validated payloads using boxed classes + +## IdBoxedNumber +public record IdBoxedNumber
+implements [IdBoxed](#idboxed) + +record that stores validated Number payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| IdBoxedNumber(Number data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| Number | data()
validated payload | +| @Nullable Object | getData()
validated payload | + +## Id +public static class Id
+extends Int64JsonSchema.Int64JsonSchema1 + +A schema class that validates payloads + +| Methods Inherited from class org.openapijsonschematools.client.schemas.Int64JsonSchema.Int64JsonSchema1 | +| ------------------------------------------------------------------ | +| validate | +| validateAndBox | + +[[Back to top]](#top) [[Back to Component Schemas]](../../../README.md#Component-Schemas) [[Back to README]](../../../README.md) diff --git a/samples/client/petstore/kotlin/docs/components/schemas/ChildCat.md b/samples/client/petstore/kotlin/docs/components/schemas/ChildCat.md new file mode 100644 index 00000000000..2b44771c4ce --- /dev/null +++ b/samples/client/petstore/kotlin/docs/components/schemas/ChildCat.md @@ -0,0 +1,324 @@ +# ChildCat +org.openapijsonschematools.client.components.schemas.ChildCat.java +public class ChildCat
+ +A class that contains necessary nested +- schema classes (which validate payloads), extends JsonSchema +- sealed interfaces which store validated payloads, java version of a sum type +- boxed classes which store validated payloads, sealed permits class implementations +- classes to store validated map payloads, extends FrozenMap +- classes to build inputs for map payloads + +## Nested Class Summary +| Modifier and Type | Class and Description | +| ----------------- | ---------------------- | +| sealed interface | [ChildCat.ChildCat1Boxed](#childcat1boxed)
sealed interface for validated payloads | +| record | [ChildCat.ChildCat1BoxedVoid](#childcat1boxedvoid)
boxed class to store validated null payloads | +| record | [ChildCat.ChildCat1BoxedBoolean](#childcat1boxedboolean)
boxed class to store validated boolean payloads | +| record | [ChildCat.ChildCat1BoxedNumber](#childcat1boxednumber)
boxed class to store validated Number payloads | +| record | [ChildCat.ChildCat1BoxedString](#childcat1boxedstring)
boxed class to store validated String payloads | +| record | [ChildCat.ChildCat1BoxedList](#childcat1boxedlist)
boxed class to store validated List payloads | +| record | [ChildCat.ChildCat1BoxedMap](#childcat1boxedmap)
boxed class to store validated Map payloads | +| static class | [ChildCat.ChildCat1](#childcat1)
schema class | +| sealed interface | [ChildCat.Schema1Boxed](#schema1boxed)
sealed interface for validated payloads | +| record | [ChildCat.Schema1BoxedMap](#schema1boxedmap)
boxed class to store validated Map payloads | +| static class | [ChildCat.Schema1](#schema1)
schema class | +| static class | [ChildCat.Schema1MapBuilder](#schema1mapbuilder)
builder for Map payloads | +| static class | [ChildCat.Schema1Map](#schema1map)
output class for Map payloads | +| sealed interface | [ChildCat.NameBoxed](#nameboxed)
sealed interface for validated payloads | +| record | [ChildCat.NameBoxedString](#nameboxedstring)
boxed class to store validated String payloads | +| static class | [ChildCat.Name](#name)
schema class | + +## ChildCat1Boxed +public sealed interface ChildCat1Boxed
+permits
+[ChildCat1BoxedVoid](#childcat1boxedvoid), +[ChildCat1BoxedBoolean](#childcat1boxedboolean), +[ChildCat1BoxedNumber](#childcat1boxednumber), +[ChildCat1BoxedString](#childcat1boxedstring), +[ChildCat1BoxedList](#childcat1boxedlist), +[ChildCat1BoxedMap](#childcat1boxedmap) + +sealed interface that stores validated payloads using boxed classes + +## ChildCat1BoxedVoid +public record ChildCat1BoxedVoid
+implements [ChildCat1Boxed](#childcat1boxed) + +record that stores validated null payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| ChildCat1BoxedVoid(Nothing? data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| Nothing? | data()
validated payload | +| @Nullable Object | getData()
validated payload | + +## ChildCat1BoxedBoolean +public record ChildCat1BoxedBoolean
+implements [ChildCat1Boxed](#childcat1boxed) + +record that stores validated boolean payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| ChildCat1BoxedBoolean(boolean data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| boolean | data()
validated payload | +| @Nullable Object | getData()
validated payload | + +## ChildCat1BoxedNumber +public record ChildCat1BoxedNumber
+implements [ChildCat1Boxed](#childcat1boxed) + +record that stores validated Number payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| ChildCat1BoxedNumber(Number data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| Number | data()
validated payload | +| @Nullable Object | getData()
validated payload | + +## ChildCat1BoxedString +public record ChildCat1BoxedString
+implements [ChildCat1Boxed](#childcat1boxed) + +record that stores validated String payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| ChildCat1BoxedString(String data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| String | data()
validated payload | +| @Nullable Object | getData()
validated payload | + +## ChildCat1BoxedList +public record ChildCat1BoxedList
+implements [ChildCat1Boxed](#childcat1boxed) + +record that stores validated List payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| ChildCat1BoxedList(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 | + +## ChildCat1BoxedMap +public record ChildCat1BoxedMap
+implements [ChildCat1Boxed](#childcat1boxed) + +record that stores validated Map payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| ChildCat1BoxedMap(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 | + +## ChildCat1 +public static class ChildCat1
+extends JsonSchema + +A schema class that validates payloads + +### Field Summary +| Modifier and Type | Field and Description | +| ----------------- | ---------------------- | +| List> | allOf = List.of(
    [ParentPet.ParentPet1.class](../../components/schemas/ParentPet.md#parentpet1),
    [Schema1.class](#schema1)
;)
| + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| String | validate(String arg, SchemaConfiguration configuration) | +| Nothing? | validate(Nothing? arg, SchemaConfiguration configuration) | +| int | validate(int arg, SchemaConfiguration configuration) | +| long | validate(long arg, SchemaConfiguration configuration) | +| float | validate(float arg, SchemaConfiguration configuration) | +| double | validate(double arg, SchemaConfiguration configuration) | +| Number | validate(Number arg, SchemaConfiguration configuration) | +| boolean | validate(boolean arg, SchemaConfiguration configuration) | +| FrozenMap<@Nullable Object> | validate(Map<?, ?> arg, SchemaConfiguration configuration) | +| FrozenList<@Nullable Object> | validate(List arg, SchemaConfiguration configuration) | +| [ChildCat1BoxedString](#childcat1boxedstring) | validateAndBox(String arg, SchemaConfiguration configuration) | +| [ChildCat1BoxedVoid](#childcat1boxedvoid) | validateAndBox(Nothing? arg, SchemaConfiguration configuration) | +| [ChildCat1BoxedNumber](#childcat1boxednumber) | validateAndBox(Number arg, SchemaConfiguration configuration) | +| [ChildCat1BoxedBoolean](#childcat1boxedboolean) | validateAndBox(boolean arg, SchemaConfiguration configuration) | +| [ChildCat1BoxedMap](#childcat1boxedmap) | validateAndBox(Map<?, ?> arg, SchemaConfiguration configuration) | +| [ChildCat1BoxedList](#childcat1boxedlist) | validateAndBox(List arg, SchemaConfiguration configuration) | +| [ChildCat1Boxed](#childcat1boxed) | validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) | +| @Nullable Object | validate(@Nullable Object arg, SchemaConfiguration configuration) | + +## Schema1Boxed +public sealed interface Schema1Boxed
+permits
+[Schema1BoxedMap](#schema1boxedmap) + +sealed interface that stores validated payloads using boxed classes + +## Schema1BoxedMap +public record Schema1BoxedMap
+implements [Schema1Boxed](#schema1boxed) + +record that stores validated Map payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| Schema1BoxedMap([Schema1Map](#schema1map) data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| [Schema1Map](#schema1map) | data()
validated payload | +| @Nullable Object | getData()
validated payload | + +## Schema1 +public static class Schema1
+extends JsonSchema + +A schema class that validates payloads + +### Code Sample +``` +import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags; +import org.openapijsonschematools.client.configurations.SchemaConfiguration; +import org.openapijsonschematools.client.exceptions.ValidationException; +import org.openapijsonschematools.client.schemas.validation.MapUtils; +import org.openapijsonschematools.client.schemas.validation.FrozenList; +import org.openapijsonschematools.client.schemas.validation.FrozenMap; +import org.openapijsonschematools.client.components.schemas.ChildCat; + +import java.util.Arrays; +import java.util.List; +import java.util.AbstractMap; + +static final SchemaConfiguration configuration = new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().build()); + +// Map validation +ChildCat.Schema1Map validatedPayload = + ChildCat.Schema1.validate( + new ChildCat.Schema1MapBuilder() + .name("a") + + .build(), + configuration +); +``` + +### Field Summary +| Modifier and Type | Field and Description | +| ----------------- | ---------------------- | +| Set> | type = Set.of(Map.class) | +| Map> | properties = Map.ofEntries(
    new PropertyEntry("name", [Name.class](#name)))
)
| + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| [Schema1Map](#schema1map) | validate([Map<?, ?>](#schema1mapbuilder) arg, SchemaConfiguration configuration) | +| [Schema1BoxedMap](#schema1boxedmap) | validateAndBox([Map<?, ?>](#schema1mapbuilder) arg, SchemaConfiguration configuration) | +| [Schema1Boxed](#schema1boxed) | validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) | +| @Nullable Object | validate(@Nullable Object arg, SchemaConfiguration configuration) | + +## Schema1MapBuilder +public class Schema1MapBuilder
+builder for `Map` + +A class that builds the Map input type + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| Schema1MapBuilder()
Creates a builder that contains an empty map | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| Map | build()
Returns map input that should be used with Schema.validate | +| [Schema1MapBuilder](#schema1mapbuilder) | name(String value) | +| [Schema1MapBuilder](#schema1mapbuilder) | additionalProperty(String key, Nothing? value) | +| [Schema1MapBuilder](#schema1mapbuilder) | additionalProperty(String key, boolean value) | +| [Schema1MapBuilder](#schema1mapbuilder) | additionalProperty(String key, String value) | +| [Schema1MapBuilder](#schema1mapbuilder) | additionalProperty(String key, int value) | +| [Schema1MapBuilder](#schema1mapbuilder) | additionalProperty(String key, float value) | +| [Schema1MapBuilder](#schema1mapbuilder) | additionalProperty(String key, long value) | +| [Schema1MapBuilder](#schema1mapbuilder) | additionalProperty(String key, double value) | +| [Schema1MapBuilder](#schema1mapbuilder) | additionalProperty(String key, List value) | +| [Schema1MapBuilder](#schema1mapbuilder) | additionalProperty(String key, Map value) | + +## Schema1Map +public static class Schema1Map
+extends FrozenMap + +A class to store validated Map payloads + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| static [Schema1Map](#schema1map) | of([Map](#schema1mapbuilder) arg, SchemaConfiguration configuration) | +| String | name()
[optional] | +| @Nullable Object | getAdditionalProperty(String name)
provides type safety for additional properties | + +## NameBoxed +public sealed interface NameBoxed
+permits
+[NameBoxedString](#nameboxedstring) + +sealed interface that stores validated payloads using boxed classes + +## NameBoxedString +public record NameBoxedString
+implements [NameBoxed](#nameboxed) + +record that stores validated String payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| NameBoxedString(String data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| String | data()
validated payload | +| @Nullable Object | getData()
validated payload | + +## Name +public static class Name
+extends StringJsonSchema.StringJsonSchema1 + +A schema class that validates payloads + +| Methods Inherited from class org.openapijsonschematools.client.schemas.StringJsonSchema.StringJsonSchema1 | +| ------------------------------------------------------------------ | +| validate | +| validateAndBox | + +[[Back to top]](#top) [[Back to Component Schemas]](../../../README.md#Component-Schemas) [[Back to README]](../../../README.md) diff --git a/samples/client/petstore/kotlin/docs/components/schemas/ClassModel.md b/samples/client/petstore/kotlin/docs/components/schemas/ClassModel.md new file mode 100644 index 00000000000..01df2ad6103 --- /dev/null +++ b/samples/client/petstore/kotlin/docs/components/schemas/ClassModel.md @@ -0,0 +1,253 @@ +# ClassModel +org.openapijsonschematools.client.components.schemas.ClassModel.java +public class ClassModel
+ +A class that contains necessary nested +- schema classes (which validate payloads), extends JsonSchema +- sealed interfaces which store validated payloads, java version of a sum type +- boxed classes which store validated payloads, sealed permits class implementations +- classes to store validated map payloads, extends FrozenMap +- classes to build inputs for map payloads + +## Nested Class Summary +| Modifier and Type | Class and Description | +| ----------------- | ---------------------- | +| sealed interface | [ClassModel.ClassModel1Boxed](#classmodel1boxed)
sealed interface for validated payloads | +| record | [ClassModel.ClassModel1BoxedVoid](#classmodel1boxedvoid)
boxed class to store validated null payloads | +| record | [ClassModel.ClassModel1BoxedBoolean](#classmodel1boxedboolean)
boxed class to store validated boolean payloads | +| record | [ClassModel.ClassModel1BoxedNumber](#classmodel1boxednumber)
boxed class to store validated Number payloads | +| record | [ClassModel.ClassModel1BoxedString](#classmodel1boxedstring)
boxed class to store validated String payloads | +| record | [ClassModel.ClassModel1BoxedList](#classmodel1boxedlist)
boxed class to store validated List payloads | +| record | [ClassModel.ClassModel1BoxedMap](#classmodel1boxedmap)
boxed class to store validated Map payloads | +| static class | [ClassModel.ClassModel1](#classmodel1)
schema class | +| static class | [ClassModel.ClassModelMapBuilder](#classmodelmapbuilder)
builder for Map payloads | +| static class | [ClassModel.ClassModelMap](#classmodelmap)
output class for Map payloads | +| sealed interface | [ClassModel.ClassSchemaBoxed](#classschemaboxed)
sealed interface for validated payloads | +| record | [ClassModel.ClassSchemaBoxedString](#classschemaboxedstring)
boxed class to store validated String payloads | +| static class | [ClassModel.ClassSchema](#classschema)
schema class | + +## ClassModel1Boxed +public sealed interface ClassModel1Boxed
+permits
+[ClassModel1BoxedVoid](#classmodel1boxedvoid), +[ClassModel1BoxedBoolean](#classmodel1boxedboolean), +[ClassModel1BoxedNumber](#classmodel1boxednumber), +[ClassModel1BoxedString](#classmodel1boxedstring), +[ClassModel1BoxedList](#classmodel1boxedlist), +[ClassModel1BoxedMap](#classmodel1boxedmap) + +sealed interface that stores validated payloads using boxed classes + +## ClassModel1BoxedVoid +public record ClassModel1BoxedVoid
+implements [ClassModel1Boxed](#classmodel1boxed) + +record that stores validated null payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| ClassModel1BoxedVoid(Nothing? data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| Nothing? | data()
validated payload | +| @Nullable Object | getData()
validated payload | + +## ClassModel1BoxedBoolean +public record ClassModel1BoxedBoolean
+implements [ClassModel1Boxed](#classmodel1boxed) + +record that stores validated boolean payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| ClassModel1BoxedBoolean(boolean data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| boolean | data()
validated payload | +| @Nullable Object | getData()
validated payload | + +## ClassModel1BoxedNumber +public record ClassModel1BoxedNumber
+implements [ClassModel1Boxed](#classmodel1boxed) + +record that stores validated Number payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| ClassModel1BoxedNumber(Number data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| Number | data()
validated payload | +| @Nullable Object | getData()
validated payload | + +## ClassModel1BoxedString +public record ClassModel1BoxedString
+implements [ClassModel1Boxed](#classmodel1boxed) + +record that stores validated String payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| ClassModel1BoxedString(String data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| String | data()
validated payload | +| @Nullable Object | getData()
validated payload | + +## ClassModel1BoxedList +public record ClassModel1BoxedList
+implements [ClassModel1Boxed](#classmodel1boxed) + +record that stores validated List payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| ClassModel1BoxedList(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 | + +## ClassModel1BoxedMap +public record ClassModel1BoxedMap
+implements [ClassModel1Boxed](#classmodel1boxed) + +record that stores validated Map payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| ClassModel1BoxedMap([ClassModelMap](#classmodelmap) data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| [ClassModelMap](#classmodelmap) | data()
validated payload | +| @Nullable Object | getData()
validated payload | + +## ClassModel1 +public static class ClassModel1
+extends JsonSchema + +A schema class that validates payloads + +## Description +Model for testing model with "_class" property + +### Field Summary +| Modifier and Type | Field and Description | +| ----------------- | ---------------------- | +| Map> | properties = Map.ofEntries(
    new PropertyEntry("_class", [ClassSchema.class](#classschema)))
)
| + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| String | validate(String arg, SchemaConfiguration configuration) | +| Nothing? | validate(Nothing? arg, SchemaConfiguration configuration) | +| int | validate(int arg, SchemaConfiguration configuration) | +| long | validate(long arg, SchemaConfiguration configuration) | +| float | validate(float arg, SchemaConfiguration configuration) | +| double | validate(double arg, SchemaConfiguration configuration) | +| Number | validate(Number arg, SchemaConfiguration configuration) | +| boolean | validate(boolean arg, SchemaConfiguration configuration) | +| [ClassModelMap](#classmodelmap) | validate([Map<?, ?>](#classmodelmapbuilder) arg, SchemaConfiguration configuration) | +| FrozenList<@Nullable Object> | validate(List arg, SchemaConfiguration configuration) | +| [ClassModel1BoxedString](#classmodel1boxedstring) | validateAndBox(String arg, SchemaConfiguration configuration) | +| [ClassModel1BoxedVoid](#classmodel1boxedvoid) | validateAndBox(Nothing? arg, SchemaConfiguration configuration) | +| [ClassModel1BoxedNumber](#classmodel1boxednumber) | validateAndBox(Number arg, SchemaConfiguration configuration) | +| [ClassModel1BoxedBoolean](#classmodel1boxedboolean) | validateAndBox(boolean arg, SchemaConfiguration configuration) | +| [ClassModel1BoxedMap](#classmodel1boxedmap) | validateAndBox([Map<?, ?>](#classmodelmapbuilder) arg, SchemaConfiguration configuration) | +| [ClassModel1BoxedList](#classmodel1boxedlist) | validateAndBox(List arg, SchemaConfiguration configuration) | +| [ClassModel1Boxed](#classmodel1boxed) | validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) | +| @Nullable Object | validate(@Nullable Object arg, SchemaConfiguration configuration) | + +## ClassModelMapBuilder +public class ClassModelMapBuilder
+builder for `Map` + +A class that builds the Map input type + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| ClassModelMapBuilder()
Creates a builder that contains an empty map | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| Map | build()
Returns map input that should be used with Schema.validate | +| [ClassModelMapBuilder](#classmodelmapbuilder) | lowLineClass(String value) | +| [ClassModelMapBuilder](#classmodelmapbuilder) | additionalProperty(String key, Nothing? value) | +| [ClassModelMapBuilder](#classmodelmapbuilder) | additionalProperty(String key, boolean value) | +| [ClassModelMapBuilder](#classmodelmapbuilder) | additionalProperty(String key, String value) | +| [ClassModelMapBuilder](#classmodelmapbuilder) | additionalProperty(String key, int value) | +| [ClassModelMapBuilder](#classmodelmapbuilder) | additionalProperty(String key, float value) | +| [ClassModelMapBuilder](#classmodelmapbuilder) | additionalProperty(String key, long value) | +| [ClassModelMapBuilder](#classmodelmapbuilder) | additionalProperty(String key, double value) | +| [ClassModelMapBuilder](#classmodelmapbuilder) | additionalProperty(String key, List value) | +| [ClassModelMapBuilder](#classmodelmapbuilder) | additionalProperty(String key, Map value) | + +## ClassModelMap +public static class ClassModelMap
+extends FrozenMap + +A class to store validated Map payloads + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| static [ClassModelMap](#classmodelmap) | of([Map](#classmodelmapbuilder) arg, SchemaConfiguration configuration) | +| @Nullable Object | get(String key)
This schema has invalid Java names so this method must be used when you access instance["_class"], | +| @Nullable Object | getAdditionalProperty(String name)
provides type safety for additional properties | + +## ClassSchemaBoxed +public sealed interface ClassSchemaBoxed
+permits
+[ClassSchemaBoxedString](#classschemaboxedstring) + +sealed interface that stores validated payloads using boxed classes + +## ClassSchemaBoxedString +public record ClassSchemaBoxedString
+implements [ClassSchemaBoxed](#classschemaboxed) + +record that stores validated String payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| ClassSchemaBoxedString(String data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| String | data()
validated payload | +| @Nullable Object | getData()
validated payload | + +## ClassSchema +public static class ClassSchema
+extends StringJsonSchema.StringJsonSchema1 + +A schema class that validates payloads + +| Methods Inherited from class org.openapijsonschematools.client.schemas.StringJsonSchema.StringJsonSchema1 | +| ------------------------------------------------------------------ | +| validate | +| validateAndBox | + +[[Back to top]](#top) [[Back to Component Schemas]](../../../README.md#Component-Schemas) [[Back to README]](../../../README.md) diff --git a/samples/client/petstore/kotlin/docs/components/schemas/Client.md b/samples/client/petstore/kotlin/docs/components/schemas/Client.md new file mode 100644 index 00000000000..41d2ebd6380 --- /dev/null +++ b/samples/client/petstore/kotlin/docs/components/schemas/Client.md @@ -0,0 +1,169 @@ +# Client +org.openapijsonschematools.client.components.schemas.Client.java +public class Client
+ +A class that contains necessary nested +- schema classes (which validate payloads), extends JsonSchema +- sealed interfaces which store validated payloads, java version of a sum type +- boxed classes which store validated payloads, sealed permits class implementations +- classes to store validated map payloads, extends FrozenMap +- classes to build inputs for map payloads + +## Nested Class Summary +| Modifier and Type | Class and Description | +| ----------------- | ---------------------- | +| sealed interface | [Client.Client1Boxed](#client1boxed)
sealed interface for validated payloads | +| record | [Client.Client1BoxedMap](#client1boxedmap)
boxed class to store validated Map payloads | +| static class | [Client.Client1](#client1)
schema class | +| static class | [Client.ClientMapBuilder1](#clientmapbuilder1)
builder for Map payloads | +| static class | [Client.ClientMap](#clientmap)
output class for Map payloads | +| sealed interface | [Client.Client2Boxed](#client2boxed)
sealed interface for validated payloads | +| record | [Client.Client2BoxedString](#client2boxedstring)
boxed class to store validated String payloads | +| static class | [Client.Client2](#client2)
schema class | + +## Client1Boxed +public sealed interface Client1Boxed
+permits
+[Client1BoxedMap](#client1boxedmap) + +sealed interface that stores validated payloads using boxed classes + +## Client1BoxedMap +public record Client1BoxedMap
+implements [Client1Boxed](#client1boxed) + +record that stores validated Map payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| Client1BoxedMap([ClientMap](#clientmap) data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| [ClientMap](#clientmap) | data()
validated payload | +| @Nullable Object | getData()
validated payload | + +## Client1 +public static class Client1
+extends JsonSchema + +A schema class that validates payloads + +### Code Sample +``` +import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags; +import org.openapijsonschematools.client.configurations.SchemaConfiguration; +import org.openapijsonschematools.client.exceptions.ValidationException; +import org.openapijsonschematools.client.schemas.validation.MapUtils; +import org.openapijsonschematools.client.schemas.validation.FrozenList; +import org.openapijsonschematools.client.schemas.validation.FrozenMap; +import org.openapijsonschematools.client.components.schemas.Client; + +import java.util.Arrays; +import java.util.List; +import java.util.AbstractMap; + +static final SchemaConfiguration configuration = new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().build()); + +// Map validation +Client.ClientMap validatedPayload = + Client.Client1.validate( + new Client.ClientMapBuilder1() + .client("a") + + .build(), + configuration +); +``` + +### Field Summary +| Modifier and Type | Field and Description | +| ----------------- | ---------------------- | +| Set> | type = Set.of(Map.class) | +| Map> | properties = Map.ofEntries(
    new PropertyEntry("client", [Client2.class](#client2)))
)
| + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| [ClientMap](#clientmap) | validate([Map<?, ?>](#clientmapbuilder1) arg, SchemaConfiguration configuration) | +| [Client1BoxedMap](#client1boxedmap) | validateAndBox([Map<?, ?>](#clientmapbuilder1) arg, SchemaConfiguration configuration) | +| [Client1Boxed](#client1boxed) | validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) | +| @Nullable Object | validate(@Nullable Object arg, SchemaConfiguration configuration) | + +## ClientMapBuilder1 +public class ClientMapBuilder1
+builder for `Map` + +A class that builds the Map input type + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| ClientMapBuilder1()
Creates a builder that contains an empty map | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| Map | build()
Returns map input that should be used with Schema.validate | +| [ClientMapBuilder1](#clientmapbuilder1) | client(String value) | +| [ClientMapBuilder1](#clientmapbuilder1) | additionalProperty(String key, Nothing? value) | +| [ClientMapBuilder1](#clientmapbuilder1) | additionalProperty(String key, boolean value) | +| [ClientMapBuilder1](#clientmapbuilder1) | additionalProperty(String key, String value) | +| [ClientMapBuilder1](#clientmapbuilder1) | additionalProperty(String key, int value) | +| [ClientMapBuilder1](#clientmapbuilder1) | additionalProperty(String key, float value) | +| [ClientMapBuilder1](#clientmapbuilder1) | additionalProperty(String key, long value) | +| [ClientMapBuilder1](#clientmapbuilder1) | additionalProperty(String key, double value) | +| [ClientMapBuilder1](#clientmapbuilder1) | additionalProperty(String key, List value) | +| [ClientMapBuilder1](#clientmapbuilder1) | additionalProperty(String key, Map value) | + +## ClientMap +public static class ClientMap
+extends FrozenMap + +A class to store validated Map payloads + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| static [ClientMap](#clientmap) | of([Map](#clientmapbuilder1) arg, SchemaConfiguration configuration) | +| String | client()
[optional] | +| @Nullable Object | getAdditionalProperty(String name)
provides type safety for additional properties | + +## Client2Boxed +public sealed interface Client2Boxed
+permits
+[Client2BoxedString](#client2boxedstring) + +sealed interface that stores validated payloads using boxed classes + +## Client2BoxedString +public record Client2BoxedString
+implements [Client2Boxed](#client2boxed) + +record that stores validated String payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| Client2BoxedString(String data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| String | data()
validated payload | +| @Nullable Object | getData()
validated payload | + +## Client2 +public static class Client2
+extends StringJsonSchema.StringJsonSchema1 + +A schema class that validates payloads + +| Methods Inherited from class org.openapijsonschematools.client.schemas.StringJsonSchema.StringJsonSchema1 | +| ------------------------------------------------------------------ | +| validate | +| validateAndBox | + +[[Back to top]](#top) [[Back to Component Schemas]](../../../README.md#Component-Schemas) [[Back to README]](../../../README.md) diff --git a/samples/client/petstore/kotlin/docs/components/schemas/ComplexQuadrilateral.md b/samples/client/petstore/kotlin/docs/components/schemas/ComplexQuadrilateral.md new file mode 100644 index 00000000000..378f2be1679 --- /dev/null +++ b/samples/client/petstore/kotlin/docs/components/schemas/ComplexQuadrilateral.md @@ -0,0 +1,371 @@ +# ComplexQuadrilateral +org.openapijsonschematools.client.components.schemas.ComplexQuadrilateral.java +public class ComplexQuadrilateral
+ +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 | [ComplexQuadrilateral.ComplexQuadrilateral1Boxed](#complexquadrilateral1boxed)
sealed interface for validated payloads | +| record | [ComplexQuadrilateral.ComplexQuadrilateral1BoxedVoid](#complexquadrilateral1boxedvoid)
boxed class to store validated null payloads | +| record | [ComplexQuadrilateral.ComplexQuadrilateral1BoxedBoolean](#complexquadrilateral1boxedboolean)
boxed class to store validated boolean payloads | +| record | [ComplexQuadrilateral.ComplexQuadrilateral1BoxedNumber](#complexquadrilateral1boxednumber)
boxed class to store validated Number payloads | +| record | [ComplexQuadrilateral.ComplexQuadrilateral1BoxedString](#complexquadrilateral1boxedstring)
boxed class to store validated String payloads | +| record | [ComplexQuadrilateral.ComplexQuadrilateral1BoxedList](#complexquadrilateral1boxedlist)
boxed class to store validated List payloads | +| record | [ComplexQuadrilateral.ComplexQuadrilateral1BoxedMap](#complexquadrilateral1boxedmap)
boxed class to store validated Map payloads | +| static class | [ComplexQuadrilateral.ComplexQuadrilateral1](#complexquadrilateral1)
schema class | +| sealed interface | [ComplexQuadrilateral.Schema1Boxed](#schema1boxed)
sealed interface for validated payloads | +| record | [ComplexQuadrilateral.Schema1BoxedMap](#schema1boxedmap)
boxed class to store validated Map payloads | +| static class | [ComplexQuadrilateral.Schema1](#schema1)
schema class | +| static class | [ComplexQuadrilateral.Schema1MapBuilder](#schema1mapbuilder)
builder for Map payloads | +| static class | [ComplexQuadrilateral.Schema1Map](#schema1map)
output class for Map payloads | +| sealed interface | [ComplexQuadrilateral.QuadrilateralTypeBoxed](#quadrilateraltypeboxed)
sealed interface for validated payloads | +| record | [ComplexQuadrilateral.QuadrilateralTypeBoxedString](#quadrilateraltypeboxedstring)
boxed class to store validated String payloads | +| static class | [ComplexQuadrilateral.QuadrilateralType](#quadrilateraltype)
schema class | +| enum | [ComplexQuadrilateral.StringQuadrilateralTypeEnums](#stringquadrilateraltypeenums)
String enum | + +## ComplexQuadrilateral1Boxed +public sealed interface ComplexQuadrilateral1Boxed
+permits
+[ComplexQuadrilateral1BoxedVoid](#complexquadrilateral1boxedvoid), +[ComplexQuadrilateral1BoxedBoolean](#complexquadrilateral1boxedboolean), +[ComplexQuadrilateral1BoxedNumber](#complexquadrilateral1boxednumber), +[ComplexQuadrilateral1BoxedString](#complexquadrilateral1boxedstring), +[ComplexQuadrilateral1BoxedList](#complexquadrilateral1boxedlist), +[ComplexQuadrilateral1BoxedMap](#complexquadrilateral1boxedmap) + +sealed interface that stores validated payloads using boxed classes + +## ComplexQuadrilateral1BoxedVoid +public record ComplexQuadrilateral1BoxedVoid
+implements [ComplexQuadrilateral1Boxed](#complexquadrilateral1boxed) + +record that stores validated null payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| ComplexQuadrilateral1BoxedVoid(Nothing? data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| Nothing? | data()
validated payload | +| @Nullable Object | getData()
validated payload | + +## ComplexQuadrilateral1BoxedBoolean +public record ComplexQuadrilateral1BoxedBoolean
+implements [ComplexQuadrilateral1Boxed](#complexquadrilateral1boxed) + +record that stores validated boolean payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| ComplexQuadrilateral1BoxedBoolean(boolean data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| boolean | data()
validated payload | +| @Nullable Object | getData()
validated payload | + +## ComplexQuadrilateral1BoxedNumber +public record ComplexQuadrilateral1BoxedNumber
+implements [ComplexQuadrilateral1Boxed](#complexquadrilateral1boxed) + +record that stores validated Number payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| ComplexQuadrilateral1BoxedNumber(Number data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| Number | data()
validated payload | +| @Nullable Object | getData()
validated payload | + +## ComplexQuadrilateral1BoxedString +public record ComplexQuadrilateral1BoxedString
+implements [ComplexQuadrilateral1Boxed](#complexquadrilateral1boxed) + +record that stores validated String payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| ComplexQuadrilateral1BoxedString(String data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| String | data()
validated payload | +| @Nullable Object | getData()
validated payload | + +## ComplexQuadrilateral1BoxedList +public record ComplexQuadrilateral1BoxedList
+implements [ComplexQuadrilateral1Boxed](#complexquadrilateral1boxed) + +record that stores validated List payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| ComplexQuadrilateral1BoxedList(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 | + +## ComplexQuadrilateral1BoxedMap +public record ComplexQuadrilateral1BoxedMap
+implements [ComplexQuadrilateral1Boxed](#complexquadrilateral1boxed) + +record that stores validated Map payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| ComplexQuadrilateral1BoxedMap(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 | + +## ComplexQuadrilateral1 +public static class ComplexQuadrilateral1
+extends JsonSchema + +A schema class that validates payloads + +### Field Summary +| Modifier and Type | Field and Description | +| ----------------- | ---------------------- | +| List> | allOf = List.of(
    [QuadrilateralInterface.QuadrilateralInterface1.class](../../components/schemas/QuadrilateralInterface.md#quadrilateralinterface1),
    [Schema1.class](#schema1)
;)
| + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| String | validate(String arg, SchemaConfiguration configuration) | +| Nothing? | validate(Nothing? arg, SchemaConfiguration configuration) | +| int | validate(int arg, SchemaConfiguration configuration) | +| long | validate(long arg, SchemaConfiguration configuration) | +| float | validate(float arg, SchemaConfiguration configuration) | +| double | validate(double arg, SchemaConfiguration configuration) | +| Number | validate(Number arg, SchemaConfiguration configuration) | +| boolean | validate(boolean arg, SchemaConfiguration configuration) | +| FrozenMap<@Nullable Object> | validate(Map<?, ?> arg, SchemaConfiguration configuration) | +| FrozenList<@Nullable Object> | validate(List arg, SchemaConfiguration configuration) | +| [ComplexQuadrilateral1BoxedString](#complexquadrilateral1boxedstring) | validateAndBox(String arg, SchemaConfiguration configuration) | +| [ComplexQuadrilateral1BoxedVoid](#complexquadrilateral1boxedvoid) | validateAndBox(Nothing? arg, SchemaConfiguration configuration) | +| [ComplexQuadrilateral1BoxedNumber](#complexquadrilateral1boxednumber) | validateAndBox(Number arg, SchemaConfiguration configuration) | +| [ComplexQuadrilateral1BoxedBoolean](#complexquadrilateral1boxedboolean) | validateAndBox(boolean arg, SchemaConfiguration configuration) | +| [ComplexQuadrilateral1BoxedMap](#complexquadrilateral1boxedmap) | validateAndBox(Map<?, ?> arg, SchemaConfiguration configuration) | +| [ComplexQuadrilateral1BoxedList](#complexquadrilateral1boxedlist) | validateAndBox(List arg, SchemaConfiguration configuration) | +| [ComplexQuadrilateral1Boxed](#complexquadrilateral1boxed) | validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) | +| @Nullable Object | validate(@Nullable Object arg, SchemaConfiguration configuration) | + +## Schema1Boxed +public sealed interface Schema1Boxed
+permits
+[Schema1BoxedMap](#schema1boxedmap) + +sealed interface that stores validated payloads using boxed classes + +## Schema1BoxedMap +public record Schema1BoxedMap
+implements [Schema1Boxed](#schema1boxed) + +record that stores validated Map payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| Schema1BoxedMap([Schema1Map](#schema1map) data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| [Schema1Map](#schema1map) | data()
validated payload | +| @Nullable Object | getData()
validated payload | + +## Schema1 +public static class Schema1
+extends JsonSchema + +A schema class that validates payloads + +### Code Sample +``` +import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags; +import org.openapijsonschematools.client.configurations.SchemaConfiguration; +import org.openapijsonschematools.client.exceptions.ValidationException; +import org.openapijsonschematools.client.schemas.validation.MapUtils; +import org.openapijsonschematools.client.schemas.validation.FrozenList; +import org.openapijsonschematools.client.schemas.validation.FrozenMap; +import org.openapijsonschematools.client.components.schemas.ComplexQuadrilateral; + +import java.util.Arrays; +import java.util.List; +import java.util.AbstractMap; + +static final SchemaConfiguration configuration = new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().build()); + +// Map validation +ComplexQuadrilateral.Schema1Map validatedPayload = + ComplexQuadrilateral.Schema1.validate( + new ComplexQuadrilateral.Schema1MapBuilder() + .quadrilateralType("ComplexQuadrilateral") + + .build(), + configuration +); +``` + +### Field Summary +| Modifier and Type | Field and Description | +| ----------------- | ---------------------- | +| Set> | type = Set.of(Map.class) | +| Map> | properties = Map.ofEntries(
    new PropertyEntry("quadrilateralType", [QuadrilateralType.class](#quadrilateraltype)))
)
| + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| [Schema1Map](#schema1map) | validate([Map<?, ?>](#schema1mapbuilder) arg, SchemaConfiguration configuration) | +| [Schema1BoxedMap](#schema1boxedmap) | validateAndBox([Map<?, ?>](#schema1mapbuilder) arg, SchemaConfiguration configuration) | +| [Schema1Boxed](#schema1boxed) | validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) | +| @Nullable Object | validate(@Nullable Object arg, SchemaConfiguration configuration) | + +## Schema1MapBuilder +public class Schema1MapBuilder
+builder for `Map` + +A class that builds the Map input type + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| Schema1MapBuilder()
Creates a builder that contains an empty map | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| Map | build()
Returns map input that should be used with Schema.validate | +| [Schema1MapBuilder](#schema1mapbuilder) | quadrilateralType(String value) | +| [Schema1MapBuilder](#schema1mapbuilder) | quadrilateralType([StringQuadrilateralTypeEnums](#stringquadrilateraltypeenums) value) | +| [Schema1MapBuilder](#schema1mapbuilder) | additionalProperty(String key, Nothing? value) | +| [Schema1MapBuilder](#schema1mapbuilder) | additionalProperty(String key, boolean value) | +| [Schema1MapBuilder](#schema1mapbuilder) | additionalProperty(String key, String value) | +| [Schema1MapBuilder](#schema1mapbuilder) | additionalProperty(String key, int value) | +| [Schema1MapBuilder](#schema1mapbuilder) | additionalProperty(String key, float value) | +| [Schema1MapBuilder](#schema1mapbuilder) | additionalProperty(String key, long value) | +| [Schema1MapBuilder](#schema1mapbuilder) | additionalProperty(String key, double value) | +| [Schema1MapBuilder](#schema1mapbuilder) | additionalProperty(String key, List value) | +| [Schema1MapBuilder](#schema1mapbuilder) | additionalProperty(String key, Map value) | + +## Schema1Map +public static class Schema1Map
+extends FrozenMap + +A class to store validated Map payloads + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| static [Schema1Map](#schema1map) | of([Map](#schema1mapbuilder) arg, SchemaConfiguration configuration) | +| String | quadrilateralType()
[optional] must be one of ["ComplexQuadrilateral"] | +| @Nullable Object | getAdditionalProperty(String name)
provides type safety for additional properties | + +## QuadrilateralTypeBoxed +public sealed interface QuadrilateralTypeBoxed
+permits
+[QuadrilateralTypeBoxedString](#quadrilateraltypeboxedstring) + +sealed interface that stores validated payloads using boxed classes + +## QuadrilateralTypeBoxedString +public record QuadrilateralTypeBoxedString
+implements [QuadrilateralTypeBoxed](#quadrilateraltypeboxed) + +record that stores validated String payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| QuadrilateralTypeBoxedString(String data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| String | data()
validated payload | +| @Nullable Object | getData()
validated payload | + +## QuadrilateralType +public static class QuadrilateralType
+extends JsonSchema + +A schema class that validates payloads + +### Code Sample +``` +import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags; +import org.openapijsonschematools.client.configurations.SchemaConfiguration; +import org.openapijsonschematools.client.exceptions.ValidationException; +import org.openapijsonschematools.client.schemas.validation.MapUtils; +import org.openapijsonschematools.client.schemas.validation.FrozenList; +import org.openapijsonschematools.client.schemas.validation.FrozenMap; +import org.openapijsonschematools.client.components.schemas.ComplexQuadrilateral; + +import java.util.Arrays; +import java.util.List; +import java.util.AbstractMap; + +static final SchemaConfiguration configuration = new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().build()); + +// String validation +String validatedPayload = ComplexQuadrilateral.QuadrilateralType.validate( + "ComplexQuadrilateral", + configuration +); +``` + +### Field Summary +| Modifier and Type | Field and Description | +| ----------------- | ---------------------- | +| Set> | type = Set.of(
    String.class
)
| +| Set | enumValues = SetMaker.makeSet(
    "ComplexQuadrilateral"
)
| + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| String | validate(String arg, SchemaConfiguration configuration) | +| String | validate([StringQuadrilateralTypeEnums](#stringquadrilateraltypeenums) arg, SchemaConfiguration configuration) | +| [QuadrilateralTypeBoxedString](#quadrilateraltypeboxedstring) | validateAndBox(String arg, SchemaConfiguration configuration) | +| [QuadrilateralTypeBoxed](#quadrilateraltypeboxed) | validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) | +| @Nullable Object | validate(@Nullable Object arg, SchemaConfiguration configuration) | + +## StringQuadrilateralTypeEnums +public enum StringQuadrilateralTypeEnums
+extends `Enum` + +A class that stores String enum values + +### Enum Constant Summary +| Enum Constant | Description | +| ------------- | ----------- | +| COMPLEX_QUADRILATERAL | value = "ComplexQuadrilateral" | + +[[Back to top]](#top) [[Back to Component Schemas]](../../../README.md#Component-Schemas) [[Back to README]](../../../README.md) diff --git a/samples/client/petstore/kotlin/docs/components/schemas/ComposedAnyOfDifferentTypesNoValidations.md b/samples/client/petstore/kotlin/docs/components/schemas/ComposedAnyOfDifferentTypesNoValidations.md new file mode 100644 index 00000000000..4b7d5f8db06 --- /dev/null +++ b/samples/client/petstore/kotlin/docs/components/schemas/ComposedAnyOfDifferentTypesNoValidations.md @@ -0,0 +1,956 @@ +# ComposedAnyOfDifferentTypesNoValidations +org.openapijsonschematools.client.components.schemas.ComposedAnyOfDifferentTypesNoValidations.java +public class ComposedAnyOfDifferentTypesNoValidations
+ +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 list payloads, extends FrozenList +- classes to build inputs for list payloads + +## Nested Class Summary +| Modifier and Type | Class and Description | +| ----------------- | ---------------------- | +| sealed interface | [ComposedAnyOfDifferentTypesNoValidations.ComposedAnyOfDifferentTypesNoValidations1Boxed](#composedanyofdifferenttypesnovalidations1boxed)
sealed interface for validated payloads | +| record | [ComposedAnyOfDifferentTypesNoValidations.ComposedAnyOfDifferentTypesNoValidations1BoxedVoid](#composedanyofdifferenttypesnovalidations1boxedvoid)
boxed class to store validated null payloads | +| record | [ComposedAnyOfDifferentTypesNoValidations.ComposedAnyOfDifferentTypesNoValidations1BoxedBoolean](#composedanyofdifferenttypesnovalidations1boxedboolean)
boxed class to store validated boolean payloads | +| record | [ComposedAnyOfDifferentTypesNoValidations.ComposedAnyOfDifferentTypesNoValidations1BoxedNumber](#composedanyofdifferenttypesnovalidations1boxednumber)
boxed class to store validated Number payloads | +| record | [ComposedAnyOfDifferentTypesNoValidations.ComposedAnyOfDifferentTypesNoValidations1BoxedString](#composedanyofdifferenttypesnovalidations1boxedstring)
boxed class to store validated String payloads | +| record | [ComposedAnyOfDifferentTypesNoValidations.ComposedAnyOfDifferentTypesNoValidations1BoxedList](#composedanyofdifferenttypesnovalidations1boxedlist)
boxed class to store validated List payloads | +| record | [ComposedAnyOfDifferentTypesNoValidations.ComposedAnyOfDifferentTypesNoValidations1BoxedMap](#composedanyofdifferenttypesnovalidations1boxedmap)
boxed class to store validated Map payloads | +| static class | [ComposedAnyOfDifferentTypesNoValidations.ComposedAnyOfDifferentTypesNoValidations1](#composedanyofdifferenttypesnovalidations1)
schema class | +| sealed interface | [ComposedAnyOfDifferentTypesNoValidations.Schema15Boxed](#schema15boxed)
sealed interface for validated payloads | +| record | [ComposedAnyOfDifferentTypesNoValidations.Schema15BoxedNumber](#schema15boxednumber)
boxed class to store validated Number payloads | +| static class | [ComposedAnyOfDifferentTypesNoValidations.Schema15](#schema15)
schema class | +| sealed interface | [ComposedAnyOfDifferentTypesNoValidations.Schema14Boxed](#schema14boxed)
sealed interface for validated payloads | +| record | [ComposedAnyOfDifferentTypesNoValidations.Schema14BoxedNumber](#schema14boxednumber)
boxed class to store validated Number payloads | +| static class | [ComposedAnyOfDifferentTypesNoValidations.Schema14](#schema14)
schema class | +| sealed interface | [ComposedAnyOfDifferentTypesNoValidations.Schema13Boxed](#schema13boxed)
sealed interface for validated payloads | +| record | [ComposedAnyOfDifferentTypesNoValidations.Schema13BoxedNumber](#schema13boxednumber)
boxed class to store validated Number payloads | +| static class | [ComposedAnyOfDifferentTypesNoValidations.Schema13](#schema13)
schema class | +| sealed interface | [ComposedAnyOfDifferentTypesNoValidations.Schema12Boxed](#schema12boxed)
sealed interface for validated payloads | +| record | [ComposedAnyOfDifferentTypesNoValidations.Schema12BoxedNumber](#schema12boxednumber)
boxed class to store validated Number payloads | +| static class | [ComposedAnyOfDifferentTypesNoValidations.Schema12](#schema12)
schema class | +| sealed interface | [ComposedAnyOfDifferentTypesNoValidations.Schema11Boxed](#schema11boxed)
sealed interface for validated payloads | +| record | [ComposedAnyOfDifferentTypesNoValidations.Schema11BoxedNumber](#schema11boxednumber)
boxed class to store validated Number payloads | +| static class | [ComposedAnyOfDifferentTypesNoValidations.Schema11](#schema11)
schema class | +| sealed interface | [ComposedAnyOfDifferentTypesNoValidations.Schema10Boxed](#schema10boxed)
sealed interface for validated payloads | +| record | [ComposedAnyOfDifferentTypesNoValidations.Schema10BoxedNumber](#schema10boxednumber)
boxed class to store validated Number payloads | +| static class | [ComposedAnyOfDifferentTypesNoValidations.Schema10](#schema10)
schema class | +| sealed interface | [ComposedAnyOfDifferentTypesNoValidations.Schema9Boxed](#schema9boxed)
sealed interface for validated payloads | +| record | [ComposedAnyOfDifferentTypesNoValidations.Schema9BoxedList](#schema9boxedlist)
boxed class to store validated List payloads | +| static class | [ComposedAnyOfDifferentTypesNoValidations.Schema9](#schema9)
schema class | +| static class | [ComposedAnyOfDifferentTypesNoValidations.Schema9ListBuilder](#schema9listbuilder)
builder for List payloads | +| static class | [ComposedAnyOfDifferentTypesNoValidations.Schema9List](#schema9list)
output class for List payloads | +| sealed interface | [ComposedAnyOfDifferentTypesNoValidations.ItemsBoxed](#itemsboxed)
sealed interface for validated payloads | +| record | [ComposedAnyOfDifferentTypesNoValidations.ItemsBoxedVoid](#itemsboxedvoid)
boxed class to store validated null payloads | +| record | [ComposedAnyOfDifferentTypesNoValidations.ItemsBoxedBoolean](#itemsboxedboolean)
boxed class to store validated boolean payloads | +| record | [ComposedAnyOfDifferentTypesNoValidations.ItemsBoxedNumber](#itemsboxednumber)
boxed class to store validated Number payloads | +| record | [ComposedAnyOfDifferentTypesNoValidations.ItemsBoxedString](#itemsboxedstring)
boxed class to store validated String payloads | +| record | [ComposedAnyOfDifferentTypesNoValidations.ItemsBoxedList](#itemsboxedlist)
boxed class to store validated List payloads | +| record | [ComposedAnyOfDifferentTypesNoValidations.ItemsBoxedMap](#itemsboxedmap)
boxed class to store validated Map payloads | +| static class | [ComposedAnyOfDifferentTypesNoValidations.Items](#items)
schema class | +| sealed interface | [ComposedAnyOfDifferentTypesNoValidations.Schema8Boxed](#schema8boxed)
sealed interface for validated payloads | +| record | [ComposedAnyOfDifferentTypesNoValidations.Schema8BoxedVoid](#schema8boxedvoid)
boxed class to store validated null payloads | +| static class | [ComposedAnyOfDifferentTypesNoValidations.Schema8](#schema8)
schema class | +| sealed interface | [ComposedAnyOfDifferentTypesNoValidations.Schema7Boxed](#schema7boxed)
sealed interface for validated payloads | +| record | [ComposedAnyOfDifferentTypesNoValidations.Schema7BoxedBoolean](#schema7boxedboolean)
boxed class to store validated boolean payloads | +| static class | [ComposedAnyOfDifferentTypesNoValidations.Schema7](#schema7)
schema class | +| sealed interface | [ComposedAnyOfDifferentTypesNoValidations.Schema6Boxed](#schema6boxed)
sealed interface for validated payloads | +| record | [ComposedAnyOfDifferentTypesNoValidations.Schema6BoxedMap](#schema6boxedmap)
boxed class to store validated Map payloads | +| static class | [ComposedAnyOfDifferentTypesNoValidations.Schema6](#schema6)
schema class | +| sealed interface | [ComposedAnyOfDifferentTypesNoValidations.Schema5Boxed](#schema5boxed)
sealed interface for validated payloads | +| record | [ComposedAnyOfDifferentTypesNoValidations.Schema5BoxedString](#schema5boxedstring)
boxed class to store validated String payloads | +| static class | [ComposedAnyOfDifferentTypesNoValidations.Schema5](#schema5)
schema class | +| sealed interface | [ComposedAnyOfDifferentTypesNoValidations.Schema4Boxed](#schema4boxed)
sealed interface for validated payloads | +| record | [ComposedAnyOfDifferentTypesNoValidations.Schema4BoxedString](#schema4boxedstring)
boxed class to store validated String payloads | +| static class | [ComposedAnyOfDifferentTypesNoValidations.Schema4](#schema4)
schema class | +| sealed interface | [ComposedAnyOfDifferentTypesNoValidations.Schema3Boxed](#schema3boxed)
sealed interface for validated payloads | +| static class | [ComposedAnyOfDifferentTypesNoValidations.Schema3](#schema3)
schema class | +| sealed interface | [ComposedAnyOfDifferentTypesNoValidations.Schema2Boxed](#schema2boxed)
sealed interface for validated payloads | +| record | [ComposedAnyOfDifferentTypesNoValidations.Schema2BoxedString](#schema2boxedstring)
boxed class to store validated String payloads | +| static class | [ComposedAnyOfDifferentTypesNoValidations.Schema2](#schema2)
schema class | +| sealed interface | [ComposedAnyOfDifferentTypesNoValidations.Schema1Boxed](#schema1boxed)
sealed interface for validated payloads | +| record | [ComposedAnyOfDifferentTypesNoValidations.Schema1BoxedString](#schema1boxedstring)
boxed class to store validated String payloads | +| static class | [ComposedAnyOfDifferentTypesNoValidations.Schema1](#schema1)
schema class | +| sealed interface | [ComposedAnyOfDifferentTypesNoValidations.Schema0Boxed](#schema0boxed)
sealed interface for validated payloads | +| record | [ComposedAnyOfDifferentTypesNoValidations.Schema0BoxedMap](#schema0boxedmap)
boxed class to store validated Map payloads | +| static class | [ComposedAnyOfDifferentTypesNoValidations.Schema0](#schema0)
schema class | + +## ComposedAnyOfDifferentTypesNoValidations1Boxed +public sealed interface ComposedAnyOfDifferentTypesNoValidations1Boxed
+permits
+[ComposedAnyOfDifferentTypesNoValidations1BoxedVoid](#composedanyofdifferenttypesnovalidations1boxedvoid), +[ComposedAnyOfDifferentTypesNoValidations1BoxedBoolean](#composedanyofdifferenttypesnovalidations1boxedboolean), +[ComposedAnyOfDifferentTypesNoValidations1BoxedNumber](#composedanyofdifferenttypesnovalidations1boxednumber), +[ComposedAnyOfDifferentTypesNoValidations1BoxedString](#composedanyofdifferenttypesnovalidations1boxedstring), +[ComposedAnyOfDifferentTypesNoValidations1BoxedList](#composedanyofdifferenttypesnovalidations1boxedlist), +[ComposedAnyOfDifferentTypesNoValidations1BoxedMap](#composedanyofdifferenttypesnovalidations1boxedmap) + +sealed interface that stores validated payloads using boxed classes + +## ComposedAnyOfDifferentTypesNoValidations1BoxedVoid +public record ComposedAnyOfDifferentTypesNoValidations1BoxedVoid
+implements [ComposedAnyOfDifferentTypesNoValidations1Boxed](#composedanyofdifferenttypesnovalidations1boxed) + +record that stores validated null payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| ComposedAnyOfDifferentTypesNoValidations1BoxedVoid(Nothing? data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| Nothing? | data()
validated payload | +| @Nullable Object | getData()
validated payload | + +## ComposedAnyOfDifferentTypesNoValidations1BoxedBoolean +public record ComposedAnyOfDifferentTypesNoValidations1BoxedBoolean
+implements [ComposedAnyOfDifferentTypesNoValidations1Boxed](#composedanyofdifferenttypesnovalidations1boxed) + +record that stores validated boolean payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| ComposedAnyOfDifferentTypesNoValidations1BoxedBoolean(boolean data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| boolean | data()
validated payload | +| @Nullable Object | getData()
validated payload | + +## ComposedAnyOfDifferentTypesNoValidations1BoxedNumber +public record ComposedAnyOfDifferentTypesNoValidations1BoxedNumber
+implements [ComposedAnyOfDifferentTypesNoValidations1Boxed](#composedanyofdifferenttypesnovalidations1boxed) + +record that stores validated Number payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| ComposedAnyOfDifferentTypesNoValidations1BoxedNumber(Number data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| Number | data()
validated payload | +| @Nullable Object | getData()
validated payload | + +## ComposedAnyOfDifferentTypesNoValidations1BoxedString +public record ComposedAnyOfDifferentTypesNoValidations1BoxedString
+implements [ComposedAnyOfDifferentTypesNoValidations1Boxed](#composedanyofdifferenttypesnovalidations1boxed) + +record that stores validated String payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| ComposedAnyOfDifferentTypesNoValidations1BoxedString(String data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| String | data()
validated payload | +| @Nullable Object | getData()
validated payload | + +## ComposedAnyOfDifferentTypesNoValidations1BoxedList +public record ComposedAnyOfDifferentTypesNoValidations1BoxedList
+implements [ComposedAnyOfDifferentTypesNoValidations1Boxed](#composedanyofdifferenttypesnovalidations1boxed) + +record that stores validated List payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| ComposedAnyOfDifferentTypesNoValidations1BoxedList(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 | + +## ComposedAnyOfDifferentTypesNoValidations1BoxedMap +public record ComposedAnyOfDifferentTypesNoValidations1BoxedMap
+implements [ComposedAnyOfDifferentTypesNoValidations1Boxed](#composedanyofdifferenttypesnovalidations1boxed) + +record that stores validated Map payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| ComposedAnyOfDifferentTypesNoValidations1BoxedMap(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 | + +## ComposedAnyOfDifferentTypesNoValidations1 +public static class ComposedAnyOfDifferentTypesNoValidations1
+extends JsonSchema + +A schema class that validates payloads + +### Field Summary +| Modifier and Type | Field and Description | +| ----------------- | ---------------------- | +| List> | anyOf = List.of(
    [Schema0.class](#schema0),
    [Schema1.class](#schema1),
    [Schema2.class](#schema2),
    [Schema3.class](#schema3),
    [Schema4.class](#schema4),
    [Schema5.class](#schema5),
    [Schema6.class](#schema6),
    [Schema7.class](#schema7),
    [Schema8.class](#schema8),
    [Schema9.class](#schema9),
    [Schema10.class](#schema10),
    [Schema11.class](#schema11),
    [Schema12.class](#schema12),
    [Schema13.class](#schema13),
    [Schema14.class](#schema14),
    [Schema15.class](#schema15)
)
| + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| String | validate(String arg, SchemaConfiguration configuration) | +| Nothing? | validate(Nothing? arg, SchemaConfiguration configuration) | +| int | validate(int arg, SchemaConfiguration configuration) | +| long | validate(long arg, SchemaConfiguration configuration) | +| float | validate(float arg, SchemaConfiguration configuration) | +| double | validate(double arg, SchemaConfiguration configuration) | +| Number | validate(Number arg, SchemaConfiguration configuration) | +| boolean | validate(boolean arg, SchemaConfiguration configuration) | +| FrozenMap<@Nullable Object> | validate(Map<?, ?> arg, SchemaConfiguration configuration) | +| FrozenList<@Nullable Object> | validate(List arg, SchemaConfiguration configuration) | +| [ComposedAnyOfDifferentTypesNoValidations1BoxedString](#composedanyofdifferenttypesnovalidations1boxedstring) | validateAndBox(String arg, SchemaConfiguration configuration) | +| [ComposedAnyOfDifferentTypesNoValidations1BoxedVoid](#composedanyofdifferenttypesnovalidations1boxedvoid) | validateAndBox(Nothing? arg, SchemaConfiguration configuration) | +| [ComposedAnyOfDifferentTypesNoValidations1BoxedNumber](#composedanyofdifferenttypesnovalidations1boxednumber) | validateAndBox(Number arg, SchemaConfiguration configuration) | +| [ComposedAnyOfDifferentTypesNoValidations1BoxedBoolean](#composedanyofdifferenttypesnovalidations1boxedboolean) | validateAndBox(boolean arg, SchemaConfiguration configuration) | +| [ComposedAnyOfDifferentTypesNoValidations1BoxedMap](#composedanyofdifferenttypesnovalidations1boxedmap) | validateAndBox(Map<?, ?> arg, SchemaConfiguration configuration) | +| [ComposedAnyOfDifferentTypesNoValidations1BoxedList](#composedanyofdifferenttypesnovalidations1boxedlist) | validateAndBox(List arg, SchemaConfiguration configuration) | +| [ComposedAnyOfDifferentTypesNoValidations1Boxed](#composedanyofdifferenttypesnovalidations1boxed) | validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) | +| @Nullable Object | validate(@Nullable Object arg, SchemaConfiguration configuration) | + +## Schema15Boxed +public sealed interface Schema15Boxed
+permits
+[Schema15BoxedNumber](#schema15boxednumber) + +sealed interface that stores validated payloads using boxed classes + +## Schema15BoxedNumber +public record Schema15BoxedNumber
+implements [Schema15Boxed](#schema15boxed) + +record that stores validated Number payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| Schema15BoxedNumber(Number data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| Number | data()
validated payload | +| @Nullable Object | getData()
validated payload | + +## Schema15 +public static class Schema15
+extends Int64JsonSchema.Int64JsonSchema1 + +A schema class that validates payloads + +| Methods Inherited from class org.openapijsonschematools.client.schemas.Int64JsonSchema.Int64JsonSchema1 | +| ------------------------------------------------------------------ | +| validate | +| validateAndBox | + +## Schema14Boxed +public sealed interface Schema14Boxed
+permits
+[Schema14BoxedNumber](#schema14boxednumber) + +sealed interface that stores validated payloads using boxed classes + +## Schema14BoxedNumber +public record Schema14BoxedNumber
+implements [Schema14Boxed](#schema14boxed) + +record that stores validated Number payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| Schema14BoxedNumber(Number data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| Number | data()
validated payload | +| @Nullable Object | getData()
validated payload | + +## Schema14 +public static class Schema14
+extends Int32JsonSchema.Int32JsonSchema1 + +A schema class that validates payloads + +| Methods Inherited from class org.openapijsonschematools.client.schemas.Int32JsonSchema.Int32JsonSchema1 | +| ------------------------------------------------------------------ | +| validate | +| validateAndBox | + +## Schema13Boxed +public sealed interface Schema13Boxed
+permits
+[Schema13BoxedNumber](#schema13boxednumber) + +sealed interface that stores validated payloads using boxed classes + +## Schema13BoxedNumber +public record Schema13BoxedNumber
+implements [Schema13Boxed](#schema13boxed) + +record that stores validated Number payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| Schema13BoxedNumber(Number data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| Number | data()
validated payload | +| @Nullable Object | getData()
validated payload | + +## Schema13 +public static class Schema13
+extends IntJsonSchema.IntJsonSchema1 + +A schema class that validates payloads + +| Methods Inherited from class org.openapijsonschematools.client.schemas.IntJsonSchema.IntJsonSchema1 | +| ------------------------------------------------------------------ | +| validate | +| validateAndBox | + +## Schema12Boxed +public sealed interface Schema12Boxed
+permits
+[Schema12BoxedNumber](#schema12boxednumber) + +sealed interface that stores validated payloads using boxed classes + +## Schema12BoxedNumber +public record Schema12BoxedNumber
+implements [Schema12Boxed](#schema12boxed) + +record that stores validated Number payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| Schema12BoxedNumber(Number data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| Number | data()
validated payload | +| @Nullable Object | getData()
validated payload | + +## Schema12 +public static class Schema12
+extends DoubleJsonSchema.DoubleJsonSchema1 + +A schema class that validates payloads + +| Methods Inherited from class org.openapijsonschematools.client.schemas.DoubleJsonSchema.DoubleJsonSchema1 | +| ------------------------------------------------------------------ | +| validate | +| validateAndBox | + +## Schema11Boxed +public sealed interface Schema11Boxed
+permits
+[Schema11BoxedNumber](#schema11boxednumber) + +sealed interface that stores validated payloads using boxed classes + +## Schema11BoxedNumber +public record Schema11BoxedNumber
+implements [Schema11Boxed](#schema11boxed) + +record that stores validated Number payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| Schema11BoxedNumber(Number data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| Number | data()
validated payload | +| @Nullable Object | getData()
validated payload | + +## Schema11 +public static class Schema11
+extends FloatJsonSchema.FloatJsonSchema1 + +A schema class that validates payloads + +| Methods Inherited from class org.openapijsonschematools.client.schemas.FloatJsonSchema.FloatJsonSchema1 | +| ------------------------------------------------------------------ | +| validate | +| validateAndBox | + +## Schema10Boxed +public sealed interface Schema10Boxed
+permits
+[Schema10BoxedNumber](#schema10boxednumber) + +sealed interface that stores validated payloads using boxed classes + +## Schema10BoxedNumber +public record Schema10BoxedNumber
+implements [Schema10Boxed](#schema10boxed) + +record that stores validated Number payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| Schema10BoxedNumber(Number data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| Number | data()
validated payload | +| @Nullable Object | getData()
validated payload | + +## Schema10 +public static class Schema10
+extends NumberJsonSchema.NumberJsonSchema1 + +A schema class that validates payloads + +| Methods Inherited from class org.openapijsonschematools.client.schemas.NumberJsonSchema.NumberJsonSchema1 | +| ------------------------------------------------------------------ | +| validate | +| validateAndBox | + +## Schema9Boxed +public sealed interface Schema9Boxed
+permits
+[Schema9BoxedList](#schema9boxedlist) + +sealed interface that stores validated payloads using boxed classes + +## Schema9BoxedList +public record Schema9BoxedList
+implements [Schema9Boxed](#schema9boxed) + +record that stores validated List payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| Schema9BoxedList([Schema9List](#schema9list) data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| [Schema9List](#schema9list) | data()
validated payload | +| @Nullable Object | getData()
validated payload | + +## Schema9 +public static class Schema9
+extends JsonSchema + +A schema class that validates payloads + +### Code Sample +``` +import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags; +import org.openapijsonschematools.client.configurations.SchemaConfiguration; +import org.openapijsonschematools.client.exceptions.ValidationException; +import org.openapijsonschematools.client.schemas.validation.MapUtils; +import org.openapijsonschematools.client.schemas.validation.FrozenList; +import org.openapijsonschematools.client.schemas.validation.FrozenMap; +import org.openapijsonschematools.client.components.schemas.ComposedAnyOfDifferentTypesNoValidations; + +import java.util.Arrays; +import java.util.List; +import java.util.AbstractMap; + +static final SchemaConfiguration configuration = new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().build()); + +// List validation +ComposedAnyOfDifferentTypesNoValidations.Schema9List validatedPayload = + ComposedAnyOfDifferentTypesNoValidations.Schema9.validate( + new ComposedAnyOfDifferentTypesNoValidations.Schema9ListBuilder() + .build(), + configuration +); +``` + +### Field Summary +| Modifier and Type | Field and Description | +| ----------------- | ---------------------- | +| Set> | type = Set.of(List.class) | +| Class | items = [Items.class](#items) | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| [Schema9List](#schema9list) | validate([List](#schema9listbuilder) arg, SchemaConfiguration configuration) | +| [Schema9BoxedList](#schema9boxedlist) | validateAndBox([List](#schema9listbuilder) arg, SchemaConfiguration configuration) | +| [Schema9Boxed](#schema9boxed) | validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) | +| @Nullable Object | validate(@Nullable Object arg, SchemaConfiguration configuration) | + +## Schema9ListBuilder +public class Schema9ListBuilder
+builder for `List<@Nullable Object>` + +A class that builds the List input type + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| Schema9ListBuilder()
Creates an empty list | +| Schema9ListBuilder(List<@Nullable Object> items)
Stores the items in a list | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| Schema9ListBuilder | add(Nothing? item) | +| Schema9ListBuilder | add(boolean item) | +| Schema9ListBuilder | add(String item) | +| Schema9ListBuilder | add(int item) | +| Schema9ListBuilder | add(float item) | +| Schema9ListBuilder | add(long item) | +| Schema9ListBuilder | add(double item) | +| Schema9ListBuilder | add(List item) | +| Schema9ListBuilder | add(Map item) | +| List<@Nullable Object> | build()
Returns list input that should be used with Schema.validate | + +## Schema9List +public class Schema9List
+extends `FrozenList<@Nullable Object>` + +A class to store validated List payloads + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| static [Schema9List](#schema9list) | of([List](#schema9listbuilder) arg, SchemaConfiguration configuration) | + +## ItemsBoxed +public sealed interface ItemsBoxed
+permits
+[ItemsBoxedVoid](#itemsboxedvoid), +[ItemsBoxedBoolean](#itemsboxedboolean), +[ItemsBoxedNumber](#itemsboxednumber), +[ItemsBoxedString](#itemsboxedstring), +[ItemsBoxedList](#itemsboxedlist), +[ItemsBoxedMap](#itemsboxedmap) + +sealed interface that stores validated payloads using boxed classes + +## ItemsBoxedVoid +public record ItemsBoxedVoid
+implements [ItemsBoxed](#itemsboxed) + +record that stores validated null payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| ItemsBoxedVoid(Nothing? data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| Nothing? | data()
validated payload | +| @Nullable Object | getData()
validated payload | + +## ItemsBoxedBoolean +public record ItemsBoxedBoolean
+implements [ItemsBoxed](#itemsboxed) + +record that stores validated boolean payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| ItemsBoxedBoolean(boolean data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| boolean | data()
validated payload | +| @Nullable Object | getData()
validated payload | + +## ItemsBoxedNumber +public record ItemsBoxedNumber
+implements [ItemsBoxed](#itemsboxed) + +record that stores validated Number payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| ItemsBoxedNumber(Number data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| Number | data()
validated payload | +| @Nullable Object | getData()
validated payload | + +## ItemsBoxedString +public record ItemsBoxedString
+implements [ItemsBoxed](#itemsboxed) + +record that stores validated String payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| ItemsBoxedString(String data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| String | data()
validated payload | +| @Nullable Object | getData()
validated payload | + +## ItemsBoxedList +public record ItemsBoxedList
+implements [ItemsBoxed](#itemsboxed) + +record that stores validated List payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| ItemsBoxedList(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 | + +## ItemsBoxedMap +public record ItemsBoxedMap
+implements [ItemsBoxed](#itemsboxed) + +record that stores validated Map payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| ItemsBoxedMap(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 | + +## Items +public static class Items
+extends AnyTypeJsonSchema.AnyTypeJsonSchema1 + +A schema class that validates payloads + +| Methods Inherited from class org.openapijsonschematools.client.schemas.AnyTypeJsonSchema.AnyTypeJsonSchema1 | +| ------------------------------------------------------------------ | +| validate | +| validateAndBox | + +## Schema8Boxed +public sealed interface Schema8Boxed
+permits
+[Schema8BoxedVoid](#schema8boxedvoid) + +sealed interface that stores validated payloads using boxed classes + +## Schema8BoxedVoid +public record Schema8BoxedVoid
+implements [Schema8Boxed](#schema8boxed) + +record that stores validated null payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| Schema8BoxedVoid(Nothing? data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| Nothing? | data()
validated payload | +| @Nullable Object | getData()
validated payload | + +## Schema8 +public static class Schema8
+extends NullJsonSchema.NullJsonSchema1 + +A schema class that validates payloads + +| Methods Inherited from class org.openapijsonschematools.client.schemas.NullJsonSchema.NullJsonSchema1 | +| ------------------------------------------------------------------ | +| validate | +| validateAndBox | + +## Schema7Boxed +public sealed interface Schema7Boxed
+permits
+[Schema7BoxedBoolean](#schema7boxedboolean) + +sealed interface that stores validated payloads using boxed classes + +## Schema7BoxedBoolean +public record Schema7BoxedBoolean
+implements [Schema7Boxed](#schema7boxed) + +record that stores validated boolean payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| Schema7BoxedBoolean(boolean data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| boolean | data()
validated payload | +| @Nullable Object | getData()
validated payload | + +## Schema7 +public static class Schema7
+extends BooleanJsonSchema.BooleanJsonSchema1 + +A schema class that validates payloads + +| Methods Inherited from class org.openapijsonschematools.client.schemas.BooleanJsonSchema.BooleanJsonSchema1 | +| ------------------------------------------------------------------ | +| validate | +| validateAndBox | + +## Schema6Boxed +public sealed interface Schema6Boxed
+permits
+[Schema6BoxedMap](#schema6boxedmap) + +sealed interface that stores validated payloads using boxed classes + +## Schema6BoxedMap +public record Schema6BoxedMap
+implements [Schema6Boxed](#schema6boxed) + +record that stores validated Map payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| Schema6BoxedMap(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 | + +## Schema6 +public static class Schema6
+extends MapJsonSchema.MapJsonSchema1 + +A schema class that validates payloads + +| Methods Inherited from class org.openapijsonschematools.client.schemas.MapJsonSchema.MapJsonSchema1 | +| ------------------------------------------------------------------ | +| validate | +| validateAndBox | + +## Schema5Boxed +public sealed interface Schema5Boxed
+permits
+[Schema5BoxedString](#schema5boxedstring) + +sealed interface that stores validated payloads using boxed classes + +## Schema5BoxedString +public record Schema5BoxedString
+implements [Schema5Boxed](#schema5boxed) + +record that stores validated String payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| Schema5BoxedString(String data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| String | data()
validated payload | +| @Nullable Object | getData()
validated payload | + +## Schema5 +public static class Schema5
+extends StringJsonSchema.StringJsonSchema1 + +A schema class that validates payloads + +| Methods Inherited from class org.openapijsonschematools.client.schemas.StringJsonSchema.StringJsonSchema1 | +| ------------------------------------------------------------------ | +| validate | +| validateAndBox | + +## Schema4Boxed +public sealed interface Schema4Boxed
+permits
+[Schema4BoxedString](#schema4boxedstring) + +sealed interface that stores validated payloads using boxed classes + +## Schema4BoxedString +public record Schema4BoxedString
+implements [Schema4Boxed](#schema4boxed) + +record that stores validated String payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| Schema4BoxedString(String data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| String | data()
validated payload | +| @Nullable Object | getData()
validated payload | + +## Schema4 +public static class Schema4
+extends StringJsonSchema.StringJsonSchema1 + +A schema class that validates payloads + +## Schema3Boxed +public sealed interface Schema3Boxed
+permits
+ +sealed interface that stores validated payloads using boxed classes + +## Schema3 +public static class Schema3
+extends JsonSchema + +A schema class that validates payloads + +## Schema2Boxed +public sealed interface Schema2Boxed
+permits
+[Schema2BoxedString](#schema2boxedstring) + +sealed interface that stores validated payloads using boxed classes + +## Schema2BoxedString +public record Schema2BoxedString
+implements [Schema2Boxed](#schema2boxed) + +record that stores validated String payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| Schema2BoxedString(String data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| String | data()
validated payload | +| @Nullable Object | getData()
validated payload | + +## Schema2 +public static class Schema2
+extends DateTimeJsonSchema.DateTimeJsonSchema1 + +A schema class that validates payloads + +| Methods Inherited from class org.openapijsonschematools.client.schemas.DateTimeJsonSchema.DateTimeJsonSchema1 | +| ------------------------------------------------------------------ | +| validate | +| validateAndBox | + +## Schema1Boxed +public sealed interface Schema1Boxed
+permits
+[Schema1BoxedString](#schema1boxedstring) + +sealed interface that stores validated payloads using boxed classes + +## Schema1BoxedString +public record Schema1BoxedString
+implements [Schema1Boxed](#schema1boxed) + +record that stores validated String payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| Schema1BoxedString(String data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| String | data()
validated payload | +| @Nullable Object | getData()
validated payload | + +## Schema1 +public static class Schema1
+extends DateJsonSchema.DateJsonSchema1 + +A schema class that validates payloads + +| Methods Inherited from class org.openapijsonschematools.client.schemas.DateJsonSchema.DateJsonSchema1 | +| ------------------------------------------------------------------ | +| validate | +| validateAndBox | + +## Schema0Boxed +public sealed interface Schema0Boxed
+permits
+[Schema0BoxedMap](#schema0boxedmap) + +sealed interface that stores validated payloads using boxed classes + +## Schema0BoxedMap +public record Schema0BoxedMap
+implements [Schema0Boxed](#schema0boxed) + +record that stores validated Map payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| Schema0BoxedMap(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 | + +## Schema0 +public static class Schema0
+extends MapJsonSchema.MapJsonSchema1 + +A schema class that validates payloads + +| Methods Inherited from class org.openapijsonschematools.client.schemas.MapJsonSchema.MapJsonSchema1 | +| ------------------------------------------------------------------ | +| validate | +| validateAndBox | + +[[Back to top]](#top) [[Back to Component Schemas]](../../../README.md#Component-Schemas) [[Back to README]](../../../README.md) diff --git a/samples/client/petstore/kotlin/docs/components/schemas/ComposedArray.md b/samples/client/petstore/kotlin/docs/components/schemas/ComposedArray.md new file mode 100644 index 00000000000..6b8c830f54a --- /dev/null +++ b/samples/client/petstore/kotlin/docs/components/schemas/ComposedArray.md @@ -0,0 +1,260 @@ +# ComposedArray +org.openapijsonschematools.client.components.schemas.ComposedArray.java +public class ComposedArray
+ +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 list payloads, extends FrozenList +- classes to build inputs for list payloads + +## Nested Class Summary +| Modifier and Type | Class and Description | +| ----------------- | ---------------------- | +| sealed interface | [ComposedArray.ComposedArray1Boxed](#composedarray1boxed)
sealed interface for validated payloads | +| record | [ComposedArray.ComposedArray1BoxedList](#composedarray1boxedlist)
boxed class to store validated List payloads | +| static class | [ComposedArray.ComposedArray1](#composedarray1)
schema class | +| static class | [ComposedArray.ComposedArrayListBuilder](#composedarraylistbuilder)
builder for List payloads | +| static class | [ComposedArray.ComposedArrayList](#composedarraylist)
output class for List payloads | +| sealed interface | [ComposedArray.ItemsBoxed](#itemsboxed)
sealed interface for validated payloads | +| record | [ComposedArray.ItemsBoxedVoid](#itemsboxedvoid)
boxed class to store validated null payloads | +| record | [ComposedArray.ItemsBoxedBoolean](#itemsboxedboolean)
boxed class to store validated boolean payloads | +| record | [ComposedArray.ItemsBoxedNumber](#itemsboxednumber)
boxed class to store validated Number payloads | +| record | [ComposedArray.ItemsBoxedString](#itemsboxedstring)
boxed class to store validated String payloads | +| record | [ComposedArray.ItemsBoxedList](#itemsboxedlist)
boxed class to store validated List payloads | +| record | [ComposedArray.ItemsBoxedMap](#itemsboxedmap)
boxed class to store validated Map payloads | +| static class | [ComposedArray.Items](#items)
schema class | + +## ComposedArray1Boxed +public sealed interface ComposedArray1Boxed
+permits
+[ComposedArray1BoxedList](#composedarray1boxedlist) + +sealed interface that stores validated payloads using boxed classes + +## ComposedArray1BoxedList +public record ComposedArray1BoxedList
+implements [ComposedArray1Boxed](#composedarray1boxed) + +record that stores validated List payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| ComposedArray1BoxedList([ComposedArrayList](#composedarraylist) data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| [ComposedArrayList](#composedarraylist) | data()
validated payload | +| @Nullable Object | getData()
validated payload | + +## ComposedArray1 +public static class ComposedArray1
+extends JsonSchema + +A schema class that validates payloads + +### Code Sample +``` +import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags; +import org.openapijsonschematools.client.configurations.SchemaConfiguration; +import org.openapijsonschematools.client.exceptions.ValidationException; +import org.openapijsonschematools.client.schemas.validation.MapUtils; +import org.openapijsonschematools.client.schemas.validation.FrozenList; +import org.openapijsonschematools.client.schemas.validation.FrozenMap; +import org.openapijsonschematools.client.components.schemas.ComposedArray; + +import java.util.Arrays; +import java.util.List; +import java.util.AbstractMap; + +static final SchemaConfiguration configuration = new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().build()); + +// List validation +ComposedArray.ComposedArrayList validatedPayload = + ComposedArray.ComposedArray1.validate( + new ComposedArray.ComposedArrayListBuilder() + .build(), + configuration +); +``` + +### Field Summary +| Modifier and Type | Field and Description | +| ----------------- | ---------------------- | +| Set> | type = Set.of(List.class) | +| Class | items = [Items.class](#items) | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| [ComposedArrayList](#composedarraylist) | validate([List](#composedarraylistbuilder) arg, SchemaConfiguration configuration) | +| [ComposedArray1BoxedList](#composedarray1boxedlist) | validateAndBox([List](#composedarraylistbuilder) arg, SchemaConfiguration configuration) | +| [ComposedArray1Boxed](#composedarray1boxed) | validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) | +| @Nullable Object | validate(@Nullable Object arg, SchemaConfiguration configuration) | + +## ComposedArrayListBuilder +public class ComposedArrayListBuilder
+builder for `List<@Nullable Object>` + +A class that builds the List input type + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| ComposedArrayListBuilder()
Creates an empty list | +| ComposedArrayListBuilder(List<@Nullable Object> items)
Stores the items in a list | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| ComposedArrayListBuilder | add(Nothing? item) | +| ComposedArrayListBuilder | add(boolean item) | +| ComposedArrayListBuilder | add(String item) | +| ComposedArrayListBuilder | add(int item) | +| ComposedArrayListBuilder | add(float item) | +| ComposedArrayListBuilder | add(long item) | +| ComposedArrayListBuilder | add(double item) | +| ComposedArrayListBuilder | add(List item) | +| ComposedArrayListBuilder | add(Map item) | +| List<@Nullable Object> | build()
Returns list input that should be used with Schema.validate | + +## ComposedArrayList +public class ComposedArrayList
+extends `FrozenList<@Nullable Object>` + +A class to store validated List payloads + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| static [ComposedArrayList](#composedarraylist) | of([List](#composedarraylistbuilder) arg, SchemaConfiguration configuration) | + +## ItemsBoxed +public sealed interface ItemsBoxed
+permits
+[ItemsBoxedVoid](#itemsboxedvoid), +[ItemsBoxedBoolean](#itemsboxedboolean), +[ItemsBoxedNumber](#itemsboxednumber), +[ItemsBoxedString](#itemsboxedstring), +[ItemsBoxedList](#itemsboxedlist), +[ItemsBoxedMap](#itemsboxedmap) + +sealed interface that stores validated payloads using boxed classes + +## ItemsBoxedVoid +public record ItemsBoxedVoid
+implements [ItemsBoxed](#itemsboxed) + +record that stores validated null payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| ItemsBoxedVoid(Nothing? data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| Nothing? | data()
validated payload | +| @Nullable Object | getData()
validated payload | + +## ItemsBoxedBoolean +public record ItemsBoxedBoolean
+implements [ItemsBoxed](#itemsboxed) + +record that stores validated boolean payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| ItemsBoxedBoolean(boolean data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| boolean | data()
validated payload | +| @Nullable Object | getData()
validated payload | + +## ItemsBoxedNumber +public record ItemsBoxedNumber
+implements [ItemsBoxed](#itemsboxed) + +record that stores validated Number payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| ItemsBoxedNumber(Number data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| Number | data()
validated payload | +| @Nullable Object | getData()
validated payload | + +## ItemsBoxedString +public record ItemsBoxedString
+implements [ItemsBoxed](#itemsboxed) + +record that stores validated String payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| ItemsBoxedString(String data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| String | data()
validated payload | +| @Nullable Object | getData()
validated payload | + +## ItemsBoxedList +public record ItemsBoxedList
+implements [ItemsBoxed](#itemsboxed) + +record that stores validated List payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| ItemsBoxedList(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 | + +## ItemsBoxedMap +public record ItemsBoxedMap
+implements [ItemsBoxed](#itemsboxed) + +record that stores validated Map payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| ItemsBoxedMap(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 | + +## Items +public static class Items
+extends AnyTypeJsonSchema.AnyTypeJsonSchema1 + +A schema class that validates payloads + +| Methods Inherited from class org.openapijsonschematools.client.schemas.AnyTypeJsonSchema.AnyTypeJsonSchema1 | +| ------------------------------------------------------------------ | +| validate | +| validateAndBox | + +[[Back to top]](#top) [[Back to Component Schemas]](../../../README.md#Component-Schemas) [[Back to README]](../../../README.md) diff --git a/samples/client/petstore/kotlin/docs/components/schemas/ComposedBool.md b/samples/client/petstore/kotlin/docs/components/schemas/ComposedBool.md new file mode 100644 index 00000000000..251a502a27e --- /dev/null +++ b/samples/client/petstore/kotlin/docs/components/schemas/ComposedBool.md @@ -0,0 +1,217 @@ +# ComposedBool +org.openapijsonschematools.client.components.schemas.ComposedBool.java +public class ComposedBool
+ +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 + +## Nested Class Summary +| Modifier and Type | Class and Description | +| ----------------- | ---------------------- | +| sealed interface | [ComposedBool.ComposedBool1Boxed](#composedbool1boxed)
sealed interface for validated payloads | +| record | [ComposedBool.ComposedBool1BoxedBoolean](#composedbool1boxedboolean)
boxed class to store validated boolean payloads | +| static class | [ComposedBool.ComposedBool1](#composedbool1)
schema class | +| sealed interface | [ComposedBool.Schema0Boxed](#schema0boxed)
sealed interface for validated payloads | +| record | [ComposedBool.Schema0BoxedVoid](#schema0boxedvoid)
boxed class to store validated null payloads | +| record | [ComposedBool.Schema0BoxedBoolean](#schema0boxedboolean)
boxed class to store validated boolean payloads | +| record | [ComposedBool.Schema0BoxedNumber](#schema0boxednumber)
boxed class to store validated Number payloads | +| record | [ComposedBool.Schema0BoxedString](#schema0boxedstring)
boxed class to store validated String payloads | +| record | [ComposedBool.Schema0BoxedList](#schema0boxedlist)
boxed class to store validated List payloads | +| record | [ComposedBool.Schema0BoxedMap](#schema0boxedmap)
boxed class to store validated Map payloads | +| static class | [ComposedBool.Schema0](#schema0)
schema class | + +## ComposedBool1Boxed +public sealed interface ComposedBool1Boxed
+permits
+[ComposedBool1BoxedBoolean](#composedbool1boxedboolean) + +sealed interface that stores validated payloads using boxed classes + +## ComposedBool1BoxedBoolean +public record ComposedBool1BoxedBoolean
+implements [ComposedBool1Boxed](#composedbool1boxed) + +record that stores validated boolean payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| ComposedBool1BoxedBoolean(boolean data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| boolean | data()
validated payload | +| @Nullable Object | getData()
validated payload | + +## ComposedBool1 +public static class ComposedBool1
+extends JsonSchema + +A schema class that validates payloads + +### Code Sample +``` +import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags; +import org.openapijsonschematools.client.configurations.SchemaConfiguration; +import org.openapijsonschematools.client.exceptions.ValidationException; +import org.openapijsonschematools.client.schemas.validation.MapUtils; +import org.openapijsonschematools.client.schemas.validation.FrozenList; +import org.openapijsonschematools.client.schemas.validation.FrozenMap; +import org.openapijsonschematools.client.components.schemas.ComposedBool; + +import java.util.Arrays; +import java.util.List; +import java.util.AbstractMap; + +static final SchemaConfiguration configuration = new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().build()); + +// boolean validation +boolean validatedPayload = ComposedBool.ComposedBool1.validate( + true, + configuration +); +``` + +### Field Summary +| Modifier and Type | Field and Description | +| ----------------- | ---------------------- | +| Set> | type = Set.of(Boolean.class) | +| List> | allOf = List.of(
    [Schema0.class](#schema0)
;)
| + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| boolean | validate(boolean arg, SchemaConfiguration configuration) | +| [ComposedBool1BoxedBoolean](#composedbool1boxedboolean) | validateAndBox(boolean arg, SchemaConfiguration configuration) | +| [ComposedBool1Boxed](#composedbool1boxed) | validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) | +| @Nullable Object | validate(@Nullable Object arg, SchemaConfiguration configuration) | + +## Schema0Boxed +public sealed interface Schema0Boxed
+permits
+[Schema0BoxedVoid](#schema0boxedvoid), +[Schema0BoxedBoolean](#schema0boxedboolean), +[Schema0BoxedNumber](#schema0boxednumber), +[Schema0BoxedString](#schema0boxedstring), +[Schema0BoxedList](#schema0boxedlist), +[Schema0BoxedMap](#schema0boxedmap) + +sealed interface that stores validated payloads using boxed classes + +## Schema0BoxedVoid +public record Schema0BoxedVoid
+implements [Schema0Boxed](#schema0boxed) + +record that stores validated null payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| Schema0BoxedVoid(Nothing? data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| Nothing? | data()
validated payload | +| @Nullable Object | getData()
validated payload | + +## Schema0BoxedBoolean +public record Schema0BoxedBoolean
+implements [Schema0Boxed](#schema0boxed) + +record that stores validated boolean payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| Schema0BoxedBoolean(boolean data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| boolean | data()
validated payload | +| @Nullable Object | getData()
validated payload | + +## Schema0BoxedNumber +public record Schema0BoxedNumber
+implements [Schema0Boxed](#schema0boxed) + +record that stores validated Number payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| Schema0BoxedNumber(Number data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| Number | data()
validated payload | +| @Nullable Object | getData()
validated payload | + +## Schema0BoxedString +public record Schema0BoxedString
+implements [Schema0Boxed](#schema0boxed) + +record that stores validated String payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| Schema0BoxedString(String data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| String | data()
validated payload | +| @Nullable Object | getData()
validated payload | + +## Schema0BoxedList +public record Schema0BoxedList
+implements [Schema0Boxed](#schema0boxed) + +record that stores validated List payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| Schema0BoxedList(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 | + +## Schema0BoxedMap +public record Schema0BoxedMap
+implements [Schema0Boxed](#schema0boxed) + +record that stores validated Map payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| Schema0BoxedMap(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 | + +## Schema0 +public static class Schema0
+extends AnyTypeJsonSchema.AnyTypeJsonSchema1 + +A schema class that validates payloads + +| Methods Inherited from class org.openapijsonschematools.client.schemas.AnyTypeJsonSchema.AnyTypeJsonSchema1 | +| ------------------------------------------------------------------ | +| validate | +| validateAndBox | + +[[Back to top]](#top) [[Back to Component Schemas]](../../../README.md#Component-Schemas) [[Back to README]](../../../README.md) diff --git a/samples/client/petstore/kotlin/docs/components/schemas/ComposedNone.md b/samples/client/petstore/kotlin/docs/components/schemas/ComposedNone.md new file mode 100644 index 00000000000..06e554db8dc --- /dev/null +++ b/samples/client/petstore/kotlin/docs/components/schemas/ComposedNone.md @@ -0,0 +1,217 @@ +# ComposedNone +org.openapijsonschematools.client.components.schemas.ComposedNone.java +public class ComposedNone
+ +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 + +## Nested Class Summary +| Modifier and Type | Class and Description | +| ----------------- | ---------------------- | +| sealed interface | [ComposedNone.ComposedNone1Boxed](#composednone1boxed)
sealed interface for validated payloads | +| record | [ComposedNone.ComposedNone1BoxedVoid](#composednone1boxedvoid)
boxed class to store validated null payloads | +| static class | [ComposedNone.ComposedNone1](#composednone1)
schema class | +| sealed interface | [ComposedNone.Schema0Boxed](#schema0boxed)
sealed interface for validated payloads | +| record | [ComposedNone.Schema0BoxedVoid](#schema0boxedvoid)
boxed class to store validated null payloads | +| record | [ComposedNone.Schema0BoxedBoolean](#schema0boxedboolean)
boxed class to store validated boolean payloads | +| record | [ComposedNone.Schema0BoxedNumber](#schema0boxednumber)
boxed class to store validated Number payloads | +| record | [ComposedNone.Schema0BoxedString](#schema0boxedstring)
boxed class to store validated String payloads | +| record | [ComposedNone.Schema0BoxedList](#schema0boxedlist)
boxed class to store validated List payloads | +| record | [ComposedNone.Schema0BoxedMap](#schema0boxedmap)
boxed class to store validated Map payloads | +| static class | [ComposedNone.Schema0](#schema0)
schema class | + +## ComposedNone1Boxed +public sealed interface ComposedNone1Boxed
+permits
+[ComposedNone1BoxedVoid](#composednone1boxedvoid) + +sealed interface that stores validated payloads using boxed classes + +## ComposedNone1BoxedVoid +public record ComposedNone1BoxedVoid
+implements [ComposedNone1Boxed](#composednone1boxed) + +record that stores validated null payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| ComposedNone1BoxedVoid(Nothing? data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| Nothing? | data()
validated payload | +| @Nullable Object | getData()
validated payload | + +## ComposedNone1 +public static class ComposedNone1
+extends JsonSchema + +A schema class that validates payloads + +### Code Sample +``` +import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags; +import org.openapijsonschematools.client.configurations.SchemaConfiguration; +import org.openapijsonschematools.client.exceptions.ValidationException; +import org.openapijsonschematools.client.schemas.validation.MapUtils; +import org.openapijsonschematools.client.schemas.validation.FrozenList; +import org.openapijsonschematools.client.schemas.validation.FrozenMap; +import org.openapijsonschematools.client.components.schemas.ComposedNone; + +import java.util.Arrays; +import java.util.List; +import java.util.AbstractMap; + +static final SchemaConfiguration configuration = new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().build()); + +// null validation +Nothing? validatedPayload = ComposedNone.ComposedNone1.validate( + (Nothing?) null, + configuration +); +``` + +### Field Summary +| Modifier and Type | Field and Description | +| ----------------- | ---------------------- | +| Set> | type = Set.of(Nothing?.class) | +| List> | allOf = List.of(
    [Schema0.class](#schema0)
;)
| + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| Nothing? | validate(Nothing? arg, SchemaConfiguration configuration) | +| [ComposedNone1BoxedVoid](#composednone1boxedvoid) | validateAndBox(Nothing? arg, SchemaConfiguration configuration) | +| [ComposedNone1Boxed](#composednone1boxed) | validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) | +| @Nullable Object | validate(@Nullable Object arg, SchemaConfiguration configuration) | + +## Schema0Boxed +public sealed interface Schema0Boxed
+permits
+[Schema0BoxedVoid](#schema0boxedvoid), +[Schema0BoxedBoolean](#schema0boxedboolean), +[Schema0BoxedNumber](#schema0boxednumber), +[Schema0BoxedString](#schema0boxedstring), +[Schema0BoxedList](#schema0boxedlist), +[Schema0BoxedMap](#schema0boxedmap) + +sealed interface that stores validated payloads using boxed classes + +## Schema0BoxedVoid +public record Schema0BoxedVoid
+implements [Schema0Boxed](#schema0boxed) + +record that stores validated null payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| Schema0BoxedVoid(Nothing? data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| Nothing? | data()
validated payload | +| @Nullable Object | getData()
validated payload | + +## Schema0BoxedBoolean +public record Schema0BoxedBoolean
+implements [Schema0Boxed](#schema0boxed) + +record that stores validated boolean payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| Schema0BoxedBoolean(boolean data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| boolean | data()
validated payload | +| @Nullable Object | getData()
validated payload | + +## Schema0BoxedNumber +public record Schema0BoxedNumber
+implements [Schema0Boxed](#schema0boxed) + +record that stores validated Number payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| Schema0BoxedNumber(Number data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| Number | data()
validated payload | +| @Nullable Object | getData()
validated payload | + +## Schema0BoxedString +public record Schema0BoxedString
+implements [Schema0Boxed](#schema0boxed) + +record that stores validated String payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| Schema0BoxedString(String data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| String | data()
validated payload | +| @Nullable Object | getData()
validated payload | + +## Schema0BoxedList +public record Schema0BoxedList
+implements [Schema0Boxed](#schema0boxed) + +record that stores validated List payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| Schema0BoxedList(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 | + +## Schema0BoxedMap +public record Schema0BoxedMap
+implements [Schema0Boxed](#schema0boxed) + +record that stores validated Map payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| Schema0BoxedMap(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 | + +## Schema0 +public static class Schema0
+extends AnyTypeJsonSchema.AnyTypeJsonSchema1 + +A schema class that validates payloads + +| Methods Inherited from class org.openapijsonschematools.client.schemas.AnyTypeJsonSchema.AnyTypeJsonSchema1 | +| ------------------------------------------------------------------ | +| validate | +| validateAndBox | + +[[Back to top]](#top) [[Back to Component Schemas]](../../../README.md#Component-Schemas) [[Back to README]](../../../README.md) diff --git a/samples/client/petstore/kotlin/docs/components/schemas/ComposedNumber.md b/samples/client/petstore/kotlin/docs/components/schemas/ComposedNumber.md new file mode 100644 index 00000000000..64a97f4c0c9 --- /dev/null +++ b/samples/client/petstore/kotlin/docs/components/schemas/ComposedNumber.md @@ -0,0 +1,217 @@ +# ComposedNumber +org.openapijsonschematools.client.components.schemas.ComposedNumber.java +public class ComposedNumber
+ +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 + +## Nested Class Summary +| Modifier and Type | Class and Description | +| ----------------- | ---------------------- | +| sealed interface | [ComposedNumber.ComposedNumber1Boxed](#composednumber1boxed)
sealed interface for validated payloads | +| record | [ComposedNumber.ComposedNumber1BoxedNumber](#composednumber1boxednumber)
boxed class to store validated Number payloads | +| static class | [ComposedNumber.ComposedNumber1](#composednumber1)
schema class | +| sealed interface | [ComposedNumber.Schema0Boxed](#schema0boxed)
sealed interface for validated payloads | +| record | [ComposedNumber.Schema0BoxedVoid](#schema0boxedvoid)
boxed class to store validated null payloads | +| record | [ComposedNumber.Schema0BoxedBoolean](#schema0boxedboolean)
boxed class to store validated boolean payloads | +| record | [ComposedNumber.Schema0BoxedNumber](#schema0boxednumber)
boxed class to store validated Number payloads | +| record | [ComposedNumber.Schema0BoxedString](#schema0boxedstring)
boxed class to store validated String payloads | +| record | [ComposedNumber.Schema0BoxedList](#schema0boxedlist)
boxed class to store validated List payloads | +| record | [ComposedNumber.Schema0BoxedMap](#schema0boxedmap)
boxed class to store validated Map payloads | +| static class | [ComposedNumber.Schema0](#schema0)
schema class | + +## ComposedNumber1Boxed +public sealed interface ComposedNumber1Boxed
+permits
+[ComposedNumber1BoxedNumber](#composednumber1boxednumber) + +sealed interface that stores validated payloads using boxed classes + +## ComposedNumber1BoxedNumber +public record ComposedNumber1BoxedNumber
+implements [ComposedNumber1Boxed](#composednumber1boxed) + +record that stores validated Number payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| ComposedNumber1BoxedNumber(Number data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| Number | data()
validated payload | +| @Nullable Object | getData()
validated payload | + +## ComposedNumber1 +public static class ComposedNumber1
+extends JsonSchema + +A schema class that validates payloads + +### Code Sample +``` +import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags; +import org.openapijsonschematools.client.configurations.SchemaConfiguration; +import org.openapijsonschematools.client.exceptions.ValidationException; +import org.openapijsonschematools.client.schemas.validation.MapUtils; +import org.openapijsonschematools.client.schemas.validation.FrozenList; +import org.openapijsonschematools.client.schemas.validation.FrozenMap; +import org.openapijsonschematools.client.components.schemas.ComposedNumber; + +import java.util.Arrays; +import java.util.List; +import java.util.AbstractMap; + +static final SchemaConfiguration configuration = new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().build()); + +// int validation +int validatedPayload = ComposedNumber.ComposedNumber1.validate( + 1, + configuration +); +``` + +### Field Summary +| Modifier and Type | Field and Description | +| ----------------- | ---------------------- | +| Set> | type = Set.of(
    Integer.class,
    Long.class,
    Float.class,
    Double.class
)
| +| List> | allOf = List.of(
    [Schema0.class](#schema0)
;)
| + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| Number | validate(Number arg, SchemaConfiguration configuration) | +| [ComposedNumber1BoxedNumber](#composednumber1boxednumber) | validateAndBox(Number arg, SchemaConfiguration configuration) | +| [ComposedNumber1Boxed](#composednumber1boxed) | validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) | +| @Nullable Object | validate(@Nullable Object arg, SchemaConfiguration configuration) | + +## Schema0Boxed +public sealed interface Schema0Boxed
+permits
+[Schema0BoxedVoid](#schema0boxedvoid), +[Schema0BoxedBoolean](#schema0boxedboolean), +[Schema0BoxedNumber](#schema0boxednumber), +[Schema0BoxedString](#schema0boxedstring), +[Schema0BoxedList](#schema0boxedlist), +[Schema0BoxedMap](#schema0boxedmap) + +sealed interface that stores validated payloads using boxed classes + +## Schema0BoxedVoid +public record Schema0BoxedVoid
+implements [Schema0Boxed](#schema0boxed) + +record that stores validated null payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| Schema0BoxedVoid(Nothing? data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| Nothing? | data()
validated payload | +| @Nullable Object | getData()
validated payload | + +## Schema0BoxedBoolean +public record Schema0BoxedBoolean
+implements [Schema0Boxed](#schema0boxed) + +record that stores validated boolean payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| Schema0BoxedBoolean(boolean data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| boolean | data()
validated payload | +| @Nullable Object | getData()
validated payload | + +## Schema0BoxedNumber +public record Schema0BoxedNumber
+implements [Schema0Boxed](#schema0boxed) + +record that stores validated Number payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| Schema0BoxedNumber(Number data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| Number | data()
validated payload | +| @Nullable Object | getData()
validated payload | + +## Schema0BoxedString +public record Schema0BoxedString
+implements [Schema0Boxed](#schema0boxed) + +record that stores validated String payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| Schema0BoxedString(String data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| String | data()
validated payload | +| @Nullable Object | getData()
validated payload | + +## Schema0BoxedList +public record Schema0BoxedList
+implements [Schema0Boxed](#schema0boxed) + +record that stores validated List payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| Schema0BoxedList(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 | + +## Schema0BoxedMap +public record Schema0BoxedMap
+implements [Schema0Boxed](#schema0boxed) + +record that stores validated Map payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| Schema0BoxedMap(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 | + +## Schema0 +public static class Schema0
+extends AnyTypeJsonSchema.AnyTypeJsonSchema1 + +A schema class that validates payloads + +| Methods Inherited from class org.openapijsonschematools.client.schemas.AnyTypeJsonSchema.AnyTypeJsonSchema1 | +| ------------------------------------------------------------------ | +| validate | +| validateAndBox | + +[[Back to top]](#top) [[Back to Component Schemas]](../../../README.md#Component-Schemas) [[Back to README]](../../../README.md) diff --git a/samples/client/petstore/kotlin/docs/components/schemas/ComposedObject.md b/samples/client/petstore/kotlin/docs/components/schemas/ComposedObject.md new file mode 100644 index 00000000000..a37b31f15d5 --- /dev/null +++ b/samples/client/petstore/kotlin/docs/components/schemas/ComposedObject.md @@ -0,0 +1,194 @@ +# ComposedObject +org.openapijsonschematools.client.components.schemas.ComposedObject.java +public class ComposedObject
+ +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 + +## Nested Class Summary +| Modifier and Type | Class and Description | +| ----------------- | ---------------------- | +| sealed interface | [ComposedObject.ComposedObject1Boxed](#composedobject1boxed)
sealed interface for validated payloads | +| record | [ComposedObject.ComposedObject1BoxedMap](#composedobject1boxedmap)
boxed class to store validated Map payloads | +| static class | [ComposedObject.ComposedObject1](#composedobject1)
schema class | +| sealed interface | [ComposedObject.Schema0Boxed](#schema0boxed)
sealed interface for validated payloads | +| record | [ComposedObject.Schema0BoxedVoid](#schema0boxedvoid)
boxed class to store validated null payloads | +| record | [ComposedObject.Schema0BoxedBoolean](#schema0boxedboolean)
boxed class to store validated boolean payloads | +| record | [ComposedObject.Schema0BoxedNumber](#schema0boxednumber)
boxed class to store validated Number payloads | +| record | [ComposedObject.Schema0BoxedString](#schema0boxedstring)
boxed class to store validated String payloads | +| record | [ComposedObject.Schema0BoxedList](#schema0boxedlist)
boxed class to store validated List payloads | +| record | [ComposedObject.Schema0BoxedMap](#schema0boxedmap)
boxed class to store validated Map payloads | +| static class | [ComposedObject.Schema0](#schema0)
schema class | + +## ComposedObject1Boxed +public sealed interface ComposedObject1Boxed
+permits
+[ComposedObject1BoxedMap](#composedobject1boxedmap) + +sealed interface that stores validated payloads using boxed classes + +## ComposedObject1BoxedMap +public record ComposedObject1BoxedMap
+implements [ComposedObject1Boxed](#composedobject1boxed) + +record that stores validated Map payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| ComposedObject1BoxedMap(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 | + +## ComposedObject1 +public static class ComposedObject1
+extends JsonSchema + +A schema class that validates payloads + +### Field Summary +| Modifier and Type | Field and Description | +| ----------------- | ---------------------- | +| Set> | type = Set.of(Map.class) | +| List> | allOf = List.of(
    [Schema0.class](#schema0)
;)
| + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| FrozenMap | validate(Map<?, ?> arg, SchemaConfiguration configuration) | +| [ComposedObject1BoxedMap](#composedobject1boxedmap) | validateAndBox(Map<?, ?> arg, SchemaConfiguration configuration) | +| [ComposedObject1Boxed](#composedobject1boxed) | validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) | +| @Nullable Object | validate(@Nullable Object arg, SchemaConfiguration configuration) | + +## Schema0Boxed +public sealed interface Schema0Boxed
+permits
+[Schema0BoxedVoid](#schema0boxedvoid), +[Schema0BoxedBoolean](#schema0boxedboolean), +[Schema0BoxedNumber](#schema0boxednumber), +[Schema0BoxedString](#schema0boxedstring), +[Schema0BoxedList](#schema0boxedlist), +[Schema0BoxedMap](#schema0boxedmap) + +sealed interface that stores validated payloads using boxed classes + +## Schema0BoxedVoid +public record Schema0BoxedVoid
+implements [Schema0Boxed](#schema0boxed) + +record that stores validated null payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| Schema0BoxedVoid(Nothing? data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| Nothing? | data()
validated payload | +| @Nullable Object | getData()
validated payload | + +## Schema0BoxedBoolean +public record Schema0BoxedBoolean
+implements [Schema0Boxed](#schema0boxed) + +record that stores validated boolean payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| Schema0BoxedBoolean(boolean data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| boolean | data()
validated payload | +| @Nullable Object | getData()
validated payload | + +## Schema0BoxedNumber +public record Schema0BoxedNumber
+implements [Schema0Boxed](#schema0boxed) + +record that stores validated Number payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| Schema0BoxedNumber(Number data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| Number | data()
validated payload | +| @Nullable Object | getData()
validated payload | + +## Schema0BoxedString +public record Schema0BoxedString
+implements [Schema0Boxed](#schema0boxed) + +record that stores validated String payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| Schema0BoxedString(String data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| String | data()
validated payload | +| @Nullable Object | getData()
validated payload | + +## Schema0BoxedList +public record Schema0BoxedList
+implements [Schema0Boxed](#schema0boxed) + +record that stores validated List payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| Schema0BoxedList(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 | + +## Schema0BoxedMap +public record Schema0BoxedMap
+implements [Schema0Boxed](#schema0boxed) + +record that stores validated Map payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| Schema0BoxedMap(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 | + +## Schema0 +public static class Schema0
+extends AnyTypeJsonSchema.AnyTypeJsonSchema1 + +A schema class that validates payloads + +| Methods Inherited from class org.openapijsonschematools.client.schemas.AnyTypeJsonSchema.AnyTypeJsonSchema1 | +| ------------------------------------------------------------------ | +| validate | +| validateAndBox | + +[[Back to top]](#top) [[Back to Component Schemas]](../../../README.md#Component-Schemas) [[Back to README]](../../../README.md) diff --git a/samples/client/petstore/kotlin/docs/components/schemas/ComposedOneOfDifferentTypes.md b/samples/client/petstore/kotlin/docs/components/schemas/ComposedOneOfDifferentTypes.md new file mode 100644 index 00000000000..981677be57f --- /dev/null +++ b/samples/client/petstore/kotlin/docs/components/schemas/ComposedOneOfDifferentTypes.md @@ -0,0 +1,615 @@ +# ComposedOneOfDifferentTypes +org.openapijsonschematools.client.components.schemas.ComposedOneOfDifferentTypes.java +public class ComposedOneOfDifferentTypes
+ +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 list payloads, extends FrozenList +- classes to build inputs for list payloads + +## Nested Class Summary +| Modifier and Type | Class and Description | +| ----------------- | ---------------------- | +| sealed interface | [ComposedOneOfDifferentTypes.ComposedOneOfDifferentTypes1Boxed](#composedoneofdifferenttypes1boxed)
sealed interface for validated payloads | +| record | [ComposedOneOfDifferentTypes.ComposedOneOfDifferentTypes1BoxedVoid](#composedoneofdifferenttypes1boxedvoid)
boxed class to store validated null payloads | +| record | [ComposedOneOfDifferentTypes.ComposedOneOfDifferentTypes1BoxedBoolean](#composedoneofdifferenttypes1boxedboolean)
boxed class to store validated boolean payloads | +| record | [ComposedOneOfDifferentTypes.ComposedOneOfDifferentTypes1BoxedNumber](#composedoneofdifferenttypes1boxednumber)
boxed class to store validated Number payloads | +| record | [ComposedOneOfDifferentTypes.ComposedOneOfDifferentTypes1BoxedString](#composedoneofdifferenttypes1boxedstring)
boxed class to store validated String payloads | +| record | [ComposedOneOfDifferentTypes.ComposedOneOfDifferentTypes1BoxedList](#composedoneofdifferenttypes1boxedlist)
boxed class to store validated List payloads | +| record | [ComposedOneOfDifferentTypes.ComposedOneOfDifferentTypes1BoxedMap](#composedoneofdifferenttypes1boxedmap)
boxed class to store validated Map payloads | +| static class | [ComposedOneOfDifferentTypes.ComposedOneOfDifferentTypes1](#composedoneofdifferenttypes1)
schema class | +| sealed interface | [ComposedOneOfDifferentTypes.Schema6Boxed](#schema6boxed)
sealed interface for validated payloads | +| record | [ComposedOneOfDifferentTypes.Schema6BoxedString](#schema6boxedstring)
boxed class to store validated String payloads | +| static class | [ComposedOneOfDifferentTypes.Schema6](#schema6)
schema class | +| sealed interface | [ComposedOneOfDifferentTypes.Schema5Boxed](#schema5boxed)
sealed interface for validated payloads | +| record | [ComposedOneOfDifferentTypes.Schema5BoxedList](#schema5boxedlist)
boxed class to store validated List payloads | +| static class | [ComposedOneOfDifferentTypes.Schema5](#schema5)
schema class | +| static class | [ComposedOneOfDifferentTypes.Schema5ListBuilder](#schema5listbuilder)
builder for List payloads | +| static class | [ComposedOneOfDifferentTypes.Schema5List](#schema5list)
output class for List payloads | +| sealed interface | [ComposedOneOfDifferentTypes.ItemsBoxed](#itemsboxed)
sealed interface for validated payloads | +| record | [ComposedOneOfDifferentTypes.ItemsBoxedVoid](#itemsboxedvoid)
boxed class to store validated null payloads | +| record | [ComposedOneOfDifferentTypes.ItemsBoxedBoolean](#itemsboxedboolean)
boxed class to store validated boolean payloads | +| record | [ComposedOneOfDifferentTypes.ItemsBoxedNumber](#itemsboxednumber)
boxed class to store validated Number payloads | +| record | [ComposedOneOfDifferentTypes.ItemsBoxedString](#itemsboxedstring)
boxed class to store validated String payloads | +| record | [ComposedOneOfDifferentTypes.ItemsBoxedList](#itemsboxedlist)
boxed class to store validated List payloads | +| record | [ComposedOneOfDifferentTypes.ItemsBoxedMap](#itemsboxedmap)
boxed class to store validated Map payloads | +| static class | [ComposedOneOfDifferentTypes.Items](#items)
schema class | +| sealed interface | [ComposedOneOfDifferentTypes.Schema4Boxed](#schema4boxed)
sealed interface for validated payloads | +| record | [ComposedOneOfDifferentTypes.Schema4BoxedMap](#schema4boxedmap)
boxed class to store validated Map payloads | +| static class | [ComposedOneOfDifferentTypes.Schema4](#schema4)
schema class | +| sealed interface | [ComposedOneOfDifferentTypes.Schema3Boxed](#schema3boxed)
sealed interface for validated payloads | +| record | [ComposedOneOfDifferentTypes.Schema3BoxedString](#schema3boxedstring)
boxed class to store validated String payloads | +| static class | [ComposedOneOfDifferentTypes.Schema3](#schema3)
schema class | +| sealed interface | [ComposedOneOfDifferentTypes.Schema2Boxed](#schema2boxed)
sealed interface for validated payloads | +| record | [ComposedOneOfDifferentTypes.Schema2BoxedVoid](#schema2boxedvoid)
boxed class to store validated null payloads | +| static class | [ComposedOneOfDifferentTypes.Schema2](#schema2)
schema class | + +## ComposedOneOfDifferentTypes1Boxed +public sealed interface ComposedOneOfDifferentTypes1Boxed
+permits
+[ComposedOneOfDifferentTypes1BoxedVoid](#composedoneofdifferenttypes1boxedvoid), +[ComposedOneOfDifferentTypes1BoxedBoolean](#composedoneofdifferenttypes1boxedboolean), +[ComposedOneOfDifferentTypes1BoxedNumber](#composedoneofdifferenttypes1boxednumber), +[ComposedOneOfDifferentTypes1BoxedString](#composedoneofdifferenttypes1boxedstring), +[ComposedOneOfDifferentTypes1BoxedList](#composedoneofdifferenttypes1boxedlist), +[ComposedOneOfDifferentTypes1BoxedMap](#composedoneofdifferenttypes1boxedmap) + +sealed interface that stores validated payloads using boxed classes + +## ComposedOneOfDifferentTypes1BoxedVoid +public record ComposedOneOfDifferentTypes1BoxedVoid
+implements [ComposedOneOfDifferentTypes1Boxed](#composedoneofdifferenttypes1boxed) + +record that stores validated null payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| ComposedOneOfDifferentTypes1BoxedVoid(Nothing? data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| Nothing? | data()
validated payload | +| @Nullable Object | getData()
validated payload | + +## ComposedOneOfDifferentTypes1BoxedBoolean +public record ComposedOneOfDifferentTypes1BoxedBoolean
+implements [ComposedOneOfDifferentTypes1Boxed](#composedoneofdifferenttypes1boxed) + +record that stores validated boolean payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| ComposedOneOfDifferentTypes1BoxedBoolean(boolean data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| boolean | data()
validated payload | +| @Nullable Object | getData()
validated payload | + +## ComposedOneOfDifferentTypes1BoxedNumber +public record ComposedOneOfDifferentTypes1BoxedNumber
+implements [ComposedOneOfDifferentTypes1Boxed](#composedoneofdifferenttypes1boxed) + +record that stores validated Number payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| ComposedOneOfDifferentTypes1BoxedNumber(Number data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| Number | data()
validated payload | +| @Nullable Object | getData()
validated payload | + +## ComposedOneOfDifferentTypes1BoxedString +public record ComposedOneOfDifferentTypes1BoxedString
+implements [ComposedOneOfDifferentTypes1Boxed](#composedoneofdifferenttypes1boxed) + +record that stores validated String payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| ComposedOneOfDifferentTypes1BoxedString(String data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| String | data()
validated payload | +| @Nullable Object | getData()
validated payload | + +## ComposedOneOfDifferentTypes1BoxedList +public record ComposedOneOfDifferentTypes1BoxedList
+implements [ComposedOneOfDifferentTypes1Boxed](#composedoneofdifferenttypes1boxed) + +record that stores validated List payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| ComposedOneOfDifferentTypes1BoxedList(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 | + +## ComposedOneOfDifferentTypes1BoxedMap +public record ComposedOneOfDifferentTypes1BoxedMap
+implements [ComposedOneOfDifferentTypes1Boxed](#composedoneofdifferenttypes1boxed) + +record that stores validated Map payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| ComposedOneOfDifferentTypes1BoxedMap(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 | + +## ComposedOneOfDifferentTypes1 +public static class ComposedOneOfDifferentTypes1
+extends JsonSchema + +A schema class that validates payloads + +## Description +this is a model that allows payloads of type object or number + +### Field Summary +| Modifier and Type | Field and Description | +| ----------------- | ---------------------- | +| List> | oneOf = List.of(
    [NumberWithValidations.NumberWithValidations1.class](../../components/schemas/NumberWithValidations.md#numberwithvalidations1),
    [Animal.Animal1.class](../../components/schemas/Animal.md#animal1),
    [Schema2.class](#schema2),
    [Schema3.class](#schema3),
    [Schema4.class](#schema4),
    [Schema5.class](#schema5),
    [Schema6.class](#schema6)
))
| + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| String | validate(String arg, SchemaConfiguration configuration) | +| Nothing? | validate(Nothing? arg, SchemaConfiguration configuration) | +| int | validate(int arg, SchemaConfiguration configuration) | +| long | validate(long arg, SchemaConfiguration configuration) | +| float | validate(float arg, SchemaConfiguration configuration) | +| double | validate(double arg, SchemaConfiguration configuration) | +| Number | validate(Number arg, SchemaConfiguration configuration) | +| boolean | validate(boolean arg, SchemaConfiguration configuration) | +| FrozenMap<@Nullable Object> | validate(Map<?, ?> arg, SchemaConfiguration configuration) | +| FrozenList<@Nullable Object> | validate(List arg, SchemaConfiguration configuration) | +| [ComposedOneOfDifferentTypes1BoxedString](#composedoneofdifferenttypes1boxedstring) | validateAndBox(String arg, SchemaConfiguration configuration) | +| [ComposedOneOfDifferentTypes1BoxedVoid](#composedoneofdifferenttypes1boxedvoid) | validateAndBox(Nothing? arg, SchemaConfiguration configuration) | +| [ComposedOneOfDifferentTypes1BoxedNumber](#composedoneofdifferenttypes1boxednumber) | validateAndBox(Number arg, SchemaConfiguration configuration) | +| [ComposedOneOfDifferentTypes1BoxedBoolean](#composedoneofdifferenttypes1boxedboolean) | validateAndBox(boolean arg, SchemaConfiguration configuration) | +| [ComposedOneOfDifferentTypes1BoxedMap](#composedoneofdifferenttypes1boxedmap) | validateAndBox(Map<?, ?> arg, SchemaConfiguration configuration) | +| [ComposedOneOfDifferentTypes1BoxedList](#composedoneofdifferenttypes1boxedlist) | validateAndBox(List arg, SchemaConfiguration configuration) | +| [ComposedOneOfDifferentTypes1Boxed](#composedoneofdifferenttypes1boxed) | validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) | +| @Nullable Object | validate(@Nullable Object arg, SchemaConfiguration configuration) | + +## Schema6Boxed +public sealed interface Schema6Boxed
+permits
+[Schema6BoxedString](#schema6boxedstring) + +sealed interface that stores validated payloads using boxed classes + +## Schema6BoxedString +public record Schema6BoxedString
+implements [Schema6Boxed](#schema6boxed) + +record that stores validated String payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| Schema6BoxedString(String data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| String | data()
validated payload | +| @Nullable Object | getData()
validated payload | + +## Schema6 +public static class Schema6
+extends JsonSchema + +A schema class that validates payloads + +### Code Sample +``` +import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags; +import org.openapijsonschematools.client.configurations.SchemaConfiguration; +import org.openapijsonschematools.client.exceptions.ValidationException; +import org.openapijsonschematools.client.schemas.validation.MapUtils; +import org.openapijsonschematools.client.schemas.validation.FrozenList; +import org.openapijsonschematools.client.schemas.validation.FrozenMap; +import org.openapijsonschematools.client.components.schemas.ComposedOneOfDifferentTypes; + +import java.util.Arrays; +import java.util.List; +import java.util.AbstractMap; + +static final SchemaConfiguration configuration = new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().build()); + +// String validation +String validatedPayload = ComposedOneOfDifferentTypes.Schema6.validate( + "2020jUR,rZ#UM/?R,Fp^l6$ARj", + configuration +); +``` + +### Field Summary +| Modifier and Type | Field and Description | +| ----------------- | ---------------------- | +| Set> | type = Set.of(
    String.class
)
| +| String | type = "date-time"; | +| Pattern | pattern = Pattern.compile(
    "^2020.*"
)
| + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| String | validate(String arg, SchemaConfiguration configuration) | +| [Schema6BoxedString](#schema6boxedstring) | validateAndBox(String arg, SchemaConfiguration configuration) | +| [Schema6Boxed](#schema6boxed) | validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) | +| @Nullable Object | validate(@Nullable Object arg, SchemaConfiguration configuration) | + +## Schema5Boxed +public sealed interface Schema5Boxed
+permits
+[Schema5BoxedList](#schema5boxedlist) + +sealed interface that stores validated payloads using boxed classes + +## Schema5BoxedList +public record Schema5BoxedList
+implements [Schema5Boxed](#schema5boxed) + +record that stores validated List payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| Schema5BoxedList([Schema5List](#schema5list) data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| [Schema5List](#schema5list) | data()
validated payload | +| @Nullable Object | getData()
validated payload | + +## Schema5 +public static class Schema5
+extends JsonSchema + +A schema class that validates payloads + +### Code Sample +``` +import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags; +import org.openapijsonschematools.client.configurations.SchemaConfiguration; +import org.openapijsonschematools.client.exceptions.ValidationException; +import org.openapijsonschematools.client.schemas.validation.MapUtils; +import org.openapijsonschematools.client.schemas.validation.FrozenList; +import org.openapijsonschematools.client.schemas.validation.FrozenMap; +import org.openapijsonschematools.client.components.schemas.ComposedOneOfDifferentTypes; + +import java.util.Arrays; +import java.util.List; +import java.util.AbstractMap; + +static final SchemaConfiguration configuration = new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().build()); + +// List validation +ComposedOneOfDifferentTypes.Schema5List validatedPayload = + ComposedOneOfDifferentTypes.Schema5.validate( + new ComposedOneOfDifferentTypes.Schema5ListBuilder() + .build(), + configuration +); +``` + +### Field Summary +| Modifier and Type | Field and Description | +| ----------------- | ---------------------- | +| Set> | type = Set.of(List.class) | +| Class | items = [Items.class](#items) | +| Integer | maxItems = 4 | +| Integer | minItems = 4 | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| [Schema5List](#schema5list) | validate([List](#schema5listbuilder) arg, SchemaConfiguration configuration) | +| [Schema5BoxedList](#schema5boxedlist) | validateAndBox([List](#schema5listbuilder) arg, SchemaConfiguration configuration) | +| [Schema5Boxed](#schema5boxed) | validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) | +| @Nullable Object | validate(@Nullable Object arg, SchemaConfiguration configuration) | + +## Schema5ListBuilder +public class Schema5ListBuilder
+builder for `List<@Nullable Object>` + +A class that builds the List input type + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| Schema5ListBuilder()
Creates an empty list | +| Schema5ListBuilder(List<@Nullable Object> items)
Stores the items in a list | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| Schema5ListBuilder | add(Nothing? item) | +| Schema5ListBuilder | add(boolean item) | +| Schema5ListBuilder | add(String item) | +| Schema5ListBuilder | add(int item) | +| Schema5ListBuilder | add(float item) | +| Schema5ListBuilder | add(long item) | +| Schema5ListBuilder | add(double item) | +| Schema5ListBuilder | add(List item) | +| Schema5ListBuilder | add(Map item) | +| List<@Nullable Object> | build()
Returns list input that should be used with Schema.validate | + +## Schema5List +public class Schema5List
+extends `FrozenList<@Nullable Object>` + +A class to store validated List payloads + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| static [Schema5List](#schema5list) | of([List](#schema5listbuilder) arg, SchemaConfiguration configuration) | + +## ItemsBoxed +public sealed interface ItemsBoxed
+permits
+[ItemsBoxedVoid](#itemsboxedvoid), +[ItemsBoxedBoolean](#itemsboxedboolean), +[ItemsBoxedNumber](#itemsboxednumber), +[ItemsBoxedString](#itemsboxedstring), +[ItemsBoxedList](#itemsboxedlist), +[ItemsBoxedMap](#itemsboxedmap) + +sealed interface that stores validated payloads using boxed classes + +## ItemsBoxedVoid +public record ItemsBoxedVoid
+implements [ItemsBoxed](#itemsboxed) + +record that stores validated null payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| ItemsBoxedVoid(Nothing? data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| Nothing? | data()
validated payload | +| @Nullable Object | getData()
validated payload | + +## ItemsBoxedBoolean +public record ItemsBoxedBoolean
+implements [ItemsBoxed](#itemsboxed) + +record that stores validated boolean payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| ItemsBoxedBoolean(boolean data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| boolean | data()
validated payload | +| @Nullable Object | getData()
validated payload | + +## ItemsBoxedNumber +public record ItemsBoxedNumber
+implements [ItemsBoxed](#itemsboxed) + +record that stores validated Number payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| ItemsBoxedNumber(Number data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| Number | data()
validated payload | +| @Nullable Object | getData()
validated payload | + +## ItemsBoxedString +public record ItemsBoxedString
+implements [ItemsBoxed](#itemsboxed) + +record that stores validated String payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| ItemsBoxedString(String data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| String | data()
validated payload | +| @Nullable Object | getData()
validated payload | + +## ItemsBoxedList +public record ItemsBoxedList
+implements [ItemsBoxed](#itemsboxed) + +record that stores validated List payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| ItemsBoxedList(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 | + +## ItemsBoxedMap +public record ItemsBoxedMap
+implements [ItemsBoxed](#itemsboxed) + +record that stores validated Map payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| ItemsBoxedMap(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 | + +## Items +public static class Items
+extends AnyTypeJsonSchema.AnyTypeJsonSchema1 + +A schema class that validates payloads + +| Methods Inherited from class org.openapijsonschematools.client.schemas.AnyTypeJsonSchema.AnyTypeJsonSchema1 | +| ------------------------------------------------------------------ | +| validate | +| validateAndBox | + +## Schema4Boxed +public sealed interface Schema4Boxed
+permits
+[Schema4BoxedMap](#schema4boxedmap) + +sealed interface that stores validated payloads using boxed classes + +## Schema4BoxedMap +public record Schema4BoxedMap
+implements [Schema4Boxed](#schema4boxed) + +record that stores validated Map payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| Schema4BoxedMap(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 | + +## Schema4 +public static class Schema4
+extends JsonSchema + +A schema class that validates payloads + +### Field Summary +| Modifier and Type | Field and Description | +| ----------------- | ---------------------- | +| Set> | type = Set.of(Map.class) | +| Integer | maxProperties = 4 | +| Integer | minProperties = 4 | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| FrozenMap | validate(Map<?, ?> arg, SchemaConfiguration configuration) | +| [Schema4BoxedMap](#schema4boxedmap) | validateAndBox(Map<?, ?> arg, SchemaConfiguration configuration) | +| [Schema4Boxed](#schema4boxed) | validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) | +| @Nullable Object | validate(@Nullable Object arg, SchemaConfiguration configuration) | + +## Schema3Boxed +public sealed interface Schema3Boxed
+permits
+[Schema3BoxedString](#schema3boxedstring) + +sealed interface that stores validated payloads using boxed classes + +## Schema3BoxedString +public record Schema3BoxedString
+implements [Schema3Boxed](#schema3boxed) + +record that stores validated String payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| Schema3BoxedString(String data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| String | data()
validated payload | +| @Nullable Object | getData()
validated payload | + +## Schema3 +public static class Schema3
+extends DateJsonSchema.DateJsonSchema1 + +A schema class that validates payloads + +| Methods Inherited from class org.openapijsonschematools.client.schemas.DateJsonSchema.DateJsonSchema1 | +| ------------------------------------------------------------------ | +| validate | +| validateAndBox | + +## Schema2Boxed +public sealed interface Schema2Boxed
+permits
+[Schema2BoxedVoid](#schema2boxedvoid) + +sealed interface that stores validated payloads using boxed classes + +## Schema2BoxedVoid +public record Schema2BoxedVoid
+implements [Schema2Boxed](#schema2boxed) + +record that stores validated null payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| Schema2BoxedVoid(Nothing? data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| Nothing? | data()
validated payload | +| @Nullable Object | getData()
validated payload | + +## Schema2 +public static class Schema2
+extends NullJsonSchema.NullJsonSchema1 + +A schema class that validates payloads + +| Methods Inherited from class org.openapijsonschematools.client.schemas.NullJsonSchema.NullJsonSchema1 | +| ------------------------------------------------------------------ | +| validate | +| validateAndBox | + +[[Back to top]](#top) [[Back to Component Schemas]](../../../README.md#Component-Schemas) [[Back to README]](../../../README.md) diff --git a/samples/client/petstore/kotlin/docs/components/schemas/ComposedString.md b/samples/client/petstore/kotlin/docs/components/schemas/ComposedString.md new file mode 100644 index 00000000000..dc49afc203b --- /dev/null +++ b/samples/client/petstore/kotlin/docs/components/schemas/ComposedString.md @@ -0,0 +1,217 @@ +# ComposedString +org.openapijsonschematools.client.components.schemas.ComposedString.java +public class ComposedString
+ +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 + +## Nested Class Summary +| Modifier and Type | Class and Description | +| ----------------- | ---------------------- | +| sealed interface | [ComposedString.ComposedString1Boxed](#composedstring1boxed)
sealed interface for validated payloads | +| record | [ComposedString.ComposedString1BoxedString](#composedstring1boxedstring)
boxed class to store validated String payloads | +| static class | [ComposedString.ComposedString1](#composedstring1)
schema class | +| sealed interface | [ComposedString.Schema0Boxed](#schema0boxed)
sealed interface for validated payloads | +| record | [ComposedString.Schema0BoxedVoid](#schema0boxedvoid)
boxed class to store validated null payloads | +| record | [ComposedString.Schema0BoxedBoolean](#schema0boxedboolean)
boxed class to store validated boolean payloads | +| record | [ComposedString.Schema0BoxedNumber](#schema0boxednumber)
boxed class to store validated Number payloads | +| record | [ComposedString.Schema0BoxedString](#schema0boxedstring)
boxed class to store validated String payloads | +| record | [ComposedString.Schema0BoxedList](#schema0boxedlist)
boxed class to store validated List payloads | +| record | [ComposedString.Schema0BoxedMap](#schema0boxedmap)
boxed class to store validated Map payloads | +| static class | [ComposedString.Schema0](#schema0)
schema class | + +## ComposedString1Boxed +public sealed interface ComposedString1Boxed
+permits
+[ComposedString1BoxedString](#composedstring1boxedstring) + +sealed interface that stores validated payloads using boxed classes + +## ComposedString1BoxedString +public record ComposedString1BoxedString
+implements [ComposedString1Boxed](#composedstring1boxed) + +record that stores validated String payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| ComposedString1BoxedString(String data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| String | data()
validated payload | +| @Nullable Object | getData()
validated payload | + +## ComposedString1 +public static class ComposedString1
+extends JsonSchema + +A schema class that validates payloads + +### Code Sample +``` +import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags; +import org.openapijsonschematools.client.configurations.SchemaConfiguration; +import org.openapijsonschematools.client.exceptions.ValidationException; +import org.openapijsonschematools.client.schemas.validation.MapUtils; +import org.openapijsonschematools.client.schemas.validation.FrozenList; +import org.openapijsonschematools.client.schemas.validation.FrozenMap; +import org.openapijsonschematools.client.components.schemas.ComposedString; + +import java.util.Arrays; +import java.util.List; +import java.util.AbstractMap; + +static final SchemaConfiguration configuration = new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().build()); + +// String validation +String validatedPayload = ComposedString.ComposedString1.validate( + "a", + configuration +); +``` + +### Field Summary +| Modifier and Type | Field and Description | +| ----------------- | ---------------------- | +| Set> | type = Set.of(
    String.class
)
| +| List> | allOf = List.of(
    [Schema0.class](#schema0)
;)
| + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| String | validate(String arg, SchemaConfiguration configuration) | +| [ComposedString1BoxedString](#composedstring1boxedstring) | validateAndBox(String arg, SchemaConfiguration configuration) | +| [ComposedString1Boxed](#composedstring1boxed) | validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) | +| @Nullable Object | validate(@Nullable Object arg, SchemaConfiguration configuration) | + +## Schema0Boxed +public sealed interface Schema0Boxed
+permits
+[Schema0BoxedVoid](#schema0boxedvoid), +[Schema0BoxedBoolean](#schema0boxedboolean), +[Schema0BoxedNumber](#schema0boxednumber), +[Schema0BoxedString](#schema0boxedstring), +[Schema0BoxedList](#schema0boxedlist), +[Schema0BoxedMap](#schema0boxedmap) + +sealed interface that stores validated payloads using boxed classes + +## Schema0BoxedVoid +public record Schema0BoxedVoid
+implements [Schema0Boxed](#schema0boxed) + +record that stores validated null payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| Schema0BoxedVoid(Nothing? data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| Nothing? | data()
validated payload | +| @Nullable Object | getData()
validated payload | + +## Schema0BoxedBoolean +public record Schema0BoxedBoolean
+implements [Schema0Boxed](#schema0boxed) + +record that stores validated boolean payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| Schema0BoxedBoolean(boolean data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| boolean | data()
validated payload | +| @Nullable Object | getData()
validated payload | + +## Schema0BoxedNumber +public record Schema0BoxedNumber
+implements [Schema0Boxed](#schema0boxed) + +record that stores validated Number payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| Schema0BoxedNumber(Number data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| Number | data()
validated payload | +| @Nullable Object | getData()
validated payload | + +## Schema0BoxedString +public record Schema0BoxedString
+implements [Schema0Boxed](#schema0boxed) + +record that stores validated String payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| Schema0BoxedString(String data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| String | data()
validated payload | +| @Nullable Object | getData()
validated payload | + +## Schema0BoxedList +public record Schema0BoxedList
+implements [Schema0Boxed](#schema0boxed) + +record that stores validated List payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| Schema0BoxedList(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 | + +## Schema0BoxedMap +public record Schema0BoxedMap
+implements [Schema0Boxed](#schema0boxed) + +record that stores validated Map payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| Schema0BoxedMap(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 | + +## Schema0 +public static class Schema0
+extends AnyTypeJsonSchema.AnyTypeJsonSchema1 + +A schema class that validates payloads + +| Methods Inherited from class org.openapijsonschematools.client.schemas.AnyTypeJsonSchema.AnyTypeJsonSchema1 | +| ------------------------------------------------------------------ | +| validate | +| validateAndBox | + +[[Back to top]](#top) [[Back to Component Schemas]](../../../README.md#Component-Schemas) [[Back to README]](../../../README.md) diff --git a/samples/client/petstore/kotlin/docs/components/schemas/Currency.md b/samples/client/petstore/kotlin/docs/components/schemas/Currency.md new file mode 100644 index 00000000000..0823b95de18 --- /dev/null +++ b/samples/client/petstore/kotlin/docs/components/schemas/Currency.md @@ -0,0 +1,99 @@ +# Currency +org.openapijsonschematools.client.components.schemas.Currency.java +public class Currency
+ +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 +- enum classes + +## Nested Class Summary +| Modifier and Type | Class and Description | +| ----------------- | ---------------------- | +| sealed interface | [Currency.Currency1Boxed](#currency1boxed)
sealed interface for validated payloads | +| record | [Currency.Currency1BoxedString](#currency1boxedstring)
boxed class to store validated String payloads | +| static class | [Currency.Currency1](#currency1)
schema class | +| enum | [Currency.StringCurrencyEnums](#stringcurrencyenums)
String enum | + +## Currency1Boxed +public sealed interface Currency1Boxed
+permits
+[Currency1BoxedString](#currency1boxedstring) + +sealed interface that stores validated payloads using boxed classes + +## Currency1BoxedString +public record Currency1BoxedString
+implements [Currency1Boxed](#currency1boxed) + +record that stores validated String payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| Currency1BoxedString(String data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| String | data()
validated payload | +| @Nullable Object | getData()
validated payload | + +## Currency1 +public static class Currency1
+extends JsonSchema + +A schema class that validates payloads + +### Code Sample +``` +import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags; +import org.openapijsonschematools.client.configurations.SchemaConfiguration; +import org.openapijsonschematools.client.exceptions.ValidationException; +import org.openapijsonschematools.client.schemas.validation.MapUtils; +import org.openapijsonschematools.client.schemas.validation.FrozenList; +import org.openapijsonschematools.client.schemas.validation.FrozenMap; +import org.openapijsonschematools.client.components.schemas.Currency; + +import java.util.Arrays; +import java.util.List; +import java.util.AbstractMap; + +static final SchemaConfiguration configuration = new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().build()); + +// String validation +String validatedPayload = Currency.Currency1.validate( + "eur", + configuration +); +``` + +### Field Summary +| Modifier and Type | Field and Description | +| ----------------- | ---------------------- | +| Set> | type = Set.of(
    String.class
)
| +| Set | enumValues = SetMaker.makeSet(
    "eur",
    "usd"
)
| + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| String | validate(String arg, SchemaConfiguration configuration) | +| String | validate([StringCurrencyEnums](#stringcurrencyenums) arg, SchemaConfiguration configuration) | +| [Currency1BoxedString](#currency1boxedstring) | validateAndBox(String arg, SchemaConfiguration configuration) | +| [Currency1Boxed](#currency1boxed) | validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) | +| @Nullable Object | validate(@Nullable Object arg, SchemaConfiguration configuration) | + +## StringCurrencyEnums +public enum StringCurrencyEnums
+extends `Enum` + +A class that stores String enum values + +### Enum Constant Summary +| Enum Constant | Description | +| ------------- | ----------- | +| EUR | value = "eur" | +| USD | value = "usd" | + +[[Back to top]](#top) [[Back to Component Schemas]](../../../README.md#Component-Schemas) [[Back to README]](../../../README.md) diff --git a/samples/client/petstore/kotlin/docs/components/schemas/DanishPig.md b/samples/client/petstore/kotlin/docs/components/schemas/DanishPig.md new file mode 100644 index 00000000000..7515796e1ea --- /dev/null +++ b/samples/client/petstore/kotlin/docs/components/schemas/DanishPig.md @@ -0,0 +1,232 @@ +# DanishPig +org.openapijsonschematools.client.components.schemas.DanishPig.java +public class DanishPig
+ +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 | [DanishPig.DanishPig1Boxed](#danishpig1boxed)
sealed interface for validated payloads | +| record | [DanishPig.DanishPig1BoxedMap](#danishpig1boxedmap)
boxed class to store validated Map payloads | +| static class | [DanishPig.DanishPig1](#danishpig1)
schema class | +| static class | [DanishPig.DanishPigMapBuilder](#danishpigmapbuilder)
builder for Map payloads | +| static class | [DanishPig.DanishPigMap](#danishpigmap)
output class for Map payloads | +| sealed interface | [DanishPig.ClassNameBoxed](#classnameboxed)
sealed interface for validated payloads | +| record | [DanishPig.ClassNameBoxedString](#classnameboxedstring)
boxed class to store validated String payloads | +| static class | [DanishPig.ClassName](#classname)
schema class | +| enum | [DanishPig.StringClassNameEnums](#stringclassnameenums)
String enum | + +## DanishPig1Boxed +public sealed interface DanishPig1Boxed
+permits
+[DanishPig1BoxedMap](#danishpig1boxedmap) + +sealed interface that stores validated payloads using boxed classes + +## DanishPig1BoxedMap +public record DanishPig1BoxedMap
+implements [DanishPig1Boxed](#danishpig1boxed) + +record that stores validated Map payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| DanishPig1BoxedMap([DanishPigMap](#danishpigmap) data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| [DanishPigMap](#danishpigmap) | data()
validated payload | +| @Nullable Object | getData()
validated payload | + +## DanishPig1 +public static class DanishPig1
+extends JsonSchema + +A schema class that validates payloads + +### Code Sample +``` +import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags; +import org.openapijsonschematools.client.configurations.SchemaConfiguration; +import org.openapijsonschematools.client.exceptions.ValidationException; +import org.openapijsonschematools.client.schemas.validation.MapUtils; +import org.openapijsonschematools.client.schemas.validation.FrozenList; +import org.openapijsonschematools.client.schemas.validation.FrozenMap; +import org.openapijsonschematools.client.components.schemas.DanishPig; + +import java.util.Arrays; +import java.util.List; +import java.util.AbstractMap; + +static final SchemaConfiguration configuration = new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().build()); + +// Map validation +DanishPig.DanishPigMap validatedPayload = + DanishPig.DanishPig1.validate( + new DanishPig.DanishPigMapBuilder() + .className("DanishPig") + + .build(), + configuration +); +``` + +### Field Summary +| Modifier and Type | Field and Description | +| ----------------- | ---------------------- | +| Set> | type = Set.of(Map.class) | +| Map> | properties = Map.ofEntries(
    new PropertyEntry("className", [ClassName.class](#classname)))
)
| +| Set | required = Set.of(
    "className"
)
| + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| [DanishPigMap](#danishpigmap) | validate([Map<?, ?>](#danishpigmapbuilder) arg, SchemaConfiguration configuration) | +| [DanishPig1BoxedMap](#danishpig1boxedmap) | validateAndBox([Map<?, ?>](#danishpigmapbuilder) arg, SchemaConfiguration configuration) | +| [DanishPig1Boxed](#danishpig1boxed) | validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) | +| @Nullable Object | validate(@Nullable Object arg, SchemaConfiguration configuration) | + +## DanishPigMap0Builder +public class DanishPigMap0Builder
+builder for `Map` + +A class that builds the Map input type + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| DanishPigMap0Builder(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 | +| [DanishPigMap0Builder](#danishpigmap0builder) | additionalProperty(String key, Nothing? value) | +| [DanishPigMap0Builder](#danishpigmap0builder) | additionalProperty(String key, boolean value) | +| [DanishPigMap0Builder](#danishpigmap0builder) | additionalProperty(String key, String value) | +| [DanishPigMap0Builder](#danishpigmap0builder) | additionalProperty(String key, int value) | +| [DanishPigMap0Builder](#danishpigmap0builder) | additionalProperty(String key, float value) | +| [DanishPigMap0Builder](#danishpigmap0builder) | additionalProperty(String key, long value) | +| [DanishPigMap0Builder](#danishpigmap0builder) | additionalProperty(String key, double value) | +| [DanishPigMap0Builder](#danishpigmap0builder) | additionalProperty(String key, List value) | +| [DanishPigMap0Builder](#danishpigmap0builder) | additionalProperty(String key, Map value) | + +## DanishPigMapBuilder +public class DanishPigMapBuilder
+builder for `Map` + +A class that builds the Map input type + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| DanishPigMapBuilder()
Creates a builder that contains an empty map | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| [DanishPigMap0Builder](#danishpigmap0builder) | className(String value) | +| [DanishPigMap0Builder](#danishpigmap0builder) | className([StringClassNameEnums](#stringclassnameenums) value) | + +## DanishPigMap +public static class DanishPigMap
+extends FrozenMap + +A class to store validated Map payloads + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| static [DanishPigMap](#danishpigmap) | of([Map](#danishpigmapbuilder) arg, SchemaConfiguration configuration) | +| String | className()
must be one of ["DanishPig"] | +| @Nullable Object | getAdditionalProperty(String name)
provides type safety for additional properties | + +## ClassNameBoxed +public sealed interface ClassNameBoxed
+permits
+[ClassNameBoxedString](#classnameboxedstring) + +sealed interface that stores validated payloads using boxed classes + +## ClassNameBoxedString +public record ClassNameBoxedString
+implements [ClassNameBoxed](#classnameboxed) + +record that stores validated String payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| ClassNameBoxedString(String data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| String | data()
validated payload | +| @Nullable Object | getData()
validated payload | + +## ClassName +public static class ClassName
+extends JsonSchema + +A schema class that validates payloads + +### Code Sample +``` +import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags; +import org.openapijsonschematools.client.configurations.SchemaConfiguration; +import org.openapijsonschematools.client.exceptions.ValidationException; +import org.openapijsonschematools.client.schemas.validation.MapUtils; +import org.openapijsonschematools.client.schemas.validation.FrozenList; +import org.openapijsonschematools.client.schemas.validation.FrozenMap; +import org.openapijsonschematools.client.components.schemas.DanishPig; + +import java.util.Arrays; +import java.util.List; +import java.util.AbstractMap; + +static final SchemaConfiguration configuration = new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().build()); + +// String validation +String validatedPayload = DanishPig.ClassName.validate( + "DanishPig", + configuration +); +``` + +### Field Summary +| Modifier and Type | Field and Description | +| ----------------- | ---------------------- | +| Set> | type = Set.of(
    String.class
)
| +| Set | enumValues = SetMaker.makeSet(
    "DanishPig"
)
| + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| String | validate(String arg, SchemaConfiguration configuration) | +| String | validate([StringClassNameEnums](#stringclassnameenums) arg, SchemaConfiguration configuration) | +| [ClassNameBoxedString](#classnameboxedstring) | validateAndBox(String arg, SchemaConfiguration configuration) | +| [ClassNameBoxed](#classnameboxed) | validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) | +| @Nullable Object | validate(@Nullable Object arg, SchemaConfiguration configuration) | + +## StringClassNameEnums +public enum StringClassNameEnums
+extends `Enum` + +A class that stores String enum values + +### Enum Constant Summary +| Enum Constant | Description | +| ------------- | ----------- | +| DANISH_PIG | value = "DanishPig" | + +[[Back to top]](#top) [[Back to Component Schemas]](../../../README.md#Component-Schemas) [[Back to README]](../../../README.md) diff --git a/samples/client/petstore/kotlin/docs/components/schemas/DateTimeTest.md b/samples/client/petstore/kotlin/docs/components/schemas/DateTimeTest.md new file mode 100644 index 00000000000..e6c590b86bf --- /dev/null +++ b/samples/client/petstore/kotlin/docs/components/schemas/DateTimeTest.md @@ -0,0 +1,85 @@ +# DateTimeTest +org.openapijsonschematools.client.components.schemas.DateTimeTest.java +public class DateTimeTest
+ +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 + +## Nested Class Summary +| Modifier and Type | Class and Description | +| ----------------- | ---------------------- | +| sealed interface | [DateTimeTest.DateTimeTest1Boxed](#datetimetest1boxed)
sealed interface for validated payloads | +| record | [DateTimeTest.DateTimeTest1BoxedString](#datetimetest1boxedstring)
boxed class to store validated String payloads | +| static class | [DateTimeTest.DateTimeTest1](#datetimetest1)
schema class | + +## DateTimeTest1Boxed +public sealed interface DateTimeTest1Boxed
+permits
+[DateTimeTest1BoxedString](#datetimetest1boxedstring) + +sealed interface that stores validated payloads using boxed classes + +## DateTimeTest1BoxedString +public record DateTimeTest1BoxedString
+implements [DateTimeTest1Boxed](#datetimetest1boxed) + +record that stores validated String payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| DateTimeTest1BoxedString(String data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| String | data()
validated payload | +| @Nullable Object | getData()
validated payload | + +## DateTimeTest1 +public static class DateTimeTest1
+extends JsonSchema + +A schema class that validates payloads + +### Code Sample +``` +import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags; +import org.openapijsonschematools.client.configurations.SchemaConfiguration; +import org.openapijsonschematools.client.exceptions.ValidationException; +import org.openapijsonschematools.client.schemas.validation.MapUtils; +import org.openapijsonschematools.client.schemas.validation.FrozenList; +import org.openapijsonschematools.client.schemas.validation.FrozenMap; +import org.openapijsonschematools.client.components.schemas.DateTimeTest; + +import java.util.Arrays; +import java.util.List; +import java.util.AbstractMap; + +static final SchemaConfiguration configuration = new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().build()); + +// String validation +String validatedPayload = DateTimeTest.DateTimeTest1.validate( + "1970-01-01T00:00:00.00Z", + configuration +); +``` + +### Field Summary +| Modifier and Type | Field and Description | +| ----------------- | ---------------------- | +| Set> | type = Set.of(
    String.class
)
| +| String | type = "date-time"; | +| @Nullable Object | defaultValue = "2010-01-01T10:10:10.000111+01:00" | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| String | validate(String arg, SchemaConfiguration configuration) | +| [DateTimeTest1BoxedString](#datetimetest1boxedstring) | validateAndBox(String arg, SchemaConfiguration configuration) | +| [DateTimeTest1Boxed](#datetimetest1boxed) | validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) | +| @Nullable Object | validate(@Nullable Object arg, SchemaConfiguration configuration) | + +[[Back to top]](#top) [[Back to Component Schemas]](../../../README.md#Component-Schemas) [[Back to README]](../../../README.md) diff --git a/samples/client/petstore/kotlin/docs/components/schemas/DateTimeWithValidations.md b/samples/client/petstore/kotlin/docs/components/schemas/DateTimeWithValidations.md new file mode 100644 index 00000000000..ac9b22fe003 --- /dev/null +++ b/samples/client/petstore/kotlin/docs/components/schemas/DateTimeWithValidations.md @@ -0,0 +1,85 @@ +# DateTimeWithValidations +org.openapijsonschematools.client.components.schemas.DateTimeWithValidations.java +public class DateTimeWithValidations
+ +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 + +## Nested Class Summary +| Modifier and Type | Class and Description | +| ----------------- | ---------------------- | +| sealed interface | [DateTimeWithValidations.DateTimeWithValidations1Boxed](#datetimewithvalidations1boxed)
sealed interface for validated payloads | +| record | [DateTimeWithValidations.DateTimeWithValidations1BoxedString](#datetimewithvalidations1boxedstring)
boxed class to store validated String payloads | +| static class | [DateTimeWithValidations.DateTimeWithValidations1](#datetimewithvalidations1)
schema class | + +## DateTimeWithValidations1Boxed +public sealed interface DateTimeWithValidations1Boxed
+permits
+[DateTimeWithValidations1BoxedString](#datetimewithvalidations1boxedstring) + +sealed interface that stores validated payloads using boxed classes + +## DateTimeWithValidations1BoxedString +public record DateTimeWithValidations1BoxedString
+implements [DateTimeWithValidations1Boxed](#datetimewithvalidations1boxed) + +record that stores validated String payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| DateTimeWithValidations1BoxedString(String data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| String | data()
validated payload | +| @Nullable Object | getData()
validated payload | + +## DateTimeWithValidations1 +public static class DateTimeWithValidations1
+extends JsonSchema + +A schema class that validates payloads + +### Code Sample +``` +import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags; +import org.openapijsonschematools.client.configurations.SchemaConfiguration; +import org.openapijsonschematools.client.exceptions.ValidationException; +import org.openapijsonschematools.client.schemas.validation.MapUtils; +import org.openapijsonschematools.client.schemas.validation.FrozenList; +import org.openapijsonschematools.client.schemas.validation.FrozenMap; +import org.openapijsonschematools.client.components.schemas.DateTimeWithValidations; + +import java.util.Arrays; +import java.util.List; +import java.util.AbstractMap; + +static final SchemaConfiguration configuration = new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().build()); + +// String validation +String validatedPayload = DateTimeWithValidations.DateTimeWithValidations1.validate( + "2020jUR,rZ#UM/?R,Fp^l6$ARj", + configuration +); +``` + +### Field Summary +| Modifier and Type | Field and Description | +| ----------------- | ---------------------- | +| Set> | type = Set.of(
    String.class
)
| +| String | type = "date-time"; | +| Pattern | pattern = Pattern.compile(
    "^2020.*"
)
| + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| String | validate(String arg, SchemaConfiguration configuration) | +| [DateTimeWithValidations1BoxedString](#datetimewithvalidations1boxedstring) | validateAndBox(String arg, SchemaConfiguration configuration) | +| [DateTimeWithValidations1Boxed](#datetimewithvalidations1boxed) | validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) | +| @Nullable Object | validate(@Nullable Object arg, SchemaConfiguration configuration) | + +[[Back to top]](#top) [[Back to Component Schemas]](../../../README.md#Component-Schemas) [[Back to README]](../../../README.md) diff --git a/samples/client/petstore/kotlin/docs/components/schemas/DateWithValidations.md b/samples/client/petstore/kotlin/docs/components/schemas/DateWithValidations.md new file mode 100644 index 00000000000..3e3a7e44641 --- /dev/null +++ b/samples/client/petstore/kotlin/docs/components/schemas/DateWithValidations.md @@ -0,0 +1,85 @@ +# DateWithValidations +org.openapijsonschematools.client.components.schemas.DateWithValidations.java +public class DateWithValidations
+ +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 + +## Nested Class Summary +| Modifier and Type | Class and Description | +| ----------------- | ---------------------- | +| sealed interface | [DateWithValidations.DateWithValidations1Boxed](#datewithvalidations1boxed)
sealed interface for validated payloads | +| record | [DateWithValidations.DateWithValidations1BoxedString](#datewithvalidations1boxedstring)
boxed class to store validated String payloads | +| static class | [DateWithValidations.DateWithValidations1](#datewithvalidations1)
schema class | + +## DateWithValidations1Boxed +public sealed interface DateWithValidations1Boxed
+permits
+[DateWithValidations1BoxedString](#datewithvalidations1boxedstring) + +sealed interface that stores validated payloads using boxed classes + +## DateWithValidations1BoxedString +public record DateWithValidations1BoxedString
+implements [DateWithValidations1Boxed](#datewithvalidations1boxed) + +record that stores validated String payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| DateWithValidations1BoxedString(String data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| String | data()
validated payload | +| @Nullable Object | getData()
validated payload | + +## DateWithValidations1 +public static class DateWithValidations1
+extends JsonSchema + +A schema class that validates payloads + +### Code Sample +``` +import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags; +import org.openapijsonschematools.client.configurations.SchemaConfiguration; +import org.openapijsonschematools.client.exceptions.ValidationException; +import org.openapijsonschematools.client.schemas.validation.MapUtils; +import org.openapijsonschematools.client.schemas.validation.FrozenList; +import org.openapijsonschematools.client.schemas.validation.FrozenMap; +import org.openapijsonschematools.client.components.schemas.DateWithValidations; + +import java.util.Arrays; +import java.util.List; +import java.util.AbstractMap; + +static final SchemaConfiguration configuration = new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().build()); + +// String validation +String validatedPayload = DateWithValidations.DateWithValidations1.validate( + "2020jUR,rZ#UM/?R,Fp^l6$ARj", + configuration +); +``` + +### Field Summary +| Modifier and Type | Field and Description | +| ----------------- | ---------------------- | +| Set> | type = Set.of(
    String.class
)
| +| String | type = "date"; | +| Pattern | pattern = Pattern.compile(
    "^2020.*"
)
| + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| String | validate(String arg, SchemaConfiguration configuration) | +| [DateWithValidations1BoxedString](#datewithvalidations1boxedstring) | validateAndBox(String arg, SchemaConfiguration configuration) | +| [DateWithValidations1Boxed](#datewithvalidations1boxed) | validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) | +| @Nullable Object | validate(@Nullable Object arg, SchemaConfiguration configuration) | + +[[Back to top]](#top) [[Back to Component Schemas]](../../../README.md#Component-Schemas) [[Back to README]](../../../README.md) diff --git a/samples/client/petstore/kotlin/docs/components/schemas/DecimalPayload.md b/samples/client/petstore/kotlin/docs/components/schemas/DecimalPayload.md new file mode 100644 index 00000000000..d9431cd5451 --- /dev/null +++ b/samples/client/petstore/kotlin/docs/components/schemas/DecimalPayload.md @@ -0,0 +1,52 @@ +# DecimalPayload +org.openapijsonschematools.client.components.schemas.DecimalPayload.java +public class DecimalPayload
+ +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 + +## Nested Class Summary +| Modifier and Type | Class and Description | +| ----------------- | ---------------------- | +| sealed interface | [DecimalPayload.DecimalPayload1Boxed](#decimalpayload1boxed)
sealed interface for validated payloads | +| record | [DecimalPayload.DecimalPayload1BoxedString](#decimalpayload1boxedstring)
boxed class to store validated String payloads | +| static class | [DecimalPayload.DecimalPayload1](#decimalpayload1)
schema class | + +## DecimalPayload1Boxed +public sealed interface DecimalPayload1Boxed
+permits
+[DecimalPayload1BoxedString](#decimalpayload1boxedstring) + +sealed interface that stores validated payloads using boxed classes + +## DecimalPayload1BoxedString +public record DecimalPayload1BoxedString
+implements [DecimalPayload1Boxed](#decimalpayload1boxed) + +record that stores validated String payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| DecimalPayload1BoxedString(String data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| String | data()
validated payload | +| @Nullable Object | getData()
validated payload | + +## DecimalPayload1 +public static class DecimalPayload1
+extends DecimalJsonSchema.DecimalJsonSchema1 + +A schema class that validates payloads + +| Methods Inherited from class org.openapijsonschematools.client.schemas.DecimalJsonSchema.DecimalJsonSchema1 | +| ------------------------------------------------------------------ | +| validate | +| validateAndBox | + +[[Back to top]](#top) [[Back to Component Schemas]](../../../README.md#Component-Schemas) [[Back to README]](../../../README.md) diff --git a/samples/client/petstore/kotlin/docs/components/schemas/Dog.md b/samples/client/petstore/kotlin/docs/components/schemas/Dog.md new file mode 100644 index 00000000000..2355b75a20a --- /dev/null +++ b/samples/client/petstore/kotlin/docs/components/schemas/Dog.md @@ -0,0 +1,324 @@ +# Dog +org.openapijsonschematools.client.components.schemas.Dog.java +public class Dog
+ +A class that contains necessary nested +- schema classes (which validate payloads), extends JsonSchema +- sealed interfaces which store validated payloads, java version of a sum type +- boxed classes which store validated payloads, sealed permits class implementations +- classes to store validated map payloads, extends FrozenMap +- classes to build inputs for map payloads + +## Nested Class Summary +| Modifier and Type | Class and Description | +| ----------------- | ---------------------- | +| sealed interface | [Dog.Dog1Boxed](#dog1boxed)
sealed interface for validated payloads | +| record | [Dog.Dog1BoxedVoid](#dog1boxedvoid)
boxed class to store validated null payloads | +| record | [Dog.Dog1BoxedBoolean](#dog1boxedboolean)
boxed class to store validated boolean payloads | +| record | [Dog.Dog1BoxedNumber](#dog1boxednumber)
boxed class to store validated Number payloads | +| record | [Dog.Dog1BoxedString](#dog1boxedstring)
boxed class to store validated String payloads | +| record | [Dog.Dog1BoxedList](#dog1boxedlist)
boxed class to store validated List payloads | +| record | [Dog.Dog1BoxedMap](#dog1boxedmap)
boxed class to store validated Map payloads | +| static class | [Dog.Dog1](#dog1)
schema class | +| sealed interface | [Dog.Schema1Boxed](#schema1boxed)
sealed interface for validated payloads | +| record | [Dog.Schema1BoxedMap](#schema1boxedmap)
boxed class to store validated Map payloads | +| static class | [Dog.Schema1](#schema1)
schema class | +| static class | [Dog.Schema1MapBuilder](#schema1mapbuilder)
builder for Map payloads | +| static class | [Dog.Schema1Map](#schema1map)
output class for Map payloads | +| sealed interface | [Dog.BreedBoxed](#breedboxed)
sealed interface for validated payloads | +| record | [Dog.BreedBoxedString](#breedboxedstring)
boxed class to store validated String payloads | +| static class | [Dog.Breed](#breed)
schema class | + +## Dog1Boxed +public sealed interface Dog1Boxed
+permits
+[Dog1BoxedVoid](#dog1boxedvoid), +[Dog1BoxedBoolean](#dog1boxedboolean), +[Dog1BoxedNumber](#dog1boxednumber), +[Dog1BoxedString](#dog1boxedstring), +[Dog1BoxedList](#dog1boxedlist), +[Dog1BoxedMap](#dog1boxedmap) + +sealed interface that stores validated payloads using boxed classes + +## Dog1BoxedVoid +public record Dog1BoxedVoid
+implements [Dog1Boxed](#dog1boxed) + +record that stores validated null payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| Dog1BoxedVoid(Nothing? data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| Nothing? | data()
validated payload | +| @Nullable Object | getData()
validated payload | + +## Dog1BoxedBoolean +public record Dog1BoxedBoolean
+implements [Dog1Boxed](#dog1boxed) + +record that stores validated boolean payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| Dog1BoxedBoolean(boolean data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| boolean | data()
validated payload | +| @Nullable Object | getData()
validated payload | + +## Dog1BoxedNumber +public record Dog1BoxedNumber
+implements [Dog1Boxed](#dog1boxed) + +record that stores validated Number payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| Dog1BoxedNumber(Number data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| Number | data()
validated payload | +| @Nullable Object | getData()
validated payload | + +## Dog1BoxedString +public record Dog1BoxedString
+implements [Dog1Boxed](#dog1boxed) + +record that stores validated String payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| Dog1BoxedString(String data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| String | data()
validated payload | +| @Nullable Object | getData()
validated payload | + +## Dog1BoxedList +public record Dog1BoxedList
+implements [Dog1Boxed](#dog1boxed) + +record that stores validated List payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| Dog1BoxedList(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 | + +## Dog1BoxedMap +public record Dog1BoxedMap
+implements [Dog1Boxed](#dog1boxed) + +record that stores validated Map payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| Dog1BoxedMap(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 | + +## Dog1 +public static class Dog1
+extends JsonSchema + +A schema class that validates payloads + +### Field Summary +| Modifier and Type | Field and Description | +| ----------------- | ---------------------- | +| List> | allOf = List.of(
    [Animal.Animal1.class](../../components/schemas/Animal.md#animal1),
    [Schema1.class](#schema1)
;)
| + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| String | validate(String arg, SchemaConfiguration configuration) | +| Nothing? | validate(Nothing? arg, SchemaConfiguration configuration) | +| int | validate(int arg, SchemaConfiguration configuration) | +| long | validate(long arg, SchemaConfiguration configuration) | +| float | validate(float arg, SchemaConfiguration configuration) | +| double | validate(double arg, SchemaConfiguration configuration) | +| Number | validate(Number arg, SchemaConfiguration configuration) | +| boolean | validate(boolean arg, SchemaConfiguration configuration) | +| FrozenMap<@Nullable Object> | validate(Map<?, ?> arg, SchemaConfiguration configuration) | +| FrozenList<@Nullable Object> | validate(List arg, SchemaConfiguration configuration) | +| [Dog1BoxedString](#dog1boxedstring) | validateAndBox(String arg, SchemaConfiguration configuration) | +| [Dog1BoxedVoid](#dog1boxedvoid) | validateAndBox(Nothing? arg, SchemaConfiguration configuration) | +| [Dog1BoxedNumber](#dog1boxednumber) | validateAndBox(Number arg, SchemaConfiguration configuration) | +| [Dog1BoxedBoolean](#dog1boxedboolean) | validateAndBox(boolean arg, SchemaConfiguration configuration) | +| [Dog1BoxedMap](#dog1boxedmap) | validateAndBox(Map<?, ?> arg, SchemaConfiguration configuration) | +| [Dog1BoxedList](#dog1boxedlist) | validateAndBox(List arg, SchemaConfiguration configuration) | +| [Dog1Boxed](#dog1boxed) | validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) | +| @Nullable Object | validate(@Nullable Object arg, SchemaConfiguration configuration) | + +## Schema1Boxed +public sealed interface Schema1Boxed
+permits
+[Schema1BoxedMap](#schema1boxedmap) + +sealed interface that stores validated payloads using boxed classes + +## Schema1BoxedMap +public record Schema1BoxedMap
+implements [Schema1Boxed](#schema1boxed) + +record that stores validated Map payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| Schema1BoxedMap([Schema1Map](#schema1map) data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| [Schema1Map](#schema1map) | data()
validated payload | +| @Nullable Object | getData()
validated payload | + +## Schema1 +public static class Schema1
+extends JsonSchema + +A schema class that validates payloads + +### Code Sample +``` +import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags; +import org.openapijsonschematools.client.configurations.SchemaConfiguration; +import org.openapijsonschematools.client.exceptions.ValidationException; +import org.openapijsonschematools.client.schemas.validation.MapUtils; +import org.openapijsonschematools.client.schemas.validation.FrozenList; +import org.openapijsonschematools.client.schemas.validation.FrozenMap; +import org.openapijsonschematools.client.components.schemas.Dog; + +import java.util.Arrays; +import java.util.List; +import java.util.AbstractMap; + +static final SchemaConfiguration configuration = new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().build()); + +// Map validation +Dog.Schema1Map validatedPayload = + Dog.Schema1.validate( + new Dog.Schema1MapBuilder() + .breed("a") + + .build(), + configuration +); +``` + +### Field Summary +| Modifier and Type | Field and Description | +| ----------------- | ---------------------- | +| Set> | type = Set.of(Map.class) | +| Map> | properties = Map.ofEntries(
    new PropertyEntry("breed", [Breed.class](#breed)))
)
| + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| [Schema1Map](#schema1map) | validate([Map<?, ?>](#schema1mapbuilder) arg, SchemaConfiguration configuration) | +| [Schema1BoxedMap](#schema1boxedmap) | validateAndBox([Map<?, ?>](#schema1mapbuilder) arg, SchemaConfiguration configuration) | +| [Schema1Boxed](#schema1boxed) | validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) | +| @Nullable Object | validate(@Nullable Object arg, SchemaConfiguration configuration) | + +## Schema1MapBuilder +public class Schema1MapBuilder
+builder for `Map` + +A class that builds the Map input type + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| Schema1MapBuilder()
Creates a builder that contains an empty map | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| Map | build()
Returns map input that should be used with Schema.validate | +| [Schema1MapBuilder](#schema1mapbuilder) | breed(String value) | +| [Schema1MapBuilder](#schema1mapbuilder) | additionalProperty(String key, Nothing? value) | +| [Schema1MapBuilder](#schema1mapbuilder) | additionalProperty(String key, boolean value) | +| [Schema1MapBuilder](#schema1mapbuilder) | additionalProperty(String key, String value) | +| [Schema1MapBuilder](#schema1mapbuilder) | additionalProperty(String key, int value) | +| [Schema1MapBuilder](#schema1mapbuilder) | additionalProperty(String key, float value) | +| [Schema1MapBuilder](#schema1mapbuilder) | additionalProperty(String key, long value) | +| [Schema1MapBuilder](#schema1mapbuilder) | additionalProperty(String key, double value) | +| [Schema1MapBuilder](#schema1mapbuilder) | additionalProperty(String key, List value) | +| [Schema1MapBuilder](#schema1mapbuilder) | additionalProperty(String key, Map value) | + +## Schema1Map +public static class Schema1Map
+extends FrozenMap + +A class to store validated Map payloads + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| static [Schema1Map](#schema1map) | of([Map](#schema1mapbuilder) arg, SchemaConfiguration configuration) | +| String | breed()
[optional] | +| @Nullable Object | getAdditionalProperty(String name)
provides type safety for additional properties | + +## BreedBoxed +public sealed interface BreedBoxed
+permits
+[BreedBoxedString](#breedboxedstring) + +sealed interface that stores validated payloads using boxed classes + +## BreedBoxedString +public record BreedBoxedString
+implements [BreedBoxed](#breedboxed) + +record that stores validated String payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| BreedBoxedString(String data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| String | data()
validated payload | +| @Nullable Object | getData()
validated payload | + +## Breed +public static class Breed
+extends StringJsonSchema.StringJsonSchema1 + +A schema class that validates payloads + +| Methods Inherited from class org.openapijsonschematools.client.schemas.StringJsonSchema.StringJsonSchema1 | +| ------------------------------------------------------------------ | +| validate | +| validateAndBox | + +[[Back to top]](#top) [[Back to Component Schemas]](../../../README.md#Component-Schemas) [[Back to README]](../../../README.md) diff --git a/samples/client/petstore/kotlin/docs/components/schemas/Drawing.md b/samples/client/petstore/kotlin/docs/components/schemas/Drawing.md new file mode 100644 index 00000000000..146c8a50f8d --- /dev/null +++ b/samples/client/petstore/kotlin/docs/components/schemas/Drawing.md @@ -0,0 +1,277 @@ +# Drawing +org.openapijsonschematools.client.components.schemas.Drawing.java +public class Drawing
+ +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 list payloads, extends FrozenList +- classes to build inputs for list payloads +- classes to store validated map payloads, extends FrozenMap +- classes to build inputs for map payloads + +## Nested Class Summary +| Modifier and Type | Class and Description | +| ----------------- | ---------------------- | +| sealed interface | [Drawing.Drawing1Boxed](#drawing1boxed)
sealed interface for validated payloads | +| record | [Drawing.Drawing1BoxedMap](#drawing1boxedmap)
boxed class to store validated Map payloads | +| static class | [Drawing.Drawing1](#drawing1)
schema class | +| static class | [Drawing.DrawingMapBuilder](#drawingmapbuilder)
builder for Map payloads | +| static class | [Drawing.DrawingMap](#drawingmap)
output class for Map payloads | +| sealed interface | [Drawing.ShapesBoxed](#shapesboxed)
sealed interface for validated payloads | +| record | [Drawing.ShapesBoxedList](#shapesboxedlist)
boxed class to store validated List payloads | +| static class | [Drawing.Shapes](#shapes)
schema class | +| static class | [Drawing.ShapesListBuilder](#shapeslistbuilder)
builder for List payloads | +| static class | [Drawing.ShapesList](#shapeslist)
output class for List payloads | + +## Drawing1Boxed +public sealed interface Drawing1Boxed
+permits
+[Drawing1BoxedMap](#drawing1boxedmap) + +sealed interface that stores validated payloads using boxed classes + +## Drawing1BoxedMap +public record Drawing1BoxedMap
+implements [Drawing1Boxed](#drawing1boxed) + +record that stores validated Map payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| Drawing1BoxedMap([DrawingMap](#drawingmap) data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| [DrawingMap](#drawingmap) | data()
validated payload | +| @Nullable Object | getData()
validated payload | + +## Drawing1 +public static class Drawing1
+extends JsonSchema + +A schema class that validates payloads + +### Code Sample +``` +import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags; +import org.openapijsonschematools.client.configurations.SchemaConfiguration; +import org.openapijsonschematools.client.exceptions.ValidationException; +import org.openapijsonschematools.client.schemas.validation.MapUtils; +import org.openapijsonschematools.client.schemas.validation.FrozenList; +import org.openapijsonschematools.client.schemas.validation.FrozenMap; +import org.openapijsonschematools.client.components.schemas.Drawing; + +import java.util.Arrays; +import java.util.List; +import java.util.AbstractMap; + +static final SchemaConfiguration configuration = new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().build()); + +// Map validation +Drawing.DrawingMap validatedPayload = + Drawing.Drawing1.validate( + new Drawing.DrawingMapBuilder() + .shapes( + Arrays.asList( + ) + ) + .build(), + configuration +); +``` + +### Field Summary +| Modifier and Type | Field and Description | +| ----------------- | ---------------------- | +| Set> | type = Set.of(Map.class) | +| Map> | properties = Map.ofEntries(
    new PropertyEntry("mainShape", [Shape.Shape1.class](../../components/schemas/Shape.md#shape1)),
    new PropertyEntry("shapeOrNull", [ShapeOrNull.ShapeOrNull1.class](../../components/schemas/ShapeOrNull.md#shapeornull1)),
    new PropertyEntry("nullableShape", [NullableShape.NullableShape1.class](../../components/schemas/NullableShape.md#nullableshape1)),
    new PropertyEntry("shapes", [Shapes.class](#shapes)))
)
| +| Class | additionalProperties = [Fruit.Fruit1.class](../../components/schemas/Fruit.md#fruit1) | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| [DrawingMap](#drawingmap) | validate([Map<?, ?>](#drawingmapbuilder) arg, SchemaConfiguration configuration) | +| [Drawing1BoxedMap](#drawing1boxedmap) | validateAndBox([Map<?, ?>](#drawingmapbuilder) arg, SchemaConfiguration configuration) | +| [Drawing1Boxed](#drawing1boxed) | validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) | +| @Nullable Object | validate(@Nullable Object arg, SchemaConfiguration configuration) | + +## DrawingMapBuilder +public class DrawingMapBuilder
+builder for `Map` + +A class that builds the Map input type + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| DrawingMapBuilder()
Creates a builder that contains an empty map | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| Map | build()
Returns map input that should be used with Schema.validate | +| [DrawingMapBuilder](#drawingmapbuilder) | mainShape(Nothing? value) | +| [DrawingMapBuilder](#drawingmapbuilder) | mainShape(boolean value) | +| [DrawingMapBuilder](#drawingmapbuilder) | mainShape(String value) | +| [DrawingMapBuilder](#drawingmapbuilder) | mainShape(int value) | +| [DrawingMapBuilder](#drawingmapbuilder) | mainShape(float value) | +| [DrawingMapBuilder](#drawingmapbuilder) | mainShape(long value) | +| [DrawingMapBuilder](#drawingmapbuilder) | mainShape(double value) | +| [DrawingMapBuilder](#drawingmapbuilder) | mainShape(List value) | +| [DrawingMapBuilder](#drawingmapbuilder) | mainShape(Map value) | +| [DrawingMapBuilder](#drawingmapbuilder) | shapeOrNull(Nothing? value) | +| [DrawingMapBuilder](#drawingmapbuilder) | shapeOrNull(boolean value) | +| [DrawingMapBuilder](#drawingmapbuilder) | shapeOrNull(String value) | +| [DrawingMapBuilder](#drawingmapbuilder) | shapeOrNull(int value) | +| [DrawingMapBuilder](#drawingmapbuilder) | shapeOrNull(float value) | +| [DrawingMapBuilder](#drawingmapbuilder) | shapeOrNull(long value) | +| [DrawingMapBuilder](#drawingmapbuilder) | shapeOrNull(double value) | +| [DrawingMapBuilder](#drawingmapbuilder) | shapeOrNull(List value) | +| [DrawingMapBuilder](#drawingmapbuilder) | shapeOrNull(Map value) | +| [DrawingMapBuilder](#drawingmapbuilder) | nullableShape(Nothing? value) | +| [DrawingMapBuilder](#drawingmapbuilder) | nullableShape(boolean value) | +| [DrawingMapBuilder](#drawingmapbuilder) | nullableShape(String value) | +| [DrawingMapBuilder](#drawingmapbuilder) | nullableShape(int value) | +| [DrawingMapBuilder](#drawingmapbuilder) | nullableShape(float value) | +| [DrawingMapBuilder](#drawingmapbuilder) | nullableShape(long value) | +| [DrawingMapBuilder](#drawingmapbuilder) | nullableShape(double value) | +| [DrawingMapBuilder](#drawingmapbuilder) | nullableShape(List value) | +| [DrawingMapBuilder](#drawingmapbuilder) | nullableShape(Map value) | +| [DrawingMapBuilder](#drawingmapbuilder) | shapes(List<@Nullable Object> value) | +| [DrawingMapBuilder](#drawingmapbuilder) | additionalProperty(String key, Nothing? value) | +| [DrawingMapBuilder](#drawingmapbuilder) | additionalProperty(String key, boolean value) | +| [DrawingMapBuilder](#drawingmapbuilder) | additionalProperty(String key, String value) | +| [DrawingMapBuilder](#drawingmapbuilder) | additionalProperty(String key, int value) | +| [DrawingMapBuilder](#drawingmapbuilder) | additionalProperty(String key, float value) | +| [DrawingMapBuilder](#drawingmapbuilder) | additionalProperty(String key, long value) | +| [DrawingMapBuilder](#drawingmapbuilder) | additionalProperty(String key, double value) | +| [DrawingMapBuilder](#drawingmapbuilder) | additionalProperty(String key, List value) | +| [DrawingMapBuilder](#drawingmapbuilder) | additionalProperty(String key, Map value) | + +## DrawingMap +public static class DrawingMap
+extends FrozenMap + +A class to store validated Map payloads + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| static [DrawingMap](#drawingmap) | of([Map](#drawingmapbuilder) arg, SchemaConfiguration configuration) | +| @Nullable Object | mainShape()
[optional] | +| @Nullable Object | shapeOrNull()
[optional] | +| @Nullable Object | nullableShape()
[optional] | +| [ShapesList](#shapeslist) | shapes()
[optional] | +| @Nullable Object | getAdditionalProperty(String name)
provides type safety for additional properties | + +## ShapesBoxed +public sealed interface ShapesBoxed
+permits
+[ShapesBoxedList](#shapesboxedlist) + +sealed interface that stores validated payloads using boxed classes + +## ShapesBoxedList +public record ShapesBoxedList
+implements [ShapesBoxed](#shapesboxed) + +record that stores validated List payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| ShapesBoxedList([ShapesList](#shapeslist) data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| [ShapesList](#shapeslist) | data()
validated payload | +| @Nullable Object | getData()
validated payload | + +## Shapes +public static class Shapes
+extends JsonSchema + +A schema class that validates payloads + +### Code Sample +``` +import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags; +import org.openapijsonschematools.client.configurations.SchemaConfiguration; +import org.openapijsonschematools.client.exceptions.ValidationException; +import org.openapijsonschematools.client.schemas.validation.MapUtils; +import org.openapijsonschematools.client.schemas.validation.FrozenList; +import org.openapijsonschematools.client.schemas.validation.FrozenMap; +import org.openapijsonschematools.client.components.schemas.Drawing; + +import java.util.Arrays; +import java.util.List; +import java.util.AbstractMap; + +static final SchemaConfiguration configuration = new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().build()); + +// List validation +Drawing.ShapesList validatedPayload = + Drawing.Shapes.validate( + new Drawing.ShapesListBuilder() + .build(), + configuration +); +``` + +### Field Summary +| Modifier and Type | Field and Description | +| ----------------- | ---------------------- | +| Set> | type = Set.of(List.class) | +| Class | items = [Shape.Shape1.class](../../components/schemas/Shape.md#shape1) | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| [ShapesList](#shapeslist) | validate([List](#shapeslistbuilder) arg, SchemaConfiguration configuration) | +| [ShapesBoxedList](#shapesboxedlist) | validateAndBox([List](#shapeslistbuilder) arg, SchemaConfiguration configuration) | +| [ShapesBoxed](#shapesboxed) | validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) | +| @Nullable Object | validate(@Nullable Object arg, SchemaConfiguration configuration) | + +## ShapesListBuilder +public class ShapesListBuilder
+builder for `List<@Nullable Object>` + +A class that builds the List input type + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| ShapesListBuilder()
Creates an empty list | +| ShapesListBuilder(List<@Nullable Object> items)
Stores the items in a list | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| ShapesListBuilder | add(Nothing? item) | +| ShapesListBuilder | add(boolean item) | +| ShapesListBuilder | add(String item) | +| ShapesListBuilder | add(int item) | +| ShapesListBuilder | add(float item) | +| ShapesListBuilder | add(long item) | +| ShapesListBuilder | add(double item) | +| ShapesListBuilder | add(List item) | +| ShapesListBuilder | add(Map item) | +| List<@Nullable Object> | build()
Returns list input that should be used with Schema.validate | + +## ShapesList +public class ShapesList
+extends `FrozenList<@Nullable Object>` + +A class to store validated List payloads + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| static [ShapesList](#shapeslist) | of([List](#shapeslistbuilder) arg, SchemaConfiguration configuration) | + +[[Back to top]](#top) [[Back to Component Schemas]](../../../README.md#Component-Schemas) [[Back to README]](../../../README.md) diff --git a/samples/client/petstore/kotlin/docs/components/schemas/EnumArrays.md b/samples/client/petstore/kotlin/docs/components/schemas/EnumArrays.md new file mode 100644 index 00000000000..3614e3b1869 --- /dev/null +++ b/samples/client/petstore/kotlin/docs/components/schemas/EnumArrays.md @@ -0,0 +1,416 @@ +# EnumArrays +org.openapijsonschematools.client.components.schemas.EnumArrays.java +public class EnumArrays
+ +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 list payloads, extends FrozenList +- classes to build inputs for list payloads +- 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 | [EnumArrays.EnumArrays1Boxed](#enumarrays1boxed)
sealed interface for validated payloads | +| record | [EnumArrays.EnumArrays1BoxedMap](#enumarrays1boxedmap)
boxed class to store validated Map payloads | +| static class | [EnumArrays.EnumArrays1](#enumarrays1)
schema class | +| static class | [EnumArrays.EnumArraysMapBuilder](#enumarraysmapbuilder)
builder for Map payloads | +| static class | [EnumArrays.EnumArraysMap](#enumarraysmap)
output class for Map payloads | +| sealed interface | [EnumArrays.ArrayEnumBoxed](#arrayenumboxed)
sealed interface for validated payloads | +| record | [EnumArrays.ArrayEnumBoxedList](#arrayenumboxedlist)
boxed class to store validated List payloads | +| static class | [EnumArrays.ArrayEnum](#arrayenum)
schema class | +| static class | [EnumArrays.ArrayEnumListBuilder](#arrayenumlistbuilder)
builder for List payloads | +| static class | [EnumArrays.ArrayEnumList](#arrayenumlist)
output class for List payloads | +| sealed interface | [EnumArrays.ItemsBoxed](#itemsboxed)
sealed interface for validated payloads | +| record | [EnumArrays.ItemsBoxedString](#itemsboxedstring)
boxed class to store validated String payloads | +| static class | [EnumArrays.Items](#items)
schema class | +| enum | [EnumArrays.StringItemsEnums](#stringitemsenums)
String enum | +| sealed interface | [EnumArrays.JustSymbolBoxed](#justsymbolboxed)
sealed interface for validated payloads | +| record | [EnumArrays.JustSymbolBoxedString](#justsymbolboxedstring)
boxed class to store validated String payloads | +| static class | [EnumArrays.JustSymbol](#justsymbol)
schema class | +| enum | [EnumArrays.StringJustSymbolEnums](#stringjustsymbolenums)
String enum | + +## EnumArrays1Boxed +public sealed interface EnumArrays1Boxed
+permits
+[EnumArrays1BoxedMap](#enumarrays1boxedmap) + +sealed interface that stores validated payloads using boxed classes + +## EnumArrays1BoxedMap +public record EnumArrays1BoxedMap
+implements [EnumArrays1Boxed](#enumarrays1boxed) + +record that stores validated Map payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| EnumArrays1BoxedMap([EnumArraysMap](#enumarraysmap) data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| [EnumArraysMap](#enumarraysmap) | data()
validated payload | +| @Nullable Object | getData()
validated payload | + +## EnumArrays1 +public static class EnumArrays1
+extends JsonSchema + +A schema class that validates payloads + +### Code Sample +``` +import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags; +import org.openapijsonschematools.client.configurations.SchemaConfiguration; +import org.openapijsonschematools.client.exceptions.ValidationException; +import org.openapijsonschematools.client.schemas.validation.MapUtils; +import org.openapijsonschematools.client.schemas.validation.FrozenList; +import org.openapijsonschematools.client.schemas.validation.FrozenMap; +import org.openapijsonschematools.client.components.schemas.EnumArrays; + +import java.util.Arrays; +import java.util.List; +import java.util.AbstractMap; + +static final SchemaConfiguration configuration = new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().build()); + +// Map validation +EnumArrays.EnumArraysMap validatedPayload = + EnumArrays.EnumArrays1.validate( + new EnumArrays.EnumArraysMapBuilder() + .just_symbol(">=") + + .array_enum( + Arrays.asList( + "fish" + ) + ) + .build(), + configuration +); +``` + +### Field Summary +| Modifier and Type | Field and Description | +| ----------------- | ---------------------- | +| Set> | type = Set.of(Map.class) | +| Map> | properties = Map.ofEntries(
    new PropertyEntry("just_symbol", [JustSymbol.class](#justsymbol))),
    new PropertyEntry("array_enum", [ArrayEnum.class](#arrayenum)))
)
| + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| [EnumArraysMap](#enumarraysmap) | validate([Map<?, ?>](#enumarraysmapbuilder) arg, SchemaConfiguration configuration) | +| [EnumArrays1BoxedMap](#enumarrays1boxedmap) | validateAndBox([Map<?, ?>](#enumarraysmapbuilder) arg, SchemaConfiguration configuration) | +| [EnumArrays1Boxed](#enumarrays1boxed) | validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) | +| @Nullable Object | validate(@Nullable Object arg, SchemaConfiguration configuration) | + +## EnumArraysMapBuilder +public class EnumArraysMapBuilder
+builder for `Map` + +A class that builds the Map input type + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| EnumArraysMapBuilder()
Creates a builder that contains an empty map | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| Map | build()
Returns map input that should be used with Schema.validate | +| [EnumArraysMapBuilder](#enumarraysmapbuilder) | just_symbol(String value) | +| [EnumArraysMapBuilder](#enumarraysmapbuilder) | just_symbol([StringJustSymbolEnums](#stringjustsymbolenums) value) | +| [EnumArraysMapBuilder](#enumarraysmapbuilder) | array_enum(List value) | +| [EnumArraysMapBuilder](#enumarraysmapbuilder) | additionalProperty(String key, Nothing? value) | +| [EnumArraysMapBuilder](#enumarraysmapbuilder) | additionalProperty(String key, boolean value) | +| [EnumArraysMapBuilder](#enumarraysmapbuilder) | additionalProperty(String key, String value) | +| [EnumArraysMapBuilder](#enumarraysmapbuilder) | additionalProperty(String key, int value) | +| [EnumArraysMapBuilder](#enumarraysmapbuilder) | additionalProperty(String key, float value) | +| [EnumArraysMapBuilder](#enumarraysmapbuilder) | additionalProperty(String key, long value) | +| [EnumArraysMapBuilder](#enumarraysmapbuilder) | additionalProperty(String key, double value) | +| [EnumArraysMapBuilder](#enumarraysmapbuilder) | additionalProperty(String key, List value) | +| [EnumArraysMapBuilder](#enumarraysmapbuilder) | additionalProperty(String key, Map value) | + +## EnumArraysMap +public static class EnumArraysMap
+extends FrozenMap + +A class to store validated Map payloads + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| static [EnumArraysMap](#enumarraysmap) | of([Map](#enumarraysmapbuilder) arg, SchemaConfiguration configuration) | +| String | just_symbol()
[optional] must be one of [">=", "$"] | +| [ArrayEnumList](#arrayenumlist) | array_enum()
[optional] | +| @Nullable Object | getAdditionalProperty(String name)
provides type safety for additional properties | + +## ArrayEnumBoxed +public sealed interface ArrayEnumBoxed
+permits
+[ArrayEnumBoxedList](#arrayenumboxedlist) + +sealed interface that stores validated payloads using boxed classes + +## ArrayEnumBoxedList +public record ArrayEnumBoxedList
+implements [ArrayEnumBoxed](#arrayenumboxed) + +record that stores validated List payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| ArrayEnumBoxedList([ArrayEnumList](#arrayenumlist) data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| [ArrayEnumList](#arrayenumlist) | data()
validated payload | +| @Nullable Object | getData()
validated payload | + +## ArrayEnum +public static class ArrayEnum
+extends JsonSchema + +A schema class that validates payloads + +### Code Sample +``` +import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags; +import org.openapijsonschematools.client.configurations.SchemaConfiguration; +import org.openapijsonschematools.client.exceptions.ValidationException; +import org.openapijsonschematools.client.schemas.validation.MapUtils; +import org.openapijsonschematools.client.schemas.validation.FrozenList; +import org.openapijsonschematools.client.schemas.validation.FrozenMap; +import org.openapijsonschematools.client.components.schemas.EnumArrays; + +import java.util.Arrays; +import java.util.List; +import java.util.AbstractMap; + +static final SchemaConfiguration configuration = new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().build()); + +// List validation +EnumArrays.ArrayEnumList validatedPayload = + EnumArrays.ArrayEnum.validate( + new EnumArrays.ArrayEnumListBuilder() + .add("fish") + + .build(), + configuration +); +``` + +### Field Summary +| Modifier and Type | Field and Description | +| ----------------- | ---------------------- | +| Set> | type = Set.of(List.class) | +| Class | items = [Items.class](#items) | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| [ArrayEnumList](#arrayenumlist) | validate([List](#arrayenumlistbuilder) arg, SchemaConfiguration configuration) | +| [ArrayEnumBoxedList](#arrayenumboxedlist) | validateAndBox([List](#arrayenumlistbuilder) arg, SchemaConfiguration configuration) | +| [ArrayEnumBoxed](#arrayenumboxed) | validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) | +| @Nullable Object | validate(@Nullable Object arg, SchemaConfiguration configuration) | + +## ArrayEnumListBuilder +public class ArrayEnumListBuilder
+builder for `List` + +A class that builds the List input type + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| ArrayEnumListBuilder()
Creates an empty list | +| ArrayEnumListBuilder(List items)
Stores the items in a list | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| ArrayEnumListBuilder | add(String item) | +| ArrayEnumListBuilder | add([StringItemsEnums](#stringitemsenums) item) | +| List | build()
Returns list input that should be used with Schema.validate | + +## ArrayEnumList +public class ArrayEnumList
+extends `FrozenList` + +A class to store validated List payloads + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| static [ArrayEnumList](#arrayenumlist) | of([List](#arrayenumlistbuilder) arg, SchemaConfiguration configuration) | + +## ItemsBoxed +public sealed interface ItemsBoxed
+permits
+[ItemsBoxedString](#itemsboxedstring) + +sealed interface that stores validated payloads using boxed classes + +## ItemsBoxedString +public record ItemsBoxedString
+implements [ItemsBoxed](#itemsboxed) + +record that stores validated String payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| ItemsBoxedString(String data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| String | data()
validated payload | +| @Nullable Object | getData()
validated payload | + +## Items +public static class Items
+extends JsonSchema + +A schema class that validates payloads + +### Code Sample +``` +import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags; +import org.openapijsonschematools.client.configurations.SchemaConfiguration; +import org.openapijsonschematools.client.exceptions.ValidationException; +import org.openapijsonschematools.client.schemas.validation.MapUtils; +import org.openapijsonschematools.client.schemas.validation.FrozenList; +import org.openapijsonschematools.client.schemas.validation.FrozenMap; +import org.openapijsonschematools.client.components.schemas.EnumArrays; + +import java.util.Arrays; +import java.util.List; +import java.util.AbstractMap; + +static final SchemaConfiguration configuration = new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().build()); + +// String validation +String validatedPayload = EnumArrays.Items.validate( + "fish", + configuration +); +``` + +### Field Summary +| Modifier and Type | Field and Description | +| ----------------- | ---------------------- | +| Set> | type = Set.of(
    String.class
)
| +| Set | enumValues = SetMaker.makeSet(
    "fish",
    "crab"
)
| + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| String | validate(String arg, SchemaConfiguration configuration) | +| String | validate([StringItemsEnums](#stringitemsenums) arg, SchemaConfiguration configuration) | +| [ItemsBoxedString](#itemsboxedstring) | validateAndBox(String arg, SchemaConfiguration configuration) | +| [ItemsBoxed](#itemsboxed) | validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) | +| @Nullable Object | validate(@Nullable Object arg, SchemaConfiguration configuration) | + +## StringItemsEnums +public enum StringItemsEnums
+extends `Enum` + +A class that stores String enum values + +### Enum Constant Summary +| Enum Constant | Description | +| ------------- | ----------- | +| FISH | value = "fish" | +| CRAB | value = "crab" | + +## JustSymbolBoxed +public sealed interface JustSymbolBoxed
+permits
+[JustSymbolBoxedString](#justsymbolboxedstring) + +sealed interface that stores validated payloads using boxed classes + +## JustSymbolBoxedString +public record JustSymbolBoxedString
+implements [JustSymbolBoxed](#justsymbolboxed) + +record that stores validated String payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| JustSymbolBoxedString(String data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| String | data()
validated payload | +| @Nullable Object | getData()
validated payload | + +## JustSymbol +public static class JustSymbol
+extends JsonSchema + +A schema class that validates payloads + +### Code Sample +``` +import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags; +import org.openapijsonschematools.client.configurations.SchemaConfiguration; +import org.openapijsonschematools.client.exceptions.ValidationException; +import org.openapijsonschematools.client.schemas.validation.MapUtils; +import org.openapijsonschematools.client.schemas.validation.FrozenList; +import org.openapijsonschematools.client.schemas.validation.FrozenMap; +import org.openapijsonschematools.client.components.schemas.EnumArrays; + +import java.util.Arrays; +import java.util.List; +import java.util.AbstractMap; + +static final SchemaConfiguration configuration = new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().build()); + +// String validation +String validatedPayload = EnumArrays.JustSymbol.validate( + ">=", + configuration +); +``` + +### Field Summary +| Modifier and Type | Field and Description | +| ----------------- | ---------------------- | +| Set> | type = Set.of(
    String.class
)
| +| Set | enumValues = SetMaker.makeSet(
    ">=",
    "$"
)
| + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| String | validate(String arg, SchemaConfiguration configuration) | +| String | validate([StringJustSymbolEnums](#stringjustsymbolenums) arg, SchemaConfiguration configuration) | +| [JustSymbolBoxedString](#justsymbolboxedstring) | validateAndBox(String arg, SchemaConfiguration configuration) | +| [JustSymbolBoxed](#justsymbolboxed) | validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) | +| @Nullable Object | validate(@Nullable Object arg, SchemaConfiguration configuration) | + +## StringJustSymbolEnums +public enum StringJustSymbolEnums
+extends `Enum` + +A class that stores String enum values + +### Enum Constant Summary +| Enum Constant | Description | +| ------------- | ----------- | +| GREATER_THAN_SIGN_EQUALS_SIGN | value = ">=" | +| DOLLAR_SIGN | value = "$" | + +[[Back to top]](#top) [[Back to Component Schemas]](../../../README.md#Component-Schemas) [[Back to README]](../../../README.md) diff --git a/samples/client/petstore/kotlin/docs/components/schemas/EnumClass.md b/samples/client/petstore/kotlin/docs/components/schemas/EnumClass.md new file mode 100644 index 00000000000..4ee8809a9b0 --- /dev/null +++ b/samples/client/petstore/kotlin/docs/components/schemas/EnumClass.md @@ -0,0 +1,103 @@ +# EnumClass +org.openapijsonschematools.client.components.schemas.EnumClass.java +public class EnumClass
+ +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 +- enum classes + +## Nested Class Summary +| Modifier and Type | Class and Description | +| ----------------- | ---------------------- | +| sealed interface | [EnumClass.EnumClass1Boxed](#enumclass1boxed)
sealed interface for validated payloads | +| record | [EnumClass.EnumClass1BoxedString](#enumclass1boxedstring)
boxed class to store validated String payloads | +| static class | [EnumClass.EnumClass1](#enumclass1)
schema class | +| enum | [EnumClass.StringEnumClassEnums](#stringenumclassenums)
String enum | + +## EnumClass1Boxed +public sealed interface EnumClass1Boxed
+permits
+[EnumClass1BoxedString](#enumclass1boxedstring) + +sealed interface that stores validated payloads using boxed classes + +## EnumClass1BoxedString +public record EnumClass1BoxedString
+implements [EnumClass1Boxed](#enumclass1boxed) + +record that stores validated String payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| EnumClass1BoxedString(String data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| String | data()
validated payload | +| @Nullable Object | getData()
validated payload | + +## EnumClass1 +public static class EnumClass1
+extends JsonSchema + +A schema class that validates payloads + +### Code Sample +``` +import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags; +import org.openapijsonschematools.client.configurations.SchemaConfiguration; +import org.openapijsonschematools.client.exceptions.ValidationException; +import org.openapijsonschematools.client.schemas.validation.MapUtils; +import org.openapijsonschematools.client.schemas.validation.FrozenList; +import org.openapijsonschematools.client.schemas.validation.FrozenMap; +import org.openapijsonschematools.client.components.schemas.EnumClass; + +import java.util.Arrays; +import java.util.List; +import java.util.AbstractMap; + +static final SchemaConfiguration configuration = new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().build()); + +// String validation +String validatedPayload = EnumClass.EnumClass1.validate( + "_abc", + configuration +); +``` + +### Field Summary +| Modifier and Type | Field and Description | +| ----------------- | ---------------------- | +| Set> | type = Set.of(
    String.class
)
| +| Set | enumValues = SetMaker.makeSet(
    "_abc",
    "-efg",
    "(xyz)",
    "COUNT_1M",
    "COUNT_50M"
)
| +| @Nullable Object | defaultValue = "-efg" | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| String | validate(String arg, SchemaConfiguration configuration) | +| String | validate([StringEnumClassEnums](#stringenumclassenums) arg, SchemaConfiguration configuration) | +| [EnumClass1BoxedString](#enumclass1boxedstring) | validateAndBox(String arg, SchemaConfiguration configuration) | +| [EnumClass1Boxed](#enumclass1boxed) | validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) | +| @Nullable Object | validate(@Nullable Object arg, SchemaConfiguration configuration) | + +## StringEnumClassEnums +public enum StringEnumClassEnums
+extends `Enum` + +A class that stores String enum values + +### Enum Constant Summary +| Enum Constant | Description | +| ------------- | ----------- | +| LOW_LINE_ABC | value = "_abc" | +| HYPHEN_MINUS_EFG | value = "-efg" | +| LEFT_PARENTHESIS_XYZ_RIGHT_PARENTHESIS | value = "(xyz)" | +| COUNT_1M | value = "COUNT_1M" | +| COUNT_50M | value = "COUNT_50M" | + +[[Back to top]](#top) [[Back to Component Schemas]](../../../README.md#Component-Schemas) [[Back to README]](../../../README.md) diff --git a/samples/client/petstore/kotlin/docs/components/schemas/EnumTest.md b/samples/client/petstore/kotlin/docs/components/schemas/EnumTest.md new file mode 100644 index 00000000000..b1eced4c620 --- /dev/null +++ b/samples/client/petstore/kotlin/docs/components/schemas/EnumTest.md @@ -0,0 +1,597 @@ +# EnumTest +org.openapijsonschematools.client.components.schemas.EnumTest.java +public class EnumTest
+ +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 | [EnumTest.EnumTest1Boxed](#enumtest1boxed)
sealed interface for validated payloads | +| record | [EnumTest.EnumTest1BoxedMap](#enumtest1boxedmap)
boxed class to store validated Map payloads | +| static class | [EnumTest.EnumTest1](#enumtest1)
schema class | +| static class | [EnumTest.EnumTestMapBuilder](#enumtestmapbuilder)
builder for Map payloads | +| static class | [EnumTest.EnumTestMap](#enumtestmap)
output class for Map payloads | +| sealed interface | [EnumTest.EnumNumberBoxed](#enumnumberboxed)
sealed interface for validated payloads | +| record | [EnumTest.EnumNumberBoxedNumber](#enumnumberboxednumber)
boxed class to store validated Number payloads | +| static class | [EnumTest.EnumNumber](#enumnumber)
schema class | +| enum | [EnumTest.DoubleEnumNumberEnums](#doubleenumnumberenums)
Double enum | +| enum | [EnumTest.FloatEnumNumberEnums](#floatenumnumberenums)
Float enum | +| sealed interface | [EnumTest.EnumIntegerBoxed](#enumintegerboxed)
sealed interface for validated payloads | +| record | [EnumTest.EnumIntegerBoxedNumber](#enumintegerboxednumber)
boxed class to store validated Number payloads | +| static class | [EnumTest.EnumInteger](#enuminteger)
schema class | +| enum | [EnumTest.IntegerEnumIntegerEnums](#integerenumintegerenums)
Integer enum | +| enum | [EnumTest.LongEnumIntegerEnums](#longenumintegerenums)
Long enum | +| enum | [EnumTest.FloatEnumIntegerEnums](#floatenumintegerenums)
Float enum | +| enum | [EnumTest.DoubleEnumIntegerEnums](#doubleenumintegerenums)
Double enum | +| sealed interface | [EnumTest.EnumStringRequiredBoxed](#enumstringrequiredboxed)
sealed interface for validated payloads | +| record | [EnumTest.EnumStringRequiredBoxedString](#enumstringrequiredboxedstring)
boxed class to store validated String payloads | +| static class | [EnumTest.EnumStringRequired](#enumstringrequired)
schema class | +| enum | [EnumTest.StringEnumStringRequiredEnums](#stringenumstringrequiredenums)
String enum | +| sealed interface | [EnumTest.EnumStringBoxed](#enumstringboxed)
sealed interface for validated payloads | +| record | [EnumTest.EnumStringBoxedString](#enumstringboxedstring)
boxed class to store validated String payloads | +| static class | [EnumTest.EnumString](#enumstring)
schema class | +| enum | [EnumTest.StringEnumStringEnums](#stringenumstringenums)
String enum | + +## EnumTest1Boxed +public sealed interface EnumTest1Boxed
+permits
+[EnumTest1BoxedMap](#enumtest1boxedmap) + +sealed interface that stores validated payloads using boxed classes + +## EnumTest1BoxedMap +public record EnumTest1BoxedMap
+implements [EnumTest1Boxed](#enumtest1boxed) + +record that stores validated Map payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| EnumTest1BoxedMap([EnumTestMap](#enumtestmap) data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| [EnumTestMap](#enumtestmap) | data()
validated payload | +| @Nullable Object | getData()
validated payload | + +## EnumTest1 +public static class EnumTest1
+extends JsonSchema + +A schema class that validates payloads + +### Code Sample +``` +import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags; +import org.openapijsonschematools.client.configurations.SchemaConfiguration; +import org.openapijsonschematools.client.exceptions.ValidationException; +import org.openapijsonschematools.client.schemas.validation.MapUtils; +import org.openapijsonschematools.client.schemas.validation.FrozenList; +import org.openapijsonschematools.client.schemas.validation.FrozenMap; +import org.openapijsonschematools.client.components.schemas.EnumTest; + +import java.util.Arrays; +import java.util.List; +import java.util.AbstractMap; + +static final SchemaConfiguration configuration = new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().build()); + +// Map validation +EnumTest.EnumTestMap validatedPayload = + EnumTest.EnumTest1.validate( + new EnumTest.EnumTestMapBuilder() + .enum_string_required("UPPER") + + .enum_string("UPPER") + + .enum_integer(1) + + .enum_number(3.14d) + + .build(), + configuration +); +``` + +### Field Summary +| Modifier and Type | Field and Description | +| ----------------- | ---------------------- | +| Set> | type = Set.of(Map.class) | +| Map> | properties = Map.ofEntries(
    new PropertyEntry("enum_string", [EnumString.class](#enumstring))),
    new PropertyEntry("enum_string_required", [EnumStringRequired.class](#enumstringrequired))),
    new PropertyEntry("enum_integer", [EnumInteger.class](#enuminteger))),
    new PropertyEntry("enum_number", [EnumNumber.class](#enumnumber))),
    new PropertyEntry("stringEnum", [StringEnum.StringEnum1.class](../../components/schemas/StringEnum.md#stringenum1)),
    new PropertyEntry("IntegerEnum", [IntegerEnum.IntegerEnum1.class](../../components/schemas/IntegerEnum.md#integerenum1)),
    new PropertyEntry("StringEnumWithDefaultValue", [StringEnumWithDefaultValue.StringEnumWithDefaultValue1.class](../../components/schemas/StringEnumWithDefaultValue.md#stringenumwithdefaultvalue1)),
    new PropertyEntry("IntegerEnumWithDefaultValue", [IntegerEnumWithDefaultValue.IntegerEnumWithDefaultValue1.class](../../components/schemas/IntegerEnumWithDefaultValue.md#integerenumwithdefaultvalue1)),
    new PropertyEntry("IntegerEnumOneValue", [IntegerEnumOneValue.IntegerEnumOneValue1.class](../../components/schemas/IntegerEnumOneValue.md#integerenumonevalue1))
)
| +| Set | required = Set.of(
    "enum_string_required"
)
| + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| [EnumTestMap](#enumtestmap) | validate([Map<?, ?>](#enumtestmapbuilder) arg, SchemaConfiguration configuration) | +| [EnumTest1BoxedMap](#enumtest1boxedmap) | validateAndBox([Map<?, ?>](#enumtestmapbuilder) arg, SchemaConfiguration configuration) | +| [EnumTest1Boxed](#enumtest1boxed) | validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) | +| @Nullable Object | validate(@Nullable Object arg, SchemaConfiguration configuration) | + +## EnumTestMap0Builder +public class EnumTestMap0Builder
+builder for `Map` + +A class that builds the Map input type + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| EnumTestMap0Builder(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 | +| [EnumTestMap0Builder](#enumtestmap0builder) | enum_string(String value) | +| [EnumTestMap0Builder](#enumtestmap0builder) | enum_string([StringEnumStringEnums](#stringenumstringenums) value) | +| [EnumTestMap0Builder](#enumtestmap0builder) | enum_integer(int value) | +| [EnumTestMap0Builder](#enumtestmap0builder) | enum_integer(float value) | +| [EnumTestMap0Builder](#enumtestmap0builder) | enum_integer([IntegerEnumIntegerEnums](#integerenumintegerenums) value) | +| [EnumTestMap0Builder](#enumtestmap0builder) | enum_integer([LongEnumIntegerEnums](#longenumintegerenums) value) | +| [EnumTestMap0Builder](#enumtestmap0builder) | enum_integer([FloatEnumIntegerEnums](#floatenumintegerenums) value) | +| [EnumTestMap0Builder](#enumtestmap0builder) | enum_integer([DoubleEnumIntegerEnums](#doubleenumintegerenums) value) | +| [EnumTestMap0Builder](#enumtestmap0builder) | enum_number(int value) | +| [EnumTestMap0Builder](#enumtestmap0builder) | enum_number(float value) | +| [EnumTestMap0Builder](#enumtestmap0builder) | enum_number(long value) | +| [EnumTestMap0Builder](#enumtestmap0builder) | enum_number(double value) | +| [EnumTestMap0Builder](#enumtestmap0builder) | enum_number([DoubleEnumNumberEnums](#doubleenumnumberenums) value) | +| [EnumTestMap0Builder](#enumtestmap0builder) | enum_number([FloatEnumNumberEnums](#floatenumnumberenums) value) | +| [EnumTestMap0Builder](#enumtestmap0builder) | stringEnum(Nothing? value) | +| [EnumTestMap0Builder](#enumtestmap0builder) | stringEnum(String value) | +| [EnumTestMap0Builder](#enumtestmap0builder) | stringEnum([StringEnum.StringStringEnumEnums](../../components/schemas/StringEnum.md#stringstringenumenums) value) | +| [EnumTestMap0Builder](#enumtestmap0builder) | stringEnum([StringEnum.NullStringEnumEnums](../../components/schemas/StringEnum.md#nullstringenumenums) value) | +| [EnumTestMap0Builder](#enumtestmap0builder) | IntegerEnum(int value) | +| [EnumTestMap0Builder](#enumtestmap0builder) | IntegerEnum(float value) | +| [EnumTestMap0Builder](#enumtestmap0builder) | IntegerEnum(long value) | +| [EnumTestMap0Builder](#enumtestmap0builder) | IntegerEnum(double value) | +| [EnumTestMap0Builder](#enumtestmap0builder) | IntegerEnum([IntegerEnum.IntegerIntegerEnumEnums](../../components/schemas/IntegerEnum.md#integerintegerenumenums) value) | +| [EnumTestMap0Builder](#enumtestmap0builder) | IntegerEnum([IntegerEnum.LongIntegerEnumEnums](../../components/schemas/IntegerEnum.md#longintegerenumenums) value) | +| [EnumTestMap0Builder](#enumtestmap0builder) | IntegerEnum([IntegerEnum.FloatIntegerEnumEnums](../../components/schemas/IntegerEnum.md#floatintegerenumenums) value) | +| [EnumTestMap0Builder](#enumtestmap0builder) | IntegerEnum([IntegerEnum.DoubleIntegerEnumEnums](../../components/schemas/IntegerEnum.md#doubleintegerenumenums) value) | +| [EnumTestMap0Builder](#enumtestmap0builder) | StringEnumWithDefaultValue(String value) | +| [EnumTestMap0Builder](#enumtestmap0builder) | StringEnumWithDefaultValue([StringEnumWithDefaultValue.StringStringEnumWithDefaultValueEnums](../../components/schemas/StringEnumWithDefaultValue.md#stringstringenumwithdefaultvalueenums) value) | +| [EnumTestMap0Builder](#enumtestmap0builder) | IntegerEnumWithDefaultValue(int value) | +| [EnumTestMap0Builder](#enumtestmap0builder) | IntegerEnumWithDefaultValue(float value) | +| [EnumTestMap0Builder](#enumtestmap0builder) | IntegerEnumWithDefaultValue(long value) | +| [EnumTestMap0Builder](#enumtestmap0builder) | IntegerEnumWithDefaultValue(double value) | +| [EnumTestMap0Builder](#enumtestmap0builder) | IntegerEnumWithDefaultValue([IntegerEnumWithDefaultValue.IntegerIntegerEnumWithDefaultValueEnums](../../components/schemas/IntegerEnumWithDefaultValue.md#integerintegerenumwithdefaultvalueenums) value) | +| [EnumTestMap0Builder](#enumtestmap0builder) | IntegerEnumWithDefaultValue([IntegerEnumWithDefaultValue.LongIntegerEnumWithDefaultValueEnums](../../components/schemas/IntegerEnumWithDefaultValue.md#longintegerenumwithdefaultvalueenums) value) | +| [EnumTestMap0Builder](#enumtestmap0builder) | IntegerEnumWithDefaultValue([IntegerEnumWithDefaultValue.FloatIntegerEnumWithDefaultValueEnums](../../components/schemas/IntegerEnumWithDefaultValue.md#floatintegerenumwithdefaultvalueenums) value) | +| [EnumTestMap0Builder](#enumtestmap0builder) | IntegerEnumWithDefaultValue([IntegerEnumWithDefaultValue.DoubleIntegerEnumWithDefaultValueEnums](../../components/schemas/IntegerEnumWithDefaultValue.md#doubleintegerenumwithdefaultvalueenums) value) | +| [EnumTestMap0Builder](#enumtestmap0builder) | IntegerEnumOneValue(int value) | +| [EnumTestMap0Builder](#enumtestmap0builder) | IntegerEnumOneValue(float value) | +| [EnumTestMap0Builder](#enumtestmap0builder) | IntegerEnumOneValue(long value) | +| [EnumTestMap0Builder](#enumtestmap0builder) | IntegerEnumOneValue(double value) | +| [EnumTestMap0Builder](#enumtestmap0builder) | IntegerEnumOneValue([IntegerEnumOneValue.IntegerIntegerEnumOneValueEnums](../../components/schemas/IntegerEnumOneValue.md#integerintegerenumonevalueenums) value) | +| [EnumTestMap0Builder](#enumtestmap0builder) | IntegerEnumOneValue([IntegerEnumOneValue.LongIntegerEnumOneValueEnums](../../components/schemas/IntegerEnumOneValue.md#longintegerenumonevalueenums) value) | +| [EnumTestMap0Builder](#enumtestmap0builder) | IntegerEnumOneValue([IntegerEnumOneValue.FloatIntegerEnumOneValueEnums](../../components/schemas/IntegerEnumOneValue.md#floatintegerenumonevalueenums) value) | +| [EnumTestMap0Builder](#enumtestmap0builder) | IntegerEnumOneValue([IntegerEnumOneValue.DoubleIntegerEnumOneValueEnums](../../components/schemas/IntegerEnumOneValue.md#doubleintegerenumonevalueenums) value) | +| [EnumTestMap0Builder](#enumtestmap0builder) | additionalProperty(String key, Nothing? value) | +| [EnumTestMap0Builder](#enumtestmap0builder) | additionalProperty(String key, boolean value) | +| [EnumTestMap0Builder](#enumtestmap0builder) | additionalProperty(String key, String value) | +| [EnumTestMap0Builder](#enumtestmap0builder) | additionalProperty(String key, int value) | +| [EnumTestMap0Builder](#enumtestmap0builder) | additionalProperty(String key, float value) | +| [EnumTestMap0Builder](#enumtestmap0builder) | additionalProperty(String key, long value) | +| [EnumTestMap0Builder](#enumtestmap0builder) | additionalProperty(String key, double value) | +| [EnumTestMap0Builder](#enumtestmap0builder) | additionalProperty(String key, List value) | +| [EnumTestMap0Builder](#enumtestmap0builder) | additionalProperty(String key, Map value) | + +## EnumTestMapBuilder +public class EnumTestMapBuilder
+builder for `Map` + +A class that builds the Map input type + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| EnumTestMapBuilder()
Creates a builder that contains an empty map | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| [EnumTestMap0Builder](#enumtestmap0builder) | enum_string_required(String value) | +| [EnumTestMap0Builder](#enumtestmap0builder) | enum_string_required([StringEnumStringRequiredEnums](#stringenumstringrequiredenums) value) | + +## EnumTestMap +public static class EnumTestMap
+extends FrozenMap + +A class to store validated Map payloads + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| static [EnumTestMap](#enumtestmap) | of([Map](#enumtestmapbuilder) arg, SchemaConfiguration configuration) | +| String | enum_string_required()
must be one of ["UPPER", "lower", ""] | +| String | enum_string()
[optional] must be one of ["UPPER", "lower", ""] | +| Number | enum_integer()
[optional] must be one of [1, -1] value must be a 32 bit integer | +| Number | enum_number()
[optional] must be one of [1.1, -1.2] value must be a 64 bit float | +| @Nullable String | stringEnum()
[optional] | +| Number | IntegerEnum()
[optional] | +| String | StringEnumWithDefaultValue()
[optional] | +| Number | IntegerEnumWithDefaultValue()
[optional] | +| Number | IntegerEnumOneValue()
[optional] | +| @Nullable Object | getAdditionalProperty(String name)
provides type safety for additional properties | + +## EnumNumberBoxed +public sealed interface EnumNumberBoxed
+permits
+[EnumNumberBoxedNumber](#enumnumberboxednumber) + +sealed interface that stores validated payloads using boxed classes + +## EnumNumberBoxedNumber +public record EnumNumberBoxedNumber
+implements [EnumNumberBoxed](#enumnumberboxed) + +record that stores validated Number payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| EnumNumberBoxedNumber(Number data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| Number | data()
validated payload | +| @Nullable Object | getData()
validated payload | + +## EnumNumber +public static class EnumNumber
+extends JsonSchema + +A schema class that validates payloads + +### Code Sample +``` +import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags; +import org.openapijsonschematools.client.configurations.SchemaConfiguration; +import org.openapijsonschematools.client.exceptions.ValidationException; +import org.openapijsonschematools.client.schemas.validation.MapUtils; +import org.openapijsonschematools.client.schemas.validation.FrozenList; +import org.openapijsonschematools.client.schemas.validation.FrozenMap; +import org.openapijsonschematools.client.components.schemas.EnumTest; + +import java.util.Arrays; +import java.util.List; +import java.util.AbstractMap; + +static final SchemaConfiguration configuration = new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().build()); + +// double validation +double validatedPayload = EnumTest.EnumNumber.validate( + 3.14d, + configuration +); +``` + +### Field Summary +| Modifier and Type | Field and Description | +| ----------------- | ---------------------- | +| Set> | type = Set.of(
    Integer.class,
    Long.class,
    Float.class,
    Double.class
)
| +| String | type = "double"; | +| Set | enumValues = SetMaker.makeSet(
    1.1,
    -1.2
)
| + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| double | validate(double arg, SchemaConfiguration configuration) | +| [EnumNumberBoxedNumber](#enumnumberboxednumber) | validateAndBox(Number arg, SchemaConfiguration configuration) | +| [EnumNumberBoxed](#enumnumberboxed) | validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) | +| @Nullable Object | validate(@Nullable Object arg, SchemaConfiguration configuration) | + +## DoubleEnumNumberEnums +public enum DoubleEnumNumberEnums
+extends `Enum` + +A class that stores Double enum values + +### Enum Constant Summary +| Enum Constant | Description | +| ------------- | ----------- | +| POSITIVE_1_PT_1 | value = 1.1d | +| NEGATIVE_1_PT_2 | value = -1.2d | + +## FloatEnumNumberEnums +public enum FloatEnumNumberEnums
+extends `Enum` + +A class that stores Float enum values + +### Enum Constant Summary +| Enum Constant | Description | +| ------------- | ----------- | +| POSITIVE_1_PT_1 | value = 1.1f | +| NEGATIVE_1_PT_2 | value = -1.2f | + +## EnumIntegerBoxed +public sealed interface EnumIntegerBoxed
+permits
+[EnumIntegerBoxedNumber](#enumintegerboxednumber) + +sealed interface that stores validated payloads using boxed classes + +## EnumIntegerBoxedNumber +public record EnumIntegerBoxedNumber
+implements [EnumIntegerBoxed](#enumintegerboxed) + +record that stores validated Number payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| EnumIntegerBoxedNumber(Number data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| Number | data()
validated payload | +| @Nullable Object | getData()
validated payload | + +## EnumInteger +public static class EnumInteger
+extends JsonSchema + +A schema class that validates payloads + +### Code Sample +``` +import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags; +import org.openapijsonschematools.client.configurations.SchemaConfiguration; +import org.openapijsonschematools.client.exceptions.ValidationException; +import org.openapijsonschematools.client.schemas.validation.MapUtils; +import org.openapijsonschematools.client.schemas.validation.FrozenList; +import org.openapijsonschematools.client.schemas.validation.FrozenMap; +import org.openapijsonschematools.client.components.schemas.EnumTest; + +import java.util.Arrays; +import java.util.List; +import java.util.AbstractMap; + +static final SchemaConfiguration configuration = new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().build()); + +// int validation +int validatedPayload = EnumTest.EnumInteger.validate( + 1, + configuration +); +``` + +### Field Summary +| Modifier and Type | Field and Description | +| ----------------- | ---------------------- | +| Set> | type = Set.of(
    Integer.class,
    Long.class,
    Float.class,
    Double.class
)
| +| String | type = "int32"; | +| Set | enumValues = SetMaker.makeSet(
    1,
    -1
)
| + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| int | validate(int arg, SchemaConfiguration configuration) | +| [EnumIntegerBoxedNumber](#enumintegerboxednumber) | validateAndBox(Number arg, SchemaConfiguration configuration) | +| [EnumIntegerBoxed](#enumintegerboxed) | validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) | +| @Nullable Object | validate(@Nullable Object arg, SchemaConfiguration configuration) | + +## IntegerEnumIntegerEnums +public enum IntegerEnumIntegerEnums
+extends `Enum` + +A class that stores Integer enum values + +### Enum Constant Summary +| Enum Constant | Description | +| ------------- | ----------- | +| POSITIVE_1 | value = 1 | +| NEGATIVE_1 | value = -1 | + +## LongEnumIntegerEnums +public enum LongEnumIntegerEnums
+extends `Enum` + +A class that stores Long enum values + +### Enum Constant Summary +| Enum Constant | Description | +| ------------- | ----------- | +| POSITIVE_1 | value = 1L | +| NEGATIVE_1 | value = -1L | + +## FloatEnumIntegerEnums +public enum FloatEnumIntegerEnums
+extends `Enum` + +A class that stores Float enum values + +### Enum Constant Summary +| Enum Constant | Description | +| ------------- | ----------- | +| POSITIVE_1 | value = 1.0f | +| NEGATIVE_1 | value = -1.0f | + +## DoubleEnumIntegerEnums +public enum DoubleEnumIntegerEnums
+extends `Enum` + +A class that stores Double enum values + +### Enum Constant Summary +| Enum Constant | Description | +| ------------- | ----------- | +| POSITIVE_1 | value = 1.0d | +| NEGATIVE_1 | value = -1.0d | + +## EnumStringRequiredBoxed +public sealed interface EnumStringRequiredBoxed
+permits
+[EnumStringRequiredBoxedString](#enumstringrequiredboxedstring) + +sealed interface that stores validated payloads using boxed classes + +## EnumStringRequiredBoxedString +public record EnumStringRequiredBoxedString
+implements [EnumStringRequiredBoxed](#enumstringrequiredboxed) + +record that stores validated String payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| EnumStringRequiredBoxedString(String data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| String | data()
validated payload | +| @Nullable Object | getData()
validated payload | + +## EnumStringRequired +public static class EnumStringRequired
+extends JsonSchema + +A schema class that validates payloads + +### Code Sample +``` +import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags; +import org.openapijsonschematools.client.configurations.SchemaConfiguration; +import org.openapijsonschematools.client.exceptions.ValidationException; +import org.openapijsonschematools.client.schemas.validation.MapUtils; +import org.openapijsonschematools.client.schemas.validation.FrozenList; +import org.openapijsonschematools.client.schemas.validation.FrozenMap; +import org.openapijsonschematools.client.components.schemas.EnumTest; + +import java.util.Arrays; +import java.util.List; +import java.util.AbstractMap; + +static final SchemaConfiguration configuration = new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().build()); + +// String validation +String validatedPayload = EnumTest.EnumStringRequired.validate( + "UPPER", + configuration +); +``` + +### Field Summary +| Modifier and Type | Field and Description | +| ----------------- | ---------------------- | +| Set> | type = Set.of(
    String.class
)
| +| Set | enumValues = SetMaker.makeSet(
    "UPPER",
    "lower",
    ""
)
| + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| String | validate(String arg, SchemaConfiguration configuration) | +| String | validate([StringEnumStringRequiredEnums](#stringenumstringrequiredenums) arg, SchemaConfiguration configuration) | +| [EnumStringRequiredBoxedString](#enumstringrequiredboxedstring) | validateAndBox(String arg, SchemaConfiguration configuration) | +| [EnumStringRequiredBoxed](#enumstringrequiredboxed) | validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) | +| @Nullable Object | validate(@Nullable Object arg, SchemaConfiguration configuration) | + +## StringEnumStringRequiredEnums +public enum StringEnumStringRequiredEnums
+extends `Enum` + +A class that stores String enum values + +### Enum Constant Summary +| Enum Constant | Description | +| ------------- | ----------- | +| UPPER | value = "UPPER" | +| LOWER | value = "lower" | +| EMPTY | value = "" | + +## EnumStringBoxed +public sealed interface EnumStringBoxed
+permits
+[EnumStringBoxedString](#enumstringboxedstring) + +sealed interface that stores validated payloads using boxed classes + +## EnumStringBoxedString +public record EnumStringBoxedString
+implements [EnumStringBoxed](#enumstringboxed) + +record that stores validated String payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| EnumStringBoxedString(String data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| String | data()
validated payload | +| @Nullable Object | getData()
validated payload | + +## EnumString +public static class EnumString
+extends JsonSchema + +A schema class that validates payloads + +### Code Sample +``` +import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags; +import org.openapijsonschematools.client.configurations.SchemaConfiguration; +import org.openapijsonschematools.client.exceptions.ValidationException; +import org.openapijsonschematools.client.schemas.validation.MapUtils; +import org.openapijsonschematools.client.schemas.validation.FrozenList; +import org.openapijsonschematools.client.schemas.validation.FrozenMap; +import org.openapijsonschematools.client.components.schemas.EnumTest; + +import java.util.Arrays; +import java.util.List; +import java.util.AbstractMap; + +static final SchemaConfiguration configuration = new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().build()); + +// String validation +String validatedPayload = EnumTest.EnumString.validate( + "UPPER", + configuration +); +``` + +### Field Summary +| Modifier and Type | Field and Description | +| ----------------- | ---------------------- | +| Set> | type = Set.of(
    String.class
)
| +| Set | enumValues = SetMaker.makeSet(
    "UPPER",
    "lower",
    ""
)
| + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| String | validate(String arg, SchemaConfiguration configuration) | +| String | validate([StringEnumStringEnums](#stringenumstringenums) arg, SchemaConfiguration configuration) | +| [EnumStringBoxedString](#enumstringboxedstring) | validateAndBox(String arg, SchemaConfiguration configuration) | +| [EnumStringBoxed](#enumstringboxed) | validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) | +| @Nullable Object | validate(@Nullable Object arg, SchemaConfiguration configuration) | + +## StringEnumStringEnums +public enum StringEnumStringEnums
+extends `Enum` + +A class that stores String enum values + +### Enum Constant Summary +| Enum Constant | Description | +| ------------- | ----------- | +| UPPER | value = "UPPER" | +| LOWER | value = "lower" | +| EMPTY | value = "" | + +[[Back to top]](#top) [[Back to Component Schemas]](../../../README.md#Component-Schemas) [[Back to README]](../../../README.md) diff --git a/samples/client/petstore/kotlin/docs/components/schemas/EquilateralTriangle.md b/samples/client/petstore/kotlin/docs/components/schemas/EquilateralTriangle.md new file mode 100644 index 00000000000..55ce3f9f8b2 --- /dev/null +++ b/samples/client/petstore/kotlin/docs/components/schemas/EquilateralTriangle.md @@ -0,0 +1,371 @@ +# EquilateralTriangle +org.openapijsonschematools.client.components.schemas.EquilateralTriangle.java +public class EquilateralTriangle
+ +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 | [EquilateralTriangle.EquilateralTriangle1Boxed](#equilateraltriangle1boxed)
sealed interface for validated payloads | +| record | [EquilateralTriangle.EquilateralTriangle1BoxedVoid](#equilateraltriangle1boxedvoid)
boxed class to store validated null payloads | +| record | [EquilateralTriangle.EquilateralTriangle1BoxedBoolean](#equilateraltriangle1boxedboolean)
boxed class to store validated boolean payloads | +| record | [EquilateralTriangle.EquilateralTriangle1BoxedNumber](#equilateraltriangle1boxednumber)
boxed class to store validated Number payloads | +| record | [EquilateralTriangle.EquilateralTriangle1BoxedString](#equilateraltriangle1boxedstring)
boxed class to store validated String payloads | +| record | [EquilateralTriangle.EquilateralTriangle1BoxedList](#equilateraltriangle1boxedlist)
boxed class to store validated List payloads | +| record | [EquilateralTriangle.EquilateralTriangle1BoxedMap](#equilateraltriangle1boxedmap)
boxed class to store validated Map payloads | +| static class | [EquilateralTriangle.EquilateralTriangle1](#equilateraltriangle1)
schema class | +| sealed interface | [EquilateralTriangle.Schema1Boxed](#schema1boxed)
sealed interface for validated payloads | +| record | [EquilateralTriangle.Schema1BoxedMap](#schema1boxedmap)
boxed class to store validated Map payloads | +| static class | [EquilateralTriangle.Schema1](#schema1)
schema class | +| static class | [EquilateralTriangle.Schema1MapBuilder](#schema1mapbuilder)
builder for Map payloads | +| static class | [EquilateralTriangle.Schema1Map](#schema1map)
output class for Map payloads | +| sealed interface | [EquilateralTriangle.TriangleTypeBoxed](#triangletypeboxed)
sealed interface for validated payloads | +| record | [EquilateralTriangle.TriangleTypeBoxedString](#triangletypeboxedstring)
boxed class to store validated String payloads | +| static class | [EquilateralTriangle.TriangleType](#triangletype)
schema class | +| enum | [EquilateralTriangle.StringTriangleTypeEnums](#stringtriangletypeenums)
String enum | + +## EquilateralTriangle1Boxed +public sealed interface EquilateralTriangle1Boxed
+permits
+[EquilateralTriangle1BoxedVoid](#equilateraltriangle1boxedvoid), +[EquilateralTriangle1BoxedBoolean](#equilateraltriangle1boxedboolean), +[EquilateralTriangle1BoxedNumber](#equilateraltriangle1boxednumber), +[EquilateralTriangle1BoxedString](#equilateraltriangle1boxedstring), +[EquilateralTriangle1BoxedList](#equilateraltriangle1boxedlist), +[EquilateralTriangle1BoxedMap](#equilateraltriangle1boxedmap) + +sealed interface that stores validated payloads using boxed classes + +## EquilateralTriangle1BoxedVoid +public record EquilateralTriangle1BoxedVoid
+implements [EquilateralTriangle1Boxed](#equilateraltriangle1boxed) + +record that stores validated null payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| EquilateralTriangle1BoxedVoid(Nothing? data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| Nothing? | data()
validated payload | +| @Nullable Object | getData()
validated payload | + +## EquilateralTriangle1BoxedBoolean +public record EquilateralTriangle1BoxedBoolean
+implements [EquilateralTriangle1Boxed](#equilateraltriangle1boxed) + +record that stores validated boolean payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| EquilateralTriangle1BoxedBoolean(boolean data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| boolean | data()
validated payload | +| @Nullable Object | getData()
validated payload | + +## EquilateralTriangle1BoxedNumber +public record EquilateralTriangle1BoxedNumber
+implements [EquilateralTriangle1Boxed](#equilateraltriangle1boxed) + +record that stores validated Number payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| EquilateralTriangle1BoxedNumber(Number data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| Number | data()
validated payload | +| @Nullable Object | getData()
validated payload | + +## EquilateralTriangle1BoxedString +public record EquilateralTriangle1BoxedString
+implements [EquilateralTriangle1Boxed](#equilateraltriangle1boxed) + +record that stores validated String payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| EquilateralTriangle1BoxedString(String data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| String | data()
validated payload | +| @Nullable Object | getData()
validated payload | + +## EquilateralTriangle1BoxedList +public record EquilateralTriangle1BoxedList
+implements [EquilateralTriangle1Boxed](#equilateraltriangle1boxed) + +record that stores validated List payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| EquilateralTriangle1BoxedList(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 | + +## EquilateralTriangle1BoxedMap +public record EquilateralTriangle1BoxedMap
+implements [EquilateralTriangle1Boxed](#equilateraltriangle1boxed) + +record that stores validated Map payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| EquilateralTriangle1BoxedMap(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 | + +## EquilateralTriangle1 +public static class EquilateralTriangle1
+extends JsonSchema + +A schema class that validates payloads + +### Field Summary +| Modifier and Type | Field and Description | +| ----------------- | ---------------------- | +| List> | allOf = List.of(
    [TriangleInterface.TriangleInterface1.class](../../components/schemas/TriangleInterface.md#triangleinterface1),
    [Schema1.class](#schema1)
;)
| + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| String | validate(String arg, SchemaConfiguration configuration) | +| Nothing? | validate(Nothing? arg, SchemaConfiguration configuration) | +| int | validate(int arg, SchemaConfiguration configuration) | +| long | validate(long arg, SchemaConfiguration configuration) | +| float | validate(float arg, SchemaConfiguration configuration) | +| double | validate(double arg, SchemaConfiguration configuration) | +| Number | validate(Number arg, SchemaConfiguration configuration) | +| boolean | validate(boolean arg, SchemaConfiguration configuration) | +| FrozenMap<@Nullable Object> | validate(Map<?, ?> arg, SchemaConfiguration configuration) | +| FrozenList<@Nullable Object> | validate(List arg, SchemaConfiguration configuration) | +| [EquilateralTriangle1BoxedString](#equilateraltriangle1boxedstring) | validateAndBox(String arg, SchemaConfiguration configuration) | +| [EquilateralTriangle1BoxedVoid](#equilateraltriangle1boxedvoid) | validateAndBox(Nothing? arg, SchemaConfiguration configuration) | +| [EquilateralTriangle1BoxedNumber](#equilateraltriangle1boxednumber) | validateAndBox(Number arg, SchemaConfiguration configuration) | +| [EquilateralTriangle1BoxedBoolean](#equilateraltriangle1boxedboolean) | validateAndBox(boolean arg, SchemaConfiguration configuration) | +| [EquilateralTriangle1BoxedMap](#equilateraltriangle1boxedmap) | validateAndBox(Map<?, ?> arg, SchemaConfiguration configuration) | +| [EquilateralTriangle1BoxedList](#equilateraltriangle1boxedlist) | validateAndBox(List arg, SchemaConfiguration configuration) | +| [EquilateralTriangle1Boxed](#equilateraltriangle1boxed) | validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) | +| @Nullable Object | validate(@Nullable Object arg, SchemaConfiguration configuration) | + +## Schema1Boxed +public sealed interface Schema1Boxed
+permits
+[Schema1BoxedMap](#schema1boxedmap) + +sealed interface that stores validated payloads using boxed classes + +## Schema1BoxedMap +public record Schema1BoxedMap
+implements [Schema1Boxed](#schema1boxed) + +record that stores validated Map payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| Schema1BoxedMap([Schema1Map](#schema1map) data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| [Schema1Map](#schema1map) | data()
validated payload | +| @Nullable Object | getData()
validated payload | + +## Schema1 +public static class Schema1
+extends JsonSchema + +A schema class that validates payloads + +### Code Sample +``` +import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags; +import org.openapijsonschematools.client.configurations.SchemaConfiguration; +import org.openapijsonschematools.client.exceptions.ValidationException; +import org.openapijsonschematools.client.schemas.validation.MapUtils; +import org.openapijsonschematools.client.schemas.validation.FrozenList; +import org.openapijsonschematools.client.schemas.validation.FrozenMap; +import org.openapijsonschematools.client.components.schemas.EquilateralTriangle; + +import java.util.Arrays; +import java.util.List; +import java.util.AbstractMap; + +static final SchemaConfiguration configuration = new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().build()); + +// Map validation +EquilateralTriangle.Schema1Map validatedPayload = + EquilateralTriangle.Schema1.validate( + new EquilateralTriangle.Schema1MapBuilder() + .triangleType("EquilateralTriangle") + + .build(), + configuration +); +``` + +### Field Summary +| Modifier and Type | Field and Description | +| ----------------- | ---------------------- | +| Set> | type = Set.of(Map.class) | +| Map> | properties = Map.ofEntries(
    new PropertyEntry("triangleType", [TriangleType.class](#triangletype)))
)
| + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| [Schema1Map](#schema1map) | validate([Map<?, ?>](#schema1mapbuilder) arg, SchemaConfiguration configuration) | +| [Schema1BoxedMap](#schema1boxedmap) | validateAndBox([Map<?, ?>](#schema1mapbuilder) arg, SchemaConfiguration configuration) | +| [Schema1Boxed](#schema1boxed) | validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) | +| @Nullable Object | validate(@Nullable Object arg, SchemaConfiguration configuration) | + +## Schema1MapBuilder +public class Schema1MapBuilder
+builder for `Map` + +A class that builds the Map input type + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| Schema1MapBuilder()
Creates a builder that contains an empty map | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| Map | build()
Returns map input that should be used with Schema.validate | +| [Schema1MapBuilder](#schema1mapbuilder) | triangleType(String value) | +| [Schema1MapBuilder](#schema1mapbuilder) | triangleType([StringTriangleTypeEnums](#stringtriangletypeenums) value) | +| [Schema1MapBuilder](#schema1mapbuilder) | additionalProperty(String key, Nothing? value) | +| [Schema1MapBuilder](#schema1mapbuilder) | additionalProperty(String key, boolean value) | +| [Schema1MapBuilder](#schema1mapbuilder) | additionalProperty(String key, String value) | +| [Schema1MapBuilder](#schema1mapbuilder) | additionalProperty(String key, int value) | +| [Schema1MapBuilder](#schema1mapbuilder) | additionalProperty(String key, float value) | +| [Schema1MapBuilder](#schema1mapbuilder) | additionalProperty(String key, long value) | +| [Schema1MapBuilder](#schema1mapbuilder) | additionalProperty(String key, double value) | +| [Schema1MapBuilder](#schema1mapbuilder) | additionalProperty(String key, List value) | +| [Schema1MapBuilder](#schema1mapbuilder) | additionalProperty(String key, Map value) | + +## Schema1Map +public static class Schema1Map
+extends FrozenMap + +A class to store validated Map payloads + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| static [Schema1Map](#schema1map) | of([Map](#schema1mapbuilder) arg, SchemaConfiguration configuration) | +| String | triangleType()
[optional] must be one of ["EquilateralTriangle"] | +| @Nullable Object | getAdditionalProperty(String name)
provides type safety for additional properties | + +## TriangleTypeBoxed +public sealed interface TriangleTypeBoxed
+permits
+[TriangleTypeBoxedString](#triangletypeboxedstring) + +sealed interface that stores validated payloads using boxed classes + +## TriangleTypeBoxedString +public record TriangleTypeBoxedString
+implements [TriangleTypeBoxed](#triangletypeboxed) + +record that stores validated String payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| TriangleTypeBoxedString(String data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| String | data()
validated payload | +| @Nullable Object | getData()
validated payload | + +## TriangleType +public static class TriangleType
+extends JsonSchema + +A schema class that validates payloads + +### Code Sample +``` +import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags; +import org.openapijsonschematools.client.configurations.SchemaConfiguration; +import org.openapijsonschematools.client.exceptions.ValidationException; +import org.openapijsonschematools.client.schemas.validation.MapUtils; +import org.openapijsonschematools.client.schemas.validation.FrozenList; +import org.openapijsonschematools.client.schemas.validation.FrozenMap; +import org.openapijsonschematools.client.components.schemas.EquilateralTriangle; + +import java.util.Arrays; +import java.util.List; +import java.util.AbstractMap; + +static final SchemaConfiguration configuration = new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().build()); + +// String validation +String validatedPayload = EquilateralTriangle.TriangleType.validate( + "EquilateralTriangle", + configuration +); +``` + +### Field Summary +| Modifier and Type | Field and Description | +| ----------------- | ---------------------- | +| Set> | type = Set.of(
    String.class
)
| +| Set | enumValues = SetMaker.makeSet(
    "EquilateralTriangle"
)
| + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| String | validate(String arg, SchemaConfiguration configuration) | +| String | validate([StringTriangleTypeEnums](#stringtriangletypeenums) arg, SchemaConfiguration configuration) | +| [TriangleTypeBoxedString](#triangletypeboxedstring) | validateAndBox(String arg, SchemaConfiguration configuration) | +| [TriangleTypeBoxed](#triangletypeboxed) | validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) | +| @Nullable Object | validate(@Nullable Object arg, SchemaConfiguration configuration) | + +## StringTriangleTypeEnums +public enum StringTriangleTypeEnums
+extends `Enum` + +A class that stores String enum values + +### Enum Constant Summary +| Enum Constant | Description | +| ------------- | ----------- | +| EQUILATERAL_TRIANGLE | value = "EquilateralTriangle" | + +[[Back to top]](#top) [[Back to Component Schemas]](../../../README.md#Component-Schemas) [[Back to README]](../../../README.md) diff --git a/samples/client/petstore/kotlin/docs/components/schemas/File.md b/samples/client/petstore/kotlin/docs/components/schemas/File.md new file mode 100644 index 00000000000..f8126c53460 --- /dev/null +++ b/samples/client/petstore/kotlin/docs/components/schemas/File.md @@ -0,0 +1,175 @@ +# File +org.openapijsonschematools.client.components.schemas.File.java +public class File
+ +A class that contains necessary nested +- schema classes (which validate payloads), extends JsonSchema +- sealed interfaces which store validated payloads, java version of a sum type +- boxed classes which store validated payloads, sealed permits class implementations +- classes to store validated map payloads, extends FrozenMap +- classes to build inputs for map payloads + +## Nested Class Summary +| Modifier and Type | Class and Description | +| ----------------- | ---------------------- | +| sealed interface | [File.File1Boxed](#file1boxed)
sealed interface for validated payloads | +| record | [File.File1BoxedMap](#file1boxedmap)
boxed class to store validated Map payloads | +| static class | [File.File1](#file1)
schema class | +| static class | [File.FileMapBuilder](#filemapbuilder)
builder for Map payloads | +| static class | [File.FileMap](#filemap)
output class for Map payloads | +| sealed interface | [File.SourceURIBoxed](#sourceuriboxed)
sealed interface for validated payloads | +| record | [File.SourceURIBoxedString](#sourceuriboxedstring)
boxed class to store validated String payloads | +| static class | [File.SourceURI](#sourceuri)
schema class | + +## File1Boxed +public sealed interface File1Boxed
+permits
+[File1BoxedMap](#file1boxedmap) + +sealed interface that stores validated payloads using boxed classes + +## File1BoxedMap +public record File1BoxedMap
+implements [File1Boxed](#file1boxed) + +record that stores validated Map payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| File1BoxedMap([FileMap](#filemap) data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| [FileMap](#filemap) | data()
validated payload | +| @Nullable Object | getData()
validated payload | + +## File1 +public static class File1
+extends JsonSchema + +A schema class that validates payloads + +## Description +Must be named `File` for test. + +### Code Sample +``` +import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags; +import org.openapijsonschematools.client.configurations.SchemaConfiguration; +import org.openapijsonschematools.client.exceptions.ValidationException; +import org.openapijsonschematools.client.schemas.validation.MapUtils; +import org.openapijsonschematools.client.schemas.validation.FrozenList; +import org.openapijsonschematools.client.schemas.validation.FrozenMap; +import org.openapijsonschematools.client.components.schemas.File; + +import java.util.Arrays; +import java.util.List; +import java.util.AbstractMap; + +static final SchemaConfiguration configuration = new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().build()); + +// Map validation +File.FileMap validatedPayload = + File.File1.validate( + new File.FileMapBuilder() + .sourceURI("a") + + .build(), + configuration +); +``` + +### Field Summary +| Modifier and Type | Field and Description | +| ----------------- | ---------------------- | +| Set> | type = Set.of(Map.class) | +| Map> | properties = Map.ofEntries(
    new PropertyEntry("sourceURI", [SourceURI.class](#sourceuri)))
)
| + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| [FileMap](#filemap) | validate([Map<?, ?>](#filemapbuilder) arg, SchemaConfiguration configuration) | +| [File1BoxedMap](#file1boxedmap) | validateAndBox([Map<?, ?>](#filemapbuilder) arg, SchemaConfiguration configuration) | +| [File1Boxed](#file1boxed) | validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) | +| @Nullable Object | validate(@Nullable Object arg, SchemaConfiguration configuration) | + +## FileMapBuilder +public class FileMapBuilder
+builder for `Map` + +A class that builds the Map input type + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| FileMapBuilder()
Creates a builder that contains an empty map | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| Map | build()
Returns map input that should be used with Schema.validate | +| [FileMapBuilder](#filemapbuilder) | sourceURI(String value) | +| [FileMapBuilder](#filemapbuilder) | additionalProperty(String key, Nothing? value) | +| [FileMapBuilder](#filemapbuilder) | additionalProperty(String key, boolean value) | +| [FileMapBuilder](#filemapbuilder) | additionalProperty(String key, String value) | +| [FileMapBuilder](#filemapbuilder) | additionalProperty(String key, int value) | +| [FileMapBuilder](#filemapbuilder) | additionalProperty(String key, float value) | +| [FileMapBuilder](#filemapbuilder) | additionalProperty(String key, long value) | +| [FileMapBuilder](#filemapbuilder) | additionalProperty(String key, double value) | +| [FileMapBuilder](#filemapbuilder) | additionalProperty(String key, List value) | +| [FileMapBuilder](#filemapbuilder) | additionalProperty(String key, Map value) | + +## FileMap +public static class FileMap
+extends FrozenMap + +A class to store validated Map payloads + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| static [FileMap](#filemap) | of([Map](#filemapbuilder) arg, SchemaConfiguration configuration) | +| String | sourceURI()
[optional] | +| @Nullable Object | getAdditionalProperty(String name)
provides type safety for additional properties | + +## SourceURIBoxed +public sealed interface SourceURIBoxed
+permits
+[SourceURIBoxedString](#sourceuriboxedstring) + +sealed interface that stores validated payloads using boxed classes + +## SourceURIBoxedString +public record SourceURIBoxedString
+implements [SourceURIBoxed](#sourceuriboxed) + +record that stores validated String payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| SourceURIBoxedString(String data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| String | data()
validated payload | +| @Nullable Object | getData()
validated payload | + +## SourceURI +public static class SourceURI
+extends StringJsonSchema.StringJsonSchema1 + +A schema class that validates payloads + +## Description +Test capitalization + +| Methods Inherited from class org.openapijsonschematools.client.schemas.StringJsonSchema.StringJsonSchema1 | +| ------------------------------------------------------------------ | +| validate | +| validateAndBox | + +[[Back to top]](#top) [[Back to Component Schemas]](../../../README.md#Component-Schemas) [[Back to README]](../../../README.md) diff --git a/samples/client/petstore/kotlin/docs/components/schemas/FileSchemaTestClass.md b/samples/client/petstore/kotlin/docs/components/schemas/FileSchemaTestClass.md new file mode 100644 index 00000000000..eabdba125c0 --- /dev/null +++ b/samples/client/petstore/kotlin/docs/components/schemas/FileSchemaTestClass.md @@ -0,0 +1,240 @@ +# FileSchemaTestClass +org.openapijsonschematools.client.components.schemas.FileSchemaTestClass.java +public class FileSchemaTestClass
+ +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 list payloads, extends FrozenList +- classes to build inputs for list payloads +- classes to store validated map payloads, extends FrozenMap +- classes to build inputs for map payloads + +## Nested Class Summary +| Modifier and Type | Class and Description | +| ----------------- | ---------------------- | +| sealed interface | [FileSchemaTestClass.FileSchemaTestClass1Boxed](#fileschematestclass1boxed)
sealed interface for validated payloads | +| record | [FileSchemaTestClass.FileSchemaTestClass1BoxedMap](#fileschematestclass1boxedmap)
boxed class to store validated Map payloads | +| static class | [FileSchemaTestClass.FileSchemaTestClass1](#fileschematestclass1)
schema class | +| static class | [FileSchemaTestClass.FileSchemaTestClassMapBuilder](#fileschematestclassmapbuilder)
builder for Map payloads | +| static class | [FileSchemaTestClass.FileSchemaTestClassMap](#fileschematestclassmap)
output class for Map payloads | +| sealed interface | [FileSchemaTestClass.FilesBoxed](#filesboxed)
sealed interface for validated payloads | +| record | [FileSchemaTestClass.FilesBoxedList](#filesboxedlist)
boxed class to store validated List payloads | +| static class | [FileSchemaTestClass.Files](#files)
schema class | +| static class | [FileSchemaTestClass.FilesListBuilder](#fileslistbuilder)
builder for List payloads | +| static class | [FileSchemaTestClass.FilesList](#fileslist)
output class for List payloads | + +## FileSchemaTestClass1Boxed +public sealed interface FileSchemaTestClass1Boxed
+permits
+[FileSchemaTestClass1BoxedMap](#fileschematestclass1boxedmap) + +sealed interface that stores validated payloads using boxed classes + +## FileSchemaTestClass1BoxedMap +public record FileSchemaTestClass1BoxedMap
+implements [FileSchemaTestClass1Boxed](#fileschematestclass1boxed) + +record that stores validated Map payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| FileSchemaTestClass1BoxedMap([FileSchemaTestClassMap](#fileschematestclassmap) data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| [FileSchemaTestClassMap](#fileschematestclassmap) | data()
validated payload | +| @Nullable Object | getData()
validated payload | + +## FileSchemaTestClass1 +public static class FileSchemaTestClass1
+extends JsonSchema + +A schema class that validates payloads + +### Code Sample +``` +import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags; +import org.openapijsonschematools.client.configurations.SchemaConfiguration; +import org.openapijsonschematools.client.exceptions.ValidationException; +import org.openapijsonschematools.client.schemas.validation.MapUtils; +import org.openapijsonschematools.client.schemas.validation.FrozenList; +import org.openapijsonschematools.client.schemas.validation.FrozenMap; +import org.openapijsonschematools.client.components.schemas.FileSchemaTestClass; + +import java.util.Arrays; +import java.util.List; +import java.util.AbstractMap; + +static final SchemaConfiguration configuration = new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().build()); + +// Map validation +FileSchemaTestClass.FileSchemaTestClassMap validatedPayload = + FileSchemaTestClass.FileSchemaTestClass1.validate( + new FileSchemaTestClass.FileSchemaTestClassMapBuilder() + .files( + Arrays.asList( + ) + ) + .build(), + configuration +); +``` + +### Field Summary +| Modifier and Type | Field and Description | +| ----------------- | ---------------------- | +| Set> | type = Set.of(Map.class) | +| Map> | properties = Map.ofEntries(
    new PropertyEntry("file", [File.File1.class](../../components/schemas/File.md#file1)),
    new PropertyEntry("files", [Files.class](#files)))
)
| + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| [FileSchemaTestClassMap](#fileschematestclassmap) | validate([Map<?, ?>](#fileschematestclassmapbuilder) arg, SchemaConfiguration configuration) | +| [FileSchemaTestClass1BoxedMap](#fileschematestclass1boxedmap) | validateAndBox([Map<?, ?>](#fileschematestclassmapbuilder) arg, SchemaConfiguration configuration) | +| [FileSchemaTestClass1Boxed](#fileschematestclass1boxed) | validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) | +| @Nullable Object | validate(@Nullable Object arg, SchemaConfiguration configuration) | + +## FileSchemaTestClassMapBuilder +public class FileSchemaTestClassMapBuilder
+builder for `Map` + +A class that builds the Map input type + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| FileSchemaTestClassMapBuilder()
Creates a builder that contains an empty map | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| Map | build()
Returns map input that should be used with Schema.validate | +| [FileSchemaTestClassMapBuilder](#fileschematestclassmapbuilder) | file(Map value) | +| [FileSchemaTestClassMapBuilder](#fileschematestclassmapbuilder) | files(List> value) | +| [FileSchemaTestClassMapBuilder](#fileschematestclassmapbuilder) | additionalProperty(String key, Nothing? value) | +| [FileSchemaTestClassMapBuilder](#fileschematestclassmapbuilder) | additionalProperty(String key, boolean value) | +| [FileSchemaTestClassMapBuilder](#fileschematestclassmapbuilder) | additionalProperty(String key, String value) | +| [FileSchemaTestClassMapBuilder](#fileschematestclassmapbuilder) | additionalProperty(String key, int value) | +| [FileSchemaTestClassMapBuilder](#fileschematestclassmapbuilder) | additionalProperty(String key, float value) | +| [FileSchemaTestClassMapBuilder](#fileschematestclassmapbuilder) | additionalProperty(String key, long value) | +| [FileSchemaTestClassMapBuilder](#fileschematestclassmapbuilder) | additionalProperty(String key, double value) | +| [FileSchemaTestClassMapBuilder](#fileschematestclassmapbuilder) | additionalProperty(String key, List value) | +| [FileSchemaTestClassMapBuilder](#fileschematestclassmapbuilder) | additionalProperty(String key, Map value) | + +## FileSchemaTestClassMap +public static class FileSchemaTestClassMap
+extends FrozenMap + +A class to store validated Map payloads + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| static [FileSchemaTestClassMap](#fileschematestclassmap) | of([Map](#fileschematestclassmapbuilder) arg, SchemaConfiguration configuration) | +| [File.FileMap](../../components/schemas/File.md#filemap) | file()
[optional] | +| [FilesList](#fileslist) | files()
[optional] | +| @Nullable Object | getAdditionalProperty(String name)
provides type safety for additional properties | + +## FilesBoxed +public sealed interface FilesBoxed
+permits
+[FilesBoxedList](#filesboxedlist) + +sealed interface that stores validated payloads using boxed classes + +## FilesBoxedList +public record FilesBoxedList
+implements [FilesBoxed](#filesboxed) + +record that stores validated List payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| FilesBoxedList([FilesList](#fileslist) data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| [FilesList](#fileslist) | data()
validated payload | +| @Nullable Object | getData()
validated payload | + +## Files +public static class Files
+extends JsonSchema + +A schema class that validates payloads + +### Code Sample +``` +import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags; +import org.openapijsonschematools.client.configurations.SchemaConfiguration; +import org.openapijsonschematools.client.exceptions.ValidationException; +import org.openapijsonschematools.client.schemas.validation.MapUtils; +import org.openapijsonschematools.client.schemas.validation.FrozenList; +import org.openapijsonschematools.client.schemas.validation.FrozenMap; +import org.openapijsonschematools.client.components.schemas.FileSchemaTestClass; + +import java.util.Arrays; +import java.util.List; +import java.util.AbstractMap; + +static final SchemaConfiguration configuration = new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().build()); + +// List validation +FileSchemaTestClass.FilesList validatedPayload = + FileSchemaTestClass.Files.validate( + new FileSchemaTestClass.FilesListBuilder() + .build(), + configuration +); +``` + +### Field Summary +| Modifier and Type | Field and Description | +| ----------------- | ---------------------- | +| Set> | type = Set.of(List.class) | +| Class | items = [File.File1.class](../../components/schemas/File.md#file1) | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| [FilesList](#fileslist) | validate([List](#fileslistbuilder) arg, SchemaConfiguration configuration) | +| [FilesBoxedList](#filesboxedlist) | validateAndBox([List](#fileslistbuilder) arg, SchemaConfiguration configuration) | +| [FilesBoxed](#filesboxed) | validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) | +| @Nullable Object | validate(@Nullable Object arg, SchemaConfiguration configuration) | + +## FilesListBuilder +public class FilesListBuilder
+builder for `List>` + +A class that builds the List input type + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| FilesListBuilder()
Creates an empty list | +| FilesListBuilder(List> items)
Stores the items in a list | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| FilesListBuilder | add(Map item) | +| List> | build()
Returns list input that should be used with Schema.validate | + +## FilesList +public class FilesList
+extends `FrozenList` + +A class to store validated List payloads + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| static [FilesList](#fileslist) | of([List>](#fileslistbuilder) arg, SchemaConfiguration configuration) | + +[[Back to top]](#top) [[Back to Component Schemas]](../../../README.md#Component-Schemas) [[Back to README]](../../../README.md) diff --git a/samples/client/petstore/kotlin/docs/components/schemas/Foo.md b/samples/client/petstore/kotlin/docs/components/schemas/Foo.md new file mode 100644 index 00000000000..4bedecdb95d --- /dev/null +++ b/samples/client/petstore/kotlin/docs/components/schemas/Foo.md @@ -0,0 +1,129 @@ +# Foo +org.openapijsonschematools.client.components.schemas.Foo.java +public class Foo
+ +A class that contains necessary nested +- schema classes (which validate payloads), extends JsonSchema +- sealed interfaces which store validated payloads, java version of a sum type +- boxed classes which store validated payloads, sealed permits class implementations +- classes to store validated map payloads, extends FrozenMap +- classes to build inputs for map payloads + +## Nested Class Summary +| Modifier and Type | Class and Description | +| ----------------- | ---------------------- | +| sealed interface | [Foo.Foo1Boxed](#foo1boxed)
sealed interface for validated payloads | +| record | [Foo.Foo1BoxedMap](#foo1boxedmap)
boxed class to store validated Map payloads | +| static class | [Foo.Foo1](#foo1)
schema class | +| static class | [Foo.FooMapBuilder](#foomapbuilder)
builder for Map payloads | +| static class | [Foo.FooMap](#foomap)
output class for Map payloads | + +## Foo1Boxed +public sealed interface Foo1Boxed
+permits
+[Foo1BoxedMap](#foo1boxedmap) + +sealed interface that stores validated payloads using boxed classes + +## Foo1BoxedMap +public record Foo1BoxedMap
+implements [Foo1Boxed](#foo1boxed) + +record that stores validated Map payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| Foo1BoxedMap([FooMap](#foomap) data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| [FooMap](#foomap) | data()
validated payload | +| @Nullable Object | getData()
validated payload | + +## Foo1 +public static class Foo1
+extends JsonSchema + +A schema class that validates payloads + +### Code Sample +``` +import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags; +import org.openapijsonschematools.client.configurations.SchemaConfiguration; +import org.openapijsonschematools.client.exceptions.ValidationException; +import org.openapijsonschematools.client.schemas.validation.MapUtils; +import org.openapijsonschematools.client.schemas.validation.FrozenList; +import org.openapijsonschematools.client.schemas.validation.FrozenMap; +import org.openapijsonschematools.client.components.schemas.Foo; + +import java.util.Arrays; +import java.util.List; +import java.util.AbstractMap; + +static final SchemaConfiguration configuration = new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().build()); + +// Map validation +Foo.FooMap validatedPayload = + Foo.Foo1.validate( + new Foo.FooMapBuilder() + .build(), + configuration +); +``` + +### Field Summary +| Modifier and Type | Field and Description | +| ----------------- | ---------------------- | +| Set> | type = Set.of(Map.class) | +| Map> | properties = Map.ofEntries(
    new PropertyEntry("bar", [Bar.Bar1.class](../../components/schemas/Bar.md#bar1))
)
| + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| [FooMap](#foomap) | validate([Map<?, ?>](#foomapbuilder) arg, SchemaConfiguration configuration) | +| [Foo1BoxedMap](#foo1boxedmap) | validateAndBox([Map<?, ?>](#foomapbuilder) arg, SchemaConfiguration configuration) | +| [Foo1Boxed](#foo1boxed) | validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) | +| @Nullable Object | validate(@Nullable Object arg, SchemaConfiguration configuration) | + +## FooMapBuilder +public class FooMapBuilder
+builder for `Map` + +A class that builds the Map input type + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| FooMapBuilder()
Creates a builder that contains an empty map | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| Map | build()
Returns map input that should be used with Schema.validate | +| [FooMapBuilder](#foomapbuilder) | bar(String value) | +| [FooMapBuilder](#foomapbuilder) | additionalProperty(String key, Nothing? value) | +| [FooMapBuilder](#foomapbuilder) | additionalProperty(String key, boolean value) | +| [FooMapBuilder](#foomapbuilder) | additionalProperty(String key, String value) | +| [FooMapBuilder](#foomapbuilder) | additionalProperty(String key, int value) | +| [FooMapBuilder](#foomapbuilder) | additionalProperty(String key, float value) | +| [FooMapBuilder](#foomapbuilder) | additionalProperty(String key, long value) | +| [FooMapBuilder](#foomapbuilder) | additionalProperty(String key, double value) | +| [FooMapBuilder](#foomapbuilder) | additionalProperty(String key, List value) | +| [FooMapBuilder](#foomapbuilder) | additionalProperty(String key, Map value) | + +## FooMap +public static class FooMap
+extends FrozenMap + +A class to store validated Map payloads + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| static [FooMap](#foomap) | of([Map](#foomapbuilder) arg, SchemaConfiguration configuration) | +| String | bar()
[optional] | +| @Nullable Object | getAdditionalProperty(String name)
provides type safety for additional properties | + +[[Back to top]](#top) [[Back to Component Schemas]](../../../README.md#Component-Schemas) [[Back to README]](../../../README.md) diff --git a/samples/client/petstore/kotlin/docs/components/schemas/FormatTest.md b/samples/client/petstore/kotlin/docs/components/schemas/FormatTest.md new file mode 100644 index 00000000000..78dee00ba4b --- /dev/null +++ b/samples/client/petstore/kotlin/docs/components/schemas/FormatTest.md @@ -0,0 +1,1696 @@ +# FormatTest +org.openapijsonschematools.client.components.schemas.FormatTest.java +public class FormatTest
+ +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 list payloads, extends FrozenList +- classes to build inputs for list payloads +- classes to store validated map payloads, extends FrozenMap +- classes to build inputs for map payloads + +## Nested Class Summary +| Modifier and Type | Class and Description | +| ----------------- | ---------------------- | +| sealed interface | [FormatTest.FormatTest1Boxed](#formattest1boxed)
sealed interface for validated payloads | +| record | [FormatTest.FormatTest1BoxedMap](#formattest1boxedmap)
boxed class to store validated Map payloads | +| static class | [FormatTest.FormatTest1](#formattest1)
schema class | +| static class | [FormatTest.FormatTestMapBuilder](#formattestmapbuilder)
builder for Map payloads | +| static class | [FormatTest.FormatTestMap](#formattestmap)
output class for Map payloads | +| sealed interface | [FormatTest.NonePropBoxed](#nonepropboxed)
sealed interface for validated payloads | +| record | [FormatTest.NonePropBoxedVoid](#nonepropboxedvoid)
boxed class to store validated null payloads | +| static class | [FormatTest.NoneProp](#noneprop)
schema class | +| sealed interface | [FormatTest.PatternWithDigitsAndDelimiterBoxed](#patternwithdigitsanddelimiterboxed)
sealed interface for validated payloads | +| record | [FormatTest.PatternWithDigitsAndDelimiterBoxedString](#patternwithdigitsanddelimiterboxedstring)
boxed class to store validated String payloads | +| static class | [FormatTest.PatternWithDigitsAndDelimiter](#patternwithdigitsanddelimiter)
schema class | +| sealed interface | [FormatTest.PatternWithDigitsBoxed](#patternwithdigitsboxed)
sealed interface for validated payloads | +| record | [FormatTest.PatternWithDigitsBoxedString](#patternwithdigitsboxedstring)
boxed class to store validated String payloads | +| static class | [FormatTest.PatternWithDigits](#patternwithdigits)
schema class | +| sealed interface | [FormatTest.PasswordBoxed](#passwordboxed)
sealed interface for validated payloads | +| record | [FormatTest.PasswordBoxedString](#passwordboxedstring)
boxed class to store validated String payloads | +| static class | [FormatTest.Password](#password)
schema class | +| sealed interface | [FormatTest.UuidNoExampleBoxed](#uuidnoexampleboxed)
sealed interface for validated payloads | +| record | [FormatTest.UuidNoExampleBoxedString](#uuidnoexampleboxedstring)
boxed class to store validated String payloads | +| static class | [FormatTest.UuidNoExample](#uuidnoexample)
schema class | +| sealed interface | [FormatTest.UuidSchemaBoxed](#uuidschemaboxed)
sealed interface for validated payloads | +| record | [FormatTest.UuidSchemaBoxedString](#uuidschemaboxedstring)
boxed class to store validated String payloads | +| static class | [FormatTest.UuidSchema](#uuidschema)
schema class | +| sealed interface | [FormatTest.DateTimeBoxed](#datetimeboxed)
sealed interface for validated payloads | +| record | [FormatTest.DateTimeBoxedString](#datetimeboxedstring)
boxed class to store validated String payloads | +| static class | [FormatTest.DateTime](#datetime)
schema class | +| sealed interface | [FormatTest.DateBoxed](#dateboxed)
sealed interface for validated payloads | +| record | [FormatTest.DateBoxedString](#dateboxedstring)
boxed class to store validated String payloads | +| static class | [FormatTest.Date](#date)
schema class | +| sealed interface | [FormatTest.BinaryBoxed](#binaryboxed)
sealed interface for validated payloads | +| static class | [FormatTest.Binary](#binary)
schema class | +| sealed interface | [FormatTest.ByteSchemaBoxed](#byteschemaboxed)
sealed interface for validated payloads | +| record | [FormatTest.ByteSchemaBoxedString](#byteschemaboxedstring)
boxed class to store validated String payloads | +| static class | [FormatTest.ByteSchema](#byteschema)
schema class | +| sealed interface | [FormatTest.StringSchemaBoxed](#stringschemaboxed)
sealed interface for validated payloads | +| record | [FormatTest.StringSchemaBoxedString](#stringschemaboxedstring)
boxed class to store validated String payloads | +| static class | [FormatTest.StringSchema](#stringschema)
schema class | +| sealed interface | [FormatTest.ArrayWithUniqueItemsBoxed](#arraywithuniqueitemsboxed)
sealed interface for validated payloads | +| record | [FormatTest.ArrayWithUniqueItemsBoxedList](#arraywithuniqueitemsboxedlist)
boxed class to store validated List payloads | +| static class | [FormatTest.ArrayWithUniqueItems](#arraywithuniqueitems)
schema class | +| static class | [FormatTest.ArrayWithUniqueItemsListBuilder](#arraywithuniqueitemslistbuilder)
builder for List payloads | +| static class | [FormatTest.ArrayWithUniqueItemsList](#arraywithuniqueitemslist)
output class for List payloads | +| sealed interface | [FormatTest.ItemsBoxed](#itemsboxed)
sealed interface for validated payloads | +| record | [FormatTest.ItemsBoxedNumber](#itemsboxednumber)
boxed class to store validated Number payloads | +| static class | [FormatTest.Items](#items)
schema class | +| sealed interface | [FormatTest.Float64Boxed](#float64boxed)
sealed interface for validated payloads | +| record | [FormatTest.Float64BoxedNumber](#float64boxednumber)
boxed class to store validated Number payloads | +| static class | [FormatTest.Float64](#float64)
schema class | +| sealed interface | [FormatTest.DoubleSchemaBoxed](#doubleschemaboxed)
sealed interface for validated payloads | +| record | [FormatTest.DoubleSchemaBoxedNumber](#doubleschemaboxednumber)
boxed class to store validated Number payloads | +| static class | [FormatTest.DoubleSchema](#doubleschema)
schema class | +| sealed interface | [FormatTest.Float32Boxed](#float32boxed)
sealed interface for validated payloads | +| record | [FormatTest.Float32BoxedNumber](#float32boxednumber)
boxed class to store validated Number payloads | +| static class | [FormatTest.Float32](#float32)
schema class | +| sealed interface | [FormatTest.FloatSchemaBoxed](#floatschemaboxed)
sealed interface for validated payloads | +| record | [FormatTest.FloatSchemaBoxedNumber](#floatschemaboxednumber)
boxed class to store validated Number payloads | +| static class | [FormatTest.FloatSchema](#floatschema)
schema class | +| sealed interface | [FormatTest.NumberSchemaBoxed](#numberschemaboxed)
sealed interface for validated payloads | +| record | [FormatTest.NumberSchemaBoxedNumber](#numberschemaboxednumber)
boxed class to store validated Number payloads | +| static class | [FormatTest.NumberSchema](#numberschema)
schema class | +| sealed interface | [FormatTest.Int64Boxed](#int64boxed)
sealed interface for validated payloads | +| record | [FormatTest.Int64BoxedNumber](#int64boxednumber)
boxed class to store validated Number payloads | +| static class | [FormatTest.Int64](#int64)
schema class | +| sealed interface | [FormatTest.Int32withValidationsBoxed](#int32withvalidationsboxed)
sealed interface for validated payloads | +| record | [FormatTest.Int32withValidationsBoxedNumber](#int32withvalidationsboxednumber)
boxed class to store validated Number payloads | +| static class | [FormatTest.Int32withValidations](#int32withvalidations)
schema class | +| sealed interface | [FormatTest.Int32Boxed](#int32boxed)
sealed interface for validated payloads | +| record | [FormatTest.Int32BoxedNumber](#int32boxednumber)
boxed class to store validated Number payloads | +| static class | [FormatTest.Int32](#int32)
schema class | +| sealed interface | [FormatTest.IntegerSchemaBoxed](#integerschemaboxed)
sealed interface for validated payloads | +| record | [FormatTest.IntegerSchemaBoxedNumber](#integerschemaboxednumber)
boxed class to store validated Number payloads | +| static class | [FormatTest.IntegerSchema](#integerschema)
schema class | + +## FormatTest1Boxed +public sealed interface FormatTest1Boxed
+permits
+[FormatTest1BoxedMap](#formattest1boxedmap) + +sealed interface that stores validated payloads using boxed classes + +## FormatTest1BoxedMap +public record FormatTest1BoxedMap
+implements [FormatTest1Boxed](#formattest1boxed) + +record that stores validated Map payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| FormatTest1BoxedMap([FormatTestMap](#formattestmap) data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| [FormatTestMap](#formattestmap) | data()
validated payload | +| @Nullable Object | getData()
validated payload | + +## FormatTest1 +public static class FormatTest1
+extends JsonSchema + +A schema class that validates payloads + +### Code Sample +``` +import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags; +import org.openapijsonschematools.client.configurations.SchemaConfiguration; +import org.openapijsonschematools.client.exceptions.ValidationException; +import org.openapijsonschematools.client.schemas.validation.MapUtils; +import org.openapijsonschematools.client.schemas.validation.FrozenList; +import org.openapijsonschematools.client.schemas.validation.FrozenMap; +import org.openapijsonschematools.client.components.schemas.FormatTest; + +import java.util.Arrays; +import java.util.List; +import java.util.AbstractMap; + +static final SchemaConfiguration configuration = new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().build()); + +// Map validation +FormatTest.FormatTestMap validatedPayload = + FormatTest.FormatTest1.validate( + new FormatTest.FormatTestMapBuilder() + .setByte("a") + + .date("2020-12-13") + + .setNumber(1) + + .password("a") + + .setInteger(1) + + .int32(1) + + .int32withValidations(1) + + .int64(1L) + + .setFloat(3.14f) + + .float32(3.14f) + + .setDouble(3.14d) + + .float64(3.14d) + + .arrayWithUniqueItems( + Arrays.asList( + 1 + ) + ) + .setString("A") + + .binary("a") + + .dateTime("1970-01-01T00:00:00.00Z") + + .setUuid("046b6c7f-0b8a-43b9-b35d-6489e6daee91") + + .uuidNoExample("046b6c7f-0b8a-43b9-b35d-6489e6daee91") + + .pattern_with_digits("0480728880") + + .pattern_with_digits_and_delimiter("IMage_88") + + .noneProp(null) + + .build(), + configuration +); +``` + +### Field Summary +| Modifier and Type | Field and Description | +| ----------------- | ---------------------- | +| Set> | type = Set.of(Map.class) | +| Map> | properties = Map.ofEntries(
    new PropertyEntry("integer", [IntegerSchema.class](#integerschema))),
    new PropertyEntry("int32", [Int32.class](#int32))),
    new PropertyEntry("int32withValidations", [Int32withValidations.class](#int32withvalidations))),
    new PropertyEntry("int64", [Int64.class](#int64))),
    new PropertyEntry("number", [NumberSchema.class](#numberschema))),
    new PropertyEntry("float", [FloatSchema.class](#floatschema))),
    new PropertyEntry("float32", [Float32.class](#float32))),
    new PropertyEntry("double", [DoubleSchema.class](#doubleschema))),
    new PropertyEntry("float64", [Float64.class](#float64))),
    new PropertyEntry("arrayWithUniqueItems", [ArrayWithUniqueItems.class](#arraywithuniqueitems))),
    new PropertyEntry("string", [StringSchema.class](#stringschema))),
    new PropertyEntry("byte", [ByteSchema.class](#byteschema))),
    new PropertyEntry("binary", [Binary.class](#binary))),
    new PropertyEntry("date", [Date.class](#date))),
    new PropertyEntry("dateTime", [DateTime.class](#datetime))),
    new PropertyEntry("uuid", [UuidSchema.class](#uuidschema))),
    new PropertyEntry("uuidNoExample", [UuidNoExample.class](#uuidnoexample))),
    new PropertyEntry("password", [Password.class](#password))),
    new PropertyEntry("pattern_with_digits", [PatternWithDigits.class](#patternwithdigits))),
    new PropertyEntry("pattern_with_digits_and_delimiter", [PatternWithDigitsAndDelimiter.class](#patternwithdigitsanddelimiter))),
    new PropertyEntry("noneProp", [NoneProp.class](#noneprop)))
)
| +| Set | required = Set.of(
    "byte",
    "date",
    "number",
    "password"
)
| + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| [FormatTestMap](#formattestmap) | validate([Map<?, ?>](#formattestmapbuilder) arg, SchemaConfiguration configuration) | +| [FormatTest1BoxedMap](#formattest1boxedmap) | validateAndBox([Map<?, ?>](#formattestmapbuilder) arg, SchemaConfiguration configuration) | +| [FormatTest1Boxed](#formattest1boxed) | validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) | +| @Nullable Object | validate(@Nullable Object arg, SchemaConfiguration configuration) | + +## FormatTestMap0000Builder +public class FormatTestMap0000Builder
+builder for `Map` + +A class that builds the Map input type + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| FormatTestMap0000Builder(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 | +| [FormatTestMap0000Builder](#formattestmap0000builder) | setInteger(int value) | +| [FormatTestMap0000Builder](#formattestmap0000builder) | setInteger(float value) | +| [FormatTestMap0000Builder](#formattestmap0000builder) | setInteger(long value) | +| [FormatTestMap0000Builder](#formattestmap0000builder) | setInteger(double value) | +| [FormatTestMap0000Builder](#formattestmap0000builder) | int32(int value) | +| [FormatTestMap0000Builder](#formattestmap0000builder) | int32(float value) | +| [FormatTestMap0000Builder](#formattestmap0000builder) | int32withValidations(int value) | +| [FormatTestMap0000Builder](#formattestmap0000builder) | int32withValidations(float value) | +| [FormatTestMap0000Builder](#formattestmap0000builder) | int64(int value) | +| [FormatTestMap0000Builder](#formattestmap0000builder) | int64(float value) | +| [FormatTestMap0000Builder](#formattestmap0000builder) | int64(long value) | +| [FormatTestMap0000Builder](#formattestmap0000builder) | int64(double value) | +| [FormatTestMap0000Builder](#formattestmap0000builder) | setFloat(int value) | +| [FormatTestMap0000Builder](#formattestmap0000builder) | setFloat(float value) | +| [FormatTestMap0000Builder](#formattestmap0000builder) | setFloat(long value) | +| [FormatTestMap0000Builder](#formattestmap0000builder) | setFloat(double value) | +| [FormatTestMap0000Builder](#formattestmap0000builder) | float32(int value) | +| [FormatTestMap0000Builder](#formattestmap0000builder) | float32(float value) | +| [FormatTestMap0000Builder](#formattestmap0000builder) | float32(long value) | +| [FormatTestMap0000Builder](#formattestmap0000builder) | float32(double value) | +| [FormatTestMap0000Builder](#formattestmap0000builder) | setDouble(int value) | +| [FormatTestMap0000Builder](#formattestmap0000builder) | setDouble(float value) | +| [FormatTestMap0000Builder](#formattestmap0000builder) | setDouble(long value) | +| [FormatTestMap0000Builder](#formattestmap0000builder) | setDouble(double value) | +| [FormatTestMap0000Builder](#formattestmap0000builder) | float64(int value) | +| [FormatTestMap0000Builder](#formattestmap0000builder) | float64(float value) | +| [FormatTestMap0000Builder](#formattestmap0000builder) | float64(long value) | +| [FormatTestMap0000Builder](#formattestmap0000builder) | float64(double value) | +| [FormatTestMap0000Builder](#formattestmap0000builder) | arrayWithUniqueItems(List value) | +| [FormatTestMap0000Builder](#formattestmap0000builder) | setString(String value) | +| [FormatTestMap0000Builder](#formattestmap0000builder) | binary(String value) | +| [FormatTestMap0000Builder](#formattestmap0000builder) | dateTime(String value) | +| [FormatTestMap0000Builder](#formattestmap0000builder) | setUuid(String value) | +| [FormatTestMap0000Builder](#formattestmap0000builder) | uuidNoExample(String value) | +| [FormatTestMap0000Builder](#formattestmap0000builder) | pattern_with_digits(String value) | +| [FormatTestMap0000Builder](#formattestmap0000builder) | pattern_with_digits_and_delimiter(String value) | +| [FormatTestMap0000Builder](#formattestmap0000builder) | noneProp(Nothing? value) | +| [FormatTestMap0000Builder](#formattestmap0000builder) | additionalProperty(String key, Nothing? value) | +| [FormatTestMap0000Builder](#formattestmap0000builder) | additionalProperty(String key, boolean value) | +| [FormatTestMap0000Builder](#formattestmap0000builder) | additionalProperty(String key, String value) | +| [FormatTestMap0000Builder](#formattestmap0000builder) | additionalProperty(String key, int value) | +| [FormatTestMap0000Builder](#formattestmap0000builder) | additionalProperty(String key, float value) | +| [FormatTestMap0000Builder](#formattestmap0000builder) | additionalProperty(String key, long value) | +| [FormatTestMap0000Builder](#formattestmap0000builder) | additionalProperty(String key, double value) | +| [FormatTestMap0000Builder](#formattestmap0000builder) | additionalProperty(String key, List value) | +| [FormatTestMap0000Builder](#formattestmap0000builder) | additionalProperty(String key, Map value) | + +## FormatTestMap0001Builder +public class FormatTestMap0001Builder
+builder for `Map` + +A class that builds the Map input type + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| FormatTestMap0001Builder(Map instance)
Creates a builder that contains the passed instance | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| [FormatTestMap0000Builder](#formattestmap0000builder) | password(String value) | + +## FormatTestMap0010Builder +public class FormatTestMap0010Builder
+builder for `Map` + +A class that builds the Map input type + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| FormatTestMap0010Builder(Map instance)
Creates a builder that contains the passed instance | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| [FormatTestMap0000Builder](#formattestmap0000builder) | setNumber(int value) | +| [FormatTestMap0000Builder](#formattestmap0000builder) | setNumber(float value) | +| [FormatTestMap0000Builder](#formattestmap0000builder) | setNumber(long value) | +| [FormatTestMap0000Builder](#formattestmap0000builder) | setNumber(double value) | + +## FormatTestMap0011Builder +public class FormatTestMap0011Builder
+builder for `Map` + +A class that builds the Map input type + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| FormatTestMap0011Builder(Map instance)
Creates a builder that contains the passed instance | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| [FormatTestMap0001Builder](#formattestmap0001builder) | setNumber(int value) | +| [FormatTestMap0001Builder](#formattestmap0001builder) | setNumber(float value) | +| [FormatTestMap0001Builder](#formattestmap0001builder) | setNumber(long value) | +| [FormatTestMap0001Builder](#formattestmap0001builder) | setNumber(double value) | +| [FormatTestMap0010Builder](#formattestmap0010builder) | password(String value) | + +## FormatTestMap0100Builder +public class FormatTestMap0100Builder
+builder for `Map` + +A class that builds the Map input type + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| FormatTestMap0100Builder(Map instance)
Creates a builder that contains the passed instance | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| [FormatTestMap0000Builder](#formattestmap0000builder) | date(String value) | + +## FormatTestMap0101Builder +public class FormatTestMap0101Builder
+builder for `Map` + +A class that builds the Map input type + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| FormatTestMap0101Builder(Map instance)
Creates a builder that contains the passed instance | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| [FormatTestMap0001Builder](#formattestmap0001builder) | date(String value) | +| [FormatTestMap0100Builder](#formattestmap0100builder) | password(String value) | + +## FormatTestMap0110Builder +public class FormatTestMap0110Builder
+builder for `Map` + +A class that builds the Map input type + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| FormatTestMap0110Builder(Map instance)
Creates a builder that contains the passed instance | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| [FormatTestMap0010Builder](#formattestmap0010builder) | date(String value) | +| [FormatTestMap0100Builder](#formattestmap0100builder) | setNumber(int value) | +| [FormatTestMap0100Builder](#formattestmap0100builder) | setNumber(float value) | +| [FormatTestMap0100Builder](#formattestmap0100builder) | setNumber(long value) | +| [FormatTestMap0100Builder](#formattestmap0100builder) | setNumber(double value) | + +## FormatTestMap0111Builder +public class FormatTestMap0111Builder
+builder for `Map` + +A class that builds the Map input type + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| FormatTestMap0111Builder(Map instance)
Creates a builder that contains the passed instance | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| [FormatTestMap0011Builder](#formattestmap0011builder) | date(String value) | +| [FormatTestMap0101Builder](#formattestmap0101builder) | setNumber(int value) | +| [FormatTestMap0101Builder](#formattestmap0101builder) | setNumber(float value) | +| [FormatTestMap0101Builder](#formattestmap0101builder) | setNumber(long value) | +| [FormatTestMap0101Builder](#formattestmap0101builder) | setNumber(double value) | +| [FormatTestMap0110Builder](#formattestmap0110builder) | password(String value) | + +## FormatTestMap1000Builder +public class FormatTestMap1000Builder
+builder for `Map` + +A class that builds the Map input type + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| FormatTestMap1000Builder(Map instance)
Creates a builder that contains the passed instance | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| [FormatTestMap0000Builder](#formattestmap0000builder) | setByte(String value) | + +## FormatTestMap1001Builder +public class FormatTestMap1001Builder
+builder for `Map` + +A class that builds the Map input type + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| FormatTestMap1001Builder(Map instance)
Creates a builder that contains the passed instance | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| [FormatTestMap0001Builder](#formattestmap0001builder) | setByte(String value) | +| [FormatTestMap1000Builder](#formattestmap1000builder) | password(String value) | + +## FormatTestMap1010Builder +public class FormatTestMap1010Builder
+builder for `Map` + +A class that builds the Map input type + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| FormatTestMap1010Builder(Map instance)
Creates a builder that contains the passed instance | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| [FormatTestMap0010Builder](#formattestmap0010builder) | setByte(String value) | +| [FormatTestMap1000Builder](#formattestmap1000builder) | setNumber(int value) | +| [FormatTestMap1000Builder](#formattestmap1000builder) | setNumber(float value) | +| [FormatTestMap1000Builder](#formattestmap1000builder) | setNumber(long value) | +| [FormatTestMap1000Builder](#formattestmap1000builder) | setNumber(double value) | + +## FormatTestMap1011Builder +public class FormatTestMap1011Builder
+builder for `Map` + +A class that builds the Map input type + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| FormatTestMap1011Builder(Map instance)
Creates a builder that contains the passed instance | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| [FormatTestMap0011Builder](#formattestmap0011builder) | setByte(String value) | +| [FormatTestMap1001Builder](#formattestmap1001builder) | setNumber(int value) | +| [FormatTestMap1001Builder](#formattestmap1001builder) | setNumber(float value) | +| [FormatTestMap1001Builder](#formattestmap1001builder) | setNumber(long value) | +| [FormatTestMap1001Builder](#formattestmap1001builder) | setNumber(double value) | +| [FormatTestMap1010Builder](#formattestmap1010builder) | password(String value) | + +## FormatTestMap1100Builder +public class FormatTestMap1100Builder
+builder for `Map` + +A class that builds the Map input type + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| FormatTestMap1100Builder(Map instance)
Creates a builder that contains the passed instance | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| [FormatTestMap0100Builder](#formattestmap0100builder) | setByte(String value) | +| [FormatTestMap1000Builder](#formattestmap1000builder) | date(String value) | + +## FormatTestMap1101Builder +public class FormatTestMap1101Builder
+builder for `Map` + +A class that builds the Map input type + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| FormatTestMap1101Builder(Map instance)
Creates a builder that contains the passed instance | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| [FormatTestMap0101Builder](#formattestmap0101builder) | setByte(String value) | +| [FormatTestMap1001Builder](#formattestmap1001builder) | date(String value) | +| [FormatTestMap1100Builder](#formattestmap1100builder) | password(String value) | + +## FormatTestMap1110Builder +public class FormatTestMap1110Builder
+builder for `Map` + +A class that builds the Map input type + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| FormatTestMap1110Builder(Map instance)
Creates a builder that contains the passed instance | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| [FormatTestMap0110Builder](#formattestmap0110builder) | setByte(String value) | +| [FormatTestMap1010Builder](#formattestmap1010builder) | date(String value) | +| [FormatTestMap1100Builder](#formattestmap1100builder) | setNumber(int value) | +| [FormatTestMap1100Builder](#formattestmap1100builder) | setNumber(float value) | +| [FormatTestMap1100Builder](#formattestmap1100builder) | setNumber(long value) | +| [FormatTestMap1100Builder](#formattestmap1100builder) | setNumber(double value) | + +## FormatTestMapBuilder +public class FormatTestMapBuilder
+builder for `Map` + +A class that builds the Map input type + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| FormatTestMapBuilder()
Creates a builder that contains an empty map | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| [FormatTestMap0111Builder](#formattestmap0111builder) | setByte(String value) | +| [FormatTestMap1011Builder](#formattestmap1011builder) | date(String value) | +| [FormatTestMap1101Builder](#formattestmap1101builder) | setNumber(int value) | +| [FormatTestMap1101Builder](#formattestmap1101builder) | setNumber(float value) | +| [FormatTestMap1101Builder](#formattestmap1101builder) | setNumber(long value) | +| [FormatTestMap1101Builder](#formattestmap1101builder) | setNumber(double value) | +| [FormatTestMap1110Builder](#formattestmap1110builder) | password(String value) | + +## FormatTestMap +public static class FormatTestMap
+extends FrozenMap + +A class to store validated Map payloads + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| static [FormatTestMap](#formattestmap) | of([Map](#formattestmapbuilder) arg, SchemaConfiguration configuration) | +| String | date()
value must conform to RFC-3339 full-date YYYY-MM-DD | +| String | password()
| +| Number | int32()
[optional] value must be a 32 bit integer | +| Number | int32withValidations()
[optional] value must be a 32 bit integer | +| Number | int64()
[optional] value must be a 64 bit integer | +| Number | float32()
[optional] value must be a 32 bit float | +| Number | float64()
[optional] value must be a 64 bit float | +| [ArrayWithUniqueItemsList](#arraywithuniqueitemslist) | arrayWithUniqueItems()
[optional] | +| String | binary()
[optional] | +| String | dateTime()
[optional] value must conform to RFC-3339 date-time | +| String | uuidNoExample()
[optional] value must be a uuid | +| String | pattern_with_digits()
[optional] | +| String | pattern_with_digits_and_delimiter()
[optional] | +| Nothing? | noneProp()
[optional] | +| @Nullable Object | get(String key)
This schema has invalid Java names so this method must be used when you access instance["byte"], instance["number"], instance["integer"], instance["float"], instance["double"], instance["string"], instance["uuid"], | +| @Nullable Object | getAdditionalProperty(String name)
provides type safety for additional properties | + +## NonePropBoxed +public sealed interface NonePropBoxed
+permits
+[NonePropBoxedVoid](#nonepropboxedvoid) + +sealed interface that stores validated payloads using boxed classes + +## NonePropBoxedVoid +public record NonePropBoxedVoid
+implements [NonePropBoxed](#nonepropboxed) + +record that stores validated null payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| NonePropBoxedVoid(Nothing? data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| Nothing? | data()
validated payload | +| @Nullable Object | getData()
validated payload | + +## NoneProp +public static class NoneProp
+extends NullJsonSchema.NullJsonSchema1 + +A schema class that validates payloads + +| Methods Inherited from class org.openapijsonschematools.client.schemas.NullJsonSchema.NullJsonSchema1 | +| ------------------------------------------------------------------ | +| validate | +| validateAndBox | + +## PatternWithDigitsAndDelimiterBoxed +public sealed interface PatternWithDigitsAndDelimiterBoxed
+permits
+[PatternWithDigitsAndDelimiterBoxedString](#patternwithdigitsanddelimiterboxedstring) + +sealed interface that stores validated payloads using boxed classes + +## PatternWithDigitsAndDelimiterBoxedString +public record PatternWithDigitsAndDelimiterBoxedString
+implements [PatternWithDigitsAndDelimiterBoxed](#patternwithdigitsanddelimiterboxed) + +record that stores validated String payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| PatternWithDigitsAndDelimiterBoxedString(String data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| String | data()
validated payload | +| @Nullable Object | getData()
validated payload | + +## PatternWithDigitsAndDelimiter +public static class PatternWithDigitsAndDelimiter
+extends JsonSchema + +A schema class that validates payloads + +## Description +A string starting with 'image_' (case insensitive) and one to three digits following i.e. Image_01. + +### Code Sample +``` +import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags; +import org.openapijsonschematools.client.configurations.SchemaConfiguration; +import org.openapijsonschematools.client.exceptions.ValidationException; +import org.openapijsonschematools.client.schemas.validation.MapUtils; +import org.openapijsonschematools.client.schemas.validation.FrozenList; +import org.openapijsonschematools.client.schemas.validation.FrozenMap; +import org.openapijsonschematools.client.components.schemas.FormatTest; + +import java.util.Arrays; +import java.util.List; +import java.util.AbstractMap; + +static final SchemaConfiguration configuration = new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().build()); + +// String validation +String validatedPayload = FormatTest.PatternWithDigitsAndDelimiter.validate( + "IMage_88", + configuration +); +``` + +### Field Summary +| Modifier and Type | Field and Description | +| ----------------- | ---------------------- | +| Set> | type = Set.of(
    String.class
)
| +| Pattern | pattern = Pattern.compile(
    "^image_\\d{1,3}$",
    Pattern.CASE_INSENSITIVE
)
| + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| String | validate(String arg, SchemaConfiguration configuration) | +| [PatternWithDigitsAndDelimiterBoxedString](#patternwithdigitsanddelimiterboxedstring) | validateAndBox(String arg, SchemaConfiguration configuration) | +| [PatternWithDigitsAndDelimiterBoxed](#patternwithdigitsanddelimiterboxed) | validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) | +| @Nullable Object | validate(@Nullable Object arg, SchemaConfiguration configuration) | + +## PatternWithDigitsBoxed +public sealed interface PatternWithDigitsBoxed
+permits
+[PatternWithDigitsBoxedString](#patternwithdigitsboxedstring) + +sealed interface that stores validated payloads using boxed classes + +## PatternWithDigitsBoxedString +public record PatternWithDigitsBoxedString
+implements [PatternWithDigitsBoxed](#patternwithdigitsboxed) + +record that stores validated String payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| PatternWithDigitsBoxedString(String data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| String | data()
validated payload | +| @Nullable Object | getData()
validated payload | + +## PatternWithDigits +public static class PatternWithDigits
+extends JsonSchema + +A schema class that validates payloads + +## Description +A string that is a 10 digit number. Can have leading zeros. + +### Code Sample +``` +import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags; +import org.openapijsonschematools.client.configurations.SchemaConfiguration; +import org.openapijsonschematools.client.exceptions.ValidationException; +import org.openapijsonschematools.client.schemas.validation.MapUtils; +import org.openapijsonschematools.client.schemas.validation.FrozenList; +import org.openapijsonschematools.client.schemas.validation.FrozenMap; +import org.openapijsonschematools.client.components.schemas.FormatTest; + +import java.util.Arrays; +import java.util.List; +import java.util.AbstractMap; + +static final SchemaConfiguration configuration = new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().build()); + +// String validation +String validatedPayload = FormatTest.PatternWithDigits.validate( + "0480728880", + configuration +); +``` + +### Field Summary +| Modifier and Type | Field and Description | +| ----------------- | ---------------------- | +| Set> | type = Set.of(
    String.class
)
| +| Pattern | pattern = Pattern.compile(
    "^\\d{10}$"
)
| + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| String | validate(String arg, SchemaConfiguration configuration) | +| [PatternWithDigitsBoxedString](#patternwithdigitsboxedstring) | validateAndBox(String arg, SchemaConfiguration configuration) | +| [PatternWithDigitsBoxed](#patternwithdigitsboxed) | validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) | +| @Nullable Object | validate(@Nullable Object arg, SchemaConfiguration configuration) | + +## PasswordBoxed +public sealed interface PasswordBoxed
+permits
+[PasswordBoxedString](#passwordboxedstring) + +sealed interface that stores validated payloads using boxed classes + +## PasswordBoxedString +public record PasswordBoxedString
+implements [PasswordBoxed](#passwordboxed) + +record that stores validated String payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| PasswordBoxedString(String data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| String | data()
validated payload | +| @Nullable Object | getData()
validated payload | + +## Password +public static class Password
+extends JsonSchema + +A schema class that validates payloads + +### Code Sample +``` +import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags; +import org.openapijsonschematools.client.configurations.SchemaConfiguration; +import org.openapijsonschematools.client.exceptions.ValidationException; +import org.openapijsonschematools.client.schemas.validation.MapUtils; +import org.openapijsonschematools.client.schemas.validation.FrozenList; +import org.openapijsonschematools.client.schemas.validation.FrozenMap; +import org.openapijsonschematools.client.components.schemas.FormatTest; + +import java.util.Arrays; +import java.util.List; +import java.util.AbstractMap; + +static final SchemaConfiguration configuration = new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().build()); + +// String validation +String validatedPayload = FormatTest.Password.validate( + "a", + configuration +); +``` + +### Field Summary +| Modifier and Type | Field and Description | +| ----------------- | ---------------------- | +| Set> | type = Set.of(
    String.class
)
| +| String | type = "password"; | +| Integer | maxLength = 64 | +| Integer | minLength = 10 | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| String | validate(String arg, SchemaConfiguration configuration) | +| [PasswordBoxedString](#passwordboxedstring) | validateAndBox(String arg, SchemaConfiguration configuration) | +| [PasswordBoxed](#passwordboxed) | validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) | +| @Nullable Object | validate(@Nullable Object arg, SchemaConfiguration configuration) | + +## UuidNoExampleBoxed +public sealed interface UuidNoExampleBoxed
+permits
+[UuidNoExampleBoxedString](#uuidnoexampleboxedstring) + +sealed interface that stores validated payloads using boxed classes + +## UuidNoExampleBoxedString +public record UuidNoExampleBoxedString
+implements [UuidNoExampleBoxed](#uuidnoexampleboxed) + +record that stores validated String payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| UuidNoExampleBoxedString(String data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| String | data()
validated payload | +| @Nullable Object | getData()
validated payload | + +## UuidNoExample +public static class UuidNoExample
+extends UuidJsonSchema.UuidJsonSchema1 + +A schema class that validates payloads + +| Methods Inherited from class org.openapijsonschematools.client.schemas.UuidJsonSchema.UuidJsonSchema1 | +| ------------------------------------------------------------------ | +| validate | +| validateAndBox | + +## UuidSchemaBoxed +public sealed interface UuidSchemaBoxed
+permits
+[UuidSchemaBoxedString](#uuidschemaboxedstring) + +sealed interface that stores validated payloads using boxed classes + +## UuidSchemaBoxedString +public record UuidSchemaBoxedString
+implements [UuidSchemaBoxed](#uuidschemaboxed) + +record that stores validated String payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| UuidSchemaBoxedString(String data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| String | data()
validated payload | +| @Nullable Object | getData()
validated payload | + +## UuidSchema +public static class UuidSchema
+extends UuidJsonSchema.UuidJsonSchema1 + +A schema class that validates payloads + +| Methods Inherited from class org.openapijsonschematools.client.schemas.UuidJsonSchema.UuidJsonSchema1 | +| ------------------------------------------------------------------ | +| validate | +| validateAndBox | + +## DateTimeBoxed +public sealed interface DateTimeBoxed
+permits
+[DateTimeBoxedString](#datetimeboxedstring) + +sealed interface that stores validated payloads using boxed classes + +## DateTimeBoxedString +public record DateTimeBoxedString
+implements [DateTimeBoxed](#datetimeboxed) + +record that stores validated String payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| DateTimeBoxedString(String data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| String | data()
validated payload | +| @Nullable Object | getData()
validated payload | + +## DateTime +public static class DateTime
+extends DateTimeJsonSchema.DateTimeJsonSchema1 + +A schema class that validates payloads + +| Methods Inherited from class org.openapijsonschematools.client.schemas.DateTimeJsonSchema.DateTimeJsonSchema1 | +| ------------------------------------------------------------------ | +| validate | +| validateAndBox | + +## DateBoxed +public sealed interface DateBoxed
+permits
+[DateBoxedString](#dateboxedstring) + +sealed interface that stores validated payloads using boxed classes + +## DateBoxedString +public record DateBoxedString
+implements [DateBoxed](#dateboxed) + +record that stores validated String payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| DateBoxedString(String data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| String | data()
validated payload | +| @Nullable Object | getData()
validated payload | + +## Date +public static class Date
+extends DateJsonSchema.DateJsonSchema1 + +A schema class that validates payloads + +| Methods Inherited from class org.openapijsonschematools.client.schemas.DateJsonSchema.DateJsonSchema1 | +| ------------------------------------------------------------------ | +| validate | +| validateAndBox | + +## BinaryBoxed +public sealed interface BinaryBoxed
+permits
+ +sealed interface that stores validated payloads using boxed classes + +## Binary +public static class Binary
+extends JsonSchema + +A schema class that validates payloads + +## ByteSchemaBoxed +public sealed interface ByteSchemaBoxed
+permits
+[ByteSchemaBoxedString](#byteschemaboxedstring) + +sealed interface that stores validated payloads using boxed classes + +## ByteSchemaBoxedString +public record ByteSchemaBoxedString
+implements [ByteSchemaBoxed](#byteschemaboxed) + +record that stores validated String payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| ByteSchemaBoxedString(String data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| String | data()
validated payload | +| @Nullable Object | getData()
validated payload | + +## ByteSchema +public static class ByteSchema
+extends StringJsonSchema.StringJsonSchema1 + +A schema class that validates payloads + +## StringSchemaBoxed +public sealed interface StringSchemaBoxed
+permits
+[StringSchemaBoxedString](#stringschemaboxedstring) + +sealed interface that stores validated payloads using boxed classes + +## StringSchemaBoxedString +public record StringSchemaBoxedString
+implements [StringSchemaBoxed](#stringschemaboxed) + +record that stores validated String payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| StringSchemaBoxedString(String data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| String | data()
validated payload | +| @Nullable Object | getData()
validated payload | + +## StringSchema +public static class StringSchema
+extends JsonSchema + +A schema class that validates payloads + +### Code Sample +``` +import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags; +import org.openapijsonschematools.client.configurations.SchemaConfiguration; +import org.openapijsonschematools.client.exceptions.ValidationException; +import org.openapijsonschematools.client.schemas.validation.MapUtils; +import org.openapijsonschematools.client.schemas.validation.FrozenList; +import org.openapijsonschematools.client.schemas.validation.FrozenMap; +import org.openapijsonschematools.client.components.schemas.FormatTest; + +import java.util.Arrays; +import java.util.List; +import java.util.AbstractMap; + +static final SchemaConfiguration configuration = new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().build()); + +// String validation +String validatedPayload = FormatTest.StringSchema.validate( + "A", + configuration +); +``` + +### Field Summary +| Modifier and Type | Field and Description | +| ----------------- | ---------------------- | +| Set> | type = Set.of(
    String.class
)
| +| Pattern | pattern = Pattern.compile(
    "[a-z]",
    Pattern.CASE_INSENSITIVE
)
| + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| String | validate(String arg, SchemaConfiguration configuration) | +| [StringSchemaBoxedString](#stringschemaboxedstring) | validateAndBox(String arg, SchemaConfiguration configuration) | +| [StringSchemaBoxed](#stringschemaboxed) | validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) | +| @Nullable Object | validate(@Nullable Object arg, SchemaConfiguration configuration) | + +## ArrayWithUniqueItemsBoxed +public sealed interface ArrayWithUniqueItemsBoxed
+permits
+[ArrayWithUniqueItemsBoxedList](#arraywithuniqueitemsboxedlist) + +sealed interface that stores validated payloads using boxed classes + +## ArrayWithUniqueItemsBoxedList +public record ArrayWithUniqueItemsBoxedList
+implements [ArrayWithUniqueItemsBoxed](#arraywithuniqueitemsboxed) + +record that stores validated List payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| ArrayWithUniqueItemsBoxedList([ArrayWithUniqueItemsList](#arraywithuniqueitemslist) data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| [ArrayWithUniqueItemsList](#arraywithuniqueitemslist) | data()
validated payload | +| @Nullable Object | getData()
validated payload | + +## ArrayWithUniqueItems +public static class ArrayWithUniqueItems
+extends JsonSchema + +A schema class that validates payloads + +### Code Sample +``` +import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags; +import org.openapijsonschematools.client.configurations.SchemaConfiguration; +import org.openapijsonschematools.client.exceptions.ValidationException; +import org.openapijsonschematools.client.schemas.validation.MapUtils; +import org.openapijsonschematools.client.schemas.validation.FrozenList; +import org.openapijsonschematools.client.schemas.validation.FrozenMap; +import org.openapijsonschematools.client.components.schemas.FormatTest; + +import java.util.Arrays; +import java.util.List; +import java.util.AbstractMap; + +static final SchemaConfiguration configuration = new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().build()); + +// List validation +FormatTest.ArrayWithUniqueItemsList validatedPayload = + FormatTest.ArrayWithUniqueItems.validate( + new FormatTest.ArrayWithUniqueItemsListBuilder() + .add(1) + + .build(), + configuration +); +``` + +### Field Summary +| Modifier and Type | Field and Description | +| ----------------- | ---------------------- | +| Set> | type = Set.of(List.class) | +| Class | items = [Items.class](#items) | +| Boolean | uniqueItems = true | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| [ArrayWithUniqueItemsList](#arraywithuniqueitemslist) | validate([List](#arraywithuniqueitemslistbuilder) arg, SchemaConfiguration configuration) | +| [ArrayWithUniqueItemsBoxedList](#arraywithuniqueitemsboxedlist) | validateAndBox([List](#arraywithuniqueitemslistbuilder) arg, SchemaConfiguration configuration) | +| [ArrayWithUniqueItemsBoxed](#arraywithuniqueitemsboxed) | validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) | +| @Nullable Object | validate(@Nullable Object arg, SchemaConfiguration configuration) | + +## ArrayWithUniqueItemsListBuilder +public class ArrayWithUniqueItemsListBuilder
+builder for `List` + +A class that builds the List input type + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| ArrayWithUniqueItemsListBuilder()
Creates an empty list | +| ArrayWithUniqueItemsListBuilder(List items)
Stores the items in a list | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| ArrayWithUniqueItemsListBuilder | add(int item) | +| ArrayWithUniqueItemsListBuilder | add(float item) | +| ArrayWithUniqueItemsListBuilder | add(long item) | +| ArrayWithUniqueItemsListBuilder | add(double item) | +| List | build()
Returns list input that should be used with Schema.validate | + +## ArrayWithUniqueItemsList +public class ArrayWithUniqueItemsList
+extends `FrozenList` + +A class to store validated List payloads + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| static [ArrayWithUniqueItemsList](#arraywithuniqueitemslist) | of([List](#arraywithuniqueitemslistbuilder) arg, SchemaConfiguration configuration) | + +## ItemsBoxed +public sealed interface ItemsBoxed
+permits
+[ItemsBoxedNumber](#itemsboxednumber) + +sealed interface that stores validated payloads using boxed classes + +## ItemsBoxedNumber +public record ItemsBoxedNumber
+implements [ItemsBoxed](#itemsboxed) + +record that stores validated Number payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| ItemsBoxedNumber(Number data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| Number | data()
validated payload | +| @Nullable Object | getData()
validated payload | + +## Items +public static class Items
+extends NumberJsonSchema.NumberJsonSchema1 + +A schema class that validates payloads + +| Methods Inherited from class org.openapijsonschematools.client.schemas.NumberJsonSchema.NumberJsonSchema1 | +| ------------------------------------------------------------------ | +| validate | +| validateAndBox | + +## Float64Boxed +public sealed interface Float64Boxed
+permits
+[Float64BoxedNumber](#float64boxednumber) + +sealed interface that stores validated payloads using boxed classes + +## Float64BoxedNumber +public record Float64BoxedNumber
+implements [Float64Boxed](#float64boxed) + +record that stores validated Number payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| Float64BoxedNumber(Number data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| Number | data()
validated payload | +| @Nullable Object | getData()
validated payload | + +## Float64 +public static class Float64
+extends DoubleJsonSchema.DoubleJsonSchema1 + +A schema class that validates payloads + +| Methods Inherited from class org.openapijsonschematools.client.schemas.DoubleJsonSchema.DoubleJsonSchema1 | +| ------------------------------------------------------------------ | +| validate | +| validateAndBox | + +## DoubleSchemaBoxed +public sealed interface DoubleSchemaBoxed
+permits
+[DoubleSchemaBoxedNumber](#doubleschemaboxednumber) + +sealed interface that stores validated payloads using boxed classes + +## DoubleSchemaBoxedNumber +public record DoubleSchemaBoxedNumber
+implements [DoubleSchemaBoxed](#doubleschemaboxed) + +record that stores validated Number payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| DoubleSchemaBoxedNumber(Number data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| Number | data()
validated payload | +| @Nullable Object | getData()
validated payload | + +## DoubleSchema +public static class DoubleSchema
+extends JsonSchema + +A schema class that validates payloads + +### Code Sample +``` +import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags; +import org.openapijsonschematools.client.configurations.SchemaConfiguration; +import org.openapijsonschematools.client.exceptions.ValidationException; +import org.openapijsonschematools.client.schemas.validation.MapUtils; +import org.openapijsonschematools.client.schemas.validation.FrozenList; +import org.openapijsonschematools.client.schemas.validation.FrozenMap; +import org.openapijsonschematools.client.components.schemas.FormatTest; + +import java.util.Arrays; +import java.util.List; +import java.util.AbstractMap; + +static final SchemaConfiguration configuration = new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().build()); + +// double validation +double validatedPayload = FormatTest.DoubleSchema.validate( + 3.14d, + configuration +); +``` + +### Field Summary +| Modifier and Type | Field and Description | +| ----------------- | ---------------------- | +| Set> | type = Set.of(
    Integer.class,
    Long.class,
    Float.class,
    Double.class
)
| +| String | type = "double"; | +| Number | maximum = 123.4 | +| Number | minimum = 67.8 | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| double | validate(double arg, SchemaConfiguration configuration) | +| [DoubleSchemaBoxedNumber](#doubleschemaboxednumber) | validateAndBox(Number arg, SchemaConfiguration configuration) | +| [DoubleSchemaBoxed](#doubleschemaboxed) | validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) | +| @Nullable Object | validate(@Nullable Object arg, SchemaConfiguration configuration) | + +## Float32Boxed +public sealed interface Float32Boxed
+permits
+[Float32BoxedNumber](#float32boxednumber) + +sealed interface that stores validated payloads using boxed classes + +## Float32BoxedNumber +public record Float32BoxedNumber
+implements [Float32Boxed](#float32boxed) + +record that stores validated Number payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| Float32BoxedNumber(Number data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| Number | data()
validated payload | +| @Nullable Object | getData()
validated payload | + +## Float32 +public static class Float32
+extends FloatJsonSchema.FloatJsonSchema1 + +A schema class that validates payloads + +| Methods Inherited from class org.openapijsonschematools.client.schemas.FloatJsonSchema.FloatJsonSchema1 | +| ------------------------------------------------------------------ | +| validate | +| validateAndBox | + +## FloatSchemaBoxed +public sealed interface FloatSchemaBoxed
+permits
+[FloatSchemaBoxedNumber](#floatschemaboxednumber) + +sealed interface that stores validated payloads using boxed classes + +## FloatSchemaBoxedNumber +public record FloatSchemaBoxedNumber
+implements [FloatSchemaBoxed](#floatschemaboxed) + +record that stores validated Number payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| FloatSchemaBoxedNumber(Number data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| Number | data()
validated payload | +| @Nullable Object | getData()
validated payload | + +## FloatSchema +public static class FloatSchema
+extends JsonSchema + +A schema class that validates payloads + +## Description +this is a reserved python keyword + +### Code Sample +``` +import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags; +import org.openapijsonschematools.client.configurations.SchemaConfiguration; +import org.openapijsonschematools.client.exceptions.ValidationException; +import org.openapijsonschematools.client.schemas.validation.MapUtils; +import org.openapijsonschematools.client.schemas.validation.FrozenList; +import org.openapijsonschematools.client.schemas.validation.FrozenMap; +import org.openapijsonschematools.client.components.schemas.FormatTest; + +import java.util.Arrays; +import java.util.List; +import java.util.AbstractMap; + +static final SchemaConfiguration configuration = new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().build()); + +// float validation +float validatedPayload = FormatTest.FloatSchema.validate( + 3.14f, + configuration +); +``` + +### Field Summary +| Modifier and Type | Field and Description | +| ----------------- | ---------------------- | +| Set> | type = Set.of(
    Integer.class,
    Long.class,
    Float.class,
    Double.class
)
| +| String | type = "float"; | +| Number | maximum = 987.6 | +| Number | minimum = 54.3 | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| float | validate(float arg, SchemaConfiguration configuration) | +| [FloatSchemaBoxedNumber](#floatschemaboxednumber) | validateAndBox(Number arg, SchemaConfiguration configuration) | +| [FloatSchemaBoxed](#floatschemaboxed) | validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) | +| @Nullable Object | validate(@Nullable Object arg, SchemaConfiguration configuration) | + +## NumberSchemaBoxed +public sealed interface NumberSchemaBoxed
+permits
+[NumberSchemaBoxedNumber](#numberschemaboxednumber) + +sealed interface that stores validated payloads using boxed classes + +## NumberSchemaBoxedNumber +public record NumberSchemaBoxedNumber
+implements [NumberSchemaBoxed](#numberschemaboxed) + +record that stores validated Number payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| NumberSchemaBoxedNumber(Number data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| Number | data()
validated payload | +| @Nullable Object | getData()
validated payload | + +## NumberSchema +public static class NumberSchema
+extends JsonSchema + +A schema class that validates payloads + +### Code Sample +``` +import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags; +import org.openapijsonschematools.client.configurations.SchemaConfiguration; +import org.openapijsonschematools.client.exceptions.ValidationException; +import org.openapijsonschematools.client.schemas.validation.MapUtils; +import org.openapijsonschematools.client.schemas.validation.FrozenList; +import org.openapijsonschematools.client.schemas.validation.FrozenMap; +import org.openapijsonschematools.client.components.schemas.FormatTest; + +import java.util.Arrays; +import java.util.List; +import java.util.AbstractMap; + +static final SchemaConfiguration configuration = new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().build()); + +// int validation +int validatedPayload = FormatTest.NumberSchema.validate( + 1, + configuration +); +``` + +### Field Summary +| Modifier and Type | Field and Description | +| ----------------- | ---------------------- | +| Set> | type = Set.of(
    Integer.class,
    Long.class,
    Float.class,
    Double.class
)
| +| Number | maximum = 543.2 | +| Number | minimum = 32.1 | +| BigDecimal | multipleOf = new BigDecimal("32.5") | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| Number | validate(Number arg, SchemaConfiguration configuration) | +| [NumberSchemaBoxedNumber](#numberschemaboxednumber) | validateAndBox(Number arg, SchemaConfiguration configuration) | +| [NumberSchemaBoxed](#numberschemaboxed) | validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) | +| @Nullable Object | validate(@Nullable Object arg, SchemaConfiguration configuration) | + +## Int64Boxed +public sealed interface Int64Boxed
+permits
+[Int64BoxedNumber](#int64boxednumber) + +sealed interface that stores validated payloads using boxed classes + +## Int64BoxedNumber +public record Int64BoxedNumber
+implements [Int64Boxed](#int64boxed) + +record that stores validated Number payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| Int64BoxedNumber(Number data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| Number | data()
validated payload | +| @Nullable Object | getData()
validated payload | + +## Int64 +public static class Int64
+extends Int64JsonSchema.Int64JsonSchema1 + +A schema class that validates payloads + +| Methods Inherited from class org.openapijsonschematools.client.schemas.Int64JsonSchema.Int64JsonSchema1 | +| ------------------------------------------------------------------ | +| validate | +| validateAndBox | + +## Int32withValidationsBoxed +public sealed interface Int32withValidationsBoxed
+permits
+[Int32withValidationsBoxedNumber](#int32withvalidationsboxednumber) + +sealed interface that stores validated payloads using boxed classes + +## Int32withValidationsBoxedNumber +public record Int32withValidationsBoxedNumber
+implements [Int32withValidationsBoxed](#int32withvalidationsboxed) + +record that stores validated Number payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| Int32withValidationsBoxedNumber(Number data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| Number | data()
validated payload | +| @Nullable Object | getData()
validated payload | + +## Int32withValidations +public static class Int32withValidations
+extends JsonSchema + +A schema class that validates payloads + +### Code Sample +``` +import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags; +import org.openapijsonschematools.client.configurations.SchemaConfiguration; +import org.openapijsonschematools.client.exceptions.ValidationException; +import org.openapijsonschematools.client.schemas.validation.MapUtils; +import org.openapijsonschematools.client.schemas.validation.FrozenList; +import org.openapijsonschematools.client.schemas.validation.FrozenMap; +import org.openapijsonschematools.client.components.schemas.FormatTest; + +import java.util.Arrays; +import java.util.List; +import java.util.AbstractMap; + +static final SchemaConfiguration configuration = new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().build()); + +// int validation +int validatedPayload = FormatTest.Int32withValidations.validate( + 1, + configuration +); +``` + +### Field Summary +| Modifier and Type | Field and Description | +| ----------------- | ---------------------- | +| Set> | type = Set.of(
    Integer.class,
    Long.class,
    Float.class,
    Double.class
)
| +| String | type = "int32"; | +| Number | maximum = 200 | +| Number | minimum = 20 | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| int | validate(int arg, SchemaConfiguration configuration) | +| [Int32withValidationsBoxedNumber](#int32withvalidationsboxednumber) | validateAndBox(Number arg, SchemaConfiguration configuration) | +| [Int32withValidationsBoxed](#int32withvalidationsboxed) | validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) | +| @Nullable Object | validate(@Nullable Object arg, SchemaConfiguration configuration) | + +## Int32Boxed +public sealed interface Int32Boxed
+permits
+[Int32BoxedNumber](#int32boxednumber) + +sealed interface that stores validated payloads using boxed classes + +## Int32BoxedNumber +public record Int32BoxedNumber
+implements [Int32Boxed](#int32boxed) + +record that stores validated Number payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| Int32BoxedNumber(Number data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| Number | data()
validated payload | +| @Nullable Object | getData()
validated payload | + +## Int32 +public static class Int32
+extends Int32JsonSchema.Int32JsonSchema1 + +A schema class that validates payloads + +| Methods Inherited from class org.openapijsonschematools.client.schemas.Int32JsonSchema.Int32JsonSchema1 | +| ------------------------------------------------------------------ | +| validate | +| validateAndBox | + +## IntegerSchemaBoxed +public sealed interface IntegerSchemaBoxed
+permits
+[IntegerSchemaBoxedNumber](#integerschemaboxednumber) + +sealed interface that stores validated payloads using boxed classes + +## IntegerSchemaBoxedNumber +public record IntegerSchemaBoxedNumber
+implements [IntegerSchemaBoxed](#integerschemaboxed) + +record that stores validated Number payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| IntegerSchemaBoxedNumber(Number data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| Number | data()
validated payload | +| @Nullable Object | getData()
validated payload | + +## IntegerSchema +public static class IntegerSchema
+extends JsonSchema + +A schema class that validates payloads + +### Code Sample +``` +import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags; +import org.openapijsonschematools.client.configurations.SchemaConfiguration; +import org.openapijsonschematools.client.exceptions.ValidationException; +import org.openapijsonschematools.client.schemas.validation.MapUtils; +import org.openapijsonschematools.client.schemas.validation.FrozenList; +import org.openapijsonschematools.client.schemas.validation.FrozenMap; +import org.openapijsonschematools.client.components.schemas.FormatTest; + +import java.util.Arrays; +import java.util.List; +import java.util.AbstractMap; + +static final SchemaConfiguration configuration = new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().build()); + +// int validation +int validatedPayload = FormatTest.IntegerSchema.validate( + 1L, + configuration +); +``` + +### Field Summary +| Modifier and Type | Field and Description | +| ----------------- | ---------------------- | +| Set> | type = Set.of(
    Integer.class,
    Long.class,
    Float.class,
    Double.class
)
| +| String | type = "int"; | +| Number | maximum = 100 | +| Number | minimum = 10 | +| BigDecimal | multipleOf = new BigDecimal("2") | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| long | validate(long arg, SchemaConfiguration configuration) | +| [IntegerSchemaBoxedNumber](#integerschemaboxednumber) | validateAndBox(Number arg, SchemaConfiguration configuration) | +| [IntegerSchemaBoxed](#integerschemaboxed) | validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) | +| @Nullable Object | validate(@Nullable Object arg, SchemaConfiguration configuration) | + +[[Back to top]](#top) [[Back to Component Schemas]](../../../README.md#Component-Schemas) [[Back to README]](../../../README.md) diff --git a/samples/client/petstore/kotlin/docs/components/schemas/FromSchema.md b/samples/client/petstore/kotlin/docs/components/schemas/FromSchema.md new file mode 100644 index 00000000000..01c3cffdf56 --- /dev/null +++ b/samples/client/petstore/kotlin/docs/components/schemas/FromSchema.md @@ -0,0 +1,214 @@ +# FromSchema +org.openapijsonschematools.client.components.schemas.FromSchema.java +public class FromSchema
+ +A class that contains necessary nested +- schema classes (which validate payloads), extends JsonSchema +- sealed interfaces which store validated payloads, java version of a sum type +- boxed classes which store validated payloads, sealed permits class implementations +- classes to store validated map payloads, extends FrozenMap +- classes to build inputs for map payloads + +## Nested Class Summary +| Modifier and Type | Class and Description | +| ----------------- | ---------------------- | +| sealed interface | [FromSchema.FromSchema1Boxed](#fromschema1boxed)
sealed interface for validated payloads | +| record | [FromSchema.FromSchema1BoxedMap](#fromschema1boxedmap)
boxed class to store validated Map payloads | +| static class | [FromSchema.FromSchema1](#fromschema1)
schema class | +| static class | [FromSchema.FromSchemaMapBuilder](#fromschemamapbuilder)
builder for Map payloads | +| static class | [FromSchema.FromSchemaMap](#fromschemamap)
output class for Map payloads | +| sealed interface | [FromSchema.IdBoxed](#idboxed)
sealed interface for validated payloads | +| record | [FromSchema.IdBoxedNumber](#idboxednumber)
boxed class to store validated Number payloads | +| static class | [FromSchema.Id](#id)
schema class | +| sealed interface | [FromSchema.DataBoxed](#databoxed)
sealed interface for validated payloads | +| record | [FromSchema.DataBoxedString](#databoxedstring)
boxed class to store validated String payloads | +| static class | [FromSchema.Data](#data)
schema class | + +## FromSchema1Boxed +public sealed interface FromSchema1Boxed
+permits
+[FromSchema1BoxedMap](#fromschema1boxedmap) + +sealed interface that stores validated payloads using boxed classes + +## FromSchema1BoxedMap +public record FromSchema1BoxedMap
+implements [FromSchema1Boxed](#fromschema1boxed) + +record that stores validated Map payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| FromSchema1BoxedMap([FromSchemaMap](#fromschemamap) data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| [FromSchemaMap](#fromschemamap) | data()
validated payload | +| @Nullable Object | getData()
validated payload | + +## FromSchema1 +public static class FromSchema1
+extends JsonSchema + +A schema class that validates payloads + +### Code Sample +``` +import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags; +import org.openapijsonschematools.client.configurations.SchemaConfiguration; +import org.openapijsonschematools.client.exceptions.ValidationException; +import org.openapijsonschematools.client.schemas.validation.MapUtils; +import org.openapijsonschematools.client.schemas.validation.FrozenList; +import org.openapijsonschematools.client.schemas.validation.FrozenMap; +import org.openapijsonschematools.client.components.schemas.FromSchema; + +import java.util.Arrays; +import java.util.List; +import java.util.AbstractMap; + +static final SchemaConfiguration configuration = new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().build()); + +// Map validation +FromSchema.FromSchemaMap validatedPayload = + FromSchema.FromSchema1.validate( + new FromSchema.FromSchemaMapBuilder() + .data("a") + + .id(1) + + .build(), + configuration +); +``` + +### Field Summary +| Modifier and Type | Field and Description | +| ----------------- | ---------------------- | +| Set> | type = Set.of(Map.class) | +| Map> | properties = Map.ofEntries(
    new PropertyEntry("data", [Data.class](#data))),
    new PropertyEntry("id", [Id.class](#id)))
)
| + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| [FromSchemaMap](#fromschemamap) | validate([Map<?, ?>](#fromschemamapbuilder) arg, SchemaConfiguration configuration) | +| [FromSchema1BoxedMap](#fromschema1boxedmap) | validateAndBox([Map<?, ?>](#fromschemamapbuilder) arg, SchemaConfiguration configuration) | +| [FromSchema1Boxed](#fromschema1boxed) | validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) | +| @Nullable Object | validate(@Nullable Object arg, SchemaConfiguration configuration) | + +## FromSchemaMapBuilder +public class FromSchemaMapBuilder
+builder for `Map` + +A class that builds the Map input type + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| FromSchemaMapBuilder()
Creates a builder that contains an empty map | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| Map | build()
Returns map input that should be used with Schema.validate | +| [FromSchemaMapBuilder](#fromschemamapbuilder) | data(String value) | +| [FromSchemaMapBuilder](#fromschemamapbuilder) | id(int value) | +| [FromSchemaMapBuilder](#fromschemamapbuilder) | id(float value) | +| [FromSchemaMapBuilder](#fromschemamapbuilder) | id(long value) | +| [FromSchemaMapBuilder](#fromschemamapbuilder) | id(double value) | +| [FromSchemaMapBuilder](#fromschemamapbuilder) | additionalProperty(String key, Nothing? value) | +| [FromSchemaMapBuilder](#fromschemamapbuilder) | additionalProperty(String key, boolean value) | +| [FromSchemaMapBuilder](#fromschemamapbuilder) | additionalProperty(String key, String value) | +| [FromSchemaMapBuilder](#fromschemamapbuilder) | additionalProperty(String key, int value) | +| [FromSchemaMapBuilder](#fromschemamapbuilder) | additionalProperty(String key, float value) | +| [FromSchemaMapBuilder](#fromschemamapbuilder) | additionalProperty(String key, long value) | +| [FromSchemaMapBuilder](#fromschemamapbuilder) | additionalProperty(String key, double value) | +| [FromSchemaMapBuilder](#fromschemamapbuilder) | additionalProperty(String key, List value) | +| [FromSchemaMapBuilder](#fromschemamapbuilder) | additionalProperty(String key, Map value) | + +## FromSchemaMap +public static class FromSchemaMap
+extends FrozenMap + +A class to store validated Map payloads + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| static [FromSchemaMap](#fromschemamap) | of([Map](#fromschemamapbuilder) arg, SchemaConfiguration configuration) | +| String | data()
[optional] | +| Number | id()
[optional] | +| @Nullable Object | getAdditionalProperty(String name)
provides type safety for additional properties | + +## IdBoxed +public sealed interface IdBoxed
+permits
+[IdBoxedNumber](#idboxednumber) + +sealed interface that stores validated payloads using boxed classes + +## IdBoxedNumber +public record IdBoxedNumber
+implements [IdBoxed](#idboxed) + +record that stores validated Number payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| IdBoxedNumber(Number data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| Number | data()
validated payload | +| @Nullable Object | getData()
validated payload | + +## Id +public static class Id
+extends IntJsonSchema.IntJsonSchema1 + +A schema class that validates payloads + +| Methods Inherited from class org.openapijsonschematools.client.schemas.IntJsonSchema.IntJsonSchema1 | +| ------------------------------------------------------------------ | +| validate | +| validateAndBox | + +## DataBoxed +public sealed interface DataBoxed
+permits
+[DataBoxedString](#databoxedstring) + +sealed interface that stores validated payloads using boxed classes + +## DataBoxedString +public record DataBoxedString
+implements [DataBoxed](#databoxed) + +record that stores validated String payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| DataBoxedString(String data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| String | data()
validated payload | +| @Nullable Object | getData()
validated payload | + +## Data +public static class Data
+extends StringJsonSchema.StringJsonSchema1 + +A schema class that validates payloads + +| Methods Inherited from class org.openapijsonschematools.client.schemas.StringJsonSchema.StringJsonSchema1 | +| ------------------------------------------------------------------ | +| validate | +| validateAndBox | + +[[Back to top]](#top) [[Back to Component Schemas]](../../../README.md#Component-Schemas) [[Back to README]](../../../README.md) diff --git a/samples/client/petstore/kotlin/docs/components/schemas/Fruit.md b/samples/client/petstore/kotlin/docs/components/schemas/Fruit.md new file mode 100644 index 00000000000..262e15ccefe --- /dev/null +++ b/samples/client/petstore/kotlin/docs/components/schemas/Fruit.md @@ -0,0 +1,251 @@ +# Fruit +org.openapijsonschematools.client.components.schemas.Fruit.java +public class Fruit
+ +A class that contains necessary nested +- schema classes (which validate payloads), extends JsonSchema +- sealed interfaces which store validated payloads, java version of a sum type +- boxed classes which store validated payloads, sealed permits class implementations +- classes to store validated map payloads, extends FrozenMap +- classes to build inputs for map payloads + +## Nested Class Summary +| Modifier and Type | Class and Description | +| ----------------- | ---------------------- | +| sealed interface | [Fruit.Fruit1Boxed](#fruit1boxed)
sealed interface for validated payloads | +| record | [Fruit.Fruit1BoxedVoid](#fruit1boxedvoid)
boxed class to store validated null payloads | +| record | [Fruit.Fruit1BoxedBoolean](#fruit1boxedboolean)
boxed class to store validated boolean payloads | +| record | [Fruit.Fruit1BoxedNumber](#fruit1boxednumber)
boxed class to store validated Number payloads | +| record | [Fruit.Fruit1BoxedString](#fruit1boxedstring)
boxed class to store validated String payloads | +| record | [Fruit.Fruit1BoxedList](#fruit1boxedlist)
boxed class to store validated List payloads | +| record | [Fruit.Fruit1BoxedMap](#fruit1boxedmap)
boxed class to store validated Map payloads | +| static class | [Fruit.Fruit1](#fruit1)
schema class | +| static class | [Fruit.FruitMapBuilder](#fruitmapbuilder)
builder for Map payloads | +| static class | [Fruit.FruitMap](#fruitmap)
output class for Map payloads | +| sealed interface | [Fruit.ColorBoxed](#colorboxed)
sealed interface for validated payloads | +| record | [Fruit.ColorBoxedString](#colorboxedstring)
boxed class to store validated String payloads | +| static class | [Fruit.Color](#color)
schema class | + +## Fruit1Boxed +public sealed interface Fruit1Boxed
+permits
+[Fruit1BoxedVoid](#fruit1boxedvoid), +[Fruit1BoxedBoolean](#fruit1boxedboolean), +[Fruit1BoxedNumber](#fruit1boxednumber), +[Fruit1BoxedString](#fruit1boxedstring), +[Fruit1BoxedList](#fruit1boxedlist), +[Fruit1BoxedMap](#fruit1boxedmap) + +sealed interface that stores validated payloads using boxed classes + +## Fruit1BoxedVoid +public record Fruit1BoxedVoid
+implements [Fruit1Boxed](#fruit1boxed) + +record that stores validated null payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| Fruit1BoxedVoid(Nothing? data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| Nothing? | data()
validated payload | +| @Nullable Object | getData()
validated payload | + +## Fruit1BoxedBoolean +public record Fruit1BoxedBoolean
+implements [Fruit1Boxed](#fruit1boxed) + +record that stores validated boolean payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| Fruit1BoxedBoolean(boolean data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| boolean | data()
validated payload | +| @Nullable Object | getData()
validated payload | + +## Fruit1BoxedNumber +public record Fruit1BoxedNumber
+implements [Fruit1Boxed](#fruit1boxed) + +record that stores validated Number payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| Fruit1BoxedNumber(Number data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| Number | data()
validated payload | +| @Nullable Object | getData()
validated payload | + +## Fruit1BoxedString +public record Fruit1BoxedString
+implements [Fruit1Boxed](#fruit1boxed) + +record that stores validated String payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| Fruit1BoxedString(String data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| String | data()
validated payload | +| @Nullable Object | getData()
validated payload | + +## Fruit1BoxedList +public record Fruit1BoxedList
+implements [Fruit1Boxed](#fruit1boxed) + +record that stores validated List payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| Fruit1BoxedList(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 | + +## Fruit1BoxedMap +public record Fruit1BoxedMap
+implements [Fruit1Boxed](#fruit1boxed) + +record that stores validated Map payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| Fruit1BoxedMap([FruitMap](#fruitmap) data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| [FruitMap](#fruitmap) | data()
validated payload | +| @Nullable Object | getData()
validated payload | + +## Fruit1 +public static class Fruit1
+extends JsonSchema + +A schema class that validates payloads + +### Field Summary +| Modifier and Type | Field and Description | +| ----------------- | ---------------------- | +| Map> | properties = Map.ofEntries(
    new PropertyEntry("color", [Color.class](#color)))
)
| +| List> | oneOf = List.of(
    [Apple.Apple1.class](../../components/schemas/Apple.md#apple1),
    [Banana.Banana1.class](../../components/schemas/Banana.md#banana1)
))
| + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| String | validate(String arg, SchemaConfiguration configuration) | +| Nothing? | validate(Nothing? arg, SchemaConfiguration configuration) | +| int | validate(int arg, SchemaConfiguration configuration) | +| long | validate(long arg, SchemaConfiguration configuration) | +| float | validate(float arg, SchemaConfiguration configuration) | +| double | validate(double arg, SchemaConfiguration configuration) | +| Number | validate(Number arg, SchemaConfiguration configuration) | +| boolean | validate(boolean arg, SchemaConfiguration configuration) | +| [FruitMap](#fruitmap) | validate([Map<?, ?>](#fruitmapbuilder) arg, SchemaConfiguration configuration) | +| FrozenList<@Nullable Object> | validate(List arg, SchemaConfiguration configuration) | +| [Fruit1BoxedString](#fruit1boxedstring) | validateAndBox(String arg, SchemaConfiguration configuration) | +| [Fruit1BoxedVoid](#fruit1boxedvoid) | validateAndBox(Nothing? arg, SchemaConfiguration configuration) | +| [Fruit1BoxedNumber](#fruit1boxednumber) | validateAndBox(Number arg, SchemaConfiguration configuration) | +| [Fruit1BoxedBoolean](#fruit1boxedboolean) | validateAndBox(boolean arg, SchemaConfiguration configuration) | +| [Fruit1BoxedMap](#fruit1boxedmap) | validateAndBox([Map<?, ?>](#fruitmapbuilder) arg, SchemaConfiguration configuration) | +| [Fruit1BoxedList](#fruit1boxedlist) | validateAndBox(List arg, SchemaConfiguration configuration) | +| [Fruit1Boxed](#fruit1boxed) | validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) | +| @Nullable Object | validate(@Nullable Object arg, SchemaConfiguration configuration) | + +## FruitMapBuilder +public class FruitMapBuilder
+builder for `Map` + +A class that builds the Map input type + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| FruitMapBuilder()
Creates a builder that contains an empty map | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| Map | build()
Returns map input that should be used with Schema.validate | +| [FruitMapBuilder](#fruitmapbuilder) | color(String value) | +| [FruitMapBuilder](#fruitmapbuilder) | additionalProperty(String key, Nothing? value) | +| [FruitMapBuilder](#fruitmapbuilder) | additionalProperty(String key, boolean value) | +| [FruitMapBuilder](#fruitmapbuilder) | additionalProperty(String key, String value) | +| [FruitMapBuilder](#fruitmapbuilder) | additionalProperty(String key, int value) | +| [FruitMapBuilder](#fruitmapbuilder) | additionalProperty(String key, float value) | +| [FruitMapBuilder](#fruitmapbuilder) | additionalProperty(String key, long value) | +| [FruitMapBuilder](#fruitmapbuilder) | additionalProperty(String key, double value) | +| [FruitMapBuilder](#fruitmapbuilder) | additionalProperty(String key, List value) | +| [FruitMapBuilder](#fruitmapbuilder) | additionalProperty(String key, Map value) | + +## FruitMap +public static class FruitMap
+extends FrozenMap + +A class to store validated Map payloads + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| static [FruitMap](#fruitmap) | of([Map](#fruitmapbuilder) arg, SchemaConfiguration configuration) | +| String | color()
[optional] | +| @Nullable Object | getAdditionalProperty(String name)
provides type safety for additional properties | + +## ColorBoxed +public sealed interface ColorBoxed
+permits
+[ColorBoxedString](#colorboxedstring) + +sealed interface that stores validated payloads using boxed classes + +## ColorBoxedString +public record ColorBoxedString
+implements [ColorBoxed](#colorboxed) + +record that stores validated String payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| ColorBoxedString(String data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| String | data()
validated payload | +| @Nullable Object | getData()
validated payload | + +## Color +public static class Color
+extends StringJsonSchema.StringJsonSchema1 + +A schema class that validates payloads + +| Methods Inherited from class org.openapijsonschematools.client.schemas.StringJsonSchema.StringJsonSchema1 | +| ------------------------------------------------------------------ | +| validate | +| validateAndBox | + +[[Back to top]](#top) [[Back to Component Schemas]](../../../README.md#Component-Schemas) [[Back to README]](../../../README.md) diff --git a/samples/client/petstore/kotlin/docs/components/schemas/FruitReq.md b/samples/client/petstore/kotlin/docs/components/schemas/FruitReq.md new file mode 100644 index 00000000000..aac35b56aa4 --- /dev/null +++ b/samples/client/petstore/kotlin/docs/components/schemas/FruitReq.md @@ -0,0 +1,207 @@ +# FruitReq +org.openapijsonschematools.client.components.schemas.FruitReq.java +public class FruitReq
+ +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 + +## Nested Class Summary +| Modifier and Type | Class and Description | +| ----------------- | ---------------------- | +| sealed interface | [FruitReq.FruitReq1Boxed](#fruitreq1boxed)
sealed interface for validated payloads | +| record | [FruitReq.FruitReq1BoxedVoid](#fruitreq1boxedvoid)
boxed class to store validated null payloads | +| record | [FruitReq.FruitReq1BoxedBoolean](#fruitreq1boxedboolean)
boxed class to store validated boolean payloads | +| record | [FruitReq.FruitReq1BoxedNumber](#fruitreq1boxednumber)
boxed class to store validated Number payloads | +| record | [FruitReq.FruitReq1BoxedString](#fruitreq1boxedstring)
boxed class to store validated String payloads | +| record | [FruitReq.FruitReq1BoxedList](#fruitreq1boxedlist)
boxed class to store validated List payloads | +| record | [FruitReq.FruitReq1BoxedMap](#fruitreq1boxedmap)
boxed class to store validated Map payloads | +| static class | [FruitReq.FruitReq1](#fruitreq1)
schema class | +| sealed interface | [FruitReq.Schema0Boxed](#schema0boxed)
sealed interface for validated payloads | +| record | [FruitReq.Schema0BoxedVoid](#schema0boxedvoid)
boxed class to store validated null payloads | +| static class | [FruitReq.Schema0](#schema0)
schema class | + +## FruitReq1Boxed +public sealed interface FruitReq1Boxed
+permits
+[FruitReq1BoxedVoid](#fruitreq1boxedvoid), +[FruitReq1BoxedBoolean](#fruitreq1boxedboolean), +[FruitReq1BoxedNumber](#fruitreq1boxednumber), +[FruitReq1BoxedString](#fruitreq1boxedstring), +[FruitReq1BoxedList](#fruitreq1boxedlist), +[FruitReq1BoxedMap](#fruitreq1boxedmap) + +sealed interface that stores validated payloads using boxed classes + +## FruitReq1BoxedVoid +public record FruitReq1BoxedVoid
+implements [FruitReq1Boxed](#fruitreq1boxed) + +record that stores validated null payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| FruitReq1BoxedVoid(Nothing? data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| Nothing? | data()
validated payload | +| @Nullable Object | getData()
validated payload | + +## FruitReq1BoxedBoolean +public record FruitReq1BoxedBoolean
+implements [FruitReq1Boxed](#fruitreq1boxed) + +record that stores validated boolean payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| FruitReq1BoxedBoolean(boolean data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| boolean | data()
validated payload | +| @Nullable Object | getData()
validated payload | + +## FruitReq1BoxedNumber +public record FruitReq1BoxedNumber
+implements [FruitReq1Boxed](#fruitreq1boxed) + +record that stores validated Number payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| FruitReq1BoxedNumber(Number data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| Number | data()
validated payload | +| @Nullable Object | getData()
validated payload | + +## FruitReq1BoxedString +public record FruitReq1BoxedString
+implements [FruitReq1Boxed](#fruitreq1boxed) + +record that stores validated String payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| FruitReq1BoxedString(String data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| String | data()
validated payload | +| @Nullable Object | getData()
validated payload | + +## FruitReq1BoxedList +public record FruitReq1BoxedList
+implements [FruitReq1Boxed](#fruitreq1boxed) + +record that stores validated List payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| FruitReq1BoxedList(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 | + +## FruitReq1BoxedMap +public record FruitReq1BoxedMap
+implements [FruitReq1Boxed](#fruitreq1boxed) + +record that stores validated Map payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| FruitReq1BoxedMap(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 | + +## FruitReq1 +public static class FruitReq1
+extends JsonSchema + +A schema class that validates payloads + +### Field Summary +| Modifier and Type | Field and Description | +| ----------------- | ---------------------- | +| List> | oneOf = List.of(
    [Schema0.class](#schema0),
    [AppleReq.AppleReq1.class](../../components/schemas/AppleReq.md#applereq1),
    [BananaReq.BananaReq1.class](../../components/schemas/BananaReq.md#bananareq1)
))
| + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| String | validate(String arg, SchemaConfiguration configuration) | +| Nothing? | validate(Nothing? arg, SchemaConfiguration configuration) | +| int | validate(int arg, SchemaConfiguration configuration) | +| long | validate(long arg, SchemaConfiguration configuration) | +| float | validate(float arg, SchemaConfiguration configuration) | +| double | validate(double arg, SchemaConfiguration configuration) | +| Number | validate(Number arg, SchemaConfiguration configuration) | +| boolean | validate(boolean arg, SchemaConfiguration configuration) | +| FrozenMap<@Nullable Object> | validate(Map<?, ?> arg, SchemaConfiguration configuration) | +| FrozenList<@Nullable Object> | validate(List arg, SchemaConfiguration configuration) | +| [FruitReq1BoxedString](#fruitreq1boxedstring) | validateAndBox(String arg, SchemaConfiguration configuration) | +| [FruitReq1BoxedVoid](#fruitreq1boxedvoid) | validateAndBox(Nothing? arg, SchemaConfiguration configuration) | +| [FruitReq1BoxedNumber](#fruitreq1boxednumber) | validateAndBox(Number arg, SchemaConfiguration configuration) | +| [FruitReq1BoxedBoolean](#fruitreq1boxedboolean) | validateAndBox(boolean arg, SchemaConfiguration configuration) | +| [FruitReq1BoxedMap](#fruitreq1boxedmap) | validateAndBox(Map<?, ?> arg, SchemaConfiguration configuration) | +| [FruitReq1BoxedList](#fruitreq1boxedlist) | validateAndBox(List arg, SchemaConfiguration configuration) | +| [FruitReq1Boxed](#fruitreq1boxed) | validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) | +| @Nullable Object | validate(@Nullable Object arg, SchemaConfiguration configuration) | + +## Schema0Boxed +public sealed interface Schema0Boxed
+permits
+[Schema0BoxedVoid](#schema0boxedvoid) + +sealed interface that stores validated payloads using boxed classes + +## Schema0BoxedVoid +public record Schema0BoxedVoid
+implements [Schema0Boxed](#schema0boxed) + +record that stores validated null payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| Schema0BoxedVoid(Nothing? data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| Nothing? | data()
validated payload | +| @Nullable Object | getData()
validated payload | + +## Schema0 +public static class Schema0
+extends NullJsonSchema.NullJsonSchema1 + +A schema class that validates payloads + +| Methods Inherited from class org.openapijsonschematools.client.schemas.NullJsonSchema.NullJsonSchema1 | +| ------------------------------------------------------------------ | +| validate | +| validateAndBox | + +[[Back to top]](#top) [[Back to Component Schemas]](../../../README.md#Component-Schemas) [[Back to README]](../../../README.md) diff --git a/samples/client/petstore/kotlin/docs/components/schemas/GmFruit.md b/samples/client/petstore/kotlin/docs/components/schemas/GmFruit.md new file mode 100644 index 00000000000..f5b138715f4 --- /dev/null +++ b/samples/client/petstore/kotlin/docs/components/schemas/GmFruit.md @@ -0,0 +1,251 @@ +# GmFruit +org.openapijsonschematools.client.components.schemas.GmFruit.java +public class GmFruit
+ +A class that contains necessary nested +- schema classes (which validate payloads), extends JsonSchema +- sealed interfaces which store validated payloads, java version of a sum type +- boxed classes which store validated payloads, sealed permits class implementations +- classes to store validated map payloads, extends FrozenMap +- classes to build inputs for map payloads + +## Nested Class Summary +| Modifier and Type | Class and Description | +| ----------------- | ---------------------- | +| sealed interface | [GmFruit.GmFruit1Boxed](#gmfruit1boxed)
sealed interface for validated payloads | +| record | [GmFruit.GmFruit1BoxedVoid](#gmfruit1boxedvoid)
boxed class to store validated null payloads | +| record | [GmFruit.GmFruit1BoxedBoolean](#gmfruit1boxedboolean)
boxed class to store validated boolean payloads | +| record | [GmFruit.GmFruit1BoxedNumber](#gmfruit1boxednumber)
boxed class to store validated Number payloads | +| record | [GmFruit.GmFruit1BoxedString](#gmfruit1boxedstring)
boxed class to store validated String payloads | +| record | [GmFruit.GmFruit1BoxedList](#gmfruit1boxedlist)
boxed class to store validated List payloads | +| record | [GmFruit.GmFruit1BoxedMap](#gmfruit1boxedmap)
boxed class to store validated Map payloads | +| static class | [GmFruit.GmFruit1](#gmfruit1)
schema class | +| static class | [GmFruit.GmFruitMapBuilder](#gmfruitmapbuilder)
builder for Map payloads | +| static class | [GmFruit.GmFruitMap](#gmfruitmap)
output class for Map payloads | +| sealed interface | [GmFruit.ColorBoxed](#colorboxed)
sealed interface for validated payloads | +| record | [GmFruit.ColorBoxedString](#colorboxedstring)
boxed class to store validated String payloads | +| static class | [GmFruit.Color](#color)
schema class | + +## GmFruit1Boxed +public sealed interface GmFruit1Boxed
+permits
+[GmFruit1BoxedVoid](#gmfruit1boxedvoid), +[GmFruit1BoxedBoolean](#gmfruit1boxedboolean), +[GmFruit1BoxedNumber](#gmfruit1boxednumber), +[GmFruit1BoxedString](#gmfruit1boxedstring), +[GmFruit1BoxedList](#gmfruit1boxedlist), +[GmFruit1BoxedMap](#gmfruit1boxedmap) + +sealed interface that stores validated payloads using boxed classes + +## GmFruit1BoxedVoid +public record GmFruit1BoxedVoid
+implements [GmFruit1Boxed](#gmfruit1boxed) + +record that stores validated null payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| GmFruit1BoxedVoid(Nothing? data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| Nothing? | data()
validated payload | +| @Nullable Object | getData()
validated payload | + +## GmFruit1BoxedBoolean +public record GmFruit1BoxedBoolean
+implements [GmFruit1Boxed](#gmfruit1boxed) + +record that stores validated boolean payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| GmFruit1BoxedBoolean(boolean data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| boolean | data()
validated payload | +| @Nullable Object | getData()
validated payload | + +## GmFruit1BoxedNumber +public record GmFruit1BoxedNumber
+implements [GmFruit1Boxed](#gmfruit1boxed) + +record that stores validated Number payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| GmFruit1BoxedNumber(Number data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| Number | data()
validated payload | +| @Nullable Object | getData()
validated payload | + +## GmFruit1BoxedString +public record GmFruit1BoxedString
+implements [GmFruit1Boxed](#gmfruit1boxed) + +record that stores validated String payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| GmFruit1BoxedString(String data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| String | data()
validated payload | +| @Nullable Object | getData()
validated payload | + +## GmFruit1BoxedList +public record GmFruit1BoxedList
+implements [GmFruit1Boxed](#gmfruit1boxed) + +record that stores validated List payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| GmFruit1BoxedList(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 | + +## GmFruit1BoxedMap +public record GmFruit1BoxedMap
+implements [GmFruit1Boxed](#gmfruit1boxed) + +record that stores validated Map payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| GmFruit1BoxedMap([GmFruitMap](#gmfruitmap) data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| [GmFruitMap](#gmfruitmap) | data()
validated payload | +| @Nullable Object | getData()
validated payload | + +## GmFruit1 +public static class GmFruit1
+extends JsonSchema + +A schema class that validates payloads + +### Field Summary +| Modifier and Type | Field and Description | +| ----------------- | ---------------------- | +| Map> | properties = Map.ofEntries(
    new PropertyEntry("color", [Color.class](#color)))
)
| +| List> | anyOf = List.of(
    [Apple.Apple1.class](../../components/schemas/Apple.md#apple1),
    [Banana.Banana1.class](../../components/schemas/Banana.md#banana1)
)
| + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| String | validate(String arg, SchemaConfiguration configuration) | +| Nothing? | validate(Nothing? arg, SchemaConfiguration configuration) | +| int | validate(int arg, SchemaConfiguration configuration) | +| long | validate(long arg, SchemaConfiguration configuration) | +| float | validate(float arg, SchemaConfiguration configuration) | +| double | validate(double arg, SchemaConfiguration configuration) | +| Number | validate(Number arg, SchemaConfiguration configuration) | +| boolean | validate(boolean arg, SchemaConfiguration configuration) | +| [GmFruitMap](#gmfruitmap) | validate([Map<?, ?>](#gmfruitmapbuilder) arg, SchemaConfiguration configuration) | +| FrozenList<@Nullable Object> | validate(List arg, SchemaConfiguration configuration) | +| [GmFruit1BoxedString](#gmfruit1boxedstring) | validateAndBox(String arg, SchemaConfiguration configuration) | +| [GmFruit1BoxedVoid](#gmfruit1boxedvoid) | validateAndBox(Nothing? arg, SchemaConfiguration configuration) | +| [GmFruit1BoxedNumber](#gmfruit1boxednumber) | validateAndBox(Number arg, SchemaConfiguration configuration) | +| [GmFruit1BoxedBoolean](#gmfruit1boxedboolean) | validateAndBox(boolean arg, SchemaConfiguration configuration) | +| [GmFruit1BoxedMap](#gmfruit1boxedmap) | validateAndBox([Map<?, ?>](#gmfruitmapbuilder) arg, SchemaConfiguration configuration) | +| [GmFruit1BoxedList](#gmfruit1boxedlist) | validateAndBox(List arg, SchemaConfiguration configuration) | +| [GmFruit1Boxed](#gmfruit1boxed) | validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) | +| @Nullable Object | validate(@Nullable Object arg, SchemaConfiguration configuration) | + +## GmFruitMapBuilder +public class GmFruitMapBuilder
+builder for `Map` + +A class that builds the Map input type + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| GmFruitMapBuilder()
Creates a builder that contains an empty map | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| Map | build()
Returns map input that should be used with Schema.validate | +| [GmFruitMapBuilder](#gmfruitmapbuilder) | color(String value) | +| [GmFruitMapBuilder](#gmfruitmapbuilder) | additionalProperty(String key, Nothing? value) | +| [GmFruitMapBuilder](#gmfruitmapbuilder) | additionalProperty(String key, boolean value) | +| [GmFruitMapBuilder](#gmfruitmapbuilder) | additionalProperty(String key, String value) | +| [GmFruitMapBuilder](#gmfruitmapbuilder) | additionalProperty(String key, int value) | +| [GmFruitMapBuilder](#gmfruitmapbuilder) | additionalProperty(String key, float value) | +| [GmFruitMapBuilder](#gmfruitmapbuilder) | additionalProperty(String key, long value) | +| [GmFruitMapBuilder](#gmfruitmapbuilder) | additionalProperty(String key, double value) | +| [GmFruitMapBuilder](#gmfruitmapbuilder) | additionalProperty(String key, List value) | +| [GmFruitMapBuilder](#gmfruitmapbuilder) | additionalProperty(String key, Map value) | + +## GmFruitMap +public static class GmFruitMap
+extends FrozenMap + +A class to store validated Map payloads + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| static [GmFruitMap](#gmfruitmap) | of([Map](#gmfruitmapbuilder) arg, SchemaConfiguration configuration) | +| String | color()
[optional] | +| @Nullable Object | getAdditionalProperty(String name)
provides type safety for additional properties | + +## ColorBoxed +public sealed interface ColorBoxed
+permits
+[ColorBoxedString](#colorboxedstring) + +sealed interface that stores validated payloads using boxed classes + +## ColorBoxedString +public record ColorBoxedString
+implements [ColorBoxed](#colorboxed) + +record that stores validated String payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| ColorBoxedString(String data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| String | data()
validated payload | +| @Nullable Object | getData()
validated payload | + +## Color +public static class Color
+extends StringJsonSchema.StringJsonSchema1 + +A schema class that validates payloads + +| Methods Inherited from class org.openapijsonschematools.client.schemas.StringJsonSchema.StringJsonSchema1 | +| ------------------------------------------------------------------ | +| validate | +| validateAndBox | + +[[Back to top]](#top) [[Back to Component Schemas]](../../../README.md#Component-Schemas) [[Back to README]](../../../README.md) diff --git a/samples/client/petstore/kotlin/docs/components/schemas/GrandparentAnimal.md b/samples/client/petstore/kotlin/docs/components/schemas/GrandparentAnimal.md new file mode 100644 index 00000000000..7850a898319 --- /dev/null +++ b/samples/client/petstore/kotlin/docs/components/schemas/GrandparentAnimal.md @@ -0,0 +1,185 @@ +# GrandparentAnimal +org.openapijsonschematools.client.components.schemas.GrandparentAnimal.java +public class GrandparentAnimal
+ +A class that contains necessary nested +- schema classes (which validate payloads), extends JsonSchema +- sealed interfaces which store validated payloads, java version of a sum type +- boxed classes which store validated payloads, sealed permits class implementations +- classes to store validated map payloads, extends FrozenMap +- classes to build inputs for map payloads + +## Nested Class Summary +| Modifier and Type | Class and Description | +| ----------------- | ---------------------- | +| sealed interface | [GrandparentAnimal.GrandparentAnimal1Boxed](#grandparentanimal1boxed)
sealed interface for validated payloads | +| record | [GrandparentAnimal.GrandparentAnimal1BoxedMap](#grandparentanimal1boxedmap)
boxed class to store validated Map payloads | +| static class | [GrandparentAnimal.GrandparentAnimal1](#grandparentanimal1)
schema class | +| static class | [GrandparentAnimal.GrandparentAnimalMapBuilder](#grandparentanimalmapbuilder)
builder for Map payloads | +| static class | [GrandparentAnimal.GrandparentAnimalMap](#grandparentanimalmap)
output class for Map payloads | +| sealed interface | [GrandparentAnimal.PetTypeBoxed](#pettypeboxed)
sealed interface for validated payloads | +| record | [GrandparentAnimal.PetTypeBoxedString](#pettypeboxedstring)
boxed class to store validated String payloads | +| static class | [GrandparentAnimal.PetType](#pettype)
schema class | + +## GrandparentAnimal1Boxed +public sealed interface GrandparentAnimal1Boxed
+permits
+[GrandparentAnimal1BoxedMap](#grandparentanimal1boxedmap) + +sealed interface that stores validated payloads using boxed classes + +## GrandparentAnimal1BoxedMap +public record GrandparentAnimal1BoxedMap
+implements [GrandparentAnimal1Boxed](#grandparentanimal1boxed) + +record that stores validated Map payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| GrandparentAnimal1BoxedMap([GrandparentAnimalMap](#grandparentanimalmap) data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| [GrandparentAnimalMap](#grandparentanimalmap) | data()
validated payload | +| @Nullable Object | getData()
validated payload | + +## GrandparentAnimal1 +public static class GrandparentAnimal1
+extends JsonSchema + +A schema class that validates payloads + +### Code Sample +``` +import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags; +import org.openapijsonschematools.client.configurations.SchemaConfiguration; +import org.openapijsonschematools.client.exceptions.ValidationException; +import org.openapijsonschematools.client.schemas.validation.MapUtils; +import org.openapijsonschematools.client.schemas.validation.FrozenList; +import org.openapijsonschematools.client.schemas.validation.FrozenMap; +import org.openapijsonschematools.client.components.schemas.GrandparentAnimal; + +import java.util.Arrays; +import java.util.List; +import java.util.AbstractMap; + +static final SchemaConfiguration configuration = new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().build()); + +// Map validation +GrandparentAnimal.GrandparentAnimalMap validatedPayload = + GrandparentAnimal.GrandparentAnimal1.validate( + new GrandparentAnimal.GrandparentAnimalMapBuilder() + .pet_type("a") + + .build(), + configuration +); +``` + +### Field Summary +| Modifier and Type | Field and Description | +| ----------------- | ---------------------- | +| Set> | type = Set.of(Map.class) | +| Map> | properties = Map.ofEntries(
    new PropertyEntry("pet_type", [PetType.class](#pettype)))
)
| +| Set | required = Set.of(
    "pet_type"
)
| + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| [GrandparentAnimalMap](#grandparentanimalmap) | validate([Map<?, ?>](#grandparentanimalmapbuilder) arg, SchemaConfiguration configuration) | +| [GrandparentAnimal1BoxedMap](#grandparentanimal1boxedmap) | validateAndBox([Map<?, ?>](#grandparentanimalmapbuilder) arg, SchemaConfiguration configuration) | +| [GrandparentAnimal1Boxed](#grandparentanimal1boxed) | validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) | +| @Nullable Object | validate(@Nullable Object arg, SchemaConfiguration configuration) | + +## GrandparentAnimalMap0Builder +public class GrandparentAnimalMap0Builder
+builder for `Map` + +A class that builds the Map input type + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| GrandparentAnimalMap0Builder(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 | +| [GrandparentAnimalMap0Builder](#grandparentanimalmap0builder) | additionalProperty(String key, Nothing? value) | +| [GrandparentAnimalMap0Builder](#grandparentanimalmap0builder) | additionalProperty(String key, boolean value) | +| [GrandparentAnimalMap0Builder](#grandparentanimalmap0builder) | additionalProperty(String key, String value) | +| [GrandparentAnimalMap0Builder](#grandparentanimalmap0builder) | additionalProperty(String key, int value) | +| [GrandparentAnimalMap0Builder](#grandparentanimalmap0builder) | additionalProperty(String key, float value) | +| [GrandparentAnimalMap0Builder](#grandparentanimalmap0builder) | additionalProperty(String key, long value) | +| [GrandparentAnimalMap0Builder](#grandparentanimalmap0builder) | additionalProperty(String key, double value) | +| [GrandparentAnimalMap0Builder](#grandparentanimalmap0builder) | additionalProperty(String key, List value) | +| [GrandparentAnimalMap0Builder](#grandparentanimalmap0builder) | additionalProperty(String key, Map value) | + +## GrandparentAnimalMapBuilder +public class GrandparentAnimalMapBuilder
+builder for `Map` + +A class that builds the Map input type + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| GrandparentAnimalMapBuilder()
Creates a builder that contains an empty map | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| [GrandparentAnimalMap0Builder](#grandparentanimalmap0builder) | pet_type(String value) | + +## GrandparentAnimalMap +public static class GrandparentAnimalMap
+extends FrozenMap + +A class to store validated Map payloads + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| static [GrandparentAnimalMap](#grandparentanimalmap) | of([Map](#grandparentanimalmapbuilder) arg, SchemaConfiguration configuration) | +| String | pet_type()
| +| @Nullable Object | getAdditionalProperty(String name)
provides type safety for additional properties | + +## PetTypeBoxed +public sealed interface PetTypeBoxed
+permits
+[PetTypeBoxedString](#pettypeboxedstring) + +sealed interface that stores validated payloads using boxed classes + +## PetTypeBoxedString +public record PetTypeBoxedString
+implements [PetTypeBoxed](#pettypeboxed) + +record that stores validated String payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| PetTypeBoxedString(String data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| String | data()
validated payload | +| @Nullable Object | getData()
validated payload | + +## PetType +public static class PetType
+extends StringJsonSchema.StringJsonSchema1 + +A schema class that validates payloads + +| Methods Inherited from class org.openapijsonschematools.client.schemas.StringJsonSchema.StringJsonSchema1 | +| ------------------------------------------------------------------ | +| validate | +| validateAndBox | + +[[Back to top]](#top) [[Back to Component Schemas]](../../../README.md#Component-Schemas) [[Back to README]](../../../README.md) diff --git a/samples/client/petstore/kotlin/docs/components/schemas/HasOnlyReadOnly.md b/samples/client/petstore/kotlin/docs/components/schemas/HasOnlyReadOnly.md new file mode 100644 index 00000000000..b521426d668 --- /dev/null +++ b/samples/client/petstore/kotlin/docs/components/schemas/HasOnlyReadOnly.md @@ -0,0 +1,211 @@ +# HasOnlyReadOnly +org.openapijsonschematools.client.components.schemas.HasOnlyReadOnly.java +public class HasOnlyReadOnly
+ +A class that contains necessary nested +- schema classes (which validate payloads), extends JsonSchema +- sealed interfaces which store validated payloads, java version of a sum type +- boxed classes which store validated payloads, sealed permits class implementations +- classes to store validated map payloads, extends FrozenMap +- classes to build inputs for map payloads + +## Nested Class Summary +| Modifier and Type | Class and Description | +| ----------------- | ---------------------- | +| sealed interface | [HasOnlyReadOnly.HasOnlyReadOnly1Boxed](#hasonlyreadonly1boxed)
sealed interface for validated payloads | +| record | [HasOnlyReadOnly.HasOnlyReadOnly1BoxedMap](#hasonlyreadonly1boxedmap)
boxed class to store validated Map payloads | +| static class | [HasOnlyReadOnly.HasOnlyReadOnly1](#hasonlyreadonly1)
schema class | +| static class | [HasOnlyReadOnly.HasOnlyReadOnlyMapBuilder](#hasonlyreadonlymapbuilder)
builder for Map payloads | +| static class | [HasOnlyReadOnly.HasOnlyReadOnlyMap](#hasonlyreadonlymap)
output class for Map payloads | +| sealed interface | [HasOnlyReadOnly.FooBoxed](#fooboxed)
sealed interface for validated payloads | +| record | [HasOnlyReadOnly.FooBoxedString](#fooboxedstring)
boxed class to store validated String payloads | +| static class | [HasOnlyReadOnly.Foo](#foo)
schema class | +| sealed interface | [HasOnlyReadOnly.BarBoxed](#barboxed)
sealed interface for validated payloads | +| record | [HasOnlyReadOnly.BarBoxedString](#barboxedstring)
boxed class to store validated String payloads | +| static class | [HasOnlyReadOnly.Bar](#bar)
schema class | + +## HasOnlyReadOnly1Boxed +public sealed interface HasOnlyReadOnly1Boxed
+permits
+[HasOnlyReadOnly1BoxedMap](#hasonlyreadonly1boxedmap) + +sealed interface that stores validated payloads using boxed classes + +## HasOnlyReadOnly1BoxedMap +public record HasOnlyReadOnly1BoxedMap
+implements [HasOnlyReadOnly1Boxed](#hasonlyreadonly1boxed) + +record that stores validated Map payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| HasOnlyReadOnly1BoxedMap([HasOnlyReadOnlyMap](#hasonlyreadonlymap) data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| [HasOnlyReadOnlyMap](#hasonlyreadonlymap) | data()
validated payload | +| @Nullable Object | getData()
validated payload | + +## HasOnlyReadOnly1 +public static class HasOnlyReadOnly1
+extends JsonSchema + +A schema class that validates payloads + +### Code Sample +``` +import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags; +import org.openapijsonschematools.client.configurations.SchemaConfiguration; +import org.openapijsonschematools.client.exceptions.ValidationException; +import org.openapijsonschematools.client.schemas.validation.MapUtils; +import org.openapijsonschematools.client.schemas.validation.FrozenList; +import org.openapijsonschematools.client.schemas.validation.FrozenMap; +import org.openapijsonschematools.client.components.schemas.HasOnlyReadOnly; + +import java.util.Arrays; +import java.util.List; +import java.util.AbstractMap; + +static final SchemaConfiguration configuration = new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().build()); + +// Map validation +HasOnlyReadOnly.HasOnlyReadOnlyMap validatedPayload = + HasOnlyReadOnly.HasOnlyReadOnly1.validate( + new HasOnlyReadOnly.HasOnlyReadOnlyMapBuilder() + .bar("a") + + .foo("a") + + .build(), + configuration +); +``` + +### Field Summary +| Modifier and Type | Field and Description | +| ----------------- | ---------------------- | +| Set> | type = Set.of(Map.class) | +| Map> | properties = Map.ofEntries(
    new PropertyEntry("bar", [Bar.class](#bar))),
    new PropertyEntry("foo", [Foo.class](#foo)))
)
| + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| [HasOnlyReadOnlyMap](#hasonlyreadonlymap) | validate([Map<?, ?>](#hasonlyreadonlymapbuilder) arg, SchemaConfiguration configuration) | +| [HasOnlyReadOnly1BoxedMap](#hasonlyreadonly1boxedmap) | validateAndBox([Map<?, ?>](#hasonlyreadonlymapbuilder) arg, SchemaConfiguration configuration) | +| [HasOnlyReadOnly1Boxed](#hasonlyreadonly1boxed) | validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) | +| @Nullable Object | validate(@Nullable Object arg, SchemaConfiguration configuration) | + +## HasOnlyReadOnlyMapBuilder +public class HasOnlyReadOnlyMapBuilder
+builder for `Map` + +A class that builds the Map input type + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| HasOnlyReadOnlyMapBuilder()
Creates a builder that contains an empty map | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| Map | build()
Returns map input that should be used with Schema.validate | +| [HasOnlyReadOnlyMapBuilder](#hasonlyreadonlymapbuilder) | bar(String value) | +| [HasOnlyReadOnlyMapBuilder](#hasonlyreadonlymapbuilder) | foo(String value) | +| [HasOnlyReadOnlyMapBuilder](#hasonlyreadonlymapbuilder) | additionalProperty(String key, Nothing? value) | +| [HasOnlyReadOnlyMapBuilder](#hasonlyreadonlymapbuilder) | additionalProperty(String key, boolean value) | +| [HasOnlyReadOnlyMapBuilder](#hasonlyreadonlymapbuilder) | additionalProperty(String key, String value) | +| [HasOnlyReadOnlyMapBuilder](#hasonlyreadonlymapbuilder) | additionalProperty(String key, int value) | +| [HasOnlyReadOnlyMapBuilder](#hasonlyreadonlymapbuilder) | additionalProperty(String key, float value) | +| [HasOnlyReadOnlyMapBuilder](#hasonlyreadonlymapbuilder) | additionalProperty(String key, long value) | +| [HasOnlyReadOnlyMapBuilder](#hasonlyreadonlymapbuilder) | additionalProperty(String key, double value) | +| [HasOnlyReadOnlyMapBuilder](#hasonlyreadonlymapbuilder) | additionalProperty(String key, List value) | +| [HasOnlyReadOnlyMapBuilder](#hasonlyreadonlymapbuilder) | additionalProperty(String key, Map value) | + +## HasOnlyReadOnlyMap +public static class HasOnlyReadOnlyMap
+extends FrozenMap + +A class to store validated Map payloads + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| static [HasOnlyReadOnlyMap](#hasonlyreadonlymap) | of([Map](#hasonlyreadonlymapbuilder) arg, SchemaConfiguration configuration) | +| String | bar()
[optional] | +| String | foo()
[optional] | +| @Nullable Object | getAdditionalProperty(String name)
provides type safety for additional properties | + +## FooBoxed +public sealed interface FooBoxed
+permits
+[FooBoxedString](#fooboxedstring) + +sealed interface that stores validated payloads using boxed classes + +## FooBoxedString +public record FooBoxedString
+implements [FooBoxed](#fooboxed) + +record that stores validated String payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| FooBoxedString(String data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| String | data()
validated payload | +| @Nullable Object | getData()
validated payload | + +## Foo +public static class Foo
+extends StringJsonSchema.StringJsonSchema1 + +A schema class that validates payloads + +| Methods Inherited from class org.openapijsonschematools.client.schemas.StringJsonSchema.StringJsonSchema1 | +| ------------------------------------------------------------------ | +| validate | +| validateAndBox | + +## BarBoxed +public sealed interface BarBoxed
+permits
+[BarBoxedString](#barboxedstring) + +sealed interface that stores validated payloads using boxed classes + +## BarBoxedString +public record BarBoxedString
+implements [BarBoxed](#barboxed) + +record that stores validated String payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| BarBoxedString(String data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| String | data()
validated payload | +| @Nullable Object | getData()
validated payload | + +## Bar +public static class Bar
+extends StringJsonSchema.StringJsonSchema1 + +A schema class that validates payloads + +| Methods Inherited from class org.openapijsonschematools.client.schemas.StringJsonSchema.StringJsonSchema1 | +| ------------------------------------------------------------------ | +| validate | +| validateAndBox | + +[[Back to top]](#top) [[Back to Component Schemas]](../../../README.md#Component-Schemas) [[Back to README]](../../../README.md) diff --git a/samples/client/petstore/kotlin/docs/components/schemas/HealthCheckResult.md b/samples/client/petstore/kotlin/docs/components/schemas/HealthCheckResult.md new file mode 100644 index 00000000000..518fb4c4b67 --- /dev/null +++ b/samples/client/petstore/kotlin/docs/components/schemas/HealthCheckResult.md @@ -0,0 +1,231 @@ +# HealthCheckResult +org.openapijsonschematools.client.components.schemas.HealthCheckResult.java +public class HealthCheckResult
+ +A class that contains necessary nested +- schema classes (which validate payloads), extends JsonSchema +- sealed interfaces which store validated payloads, java version of a sum type +- boxed classes which store validated payloads, sealed permits class implementations +- classes to store validated map payloads, extends FrozenMap +- classes to build inputs for map payloads + +## Nested Class Summary +| Modifier and Type | Class and Description | +| ----------------- | ---------------------- | +| sealed interface | [HealthCheckResult.HealthCheckResult1Boxed](#healthcheckresult1boxed)
sealed interface for validated payloads | +| record | [HealthCheckResult.HealthCheckResult1BoxedMap](#healthcheckresult1boxedmap)
boxed class to store validated Map payloads | +| static class | [HealthCheckResult.HealthCheckResult1](#healthcheckresult1)
schema class | +| static class | [HealthCheckResult.HealthCheckResultMapBuilder](#healthcheckresultmapbuilder)
builder for Map payloads | +| static class | [HealthCheckResult.HealthCheckResultMap](#healthcheckresultmap)
output class for Map payloads | +| sealed interface | [HealthCheckResult.NullableMessageBoxed](#nullablemessageboxed)
sealed interface for validated payloads | +| record | [HealthCheckResult.NullableMessageBoxedVoid](#nullablemessageboxedvoid)
boxed class to store validated null payloads | +| record | [HealthCheckResult.NullableMessageBoxedString](#nullablemessageboxedstring)
boxed class to store validated String payloads | +| static class | [HealthCheckResult.NullableMessage](#nullablemessage)
schema class | + +## HealthCheckResult1Boxed +public sealed interface HealthCheckResult1Boxed
+permits
+[HealthCheckResult1BoxedMap](#healthcheckresult1boxedmap) + +sealed interface that stores validated payloads using boxed classes + +## HealthCheckResult1BoxedMap +public record HealthCheckResult1BoxedMap
+implements [HealthCheckResult1Boxed](#healthcheckresult1boxed) + +record that stores validated Map payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| HealthCheckResult1BoxedMap([HealthCheckResultMap](#healthcheckresultmap) data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| [HealthCheckResultMap](#healthcheckresultmap) | data()
validated payload | +| @Nullable Object | getData()
validated payload | + +## HealthCheckResult1 +public static class HealthCheckResult1
+extends JsonSchema + +A schema class that validates payloads + +## Description +Just a string to inform instance is up and running. Make it nullable in hope to get it as pointer in generated model. + +### Code Sample +``` +import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags; +import org.openapijsonschematools.client.configurations.SchemaConfiguration; +import org.openapijsonschematools.client.exceptions.ValidationException; +import org.openapijsonschematools.client.schemas.validation.MapUtils; +import org.openapijsonschematools.client.schemas.validation.FrozenList; +import org.openapijsonschematools.client.schemas.validation.FrozenMap; +import org.openapijsonschematools.client.components.schemas.HealthCheckResult; + +import java.util.Arrays; +import java.util.List; +import java.util.AbstractMap; + +static final SchemaConfiguration configuration = new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().build()); + +// Map validation +HealthCheckResult.HealthCheckResultMap validatedPayload = + HealthCheckResult.HealthCheckResult1.validate( + new HealthCheckResult.HealthCheckResultMapBuilder() + .NullableMessage(null) + + .build(), + configuration +); +``` + +### Field Summary +| Modifier and Type | Field and Description | +| ----------------- | ---------------------- | +| Set> | type = Set.of(Map.class) | +| Map> | properties = Map.ofEntries(
    new PropertyEntry("NullableMessage", [NullableMessage.class](#nullablemessage)))
)
| + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| [HealthCheckResultMap](#healthcheckresultmap) | validate([Map<?, ?>](#healthcheckresultmapbuilder) arg, SchemaConfiguration configuration) | +| [HealthCheckResult1BoxedMap](#healthcheckresult1boxedmap) | validateAndBox([Map<?, ?>](#healthcheckresultmapbuilder) arg, SchemaConfiguration configuration) | +| [HealthCheckResult1Boxed](#healthcheckresult1boxed) | validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) | +| @Nullable Object | validate(@Nullable Object arg, SchemaConfiguration configuration) | + +## HealthCheckResultMapBuilder +public class HealthCheckResultMapBuilder
+builder for `Map` + +A class that builds the Map input type + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| HealthCheckResultMapBuilder()
Creates a builder that contains an empty map | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| Map | build()
Returns map input that should be used with Schema.validate | +| [HealthCheckResultMapBuilder](#healthcheckresultmapbuilder) | NullableMessage(Nothing? value) | +| [HealthCheckResultMapBuilder](#healthcheckresultmapbuilder) | NullableMessage(String value) | +| [HealthCheckResultMapBuilder](#healthcheckresultmapbuilder) | additionalProperty(String key, Nothing? value) | +| [HealthCheckResultMapBuilder](#healthcheckresultmapbuilder) | additionalProperty(String key, boolean value) | +| [HealthCheckResultMapBuilder](#healthcheckresultmapbuilder) | additionalProperty(String key, String value) | +| [HealthCheckResultMapBuilder](#healthcheckresultmapbuilder) | additionalProperty(String key, int value) | +| [HealthCheckResultMapBuilder](#healthcheckresultmapbuilder) | additionalProperty(String key, float value) | +| [HealthCheckResultMapBuilder](#healthcheckresultmapbuilder) | additionalProperty(String key, long value) | +| [HealthCheckResultMapBuilder](#healthcheckresultmapbuilder) | additionalProperty(String key, double value) | +| [HealthCheckResultMapBuilder](#healthcheckresultmapbuilder) | additionalProperty(String key, List value) | +| [HealthCheckResultMapBuilder](#healthcheckresultmapbuilder) | additionalProperty(String key, Map value) | + +## HealthCheckResultMap +public static class HealthCheckResultMap
+extends FrozenMap + +A class to store validated Map payloads + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| static [HealthCheckResultMap](#healthcheckresultmap) | of([Map](#healthcheckresultmapbuilder) arg, SchemaConfiguration configuration) | +| @Nullable String | NullableMessage()
[optional] | +| @Nullable Object | getAdditionalProperty(String name)
provides type safety for additional properties | + +## NullableMessageBoxed +public sealed interface NullableMessageBoxed
+permits
+[NullableMessageBoxedVoid](#nullablemessageboxedvoid), +[NullableMessageBoxedString](#nullablemessageboxedstring) + +sealed interface that stores validated payloads using boxed classes + +## NullableMessageBoxedVoid +public record NullableMessageBoxedVoid
+implements [NullableMessageBoxed](#nullablemessageboxed) + +record that stores validated null payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| NullableMessageBoxedVoid(Nothing? data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| Nothing? | data()
validated payload | +| @Nullable Object | getData()
validated payload | + +## NullableMessageBoxedString +public record NullableMessageBoxedString
+implements [NullableMessageBoxed](#nullablemessageboxed) + +record that stores validated String payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| NullableMessageBoxedString(String data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| String | data()
validated payload | +| @Nullable Object | getData()
validated payload | + +## NullableMessage +public static class NullableMessage
+extends JsonSchema + +A schema class that validates payloads + +### Code Sample +``` +import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags; +import org.openapijsonschematools.client.configurations.SchemaConfiguration; +import org.openapijsonschematools.client.exceptions.ValidationException; +import org.openapijsonschematools.client.schemas.validation.MapUtils; +import org.openapijsonschematools.client.schemas.validation.FrozenList; +import org.openapijsonschematools.client.schemas.validation.FrozenMap; +import org.openapijsonschematools.client.components.schemas.HealthCheckResult; + +import java.util.Arrays; +import java.util.List; +import java.util.AbstractMap; + +static final SchemaConfiguration configuration = new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().build()); + +// null validation +Nothing? validatedPayload = HealthCheckResult.NullableMessage.validate( + (Nothing?) null, + configuration +); + +// String validation +String validatedPayload = HealthCheckResult.NullableMessage.validate( + "a", + configuration +); +``` + +### Field Summary +| Modifier and Type | Field and Description | +| ----------------- | ---------------------- | +| Set> | type = Set.of(
    Nothing?.class,
    String.class
)
| + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| Nothing? | validate(Nothing? arg, SchemaConfiguration configuration) | +| [NullableMessageBoxedVoid](#nullablemessageboxedvoid) | validateAndBox(Nothing? arg, SchemaConfiguration configuration) | +| String | validate(String arg, SchemaConfiguration configuration) | +| [NullableMessageBoxedString](#nullablemessageboxedstring) | validateAndBox(String arg, SchemaConfiguration configuration) | +| [NullableMessageBoxed](#nullablemessageboxed) | validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) | +| @Nullable Object | validate(@Nullable Object arg, SchemaConfiguration configuration) | + +[[Back to top]](#top) [[Back to Component Schemas]](../../../README.md#Component-Schemas) [[Back to README]](../../../README.md) diff --git a/samples/client/petstore/kotlin/docs/components/schemas/IntegerEnum.md b/samples/client/petstore/kotlin/docs/components/schemas/IntegerEnum.md new file mode 100644 index 00000000000..56dd47dc072 --- /dev/null +++ b/samples/client/petstore/kotlin/docs/components/schemas/IntegerEnum.md @@ -0,0 +1,142 @@ +# IntegerEnum +org.openapijsonschematools.client.components.schemas.IntegerEnum.java +public class IntegerEnum
+ +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 +- enum classes + +## Nested Class Summary +| Modifier and Type | Class and Description | +| ----------------- | ---------------------- | +| sealed interface | [IntegerEnum.IntegerEnum1Boxed](#integerenum1boxed)
sealed interface for validated payloads | +| record | [IntegerEnum.IntegerEnum1BoxedNumber](#integerenum1boxednumber)
boxed class to store validated Number payloads | +| static class | [IntegerEnum.IntegerEnum1](#integerenum1)
schema class | +| enum | [IntegerEnum.IntegerIntegerEnumEnums](#integerintegerenumenums)
Integer enum | +| enum | [IntegerEnum.LongIntegerEnumEnums](#longintegerenumenums)
Long enum | +| enum | [IntegerEnum.FloatIntegerEnumEnums](#floatintegerenumenums)
Float enum | +| enum | [IntegerEnum.DoubleIntegerEnumEnums](#doubleintegerenumenums)
Double enum | + +## IntegerEnum1Boxed +public sealed interface IntegerEnum1Boxed
+permits
+[IntegerEnum1BoxedNumber](#integerenum1boxednumber) + +sealed interface that stores validated payloads using boxed classes + +## IntegerEnum1BoxedNumber +public record IntegerEnum1BoxedNumber
+implements [IntegerEnum1Boxed](#integerenum1boxed) + +record that stores validated Number payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| IntegerEnum1BoxedNumber(Number data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| Number | data()
validated payload | +| @Nullable Object | getData()
validated payload | + +## IntegerEnum1 +public static class IntegerEnum1
+extends JsonSchema + +A schema class that validates payloads + +### Code Sample +``` +import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags; +import org.openapijsonschematools.client.configurations.SchemaConfiguration; +import org.openapijsonschematools.client.exceptions.ValidationException; +import org.openapijsonschematools.client.schemas.validation.MapUtils; +import org.openapijsonschematools.client.schemas.validation.FrozenList; +import org.openapijsonschematools.client.schemas.validation.FrozenMap; +import org.openapijsonschematools.client.components.schemas.IntegerEnum; + +import java.util.Arrays; +import java.util.List; +import java.util.AbstractMap; + +static final SchemaConfiguration configuration = new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().build()); + +// int validation +int validatedPayload = IntegerEnum.IntegerEnum1.validate( + 1L, + configuration +); +``` + +### Field Summary +| Modifier and Type | Field and Description | +| ----------------- | ---------------------- | +| Set> | type = Set.of(
    Integer.class,
    Long.class,
    Float.class,
    Double.class
)
| +| String | type = "int"; | +| Set | enumValues = SetMaker.makeSet(
    0,
    1,
    2
)
| + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| long | validate(long arg, SchemaConfiguration configuration) | +| [IntegerEnum1BoxedNumber](#integerenum1boxednumber) | validateAndBox(Number arg, SchemaConfiguration configuration) | +| [IntegerEnum1Boxed](#integerenum1boxed) | validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) | +| @Nullable Object | validate(@Nullable Object arg, SchemaConfiguration configuration) | + +## IntegerIntegerEnumEnums +public enum IntegerIntegerEnumEnums
+extends `Enum` + +A class that stores Integer enum values + +### Enum Constant Summary +| Enum Constant | Description | +| ------------- | ----------- | +| POSITIVE_0 | value = 0 | +| POSITIVE_1 | value = 1 | +| POSITIVE_2 | value = 2 | + +## LongIntegerEnumEnums +public enum LongIntegerEnumEnums
+extends `Enum` + +A class that stores Long enum values + +### Enum Constant Summary +| Enum Constant | Description | +| ------------- | ----------- | +| POSITIVE_0 | value = 0L | +| POSITIVE_1 | value = 1L | +| POSITIVE_2 | value = 2L | + +## FloatIntegerEnumEnums +public enum FloatIntegerEnumEnums
+extends `Enum` + +A class that stores Float enum values + +### Enum Constant Summary +| Enum Constant | Description | +| ------------- | ----------- | +| POSITIVE_0 | value = 0.0f | +| POSITIVE_1 | value = 1.0f | +| POSITIVE_2 | value = 2.0f | + +## DoubleIntegerEnumEnums +public enum DoubleIntegerEnumEnums
+extends `Enum` + +A class that stores Double enum values + +### Enum Constant Summary +| Enum Constant | Description | +| ------------- | ----------- | +| POSITIVE_0 | value = 0.0d | +| POSITIVE_1 | value = 1.0d | +| POSITIVE_2 | value = 2.0d | + +[[Back to top]](#top) [[Back to Component Schemas]](../../../README.md#Component-Schemas) [[Back to README]](../../../README.md) diff --git a/samples/client/petstore/kotlin/docs/components/schemas/IntegerEnumBig.md b/samples/client/petstore/kotlin/docs/components/schemas/IntegerEnumBig.md new file mode 100644 index 00000000000..df5967575a1 --- /dev/null +++ b/samples/client/petstore/kotlin/docs/components/schemas/IntegerEnumBig.md @@ -0,0 +1,142 @@ +# IntegerEnumBig +org.openapijsonschematools.client.components.schemas.IntegerEnumBig.java +public class IntegerEnumBig
+ +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 +- enum classes + +## Nested Class Summary +| Modifier and Type | Class and Description | +| ----------------- | ---------------------- | +| sealed interface | [IntegerEnumBig.IntegerEnumBig1Boxed](#integerenumbig1boxed)
sealed interface for validated payloads | +| record | [IntegerEnumBig.IntegerEnumBig1BoxedNumber](#integerenumbig1boxednumber)
boxed class to store validated Number payloads | +| static class | [IntegerEnumBig.IntegerEnumBig1](#integerenumbig1)
schema class | +| enum | [IntegerEnumBig.IntegerIntegerEnumBigEnums](#integerintegerenumbigenums)
Integer enum | +| enum | [IntegerEnumBig.LongIntegerEnumBigEnums](#longintegerenumbigenums)
Long enum | +| enum | [IntegerEnumBig.FloatIntegerEnumBigEnums](#floatintegerenumbigenums)
Float enum | +| enum | [IntegerEnumBig.DoubleIntegerEnumBigEnums](#doubleintegerenumbigenums)
Double enum | + +## IntegerEnumBig1Boxed +public sealed interface IntegerEnumBig1Boxed
+permits
+[IntegerEnumBig1BoxedNumber](#integerenumbig1boxednumber) + +sealed interface that stores validated payloads using boxed classes + +## IntegerEnumBig1BoxedNumber +public record IntegerEnumBig1BoxedNumber
+implements [IntegerEnumBig1Boxed](#integerenumbig1boxed) + +record that stores validated Number payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| IntegerEnumBig1BoxedNumber(Number data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| Number | data()
validated payload | +| @Nullable Object | getData()
validated payload | + +## IntegerEnumBig1 +public static class IntegerEnumBig1
+extends JsonSchema + +A schema class that validates payloads + +### Code Sample +``` +import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags; +import org.openapijsonschematools.client.configurations.SchemaConfiguration; +import org.openapijsonschematools.client.exceptions.ValidationException; +import org.openapijsonschematools.client.schemas.validation.MapUtils; +import org.openapijsonschematools.client.schemas.validation.FrozenList; +import org.openapijsonschematools.client.schemas.validation.FrozenMap; +import org.openapijsonschematools.client.components.schemas.IntegerEnumBig; + +import java.util.Arrays; +import java.util.List; +import java.util.AbstractMap; + +static final SchemaConfiguration configuration = new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().build()); + +// int validation +int validatedPayload = IntegerEnumBig.IntegerEnumBig1.validate( + 1L, + configuration +); +``` + +### Field Summary +| Modifier and Type | Field and Description | +| ----------------- | ---------------------- | +| Set> | type = Set.of(
    Integer.class,
    Long.class,
    Float.class,
    Double.class
)
| +| String | type = "int"; | +| Set | enumValues = SetMaker.makeSet(
    10,
    11,
    12
)
| + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| long | validate(long arg, SchemaConfiguration configuration) | +| [IntegerEnumBig1BoxedNumber](#integerenumbig1boxednumber) | validateAndBox(Number arg, SchemaConfiguration configuration) | +| [IntegerEnumBig1Boxed](#integerenumbig1boxed) | validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) | +| @Nullable Object | validate(@Nullable Object arg, SchemaConfiguration configuration) | + +## IntegerIntegerEnumBigEnums +public enum IntegerIntegerEnumBigEnums
+extends `Enum` + +A class that stores Integer enum values + +### Enum Constant Summary +| Enum Constant | Description | +| ------------- | ----------- | +| POSITIVE_10 | value = 10 | +| POSITIVE_11 | value = 11 | +| POSITIVE_12 | value = 12 | + +## LongIntegerEnumBigEnums +public enum LongIntegerEnumBigEnums
+extends `Enum` + +A class that stores Long enum values + +### Enum Constant Summary +| Enum Constant | Description | +| ------------- | ----------- | +| POSITIVE_10 | value = 10L | +| POSITIVE_11 | value = 11L | +| POSITIVE_12 | value = 12L | + +## FloatIntegerEnumBigEnums +public enum FloatIntegerEnumBigEnums
+extends `Enum` + +A class that stores Float enum values + +### Enum Constant Summary +| Enum Constant | Description | +| ------------- | ----------- | +| POSITIVE_10 | value = 10.0f | +| POSITIVE_11 | value = 11.0f | +| POSITIVE_12 | value = 12.0f | + +## DoubleIntegerEnumBigEnums +public enum DoubleIntegerEnumBigEnums
+extends `Enum` + +A class that stores Double enum values + +### Enum Constant Summary +| Enum Constant | Description | +| ------------- | ----------- | +| POSITIVE_10 | value = 10.0d | +| POSITIVE_11 | value = 11.0d | +| POSITIVE_12 | value = 12.0d | + +[[Back to top]](#top) [[Back to Component Schemas]](../../../README.md#Component-Schemas) [[Back to README]](../../../README.md) diff --git a/samples/client/petstore/kotlin/docs/components/schemas/IntegerEnumOneValue.md b/samples/client/petstore/kotlin/docs/components/schemas/IntegerEnumOneValue.md new file mode 100644 index 00000000000..76e57df77d2 --- /dev/null +++ b/samples/client/petstore/kotlin/docs/components/schemas/IntegerEnumOneValue.md @@ -0,0 +1,134 @@ +# IntegerEnumOneValue +org.openapijsonschematools.client.components.schemas.IntegerEnumOneValue.java +public class IntegerEnumOneValue
+ +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 +- enum classes + +## Nested Class Summary +| Modifier and Type | Class and Description | +| ----------------- | ---------------------- | +| sealed interface | [IntegerEnumOneValue.IntegerEnumOneValue1Boxed](#integerenumonevalue1boxed)
sealed interface for validated payloads | +| record | [IntegerEnumOneValue.IntegerEnumOneValue1BoxedNumber](#integerenumonevalue1boxednumber)
boxed class to store validated Number payloads | +| static class | [IntegerEnumOneValue.IntegerEnumOneValue1](#integerenumonevalue1)
schema class | +| enum | [IntegerEnumOneValue.IntegerIntegerEnumOneValueEnums](#integerintegerenumonevalueenums)
Integer enum | +| enum | [IntegerEnumOneValue.LongIntegerEnumOneValueEnums](#longintegerenumonevalueenums)
Long enum | +| enum | [IntegerEnumOneValue.FloatIntegerEnumOneValueEnums](#floatintegerenumonevalueenums)
Float enum | +| enum | [IntegerEnumOneValue.DoubleIntegerEnumOneValueEnums](#doubleintegerenumonevalueenums)
Double enum | + +## IntegerEnumOneValue1Boxed +public sealed interface IntegerEnumOneValue1Boxed
+permits
+[IntegerEnumOneValue1BoxedNumber](#integerenumonevalue1boxednumber) + +sealed interface that stores validated payloads using boxed classes + +## IntegerEnumOneValue1BoxedNumber +public record IntegerEnumOneValue1BoxedNumber
+implements [IntegerEnumOneValue1Boxed](#integerenumonevalue1boxed) + +record that stores validated Number payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| IntegerEnumOneValue1BoxedNumber(Number data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| Number | data()
validated payload | +| @Nullable Object | getData()
validated payload | + +## IntegerEnumOneValue1 +public static class IntegerEnumOneValue1
+extends JsonSchema + +A schema class that validates payloads + +### Code Sample +``` +import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags; +import org.openapijsonschematools.client.configurations.SchemaConfiguration; +import org.openapijsonschematools.client.exceptions.ValidationException; +import org.openapijsonschematools.client.schemas.validation.MapUtils; +import org.openapijsonschematools.client.schemas.validation.FrozenList; +import org.openapijsonschematools.client.schemas.validation.FrozenMap; +import org.openapijsonschematools.client.components.schemas.IntegerEnumOneValue; + +import java.util.Arrays; +import java.util.List; +import java.util.AbstractMap; + +static final SchemaConfiguration configuration = new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().build()); + +// int validation +int validatedPayload = IntegerEnumOneValue.IntegerEnumOneValue1.validate( + 1L, + configuration +); +``` + +### Field Summary +| Modifier and Type | Field and Description | +| ----------------- | ---------------------- | +| Set> | type = Set.of(
    Integer.class,
    Long.class,
    Float.class,
    Double.class
)
| +| String | type = "int"; | +| Set | enumValues = SetMaker.makeSet(
    0
)
| + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| long | validate(long arg, SchemaConfiguration configuration) | +| [IntegerEnumOneValue1BoxedNumber](#integerenumonevalue1boxednumber) | validateAndBox(Number arg, SchemaConfiguration configuration) | +| [IntegerEnumOneValue1Boxed](#integerenumonevalue1boxed) | validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) | +| @Nullable Object | validate(@Nullable Object arg, SchemaConfiguration configuration) | + +## IntegerIntegerEnumOneValueEnums +public enum IntegerIntegerEnumOneValueEnums
+extends `Enum` + +A class that stores Integer enum values + +### Enum Constant Summary +| Enum Constant | Description | +| ------------- | ----------- | +| POSITIVE_0 | value = 0 | + +## LongIntegerEnumOneValueEnums +public enum LongIntegerEnumOneValueEnums
+extends `Enum` + +A class that stores Long enum values + +### Enum Constant Summary +| Enum Constant | Description | +| ------------- | ----------- | +| POSITIVE_0 | value = 0L | + +## FloatIntegerEnumOneValueEnums +public enum FloatIntegerEnumOneValueEnums
+extends `Enum` + +A class that stores Float enum values + +### Enum Constant Summary +| Enum Constant | Description | +| ------------- | ----------- | +| POSITIVE_0 | value = 0.0f | + +## DoubleIntegerEnumOneValueEnums +public enum DoubleIntegerEnumOneValueEnums
+extends `Enum` + +A class that stores Double enum values + +### Enum Constant Summary +| Enum Constant | Description | +| ------------- | ----------- | +| POSITIVE_0 | value = 0.0d | + +[[Back to top]](#top) [[Back to Component Schemas]](../../../README.md#Component-Schemas) [[Back to README]](../../../README.md) diff --git a/samples/client/petstore/kotlin/docs/components/schemas/IntegerEnumWithDefaultValue.md b/samples/client/petstore/kotlin/docs/components/schemas/IntegerEnumWithDefaultValue.md new file mode 100644 index 00000000000..d45ff7f8046 --- /dev/null +++ b/samples/client/petstore/kotlin/docs/components/schemas/IntegerEnumWithDefaultValue.md @@ -0,0 +1,143 @@ +# IntegerEnumWithDefaultValue +org.openapijsonschematools.client.components.schemas.IntegerEnumWithDefaultValue.java +public class IntegerEnumWithDefaultValue
+ +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 +- enum classes + +## Nested Class Summary +| Modifier and Type | Class and Description | +| ----------------- | ---------------------- | +| sealed interface | [IntegerEnumWithDefaultValue.IntegerEnumWithDefaultValue1Boxed](#integerenumwithdefaultvalue1boxed)
sealed interface for validated payloads | +| record | [IntegerEnumWithDefaultValue.IntegerEnumWithDefaultValue1BoxedNumber](#integerenumwithdefaultvalue1boxednumber)
boxed class to store validated Number payloads | +| static class | [IntegerEnumWithDefaultValue.IntegerEnumWithDefaultValue1](#integerenumwithdefaultvalue1)
schema class | +| enum | [IntegerEnumWithDefaultValue.IntegerIntegerEnumWithDefaultValueEnums](#integerintegerenumwithdefaultvalueenums)
Integer enum | +| enum | [IntegerEnumWithDefaultValue.LongIntegerEnumWithDefaultValueEnums](#longintegerenumwithdefaultvalueenums)
Long enum | +| enum | [IntegerEnumWithDefaultValue.FloatIntegerEnumWithDefaultValueEnums](#floatintegerenumwithdefaultvalueenums)
Float enum | +| enum | [IntegerEnumWithDefaultValue.DoubleIntegerEnumWithDefaultValueEnums](#doubleintegerenumwithdefaultvalueenums)
Double enum | + +## IntegerEnumWithDefaultValue1Boxed +public sealed interface IntegerEnumWithDefaultValue1Boxed
+permits
+[IntegerEnumWithDefaultValue1BoxedNumber](#integerenumwithdefaultvalue1boxednumber) + +sealed interface that stores validated payloads using boxed classes + +## IntegerEnumWithDefaultValue1BoxedNumber +public record IntegerEnumWithDefaultValue1BoxedNumber
+implements [IntegerEnumWithDefaultValue1Boxed](#integerenumwithdefaultvalue1boxed) + +record that stores validated Number payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| IntegerEnumWithDefaultValue1BoxedNumber(Number data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| Number | data()
validated payload | +| @Nullable Object | getData()
validated payload | + +## IntegerEnumWithDefaultValue1 +public static class IntegerEnumWithDefaultValue1
+extends JsonSchema + +A schema class that validates payloads + +### Code Sample +``` +import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags; +import org.openapijsonschematools.client.configurations.SchemaConfiguration; +import org.openapijsonschematools.client.exceptions.ValidationException; +import org.openapijsonschematools.client.schemas.validation.MapUtils; +import org.openapijsonschematools.client.schemas.validation.FrozenList; +import org.openapijsonschematools.client.schemas.validation.FrozenMap; +import org.openapijsonschematools.client.components.schemas.IntegerEnumWithDefaultValue; + +import java.util.Arrays; +import java.util.List; +import java.util.AbstractMap; + +static final SchemaConfiguration configuration = new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().build()); + +// int validation +int validatedPayload = IntegerEnumWithDefaultValue.IntegerEnumWithDefaultValue1.validate( + 1L, + configuration +); +``` + +### Field Summary +| Modifier and Type | Field and Description | +| ----------------- | ---------------------- | +| Set> | type = Set.of(
    Integer.class,
    Long.class,
    Float.class,
    Double.class
)
| +| String | type = "int"; | +| Set | enumValues = SetMaker.makeSet(
    0,
    1,
    2
)
| +| @Nullable Object | defaultValue = 0 | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| long | validate(long arg, SchemaConfiguration configuration) | +| [IntegerEnumWithDefaultValue1BoxedNumber](#integerenumwithdefaultvalue1boxednumber) | validateAndBox(Number arg, SchemaConfiguration configuration) | +| [IntegerEnumWithDefaultValue1Boxed](#integerenumwithdefaultvalue1boxed) | validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) | +| @Nullable Object | validate(@Nullable Object arg, SchemaConfiguration configuration) | + +## IntegerIntegerEnumWithDefaultValueEnums +public enum IntegerIntegerEnumWithDefaultValueEnums
+extends `Enum` + +A class that stores Integer enum values + +### Enum Constant Summary +| Enum Constant | Description | +| ------------- | ----------- | +| POSITIVE_0 | value = 0 | +| POSITIVE_1 | value = 1 | +| POSITIVE_2 | value = 2 | + +## LongIntegerEnumWithDefaultValueEnums +public enum LongIntegerEnumWithDefaultValueEnums
+extends `Enum` + +A class that stores Long enum values + +### Enum Constant Summary +| Enum Constant | Description | +| ------------- | ----------- | +| POSITIVE_0 | value = 0L | +| POSITIVE_1 | value = 1L | +| POSITIVE_2 | value = 2L | + +## FloatIntegerEnumWithDefaultValueEnums +public enum FloatIntegerEnumWithDefaultValueEnums
+extends `Enum` + +A class that stores Float enum values + +### Enum Constant Summary +| Enum Constant | Description | +| ------------- | ----------- | +| POSITIVE_0 | value = 0.0f | +| POSITIVE_1 | value = 1.0f | +| POSITIVE_2 | value = 2.0f | + +## DoubleIntegerEnumWithDefaultValueEnums +public enum DoubleIntegerEnumWithDefaultValueEnums
+extends `Enum` + +A class that stores Double enum values + +### Enum Constant Summary +| Enum Constant | Description | +| ------------- | ----------- | +| POSITIVE_0 | value = 0.0d | +| POSITIVE_1 | value = 1.0d | +| POSITIVE_2 | value = 2.0d | + +[[Back to top]](#top) [[Back to Component Schemas]](../../../README.md#Component-Schemas) [[Back to README]](../../../README.md) diff --git a/samples/client/petstore/kotlin/docs/components/schemas/IntegerMax10.md b/samples/client/petstore/kotlin/docs/components/schemas/IntegerMax10.md new file mode 100644 index 00000000000..dcaf721386d --- /dev/null +++ b/samples/client/petstore/kotlin/docs/components/schemas/IntegerMax10.md @@ -0,0 +1,85 @@ +# IntegerMax10 +org.openapijsonschematools.client.components.schemas.IntegerMax10.java +public class IntegerMax10
+ +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 + +## Nested Class Summary +| Modifier and Type | Class and Description | +| ----------------- | ---------------------- | +| sealed interface | [IntegerMax10.IntegerMax101Boxed](#integermax101boxed)
sealed interface for validated payloads | +| record | [IntegerMax10.IntegerMax101BoxedNumber](#integermax101boxednumber)
boxed class to store validated Number payloads | +| static class | [IntegerMax10.IntegerMax101](#integermax101)
schema class | + +## IntegerMax101Boxed +public sealed interface IntegerMax101Boxed
+permits
+[IntegerMax101BoxedNumber](#integermax101boxednumber) + +sealed interface that stores validated payloads using boxed classes + +## IntegerMax101BoxedNumber +public record IntegerMax101BoxedNumber
+implements [IntegerMax101Boxed](#integermax101boxed) + +record that stores validated Number payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| IntegerMax101BoxedNumber(Number data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| Number | data()
validated payload | +| @Nullable Object | getData()
validated payload | + +## IntegerMax101 +public static class IntegerMax101
+extends JsonSchema + +A schema class that validates payloads + +### Code Sample +``` +import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags; +import org.openapijsonschematools.client.configurations.SchemaConfiguration; +import org.openapijsonschematools.client.exceptions.ValidationException; +import org.openapijsonschematools.client.schemas.validation.MapUtils; +import org.openapijsonschematools.client.schemas.validation.FrozenList; +import org.openapijsonschematools.client.schemas.validation.FrozenMap; +import org.openapijsonschematools.client.components.schemas.IntegerMax10; + +import java.util.Arrays; +import java.util.List; +import java.util.AbstractMap; + +static final SchemaConfiguration configuration = new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().build()); + +// long validation +long validatedPayload = IntegerMax10.IntegerMax101.validate( + 1L, + configuration +); +``` + +### Field Summary +| Modifier and Type | Field and Description | +| ----------------- | ---------------------- | +| Set> | type = Set.of(
    Integer.class,
    Long.class,
    Float.class,
    Double.class
)
| +| String | type = "int64"; | +| Number | maximum = 10 | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| long | validate(long arg, SchemaConfiguration configuration) | +| [IntegerMax101BoxedNumber](#integermax101boxednumber) | validateAndBox(Number arg, SchemaConfiguration configuration) | +| [IntegerMax101Boxed](#integermax101boxed) | validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) | +| @Nullable Object | validate(@Nullable Object arg, SchemaConfiguration configuration) | + +[[Back to top]](#top) [[Back to Component Schemas]](../../../README.md#Component-Schemas) [[Back to README]](../../../README.md) diff --git a/samples/client/petstore/kotlin/docs/components/schemas/IntegerMin15.md b/samples/client/petstore/kotlin/docs/components/schemas/IntegerMin15.md new file mode 100644 index 00000000000..b4b1192132c --- /dev/null +++ b/samples/client/petstore/kotlin/docs/components/schemas/IntegerMin15.md @@ -0,0 +1,85 @@ +# IntegerMin15 +org.openapijsonschematools.client.components.schemas.IntegerMin15.java +public class IntegerMin15
+ +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 + +## Nested Class Summary +| Modifier and Type | Class and Description | +| ----------------- | ---------------------- | +| sealed interface | [IntegerMin15.IntegerMin151Boxed](#integermin151boxed)
sealed interface for validated payloads | +| record | [IntegerMin15.IntegerMin151BoxedNumber](#integermin151boxednumber)
boxed class to store validated Number payloads | +| static class | [IntegerMin15.IntegerMin151](#integermin151)
schema class | + +## IntegerMin151Boxed +public sealed interface IntegerMin151Boxed
+permits
+[IntegerMin151BoxedNumber](#integermin151boxednumber) + +sealed interface that stores validated payloads using boxed classes + +## IntegerMin151BoxedNumber +public record IntegerMin151BoxedNumber
+implements [IntegerMin151Boxed](#integermin151boxed) + +record that stores validated Number payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| IntegerMin151BoxedNumber(Number data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| Number | data()
validated payload | +| @Nullable Object | getData()
validated payload | + +## IntegerMin151 +public static class IntegerMin151
+extends JsonSchema + +A schema class that validates payloads + +### Code Sample +``` +import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags; +import org.openapijsonschematools.client.configurations.SchemaConfiguration; +import org.openapijsonschematools.client.exceptions.ValidationException; +import org.openapijsonschematools.client.schemas.validation.MapUtils; +import org.openapijsonschematools.client.schemas.validation.FrozenList; +import org.openapijsonschematools.client.schemas.validation.FrozenMap; +import org.openapijsonschematools.client.components.schemas.IntegerMin15; + +import java.util.Arrays; +import java.util.List; +import java.util.AbstractMap; + +static final SchemaConfiguration configuration = new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().build()); + +// long validation +long validatedPayload = IntegerMin15.IntegerMin151.validate( + 1L, + configuration +); +``` + +### Field Summary +| Modifier and Type | Field and Description | +| ----------------- | ---------------------- | +| Set> | type = Set.of(
    Integer.class,
    Long.class,
    Float.class,
    Double.class
)
| +| String | type = "int64"; | +| Number | minimum = 15 | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| long | validate(long arg, SchemaConfiguration configuration) | +| [IntegerMin151BoxedNumber](#integermin151boxednumber) | validateAndBox(Number arg, SchemaConfiguration configuration) | +| [IntegerMin151Boxed](#integermin151boxed) | validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) | +| @Nullable Object | validate(@Nullable Object arg, SchemaConfiguration configuration) | + +[[Back to top]](#top) [[Back to Component Schemas]](../../../README.md#Component-Schemas) [[Back to README]](../../../README.md) diff --git a/samples/client/petstore/kotlin/docs/components/schemas/IsoscelesTriangle.md b/samples/client/petstore/kotlin/docs/components/schemas/IsoscelesTriangle.md new file mode 100644 index 00000000000..e421e54de1b --- /dev/null +++ b/samples/client/petstore/kotlin/docs/components/schemas/IsoscelesTriangle.md @@ -0,0 +1,371 @@ +# IsoscelesTriangle +org.openapijsonschematools.client.components.schemas.IsoscelesTriangle.java +public class IsoscelesTriangle
+ +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 | [IsoscelesTriangle.IsoscelesTriangle1Boxed](#isoscelestriangle1boxed)
sealed interface for validated payloads | +| record | [IsoscelesTriangle.IsoscelesTriangle1BoxedVoid](#isoscelestriangle1boxedvoid)
boxed class to store validated null payloads | +| record | [IsoscelesTriangle.IsoscelesTriangle1BoxedBoolean](#isoscelestriangle1boxedboolean)
boxed class to store validated boolean payloads | +| record | [IsoscelesTriangle.IsoscelesTriangle1BoxedNumber](#isoscelestriangle1boxednumber)
boxed class to store validated Number payloads | +| record | [IsoscelesTriangle.IsoscelesTriangle1BoxedString](#isoscelestriangle1boxedstring)
boxed class to store validated String payloads | +| record | [IsoscelesTriangle.IsoscelesTriangle1BoxedList](#isoscelestriangle1boxedlist)
boxed class to store validated List payloads | +| record | [IsoscelesTriangle.IsoscelesTriangle1BoxedMap](#isoscelestriangle1boxedmap)
boxed class to store validated Map payloads | +| static class | [IsoscelesTriangle.IsoscelesTriangle1](#isoscelestriangle1)
schema class | +| sealed interface | [IsoscelesTriangle.Schema1Boxed](#schema1boxed)
sealed interface for validated payloads | +| record | [IsoscelesTriangle.Schema1BoxedMap](#schema1boxedmap)
boxed class to store validated Map payloads | +| static class | [IsoscelesTriangle.Schema1](#schema1)
schema class | +| static class | [IsoscelesTriangle.Schema1MapBuilder](#schema1mapbuilder)
builder for Map payloads | +| static class | [IsoscelesTriangle.Schema1Map](#schema1map)
output class for Map payloads | +| sealed interface | [IsoscelesTriangle.TriangleTypeBoxed](#triangletypeboxed)
sealed interface for validated payloads | +| record | [IsoscelesTriangle.TriangleTypeBoxedString](#triangletypeboxedstring)
boxed class to store validated String payloads | +| static class | [IsoscelesTriangle.TriangleType](#triangletype)
schema class | +| enum | [IsoscelesTriangle.StringTriangleTypeEnums](#stringtriangletypeenums)
String enum | + +## IsoscelesTriangle1Boxed +public sealed interface IsoscelesTriangle1Boxed
+permits
+[IsoscelesTriangle1BoxedVoid](#isoscelestriangle1boxedvoid), +[IsoscelesTriangle1BoxedBoolean](#isoscelestriangle1boxedboolean), +[IsoscelesTriangle1BoxedNumber](#isoscelestriangle1boxednumber), +[IsoscelesTriangle1BoxedString](#isoscelestriangle1boxedstring), +[IsoscelesTriangle1BoxedList](#isoscelestriangle1boxedlist), +[IsoscelesTriangle1BoxedMap](#isoscelestriangle1boxedmap) + +sealed interface that stores validated payloads using boxed classes + +## IsoscelesTriangle1BoxedVoid +public record IsoscelesTriangle1BoxedVoid
+implements [IsoscelesTriangle1Boxed](#isoscelestriangle1boxed) + +record that stores validated null payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| IsoscelesTriangle1BoxedVoid(Nothing? data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| Nothing? | data()
validated payload | +| @Nullable Object | getData()
validated payload | + +## IsoscelesTriangle1BoxedBoolean +public record IsoscelesTriangle1BoxedBoolean
+implements [IsoscelesTriangle1Boxed](#isoscelestriangle1boxed) + +record that stores validated boolean payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| IsoscelesTriangle1BoxedBoolean(boolean data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| boolean | data()
validated payload | +| @Nullable Object | getData()
validated payload | + +## IsoscelesTriangle1BoxedNumber +public record IsoscelesTriangle1BoxedNumber
+implements [IsoscelesTriangle1Boxed](#isoscelestriangle1boxed) + +record that stores validated Number payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| IsoscelesTriangle1BoxedNumber(Number data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| Number | data()
validated payload | +| @Nullable Object | getData()
validated payload | + +## IsoscelesTriangle1BoxedString +public record IsoscelesTriangle1BoxedString
+implements [IsoscelesTriangle1Boxed](#isoscelestriangle1boxed) + +record that stores validated String payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| IsoscelesTriangle1BoxedString(String data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| String | data()
validated payload | +| @Nullable Object | getData()
validated payload | + +## IsoscelesTriangle1BoxedList +public record IsoscelesTriangle1BoxedList
+implements [IsoscelesTriangle1Boxed](#isoscelestriangle1boxed) + +record that stores validated List payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| IsoscelesTriangle1BoxedList(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 | + +## IsoscelesTriangle1BoxedMap +public record IsoscelesTriangle1BoxedMap
+implements [IsoscelesTriangle1Boxed](#isoscelestriangle1boxed) + +record that stores validated Map payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| IsoscelesTriangle1BoxedMap(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 | + +## IsoscelesTriangle1 +public static class IsoscelesTriangle1
+extends JsonSchema + +A schema class that validates payloads + +### Field Summary +| Modifier and Type | Field and Description | +| ----------------- | ---------------------- | +| List> | allOf = List.of(
    [TriangleInterface.TriangleInterface1.class](../../components/schemas/TriangleInterface.md#triangleinterface1),
    [Schema1.class](#schema1)
;)
| + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| String | validate(String arg, SchemaConfiguration configuration) | +| Nothing? | validate(Nothing? arg, SchemaConfiguration configuration) | +| int | validate(int arg, SchemaConfiguration configuration) | +| long | validate(long arg, SchemaConfiguration configuration) | +| float | validate(float arg, SchemaConfiguration configuration) | +| double | validate(double arg, SchemaConfiguration configuration) | +| Number | validate(Number arg, SchemaConfiguration configuration) | +| boolean | validate(boolean arg, SchemaConfiguration configuration) | +| FrozenMap<@Nullable Object> | validate(Map<?, ?> arg, SchemaConfiguration configuration) | +| FrozenList<@Nullable Object> | validate(List arg, SchemaConfiguration configuration) | +| [IsoscelesTriangle1BoxedString](#isoscelestriangle1boxedstring) | validateAndBox(String arg, SchemaConfiguration configuration) | +| [IsoscelesTriangle1BoxedVoid](#isoscelestriangle1boxedvoid) | validateAndBox(Nothing? arg, SchemaConfiguration configuration) | +| [IsoscelesTriangle1BoxedNumber](#isoscelestriangle1boxednumber) | validateAndBox(Number arg, SchemaConfiguration configuration) | +| [IsoscelesTriangle1BoxedBoolean](#isoscelestriangle1boxedboolean) | validateAndBox(boolean arg, SchemaConfiguration configuration) | +| [IsoscelesTriangle1BoxedMap](#isoscelestriangle1boxedmap) | validateAndBox(Map<?, ?> arg, SchemaConfiguration configuration) | +| [IsoscelesTriangle1BoxedList](#isoscelestriangle1boxedlist) | validateAndBox(List arg, SchemaConfiguration configuration) | +| [IsoscelesTriangle1Boxed](#isoscelestriangle1boxed) | validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) | +| @Nullable Object | validate(@Nullable Object arg, SchemaConfiguration configuration) | + +## Schema1Boxed +public sealed interface Schema1Boxed
+permits
+[Schema1BoxedMap](#schema1boxedmap) + +sealed interface that stores validated payloads using boxed classes + +## Schema1BoxedMap +public record Schema1BoxedMap
+implements [Schema1Boxed](#schema1boxed) + +record that stores validated Map payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| Schema1BoxedMap([Schema1Map](#schema1map) data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| [Schema1Map](#schema1map) | data()
validated payload | +| @Nullable Object | getData()
validated payload | + +## Schema1 +public static class Schema1
+extends JsonSchema + +A schema class that validates payloads + +### Code Sample +``` +import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags; +import org.openapijsonschematools.client.configurations.SchemaConfiguration; +import org.openapijsonschematools.client.exceptions.ValidationException; +import org.openapijsonschematools.client.schemas.validation.MapUtils; +import org.openapijsonschematools.client.schemas.validation.FrozenList; +import org.openapijsonschematools.client.schemas.validation.FrozenMap; +import org.openapijsonschematools.client.components.schemas.IsoscelesTriangle; + +import java.util.Arrays; +import java.util.List; +import java.util.AbstractMap; + +static final SchemaConfiguration configuration = new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().build()); + +// Map validation +IsoscelesTriangle.Schema1Map validatedPayload = + IsoscelesTriangle.Schema1.validate( + new IsoscelesTriangle.Schema1MapBuilder() + .triangleType("IsoscelesTriangle") + + .build(), + configuration +); +``` + +### Field Summary +| Modifier and Type | Field and Description | +| ----------------- | ---------------------- | +| Set> | type = Set.of(Map.class) | +| Map> | properties = Map.ofEntries(
    new PropertyEntry("triangleType", [TriangleType.class](#triangletype)))
)
| + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| [Schema1Map](#schema1map) | validate([Map<?, ?>](#schema1mapbuilder) arg, SchemaConfiguration configuration) | +| [Schema1BoxedMap](#schema1boxedmap) | validateAndBox([Map<?, ?>](#schema1mapbuilder) arg, SchemaConfiguration configuration) | +| [Schema1Boxed](#schema1boxed) | validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) | +| @Nullable Object | validate(@Nullable Object arg, SchemaConfiguration configuration) | + +## Schema1MapBuilder +public class Schema1MapBuilder
+builder for `Map` + +A class that builds the Map input type + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| Schema1MapBuilder()
Creates a builder that contains an empty map | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| Map | build()
Returns map input that should be used with Schema.validate | +| [Schema1MapBuilder](#schema1mapbuilder) | triangleType(String value) | +| [Schema1MapBuilder](#schema1mapbuilder) | triangleType([StringTriangleTypeEnums](#stringtriangletypeenums) value) | +| [Schema1MapBuilder](#schema1mapbuilder) | additionalProperty(String key, Nothing? value) | +| [Schema1MapBuilder](#schema1mapbuilder) | additionalProperty(String key, boolean value) | +| [Schema1MapBuilder](#schema1mapbuilder) | additionalProperty(String key, String value) | +| [Schema1MapBuilder](#schema1mapbuilder) | additionalProperty(String key, int value) | +| [Schema1MapBuilder](#schema1mapbuilder) | additionalProperty(String key, float value) | +| [Schema1MapBuilder](#schema1mapbuilder) | additionalProperty(String key, long value) | +| [Schema1MapBuilder](#schema1mapbuilder) | additionalProperty(String key, double value) | +| [Schema1MapBuilder](#schema1mapbuilder) | additionalProperty(String key, List value) | +| [Schema1MapBuilder](#schema1mapbuilder) | additionalProperty(String key, Map value) | + +## Schema1Map +public static class Schema1Map
+extends FrozenMap + +A class to store validated Map payloads + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| static [Schema1Map](#schema1map) | of([Map](#schema1mapbuilder) arg, SchemaConfiguration configuration) | +| String | triangleType()
[optional] must be one of ["IsoscelesTriangle"] | +| @Nullable Object | getAdditionalProperty(String name)
provides type safety for additional properties | + +## TriangleTypeBoxed +public sealed interface TriangleTypeBoxed
+permits
+[TriangleTypeBoxedString](#triangletypeboxedstring) + +sealed interface that stores validated payloads using boxed classes + +## TriangleTypeBoxedString +public record TriangleTypeBoxedString
+implements [TriangleTypeBoxed](#triangletypeboxed) + +record that stores validated String payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| TriangleTypeBoxedString(String data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| String | data()
validated payload | +| @Nullable Object | getData()
validated payload | + +## TriangleType +public static class TriangleType
+extends JsonSchema + +A schema class that validates payloads + +### Code Sample +``` +import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags; +import org.openapijsonschematools.client.configurations.SchemaConfiguration; +import org.openapijsonschematools.client.exceptions.ValidationException; +import org.openapijsonschematools.client.schemas.validation.MapUtils; +import org.openapijsonschematools.client.schemas.validation.FrozenList; +import org.openapijsonschematools.client.schemas.validation.FrozenMap; +import org.openapijsonschematools.client.components.schemas.IsoscelesTriangle; + +import java.util.Arrays; +import java.util.List; +import java.util.AbstractMap; + +static final SchemaConfiguration configuration = new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().build()); + +// String validation +String validatedPayload = IsoscelesTriangle.TriangleType.validate( + "IsoscelesTriangle", + configuration +); +``` + +### Field Summary +| Modifier and Type | Field and Description | +| ----------------- | ---------------------- | +| Set> | type = Set.of(
    String.class
)
| +| Set | enumValues = SetMaker.makeSet(
    "IsoscelesTriangle"
)
| + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| String | validate(String arg, SchemaConfiguration configuration) | +| String | validate([StringTriangleTypeEnums](#stringtriangletypeenums) arg, SchemaConfiguration configuration) | +| [TriangleTypeBoxedString](#triangletypeboxedstring) | validateAndBox(String arg, SchemaConfiguration configuration) | +| [TriangleTypeBoxed](#triangletypeboxed) | validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) | +| @Nullable Object | validate(@Nullable Object arg, SchemaConfiguration configuration) | + +## StringTriangleTypeEnums +public enum StringTriangleTypeEnums
+extends `Enum` + +A class that stores String enum values + +### Enum Constant Summary +| Enum Constant | Description | +| ------------- | ----------- | +| ISOSCELES_TRIANGLE | value = "IsoscelesTriangle" | + +[[Back to top]](#top) [[Back to Component Schemas]](../../../README.md#Component-Schemas) [[Back to README]](../../../README.md) diff --git a/samples/client/petstore/kotlin/docs/components/schemas/Items.md b/samples/client/petstore/kotlin/docs/components/schemas/Items.md new file mode 100644 index 00000000000..ef9402f5f91 --- /dev/null +++ b/samples/client/petstore/kotlin/docs/components/schemas/Items.md @@ -0,0 +1,160 @@ +# Items +org.openapijsonschematools.client.components.schemas.Items.java +public class Items
+ +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 list payloads, extends FrozenList +- classes to build inputs for list payloads + +## Nested Class Summary +| Modifier and Type | Class and Description | +| ----------------- | ---------------------- | +| sealed interface | [Items.Items1Boxed](#items1boxed)
sealed interface for validated payloads | +| record | [Items.Items1BoxedList](#items1boxedlist)
boxed class to store validated List payloads | +| static class | [Items.Items1](#items1)
schema class | +| static class | [Items.ItemsListBuilder](#itemslistbuilder)
builder for List payloads | +| static class | [Items.ItemsList](#itemslist)
output class for List payloads | +| sealed interface | [Items.Items2Boxed](#items2boxed)
sealed interface for validated payloads | +| record | [Items.Items2BoxedMap](#items2boxedmap)
boxed class to store validated Map payloads | +| static class | [Items.Items2](#items2)
schema class | + +## Items1Boxed +public sealed interface Items1Boxed
+permits
+[Items1BoxedList](#items1boxedlist) + +sealed interface that stores validated payloads using boxed classes + +## Items1BoxedList +public record Items1BoxedList
+implements [Items1Boxed](#items1boxed) + +record that stores validated List payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| Items1BoxedList([ItemsList](#itemslist) data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| [ItemsList](#itemslist) | data()
validated payload | +| @Nullable Object | getData()
validated payload | + +## Items1 +public static class Items1
+extends JsonSchema + +A schema class that validates payloads + +## Description +component's name collides with the inner schema name + +### Code Sample +``` +import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags; +import org.openapijsonschematools.client.configurations.SchemaConfiguration; +import org.openapijsonschematools.client.exceptions.ValidationException; +import org.openapijsonschematools.client.schemas.validation.MapUtils; +import org.openapijsonschematools.client.schemas.validation.FrozenList; +import org.openapijsonschematools.client.schemas.validation.FrozenMap; +import org.openapijsonschematools.client.components.schemas.Items; + +import java.util.Arrays; +import java.util.List; +import java.util.AbstractMap; + +static final SchemaConfiguration configuration = new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().build()); + +// List validation +Items.ItemsList validatedPayload = + Items.Items1.validate( + new Items.ItemsListBuilder() + .build(), + configuration +); +``` + +### Field Summary +| Modifier and Type | Field and Description | +| ----------------- | ---------------------- | +| Set> | type = Set.of(List.class) | +| Class | items = [Items2.class](#items2) | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| [ItemsList](#itemslist) | validate([List](#itemslistbuilder) arg, SchemaConfiguration configuration) | +| [Items1BoxedList](#items1boxedlist) | validateAndBox([List](#itemslistbuilder) arg, SchemaConfiguration configuration) | +| [Items1Boxed](#items1boxed) | validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) | +| @Nullable Object | validate(@Nullable Object arg, SchemaConfiguration configuration) | + +## ItemsListBuilder +public class ItemsListBuilder
+builder for `List>` + +A class that builds the List input type + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| ItemsListBuilder()
Creates an empty list | +| ItemsListBuilder(List> items)
Stores the items in a list | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| ItemsListBuilder | add(Map item) | +| List> | build()
Returns list input that should be used with Schema.validate | + +## ItemsList +public class ItemsList
+extends `FrozenList>` + +A class to store validated List payloads + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| static [ItemsList](#itemslist) | of([List>](#itemslistbuilder) arg, SchemaConfiguration configuration) | + +## Items2Boxed +public sealed interface Items2Boxed
+permits
+[Items2BoxedMap](#items2boxedmap) + +sealed interface that stores validated payloads using boxed classes + +## Items2BoxedMap +public record Items2BoxedMap
+implements [Items2Boxed](#items2boxed) + +record that stores validated Map payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| Items2BoxedMap(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 | + +## Items2 +public static class Items2
+extends MapJsonSchema.MapJsonSchema1 + +A schema class that validates payloads + +| Methods Inherited from class org.openapijsonschematools.client.schemas.MapJsonSchema.MapJsonSchema1 | +| ------------------------------------------------------------------ | +| validate | +| validateAndBox | + +[[Back to top]](#top) [[Back to Component Schemas]](../../../README.md#Component-Schemas) [[Back to README]](../../../README.md) diff --git a/samples/client/petstore/kotlin/docs/components/schemas/ItemsSchema.md b/samples/client/petstore/kotlin/docs/components/schemas/ItemsSchema.md new file mode 100644 index 00000000000..6355ac50c42 --- /dev/null +++ b/samples/client/petstore/kotlin/docs/components/schemas/ItemsSchema.md @@ -0,0 +1,253 @@ +# ItemsSchema +org.openapijsonschematools.client.components.schemas.ItemsSchema.java +public class ItemsSchema
+ +A class that contains necessary nested +- schema classes (which validate payloads), extends JsonSchema +- sealed interfaces which store validated payloads, java version of a sum type +- boxed classes which store validated payloads, sealed permits class implementations +- classes to store validated map payloads, extends FrozenMap +- classes to build inputs for map payloads + +## Nested Class Summary +| Modifier and Type | Class and Description | +| ----------------- | ---------------------- | +| sealed interface | [ItemsSchema.ItemsSchema1Boxed](#itemsschema1boxed)
sealed interface for validated payloads | +| record | [ItemsSchema.ItemsSchema1BoxedMap](#itemsschema1boxedmap)
boxed class to store validated Map payloads | +| static class | [ItemsSchema.ItemsSchema1](#itemsschema1)
schema class | +| static class | [ItemsSchema.ItemsSchemaMapBuilder](#itemsschemamapbuilder)
builder for Map payloads | +| static class | [ItemsSchema.ItemsSchemaMap](#itemsschemamap)
output class for Map payloads | +| sealed interface | [ItemsSchema.SecondAdditionalPropertyBoxed](#secondadditionalpropertyboxed)
sealed interface for validated payloads | +| record | [ItemsSchema.SecondAdditionalPropertyBoxedString](#secondadditionalpropertyboxedstring)
boxed class to store validated String payloads | +| static class | [ItemsSchema.SecondAdditionalProperty](#secondadditionalproperty)
schema class | +| sealed interface | [ItemsSchema.SomePropertyBoxed](#somepropertyboxed)
sealed interface for validated payloads | +| record | [ItemsSchema.SomePropertyBoxedString](#somepropertyboxedstring)
boxed class to store validated String payloads | +| static class | [ItemsSchema.SomeProperty](#someproperty)
schema class | +| sealed interface | [ItemsSchema.NameBoxed](#nameboxed)
sealed interface for validated payloads | +| record | [ItemsSchema.NameBoxedString](#nameboxedstring)
boxed class to store validated String payloads | +| static class | [ItemsSchema.Name](#name)
schema class | + +## ItemsSchema1Boxed +public sealed interface ItemsSchema1Boxed
+permits
+[ItemsSchema1BoxedMap](#itemsschema1boxedmap) + +sealed interface that stores validated payloads using boxed classes + +## ItemsSchema1BoxedMap +public record ItemsSchema1BoxedMap
+implements [ItemsSchema1Boxed](#itemsschema1boxed) + +record that stores validated Map payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| ItemsSchema1BoxedMap([ItemsSchemaMap](#itemsschemamap) data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| [ItemsSchemaMap](#itemsschemamap) | data()
validated payload | +| @Nullable Object | getData()
validated payload | + +## ItemsSchema1 +public static class ItemsSchema1
+extends JsonSchema + +A schema class that validates payloads + +### Code Sample +``` +import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags; +import org.openapijsonschematools.client.configurations.SchemaConfiguration; +import org.openapijsonschematools.client.exceptions.ValidationException; +import org.openapijsonschematools.client.schemas.validation.MapUtils; +import org.openapijsonschematools.client.schemas.validation.FrozenList; +import org.openapijsonschematools.client.schemas.validation.FrozenMap; +import org.openapijsonschematools.client.components.schemas.ItemsSchema; + +import java.util.Arrays; +import java.util.List; +import java.util.AbstractMap; + +static final SchemaConfiguration configuration = new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().build()); + +// Map validation +ItemsSchema.ItemsSchemaMap validatedPayload = + ItemsSchema.ItemsSchema1.validate( + new ItemsSchema.ItemsSchemaMapBuilder() + .name("a") + + .someProperty("a") + + .secondAdditionalProperty("a") + + .build(), + configuration +); +``` + +### Field Summary +| Modifier and Type | Field and Description | +| ----------------- | ---------------------- | +| Set> | type = Set.of(Map.class) | +| Map> | properties = Map.ofEntries(
    new PropertyEntry("name", [Name.class](#name))),
    new PropertyEntry("someProperty", [SomeProperty.class](#someproperty))),
    new PropertyEntry("secondAdditionalProperty", [SecondAdditionalProperty.class](#secondadditionalproperty)))
)
| + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| [ItemsSchemaMap](#itemsschemamap) | validate([Map<?, ?>](#itemsschemamapbuilder) arg, SchemaConfiguration configuration) | +| [ItemsSchema1BoxedMap](#itemsschema1boxedmap) | validateAndBox([Map<?, ?>](#itemsschemamapbuilder) arg, SchemaConfiguration configuration) | +| [ItemsSchema1Boxed](#itemsschema1boxed) | validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) | +| @Nullable Object | validate(@Nullable Object arg, SchemaConfiguration configuration) | + +## ItemsSchemaMapBuilder +public class ItemsSchemaMapBuilder
+builder for `Map` + +A class that builds the Map input type + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| ItemsSchemaMapBuilder()
Creates a builder that contains an empty map | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| Map | build()
Returns map input that should be used with Schema.validate | +| [ItemsSchemaMapBuilder](#itemsschemamapbuilder) | name(String value) | +| [ItemsSchemaMapBuilder](#itemsschemamapbuilder) | someProperty(String value) | +| [ItemsSchemaMapBuilder](#itemsschemamapbuilder) | secondAdditionalProperty(String value) | +| [ItemsSchemaMapBuilder](#itemsschemamapbuilder) | additionalProperty(String key, Nothing? value) | +| [ItemsSchemaMapBuilder](#itemsschemamapbuilder) | additionalProperty(String key, boolean value) | +| [ItemsSchemaMapBuilder](#itemsschemamapbuilder) | additionalProperty(String key, String value) | +| [ItemsSchemaMapBuilder](#itemsschemamapbuilder) | additionalProperty(String key, int value) | +| [ItemsSchemaMapBuilder](#itemsschemamapbuilder) | additionalProperty(String key, float value) | +| [ItemsSchemaMapBuilder](#itemsschemamapbuilder) | additionalProperty(String key, long value) | +| [ItemsSchemaMapBuilder](#itemsschemamapbuilder) | additionalProperty(String key, double value) | +| [ItemsSchemaMapBuilder](#itemsschemamapbuilder) | additionalProperty(String key, List value) | +| [ItemsSchemaMapBuilder](#itemsschemamapbuilder) | additionalProperty(String key, Map value) | + +## ItemsSchemaMap +public static class ItemsSchemaMap
+extends FrozenMap + +A class to store validated Map payloads + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| static [ItemsSchemaMap](#itemsschemamap) | of([Map](#itemsschemamapbuilder) arg, SchemaConfiguration configuration) | +| String | name()
[optional] | +| String | someProperty()
[optional] | +| String | secondAdditionalProperty()
[optional] | +| @Nullable Object | getAdditionalProperty(String name)
provides type safety for additional properties | + +## SecondAdditionalPropertyBoxed +public sealed interface SecondAdditionalPropertyBoxed
+permits
+[SecondAdditionalPropertyBoxedString](#secondadditionalpropertyboxedstring) + +sealed interface that stores validated payloads using boxed classes + +## SecondAdditionalPropertyBoxedString +public record SecondAdditionalPropertyBoxedString
+implements [SecondAdditionalPropertyBoxed](#secondadditionalpropertyboxed) + +record that stores validated String payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| SecondAdditionalPropertyBoxedString(String data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| String | data()
validated payload | +| @Nullable Object | getData()
validated payload | + +## SecondAdditionalProperty +public static class SecondAdditionalProperty
+extends StringJsonSchema.StringJsonSchema1 + +A schema class that validates payloads + +| Methods Inherited from class org.openapijsonschematools.client.schemas.StringJsonSchema.StringJsonSchema1 | +| ------------------------------------------------------------------ | +| validate | +| validateAndBox | + +## SomePropertyBoxed +public sealed interface SomePropertyBoxed
+permits
+[SomePropertyBoxedString](#somepropertyboxedstring) + +sealed interface that stores validated payloads using boxed classes + +## SomePropertyBoxedString +public record SomePropertyBoxedString
+implements [SomePropertyBoxed](#somepropertyboxed) + +record that stores validated String payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| SomePropertyBoxedString(String data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| String | data()
validated payload | +| @Nullable Object | getData()
validated payload | + +## SomeProperty +public static class SomeProperty
+extends StringJsonSchema.StringJsonSchema1 + +A schema class that validates payloads + +| Methods Inherited from class org.openapijsonschematools.client.schemas.StringJsonSchema.StringJsonSchema1 | +| ------------------------------------------------------------------ | +| validate | +| validateAndBox | + +## NameBoxed +public sealed interface NameBoxed
+permits
+[NameBoxedString](#nameboxedstring) + +sealed interface that stores validated payloads using boxed classes + +## NameBoxedString +public record NameBoxedString
+implements [NameBoxed](#nameboxed) + +record that stores validated String payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| NameBoxedString(String data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| String | data()
validated payload | +| @Nullable Object | getData()
validated payload | + +## Name +public static class Name
+extends StringJsonSchema.StringJsonSchema1 + +A schema class that validates payloads + +| Methods Inherited from class org.openapijsonschematools.client.schemas.StringJsonSchema.StringJsonSchema1 | +| ------------------------------------------------------------------ | +| validate | +| validateAndBox | + +[[Back to top]](#top) [[Back to Component Schemas]](../../../README.md#Component-Schemas) [[Back to README]](../../../README.md) diff --git a/samples/client/petstore/kotlin/docs/components/schemas/JSONPatchRequest.md b/samples/client/petstore/kotlin/docs/components/schemas/JSONPatchRequest.md new file mode 100644 index 00000000000..3358698409c --- /dev/null +++ b/samples/client/petstore/kotlin/docs/components/schemas/JSONPatchRequest.md @@ -0,0 +1,282 @@ +# JSONPatchRequest +org.openapijsonschematools.client.components.schemas.JSONPatchRequest.java +public class JSONPatchRequest
+ +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 list payloads, extends FrozenList +- classes to build inputs for list payloads + +## Nested Class Summary +| Modifier and Type | Class and Description | +| ----------------- | ---------------------- | +| sealed interface | [JSONPatchRequest.JSONPatchRequest1Boxed](#jsonpatchrequest1boxed)
sealed interface for validated payloads | +| record | [JSONPatchRequest.JSONPatchRequest1BoxedList](#jsonpatchrequest1boxedlist)
boxed class to store validated List payloads | +| static class | [JSONPatchRequest.JSONPatchRequest1](#jsonpatchrequest1)
schema class | +| static class | [JSONPatchRequest.JSONPatchRequestListBuilder](#jsonpatchrequestlistbuilder)
builder for List payloads | +| static class | [JSONPatchRequest.JSONPatchRequestList](#jsonpatchrequestlist)
output class for List payloads | +| sealed interface | [JSONPatchRequest.ItemsBoxed](#itemsboxed)
sealed interface for validated payloads | +| record | [JSONPatchRequest.ItemsBoxedVoid](#itemsboxedvoid)
boxed class to store validated null payloads | +| record | [JSONPatchRequest.ItemsBoxedBoolean](#itemsboxedboolean)
boxed class to store validated boolean payloads | +| record | [JSONPatchRequest.ItemsBoxedNumber](#itemsboxednumber)
boxed class to store validated Number payloads | +| record | [JSONPatchRequest.ItemsBoxedString](#itemsboxedstring)
boxed class to store validated String payloads | +| record | [JSONPatchRequest.ItemsBoxedList](#itemsboxedlist)
boxed class to store validated List payloads | +| record | [JSONPatchRequest.ItemsBoxedMap](#itemsboxedmap)
boxed class to store validated Map payloads | +| static class | [JSONPatchRequest.Items](#items)
schema class | + +## JSONPatchRequest1Boxed +public sealed interface JSONPatchRequest1Boxed
+permits
+[JSONPatchRequest1BoxedList](#jsonpatchrequest1boxedlist) + +sealed interface that stores validated payloads using boxed classes + +## JSONPatchRequest1BoxedList +public record JSONPatchRequest1BoxedList
+implements [JSONPatchRequest1Boxed](#jsonpatchrequest1boxed) + +record that stores validated List payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| JSONPatchRequest1BoxedList([JSONPatchRequestList](#jsonpatchrequestlist) data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| [JSONPatchRequestList](#jsonpatchrequestlist) | data()
validated payload | +| @Nullable Object | getData()
validated payload | + +## JSONPatchRequest1 +public static class JSONPatchRequest1
+extends JsonSchema + +A schema class that validates payloads + +### Code Sample +``` +import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags; +import org.openapijsonschematools.client.configurations.SchemaConfiguration; +import org.openapijsonschematools.client.exceptions.ValidationException; +import org.openapijsonschematools.client.schemas.validation.MapUtils; +import org.openapijsonschematools.client.schemas.validation.FrozenList; +import org.openapijsonschematools.client.schemas.validation.FrozenMap; +import org.openapijsonschematools.client.components.schemas.JSONPatchRequest; + +import java.util.Arrays; +import java.util.List; +import java.util.AbstractMap; + +static final SchemaConfiguration configuration = new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().build()); + +// List validation +JSONPatchRequest.JSONPatchRequestList validatedPayload = + JSONPatchRequest.JSONPatchRequest1.validate( + new JSONPatchRequest.JSONPatchRequestListBuilder() + .build(), + configuration +); +``` + +### Field Summary +| Modifier and Type | Field and Description | +| ----------------- | ---------------------- | +| Set> | type = Set.of(List.class) | +| Class | items = [Items.class](#items) | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| [JSONPatchRequestList](#jsonpatchrequestlist) | validate([List](#jsonpatchrequestlistbuilder) arg, SchemaConfiguration configuration) | +| [JSONPatchRequest1BoxedList](#jsonpatchrequest1boxedlist) | validateAndBox([List](#jsonpatchrequestlistbuilder) arg, SchemaConfiguration configuration) | +| [JSONPatchRequest1Boxed](#jsonpatchrequest1boxed) | validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) | +| @Nullable Object | validate(@Nullable Object arg, SchemaConfiguration configuration) | + +## JSONPatchRequestListBuilder +public class JSONPatchRequestListBuilder
+builder for `List<@Nullable Object>` + +A class that builds the List input type + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| JSONPatchRequestListBuilder()
Creates an empty list | +| JSONPatchRequestListBuilder(List<@Nullable Object> items)
Stores the items in a list | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| JSONPatchRequestListBuilder | add(Nothing? item) | +| JSONPatchRequestListBuilder | add(boolean item) | +| JSONPatchRequestListBuilder | add(String item) | +| JSONPatchRequestListBuilder | add(int item) | +| JSONPatchRequestListBuilder | add(float item) | +| JSONPatchRequestListBuilder | add(long item) | +| JSONPatchRequestListBuilder | add(double item) | +| JSONPatchRequestListBuilder | add(List item) | +| JSONPatchRequestListBuilder | add(Map item) | +| List<@Nullable Object> | build()
Returns list input that should be used with Schema.validate | + +## JSONPatchRequestList +public class JSONPatchRequestList
+extends `FrozenList<@Nullable Object>` + +A class to store validated List payloads + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| static [JSONPatchRequestList](#jsonpatchrequestlist) | of([List](#jsonpatchrequestlistbuilder) arg, SchemaConfiguration configuration) | + +## ItemsBoxed +public sealed interface ItemsBoxed
+permits
+[ItemsBoxedVoid](#itemsboxedvoid), +[ItemsBoxedBoolean](#itemsboxedboolean), +[ItemsBoxedNumber](#itemsboxednumber), +[ItemsBoxedString](#itemsboxedstring), +[ItemsBoxedList](#itemsboxedlist), +[ItemsBoxedMap](#itemsboxedmap) + +sealed interface that stores validated payloads using boxed classes + +## ItemsBoxedVoid +public record ItemsBoxedVoid
+implements [ItemsBoxed](#itemsboxed) + +record that stores validated null payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| ItemsBoxedVoid(Nothing? data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| Nothing? | data()
validated payload | +| @Nullable Object | getData()
validated payload | + +## ItemsBoxedBoolean +public record ItemsBoxedBoolean
+implements [ItemsBoxed](#itemsboxed) + +record that stores validated boolean payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| ItemsBoxedBoolean(boolean data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| boolean | data()
validated payload | +| @Nullable Object | getData()
validated payload | + +## ItemsBoxedNumber +public record ItemsBoxedNumber
+implements [ItemsBoxed](#itemsboxed) + +record that stores validated Number payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| ItemsBoxedNumber(Number data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| Number | data()
validated payload | +| @Nullable Object | getData()
validated payload | + +## ItemsBoxedString +public record ItemsBoxedString
+implements [ItemsBoxed](#itemsboxed) + +record that stores validated String payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| ItemsBoxedString(String data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| String | data()
validated payload | +| @Nullable Object | getData()
validated payload | + +## ItemsBoxedList +public record ItemsBoxedList
+implements [ItemsBoxed](#itemsboxed) + +record that stores validated List payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| ItemsBoxedList(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 | + +## ItemsBoxedMap +public record ItemsBoxedMap
+implements [ItemsBoxed](#itemsboxed) + +record that stores validated Map payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| ItemsBoxedMap(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 | + +## Items +public static class Items
+extends JsonSchema + +A schema class that validates payloads + +### Field Summary +| Modifier and Type | Field and Description | +| ----------------- | ---------------------- | +| List> | oneOf = List.of(
    [JSONPatchRequestAddReplaceTest.JSONPatchRequestAddReplaceTest1.class](../../components/schemas/JSONPatchRequestAddReplaceTest.md#jsonpatchrequestaddreplacetest1),
    [JSONPatchRequestRemove.JSONPatchRequestRemove1.class](../../components/schemas/JSONPatchRequestRemove.md#jsonpatchrequestremove1),
    [JSONPatchRequestMoveCopy.JSONPatchRequestMoveCopy1.class](../../components/schemas/JSONPatchRequestMoveCopy.md#jsonpatchrequestmovecopy1)
))
| + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| String | validate(String arg, SchemaConfiguration configuration) | +| Nothing? | validate(Nothing? arg, SchemaConfiguration configuration) | +| int | validate(int arg, SchemaConfiguration configuration) | +| long | validate(long arg, SchemaConfiguration configuration) | +| float | validate(float arg, SchemaConfiguration configuration) | +| double | validate(double arg, SchemaConfiguration configuration) | +| Number | validate(Number arg, SchemaConfiguration configuration) | +| boolean | validate(boolean arg, SchemaConfiguration configuration) | +| FrozenMap<@Nullable Object> | validate(Map<?, ?> arg, SchemaConfiguration configuration) | +| FrozenList<@Nullable Object> | validate(List arg, SchemaConfiguration configuration) | +| [ItemsBoxedString](#itemsboxedstring) | validateAndBox(String arg, SchemaConfiguration configuration) | +| [ItemsBoxedVoid](#itemsboxedvoid) | validateAndBox(Nothing? arg, SchemaConfiguration configuration) | +| [ItemsBoxedNumber](#itemsboxednumber) | validateAndBox(Number arg, SchemaConfiguration configuration) | +| [ItemsBoxedBoolean](#itemsboxedboolean) | validateAndBox(boolean arg, SchemaConfiguration configuration) | +| [ItemsBoxedMap](#itemsboxedmap) | validateAndBox(Map<?, ?> arg, SchemaConfiguration configuration) | +| [ItemsBoxedList](#itemsboxedlist) | validateAndBox(List arg, SchemaConfiguration configuration) | +| [ItemsBoxed](#itemsboxed) | validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) | +| @Nullable Object | validate(@Nullable Object arg, SchemaConfiguration configuration) | + +[[Back to top]](#top) [[Back to Component Schemas]](../../../README.md#Component-Schemas) [[Back to README]](../../../README.md) diff --git a/samples/client/petstore/kotlin/docs/components/schemas/JSONPatchRequestAddReplaceTest.md b/samples/client/petstore/kotlin/docs/components/schemas/JSONPatchRequestAddReplaceTest.md new file mode 100644 index 00000000000..b79cb160737 --- /dev/null +++ b/samples/client/petstore/kotlin/docs/components/schemas/JSONPatchRequestAddReplaceTest.md @@ -0,0 +1,678 @@ +# JSONPatchRequestAddReplaceTest +org.openapijsonschematools.client.components.schemas.JSONPatchRequestAddReplaceTest.java +public class JSONPatchRequestAddReplaceTest
+ +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 | [JSONPatchRequestAddReplaceTest.JSONPatchRequestAddReplaceTest1Boxed](#jsonpatchrequestaddreplacetest1boxed)
sealed interface for validated payloads | +| record | [JSONPatchRequestAddReplaceTest.JSONPatchRequestAddReplaceTest1BoxedMap](#jsonpatchrequestaddreplacetest1boxedmap)
boxed class to store validated Map payloads | +| static class | [JSONPatchRequestAddReplaceTest.JSONPatchRequestAddReplaceTest1](#jsonpatchrequestaddreplacetest1)
schema class | +| static class | [JSONPatchRequestAddReplaceTest.JSONPatchRequestAddReplaceTestMapBuilder](#jsonpatchrequestaddreplacetestmapbuilder)
builder for Map payloads | +| static class | [JSONPatchRequestAddReplaceTest.JSONPatchRequestAddReplaceTestMap](#jsonpatchrequestaddreplacetestmap)
output class for Map payloads | +| sealed interface | [JSONPatchRequestAddReplaceTest.OpBoxed](#opboxed)
sealed interface for validated payloads | +| record | [JSONPatchRequestAddReplaceTest.OpBoxedString](#opboxedstring)
boxed class to store validated String payloads | +| static class | [JSONPatchRequestAddReplaceTest.Op](#op)
schema class | +| enum | [JSONPatchRequestAddReplaceTest.StringOpEnums](#stringopenums)
String enum | +| sealed interface | [JSONPatchRequestAddReplaceTest.ValueBoxed](#valueboxed)
sealed interface for validated payloads | +| record | [JSONPatchRequestAddReplaceTest.ValueBoxedVoid](#valueboxedvoid)
boxed class to store validated null payloads | +| record | [JSONPatchRequestAddReplaceTest.ValueBoxedBoolean](#valueboxedboolean)
boxed class to store validated boolean payloads | +| record | [JSONPatchRequestAddReplaceTest.ValueBoxedNumber](#valueboxednumber)
boxed class to store validated Number payloads | +| record | [JSONPatchRequestAddReplaceTest.ValueBoxedString](#valueboxedstring)
boxed class to store validated String payloads | +| record | [JSONPatchRequestAddReplaceTest.ValueBoxedList](#valueboxedlist)
boxed class to store validated List payloads | +| record | [JSONPatchRequestAddReplaceTest.ValueBoxedMap](#valueboxedmap)
boxed class to store validated Map payloads | +| static class | [JSONPatchRequestAddReplaceTest.Value](#value)
schema class | +| sealed interface | [JSONPatchRequestAddReplaceTest.PathBoxed](#pathboxed)
sealed interface for validated payloads | +| record | [JSONPatchRequestAddReplaceTest.PathBoxedString](#pathboxedstring)
boxed class to store validated String payloads | +| static class | [JSONPatchRequestAddReplaceTest.Path](#path)
schema class | +| sealed interface | [JSONPatchRequestAddReplaceTest.AdditionalPropertiesBoxed](#additionalpropertiesboxed)
sealed interface for validated payloads | +| record | [JSONPatchRequestAddReplaceTest.AdditionalPropertiesBoxedVoid](#additionalpropertiesboxedvoid)
boxed class to store validated null payloads | +| record | [JSONPatchRequestAddReplaceTest.AdditionalPropertiesBoxedBoolean](#additionalpropertiesboxedboolean)
boxed class to store validated boolean payloads | +| record | [JSONPatchRequestAddReplaceTest.AdditionalPropertiesBoxedNumber](#additionalpropertiesboxednumber)
boxed class to store validated Number payloads | +| record | [JSONPatchRequestAddReplaceTest.AdditionalPropertiesBoxedString](#additionalpropertiesboxedstring)
boxed class to store validated String payloads | +| record | [JSONPatchRequestAddReplaceTest.AdditionalPropertiesBoxedList](#additionalpropertiesboxedlist)
boxed class to store validated List payloads | +| record | [JSONPatchRequestAddReplaceTest.AdditionalPropertiesBoxedMap](#additionalpropertiesboxedmap)
boxed class to store validated Map payloads | +| static class | [JSONPatchRequestAddReplaceTest.AdditionalProperties](#additionalproperties)
schema class | + +## JSONPatchRequestAddReplaceTest1Boxed +public sealed interface JSONPatchRequestAddReplaceTest1Boxed
+permits
+[JSONPatchRequestAddReplaceTest1BoxedMap](#jsonpatchrequestaddreplacetest1boxedmap) + +sealed interface that stores validated payloads using boxed classes + +## JSONPatchRequestAddReplaceTest1BoxedMap +public record JSONPatchRequestAddReplaceTest1BoxedMap
+implements [JSONPatchRequestAddReplaceTest1Boxed](#jsonpatchrequestaddreplacetest1boxed) + +record that stores validated Map payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| JSONPatchRequestAddReplaceTest1BoxedMap([JSONPatchRequestAddReplaceTestMap](#jsonpatchrequestaddreplacetestmap) data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| [JSONPatchRequestAddReplaceTestMap](#jsonpatchrequestaddreplacetestmap) | data()
validated payload | +| @Nullable Object | getData()
validated payload | + +## JSONPatchRequestAddReplaceTest1 +public static class JSONPatchRequestAddReplaceTest1
+extends JsonSchema + +A schema class that validates payloads + +### Code Sample +``` +import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags; +import org.openapijsonschematools.client.configurations.SchemaConfiguration; +import org.openapijsonschematools.client.exceptions.ValidationException; +import org.openapijsonschematools.client.schemas.validation.MapUtils; +import org.openapijsonschematools.client.schemas.validation.FrozenList; +import org.openapijsonschematools.client.schemas.validation.FrozenMap; +import org.openapijsonschematools.client.components.schemas.JSONPatchRequestAddReplaceTest; + +import java.util.Arrays; +import java.util.List; +import java.util.AbstractMap; + +static final SchemaConfiguration configuration = new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().build()); + +// Map validation +JSONPatchRequestAddReplaceTest.JSONPatchRequestAddReplaceTestMap validatedPayload = + JSONPatchRequestAddReplaceTest.JSONPatchRequestAddReplaceTest1.validate( + new JSONPatchRequestAddReplaceTest.JSONPatchRequestAddReplaceTestMapBuilder() + .op("add") + + .path("a") + + .build(), + configuration +); +``` + +### Field Summary +| Modifier and Type | Field and Description | +| ----------------- | ---------------------- | +| Set> | type = Set.of(Map.class) | +| Map> | properties = Map.ofEntries(
    new PropertyEntry("path", [Path.class](#path))),
    new PropertyEntry("value", [Value.class](#value))),
    new PropertyEntry("op", [Op.class](#op)))
)
| +| Set | required = Set.of(
    "op",
    "path",
    "value"
)
| +| Class | additionalProperties = [AdditionalProperties.class](#additionalproperties) | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| [JSONPatchRequestAddReplaceTestMap](#jsonpatchrequestaddreplacetestmap) | validate([Map<?, ?>](#jsonpatchrequestaddreplacetestmapbuilder) arg, SchemaConfiguration configuration) | +| [JSONPatchRequestAddReplaceTest1BoxedMap](#jsonpatchrequestaddreplacetest1boxedmap) | validateAndBox([Map<?, ?>](#jsonpatchrequestaddreplacetestmapbuilder) arg, SchemaConfiguration configuration) | +| [JSONPatchRequestAddReplaceTest1Boxed](#jsonpatchrequestaddreplacetest1boxed) | validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) | +| @Nullable Object | validate(@Nullable Object arg, SchemaConfiguration configuration) | + +## JSONPatchRequestAddReplaceTestMap000Builder +public class JSONPatchRequestAddReplaceTestMap000Builder
+builder for `Map` + +A class that builds the Map input type + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| JSONPatchRequestAddReplaceTestMap000Builder(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 | + +## JSONPatchRequestAddReplaceTestMap001Builder +public class JSONPatchRequestAddReplaceTestMap001Builder
+builder for `Map` + +A class that builds the Map input type + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| JSONPatchRequestAddReplaceTestMap001Builder(Map instance)
Creates a builder that contains the passed instance | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| [JSONPatchRequestAddReplaceTestMap000Builder](#jsonpatchrequestaddreplacetestmap000builder) | value(Nothing? value) | +| [JSONPatchRequestAddReplaceTestMap000Builder](#jsonpatchrequestaddreplacetestmap000builder) | value(boolean value) | +| [JSONPatchRequestAddReplaceTestMap000Builder](#jsonpatchrequestaddreplacetestmap000builder) | value(String value) | +| [JSONPatchRequestAddReplaceTestMap000Builder](#jsonpatchrequestaddreplacetestmap000builder) | value(int value) | +| [JSONPatchRequestAddReplaceTestMap000Builder](#jsonpatchrequestaddreplacetestmap000builder) | value(float value) | +| [JSONPatchRequestAddReplaceTestMap000Builder](#jsonpatchrequestaddreplacetestmap000builder) | value(long value) | +| [JSONPatchRequestAddReplaceTestMap000Builder](#jsonpatchrequestaddreplacetestmap000builder) | value(double value) | +| [JSONPatchRequestAddReplaceTestMap000Builder](#jsonpatchrequestaddreplacetestmap000builder) | value(List value) | +| [JSONPatchRequestAddReplaceTestMap000Builder](#jsonpatchrequestaddreplacetestmap000builder) | value(Map value) | + +## JSONPatchRequestAddReplaceTestMap010Builder +public class JSONPatchRequestAddReplaceTestMap010Builder
+builder for `Map` + +A class that builds the Map input type + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| JSONPatchRequestAddReplaceTestMap010Builder(Map instance)
Creates a builder that contains the passed instance | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| [JSONPatchRequestAddReplaceTestMap000Builder](#jsonpatchrequestaddreplacetestmap000builder) | path(String value) | + +## JSONPatchRequestAddReplaceTestMap011Builder +public class JSONPatchRequestAddReplaceTestMap011Builder
+builder for `Map` + +A class that builds the Map input type + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| JSONPatchRequestAddReplaceTestMap011Builder(Map instance)
Creates a builder that contains the passed instance | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| [JSONPatchRequestAddReplaceTestMap001Builder](#jsonpatchrequestaddreplacetestmap001builder) | path(String value) | +| [JSONPatchRequestAddReplaceTestMap010Builder](#jsonpatchrequestaddreplacetestmap010builder) | value(Nothing? value) | +| [JSONPatchRequestAddReplaceTestMap010Builder](#jsonpatchrequestaddreplacetestmap010builder) | value(boolean value) | +| [JSONPatchRequestAddReplaceTestMap010Builder](#jsonpatchrequestaddreplacetestmap010builder) | value(String value) | +| [JSONPatchRequestAddReplaceTestMap010Builder](#jsonpatchrequestaddreplacetestmap010builder) | value(int value) | +| [JSONPatchRequestAddReplaceTestMap010Builder](#jsonpatchrequestaddreplacetestmap010builder) | value(float value) | +| [JSONPatchRequestAddReplaceTestMap010Builder](#jsonpatchrequestaddreplacetestmap010builder) | value(long value) | +| [JSONPatchRequestAddReplaceTestMap010Builder](#jsonpatchrequestaddreplacetestmap010builder) | value(double value) | +| [JSONPatchRequestAddReplaceTestMap010Builder](#jsonpatchrequestaddreplacetestmap010builder) | value(List value) | +| [JSONPatchRequestAddReplaceTestMap010Builder](#jsonpatchrequestaddreplacetestmap010builder) | value(Map value) | + +## JSONPatchRequestAddReplaceTestMap100Builder +public class JSONPatchRequestAddReplaceTestMap100Builder
+builder for `Map` + +A class that builds the Map input type + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| JSONPatchRequestAddReplaceTestMap100Builder(Map instance)
Creates a builder that contains the passed instance | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| [JSONPatchRequestAddReplaceTestMap000Builder](#jsonpatchrequestaddreplacetestmap000builder) | op(String value) | +| [JSONPatchRequestAddReplaceTestMap000Builder](#jsonpatchrequestaddreplacetestmap000builder) | op([StringOpEnums](#stringopenums) value) | + +## JSONPatchRequestAddReplaceTestMap101Builder +public class JSONPatchRequestAddReplaceTestMap101Builder
+builder for `Map` + +A class that builds the Map input type + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| JSONPatchRequestAddReplaceTestMap101Builder(Map instance)
Creates a builder that contains the passed instance | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| [JSONPatchRequestAddReplaceTestMap001Builder](#jsonpatchrequestaddreplacetestmap001builder) | op(String value) | +| [JSONPatchRequestAddReplaceTestMap001Builder](#jsonpatchrequestaddreplacetestmap001builder) | op([StringOpEnums](#stringopenums) value) | +| [JSONPatchRequestAddReplaceTestMap100Builder](#jsonpatchrequestaddreplacetestmap100builder) | value(Nothing? value) | +| [JSONPatchRequestAddReplaceTestMap100Builder](#jsonpatchrequestaddreplacetestmap100builder) | value(boolean value) | +| [JSONPatchRequestAddReplaceTestMap100Builder](#jsonpatchrequestaddreplacetestmap100builder) | value(String value) | +| [JSONPatchRequestAddReplaceTestMap100Builder](#jsonpatchrequestaddreplacetestmap100builder) | value(int value) | +| [JSONPatchRequestAddReplaceTestMap100Builder](#jsonpatchrequestaddreplacetestmap100builder) | value(float value) | +| [JSONPatchRequestAddReplaceTestMap100Builder](#jsonpatchrequestaddreplacetestmap100builder) | value(long value) | +| [JSONPatchRequestAddReplaceTestMap100Builder](#jsonpatchrequestaddreplacetestmap100builder) | value(double value) | +| [JSONPatchRequestAddReplaceTestMap100Builder](#jsonpatchrequestaddreplacetestmap100builder) | value(List value) | +| [JSONPatchRequestAddReplaceTestMap100Builder](#jsonpatchrequestaddreplacetestmap100builder) | value(Map value) | + +## JSONPatchRequestAddReplaceTestMap110Builder +public class JSONPatchRequestAddReplaceTestMap110Builder
+builder for `Map` + +A class that builds the Map input type + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| JSONPatchRequestAddReplaceTestMap110Builder(Map instance)
Creates a builder that contains the passed instance | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| [JSONPatchRequestAddReplaceTestMap010Builder](#jsonpatchrequestaddreplacetestmap010builder) | op(String value) | +| [JSONPatchRequestAddReplaceTestMap010Builder](#jsonpatchrequestaddreplacetestmap010builder) | op([StringOpEnums](#stringopenums) value) | +| [JSONPatchRequestAddReplaceTestMap100Builder](#jsonpatchrequestaddreplacetestmap100builder) | path(String value) | + +## JSONPatchRequestAddReplaceTestMapBuilder +public class JSONPatchRequestAddReplaceTestMapBuilder
+builder for `Map` + +A class that builds the Map input type + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| JSONPatchRequestAddReplaceTestMapBuilder()
Creates a builder that contains an empty map | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| [JSONPatchRequestAddReplaceTestMap011Builder](#jsonpatchrequestaddreplacetestmap011builder) | op(String value) | +| [JSONPatchRequestAddReplaceTestMap011Builder](#jsonpatchrequestaddreplacetestmap011builder) | op([StringOpEnums](#stringopenums) value) | +| [JSONPatchRequestAddReplaceTestMap101Builder](#jsonpatchrequestaddreplacetestmap101builder) | path(String value) | +| [JSONPatchRequestAddReplaceTestMap110Builder](#jsonpatchrequestaddreplacetestmap110builder) | value(Nothing? value) | +| [JSONPatchRequestAddReplaceTestMap110Builder](#jsonpatchrequestaddreplacetestmap110builder) | value(boolean value) | +| [JSONPatchRequestAddReplaceTestMap110Builder](#jsonpatchrequestaddreplacetestmap110builder) | value(String value) | +| [JSONPatchRequestAddReplaceTestMap110Builder](#jsonpatchrequestaddreplacetestmap110builder) | value(int value) | +| [JSONPatchRequestAddReplaceTestMap110Builder](#jsonpatchrequestaddreplacetestmap110builder) | value(float value) | +| [JSONPatchRequestAddReplaceTestMap110Builder](#jsonpatchrequestaddreplacetestmap110builder) | value(long value) | +| [JSONPatchRequestAddReplaceTestMap110Builder](#jsonpatchrequestaddreplacetestmap110builder) | value(double value) | +| [JSONPatchRequestAddReplaceTestMap110Builder](#jsonpatchrequestaddreplacetestmap110builder) | value(List value) | +| [JSONPatchRequestAddReplaceTestMap110Builder](#jsonpatchrequestaddreplacetestmap110builder) | value(Map value) | + +## JSONPatchRequestAddReplaceTestMap +public static class JSONPatchRequestAddReplaceTestMap
+extends FrozenMap + +A class to store validated Map payloads + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| static [JSONPatchRequestAddReplaceTestMap](#jsonpatchrequestaddreplacetestmap) | of([Map](#jsonpatchrequestaddreplacetestmapbuilder) arg, SchemaConfiguration configuration) | +| String | op()
must be one of ["add", "replace", "test"] | +| String | path()
| +| @Nullable Object | value()
| + +## OpBoxed +public sealed interface OpBoxed
+permits
+[OpBoxedString](#opboxedstring) + +sealed interface that stores validated payloads using boxed classes + +## OpBoxedString +public record OpBoxedString
+implements [OpBoxed](#opboxed) + +record that stores validated String payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| OpBoxedString(String data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| String | data()
validated payload | +| @Nullable Object | getData()
validated payload | + +## Op +public static class Op
+extends JsonSchema + +A schema class that validates payloads + +## Description +The operation to perform. + +### Code Sample +``` +import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags; +import org.openapijsonschematools.client.configurations.SchemaConfiguration; +import org.openapijsonschematools.client.exceptions.ValidationException; +import org.openapijsonschematools.client.schemas.validation.MapUtils; +import org.openapijsonschematools.client.schemas.validation.FrozenList; +import org.openapijsonschematools.client.schemas.validation.FrozenMap; +import org.openapijsonschematools.client.components.schemas.JSONPatchRequestAddReplaceTest; + +import java.util.Arrays; +import java.util.List; +import java.util.AbstractMap; + +static final SchemaConfiguration configuration = new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().build()); + +// String validation +String validatedPayload = JSONPatchRequestAddReplaceTest.Op.validate( + "add", + configuration +); +``` + +### Field Summary +| Modifier and Type | Field and Description | +| ----------------- | ---------------------- | +| Set> | type = Set.of(
    String.class
)
| +| Set | enumValues = SetMaker.makeSet(
    "add",
    "replace",
    "test"
)
| + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| String | validate(String arg, SchemaConfiguration configuration) | +| String | validate([StringOpEnums](#stringopenums) arg, SchemaConfiguration configuration) | +| [OpBoxedString](#opboxedstring) | validateAndBox(String arg, SchemaConfiguration configuration) | +| [OpBoxed](#opboxed) | validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) | +| @Nullable Object | validate(@Nullable Object arg, SchemaConfiguration configuration) | + +## StringOpEnums +public enum StringOpEnums
+extends `Enum` + +A class that stores String enum values + +### Enum Constant Summary +| Enum Constant | Description | +| ------------- | ----------- | +| ADD | value = "add" | +| REPLACE | value = "replace" | +| TEST | value = "test" | + +## ValueBoxed +public sealed interface ValueBoxed
+permits
+[ValueBoxedVoid](#valueboxedvoid), +[ValueBoxedBoolean](#valueboxedboolean), +[ValueBoxedNumber](#valueboxednumber), +[ValueBoxedString](#valueboxedstring), +[ValueBoxedList](#valueboxedlist), +[ValueBoxedMap](#valueboxedmap) + +sealed interface that stores validated payloads using boxed classes + +## ValueBoxedVoid +public record ValueBoxedVoid
+implements [ValueBoxed](#valueboxed) + +record that stores validated null payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| ValueBoxedVoid(Nothing? data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| Nothing? | data()
validated payload | +| @Nullable Object | getData()
validated payload | + +## ValueBoxedBoolean +public record ValueBoxedBoolean
+implements [ValueBoxed](#valueboxed) + +record that stores validated boolean payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| ValueBoxedBoolean(boolean data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| boolean | data()
validated payload | +| @Nullable Object | getData()
validated payload | + +## ValueBoxedNumber +public record ValueBoxedNumber
+implements [ValueBoxed](#valueboxed) + +record that stores validated Number payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| ValueBoxedNumber(Number data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| Number | data()
validated payload | +| @Nullable Object | getData()
validated payload | + +## ValueBoxedString +public record ValueBoxedString
+implements [ValueBoxed](#valueboxed) + +record that stores validated String payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| ValueBoxedString(String data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| String | data()
validated payload | +| @Nullable Object | getData()
validated payload | + +## ValueBoxedList +public record ValueBoxedList
+implements [ValueBoxed](#valueboxed) + +record that stores validated List payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| ValueBoxedList(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 | + +## ValueBoxedMap +public record ValueBoxedMap
+implements [ValueBoxed](#valueboxed) + +record that stores validated Map payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| ValueBoxedMap(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 | + +## Value +public static class Value
+extends AnyTypeJsonSchema.AnyTypeJsonSchema1 + +A schema class that validates payloads + +## Description +The value to add, replace or test. + +| Methods Inherited from class org.openapijsonschematools.client.schemas.AnyTypeJsonSchema.AnyTypeJsonSchema1 | +| ------------------------------------------------------------------ | +| validate | +| validateAndBox | + +## PathBoxed +public sealed interface PathBoxed
+permits
+[PathBoxedString](#pathboxedstring) + +sealed interface that stores validated payloads using boxed classes + +## PathBoxedString +public record PathBoxedString
+implements [PathBoxed](#pathboxed) + +record that stores validated String payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| PathBoxedString(String data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| String | data()
validated payload | +| @Nullable Object | getData()
validated payload | + +## Path +public static class Path
+extends StringJsonSchema.StringJsonSchema1 + +A schema class that validates payloads + +## Description +A JSON Pointer path. + +| Methods Inherited from class org.openapijsonschematools.client.schemas.StringJsonSchema.StringJsonSchema1 | +| ------------------------------------------------------------------ | +| validate | +| validateAndBox | + +## 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(Nothing? data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| Nothing? | 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 Component Schemas]](../../../README.md#Component-Schemas) [[Back to README]](../../../README.md) diff --git a/samples/client/petstore/kotlin/docs/components/schemas/JSONPatchRequestMoveCopy.md b/samples/client/petstore/kotlin/docs/components/schemas/JSONPatchRequestMoveCopy.md new file mode 100644 index 00000000000..902ec2237a8 --- /dev/null +++ b/samples/client/petstore/kotlin/docs/components/schemas/JSONPatchRequestMoveCopy.md @@ -0,0 +1,552 @@ +# JSONPatchRequestMoveCopy +org.openapijsonschematools.client.components.schemas.JSONPatchRequestMoveCopy.java +public class JSONPatchRequestMoveCopy
+ +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 | [JSONPatchRequestMoveCopy.JSONPatchRequestMoveCopy1Boxed](#jsonpatchrequestmovecopy1boxed)
sealed interface for validated payloads | +| record | [JSONPatchRequestMoveCopy.JSONPatchRequestMoveCopy1BoxedMap](#jsonpatchrequestmovecopy1boxedmap)
boxed class to store validated Map payloads | +| static class | [JSONPatchRequestMoveCopy.JSONPatchRequestMoveCopy1](#jsonpatchrequestmovecopy1)
schema class | +| static class | [JSONPatchRequestMoveCopy.JSONPatchRequestMoveCopyMapBuilder](#jsonpatchrequestmovecopymapbuilder)
builder for Map payloads | +| static class | [JSONPatchRequestMoveCopy.JSONPatchRequestMoveCopyMap](#jsonpatchrequestmovecopymap)
output class for Map payloads | +| sealed interface | [JSONPatchRequestMoveCopy.OpBoxed](#opboxed)
sealed interface for validated payloads | +| record | [JSONPatchRequestMoveCopy.OpBoxedString](#opboxedstring)
boxed class to store validated String payloads | +| static class | [JSONPatchRequestMoveCopy.Op](#op)
schema class | +| enum | [JSONPatchRequestMoveCopy.StringOpEnums](#stringopenums)
String enum | +| sealed interface | [JSONPatchRequestMoveCopy.PathBoxed](#pathboxed)
sealed interface for validated payloads | +| record | [JSONPatchRequestMoveCopy.PathBoxedString](#pathboxedstring)
boxed class to store validated String payloads | +| static class | [JSONPatchRequestMoveCopy.Path](#path)
schema class | +| sealed interface | [JSONPatchRequestMoveCopy.FromBoxed](#fromboxed)
sealed interface for validated payloads | +| record | [JSONPatchRequestMoveCopy.FromBoxedString](#fromboxedstring)
boxed class to store validated String payloads | +| static class | [JSONPatchRequestMoveCopy.From](#from)
schema class | +| sealed interface | [JSONPatchRequestMoveCopy.AdditionalPropertiesBoxed](#additionalpropertiesboxed)
sealed interface for validated payloads | +| record | [JSONPatchRequestMoveCopy.AdditionalPropertiesBoxedVoid](#additionalpropertiesboxedvoid)
boxed class to store validated null payloads | +| record | [JSONPatchRequestMoveCopy.AdditionalPropertiesBoxedBoolean](#additionalpropertiesboxedboolean)
boxed class to store validated boolean payloads | +| record | [JSONPatchRequestMoveCopy.AdditionalPropertiesBoxedNumber](#additionalpropertiesboxednumber)
boxed class to store validated Number payloads | +| record | [JSONPatchRequestMoveCopy.AdditionalPropertiesBoxedString](#additionalpropertiesboxedstring)
boxed class to store validated String payloads | +| record | [JSONPatchRequestMoveCopy.AdditionalPropertiesBoxedList](#additionalpropertiesboxedlist)
boxed class to store validated List payloads | +| record | [JSONPatchRequestMoveCopy.AdditionalPropertiesBoxedMap](#additionalpropertiesboxedmap)
boxed class to store validated Map payloads | +| static class | [JSONPatchRequestMoveCopy.AdditionalProperties](#additionalproperties)
schema class | + +## JSONPatchRequestMoveCopy1Boxed +public sealed interface JSONPatchRequestMoveCopy1Boxed
+permits
+[JSONPatchRequestMoveCopy1BoxedMap](#jsonpatchrequestmovecopy1boxedmap) + +sealed interface that stores validated payloads using boxed classes + +## JSONPatchRequestMoveCopy1BoxedMap +public record JSONPatchRequestMoveCopy1BoxedMap
+implements [JSONPatchRequestMoveCopy1Boxed](#jsonpatchrequestmovecopy1boxed) + +record that stores validated Map payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| JSONPatchRequestMoveCopy1BoxedMap([JSONPatchRequestMoveCopyMap](#jsonpatchrequestmovecopymap) data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| [JSONPatchRequestMoveCopyMap](#jsonpatchrequestmovecopymap) | data()
validated payload | +| @Nullable Object | getData()
validated payload | + +## JSONPatchRequestMoveCopy1 +public static class JSONPatchRequestMoveCopy1
+extends JsonSchema + +A schema class that validates payloads + +### Code Sample +``` +import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags; +import org.openapijsonschematools.client.configurations.SchemaConfiguration; +import org.openapijsonschematools.client.exceptions.ValidationException; +import org.openapijsonschematools.client.schemas.validation.MapUtils; +import org.openapijsonschematools.client.schemas.validation.FrozenList; +import org.openapijsonschematools.client.schemas.validation.FrozenMap; +import org.openapijsonschematools.client.components.schemas.JSONPatchRequestMoveCopy; + +import java.util.Arrays; +import java.util.List; +import java.util.AbstractMap; + +static final SchemaConfiguration configuration = new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().build()); + +// Map validation +JSONPatchRequestMoveCopy.JSONPatchRequestMoveCopyMap validatedPayload = + JSONPatchRequestMoveCopy.JSONPatchRequestMoveCopy1.validate( + new JSONPatchRequestMoveCopy.JSONPatchRequestMoveCopyMapBuilder() + .from("a") + + .op("move") + + .path("a") + + .build(), + configuration +); +``` + +### Field Summary +| Modifier and Type | Field and Description | +| ----------------- | ---------------------- | +| Set> | type = Set.of(Map.class) | +| Map> | properties = Map.ofEntries(
    new PropertyEntry("from", [From.class](#from))),
    new PropertyEntry("path", [Path.class](#path))),
    new PropertyEntry("op", [Op.class](#op)))
)
| +| Set | required = Set.of(
    "from",
    "op",
    "path"
)
| +| Class | additionalProperties = [AdditionalProperties.class](#additionalproperties) | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| [JSONPatchRequestMoveCopyMap](#jsonpatchrequestmovecopymap) | validate([Map<?, ?>](#jsonpatchrequestmovecopymapbuilder) arg, SchemaConfiguration configuration) | +| [JSONPatchRequestMoveCopy1BoxedMap](#jsonpatchrequestmovecopy1boxedmap) | validateAndBox([Map<?, ?>](#jsonpatchrequestmovecopymapbuilder) arg, SchemaConfiguration configuration) | +| [JSONPatchRequestMoveCopy1Boxed](#jsonpatchrequestmovecopy1boxed) | validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) | +| @Nullable Object | validate(@Nullable Object arg, SchemaConfiguration configuration) | + +## JSONPatchRequestMoveCopyMap000Builder +public class JSONPatchRequestMoveCopyMap000Builder
+builder for `Map` + +A class that builds the Map input type + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| JSONPatchRequestMoveCopyMap000Builder(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 | + +## JSONPatchRequestMoveCopyMap001Builder +public class JSONPatchRequestMoveCopyMap001Builder
+builder for `Map` + +A class that builds the Map input type + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| JSONPatchRequestMoveCopyMap001Builder(Map instance)
Creates a builder that contains the passed instance | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| [JSONPatchRequestMoveCopyMap000Builder](#jsonpatchrequestmovecopymap000builder) | path(String value) | + +## JSONPatchRequestMoveCopyMap010Builder +public class JSONPatchRequestMoveCopyMap010Builder
+builder for `Map` + +A class that builds the Map input type + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| JSONPatchRequestMoveCopyMap010Builder(Map instance)
Creates a builder that contains the passed instance | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| [JSONPatchRequestMoveCopyMap000Builder](#jsonpatchrequestmovecopymap000builder) | op(String value) | +| [JSONPatchRequestMoveCopyMap000Builder](#jsonpatchrequestmovecopymap000builder) | op([StringOpEnums](#stringopenums) value) | + +## JSONPatchRequestMoveCopyMap011Builder +public class JSONPatchRequestMoveCopyMap011Builder
+builder for `Map` + +A class that builds the Map input type + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| JSONPatchRequestMoveCopyMap011Builder(Map instance)
Creates a builder that contains the passed instance | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| [JSONPatchRequestMoveCopyMap001Builder](#jsonpatchrequestmovecopymap001builder) | op(String value) | +| [JSONPatchRequestMoveCopyMap001Builder](#jsonpatchrequestmovecopymap001builder) | op([StringOpEnums](#stringopenums) value) | +| [JSONPatchRequestMoveCopyMap010Builder](#jsonpatchrequestmovecopymap010builder) | path(String value) | + +## JSONPatchRequestMoveCopyMap100Builder +public class JSONPatchRequestMoveCopyMap100Builder
+builder for `Map` + +A class that builds the Map input type + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| JSONPatchRequestMoveCopyMap100Builder(Map instance)
Creates a builder that contains the passed instance | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| [JSONPatchRequestMoveCopyMap000Builder](#jsonpatchrequestmovecopymap000builder) | from(String value) | + +## JSONPatchRequestMoveCopyMap101Builder +public class JSONPatchRequestMoveCopyMap101Builder
+builder for `Map` + +A class that builds the Map input type + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| JSONPatchRequestMoveCopyMap101Builder(Map instance)
Creates a builder that contains the passed instance | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| [JSONPatchRequestMoveCopyMap001Builder](#jsonpatchrequestmovecopymap001builder) | from(String value) | +| [JSONPatchRequestMoveCopyMap100Builder](#jsonpatchrequestmovecopymap100builder) | path(String value) | + +## JSONPatchRequestMoveCopyMap110Builder +public class JSONPatchRequestMoveCopyMap110Builder
+builder for `Map` + +A class that builds the Map input type + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| JSONPatchRequestMoveCopyMap110Builder(Map instance)
Creates a builder that contains the passed instance | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| [JSONPatchRequestMoveCopyMap010Builder](#jsonpatchrequestmovecopymap010builder) | from(String value) | +| [JSONPatchRequestMoveCopyMap100Builder](#jsonpatchrequestmovecopymap100builder) | op(String value) | +| [JSONPatchRequestMoveCopyMap100Builder](#jsonpatchrequestmovecopymap100builder) | op([StringOpEnums](#stringopenums) value) | + +## JSONPatchRequestMoveCopyMapBuilder +public class JSONPatchRequestMoveCopyMapBuilder
+builder for `Map` + +A class that builds the Map input type + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| JSONPatchRequestMoveCopyMapBuilder()
Creates a builder that contains an empty map | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| [JSONPatchRequestMoveCopyMap011Builder](#jsonpatchrequestmovecopymap011builder) | from(String value) | +| [JSONPatchRequestMoveCopyMap101Builder](#jsonpatchrequestmovecopymap101builder) | op(String value) | +| [JSONPatchRequestMoveCopyMap101Builder](#jsonpatchrequestmovecopymap101builder) | op([StringOpEnums](#stringopenums) value) | +| [JSONPatchRequestMoveCopyMap110Builder](#jsonpatchrequestmovecopymap110builder) | path(String value) | + +## JSONPatchRequestMoveCopyMap +public static class JSONPatchRequestMoveCopyMap
+extends FrozenMap + +A class to store validated Map payloads + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| static [JSONPatchRequestMoveCopyMap](#jsonpatchrequestmovecopymap) | of([Map](#jsonpatchrequestmovecopymapbuilder) arg, SchemaConfiguration configuration) | +| String | from()
| +| String | op()
must be one of ["move", "copy"] | +| String | path()
| + +## OpBoxed +public sealed interface OpBoxed
+permits
+[OpBoxedString](#opboxedstring) + +sealed interface that stores validated payloads using boxed classes + +## OpBoxedString +public record OpBoxedString
+implements [OpBoxed](#opboxed) + +record that stores validated String payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| OpBoxedString(String data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| String | data()
validated payload | +| @Nullable Object | getData()
validated payload | + +## Op +public static class Op
+extends JsonSchema + +A schema class that validates payloads + +## Description +The operation to perform. + +### Code Sample +``` +import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags; +import org.openapijsonschematools.client.configurations.SchemaConfiguration; +import org.openapijsonschematools.client.exceptions.ValidationException; +import org.openapijsonschematools.client.schemas.validation.MapUtils; +import org.openapijsonschematools.client.schemas.validation.FrozenList; +import org.openapijsonschematools.client.schemas.validation.FrozenMap; +import org.openapijsonschematools.client.components.schemas.JSONPatchRequestMoveCopy; + +import java.util.Arrays; +import java.util.List; +import java.util.AbstractMap; + +static final SchemaConfiguration configuration = new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().build()); + +// String validation +String validatedPayload = JSONPatchRequestMoveCopy.Op.validate( + "move", + configuration +); +``` + +### Field Summary +| Modifier and Type | Field and Description | +| ----------------- | ---------------------- | +| Set> | type = Set.of(
    String.class
)
| +| Set | enumValues = SetMaker.makeSet(
    "move",
    "copy"
)
| + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| String | validate(String arg, SchemaConfiguration configuration) | +| String | validate([StringOpEnums](#stringopenums) arg, SchemaConfiguration configuration) | +| [OpBoxedString](#opboxedstring) | validateAndBox(String arg, SchemaConfiguration configuration) | +| [OpBoxed](#opboxed) | validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) | +| @Nullable Object | validate(@Nullable Object arg, SchemaConfiguration configuration) | + +## StringOpEnums +public enum StringOpEnums
+extends `Enum` + +A class that stores String enum values + +### Enum Constant Summary +| Enum Constant | Description | +| ------------- | ----------- | +| MOVE | value = "move" | +| COPY | value = "copy" | + +## PathBoxed +public sealed interface PathBoxed
+permits
+[PathBoxedString](#pathboxedstring) + +sealed interface that stores validated payloads using boxed classes + +## PathBoxedString +public record PathBoxedString
+implements [PathBoxed](#pathboxed) + +record that stores validated String payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| PathBoxedString(String data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| String | data()
validated payload | +| @Nullable Object | getData()
validated payload | + +## Path +public static class Path
+extends StringJsonSchema.StringJsonSchema1 + +A schema class that validates payloads + +## Description +A JSON Pointer path. + +| Methods Inherited from class org.openapijsonschematools.client.schemas.StringJsonSchema.StringJsonSchema1 | +| ------------------------------------------------------------------ | +| validate | +| validateAndBox | + +## FromBoxed +public sealed interface FromBoxed
+permits
+[FromBoxedString](#fromboxedstring) + +sealed interface that stores validated payloads using boxed classes + +## FromBoxedString +public record FromBoxedString
+implements [FromBoxed](#fromboxed) + +record that stores validated String payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| FromBoxedString(String data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| String | data()
validated payload | +| @Nullable Object | getData()
validated payload | + +## From +public static class From
+extends StringJsonSchema.StringJsonSchema1 + +A schema class that validates payloads + +## Description +A JSON Pointer path. + +| Methods Inherited from class org.openapijsonschematools.client.schemas.StringJsonSchema.StringJsonSchema1 | +| ------------------------------------------------------------------ | +| validate | +| validateAndBox | + +## 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(Nothing? data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| Nothing? | 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 Component Schemas]](../../../README.md#Component-Schemas) [[Back to README]](../../../README.md) diff --git a/samples/client/petstore/kotlin/docs/components/schemas/JSONPatchRequestRemove.md b/samples/client/petstore/kotlin/docs/components/schemas/JSONPatchRequestRemove.md new file mode 100644 index 00000000000..b204d5c39aa --- /dev/null +++ b/samples/client/petstore/kotlin/docs/components/schemas/JSONPatchRequestRemove.md @@ -0,0 +1,437 @@ +# JSONPatchRequestRemove +org.openapijsonschematools.client.components.schemas.JSONPatchRequestRemove.java +public class JSONPatchRequestRemove
+ +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 | [JSONPatchRequestRemove.JSONPatchRequestRemove1Boxed](#jsonpatchrequestremove1boxed)
sealed interface for validated payloads | +| record | [JSONPatchRequestRemove.JSONPatchRequestRemove1BoxedMap](#jsonpatchrequestremove1boxedmap)
boxed class to store validated Map payloads | +| static class | [JSONPatchRequestRemove.JSONPatchRequestRemove1](#jsonpatchrequestremove1)
schema class | +| static class | [JSONPatchRequestRemove.JSONPatchRequestRemoveMapBuilder](#jsonpatchrequestremovemapbuilder)
builder for Map payloads | +| static class | [JSONPatchRequestRemove.JSONPatchRequestRemoveMap](#jsonpatchrequestremovemap)
output class for Map payloads | +| sealed interface | [JSONPatchRequestRemove.OpBoxed](#opboxed)
sealed interface for validated payloads | +| record | [JSONPatchRequestRemove.OpBoxedString](#opboxedstring)
boxed class to store validated String payloads | +| static class | [JSONPatchRequestRemove.Op](#op)
schema class | +| enum | [JSONPatchRequestRemove.StringOpEnums](#stringopenums)
String enum | +| sealed interface | [JSONPatchRequestRemove.PathBoxed](#pathboxed)
sealed interface for validated payloads | +| record | [JSONPatchRequestRemove.PathBoxedString](#pathboxedstring)
boxed class to store validated String payloads | +| static class | [JSONPatchRequestRemove.Path](#path)
schema class | +| sealed interface | [JSONPatchRequestRemove.AdditionalPropertiesBoxed](#additionalpropertiesboxed)
sealed interface for validated payloads | +| record | [JSONPatchRequestRemove.AdditionalPropertiesBoxedVoid](#additionalpropertiesboxedvoid)
boxed class to store validated null payloads | +| record | [JSONPatchRequestRemove.AdditionalPropertiesBoxedBoolean](#additionalpropertiesboxedboolean)
boxed class to store validated boolean payloads | +| record | [JSONPatchRequestRemove.AdditionalPropertiesBoxedNumber](#additionalpropertiesboxednumber)
boxed class to store validated Number payloads | +| record | [JSONPatchRequestRemove.AdditionalPropertiesBoxedString](#additionalpropertiesboxedstring)
boxed class to store validated String payloads | +| record | [JSONPatchRequestRemove.AdditionalPropertiesBoxedList](#additionalpropertiesboxedlist)
boxed class to store validated List payloads | +| record | [JSONPatchRequestRemove.AdditionalPropertiesBoxedMap](#additionalpropertiesboxedmap)
boxed class to store validated Map payloads | +| static class | [JSONPatchRequestRemove.AdditionalProperties](#additionalproperties)
schema class | + +## JSONPatchRequestRemove1Boxed +public sealed interface JSONPatchRequestRemove1Boxed
+permits
+[JSONPatchRequestRemove1BoxedMap](#jsonpatchrequestremove1boxedmap) + +sealed interface that stores validated payloads using boxed classes + +## JSONPatchRequestRemove1BoxedMap +public record JSONPatchRequestRemove1BoxedMap
+implements [JSONPatchRequestRemove1Boxed](#jsonpatchrequestremove1boxed) + +record that stores validated Map payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| JSONPatchRequestRemove1BoxedMap([JSONPatchRequestRemoveMap](#jsonpatchrequestremovemap) data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| [JSONPatchRequestRemoveMap](#jsonpatchrequestremovemap) | data()
validated payload | +| @Nullable Object | getData()
validated payload | + +## JSONPatchRequestRemove1 +public static class JSONPatchRequestRemove1
+extends JsonSchema + +A schema class that validates payloads + +### Code Sample +``` +import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags; +import org.openapijsonschematools.client.configurations.SchemaConfiguration; +import org.openapijsonschematools.client.exceptions.ValidationException; +import org.openapijsonschematools.client.schemas.validation.MapUtils; +import org.openapijsonschematools.client.schemas.validation.FrozenList; +import org.openapijsonschematools.client.schemas.validation.FrozenMap; +import org.openapijsonschematools.client.components.schemas.JSONPatchRequestRemove; + +import java.util.Arrays; +import java.util.List; +import java.util.AbstractMap; + +static final SchemaConfiguration configuration = new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().build()); + +// Map validation +JSONPatchRequestRemove.JSONPatchRequestRemoveMap validatedPayload = + JSONPatchRequestRemove.JSONPatchRequestRemove1.validate( + new JSONPatchRequestRemove.JSONPatchRequestRemoveMapBuilder() + .op("remove") + + .path("a") + + .build(), + configuration +); +``` + +### Field Summary +| Modifier and Type | Field and Description | +| ----------------- | ---------------------- | +| Set> | type = Set.of(Map.class) | +| Map> | properties = Map.ofEntries(
    new PropertyEntry("path", [Path.class](#path))),
    new PropertyEntry("op", [Op.class](#op)))
)
| +| Set | required = Set.of(
    "op",
    "path"
)
| +| Class | additionalProperties = [AdditionalProperties.class](#additionalproperties) | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| [JSONPatchRequestRemoveMap](#jsonpatchrequestremovemap) | validate([Map<?, ?>](#jsonpatchrequestremovemapbuilder) arg, SchemaConfiguration configuration) | +| [JSONPatchRequestRemove1BoxedMap](#jsonpatchrequestremove1boxedmap) | validateAndBox([Map<?, ?>](#jsonpatchrequestremovemapbuilder) arg, SchemaConfiguration configuration) | +| [JSONPatchRequestRemove1Boxed](#jsonpatchrequestremove1boxed) | validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) | +| @Nullable Object | validate(@Nullable Object arg, SchemaConfiguration configuration) | + +## JSONPatchRequestRemoveMap00Builder +public class JSONPatchRequestRemoveMap00Builder
+builder for `Map` + +A class that builds the Map input type + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| JSONPatchRequestRemoveMap00Builder(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 | + +## JSONPatchRequestRemoveMap01Builder +public class JSONPatchRequestRemoveMap01Builder
+builder for `Map` + +A class that builds the Map input type + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| JSONPatchRequestRemoveMap01Builder(Map instance)
Creates a builder that contains the passed instance | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| [JSONPatchRequestRemoveMap00Builder](#jsonpatchrequestremovemap00builder) | path(String value) | + +## JSONPatchRequestRemoveMap10Builder +public class JSONPatchRequestRemoveMap10Builder
+builder for `Map` + +A class that builds the Map input type + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| JSONPatchRequestRemoveMap10Builder(Map instance)
Creates a builder that contains the passed instance | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| [JSONPatchRequestRemoveMap00Builder](#jsonpatchrequestremovemap00builder) | op(String value) | +| [JSONPatchRequestRemoveMap00Builder](#jsonpatchrequestremovemap00builder) | op([StringOpEnums](#stringopenums) value) | + +## JSONPatchRequestRemoveMapBuilder +public class JSONPatchRequestRemoveMapBuilder
+builder for `Map` + +A class that builds the Map input type + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| JSONPatchRequestRemoveMapBuilder()
Creates a builder that contains an empty map | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| [JSONPatchRequestRemoveMap01Builder](#jsonpatchrequestremovemap01builder) | op(String value) | +| [JSONPatchRequestRemoveMap01Builder](#jsonpatchrequestremovemap01builder) | op([StringOpEnums](#stringopenums) value) | +| [JSONPatchRequestRemoveMap10Builder](#jsonpatchrequestremovemap10builder) | path(String value) | + +## JSONPatchRequestRemoveMap +public static class JSONPatchRequestRemoveMap
+extends FrozenMap + +A class to store validated Map payloads + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| static [JSONPatchRequestRemoveMap](#jsonpatchrequestremovemap) | of([Map](#jsonpatchrequestremovemapbuilder) arg, SchemaConfiguration configuration) | +| String | op()
must be one of ["remove"] | +| String | path()
| + +## OpBoxed +public sealed interface OpBoxed
+permits
+[OpBoxedString](#opboxedstring) + +sealed interface that stores validated payloads using boxed classes + +## OpBoxedString +public record OpBoxedString
+implements [OpBoxed](#opboxed) + +record that stores validated String payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| OpBoxedString(String data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| String | data()
validated payload | +| @Nullable Object | getData()
validated payload | + +## Op +public static class Op
+extends JsonSchema + +A schema class that validates payloads + +## Description +The operation to perform. + +### Code Sample +``` +import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags; +import org.openapijsonschematools.client.configurations.SchemaConfiguration; +import org.openapijsonschematools.client.exceptions.ValidationException; +import org.openapijsonschematools.client.schemas.validation.MapUtils; +import org.openapijsonschematools.client.schemas.validation.FrozenList; +import org.openapijsonschematools.client.schemas.validation.FrozenMap; +import org.openapijsonschematools.client.components.schemas.JSONPatchRequestRemove; + +import java.util.Arrays; +import java.util.List; +import java.util.AbstractMap; + +static final SchemaConfiguration configuration = new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().build()); + +// String validation +String validatedPayload = JSONPatchRequestRemove.Op.validate( + "remove", + configuration +); +``` + +### Field Summary +| Modifier and Type | Field and Description | +| ----------------- | ---------------------- | +| Set> | type = Set.of(
    String.class
)
| +| Set | enumValues = SetMaker.makeSet(
    "remove"
)
| + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| String | validate(String arg, SchemaConfiguration configuration) | +| String | validate([StringOpEnums](#stringopenums) arg, SchemaConfiguration configuration) | +| [OpBoxedString](#opboxedstring) | validateAndBox(String arg, SchemaConfiguration configuration) | +| [OpBoxed](#opboxed) | validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) | +| @Nullable Object | validate(@Nullable Object arg, SchemaConfiguration configuration) | + +## StringOpEnums +public enum StringOpEnums
+extends `Enum` + +A class that stores String enum values + +### Enum Constant Summary +| Enum Constant | Description | +| ------------- | ----------- | +| REMOVE | value = "remove" | + +## PathBoxed +public sealed interface PathBoxed
+permits
+[PathBoxedString](#pathboxedstring) + +sealed interface that stores validated payloads using boxed classes + +## PathBoxedString +public record PathBoxedString
+implements [PathBoxed](#pathboxed) + +record that stores validated String payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| PathBoxedString(String data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| String | data()
validated payload | +| @Nullable Object | getData()
validated payload | + +## Path +public static class Path
+extends StringJsonSchema.StringJsonSchema1 + +A schema class that validates payloads + +## Description +A JSON Pointer path. + +| Methods Inherited from class org.openapijsonschematools.client.schemas.StringJsonSchema.StringJsonSchema1 | +| ------------------------------------------------------------------ | +| validate | +| validateAndBox | + +## 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(Nothing? data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| Nothing? | 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 Component Schemas]](../../../README.md#Component-Schemas) [[Back to README]](../../../README.md) diff --git a/samples/client/petstore/kotlin/docs/components/schemas/Mammal.md b/samples/client/petstore/kotlin/docs/components/schemas/Mammal.md new file mode 100644 index 00000000000..21fe650ab2e --- /dev/null +++ b/samples/client/petstore/kotlin/docs/components/schemas/Mammal.md @@ -0,0 +1,169 @@ +# Mammal +org.openapijsonschematools.client.components.schemas.Mammal.java +public class Mammal
+ +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 + +## Nested Class Summary +| Modifier and Type | Class and Description | +| ----------------- | ---------------------- | +| sealed interface | [Mammal.Mammal1Boxed](#mammal1boxed)
sealed interface for validated payloads | +| record | [Mammal.Mammal1BoxedVoid](#mammal1boxedvoid)
boxed class to store validated null payloads | +| record | [Mammal.Mammal1BoxedBoolean](#mammal1boxedboolean)
boxed class to store validated boolean payloads | +| record | [Mammal.Mammal1BoxedNumber](#mammal1boxednumber)
boxed class to store validated Number payloads | +| record | [Mammal.Mammal1BoxedString](#mammal1boxedstring)
boxed class to store validated String payloads | +| record | [Mammal.Mammal1BoxedList](#mammal1boxedlist)
boxed class to store validated List payloads | +| record | [Mammal.Mammal1BoxedMap](#mammal1boxedmap)
boxed class to store validated Map payloads | +| static class | [Mammal.Mammal1](#mammal1)
schema class | + +## Mammal1Boxed +public sealed interface Mammal1Boxed
+permits
+[Mammal1BoxedVoid](#mammal1boxedvoid), +[Mammal1BoxedBoolean](#mammal1boxedboolean), +[Mammal1BoxedNumber](#mammal1boxednumber), +[Mammal1BoxedString](#mammal1boxedstring), +[Mammal1BoxedList](#mammal1boxedlist), +[Mammal1BoxedMap](#mammal1boxedmap) + +sealed interface that stores validated payloads using boxed classes + +## Mammal1BoxedVoid +public record Mammal1BoxedVoid
+implements [Mammal1Boxed](#mammal1boxed) + +record that stores validated null payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| Mammal1BoxedVoid(Nothing? data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| Nothing? | data()
validated payload | +| @Nullable Object | getData()
validated payload | + +## Mammal1BoxedBoolean +public record Mammal1BoxedBoolean
+implements [Mammal1Boxed](#mammal1boxed) + +record that stores validated boolean payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| Mammal1BoxedBoolean(boolean data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| boolean | data()
validated payload | +| @Nullable Object | getData()
validated payload | + +## Mammal1BoxedNumber +public record Mammal1BoxedNumber
+implements [Mammal1Boxed](#mammal1boxed) + +record that stores validated Number payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| Mammal1BoxedNumber(Number data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| Number | data()
validated payload | +| @Nullable Object | getData()
validated payload | + +## Mammal1BoxedString +public record Mammal1BoxedString
+implements [Mammal1Boxed](#mammal1boxed) + +record that stores validated String payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| Mammal1BoxedString(String data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| String | data()
validated payload | +| @Nullable Object | getData()
validated payload | + +## Mammal1BoxedList +public record Mammal1BoxedList
+implements [Mammal1Boxed](#mammal1boxed) + +record that stores validated List payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| Mammal1BoxedList(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 | + +## Mammal1BoxedMap +public record Mammal1BoxedMap
+implements [Mammal1Boxed](#mammal1boxed) + +record that stores validated Map payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| Mammal1BoxedMap(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 | + +## Mammal1 +public static class Mammal1
+extends JsonSchema + +A schema class that validates payloads + +### Field Summary +| Modifier and Type | Field and Description | +| ----------------- | ---------------------- | +| List> | oneOf = List.of(
    [Whale.Whale1.class](../../components/schemas/Whale.md#whale1),
    [Zebra.Zebra1.class](../../components/schemas/Zebra.md#zebra1),
    [Pig.Pig1.class](../../components/schemas/Pig.md#pig1)
))
| + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| String | validate(String arg, SchemaConfiguration configuration) | +| Nothing? | validate(Nothing? arg, SchemaConfiguration configuration) | +| int | validate(int arg, SchemaConfiguration configuration) | +| long | validate(long arg, SchemaConfiguration configuration) | +| float | validate(float arg, SchemaConfiguration configuration) | +| double | validate(double arg, SchemaConfiguration configuration) | +| Number | validate(Number arg, SchemaConfiguration configuration) | +| boolean | validate(boolean arg, SchemaConfiguration configuration) | +| FrozenMap<@Nullable Object> | validate(Map<?, ?> arg, SchemaConfiguration configuration) | +| FrozenList<@Nullable Object> | validate(List arg, SchemaConfiguration configuration) | +| [Mammal1BoxedString](#mammal1boxedstring) | validateAndBox(String arg, SchemaConfiguration configuration) | +| [Mammal1BoxedVoid](#mammal1boxedvoid) | validateAndBox(Nothing? arg, SchemaConfiguration configuration) | +| [Mammal1BoxedNumber](#mammal1boxednumber) | validateAndBox(Number arg, SchemaConfiguration configuration) | +| [Mammal1BoxedBoolean](#mammal1boxedboolean) | validateAndBox(boolean arg, SchemaConfiguration configuration) | +| [Mammal1BoxedMap](#mammal1boxedmap) | validateAndBox(Map<?, ?> arg, SchemaConfiguration configuration) | +| [Mammal1BoxedList](#mammal1boxedlist) | validateAndBox(List arg, SchemaConfiguration configuration) | +| [Mammal1Boxed](#mammal1boxed) | validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) | +| @Nullable Object | validate(@Nullable Object arg, SchemaConfiguration configuration) | + +[[Back to top]](#top) [[Back to Component Schemas]](../../../README.md#Component-Schemas) [[Back to README]](../../../README.md) diff --git a/samples/client/petstore/kotlin/docs/components/schemas/MapTest.md b/samples/client/petstore/kotlin/docs/components/schemas/MapTest.md new file mode 100644 index 00000000000..22dff0cf5b6 --- /dev/null +++ b/samples/client/petstore/kotlin/docs/components/schemas/MapTest.md @@ -0,0 +1,753 @@ +# MapTest +org.openapijsonschematools.client.components.schemas.MapTest.java +public class MapTest
+ +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 | [MapTest.MapTest1Boxed](#maptest1boxed)
sealed interface for validated payloads | +| record | [MapTest.MapTest1BoxedMap](#maptest1boxedmap)
boxed class to store validated Map payloads | +| static class | [MapTest.MapTest1](#maptest1)
schema class | +| static class | [MapTest.MapTestMapBuilder](#maptestmapbuilder)
builder for Map payloads | +| static class | [MapTest.MapTestMap](#maptestmap)
output class for Map payloads | +| sealed interface | [MapTest.DirectMapBoxed](#directmapboxed)
sealed interface for validated payloads | +| record | [MapTest.DirectMapBoxedMap](#directmapboxedmap)
boxed class to store validated Map payloads | +| static class | [MapTest.DirectMap](#directmap)
schema class | +| static class | [MapTest.DirectMapMapBuilder](#directmapmapbuilder)
builder for Map payloads | +| static class | [MapTest.DirectMapMap](#directmapmap)
output class for Map payloads | +| sealed interface | [MapTest.AdditionalProperties3Boxed](#additionalproperties3boxed)
sealed interface for validated payloads | +| record | [MapTest.AdditionalProperties3BoxedBoolean](#additionalproperties3boxedboolean)
boxed class to store validated boolean payloads | +| static class | [MapTest.AdditionalProperties3](#additionalproperties3)
schema class | +| sealed interface | [MapTest.MapOfEnumStringBoxed](#mapofenumstringboxed)
sealed interface for validated payloads | +| record | [MapTest.MapOfEnumStringBoxedMap](#mapofenumstringboxedmap)
boxed class to store validated Map payloads | +| static class | [MapTest.MapOfEnumString](#mapofenumstring)
schema class | +| static class | [MapTest.MapOfEnumStringMapBuilder](#mapofenumstringmapbuilder)
builder for Map payloads | +| static class | [MapTest.MapOfEnumStringMap](#mapofenumstringmap)
output class for Map payloads | +| sealed interface | [MapTest.AdditionalProperties2Boxed](#additionalproperties2boxed)
sealed interface for validated payloads | +| record | [MapTest.AdditionalProperties2BoxedString](#additionalproperties2boxedstring)
boxed class to store validated String payloads | +| static class | [MapTest.AdditionalProperties2](#additionalproperties2)
schema class | +| enum | [MapTest.StringAdditionalPropertiesEnums](#stringadditionalpropertiesenums)
String enum | +| sealed interface | [MapTest.MapMapOfStringBoxed](#mapmapofstringboxed)
sealed interface for validated payloads | +| record | [MapTest.MapMapOfStringBoxedMap](#mapmapofstringboxedmap)
boxed class to store validated Map payloads | +| static class | [MapTest.MapMapOfString](#mapmapofstring)
schema class | +| static class | [MapTest.MapMapOfStringMapBuilder](#mapmapofstringmapbuilder)
builder for Map payloads | +| static class | [MapTest.MapMapOfStringMap](#mapmapofstringmap)
output class for Map payloads | +| sealed interface | [MapTest.AdditionalPropertiesBoxed](#additionalpropertiesboxed)
sealed interface for validated payloads | +| record | [MapTest.AdditionalPropertiesBoxedMap](#additionalpropertiesboxedmap)
boxed class to store validated Map payloads | +| static class | [MapTest.AdditionalProperties](#additionalproperties)
schema class | +| static class | [MapTest.AdditionalPropertiesMapBuilder1](#additionalpropertiesmapbuilder1)
builder for Map payloads | +| static class | [MapTest.AdditionalPropertiesMap](#additionalpropertiesmap)
output class for Map payloads | +| sealed interface | [MapTest.AdditionalProperties1Boxed](#additionalproperties1boxed)
sealed interface for validated payloads | +| record | [MapTest.AdditionalProperties1BoxedString](#additionalproperties1boxedstring)
boxed class to store validated String payloads | +| static class | [MapTest.AdditionalProperties1](#additionalproperties1)
schema class | + +## MapTest1Boxed +public sealed interface MapTest1Boxed
+permits
+[MapTest1BoxedMap](#maptest1boxedmap) + +sealed interface that stores validated payloads using boxed classes + +## MapTest1BoxedMap +public record MapTest1BoxedMap
+implements [MapTest1Boxed](#maptest1boxed) + +record that stores validated Map payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| MapTest1BoxedMap([MapTestMap](#maptestmap) data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| [MapTestMap](#maptestmap) | data()
validated payload | +| @Nullable Object | getData()
validated payload | + +## MapTest1 +public static class MapTest1
+extends JsonSchema + +A schema class that validates payloads + +### Code Sample +``` +import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags; +import org.openapijsonschematools.client.configurations.SchemaConfiguration; +import org.openapijsonschematools.client.exceptions.ValidationException; +import org.openapijsonschematools.client.schemas.validation.MapUtils; +import org.openapijsonschematools.client.schemas.validation.FrozenList; +import org.openapijsonschematools.client.schemas.validation.FrozenMap; +import org.openapijsonschematools.client.components.schemas.MapTest; + +import java.util.Arrays; +import java.util.List; +import java.util.AbstractMap; + +static final SchemaConfiguration configuration = new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().build()); + +// Map validation +MapTest.MapTestMap validatedPayload = + MapTest.MapTest1.validate( + new MapTest.MapTestMapBuilder() + .map_map_of_string( + MapUtils.makeMap( + new AbstractMap.SimpleEntry>( + "someAdditionalProperty", + MapUtils.makeMap( + new AbstractMap.SimpleEntry( + "someAdditionalProperty", + "a" + ) + ) + ) + ) + ) + .map_of_enum_string( + MapUtils.makeMap( + new AbstractMap.SimpleEntry( + "someAdditionalProperty", + "UPPER" + ) + ) + ) + .direct_map( + MapUtils.makeMap( + new AbstractMap.SimpleEntry( + "someAdditionalProperty", + true + ) + ) + ) + .build(), + configuration +); +``` + +### Field Summary +| Modifier and Type | Field and Description | +| ----------------- | ---------------------- | +| Set> | type = Set.of(Map.class) | +| Map> | properties = Map.ofEntries(
    new PropertyEntry("map_map_of_string", [MapMapOfString.class](#mapmapofstring))),
    new PropertyEntry("map_of_enum_string", [MapOfEnumString.class](#mapofenumstring))),
    new PropertyEntry("direct_map", [DirectMap.class](#directmap))),
    new PropertyEntry("indirect_map", [StringBooleanMap.StringBooleanMap1.class](../../components/schemas/StringBooleanMap.md#stringbooleanmap1))
)
| + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| [MapTestMap](#maptestmap) | validate([Map<?, ?>](#maptestmapbuilder) arg, SchemaConfiguration configuration) | +| [MapTest1BoxedMap](#maptest1boxedmap) | validateAndBox([Map<?, ?>](#maptestmapbuilder) arg, SchemaConfiguration configuration) | +| [MapTest1Boxed](#maptest1boxed) | validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) | +| @Nullable Object | validate(@Nullable Object arg, SchemaConfiguration configuration) | + +## MapTestMapBuilder +public class MapTestMapBuilder
+builder for `Map` + +A class that builds the Map input type + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| MapTestMapBuilder()
Creates a builder that contains an empty map | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| Map | build()
Returns map input that should be used with Schema.validate | +| [MapTestMapBuilder](#maptestmapbuilder) | map_map_of_string(Map> value) | +| [MapTestMapBuilder](#maptestmapbuilder) | map_of_enum_string(Map value) | +| [MapTestMapBuilder](#maptestmapbuilder) | direct_map(Map value) | +| [MapTestMapBuilder](#maptestmapbuilder) | indirect_map(Map value) | +| [MapTestMapBuilder](#maptestmapbuilder) | additionalProperty(String key, Nothing? value) | +| [MapTestMapBuilder](#maptestmapbuilder) | additionalProperty(String key, boolean value) | +| [MapTestMapBuilder](#maptestmapbuilder) | additionalProperty(String key, String value) | +| [MapTestMapBuilder](#maptestmapbuilder) | additionalProperty(String key, int value) | +| [MapTestMapBuilder](#maptestmapbuilder) | additionalProperty(String key, float value) | +| [MapTestMapBuilder](#maptestmapbuilder) | additionalProperty(String key, long value) | +| [MapTestMapBuilder](#maptestmapbuilder) | additionalProperty(String key, double value) | +| [MapTestMapBuilder](#maptestmapbuilder) | additionalProperty(String key, List value) | +| [MapTestMapBuilder](#maptestmapbuilder) | additionalProperty(String key, Map value) | + +## MapTestMap +public static class MapTestMap
+extends FrozenMap + +A class to store validated Map payloads + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| static [MapTestMap](#maptestmap) | of([Map](#maptestmapbuilder) arg, SchemaConfiguration configuration) | +| [MapMapOfStringMap](#mapmapofstringmap) | map_map_of_string()
[optional] | +| [MapOfEnumStringMap](#mapofenumstringmap) | map_of_enum_string()
[optional] | +| [DirectMapMap](#directmapmap) | direct_map()
[optional] | +| [StringBooleanMap.StringBooleanMapMap](../../components/schemas/StringBooleanMap.md#stringbooleanmapmap) | indirect_map()
[optional] | +| @Nullable Object | getAdditionalProperty(String name)
provides type safety for additional properties | + +## DirectMapBoxed +public sealed interface DirectMapBoxed
+permits
+[DirectMapBoxedMap](#directmapboxedmap) + +sealed interface that stores validated payloads using boxed classes + +## DirectMapBoxedMap +public record DirectMapBoxedMap
+implements [DirectMapBoxed](#directmapboxed) + +record that stores validated Map payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| DirectMapBoxedMap([DirectMapMap](#directmapmap) data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| [DirectMapMap](#directmapmap) | data()
validated payload | +| @Nullable Object | getData()
validated payload | + +## DirectMap +public static class DirectMap
+extends JsonSchema + +A schema class that validates payloads + +### Code Sample +``` +import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags; +import org.openapijsonschematools.client.configurations.SchemaConfiguration; +import org.openapijsonschematools.client.exceptions.ValidationException; +import org.openapijsonschematools.client.schemas.validation.MapUtils; +import org.openapijsonschematools.client.schemas.validation.FrozenList; +import org.openapijsonschematools.client.schemas.validation.FrozenMap; +import org.openapijsonschematools.client.components.schemas.MapTest; + +import java.util.Arrays; +import java.util.List; +import java.util.AbstractMap; + +static final SchemaConfiguration configuration = new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().build()); + +// Map validation +MapTest.DirectMapMap validatedPayload = + MapTest.DirectMap.validate( + new MapTest.DirectMapMapBuilder() + .additionalProperty("someAdditionalProperty", true) + + .build(), + configuration +); +``` + +### Field Summary +| Modifier and Type | Field and Description | +| ----------------- | ---------------------- | +| Set> | type = Set.of(Map.class) | +| Class | additionalProperties = [AdditionalProperties3.class](#additionalproperties3) | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| [DirectMapMap](#directmapmap) | validate([Map<?, ?>](#directmapmapbuilder) arg, SchemaConfiguration configuration) | +| [DirectMapBoxedMap](#directmapboxedmap) | validateAndBox([Map<?, ?>](#directmapmapbuilder) arg, SchemaConfiguration configuration) | +| [DirectMapBoxed](#directmapboxed) | validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) | +| @Nullable Object | validate(@Nullable Object arg, SchemaConfiguration configuration) | + +## DirectMapMapBuilder +public class DirectMapMapBuilder
+builder for `Map` + +A class that builds the Map input type + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| DirectMapMapBuilder()
Creates a builder that contains an empty map | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| Map | build()
Returns map input that should be used with Schema.validate | +| [DirectMapMapBuilder](#directmapmapbuilder) | additionalProperty(String key, boolean value) | + +## DirectMapMap +public static class DirectMapMap
+extends FrozenMap + +A class to store validated Map payloads + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| static [DirectMapMap](#directmapmap) | of([Map](#directmapmapbuilder) arg, SchemaConfiguration configuration) | +| boolean | getAdditionalProperty(String name)
provides type safety for additional properties | + +## AdditionalProperties3Boxed +public sealed interface AdditionalProperties3Boxed
+permits
+[AdditionalProperties3BoxedBoolean](#additionalproperties3boxedboolean) + +sealed interface that stores validated payloads using boxed classes + +## AdditionalProperties3BoxedBoolean +public record AdditionalProperties3BoxedBoolean
+implements [AdditionalProperties3Boxed](#additionalproperties3boxed) + +record that stores validated boolean payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| AdditionalProperties3BoxedBoolean(boolean data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| boolean | data()
validated payload | +| @Nullable Object | getData()
validated payload | + +## AdditionalProperties3 +public static class AdditionalProperties3
+extends BooleanJsonSchema.BooleanJsonSchema1 + +A schema class that validates payloads + +| Methods Inherited from class org.openapijsonschematools.client.schemas.BooleanJsonSchema.BooleanJsonSchema1 | +| ------------------------------------------------------------------ | +| validate | +| validateAndBox | + +## MapOfEnumStringBoxed +public sealed interface MapOfEnumStringBoxed
+permits
+[MapOfEnumStringBoxedMap](#mapofenumstringboxedmap) + +sealed interface that stores validated payloads using boxed classes + +## MapOfEnumStringBoxedMap +public record MapOfEnumStringBoxedMap
+implements [MapOfEnumStringBoxed](#mapofenumstringboxed) + +record that stores validated Map payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| MapOfEnumStringBoxedMap([MapOfEnumStringMap](#mapofenumstringmap) data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| [MapOfEnumStringMap](#mapofenumstringmap) | data()
validated payload | +| @Nullable Object | getData()
validated payload | + +## MapOfEnumString +public static class MapOfEnumString
+extends JsonSchema + +A schema class that validates payloads + +### Code Sample +``` +import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags; +import org.openapijsonschematools.client.configurations.SchemaConfiguration; +import org.openapijsonschematools.client.exceptions.ValidationException; +import org.openapijsonschematools.client.schemas.validation.MapUtils; +import org.openapijsonschematools.client.schemas.validation.FrozenList; +import org.openapijsonschematools.client.schemas.validation.FrozenMap; +import org.openapijsonschematools.client.components.schemas.MapTest; + +import java.util.Arrays; +import java.util.List; +import java.util.AbstractMap; + +static final SchemaConfiguration configuration = new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().build()); + +// Map validation +MapTest.MapOfEnumStringMap validatedPayload = + MapTest.MapOfEnumString.validate( + new MapTest.MapOfEnumStringMapBuilder() + .additionalProperty("someAdditionalProperty", "UPPER") + + .build(), + configuration +); +``` + +### Field Summary +| Modifier and Type | Field and Description | +| ----------------- | ---------------------- | +| Set> | type = Set.of(Map.class) | +| Class | additionalProperties = [AdditionalProperties2.class](#additionalproperties2) | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| [MapOfEnumStringMap](#mapofenumstringmap) | validate([Map<?, ?>](#mapofenumstringmapbuilder) arg, SchemaConfiguration configuration) | +| [MapOfEnumStringBoxedMap](#mapofenumstringboxedmap) | validateAndBox([Map<?, ?>](#mapofenumstringmapbuilder) arg, SchemaConfiguration configuration) | +| [MapOfEnumStringBoxed](#mapofenumstringboxed) | validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) | +| @Nullable Object | validate(@Nullable Object arg, SchemaConfiguration configuration) | + +## MapOfEnumStringMapBuilder +public class MapOfEnumStringMapBuilder
+builder for `Map` + +A class that builds the Map input type + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| MapOfEnumStringMapBuilder()
Creates a builder that contains an empty map | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| Map | build()
Returns map input that should be used with Schema.validate | +| [MapOfEnumStringMapBuilder](#mapofenumstringmapbuilder) | additionalProperty(String key, String value) | +| [MapOfEnumStringMapBuilder](#mapofenumstringmapbuilder) | additionalProperty(String key, [StringAdditionalPropertiesEnums](#stringadditionalpropertiesenums) value) | + +## MapOfEnumStringMap +public static class MapOfEnumStringMap
+extends FrozenMap + +A class to store validated Map payloads + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| static [MapOfEnumStringMap](#mapofenumstringmap) | of([Map](#mapofenumstringmapbuilder) arg, SchemaConfiguration configuration) | +| String | getAdditionalProperty(String name)
provides type safety for additional properties | + +## AdditionalProperties2Boxed +public sealed interface AdditionalProperties2Boxed
+permits
+[AdditionalProperties2BoxedString](#additionalproperties2boxedstring) + +sealed interface that stores validated payloads using boxed classes + +## AdditionalProperties2BoxedString +public record AdditionalProperties2BoxedString
+implements [AdditionalProperties2Boxed](#additionalproperties2boxed) + +record that stores validated String payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| AdditionalProperties2BoxedString(String data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| String | data()
validated payload | +| @Nullable Object | getData()
validated payload | + +## AdditionalProperties2 +public static class AdditionalProperties2
+extends JsonSchema + +A schema class that validates payloads + +### Code Sample +``` +import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags; +import org.openapijsonschematools.client.configurations.SchemaConfiguration; +import org.openapijsonschematools.client.exceptions.ValidationException; +import org.openapijsonschematools.client.schemas.validation.MapUtils; +import org.openapijsonschematools.client.schemas.validation.FrozenList; +import org.openapijsonschematools.client.schemas.validation.FrozenMap; +import org.openapijsonschematools.client.components.schemas.MapTest; + +import java.util.Arrays; +import java.util.List; +import java.util.AbstractMap; + +static final SchemaConfiguration configuration = new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().build()); + +// String validation +String validatedPayload = MapTest.AdditionalProperties2.validate( + "UPPER", + configuration +); +``` + +### Field Summary +| Modifier and Type | Field and Description | +| ----------------- | ---------------------- | +| Set> | type = Set.of(
    String.class
)
| +| Set | enumValues = SetMaker.makeSet(
    "UPPER",
    "lower"
)
| + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| String | validate(String arg, SchemaConfiguration configuration) | +| String | validate([StringAdditionalPropertiesEnums](#stringadditionalpropertiesenums) arg, SchemaConfiguration configuration) | +| [AdditionalProperties2BoxedString](#additionalproperties2boxedstring) | validateAndBox(String arg, SchemaConfiguration configuration) | +| [AdditionalProperties2Boxed](#additionalproperties2boxed) | validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) | +| @Nullable Object | validate(@Nullable Object arg, SchemaConfiguration configuration) | + +## StringAdditionalPropertiesEnums +public enum StringAdditionalPropertiesEnums
+extends `Enum` + +A class that stores String enum values + +### Enum Constant Summary +| Enum Constant | Description | +| ------------- | ----------- | +| UPPER | value = "UPPER" | +| LOWER | value = "lower" | + +## MapMapOfStringBoxed +public sealed interface MapMapOfStringBoxed
+permits
+[MapMapOfStringBoxedMap](#mapmapofstringboxedmap) + +sealed interface that stores validated payloads using boxed classes + +## MapMapOfStringBoxedMap +public record MapMapOfStringBoxedMap
+implements [MapMapOfStringBoxed](#mapmapofstringboxed) + +record that stores validated Map payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| MapMapOfStringBoxedMap([MapMapOfStringMap](#mapmapofstringmap) data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| [MapMapOfStringMap](#mapmapofstringmap) | data()
validated payload | +| @Nullable Object | getData()
validated payload | + +## MapMapOfString +public static class MapMapOfString
+extends JsonSchema + +A schema class that validates payloads + +### Code Sample +``` +import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags; +import org.openapijsonschematools.client.configurations.SchemaConfiguration; +import org.openapijsonschematools.client.exceptions.ValidationException; +import org.openapijsonschematools.client.schemas.validation.MapUtils; +import org.openapijsonschematools.client.schemas.validation.FrozenList; +import org.openapijsonschematools.client.schemas.validation.FrozenMap; +import org.openapijsonschematools.client.components.schemas.MapTest; + +import java.util.Arrays; +import java.util.List; +import java.util.AbstractMap; + +static final SchemaConfiguration configuration = new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().build()); + +// Map validation +MapTest.MapMapOfStringMap validatedPayload = + MapTest.MapMapOfString.validate( + new MapTest.MapMapOfStringMapBuilder() + .additionalProperty( + "someAdditionalProperty", + MapUtils.makeMap( + new AbstractMap.SimpleEntry( + "someAdditionalProperty", + "a" + ) + ) + ) + .build(), + configuration +); +``` + +### Field Summary +| Modifier and Type | Field and Description | +| ----------------- | ---------------------- | +| Set> | type = Set.of(Map.class) | +| Class | additionalProperties = [AdditionalProperties.class](#additionalproperties) | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| [MapMapOfStringMap](#mapmapofstringmap) | validate([Map<?, ?>](#mapmapofstringmapbuilder) arg, SchemaConfiguration configuration) | +| [MapMapOfStringBoxedMap](#mapmapofstringboxedmap) | validateAndBox([Map<?, ?>](#mapmapofstringmapbuilder) arg, SchemaConfiguration configuration) | +| [MapMapOfStringBoxed](#mapmapofstringboxed) | validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) | +| @Nullable Object | validate(@Nullable Object arg, SchemaConfiguration configuration) | + +## MapMapOfStringMapBuilder +public class MapMapOfStringMapBuilder
+builder for `Map>` + +A class that builds the Map input type + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| MapMapOfStringMapBuilder()
Creates a builder that contains an empty map | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| Map> | build()
Returns map input that should be used with Schema.validate | +| [MapMapOfStringMapBuilder](#mapmapofstringmapbuilder) | additionalProperty(String key, Map value) | + +## MapMapOfStringMap +public static class MapMapOfStringMap
+extends FrozenMap + +A class to store validated Map payloads + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| static [MapMapOfStringMap](#mapmapofstringmap) | of([Map>](#mapmapofstringmapbuilder) arg, SchemaConfiguration configuration) | +| [AdditionalPropertiesMap](#additionalpropertiesmap) | getAdditionalProperty(String name)
provides type safety for additional properties | + +## AdditionalPropertiesBoxed +public sealed interface AdditionalPropertiesBoxed
+permits
+[AdditionalPropertiesBoxedMap](#additionalpropertiesboxedmap) + +sealed interface that stores validated payloads using boxed classes + +## AdditionalPropertiesBoxedMap +public record AdditionalPropertiesBoxedMap
+implements [AdditionalPropertiesBoxed](#additionalpropertiesboxed) + +record that stores validated Map payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| AdditionalPropertiesBoxedMap([AdditionalPropertiesMap](#additionalpropertiesmap) data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| [AdditionalPropertiesMap](#additionalpropertiesmap) | data()
validated payload | +| @Nullable Object | getData()
validated payload | + +## AdditionalProperties +public static class AdditionalProperties
+extends JsonSchema + +A schema class that validates payloads + +### Code Sample +``` +import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags; +import org.openapijsonschematools.client.configurations.SchemaConfiguration; +import org.openapijsonschematools.client.exceptions.ValidationException; +import org.openapijsonschematools.client.schemas.validation.MapUtils; +import org.openapijsonschematools.client.schemas.validation.FrozenList; +import org.openapijsonschematools.client.schemas.validation.FrozenMap; +import org.openapijsonschematools.client.components.schemas.MapTest; + +import java.util.Arrays; +import java.util.List; +import java.util.AbstractMap; + +static final SchemaConfiguration configuration = new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().build()); + +// Map validation +MapTest.AdditionalPropertiesMap validatedPayload = + MapTest.AdditionalProperties.validate( + new MapTest.AdditionalPropertiesMapBuilder1() + .additionalProperty("someAdditionalProperty", "a") + + .build(), + configuration +); +``` + +### Field Summary +| Modifier and Type | Field and Description | +| ----------------- | ---------------------- | +| Set> | type = Set.of(Map.class) | +| Class | additionalProperties = [AdditionalProperties1.class](#additionalproperties1) | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| [AdditionalPropertiesMap](#additionalpropertiesmap) | validate([Map<?, ?>](#additionalpropertiesmapbuilder1) arg, SchemaConfiguration configuration) | +| [AdditionalPropertiesBoxedMap](#additionalpropertiesboxedmap) | validateAndBox([Map<?, ?>](#additionalpropertiesmapbuilder1) arg, SchemaConfiguration configuration) | +| [AdditionalPropertiesBoxed](#additionalpropertiesboxed) | validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) | +| @Nullable Object | validate(@Nullable Object arg, SchemaConfiguration configuration) | + +## AdditionalPropertiesMapBuilder1 +public class AdditionalPropertiesMapBuilder1
+builder for `Map` + +A class that builds the Map input type + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| AdditionalPropertiesMapBuilder1()
Creates a builder that contains an empty map | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| Map | build()
Returns map input that should be used with Schema.validate | +| [AdditionalPropertiesMapBuilder1](#additionalpropertiesmapbuilder1) | additionalProperty(String key, String value) | + +## AdditionalPropertiesMap +public static class AdditionalPropertiesMap
+extends FrozenMap + +A class to store validated Map payloads + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| static [AdditionalPropertiesMap](#additionalpropertiesmap) | of([Map](#additionalpropertiesmapbuilder1) arg, SchemaConfiguration configuration) | +| String | getAdditionalProperty(String name)
provides type safety for additional properties | + +## AdditionalProperties1Boxed +public sealed interface AdditionalProperties1Boxed
+permits
+[AdditionalProperties1BoxedString](#additionalproperties1boxedstring) + +sealed interface that stores validated payloads using boxed classes + +## AdditionalProperties1BoxedString +public record AdditionalProperties1BoxedString
+implements [AdditionalProperties1Boxed](#additionalproperties1boxed) + +record that stores validated String payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| AdditionalProperties1BoxedString(String data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| String | data()
validated payload | +| @Nullable Object | getData()
validated payload | + +## AdditionalProperties1 +public static class AdditionalProperties1
+extends StringJsonSchema.StringJsonSchema1 + +A schema class that validates payloads + +| Methods Inherited from class org.openapijsonschematools.client.schemas.StringJsonSchema.StringJsonSchema1 | +| ------------------------------------------------------------------ | +| validate | +| validateAndBox | + +[[Back to top]](#top) [[Back to Component Schemas]](../../../README.md#Component-Schemas) [[Back to README]](../../../README.md) diff --git a/samples/client/petstore/kotlin/docs/components/schemas/MixedPropertiesAndAdditionalPropertiesClass.md b/samples/client/petstore/kotlin/docs/components/schemas/MixedPropertiesAndAdditionalPropertiesClass.md new file mode 100644 index 00000000000..e7da20d2573 --- /dev/null +++ b/samples/client/petstore/kotlin/docs/components/schemas/MixedPropertiesAndAdditionalPropertiesClass.md @@ -0,0 +1,345 @@ +# MixedPropertiesAndAdditionalPropertiesClass +org.openapijsonschematools.client.components.schemas.MixedPropertiesAndAdditionalPropertiesClass.java +public class MixedPropertiesAndAdditionalPropertiesClass
+ +A class that contains necessary nested +- schema classes (which validate payloads), extends JsonSchema +- sealed interfaces which store validated payloads, java version of a sum type +- boxed classes which store validated payloads, sealed permits class implementations +- classes to store validated map payloads, extends FrozenMap +- classes to build inputs for map payloads + +## Nested Class Summary +| Modifier and Type | Class and Description | +| ----------------- | ---------------------- | +| sealed interface | [MixedPropertiesAndAdditionalPropertiesClass.MixedPropertiesAndAdditionalPropertiesClass1Boxed](#mixedpropertiesandadditionalpropertiesclass1boxed)
sealed interface for validated payloads | +| record | [MixedPropertiesAndAdditionalPropertiesClass.MixedPropertiesAndAdditionalPropertiesClass1BoxedMap](#mixedpropertiesandadditionalpropertiesclass1boxedmap)
boxed class to store validated Map payloads | +| static class | [MixedPropertiesAndAdditionalPropertiesClass.MixedPropertiesAndAdditionalPropertiesClass1](#mixedpropertiesandadditionalpropertiesclass1)
schema class | +| static class | [MixedPropertiesAndAdditionalPropertiesClass.MixedPropertiesAndAdditionalPropertiesClassMapBuilder](#mixedpropertiesandadditionalpropertiesclassmapbuilder)
builder for Map payloads | +| static class | [MixedPropertiesAndAdditionalPropertiesClass.MixedPropertiesAndAdditionalPropertiesClassMap](#mixedpropertiesandadditionalpropertiesclassmap)
output class for Map payloads | +| sealed interface | [MixedPropertiesAndAdditionalPropertiesClass.MapSchemaBoxed](#mapschemaboxed)
sealed interface for validated payloads | +| record | [MixedPropertiesAndAdditionalPropertiesClass.MapSchemaBoxedMap](#mapschemaboxedmap)
boxed class to store validated Map payloads | +| static class | [MixedPropertiesAndAdditionalPropertiesClass.MapSchema](#mapschema)
schema class | +| static class | [MixedPropertiesAndAdditionalPropertiesClass.MapMapBuilder](#mapmapbuilder)
builder for Map payloads | +| static class | [MixedPropertiesAndAdditionalPropertiesClass.MapMap](#mapmap)
output class for Map payloads | +| sealed interface | [MixedPropertiesAndAdditionalPropertiesClass.DateTimeBoxed](#datetimeboxed)
sealed interface for validated payloads | +| record | [MixedPropertiesAndAdditionalPropertiesClass.DateTimeBoxedString](#datetimeboxedstring)
boxed class to store validated String payloads | +| static class | [MixedPropertiesAndAdditionalPropertiesClass.DateTime](#datetime)
schema class | +| sealed interface | [MixedPropertiesAndAdditionalPropertiesClass.UuidSchemaBoxed](#uuidschemaboxed)
sealed interface for validated payloads | +| record | [MixedPropertiesAndAdditionalPropertiesClass.UuidSchemaBoxedString](#uuidschemaboxedstring)
boxed class to store validated String payloads | +| static class | [MixedPropertiesAndAdditionalPropertiesClass.UuidSchema](#uuidschema)
schema class | + +## MixedPropertiesAndAdditionalPropertiesClass1Boxed +public sealed interface MixedPropertiesAndAdditionalPropertiesClass1Boxed
+permits
+[MixedPropertiesAndAdditionalPropertiesClass1BoxedMap](#mixedpropertiesandadditionalpropertiesclass1boxedmap) + +sealed interface that stores validated payloads using boxed classes + +## MixedPropertiesAndAdditionalPropertiesClass1BoxedMap +public record MixedPropertiesAndAdditionalPropertiesClass1BoxedMap
+implements [MixedPropertiesAndAdditionalPropertiesClass1Boxed](#mixedpropertiesandadditionalpropertiesclass1boxed) + +record that stores validated Map payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| MixedPropertiesAndAdditionalPropertiesClass1BoxedMap([MixedPropertiesAndAdditionalPropertiesClassMap](#mixedpropertiesandadditionalpropertiesclassmap) data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| [MixedPropertiesAndAdditionalPropertiesClassMap](#mixedpropertiesandadditionalpropertiesclassmap) | data()
validated payload | +| @Nullable Object | getData()
validated payload | + +## MixedPropertiesAndAdditionalPropertiesClass1 +public static class MixedPropertiesAndAdditionalPropertiesClass1
+extends JsonSchema + +A schema class that validates payloads + +### Code Sample +``` +import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags; +import org.openapijsonschematools.client.configurations.SchemaConfiguration; +import org.openapijsonschematools.client.exceptions.ValidationException; +import org.openapijsonschematools.client.schemas.validation.MapUtils; +import org.openapijsonschematools.client.schemas.validation.FrozenList; +import org.openapijsonschematools.client.schemas.validation.FrozenMap; +import org.openapijsonschematools.client.components.schemas.MixedPropertiesAndAdditionalPropertiesClass; + +import java.util.Arrays; +import java.util.List; +import java.util.AbstractMap; + +static final SchemaConfiguration configuration = new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().build()); + +// Map validation +MixedPropertiesAndAdditionalPropertiesClass.MixedPropertiesAndAdditionalPropertiesClassMap validatedPayload = + MixedPropertiesAndAdditionalPropertiesClass.MixedPropertiesAndAdditionalPropertiesClass1.validate( + new MixedPropertiesAndAdditionalPropertiesClass.MixedPropertiesAndAdditionalPropertiesClassMapBuilder() + .setUuid("046b6c7f-0b8a-43b9-b35d-6489e6daee91") + + .dateTime("1970-01-01T00:00:00.00Z") + + .setMap( + MapUtils.makeMap( + new AbstractMap.SimpleEntry>( + "someAdditionalProperty", + MapUtils.makeMap( + new AbstractMap.SimpleEntry( + "className", + "a" + ), + new AbstractMap.SimpleEntry( + "color", + "a" + ) + ) + ) + ) + ) + .build(), + configuration +); +``` + +### Field Summary +| Modifier and Type | Field and Description | +| ----------------- | ---------------------- | +| Set> | type = Set.of(Map.class) | +| Map> | properties = Map.ofEntries(
    new PropertyEntry("uuid", [UuidSchema.class](#uuidschema))),
    new PropertyEntry("dateTime", [DateTime.class](#datetime))),
    new PropertyEntry("map", [MapSchema.class](#mapschema)))
)
| + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| [MixedPropertiesAndAdditionalPropertiesClassMap](#mixedpropertiesandadditionalpropertiesclassmap) | validate([Map<?, ?>](#mixedpropertiesandadditionalpropertiesclassmapbuilder) arg, SchemaConfiguration configuration) | +| [MixedPropertiesAndAdditionalPropertiesClass1BoxedMap](#mixedpropertiesandadditionalpropertiesclass1boxedmap) | validateAndBox([Map<?, ?>](#mixedpropertiesandadditionalpropertiesclassmapbuilder) arg, SchemaConfiguration configuration) | +| [MixedPropertiesAndAdditionalPropertiesClass1Boxed](#mixedpropertiesandadditionalpropertiesclass1boxed) | validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) | +| @Nullable Object | validate(@Nullable Object arg, SchemaConfiguration configuration) | + +## MixedPropertiesAndAdditionalPropertiesClassMapBuilder +public class MixedPropertiesAndAdditionalPropertiesClassMapBuilder
+builder for `Map` + +A class that builds the Map input type + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| MixedPropertiesAndAdditionalPropertiesClassMapBuilder()
Creates a builder that contains an empty map | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| Map | build()
Returns map input that should be used with Schema.validate | +| [MixedPropertiesAndAdditionalPropertiesClassMapBuilder](#mixedpropertiesandadditionalpropertiesclassmapbuilder) | setUuid(String value) | +| [MixedPropertiesAndAdditionalPropertiesClassMapBuilder](#mixedpropertiesandadditionalpropertiesclassmapbuilder) | dateTime(String value) | +| [MixedPropertiesAndAdditionalPropertiesClassMapBuilder](#mixedpropertiesandadditionalpropertiesclassmapbuilder) | setMap(Map> value) | +| [MixedPropertiesAndAdditionalPropertiesClassMapBuilder](#mixedpropertiesandadditionalpropertiesclassmapbuilder) | additionalProperty(String key, Nothing? value) | +| [MixedPropertiesAndAdditionalPropertiesClassMapBuilder](#mixedpropertiesandadditionalpropertiesclassmapbuilder) | additionalProperty(String key, boolean value) | +| [MixedPropertiesAndAdditionalPropertiesClassMapBuilder](#mixedpropertiesandadditionalpropertiesclassmapbuilder) | additionalProperty(String key, String value) | +| [MixedPropertiesAndAdditionalPropertiesClassMapBuilder](#mixedpropertiesandadditionalpropertiesclassmapbuilder) | additionalProperty(String key, int value) | +| [MixedPropertiesAndAdditionalPropertiesClassMapBuilder](#mixedpropertiesandadditionalpropertiesclassmapbuilder) | additionalProperty(String key, float value) | +| [MixedPropertiesAndAdditionalPropertiesClassMapBuilder](#mixedpropertiesandadditionalpropertiesclassmapbuilder) | additionalProperty(String key, long value) | +| [MixedPropertiesAndAdditionalPropertiesClassMapBuilder](#mixedpropertiesandadditionalpropertiesclassmapbuilder) | additionalProperty(String key, double value) | +| [MixedPropertiesAndAdditionalPropertiesClassMapBuilder](#mixedpropertiesandadditionalpropertiesclassmapbuilder) | additionalProperty(String key, List value) | +| [MixedPropertiesAndAdditionalPropertiesClassMapBuilder](#mixedpropertiesandadditionalpropertiesclassmapbuilder) | additionalProperty(String key, Map value) | + +## MixedPropertiesAndAdditionalPropertiesClassMap +public static class MixedPropertiesAndAdditionalPropertiesClassMap
+extends FrozenMap + +A class to store validated Map payloads + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| static [MixedPropertiesAndAdditionalPropertiesClassMap](#mixedpropertiesandadditionalpropertiesclassmap) | of([Map](#mixedpropertiesandadditionalpropertiesclassmapbuilder) arg, SchemaConfiguration configuration) | +| String | dateTime()
[optional] value must conform to RFC-3339 date-time | +| @Nullable Object | get(String key)
This schema has invalid Java names so this method must be used when you access instance["uuid"], instance["map"], | +| @Nullable Object | getAdditionalProperty(String name)
provides type safety for additional properties | + +## MapSchemaBoxed +public sealed interface MapSchemaBoxed
+permits
+[MapSchemaBoxedMap](#mapschemaboxedmap) + +sealed interface that stores validated payloads using boxed classes + +## MapSchemaBoxedMap +public record MapSchemaBoxedMap
+implements [MapSchemaBoxed](#mapschemaboxed) + +record that stores validated Map payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| MapSchemaBoxedMap([MapMap](#mapmap) data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| [MapMap](#mapmap) | data()
validated payload | +| @Nullable Object | getData()
validated payload | + +## MapSchema +public static class MapSchema
+extends JsonSchema + +A schema class that validates payloads + +### Code Sample +``` +import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags; +import org.openapijsonschematools.client.configurations.SchemaConfiguration; +import org.openapijsonschematools.client.exceptions.ValidationException; +import org.openapijsonschematools.client.schemas.validation.MapUtils; +import org.openapijsonschematools.client.schemas.validation.FrozenList; +import org.openapijsonschematools.client.schemas.validation.FrozenMap; +import org.openapijsonschematools.client.components.schemas.MixedPropertiesAndAdditionalPropertiesClass; + +import java.util.Arrays; +import java.util.List; +import java.util.AbstractMap; + +static final SchemaConfiguration configuration = new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().build()); + +// Map validation +MixedPropertiesAndAdditionalPropertiesClass.MapMap validatedPayload = + MixedPropertiesAndAdditionalPropertiesClass.MapSchema.validate( + new MixedPropertiesAndAdditionalPropertiesClass.MapMapBuilder() + .additionalProperty( + "someAdditionalProperty", + MapUtils.makeMap( + new AbstractMap.SimpleEntry( + "className", + "a" + ), + new AbstractMap.SimpleEntry( + "color", + "a" + ) + ) + ) + .build(), + configuration +); +``` + +### Field Summary +| Modifier and Type | Field and Description | +| ----------------- | ---------------------- | +| Set> | type = Set.of(Map.class) | +| Class | additionalProperties = [Animal.Animal1.class](../../components/schemas/Animal.md#animal1) | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| [MapMap](#mapmap) | validate([Map<?, ?>](#mapmapbuilder) arg, SchemaConfiguration configuration) | +| [MapSchemaBoxedMap](#mapschemaboxedmap) | validateAndBox([Map<?, ?>](#mapmapbuilder) arg, SchemaConfiguration configuration) | +| [MapSchemaBoxed](#mapschemaboxed) | validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) | +| @Nullable Object | validate(@Nullable Object arg, SchemaConfiguration configuration) | + +## MapMapBuilder +public class MapMapBuilder
+builder for `Map>` + +A class that builds the Map input type + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| MapMapBuilder()
Creates a builder that contains an empty map | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| Map> | build()
Returns map input that should be used with Schema.validate | +| [MapMapBuilder](#mapmapbuilder) | additionalProperty(String key, Map value) | + +## MapMap +public static class MapMap
+extends FrozenMap + +A class to store validated Map payloads + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| static [MapMap](#mapmap) | of([Map>](#mapmapbuilder) arg, SchemaConfiguration configuration) | +| [Animal.AnimalMap](../../components/schemas/Animal.md#animalmap) | getAdditionalProperty(String name)
provides type safety for additional properties | + +## DateTimeBoxed +public sealed interface DateTimeBoxed
+permits
+[DateTimeBoxedString](#datetimeboxedstring) + +sealed interface that stores validated payloads using boxed classes + +## DateTimeBoxedString +public record DateTimeBoxedString
+implements [DateTimeBoxed](#datetimeboxed) + +record that stores validated String payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| DateTimeBoxedString(String data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| String | data()
validated payload | +| @Nullable Object | getData()
validated payload | + +## DateTime +public static class DateTime
+extends DateTimeJsonSchema.DateTimeJsonSchema1 + +A schema class that validates payloads + +| Methods Inherited from class org.openapijsonschematools.client.schemas.DateTimeJsonSchema.DateTimeJsonSchema1 | +| ------------------------------------------------------------------ | +| validate | +| validateAndBox | + +## UuidSchemaBoxed +public sealed interface UuidSchemaBoxed
+permits
+[UuidSchemaBoxedString](#uuidschemaboxedstring) + +sealed interface that stores validated payloads using boxed classes + +## UuidSchemaBoxedString +public record UuidSchemaBoxedString
+implements [UuidSchemaBoxed](#uuidschemaboxed) + +record that stores validated String payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| UuidSchemaBoxedString(String data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| String | data()
validated payload | +| @Nullable Object | getData()
validated payload | + +## UuidSchema +public static class UuidSchema
+extends UuidJsonSchema.UuidJsonSchema1 + +A schema class that validates payloads + +| Methods Inherited from class org.openapijsonschematools.client.schemas.UuidJsonSchema.UuidJsonSchema1 | +| ------------------------------------------------------------------ | +| validate | +| validateAndBox | + +[[Back to top]](#top) [[Back to Component Schemas]](../../../README.md#Component-Schemas) [[Back to README]](../../../README.md) diff --git a/samples/client/petstore/kotlin/docs/components/schemas/Money.md b/samples/client/petstore/kotlin/docs/components/schemas/Money.md new file mode 100644 index 00000000000..80ee219f343 --- /dev/null +++ b/samples/client/petstore/kotlin/docs/components/schemas/Money.md @@ -0,0 +1,347 @@ +# Money +org.openapijsonschematools.client.components.schemas.Money.java +public class Money
+ +A class that contains necessary nested +- schema classes (which validate payloads), extends JsonSchema +- sealed interfaces which store validated payloads, java version of a sum type +- boxed classes which store validated payloads, sealed permits class implementations +- classes to store validated map payloads, extends FrozenMap +- classes to build inputs for map payloads + +## Nested Class Summary +| Modifier and Type | Class and Description | +| ----------------- | ---------------------- | +| sealed interface | [Money.Money1Boxed](#money1boxed)
sealed interface for validated payloads | +| record | [Money.Money1BoxedMap](#money1boxedmap)
boxed class to store validated Map payloads | +| static class | [Money.Money1](#money1)
schema class | +| static class | [Money.MoneyMapBuilder](#moneymapbuilder)
builder for Map payloads | +| static class | [Money.MoneyMap](#moneymap)
output class for Map payloads | +| sealed interface | [Money.AmountBoxed](#amountboxed)
sealed interface for validated payloads | +| record | [Money.AmountBoxedString](#amountboxedstring)
boxed class to store validated String payloads | +| static class | [Money.Amount](#amount)
schema class | +| sealed interface | [Money.AdditionalPropertiesBoxed](#additionalpropertiesboxed)
sealed interface for validated payloads | +| record | [Money.AdditionalPropertiesBoxedVoid](#additionalpropertiesboxedvoid)
boxed class to store validated null payloads | +| record | [Money.AdditionalPropertiesBoxedBoolean](#additionalpropertiesboxedboolean)
boxed class to store validated boolean payloads | +| record | [Money.AdditionalPropertiesBoxedNumber](#additionalpropertiesboxednumber)
boxed class to store validated Number payloads | +| record | [Money.AdditionalPropertiesBoxedString](#additionalpropertiesboxedstring)
boxed class to store validated String payloads | +| record | [Money.AdditionalPropertiesBoxedList](#additionalpropertiesboxedlist)
boxed class to store validated List payloads | +| record | [Money.AdditionalPropertiesBoxedMap](#additionalpropertiesboxedmap)
boxed class to store validated Map payloads | +| static class | [Money.AdditionalProperties](#additionalproperties)
schema class | + +## Money1Boxed +public sealed interface Money1Boxed
+permits
+[Money1BoxedMap](#money1boxedmap) + +sealed interface that stores validated payloads using boxed classes + +## Money1BoxedMap +public record Money1BoxedMap
+implements [Money1Boxed](#money1boxed) + +record that stores validated Map payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| Money1BoxedMap([MoneyMap](#moneymap) data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| [MoneyMap](#moneymap) | data()
validated payload | +| @Nullable Object | getData()
validated payload | + +## Money1 +public static class Money1
+extends JsonSchema + +A schema class that validates payloads + +### Code Sample +``` +import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags; +import org.openapijsonschematools.client.configurations.SchemaConfiguration; +import org.openapijsonschematools.client.exceptions.ValidationException; +import org.openapijsonschematools.client.schemas.validation.MapUtils; +import org.openapijsonschematools.client.schemas.validation.FrozenList; +import org.openapijsonschematools.client.schemas.validation.FrozenMap; +import org.openapijsonschematools.client.components.schemas.Money; + +import java.util.Arrays; +import java.util.List; +import java.util.AbstractMap; + +static final SchemaConfiguration configuration = new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().build()); + +// Map validation +Money.MoneyMap validatedPayload = + Money.Money1.validate( + new Money.MoneyMapBuilder() + .amount("3.14") + + .currency("eur") + + .build(), + configuration +); +``` + +### Field Summary +| Modifier and Type | Field and Description | +| ----------------- | ---------------------- | +| Set> | type = Set.of(Map.class) | +| Map> | properties = Map.ofEntries(
    new PropertyEntry("amount", [Amount.class](#amount))),
    new PropertyEntry("currency", [Currency.Currency1.class](../../components/schemas/Currency.md#currency1))
)
| +| Set | required = Set.of(
    "amount",
    "currency"
)
| +| Class | additionalProperties = [AdditionalProperties.class](#additionalproperties) | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| [MoneyMap](#moneymap) | validate([Map<?, ?>](#moneymapbuilder) arg, SchemaConfiguration configuration) | +| [Money1BoxedMap](#money1boxedmap) | validateAndBox([Map<?, ?>](#moneymapbuilder) arg, SchemaConfiguration configuration) | +| [Money1Boxed](#money1boxed) | validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) | +| @Nullable Object | validate(@Nullable Object arg, SchemaConfiguration configuration) | + +## MoneyMap00Builder +public class MoneyMap00Builder
+builder for `Map` + +A class that builds the Map input type + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| MoneyMap00Builder(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 | + +## MoneyMap01Builder +public class MoneyMap01Builder
+builder for `Map` + +A class that builds the Map input type + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| MoneyMap01Builder(Map instance)
Creates a builder that contains the passed instance | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| [MoneyMap00Builder](#moneymap00builder) | currency(String value) | +| [MoneyMap00Builder](#moneymap00builder) | currency([Currency.StringCurrencyEnums](../../components/schemas/Currency.md#stringcurrencyenums) value) | + +## MoneyMap10Builder +public class MoneyMap10Builder
+builder for `Map` + +A class that builds the Map input type + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| MoneyMap10Builder(Map instance)
Creates a builder that contains the passed instance | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| [MoneyMap00Builder](#moneymap00builder) | amount(String value) | + +## MoneyMapBuilder +public class MoneyMapBuilder
+builder for `Map` + +A class that builds the Map input type + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| MoneyMapBuilder()
Creates a builder that contains an empty map | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| [MoneyMap01Builder](#moneymap01builder) | amount(String value) | +| [MoneyMap10Builder](#moneymap10builder) | currency(String value) | +| [MoneyMap10Builder](#moneymap10builder) | currency([Currency.StringCurrencyEnums](../../components/schemas/Currency.md#stringcurrencyenums) value) | + +## MoneyMap +public static class MoneyMap
+extends FrozenMap + +A class to store validated Map payloads + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| static [MoneyMap](#moneymap) | of([Map](#moneymapbuilder) arg, SchemaConfiguration configuration) | +| String | amount()
value must be int or float numeric | +| String | currency()
| + +## AmountBoxed +public sealed interface AmountBoxed
+permits
+[AmountBoxedString](#amountboxedstring) + +sealed interface that stores validated payloads using boxed classes + +## AmountBoxedString +public record AmountBoxedString
+implements [AmountBoxed](#amountboxed) + +record that stores validated String payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| AmountBoxedString(String data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| String | data()
validated payload | +| @Nullable Object | getData()
validated payload | + +## Amount +public static class Amount
+extends DecimalJsonSchema.DecimalJsonSchema1 + +A schema class that validates payloads + +| Methods Inherited from class org.openapijsonschematools.client.schemas.DecimalJsonSchema.DecimalJsonSchema1 | +| ------------------------------------------------------------------ | +| validate | +| validateAndBox | + +## 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(Nothing? data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| Nothing? | 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 Component Schemas]](../../../README.md#Component-Schemas) [[Back to README]](../../../README.md) diff --git a/samples/client/petstore/kotlin/docs/components/schemas/MultiPropertiesSchema.md b/samples/client/petstore/kotlin/docs/components/schemas/MultiPropertiesSchema.md new file mode 100644 index 00000000000..4cc7860079a --- /dev/null +++ b/samples/client/petstore/kotlin/docs/components/schemas/MultiPropertiesSchema.md @@ -0,0 +1,463 @@ +# MultiPropertiesSchema +org.openapijsonschematools.client.components.schemas.MultiPropertiesSchema.java +public class MultiPropertiesSchema
+ +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 list payloads, extends FrozenList +- classes to build inputs for list payloads +- classes to store validated map payloads, extends FrozenMap +- classes to build inputs for map payloads + +## Nested Class Summary +| Modifier and Type | Class and Description | +| ----------------- | ---------------------- | +| sealed interface | [MultiPropertiesSchema.MultiPropertiesSchema1Boxed](#multipropertiesschema1boxed)
sealed interface for validated payloads | +| record | [MultiPropertiesSchema.MultiPropertiesSchema1BoxedMap](#multipropertiesschema1boxedmap)
boxed class to store validated Map payloads | +| static class | [MultiPropertiesSchema.MultiPropertiesSchema1](#multipropertiesschema1)
schema class | +| static class | [MultiPropertiesSchema.MultiPropertiesSchemaMapBuilder](#multipropertiesschemamapbuilder)
builder for Map payloads | +| static class | [MultiPropertiesSchema.MultiPropertiesSchemaMap](#multipropertiesschemamap)
output class for Map payloads | +| sealed interface | [MultiPropertiesSchema.DataBoxed](#databoxed)
sealed interface for validated payloads | +| record | [MultiPropertiesSchema.DataBoxedList](#databoxedlist)
boxed class to store validated List payloads | +| static class | [MultiPropertiesSchema.Data](#data)
schema class | +| static class | [MultiPropertiesSchema.DataListBuilder](#datalistbuilder)
builder for List payloads | +| static class | [MultiPropertiesSchema.DataList](#datalist)
output class for List payloads | +| sealed interface | [MultiPropertiesSchema.MessageBoxed](#messageboxed)
sealed interface for validated payloads | +| record | [MultiPropertiesSchema.MessageBoxedString](#messageboxedstring)
boxed class to store validated String payloads | +| static class | [MultiPropertiesSchema.Message](#message)
schema class | +| sealed interface | [MultiPropertiesSchema.StatusBoxed](#statusboxed)
sealed interface for validated payloads | +| record | [MultiPropertiesSchema.StatusBoxedNumber](#statusboxednumber)
boxed class to store validated Number payloads | +| static class | [MultiPropertiesSchema.Status](#status)
schema class | +| sealed interface | [MultiPropertiesSchema.AdditionalPropertiesBoxed](#additionalpropertiesboxed)
sealed interface for validated payloads | +| record | [MultiPropertiesSchema.AdditionalPropertiesBoxedVoid](#additionalpropertiesboxedvoid)
boxed class to store validated null payloads | +| record | [MultiPropertiesSchema.AdditionalPropertiesBoxedBoolean](#additionalpropertiesboxedboolean)
boxed class to store validated boolean payloads | +| record | [MultiPropertiesSchema.AdditionalPropertiesBoxedNumber](#additionalpropertiesboxednumber)
boxed class to store validated Number payloads | +| record | [MultiPropertiesSchema.AdditionalPropertiesBoxedString](#additionalpropertiesboxedstring)
boxed class to store validated String payloads | +| record | [MultiPropertiesSchema.AdditionalPropertiesBoxedList](#additionalpropertiesboxedlist)
boxed class to store validated List payloads | +| record | [MultiPropertiesSchema.AdditionalPropertiesBoxedMap](#additionalpropertiesboxedmap)
boxed class to store validated Map payloads | +| static class | [MultiPropertiesSchema.AdditionalProperties](#additionalproperties)
schema class | + +## MultiPropertiesSchema1Boxed +public sealed interface MultiPropertiesSchema1Boxed
+permits
+[MultiPropertiesSchema1BoxedMap](#multipropertiesschema1boxedmap) + +sealed interface that stores validated payloads using boxed classes + +## MultiPropertiesSchema1BoxedMap +public record MultiPropertiesSchema1BoxedMap
+implements [MultiPropertiesSchema1Boxed](#multipropertiesschema1boxed) + +record that stores validated Map payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| MultiPropertiesSchema1BoxedMap([MultiPropertiesSchemaMap](#multipropertiesschemamap) data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| [MultiPropertiesSchemaMap](#multipropertiesschemamap) | data()
validated payload | +| @Nullable Object | getData()
validated payload | + +## MultiPropertiesSchema1 +public static class MultiPropertiesSchema1
+extends JsonSchema + +A schema class that validates payloads + +### Code Sample +``` +import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags; +import org.openapijsonschematools.client.configurations.SchemaConfiguration; +import org.openapijsonschematools.client.exceptions.ValidationException; +import org.openapijsonschematools.client.schemas.validation.MapUtils; +import org.openapijsonschematools.client.schemas.validation.FrozenList; +import org.openapijsonschematools.client.schemas.validation.FrozenMap; +import org.openapijsonschematools.client.components.schemas.MultiPropertiesSchema; + +import java.util.Arrays; +import java.util.List; +import java.util.AbstractMap; + +static final SchemaConfiguration configuration = new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().build()); + +// Map validation +MultiPropertiesSchema.MultiPropertiesSchemaMap validatedPayload = + MultiPropertiesSchema.MultiPropertiesSchema1.validate( + new MultiPropertiesSchema.MultiPropertiesSchemaMapBuilder() + .status(1) + + .data( + Arrays.asList( + ) + ) + .message("a") + + .build(), + configuration +); +``` + +### Field Summary +| Modifier and Type | Field and Description | +| ----------------- | ---------------------- | +| Set> | type = Set.of(Map.class) | +| Map> | properties = Map.ofEntries(
    new PropertyEntry("status", [Status.class](#status))),
    new PropertyEntry("data", [Data.class](#data))),
    new PropertyEntry("message", [Message.class](#message)))
)
| +| Set | required = Set.of(
    "status"
)
| +| Class | additionalProperties = [AdditionalProperties.class](#additionalproperties) | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| [MultiPropertiesSchemaMap](#multipropertiesschemamap) | validate([Map<?, ?>](#multipropertiesschemamapbuilder) arg, SchemaConfiguration configuration) | +| [MultiPropertiesSchema1BoxedMap](#multipropertiesschema1boxedmap) | validateAndBox([Map<?, ?>](#multipropertiesschemamapbuilder) arg, SchemaConfiguration configuration) | +| [MultiPropertiesSchema1Boxed](#multipropertiesschema1boxed) | validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) | +| @Nullable Object | validate(@Nullable Object arg, SchemaConfiguration configuration) | + +## MultiPropertiesSchemaMap0Builder +public class MultiPropertiesSchemaMap0Builder
+builder for `Map` + +A class that builds the Map input type + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| MultiPropertiesSchemaMap0Builder(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 | +| [MultiPropertiesSchemaMap0Builder](#multipropertiesschemamap0builder) | data(List> value) | +| [MultiPropertiesSchemaMap0Builder](#multipropertiesschemamap0builder) | message(String value) | + +## MultiPropertiesSchemaMapBuilder +public class MultiPropertiesSchemaMapBuilder
+builder for `Map` + +A class that builds the Map input type + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| MultiPropertiesSchemaMapBuilder()
Creates a builder that contains an empty map | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| [MultiPropertiesSchemaMap0Builder](#multipropertiesschemamap0builder) | status(int value) | +| [MultiPropertiesSchemaMap0Builder](#multipropertiesschemamap0builder) | status(float value) | + +## MultiPropertiesSchemaMap +public static class MultiPropertiesSchemaMap
+extends FrozenMap + +A class to store validated Map payloads + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| static [MultiPropertiesSchemaMap](#multipropertiesschemamap) | of([Map](#multipropertiesschemamapbuilder) arg, SchemaConfiguration configuration) | +| Number | status()
value must be a 32 bit integer | +| [DataList](#datalist) | data()
[optional] | +| String | message()
[optional] | + +## DataBoxed +public sealed interface DataBoxed
+permits
+[DataBoxedList](#databoxedlist) + +sealed interface that stores validated payloads using boxed classes + +## DataBoxedList +public record DataBoxedList
+implements [DataBoxed](#databoxed) + +record that stores validated List payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| DataBoxedList([DataList](#datalist) data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| [DataList](#datalist) | data()
validated payload | +| @Nullable Object | getData()
validated payload | + +## Data +public static class Data
+extends JsonSchema + +A schema class that validates payloads + +### Code Sample +``` +import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags; +import org.openapijsonschematools.client.configurations.SchemaConfiguration; +import org.openapijsonschematools.client.exceptions.ValidationException; +import org.openapijsonschematools.client.schemas.validation.MapUtils; +import org.openapijsonschematools.client.schemas.validation.FrozenList; +import org.openapijsonschematools.client.schemas.validation.FrozenMap; +import org.openapijsonschematools.client.components.schemas.MultiPropertiesSchema; + +import java.util.Arrays; +import java.util.List; +import java.util.AbstractMap; + +static final SchemaConfiguration configuration = new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().build()); + +// List validation +MultiPropertiesSchema.DataList validatedPayload = + MultiPropertiesSchema.Data.validate( + new MultiPropertiesSchema.DataListBuilder() + .build(), + configuration +); +``` + +### Field Summary +| Modifier and Type | Field and Description | +| ----------------- | ---------------------- | +| Set> | type = Set.of(List.class) | +| Class | items = [ItemsSchema.ItemsSchema1.class](../../components/schemas/ItemsSchema.md#itemsschema1) | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| [DataList](#datalist) | validate([List](#datalistbuilder) arg, SchemaConfiguration configuration) | +| [DataBoxedList](#databoxedlist) | validateAndBox([List](#datalistbuilder) arg, SchemaConfiguration configuration) | +| [DataBoxed](#databoxed) | validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) | +| @Nullable Object | validate(@Nullable Object arg, SchemaConfiguration configuration) | + +## DataListBuilder +public class DataListBuilder
+builder for `List>` + +A class that builds the List input type + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| DataListBuilder()
Creates an empty list | +| DataListBuilder(List> items)
Stores the items in a list | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| DataListBuilder | add(Map item) | +| List> | build()
Returns list input that should be used with Schema.validate | + +## DataList +public class DataList
+extends `FrozenList` + +A class to store validated List payloads + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| static [DataList](#datalist) | of([List>](#datalistbuilder) arg, SchemaConfiguration configuration) | + +## MessageBoxed +public sealed interface MessageBoxed
+permits
+[MessageBoxedString](#messageboxedstring) + +sealed interface that stores validated payloads using boxed classes + +## MessageBoxedString +public record MessageBoxedString
+implements [MessageBoxed](#messageboxed) + +record that stores validated String payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| MessageBoxedString(String data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| String | data()
validated payload | +| @Nullable Object | getData()
validated payload | + +## Message +public static class Message
+extends StringJsonSchema.StringJsonSchema1 + +A schema class that validates payloads + +| Methods Inherited from class org.openapijsonschematools.client.schemas.StringJsonSchema.StringJsonSchema1 | +| ------------------------------------------------------------------ | +| validate | +| validateAndBox | + +## StatusBoxed +public sealed interface StatusBoxed
+permits
+[StatusBoxedNumber](#statusboxednumber) + +sealed interface that stores validated payloads using boxed classes + +## StatusBoxedNumber +public record StatusBoxedNumber
+implements [StatusBoxed](#statusboxed) + +record that stores validated Number payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| StatusBoxedNumber(Number data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| Number | data()
validated payload | +| @Nullable Object | getData()
validated payload | + +## Status +public static class Status
+extends Int32JsonSchema.Int32JsonSchema1 + +A schema class that validates payloads + +| Methods Inherited from class org.openapijsonschematools.client.schemas.Int32JsonSchema.Int32JsonSchema1 | +| ------------------------------------------------------------------ | +| validate | +| validateAndBox | + +## 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(Nothing? data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| Nothing? | 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 Component Schemas]](../../../README.md#Component-Schemas) [[Back to README]](../../../README.md) diff --git a/samples/client/petstore/kotlin/docs/components/schemas/MyObjectDto.md b/samples/client/petstore/kotlin/docs/components/schemas/MyObjectDto.md new file mode 100644 index 00000000000..3a9b3c4a20b --- /dev/null +++ b/samples/client/petstore/kotlin/docs/components/schemas/MyObjectDto.md @@ -0,0 +1,293 @@ +# MyObjectDto +org.openapijsonschematools.client.components.schemas.MyObjectDto.java +public class MyObjectDto
+ +A class that contains necessary nested +- schema classes (which validate payloads), extends JsonSchema +- sealed interfaces which store validated payloads, java version of a sum type +- boxed classes which store validated payloads, sealed permits class implementations +- classes to store validated map payloads, extends FrozenMap +- classes to build inputs for map payloads + +## Nested Class Summary +| Modifier and Type | Class and Description | +| ----------------- | ---------------------- | +| sealed interface | [MyObjectDto.MyObjectDto1Boxed](#myobjectdto1boxed)
sealed interface for validated payloads | +| record | [MyObjectDto.MyObjectDto1BoxedMap](#myobjectdto1boxedmap)
boxed class to store validated Map payloads | +| static class | [MyObjectDto.MyObjectDto1](#myobjectdto1)
schema class | +| static class | [MyObjectDto.MyObjectDtoMapBuilder](#myobjectdtomapbuilder)
builder for Map payloads | +| static class | [MyObjectDto.MyObjectDtoMap](#myobjectdtomap)
output class for Map payloads | +| sealed interface | [MyObjectDto.IdBoxed](#idboxed)
sealed interface for validated payloads | +| record | [MyObjectDto.IdBoxedString](#idboxedstring)
boxed class to store validated String payloads | +| static class | [MyObjectDto.Id](#id)
schema class | +| sealed interface | [MyObjectDto.AdditionalPropertiesBoxed](#additionalpropertiesboxed)
sealed interface for validated payloads | +| record | [MyObjectDto.AdditionalPropertiesBoxedVoid](#additionalpropertiesboxedvoid)
boxed class to store validated null payloads | +| record | [MyObjectDto.AdditionalPropertiesBoxedBoolean](#additionalpropertiesboxedboolean)
boxed class to store validated boolean payloads | +| record | [MyObjectDto.AdditionalPropertiesBoxedNumber](#additionalpropertiesboxednumber)
boxed class to store validated Number payloads | +| record | [MyObjectDto.AdditionalPropertiesBoxedString](#additionalpropertiesboxedstring)
boxed class to store validated String payloads | +| record | [MyObjectDto.AdditionalPropertiesBoxedList](#additionalpropertiesboxedlist)
boxed class to store validated List payloads | +| record | [MyObjectDto.AdditionalPropertiesBoxedMap](#additionalpropertiesboxedmap)
boxed class to store validated Map payloads | +| static class | [MyObjectDto.AdditionalProperties](#additionalproperties)
schema class | + +## MyObjectDto1Boxed +public sealed interface MyObjectDto1Boxed
+permits
+[MyObjectDto1BoxedMap](#myobjectdto1boxedmap) + +sealed interface that stores validated payloads using boxed classes + +## MyObjectDto1BoxedMap +public record MyObjectDto1BoxedMap
+implements [MyObjectDto1Boxed](#myobjectdto1boxed) + +record that stores validated Map payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| MyObjectDto1BoxedMap([MyObjectDtoMap](#myobjectdtomap) data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| [MyObjectDtoMap](#myobjectdtomap) | data()
validated payload | +| @Nullable Object | getData()
validated payload | + +## MyObjectDto1 +public static class MyObjectDto1
+extends JsonSchema + +A schema class that validates payloads + +### Code Sample +``` +import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags; +import org.openapijsonschematools.client.configurations.SchemaConfiguration; +import org.openapijsonschematools.client.exceptions.ValidationException; +import org.openapijsonschematools.client.schemas.validation.MapUtils; +import org.openapijsonschematools.client.schemas.validation.FrozenList; +import org.openapijsonschematools.client.schemas.validation.FrozenMap; +import org.openapijsonschematools.client.components.schemas.MyObjectDto; + +import java.util.Arrays; +import java.util.List; +import java.util.AbstractMap; + +static final SchemaConfiguration configuration = new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().build()); + +// Map validation +MyObjectDto.MyObjectDtoMap validatedPayload = + MyObjectDto.MyObjectDto1.validate( + new MyObjectDto.MyObjectDtoMapBuilder() + .id("046b6c7f-0b8a-43b9-b35d-6489e6daee91") + + .build(), + configuration +); +``` + +### Field Summary +| Modifier and Type | Field and Description | +| ----------------- | ---------------------- | +| Set> | type = Set.of(Map.class) | +| Map> | properties = Map.ofEntries(
    new PropertyEntry("id", [Id.class](#id)))
)
| +| Class | additionalProperties = [AdditionalProperties.class](#additionalproperties) | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| [MyObjectDtoMap](#myobjectdtomap) | validate([Map<?, ?>](#myobjectdtomapbuilder) arg, SchemaConfiguration configuration) | +| [MyObjectDto1BoxedMap](#myobjectdto1boxedmap) | validateAndBox([Map<?, ?>](#myobjectdtomapbuilder) arg, SchemaConfiguration configuration) | +| [MyObjectDto1Boxed](#myobjectdto1boxed) | validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) | +| @Nullable Object | validate(@Nullable Object arg, SchemaConfiguration configuration) | + +## MyObjectDtoMapBuilder +public class MyObjectDtoMapBuilder
+builder for `Map` + +A class that builds the Map input type + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| MyObjectDtoMapBuilder()
Creates a builder that contains an empty map | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| Map | build()
Returns map input that should be used with Schema.validate | +| [MyObjectDtoMapBuilder](#myobjectdtomapbuilder) | id(String value) | + +## MyObjectDtoMap +public static class MyObjectDtoMap
+extends FrozenMap + +A class to store validated Map payloads + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| static [MyObjectDtoMap](#myobjectdtomap) | of([Map](#myobjectdtomapbuilder) arg, SchemaConfiguration configuration) | +| String | id()
[optional] value must be a uuid | + +## IdBoxed +public sealed interface IdBoxed
+permits
+[IdBoxedString](#idboxedstring) + +sealed interface that stores validated payloads using boxed classes + +## IdBoxedString +public record IdBoxedString
+implements [IdBoxed](#idboxed) + +record that stores validated String payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| IdBoxedString(String data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| String | data()
validated payload | +| @Nullable Object | getData()
validated payload | + +## Id +public static class Id
+extends UuidJsonSchema.UuidJsonSchema1 + +A schema class that validates payloads + +| Methods Inherited from class org.openapijsonschematools.client.schemas.UuidJsonSchema.UuidJsonSchema1 | +| ------------------------------------------------------------------ | +| validate | +| validateAndBox | + +## 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(Nothing? data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| Nothing? | 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 Component Schemas]](../../../README.md#Component-Schemas) [[Back to README]](../../../README.md) diff --git a/samples/client/petstore/kotlin/docs/components/schemas/Name.md b/samples/client/petstore/kotlin/docs/components/schemas/Name.md new file mode 100644 index 00000000000..145d76ec02f --- /dev/null +++ b/samples/client/petstore/kotlin/docs/components/schemas/Name.md @@ -0,0 +1,354 @@ +# Name +org.openapijsonschematools.client.components.schemas.Name.java +public class Name
+ +A class that contains necessary nested +- schema classes (which validate payloads), extends JsonSchema +- sealed interfaces which store validated payloads, java version of a sum type +- boxed classes which store validated payloads, sealed permits class implementations +- classes to store validated map payloads, extends FrozenMap +- classes to build inputs for map payloads + +## Nested Class Summary +| Modifier and Type | Class and Description | +| ----------------- | ---------------------- | +| sealed interface | [Name.Name1Boxed](#name1boxed)
sealed interface for validated payloads | +| record | [Name.Name1BoxedVoid](#name1boxedvoid)
boxed class to store validated null payloads | +| record | [Name.Name1BoxedBoolean](#name1boxedboolean)
boxed class to store validated boolean payloads | +| record | [Name.Name1BoxedNumber](#name1boxednumber)
boxed class to store validated Number payloads | +| record | [Name.Name1BoxedString](#name1boxedstring)
boxed class to store validated String payloads | +| record | [Name.Name1BoxedList](#name1boxedlist)
boxed class to store validated List payloads | +| record | [Name.Name1BoxedMap](#name1boxedmap)
boxed class to store validated Map payloads | +| static class | [Name.Name1](#name1)
schema class | +| static class | [Name.NameMapBuilder1](#namemapbuilder1)
builder for Map payloads | +| static class | [Name.NameMap](#namemap)
output class for Map payloads | +| sealed interface | [Name.PropertyBoxed](#propertyboxed)
sealed interface for validated payloads | +| record | [Name.PropertyBoxedString](#propertyboxedstring)
boxed class to store validated String payloads | +| static class | [Name.Property](#property)
schema class | +| sealed interface | [Name.SnakeCaseBoxed](#snakecaseboxed)
sealed interface for validated payloads | +| record | [Name.SnakeCaseBoxedNumber](#snakecaseboxednumber)
boxed class to store validated Number payloads | +| static class | [Name.SnakeCase](#snakecase)
schema class | +| sealed interface | [Name.Name2Boxed](#name2boxed)
sealed interface for validated payloads | +| record | [Name.Name2BoxedNumber](#name2boxednumber)
boxed class to store validated Number payloads | +| static class | [Name.Name2](#name2)
schema class | + +## Name1Boxed +public sealed interface Name1Boxed
+permits
+[Name1BoxedVoid](#name1boxedvoid), +[Name1BoxedBoolean](#name1boxedboolean), +[Name1BoxedNumber](#name1boxednumber), +[Name1BoxedString](#name1boxedstring), +[Name1BoxedList](#name1boxedlist), +[Name1BoxedMap](#name1boxedmap) + +sealed interface that stores validated payloads using boxed classes + +## Name1BoxedVoid +public record Name1BoxedVoid
+implements [Name1Boxed](#name1boxed) + +record that stores validated null payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| Name1BoxedVoid(Nothing? data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| Nothing? | data()
validated payload | +| @Nullable Object | getData()
validated payload | + +## Name1BoxedBoolean +public record Name1BoxedBoolean
+implements [Name1Boxed](#name1boxed) + +record that stores validated boolean payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| Name1BoxedBoolean(boolean data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| boolean | data()
validated payload | +| @Nullable Object | getData()
validated payload | + +## Name1BoxedNumber +public record Name1BoxedNumber
+implements [Name1Boxed](#name1boxed) + +record that stores validated Number payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| Name1BoxedNumber(Number data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| Number | data()
validated payload | +| @Nullable Object | getData()
validated payload | + +## Name1BoxedString +public record Name1BoxedString
+implements [Name1Boxed](#name1boxed) + +record that stores validated String payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| Name1BoxedString(String data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| String | data()
validated payload | +| @Nullable Object | getData()
validated payload | + +## Name1BoxedList +public record Name1BoxedList
+implements [Name1Boxed](#name1boxed) + +record that stores validated List payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| Name1BoxedList(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 | + +## Name1BoxedMap +public record Name1BoxedMap
+implements [Name1Boxed](#name1boxed) + +record that stores validated Map payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| Name1BoxedMap([NameMap](#namemap) data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| [NameMap](#namemap) | data()
validated payload | +| @Nullable Object | getData()
validated payload | + +## Name1 +public static class Name1
+extends JsonSchema + +A schema class that validates payloads + +## Description +Model for testing model name same as property name + +### Field Summary +| Modifier and Type | Field and Description | +| ----------------- | ---------------------- | +| Map> | properties = Map.ofEntries(
    new PropertyEntry("name", [Name2.class](#name2))),
    new PropertyEntry("snake_case", [SnakeCase.class](#snakecase))),
    new PropertyEntry("property", [Property.class](#property)))
)
| +| Set | required = Set.of(
    "name"
)
| + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| String | validate(String arg, SchemaConfiguration configuration) | +| Nothing? | validate(Nothing? arg, SchemaConfiguration configuration) | +| int | validate(int arg, SchemaConfiguration configuration) | +| long | validate(long arg, SchemaConfiguration configuration) | +| float | validate(float arg, SchemaConfiguration configuration) | +| double | validate(double arg, SchemaConfiguration configuration) | +| Number | validate(Number arg, SchemaConfiguration configuration) | +| boolean | validate(boolean arg, SchemaConfiguration configuration) | +| [NameMap](#namemap) | validate([Map<?, ?>](#namemapbuilder1) arg, SchemaConfiguration configuration) | +| FrozenList<@Nullable Object> | validate(List arg, SchemaConfiguration configuration) | +| [Name1BoxedString](#name1boxedstring) | validateAndBox(String arg, SchemaConfiguration configuration) | +| [Name1BoxedVoid](#name1boxedvoid) | validateAndBox(Nothing? arg, SchemaConfiguration configuration) | +| [Name1BoxedNumber](#name1boxednumber) | validateAndBox(Number arg, SchemaConfiguration configuration) | +| [Name1BoxedBoolean](#name1boxedboolean) | validateAndBox(boolean arg, SchemaConfiguration configuration) | +| [Name1BoxedMap](#name1boxedmap) | validateAndBox([Map<?, ?>](#namemapbuilder1) arg, SchemaConfiguration configuration) | +| [Name1BoxedList](#name1boxedlist) | validateAndBox(List arg, SchemaConfiguration configuration) | +| [Name1Boxed](#name1boxed) | validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) | +| @Nullable Object | validate(@Nullable Object arg, SchemaConfiguration configuration) | + +## NameMap0Builder +public class NameMap0Builder
+builder for `Map` + +A class that builds the Map input type + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| NameMap0Builder(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 | +| [NameMap0Builder](#namemap0builder) | snake_case(int value) | +| [NameMap0Builder](#namemap0builder) | snake_case(float value) | +| [NameMap0Builder](#namemap0builder) | property(String value) | +| [NameMap0Builder](#namemap0builder) | additionalProperty(String key, Nothing? value) | +| [NameMap0Builder](#namemap0builder) | additionalProperty(String key, boolean value) | +| [NameMap0Builder](#namemap0builder) | additionalProperty(String key, String value) | +| [NameMap0Builder](#namemap0builder) | additionalProperty(String key, int value) | +| [NameMap0Builder](#namemap0builder) | additionalProperty(String key, float value) | +| [NameMap0Builder](#namemap0builder) | additionalProperty(String key, long value) | +| [NameMap0Builder](#namemap0builder) | additionalProperty(String key, double value) | +| [NameMap0Builder](#namemap0builder) | additionalProperty(String key, List value) | +| [NameMap0Builder](#namemap0builder) | additionalProperty(String key, Map value) | + +## NameMapBuilder1 +public class NameMapBuilder1
+builder for `Map` + +A class that builds the Map input type + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| NameMapBuilder1()
Creates a builder that contains an empty map | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| [NameMap0Builder](#namemap0builder) | name(int value) | +| [NameMap0Builder](#namemap0builder) | name(float value) | + +## NameMap +public static class NameMap
+extends FrozenMap + +A class to store validated Map payloads + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| static [NameMap](#namemap) | of([Map](#namemapbuilder1) arg, SchemaConfiguration configuration) | +| Number | name()
value must be a 32 bit integer | +| Number | snake_case()
[optional] value must be a 32 bit integer | +| String | property()
[optional] | +| @Nullable Object | getAdditionalProperty(String name)
provides type safety for additional properties | + +## PropertyBoxed +public sealed interface PropertyBoxed
+permits
+[PropertyBoxedString](#propertyboxedstring) + +sealed interface that stores validated payloads using boxed classes + +## PropertyBoxedString +public record PropertyBoxedString
+implements [PropertyBoxed](#propertyboxed) + +record that stores validated String payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| PropertyBoxedString(String data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| String | data()
validated payload | +| @Nullable Object | getData()
validated payload | + +## Property +public static class Property
+extends StringJsonSchema.StringJsonSchema1 + +A schema class that validates payloads + +## Description +this is a reserved python keyword + +| Methods Inherited from class org.openapijsonschematools.client.schemas.StringJsonSchema.StringJsonSchema1 | +| ------------------------------------------------------------------ | +| validate | +| validateAndBox | + +## SnakeCaseBoxed +public sealed interface SnakeCaseBoxed
+permits
+[SnakeCaseBoxedNumber](#snakecaseboxednumber) + +sealed interface that stores validated payloads using boxed classes + +## SnakeCaseBoxedNumber +public record SnakeCaseBoxedNumber
+implements [SnakeCaseBoxed](#snakecaseboxed) + +record that stores validated Number payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| SnakeCaseBoxedNumber(Number data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| Number | data()
validated payload | +| @Nullable Object | getData()
validated payload | + +## SnakeCase +public static class SnakeCase
+extends Int32JsonSchema.Int32JsonSchema1 + +A schema class that validates payloads + +| Methods Inherited from class org.openapijsonschematools.client.schemas.Int32JsonSchema.Int32JsonSchema1 | +| ------------------------------------------------------------------ | +| validate | +| validateAndBox | + +## Name2Boxed +public sealed interface Name2Boxed
+permits
+[Name2BoxedNumber](#name2boxednumber) + +sealed interface that stores validated payloads using boxed classes + +## Name2BoxedNumber +public record Name2BoxedNumber
+implements [Name2Boxed](#name2boxed) + +record that stores validated Number payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| Name2BoxedNumber(Number data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| Number | data()
validated payload | +| @Nullable Object | getData()
validated payload | + +## Name2 +public static class Name2
+extends Int32JsonSchema.Int32JsonSchema1 + +A schema class that validates payloads + +| Methods Inherited from class org.openapijsonschematools.client.schemas.Int32JsonSchema.Int32JsonSchema1 | +| ------------------------------------------------------------------ | +| validate | +| validateAndBox | + +[[Back to top]](#top) [[Back to Component Schemas]](../../../README.md#Component-Schemas) [[Back to README]](../../../README.md) diff --git a/samples/client/petstore/kotlin/docs/components/schemas/NoAdditionalProperties.md b/samples/client/petstore/kotlin/docs/components/schemas/NoAdditionalProperties.md new file mode 100644 index 00000000000..5cb5b89be70 --- /dev/null +++ b/samples/client/petstore/kotlin/docs/components/schemas/NoAdditionalProperties.md @@ -0,0 +1,357 @@ +# NoAdditionalProperties +org.openapijsonschematools.client.components.schemas.NoAdditionalProperties.java +public class NoAdditionalProperties
+ +A class that contains necessary nested +- schema classes (which validate payloads), extends JsonSchema +- sealed interfaces which store validated payloads, java version of a sum type +- boxed classes which store validated payloads, sealed permits class implementations +- classes to store validated map payloads, extends FrozenMap +- classes to build inputs for map payloads + +## Nested Class Summary +| Modifier and Type | Class and Description | +| ----------------- | ---------------------- | +| sealed interface | [NoAdditionalProperties.NoAdditionalProperties1Boxed](#noadditionalproperties1boxed)
sealed interface for validated payloads | +| record | [NoAdditionalProperties.NoAdditionalProperties1BoxedMap](#noadditionalproperties1boxedmap)
boxed class to store validated Map payloads | +| static class | [NoAdditionalProperties.NoAdditionalProperties1](#noadditionalproperties1)
schema class | +| static class | [NoAdditionalProperties.NoAdditionalPropertiesMapBuilder](#noadditionalpropertiesmapbuilder)
builder for Map payloads | +| static class | [NoAdditionalProperties.NoAdditionalPropertiesMap](#noadditionalpropertiesmap)
output class for Map payloads | +| sealed interface | [NoAdditionalProperties.PetIdBoxed](#petidboxed)
sealed interface for validated payloads | +| record | [NoAdditionalProperties.PetIdBoxedNumber](#petidboxednumber)
boxed class to store validated Number payloads | +| static class | [NoAdditionalProperties.PetId](#petid)
schema class | +| sealed interface | [NoAdditionalProperties.IdBoxed](#idboxed)
sealed interface for validated payloads | +| record | [NoAdditionalProperties.IdBoxedNumber](#idboxednumber)
boxed class to store validated Number payloads | +| static class | [NoAdditionalProperties.Id](#id)
schema class | +| sealed interface | [NoAdditionalProperties.AdditionalPropertiesBoxed](#additionalpropertiesboxed)
sealed interface for validated payloads | +| record | [NoAdditionalProperties.AdditionalPropertiesBoxedVoid](#additionalpropertiesboxedvoid)
boxed class to store validated null payloads | +| record | [NoAdditionalProperties.AdditionalPropertiesBoxedBoolean](#additionalpropertiesboxedboolean)
boxed class to store validated boolean payloads | +| record | [NoAdditionalProperties.AdditionalPropertiesBoxedNumber](#additionalpropertiesboxednumber)
boxed class to store validated Number payloads | +| record | [NoAdditionalProperties.AdditionalPropertiesBoxedString](#additionalpropertiesboxedstring)
boxed class to store validated String payloads | +| record | [NoAdditionalProperties.AdditionalPropertiesBoxedList](#additionalpropertiesboxedlist)
boxed class to store validated List payloads | +| record | [NoAdditionalProperties.AdditionalPropertiesBoxedMap](#additionalpropertiesboxedmap)
boxed class to store validated Map payloads | +| static class | [NoAdditionalProperties.AdditionalProperties](#additionalproperties)
schema class | + +## NoAdditionalProperties1Boxed +public sealed interface NoAdditionalProperties1Boxed
+permits
+[NoAdditionalProperties1BoxedMap](#noadditionalproperties1boxedmap) + +sealed interface that stores validated payloads using boxed classes + +## NoAdditionalProperties1BoxedMap +public record NoAdditionalProperties1BoxedMap
+implements [NoAdditionalProperties1Boxed](#noadditionalproperties1boxed) + +record that stores validated Map payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| NoAdditionalProperties1BoxedMap([NoAdditionalPropertiesMap](#noadditionalpropertiesmap) data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| [NoAdditionalPropertiesMap](#noadditionalpropertiesmap) | data()
validated payload | +| @Nullable Object | getData()
validated payload | + +## NoAdditionalProperties1 +public static class NoAdditionalProperties1
+extends JsonSchema + +A schema class that validates payloads + +### Code Sample +``` +import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags; +import org.openapijsonschematools.client.configurations.SchemaConfiguration; +import org.openapijsonschematools.client.exceptions.ValidationException; +import org.openapijsonschematools.client.schemas.validation.MapUtils; +import org.openapijsonschematools.client.schemas.validation.FrozenList; +import org.openapijsonschematools.client.schemas.validation.FrozenMap; +import org.openapijsonschematools.client.components.schemas.NoAdditionalProperties; + +import java.util.Arrays; +import java.util.List; +import java.util.AbstractMap; + +static final SchemaConfiguration configuration = new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().build()); + +// Map validation +NoAdditionalProperties.NoAdditionalPropertiesMap validatedPayload = + NoAdditionalProperties.NoAdditionalProperties1.validate( + new NoAdditionalProperties.NoAdditionalPropertiesMapBuilder() + .id(1L) + + .petId(1L) + + .build(), + configuration +); +``` + +### Field Summary +| Modifier and Type | Field and Description | +| ----------------- | ---------------------- | +| Set> | type = Set.of(Map.class) | +| Map> | properties = Map.ofEntries(
    new PropertyEntry("id", [Id.class](#id))),
    new PropertyEntry("petId", [PetId.class](#petid)))
)
| +| Set | required = Set.of(
    "id"
)
| +| Class | additionalProperties = [AdditionalProperties.class](#additionalproperties) | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| [NoAdditionalPropertiesMap](#noadditionalpropertiesmap) | validate([Map<?, ?>](#noadditionalpropertiesmapbuilder) arg, SchemaConfiguration configuration) | +| [NoAdditionalProperties1BoxedMap](#noadditionalproperties1boxedmap) | validateAndBox([Map<?, ?>](#noadditionalpropertiesmapbuilder) arg, SchemaConfiguration configuration) | +| [NoAdditionalProperties1Boxed](#noadditionalproperties1boxed) | validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) | +| @Nullable Object | validate(@Nullable Object arg, SchemaConfiguration configuration) | + +## NoAdditionalPropertiesMap0Builder +public class NoAdditionalPropertiesMap0Builder
+builder for `Map` + +A class that builds the Map input type + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| NoAdditionalPropertiesMap0Builder(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 | +| [NoAdditionalPropertiesMap0Builder](#noadditionalpropertiesmap0builder) | petId(int value) | +| [NoAdditionalPropertiesMap0Builder](#noadditionalpropertiesmap0builder) | petId(float value) | +| [NoAdditionalPropertiesMap0Builder](#noadditionalpropertiesmap0builder) | petId(long value) | +| [NoAdditionalPropertiesMap0Builder](#noadditionalpropertiesmap0builder) | petId(double value) | + +## NoAdditionalPropertiesMapBuilder +public class NoAdditionalPropertiesMapBuilder
+builder for `Map` + +A class that builds the Map input type + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| NoAdditionalPropertiesMapBuilder()
Creates a builder that contains an empty map | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| [NoAdditionalPropertiesMap0Builder](#noadditionalpropertiesmap0builder) | id(int value) | +| [NoAdditionalPropertiesMap0Builder](#noadditionalpropertiesmap0builder) | id(float value) | +| [NoAdditionalPropertiesMap0Builder](#noadditionalpropertiesmap0builder) | id(long value) | +| [NoAdditionalPropertiesMap0Builder](#noadditionalpropertiesmap0builder) | id(double value) | + +## NoAdditionalPropertiesMap +public static class NoAdditionalPropertiesMap
+extends FrozenMap + +A class to store validated Map payloads + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| static [NoAdditionalPropertiesMap](#noadditionalpropertiesmap) | of([Map](#noadditionalpropertiesmapbuilder) arg, SchemaConfiguration configuration) | +| Number | id()
value must be a 64 bit integer | +| Number | petId()
[optional] value must be a 64 bit integer | + +## PetIdBoxed +public sealed interface PetIdBoxed
+permits
+[PetIdBoxedNumber](#petidboxednumber) + +sealed interface that stores validated payloads using boxed classes + +## PetIdBoxedNumber +public record PetIdBoxedNumber
+implements [PetIdBoxed](#petidboxed) + +record that stores validated Number payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| PetIdBoxedNumber(Number data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| Number | data()
validated payload | +| @Nullable Object | getData()
validated payload | + +## PetId +public static class PetId
+extends Int64JsonSchema.Int64JsonSchema1 + +A schema class that validates payloads + +| Methods Inherited from class org.openapijsonschematools.client.schemas.Int64JsonSchema.Int64JsonSchema1 | +| ------------------------------------------------------------------ | +| validate | +| validateAndBox | + +## IdBoxed +public sealed interface IdBoxed
+permits
+[IdBoxedNumber](#idboxednumber) + +sealed interface that stores validated payloads using boxed classes + +## IdBoxedNumber +public record IdBoxedNumber
+implements [IdBoxed](#idboxed) + +record that stores validated Number payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| IdBoxedNumber(Number data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| Number | data()
validated payload | +| @Nullable Object | getData()
validated payload | + +## Id +public static class Id
+extends Int64JsonSchema.Int64JsonSchema1 + +A schema class that validates payloads + +| Methods Inherited from class org.openapijsonschematools.client.schemas.Int64JsonSchema.Int64JsonSchema1 | +| ------------------------------------------------------------------ | +| validate | +| validateAndBox | + +## 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(Nothing? data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| Nothing? | 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 Component Schemas]](../../../README.md#Component-Schemas) [[Back to README]](../../../README.md) diff --git a/samples/client/petstore/kotlin/docs/components/schemas/NullableClass.md b/samples/client/petstore/kotlin/docs/components/schemas/NullableClass.md new file mode 100644 index 00000000000..84627865c31 --- /dev/null +++ b/samples/client/petstore/kotlin/docs/components/schemas/NullableClass.md @@ -0,0 +1,2041 @@ +# NullableClass +org.openapijsonschematools.client.components.schemas.NullableClass.java +public class NullableClass
+ +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 list payloads, extends FrozenList +- classes to build inputs for list payloads +- classes to store validated map payloads, extends FrozenMap +- classes to build inputs for map payloads + +## Nested Class Summary +| Modifier and Type | Class and Description | +| ----------------- | ---------------------- | +| sealed interface | [NullableClass.NullableClass1Boxed](#nullableclass1boxed)
sealed interface for validated payloads | +| record | [NullableClass.NullableClass1BoxedMap](#nullableclass1boxedmap)
boxed class to store validated Map payloads | +| static class | [NullableClass.NullableClass1](#nullableclass1)
schema class | +| static class | [NullableClass.NullableClassMapBuilder](#nullableclassmapbuilder)
builder for Map payloads | +| static class | [NullableClass.NullableClassMap](#nullableclassmap)
output class for Map payloads | +| sealed interface | [NullableClass.ObjectItemsNullableBoxed](#objectitemsnullableboxed)
sealed interface for validated payloads | +| record | [NullableClass.ObjectItemsNullableBoxedMap](#objectitemsnullableboxedmap)
boxed class to store validated Map payloads | +| static class | [NullableClass.ObjectItemsNullable](#objectitemsnullable)
schema class | +| static class | [NullableClass.ObjectItemsNullableMapBuilder](#objectitemsnullablemapbuilder)
builder for Map payloads | +| static class | [NullableClass.ObjectItemsNullableMap](#objectitemsnullablemap)
output class for Map payloads | +| sealed interface | [NullableClass.AdditionalProperties2Boxed](#additionalproperties2boxed)
sealed interface for validated payloads | +| record | [NullableClass.AdditionalProperties2BoxedVoid](#additionalproperties2boxedvoid)
boxed class to store validated null payloads | +| record | [NullableClass.AdditionalProperties2BoxedMap](#additionalproperties2boxedmap)
boxed class to store validated Map payloads | +| static class | [NullableClass.AdditionalProperties2](#additionalproperties2)
schema class | +| sealed interface | [NullableClass.ObjectAndItemsNullablePropBoxed](#objectanditemsnullablepropboxed)
sealed interface for validated payloads | +| record | [NullableClass.ObjectAndItemsNullablePropBoxedVoid](#objectanditemsnullablepropboxedvoid)
boxed class to store validated null payloads | +| record | [NullableClass.ObjectAndItemsNullablePropBoxedMap](#objectanditemsnullablepropboxedmap)
boxed class to store validated Map payloads | +| static class | [NullableClass.ObjectAndItemsNullableProp](#objectanditemsnullableprop)
schema class | +| static class | [NullableClass.ObjectAndItemsNullablePropMapBuilder](#objectanditemsnullablepropmapbuilder)
builder for Map payloads | +| static class | [NullableClass.ObjectAndItemsNullablePropMap](#objectanditemsnullablepropmap)
output class for Map payloads | +| sealed interface | [NullableClass.AdditionalProperties1Boxed](#additionalproperties1boxed)
sealed interface for validated payloads | +| record | [NullableClass.AdditionalProperties1BoxedVoid](#additionalproperties1boxedvoid)
boxed class to store validated null payloads | +| record | [NullableClass.AdditionalProperties1BoxedMap](#additionalproperties1boxedmap)
boxed class to store validated Map payloads | +| static class | [NullableClass.AdditionalProperties1](#additionalproperties1)
schema class | +| sealed interface | [NullableClass.ObjectNullablePropBoxed](#objectnullablepropboxed)
sealed interface for validated payloads | +| record | [NullableClass.ObjectNullablePropBoxedVoid](#objectnullablepropboxedvoid)
boxed class to store validated null payloads | +| record | [NullableClass.ObjectNullablePropBoxedMap](#objectnullablepropboxedmap)
boxed class to store validated Map payloads | +| static class | [NullableClass.ObjectNullableProp](#objectnullableprop)
schema class | +| static class | [NullableClass.ObjectNullablePropMapBuilder](#objectnullablepropmapbuilder)
builder for Map payloads | +| static class | [NullableClass.ObjectNullablePropMap](#objectnullablepropmap)
output class for Map payloads | +| sealed interface | [NullableClass.AdditionalPropertiesBoxed](#additionalpropertiesboxed)
sealed interface for validated payloads | +| record | [NullableClass.AdditionalPropertiesBoxedMap](#additionalpropertiesboxedmap)
boxed class to store validated Map payloads | +| static class | [NullableClass.AdditionalProperties](#additionalproperties)
schema class | +| sealed interface | [NullableClass.ArrayItemsNullableBoxed](#arrayitemsnullableboxed)
sealed interface for validated payloads | +| record | [NullableClass.ArrayItemsNullableBoxedList](#arrayitemsnullableboxedlist)
boxed class to store validated List payloads | +| static class | [NullableClass.ArrayItemsNullable](#arrayitemsnullable)
schema class | +| static class | [NullableClass.ArrayItemsNullableListBuilder](#arrayitemsnullablelistbuilder)
builder for List payloads | +| static class | [NullableClass.ArrayItemsNullableList](#arrayitemsnullablelist)
output class for List payloads | +| sealed interface | [NullableClass.Items2Boxed](#items2boxed)
sealed interface for validated payloads | +| record | [NullableClass.Items2BoxedVoid](#items2boxedvoid)
boxed class to store validated null payloads | +| record | [NullableClass.Items2BoxedMap](#items2boxedmap)
boxed class to store validated Map payloads | +| static class | [NullableClass.Items2](#items2)
schema class | +| sealed interface | [NullableClass.ArrayAndItemsNullablePropBoxed](#arrayanditemsnullablepropboxed)
sealed interface for validated payloads | +| record | [NullableClass.ArrayAndItemsNullablePropBoxedVoid](#arrayanditemsnullablepropboxedvoid)
boxed class to store validated null payloads | +| record | [NullableClass.ArrayAndItemsNullablePropBoxedList](#arrayanditemsnullablepropboxedlist)
boxed class to store validated List payloads | +| static class | [NullableClass.ArrayAndItemsNullableProp](#arrayanditemsnullableprop)
schema class | +| static class | [NullableClass.ArrayAndItemsNullablePropListBuilder](#arrayanditemsnullableproplistbuilder)
builder for List payloads | +| static class | [NullableClass.ArrayAndItemsNullablePropList](#arrayanditemsnullableproplist)
output class for List payloads | +| sealed interface | [NullableClass.Items1Boxed](#items1boxed)
sealed interface for validated payloads | +| record | [NullableClass.Items1BoxedVoid](#items1boxedvoid)
boxed class to store validated null payloads | +| record | [NullableClass.Items1BoxedMap](#items1boxedmap)
boxed class to store validated Map payloads | +| static class | [NullableClass.Items1](#items1)
schema class | +| sealed interface | [NullableClass.ArrayNullablePropBoxed](#arraynullablepropboxed)
sealed interface for validated payloads | +| record | [NullableClass.ArrayNullablePropBoxedVoid](#arraynullablepropboxedvoid)
boxed class to store validated null payloads | +| record | [NullableClass.ArrayNullablePropBoxedList](#arraynullablepropboxedlist)
boxed class to store validated List payloads | +| static class | [NullableClass.ArrayNullableProp](#arraynullableprop)
schema class | +| static class | [NullableClass.ArrayNullablePropListBuilder](#arraynullableproplistbuilder)
builder for List payloads | +| static class | [NullableClass.ArrayNullablePropList](#arraynullableproplist)
output class for List payloads | +| sealed interface | [NullableClass.ItemsBoxed](#itemsboxed)
sealed interface for validated payloads | +| record | [NullableClass.ItemsBoxedMap](#itemsboxedmap)
boxed class to store validated Map payloads | +| static class | [NullableClass.Items](#items)
schema class | +| sealed interface | [NullableClass.DatetimePropBoxed](#datetimepropboxed)
sealed interface for validated payloads | +| record | [NullableClass.DatetimePropBoxedVoid](#datetimepropboxedvoid)
boxed class to store validated null payloads | +| record | [NullableClass.DatetimePropBoxedString](#datetimepropboxedstring)
boxed class to store validated String payloads | +| static class | [NullableClass.DatetimeProp](#datetimeprop)
schema class | +| sealed interface | [NullableClass.DatePropBoxed](#datepropboxed)
sealed interface for validated payloads | +| record | [NullableClass.DatePropBoxedVoid](#datepropboxedvoid)
boxed class to store validated null payloads | +| record | [NullableClass.DatePropBoxedString](#datepropboxedstring)
boxed class to store validated String payloads | +| static class | [NullableClass.DateProp](#dateprop)
schema class | +| sealed interface | [NullableClass.StringPropBoxed](#stringpropboxed)
sealed interface for validated payloads | +| record | [NullableClass.StringPropBoxedVoid](#stringpropboxedvoid)
boxed class to store validated null payloads | +| record | [NullableClass.StringPropBoxedString](#stringpropboxedstring)
boxed class to store validated String payloads | +| static class | [NullableClass.StringProp](#stringprop)
schema class | +| sealed interface | [NullableClass.BooleanPropBoxed](#booleanpropboxed)
sealed interface for validated payloads | +| record | [NullableClass.BooleanPropBoxedVoid](#booleanpropboxedvoid)
boxed class to store validated null payloads | +| record | [NullableClass.BooleanPropBoxedBoolean](#booleanpropboxedboolean)
boxed class to store validated boolean payloads | +| static class | [NullableClass.BooleanProp](#booleanprop)
schema class | +| sealed interface | [NullableClass.NumberPropBoxed](#numberpropboxed)
sealed interface for validated payloads | +| record | [NullableClass.NumberPropBoxedVoid](#numberpropboxedvoid)
boxed class to store validated null payloads | +| record | [NullableClass.NumberPropBoxedNumber](#numberpropboxednumber)
boxed class to store validated Number payloads | +| static class | [NullableClass.NumberProp](#numberprop)
schema class | +| sealed interface | [NullableClass.IntegerPropBoxed](#integerpropboxed)
sealed interface for validated payloads | +| record | [NullableClass.IntegerPropBoxedVoid](#integerpropboxedvoid)
boxed class to store validated null payloads | +| record | [NullableClass.IntegerPropBoxedNumber](#integerpropboxednumber)
boxed class to store validated Number payloads | +| static class | [NullableClass.IntegerProp](#integerprop)
schema class | +| sealed interface | [NullableClass.AdditionalProperties3Boxed](#additionalproperties3boxed)
sealed interface for validated payloads | +| record | [NullableClass.AdditionalProperties3BoxedVoid](#additionalproperties3boxedvoid)
boxed class to store validated null payloads | +| record | [NullableClass.AdditionalProperties3BoxedMap](#additionalproperties3boxedmap)
boxed class to store validated Map payloads | +| static class | [NullableClass.AdditionalProperties3](#additionalproperties3)
schema class | + +## NullableClass1Boxed +public sealed interface NullableClass1Boxed
+permits
+[NullableClass1BoxedMap](#nullableclass1boxedmap) + +sealed interface that stores validated payloads using boxed classes + +## NullableClass1BoxedMap +public record NullableClass1BoxedMap
+implements [NullableClass1Boxed](#nullableclass1boxed) + +record that stores validated Map payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| NullableClass1BoxedMap([NullableClassMap](#nullableclassmap) data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| [NullableClassMap](#nullableclassmap) | data()
validated payload | +| @Nullable Object | getData()
validated payload | + +## NullableClass1 +public static class NullableClass1
+extends JsonSchema + +A schema class that validates payloads + +### Code Sample +``` +import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags; +import org.openapijsonschematools.client.configurations.SchemaConfiguration; +import org.openapijsonschematools.client.exceptions.ValidationException; +import org.openapijsonschematools.client.schemas.validation.MapUtils; +import org.openapijsonschematools.client.schemas.validation.FrozenList; +import org.openapijsonschematools.client.schemas.validation.FrozenMap; +import org.openapijsonschematools.client.components.schemas.NullableClass; + +import java.util.Arrays; +import java.util.List; +import java.util.AbstractMap; + +static final SchemaConfiguration configuration = new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().build()); + +// Map validation +NullableClass.NullableClassMap validatedPayload = + NullableClass.NullableClass1.validate( + new NullableClass.NullableClassMapBuilder() + .integer_prop(null) + + .number_prop(null) + + .boolean_prop(null) + + .string_prop(null) + + .date_prop(null) + + .datetime_prop(null) + + .array_nullable_prop(null) + + .array_and_items_nullable_prop(null) + + .array_items_nullable( + Arrays.asList( + null + ) + ) + .object_nullable_prop(null) + + .object_and_items_nullable_prop(null) + + .object_items_nullable( + MapUtils.makeMap( + new AbstractMap.SimpleEntry( + "someAdditionalProperty", + null + ) + ) + ) + .additionalProperty("someAdditionalProperty", null) + + .build(), + configuration +); +``` + +### Field Summary +| Modifier and Type | Field and Description | +| ----------------- | ---------------------- | +| Set> | type = Set.of(Map.class) | +| Map> | properties = Map.ofEntries(
    new PropertyEntry("integer_prop", [IntegerProp.class](#integerprop))),
    new PropertyEntry("number_prop", [NumberProp.class](#numberprop))),
    new PropertyEntry("boolean_prop", [BooleanProp.class](#booleanprop))),
    new PropertyEntry("string_prop", [StringProp.class](#stringprop))),
    new PropertyEntry("date_prop", [DateProp.class](#dateprop))),
    new PropertyEntry("datetime_prop", [DatetimeProp.class](#datetimeprop))),
    new PropertyEntry("array_nullable_prop", [ArrayNullableProp.class](#arraynullableprop))),
    new PropertyEntry("array_and_items_nullable_prop", [ArrayAndItemsNullableProp.class](#arrayanditemsnullableprop))),
    new PropertyEntry("array_items_nullable", [ArrayItemsNullable.class](#arrayitemsnullable))),
    new PropertyEntry("object_nullable_prop", [ObjectNullableProp.class](#objectnullableprop))),
    new PropertyEntry("object_and_items_nullable_prop", [ObjectAndItemsNullableProp.class](#objectanditemsnullableprop))),
    new PropertyEntry("object_items_nullable", [ObjectItemsNullable.class](#objectitemsnullable)))
)
| +| Class | additionalProperties = [AdditionalProperties3.class](#additionalproperties3) | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| [NullableClassMap](#nullableclassmap) | validate([Map<?, ?>](#nullableclassmapbuilder) arg, SchemaConfiguration configuration) | +| [NullableClass1BoxedMap](#nullableclass1boxedmap) | validateAndBox([Map<?, ?>](#nullableclassmapbuilder) arg, SchemaConfiguration configuration) | +| [NullableClass1Boxed](#nullableclass1boxed) | validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) | +| @Nullable Object | validate(@Nullable Object arg, SchemaConfiguration configuration) | + +## NullableClassMapBuilder +public class NullableClassMapBuilder
+builder for `Map` + +A class that builds the Map input type + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| NullableClassMapBuilder()
Creates a builder that contains an empty map | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| Map | build()
Returns map input that should be used with Schema.validate | +| [NullableClassMapBuilder](#nullableclassmapbuilder) | integer_prop(Nothing? value) | +| [NullableClassMapBuilder](#nullableclassmapbuilder) | integer_prop(int value) | +| [NullableClassMapBuilder](#nullableclassmapbuilder) | integer_prop(float value) | +| [NullableClassMapBuilder](#nullableclassmapbuilder) | integer_prop(long value) | +| [NullableClassMapBuilder](#nullableclassmapbuilder) | integer_prop(double value) | +| [NullableClassMapBuilder](#nullableclassmapbuilder) | number_prop(Nothing? value) | +| [NullableClassMapBuilder](#nullableclassmapbuilder) | number_prop(int value) | +| [NullableClassMapBuilder](#nullableclassmapbuilder) | number_prop(float value) | +| [NullableClassMapBuilder](#nullableclassmapbuilder) | number_prop(long value) | +| [NullableClassMapBuilder](#nullableclassmapbuilder) | number_prop(double value) | +| [NullableClassMapBuilder](#nullableclassmapbuilder) | boolean_prop(Nothing? value) | +| [NullableClassMapBuilder](#nullableclassmapbuilder) | boolean_prop(boolean value) | +| [NullableClassMapBuilder](#nullableclassmapbuilder) | string_prop(Nothing? value) | +| [NullableClassMapBuilder](#nullableclassmapbuilder) | string_prop(String value) | +| [NullableClassMapBuilder](#nullableclassmapbuilder) | date_prop(Nothing? value) | +| [NullableClassMapBuilder](#nullableclassmapbuilder) | date_prop(String value) | +| [NullableClassMapBuilder](#nullableclassmapbuilder) | datetime_prop(Nothing? value) | +| [NullableClassMapBuilder](#nullableclassmapbuilder) | datetime_prop(String value) | +| [NullableClassMapBuilder](#nullableclassmapbuilder) | array_nullable_prop(Nothing? value) | +| [NullableClassMapBuilder](#nullableclassmapbuilder) | array_nullable_prop(List> value) | +| [NullableClassMapBuilder](#nullableclassmapbuilder) | array_and_items_nullable_prop(Nothing? value) | +| [NullableClassMapBuilder](#nullableclassmapbuilder) | array_and_items_nullable_prop(List<@Nullable Map> value) | +| [NullableClassMapBuilder](#nullableclassmapbuilder) | array_items_nullable(List<@Nullable Map> value) | +| [NullableClassMapBuilder](#nullableclassmapbuilder) | object_nullable_prop(Nothing? value) | +| [NullableClassMapBuilder](#nullableclassmapbuilder) | object_nullable_prop(Map> value) | +| [NullableClassMapBuilder](#nullableclassmapbuilder) | object_and_items_nullable_prop(Nothing? value) | +| [NullableClassMapBuilder](#nullableclassmapbuilder) | object_and_items_nullable_prop(Map> value) | +| [NullableClassMapBuilder](#nullableclassmapbuilder) | object_items_nullable(Map> value) | +| [NullableClassMapBuilder](#nullableclassmapbuilder) | additionalProperty(String key, Nothing? value) | +| [NullableClassMapBuilder](#nullableclassmapbuilder) | additionalProperty(String key, Map value) | + +## NullableClassMap +public static class NullableClassMap
+extends FrozenMap + +A class to store validated Map payloads + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| static [NullableClassMap](#nullableclassmap) | of([Map](#nullableclassmapbuilder) arg, SchemaConfiguration configuration) | +| @Nullable Number | integer_prop()
[optional] | +| @Nullable Number | number_prop()
[optional] | +| @Nullable Boolean | boolean_prop()
[optional] | +| @Nullable String | string_prop()
[optional] | +| @Nullable String | date_prop()
[optional] value must conform to RFC-3339 full-date YYYY-MM-DD | +| @Nullable String | datetime_prop()
[optional] value must conform to RFC-3339 date-time | +| [ArrayNullablePropList](#arraynullableproplist) | array_nullable_prop()
[optional] | +| [ArrayAndItemsNullablePropList](#arrayanditemsnullableproplist) | array_and_items_nullable_prop()
[optional] | +| [ArrayItemsNullableList](#arrayitemsnullablelist) | array_items_nullable()
[optional] | +| [ObjectNullablePropMap](#objectnullablepropmap) | object_nullable_prop()
[optional] | +| [ObjectAndItemsNullablePropMap](#objectanditemsnullablepropmap) | object_and_items_nullable_prop()
[optional] | +| [ObjectItemsNullableMap](#objectitemsnullablemap) | object_items_nullable()
[optional] | +| @Nullable FrozenMap | getAdditionalProperty(String name)
provides type safety for additional properties | + +## ObjectItemsNullableBoxed +public sealed interface ObjectItemsNullableBoxed
+permits
+[ObjectItemsNullableBoxedMap](#objectitemsnullableboxedmap) + +sealed interface that stores validated payloads using boxed classes + +## ObjectItemsNullableBoxedMap +public record ObjectItemsNullableBoxedMap
+implements [ObjectItemsNullableBoxed](#objectitemsnullableboxed) + +record that stores validated Map payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| ObjectItemsNullableBoxedMap([ObjectItemsNullableMap](#objectitemsnullablemap) data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| [ObjectItemsNullableMap](#objectitemsnullablemap) | data()
validated payload | +| @Nullable Object | getData()
validated payload | + +## ObjectItemsNullable +public static class ObjectItemsNullable
+extends JsonSchema + +A schema class that validates payloads + +### Code Sample +``` +import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags; +import org.openapijsonschematools.client.configurations.SchemaConfiguration; +import org.openapijsonschematools.client.exceptions.ValidationException; +import org.openapijsonschematools.client.schemas.validation.MapUtils; +import org.openapijsonschematools.client.schemas.validation.FrozenList; +import org.openapijsonschematools.client.schemas.validation.FrozenMap; +import org.openapijsonschematools.client.components.schemas.NullableClass; + +import java.util.Arrays; +import java.util.List; +import java.util.AbstractMap; + +static final SchemaConfiguration configuration = new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().build()); + +// Map validation +NullableClass.ObjectItemsNullableMap validatedPayload = + NullableClass.ObjectItemsNullable.validate( + new NullableClass.ObjectItemsNullableMapBuilder() + .additionalProperty("someAdditionalProperty", null) + + .build(), + configuration +); +``` + +### Field Summary +| Modifier and Type | Field and Description | +| ----------------- | ---------------------- | +| Set> | type = Set.of(Map.class) | +| Class | additionalProperties = [AdditionalProperties2.class](#additionalproperties2) | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| [ObjectItemsNullableMap](#objectitemsnullablemap) | validate([Map<?, ?>](#objectitemsnullablemapbuilder) arg, SchemaConfiguration configuration) | +| [ObjectItemsNullableBoxedMap](#objectitemsnullableboxedmap) | validateAndBox([Map<?, ?>](#objectitemsnullablemapbuilder) arg, SchemaConfiguration configuration) | +| [ObjectItemsNullableBoxed](#objectitemsnullableboxed) | validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) | +| @Nullable Object | validate(@Nullable Object arg, SchemaConfiguration configuration) | + +## ObjectItemsNullableMapBuilder +public class ObjectItemsNullableMapBuilder
+builder for `Map>` + +A class that builds the Map input type + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| ObjectItemsNullableMapBuilder()
Creates a builder that contains an empty map | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| Map> | build()
Returns map input that should be used with Schema.validate | +| [ObjectItemsNullableMapBuilder](#objectitemsnullablemapbuilder) | additionalProperty(String key, Nothing? value) | +| [ObjectItemsNullableMapBuilder](#objectitemsnullablemapbuilder) | additionalProperty(String key, Map value) | + +## ObjectItemsNullableMap +public static class ObjectItemsNullableMap
+extends FrozenMap> + +A class to store validated Map payloads + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| static [ObjectItemsNullableMap](#objectitemsnullablemap) | of([Map>](#objectitemsnullablemapbuilder) arg, SchemaConfiguration configuration) | +| @Nullable FrozenMap | getAdditionalProperty(String name)
provides type safety for additional properties | + +## AdditionalProperties2Boxed +public sealed interface AdditionalProperties2Boxed
+permits
+[AdditionalProperties2BoxedVoid](#additionalproperties2boxedvoid), +[AdditionalProperties2BoxedMap](#additionalproperties2boxedmap) + +sealed interface that stores validated payloads using boxed classes + +## AdditionalProperties2BoxedVoid +public record AdditionalProperties2BoxedVoid
+implements [AdditionalProperties2Boxed](#additionalproperties2boxed) + +record that stores validated null payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| AdditionalProperties2BoxedVoid(Nothing? data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| Nothing? | data()
validated payload | +| @Nullable Object | getData()
validated payload | + +## AdditionalProperties2BoxedMap +public record AdditionalProperties2BoxedMap
+implements [AdditionalProperties2Boxed](#additionalproperties2boxed) + +record that stores validated Map payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| AdditionalProperties2BoxedMap(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 | + +## AdditionalProperties2 +public static class AdditionalProperties2
+extends JsonSchema + +A schema class that validates payloads + +### Code Sample +``` +import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags; +import org.openapijsonschematools.client.configurations.SchemaConfiguration; +import org.openapijsonschematools.client.exceptions.ValidationException; +import org.openapijsonschematools.client.schemas.validation.MapUtils; +import org.openapijsonschematools.client.schemas.validation.FrozenList; +import org.openapijsonschematools.client.schemas.validation.FrozenMap; +import org.openapijsonschematools.client.components.schemas.NullableClass; + +import java.util.Arrays; +import java.util.List; +import java.util.AbstractMap; + +static final SchemaConfiguration configuration = new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().build()); + +// null validation +Nothing? validatedPayload = NullableClass.AdditionalProperties2.validate( + (Nothing?) null, + configuration +); +``` + +### Field Summary +| Modifier and Type | Field and Description | +| ----------------- | ---------------------- | +| Set> | type = Set.of(
    Nothing?.class,
    Map.class
)
| + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| Nothing? | validate(Nothing? arg, SchemaConfiguration configuration) | +| [AdditionalProperties2BoxedVoid](#additionalproperties2boxedvoid) | validateAndBox(Nothing? arg, SchemaConfiguration configuration) | +| FrozenMap | validate(Map<?, ?> arg, SchemaConfiguration configuration) | +| [AdditionalProperties2BoxedMap](#additionalproperties2boxedmap) | validateAndBox(Map<?, ?> arg, SchemaConfiguration configuration) | +| [AdditionalProperties2Boxed](#additionalproperties2boxed) | validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) | +| @Nullable Object | validate(@Nullable Object arg, SchemaConfiguration configuration) | + +## ObjectAndItemsNullablePropBoxed +public sealed interface ObjectAndItemsNullablePropBoxed
+permits
+[ObjectAndItemsNullablePropBoxedVoid](#objectanditemsnullablepropboxedvoid), +[ObjectAndItemsNullablePropBoxedMap](#objectanditemsnullablepropboxedmap) + +sealed interface that stores validated payloads using boxed classes + +## ObjectAndItemsNullablePropBoxedVoid +public record ObjectAndItemsNullablePropBoxedVoid
+implements [ObjectAndItemsNullablePropBoxed](#objectanditemsnullablepropboxed) + +record that stores validated null payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| ObjectAndItemsNullablePropBoxedVoid(Nothing? data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| Nothing? | data()
validated payload | +| @Nullable Object | getData()
validated payload | + +## ObjectAndItemsNullablePropBoxedMap +public record ObjectAndItemsNullablePropBoxedMap
+implements [ObjectAndItemsNullablePropBoxed](#objectanditemsnullablepropboxed) + +record that stores validated Map payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| ObjectAndItemsNullablePropBoxedMap([ObjectAndItemsNullablePropMap](#objectanditemsnullablepropmap) data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| [ObjectAndItemsNullablePropMap](#objectanditemsnullablepropmap) | data()
validated payload | +| @Nullable Object | getData()
validated payload | + +## ObjectAndItemsNullableProp +public static class ObjectAndItemsNullableProp
+extends JsonSchema + +A schema class that validates payloads + +### Code Sample +``` +import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags; +import org.openapijsonschematools.client.configurations.SchemaConfiguration; +import org.openapijsonschematools.client.exceptions.ValidationException; +import org.openapijsonschematools.client.schemas.validation.MapUtils; +import org.openapijsonschematools.client.schemas.validation.FrozenList; +import org.openapijsonschematools.client.schemas.validation.FrozenMap; +import org.openapijsonschematools.client.components.schemas.NullableClass; + +import java.util.Arrays; +import java.util.List; +import java.util.AbstractMap; + +static final SchemaConfiguration configuration = new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().build()); + +// null validation +Nothing? validatedPayload = NullableClass.ObjectAndItemsNullableProp.validate( + (Nothing?) null, + configuration +); + +// Map validation +NullableClass.ObjectAndItemsNullablePropMap validatedPayload = + NullableClass.ObjectAndItemsNullableProp.validate( + new NullableClass.ObjectAndItemsNullablePropMapBuilder() + .additionalProperty("someAdditionalProperty", null) + + .build(), + configuration +); +``` + +### Field Summary +| Modifier and Type | Field and Description | +| ----------------- | ---------------------- | +| Set> | type = Set.of(
    Nothing?.class,
    Map.class
)
| +| Class | additionalProperties = [AdditionalProperties1.class](#additionalproperties1) | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| Nothing? | validate(Nothing? arg, SchemaConfiguration configuration) | +| [ObjectAndItemsNullablePropBoxedVoid](#objectanditemsnullablepropboxedvoid) | validateAndBox(Nothing? arg, SchemaConfiguration configuration) | +| [ObjectAndItemsNullablePropMap](#objectanditemsnullablepropmap) | validate([Map<?, ?>](#objectanditemsnullablepropmapbuilder) arg, SchemaConfiguration configuration) | +| [ObjectAndItemsNullablePropBoxedMap](#objectanditemsnullablepropboxedmap) | validateAndBox([Map<?, ?>](#objectanditemsnullablepropmapbuilder) arg, SchemaConfiguration configuration) | +| [ObjectAndItemsNullablePropBoxed](#objectanditemsnullablepropboxed) | validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) | +| @Nullable Object | validate(@Nullable Object arg, SchemaConfiguration configuration) | + +## ObjectAndItemsNullablePropMapBuilder +public class ObjectAndItemsNullablePropMapBuilder
+builder for `Map>` + +A class that builds the Map input type + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| ObjectAndItemsNullablePropMapBuilder()
Creates a builder that contains an empty map | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| Map> | build()
Returns map input that should be used with Schema.validate | +| [ObjectAndItemsNullablePropMapBuilder](#objectanditemsnullablepropmapbuilder) | additionalProperty(String key, Nothing? value) | +| [ObjectAndItemsNullablePropMapBuilder](#objectanditemsnullablepropmapbuilder) | additionalProperty(String key, Map value) | + +## ObjectAndItemsNullablePropMap +public static class ObjectAndItemsNullablePropMap
+extends FrozenMap> + +A class to store validated Map payloads + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| static [ObjectAndItemsNullablePropMap](#objectanditemsnullablepropmap) | of([Map>](#objectanditemsnullablepropmapbuilder) arg, SchemaConfiguration configuration) | +| @Nullable FrozenMap | getAdditionalProperty(String name)
provides type safety for additional properties | + +## AdditionalProperties1Boxed +public sealed interface AdditionalProperties1Boxed
+permits
+[AdditionalProperties1BoxedVoid](#additionalproperties1boxedvoid), +[AdditionalProperties1BoxedMap](#additionalproperties1boxedmap) + +sealed interface that stores validated payloads using boxed classes + +## AdditionalProperties1BoxedVoid +public record AdditionalProperties1BoxedVoid
+implements [AdditionalProperties1Boxed](#additionalproperties1boxed) + +record that stores validated null payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| AdditionalProperties1BoxedVoid(Nothing? data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| Nothing? | data()
validated payload | +| @Nullable Object | getData()
validated payload | + +## AdditionalProperties1BoxedMap +public record AdditionalProperties1BoxedMap
+implements [AdditionalProperties1Boxed](#additionalproperties1boxed) + +record that stores validated Map payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| AdditionalProperties1BoxedMap(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 | + +## AdditionalProperties1 +public static class AdditionalProperties1
+extends JsonSchema + +A schema class that validates payloads + +### Code Sample +``` +import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags; +import org.openapijsonschematools.client.configurations.SchemaConfiguration; +import org.openapijsonschematools.client.exceptions.ValidationException; +import org.openapijsonschematools.client.schemas.validation.MapUtils; +import org.openapijsonschematools.client.schemas.validation.FrozenList; +import org.openapijsonschematools.client.schemas.validation.FrozenMap; +import org.openapijsonschematools.client.components.schemas.NullableClass; + +import java.util.Arrays; +import java.util.List; +import java.util.AbstractMap; + +static final SchemaConfiguration configuration = new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().build()); + +// null validation +Nothing? validatedPayload = NullableClass.AdditionalProperties1.validate( + (Nothing?) null, + configuration +); +``` + +### Field Summary +| Modifier and Type | Field and Description | +| ----------------- | ---------------------- | +| Set> | type = Set.of(
    Nothing?.class,
    Map.class
)
| + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| Nothing? | validate(Nothing? arg, SchemaConfiguration configuration) | +| [AdditionalProperties1BoxedVoid](#additionalproperties1boxedvoid) | validateAndBox(Nothing? arg, SchemaConfiguration configuration) | +| FrozenMap | validate(Map<?, ?> arg, SchemaConfiguration configuration) | +| [AdditionalProperties1BoxedMap](#additionalproperties1boxedmap) | validateAndBox(Map<?, ?> arg, SchemaConfiguration configuration) | +| [AdditionalProperties1Boxed](#additionalproperties1boxed) | validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) | +| @Nullable Object | validate(@Nullable Object arg, SchemaConfiguration configuration) | + +## ObjectNullablePropBoxed +public sealed interface ObjectNullablePropBoxed
+permits
+[ObjectNullablePropBoxedVoid](#objectnullablepropboxedvoid), +[ObjectNullablePropBoxedMap](#objectnullablepropboxedmap) + +sealed interface that stores validated payloads using boxed classes + +## ObjectNullablePropBoxedVoid +public record ObjectNullablePropBoxedVoid
+implements [ObjectNullablePropBoxed](#objectnullablepropboxed) + +record that stores validated null payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| ObjectNullablePropBoxedVoid(Nothing? data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| Nothing? | data()
validated payload | +| @Nullable Object | getData()
validated payload | + +## ObjectNullablePropBoxedMap +public record ObjectNullablePropBoxedMap
+implements [ObjectNullablePropBoxed](#objectnullablepropboxed) + +record that stores validated Map payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| ObjectNullablePropBoxedMap([ObjectNullablePropMap](#objectnullablepropmap) data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| [ObjectNullablePropMap](#objectnullablepropmap) | data()
validated payload | +| @Nullable Object | getData()
validated payload | + +## ObjectNullableProp +public static class ObjectNullableProp
+extends JsonSchema + +A schema class that validates payloads + +### Code Sample +``` +import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags; +import org.openapijsonschematools.client.configurations.SchemaConfiguration; +import org.openapijsonschematools.client.exceptions.ValidationException; +import org.openapijsonschematools.client.schemas.validation.MapUtils; +import org.openapijsonschematools.client.schemas.validation.FrozenList; +import org.openapijsonschematools.client.schemas.validation.FrozenMap; +import org.openapijsonschematools.client.components.schemas.NullableClass; + +import java.util.Arrays; +import java.util.List; +import java.util.AbstractMap; + +static final SchemaConfiguration configuration = new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().build()); + +// null validation +Nothing? validatedPayload = NullableClass.ObjectNullableProp.validate( + (Nothing?) null, + configuration +); + +// Map validation +NullableClass.ObjectNullablePropMap validatedPayload = + NullableClass.ObjectNullableProp.validate( + new NullableClass.ObjectNullablePropMapBuilder() + .build(), + configuration +); +``` + +### Field Summary +| Modifier and Type | Field and Description | +| ----------------- | ---------------------- | +| Set> | type = Set.of(
    Nothing?.class,
    Map.class
)
| +| Class | additionalProperties = [AdditionalProperties.class](#additionalproperties) | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| Nothing? | validate(Nothing? arg, SchemaConfiguration configuration) | +| [ObjectNullablePropBoxedVoid](#objectnullablepropboxedvoid) | validateAndBox(Nothing? arg, SchemaConfiguration configuration) | +| [ObjectNullablePropMap](#objectnullablepropmap) | validate([Map<?, ?>](#objectnullablepropmapbuilder) arg, SchemaConfiguration configuration) | +| [ObjectNullablePropBoxedMap](#objectnullablepropboxedmap) | validateAndBox([Map<?, ?>](#objectnullablepropmapbuilder) arg, SchemaConfiguration configuration) | +| [ObjectNullablePropBoxed](#objectnullablepropboxed) | validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) | +| @Nullable Object | validate(@Nullable Object arg, SchemaConfiguration configuration) | + +## ObjectNullablePropMapBuilder +public class ObjectNullablePropMapBuilder
+builder for `Map>` + +A class that builds the Map input type + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| ObjectNullablePropMapBuilder()
Creates a builder that contains an empty map | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| Map> | build()
Returns map input that should be used with Schema.validate | +| [ObjectNullablePropMapBuilder](#objectnullablepropmapbuilder) | additionalProperty(String key, Map value) | + +## ObjectNullablePropMap +public static class ObjectNullablePropMap
+extends FrozenMap> + +A class to store validated Map payloads + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| static [ObjectNullablePropMap](#objectnullablepropmap) | of([Map>](#objectnullablepropmapbuilder) arg, SchemaConfiguration configuration) | +| FrozenMap | getAdditionalProperty(String name)
provides type safety for additional properties | + +## AdditionalPropertiesBoxed +public sealed interface AdditionalPropertiesBoxed
+permits
+[AdditionalPropertiesBoxedMap](#additionalpropertiesboxedmap) + +sealed interface that stores validated payloads using boxed classes + +## 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 MapJsonSchema.MapJsonSchema1 + +A schema class that validates payloads + +| Methods Inherited from class org.openapijsonschematools.client.schemas.MapJsonSchema.MapJsonSchema1 | +| ------------------------------------------------------------------ | +| validate | +| validateAndBox | + +## ArrayItemsNullableBoxed +public sealed interface ArrayItemsNullableBoxed
+permits
+[ArrayItemsNullableBoxedList](#arrayitemsnullableboxedlist) + +sealed interface that stores validated payloads using boxed classes + +## ArrayItemsNullableBoxedList +public record ArrayItemsNullableBoxedList
+implements [ArrayItemsNullableBoxed](#arrayitemsnullableboxed) + +record that stores validated List payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| ArrayItemsNullableBoxedList([ArrayItemsNullableList](#arrayitemsnullablelist) data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| [ArrayItemsNullableList](#arrayitemsnullablelist) | data()
validated payload | +| @Nullable Object | getData()
validated payload | + +## ArrayItemsNullable +public static class ArrayItemsNullable
+extends JsonSchema + +A schema class that validates payloads + +### Code Sample +``` +import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags; +import org.openapijsonschematools.client.configurations.SchemaConfiguration; +import org.openapijsonschematools.client.exceptions.ValidationException; +import org.openapijsonschematools.client.schemas.validation.MapUtils; +import org.openapijsonschematools.client.schemas.validation.FrozenList; +import org.openapijsonschematools.client.schemas.validation.FrozenMap; +import org.openapijsonschematools.client.components.schemas.NullableClass; + +import java.util.Arrays; +import java.util.List; +import java.util.AbstractMap; + +static final SchemaConfiguration configuration = new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().build()); + +// List validation +NullableClass.ArrayItemsNullableList validatedPayload = + NullableClass.ArrayItemsNullable.validate( + new NullableClass.ArrayItemsNullableListBuilder() + .add((Nothing?) null) + + .build(), + configuration +); +``` + +### Field Summary +| Modifier and Type | Field and Description | +| ----------------- | ---------------------- | +| Set> | type = Set.of(List.class) | +| Class | items = [Items2.class](#items2) | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| [ArrayItemsNullableList](#arrayitemsnullablelist) | validate([List](#arrayitemsnullablelistbuilder) arg, SchemaConfiguration configuration) | +| [ArrayItemsNullableBoxedList](#arrayitemsnullableboxedlist) | validateAndBox([List](#arrayitemsnullablelistbuilder) arg, SchemaConfiguration configuration) | +| [ArrayItemsNullableBoxed](#arrayitemsnullableboxed) | validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) | +| @Nullable Object | validate(@Nullable Object arg, SchemaConfiguration configuration) | + +## ArrayItemsNullableListBuilder +public class ArrayItemsNullableListBuilder
+builder for `List<@Nullable Map>` + +A class that builds the List input type + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| ArrayItemsNullableListBuilder()
Creates an empty list | +| ArrayItemsNullableListBuilder(List<@Nullable Map> items)
Stores the items in a list | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| ArrayItemsNullableListBuilder | add(Nothing? item) | +| ArrayItemsNullableListBuilder | add(Map item) | +| List<@Nullable Map> | build()
Returns list input that should be used with Schema.validate | + +## ArrayItemsNullableList +public class ArrayItemsNullableList
+extends `FrozenList<@Nullable FrozenMap>` + +A class to store validated List payloads + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| static [ArrayItemsNullableList](#arrayitemsnullablelist) | of([List>](#arrayitemsnullablelistbuilder) arg, SchemaConfiguration configuration) | + +## Items2Boxed +public sealed interface Items2Boxed
+permits
+[Items2BoxedVoid](#items2boxedvoid), +[Items2BoxedMap](#items2boxedmap) + +sealed interface that stores validated payloads using boxed classes + +## Items2BoxedVoid +public record Items2BoxedVoid
+implements [Items2Boxed](#items2boxed) + +record that stores validated null payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| Items2BoxedVoid(Nothing? data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| Nothing? | data()
validated payload | +| @Nullable Object | getData()
validated payload | + +## Items2BoxedMap +public record Items2BoxedMap
+implements [Items2Boxed](#items2boxed) + +record that stores validated Map payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| Items2BoxedMap(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 | + +## Items2 +public static class Items2
+extends JsonSchema + +A schema class that validates payloads + +### Code Sample +``` +import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags; +import org.openapijsonschematools.client.configurations.SchemaConfiguration; +import org.openapijsonschematools.client.exceptions.ValidationException; +import org.openapijsonschematools.client.schemas.validation.MapUtils; +import org.openapijsonschematools.client.schemas.validation.FrozenList; +import org.openapijsonschematools.client.schemas.validation.FrozenMap; +import org.openapijsonschematools.client.components.schemas.NullableClass; + +import java.util.Arrays; +import java.util.List; +import java.util.AbstractMap; + +static final SchemaConfiguration configuration = new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().build()); + +// null validation +Nothing? validatedPayload = NullableClass.Items2.validate( + (Nothing?) null, + configuration +); +``` + +### Field Summary +| Modifier and Type | Field and Description | +| ----------------- | ---------------------- | +| Set> | type = Set.of(
    Nothing?.class,
    Map.class
)
| + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| Nothing? | validate(Nothing? arg, SchemaConfiguration configuration) | +| [Items2BoxedVoid](#items2boxedvoid) | validateAndBox(Nothing? arg, SchemaConfiguration configuration) | +| FrozenMap | validate(Map<?, ?> arg, SchemaConfiguration configuration) | +| [Items2BoxedMap](#items2boxedmap) | validateAndBox(Map<?, ?> arg, SchemaConfiguration configuration) | +| [Items2Boxed](#items2boxed) | validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) | +| @Nullable Object | validate(@Nullable Object arg, SchemaConfiguration configuration) | + +## ArrayAndItemsNullablePropBoxed +public sealed interface ArrayAndItemsNullablePropBoxed
+permits
+[ArrayAndItemsNullablePropBoxedVoid](#arrayanditemsnullablepropboxedvoid), +[ArrayAndItemsNullablePropBoxedList](#arrayanditemsnullablepropboxedlist) + +sealed interface that stores validated payloads using boxed classes + +## ArrayAndItemsNullablePropBoxedVoid +public record ArrayAndItemsNullablePropBoxedVoid
+implements [ArrayAndItemsNullablePropBoxed](#arrayanditemsnullablepropboxed) + +record that stores validated null payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| ArrayAndItemsNullablePropBoxedVoid(Nothing? data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| Nothing? | data()
validated payload | +| @Nullable Object | getData()
validated payload | + +## ArrayAndItemsNullablePropBoxedList +public record ArrayAndItemsNullablePropBoxedList
+implements [ArrayAndItemsNullablePropBoxed](#arrayanditemsnullablepropboxed) + +record that stores validated List payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| ArrayAndItemsNullablePropBoxedList([ArrayAndItemsNullablePropList](#arrayanditemsnullableproplist) data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| [ArrayAndItemsNullablePropList](#arrayanditemsnullableproplist) | data()
validated payload | +| @Nullable Object | getData()
validated payload | + +## ArrayAndItemsNullableProp +public static class ArrayAndItemsNullableProp
+extends JsonSchema + +A schema class that validates payloads + +### Code Sample +``` +import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags; +import org.openapijsonschematools.client.configurations.SchemaConfiguration; +import org.openapijsonschematools.client.exceptions.ValidationException; +import org.openapijsonschematools.client.schemas.validation.MapUtils; +import org.openapijsonschematools.client.schemas.validation.FrozenList; +import org.openapijsonschematools.client.schemas.validation.FrozenMap; +import org.openapijsonschematools.client.components.schemas.NullableClass; + +import java.util.Arrays; +import java.util.List; +import java.util.AbstractMap; + +static final SchemaConfiguration configuration = new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().build()); + +// null validation +Nothing? validatedPayload = NullableClass.ArrayAndItemsNullableProp.validate( + (Nothing?) null, + configuration +); + +// List validation +NullableClass.ArrayAndItemsNullablePropList validatedPayload = + NullableClass.ArrayAndItemsNullableProp.validate( + new NullableClass.ArrayAndItemsNullablePropListBuilder() + .add((Nothing?) null) + + .build(), + configuration +); +``` + +### Field Summary +| Modifier and Type | Field and Description | +| ----------------- | ---------------------- | +| Set> | type = Set.of(
    Nothing?.class,
    List.class
)
| +| Class | items = [Items1.class](#items1) | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| Nothing? | validate(Nothing? arg, SchemaConfiguration configuration) | +| [ArrayAndItemsNullablePropBoxedVoid](#arrayanditemsnullablepropboxedvoid) | validateAndBox(Nothing? arg, SchemaConfiguration configuration) | +| [ArrayAndItemsNullablePropList](#arrayanditemsnullableproplist) | validate([List](#arrayanditemsnullableproplistbuilder) arg, SchemaConfiguration configuration) | +| [ArrayAndItemsNullablePropBoxedList](#arrayanditemsnullablepropboxedlist) | validateAndBox([List](#arrayanditemsnullableproplistbuilder) arg, SchemaConfiguration configuration) | +| [ArrayAndItemsNullablePropBoxed](#arrayanditemsnullablepropboxed) | validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) | +| @Nullable Object | validate(@Nullable Object arg, SchemaConfiguration configuration) | + +## ArrayAndItemsNullablePropListBuilder +public class ArrayAndItemsNullablePropListBuilder
+builder for `List<@Nullable Map>` + +A class that builds the List input type + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| ArrayAndItemsNullablePropListBuilder()
Creates an empty list | +| ArrayAndItemsNullablePropListBuilder(List<@Nullable Map> items)
Stores the items in a list | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| ArrayAndItemsNullablePropListBuilder | add(Nothing? item) | +| ArrayAndItemsNullablePropListBuilder | add(Map item) | +| List<@Nullable Map> | build()
Returns list input that should be used with Schema.validate | + +## ArrayAndItemsNullablePropList +public class ArrayAndItemsNullablePropList
+extends `FrozenList<@Nullable FrozenMap>` + +A class to store validated List payloads + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| static [ArrayAndItemsNullablePropList](#arrayanditemsnullableproplist) | of([List>](#arrayanditemsnullableproplistbuilder) arg, SchemaConfiguration configuration) | + +## Items1Boxed +public sealed interface Items1Boxed
+permits
+[Items1BoxedVoid](#items1boxedvoid), +[Items1BoxedMap](#items1boxedmap) + +sealed interface that stores validated payloads using boxed classes + +## Items1BoxedVoid +public record Items1BoxedVoid
+implements [Items1Boxed](#items1boxed) + +record that stores validated null payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| Items1BoxedVoid(Nothing? data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| Nothing? | data()
validated payload | +| @Nullable Object | getData()
validated payload | + +## Items1BoxedMap +public record Items1BoxedMap
+implements [Items1Boxed](#items1boxed) + +record that stores validated Map payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| Items1BoxedMap(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 | + +## Items1 +public static class Items1
+extends JsonSchema + +A schema class that validates payloads + +### Code Sample +``` +import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags; +import org.openapijsonschematools.client.configurations.SchemaConfiguration; +import org.openapijsonschematools.client.exceptions.ValidationException; +import org.openapijsonschematools.client.schemas.validation.MapUtils; +import org.openapijsonschematools.client.schemas.validation.FrozenList; +import org.openapijsonschematools.client.schemas.validation.FrozenMap; +import org.openapijsonschematools.client.components.schemas.NullableClass; + +import java.util.Arrays; +import java.util.List; +import java.util.AbstractMap; + +static final SchemaConfiguration configuration = new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().build()); + +// null validation +Nothing? validatedPayload = NullableClass.Items1.validate( + (Nothing?) null, + configuration +); +``` + +### Field Summary +| Modifier and Type | Field and Description | +| ----------------- | ---------------------- | +| Set> | type = Set.of(
    Nothing?.class,
    Map.class
)
| + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| Nothing? | validate(Nothing? arg, SchemaConfiguration configuration) | +| [Items1BoxedVoid](#items1boxedvoid) | validateAndBox(Nothing? arg, SchemaConfiguration configuration) | +| FrozenMap | validate(Map<?, ?> arg, SchemaConfiguration configuration) | +| [Items1BoxedMap](#items1boxedmap) | validateAndBox(Map<?, ?> arg, SchemaConfiguration configuration) | +| [Items1Boxed](#items1boxed) | validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) | +| @Nullable Object | validate(@Nullable Object arg, SchemaConfiguration configuration) | + +## ArrayNullablePropBoxed +public sealed interface ArrayNullablePropBoxed
+permits
+[ArrayNullablePropBoxedVoid](#arraynullablepropboxedvoid), +[ArrayNullablePropBoxedList](#arraynullablepropboxedlist) + +sealed interface that stores validated payloads using boxed classes + +## ArrayNullablePropBoxedVoid +public record ArrayNullablePropBoxedVoid
+implements [ArrayNullablePropBoxed](#arraynullablepropboxed) + +record that stores validated null payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| ArrayNullablePropBoxedVoid(Nothing? data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| Nothing? | data()
validated payload | +| @Nullable Object | getData()
validated payload | + +## ArrayNullablePropBoxedList +public record ArrayNullablePropBoxedList
+implements [ArrayNullablePropBoxed](#arraynullablepropboxed) + +record that stores validated List payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| ArrayNullablePropBoxedList([ArrayNullablePropList](#arraynullableproplist) data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| [ArrayNullablePropList](#arraynullableproplist) | data()
validated payload | +| @Nullable Object | getData()
validated payload | + +## ArrayNullableProp +public static class ArrayNullableProp
+extends JsonSchema + +A schema class that validates payloads + +### Code Sample +``` +import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags; +import org.openapijsonschematools.client.configurations.SchemaConfiguration; +import org.openapijsonschematools.client.exceptions.ValidationException; +import org.openapijsonschematools.client.schemas.validation.MapUtils; +import org.openapijsonschematools.client.schemas.validation.FrozenList; +import org.openapijsonschematools.client.schemas.validation.FrozenMap; +import org.openapijsonschematools.client.components.schemas.NullableClass; + +import java.util.Arrays; +import java.util.List; +import java.util.AbstractMap; + +static final SchemaConfiguration configuration = new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().build()); + +// null validation +Nothing? validatedPayload = NullableClass.ArrayNullableProp.validate( + (Nothing?) null, + configuration +); + +// List validation +NullableClass.ArrayNullablePropList validatedPayload = + NullableClass.ArrayNullableProp.validate( + new NullableClass.ArrayNullablePropListBuilder() + .build(), + configuration +); +``` + +### Field Summary +| Modifier and Type | Field and Description | +| ----------------- | ---------------------- | +| Set> | type = Set.of(
    Nothing?.class,
    List.class
)
| +| Class | items = [Items.class](#items) | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| Nothing? | validate(Nothing? arg, SchemaConfiguration configuration) | +| [ArrayNullablePropBoxedVoid](#arraynullablepropboxedvoid) | validateAndBox(Nothing? arg, SchemaConfiguration configuration) | +| [ArrayNullablePropList](#arraynullableproplist) | validate([List](#arraynullableproplistbuilder) arg, SchemaConfiguration configuration) | +| [ArrayNullablePropBoxedList](#arraynullablepropboxedlist) | validateAndBox([List](#arraynullableproplistbuilder) arg, SchemaConfiguration configuration) | +| [ArrayNullablePropBoxed](#arraynullablepropboxed) | validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) | +| @Nullable Object | validate(@Nullable Object arg, SchemaConfiguration configuration) | + +## ArrayNullablePropListBuilder +public class ArrayNullablePropListBuilder
+builder for `List>` + +A class that builds the List input type + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| ArrayNullablePropListBuilder()
Creates an empty list | +| ArrayNullablePropListBuilder(List> items)
Stores the items in a list | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| ArrayNullablePropListBuilder | add(Map item) | +| List> | build()
Returns list input that should be used with Schema.validate | + +## ArrayNullablePropList +public class ArrayNullablePropList
+extends `FrozenList>` + +A class to store validated List payloads + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| static [ArrayNullablePropList](#arraynullableproplist) | of([List>](#arraynullableproplistbuilder) arg, SchemaConfiguration configuration) | + +## ItemsBoxed +public sealed interface ItemsBoxed
+permits
+[ItemsBoxedMap](#itemsboxedmap) + +sealed interface that stores validated payloads using boxed classes + +## ItemsBoxedMap +public record ItemsBoxedMap
+implements [ItemsBoxed](#itemsboxed) + +record that stores validated Map payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| ItemsBoxedMap(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 | + +## Items +public static class Items
+extends MapJsonSchema.MapJsonSchema1 + +A schema class that validates payloads + +| Methods Inherited from class org.openapijsonschematools.client.schemas.MapJsonSchema.MapJsonSchema1 | +| ------------------------------------------------------------------ | +| validate | +| validateAndBox | + +## DatetimePropBoxed +public sealed interface DatetimePropBoxed
+permits
+[DatetimePropBoxedVoid](#datetimepropboxedvoid), +[DatetimePropBoxedString](#datetimepropboxedstring) + +sealed interface that stores validated payloads using boxed classes + +## DatetimePropBoxedVoid +public record DatetimePropBoxedVoid
+implements [DatetimePropBoxed](#datetimepropboxed) + +record that stores validated null payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| DatetimePropBoxedVoid(Nothing? data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| Nothing? | data()
validated payload | +| @Nullable Object | getData()
validated payload | + +## DatetimePropBoxedString +public record DatetimePropBoxedString
+implements [DatetimePropBoxed](#datetimepropboxed) + +record that stores validated String payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| DatetimePropBoxedString(String data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| String | data()
validated payload | +| @Nullable Object | getData()
validated payload | + +## DatetimeProp +public static class DatetimeProp
+extends JsonSchema + +A schema class that validates payloads + +### Code Sample +``` +import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags; +import org.openapijsonschematools.client.configurations.SchemaConfiguration; +import org.openapijsonschematools.client.exceptions.ValidationException; +import org.openapijsonschematools.client.schemas.validation.MapUtils; +import org.openapijsonschematools.client.schemas.validation.FrozenList; +import org.openapijsonschematools.client.schemas.validation.FrozenMap; +import org.openapijsonschematools.client.components.schemas.NullableClass; + +import java.util.Arrays; +import java.util.List; +import java.util.AbstractMap; + +static final SchemaConfiguration configuration = new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().build()); + +// null validation +Nothing? validatedPayload = NullableClass.DatetimeProp.validate( + (Nothing?) null, + configuration +); + +// String validation +String validatedPayload = NullableClass.DatetimeProp.validate( + "1970-01-01T00:00:00.00Z", + configuration +); +``` + +### Field Summary +| Modifier and Type | Field and Description | +| ----------------- | ---------------------- | +| Set> | type = Set.of(
    Nothing?.class,
    String.class
)
| +| String | type = "date-time"; | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| Nothing? | validate(Nothing? arg, SchemaConfiguration configuration) | +| [DatetimePropBoxedVoid](#datetimepropboxedvoid) | validateAndBox(Nothing? arg, SchemaConfiguration configuration) | +| String | validate(String arg, SchemaConfiguration configuration) | +| [DatetimePropBoxedString](#datetimepropboxedstring) | validateAndBox(String arg, SchemaConfiguration configuration) | +| [DatetimePropBoxed](#datetimepropboxed) | validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) | +| @Nullable Object | validate(@Nullable Object arg, SchemaConfiguration configuration) | + +## DatePropBoxed +public sealed interface DatePropBoxed
+permits
+[DatePropBoxedVoid](#datepropboxedvoid), +[DatePropBoxedString](#datepropboxedstring) + +sealed interface that stores validated payloads using boxed classes + +## DatePropBoxedVoid +public record DatePropBoxedVoid
+implements [DatePropBoxed](#datepropboxed) + +record that stores validated null payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| DatePropBoxedVoid(Nothing? data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| Nothing? | data()
validated payload | +| @Nullable Object | getData()
validated payload | + +## DatePropBoxedString +public record DatePropBoxedString
+implements [DatePropBoxed](#datepropboxed) + +record that stores validated String payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| DatePropBoxedString(String data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| String | data()
validated payload | +| @Nullable Object | getData()
validated payload | + +## DateProp +public static class DateProp
+extends JsonSchema + +A schema class that validates payloads + +### Code Sample +``` +import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags; +import org.openapijsonschematools.client.configurations.SchemaConfiguration; +import org.openapijsonschematools.client.exceptions.ValidationException; +import org.openapijsonschematools.client.schemas.validation.MapUtils; +import org.openapijsonschematools.client.schemas.validation.FrozenList; +import org.openapijsonschematools.client.schemas.validation.FrozenMap; +import org.openapijsonschematools.client.components.schemas.NullableClass; + +import java.util.Arrays; +import java.util.List; +import java.util.AbstractMap; + +static final SchemaConfiguration configuration = new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().build()); + +// null validation +Nothing? validatedPayload = NullableClass.DateProp.validate( + (Nothing?) null, + configuration +); + +// String validation +String validatedPayload = NullableClass.DateProp.validate( + "2020-12-13", + configuration +); +``` + +### Field Summary +| Modifier and Type | Field and Description | +| ----------------- | ---------------------- | +| Set> | type = Set.of(
    Nothing?.class,
    String.class
)
| +| String | type = "date"; | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| Nothing? | validate(Nothing? arg, SchemaConfiguration configuration) | +| [DatePropBoxedVoid](#datepropboxedvoid) | validateAndBox(Nothing? arg, SchemaConfiguration configuration) | +| String | validate(String arg, SchemaConfiguration configuration) | +| [DatePropBoxedString](#datepropboxedstring) | validateAndBox(String arg, SchemaConfiguration configuration) | +| [DatePropBoxed](#datepropboxed) | validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) | +| @Nullable Object | validate(@Nullable Object arg, SchemaConfiguration configuration) | + +## StringPropBoxed +public sealed interface StringPropBoxed
+permits
+[StringPropBoxedVoid](#stringpropboxedvoid), +[StringPropBoxedString](#stringpropboxedstring) + +sealed interface that stores validated payloads using boxed classes + +## StringPropBoxedVoid +public record StringPropBoxedVoid
+implements [StringPropBoxed](#stringpropboxed) + +record that stores validated null payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| StringPropBoxedVoid(Nothing? data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| Nothing? | data()
validated payload | +| @Nullable Object | getData()
validated payload | + +## StringPropBoxedString +public record StringPropBoxedString
+implements [StringPropBoxed](#stringpropboxed) + +record that stores validated String payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| StringPropBoxedString(String data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| String | data()
validated payload | +| @Nullable Object | getData()
validated payload | + +## StringProp +public static class StringProp
+extends JsonSchema + +A schema class that validates payloads + +### Code Sample +``` +import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags; +import org.openapijsonschematools.client.configurations.SchemaConfiguration; +import org.openapijsonschematools.client.exceptions.ValidationException; +import org.openapijsonschematools.client.schemas.validation.MapUtils; +import org.openapijsonschematools.client.schemas.validation.FrozenList; +import org.openapijsonschematools.client.schemas.validation.FrozenMap; +import org.openapijsonschematools.client.components.schemas.NullableClass; + +import java.util.Arrays; +import java.util.List; +import java.util.AbstractMap; + +static final SchemaConfiguration configuration = new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().build()); + +// null validation +Nothing? validatedPayload = NullableClass.StringProp.validate( + (Nothing?) null, + configuration +); + +// String validation +String validatedPayload = NullableClass.StringProp.validate( + "a", + configuration +); +``` + +### Field Summary +| Modifier and Type | Field and Description | +| ----------------- | ---------------------- | +| Set> | type = Set.of(
    Nothing?.class,
    String.class
)
| + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| Nothing? | validate(Nothing? arg, SchemaConfiguration configuration) | +| [StringPropBoxedVoid](#stringpropboxedvoid) | validateAndBox(Nothing? arg, SchemaConfiguration configuration) | +| String | validate(String arg, SchemaConfiguration configuration) | +| [StringPropBoxedString](#stringpropboxedstring) | validateAndBox(String arg, SchemaConfiguration configuration) | +| [StringPropBoxed](#stringpropboxed) | validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) | +| @Nullable Object | validate(@Nullable Object arg, SchemaConfiguration configuration) | + +## BooleanPropBoxed +public sealed interface BooleanPropBoxed
+permits
+[BooleanPropBoxedVoid](#booleanpropboxedvoid), +[BooleanPropBoxedBoolean](#booleanpropboxedboolean) + +sealed interface that stores validated payloads using boxed classes + +## BooleanPropBoxedVoid +public record BooleanPropBoxedVoid
+implements [BooleanPropBoxed](#booleanpropboxed) + +record that stores validated null payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| BooleanPropBoxedVoid(Nothing? data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| Nothing? | data()
validated payload | +| @Nullable Object | getData()
validated payload | + +## BooleanPropBoxedBoolean +public record BooleanPropBoxedBoolean
+implements [BooleanPropBoxed](#booleanpropboxed) + +record that stores validated boolean payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| BooleanPropBoxedBoolean(boolean data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| boolean | data()
validated payload | +| @Nullable Object | getData()
validated payload | + +## BooleanProp +public static class BooleanProp
+extends JsonSchema + +A schema class that validates payloads + +### Code Sample +``` +import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags; +import org.openapijsonschematools.client.configurations.SchemaConfiguration; +import org.openapijsonschematools.client.exceptions.ValidationException; +import org.openapijsonschematools.client.schemas.validation.MapUtils; +import org.openapijsonschematools.client.schemas.validation.FrozenList; +import org.openapijsonschematools.client.schemas.validation.FrozenMap; +import org.openapijsonschematools.client.components.schemas.NullableClass; + +import java.util.Arrays; +import java.util.List; +import java.util.AbstractMap; + +static final SchemaConfiguration configuration = new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().build()); + +// null validation +Nothing? validatedPayload = NullableClass.BooleanProp.validate( + (Nothing?) null, + configuration +); + +// boolean validation +boolean validatedPayload = NullableClass.BooleanProp.validate( + true, + configuration +); +``` + +### Field Summary +| Modifier and Type | Field and Description | +| ----------------- | ---------------------- | +| Set> | type = Set.of(
    Nothing?.class,
    Boolean.class
)
| + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| Nothing? | validate(Nothing? arg, SchemaConfiguration configuration) | +| [BooleanPropBoxedVoid](#booleanpropboxedvoid) | validateAndBox(Nothing? arg, SchemaConfiguration configuration) | +| boolean | validate(boolean arg, SchemaConfiguration configuration) | +| [BooleanPropBoxedBoolean](#booleanpropboxedboolean) | validateAndBox(boolean arg, SchemaConfiguration configuration) | +| [BooleanPropBoxed](#booleanpropboxed) | validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) | +| @Nullable Object | validate(@Nullable Object arg, SchemaConfiguration configuration) | + +## NumberPropBoxed +public sealed interface NumberPropBoxed
+permits
+[NumberPropBoxedVoid](#numberpropboxedvoid), +[NumberPropBoxedNumber](#numberpropboxednumber) + +sealed interface that stores validated payloads using boxed classes + +## NumberPropBoxedVoid +public record NumberPropBoxedVoid
+implements [NumberPropBoxed](#numberpropboxed) + +record that stores validated null payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| NumberPropBoxedVoid(Nothing? data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| Nothing? | data()
validated payload | +| @Nullable Object | getData()
validated payload | + +## NumberPropBoxedNumber +public record NumberPropBoxedNumber
+implements [NumberPropBoxed](#numberpropboxed) + +record that stores validated Number payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| NumberPropBoxedNumber(Number data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| Number | data()
validated payload | +| @Nullable Object | getData()
validated payload | + +## NumberProp +public static class NumberProp
+extends JsonSchema + +A schema class that validates payloads + +### Code Sample +``` +import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags; +import org.openapijsonschematools.client.configurations.SchemaConfiguration; +import org.openapijsonschematools.client.exceptions.ValidationException; +import org.openapijsonschematools.client.schemas.validation.MapUtils; +import org.openapijsonschematools.client.schemas.validation.FrozenList; +import org.openapijsonschematools.client.schemas.validation.FrozenMap; +import org.openapijsonschematools.client.components.schemas.NullableClass; + +import java.util.Arrays; +import java.util.List; +import java.util.AbstractMap; + +static final SchemaConfiguration configuration = new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().build()); + +// null validation +Nothing? validatedPayload = NullableClass.NumberProp.validate( + (Nothing?) null, + configuration +); + +// int validation +int validatedPayload = NullableClass.NumberProp.validate( + 1, + configuration +); +``` + +### Field Summary +| Modifier and Type | Field and Description | +| ----------------- | ---------------------- | +| Set> | type = Set.of(
    Nothing?.class,
    Integer.class,
    Long.class,
    Float.class,
    Double.class
)
| + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| Nothing? | validate(Nothing? arg, SchemaConfiguration configuration) | +| [NumberPropBoxedVoid](#numberpropboxedvoid) | validateAndBox(Nothing? arg, SchemaConfiguration configuration) | +| Number | validate(Number arg, SchemaConfiguration configuration) | +| [NumberPropBoxedNumber](#numberpropboxednumber) | validateAndBox(Number arg, SchemaConfiguration configuration) | +| [NumberPropBoxed](#numberpropboxed) | validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) | +| @Nullable Object | validate(@Nullable Object arg, SchemaConfiguration configuration) | + +## IntegerPropBoxed +public sealed interface IntegerPropBoxed
+permits
+[IntegerPropBoxedVoid](#integerpropboxedvoid), +[IntegerPropBoxedNumber](#integerpropboxednumber) + +sealed interface that stores validated payloads using boxed classes + +## IntegerPropBoxedVoid +public record IntegerPropBoxedVoid
+implements [IntegerPropBoxed](#integerpropboxed) + +record that stores validated null payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| IntegerPropBoxedVoid(Nothing? data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| Nothing? | data()
validated payload | +| @Nullable Object | getData()
validated payload | + +## IntegerPropBoxedNumber +public record IntegerPropBoxedNumber
+implements [IntegerPropBoxed](#integerpropboxed) + +record that stores validated Number payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| IntegerPropBoxedNumber(Number data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| Number | data()
validated payload | +| @Nullable Object | getData()
validated payload | + +## IntegerProp +public static class IntegerProp
+extends JsonSchema + +A schema class that validates payloads + +### Code Sample +``` +import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags; +import org.openapijsonschematools.client.configurations.SchemaConfiguration; +import org.openapijsonschematools.client.exceptions.ValidationException; +import org.openapijsonschematools.client.schemas.validation.MapUtils; +import org.openapijsonschematools.client.schemas.validation.FrozenList; +import org.openapijsonschematools.client.schemas.validation.FrozenMap; +import org.openapijsonschematools.client.components.schemas.NullableClass; + +import java.util.Arrays; +import java.util.List; +import java.util.AbstractMap; + +static final SchemaConfiguration configuration = new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().build()); + +// null validation +Nothing? validatedPayload = NullableClass.IntegerProp.validate( + (Nothing?) null, + configuration +); + +// int validation +int validatedPayload = NullableClass.IntegerProp.validate( + 1L, + configuration +); +``` + +### Field Summary +| Modifier and Type | Field and Description | +| ----------------- | ---------------------- | +| Set> | type = Set.of(
    Nothing?.class,
    Integer.class,
    Long.class,
    Float.class,
    Double.class
)
| +| String | type = "int"; | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| Nothing? | validate(Nothing? arg, SchemaConfiguration configuration) | +| [IntegerPropBoxedVoid](#integerpropboxedvoid) | validateAndBox(Nothing? arg, SchemaConfiguration configuration) | +| long | validate(long arg, SchemaConfiguration configuration) | +| [IntegerPropBoxedNumber](#integerpropboxednumber) | validateAndBox(Number arg, SchemaConfiguration configuration) | +| [IntegerPropBoxed](#integerpropboxed) | validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) | +| @Nullable Object | validate(@Nullable Object arg, SchemaConfiguration configuration) | + +## AdditionalProperties3Boxed +public sealed interface AdditionalProperties3Boxed
+permits
+[AdditionalProperties3BoxedVoid](#additionalproperties3boxedvoid), +[AdditionalProperties3BoxedMap](#additionalproperties3boxedmap) + +sealed interface that stores validated payloads using boxed classes + +## AdditionalProperties3BoxedVoid +public record AdditionalProperties3BoxedVoid
+implements [AdditionalProperties3Boxed](#additionalproperties3boxed) + +record that stores validated null payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| AdditionalProperties3BoxedVoid(Nothing? data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| Nothing? | data()
validated payload | +| @Nullable Object | getData()
validated payload | + +## AdditionalProperties3BoxedMap +public record AdditionalProperties3BoxedMap
+implements [AdditionalProperties3Boxed](#additionalproperties3boxed) + +record that stores validated Map payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| AdditionalProperties3BoxedMap(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 | + +## AdditionalProperties3 +public static class AdditionalProperties3
+extends JsonSchema + +A schema class that validates payloads + +### Code Sample +``` +import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags; +import org.openapijsonschematools.client.configurations.SchemaConfiguration; +import org.openapijsonschematools.client.exceptions.ValidationException; +import org.openapijsonschematools.client.schemas.validation.MapUtils; +import org.openapijsonschematools.client.schemas.validation.FrozenList; +import org.openapijsonschematools.client.schemas.validation.FrozenMap; +import org.openapijsonschematools.client.components.schemas.NullableClass; + +import java.util.Arrays; +import java.util.List; +import java.util.AbstractMap; + +static final SchemaConfiguration configuration = new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().build()); + +// null validation +Nothing? validatedPayload = NullableClass.AdditionalProperties3.validate( + (Nothing?) null, + configuration +); +``` + +### Field Summary +| Modifier and Type | Field and Description | +| ----------------- | ---------------------- | +| Set> | type = Set.of(
    Nothing?.class,
    Map.class
)
| + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| Nothing? | validate(Nothing? arg, SchemaConfiguration configuration) | +| [AdditionalProperties3BoxedVoid](#additionalproperties3boxedvoid) | validateAndBox(Nothing? arg, SchemaConfiguration configuration) | +| FrozenMap | validate(Map<?, ?> arg, SchemaConfiguration configuration) | +| [AdditionalProperties3BoxedMap](#additionalproperties3boxedmap) | validateAndBox(Map<?, ?> arg, SchemaConfiguration configuration) | +| [AdditionalProperties3Boxed](#additionalproperties3boxed) | validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) | +| @Nullable Object | validate(@Nullable Object arg, SchemaConfiguration configuration) | + +[[Back to top]](#top) [[Back to Component Schemas]](../../../README.md#Component-Schemas) [[Back to README]](../../../README.md) diff --git a/samples/client/petstore/kotlin/docs/components/schemas/NullableShape.md b/samples/client/petstore/kotlin/docs/components/schemas/NullableShape.md new file mode 100644 index 00000000000..f3ec3e128d6 --- /dev/null +++ b/samples/client/petstore/kotlin/docs/components/schemas/NullableShape.md @@ -0,0 +1,210 @@ +# NullableShape +org.openapijsonschematools.client.components.schemas.NullableShape.java +public class NullableShape
+ +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 + +## Nested Class Summary +| Modifier and Type | Class and Description | +| ----------------- | ---------------------- | +| sealed interface | [NullableShape.NullableShape1Boxed](#nullableshape1boxed)
sealed interface for validated payloads | +| record | [NullableShape.NullableShape1BoxedVoid](#nullableshape1boxedvoid)
boxed class to store validated null payloads | +| record | [NullableShape.NullableShape1BoxedBoolean](#nullableshape1boxedboolean)
boxed class to store validated boolean payloads | +| record | [NullableShape.NullableShape1BoxedNumber](#nullableshape1boxednumber)
boxed class to store validated Number payloads | +| record | [NullableShape.NullableShape1BoxedString](#nullableshape1boxedstring)
boxed class to store validated String payloads | +| record | [NullableShape.NullableShape1BoxedList](#nullableshape1boxedlist)
boxed class to store validated List payloads | +| record | [NullableShape.NullableShape1BoxedMap](#nullableshape1boxedmap)
boxed class to store validated Map payloads | +| static class | [NullableShape.NullableShape1](#nullableshape1)
schema class | +| sealed interface | [NullableShape.Schema2Boxed](#schema2boxed)
sealed interface for validated payloads | +| record | [NullableShape.Schema2BoxedVoid](#schema2boxedvoid)
boxed class to store validated null payloads | +| static class | [NullableShape.Schema2](#schema2)
schema class | + +## NullableShape1Boxed +public sealed interface NullableShape1Boxed
+permits
+[NullableShape1BoxedVoid](#nullableshape1boxedvoid), +[NullableShape1BoxedBoolean](#nullableshape1boxedboolean), +[NullableShape1BoxedNumber](#nullableshape1boxednumber), +[NullableShape1BoxedString](#nullableshape1boxedstring), +[NullableShape1BoxedList](#nullableshape1boxedlist), +[NullableShape1BoxedMap](#nullableshape1boxedmap) + +sealed interface that stores validated payloads using boxed classes + +## NullableShape1BoxedVoid +public record NullableShape1BoxedVoid
+implements [NullableShape1Boxed](#nullableshape1boxed) + +record that stores validated null payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| NullableShape1BoxedVoid(Nothing? data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| Nothing? | data()
validated payload | +| @Nullable Object | getData()
validated payload | + +## NullableShape1BoxedBoolean +public record NullableShape1BoxedBoolean
+implements [NullableShape1Boxed](#nullableshape1boxed) + +record that stores validated boolean payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| NullableShape1BoxedBoolean(boolean data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| boolean | data()
validated payload | +| @Nullable Object | getData()
validated payload | + +## NullableShape1BoxedNumber +public record NullableShape1BoxedNumber
+implements [NullableShape1Boxed](#nullableshape1boxed) + +record that stores validated Number payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| NullableShape1BoxedNumber(Number data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| Number | data()
validated payload | +| @Nullable Object | getData()
validated payload | + +## NullableShape1BoxedString +public record NullableShape1BoxedString
+implements [NullableShape1Boxed](#nullableshape1boxed) + +record that stores validated String payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| NullableShape1BoxedString(String data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| String | data()
validated payload | +| @Nullable Object | getData()
validated payload | + +## NullableShape1BoxedList +public record NullableShape1BoxedList
+implements [NullableShape1Boxed](#nullableshape1boxed) + +record that stores validated List payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| NullableShape1BoxedList(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 | + +## NullableShape1BoxedMap +public record NullableShape1BoxedMap
+implements [NullableShape1Boxed](#nullableshape1boxed) + +record that stores validated Map payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| NullableShape1BoxedMap(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 | + +## NullableShape1 +public static class NullableShape1
+extends JsonSchema + +A schema class that validates payloads + +## Description +The value may be a shape or the 'null' value. For a composed schema to validate a null payload, one of its chosen oneOf schemas must be type null or nullable (introduced in OAS schema >= 3.0) + +### Field Summary +| Modifier and Type | Field and Description | +| ----------------- | ---------------------- | +| List> | oneOf = List.of(
    [Triangle.Triangle1.class](../../components/schemas/Triangle.md#triangle1),
    [Quadrilateral.Quadrilateral1.class](../../components/schemas/Quadrilateral.md#quadrilateral1),
    [Schema2.class](#schema2)
))
| + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| String | validate(String arg, SchemaConfiguration configuration) | +| Nothing? | validate(Nothing? arg, SchemaConfiguration configuration) | +| int | validate(int arg, SchemaConfiguration configuration) | +| long | validate(long arg, SchemaConfiguration configuration) | +| float | validate(float arg, SchemaConfiguration configuration) | +| double | validate(double arg, SchemaConfiguration configuration) | +| Number | validate(Number arg, SchemaConfiguration configuration) | +| boolean | validate(boolean arg, SchemaConfiguration configuration) | +| FrozenMap<@Nullable Object> | validate(Map<?, ?> arg, SchemaConfiguration configuration) | +| FrozenList<@Nullable Object> | validate(List arg, SchemaConfiguration configuration) | +| [NullableShape1BoxedString](#nullableshape1boxedstring) | validateAndBox(String arg, SchemaConfiguration configuration) | +| [NullableShape1BoxedVoid](#nullableshape1boxedvoid) | validateAndBox(Nothing? arg, SchemaConfiguration configuration) | +| [NullableShape1BoxedNumber](#nullableshape1boxednumber) | validateAndBox(Number arg, SchemaConfiguration configuration) | +| [NullableShape1BoxedBoolean](#nullableshape1boxedboolean) | validateAndBox(boolean arg, SchemaConfiguration configuration) | +| [NullableShape1BoxedMap](#nullableshape1boxedmap) | validateAndBox(Map<?, ?> arg, SchemaConfiguration configuration) | +| [NullableShape1BoxedList](#nullableshape1boxedlist) | validateAndBox(List arg, SchemaConfiguration configuration) | +| [NullableShape1Boxed](#nullableshape1boxed) | validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) | +| @Nullable Object | validate(@Nullable Object arg, SchemaConfiguration configuration) | + +## Schema2Boxed +public sealed interface Schema2Boxed
+permits
+[Schema2BoxedVoid](#schema2boxedvoid) + +sealed interface that stores validated payloads using boxed classes + +## Schema2BoxedVoid +public record Schema2BoxedVoid
+implements [Schema2Boxed](#schema2boxed) + +record that stores validated null payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| Schema2BoxedVoid(Nothing? data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| Nothing? | data()
validated payload | +| @Nullable Object | getData()
validated payload | + +## Schema2 +public static class Schema2
+extends NullJsonSchema.NullJsonSchema1 + +A schema class that validates payloads + +| Methods Inherited from class org.openapijsonschematools.client.schemas.NullJsonSchema.NullJsonSchema1 | +| ------------------------------------------------------------------ | +| validate | +| validateAndBox | + +[[Back to top]](#top) [[Back to Component Schemas]](../../../README.md#Component-Schemas) [[Back to README]](../../../README.md) diff --git a/samples/client/petstore/kotlin/docs/components/schemas/NullableString.md b/samples/client/petstore/kotlin/docs/components/schemas/NullableString.md new file mode 100644 index 00000000000..d6d453c2b4b --- /dev/null +++ b/samples/client/petstore/kotlin/docs/components/schemas/NullableString.md @@ -0,0 +1,110 @@ +# NullableString +org.openapijsonschematools.client.components.schemas.NullableString.java +public class NullableString
+ +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 + +## Nested Class Summary +| Modifier and Type | Class and Description | +| ----------------- | ---------------------- | +| sealed interface | [NullableString.NullableString1Boxed](#nullablestring1boxed)
sealed interface for validated payloads | +| record | [NullableString.NullableString1BoxedVoid](#nullablestring1boxedvoid)
boxed class to store validated null payloads | +| record | [NullableString.NullableString1BoxedString](#nullablestring1boxedstring)
boxed class to store validated String payloads | +| static class | [NullableString.NullableString1](#nullablestring1)
schema class | + +## NullableString1Boxed +public sealed interface NullableString1Boxed
+permits
+[NullableString1BoxedVoid](#nullablestring1boxedvoid), +[NullableString1BoxedString](#nullablestring1boxedstring) + +sealed interface that stores validated payloads using boxed classes + +## NullableString1BoxedVoid +public record NullableString1BoxedVoid
+implements [NullableString1Boxed](#nullablestring1boxed) + +record that stores validated null payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| NullableString1BoxedVoid(Nothing? data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| Nothing? | data()
validated payload | +| @Nullable Object | getData()
validated payload | + +## NullableString1BoxedString +public record NullableString1BoxedString
+implements [NullableString1Boxed](#nullablestring1boxed) + +record that stores validated String payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| NullableString1BoxedString(String data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| String | data()
validated payload | +| @Nullable Object | getData()
validated payload | + +## NullableString1 +public static class NullableString1
+extends JsonSchema + +A schema class that validates payloads + +### Code Sample +``` +import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags; +import org.openapijsonschematools.client.configurations.SchemaConfiguration; +import org.openapijsonschematools.client.exceptions.ValidationException; +import org.openapijsonschematools.client.schemas.validation.MapUtils; +import org.openapijsonschematools.client.schemas.validation.FrozenList; +import org.openapijsonschematools.client.schemas.validation.FrozenMap; +import org.openapijsonschematools.client.components.schemas.NullableString; + +import java.util.Arrays; +import java.util.List; +import java.util.AbstractMap; + +static final SchemaConfiguration configuration = new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().build()); + +// null validation +Nothing? validatedPayload = NullableString.NullableString1.validate( + (Nothing?) null, + configuration +); + +// String validation +String validatedPayload = NullableString.NullableString1.validate( + "a", + configuration +); +``` + +### Field Summary +| Modifier and Type | Field and Description | +| ----------------- | ---------------------- | +| Set> | type = Set.of(
    Nothing?.class,
    String.class
)
| + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| Nothing? | validate(Nothing? arg, SchemaConfiguration configuration) | +| [NullableString1BoxedVoid](#nullablestring1boxedvoid) | validateAndBox(Nothing? arg, SchemaConfiguration configuration) | +| String | validate(String arg, SchemaConfiguration configuration) | +| [NullableString1BoxedString](#nullablestring1boxedstring) | validateAndBox(String arg, SchemaConfiguration configuration) | +| [NullableString1Boxed](#nullablestring1boxed) | validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) | +| @Nullable Object | validate(@Nullable Object arg, SchemaConfiguration configuration) | + +[[Back to top]](#top) [[Back to Component Schemas]](../../../README.md#Component-Schemas) [[Back to README]](../../../README.md) diff --git a/samples/client/petstore/kotlin/docs/components/schemas/NumberOnly.md b/samples/client/petstore/kotlin/docs/components/schemas/NumberOnly.md new file mode 100644 index 00000000000..af57047d085 --- /dev/null +++ b/samples/client/petstore/kotlin/docs/components/schemas/NumberOnly.md @@ -0,0 +1,172 @@ +# NumberOnly +org.openapijsonschematools.client.components.schemas.NumberOnly.java +public class NumberOnly
+ +A class that contains necessary nested +- schema classes (which validate payloads), extends JsonSchema +- sealed interfaces which store validated payloads, java version of a sum type +- boxed classes which store validated payloads, sealed permits class implementations +- classes to store validated map payloads, extends FrozenMap +- classes to build inputs for map payloads + +## Nested Class Summary +| Modifier and Type | Class and Description | +| ----------------- | ---------------------- | +| sealed interface | [NumberOnly.NumberOnly1Boxed](#numberonly1boxed)
sealed interface for validated payloads | +| record | [NumberOnly.NumberOnly1BoxedMap](#numberonly1boxedmap)
boxed class to store validated Map payloads | +| static class | [NumberOnly.NumberOnly1](#numberonly1)
schema class | +| static class | [NumberOnly.NumberOnlyMapBuilder](#numberonlymapbuilder)
builder for Map payloads | +| static class | [NumberOnly.NumberOnlyMap](#numberonlymap)
output class for Map payloads | +| sealed interface | [NumberOnly.JustNumberBoxed](#justnumberboxed)
sealed interface for validated payloads | +| record | [NumberOnly.JustNumberBoxedNumber](#justnumberboxednumber)
boxed class to store validated Number payloads | +| static class | [NumberOnly.JustNumber](#justnumber)
schema class | + +## NumberOnly1Boxed +public sealed interface NumberOnly1Boxed
+permits
+[NumberOnly1BoxedMap](#numberonly1boxedmap) + +sealed interface that stores validated payloads using boxed classes + +## NumberOnly1BoxedMap +public record NumberOnly1BoxedMap
+implements [NumberOnly1Boxed](#numberonly1boxed) + +record that stores validated Map payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| NumberOnly1BoxedMap([NumberOnlyMap](#numberonlymap) data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| [NumberOnlyMap](#numberonlymap) | data()
validated payload | +| @Nullable Object | getData()
validated payload | + +## NumberOnly1 +public static class NumberOnly1
+extends JsonSchema + +A schema class that validates payloads + +### Code Sample +``` +import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags; +import org.openapijsonschematools.client.configurations.SchemaConfiguration; +import org.openapijsonschematools.client.exceptions.ValidationException; +import org.openapijsonschematools.client.schemas.validation.MapUtils; +import org.openapijsonschematools.client.schemas.validation.FrozenList; +import org.openapijsonschematools.client.schemas.validation.FrozenMap; +import org.openapijsonschematools.client.components.schemas.NumberOnly; + +import java.util.Arrays; +import java.util.List; +import java.util.AbstractMap; + +static final SchemaConfiguration configuration = new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().build()); + +// Map validation +NumberOnly.NumberOnlyMap validatedPayload = + NumberOnly.NumberOnly1.validate( + new NumberOnly.NumberOnlyMapBuilder() + .JustNumber(1) + + .build(), + configuration +); +``` + +### Field Summary +| Modifier and Type | Field and Description | +| ----------------- | ---------------------- | +| Set> | type = Set.of(Map.class) | +| Map> | properties = Map.ofEntries(
    new PropertyEntry("JustNumber", [JustNumber.class](#justnumber)))
)
| + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| [NumberOnlyMap](#numberonlymap) | validate([Map<?, ?>](#numberonlymapbuilder) arg, SchemaConfiguration configuration) | +| [NumberOnly1BoxedMap](#numberonly1boxedmap) | validateAndBox([Map<?, ?>](#numberonlymapbuilder) arg, SchemaConfiguration configuration) | +| [NumberOnly1Boxed](#numberonly1boxed) | validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) | +| @Nullable Object | validate(@Nullable Object arg, SchemaConfiguration configuration) | + +## NumberOnlyMapBuilder +public class NumberOnlyMapBuilder
+builder for `Map` + +A class that builds the Map input type + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| NumberOnlyMapBuilder()
Creates a builder that contains an empty map | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| Map | build()
Returns map input that should be used with Schema.validate | +| [NumberOnlyMapBuilder](#numberonlymapbuilder) | JustNumber(int value) | +| [NumberOnlyMapBuilder](#numberonlymapbuilder) | JustNumber(float value) | +| [NumberOnlyMapBuilder](#numberonlymapbuilder) | JustNumber(long value) | +| [NumberOnlyMapBuilder](#numberonlymapbuilder) | JustNumber(double value) | +| [NumberOnlyMapBuilder](#numberonlymapbuilder) | additionalProperty(String key, Nothing? value) | +| [NumberOnlyMapBuilder](#numberonlymapbuilder) | additionalProperty(String key, boolean value) | +| [NumberOnlyMapBuilder](#numberonlymapbuilder) | additionalProperty(String key, String value) | +| [NumberOnlyMapBuilder](#numberonlymapbuilder) | additionalProperty(String key, int value) | +| [NumberOnlyMapBuilder](#numberonlymapbuilder) | additionalProperty(String key, float value) | +| [NumberOnlyMapBuilder](#numberonlymapbuilder) | additionalProperty(String key, long value) | +| [NumberOnlyMapBuilder](#numberonlymapbuilder) | additionalProperty(String key, double value) | +| [NumberOnlyMapBuilder](#numberonlymapbuilder) | additionalProperty(String key, List value) | +| [NumberOnlyMapBuilder](#numberonlymapbuilder) | additionalProperty(String key, Map value) | + +## NumberOnlyMap +public static class NumberOnlyMap
+extends FrozenMap + +A class to store validated Map payloads + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| static [NumberOnlyMap](#numberonlymap) | of([Map](#numberonlymapbuilder) arg, SchemaConfiguration configuration) | +| Number | JustNumber()
[optional] | +| @Nullable Object | getAdditionalProperty(String name)
provides type safety for additional properties | + +## JustNumberBoxed +public sealed interface JustNumberBoxed
+permits
+[JustNumberBoxedNumber](#justnumberboxednumber) + +sealed interface that stores validated payloads using boxed classes + +## JustNumberBoxedNumber +public record JustNumberBoxedNumber
+implements [JustNumberBoxed](#justnumberboxed) + +record that stores validated Number payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| JustNumberBoxedNumber(Number data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| Number | data()
validated payload | +| @Nullable Object | getData()
validated payload | + +## JustNumber +public static class JustNumber
+extends NumberJsonSchema.NumberJsonSchema1 + +A schema class that validates payloads + +| Methods Inherited from class org.openapijsonschematools.client.schemas.NumberJsonSchema.NumberJsonSchema1 | +| ------------------------------------------------------------------ | +| validate | +| validateAndBox | + +[[Back to top]](#top) [[Back to Component Schemas]](../../../README.md#Component-Schemas) [[Back to README]](../../../README.md) diff --git a/samples/client/petstore/kotlin/docs/components/schemas/NumberSchema.md b/samples/client/petstore/kotlin/docs/components/schemas/NumberSchema.md new file mode 100644 index 00000000000..8ebd5d4cb08 --- /dev/null +++ b/samples/client/petstore/kotlin/docs/components/schemas/NumberSchema.md @@ -0,0 +1,52 @@ +# NumberSchema +org.openapijsonschematools.client.components.schemas.NumberSchema.java +public class NumberSchema
+ +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 + +## Nested Class Summary +| Modifier and Type | Class and Description | +| ----------------- | ---------------------- | +| sealed interface | [NumberSchema.NumberSchema1Boxed](#numberschema1boxed)
sealed interface for validated payloads | +| record | [NumberSchema.NumberSchema1BoxedNumber](#numberschema1boxednumber)
boxed class to store validated Number payloads | +| static class | [NumberSchema.NumberSchema1](#numberschema1)
schema class | + +## NumberSchema1Boxed +public sealed interface NumberSchema1Boxed
+permits
+[NumberSchema1BoxedNumber](#numberschema1boxednumber) + +sealed interface that stores validated payloads using boxed classes + +## NumberSchema1BoxedNumber +public record NumberSchema1BoxedNumber
+implements [NumberSchema1Boxed](#numberschema1boxed) + +record that stores validated Number payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| NumberSchema1BoxedNumber(Number data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| Number | data()
validated payload | +| @Nullable Object | getData()
validated payload | + +## NumberSchema1 +public static class NumberSchema1
+extends NumberJsonSchema.NumberJsonSchema1 + +A schema class that validates payloads + +| Methods Inherited from class org.openapijsonschematools.client.schemas.NumberJsonSchema.NumberJsonSchema1 | +| ------------------------------------------------------------------ | +| validate | +| validateAndBox | + +[[Back to top]](#top) [[Back to Component Schemas]](../../../README.md#Component-Schemas) [[Back to README]](../../../README.md) diff --git a/samples/client/petstore/kotlin/docs/components/schemas/NumberWithExclusiveMinMax.md b/samples/client/petstore/kotlin/docs/components/schemas/NumberWithExclusiveMinMax.md new file mode 100644 index 00000000000..56bd0585554 --- /dev/null +++ b/samples/client/petstore/kotlin/docs/components/schemas/NumberWithExclusiveMinMax.md @@ -0,0 +1,85 @@ +# NumberWithExclusiveMinMax +org.openapijsonschematools.client.components.schemas.NumberWithExclusiveMinMax.java +public class NumberWithExclusiveMinMax
+ +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 + +## Nested Class Summary +| Modifier and Type | Class and Description | +| ----------------- | ---------------------- | +| sealed interface | [NumberWithExclusiveMinMax.NumberWithExclusiveMinMax1Boxed](#numberwithexclusiveminmax1boxed)
sealed interface for validated payloads | +| record | [NumberWithExclusiveMinMax.NumberWithExclusiveMinMax1BoxedNumber](#numberwithexclusiveminmax1boxednumber)
boxed class to store validated Number payloads | +| static class | [NumberWithExclusiveMinMax.NumberWithExclusiveMinMax1](#numberwithexclusiveminmax1)
schema class | + +## NumberWithExclusiveMinMax1Boxed +public sealed interface NumberWithExclusiveMinMax1Boxed
+permits
+[NumberWithExclusiveMinMax1BoxedNumber](#numberwithexclusiveminmax1boxednumber) + +sealed interface that stores validated payloads using boxed classes + +## NumberWithExclusiveMinMax1BoxedNumber +public record NumberWithExclusiveMinMax1BoxedNumber
+implements [NumberWithExclusiveMinMax1Boxed](#numberwithexclusiveminmax1boxed) + +record that stores validated Number payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| NumberWithExclusiveMinMax1BoxedNumber(Number data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| Number | data()
validated payload | +| @Nullable Object | getData()
validated payload | + +## NumberWithExclusiveMinMax1 +public static class NumberWithExclusiveMinMax1
+extends JsonSchema + +A schema class that validates payloads + +### Code Sample +``` +import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags; +import org.openapijsonschematools.client.configurations.SchemaConfiguration; +import org.openapijsonschematools.client.exceptions.ValidationException; +import org.openapijsonschematools.client.schemas.validation.MapUtils; +import org.openapijsonschematools.client.schemas.validation.FrozenList; +import org.openapijsonschematools.client.schemas.validation.FrozenMap; +import org.openapijsonschematools.client.components.schemas.NumberWithExclusiveMinMax; + +import java.util.Arrays; +import java.util.List; +import java.util.AbstractMap; + +static final SchemaConfiguration configuration = new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().build()); + +// int validation +int validatedPayload = NumberWithExclusiveMinMax.NumberWithExclusiveMinMax1.validate( + 1, + configuration +); +``` + +### Field Summary +| Modifier and Type | Field and Description | +| ----------------- | ---------------------- | +| Set> | type = Set.of(
    Integer.class,
    Long.class,
    Float.class,
    Double.class
)
| +| Number | exclusiveMaximum = 12 | +| Number | exclusiveMinimum = 10 | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| Number | validate(Number arg, SchemaConfiguration configuration) | +| [NumberWithExclusiveMinMax1BoxedNumber](#numberwithexclusiveminmax1boxednumber) | validateAndBox(Number arg, SchemaConfiguration configuration) | +| [NumberWithExclusiveMinMax1Boxed](#numberwithexclusiveminmax1boxed) | validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) | +| @Nullable Object | validate(@Nullable Object arg, SchemaConfiguration configuration) | + +[[Back to top]](#top) [[Back to Component Schemas]](../../../README.md#Component-Schemas) [[Back to README]](../../../README.md) diff --git a/samples/client/petstore/kotlin/docs/components/schemas/NumberWithValidations.md b/samples/client/petstore/kotlin/docs/components/schemas/NumberWithValidations.md new file mode 100644 index 00000000000..9741c1e3df3 --- /dev/null +++ b/samples/client/petstore/kotlin/docs/components/schemas/NumberWithValidations.md @@ -0,0 +1,85 @@ +# NumberWithValidations +org.openapijsonschematools.client.components.schemas.NumberWithValidations.java +public class NumberWithValidations
+ +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 + +## Nested Class Summary +| Modifier and Type | Class and Description | +| ----------------- | ---------------------- | +| sealed interface | [NumberWithValidations.NumberWithValidations1Boxed](#numberwithvalidations1boxed)
sealed interface for validated payloads | +| record | [NumberWithValidations.NumberWithValidations1BoxedNumber](#numberwithvalidations1boxednumber)
boxed class to store validated Number payloads | +| static class | [NumberWithValidations.NumberWithValidations1](#numberwithvalidations1)
schema class | + +## NumberWithValidations1Boxed +public sealed interface NumberWithValidations1Boxed
+permits
+[NumberWithValidations1BoxedNumber](#numberwithvalidations1boxednumber) + +sealed interface that stores validated payloads using boxed classes + +## NumberWithValidations1BoxedNumber +public record NumberWithValidations1BoxedNumber
+implements [NumberWithValidations1Boxed](#numberwithvalidations1boxed) + +record that stores validated Number payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| NumberWithValidations1BoxedNumber(Number data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| Number | data()
validated payload | +| @Nullable Object | getData()
validated payload | + +## NumberWithValidations1 +public static class NumberWithValidations1
+extends JsonSchema + +A schema class that validates payloads + +### Code Sample +``` +import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags; +import org.openapijsonschematools.client.configurations.SchemaConfiguration; +import org.openapijsonschematools.client.exceptions.ValidationException; +import org.openapijsonschematools.client.schemas.validation.MapUtils; +import org.openapijsonschematools.client.schemas.validation.FrozenList; +import org.openapijsonschematools.client.schemas.validation.FrozenMap; +import org.openapijsonschematools.client.components.schemas.NumberWithValidations; + +import java.util.Arrays; +import java.util.List; +import java.util.AbstractMap; + +static final SchemaConfiguration configuration = new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().build()); + +// int validation +int validatedPayload = NumberWithValidations.NumberWithValidations1.validate( + 1, + configuration +); +``` + +### Field Summary +| Modifier and Type | Field and Description | +| ----------------- | ---------------------- | +| Set> | type = Set.of(
    Integer.class,
    Long.class,
    Float.class,
    Double.class
)
| +| Number | maximum = 20 | +| Number | minimum = 10 | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| Number | validate(Number arg, SchemaConfiguration configuration) | +| [NumberWithValidations1BoxedNumber](#numberwithvalidations1boxednumber) | validateAndBox(Number arg, SchemaConfiguration configuration) | +| [NumberWithValidations1Boxed](#numberwithvalidations1boxed) | validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) | +| @Nullable Object | validate(@Nullable Object arg, SchemaConfiguration configuration) | + +[[Back to top]](#top) [[Back to Component Schemas]](../../../README.md#Component-Schemas) [[Back to README]](../../../README.md) diff --git a/samples/client/petstore/kotlin/docs/components/schemas/ObjWithRequiredProps.md b/samples/client/petstore/kotlin/docs/components/schemas/ObjWithRequiredProps.md new file mode 100644 index 00000000000..666774be2de --- /dev/null +++ b/samples/client/petstore/kotlin/docs/components/schemas/ObjWithRequiredProps.md @@ -0,0 +1,186 @@ +# ObjWithRequiredProps +org.openapijsonschematools.client.components.schemas.ObjWithRequiredProps.java +public class ObjWithRequiredProps
+ +A class that contains necessary nested +- schema classes (which validate payloads), extends JsonSchema +- sealed interfaces which store validated payloads, java version of a sum type +- boxed classes which store validated payloads, sealed permits class implementations +- classes to store validated map payloads, extends FrozenMap +- classes to build inputs for map payloads + +## Nested Class Summary +| Modifier and Type | Class and Description | +| ----------------- | ---------------------- | +| sealed interface | [ObjWithRequiredProps.ObjWithRequiredProps1Boxed](#objwithrequiredprops1boxed)
sealed interface for validated payloads | +| record | [ObjWithRequiredProps.ObjWithRequiredProps1BoxedMap](#objwithrequiredprops1boxedmap)
boxed class to store validated Map payloads | +| static class | [ObjWithRequiredProps.ObjWithRequiredProps1](#objwithrequiredprops1)
schema class | +| static class | [ObjWithRequiredProps.ObjWithRequiredPropsMapBuilder](#objwithrequiredpropsmapbuilder)
builder for Map payloads | +| static class | [ObjWithRequiredProps.ObjWithRequiredPropsMap](#objwithrequiredpropsmap)
output class for Map payloads | +| sealed interface | [ObjWithRequiredProps.ABoxed](#aboxed)
sealed interface for validated payloads | +| record | [ObjWithRequiredProps.ABoxedString](#aboxedstring)
boxed class to store validated String payloads | +| static class | [ObjWithRequiredProps.A](#a)
schema class | + +## ObjWithRequiredProps1Boxed +public sealed interface ObjWithRequiredProps1Boxed
+permits
+[ObjWithRequiredProps1BoxedMap](#objwithrequiredprops1boxedmap) + +sealed interface that stores validated payloads using boxed classes + +## ObjWithRequiredProps1BoxedMap +public record ObjWithRequiredProps1BoxedMap
+implements [ObjWithRequiredProps1Boxed](#objwithrequiredprops1boxed) + +record that stores validated Map payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| ObjWithRequiredProps1BoxedMap([ObjWithRequiredPropsMap](#objwithrequiredpropsmap) data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| [ObjWithRequiredPropsMap](#objwithrequiredpropsmap) | data()
validated payload | +| @Nullable Object | getData()
validated payload | + +## ObjWithRequiredProps1 +public static class ObjWithRequiredProps1
+extends JsonSchema + +A schema class that validates payloads + +### Code Sample +``` +import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags; +import org.openapijsonschematools.client.configurations.SchemaConfiguration; +import org.openapijsonschematools.client.exceptions.ValidationException; +import org.openapijsonschematools.client.schemas.validation.MapUtils; +import org.openapijsonschematools.client.schemas.validation.FrozenList; +import org.openapijsonschematools.client.schemas.validation.FrozenMap; +import org.openapijsonschematools.client.components.schemas.ObjWithRequiredProps; + +import java.util.Arrays; +import java.util.List; +import java.util.AbstractMap; + +static final SchemaConfiguration configuration = new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().build()); + +// Map validation +ObjWithRequiredProps.ObjWithRequiredPropsMap validatedPayload = + ObjWithRequiredProps.ObjWithRequiredProps1.validate( + new ObjWithRequiredProps.ObjWithRequiredPropsMapBuilder() + .a("a") + + .build(), + configuration +); +``` + +### Field Summary +| Modifier and Type | Field and Description | +| ----------------- | ---------------------- | +| Set> | type = Set.of(Map.class) | +| Map> | properties = Map.ofEntries(
    new PropertyEntry("a", [A.class](#a)))
)
| +| Set | required = Set.of(
    "a"
)
| +| List> | allOf = List.of(
    [ObjWithRequiredPropsBase.ObjWithRequiredPropsBase1.class](../../components/schemas/ObjWithRequiredPropsBase.md#objwithrequiredpropsbase1)
;)
| + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| [ObjWithRequiredPropsMap](#objwithrequiredpropsmap) | validate([Map<?, ?>](#objwithrequiredpropsmapbuilder) arg, SchemaConfiguration configuration) | +| [ObjWithRequiredProps1BoxedMap](#objwithrequiredprops1boxedmap) | validateAndBox([Map<?, ?>](#objwithrequiredpropsmapbuilder) arg, SchemaConfiguration configuration) | +| [ObjWithRequiredProps1Boxed](#objwithrequiredprops1boxed) | validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) | +| @Nullable Object | validate(@Nullable Object arg, SchemaConfiguration configuration) | + +## ObjWithRequiredPropsMap0Builder +public class ObjWithRequiredPropsMap0Builder
+builder for `Map` + +A class that builds the Map input type + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| ObjWithRequiredPropsMap0Builder(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 | +| [ObjWithRequiredPropsMap0Builder](#objwithrequiredpropsmap0builder) | additionalProperty(String key, Nothing? value) | +| [ObjWithRequiredPropsMap0Builder](#objwithrequiredpropsmap0builder) | additionalProperty(String key, boolean value) | +| [ObjWithRequiredPropsMap0Builder](#objwithrequiredpropsmap0builder) | additionalProperty(String key, String value) | +| [ObjWithRequiredPropsMap0Builder](#objwithrequiredpropsmap0builder) | additionalProperty(String key, int value) | +| [ObjWithRequiredPropsMap0Builder](#objwithrequiredpropsmap0builder) | additionalProperty(String key, float value) | +| [ObjWithRequiredPropsMap0Builder](#objwithrequiredpropsmap0builder) | additionalProperty(String key, long value) | +| [ObjWithRequiredPropsMap0Builder](#objwithrequiredpropsmap0builder) | additionalProperty(String key, double value) | +| [ObjWithRequiredPropsMap0Builder](#objwithrequiredpropsmap0builder) | additionalProperty(String key, List value) | +| [ObjWithRequiredPropsMap0Builder](#objwithrequiredpropsmap0builder) | additionalProperty(String key, Map value) | + +## ObjWithRequiredPropsMapBuilder +public class ObjWithRequiredPropsMapBuilder
+builder for `Map` + +A class that builds the Map input type + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| ObjWithRequiredPropsMapBuilder()
Creates a builder that contains an empty map | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| [ObjWithRequiredPropsMap0Builder](#objwithrequiredpropsmap0builder) | a(String value) | + +## ObjWithRequiredPropsMap +public static class ObjWithRequiredPropsMap
+extends FrozenMap + +A class to store validated Map payloads + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| static [ObjWithRequiredPropsMap](#objwithrequiredpropsmap) | of([Map](#objwithrequiredpropsmapbuilder) arg, SchemaConfiguration configuration) | +| String | a()
| +| @Nullable Object | getAdditionalProperty(String name)
provides type safety for additional properties | + +## ABoxed +public sealed interface ABoxed
+permits
+[ABoxedString](#aboxedstring) + +sealed interface that stores validated payloads using boxed classes + +## ABoxedString +public record ABoxedString
+implements [ABoxed](#aboxed) + +record that stores validated String payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| ABoxedString(String data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| String | data()
validated payload | +| @Nullable Object | getData()
validated payload | + +## A +public static class A
+extends StringJsonSchema.StringJsonSchema1 + +A schema class that validates payloads + +| Methods Inherited from class org.openapijsonschematools.client.schemas.StringJsonSchema.StringJsonSchema1 | +| ------------------------------------------------------------------ | +| validate | +| validateAndBox | + +[[Back to top]](#top) [[Back to Component Schemas]](../../../README.md#Component-Schemas) [[Back to README]](../../../README.md) diff --git a/samples/client/petstore/kotlin/docs/components/schemas/ObjWithRequiredPropsBase.md b/samples/client/petstore/kotlin/docs/components/schemas/ObjWithRequiredPropsBase.md new file mode 100644 index 00000000000..e08d48bff09 --- /dev/null +++ b/samples/client/petstore/kotlin/docs/components/schemas/ObjWithRequiredPropsBase.md @@ -0,0 +1,185 @@ +# ObjWithRequiredPropsBase +org.openapijsonschematools.client.components.schemas.ObjWithRequiredPropsBase.java +public class ObjWithRequiredPropsBase
+ +A class that contains necessary nested +- schema classes (which validate payloads), extends JsonSchema +- sealed interfaces which store validated payloads, java version of a sum type +- boxed classes which store validated payloads, sealed permits class implementations +- classes to store validated map payloads, extends FrozenMap +- classes to build inputs for map payloads + +## Nested Class Summary +| Modifier and Type | Class and Description | +| ----------------- | ---------------------- | +| sealed interface | [ObjWithRequiredPropsBase.ObjWithRequiredPropsBase1Boxed](#objwithrequiredpropsbase1boxed)
sealed interface for validated payloads | +| record | [ObjWithRequiredPropsBase.ObjWithRequiredPropsBase1BoxedMap](#objwithrequiredpropsbase1boxedmap)
boxed class to store validated Map payloads | +| static class | [ObjWithRequiredPropsBase.ObjWithRequiredPropsBase1](#objwithrequiredpropsbase1)
schema class | +| static class | [ObjWithRequiredPropsBase.ObjWithRequiredPropsBaseMapBuilder](#objwithrequiredpropsbasemapbuilder)
builder for Map payloads | +| static class | [ObjWithRequiredPropsBase.ObjWithRequiredPropsBaseMap](#objwithrequiredpropsbasemap)
output class for Map payloads | +| sealed interface | [ObjWithRequiredPropsBase.BBoxed](#bboxed)
sealed interface for validated payloads | +| record | [ObjWithRequiredPropsBase.BBoxedString](#bboxedstring)
boxed class to store validated String payloads | +| static class | [ObjWithRequiredPropsBase.B](#b)
schema class | + +## ObjWithRequiredPropsBase1Boxed +public sealed interface ObjWithRequiredPropsBase1Boxed
+permits
+[ObjWithRequiredPropsBase1BoxedMap](#objwithrequiredpropsbase1boxedmap) + +sealed interface that stores validated payloads using boxed classes + +## ObjWithRequiredPropsBase1BoxedMap +public record ObjWithRequiredPropsBase1BoxedMap
+implements [ObjWithRequiredPropsBase1Boxed](#objwithrequiredpropsbase1boxed) + +record that stores validated Map payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| ObjWithRequiredPropsBase1BoxedMap([ObjWithRequiredPropsBaseMap](#objwithrequiredpropsbasemap) data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| [ObjWithRequiredPropsBaseMap](#objwithrequiredpropsbasemap) | data()
validated payload | +| @Nullable Object | getData()
validated payload | + +## ObjWithRequiredPropsBase1 +public static class ObjWithRequiredPropsBase1
+extends JsonSchema + +A schema class that validates payloads + +### Code Sample +``` +import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags; +import org.openapijsonschematools.client.configurations.SchemaConfiguration; +import org.openapijsonschematools.client.exceptions.ValidationException; +import org.openapijsonschematools.client.schemas.validation.MapUtils; +import org.openapijsonschematools.client.schemas.validation.FrozenList; +import org.openapijsonschematools.client.schemas.validation.FrozenMap; +import org.openapijsonschematools.client.components.schemas.ObjWithRequiredPropsBase; + +import java.util.Arrays; +import java.util.List; +import java.util.AbstractMap; + +static final SchemaConfiguration configuration = new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().build()); + +// Map validation +ObjWithRequiredPropsBase.ObjWithRequiredPropsBaseMap validatedPayload = + ObjWithRequiredPropsBase.ObjWithRequiredPropsBase1.validate( + new ObjWithRequiredPropsBase.ObjWithRequiredPropsBaseMapBuilder() + .b("a") + + .build(), + configuration +); +``` + +### Field Summary +| Modifier and Type | Field and Description | +| ----------------- | ---------------------- | +| Set> | type = Set.of(Map.class) | +| Map> | properties = Map.ofEntries(
    new PropertyEntry("b", [B.class](#b)))
)
| +| Set | required = Set.of(
    "b"
)
| + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| [ObjWithRequiredPropsBaseMap](#objwithrequiredpropsbasemap) | validate([Map<?, ?>](#objwithrequiredpropsbasemapbuilder) arg, SchemaConfiguration configuration) | +| [ObjWithRequiredPropsBase1BoxedMap](#objwithrequiredpropsbase1boxedmap) | validateAndBox([Map<?, ?>](#objwithrequiredpropsbasemapbuilder) arg, SchemaConfiguration configuration) | +| [ObjWithRequiredPropsBase1Boxed](#objwithrequiredpropsbase1boxed) | validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) | +| @Nullable Object | validate(@Nullable Object arg, SchemaConfiguration configuration) | + +## ObjWithRequiredPropsBaseMap0Builder +public class ObjWithRequiredPropsBaseMap0Builder
+builder for `Map` + +A class that builds the Map input type + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| ObjWithRequiredPropsBaseMap0Builder(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 | +| [ObjWithRequiredPropsBaseMap0Builder](#objwithrequiredpropsbasemap0builder) | additionalProperty(String key, Nothing? value) | +| [ObjWithRequiredPropsBaseMap0Builder](#objwithrequiredpropsbasemap0builder) | additionalProperty(String key, boolean value) | +| [ObjWithRequiredPropsBaseMap0Builder](#objwithrequiredpropsbasemap0builder) | additionalProperty(String key, String value) | +| [ObjWithRequiredPropsBaseMap0Builder](#objwithrequiredpropsbasemap0builder) | additionalProperty(String key, int value) | +| [ObjWithRequiredPropsBaseMap0Builder](#objwithrequiredpropsbasemap0builder) | additionalProperty(String key, float value) | +| [ObjWithRequiredPropsBaseMap0Builder](#objwithrequiredpropsbasemap0builder) | additionalProperty(String key, long value) | +| [ObjWithRequiredPropsBaseMap0Builder](#objwithrequiredpropsbasemap0builder) | additionalProperty(String key, double value) | +| [ObjWithRequiredPropsBaseMap0Builder](#objwithrequiredpropsbasemap0builder) | additionalProperty(String key, List value) | +| [ObjWithRequiredPropsBaseMap0Builder](#objwithrequiredpropsbasemap0builder) | additionalProperty(String key, Map value) | + +## ObjWithRequiredPropsBaseMapBuilder +public class ObjWithRequiredPropsBaseMapBuilder
+builder for `Map` + +A class that builds the Map input type + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| ObjWithRequiredPropsBaseMapBuilder()
Creates a builder that contains an empty map | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| [ObjWithRequiredPropsBaseMap0Builder](#objwithrequiredpropsbasemap0builder) | b(String value) | + +## ObjWithRequiredPropsBaseMap +public static class ObjWithRequiredPropsBaseMap
+extends FrozenMap + +A class to store validated Map payloads + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| static [ObjWithRequiredPropsBaseMap](#objwithrequiredpropsbasemap) | of([Map](#objwithrequiredpropsbasemapbuilder) arg, SchemaConfiguration configuration) | +| String | b()
| +| @Nullable Object | getAdditionalProperty(String name)
provides type safety for additional properties | + +## BBoxed +public sealed interface BBoxed
+permits
+[BBoxedString](#bboxedstring) + +sealed interface that stores validated payloads using boxed classes + +## BBoxedString +public record BBoxedString
+implements [BBoxed](#bboxed) + +record that stores validated String payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| BBoxedString(String data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| String | data()
validated payload | +| @Nullable Object | getData()
validated payload | + +## B +public static class B
+extends StringJsonSchema.StringJsonSchema1 + +A schema class that validates payloads + +| Methods Inherited from class org.openapijsonschematools.client.schemas.StringJsonSchema.StringJsonSchema1 | +| ------------------------------------------------------------------ | +| validate | +| validateAndBox | + +[[Back to top]](#top) [[Back to Component Schemas]](../../../README.md#Component-Schemas) [[Back to README]](../../../README.md) diff --git a/samples/client/petstore/kotlin/docs/components/schemas/ObjectInterface.md b/samples/client/petstore/kotlin/docs/components/schemas/ObjectInterface.md new file mode 100644 index 00000000000..b838c721b58 --- /dev/null +++ b/samples/client/petstore/kotlin/docs/components/schemas/ObjectInterface.md @@ -0,0 +1,52 @@ +# ObjectInterface +org.openapijsonschematools.client.components.schemas.ObjectInterface.java +public class ObjectInterface
+ +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 + +## Nested Class Summary +| Modifier and Type | Class and Description | +| ----------------- | ---------------------- | +| sealed interface | [ObjectInterface.ObjectInterface1Boxed](#objectinterface1boxed)
sealed interface for validated payloads | +| record | [ObjectInterface.ObjectInterface1BoxedMap](#objectinterface1boxedmap)
boxed class to store validated Map payloads | +| static class | [ObjectInterface.ObjectInterface1](#objectinterface1)
schema class | + +## ObjectInterface1Boxed +public sealed interface ObjectInterface1Boxed
+permits
+[ObjectInterface1BoxedMap](#objectinterface1boxedmap) + +sealed interface that stores validated payloads using boxed classes + +## ObjectInterface1BoxedMap +public record ObjectInterface1BoxedMap
+implements [ObjectInterface1Boxed](#objectinterface1boxed) + +record that stores validated Map payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| ObjectInterface1BoxedMap(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 | + +## ObjectInterface1 +public static class ObjectInterface1
+extends MapJsonSchema.MapJsonSchema1 + +A schema class that validates payloads + +| Methods Inherited from class org.openapijsonschematools.client.schemas.MapJsonSchema.MapJsonSchema1 | +| ------------------------------------------------------------------ | +| validate | +| validateAndBox | + +[[Back to top]](#top) [[Back to Component Schemas]](../../../README.md#Component-Schemas) [[Back to README]](../../../README.md) diff --git a/samples/client/petstore/kotlin/docs/components/schemas/ObjectModelWithArgAndArgsProperties.md b/samples/client/petstore/kotlin/docs/components/schemas/ObjectModelWithArgAndArgsProperties.md new file mode 100644 index 00000000000..ebe6eb02a3f --- /dev/null +++ b/samples/client/petstore/kotlin/docs/components/schemas/ObjectModelWithArgAndArgsProperties.md @@ -0,0 +1,259 @@ +# ObjectModelWithArgAndArgsProperties +org.openapijsonschematools.client.components.schemas.ObjectModelWithArgAndArgsProperties.java +public class ObjectModelWithArgAndArgsProperties
+ +A class that contains necessary nested +- schema classes (which validate payloads), extends JsonSchema +- sealed interfaces which store validated payloads, java version of a sum type +- boxed classes which store validated payloads, sealed permits class implementations +- classes to store validated map payloads, extends FrozenMap +- classes to build inputs for map payloads + +## Nested Class Summary +| Modifier and Type | Class and Description | +| ----------------- | ---------------------- | +| sealed interface | [ObjectModelWithArgAndArgsProperties.ObjectModelWithArgAndArgsProperties1Boxed](#objectmodelwithargandargsproperties1boxed)
sealed interface for validated payloads | +| record | [ObjectModelWithArgAndArgsProperties.ObjectModelWithArgAndArgsProperties1BoxedMap](#objectmodelwithargandargsproperties1boxedmap)
boxed class to store validated Map payloads | +| static class | [ObjectModelWithArgAndArgsProperties.ObjectModelWithArgAndArgsProperties1](#objectmodelwithargandargsproperties1)
schema class | +| static class | [ObjectModelWithArgAndArgsProperties.ObjectModelWithArgAndArgsPropertiesMapBuilder](#objectmodelwithargandargspropertiesmapbuilder)
builder for Map payloads | +| static class | [ObjectModelWithArgAndArgsProperties.ObjectModelWithArgAndArgsPropertiesMap](#objectmodelwithargandargspropertiesmap)
output class for Map payloads | +| sealed interface | [ObjectModelWithArgAndArgsProperties.ArgsBoxed](#argsboxed)
sealed interface for validated payloads | +| record | [ObjectModelWithArgAndArgsProperties.ArgsBoxedString](#argsboxedstring)
boxed class to store validated String payloads | +| static class | [ObjectModelWithArgAndArgsProperties.Args](#args)
schema class | +| sealed interface | [ObjectModelWithArgAndArgsProperties.ArgBoxed](#argboxed)
sealed interface for validated payloads | +| record | [ObjectModelWithArgAndArgsProperties.ArgBoxedString](#argboxedstring)
boxed class to store validated String payloads | +| static class | [ObjectModelWithArgAndArgsProperties.Arg](#arg)
schema class | + +## ObjectModelWithArgAndArgsProperties1Boxed +public sealed interface ObjectModelWithArgAndArgsProperties1Boxed
+permits
+[ObjectModelWithArgAndArgsProperties1BoxedMap](#objectmodelwithargandargsproperties1boxedmap) + +sealed interface that stores validated payloads using boxed classes + +## ObjectModelWithArgAndArgsProperties1BoxedMap +public record ObjectModelWithArgAndArgsProperties1BoxedMap
+implements [ObjectModelWithArgAndArgsProperties1Boxed](#objectmodelwithargandargsproperties1boxed) + +record that stores validated Map payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| ObjectModelWithArgAndArgsProperties1BoxedMap([ObjectModelWithArgAndArgsPropertiesMap](#objectmodelwithargandargspropertiesmap) data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| [ObjectModelWithArgAndArgsPropertiesMap](#objectmodelwithargandargspropertiesmap) | data()
validated payload | +| @Nullable Object | getData()
validated payload | + +## ObjectModelWithArgAndArgsProperties1 +public static class ObjectModelWithArgAndArgsProperties1
+extends JsonSchema + +A schema class that validates payloads + +### Code Sample +``` +import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags; +import org.openapijsonschematools.client.configurations.SchemaConfiguration; +import org.openapijsonschematools.client.exceptions.ValidationException; +import org.openapijsonschematools.client.schemas.validation.MapUtils; +import org.openapijsonschematools.client.schemas.validation.FrozenList; +import org.openapijsonschematools.client.schemas.validation.FrozenMap; +import org.openapijsonschematools.client.components.schemas.ObjectModelWithArgAndArgsProperties; + +import java.util.Arrays; +import java.util.List; +import java.util.AbstractMap; + +static final SchemaConfiguration configuration = new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().build()); + +// Map validation +ObjectModelWithArgAndArgsProperties.ObjectModelWithArgAndArgsPropertiesMap validatedPayload = + ObjectModelWithArgAndArgsProperties.ObjectModelWithArgAndArgsProperties1.validate( + new ObjectModelWithArgAndArgsProperties.ObjectModelWithArgAndArgsPropertiesMapBuilder() + .arg("a") + + .args("a") + + .build(), + configuration +); +``` + +### Field Summary +| Modifier and Type | Field and Description | +| ----------------- | ---------------------- | +| Set> | type = Set.of(Map.class) | +| Map> | properties = Map.ofEntries(
    new PropertyEntry("arg", [Arg.class](#arg))),
    new PropertyEntry("args", [Args.class](#args)))
)
| +| Set | required = Set.of(
    "arg",
    "args"
)
| + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| [ObjectModelWithArgAndArgsPropertiesMap](#objectmodelwithargandargspropertiesmap) | validate([Map<?, ?>](#objectmodelwithargandargspropertiesmapbuilder) arg, SchemaConfiguration configuration) | +| [ObjectModelWithArgAndArgsProperties1BoxedMap](#objectmodelwithargandargsproperties1boxedmap) | validateAndBox([Map<?, ?>](#objectmodelwithargandargspropertiesmapbuilder) arg, SchemaConfiguration configuration) | +| [ObjectModelWithArgAndArgsProperties1Boxed](#objectmodelwithargandargsproperties1boxed) | validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) | +| @Nullable Object | validate(@Nullable Object arg, SchemaConfiguration configuration) | + +## ObjectModelWithArgAndArgsPropertiesMap00Builder +public class ObjectModelWithArgAndArgsPropertiesMap00Builder
+builder for `Map` + +A class that builds the Map input type + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| ObjectModelWithArgAndArgsPropertiesMap00Builder(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 | +| [ObjectModelWithArgAndArgsPropertiesMap00Builder](#objectmodelwithargandargspropertiesmap00builder) | additionalProperty(String key, Nothing? value) | +| [ObjectModelWithArgAndArgsPropertiesMap00Builder](#objectmodelwithargandargspropertiesmap00builder) | additionalProperty(String key, boolean value) | +| [ObjectModelWithArgAndArgsPropertiesMap00Builder](#objectmodelwithargandargspropertiesmap00builder) | additionalProperty(String key, String value) | +| [ObjectModelWithArgAndArgsPropertiesMap00Builder](#objectmodelwithargandargspropertiesmap00builder) | additionalProperty(String key, int value) | +| [ObjectModelWithArgAndArgsPropertiesMap00Builder](#objectmodelwithargandargspropertiesmap00builder) | additionalProperty(String key, float value) | +| [ObjectModelWithArgAndArgsPropertiesMap00Builder](#objectmodelwithargandargspropertiesmap00builder) | additionalProperty(String key, long value) | +| [ObjectModelWithArgAndArgsPropertiesMap00Builder](#objectmodelwithargandargspropertiesmap00builder) | additionalProperty(String key, double value) | +| [ObjectModelWithArgAndArgsPropertiesMap00Builder](#objectmodelwithargandargspropertiesmap00builder) | additionalProperty(String key, List value) | +| [ObjectModelWithArgAndArgsPropertiesMap00Builder](#objectmodelwithargandargspropertiesmap00builder) | additionalProperty(String key, Map value) | + +## ObjectModelWithArgAndArgsPropertiesMap01Builder +public class ObjectModelWithArgAndArgsPropertiesMap01Builder
+builder for `Map` + +A class that builds the Map input type + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| ObjectModelWithArgAndArgsPropertiesMap01Builder(Map instance)
Creates a builder that contains the passed instance | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| [ObjectModelWithArgAndArgsPropertiesMap00Builder](#objectmodelwithargandargspropertiesmap00builder) | args(String value) | + +## ObjectModelWithArgAndArgsPropertiesMap10Builder +public class ObjectModelWithArgAndArgsPropertiesMap10Builder
+builder for `Map` + +A class that builds the Map input type + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| ObjectModelWithArgAndArgsPropertiesMap10Builder(Map instance)
Creates a builder that contains the passed instance | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| [ObjectModelWithArgAndArgsPropertiesMap00Builder](#objectmodelwithargandargspropertiesmap00builder) | arg(String value) | + +## ObjectModelWithArgAndArgsPropertiesMapBuilder +public class ObjectModelWithArgAndArgsPropertiesMapBuilder
+builder for `Map` + +A class that builds the Map input type + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| ObjectModelWithArgAndArgsPropertiesMapBuilder()
Creates a builder that contains an empty map | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| [ObjectModelWithArgAndArgsPropertiesMap01Builder](#objectmodelwithargandargspropertiesmap01builder) | arg(String value) | +| [ObjectModelWithArgAndArgsPropertiesMap10Builder](#objectmodelwithargandargspropertiesmap10builder) | args(String value) | + +## ObjectModelWithArgAndArgsPropertiesMap +public static class ObjectModelWithArgAndArgsPropertiesMap
+extends FrozenMap + +A class to store validated Map payloads + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| static [ObjectModelWithArgAndArgsPropertiesMap](#objectmodelwithargandargspropertiesmap) | of([Map](#objectmodelwithargandargspropertiesmapbuilder) arg, SchemaConfiguration configuration) | +| String | arg()
| +| String | args()
| +| @Nullable Object | getAdditionalProperty(String name)
provides type safety for additional properties | + +## ArgsBoxed +public sealed interface ArgsBoxed
+permits
+[ArgsBoxedString](#argsboxedstring) + +sealed interface that stores validated payloads using boxed classes + +## ArgsBoxedString +public record ArgsBoxedString
+implements [ArgsBoxed](#argsboxed) + +record that stores validated String payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| ArgsBoxedString(String data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| String | data()
validated payload | +| @Nullable Object | getData()
validated payload | + +## Args +public static class Args
+extends StringJsonSchema.StringJsonSchema1 + +A schema class that validates payloads + +| Methods Inherited from class org.openapijsonschematools.client.schemas.StringJsonSchema.StringJsonSchema1 | +| ------------------------------------------------------------------ | +| validate | +| validateAndBox | + +## ArgBoxed +public sealed interface ArgBoxed
+permits
+[ArgBoxedString](#argboxedstring) + +sealed interface that stores validated payloads using boxed classes + +## ArgBoxedString +public record ArgBoxedString
+implements [ArgBoxed](#argboxed) + +record that stores validated String payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| ArgBoxedString(String data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| String | data()
validated payload | +| @Nullable Object | getData()
validated payload | + +## Arg +public static class Arg
+extends StringJsonSchema.StringJsonSchema1 + +A schema class that validates payloads + +| Methods Inherited from class org.openapijsonschematools.client.schemas.StringJsonSchema.StringJsonSchema1 | +| ------------------------------------------------------------------ | +| validate | +| validateAndBox | + +[[Back to top]](#top) [[Back to Component Schemas]](../../../README.md#Component-Schemas) [[Back to README]](../../../README.md) diff --git a/samples/client/petstore/kotlin/docs/components/schemas/ObjectModelWithRefProps.md b/samples/client/petstore/kotlin/docs/components/schemas/ObjectModelWithRefProps.md new file mode 100644 index 00000000000..965b77a1f9e --- /dev/null +++ b/samples/client/petstore/kotlin/docs/components/schemas/ObjectModelWithRefProps.md @@ -0,0 +1,139 @@ +# ObjectModelWithRefProps +org.openapijsonschematools.client.components.schemas.ObjectModelWithRefProps.java +public class ObjectModelWithRefProps
+ +A class that contains necessary nested +- schema classes (which validate payloads), extends JsonSchema +- sealed interfaces which store validated payloads, java version of a sum type +- boxed classes which store validated payloads, sealed permits class implementations +- classes to store validated map payloads, extends FrozenMap +- classes to build inputs for map payloads + +## Nested Class Summary +| Modifier and Type | Class and Description | +| ----------------- | ---------------------- | +| sealed interface | [ObjectModelWithRefProps.ObjectModelWithRefProps1Boxed](#objectmodelwithrefprops1boxed)
sealed interface for validated payloads | +| record | [ObjectModelWithRefProps.ObjectModelWithRefProps1BoxedMap](#objectmodelwithrefprops1boxedmap)
boxed class to store validated Map payloads | +| static class | [ObjectModelWithRefProps.ObjectModelWithRefProps1](#objectmodelwithrefprops1)
schema class | +| static class | [ObjectModelWithRefProps.ObjectModelWithRefPropsMapBuilder](#objectmodelwithrefpropsmapbuilder)
builder for Map payloads | +| static class | [ObjectModelWithRefProps.ObjectModelWithRefPropsMap](#objectmodelwithrefpropsmap)
output class for Map payloads | + +## ObjectModelWithRefProps1Boxed +public sealed interface ObjectModelWithRefProps1Boxed
+permits
+[ObjectModelWithRefProps1BoxedMap](#objectmodelwithrefprops1boxedmap) + +sealed interface that stores validated payloads using boxed classes + +## ObjectModelWithRefProps1BoxedMap +public record ObjectModelWithRefProps1BoxedMap
+implements [ObjectModelWithRefProps1Boxed](#objectmodelwithrefprops1boxed) + +record that stores validated Map payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| ObjectModelWithRefProps1BoxedMap([ObjectModelWithRefPropsMap](#objectmodelwithrefpropsmap) data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| [ObjectModelWithRefPropsMap](#objectmodelwithrefpropsmap) | data()
validated payload | +| @Nullable Object | getData()
validated payload | + +## ObjectModelWithRefProps1 +public static class ObjectModelWithRefProps1
+extends JsonSchema + +A schema class that validates payloads + +## Description +a model that includes properties which should stay primitive (String + Boolean) and one which is defined as a class, NumberWithValidations + +### Code Sample +``` +import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags; +import org.openapijsonschematools.client.configurations.SchemaConfiguration; +import org.openapijsonschematools.client.exceptions.ValidationException; +import org.openapijsonschematools.client.schemas.validation.MapUtils; +import org.openapijsonschematools.client.schemas.validation.FrozenList; +import org.openapijsonschematools.client.schemas.validation.FrozenMap; +import org.openapijsonschematools.client.components.schemas.ObjectModelWithRefProps; + +import java.util.Arrays; +import java.util.List; +import java.util.AbstractMap; + +static final SchemaConfiguration configuration = new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().build()); + +// Map validation +ObjectModelWithRefProps.ObjectModelWithRefPropsMap validatedPayload = + ObjectModelWithRefProps.ObjectModelWithRefProps1.validate( + new ObjectModelWithRefProps.ObjectModelWithRefPropsMapBuilder() + .build(), + configuration +); +``` + +### Field Summary +| Modifier and Type | Field and Description | +| ----------------- | ---------------------- | +| Set> | type = Set.of(Map.class) | +| Map> | properties = Map.ofEntries(
    new PropertyEntry("myNumber", [NumberWithValidations.NumberWithValidations1.class](../../components/schemas/NumberWithValidations.md#numberwithvalidations1)),
    new PropertyEntry("myString", [StringSchema.StringSchema1.class](../../components/schemas/StringSchema.md#stringschema1)),
    new PropertyEntry("myBoolean", [BooleanSchema.BooleanSchema1.class](../../components/schemas/BooleanSchema.md#booleanschema1))
)
| + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| [ObjectModelWithRefPropsMap](#objectmodelwithrefpropsmap) | validate([Map<?, ?>](#objectmodelwithrefpropsmapbuilder) arg, SchemaConfiguration configuration) | +| [ObjectModelWithRefProps1BoxedMap](#objectmodelwithrefprops1boxedmap) | validateAndBox([Map<?, ?>](#objectmodelwithrefpropsmapbuilder) arg, SchemaConfiguration configuration) | +| [ObjectModelWithRefProps1Boxed](#objectmodelwithrefprops1boxed) | validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) | +| @Nullable Object | validate(@Nullable Object arg, SchemaConfiguration configuration) | + +## ObjectModelWithRefPropsMapBuilder +public class ObjectModelWithRefPropsMapBuilder
+builder for `Map` + +A class that builds the Map input type + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| ObjectModelWithRefPropsMapBuilder()
Creates a builder that contains an empty map | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| Map | build()
Returns map input that should be used with Schema.validate | +| [ObjectModelWithRefPropsMapBuilder](#objectmodelwithrefpropsmapbuilder) | myNumber(int value) | +| [ObjectModelWithRefPropsMapBuilder](#objectmodelwithrefpropsmapbuilder) | myNumber(float value) | +| [ObjectModelWithRefPropsMapBuilder](#objectmodelwithrefpropsmapbuilder) | myNumber(long value) | +| [ObjectModelWithRefPropsMapBuilder](#objectmodelwithrefpropsmapbuilder) | myNumber(double value) | +| [ObjectModelWithRefPropsMapBuilder](#objectmodelwithrefpropsmapbuilder) | myString(String value) | +| [ObjectModelWithRefPropsMapBuilder](#objectmodelwithrefpropsmapbuilder) | myBoolean(boolean value) | +| [ObjectModelWithRefPropsMapBuilder](#objectmodelwithrefpropsmapbuilder) | additionalProperty(String key, Nothing? value) | +| [ObjectModelWithRefPropsMapBuilder](#objectmodelwithrefpropsmapbuilder) | additionalProperty(String key, boolean value) | +| [ObjectModelWithRefPropsMapBuilder](#objectmodelwithrefpropsmapbuilder) | additionalProperty(String key, String value) | +| [ObjectModelWithRefPropsMapBuilder](#objectmodelwithrefpropsmapbuilder) | additionalProperty(String key, int value) | +| [ObjectModelWithRefPropsMapBuilder](#objectmodelwithrefpropsmapbuilder) | additionalProperty(String key, float value) | +| [ObjectModelWithRefPropsMapBuilder](#objectmodelwithrefpropsmapbuilder) | additionalProperty(String key, long value) | +| [ObjectModelWithRefPropsMapBuilder](#objectmodelwithrefpropsmapbuilder) | additionalProperty(String key, double value) | +| [ObjectModelWithRefPropsMapBuilder](#objectmodelwithrefpropsmapbuilder) | additionalProperty(String key, List value) | +| [ObjectModelWithRefPropsMapBuilder](#objectmodelwithrefpropsmapbuilder) | additionalProperty(String key, Map value) | + +## ObjectModelWithRefPropsMap +public static class ObjectModelWithRefPropsMap
+extends FrozenMap + +A class to store validated Map payloads + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| static [ObjectModelWithRefPropsMap](#objectmodelwithrefpropsmap) | of([Map](#objectmodelwithrefpropsmapbuilder) arg, SchemaConfiguration configuration) | +| Number | myNumber()
[optional] | +| String | myString()
[optional] | +| boolean | myBoolean()
[optional] | +| @Nullable Object | getAdditionalProperty(String name)
provides type safety for additional properties | + +[[Back to top]](#top) [[Back to Component Schemas]](../../../README.md#Component-Schemas) [[Back to README]](../../../README.md) diff --git a/samples/client/petstore/kotlin/docs/components/schemas/ObjectWithAllOfWithReqTestPropFromUnsetAddProp.md b/samples/client/petstore/kotlin/docs/components/schemas/ObjectWithAllOfWithReqTestPropFromUnsetAddProp.md new file mode 100644 index 00000000000..42ce8ddc190 --- /dev/null +++ b/samples/client/petstore/kotlin/docs/components/schemas/ObjectWithAllOfWithReqTestPropFromUnsetAddProp.md @@ -0,0 +1,350 @@ +# ObjectWithAllOfWithReqTestPropFromUnsetAddProp +org.openapijsonschematools.client.components.schemas.ObjectWithAllOfWithReqTestPropFromUnsetAddProp.java +public class ObjectWithAllOfWithReqTestPropFromUnsetAddProp
+ +A class that contains necessary nested +- schema classes (which validate payloads), extends JsonSchema +- sealed interfaces which store validated payloads, java version of a sum type +- boxed classes which store validated payloads, sealed permits class implementations +- classes to store validated map payloads, extends FrozenMap +- classes to build inputs for map payloads + +## Nested Class Summary +| Modifier and Type | Class and Description | +| ----------------- | ---------------------- | +| sealed interface | [ObjectWithAllOfWithReqTestPropFromUnsetAddProp.ObjectWithAllOfWithReqTestPropFromUnsetAddProp1Boxed](#objectwithallofwithreqtestpropfromunsetaddprop1boxed)
sealed interface for validated payloads | +| record | [ObjectWithAllOfWithReqTestPropFromUnsetAddProp.ObjectWithAllOfWithReqTestPropFromUnsetAddProp1BoxedVoid](#objectwithallofwithreqtestpropfromunsetaddprop1boxedvoid)
boxed class to store validated null payloads | +| record | [ObjectWithAllOfWithReqTestPropFromUnsetAddProp.ObjectWithAllOfWithReqTestPropFromUnsetAddProp1BoxedBoolean](#objectwithallofwithreqtestpropfromunsetaddprop1boxedboolean)
boxed class to store validated boolean payloads | +| record | [ObjectWithAllOfWithReqTestPropFromUnsetAddProp.ObjectWithAllOfWithReqTestPropFromUnsetAddProp1BoxedNumber](#objectwithallofwithreqtestpropfromunsetaddprop1boxednumber)
boxed class to store validated Number payloads | +| record | [ObjectWithAllOfWithReqTestPropFromUnsetAddProp.ObjectWithAllOfWithReqTestPropFromUnsetAddProp1BoxedString](#objectwithallofwithreqtestpropfromunsetaddprop1boxedstring)
boxed class to store validated String payloads | +| record | [ObjectWithAllOfWithReqTestPropFromUnsetAddProp.ObjectWithAllOfWithReqTestPropFromUnsetAddProp1BoxedList](#objectwithallofwithreqtestpropfromunsetaddprop1boxedlist)
boxed class to store validated List payloads | +| record | [ObjectWithAllOfWithReqTestPropFromUnsetAddProp.ObjectWithAllOfWithReqTestPropFromUnsetAddProp1BoxedMap](#objectwithallofwithreqtestpropfromunsetaddprop1boxedmap)
boxed class to store validated Map payloads | +| static class | [ObjectWithAllOfWithReqTestPropFromUnsetAddProp.ObjectWithAllOfWithReqTestPropFromUnsetAddProp1](#objectwithallofwithreqtestpropfromunsetaddprop1)
schema class | +| sealed interface | [ObjectWithAllOfWithReqTestPropFromUnsetAddProp.Schema1Boxed](#schema1boxed)
sealed interface for validated payloads | +| record | [ObjectWithAllOfWithReqTestPropFromUnsetAddProp.Schema1BoxedMap](#schema1boxedmap)
boxed class to store validated Map payloads | +| static class | [ObjectWithAllOfWithReqTestPropFromUnsetAddProp.Schema1](#schema1)
schema class | +| static class | [ObjectWithAllOfWithReqTestPropFromUnsetAddProp.Schema1MapBuilder](#schema1mapbuilder)
builder for Map payloads | +| static class | [ObjectWithAllOfWithReqTestPropFromUnsetAddProp.Schema1Map](#schema1map)
output class for Map payloads | +| sealed interface | [ObjectWithAllOfWithReqTestPropFromUnsetAddProp.NameBoxed](#nameboxed)
sealed interface for validated payloads | +| record | [ObjectWithAllOfWithReqTestPropFromUnsetAddProp.NameBoxedString](#nameboxedstring)
boxed class to store validated String payloads | +| static class | [ObjectWithAllOfWithReqTestPropFromUnsetAddProp.Name](#name)
schema class | + +## ObjectWithAllOfWithReqTestPropFromUnsetAddProp1Boxed +public sealed interface ObjectWithAllOfWithReqTestPropFromUnsetAddProp1Boxed
+permits
+[ObjectWithAllOfWithReqTestPropFromUnsetAddProp1BoxedVoid](#objectwithallofwithreqtestpropfromunsetaddprop1boxedvoid), +[ObjectWithAllOfWithReqTestPropFromUnsetAddProp1BoxedBoolean](#objectwithallofwithreqtestpropfromunsetaddprop1boxedboolean), +[ObjectWithAllOfWithReqTestPropFromUnsetAddProp1BoxedNumber](#objectwithallofwithreqtestpropfromunsetaddprop1boxednumber), +[ObjectWithAllOfWithReqTestPropFromUnsetAddProp1BoxedString](#objectwithallofwithreqtestpropfromunsetaddprop1boxedstring), +[ObjectWithAllOfWithReqTestPropFromUnsetAddProp1BoxedList](#objectwithallofwithreqtestpropfromunsetaddprop1boxedlist), +[ObjectWithAllOfWithReqTestPropFromUnsetAddProp1BoxedMap](#objectwithallofwithreqtestpropfromunsetaddprop1boxedmap) + +sealed interface that stores validated payloads using boxed classes + +## ObjectWithAllOfWithReqTestPropFromUnsetAddProp1BoxedVoid +public record ObjectWithAllOfWithReqTestPropFromUnsetAddProp1BoxedVoid
+implements [ObjectWithAllOfWithReqTestPropFromUnsetAddProp1Boxed](#objectwithallofwithreqtestpropfromunsetaddprop1boxed) + +record that stores validated null payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| ObjectWithAllOfWithReqTestPropFromUnsetAddProp1BoxedVoid(Nothing? data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| Nothing? | data()
validated payload | +| @Nullable Object | getData()
validated payload | + +## ObjectWithAllOfWithReqTestPropFromUnsetAddProp1BoxedBoolean +public record ObjectWithAllOfWithReqTestPropFromUnsetAddProp1BoxedBoolean
+implements [ObjectWithAllOfWithReqTestPropFromUnsetAddProp1Boxed](#objectwithallofwithreqtestpropfromunsetaddprop1boxed) + +record that stores validated boolean payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| ObjectWithAllOfWithReqTestPropFromUnsetAddProp1BoxedBoolean(boolean data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| boolean | data()
validated payload | +| @Nullable Object | getData()
validated payload | + +## ObjectWithAllOfWithReqTestPropFromUnsetAddProp1BoxedNumber +public record ObjectWithAllOfWithReqTestPropFromUnsetAddProp1BoxedNumber
+implements [ObjectWithAllOfWithReqTestPropFromUnsetAddProp1Boxed](#objectwithallofwithreqtestpropfromunsetaddprop1boxed) + +record that stores validated Number payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| ObjectWithAllOfWithReqTestPropFromUnsetAddProp1BoxedNumber(Number data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| Number | data()
validated payload | +| @Nullable Object | getData()
validated payload | + +## ObjectWithAllOfWithReqTestPropFromUnsetAddProp1BoxedString +public record ObjectWithAllOfWithReqTestPropFromUnsetAddProp1BoxedString
+implements [ObjectWithAllOfWithReqTestPropFromUnsetAddProp1Boxed](#objectwithallofwithreqtestpropfromunsetaddprop1boxed) + +record that stores validated String payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| ObjectWithAllOfWithReqTestPropFromUnsetAddProp1BoxedString(String data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| String | data()
validated payload | +| @Nullable Object | getData()
validated payload | + +## ObjectWithAllOfWithReqTestPropFromUnsetAddProp1BoxedList +public record ObjectWithAllOfWithReqTestPropFromUnsetAddProp1BoxedList
+implements [ObjectWithAllOfWithReqTestPropFromUnsetAddProp1Boxed](#objectwithallofwithreqtestpropfromunsetaddprop1boxed) + +record that stores validated List payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| ObjectWithAllOfWithReqTestPropFromUnsetAddProp1BoxedList(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 | + +## ObjectWithAllOfWithReqTestPropFromUnsetAddProp1BoxedMap +public record ObjectWithAllOfWithReqTestPropFromUnsetAddProp1BoxedMap
+implements [ObjectWithAllOfWithReqTestPropFromUnsetAddProp1Boxed](#objectwithallofwithreqtestpropfromunsetaddprop1boxed) + +record that stores validated Map payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| ObjectWithAllOfWithReqTestPropFromUnsetAddProp1BoxedMap(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 | + +## ObjectWithAllOfWithReqTestPropFromUnsetAddProp1 +public static class ObjectWithAllOfWithReqTestPropFromUnsetAddProp1
+extends JsonSchema + +A schema class that validates payloads + +### Field Summary +| Modifier and Type | Field and Description | +| ----------------- | ---------------------- | +| List> | allOf = List.of(
    [ObjectWithOptionalTestProp.ObjectWithOptionalTestProp1.class](../../components/schemas/ObjectWithOptionalTestProp.md#objectwithoptionaltestprop1),
    [Schema1.class](#schema1)
;)
| + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| String | validate(String arg, SchemaConfiguration configuration) | +| Nothing? | validate(Nothing? arg, SchemaConfiguration configuration) | +| int | validate(int arg, SchemaConfiguration configuration) | +| long | validate(long arg, SchemaConfiguration configuration) | +| float | validate(float arg, SchemaConfiguration configuration) | +| double | validate(double arg, SchemaConfiguration configuration) | +| Number | validate(Number arg, SchemaConfiguration configuration) | +| boolean | validate(boolean arg, SchemaConfiguration configuration) | +| FrozenMap<@Nullable Object> | validate(Map<?, ?> arg, SchemaConfiguration configuration) | +| FrozenList<@Nullable Object> | validate(List arg, SchemaConfiguration configuration) | +| [ObjectWithAllOfWithReqTestPropFromUnsetAddProp1BoxedString](#objectwithallofwithreqtestpropfromunsetaddprop1boxedstring) | validateAndBox(String arg, SchemaConfiguration configuration) | +| [ObjectWithAllOfWithReqTestPropFromUnsetAddProp1BoxedVoid](#objectwithallofwithreqtestpropfromunsetaddprop1boxedvoid) | validateAndBox(Nothing? arg, SchemaConfiguration configuration) | +| [ObjectWithAllOfWithReqTestPropFromUnsetAddProp1BoxedNumber](#objectwithallofwithreqtestpropfromunsetaddprop1boxednumber) | validateAndBox(Number arg, SchemaConfiguration configuration) | +| [ObjectWithAllOfWithReqTestPropFromUnsetAddProp1BoxedBoolean](#objectwithallofwithreqtestpropfromunsetaddprop1boxedboolean) | validateAndBox(boolean arg, SchemaConfiguration configuration) | +| [ObjectWithAllOfWithReqTestPropFromUnsetAddProp1BoxedMap](#objectwithallofwithreqtestpropfromunsetaddprop1boxedmap) | validateAndBox(Map<?, ?> arg, SchemaConfiguration configuration) | +| [ObjectWithAllOfWithReqTestPropFromUnsetAddProp1BoxedList](#objectwithallofwithreqtestpropfromunsetaddprop1boxedlist) | validateAndBox(List arg, SchemaConfiguration configuration) | +| [ObjectWithAllOfWithReqTestPropFromUnsetAddProp1Boxed](#objectwithallofwithreqtestpropfromunsetaddprop1boxed) | validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) | +| @Nullable Object | validate(@Nullable Object arg, SchemaConfiguration configuration) | + +## Schema1Boxed +public sealed interface Schema1Boxed
+permits
+[Schema1BoxedMap](#schema1boxedmap) + +sealed interface that stores validated payloads using boxed classes + +## Schema1BoxedMap +public record Schema1BoxedMap
+implements [Schema1Boxed](#schema1boxed) + +record that stores validated Map payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| Schema1BoxedMap([Schema1Map](#schema1map) data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| [Schema1Map](#schema1map) | data()
validated payload | +| @Nullable Object | getData()
validated payload | + +## Schema1 +public static class Schema1
+extends JsonSchema + +A schema class that validates payloads + +### Code Sample +``` +import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags; +import org.openapijsonschematools.client.configurations.SchemaConfiguration; +import org.openapijsonschematools.client.exceptions.ValidationException; +import org.openapijsonschematools.client.schemas.validation.MapUtils; +import org.openapijsonschematools.client.schemas.validation.FrozenList; +import org.openapijsonschematools.client.schemas.validation.FrozenMap; +import org.openapijsonschematools.client.components.schemas.ObjectWithAllOfWithReqTestPropFromUnsetAddProp; + +import java.util.Arrays; +import java.util.List; +import java.util.AbstractMap; + +static final SchemaConfiguration configuration = new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().build()); + +// Map validation +ObjectWithAllOfWithReqTestPropFromUnsetAddProp.Schema1Map validatedPayload = + ObjectWithAllOfWithReqTestPropFromUnsetAddProp.Schema1.validate( + new ObjectWithAllOfWithReqTestPropFromUnsetAddProp.Schema1MapBuilder() + .name("a") + + .build(), + configuration +); +``` + +### Field Summary +| Modifier and Type | Field and Description | +| ----------------- | ---------------------- | +| Set> | type = Set.of(Map.class) | +| Map> | properties = Map.ofEntries(
    new PropertyEntry("name", [Name.class](#name)))
)
| +| Set | required = Set.of(
    "test"
)
| + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| [Schema1Map](#schema1map) | validate([Map<?, ?>](#schema1mapbuilder) arg, SchemaConfiguration configuration) | +| [Schema1BoxedMap](#schema1boxedmap) | validateAndBox([Map<?, ?>](#schema1mapbuilder) arg, SchemaConfiguration configuration) | +| [Schema1Boxed](#schema1boxed) | validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) | +| @Nullable Object | validate(@Nullable Object arg, SchemaConfiguration configuration) | + +## Schema1Map0Builder +public class Schema1Map0Builder
+builder for `Map` + +A class that builds the Map input type + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| Schema1Map0Builder(Map instance)
Creates a builder that contains the passed instance | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| Map | build()
Returns map input that should be used with Schema.validate | +| [Schema1Map0Builder](#schema1map0builder) | name(String value) | +| [Schema1Map0Builder](#schema1map0builder) | additionalProperty(String key, Nothing? value) | +| [Schema1Map0Builder](#schema1map0builder) | additionalProperty(String key, boolean value) | +| [Schema1Map0Builder](#schema1map0builder) | additionalProperty(String key, String value) | +| [Schema1Map0Builder](#schema1map0builder) | additionalProperty(String key, int value) | +| [Schema1Map0Builder](#schema1map0builder) | additionalProperty(String key, float value) | +| [Schema1Map0Builder](#schema1map0builder) | additionalProperty(String key, long value) | +| [Schema1Map0Builder](#schema1map0builder) | additionalProperty(String key, double value) | +| [Schema1Map0Builder](#schema1map0builder) | additionalProperty(String key, List value) | +| [Schema1Map0Builder](#schema1map0builder) | additionalProperty(String key, Map value) | + +## Schema1MapBuilder +public class Schema1MapBuilder
+builder for `Map` + +A class that builds the Map input type + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| Schema1MapBuilder()
Creates a builder that contains an empty map | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| [Schema1Map0Builder](#schema1map0builder) | test(Nothing? value) | +| [Schema1Map0Builder](#schema1map0builder) | test(boolean value) | +| [Schema1Map0Builder](#schema1map0builder) | test(String value) | +| [Schema1Map0Builder](#schema1map0builder) | test(int value) | +| [Schema1Map0Builder](#schema1map0builder) | test(float value) | +| [Schema1Map0Builder](#schema1map0builder) | test(long value) | +| [Schema1Map0Builder](#schema1map0builder) | test(double value) | +| [Schema1Map0Builder](#schema1map0builder) | test(List value) | +| [Schema1Map0Builder](#schema1map0builder) | test(Map value) | + +## Schema1Map +public static class Schema1Map
+extends FrozenMap + +A class to store validated Map payloads + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| static [Schema1Map](#schema1map) | of([Map](#schema1mapbuilder) arg, SchemaConfiguration configuration) | +| @Nullable Object | test()
| +| String | name()
[optional] | +| @Nullable Object | getAdditionalProperty(String name)
provides type safety for additional properties | + +## NameBoxed +public sealed interface NameBoxed
+permits
+[NameBoxedString](#nameboxedstring) + +sealed interface that stores validated payloads using boxed classes + +## NameBoxedString +public record NameBoxedString
+implements [NameBoxed](#nameboxed) + +record that stores validated String payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| NameBoxedString(String data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| String | data()
validated payload | +| @Nullable Object | getData()
validated payload | + +## Name +public static class Name
+extends StringJsonSchema.StringJsonSchema1 + +A schema class that validates payloads + +| Methods Inherited from class org.openapijsonschematools.client.schemas.StringJsonSchema.StringJsonSchema1 | +| ------------------------------------------------------------------ | +| validate | +| validateAndBox | + +[[Back to top]](#top) [[Back to Component Schemas]](../../../README.md#Component-Schemas) [[Back to README]](../../../README.md) diff --git a/samples/client/petstore/kotlin/docs/components/schemas/ObjectWithCollidingProperties.md b/samples/client/petstore/kotlin/docs/components/schemas/ObjectWithCollidingProperties.md new file mode 100644 index 00000000000..c41be24becf --- /dev/null +++ b/samples/client/petstore/kotlin/docs/components/schemas/ObjectWithCollidingProperties.md @@ -0,0 +1,210 @@ +# ObjectWithCollidingProperties +org.openapijsonschematools.client.components.schemas.ObjectWithCollidingProperties.java +public class ObjectWithCollidingProperties
+ +A class that contains necessary nested +- schema classes (which validate payloads), extends JsonSchema +- sealed interfaces which store validated payloads, java version of a sum type +- boxed classes which store validated payloads, sealed permits class implementations +- classes to store validated map payloads, extends FrozenMap +- classes to build inputs for map payloads + +## Nested Class Summary +| Modifier and Type | Class and Description | +| ----------------- | ---------------------- | +| sealed interface | [ObjectWithCollidingProperties.ObjectWithCollidingProperties1Boxed](#objectwithcollidingproperties1boxed)
sealed interface for validated payloads | +| record | [ObjectWithCollidingProperties.ObjectWithCollidingProperties1BoxedMap](#objectwithcollidingproperties1boxedmap)
boxed class to store validated Map payloads | +| static class | [ObjectWithCollidingProperties.ObjectWithCollidingProperties1](#objectwithcollidingproperties1)
schema class | +| static class | [ObjectWithCollidingProperties.ObjectWithCollidingPropertiesMapBuilder](#objectwithcollidingpropertiesmapbuilder)
builder for Map payloads | +| static class | [ObjectWithCollidingProperties.ObjectWithCollidingPropertiesMap](#objectwithcollidingpropertiesmap)
output class for Map payloads | +| sealed interface | [ObjectWithCollidingProperties.SomepropBoxed](#somepropboxed)
sealed interface for validated payloads | +| record | [ObjectWithCollidingProperties.SomepropBoxedMap](#somepropboxedmap)
boxed class to store validated Map payloads | +| static class | [ObjectWithCollidingProperties.Someprop](#someprop)
schema class | +| sealed interface | [ObjectWithCollidingProperties.SomePropBoxed](#somepropboxed)
sealed interface for validated payloads | +| record | [ObjectWithCollidingProperties.SomePropBoxedMap](#somepropboxedmap)
boxed class to store validated Map payloads | +| static class | [ObjectWithCollidingProperties.SomeProp](#someprop)
schema class | + +## ObjectWithCollidingProperties1Boxed +public sealed interface ObjectWithCollidingProperties1Boxed
+permits
+[ObjectWithCollidingProperties1BoxedMap](#objectwithcollidingproperties1boxedmap) + +sealed interface that stores validated payloads using boxed classes + +## ObjectWithCollidingProperties1BoxedMap +public record ObjectWithCollidingProperties1BoxedMap
+implements [ObjectWithCollidingProperties1Boxed](#objectwithcollidingproperties1boxed) + +record that stores validated Map payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| ObjectWithCollidingProperties1BoxedMap([ObjectWithCollidingPropertiesMap](#objectwithcollidingpropertiesmap) data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| [ObjectWithCollidingPropertiesMap](#objectwithcollidingpropertiesmap) | data()
validated payload | +| @Nullable Object | getData()
validated payload | + +## ObjectWithCollidingProperties1 +public static class ObjectWithCollidingProperties1
+extends JsonSchema + +A schema class that validates payloads + +## Description +component with properties that have name collisions + +### Code Sample +``` +import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags; +import org.openapijsonschematools.client.configurations.SchemaConfiguration; +import org.openapijsonschematools.client.exceptions.ValidationException; +import org.openapijsonschematools.client.schemas.validation.MapUtils; +import org.openapijsonschematools.client.schemas.validation.FrozenList; +import org.openapijsonschematools.client.schemas.validation.FrozenMap; +import org.openapijsonschematools.client.components.schemas.ObjectWithCollidingProperties; + +import java.util.Arrays; +import java.util.List; +import java.util.AbstractMap; + +static final SchemaConfiguration configuration = new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().build()); + +// Map validation +ObjectWithCollidingProperties.ObjectWithCollidingPropertiesMap validatedPayload = + ObjectWithCollidingProperties.ObjectWithCollidingProperties1.validate( + new ObjectWithCollidingProperties.ObjectWithCollidingPropertiesMapBuilder() + .build(), + configuration +); +``` + +### Field Summary +| Modifier and Type | Field and Description | +| ----------------- | ---------------------- | +| Set> | type = Set.of(Map.class) | +| Map> | properties = Map.ofEntries(
    new PropertyEntry("someProp", [SomeProp.class](#someprop))),
    new PropertyEntry("someprop", [Someprop.class](#someprop)))
)
| + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| [ObjectWithCollidingPropertiesMap](#objectwithcollidingpropertiesmap) | validate([Map<?, ?>](#objectwithcollidingpropertiesmapbuilder) arg, SchemaConfiguration configuration) | +| [ObjectWithCollidingProperties1BoxedMap](#objectwithcollidingproperties1boxedmap) | validateAndBox([Map<?, ?>](#objectwithcollidingpropertiesmapbuilder) arg, SchemaConfiguration configuration) | +| [ObjectWithCollidingProperties1Boxed](#objectwithcollidingproperties1boxed) | validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) | +| @Nullable Object | validate(@Nullable Object arg, SchemaConfiguration configuration) | + +## ObjectWithCollidingPropertiesMapBuilder +public class ObjectWithCollidingPropertiesMapBuilder
+builder for `Map` + +A class that builds the Map input type + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| ObjectWithCollidingPropertiesMapBuilder()
Creates a builder that contains an empty map | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| Map | build()
Returns map input that should be used with Schema.validate | +| [ObjectWithCollidingPropertiesMapBuilder](#objectwithcollidingpropertiesmapbuilder) | someProp(Map value) | +| [ObjectWithCollidingPropertiesMapBuilder](#objectwithcollidingpropertiesmapbuilder) | someprop(Map value) | +| [ObjectWithCollidingPropertiesMapBuilder](#objectwithcollidingpropertiesmapbuilder) | additionalProperty(String key, Nothing? value) | +| [ObjectWithCollidingPropertiesMapBuilder](#objectwithcollidingpropertiesmapbuilder) | additionalProperty(String key, boolean value) | +| [ObjectWithCollidingPropertiesMapBuilder](#objectwithcollidingpropertiesmapbuilder) | additionalProperty(String key, String value) | +| [ObjectWithCollidingPropertiesMapBuilder](#objectwithcollidingpropertiesmapbuilder) | additionalProperty(String key, int value) | +| [ObjectWithCollidingPropertiesMapBuilder](#objectwithcollidingpropertiesmapbuilder) | additionalProperty(String key, float value) | +| [ObjectWithCollidingPropertiesMapBuilder](#objectwithcollidingpropertiesmapbuilder) | additionalProperty(String key, long value) | +| [ObjectWithCollidingPropertiesMapBuilder](#objectwithcollidingpropertiesmapbuilder) | additionalProperty(String key, double value) | +| [ObjectWithCollidingPropertiesMapBuilder](#objectwithcollidingpropertiesmapbuilder) | additionalProperty(String key, List value) | +| [ObjectWithCollidingPropertiesMapBuilder](#objectwithcollidingpropertiesmapbuilder) | additionalProperty(String key, Map value) | + +## ObjectWithCollidingPropertiesMap +public static class ObjectWithCollidingPropertiesMap
+extends FrozenMap + +A class to store validated Map payloads + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| static [ObjectWithCollidingPropertiesMap](#objectwithcollidingpropertiesmap) | of([Map](#objectwithcollidingpropertiesmapbuilder) arg, SchemaConfiguration configuration) | +| FrozenMap | someProp()
[optional] | +| FrozenMap | someprop()
[optional] | +| @Nullable Object | getAdditionalProperty(String name)
provides type safety for additional properties | + +## SomepropBoxed +public sealed interface SomepropBoxed
+permits
+[SomepropBoxedMap](#somepropboxedmap) + +sealed interface that stores validated payloads using boxed classes + +## SomepropBoxedMap +public record SomepropBoxedMap
+implements [SomepropBoxed](#somepropboxed) + +record that stores validated Map payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| SomepropBoxedMap(FrozenMap<@Nullable Object> data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| FrozenMap<@Nullable Object> | data()
validated payload | +| @Nullable Object | getData()
validated payload | + +## Someprop +public static class Someprop
+extends MapJsonSchema.MapJsonSchema1 + +A schema class that validates payloads + +| Methods Inherited from class org.openapijsonschematools.client.schemas.MapJsonSchema.MapJsonSchema1 | +| ------------------------------------------------------------------ | +| validate | +| validateAndBox | + +## SomePropBoxed +public sealed interface SomePropBoxed
+permits
+[SomePropBoxedMap](#somepropboxedmap) + +sealed interface that stores validated payloads using boxed classes + +## SomePropBoxedMap +public record SomePropBoxedMap
+implements [SomePropBoxed](#somepropboxed) + +record that stores validated Map payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| SomePropBoxedMap(FrozenMap<@Nullable Object> data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| FrozenMap<@Nullable Object> | data()
validated payload | +| @Nullable Object | getData()
validated payload | + +## SomeProp +public static class SomeProp
+extends MapJsonSchema.MapJsonSchema1 + +A schema class that validates payloads + +| Methods Inherited from class org.openapijsonschematools.client.schemas.MapJsonSchema.MapJsonSchema1 | +| ------------------------------------------------------------------ | +| validate | +| validateAndBox | + +[[Back to top]](#top) [[Back to Component Schemas]](../../../README.md#Component-Schemas) [[Back to README]](../../../README.md) diff --git a/samples/client/petstore/kotlin/docs/components/schemas/ObjectWithDecimalProperties.md b/samples/client/petstore/kotlin/docs/components/schemas/ObjectWithDecimalProperties.md new file mode 100644 index 00000000000..cbde4daec87 --- /dev/null +++ b/samples/client/petstore/kotlin/docs/components/schemas/ObjectWithDecimalProperties.md @@ -0,0 +1,187 @@ +# ObjectWithDecimalProperties +org.openapijsonschematools.client.components.schemas.ObjectWithDecimalProperties.java +public class ObjectWithDecimalProperties
+ +A class that contains necessary nested +- schema classes (which validate payloads), extends JsonSchema +- sealed interfaces which store validated payloads, java version of a sum type +- boxed classes which store validated payloads, sealed permits class implementations +- classes to store validated map payloads, extends FrozenMap +- classes to build inputs for map payloads + +## Nested Class Summary +| Modifier and Type | Class and Description | +| ----------------- | ---------------------- | +| sealed interface | [ObjectWithDecimalProperties.ObjectWithDecimalProperties1Boxed](#objectwithdecimalproperties1boxed)
sealed interface for validated payloads | +| record | [ObjectWithDecimalProperties.ObjectWithDecimalProperties1BoxedMap](#objectwithdecimalproperties1boxedmap)
boxed class to store validated Map payloads | +| static class | [ObjectWithDecimalProperties.ObjectWithDecimalProperties1](#objectwithdecimalproperties1)
schema class | +| static class | [ObjectWithDecimalProperties.ObjectWithDecimalPropertiesMapBuilder](#objectwithdecimalpropertiesmapbuilder)
builder for Map payloads | +| static class | [ObjectWithDecimalProperties.ObjectWithDecimalPropertiesMap](#objectwithdecimalpropertiesmap)
output class for Map payloads | +| sealed interface | [ObjectWithDecimalProperties.WidthBoxed](#widthboxed)
sealed interface for validated payloads | +| record | [ObjectWithDecimalProperties.WidthBoxedString](#widthboxedstring)
boxed class to store validated String payloads | +| static class | [ObjectWithDecimalProperties.Width](#width)
schema class | + +## ObjectWithDecimalProperties1Boxed +public sealed interface ObjectWithDecimalProperties1Boxed
+permits
+[ObjectWithDecimalProperties1BoxedMap](#objectwithdecimalproperties1boxedmap) + +sealed interface that stores validated payloads using boxed classes + +## ObjectWithDecimalProperties1BoxedMap +public record ObjectWithDecimalProperties1BoxedMap
+implements [ObjectWithDecimalProperties1Boxed](#objectwithdecimalproperties1boxed) + +record that stores validated Map payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| ObjectWithDecimalProperties1BoxedMap([ObjectWithDecimalPropertiesMap](#objectwithdecimalpropertiesmap) data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| [ObjectWithDecimalPropertiesMap](#objectwithdecimalpropertiesmap) | data()
validated payload | +| @Nullable Object | getData()
validated payload | + +## ObjectWithDecimalProperties1 +public static class ObjectWithDecimalProperties1
+extends JsonSchema + +A schema class that validates payloads + +### Code Sample +``` +import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags; +import org.openapijsonschematools.client.configurations.SchemaConfiguration; +import org.openapijsonschematools.client.exceptions.ValidationException; +import org.openapijsonschematools.client.schemas.validation.MapUtils; +import org.openapijsonschematools.client.schemas.validation.FrozenList; +import org.openapijsonschematools.client.schemas.validation.FrozenMap; +import org.openapijsonschematools.client.components.schemas.ObjectWithDecimalProperties; + +import java.util.Arrays; +import java.util.List; +import java.util.AbstractMap; + +static final SchemaConfiguration configuration = new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().build()); + +// Map validation +ObjectWithDecimalProperties.ObjectWithDecimalPropertiesMap validatedPayload = + ObjectWithDecimalProperties.ObjectWithDecimalProperties1.validate( + new ObjectWithDecimalProperties.ObjectWithDecimalPropertiesMapBuilder() + .length("3.14") + + .width("3.14") + + .cost( + MapUtils.makeMap( + new AbstractMap.SimpleEntry( + "amount", + "3.14" + ), + new AbstractMap.SimpleEntry( + "currency", + "eur" + ) + ) + ) + .build(), + configuration +); +``` + +### Field Summary +| Modifier and Type | Field and Description | +| ----------------- | ---------------------- | +| Set> | type = Set.of(Map.class) | +| Map> | properties = Map.ofEntries(
    new PropertyEntry("length", [DecimalPayload.DecimalPayload1.class](../../components/schemas/DecimalPayload.md#decimalpayload1)),
    new PropertyEntry("width", [Width.class](#width))),
    new PropertyEntry("cost", [Money.Money1.class](../../components/schemas/Money.md#money1))
)
| + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| [ObjectWithDecimalPropertiesMap](#objectwithdecimalpropertiesmap) | validate([Map<?, ?>](#objectwithdecimalpropertiesmapbuilder) arg, SchemaConfiguration configuration) | +| [ObjectWithDecimalProperties1BoxedMap](#objectwithdecimalproperties1boxedmap) | validateAndBox([Map<?, ?>](#objectwithdecimalpropertiesmapbuilder) arg, SchemaConfiguration configuration) | +| [ObjectWithDecimalProperties1Boxed](#objectwithdecimalproperties1boxed) | validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) | +| @Nullable Object | validate(@Nullable Object arg, SchemaConfiguration configuration) | + +## ObjectWithDecimalPropertiesMapBuilder +public class ObjectWithDecimalPropertiesMapBuilder
+builder for `Map` + +A class that builds the Map input type + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| ObjectWithDecimalPropertiesMapBuilder()
Creates a builder that contains an empty map | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| Map | build()
Returns map input that should be used with Schema.validate | +| [ObjectWithDecimalPropertiesMapBuilder](#objectwithdecimalpropertiesmapbuilder) | length(String value) | +| [ObjectWithDecimalPropertiesMapBuilder](#objectwithdecimalpropertiesmapbuilder) | width(String value) | +| [ObjectWithDecimalPropertiesMapBuilder](#objectwithdecimalpropertiesmapbuilder) | cost(Map value) | +| [ObjectWithDecimalPropertiesMapBuilder](#objectwithdecimalpropertiesmapbuilder) | additionalProperty(String key, Nothing? value) | +| [ObjectWithDecimalPropertiesMapBuilder](#objectwithdecimalpropertiesmapbuilder) | additionalProperty(String key, boolean value) | +| [ObjectWithDecimalPropertiesMapBuilder](#objectwithdecimalpropertiesmapbuilder) | additionalProperty(String key, String value) | +| [ObjectWithDecimalPropertiesMapBuilder](#objectwithdecimalpropertiesmapbuilder) | additionalProperty(String key, int value) | +| [ObjectWithDecimalPropertiesMapBuilder](#objectwithdecimalpropertiesmapbuilder) | additionalProperty(String key, float value) | +| [ObjectWithDecimalPropertiesMapBuilder](#objectwithdecimalpropertiesmapbuilder) | additionalProperty(String key, long value) | +| [ObjectWithDecimalPropertiesMapBuilder](#objectwithdecimalpropertiesmapbuilder) | additionalProperty(String key, double value) | +| [ObjectWithDecimalPropertiesMapBuilder](#objectwithdecimalpropertiesmapbuilder) | additionalProperty(String key, List value) | +| [ObjectWithDecimalPropertiesMapBuilder](#objectwithdecimalpropertiesmapbuilder) | additionalProperty(String key, Map value) | + +## ObjectWithDecimalPropertiesMap +public static class ObjectWithDecimalPropertiesMap
+extends FrozenMap + +A class to store validated Map payloads + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| static [ObjectWithDecimalPropertiesMap](#objectwithdecimalpropertiesmap) | of([Map](#objectwithdecimalpropertiesmapbuilder) arg, SchemaConfiguration configuration) | +| String | length()
[optional] | +| String | width()
[optional] value must be int or float numeric | +| [Money.MoneyMap](../../components/schemas/Money.md#moneymap) | cost()
[optional] | +| @Nullable Object | getAdditionalProperty(String name)
provides type safety for additional properties | + +## WidthBoxed +public sealed interface WidthBoxed
+permits
+[WidthBoxedString](#widthboxedstring) + +sealed interface that stores validated payloads using boxed classes + +## WidthBoxedString +public record WidthBoxedString
+implements [WidthBoxed](#widthboxed) + +record that stores validated String payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| WidthBoxedString(String data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| String | data()
validated payload | +| @Nullable Object | getData()
validated payload | + +## Width +public static class Width
+extends DecimalJsonSchema.DecimalJsonSchema1 + +A schema class that validates payloads + +| Methods Inherited from class org.openapijsonschematools.client.schemas.DecimalJsonSchema.DecimalJsonSchema1 | +| ------------------------------------------------------------------ | +| validate | +| validateAndBox | + +[[Back to top]](#top) [[Back to Component Schemas]](../../../README.md#Component-Schemas) [[Back to README]](../../../README.md) diff --git a/samples/client/petstore/kotlin/docs/components/schemas/ObjectWithDifficultlyNamedProps.md b/samples/client/petstore/kotlin/docs/components/schemas/ObjectWithDifficultlyNamedProps.md new file mode 100644 index 00000000000..91e847076f7 --- /dev/null +++ b/samples/client/petstore/kotlin/docs/components/schemas/ObjectWithDifficultlyNamedProps.md @@ -0,0 +1,276 @@ +# ObjectWithDifficultlyNamedProps +org.openapijsonschematools.client.components.schemas.ObjectWithDifficultlyNamedProps.java +public class ObjectWithDifficultlyNamedProps
+ +A class that contains necessary nested +- schema classes (which validate payloads), extends JsonSchema +- sealed interfaces which store validated payloads, java version of a sum type +- boxed classes which store validated payloads, sealed permits class implementations +- classes to store validated map payloads, extends FrozenMap +- classes to build inputs for map payloads + +## Nested Class Summary +| Modifier and Type | Class and Description | +| ----------------- | ---------------------- | +| sealed interface | [ObjectWithDifficultlyNamedProps.ObjectWithDifficultlyNamedProps1Boxed](#objectwithdifficultlynamedprops1boxed)
sealed interface for validated payloads | +| record | [ObjectWithDifficultlyNamedProps.ObjectWithDifficultlyNamedProps1BoxedMap](#objectwithdifficultlynamedprops1boxedmap)
boxed class to store validated Map payloads | +| static class | [ObjectWithDifficultlyNamedProps.ObjectWithDifficultlyNamedProps1](#objectwithdifficultlynamedprops1)
schema class | +| static class | [ObjectWithDifficultlyNamedProps.ObjectWithDifficultlyNamedPropsMapBuilder](#objectwithdifficultlynamedpropsmapbuilder)
builder for Map payloads | +| static class | [ObjectWithDifficultlyNamedProps.ObjectWithDifficultlyNamedPropsMap](#objectwithdifficultlynamedpropsmap)
output class for Map payloads | +| sealed interface | [ObjectWithDifficultlyNamedProps.Schema123NumberBoxed](#schema123numberboxed)
sealed interface for validated payloads | +| record | [ObjectWithDifficultlyNamedProps.Schema123NumberBoxedNumber](#schema123numberboxednumber)
boxed class to store validated Number payloads | +| static class | [ObjectWithDifficultlyNamedProps.Schema123Number](#schema123number)
schema class | +| sealed interface | [ObjectWithDifficultlyNamedProps.Schema123listBoxed](#schema123listboxed)
sealed interface for validated payloads | +| record | [ObjectWithDifficultlyNamedProps.Schema123listBoxedString](#schema123listboxedstring)
boxed class to store validated String payloads | +| static class | [ObjectWithDifficultlyNamedProps.Schema123list](#schema123list)
schema class | +| sealed interface | [ObjectWithDifficultlyNamedProps.SpecialpropertynameBoxed](#specialpropertynameboxed)
sealed interface for validated payloads | +| record | [ObjectWithDifficultlyNamedProps.SpecialpropertynameBoxedNumber](#specialpropertynameboxednumber)
boxed class to store validated Number payloads | +| static class | [ObjectWithDifficultlyNamedProps.Specialpropertyname](#specialpropertyname)
schema class | + +## ObjectWithDifficultlyNamedProps1Boxed +public sealed interface ObjectWithDifficultlyNamedProps1Boxed
+permits
+[ObjectWithDifficultlyNamedProps1BoxedMap](#objectwithdifficultlynamedprops1boxedmap) + +sealed interface that stores validated payloads using boxed classes + +## ObjectWithDifficultlyNamedProps1BoxedMap +public record ObjectWithDifficultlyNamedProps1BoxedMap
+implements [ObjectWithDifficultlyNamedProps1Boxed](#objectwithdifficultlynamedprops1boxed) + +record that stores validated Map payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| ObjectWithDifficultlyNamedProps1BoxedMap([ObjectWithDifficultlyNamedPropsMap](#objectwithdifficultlynamedpropsmap) data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| [ObjectWithDifficultlyNamedPropsMap](#objectwithdifficultlynamedpropsmap) | data()
validated payload | +| @Nullable Object | getData()
validated payload | + +## ObjectWithDifficultlyNamedProps1 +public static class ObjectWithDifficultlyNamedProps1
+extends JsonSchema + +A schema class that validates payloads + +## Description +model with properties that have invalid names for python + +### Code Sample +``` +import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags; +import org.openapijsonschematools.client.configurations.SchemaConfiguration; +import org.openapijsonschematools.client.exceptions.ValidationException; +import org.openapijsonschematools.client.schemas.validation.MapUtils; +import org.openapijsonschematools.client.schemas.validation.FrozenList; +import org.openapijsonschematools.client.schemas.validation.FrozenMap; +import org.openapijsonschematools.client.components.schemas.ObjectWithDifficultlyNamedProps; + +import java.util.Arrays; +import java.util.List; +import java.util.AbstractMap; + +static final SchemaConfiguration configuration = new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().build()); + +// Map validation +ObjectWithDifficultlyNamedProps.ObjectWithDifficultlyNamedPropsMap validatedPayload = + ObjectWithDifficultlyNamedProps.ObjectWithDifficultlyNamedProps1.validate( + new ObjectWithDifficultlyNamedProps.ObjectWithDifficultlyNamedPropsMapBuilder() + .digitOne23HyphenMinusList("a") + + .dollarSignSpecialLeftSquareBracketPropertyFullStopNameRightSquareBracket(1L) + + .digitOne23number(1) + + .build(), + configuration +); +``` + +### Field Summary +| Modifier and Type | Field and Description | +| ----------------- | ---------------------- | +| Set> | type = Set.of(Map.class) | +| Map> | properties = Map.ofEntries(
    new PropertyEntry("$special[property.name]", [Specialpropertyname.class](#specialpropertyname))),
    new PropertyEntry("123-list", [Schema123list.class](#schema123list))),
    new PropertyEntry("123Number", [Schema123Number.class](#schema123number)))
)
| +| Set | required = Set.of(
    "123-list"
)
| + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| [ObjectWithDifficultlyNamedPropsMap](#objectwithdifficultlynamedpropsmap) | validate([Map<?, ?>](#objectwithdifficultlynamedpropsmapbuilder) arg, SchemaConfiguration configuration) | +| [ObjectWithDifficultlyNamedProps1BoxedMap](#objectwithdifficultlynamedprops1boxedmap) | validateAndBox([Map<?, ?>](#objectwithdifficultlynamedpropsmapbuilder) arg, SchemaConfiguration configuration) | +| [ObjectWithDifficultlyNamedProps1Boxed](#objectwithdifficultlynamedprops1boxed) | validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) | +| @Nullable Object | validate(@Nullable Object arg, SchemaConfiguration configuration) | + +## ObjectWithDifficultlyNamedPropsMap0Builder +public class ObjectWithDifficultlyNamedPropsMap0Builder
+builder for `Map` + +A class that builds the Map input type + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| ObjectWithDifficultlyNamedPropsMap0Builder(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 | +| [ObjectWithDifficultlyNamedPropsMap0Builder](#objectwithdifficultlynamedpropsmap0builder) | dollarSignSpecialLeftSquareBracketPropertyFullStopNameRightSquareBracket(int value) | +| [ObjectWithDifficultlyNamedPropsMap0Builder](#objectwithdifficultlynamedpropsmap0builder) | dollarSignSpecialLeftSquareBracketPropertyFullStopNameRightSquareBracket(float value) | +| [ObjectWithDifficultlyNamedPropsMap0Builder](#objectwithdifficultlynamedpropsmap0builder) | dollarSignSpecialLeftSquareBracketPropertyFullStopNameRightSquareBracket(long value) | +| [ObjectWithDifficultlyNamedPropsMap0Builder](#objectwithdifficultlynamedpropsmap0builder) | dollarSignSpecialLeftSquareBracketPropertyFullStopNameRightSquareBracket(double value) | +| [ObjectWithDifficultlyNamedPropsMap0Builder](#objectwithdifficultlynamedpropsmap0builder) | digitOne23number(int value) | +| [ObjectWithDifficultlyNamedPropsMap0Builder](#objectwithdifficultlynamedpropsmap0builder) | digitOne23number(float value) | +| [ObjectWithDifficultlyNamedPropsMap0Builder](#objectwithdifficultlynamedpropsmap0builder) | digitOne23number(long value) | +| [ObjectWithDifficultlyNamedPropsMap0Builder](#objectwithdifficultlynamedpropsmap0builder) | digitOne23number(double value) | +| [ObjectWithDifficultlyNamedPropsMap0Builder](#objectwithdifficultlynamedpropsmap0builder) | additionalProperty(String key, Nothing? value) | +| [ObjectWithDifficultlyNamedPropsMap0Builder](#objectwithdifficultlynamedpropsmap0builder) | additionalProperty(String key, boolean value) | +| [ObjectWithDifficultlyNamedPropsMap0Builder](#objectwithdifficultlynamedpropsmap0builder) | additionalProperty(String key, String value) | +| [ObjectWithDifficultlyNamedPropsMap0Builder](#objectwithdifficultlynamedpropsmap0builder) | additionalProperty(String key, int value) | +| [ObjectWithDifficultlyNamedPropsMap0Builder](#objectwithdifficultlynamedpropsmap0builder) | additionalProperty(String key, float value) | +| [ObjectWithDifficultlyNamedPropsMap0Builder](#objectwithdifficultlynamedpropsmap0builder) | additionalProperty(String key, long value) | +| [ObjectWithDifficultlyNamedPropsMap0Builder](#objectwithdifficultlynamedpropsmap0builder) | additionalProperty(String key, double value) | +| [ObjectWithDifficultlyNamedPropsMap0Builder](#objectwithdifficultlynamedpropsmap0builder) | additionalProperty(String key, List value) | +| [ObjectWithDifficultlyNamedPropsMap0Builder](#objectwithdifficultlynamedpropsmap0builder) | additionalProperty(String key, Map value) | + +## ObjectWithDifficultlyNamedPropsMapBuilder +public class ObjectWithDifficultlyNamedPropsMapBuilder
+builder for `Map` + +A class that builds the Map input type + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| ObjectWithDifficultlyNamedPropsMapBuilder()
Creates a builder that contains an empty map | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| [ObjectWithDifficultlyNamedPropsMap0Builder](#objectwithdifficultlynamedpropsmap0builder) | digitOne23HyphenMinusList(String value) | + +## ObjectWithDifficultlyNamedPropsMap +public static class ObjectWithDifficultlyNamedPropsMap
+extends FrozenMap + +A class to store validated Map payloads + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| static [ObjectWithDifficultlyNamedPropsMap](#objectwithdifficultlynamedpropsmap) | of([Map](#objectwithdifficultlynamedpropsmapbuilder) arg, SchemaConfiguration configuration) | +| @Nullable Object | get(String key)
This schema has invalid Java names so this method must be used when you access instance["123-list"], instance["$special[property.name]"], instance["123Number"], | +| @Nullable Object | getAdditionalProperty(String name)
provides type safety for additional properties | + +## Schema123NumberBoxed +public sealed interface Schema123NumberBoxed
+permits
+[Schema123NumberBoxedNumber](#schema123numberboxednumber) + +sealed interface that stores validated payloads using boxed classes + +## Schema123NumberBoxedNumber +public record Schema123NumberBoxedNumber
+implements [Schema123NumberBoxed](#schema123numberboxed) + +record that stores validated Number payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| Schema123NumberBoxedNumber(Number data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| Number | data()
validated payload | +| @Nullable Object | getData()
validated payload | + +## Schema123Number +public static class Schema123Number
+extends IntJsonSchema.IntJsonSchema1 + +A schema class that validates payloads + +| Methods Inherited from class org.openapijsonschematools.client.schemas.IntJsonSchema.IntJsonSchema1 | +| ------------------------------------------------------------------ | +| validate | +| validateAndBox | + +## Schema123listBoxed +public sealed interface Schema123listBoxed
+permits
+[Schema123listBoxedString](#schema123listboxedstring) + +sealed interface that stores validated payloads using boxed classes + +## Schema123listBoxedString +public record Schema123listBoxedString
+implements [Schema123listBoxed](#schema123listboxed) + +record that stores validated String payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| Schema123listBoxedString(String data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| String | data()
validated payload | +| @Nullable Object | getData()
validated payload | + +## Schema123list +public static class Schema123list
+extends StringJsonSchema.StringJsonSchema1 + +A schema class that validates payloads + +| Methods Inherited from class org.openapijsonschematools.client.schemas.StringJsonSchema.StringJsonSchema1 | +| ------------------------------------------------------------------ | +| validate | +| validateAndBox | + +## SpecialpropertynameBoxed +public sealed interface SpecialpropertynameBoxed
+permits
+[SpecialpropertynameBoxedNumber](#specialpropertynameboxednumber) + +sealed interface that stores validated payloads using boxed classes + +## SpecialpropertynameBoxedNumber +public record SpecialpropertynameBoxedNumber
+implements [SpecialpropertynameBoxed](#specialpropertynameboxed) + +record that stores validated Number payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| SpecialpropertynameBoxedNumber(Number data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| Number | data()
validated payload | +| @Nullable Object | getData()
validated payload | + +## Specialpropertyname +public static class Specialpropertyname
+extends Int64JsonSchema.Int64JsonSchema1 + +A schema class that validates payloads + +| Methods Inherited from class org.openapijsonschematools.client.schemas.Int64JsonSchema.Int64JsonSchema1 | +| ------------------------------------------------------------------ | +| validate | +| validateAndBox | + +[[Back to top]](#top) [[Back to Component Schemas]](../../../README.md#Component-Schemas) [[Back to README]](../../../README.md) diff --git a/samples/client/petstore/kotlin/docs/components/schemas/ObjectWithInlineCompositionProperty.md b/samples/client/petstore/kotlin/docs/components/schemas/ObjectWithInlineCompositionProperty.md new file mode 100644 index 00000000000..1cc319ecbf9 --- /dev/null +++ b/samples/client/petstore/kotlin/docs/components/schemas/ObjectWithInlineCompositionProperty.md @@ -0,0 +1,362 @@ +# ObjectWithInlineCompositionProperty +org.openapijsonschematools.client.components.schemas.ObjectWithInlineCompositionProperty.java +public class ObjectWithInlineCompositionProperty
+ +A class that contains necessary nested +- schema classes (which validate payloads), extends JsonSchema +- sealed interfaces which store validated payloads, java version of a sum type +- boxed classes which store validated payloads, sealed permits class implementations +- classes to store validated map payloads, extends FrozenMap +- classes to build inputs for map payloads + +## Nested Class Summary +| Modifier and Type | Class and Description | +| ----------------- | ---------------------- | +| sealed interface | [ObjectWithInlineCompositionProperty.ObjectWithInlineCompositionProperty1Boxed](#objectwithinlinecompositionproperty1boxed)
sealed interface for validated payloads | +| record | [ObjectWithInlineCompositionProperty.ObjectWithInlineCompositionProperty1BoxedMap](#objectwithinlinecompositionproperty1boxedmap)
boxed class to store validated Map payloads | +| static class | [ObjectWithInlineCompositionProperty.ObjectWithInlineCompositionProperty1](#objectwithinlinecompositionproperty1)
schema class | +| static class | [ObjectWithInlineCompositionProperty.ObjectWithInlineCompositionPropertyMapBuilder](#objectwithinlinecompositionpropertymapbuilder)
builder for Map payloads | +| static class | [ObjectWithInlineCompositionProperty.ObjectWithInlineCompositionPropertyMap](#objectwithinlinecompositionpropertymap)
output class for Map payloads | +| sealed interface | [ObjectWithInlineCompositionProperty.SomePropBoxed](#somepropboxed)
sealed interface for validated payloads | +| record | [ObjectWithInlineCompositionProperty.SomePropBoxedVoid](#somepropboxedvoid)
boxed class to store validated null payloads | +| record | [ObjectWithInlineCompositionProperty.SomePropBoxedBoolean](#somepropboxedboolean)
boxed class to store validated boolean payloads | +| record | [ObjectWithInlineCompositionProperty.SomePropBoxedNumber](#somepropboxednumber)
boxed class to store validated Number payloads | +| record | [ObjectWithInlineCompositionProperty.SomePropBoxedString](#somepropboxedstring)
boxed class to store validated String payloads | +| record | [ObjectWithInlineCompositionProperty.SomePropBoxedList](#somepropboxedlist)
boxed class to store validated List payloads | +| record | [ObjectWithInlineCompositionProperty.SomePropBoxedMap](#somepropboxedmap)
boxed class to store validated Map payloads | +| static class | [ObjectWithInlineCompositionProperty.SomeProp](#someprop)
schema class | +| sealed interface | [ObjectWithInlineCompositionProperty.Schema0Boxed](#schema0boxed)
sealed interface for validated payloads | +| record | [ObjectWithInlineCompositionProperty.Schema0BoxedString](#schema0boxedstring)
boxed class to store validated String payloads | +| static class | [ObjectWithInlineCompositionProperty.Schema0](#schema0)
schema class | + +## ObjectWithInlineCompositionProperty1Boxed +public sealed interface ObjectWithInlineCompositionProperty1Boxed
+permits
+[ObjectWithInlineCompositionProperty1BoxedMap](#objectwithinlinecompositionproperty1boxedmap) + +sealed interface that stores validated payloads using boxed classes + +## ObjectWithInlineCompositionProperty1BoxedMap +public record ObjectWithInlineCompositionProperty1BoxedMap
+implements [ObjectWithInlineCompositionProperty1Boxed](#objectwithinlinecompositionproperty1boxed) + +record that stores validated Map payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| ObjectWithInlineCompositionProperty1BoxedMap([ObjectWithInlineCompositionPropertyMap](#objectwithinlinecompositionpropertymap) data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| [ObjectWithInlineCompositionPropertyMap](#objectwithinlinecompositionpropertymap) | data()
validated payload | +| @Nullable Object | getData()
validated payload | + +## ObjectWithInlineCompositionProperty1 +public static class ObjectWithInlineCompositionProperty1
+extends JsonSchema + +A schema class that validates payloads + +### Code Sample +``` +import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags; +import org.openapijsonschematools.client.configurations.SchemaConfiguration; +import org.openapijsonschematools.client.exceptions.ValidationException; +import org.openapijsonschematools.client.schemas.validation.MapUtils; +import org.openapijsonschematools.client.schemas.validation.FrozenList; +import org.openapijsonschematools.client.schemas.validation.FrozenMap; +import org.openapijsonschematools.client.components.schemas.ObjectWithInlineCompositionProperty; + +import java.util.Arrays; +import java.util.List; +import java.util.AbstractMap; + +static final SchemaConfiguration configuration = new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().build()); + +// Map validation +ObjectWithInlineCompositionProperty.ObjectWithInlineCompositionPropertyMap validatedPayload = + ObjectWithInlineCompositionProperty.ObjectWithInlineCompositionProperty1.validate( + new ObjectWithInlineCompositionProperty.ObjectWithInlineCompositionPropertyMapBuilder() + .build(), + configuration +); +``` + +### Field Summary +| Modifier and Type | Field and Description | +| ----------------- | ---------------------- | +| Set> | type = Set.of(Map.class) | +| Map> | properties = Map.ofEntries(
    new PropertyEntry("someProp", [SomeProp.class](#someprop)))
)
| + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| [ObjectWithInlineCompositionPropertyMap](#objectwithinlinecompositionpropertymap) | validate([Map<?, ?>](#objectwithinlinecompositionpropertymapbuilder) arg, SchemaConfiguration configuration) | +| [ObjectWithInlineCompositionProperty1BoxedMap](#objectwithinlinecompositionproperty1boxedmap) | validateAndBox([Map<?, ?>](#objectwithinlinecompositionpropertymapbuilder) arg, SchemaConfiguration configuration) | +| [ObjectWithInlineCompositionProperty1Boxed](#objectwithinlinecompositionproperty1boxed) | validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) | +| @Nullable Object | validate(@Nullable Object arg, SchemaConfiguration configuration) | + +## ObjectWithInlineCompositionPropertyMapBuilder +public class ObjectWithInlineCompositionPropertyMapBuilder
+builder for `Map` + +A class that builds the Map input type + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| ObjectWithInlineCompositionPropertyMapBuilder()
Creates a builder that contains an empty map | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| Map | build()
Returns map input that should be used with Schema.validate | +| [ObjectWithInlineCompositionPropertyMapBuilder](#objectwithinlinecompositionpropertymapbuilder) | someProp(Nothing? value) | +| [ObjectWithInlineCompositionPropertyMapBuilder](#objectwithinlinecompositionpropertymapbuilder) | someProp(boolean value) | +| [ObjectWithInlineCompositionPropertyMapBuilder](#objectwithinlinecompositionpropertymapbuilder) | someProp(String value) | +| [ObjectWithInlineCompositionPropertyMapBuilder](#objectwithinlinecompositionpropertymapbuilder) | someProp(int value) | +| [ObjectWithInlineCompositionPropertyMapBuilder](#objectwithinlinecompositionpropertymapbuilder) | someProp(float value) | +| [ObjectWithInlineCompositionPropertyMapBuilder](#objectwithinlinecompositionpropertymapbuilder) | someProp(long value) | +| [ObjectWithInlineCompositionPropertyMapBuilder](#objectwithinlinecompositionpropertymapbuilder) | someProp(double value) | +| [ObjectWithInlineCompositionPropertyMapBuilder](#objectwithinlinecompositionpropertymapbuilder) | someProp(List value) | +| [ObjectWithInlineCompositionPropertyMapBuilder](#objectwithinlinecompositionpropertymapbuilder) | someProp(Map value) | +| [ObjectWithInlineCompositionPropertyMapBuilder](#objectwithinlinecompositionpropertymapbuilder) | additionalProperty(String key, Nothing? value) | +| [ObjectWithInlineCompositionPropertyMapBuilder](#objectwithinlinecompositionpropertymapbuilder) | additionalProperty(String key, boolean value) | +| [ObjectWithInlineCompositionPropertyMapBuilder](#objectwithinlinecompositionpropertymapbuilder) | additionalProperty(String key, String value) | +| [ObjectWithInlineCompositionPropertyMapBuilder](#objectwithinlinecompositionpropertymapbuilder) | additionalProperty(String key, int value) | +| [ObjectWithInlineCompositionPropertyMapBuilder](#objectwithinlinecompositionpropertymapbuilder) | additionalProperty(String key, float value) | +| [ObjectWithInlineCompositionPropertyMapBuilder](#objectwithinlinecompositionpropertymapbuilder) | additionalProperty(String key, long value) | +| [ObjectWithInlineCompositionPropertyMapBuilder](#objectwithinlinecompositionpropertymapbuilder) | additionalProperty(String key, double value) | +| [ObjectWithInlineCompositionPropertyMapBuilder](#objectwithinlinecompositionpropertymapbuilder) | additionalProperty(String key, List value) | +| [ObjectWithInlineCompositionPropertyMapBuilder](#objectwithinlinecompositionpropertymapbuilder) | additionalProperty(String key, Map value) | + +## ObjectWithInlineCompositionPropertyMap +public static class ObjectWithInlineCompositionPropertyMap
+extends FrozenMap + +A class to store validated Map payloads + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| static [ObjectWithInlineCompositionPropertyMap](#objectwithinlinecompositionpropertymap) | of([Map](#objectwithinlinecompositionpropertymapbuilder) arg, SchemaConfiguration configuration) | +| @Nullable Object | someProp()
[optional] | +| @Nullable Object | getAdditionalProperty(String name)
provides type safety for additional properties | + +## SomePropBoxed +public sealed interface SomePropBoxed
+permits
+[SomePropBoxedVoid](#somepropboxedvoid), +[SomePropBoxedBoolean](#somepropboxedboolean), +[SomePropBoxedNumber](#somepropboxednumber), +[SomePropBoxedString](#somepropboxedstring), +[SomePropBoxedList](#somepropboxedlist), +[SomePropBoxedMap](#somepropboxedmap) + +sealed interface that stores validated payloads using boxed classes + +## SomePropBoxedVoid +public record SomePropBoxedVoid
+implements [SomePropBoxed](#somepropboxed) + +record that stores validated null payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| SomePropBoxedVoid(Nothing? data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| Nothing? | data()
validated payload | +| @Nullable Object | getData()
validated payload | + +## SomePropBoxedBoolean +public record SomePropBoxedBoolean
+implements [SomePropBoxed](#somepropboxed) + +record that stores validated boolean payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| SomePropBoxedBoolean(boolean data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| boolean | data()
validated payload | +| @Nullable Object | getData()
validated payload | + +## SomePropBoxedNumber +public record SomePropBoxedNumber
+implements [SomePropBoxed](#somepropboxed) + +record that stores validated Number payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| SomePropBoxedNumber(Number data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| Number | data()
validated payload | +| @Nullable Object | getData()
validated payload | + +## SomePropBoxedString +public record SomePropBoxedString
+implements [SomePropBoxed](#somepropboxed) + +record that stores validated String payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| SomePropBoxedString(String data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| String | data()
validated payload | +| @Nullable Object | getData()
validated payload | + +## SomePropBoxedList +public record SomePropBoxedList
+implements [SomePropBoxed](#somepropboxed) + +record that stores validated List payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| SomePropBoxedList(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 | + +## SomePropBoxedMap +public record SomePropBoxedMap
+implements [SomePropBoxed](#somepropboxed) + +record that stores validated Map payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| SomePropBoxedMap(FrozenMap<@Nullable Object> data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| FrozenMap<@Nullable Object> | data()
validated payload | +| @Nullable Object | getData()
validated payload | + +## SomeProp +public static class SomeProp
+extends JsonSchema + +A schema class that validates payloads + +### Field Summary +| Modifier and Type | Field and Description | +| ----------------- | ---------------------- | +| List> | allOf = List.of(
    [Schema0.class](#schema0)
;)
| + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| String | validate(String arg, SchemaConfiguration configuration) | +| Nothing? | validate(Nothing? arg, SchemaConfiguration configuration) | +| int | validate(int arg, SchemaConfiguration configuration) | +| long | validate(long arg, SchemaConfiguration configuration) | +| float | validate(float arg, SchemaConfiguration configuration) | +| double | validate(double arg, SchemaConfiguration configuration) | +| Number | validate(Number arg, SchemaConfiguration configuration) | +| boolean | validate(boolean arg, SchemaConfiguration configuration) | +| FrozenMap<@Nullable Object> | validate(Map<?, ?> arg, SchemaConfiguration configuration) | +| FrozenList<@Nullable Object> | validate(List arg, SchemaConfiguration configuration) | +| [SomePropBoxedString](#somepropboxedstring) | validateAndBox(String arg, SchemaConfiguration configuration) | +| [SomePropBoxedVoid](#somepropboxedvoid) | validateAndBox(Nothing? arg, SchemaConfiguration configuration) | +| [SomePropBoxedNumber](#somepropboxednumber) | validateAndBox(Number arg, SchemaConfiguration configuration) | +| [SomePropBoxedBoolean](#somepropboxedboolean) | validateAndBox(boolean arg, SchemaConfiguration configuration) | +| [SomePropBoxedMap](#somepropboxedmap) | validateAndBox(Map<?, ?> arg, SchemaConfiguration configuration) | +| [SomePropBoxedList](#somepropboxedlist) | validateAndBox(List arg, SchemaConfiguration configuration) | +| [SomePropBoxed](#somepropboxed) | validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) | +| @Nullable Object | validate(@Nullable Object arg, SchemaConfiguration configuration) | + +## Schema0Boxed +public sealed interface Schema0Boxed
+permits
+[Schema0BoxedString](#schema0boxedstring) + +sealed interface that stores validated payloads using boxed classes + +## Schema0BoxedString +public record Schema0BoxedString
+implements [Schema0Boxed](#schema0boxed) + +record that stores validated String payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| Schema0BoxedString(String data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| String | data()
validated payload | +| @Nullable Object | getData()
validated payload | + +## Schema0 +public static class Schema0
+extends JsonSchema + +A schema class that validates payloads + +### Code Sample +``` +import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags; +import org.openapijsonschematools.client.configurations.SchemaConfiguration; +import org.openapijsonschematools.client.exceptions.ValidationException; +import org.openapijsonschematools.client.schemas.validation.MapUtils; +import org.openapijsonschematools.client.schemas.validation.FrozenList; +import org.openapijsonschematools.client.schemas.validation.FrozenMap; +import org.openapijsonschematools.client.components.schemas.ObjectWithInlineCompositionProperty; + +import java.util.Arrays; +import java.util.List; +import java.util.AbstractMap; + +static final SchemaConfiguration configuration = new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().build()); + +// String validation +String validatedPayload = ObjectWithInlineCompositionProperty.Schema0.validate( + "a", + configuration +); +``` + +### Field Summary +| Modifier and Type | Field and Description | +| ----------------- | ---------------------- | +| Set> | type = Set.of(
    String.class
)
| +| Integer | minLength = 1 | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| String | validate(String arg, SchemaConfiguration configuration) | +| [Schema0BoxedString](#schema0boxedstring) | validateAndBox(String arg, SchemaConfiguration configuration) | +| [Schema0Boxed](#schema0boxed) | validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) | +| @Nullable Object | validate(@Nullable Object arg, SchemaConfiguration configuration) | + +[[Back to top]](#top) [[Back to Component Schemas]](../../../README.md#Component-Schemas) [[Back to README]](../../../README.md) diff --git a/samples/client/petstore/kotlin/docs/components/schemas/ObjectWithInvalidNamedRefedProperties.md b/samples/client/petstore/kotlin/docs/components/schemas/ObjectWithInvalidNamedRefedProperties.md new file mode 100644 index 00000000000..a70ea28ffb1 --- /dev/null +++ b/samples/client/petstore/kotlin/docs/components/schemas/ObjectWithInvalidNamedRefedProperties.md @@ -0,0 +1,196 @@ +# ObjectWithInvalidNamedRefedProperties +org.openapijsonschematools.client.components.schemas.ObjectWithInvalidNamedRefedProperties.java +public class ObjectWithInvalidNamedRefedProperties
+ +A class that contains necessary nested +- schema classes (which validate payloads), extends JsonSchema +- sealed interfaces which store validated payloads, java version of a sum type +- boxed classes which store validated payloads, sealed permits class implementations +- classes to store validated map payloads, extends FrozenMap +- classes to build inputs for map payloads + +## Nested Class Summary +| Modifier and Type | Class and Description | +| ----------------- | ---------------------- | +| sealed interface | [ObjectWithInvalidNamedRefedProperties.ObjectWithInvalidNamedRefedProperties1Boxed](#objectwithinvalidnamedrefedproperties1boxed)
sealed interface for validated payloads | +| record | [ObjectWithInvalidNamedRefedProperties.ObjectWithInvalidNamedRefedProperties1BoxedMap](#objectwithinvalidnamedrefedproperties1boxedmap)
boxed class to store validated Map payloads | +| static class | [ObjectWithInvalidNamedRefedProperties.ObjectWithInvalidNamedRefedProperties1](#objectwithinvalidnamedrefedproperties1)
schema class | +| static class | [ObjectWithInvalidNamedRefedProperties.ObjectWithInvalidNamedRefedPropertiesMapBuilder](#objectwithinvalidnamedrefedpropertiesmapbuilder)
builder for Map payloads | +| static class | [ObjectWithInvalidNamedRefedProperties.ObjectWithInvalidNamedRefedPropertiesMap](#objectwithinvalidnamedrefedpropertiesmap)
output class for Map payloads | + +## ObjectWithInvalidNamedRefedProperties1Boxed +public sealed interface ObjectWithInvalidNamedRefedProperties1Boxed
+permits
+[ObjectWithInvalidNamedRefedProperties1BoxedMap](#objectwithinvalidnamedrefedproperties1boxedmap) + +sealed interface that stores validated payloads using boxed classes + +## ObjectWithInvalidNamedRefedProperties1BoxedMap +public record ObjectWithInvalidNamedRefedProperties1BoxedMap
+implements [ObjectWithInvalidNamedRefedProperties1Boxed](#objectwithinvalidnamedrefedproperties1boxed) + +record that stores validated Map payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| ObjectWithInvalidNamedRefedProperties1BoxedMap([ObjectWithInvalidNamedRefedPropertiesMap](#objectwithinvalidnamedrefedpropertiesmap) data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| [ObjectWithInvalidNamedRefedPropertiesMap](#objectwithinvalidnamedrefedpropertiesmap) | data()
validated payload | +| @Nullable Object | getData()
validated payload | + +## ObjectWithInvalidNamedRefedProperties1 +public static class ObjectWithInvalidNamedRefedProperties1
+extends JsonSchema + +A schema class that validates payloads + +### Code Sample +``` +import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags; +import org.openapijsonschematools.client.configurations.SchemaConfiguration; +import org.openapijsonschematools.client.exceptions.ValidationException; +import org.openapijsonschematools.client.schemas.validation.MapUtils; +import org.openapijsonschematools.client.schemas.validation.FrozenList; +import org.openapijsonschematools.client.schemas.validation.FrozenMap; +import org.openapijsonschematools.client.components.schemas.ObjectWithInvalidNamedRefedProperties; + +import java.util.Arrays; +import java.util.List; +import java.util.AbstractMap; + +static final SchemaConfiguration configuration = new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().build()); + +// Map validation +ObjectWithInvalidNamedRefedProperties.ObjectWithInvalidNamedRefedPropertiesMap validatedPayload = + ObjectWithInvalidNamedRefedProperties.ObjectWithInvalidNamedRefedProperties1.validate( + new ObjectWithInvalidNamedRefedProperties.ObjectWithInvalidNamedRefedPropertiesMapBuilder() + .exclamationMarkReference( + Arrays.asList( + 1L + ) + ) + .from( + MapUtils.makeMap( + new AbstractMap.SimpleEntry( + "data", + "a" + ), + new AbstractMap.SimpleEntry( + "id", + 1 + ) + ) + ) + .build(), + configuration +); +``` + +### Field Summary +| Modifier and Type | Field and Description | +| ----------------- | ---------------------- | +| Set> | type = Set.of(Map.class) | +| Map> | properties = Map.ofEntries(
    new PropertyEntry("from", [FromSchema.FromSchema1.class](../../components/schemas/FromSchema.md#fromschema1)),
    new PropertyEntry("!reference", [ArrayWithValidationsInItems.ArrayWithValidationsInItems1.class](../../components/schemas/ArrayWithValidationsInItems.md#arraywithvalidationsinitems1))
)
| +| Set | required = Set.of(
    "!reference",
    "from"
)
| + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| [ObjectWithInvalidNamedRefedPropertiesMap](#objectwithinvalidnamedrefedpropertiesmap) | validate([Map<?, ?>](#objectwithinvalidnamedrefedpropertiesmapbuilder) arg, SchemaConfiguration configuration) | +| [ObjectWithInvalidNamedRefedProperties1BoxedMap](#objectwithinvalidnamedrefedproperties1boxedmap) | validateAndBox([Map<?, ?>](#objectwithinvalidnamedrefedpropertiesmapbuilder) arg, SchemaConfiguration configuration) | +| [ObjectWithInvalidNamedRefedProperties1Boxed](#objectwithinvalidnamedrefedproperties1boxed) | validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) | +| @Nullable Object | validate(@Nullable Object arg, SchemaConfiguration configuration) | + +## ObjectWithInvalidNamedRefedPropertiesMap00Builder +public class ObjectWithInvalidNamedRefedPropertiesMap00Builder
+builder for `Map` + +A class that builds the Map input type + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| ObjectWithInvalidNamedRefedPropertiesMap00Builder(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 | +| [ObjectWithInvalidNamedRefedPropertiesMap00Builder](#objectwithinvalidnamedrefedpropertiesmap00builder) | additionalProperty(String key, Nothing? value) | +| [ObjectWithInvalidNamedRefedPropertiesMap00Builder](#objectwithinvalidnamedrefedpropertiesmap00builder) | additionalProperty(String key, boolean value) | +| [ObjectWithInvalidNamedRefedPropertiesMap00Builder](#objectwithinvalidnamedrefedpropertiesmap00builder) | additionalProperty(String key, String value) | +| [ObjectWithInvalidNamedRefedPropertiesMap00Builder](#objectwithinvalidnamedrefedpropertiesmap00builder) | additionalProperty(String key, int value) | +| [ObjectWithInvalidNamedRefedPropertiesMap00Builder](#objectwithinvalidnamedrefedpropertiesmap00builder) | additionalProperty(String key, float value) | +| [ObjectWithInvalidNamedRefedPropertiesMap00Builder](#objectwithinvalidnamedrefedpropertiesmap00builder) | additionalProperty(String key, long value) | +| [ObjectWithInvalidNamedRefedPropertiesMap00Builder](#objectwithinvalidnamedrefedpropertiesmap00builder) | additionalProperty(String key, double value) | +| [ObjectWithInvalidNamedRefedPropertiesMap00Builder](#objectwithinvalidnamedrefedpropertiesmap00builder) | additionalProperty(String key, List value) | +| [ObjectWithInvalidNamedRefedPropertiesMap00Builder](#objectwithinvalidnamedrefedpropertiesmap00builder) | additionalProperty(String key, Map value) | + +## ObjectWithInvalidNamedRefedPropertiesMap01Builder +public class ObjectWithInvalidNamedRefedPropertiesMap01Builder
+builder for `Map` + +A class that builds the Map input type + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| ObjectWithInvalidNamedRefedPropertiesMap01Builder(Map instance)
Creates a builder that contains the passed instance | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| [ObjectWithInvalidNamedRefedPropertiesMap00Builder](#objectwithinvalidnamedrefedpropertiesmap00builder) | from(Map value) | + +## ObjectWithInvalidNamedRefedPropertiesMap10Builder +public class ObjectWithInvalidNamedRefedPropertiesMap10Builder
+builder for `Map` + +A class that builds the Map input type + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| ObjectWithInvalidNamedRefedPropertiesMap10Builder(Map instance)
Creates a builder that contains the passed instance | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| [ObjectWithInvalidNamedRefedPropertiesMap00Builder](#objectwithinvalidnamedrefedpropertiesmap00builder) | exclamationMarkReference(List value) | + +## ObjectWithInvalidNamedRefedPropertiesMapBuilder +public class ObjectWithInvalidNamedRefedPropertiesMapBuilder
+builder for `Map` + +A class that builds the Map input type + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| ObjectWithInvalidNamedRefedPropertiesMapBuilder()
Creates a builder that contains an empty map | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| [ObjectWithInvalidNamedRefedPropertiesMap01Builder](#objectwithinvalidnamedrefedpropertiesmap01builder) | exclamationMarkReference(List value) | +| [ObjectWithInvalidNamedRefedPropertiesMap10Builder](#objectwithinvalidnamedrefedpropertiesmap10builder) | from(Map value) | + +## ObjectWithInvalidNamedRefedPropertiesMap +public static class ObjectWithInvalidNamedRefedPropertiesMap
+extends FrozenMap + +A class to store validated Map payloads + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| static [ObjectWithInvalidNamedRefedPropertiesMap](#objectwithinvalidnamedrefedpropertiesmap) | of([Map](#objectwithinvalidnamedrefedpropertiesmapbuilder) arg, SchemaConfiguration configuration) | +| [FromSchema.FromSchemaMap](../../components/schemas/FromSchema.md#fromschemamap) | from()
| +| @Nullable Object | get(String key)
This schema has invalid Java names so this method must be used when you access instance["!reference"], | +| @Nullable Object | getAdditionalProperty(String name)
provides type safety for additional properties | + +[[Back to top]](#top) [[Back to Component Schemas]](../../../README.md#Component-Schemas) [[Back to README]](../../../README.md) diff --git a/samples/client/petstore/kotlin/docs/components/schemas/ObjectWithNonIntersectingValues.md b/samples/client/petstore/kotlin/docs/components/schemas/ObjectWithNonIntersectingValues.md new file mode 100644 index 00000000000..a26f275ad0b --- /dev/null +++ b/samples/client/petstore/kotlin/docs/components/schemas/ObjectWithNonIntersectingValues.md @@ -0,0 +1,205 @@ +# ObjectWithNonIntersectingValues +org.openapijsonschematools.client.components.schemas.ObjectWithNonIntersectingValues.java +public class ObjectWithNonIntersectingValues
+ +A class that contains necessary nested +- schema classes (which validate payloads), extends JsonSchema +- sealed interfaces which store validated payloads, java version of a sum type +- boxed classes which store validated payloads, sealed permits class implementations +- classes to store validated map payloads, extends FrozenMap +- classes to build inputs for map payloads + +## Nested Class Summary +| Modifier and Type | Class and Description | +| ----------------- | ---------------------- | +| sealed interface | [ObjectWithNonIntersectingValues.ObjectWithNonIntersectingValues1Boxed](#objectwithnonintersectingvalues1boxed)
sealed interface for validated payloads | +| record | [ObjectWithNonIntersectingValues.ObjectWithNonIntersectingValues1BoxedMap](#objectwithnonintersectingvalues1boxedmap)
boxed class to store validated Map payloads | +| static class | [ObjectWithNonIntersectingValues.ObjectWithNonIntersectingValues1](#objectwithnonintersectingvalues1)
schema class | +| static class | [ObjectWithNonIntersectingValues.ObjectWithNonIntersectingValuesMapBuilder](#objectwithnonintersectingvaluesmapbuilder)
builder for Map payloads | +| static class | [ObjectWithNonIntersectingValues.ObjectWithNonIntersectingValuesMap](#objectwithnonintersectingvaluesmap)
output class for Map payloads | +| sealed interface | [ObjectWithNonIntersectingValues.ABoxed](#aboxed)
sealed interface for validated payloads | +| record | [ObjectWithNonIntersectingValues.ABoxedNumber](#aboxednumber)
boxed class to store validated Number payloads | +| static class | [ObjectWithNonIntersectingValues.A](#a)
schema class | +| sealed interface | [ObjectWithNonIntersectingValues.AdditionalPropertiesBoxed](#additionalpropertiesboxed)
sealed interface for validated payloads | +| record | [ObjectWithNonIntersectingValues.AdditionalPropertiesBoxedString](#additionalpropertiesboxedstring)
boxed class to store validated String payloads | +| static class | [ObjectWithNonIntersectingValues.AdditionalProperties](#additionalproperties)
schema class | + +## ObjectWithNonIntersectingValues1Boxed +public sealed interface ObjectWithNonIntersectingValues1Boxed
+permits
+[ObjectWithNonIntersectingValues1BoxedMap](#objectwithnonintersectingvalues1boxedmap) + +sealed interface that stores validated payloads using boxed classes + +## ObjectWithNonIntersectingValues1BoxedMap +public record ObjectWithNonIntersectingValues1BoxedMap
+implements [ObjectWithNonIntersectingValues1Boxed](#objectwithnonintersectingvalues1boxed) + +record that stores validated Map payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| ObjectWithNonIntersectingValues1BoxedMap([ObjectWithNonIntersectingValuesMap](#objectwithnonintersectingvaluesmap) data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| [ObjectWithNonIntersectingValuesMap](#objectwithnonintersectingvaluesmap) | data()
validated payload | +| @Nullable Object | getData()
validated payload | + +## ObjectWithNonIntersectingValues1 +public static class ObjectWithNonIntersectingValues1
+extends JsonSchema + +A schema class that validates payloads + +### Code Sample +``` +import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags; +import org.openapijsonschematools.client.configurations.SchemaConfiguration; +import org.openapijsonschematools.client.exceptions.ValidationException; +import org.openapijsonschematools.client.schemas.validation.MapUtils; +import org.openapijsonschematools.client.schemas.validation.FrozenList; +import org.openapijsonschematools.client.schemas.validation.FrozenMap; +import org.openapijsonschematools.client.components.schemas.ObjectWithNonIntersectingValues; + +import java.util.Arrays; +import java.util.List; +import java.util.AbstractMap; + +static final SchemaConfiguration configuration = new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().build()); + +// Map validation +ObjectWithNonIntersectingValues.ObjectWithNonIntersectingValuesMap validatedPayload = + ObjectWithNonIntersectingValues.ObjectWithNonIntersectingValues1.validate( + new ObjectWithNonIntersectingValues.ObjectWithNonIntersectingValuesMapBuilder() + .a(1) + + .additionalProperty("someAdditionalProperty", "a") + + .build(), + configuration +); +``` + +### Field Summary +| Modifier and Type | Field and Description | +| ----------------- | ---------------------- | +| Set> | type = Set.of(Map.class) | +| Map> | properties = Map.ofEntries(
    new PropertyEntry("a", [A.class](#a)))
)
| +| Class | additionalProperties = [AdditionalProperties.class](#additionalproperties) | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| [ObjectWithNonIntersectingValuesMap](#objectwithnonintersectingvaluesmap) | validate([Map<?, ?>](#objectwithnonintersectingvaluesmapbuilder) arg, SchemaConfiguration configuration) | +| [ObjectWithNonIntersectingValues1BoxedMap](#objectwithnonintersectingvalues1boxedmap) | validateAndBox([Map<?, ?>](#objectwithnonintersectingvaluesmapbuilder) arg, SchemaConfiguration configuration) | +| [ObjectWithNonIntersectingValues1Boxed](#objectwithnonintersectingvalues1boxed) | validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) | +| @Nullable Object | validate(@Nullable Object arg, SchemaConfiguration configuration) | + +## ObjectWithNonIntersectingValuesMapBuilder +public class ObjectWithNonIntersectingValuesMapBuilder
+builder for `Map` + +A class that builds the Map input type + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| ObjectWithNonIntersectingValuesMapBuilder()
Creates a builder that contains an empty map | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| Map | build()
Returns map input that should be used with Schema.validate | +| [ObjectWithNonIntersectingValuesMapBuilder](#objectwithnonintersectingvaluesmapbuilder) | a(int value) | +| [ObjectWithNonIntersectingValuesMapBuilder](#objectwithnonintersectingvaluesmapbuilder) | a(float value) | +| [ObjectWithNonIntersectingValuesMapBuilder](#objectwithnonintersectingvaluesmapbuilder) | a(long value) | +| [ObjectWithNonIntersectingValuesMapBuilder](#objectwithnonintersectingvaluesmapbuilder) | a(double value) | +| [ObjectWithNonIntersectingValuesMapBuilder](#objectwithnonintersectingvaluesmapbuilder) | additionalProperty(String key, String value) | + +## ObjectWithNonIntersectingValuesMap +public static class ObjectWithNonIntersectingValuesMap
+extends FrozenMap + +A class to store validated Map payloads + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| static [ObjectWithNonIntersectingValuesMap](#objectwithnonintersectingvaluesmap) | of([Map](#objectwithnonintersectingvaluesmapbuilder) arg, SchemaConfiguration configuration) | +| Number | a()
[optional] | +| String | getAdditionalProperty(String name)
provides type safety for additional properties | + +## ABoxed +public sealed interface ABoxed
+permits
+[ABoxedNumber](#aboxednumber) + +sealed interface that stores validated payloads using boxed classes + +## ABoxedNumber +public record ABoxedNumber
+implements [ABoxed](#aboxed) + +record that stores validated Number payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| ABoxedNumber(Number data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| Number | data()
validated payload | +| @Nullable Object | getData()
validated payload | + +## A +public static class A
+extends NumberJsonSchema.NumberJsonSchema1 + +A schema class that validates payloads + +| Methods Inherited from class org.openapijsonschematools.client.schemas.NumberJsonSchema.NumberJsonSchema1 | +| ------------------------------------------------------------------ | +| validate | +| validateAndBox | + +## AdditionalPropertiesBoxed +public sealed interface AdditionalPropertiesBoxed
+permits
+[AdditionalPropertiesBoxedString](#additionalpropertiesboxedstring) + +sealed interface that stores validated payloads using boxed classes + +## 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 | + +## AdditionalProperties +public static class AdditionalProperties
+extends StringJsonSchema.StringJsonSchema1 + +A schema class that validates payloads + +| Methods Inherited from class org.openapijsonschematools.client.schemas.StringJsonSchema.StringJsonSchema1 | +| ------------------------------------------------------------------ | +| validate | +| validateAndBox | + +[[Back to top]](#top) [[Back to Component Schemas]](../../../README.md#Component-Schemas) [[Back to README]](../../../README.md) diff --git a/samples/client/petstore/kotlin/docs/components/schemas/ObjectWithOnlyOptionalProps.md b/samples/client/petstore/kotlin/docs/components/schemas/ObjectWithOnlyOptionalProps.md new file mode 100644 index 00000000000..def2c8ea530 --- /dev/null +++ b/samples/client/petstore/kotlin/docs/components/schemas/ObjectWithOnlyOptionalProps.md @@ -0,0 +1,478 @@ +# ObjectWithOnlyOptionalProps +org.openapijsonschematools.client.components.schemas.ObjectWithOnlyOptionalProps.java +public class ObjectWithOnlyOptionalProps
+ +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 list payloads, extends FrozenList +- classes to build inputs for list payloads +- classes to store validated map payloads, extends FrozenMap +- classes to build inputs for map payloads + +## Nested Class Summary +| Modifier and Type | Class and Description | +| ----------------- | ---------------------- | +| sealed interface | [ObjectWithOnlyOptionalProps.ObjectWithOnlyOptionalProps1Boxed](#objectwithonlyoptionalprops1boxed)
sealed interface for validated payloads | +| record | [ObjectWithOnlyOptionalProps.ObjectWithOnlyOptionalProps1BoxedMap](#objectwithonlyoptionalprops1boxedmap)
boxed class to store validated Map payloads | +| static class | [ObjectWithOnlyOptionalProps.ObjectWithOnlyOptionalProps1](#objectwithonlyoptionalprops1)
schema class | +| static class | [ObjectWithOnlyOptionalProps.ObjectWithOnlyOptionalPropsMapBuilder](#objectwithonlyoptionalpropsmapbuilder)
builder for Map payloads | +| static class | [ObjectWithOnlyOptionalProps.ObjectWithOnlyOptionalPropsMap](#objectwithonlyoptionalpropsmap)
output class for Map payloads | +| sealed interface | [ObjectWithOnlyOptionalProps.ArrayPropertyBoxed](#arraypropertyboxed)
sealed interface for validated payloads | +| record | [ObjectWithOnlyOptionalProps.ArrayPropertyBoxedVoid](#arraypropertyboxedvoid)
boxed class to store validated null payloads | +| record | [ObjectWithOnlyOptionalProps.ArrayPropertyBoxedList](#arraypropertyboxedlist)
boxed class to store validated List payloads | +| static class | [ObjectWithOnlyOptionalProps.ArrayProperty](#arrayproperty)
schema class | +| static class | [ObjectWithOnlyOptionalProps.ArrayPropertyListBuilder](#arraypropertylistbuilder)
builder for List payloads | +| static class | [ObjectWithOnlyOptionalProps.ArrayPropertyList](#arraypropertylist)
output class for List payloads | +| sealed interface | [ObjectWithOnlyOptionalProps.BBoxed](#bboxed)
sealed interface for validated payloads | +| record | [ObjectWithOnlyOptionalProps.BBoxedNumber](#bboxednumber)
boxed class to store validated Number payloads | +| static class | [ObjectWithOnlyOptionalProps.B](#b)
schema class | +| sealed interface | [ObjectWithOnlyOptionalProps.ABoxed](#aboxed)
sealed interface for validated payloads | +| record | [ObjectWithOnlyOptionalProps.ABoxedString](#aboxedstring)
boxed class to store validated String payloads | +| static class | [ObjectWithOnlyOptionalProps.A](#a)
schema class | +| sealed interface | [ObjectWithOnlyOptionalProps.AdditionalPropertiesBoxed](#additionalpropertiesboxed)
sealed interface for validated payloads | +| record | [ObjectWithOnlyOptionalProps.AdditionalPropertiesBoxedVoid](#additionalpropertiesboxedvoid)
boxed class to store validated null payloads | +| record | [ObjectWithOnlyOptionalProps.AdditionalPropertiesBoxedBoolean](#additionalpropertiesboxedboolean)
boxed class to store validated boolean payloads | +| record | [ObjectWithOnlyOptionalProps.AdditionalPropertiesBoxedNumber](#additionalpropertiesboxednumber)
boxed class to store validated Number payloads | +| record | [ObjectWithOnlyOptionalProps.AdditionalPropertiesBoxedString](#additionalpropertiesboxedstring)
boxed class to store validated String payloads | +| record | [ObjectWithOnlyOptionalProps.AdditionalPropertiesBoxedList](#additionalpropertiesboxedlist)
boxed class to store validated List payloads | +| record | [ObjectWithOnlyOptionalProps.AdditionalPropertiesBoxedMap](#additionalpropertiesboxedmap)
boxed class to store validated Map payloads | +| static class | [ObjectWithOnlyOptionalProps.AdditionalProperties](#additionalproperties)
schema class | + +## ObjectWithOnlyOptionalProps1Boxed +public sealed interface ObjectWithOnlyOptionalProps1Boxed
+permits
+[ObjectWithOnlyOptionalProps1BoxedMap](#objectwithonlyoptionalprops1boxedmap) + +sealed interface that stores validated payloads using boxed classes + +## ObjectWithOnlyOptionalProps1BoxedMap +public record ObjectWithOnlyOptionalProps1BoxedMap
+implements [ObjectWithOnlyOptionalProps1Boxed](#objectwithonlyoptionalprops1boxed) + +record that stores validated Map payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| ObjectWithOnlyOptionalProps1BoxedMap([ObjectWithOnlyOptionalPropsMap](#objectwithonlyoptionalpropsmap) data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| [ObjectWithOnlyOptionalPropsMap](#objectwithonlyoptionalpropsmap) | data()
validated payload | +| @Nullable Object | getData()
validated payload | + +## ObjectWithOnlyOptionalProps1 +public static class ObjectWithOnlyOptionalProps1
+extends JsonSchema + +A schema class that validates payloads + +### Code Sample +``` +import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags; +import org.openapijsonschematools.client.configurations.SchemaConfiguration; +import org.openapijsonschematools.client.exceptions.ValidationException; +import org.openapijsonschematools.client.schemas.validation.MapUtils; +import org.openapijsonschematools.client.schemas.validation.FrozenList; +import org.openapijsonschematools.client.schemas.validation.FrozenMap; +import org.openapijsonschematools.client.components.schemas.ObjectWithOnlyOptionalProps; + +import java.util.Arrays; +import java.util.List; +import java.util.AbstractMap; + +static final SchemaConfiguration configuration = new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().build()); + +// Map validation +ObjectWithOnlyOptionalProps.ObjectWithOnlyOptionalPropsMap validatedPayload = + ObjectWithOnlyOptionalProps.ObjectWithOnlyOptionalProps1.validate( + new ObjectWithOnlyOptionalProps.ObjectWithOnlyOptionalPropsMapBuilder() + .a("a") + + .b(1) + + .ArrayProperty(null) + + .build(), + configuration +); +``` + +### Field Summary +| Modifier and Type | Field and Description | +| ----------------- | ---------------------- | +| Set> | type = Set.of(Map.class) | +| Map> | properties = Map.ofEntries(
    new PropertyEntry("a", [A.class](#a))),
    new PropertyEntry("b", [B.class](#b))),
    new PropertyEntry("ArrayProperty", [ArrayProperty.class](#arrayproperty)))
)
| +| Class | additionalProperties = [AdditionalProperties.class](#additionalproperties) | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| [ObjectWithOnlyOptionalPropsMap](#objectwithonlyoptionalpropsmap) | validate([Map<?, ?>](#objectwithonlyoptionalpropsmapbuilder) arg, SchemaConfiguration configuration) | +| [ObjectWithOnlyOptionalProps1BoxedMap](#objectwithonlyoptionalprops1boxedmap) | validateAndBox([Map<?, ?>](#objectwithonlyoptionalpropsmapbuilder) arg, SchemaConfiguration configuration) | +| [ObjectWithOnlyOptionalProps1Boxed](#objectwithonlyoptionalprops1boxed) | validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) | +| @Nullable Object | validate(@Nullable Object arg, SchemaConfiguration configuration) | + +## ObjectWithOnlyOptionalPropsMapBuilder +public class ObjectWithOnlyOptionalPropsMapBuilder
+builder for `Map` + +A class that builds the Map input type + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| ObjectWithOnlyOptionalPropsMapBuilder()
Creates a builder that contains an empty map | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| Map | build()
Returns map input that should be used with Schema.validate | +| [ObjectWithOnlyOptionalPropsMapBuilder](#objectwithonlyoptionalpropsmapbuilder) | a(String value) | +| [ObjectWithOnlyOptionalPropsMapBuilder](#objectwithonlyoptionalpropsmapbuilder) | b(int value) | +| [ObjectWithOnlyOptionalPropsMapBuilder](#objectwithonlyoptionalpropsmapbuilder) | b(float value) | +| [ObjectWithOnlyOptionalPropsMapBuilder](#objectwithonlyoptionalpropsmapbuilder) | b(long value) | +| [ObjectWithOnlyOptionalPropsMapBuilder](#objectwithonlyoptionalpropsmapbuilder) | b(double value) | +| [ObjectWithOnlyOptionalPropsMapBuilder](#objectwithonlyoptionalpropsmapbuilder) | ArrayProperty(Nothing? value) | +| [ObjectWithOnlyOptionalPropsMapBuilder](#objectwithonlyoptionalpropsmapbuilder) | ArrayProperty(List value) | + +## ObjectWithOnlyOptionalPropsMap +public static class ObjectWithOnlyOptionalPropsMap
+extends FrozenMap + +A class to store validated Map payloads + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| static [ObjectWithOnlyOptionalPropsMap](#objectwithonlyoptionalpropsmap) | of([Map](#objectwithonlyoptionalpropsmapbuilder) arg, SchemaConfiguration configuration) | +| String | a()
[optional] | +| Number | b()
[optional] | +| [ArrayPropertyList](#arraypropertylist) | ArrayProperty()
[optional] | + +## ArrayPropertyBoxed +public sealed interface ArrayPropertyBoxed
+permits
+[ArrayPropertyBoxedVoid](#arraypropertyboxedvoid), +[ArrayPropertyBoxedList](#arraypropertyboxedlist) + +sealed interface that stores validated payloads using boxed classes + +## ArrayPropertyBoxedVoid +public record ArrayPropertyBoxedVoid
+implements [ArrayPropertyBoxed](#arraypropertyboxed) + +record that stores validated null payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| ArrayPropertyBoxedVoid(Nothing? data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| Nothing? | data()
validated payload | +| @Nullable Object | getData()
validated payload | + +## ArrayPropertyBoxedList +public record ArrayPropertyBoxedList
+implements [ArrayPropertyBoxed](#arraypropertyboxed) + +record that stores validated List payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| ArrayPropertyBoxedList([ArrayPropertyList](#arraypropertylist) data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| [ArrayPropertyList](#arraypropertylist) | data()
validated payload | +| @Nullable Object | getData()
validated payload | + +## ArrayProperty +public static class ArrayProperty
+extends JsonSchema + +A schema class that validates payloads + +### Code Sample +``` +import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags; +import org.openapijsonschematools.client.configurations.SchemaConfiguration; +import org.openapijsonschematools.client.exceptions.ValidationException; +import org.openapijsonschematools.client.schemas.validation.MapUtils; +import org.openapijsonschematools.client.schemas.validation.FrozenList; +import org.openapijsonschematools.client.schemas.validation.FrozenMap; +import org.openapijsonschematools.client.components.schemas.ObjectWithOnlyOptionalProps; + +import java.util.Arrays; +import java.util.List; +import java.util.AbstractMap; + +static final SchemaConfiguration configuration = new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().build()); + +// null validation +Nothing? validatedPayload = ObjectWithOnlyOptionalProps.ArrayProperty.validate( + (Nothing?) null, + configuration +); + +// List validation +ObjectWithOnlyOptionalProps.ArrayPropertyList validatedPayload = + ObjectWithOnlyOptionalProps.ArrayProperty.validate( + new ObjectWithOnlyOptionalProps.ArrayPropertyListBuilder() + .add("_abc") + + .build(), + configuration +); +``` + +### Field Summary +| Modifier and Type | Field and Description | +| ----------------- | ---------------------- | +| Set> | type = Set.of(
    Nothing?.class,
    List.class
)
| +| Class | items = [EnumClass.EnumClass1.class](../../components/schemas/EnumClass.md#enumclass1) | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| Nothing? | validate(Nothing? arg, SchemaConfiguration configuration) | +| [ArrayPropertyBoxedVoid](#arraypropertyboxedvoid) | validateAndBox(Nothing? arg, SchemaConfiguration configuration) | +| [ArrayPropertyList](#arraypropertylist) | validate([List](#arraypropertylistbuilder) arg, SchemaConfiguration configuration) | +| [ArrayPropertyBoxedList](#arraypropertyboxedlist) | validateAndBox([List](#arraypropertylistbuilder) arg, SchemaConfiguration configuration) | +| [ArrayPropertyBoxed](#arraypropertyboxed) | validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) | +| @Nullable Object | validate(@Nullable Object arg, SchemaConfiguration configuration) | + +## ArrayPropertyListBuilder +public class ArrayPropertyListBuilder
+builder for `List` + +A class that builds the List input type + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| ArrayPropertyListBuilder()
Creates an empty list | +| ArrayPropertyListBuilder(List items)
Stores the items in a list | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| ArrayPropertyListBuilder | add(String item) | +| ArrayPropertyListBuilder | add([EnumClass.StringEnumClassEnums](../../components/schemas/EnumClass.md#stringenumclassenums) item) | +| List | build()
Returns list input that should be used with Schema.validate | + +## ArrayPropertyList +public class ArrayPropertyList
+extends `FrozenList` + +A class to store validated List payloads + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| static [ArrayPropertyList](#arraypropertylist) | of([List](#arraypropertylistbuilder) arg, SchemaConfiguration configuration) | + +## BBoxed +public sealed interface BBoxed
+permits
+[BBoxedNumber](#bboxednumber) + +sealed interface that stores validated payloads using boxed classes + +## BBoxedNumber +public record BBoxedNumber
+implements [BBoxed](#bboxed) + +record that stores validated Number payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| BBoxedNumber(Number data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| Number | data()
validated payload | +| @Nullable Object | getData()
validated payload | + +## B +public static class B
+extends NumberJsonSchema.NumberJsonSchema1 + +A schema class that validates payloads + +| Methods Inherited from class org.openapijsonschematools.client.schemas.NumberJsonSchema.NumberJsonSchema1 | +| ------------------------------------------------------------------ | +| validate | +| validateAndBox | + +## ABoxed +public sealed interface ABoxed
+permits
+[ABoxedString](#aboxedstring) + +sealed interface that stores validated payloads using boxed classes + +## ABoxedString +public record ABoxedString
+implements [ABoxed](#aboxed) + +record that stores validated String payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| ABoxedString(String data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| String | data()
validated payload | +| @Nullable Object | getData()
validated payload | + +## A +public static class A
+extends StringJsonSchema.StringJsonSchema1 + +A schema class that validates payloads + +| Methods Inherited from class org.openapijsonschematools.client.schemas.StringJsonSchema.StringJsonSchema1 | +| ------------------------------------------------------------------ | +| validate | +| validateAndBox | + +## 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(Nothing? data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| Nothing? | 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 Component Schemas]](../../../README.md#Component-Schemas) [[Back to README]](../../../README.md) diff --git a/samples/client/petstore/kotlin/docs/components/schemas/ObjectWithOptionalTestProp.md b/samples/client/petstore/kotlin/docs/components/schemas/ObjectWithOptionalTestProp.md new file mode 100644 index 00000000000..46c585734b0 --- /dev/null +++ b/samples/client/petstore/kotlin/docs/components/schemas/ObjectWithOptionalTestProp.md @@ -0,0 +1,169 @@ +# ObjectWithOptionalTestProp +org.openapijsonschematools.client.components.schemas.ObjectWithOptionalTestProp.java +public class ObjectWithOptionalTestProp
+ +A class that contains necessary nested +- schema classes (which validate payloads), extends JsonSchema +- sealed interfaces which store validated payloads, java version of a sum type +- boxed classes which store validated payloads, sealed permits class implementations +- classes to store validated map payloads, extends FrozenMap +- classes to build inputs for map payloads + +## Nested Class Summary +| Modifier and Type | Class and Description | +| ----------------- | ---------------------- | +| sealed interface | [ObjectWithOptionalTestProp.ObjectWithOptionalTestProp1Boxed](#objectwithoptionaltestprop1boxed)
sealed interface for validated payloads | +| record | [ObjectWithOptionalTestProp.ObjectWithOptionalTestProp1BoxedMap](#objectwithoptionaltestprop1boxedmap)
boxed class to store validated Map payloads | +| static class | [ObjectWithOptionalTestProp.ObjectWithOptionalTestProp1](#objectwithoptionaltestprop1)
schema class | +| static class | [ObjectWithOptionalTestProp.ObjectWithOptionalTestPropMapBuilder](#objectwithoptionaltestpropmapbuilder)
builder for Map payloads | +| static class | [ObjectWithOptionalTestProp.ObjectWithOptionalTestPropMap](#objectwithoptionaltestpropmap)
output class for Map payloads | +| sealed interface | [ObjectWithOptionalTestProp.TestBoxed](#testboxed)
sealed interface for validated payloads | +| record | [ObjectWithOptionalTestProp.TestBoxedString](#testboxedstring)
boxed class to store validated String payloads | +| static class | [ObjectWithOptionalTestProp.Test](#test)
schema class | + +## ObjectWithOptionalTestProp1Boxed +public sealed interface ObjectWithOptionalTestProp1Boxed
+permits
+[ObjectWithOptionalTestProp1BoxedMap](#objectwithoptionaltestprop1boxedmap) + +sealed interface that stores validated payloads using boxed classes + +## ObjectWithOptionalTestProp1BoxedMap +public record ObjectWithOptionalTestProp1BoxedMap
+implements [ObjectWithOptionalTestProp1Boxed](#objectwithoptionaltestprop1boxed) + +record that stores validated Map payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| ObjectWithOptionalTestProp1BoxedMap([ObjectWithOptionalTestPropMap](#objectwithoptionaltestpropmap) data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| [ObjectWithOptionalTestPropMap](#objectwithoptionaltestpropmap) | data()
validated payload | +| @Nullable Object | getData()
validated payload | + +## ObjectWithOptionalTestProp1 +public static class ObjectWithOptionalTestProp1
+extends JsonSchema + +A schema class that validates payloads + +### Code Sample +``` +import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags; +import org.openapijsonschematools.client.configurations.SchemaConfiguration; +import org.openapijsonschematools.client.exceptions.ValidationException; +import org.openapijsonschematools.client.schemas.validation.MapUtils; +import org.openapijsonschematools.client.schemas.validation.FrozenList; +import org.openapijsonschematools.client.schemas.validation.FrozenMap; +import org.openapijsonschematools.client.components.schemas.ObjectWithOptionalTestProp; + +import java.util.Arrays; +import java.util.List; +import java.util.AbstractMap; + +static final SchemaConfiguration configuration = new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().build()); + +// Map validation +ObjectWithOptionalTestProp.ObjectWithOptionalTestPropMap validatedPayload = + ObjectWithOptionalTestProp.ObjectWithOptionalTestProp1.validate( + new ObjectWithOptionalTestProp.ObjectWithOptionalTestPropMapBuilder() + .test("a") + + .build(), + configuration +); +``` + +### Field Summary +| Modifier and Type | Field and Description | +| ----------------- | ---------------------- | +| Set> | type = Set.of(Map.class) | +| Map> | properties = Map.ofEntries(
    new PropertyEntry("test", [Test.class](#test)))
)
| + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| [ObjectWithOptionalTestPropMap](#objectwithoptionaltestpropmap) | validate([Map<?, ?>](#objectwithoptionaltestpropmapbuilder) arg, SchemaConfiguration configuration) | +| [ObjectWithOptionalTestProp1BoxedMap](#objectwithoptionaltestprop1boxedmap) | validateAndBox([Map<?, ?>](#objectwithoptionaltestpropmapbuilder) arg, SchemaConfiguration configuration) | +| [ObjectWithOptionalTestProp1Boxed](#objectwithoptionaltestprop1boxed) | validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) | +| @Nullable Object | validate(@Nullable Object arg, SchemaConfiguration configuration) | + +## ObjectWithOptionalTestPropMapBuilder +public class ObjectWithOptionalTestPropMapBuilder
+builder for `Map` + +A class that builds the Map input type + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| ObjectWithOptionalTestPropMapBuilder()
Creates a builder that contains an empty map | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| Map | build()
Returns map input that should be used with Schema.validate | +| [ObjectWithOptionalTestPropMapBuilder](#objectwithoptionaltestpropmapbuilder) | test(String value) | +| [ObjectWithOptionalTestPropMapBuilder](#objectwithoptionaltestpropmapbuilder) | additionalProperty(String key, Nothing? value) | +| [ObjectWithOptionalTestPropMapBuilder](#objectwithoptionaltestpropmapbuilder) | additionalProperty(String key, boolean value) | +| [ObjectWithOptionalTestPropMapBuilder](#objectwithoptionaltestpropmapbuilder) | additionalProperty(String key, String value) | +| [ObjectWithOptionalTestPropMapBuilder](#objectwithoptionaltestpropmapbuilder) | additionalProperty(String key, int value) | +| [ObjectWithOptionalTestPropMapBuilder](#objectwithoptionaltestpropmapbuilder) | additionalProperty(String key, float value) | +| [ObjectWithOptionalTestPropMapBuilder](#objectwithoptionaltestpropmapbuilder) | additionalProperty(String key, long value) | +| [ObjectWithOptionalTestPropMapBuilder](#objectwithoptionaltestpropmapbuilder) | additionalProperty(String key, double value) | +| [ObjectWithOptionalTestPropMapBuilder](#objectwithoptionaltestpropmapbuilder) | additionalProperty(String key, List value) | +| [ObjectWithOptionalTestPropMapBuilder](#objectwithoptionaltestpropmapbuilder) | additionalProperty(String key, Map value) | + +## ObjectWithOptionalTestPropMap +public static class ObjectWithOptionalTestPropMap
+extends FrozenMap + +A class to store validated Map payloads + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| static [ObjectWithOptionalTestPropMap](#objectwithoptionaltestpropmap) | of([Map](#objectwithoptionaltestpropmapbuilder) arg, SchemaConfiguration configuration) | +| String | test()
[optional] | +| @Nullable Object | getAdditionalProperty(String name)
provides type safety for additional properties | + +## TestBoxed +public sealed interface TestBoxed
+permits
+[TestBoxedString](#testboxedstring) + +sealed interface that stores validated payloads using boxed classes + +## TestBoxedString +public record TestBoxedString
+implements [TestBoxed](#testboxed) + +record that stores validated String payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| TestBoxedString(String data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| String | data()
validated payload | +| @Nullable Object | getData()
validated payload | + +## Test +public static class Test
+extends StringJsonSchema.StringJsonSchema1 + +A schema class that validates payloads + +| Methods Inherited from class org.openapijsonschematools.client.schemas.StringJsonSchema.StringJsonSchema1 | +| ------------------------------------------------------------------ | +| validate | +| validateAndBox | + +[[Back to top]](#top) [[Back to Component Schemas]](../../../README.md#Component-Schemas) [[Back to README]](../../../README.md) diff --git a/samples/client/petstore/kotlin/docs/components/schemas/ObjectWithValidations.md b/samples/client/petstore/kotlin/docs/components/schemas/ObjectWithValidations.md new file mode 100644 index 00000000000..755fa9edbb3 --- /dev/null +++ b/samples/client/petstore/kotlin/docs/components/schemas/ObjectWithValidations.md @@ -0,0 +1,61 @@ +# ObjectWithValidations +org.openapijsonschematools.client.components.schemas.ObjectWithValidations.java +public class ObjectWithValidations
+ +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 + +## Nested Class Summary +| Modifier and Type | Class and Description | +| ----------------- | ---------------------- | +| sealed interface | [ObjectWithValidations.ObjectWithValidations1Boxed](#objectwithvalidations1boxed)
sealed interface for validated payloads | +| record | [ObjectWithValidations.ObjectWithValidations1BoxedMap](#objectwithvalidations1boxedmap)
boxed class to store validated Map payloads | +| static class | [ObjectWithValidations.ObjectWithValidations1](#objectwithvalidations1)
schema class | + +## ObjectWithValidations1Boxed +public sealed interface ObjectWithValidations1Boxed
+permits
+[ObjectWithValidations1BoxedMap](#objectwithvalidations1boxedmap) + +sealed interface that stores validated payloads using boxed classes + +## ObjectWithValidations1BoxedMap +public record ObjectWithValidations1BoxedMap
+implements [ObjectWithValidations1Boxed](#objectwithvalidations1boxed) + +record that stores validated Map payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| ObjectWithValidations1BoxedMap(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 | + +## ObjectWithValidations1 +public static class ObjectWithValidations1
+extends JsonSchema + +A schema class that validates payloads + +### Field Summary +| Modifier and Type | Field and Description | +| ----------------- | ---------------------- | +| Set> | type = Set.of(Map.class) | +| Integer | minProperties = 2 | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| FrozenMap | validate(Map<?, ?> arg, SchemaConfiguration configuration) | +| [ObjectWithValidations1BoxedMap](#objectwithvalidations1boxedmap) | validateAndBox(Map<?, ?> arg, SchemaConfiguration configuration) | +| [ObjectWithValidations1Boxed](#objectwithvalidations1boxed) | validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) | +| @Nullable Object | validate(@Nullable Object arg, SchemaConfiguration configuration) | + +[[Back to top]](#top) [[Back to Component Schemas]](../../../README.md#Component-Schemas) [[Back to README]](../../../README.md) diff --git a/samples/client/petstore/kotlin/docs/components/schemas/Order.md b/samples/client/petstore/kotlin/docs/components/schemas/Order.md new file mode 100644 index 00000000000..ac6a0023076 --- /dev/null +++ b/samples/client/petstore/kotlin/docs/components/schemas/Order.md @@ -0,0 +1,438 @@ +# Order +org.openapijsonschematools.client.components.schemas.Order.java +public class Order
+ +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 | [Order.Order1Boxed](#order1boxed)
sealed interface for validated payloads | +| record | [Order.Order1BoxedMap](#order1boxedmap)
boxed class to store validated Map payloads | +| static class | [Order.Order1](#order1)
schema class | +| static class | [Order.OrderMapBuilder](#ordermapbuilder)
builder for Map payloads | +| static class | [Order.OrderMap](#ordermap)
output class for Map payloads | +| sealed interface | [Order.CompleteBoxed](#completeboxed)
sealed interface for validated payloads | +| record | [Order.CompleteBoxedBoolean](#completeboxedboolean)
boxed class to store validated boolean payloads | +| static class | [Order.Complete](#complete)
schema class | +| sealed interface | [Order.StatusBoxed](#statusboxed)
sealed interface for validated payloads | +| record | [Order.StatusBoxedString](#statusboxedstring)
boxed class to store validated String payloads | +| static class | [Order.Status](#status)
schema class | +| enum | [Order.StringStatusEnums](#stringstatusenums)
String enum | +| sealed interface | [Order.ShipDateBoxed](#shipdateboxed)
sealed interface for validated payloads | +| record | [Order.ShipDateBoxedString](#shipdateboxedstring)
boxed class to store validated String payloads | +| static class | [Order.ShipDate](#shipdate)
schema class | +| sealed interface | [Order.QuantityBoxed](#quantityboxed)
sealed interface for validated payloads | +| record | [Order.QuantityBoxedNumber](#quantityboxednumber)
boxed class to store validated Number payloads | +| static class | [Order.Quantity](#quantity)
schema class | +| sealed interface | [Order.PetIdBoxed](#petidboxed)
sealed interface for validated payloads | +| record | [Order.PetIdBoxedNumber](#petidboxednumber)
boxed class to store validated Number payloads | +| static class | [Order.PetId](#petid)
schema class | +| sealed interface | [Order.IdBoxed](#idboxed)
sealed interface for validated payloads | +| record | [Order.IdBoxedNumber](#idboxednumber)
boxed class to store validated Number payloads | +| static class | [Order.Id](#id)
schema class | + +## Order1Boxed +public sealed interface Order1Boxed
+permits
+[Order1BoxedMap](#order1boxedmap) + +sealed interface that stores validated payloads using boxed classes + +## Order1BoxedMap +public record Order1BoxedMap
+implements [Order1Boxed](#order1boxed) + +record that stores validated Map payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| Order1BoxedMap([OrderMap](#ordermap) data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| [OrderMap](#ordermap) | data()
validated payload | +| @Nullable Object | getData()
validated payload | + +## Order1 +public static class Order1
+extends JsonSchema + +A schema class that validates payloads + +### Code Sample +``` +import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags; +import org.openapijsonschematools.client.configurations.SchemaConfiguration; +import org.openapijsonschematools.client.exceptions.ValidationException; +import org.openapijsonschematools.client.schemas.validation.MapUtils; +import org.openapijsonschematools.client.schemas.validation.FrozenList; +import org.openapijsonschematools.client.schemas.validation.FrozenMap; +import org.openapijsonschematools.client.components.schemas.Order; + +import java.util.Arrays; +import java.util.List; +import java.util.AbstractMap; + +static final SchemaConfiguration configuration = new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().build()); + +// Map validation +Order.OrderMap validatedPayload = + Order.Order1.validate( + new Order.OrderMapBuilder() + .id(1L) + + .petId(1L) + + .quantity(1) + + .shipDate("1970-01-01T00:00:00.00Z") + + .status("placed") + + .complete(true) + + .build(), + configuration +); +``` + +### Field Summary +| Modifier and Type | Field and Description | +| ----------------- | ---------------------- | +| Set> | type = Set.of(Map.class) | +| Map> | properties = Map.ofEntries(
    new PropertyEntry("id", [Id.class](#id))),
    new PropertyEntry("petId", [PetId.class](#petid))),
    new PropertyEntry("quantity", [Quantity.class](#quantity))),
    new PropertyEntry("shipDate", [ShipDate.class](#shipdate))),
    new PropertyEntry("status", [Status.class](#status))),
    new PropertyEntry("complete", [Complete.class](#complete)))
)
| + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| [OrderMap](#ordermap) | validate([Map<?, ?>](#ordermapbuilder) arg, SchemaConfiguration configuration) | +| [Order1BoxedMap](#order1boxedmap) | validateAndBox([Map<?, ?>](#ordermapbuilder) arg, SchemaConfiguration configuration) | +| [Order1Boxed](#order1boxed) | validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) | +| @Nullable Object | validate(@Nullable Object arg, SchemaConfiguration configuration) | + +## OrderMapBuilder +public class OrderMapBuilder
+builder for `Map` + +A class that builds the Map input type + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| OrderMapBuilder()
Creates a builder that contains an empty map | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| Map | build()
Returns map input that should be used with Schema.validate | +| [OrderMapBuilder](#ordermapbuilder) | id(int value) | +| [OrderMapBuilder](#ordermapbuilder) | id(float value) | +| [OrderMapBuilder](#ordermapbuilder) | id(long value) | +| [OrderMapBuilder](#ordermapbuilder) | id(double value) | +| [OrderMapBuilder](#ordermapbuilder) | petId(int value) | +| [OrderMapBuilder](#ordermapbuilder) | petId(float value) | +| [OrderMapBuilder](#ordermapbuilder) | petId(long value) | +| [OrderMapBuilder](#ordermapbuilder) | petId(double value) | +| [OrderMapBuilder](#ordermapbuilder) | quantity(int value) | +| [OrderMapBuilder](#ordermapbuilder) | quantity(float value) | +| [OrderMapBuilder](#ordermapbuilder) | shipDate(String value) | +| [OrderMapBuilder](#ordermapbuilder) | status(String value) | +| [OrderMapBuilder](#ordermapbuilder) | status([StringStatusEnums](#stringstatusenums) value) | +| [OrderMapBuilder](#ordermapbuilder) | complete(boolean value) | +| [OrderMapBuilder](#ordermapbuilder) | additionalProperty(String key, Nothing? value) | +| [OrderMapBuilder](#ordermapbuilder) | additionalProperty(String key, boolean value) | +| [OrderMapBuilder](#ordermapbuilder) | additionalProperty(String key, String value) | +| [OrderMapBuilder](#ordermapbuilder) | additionalProperty(String key, int value) | +| [OrderMapBuilder](#ordermapbuilder) | additionalProperty(String key, float value) | +| [OrderMapBuilder](#ordermapbuilder) | additionalProperty(String key, long value) | +| [OrderMapBuilder](#ordermapbuilder) | additionalProperty(String key, double value) | +| [OrderMapBuilder](#ordermapbuilder) | additionalProperty(String key, List value) | +| [OrderMapBuilder](#ordermapbuilder) | additionalProperty(String key, Map value) | + +## OrderMap +public static class OrderMap
+extends FrozenMap + +A class to store validated Map payloads + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| static [OrderMap](#ordermap) | of([Map](#ordermapbuilder) arg, SchemaConfiguration configuration) | +| Number | id()
[optional] value must be a 64 bit integer | +| Number | petId()
[optional] value must be a 64 bit integer | +| Number | quantity()
[optional] value must be a 32 bit integer | +| String | shipDate()
[optional] value must conform to RFC-3339 date-time | +| String | status()
[optional] must be one of ["placed", "approved", "delivered"] | +| boolean | complete()
[optional] if omitted the server will use the default value of false | +| @Nullable Object | getAdditionalProperty(String name)
provides type safety for additional properties | + +## CompleteBoxed +public sealed interface CompleteBoxed
+permits
+[CompleteBoxedBoolean](#completeboxedboolean) + +sealed interface that stores validated payloads using boxed classes + +## CompleteBoxedBoolean +public record CompleteBoxedBoolean
+implements [CompleteBoxed](#completeboxed) + +record that stores validated boolean payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| CompleteBoxedBoolean(boolean data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| boolean | data()
validated payload | +| @Nullable Object | getData()
validated payload | + +## Complete +public static class Complete
+extends BooleanJsonSchema.BooleanJsonSchema1 + +A schema class that validates payloads + +| Methods Inherited from class org.openapijsonschematools.client.schemas.BooleanJsonSchema.BooleanJsonSchema1 | +| ------------------------------------------------------------------ | +| validate | +| validateAndBox | + +## StatusBoxed +public sealed interface StatusBoxed
+permits
+[StatusBoxedString](#statusboxedstring) + +sealed interface that stores validated payloads using boxed classes + +## StatusBoxedString +public record StatusBoxedString
+implements [StatusBoxed](#statusboxed) + +record that stores validated String payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| StatusBoxedString(String data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| String | data()
validated payload | +| @Nullable Object | getData()
validated payload | + +## Status +public static class Status
+extends JsonSchema + +A schema class that validates payloads + +## Description +Order Status + +### Code Sample +``` +import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags; +import org.openapijsonschematools.client.configurations.SchemaConfiguration; +import org.openapijsonschematools.client.exceptions.ValidationException; +import org.openapijsonschematools.client.schemas.validation.MapUtils; +import org.openapijsonschematools.client.schemas.validation.FrozenList; +import org.openapijsonschematools.client.schemas.validation.FrozenMap; +import org.openapijsonschematools.client.components.schemas.Order; + +import java.util.Arrays; +import java.util.List; +import java.util.AbstractMap; + +static final SchemaConfiguration configuration = new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().build()); + +// String validation +String validatedPayload = Order.Status.validate( + "placed", + configuration +); +``` + +### Field Summary +| Modifier and Type | Field and Description | +| ----------------- | ---------------------- | +| Set> | type = Set.of(
    String.class
)
| +| Set | enumValues = SetMaker.makeSet(
    "placed",
    "approved",
    "delivered"
)
| + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| String | validate(String arg, SchemaConfiguration configuration) | +| String | validate([StringStatusEnums](#stringstatusenums) arg, SchemaConfiguration configuration) | +| [StatusBoxedString](#statusboxedstring) | validateAndBox(String arg, SchemaConfiguration configuration) | +| [StatusBoxed](#statusboxed) | validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) | +| @Nullable Object | validate(@Nullable Object arg, SchemaConfiguration configuration) | + +## StringStatusEnums +public enum StringStatusEnums
+extends `Enum` + +A class that stores String enum values + +### Enum Constant Summary +| Enum Constant | Description | +| ------------- | ----------- | +| PLACED | value = "placed" | +| APPROVED | value = "approved" | +| DELIVERED | value = "delivered" | + +## ShipDateBoxed +public sealed interface ShipDateBoxed
+permits
+[ShipDateBoxedString](#shipdateboxedstring) + +sealed interface that stores validated payloads using boxed classes + +## ShipDateBoxedString +public record ShipDateBoxedString
+implements [ShipDateBoxed](#shipdateboxed) + +record that stores validated String payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| ShipDateBoxedString(String data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| String | data()
validated payload | +| @Nullable Object | getData()
validated payload | + +## ShipDate +public static class ShipDate
+extends DateTimeJsonSchema.DateTimeJsonSchema1 + +A schema class that validates payloads + +| Methods Inherited from class org.openapijsonschematools.client.schemas.DateTimeJsonSchema.DateTimeJsonSchema1 | +| ------------------------------------------------------------------ | +| validate | +| validateAndBox | + +## QuantityBoxed +public sealed interface QuantityBoxed
+permits
+[QuantityBoxedNumber](#quantityboxednumber) + +sealed interface that stores validated payloads using boxed classes + +## QuantityBoxedNumber +public record QuantityBoxedNumber
+implements [QuantityBoxed](#quantityboxed) + +record that stores validated Number payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| QuantityBoxedNumber(Number data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| Number | data()
validated payload | +| @Nullable Object | getData()
validated payload | + +## Quantity +public static class Quantity
+extends Int32JsonSchema.Int32JsonSchema1 + +A schema class that validates payloads + +| Methods Inherited from class org.openapijsonschematools.client.schemas.Int32JsonSchema.Int32JsonSchema1 | +| ------------------------------------------------------------------ | +| validate | +| validateAndBox | + +## PetIdBoxed +public sealed interface PetIdBoxed
+permits
+[PetIdBoxedNumber](#petidboxednumber) + +sealed interface that stores validated payloads using boxed classes + +## PetIdBoxedNumber +public record PetIdBoxedNumber
+implements [PetIdBoxed](#petidboxed) + +record that stores validated Number payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| PetIdBoxedNumber(Number data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| Number | data()
validated payload | +| @Nullable Object | getData()
validated payload | + +## PetId +public static class PetId
+extends Int64JsonSchema.Int64JsonSchema1 + +A schema class that validates payloads + +| Methods Inherited from class org.openapijsonschematools.client.schemas.Int64JsonSchema.Int64JsonSchema1 | +| ------------------------------------------------------------------ | +| validate | +| validateAndBox | + +## IdBoxed +public sealed interface IdBoxed
+permits
+[IdBoxedNumber](#idboxednumber) + +sealed interface that stores validated payloads using boxed classes + +## IdBoxedNumber +public record IdBoxedNumber
+implements [IdBoxed](#idboxed) + +record that stores validated Number payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| IdBoxedNumber(Number data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| Number | data()
validated payload | +| @Nullable Object | getData()
validated payload | + +## Id +public static class Id
+extends Int64JsonSchema.Int64JsonSchema1 + +A schema class that validates payloads + +| Methods Inherited from class org.openapijsonschematools.client.schemas.Int64JsonSchema.Int64JsonSchema1 | +| ------------------------------------------------------------------ | +| validate | +| validateAndBox | + +[[Back to top]](#top) [[Back to Component Schemas]](../../../README.md#Component-Schemas) [[Back to README]](../../../README.md) diff --git a/samples/client/petstore/kotlin/docs/components/schemas/PaginatedResultMyObjectDto.md b/samples/client/petstore/kotlin/docs/components/schemas/PaginatedResultMyObjectDto.md new file mode 100644 index 00000000000..885b7c8000c --- /dev/null +++ b/samples/client/petstore/kotlin/docs/components/schemas/PaginatedResultMyObjectDto.md @@ -0,0 +1,458 @@ +# PaginatedResultMyObjectDto +org.openapijsonschematools.client.components.schemas.PaginatedResultMyObjectDto.java +public class PaginatedResultMyObjectDto
+ +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 list payloads, extends FrozenList +- classes to build inputs for list payloads +- classes to store validated map payloads, extends FrozenMap +- classes to build inputs for map payloads + +## Nested Class Summary +| Modifier and Type | Class and Description | +| ----------------- | ---------------------- | +| sealed interface | [PaginatedResultMyObjectDto.PaginatedResultMyObjectDto1Boxed](#paginatedresultmyobjectdto1boxed)
sealed interface for validated payloads | +| record | [PaginatedResultMyObjectDto.PaginatedResultMyObjectDto1BoxedMap](#paginatedresultmyobjectdto1boxedmap)
boxed class to store validated Map payloads | +| static class | [PaginatedResultMyObjectDto.PaginatedResultMyObjectDto1](#paginatedresultmyobjectdto1)
schema class | +| static class | [PaginatedResultMyObjectDto.PaginatedResultMyObjectDtoMapBuilder](#paginatedresultmyobjectdtomapbuilder)
builder for Map payloads | +| static class | [PaginatedResultMyObjectDto.PaginatedResultMyObjectDtoMap](#paginatedresultmyobjectdtomap)
output class for Map payloads | +| sealed interface | [PaginatedResultMyObjectDto.ResultsBoxed](#resultsboxed)
sealed interface for validated payloads | +| record | [PaginatedResultMyObjectDto.ResultsBoxedList](#resultsboxedlist)
boxed class to store validated List payloads | +| static class | [PaginatedResultMyObjectDto.Results](#results)
schema class | +| static class | [PaginatedResultMyObjectDto.ResultsListBuilder](#resultslistbuilder)
builder for List payloads | +| static class | [PaginatedResultMyObjectDto.ResultsList](#resultslist)
output class for List payloads | +| sealed interface | [PaginatedResultMyObjectDto.CountBoxed](#countboxed)
sealed interface for validated payloads | +| record | [PaginatedResultMyObjectDto.CountBoxedNumber](#countboxednumber)
boxed class to store validated Number payloads | +| static class | [PaginatedResultMyObjectDto.Count](#count)
schema class | +| sealed interface | [PaginatedResultMyObjectDto.AdditionalPropertiesBoxed](#additionalpropertiesboxed)
sealed interface for validated payloads | +| record | [PaginatedResultMyObjectDto.AdditionalPropertiesBoxedVoid](#additionalpropertiesboxedvoid)
boxed class to store validated null payloads | +| record | [PaginatedResultMyObjectDto.AdditionalPropertiesBoxedBoolean](#additionalpropertiesboxedboolean)
boxed class to store validated boolean payloads | +| record | [PaginatedResultMyObjectDto.AdditionalPropertiesBoxedNumber](#additionalpropertiesboxednumber)
boxed class to store validated Number payloads | +| record | [PaginatedResultMyObjectDto.AdditionalPropertiesBoxedString](#additionalpropertiesboxedstring)
boxed class to store validated String payloads | +| record | [PaginatedResultMyObjectDto.AdditionalPropertiesBoxedList](#additionalpropertiesboxedlist)
boxed class to store validated List payloads | +| record | [PaginatedResultMyObjectDto.AdditionalPropertiesBoxedMap](#additionalpropertiesboxedmap)
boxed class to store validated Map payloads | +| static class | [PaginatedResultMyObjectDto.AdditionalProperties](#additionalproperties)
schema class | + +## PaginatedResultMyObjectDto1Boxed +public sealed interface PaginatedResultMyObjectDto1Boxed
+permits
+[PaginatedResultMyObjectDto1BoxedMap](#paginatedresultmyobjectdto1boxedmap) + +sealed interface that stores validated payloads using boxed classes + +## PaginatedResultMyObjectDto1BoxedMap +public record PaginatedResultMyObjectDto1BoxedMap
+implements [PaginatedResultMyObjectDto1Boxed](#paginatedresultmyobjectdto1boxed) + +record that stores validated Map payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| PaginatedResultMyObjectDto1BoxedMap([PaginatedResultMyObjectDtoMap](#paginatedresultmyobjectdtomap) data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| [PaginatedResultMyObjectDtoMap](#paginatedresultmyobjectdtomap) | data()
validated payload | +| @Nullable Object | getData()
validated payload | + +## PaginatedResultMyObjectDto1 +public static class PaginatedResultMyObjectDto1
+extends JsonSchema + +A schema class that validates payloads + +### Code Sample +``` +import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags; +import org.openapijsonschematools.client.configurations.SchemaConfiguration; +import org.openapijsonschematools.client.exceptions.ValidationException; +import org.openapijsonschematools.client.schemas.validation.MapUtils; +import org.openapijsonschematools.client.schemas.validation.FrozenList; +import org.openapijsonschematools.client.schemas.validation.FrozenMap; +import org.openapijsonschematools.client.components.schemas.PaginatedResultMyObjectDto; + +import java.util.Arrays; +import java.util.List; +import java.util.AbstractMap; + +static final SchemaConfiguration configuration = new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().build()); + +// Map validation +PaginatedResultMyObjectDto.PaginatedResultMyObjectDtoMap validatedPayload = + PaginatedResultMyObjectDto.PaginatedResultMyObjectDto1.validate( + new PaginatedResultMyObjectDto.PaginatedResultMyObjectDtoMapBuilder() + .count(1) + + .results( + Arrays.asList( + ) + ) + .build(), + configuration +); +``` + +### Field Summary +| Modifier and Type | Field and Description | +| ----------------- | ---------------------- | +| Set> | type = Set.of(Map.class) | +| Map> | properties = Map.ofEntries(
    new PropertyEntry("count", [Count.class](#count))),
    new PropertyEntry("results", [Results.class](#results)))
)
| +| Set | required = Set.of(
    "count",
    "results"
)
| +| Class | additionalProperties = [AdditionalProperties.class](#additionalproperties) | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| [PaginatedResultMyObjectDtoMap](#paginatedresultmyobjectdtomap) | validate([Map<?, ?>](#paginatedresultmyobjectdtomapbuilder) arg, SchemaConfiguration configuration) | +| [PaginatedResultMyObjectDto1BoxedMap](#paginatedresultmyobjectdto1boxedmap) | validateAndBox([Map<?, ?>](#paginatedresultmyobjectdtomapbuilder) arg, SchemaConfiguration configuration) | +| [PaginatedResultMyObjectDto1Boxed](#paginatedresultmyobjectdto1boxed) | validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) | +| @Nullable Object | validate(@Nullable Object arg, SchemaConfiguration configuration) | + +## PaginatedResultMyObjectDtoMap00Builder +public class PaginatedResultMyObjectDtoMap00Builder
+builder for `Map` + +A class that builds the Map input type + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| PaginatedResultMyObjectDtoMap00Builder(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 | + +## PaginatedResultMyObjectDtoMap01Builder +public class PaginatedResultMyObjectDtoMap01Builder
+builder for `Map` + +A class that builds the Map input type + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| PaginatedResultMyObjectDtoMap01Builder(Map instance)
Creates a builder that contains the passed instance | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| [PaginatedResultMyObjectDtoMap00Builder](#paginatedresultmyobjectdtomap00builder) | results(List> value) | + +## PaginatedResultMyObjectDtoMap10Builder +public class PaginatedResultMyObjectDtoMap10Builder
+builder for `Map` + +A class that builds the Map input type + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| PaginatedResultMyObjectDtoMap10Builder(Map instance)
Creates a builder that contains the passed instance | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| [PaginatedResultMyObjectDtoMap00Builder](#paginatedresultmyobjectdtomap00builder) | count(int value) | +| [PaginatedResultMyObjectDtoMap00Builder](#paginatedresultmyobjectdtomap00builder) | count(float value) | +| [PaginatedResultMyObjectDtoMap00Builder](#paginatedresultmyobjectdtomap00builder) | count(long value) | +| [PaginatedResultMyObjectDtoMap00Builder](#paginatedresultmyobjectdtomap00builder) | count(double value) | + +## PaginatedResultMyObjectDtoMapBuilder +public class PaginatedResultMyObjectDtoMapBuilder
+builder for `Map` + +A class that builds the Map input type + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| PaginatedResultMyObjectDtoMapBuilder()
Creates a builder that contains an empty map | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| [PaginatedResultMyObjectDtoMap01Builder](#paginatedresultmyobjectdtomap01builder) | count(int value) | +| [PaginatedResultMyObjectDtoMap01Builder](#paginatedresultmyobjectdtomap01builder) | count(float value) | +| [PaginatedResultMyObjectDtoMap01Builder](#paginatedresultmyobjectdtomap01builder) | count(long value) | +| [PaginatedResultMyObjectDtoMap01Builder](#paginatedresultmyobjectdtomap01builder) | count(double value) | +| [PaginatedResultMyObjectDtoMap10Builder](#paginatedresultmyobjectdtomap10builder) | results(List> value) | + +## PaginatedResultMyObjectDtoMap +public static class PaginatedResultMyObjectDtoMap
+extends FrozenMap + +A class to store validated Map payloads + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| static [PaginatedResultMyObjectDtoMap](#paginatedresultmyobjectdtomap) | of([Map](#paginatedresultmyobjectdtomapbuilder) arg, SchemaConfiguration configuration) | +| Number | count()
| +| [ResultsList](#resultslist) | results()
| + +## ResultsBoxed +public sealed interface ResultsBoxed
+permits
+[ResultsBoxedList](#resultsboxedlist) + +sealed interface that stores validated payloads using boxed classes + +## ResultsBoxedList +public record ResultsBoxedList
+implements [ResultsBoxed](#resultsboxed) + +record that stores validated List payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| ResultsBoxedList([ResultsList](#resultslist) data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| [ResultsList](#resultslist) | data()
validated payload | +| @Nullable Object | getData()
validated payload | + +## Results +public static class Results
+extends JsonSchema + +A schema class that validates payloads + +### Code Sample +``` +import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags; +import org.openapijsonschematools.client.configurations.SchemaConfiguration; +import org.openapijsonschematools.client.exceptions.ValidationException; +import org.openapijsonschematools.client.schemas.validation.MapUtils; +import org.openapijsonschematools.client.schemas.validation.FrozenList; +import org.openapijsonschematools.client.schemas.validation.FrozenMap; +import org.openapijsonschematools.client.components.schemas.PaginatedResultMyObjectDto; + +import java.util.Arrays; +import java.util.List; +import java.util.AbstractMap; + +static final SchemaConfiguration configuration = new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().build()); + +// List validation +PaginatedResultMyObjectDto.ResultsList validatedPayload = + PaginatedResultMyObjectDto.Results.validate( + new PaginatedResultMyObjectDto.ResultsListBuilder() + .build(), + configuration +); +``` + +### Field Summary +| Modifier and Type | Field and Description | +| ----------------- | ---------------------- | +| Set> | type = Set.of(List.class) | +| Class | items = [MyObjectDto.MyObjectDto1.class](../../components/schemas/MyObjectDto.md#myobjectdto1) | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| [ResultsList](#resultslist) | validate([List](#resultslistbuilder) arg, SchemaConfiguration configuration) | +| [ResultsBoxedList](#resultsboxedlist) | validateAndBox([List](#resultslistbuilder) arg, SchemaConfiguration configuration) | +| [ResultsBoxed](#resultsboxed) | validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) | +| @Nullable Object | validate(@Nullable Object arg, SchemaConfiguration configuration) | + +## ResultsListBuilder +public class ResultsListBuilder
+builder for `List>` + +A class that builds the List input type + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| ResultsListBuilder()
Creates an empty list | +| ResultsListBuilder(List> items)
Stores the items in a list | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| ResultsListBuilder | add(Map item) | +| List> | build()
Returns list input that should be used with Schema.validate | + +## ResultsList +public class ResultsList
+extends `FrozenList` + +A class to store validated List payloads + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| static [ResultsList](#resultslist) | of([List>](#resultslistbuilder) arg, SchemaConfiguration configuration) | + +## CountBoxed +public sealed interface CountBoxed
+permits
+[CountBoxedNumber](#countboxednumber) + +sealed interface that stores validated payloads using boxed classes + +## CountBoxedNumber +public record CountBoxedNumber
+implements [CountBoxed](#countboxed) + +record that stores validated Number payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| CountBoxedNumber(Number data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| Number | data()
validated payload | +| @Nullable Object | getData()
validated payload | + +## Count +public static class Count
+extends IntJsonSchema.IntJsonSchema1 + +A schema class that validates payloads + +| Methods Inherited from class org.openapijsonschematools.client.schemas.IntJsonSchema.IntJsonSchema1 | +| ------------------------------------------------------------------ | +| validate | +| validateAndBox | + +## 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(Nothing? data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| Nothing? | 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 Component Schemas]](../../../README.md#Component-Schemas) [[Back to README]](../../../README.md) diff --git a/samples/client/petstore/kotlin/docs/components/schemas/ParentPet.md b/samples/client/petstore/kotlin/docs/components/schemas/ParentPet.md new file mode 100644 index 00000000000..d377636a119 --- /dev/null +++ b/samples/client/petstore/kotlin/docs/components/schemas/ParentPet.md @@ -0,0 +1,61 @@ +# ParentPet +org.openapijsonschematools.client.components.schemas.ParentPet.java +public class ParentPet
+ +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 + +## Nested Class Summary +| Modifier and Type | Class and Description | +| ----------------- | ---------------------- | +| sealed interface | [ParentPet.ParentPet1Boxed](#parentpet1boxed)
sealed interface for validated payloads | +| record | [ParentPet.ParentPet1BoxedMap](#parentpet1boxedmap)
boxed class to store validated Map payloads | +| static class | [ParentPet.ParentPet1](#parentpet1)
schema class | + +## ParentPet1Boxed +public sealed interface ParentPet1Boxed
+permits
+[ParentPet1BoxedMap](#parentpet1boxedmap) + +sealed interface that stores validated payloads using boxed classes + +## ParentPet1BoxedMap +public record ParentPet1BoxedMap
+implements [ParentPet1Boxed](#parentpet1boxed) + +record that stores validated Map payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| ParentPet1BoxedMap(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 | + +## ParentPet1 +public static class ParentPet1
+extends JsonSchema + +A schema class that validates payloads + +### Field Summary +| Modifier and Type | Field and Description | +| ----------------- | ---------------------- | +| Set> | type = Set.of(Map.class) | +| List> | allOf = List.of(
    [GrandparentAnimal.GrandparentAnimal1.class](../../components/schemas/GrandparentAnimal.md#grandparentanimal1)
;)
| + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| FrozenMap | validate(Map<?, ?> arg, SchemaConfiguration configuration) | +| [ParentPet1BoxedMap](#parentpet1boxedmap) | validateAndBox(Map<?, ?> arg, SchemaConfiguration configuration) | +| [ParentPet1Boxed](#parentpet1boxed) | validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) | +| @Nullable Object | validate(@Nullable Object arg, SchemaConfiguration configuration) | + +[[Back to top]](#top) [[Back to Component Schemas]](../../../README.md#Component-Schemas) [[Back to README]](../../../README.md) diff --git a/samples/client/petstore/kotlin/docs/components/schemas/Pet.md b/samples/client/petstore/kotlin/docs/components/schemas/Pet.md new file mode 100644 index 00000000000..5c54e5b4e49 --- /dev/null +++ b/samples/client/petstore/kotlin/docs/components/schemas/Pet.md @@ -0,0 +1,652 @@ +# Pet +org.openapijsonschematools.client.components.schemas.Pet.java +public class Pet
+ +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 list payloads, extends FrozenList +- classes to build inputs for list payloads +- 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 | [Pet.Pet1Boxed](#pet1boxed)
sealed interface for validated payloads | +| record | [Pet.Pet1BoxedMap](#pet1boxedmap)
boxed class to store validated Map payloads | +| static class | [Pet.Pet1](#pet1)
schema class | +| static class | [Pet.PetMapBuilder](#petmapbuilder)
builder for Map payloads | +| static class | [Pet.PetMap](#petmap)
output class for Map payloads | +| sealed interface | [Pet.TagsBoxed](#tagsboxed)
sealed interface for validated payloads | +| record | [Pet.TagsBoxedList](#tagsboxedlist)
boxed class to store validated List payloads | +| static class | [Pet.Tags](#tags)
schema class | +| static class | [Pet.TagsListBuilder](#tagslistbuilder)
builder for List payloads | +| static class | [Pet.TagsList](#tagslist)
output class for List payloads | +| sealed interface | [Pet.StatusBoxed](#statusboxed)
sealed interface for validated payloads | +| record | [Pet.StatusBoxedString](#statusboxedstring)
boxed class to store validated String payloads | +| static class | [Pet.Status](#status)
schema class | +| enum | [Pet.StringStatusEnums](#stringstatusenums)
String enum | +| sealed interface | [Pet.PhotoUrlsBoxed](#photourlsboxed)
sealed interface for validated payloads | +| record | [Pet.PhotoUrlsBoxedList](#photourlsboxedlist)
boxed class to store validated List payloads | +| static class | [Pet.PhotoUrls](#photourls)
schema class | +| static class | [Pet.PhotoUrlsListBuilder](#photourlslistbuilder)
builder for List payloads | +| static class | [Pet.PhotoUrlsList](#photourlslist)
output class for List payloads | +| sealed interface | [Pet.ItemsBoxed](#itemsboxed)
sealed interface for validated payloads | +| record | [Pet.ItemsBoxedString](#itemsboxedstring)
boxed class to store validated String payloads | +| static class | [Pet.Items](#items)
schema class | +| sealed interface | [Pet.NameBoxed](#nameboxed)
sealed interface for validated payloads | +| record | [Pet.NameBoxedString](#nameboxedstring)
boxed class to store validated String payloads | +| static class | [Pet.Name](#name)
schema class | +| sealed interface | [Pet.IdBoxed](#idboxed)
sealed interface for validated payloads | +| record | [Pet.IdBoxedNumber](#idboxednumber)
boxed class to store validated Number payloads | +| static class | [Pet.Id](#id)
schema class | + +## Pet1Boxed +public sealed interface Pet1Boxed
+permits
+[Pet1BoxedMap](#pet1boxedmap) + +sealed interface that stores validated payloads using boxed classes + +## Pet1BoxedMap +public record Pet1BoxedMap
+implements [Pet1Boxed](#pet1boxed) + +record that stores validated Map payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| Pet1BoxedMap([PetMap](#petmap) data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| [PetMap](#petmap) | data()
validated payload | +| @Nullable Object | getData()
validated payload | + +## Pet1 +public static class Pet1
+extends JsonSchema + +A schema class that validates payloads + +## Description +Pet object that needs to be added to the store + +### Code Sample +``` +import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags; +import org.openapijsonschematools.client.configurations.SchemaConfiguration; +import org.openapijsonschematools.client.exceptions.ValidationException; +import org.openapijsonschematools.client.schemas.validation.MapUtils; +import org.openapijsonschematools.client.schemas.validation.FrozenList; +import org.openapijsonschematools.client.schemas.validation.FrozenMap; +import org.openapijsonschematools.client.components.schemas.Pet; + +import java.util.Arrays; +import java.util.List; +import java.util.AbstractMap; + +static final SchemaConfiguration configuration = new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().build()); + +// Map validation +Pet.PetMap validatedPayload = + Pet.Pet1.validate( + 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(), + configuration +); +``` + +### Field Summary +| Modifier and Type | Field and Description | +| ----------------- | ---------------------- | +| Set> | type = Set.of(Map.class) | +| Map> | properties = Map.ofEntries(
    new PropertyEntry("id", [Id.class](#id))),
    new PropertyEntry("category", [Category.Category1.class](../../components/schemas/Category.md#category1)),
    new PropertyEntry("name", [Name.class](#name))),
    new PropertyEntry("photoUrls", [PhotoUrls.class](#photourls))),
    new PropertyEntry("tags", [Tags.class](#tags))),
    new PropertyEntry("status", [Status.class](#status)))
)
| +| Set | required = Set.of(
    "name",
    "photoUrls"
)
| + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| [PetMap](#petmap) | validate([Map<?, ?>](#petmapbuilder) arg, SchemaConfiguration configuration) | +| [Pet1BoxedMap](#pet1boxedmap) | validateAndBox([Map<?, ?>](#petmapbuilder) arg, SchemaConfiguration configuration) | +| [Pet1Boxed](#pet1boxed) | validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) | +| @Nullable Object | validate(@Nullable Object arg, SchemaConfiguration configuration) | + +## PetMap00Builder +public class PetMap00Builder
+builder for `Map` + +A class that builds the Map input type + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| PetMap00Builder(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 | +| [PetMap00Builder](#petmap00builder) | id(int value) | +| [PetMap00Builder](#petmap00builder) | id(float value) | +| [PetMap00Builder](#petmap00builder) | id(long value) | +| [PetMap00Builder](#petmap00builder) | id(double value) | +| [PetMap00Builder](#petmap00builder) | category(Map value) | +| [PetMap00Builder](#petmap00builder) | tags(List> value) | +| [PetMap00Builder](#petmap00builder) | status(String value) | +| [PetMap00Builder](#petmap00builder) | status([StringStatusEnums](#stringstatusenums) value) | +| [PetMap00Builder](#petmap00builder) | additionalProperty(String key, Nothing? value) | +| [PetMap00Builder](#petmap00builder) | additionalProperty(String key, boolean value) | +| [PetMap00Builder](#petmap00builder) | additionalProperty(String key, String value) | +| [PetMap00Builder](#petmap00builder) | additionalProperty(String key, int value) | +| [PetMap00Builder](#petmap00builder) | additionalProperty(String key, float value) | +| [PetMap00Builder](#petmap00builder) | additionalProperty(String key, long value) | +| [PetMap00Builder](#petmap00builder) | additionalProperty(String key, double value) | +| [PetMap00Builder](#petmap00builder) | additionalProperty(String key, List value) | +| [PetMap00Builder](#petmap00builder) | additionalProperty(String key, Map value) | + +## PetMap01Builder +public class PetMap01Builder
+builder for `Map` + +A class that builds the Map input type + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| PetMap01Builder(Map instance)
Creates a builder that contains the passed instance | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| [PetMap00Builder](#petmap00builder) | photoUrls(List value) | + +## PetMap10Builder +public class PetMap10Builder
+builder for `Map` + +A class that builds the Map input type + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| PetMap10Builder(Map instance)
Creates a builder that contains the passed instance | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| [PetMap00Builder](#petmap00builder) | name(String value) | + +## PetMapBuilder +public class PetMapBuilder
+builder for `Map` + +A class that builds the Map input type + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| PetMapBuilder()
Creates a builder that contains an empty map | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| [PetMap01Builder](#petmap01builder) | name(String value) | +| [PetMap10Builder](#petmap10builder) | photoUrls(List value) | + +## PetMap +public static class PetMap
+extends FrozenMap + +A class to store validated Map payloads + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| static [PetMap](#petmap) | of([Map](#petmapbuilder) arg, SchemaConfiguration configuration) | +| String | name()
| +| [PhotoUrlsList](#photourlslist) | photoUrls()
| +| Number | id()
[optional] value must be a 64 bit integer | +| [Category.CategoryMap](../../components/schemas/Category.md#categorymap) | category()
[optional] | +| [TagsList](#tagslist) | tags()
[optional] | +| String | status()
[optional] must be one of ["available", "pending", "sold"] | +| @Nullable Object | getAdditionalProperty(String name)
provides type safety for additional properties | + +## TagsBoxed +public sealed interface TagsBoxed
+permits
+[TagsBoxedList](#tagsboxedlist) + +sealed interface that stores validated payloads using boxed classes + +## TagsBoxedList +public record TagsBoxedList
+implements [TagsBoxed](#tagsboxed) + +record that stores validated List payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| TagsBoxedList([TagsList](#tagslist) data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| [TagsList](#tagslist) | data()
validated payload | +| @Nullable Object | getData()
validated payload | + +## Tags +public static class Tags
+extends JsonSchema + +A schema class that validates payloads + +### Code Sample +``` +import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags; +import org.openapijsonschematools.client.configurations.SchemaConfiguration; +import org.openapijsonschematools.client.exceptions.ValidationException; +import org.openapijsonschematools.client.schemas.validation.MapUtils; +import org.openapijsonschematools.client.schemas.validation.FrozenList; +import org.openapijsonschematools.client.schemas.validation.FrozenMap; +import org.openapijsonschematools.client.components.schemas.Pet; + +import java.util.Arrays; +import java.util.List; +import java.util.AbstractMap; + +static final SchemaConfiguration configuration = new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().build()); + +// List validation +Pet.TagsList validatedPayload = + Pet.Tags.validate( + new Pet.TagsListBuilder() + .add( + MapUtils.makeMap( + new AbstractMap.SimpleEntry( + "id", + 1L + ), + new AbstractMap.SimpleEntry( + "name", + "a" + ) + ) + ) + .build(), + configuration +); +``` + +### Field Summary +| Modifier and Type | Field and Description | +| ----------------- | ---------------------- | +| Set> | type = Set.of(List.class) | +| Class | items = [Tag.Tag1.class](../../components/schemas/Tag.md#tag1) | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| [TagsList](#tagslist) | validate([List](#tagslistbuilder) arg, SchemaConfiguration configuration) | +| [TagsBoxedList](#tagsboxedlist) | validateAndBox([List](#tagslistbuilder) arg, SchemaConfiguration configuration) | +| [TagsBoxed](#tagsboxed) | validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) | +| @Nullable Object | validate(@Nullable Object arg, SchemaConfiguration configuration) | + +## TagsListBuilder +public class TagsListBuilder
+builder for `List>` + +A class that builds the List input type + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| TagsListBuilder()
Creates an empty list | +| TagsListBuilder(List> items)
Stores the items in a list | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| TagsListBuilder | add(Map item) | +| List> | build()
Returns list input that should be used with Schema.validate | + +## TagsList +public class TagsList
+extends `FrozenList` + +A class to store validated List payloads + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| static [TagsList](#tagslist) | of([List>](#tagslistbuilder) arg, SchemaConfiguration configuration) | + +## StatusBoxed +public sealed interface StatusBoxed
+permits
+[StatusBoxedString](#statusboxedstring) + +sealed interface that stores validated payloads using boxed classes + +## StatusBoxedString +public record StatusBoxedString
+implements [StatusBoxed](#statusboxed) + +record that stores validated String payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| StatusBoxedString(String data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| String | data()
validated payload | +| @Nullable Object | getData()
validated payload | + +## Status +public static class Status
+extends JsonSchema + +A schema class that validates payloads + +## Description +pet status in the store + +### Code Sample +``` +import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags; +import org.openapijsonschematools.client.configurations.SchemaConfiguration; +import org.openapijsonschematools.client.exceptions.ValidationException; +import org.openapijsonschematools.client.schemas.validation.MapUtils; +import org.openapijsonschematools.client.schemas.validation.FrozenList; +import org.openapijsonschematools.client.schemas.validation.FrozenMap; +import org.openapijsonschematools.client.components.schemas.Pet; + +import java.util.Arrays; +import java.util.List; +import java.util.AbstractMap; + +static final SchemaConfiguration configuration = new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().build()); + +// String validation +String validatedPayload = Pet.Status.validate( + "available", + configuration +); +``` + +### Field Summary +| Modifier and Type | Field and Description | +| ----------------- | ---------------------- | +| Set> | type = Set.of(
    String.class
)
| +| Set | enumValues = SetMaker.makeSet(
    "available",
    "pending",
    "sold"
)
| + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| String | validate(String arg, SchemaConfiguration configuration) | +| String | validate([StringStatusEnums](#stringstatusenums) arg, SchemaConfiguration configuration) | +| [StatusBoxedString](#statusboxedstring) | validateAndBox(String arg, SchemaConfiguration configuration) | +| [StatusBoxed](#statusboxed) | validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) | +| @Nullable Object | validate(@Nullable Object arg, SchemaConfiguration configuration) | + +## StringStatusEnums +public enum StringStatusEnums
+extends `Enum` + +A class that stores String enum values + +### Enum Constant Summary +| Enum Constant | Description | +| ------------- | ----------- | +| AVAILABLE | value = "available" | +| PENDING | value = "pending" | +| SOLD | value = "sold" | + +## PhotoUrlsBoxed +public sealed interface PhotoUrlsBoxed
+permits
+[PhotoUrlsBoxedList](#photourlsboxedlist) + +sealed interface that stores validated payloads using boxed classes + +## PhotoUrlsBoxedList +public record PhotoUrlsBoxedList
+implements [PhotoUrlsBoxed](#photourlsboxed) + +record that stores validated List payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| PhotoUrlsBoxedList([PhotoUrlsList](#photourlslist) data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| [PhotoUrlsList](#photourlslist) | data()
validated payload | +| @Nullable Object | getData()
validated payload | + +## PhotoUrls +public static class PhotoUrls
+extends JsonSchema + +A schema class that validates payloads + +### Code Sample +``` +import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags; +import org.openapijsonschematools.client.configurations.SchemaConfiguration; +import org.openapijsonschematools.client.exceptions.ValidationException; +import org.openapijsonschematools.client.schemas.validation.MapUtils; +import org.openapijsonschematools.client.schemas.validation.FrozenList; +import org.openapijsonschematools.client.schemas.validation.FrozenMap; +import org.openapijsonschematools.client.components.schemas.Pet; + +import java.util.Arrays; +import java.util.List; +import java.util.AbstractMap; + +static final SchemaConfiguration configuration = new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().build()); + +// List validation +Pet.PhotoUrlsList validatedPayload = + Pet.PhotoUrls.validate( + new Pet.PhotoUrlsListBuilder() + .add("a") + + .build(), + configuration +); +``` + +### Field Summary +| Modifier and Type | Field and Description | +| ----------------- | ---------------------- | +| Set> | type = Set.of(List.class) | +| Class | items = [Items.class](#items) | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| [PhotoUrlsList](#photourlslist) | validate([List](#photourlslistbuilder) arg, SchemaConfiguration configuration) | +| [PhotoUrlsBoxedList](#photourlsboxedlist) | validateAndBox([List](#photourlslistbuilder) arg, SchemaConfiguration configuration) | +| [PhotoUrlsBoxed](#photourlsboxed) | validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) | +| @Nullable Object | validate(@Nullable Object arg, SchemaConfiguration configuration) | + +## PhotoUrlsListBuilder +public class PhotoUrlsListBuilder
+builder for `List` + +A class that builds the List input type + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| PhotoUrlsListBuilder()
Creates an empty list | +| PhotoUrlsListBuilder(List items)
Stores the items in a list | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| PhotoUrlsListBuilder | add(String item) | +| List | build()
Returns list input that should be used with Schema.validate | + +## PhotoUrlsList +public class PhotoUrlsList
+extends `FrozenList` + +A class to store validated List payloads + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| static [PhotoUrlsList](#photourlslist) | of([List](#photourlslistbuilder) arg, SchemaConfiguration configuration) | + +## ItemsBoxed +public sealed interface ItemsBoxed
+permits
+[ItemsBoxedString](#itemsboxedstring) + +sealed interface that stores validated payloads using boxed classes + +## ItemsBoxedString +public record ItemsBoxedString
+implements [ItemsBoxed](#itemsboxed) + +record that stores validated String payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| ItemsBoxedString(String data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| String | data()
validated payload | +| @Nullable Object | getData()
validated payload | + +## Items +public static class Items
+extends StringJsonSchema.StringJsonSchema1 + +A schema class that validates payloads + +| Methods Inherited from class org.openapijsonschematools.client.schemas.StringJsonSchema.StringJsonSchema1 | +| ------------------------------------------------------------------ | +| validate | +| validateAndBox | + +## NameBoxed +public sealed interface NameBoxed
+permits
+[NameBoxedString](#nameboxedstring) + +sealed interface that stores validated payloads using boxed classes + +## NameBoxedString +public record NameBoxedString
+implements [NameBoxed](#nameboxed) + +record that stores validated String payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| NameBoxedString(String data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| String | data()
validated payload | +| @Nullable Object | getData()
validated payload | + +## Name +public static class Name
+extends StringJsonSchema.StringJsonSchema1 + +A schema class that validates payloads + +| Methods Inherited from class org.openapijsonschematools.client.schemas.StringJsonSchema.StringJsonSchema1 | +| ------------------------------------------------------------------ | +| validate | +| validateAndBox | + +## IdBoxed +public sealed interface IdBoxed
+permits
+[IdBoxedNumber](#idboxednumber) + +sealed interface that stores validated payloads using boxed classes + +## IdBoxedNumber +public record IdBoxedNumber
+implements [IdBoxed](#idboxed) + +record that stores validated Number payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| IdBoxedNumber(Number data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| Number | data()
validated payload | +| @Nullable Object | getData()
validated payload | + +## Id +public static class Id
+extends Int64JsonSchema.Int64JsonSchema1 + +A schema class that validates payloads + +| Methods Inherited from class org.openapijsonschematools.client.schemas.Int64JsonSchema.Int64JsonSchema1 | +| ------------------------------------------------------------------ | +| validate | +| validateAndBox | + +[[Back to top]](#top) [[Back to Component Schemas]](../../../README.md#Component-Schemas) [[Back to README]](../../../README.md) diff --git a/samples/client/petstore/kotlin/docs/components/schemas/Pig.md b/samples/client/petstore/kotlin/docs/components/schemas/Pig.md new file mode 100644 index 00000000000..fa72e2c2e0c --- /dev/null +++ b/samples/client/petstore/kotlin/docs/components/schemas/Pig.md @@ -0,0 +1,169 @@ +# Pig +org.openapijsonschematools.client.components.schemas.Pig.java +public class Pig
+ +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 + +## Nested Class Summary +| Modifier and Type | Class and Description | +| ----------------- | ---------------------- | +| sealed interface | [Pig.Pig1Boxed](#pig1boxed)
sealed interface for validated payloads | +| record | [Pig.Pig1BoxedVoid](#pig1boxedvoid)
boxed class to store validated null payloads | +| record | [Pig.Pig1BoxedBoolean](#pig1boxedboolean)
boxed class to store validated boolean payloads | +| record | [Pig.Pig1BoxedNumber](#pig1boxednumber)
boxed class to store validated Number payloads | +| record | [Pig.Pig1BoxedString](#pig1boxedstring)
boxed class to store validated String payloads | +| record | [Pig.Pig1BoxedList](#pig1boxedlist)
boxed class to store validated List payloads | +| record | [Pig.Pig1BoxedMap](#pig1boxedmap)
boxed class to store validated Map payloads | +| static class | [Pig.Pig1](#pig1)
schema class | + +## Pig1Boxed +public sealed interface Pig1Boxed
+permits
+[Pig1BoxedVoid](#pig1boxedvoid), +[Pig1BoxedBoolean](#pig1boxedboolean), +[Pig1BoxedNumber](#pig1boxednumber), +[Pig1BoxedString](#pig1boxedstring), +[Pig1BoxedList](#pig1boxedlist), +[Pig1BoxedMap](#pig1boxedmap) + +sealed interface that stores validated payloads using boxed classes + +## Pig1BoxedVoid +public record Pig1BoxedVoid
+implements [Pig1Boxed](#pig1boxed) + +record that stores validated null payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| Pig1BoxedVoid(Nothing? data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| Nothing? | data()
validated payload | +| @Nullable Object | getData()
validated payload | + +## Pig1BoxedBoolean +public record Pig1BoxedBoolean
+implements [Pig1Boxed](#pig1boxed) + +record that stores validated boolean payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| Pig1BoxedBoolean(boolean data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| boolean | data()
validated payload | +| @Nullable Object | getData()
validated payload | + +## Pig1BoxedNumber +public record Pig1BoxedNumber
+implements [Pig1Boxed](#pig1boxed) + +record that stores validated Number payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| Pig1BoxedNumber(Number data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| Number | data()
validated payload | +| @Nullable Object | getData()
validated payload | + +## Pig1BoxedString +public record Pig1BoxedString
+implements [Pig1Boxed](#pig1boxed) + +record that stores validated String payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| Pig1BoxedString(String data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| String | data()
validated payload | +| @Nullable Object | getData()
validated payload | + +## Pig1BoxedList +public record Pig1BoxedList
+implements [Pig1Boxed](#pig1boxed) + +record that stores validated List payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| Pig1BoxedList(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 | + +## Pig1BoxedMap +public record Pig1BoxedMap
+implements [Pig1Boxed](#pig1boxed) + +record that stores validated Map payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| Pig1BoxedMap(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 | + +## Pig1 +public static class Pig1
+extends JsonSchema + +A schema class that validates payloads + +### Field Summary +| Modifier and Type | Field and Description | +| ----------------- | ---------------------- | +| List> | oneOf = List.of(
    [BasquePig.BasquePig1.class](../../components/schemas/BasquePig.md#basquepig1),
    [DanishPig.DanishPig1.class](../../components/schemas/DanishPig.md#danishpig1)
))
| + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| String | validate(String arg, SchemaConfiguration configuration) | +| Nothing? | validate(Nothing? arg, SchemaConfiguration configuration) | +| int | validate(int arg, SchemaConfiguration configuration) | +| long | validate(long arg, SchemaConfiguration configuration) | +| float | validate(float arg, SchemaConfiguration configuration) | +| double | validate(double arg, SchemaConfiguration configuration) | +| Number | validate(Number arg, SchemaConfiguration configuration) | +| boolean | validate(boolean arg, SchemaConfiguration configuration) | +| FrozenMap<@Nullable Object> | validate(Map<?, ?> arg, SchemaConfiguration configuration) | +| FrozenList<@Nullable Object> | validate(List arg, SchemaConfiguration configuration) | +| [Pig1BoxedString](#pig1boxedstring) | validateAndBox(String arg, SchemaConfiguration configuration) | +| [Pig1BoxedVoid](#pig1boxedvoid) | validateAndBox(Nothing? arg, SchemaConfiguration configuration) | +| [Pig1BoxedNumber](#pig1boxednumber) | validateAndBox(Number arg, SchemaConfiguration configuration) | +| [Pig1BoxedBoolean](#pig1boxedboolean) | validateAndBox(boolean arg, SchemaConfiguration configuration) | +| [Pig1BoxedMap](#pig1boxedmap) | validateAndBox(Map<?, ?> arg, SchemaConfiguration configuration) | +| [Pig1BoxedList](#pig1boxedlist) | validateAndBox(List arg, SchemaConfiguration configuration) | +| [Pig1Boxed](#pig1boxed) | validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) | +| @Nullable Object | validate(@Nullable Object arg, SchemaConfiguration configuration) | + +[[Back to top]](#top) [[Back to Component Schemas]](../../../README.md#Component-Schemas) [[Back to README]](../../../README.md) diff --git a/samples/client/petstore/kotlin/docs/components/schemas/Player.md b/samples/client/petstore/kotlin/docs/components/schemas/Player.md new file mode 100644 index 00000000000..9d5bd532a80 --- /dev/null +++ b/samples/client/petstore/kotlin/docs/components/schemas/Player.md @@ -0,0 +1,174 @@ +# Player +org.openapijsonschematools.client.components.schemas.Player.java +public class Player
+ +A class that contains necessary nested +- schema classes (which validate payloads), extends JsonSchema +- sealed interfaces which store validated payloads, java version of a sum type +- boxed classes which store validated payloads, sealed permits class implementations +- classes to store validated map payloads, extends FrozenMap +- classes to build inputs for map payloads + +## Nested Class Summary +| Modifier and Type | Class and Description | +| ----------------- | ---------------------- | +| sealed interface | [Player.Player1Boxed](#player1boxed)
sealed interface for validated payloads | +| record | [Player.Player1BoxedMap](#player1boxedmap)
boxed class to store validated Map payloads | +| static class | [Player.Player1](#player1)
schema class | +| static class | [Player.PlayerMapBuilder](#playermapbuilder)
builder for Map payloads | +| static class | [Player.PlayerMap](#playermap)
output class for Map payloads | +| sealed interface | [Player.NameBoxed](#nameboxed)
sealed interface for validated payloads | +| record | [Player.NameBoxedString](#nameboxedstring)
boxed class to store validated String payloads | +| static class | [Player.Name](#name)
schema class | + +## Player1Boxed +public sealed interface Player1Boxed
+permits
+[Player1BoxedMap](#player1boxedmap) + +sealed interface that stores validated payloads using boxed classes + +## Player1BoxedMap +public record Player1BoxedMap
+implements [Player1Boxed](#player1boxed) + +record that stores validated Map payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| Player1BoxedMap([PlayerMap](#playermap) data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| [PlayerMap](#playermap) | data()
validated payload | +| @Nullable Object | getData()
validated payload | + +## Player1 +public static class Player1
+extends JsonSchema + +A schema class that validates payloads + +## Description +a model that includes a self reference this forces properties and additionalProperties to be lazy loaded in python models because the Player class has not fully loaded when defining properties + +### Code Sample +``` +import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags; +import org.openapijsonschematools.client.configurations.SchemaConfiguration; +import org.openapijsonschematools.client.exceptions.ValidationException; +import org.openapijsonschematools.client.schemas.validation.MapUtils; +import org.openapijsonschematools.client.schemas.validation.FrozenList; +import org.openapijsonschematools.client.schemas.validation.FrozenMap; +import org.openapijsonschematools.client.components.schemas.Player; + +import java.util.Arrays; +import java.util.List; +import java.util.AbstractMap; + +static final SchemaConfiguration configuration = new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().build()); + +// Map validation +Player.PlayerMap validatedPayload = + Player.Player1.validate( + new Player.PlayerMapBuilder() + .name("a") + + .build(), + configuration +); +``` + +### Field Summary +| Modifier and Type | Field and Description | +| ----------------- | ---------------------- | +| Set> | type = Set.of(Map.class) | +| Map> | properties = Map.ofEntries(
    new PropertyEntry("name", [Name.class](#name))),
    new PropertyEntry("enemyPlayer", [Player1.class](#player1)))
)
| + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| [PlayerMap](#playermap) | validate([Map<?, ?>](#playermapbuilder) arg, SchemaConfiguration configuration) | +| [Player1BoxedMap](#player1boxedmap) | validateAndBox([Map<?, ?>](#playermapbuilder) arg, SchemaConfiguration configuration) | +| [Player1Boxed](#player1boxed) | validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) | +| @Nullable Object | validate(@Nullable Object arg, SchemaConfiguration configuration) | + +## PlayerMapBuilder +public class PlayerMapBuilder
+builder for `Map` + +A class that builds the Map input type + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| PlayerMapBuilder()
Creates a builder that contains an empty map | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| Map | build()
Returns map input that should be used with Schema.validate | +| [PlayerMapBuilder](#playermapbuilder) | name(String value) | +| [PlayerMapBuilder](#playermapbuilder) | enemyPlayer(Map value) | +| [PlayerMapBuilder](#playermapbuilder) | additionalProperty(String key, Nothing? value) | +| [PlayerMapBuilder](#playermapbuilder) | additionalProperty(String key, boolean value) | +| [PlayerMapBuilder](#playermapbuilder) | additionalProperty(String key, String value) | +| [PlayerMapBuilder](#playermapbuilder) | additionalProperty(String key, int value) | +| [PlayerMapBuilder](#playermapbuilder) | additionalProperty(String key, float value) | +| [PlayerMapBuilder](#playermapbuilder) | additionalProperty(String key, long value) | +| [PlayerMapBuilder](#playermapbuilder) | additionalProperty(String key, double value) | +| [PlayerMapBuilder](#playermapbuilder) | additionalProperty(String key, List value) | +| [PlayerMapBuilder](#playermapbuilder) | additionalProperty(String key, Map value) | + +## PlayerMap +public static class PlayerMap
+extends FrozenMap + +A class to store validated Map payloads + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| static [PlayerMap](#playermap) | of([Map](#playermapbuilder) arg, SchemaConfiguration configuration) | +| String | name()
[optional] | +| [PlayerMap](#playermap) | enemyPlayer()
[optional] | +| @Nullable Object | getAdditionalProperty(String name)
provides type safety for additional properties | + +## NameBoxed +public sealed interface NameBoxed
+permits
+[NameBoxedString](#nameboxedstring) + +sealed interface that stores validated payloads using boxed classes + +## NameBoxedString +public record NameBoxedString
+implements [NameBoxed](#nameboxed) + +record that stores validated String payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| NameBoxedString(String data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| String | data()
validated payload | +| @Nullable Object | getData()
validated payload | + +## Name +public static class Name
+extends StringJsonSchema.StringJsonSchema1 + +A schema class that validates payloads + +| Methods Inherited from class org.openapijsonschematools.client.schemas.StringJsonSchema.StringJsonSchema1 | +| ------------------------------------------------------------------ | +| validate | +| validateAndBox | + +[[Back to top]](#top) [[Back to Component Schemas]](../../../README.md#Component-Schemas) [[Back to README]](../../../README.md) diff --git a/samples/client/petstore/kotlin/docs/components/schemas/PublicKey.md b/samples/client/petstore/kotlin/docs/components/schemas/PublicKey.md new file mode 100644 index 00000000000..1b67de36d32 --- /dev/null +++ b/samples/client/petstore/kotlin/docs/components/schemas/PublicKey.md @@ -0,0 +1,172 @@ +# PublicKey +org.openapijsonschematools.client.components.schemas.PublicKey.java +public class PublicKey
+ +A class that contains necessary nested +- schema classes (which validate payloads), extends JsonSchema +- sealed interfaces which store validated payloads, java version of a sum type +- boxed classes which store validated payloads, sealed permits class implementations +- classes to store validated map payloads, extends FrozenMap +- classes to build inputs for map payloads + +## Nested Class Summary +| Modifier and Type | Class and Description | +| ----------------- | ---------------------- | +| sealed interface | [PublicKey.PublicKey1Boxed](#publickey1boxed)
sealed interface for validated payloads | +| record | [PublicKey.PublicKey1BoxedMap](#publickey1boxedmap)
boxed class to store validated Map payloads | +| static class | [PublicKey.PublicKey1](#publickey1)
schema class | +| static class | [PublicKey.PublicKeyMapBuilder](#publickeymapbuilder)
builder for Map payloads | +| static class | [PublicKey.PublicKeyMap](#publickeymap)
output class for Map payloads | +| sealed interface | [PublicKey.KeyBoxed](#keyboxed)
sealed interface for validated payloads | +| record | [PublicKey.KeyBoxedString](#keyboxedstring)
boxed class to store validated String payloads | +| static class | [PublicKey.Key](#key)
schema class | + +## PublicKey1Boxed +public sealed interface PublicKey1Boxed
+permits
+[PublicKey1BoxedMap](#publickey1boxedmap) + +sealed interface that stores validated payloads using boxed classes + +## PublicKey1BoxedMap +public record PublicKey1BoxedMap
+implements [PublicKey1Boxed](#publickey1boxed) + +record that stores validated Map payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| PublicKey1BoxedMap([PublicKeyMap](#publickeymap) data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| [PublicKeyMap](#publickeymap) | data()
validated payload | +| @Nullable Object | getData()
validated payload | + +## PublicKey1 +public static class PublicKey1
+extends JsonSchema + +A schema class that validates payloads + +## Description +schema that contains a property named key + +### Code Sample +``` +import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags; +import org.openapijsonschematools.client.configurations.SchemaConfiguration; +import org.openapijsonschematools.client.exceptions.ValidationException; +import org.openapijsonschematools.client.schemas.validation.MapUtils; +import org.openapijsonschematools.client.schemas.validation.FrozenList; +import org.openapijsonschematools.client.schemas.validation.FrozenMap; +import org.openapijsonschematools.client.components.schemas.PublicKey; + +import java.util.Arrays; +import java.util.List; +import java.util.AbstractMap; + +static final SchemaConfiguration configuration = new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().build()); + +// Map validation +PublicKey.PublicKeyMap validatedPayload = + PublicKey.PublicKey1.validate( + new PublicKey.PublicKeyMapBuilder() + .key("a") + + .build(), + configuration +); +``` + +### Field Summary +| Modifier and Type | Field and Description | +| ----------------- | ---------------------- | +| Set> | type = Set.of(Map.class) | +| Map> | properties = Map.ofEntries(
    new PropertyEntry("key", [Key.class](#key)))
)
| + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| [PublicKeyMap](#publickeymap) | validate([Map<?, ?>](#publickeymapbuilder) arg, SchemaConfiguration configuration) | +| [PublicKey1BoxedMap](#publickey1boxedmap) | validateAndBox([Map<?, ?>](#publickeymapbuilder) arg, SchemaConfiguration configuration) | +| [PublicKey1Boxed](#publickey1boxed) | validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) | +| @Nullable Object | validate(@Nullable Object arg, SchemaConfiguration configuration) | + +## PublicKeyMapBuilder +public class PublicKeyMapBuilder
+builder for `Map` + +A class that builds the Map input type + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| PublicKeyMapBuilder()
Creates a builder that contains an empty map | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| Map | build()
Returns map input that should be used with Schema.validate | +| [PublicKeyMapBuilder](#publickeymapbuilder) | key(String value) | +| [PublicKeyMapBuilder](#publickeymapbuilder) | additionalProperty(String key, Nothing? value) | +| [PublicKeyMapBuilder](#publickeymapbuilder) | additionalProperty(String key, boolean value) | +| [PublicKeyMapBuilder](#publickeymapbuilder) | additionalProperty(String key, String value) | +| [PublicKeyMapBuilder](#publickeymapbuilder) | additionalProperty(String key, int value) | +| [PublicKeyMapBuilder](#publickeymapbuilder) | additionalProperty(String key, float value) | +| [PublicKeyMapBuilder](#publickeymapbuilder) | additionalProperty(String key, long value) | +| [PublicKeyMapBuilder](#publickeymapbuilder) | additionalProperty(String key, double value) | +| [PublicKeyMapBuilder](#publickeymapbuilder) | additionalProperty(String key, List value) | +| [PublicKeyMapBuilder](#publickeymapbuilder) | additionalProperty(String key, Map value) | + +## PublicKeyMap +public static class PublicKeyMap
+extends FrozenMap + +A class to store validated Map payloads + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| static [PublicKeyMap](#publickeymap) | of([Map](#publickeymapbuilder) arg, SchemaConfiguration configuration) | +| String | key()
[optional] | +| @Nullable Object | getAdditionalProperty(String name)
provides type safety for additional properties | + +## KeyBoxed +public sealed interface KeyBoxed
+permits
+[KeyBoxedString](#keyboxedstring) + +sealed interface that stores validated payloads using boxed classes + +## KeyBoxedString +public record KeyBoxedString
+implements [KeyBoxed](#keyboxed) + +record that stores validated String payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| KeyBoxedString(String data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| String | data()
validated payload | +| @Nullable Object | getData()
validated payload | + +## Key +public static class Key
+extends StringJsonSchema.StringJsonSchema1 + +A schema class that validates payloads + +| Methods Inherited from class org.openapijsonschematools.client.schemas.StringJsonSchema.StringJsonSchema1 | +| ------------------------------------------------------------------ | +| validate | +| validateAndBox | + +[[Back to top]](#top) [[Back to Component Schemas]](../../../README.md#Component-Schemas) [[Back to README]](../../../README.md) diff --git a/samples/client/petstore/kotlin/docs/components/schemas/Quadrilateral.md b/samples/client/petstore/kotlin/docs/components/schemas/Quadrilateral.md new file mode 100644 index 00000000000..984f6f97984 --- /dev/null +++ b/samples/client/petstore/kotlin/docs/components/schemas/Quadrilateral.md @@ -0,0 +1,169 @@ +# Quadrilateral +org.openapijsonschematools.client.components.schemas.Quadrilateral.java +public class Quadrilateral
+ +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 + +## Nested Class Summary +| Modifier and Type | Class and Description | +| ----------------- | ---------------------- | +| sealed interface | [Quadrilateral.Quadrilateral1Boxed](#quadrilateral1boxed)
sealed interface for validated payloads | +| record | [Quadrilateral.Quadrilateral1BoxedVoid](#quadrilateral1boxedvoid)
boxed class to store validated null payloads | +| record | [Quadrilateral.Quadrilateral1BoxedBoolean](#quadrilateral1boxedboolean)
boxed class to store validated boolean payloads | +| record | [Quadrilateral.Quadrilateral1BoxedNumber](#quadrilateral1boxednumber)
boxed class to store validated Number payloads | +| record | [Quadrilateral.Quadrilateral1BoxedString](#quadrilateral1boxedstring)
boxed class to store validated String payloads | +| record | [Quadrilateral.Quadrilateral1BoxedList](#quadrilateral1boxedlist)
boxed class to store validated List payloads | +| record | [Quadrilateral.Quadrilateral1BoxedMap](#quadrilateral1boxedmap)
boxed class to store validated Map payloads | +| static class | [Quadrilateral.Quadrilateral1](#quadrilateral1)
schema class | + +## Quadrilateral1Boxed +public sealed interface Quadrilateral1Boxed
+permits
+[Quadrilateral1BoxedVoid](#quadrilateral1boxedvoid), +[Quadrilateral1BoxedBoolean](#quadrilateral1boxedboolean), +[Quadrilateral1BoxedNumber](#quadrilateral1boxednumber), +[Quadrilateral1BoxedString](#quadrilateral1boxedstring), +[Quadrilateral1BoxedList](#quadrilateral1boxedlist), +[Quadrilateral1BoxedMap](#quadrilateral1boxedmap) + +sealed interface that stores validated payloads using boxed classes + +## Quadrilateral1BoxedVoid +public record Quadrilateral1BoxedVoid
+implements [Quadrilateral1Boxed](#quadrilateral1boxed) + +record that stores validated null payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| Quadrilateral1BoxedVoid(Nothing? data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| Nothing? | data()
validated payload | +| @Nullable Object | getData()
validated payload | + +## Quadrilateral1BoxedBoolean +public record Quadrilateral1BoxedBoolean
+implements [Quadrilateral1Boxed](#quadrilateral1boxed) + +record that stores validated boolean payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| Quadrilateral1BoxedBoolean(boolean data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| boolean | data()
validated payload | +| @Nullable Object | getData()
validated payload | + +## Quadrilateral1BoxedNumber +public record Quadrilateral1BoxedNumber
+implements [Quadrilateral1Boxed](#quadrilateral1boxed) + +record that stores validated Number payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| Quadrilateral1BoxedNumber(Number data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| Number | data()
validated payload | +| @Nullable Object | getData()
validated payload | + +## Quadrilateral1BoxedString +public record Quadrilateral1BoxedString
+implements [Quadrilateral1Boxed](#quadrilateral1boxed) + +record that stores validated String payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| Quadrilateral1BoxedString(String data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| String | data()
validated payload | +| @Nullable Object | getData()
validated payload | + +## Quadrilateral1BoxedList +public record Quadrilateral1BoxedList
+implements [Quadrilateral1Boxed](#quadrilateral1boxed) + +record that stores validated List payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| Quadrilateral1BoxedList(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 | + +## Quadrilateral1BoxedMap +public record Quadrilateral1BoxedMap
+implements [Quadrilateral1Boxed](#quadrilateral1boxed) + +record that stores validated Map payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| Quadrilateral1BoxedMap(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 | + +## Quadrilateral1 +public static class Quadrilateral1
+extends JsonSchema + +A schema class that validates payloads + +### Field Summary +| Modifier and Type | Field and Description | +| ----------------- | ---------------------- | +| List> | oneOf = List.of(
    [SimpleQuadrilateral.SimpleQuadrilateral1.class](../../components/schemas/SimpleQuadrilateral.md#simplequadrilateral1),
    [ComplexQuadrilateral.ComplexQuadrilateral1.class](../../components/schemas/ComplexQuadrilateral.md#complexquadrilateral1)
))
| + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| String | validate(String arg, SchemaConfiguration configuration) | +| Nothing? | validate(Nothing? arg, SchemaConfiguration configuration) | +| int | validate(int arg, SchemaConfiguration configuration) | +| long | validate(long arg, SchemaConfiguration configuration) | +| float | validate(float arg, SchemaConfiguration configuration) | +| double | validate(double arg, SchemaConfiguration configuration) | +| Number | validate(Number arg, SchemaConfiguration configuration) | +| boolean | validate(boolean arg, SchemaConfiguration configuration) | +| FrozenMap<@Nullable Object> | validate(Map<?, ?> arg, SchemaConfiguration configuration) | +| FrozenList<@Nullable Object> | validate(List arg, SchemaConfiguration configuration) | +| [Quadrilateral1BoxedString](#quadrilateral1boxedstring) | validateAndBox(String arg, SchemaConfiguration configuration) | +| [Quadrilateral1BoxedVoid](#quadrilateral1boxedvoid) | validateAndBox(Nothing? arg, SchemaConfiguration configuration) | +| [Quadrilateral1BoxedNumber](#quadrilateral1boxednumber) | validateAndBox(Number arg, SchemaConfiguration configuration) | +| [Quadrilateral1BoxedBoolean](#quadrilateral1boxedboolean) | validateAndBox(boolean arg, SchemaConfiguration configuration) | +| [Quadrilateral1BoxedMap](#quadrilateral1boxedmap) | validateAndBox(Map<?, ?> arg, SchemaConfiguration configuration) | +| [Quadrilateral1BoxedList](#quadrilateral1boxedlist) | validateAndBox(List arg, SchemaConfiguration configuration) | +| [Quadrilateral1Boxed](#quadrilateral1boxed) | validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) | +| @Nullable Object | validate(@Nullable Object arg, SchemaConfiguration configuration) | + +[[Back to top]](#top) [[Back to Component Schemas]](../../../README.md#Component-Schemas) [[Back to README]](../../../README.md) diff --git a/samples/client/petstore/kotlin/docs/components/schemas/QuadrilateralInterface.md b/samples/client/petstore/kotlin/docs/components/schemas/QuadrilateralInterface.md new file mode 100644 index 00000000000..89a9ee40785 --- /dev/null +++ b/samples/client/petstore/kotlin/docs/components/schemas/QuadrilateralInterface.md @@ -0,0 +1,386 @@ +# QuadrilateralInterface +org.openapijsonschematools.client.components.schemas.QuadrilateralInterface.java +public class QuadrilateralInterface
+ +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 | [QuadrilateralInterface.QuadrilateralInterface1Boxed](#quadrilateralinterface1boxed)
sealed interface for validated payloads | +| record | [QuadrilateralInterface.QuadrilateralInterface1BoxedVoid](#quadrilateralinterface1boxedvoid)
boxed class to store validated null payloads | +| record | [QuadrilateralInterface.QuadrilateralInterface1BoxedBoolean](#quadrilateralinterface1boxedboolean)
boxed class to store validated boolean payloads | +| record | [QuadrilateralInterface.QuadrilateralInterface1BoxedNumber](#quadrilateralinterface1boxednumber)
boxed class to store validated Number payloads | +| record | [QuadrilateralInterface.QuadrilateralInterface1BoxedString](#quadrilateralinterface1boxedstring)
boxed class to store validated String payloads | +| record | [QuadrilateralInterface.QuadrilateralInterface1BoxedList](#quadrilateralinterface1boxedlist)
boxed class to store validated List payloads | +| record | [QuadrilateralInterface.QuadrilateralInterface1BoxedMap](#quadrilateralinterface1boxedmap)
boxed class to store validated Map payloads | +| static class | [QuadrilateralInterface.QuadrilateralInterface1](#quadrilateralinterface1)
schema class | +| static class | [QuadrilateralInterface.QuadrilateralInterfaceMapBuilder](#quadrilateralinterfacemapbuilder)
builder for Map payloads | +| static class | [QuadrilateralInterface.QuadrilateralInterfaceMap](#quadrilateralinterfacemap)
output class for Map payloads | +| sealed interface | [QuadrilateralInterface.QuadrilateralTypeBoxed](#quadrilateraltypeboxed)
sealed interface for validated payloads | +| record | [QuadrilateralInterface.QuadrilateralTypeBoxedString](#quadrilateraltypeboxedstring)
boxed class to store validated String payloads | +| static class | [QuadrilateralInterface.QuadrilateralType](#quadrilateraltype)
schema class | +| sealed interface | [QuadrilateralInterface.ShapeTypeBoxed](#shapetypeboxed)
sealed interface for validated payloads | +| record | [QuadrilateralInterface.ShapeTypeBoxedString](#shapetypeboxedstring)
boxed class to store validated String payloads | +| static class | [QuadrilateralInterface.ShapeType](#shapetype)
schema class | +| enum | [QuadrilateralInterface.StringShapeTypeEnums](#stringshapetypeenums)
String enum | + +## QuadrilateralInterface1Boxed +public sealed interface QuadrilateralInterface1Boxed
+permits
+[QuadrilateralInterface1BoxedVoid](#quadrilateralinterface1boxedvoid), +[QuadrilateralInterface1BoxedBoolean](#quadrilateralinterface1boxedboolean), +[QuadrilateralInterface1BoxedNumber](#quadrilateralinterface1boxednumber), +[QuadrilateralInterface1BoxedString](#quadrilateralinterface1boxedstring), +[QuadrilateralInterface1BoxedList](#quadrilateralinterface1boxedlist), +[QuadrilateralInterface1BoxedMap](#quadrilateralinterface1boxedmap) + +sealed interface that stores validated payloads using boxed classes + +## QuadrilateralInterface1BoxedVoid +public record QuadrilateralInterface1BoxedVoid
+implements [QuadrilateralInterface1Boxed](#quadrilateralinterface1boxed) + +record that stores validated null payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| QuadrilateralInterface1BoxedVoid(Nothing? data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| Nothing? | data()
validated payload | +| @Nullable Object | getData()
validated payload | + +## QuadrilateralInterface1BoxedBoolean +public record QuadrilateralInterface1BoxedBoolean
+implements [QuadrilateralInterface1Boxed](#quadrilateralinterface1boxed) + +record that stores validated boolean payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| QuadrilateralInterface1BoxedBoolean(boolean data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| boolean | data()
validated payload | +| @Nullable Object | getData()
validated payload | + +## QuadrilateralInterface1BoxedNumber +public record QuadrilateralInterface1BoxedNumber
+implements [QuadrilateralInterface1Boxed](#quadrilateralinterface1boxed) + +record that stores validated Number payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| QuadrilateralInterface1BoxedNumber(Number data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| Number | data()
validated payload | +| @Nullable Object | getData()
validated payload | + +## QuadrilateralInterface1BoxedString +public record QuadrilateralInterface1BoxedString
+implements [QuadrilateralInterface1Boxed](#quadrilateralinterface1boxed) + +record that stores validated String payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| QuadrilateralInterface1BoxedString(String data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| String | data()
validated payload | +| @Nullable Object | getData()
validated payload | + +## QuadrilateralInterface1BoxedList +public record QuadrilateralInterface1BoxedList
+implements [QuadrilateralInterface1Boxed](#quadrilateralinterface1boxed) + +record that stores validated List payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| QuadrilateralInterface1BoxedList(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 | + +## QuadrilateralInterface1BoxedMap +public record QuadrilateralInterface1BoxedMap
+implements [QuadrilateralInterface1Boxed](#quadrilateralinterface1boxed) + +record that stores validated Map payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| QuadrilateralInterface1BoxedMap([QuadrilateralInterfaceMap](#quadrilateralinterfacemap) data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| [QuadrilateralInterfaceMap](#quadrilateralinterfacemap) | data()
validated payload | +| @Nullable Object | getData()
validated payload | + +## QuadrilateralInterface1 +public static class QuadrilateralInterface1
+extends JsonSchema + +A schema class that validates payloads + +### Field Summary +| Modifier and Type | Field and Description | +| ----------------- | ---------------------- | +| Map> | properties = Map.ofEntries(
    new PropertyEntry("shapeType", [ShapeType.class](#shapetype))),
    new PropertyEntry("quadrilateralType", [QuadrilateralType.class](#quadrilateraltype)))
)
| +| Set | required = Set.of(
    "quadrilateralType",
    "shapeType"
)
| + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| String | validate(String arg, SchemaConfiguration configuration) | +| Nothing? | validate(Nothing? arg, SchemaConfiguration configuration) | +| int | validate(int arg, SchemaConfiguration configuration) | +| long | validate(long arg, SchemaConfiguration configuration) | +| float | validate(float arg, SchemaConfiguration configuration) | +| double | validate(double arg, SchemaConfiguration configuration) | +| Number | validate(Number arg, SchemaConfiguration configuration) | +| boolean | validate(boolean arg, SchemaConfiguration configuration) | +| [QuadrilateralInterfaceMap](#quadrilateralinterfacemap) | validate([Map<?, ?>](#quadrilateralinterfacemapbuilder) arg, SchemaConfiguration configuration) | +| FrozenList<@Nullable Object> | validate(List arg, SchemaConfiguration configuration) | +| [QuadrilateralInterface1BoxedString](#quadrilateralinterface1boxedstring) | validateAndBox(String arg, SchemaConfiguration configuration) | +| [QuadrilateralInterface1BoxedVoid](#quadrilateralinterface1boxedvoid) | validateAndBox(Nothing? arg, SchemaConfiguration configuration) | +| [QuadrilateralInterface1BoxedNumber](#quadrilateralinterface1boxednumber) | validateAndBox(Number arg, SchemaConfiguration configuration) | +| [QuadrilateralInterface1BoxedBoolean](#quadrilateralinterface1boxedboolean) | validateAndBox(boolean arg, SchemaConfiguration configuration) | +| [QuadrilateralInterface1BoxedMap](#quadrilateralinterface1boxedmap) | validateAndBox([Map<?, ?>](#quadrilateralinterfacemapbuilder) arg, SchemaConfiguration configuration) | +| [QuadrilateralInterface1BoxedList](#quadrilateralinterface1boxedlist) | validateAndBox(List arg, SchemaConfiguration configuration) | +| [QuadrilateralInterface1Boxed](#quadrilateralinterface1boxed) | validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) | +| @Nullable Object | validate(@Nullable Object arg, SchemaConfiguration configuration) | + +## QuadrilateralInterfaceMap00Builder +public class QuadrilateralInterfaceMap00Builder
+builder for `Map` + +A class that builds the Map input type + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| QuadrilateralInterfaceMap00Builder(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 | +| [QuadrilateralInterfaceMap00Builder](#quadrilateralinterfacemap00builder) | additionalProperty(String key, Nothing? value) | +| [QuadrilateralInterfaceMap00Builder](#quadrilateralinterfacemap00builder) | additionalProperty(String key, boolean value) | +| [QuadrilateralInterfaceMap00Builder](#quadrilateralinterfacemap00builder) | additionalProperty(String key, String value) | +| [QuadrilateralInterfaceMap00Builder](#quadrilateralinterfacemap00builder) | additionalProperty(String key, int value) | +| [QuadrilateralInterfaceMap00Builder](#quadrilateralinterfacemap00builder) | additionalProperty(String key, float value) | +| [QuadrilateralInterfaceMap00Builder](#quadrilateralinterfacemap00builder) | additionalProperty(String key, long value) | +| [QuadrilateralInterfaceMap00Builder](#quadrilateralinterfacemap00builder) | additionalProperty(String key, double value) | +| [QuadrilateralInterfaceMap00Builder](#quadrilateralinterfacemap00builder) | additionalProperty(String key, List value) | +| [QuadrilateralInterfaceMap00Builder](#quadrilateralinterfacemap00builder) | additionalProperty(String key, Map value) | + +## QuadrilateralInterfaceMap01Builder +public class QuadrilateralInterfaceMap01Builder
+builder for `Map` + +A class that builds the Map input type + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| QuadrilateralInterfaceMap01Builder(Map instance)
Creates a builder that contains the passed instance | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| [QuadrilateralInterfaceMap00Builder](#quadrilateralinterfacemap00builder) | shapeType(String value) | +| [QuadrilateralInterfaceMap00Builder](#quadrilateralinterfacemap00builder) | shapeType([StringShapeTypeEnums](#stringshapetypeenums) value) | + +## QuadrilateralInterfaceMap10Builder +public class QuadrilateralInterfaceMap10Builder
+builder for `Map` + +A class that builds the Map input type + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| QuadrilateralInterfaceMap10Builder(Map instance)
Creates a builder that contains the passed instance | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| [QuadrilateralInterfaceMap00Builder](#quadrilateralinterfacemap00builder) | quadrilateralType(String value) | + +## QuadrilateralInterfaceMapBuilder +public class QuadrilateralInterfaceMapBuilder
+builder for `Map` + +A class that builds the Map input type + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| QuadrilateralInterfaceMapBuilder()
Creates a builder that contains an empty map | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| [QuadrilateralInterfaceMap01Builder](#quadrilateralinterfacemap01builder) | quadrilateralType(String value) | +| [QuadrilateralInterfaceMap10Builder](#quadrilateralinterfacemap10builder) | shapeType(String value) | +| [QuadrilateralInterfaceMap10Builder](#quadrilateralinterfacemap10builder) | shapeType([StringShapeTypeEnums](#stringshapetypeenums) value) | + +## QuadrilateralInterfaceMap +public static class QuadrilateralInterfaceMap
+extends FrozenMap + +A class to store validated Map payloads + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| static [QuadrilateralInterfaceMap](#quadrilateralinterfacemap) | of([Map](#quadrilateralinterfacemapbuilder) arg, SchemaConfiguration configuration) | +| String | quadrilateralType()
| +| String | shapeType()
must be one of ["Quadrilateral"] | +| @Nullable Object | getAdditionalProperty(String name)
provides type safety for additional properties | + +## QuadrilateralTypeBoxed +public sealed interface QuadrilateralTypeBoxed
+permits
+[QuadrilateralTypeBoxedString](#quadrilateraltypeboxedstring) + +sealed interface that stores validated payloads using boxed classes + +## QuadrilateralTypeBoxedString +public record QuadrilateralTypeBoxedString
+implements [QuadrilateralTypeBoxed](#quadrilateraltypeboxed) + +record that stores validated String payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| QuadrilateralTypeBoxedString(String data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| String | data()
validated payload | +| @Nullable Object | getData()
validated payload | + +## QuadrilateralType +public static class QuadrilateralType
+extends StringJsonSchema.StringJsonSchema1 + +A schema class that validates payloads + +| Methods Inherited from class org.openapijsonschematools.client.schemas.StringJsonSchema.StringJsonSchema1 | +| ------------------------------------------------------------------ | +| validate | +| validateAndBox | + +## ShapeTypeBoxed +public sealed interface ShapeTypeBoxed
+permits
+[ShapeTypeBoxedString](#shapetypeboxedstring) + +sealed interface that stores validated payloads using boxed classes + +## ShapeTypeBoxedString +public record ShapeTypeBoxedString
+implements [ShapeTypeBoxed](#shapetypeboxed) + +record that stores validated String payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| ShapeTypeBoxedString(String data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| String | data()
validated payload | +| @Nullable Object | getData()
validated payload | + +## ShapeType +public static class ShapeType
+extends JsonSchema + +A schema class that validates payloads + +### Code Sample +``` +import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags; +import org.openapijsonschematools.client.configurations.SchemaConfiguration; +import org.openapijsonschematools.client.exceptions.ValidationException; +import org.openapijsonschematools.client.schemas.validation.MapUtils; +import org.openapijsonschematools.client.schemas.validation.FrozenList; +import org.openapijsonschematools.client.schemas.validation.FrozenMap; +import org.openapijsonschematools.client.components.schemas.QuadrilateralInterface; + +import java.util.Arrays; +import java.util.List; +import java.util.AbstractMap; + +static final SchemaConfiguration configuration = new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().build()); + +// String validation +String validatedPayload = QuadrilateralInterface.ShapeType.validate( + "Quadrilateral", + configuration +); +``` + +### Field Summary +| Modifier and Type | Field and Description | +| ----------------- | ---------------------- | +| Set> | type = Set.of(
    String.class
)
| +| Set | enumValues = SetMaker.makeSet(
    "Quadrilateral"
)
| + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| String | validate(String arg, SchemaConfiguration configuration) | +| String | validate([StringShapeTypeEnums](#stringshapetypeenums) arg, SchemaConfiguration configuration) | +| [ShapeTypeBoxedString](#shapetypeboxedstring) | validateAndBox(String arg, SchemaConfiguration configuration) | +| [ShapeTypeBoxed](#shapetypeboxed) | validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) | +| @Nullable Object | validate(@Nullable Object arg, SchemaConfiguration configuration) | + +## StringShapeTypeEnums +public enum StringShapeTypeEnums
+extends `Enum` + +A class that stores String enum values + +### Enum Constant Summary +| Enum Constant | Description | +| ------------- | ----------- | +| QUADRILATERAL | value = "Quadrilateral" | + +[[Back to top]](#top) [[Back to Component Schemas]](../../../README.md#Component-Schemas) [[Back to README]](../../../README.md) diff --git a/samples/client/petstore/kotlin/docs/components/schemas/ReadOnlyFirst.md b/samples/client/petstore/kotlin/docs/components/schemas/ReadOnlyFirst.md new file mode 100644 index 00000000000..4ec4c950ba8 --- /dev/null +++ b/samples/client/petstore/kotlin/docs/components/schemas/ReadOnlyFirst.md @@ -0,0 +1,211 @@ +# ReadOnlyFirst +org.openapijsonschematools.client.components.schemas.ReadOnlyFirst.java +public class ReadOnlyFirst
+ +A class that contains necessary nested +- schema classes (which validate payloads), extends JsonSchema +- sealed interfaces which store validated payloads, java version of a sum type +- boxed classes which store validated payloads, sealed permits class implementations +- classes to store validated map payloads, extends FrozenMap +- classes to build inputs for map payloads + +## Nested Class Summary +| Modifier and Type | Class and Description | +| ----------------- | ---------------------- | +| sealed interface | [ReadOnlyFirst.ReadOnlyFirst1Boxed](#readonlyfirst1boxed)
sealed interface for validated payloads | +| record | [ReadOnlyFirst.ReadOnlyFirst1BoxedMap](#readonlyfirst1boxedmap)
boxed class to store validated Map payloads | +| static class | [ReadOnlyFirst.ReadOnlyFirst1](#readonlyfirst1)
schema class | +| static class | [ReadOnlyFirst.ReadOnlyFirstMapBuilder](#readonlyfirstmapbuilder)
builder for Map payloads | +| static class | [ReadOnlyFirst.ReadOnlyFirstMap](#readonlyfirstmap)
output class for Map payloads | +| sealed interface | [ReadOnlyFirst.BazBoxed](#bazboxed)
sealed interface for validated payloads | +| record | [ReadOnlyFirst.BazBoxedString](#bazboxedstring)
boxed class to store validated String payloads | +| static class | [ReadOnlyFirst.Baz](#baz)
schema class | +| sealed interface | [ReadOnlyFirst.BarBoxed](#barboxed)
sealed interface for validated payloads | +| record | [ReadOnlyFirst.BarBoxedString](#barboxedstring)
boxed class to store validated String payloads | +| static class | [ReadOnlyFirst.Bar](#bar)
schema class | + +## ReadOnlyFirst1Boxed +public sealed interface ReadOnlyFirst1Boxed
+permits
+[ReadOnlyFirst1BoxedMap](#readonlyfirst1boxedmap) + +sealed interface that stores validated payloads using boxed classes + +## ReadOnlyFirst1BoxedMap +public record ReadOnlyFirst1BoxedMap
+implements [ReadOnlyFirst1Boxed](#readonlyfirst1boxed) + +record that stores validated Map payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| ReadOnlyFirst1BoxedMap([ReadOnlyFirstMap](#readonlyfirstmap) data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| [ReadOnlyFirstMap](#readonlyfirstmap) | data()
validated payload | +| @Nullable Object | getData()
validated payload | + +## ReadOnlyFirst1 +public static class ReadOnlyFirst1
+extends JsonSchema + +A schema class that validates payloads + +### Code Sample +``` +import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags; +import org.openapijsonschematools.client.configurations.SchemaConfiguration; +import org.openapijsonschematools.client.exceptions.ValidationException; +import org.openapijsonschematools.client.schemas.validation.MapUtils; +import org.openapijsonschematools.client.schemas.validation.FrozenList; +import org.openapijsonschematools.client.schemas.validation.FrozenMap; +import org.openapijsonschematools.client.components.schemas.ReadOnlyFirst; + +import java.util.Arrays; +import java.util.List; +import java.util.AbstractMap; + +static final SchemaConfiguration configuration = new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().build()); + +// Map validation +ReadOnlyFirst.ReadOnlyFirstMap validatedPayload = + ReadOnlyFirst.ReadOnlyFirst1.validate( + new ReadOnlyFirst.ReadOnlyFirstMapBuilder() + .bar("a") + + .baz("a") + + .build(), + configuration +); +``` + +### Field Summary +| Modifier and Type | Field and Description | +| ----------------- | ---------------------- | +| Set> | type = Set.of(Map.class) | +| Map> | properties = Map.ofEntries(
    new PropertyEntry("bar", [Bar.class](#bar))),
    new PropertyEntry("baz", [Baz.class](#baz)))
)
| + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| [ReadOnlyFirstMap](#readonlyfirstmap) | validate([Map<?, ?>](#readonlyfirstmapbuilder) arg, SchemaConfiguration configuration) | +| [ReadOnlyFirst1BoxedMap](#readonlyfirst1boxedmap) | validateAndBox([Map<?, ?>](#readonlyfirstmapbuilder) arg, SchemaConfiguration configuration) | +| [ReadOnlyFirst1Boxed](#readonlyfirst1boxed) | validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) | +| @Nullable Object | validate(@Nullable Object arg, SchemaConfiguration configuration) | + +## ReadOnlyFirstMapBuilder +public class ReadOnlyFirstMapBuilder
+builder for `Map` + +A class that builds the Map input type + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| ReadOnlyFirstMapBuilder()
Creates a builder that contains an empty map | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| Map | build()
Returns map input that should be used with Schema.validate | +| [ReadOnlyFirstMapBuilder](#readonlyfirstmapbuilder) | bar(String value) | +| [ReadOnlyFirstMapBuilder](#readonlyfirstmapbuilder) | baz(String value) | +| [ReadOnlyFirstMapBuilder](#readonlyfirstmapbuilder) | additionalProperty(String key, Nothing? value) | +| [ReadOnlyFirstMapBuilder](#readonlyfirstmapbuilder) | additionalProperty(String key, boolean value) | +| [ReadOnlyFirstMapBuilder](#readonlyfirstmapbuilder) | additionalProperty(String key, String value) | +| [ReadOnlyFirstMapBuilder](#readonlyfirstmapbuilder) | additionalProperty(String key, int value) | +| [ReadOnlyFirstMapBuilder](#readonlyfirstmapbuilder) | additionalProperty(String key, float value) | +| [ReadOnlyFirstMapBuilder](#readonlyfirstmapbuilder) | additionalProperty(String key, long value) | +| [ReadOnlyFirstMapBuilder](#readonlyfirstmapbuilder) | additionalProperty(String key, double value) | +| [ReadOnlyFirstMapBuilder](#readonlyfirstmapbuilder) | additionalProperty(String key, List value) | +| [ReadOnlyFirstMapBuilder](#readonlyfirstmapbuilder) | additionalProperty(String key, Map value) | + +## ReadOnlyFirstMap +public static class ReadOnlyFirstMap
+extends FrozenMap + +A class to store validated Map payloads + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| static [ReadOnlyFirstMap](#readonlyfirstmap) | of([Map](#readonlyfirstmapbuilder) arg, SchemaConfiguration configuration) | +| String | bar()
[optional] | +| String | baz()
[optional] | +| @Nullable Object | getAdditionalProperty(String name)
provides type safety for additional properties | + +## BazBoxed +public sealed interface BazBoxed
+permits
+[BazBoxedString](#bazboxedstring) + +sealed interface that stores validated payloads using boxed classes + +## BazBoxedString +public record BazBoxedString
+implements [BazBoxed](#bazboxed) + +record that stores validated String payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| BazBoxedString(String data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| String | data()
validated payload | +| @Nullable Object | getData()
validated payload | + +## Baz +public static class Baz
+extends StringJsonSchema.StringJsonSchema1 + +A schema class that validates payloads + +| Methods Inherited from class org.openapijsonschematools.client.schemas.StringJsonSchema.StringJsonSchema1 | +| ------------------------------------------------------------------ | +| validate | +| validateAndBox | + +## BarBoxed +public sealed interface BarBoxed
+permits
+[BarBoxedString](#barboxedstring) + +sealed interface that stores validated payloads using boxed classes + +## BarBoxedString +public record BarBoxedString
+implements [BarBoxed](#barboxed) + +record that stores validated String payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| BarBoxedString(String data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| String | data()
validated payload | +| @Nullable Object | getData()
validated payload | + +## Bar +public static class Bar
+extends StringJsonSchema.StringJsonSchema1 + +A schema class that validates payloads + +| Methods Inherited from class org.openapijsonschematools.client.schemas.StringJsonSchema.StringJsonSchema1 | +| ------------------------------------------------------------------ | +| validate | +| validateAndBox | + +[[Back to top]](#top) [[Back to Component Schemas]](../../../README.md#Component-Schemas) [[Back to README]](../../../README.md) diff --git a/samples/client/petstore/kotlin/docs/components/schemas/RefPet.md b/samples/client/petstore/kotlin/docs/components/schemas/RefPet.md new file mode 100644 index 00000000000..73e54bfa49a --- /dev/null +++ b/samples/client/petstore/kotlin/docs/components/schemas/RefPet.md @@ -0,0 +1,22 @@ +# RefPet +org.openapijsonschematools.client.components.schemas.RefPet.java +public class RefPet
+extends [Pet1](../../components/schemas/Pet.md#pet) + +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 + +## Nested Class Summary +| Modifier and Type | Class and Description | +| ----------------- | ---------------------- | +| static class | [RefPet.RefPet1](#refpet1)
schema class | + +## RefPet1 +public static class RefPet1
+extends [Pet.Pet1](../../components/schemas/Pet.md#pet1) + +A schema class that validates payloads + +[[Back to top]](#top) [[Back to Component Schemas]](../../../README.md#Component-Schemas) [[Back to README]](../../../README.md) diff --git a/samples/client/petstore/kotlin/docs/components/schemas/ReqPropsFromExplicitAddProps.md b/samples/client/petstore/kotlin/docs/components/schemas/ReqPropsFromExplicitAddProps.md new file mode 100644 index 00000000000..051029fca2e --- /dev/null +++ b/samples/client/petstore/kotlin/docs/components/schemas/ReqPropsFromExplicitAddProps.md @@ -0,0 +1,211 @@ +# ReqPropsFromExplicitAddProps +org.openapijsonschematools.client.components.schemas.ReqPropsFromExplicitAddProps.java +public class ReqPropsFromExplicitAddProps
+ +A class that contains necessary nested +- schema classes (which validate payloads), extends JsonSchema +- sealed interfaces which store validated payloads, java version of a sum type +- boxed classes which store validated payloads, sealed permits class implementations +- classes to store validated map payloads, extends FrozenMap +- classes to build inputs for map payloads + +## Nested Class Summary +| Modifier and Type | Class and Description | +| ----------------- | ---------------------- | +| sealed interface | [ReqPropsFromExplicitAddProps.ReqPropsFromExplicitAddProps1Boxed](#reqpropsfromexplicitaddprops1boxed)
sealed interface for validated payloads | +| record | [ReqPropsFromExplicitAddProps.ReqPropsFromExplicitAddProps1BoxedMap](#reqpropsfromexplicitaddprops1boxedmap)
boxed class to store validated Map payloads | +| static class | [ReqPropsFromExplicitAddProps.ReqPropsFromExplicitAddProps1](#reqpropsfromexplicitaddprops1)
schema class | +| static class | [ReqPropsFromExplicitAddProps.ReqPropsFromExplicitAddPropsMapBuilder](#reqpropsfromexplicitaddpropsmapbuilder)
builder for Map payloads | +| static class | [ReqPropsFromExplicitAddProps.ReqPropsFromExplicitAddPropsMap](#reqpropsfromexplicitaddpropsmap)
output class for Map payloads | +| sealed interface | [ReqPropsFromExplicitAddProps.AdditionalPropertiesBoxed](#additionalpropertiesboxed)
sealed interface for validated payloads | +| record | [ReqPropsFromExplicitAddProps.AdditionalPropertiesBoxedString](#additionalpropertiesboxedstring)
boxed class to store validated String payloads | +| static class | [ReqPropsFromExplicitAddProps.AdditionalProperties](#additionalproperties)
schema class | + +## ReqPropsFromExplicitAddProps1Boxed +public sealed interface ReqPropsFromExplicitAddProps1Boxed
+permits
+[ReqPropsFromExplicitAddProps1BoxedMap](#reqpropsfromexplicitaddprops1boxedmap) + +sealed interface that stores validated payloads using boxed classes + +## ReqPropsFromExplicitAddProps1BoxedMap +public record ReqPropsFromExplicitAddProps1BoxedMap
+implements [ReqPropsFromExplicitAddProps1Boxed](#reqpropsfromexplicitaddprops1boxed) + +record that stores validated Map payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| ReqPropsFromExplicitAddProps1BoxedMap([ReqPropsFromExplicitAddPropsMap](#reqpropsfromexplicitaddpropsmap) data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| [ReqPropsFromExplicitAddPropsMap](#reqpropsfromexplicitaddpropsmap) | data()
validated payload | +| @Nullable Object | getData()
validated payload | + +## ReqPropsFromExplicitAddProps1 +public static class ReqPropsFromExplicitAddProps1
+extends JsonSchema + +A schema class that validates payloads + +### Code Sample +``` +import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags; +import org.openapijsonschematools.client.configurations.SchemaConfiguration; +import org.openapijsonschematools.client.exceptions.ValidationException; +import org.openapijsonschematools.client.schemas.validation.MapUtils; +import org.openapijsonschematools.client.schemas.validation.FrozenList; +import org.openapijsonschematools.client.schemas.validation.FrozenMap; +import org.openapijsonschematools.client.components.schemas.ReqPropsFromExplicitAddProps; + +import java.util.Arrays; +import java.util.List; +import java.util.AbstractMap; + +static final SchemaConfiguration configuration = new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().build()); + +// Map validation +ReqPropsFromExplicitAddProps.ReqPropsFromExplicitAddPropsMap validatedPayload = + ReqPropsFromExplicitAddProps.ReqPropsFromExplicitAddProps1.validate( + new ReqPropsFromExplicitAddProps.ReqPropsFromExplicitAddPropsMapBuilder() + .invalidHyphenMinusName("a") + + .build(), + configuration +); +``` + +### Field Summary +| Modifier and Type | Field and Description | +| ----------------- | ---------------------- | +| Set> | type = Set.of(Map.class) | +| Set | required = Set.of(
    "invalid-name",
    "validName"
)
| +| Class | additionalProperties = [AdditionalProperties.class](#additionalproperties) | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| [ReqPropsFromExplicitAddPropsMap](#reqpropsfromexplicitaddpropsmap) | validate([Map<?, ?>](#reqpropsfromexplicitaddpropsmapbuilder) arg, SchemaConfiguration configuration) | +| [ReqPropsFromExplicitAddProps1BoxedMap](#reqpropsfromexplicitaddprops1boxedmap) | validateAndBox([Map<?, ?>](#reqpropsfromexplicitaddpropsmapbuilder) arg, SchemaConfiguration configuration) | +| [ReqPropsFromExplicitAddProps1Boxed](#reqpropsfromexplicitaddprops1boxed) | validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) | +| @Nullable Object | validate(@Nullable Object arg, SchemaConfiguration configuration) | + +## ReqPropsFromExplicitAddPropsMap00Builder +public class ReqPropsFromExplicitAddPropsMap00Builder
+builder for `Map` + +A class that builds the Map input type + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| ReqPropsFromExplicitAddPropsMap00Builder(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 | +| [ReqPropsFromExplicitAddPropsMap00Builder](#reqpropsfromexplicitaddpropsmap00builder) | additionalProperty(String key, String value) | + +## ReqPropsFromExplicitAddPropsMap01Builder +public class ReqPropsFromExplicitAddPropsMap01Builder
+builder for `Map` + +A class that builds the Map input type + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| ReqPropsFromExplicitAddPropsMap01Builder(Map instance)
Creates a builder that contains the passed instance | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| [ReqPropsFromExplicitAddPropsMap00Builder](#reqpropsfromexplicitaddpropsmap00builder) | validName(String value) | + +## ReqPropsFromExplicitAddPropsMap10Builder +public class ReqPropsFromExplicitAddPropsMap10Builder
+builder for `Map` + +A class that builds the Map input type + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| ReqPropsFromExplicitAddPropsMap10Builder(Map instance)
Creates a builder that contains the passed instance | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| [ReqPropsFromExplicitAddPropsMap00Builder](#reqpropsfromexplicitaddpropsmap00builder) | invalidHyphenMinusName(String value) | + +## ReqPropsFromExplicitAddPropsMapBuilder +public class ReqPropsFromExplicitAddPropsMapBuilder
+builder for `Map` + +A class that builds the Map input type + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| ReqPropsFromExplicitAddPropsMapBuilder()
Creates a builder that contains an empty map | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| [ReqPropsFromExplicitAddPropsMap01Builder](#reqpropsfromexplicitaddpropsmap01builder) | invalidHyphenMinusName(String value) | +| [ReqPropsFromExplicitAddPropsMap10Builder](#reqpropsfromexplicitaddpropsmap10builder) | validName(String value) | + +## ReqPropsFromExplicitAddPropsMap +public static class ReqPropsFromExplicitAddPropsMap
+extends FrozenMap + +A class to store validated Map payloads + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| static [ReqPropsFromExplicitAddPropsMap](#reqpropsfromexplicitaddpropsmap) | of([Map](#reqpropsfromexplicitaddpropsmapbuilder) arg, SchemaConfiguration configuration) | +| String | validName()
| +| String | get(String key)
This schema has invalid Java names so this method must be used when you access instance["invalid-name"], | +| String | getAdditionalProperty(String name)
provides type safety for additional properties | + +## AdditionalPropertiesBoxed +public sealed interface AdditionalPropertiesBoxed
+permits
+[AdditionalPropertiesBoxedString](#additionalpropertiesboxedstring) + +sealed interface that stores validated payloads using boxed classes + +## 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 | + +## AdditionalProperties +public static class AdditionalProperties
+extends StringJsonSchema.StringJsonSchema1 + +A schema class that validates payloads + +| Methods Inherited from class org.openapijsonschematools.client.schemas.StringJsonSchema.StringJsonSchema1 | +| ------------------------------------------------------------------ | +| validate | +| validateAndBox | + +[[Back to top]](#top) [[Back to Component Schemas]](../../../README.md#Component-Schemas) [[Back to README]](../../../README.md) diff --git a/samples/client/petstore/kotlin/docs/components/schemas/ReqPropsFromTrueAddProps.md b/samples/client/petstore/kotlin/docs/components/schemas/ReqPropsFromTrueAddProps.md new file mode 100644 index 00000000000..9dff9f9ec9b --- /dev/null +++ b/samples/client/petstore/kotlin/docs/components/schemas/ReqPropsFromTrueAddProps.md @@ -0,0 +1,344 @@ +# ReqPropsFromTrueAddProps +org.openapijsonschematools.client.components.schemas.ReqPropsFromTrueAddProps.java +public class ReqPropsFromTrueAddProps
+ +A class that contains necessary nested +- schema classes (which validate payloads), extends JsonSchema +- sealed interfaces which store validated payloads, java version of a sum type +- boxed classes which store validated payloads, sealed permits class implementations +- classes to store validated map payloads, extends FrozenMap +- classes to build inputs for map payloads + +## Nested Class Summary +| Modifier and Type | Class and Description | +| ----------------- | ---------------------- | +| sealed interface | [ReqPropsFromTrueAddProps.ReqPropsFromTrueAddProps1Boxed](#reqpropsfromtrueaddprops1boxed)
sealed interface for validated payloads | +| record | [ReqPropsFromTrueAddProps.ReqPropsFromTrueAddProps1BoxedMap](#reqpropsfromtrueaddprops1boxedmap)
boxed class to store validated Map payloads | +| static class | [ReqPropsFromTrueAddProps.ReqPropsFromTrueAddProps1](#reqpropsfromtrueaddprops1)
schema class | +| static class | [ReqPropsFromTrueAddProps.ReqPropsFromTrueAddPropsMapBuilder](#reqpropsfromtrueaddpropsmapbuilder)
builder for Map payloads | +| static class | [ReqPropsFromTrueAddProps.ReqPropsFromTrueAddPropsMap](#reqpropsfromtrueaddpropsmap)
output class for Map payloads | +| sealed interface | [ReqPropsFromTrueAddProps.AdditionalPropertiesBoxed](#additionalpropertiesboxed)
sealed interface for validated payloads | +| record | [ReqPropsFromTrueAddProps.AdditionalPropertiesBoxedVoid](#additionalpropertiesboxedvoid)
boxed class to store validated null payloads | +| record | [ReqPropsFromTrueAddProps.AdditionalPropertiesBoxedBoolean](#additionalpropertiesboxedboolean)
boxed class to store validated boolean payloads | +| record | [ReqPropsFromTrueAddProps.AdditionalPropertiesBoxedNumber](#additionalpropertiesboxednumber)
boxed class to store validated Number payloads | +| record | [ReqPropsFromTrueAddProps.AdditionalPropertiesBoxedString](#additionalpropertiesboxedstring)
boxed class to store validated String payloads | +| record | [ReqPropsFromTrueAddProps.AdditionalPropertiesBoxedList](#additionalpropertiesboxedlist)
boxed class to store validated List payloads | +| record | [ReqPropsFromTrueAddProps.AdditionalPropertiesBoxedMap](#additionalpropertiesboxedmap)
boxed class to store validated Map payloads | +| static class | [ReqPropsFromTrueAddProps.AdditionalProperties](#additionalproperties)
schema class | + +## ReqPropsFromTrueAddProps1Boxed +public sealed interface ReqPropsFromTrueAddProps1Boxed
+permits
+[ReqPropsFromTrueAddProps1BoxedMap](#reqpropsfromtrueaddprops1boxedmap) + +sealed interface that stores validated payloads using boxed classes + +## ReqPropsFromTrueAddProps1BoxedMap +public record ReqPropsFromTrueAddProps1BoxedMap
+implements [ReqPropsFromTrueAddProps1Boxed](#reqpropsfromtrueaddprops1boxed) + +record that stores validated Map payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| ReqPropsFromTrueAddProps1BoxedMap([ReqPropsFromTrueAddPropsMap](#reqpropsfromtrueaddpropsmap) data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| [ReqPropsFromTrueAddPropsMap](#reqpropsfromtrueaddpropsmap) | data()
validated payload | +| @Nullable Object | getData()
validated payload | + +## ReqPropsFromTrueAddProps1 +public static class ReqPropsFromTrueAddProps1
+extends JsonSchema + +A schema class that validates payloads + +### Code Sample +``` +import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags; +import org.openapijsonschematools.client.configurations.SchemaConfiguration; +import org.openapijsonschematools.client.exceptions.ValidationException; +import org.openapijsonschematools.client.schemas.validation.MapUtils; +import org.openapijsonschematools.client.schemas.validation.FrozenList; +import org.openapijsonschematools.client.schemas.validation.FrozenMap; +import org.openapijsonschematools.client.components.schemas.ReqPropsFromTrueAddProps; + +import java.util.Arrays; +import java.util.List; +import java.util.AbstractMap; + +static final SchemaConfiguration configuration = new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().build()); + +// Map validation +ReqPropsFromTrueAddProps.ReqPropsFromTrueAddPropsMap validatedPayload = + ReqPropsFromTrueAddProps.ReqPropsFromTrueAddProps1.validate( + new ReqPropsFromTrueAddProps.ReqPropsFromTrueAddPropsMapBuilder() + .build(), + configuration +); +``` + +### Field Summary +| Modifier and Type | Field and Description | +| ----------------- | ---------------------- | +| Set> | type = Set.of(Map.class) | +| Set | required = Set.of(
    "invalid-name",
    "validName"
)
| +| Class | additionalProperties = [AdditionalProperties.class](#additionalproperties) | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| [ReqPropsFromTrueAddPropsMap](#reqpropsfromtrueaddpropsmap) | validate([Map<?, ?>](#reqpropsfromtrueaddpropsmapbuilder) arg, SchemaConfiguration configuration) | +| [ReqPropsFromTrueAddProps1BoxedMap](#reqpropsfromtrueaddprops1boxedmap) | validateAndBox([Map<?, ?>](#reqpropsfromtrueaddpropsmapbuilder) arg, SchemaConfiguration configuration) | +| [ReqPropsFromTrueAddProps1Boxed](#reqpropsfromtrueaddprops1boxed) | validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) | +| @Nullable Object | validate(@Nullable Object arg, SchemaConfiguration configuration) | + +## ReqPropsFromTrueAddPropsMap00Builder +public class ReqPropsFromTrueAddPropsMap00Builder
+builder for `Map` + +A class that builds the Map input type + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| ReqPropsFromTrueAddPropsMap00Builder(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 | +| [ReqPropsFromTrueAddPropsMap00Builder](#reqpropsfromtrueaddpropsmap00builder) | additionalProperty(String key, Nothing? value) | +| [ReqPropsFromTrueAddPropsMap00Builder](#reqpropsfromtrueaddpropsmap00builder) | additionalProperty(String key, boolean value) | +| [ReqPropsFromTrueAddPropsMap00Builder](#reqpropsfromtrueaddpropsmap00builder) | additionalProperty(String key, String value) | +| [ReqPropsFromTrueAddPropsMap00Builder](#reqpropsfromtrueaddpropsmap00builder) | additionalProperty(String key, int value) | +| [ReqPropsFromTrueAddPropsMap00Builder](#reqpropsfromtrueaddpropsmap00builder) | additionalProperty(String key, float value) | +| [ReqPropsFromTrueAddPropsMap00Builder](#reqpropsfromtrueaddpropsmap00builder) | additionalProperty(String key, long value) | +| [ReqPropsFromTrueAddPropsMap00Builder](#reqpropsfromtrueaddpropsmap00builder) | additionalProperty(String key, double value) | +| [ReqPropsFromTrueAddPropsMap00Builder](#reqpropsfromtrueaddpropsmap00builder) | additionalProperty(String key, List value) | +| [ReqPropsFromTrueAddPropsMap00Builder](#reqpropsfromtrueaddpropsmap00builder) | additionalProperty(String key, Map value) | + +## ReqPropsFromTrueAddPropsMap01Builder +public class ReqPropsFromTrueAddPropsMap01Builder
+builder for `Map` + +A class that builds the Map input type + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| ReqPropsFromTrueAddPropsMap01Builder(Map instance)
Creates a builder that contains the passed instance | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| [ReqPropsFromTrueAddPropsMap00Builder](#reqpropsfromtrueaddpropsmap00builder) | validName(Nothing? value) | +| [ReqPropsFromTrueAddPropsMap00Builder](#reqpropsfromtrueaddpropsmap00builder) | validName(boolean value) | +| [ReqPropsFromTrueAddPropsMap00Builder](#reqpropsfromtrueaddpropsmap00builder) | validName(String value) | +| [ReqPropsFromTrueAddPropsMap00Builder](#reqpropsfromtrueaddpropsmap00builder) | validName(int value) | +| [ReqPropsFromTrueAddPropsMap00Builder](#reqpropsfromtrueaddpropsmap00builder) | validName(float value) | +| [ReqPropsFromTrueAddPropsMap00Builder](#reqpropsfromtrueaddpropsmap00builder) | validName(long value) | +| [ReqPropsFromTrueAddPropsMap00Builder](#reqpropsfromtrueaddpropsmap00builder) | validName(double value) | +| [ReqPropsFromTrueAddPropsMap00Builder](#reqpropsfromtrueaddpropsmap00builder) | validName(List value) | +| [ReqPropsFromTrueAddPropsMap00Builder](#reqpropsfromtrueaddpropsmap00builder) | validName(Map value) | + +## ReqPropsFromTrueAddPropsMap10Builder +public class ReqPropsFromTrueAddPropsMap10Builder
+builder for `Map` + +A class that builds the Map input type + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| ReqPropsFromTrueAddPropsMap10Builder(Map instance)
Creates a builder that contains the passed instance | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| [ReqPropsFromTrueAddPropsMap00Builder](#reqpropsfromtrueaddpropsmap00builder) | invalidHyphenMinusName(Nothing? value) | +| [ReqPropsFromTrueAddPropsMap00Builder](#reqpropsfromtrueaddpropsmap00builder) | invalidHyphenMinusName(boolean value) | +| [ReqPropsFromTrueAddPropsMap00Builder](#reqpropsfromtrueaddpropsmap00builder) | invalidHyphenMinusName(String value) | +| [ReqPropsFromTrueAddPropsMap00Builder](#reqpropsfromtrueaddpropsmap00builder) | invalidHyphenMinusName(int value) | +| [ReqPropsFromTrueAddPropsMap00Builder](#reqpropsfromtrueaddpropsmap00builder) | invalidHyphenMinusName(float value) | +| [ReqPropsFromTrueAddPropsMap00Builder](#reqpropsfromtrueaddpropsmap00builder) | invalidHyphenMinusName(long value) | +| [ReqPropsFromTrueAddPropsMap00Builder](#reqpropsfromtrueaddpropsmap00builder) | invalidHyphenMinusName(double value) | +| [ReqPropsFromTrueAddPropsMap00Builder](#reqpropsfromtrueaddpropsmap00builder) | invalidHyphenMinusName(List value) | +| [ReqPropsFromTrueAddPropsMap00Builder](#reqpropsfromtrueaddpropsmap00builder) | invalidHyphenMinusName(Map value) | + +## ReqPropsFromTrueAddPropsMapBuilder +public class ReqPropsFromTrueAddPropsMapBuilder
+builder for `Map` + +A class that builds the Map input type + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| ReqPropsFromTrueAddPropsMapBuilder()
Creates a builder that contains an empty map | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| [ReqPropsFromTrueAddPropsMap01Builder](#reqpropsfromtrueaddpropsmap01builder) | invalidHyphenMinusName(Nothing? value) | +| [ReqPropsFromTrueAddPropsMap01Builder](#reqpropsfromtrueaddpropsmap01builder) | invalidHyphenMinusName(boolean value) | +| [ReqPropsFromTrueAddPropsMap01Builder](#reqpropsfromtrueaddpropsmap01builder) | invalidHyphenMinusName(String value) | +| [ReqPropsFromTrueAddPropsMap01Builder](#reqpropsfromtrueaddpropsmap01builder) | invalidHyphenMinusName(int value) | +| [ReqPropsFromTrueAddPropsMap01Builder](#reqpropsfromtrueaddpropsmap01builder) | invalidHyphenMinusName(float value) | +| [ReqPropsFromTrueAddPropsMap01Builder](#reqpropsfromtrueaddpropsmap01builder) | invalidHyphenMinusName(long value) | +| [ReqPropsFromTrueAddPropsMap01Builder](#reqpropsfromtrueaddpropsmap01builder) | invalidHyphenMinusName(double value) | +| [ReqPropsFromTrueAddPropsMap01Builder](#reqpropsfromtrueaddpropsmap01builder) | invalidHyphenMinusName(List value) | +| [ReqPropsFromTrueAddPropsMap01Builder](#reqpropsfromtrueaddpropsmap01builder) | invalidHyphenMinusName(Map value) | +| [ReqPropsFromTrueAddPropsMap10Builder](#reqpropsfromtrueaddpropsmap10builder) | validName(Nothing? value) | +| [ReqPropsFromTrueAddPropsMap10Builder](#reqpropsfromtrueaddpropsmap10builder) | validName(boolean value) | +| [ReqPropsFromTrueAddPropsMap10Builder](#reqpropsfromtrueaddpropsmap10builder) | validName(String value) | +| [ReqPropsFromTrueAddPropsMap10Builder](#reqpropsfromtrueaddpropsmap10builder) | validName(int value) | +| [ReqPropsFromTrueAddPropsMap10Builder](#reqpropsfromtrueaddpropsmap10builder) | validName(float value) | +| [ReqPropsFromTrueAddPropsMap10Builder](#reqpropsfromtrueaddpropsmap10builder) | validName(long value) | +| [ReqPropsFromTrueAddPropsMap10Builder](#reqpropsfromtrueaddpropsmap10builder) | validName(double value) | +| [ReqPropsFromTrueAddPropsMap10Builder](#reqpropsfromtrueaddpropsmap10builder) | validName(List value) | +| [ReqPropsFromTrueAddPropsMap10Builder](#reqpropsfromtrueaddpropsmap10builder) | validName(Map value) | + +## ReqPropsFromTrueAddPropsMap +public static class ReqPropsFromTrueAddPropsMap
+extends FrozenMap + +A class to store validated Map payloads + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| static [ReqPropsFromTrueAddPropsMap](#reqpropsfromtrueaddpropsmap) | of([Map](#reqpropsfromtrueaddpropsmapbuilder) arg, SchemaConfiguration configuration) | +| @Nullable Object | validName()
| +| @Nullable Object | get(String key)
This schema has invalid Java names so this method must be used when you access instance["invalid-name"], | +| @Nullable Object | getAdditionalProperty(String name)
provides type safety for additional properties | + +## 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(Nothing? data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| Nothing? | 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 AnyTypeJsonSchema.AnyTypeJsonSchema1 + +A schema class that validates payloads + +| Methods Inherited from class org.openapijsonschematools.client.schemas.AnyTypeJsonSchema.AnyTypeJsonSchema1 | +| ------------------------------------------------------------------ | +| validate | +| validateAndBox | + +[[Back to top]](#top) [[Back to Component Schemas]](../../../README.md#Component-Schemas) [[Back to README]](../../../README.md) diff --git a/samples/client/petstore/kotlin/docs/components/schemas/ReqPropsFromUnsetAddProps.md b/samples/client/petstore/kotlin/docs/components/schemas/ReqPropsFromUnsetAddProps.md new file mode 100644 index 00000000000..02a34a1dc7a --- /dev/null +++ b/samples/client/petstore/kotlin/docs/components/schemas/ReqPropsFromUnsetAddProps.md @@ -0,0 +1,210 @@ +# ReqPropsFromUnsetAddProps +org.openapijsonschematools.client.components.schemas.ReqPropsFromUnsetAddProps.java +public class ReqPropsFromUnsetAddProps
+ +A class that contains necessary nested +- schema classes (which validate payloads), extends JsonSchema +- sealed interfaces which store validated payloads, java version of a sum type +- boxed classes which store validated payloads, sealed permits class implementations +- classes to store validated map payloads, extends FrozenMap +- classes to build inputs for map payloads + +## Nested Class Summary +| Modifier and Type | Class and Description | +| ----------------- | ---------------------- | +| sealed interface | [ReqPropsFromUnsetAddProps.ReqPropsFromUnsetAddProps1Boxed](#reqpropsfromunsetaddprops1boxed)
sealed interface for validated payloads | +| record | [ReqPropsFromUnsetAddProps.ReqPropsFromUnsetAddProps1BoxedMap](#reqpropsfromunsetaddprops1boxedmap)
boxed class to store validated Map payloads | +| static class | [ReqPropsFromUnsetAddProps.ReqPropsFromUnsetAddProps1](#reqpropsfromunsetaddprops1)
schema class | +| static class | [ReqPropsFromUnsetAddProps.ReqPropsFromUnsetAddPropsMapBuilder](#reqpropsfromunsetaddpropsmapbuilder)
builder for Map payloads | +| static class | [ReqPropsFromUnsetAddProps.ReqPropsFromUnsetAddPropsMap](#reqpropsfromunsetaddpropsmap)
output class for Map payloads | + +## ReqPropsFromUnsetAddProps1Boxed +public sealed interface ReqPropsFromUnsetAddProps1Boxed
+permits
+[ReqPropsFromUnsetAddProps1BoxedMap](#reqpropsfromunsetaddprops1boxedmap) + +sealed interface that stores validated payloads using boxed classes + +## ReqPropsFromUnsetAddProps1BoxedMap +public record ReqPropsFromUnsetAddProps1BoxedMap
+implements [ReqPropsFromUnsetAddProps1Boxed](#reqpropsfromunsetaddprops1boxed) + +record that stores validated Map payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| ReqPropsFromUnsetAddProps1BoxedMap([ReqPropsFromUnsetAddPropsMap](#reqpropsfromunsetaddpropsmap) data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| [ReqPropsFromUnsetAddPropsMap](#reqpropsfromunsetaddpropsmap) | data()
validated payload | +| @Nullable Object | getData()
validated payload | + +## ReqPropsFromUnsetAddProps1 +public static class ReqPropsFromUnsetAddProps1
+extends JsonSchema + +A schema class that validates payloads + +### Code Sample +``` +import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags; +import org.openapijsonschematools.client.configurations.SchemaConfiguration; +import org.openapijsonschematools.client.exceptions.ValidationException; +import org.openapijsonschematools.client.schemas.validation.MapUtils; +import org.openapijsonschematools.client.schemas.validation.FrozenList; +import org.openapijsonschematools.client.schemas.validation.FrozenMap; +import org.openapijsonschematools.client.components.schemas.ReqPropsFromUnsetAddProps; + +import java.util.Arrays; +import java.util.List; +import java.util.AbstractMap; + +static final SchemaConfiguration configuration = new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().build()); + +// Map validation +ReqPropsFromUnsetAddProps.ReqPropsFromUnsetAddPropsMap validatedPayload = + ReqPropsFromUnsetAddProps.ReqPropsFromUnsetAddProps1.validate( + new ReqPropsFromUnsetAddProps.ReqPropsFromUnsetAddPropsMapBuilder() + .build(), + configuration +); +``` + +### Field Summary +| Modifier and Type | Field and Description | +| ----------------- | ---------------------- | +| Set> | type = Set.of(Map.class) | +| Set | required = Set.of(
    "invalid-name",
    "validName"
)
| + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| [ReqPropsFromUnsetAddPropsMap](#reqpropsfromunsetaddpropsmap) | validate([Map<?, ?>](#reqpropsfromunsetaddpropsmapbuilder) arg, SchemaConfiguration configuration) | +| [ReqPropsFromUnsetAddProps1BoxedMap](#reqpropsfromunsetaddprops1boxedmap) | validateAndBox([Map<?, ?>](#reqpropsfromunsetaddpropsmapbuilder) arg, SchemaConfiguration configuration) | +| [ReqPropsFromUnsetAddProps1Boxed](#reqpropsfromunsetaddprops1boxed) | validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) | +| @Nullable Object | validate(@Nullable Object arg, SchemaConfiguration configuration) | + +## ReqPropsFromUnsetAddPropsMap00Builder +public class ReqPropsFromUnsetAddPropsMap00Builder
+builder for `Map` + +A class that builds the Map input type + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| ReqPropsFromUnsetAddPropsMap00Builder(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 | +| [ReqPropsFromUnsetAddPropsMap00Builder](#reqpropsfromunsetaddpropsmap00builder) | additionalProperty(String key, Nothing? value) | +| [ReqPropsFromUnsetAddPropsMap00Builder](#reqpropsfromunsetaddpropsmap00builder) | additionalProperty(String key, boolean value) | +| [ReqPropsFromUnsetAddPropsMap00Builder](#reqpropsfromunsetaddpropsmap00builder) | additionalProperty(String key, String value) | +| [ReqPropsFromUnsetAddPropsMap00Builder](#reqpropsfromunsetaddpropsmap00builder) | additionalProperty(String key, int value) | +| [ReqPropsFromUnsetAddPropsMap00Builder](#reqpropsfromunsetaddpropsmap00builder) | additionalProperty(String key, float value) | +| [ReqPropsFromUnsetAddPropsMap00Builder](#reqpropsfromunsetaddpropsmap00builder) | additionalProperty(String key, long value) | +| [ReqPropsFromUnsetAddPropsMap00Builder](#reqpropsfromunsetaddpropsmap00builder) | additionalProperty(String key, double value) | +| [ReqPropsFromUnsetAddPropsMap00Builder](#reqpropsfromunsetaddpropsmap00builder) | additionalProperty(String key, List value) | +| [ReqPropsFromUnsetAddPropsMap00Builder](#reqpropsfromunsetaddpropsmap00builder) | additionalProperty(String key, Map value) | + +## ReqPropsFromUnsetAddPropsMap01Builder +public class ReqPropsFromUnsetAddPropsMap01Builder
+builder for `Map` + +A class that builds the Map input type + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| ReqPropsFromUnsetAddPropsMap01Builder(Map instance)
Creates a builder that contains the passed instance | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| [ReqPropsFromUnsetAddPropsMap00Builder](#reqpropsfromunsetaddpropsmap00builder) | validName(Nothing? value) | +| [ReqPropsFromUnsetAddPropsMap00Builder](#reqpropsfromunsetaddpropsmap00builder) | validName(boolean value) | +| [ReqPropsFromUnsetAddPropsMap00Builder](#reqpropsfromunsetaddpropsmap00builder) | validName(String value) | +| [ReqPropsFromUnsetAddPropsMap00Builder](#reqpropsfromunsetaddpropsmap00builder) | validName(int value) | +| [ReqPropsFromUnsetAddPropsMap00Builder](#reqpropsfromunsetaddpropsmap00builder) | validName(float value) | +| [ReqPropsFromUnsetAddPropsMap00Builder](#reqpropsfromunsetaddpropsmap00builder) | validName(long value) | +| [ReqPropsFromUnsetAddPropsMap00Builder](#reqpropsfromunsetaddpropsmap00builder) | validName(double value) | +| [ReqPropsFromUnsetAddPropsMap00Builder](#reqpropsfromunsetaddpropsmap00builder) | validName(List value) | +| [ReqPropsFromUnsetAddPropsMap00Builder](#reqpropsfromunsetaddpropsmap00builder) | validName(Map value) | + +## ReqPropsFromUnsetAddPropsMap10Builder +public class ReqPropsFromUnsetAddPropsMap10Builder
+builder for `Map` + +A class that builds the Map input type + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| ReqPropsFromUnsetAddPropsMap10Builder(Map instance)
Creates a builder that contains the passed instance | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| [ReqPropsFromUnsetAddPropsMap00Builder](#reqpropsfromunsetaddpropsmap00builder) | invalidHyphenMinusName(Nothing? value) | +| [ReqPropsFromUnsetAddPropsMap00Builder](#reqpropsfromunsetaddpropsmap00builder) | invalidHyphenMinusName(boolean value) | +| [ReqPropsFromUnsetAddPropsMap00Builder](#reqpropsfromunsetaddpropsmap00builder) | invalidHyphenMinusName(String value) | +| [ReqPropsFromUnsetAddPropsMap00Builder](#reqpropsfromunsetaddpropsmap00builder) | invalidHyphenMinusName(int value) | +| [ReqPropsFromUnsetAddPropsMap00Builder](#reqpropsfromunsetaddpropsmap00builder) | invalidHyphenMinusName(float value) | +| [ReqPropsFromUnsetAddPropsMap00Builder](#reqpropsfromunsetaddpropsmap00builder) | invalidHyphenMinusName(long value) | +| [ReqPropsFromUnsetAddPropsMap00Builder](#reqpropsfromunsetaddpropsmap00builder) | invalidHyphenMinusName(double value) | +| [ReqPropsFromUnsetAddPropsMap00Builder](#reqpropsfromunsetaddpropsmap00builder) | invalidHyphenMinusName(List value) | +| [ReqPropsFromUnsetAddPropsMap00Builder](#reqpropsfromunsetaddpropsmap00builder) | invalidHyphenMinusName(Map value) | + +## ReqPropsFromUnsetAddPropsMapBuilder +public class ReqPropsFromUnsetAddPropsMapBuilder
+builder for `Map` + +A class that builds the Map input type + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| ReqPropsFromUnsetAddPropsMapBuilder()
Creates a builder that contains an empty map | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| [ReqPropsFromUnsetAddPropsMap01Builder](#reqpropsfromunsetaddpropsmap01builder) | invalidHyphenMinusName(Nothing? value) | +| [ReqPropsFromUnsetAddPropsMap01Builder](#reqpropsfromunsetaddpropsmap01builder) | invalidHyphenMinusName(boolean value) | +| [ReqPropsFromUnsetAddPropsMap01Builder](#reqpropsfromunsetaddpropsmap01builder) | invalidHyphenMinusName(String value) | +| [ReqPropsFromUnsetAddPropsMap01Builder](#reqpropsfromunsetaddpropsmap01builder) | invalidHyphenMinusName(int value) | +| [ReqPropsFromUnsetAddPropsMap01Builder](#reqpropsfromunsetaddpropsmap01builder) | invalidHyphenMinusName(float value) | +| [ReqPropsFromUnsetAddPropsMap01Builder](#reqpropsfromunsetaddpropsmap01builder) | invalidHyphenMinusName(long value) | +| [ReqPropsFromUnsetAddPropsMap01Builder](#reqpropsfromunsetaddpropsmap01builder) | invalidHyphenMinusName(double value) | +| [ReqPropsFromUnsetAddPropsMap01Builder](#reqpropsfromunsetaddpropsmap01builder) | invalidHyphenMinusName(List value) | +| [ReqPropsFromUnsetAddPropsMap01Builder](#reqpropsfromunsetaddpropsmap01builder) | invalidHyphenMinusName(Map value) | +| [ReqPropsFromUnsetAddPropsMap10Builder](#reqpropsfromunsetaddpropsmap10builder) | validName(Nothing? value) | +| [ReqPropsFromUnsetAddPropsMap10Builder](#reqpropsfromunsetaddpropsmap10builder) | validName(boolean value) | +| [ReqPropsFromUnsetAddPropsMap10Builder](#reqpropsfromunsetaddpropsmap10builder) | validName(String value) | +| [ReqPropsFromUnsetAddPropsMap10Builder](#reqpropsfromunsetaddpropsmap10builder) | validName(int value) | +| [ReqPropsFromUnsetAddPropsMap10Builder](#reqpropsfromunsetaddpropsmap10builder) | validName(float value) | +| [ReqPropsFromUnsetAddPropsMap10Builder](#reqpropsfromunsetaddpropsmap10builder) | validName(long value) | +| [ReqPropsFromUnsetAddPropsMap10Builder](#reqpropsfromunsetaddpropsmap10builder) | validName(double value) | +| [ReqPropsFromUnsetAddPropsMap10Builder](#reqpropsfromunsetaddpropsmap10builder) | validName(List value) | +| [ReqPropsFromUnsetAddPropsMap10Builder](#reqpropsfromunsetaddpropsmap10builder) | validName(Map value) | + +## ReqPropsFromUnsetAddPropsMap +public static class ReqPropsFromUnsetAddPropsMap
+extends FrozenMap + +A class to store validated Map payloads + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| static [ReqPropsFromUnsetAddPropsMap](#reqpropsfromunsetaddpropsmap) | of([Map](#reqpropsfromunsetaddpropsmapbuilder) arg, SchemaConfiguration configuration) | +| @Nullable Object | validName()
| +| @Nullable Object | get(String key)
This schema has invalid Java names so this method must be used when you access instance["invalid-name"], | +| @Nullable Object | getAdditionalProperty(String name)
provides type safety for additional properties | + +[[Back to top]](#top) [[Back to Component Schemas]](../../../README.md#Component-Schemas) [[Back to README]](../../../README.md) diff --git a/samples/client/petstore/kotlin/docs/components/schemas/ReturnSchema.md b/samples/client/petstore/kotlin/docs/components/schemas/ReturnSchema.md new file mode 100644 index 00000000000..fb5c1608867 --- /dev/null +++ b/samples/client/petstore/kotlin/docs/components/schemas/ReturnSchema.md @@ -0,0 +1,257 @@ +# ReturnSchema +org.openapijsonschematools.client.components.schemas.ReturnSchema.java +public class ReturnSchema
+ +A class that contains necessary nested +- schema classes (which validate payloads), extends JsonSchema +- sealed interfaces which store validated payloads, java version of a sum type +- boxed classes which store validated payloads, sealed permits class implementations +- classes to store validated map payloads, extends FrozenMap +- classes to build inputs for map payloads + +## Nested Class Summary +| Modifier and Type | Class and Description | +| ----------------- | ---------------------- | +| sealed interface | [ReturnSchema.ReturnSchema1Boxed](#returnschema1boxed)
sealed interface for validated payloads | +| record | [ReturnSchema.ReturnSchema1BoxedVoid](#returnschema1boxedvoid)
boxed class to store validated null payloads | +| record | [ReturnSchema.ReturnSchema1BoxedBoolean](#returnschema1boxedboolean)
boxed class to store validated boolean payloads | +| record | [ReturnSchema.ReturnSchema1BoxedNumber](#returnschema1boxednumber)
boxed class to store validated Number payloads | +| record | [ReturnSchema.ReturnSchema1BoxedString](#returnschema1boxedstring)
boxed class to store validated String payloads | +| record | [ReturnSchema.ReturnSchema1BoxedList](#returnschema1boxedlist)
boxed class to store validated List payloads | +| record | [ReturnSchema.ReturnSchema1BoxedMap](#returnschema1boxedmap)
boxed class to store validated Map payloads | +| static class | [ReturnSchema.ReturnSchema1](#returnschema1)
schema class | +| static class | [ReturnSchema.ReturnMapBuilder1](#returnmapbuilder1)
builder for Map payloads | +| static class | [ReturnSchema.ReturnMap](#returnmap)
output class for Map payloads | +| sealed interface | [ReturnSchema.ReturnSchema2Boxed](#returnschema2boxed)
sealed interface for validated payloads | +| record | [ReturnSchema.ReturnSchema2BoxedNumber](#returnschema2boxednumber)
boxed class to store validated Number payloads | +| static class | [ReturnSchema.ReturnSchema2](#returnschema2)
schema class | + +## ReturnSchema1Boxed +public sealed interface ReturnSchema1Boxed
+permits
+[ReturnSchema1BoxedVoid](#returnschema1boxedvoid), +[ReturnSchema1BoxedBoolean](#returnschema1boxedboolean), +[ReturnSchema1BoxedNumber](#returnschema1boxednumber), +[ReturnSchema1BoxedString](#returnschema1boxedstring), +[ReturnSchema1BoxedList](#returnschema1boxedlist), +[ReturnSchema1BoxedMap](#returnschema1boxedmap) + +sealed interface that stores validated payloads using boxed classes + +## ReturnSchema1BoxedVoid +public record ReturnSchema1BoxedVoid
+implements [ReturnSchema1Boxed](#returnschema1boxed) + +record that stores validated null payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| ReturnSchema1BoxedVoid(Nothing? data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| Nothing? | data()
validated payload | +| @Nullable Object | getData()
validated payload | + +## ReturnSchema1BoxedBoolean +public record ReturnSchema1BoxedBoolean
+implements [ReturnSchema1Boxed](#returnschema1boxed) + +record that stores validated boolean payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| ReturnSchema1BoxedBoolean(boolean data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| boolean | data()
validated payload | +| @Nullable Object | getData()
validated payload | + +## ReturnSchema1BoxedNumber +public record ReturnSchema1BoxedNumber
+implements [ReturnSchema1Boxed](#returnschema1boxed) + +record that stores validated Number payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| ReturnSchema1BoxedNumber(Number data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| Number | data()
validated payload | +| @Nullable Object | getData()
validated payload | + +## ReturnSchema1BoxedString +public record ReturnSchema1BoxedString
+implements [ReturnSchema1Boxed](#returnschema1boxed) + +record that stores validated String payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| ReturnSchema1BoxedString(String data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| String | data()
validated payload | +| @Nullable Object | getData()
validated payload | + +## ReturnSchema1BoxedList +public record ReturnSchema1BoxedList
+implements [ReturnSchema1Boxed](#returnschema1boxed) + +record that stores validated List payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| ReturnSchema1BoxedList(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 | + +## ReturnSchema1BoxedMap +public record ReturnSchema1BoxedMap
+implements [ReturnSchema1Boxed](#returnschema1boxed) + +record that stores validated Map payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| ReturnSchema1BoxedMap([ReturnMap](#returnmap) data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| [ReturnMap](#returnmap) | data()
validated payload | +| @Nullable Object | getData()
validated payload | + +## ReturnSchema1 +public static class ReturnSchema1
+extends JsonSchema + +A schema class that validates payloads + +## Description +Model for testing reserved words + +### Field Summary +| Modifier and Type | Field and Description | +| ----------------- | ---------------------- | +| Map> | properties = Map.ofEntries(
    new PropertyEntry("return", [ReturnSchema2.class](#returnschema2)))
)
| + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| String | validate(String arg, SchemaConfiguration configuration) | +| Nothing? | validate(Nothing? arg, SchemaConfiguration configuration) | +| int | validate(int arg, SchemaConfiguration configuration) | +| long | validate(long arg, SchemaConfiguration configuration) | +| float | validate(float arg, SchemaConfiguration configuration) | +| double | validate(double arg, SchemaConfiguration configuration) | +| Number | validate(Number arg, SchemaConfiguration configuration) | +| boolean | validate(boolean arg, SchemaConfiguration configuration) | +| [ReturnMap](#returnmap) | validate([Map<?, ?>](#returnmapbuilder1) arg, SchemaConfiguration configuration) | +| FrozenList<@Nullable Object> | validate(List arg, SchemaConfiguration configuration) | +| [ReturnSchema1BoxedString](#returnschema1boxedstring) | validateAndBox(String arg, SchemaConfiguration configuration) | +| [ReturnSchema1BoxedVoid](#returnschema1boxedvoid) | validateAndBox(Nothing? arg, SchemaConfiguration configuration) | +| [ReturnSchema1BoxedNumber](#returnschema1boxednumber) | validateAndBox(Number arg, SchemaConfiguration configuration) | +| [ReturnSchema1BoxedBoolean](#returnschema1boxedboolean) | validateAndBox(boolean arg, SchemaConfiguration configuration) | +| [ReturnSchema1BoxedMap](#returnschema1boxedmap) | validateAndBox([Map<?, ?>](#returnmapbuilder1) arg, SchemaConfiguration configuration) | +| [ReturnSchema1BoxedList](#returnschema1boxedlist) | validateAndBox(List arg, SchemaConfiguration configuration) | +| [ReturnSchema1Boxed](#returnschema1boxed) | validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) | +| @Nullable Object | validate(@Nullable Object arg, SchemaConfiguration configuration) | + +## ReturnMapBuilder1 +public class ReturnMapBuilder1
+builder for `Map` + +A class that builds the Map input type + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| ReturnMapBuilder1()
Creates a builder that contains an empty map | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| Map | build()
Returns map input that should be used with Schema.validate | +| [ReturnMapBuilder1](#returnmapbuilder1) | setReturn(int value) | +| [ReturnMapBuilder1](#returnmapbuilder1) | setReturn(float value) | +| [ReturnMapBuilder1](#returnmapbuilder1) | additionalProperty(String key, Nothing? value) | +| [ReturnMapBuilder1](#returnmapbuilder1) | additionalProperty(String key, boolean value) | +| [ReturnMapBuilder1](#returnmapbuilder1) | additionalProperty(String key, String value) | +| [ReturnMapBuilder1](#returnmapbuilder1) | additionalProperty(String key, int value) | +| [ReturnMapBuilder1](#returnmapbuilder1) | additionalProperty(String key, float value) | +| [ReturnMapBuilder1](#returnmapbuilder1) | additionalProperty(String key, long value) | +| [ReturnMapBuilder1](#returnmapbuilder1) | additionalProperty(String key, double value) | +| [ReturnMapBuilder1](#returnmapbuilder1) | additionalProperty(String key, List value) | +| [ReturnMapBuilder1](#returnmapbuilder1) | additionalProperty(String key, Map value) | + +## ReturnMap +public static class ReturnMap
+extends FrozenMap + +A class to store validated Map payloads + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| static [ReturnMap](#returnmap) | of([Map](#returnmapbuilder1) arg, SchemaConfiguration configuration) | +| @Nullable Object | get(String key)
This schema has invalid Java names so this method must be used when you access instance["return"], | +| @Nullable Object | getAdditionalProperty(String name)
provides type safety for additional properties | + +## ReturnSchema2Boxed +public sealed interface ReturnSchema2Boxed
+permits
+[ReturnSchema2BoxedNumber](#returnschema2boxednumber) + +sealed interface that stores validated payloads using boxed classes + +## ReturnSchema2BoxedNumber +public record ReturnSchema2BoxedNumber
+implements [ReturnSchema2Boxed](#returnschema2boxed) + +record that stores validated Number payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| ReturnSchema2BoxedNumber(Number data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| Number | data()
validated payload | +| @Nullable Object | getData()
validated payload | + +## ReturnSchema2 +public static class ReturnSchema2
+extends Int32JsonSchema.Int32JsonSchema1 + +A schema class that validates payloads + +## Description +this is a reserved python keyword + +| Methods Inherited from class org.openapijsonschematools.client.schemas.Int32JsonSchema.Int32JsonSchema1 | +| ------------------------------------------------------------------ | +| validate | +| validateAndBox | + +[[Back to top]](#top) [[Back to Component Schemas]](../../../README.md#Component-Schemas) [[Back to README]](../../../README.md) diff --git a/samples/client/petstore/kotlin/docs/components/schemas/ScaleneTriangle.md b/samples/client/petstore/kotlin/docs/components/schemas/ScaleneTriangle.md new file mode 100644 index 00000000000..7c2be88acb9 --- /dev/null +++ b/samples/client/petstore/kotlin/docs/components/schemas/ScaleneTriangle.md @@ -0,0 +1,371 @@ +# ScaleneTriangle +org.openapijsonschematools.client.components.schemas.ScaleneTriangle.java +public class ScaleneTriangle
+ +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 | [ScaleneTriangle.ScaleneTriangle1Boxed](#scalenetriangle1boxed)
sealed interface for validated payloads | +| record | [ScaleneTriangle.ScaleneTriangle1BoxedVoid](#scalenetriangle1boxedvoid)
boxed class to store validated null payloads | +| record | [ScaleneTriangle.ScaleneTriangle1BoxedBoolean](#scalenetriangle1boxedboolean)
boxed class to store validated boolean payloads | +| record | [ScaleneTriangle.ScaleneTriangle1BoxedNumber](#scalenetriangle1boxednumber)
boxed class to store validated Number payloads | +| record | [ScaleneTriangle.ScaleneTriangle1BoxedString](#scalenetriangle1boxedstring)
boxed class to store validated String payloads | +| record | [ScaleneTriangle.ScaleneTriangle1BoxedList](#scalenetriangle1boxedlist)
boxed class to store validated List payloads | +| record | [ScaleneTriangle.ScaleneTriangle1BoxedMap](#scalenetriangle1boxedmap)
boxed class to store validated Map payloads | +| static class | [ScaleneTriangle.ScaleneTriangle1](#scalenetriangle1)
schema class | +| sealed interface | [ScaleneTriangle.Schema1Boxed](#schema1boxed)
sealed interface for validated payloads | +| record | [ScaleneTriangle.Schema1BoxedMap](#schema1boxedmap)
boxed class to store validated Map payloads | +| static class | [ScaleneTriangle.Schema1](#schema1)
schema class | +| static class | [ScaleneTriangle.Schema1MapBuilder](#schema1mapbuilder)
builder for Map payloads | +| static class | [ScaleneTriangle.Schema1Map](#schema1map)
output class for Map payloads | +| sealed interface | [ScaleneTriangle.TriangleTypeBoxed](#triangletypeboxed)
sealed interface for validated payloads | +| record | [ScaleneTriangle.TriangleTypeBoxedString](#triangletypeboxedstring)
boxed class to store validated String payloads | +| static class | [ScaleneTriangle.TriangleType](#triangletype)
schema class | +| enum | [ScaleneTriangle.StringTriangleTypeEnums](#stringtriangletypeenums)
String enum | + +## ScaleneTriangle1Boxed +public sealed interface ScaleneTriangle1Boxed
+permits
+[ScaleneTriangle1BoxedVoid](#scalenetriangle1boxedvoid), +[ScaleneTriangle1BoxedBoolean](#scalenetriangle1boxedboolean), +[ScaleneTriangle1BoxedNumber](#scalenetriangle1boxednumber), +[ScaleneTriangle1BoxedString](#scalenetriangle1boxedstring), +[ScaleneTriangle1BoxedList](#scalenetriangle1boxedlist), +[ScaleneTriangle1BoxedMap](#scalenetriangle1boxedmap) + +sealed interface that stores validated payloads using boxed classes + +## ScaleneTriangle1BoxedVoid +public record ScaleneTriangle1BoxedVoid
+implements [ScaleneTriangle1Boxed](#scalenetriangle1boxed) + +record that stores validated null payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| ScaleneTriangle1BoxedVoid(Nothing? data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| Nothing? | data()
validated payload | +| @Nullable Object | getData()
validated payload | + +## ScaleneTriangle1BoxedBoolean +public record ScaleneTriangle1BoxedBoolean
+implements [ScaleneTriangle1Boxed](#scalenetriangle1boxed) + +record that stores validated boolean payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| ScaleneTriangle1BoxedBoolean(boolean data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| boolean | data()
validated payload | +| @Nullable Object | getData()
validated payload | + +## ScaleneTriangle1BoxedNumber +public record ScaleneTriangle1BoxedNumber
+implements [ScaleneTriangle1Boxed](#scalenetriangle1boxed) + +record that stores validated Number payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| ScaleneTriangle1BoxedNumber(Number data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| Number | data()
validated payload | +| @Nullable Object | getData()
validated payload | + +## ScaleneTriangle1BoxedString +public record ScaleneTriangle1BoxedString
+implements [ScaleneTriangle1Boxed](#scalenetriangle1boxed) + +record that stores validated String payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| ScaleneTriangle1BoxedString(String data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| String | data()
validated payload | +| @Nullable Object | getData()
validated payload | + +## ScaleneTriangle1BoxedList +public record ScaleneTriangle1BoxedList
+implements [ScaleneTriangle1Boxed](#scalenetriangle1boxed) + +record that stores validated List payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| ScaleneTriangle1BoxedList(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 | + +## ScaleneTriangle1BoxedMap +public record ScaleneTriangle1BoxedMap
+implements [ScaleneTriangle1Boxed](#scalenetriangle1boxed) + +record that stores validated Map payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| ScaleneTriangle1BoxedMap(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 | + +## ScaleneTriangle1 +public static class ScaleneTriangle1
+extends JsonSchema + +A schema class that validates payloads + +### Field Summary +| Modifier and Type | Field and Description | +| ----------------- | ---------------------- | +| List> | allOf = List.of(
    [TriangleInterface.TriangleInterface1.class](../../components/schemas/TriangleInterface.md#triangleinterface1),
    [Schema1.class](#schema1)
;)
| + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| String | validate(String arg, SchemaConfiguration configuration) | +| Nothing? | validate(Nothing? arg, SchemaConfiguration configuration) | +| int | validate(int arg, SchemaConfiguration configuration) | +| long | validate(long arg, SchemaConfiguration configuration) | +| float | validate(float arg, SchemaConfiguration configuration) | +| double | validate(double arg, SchemaConfiguration configuration) | +| Number | validate(Number arg, SchemaConfiguration configuration) | +| boolean | validate(boolean arg, SchemaConfiguration configuration) | +| FrozenMap<@Nullable Object> | validate(Map<?, ?> arg, SchemaConfiguration configuration) | +| FrozenList<@Nullable Object> | validate(List arg, SchemaConfiguration configuration) | +| [ScaleneTriangle1BoxedString](#scalenetriangle1boxedstring) | validateAndBox(String arg, SchemaConfiguration configuration) | +| [ScaleneTriangle1BoxedVoid](#scalenetriangle1boxedvoid) | validateAndBox(Nothing? arg, SchemaConfiguration configuration) | +| [ScaleneTriangle1BoxedNumber](#scalenetriangle1boxednumber) | validateAndBox(Number arg, SchemaConfiguration configuration) | +| [ScaleneTriangle1BoxedBoolean](#scalenetriangle1boxedboolean) | validateAndBox(boolean arg, SchemaConfiguration configuration) | +| [ScaleneTriangle1BoxedMap](#scalenetriangle1boxedmap) | validateAndBox(Map<?, ?> arg, SchemaConfiguration configuration) | +| [ScaleneTriangle1BoxedList](#scalenetriangle1boxedlist) | validateAndBox(List arg, SchemaConfiguration configuration) | +| [ScaleneTriangle1Boxed](#scalenetriangle1boxed) | validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) | +| @Nullable Object | validate(@Nullable Object arg, SchemaConfiguration configuration) | + +## Schema1Boxed +public sealed interface Schema1Boxed
+permits
+[Schema1BoxedMap](#schema1boxedmap) + +sealed interface that stores validated payloads using boxed classes + +## Schema1BoxedMap +public record Schema1BoxedMap
+implements [Schema1Boxed](#schema1boxed) + +record that stores validated Map payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| Schema1BoxedMap([Schema1Map](#schema1map) data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| [Schema1Map](#schema1map) | data()
validated payload | +| @Nullable Object | getData()
validated payload | + +## Schema1 +public static class Schema1
+extends JsonSchema + +A schema class that validates payloads + +### Code Sample +``` +import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags; +import org.openapijsonschematools.client.configurations.SchemaConfiguration; +import org.openapijsonschematools.client.exceptions.ValidationException; +import org.openapijsonschematools.client.schemas.validation.MapUtils; +import org.openapijsonschematools.client.schemas.validation.FrozenList; +import org.openapijsonschematools.client.schemas.validation.FrozenMap; +import org.openapijsonschematools.client.components.schemas.ScaleneTriangle; + +import java.util.Arrays; +import java.util.List; +import java.util.AbstractMap; + +static final SchemaConfiguration configuration = new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().build()); + +// Map validation +ScaleneTriangle.Schema1Map validatedPayload = + ScaleneTriangle.Schema1.validate( + new ScaleneTriangle.Schema1MapBuilder() + .triangleType("ScaleneTriangle") + + .build(), + configuration +); +``` + +### Field Summary +| Modifier and Type | Field and Description | +| ----------------- | ---------------------- | +| Set> | type = Set.of(Map.class) | +| Map> | properties = Map.ofEntries(
    new PropertyEntry("triangleType", [TriangleType.class](#triangletype)))
)
| + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| [Schema1Map](#schema1map) | validate([Map<?, ?>](#schema1mapbuilder) arg, SchemaConfiguration configuration) | +| [Schema1BoxedMap](#schema1boxedmap) | validateAndBox([Map<?, ?>](#schema1mapbuilder) arg, SchemaConfiguration configuration) | +| [Schema1Boxed](#schema1boxed) | validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) | +| @Nullable Object | validate(@Nullable Object arg, SchemaConfiguration configuration) | + +## Schema1MapBuilder +public class Schema1MapBuilder
+builder for `Map` + +A class that builds the Map input type + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| Schema1MapBuilder()
Creates a builder that contains an empty map | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| Map | build()
Returns map input that should be used with Schema.validate | +| [Schema1MapBuilder](#schema1mapbuilder) | triangleType(String value) | +| [Schema1MapBuilder](#schema1mapbuilder) | triangleType([StringTriangleTypeEnums](#stringtriangletypeenums) value) | +| [Schema1MapBuilder](#schema1mapbuilder) | additionalProperty(String key, Nothing? value) | +| [Schema1MapBuilder](#schema1mapbuilder) | additionalProperty(String key, boolean value) | +| [Schema1MapBuilder](#schema1mapbuilder) | additionalProperty(String key, String value) | +| [Schema1MapBuilder](#schema1mapbuilder) | additionalProperty(String key, int value) | +| [Schema1MapBuilder](#schema1mapbuilder) | additionalProperty(String key, float value) | +| [Schema1MapBuilder](#schema1mapbuilder) | additionalProperty(String key, long value) | +| [Schema1MapBuilder](#schema1mapbuilder) | additionalProperty(String key, double value) | +| [Schema1MapBuilder](#schema1mapbuilder) | additionalProperty(String key, List value) | +| [Schema1MapBuilder](#schema1mapbuilder) | additionalProperty(String key, Map value) | + +## Schema1Map +public static class Schema1Map
+extends FrozenMap + +A class to store validated Map payloads + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| static [Schema1Map](#schema1map) | of([Map](#schema1mapbuilder) arg, SchemaConfiguration configuration) | +| String | triangleType()
[optional] must be one of ["ScaleneTriangle"] | +| @Nullable Object | getAdditionalProperty(String name)
provides type safety for additional properties | + +## TriangleTypeBoxed +public sealed interface TriangleTypeBoxed
+permits
+[TriangleTypeBoxedString](#triangletypeboxedstring) + +sealed interface that stores validated payloads using boxed classes + +## TriangleTypeBoxedString +public record TriangleTypeBoxedString
+implements [TriangleTypeBoxed](#triangletypeboxed) + +record that stores validated String payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| TriangleTypeBoxedString(String data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| String | data()
validated payload | +| @Nullable Object | getData()
validated payload | + +## TriangleType +public static class TriangleType
+extends JsonSchema + +A schema class that validates payloads + +### Code Sample +``` +import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags; +import org.openapijsonschematools.client.configurations.SchemaConfiguration; +import org.openapijsonschematools.client.exceptions.ValidationException; +import org.openapijsonschematools.client.schemas.validation.MapUtils; +import org.openapijsonschematools.client.schemas.validation.FrozenList; +import org.openapijsonschematools.client.schemas.validation.FrozenMap; +import org.openapijsonschematools.client.components.schemas.ScaleneTriangle; + +import java.util.Arrays; +import java.util.List; +import java.util.AbstractMap; + +static final SchemaConfiguration configuration = new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().build()); + +// String validation +String validatedPayload = ScaleneTriangle.TriangleType.validate( + "ScaleneTriangle", + configuration +); +``` + +### Field Summary +| Modifier and Type | Field and Description | +| ----------------- | ---------------------- | +| Set> | type = Set.of(
    String.class
)
| +| Set | enumValues = SetMaker.makeSet(
    "ScaleneTriangle"
)
| + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| String | validate(String arg, SchemaConfiguration configuration) | +| String | validate([StringTriangleTypeEnums](#stringtriangletypeenums) arg, SchemaConfiguration configuration) | +| [TriangleTypeBoxedString](#triangletypeboxedstring) | validateAndBox(String arg, SchemaConfiguration configuration) | +| [TriangleTypeBoxed](#triangletypeboxed) | validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) | +| @Nullable Object | validate(@Nullable Object arg, SchemaConfiguration configuration) | + +## StringTriangleTypeEnums +public enum StringTriangleTypeEnums
+extends `Enum` + +A class that stores String enum values + +### Enum Constant Summary +| Enum Constant | Description | +| ------------- | ----------- | +| SCALENE_TRIANGLE | value = "ScaleneTriangle" | + +[[Back to top]](#top) [[Back to Component Schemas]](../../../README.md#Component-Schemas) [[Back to README]](../../../README.md) diff --git a/samples/client/petstore/kotlin/docs/components/schemas/Schema200Response.md b/samples/client/petstore/kotlin/docs/components/schemas/Schema200Response.md new file mode 100644 index 00000000000..8b8860660e9 --- /dev/null +++ b/samples/client/petstore/kotlin/docs/components/schemas/Schema200Response.md @@ -0,0 +1,297 @@ +# Schema200Response +org.openapijsonschematools.client.components.schemas.Schema200Response.java +public class Schema200Response
+ +A class that contains necessary nested +- schema classes (which validate payloads), extends JsonSchema +- sealed interfaces which store validated payloads, java version of a sum type +- boxed classes which store validated payloads, sealed permits class implementations +- classes to store validated map payloads, extends FrozenMap +- classes to build inputs for map payloads + +## Nested Class Summary +| Modifier and Type | Class and Description | +| ----------------- | ---------------------- | +| sealed interface | [Schema200Response.Schema200Response1Boxed](#schema200response1boxed)
sealed interface for validated payloads | +| record | [Schema200Response.Schema200Response1BoxedVoid](#schema200response1boxedvoid)
boxed class to store validated null payloads | +| record | [Schema200Response.Schema200Response1BoxedBoolean](#schema200response1boxedboolean)
boxed class to store validated boolean payloads | +| record | [Schema200Response.Schema200Response1BoxedNumber](#schema200response1boxednumber)
boxed class to store validated Number payloads | +| record | [Schema200Response.Schema200Response1BoxedString](#schema200response1boxedstring)
boxed class to store validated String payloads | +| record | [Schema200Response.Schema200Response1BoxedList](#schema200response1boxedlist)
boxed class to store validated List payloads | +| record | [Schema200Response.Schema200Response1BoxedMap](#schema200response1boxedmap)
boxed class to store validated Map payloads | +| static class | [Schema200Response.Schema200Response1](#schema200response1)
schema class | +| static class | [Schema200Response.Schema200ResponseMapBuilder](#schema200responsemapbuilder)
builder for Map payloads | +| static class | [Schema200Response.Schema200ResponseMap](#schema200responsemap)
output class for Map payloads | +| sealed interface | [Schema200Response.ClassSchemaBoxed](#classschemaboxed)
sealed interface for validated payloads | +| record | [Schema200Response.ClassSchemaBoxedString](#classschemaboxedstring)
boxed class to store validated String payloads | +| static class | [Schema200Response.ClassSchema](#classschema)
schema class | +| sealed interface | [Schema200Response.NameBoxed](#nameboxed)
sealed interface for validated payloads | +| record | [Schema200Response.NameBoxedNumber](#nameboxednumber)
boxed class to store validated Number payloads | +| static class | [Schema200Response.Name](#name)
schema class | + +## Schema200Response1Boxed +public sealed interface Schema200Response1Boxed
+permits
+[Schema200Response1BoxedVoid](#schema200response1boxedvoid), +[Schema200Response1BoxedBoolean](#schema200response1boxedboolean), +[Schema200Response1BoxedNumber](#schema200response1boxednumber), +[Schema200Response1BoxedString](#schema200response1boxedstring), +[Schema200Response1BoxedList](#schema200response1boxedlist), +[Schema200Response1BoxedMap](#schema200response1boxedmap) + +sealed interface that stores validated payloads using boxed classes + +## Schema200Response1BoxedVoid +public record Schema200Response1BoxedVoid
+implements [Schema200Response1Boxed](#schema200response1boxed) + +record that stores validated null payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| Schema200Response1BoxedVoid(Nothing? data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| Nothing? | data()
validated payload | +| @Nullable Object | getData()
validated payload | + +## Schema200Response1BoxedBoolean +public record Schema200Response1BoxedBoolean
+implements [Schema200Response1Boxed](#schema200response1boxed) + +record that stores validated boolean payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| Schema200Response1BoxedBoolean(boolean data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| boolean | data()
validated payload | +| @Nullable Object | getData()
validated payload | + +## Schema200Response1BoxedNumber +public record Schema200Response1BoxedNumber
+implements [Schema200Response1Boxed](#schema200response1boxed) + +record that stores validated Number payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| Schema200Response1BoxedNumber(Number data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| Number | data()
validated payload | +| @Nullable Object | getData()
validated payload | + +## Schema200Response1BoxedString +public record Schema200Response1BoxedString
+implements [Schema200Response1Boxed](#schema200response1boxed) + +record that stores validated String payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| Schema200Response1BoxedString(String data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| String | data()
validated payload | +| @Nullable Object | getData()
validated payload | + +## Schema200Response1BoxedList +public record Schema200Response1BoxedList
+implements [Schema200Response1Boxed](#schema200response1boxed) + +record that stores validated List payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| Schema200Response1BoxedList(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 | + +## Schema200Response1BoxedMap +public record Schema200Response1BoxedMap
+implements [Schema200Response1Boxed](#schema200response1boxed) + +record that stores validated Map payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| Schema200Response1BoxedMap([Schema200ResponseMap](#schema200responsemap) data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| [Schema200ResponseMap](#schema200responsemap) | data()
validated payload | +| @Nullable Object | getData()
validated payload | + +## Schema200Response1 +public static class Schema200Response1
+extends JsonSchema + +A schema class that validates payloads + +## Description +model with an invalid class name for python, starts with a number + +### Field Summary +| Modifier and Type | Field and Description | +| ----------------- | ---------------------- | +| Map> | properties = Map.ofEntries(
    new PropertyEntry("name", [Name.class](#name))),
    new PropertyEntry("class", [ClassSchema.class](#classschema)))
)
| + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| String | validate(String arg, SchemaConfiguration configuration) | +| Nothing? | validate(Nothing? arg, SchemaConfiguration configuration) | +| int | validate(int arg, SchemaConfiguration configuration) | +| long | validate(long arg, SchemaConfiguration configuration) | +| float | validate(float arg, SchemaConfiguration configuration) | +| double | validate(double arg, SchemaConfiguration configuration) | +| Number | validate(Number arg, SchemaConfiguration configuration) | +| boolean | validate(boolean arg, SchemaConfiguration configuration) | +| [Schema200ResponseMap](#schema200responsemap) | validate([Map<?, ?>](#schema200responsemapbuilder) arg, SchemaConfiguration configuration) | +| FrozenList<@Nullable Object> | validate(List arg, SchemaConfiguration configuration) | +| [Schema200Response1BoxedString](#schema200response1boxedstring) | validateAndBox(String arg, SchemaConfiguration configuration) | +| [Schema200Response1BoxedVoid](#schema200response1boxedvoid) | validateAndBox(Nothing? arg, SchemaConfiguration configuration) | +| [Schema200Response1BoxedNumber](#schema200response1boxednumber) | validateAndBox(Number arg, SchemaConfiguration configuration) | +| [Schema200Response1BoxedBoolean](#schema200response1boxedboolean) | validateAndBox(boolean arg, SchemaConfiguration configuration) | +| [Schema200Response1BoxedMap](#schema200response1boxedmap) | validateAndBox([Map<?, ?>](#schema200responsemapbuilder) arg, SchemaConfiguration configuration) | +| [Schema200Response1BoxedList](#schema200response1boxedlist) | validateAndBox(List arg, SchemaConfiguration configuration) | +| [Schema200Response1Boxed](#schema200response1boxed) | validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) | +| @Nullable Object | validate(@Nullable Object arg, SchemaConfiguration configuration) | + +## Schema200ResponseMapBuilder +public class Schema200ResponseMapBuilder
+builder for `Map` + +A class that builds the Map input type + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| Schema200ResponseMapBuilder()
Creates a builder that contains an empty map | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| Map | build()
Returns map input that should be used with Schema.validate | +| [Schema200ResponseMapBuilder](#schema200responsemapbuilder) | name(int value) | +| [Schema200ResponseMapBuilder](#schema200responsemapbuilder) | name(float value) | +| [Schema200ResponseMapBuilder](#schema200responsemapbuilder) | setClass(String value) | +| [Schema200ResponseMapBuilder](#schema200responsemapbuilder) | additionalProperty(String key, Nothing? value) | +| [Schema200ResponseMapBuilder](#schema200responsemapbuilder) | additionalProperty(String key, boolean value) | +| [Schema200ResponseMapBuilder](#schema200responsemapbuilder) | additionalProperty(String key, String value) | +| [Schema200ResponseMapBuilder](#schema200responsemapbuilder) | additionalProperty(String key, int value) | +| [Schema200ResponseMapBuilder](#schema200responsemapbuilder) | additionalProperty(String key, float value) | +| [Schema200ResponseMapBuilder](#schema200responsemapbuilder) | additionalProperty(String key, long value) | +| [Schema200ResponseMapBuilder](#schema200responsemapbuilder) | additionalProperty(String key, double value) | +| [Schema200ResponseMapBuilder](#schema200responsemapbuilder) | additionalProperty(String key, List value) | +| [Schema200ResponseMapBuilder](#schema200responsemapbuilder) | additionalProperty(String key, Map value) | + +## Schema200ResponseMap +public static class Schema200ResponseMap
+extends FrozenMap + +A class to store validated Map payloads + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| static [Schema200ResponseMap](#schema200responsemap) | of([Map](#schema200responsemapbuilder) arg, SchemaConfiguration configuration) | +| Number | name()
[optional] value must be a 32 bit integer | +| @Nullable Object | get(String key)
This schema has invalid Java names so this method must be used when you access instance["class"], | +| @Nullable Object | getAdditionalProperty(String name)
provides type safety for additional properties | + +## ClassSchemaBoxed +public sealed interface ClassSchemaBoxed
+permits
+[ClassSchemaBoxedString](#classschemaboxedstring) + +sealed interface that stores validated payloads using boxed classes + +## ClassSchemaBoxedString +public record ClassSchemaBoxedString
+implements [ClassSchemaBoxed](#classschemaboxed) + +record that stores validated String payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| ClassSchemaBoxedString(String data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| String | data()
validated payload | +| @Nullable Object | getData()
validated payload | + +## ClassSchema +public static class ClassSchema
+extends StringJsonSchema.StringJsonSchema1 + +A schema class that validates payloads + +## Description +this is a reserved python keyword + +| Methods Inherited from class org.openapijsonschematools.client.schemas.StringJsonSchema.StringJsonSchema1 | +| ------------------------------------------------------------------ | +| validate | +| validateAndBox | + +## NameBoxed +public sealed interface NameBoxed
+permits
+[NameBoxedNumber](#nameboxednumber) + +sealed interface that stores validated payloads using boxed classes + +## NameBoxedNumber +public record NameBoxedNumber
+implements [NameBoxed](#nameboxed) + +record that stores validated Number payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| NameBoxedNumber(Number data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| Number | data()
validated payload | +| @Nullable Object | getData()
validated payload | + +## Name +public static class Name
+extends Int32JsonSchema.Int32JsonSchema1 + +A schema class that validates payloads + +| Methods Inherited from class org.openapijsonschematools.client.schemas.Int32JsonSchema.Int32JsonSchema1 | +| ------------------------------------------------------------------ | +| validate | +| validateAndBox | + +[[Back to top]](#top) [[Back to Component Schemas]](../../../README.md#Component-Schemas) [[Back to README]](../../../README.md) diff --git a/samples/client/petstore/kotlin/docs/components/schemas/SelfReferencingArrayModel.md b/samples/client/petstore/kotlin/docs/components/schemas/SelfReferencingArrayModel.md new file mode 100644 index 00000000000..ba989c0d031 --- /dev/null +++ b/samples/client/petstore/kotlin/docs/components/schemas/SelfReferencingArrayModel.md @@ -0,0 +1,119 @@ +# SelfReferencingArrayModel +org.openapijsonschematools.client.components.schemas.SelfReferencingArrayModel.java +public class SelfReferencingArrayModel
+ +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 list payloads, extends FrozenList +- classes to build inputs for list payloads + +## Nested Class Summary +| Modifier and Type | Class and Description | +| ----------------- | ---------------------- | +| sealed interface | [SelfReferencingArrayModel.SelfReferencingArrayModel1Boxed](#selfreferencingarraymodel1boxed)
sealed interface for validated payloads | +| record | [SelfReferencingArrayModel.SelfReferencingArrayModel1BoxedList](#selfreferencingarraymodel1boxedlist)
boxed class to store validated List payloads | +| static class | [SelfReferencingArrayModel.SelfReferencingArrayModel1](#selfreferencingarraymodel1)
schema class | +| static class | [SelfReferencingArrayModel.SelfReferencingArrayModelListBuilder](#selfreferencingarraymodellistbuilder)
builder for List payloads | +| static class | [SelfReferencingArrayModel.SelfReferencingArrayModelList](#selfreferencingarraymodellist)
output class for List payloads | + +## SelfReferencingArrayModel1Boxed +public sealed interface SelfReferencingArrayModel1Boxed
+permits
+[SelfReferencingArrayModel1BoxedList](#selfreferencingarraymodel1boxedlist) + +sealed interface that stores validated payloads using boxed classes + +## SelfReferencingArrayModel1BoxedList +public record SelfReferencingArrayModel1BoxedList
+implements [SelfReferencingArrayModel1Boxed](#selfreferencingarraymodel1boxed) + +record that stores validated List payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| SelfReferencingArrayModel1BoxedList([SelfReferencingArrayModelList](#selfreferencingarraymodellist) data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| [SelfReferencingArrayModelList](#selfreferencingarraymodellist) | data()
validated payload | +| @Nullable Object | getData()
validated payload | + +## SelfReferencingArrayModel1 +public static class SelfReferencingArrayModel1
+extends JsonSchema + +A schema class that validates payloads + +### Code Sample +``` +import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags; +import org.openapijsonschematools.client.configurations.SchemaConfiguration; +import org.openapijsonschematools.client.exceptions.ValidationException; +import org.openapijsonschematools.client.schemas.validation.MapUtils; +import org.openapijsonschematools.client.schemas.validation.FrozenList; +import org.openapijsonschematools.client.schemas.validation.FrozenMap; +import org.openapijsonschematools.client.components.schemas.SelfReferencingArrayModel; + +import java.util.Arrays; +import java.util.List; +import java.util.AbstractMap; + +static final SchemaConfiguration configuration = new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().build()); + +// List validation +SelfReferencingArrayModel.SelfReferencingArrayModelList validatedPayload = + SelfReferencingArrayModel.SelfReferencingArrayModel1.validate( + new SelfReferencingArrayModel.SelfReferencingArrayModelListBuilder() + .build(), + configuration +); +``` + +### Field Summary +| Modifier and Type | Field and Description | +| ----------------- | ---------------------- | +| Set> | type = Set.of(List.class) | +| Class | items = [SelfReferencingArrayModel1.class](#selfreferencingarraymodel1) | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| [SelfReferencingArrayModelList](#selfreferencingarraymodellist) | validate([List](#selfreferencingarraymodellistbuilder) arg, SchemaConfiguration configuration) | +| [SelfReferencingArrayModel1BoxedList](#selfreferencingarraymodel1boxedlist) | validateAndBox([List](#selfreferencingarraymodellistbuilder) arg, SchemaConfiguration configuration) | +| [SelfReferencingArrayModel1Boxed](#selfreferencingarraymodel1boxed) | validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) | +| @Nullable Object | validate(@Nullable Object arg, SchemaConfiguration configuration) | + +## SelfReferencingArrayModelListBuilder +public class SelfReferencingArrayModelListBuilder
+builder for `List>` + +A class that builds the List input type + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| SelfReferencingArrayModelListBuilder()
Creates an empty list | +| SelfReferencingArrayModelListBuilder(List> items)
Stores the items in a list | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| SelfReferencingArrayModelListBuilder | add(List item) | +| List> | build()
Returns list input that should be used with Schema.validate | + +## SelfReferencingArrayModelList +public class SelfReferencingArrayModelList
+extends `FrozenList` + +A class to store validated List payloads + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| static [SelfReferencingArrayModelList](#selfreferencingarraymodellist) | of([List>](#selfreferencingarraymodellistbuilder) arg, SchemaConfiguration configuration) | + +[[Back to top]](#top) [[Back to Component Schemas]](../../../README.md#Component-Schemas) [[Back to README]](../../../README.md) diff --git a/samples/client/petstore/kotlin/docs/components/schemas/SelfReferencingObjectModel.md b/samples/client/petstore/kotlin/docs/components/schemas/SelfReferencingObjectModel.md new file mode 100644 index 00000000000..587d1f6d89c --- /dev/null +++ b/samples/client/petstore/kotlin/docs/components/schemas/SelfReferencingObjectModel.md @@ -0,0 +1,122 @@ +# SelfReferencingObjectModel +org.openapijsonschematools.client.components.schemas.SelfReferencingObjectModel.java +public class SelfReferencingObjectModel
+ +A class that contains necessary nested +- schema classes (which validate payloads), extends JsonSchema +- sealed interfaces which store validated payloads, java version of a sum type +- boxed classes which store validated payloads, sealed permits class implementations +- classes to store validated map payloads, extends FrozenMap +- classes to build inputs for map payloads + +## Nested Class Summary +| Modifier and Type | Class and Description | +| ----------------- | ---------------------- | +| sealed interface | [SelfReferencingObjectModel.SelfReferencingObjectModel1Boxed](#selfreferencingobjectmodel1boxed)
sealed interface for validated payloads | +| record | [SelfReferencingObjectModel.SelfReferencingObjectModel1BoxedMap](#selfreferencingobjectmodel1boxedmap)
boxed class to store validated Map payloads | +| static class | [SelfReferencingObjectModel.SelfReferencingObjectModel1](#selfreferencingobjectmodel1)
schema class | +| static class | [SelfReferencingObjectModel.SelfReferencingObjectModelMapBuilder](#selfreferencingobjectmodelmapbuilder)
builder for Map payloads | +| static class | [SelfReferencingObjectModel.SelfReferencingObjectModelMap](#selfreferencingobjectmodelmap)
output class for Map payloads | + +## SelfReferencingObjectModel1Boxed +public sealed interface SelfReferencingObjectModel1Boxed
+permits
+[SelfReferencingObjectModel1BoxedMap](#selfreferencingobjectmodel1boxedmap) + +sealed interface that stores validated payloads using boxed classes + +## SelfReferencingObjectModel1BoxedMap +public record SelfReferencingObjectModel1BoxedMap
+implements [SelfReferencingObjectModel1Boxed](#selfreferencingobjectmodel1boxed) + +record that stores validated Map payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| SelfReferencingObjectModel1BoxedMap([SelfReferencingObjectModelMap](#selfreferencingobjectmodelmap) data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| [SelfReferencingObjectModelMap](#selfreferencingobjectmodelmap) | data()
validated payload | +| @Nullable Object | getData()
validated payload | + +## SelfReferencingObjectModel1 +public static class SelfReferencingObjectModel1
+extends JsonSchema + +A schema class that validates payloads + +### Code Sample +``` +import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags; +import org.openapijsonschematools.client.configurations.SchemaConfiguration; +import org.openapijsonschematools.client.exceptions.ValidationException; +import org.openapijsonschematools.client.schemas.validation.MapUtils; +import org.openapijsonschematools.client.schemas.validation.FrozenList; +import org.openapijsonschematools.client.schemas.validation.FrozenMap; +import org.openapijsonschematools.client.components.schemas.SelfReferencingObjectModel; + +import java.util.Arrays; +import java.util.List; +import java.util.AbstractMap; + +static final SchemaConfiguration configuration = new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().build()); + +// Map validation +SelfReferencingObjectModel.SelfReferencingObjectModelMap validatedPayload = + SelfReferencingObjectModel.SelfReferencingObjectModel1.validate( + new SelfReferencingObjectModel.SelfReferencingObjectModelMapBuilder() + .build(), + configuration +); +``` + +### Field Summary +| Modifier and Type | Field and Description | +| ----------------- | ---------------------- | +| Set> | type = Set.of(Map.class) | +| Map> | properties = Map.ofEntries(
    new PropertyEntry("selfRef", [SelfReferencingObjectModel1.class](#selfreferencingobjectmodel1)))
)
| +| Class | additionalProperties = [SelfReferencingObjectModel1.class](#selfreferencingobjectmodel1) | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| [SelfReferencingObjectModelMap](#selfreferencingobjectmodelmap) | validate([Map<?, ?>](#selfreferencingobjectmodelmapbuilder) arg, SchemaConfiguration configuration) | +| [SelfReferencingObjectModel1BoxedMap](#selfreferencingobjectmodel1boxedmap) | validateAndBox([Map<?, ?>](#selfreferencingobjectmodelmapbuilder) arg, SchemaConfiguration configuration) | +| [SelfReferencingObjectModel1Boxed](#selfreferencingobjectmodel1boxed) | validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) | +| @Nullable Object | validate(@Nullable Object arg, SchemaConfiguration configuration) | + +## SelfReferencingObjectModelMapBuilder +public class SelfReferencingObjectModelMapBuilder
+builder for `Map` + +A class that builds the Map input type + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| SelfReferencingObjectModelMapBuilder()
Creates a builder that contains an empty map | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| Map | build()
Returns map input that should be used with Schema.validate | +| [SelfReferencingObjectModelMapBuilder](#selfreferencingobjectmodelmapbuilder) | selfRef(Map value) | +| [SelfReferencingObjectModelMapBuilder](#selfreferencingobjectmodelmapbuilder) | additionalProperty(String key, Map value) | + +## SelfReferencingObjectModelMap +public static class SelfReferencingObjectModelMap
+extends FrozenMap + +A class to store validated Map payloads + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| static [SelfReferencingObjectModelMap](#selfreferencingobjectmodelmap) | of([Map](#selfreferencingobjectmodelmapbuilder) arg, SchemaConfiguration configuration) | +| [SelfReferencingObjectModelMap](#selfreferencingobjectmodelmap) | selfRef()
[optional] | +| [SelfReferencingObjectModelMap](#selfreferencingobjectmodelmap) | getAdditionalProperty(String name)
provides type safety for additional properties | + +[[Back to top]](#top) [[Back to Component Schemas]](../../../README.md#Component-Schemas) [[Back to README]](../../../README.md) diff --git a/samples/client/petstore/kotlin/docs/components/schemas/Shape.md b/samples/client/petstore/kotlin/docs/components/schemas/Shape.md new file mode 100644 index 00000000000..3ace8e6991f --- /dev/null +++ b/samples/client/petstore/kotlin/docs/components/schemas/Shape.md @@ -0,0 +1,169 @@ +# Shape +org.openapijsonschematools.client.components.schemas.Shape.java +public class Shape
+ +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 + +## Nested Class Summary +| Modifier and Type | Class and Description | +| ----------------- | ---------------------- | +| sealed interface | [Shape.Shape1Boxed](#shape1boxed)
sealed interface for validated payloads | +| record | [Shape.Shape1BoxedVoid](#shape1boxedvoid)
boxed class to store validated null payloads | +| record | [Shape.Shape1BoxedBoolean](#shape1boxedboolean)
boxed class to store validated boolean payloads | +| record | [Shape.Shape1BoxedNumber](#shape1boxednumber)
boxed class to store validated Number payloads | +| record | [Shape.Shape1BoxedString](#shape1boxedstring)
boxed class to store validated String payloads | +| record | [Shape.Shape1BoxedList](#shape1boxedlist)
boxed class to store validated List payloads | +| record | [Shape.Shape1BoxedMap](#shape1boxedmap)
boxed class to store validated Map payloads | +| static class | [Shape.Shape1](#shape1)
schema class | + +## Shape1Boxed +public sealed interface Shape1Boxed
+permits
+[Shape1BoxedVoid](#shape1boxedvoid), +[Shape1BoxedBoolean](#shape1boxedboolean), +[Shape1BoxedNumber](#shape1boxednumber), +[Shape1BoxedString](#shape1boxedstring), +[Shape1BoxedList](#shape1boxedlist), +[Shape1BoxedMap](#shape1boxedmap) + +sealed interface that stores validated payloads using boxed classes + +## Shape1BoxedVoid +public record Shape1BoxedVoid
+implements [Shape1Boxed](#shape1boxed) + +record that stores validated null payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| Shape1BoxedVoid(Nothing? data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| Nothing? | data()
validated payload | +| @Nullable Object | getData()
validated payload | + +## Shape1BoxedBoolean +public record Shape1BoxedBoolean
+implements [Shape1Boxed](#shape1boxed) + +record that stores validated boolean payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| Shape1BoxedBoolean(boolean data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| boolean | data()
validated payload | +| @Nullable Object | getData()
validated payload | + +## Shape1BoxedNumber +public record Shape1BoxedNumber
+implements [Shape1Boxed](#shape1boxed) + +record that stores validated Number payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| Shape1BoxedNumber(Number data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| Number | data()
validated payload | +| @Nullable Object | getData()
validated payload | + +## Shape1BoxedString +public record Shape1BoxedString
+implements [Shape1Boxed](#shape1boxed) + +record that stores validated String payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| Shape1BoxedString(String data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| String | data()
validated payload | +| @Nullable Object | getData()
validated payload | + +## Shape1BoxedList +public record Shape1BoxedList
+implements [Shape1Boxed](#shape1boxed) + +record that stores validated List payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| Shape1BoxedList(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 | + +## Shape1BoxedMap +public record Shape1BoxedMap
+implements [Shape1Boxed](#shape1boxed) + +record that stores validated Map payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| Shape1BoxedMap(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 | + +## Shape1 +public static class Shape1
+extends JsonSchema + +A schema class that validates payloads + +### Field Summary +| Modifier and Type | Field and Description | +| ----------------- | ---------------------- | +| List> | oneOf = List.of(
    [Triangle.Triangle1.class](../../components/schemas/Triangle.md#triangle1),
    [Quadrilateral.Quadrilateral1.class](../../components/schemas/Quadrilateral.md#quadrilateral1)
))
| + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| String | validate(String arg, SchemaConfiguration configuration) | +| Nothing? | validate(Nothing? arg, SchemaConfiguration configuration) | +| int | validate(int arg, SchemaConfiguration configuration) | +| long | validate(long arg, SchemaConfiguration configuration) | +| float | validate(float arg, SchemaConfiguration configuration) | +| double | validate(double arg, SchemaConfiguration configuration) | +| Number | validate(Number arg, SchemaConfiguration configuration) | +| boolean | validate(boolean arg, SchemaConfiguration configuration) | +| FrozenMap<@Nullable Object> | validate(Map<?, ?> arg, SchemaConfiguration configuration) | +| FrozenList<@Nullable Object> | validate(List arg, SchemaConfiguration configuration) | +| [Shape1BoxedString](#shape1boxedstring) | validateAndBox(String arg, SchemaConfiguration configuration) | +| [Shape1BoxedVoid](#shape1boxedvoid) | validateAndBox(Nothing? arg, SchemaConfiguration configuration) | +| [Shape1BoxedNumber](#shape1boxednumber) | validateAndBox(Number arg, SchemaConfiguration configuration) | +| [Shape1BoxedBoolean](#shape1boxedboolean) | validateAndBox(boolean arg, SchemaConfiguration configuration) | +| [Shape1BoxedMap](#shape1boxedmap) | validateAndBox(Map<?, ?> arg, SchemaConfiguration configuration) | +| [Shape1BoxedList](#shape1boxedlist) | validateAndBox(List arg, SchemaConfiguration configuration) | +| [Shape1Boxed](#shape1boxed) | validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) | +| @Nullable Object | validate(@Nullable Object arg, SchemaConfiguration configuration) | + +[[Back to top]](#top) [[Back to Component Schemas]](../../../README.md#Component-Schemas) [[Back to README]](../../../README.md) diff --git a/samples/client/petstore/kotlin/docs/components/schemas/ShapeOrNull.md b/samples/client/petstore/kotlin/docs/components/schemas/ShapeOrNull.md new file mode 100644 index 00000000000..8ef9d1f2f18 --- /dev/null +++ b/samples/client/petstore/kotlin/docs/components/schemas/ShapeOrNull.md @@ -0,0 +1,210 @@ +# ShapeOrNull +org.openapijsonschematools.client.components.schemas.ShapeOrNull.java +public class ShapeOrNull
+ +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 + +## Nested Class Summary +| Modifier and Type | Class and Description | +| ----------------- | ---------------------- | +| sealed interface | [ShapeOrNull.ShapeOrNull1Boxed](#shapeornull1boxed)
sealed interface for validated payloads | +| record | [ShapeOrNull.ShapeOrNull1BoxedVoid](#shapeornull1boxedvoid)
boxed class to store validated null payloads | +| record | [ShapeOrNull.ShapeOrNull1BoxedBoolean](#shapeornull1boxedboolean)
boxed class to store validated boolean payloads | +| record | [ShapeOrNull.ShapeOrNull1BoxedNumber](#shapeornull1boxednumber)
boxed class to store validated Number payloads | +| record | [ShapeOrNull.ShapeOrNull1BoxedString](#shapeornull1boxedstring)
boxed class to store validated String payloads | +| record | [ShapeOrNull.ShapeOrNull1BoxedList](#shapeornull1boxedlist)
boxed class to store validated List payloads | +| record | [ShapeOrNull.ShapeOrNull1BoxedMap](#shapeornull1boxedmap)
boxed class to store validated Map payloads | +| static class | [ShapeOrNull.ShapeOrNull1](#shapeornull1)
schema class | +| sealed interface | [ShapeOrNull.Schema0Boxed](#schema0boxed)
sealed interface for validated payloads | +| record | [ShapeOrNull.Schema0BoxedVoid](#schema0boxedvoid)
boxed class to store validated null payloads | +| static class | [ShapeOrNull.Schema0](#schema0)
schema class | + +## ShapeOrNull1Boxed +public sealed interface ShapeOrNull1Boxed
+permits
+[ShapeOrNull1BoxedVoid](#shapeornull1boxedvoid), +[ShapeOrNull1BoxedBoolean](#shapeornull1boxedboolean), +[ShapeOrNull1BoxedNumber](#shapeornull1boxednumber), +[ShapeOrNull1BoxedString](#shapeornull1boxedstring), +[ShapeOrNull1BoxedList](#shapeornull1boxedlist), +[ShapeOrNull1BoxedMap](#shapeornull1boxedmap) + +sealed interface that stores validated payloads using boxed classes + +## ShapeOrNull1BoxedVoid +public record ShapeOrNull1BoxedVoid
+implements [ShapeOrNull1Boxed](#shapeornull1boxed) + +record that stores validated null payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| ShapeOrNull1BoxedVoid(Nothing? data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| Nothing? | data()
validated payload | +| @Nullable Object | getData()
validated payload | + +## ShapeOrNull1BoxedBoolean +public record ShapeOrNull1BoxedBoolean
+implements [ShapeOrNull1Boxed](#shapeornull1boxed) + +record that stores validated boolean payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| ShapeOrNull1BoxedBoolean(boolean data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| boolean | data()
validated payload | +| @Nullable Object | getData()
validated payload | + +## ShapeOrNull1BoxedNumber +public record ShapeOrNull1BoxedNumber
+implements [ShapeOrNull1Boxed](#shapeornull1boxed) + +record that stores validated Number payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| ShapeOrNull1BoxedNumber(Number data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| Number | data()
validated payload | +| @Nullable Object | getData()
validated payload | + +## ShapeOrNull1BoxedString +public record ShapeOrNull1BoxedString
+implements [ShapeOrNull1Boxed](#shapeornull1boxed) + +record that stores validated String payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| ShapeOrNull1BoxedString(String data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| String | data()
validated payload | +| @Nullable Object | getData()
validated payload | + +## ShapeOrNull1BoxedList +public record ShapeOrNull1BoxedList
+implements [ShapeOrNull1Boxed](#shapeornull1boxed) + +record that stores validated List payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| ShapeOrNull1BoxedList(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 | + +## ShapeOrNull1BoxedMap +public record ShapeOrNull1BoxedMap
+implements [ShapeOrNull1Boxed](#shapeornull1boxed) + +record that stores validated Map payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| ShapeOrNull1BoxedMap(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 | + +## ShapeOrNull1 +public static class ShapeOrNull1
+extends JsonSchema + +A schema class that validates payloads + +## Description +The value may be a shape or the 'null' value. This is introduced in OAS schema >= 3.1. + +### Field Summary +| Modifier and Type | Field and Description | +| ----------------- | ---------------------- | +| List> | oneOf = List.of(
    [Schema0.class](#schema0),
    [Triangle.Triangle1.class](../../components/schemas/Triangle.md#triangle1),
    [Quadrilateral.Quadrilateral1.class](../../components/schemas/Quadrilateral.md#quadrilateral1)
))
| + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| String | validate(String arg, SchemaConfiguration configuration) | +| Nothing? | validate(Nothing? arg, SchemaConfiguration configuration) | +| int | validate(int arg, SchemaConfiguration configuration) | +| long | validate(long arg, SchemaConfiguration configuration) | +| float | validate(float arg, SchemaConfiguration configuration) | +| double | validate(double arg, SchemaConfiguration configuration) | +| Number | validate(Number arg, SchemaConfiguration configuration) | +| boolean | validate(boolean arg, SchemaConfiguration configuration) | +| FrozenMap<@Nullable Object> | validate(Map<?, ?> arg, SchemaConfiguration configuration) | +| FrozenList<@Nullable Object> | validate(List arg, SchemaConfiguration configuration) | +| [ShapeOrNull1BoxedString](#shapeornull1boxedstring) | validateAndBox(String arg, SchemaConfiguration configuration) | +| [ShapeOrNull1BoxedVoid](#shapeornull1boxedvoid) | validateAndBox(Nothing? arg, SchemaConfiguration configuration) | +| [ShapeOrNull1BoxedNumber](#shapeornull1boxednumber) | validateAndBox(Number arg, SchemaConfiguration configuration) | +| [ShapeOrNull1BoxedBoolean](#shapeornull1boxedboolean) | validateAndBox(boolean arg, SchemaConfiguration configuration) | +| [ShapeOrNull1BoxedMap](#shapeornull1boxedmap) | validateAndBox(Map<?, ?> arg, SchemaConfiguration configuration) | +| [ShapeOrNull1BoxedList](#shapeornull1boxedlist) | validateAndBox(List arg, SchemaConfiguration configuration) | +| [ShapeOrNull1Boxed](#shapeornull1boxed) | validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) | +| @Nullable Object | validate(@Nullable Object arg, SchemaConfiguration configuration) | + +## Schema0Boxed +public sealed interface Schema0Boxed
+permits
+[Schema0BoxedVoid](#schema0boxedvoid) + +sealed interface that stores validated payloads using boxed classes + +## Schema0BoxedVoid +public record Schema0BoxedVoid
+implements [Schema0Boxed](#schema0boxed) + +record that stores validated null payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| Schema0BoxedVoid(Nothing? data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| Nothing? | data()
validated payload | +| @Nullable Object | getData()
validated payload | + +## Schema0 +public static class Schema0
+extends NullJsonSchema.NullJsonSchema1 + +A schema class that validates payloads + +| Methods Inherited from class org.openapijsonschematools.client.schemas.NullJsonSchema.NullJsonSchema1 | +| ------------------------------------------------------------------ | +| validate | +| validateAndBox | + +[[Back to top]](#top) [[Back to Component Schemas]](../../../README.md#Component-Schemas) [[Back to README]](../../../README.md) diff --git a/samples/client/petstore/kotlin/docs/components/schemas/SimpleQuadrilateral.md b/samples/client/petstore/kotlin/docs/components/schemas/SimpleQuadrilateral.md new file mode 100644 index 00000000000..cff62e66032 --- /dev/null +++ b/samples/client/petstore/kotlin/docs/components/schemas/SimpleQuadrilateral.md @@ -0,0 +1,371 @@ +# SimpleQuadrilateral +org.openapijsonschematools.client.components.schemas.SimpleQuadrilateral.java +public class SimpleQuadrilateral
+ +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 | [SimpleQuadrilateral.SimpleQuadrilateral1Boxed](#simplequadrilateral1boxed)
sealed interface for validated payloads | +| record | [SimpleQuadrilateral.SimpleQuadrilateral1BoxedVoid](#simplequadrilateral1boxedvoid)
boxed class to store validated null payloads | +| record | [SimpleQuadrilateral.SimpleQuadrilateral1BoxedBoolean](#simplequadrilateral1boxedboolean)
boxed class to store validated boolean payloads | +| record | [SimpleQuadrilateral.SimpleQuadrilateral1BoxedNumber](#simplequadrilateral1boxednumber)
boxed class to store validated Number payloads | +| record | [SimpleQuadrilateral.SimpleQuadrilateral1BoxedString](#simplequadrilateral1boxedstring)
boxed class to store validated String payloads | +| record | [SimpleQuadrilateral.SimpleQuadrilateral1BoxedList](#simplequadrilateral1boxedlist)
boxed class to store validated List payloads | +| record | [SimpleQuadrilateral.SimpleQuadrilateral1BoxedMap](#simplequadrilateral1boxedmap)
boxed class to store validated Map payloads | +| static class | [SimpleQuadrilateral.SimpleQuadrilateral1](#simplequadrilateral1)
schema class | +| sealed interface | [SimpleQuadrilateral.Schema1Boxed](#schema1boxed)
sealed interface for validated payloads | +| record | [SimpleQuadrilateral.Schema1BoxedMap](#schema1boxedmap)
boxed class to store validated Map payloads | +| static class | [SimpleQuadrilateral.Schema1](#schema1)
schema class | +| static class | [SimpleQuadrilateral.Schema1MapBuilder](#schema1mapbuilder)
builder for Map payloads | +| static class | [SimpleQuadrilateral.Schema1Map](#schema1map)
output class for Map payloads | +| sealed interface | [SimpleQuadrilateral.QuadrilateralTypeBoxed](#quadrilateraltypeboxed)
sealed interface for validated payloads | +| record | [SimpleQuadrilateral.QuadrilateralTypeBoxedString](#quadrilateraltypeboxedstring)
boxed class to store validated String payloads | +| static class | [SimpleQuadrilateral.QuadrilateralType](#quadrilateraltype)
schema class | +| enum | [SimpleQuadrilateral.StringQuadrilateralTypeEnums](#stringquadrilateraltypeenums)
String enum | + +## SimpleQuadrilateral1Boxed +public sealed interface SimpleQuadrilateral1Boxed
+permits
+[SimpleQuadrilateral1BoxedVoid](#simplequadrilateral1boxedvoid), +[SimpleQuadrilateral1BoxedBoolean](#simplequadrilateral1boxedboolean), +[SimpleQuadrilateral1BoxedNumber](#simplequadrilateral1boxednumber), +[SimpleQuadrilateral1BoxedString](#simplequadrilateral1boxedstring), +[SimpleQuadrilateral1BoxedList](#simplequadrilateral1boxedlist), +[SimpleQuadrilateral1BoxedMap](#simplequadrilateral1boxedmap) + +sealed interface that stores validated payloads using boxed classes + +## SimpleQuadrilateral1BoxedVoid +public record SimpleQuadrilateral1BoxedVoid
+implements [SimpleQuadrilateral1Boxed](#simplequadrilateral1boxed) + +record that stores validated null payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| SimpleQuadrilateral1BoxedVoid(Nothing? data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| Nothing? | data()
validated payload | +| @Nullable Object | getData()
validated payload | + +## SimpleQuadrilateral1BoxedBoolean +public record SimpleQuadrilateral1BoxedBoolean
+implements [SimpleQuadrilateral1Boxed](#simplequadrilateral1boxed) + +record that stores validated boolean payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| SimpleQuadrilateral1BoxedBoolean(boolean data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| boolean | data()
validated payload | +| @Nullable Object | getData()
validated payload | + +## SimpleQuadrilateral1BoxedNumber +public record SimpleQuadrilateral1BoxedNumber
+implements [SimpleQuadrilateral1Boxed](#simplequadrilateral1boxed) + +record that stores validated Number payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| SimpleQuadrilateral1BoxedNumber(Number data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| Number | data()
validated payload | +| @Nullable Object | getData()
validated payload | + +## SimpleQuadrilateral1BoxedString +public record SimpleQuadrilateral1BoxedString
+implements [SimpleQuadrilateral1Boxed](#simplequadrilateral1boxed) + +record that stores validated String payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| SimpleQuadrilateral1BoxedString(String data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| String | data()
validated payload | +| @Nullable Object | getData()
validated payload | + +## SimpleQuadrilateral1BoxedList +public record SimpleQuadrilateral1BoxedList
+implements [SimpleQuadrilateral1Boxed](#simplequadrilateral1boxed) + +record that stores validated List payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| SimpleQuadrilateral1BoxedList(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 | + +## SimpleQuadrilateral1BoxedMap +public record SimpleQuadrilateral1BoxedMap
+implements [SimpleQuadrilateral1Boxed](#simplequadrilateral1boxed) + +record that stores validated Map payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| SimpleQuadrilateral1BoxedMap(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 | + +## SimpleQuadrilateral1 +public static class SimpleQuadrilateral1
+extends JsonSchema + +A schema class that validates payloads + +### Field Summary +| Modifier and Type | Field and Description | +| ----------------- | ---------------------- | +| List> | allOf = List.of(
    [QuadrilateralInterface.QuadrilateralInterface1.class](../../components/schemas/QuadrilateralInterface.md#quadrilateralinterface1),
    [Schema1.class](#schema1)
;)
| + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| String | validate(String arg, SchemaConfiguration configuration) | +| Nothing? | validate(Nothing? arg, SchemaConfiguration configuration) | +| int | validate(int arg, SchemaConfiguration configuration) | +| long | validate(long arg, SchemaConfiguration configuration) | +| float | validate(float arg, SchemaConfiguration configuration) | +| double | validate(double arg, SchemaConfiguration configuration) | +| Number | validate(Number arg, SchemaConfiguration configuration) | +| boolean | validate(boolean arg, SchemaConfiguration configuration) | +| FrozenMap<@Nullable Object> | validate(Map<?, ?> arg, SchemaConfiguration configuration) | +| FrozenList<@Nullable Object> | validate(List arg, SchemaConfiguration configuration) | +| [SimpleQuadrilateral1BoxedString](#simplequadrilateral1boxedstring) | validateAndBox(String arg, SchemaConfiguration configuration) | +| [SimpleQuadrilateral1BoxedVoid](#simplequadrilateral1boxedvoid) | validateAndBox(Nothing? arg, SchemaConfiguration configuration) | +| [SimpleQuadrilateral1BoxedNumber](#simplequadrilateral1boxednumber) | validateAndBox(Number arg, SchemaConfiguration configuration) | +| [SimpleQuadrilateral1BoxedBoolean](#simplequadrilateral1boxedboolean) | validateAndBox(boolean arg, SchemaConfiguration configuration) | +| [SimpleQuadrilateral1BoxedMap](#simplequadrilateral1boxedmap) | validateAndBox(Map<?, ?> arg, SchemaConfiguration configuration) | +| [SimpleQuadrilateral1BoxedList](#simplequadrilateral1boxedlist) | validateAndBox(List arg, SchemaConfiguration configuration) | +| [SimpleQuadrilateral1Boxed](#simplequadrilateral1boxed) | validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) | +| @Nullable Object | validate(@Nullable Object arg, SchemaConfiguration configuration) | + +## Schema1Boxed +public sealed interface Schema1Boxed
+permits
+[Schema1BoxedMap](#schema1boxedmap) + +sealed interface that stores validated payloads using boxed classes + +## Schema1BoxedMap +public record Schema1BoxedMap
+implements [Schema1Boxed](#schema1boxed) + +record that stores validated Map payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| Schema1BoxedMap([Schema1Map](#schema1map) data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| [Schema1Map](#schema1map) | data()
validated payload | +| @Nullable Object | getData()
validated payload | + +## Schema1 +public static class Schema1
+extends JsonSchema + +A schema class that validates payloads + +### Code Sample +``` +import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags; +import org.openapijsonschematools.client.configurations.SchemaConfiguration; +import org.openapijsonschematools.client.exceptions.ValidationException; +import org.openapijsonschematools.client.schemas.validation.MapUtils; +import org.openapijsonschematools.client.schemas.validation.FrozenList; +import org.openapijsonschematools.client.schemas.validation.FrozenMap; +import org.openapijsonschematools.client.components.schemas.SimpleQuadrilateral; + +import java.util.Arrays; +import java.util.List; +import java.util.AbstractMap; + +static final SchemaConfiguration configuration = new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().build()); + +// Map validation +SimpleQuadrilateral.Schema1Map validatedPayload = + SimpleQuadrilateral.Schema1.validate( + new SimpleQuadrilateral.Schema1MapBuilder() + .quadrilateralType("SimpleQuadrilateral") + + .build(), + configuration +); +``` + +### Field Summary +| Modifier and Type | Field and Description | +| ----------------- | ---------------------- | +| Set> | type = Set.of(Map.class) | +| Map> | properties = Map.ofEntries(
    new PropertyEntry("quadrilateralType", [QuadrilateralType.class](#quadrilateraltype)))
)
| + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| [Schema1Map](#schema1map) | validate([Map<?, ?>](#schema1mapbuilder) arg, SchemaConfiguration configuration) | +| [Schema1BoxedMap](#schema1boxedmap) | validateAndBox([Map<?, ?>](#schema1mapbuilder) arg, SchemaConfiguration configuration) | +| [Schema1Boxed](#schema1boxed) | validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) | +| @Nullable Object | validate(@Nullable Object arg, SchemaConfiguration configuration) | + +## Schema1MapBuilder +public class Schema1MapBuilder
+builder for `Map` + +A class that builds the Map input type + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| Schema1MapBuilder()
Creates a builder that contains an empty map | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| Map | build()
Returns map input that should be used with Schema.validate | +| [Schema1MapBuilder](#schema1mapbuilder) | quadrilateralType(String value) | +| [Schema1MapBuilder](#schema1mapbuilder) | quadrilateralType([StringQuadrilateralTypeEnums](#stringquadrilateraltypeenums) value) | +| [Schema1MapBuilder](#schema1mapbuilder) | additionalProperty(String key, Nothing? value) | +| [Schema1MapBuilder](#schema1mapbuilder) | additionalProperty(String key, boolean value) | +| [Schema1MapBuilder](#schema1mapbuilder) | additionalProperty(String key, String value) | +| [Schema1MapBuilder](#schema1mapbuilder) | additionalProperty(String key, int value) | +| [Schema1MapBuilder](#schema1mapbuilder) | additionalProperty(String key, float value) | +| [Schema1MapBuilder](#schema1mapbuilder) | additionalProperty(String key, long value) | +| [Schema1MapBuilder](#schema1mapbuilder) | additionalProperty(String key, double value) | +| [Schema1MapBuilder](#schema1mapbuilder) | additionalProperty(String key, List value) | +| [Schema1MapBuilder](#schema1mapbuilder) | additionalProperty(String key, Map value) | + +## Schema1Map +public static class Schema1Map
+extends FrozenMap + +A class to store validated Map payloads + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| static [Schema1Map](#schema1map) | of([Map](#schema1mapbuilder) arg, SchemaConfiguration configuration) | +| String | quadrilateralType()
[optional] must be one of ["SimpleQuadrilateral"] | +| @Nullable Object | getAdditionalProperty(String name)
provides type safety for additional properties | + +## QuadrilateralTypeBoxed +public sealed interface QuadrilateralTypeBoxed
+permits
+[QuadrilateralTypeBoxedString](#quadrilateraltypeboxedstring) + +sealed interface that stores validated payloads using boxed classes + +## QuadrilateralTypeBoxedString +public record QuadrilateralTypeBoxedString
+implements [QuadrilateralTypeBoxed](#quadrilateraltypeboxed) + +record that stores validated String payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| QuadrilateralTypeBoxedString(String data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| String | data()
validated payload | +| @Nullable Object | getData()
validated payload | + +## QuadrilateralType +public static class QuadrilateralType
+extends JsonSchema + +A schema class that validates payloads + +### Code Sample +``` +import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags; +import org.openapijsonschematools.client.configurations.SchemaConfiguration; +import org.openapijsonschematools.client.exceptions.ValidationException; +import org.openapijsonschematools.client.schemas.validation.MapUtils; +import org.openapijsonschematools.client.schemas.validation.FrozenList; +import org.openapijsonschematools.client.schemas.validation.FrozenMap; +import org.openapijsonschematools.client.components.schemas.SimpleQuadrilateral; + +import java.util.Arrays; +import java.util.List; +import java.util.AbstractMap; + +static final SchemaConfiguration configuration = new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().build()); + +// String validation +String validatedPayload = SimpleQuadrilateral.QuadrilateralType.validate( + "SimpleQuadrilateral", + configuration +); +``` + +### Field Summary +| Modifier and Type | Field and Description | +| ----------------- | ---------------------- | +| Set> | type = Set.of(
    String.class
)
| +| Set | enumValues = SetMaker.makeSet(
    "SimpleQuadrilateral"
)
| + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| String | validate(String arg, SchemaConfiguration configuration) | +| String | validate([StringQuadrilateralTypeEnums](#stringquadrilateraltypeenums) arg, SchemaConfiguration configuration) | +| [QuadrilateralTypeBoxedString](#quadrilateraltypeboxedstring) | validateAndBox(String arg, SchemaConfiguration configuration) | +| [QuadrilateralTypeBoxed](#quadrilateraltypeboxed) | validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) | +| @Nullable Object | validate(@Nullable Object arg, SchemaConfiguration configuration) | + +## StringQuadrilateralTypeEnums +public enum StringQuadrilateralTypeEnums
+extends `Enum` + +A class that stores String enum values + +### Enum Constant Summary +| Enum Constant | Description | +| ------------- | ----------- | +| SIMPLE_QUADRILATERAL | value = "SimpleQuadrilateral" | + +[[Back to top]](#top) [[Back to Component Schemas]](../../../README.md#Component-Schemas) [[Back to README]](../../../README.md) diff --git a/samples/client/petstore/kotlin/docs/components/schemas/SomeObject.md b/samples/client/petstore/kotlin/docs/components/schemas/SomeObject.md new file mode 100644 index 00000000000..5f9a9c8d7fd --- /dev/null +++ b/samples/client/petstore/kotlin/docs/components/schemas/SomeObject.md @@ -0,0 +1,169 @@ +# SomeObject +org.openapijsonschematools.client.components.schemas.SomeObject.java +public class SomeObject
+ +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 + +## Nested Class Summary +| Modifier and Type | Class and Description | +| ----------------- | ---------------------- | +| sealed interface | [SomeObject.SomeObject1Boxed](#someobject1boxed)
sealed interface for validated payloads | +| record | [SomeObject.SomeObject1BoxedVoid](#someobject1boxedvoid)
boxed class to store validated null payloads | +| record | [SomeObject.SomeObject1BoxedBoolean](#someobject1boxedboolean)
boxed class to store validated boolean payloads | +| record | [SomeObject.SomeObject1BoxedNumber](#someobject1boxednumber)
boxed class to store validated Number payloads | +| record | [SomeObject.SomeObject1BoxedString](#someobject1boxedstring)
boxed class to store validated String payloads | +| record | [SomeObject.SomeObject1BoxedList](#someobject1boxedlist)
boxed class to store validated List payloads | +| record | [SomeObject.SomeObject1BoxedMap](#someobject1boxedmap)
boxed class to store validated Map payloads | +| static class | [SomeObject.SomeObject1](#someobject1)
schema class | + +## SomeObject1Boxed +public sealed interface SomeObject1Boxed
+permits
+[SomeObject1BoxedVoid](#someobject1boxedvoid), +[SomeObject1BoxedBoolean](#someobject1boxedboolean), +[SomeObject1BoxedNumber](#someobject1boxednumber), +[SomeObject1BoxedString](#someobject1boxedstring), +[SomeObject1BoxedList](#someobject1boxedlist), +[SomeObject1BoxedMap](#someobject1boxedmap) + +sealed interface that stores validated payloads using boxed classes + +## SomeObject1BoxedVoid +public record SomeObject1BoxedVoid
+implements [SomeObject1Boxed](#someobject1boxed) + +record that stores validated null payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| SomeObject1BoxedVoid(Nothing? data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| Nothing? | data()
validated payload | +| @Nullable Object | getData()
validated payload | + +## SomeObject1BoxedBoolean +public record SomeObject1BoxedBoolean
+implements [SomeObject1Boxed](#someobject1boxed) + +record that stores validated boolean payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| SomeObject1BoxedBoolean(boolean data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| boolean | data()
validated payload | +| @Nullable Object | getData()
validated payload | + +## SomeObject1BoxedNumber +public record SomeObject1BoxedNumber
+implements [SomeObject1Boxed](#someobject1boxed) + +record that stores validated Number payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| SomeObject1BoxedNumber(Number data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| Number | data()
validated payload | +| @Nullable Object | getData()
validated payload | + +## SomeObject1BoxedString +public record SomeObject1BoxedString
+implements [SomeObject1Boxed](#someobject1boxed) + +record that stores validated String payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| SomeObject1BoxedString(String data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| String | data()
validated payload | +| @Nullable Object | getData()
validated payload | + +## SomeObject1BoxedList +public record SomeObject1BoxedList
+implements [SomeObject1Boxed](#someobject1boxed) + +record that stores validated List payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| SomeObject1BoxedList(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 | + +## SomeObject1BoxedMap +public record SomeObject1BoxedMap
+implements [SomeObject1Boxed](#someobject1boxed) + +record that stores validated Map payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| SomeObject1BoxedMap(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 | + +## SomeObject1 +public static class SomeObject1
+extends JsonSchema + +A schema class that validates payloads + +### Field Summary +| Modifier and Type | Field and Description | +| ----------------- | ---------------------- | +| List> | allOf = List.of(
    [ObjectInterface.ObjectInterface1.class](../../components/schemas/ObjectInterface.md#objectinterface1)
;)
| + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| String | validate(String arg, SchemaConfiguration configuration) | +| Nothing? | validate(Nothing? arg, SchemaConfiguration configuration) | +| int | validate(int arg, SchemaConfiguration configuration) | +| long | validate(long arg, SchemaConfiguration configuration) | +| float | validate(float arg, SchemaConfiguration configuration) | +| double | validate(double arg, SchemaConfiguration configuration) | +| Number | validate(Number arg, SchemaConfiguration configuration) | +| boolean | validate(boolean arg, SchemaConfiguration configuration) | +| FrozenMap<@Nullable Object> | validate(Map<?, ?> arg, SchemaConfiguration configuration) | +| FrozenList<@Nullable Object> | validate(List arg, SchemaConfiguration configuration) | +| [SomeObject1BoxedString](#someobject1boxedstring) | validateAndBox(String arg, SchemaConfiguration configuration) | +| [SomeObject1BoxedVoid](#someobject1boxedvoid) | validateAndBox(Nothing? arg, SchemaConfiguration configuration) | +| [SomeObject1BoxedNumber](#someobject1boxednumber) | validateAndBox(Number arg, SchemaConfiguration configuration) | +| [SomeObject1BoxedBoolean](#someobject1boxedboolean) | validateAndBox(boolean arg, SchemaConfiguration configuration) | +| [SomeObject1BoxedMap](#someobject1boxedmap) | validateAndBox(Map<?, ?> arg, SchemaConfiguration configuration) | +| [SomeObject1BoxedList](#someobject1boxedlist) | validateAndBox(List arg, SchemaConfiguration configuration) | +| [SomeObject1Boxed](#someobject1boxed) | validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) | +| @Nullable Object | validate(@Nullable Object arg, SchemaConfiguration configuration) | + +[[Back to top]](#top) [[Back to Component Schemas]](../../../README.md#Component-Schemas) [[Back to README]](../../../README.md) diff --git a/samples/client/petstore/kotlin/docs/components/schemas/SpecialModelname.md b/samples/client/petstore/kotlin/docs/components/schemas/SpecialModelname.md new file mode 100644 index 00000000000..f3b31c51a87 --- /dev/null +++ b/samples/client/petstore/kotlin/docs/components/schemas/SpecialModelname.md @@ -0,0 +1,172 @@ +# SpecialModelname +org.openapijsonschematools.client.components.schemas.SpecialModelname.java +public class SpecialModelname
+ +A class that contains necessary nested +- schema classes (which validate payloads), extends JsonSchema +- sealed interfaces which store validated payloads, java version of a sum type +- boxed classes which store validated payloads, sealed permits class implementations +- classes to store validated map payloads, extends FrozenMap +- classes to build inputs for map payloads + +## Nested Class Summary +| Modifier and Type | Class and Description | +| ----------------- | ---------------------- | +| sealed interface | [SpecialModelname.SpecialModelname1Boxed](#specialmodelname1boxed)
sealed interface for validated payloads | +| record | [SpecialModelname.SpecialModelname1BoxedMap](#specialmodelname1boxedmap)
boxed class to store validated Map payloads | +| static class | [SpecialModelname.SpecialModelname1](#specialmodelname1)
schema class | +| static class | [SpecialModelname.SpecialModelnameMapBuilder](#specialmodelnamemapbuilder)
builder for Map payloads | +| static class | [SpecialModelname.SpecialModelnameMap](#specialmodelnamemap)
output class for Map payloads | +| sealed interface | [SpecialModelname.ABoxed](#aboxed)
sealed interface for validated payloads | +| record | [SpecialModelname.ABoxedString](#aboxedstring)
boxed class to store validated String payloads | +| static class | [SpecialModelname.A](#a)
schema class | + +## SpecialModelname1Boxed +public sealed interface SpecialModelname1Boxed
+permits
+[SpecialModelname1BoxedMap](#specialmodelname1boxedmap) + +sealed interface that stores validated payloads using boxed classes + +## SpecialModelname1BoxedMap +public record SpecialModelname1BoxedMap
+implements [SpecialModelname1Boxed](#specialmodelname1boxed) + +record that stores validated Map payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| SpecialModelname1BoxedMap([SpecialModelnameMap](#specialmodelnamemap) data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| [SpecialModelnameMap](#specialmodelnamemap) | data()
validated payload | +| @Nullable Object | getData()
validated payload | + +## SpecialModelname1 +public static class SpecialModelname1
+extends JsonSchema + +A schema class that validates payloads + +## Description +model with an invalid class name for python + +### Code Sample +``` +import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags; +import org.openapijsonschematools.client.configurations.SchemaConfiguration; +import org.openapijsonschematools.client.exceptions.ValidationException; +import org.openapijsonschematools.client.schemas.validation.MapUtils; +import org.openapijsonschematools.client.schemas.validation.FrozenList; +import org.openapijsonschematools.client.schemas.validation.FrozenMap; +import org.openapijsonschematools.client.components.schemas.SpecialModelname; + +import java.util.Arrays; +import java.util.List; +import java.util.AbstractMap; + +static final SchemaConfiguration configuration = new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().build()); + +// Map validation +SpecialModelname.SpecialModelnameMap validatedPayload = + SpecialModelname.SpecialModelname1.validate( + new SpecialModelname.SpecialModelnameMapBuilder() + .a("a") + + .build(), + configuration +); +``` + +### Field Summary +| Modifier and Type | Field and Description | +| ----------------- | ---------------------- | +| Set> | type = Set.of(Map.class) | +| Map> | properties = Map.ofEntries(
    new PropertyEntry("a", [A.class](#a)))
)
| + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| [SpecialModelnameMap](#specialmodelnamemap) | validate([Map<?, ?>](#specialmodelnamemapbuilder) arg, SchemaConfiguration configuration) | +| [SpecialModelname1BoxedMap](#specialmodelname1boxedmap) | validateAndBox([Map<?, ?>](#specialmodelnamemapbuilder) arg, SchemaConfiguration configuration) | +| [SpecialModelname1Boxed](#specialmodelname1boxed) | validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) | +| @Nullable Object | validate(@Nullable Object arg, SchemaConfiguration configuration) | + +## SpecialModelnameMapBuilder +public class SpecialModelnameMapBuilder
+builder for `Map` + +A class that builds the Map input type + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| SpecialModelnameMapBuilder()
Creates a builder that contains an empty map | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| Map | build()
Returns map input that should be used with Schema.validate | +| [SpecialModelnameMapBuilder](#specialmodelnamemapbuilder) | a(String value) | +| [SpecialModelnameMapBuilder](#specialmodelnamemapbuilder) | additionalProperty(String key, Nothing? value) | +| [SpecialModelnameMapBuilder](#specialmodelnamemapbuilder) | additionalProperty(String key, boolean value) | +| [SpecialModelnameMapBuilder](#specialmodelnamemapbuilder) | additionalProperty(String key, String value) | +| [SpecialModelnameMapBuilder](#specialmodelnamemapbuilder) | additionalProperty(String key, int value) | +| [SpecialModelnameMapBuilder](#specialmodelnamemapbuilder) | additionalProperty(String key, float value) | +| [SpecialModelnameMapBuilder](#specialmodelnamemapbuilder) | additionalProperty(String key, long value) | +| [SpecialModelnameMapBuilder](#specialmodelnamemapbuilder) | additionalProperty(String key, double value) | +| [SpecialModelnameMapBuilder](#specialmodelnamemapbuilder) | additionalProperty(String key, List value) | +| [SpecialModelnameMapBuilder](#specialmodelnamemapbuilder) | additionalProperty(String key, Map value) | + +## SpecialModelnameMap +public static class SpecialModelnameMap
+extends FrozenMap + +A class to store validated Map payloads + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| static [SpecialModelnameMap](#specialmodelnamemap) | of([Map](#specialmodelnamemapbuilder) arg, SchemaConfiguration configuration) | +| String | a()
[optional] | +| @Nullable Object | getAdditionalProperty(String name)
provides type safety for additional properties | + +## ABoxed +public sealed interface ABoxed
+permits
+[ABoxedString](#aboxedstring) + +sealed interface that stores validated payloads using boxed classes + +## ABoxedString +public record ABoxedString
+implements [ABoxed](#aboxed) + +record that stores validated String payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| ABoxedString(String data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| String | data()
validated payload | +| @Nullable Object | getData()
validated payload | + +## A +public static class A
+extends StringJsonSchema.StringJsonSchema1 + +A schema class that validates payloads + +| Methods Inherited from class org.openapijsonschematools.client.schemas.StringJsonSchema.StringJsonSchema1 | +| ------------------------------------------------------------------ | +| validate | +| validateAndBox | + +[[Back to top]](#top) [[Back to Component Schemas]](../../../README.md#Component-Schemas) [[Back to README]](../../../README.md) diff --git a/samples/client/petstore/kotlin/docs/components/schemas/StringBooleanMap.md b/samples/client/petstore/kotlin/docs/components/schemas/StringBooleanMap.md new file mode 100644 index 00000000000..1d4ff14b2c6 --- /dev/null +++ b/samples/client/petstore/kotlin/docs/components/schemas/StringBooleanMap.md @@ -0,0 +1,159 @@ +# StringBooleanMap +org.openapijsonschematools.client.components.schemas.StringBooleanMap.java +public class StringBooleanMap
+ +A class that contains necessary nested +- schema classes (which validate payloads), extends JsonSchema +- sealed interfaces which store validated payloads, java version of a sum type +- boxed classes which store validated payloads, sealed permits class implementations +- classes to store validated map payloads, extends FrozenMap +- classes to build inputs for map payloads + +## Nested Class Summary +| Modifier and Type | Class and Description | +| ----------------- | ---------------------- | +| sealed interface | [StringBooleanMap.StringBooleanMap1Boxed](#stringbooleanmap1boxed)
sealed interface for validated payloads | +| record | [StringBooleanMap.StringBooleanMap1BoxedMap](#stringbooleanmap1boxedmap)
boxed class to store validated Map payloads | +| static class | [StringBooleanMap.StringBooleanMap1](#stringbooleanmap1)
schema class | +| static class | [StringBooleanMap.StringBooleanMapMapBuilder](#stringbooleanmapmapbuilder)
builder for Map payloads | +| static class | [StringBooleanMap.StringBooleanMapMap](#stringbooleanmapmap)
output class for Map payloads | +| sealed interface | [StringBooleanMap.AdditionalPropertiesBoxed](#additionalpropertiesboxed)
sealed interface for validated payloads | +| record | [StringBooleanMap.AdditionalPropertiesBoxedBoolean](#additionalpropertiesboxedboolean)
boxed class to store validated boolean payloads | +| static class | [StringBooleanMap.AdditionalProperties](#additionalproperties)
schema class | + +## StringBooleanMap1Boxed +public sealed interface StringBooleanMap1Boxed
+permits
+[StringBooleanMap1BoxedMap](#stringbooleanmap1boxedmap) + +sealed interface that stores validated payloads using boxed classes + +## StringBooleanMap1BoxedMap +public record StringBooleanMap1BoxedMap
+implements [StringBooleanMap1Boxed](#stringbooleanmap1boxed) + +record that stores validated Map payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| StringBooleanMap1BoxedMap([StringBooleanMapMap](#stringbooleanmapmap) data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| [StringBooleanMapMap](#stringbooleanmapmap) | data()
validated payload | +| @Nullable Object | getData()
validated payload | + +## StringBooleanMap1 +public static class StringBooleanMap1
+extends JsonSchema + +A schema class that validates payloads + +### Code Sample +``` +import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags; +import org.openapijsonschematools.client.configurations.SchemaConfiguration; +import org.openapijsonschematools.client.exceptions.ValidationException; +import org.openapijsonschematools.client.schemas.validation.MapUtils; +import org.openapijsonschematools.client.schemas.validation.FrozenList; +import org.openapijsonschematools.client.schemas.validation.FrozenMap; +import org.openapijsonschematools.client.components.schemas.StringBooleanMap; + +import java.util.Arrays; +import java.util.List; +import java.util.AbstractMap; + +static final SchemaConfiguration configuration = new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().build()); + +// Map validation +StringBooleanMap.StringBooleanMapMap validatedPayload = + StringBooleanMap.StringBooleanMap1.validate( + new StringBooleanMap.StringBooleanMapMapBuilder() + .additionalProperty("someAdditionalProperty", true) + + .build(), + configuration +); +``` + +### Field Summary +| Modifier and Type | Field and Description | +| ----------------- | ---------------------- | +| Set> | type = Set.of(Map.class) | +| Class | additionalProperties = [AdditionalProperties.class](#additionalproperties) | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| [StringBooleanMapMap](#stringbooleanmapmap) | validate([Map<?, ?>](#stringbooleanmapmapbuilder) arg, SchemaConfiguration configuration) | +| [StringBooleanMap1BoxedMap](#stringbooleanmap1boxedmap) | validateAndBox([Map<?, ?>](#stringbooleanmapmapbuilder) arg, SchemaConfiguration configuration) | +| [StringBooleanMap1Boxed](#stringbooleanmap1boxed) | validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) | +| @Nullable Object | validate(@Nullable Object arg, SchemaConfiguration configuration) | + +## StringBooleanMapMapBuilder +public class StringBooleanMapMapBuilder
+builder for `Map` + +A class that builds the Map input type + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| StringBooleanMapMapBuilder()
Creates a builder that contains an empty map | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| Map | build()
Returns map input that should be used with Schema.validate | +| [StringBooleanMapMapBuilder](#stringbooleanmapmapbuilder) | additionalProperty(String key, boolean value) | + +## StringBooleanMapMap +public static class StringBooleanMapMap
+extends FrozenMap + +A class to store validated Map payloads + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| static [StringBooleanMapMap](#stringbooleanmapmap) | of([Map](#stringbooleanmapmapbuilder) arg, SchemaConfiguration configuration) | +| boolean | getAdditionalProperty(String name)
provides type safety for additional properties | + +## AdditionalPropertiesBoxed +public sealed interface AdditionalPropertiesBoxed
+permits
+[AdditionalPropertiesBoxedBoolean](#additionalpropertiesboxedboolean) + +sealed interface that stores validated payloads using boxed classes + +## 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 | + +## AdditionalProperties +public static class AdditionalProperties
+extends BooleanJsonSchema.BooleanJsonSchema1 + +A schema class that validates payloads + +| Methods Inherited from class org.openapijsonschematools.client.schemas.BooleanJsonSchema.BooleanJsonSchema1 | +| ------------------------------------------------------------------ | +| validate | +| validateAndBox | + +[[Back to top]](#top) [[Back to Component Schemas]](../../../README.md#Component-Schemas) [[Back to README]](../../../README.md) diff --git a/samples/client/petstore/kotlin/docs/components/schemas/StringEnum.md b/samples/client/petstore/kotlin/docs/components/schemas/StringEnum.md new file mode 100644 index 00000000000..8a9ae226c59 --- /dev/null +++ b/samples/client/petstore/kotlin/docs/components/schemas/StringEnum.md @@ -0,0 +1,143 @@ +# StringEnum +org.openapijsonschematools.client.components.schemas.StringEnum.java +public class StringEnum
+ +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 +- enum classes + +## Nested Class Summary +| Modifier and Type | Class and Description | +| ----------------- | ---------------------- | +| sealed interface | [StringEnum.StringEnum1Boxed](#stringenum1boxed)
sealed interface for validated payloads | +| record | [StringEnum.StringEnum1BoxedVoid](#stringenum1boxedvoid)
boxed class to store validated null payloads | +| record | [StringEnum.StringEnum1BoxedString](#stringenum1boxedstring)
boxed class to store validated String payloads | +| static class | [StringEnum.StringEnum1](#stringenum1)
schema class | +| enum | [StringEnum.StringStringEnumEnums](#stringstringenumenums)
String enum | +| enum | [StringEnum.NullStringEnumEnums](#nullstringenumenums)
null enum | + +## StringEnum1Boxed +public sealed interface StringEnum1Boxed
+permits
+[StringEnum1BoxedVoid](#stringenum1boxedvoid), +[StringEnum1BoxedString](#stringenum1boxedstring) + +sealed interface that stores validated payloads using boxed classes + +## StringEnum1BoxedVoid +public record StringEnum1BoxedVoid
+implements [StringEnum1Boxed](#stringenum1boxed) + +record that stores validated null payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| StringEnum1BoxedVoid(Nothing? data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| Nothing? | data()
validated payload | +| @Nullable Object | getData()
validated payload | + +## StringEnum1BoxedString +public record StringEnum1BoxedString
+implements [StringEnum1Boxed](#stringenum1boxed) + +record that stores validated String payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| StringEnum1BoxedString(String data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| String | data()
validated payload | +| @Nullable Object | getData()
validated payload | + +## StringEnum1 +public static class StringEnum1
+extends JsonSchema + +A schema class that validates payloads + +### Code Sample +``` +import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags; +import org.openapijsonschematools.client.configurations.SchemaConfiguration; +import org.openapijsonschematools.client.exceptions.ValidationException; +import org.openapijsonschematools.client.schemas.validation.MapUtils; +import org.openapijsonschematools.client.schemas.validation.FrozenList; +import org.openapijsonschematools.client.schemas.validation.FrozenMap; +import org.openapijsonschematools.client.components.schemas.StringEnum; + +import java.util.Arrays; +import java.util.List; +import java.util.AbstractMap; + +static final SchemaConfiguration configuration = new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().build()); + +// null validation +Nothing? validatedPayload = StringEnum.StringEnum1.validate( + (Nothing?) null, + configuration +); + +// String validation +String validatedPayload = StringEnum.StringEnum1.validate( + "placed", + configuration +); +``` + +### Field Summary +| Modifier and Type | Field and Description | +| ----------------- | ---------------------- | +| Set> | type = Set.of(
    Nothing?.class,
    String.class
)
| +| Set | enumValues = SetMaker.makeSet(
    "placed",
    "approved",
    "delivered",
    "single quoted",
    "multiple\nlines",
    "double quote \n with newline",
    null
)
| + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| Nothing? | validate(Nothing? arg, SchemaConfiguration configuration) | +| Nothing? | validate([NullStringEnumEnums](#nullstringenumenums) arg, SchemaConfiguration configuration) | +| [StringEnum1BoxedVoid](#stringenum1boxedvoid) | validateAndBox(Nothing? arg, SchemaConfiguration configuration) | +| String | validate(String arg, SchemaConfiguration configuration) | +| String | validate([StringStringEnumEnums](#stringstringenumenums) arg, SchemaConfiguration configuration) | +| [StringEnum1BoxedString](#stringenum1boxedstring) | validateAndBox(String arg, SchemaConfiguration configuration) | +| [StringEnum1Boxed](#stringenum1boxed) | validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) | +| @Nullable Object | validate(@Nullable Object arg, SchemaConfiguration configuration) | + +## StringStringEnumEnums +public enum StringStringEnumEnums
+extends `Enum` + +A class that stores String enum values + +### Enum Constant Summary +| Enum Constant | Description | +| ------------- | ----------- | +| PLACED | value = "placed" | +| APPROVED | value = "approved" | +| DELIVERED | value = "delivered" | +| SINGLE_QUOTED | value = "single quoted" | +| MULTIPLE_LINE_FEED_LF_LINES | value = "multiple\nlines" | +| DOUBLE_QUOTE_LINE_FEED_LF_WITH_NEWLINE | value = "double quote \n with newline" | + +## NullStringEnumEnums +public enum NullStringEnumEnums
+extends `Enum` + +A class that stores null enum values + +### Enum Constant Summary +| Enum Constant | Description | +| ------------- | ----------- | +| NONE | value = null | + +[[Back to top]](#top) [[Back to Component Schemas]](../../../README.md#Component-Schemas) [[Back to README]](../../../README.md) diff --git a/samples/client/petstore/kotlin/docs/components/schemas/StringEnumWithDefaultValue.md b/samples/client/petstore/kotlin/docs/components/schemas/StringEnumWithDefaultValue.md new file mode 100644 index 00000000000..4f00e792efc --- /dev/null +++ b/samples/client/petstore/kotlin/docs/components/schemas/StringEnumWithDefaultValue.md @@ -0,0 +1,101 @@ +# StringEnumWithDefaultValue +org.openapijsonschematools.client.components.schemas.StringEnumWithDefaultValue.java +public class StringEnumWithDefaultValue
+ +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 +- enum classes + +## Nested Class Summary +| Modifier and Type | Class and Description | +| ----------------- | ---------------------- | +| sealed interface | [StringEnumWithDefaultValue.StringEnumWithDefaultValue1Boxed](#stringenumwithdefaultvalue1boxed)
sealed interface for validated payloads | +| record | [StringEnumWithDefaultValue.StringEnumWithDefaultValue1BoxedString](#stringenumwithdefaultvalue1boxedstring)
boxed class to store validated String payloads | +| static class | [StringEnumWithDefaultValue.StringEnumWithDefaultValue1](#stringenumwithdefaultvalue1)
schema class | +| enum | [StringEnumWithDefaultValue.StringStringEnumWithDefaultValueEnums](#stringstringenumwithdefaultvalueenums)
String enum | + +## StringEnumWithDefaultValue1Boxed +public sealed interface StringEnumWithDefaultValue1Boxed
+permits
+[StringEnumWithDefaultValue1BoxedString](#stringenumwithdefaultvalue1boxedstring) + +sealed interface that stores validated payloads using boxed classes + +## StringEnumWithDefaultValue1BoxedString +public record StringEnumWithDefaultValue1BoxedString
+implements [StringEnumWithDefaultValue1Boxed](#stringenumwithdefaultvalue1boxed) + +record that stores validated String payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| StringEnumWithDefaultValue1BoxedString(String data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| String | data()
validated payload | +| @Nullable Object | getData()
validated payload | + +## StringEnumWithDefaultValue1 +public static class StringEnumWithDefaultValue1
+extends JsonSchema + +A schema class that validates payloads + +### Code Sample +``` +import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags; +import org.openapijsonschematools.client.configurations.SchemaConfiguration; +import org.openapijsonschematools.client.exceptions.ValidationException; +import org.openapijsonschematools.client.schemas.validation.MapUtils; +import org.openapijsonschematools.client.schemas.validation.FrozenList; +import org.openapijsonschematools.client.schemas.validation.FrozenMap; +import org.openapijsonschematools.client.components.schemas.StringEnumWithDefaultValue; + +import java.util.Arrays; +import java.util.List; +import java.util.AbstractMap; + +static final SchemaConfiguration configuration = new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().build()); + +// String validation +String validatedPayload = StringEnumWithDefaultValue.StringEnumWithDefaultValue1.validate( + "placed", + configuration +); +``` + +### Field Summary +| Modifier and Type | Field and Description | +| ----------------- | ---------------------- | +| Set> | type = Set.of(
    String.class
)
| +| Set | enumValues = SetMaker.makeSet(
    "placed",
    "approved",
    "delivered"
)
| +| @Nullable Object | defaultValue = "placed" | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| String | validate(String arg, SchemaConfiguration configuration) | +| String | validate([StringStringEnumWithDefaultValueEnums](#stringstringenumwithdefaultvalueenums) arg, SchemaConfiguration configuration) | +| [StringEnumWithDefaultValue1BoxedString](#stringenumwithdefaultvalue1boxedstring) | validateAndBox(String arg, SchemaConfiguration configuration) | +| [StringEnumWithDefaultValue1Boxed](#stringenumwithdefaultvalue1boxed) | validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) | +| @Nullable Object | validate(@Nullable Object arg, SchemaConfiguration configuration) | + +## StringStringEnumWithDefaultValueEnums +public enum StringStringEnumWithDefaultValueEnums
+extends `Enum` + +A class that stores String enum values + +### Enum Constant Summary +| Enum Constant | Description | +| ------------- | ----------- | +| PLACED | value = "placed" | +| APPROVED | value = "approved" | +| DELIVERED | value = "delivered" | + +[[Back to top]](#top) [[Back to Component Schemas]](../../../README.md#Component-Schemas) [[Back to README]](../../../README.md) diff --git a/samples/client/petstore/kotlin/docs/components/schemas/StringSchema.md b/samples/client/petstore/kotlin/docs/components/schemas/StringSchema.md new file mode 100644 index 00000000000..396ff63d7b9 --- /dev/null +++ b/samples/client/petstore/kotlin/docs/components/schemas/StringSchema.md @@ -0,0 +1,52 @@ +# StringSchema +org.openapijsonschematools.client.components.schemas.StringSchema.java +public class StringSchema
+ +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 + +## Nested Class Summary +| Modifier and Type | Class and Description | +| ----------------- | ---------------------- | +| sealed interface | [StringSchema.StringSchema1Boxed](#stringschema1boxed)
sealed interface for validated payloads | +| record | [StringSchema.StringSchema1BoxedString](#stringschema1boxedstring)
boxed class to store validated String payloads | +| static class | [StringSchema.StringSchema1](#stringschema1)
schema class | + +## StringSchema1Boxed +public sealed interface StringSchema1Boxed
+permits
+[StringSchema1BoxedString](#stringschema1boxedstring) + +sealed interface that stores validated payloads using boxed classes + +## StringSchema1BoxedString +public record StringSchema1BoxedString
+implements [StringSchema1Boxed](#stringschema1boxed) + +record that stores validated String payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| StringSchema1BoxedString(String data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| String | data()
validated payload | +| @Nullable Object | getData()
validated payload | + +## StringSchema1 +public static class StringSchema1
+extends StringJsonSchema.StringJsonSchema1 + +A schema class that validates payloads + +| Methods Inherited from class org.openapijsonschematools.client.schemas.StringJsonSchema.StringJsonSchema1 | +| ------------------------------------------------------------------ | +| validate | +| validateAndBox | + +[[Back to top]](#top) [[Back to Component Schemas]](../../../README.md#Component-Schemas) [[Back to README]](../../../README.md) diff --git a/samples/client/petstore/kotlin/docs/components/schemas/StringWithValidation.md b/samples/client/petstore/kotlin/docs/components/schemas/StringWithValidation.md new file mode 100644 index 00000000000..9fc470d2da0 --- /dev/null +++ b/samples/client/petstore/kotlin/docs/components/schemas/StringWithValidation.md @@ -0,0 +1,84 @@ +# StringWithValidation +org.openapijsonschematools.client.components.schemas.StringWithValidation.java +public class StringWithValidation
+ +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 + +## Nested Class Summary +| Modifier and Type | Class and Description | +| ----------------- | ---------------------- | +| sealed interface | [StringWithValidation.StringWithValidation1Boxed](#stringwithvalidation1boxed)
sealed interface for validated payloads | +| record | [StringWithValidation.StringWithValidation1BoxedString](#stringwithvalidation1boxedstring)
boxed class to store validated String payloads | +| static class | [StringWithValidation.StringWithValidation1](#stringwithvalidation1)
schema class | + +## StringWithValidation1Boxed +public sealed interface StringWithValidation1Boxed
+permits
+[StringWithValidation1BoxedString](#stringwithvalidation1boxedstring) + +sealed interface that stores validated payloads using boxed classes + +## StringWithValidation1BoxedString +public record StringWithValidation1BoxedString
+implements [StringWithValidation1Boxed](#stringwithvalidation1boxed) + +record that stores validated String payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| StringWithValidation1BoxedString(String data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| String | data()
validated payload | +| @Nullable Object | getData()
validated payload | + +## StringWithValidation1 +public static class StringWithValidation1
+extends JsonSchema + +A schema class that validates payloads + +### Code Sample +``` +import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags; +import org.openapijsonschematools.client.configurations.SchemaConfiguration; +import org.openapijsonschematools.client.exceptions.ValidationException; +import org.openapijsonschematools.client.schemas.validation.MapUtils; +import org.openapijsonschematools.client.schemas.validation.FrozenList; +import org.openapijsonschematools.client.schemas.validation.FrozenMap; +import org.openapijsonschematools.client.components.schemas.StringWithValidation; + +import java.util.Arrays; +import java.util.List; +import java.util.AbstractMap; + +static final SchemaConfiguration configuration = new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().build()); + +// String validation +String validatedPayload = StringWithValidation.StringWithValidation1.validate( + "a", + configuration +); +``` + +### Field Summary +| Modifier and Type | Field and Description | +| ----------------- | ---------------------- | +| Set> | type = Set.of(
    String.class
)
| +| Integer | minLength = 7 | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| String | validate(String arg, SchemaConfiguration configuration) | +| [StringWithValidation1BoxedString](#stringwithvalidation1boxedstring) | validateAndBox(String arg, SchemaConfiguration configuration) | +| [StringWithValidation1Boxed](#stringwithvalidation1boxed) | validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) | +| @Nullable Object | validate(@Nullable Object arg, SchemaConfiguration configuration) | + +[[Back to top]](#top) [[Back to Component Schemas]](../../../README.md#Component-Schemas) [[Back to README]](../../../README.md) diff --git a/samples/client/petstore/kotlin/docs/components/schemas/Tag.md b/samples/client/petstore/kotlin/docs/components/schemas/Tag.md new file mode 100644 index 00000000000..b03db519f8a --- /dev/null +++ b/samples/client/petstore/kotlin/docs/components/schemas/Tag.md @@ -0,0 +1,214 @@ +# Tag +org.openapijsonschematools.client.components.schemas.Tag.java +public class Tag
+ +A class that contains necessary nested +- schema classes (which validate payloads), extends JsonSchema +- sealed interfaces which store validated payloads, java version of a sum type +- boxed classes which store validated payloads, sealed permits class implementations +- classes to store validated map payloads, extends FrozenMap +- classes to build inputs for map payloads + +## Nested Class Summary +| Modifier and Type | Class and Description | +| ----------------- | ---------------------- | +| sealed interface | [Tag.Tag1Boxed](#tag1boxed)
sealed interface for validated payloads | +| record | [Tag.Tag1BoxedMap](#tag1boxedmap)
boxed class to store validated Map payloads | +| static class | [Tag.Tag1](#tag1)
schema class | +| static class | [Tag.TagMapBuilder](#tagmapbuilder)
builder for Map payloads | +| static class | [Tag.TagMap](#tagmap)
output class for Map payloads | +| sealed interface | [Tag.NameBoxed](#nameboxed)
sealed interface for validated payloads | +| record | [Tag.NameBoxedString](#nameboxedstring)
boxed class to store validated String payloads | +| static class | [Tag.Name](#name)
schema class | +| sealed interface | [Tag.IdBoxed](#idboxed)
sealed interface for validated payloads | +| record | [Tag.IdBoxedNumber](#idboxednumber)
boxed class to store validated Number payloads | +| static class | [Tag.Id](#id)
schema class | + +## Tag1Boxed +public sealed interface Tag1Boxed
+permits
+[Tag1BoxedMap](#tag1boxedmap) + +sealed interface that stores validated payloads using boxed classes + +## Tag1BoxedMap +public record Tag1BoxedMap
+implements [Tag1Boxed](#tag1boxed) + +record that stores validated Map payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| Tag1BoxedMap([TagMap](#tagmap) data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| [TagMap](#tagmap) | data()
validated payload | +| @Nullable Object | getData()
validated payload | + +## Tag1 +public static class Tag1
+extends JsonSchema + +A schema class that validates payloads + +### Code Sample +``` +import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags; +import org.openapijsonschematools.client.configurations.SchemaConfiguration; +import org.openapijsonschematools.client.exceptions.ValidationException; +import org.openapijsonschematools.client.schemas.validation.MapUtils; +import org.openapijsonschematools.client.schemas.validation.FrozenList; +import org.openapijsonschematools.client.schemas.validation.FrozenMap; +import org.openapijsonschematools.client.components.schemas.Tag; + +import java.util.Arrays; +import java.util.List; +import java.util.AbstractMap; + +static final SchemaConfiguration configuration = new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().build()); + +// Map validation +Tag.TagMap validatedPayload = + Tag.Tag1.validate( + new Tag.TagMapBuilder() + .id(1L) + + .name("a") + + .build(), + configuration +); +``` + +### Field Summary +| Modifier and Type | Field and Description | +| ----------------- | ---------------------- | +| Set> | type = Set.of(Map.class) | +| Map> | properties = Map.ofEntries(
    new PropertyEntry("id", [Id.class](#id))),
    new PropertyEntry("name", [Name.class](#name)))
)
| + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| [TagMap](#tagmap) | validate([Map<?, ?>](#tagmapbuilder) arg, SchemaConfiguration configuration) | +| [Tag1BoxedMap](#tag1boxedmap) | validateAndBox([Map<?, ?>](#tagmapbuilder) arg, SchemaConfiguration configuration) | +| [Tag1Boxed](#tag1boxed) | validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) | +| @Nullable Object | validate(@Nullable Object arg, SchemaConfiguration configuration) | + +## TagMapBuilder +public class TagMapBuilder
+builder for `Map` + +A class that builds the Map input type + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| TagMapBuilder()
Creates a builder that contains an empty map | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| Map | build()
Returns map input that should be used with Schema.validate | +| [TagMapBuilder](#tagmapbuilder) | id(int value) | +| [TagMapBuilder](#tagmapbuilder) | id(float value) | +| [TagMapBuilder](#tagmapbuilder) | id(long value) | +| [TagMapBuilder](#tagmapbuilder) | id(double value) | +| [TagMapBuilder](#tagmapbuilder) | name(String value) | +| [TagMapBuilder](#tagmapbuilder) | additionalProperty(String key, Nothing? value) | +| [TagMapBuilder](#tagmapbuilder) | additionalProperty(String key, boolean value) | +| [TagMapBuilder](#tagmapbuilder) | additionalProperty(String key, String value) | +| [TagMapBuilder](#tagmapbuilder) | additionalProperty(String key, int value) | +| [TagMapBuilder](#tagmapbuilder) | additionalProperty(String key, float value) | +| [TagMapBuilder](#tagmapbuilder) | additionalProperty(String key, long value) | +| [TagMapBuilder](#tagmapbuilder) | additionalProperty(String key, double value) | +| [TagMapBuilder](#tagmapbuilder) | additionalProperty(String key, List value) | +| [TagMapBuilder](#tagmapbuilder) | additionalProperty(String key, Map value) | + +## TagMap +public static class TagMap
+extends FrozenMap + +A class to store validated Map payloads + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| static [TagMap](#tagmap) | of([Map](#tagmapbuilder) arg, SchemaConfiguration configuration) | +| Number | id()
[optional] value must be a 64 bit integer | +| String | name()
[optional] | +| @Nullable Object | getAdditionalProperty(String name)
provides type safety for additional properties | + +## NameBoxed +public sealed interface NameBoxed
+permits
+[NameBoxedString](#nameboxedstring) + +sealed interface that stores validated payloads using boxed classes + +## NameBoxedString +public record NameBoxedString
+implements [NameBoxed](#nameboxed) + +record that stores validated String payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| NameBoxedString(String data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| String | data()
validated payload | +| @Nullable Object | getData()
validated payload | + +## Name +public static class Name
+extends StringJsonSchema.StringJsonSchema1 + +A schema class that validates payloads + +| Methods Inherited from class org.openapijsonschematools.client.schemas.StringJsonSchema.StringJsonSchema1 | +| ------------------------------------------------------------------ | +| validate | +| validateAndBox | + +## IdBoxed +public sealed interface IdBoxed
+permits
+[IdBoxedNumber](#idboxednumber) + +sealed interface that stores validated payloads using boxed classes + +## IdBoxedNumber +public record IdBoxedNumber
+implements [IdBoxed](#idboxed) + +record that stores validated Number payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| IdBoxedNumber(Number data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| Number | data()
validated payload | +| @Nullable Object | getData()
validated payload | + +## Id +public static class Id
+extends Int64JsonSchema.Int64JsonSchema1 + +A schema class that validates payloads + +| Methods Inherited from class org.openapijsonschematools.client.schemas.Int64JsonSchema.Int64JsonSchema1 | +| ------------------------------------------------------------------ | +| validate | +| validateAndBox | + +[[Back to top]](#top) [[Back to Component Schemas]](../../../README.md#Component-Schemas) [[Back to README]](../../../README.md) diff --git a/samples/client/petstore/kotlin/docs/components/schemas/Triangle.md b/samples/client/petstore/kotlin/docs/components/schemas/Triangle.md new file mode 100644 index 00000000000..64dff16e233 --- /dev/null +++ b/samples/client/petstore/kotlin/docs/components/schemas/Triangle.md @@ -0,0 +1,169 @@ +# Triangle +org.openapijsonschematools.client.components.schemas.Triangle.java +public class Triangle
+ +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 + +## Nested Class Summary +| Modifier and Type | Class and Description | +| ----------------- | ---------------------- | +| sealed interface | [Triangle.Triangle1Boxed](#triangle1boxed)
sealed interface for validated payloads | +| record | [Triangle.Triangle1BoxedVoid](#triangle1boxedvoid)
boxed class to store validated null payloads | +| record | [Triangle.Triangle1BoxedBoolean](#triangle1boxedboolean)
boxed class to store validated boolean payloads | +| record | [Triangle.Triangle1BoxedNumber](#triangle1boxednumber)
boxed class to store validated Number payloads | +| record | [Triangle.Triangle1BoxedString](#triangle1boxedstring)
boxed class to store validated String payloads | +| record | [Triangle.Triangle1BoxedList](#triangle1boxedlist)
boxed class to store validated List payloads | +| record | [Triangle.Triangle1BoxedMap](#triangle1boxedmap)
boxed class to store validated Map payloads | +| static class | [Triangle.Triangle1](#triangle1)
schema class | + +## Triangle1Boxed +public sealed interface Triangle1Boxed
+permits
+[Triangle1BoxedVoid](#triangle1boxedvoid), +[Triangle1BoxedBoolean](#triangle1boxedboolean), +[Triangle1BoxedNumber](#triangle1boxednumber), +[Triangle1BoxedString](#triangle1boxedstring), +[Triangle1BoxedList](#triangle1boxedlist), +[Triangle1BoxedMap](#triangle1boxedmap) + +sealed interface that stores validated payloads using boxed classes + +## Triangle1BoxedVoid +public record Triangle1BoxedVoid
+implements [Triangle1Boxed](#triangle1boxed) + +record that stores validated null payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| Triangle1BoxedVoid(Nothing? data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| Nothing? | data()
validated payload | +| @Nullable Object | getData()
validated payload | + +## Triangle1BoxedBoolean +public record Triangle1BoxedBoolean
+implements [Triangle1Boxed](#triangle1boxed) + +record that stores validated boolean payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| Triangle1BoxedBoolean(boolean data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| boolean | data()
validated payload | +| @Nullable Object | getData()
validated payload | + +## Triangle1BoxedNumber +public record Triangle1BoxedNumber
+implements [Triangle1Boxed](#triangle1boxed) + +record that stores validated Number payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| Triangle1BoxedNumber(Number data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| Number | data()
validated payload | +| @Nullable Object | getData()
validated payload | + +## Triangle1BoxedString +public record Triangle1BoxedString
+implements [Triangle1Boxed](#triangle1boxed) + +record that stores validated String payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| Triangle1BoxedString(String data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| String | data()
validated payload | +| @Nullable Object | getData()
validated payload | + +## Triangle1BoxedList +public record Triangle1BoxedList
+implements [Triangle1Boxed](#triangle1boxed) + +record that stores validated List payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| Triangle1BoxedList(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 | + +## Triangle1BoxedMap +public record Triangle1BoxedMap
+implements [Triangle1Boxed](#triangle1boxed) + +record that stores validated Map payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| Triangle1BoxedMap(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 | + +## Triangle1 +public static class Triangle1
+extends JsonSchema + +A schema class that validates payloads + +### Field Summary +| Modifier and Type | Field and Description | +| ----------------- | ---------------------- | +| List> | oneOf = List.of(
    [EquilateralTriangle.EquilateralTriangle1.class](../../components/schemas/EquilateralTriangle.md#equilateraltriangle1),
    [IsoscelesTriangle.IsoscelesTriangle1.class](../../components/schemas/IsoscelesTriangle.md#isoscelestriangle1),
    [ScaleneTriangle.ScaleneTriangle1.class](../../components/schemas/ScaleneTriangle.md#scalenetriangle1)
))
| + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| String | validate(String arg, SchemaConfiguration configuration) | +| Nothing? | validate(Nothing? arg, SchemaConfiguration configuration) | +| int | validate(int arg, SchemaConfiguration configuration) | +| long | validate(long arg, SchemaConfiguration configuration) | +| float | validate(float arg, SchemaConfiguration configuration) | +| double | validate(double arg, SchemaConfiguration configuration) | +| Number | validate(Number arg, SchemaConfiguration configuration) | +| boolean | validate(boolean arg, SchemaConfiguration configuration) | +| FrozenMap<@Nullable Object> | validate(Map<?, ?> arg, SchemaConfiguration configuration) | +| FrozenList<@Nullable Object> | validate(List arg, SchemaConfiguration configuration) | +| [Triangle1BoxedString](#triangle1boxedstring) | validateAndBox(String arg, SchemaConfiguration configuration) | +| [Triangle1BoxedVoid](#triangle1boxedvoid) | validateAndBox(Nothing? arg, SchemaConfiguration configuration) | +| [Triangle1BoxedNumber](#triangle1boxednumber) | validateAndBox(Number arg, SchemaConfiguration configuration) | +| [Triangle1BoxedBoolean](#triangle1boxedboolean) | validateAndBox(boolean arg, SchemaConfiguration configuration) | +| [Triangle1BoxedMap](#triangle1boxedmap) | validateAndBox(Map<?, ?> arg, SchemaConfiguration configuration) | +| [Triangle1BoxedList](#triangle1boxedlist) | validateAndBox(List arg, SchemaConfiguration configuration) | +| [Triangle1Boxed](#triangle1boxed) | validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) | +| @Nullable Object | validate(@Nullable Object arg, SchemaConfiguration configuration) | + +[[Back to top]](#top) [[Back to Component Schemas]](../../../README.md#Component-Schemas) [[Back to README]](../../../README.md) diff --git a/samples/client/petstore/kotlin/docs/components/schemas/TriangleInterface.md b/samples/client/petstore/kotlin/docs/components/schemas/TriangleInterface.md new file mode 100644 index 00000000000..021b25dd7b6 --- /dev/null +++ b/samples/client/petstore/kotlin/docs/components/schemas/TriangleInterface.md @@ -0,0 +1,386 @@ +# TriangleInterface +org.openapijsonschematools.client.components.schemas.TriangleInterface.java +public class TriangleInterface
+ +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 | [TriangleInterface.TriangleInterface1Boxed](#triangleinterface1boxed)
sealed interface for validated payloads | +| record | [TriangleInterface.TriangleInterface1BoxedVoid](#triangleinterface1boxedvoid)
boxed class to store validated null payloads | +| record | [TriangleInterface.TriangleInterface1BoxedBoolean](#triangleinterface1boxedboolean)
boxed class to store validated boolean payloads | +| record | [TriangleInterface.TriangleInterface1BoxedNumber](#triangleinterface1boxednumber)
boxed class to store validated Number payloads | +| record | [TriangleInterface.TriangleInterface1BoxedString](#triangleinterface1boxedstring)
boxed class to store validated String payloads | +| record | [TriangleInterface.TriangleInterface1BoxedList](#triangleinterface1boxedlist)
boxed class to store validated List payloads | +| record | [TriangleInterface.TriangleInterface1BoxedMap](#triangleinterface1boxedmap)
boxed class to store validated Map payloads | +| static class | [TriangleInterface.TriangleInterface1](#triangleinterface1)
schema class | +| static class | [TriangleInterface.TriangleInterfaceMapBuilder](#triangleinterfacemapbuilder)
builder for Map payloads | +| static class | [TriangleInterface.TriangleInterfaceMap](#triangleinterfacemap)
output class for Map payloads | +| sealed interface | [TriangleInterface.TriangleTypeBoxed](#triangletypeboxed)
sealed interface for validated payloads | +| record | [TriangleInterface.TriangleTypeBoxedString](#triangletypeboxedstring)
boxed class to store validated String payloads | +| static class | [TriangleInterface.TriangleType](#triangletype)
schema class | +| sealed interface | [TriangleInterface.ShapeTypeBoxed](#shapetypeboxed)
sealed interface for validated payloads | +| record | [TriangleInterface.ShapeTypeBoxedString](#shapetypeboxedstring)
boxed class to store validated String payloads | +| static class | [TriangleInterface.ShapeType](#shapetype)
schema class | +| enum | [TriangleInterface.StringShapeTypeEnums](#stringshapetypeenums)
String enum | + +## TriangleInterface1Boxed +public sealed interface TriangleInterface1Boxed
+permits
+[TriangleInterface1BoxedVoid](#triangleinterface1boxedvoid), +[TriangleInterface1BoxedBoolean](#triangleinterface1boxedboolean), +[TriangleInterface1BoxedNumber](#triangleinterface1boxednumber), +[TriangleInterface1BoxedString](#triangleinterface1boxedstring), +[TriangleInterface1BoxedList](#triangleinterface1boxedlist), +[TriangleInterface1BoxedMap](#triangleinterface1boxedmap) + +sealed interface that stores validated payloads using boxed classes + +## TriangleInterface1BoxedVoid +public record TriangleInterface1BoxedVoid
+implements [TriangleInterface1Boxed](#triangleinterface1boxed) + +record that stores validated null payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| TriangleInterface1BoxedVoid(Nothing? data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| Nothing? | data()
validated payload | +| @Nullable Object | getData()
validated payload | + +## TriangleInterface1BoxedBoolean +public record TriangleInterface1BoxedBoolean
+implements [TriangleInterface1Boxed](#triangleinterface1boxed) + +record that stores validated boolean payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| TriangleInterface1BoxedBoolean(boolean data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| boolean | data()
validated payload | +| @Nullable Object | getData()
validated payload | + +## TriangleInterface1BoxedNumber +public record TriangleInterface1BoxedNumber
+implements [TriangleInterface1Boxed](#triangleinterface1boxed) + +record that stores validated Number payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| TriangleInterface1BoxedNumber(Number data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| Number | data()
validated payload | +| @Nullable Object | getData()
validated payload | + +## TriangleInterface1BoxedString +public record TriangleInterface1BoxedString
+implements [TriangleInterface1Boxed](#triangleinterface1boxed) + +record that stores validated String payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| TriangleInterface1BoxedString(String data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| String | data()
validated payload | +| @Nullable Object | getData()
validated payload | + +## TriangleInterface1BoxedList +public record TriangleInterface1BoxedList
+implements [TriangleInterface1Boxed](#triangleinterface1boxed) + +record that stores validated List payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| TriangleInterface1BoxedList(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 | + +## TriangleInterface1BoxedMap +public record TriangleInterface1BoxedMap
+implements [TriangleInterface1Boxed](#triangleinterface1boxed) + +record that stores validated Map payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| TriangleInterface1BoxedMap([TriangleInterfaceMap](#triangleinterfacemap) data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| [TriangleInterfaceMap](#triangleinterfacemap) | data()
validated payload | +| @Nullable Object | getData()
validated payload | + +## TriangleInterface1 +public static class TriangleInterface1
+extends JsonSchema + +A schema class that validates payloads + +### Field Summary +| Modifier and Type | Field and Description | +| ----------------- | ---------------------- | +| Map> | properties = Map.ofEntries(
    new PropertyEntry("shapeType", [ShapeType.class](#shapetype))),
    new PropertyEntry("triangleType", [TriangleType.class](#triangletype)))
)
| +| Set | required = Set.of(
    "shapeType",
    "triangleType"
)
| + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| String | validate(String arg, SchemaConfiguration configuration) | +| Nothing? | validate(Nothing? arg, SchemaConfiguration configuration) | +| int | validate(int arg, SchemaConfiguration configuration) | +| long | validate(long arg, SchemaConfiguration configuration) | +| float | validate(float arg, SchemaConfiguration configuration) | +| double | validate(double arg, SchemaConfiguration configuration) | +| Number | validate(Number arg, SchemaConfiguration configuration) | +| boolean | validate(boolean arg, SchemaConfiguration configuration) | +| [TriangleInterfaceMap](#triangleinterfacemap) | validate([Map<?, ?>](#triangleinterfacemapbuilder) arg, SchemaConfiguration configuration) | +| FrozenList<@Nullable Object> | validate(List arg, SchemaConfiguration configuration) | +| [TriangleInterface1BoxedString](#triangleinterface1boxedstring) | validateAndBox(String arg, SchemaConfiguration configuration) | +| [TriangleInterface1BoxedVoid](#triangleinterface1boxedvoid) | validateAndBox(Nothing? arg, SchemaConfiguration configuration) | +| [TriangleInterface1BoxedNumber](#triangleinterface1boxednumber) | validateAndBox(Number arg, SchemaConfiguration configuration) | +| [TriangleInterface1BoxedBoolean](#triangleinterface1boxedboolean) | validateAndBox(boolean arg, SchemaConfiguration configuration) | +| [TriangleInterface1BoxedMap](#triangleinterface1boxedmap) | validateAndBox([Map<?, ?>](#triangleinterfacemapbuilder) arg, SchemaConfiguration configuration) | +| [TriangleInterface1BoxedList](#triangleinterface1boxedlist) | validateAndBox(List arg, SchemaConfiguration configuration) | +| [TriangleInterface1Boxed](#triangleinterface1boxed) | validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) | +| @Nullable Object | validate(@Nullable Object arg, SchemaConfiguration configuration) | + +## TriangleInterfaceMap00Builder +public class TriangleInterfaceMap00Builder
+builder for `Map` + +A class that builds the Map input type + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| TriangleInterfaceMap00Builder(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 | +| [TriangleInterfaceMap00Builder](#triangleinterfacemap00builder) | additionalProperty(String key, Nothing? value) | +| [TriangleInterfaceMap00Builder](#triangleinterfacemap00builder) | additionalProperty(String key, boolean value) | +| [TriangleInterfaceMap00Builder](#triangleinterfacemap00builder) | additionalProperty(String key, String value) | +| [TriangleInterfaceMap00Builder](#triangleinterfacemap00builder) | additionalProperty(String key, int value) | +| [TriangleInterfaceMap00Builder](#triangleinterfacemap00builder) | additionalProperty(String key, float value) | +| [TriangleInterfaceMap00Builder](#triangleinterfacemap00builder) | additionalProperty(String key, long value) | +| [TriangleInterfaceMap00Builder](#triangleinterfacemap00builder) | additionalProperty(String key, double value) | +| [TriangleInterfaceMap00Builder](#triangleinterfacemap00builder) | additionalProperty(String key, List value) | +| [TriangleInterfaceMap00Builder](#triangleinterfacemap00builder) | additionalProperty(String key, Map value) | + +## TriangleInterfaceMap01Builder +public class TriangleInterfaceMap01Builder
+builder for `Map` + +A class that builds the Map input type + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| TriangleInterfaceMap01Builder(Map instance)
Creates a builder that contains the passed instance | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| [TriangleInterfaceMap00Builder](#triangleinterfacemap00builder) | triangleType(String value) | + +## TriangleInterfaceMap10Builder +public class TriangleInterfaceMap10Builder
+builder for `Map` + +A class that builds the Map input type + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| TriangleInterfaceMap10Builder(Map instance)
Creates a builder that contains the passed instance | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| [TriangleInterfaceMap00Builder](#triangleinterfacemap00builder) | shapeType(String value) | +| [TriangleInterfaceMap00Builder](#triangleinterfacemap00builder) | shapeType([StringShapeTypeEnums](#stringshapetypeenums) value) | + +## TriangleInterfaceMapBuilder +public class TriangleInterfaceMapBuilder
+builder for `Map` + +A class that builds the Map input type + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| TriangleInterfaceMapBuilder()
Creates a builder that contains an empty map | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| [TriangleInterfaceMap01Builder](#triangleinterfacemap01builder) | shapeType(String value) | +| [TriangleInterfaceMap01Builder](#triangleinterfacemap01builder) | shapeType([StringShapeTypeEnums](#stringshapetypeenums) value) | +| [TriangleInterfaceMap10Builder](#triangleinterfacemap10builder) | triangleType(String value) | + +## TriangleInterfaceMap +public static class TriangleInterfaceMap
+extends FrozenMap + +A class to store validated Map payloads + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| static [TriangleInterfaceMap](#triangleinterfacemap) | of([Map](#triangleinterfacemapbuilder) arg, SchemaConfiguration configuration) | +| String | shapeType()
must be one of ["Triangle"] | +| String | triangleType()
| +| @Nullable Object | getAdditionalProperty(String name)
provides type safety for additional properties | + +## TriangleTypeBoxed +public sealed interface TriangleTypeBoxed
+permits
+[TriangleTypeBoxedString](#triangletypeboxedstring) + +sealed interface that stores validated payloads using boxed classes + +## TriangleTypeBoxedString +public record TriangleTypeBoxedString
+implements [TriangleTypeBoxed](#triangletypeboxed) + +record that stores validated String payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| TriangleTypeBoxedString(String data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| String | data()
validated payload | +| @Nullable Object | getData()
validated payload | + +## TriangleType +public static class TriangleType
+extends StringJsonSchema.StringJsonSchema1 + +A schema class that validates payloads + +| Methods Inherited from class org.openapijsonschematools.client.schemas.StringJsonSchema.StringJsonSchema1 | +| ------------------------------------------------------------------ | +| validate | +| validateAndBox | + +## ShapeTypeBoxed +public sealed interface ShapeTypeBoxed
+permits
+[ShapeTypeBoxedString](#shapetypeboxedstring) + +sealed interface that stores validated payloads using boxed classes + +## ShapeTypeBoxedString +public record ShapeTypeBoxedString
+implements [ShapeTypeBoxed](#shapetypeboxed) + +record that stores validated String payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| ShapeTypeBoxedString(String data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| String | data()
validated payload | +| @Nullable Object | getData()
validated payload | + +## ShapeType +public static class ShapeType
+extends JsonSchema + +A schema class that validates payloads + +### Code Sample +``` +import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags; +import org.openapijsonschematools.client.configurations.SchemaConfiguration; +import org.openapijsonschematools.client.exceptions.ValidationException; +import org.openapijsonschematools.client.schemas.validation.MapUtils; +import org.openapijsonschematools.client.schemas.validation.FrozenList; +import org.openapijsonschematools.client.schemas.validation.FrozenMap; +import org.openapijsonschematools.client.components.schemas.TriangleInterface; + +import java.util.Arrays; +import java.util.List; +import java.util.AbstractMap; + +static final SchemaConfiguration configuration = new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().build()); + +// String validation +String validatedPayload = TriangleInterface.ShapeType.validate( + "Triangle", + configuration +); +``` + +### Field Summary +| Modifier and Type | Field and Description | +| ----------------- | ---------------------- | +| Set> | type = Set.of(
    String.class
)
| +| Set | enumValues = SetMaker.makeSet(
    "Triangle"
)
| + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| String | validate(String arg, SchemaConfiguration configuration) | +| String | validate([StringShapeTypeEnums](#stringshapetypeenums) arg, SchemaConfiguration configuration) | +| [ShapeTypeBoxedString](#shapetypeboxedstring) | validateAndBox(String arg, SchemaConfiguration configuration) | +| [ShapeTypeBoxed](#shapetypeboxed) | validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) | +| @Nullable Object | validate(@Nullable Object arg, SchemaConfiguration configuration) | + +## StringShapeTypeEnums +public enum StringShapeTypeEnums
+extends `Enum` + +A class that stores String enum values + +### Enum Constant Summary +| Enum Constant | Description | +| ------------- | ----------- | +| TRIANGLE | value = "Triangle" | + +[[Back to top]](#top) [[Back to Component Schemas]](../../../README.md#Component-Schemas) [[Back to README]](../../../README.md) diff --git a/samples/client/petstore/kotlin/docs/components/schemas/UUIDString.md b/samples/client/petstore/kotlin/docs/components/schemas/UUIDString.md new file mode 100644 index 00000000000..f6c62c7002f --- /dev/null +++ b/samples/client/petstore/kotlin/docs/components/schemas/UUIDString.md @@ -0,0 +1,85 @@ +# UUIDString +org.openapijsonschematools.client.components.schemas.UUIDString.java +public class UUIDString
+ +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 + +## Nested Class Summary +| Modifier and Type | Class and Description | +| ----------------- | ---------------------- | +| sealed interface | [UUIDString.UUIDString1Boxed](#uuidstring1boxed)
sealed interface for validated payloads | +| record | [UUIDString.UUIDString1BoxedString](#uuidstring1boxedstring)
boxed class to store validated String payloads | +| static class | [UUIDString.UUIDString1](#uuidstring1)
schema class | + +## UUIDString1Boxed +public sealed interface UUIDString1Boxed
+permits
+[UUIDString1BoxedString](#uuidstring1boxedstring) + +sealed interface that stores validated payloads using boxed classes + +## UUIDString1BoxedString +public record UUIDString1BoxedString
+implements [UUIDString1Boxed](#uuidstring1boxed) + +record that stores validated String payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| UUIDString1BoxedString(String data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| String | data()
validated payload | +| @Nullable Object | getData()
validated payload | + +## UUIDString1 +public static class UUIDString1
+extends JsonSchema + +A schema class that validates payloads + +### Code Sample +``` +import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags; +import org.openapijsonschematools.client.configurations.SchemaConfiguration; +import org.openapijsonschematools.client.exceptions.ValidationException; +import org.openapijsonschematools.client.schemas.validation.MapUtils; +import org.openapijsonschematools.client.schemas.validation.FrozenList; +import org.openapijsonschematools.client.schemas.validation.FrozenMap; +import org.openapijsonschematools.client.components.schemas.UUIDString; + +import java.util.Arrays; +import java.util.List; +import java.util.AbstractMap; + +static final SchemaConfiguration configuration = new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().build()); + +// String validation +String validatedPayload = UUIDString.UUIDString1.validate( + "046b6c7f-0b8a-43b9-b35d-6489e6daee91", + configuration +); +``` + +### Field Summary +| Modifier and Type | Field and Description | +| ----------------- | ---------------------- | +| Set> | type = Set.of(
    String.class
)
| +| String | type = "uuid"; | +| Integer | minLength = 1 | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| String | validate(String arg, SchemaConfiguration configuration) | +| [UUIDString1BoxedString](#uuidstring1boxedstring) | validateAndBox(String arg, SchemaConfiguration configuration) | +| [UUIDString1Boxed](#uuidstring1boxed) | validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) | +| @Nullable Object | validate(@Nullable Object arg, SchemaConfiguration configuration) | + +[[Back to top]](#top) [[Back to Component Schemas]](../../../README.md#Component-Schemas) [[Back to README]](../../../README.md) diff --git a/samples/client/petstore/kotlin/docs/components/schemas/User.md b/samples/client/petstore/kotlin/docs/components/schemas/User.md new file mode 100644 index 00000000000..190cec7cbc9 --- /dev/null +++ b/samples/client/petstore/kotlin/docs/components/schemas/User.md @@ -0,0 +1,1109 @@ +# User +org.openapijsonschematools.client.components.schemas.User.java +public class User
+ +A class that contains necessary nested +- schema classes (which validate payloads), extends JsonSchema +- sealed interfaces which store validated payloads, java version of a sum type +- boxed classes which store validated payloads, sealed permits class implementations +- classes to store validated map payloads, extends FrozenMap +- classes to build inputs for map payloads + +## Nested Class Summary +| Modifier and Type | Class and Description | +| ----------------- | ---------------------- | +| sealed interface | [User.User1Boxed](#user1boxed)
sealed interface for validated payloads | +| record | [User.User1BoxedMap](#user1boxedmap)
boxed class to store validated Map payloads | +| static class | [User.User1](#user1)
schema class | +| static class | [User.UserMapBuilder](#usermapbuilder)
builder for Map payloads | +| static class | [User.UserMap](#usermap)
output class for Map payloads | +| sealed interface | [User.AnyTypePropNullableBoxed](#anytypepropnullableboxed)
sealed interface for validated payloads | +| record | [User.AnyTypePropNullableBoxedVoid](#anytypepropnullableboxedvoid)
boxed class to store validated null payloads | +| record | [User.AnyTypePropNullableBoxedBoolean](#anytypepropnullableboxedboolean)
boxed class to store validated boolean payloads | +| record | [User.AnyTypePropNullableBoxedNumber](#anytypepropnullableboxednumber)
boxed class to store validated Number payloads | +| record | [User.AnyTypePropNullableBoxedString](#anytypepropnullableboxedstring)
boxed class to store validated String payloads | +| record | [User.AnyTypePropNullableBoxedList](#anytypepropnullableboxedlist)
boxed class to store validated List payloads | +| record | [User.AnyTypePropNullableBoxedMap](#anytypepropnullableboxedmap)
boxed class to store validated Map payloads | +| static class | [User.AnyTypePropNullable](#anytypepropnullable)
schema class | +| sealed interface | [User.AnyTypeExceptNullPropBoxed](#anytypeexceptnullpropboxed)
sealed interface for validated payloads | +| record | [User.AnyTypeExceptNullPropBoxedVoid](#anytypeexceptnullpropboxedvoid)
boxed class to store validated null payloads | +| record | [User.AnyTypeExceptNullPropBoxedBoolean](#anytypeexceptnullpropboxedboolean)
boxed class to store validated boolean payloads | +| record | [User.AnyTypeExceptNullPropBoxedNumber](#anytypeexceptnullpropboxednumber)
boxed class to store validated Number payloads | +| record | [User.AnyTypeExceptNullPropBoxedString](#anytypeexceptnullpropboxedstring)
boxed class to store validated String payloads | +| record | [User.AnyTypeExceptNullPropBoxedList](#anytypeexceptnullpropboxedlist)
boxed class to store validated List payloads | +| record | [User.AnyTypeExceptNullPropBoxedMap](#anytypeexceptnullpropboxedmap)
boxed class to store validated Map payloads | +| static class | [User.AnyTypeExceptNullProp](#anytypeexceptnullprop)
schema class | +| sealed interface | [User.NotBoxed](#notboxed)
sealed interface for validated payloads | +| record | [User.NotBoxedVoid](#notboxedvoid)
boxed class to store validated null payloads | +| static class | [User.Not](#not)
schema class | +| sealed interface | [User.AnyTypePropBoxed](#anytypepropboxed)
sealed interface for validated payloads | +| record | [User.AnyTypePropBoxedVoid](#anytypepropboxedvoid)
boxed class to store validated null payloads | +| record | [User.AnyTypePropBoxedBoolean](#anytypepropboxedboolean)
boxed class to store validated boolean payloads | +| record | [User.AnyTypePropBoxedNumber](#anytypepropboxednumber)
boxed class to store validated Number payloads | +| record | [User.AnyTypePropBoxedString](#anytypepropboxedstring)
boxed class to store validated String payloads | +| record | [User.AnyTypePropBoxedList](#anytypepropboxedlist)
boxed class to store validated List payloads | +| record | [User.AnyTypePropBoxedMap](#anytypepropboxedmap)
boxed class to store validated Map payloads | +| static class | [User.AnyTypeProp](#anytypeprop)
schema class | +| sealed interface | [User.ObjectWithNoDeclaredPropsNullableBoxed](#objectwithnodeclaredpropsnullableboxed)
sealed interface for validated payloads | +| record | [User.ObjectWithNoDeclaredPropsNullableBoxedVoid](#objectwithnodeclaredpropsnullableboxedvoid)
boxed class to store validated null payloads | +| record | [User.ObjectWithNoDeclaredPropsNullableBoxedMap](#objectwithnodeclaredpropsnullableboxedmap)
boxed class to store validated Map payloads | +| static class | [User.ObjectWithNoDeclaredPropsNullable](#objectwithnodeclaredpropsnullable)
schema class | +| sealed interface | [User.ObjectWithNoDeclaredPropsBoxed](#objectwithnodeclaredpropsboxed)
sealed interface for validated payloads | +| record | [User.ObjectWithNoDeclaredPropsBoxedMap](#objectwithnodeclaredpropsboxedmap)
boxed class to store validated Map payloads | +| static class | [User.ObjectWithNoDeclaredProps](#objectwithnodeclaredprops)
schema class | +| sealed interface | [User.UserStatusBoxed](#userstatusboxed)
sealed interface for validated payloads | +| record | [User.UserStatusBoxedNumber](#userstatusboxednumber)
boxed class to store validated Number payloads | +| static class | [User.UserStatus](#userstatus)
schema class | +| sealed interface | [User.PhoneBoxed](#phoneboxed)
sealed interface for validated payloads | +| record | [User.PhoneBoxedString](#phoneboxedstring)
boxed class to store validated String payloads | +| static class | [User.Phone](#phone)
schema class | +| sealed interface | [User.PasswordBoxed](#passwordboxed)
sealed interface for validated payloads | +| record | [User.PasswordBoxedString](#passwordboxedstring)
boxed class to store validated String payloads | +| static class | [User.Password](#password)
schema class | +| sealed interface | [User.EmailBoxed](#emailboxed)
sealed interface for validated payloads | +| record | [User.EmailBoxedString](#emailboxedstring)
boxed class to store validated String payloads | +| static class | [User.Email](#email)
schema class | +| sealed interface | [User.LastNameBoxed](#lastnameboxed)
sealed interface for validated payloads | +| record | [User.LastNameBoxedString](#lastnameboxedstring)
boxed class to store validated String payloads | +| static class | [User.LastName](#lastname)
schema class | +| sealed interface | [User.FirstNameBoxed](#firstnameboxed)
sealed interface for validated payloads | +| record | [User.FirstNameBoxedString](#firstnameboxedstring)
boxed class to store validated String payloads | +| static class | [User.FirstName](#firstname)
schema class | +| sealed interface | [User.UsernameBoxed](#usernameboxed)
sealed interface for validated payloads | +| record | [User.UsernameBoxedString](#usernameboxedstring)
boxed class to store validated String payloads | +| static class | [User.Username](#username)
schema class | +| sealed interface | [User.IdBoxed](#idboxed)
sealed interface for validated payloads | +| record | [User.IdBoxedNumber](#idboxednumber)
boxed class to store validated Number payloads | +| static class | [User.Id](#id)
schema class | + +## User1Boxed +public sealed interface User1Boxed
+permits
+[User1BoxedMap](#user1boxedmap) + +sealed interface that stores validated payloads using boxed classes + +## User1BoxedMap +public record User1BoxedMap
+implements [User1Boxed](#user1boxed) + +record that stores validated Map payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| User1BoxedMap([UserMap](#usermap) data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| [UserMap](#usermap) | data()
validated payload | +| @Nullable Object | getData()
validated payload | + +## User1 +public static class User1
+extends JsonSchema + +A schema class that validates payloads + +### Code Sample +``` +import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags; +import org.openapijsonschematools.client.configurations.SchemaConfiguration; +import org.openapijsonschematools.client.exceptions.ValidationException; +import org.openapijsonschematools.client.schemas.validation.MapUtils; +import org.openapijsonschematools.client.schemas.validation.FrozenList; +import org.openapijsonschematools.client.schemas.validation.FrozenMap; +import org.openapijsonschematools.client.components.schemas.User; + +import java.util.Arrays; +import java.util.List; +import java.util.AbstractMap; + +static final SchemaConfiguration configuration = new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().build()); + +// Map validation +User.UserMap validatedPayload = + User.User1.validate( + new User.UserMapBuilder() + .id(1L) + + .username("a") + + .firstName("a") + + .lastName("a") + + .email("a") + + .password("a") + + .phone("a") + + .userStatus(1) + + .objectWithNoDeclaredPropsNullable(null) + + .build(), + configuration +); +``` + +### Field Summary +| Modifier and Type | Field and Description | +| ----------------- | ---------------------- | +| Set> | type = Set.of(Map.class) | +| Map> | properties = Map.ofEntries(
    new PropertyEntry("id", [Id.class](#id))),
    new PropertyEntry("username", [Username.class](#username))),
    new PropertyEntry("firstName", [FirstName.class](#firstname))),
    new PropertyEntry("lastName", [LastName.class](#lastname))),
    new PropertyEntry("email", [Email.class](#email))),
    new PropertyEntry("password", [Password.class](#password))),
    new PropertyEntry("phone", [Phone.class](#phone))),
    new PropertyEntry("userStatus", [UserStatus.class](#userstatus))),
    new PropertyEntry("objectWithNoDeclaredProps", [ObjectWithNoDeclaredProps.class](#objectwithnodeclaredprops))),
    new PropertyEntry("objectWithNoDeclaredPropsNullable", [ObjectWithNoDeclaredPropsNullable.class](#objectwithnodeclaredpropsnullable))),
    new PropertyEntry("anyTypeProp", [AnyTypeProp.class](#anytypeprop))),
    new PropertyEntry("anyTypeExceptNullProp", [AnyTypeExceptNullProp.class](#anytypeexceptnullprop))),
    new PropertyEntry("anyTypePropNullable", [AnyTypePropNullable.class](#anytypepropnullable)))
)
| + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| [UserMap](#usermap) | validate([Map<?, ?>](#usermapbuilder) arg, SchemaConfiguration configuration) | +| [User1BoxedMap](#user1boxedmap) | validateAndBox([Map<?, ?>](#usermapbuilder) arg, SchemaConfiguration configuration) | +| [User1Boxed](#user1boxed) | validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) | +| @Nullable Object | validate(@Nullable Object arg, SchemaConfiguration configuration) | + +## UserMapBuilder +public class UserMapBuilder
+builder for `Map` + +A class that builds the Map input type + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| UserMapBuilder()
Creates a builder that contains an empty map | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| Map | build()
Returns map input that should be used with Schema.validate | +| [UserMapBuilder](#usermapbuilder) | id(int value) | +| [UserMapBuilder](#usermapbuilder) | id(float value) | +| [UserMapBuilder](#usermapbuilder) | id(long value) | +| [UserMapBuilder](#usermapbuilder) | id(double value) | +| [UserMapBuilder](#usermapbuilder) | username(String value) | +| [UserMapBuilder](#usermapbuilder) | firstName(String value) | +| [UserMapBuilder](#usermapbuilder) | lastName(String value) | +| [UserMapBuilder](#usermapbuilder) | email(String value) | +| [UserMapBuilder](#usermapbuilder) | password(String value) | +| [UserMapBuilder](#usermapbuilder) | phone(String value) | +| [UserMapBuilder](#usermapbuilder) | userStatus(int value) | +| [UserMapBuilder](#usermapbuilder) | userStatus(float value) | +| [UserMapBuilder](#usermapbuilder) | objectWithNoDeclaredProps(Map value) | +| [UserMapBuilder](#usermapbuilder) | objectWithNoDeclaredPropsNullable(Nothing? value) | +| [UserMapBuilder](#usermapbuilder) | objectWithNoDeclaredPropsNullable(Map value) | +| [UserMapBuilder](#usermapbuilder) | anyTypeProp(Nothing? value) | +| [UserMapBuilder](#usermapbuilder) | anyTypeProp(boolean value) | +| [UserMapBuilder](#usermapbuilder) | anyTypeProp(String value) | +| [UserMapBuilder](#usermapbuilder) | anyTypeProp(int value) | +| [UserMapBuilder](#usermapbuilder) | anyTypeProp(float value) | +| [UserMapBuilder](#usermapbuilder) | anyTypeProp(long value) | +| [UserMapBuilder](#usermapbuilder) | anyTypeProp(double value) | +| [UserMapBuilder](#usermapbuilder) | anyTypeProp(List value) | +| [UserMapBuilder](#usermapbuilder) | anyTypeProp(Map value) | +| [UserMapBuilder](#usermapbuilder) | anyTypeExceptNullProp(Nothing? value) | +| [UserMapBuilder](#usermapbuilder) | anyTypeExceptNullProp(boolean value) | +| [UserMapBuilder](#usermapbuilder) | anyTypeExceptNullProp(String value) | +| [UserMapBuilder](#usermapbuilder) | anyTypeExceptNullProp(int value) | +| [UserMapBuilder](#usermapbuilder) | anyTypeExceptNullProp(float value) | +| [UserMapBuilder](#usermapbuilder) | anyTypeExceptNullProp(long value) | +| [UserMapBuilder](#usermapbuilder) | anyTypeExceptNullProp(double value) | +| [UserMapBuilder](#usermapbuilder) | anyTypeExceptNullProp(List value) | +| [UserMapBuilder](#usermapbuilder) | anyTypeExceptNullProp(Map value) | +| [UserMapBuilder](#usermapbuilder) | anyTypePropNullable(Nothing? value) | +| [UserMapBuilder](#usermapbuilder) | anyTypePropNullable(boolean value) | +| [UserMapBuilder](#usermapbuilder) | anyTypePropNullable(String value) | +| [UserMapBuilder](#usermapbuilder) | anyTypePropNullable(int value) | +| [UserMapBuilder](#usermapbuilder) | anyTypePropNullable(float value) | +| [UserMapBuilder](#usermapbuilder) | anyTypePropNullable(long value) | +| [UserMapBuilder](#usermapbuilder) | anyTypePropNullable(double value) | +| [UserMapBuilder](#usermapbuilder) | anyTypePropNullable(List value) | +| [UserMapBuilder](#usermapbuilder) | anyTypePropNullable(Map value) | +| [UserMapBuilder](#usermapbuilder) | additionalProperty(String key, Nothing? value) | +| [UserMapBuilder](#usermapbuilder) | additionalProperty(String key, boolean value) | +| [UserMapBuilder](#usermapbuilder) | additionalProperty(String key, String value) | +| [UserMapBuilder](#usermapbuilder) | additionalProperty(String key, int value) | +| [UserMapBuilder](#usermapbuilder) | additionalProperty(String key, float value) | +| [UserMapBuilder](#usermapbuilder) | additionalProperty(String key, long value) | +| [UserMapBuilder](#usermapbuilder) | additionalProperty(String key, double value) | +| [UserMapBuilder](#usermapbuilder) | additionalProperty(String key, List value) | +| [UserMapBuilder](#usermapbuilder) | additionalProperty(String key, Map value) | + +## UserMap +public static class UserMap
+extends FrozenMap + +A class to store validated Map payloads + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| static [UserMap](#usermap) | of([Map](#usermapbuilder) arg, SchemaConfiguration configuration) | +| Number | id()
[optional] value must be a 64 bit integer | +| String | username()
[optional] | +| String | firstName()
[optional] | +| String | lastName()
[optional] | +| String | email()
[optional] | +| String | password()
[optional] | +| String | phone()
[optional] | +| Number | userStatus()
[optional] value must be a 32 bit integer | +| FrozenMap | objectWithNoDeclaredProps()
[optional] | +| @Nullable FrozenMap | objectWithNoDeclaredPropsNullable()
[optional] | +| @Nullable Object | anyTypeProp()
[optional] | +| @Nullable Object | anyTypeExceptNullProp()
[optional] | +| @Nullable Object | anyTypePropNullable()
[optional] | +| @Nullable Object | getAdditionalProperty(String name)
provides type safety for additional properties | + +## AnyTypePropNullableBoxed +public sealed interface AnyTypePropNullableBoxed
+permits
+[AnyTypePropNullableBoxedVoid](#anytypepropnullableboxedvoid), +[AnyTypePropNullableBoxedBoolean](#anytypepropnullableboxedboolean), +[AnyTypePropNullableBoxedNumber](#anytypepropnullableboxednumber), +[AnyTypePropNullableBoxedString](#anytypepropnullableboxedstring), +[AnyTypePropNullableBoxedList](#anytypepropnullableboxedlist), +[AnyTypePropNullableBoxedMap](#anytypepropnullableboxedmap) + +sealed interface that stores validated payloads using boxed classes + +## AnyTypePropNullableBoxedVoid +public record AnyTypePropNullableBoxedVoid
+implements [AnyTypePropNullableBoxed](#anytypepropnullableboxed) + +record that stores validated null payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| AnyTypePropNullableBoxedVoid(Nothing? data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| Nothing? | data()
validated payload | +| @Nullable Object | getData()
validated payload | + +## AnyTypePropNullableBoxedBoolean +public record AnyTypePropNullableBoxedBoolean
+implements [AnyTypePropNullableBoxed](#anytypepropnullableboxed) + +record that stores validated boolean payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| AnyTypePropNullableBoxedBoolean(boolean data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| boolean | data()
validated payload | +| @Nullable Object | getData()
validated payload | + +## AnyTypePropNullableBoxedNumber +public record AnyTypePropNullableBoxedNumber
+implements [AnyTypePropNullableBoxed](#anytypepropnullableboxed) + +record that stores validated Number payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| AnyTypePropNullableBoxedNumber(Number data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| Number | data()
validated payload | +| @Nullable Object | getData()
validated payload | + +## AnyTypePropNullableBoxedString +public record AnyTypePropNullableBoxedString
+implements [AnyTypePropNullableBoxed](#anytypepropnullableboxed) + +record that stores validated String payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| AnyTypePropNullableBoxedString(String data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| String | data()
validated payload | +| @Nullable Object | getData()
validated payload | + +## AnyTypePropNullableBoxedList +public record AnyTypePropNullableBoxedList
+implements [AnyTypePropNullableBoxed](#anytypepropnullableboxed) + +record that stores validated List payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| AnyTypePropNullableBoxedList(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 | + +## AnyTypePropNullableBoxedMap +public record AnyTypePropNullableBoxedMap
+implements [AnyTypePropNullableBoxed](#anytypepropnullableboxed) + +record that stores validated Map payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| AnyTypePropNullableBoxedMap(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 | + +## AnyTypePropNullable +public static class AnyTypePropNullable
+extends AnyTypeJsonSchema.AnyTypeJsonSchema1 + +A schema class that validates payloads + +## Description +test code generation for any type Here the 'type' attribute is not specified, which means the value can be anything, including the null value, string, number, boolean, array or object. The 'nullable' attribute does not change the allowed values. + +| Methods Inherited from class org.openapijsonschematools.client.schemas.AnyTypeJsonSchema.AnyTypeJsonSchema1 | +| ------------------------------------------------------------------ | +| validate | +| validateAndBox | + +## AnyTypeExceptNullPropBoxed +public sealed interface AnyTypeExceptNullPropBoxed
+permits
+[AnyTypeExceptNullPropBoxedVoid](#anytypeexceptnullpropboxedvoid), +[AnyTypeExceptNullPropBoxedBoolean](#anytypeexceptnullpropboxedboolean), +[AnyTypeExceptNullPropBoxedNumber](#anytypeexceptnullpropboxednumber), +[AnyTypeExceptNullPropBoxedString](#anytypeexceptnullpropboxedstring), +[AnyTypeExceptNullPropBoxedList](#anytypeexceptnullpropboxedlist), +[AnyTypeExceptNullPropBoxedMap](#anytypeexceptnullpropboxedmap) + +sealed interface that stores validated payloads using boxed classes + +## AnyTypeExceptNullPropBoxedVoid +public record AnyTypeExceptNullPropBoxedVoid
+implements [AnyTypeExceptNullPropBoxed](#anytypeexceptnullpropboxed) + +record that stores validated null payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| AnyTypeExceptNullPropBoxedVoid(Nothing? data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| Nothing? | data()
validated payload | +| @Nullable Object | getData()
validated payload | + +## AnyTypeExceptNullPropBoxedBoolean +public record AnyTypeExceptNullPropBoxedBoolean
+implements [AnyTypeExceptNullPropBoxed](#anytypeexceptnullpropboxed) + +record that stores validated boolean payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| AnyTypeExceptNullPropBoxedBoolean(boolean data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| boolean | data()
validated payload | +| @Nullable Object | getData()
validated payload | + +## AnyTypeExceptNullPropBoxedNumber +public record AnyTypeExceptNullPropBoxedNumber
+implements [AnyTypeExceptNullPropBoxed](#anytypeexceptnullpropboxed) + +record that stores validated Number payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| AnyTypeExceptNullPropBoxedNumber(Number data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| Number | data()
validated payload | +| @Nullable Object | getData()
validated payload | + +## AnyTypeExceptNullPropBoxedString +public record AnyTypeExceptNullPropBoxedString
+implements [AnyTypeExceptNullPropBoxed](#anytypeexceptnullpropboxed) + +record that stores validated String payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| AnyTypeExceptNullPropBoxedString(String data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| String | data()
validated payload | +| @Nullable Object | getData()
validated payload | + +## AnyTypeExceptNullPropBoxedList +public record AnyTypeExceptNullPropBoxedList
+implements [AnyTypeExceptNullPropBoxed](#anytypeexceptnullpropboxed) + +record that stores validated List payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| AnyTypeExceptNullPropBoxedList(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 | + +## AnyTypeExceptNullPropBoxedMap +public record AnyTypeExceptNullPropBoxedMap
+implements [AnyTypeExceptNullPropBoxed](#anytypeexceptnullpropboxed) + +record that stores validated Map payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| AnyTypeExceptNullPropBoxedMap(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 | + +## AnyTypeExceptNullProp +public static class AnyTypeExceptNullProp
+extends JsonSchema + +A schema class that validates payloads + +## Description +any type except 'null' Here the 'type' attribute is not specified, which means the value can be anything, including the null value, string, number, boolean, array or object. + +### Field Summary +| Modifier and Type | Field and Description | +| ----------------- | ---------------------- | +| Class | not = [Not.class](#not) | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| String | validate(String arg, SchemaConfiguration configuration) | +| Nothing? | validate(Nothing? arg, SchemaConfiguration configuration) | +| int | validate(int arg, SchemaConfiguration configuration) | +| long | validate(long arg, SchemaConfiguration configuration) | +| float | validate(float arg, SchemaConfiguration configuration) | +| double | validate(double arg, SchemaConfiguration configuration) | +| Number | validate(Number arg, SchemaConfiguration configuration) | +| boolean | validate(boolean arg, SchemaConfiguration configuration) | +| FrozenMap<@Nullable Object> | validate(Map<?, ?> arg, SchemaConfiguration configuration) | +| FrozenList<@Nullable Object> | validate(List arg, SchemaConfiguration configuration) | +| [AnyTypeExceptNullPropBoxedString](#anytypeexceptnullpropboxedstring) | validateAndBox(String arg, SchemaConfiguration configuration) | +| [AnyTypeExceptNullPropBoxedVoid](#anytypeexceptnullpropboxedvoid) | validateAndBox(Nothing? arg, SchemaConfiguration configuration) | +| [AnyTypeExceptNullPropBoxedNumber](#anytypeexceptnullpropboxednumber) | validateAndBox(Number arg, SchemaConfiguration configuration) | +| [AnyTypeExceptNullPropBoxedBoolean](#anytypeexceptnullpropboxedboolean) | validateAndBox(boolean arg, SchemaConfiguration configuration) | +| [AnyTypeExceptNullPropBoxedMap](#anytypeexceptnullpropboxedmap) | validateAndBox(Map<?, ?> arg, SchemaConfiguration configuration) | +| [AnyTypeExceptNullPropBoxedList](#anytypeexceptnullpropboxedlist) | validateAndBox(List arg, SchemaConfiguration configuration) | +| [AnyTypeExceptNullPropBoxed](#anytypeexceptnullpropboxed) | validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) | +| @Nullable Object | validate(@Nullable Object arg, SchemaConfiguration configuration) | + +## NotBoxed +public sealed interface NotBoxed
+permits
+[NotBoxedVoid](#notboxedvoid) + +sealed interface that stores validated payloads using boxed classes + +## NotBoxedVoid +public record NotBoxedVoid
+implements [NotBoxed](#notboxed) + +record that stores validated null payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| NotBoxedVoid(Nothing? data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| Nothing? | data()
validated payload | +| @Nullable Object | getData()
validated payload | + +## Not +public static class Not
+extends NullJsonSchema.NullJsonSchema1 + +A schema class that validates payloads + +| Methods Inherited from class org.openapijsonschematools.client.schemas.NullJsonSchema.NullJsonSchema1 | +| ------------------------------------------------------------------ | +| validate | +| validateAndBox | + +## AnyTypePropBoxed +public sealed interface AnyTypePropBoxed
+permits
+[AnyTypePropBoxedVoid](#anytypepropboxedvoid), +[AnyTypePropBoxedBoolean](#anytypepropboxedboolean), +[AnyTypePropBoxedNumber](#anytypepropboxednumber), +[AnyTypePropBoxedString](#anytypepropboxedstring), +[AnyTypePropBoxedList](#anytypepropboxedlist), +[AnyTypePropBoxedMap](#anytypepropboxedmap) + +sealed interface that stores validated payloads using boxed classes + +## AnyTypePropBoxedVoid +public record AnyTypePropBoxedVoid
+implements [AnyTypePropBoxed](#anytypepropboxed) + +record that stores validated null payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| AnyTypePropBoxedVoid(Nothing? data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| Nothing? | data()
validated payload | +| @Nullable Object | getData()
validated payload | + +## AnyTypePropBoxedBoolean +public record AnyTypePropBoxedBoolean
+implements [AnyTypePropBoxed](#anytypepropboxed) + +record that stores validated boolean payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| AnyTypePropBoxedBoolean(boolean data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| boolean | data()
validated payload | +| @Nullable Object | getData()
validated payload | + +## AnyTypePropBoxedNumber +public record AnyTypePropBoxedNumber
+implements [AnyTypePropBoxed](#anytypepropboxed) + +record that stores validated Number payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| AnyTypePropBoxedNumber(Number data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| Number | data()
validated payload | +| @Nullable Object | getData()
validated payload | + +## AnyTypePropBoxedString +public record AnyTypePropBoxedString
+implements [AnyTypePropBoxed](#anytypepropboxed) + +record that stores validated String payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| AnyTypePropBoxedString(String data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| String | data()
validated payload | +| @Nullable Object | getData()
validated payload | + +## AnyTypePropBoxedList +public record AnyTypePropBoxedList
+implements [AnyTypePropBoxed](#anytypepropboxed) + +record that stores validated List payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| AnyTypePropBoxedList(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 | + +## AnyTypePropBoxedMap +public record AnyTypePropBoxedMap
+implements [AnyTypePropBoxed](#anytypepropboxed) + +record that stores validated Map payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| AnyTypePropBoxedMap(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 | + +## AnyTypeProp +public static class AnyTypeProp
+extends AnyTypeJsonSchema.AnyTypeJsonSchema1 + +A schema class that validates payloads + +## Description +test code generation for any type Here the 'type' attribute is not specified, which means the value can be anything, including the null value, string, number, boolean, array or object. See https://github.com/OAI/OpenAPI-Specification/issues/1389 + +| Methods Inherited from class org.openapijsonschematools.client.schemas.AnyTypeJsonSchema.AnyTypeJsonSchema1 | +| ------------------------------------------------------------------ | +| validate | +| validateAndBox | + +## ObjectWithNoDeclaredPropsNullableBoxed +public sealed interface ObjectWithNoDeclaredPropsNullableBoxed
+permits
+[ObjectWithNoDeclaredPropsNullableBoxedVoid](#objectwithnodeclaredpropsnullableboxedvoid), +[ObjectWithNoDeclaredPropsNullableBoxedMap](#objectwithnodeclaredpropsnullableboxedmap) + +sealed interface that stores validated payloads using boxed classes + +## ObjectWithNoDeclaredPropsNullableBoxedVoid +public record ObjectWithNoDeclaredPropsNullableBoxedVoid
+implements [ObjectWithNoDeclaredPropsNullableBoxed](#objectwithnodeclaredpropsnullableboxed) + +record that stores validated null payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| ObjectWithNoDeclaredPropsNullableBoxedVoid(Nothing? data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| Nothing? | data()
validated payload | +| @Nullable Object | getData()
validated payload | + +## ObjectWithNoDeclaredPropsNullableBoxedMap +public record ObjectWithNoDeclaredPropsNullableBoxedMap
+implements [ObjectWithNoDeclaredPropsNullableBoxed](#objectwithnodeclaredpropsnullableboxed) + +record that stores validated Map payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| ObjectWithNoDeclaredPropsNullableBoxedMap(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 | + +## ObjectWithNoDeclaredPropsNullable +public static class ObjectWithNoDeclaredPropsNullable
+extends JsonSchema + +A schema class that validates payloads + +## Description +test code generation for nullable objects. Value must be a map of strings to values or the 'null' value. + +### Code Sample +``` +import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags; +import org.openapijsonschematools.client.configurations.SchemaConfiguration; +import org.openapijsonschematools.client.exceptions.ValidationException; +import org.openapijsonschematools.client.schemas.validation.MapUtils; +import org.openapijsonschematools.client.schemas.validation.FrozenList; +import org.openapijsonschematools.client.schemas.validation.FrozenMap; +import org.openapijsonschematools.client.components.schemas.User; + +import java.util.Arrays; +import java.util.List; +import java.util.AbstractMap; + +static final SchemaConfiguration configuration = new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().build()); + +// null validation +Nothing? validatedPayload = User.ObjectWithNoDeclaredPropsNullable.validate( + (Nothing?) null, + configuration +); +``` + +### Field Summary +| Modifier and Type | Field and Description | +| ----------------- | ---------------------- | +| Set> | type = Set.of(
    Nothing?.class,
    Map.class
)
| + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| Nothing? | validate(Nothing? arg, SchemaConfiguration configuration) | +| [ObjectWithNoDeclaredPropsNullableBoxedVoid](#objectwithnodeclaredpropsnullableboxedvoid) | validateAndBox(Nothing? arg, SchemaConfiguration configuration) | +| FrozenMap | validate(Map<?, ?> arg, SchemaConfiguration configuration) | +| [ObjectWithNoDeclaredPropsNullableBoxedMap](#objectwithnodeclaredpropsnullableboxedmap) | validateAndBox(Map<?, ?> arg, SchemaConfiguration configuration) | +| [ObjectWithNoDeclaredPropsNullableBoxed](#objectwithnodeclaredpropsnullableboxed) | validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) | +| @Nullable Object | validate(@Nullable Object arg, SchemaConfiguration configuration) | + +## ObjectWithNoDeclaredPropsBoxed +public sealed interface ObjectWithNoDeclaredPropsBoxed
+permits
+[ObjectWithNoDeclaredPropsBoxedMap](#objectwithnodeclaredpropsboxedmap) + +sealed interface that stores validated payloads using boxed classes + +## ObjectWithNoDeclaredPropsBoxedMap +public record ObjectWithNoDeclaredPropsBoxedMap
+implements [ObjectWithNoDeclaredPropsBoxed](#objectwithnodeclaredpropsboxed) + +record that stores validated Map payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| ObjectWithNoDeclaredPropsBoxedMap(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 | + +## ObjectWithNoDeclaredProps +public static class ObjectWithNoDeclaredProps
+extends MapJsonSchema.MapJsonSchema1 + +A schema class that validates payloads + +## Description +test code generation for objects Value must be a map of strings to values. It cannot be the 'null' value. + +| Methods Inherited from class org.openapijsonschematools.client.schemas.MapJsonSchema.MapJsonSchema1 | +| ------------------------------------------------------------------ | +| validate | +| validateAndBox | + +## UserStatusBoxed +public sealed interface UserStatusBoxed
+permits
+[UserStatusBoxedNumber](#userstatusboxednumber) + +sealed interface that stores validated payloads using boxed classes + +## UserStatusBoxedNumber +public record UserStatusBoxedNumber
+implements [UserStatusBoxed](#userstatusboxed) + +record that stores validated Number payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| UserStatusBoxedNumber(Number data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| Number | data()
validated payload | +| @Nullable Object | getData()
validated payload | + +## UserStatus +public static class UserStatus
+extends Int32JsonSchema.Int32JsonSchema1 + +A schema class that validates payloads + +## Description +User Status + +| Methods Inherited from class org.openapijsonschematools.client.schemas.Int32JsonSchema.Int32JsonSchema1 | +| ------------------------------------------------------------------ | +| validate | +| validateAndBox | + +## PhoneBoxed +public sealed interface PhoneBoxed
+permits
+[PhoneBoxedString](#phoneboxedstring) + +sealed interface that stores validated payloads using boxed classes + +## PhoneBoxedString +public record PhoneBoxedString
+implements [PhoneBoxed](#phoneboxed) + +record that stores validated String payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| PhoneBoxedString(String data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| String | data()
validated payload | +| @Nullable Object | getData()
validated payload | + +## Phone +public static class Phone
+extends StringJsonSchema.StringJsonSchema1 + +A schema class that validates payloads + +| Methods Inherited from class org.openapijsonschematools.client.schemas.StringJsonSchema.StringJsonSchema1 | +| ------------------------------------------------------------------ | +| validate | +| validateAndBox | + +## PasswordBoxed +public sealed interface PasswordBoxed
+permits
+[PasswordBoxedString](#passwordboxedstring) + +sealed interface that stores validated payloads using boxed classes + +## PasswordBoxedString +public record PasswordBoxedString
+implements [PasswordBoxed](#passwordboxed) + +record that stores validated String payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| PasswordBoxedString(String data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| String | data()
validated payload | +| @Nullable Object | getData()
validated payload | + +## Password +public static class Password
+extends StringJsonSchema.StringJsonSchema1 + +A schema class that validates payloads + +| Methods Inherited from class org.openapijsonschematools.client.schemas.StringJsonSchema.StringJsonSchema1 | +| ------------------------------------------------------------------ | +| validate | +| validateAndBox | + +## EmailBoxed +public sealed interface EmailBoxed
+permits
+[EmailBoxedString](#emailboxedstring) + +sealed interface that stores validated payloads using boxed classes + +## EmailBoxedString +public record EmailBoxedString
+implements [EmailBoxed](#emailboxed) + +record that stores validated String payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| EmailBoxedString(String data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| String | data()
validated payload | +| @Nullable Object | getData()
validated payload | + +## Email +public static class Email
+extends StringJsonSchema.StringJsonSchema1 + +A schema class that validates payloads + +| Methods Inherited from class org.openapijsonschematools.client.schemas.StringJsonSchema.StringJsonSchema1 | +| ------------------------------------------------------------------ | +| validate | +| validateAndBox | + +## LastNameBoxed +public sealed interface LastNameBoxed
+permits
+[LastNameBoxedString](#lastnameboxedstring) + +sealed interface that stores validated payloads using boxed classes + +## LastNameBoxedString +public record LastNameBoxedString
+implements [LastNameBoxed](#lastnameboxed) + +record that stores validated String payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| LastNameBoxedString(String data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| String | data()
validated payload | +| @Nullable Object | getData()
validated payload | + +## LastName +public static class LastName
+extends StringJsonSchema.StringJsonSchema1 + +A schema class that validates payloads + +| Methods Inherited from class org.openapijsonschematools.client.schemas.StringJsonSchema.StringJsonSchema1 | +| ------------------------------------------------------------------ | +| validate | +| validateAndBox | + +## FirstNameBoxed +public sealed interface FirstNameBoxed
+permits
+[FirstNameBoxedString](#firstnameboxedstring) + +sealed interface that stores validated payloads using boxed classes + +## FirstNameBoxedString +public record FirstNameBoxedString
+implements [FirstNameBoxed](#firstnameboxed) + +record that stores validated String payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| FirstNameBoxedString(String data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| String | data()
validated payload | +| @Nullable Object | getData()
validated payload | + +## FirstName +public static class FirstName
+extends StringJsonSchema.StringJsonSchema1 + +A schema class that validates payloads + +| Methods Inherited from class org.openapijsonschematools.client.schemas.StringJsonSchema.StringJsonSchema1 | +| ------------------------------------------------------------------ | +| validate | +| validateAndBox | + +## UsernameBoxed +public sealed interface UsernameBoxed
+permits
+[UsernameBoxedString](#usernameboxedstring) + +sealed interface that stores validated payloads using boxed classes + +## UsernameBoxedString +public record UsernameBoxedString
+implements [UsernameBoxed](#usernameboxed) + +record that stores validated String payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| UsernameBoxedString(String data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| String | data()
validated payload | +| @Nullable Object | getData()
validated payload | + +## Username +public static class Username
+extends StringJsonSchema.StringJsonSchema1 + +A schema class that validates payloads + +| Methods Inherited from class org.openapijsonschematools.client.schemas.StringJsonSchema.StringJsonSchema1 | +| ------------------------------------------------------------------ | +| validate | +| validateAndBox | + +## IdBoxed +public sealed interface IdBoxed
+permits
+[IdBoxedNumber](#idboxednumber) + +sealed interface that stores validated payloads using boxed classes + +## IdBoxedNumber +public record IdBoxedNumber
+implements [IdBoxed](#idboxed) + +record that stores validated Number payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| IdBoxedNumber(Number data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| Number | data()
validated payload | +| @Nullable Object | getData()
validated payload | + +## Id +public static class Id
+extends Int64JsonSchema.Int64JsonSchema1 + +A schema class that validates payloads + +| Methods Inherited from class org.openapijsonschematools.client.schemas.Int64JsonSchema.Int64JsonSchema1 | +| ------------------------------------------------------------------ | +| validate | +| validateAndBox | + +[[Back to top]](#top) [[Back to Component Schemas]](../../../README.md#Component-Schemas) [[Back to README]](../../../README.md) diff --git a/samples/client/petstore/kotlin/docs/components/schemas/Whale.md b/samples/client/petstore/kotlin/docs/components/schemas/Whale.md new file mode 100644 index 00000000000..62c94750589 --- /dev/null +++ b/samples/client/petstore/kotlin/docs/components/schemas/Whale.md @@ -0,0 +1,316 @@ +# Whale +org.openapijsonschematools.client.components.schemas.Whale.java +public class Whale
+ +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 | [Whale.Whale1Boxed](#whale1boxed)
sealed interface for validated payloads | +| record | [Whale.Whale1BoxedMap](#whale1boxedmap)
boxed class to store validated Map payloads | +| static class | [Whale.Whale1](#whale1)
schema class | +| static class | [Whale.WhaleMapBuilder](#whalemapbuilder)
builder for Map payloads | +| static class | [Whale.WhaleMap](#whalemap)
output class for Map payloads | +| sealed interface | [Whale.ClassNameBoxed](#classnameboxed)
sealed interface for validated payloads | +| record | [Whale.ClassNameBoxedString](#classnameboxedstring)
boxed class to store validated String payloads | +| static class | [Whale.ClassName](#classname)
schema class | +| enum | [Whale.StringClassNameEnums](#stringclassnameenums)
String enum | +| sealed interface | [Whale.HasTeethBoxed](#hasteethboxed)
sealed interface for validated payloads | +| record | [Whale.HasTeethBoxedBoolean](#hasteethboxedboolean)
boxed class to store validated boolean payloads | +| static class | [Whale.HasTeeth](#hasteeth)
schema class | +| sealed interface | [Whale.HasBaleenBoxed](#hasbaleenboxed)
sealed interface for validated payloads | +| record | [Whale.HasBaleenBoxedBoolean](#hasbaleenboxedboolean)
boxed class to store validated boolean payloads | +| static class | [Whale.HasBaleen](#hasbaleen)
schema class | + +## Whale1Boxed +public sealed interface Whale1Boxed
+permits
+[Whale1BoxedMap](#whale1boxedmap) + +sealed interface that stores validated payloads using boxed classes + +## Whale1BoxedMap +public record Whale1BoxedMap
+implements [Whale1Boxed](#whale1boxed) + +record that stores validated Map payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| Whale1BoxedMap([WhaleMap](#whalemap) data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| [WhaleMap](#whalemap) | data()
validated payload | +| @Nullable Object | getData()
validated payload | + +## Whale1 +public static class Whale1
+extends JsonSchema + +A schema class that validates payloads + +### Code Sample +``` +import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags; +import org.openapijsonschematools.client.configurations.SchemaConfiguration; +import org.openapijsonschematools.client.exceptions.ValidationException; +import org.openapijsonschematools.client.schemas.validation.MapUtils; +import org.openapijsonschematools.client.schemas.validation.FrozenList; +import org.openapijsonschematools.client.schemas.validation.FrozenMap; +import org.openapijsonschematools.client.components.schemas.Whale; + +import java.util.Arrays; +import java.util.List; +import java.util.AbstractMap; + +static final SchemaConfiguration configuration = new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().build()); + +// Map validation +Whale.WhaleMap validatedPayload = + Whale.Whale1.validate( + new Whale.WhaleMapBuilder() + .className("whale") + + .hasBaleen(true) + + .hasTeeth(true) + + .build(), + configuration +); +``` + +### Field Summary +| Modifier and Type | Field and Description | +| ----------------- | ---------------------- | +| Set> | type = Set.of(Map.class) | +| Map> | properties = Map.ofEntries(
    new PropertyEntry("hasBaleen", [HasBaleen.class](#hasbaleen))),
    new PropertyEntry("hasTeeth", [HasTeeth.class](#hasteeth))),
    new PropertyEntry("className", [ClassName.class](#classname)))
)
| +| Set | required = Set.of(
    "className"
)
| + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| [WhaleMap](#whalemap) | validate([Map<?, ?>](#whalemapbuilder) arg, SchemaConfiguration configuration) | +| [Whale1BoxedMap](#whale1boxedmap) | validateAndBox([Map<?, ?>](#whalemapbuilder) arg, SchemaConfiguration configuration) | +| [Whale1Boxed](#whale1boxed) | validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) | +| @Nullable Object | validate(@Nullable Object arg, SchemaConfiguration configuration) | + +## WhaleMap0Builder +public class WhaleMap0Builder
+builder for `Map` + +A class that builds the Map input type + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| WhaleMap0Builder(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 | +| [WhaleMap0Builder](#whalemap0builder) | hasBaleen(boolean value) | +| [WhaleMap0Builder](#whalemap0builder) | hasTeeth(boolean value) | +| [WhaleMap0Builder](#whalemap0builder) | additionalProperty(String key, Nothing? value) | +| [WhaleMap0Builder](#whalemap0builder) | additionalProperty(String key, boolean value) | +| [WhaleMap0Builder](#whalemap0builder) | additionalProperty(String key, String value) | +| [WhaleMap0Builder](#whalemap0builder) | additionalProperty(String key, int value) | +| [WhaleMap0Builder](#whalemap0builder) | additionalProperty(String key, float value) | +| [WhaleMap0Builder](#whalemap0builder) | additionalProperty(String key, long value) | +| [WhaleMap0Builder](#whalemap0builder) | additionalProperty(String key, double value) | +| [WhaleMap0Builder](#whalemap0builder) | additionalProperty(String key, List value) | +| [WhaleMap0Builder](#whalemap0builder) | additionalProperty(String key, Map value) | + +## WhaleMapBuilder +public class WhaleMapBuilder
+builder for `Map` + +A class that builds the Map input type + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| WhaleMapBuilder()
Creates a builder that contains an empty map | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| [WhaleMap0Builder](#whalemap0builder) | className(String value) | +| [WhaleMap0Builder](#whalemap0builder) | className([StringClassNameEnums](#stringclassnameenums) value) | + +## WhaleMap +public static class WhaleMap
+extends FrozenMap + +A class to store validated Map payloads + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| static [WhaleMap](#whalemap) | of([Map](#whalemapbuilder) arg, SchemaConfiguration configuration) | +| String | className()
must be one of ["whale"] | +| boolean | hasBaleen()
[optional] | +| boolean | hasTeeth()
[optional] | +| @Nullable Object | getAdditionalProperty(String name)
provides type safety for additional properties | + +## ClassNameBoxed +public sealed interface ClassNameBoxed
+permits
+[ClassNameBoxedString](#classnameboxedstring) + +sealed interface that stores validated payloads using boxed classes + +## ClassNameBoxedString +public record ClassNameBoxedString
+implements [ClassNameBoxed](#classnameboxed) + +record that stores validated String payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| ClassNameBoxedString(String data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| String | data()
validated payload | +| @Nullable Object | getData()
validated payload | + +## ClassName +public static class ClassName
+extends JsonSchema + +A schema class that validates payloads + +### Code Sample +``` +import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags; +import org.openapijsonschematools.client.configurations.SchemaConfiguration; +import org.openapijsonschematools.client.exceptions.ValidationException; +import org.openapijsonschematools.client.schemas.validation.MapUtils; +import org.openapijsonschematools.client.schemas.validation.FrozenList; +import org.openapijsonschematools.client.schemas.validation.FrozenMap; +import org.openapijsonschematools.client.components.schemas.Whale; + +import java.util.Arrays; +import java.util.List; +import java.util.AbstractMap; + +static final SchemaConfiguration configuration = new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().build()); + +// String validation +String validatedPayload = Whale.ClassName.validate( + "whale", + configuration +); +``` + +### Field Summary +| Modifier and Type | Field and Description | +| ----------------- | ---------------------- | +| Set> | type = Set.of(
    String.class
)
| +| Set | enumValues = SetMaker.makeSet(
    "whale"
)
| + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| String | validate(String arg, SchemaConfiguration configuration) | +| String | validate([StringClassNameEnums](#stringclassnameenums) arg, SchemaConfiguration configuration) | +| [ClassNameBoxedString](#classnameboxedstring) | validateAndBox(String arg, SchemaConfiguration configuration) | +| [ClassNameBoxed](#classnameboxed) | validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) | +| @Nullable Object | validate(@Nullable Object arg, SchemaConfiguration configuration) | + +## StringClassNameEnums +public enum StringClassNameEnums
+extends `Enum` + +A class that stores String enum values + +### Enum Constant Summary +| Enum Constant | Description | +| ------------- | ----------- | +| WHALE | value = "whale" | + +## HasTeethBoxed +public sealed interface HasTeethBoxed
+permits
+[HasTeethBoxedBoolean](#hasteethboxedboolean) + +sealed interface that stores validated payloads using boxed classes + +## HasTeethBoxedBoolean +public record HasTeethBoxedBoolean
+implements [HasTeethBoxed](#hasteethboxed) + +record that stores validated boolean payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| HasTeethBoxedBoolean(boolean data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| boolean | data()
validated payload | +| @Nullable Object | getData()
validated payload | + +## HasTeeth +public static class HasTeeth
+extends BooleanJsonSchema.BooleanJsonSchema1 + +A schema class that validates payloads + +| Methods Inherited from class org.openapijsonschematools.client.schemas.BooleanJsonSchema.BooleanJsonSchema1 | +| ------------------------------------------------------------------ | +| validate | +| validateAndBox | + +## HasBaleenBoxed +public sealed interface HasBaleenBoxed
+permits
+[HasBaleenBoxedBoolean](#hasbaleenboxedboolean) + +sealed interface that stores validated payloads using boxed classes + +## HasBaleenBoxedBoolean +public record HasBaleenBoxedBoolean
+implements [HasBaleenBoxed](#hasbaleenboxed) + +record that stores validated boolean payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| HasBaleenBoxedBoolean(boolean data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| boolean | data()
validated payload | +| @Nullable Object | getData()
validated payload | + +## HasBaleen +public static class HasBaleen
+extends BooleanJsonSchema.BooleanJsonSchema1 + +A schema class that validates payloads + +| Methods Inherited from class org.openapijsonschematools.client.schemas.BooleanJsonSchema.BooleanJsonSchema1 | +| ------------------------------------------------------------------ | +| validate | +| validateAndBox | + +[[Back to top]](#top) [[Back to Component Schemas]](../../../README.md#Component-Schemas) [[Back to README]](../../../README.md) diff --git a/samples/client/petstore/kotlin/docs/components/schemas/Zebra.md b/samples/client/petstore/kotlin/docs/components/schemas/Zebra.md new file mode 100644 index 00000000000..59ed83af36d --- /dev/null +++ b/samples/client/petstore/kotlin/docs/components/schemas/Zebra.md @@ -0,0 +1,456 @@ +# Zebra +org.openapijsonschematools.client.components.schemas.Zebra.java +public class Zebra
+ +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 | [Zebra.Zebra1Boxed](#zebra1boxed)
sealed interface for validated payloads | +| record | [Zebra.Zebra1BoxedMap](#zebra1boxedmap)
boxed class to store validated Map payloads | +| static class | [Zebra.Zebra1](#zebra1)
schema class | +| static class | [Zebra.ZebraMapBuilder](#zebramapbuilder)
builder for Map payloads | +| static class | [Zebra.ZebraMap](#zebramap)
output class for Map payloads | +| sealed interface | [Zebra.ClassNameBoxed](#classnameboxed)
sealed interface for validated payloads | +| record | [Zebra.ClassNameBoxedString](#classnameboxedstring)
boxed class to store validated String payloads | +| static class | [Zebra.ClassName](#classname)
schema class | +| enum | [Zebra.StringClassNameEnums](#stringclassnameenums)
String enum | +| sealed interface | [Zebra.TypeBoxed](#typeboxed)
sealed interface for validated payloads | +| record | [Zebra.TypeBoxedString](#typeboxedstring)
boxed class to store validated String payloads | +| static class | [Zebra.Type](#type)
schema class | +| enum | [Zebra.StringTypeEnums](#stringtypeenums)
String enum | +| sealed interface | [Zebra.AdditionalPropertiesBoxed](#additionalpropertiesboxed)
sealed interface for validated payloads | +| record | [Zebra.AdditionalPropertiesBoxedVoid](#additionalpropertiesboxedvoid)
boxed class to store validated null payloads | +| record | [Zebra.AdditionalPropertiesBoxedBoolean](#additionalpropertiesboxedboolean)
boxed class to store validated boolean payloads | +| record | [Zebra.AdditionalPropertiesBoxedNumber](#additionalpropertiesboxednumber)
boxed class to store validated Number payloads | +| record | [Zebra.AdditionalPropertiesBoxedString](#additionalpropertiesboxedstring)
boxed class to store validated String payloads | +| record | [Zebra.AdditionalPropertiesBoxedList](#additionalpropertiesboxedlist)
boxed class to store validated List payloads | +| record | [Zebra.AdditionalPropertiesBoxedMap](#additionalpropertiesboxedmap)
boxed class to store validated Map payloads | +| static class | [Zebra.AdditionalProperties](#additionalproperties)
schema class | + +## Zebra1Boxed +public sealed interface Zebra1Boxed
+permits
+[Zebra1BoxedMap](#zebra1boxedmap) + +sealed interface that stores validated payloads using boxed classes + +## Zebra1BoxedMap +public record Zebra1BoxedMap
+implements [Zebra1Boxed](#zebra1boxed) + +record that stores validated Map payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| Zebra1BoxedMap([ZebraMap](#zebramap) data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| [ZebraMap](#zebramap) | data()
validated payload | +| @Nullable Object | getData()
validated payload | + +## Zebra1 +public static class Zebra1
+extends JsonSchema + +A schema class that validates payloads + +### Code Sample +``` +import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags; +import org.openapijsonschematools.client.configurations.SchemaConfiguration; +import org.openapijsonschematools.client.exceptions.ValidationException; +import org.openapijsonschematools.client.schemas.validation.MapUtils; +import org.openapijsonschematools.client.schemas.validation.FrozenList; +import org.openapijsonschematools.client.schemas.validation.FrozenMap; +import org.openapijsonschematools.client.components.schemas.Zebra; + +import java.util.Arrays; +import java.util.List; +import java.util.AbstractMap; + +static final SchemaConfiguration configuration = new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().build()); + +// Map validation +Zebra.ZebraMap validatedPayload = + Zebra.Zebra1.validate( + new Zebra.ZebraMapBuilder() + .className("zebra") + + .type("plains") + + .build(), + configuration +); +``` + +### Field Summary +| Modifier and Type | Field and Description | +| ----------------- | ---------------------- | +| Set> | type = Set.of(Map.class) | +| Map> | properties = Map.ofEntries(
    new PropertyEntry("type", [Type.class](#type))),
    new PropertyEntry("className", [ClassName.class](#classname)))
)
| +| Set | required = Set.of(
    "className"
)
| +| Class | additionalProperties = [AdditionalProperties.class](#additionalproperties) | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| [ZebraMap](#zebramap) | validate([Map<?, ?>](#zebramapbuilder) arg, SchemaConfiguration configuration) | +| [Zebra1BoxedMap](#zebra1boxedmap) | validateAndBox([Map<?, ?>](#zebramapbuilder) arg, SchemaConfiguration configuration) | +| [Zebra1Boxed](#zebra1boxed) | validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) | +| @Nullable Object | validate(@Nullable Object arg, SchemaConfiguration configuration) | + +## ZebraMap0Builder +public class ZebraMap0Builder
+builder for `Map` + +A class that builds the Map input type + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| ZebraMap0Builder(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 | +| [ZebraMap0Builder](#zebramap0builder) | type(String value) | +| [ZebraMap0Builder](#zebramap0builder) | type([StringTypeEnums](#stringtypeenums) value) | +| [ZebraMap0Builder](#zebramap0builder) | additionalProperty(String key, Nothing? value) | +| [ZebraMap0Builder](#zebramap0builder) | additionalProperty(String key, boolean value) | +| [ZebraMap0Builder](#zebramap0builder) | additionalProperty(String key, String value) | +| [ZebraMap0Builder](#zebramap0builder) | additionalProperty(String key, int value) | +| [ZebraMap0Builder](#zebramap0builder) | additionalProperty(String key, float value) | +| [ZebraMap0Builder](#zebramap0builder) | additionalProperty(String key, long value) | +| [ZebraMap0Builder](#zebramap0builder) | additionalProperty(String key, double value) | +| [ZebraMap0Builder](#zebramap0builder) | additionalProperty(String key, List value) | +| [ZebraMap0Builder](#zebramap0builder) | additionalProperty(String key, Map value) | + +## ZebraMapBuilder +public class ZebraMapBuilder
+builder for `Map` + +A class that builds the Map input type + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| ZebraMapBuilder()
Creates a builder that contains an empty map | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| [ZebraMap0Builder](#zebramap0builder) | className(String value) | +| [ZebraMap0Builder](#zebramap0builder) | className([StringClassNameEnums](#stringclassnameenums) value) | + +## ZebraMap +public static class ZebraMap
+extends FrozenMap + +A class to store validated Map payloads + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| static [ZebraMap](#zebramap) | of([Map](#zebramapbuilder) arg, SchemaConfiguration configuration) | +| String | className()
must be one of ["zebra"] | +| String | type()
[optional] must be one of ["plains", "mountain", "grevys"] | +| @Nullable Object | getAdditionalProperty(String name)
provides type safety for additional properties | + +## ClassNameBoxed +public sealed interface ClassNameBoxed
+permits
+[ClassNameBoxedString](#classnameboxedstring) + +sealed interface that stores validated payloads using boxed classes + +## ClassNameBoxedString +public record ClassNameBoxedString
+implements [ClassNameBoxed](#classnameboxed) + +record that stores validated String payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| ClassNameBoxedString(String data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| String | data()
validated payload | +| @Nullable Object | getData()
validated payload | + +## ClassName +public static class ClassName
+extends JsonSchema + +A schema class that validates payloads + +### Code Sample +``` +import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags; +import org.openapijsonschematools.client.configurations.SchemaConfiguration; +import org.openapijsonschematools.client.exceptions.ValidationException; +import org.openapijsonschematools.client.schemas.validation.MapUtils; +import org.openapijsonschematools.client.schemas.validation.FrozenList; +import org.openapijsonschematools.client.schemas.validation.FrozenMap; +import org.openapijsonschematools.client.components.schemas.Zebra; + +import java.util.Arrays; +import java.util.List; +import java.util.AbstractMap; + +static final SchemaConfiguration configuration = new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().build()); + +// String validation +String validatedPayload = Zebra.ClassName.validate( + "zebra", + configuration +); +``` + +### Field Summary +| Modifier and Type | Field and Description | +| ----------------- | ---------------------- | +| Set> | type = Set.of(
    String.class
)
| +| Set | enumValues = SetMaker.makeSet(
    "zebra"
)
| + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| String | validate(String arg, SchemaConfiguration configuration) | +| String | validate([StringClassNameEnums](#stringclassnameenums) arg, SchemaConfiguration configuration) | +| [ClassNameBoxedString](#classnameboxedstring) | validateAndBox(String arg, SchemaConfiguration configuration) | +| [ClassNameBoxed](#classnameboxed) | validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) | +| @Nullable Object | validate(@Nullable Object arg, SchemaConfiguration configuration) | + +## StringClassNameEnums +public enum StringClassNameEnums
+extends `Enum` + +A class that stores String enum values + +### Enum Constant Summary +| Enum Constant | Description | +| ------------- | ----------- | +| ZEBRA | value = "zebra" | + +## TypeBoxed +public sealed interface TypeBoxed
+permits
+[TypeBoxedString](#typeboxedstring) + +sealed interface that stores validated payloads using boxed classes + +## TypeBoxedString +public record TypeBoxedString
+implements [TypeBoxed](#typeboxed) + +record that stores validated String payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| TypeBoxedString(String data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| String | data()
validated payload | +| @Nullable Object | getData()
validated payload | + +## Type +public static class Type
+extends JsonSchema + +A schema class that validates payloads + +### Code Sample +``` +import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags; +import org.openapijsonschematools.client.configurations.SchemaConfiguration; +import org.openapijsonschematools.client.exceptions.ValidationException; +import org.openapijsonschematools.client.schemas.validation.MapUtils; +import org.openapijsonschematools.client.schemas.validation.FrozenList; +import org.openapijsonschematools.client.schemas.validation.FrozenMap; +import org.openapijsonschematools.client.components.schemas.Zebra; + +import java.util.Arrays; +import java.util.List; +import java.util.AbstractMap; + +static final SchemaConfiguration configuration = new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().build()); + +// String validation +String validatedPayload = Zebra.Type.validate( + "plains", + configuration +); +``` + +### Field Summary +| Modifier and Type | Field and Description | +| ----------------- | ---------------------- | +| Set> | type = Set.of(
    String.class
)
| +| Set | enumValues = SetMaker.makeSet(
    "plains",
    "mountain",
    "grevys"
)
| + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| String | validate(String arg, SchemaConfiguration configuration) | +| String | validate([StringTypeEnums](#stringtypeenums) arg, SchemaConfiguration configuration) | +| [TypeBoxedString](#typeboxedstring) | validateAndBox(String arg, SchemaConfiguration configuration) | +| [TypeBoxed](#typeboxed) | validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) | +| @Nullable Object | validate(@Nullable Object arg, SchemaConfiguration configuration) | + +## StringTypeEnums +public enum StringTypeEnums
+extends `Enum` + +A class that stores String enum values + +### Enum Constant Summary +| Enum Constant | Description | +| ------------- | ----------- | +| PLAINS | value = "plains" | +| MOUNTAIN | value = "mountain" | +| GREVYS | value = "grevys" | + +## 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(Nothing? data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| Nothing? | 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 AnyTypeJsonSchema.AnyTypeJsonSchema1 + +A schema class that validates payloads + +| Methods Inherited from class org.openapijsonschematools.client.schemas.AnyTypeJsonSchema.AnyTypeJsonSchema1 | +| ------------------------------------------------------------------ | +| validate | +| validateAndBox | + +[[Back to top]](#top) [[Back to Component Schemas]](../../../README.md#Component-Schemas) [[Back to README]](../../../README.md) diff --git a/samples/client/petstore/kotlin/docs/components/securityschemes/ApiKey.md b/samples/client/petstore/kotlin/docs/components/securityschemes/ApiKey.md new file mode 100644 index 00000000000..683fc84f1f0 --- /dev/null +++ b/samples/client/petstore/kotlin/docs/components/securityschemes/ApiKey.md @@ -0,0 +1,22 @@ +org.openapijsonschematools.client.components.securityschemes.ApiKey +# SecurityScheme ApiKey + +public class ApiKey +extends ApiKeyHeaderSecurityScheme + +A class that is used to apply auth to a request + +### Description +apiKey in header + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| void | applyAuth(Map> headers, String resourcePath, String method, HttpRequest.BodyPublisher bodyPublisher, @Nullable String queryParamsSuffix, List scopeNames) | + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| ApiKey(String apiKey)
for header apiKey auth | + +[[Back to top]](#top) [[Back to Component Security Schemes]](../../../README.md#Component-SecuritySchemes) [[Back to README]](../../../README.md) diff --git a/samples/client/petstore/kotlin/docs/components/securityschemes/ApiKeyQuery.md b/samples/client/petstore/kotlin/docs/components/securityschemes/ApiKeyQuery.md new file mode 100644 index 00000000000..3a9c08397fa --- /dev/null +++ b/samples/client/petstore/kotlin/docs/components/securityschemes/ApiKeyQuery.md @@ -0,0 +1,22 @@ +org.openapijsonschematools.client.components.securityschemes.ApiKeyQuery +# SecurityScheme ApiKeyQuery + +public class ApiKeyQuery +extends ApiKeyQuerySecurityScheme + +A class that is used to apply auth to a request + +### Description +apiKey in query + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| void | applyAuth(Map> headers, String resourcePath, String method, HttpRequest.BodyPublisher bodyPublisher, @Nullable String queryParamsSuffix, List scopeNames) | + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| ApiKeyQuery(String apiKey)
for query apiKey auth | + +[[Back to top]](#top) [[Back to Component Security Schemes]](../../../README.md#Component-SecuritySchemes) [[Back to README]](../../../README.md) diff --git a/samples/client/petstore/kotlin/docs/components/securityschemes/BearerTest.md b/samples/client/petstore/kotlin/docs/components/securityschemes/BearerTest.md new file mode 100644 index 00000000000..fd0b3c2f14b --- /dev/null +++ b/samples/client/petstore/kotlin/docs/components/securityschemes/BearerTest.md @@ -0,0 +1,22 @@ +org.openapijsonschematools.client.components.securityschemes.BearerTest +# SecurityScheme BearerTest + +public class BearerTest +extends HttpBearerSecurityScheme + +A class that is used to apply auth to a request + +### Description +http bearer with JWT bearer format + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| void | applyAuth(Map> headers, String resourcePath, String method, HttpRequest.BodyPublisher bodyPublisher, @Nullable String queryParamsSuffix, List scopeNames) | + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| BearerTest(String accessToken) | + +[[Back to top]](#top) [[Back to Component Security Schemes]](../../../README.md#Component-SecuritySchemes) [[Back to README]](../../../README.md) diff --git a/samples/client/petstore/kotlin/docs/components/securityschemes/HttpBasicTest.md b/samples/client/petstore/kotlin/docs/components/securityschemes/HttpBasicTest.md new file mode 100644 index 00000000000..d828c6a7db1 --- /dev/null +++ b/samples/client/petstore/kotlin/docs/components/securityschemes/HttpBasicTest.md @@ -0,0 +1,22 @@ +org.openapijsonschematools.client.components.securityschemes.HttpBasicTest +# SecurityScheme HttpBasicTest + +public class HttpBasicTest +extends HttpBasicSecurityScheme + +A class that is used to apply auth to a request + +### Description +http basic + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| void | applyAuth(Map> headers, String resourcePath, String method, HttpRequest.BodyPublisher bodyPublisher, @Nullable String queryParamsSuffix, List scopeNames) | + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| HttpBasicTest(String userId, String password) | + +[[Back to top]](#top) [[Back to Component Security Schemes]](../../../README.md#Component-SecuritySchemes) [[Back to README]](../../../README.md) diff --git a/samples/client/petstore/kotlin/docs/components/securityschemes/HttpSignatureTest.md b/samples/client/petstore/kotlin/docs/components/securityschemes/HttpSignatureTest.md new file mode 100644 index 00000000000..1c3a9df3af0 --- /dev/null +++ b/samples/client/petstore/kotlin/docs/components/securityschemes/HttpSignatureTest.md @@ -0,0 +1,22 @@ +org.openapijsonschematools.client.components.securityschemes.HttpSignatureTest +# SecurityScheme HttpSignatureTest + +public class HttpSignatureTest +extends HttpSignatureSecurityScheme + +A class that is used to apply auth to a request + +### Description +http + signature + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| void | applyAuth(Map> headers, String resourcePath, String method, HttpRequest.BodyPublisher bodyPublisher, @Nullable String queryParamsSuffix, List scopeNames) | + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| todo | + +[[Back to top]](#top) [[Back to Component Security Schemes]](../../../README.md#Component-SecuritySchemes) [[Back to README]](../../../README.md) diff --git a/samples/client/petstore/kotlin/docs/components/securityschemes/OpenIdConnectTest.md b/samples/client/petstore/kotlin/docs/components/securityschemes/OpenIdConnectTest.md new file mode 100644 index 00000000000..c53a8c6d6df --- /dev/null +++ b/samples/client/petstore/kotlin/docs/components/securityschemes/OpenIdConnectTest.md @@ -0,0 +1,22 @@ +org.openapijsonschematools.client.components.securityschemes.OpenIdConnectTest +# SecurityScheme OpenIdConnectTest + +public class OpenIdConnectTest +extends OpenIdConnectSecurityScheme + +A class that is used to apply auth to a request + +### Description +openIdConnect + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| void | applyAuth(Map> headers, String resourcePath, String method, HttpRequest.BodyPublisher bodyPublisher, @Nullable String queryParamsSuffix, List scopeNames) | + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| todo | + +[[Back to top]](#top) [[Back to Component Security Schemes]](../../../README.md#Component-SecuritySchemes) [[Back to README]](../../../README.md) diff --git a/samples/client/petstore/kotlin/docs/components/securityschemes/PetstoreAuth.md b/samples/client/petstore/kotlin/docs/components/securityschemes/PetstoreAuth.md new file mode 100644 index 00000000000..1a71f915c39 --- /dev/null +++ b/samples/client/petstore/kotlin/docs/components/securityschemes/PetstoreAuth.md @@ -0,0 +1,22 @@ +org.openapijsonschematools.client.components.securityschemes.PetstoreAuth +# SecurityScheme PetstoreAuth + +public class PetstoreAuth +extends Oauth2SecurityScheme + +A class that is used to apply auth to a request + +### Description +oauth2 implicit flow with two scopes + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| void | applyAuth(Map> headers, String resourcePath, String method, HttpRequest.BodyPublisher bodyPublisher, @Nullable String queryParamsSuffix, List scopeNames) | + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| todo | + +[[Back to top]](#top) [[Back to Component Security Schemes]](../../../README.md#Component-SecuritySchemes) [[Back to README]](../../../README.md) diff --git a/samples/client/petstore/kotlin/docs/paths/anotherfakedummy/AnotherfakedummyPatch.md b/samples/client/petstore/kotlin/docs/paths/anotherfakedummy/AnotherfakedummyPatch.md new file mode 100644 index 00000000000..a85eb636b4c --- /dev/null +++ b/samples/client/petstore/kotlin/docs/paths/anotherfakedummy/AnotherfakedummyPatch.md @@ -0,0 +1,188 @@ +# AnotherfakedummyPatch + +public class AnotherfakedummyPatch + +A class that contains necessary endpoint classes +- a class that calls the endpoint method using the http verb +- a class that calls the endpoint method using the operationId name +- class(es) to store the request inputs +- builder(s) to set the request input data + +## Nested Class Summary +| Modifier and Type | Class and Description | +| ----------------- | --------------------- | +| static class | [Patch](#patch)
The class that has a patch method to call the endpoint | +| interface | [Model123TestSpecialTagsOperation](#model123testspecialtagsoperation)
The interface that has a model123TestSpecialTags method to call the endpoint | +| static class | [PatchRequest](#patchrequest)
The final request inputs class | +| static class | [PatchNullableRequest](#patchnullablerequest)
The initial request inputs class | +| static class | [Patch0RequestBuilder](#patch0requestbuilder)
A builder for the request input class | +| static class | [PatchRequestBuilder](#patchrequestbuilder)
A builder for the request input class | + +## Patch +public static class Patch extends ApiClient.ApiClient1 implements PatchOperation
+ +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.AnotherfakedummyPatchRequestBody; +import org.openapijsonschematools.client.components.schemas.Client; +import org.openapijsonschematools.client.servers.RootServer0; +import org.openapijsonschematools.client.servers.RootServer1; +import org.openapijsonschematools.client.servers.RootServer2; +import org.openapijsonschematools.client.paths.anotherfakedummy.patch.responses.AnotherfakedummyPatchCode200Response; +import org.openapijsonschematools.client.servers.RootServerInfo; +import org.openapijsonschematools.client.paths.anotherfakedummy.AnotherfakedummyPatch; +import org.openapijsonschematools.client.paths.anotherfakedummy.patch.AnotherfakedummyPatchResponses; + +import java.io.IOException; +import java.util.Arrays; +import java.util.List; +import java.util.Map; +import java.util.AbstractMap; + +// if you want to use a server that is not SERVER_0 pass it in here and change the ServerIndex input below +ApiConfiguration.ServerInfo serverInfo = new ApiConfiguration.ServerInfoBuilder() + .rootServerInfo( + new RootServerInfo.RootServerInfoBuilder() + .rootServer0(new RootServer0()) + .build() + ) + .build(); +ApiConfiguration.ServerIndexInfo serverIndexInfo = new ApiConfiguration.ServerIndexInfoBuilder() + .rootServerInfoServerIndex(RootServerInfo.ServerIndex.SERVER_0) + .build(); +Duration timeout = Duration.ofSeconds(1L); +Map> defaultHeaders = Map.of("User-Agent", List.of("OpenAPI-JSON-Schema-Generator/1.0.0/java")); +ApiConfiguration apiConfiguration = new ApiConfiguration( + serverInfo + serverIndexInfo, + timeout, + defaultHeaders +); +SchemaConfiguration schemaConfiguration = new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().build()); +AnotherfakedummyPatch.Patch apiClient = new AnotherfakedummyPatch.Patch(apiConfiguration, schemaConfiguration); + + +Client1BoxedMap requestBodyPayload = + Client.Client1.validateAndBox( + new Client.ClientMapBuilder1() + .client("a") + + .build(), + schemaConfiguration +); +AnotherfakedummyPatchRequestBody.SealedRequestBody requestBody = new AnotherfakedummyPatchRequestBody.ApplicationjsonRequestBody(requestBodyPayload); + +var request = new AnotherfakedummyPatch.PatchRequestBuilder() + .requestBody(requestBody) + .build(); + +AnotherfakedummyPatchResponses.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; +} +AnotherfakedummyPatchResponses.EndpointAnotherfakedummyPatchCode200Response castResponse = (AnotherfakedummyPatchResponses.EndpointAnotherfakedummyPatchCode200Response) response; +AnotherfakedummyPatchCode200Response.ApplicationjsonResponseBody deserializedBody = (AnotherfakedummyPatchCode200Response.ApplicationjsonResponseBody) castResponse.body; +// handle deserialized body here +``` +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| Patch(ApiConfiguration apiConfiguration, SchemaConfiguration schemaConfiguration)
Creates an instance | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| [AnotherfakedummyPatchResponses.EndpointResponse](../../paths/anotherfakedummy/patch/AnotherfakedummyPatchResponses.md#endpointresponse) | patch([PatchRequest](#patchrequest) request) | + +## Model123TestSpecialTagsOperation +public interface Model123TestSpecialTagsOperation
+ +an interface that allows one to call the endpoint using a method named model123TestSpecialTags by the operationId + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| [AnotherfakedummyPatchResponses.EndpointResponse](../../paths/anotherfakedummy/patch/AnotherfakedummyPatchResponses.md#endpointresponse) | model123TestSpecialTags([PatchRequest](#patchrequest) request) | + +## PatchRequest +public static class PatchRequest
+ +a class that stores the final request inputs + +### Field Summary +| Modifier and Type | Field and Description | +| ----------------- | --------------------- | +| [AnotherfakedummyPatchRequestBody.SealedRequestBody](../../paths/anotherfakedummy/patch/AnotherfakedummyPatchRequestBody.md#sealedrequestbody) | requestBody | +| [RootServerInfo.@Nullable ServerIndex](../../RootServerInfo.md#serverindex) | serverIndex
optional. Note: this will override the value in apiConfiguration | +| @Nullable Duration | timeout
optional. Note: this will override the value in apiConfiguration | + +## PatchNullableRequest +public static class PatchNullableRequest
+ +a class that stores the initial request inputs + +### Field Summary +| Modifier and Type | Field and Description | +| ----------------- | --------------------- | +| [AnotherfakedummyPatchRequestBody.@Nullable SealedRequestBody](../../paths/anotherfakedummy/patch/AnotherfakedummyPatchRequestBody.md#sealedrequestbody) | requestBody | +| [RootServerInfo.@Nullable ServerIndex](../../RootServerInfo.md#serverindex) | serverIndex | +| @Nullable Duration | timeout | + +## Patch0RequestBuilder +public static class Patch0RequestBuilder
+ +a builder for request inputs + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| Patch0RequestBuilder(Patch0RequestBuilder instance)
Creates a builder that contains the passed instance | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| [PatchRequest](#patchrequest) | build()
Returns the request input used to call an endpoint method | +| [Patch0RequestBuilder](#patch0requestbuilder) | serverIndex([RootServerInfo.ServerIndex](../../RootServerInfo.md#serverindex) serverIndex)
sets the optional property. Note: this will override the value in apiConfiguration | +| [Patch0RequestBuilder](#patch0requestbuilder) | timeout(Duration timeout)
sets the optional property. Note: this will override the value in apiConfiguration | + +## PatchRequestBuilder +public static class PatchRequestBuilder
+ +a builder for request inputs + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| PatchRequestBuilder()
Creates a builder that contains null for all parameters | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| [Patch0RequestBuilder](#patch0requestbuilder) | requestBody([AnotherfakedummyPatchRequestBody.SealedRequestBody](../../paths/anotherfakedummy/patch/AnotherfakedummyPatchRequestBody.md#sealedrequestbody) requestBody)
sets the property | + +[[Back to top]](#top) [[Back to README]](../../../README.md) diff --git a/samples/client/petstore/kotlin/docs/paths/anotherfakedummy/patch/AnotherfakedummyPatchRequestBody.md b/samples/client/petstore/kotlin/docs/paths/anotherfakedummy/patch/AnotherfakedummyPatchRequestBody.md new file mode 100644 index 00000000000..efa5336e17e --- /dev/null +++ b/samples/client/petstore/kotlin/docs/paths/anotherfakedummy/patch/AnotherfakedummyPatchRequestBody.md @@ -0,0 +1,17 @@ +# AnotherfakedummyPatchRequestBody + +public class AnotherfakedummyPatchRequestBody 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 + +## Nested Class Summary +| Modifier and Type | Class and Description | +| ----------------- | --------------------- | +| static class | [AnotherfakedummyPatchRequestBody.AnotherfakedummyPatchRequestBody1](#anotherfakedummypatchrequestbody1)
class that serializes request bodies | + +## AnotherfakedummyPatchRequestBody1 +public static class AnotherfakedummyPatchRequestBody1 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/kotlin/docs/paths/anotherfakedummy/patch/AnotherfakedummyPatchResponses.md b/samples/client/petstore/kotlin/docs/paths/anotherfakedummy/patch/AnotherfakedummyPatchResponses.md new file mode 100644 index 00000000000..54baee69017 --- /dev/null +++ b/samples/client/petstore/kotlin/docs/paths/anotherfakedummy/patch/AnotherfakedummyPatchResponses.md @@ -0,0 +1,29 @@ +# AnotherfakedummyPatchResponses + +public class AnotherfakedummyPatchResponses + +A class that contains necessary responses classes +- a sealed interface, EndpointResponse, that stores endpoint responses +- records for each endpoint response + +## Nested Class Summary +| Modifier and Type | Class and Description | +| ----------------- | --------------------- | +| sealed interface | [EndpointResponse](#endpointresponse)
stores the endpoint responses | +| record | [EndpointAnotherfakedummyPatchCode200Response](#endpointanotherfakedummypatchcode200response)
the response for 200 | + +## EndpointResponse +public sealed interface EndpointResponse permits
+[EndpointAnotherfakedummyPatchCode200Response](#endpointanotherfakedummypatchcode200response) + +a sealed interface that stores endpoint responses + +## EndpointAnotherfakedummyPatchCode200Response +public record EndpointAnotherfakedummyPatchCode200Response( + HttpResponse response, + [AnotherfakedummyPatchCode200Response.SealedResponseBody](../../../paths/anotherfakedummy/patch/responses/AnotherfakedummyPatchCode200Response.md#sealedresponsebody) body, + Nothing? headers +) implements EndpointResponse, ApiResponse
+ +a class that stores an endpoint response + diff --git a/samples/client/petstore/kotlin/docs/paths/anotherfakedummy/patch/responses/AnotherfakedummyPatchCode200Response.md b/samples/client/petstore/kotlin/docs/paths/anotherfakedummy/patch/responses/AnotherfakedummyPatchCode200Response.md new file mode 100644 index 00000000000..cdbe61ff3ee --- /dev/null +++ b/samples/client/petstore/kotlin/docs/paths/anotherfakedummy/patch/responses/AnotherfakedummyPatchCode200Response.md @@ -0,0 +1,87 @@ +# AnotherfakedummyPatchCode200Response + +public class AnotherfakedummyPatchCode200Response + +A class that contains necessary nested response classes +- SealedMediaType, a sealed interface which contains all the schema/encoding info for each contentType +- records which implement SealedMediaType, the concrete media types +- SealedResponseBody, a sealed interface which contains all the contentType/schema types +- records which implement SealedResponseBody, the concrete response body types +- a class that extends ResponseDeserializer and is used to deserialize responses + +## Nested Class Summary +| Modifier and Type | Class and Description | +| ----------------- | --------------------- | +| sealed interface | [AnotherfakedummyPatchCode200Response.SealedMediaType](#sealedmediatype)
media type sealed interface | +| record | [AnotherfakedummyPatchCode200Response.ApplicationjsonMediaType](#applicationjsonmediatype)
record storing schema + encoding for a specific contentType | +| sealed interface | [AnotherfakedummyPatchCode200Response.SealedResponseBody](#sealedresponsebody)
response body sealed interface | +| record | [AnotherfakedummyPatchCode200Response.ApplicationjsonResponseBody](#applicationjsonresponsebody)
implements sealed interface to store response body | +| static class | [AnotherfakedummyPatchCode200Response.AnotherfakedummyPatchCode200Response1](#anotherfakedummypatchcode200response1)
class that deserializes responses | + +## SealedMediaType +public sealed interface SealedMediaType
+permits
+[ApplicationjsonMediaType](#applicationjsonmediatype) + +sealed interface that stores schema and encoding info + +## ApplicationjsonMediaType +public record ApplicationjsonMediaType
+implements [SealedMediaType](#sealedmediatype), MediaType<[ApplicationjsonSchema.ApplicationjsonSchema1](../../../../paths/anotherfakedummy/patch/responses/code200response/content/applicationjson/ApplicationjsonSchema.md#applicationjsonschema1), Nothing?> + +class storing schema info for a specific contentType + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| ApplicationjsonMediaType()
Creates an instance | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| [ApplicationjsonSchema.ApplicationjsonSchema1](../../../../paths/anotherfakedummy/patch/responses/code200response/content/applicationjson/ApplicationjsonSchema.md#applicationjsonschema1) | schema()
the schema for this MediaType | +| Nothing? | encoding()
the encoding info | + +## SealedResponseBody +public sealed interface SealedResponseBody
+permits
+[ApplicationjsonResponseBody](#applicationjsonresponsebody) + +sealed interface that stores response body + +## ApplicationjsonResponseBody +public record ApplicationjsonResponseBody
+implements [SealedResponseBody](#sealedresponsebody) + +A record class to store response body for contentType="application/json" + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| ApplicationjsonResponseBody(ApplicationjsonSchema.[Client1Boxed](../../../../components/schemas/Client.md#client1boxed) body)
Creates an instance | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| ApplicationjsonSchema.[Client1Boxed](../../../../components/schemas/Client.md#client1boxed) | body()
returns the body passed in in the constructor | + +## AnotherfakedummyPatchCode200Response1 +public static class AnotherfakedummyPatchCode200Response1
+extends ResponseDeserializer<[SealedResponseBody](#sealedresponsebody), Nothing?, [SealedMediaType](#sealedmediatype)> + +a class that deserializes responses + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| AnotherfakedummyPatchCode200Response1()
Creates an instance | + +### Field Summary +| Modifier and Type | Field and Description | +| ----------------- | --------------------- | +| 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 | +| ----------------- | ---------------------- | +| ApiResponse<[SealedResponseBody](#sealedresponsebody), Nothing?> | deserialize(HttpResponse response, SchemaConfiguration configuration)
called by endpoint when deserialize responses | diff --git a/samples/client/petstore/kotlin/docs/paths/anotherfakedummy/patch/responses/code200response/content/applicationjson/ApplicationjsonSchema.md b/samples/client/petstore/kotlin/docs/paths/anotherfakedummy/patch/responses/code200response/content/applicationjson/ApplicationjsonSchema.md new file mode 100644 index 00000000000..534041524ca --- /dev/null +++ b/samples/client/petstore/kotlin/docs/paths/anotherfakedummy/patch/responses/code200response/content/applicationjson/ApplicationjsonSchema.md @@ -0,0 +1,19 @@ +# ApplicationjsonSchema +public class ApplicationjsonSchema
+extends [Client1](../../../../../../../components/schemas/Client.md#client) + +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 + +## Nested Class Summary +| Modifier and Type | Class and Description | +| ----------------- | ---------------------- | +| static class | [ApplicationjsonSchema.ApplicationjsonSchema1](#applicationjsonschema1)
schema class | + +## ApplicationjsonSchema1 +public static class ApplicationjsonSchema1
+extends [Client.Client1](../../../../../../../components/schemas/Client.md#client1) + +A schema class that validates payloads diff --git a/samples/client/petstore/kotlin/docs/paths/commonparamsubdir/CommonparamsubdirDelete.md b/samples/client/petstore/kotlin/docs/paths/commonparamsubdir/CommonparamsubdirDelete.md new file mode 100644 index 00000000000..10427882962 --- /dev/null +++ b/samples/client/petstore/kotlin/docs/paths/commonparamsubdir/CommonparamsubdirDelete.md @@ -0,0 +1,189 @@ +# CommonparamsubdirDelete + +public class CommonparamsubdirDelete + +A class that contains necessary endpoint classes +- a class that calls the endpoint method using the http verb +- a class that calls the endpoint method using the operationId name +- class(es) to store the request inputs +- builder(s) to set the request input data + +## Nested Class Summary +| Modifier and Type | Class and Description | +| ----------------- | --------------------- | +| static class | [Delete](#delete)
The class that has a delete method to call the endpoint | +| interface | [DeleteCommonParamOperation](#deletecommonparamoperation)
The interface that has a deleteCommonParam method to call the endpoint | +| static class | [DeleteRequest](#deleterequest)
The final request inputs class | +| static class | [DeleteNullableRequest](#deletenullablerequest)
The initial request inputs class | +| static class | [Delete0RequestBuilder](#delete0requestbuilder)
A builder for the request input class | +| static class | [DeleteRequestBuilder](#deleterequestbuilder)
A builder for the request input class | + +## Delete +public static class Delete extends ApiClient.ApiClient1 implements DeleteOperation
+ +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.CommonparamsubdirDeleteHeaderParameters; +import org.openapijsonschematools.client.RootServerInfo; +import org.openapijsonschematools.client.paths.commonparamsubdir.delete.CommonparamsubdirDeletePathParameters; +import org.openapijsonschematools.client.servers.RootServer0; +import org.openapijsonschematools.client.servers.RootServer1; +import org.openapijsonschematools.client.servers.RootServer2; +import org.openapijsonschematools.client.paths.commonparamsubdir.delete.responses.CommonparamsubdirDeleteCode200Response; +import org.openapijsonschematools.client.servers.RootServerInfo; +import org.openapijsonschematools.client.paths.commonparamsubdir.CommonparamsubdirDelete; +import org.openapijsonschematools.client.paths.commonparamsubdir.delete.CommonparamsubdirDeleteResponses; + +import java.io.IOException; +import java.util.Arrays; +import java.util.List; +import java.util.Map; +import java.util.AbstractMap; + +// if you want to use a server that is not SERVER_0 pass it in here and change the ServerIndex input below +ApiConfiguration.ServerInfo serverInfo = new ApiConfiguration.ServerInfoBuilder() + .rootServerInfo( + new RootServerInfo.RootServerInfoBuilder() + .rootServer0(new RootServer0()) + .build() + ) + .build(); +ApiConfiguration.ServerIndexInfo serverIndexInfo = new ApiConfiguration.ServerIndexInfoBuilder() + .rootServerInfoServerIndex(RootServerInfo.ServerIndex.SERVER_0) + .build(); +Duration timeout = Duration.ofSeconds(1L); +Map> defaultHeaders = Map.of("User-Agent", List.of("OpenAPI-JSON-Schema-Generator/1.0.0/java")); +ApiConfiguration apiConfiguration = new ApiConfiguration( + serverInfo + serverIndexInfo, + timeout, + defaultHeaders +); +SchemaConfiguration schemaConfiguration = new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().build()); +CommonparamsubdirDelete.Delete apiClient = new CommonparamsubdirDelete.Delete(apiConfiguration, schemaConfiguration); + + +// Map validation +CommonparamsubdirDeletePathParameters.PathParametersMap pathParameters = + CommonparamsubdirDeletePathParameters.CommonparamsubdirDeletePathParameters1.validate( + new CommonparamsubdirDeletePathParameters.PathParametersMapBuilder() + .subDir("c") + + .build(), + schemaConfiguration +); + +var request = new CommonparamsubdirDelete.DeleteRequestBuilder() + .pathParameters(pathParameters) + .build(); + +CommonparamsubdirDeleteResponses.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; +} +CommonparamsubdirDeleteResponses.EndpointCommonparamsubdirDeleteCode200Response castResponse = (CommonparamsubdirDeleteResponses.EndpointCommonparamsubdirDeleteCode200Response) response; +``` +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| Delete(ApiConfiguration apiConfiguration, SchemaConfiguration schemaConfiguration)
Creates an instance | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| [CommonparamsubdirDeleteResponses.EndpointResponse](../../paths/commonparamsubdir/delete/CommonparamsubdirDeleteResponses.md#endpointresponse) | delete([DeleteRequest](#deleterequest) request) | + +## DeleteCommonParamOperation +public interface DeleteCommonParamOperation
+ +an interface that allows one to call the endpoint using a method named deleteCommonParam by the operationId + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| [CommonparamsubdirDeleteResponses.EndpointResponse](../../paths/commonparamsubdir/delete/CommonparamsubdirDeleteResponses.md#endpointresponse) | deleteCommonParam([DeleteRequest](#deleterequest) request) | + +## DeleteRequest +public static class DeleteRequest
+ +a class that stores the final request inputs + +### Field Summary +| Modifier and Type | Field and Description | +| ----------------- | --------------------- | +| [CommonparamsubdirDeletePathParameters.PathParametersMap](../../paths/commonparamsubdir/delete/CommonparamsubdirDeletePathParameters.md#pathparametersmap) | pathParameters | +| [CommonparamsubdirDeleteHeaderParameters.@Nullable HeaderParametersMap](../../paths/commonparamsubdir/delete/CommonparamsubdirDeleteHeaderParameters.md#headerparametersmap) | headerParameters
optional | +| [RootServerInfo.@Nullable ServerIndex](../../RootServerInfo.md#serverindex) | serverIndex
optional. Note: this will override the value in apiConfiguration | +| @Nullable Duration | timeout
optional. Note: this will override the value in apiConfiguration | + +## DeleteNullableRequest +public static class DeleteNullableRequest
+ +a class that stores the initial request inputs + +### Field Summary +| Modifier and Type | Field and Description | +| ----------------- | --------------------- | +| [CommonparamsubdirDeletePathParameters.@Nullable PathParametersMap](../../paths/commonparamsubdir/delete/CommonparamsubdirDeletePathParameters.md#pathparametersmap) | pathParameters | +| [CommonparamsubdirDeleteHeaderParameters.@Nullable HeaderParametersMap](../../paths/commonparamsubdir/delete/CommonparamsubdirDeleteHeaderParameters.md#headerparametersmap) | headerParameters | +| [RootServerInfo.@Nullable ServerIndex](../../RootServerInfo.md#serverindex) | serverIndex | +| @Nullable Duration | timeout | + +## Delete0RequestBuilder +public static class Delete0RequestBuilder
+ +a builder for request inputs + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| Delete0RequestBuilder(Delete0RequestBuilder instance)
Creates a builder that contains the passed instance | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| [DeleteRequest](#deleterequest) | build()
Returns the request input used to call an endpoint method | +| [Delete0RequestBuilder](#delete0requestbuilder) | headerParameters([CommonparamsubdirDeleteHeaderParametersHeaderParametersMap](../../paths/commonparamsubdir/delete/CommonparamsubdirDeleteHeaderParameters.md#headerparametersmap) headerParameters)
sets the optional property | +| [Delete0RequestBuilder](#delete0requestbuilder) | serverIndex([RootServerInfo.ServerIndex](../../RootServerInfo.md#serverindex) serverIndex)
sets the optional property. Note: this will override the value in apiConfiguration | +| [Delete0RequestBuilder](#delete0requestbuilder) | timeout(Duration timeout)
sets the optional property. Note: this will override the value in apiConfiguration | + +## DeleteRequestBuilder +public static class DeleteRequestBuilder
+ +a builder for request inputs + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| DeleteRequestBuilder()
Creates a builder that contains null for all parameters | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| [Delete0RequestBuilder](#delete0requestbuilder) | pathParameters([CommonparamsubdirDeletePathParametersPathParametersMap](../../paths/commonparamsubdir/delete/CommonparamsubdirDeletePathParameters.md#pathparametersmap) pathParameters)
sets the property | + +[[Back to top]](#top) [[Back to README]](../../../README.md) diff --git a/samples/client/petstore/kotlin/docs/paths/commonparamsubdir/CommonparamsubdirGet.md b/samples/client/petstore/kotlin/docs/paths/commonparamsubdir/CommonparamsubdirGet.md new file mode 100644 index 00000000000..a3ff40c51bc --- /dev/null +++ b/samples/client/petstore/kotlin/docs/paths/commonparamsubdir/CommonparamsubdirGet.md @@ -0,0 +1,189 @@ +# CommonparamsubdirGet + +public class CommonparamsubdirGet + +A class that contains necessary endpoint classes +- a class that calls the endpoint method using the http verb +- a class that calls the endpoint method using the operationId name +- class(es) to store the request inputs +- builder(s) to set the request input data + +## Nested Class Summary +| Modifier and Type | Class and Description | +| ----------------- | --------------------- | +| static class | [Get](#get)
The class that has a get method to call the endpoint | +| interface | [GetCommonParamOperation](#getcommonparamoperation)
The interface that has a getCommonParam method to call the endpoint | +| static class | [GetRequest](#getrequest)
The final request inputs class | +| static class | [GetNullableRequest](#getnullablerequest)
The initial request inputs class | +| static class | [Get0RequestBuilder](#get0requestbuilder)
A builder for the request input class | +| static class | [GetRequestBuilder](#getrequestbuilder)
A builder for the request input class | + +## Get +public static class Get extends ApiClient.ApiClient1 implements GetOperation
+ +a class that allows one to call the endpoint using a method named get + +### 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.get.CommonparamsubdirGetQueryParameters; +import org.openapijsonschematools.client.RootServerInfo; +import org.openapijsonschematools.client.paths.commonparamsubdir.get.CommonparamsubdirGetPathParameters; +import org.openapijsonschematools.client.servers.RootServer0; +import org.openapijsonschematools.client.servers.RootServer1; +import org.openapijsonschematools.client.servers.RootServer2; +import org.openapijsonschematools.client.paths.commonparamsubdir.get.responses.CommonparamsubdirGetCode200Response; +import org.openapijsonschematools.client.servers.RootServerInfo; +import org.openapijsonschematools.client.paths.commonparamsubdir.CommonparamsubdirGet; +import org.openapijsonschematools.client.paths.commonparamsubdir.get.CommonparamsubdirGetResponses; + +import java.io.IOException; +import java.util.Arrays; +import java.util.List; +import java.util.Map; +import java.util.AbstractMap; + +// if you want to use a server that is not SERVER_0 pass it in here and change the ServerIndex input below +ApiConfiguration.ServerInfo serverInfo = new ApiConfiguration.ServerInfoBuilder() + .rootServerInfo( + new RootServerInfo.RootServerInfoBuilder() + .rootServer0(new RootServer0()) + .build() + ) + .build(); +ApiConfiguration.ServerIndexInfo serverIndexInfo = new ApiConfiguration.ServerIndexInfoBuilder() + .rootServerInfoServerIndex(RootServerInfo.ServerIndex.SERVER_0) + .build(); +Duration timeout = Duration.ofSeconds(1L); +Map> defaultHeaders = Map.of("User-Agent", List.of("OpenAPI-JSON-Schema-Generator/1.0.0/java")); +ApiConfiguration apiConfiguration = new ApiConfiguration( + serverInfo + serverIndexInfo, + timeout, + defaultHeaders +); +SchemaConfiguration schemaConfiguration = new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().build()); +CommonparamsubdirGet.Get apiClient = new CommonparamsubdirGet.Get(apiConfiguration, schemaConfiguration); + + +// Map validation +CommonparamsubdirGetPathParameters.PathParametersMap pathParameters = + CommonparamsubdirGetPathParameters.CommonparamsubdirGetPathParameters1.validate( + new CommonparamsubdirGetPathParameters.PathParametersMapBuilder() + .subDir("a") + + .build(), + schemaConfiguration +); + +var request = new CommonparamsubdirGet.GetRequestBuilder() + .pathParameters(pathParameters) + .build(); + +CommonparamsubdirGetResponses.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; +} +CommonparamsubdirGetResponses.EndpointCommonparamsubdirGetCode200Response castResponse = (CommonparamsubdirGetResponses.EndpointCommonparamsubdirGetCode200Response) response; +``` +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| Get(ApiConfiguration apiConfiguration, SchemaConfiguration schemaConfiguration)
Creates an instance | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| [CommonparamsubdirGetResponses.EndpointResponse](../../paths/commonparamsubdir/get/CommonparamsubdirGetResponses.md#endpointresponse) | get([GetRequest](#getrequest) request) | + +## GetCommonParamOperation +public interface GetCommonParamOperation
+ +an interface that allows one to call the endpoint using a method named getCommonParam by the operationId + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| [CommonparamsubdirGetResponses.EndpointResponse](../../paths/commonparamsubdir/get/CommonparamsubdirGetResponses.md#endpointresponse) | getCommonParam([GetRequest](#getrequest) request) | + +## GetRequest +public static class GetRequest
+ +a class that stores the final request inputs + +### Field Summary +| Modifier and Type | Field and Description | +| ----------------- | --------------------- | +| [CommonparamsubdirGetPathParameters.PathParametersMap](../../paths/commonparamsubdir/get/CommonparamsubdirGetPathParameters.md#pathparametersmap) | pathParameters | +| [CommonparamsubdirGetQueryParameters.@Nullable QueryParametersMap](../../paths/commonparamsubdir/get/CommonparamsubdirGetQueryParameters.md#queryparametersmap) | queryParameters
optional | +| [RootServerInfo.@Nullable ServerIndex](../../RootServerInfo.md#serverindex) | serverIndex
optional. Note: this will override the value in apiConfiguration | +| @Nullable Duration | timeout
optional. Note: this will override the value in apiConfiguration | + +## GetNullableRequest +public static class GetNullableRequest
+ +a class that stores the initial request inputs + +### Field Summary +| Modifier and Type | Field and Description | +| ----------------- | --------------------- | +| [CommonparamsubdirGetPathParameters.@Nullable PathParametersMap](../../paths/commonparamsubdir/get/CommonparamsubdirGetPathParameters.md#pathparametersmap) | pathParameters | +| [CommonparamsubdirGetQueryParameters.@Nullable QueryParametersMap](../../paths/commonparamsubdir/get/CommonparamsubdirGetQueryParameters.md#queryparametersmap) | queryParameters | +| [RootServerInfo.@Nullable ServerIndex](../../RootServerInfo.md#serverindex) | serverIndex | +| @Nullable Duration | timeout | + +## Get0RequestBuilder +public static class Get0RequestBuilder
+ +a builder for request inputs + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| Get0RequestBuilder(Get0RequestBuilder instance)
Creates a builder that contains the passed instance | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| [GetRequest](#getrequest) | build()
Returns the request input used to call an endpoint method | +| [Get0RequestBuilder](#get0requestbuilder) | queryParameters([CommonparamsubdirGetQueryParametersQueryParametersMap](../../paths/commonparamsubdir/get/CommonparamsubdirGetQueryParameters.md#queryparametersmap) queryParameters)
sets the optional property | +| [Get0RequestBuilder](#get0requestbuilder) | serverIndex([RootServerInfo.ServerIndex](../../RootServerInfo.md#serverindex) serverIndex)
sets the optional property. Note: this will override the value in apiConfiguration | +| [Get0RequestBuilder](#get0requestbuilder) | timeout(Duration timeout)
sets the optional property. Note: this will override the value in apiConfiguration | + +## GetRequestBuilder +public static class GetRequestBuilder
+ +a builder for request inputs + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| GetRequestBuilder()
Creates a builder that contains null for all parameters | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| [Get0RequestBuilder](#get0requestbuilder) | pathParameters([CommonparamsubdirGetPathParametersPathParametersMap](../../paths/commonparamsubdir/get/CommonparamsubdirGetPathParameters.md#pathparametersmap) pathParameters)
sets the property | + +[[Back to top]](#top) [[Back to README]](../../../README.md) diff --git a/samples/client/petstore/kotlin/docs/paths/commonparamsubdir/CommonparamsubdirPost.md b/samples/client/petstore/kotlin/docs/paths/commonparamsubdir/CommonparamsubdirPost.md new file mode 100644 index 00000000000..f55668cf6c5 --- /dev/null +++ b/samples/client/petstore/kotlin/docs/paths/commonparamsubdir/CommonparamsubdirPost.md @@ -0,0 +1,189 @@ +# CommonparamsubdirPost + +public class CommonparamsubdirPost + +A class that contains necessary endpoint classes +- a class that calls the endpoint method using the http verb +- a class that calls the endpoint method using the operationId name +- class(es) to store the request inputs +- builder(s) to set the request input data + +## Nested Class Summary +| Modifier and Type | Class and Description | +| ----------------- | --------------------- | +| static class | [Post](#post)
The class that has a post method to call the endpoint | +| interface | [PostCommonParamOperation](#postcommonparamoperation)
The interface that has a postCommonParam method to call the endpoint | +| static class | [PostRequest](#postrequest)
The final request inputs class | +| static class | [PostNullableRequest](#postnullablerequest)
The initial request inputs class | +| static class | [Post0RequestBuilder](#post0requestbuilder)
A builder for the request input class | +| static class | [PostRequestBuilder](#postrequestbuilder)
A builder for the request input class | + +## Post +public static class Post 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.commonparamsubdir.post.CommonparamsubdirPostHeaderParameters; +import org.openapijsonschematools.client.RootServerInfo; +import org.openapijsonschematools.client.paths.commonparamsubdir.post.CommonparamsubdirPostPathParameters; +import org.openapijsonschematools.client.servers.RootServer0; +import org.openapijsonschematools.client.servers.RootServer1; +import org.openapijsonschematools.client.servers.RootServer2; +import org.openapijsonschematools.client.paths.commonparamsubdir.post.responses.CommonparamsubdirPostCode200Response; +import org.openapijsonschematools.client.servers.RootServerInfo; +import org.openapijsonschematools.client.paths.commonparamsubdir.CommonparamsubdirPost; +import org.openapijsonschematools.client.paths.commonparamsubdir.post.CommonparamsubdirPostResponses; + +import java.io.IOException; +import java.util.Arrays; +import java.util.List; +import java.util.Map; +import java.util.AbstractMap; + +// if you want to use a server that is not SERVER_0 pass it in here and change the ServerIndex input below +ApiConfiguration.ServerInfo serverInfo = new ApiConfiguration.ServerInfoBuilder() + .rootServerInfo( + new RootServerInfo.RootServerInfoBuilder() + .rootServer0(new RootServer0()) + .build() + ) + .build(); +ApiConfiguration.ServerIndexInfo serverIndexInfo = new ApiConfiguration.ServerIndexInfoBuilder() + .rootServerInfoServerIndex(RootServerInfo.ServerIndex.SERVER_0) + .build(); +Duration timeout = Duration.ofSeconds(1L); +Map> defaultHeaders = Map.of("User-Agent", List.of("OpenAPI-JSON-Schema-Generator/1.0.0/java")); +ApiConfiguration apiConfiguration = new ApiConfiguration( + serverInfo + serverIndexInfo, + timeout, + defaultHeaders +); +SchemaConfiguration schemaConfiguration = new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().build()); +CommonparamsubdirPost.Post apiClient = new CommonparamsubdirPost.Post(apiConfiguration, schemaConfiguration); + + +// Map validation +CommonparamsubdirPostPathParameters.PathParametersMap pathParameters = + CommonparamsubdirPostPathParameters.CommonparamsubdirPostPathParameters1.validate( + new CommonparamsubdirPostPathParameters.PathParametersMapBuilder() + .subDir("a") + + .build(), + schemaConfiguration +); + +var request = new CommonparamsubdirPost.PostRequestBuilder() + .pathParameters(pathParameters) + .build(); + +CommonparamsubdirPostResponses.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; +} +CommonparamsubdirPostResponses.EndpointCommonparamsubdirPostCode200Response castResponse = (CommonparamsubdirPostResponses.EndpointCommonparamsubdirPostCode200Response) response; +``` +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| Post(ApiConfiguration apiConfiguration, SchemaConfiguration schemaConfiguration)
Creates an instance | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| [CommonparamsubdirPostResponses.EndpointResponse](../../paths/commonparamsubdir/post/CommonparamsubdirPostResponses.md#endpointresponse) | post([PostRequest](#postrequest) request) | + +## PostCommonParamOperation +public interface PostCommonParamOperation
+ +an interface that allows one to call the endpoint using a method named postCommonParam by the operationId + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| [CommonparamsubdirPostResponses.EndpointResponse](../../paths/commonparamsubdir/post/CommonparamsubdirPostResponses.md#endpointresponse) | postCommonParam([PostRequest](#postrequest) request) | + +## PostRequest +public static class PostRequest
+ +a class that stores the final request inputs + +### Field Summary +| Modifier and Type | Field and Description | +| ----------------- | --------------------- | +| [CommonparamsubdirPostPathParameters.PathParametersMap](../../paths/commonparamsubdir/post/CommonparamsubdirPostPathParameters.md#pathparametersmap) | pathParameters | +| [CommonparamsubdirPostHeaderParameters.@Nullable HeaderParametersMap](../../paths/commonparamsubdir/post/CommonparamsubdirPostHeaderParameters.md#headerparametersmap) | headerParameters
optional | +| [RootServerInfo.@Nullable ServerIndex](../../RootServerInfo.md#serverindex) | serverIndex
optional. Note: this will override the value in apiConfiguration | +| @Nullable Duration | timeout
optional. Note: this will override the value in apiConfiguration | + +## PostNullableRequest +public static class PostNullableRequest
+ +a class that stores the initial request inputs + +### Field Summary +| Modifier and Type | Field and Description | +| ----------------- | --------------------- | +| [CommonparamsubdirPostPathParameters.@Nullable PathParametersMap](../../paths/commonparamsubdir/post/CommonparamsubdirPostPathParameters.md#pathparametersmap) | pathParameters | +| [CommonparamsubdirPostHeaderParameters.@Nullable HeaderParametersMap](../../paths/commonparamsubdir/post/CommonparamsubdirPostHeaderParameters.md#headerparametersmap) | headerParameters | +| [RootServerInfo.@Nullable ServerIndex](../../RootServerInfo.md#serverindex) | serverIndex | +| @Nullable Duration | timeout | + +## Post0RequestBuilder +public static class Post0RequestBuilder
+ +a builder for request inputs + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| Post0RequestBuilder(Post0RequestBuilder instance)
Creates a builder that contains the passed instance | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| [PostRequest](#postrequest) | build()
Returns the request input used to call an endpoint method | +| [Post0RequestBuilder](#post0requestbuilder) | headerParameters([CommonparamsubdirPostHeaderParametersHeaderParametersMap](../../paths/commonparamsubdir/post/CommonparamsubdirPostHeaderParameters.md#headerparametersmap) headerParameters)
sets the optional property | +| [Post0RequestBuilder](#post0requestbuilder) | serverIndex([RootServerInfo.ServerIndex](../../RootServerInfo.md#serverindex) serverIndex)
sets the optional property. Note: this will override the value in apiConfiguration | +| [Post0RequestBuilder](#post0requestbuilder) | timeout(Duration timeout)
sets the optional property. Note: this will override the value in apiConfiguration | + +## PostRequestBuilder +public static class PostRequestBuilder
+ +a builder for request inputs + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| PostRequestBuilder()
Creates a builder that contains null for all parameters | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| [Post0RequestBuilder](#post0requestbuilder) | pathParameters([CommonparamsubdirPostPathParametersPathParametersMap](../../paths/commonparamsubdir/post/CommonparamsubdirPostPathParameters.md#pathparametersmap) pathParameters)
sets the property | + +[[Back to top]](#top) [[Back to README]](../../../README.md) diff --git a/samples/client/petstore/kotlin/docs/paths/commonparamsubdir/delete/CommonparamsubdirDeleteHeaderParameters.md b/samples/client/petstore/kotlin/docs/paths/commonparamsubdir/delete/CommonparamsubdirDeleteHeaderParameters.md new file mode 100644 index 00000000000..03ce1e35104 --- /dev/null +++ b/samples/client/petstore/kotlin/docs/paths/commonparamsubdir/delete/CommonparamsubdirDeleteHeaderParameters.md @@ -0,0 +1,252 @@ +# CommonparamsubdirDeleteHeaderParameters +public class CommonparamsubdirDeleteHeaderParameters
+ +A class that contains necessary nested +- schema classes (which validate payloads), extends JsonSchema +- sealed interfaces which store validated payloads, java version of a sum type +- boxed classes which store validated payloads, sealed permits class implementations +- classes to store validated map payloads, extends FrozenMap +- classes to build inputs for map payloads + +## Nested Class Summary +| Modifier and Type | Class and Description | +| ----------------- | ---------------------- | +| sealed interface | [CommonparamsubdirDeleteHeaderParameters.CommonparamsubdirDeleteHeaderParameters1Boxed](#commonparamsubdirdeleteheaderparameters1boxed)
sealed interface for validated payloads | +| record | [CommonparamsubdirDeleteHeaderParameters.CommonparamsubdirDeleteHeaderParameters1BoxedMap](#commonparamsubdirdeleteheaderparameters1boxedmap)
boxed class to store validated Map payloads | +| static class | [CommonparamsubdirDeleteHeaderParameters.CommonparamsubdirDeleteHeaderParameters1](#commonparamsubdirdeleteheaderparameters1)
schema class | +| static class | [CommonparamsubdirDeleteHeaderParameters.HeaderParametersMapBuilder](#headerparametersmapbuilder)
builder for Map payloads | +| static class | [CommonparamsubdirDeleteHeaderParameters.HeaderParametersMap](#headerparametersmap)
output class for Map payloads | +| sealed interface | [CommonparamsubdirDeleteHeaderParameters.AdditionalPropertiesBoxed](#additionalpropertiesboxed)
sealed interface for validated payloads | +| record | [CommonparamsubdirDeleteHeaderParameters.AdditionalPropertiesBoxedVoid](#additionalpropertiesboxedvoid)
boxed class to store validated null payloads | +| record | [CommonparamsubdirDeleteHeaderParameters.AdditionalPropertiesBoxedBoolean](#additionalpropertiesboxedboolean)
boxed class to store validated boolean payloads | +| record | [CommonparamsubdirDeleteHeaderParameters.AdditionalPropertiesBoxedNumber](#additionalpropertiesboxednumber)
boxed class to store validated Number payloads | +| record | [CommonparamsubdirDeleteHeaderParameters.AdditionalPropertiesBoxedString](#additionalpropertiesboxedstring)
boxed class to store validated String payloads | +| record | [CommonparamsubdirDeleteHeaderParameters.AdditionalPropertiesBoxedList](#additionalpropertiesboxedlist)
boxed class to store validated List payloads | +| record | [CommonparamsubdirDeleteHeaderParameters.AdditionalPropertiesBoxedMap](#additionalpropertiesboxedmap)
boxed class to store validated Map payloads | +| static class | [CommonparamsubdirDeleteHeaderParameters.AdditionalProperties](#additionalproperties)
schema class | + +## CommonparamsubdirDeleteHeaderParameters1Boxed +public sealed interface CommonparamsubdirDeleteHeaderParameters1Boxed
+permits
+[CommonparamsubdirDeleteHeaderParameters1BoxedMap](#commonparamsubdirdeleteheaderparameters1boxedmap) + +sealed interface that stores validated payloads using boxed classes + +## CommonparamsubdirDeleteHeaderParameters1BoxedMap +public record CommonparamsubdirDeleteHeaderParameters1BoxedMap
+implements [CommonparamsubdirDeleteHeaderParameters1Boxed](#commonparamsubdirdeleteheaderparameters1boxed) + +record that stores validated Map payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| CommonparamsubdirDeleteHeaderParameters1BoxedMap([HeaderParametersMap](#headerparametersmap) data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| [HeaderParametersMap](#headerparametersmap) | data()
validated payload | +| @Nullable Object | getData()
validated payload | + +## CommonparamsubdirDeleteHeaderParameters1 +public static class CommonparamsubdirDeleteHeaderParameters1
+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.commonparamsubdir.delete.CommonparamsubdirDeleteHeaderParameters; + +import java.util.Arrays; +import java.util.List; +import java.util.AbstractMap; + +static final SchemaConfiguration configuration = new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().build()); + +// Map validation +CommonparamsubdirDeleteHeaderParameters.HeaderParametersMap validatedPayload = + CommonparamsubdirDeleteHeaderParameters.CommonparamsubdirDeleteHeaderParameters1.validate( + new CommonparamsubdirDeleteHeaderParameters.HeaderParametersMapBuilder() + .someHeader("a") + + .build(), + configuration +); +``` + +### Field Summary +| Modifier and Type | Field and Description | +| ----------------- | ---------------------- | +| Set> | type = Set.of(Map.class) | +| Map> | properties = Map.ofEntries(
    new PropertyEntry("someHeader", [Schema0.Schema01.class](../../../paths/commonparamsubdir/delete/parameters/parameter0/Schema0.md#schema01))
)
| +| Class | additionalProperties = [AdditionalProperties.class](#additionalproperties) | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| [HeaderParametersMap](#headerparametersmap) | validate([Map<?, ?>](#headerparametersmapbuilder) arg, SchemaConfiguration configuration) | +| [CommonparamsubdirDeleteHeaderParameters1BoxedMap](#commonparamsubdirdeleteheaderparameters1boxedmap) | validateAndBox([Map<?, ?>](#headerparametersmapbuilder) arg, SchemaConfiguration configuration) | +| [CommonparamsubdirDeleteHeaderParameters1Boxed](#commonparamsubdirdeleteheaderparameters1boxed) | validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) | +| @Nullable Object | validate(@Nullable Object arg, SchemaConfiguration configuration) | + +## HeaderParametersMapBuilder +public class HeaderParametersMapBuilder
+builder for `Map` + +A class that builds the Map input type + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| HeaderParametersMapBuilder()
Creates a builder that contains an empty map | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| Map | build()
Returns map input that should be used with Schema.validate | +| [HeaderParametersMapBuilder](#headerparametersmapbuilder) | someHeader(String value) | + +## HeaderParametersMap +public static class HeaderParametersMap
+extends FrozenMap + +A class to store validated Map payloads + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| static [HeaderParametersMap](#headerparametersmap) | of([Map](#headerparametersmapbuilder) arg, SchemaConfiguration configuration) | +| String | someHeader()
[optional] | + +## 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(Nothing? data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| Nothing? | 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/kotlin/docs/paths/commonparamsubdir/delete/CommonparamsubdirDeletePathParameters.md b/samples/client/petstore/kotlin/docs/paths/commonparamsubdir/delete/CommonparamsubdirDeletePathParameters.md new file mode 100644 index 00000000000..0c0dd18e40d --- /dev/null +++ b/samples/client/petstore/kotlin/docs/paths/commonparamsubdir/delete/CommonparamsubdirDeletePathParameters.md @@ -0,0 +1,269 @@ +# CommonparamsubdirDeletePathParameters +public class CommonparamsubdirDeletePathParameters
+ +A class that contains necessary nested +- schema classes (which validate payloads), extends JsonSchema +- sealed interfaces which store validated payloads, java version of a sum type +- boxed classes which store validated payloads, sealed permits class implementations +- classes to store validated map payloads, extends FrozenMap +- classes to build inputs for map payloads + +## Nested Class Summary +| Modifier and Type | Class and Description | +| ----------------- | ---------------------- | +| sealed interface | [CommonparamsubdirDeletePathParameters.CommonparamsubdirDeletePathParameters1Boxed](#commonparamsubdirdeletepathparameters1boxed)
sealed interface for validated payloads | +| record | [CommonparamsubdirDeletePathParameters.CommonparamsubdirDeletePathParameters1BoxedMap](#commonparamsubdirdeletepathparameters1boxedmap)
boxed class to store validated Map payloads | +| static class | [CommonparamsubdirDeletePathParameters.CommonparamsubdirDeletePathParameters1](#commonparamsubdirdeletepathparameters1)
schema class | +| static class | [CommonparamsubdirDeletePathParameters.PathParametersMapBuilder](#pathparametersmapbuilder)
builder for Map payloads | +| static class | [CommonparamsubdirDeletePathParameters.PathParametersMap](#pathparametersmap)
output class for Map payloads | +| sealed interface | [CommonparamsubdirDeletePathParameters.AdditionalPropertiesBoxed](#additionalpropertiesboxed)
sealed interface for validated payloads | +| record | [CommonparamsubdirDeletePathParameters.AdditionalPropertiesBoxedVoid](#additionalpropertiesboxedvoid)
boxed class to store validated null payloads | +| record | [CommonparamsubdirDeletePathParameters.AdditionalPropertiesBoxedBoolean](#additionalpropertiesboxedboolean)
boxed class to store validated boolean payloads | +| record | [CommonparamsubdirDeletePathParameters.AdditionalPropertiesBoxedNumber](#additionalpropertiesboxednumber)
boxed class to store validated Number payloads | +| record | [CommonparamsubdirDeletePathParameters.AdditionalPropertiesBoxedString](#additionalpropertiesboxedstring)
boxed class to store validated String payloads | +| record | [CommonparamsubdirDeletePathParameters.AdditionalPropertiesBoxedList](#additionalpropertiesboxedlist)
boxed class to store validated List payloads | +| record | [CommonparamsubdirDeletePathParameters.AdditionalPropertiesBoxedMap](#additionalpropertiesboxedmap)
boxed class to store validated Map payloads | +| static class | [CommonparamsubdirDeletePathParameters.AdditionalProperties](#additionalproperties)
schema class | + +## CommonparamsubdirDeletePathParameters1Boxed +public sealed interface CommonparamsubdirDeletePathParameters1Boxed
+permits
+[CommonparamsubdirDeletePathParameters1BoxedMap](#commonparamsubdirdeletepathparameters1boxedmap) + +sealed interface that stores validated payloads using boxed classes + +## CommonparamsubdirDeletePathParameters1BoxedMap +public record CommonparamsubdirDeletePathParameters1BoxedMap
+implements [CommonparamsubdirDeletePathParameters1Boxed](#commonparamsubdirdeletepathparameters1boxed) + +record that stores validated Map payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| CommonparamsubdirDeletePathParameters1BoxedMap([PathParametersMap](#pathparametersmap) data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| [PathParametersMap](#pathparametersmap) | data()
validated payload | +| @Nullable Object | getData()
validated payload | + +## CommonparamsubdirDeletePathParameters1 +public static class CommonparamsubdirDeletePathParameters1
+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.commonparamsubdir.delete.CommonparamsubdirDeletePathParameters; + +import java.util.Arrays; +import java.util.List; +import java.util.AbstractMap; + +static final SchemaConfiguration configuration = new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().build()); + +// Map validation +CommonparamsubdirDeletePathParameters.PathParametersMap validatedPayload = + CommonparamsubdirDeletePathParameters.CommonparamsubdirDeletePathParameters1.validate( + new CommonparamsubdirDeletePathParameters.PathParametersMapBuilder() + .subDir("c") + + .build(), + configuration +); +``` + +### Field Summary +| Modifier and Type | Field and Description | +| ----------------- | ---------------------- | +| Set> | type = Set.of(Map.class) | +| Map> | properties = Map.ofEntries(
    new PropertyEntry("subDir", [Schema1.Schema11.class](../../../paths/commonparamsubdir/delete/parameters/parameter1/Schema1.md#schema11))
)
| +| Set | required = Set.of(
    "subDir"
)
| +| Class | additionalProperties = [AdditionalProperties.class](#additionalproperties) | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| [PathParametersMap](#pathparametersmap) | validate([Map<?, ?>](#pathparametersmapbuilder) arg, SchemaConfiguration configuration) | +| [CommonparamsubdirDeletePathParameters1BoxedMap](#commonparamsubdirdeletepathparameters1boxedmap) | validateAndBox([Map<?, ?>](#pathparametersmapbuilder) arg, SchemaConfiguration configuration) | +| [CommonparamsubdirDeletePathParameters1Boxed](#commonparamsubdirdeletepathparameters1boxed) | validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) | +| @Nullable Object | validate(@Nullable Object arg, SchemaConfiguration configuration) | + +## PathParametersMap0Builder +public class PathParametersMap0Builder
+builder for `Map` + +A class that builds the Map input type + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| PathParametersMap0Builder(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 | + +## PathParametersMapBuilder +public class PathParametersMapBuilder
+builder for `Map` + +A class that builds the Map input type + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| PathParametersMapBuilder()
Creates a builder that contains an empty map | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| [PathParametersMap0Builder](#pathparametersmap0builder) | subDir(String value) | +| [PathParametersMap0Builder](#pathparametersmap0builder) | subDir([Schema1.StringSchemaEnums1](../../../paths/commonparamsubdir/delete/parameters/parameter1/Schema1.md#stringschemaenums1) value) | + +## PathParametersMap +public static class PathParametersMap
+extends FrozenMap + +A class to store validated Map payloads + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| static [PathParametersMap](#pathparametersmap) | of([Map](#pathparametersmapbuilder) arg, SchemaConfiguration configuration) | +| String | subDir()
| + +## 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(Nothing? data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| Nothing? | 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/kotlin/docs/paths/commonparamsubdir/delete/CommonparamsubdirDeleteResponses.md b/samples/client/petstore/kotlin/docs/paths/commonparamsubdir/delete/CommonparamsubdirDeleteResponses.md new file mode 100644 index 00000000000..8cfcc7816e7 --- /dev/null +++ b/samples/client/petstore/kotlin/docs/paths/commonparamsubdir/delete/CommonparamsubdirDeleteResponses.md @@ -0,0 +1,29 @@ +# CommonparamsubdirDeleteResponses + +public class CommonparamsubdirDeleteResponses + +A class that contains necessary responses classes +- a sealed interface, EndpointResponse, that stores endpoint responses +- records for each endpoint response + +## Nested Class Summary +| Modifier and Type | Class and Description | +| ----------------- | --------------------- | +| sealed interface | [EndpointResponse](#endpointresponse)
stores the endpoint responses | +| record | [EndpointCommonparamsubdirDeleteCode200Response](#endpointcommonparamsubdirdeletecode200response)
the response for 200 | + +## EndpointResponse +public sealed interface EndpointResponse permits
+[EndpointCommonparamsubdirDeleteCode200Response](#endpointcommonparamsubdirdeletecode200response) + +a sealed interface that stores endpoint responses + +## EndpointCommonparamsubdirDeleteCode200Response +public record EndpointCommonparamsubdirDeleteCode200Response( + HttpResponse response, + Nothing? body, + Nothing? headers +) implements EndpointResponse, ApiResponse
+ +a class that stores an endpoint response + diff --git a/samples/client/petstore/kotlin/docs/paths/commonparamsubdir/delete/parameters/parameter0/Schema0.md b/samples/client/petstore/kotlin/docs/paths/commonparamsubdir/delete/parameters/parameter0/Schema0.md new file mode 100644 index 00000000000..9ff90e0bc35 --- /dev/null +++ b/samples/client/petstore/kotlin/docs/paths/commonparamsubdir/delete/parameters/parameter0/Schema0.md @@ -0,0 +1,49 @@ +# Schema0 +public class Schema0
+ +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 + +## Nested Class Summary +| Modifier and Type | Class and Description | +| ----------------- | ---------------------- | +| sealed interface | [Schema0.Schema01Boxed](#schema01boxed)
sealed interface for validated payloads | +| record | [Schema0.Schema01BoxedString](#schema01boxedstring)
boxed class to store validated String payloads | +| static class | [Schema0.Schema01](#schema01)
schema class | + +## Schema01Boxed +public sealed interface Schema01Boxed
+permits
+[Schema01BoxedString](#schema01boxedstring) + +sealed interface that stores validated payloads using boxed classes + +## Schema01BoxedString +public record Schema01BoxedString
+implements [Schema01Boxed](#schema01boxed) + +record that stores validated String payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| Schema01BoxedString(String data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| String | data()
validated payload | +| @Nullable Object | getData()
validated payload | + +## Schema01 +public static class Schema01
+extends StringJsonSchema.StringJsonSchema1 + +A schema class that validates payloads + +| Methods Inherited from class org.openapijsonschematools.client.schemas.StringJsonSchema.StringJsonSchema1 | +| ------------------------------------------------------------------ | +| validate | +| validateAndBox | diff --git a/samples/client/petstore/kotlin/docs/paths/commonparamsubdir/delete/parameters/parameter1/Schema1.md b/samples/client/petstore/kotlin/docs/paths/commonparamsubdir/delete/parameters/parameter1/Schema1.md new file mode 100644 index 00000000000..ef5c82182ba --- /dev/null +++ b/samples/client/petstore/kotlin/docs/paths/commonparamsubdir/delete/parameters/parameter1/Schema1.md @@ -0,0 +1,96 @@ +# Schema1 +public class Schema1
+ +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 +- enum classes + +## Nested Class Summary +| Modifier and Type | Class and Description | +| ----------------- | ---------------------- | +| sealed interface | [Schema1.Schema11Boxed](#schema11boxed)
sealed interface for validated payloads | +| record | [Schema1.Schema11BoxedString](#schema11boxedstring)
boxed class to store validated String payloads | +| static class | [Schema1.Schema11](#schema11)
schema class | +| enum | [Schema1.StringSchemaEnums1](#stringschemaenums1)
String enum | + +## Schema11Boxed +public sealed interface Schema11Boxed
+permits
+[Schema11BoxedString](#schema11boxedstring) + +sealed interface that stores validated payloads using boxed classes + +## Schema11BoxedString +public record Schema11BoxedString
+implements [Schema11Boxed](#schema11boxed) + +record that stores validated String payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| Schema11BoxedString(String data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| String | data()
validated payload | +| @Nullable Object | getData()
validated payload | + +## Schema11 +public static class Schema11
+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.commonparamsubdir.delete.parameters.parameter1.Schema1; + +import java.util.Arrays; +import java.util.List; +import java.util.AbstractMap; + +static final SchemaConfiguration configuration = new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().build()); + +// String validation +String validatedPayload = Schema1.Schema11.validate( + "c", + configuration +); +``` + +### Field Summary +| Modifier and Type | Field and Description | +| ----------------- | ---------------------- | +| Set> | type = Set.of(
    String.class
)
| +| Set | enumValues = SetMaker.makeSet(
    "c",
    "d"
)
| + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| String | validate(String arg, SchemaConfiguration configuration) | +| String | validate([StringSchemaEnums1](#stringschemaenums1) arg, SchemaConfiguration configuration) | +| [Schema11BoxedString](#schema11boxedstring) | validateAndBox(String arg, SchemaConfiguration configuration) | +| [Schema11Boxed](#schema11boxed) | validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) | +| @Nullable Object | validate(@Nullable Object arg, SchemaConfiguration configuration) | + +## StringSchemaEnums1 +public enum StringSchemaEnums1
+extends `Enum` + +A class that stores String enum values + +### Enum Constant Summary +| Enum Constant | Description | +| ------------- | ----------- | +| C | value = "c" | +| D | value = "d" | diff --git a/samples/client/petstore/kotlin/docs/paths/commonparamsubdir/delete/responses/CommonparamsubdirDeleteCode200Response.md b/samples/client/petstore/kotlin/docs/paths/commonparamsubdir/delete/responses/CommonparamsubdirDeleteCode200Response.md new file mode 100644 index 00000000000..7781a6df85d --- /dev/null +++ b/samples/client/petstore/kotlin/docs/paths/commonparamsubdir/delete/responses/CommonparamsubdirDeleteCode200Response.md @@ -0,0 +1,17 @@ +# CommonparamsubdirDeleteCode200Response + +public class CommonparamsubdirDeleteCode200Response extends [SuccessDescriptionOnly](../../components/responses/SuccessDescriptionOnly.md) + +A class (extended from the $ref class) that contains necessary nested response classes +- a class that extends ResponseDeserializer and is used to deserialize responses + +## Nested Class Summary +| Modifier and Type | Class and Description | +| ----------------- | --------------------- | +| static class | [CommonparamsubdirDeleteCode200Response.CommonparamsubdirDeleteCode200Response1](#commonparamsubdirdeletecode200response1)
class that deserializes responses | + +## CommonparamsubdirDeleteCode200Response1 +public static class CommonparamsubdirDeleteCode200Response1 extends [SuccessDescriptionOnly1](../../components/responses/SuccessDescriptionOnly.md#successdescriptiononly1)
+ +a class that deserializes responses, extended from the $ref class + diff --git a/samples/client/petstore/kotlin/docs/paths/commonparamsubdir/get/CommonparamsubdirGetPathParameters.md b/samples/client/petstore/kotlin/docs/paths/commonparamsubdir/get/CommonparamsubdirGetPathParameters.md new file mode 100644 index 00000000000..dd6790c7029 --- /dev/null +++ b/samples/client/petstore/kotlin/docs/paths/commonparamsubdir/get/CommonparamsubdirGetPathParameters.md @@ -0,0 +1,269 @@ +# CommonparamsubdirGetPathParameters +public class CommonparamsubdirGetPathParameters
+ +A class that contains necessary nested +- schema classes (which validate payloads), extends JsonSchema +- sealed interfaces which store validated payloads, java version of a sum type +- boxed classes which store validated payloads, sealed permits class implementations +- classes to store validated map payloads, extends FrozenMap +- classes to build inputs for map payloads + +## Nested Class Summary +| Modifier and Type | Class and Description | +| ----------------- | ---------------------- | +| sealed interface | [CommonparamsubdirGetPathParameters.CommonparamsubdirGetPathParameters1Boxed](#commonparamsubdirgetpathparameters1boxed)
sealed interface for validated payloads | +| record | [CommonparamsubdirGetPathParameters.CommonparamsubdirGetPathParameters1BoxedMap](#commonparamsubdirgetpathparameters1boxedmap)
boxed class to store validated Map payloads | +| static class | [CommonparamsubdirGetPathParameters.CommonparamsubdirGetPathParameters1](#commonparamsubdirgetpathparameters1)
schema class | +| static class | [CommonparamsubdirGetPathParameters.PathParametersMapBuilder](#pathparametersmapbuilder)
builder for Map payloads | +| static class | [CommonparamsubdirGetPathParameters.PathParametersMap](#pathparametersmap)
output class for Map payloads | +| sealed interface | [CommonparamsubdirGetPathParameters.AdditionalPropertiesBoxed](#additionalpropertiesboxed)
sealed interface for validated payloads | +| record | [CommonparamsubdirGetPathParameters.AdditionalPropertiesBoxedVoid](#additionalpropertiesboxedvoid)
boxed class to store validated null payloads | +| record | [CommonparamsubdirGetPathParameters.AdditionalPropertiesBoxedBoolean](#additionalpropertiesboxedboolean)
boxed class to store validated boolean payloads | +| record | [CommonparamsubdirGetPathParameters.AdditionalPropertiesBoxedNumber](#additionalpropertiesboxednumber)
boxed class to store validated Number payloads | +| record | [CommonparamsubdirGetPathParameters.AdditionalPropertiesBoxedString](#additionalpropertiesboxedstring)
boxed class to store validated String payloads | +| record | [CommonparamsubdirGetPathParameters.AdditionalPropertiesBoxedList](#additionalpropertiesboxedlist)
boxed class to store validated List payloads | +| record | [CommonparamsubdirGetPathParameters.AdditionalPropertiesBoxedMap](#additionalpropertiesboxedmap)
boxed class to store validated Map payloads | +| static class | [CommonparamsubdirGetPathParameters.AdditionalProperties](#additionalproperties)
schema class | + +## CommonparamsubdirGetPathParameters1Boxed +public sealed interface CommonparamsubdirGetPathParameters1Boxed
+permits
+[CommonparamsubdirGetPathParameters1BoxedMap](#commonparamsubdirgetpathparameters1boxedmap) + +sealed interface that stores validated payloads using boxed classes + +## CommonparamsubdirGetPathParameters1BoxedMap +public record CommonparamsubdirGetPathParameters1BoxedMap
+implements [CommonparamsubdirGetPathParameters1Boxed](#commonparamsubdirgetpathparameters1boxed) + +record that stores validated Map payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| CommonparamsubdirGetPathParameters1BoxedMap([PathParametersMap](#pathparametersmap) data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| [PathParametersMap](#pathparametersmap) | data()
validated payload | +| @Nullable Object | getData()
validated payload | + +## CommonparamsubdirGetPathParameters1 +public static class CommonparamsubdirGetPathParameters1
+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.commonparamsubdir.get.CommonparamsubdirGetPathParameters; + +import java.util.Arrays; +import java.util.List; +import java.util.AbstractMap; + +static final SchemaConfiguration configuration = new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().build()); + +// Map validation +CommonparamsubdirGetPathParameters.PathParametersMap validatedPayload = + CommonparamsubdirGetPathParameters.CommonparamsubdirGetPathParameters1.validate( + new CommonparamsubdirGetPathParameters.PathParametersMapBuilder() + .subDir("a") + + .build(), + configuration +); +``` + +### Field Summary +| Modifier and Type | Field and Description | +| ----------------- | ---------------------- | +| Set> | type = Set.of(Map.class) | +| Map> | properties = Map.ofEntries(
    new PropertyEntry("subDir", [RouteParamSchema0.RouteParamSchema01.class](../../../paths/commonparamsubdir/parameters/routeparameter0/RouteParamSchema0.md#routeparamschema01))
)
| +| Set | required = Set.of(
    "subDir"
)
| +| Class | additionalProperties = [AdditionalProperties.class](#additionalproperties) | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| [PathParametersMap](#pathparametersmap) | validate([Map<?, ?>](#pathparametersmapbuilder) arg, SchemaConfiguration configuration) | +| [CommonparamsubdirGetPathParameters1BoxedMap](#commonparamsubdirgetpathparameters1boxedmap) | validateAndBox([Map<?, ?>](#pathparametersmapbuilder) arg, SchemaConfiguration configuration) | +| [CommonparamsubdirGetPathParameters1Boxed](#commonparamsubdirgetpathparameters1boxed) | validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) | +| @Nullable Object | validate(@Nullable Object arg, SchemaConfiguration configuration) | + +## PathParametersMap0Builder +public class PathParametersMap0Builder
+builder for `Map` + +A class that builds the Map input type + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| PathParametersMap0Builder(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 | + +## PathParametersMapBuilder +public class PathParametersMapBuilder
+builder for `Map` + +A class that builds the Map input type + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| PathParametersMapBuilder()
Creates a builder that contains an empty map | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| [PathParametersMap0Builder](#pathparametersmap0builder) | subDir(String value) | +| [PathParametersMap0Builder](#pathparametersmap0builder) | subDir([RouteParamSchema0.StringRouteParamSchemaEnums0](../../../paths/commonparamsubdir/parameters/routeparameter0/RouteParamSchema0.md#stringrouteparamschemaenums0) value) | + +## PathParametersMap +public static class PathParametersMap
+extends FrozenMap + +A class to store validated Map payloads + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| static [PathParametersMap](#pathparametersmap) | of([Map](#pathparametersmapbuilder) arg, SchemaConfiguration configuration) | +| String | subDir()
| + +## 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(Nothing? data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| Nothing? | 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/kotlin/docs/paths/commonparamsubdir/get/CommonparamsubdirGetQueryParameters.md b/samples/client/petstore/kotlin/docs/paths/commonparamsubdir/get/CommonparamsubdirGetQueryParameters.md new file mode 100644 index 00000000000..8ccc75d91c1 --- /dev/null +++ b/samples/client/petstore/kotlin/docs/paths/commonparamsubdir/get/CommonparamsubdirGetQueryParameters.md @@ -0,0 +1,252 @@ +# CommonparamsubdirGetQueryParameters +public class CommonparamsubdirGetQueryParameters
+ +A class that contains necessary nested +- schema classes (which validate payloads), extends JsonSchema +- sealed interfaces which store validated payloads, java version of a sum type +- boxed classes which store validated payloads, sealed permits class implementations +- classes to store validated map payloads, extends FrozenMap +- classes to build inputs for map payloads + +## Nested Class Summary +| Modifier and Type | Class and Description | +| ----------------- | ---------------------- | +| sealed interface | [CommonparamsubdirGetQueryParameters.CommonparamsubdirGetQueryParameters1Boxed](#commonparamsubdirgetqueryparameters1boxed)
sealed interface for validated payloads | +| record | [CommonparamsubdirGetQueryParameters.CommonparamsubdirGetQueryParameters1BoxedMap](#commonparamsubdirgetqueryparameters1boxedmap)
boxed class to store validated Map payloads | +| static class | [CommonparamsubdirGetQueryParameters.CommonparamsubdirGetQueryParameters1](#commonparamsubdirgetqueryparameters1)
schema class | +| static class | [CommonparamsubdirGetQueryParameters.QueryParametersMapBuilder](#queryparametersmapbuilder)
builder for Map payloads | +| static class | [CommonparamsubdirGetQueryParameters.QueryParametersMap](#queryparametersmap)
output class for Map payloads | +| sealed interface | [CommonparamsubdirGetQueryParameters.AdditionalPropertiesBoxed](#additionalpropertiesboxed)
sealed interface for validated payloads | +| record | [CommonparamsubdirGetQueryParameters.AdditionalPropertiesBoxedVoid](#additionalpropertiesboxedvoid)
boxed class to store validated null payloads | +| record | [CommonparamsubdirGetQueryParameters.AdditionalPropertiesBoxedBoolean](#additionalpropertiesboxedboolean)
boxed class to store validated boolean payloads | +| record | [CommonparamsubdirGetQueryParameters.AdditionalPropertiesBoxedNumber](#additionalpropertiesboxednumber)
boxed class to store validated Number payloads | +| record | [CommonparamsubdirGetQueryParameters.AdditionalPropertiesBoxedString](#additionalpropertiesboxedstring)
boxed class to store validated String payloads | +| record | [CommonparamsubdirGetQueryParameters.AdditionalPropertiesBoxedList](#additionalpropertiesboxedlist)
boxed class to store validated List payloads | +| record | [CommonparamsubdirGetQueryParameters.AdditionalPropertiesBoxedMap](#additionalpropertiesboxedmap)
boxed class to store validated Map payloads | +| static class | [CommonparamsubdirGetQueryParameters.AdditionalProperties](#additionalproperties)
schema class | + +## CommonparamsubdirGetQueryParameters1Boxed +public sealed interface CommonparamsubdirGetQueryParameters1Boxed
+permits
+[CommonparamsubdirGetQueryParameters1BoxedMap](#commonparamsubdirgetqueryparameters1boxedmap) + +sealed interface that stores validated payloads using boxed classes + +## CommonparamsubdirGetQueryParameters1BoxedMap +public record CommonparamsubdirGetQueryParameters1BoxedMap
+implements [CommonparamsubdirGetQueryParameters1Boxed](#commonparamsubdirgetqueryparameters1boxed) + +record that stores validated Map payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| CommonparamsubdirGetQueryParameters1BoxedMap([QueryParametersMap](#queryparametersmap) data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| [QueryParametersMap](#queryparametersmap) | data()
validated payload | +| @Nullable Object | getData()
validated payload | + +## CommonparamsubdirGetQueryParameters1 +public static class CommonparamsubdirGetQueryParameters1
+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.commonparamsubdir.get.CommonparamsubdirGetQueryParameters; + +import java.util.Arrays; +import java.util.List; +import java.util.AbstractMap; + +static final SchemaConfiguration configuration = new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().build()); + +// Map validation +CommonparamsubdirGetQueryParameters.QueryParametersMap validatedPayload = + CommonparamsubdirGetQueryParameters.CommonparamsubdirGetQueryParameters1.validate( + new CommonparamsubdirGetQueryParameters.QueryParametersMapBuilder() + .searchStr("a") + + .build(), + configuration +); +``` + +### Field Summary +| Modifier and Type | Field and Description | +| ----------------- | ---------------------- | +| Set> | type = Set.of(Map.class) | +| Map> | properties = Map.ofEntries(
    new PropertyEntry("searchStr", [Schema0.Schema01.class](../../../paths/commonparamsubdir/get/parameters/parameter0/Schema0.md#schema01))
)
| +| Class | additionalProperties = [AdditionalProperties.class](#additionalproperties) | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| [QueryParametersMap](#queryparametersmap) | validate([Map<?, ?>](#queryparametersmapbuilder) arg, SchemaConfiguration configuration) | +| [CommonparamsubdirGetQueryParameters1BoxedMap](#commonparamsubdirgetqueryparameters1boxedmap) | validateAndBox([Map<?, ?>](#queryparametersmapbuilder) arg, SchemaConfiguration configuration) | +| [CommonparamsubdirGetQueryParameters1Boxed](#commonparamsubdirgetqueryparameters1boxed) | validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) | +| @Nullable Object | validate(@Nullable Object arg, SchemaConfiguration configuration) | + +## QueryParametersMapBuilder +public class QueryParametersMapBuilder
+builder for `Map` + +A class that builds the Map input type + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| QueryParametersMapBuilder()
Creates a builder that contains an empty map | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| Map | build()
Returns map input that should be used with Schema.validate | +| [QueryParametersMapBuilder](#queryparametersmapbuilder) | searchStr(String value) | + +## QueryParametersMap +public static class QueryParametersMap
+extends FrozenMap + +A class to store validated Map payloads + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| static [QueryParametersMap](#queryparametersmap) | of([Map](#queryparametersmapbuilder) arg, SchemaConfiguration configuration) | +| String | searchStr()
[optional] | + +## 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(Nothing? data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| Nothing? | 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/kotlin/docs/paths/commonparamsubdir/get/CommonparamsubdirGetResponses.md b/samples/client/petstore/kotlin/docs/paths/commonparamsubdir/get/CommonparamsubdirGetResponses.md new file mode 100644 index 00000000000..2fe9a9b9b40 --- /dev/null +++ b/samples/client/petstore/kotlin/docs/paths/commonparamsubdir/get/CommonparamsubdirGetResponses.md @@ -0,0 +1,29 @@ +# CommonparamsubdirGetResponses + +public class CommonparamsubdirGetResponses + +A class that contains necessary responses classes +- a sealed interface, EndpointResponse, that stores endpoint responses +- records for each endpoint response + +## Nested Class Summary +| Modifier and Type | Class and Description | +| ----------------- | --------------------- | +| sealed interface | [EndpointResponse](#endpointresponse)
stores the endpoint responses | +| record | [EndpointCommonparamsubdirGetCode200Response](#endpointcommonparamsubdirgetcode200response)
the response for 200 | + +## EndpointResponse +public sealed interface EndpointResponse permits
+[EndpointCommonparamsubdirGetCode200Response](#endpointcommonparamsubdirgetcode200response) + +a sealed interface that stores endpoint responses + +## EndpointCommonparamsubdirGetCode200Response +public record EndpointCommonparamsubdirGetCode200Response( + HttpResponse response, + Nothing? body, + Nothing? headers +) implements EndpointResponse, ApiResponse
+ +a class that stores an endpoint response + diff --git a/samples/client/petstore/kotlin/docs/paths/commonparamsubdir/get/parameters/parameter0/Schema0.md b/samples/client/petstore/kotlin/docs/paths/commonparamsubdir/get/parameters/parameter0/Schema0.md new file mode 100644 index 00000000000..9ff90e0bc35 --- /dev/null +++ b/samples/client/petstore/kotlin/docs/paths/commonparamsubdir/get/parameters/parameter0/Schema0.md @@ -0,0 +1,49 @@ +# Schema0 +public class Schema0
+ +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 + +## Nested Class Summary +| Modifier and Type | Class and Description | +| ----------------- | ---------------------- | +| sealed interface | [Schema0.Schema01Boxed](#schema01boxed)
sealed interface for validated payloads | +| record | [Schema0.Schema01BoxedString](#schema01boxedstring)
boxed class to store validated String payloads | +| static class | [Schema0.Schema01](#schema01)
schema class | + +## Schema01Boxed +public sealed interface Schema01Boxed
+permits
+[Schema01BoxedString](#schema01boxedstring) + +sealed interface that stores validated payloads using boxed classes + +## Schema01BoxedString +public record Schema01BoxedString
+implements [Schema01Boxed](#schema01boxed) + +record that stores validated String payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| Schema01BoxedString(String data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| String | data()
validated payload | +| @Nullable Object | getData()
validated payload | + +## Schema01 +public static class Schema01
+extends StringJsonSchema.StringJsonSchema1 + +A schema class that validates payloads + +| Methods Inherited from class org.openapijsonschematools.client.schemas.StringJsonSchema.StringJsonSchema1 | +| ------------------------------------------------------------------ | +| validate | +| validateAndBox | diff --git a/samples/client/petstore/kotlin/docs/paths/commonparamsubdir/get/responses/CommonparamsubdirGetCode200Response.md b/samples/client/petstore/kotlin/docs/paths/commonparamsubdir/get/responses/CommonparamsubdirGetCode200Response.md new file mode 100644 index 00000000000..11da3fc2681 --- /dev/null +++ b/samples/client/petstore/kotlin/docs/paths/commonparamsubdir/get/responses/CommonparamsubdirGetCode200Response.md @@ -0,0 +1,17 @@ +# CommonparamsubdirGetCode200Response + +public class CommonparamsubdirGetCode200Response extends [SuccessDescriptionOnly](../../components/responses/SuccessDescriptionOnly.md) + +A class (extended from the $ref class) that contains necessary nested response classes +- a class that extends ResponseDeserializer and is used to deserialize responses + +## Nested Class Summary +| Modifier and Type | Class and Description | +| ----------------- | --------------------- | +| static class | [CommonparamsubdirGetCode200Response.CommonparamsubdirGetCode200Response1](#commonparamsubdirgetcode200response1)
class that deserializes responses | + +## CommonparamsubdirGetCode200Response1 +public static class CommonparamsubdirGetCode200Response1 extends [SuccessDescriptionOnly1](../../components/responses/SuccessDescriptionOnly.md#successdescriptiononly1)
+ +a class that deserializes responses, extended from the $ref class + diff --git a/samples/client/petstore/kotlin/docs/paths/commonparamsubdir/parameters/routeparameter0/RouteParamSchema0.md b/samples/client/petstore/kotlin/docs/paths/commonparamsubdir/parameters/routeparameter0/RouteParamSchema0.md new file mode 100644 index 00000000000..a21f308c2ea --- /dev/null +++ b/samples/client/petstore/kotlin/docs/paths/commonparamsubdir/parameters/routeparameter0/RouteParamSchema0.md @@ -0,0 +1,96 @@ +# RouteParamSchema0 +public class RouteParamSchema0
+ +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 +- enum classes + +## Nested Class Summary +| Modifier and Type | Class and Description | +| ----------------- | ---------------------- | +| sealed interface | [RouteParamSchema0.RouteParamSchema01Boxed](#routeparamschema01boxed)
sealed interface for validated payloads | +| record | [RouteParamSchema0.RouteParamSchema01BoxedString](#routeparamschema01boxedstring)
boxed class to store validated String payloads | +| static class | [RouteParamSchema0.RouteParamSchema01](#routeparamschema01)
schema class | +| enum | [RouteParamSchema0.StringRouteParamSchemaEnums0](#stringrouteparamschemaenums0)
String enum | + +## RouteParamSchema01Boxed +public sealed interface RouteParamSchema01Boxed
+permits
+[RouteParamSchema01BoxedString](#routeparamschema01boxedstring) + +sealed interface that stores validated payloads using boxed classes + +## RouteParamSchema01BoxedString +public record RouteParamSchema01BoxedString
+implements [RouteParamSchema01Boxed](#routeparamschema01boxed) + +record that stores validated String payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| RouteParamSchema01BoxedString(String data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| String | data()
validated payload | +| @Nullable Object | getData()
validated payload | + +## RouteParamSchema01 +public static class RouteParamSchema01
+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.commonparamsubdir.parameters.routeparameter0.RouteParamSchema0; + +import java.util.Arrays; +import java.util.List; +import java.util.AbstractMap; + +static final SchemaConfiguration configuration = new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().build()); + +// String validation +String validatedPayload = RouteParamSchema0.RouteParamSchema01.validate( + "a", + configuration +); +``` + +### Field Summary +| Modifier and Type | Field and Description | +| ----------------- | ---------------------- | +| Set> | type = Set.of(
    String.class
)
| +| Set | enumValues = SetMaker.makeSet(
    "a",
    "b"
)
| + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| String | validate(String arg, SchemaConfiguration configuration) | +| String | validate([StringRouteParamSchemaEnums0](#stringrouteparamschemaenums0) arg, SchemaConfiguration configuration) | +| [RouteParamSchema01BoxedString](#routeparamschema01boxedstring) | validateAndBox(String arg, SchemaConfiguration configuration) | +| [RouteParamSchema01Boxed](#routeparamschema01boxed) | validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) | +| @Nullable Object | validate(@Nullable Object arg, SchemaConfiguration configuration) | + +## StringRouteParamSchemaEnums0 +public enum StringRouteParamSchemaEnums0
+extends `Enum` + +A class that stores String enum values + +### Enum Constant Summary +| Enum Constant | Description | +| ------------- | ----------- | +| A | value = "a" | +| B | value = "b" | diff --git a/samples/client/petstore/kotlin/docs/paths/commonparamsubdir/post/CommonparamsubdirPostHeaderParameters.md b/samples/client/petstore/kotlin/docs/paths/commonparamsubdir/post/CommonparamsubdirPostHeaderParameters.md new file mode 100644 index 00000000000..2bac00c6ce3 --- /dev/null +++ b/samples/client/petstore/kotlin/docs/paths/commonparamsubdir/post/CommonparamsubdirPostHeaderParameters.md @@ -0,0 +1,252 @@ +# CommonparamsubdirPostHeaderParameters +public class CommonparamsubdirPostHeaderParameters
+ +A class that contains necessary nested +- schema classes (which validate payloads), extends JsonSchema +- sealed interfaces which store validated payloads, java version of a sum type +- boxed classes which store validated payloads, sealed permits class implementations +- classes to store validated map payloads, extends FrozenMap +- classes to build inputs for map payloads + +## Nested Class Summary +| Modifier and Type | Class and Description | +| ----------------- | ---------------------- | +| sealed interface | [CommonparamsubdirPostHeaderParameters.CommonparamsubdirPostHeaderParameters1Boxed](#commonparamsubdirpostheaderparameters1boxed)
sealed interface for validated payloads | +| record | [CommonparamsubdirPostHeaderParameters.CommonparamsubdirPostHeaderParameters1BoxedMap](#commonparamsubdirpostheaderparameters1boxedmap)
boxed class to store validated Map payloads | +| static class | [CommonparamsubdirPostHeaderParameters.CommonparamsubdirPostHeaderParameters1](#commonparamsubdirpostheaderparameters1)
schema class | +| static class | [CommonparamsubdirPostHeaderParameters.HeaderParametersMapBuilder](#headerparametersmapbuilder)
builder for Map payloads | +| static class | [CommonparamsubdirPostHeaderParameters.HeaderParametersMap](#headerparametersmap)
output class for Map payloads | +| sealed interface | [CommonparamsubdirPostHeaderParameters.AdditionalPropertiesBoxed](#additionalpropertiesboxed)
sealed interface for validated payloads | +| record | [CommonparamsubdirPostHeaderParameters.AdditionalPropertiesBoxedVoid](#additionalpropertiesboxedvoid)
boxed class to store validated null payloads | +| record | [CommonparamsubdirPostHeaderParameters.AdditionalPropertiesBoxedBoolean](#additionalpropertiesboxedboolean)
boxed class to store validated boolean payloads | +| record | [CommonparamsubdirPostHeaderParameters.AdditionalPropertiesBoxedNumber](#additionalpropertiesboxednumber)
boxed class to store validated Number payloads | +| record | [CommonparamsubdirPostHeaderParameters.AdditionalPropertiesBoxedString](#additionalpropertiesboxedstring)
boxed class to store validated String payloads | +| record | [CommonparamsubdirPostHeaderParameters.AdditionalPropertiesBoxedList](#additionalpropertiesboxedlist)
boxed class to store validated List payloads | +| record | [CommonparamsubdirPostHeaderParameters.AdditionalPropertiesBoxedMap](#additionalpropertiesboxedmap)
boxed class to store validated Map payloads | +| static class | [CommonparamsubdirPostHeaderParameters.AdditionalProperties](#additionalproperties)
schema class | + +## CommonparamsubdirPostHeaderParameters1Boxed +public sealed interface CommonparamsubdirPostHeaderParameters1Boxed
+permits
+[CommonparamsubdirPostHeaderParameters1BoxedMap](#commonparamsubdirpostheaderparameters1boxedmap) + +sealed interface that stores validated payloads using boxed classes + +## CommonparamsubdirPostHeaderParameters1BoxedMap +public record CommonparamsubdirPostHeaderParameters1BoxedMap
+implements [CommonparamsubdirPostHeaderParameters1Boxed](#commonparamsubdirpostheaderparameters1boxed) + +record that stores validated Map payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| CommonparamsubdirPostHeaderParameters1BoxedMap([HeaderParametersMap](#headerparametersmap) data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| [HeaderParametersMap](#headerparametersmap) | data()
validated payload | +| @Nullable Object | getData()
validated payload | + +## CommonparamsubdirPostHeaderParameters1 +public static class CommonparamsubdirPostHeaderParameters1
+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.commonparamsubdir.post.CommonparamsubdirPostHeaderParameters; + +import java.util.Arrays; +import java.util.List; +import java.util.AbstractMap; + +static final SchemaConfiguration configuration = new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().build()); + +// Map validation +CommonparamsubdirPostHeaderParameters.HeaderParametersMap validatedPayload = + CommonparamsubdirPostHeaderParameters.CommonparamsubdirPostHeaderParameters1.validate( + new CommonparamsubdirPostHeaderParameters.HeaderParametersMapBuilder() + .someHeader("a") + + .build(), + configuration +); +``` + +### Field Summary +| Modifier and Type | Field and Description | +| ----------------- | ---------------------- | +| Set> | type = Set.of(Map.class) | +| Map> | properties = Map.ofEntries(
    new PropertyEntry("someHeader", [Schema0.Schema01.class](../../../paths/commonparamsubdir/post/parameters/parameter0/Schema0.md#schema01))
)
| +| Class | additionalProperties = [AdditionalProperties.class](#additionalproperties) | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| [HeaderParametersMap](#headerparametersmap) | validate([Map<?, ?>](#headerparametersmapbuilder) arg, SchemaConfiguration configuration) | +| [CommonparamsubdirPostHeaderParameters1BoxedMap](#commonparamsubdirpostheaderparameters1boxedmap) | validateAndBox([Map<?, ?>](#headerparametersmapbuilder) arg, SchemaConfiguration configuration) | +| [CommonparamsubdirPostHeaderParameters1Boxed](#commonparamsubdirpostheaderparameters1boxed) | validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) | +| @Nullable Object | validate(@Nullable Object arg, SchemaConfiguration configuration) | + +## HeaderParametersMapBuilder +public class HeaderParametersMapBuilder
+builder for `Map` + +A class that builds the Map input type + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| HeaderParametersMapBuilder()
Creates a builder that contains an empty map | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| Map | build()
Returns map input that should be used with Schema.validate | +| [HeaderParametersMapBuilder](#headerparametersmapbuilder) | someHeader(String value) | + +## HeaderParametersMap +public static class HeaderParametersMap
+extends FrozenMap + +A class to store validated Map payloads + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| static [HeaderParametersMap](#headerparametersmap) | of([Map](#headerparametersmapbuilder) arg, SchemaConfiguration configuration) | +| String | someHeader()
[optional] | + +## 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(Nothing? data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| Nothing? | 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/kotlin/docs/paths/commonparamsubdir/post/CommonparamsubdirPostPathParameters.md b/samples/client/petstore/kotlin/docs/paths/commonparamsubdir/post/CommonparamsubdirPostPathParameters.md new file mode 100644 index 00000000000..5ebd1fcc3e3 --- /dev/null +++ b/samples/client/petstore/kotlin/docs/paths/commonparamsubdir/post/CommonparamsubdirPostPathParameters.md @@ -0,0 +1,269 @@ +# CommonparamsubdirPostPathParameters +public class CommonparamsubdirPostPathParameters
+ +A class that contains necessary nested +- schema classes (which validate payloads), extends JsonSchema +- sealed interfaces which store validated payloads, java version of a sum type +- boxed classes which store validated payloads, sealed permits class implementations +- classes to store validated map payloads, extends FrozenMap +- classes to build inputs for map payloads + +## Nested Class Summary +| Modifier and Type | Class and Description | +| ----------------- | ---------------------- | +| sealed interface | [CommonparamsubdirPostPathParameters.CommonparamsubdirPostPathParameters1Boxed](#commonparamsubdirpostpathparameters1boxed)
sealed interface for validated payloads | +| record | [CommonparamsubdirPostPathParameters.CommonparamsubdirPostPathParameters1BoxedMap](#commonparamsubdirpostpathparameters1boxedmap)
boxed class to store validated Map payloads | +| static class | [CommonparamsubdirPostPathParameters.CommonparamsubdirPostPathParameters1](#commonparamsubdirpostpathparameters1)
schema class | +| static class | [CommonparamsubdirPostPathParameters.PathParametersMapBuilder](#pathparametersmapbuilder)
builder for Map payloads | +| static class | [CommonparamsubdirPostPathParameters.PathParametersMap](#pathparametersmap)
output class for Map payloads | +| sealed interface | [CommonparamsubdirPostPathParameters.AdditionalPropertiesBoxed](#additionalpropertiesboxed)
sealed interface for validated payloads | +| record | [CommonparamsubdirPostPathParameters.AdditionalPropertiesBoxedVoid](#additionalpropertiesboxedvoid)
boxed class to store validated null payloads | +| record | [CommonparamsubdirPostPathParameters.AdditionalPropertiesBoxedBoolean](#additionalpropertiesboxedboolean)
boxed class to store validated boolean payloads | +| record | [CommonparamsubdirPostPathParameters.AdditionalPropertiesBoxedNumber](#additionalpropertiesboxednumber)
boxed class to store validated Number payloads | +| record | [CommonparamsubdirPostPathParameters.AdditionalPropertiesBoxedString](#additionalpropertiesboxedstring)
boxed class to store validated String payloads | +| record | [CommonparamsubdirPostPathParameters.AdditionalPropertiesBoxedList](#additionalpropertiesboxedlist)
boxed class to store validated List payloads | +| record | [CommonparamsubdirPostPathParameters.AdditionalPropertiesBoxedMap](#additionalpropertiesboxedmap)
boxed class to store validated Map payloads | +| static class | [CommonparamsubdirPostPathParameters.AdditionalProperties](#additionalproperties)
schema class | + +## CommonparamsubdirPostPathParameters1Boxed +public sealed interface CommonparamsubdirPostPathParameters1Boxed
+permits
+[CommonparamsubdirPostPathParameters1BoxedMap](#commonparamsubdirpostpathparameters1boxedmap) + +sealed interface that stores validated payloads using boxed classes + +## CommonparamsubdirPostPathParameters1BoxedMap +public record CommonparamsubdirPostPathParameters1BoxedMap
+implements [CommonparamsubdirPostPathParameters1Boxed](#commonparamsubdirpostpathparameters1boxed) + +record that stores validated Map payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| CommonparamsubdirPostPathParameters1BoxedMap([PathParametersMap](#pathparametersmap) data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| [PathParametersMap](#pathparametersmap) | data()
validated payload | +| @Nullable Object | getData()
validated payload | + +## CommonparamsubdirPostPathParameters1 +public static class CommonparamsubdirPostPathParameters1
+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.commonparamsubdir.post.CommonparamsubdirPostPathParameters; + +import java.util.Arrays; +import java.util.List; +import java.util.AbstractMap; + +static final SchemaConfiguration configuration = new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().build()); + +// Map validation +CommonparamsubdirPostPathParameters.PathParametersMap validatedPayload = + CommonparamsubdirPostPathParameters.CommonparamsubdirPostPathParameters1.validate( + new CommonparamsubdirPostPathParameters.PathParametersMapBuilder() + .subDir("a") + + .build(), + configuration +); +``` + +### Field Summary +| Modifier and Type | Field and Description | +| ----------------- | ---------------------- | +| Set> | type = Set.of(Map.class) | +| Map> | properties = Map.ofEntries(
    new PropertyEntry("subDir", [RouteParamSchema0.RouteParamSchema01.class](../../../paths/commonparamsubdir/parameters/routeparameter0/RouteParamSchema0.md#routeparamschema01))
)
| +| Set | required = Set.of(
    "subDir"
)
| +| Class | additionalProperties = [AdditionalProperties.class](#additionalproperties) | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| [PathParametersMap](#pathparametersmap) | validate([Map<?, ?>](#pathparametersmapbuilder) arg, SchemaConfiguration configuration) | +| [CommonparamsubdirPostPathParameters1BoxedMap](#commonparamsubdirpostpathparameters1boxedmap) | validateAndBox([Map<?, ?>](#pathparametersmapbuilder) arg, SchemaConfiguration configuration) | +| [CommonparamsubdirPostPathParameters1Boxed](#commonparamsubdirpostpathparameters1boxed) | validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) | +| @Nullable Object | validate(@Nullable Object arg, SchemaConfiguration configuration) | + +## PathParametersMap0Builder +public class PathParametersMap0Builder
+builder for `Map` + +A class that builds the Map input type + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| PathParametersMap0Builder(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 | + +## PathParametersMapBuilder +public class PathParametersMapBuilder
+builder for `Map` + +A class that builds the Map input type + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| PathParametersMapBuilder()
Creates a builder that contains an empty map | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| [PathParametersMap0Builder](#pathparametersmap0builder) | subDir(String value) | +| [PathParametersMap0Builder](#pathparametersmap0builder) | subDir([RouteParamSchema0.StringRouteParamSchemaEnums0](../../../paths/commonparamsubdir/parameters/routeparameter0/RouteParamSchema0.md#stringrouteparamschemaenums0) value) | + +## PathParametersMap +public static class PathParametersMap
+extends FrozenMap + +A class to store validated Map payloads + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| static [PathParametersMap](#pathparametersmap) | of([Map](#pathparametersmapbuilder) arg, SchemaConfiguration configuration) | +| String | subDir()
| + +## 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(Nothing? data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| Nothing? | 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/kotlin/docs/paths/commonparamsubdir/post/CommonparamsubdirPostResponses.md b/samples/client/petstore/kotlin/docs/paths/commonparamsubdir/post/CommonparamsubdirPostResponses.md new file mode 100644 index 00000000000..3fdc9818f77 --- /dev/null +++ b/samples/client/petstore/kotlin/docs/paths/commonparamsubdir/post/CommonparamsubdirPostResponses.md @@ -0,0 +1,29 @@ +# CommonparamsubdirPostResponses + +public class CommonparamsubdirPostResponses + +A class that contains necessary responses classes +- a sealed interface, EndpointResponse, that stores endpoint responses +- records for each endpoint response + +## Nested Class Summary +| Modifier and Type | Class and Description | +| ----------------- | --------------------- | +| sealed interface | [EndpointResponse](#endpointresponse)
stores the endpoint responses | +| record | [EndpointCommonparamsubdirPostCode200Response](#endpointcommonparamsubdirpostcode200response)
the response for 200 | + +## EndpointResponse +public sealed interface EndpointResponse permits
+[EndpointCommonparamsubdirPostCode200Response](#endpointcommonparamsubdirpostcode200response) + +a sealed interface that stores endpoint responses + +## EndpointCommonparamsubdirPostCode200Response +public record EndpointCommonparamsubdirPostCode200Response( + HttpResponse response, + Nothing? body, + Nothing? headers +) implements EndpointResponse, ApiResponse
+ +a class that stores an endpoint response + diff --git a/samples/client/petstore/kotlin/docs/paths/commonparamsubdir/post/parameters/parameter0/Schema0.md b/samples/client/petstore/kotlin/docs/paths/commonparamsubdir/post/parameters/parameter0/Schema0.md new file mode 100644 index 00000000000..9ff90e0bc35 --- /dev/null +++ b/samples/client/petstore/kotlin/docs/paths/commonparamsubdir/post/parameters/parameter0/Schema0.md @@ -0,0 +1,49 @@ +# Schema0 +public class Schema0
+ +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 + +## Nested Class Summary +| Modifier and Type | Class and Description | +| ----------------- | ---------------------- | +| sealed interface | [Schema0.Schema01Boxed](#schema01boxed)
sealed interface for validated payloads | +| record | [Schema0.Schema01BoxedString](#schema01boxedstring)
boxed class to store validated String payloads | +| static class | [Schema0.Schema01](#schema01)
schema class | + +## Schema01Boxed +public sealed interface Schema01Boxed
+permits
+[Schema01BoxedString](#schema01boxedstring) + +sealed interface that stores validated payloads using boxed classes + +## Schema01BoxedString +public record Schema01BoxedString
+implements [Schema01Boxed](#schema01boxed) + +record that stores validated String payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| Schema01BoxedString(String data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| String | data()
validated payload | +| @Nullable Object | getData()
validated payload | + +## Schema01 +public static class Schema01
+extends StringJsonSchema.StringJsonSchema1 + +A schema class that validates payloads + +| Methods Inherited from class org.openapijsonschematools.client.schemas.StringJsonSchema.StringJsonSchema1 | +| ------------------------------------------------------------------ | +| validate | +| validateAndBox | diff --git a/samples/client/petstore/kotlin/docs/paths/commonparamsubdir/post/responses/CommonparamsubdirPostCode200Response.md b/samples/client/petstore/kotlin/docs/paths/commonparamsubdir/post/responses/CommonparamsubdirPostCode200Response.md new file mode 100644 index 00000000000..56ce18a3786 --- /dev/null +++ b/samples/client/petstore/kotlin/docs/paths/commonparamsubdir/post/responses/CommonparamsubdirPostCode200Response.md @@ -0,0 +1,17 @@ +# CommonparamsubdirPostCode200Response + +public class CommonparamsubdirPostCode200Response extends [SuccessDescriptionOnly](../../components/responses/SuccessDescriptionOnly.md) + +A class (extended from the $ref class) that contains necessary nested response classes +- a class that extends ResponseDeserializer and is used to deserialize responses + +## Nested Class Summary +| Modifier and Type | Class and Description | +| ----------------- | --------------------- | +| static class | [CommonparamsubdirPostCode200Response.CommonparamsubdirPostCode200Response1](#commonparamsubdirpostcode200response1)
class that deserializes responses | + +## CommonparamsubdirPostCode200Response1 +public static class CommonparamsubdirPostCode200Response1 extends [SuccessDescriptionOnly1](../../components/responses/SuccessDescriptionOnly.md#successdescriptiononly1)
+ +a class that deserializes responses, extended from the $ref class + diff --git a/samples/client/petstore/kotlin/docs/paths/fake/FakeDelete.md b/samples/client/petstore/kotlin/docs/paths/fake/FakeDelete.md new file mode 100644 index 00000000000..49f9d408a2b --- /dev/null +++ b/samples/client/petstore/kotlin/docs/paths/fake/FakeDelete.md @@ -0,0 +1,255 @@ +# FakeDelete + +public class FakeDelete + +A class that contains necessary endpoint classes +- a class that calls the endpoint method using the http verb +- a class that calls the endpoint method using the operationId name +- class(es) to store the request inputs +- builder(s) to set the request input data + +## Nested Class Summary +| Modifier and Type | Class and Description | +| ----------------- | --------------------- | +| static class | [Delete](#delete)
The class that has a delete method to call the endpoint | +| interface | [GroupParametersOperation](#groupparametersoperation)
The interface that has a groupParameters method to call the endpoint | +| static class | [DeleteRequest](#deleterequest)
The final request inputs class | +| static class | [DeleteNullableRequest](#deletenullablerequest)
The initial request inputs class | +| static class | [Delete00RequestBuilder](#delete00requestbuilder)
A builder for the request input class | +| static class | [Delete01RequestBuilder](#delete01requestbuilder)
A builder for the request input class | +| static class | [Delete10RequestBuilder](#delete10requestbuilder)
A builder for the request input class | +| static class | [DeleteRequestBuilder](#deleterequestbuilder)
A builder for the request input class | + +## Delete +public static class Delete extends ApiClient.ApiClient1 implements DeleteOperation
+ +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.fake.delete.FakeDeleteSecurityInfo; +import org.openapijsonschematools.client.paths.fake.delete.FakeDeleteHeaderParameters; +import org.openapijsonschematools.client.paths.fake.delete.FakeDeleteQueryParameters; +import org.openapijsonschematools.client.servers.RootServer0; +import org.openapijsonschematools.client.servers.RootServer1; +import org.openapijsonschematools.client.servers.RootServer2; +import org.openapijsonschematools.client.securityschemes.SecurityScheme; +import org.openapijsonschematools.client.components.securityschemes.BearerTest; +import org.openapijsonschematools.client.paths.fake.delete.responses.FakeDeleteCode200Response; +import org.openapijsonschematools.client.servers.RootServerInfo; +import org.openapijsonschematools.client.paths.fake.FakeDelete; +import org.openapijsonschematools.client.paths.fake.delete.FakeDeleteResponses; + +import java.io.IOException; +import java.util.Arrays; +import java.util.List; +import java.util.Map; +import java.util.AbstractMap; + +// if you want to use a server that is not SERVER_0 pass it in here and change the ServerIndex input below +ApiConfiguration.ServerInfo serverInfo = new ApiConfiguration.ServerInfoBuilder() + .rootServerInfo( + new RootServerInfo.RootServerInfoBuilder() + .rootServer0(new RootServer0()) + .build() + ) + .build(); +ApiConfiguration.ServerIndexInfo serverIndexInfo = new ApiConfiguration.ServerIndexInfoBuilder() + .rootServerInfoServerIndex(RootServerInfo.ServerIndex.SERVER_0) + .build(); +List securitySchemes = new ArrayList(); +securitySchemes.add( + new BearerTest("someAccessToken"); +); +ApiConfiguration.SecurityIndexInfo securityIndexInfo = new ApiConfiguration.SecurityIndexInfoBuilder() + .fakeDeleteSecurityRequirementObject0SecurityIndex(FakeDeleteSecurityRequirementObject0.SecurityIndex.SECURITY_0) + .build(); +Duration timeout = Duration.ofSeconds(1L); +Map> defaultHeaders = Map.of("User-Agent", List.of("OpenAPI-JSON-Schema-Generator/1.0.0/java")); +ApiConfiguration apiConfiguration = new ApiConfiguration( + serverInfo + serverIndexInfo, + securitySchemes, + securityIndexInfo, + timeout, + defaultHeaders +); +SchemaConfiguration schemaConfiguration = new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().build()); +FakeDelete.Delete apiClient = new FakeDelete.Delete(apiConfiguration, schemaConfiguration); + + +// Map validation +FakeDeleteHeaderParameters.HeaderParametersMap headerParameters = + FakeDeleteHeaderParameters.FakeDeleteHeaderParameters1.validate( + new FakeDeleteHeaderParameters.HeaderParametersMapBuilder() + .required_boolean_group("true") + + .boolean_group("true") + + .build(), + schemaConfiguration +); + +// Map validation +FakeDeleteQueryParameters.QueryParametersMap queryParameters = + FakeDeleteQueryParameters.FakeDeleteQueryParameters1.validate( + new FakeDeleteQueryParameters.QueryParametersMapBuilder() + .required_int64_group(1L) + + .required_string_group("a") + + .int64_group(1L) + + .string_group("a") + + .build(), + schemaConfiguration +); + +var request = new FakeDelete.DeleteRequestBuilder() + .headerParameters(headerParameters) + .queryParameters(queryParameters) + .build(); + +FakeDeleteResponses.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; +} +FakeDeleteResponses.EndpointFakeDeleteCode200Response castResponse = (FakeDeleteResponses.EndpointFakeDeleteCode200Response) response; +``` +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| Delete(ApiConfiguration apiConfiguration, SchemaConfiguration schemaConfiguration)
Creates an instance | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| [FakeDeleteResponses.EndpointResponse](../../paths/fake/delete/FakeDeleteResponses.md#endpointresponse) | delete([DeleteRequest](#deleterequest) request) | + +## GroupParametersOperation +public interface GroupParametersOperation
+ +an interface that allows one to call the endpoint using a method named groupParameters by the operationId + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| [FakeDeleteResponses.EndpointResponse](../../paths/fake/delete/FakeDeleteResponses.md#endpointresponse) | groupParameters([DeleteRequest](#deleterequest) request) | + +## DeleteRequest +public static class DeleteRequest
+ +a class that stores the final request inputs + +### Field Summary +| Modifier and Type | Field and Description | +| ----------------- | --------------------- | +| [FakeDeleteHeaderParameters.HeaderParametersMap](../../paths/fake/delete/FakeDeleteHeaderParameters.md#headerparametersmap) | headerParameters | +| [FakeDeleteQueryParameters.QueryParametersMap](../../paths/fake/delete/FakeDeleteQueryParameters.md#queryparametersmap) | queryParameters | +| [RootServerInfo.@Nullable ServerIndex](../../RootServerInfo.md#serverindex) | serverIndex
optional. Note: this will override the value in apiConfiguration | +| [FakeDeleteSecurityInfo.@Nullable SecurityIndex](../../paths/fake/delete/FakeDeleteSecurityInfo.md#securityindex) | securityIndex
optional. Note: this will override the value in apiConfiguration | +| @Nullable Duration | timeout
optional. Note: this will override the value in apiConfiguration | + +## DeleteNullableRequest +public static class DeleteNullableRequest
+ +a class that stores the initial request inputs + +### Field Summary +| Modifier and Type | Field and Description | +| ----------------- | --------------------- | +| [FakeDeleteHeaderParameters.@Nullable HeaderParametersMap](../../paths/fake/delete/FakeDeleteHeaderParameters.md#headerparametersmap) | headerParameters | +| [FakeDeleteQueryParameters.@Nullable QueryParametersMap](../../paths/fake/delete/FakeDeleteQueryParameters.md#queryparametersmap) | queryParameters | +| [RootServerInfo.@Nullable ServerIndex](../../RootServerInfo.md#serverindex) | serverIndex | +| [FakeDeleteSecurityInfo.@Nullable SecurityIndex](../../paths/fake/delete/FakeDeleteSecurityInfo.md#securityindex) | securityIndex | +| @Nullable Duration | timeout | + +## Delete00RequestBuilder +public static class Delete00RequestBuilder
+ +a builder for request inputs + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| Delete00RequestBuilder(Delete00RequestBuilder instance)
Creates a builder that contains the passed instance | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| [DeleteRequest](#deleterequest) | build()
Returns the request input used to call an endpoint method | +| [Delete00RequestBuilder](#delete00requestbuilder) | serverIndex([RootServerInfo.ServerIndex](../../RootServerInfo.md#serverindex) serverIndex)
sets the optional property. Note: this will override the value in apiConfiguration | +| [Delete00RequestBuilder](#delete00requestbuilder) | securityIndex([FakeDeleteSecurityInfo.SecurityIndex](../../paths/fake/delete/FakeDeleteSecurityInfo.md#securityindex) securityIndex)
sets the optional property. Note: this will override the value in apiConfiguration | +| [Delete00RequestBuilder](#delete00requestbuilder) | timeout(Duration timeout)
sets the optional property. Note: this will override the value in apiConfiguration | + +## Delete01RequestBuilder +public static class Delete01RequestBuilder
+ +a builder for request inputs + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| Delete01RequestBuilder(Delete01RequestBuilder instance)
Creates a builder that contains the passed instance | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| [Delete00RequestBuilder](#delete00requestbuilder) | queryParameters([FakeDeleteQueryParametersQueryParametersMap](../../paths/fake/delete/FakeDeleteQueryParameters.md#queryparametersmap) queryParameters)
sets the property | + +## Delete10RequestBuilder +public static class Delete10RequestBuilder
+ +a builder for request inputs + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| Delete10RequestBuilder(Delete10RequestBuilder instance)
Creates a builder that contains the passed instance | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| [Delete00RequestBuilder](#delete00requestbuilder) | headerParameters([FakeDeleteHeaderParametersHeaderParametersMap](../../paths/fake/delete/FakeDeleteHeaderParameters.md#headerparametersmap) headerParameters)
sets the property | + +## DeleteRequestBuilder +public static class DeleteRequestBuilder
+ +a builder for request inputs + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| DeleteRequestBuilder()
Creates a builder that contains null for all parameters | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| [Delete01RequestBuilder](#delete01requestbuilder) | headerParameters([FakeDeleteHeaderParametersHeaderParametersMap](../../paths/fake/delete/FakeDeleteHeaderParameters.md#headerparametersmap) headerParameters)
sets the property | +| [Delete10RequestBuilder](#delete10requestbuilder) | queryParameters([FakeDeleteQueryParametersQueryParametersMap](../../paths/fake/delete/FakeDeleteQueryParameters.md#queryparametersmap) queryParameters)
sets the property | + +[[Back to top]](#top) [[Back to README]](../../../README.md) diff --git a/samples/client/petstore/kotlin/docs/paths/fake/FakeGet.md b/samples/client/petstore/kotlin/docs/paths/fake/FakeGet.md new file mode 100644 index 00000000000..2504a8b4a8d --- /dev/null +++ b/samples/client/petstore/kotlin/docs/paths/fake/FakeGet.md @@ -0,0 +1,156 @@ +# FakeGet + +public class FakeGet + +A class that contains necessary endpoint classes +- a class that calls the endpoint method using the http verb +- a class that calls the endpoint method using the operationId name +- class(es) to store the request inputs +- builder(s) to set the request input data + +## Nested Class Summary +| Modifier and Type | Class and Description | +| ----------------- | --------------------- | +| static class | [Get](#get)
The class that has a get method to call the endpoint | +| interface | [EnumParametersOperation](#enumparametersoperation)
The interface that has a enumParameters method to call the endpoint | +| static class | [GetRequest](#getrequest)
The request inputs class | +| static class | [GetRequestBuilder](#getrequestbuilder)
A builder for the request input class | + +## Get +public static class Get extends ApiClient.ApiClient1 implements GetOperation
+ +a class that allows one to call the endpoint using a method named get + +### 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.fake.get.FakeGetRequestBody; +import org.openapijsonschematools.client.paths.fake.get.requestbody.content.applicationxwwwformurlencoded.ApplicationxwwwformurlencodedSchema; +import org.openapijsonschematools.client.paths.fake.get.FakeGetHeaderParameters; +import org.openapijsonschematools.client.paths.fake.get.FakeGetQueryParameters; +import org.openapijsonschematools.client.RootServerInfo; +import org.openapijsonschematools.client.servers.RootServer0; +import org.openapijsonschematools.client.servers.RootServer1; +import org.openapijsonschematools.client.servers.RootServer2; +import org.openapijsonschematools.client.paths.fake.get.responses.FakeGetCode200Response; +import org.openapijsonschematools.client.paths.fake.get.responses.FakeGetCode404Response; +import org.openapijsonschematools.client.servers.RootServerInfo; +import org.openapijsonschematools.client.paths.fake.FakeGet; +import org.openapijsonschematools.client.paths.fake.get.FakeGetResponses; + +import java.io.IOException; +import java.util.Arrays; +import java.util.List; +import java.util.Map; +import java.util.AbstractMap; + +// if you want to use a server that is not SERVER_0 pass it in here and change the ServerIndex input below +ApiConfiguration.ServerInfo serverInfo = new ApiConfiguration.ServerInfoBuilder() + .rootServerInfo( + new RootServerInfo.RootServerInfoBuilder() + .rootServer0(new RootServer0()) + .build() + ) + .build(); +ApiConfiguration.ServerIndexInfo serverIndexInfo = new ApiConfiguration.ServerIndexInfoBuilder() + .rootServerInfoServerIndex(RootServerInfo.ServerIndex.SERVER_0) + .build(); +Duration timeout = Duration.ofSeconds(1L); +Map> defaultHeaders = Map.of("User-Agent", List.of("OpenAPI-JSON-Schema-Generator/1.0.0/java")); +ApiConfiguration apiConfiguration = new ApiConfiguration( + serverInfo + serverIndexInfo, + timeout, + defaultHeaders +); +SchemaConfiguration schemaConfiguration = new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().build()); +FakeGet.Get apiClient = new FakeGet.Get(apiConfiguration, schemaConfiguration); + + +var request = new FakeGet.GetRequestBuilder().build(); + +FakeGetResponses.EndpointResponse response; +try { + response = apiClient.get(request); +} catch (FakeGetCode404Response.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; +} +FakeGetResponses.EndpointFakeGetCode200Response castResponse = (FakeGetResponses.EndpointFakeGetCode200Response) response; +``` +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| Get(ApiConfiguration apiConfiguration, SchemaConfiguration schemaConfiguration)
Creates an instance | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| [FakeGetResponses.EndpointResponse](../../paths/fake/get/FakeGetResponses.md#endpointresponse) | get([GetRequest](#getrequest) request) | + +## EnumParametersOperation +public interface EnumParametersOperation
+ +an interface that allows one to call the endpoint using a method named enumParameters by the operationId + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| [FakeGetResponses.EndpointResponse](../../paths/fake/get/FakeGetResponses.md#endpointresponse) | enumParameters([GetRequest](#getrequest) request) | + +## GetRequest +public static class GetRequest
+ +a class that stores the final request inputs + +### Field Summary +| Modifier and Type | Field and Description | +| ----------------- | --------------------- | +| [FakeGetRequestBody.@Nullable SealedRequestBody](../../paths/fake/get/FakeGetRequestBody.md#sealedrequestbody) | requestBody
optional | +| [FakeGetHeaderParameters.@Nullable HeaderParametersMap](../../paths/fake/get/FakeGetHeaderParameters.md#headerparametersmap) | headerParameters
optional | +| [FakeGetQueryParameters.@Nullable QueryParametersMap](../../paths/fake/get/FakeGetQueryParameters.md#queryparametersmap) | queryParameters
optional | +| [RootServerInfo.@Nullable ServerIndex](../../RootServerInfo.md#serverindex) | serverIndex
optional. Note: this will override the value in apiConfiguration | +| @Nullable Duration | timeout
optional. Note: this will override the value in apiConfiguration | + +## GetRequestBuilder +public static class GetRequestBuilder
+ +a builder for request inputs + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| GetRequestBuilder()
Creates a builder that contains null for all parameters | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| [GetRequest](#getrequest) | build()
Returns the request input used to call an endpoint method | +| [GetRequestBuilder](#getrequestbuilder) | requestBody([FakeGetRequestBody.SealedRequestBody](../../paths/fake/get/FakeGetRequestBody.md#sealedrequestbody) requestBody)
sets the optional property | +| [GetRequestBuilder](#getrequestbuilder) | headerParameters([FakeGetHeaderParametersHeaderParametersMap](../../paths/fake/get/FakeGetHeaderParameters.md#headerparametersmap) headerParameters)
sets the optional property | +| [GetRequestBuilder](#getrequestbuilder) | queryParameters([FakeGetQueryParametersQueryParametersMap](../../paths/fake/get/FakeGetQueryParameters.md#queryparametersmap) queryParameters)
sets the optional property | +| [GetRequestBuilder](#getrequestbuilder) | serverIndex([RootServerInfo.ServerIndex](../../RootServerInfo.md#serverindex) serverIndex)
sets the optional property. Note: this will override the value in apiConfiguration | +| [GetRequestBuilder](#getrequestbuilder) | timeout(Duration timeout)
sets the optional property. Note: this will override the value in apiConfiguration | + +[[Back to top]](#top) [[Back to README]](../../../README.md) diff --git a/samples/client/petstore/kotlin/docs/paths/fake/FakePatch.md b/samples/client/petstore/kotlin/docs/paths/fake/FakePatch.md new file mode 100644 index 00000000000..a4b21b9a406 --- /dev/null +++ b/samples/client/petstore/kotlin/docs/paths/fake/FakePatch.md @@ -0,0 +1,188 @@ +# FakePatch + +public class FakePatch + +A class that contains necessary endpoint classes +- a class that calls the endpoint method using the http verb +- a class that calls the endpoint method using the operationId name +- class(es) to store the request inputs +- builder(s) to set the request input data + +## Nested Class Summary +| Modifier and Type | Class and Description | +| ----------------- | --------------------- | +| static class | [Patch](#patch)
The class that has a patch method to call the endpoint | +| interface | [ClientModelOperation](#clientmodeloperation)
The interface that has a clientModel method to call the endpoint | +| static class | [PatchRequest](#patchrequest)
The final request inputs class | +| static class | [PatchNullableRequest](#patchnullablerequest)
The initial request inputs class | +| static class | [Patch0RequestBuilder](#patch0requestbuilder)
A builder for the request input class | +| static class | [PatchRequestBuilder](#patchrequestbuilder)
A builder for the request input class | + +## Patch +public static class Patch extends ApiClient.ApiClient1 implements PatchOperation
+ +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.fake.patch.FakePatchRequestBody; +import org.openapijsonschematools.client.components.schemas.Client; +import org.openapijsonschematools.client.servers.RootServer0; +import org.openapijsonschematools.client.servers.RootServer1; +import org.openapijsonschematools.client.servers.RootServer2; +import org.openapijsonschematools.client.paths.fake.patch.responses.FakePatchCode200Response; +import org.openapijsonschematools.client.servers.RootServerInfo; +import org.openapijsonschematools.client.paths.fake.FakePatch; +import org.openapijsonschematools.client.paths.fake.patch.FakePatchResponses; + +import java.io.IOException; +import java.util.Arrays; +import java.util.List; +import java.util.Map; +import java.util.AbstractMap; + +// if you want to use a server that is not SERVER_0 pass it in here and change the ServerIndex input below +ApiConfiguration.ServerInfo serverInfo = new ApiConfiguration.ServerInfoBuilder() + .rootServerInfo( + new RootServerInfo.RootServerInfoBuilder() + .rootServer0(new RootServer0()) + .build() + ) + .build(); +ApiConfiguration.ServerIndexInfo serverIndexInfo = new ApiConfiguration.ServerIndexInfoBuilder() + .rootServerInfoServerIndex(RootServerInfo.ServerIndex.SERVER_0) + .build(); +Duration timeout = Duration.ofSeconds(1L); +Map> defaultHeaders = Map.of("User-Agent", List.of("OpenAPI-JSON-Schema-Generator/1.0.0/java")); +ApiConfiguration apiConfiguration = new ApiConfiguration( + serverInfo + serverIndexInfo, + timeout, + defaultHeaders +); +SchemaConfiguration schemaConfiguration = new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().build()); +FakePatch.Patch apiClient = new FakePatch.Patch(apiConfiguration, schemaConfiguration); + + +Client1BoxedMap requestBodyPayload = + Client.Client1.validateAndBox( + new Client.ClientMapBuilder1() + .client("a") + + .build(), + schemaConfiguration +); +FakePatchRequestBody.SealedRequestBody requestBody = new FakePatchRequestBody.ApplicationjsonRequestBody(requestBodyPayload); + +var request = new FakePatch.PatchRequestBuilder() + .requestBody(requestBody) + .build(); + +FakePatchResponses.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; +} +FakePatchResponses.EndpointFakePatchCode200Response castResponse = (FakePatchResponses.EndpointFakePatchCode200Response) response; +FakePatchCode200Response.ApplicationjsonResponseBody deserializedBody = (FakePatchCode200Response.ApplicationjsonResponseBody) castResponse.body; +// handle deserialized body here +``` +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| Patch(ApiConfiguration apiConfiguration, SchemaConfiguration schemaConfiguration)
Creates an instance | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| [FakePatchResponses.EndpointResponse](../../paths/fake/patch/FakePatchResponses.md#endpointresponse) | patch([PatchRequest](#patchrequest) request) | + +## ClientModelOperation +public interface ClientModelOperation
+ +an interface that allows one to call the endpoint using a method named clientModel by the operationId + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| [FakePatchResponses.EndpointResponse](../../paths/fake/patch/FakePatchResponses.md#endpointresponse) | clientModel([PatchRequest](#patchrequest) request) | + +## PatchRequest +public static class PatchRequest
+ +a class that stores the final request inputs + +### Field Summary +| Modifier and Type | Field and Description | +| ----------------- | --------------------- | +| [FakePatchRequestBody.SealedRequestBody](../../paths/fake/patch/FakePatchRequestBody.md#sealedrequestbody) | requestBody | +| [RootServerInfo.@Nullable ServerIndex](../../RootServerInfo.md#serverindex) | serverIndex
optional. Note: this will override the value in apiConfiguration | +| @Nullable Duration | timeout
optional. Note: this will override the value in apiConfiguration | + +## PatchNullableRequest +public static class PatchNullableRequest
+ +a class that stores the initial request inputs + +### Field Summary +| Modifier and Type | Field and Description | +| ----------------- | --------------------- | +| [FakePatchRequestBody.@Nullable SealedRequestBody](../../paths/fake/patch/FakePatchRequestBody.md#sealedrequestbody) | requestBody | +| [RootServerInfo.@Nullable ServerIndex](../../RootServerInfo.md#serverindex) | serverIndex | +| @Nullable Duration | timeout | + +## Patch0RequestBuilder +public static class Patch0RequestBuilder
+ +a builder for request inputs + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| Patch0RequestBuilder(Patch0RequestBuilder instance)
Creates a builder that contains the passed instance | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| [PatchRequest](#patchrequest) | build()
Returns the request input used to call an endpoint method | +| [Patch0RequestBuilder](#patch0requestbuilder) | serverIndex([RootServerInfo.ServerIndex](../../RootServerInfo.md#serverindex) serverIndex)
sets the optional property. Note: this will override the value in apiConfiguration | +| [Patch0RequestBuilder](#patch0requestbuilder) | timeout(Duration timeout)
sets the optional property. Note: this will override the value in apiConfiguration | + +## PatchRequestBuilder +public static class PatchRequestBuilder
+ +a builder for request inputs + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| PatchRequestBuilder()
Creates a builder that contains null for all parameters | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| [Patch0RequestBuilder](#patch0requestbuilder) | requestBody([FakePatchRequestBody.SealedRequestBody](../../paths/fake/patch/FakePatchRequestBody.md#sealedrequestbody) requestBody)
sets the property | + +[[Back to top]](#top) [[Back to README]](../../../README.md) diff --git a/samples/client/petstore/kotlin/docs/paths/fake/FakePost.md b/samples/client/petstore/kotlin/docs/paths/fake/FakePost.md new file mode 100644 index 00000000000..e9f8e9199b1 --- /dev/null +++ b/samples/client/petstore/kotlin/docs/paths/fake/FakePost.md @@ -0,0 +1,164 @@ +# FakePost + +public class FakePost + +A class that contains necessary endpoint classes +- a class that calls the endpoint method using the http verb +- a class that calls the endpoint method using the operationId name +- class(es) to store the request inputs +- builder(s) to set the request input data + +## Nested Class Summary +| Modifier and Type | Class and Description | +| ----------------- | --------------------- | +| static class | [Post](#post)
The class that has a post method to call the endpoint | +| interface | [EndpointParametersOperation](#endpointparametersoperation)
The interface that has a endpointParameters method to call the endpoint | +| static class | [PostRequest](#postrequest)
The request inputs class | +| static class | [PostRequestBuilder](#postrequestbuilder)
A builder for the request input class | + +## Post +public static class Post 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.fake.post.FakePostRequestBody; +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.RootServer0; +import org.openapijsonschematools.client.servers.RootServer1; +import org.openapijsonschematools.client.servers.RootServer2; +import org.openapijsonschematools.client.securityschemes.SecurityScheme; +import org.openapijsonschematools.client.components.securityschemes.HttpBasicTest; +import org.openapijsonschematools.client.paths.fake.post.responses.FakePostCode200Response; +import org.openapijsonschematools.client.paths.fake.post.responses.FakePostCode404Response; +import org.openapijsonschematools.client.servers.RootServerInfo; +import org.openapijsonschematools.client.paths.fake.FakePost; +import org.openapijsonschematools.client.paths.fake.post.FakePostResponses; + +import java.io.IOException; +import java.util.Arrays; +import java.util.List; +import java.util.Map; +import java.util.AbstractMap; + +// if you want to use a server that is not SERVER_0 pass it in here and change the ServerIndex input below +ApiConfiguration.ServerInfo serverInfo = new ApiConfiguration.ServerInfoBuilder() + .rootServerInfo( + new RootServerInfo.RootServerInfoBuilder() + .rootServer0(new RootServer0()) + .build() + ) + .build(); +ApiConfiguration.ServerIndexInfo serverIndexInfo = new ApiConfiguration.ServerIndexInfoBuilder() + .rootServerInfoServerIndex(RootServerInfo.ServerIndex.SERVER_0) + .build(); +List securitySchemes = new ArrayList(); +securitySchemes.add( + new HttpBasicTest("someUserId", "somePassword"); +); +ApiConfiguration.SecurityIndexInfo securityIndexInfo = new ApiConfiguration.SecurityIndexInfoBuilder() + .fakePostSecurityRequirementObject0SecurityIndex(FakePostSecurityRequirementObject0.SecurityIndex.SECURITY_0) + .build(); +Duration timeout = Duration.ofSeconds(1L); +Map> defaultHeaders = Map.of("User-Agent", List.of("OpenAPI-JSON-Schema-Generator/1.0.0/java")); +ApiConfiguration apiConfiguration = new ApiConfiguration( + serverInfo + serverIndexInfo, + securitySchemes, + securityIndexInfo, + timeout, + defaultHeaders +); +SchemaConfiguration schemaConfiguration = new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().build()); +FakePost.Post apiClient = new FakePost.Post(apiConfiguration, schemaConfiguration); + + +var request = new FakePost.PostRequestBuilder().build(); + +FakePostResponses.EndpointResponse response; +try { + response = apiClient.post(request); +} catch (FakePostCode404Response.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; +} +FakePostResponses.EndpointFakePostCode200Response castResponse = (FakePostResponses.EndpointFakePostCode200Response) response; +``` +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| Post(ApiConfiguration apiConfiguration, SchemaConfiguration schemaConfiguration)
Creates an instance | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| [FakePostResponses.EndpointResponse](../../paths/fake/post/FakePostResponses.md#endpointresponse) | post([PostRequest](#postrequest) request) | + +## EndpointParametersOperation +public interface EndpointParametersOperation
+ +an interface that allows one to call the endpoint using a method named endpointParameters by the operationId + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| [FakePostResponses.EndpointResponse](../../paths/fake/post/FakePostResponses.md#endpointresponse) | endpointParameters([PostRequest](#postrequest) request) | + +## PostRequest +public static class PostRequest
+ +a class that stores the final request inputs + +### Field Summary +| Modifier and Type | Field and Description | +| ----------------- | --------------------- | +| [FakePostRequestBody.@Nullable SealedRequestBody](../../paths/fake/post/FakePostRequestBody.md#sealedrequestbody) | requestBody
optional | +| [RootServerInfo.@Nullable ServerIndex](../../RootServerInfo.md#serverindex) | serverIndex
optional. Note: this will override the value in apiConfiguration | +| [FakePostSecurityInfo.@Nullable SecurityIndex](../../paths/fake/post/FakePostSecurityInfo.md#securityindex) | securityIndex
optional. Note: this will override the value in apiConfiguration | +| @Nullable Duration | timeout
optional. Note: this will override the value in apiConfiguration | + +## PostRequestBuilder +public static class PostRequestBuilder
+ +a builder for request inputs + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| PostRequestBuilder()
Creates a builder that contains null for all parameters | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| [PostRequest](#postrequest) | build()
Returns the request input used to call an endpoint method | +| [PostRequestBuilder](#postrequestbuilder) | requestBody([FakePostRequestBody.SealedRequestBody](../../paths/fake/post/FakePostRequestBody.md#sealedrequestbody) requestBody)
sets the optional property | +| [PostRequestBuilder](#postrequestbuilder) | serverIndex([RootServerInfo.ServerIndex](../../RootServerInfo.md#serverindex) serverIndex)
sets the optional property. Note: this will override the value in apiConfiguration | +| [PostRequestBuilder](#postrequestbuilder) | securityIndex([FakePostSecurityInfo.SecurityIndex](../../paths/fake/post/FakePostSecurityInfo.md#securityindex) securityIndex)
sets the optional property. Note: this will override the value in apiConfiguration | +| [PostRequestBuilder](#postrequestbuilder) | timeout(Duration timeout)
sets the optional property. Note: this will override the value in apiConfiguration | + +[[Back to top]](#top) [[Back to README]](../../../README.md) diff --git a/samples/client/petstore/kotlin/docs/paths/fake/delete/FakeDeleteHeaderParameters.md b/samples/client/petstore/kotlin/docs/paths/fake/delete/FakeDeleteHeaderParameters.md new file mode 100644 index 00000000000..d1eb380fba6 --- /dev/null +++ b/samples/client/petstore/kotlin/docs/paths/fake/delete/FakeDeleteHeaderParameters.md @@ -0,0 +1,274 @@ +# FakeDeleteHeaderParameters +public class FakeDeleteHeaderParameters
+ +A class that contains necessary nested +- schema classes (which validate payloads), extends JsonSchema +- sealed interfaces which store validated payloads, java version of a sum type +- boxed classes which store validated payloads, sealed permits class implementations +- classes to store validated map payloads, extends FrozenMap +- classes to build inputs for map payloads + +## Nested Class Summary +| Modifier and Type | Class and Description | +| ----------------- | ---------------------- | +| sealed interface | [FakeDeleteHeaderParameters.FakeDeleteHeaderParameters1Boxed](#fakedeleteheaderparameters1boxed)
sealed interface for validated payloads | +| record | [FakeDeleteHeaderParameters.FakeDeleteHeaderParameters1BoxedMap](#fakedeleteheaderparameters1boxedmap)
boxed class to store validated Map payloads | +| static class | [FakeDeleteHeaderParameters.FakeDeleteHeaderParameters1](#fakedeleteheaderparameters1)
schema class | +| static class | [FakeDeleteHeaderParameters.HeaderParametersMapBuilder](#headerparametersmapbuilder)
builder for Map payloads | +| static class | [FakeDeleteHeaderParameters.HeaderParametersMap](#headerparametersmap)
output class for Map payloads | +| sealed interface | [FakeDeleteHeaderParameters.AdditionalPropertiesBoxed](#additionalpropertiesboxed)
sealed interface for validated payloads | +| record | [FakeDeleteHeaderParameters.AdditionalPropertiesBoxedVoid](#additionalpropertiesboxedvoid)
boxed class to store validated null payloads | +| record | [FakeDeleteHeaderParameters.AdditionalPropertiesBoxedBoolean](#additionalpropertiesboxedboolean)
boxed class to store validated boolean payloads | +| record | [FakeDeleteHeaderParameters.AdditionalPropertiesBoxedNumber](#additionalpropertiesboxednumber)
boxed class to store validated Number payloads | +| record | [FakeDeleteHeaderParameters.AdditionalPropertiesBoxedString](#additionalpropertiesboxedstring)
boxed class to store validated String payloads | +| record | [FakeDeleteHeaderParameters.AdditionalPropertiesBoxedList](#additionalpropertiesboxedlist)
boxed class to store validated List payloads | +| record | [FakeDeleteHeaderParameters.AdditionalPropertiesBoxedMap](#additionalpropertiesboxedmap)
boxed class to store validated Map payloads | +| static class | [FakeDeleteHeaderParameters.AdditionalProperties](#additionalproperties)
schema class | + +## FakeDeleteHeaderParameters1Boxed +public sealed interface FakeDeleteHeaderParameters1Boxed
+permits
+[FakeDeleteHeaderParameters1BoxedMap](#fakedeleteheaderparameters1boxedmap) + +sealed interface that stores validated payloads using boxed classes + +## FakeDeleteHeaderParameters1BoxedMap +public record FakeDeleteHeaderParameters1BoxedMap
+implements [FakeDeleteHeaderParameters1Boxed](#fakedeleteheaderparameters1boxed) + +record that stores validated Map payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| FakeDeleteHeaderParameters1BoxedMap([HeaderParametersMap](#headerparametersmap) data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| [HeaderParametersMap](#headerparametersmap) | data()
validated payload | +| @Nullable Object | getData()
validated payload | + +## FakeDeleteHeaderParameters1 +public static class FakeDeleteHeaderParameters1
+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.fake.delete.FakeDeleteHeaderParameters; + +import java.util.Arrays; +import java.util.List; +import java.util.AbstractMap; + +static final SchemaConfiguration configuration = new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().build()); + +// Map validation +FakeDeleteHeaderParameters.HeaderParametersMap validatedPayload = + FakeDeleteHeaderParameters.FakeDeleteHeaderParameters1.validate( + new FakeDeleteHeaderParameters.HeaderParametersMapBuilder() + .required_boolean_group("true") + + .boolean_group("true") + + .build(), + configuration +); +``` + +### Field Summary +| Modifier and Type | Field and Description | +| ----------------- | ---------------------- | +| Set> | type = Set.of(Map.class) | +| Map> | properties = Map.ofEntries(
    new PropertyEntry("required_boolean_group", [Schema1.Schema11.class](../../../paths/fake/delete/parameters/parameter1/Schema1.md#schema11)),
    new PropertyEntry("boolean_group", [Schema4.Schema41.class](../../../paths/fake/delete/parameters/parameter4/Schema4.md#schema41))
)
| +| Set | required = Set.of(
    "required_boolean_group"
)
| +| Class | additionalProperties = [AdditionalProperties.class](#additionalproperties) | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| [HeaderParametersMap](#headerparametersmap) | validate([Map<?, ?>](#headerparametersmapbuilder) arg, SchemaConfiguration configuration) | +| [FakeDeleteHeaderParameters1BoxedMap](#fakedeleteheaderparameters1boxedmap) | validateAndBox([Map<?, ?>](#headerparametersmapbuilder) arg, SchemaConfiguration configuration) | +| [FakeDeleteHeaderParameters1Boxed](#fakedeleteheaderparameters1boxed) | validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) | +| @Nullable Object | validate(@Nullable Object arg, SchemaConfiguration configuration) | + +## HeaderParametersMap0Builder +public class HeaderParametersMap0Builder
+builder for `Map` + +A class that builds the Map input type + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| HeaderParametersMap0Builder(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 | +| [HeaderParametersMap0Builder](#headerparametersmap0builder) | boolean_group(String value) | +| [HeaderParametersMap0Builder](#headerparametersmap0builder) | boolean_group([Schema4.StringSchemaEnums4](../../../paths/fake/delete/parameters/parameter4/Schema4.md#stringschemaenums4) value) | + +## HeaderParametersMapBuilder +public class HeaderParametersMapBuilder
+builder for `Map` + +A class that builds the Map input type + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| HeaderParametersMapBuilder()
Creates a builder that contains an empty map | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| [HeaderParametersMap0Builder](#headerparametersmap0builder) | required_boolean_group(String value) | +| [HeaderParametersMap0Builder](#headerparametersmap0builder) | required_boolean_group([Schema1.StringSchemaEnums1](../../../paths/fake/delete/parameters/parameter1/Schema1.md#stringschemaenums1) value) | + +## HeaderParametersMap +public static class HeaderParametersMap
+extends FrozenMap + +A class to store validated Map payloads + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| static [HeaderParametersMap](#headerparametersmap) | of([Map](#headerparametersmapbuilder) arg, SchemaConfiguration configuration) | +| String | required_boolean_group()
| +| String | boolean_group()
[optional] | + +## 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(Nothing? data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| Nothing? | 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/kotlin/docs/paths/fake/delete/FakeDeleteQueryParameters.md b/samples/client/petstore/kotlin/docs/paths/fake/delete/FakeDeleteQueryParameters.md new file mode 100644 index 00000000000..f3438757587 --- /dev/null +++ b/samples/client/petstore/kotlin/docs/paths/fake/delete/FakeDeleteQueryParameters.md @@ -0,0 +1,321 @@ +# FakeDeleteQueryParameters +public class FakeDeleteQueryParameters
+ +A class that contains necessary nested +- schema classes (which validate payloads), extends JsonSchema +- sealed interfaces which store validated payloads, java version of a sum type +- boxed classes which store validated payloads, sealed permits class implementations +- classes to store validated map payloads, extends FrozenMap +- classes to build inputs for map payloads + +## Nested Class Summary +| Modifier and Type | Class and Description | +| ----------------- | ---------------------- | +| sealed interface | [FakeDeleteQueryParameters.FakeDeleteQueryParameters1Boxed](#fakedeletequeryparameters1boxed)
sealed interface for validated payloads | +| record | [FakeDeleteQueryParameters.FakeDeleteQueryParameters1BoxedMap](#fakedeletequeryparameters1boxedmap)
boxed class to store validated Map payloads | +| static class | [FakeDeleteQueryParameters.FakeDeleteQueryParameters1](#fakedeletequeryparameters1)
schema class | +| static class | [FakeDeleteQueryParameters.QueryParametersMapBuilder](#queryparametersmapbuilder)
builder for Map payloads | +| static class | [FakeDeleteQueryParameters.QueryParametersMap](#queryparametersmap)
output class for Map payloads | +| sealed interface | [FakeDeleteQueryParameters.AdditionalPropertiesBoxed](#additionalpropertiesboxed)
sealed interface for validated payloads | +| record | [FakeDeleteQueryParameters.AdditionalPropertiesBoxedVoid](#additionalpropertiesboxedvoid)
boxed class to store validated null payloads | +| record | [FakeDeleteQueryParameters.AdditionalPropertiesBoxedBoolean](#additionalpropertiesboxedboolean)
boxed class to store validated boolean payloads | +| record | [FakeDeleteQueryParameters.AdditionalPropertiesBoxedNumber](#additionalpropertiesboxednumber)
boxed class to store validated Number payloads | +| record | [FakeDeleteQueryParameters.AdditionalPropertiesBoxedString](#additionalpropertiesboxedstring)
boxed class to store validated String payloads | +| record | [FakeDeleteQueryParameters.AdditionalPropertiesBoxedList](#additionalpropertiesboxedlist)
boxed class to store validated List payloads | +| record | [FakeDeleteQueryParameters.AdditionalPropertiesBoxedMap](#additionalpropertiesboxedmap)
boxed class to store validated Map payloads | +| static class | [FakeDeleteQueryParameters.AdditionalProperties](#additionalproperties)
schema class | + +## FakeDeleteQueryParameters1Boxed +public sealed interface FakeDeleteQueryParameters1Boxed
+permits
+[FakeDeleteQueryParameters1BoxedMap](#fakedeletequeryparameters1boxedmap) + +sealed interface that stores validated payloads using boxed classes + +## FakeDeleteQueryParameters1BoxedMap +public record FakeDeleteQueryParameters1BoxedMap
+implements [FakeDeleteQueryParameters1Boxed](#fakedeletequeryparameters1boxed) + +record that stores validated Map payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| FakeDeleteQueryParameters1BoxedMap([QueryParametersMap](#queryparametersmap) data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| [QueryParametersMap](#queryparametersmap) | data()
validated payload | +| @Nullable Object | getData()
validated payload | + +## FakeDeleteQueryParameters1 +public static class FakeDeleteQueryParameters1
+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.fake.delete.FakeDeleteQueryParameters; + +import java.util.Arrays; +import java.util.List; +import java.util.AbstractMap; + +static final SchemaConfiguration configuration = new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().build()); + +// Map validation +FakeDeleteQueryParameters.QueryParametersMap validatedPayload = + FakeDeleteQueryParameters.FakeDeleteQueryParameters1.validate( + new FakeDeleteQueryParameters.QueryParametersMapBuilder() + .required_int64_group(1L) + + .required_string_group("a") + + .int64_group(1L) + + .string_group("a") + + .build(), + configuration +); +``` + +### Field Summary +| Modifier and Type | Field and Description | +| ----------------- | ---------------------- | +| Set> | type = Set.of(Map.class) | +| Map> | properties = Map.ofEntries(
    new PropertyEntry("required_string_group", [Schema0.Schema01.class](../../../paths/fake/delete/parameters/parameter0/Schema0.md#schema01)),
    new PropertyEntry("int64_group", [Schema5.Schema51.class](../../../paths/fake/delete/parameters/parameter5/Schema5.md#schema51)),
    new PropertyEntry("string_group", [Schema3.Schema31.class](../../../paths/fake/delete/parameters/parameter3/Schema3.md#schema31)),
    new PropertyEntry("required_int64_group", [Schema2.Schema21.class](../../../paths/fake/delete/parameters/parameter2/Schema2.md#schema21))
)
| +| Set | required = Set.of(
    "required_int64_group",
    "required_string_group"
)
| +| Class | additionalProperties = [AdditionalProperties.class](#additionalproperties) | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| [QueryParametersMap](#queryparametersmap) | validate([Map<?, ?>](#queryparametersmapbuilder) arg, SchemaConfiguration configuration) | +| [FakeDeleteQueryParameters1BoxedMap](#fakedeletequeryparameters1boxedmap) | validateAndBox([Map<?, ?>](#queryparametersmapbuilder) arg, SchemaConfiguration configuration) | +| [FakeDeleteQueryParameters1Boxed](#fakedeletequeryparameters1boxed) | validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) | +| @Nullable Object | validate(@Nullable Object arg, SchemaConfiguration configuration) | + +## QueryParametersMap00Builder +public class QueryParametersMap00Builder
+builder for `Map` + +A class that builds the Map input type + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| QueryParametersMap00Builder(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 | +| [QueryParametersMap00Builder](#queryparametersmap00builder) | int64_group(int value) | +| [QueryParametersMap00Builder](#queryparametersmap00builder) | int64_group(float value) | +| [QueryParametersMap00Builder](#queryparametersmap00builder) | int64_group(long value) | +| [QueryParametersMap00Builder](#queryparametersmap00builder) | int64_group(double value) | +| [QueryParametersMap00Builder](#queryparametersmap00builder) | string_group(String value) | + +## QueryParametersMap01Builder +public class QueryParametersMap01Builder
+builder for `Map` + +A class that builds the Map input type + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| QueryParametersMap01Builder(Map instance)
Creates a builder that contains the passed instance | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| [QueryParametersMap00Builder](#queryparametersmap00builder) | required_string_group(String value) | + +## QueryParametersMap10Builder +public class QueryParametersMap10Builder
+builder for `Map` + +A class that builds the Map input type + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| QueryParametersMap10Builder(Map instance)
Creates a builder that contains the passed instance | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| [QueryParametersMap00Builder](#queryparametersmap00builder) | required_int64_group(int value) | +| [QueryParametersMap00Builder](#queryparametersmap00builder) | required_int64_group(float value) | +| [QueryParametersMap00Builder](#queryparametersmap00builder) | required_int64_group(long value) | +| [QueryParametersMap00Builder](#queryparametersmap00builder) | required_int64_group(double value) | + +## QueryParametersMapBuilder +public class QueryParametersMapBuilder
+builder for `Map` + +A class that builds the Map input type + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| QueryParametersMapBuilder()
Creates a builder that contains an empty map | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| [QueryParametersMap01Builder](#queryparametersmap01builder) | required_int64_group(int value) | +| [QueryParametersMap01Builder](#queryparametersmap01builder) | required_int64_group(float value) | +| [QueryParametersMap01Builder](#queryparametersmap01builder) | required_int64_group(long value) | +| [QueryParametersMap01Builder](#queryparametersmap01builder) | required_int64_group(double value) | +| [QueryParametersMap10Builder](#queryparametersmap10builder) | required_string_group(String value) | + +## QueryParametersMap +public static class QueryParametersMap
+extends FrozenMap + +A class to store validated Map payloads + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| static [QueryParametersMap](#queryparametersmap) | of([Map](#queryparametersmapbuilder) arg, SchemaConfiguration configuration) | +| Number | required_int64_group()
| +| String | required_string_group()
| +| Number | int64_group()
[optional] | +| String | string_group()
[optional] | + +## 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(Nothing? data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| Nothing? | 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/kotlin/docs/paths/fake/delete/FakeDeleteResponses.md b/samples/client/petstore/kotlin/docs/paths/fake/delete/FakeDeleteResponses.md new file mode 100644 index 00000000000..f4c06c8a474 --- /dev/null +++ b/samples/client/petstore/kotlin/docs/paths/fake/delete/FakeDeleteResponses.md @@ -0,0 +1,29 @@ +# FakeDeleteResponses + +public class FakeDeleteResponses + +A class that contains necessary responses classes +- a sealed interface, EndpointResponse, that stores endpoint responses +- records for each endpoint response + +## Nested Class Summary +| Modifier and Type | Class and Description | +| ----------------- | --------------------- | +| sealed interface | [EndpointResponse](#endpointresponse)
stores the endpoint responses | +| record | [EndpointFakeDeleteCode200Response](#endpointfakedeletecode200response)
the response for 200 | + +## EndpointResponse +public sealed interface EndpointResponse permits
+[EndpointFakeDeleteCode200Response](#endpointfakedeletecode200response) + +a sealed interface that stores endpoint responses + +## EndpointFakeDeleteCode200Response +public record EndpointFakeDeleteCode200Response( + HttpResponse response, + Nothing? body, + Nothing? headers +) implements EndpointResponse, ApiResponse
+ +a class that stores an endpoint response + diff --git a/samples/client/petstore/kotlin/docs/paths/fake/delete/FakeDeleteSecurityInfo.md b/samples/client/petstore/kotlin/docs/paths/fake/delete/FakeDeleteSecurityInfo.md new file mode 100644 index 00000000000..7c008b766c7 --- /dev/null +++ b/samples/client/petstore/kotlin/docs/paths/fake/delete/FakeDeleteSecurityInfo.md @@ -0,0 +1,40 @@ +# FakeDeleteSecurityInfo +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 +- an enum class that describes security index values + +## Nested Class Summary +| Modifier and Type | Class and Description | +| ----------------- | --------------------- | +| static class | [FakeDeleteSecurityInfo.FakeDeleteSecurityInfo1](#fakedeletesecurityinfo1)
SecurityRequirementObjectProvider +| enum | [FakeDeleteSecurityInfo.SecurityIndex](#securityindex)
class that stores a security index | + +## FakeDeleteSecurityInfo1 +implements SecurityRequirementObjectProvider<[SecurityIndex](#securityindex)> + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| FakeDeleteSecurityInfo1()
Creates an instance | + +### Field Summary +| Modifier and Type | Field and Description | +| ----------------- | --------------------- | +| [FakeDeleteSecurityRequirementObject0](../../../paths/fake/delete/security/FakeDeleteSecurityRequirementObject0.md) | security0 | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| SecurityRequirementObject | getSecurityRequirementObject(@Nullable [SecurityIndex](#securityindex) securityIndex)
If null is input, then the instance's securityIndex will be used | + +## SecurityIndex +enum SecurityIndex
+ +### Enum Constant Summary +| Enum Constant And Description | +| ----------------------------- | +| SECURITY_0
security 0 | diff --git a/samples/client/petstore/kotlin/docs/paths/fake/delete/parameters/parameter0/Schema0.md b/samples/client/petstore/kotlin/docs/paths/fake/delete/parameters/parameter0/Schema0.md new file mode 100644 index 00000000000..9ff90e0bc35 --- /dev/null +++ b/samples/client/petstore/kotlin/docs/paths/fake/delete/parameters/parameter0/Schema0.md @@ -0,0 +1,49 @@ +# Schema0 +public class Schema0
+ +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 + +## Nested Class Summary +| Modifier and Type | Class and Description | +| ----------------- | ---------------------- | +| sealed interface | [Schema0.Schema01Boxed](#schema01boxed)
sealed interface for validated payloads | +| record | [Schema0.Schema01BoxedString](#schema01boxedstring)
boxed class to store validated String payloads | +| static class | [Schema0.Schema01](#schema01)
schema class | + +## Schema01Boxed +public sealed interface Schema01Boxed
+permits
+[Schema01BoxedString](#schema01boxedstring) + +sealed interface that stores validated payloads using boxed classes + +## Schema01BoxedString +public record Schema01BoxedString
+implements [Schema01Boxed](#schema01boxed) + +record that stores validated String payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| Schema01BoxedString(String data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| String | data()
validated payload | +| @Nullable Object | getData()
validated payload | + +## Schema01 +public static class Schema01
+extends StringJsonSchema.StringJsonSchema1 + +A schema class that validates payloads + +| Methods Inherited from class org.openapijsonschematools.client.schemas.StringJsonSchema.StringJsonSchema1 | +| ------------------------------------------------------------------ | +| validate | +| validateAndBox | diff --git a/samples/client/petstore/kotlin/docs/paths/fake/delete/parameters/parameter1/Schema1.md b/samples/client/petstore/kotlin/docs/paths/fake/delete/parameters/parameter1/Schema1.md new file mode 100644 index 00000000000..8f952c2caf2 --- /dev/null +++ b/samples/client/petstore/kotlin/docs/paths/fake/delete/parameters/parameter1/Schema1.md @@ -0,0 +1,96 @@ +# Schema1 +public class Schema1
+ +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 +- enum classes + +## Nested Class Summary +| Modifier and Type | Class and Description | +| ----------------- | ---------------------- | +| sealed interface | [Schema1.Schema11Boxed](#schema11boxed)
sealed interface for validated payloads | +| record | [Schema1.Schema11BoxedString](#schema11boxedstring)
boxed class to store validated String payloads | +| static class | [Schema1.Schema11](#schema11)
schema class | +| enum | [Schema1.StringSchemaEnums1](#stringschemaenums1)
String enum | + +## Schema11Boxed +public sealed interface Schema11Boxed
+permits
+[Schema11BoxedString](#schema11boxedstring) + +sealed interface that stores validated payloads using boxed classes + +## Schema11BoxedString +public record Schema11BoxedString
+implements [Schema11Boxed](#schema11boxed) + +record that stores validated String payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| Schema11BoxedString(String data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| String | data()
validated payload | +| @Nullable Object | getData()
validated payload | + +## Schema11 +public static class Schema11
+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.fake.delete.parameters.parameter1.Schema1; + +import java.util.Arrays; +import java.util.List; +import java.util.AbstractMap; + +static final SchemaConfiguration configuration = new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().build()); + +// String validation +String validatedPayload = Schema1.Schema11.validate( + "true", + configuration +); +``` + +### Field Summary +| Modifier and Type | Field and Description | +| ----------------- | ---------------------- | +| Set> | type = Set.of(
    String.class
)
| +| Set | enumValues = SetMaker.makeSet(
    "true",
    "false"
)
| + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| String | validate(String arg, SchemaConfiguration configuration) | +| String | validate([StringSchemaEnums1](#stringschemaenums1) arg, SchemaConfiguration configuration) | +| [Schema11BoxedString](#schema11boxedstring) | validateAndBox(String arg, SchemaConfiguration configuration) | +| [Schema11Boxed](#schema11boxed) | validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) | +| @Nullable Object | validate(@Nullable Object arg, SchemaConfiguration configuration) | + +## StringSchemaEnums1 +public enum StringSchemaEnums1
+extends `Enum` + +A class that stores String enum values + +### Enum Constant Summary +| Enum Constant | Description | +| ------------- | ----------- | +| TRUE | value = "true" | +| FALSE | value = "false" | diff --git a/samples/client/petstore/kotlin/docs/paths/fake/delete/parameters/parameter2/Schema2.md b/samples/client/petstore/kotlin/docs/paths/fake/delete/parameters/parameter2/Schema2.md new file mode 100644 index 00000000000..440bb8ca283 --- /dev/null +++ b/samples/client/petstore/kotlin/docs/paths/fake/delete/parameters/parameter2/Schema2.md @@ -0,0 +1,49 @@ +# Schema2 +public class Schema2
+ +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 + +## Nested Class Summary +| Modifier and Type | Class and Description | +| ----------------- | ---------------------- | +| sealed interface | [Schema2.Schema21Boxed](#schema21boxed)
sealed interface for validated payloads | +| record | [Schema2.Schema21BoxedNumber](#schema21boxednumber)
boxed class to store validated Number payloads | +| static class | [Schema2.Schema21](#schema21)
schema class | + +## Schema21Boxed +public sealed interface Schema21Boxed
+permits
+[Schema21BoxedNumber](#schema21boxednumber) + +sealed interface that stores validated payloads using boxed classes + +## Schema21BoxedNumber +public record Schema21BoxedNumber
+implements [Schema21Boxed](#schema21boxed) + +record that stores validated Number payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| Schema21BoxedNumber(Number data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| Number | data()
validated payload | +| @Nullable Object | getData()
validated payload | + +## Schema21 +public static class Schema21
+extends Int64JsonSchema.Int64JsonSchema1 + +A schema class that validates payloads + +| Methods Inherited from class org.openapijsonschematools.client.schemas.Int64JsonSchema.Int64JsonSchema1 | +| ------------------------------------------------------------------ | +| validate | +| validateAndBox | diff --git a/samples/client/petstore/kotlin/docs/paths/fake/delete/parameters/parameter3/Schema3.md b/samples/client/petstore/kotlin/docs/paths/fake/delete/parameters/parameter3/Schema3.md new file mode 100644 index 00000000000..41d54a1d930 --- /dev/null +++ b/samples/client/petstore/kotlin/docs/paths/fake/delete/parameters/parameter3/Schema3.md @@ -0,0 +1,49 @@ +# Schema3 +public class Schema3
+ +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 + +## Nested Class Summary +| Modifier and Type | Class and Description | +| ----------------- | ---------------------- | +| sealed interface | [Schema3.Schema31Boxed](#schema31boxed)
sealed interface for validated payloads | +| record | [Schema3.Schema31BoxedString](#schema31boxedstring)
boxed class to store validated String payloads | +| static class | [Schema3.Schema31](#schema31)
schema class | + +## Schema31Boxed +public sealed interface Schema31Boxed
+permits
+[Schema31BoxedString](#schema31boxedstring) + +sealed interface that stores validated payloads using boxed classes + +## Schema31BoxedString +public record Schema31BoxedString
+implements [Schema31Boxed](#schema31boxed) + +record that stores validated String payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| Schema31BoxedString(String data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| String | data()
validated payload | +| @Nullable Object | getData()
validated payload | + +## Schema31 +public static class Schema31
+extends StringJsonSchema.StringJsonSchema1 + +A schema class that validates payloads + +| Methods Inherited from class org.openapijsonschematools.client.schemas.StringJsonSchema.StringJsonSchema1 | +| ------------------------------------------------------------------ | +| validate | +| validateAndBox | diff --git a/samples/client/petstore/kotlin/docs/paths/fake/delete/parameters/parameter4/Schema4.md b/samples/client/petstore/kotlin/docs/paths/fake/delete/parameters/parameter4/Schema4.md new file mode 100644 index 00000000000..deb5749b4c6 --- /dev/null +++ b/samples/client/petstore/kotlin/docs/paths/fake/delete/parameters/parameter4/Schema4.md @@ -0,0 +1,96 @@ +# Schema4 +public class Schema4
+ +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 +- enum classes + +## Nested Class Summary +| Modifier and Type | Class and Description | +| ----------------- | ---------------------- | +| sealed interface | [Schema4.Schema41Boxed](#schema41boxed)
sealed interface for validated payloads | +| record | [Schema4.Schema41BoxedString](#schema41boxedstring)
boxed class to store validated String payloads | +| static class | [Schema4.Schema41](#schema41)
schema class | +| enum | [Schema4.StringSchemaEnums4](#stringschemaenums4)
String enum | + +## Schema41Boxed +public sealed interface Schema41Boxed
+permits
+[Schema41BoxedString](#schema41boxedstring) + +sealed interface that stores validated payloads using boxed classes + +## Schema41BoxedString +public record Schema41BoxedString
+implements [Schema41Boxed](#schema41boxed) + +record that stores validated String payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| Schema41BoxedString(String data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| String | data()
validated payload | +| @Nullable Object | getData()
validated payload | + +## Schema41 +public static class Schema41
+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.fake.delete.parameters.parameter4.Schema4; + +import java.util.Arrays; +import java.util.List; +import java.util.AbstractMap; + +static final SchemaConfiguration configuration = new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().build()); + +// String validation +String validatedPayload = Schema4.Schema41.validate( + "true", + configuration +); +``` + +### Field Summary +| Modifier and Type | Field and Description | +| ----------------- | ---------------------- | +| Set> | type = Set.of(
    String.class
)
| +| Set | enumValues = SetMaker.makeSet(
    "true",
    "false"
)
| + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| String | validate(String arg, SchemaConfiguration configuration) | +| String | validate([StringSchemaEnums4](#stringschemaenums4) arg, SchemaConfiguration configuration) | +| [Schema41BoxedString](#schema41boxedstring) | validateAndBox(String arg, SchemaConfiguration configuration) | +| [Schema41Boxed](#schema41boxed) | validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) | +| @Nullable Object | validate(@Nullable Object arg, SchemaConfiguration configuration) | + +## StringSchemaEnums4 +public enum StringSchemaEnums4
+extends `Enum` + +A class that stores String enum values + +### Enum Constant Summary +| Enum Constant | Description | +| ------------- | ----------- | +| TRUE | value = "true" | +| FALSE | value = "false" | diff --git a/samples/client/petstore/kotlin/docs/paths/fake/delete/parameters/parameter5/Schema5.md b/samples/client/petstore/kotlin/docs/paths/fake/delete/parameters/parameter5/Schema5.md new file mode 100644 index 00000000000..9611a34edb2 --- /dev/null +++ b/samples/client/petstore/kotlin/docs/paths/fake/delete/parameters/parameter5/Schema5.md @@ -0,0 +1,49 @@ +# Schema5 +public class Schema5
+ +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 + +## Nested Class Summary +| Modifier and Type | Class and Description | +| ----------------- | ---------------------- | +| sealed interface | [Schema5.Schema51Boxed](#schema51boxed)
sealed interface for validated payloads | +| record | [Schema5.Schema51BoxedNumber](#schema51boxednumber)
boxed class to store validated Number payloads | +| static class | [Schema5.Schema51](#schema51)
schema class | + +## Schema51Boxed +public sealed interface Schema51Boxed
+permits
+[Schema51BoxedNumber](#schema51boxednumber) + +sealed interface that stores validated payloads using boxed classes + +## Schema51BoxedNumber +public record Schema51BoxedNumber
+implements [Schema51Boxed](#schema51boxed) + +record that stores validated Number payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| Schema51BoxedNumber(Number data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| Number | data()
validated payload | +| @Nullable Object | getData()
validated payload | + +## Schema51 +public static class Schema51
+extends Int64JsonSchema.Int64JsonSchema1 + +A schema class that validates payloads + +| Methods Inherited from class org.openapijsonschematools.client.schemas.Int64JsonSchema.Int64JsonSchema1 | +| ------------------------------------------------------------------ | +| validate | +| validateAndBox | diff --git a/samples/client/petstore/kotlin/docs/paths/fake/delete/responses/FakeDeleteCode200Response.md b/samples/client/petstore/kotlin/docs/paths/fake/delete/responses/FakeDeleteCode200Response.md new file mode 100644 index 00000000000..64d63ac41a4 --- /dev/null +++ b/samples/client/petstore/kotlin/docs/paths/fake/delete/responses/FakeDeleteCode200Response.md @@ -0,0 +1,17 @@ +# FakeDeleteCode200Response + +public class FakeDeleteCode200Response extends [SuccessDescriptionOnly](../../components/responses/SuccessDescriptionOnly.md) + +A class (extended from the $ref class) that contains necessary nested response classes +- a class that extends ResponseDeserializer and is used to deserialize responses + +## Nested Class Summary +| Modifier and Type | Class and Description | +| ----------------- | --------------------- | +| static class | [FakeDeleteCode200Response.FakeDeleteCode200Response1](#fakedeletecode200response1)
class that deserializes responses | + +## FakeDeleteCode200Response1 +public static class FakeDeleteCode200Response1 extends [SuccessDescriptionOnly1](../../components/responses/SuccessDescriptionOnly.md#successdescriptiononly1)
+ +a class that deserializes responses, extended from the $ref class + diff --git a/samples/client/petstore/kotlin/docs/paths/fake/delete/security/FakeDeleteSecurityRequirementObject0.md b/samples/client/petstore/kotlin/docs/paths/fake/delete/security/FakeDeleteSecurityRequirementObject0.md new file mode 100644 index 00000000000..ce14db9f6b9 --- /dev/null +++ b/samples/client/petstore/kotlin/docs/paths/fake/delete/security/FakeDeleteSecurityRequirementObject0.md @@ -0,0 +1,15 @@ +# FakeDeleteSecurityRequirementObject0 +FakeDeleteSecurityRequirementObject0.java + +public class FakeDeleteSecurityRequirementObject0 +extends SecurityRequirementObject + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| FakeDeleteSecurityRequirementObject0()
Creates an instance | + +### 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()
    )) | diff --git a/samples/client/petstore/kotlin/docs/paths/fake/get/FakeGetHeaderParameters.md b/samples/client/petstore/kotlin/docs/paths/fake/get/FakeGetHeaderParameters.md new file mode 100644 index 00000000000..3d5df92bc19 --- /dev/null +++ b/samples/client/petstore/kotlin/docs/paths/fake/get/FakeGetHeaderParameters.md @@ -0,0 +1,260 @@ +# FakeGetHeaderParameters +public class FakeGetHeaderParameters
+ +A class that contains necessary nested +- schema classes (which validate payloads), extends JsonSchema +- sealed interfaces which store validated payloads, java version of a sum type +- boxed classes which store validated payloads, sealed permits class implementations +- classes to store validated map payloads, extends FrozenMap +- classes to build inputs for map payloads + +## Nested Class Summary +| Modifier and Type | Class and Description | +| ----------------- | ---------------------- | +| sealed interface | [FakeGetHeaderParameters.FakeGetHeaderParameters1Boxed](#fakegetheaderparameters1boxed)
sealed interface for validated payloads | +| record | [FakeGetHeaderParameters.FakeGetHeaderParameters1BoxedMap](#fakegetheaderparameters1boxedmap)
boxed class to store validated Map payloads | +| static class | [FakeGetHeaderParameters.FakeGetHeaderParameters1](#fakegetheaderparameters1)
schema class | +| static class | [FakeGetHeaderParameters.HeaderParametersMapBuilder](#headerparametersmapbuilder)
builder for Map payloads | +| static class | [FakeGetHeaderParameters.HeaderParametersMap](#headerparametersmap)
output class for Map payloads | +| sealed interface | [FakeGetHeaderParameters.AdditionalPropertiesBoxed](#additionalpropertiesboxed)
sealed interface for validated payloads | +| record | [FakeGetHeaderParameters.AdditionalPropertiesBoxedVoid](#additionalpropertiesboxedvoid)
boxed class to store validated null payloads | +| record | [FakeGetHeaderParameters.AdditionalPropertiesBoxedBoolean](#additionalpropertiesboxedboolean)
boxed class to store validated boolean payloads | +| record | [FakeGetHeaderParameters.AdditionalPropertiesBoxedNumber](#additionalpropertiesboxednumber)
boxed class to store validated Number payloads | +| record | [FakeGetHeaderParameters.AdditionalPropertiesBoxedString](#additionalpropertiesboxedstring)
boxed class to store validated String payloads | +| record | [FakeGetHeaderParameters.AdditionalPropertiesBoxedList](#additionalpropertiesboxedlist)
boxed class to store validated List payloads | +| record | [FakeGetHeaderParameters.AdditionalPropertiesBoxedMap](#additionalpropertiesboxedmap)
boxed class to store validated Map payloads | +| static class | [FakeGetHeaderParameters.AdditionalProperties](#additionalproperties)
schema class | + +## FakeGetHeaderParameters1Boxed +public sealed interface FakeGetHeaderParameters1Boxed
+permits
+[FakeGetHeaderParameters1BoxedMap](#fakegetheaderparameters1boxedmap) + +sealed interface that stores validated payloads using boxed classes + +## FakeGetHeaderParameters1BoxedMap +public record FakeGetHeaderParameters1BoxedMap
+implements [FakeGetHeaderParameters1Boxed](#fakegetheaderparameters1boxed) + +record that stores validated Map payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| FakeGetHeaderParameters1BoxedMap([HeaderParametersMap](#headerparametersmap) data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| [HeaderParametersMap](#headerparametersmap) | data()
validated payload | +| @Nullable Object | getData()
validated payload | + +## FakeGetHeaderParameters1 +public static class FakeGetHeaderParameters1
+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.fake.get.FakeGetHeaderParameters; + +import java.util.Arrays; +import java.util.List; +import java.util.AbstractMap; + +static final SchemaConfiguration configuration = new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().build()); + +// Map validation +FakeGetHeaderParameters.HeaderParametersMap validatedPayload = + FakeGetHeaderParameters.FakeGetHeaderParameters1.validate( + new FakeGetHeaderParameters.HeaderParametersMapBuilder() + .enum_header_string("_abc") + + .enum_header_string_array( + Arrays.asList( + ">" + ) + ) + .build(), + configuration +); +``` + +### Field Summary +| Modifier and Type | Field and Description | +| ----------------- | ---------------------- | +| Set> | type = Set.of(Map.class) | +| Map> | properties = Map.ofEntries(
    new PropertyEntry("enum_header_string", [Schema1.Schema11.class](../../../paths/fake/get/parameters/parameter1/Schema1.md#schema11)),
    new PropertyEntry("enum_header_string_array", [Schema0.Schema01.class](../../../paths/fake/get/parameters/parameter0/Schema0.md#schema01))
)
| +| Class | additionalProperties = [AdditionalProperties.class](#additionalproperties) | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| [HeaderParametersMap](#headerparametersmap) | validate([Map<?, ?>](#headerparametersmapbuilder) arg, SchemaConfiguration configuration) | +| [FakeGetHeaderParameters1BoxedMap](#fakegetheaderparameters1boxedmap) | validateAndBox([Map<?, ?>](#headerparametersmapbuilder) arg, SchemaConfiguration configuration) | +| [FakeGetHeaderParameters1Boxed](#fakegetheaderparameters1boxed) | validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) | +| @Nullable Object | validate(@Nullable Object arg, SchemaConfiguration configuration) | + +## HeaderParametersMapBuilder +public class HeaderParametersMapBuilder
+builder for `Map` + +A class that builds the Map input type + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| HeaderParametersMapBuilder()
Creates a builder that contains an empty map | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| Map | build()
Returns map input that should be used with Schema.validate | +| [HeaderParametersMapBuilder](#headerparametersmapbuilder) | enum_header_string(String value) | +| [HeaderParametersMapBuilder](#headerparametersmapbuilder) | enum_header_string([Schema1.StringSchemaEnums1](../../../paths/fake/get/parameters/parameter1/Schema1.md#stringschemaenums1) value) | +| [HeaderParametersMapBuilder](#headerparametersmapbuilder) | enum_header_string_array(List value) | + +## HeaderParametersMap +public static class HeaderParametersMap
+extends FrozenMap + +A class to store validated Map payloads + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| static [HeaderParametersMap](#headerparametersmap) | of([Map](#headerparametersmapbuilder) arg, SchemaConfiguration configuration) | +| String | enum_header_string()
[optional] | +| [Schema0.SchemaList0](../../../paths/fake/get/parameters/parameter0/Schema0.md#schemalist0) | enum_header_string_array()
[optional] | + +## 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(Nothing? data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| Nothing? | 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/kotlin/docs/paths/fake/get/FakeGetQueryParameters.md b/samples/client/petstore/kotlin/docs/paths/fake/get/FakeGetQueryParameters.md new file mode 100644 index 00000000000..afeff7e46dc --- /dev/null +++ b/samples/client/petstore/kotlin/docs/paths/fake/get/FakeGetQueryParameters.md @@ -0,0 +1,278 @@ +# FakeGetQueryParameters +public class FakeGetQueryParameters
+ +A class that contains necessary nested +- schema classes (which validate payloads), extends JsonSchema +- sealed interfaces which store validated payloads, java version of a sum type +- boxed classes which store validated payloads, sealed permits class implementations +- classes to store validated map payloads, extends FrozenMap +- classes to build inputs for map payloads + +## Nested Class Summary +| Modifier and Type | Class and Description | +| ----------------- | ---------------------- | +| sealed interface | [FakeGetQueryParameters.FakeGetQueryParameters1Boxed](#fakegetqueryparameters1boxed)
sealed interface for validated payloads | +| record | [FakeGetQueryParameters.FakeGetQueryParameters1BoxedMap](#fakegetqueryparameters1boxedmap)
boxed class to store validated Map payloads | +| static class | [FakeGetQueryParameters.FakeGetQueryParameters1](#fakegetqueryparameters1)
schema class | +| static class | [FakeGetQueryParameters.QueryParametersMapBuilder](#queryparametersmapbuilder)
builder for Map payloads | +| static class | [FakeGetQueryParameters.QueryParametersMap](#queryparametersmap)
output class for Map payloads | +| sealed interface | [FakeGetQueryParameters.AdditionalPropertiesBoxed](#additionalpropertiesboxed)
sealed interface for validated payloads | +| record | [FakeGetQueryParameters.AdditionalPropertiesBoxedVoid](#additionalpropertiesboxedvoid)
boxed class to store validated null payloads | +| record | [FakeGetQueryParameters.AdditionalPropertiesBoxedBoolean](#additionalpropertiesboxedboolean)
boxed class to store validated boolean payloads | +| record | [FakeGetQueryParameters.AdditionalPropertiesBoxedNumber](#additionalpropertiesboxednumber)
boxed class to store validated Number payloads | +| record | [FakeGetQueryParameters.AdditionalPropertiesBoxedString](#additionalpropertiesboxedstring)
boxed class to store validated String payloads | +| record | [FakeGetQueryParameters.AdditionalPropertiesBoxedList](#additionalpropertiesboxedlist)
boxed class to store validated List payloads | +| record | [FakeGetQueryParameters.AdditionalPropertiesBoxedMap](#additionalpropertiesboxedmap)
boxed class to store validated Map payloads | +| static class | [FakeGetQueryParameters.AdditionalProperties](#additionalproperties)
schema class | + +## FakeGetQueryParameters1Boxed +public sealed interface FakeGetQueryParameters1Boxed
+permits
+[FakeGetQueryParameters1BoxedMap](#fakegetqueryparameters1boxedmap) + +sealed interface that stores validated payloads using boxed classes + +## FakeGetQueryParameters1BoxedMap +public record FakeGetQueryParameters1BoxedMap
+implements [FakeGetQueryParameters1Boxed](#fakegetqueryparameters1boxed) + +record that stores validated Map payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| FakeGetQueryParameters1BoxedMap([QueryParametersMap](#queryparametersmap) data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| [QueryParametersMap](#queryparametersmap) | data()
validated payload | +| @Nullable Object | getData()
validated payload | + +## FakeGetQueryParameters1 +public static class FakeGetQueryParameters1
+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.fake.get.FakeGetQueryParameters; + +import java.util.Arrays; +import java.util.List; +import java.util.AbstractMap; + +static final SchemaConfiguration configuration = new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().build()); + +// Map validation +FakeGetQueryParameters.QueryParametersMap validatedPayload = + FakeGetQueryParameters.FakeGetQueryParameters1.validate( + new FakeGetQueryParameters.QueryParametersMapBuilder() + .enum_query_double(3.14d) + + .enum_query_string("_abc") + + .enum_query_integer(1) + + .enum_query_string_array( + Arrays.asList( + ">" + ) + ) + .build(), + configuration +); +``` + +### Field Summary +| Modifier and Type | Field and Description | +| ----------------- | ---------------------- | +| Set> | type = Set.of(Map.class) | +| Map> | properties = Map.ofEntries(
    new PropertyEntry("enum_query_double", [Schema5.Schema51.class](../../../paths/fake/get/parameters/parameter5/Schema5.md#schema51)),
    new PropertyEntry("enum_query_string", [Schema3.Schema31.class](../../../paths/fake/get/parameters/parameter3/Schema3.md#schema31)),
    new PropertyEntry("enum_query_integer", [Schema4.Schema41.class](../../../paths/fake/get/parameters/parameter4/Schema4.md#schema41)),
    new PropertyEntry("enum_query_string_array", [Schema2.Schema21.class](../../../paths/fake/get/parameters/parameter2/Schema2.md#schema21))
)
| +| Class | additionalProperties = [AdditionalProperties.class](#additionalproperties) | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| [QueryParametersMap](#queryparametersmap) | validate([Map<?, ?>](#queryparametersmapbuilder) arg, SchemaConfiguration configuration) | +| [FakeGetQueryParameters1BoxedMap](#fakegetqueryparameters1boxedmap) | validateAndBox([Map<?, ?>](#queryparametersmapbuilder) arg, SchemaConfiguration configuration) | +| [FakeGetQueryParameters1Boxed](#fakegetqueryparameters1boxed) | validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) | +| @Nullable Object | validate(@Nullable Object arg, SchemaConfiguration configuration) | + +## QueryParametersMapBuilder +public class QueryParametersMapBuilder
+builder for `Map` + +A class that builds the Map input type + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| QueryParametersMapBuilder()
Creates a builder that contains an empty map | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| Map | build()
Returns map input that should be used with Schema.validate | +| [QueryParametersMapBuilder](#queryparametersmapbuilder) | enum_query_double(int value) | +| [QueryParametersMapBuilder](#queryparametersmapbuilder) | enum_query_double(float value) | +| [QueryParametersMapBuilder](#queryparametersmapbuilder) | enum_query_double(long value) | +| [QueryParametersMapBuilder](#queryparametersmapbuilder) | enum_query_double(double value) | +| [QueryParametersMapBuilder](#queryparametersmapbuilder) | enum_query_double([Schema5.DoubleSchemaEnums5](../../../paths/fake/get/parameters/parameter5/Schema5.md#doubleschemaenums5) value) | +| [QueryParametersMapBuilder](#queryparametersmapbuilder) | enum_query_double([Schema5.FloatSchemaEnums5](../../../paths/fake/get/parameters/parameter5/Schema5.md#floatschemaenums5) value) | +| [QueryParametersMapBuilder](#queryparametersmapbuilder) | enum_query_string(String value) | +| [QueryParametersMapBuilder](#queryparametersmapbuilder) | enum_query_string([Schema3.StringSchemaEnums3](../../../paths/fake/get/parameters/parameter3/Schema3.md#stringschemaenums3) value) | +| [QueryParametersMapBuilder](#queryparametersmapbuilder) | enum_query_integer(int value) | +| [QueryParametersMapBuilder](#queryparametersmapbuilder) | enum_query_integer(float value) | +| [QueryParametersMapBuilder](#queryparametersmapbuilder) | enum_query_integer([Schema4.IntegerSchemaEnums4](../../../paths/fake/get/parameters/parameter4/Schema4.md#integerschemaenums4) value) | +| [QueryParametersMapBuilder](#queryparametersmapbuilder) | enum_query_integer([Schema4.LongSchemaEnums4](../../../paths/fake/get/parameters/parameter4/Schema4.md#longschemaenums4) value) | +| [QueryParametersMapBuilder](#queryparametersmapbuilder) | enum_query_integer([Schema4.FloatSchemaEnums4](../../../paths/fake/get/parameters/parameter4/Schema4.md#floatschemaenums4) value) | +| [QueryParametersMapBuilder](#queryparametersmapbuilder) | enum_query_integer([Schema4.DoubleSchemaEnums4](../../../paths/fake/get/parameters/parameter4/Schema4.md#doubleschemaenums4) value) | +| [QueryParametersMapBuilder](#queryparametersmapbuilder) | enum_query_string_array(List value) | + +## QueryParametersMap +public static class QueryParametersMap
+extends FrozenMap + +A class to store validated Map payloads + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| static [QueryParametersMap](#queryparametersmap) | of([Map](#queryparametersmapbuilder) arg, SchemaConfiguration configuration) | +| Number | enum_query_double()
[optional] | +| String | enum_query_string()
[optional] | +| Number | enum_query_integer()
[optional] | +| [Schema2.SchemaList2](../../../paths/fake/get/parameters/parameter2/Schema2.md#schemalist2) | enum_query_string_array()
[optional] | + +## 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(Nothing? data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| Nothing? | 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/kotlin/docs/paths/fake/get/FakeGetRequestBody.md b/samples/client/petstore/kotlin/docs/paths/fake/get/FakeGetRequestBody.md new file mode 100644 index 00000000000..7da230c5537 --- /dev/null +++ b/samples/client/petstore/kotlin/docs/paths/fake/get/FakeGetRequestBody.md @@ -0,0 +1,90 @@ +# FakeGetRequestBody + +public class FakeGetRequestBody + +A class that contains necessary nested request body classes +- SealedMediaType, a sealed interface which contains all the schema/encoding info for each contentType +- records which implement SealedMediaType, the concrete media types +- a class that extends RequestBodySerializer and is used to serialize input SealedRequestBody instances +- SealedRequestBody, a sealed interface which contains all the contentType/schema input types +- records which implement SealedRequestBody, the concrete request body types + +## Nested Class Summary +| Modifier and Type | Class and Description | +| ----------------- | --------------------- | +| sealed interface | [FakeGetRequestBody.SealedMediaType](#sealedmediatype)
media type sealed interface | +| record | [FakeGetRequestBody.ApplicationxwwwformurlencodedMediaType](#applicationxwwwformurlencodedmediatype)
record storing schema + encoding for a specific contentType | +| static class | [FakeGetRequestBody.FakeGetRequestBody1](#fakegetrequestbody1)
class that serializes request bodies | +| sealed interface | [FakeGetRequestBody.SealedRequestBody](#sealedrequestbody)
request body sealed interface | +| record | [FakeGetRequestBody.ApplicationxwwwformurlencodedRequestBody](#applicationxwwwformurlencodedrequestbody)
implements sealed interface to store request body input | + +## SealedMediaType +public sealed interface SealedMediaType
+permits
+[ApplicationxwwwformurlencodedMediaType](#applicationxwwwformurlencodedmediatype) + +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), Nothing?> + +class storing schema info for a specific contentType + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| ApplicationxwwwformurlencodedMediaType()
Creates an instance | + +### 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 | +| Nothing? | encoding()
the encoding info | + +## FakeGetRequestBody1 +public static class FakeGetRequestBody1
+ +a class that serializes SealedRequestBody request bodies + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| FakeGetRequestBody1()
Creates an instance | + +### Field Summary +| Modifier and Type | Field and Description | +| ----------------- | --------------------- | +| boolean | required = false
whether the request body is required | +| Map | content = Map.ofEntries(
    new AbstractMap.SimpleEntry<>("application/x-www-form-urlencoded", new [ApplicationxwwwformurlencodedMediaType](#applicationxwwwformurlencodedmediatype)())
)
the contentType to schema info | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| SerializedRequestBody | serialize([SealedRequestBody](#sealedrequestbody) requestBody)
called by endpoint when creating request body bytes | + +## SealedRequestBody +public sealed interface SealedRequestBody
+permits
+[ApplicationxwwwformurlencodedRequestBody](#applicationxwwwformurlencodedrequestbody) + +sealed interface that stores request contentType + validated schema data + +## ApplicationxwwwformurlencodedRequestBody +public record ApplicationxwwwformurlencodedRequestBody
+implements [SealedRequestBody](#sealedrequestbody),
+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 | + +### 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 | diff --git a/samples/client/petstore/kotlin/docs/paths/fake/get/FakeGetResponses.md b/samples/client/petstore/kotlin/docs/paths/fake/get/FakeGetResponses.md new file mode 100644 index 00000000000..5631100ed6d --- /dev/null +++ b/samples/client/petstore/kotlin/docs/paths/fake/get/FakeGetResponses.md @@ -0,0 +1,29 @@ +# FakeGetResponses + +public class FakeGetResponses + +A class that contains necessary responses classes +- a sealed interface, EndpointResponse, that stores endpoint responses +- records for each endpoint response + +## Nested Class Summary +| Modifier and Type | Class and Description | +| ----------------- | --------------------- | +| sealed interface | [EndpointResponse](#endpointresponse)
stores the endpoint responses | +| record | [EndpointFakeGetCode200Response](#endpointfakegetcode200response)
the response for 200 | + +## EndpointResponse +public sealed interface EndpointResponse permits
+[EndpointFakeGetCode200Response](#endpointfakegetcode200response) + +a sealed interface that stores endpoint responses + +## EndpointFakeGetCode200Response +public record EndpointFakeGetCode200Response( + HttpResponse response, + Nothing? body, + Nothing? headers +) implements EndpointResponse, ApiResponse
+ +a class that stores an endpoint response + diff --git a/samples/client/petstore/kotlin/docs/paths/fake/get/parameters/parameter0/Schema0.md b/samples/client/petstore/kotlin/docs/paths/fake/get/parameters/parameter0/Schema0.md new file mode 100644 index 00000000000..648f585218b --- /dev/null +++ b/samples/client/petstore/kotlin/docs/paths/fake/get/parameters/parameter0/Schema0.md @@ -0,0 +1,205 @@ +# Schema0 +public class Schema0
+ +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 list payloads, extends FrozenList +- classes to build inputs for list payloads +- enum classes + +## Nested Class Summary +| Modifier and Type | Class and Description | +| ----------------- | ---------------------- | +| sealed interface | [Schema0.Schema01Boxed](#schema01boxed)
sealed interface for validated payloads | +| record | [Schema0.Schema01BoxedList](#schema01boxedlist)
boxed class to store validated List payloads | +| static class | [Schema0.Schema01](#schema01)
schema class | +| static class | [Schema0.SchemaListBuilder0](#schemalistbuilder0)
builder for List payloads | +| static class | [Schema0.SchemaList0](#schemalist0)
output class for List payloads | +| sealed interface | [Schema0.Items0Boxed](#items0boxed)
sealed interface for validated payloads | +| record | [Schema0.Items0BoxedString](#items0boxedstring)
boxed class to store validated String payloads | +| static class | [Schema0.Items0](#items0)
schema class | +| enum | [Schema0.StringItemsEnums0](#stringitemsenums0)
String enum | + +## Schema01Boxed +public sealed interface Schema01Boxed
+permits
+[Schema01BoxedList](#schema01boxedlist) + +sealed interface that stores validated payloads using boxed classes + +## Schema01BoxedList +public record Schema01BoxedList
+implements [Schema01Boxed](#schema01boxed) + +record that stores validated List payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| Schema01BoxedList([SchemaList0](#schemalist0) data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| [SchemaList0](#schemalist0) | data()
validated payload | +| @Nullable Object | getData()
validated payload | + +## Schema01 +public static class Schema01
+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.fake.get.parameters.parameter0.Schema0; + +import java.util.Arrays; +import java.util.List; +import java.util.AbstractMap; + +static final SchemaConfiguration configuration = new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().build()); + +// List validation +Schema0.SchemaList0 validatedPayload = + Schema0.Schema01.validate( + new Schema0.SchemaListBuilder0() + .add(">") + + .build(), + configuration +); +``` + +### Field Summary +| Modifier and Type | Field and Description | +| ----------------- | ---------------------- | +| Set> | type = Set.of(List.class) | +| Class | items = [Items0.class](#items0) | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| [SchemaList0](#schemalist0) | validate([List](#schemalistbuilder0) arg, SchemaConfiguration configuration) | +| [Schema01BoxedList](#schema01boxedlist) | validateAndBox([List](#schemalistbuilder0) arg, SchemaConfiguration configuration) | +| [Schema01Boxed](#schema01boxed) | validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) | +| @Nullable Object | validate(@Nullable Object arg, SchemaConfiguration configuration) | + +## SchemaListBuilder0 +public class SchemaListBuilder0
+builder for `List` + +A class that builds the List input type + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| SchemaListBuilder0()
Creates an empty list | +| SchemaListBuilder0(List items)
Stores the items in a list | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| SchemaListBuilder0 | add(String item) | +| SchemaListBuilder0 | add([StringItemsEnums0](#stringitemsenums0) item) | +| List | build()
Returns list input that should be used with Schema.validate | + +## SchemaList0 +public class SchemaList0
+extends `FrozenList` + +A class to store validated List payloads + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| static [SchemaList0](#schemalist0) | of([List](#schemalistbuilder0) arg, SchemaConfiguration configuration) | + +## Items0Boxed +public sealed interface Items0Boxed
+permits
+[Items0BoxedString](#items0boxedstring) + +sealed interface that stores validated payloads using boxed classes + +## Items0BoxedString +public record Items0BoxedString
+implements [Items0Boxed](#items0boxed) + +record that stores validated String payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| Items0BoxedString(String data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| String | data()
validated payload | +| @Nullable Object | getData()
validated payload | + +## Items0 +public static class Items0
+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.fake.get.parameters.parameter0.Schema0; + +import java.util.Arrays; +import java.util.List; +import java.util.AbstractMap; + +static final SchemaConfiguration configuration = new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().build()); + +// String validation +String validatedPayload = Schema0.Items0.validate( + ">", + configuration +); +``` + +### Field Summary +| Modifier and Type | Field and Description | +| ----------------- | ---------------------- | +| Set> | type = Set.of(
    String.class
)
| +| Set | enumValues = SetMaker.makeSet(
    ">",
    "$"
)
| +| @Nullable Object | defaultValue = "$" | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| String | validate(String arg, SchemaConfiguration configuration) | +| String | validate([StringItemsEnums0](#stringitemsenums0) arg, SchemaConfiguration configuration) | +| [Items0BoxedString](#items0boxedstring) | validateAndBox(String arg, SchemaConfiguration configuration) | +| [Items0Boxed](#items0boxed) | validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) | +| @Nullable Object | validate(@Nullable Object arg, SchemaConfiguration configuration) | + +## StringItemsEnums0 +public enum StringItemsEnums0
+extends `Enum` + +A class that stores String enum values + +### Enum Constant Summary +| Enum Constant | Description | +| ------------- | ----------- | +| GREATER_THAN_SIGN | value = ">" | +| DOLLAR_SIGN | value = "$" | diff --git a/samples/client/petstore/kotlin/docs/paths/fake/get/parameters/parameter1/Schema1.md b/samples/client/petstore/kotlin/docs/paths/fake/get/parameters/parameter1/Schema1.md new file mode 100644 index 00000000000..f800da764fd --- /dev/null +++ b/samples/client/petstore/kotlin/docs/paths/fake/get/parameters/parameter1/Schema1.md @@ -0,0 +1,98 @@ +# Schema1 +public class Schema1
+ +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 +- enum classes + +## Nested Class Summary +| Modifier and Type | Class and Description | +| ----------------- | ---------------------- | +| sealed interface | [Schema1.Schema11Boxed](#schema11boxed)
sealed interface for validated payloads | +| record | [Schema1.Schema11BoxedString](#schema11boxedstring)
boxed class to store validated String payloads | +| static class | [Schema1.Schema11](#schema11)
schema class | +| enum | [Schema1.StringSchemaEnums1](#stringschemaenums1)
String enum | + +## Schema11Boxed +public sealed interface Schema11Boxed
+permits
+[Schema11BoxedString](#schema11boxedstring) + +sealed interface that stores validated payloads using boxed classes + +## Schema11BoxedString +public record Schema11BoxedString
+implements [Schema11Boxed](#schema11boxed) + +record that stores validated String payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| Schema11BoxedString(String data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| String | data()
validated payload | +| @Nullable Object | getData()
validated payload | + +## Schema11 +public static class Schema11
+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.fake.get.parameters.parameter1.Schema1; + +import java.util.Arrays; +import java.util.List; +import java.util.AbstractMap; + +static final SchemaConfiguration configuration = new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().build()); + +// String validation +String validatedPayload = Schema1.Schema11.validate( + "_abc", + configuration +); +``` + +### Field Summary +| Modifier and Type | Field and Description | +| ----------------- | ---------------------- | +| Set> | type = Set.of(
    String.class
)
| +| Set | enumValues = SetMaker.makeSet(
    "_abc",
    "-efg",
    "(xyz)"
)
| +| @Nullable Object | defaultValue = "-efg" | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| String | validate(String arg, SchemaConfiguration configuration) | +| String | validate([StringSchemaEnums1](#stringschemaenums1) arg, SchemaConfiguration configuration) | +| [Schema11BoxedString](#schema11boxedstring) | validateAndBox(String arg, SchemaConfiguration configuration) | +| [Schema11Boxed](#schema11boxed) | validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) | +| @Nullable Object | validate(@Nullable Object arg, SchemaConfiguration configuration) | + +## StringSchemaEnums1 +public enum StringSchemaEnums1
+extends `Enum` + +A class that stores String enum values + +### Enum Constant Summary +| Enum Constant | Description | +| ------------- | ----------- | +| LOW_LINE_ABC | value = "_abc" | +| HYPHEN_MINUS_EFG | value = "-efg" | +| LEFT_PARENTHESIS_XYZ_RIGHT_PARENTHESIS | value = "(xyz)" | diff --git a/samples/client/petstore/kotlin/docs/paths/fake/get/parameters/parameter2/Schema2.md b/samples/client/petstore/kotlin/docs/paths/fake/get/parameters/parameter2/Schema2.md new file mode 100644 index 00000000000..0d9d6f7469a --- /dev/null +++ b/samples/client/petstore/kotlin/docs/paths/fake/get/parameters/parameter2/Schema2.md @@ -0,0 +1,205 @@ +# Schema2 +public class Schema2
+ +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 list payloads, extends FrozenList +- classes to build inputs for list payloads +- enum classes + +## Nested Class Summary +| Modifier and Type | Class and Description | +| ----------------- | ---------------------- | +| sealed interface | [Schema2.Schema21Boxed](#schema21boxed)
sealed interface for validated payloads | +| record | [Schema2.Schema21BoxedList](#schema21boxedlist)
boxed class to store validated List payloads | +| static class | [Schema2.Schema21](#schema21)
schema class | +| static class | [Schema2.SchemaListBuilder2](#schemalistbuilder2)
builder for List payloads | +| static class | [Schema2.SchemaList2](#schemalist2)
output class for List payloads | +| sealed interface | [Schema2.Items2Boxed](#items2boxed)
sealed interface for validated payloads | +| record | [Schema2.Items2BoxedString](#items2boxedstring)
boxed class to store validated String payloads | +| static class | [Schema2.Items2](#items2)
schema class | +| enum | [Schema2.StringItemsEnums2](#stringitemsenums2)
String enum | + +## Schema21Boxed +public sealed interface Schema21Boxed
+permits
+[Schema21BoxedList](#schema21boxedlist) + +sealed interface that stores validated payloads using boxed classes + +## Schema21BoxedList +public record Schema21BoxedList
+implements [Schema21Boxed](#schema21boxed) + +record that stores validated List payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| Schema21BoxedList([SchemaList2](#schemalist2) data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| [SchemaList2](#schemalist2) | data()
validated payload | +| @Nullable Object | getData()
validated payload | + +## Schema21 +public static class Schema21
+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.fake.get.parameters.parameter2.Schema2; + +import java.util.Arrays; +import java.util.List; +import java.util.AbstractMap; + +static final SchemaConfiguration configuration = new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().build()); + +// List validation +Schema2.SchemaList2 validatedPayload = + Schema2.Schema21.validate( + new Schema2.SchemaListBuilder2() + .add(">") + + .build(), + configuration +); +``` + +### Field Summary +| Modifier and Type | Field and Description | +| ----------------- | ---------------------- | +| Set> | type = Set.of(List.class) | +| Class | items = [Items2.class](#items2) | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| [SchemaList2](#schemalist2) | validate([List](#schemalistbuilder2) arg, SchemaConfiguration configuration) | +| [Schema21BoxedList](#schema21boxedlist) | validateAndBox([List](#schemalistbuilder2) arg, SchemaConfiguration configuration) | +| [Schema21Boxed](#schema21boxed) | validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) | +| @Nullable Object | validate(@Nullable Object arg, SchemaConfiguration configuration) | + +## SchemaListBuilder2 +public class SchemaListBuilder2
+builder for `List` + +A class that builds the List input type + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| SchemaListBuilder2()
Creates an empty list | +| SchemaListBuilder2(List items)
Stores the items in a list | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| SchemaListBuilder2 | add(String item) | +| SchemaListBuilder2 | add([StringItemsEnums2](#stringitemsenums2) item) | +| List | build()
Returns list input that should be used with Schema.validate | + +## SchemaList2 +public class SchemaList2
+extends `FrozenList` + +A class to store validated List payloads + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| static [SchemaList2](#schemalist2) | of([List](#schemalistbuilder2) arg, SchemaConfiguration configuration) | + +## Items2Boxed +public sealed interface Items2Boxed
+permits
+[Items2BoxedString](#items2boxedstring) + +sealed interface that stores validated payloads using boxed classes + +## Items2BoxedString +public record Items2BoxedString
+implements [Items2Boxed](#items2boxed) + +record that stores validated String payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| Items2BoxedString(String data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| String | data()
validated payload | +| @Nullable Object | getData()
validated payload | + +## Items2 +public static class Items2
+extends JsonSchema + +A schema class that validates payloads + +### Code Sample +``` +import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags; +import org.openapijsonschematools.client.configurations.SchemaConfiguration; +import org.openapijsonschematools.client.exceptions.ValidationException; +import org.openapijsonschematools.client.schemas.validation.MapUtils; +import org.openapijsonschematools.client.schemas.validation.FrozenList; +import org.openapijsonschematools.client.schemas.validation.FrozenMap; +import org.openapijsonschematools.client.paths.fake.get.parameters.parameter2.Schema2; + +import java.util.Arrays; +import java.util.List; +import java.util.AbstractMap; + +static final SchemaConfiguration configuration = new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().build()); + +// String validation +String validatedPayload = Schema2.Items2.validate( + ">", + configuration +); +``` + +### Field Summary +| Modifier and Type | Field and Description | +| ----------------- | ---------------------- | +| Set> | type = Set.of(
    String.class
)
| +| Set | enumValues = SetMaker.makeSet(
    ">",
    "$"
)
| +| @Nullable Object | defaultValue = "$" | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| String | validate(String arg, SchemaConfiguration configuration) | +| String | validate([StringItemsEnums2](#stringitemsenums2) arg, SchemaConfiguration configuration) | +| [Items2BoxedString](#items2boxedstring) | validateAndBox(String arg, SchemaConfiguration configuration) | +| [Items2Boxed](#items2boxed) | validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) | +| @Nullable Object | validate(@Nullable Object arg, SchemaConfiguration configuration) | + +## StringItemsEnums2 +public enum StringItemsEnums2
+extends `Enum` + +A class that stores String enum values + +### Enum Constant Summary +| Enum Constant | Description | +| ------------- | ----------- | +| GREATER_THAN_SIGN | value = ">" | +| DOLLAR_SIGN | value = "$" | diff --git a/samples/client/petstore/kotlin/docs/paths/fake/get/parameters/parameter3/Schema3.md b/samples/client/petstore/kotlin/docs/paths/fake/get/parameters/parameter3/Schema3.md new file mode 100644 index 00000000000..8ea43fa12ea --- /dev/null +++ b/samples/client/petstore/kotlin/docs/paths/fake/get/parameters/parameter3/Schema3.md @@ -0,0 +1,98 @@ +# Schema3 +public class Schema3
+ +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 +- enum classes + +## Nested Class Summary +| Modifier and Type | Class and Description | +| ----------------- | ---------------------- | +| sealed interface | [Schema3.Schema31Boxed](#schema31boxed)
sealed interface for validated payloads | +| record | [Schema3.Schema31BoxedString](#schema31boxedstring)
boxed class to store validated String payloads | +| static class | [Schema3.Schema31](#schema31)
schema class | +| enum | [Schema3.StringSchemaEnums3](#stringschemaenums3)
String enum | + +## Schema31Boxed +public sealed interface Schema31Boxed
+permits
+[Schema31BoxedString](#schema31boxedstring) + +sealed interface that stores validated payloads using boxed classes + +## Schema31BoxedString +public record Schema31BoxedString
+implements [Schema31Boxed](#schema31boxed) + +record that stores validated String payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| Schema31BoxedString(String data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| String | data()
validated payload | +| @Nullable Object | getData()
validated payload | + +## Schema31 +public static class Schema31
+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.fake.get.parameters.parameter3.Schema3; + +import java.util.Arrays; +import java.util.List; +import java.util.AbstractMap; + +static final SchemaConfiguration configuration = new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().build()); + +// String validation +String validatedPayload = Schema3.Schema31.validate( + "_abc", + configuration +); +``` + +### Field Summary +| Modifier and Type | Field and Description | +| ----------------- | ---------------------- | +| Set> | type = Set.of(
    String.class
)
| +| Set | enumValues = SetMaker.makeSet(
    "_abc",
    "-efg",
    "(xyz)"
)
| +| @Nullable Object | defaultValue = "-efg" | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| String | validate(String arg, SchemaConfiguration configuration) | +| String | validate([StringSchemaEnums3](#stringschemaenums3) arg, SchemaConfiguration configuration) | +| [Schema31BoxedString](#schema31boxedstring) | validateAndBox(String arg, SchemaConfiguration configuration) | +| [Schema31Boxed](#schema31boxed) | validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) | +| @Nullable Object | validate(@Nullable Object arg, SchemaConfiguration configuration) | + +## StringSchemaEnums3 +public enum StringSchemaEnums3
+extends `Enum` + +A class that stores String enum values + +### Enum Constant Summary +| Enum Constant | Description | +| ------------- | ----------- | +| LOW_LINE_ABC | value = "_abc" | +| HYPHEN_MINUS_EFG | value = "-efg" | +| LEFT_PARENTHESIS_XYZ_RIGHT_PARENTHESIS | value = "(xyz)" | diff --git a/samples/client/petstore/kotlin/docs/paths/fake/get/parameters/parameter4/Schema4.md b/samples/client/petstore/kotlin/docs/paths/fake/get/parameters/parameter4/Schema4.md new file mode 100644 index 00000000000..937aae56a94 --- /dev/null +++ b/samples/client/petstore/kotlin/docs/paths/fake/get/parameters/parameter4/Schema4.md @@ -0,0 +1,135 @@ +# Schema4 +public class Schema4
+ +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 +- enum classes + +## Nested Class Summary +| Modifier and Type | Class and Description | +| ----------------- | ---------------------- | +| sealed interface | [Schema4.Schema41Boxed](#schema41boxed)
sealed interface for validated payloads | +| record | [Schema4.Schema41BoxedNumber](#schema41boxednumber)
boxed class to store validated Number payloads | +| static class | [Schema4.Schema41](#schema41)
schema class | +| enum | [Schema4.IntegerSchemaEnums4](#integerschemaenums4)
Integer enum | +| enum | [Schema4.LongSchemaEnums4](#longschemaenums4)
Long enum | +| enum | [Schema4.FloatSchemaEnums4](#floatschemaenums4)
Float enum | +| enum | [Schema4.DoubleSchemaEnums4](#doubleschemaenums4)
Double enum | + +## Schema41Boxed +public sealed interface Schema41Boxed
+permits
+[Schema41BoxedNumber](#schema41boxednumber) + +sealed interface that stores validated payloads using boxed classes + +## Schema41BoxedNumber +public record Schema41BoxedNumber
+implements [Schema41Boxed](#schema41boxed) + +record that stores validated Number payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| Schema41BoxedNumber(Number data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| Number | data()
validated payload | +| @Nullable Object | getData()
validated payload | + +## Schema41 +public static class Schema41
+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.fake.get.parameters.parameter4.Schema4; + +import java.util.Arrays; +import java.util.List; +import java.util.AbstractMap; + +static final SchemaConfiguration configuration = new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().build()); + +// int validation +int validatedPayload = Schema4.Schema41.validate( + 1, + configuration +); +``` + +### Field Summary +| Modifier and Type | Field and Description | +| ----------------- | ---------------------- | +| Set> | type = Set.of(
    Integer.class,
    Long.class,
    Float.class,
    Double.class
)
| +| String | type = "int32"; | +| Set | enumValues = SetMaker.makeSet(
    1,
    -2
)
| + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| int | validate(int arg, SchemaConfiguration configuration) | +| [Schema41BoxedNumber](#schema41boxednumber) | validateAndBox(Number arg, SchemaConfiguration configuration) | +| [Schema41Boxed](#schema41boxed) | validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) | +| @Nullable Object | validate(@Nullable Object arg, SchemaConfiguration configuration) | + +## IntegerSchemaEnums4 +public enum IntegerSchemaEnums4
+extends `Enum` + +A class that stores Integer enum values + +### Enum Constant Summary +| Enum Constant | Description | +| ------------- | ----------- | +| POSITIVE_1 | value = 1 | +| NEGATIVE_2 | value = -2 | + +## LongSchemaEnums4 +public enum LongSchemaEnums4
+extends `Enum` + +A class that stores Long enum values + +### Enum Constant Summary +| Enum Constant | Description | +| ------------- | ----------- | +| POSITIVE_1 | value = 1L | +| NEGATIVE_2 | value = -2L | + +## FloatSchemaEnums4 +public enum FloatSchemaEnums4
+extends `Enum` + +A class that stores Float enum values + +### Enum Constant Summary +| Enum Constant | Description | +| ------------- | ----------- | +| POSITIVE_1 | value = 1.0f | +| NEGATIVE_2 | value = -2.0f | + +## DoubleSchemaEnums4 +public enum DoubleSchemaEnums4
+extends `Enum` + +A class that stores Double enum values + +### Enum Constant Summary +| Enum Constant | Description | +| ------------- | ----------- | +| POSITIVE_1 | value = 1.0d | +| NEGATIVE_2 | value = -2.0d | diff --git a/samples/client/petstore/kotlin/docs/paths/fake/get/parameters/parameter5/Schema5.md b/samples/client/petstore/kotlin/docs/paths/fake/get/parameters/parameter5/Schema5.md new file mode 100644 index 00000000000..63198fed5b8 --- /dev/null +++ b/samples/client/petstore/kotlin/docs/paths/fake/get/parameters/parameter5/Schema5.md @@ -0,0 +1,109 @@ +# Schema5 +public class Schema5
+ +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 +- enum classes + +## Nested Class Summary +| Modifier and Type | Class and Description | +| ----------------- | ---------------------- | +| sealed interface | [Schema5.Schema51Boxed](#schema51boxed)
sealed interface for validated payloads | +| record | [Schema5.Schema51BoxedNumber](#schema51boxednumber)
boxed class to store validated Number payloads | +| static class | [Schema5.Schema51](#schema51)
schema class | +| enum | [Schema5.DoubleSchemaEnums5](#doubleschemaenums5)
Double enum | +| enum | [Schema5.FloatSchemaEnums5](#floatschemaenums5)
Float enum | + +## Schema51Boxed +public sealed interface Schema51Boxed
+permits
+[Schema51BoxedNumber](#schema51boxednumber) + +sealed interface that stores validated payloads using boxed classes + +## Schema51BoxedNumber +public record Schema51BoxedNumber
+implements [Schema51Boxed](#schema51boxed) + +record that stores validated Number payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| Schema51BoxedNumber(Number data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| Number | data()
validated payload | +| @Nullable Object | getData()
validated payload | + +## Schema51 +public static class Schema51
+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.fake.get.parameters.parameter5.Schema5; + +import java.util.Arrays; +import java.util.List; +import java.util.AbstractMap; + +static final SchemaConfiguration configuration = new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().build()); + +// double validation +double validatedPayload = Schema5.Schema51.validate( + 3.14d, + configuration +); +``` + +### Field Summary +| Modifier and Type | Field and Description | +| ----------------- | ---------------------- | +| Set> | type = Set.of(
    Integer.class,
    Long.class,
    Float.class,
    Double.class
)
| +| String | type = "double"; | +| Set | enumValues = SetMaker.makeSet(
    1.1,
    -1.2
)
| + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| double | validate(double arg, SchemaConfiguration configuration) | +| [Schema51BoxedNumber](#schema51boxednumber) | validateAndBox(Number arg, SchemaConfiguration configuration) | +| [Schema51Boxed](#schema51boxed) | validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) | +| @Nullable Object | validate(@Nullable Object arg, SchemaConfiguration configuration) | + +## DoubleSchemaEnums5 +public enum DoubleSchemaEnums5
+extends `Enum` + +A class that stores Double enum values + +### Enum Constant Summary +| Enum Constant | Description | +| ------------- | ----------- | +| POSITIVE_1_PT_1 | value = 1.1d | +| NEGATIVE_1_PT_2 | value = -1.2d | + +## FloatSchemaEnums5 +public enum FloatSchemaEnums5
+extends `Enum` + +A class that stores Float enum values + +### Enum Constant Summary +| Enum Constant | Description | +| ------------- | ----------- | +| POSITIVE_1_PT_1 | value = 1.1f | +| NEGATIVE_1_PT_2 | value = -1.2f | diff --git a/samples/client/petstore/kotlin/docs/paths/fake/get/requestbody/content/applicationxwwwformurlencoded/ApplicationxwwwformurlencodedSchema.md b/samples/client/petstore/kotlin/docs/paths/fake/get/requestbody/content/applicationxwwwformurlencoded/ApplicationxwwwformurlencodedSchema.md new file mode 100644 index 00000000000..06ee7345cb7 --- /dev/null +++ b/samples/client/petstore/kotlin/docs/paths/fake/get/requestbody/content/applicationxwwwformurlencoded/ApplicationxwwwformurlencodedSchema.md @@ -0,0 +1,422 @@ +# ApplicationxwwwformurlencodedSchema +public class ApplicationxwwwformurlencodedSchema
+ +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 list payloads, extends FrozenList +- classes to build inputs for list payloads +- 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 | [ApplicationxwwwformurlencodedSchema.ApplicationxwwwformurlencodedSchema1Boxed](#applicationxwwwformurlencodedschema1boxed)
sealed interface for validated payloads | +| record | [ApplicationxwwwformurlencodedSchema.ApplicationxwwwformurlencodedSchema1BoxedMap](#applicationxwwwformurlencodedschema1boxedmap)
boxed class to store validated Map payloads | +| static class | [ApplicationxwwwformurlencodedSchema.ApplicationxwwwformurlencodedSchema1](#applicationxwwwformurlencodedschema1)
schema class | +| static class | [ApplicationxwwwformurlencodedSchema.ApplicationxwwwformurlencodedSchemaMapBuilder](#applicationxwwwformurlencodedschemamapbuilder)
builder for Map payloads | +| static class | [ApplicationxwwwformurlencodedSchema.ApplicationxwwwformurlencodedSchemaMap](#applicationxwwwformurlencodedschemamap)
output class for Map payloads | +| sealed interface | [ApplicationxwwwformurlencodedSchema.ApplicationxwwwformurlencodedEnumFormStringBoxed](#applicationxwwwformurlencodedenumformstringboxed)
sealed interface for validated payloads | +| record | [ApplicationxwwwformurlencodedSchema.ApplicationxwwwformurlencodedEnumFormStringBoxedString](#applicationxwwwformurlencodedenumformstringboxedstring)
boxed class to store validated String payloads | +| static class | [ApplicationxwwwformurlencodedSchema.ApplicationxwwwformurlencodedEnumFormString](#applicationxwwwformurlencodedenumformstring)
schema class | +| enum | [ApplicationxwwwformurlencodedSchema.StringApplicationxwwwformurlencodedEnumFormStringEnums](#stringapplicationxwwwformurlencodedenumformstringenums)
String enum | +| sealed interface | [ApplicationxwwwformurlencodedSchema.ApplicationxwwwformurlencodedEnumFormStringArrayBoxed](#applicationxwwwformurlencodedenumformstringarrayboxed)
sealed interface for validated payloads | +| record | [ApplicationxwwwformurlencodedSchema.ApplicationxwwwformurlencodedEnumFormStringArrayBoxedList](#applicationxwwwformurlencodedenumformstringarrayboxedlist)
boxed class to store validated List payloads | +| static class | [ApplicationxwwwformurlencodedSchema.ApplicationxwwwformurlencodedEnumFormStringArray](#applicationxwwwformurlencodedenumformstringarray)
schema class | +| static class | [ApplicationxwwwformurlencodedSchema.ApplicationxwwwformurlencodedEnumFormStringArrayListBuilder](#applicationxwwwformurlencodedenumformstringarraylistbuilder)
builder for List payloads | +| static class | [ApplicationxwwwformurlencodedSchema.ApplicationxwwwformurlencodedEnumFormStringArrayList](#applicationxwwwformurlencodedenumformstringarraylist)
output class for List payloads | +| sealed interface | [ApplicationxwwwformurlencodedSchema.ApplicationxwwwformurlencodedItemsBoxed](#applicationxwwwformurlencodeditemsboxed)
sealed interface for validated payloads | +| record | [ApplicationxwwwformurlencodedSchema.ApplicationxwwwformurlencodedItemsBoxedString](#applicationxwwwformurlencodeditemsboxedstring)
boxed class to store validated String payloads | +| static class | [ApplicationxwwwformurlencodedSchema.ApplicationxwwwformurlencodedItems](#applicationxwwwformurlencodeditems)
schema class | +| enum | [ApplicationxwwwformurlencodedSchema.StringApplicationxwwwformurlencodedItemsEnums](#stringapplicationxwwwformurlencodeditemsenums)
String enum | + +## ApplicationxwwwformurlencodedSchema1Boxed +public sealed interface ApplicationxwwwformurlencodedSchema1Boxed
+permits
+[ApplicationxwwwformurlencodedSchema1BoxedMap](#applicationxwwwformurlencodedschema1boxedmap) + +sealed interface that stores validated payloads using boxed classes + +## ApplicationxwwwformurlencodedSchema1BoxedMap +public record ApplicationxwwwformurlencodedSchema1BoxedMap
+implements [ApplicationxwwwformurlencodedSchema1Boxed](#applicationxwwwformurlencodedschema1boxed) + +record that stores validated Map payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| ApplicationxwwwformurlencodedSchema1BoxedMap([ApplicationxwwwformurlencodedSchemaMap](#applicationxwwwformurlencodedschemamap) data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| [ApplicationxwwwformurlencodedSchemaMap](#applicationxwwwformurlencodedschemamap) | data()
validated payload | +| @Nullable Object | getData()
validated payload | + +## ApplicationxwwwformurlencodedSchema1 +public static class ApplicationxwwwformurlencodedSchema1
+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.fake.get.requestbody.content.applicationxwwwformurlencoded.ApplicationxwwwformurlencodedSchema; + +import java.util.Arrays; +import java.util.List; +import java.util.AbstractMap; + +static final SchemaConfiguration configuration = new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().build()); + +// Map validation +ApplicationxwwwformurlencodedSchema.ApplicationxwwwformurlencodedSchemaMap validatedPayload = + ApplicationxwwwformurlencodedSchema.ApplicationxwwwformurlencodedSchema1.validate( + new ApplicationxwwwformurlencodedSchema.ApplicationxwwwformurlencodedSchemaMapBuilder() + .enum_form_string_array( + Arrays.asList( + ">" + ) + ) + .enum_form_string("_abc") + + .build(), + configuration +); +``` + +### Field Summary +| Modifier and Type | Field and Description | +| ----------------- | ---------------------- | +| Set> | type = Set.of(Map.class) | +| Map> | properties = Map.ofEntries(
    new PropertyEntry("enum_form_string_array", [ApplicationxwwwformurlencodedEnumFormStringArray.class](#applicationxwwwformurlencodedenumformstringarray))),
    new PropertyEntry("enum_form_string", [ApplicationxwwwformurlencodedEnumFormString.class](#applicationxwwwformurlencodedenumformstring)))
)
| + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| [ApplicationxwwwformurlencodedSchemaMap](#applicationxwwwformurlencodedschemamap) | validate([Map<?, ?>](#applicationxwwwformurlencodedschemamapbuilder) arg, SchemaConfiguration configuration) | +| [ApplicationxwwwformurlencodedSchema1BoxedMap](#applicationxwwwformurlencodedschema1boxedmap) | validateAndBox([Map<?, ?>](#applicationxwwwformurlencodedschemamapbuilder) arg, SchemaConfiguration configuration) | +| [ApplicationxwwwformurlencodedSchema1Boxed](#applicationxwwwformurlencodedschema1boxed) | validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) | +| @Nullable Object | validate(@Nullable Object arg, SchemaConfiguration configuration) | + +## ApplicationxwwwformurlencodedSchemaMapBuilder +public class ApplicationxwwwformurlencodedSchemaMapBuilder
+builder for `Map` + +A class that builds the Map input type + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| ApplicationxwwwformurlencodedSchemaMapBuilder()
Creates a builder that contains an empty map | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| Map | build()
Returns map input that should be used with Schema.validate | +| [ApplicationxwwwformurlencodedSchemaMapBuilder](#applicationxwwwformurlencodedschemamapbuilder) | enum_form_string_array(List value) | +| [ApplicationxwwwformurlencodedSchemaMapBuilder](#applicationxwwwformurlencodedschemamapbuilder) | enum_form_string(String value) | +| [ApplicationxwwwformurlencodedSchemaMapBuilder](#applicationxwwwformurlencodedschemamapbuilder) | enum_form_string([StringApplicationxwwwformurlencodedEnumFormStringEnums](#stringapplicationxwwwformurlencodedenumformstringenums) value) | +| [ApplicationxwwwformurlencodedSchemaMapBuilder](#applicationxwwwformurlencodedschemamapbuilder) | additionalProperty(String key, Nothing? value) | +| [ApplicationxwwwformurlencodedSchemaMapBuilder](#applicationxwwwformurlencodedschemamapbuilder) | additionalProperty(String key, boolean value) | +| [ApplicationxwwwformurlencodedSchemaMapBuilder](#applicationxwwwformurlencodedschemamapbuilder) | additionalProperty(String key, String value) | +| [ApplicationxwwwformurlencodedSchemaMapBuilder](#applicationxwwwformurlencodedschemamapbuilder) | additionalProperty(String key, int value) | +| [ApplicationxwwwformurlencodedSchemaMapBuilder](#applicationxwwwformurlencodedschemamapbuilder) | additionalProperty(String key, float value) | +| [ApplicationxwwwformurlencodedSchemaMapBuilder](#applicationxwwwformurlencodedschemamapbuilder) | additionalProperty(String key, long value) | +| [ApplicationxwwwformurlencodedSchemaMapBuilder](#applicationxwwwformurlencodedschemamapbuilder) | additionalProperty(String key, double value) | +| [ApplicationxwwwformurlencodedSchemaMapBuilder](#applicationxwwwformurlencodedschemamapbuilder) | additionalProperty(String key, List value) | +| [ApplicationxwwwformurlencodedSchemaMapBuilder](#applicationxwwwformurlencodedschemamapbuilder) | additionalProperty(String key, Map value) | + +## ApplicationxwwwformurlencodedSchemaMap +public static class ApplicationxwwwformurlencodedSchemaMap
+extends FrozenMap + +A class to store validated Map payloads + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| static [ApplicationxwwwformurlencodedSchemaMap](#applicationxwwwformurlencodedschemamap) | of([Map](#applicationxwwwformurlencodedschemamapbuilder) arg, SchemaConfiguration configuration) | +| [ApplicationxwwwformurlencodedEnumFormStringArrayList](#applicationxwwwformurlencodedenumformstringarraylist) | enum_form_string_array()
[optional] | +| String | enum_form_string()
[optional] must be one of ["_abc", "-efg", "(xyz)"] if omitted the server will use the default value of -efg | +| @Nullable Object | getAdditionalProperty(String name)
provides type safety for additional properties | + +## ApplicationxwwwformurlencodedEnumFormStringBoxed +public sealed interface ApplicationxwwwformurlencodedEnumFormStringBoxed
+permits
+[ApplicationxwwwformurlencodedEnumFormStringBoxedString](#applicationxwwwformurlencodedenumformstringboxedstring) + +sealed interface that stores validated payloads using boxed classes + +## ApplicationxwwwformurlencodedEnumFormStringBoxedString +public record ApplicationxwwwformurlencodedEnumFormStringBoxedString
+implements [ApplicationxwwwformurlencodedEnumFormStringBoxed](#applicationxwwwformurlencodedenumformstringboxed) + +record that stores validated String payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| ApplicationxwwwformurlencodedEnumFormStringBoxedString(String data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| String | data()
validated payload | +| @Nullable Object | getData()
validated payload | + +## ApplicationxwwwformurlencodedEnumFormString +public static class ApplicationxwwwformurlencodedEnumFormString
+extends JsonSchema + +A schema class that validates payloads + +## Description +Form parameter enum test (string) + +### 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.fake.get.requestbody.content.applicationxwwwformurlencoded.ApplicationxwwwformurlencodedSchema; + +import java.util.Arrays; +import java.util.List; +import java.util.AbstractMap; + +static final SchemaConfiguration configuration = new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().build()); + +// String validation +String validatedPayload = ApplicationxwwwformurlencodedSchema.ApplicationxwwwformurlencodedEnumFormString.validate( + "_abc", + configuration +); +``` + +### Field Summary +| Modifier and Type | Field and Description | +| ----------------- | ---------------------- | +| Set> | type = Set.of(
    String.class
)
| +| Set | enumValues = SetMaker.makeSet(
    "_abc",
    "-efg",
    "(xyz)"
)
| +| @Nullable Object | defaultValue = "-efg" | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| String | validate(String arg, SchemaConfiguration configuration) | +| String | validate([StringApplicationxwwwformurlencodedEnumFormStringEnums](#stringapplicationxwwwformurlencodedenumformstringenums) arg, SchemaConfiguration configuration) | +| [ApplicationxwwwformurlencodedEnumFormStringBoxedString](#applicationxwwwformurlencodedenumformstringboxedstring) | validateAndBox(String arg, SchemaConfiguration configuration) | +| [ApplicationxwwwformurlencodedEnumFormStringBoxed](#applicationxwwwformurlencodedenumformstringboxed) | validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) | +| @Nullable Object | validate(@Nullable Object arg, SchemaConfiguration configuration) | + +## StringApplicationxwwwformurlencodedEnumFormStringEnums +public enum StringApplicationxwwwformurlencodedEnumFormStringEnums
+extends `Enum` + +A class that stores String enum values + +### Enum Constant Summary +| Enum Constant | Description | +| ------------- | ----------- | +| LOW_LINE_ABC | value = "_abc" | +| HYPHEN_MINUS_EFG | value = "-efg" | +| LEFT_PARENTHESIS_XYZ_RIGHT_PARENTHESIS | value = "(xyz)" | + +## ApplicationxwwwformurlencodedEnumFormStringArrayBoxed +public sealed interface ApplicationxwwwformurlencodedEnumFormStringArrayBoxed
+permits
+[ApplicationxwwwformurlencodedEnumFormStringArrayBoxedList](#applicationxwwwformurlencodedenumformstringarrayboxedlist) + +sealed interface that stores validated payloads using boxed classes + +## ApplicationxwwwformurlencodedEnumFormStringArrayBoxedList +public record ApplicationxwwwformurlencodedEnumFormStringArrayBoxedList
+implements [ApplicationxwwwformurlencodedEnumFormStringArrayBoxed](#applicationxwwwformurlencodedenumformstringarrayboxed) + +record that stores validated List payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| ApplicationxwwwformurlencodedEnumFormStringArrayBoxedList([ApplicationxwwwformurlencodedEnumFormStringArrayList](#applicationxwwwformurlencodedenumformstringarraylist) data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| [ApplicationxwwwformurlencodedEnumFormStringArrayList](#applicationxwwwformurlencodedenumformstringarraylist) | data()
validated payload | +| @Nullable Object | getData()
validated payload | + +## ApplicationxwwwformurlencodedEnumFormStringArray +public static class ApplicationxwwwformurlencodedEnumFormStringArray
+extends JsonSchema + +A schema class that validates payloads + +## Description +Form parameter enum test (string array) + +### 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.fake.get.requestbody.content.applicationxwwwformurlencoded.ApplicationxwwwformurlencodedSchema; + +import java.util.Arrays; +import java.util.List; +import java.util.AbstractMap; + +static final SchemaConfiguration configuration = new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().build()); + +// List validation +ApplicationxwwwformurlencodedSchema.ApplicationxwwwformurlencodedEnumFormStringArrayList validatedPayload = + ApplicationxwwwformurlencodedSchema.ApplicationxwwwformurlencodedEnumFormStringArray.validate( + new ApplicationxwwwformurlencodedSchema.ApplicationxwwwformurlencodedEnumFormStringArrayListBuilder() + .add(">") + + .build(), + configuration +); +``` + +### Field Summary +| Modifier and Type | Field and Description | +| ----------------- | ---------------------- | +| Set> | type = Set.of(List.class) | +| Class | items = [ApplicationxwwwformurlencodedItems.class](#applicationxwwwformurlencodeditems) | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| [ApplicationxwwwformurlencodedEnumFormStringArrayList](#applicationxwwwformurlencodedenumformstringarraylist) | validate([List](#applicationxwwwformurlencodedenumformstringarraylistbuilder) arg, SchemaConfiguration configuration) | +| [ApplicationxwwwformurlencodedEnumFormStringArrayBoxedList](#applicationxwwwformurlencodedenumformstringarrayboxedlist) | validateAndBox([List](#applicationxwwwformurlencodedenumformstringarraylistbuilder) arg, SchemaConfiguration configuration) | +| [ApplicationxwwwformurlencodedEnumFormStringArrayBoxed](#applicationxwwwformurlencodedenumformstringarrayboxed) | validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) | +| @Nullable Object | validate(@Nullable Object arg, SchemaConfiguration configuration) | + +## ApplicationxwwwformurlencodedEnumFormStringArrayListBuilder +public class ApplicationxwwwformurlencodedEnumFormStringArrayListBuilder
+builder for `List` + +A class that builds the List input type + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| ApplicationxwwwformurlencodedEnumFormStringArrayListBuilder()
Creates an empty list | +| ApplicationxwwwformurlencodedEnumFormStringArrayListBuilder(List items)
Stores the items in a list | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| ApplicationxwwwformurlencodedEnumFormStringArrayListBuilder | add(String item) | +| ApplicationxwwwformurlencodedEnumFormStringArrayListBuilder | add([StringApplicationxwwwformurlencodedItemsEnums](#stringapplicationxwwwformurlencodeditemsenums) item) | +| List | build()
Returns list input that should be used with Schema.validate | + +## ApplicationxwwwformurlencodedEnumFormStringArrayList +public class ApplicationxwwwformurlencodedEnumFormStringArrayList
+extends `FrozenList` + +A class to store validated List payloads + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| static [ApplicationxwwwformurlencodedEnumFormStringArrayList](#applicationxwwwformurlencodedenumformstringarraylist) | of([List](#applicationxwwwformurlencodedenumformstringarraylistbuilder) arg, SchemaConfiguration configuration) | + +## ApplicationxwwwformurlencodedItemsBoxed +public sealed interface ApplicationxwwwformurlencodedItemsBoxed
+permits
+[ApplicationxwwwformurlencodedItemsBoxedString](#applicationxwwwformurlencodeditemsboxedstring) + +sealed interface that stores validated payloads using boxed classes + +## ApplicationxwwwformurlencodedItemsBoxedString +public record ApplicationxwwwformurlencodedItemsBoxedString
+implements [ApplicationxwwwformurlencodedItemsBoxed](#applicationxwwwformurlencodeditemsboxed) + +record that stores validated String payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| ApplicationxwwwformurlencodedItemsBoxedString(String data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| String | data()
validated payload | +| @Nullable Object | getData()
validated payload | + +## ApplicationxwwwformurlencodedItems +public static class ApplicationxwwwformurlencodedItems
+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.fake.get.requestbody.content.applicationxwwwformurlencoded.ApplicationxwwwformurlencodedSchema; + +import java.util.Arrays; +import java.util.List; +import java.util.AbstractMap; + +static final SchemaConfiguration configuration = new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().build()); + +// String validation +String validatedPayload = ApplicationxwwwformurlencodedSchema.ApplicationxwwwformurlencodedItems.validate( + ">", + configuration +); +``` + +### Field Summary +| Modifier and Type | Field and Description | +| ----------------- | ---------------------- | +| Set> | type = Set.of(
    String.class
)
| +| Set | enumValues = SetMaker.makeSet(
    ">",
    "$"
)
| +| @Nullable Object | defaultValue = "$" | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| String | validate(String arg, SchemaConfiguration configuration) | +| String | validate([StringApplicationxwwwformurlencodedItemsEnums](#stringapplicationxwwwformurlencodeditemsenums) arg, SchemaConfiguration configuration) | +| [ApplicationxwwwformurlencodedItemsBoxedString](#applicationxwwwformurlencodeditemsboxedstring) | validateAndBox(String arg, SchemaConfiguration configuration) | +| [ApplicationxwwwformurlencodedItemsBoxed](#applicationxwwwformurlencodeditemsboxed) | validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) | +| @Nullable Object | validate(@Nullable Object arg, SchemaConfiguration configuration) | + +## StringApplicationxwwwformurlencodedItemsEnums +public enum StringApplicationxwwwformurlencodedItemsEnums
+extends `Enum` + +A class that stores String enum values + +### Enum Constant Summary +| Enum Constant | Description | +| ------------- | ----------- | +| GREATER_THAN_SIGN | value = ">" | +| DOLLAR_SIGN | value = "$" | diff --git a/samples/client/petstore/kotlin/docs/paths/fake/get/responses/FakeGetCode200Response.md b/samples/client/petstore/kotlin/docs/paths/fake/get/responses/FakeGetCode200Response.md new file mode 100644 index 00000000000..e22d671a474 --- /dev/null +++ b/samples/client/petstore/kotlin/docs/paths/fake/get/responses/FakeGetCode200Response.md @@ -0,0 +1,17 @@ +# FakeGetCode200Response + +public class FakeGetCode200Response extends [SuccessDescriptionOnly](../../components/responses/SuccessDescriptionOnly.md) + +A class (extended from the $ref class) that contains necessary nested response classes +- a class that extends ResponseDeserializer and is used to deserialize responses + +## Nested Class Summary +| Modifier and Type | Class and Description | +| ----------------- | --------------------- | +| static class | [FakeGetCode200Response.FakeGetCode200Response1](#fakegetcode200response1)
class that deserializes responses | + +## FakeGetCode200Response1 +public static class FakeGetCode200Response1 extends [SuccessDescriptionOnly1](../../components/responses/SuccessDescriptionOnly.md#successdescriptiononly1)
+ +a class that deserializes responses, extended from the $ref class + diff --git a/samples/client/petstore/kotlin/docs/paths/fake/get/responses/FakeGetCode404Response.md b/samples/client/petstore/kotlin/docs/paths/fake/get/responses/FakeGetCode404Response.md new file mode 100644 index 00000000000..1506c173bfa --- /dev/null +++ b/samples/client/petstore/kotlin/docs/paths/fake/get/responses/FakeGetCode404Response.md @@ -0,0 +1,87 @@ +# FakeGetCode404Response + +public class FakeGetCode404Response + +A class that contains necessary nested response classes +- SealedMediaType, a sealed interface which contains all the schema/encoding info for each contentType +- records which implement SealedMediaType, the concrete media types +- SealedResponseBody, a sealed interface which contains all the contentType/schema types +- records which implement SealedResponseBody, the concrete response body types +- a class that extends ResponseDeserializer and is used to deserialize responses + +## Nested Class Summary +| Modifier and Type | Class and Description | +| ----------------- | --------------------- | +| sealed interface | [FakeGetCode404Response.SealedMediaType](#sealedmediatype)
media type sealed interface | +| record | [FakeGetCode404Response.ApplicationjsonMediaType](#applicationjsonmediatype)
record storing schema + encoding for a specific contentType | +| sealed interface | [FakeGetCode404Response.SealedResponseBody](#sealedresponsebody)
response body sealed interface | +| record | [FakeGetCode404Response.ApplicationjsonResponseBody](#applicationjsonresponsebody)
implements sealed interface to store response body | +| static class | [FakeGetCode404Response.FakeGetCode404Response1](#fakegetcode404response1)
class that deserializes responses | + +## SealedMediaType +public sealed interface SealedMediaType
+permits
+[ApplicationjsonMediaType](#applicationjsonmediatype) + +sealed interface that stores schema and encoding info + +## ApplicationjsonMediaType +public record ApplicationjsonMediaType
+implements [SealedMediaType](#sealedmediatype), MediaType<[ApplicationjsonSchema.ApplicationjsonSchema1](../../../../paths/fake/get/responses/code404response/content/applicationjson/ApplicationjsonSchema.md#applicationjsonschema1), Nothing?> + +class storing schema info for a specific contentType + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| ApplicationjsonMediaType()
Creates an instance | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| [ApplicationjsonSchema.ApplicationjsonSchema1](../../../../paths/fake/get/responses/code404response/content/applicationjson/ApplicationjsonSchema.md#applicationjsonschema1) | schema()
the schema for this MediaType | +| Nothing? | encoding()
the encoding info | + +## SealedResponseBody +public sealed interface SealedResponseBody
+permits
+[ApplicationjsonResponseBody](#applicationjsonresponsebody) + +sealed interface that stores response body + +## ApplicationjsonResponseBody +public record ApplicationjsonResponseBody
+implements [SealedResponseBody](#sealedresponsebody) + +A record class to store response body for contentType="application/json" + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| ApplicationjsonResponseBody(ApplicationjsonSchema.MapJsonSchema1Boxed body)
Creates an instance | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| ApplicationjsonSchema.MapJsonSchema1Boxed | body()
returns the body passed in in the constructor | + +## FakeGetCode404Response1 +public static class FakeGetCode404Response1
+extends ResponseDeserializer<[SealedResponseBody](#sealedresponsebody), Nothing?, [SealedMediaType](#sealedmediatype)> + +a class that deserializes responses + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| FakeGetCode404Response1()
Creates an instance | + +### Field Summary +| Modifier and Type | Field and Description | +| ----------------- | --------------------- | +| 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 | +| ----------------- | ---------------------- | +| ApiResponse<[SealedResponseBody](#sealedresponsebody), Nothing?> | deserialize(HttpResponse response, SchemaConfiguration configuration)
called by endpoint when deserialize responses | diff --git a/samples/client/petstore/kotlin/docs/paths/fake/get/responses/code404response/content/applicationjson/ApplicationjsonSchema.md b/samples/client/petstore/kotlin/docs/paths/fake/get/responses/code404response/content/applicationjson/ApplicationjsonSchema.md new file mode 100644 index 00000000000..3ce84c1630e --- /dev/null +++ b/samples/client/petstore/kotlin/docs/paths/fake/get/responses/code404response/content/applicationjson/ApplicationjsonSchema.md @@ -0,0 +1,49 @@ +# ApplicationjsonSchema +public class ApplicationjsonSchema
+ +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 + +## Nested Class Summary +| Modifier and Type | Class and Description | +| ----------------- | ---------------------- | +| sealed interface | [ApplicationjsonSchema.ApplicationjsonSchema1Boxed](#applicationjsonschema1boxed)
sealed interface for validated payloads | +| record | [ApplicationjsonSchema.ApplicationjsonSchema1BoxedMap](#applicationjsonschema1boxedmap)
boxed class to store validated Map payloads | +| static class | [ApplicationjsonSchema.ApplicationjsonSchema1](#applicationjsonschema1)
schema class | + +## ApplicationjsonSchema1Boxed +public sealed interface ApplicationjsonSchema1Boxed
+permits
+[ApplicationjsonSchema1BoxedMap](#applicationjsonschema1boxedmap) + +sealed interface that stores validated payloads using boxed classes + +## ApplicationjsonSchema1BoxedMap +public record ApplicationjsonSchema1BoxedMap
+implements [ApplicationjsonSchema1Boxed](#applicationjsonschema1boxed) + +record that stores validated Map payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| ApplicationjsonSchema1BoxedMap(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 | + +## ApplicationjsonSchema1 +public static class ApplicationjsonSchema1
+extends MapJsonSchema.MapJsonSchema1 + +A schema class that validates payloads + +| Methods Inherited from class org.openapijsonschematools.client.schemas.MapJsonSchema.MapJsonSchema1 | +| ------------------------------------------------------------------ | +| validate | +| validateAndBox | diff --git a/samples/client/petstore/kotlin/docs/paths/fake/patch/FakePatchRequestBody.md b/samples/client/petstore/kotlin/docs/paths/fake/patch/FakePatchRequestBody.md new file mode 100644 index 00000000000..3f33af4fba5 --- /dev/null +++ b/samples/client/petstore/kotlin/docs/paths/fake/patch/FakePatchRequestBody.md @@ -0,0 +1,17 @@ +# FakePatchRequestBody + +public class FakePatchRequestBody 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 + +## Nested Class Summary +| Modifier and Type | Class and Description | +| ----------------- | --------------------- | +| static class | [FakePatchRequestBody.FakePatchRequestBody1](#fakepatchrequestbody1)
class that serializes request bodies | + +## FakePatchRequestBody1 +public static class FakePatchRequestBody1 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/kotlin/docs/paths/fake/patch/FakePatchResponses.md b/samples/client/petstore/kotlin/docs/paths/fake/patch/FakePatchResponses.md new file mode 100644 index 00000000000..da8c837467d --- /dev/null +++ b/samples/client/petstore/kotlin/docs/paths/fake/patch/FakePatchResponses.md @@ -0,0 +1,29 @@ +# FakePatchResponses + +public class FakePatchResponses + +A class that contains necessary responses classes +- a sealed interface, EndpointResponse, that stores endpoint responses +- records for each endpoint response + +## Nested Class Summary +| Modifier and Type | Class and Description | +| ----------------- | --------------------- | +| sealed interface | [EndpointResponse](#endpointresponse)
stores the endpoint responses | +| record | [EndpointFakePatchCode200Response](#endpointfakepatchcode200response)
the response for 200 | + +## EndpointResponse +public sealed interface EndpointResponse permits
+[EndpointFakePatchCode200Response](#endpointfakepatchcode200response) + +a sealed interface that stores endpoint responses + +## EndpointFakePatchCode200Response +public record EndpointFakePatchCode200Response( + HttpResponse response, + [FakePatchCode200Response.SealedResponseBody](../../../paths/fake/patch/responses/FakePatchCode200Response.md#sealedresponsebody) body, + Nothing? headers +) implements EndpointResponse, ApiResponse
+ +a class that stores an endpoint response + diff --git a/samples/client/petstore/kotlin/docs/paths/fake/patch/responses/FakePatchCode200Response.md b/samples/client/petstore/kotlin/docs/paths/fake/patch/responses/FakePatchCode200Response.md new file mode 100644 index 00000000000..e3cc385681c --- /dev/null +++ b/samples/client/petstore/kotlin/docs/paths/fake/patch/responses/FakePatchCode200Response.md @@ -0,0 +1,87 @@ +# FakePatchCode200Response + +public class FakePatchCode200Response + +A class that contains necessary nested response classes +- SealedMediaType, a sealed interface which contains all the schema/encoding info for each contentType +- records which implement SealedMediaType, the concrete media types +- SealedResponseBody, a sealed interface which contains all the contentType/schema types +- records which implement SealedResponseBody, the concrete response body types +- a class that extends ResponseDeserializer and is used to deserialize responses + +## Nested Class Summary +| Modifier and Type | Class and Description | +| ----------------- | --------------------- | +| sealed interface | [FakePatchCode200Response.SealedMediaType](#sealedmediatype)
media type sealed interface | +| record | [FakePatchCode200Response.ApplicationjsonMediaType](#applicationjsonmediatype)
record storing schema + encoding for a specific contentType | +| sealed interface | [FakePatchCode200Response.SealedResponseBody](#sealedresponsebody)
response body sealed interface | +| record | [FakePatchCode200Response.ApplicationjsonResponseBody](#applicationjsonresponsebody)
implements sealed interface to store response body | +| static class | [FakePatchCode200Response.FakePatchCode200Response1](#fakepatchcode200response1)
class that deserializes responses | + +## SealedMediaType +public sealed interface SealedMediaType
+permits
+[ApplicationjsonMediaType](#applicationjsonmediatype) + +sealed interface that stores schema and encoding info + +## ApplicationjsonMediaType +public record ApplicationjsonMediaType
+implements [SealedMediaType](#sealedmediatype), MediaType<[ApplicationjsonSchema.ApplicationjsonSchema1](../../../../paths/fake/patch/responses/code200response/content/applicationjson/ApplicationjsonSchema.md#applicationjsonschema1), Nothing?> + +class storing schema info for a specific contentType + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| ApplicationjsonMediaType()
Creates an instance | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| [ApplicationjsonSchema.ApplicationjsonSchema1](../../../../paths/fake/patch/responses/code200response/content/applicationjson/ApplicationjsonSchema.md#applicationjsonschema1) | schema()
the schema for this MediaType | +| Nothing? | encoding()
the encoding info | + +## SealedResponseBody +public sealed interface SealedResponseBody
+permits
+[ApplicationjsonResponseBody](#applicationjsonresponsebody) + +sealed interface that stores response body + +## ApplicationjsonResponseBody +public record ApplicationjsonResponseBody
+implements [SealedResponseBody](#sealedresponsebody) + +A record class to store response body for contentType="application/json" + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| ApplicationjsonResponseBody(ApplicationjsonSchema.[Client1Boxed](../../../../components/schemas/Client.md#client1boxed) body)
Creates an instance | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| ApplicationjsonSchema.[Client1Boxed](../../../../components/schemas/Client.md#client1boxed) | body()
returns the body passed in in the constructor | + +## FakePatchCode200Response1 +public static class FakePatchCode200Response1
+extends ResponseDeserializer<[SealedResponseBody](#sealedresponsebody), Nothing?, [SealedMediaType](#sealedmediatype)> + +a class that deserializes responses + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| FakePatchCode200Response1()
Creates an instance | + +### Field Summary +| Modifier and Type | Field and Description | +| ----------------- | --------------------- | +| 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 | +| ----------------- | ---------------------- | +| ApiResponse<[SealedResponseBody](#sealedresponsebody), Nothing?> | deserialize(HttpResponse response, SchemaConfiguration configuration)
called by endpoint when deserialize responses | diff --git a/samples/client/petstore/kotlin/docs/paths/fake/patch/responses/code200response/content/applicationjson/ApplicationjsonSchema.md b/samples/client/petstore/kotlin/docs/paths/fake/patch/responses/code200response/content/applicationjson/ApplicationjsonSchema.md new file mode 100644 index 00000000000..534041524ca --- /dev/null +++ b/samples/client/petstore/kotlin/docs/paths/fake/patch/responses/code200response/content/applicationjson/ApplicationjsonSchema.md @@ -0,0 +1,19 @@ +# ApplicationjsonSchema +public class ApplicationjsonSchema
+extends [Client1](../../../../../../../components/schemas/Client.md#client) + +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 + +## Nested Class Summary +| Modifier and Type | Class and Description | +| ----------------- | ---------------------- | +| static class | [ApplicationjsonSchema.ApplicationjsonSchema1](#applicationjsonschema1)
schema class | + +## ApplicationjsonSchema1 +public static class ApplicationjsonSchema1
+extends [Client.Client1](../../../../../../../components/schemas/Client.md#client1) + +A schema class that validates payloads diff --git a/samples/client/petstore/kotlin/docs/paths/fake/post/FakePostRequestBody.md b/samples/client/petstore/kotlin/docs/paths/fake/post/FakePostRequestBody.md new file mode 100644 index 00000000000..2bc1daf8044 --- /dev/null +++ b/samples/client/petstore/kotlin/docs/paths/fake/post/FakePostRequestBody.md @@ -0,0 +1,90 @@ +# FakePostRequestBody + +public class FakePostRequestBody + +A class that contains necessary nested request body classes +- SealedMediaType, a sealed interface which contains all the schema/encoding info for each contentType +- records which implement SealedMediaType, the concrete media types +- a class that extends RequestBodySerializer and is used to serialize input SealedRequestBody instances +- SealedRequestBody, a sealed interface which contains all the contentType/schema input types +- records which implement SealedRequestBody, the concrete request body types + +## Nested Class Summary +| Modifier and Type | Class and Description | +| ----------------- | --------------------- | +| sealed interface | [FakePostRequestBody.SealedMediaType](#sealedmediatype)
media type sealed interface | +| record | [FakePostRequestBody.ApplicationxwwwformurlencodedMediaType](#applicationxwwwformurlencodedmediatype)
record storing schema + encoding for a specific contentType | +| static class | [FakePostRequestBody.FakePostRequestBody1](#fakepostrequestbody1)
class that serializes request bodies | +| sealed interface | [FakePostRequestBody.SealedRequestBody](#sealedrequestbody)
request body sealed interface | +| record | [FakePostRequestBody.ApplicationxwwwformurlencodedRequestBody](#applicationxwwwformurlencodedrequestbody)
implements sealed interface to store request body input | + +## SealedMediaType +public sealed interface SealedMediaType
+permits
+[ApplicationxwwwformurlencodedMediaType](#applicationxwwwformurlencodedmediatype) + +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), Nothing?> + +class storing schema info for a specific contentType + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| ApplicationxwwwformurlencodedMediaType()
Creates an instance | + +### 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 | +| Nothing? | encoding()
the encoding info | + +## FakePostRequestBody1 +public static class FakePostRequestBody1
+ +a class that serializes SealedRequestBody request bodies + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| FakePostRequestBody1()
Creates an instance | + +### Field Summary +| Modifier and Type | Field and Description | +| ----------------- | --------------------- | +| boolean | required = false
whether the request body is required | +| Map | content = Map.ofEntries(
    new AbstractMap.SimpleEntry<>("application/x-www-form-urlencoded", new [ApplicationxwwwformurlencodedMediaType](#applicationxwwwformurlencodedmediatype)())
)
the contentType to schema info | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| SerializedRequestBody | serialize([SealedRequestBody](#sealedrequestbody) requestBody)
called by endpoint when creating request body bytes | + +## SealedRequestBody +public sealed interface SealedRequestBody
+permits
+[ApplicationxwwwformurlencodedRequestBody](#applicationxwwwformurlencodedrequestbody) + +sealed interface that stores request contentType + validated schema data + +## ApplicationxwwwformurlencodedRequestBody +public record ApplicationxwwwformurlencodedRequestBody
+implements [SealedRequestBody](#sealedrequestbody),
+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 | + +### 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 | diff --git a/samples/client/petstore/kotlin/docs/paths/fake/post/FakePostResponses.md b/samples/client/petstore/kotlin/docs/paths/fake/post/FakePostResponses.md new file mode 100644 index 00000000000..dc9d84ba978 --- /dev/null +++ b/samples/client/petstore/kotlin/docs/paths/fake/post/FakePostResponses.md @@ -0,0 +1,29 @@ +# FakePostResponses + +public class FakePostResponses + +A class that contains necessary responses classes +- a sealed interface, EndpointResponse, that stores endpoint responses +- records for each endpoint response + +## Nested Class Summary +| Modifier and Type | Class and Description | +| ----------------- | --------------------- | +| sealed interface | [EndpointResponse](#endpointresponse)
stores the endpoint responses | +| record | [EndpointFakePostCode200Response](#endpointfakepostcode200response)
the response for 200 | + +## EndpointResponse +public sealed interface EndpointResponse permits
+[EndpointFakePostCode200Response](#endpointfakepostcode200response) + +a sealed interface that stores endpoint responses + +## EndpointFakePostCode200Response +public record EndpointFakePostCode200Response( + HttpResponse response, + Nothing? body, + Nothing? headers +) implements EndpointResponse, ApiResponse
+ +a class that stores an endpoint response + diff --git a/samples/client/petstore/kotlin/docs/paths/fake/post/FakePostSecurityInfo.md b/samples/client/petstore/kotlin/docs/paths/fake/post/FakePostSecurityInfo.md new file mode 100644 index 00000000000..0166862a304 --- /dev/null +++ b/samples/client/petstore/kotlin/docs/paths/fake/post/FakePostSecurityInfo.md @@ -0,0 +1,40 @@ +# FakePostSecurityInfo +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 +- an enum class that describes security index values + +## Nested Class Summary +| Modifier and Type | Class and Description | +| ----------------- | --------------------- | +| static class | [FakePostSecurityInfo.FakePostSecurityInfo1](#fakepostsecurityinfo1)
SecurityRequirementObjectProvider +| enum | [FakePostSecurityInfo.SecurityIndex](#securityindex)
class that stores a security index | + +## FakePostSecurityInfo1 +implements SecurityRequirementObjectProvider<[SecurityIndex](#securityindex)> + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| FakePostSecurityInfo1()
Creates an instance | + +### Field Summary +| Modifier and Type | Field and Description | +| ----------------- | --------------------- | +| [FakePostSecurityRequirementObject0](../../../paths/fake/post/security/FakePostSecurityRequirementObject0.md) | security0 | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| SecurityRequirementObject | getSecurityRequirementObject(@Nullable [SecurityIndex](#securityindex) securityIndex)
If null is input, then the instance's securityIndex will be used | + +## SecurityIndex +enum SecurityIndex
+ +### Enum Constant Summary +| Enum Constant And Description | +| ----------------------------- | +| SECURITY_0
security 0 | diff --git a/samples/client/petstore/kotlin/docs/paths/fake/post/requestbody/content/applicationxwwwformurlencoded/ApplicationxwwwformurlencodedSchema.md b/samples/client/petstore/kotlin/docs/paths/fake/post/requestbody/content/applicationxwwwformurlencoded/ApplicationxwwwformurlencodedSchema.md new file mode 100644 index 00000000000..c6e16f2048b --- /dev/null +++ b/samples/client/petstore/kotlin/docs/paths/fake/post/requestbody/content/applicationxwwwformurlencoded/ApplicationxwwwformurlencodedSchema.md @@ -0,0 +1,1331 @@ +# ApplicationxwwwformurlencodedSchema +public class ApplicationxwwwformurlencodedSchema
+ +A class that contains necessary nested +- schema classes (which validate payloads), extends JsonSchema +- sealed interfaces which store validated payloads, java version of a sum type +- boxed classes which store validated payloads, sealed permits class implementations +- classes to store validated map payloads, extends FrozenMap +- classes to build inputs for map payloads + +## Nested Class Summary +| Modifier and Type | Class and Description | +| ----------------- | ---------------------- | +| sealed interface | [ApplicationxwwwformurlencodedSchema.ApplicationxwwwformurlencodedSchema1Boxed](#applicationxwwwformurlencodedschema1boxed)
sealed interface for validated payloads | +| record | [ApplicationxwwwformurlencodedSchema.ApplicationxwwwformurlencodedSchema1BoxedMap](#applicationxwwwformurlencodedschema1boxedmap)
boxed class to store validated Map payloads | +| static class | [ApplicationxwwwformurlencodedSchema.ApplicationxwwwformurlencodedSchema1](#applicationxwwwformurlencodedschema1)
schema class | +| static class | [ApplicationxwwwformurlencodedSchema.ApplicationxwwwformurlencodedSchemaMapBuilder](#applicationxwwwformurlencodedschemamapbuilder)
builder for Map payloads | +| static class | [ApplicationxwwwformurlencodedSchema.ApplicationxwwwformurlencodedSchemaMap](#applicationxwwwformurlencodedschemamap)
output class for Map payloads | +| sealed interface | [ApplicationxwwwformurlencodedSchema.ApplicationxwwwformurlencodedCallbackBoxed](#applicationxwwwformurlencodedcallbackboxed)
sealed interface for validated payloads | +| record | [ApplicationxwwwformurlencodedSchema.ApplicationxwwwformurlencodedCallbackBoxedString](#applicationxwwwformurlencodedcallbackboxedstring)
boxed class to store validated String payloads | +| static class | [ApplicationxwwwformurlencodedSchema.ApplicationxwwwformurlencodedCallback](#applicationxwwwformurlencodedcallback)
schema class | +| sealed interface | [ApplicationxwwwformurlencodedSchema.ApplicationxwwwformurlencodedPasswordBoxed](#applicationxwwwformurlencodedpasswordboxed)
sealed interface for validated payloads | +| record | [ApplicationxwwwformurlencodedSchema.ApplicationxwwwformurlencodedPasswordBoxedString](#applicationxwwwformurlencodedpasswordboxedstring)
boxed class to store validated String payloads | +| static class | [ApplicationxwwwformurlencodedSchema.ApplicationxwwwformurlencodedPassword](#applicationxwwwformurlencodedpassword)
schema class | +| sealed interface | [ApplicationxwwwformurlencodedSchema.ApplicationxwwwformurlencodedDateTimeBoxed](#applicationxwwwformurlencodeddatetimeboxed)
sealed interface for validated payloads | +| record | [ApplicationxwwwformurlencodedSchema.ApplicationxwwwformurlencodedDateTimeBoxedString](#applicationxwwwformurlencodeddatetimeboxedstring)
boxed class to store validated String payloads | +| static class | [ApplicationxwwwformurlencodedSchema.ApplicationxwwwformurlencodedDateTime](#applicationxwwwformurlencodeddatetime)
schema class | +| sealed interface | [ApplicationxwwwformurlencodedSchema.ApplicationxwwwformurlencodedDateBoxed](#applicationxwwwformurlencodeddateboxed)
sealed interface for validated payloads | +| record | [ApplicationxwwwformurlencodedSchema.ApplicationxwwwformurlencodedDateBoxedString](#applicationxwwwformurlencodeddateboxedstring)
boxed class to store validated String payloads | +| static class | [ApplicationxwwwformurlencodedSchema.ApplicationxwwwformurlencodedDate](#applicationxwwwformurlencodeddate)
schema class | +| sealed interface | [ApplicationxwwwformurlencodedSchema.ApplicationxwwwformurlencodedBinaryBoxed](#applicationxwwwformurlencodedbinaryboxed)
sealed interface for validated payloads | +| static class | [ApplicationxwwwformurlencodedSchema.ApplicationxwwwformurlencodedBinary](#applicationxwwwformurlencodedbinary)
schema class | +| sealed interface | [ApplicationxwwwformurlencodedSchema.ApplicationxwwwformurlencodedByteBoxed](#applicationxwwwformurlencodedbyteboxed)
sealed interface for validated payloads | +| record | [ApplicationxwwwformurlencodedSchema.ApplicationxwwwformurlencodedByteBoxedString](#applicationxwwwformurlencodedbyteboxedstring)
boxed class to store validated String payloads | +| static class | [ApplicationxwwwformurlencodedSchema.ApplicationxwwwformurlencodedByte](#applicationxwwwformurlencodedbyte)
schema class | +| sealed interface | [ApplicationxwwwformurlencodedSchema.ApplicationxwwwformurlencodedPatternWithoutDelimiterBoxed](#applicationxwwwformurlencodedpatternwithoutdelimiterboxed)
sealed interface for validated payloads | +| record | [ApplicationxwwwformurlencodedSchema.ApplicationxwwwformurlencodedPatternWithoutDelimiterBoxedString](#applicationxwwwformurlencodedpatternwithoutdelimiterboxedstring)
boxed class to store validated String payloads | +| static class | [ApplicationxwwwformurlencodedSchema.ApplicationxwwwformurlencodedPatternWithoutDelimiter](#applicationxwwwformurlencodedpatternwithoutdelimiter)
schema class | +| sealed interface | [ApplicationxwwwformurlencodedSchema.ApplicationxwwwformurlencodedStringBoxed](#applicationxwwwformurlencodedstringboxed)
sealed interface for validated payloads | +| record | [ApplicationxwwwformurlencodedSchema.ApplicationxwwwformurlencodedStringBoxedString](#applicationxwwwformurlencodedstringboxedstring)
boxed class to store validated String payloads | +| static class | [ApplicationxwwwformurlencodedSchema.ApplicationxwwwformurlencodedString](#applicationxwwwformurlencodedstring)
schema class | +| sealed interface | [ApplicationxwwwformurlencodedSchema.ApplicationxwwwformurlencodedDoubleBoxed](#applicationxwwwformurlencodeddoubleboxed)
sealed interface for validated payloads | +| record | [ApplicationxwwwformurlencodedSchema.ApplicationxwwwformurlencodedDoubleBoxedNumber](#applicationxwwwformurlencodeddoubleboxednumber)
boxed class to store validated Number payloads | +| static class | [ApplicationxwwwformurlencodedSchema.ApplicationxwwwformurlencodedDouble](#applicationxwwwformurlencodeddouble)
schema class | +| sealed interface | [ApplicationxwwwformurlencodedSchema.ApplicationxwwwformurlencodedFloatBoxed](#applicationxwwwformurlencodedfloatboxed)
sealed interface for validated payloads | +| record | [ApplicationxwwwformurlencodedSchema.ApplicationxwwwformurlencodedFloatBoxedNumber](#applicationxwwwformurlencodedfloatboxednumber)
boxed class to store validated Number payloads | +| static class | [ApplicationxwwwformurlencodedSchema.ApplicationxwwwformurlencodedFloat](#applicationxwwwformurlencodedfloat)
schema class | +| sealed interface | [ApplicationxwwwformurlencodedSchema.ApplicationxwwwformurlencodedNumberBoxed](#applicationxwwwformurlencodednumberboxed)
sealed interface for validated payloads | +| record | [ApplicationxwwwformurlencodedSchema.ApplicationxwwwformurlencodedNumberBoxedNumber](#applicationxwwwformurlencodednumberboxednumber)
boxed class to store validated Number payloads | +| static class | [ApplicationxwwwformurlencodedSchema.ApplicationxwwwformurlencodedNumber](#applicationxwwwformurlencodednumber)
schema class | +| sealed interface | [ApplicationxwwwformurlencodedSchema.ApplicationxwwwformurlencodedInt64Boxed](#applicationxwwwformurlencodedint64boxed)
sealed interface for validated payloads | +| record | [ApplicationxwwwformurlencodedSchema.ApplicationxwwwformurlencodedInt64BoxedNumber](#applicationxwwwformurlencodedint64boxednumber)
boxed class to store validated Number payloads | +| static class | [ApplicationxwwwformurlencodedSchema.ApplicationxwwwformurlencodedInt64](#applicationxwwwformurlencodedint64)
schema class | +| sealed interface | [ApplicationxwwwformurlencodedSchema.ApplicationxwwwformurlencodedInt32Boxed](#applicationxwwwformurlencodedint32boxed)
sealed interface for validated payloads | +| record | [ApplicationxwwwformurlencodedSchema.ApplicationxwwwformurlencodedInt32BoxedNumber](#applicationxwwwformurlencodedint32boxednumber)
boxed class to store validated Number payloads | +| static class | [ApplicationxwwwformurlencodedSchema.ApplicationxwwwformurlencodedInt32](#applicationxwwwformurlencodedint32)
schema class | +| sealed interface | [ApplicationxwwwformurlencodedSchema.ApplicationxwwwformurlencodedIntegerBoxed](#applicationxwwwformurlencodedintegerboxed)
sealed interface for validated payloads | +| record | [ApplicationxwwwformurlencodedSchema.ApplicationxwwwformurlencodedIntegerBoxedNumber](#applicationxwwwformurlencodedintegerboxednumber)
boxed class to store validated Number payloads | +| static class | [ApplicationxwwwformurlencodedSchema.ApplicationxwwwformurlencodedInteger](#applicationxwwwformurlencodedinteger)
schema class | + +## ApplicationxwwwformurlencodedSchema1Boxed +public sealed interface ApplicationxwwwformurlencodedSchema1Boxed
+permits
+[ApplicationxwwwformurlencodedSchema1BoxedMap](#applicationxwwwformurlencodedschema1boxedmap) + +sealed interface that stores validated payloads using boxed classes + +## ApplicationxwwwformurlencodedSchema1BoxedMap +public record ApplicationxwwwformurlencodedSchema1BoxedMap
+implements [ApplicationxwwwformurlencodedSchema1Boxed](#applicationxwwwformurlencodedschema1boxed) + +record that stores validated Map payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| ApplicationxwwwformurlencodedSchema1BoxedMap([ApplicationxwwwformurlencodedSchemaMap](#applicationxwwwformurlencodedschemamap) data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| [ApplicationxwwwformurlencodedSchemaMap](#applicationxwwwformurlencodedschemamap) | data()
validated payload | +| @Nullable Object | getData()
validated payload | + +## ApplicationxwwwformurlencodedSchema1 +public static class ApplicationxwwwformurlencodedSchema1
+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.fake.post.requestbody.content.applicationxwwwformurlencoded.ApplicationxwwwformurlencodedSchema; + +import java.util.Arrays; +import java.util.List; +import java.util.AbstractMap; + +static final SchemaConfiguration configuration = new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().build()); + +// Map validation +ApplicationxwwwformurlencodedSchema.ApplicationxwwwformurlencodedSchemaMap validatedPayload = + ApplicationxwwwformurlencodedSchema.ApplicationxwwwformurlencodedSchema1.validate( + 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(), + configuration +); +``` + +### Field Summary +| Modifier and Type | Field and Description | +| ----------------- | ---------------------- | +| Set> | type = Set.of(Map.class) | +| Map> | properties = Map.ofEntries(
    new PropertyEntry("integer", [ApplicationxwwwformurlencodedInteger.class](#applicationxwwwformurlencodedinteger))),
    new PropertyEntry("int32", [ApplicationxwwwformurlencodedInt32.class](#applicationxwwwformurlencodedint32))),
    new PropertyEntry("int64", [ApplicationxwwwformurlencodedInt64.class](#applicationxwwwformurlencodedint64))),
    new PropertyEntry("number", [ApplicationxwwwformurlencodedNumber.class](#applicationxwwwformurlencodednumber))),
    new PropertyEntry("float", [ApplicationxwwwformurlencodedFloat.class](#applicationxwwwformurlencodedfloat))),
    new PropertyEntry("double", [ApplicationxwwwformurlencodedDouble.class](#applicationxwwwformurlencodeddouble))),
    new PropertyEntry("string", [ApplicationxwwwformurlencodedString.class](#applicationxwwwformurlencodedstring))),
    new PropertyEntry("pattern_without_delimiter", [ApplicationxwwwformurlencodedPatternWithoutDelimiter.class](#applicationxwwwformurlencodedpatternwithoutdelimiter))),
    new PropertyEntry("byte", [ApplicationxwwwformurlencodedByte.class](#applicationxwwwformurlencodedbyte))),
    new PropertyEntry("binary", [ApplicationxwwwformurlencodedBinary.class](#applicationxwwwformurlencodedbinary))),
    new PropertyEntry("date", [ApplicationxwwwformurlencodedDate.class](#applicationxwwwformurlencodeddate))),
    new PropertyEntry("dateTime", [ApplicationxwwwformurlencodedDateTime.class](#applicationxwwwformurlencodeddatetime))),
    new PropertyEntry("password", [ApplicationxwwwformurlencodedPassword.class](#applicationxwwwformurlencodedpassword))),
    new PropertyEntry("callback", [ApplicationxwwwformurlencodedCallback.class](#applicationxwwwformurlencodedcallback)))
)
| +| Set | required = Set.of(
    "byte",
    "double",
    "number",
    "pattern_without_delimiter"
)
| + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| [ApplicationxwwwformurlencodedSchemaMap](#applicationxwwwformurlencodedschemamap) | validate([Map<?, ?>](#applicationxwwwformurlencodedschemamapbuilder) arg, SchemaConfiguration configuration) | +| [ApplicationxwwwformurlencodedSchema1BoxedMap](#applicationxwwwformurlencodedschema1boxedmap) | validateAndBox([Map<?, ?>](#applicationxwwwformurlencodedschemamapbuilder) arg, SchemaConfiguration configuration) | +| [ApplicationxwwwformurlencodedSchema1Boxed](#applicationxwwwformurlencodedschema1boxed) | validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) | +| @Nullable Object | validate(@Nullable Object arg, SchemaConfiguration configuration) | + +## ApplicationxwwwformurlencodedSchemaMap0000Builder +public class ApplicationxwwwformurlencodedSchemaMap0000Builder
+builder for `Map` + +A class that builds the Map input type + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| ApplicationxwwwformurlencodedSchemaMap0000Builder(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 | +| [ApplicationxwwwformurlencodedSchemaMap0000Builder](#applicationxwwwformurlencodedschemamap0000builder) | setInteger(int value) | +| [ApplicationxwwwformurlencodedSchemaMap0000Builder](#applicationxwwwformurlencodedschemamap0000builder) | setInteger(float value) | +| [ApplicationxwwwformurlencodedSchemaMap0000Builder](#applicationxwwwformurlencodedschemamap0000builder) | setInteger(long value) | +| [ApplicationxwwwformurlencodedSchemaMap0000Builder](#applicationxwwwformurlencodedschemamap0000builder) | setInteger(double value) | +| [ApplicationxwwwformurlencodedSchemaMap0000Builder](#applicationxwwwformurlencodedschemamap0000builder) | int32(int value) | +| [ApplicationxwwwformurlencodedSchemaMap0000Builder](#applicationxwwwformurlencodedschemamap0000builder) | int32(float value) | +| [ApplicationxwwwformurlencodedSchemaMap0000Builder](#applicationxwwwformurlencodedschemamap0000builder) | int64(int value) | +| [ApplicationxwwwformurlencodedSchemaMap0000Builder](#applicationxwwwformurlencodedschemamap0000builder) | int64(float value) | +| [ApplicationxwwwformurlencodedSchemaMap0000Builder](#applicationxwwwformurlencodedschemamap0000builder) | int64(long value) | +| [ApplicationxwwwformurlencodedSchemaMap0000Builder](#applicationxwwwformurlencodedschemamap0000builder) | int64(double value) | +| [ApplicationxwwwformurlencodedSchemaMap0000Builder](#applicationxwwwformurlencodedschemamap0000builder) | setFloat(int value) | +| [ApplicationxwwwformurlencodedSchemaMap0000Builder](#applicationxwwwformurlencodedschemamap0000builder) | setFloat(float value) | +| [ApplicationxwwwformurlencodedSchemaMap0000Builder](#applicationxwwwformurlencodedschemamap0000builder) | setFloat(long value) | +| [ApplicationxwwwformurlencodedSchemaMap0000Builder](#applicationxwwwformurlencodedschemamap0000builder) | setFloat(double value) | +| [ApplicationxwwwformurlencodedSchemaMap0000Builder](#applicationxwwwformurlencodedschemamap0000builder) | setString(String value) | +| [ApplicationxwwwformurlencodedSchemaMap0000Builder](#applicationxwwwformurlencodedschemamap0000builder) | binary(String value) | +| [ApplicationxwwwformurlencodedSchemaMap0000Builder](#applicationxwwwformurlencodedschemamap0000builder) | date(String value) | +| [ApplicationxwwwformurlencodedSchemaMap0000Builder](#applicationxwwwformurlencodedschemamap0000builder) | dateTime(String value) | +| [ApplicationxwwwformurlencodedSchemaMap0000Builder](#applicationxwwwformurlencodedschemamap0000builder) | password(String value) | +| [ApplicationxwwwformurlencodedSchemaMap0000Builder](#applicationxwwwformurlencodedschemamap0000builder) | callback(String value) | +| [ApplicationxwwwformurlencodedSchemaMap0000Builder](#applicationxwwwformurlencodedschemamap0000builder) | additionalProperty(String key, Nothing? value) | +| [ApplicationxwwwformurlencodedSchemaMap0000Builder](#applicationxwwwformurlencodedschemamap0000builder) | additionalProperty(String key, boolean value) | +| [ApplicationxwwwformurlencodedSchemaMap0000Builder](#applicationxwwwformurlencodedschemamap0000builder) | additionalProperty(String key, String value) | +| [ApplicationxwwwformurlencodedSchemaMap0000Builder](#applicationxwwwformurlencodedschemamap0000builder) | additionalProperty(String key, int value) | +| [ApplicationxwwwformurlencodedSchemaMap0000Builder](#applicationxwwwformurlencodedschemamap0000builder) | additionalProperty(String key, float value) | +| [ApplicationxwwwformurlencodedSchemaMap0000Builder](#applicationxwwwformurlencodedschemamap0000builder) | additionalProperty(String key, long value) | +| [ApplicationxwwwformurlencodedSchemaMap0000Builder](#applicationxwwwformurlencodedschemamap0000builder) | additionalProperty(String key, double value) | +| [ApplicationxwwwformurlencodedSchemaMap0000Builder](#applicationxwwwformurlencodedschemamap0000builder) | additionalProperty(String key, List value) | +| [ApplicationxwwwformurlencodedSchemaMap0000Builder](#applicationxwwwformurlencodedschemamap0000builder) | additionalProperty(String key, Map value) | + +## ApplicationxwwwformurlencodedSchemaMap0001Builder +public class ApplicationxwwwformurlencodedSchemaMap0001Builder
+builder for `Map` + +A class that builds the Map input type + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| ApplicationxwwwformurlencodedSchemaMap0001Builder(Map instance)
Creates a builder that contains the passed instance | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| [ApplicationxwwwformurlencodedSchemaMap0000Builder](#applicationxwwwformurlencodedschemamap0000builder) | pattern_without_delimiter(String value) | + +## ApplicationxwwwformurlencodedSchemaMap0010Builder +public class ApplicationxwwwformurlencodedSchemaMap0010Builder
+builder for `Map` + +A class that builds the Map input type + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| ApplicationxwwwformurlencodedSchemaMap0010Builder(Map instance)
Creates a builder that contains the passed instance | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| [ApplicationxwwwformurlencodedSchemaMap0000Builder](#applicationxwwwformurlencodedschemamap0000builder) | setNumber(int value) | +| [ApplicationxwwwformurlencodedSchemaMap0000Builder](#applicationxwwwformurlencodedschemamap0000builder) | setNumber(float value) | +| [ApplicationxwwwformurlencodedSchemaMap0000Builder](#applicationxwwwformurlencodedschemamap0000builder) | setNumber(long value) | +| [ApplicationxwwwformurlencodedSchemaMap0000Builder](#applicationxwwwformurlencodedschemamap0000builder) | setNumber(double value) | + +## ApplicationxwwwformurlencodedSchemaMap0011Builder +public class ApplicationxwwwformurlencodedSchemaMap0011Builder
+builder for `Map` + +A class that builds the Map input type + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| ApplicationxwwwformurlencodedSchemaMap0011Builder(Map instance)
Creates a builder that contains the passed instance | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| [ApplicationxwwwformurlencodedSchemaMap0001Builder](#applicationxwwwformurlencodedschemamap0001builder) | setNumber(int value) | +| [ApplicationxwwwformurlencodedSchemaMap0001Builder](#applicationxwwwformurlencodedschemamap0001builder) | setNumber(float value) | +| [ApplicationxwwwformurlencodedSchemaMap0001Builder](#applicationxwwwformurlencodedschemamap0001builder) | setNumber(long value) | +| [ApplicationxwwwformurlencodedSchemaMap0001Builder](#applicationxwwwformurlencodedschemamap0001builder) | setNumber(double value) | +| [ApplicationxwwwformurlencodedSchemaMap0010Builder](#applicationxwwwformurlencodedschemamap0010builder) | pattern_without_delimiter(String value) | + +## ApplicationxwwwformurlencodedSchemaMap0100Builder +public class ApplicationxwwwformurlencodedSchemaMap0100Builder
+builder for `Map` + +A class that builds the Map input type + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| ApplicationxwwwformurlencodedSchemaMap0100Builder(Map instance)
Creates a builder that contains the passed instance | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| [ApplicationxwwwformurlencodedSchemaMap0000Builder](#applicationxwwwformurlencodedschemamap0000builder) | setDouble(int value) | +| [ApplicationxwwwformurlencodedSchemaMap0000Builder](#applicationxwwwformurlencodedschemamap0000builder) | setDouble(float value) | +| [ApplicationxwwwformurlencodedSchemaMap0000Builder](#applicationxwwwformurlencodedschemamap0000builder) | setDouble(long value) | +| [ApplicationxwwwformurlencodedSchemaMap0000Builder](#applicationxwwwformurlencodedschemamap0000builder) | setDouble(double value) | + +## ApplicationxwwwformurlencodedSchemaMap0101Builder +public class ApplicationxwwwformurlencodedSchemaMap0101Builder
+builder for `Map` + +A class that builds the Map input type + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| ApplicationxwwwformurlencodedSchemaMap0101Builder(Map instance)
Creates a builder that contains the passed instance | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| [ApplicationxwwwformurlencodedSchemaMap0001Builder](#applicationxwwwformurlencodedschemamap0001builder) | setDouble(int value) | +| [ApplicationxwwwformurlencodedSchemaMap0001Builder](#applicationxwwwformurlencodedschemamap0001builder) | setDouble(float value) | +| [ApplicationxwwwformurlencodedSchemaMap0001Builder](#applicationxwwwformurlencodedschemamap0001builder) | setDouble(long value) | +| [ApplicationxwwwformurlencodedSchemaMap0001Builder](#applicationxwwwformurlencodedschemamap0001builder) | setDouble(double value) | +| [ApplicationxwwwformurlencodedSchemaMap0100Builder](#applicationxwwwformurlencodedschemamap0100builder) | pattern_without_delimiter(String value) | + +## ApplicationxwwwformurlencodedSchemaMap0110Builder +public class ApplicationxwwwformurlencodedSchemaMap0110Builder
+builder for `Map` + +A class that builds the Map input type + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| ApplicationxwwwformurlencodedSchemaMap0110Builder(Map instance)
Creates a builder that contains the passed instance | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| [ApplicationxwwwformurlencodedSchemaMap0010Builder](#applicationxwwwformurlencodedschemamap0010builder) | setDouble(int value) | +| [ApplicationxwwwformurlencodedSchemaMap0010Builder](#applicationxwwwformurlencodedschemamap0010builder) | setDouble(float value) | +| [ApplicationxwwwformurlencodedSchemaMap0010Builder](#applicationxwwwformurlencodedschemamap0010builder) | setDouble(long value) | +| [ApplicationxwwwformurlencodedSchemaMap0010Builder](#applicationxwwwformurlencodedschemamap0010builder) | setDouble(double value) | +| [ApplicationxwwwformurlencodedSchemaMap0100Builder](#applicationxwwwformurlencodedschemamap0100builder) | setNumber(int value) | +| [ApplicationxwwwformurlencodedSchemaMap0100Builder](#applicationxwwwformurlencodedschemamap0100builder) | setNumber(float value) | +| [ApplicationxwwwformurlencodedSchemaMap0100Builder](#applicationxwwwformurlencodedschemamap0100builder) | setNumber(long value) | +| [ApplicationxwwwformurlencodedSchemaMap0100Builder](#applicationxwwwformurlencodedschemamap0100builder) | setNumber(double value) | + +## ApplicationxwwwformurlencodedSchemaMap0111Builder +public class ApplicationxwwwformurlencodedSchemaMap0111Builder
+builder for `Map` + +A class that builds the Map input type + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| ApplicationxwwwformurlencodedSchemaMap0111Builder(Map instance)
Creates a builder that contains the passed instance | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| [ApplicationxwwwformurlencodedSchemaMap0011Builder](#applicationxwwwformurlencodedschemamap0011builder) | setDouble(int value) | +| [ApplicationxwwwformurlencodedSchemaMap0011Builder](#applicationxwwwformurlencodedschemamap0011builder) | setDouble(float value) | +| [ApplicationxwwwformurlencodedSchemaMap0011Builder](#applicationxwwwformurlencodedschemamap0011builder) | setDouble(long value) | +| [ApplicationxwwwformurlencodedSchemaMap0011Builder](#applicationxwwwformurlencodedschemamap0011builder) | setDouble(double value) | +| [ApplicationxwwwformurlencodedSchemaMap0101Builder](#applicationxwwwformurlencodedschemamap0101builder) | setNumber(int value) | +| [ApplicationxwwwformurlencodedSchemaMap0101Builder](#applicationxwwwformurlencodedschemamap0101builder) | setNumber(float value) | +| [ApplicationxwwwformurlencodedSchemaMap0101Builder](#applicationxwwwformurlencodedschemamap0101builder) | setNumber(long value) | +| [ApplicationxwwwformurlencodedSchemaMap0101Builder](#applicationxwwwformurlencodedschemamap0101builder) | setNumber(double value) | +| [ApplicationxwwwformurlencodedSchemaMap0110Builder](#applicationxwwwformurlencodedschemamap0110builder) | pattern_without_delimiter(String value) | + +## ApplicationxwwwformurlencodedSchemaMap1000Builder +public class ApplicationxwwwformurlencodedSchemaMap1000Builder
+builder for `Map` + +A class that builds the Map input type + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| ApplicationxwwwformurlencodedSchemaMap1000Builder(Map instance)
Creates a builder that contains the passed instance | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| [ApplicationxwwwformurlencodedSchemaMap0000Builder](#applicationxwwwformurlencodedschemamap0000builder) | setByte(String value) | + +## ApplicationxwwwformurlencodedSchemaMap1001Builder +public class ApplicationxwwwformurlencodedSchemaMap1001Builder
+builder for `Map` + +A class that builds the Map input type + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| ApplicationxwwwformurlencodedSchemaMap1001Builder(Map instance)
Creates a builder that contains the passed instance | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| [ApplicationxwwwformurlencodedSchemaMap0001Builder](#applicationxwwwformurlencodedschemamap0001builder) | setByte(String value) | +| [ApplicationxwwwformurlencodedSchemaMap1000Builder](#applicationxwwwformurlencodedschemamap1000builder) | pattern_without_delimiter(String value) | + +## ApplicationxwwwformurlencodedSchemaMap1010Builder +public class ApplicationxwwwformurlencodedSchemaMap1010Builder
+builder for `Map` + +A class that builds the Map input type + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| ApplicationxwwwformurlencodedSchemaMap1010Builder(Map instance)
Creates a builder that contains the passed instance | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| [ApplicationxwwwformurlencodedSchemaMap0010Builder](#applicationxwwwformurlencodedschemamap0010builder) | setByte(String value) | +| [ApplicationxwwwformurlencodedSchemaMap1000Builder](#applicationxwwwformurlencodedschemamap1000builder) | setNumber(int value) | +| [ApplicationxwwwformurlencodedSchemaMap1000Builder](#applicationxwwwformurlencodedschemamap1000builder) | setNumber(float value) | +| [ApplicationxwwwformurlencodedSchemaMap1000Builder](#applicationxwwwformurlencodedschemamap1000builder) | setNumber(long value) | +| [ApplicationxwwwformurlencodedSchemaMap1000Builder](#applicationxwwwformurlencodedschemamap1000builder) | setNumber(double value) | + +## ApplicationxwwwformurlencodedSchemaMap1011Builder +public class ApplicationxwwwformurlencodedSchemaMap1011Builder
+builder for `Map` + +A class that builds the Map input type + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| ApplicationxwwwformurlencodedSchemaMap1011Builder(Map instance)
Creates a builder that contains the passed instance | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| [ApplicationxwwwformurlencodedSchemaMap0011Builder](#applicationxwwwformurlencodedschemamap0011builder) | setByte(String value) | +| [ApplicationxwwwformurlencodedSchemaMap1001Builder](#applicationxwwwformurlencodedschemamap1001builder) | setNumber(int value) | +| [ApplicationxwwwformurlencodedSchemaMap1001Builder](#applicationxwwwformurlencodedschemamap1001builder) | setNumber(float value) | +| [ApplicationxwwwformurlencodedSchemaMap1001Builder](#applicationxwwwformurlencodedschemamap1001builder) | setNumber(long value) | +| [ApplicationxwwwformurlencodedSchemaMap1001Builder](#applicationxwwwformurlencodedschemamap1001builder) | setNumber(double value) | +| [ApplicationxwwwformurlencodedSchemaMap1010Builder](#applicationxwwwformurlencodedschemamap1010builder) | pattern_without_delimiter(String value) | + +## ApplicationxwwwformurlencodedSchemaMap1100Builder +public class ApplicationxwwwformurlencodedSchemaMap1100Builder
+builder for `Map` + +A class that builds the Map input type + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| ApplicationxwwwformurlencodedSchemaMap1100Builder(Map instance)
Creates a builder that contains the passed instance | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| [ApplicationxwwwformurlencodedSchemaMap0100Builder](#applicationxwwwformurlencodedschemamap0100builder) | setByte(String value) | +| [ApplicationxwwwformurlencodedSchemaMap1000Builder](#applicationxwwwformurlencodedschemamap1000builder) | setDouble(int value) | +| [ApplicationxwwwformurlencodedSchemaMap1000Builder](#applicationxwwwformurlencodedschemamap1000builder) | setDouble(float value) | +| [ApplicationxwwwformurlencodedSchemaMap1000Builder](#applicationxwwwformurlencodedschemamap1000builder) | setDouble(long value) | +| [ApplicationxwwwformurlencodedSchemaMap1000Builder](#applicationxwwwformurlencodedschemamap1000builder) | setDouble(double value) | + +## ApplicationxwwwformurlencodedSchemaMap1101Builder +public class ApplicationxwwwformurlencodedSchemaMap1101Builder
+builder for `Map` + +A class that builds the Map input type + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| ApplicationxwwwformurlencodedSchemaMap1101Builder(Map instance)
Creates a builder that contains the passed instance | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| [ApplicationxwwwformurlencodedSchemaMap0101Builder](#applicationxwwwformurlencodedschemamap0101builder) | setByte(String value) | +| [ApplicationxwwwformurlencodedSchemaMap1001Builder](#applicationxwwwformurlencodedschemamap1001builder) | setDouble(int value) | +| [ApplicationxwwwformurlencodedSchemaMap1001Builder](#applicationxwwwformurlencodedschemamap1001builder) | setDouble(float value) | +| [ApplicationxwwwformurlencodedSchemaMap1001Builder](#applicationxwwwformurlencodedschemamap1001builder) | setDouble(long value) | +| [ApplicationxwwwformurlencodedSchemaMap1001Builder](#applicationxwwwformurlencodedschemamap1001builder) | setDouble(double value) | +| [ApplicationxwwwformurlencodedSchemaMap1100Builder](#applicationxwwwformurlencodedschemamap1100builder) | pattern_without_delimiter(String value) | + +## ApplicationxwwwformurlencodedSchemaMap1110Builder +public class ApplicationxwwwformurlencodedSchemaMap1110Builder
+builder for `Map` + +A class that builds the Map input type + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| ApplicationxwwwformurlencodedSchemaMap1110Builder(Map instance)
Creates a builder that contains the passed instance | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| [ApplicationxwwwformurlencodedSchemaMap0110Builder](#applicationxwwwformurlencodedschemamap0110builder) | setByte(String value) | +| [ApplicationxwwwformurlencodedSchemaMap1010Builder](#applicationxwwwformurlencodedschemamap1010builder) | setDouble(int value) | +| [ApplicationxwwwformurlencodedSchemaMap1010Builder](#applicationxwwwformurlencodedschemamap1010builder) | setDouble(float value) | +| [ApplicationxwwwformurlencodedSchemaMap1010Builder](#applicationxwwwformurlencodedschemamap1010builder) | setDouble(long value) | +| [ApplicationxwwwformurlencodedSchemaMap1010Builder](#applicationxwwwformurlencodedschemamap1010builder) | setDouble(double value) | +| [ApplicationxwwwformurlencodedSchemaMap1100Builder](#applicationxwwwformurlencodedschemamap1100builder) | setNumber(int value) | +| [ApplicationxwwwformurlencodedSchemaMap1100Builder](#applicationxwwwformurlencodedschemamap1100builder) | setNumber(float value) | +| [ApplicationxwwwformurlencodedSchemaMap1100Builder](#applicationxwwwformurlencodedschemamap1100builder) | setNumber(long value) | +| [ApplicationxwwwformurlencodedSchemaMap1100Builder](#applicationxwwwformurlencodedschemamap1100builder) | setNumber(double value) | + +## ApplicationxwwwformurlencodedSchemaMapBuilder +public class ApplicationxwwwformurlencodedSchemaMapBuilder
+builder for `Map` + +A class that builds the Map input type + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| ApplicationxwwwformurlencodedSchemaMapBuilder()
Creates a builder that contains an empty map | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| [ApplicationxwwwformurlencodedSchemaMap0111Builder](#applicationxwwwformurlencodedschemamap0111builder) | setByte(String value) | +| [ApplicationxwwwformurlencodedSchemaMap1011Builder](#applicationxwwwformurlencodedschemamap1011builder) | setDouble(int value) | +| [ApplicationxwwwformurlencodedSchemaMap1011Builder](#applicationxwwwformurlencodedschemamap1011builder) | setDouble(float value) | +| [ApplicationxwwwformurlencodedSchemaMap1011Builder](#applicationxwwwformurlencodedschemamap1011builder) | setDouble(long value) | +| [ApplicationxwwwformurlencodedSchemaMap1011Builder](#applicationxwwwformurlencodedschemamap1011builder) | setDouble(double value) | +| [ApplicationxwwwformurlencodedSchemaMap1101Builder](#applicationxwwwformurlencodedschemamap1101builder) | setNumber(int value) | +| [ApplicationxwwwformurlencodedSchemaMap1101Builder](#applicationxwwwformurlencodedschemamap1101builder) | setNumber(float value) | +| [ApplicationxwwwformurlencodedSchemaMap1101Builder](#applicationxwwwformurlencodedschemamap1101builder) | setNumber(long value) | +| [ApplicationxwwwformurlencodedSchemaMap1101Builder](#applicationxwwwformurlencodedschemamap1101builder) | setNumber(double value) | +| [ApplicationxwwwformurlencodedSchemaMap1110Builder](#applicationxwwwformurlencodedschemamap1110builder) | pattern_without_delimiter(String value) | + +## ApplicationxwwwformurlencodedSchemaMap +public static class ApplicationxwwwformurlencodedSchemaMap
+extends FrozenMap + +A class to store validated Map payloads + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| static [ApplicationxwwwformurlencodedSchemaMap](#applicationxwwwformurlencodedschemamap) | of([Map](#applicationxwwwformurlencodedschemamapbuilder) arg, SchemaConfiguration configuration) | +| String | pattern_without_delimiter()
| +| Number | int32()
[optional] value must be a 32 bit integer | +| Number | int64()
[optional] value must be a 64 bit integer | +| String | binary()
[optional] | +| String | date()
[optional] value must conform to RFC-3339 full-date YYYY-MM-DD | +| String | dateTime()
[optional] if omitted the server will use the default value of 2010-02-01T10:20:10.111110+01:00 value must conform to RFC-3339 date-time | +| String | password()
[optional] | +| String | callback()
[optional] | +| @Nullable Object | get(String key)
This schema has invalid Java names so this method must be used when you access instance["byte"], instance["double"], instance["number"], instance["integer"], instance["float"], instance["string"], | +| @Nullable Object | getAdditionalProperty(String name)
provides type safety for additional properties | + +## ApplicationxwwwformurlencodedCallbackBoxed +public sealed interface ApplicationxwwwformurlencodedCallbackBoxed
+permits
+[ApplicationxwwwformurlencodedCallbackBoxedString](#applicationxwwwformurlencodedcallbackboxedstring) + +sealed interface that stores validated payloads using boxed classes + +## ApplicationxwwwformurlencodedCallbackBoxedString +public record ApplicationxwwwformurlencodedCallbackBoxedString
+implements [ApplicationxwwwformurlencodedCallbackBoxed](#applicationxwwwformurlencodedcallbackboxed) + +record that stores validated String payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| ApplicationxwwwformurlencodedCallbackBoxedString(String data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| String | data()
validated payload | +| @Nullable Object | getData()
validated payload | + +## ApplicationxwwwformurlencodedCallback +public static class ApplicationxwwwformurlencodedCallback
+extends StringJsonSchema.StringJsonSchema1 + +A schema class that validates payloads + +## Description +None + +| Methods Inherited from class org.openapijsonschematools.client.schemas.StringJsonSchema.StringJsonSchema1 | +| ------------------------------------------------------------------ | +| validate | +| validateAndBox | + +## ApplicationxwwwformurlencodedPasswordBoxed +public sealed interface ApplicationxwwwformurlencodedPasswordBoxed
+permits
+[ApplicationxwwwformurlencodedPasswordBoxedString](#applicationxwwwformurlencodedpasswordboxedstring) + +sealed interface that stores validated payloads using boxed classes + +## ApplicationxwwwformurlencodedPasswordBoxedString +public record ApplicationxwwwformurlencodedPasswordBoxedString
+implements [ApplicationxwwwformurlencodedPasswordBoxed](#applicationxwwwformurlencodedpasswordboxed) + +record that stores validated String payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| ApplicationxwwwformurlencodedPasswordBoxedString(String data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| String | data()
validated payload | +| @Nullable Object | getData()
validated payload | + +## ApplicationxwwwformurlencodedPassword +public static class ApplicationxwwwformurlencodedPassword
+extends JsonSchema + +A schema class that validates payloads + +## Description +None + +### 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.fake.post.requestbody.content.applicationxwwwformurlencoded.ApplicationxwwwformurlencodedSchema; + +import java.util.Arrays; +import java.util.List; +import java.util.AbstractMap; + +static final SchemaConfiguration configuration = new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().build()); + +// String validation +String validatedPayload = ApplicationxwwwformurlencodedSchema.ApplicationxwwwformurlencodedPassword.validate( + "a", + configuration +); +``` + +### Field Summary +| Modifier and Type | Field and Description | +| ----------------- | ---------------------- | +| Set> | type = Set.of(
    String.class
)
| +| String | type = "password"; | +| Integer | maxLength = 64 | +| Integer | minLength = 10 | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| String | validate(String arg, SchemaConfiguration configuration) | +| [ApplicationxwwwformurlencodedPasswordBoxedString](#applicationxwwwformurlencodedpasswordboxedstring) | validateAndBox(String arg, SchemaConfiguration configuration) | +| [ApplicationxwwwformurlencodedPasswordBoxed](#applicationxwwwformurlencodedpasswordboxed) | validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) | +| @Nullable Object | validate(@Nullable Object arg, SchemaConfiguration configuration) | + +## ApplicationxwwwformurlencodedDateTimeBoxed +public sealed interface ApplicationxwwwformurlencodedDateTimeBoxed
+permits
+[ApplicationxwwwformurlencodedDateTimeBoxedString](#applicationxwwwformurlencodeddatetimeboxedstring) + +sealed interface that stores validated payloads using boxed classes + +## ApplicationxwwwformurlencodedDateTimeBoxedString +public record ApplicationxwwwformurlencodedDateTimeBoxedString
+implements [ApplicationxwwwformurlencodedDateTimeBoxed](#applicationxwwwformurlencodeddatetimeboxed) + +record that stores validated String payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| ApplicationxwwwformurlencodedDateTimeBoxedString(String data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| String | data()
validated payload | +| @Nullable Object | getData()
validated payload | + +## ApplicationxwwwformurlencodedDateTime +public static class ApplicationxwwwformurlencodedDateTime
+extends JsonSchema + +A schema class that validates payloads + +## Description +None + +### 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.fake.post.requestbody.content.applicationxwwwformurlencoded.ApplicationxwwwformurlencodedSchema; + +import java.util.Arrays; +import java.util.List; +import java.util.AbstractMap; + +static final SchemaConfiguration configuration = new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().build()); + +// String validation +String validatedPayload = ApplicationxwwwformurlencodedSchema.ApplicationxwwwformurlencodedDateTime.validate( + "1970-01-01T00:00:00.00Z", + configuration +); +``` + +### Field Summary +| Modifier and Type | Field and Description | +| ----------------- | ---------------------- | +| Set> | type = Set.of(
    String.class
)
| +| String | type = "date-time"; | +| @Nullable Object | defaultValue = "2010-02-01T10:20:10.111110+01:00" | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| String | validate(String arg, SchemaConfiguration configuration) | +| [ApplicationxwwwformurlencodedDateTimeBoxedString](#applicationxwwwformurlencodeddatetimeboxedstring) | validateAndBox(String arg, SchemaConfiguration configuration) | +| [ApplicationxwwwformurlencodedDateTimeBoxed](#applicationxwwwformurlencodeddatetimeboxed) | validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) | +| @Nullable Object | validate(@Nullable Object arg, SchemaConfiguration configuration) | + +## ApplicationxwwwformurlencodedDateBoxed +public sealed interface ApplicationxwwwformurlencodedDateBoxed
+permits
+[ApplicationxwwwformurlencodedDateBoxedString](#applicationxwwwformurlencodeddateboxedstring) + +sealed interface that stores validated payloads using boxed classes + +## ApplicationxwwwformurlencodedDateBoxedString +public record ApplicationxwwwformurlencodedDateBoxedString
+implements [ApplicationxwwwformurlencodedDateBoxed](#applicationxwwwformurlencodeddateboxed) + +record that stores validated String payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| ApplicationxwwwformurlencodedDateBoxedString(String data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| String | data()
validated payload | +| @Nullable Object | getData()
validated payload | + +## ApplicationxwwwformurlencodedDate +public static class ApplicationxwwwformurlencodedDate
+extends DateJsonSchema.DateJsonSchema1 + +A schema class that validates payloads + +## Description +None + +| Methods Inherited from class org.openapijsonschematools.client.schemas.DateJsonSchema.DateJsonSchema1 | +| ------------------------------------------------------------------ | +| validate | +| validateAndBox | + +## ApplicationxwwwformurlencodedBinaryBoxed +public sealed interface ApplicationxwwwformurlencodedBinaryBoxed
+permits
+ +sealed interface that stores validated payloads using boxed classes + +## ApplicationxwwwformurlencodedBinary +public static class ApplicationxwwwformurlencodedBinary
+extends JsonSchema + +A schema class that validates payloads + +## Description +None + +## ApplicationxwwwformurlencodedByteBoxed +public sealed interface ApplicationxwwwformurlencodedByteBoxed
+permits
+[ApplicationxwwwformurlencodedByteBoxedString](#applicationxwwwformurlencodedbyteboxedstring) + +sealed interface that stores validated payloads using boxed classes + +## ApplicationxwwwformurlencodedByteBoxedString +public record ApplicationxwwwformurlencodedByteBoxedString
+implements [ApplicationxwwwformurlencodedByteBoxed](#applicationxwwwformurlencodedbyteboxed) + +record that stores validated String payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| ApplicationxwwwformurlencodedByteBoxedString(String data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| String | data()
validated payload | +| @Nullable Object | getData()
validated payload | + +## ApplicationxwwwformurlencodedByte +public static class ApplicationxwwwformurlencodedByte
+extends StringJsonSchema.StringJsonSchema1 + +A schema class that validates payloads + +## Description +None + +## ApplicationxwwwformurlencodedPatternWithoutDelimiterBoxed +public sealed interface ApplicationxwwwformurlencodedPatternWithoutDelimiterBoxed
+permits
+[ApplicationxwwwformurlencodedPatternWithoutDelimiterBoxedString](#applicationxwwwformurlencodedpatternwithoutdelimiterboxedstring) + +sealed interface that stores validated payloads using boxed classes + +## ApplicationxwwwformurlencodedPatternWithoutDelimiterBoxedString +public record ApplicationxwwwformurlencodedPatternWithoutDelimiterBoxedString
+implements [ApplicationxwwwformurlencodedPatternWithoutDelimiterBoxed](#applicationxwwwformurlencodedpatternwithoutdelimiterboxed) + +record that stores validated String payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| ApplicationxwwwformurlencodedPatternWithoutDelimiterBoxedString(String data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| String | data()
validated payload | +| @Nullable Object | getData()
validated payload | + +## ApplicationxwwwformurlencodedPatternWithoutDelimiter +public static class ApplicationxwwwformurlencodedPatternWithoutDelimiter
+extends JsonSchema + +A schema class that validates payloads + +## Description +None + +### 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.fake.post.requestbody.content.applicationxwwwformurlencoded.ApplicationxwwwformurlencodedSchema; + +import java.util.Arrays; +import java.util.List; +import java.util.AbstractMap; + +static final SchemaConfiguration configuration = new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().build()); + +// String validation +String validatedPayload = ApplicationxwwwformurlencodedSchema.ApplicationxwwwformurlencodedPatternWithoutDelimiter.validate( + "AUR,rZ#UM/?R,Fp^l6$ARjbhJk C>", + configuration +); +``` + +### Field Summary +| Modifier and Type | Field and Description | +| ----------------- | ---------------------- | +| Set> | type = Set.of(
    String.class
)
| +| Pattern | pattern = Pattern.compile(
    "^[A-Z].*"
)
| + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| String | validate(String arg, SchemaConfiguration configuration) | +| [ApplicationxwwwformurlencodedPatternWithoutDelimiterBoxedString](#applicationxwwwformurlencodedpatternwithoutdelimiterboxedstring) | validateAndBox(String arg, SchemaConfiguration configuration) | +| [ApplicationxwwwformurlencodedPatternWithoutDelimiterBoxed](#applicationxwwwformurlencodedpatternwithoutdelimiterboxed) | validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) | +| @Nullable Object | validate(@Nullable Object arg, SchemaConfiguration configuration) | + +## ApplicationxwwwformurlencodedStringBoxed +public sealed interface ApplicationxwwwformurlencodedStringBoxed
+permits
+[ApplicationxwwwformurlencodedStringBoxedString](#applicationxwwwformurlencodedstringboxedstring) + +sealed interface that stores validated payloads using boxed classes + +## ApplicationxwwwformurlencodedStringBoxedString +public record ApplicationxwwwformurlencodedStringBoxedString
+implements [ApplicationxwwwformurlencodedStringBoxed](#applicationxwwwformurlencodedstringboxed) + +record that stores validated String payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| ApplicationxwwwformurlencodedStringBoxedString(String data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| String | data()
validated payload | +| @Nullable Object | getData()
validated payload | + +## ApplicationxwwwformurlencodedString +public static class ApplicationxwwwformurlencodedString
+extends JsonSchema + +A schema class that validates payloads + +## Description +None + +### 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.fake.post.requestbody.content.applicationxwwwformurlencoded.ApplicationxwwwformurlencodedSchema; + +import java.util.Arrays; +import java.util.List; +import java.util.AbstractMap; + +static final SchemaConfiguration configuration = new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().build()); + +// String validation +String validatedPayload = ApplicationxwwwformurlencodedSchema.ApplicationxwwwformurlencodedString.validate( + "A", + configuration +); +``` + +### Field Summary +| Modifier and Type | Field and Description | +| ----------------- | ---------------------- | +| Set> | type = Set.of(
    String.class
)
| +| Pattern | pattern = Pattern.compile(
    "[a-z]",
    Pattern.CASE_INSENSITIVE
)
| + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| String | validate(String arg, SchemaConfiguration configuration) | +| [ApplicationxwwwformurlencodedStringBoxedString](#applicationxwwwformurlencodedstringboxedstring) | validateAndBox(String arg, SchemaConfiguration configuration) | +| [ApplicationxwwwformurlencodedStringBoxed](#applicationxwwwformurlencodedstringboxed) | validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) | +| @Nullable Object | validate(@Nullable Object arg, SchemaConfiguration configuration) | + +## ApplicationxwwwformurlencodedDoubleBoxed +public sealed interface ApplicationxwwwformurlencodedDoubleBoxed
+permits
+[ApplicationxwwwformurlencodedDoubleBoxedNumber](#applicationxwwwformurlencodeddoubleboxednumber) + +sealed interface that stores validated payloads using boxed classes + +## ApplicationxwwwformurlencodedDoubleBoxedNumber +public record ApplicationxwwwformurlencodedDoubleBoxedNumber
+implements [ApplicationxwwwformurlencodedDoubleBoxed](#applicationxwwwformurlencodeddoubleboxed) + +record that stores validated Number payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| ApplicationxwwwformurlencodedDoubleBoxedNumber(Number data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| Number | data()
validated payload | +| @Nullable Object | getData()
validated payload | + +## ApplicationxwwwformurlencodedDouble +public static class ApplicationxwwwformurlencodedDouble
+extends JsonSchema + +A schema class that validates payloads + +## Description +None + +### 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.fake.post.requestbody.content.applicationxwwwformurlencoded.ApplicationxwwwformurlencodedSchema; + +import java.util.Arrays; +import java.util.List; +import java.util.AbstractMap; + +static final SchemaConfiguration configuration = new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().build()); + +// double validation +double validatedPayload = ApplicationxwwwformurlencodedSchema.ApplicationxwwwformurlencodedDouble.validate( + 3.14d, + configuration +); +``` + +### Field Summary +| Modifier and Type | Field and Description | +| ----------------- | ---------------------- | +| Set> | type = Set.of(
    Integer.class,
    Long.class,
    Float.class,
    Double.class
)
| +| String | type = "double"; | +| Number | maximum = 123.4 | +| Number | minimum = 67.8 | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| double | validate(double arg, SchemaConfiguration configuration) | +| [ApplicationxwwwformurlencodedDoubleBoxedNumber](#applicationxwwwformurlencodeddoubleboxednumber) | validateAndBox(Number arg, SchemaConfiguration configuration) | +| [ApplicationxwwwformurlencodedDoubleBoxed](#applicationxwwwformurlencodeddoubleboxed) | validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) | +| @Nullable Object | validate(@Nullable Object arg, SchemaConfiguration configuration) | + +## ApplicationxwwwformurlencodedFloatBoxed +public sealed interface ApplicationxwwwformurlencodedFloatBoxed
+permits
+[ApplicationxwwwformurlencodedFloatBoxedNumber](#applicationxwwwformurlencodedfloatboxednumber) + +sealed interface that stores validated payloads using boxed classes + +## ApplicationxwwwformurlencodedFloatBoxedNumber +public record ApplicationxwwwformurlencodedFloatBoxedNumber
+implements [ApplicationxwwwformurlencodedFloatBoxed](#applicationxwwwformurlencodedfloatboxed) + +record that stores validated Number payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| ApplicationxwwwformurlencodedFloatBoxedNumber(Number data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| Number | data()
validated payload | +| @Nullable Object | getData()
validated payload | + +## ApplicationxwwwformurlencodedFloat +public static class ApplicationxwwwformurlencodedFloat
+extends JsonSchema + +A schema class that validates payloads + +## Description +None + +### 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.fake.post.requestbody.content.applicationxwwwformurlencoded.ApplicationxwwwformurlencodedSchema; + +import java.util.Arrays; +import java.util.List; +import java.util.AbstractMap; + +static final SchemaConfiguration configuration = new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().build()); + +// float validation +float validatedPayload = ApplicationxwwwformurlencodedSchema.ApplicationxwwwformurlencodedFloat.validate( + 3.14f, + configuration +); +``` + +### Field Summary +| Modifier and Type | Field and Description | +| ----------------- | ---------------------- | +| Set> | type = Set.of(
    Integer.class,
    Long.class,
    Float.class,
    Double.class
)
| +| String | type = "float"; | +| Number | maximum = 987.6 | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| float | validate(float arg, SchemaConfiguration configuration) | +| [ApplicationxwwwformurlencodedFloatBoxedNumber](#applicationxwwwformurlencodedfloatboxednumber) | validateAndBox(Number arg, SchemaConfiguration configuration) | +| [ApplicationxwwwformurlencodedFloatBoxed](#applicationxwwwformurlencodedfloatboxed) | validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) | +| @Nullable Object | validate(@Nullable Object arg, SchemaConfiguration configuration) | + +## ApplicationxwwwformurlencodedNumberBoxed +public sealed interface ApplicationxwwwformurlencodedNumberBoxed
+permits
+[ApplicationxwwwformurlencodedNumberBoxedNumber](#applicationxwwwformurlencodednumberboxednumber) + +sealed interface that stores validated payloads using boxed classes + +## ApplicationxwwwformurlencodedNumberBoxedNumber +public record ApplicationxwwwformurlencodedNumberBoxedNumber
+implements [ApplicationxwwwformurlencodedNumberBoxed](#applicationxwwwformurlencodednumberboxed) + +record that stores validated Number payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| ApplicationxwwwformurlencodedNumberBoxedNumber(Number data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| Number | data()
validated payload | +| @Nullable Object | getData()
validated payload | + +## ApplicationxwwwformurlencodedNumber +public static class ApplicationxwwwformurlencodedNumber
+extends JsonSchema + +A schema class that validates payloads + +## Description +None + +### 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.fake.post.requestbody.content.applicationxwwwformurlencoded.ApplicationxwwwformurlencodedSchema; + +import java.util.Arrays; +import java.util.List; +import java.util.AbstractMap; + +static final SchemaConfiguration configuration = new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().build()); + +// int validation +int validatedPayload = ApplicationxwwwformurlencodedSchema.ApplicationxwwwformurlencodedNumber.validate( + 1, + configuration +); +``` + +### Field Summary +| Modifier and Type | Field and Description | +| ----------------- | ---------------------- | +| Set> | type = Set.of(
    Integer.class,
    Long.class,
    Float.class,
    Double.class
)
| +| Number | maximum = 543.2 | +| Number | minimum = 32.1 | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| Number | validate(Number arg, SchemaConfiguration configuration) | +| [ApplicationxwwwformurlencodedNumberBoxedNumber](#applicationxwwwformurlencodednumberboxednumber) | validateAndBox(Number arg, SchemaConfiguration configuration) | +| [ApplicationxwwwformurlencodedNumberBoxed](#applicationxwwwformurlencodednumberboxed) | validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) | +| @Nullable Object | validate(@Nullable Object arg, SchemaConfiguration configuration) | + +## ApplicationxwwwformurlencodedInt64Boxed +public sealed interface ApplicationxwwwformurlencodedInt64Boxed
+permits
+[ApplicationxwwwformurlencodedInt64BoxedNumber](#applicationxwwwformurlencodedint64boxednumber) + +sealed interface that stores validated payloads using boxed classes + +## ApplicationxwwwformurlencodedInt64BoxedNumber +public record ApplicationxwwwformurlencodedInt64BoxedNumber
+implements [ApplicationxwwwformurlencodedInt64Boxed](#applicationxwwwformurlencodedint64boxed) + +record that stores validated Number payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| ApplicationxwwwformurlencodedInt64BoxedNumber(Number data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| Number | data()
validated payload | +| @Nullable Object | getData()
validated payload | + +## ApplicationxwwwformurlencodedInt64 +public static class ApplicationxwwwformurlencodedInt64
+extends Int64JsonSchema.Int64JsonSchema1 + +A schema class that validates payloads + +## Description +None + +| Methods Inherited from class org.openapijsonschematools.client.schemas.Int64JsonSchema.Int64JsonSchema1 | +| ------------------------------------------------------------------ | +| validate | +| validateAndBox | + +## ApplicationxwwwformurlencodedInt32Boxed +public sealed interface ApplicationxwwwformurlencodedInt32Boxed
+permits
+[ApplicationxwwwformurlencodedInt32BoxedNumber](#applicationxwwwformurlencodedint32boxednumber) + +sealed interface that stores validated payloads using boxed classes + +## ApplicationxwwwformurlencodedInt32BoxedNumber +public record ApplicationxwwwformurlencodedInt32BoxedNumber
+implements [ApplicationxwwwformurlencodedInt32Boxed](#applicationxwwwformurlencodedint32boxed) + +record that stores validated Number payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| ApplicationxwwwformurlencodedInt32BoxedNumber(Number data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| Number | data()
validated payload | +| @Nullable Object | getData()
validated payload | + +## ApplicationxwwwformurlencodedInt32 +public static class ApplicationxwwwformurlencodedInt32
+extends JsonSchema + +A schema class that validates payloads + +## Description +None + +### 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.fake.post.requestbody.content.applicationxwwwformurlencoded.ApplicationxwwwformurlencodedSchema; + +import java.util.Arrays; +import java.util.List; +import java.util.AbstractMap; + +static final SchemaConfiguration configuration = new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().build()); + +// int validation +int validatedPayload = ApplicationxwwwformurlencodedSchema.ApplicationxwwwformurlencodedInt32.validate( + 1, + configuration +); +``` + +### Field Summary +| Modifier and Type | Field and Description | +| ----------------- | ---------------------- | +| Set> | type = Set.of(
    Integer.class,
    Long.class,
    Float.class,
    Double.class
)
| +| String | type = "int32"; | +| Number | maximum = 200 | +| Number | minimum = 20 | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| int | validate(int arg, SchemaConfiguration configuration) | +| [ApplicationxwwwformurlencodedInt32BoxedNumber](#applicationxwwwformurlencodedint32boxednumber) | validateAndBox(Number arg, SchemaConfiguration configuration) | +| [ApplicationxwwwformurlencodedInt32Boxed](#applicationxwwwformurlencodedint32boxed) | validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) | +| @Nullable Object | validate(@Nullable Object arg, SchemaConfiguration configuration) | + +## ApplicationxwwwformurlencodedIntegerBoxed +public sealed interface ApplicationxwwwformurlencodedIntegerBoxed
+permits
+[ApplicationxwwwformurlencodedIntegerBoxedNumber](#applicationxwwwformurlencodedintegerboxednumber) + +sealed interface that stores validated payloads using boxed classes + +## ApplicationxwwwformurlencodedIntegerBoxedNumber +public record ApplicationxwwwformurlencodedIntegerBoxedNumber
+implements [ApplicationxwwwformurlencodedIntegerBoxed](#applicationxwwwformurlencodedintegerboxed) + +record that stores validated Number payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| ApplicationxwwwformurlencodedIntegerBoxedNumber(Number data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| Number | data()
validated payload | +| @Nullable Object | getData()
validated payload | + +## ApplicationxwwwformurlencodedInteger +public static class ApplicationxwwwformurlencodedInteger
+extends JsonSchema + +A schema class that validates payloads + +## Description +None + +### 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.fake.post.requestbody.content.applicationxwwwformurlencoded.ApplicationxwwwformurlencodedSchema; + +import java.util.Arrays; +import java.util.List; +import java.util.AbstractMap; + +static final SchemaConfiguration configuration = new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().build()); + +// int validation +int validatedPayload = ApplicationxwwwformurlencodedSchema.ApplicationxwwwformurlencodedInteger.validate( + 1L, + configuration +); +``` + +### Field Summary +| Modifier and Type | Field and Description | +| ----------------- | ---------------------- | +| Set> | type = Set.of(
    Integer.class,
    Long.class,
    Float.class,
    Double.class
)
| +| String | type = "int"; | +| Number | maximum = 100 | +| Number | minimum = 10 | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| long | validate(long arg, SchemaConfiguration configuration) | +| [ApplicationxwwwformurlencodedIntegerBoxedNumber](#applicationxwwwformurlencodedintegerboxednumber) | validateAndBox(Number arg, SchemaConfiguration configuration) | +| [ApplicationxwwwformurlencodedIntegerBoxed](#applicationxwwwformurlencodedintegerboxed) | validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) | +| @Nullable Object | validate(@Nullable Object arg, SchemaConfiguration configuration) | diff --git a/samples/client/petstore/kotlin/docs/paths/fake/post/responses/FakePostCode200Response.md b/samples/client/petstore/kotlin/docs/paths/fake/post/responses/FakePostCode200Response.md new file mode 100644 index 00000000000..3e3ca088f80 --- /dev/null +++ b/samples/client/petstore/kotlin/docs/paths/fake/post/responses/FakePostCode200Response.md @@ -0,0 +1,17 @@ +# FakePostCode200Response + +public class FakePostCode200Response extends [SuccessDescriptionOnly](../../components/responses/SuccessDescriptionOnly.md) + +A class (extended from the $ref class) that contains necessary nested response classes +- a class that extends ResponseDeserializer and is used to deserialize responses + +## Nested Class Summary +| Modifier and Type | Class and Description | +| ----------------- | --------------------- | +| static class | [FakePostCode200Response.FakePostCode200Response1](#fakepostcode200response1)
class that deserializes responses | + +## FakePostCode200Response1 +public static class FakePostCode200Response1 extends [SuccessDescriptionOnly1](../../components/responses/SuccessDescriptionOnly.md#successdescriptiononly1)
+ +a class that deserializes responses, extended from the $ref class + diff --git a/samples/client/petstore/kotlin/docs/paths/fake/post/responses/FakePostCode404Response.md b/samples/client/petstore/kotlin/docs/paths/fake/post/responses/FakePostCode404Response.md new file mode 100644 index 00000000000..7386c472c52 --- /dev/null +++ b/samples/client/petstore/kotlin/docs/paths/fake/post/responses/FakePostCode404Response.md @@ -0,0 +1,32 @@ +# FakePostCode404Response + +public class FakePostCode404Response + +A class that contains necessary nested response classes +- a class that extends ResponseDeserializer and is used to deserialize responses + +## Nested Class Summary +| Modifier and Type | Class and Description | +| ----------------- | --------------------- | +| static class | [FakePostCode404Response.FakePostCode404Response1](#fakepostcode404response1)
class that deserializes responses | + +## FakePostCode404Response1 +public static class FakePostCode404Response1
+extends ResponseDeserializer + +a class that deserializes responses + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| FakePostCode404Response1()
Creates an instance | + +### Field Summary +| Modifier and Type | Field and Description | +| ----------------- | --------------------- | +| Map | content = MapUtils.makeMap(
)
the contentType to schema info | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| ApiResponse | deserialize(HttpResponse response, SchemaConfiguration configuration)
called by endpoint when deserialize responses | diff --git a/samples/client/petstore/kotlin/docs/paths/fake/post/security/FakePostSecurityRequirementObject0.md b/samples/client/petstore/kotlin/docs/paths/fake/post/security/FakePostSecurityRequirementObject0.md new file mode 100644 index 00000000000..db0df44256c --- /dev/null +++ b/samples/client/petstore/kotlin/docs/paths/fake/post/security/FakePostSecurityRequirementObject0.md @@ -0,0 +1,15 @@ +# FakePostSecurityRequirementObject0 +FakePostSecurityRequirementObject0.java + +public class FakePostSecurityRequirementObject0 +extends SecurityRequirementObject + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| FakePostSecurityRequirementObject0()
Creates an instance | + +### 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()
    )) | diff --git a/samples/client/petstore/kotlin/docs/paths/fakeadditionalpropertieswitharrayofenums/FakeadditionalpropertieswitharrayofenumsGet.md b/samples/client/petstore/kotlin/docs/paths/fakeadditionalpropertieswitharrayofenums/FakeadditionalpropertieswitharrayofenumsGet.md new file mode 100644 index 00000000000..a1315d492bd --- /dev/null +++ b/samples/client/petstore/kotlin/docs/paths/fakeadditionalpropertieswitharrayofenums/FakeadditionalpropertieswitharrayofenumsGet.md @@ -0,0 +1,148 @@ +# FakeadditionalpropertieswitharrayofenumsGet + +public class FakeadditionalpropertieswitharrayofenumsGet + +A class that contains necessary endpoint classes +- a class that calls the endpoint method using the http verb +- a class that calls the endpoint method using the operationId name +- class(es) to store the request inputs +- builder(s) to set the request input data + +## Nested Class Summary +| Modifier and Type | Class and Description | +| ----------------- | --------------------- | +| static class | [Get](#get)
The class that has a get method to call the endpoint | +| interface | [AdditionalPropertiesWithArrayOfEnumsOperation](#additionalpropertieswitharrayofenumsoperation)
The interface that has a additionalPropertiesWithArrayOfEnums method to call the endpoint | +| static class | [GetRequest](#getrequest)
The request inputs class | +| static class | [GetRequestBuilder](#getrequestbuilder)
A builder for the request input class | + +## Get +public static class Get extends ApiClient.ApiClient1 implements GetOperation
+ +a class that allows one to call the endpoint using a method named get + +### 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.fakeadditionalpropertieswitharrayofenums.get.FakeadditionalpropertieswitharrayofenumsGetRequestBody; +import org.openapijsonschematools.client.components.schemas.AdditionalPropertiesWithArrayOfEnums; +import org.openapijsonschematools.client.RootServerInfo; +import org.openapijsonschematools.client.servers.RootServer0; +import org.openapijsonschematools.client.servers.RootServer1; +import org.openapijsonschematools.client.servers.RootServer2; +import org.openapijsonschematools.client.paths.fakeadditionalpropertieswitharrayofenums.get.responses.FakeadditionalpropertieswitharrayofenumsGetCode200Response; +import org.openapijsonschematools.client.servers.RootServerInfo; +import org.openapijsonschematools.client.paths.fakeadditionalpropertieswitharrayofenums.FakeadditionalpropertieswitharrayofenumsGet; +import org.openapijsonschematools.client.paths.fakeadditionalpropertieswitharrayofenums.get.FakeadditionalpropertieswitharrayofenumsGetResponses; + +import java.io.IOException; +import java.util.Arrays; +import java.util.List; +import java.util.Map; +import java.util.AbstractMap; + +// if you want to use a server that is not SERVER_0 pass it in here and change the ServerIndex input below +ApiConfiguration.ServerInfo serverInfo = new ApiConfiguration.ServerInfoBuilder() + .rootServerInfo( + new RootServerInfo.RootServerInfoBuilder() + .rootServer0(new RootServer0()) + .build() + ) + .build(); +ApiConfiguration.ServerIndexInfo serverIndexInfo = new ApiConfiguration.ServerIndexInfoBuilder() + .rootServerInfoServerIndex(RootServerInfo.ServerIndex.SERVER_0) + .build(); +Duration timeout = Duration.ofSeconds(1L); +Map> defaultHeaders = Map.of("User-Agent", List.of("OpenAPI-JSON-Schema-Generator/1.0.0/java")); +ApiConfiguration apiConfiguration = new ApiConfiguration( + serverInfo + serverIndexInfo, + timeout, + defaultHeaders +); +SchemaConfiguration schemaConfiguration = new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().build()); +FakeadditionalpropertieswitharrayofenumsGet.Get apiClient = new FakeadditionalpropertieswitharrayofenumsGet.Get(apiConfiguration, schemaConfiguration); + + +var request = new FakeadditionalpropertieswitharrayofenumsGet.GetRequestBuilder().build(); + +FakeadditionalpropertieswitharrayofenumsGetResponses.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; +} +FakeadditionalpropertieswitharrayofenumsGetResponses.EndpointFakeadditionalpropertieswitharrayofenumsGetCode200Response castResponse = (FakeadditionalpropertieswitharrayofenumsGetResponses.EndpointFakeadditionalpropertieswitharrayofenumsGetCode200Response) response; +FakeadditionalpropertieswitharrayofenumsGetCode200Response.ApplicationjsonResponseBody deserializedBody = (FakeadditionalpropertieswitharrayofenumsGetCode200Response.ApplicationjsonResponseBody) castResponse.body; +// handle deserialized body here +``` +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| Get(ApiConfiguration apiConfiguration, SchemaConfiguration schemaConfiguration)
Creates an instance | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| [FakeadditionalpropertieswitharrayofenumsGetResponses.EndpointResponse](../../paths/fakeadditionalpropertieswitharrayofenums/get/FakeadditionalpropertieswitharrayofenumsGetResponses.md#endpointresponse) | get([GetRequest](#getrequest) request) | + +## AdditionalPropertiesWithArrayOfEnumsOperation +public interface AdditionalPropertiesWithArrayOfEnumsOperation
+ +an interface that allows one to call the endpoint using a method named additionalPropertiesWithArrayOfEnums by the operationId + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| [FakeadditionalpropertieswitharrayofenumsGetResponses.EndpointResponse](../../paths/fakeadditionalpropertieswitharrayofenums/get/FakeadditionalpropertieswitharrayofenumsGetResponses.md#endpointresponse) | additionalPropertiesWithArrayOfEnums([GetRequest](#getrequest) request) | + +## GetRequest +public static class GetRequest
+ +a class that stores the final request inputs + +### Field Summary +| Modifier and Type | Field and Description | +| ----------------- | --------------------- | +| [FakeadditionalpropertieswitharrayofenumsGetRequestBody.@Nullable SealedRequestBody](../../paths/fakeadditionalpropertieswitharrayofenums/get/FakeadditionalpropertieswitharrayofenumsGetRequestBody.md#sealedrequestbody) | requestBody
optional | +| [RootServerInfo.@Nullable ServerIndex](../../RootServerInfo.md#serverindex) | serverIndex
optional. Note: this will override the value in apiConfiguration | +| @Nullable Duration | timeout
optional. Note: this will override the value in apiConfiguration | + +## GetRequestBuilder +public static class GetRequestBuilder
+ +a builder for request inputs + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| GetRequestBuilder()
Creates a builder that contains null for all parameters | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| [GetRequest](#getrequest) | build()
Returns the request input used to call an endpoint method | +| [GetRequestBuilder](#getrequestbuilder) | requestBody([FakeadditionalpropertieswitharrayofenumsGetRequestBody.SealedRequestBody](../../paths/fakeadditionalpropertieswitharrayofenums/get/FakeadditionalpropertieswitharrayofenumsGetRequestBody.md#sealedrequestbody) requestBody)
sets the optional property | +| [GetRequestBuilder](#getrequestbuilder) | serverIndex([RootServerInfo.ServerIndex](../../RootServerInfo.md#serverindex) serverIndex)
sets the optional property. Note: this will override the value in apiConfiguration | +| [GetRequestBuilder](#getrequestbuilder) | timeout(Duration timeout)
sets the optional property. Note: this will override the value in apiConfiguration | + +[[Back to top]](#top) [[Back to README]](../../../README.md) diff --git a/samples/client/petstore/kotlin/docs/paths/fakeadditionalpropertieswitharrayofenums/get/FakeadditionalpropertieswitharrayofenumsGetRequestBody.md b/samples/client/petstore/kotlin/docs/paths/fakeadditionalpropertieswitharrayofenums/get/FakeadditionalpropertieswitharrayofenumsGetRequestBody.md new file mode 100644 index 00000000000..58344dc5d63 --- /dev/null +++ b/samples/client/petstore/kotlin/docs/paths/fakeadditionalpropertieswitharrayofenums/get/FakeadditionalpropertieswitharrayofenumsGetRequestBody.md @@ -0,0 +1,90 @@ +# FakeadditionalpropertieswitharrayofenumsGetRequestBody + +public class FakeadditionalpropertieswitharrayofenumsGetRequestBody + +A class that contains necessary nested request body classes +- SealedMediaType, a sealed interface which contains all the schema/encoding info for each contentType +- records which implement SealedMediaType, the concrete media types +- a class that extends RequestBodySerializer and is used to serialize input SealedRequestBody instances +- SealedRequestBody, a sealed interface which contains all the contentType/schema input types +- records which implement SealedRequestBody, the concrete request body types + +## Nested Class Summary +| Modifier and Type | Class and Description | +| ----------------- | --------------------- | +| sealed interface | [FakeadditionalpropertieswitharrayofenumsGetRequestBody.SealedMediaType](#sealedmediatype)
media type sealed interface | +| record | [FakeadditionalpropertieswitharrayofenumsGetRequestBody.ApplicationjsonMediaType](#applicationjsonmediatype)
record storing schema + encoding for a specific contentType | +| static class | [FakeadditionalpropertieswitharrayofenumsGetRequestBody.FakeadditionalpropertieswitharrayofenumsGetRequestBody1](#fakeadditionalpropertieswitharrayofenumsgetrequestbody1)
class that serializes request bodies | +| sealed interface | [FakeadditionalpropertieswitharrayofenumsGetRequestBody.SealedRequestBody](#sealedrequestbody)
request body sealed interface | +| record | [FakeadditionalpropertieswitharrayofenumsGetRequestBody.ApplicationjsonRequestBody](#applicationjsonrequestbody)
implements sealed interface to store request body input | + +## SealedMediaType +public sealed interface SealedMediaType
+permits
+[ApplicationjsonMediaType](#applicationjsonmediatype) + +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), Nothing?> + +class storing schema info for a specific contentType + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| ApplicationjsonMediaType()
Creates an instance | + +### 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 | +| Nothing? | encoding()
the encoding info | + +## FakeadditionalpropertieswitharrayofenumsGetRequestBody1 +public static class FakeadditionalpropertieswitharrayofenumsGetRequestBody1
+ +a class that serializes SealedRequestBody request bodies + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| FakeadditionalpropertieswitharrayofenumsGetRequestBody1()
Creates an instance | + +### Field Summary +| Modifier and Type | Field and Description | +| ----------------- | --------------------- | +| boolean | required = false
whether the request body is required | +| 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 | +| ----------------- | ---------------------- | +| SerializedRequestBody | serialize([SealedRequestBody](#sealedrequestbody) requestBody)
called by endpoint when creating request body bytes | + +## SealedRequestBody +public sealed interface SealedRequestBody
+permits
+[ApplicationjsonRequestBody](#applicationjsonrequestbody) + +sealed interface that stores request contentType + validated schema data + +## ApplicationjsonRequestBody +public record ApplicationjsonRequestBody
+implements [SealedRequestBody](#sealedrequestbody),
+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 | + +### 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 | diff --git a/samples/client/petstore/kotlin/docs/paths/fakeadditionalpropertieswitharrayofenums/get/FakeadditionalpropertieswitharrayofenumsGetResponses.md b/samples/client/petstore/kotlin/docs/paths/fakeadditionalpropertieswitharrayofenums/get/FakeadditionalpropertieswitharrayofenumsGetResponses.md new file mode 100644 index 00000000000..9e48d107d28 --- /dev/null +++ b/samples/client/petstore/kotlin/docs/paths/fakeadditionalpropertieswitharrayofenums/get/FakeadditionalpropertieswitharrayofenumsGetResponses.md @@ -0,0 +1,29 @@ +# FakeadditionalpropertieswitharrayofenumsGetResponses + +public class FakeadditionalpropertieswitharrayofenumsGetResponses + +A class that contains necessary responses classes +- a sealed interface, EndpointResponse, that stores endpoint responses +- records for each endpoint response + +## Nested Class Summary +| Modifier and Type | Class and Description | +| ----------------- | --------------------- | +| sealed interface | [EndpointResponse](#endpointresponse)
stores the endpoint responses | +| record | [EndpointFakeadditionalpropertieswitharrayofenumsGetCode200Response](#endpointfakeadditionalpropertieswitharrayofenumsgetcode200response)
the response for 200 | + +## EndpointResponse +public sealed interface EndpointResponse permits
+[EndpointFakeadditionalpropertieswitharrayofenumsGetCode200Response](#endpointfakeadditionalpropertieswitharrayofenumsgetcode200response) + +a sealed interface that stores endpoint responses + +## EndpointFakeadditionalpropertieswitharrayofenumsGetCode200Response +public record EndpointFakeadditionalpropertieswitharrayofenumsGetCode200Response( + HttpResponse response, + [FakeadditionalpropertieswitharrayofenumsGetCode200Response.SealedResponseBody](../../../paths/fakeadditionalpropertieswitharrayofenums/get/responses/FakeadditionalpropertieswitharrayofenumsGetCode200Response.md#sealedresponsebody) body, + Nothing? headers +) implements EndpointResponse, ApiResponse
+ +a class that stores an endpoint response + diff --git a/samples/client/petstore/kotlin/docs/paths/fakeadditionalpropertieswitharrayofenums/get/requestbody/content/applicationjson/ApplicationjsonSchema.md b/samples/client/petstore/kotlin/docs/paths/fakeadditionalpropertieswitharrayofenums/get/requestbody/content/applicationjson/ApplicationjsonSchema.md new file mode 100644 index 00000000000..e583d49bf2d --- /dev/null +++ b/samples/client/petstore/kotlin/docs/paths/fakeadditionalpropertieswitharrayofenums/get/requestbody/content/applicationjson/ApplicationjsonSchema.md @@ -0,0 +1,19 @@ +# ApplicationjsonSchema +public class ApplicationjsonSchema
+extends [AdditionalPropertiesWithArrayOfEnums1](../../../../../../components/schemas/AdditionalPropertiesWithArrayOfEnums.md#additionalpropertieswitharrayofenums) + +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 + +## Nested Class Summary +| Modifier and Type | Class and Description | +| ----------------- | ---------------------- | +| static class | [ApplicationjsonSchema.ApplicationjsonSchema1](#applicationjsonschema1)
schema class | + +## ApplicationjsonSchema1 +public static class ApplicationjsonSchema1
+extends [AdditionalPropertiesWithArrayOfEnums.AdditionalPropertiesWithArrayOfEnums1](../../../../../../components/schemas/AdditionalPropertiesWithArrayOfEnums.md#additionalpropertieswitharrayofenums1) + +A schema class that validates payloads diff --git a/samples/client/petstore/kotlin/docs/paths/fakeadditionalpropertieswitharrayofenums/get/responses/FakeadditionalpropertieswitharrayofenumsGetCode200Response.md b/samples/client/petstore/kotlin/docs/paths/fakeadditionalpropertieswitharrayofenums/get/responses/FakeadditionalpropertieswitharrayofenumsGetCode200Response.md new file mode 100644 index 00000000000..ef139bd1ed0 --- /dev/null +++ b/samples/client/petstore/kotlin/docs/paths/fakeadditionalpropertieswitharrayofenums/get/responses/FakeadditionalpropertieswitharrayofenumsGetCode200Response.md @@ -0,0 +1,87 @@ +# FakeadditionalpropertieswitharrayofenumsGetCode200Response + +public class FakeadditionalpropertieswitharrayofenumsGetCode200Response + +A class that contains necessary nested response classes +- SealedMediaType, a sealed interface which contains all the schema/encoding info for each contentType +- records which implement SealedMediaType, the concrete media types +- SealedResponseBody, a sealed interface which contains all the contentType/schema types +- records which implement SealedResponseBody, the concrete response body types +- a class that extends ResponseDeserializer and is used to deserialize responses + +## Nested Class Summary +| Modifier and Type | Class and Description | +| ----------------- | --------------------- | +| sealed interface | [FakeadditionalpropertieswitharrayofenumsGetCode200Response.SealedMediaType](#sealedmediatype)
media type sealed interface | +| record | [FakeadditionalpropertieswitharrayofenumsGetCode200Response.ApplicationjsonMediaType](#applicationjsonmediatype)
record storing schema + encoding for a specific contentType | +| sealed interface | [FakeadditionalpropertieswitharrayofenumsGetCode200Response.SealedResponseBody](#sealedresponsebody)
response body sealed interface | +| record | [FakeadditionalpropertieswitharrayofenumsGetCode200Response.ApplicationjsonResponseBody](#applicationjsonresponsebody)
implements sealed interface to store response body | +| static class | [FakeadditionalpropertieswitharrayofenumsGetCode200Response.FakeadditionalpropertieswitharrayofenumsGetCode200Response1](#fakeadditionalpropertieswitharrayofenumsgetcode200response1)
class that deserializes responses | + +## SealedMediaType +public sealed interface SealedMediaType
+permits
+[ApplicationjsonMediaType](#applicationjsonmediatype) + +sealed interface that stores schema and encoding info + +## ApplicationjsonMediaType +public record ApplicationjsonMediaType
+implements [SealedMediaType](#sealedmediatype), MediaType<[ApplicationjsonSchema.ApplicationjsonSchema1](../../../../paths/fakeadditionalpropertieswitharrayofenums/get/responses/code200response/content/applicationjson/ApplicationjsonSchema.md#applicationjsonschema1), Nothing?> + +class storing schema info for a specific contentType + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| ApplicationjsonMediaType()
Creates an instance | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| [ApplicationjsonSchema.ApplicationjsonSchema1](../../../../paths/fakeadditionalpropertieswitharrayofenums/get/responses/code200response/content/applicationjson/ApplicationjsonSchema.md#applicationjsonschema1) | schema()
the schema for this MediaType | +| Nothing? | encoding()
the encoding info | + +## SealedResponseBody +public sealed interface SealedResponseBody
+permits
+[ApplicationjsonResponseBody](#applicationjsonresponsebody) + +sealed interface that stores response body + +## ApplicationjsonResponseBody +public record ApplicationjsonResponseBody
+implements [SealedResponseBody](#sealedresponsebody) + +A record class to store response body for contentType="application/json" + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| ApplicationjsonResponseBody(ApplicationjsonSchema.[AdditionalPropertiesWithArrayOfEnums1Boxed](../../../../components/schemas/AdditionalPropertiesWithArrayOfEnums.md#additionalpropertieswitharrayofenums1boxed) body)
Creates an instance | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| ApplicationjsonSchema.[AdditionalPropertiesWithArrayOfEnums1Boxed](../../../../components/schemas/AdditionalPropertiesWithArrayOfEnums.md#additionalpropertieswitharrayofenums1boxed) | body()
returns the body passed in in the constructor | + +## FakeadditionalpropertieswitharrayofenumsGetCode200Response1 +public static class FakeadditionalpropertieswitharrayofenumsGetCode200Response1
+extends ResponseDeserializer<[SealedResponseBody](#sealedresponsebody), Nothing?, [SealedMediaType](#sealedmediatype)> + +a class that deserializes responses + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| FakeadditionalpropertieswitharrayofenumsGetCode200Response1()
Creates an instance | + +### Field Summary +| Modifier and Type | Field and Description | +| ----------------- | --------------------- | +| 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 | +| ----------------- | ---------------------- | +| ApiResponse<[SealedResponseBody](#sealedresponsebody), Nothing?> | deserialize(HttpResponse response, SchemaConfiguration configuration)
called by endpoint when deserialize responses | diff --git a/samples/client/petstore/kotlin/docs/paths/fakeadditionalpropertieswitharrayofenums/get/responses/code200response/content/applicationjson/ApplicationjsonSchema.md b/samples/client/petstore/kotlin/docs/paths/fakeadditionalpropertieswitharrayofenums/get/responses/code200response/content/applicationjson/ApplicationjsonSchema.md new file mode 100644 index 00000000000..3c5d3360d21 --- /dev/null +++ b/samples/client/petstore/kotlin/docs/paths/fakeadditionalpropertieswitharrayofenums/get/responses/code200response/content/applicationjson/ApplicationjsonSchema.md @@ -0,0 +1,19 @@ +# ApplicationjsonSchema +public class ApplicationjsonSchema
+extends [AdditionalPropertiesWithArrayOfEnums1](../../../../../../../components/schemas/AdditionalPropertiesWithArrayOfEnums.md#additionalpropertieswitharrayofenums) + +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 + +## Nested Class Summary +| Modifier and Type | Class and Description | +| ----------------- | ---------------------- | +| static class | [ApplicationjsonSchema.ApplicationjsonSchema1](#applicationjsonschema1)
schema class | + +## ApplicationjsonSchema1 +public static class ApplicationjsonSchema1
+extends [AdditionalPropertiesWithArrayOfEnums.AdditionalPropertiesWithArrayOfEnums1](../../../../../../../components/schemas/AdditionalPropertiesWithArrayOfEnums.md#additionalpropertieswitharrayofenums1) + +A schema class that validates payloads diff --git a/samples/client/petstore/kotlin/docs/paths/fakebodywithfileschema/FakebodywithfileschemaPut.md b/samples/client/petstore/kotlin/docs/paths/fakebodywithfileschema/FakebodywithfileschemaPut.md new file mode 100644 index 00000000000..0da6338b397 --- /dev/null +++ b/samples/client/petstore/kotlin/docs/paths/fakebodywithfileschema/FakebodywithfileschemaPut.md @@ -0,0 +1,188 @@ +# FakebodywithfileschemaPut + +public class FakebodywithfileschemaPut + +A class that contains necessary endpoint classes +- a class that calls the endpoint method using the http verb +- a class that calls the endpoint method using the operationId name +- class(es) to store the request inputs +- builder(s) to set the request input data + +## Nested Class Summary +| Modifier and Type | Class and Description | +| ----------------- | --------------------- | +| static class | [Put](#put)
The class that has a put method to call the endpoint | +| interface | [BodyWithFileSchemaOperation](#bodywithfileschemaoperation)
The interface that has a bodyWithFileSchema method to call the endpoint | +| static class | [PutRequest](#putrequest)
The final request inputs class | +| static class | [PutNullableRequest](#putnullablerequest)
The initial request inputs class | +| static class | [Put0RequestBuilder](#put0requestbuilder)
A builder for the request input class | +| static class | [PutRequestBuilder](#putrequestbuilder)
A builder for the request input class | + +## Put +public static class Put extends ApiClient.ApiClient1 implements PutOperation
+ +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.fakebodywithfileschema.put.FakebodywithfileschemaPutRequestBody; +import org.openapijsonschematools.client.components.schemas.FileSchemaTestClass; +import org.openapijsonschematools.client.servers.RootServer0; +import org.openapijsonschematools.client.servers.RootServer1; +import org.openapijsonschematools.client.servers.RootServer2; +import org.openapijsonschematools.client.paths.fakebodywithfileschema.put.responses.FakebodywithfileschemaPutCode200Response; +import org.openapijsonschematools.client.servers.RootServerInfo; +import org.openapijsonschematools.client.paths.fakebodywithfileschema.FakebodywithfileschemaPut; +import org.openapijsonschematools.client.paths.fakebodywithfileschema.put.FakebodywithfileschemaPutResponses; + +import java.io.IOException; +import java.util.Arrays; +import java.util.List; +import java.util.Map; +import java.util.AbstractMap; + +// if you want to use a server that is not SERVER_0 pass it in here and change the ServerIndex input below +ApiConfiguration.ServerInfo serverInfo = new ApiConfiguration.ServerInfoBuilder() + .rootServerInfo( + new RootServerInfo.RootServerInfoBuilder() + .rootServer0(new RootServer0()) + .build() + ) + .build(); +ApiConfiguration.ServerIndexInfo serverIndexInfo = new ApiConfiguration.ServerIndexInfoBuilder() + .rootServerInfoServerIndex(RootServerInfo.ServerIndex.SERVER_0) + .build(); +Duration timeout = Duration.ofSeconds(1L); +Map> defaultHeaders = Map.of("User-Agent", List.of("OpenAPI-JSON-Schema-Generator/1.0.0/java")); +ApiConfiguration apiConfiguration = new ApiConfiguration( + serverInfo + serverIndexInfo, + timeout, + defaultHeaders +); +SchemaConfiguration schemaConfiguration = new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().build()); +FakebodywithfileschemaPut.Put apiClient = new FakebodywithfileschemaPut.Put(apiConfiguration, schemaConfiguration); + + +FileSchemaTestClass1BoxedMap requestBodyPayload = + FileSchemaTestClass.FileSchemaTestClass1.validateAndBox( + new FileSchemaTestClass.FileSchemaTestClassMapBuilder() + .files( + Arrays.asList( + ) + ) + .build(), + schemaConfiguration +); +FakebodywithfileschemaPut.SealedRequestBody requestBody = new FakebodywithfileschemaPut.ApplicationjsonRequestBody(requestBodyPayload); + +var request = new FakebodywithfileschemaPut.PutRequestBuilder() + .requestBody(requestBody) + .build(); + +FakebodywithfileschemaPutResponses.EndpointResponse response; +try { + response = apiClient.put(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; +} +FakebodywithfileschemaPutResponses.EndpointFakebodywithfileschemaPutCode200Response castResponse = (FakebodywithfileschemaPutResponses.EndpointFakebodywithfileschemaPutCode200Response) response; +``` +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| Put(ApiConfiguration apiConfiguration, SchemaConfiguration schemaConfiguration)
Creates an instance | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| [FakebodywithfileschemaPutResponses.EndpointResponse](../../paths/fakebodywithfileschema/put/FakebodywithfileschemaPutResponses.md#endpointresponse) | put([PutRequest](#putrequest) request) | + +## BodyWithFileSchemaOperation +public interface BodyWithFileSchemaOperation
+ +an interface that allows one to call the endpoint using a method named bodyWithFileSchema by the operationId + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| [FakebodywithfileschemaPutResponses.EndpointResponse](../../paths/fakebodywithfileschema/put/FakebodywithfileschemaPutResponses.md#endpointresponse) | bodyWithFileSchema([PutRequest](#putrequest) request) | + +## PutRequest +public static class PutRequest
+ +a class that stores the final request inputs + +### Field Summary +| Modifier and Type | Field and Description | +| ----------------- | --------------------- | +| [FakebodywithfileschemaPutRequestBody.SealedRequestBody](../../paths/fakebodywithfileschema/put/FakebodywithfileschemaPutRequestBody.md#sealedrequestbody) | requestBody | +| [RootServerInfo.@Nullable ServerIndex](../../RootServerInfo.md#serverindex) | serverIndex
optional. Note: this will override the value in apiConfiguration | +| @Nullable Duration | timeout
optional. Note: this will override the value in apiConfiguration | + +## PutNullableRequest +public static class PutNullableRequest
+ +a class that stores the initial request inputs + +### Field Summary +| Modifier and Type | Field and Description | +| ----------------- | --------------------- | +| [FakebodywithfileschemaPutRequestBody.@Nullable SealedRequestBody](../../paths/fakebodywithfileschema/put/FakebodywithfileschemaPutRequestBody.md#sealedrequestbody) | requestBody | +| [RootServerInfo.@Nullable ServerIndex](../../RootServerInfo.md#serverindex) | serverIndex | +| @Nullable Duration | timeout | + +## Put0RequestBuilder +public static class Put0RequestBuilder
+ +a builder for request inputs + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| Put0RequestBuilder(Put0RequestBuilder instance)
Creates a builder that contains the passed instance | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| [PutRequest](#putrequest) | build()
Returns the request input used to call an endpoint method | +| [Put0RequestBuilder](#put0requestbuilder) | serverIndex([RootServerInfo.ServerIndex](../../RootServerInfo.md#serverindex) serverIndex)
sets the optional property. Note: this will override the value in apiConfiguration | +| [Put0RequestBuilder](#put0requestbuilder) | timeout(Duration timeout)
sets the optional property. Note: this will override the value in apiConfiguration | + +## PutRequestBuilder +public static class PutRequestBuilder
+ +a builder for request inputs + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| PutRequestBuilder()
Creates a builder that contains null for all parameters | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| [Put0RequestBuilder](#put0requestbuilder) | requestBody([FakebodywithfileschemaPutRequestBody.SealedRequestBody](../../paths/fakebodywithfileschema/put/FakebodywithfileschemaPutRequestBody.md#sealedrequestbody) requestBody)
sets the property | + +[[Back to top]](#top) [[Back to README]](../../../README.md) diff --git a/samples/client/petstore/kotlin/docs/paths/fakebodywithfileschema/put/FakebodywithfileschemaPutRequestBody.md b/samples/client/petstore/kotlin/docs/paths/fakebodywithfileschema/put/FakebodywithfileschemaPutRequestBody.md new file mode 100644 index 00000000000..651a04da435 --- /dev/null +++ b/samples/client/petstore/kotlin/docs/paths/fakebodywithfileschema/put/FakebodywithfileschemaPutRequestBody.md @@ -0,0 +1,90 @@ +# FakebodywithfileschemaPutRequestBody + +public class FakebodywithfileschemaPutRequestBody + +A class that contains necessary nested request body classes +- SealedMediaType, a sealed interface which contains all the schema/encoding info for each contentType +- records which implement SealedMediaType, the concrete media types +- a class that extends RequestBodySerializer and is used to serialize input SealedRequestBody instances +- SealedRequestBody, a sealed interface which contains all the contentType/schema input types +- records which implement SealedRequestBody, the concrete request body types + +## Nested Class Summary +| Modifier and Type | Class and Description | +| ----------------- | --------------------- | +| sealed interface | [FakebodywithfileschemaPutRequestBody.SealedMediaType](#sealedmediatype)
media type sealed interface | +| record | [FakebodywithfileschemaPutRequestBody.ApplicationjsonMediaType](#applicationjsonmediatype)
record storing schema + encoding for a specific contentType | +| static class | [FakebodywithfileschemaPutRequestBody.FakebodywithfileschemaPutRequestBody1](#fakebodywithfileschemaputrequestbody1)
class that serializes request bodies | +| sealed interface | [FakebodywithfileschemaPutRequestBody.SealedRequestBody](#sealedrequestbody)
request body sealed interface | +| record | [FakebodywithfileschemaPutRequestBody.ApplicationjsonRequestBody](#applicationjsonrequestbody)
implements sealed interface to store request body input | + +## SealedMediaType +public sealed interface SealedMediaType
+permits
+[ApplicationjsonMediaType](#applicationjsonmediatype) + +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), Nothing?> + +class storing schema info for a specific contentType + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| ApplicationjsonMediaType()
Creates an instance | + +### 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 | +| Nothing? | encoding()
the encoding info | + +## FakebodywithfileschemaPutRequestBody1 +public static class FakebodywithfileschemaPutRequestBody1
+ +a class that serializes SealedRequestBody request bodies + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| FakebodywithfileschemaPutRequestBody1()
Creates an instance | + +### Field Summary +| Modifier and Type | Field and Description | +| ----------------- | --------------------- | +| boolean | required = true
whether the request body is required | +| 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 | +| ----------------- | ---------------------- | +| SerializedRequestBody | serialize([SealedRequestBody](#sealedrequestbody) requestBody)
called by endpoint when creating request body bytes | + +## SealedRequestBody +public sealed interface SealedRequestBody
+permits
+[ApplicationjsonRequestBody](#applicationjsonrequestbody) + +sealed interface that stores request contentType + validated schema data + +## ApplicationjsonRequestBody +public record ApplicationjsonRequestBody
+implements [SealedRequestBody](#sealedrequestbody),
+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 | + +### 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 | diff --git a/samples/client/petstore/kotlin/docs/paths/fakebodywithfileschema/put/FakebodywithfileschemaPutResponses.md b/samples/client/petstore/kotlin/docs/paths/fakebodywithfileschema/put/FakebodywithfileschemaPutResponses.md new file mode 100644 index 00000000000..2952ae46d3a --- /dev/null +++ b/samples/client/petstore/kotlin/docs/paths/fakebodywithfileschema/put/FakebodywithfileschemaPutResponses.md @@ -0,0 +1,29 @@ +# FakebodywithfileschemaPutResponses + +public class FakebodywithfileschemaPutResponses + +A class that contains necessary responses classes +- a sealed interface, EndpointResponse, that stores endpoint responses +- records for each endpoint response + +## Nested Class Summary +| Modifier and Type | Class and Description | +| ----------------- | --------------------- | +| sealed interface | [EndpointResponse](#endpointresponse)
stores the endpoint responses | +| record | [EndpointFakebodywithfileschemaPutCode200Response](#endpointfakebodywithfileschemaputcode200response)
the response for 200 | + +## EndpointResponse +public sealed interface EndpointResponse permits
+[EndpointFakebodywithfileschemaPutCode200Response](#endpointfakebodywithfileschemaputcode200response) + +a sealed interface that stores endpoint responses + +## EndpointFakebodywithfileschemaPutCode200Response +public record EndpointFakebodywithfileschemaPutCode200Response( + HttpResponse response, + Nothing? body, + Nothing? headers +) implements EndpointResponse, ApiResponse
+ +a class that stores an endpoint response + diff --git a/samples/client/petstore/kotlin/docs/paths/fakebodywithfileschema/put/requestbody/content/applicationjson/ApplicationjsonSchema.md b/samples/client/petstore/kotlin/docs/paths/fakebodywithfileschema/put/requestbody/content/applicationjson/ApplicationjsonSchema.md new file mode 100644 index 00000000000..16f5864b396 --- /dev/null +++ b/samples/client/petstore/kotlin/docs/paths/fakebodywithfileschema/put/requestbody/content/applicationjson/ApplicationjsonSchema.md @@ -0,0 +1,19 @@ +# ApplicationjsonSchema +public class ApplicationjsonSchema
+extends [FileSchemaTestClass1](../../../../../../components/schemas/FileSchemaTestClass.md#fileschematestclass) + +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 + +## Nested Class Summary +| Modifier and Type | Class and Description | +| ----------------- | ---------------------- | +| static class | [ApplicationjsonSchema.ApplicationjsonSchema1](#applicationjsonschema1)
schema class | + +## ApplicationjsonSchema1 +public static class ApplicationjsonSchema1
+extends [FileSchemaTestClass.FileSchemaTestClass1](../../../../../../components/schemas/FileSchemaTestClass.md#fileschematestclass1) + +A schema class that validates payloads diff --git a/samples/client/petstore/kotlin/docs/paths/fakebodywithfileschema/put/responses/FakebodywithfileschemaPutCode200Response.md b/samples/client/petstore/kotlin/docs/paths/fakebodywithfileschema/put/responses/FakebodywithfileschemaPutCode200Response.md new file mode 100644 index 00000000000..7de1a2829fb --- /dev/null +++ b/samples/client/petstore/kotlin/docs/paths/fakebodywithfileschema/put/responses/FakebodywithfileschemaPutCode200Response.md @@ -0,0 +1,17 @@ +# FakebodywithfileschemaPutCode200Response + +public class FakebodywithfileschemaPutCode200Response extends [SuccessDescriptionOnly](../../components/responses/SuccessDescriptionOnly.md) + +A class (extended from the $ref class) that contains necessary nested response classes +- a class that extends ResponseDeserializer and is used to deserialize responses + +## Nested Class Summary +| Modifier and Type | Class and Description | +| ----------------- | --------------------- | +| static class | [FakebodywithfileschemaPutCode200Response.FakebodywithfileschemaPutCode200Response1](#fakebodywithfileschemaputcode200response1)
class that deserializes responses | + +## FakebodywithfileschemaPutCode200Response1 +public static class FakebodywithfileschemaPutCode200Response1 extends [SuccessDescriptionOnly1](../../components/responses/SuccessDescriptionOnly.md#successdescriptiononly1)
+ +a class that deserializes responses, extended from the $ref class + diff --git a/samples/client/petstore/kotlin/docs/paths/fakebodywithqueryparams/FakebodywithqueryparamsPut.md b/samples/client/petstore/kotlin/docs/paths/fakebodywithqueryparams/FakebodywithqueryparamsPut.md new file mode 100644 index 00000000000..3e459a91467 --- /dev/null +++ b/samples/client/petstore/kotlin/docs/paths/fakebodywithqueryparams/FakebodywithqueryparamsPut.md @@ -0,0 +1,249 @@ +# FakebodywithqueryparamsPut + +public class FakebodywithqueryparamsPut + +A class that contains necessary endpoint classes +- a class that calls the endpoint method using the http verb +- a class that calls the endpoint method using the operationId name +- class(es) to store the request inputs +- builder(s) to set the request input data + +## Nested Class Summary +| Modifier and Type | Class and Description | +| ----------------- | --------------------- | +| static class | [Put](#put)
The class that has a put method to call the endpoint | +| interface | [BodyWithQueryParamsOperation](#bodywithqueryparamsoperation)
The interface that has a bodyWithQueryParams method to call the endpoint | +| static class | [PutRequest](#putrequest)
The final request inputs class | +| static class | [PutNullableRequest](#putnullablerequest)
The initial request inputs class | +| static class | [Put00RequestBuilder](#put00requestbuilder)
A builder for the request input class | +| static class | [Put01RequestBuilder](#put01requestbuilder)
A builder for the request input class | +| static class | [Put10RequestBuilder](#put10requestbuilder)
A builder for the request input class | +| static class | [PutRequestBuilder](#putrequestbuilder)
A builder for the request input class | + +## Put +public static class Put extends ApiClient.ApiClient1 implements PutOperation
+ +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.fakebodywithqueryparams.put.FakebodywithqueryparamsPutRequestBody; +import org.openapijsonschematools.client.components.schemas.User; +import org.openapijsonschematools.client.paths.fakebodywithqueryparams.put.FakebodywithqueryparamsPutQueryParameters; +import org.openapijsonschematools.client.servers.RootServer0; +import org.openapijsonschematools.client.servers.RootServer1; +import org.openapijsonschematools.client.servers.RootServer2; +import org.openapijsonschematools.client.paths.fakebodywithqueryparams.put.responses.FakebodywithqueryparamsPutCode200Response; +import org.openapijsonschematools.client.servers.RootServerInfo; +import org.openapijsonschematools.client.paths.fakebodywithqueryparams.FakebodywithqueryparamsPut; +import org.openapijsonschematools.client.paths.fakebodywithqueryparams.put.FakebodywithqueryparamsPutResponses; + +import java.io.IOException; +import java.util.Arrays; +import java.util.List; +import java.util.Map; +import java.util.AbstractMap; + +// if you want to use a server that is not SERVER_0 pass it in here and change the ServerIndex input below +ApiConfiguration.ServerInfo serverInfo = new ApiConfiguration.ServerInfoBuilder() + .rootServerInfo( + new RootServerInfo.RootServerInfoBuilder() + .rootServer0(new RootServer0()) + .build() + ) + .build(); +ApiConfiguration.ServerIndexInfo serverIndexInfo = new ApiConfiguration.ServerIndexInfoBuilder() + .rootServerInfoServerIndex(RootServerInfo.ServerIndex.SERVER_0) + .build(); +Duration timeout = Duration.ofSeconds(1L); +Map> defaultHeaders = Map.of("User-Agent", List.of("OpenAPI-JSON-Schema-Generator/1.0.0/java")); +ApiConfiguration apiConfiguration = new ApiConfiguration( + serverInfo + serverIndexInfo, + timeout, + defaultHeaders +); +SchemaConfiguration schemaConfiguration = new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().build()); +FakebodywithqueryparamsPut.Put apiClient = new FakebodywithqueryparamsPut.Put(apiConfiguration, schemaConfiguration); + + +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 +); +FakebodywithqueryparamsPut.SealedRequestBody requestBody = new FakebodywithqueryparamsPut.ApplicationjsonRequestBody(requestBodyPayload); + +// Map validation +FakebodywithqueryparamsPutQueryParameters.QueryParametersMap queryParameters = + FakebodywithqueryparamsPutQueryParameters.FakebodywithqueryparamsPutQueryParameters1.validate( + new FakebodywithqueryparamsPutQueryParameters.QueryParametersMapBuilder() + .query("a") + + .build(), + schemaConfiguration +); + +var request = new FakebodywithqueryparamsPut.PutRequestBuilder() + .requestBody(requestBody) + .queryParameters(queryParameters) + .build(); + +FakebodywithqueryparamsPutResponses.EndpointResponse response; +try { + response = apiClient.put(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; +} +FakebodywithqueryparamsPutResponses.EndpointFakebodywithqueryparamsPutCode200Response castResponse = (FakebodywithqueryparamsPutResponses.EndpointFakebodywithqueryparamsPutCode200Response) response; +``` +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| Put(ApiConfiguration apiConfiguration, SchemaConfiguration schemaConfiguration)
Creates an instance | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| [FakebodywithqueryparamsPutResponses.EndpointResponse](../../paths/fakebodywithqueryparams/put/FakebodywithqueryparamsPutResponses.md#endpointresponse) | put([PutRequest](#putrequest) request) | + +## BodyWithQueryParamsOperation +public interface BodyWithQueryParamsOperation
+ +an interface that allows one to call the endpoint using a method named bodyWithQueryParams by the operationId + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| [FakebodywithqueryparamsPutResponses.EndpointResponse](../../paths/fakebodywithqueryparams/put/FakebodywithqueryparamsPutResponses.md#endpointresponse) | bodyWithQueryParams([PutRequest](#putrequest) request) | + +## PutRequest +public static class PutRequest
+ +a class that stores the final request inputs + +### Field Summary +| Modifier and Type | Field and Description | +| ----------------- | --------------------- | +| [FakebodywithqueryparamsPutRequestBody.SealedRequestBody](../../paths/fakebodywithqueryparams/put/FakebodywithqueryparamsPutRequestBody.md#sealedrequestbody) | requestBody | +| [FakebodywithqueryparamsPutQueryParameters.QueryParametersMap](../../paths/fakebodywithqueryparams/put/FakebodywithqueryparamsPutQueryParameters.md#queryparametersmap) | queryParameters | +| [RootServerInfo.@Nullable ServerIndex](../../RootServerInfo.md#serverindex) | serverIndex
optional. Note: this will override the value in apiConfiguration | +| @Nullable Duration | timeout
optional. Note: this will override the value in apiConfiguration | + +## PutNullableRequest +public static class PutNullableRequest
+ +a class that stores the initial request inputs + +### Field Summary +| Modifier and Type | Field and Description | +| ----------------- | --------------------- | +| [FakebodywithqueryparamsPutRequestBody.@Nullable SealedRequestBody](../../paths/fakebodywithqueryparams/put/FakebodywithqueryparamsPutRequestBody.md#sealedrequestbody) | requestBody | +| [FakebodywithqueryparamsPutQueryParameters.@Nullable QueryParametersMap](../../paths/fakebodywithqueryparams/put/FakebodywithqueryparamsPutQueryParameters.md#queryparametersmap) | queryParameters | +| [RootServerInfo.@Nullable ServerIndex](../../RootServerInfo.md#serverindex) | serverIndex | +| @Nullable Duration | timeout | + +## Put00RequestBuilder +public static class Put00RequestBuilder
+ +a builder for request inputs + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| Put00RequestBuilder(Put00RequestBuilder instance)
Creates a builder that contains the passed instance | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| [PutRequest](#putrequest) | build()
Returns the request input used to call an endpoint method | +| [Put00RequestBuilder](#put00requestbuilder) | serverIndex([RootServerInfo.ServerIndex](../../RootServerInfo.md#serverindex) serverIndex)
sets the optional property. Note: this will override the value in apiConfiguration | +| [Put00RequestBuilder](#put00requestbuilder) | timeout(Duration timeout)
sets the optional property. Note: this will override the value in apiConfiguration | + +## Put01RequestBuilder +public static class Put01RequestBuilder
+ +a builder for request inputs + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| Put01RequestBuilder(Put01RequestBuilder instance)
Creates a builder that contains the passed instance | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| [Put00RequestBuilder](#put00requestbuilder) | queryParameters([FakebodywithqueryparamsPutQueryParametersQueryParametersMap](../../paths/fakebodywithqueryparams/put/FakebodywithqueryparamsPutQueryParameters.md#queryparametersmap) queryParameters)
sets the property | + +## Put10RequestBuilder +public static class Put10RequestBuilder
+ +a builder for request inputs + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| Put10RequestBuilder(Put10RequestBuilder instance)
Creates a builder that contains the passed instance | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| [Put00RequestBuilder](#put00requestbuilder) | requestBody([FakebodywithqueryparamsPutRequestBody.SealedRequestBody](../../paths/fakebodywithqueryparams/put/FakebodywithqueryparamsPutRequestBody.md#sealedrequestbody) requestBody)
sets the property | + +## PutRequestBuilder +public static class PutRequestBuilder
+ +a builder for request inputs + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| PutRequestBuilder()
Creates a builder that contains null for all parameters | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| [Put01RequestBuilder](#put01requestbuilder) | requestBody([FakebodywithqueryparamsPutRequestBody.SealedRequestBody](../../paths/fakebodywithqueryparams/put/FakebodywithqueryparamsPutRequestBody.md#sealedrequestbody) requestBody)
sets the property | +| [Put10RequestBuilder](#put10requestbuilder) | queryParameters([FakebodywithqueryparamsPutQueryParametersQueryParametersMap](../../paths/fakebodywithqueryparams/put/FakebodywithqueryparamsPutQueryParameters.md#queryparametersmap) queryParameters)
sets the property | + +[[Back to top]](#top) [[Back to README]](../../../README.md) diff --git a/samples/client/petstore/kotlin/docs/paths/fakebodywithqueryparams/put/FakebodywithqueryparamsPutQueryParameters.md b/samples/client/petstore/kotlin/docs/paths/fakebodywithqueryparams/put/FakebodywithqueryparamsPutQueryParameters.md new file mode 100644 index 00000000000..017ab61c33a --- /dev/null +++ b/samples/client/petstore/kotlin/docs/paths/fakebodywithqueryparams/put/FakebodywithqueryparamsPutQueryParameters.md @@ -0,0 +1,268 @@ +# FakebodywithqueryparamsPutQueryParameters +public class FakebodywithqueryparamsPutQueryParameters
+ +A class that contains necessary nested +- schema classes (which validate payloads), extends JsonSchema +- sealed interfaces which store validated payloads, java version of a sum type +- boxed classes which store validated payloads, sealed permits class implementations +- classes to store validated map payloads, extends FrozenMap +- classes to build inputs for map payloads + +## Nested Class Summary +| Modifier and Type | Class and Description | +| ----------------- | ---------------------- | +| sealed interface | [FakebodywithqueryparamsPutQueryParameters.FakebodywithqueryparamsPutQueryParameters1Boxed](#fakebodywithqueryparamsputqueryparameters1boxed)
sealed interface for validated payloads | +| record | [FakebodywithqueryparamsPutQueryParameters.FakebodywithqueryparamsPutQueryParameters1BoxedMap](#fakebodywithqueryparamsputqueryparameters1boxedmap)
boxed class to store validated Map payloads | +| static class | [FakebodywithqueryparamsPutQueryParameters.FakebodywithqueryparamsPutQueryParameters1](#fakebodywithqueryparamsputqueryparameters1)
schema class | +| static class | [FakebodywithqueryparamsPutQueryParameters.QueryParametersMapBuilder](#queryparametersmapbuilder)
builder for Map payloads | +| static class | [FakebodywithqueryparamsPutQueryParameters.QueryParametersMap](#queryparametersmap)
output class for Map payloads | +| sealed interface | [FakebodywithqueryparamsPutQueryParameters.AdditionalPropertiesBoxed](#additionalpropertiesboxed)
sealed interface for validated payloads | +| record | [FakebodywithqueryparamsPutQueryParameters.AdditionalPropertiesBoxedVoid](#additionalpropertiesboxedvoid)
boxed class to store validated null payloads | +| record | [FakebodywithqueryparamsPutQueryParameters.AdditionalPropertiesBoxedBoolean](#additionalpropertiesboxedboolean)
boxed class to store validated boolean payloads | +| record | [FakebodywithqueryparamsPutQueryParameters.AdditionalPropertiesBoxedNumber](#additionalpropertiesboxednumber)
boxed class to store validated Number payloads | +| record | [FakebodywithqueryparamsPutQueryParameters.AdditionalPropertiesBoxedString](#additionalpropertiesboxedstring)
boxed class to store validated String payloads | +| record | [FakebodywithqueryparamsPutQueryParameters.AdditionalPropertiesBoxedList](#additionalpropertiesboxedlist)
boxed class to store validated List payloads | +| record | [FakebodywithqueryparamsPutQueryParameters.AdditionalPropertiesBoxedMap](#additionalpropertiesboxedmap)
boxed class to store validated Map payloads | +| static class | [FakebodywithqueryparamsPutQueryParameters.AdditionalProperties](#additionalproperties)
schema class | + +## FakebodywithqueryparamsPutQueryParameters1Boxed +public sealed interface FakebodywithqueryparamsPutQueryParameters1Boxed
+permits
+[FakebodywithqueryparamsPutQueryParameters1BoxedMap](#fakebodywithqueryparamsputqueryparameters1boxedmap) + +sealed interface that stores validated payloads using boxed classes + +## FakebodywithqueryparamsPutQueryParameters1BoxedMap +public record FakebodywithqueryparamsPutQueryParameters1BoxedMap
+implements [FakebodywithqueryparamsPutQueryParameters1Boxed](#fakebodywithqueryparamsputqueryparameters1boxed) + +record that stores validated Map payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| FakebodywithqueryparamsPutQueryParameters1BoxedMap([QueryParametersMap](#queryparametersmap) data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| [QueryParametersMap](#queryparametersmap) | data()
validated payload | +| @Nullable Object | getData()
validated payload | + +## FakebodywithqueryparamsPutQueryParameters1 +public static class FakebodywithqueryparamsPutQueryParameters1
+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.fakebodywithqueryparams.put.FakebodywithqueryparamsPutQueryParameters; + +import java.util.Arrays; +import java.util.List; +import java.util.AbstractMap; + +static final SchemaConfiguration configuration = new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().build()); + +// Map validation +FakebodywithqueryparamsPutQueryParameters.QueryParametersMap validatedPayload = + FakebodywithqueryparamsPutQueryParameters.FakebodywithqueryparamsPutQueryParameters1.validate( + new FakebodywithqueryparamsPutQueryParameters.QueryParametersMapBuilder() + .query("a") + + .build(), + configuration +); +``` + +### Field Summary +| Modifier and Type | Field and Description | +| ----------------- | ---------------------- | +| Set> | type = Set.of(Map.class) | +| Map> | properties = Map.ofEntries(
    new PropertyEntry("query", [Schema0.Schema01.class](../../../paths/fakebodywithqueryparams/put/parameters/parameter0/Schema0.md#schema01))
)
| +| Set | required = Set.of(
    "query"
)
| +| Class | additionalProperties = [AdditionalProperties.class](#additionalproperties) | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| [QueryParametersMap](#queryparametersmap) | validate([Map<?, ?>](#queryparametersmapbuilder) arg, SchemaConfiguration configuration) | +| [FakebodywithqueryparamsPutQueryParameters1BoxedMap](#fakebodywithqueryparamsputqueryparameters1boxedmap) | validateAndBox([Map<?, ?>](#queryparametersmapbuilder) arg, SchemaConfiguration configuration) | +| [FakebodywithqueryparamsPutQueryParameters1Boxed](#fakebodywithqueryparamsputqueryparameters1boxed) | validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) | +| @Nullable Object | validate(@Nullable Object arg, SchemaConfiguration configuration) | + +## QueryParametersMap0Builder +public class QueryParametersMap0Builder
+builder for `Map` + +A class that builds the Map input type + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| QueryParametersMap0Builder(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 | + +## QueryParametersMapBuilder +public class QueryParametersMapBuilder
+builder for `Map` + +A class that builds the Map input type + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| QueryParametersMapBuilder()
Creates a builder that contains an empty map | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| [QueryParametersMap0Builder](#queryparametersmap0builder) | query(String value) | + +## QueryParametersMap +public static class QueryParametersMap
+extends FrozenMap + +A class to store validated Map payloads + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| static [QueryParametersMap](#queryparametersmap) | of([Map](#queryparametersmapbuilder) arg, SchemaConfiguration configuration) | +| String | query()
| + +## 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(Nothing? data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| Nothing? | 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/kotlin/docs/paths/fakebodywithqueryparams/put/FakebodywithqueryparamsPutRequestBody.md b/samples/client/petstore/kotlin/docs/paths/fakebodywithqueryparams/put/FakebodywithqueryparamsPutRequestBody.md new file mode 100644 index 00000000000..43b883f655f --- /dev/null +++ b/samples/client/petstore/kotlin/docs/paths/fakebodywithqueryparams/put/FakebodywithqueryparamsPutRequestBody.md @@ -0,0 +1,90 @@ +# FakebodywithqueryparamsPutRequestBody + +public class FakebodywithqueryparamsPutRequestBody + +A class that contains necessary nested request body classes +- SealedMediaType, a sealed interface which contains all the schema/encoding info for each contentType +- records which implement SealedMediaType, the concrete media types +- a class that extends RequestBodySerializer and is used to serialize input SealedRequestBody instances +- SealedRequestBody, a sealed interface which contains all the contentType/schema input types +- records which implement SealedRequestBody, the concrete request body types + +## Nested Class Summary +| Modifier and Type | Class and Description | +| ----------------- | --------------------- | +| sealed interface | [FakebodywithqueryparamsPutRequestBody.SealedMediaType](#sealedmediatype)
media type sealed interface | +| record | [FakebodywithqueryparamsPutRequestBody.ApplicationjsonMediaType](#applicationjsonmediatype)
record storing schema + encoding for a specific contentType | +| static class | [FakebodywithqueryparamsPutRequestBody.FakebodywithqueryparamsPutRequestBody1](#fakebodywithqueryparamsputrequestbody1)
class that serializes request bodies | +| sealed interface | [FakebodywithqueryparamsPutRequestBody.SealedRequestBody](#sealedrequestbody)
request body sealed interface | +| record | [FakebodywithqueryparamsPutRequestBody.ApplicationjsonRequestBody](#applicationjsonrequestbody)
implements sealed interface to store request body input | + +## SealedMediaType +public sealed interface SealedMediaType
+permits
+[ApplicationjsonMediaType](#applicationjsonmediatype) + +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), Nothing?> + +class storing schema info for a specific contentType + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| ApplicationjsonMediaType()
Creates an instance | + +### 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 | +| Nothing? | encoding()
the encoding info | + +## FakebodywithqueryparamsPutRequestBody1 +public static class FakebodywithqueryparamsPutRequestBody1
+ +a class that serializes SealedRequestBody request bodies + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| FakebodywithqueryparamsPutRequestBody1()
Creates an instance | + +### Field Summary +| Modifier and Type | Field and Description | +| ----------------- | --------------------- | +| boolean | required = true
whether the request body is required | +| 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 | +| ----------------- | ---------------------- | +| SerializedRequestBody | serialize([SealedRequestBody](#sealedrequestbody) requestBody)
called by endpoint when creating request body bytes | + +## SealedRequestBody +public sealed interface SealedRequestBody
+permits
+[ApplicationjsonRequestBody](#applicationjsonrequestbody) + +sealed interface that stores request contentType + validated schema data + +## ApplicationjsonRequestBody +public record ApplicationjsonRequestBody
+implements [SealedRequestBody](#sealedrequestbody),
+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 | + +### 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 | diff --git a/samples/client/petstore/kotlin/docs/paths/fakebodywithqueryparams/put/FakebodywithqueryparamsPutResponses.md b/samples/client/petstore/kotlin/docs/paths/fakebodywithqueryparams/put/FakebodywithqueryparamsPutResponses.md new file mode 100644 index 00000000000..edd318d56c6 --- /dev/null +++ b/samples/client/petstore/kotlin/docs/paths/fakebodywithqueryparams/put/FakebodywithqueryparamsPutResponses.md @@ -0,0 +1,29 @@ +# FakebodywithqueryparamsPutResponses + +public class FakebodywithqueryparamsPutResponses + +A class that contains necessary responses classes +- a sealed interface, EndpointResponse, that stores endpoint responses +- records for each endpoint response + +## Nested Class Summary +| Modifier and Type | Class and Description | +| ----------------- | --------------------- | +| sealed interface | [EndpointResponse](#endpointresponse)
stores the endpoint responses | +| record | [EndpointFakebodywithqueryparamsPutCode200Response](#endpointfakebodywithqueryparamsputcode200response)
the response for 200 | + +## EndpointResponse +public sealed interface EndpointResponse permits
+[EndpointFakebodywithqueryparamsPutCode200Response](#endpointfakebodywithqueryparamsputcode200response) + +a sealed interface that stores endpoint responses + +## EndpointFakebodywithqueryparamsPutCode200Response +public record EndpointFakebodywithqueryparamsPutCode200Response( + HttpResponse response, + Nothing? body, + Nothing? headers +) implements EndpointResponse, ApiResponse
+ +a class that stores an endpoint response + diff --git a/samples/client/petstore/kotlin/docs/paths/fakebodywithqueryparams/put/parameters/parameter0/Schema0.md b/samples/client/petstore/kotlin/docs/paths/fakebodywithqueryparams/put/parameters/parameter0/Schema0.md new file mode 100644 index 00000000000..9ff90e0bc35 --- /dev/null +++ b/samples/client/petstore/kotlin/docs/paths/fakebodywithqueryparams/put/parameters/parameter0/Schema0.md @@ -0,0 +1,49 @@ +# Schema0 +public class Schema0
+ +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 + +## Nested Class Summary +| Modifier and Type | Class and Description | +| ----------------- | ---------------------- | +| sealed interface | [Schema0.Schema01Boxed](#schema01boxed)
sealed interface for validated payloads | +| record | [Schema0.Schema01BoxedString](#schema01boxedstring)
boxed class to store validated String payloads | +| static class | [Schema0.Schema01](#schema01)
schema class | + +## Schema01Boxed +public sealed interface Schema01Boxed
+permits
+[Schema01BoxedString](#schema01boxedstring) + +sealed interface that stores validated payloads using boxed classes + +## Schema01BoxedString +public record Schema01BoxedString
+implements [Schema01Boxed](#schema01boxed) + +record that stores validated String payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| Schema01BoxedString(String data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| String | data()
validated payload | +| @Nullable Object | getData()
validated payload | + +## Schema01 +public static class Schema01
+extends StringJsonSchema.StringJsonSchema1 + +A schema class that validates payloads + +| Methods Inherited from class org.openapijsonschematools.client.schemas.StringJsonSchema.StringJsonSchema1 | +| ------------------------------------------------------------------ | +| validate | +| validateAndBox | diff --git a/samples/client/petstore/kotlin/docs/paths/fakebodywithqueryparams/put/requestbody/content/applicationjson/ApplicationjsonSchema.md b/samples/client/petstore/kotlin/docs/paths/fakebodywithqueryparams/put/requestbody/content/applicationjson/ApplicationjsonSchema.md new file mode 100644 index 00000000000..87ec51870cc --- /dev/null +++ b/samples/client/petstore/kotlin/docs/paths/fakebodywithqueryparams/put/requestbody/content/applicationjson/ApplicationjsonSchema.md @@ -0,0 +1,19 @@ +# ApplicationjsonSchema +public class ApplicationjsonSchema
+extends [User1](../../../../../../components/schemas/User.md#user) + +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 + +## Nested Class Summary +| Modifier and Type | Class and Description | +| ----------------- | ---------------------- | +| static class | [ApplicationjsonSchema.ApplicationjsonSchema1](#applicationjsonschema1)
schema class | + +## ApplicationjsonSchema1 +public static class ApplicationjsonSchema1
+extends [User.User1](../../../../../../components/schemas/User.md#user1) + +A schema class that validates payloads diff --git a/samples/client/petstore/kotlin/docs/paths/fakebodywithqueryparams/put/responses/FakebodywithqueryparamsPutCode200Response.md b/samples/client/petstore/kotlin/docs/paths/fakebodywithqueryparams/put/responses/FakebodywithqueryparamsPutCode200Response.md new file mode 100644 index 00000000000..e6bbeac0a7b --- /dev/null +++ b/samples/client/petstore/kotlin/docs/paths/fakebodywithqueryparams/put/responses/FakebodywithqueryparamsPutCode200Response.md @@ -0,0 +1,17 @@ +# FakebodywithqueryparamsPutCode200Response + +public class FakebodywithqueryparamsPutCode200Response extends [SuccessDescriptionOnly](../../components/responses/SuccessDescriptionOnly.md) + +A class (extended from the $ref class) that contains necessary nested response classes +- a class that extends ResponseDeserializer and is used to deserialize responses + +## Nested Class Summary +| Modifier and Type | Class and Description | +| ----------------- | --------------------- | +| static class | [FakebodywithqueryparamsPutCode200Response.FakebodywithqueryparamsPutCode200Response1](#fakebodywithqueryparamsputcode200response1)
class that deserializes responses | + +## FakebodywithqueryparamsPutCode200Response1 +public static class FakebodywithqueryparamsPutCode200Response1 extends [SuccessDescriptionOnly1](../../components/responses/SuccessDescriptionOnly.md#successdescriptiononly1)
+ +a class that deserializes responses, extended from the $ref class + diff --git a/samples/client/petstore/kotlin/docs/paths/fakecasesensitiveparams/FakecasesensitiveparamsPut.md b/samples/client/petstore/kotlin/docs/paths/fakecasesensitiveparams/FakecasesensitiveparamsPut.md new file mode 100644 index 00000000000..2996f66f440 --- /dev/null +++ b/samples/client/petstore/kotlin/docs/paths/fakecasesensitiveparams/FakecasesensitiveparamsPut.md @@ -0,0 +1,189 @@ +# FakecasesensitiveparamsPut + +public class FakecasesensitiveparamsPut + +A class that contains necessary endpoint classes +- a class that calls the endpoint method using the http verb +- a class that calls the endpoint method using the operationId name +- class(es) to store the request inputs +- builder(s) to set the request input data + +## Nested Class Summary +| Modifier and Type | Class and Description | +| ----------------- | --------------------- | +| static class | [Put](#put)
The class that has a put method to call the endpoint | +| interface | [CaseSensitiveParamsOperation](#casesensitiveparamsoperation)
The interface that has a caseSensitiveParams method to call the endpoint | +| static class | [PutRequest](#putrequest)
The final request inputs class | +| static class | [PutNullableRequest](#putnullablerequest)
The initial request inputs class | +| static class | [Put0RequestBuilder](#put0requestbuilder)
A builder for the request input class | +| static class | [PutRequestBuilder](#putrequestbuilder)
A builder for the request input class | + +## Put +public static class Put extends ApiClient.ApiClient1 implements PutOperation
+ +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.fakecasesensitiveparams.put.FakecasesensitiveparamsPutQueryParameters; +import org.openapijsonschematools.client.servers.RootServer0; +import org.openapijsonschematools.client.servers.RootServer1; +import org.openapijsonschematools.client.servers.RootServer2; +import org.openapijsonschematools.client.paths.fakecasesensitiveparams.put.responses.FakecasesensitiveparamsPutCode200Response; +import org.openapijsonschematools.client.servers.RootServerInfo; +import org.openapijsonschematools.client.paths.fakecasesensitiveparams.FakecasesensitiveparamsPut; +import org.openapijsonschematools.client.paths.fakecasesensitiveparams.put.FakecasesensitiveparamsPutResponses; + +import java.io.IOException; +import java.util.Arrays; +import java.util.List; +import java.util.Map; +import java.util.AbstractMap; + +// if you want to use a server that is not SERVER_0 pass it in here and change the ServerIndex input below +ApiConfiguration.ServerInfo serverInfo = new ApiConfiguration.ServerInfoBuilder() + .rootServerInfo( + new RootServerInfo.RootServerInfoBuilder() + .rootServer0(new RootServer0()) + .build() + ) + .build(); +ApiConfiguration.ServerIndexInfo serverIndexInfo = new ApiConfiguration.ServerIndexInfoBuilder() + .rootServerInfoServerIndex(RootServerInfo.ServerIndex.SERVER_0) + .build(); +Duration timeout = Duration.ofSeconds(1L); +Map> defaultHeaders = Map.of("User-Agent", List.of("OpenAPI-JSON-Schema-Generator/1.0.0/java")); +ApiConfiguration apiConfiguration = new ApiConfiguration( + serverInfo + serverIndexInfo, + timeout, + defaultHeaders +); +SchemaConfiguration schemaConfiguration = new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().build()); +FakecasesensitiveparamsPut.Put apiClient = new FakecasesensitiveparamsPut.Put(apiConfiguration, schemaConfiguration); + + +// Map validation +FakecasesensitiveparamsPutQueryParameters.QueryParametersMap queryParameters = + FakecasesensitiveparamsPutQueryParameters.FakecasesensitiveparamsPutQueryParameters1.validate( + new FakecasesensitiveparamsPutQueryParameters.QueryParametersMapBuilder() + .SomeVar("a") + + .someVar("a") + + .some_var("a") + + .build(), + schemaConfiguration +); + +var request = new FakecasesensitiveparamsPut.PutRequestBuilder() + .queryParameters(queryParameters) + .build(); + +FakecasesensitiveparamsPutResponses.EndpointResponse response; +try { + response = apiClient.put(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; +} +FakecasesensitiveparamsPutResponses.EndpointFakecasesensitiveparamsPutCode200Response castResponse = (FakecasesensitiveparamsPutResponses.EndpointFakecasesensitiveparamsPutCode200Response) response; +``` +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| Put(ApiConfiguration apiConfiguration, SchemaConfiguration schemaConfiguration)
Creates an instance | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| [FakecasesensitiveparamsPutResponses.EndpointResponse](../../paths/fakecasesensitiveparams/put/FakecasesensitiveparamsPutResponses.md#endpointresponse) | put([PutRequest](#putrequest) request) | + +## CaseSensitiveParamsOperation +public interface CaseSensitiveParamsOperation
+ +an interface that allows one to call the endpoint using a method named caseSensitiveParams by the operationId + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| [FakecasesensitiveparamsPutResponses.EndpointResponse](../../paths/fakecasesensitiveparams/put/FakecasesensitiveparamsPutResponses.md#endpointresponse) | caseSensitiveParams([PutRequest](#putrequest) request) | + +## PutRequest +public static class PutRequest
+ +a class that stores the final request inputs + +### Field Summary +| Modifier and Type | Field and Description | +| ----------------- | --------------------- | +| [FakecasesensitiveparamsPutQueryParameters.QueryParametersMap](../../paths/fakecasesensitiveparams/put/FakecasesensitiveparamsPutQueryParameters.md#queryparametersmap) | queryParameters | +| [RootServerInfo.@Nullable ServerIndex](../../RootServerInfo.md#serverindex) | serverIndex
optional. Note: this will override the value in apiConfiguration | +| @Nullable Duration | timeout
optional. Note: this will override the value in apiConfiguration | + +## PutNullableRequest +public static class PutNullableRequest
+ +a class that stores the initial request inputs + +### Field Summary +| Modifier and Type | Field and Description | +| ----------------- | --------------------- | +| [FakecasesensitiveparamsPutQueryParameters.@Nullable QueryParametersMap](../../paths/fakecasesensitiveparams/put/FakecasesensitiveparamsPutQueryParameters.md#queryparametersmap) | queryParameters | +| [RootServerInfo.@Nullable ServerIndex](../../RootServerInfo.md#serverindex) | serverIndex | +| @Nullable Duration | timeout | + +## Put0RequestBuilder +public static class Put0RequestBuilder
+ +a builder for request inputs + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| Put0RequestBuilder(Put0RequestBuilder instance)
Creates a builder that contains the passed instance | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| [PutRequest](#putrequest) | build()
Returns the request input used to call an endpoint method | +| [Put0RequestBuilder](#put0requestbuilder) | serverIndex([RootServerInfo.ServerIndex](../../RootServerInfo.md#serverindex) serverIndex)
sets the optional property. Note: this will override the value in apiConfiguration | +| [Put0RequestBuilder](#put0requestbuilder) | timeout(Duration timeout)
sets the optional property. Note: this will override the value in apiConfiguration | + +## PutRequestBuilder +public static class PutRequestBuilder
+ +a builder for request inputs + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| PutRequestBuilder()
Creates a builder that contains null for all parameters | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| [Put0RequestBuilder](#put0requestbuilder) | queryParameters([FakecasesensitiveparamsPutQueryParametersQueryParametersMap](../../paths/fakecasesensitiveparams/put/FakecasesensitiveparamsPutQueryParameters.md#queryparametersmap) queryParameters)
sets the property | + +[[Back to top]](#top) [[Back to README]](../../../README.md) diff --git a/samples/client/petstore/kotlin/docs/paths/fakecasesensitiveparams/put/FakecasesensitiveparamsPutQueryParameters.md b/samples/client/petstore/kotlin/docs/paths/fakecasesensitiveparams/put/FakecasesensitiveparamsPutQueryParameters.md new file mode 100644 index 00000000000..2284e865bb5 --- /dev/null +++ b/samples/client/petstore/kotlin/docs/paths/fakecasesensitiveparams/put/FakecasesensitiveparamsPutQueryParameters.md @@ -0,0 +1,375 @@ +# FakecasesensitiveparamsPutQueryParameters +public class FakecasesensitiveparamsPutQueryParameters
+ +A class that contains necessary nested +- schema classes (which validate payloads), extends JsonSchema +- sealed interfaces which store validated payloads, java version of a sum type +- boxed classes which store validated payloads, sealed permits class implementations +- classes to store validated map payloads, extends FrozenMap +- classes to build inputs for map payloads + +## Nested Class Summary +| Modifier and Type | Class and Description | +| ----------------- | ---------------------- | +| sealed interface | [FakecasesensitiveparamsPutQueryParameters.FakecasesensitiveparamsPutQueryParameters1Boxed](#fakecasesensitiveparamsputqueryparameters1boxed)
sealed interface for validated payloads | +| record | [FakecasesensitiveparamsPutQueryParameters.FakecasesensitiveparamsPutQueryParameters1BoxedMap](#fakecasesensitiveparamsputqueryparameters1boxedmap)
boxed class to store validated Map payloads | +| static class | [FakecasesensitiveparamsPutQueryParameters.FakecasesensitiveparamsPutQueryParameters1](#fakecasesensitiveparamsputqueryparameters1)
schema class | +| static class | [FakecasesensitiveparamsPutQueryParameters.QueryParametersMapBuilder](#queryparametersmapbuilder)
builder for Map payloads | +| static class | [FakecasesensitiveparamsPutQueryParameters.QueryParametersMap](#queryparametersmap)
output class for Map payloads | +| sealed interface | [FakecasesensitiveparamsPutQueryParameters.AdditionalPropertiesBoxed](#additionalpropertiesboxed)
sealed interface for validated payloads | +| record | [FakecasesensitiveparamsPutQueryParameters.AdditionalPropertiesBoxedVoid](#additionalpropertiesboxedvoid)
boxed class to store validated null payloads | +| record | [FakecasesensitiveparamsPutQueryParameters.AdditionalPropertiesBoxedBoolean](#additionalpropertiesboxedboolean)
boxed class to store validated boolean payloads | +| record | [FakecasesensitiveparamsPutQueryParameters.AdditionalPropertiesBoxedNumber](#additionalpropertiesboxednumber)
boxed class to store validated Number payloads | +| record | [FakecasesensitiveparamsPutQueryParameters.AdditionalPropertiesBoxedString](#additionalpropertiesboxedstring)
boxed class to store validated String payloads | +| record | [FakecasesensitiveparamsPutQueryParameters.AdditionalPropertiesBoxedList](#additionalpropertiesboxedlist)
boxed class to store validated List payloads | +| record | [FakecasesensitiveparamsPutQueryParameters.AdditionalPropertiesBoxedMap](#additionalpropertiesboxedmap)
boxed class to store validated Map payloads | +| static class | [FakecasesensitiveparamsPutQueryParameters.AdditionalProperties](#additionalproperties)
schema class | + +## FakecasesensitiveparamsPutQueryParameters1Boxed +public sealed interface FakecasesensitiveparamsPutQueryParameters1Boxed
+permits
+[FakecasesensitiveparamsPutQueryParameters1BoxedMap](#fakecasesensitiveparamsputqueryparameters1boxedmap) + +sealed interface that stores validated payloads using boxed classes + +## FakecasesensitiveparamsPutQueryParameters1BoxedMap +public record FakecasesensitiveparamsPutQueryParameters1BoxedMap
+implements [FakecasesensitiveparamsPutQueryParameters1Boxed](#fakecasesensitiveparamsputqueryparameters1boxed) + +record that stores validated Map payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| FakecasesensitiveparamsPutQueryParameters1BoxedMap([QueryParametersMap](#queryparametersmap) data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| [QueryParametersMap](#queryparametersmap) | data()
validated payload | +| @Nullable Object | getData()
validated payload | + +## FakecasesensitiveparamsPutQueryParameters1 +public static class FakecasesensitiveparamsPutQueryParameters1
+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.fakecasesensitiveparams.put.FakecasesensitiveparamsPutQueryParameters; + +import java.util.Arrays; +import java.util.List; +import java.util.AbstractMap; + +static final SchemaConfiguration configuration = new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().build()); + +// Map validation +FakecasesensitiveparamsPutQueryParameters.QueryParametersMap validatedPayload = + FakecasesensitiveparamsPutQueryParameters.FakecasesensitiveparamsPutQueryParameters1.validate( + new FakecasesensitiveparamsPutQueryParameters.QueryParametersMapBuilder() + .SomeVar("a") + + .someVar("a") + + .some_var("a") + + .build(), + configuration +); +``` + +### Field Summary +| Modifier and Type | Field and Description | +| ----------------- | ---------------------- | +| Set> | type = Set.of(Map.class) | +| Map> | properties = Map.ofEntries(
    new PropertyEntry("someVar", [Schema0.Schema01.class](../../../paths/fakecasesensitiveparams/put/parameters/parameter0/Schema0.md#schema01)),
    new PropertyEntry("some_var", [Schema2.Schema21.class](../../../paths/fakecasesensitiveparams/put/parameters/parameter2/Schema2.md#schema21)),
    new PropertyEntry("SomeVar", [Schema1.Schema11.class](../../../paths/fakecasesensitiveparams/put/parameters/parameter1/Schema1.md#schema11))
)
| +| Set | required = Set.of(
    "SomeVar",
    "someVar",
    "some_var"
)
| +| Class | additionalProperties = [AdditionalProperties.class](#additionalproperties) | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| [QueryParametersMap](#queryparametersmap) | validate([Map<?, ?>](#queryparametersmapbuilder) arg, SchemaConfiguration configuration) | +| [FakecasesensitiveparamsPutQueryParameters1BoxedMap](#fakecasesensitiveparamsputqueryparameters1boxedmap) | validateAndBox([Map<?, ?>](#queryparametersmapbuilder) arg, SchemaConfiguration configuration) | +| [FakecasesensitiveparamsPutQueryParameters1Boxed](#fakecasesensitiveparamsputqueryparameters1boxed) | validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) | +| @Nullable Object | validate(@Nullable Object arg, SchemaConfiguration configuration) | + +## QueryParametersMap000Builder +public class QueryParametersMap000Builder
+builder for `Map` + +A class that builds the Map input type + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| QueryParametersMap000Builder(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 | + +## QueryParametersMap001Builder +public class QueryParametersMap001Builder
+builder for `Map` + +A class that builds the Map input type + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| QueryParametersMap001Builder(Map instance)
Creates a builder that contains the passed instance | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| [QueryParametersMap000Builder](#queryparametersmap000builder) | some_var(String value) | + +## QueryParametersMap010Builder +public class QueryParametersMap010Builder
+builder for `Map` + +A class that builds the Map input type + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| QueryParametersMap010Builder(Map instance)
Creates a builder that contains the passed instance | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| [QueryParametersMap000Builder](#queryparametersmap000builder) | someVar(String value) | + +## QueryParametersMap011Builder +public class QueryParametersMap011Builder
+builder for `Map` + +A class that builds the Map input type + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| QueryParametersMap011Builder(Map instance)
Creates a builder that contains the passed instance | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| [QueryParametersMap001Builder](#queryparametersmap001builder) | someVar(String value) | +| [QueryParametersMap010Builder](#queryparametersmap010builder) | some_var(String value) | + +## QueryParametersMap100Builder +public class QueryParametersMap100Builder
+builder for `Map` + +A class that builds the Map input type + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| QueryParametersMap100Builder(Map instance)
Creates a builder that contains the passed instance | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| [QueryParametersMap000Builder](#queryparametersmap000builder) | SomeVar(String value) | + +## QueryParametersMap101Builder +public class QueryParametersMap101Builder
+builder for `Map` + +A class that builds the Map input type + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| QueryParametersMap101Builder(Map instance)
Creates a builder that contains the passed instance | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| [QueryParametersMap001Builder](#queryparametersmap001builder) | SomeVar(String value) | +| [QueryParametersMap100Builder](#queryparametersmap100builder) | some_var(String value) | + +## QueryParametersMap110Builder +public class QueryParametersMap110Builder
+builder for `Map` + +A class that builds the Map input type + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| QueryParametersMap110Builder(Map instance)
Creates a builder that contains the passed instance | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| [QueryParametersMap010Builder](#queryparametersmap010builder) | SomeVar(String value) | +| [QueryParametersMap100Builder](#queryparametersmap100builder) | someVar(String value) | + +## QueryParametersMapBuilder +public class QueryParametersMapBuilder
+builder for `Map` + +A class that builds the Map input type + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| QueryParametersMapBuilder()
Creates a builder that contains an empty map | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| [QueryParametersMap011Builder](#queryparametersmap011builder) | SomeVar(String value) | +| [QueryParametersMap101Builder](#queryparametersmap101builder) | someVar(String value) | +| [QueryParametersMap110Builder](#queryparametersmap110builder) | some_var(String value) | + +## QueryParametersMap +public static class QueryParametersMap
+extends FrozenMap + +A class to store validated Map payloads + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| static [QueryParametersMap](#queryparametersmap) | of([Map](#queryparametersmapbuilder) arg, SchemaConfiguration configuration) | +| String | SomeVar()
| +| String | someVar()
| +| String | some_var()
| + +## 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(Nothing? data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| Nothing? | 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/kotlin/docs/paths/fakecasesensitiveparams/put/FakecasesensitiveparamsPutResponses.md b/samples/client/petstore/kotlin/docs/paths/fakecasesensitiveparams/put/FakecasesensitiveparamsPutResponses.md new file mode 100644 index 00000000000..f28ec994333 --- /dev/null +++ b/samples/client/petstore/kotlin/docs/paths/fakecasesensitiveparams/put/FakecasesensitiveparamsPutResponses.md @@ -0,0 +1,29 @@ +# FakecasesensitiveparamsPutResponses + +public class FakecasesensitiveparamsPutResponses + +A class that contains necessary responses classes +- a sealed interface, EndpointResponse, that stores endpoint responses +- records for each endpoint response + +## Nested Class Summary +| Modifier and Type | Class and Description | +| ----------------- | --------------------- | +| sealed interface | [EndpointResponse](#endpointresponse)
stores the endpoint responses | +| record | [EndpointFakecasesensitiveparamsPutCode200Response](#endpointfakecasesensitiveparamsputcode200response)
the response for 200 | + +## EndpointResponse +public sealed interface EndpointResponse permits
+[EndpointFakecasesensitiveparamsPutCode200Response](#endpointfakecasesensitiveparamsputcode200response) + +a sealed interface that stores endpoint responses + +## EndpointFakecasesensitiveparamsPutCode200Response +public record EndpointFakecasesensitiveparamsPutCode200Response( + HttpResponse response, + Nothing? body, + Nothing? headers +) implements EndpointResponse, ApiResponse
+ +a class that stores an endpoint response + diff --git a/samples/client/petstore/kotlin/docs/paths/fakecasesensitiveparams/put/parameters/parameter0/Schema0.md b/samples/client/petstore/kotlin/docs/paths/fakecasesensitiveparams/put/parameters/parameter0/Schema0.md new file mode 100644 index 00000000000..9ff90e0bc35 --- /dev/null +++ b/samples/client/petstore/kotlin/docs/paths/fakecasesensitiveparams/put/parameters/parameter0/Schema0.md @@ -0,0 +1,49 @@ +# Schema0 +public class Schema0
+ +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 + +## Nested Class Summary +| Modifier and Type | Class and Description | +| ----------------- | ---------------------- | +| sealed interface | [Schema0.Schema01Boxed](#schema01boxed)
sealed interface for validated payloads | +| record | [Schema0.Schema01BoxedString](#schema01boxedstring)
boxed class to store validated String payloads | +| static class | [Schema0.Schema01](#schema01)
schema class | + +## Schema01Boxed +public sealed interface Schema01Boxed
+permits
+[Schema01BoxedString](#schema01boxedstring) + +sealed interface that stores validated payloads using boxed classes + +## Schema01BoxedString +public record Schema01BoxedString
+implements [Schema01Boxed](#schema01boxed) + +record that stores validated String payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| Schema01BoxedString(String data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| String | data()
validated payload | +| @Nullable Object | getData()
validated payload | + +## Schema01 +public static class Schema01
+extends StringJsonSchema.StringJsonSchema1 + +A schema class that validates payloads + +| Methods Inherited from class org.openapijsonschematools.client.schemas.StringJsonSchema.StringJsonSchema1 | +| ------------------------------------------------------------------ | +| validate | +| validateAndBox | diff --git a/samples/client/petstore/kotlin/docs/paths/fakecasesensitiveparams/put/parameters/parameter1/Schema1.md b/samples/client/petstore/kotlin/docs/paths/fakecasesensitiveparams/put/parameters/parameter1/Schema1.md new file mode 100644 index 00000000000..63ec3a884fc --- /dev/null +++ b/samples/client/petstore/kotlin/docs/paths/fakecasesensitiveparams/put/parameters/parameter1/Schema1.md @@ -0,0 +1,49 @@ +# Schema1 +public class Schema1
+ +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 + +## Nested Class Summary +| Modifier and Type | Class and Description | +| ----------------- | ---------------------- | +| sealed interface | [Schema1.Schema11Boxed](#schema11boxed)
sealed interface for validated payloads | +| record | [Schema1.Schema11BoxedString](#schema11boxedstring)
boxed class to store validated String payloads | +| static class | [Schema1.Schema11](#schema11)
schema class | + +## Schema11Boxed +public sealed interface Schema11Boxed
+permits
+[Schema11BoxedString](#schema11boxedstring) + +sealed interface that stores validated payloads using boxed classes + +## Schema11BoxedString +public record Schema11BoxedString
+implements [Schema11Boxed](#schema11boxed) + +record that stores validated String payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| Schema11BoxedString(String data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| String | data()
validated payload | +| @Nullable Object | getData()
validated payload | + +## Schema11 +public static class Schema11
+extends StringJsonSchema.StringJsonSchema1 + +A schema class that validates payloads + +| Methods Inherited from class org.openapijsonschematools.client.schemas.StringJsonSchema.StringJsonSchema1 | +| ------------------------------------------------------------------ | +| validate | +| validateAndBox | diff --git a/samples/client/petstore/kotlin/docs/paths/fakecasesensitiveparams/put/parameters/parameter2/Schema2.md b/samples/client/petstore/kotlin/docs/paths/fakecasesensitiveparams/put/parameters/parameter2/Schema2.md new file mode 100644 index 00000000000..4a7d57953eb --- /dev/null +++ b/samples/client/petstore/kotlin/docs/paths/fakecasesensitiveparams/put/parameters/parameter2/Schema2.md @@ -0,0 +1,49 @@ +# Schema2 +public class Schema2
+ +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 + +## Nested Class Summary +| Modifier and Type | Class and Description | +| ----------------- | ---------------------- | +| sealed interface | [Schema2.Schema21Boxed](#schema21boxed)
sealed interface for validated payloads | +| record | [Schema2.Schema21BoxedString](#schema21boxedstring)
boxed class to store validated String payloads | +| static class | [Schema2.Schema21](#schema21)
schema class | + +## Schema21Boxed +public sealed interface Schema21Boxed
+permits
+[Schema21BoxedString](#schema21boxedstring) + +sealed interface that stores validated payloads using boxed classes + +## Schema21BoxedString +public record Schema21BoxedString
+implements [Schema21Boxed](#schema21boxed) + +record that stores validated String payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| Schema21BoxedString(String data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| String | data()
validated payload | +| @Nullable Object | getData()
validated payload | + +## Schema21 +public static class Schema21
+extends StringJsonSchema.StringJsonSchema1 + +A schema class that validates payloads + +| Methods Inherited from class org.openapijsonschematools.client.schemas.StringJsonSchema.StringJsonSchema1 | +| ------------------------------------------------------------------ | +| validate | +| validateAndBox | diff --git a/samples/client/petstore/kotlin/docs/paths/fakecasesensitiveparams/put/responses/FakecasesensitiveparamsPutCode200Response.md b/samples/client/petstore/kotlin/docs/paths/fakecasesensitiveparams/put/responses/FakecasesensitiveparamsPutCode200Response.md new file mode 100644 index 00000000000..2ec9adb95bd --- /dev/null +++ b/samples/client/petstore/kotlin/docs/paths/fakecasesensitiveparams/put/responses/FakecasesensitiveparamsPutCode200Response.md @@ -0,0 +1,17 @@ +# FakecasesensitiveparamsPutCode200Response + +public class FakecasesensitiveparamsPutCode200Response extends [SuccessDescriptionOnly](../../components/responses/SuccessDescriptionOnly.md) + +A class (extended from the $ref class) that contains necessary nested response classes +- a class that extends ResponseDeserializer and is used to deserialize responses + +## Nested Class Summary +| Modifier and Type | Class and Description | +| ----------------- | --------------------- | +| static class | [FakecasesensitiveparamsPutCode200Response.FakecasesensitiveparamsPutCode200Response1](#fakecasesensitiveparamsputcode200response1)
class that deserializes responses | + +## FakecasesensitiveparamsPutCode200Response1 +public static class FakecasesensitiveparamsPutCode200Response1 extends [SuccessDescriptionOnly1](../../components/responses/SuccessDescriptionOnly.md#successdescriptiononly1)
+ +a class that deserializes responses, extended from the $ref class + diff --git a/samples/client/petstore/kotlin/docs/paths/fakeclassnametest/FakeclassnametestPatch.md b/samples/client/petstore/kotlin/docs/paths/fakeclassnametest/FakeclassnametestPatch.md new file mode 100644 index 00000000000..1adc69788e6 --- /dev/null +++ b/samples/client/petstore/kotlin/docs/paths/fakeclassnametest/FakeclassnametestPatch.md @@ -0,0 +1,203 @@ +# FakeclassnametestPatch + +public class FakeclassnametestPatch + +A class that contains necessary endpoint classes +- a class that calls the endpoint method using the http verb +- a class that calls the endpoint method using the operationId name +- class(es) to store the request inputs +- builder(s) to set the request input data + +## Nested Class Summary +| Modifier and Type | Class and Description | +| ----------------- | --------------------- | +| static class | [Patch](#patch)
The class that has a patch method to call the endpoint | +| interface | [ClassnameOperation](#classnameoperation)
The interface that has a classname method to call the endpoint | +| static class | [PatchRequest](#patchrequest)
The final request inputs class | +| static class | [PatchNullableRequest](#patchnullablerequest)
The initial request inputs class | +| static class | [Patch0RequestBuilder](#patch0requestbuilder)
A builder for the request input class | +| static class | [PatchRequestBuilder](#patchrequestbuilder)
A builder for the request input class | + +## Patch +public static class Patch extends ApiClient.ApiClient1 implements PatchOperation
+ +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.fakeclassnametest.patch.FakeclassnametestPatchSecurityInfo; +import org.openapijsonschematools.client.paths.fakeclassnametest.patch.FakeclassnametestPatchRequestBody; +import org.openapijsonschematools.client.components.schemas.Client; +import org.openapijsonschematools.client.servers.RootServer0; +import org.openapijsonschematools.client.servers.RootServer1; +import org.openapijsonschematools.client.servers.RootServer2; +import org.openapijsonschematools.client.securityschemes.SecurityScheme; +import org.openapijsonschematools.client.components.securityschemes.ApiKeyQuery; +import org.openapijsonschematools.client.paths.fakeclassnametest.patch.responses.FakeclassnametestPatchCode200Response; +import org.openapijsonschematools.client.servers.RootServerInfo; +import org.openapijsonschematools.client.paths.fakeclassnametest.FakeclassnametestPatch; +import org.openapijsonschematools.client.paths.fakeclassnametest.patch.FakeclassnametestPatchResponses; + +import java.io.IOException; +import java.util.Arrays; +import java.util.List; +import java.util.Map; +import java.util.AbstractMap; + +// if you want to use a server that is not SERVER_0 pass it in here and change the ServerIndex input below +ApiConfiguration.ServerInfo serverInfo = new ApiConfiguration.ServerInfoBuilder() + .rootServerInfo( + new RootServerInfo.RootServerInfoBuilder() + .rootServer0(new RootServer0()) + .build() + ) + .build(); +ApiConfiguration.ServerIndexInfo serverIndexInfo = new ApiConfiguration.ServerIndexInfoBuilder() + .rootServerInfoServerIndex(RootServerInfo.ServerIndex.SERVER_0) + .build(); +List securitySchemes = new ArrayList(); +securitySchemes.add( + new ApiKeyQuery("someApiKey"); +); +ApiConfiguration.SecurityIndexInfo securityIndexInfo = new ApiConfiguration.SecurityIndexInfoBuilder() + .fakeclassnametestPatchSecurityRequirementObject0SecurityIndex(FakeclassnametestPatchSecurityRequirementObject0.SecurityIndex.SECURITY_0) + .build(); +Duration timeout = Duration.ofSeconds(1L); +Map> defaultHeaders = Map.of("User-Agent", List.of("OpenAPI-JSON-Schema-Generator/1.0.0/java")); +ApiConfiguration apiConfiguration = new ApiConfiguration( + serverInfo + serverIndexInfo, + securitySchemes, + securityIndexInfo, + timeout, + defaultHeaders +); +SchemaConfiguration schemaConfiguration = new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().build()); +FakeclassnametestPatch.Patch apiClient = new FakeclassnametestPatch.Patch(apiConfiguration, schemaConfiguration); + + +Client1BoxedMap requestBodyPayload = + Client.Client1.validateAndBox( + new Client.ClientMapBuilder1() + .client("a") + + .build(), + schemaConfiguration +); +FakeclassnametestPatchRequestBody.SealedRequestBody requestBody = new FakeclassnametestPatchRequestBody.ApplicationjsonRequestBody(requestBodyPayload); + +var request = new FakeclassnametestPatch.PatchRequestBuilder() + .requestBody(requestBody) + .build(); + +FakeclassnametestPatchResponses.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; +} +FakeclassnametestPatchResponses.EndpointFakeclassnametestPatchCode200Response castResponse = (FakeclassnametestPatchResponses.EndpointFakeclassnametestPatchCode200Response) response; +FakeclassnametestPatchCode200Response.ApplicationjsonResponseBody deserializedBody = (FakeclassnametestPatchCode200Response.ApplicationjsonResponseBody) castResponse.body; +// handle deserialized body here +``` +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| Patch(ApiConfiguration apiConfiguration, SchemaConfiguration schemaConfiguration)
Creates an instance | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| [FakeclassnametestPatchResponses.EndpointResponse](../../paths/fakeclassnametest/patch/FakeclassnametestPatchResponses.md#endpointresponse) | patch([PatchRequest](#patchrequest) request) | + +## ClassnameOperation +public interface ClassnameOperation
+ +an interface that allows one to call the endpoint using a method named classname by the operationId + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| [FakeclassnametestPatchResponses.EndpointResponse](../../paths/fakeclassnametest/patch/FakeclassnametestPatchResponses.md#endpointresponse) | classname([PatchRequest](#patchrequest) request) | + +## PatchRequest +public static class PatchRequest
+ +a class that stores the final request inputs + +### Field Summary +| Modifier and Type | Field and Description | +| ----------------- | --------------------- | +| [FakeclassnametestPatchRequestBody.SealedRequestBody](../../paths/fakeclassnametest/patch/FakeclassnametestPatchRequestBody.md#sealedrequestbody) | requestBody | +| [RootServerInfo.@Nullable ServerIndex](../../RootServerInfo.md#serverindex) | serverIndex
optional. Note: this will override the value in apiConfiguration | +| [FakeclassnametestPatchSecurityInfo.@Nullable SecurityIndex](../../paths/fakeclassnametest/patch/FakeclassnametestPatchSecurityInfo.md#securityindex) | securityIndex
optional. Note: this will override the value in apiConfiguration | +| @Nullable Duration | timeout
optional. Note: this will override the value in apiConfiguration | + +## PatchNullableRequest +public static class PatchNullableRequest
+ +a class that stores the initial request inputs + +### Field Summary +| Modifier and Type | Field and Description | +| ----------------- | --------------------- | +| [FakeclassnametestPatchRequestBody.@Nullable SealedRequestBody](../../paths/fakeclassnametest/patch/FakeclassnametestPatchRequestBody.md#sealedrequestbody) | requestBody | +| [RootServerInfo.@Nullable ServerIndex](../../RootServerInfo.md#serverindex) | serverIndex | +| [FakeclassnametestPatchSecurityInfo.@Nullable SecurityIndex](../../paths/fakeclassnametest/patch/FakeclassnametestPatchSecurityInfo.md#securityindex) | securityIndex | +| @Nullable Duration | timeout | + +## Patch0RequestBuilder +public static class Patch0RequestBuilder
+ +a builder for request inputs + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| Patch0RequestBuilder(Patch0RequestBuilder instance)
Creates a builder that contains the passed instance | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| [PatchRequest](#patchrequest) | build()
Returns the request input used to call an endpoint method | +| [Patch0RequestBuilder](#patch0requestbuilder) | serverIndex([RootServerInfo.ServerIndex](../../RootServerInfo.md#serverindex) serverIndex)
sets the optional property. Note: this will override the value in apiConfiguration | +| [Patch0RequestBuilder](#patch0requestbuilder) | securityIndex([FakeclassnametestPatchSecurityInfo.SecurityIndex](../../paths/fakeclassnametest/patch/FakeclassnametestPatchSecurityInfo.md#securityindex) securityIndex)
sets the optional property. Note: this will override the value in apiConfiguration | +| [Patch0RequestBuilder](#patch0requestbuilder) | timeout(Duration timeout)
sets the optional property. Note: this will override the value in apiConfiguration | + +## PatchRequestBuilder +public static class PatchRequestBuilder
+ +a builder for request inputs + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| PatchRequestBuilder()
Creates a builder that contains null for all parameters | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| [Patch0RequestBuilder](#patch0requestbuilder) | requestBody([FakeclassnametestPatchRequestBody.SealedRequestBody](../../paths/fakeclassnametest/patch/FakeclassnametestPatchRequestBody.md#sealedrequestbody) requestBody)
sets the property | + +[[Back to top]](#top) [[Back to README]](../../../README.md) diff --git a/samples/client/petstore/kotlin/docs/paths/fakeclassnametest/patch/FakeclassnametestPatchRequestBody.md b/samples/client/petstore/kotlin/docs/paths/fakeclassnametest/patch/FakeclassnametestPatchRequestBody.md new file mode 100644 index 00000000000..ee0772ceed2 --- /dev/null +++ b/samples/client/petstore/kotlin/docs/paths/fakeclassnametest/patch/FakeclassnametestPatchRequestBody.md @@ -0,0 +1,17 @@ +# FakeclassnametestPatchRequestBody + +public class FakeclassnametestPatchRequestBody 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 + +## Nested Class Summary +| Modifier and Type | Class and Description | +| ----------------- | --------------------- | +| static class | [FakeclassnametestPatchRequestBody.FakeclassnametestPatchRequestBody1](#fakeclassnametestpatchrequestbody1)
class that serializes request bodies | + +## FakeclassnametestPatchRequestBody1 +public static class FakeclassnametestPatchRequestBody1 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/kotlin/docs/paths/fakeclassnametest/patch/FakeclassnametestPatchResponses.md b/samples/client/petstore/kotlin/docs/paths/fakeclassnametest/patch/FakeclassnametestPatchResponses.md new file mode 100644 index 00000000000..275f4b1980c --- /dev/null +++ b/samples/client/petstore/kotlin/docs/paths/fakeclassnametest/patch/FakeclassnametestPatchResponses.md @@ -0,0 +1,29 @@ +# FakeclassnametestPatchResponses + +public class FakeclassnametestPatchResponses + +A class that contains necessary responses classes +- a sealed interface, EndpointResponse, that stores endpoint responses +- records for each endpoint response + +## Nested Class Summary +| Modifier and Type | Class and Description | +| ----------------- | --------------------- | +| sealed interface | [EndpointResponse](#endpointresponse)
stores the endpoint responses | +| record | [EndpointFakeclassnametestPatchCode200Response](#endpointfakeclassnametestpatchcode200response)
the response for 200 | + +## EndpointResponse +public sealed interface EndpointResponse permits
+[EndpointFakeclassnametestPatchCode200Response](#endpointfakeclassnametestpatchcode200response) + +a sealed interface that stores endpoint responses + +## EndpointFakeclassnametestPatchCode200Response +public record EndpointFakeclassnametestPatchCode200Response( + HttpResponse response, + [FakeclassnametestPatchCode200Response.SealedResponseBody](../../../paths/fakeclassnametest/patch/responses/FakeclassnametestPatchCode200Response.md#sealedresponsebody) body, + Nothing? headers +) implements EndpointResponse, ApiResponse
+ +a class that stores an endpoint response + diff --git a/samples/client/petstore/kotlin/docs/paths/fakeclassnametest/patch/FakeclassnametestPatchSecurityInfo.md b/samples/client/petstore/kotlin/docs/paths/fakeclassnametest/patch/FakeclassnametestPatchSecurityInfo.md new file mode 100644 index 00000000000..3e252e7cdd7 --- /dev/null +++ b/samples/client/petstore/kotlin/docs/paths/fakeclassnametest/patch/FakeclassnametestPatchSecurityInfo.md @@ -0,0 +1,40 @@ +# FakeclassnametestPatchSecurityInfo +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 +- an enum class that describes security index values + +## Nested Class Summary +| Modifier and Type | Class and Description | +| ----------------- | --------------------- | +| static class | [FakeclassnametestPatchSecurityInfo.FakeclassnametestPatchSecurityInfo1](#fakeclassnametestpatchsecurityinfo1)
SecurityRequirementObjectProvider +| enum | [FakeclassnametestPatchSecurityInfo.SecurityIndex](#securityindex)
class that stores a security index | + +## FakeclassnametestPatchSecurityInfo1 +implements SecurityRequirementObjectProvider<[SecurityIndex](#securityindex)> + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| FakeclassnametestPatchSecurityInfo1()
Creates an instance | + +### Field Summary +| Modifier and Type | Field and Description | +| ----------------- | --------------------- | +| [FakeclassnametestPatchSecurityRequirementObject0](../../../paths/fakeclassnametest/patch/security/FakeclassnametestPatchSecurityRequirementObject0.md) | security0 | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| SecurityRequirementObject | getSecurityRequirementObject(@Nullable [SecurityIndex](#securityindex) securityIndex)
If null is input, then the instance's securityIndex will be used | + +## SecurityIndex +enum SecurityIndex
+ +### Enum Constant Summary +| Enum Constant And Description | +| ----------------------------- | +| SECURITY_0
security 0 | diff --git a/samples/client/petstore/kotlin/docs/paths/fakeclassnametest/patch/responses/FakeclassnametestPatchCode200Response.md b/samples/client/petstore/kotlin/docs/paths/fakeclassnametest/patch/responses/FakeclassnametestPatchCode200Response.md new file mode 100644 index 00000000000..b2832a09530 --- /dev/null +++ b/samples/client/petstore/kotlin/docs/paths/fakeclassnametest/patch/responses/FakeclassnametestPatchCode200Response.md @@ -0,0 +1,87 @@ +# FakeclassnametestPatchCode200Response + +public class FakeclassnametestPatchCode200Response + +A class that contains necessary nested response classes +- SealedMediaType, a sealed interface which contains all the schema/encoding info for each contentType +- records which implement SealedMediaType, the concrete media types +- SealedResponseBody, a sealed interface which contains all the contentType/schema types +- records which implement SealedResponseBody, the concrete response body types +- a class that extends ResponseDeserializer and is used to deserialize responses + +## Nested Class Summary +| Modifier and Type | Class and Description | +| ----------------- | --------------------- | +| sealed interface | [FakeclassnametestPatchCode200Response.SealedMediaType](#sealedmediatype)
media type sealed interface | +| record | [FakeclassnametestPatchCode200Response.ApplicationjsonMediaType](#applicationjsonmediatype)
record storing schema + encoding for a specific contentType | +| sealed interface | [FakeclassnametestPatchCode200Response.SealedResponseBody](#sealedresponsebody)
response body sealed interface | +| record | [FakeclassnametestPatchCode200Response.ApplicationjsonResponseBody](#applicationjsonresponsebody)
implements sealed interface to store response body | +| static class | [FakeclassnametestPatchCode200Response.FakeclassnametestPatchCode200Response1](#fakeclassnametestpatchcode200response1)
class that deserializes responses | + +## SealedMediaType +public sealed interface SealedMediaType
+permits
+[ApplicationjsonMediaType](#applicationjsonmediatype) + +sealed interface that stores schema and encoding info + +## ApplicationjsonMediaType +public record ApplicationjsonMediaType
+implements [SealedMediaType](#sealedmediatype), MediaType<[ApplicationjsonSchema.ApplicationjsonSchema1](../../../../paths/fakeclassnametest/patch/responses/code200response/content/applicationjson/ApplicationjsonSchema.md#applicationjsonschema1), Nothing?> + +class storing schema info for a specific contentType + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| ApplicationjsonMediaType()
Creates an instance | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| [ApplicationjsonSchema.ApplicationjsonSchema1](../../../../paths/fakeclassnametest/patch/responses/code200response/content/applicationjson/ApplicationjsonSchema.md#applicationjsonschema1) | schema()
the schema for this MediaType | +| Nothing? | encoding()
the encoding info | + +## SealedResponseBody +public sealed interface SealedResponseBody
+permits
+[ApplicationjsonResponseBody](#applicationjsonresponsebody) + +sealed interface that stores response body + +## ApplicationjsonResponseBody +public record ApplicationjsonResponseBody
+implements [SealedResponseBody](#sealedresponsebody) + +A record class to store response body for contentType="application/json" + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| ApplicationjsonResponseBody(ApplicationjsonSchema.[Client1Boxed](../../../../components/schemas/Client.md#client1boxed) body)
Creates an instance | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| ApplicationjsonSchema.[Client1Boxed](../../../../components/schemas/Client.md#client1boxed) | body()
returns the body passed in in the constructor | + +## FakeclassnametestPatchCode200Response1 +public static class FakeclassnametestPatchCode200Response1
+extends ResponseDeserializer<[SealedResponseBody](#sealedresponsebody), Nothing?, [SealedMediaType](#sealedmediatype)> + +a class that deserializes responses + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| FakeclassnametestPatchCode200Response1()
Creates an instance | + +### Field Summary +| Modifier and Type | Field and Description | +| ----------------- | --------------------- | +| 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 | +| ----------------- | ---------------------- | +| ApiResponse<[SealedResponseBody](#sealedresponsebody), Nothing?> | deserialize(HttpResponse response, SchemaConfiguration configuration)
called by endpoint when deserialize responses | diff --git a/samples/client/petstore/kotlin/docs/paths/fakeclassnametest/patch/responses/code200response/content/applicationjson/ApplicationjsonSchema.md b/samples/client/petstore/kotlin/docs/paths/fakeclassnametest/patch/responses/code200response/content/applicationjson/ApplicationjsonSchema.md new file mode 100644 index 00000000000..534041524ca --- /dev/null +++ b/samples/client/petstore/kotlin/docs/paths/fakeclassnametest/patch/responses/code200response/content/applicationjson/ApplicationjsonSchema.md @@ -0,0 +1,19 @@ +# ApplicationjsonSchema +public class ApplicationjsonSchema
+extends [Client1](../../../../../../../components/schemas/Client.md#client) + +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 + +## Nested Class Summary +| Modifier and Type | Class and Description | +| ----------------- | ---------------------- | +| static class | [ApplicationjsonSchema.ApplicationjsonSchema1](#applicationjsonschema1)
schema class | + +## ApplicationjsonSchema1 +public static class ApplicationjsonSchema1
+extends [Client.Client1](../../../../../../../components/schemas/Client.md#client1) + +A schema class that validates payloads diff --git a/samples/client/petstore/kotlin/docs/paths/fakeclassnametest/patch/security/FakeclassnametestPatchSecurityRequirementObject0.md b/samples/client/petstore/kotlin/docs/paths/fakeclassnametest/patch/security/FakeclassnametestPatchSecurityRequirementObject0.md new file mode 100644 index 00000000000..0651521d4b3 --- /dev/null +++ b/samples/client/petstore/kotlin/docs/paths/fakeclassnametest/patch/security/FakeclassnametestPatchSecurityRequirementObject0.md @@ -0,0 +1,15 @@ +# FakeclassnametestPatchSecurityRequirementObject0 +FakeclassnametestPatchSecurityRequirementObject0.java + +public class FakeclassnametestPatchSecurityRequirementObject0 +extends SecurityRequirementObject + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| FakeclassnametestPatchSecurityRequirementObject0()
Creates an instance | + +### 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()
    )) | diff --git a/samples/client/petstore/kotlin/docs/paths/fakedeletecoffeeid/FakedeletecoffeeidDelete.md b/samples/client/petstore/kotlin/docs/paths/fakedeletecoffeeid/FakedeletecoffeeidDelete.md new file mode 100644 index 00000000000..0223066b60f --- /dev/null +++ b/samples/client/petstore/kotlin/docs/paths/fakedeletecoffeeid/FakedeletecoffeeidDelete.md @@ -0,0 +1,189 @@ +# FakedeletecoffeeidDelete + +public class FakedeletecoffeeidDelete + +A class that contains necessary endpoint classes +- a class that calls the endpoint method using the http verb +- a class that calls the endpoint method using the operationId name +- class(es) to store the request inputs +- builder(s) to set the request input data + +## Nested Class Summary +| Modifier and Type | Class and Description | +| ----------------- | --------------------- | +| static class | [Delete](#delete)
The class that has a delete method to call the endpoint | +| interface | [DeleteCoffeeOperation](#deletecoffeeoperation)
The interface that has a deleteCoffee method to call the endpoint | +| static class | [DeleteRequest](#deleterequest)
The final request inputs class | +| static class | [DeleteNullableRequest](#deletenullablerequest)
The initial request inputs class | +| static class | [Delete0RequestBuilder](#delete0requestbuilder)
A builder for the request input class | +| static class | [DeleteRequestBuilder](#deleterequestbuilder)
A builder for the request input class | + +## Delete +public static class Delete extends ApiClient.ApiClient1 implements DeleteOperation
+ +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.FakedeletecoffeeidDeletePathParameters; +import org.openapijsonschematools.client.servers.RootServer0; +import org.openapijsonschematools.client.servers.RootServer1; +import org.openapijsonschematools.client.servers.RootServer2; +import org.openapijsonschematools.client.paths.fakedeletecoffeeid.delete.responses.FakedeletecoffeeidDeleteCode200Response; +import org.openapijsonschematools.client.paths.fakedeletecoffeeid.delete.responses.FakedeletecoffeeidDeleteCodedefaultResponse; +import org.openapijsonschematools.client.servers.RootServerInfo; +import org.openapijsonschematools.client.paths.fakedeletecoffeeid.FakedeletecoffeeidDelete; +import org.openapijsonschematools.client.paths.fakedeletecoffeeid.delete.FakedeletecoffeeidDeleteResponses; + +import java.io.IOException; +import java.util.Arrays; +import java.util.List; +import java.util.Map; +import java.util.AbstractMap; + +// if you want to use a server that is not SERVER_0 pass it in here and change the ServerIndex input below +ApiConfiguration.ServerInfo serverInfo = new ApiConfiguration.ServerInfoBuilder() + .rootServerInfo( + new RootServerInfo.RootServerInfoBuilder() + .rootServer0(new RootServer0()) + .build() + ) + .build(); +ApiConfiguration.ServerIndexInfo serverIndexInfo = new ApiConfiguration.ServerIndexInfoBuilder() + .rootServerInfoServerIndex(RootServerInfo.ServerIndex.SERVER_0) + .build(); +Duration timeout = Duration.ofSeconds(1L); +Map> defaultHeaders = Map.of("User-Agent", List.of("OpenAPI-JSON-Schema-Generator/1.0.0/java")); +ApiConfiguration apiConfiguration = new ApiConfiguration( + serverInfo + serverIndexInfo, + timeout, + defaultHeaders +); +SchemaConfiguration schemaConfiguration = new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().build()); +FakedeletecoffeeidDelete.Delete apiClient = new FakedeletecoffeeidDelete.Delete(apiConfiguration, schemaConfiguration); + + +// Map validation +FakedeletecoffeeidDeletePathParameters.PathParametersMap pathParameters = + FakedeletecoffeeidDeletePathParameters.FakedeletecoffeeidDeletePathParameters1.validate( + new FakedeletecoffeeidDeletePathParameters.PathParametersMapBuilder() + .id("a") + + .build(), + schemaConfiguration +); + +var request = new FakedeletecoffeeidDelete.DeleteRequestBuilder() + .pathParameters(pathParameters) + .build(); + +FakedeletecoffeeidDeleteResponses.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 FakedeletecoffeeidDeleteResponses.EndpointFakedeletecoffeeidDeleteCode200Response castResponse) { +} else { + FakedeletecoffeeidDeleteResponses.EndpointFakedeletecoffeeidDeleteCodedefaultResponse castResponse = (FakedeletecoffeeidDeleteResponses.EndpointFakedeletecoffeeidDeleteCodedefaultResponse) response; +} +``` +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| Delete(ApiConfiguration apiConfiguration, SchemaConfiguration schemaConfiguration)
Creates an instance | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| [FakedeletecoffeeidDeleteResponses.EndpointResponse](../../paths/fakedeletecoffeeid/delete/FakedeletecoffeeidDeleteResponses.md#endpointresponse) | delete([DeleteRequest](#deleterequest) request) | + +## DeleteCoffeeOperation +public interface DeleteCoffeeOperation
+ +an interface that allows one to call the endpoint using a method named deleteCoffee by the operationId + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| [FakedeletecoffeeidDeleteResponses.EndpointResponse](../../paths/fakedeletecoffeeid/delete/FakedeletecoffeeidDeleteResponses.md#endpointresponse) | deleteCoffee([DeleteRequest](#deleterequest) request) | + +## DeleteRequest +public static class DeleteRequest
+ +a class that stores the final request inputs + +### Field Summary +| Modifier and Type | Field and Description | +| ----------------- | --------------------- | +| [FakedeletecoffeeidDeletePathParameters.PathParametersMap](../../paths/fakedeletecoffeeid/delete/FakedeletecoffeeidDeletePathParameters.md#pathparametersmap) | pathParameters | +| [RootServerInfo.@Nullable ServerIndex](../../RootServerInfo.md#serverindex) | serverIndex
optional. Note: this will override the value in apiConfiguration | +| @Nullable Duration | timeout
optional. Note: this will override the value in apiConfiguration | + +## DeleteNullableRequest +public static class DeleteNullableRequest
+ +a class that stores the initial request inputs + +### Field Summary +| Modifier and Type | Field and Description | +| ----------------- | --------------------- | +| [FakedeletecoffeeidDeletePathParameters.@Nullable PathParametersMap](../../paths/fakedeletecoffeeid/delete/FakedeletecoffeeidDeletePathParameters.md#pathparametersmap) | pathParameters | +| [RootServerInfo.@Nullable ServerIndex](../../RootServerInfo.md#serverindex) | serverIndex | +| @Nullable Duration | timeout | + +## Delete0RequestBuilder +public static class Delete0RequestBuilder
+ +a builder for request inputs + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| Delete0RequestBuilder(Delete0RequestBuilder instance)
Creates a builder that contains the passed instance | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| [DeleteRequest](#deleterequest) | build()
Returns the request input used to call an endpoint method | +| [Delete0RequestBuilder](#delete0requestbuilder) | serverIndex([RootServerInfo.ServerIndex](../../RootServerInfo.md#serverindex) serverIndex)
sets the optional property. Note: this will override the value in apiConfiguration | +| [Delete0RequestBuilder](#delete0requestbuilder) | timeout(Duration timeout)
sets the optional property. Note: this will override the value in apiConfiguration | + +## DeleteRequestBuilder +public static class DeleteRequestBuilder
+ +a builder for request inputs + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| DeleteRequestBuilder()
Creates a builder that contains null for all parameters | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| [Delete0RequestBuilder](#delete0requestbuilder) | pathParameters([FakedeletecoffeeidDeletePathParametersPathParametersMap](../../paths/fakedeletecoffeeid/delete/FakedeletecoffeeidDeletePathParameters.md#pathparametersmap) pathParameters)
sets the property | + +[[Back to top]](#top) [[Back to README]](../../../README.md) diff --git a/samples/client/petstore/kotlin/docs/paths/fakedeletecoffeeid/delete/FakedeletecoffeeidDeletePathParameters.md b/samples/client/petstore/kotlin/docs/paths/fakedeletecoffeeid/delete/FakedeletecoffeeidDeletePathParameters.md new file mode 100644 index 00000000000..d9c538067c4 --- /dev/null +++ b/samples/client/petstore/kotlin/docs/paths/fakedeletecoffeeid/delete/FakedeletecoffeeidDeletePathParameters.md @@ -0,0 +1,268 @@ +# FakedeletecoffeeidDeletePathParameters +public class FakedeletecoffeeidDeletePathParameters
+ +A class that contains necessary nested +- schema classes (which validate payloads), extends JsonSchema +- sealed interfaces which store validated payloads, java version of a sum type +- boxed classes which store validated payloads, sealed permits class implementations +- classes to store validated map payloads, extends FrozenMap +- classes to build inputs for map payloads + +## Nested Class Summary +| Modifier and Type | Class and Description | +| ----------------- | ---------------------- | +| sealed interface | [FakedeletecoffeeidDeletePathParameters.FakedeletecoffeeidDeletePathParameters1Boxed](#fakedeletecoffeeiddeletepathparameters1boxed)
sealed interface for validated payloads | +| record | [FakedeletecoffeeidDeletePathParameters.FakedeletecoffeeidDeletePathParameters1BoxedMap](#fakedeletecoffeeiddeletepathparameters1boxedmap)
boxed class to store validated Map payloads | +| static class | [FakedeletecoffeeidDeletePathParameters.FakedeletecoffeeidDeletePathParameters1](#fakedeletecoffeeiddeletepathparameters1)
schema class | +| static class | [FakedeletecoffeeidDeletePathParameters.PathParametersMapBuilder](#pathparametersmapbuilder)
builder for Map payloads | +| static class | [FakedeletecoffeeidDeletePathParameters.PathParametersMap](#pathparametersmap)
output class for Map payloads | +| sealed interface | [FakedeletecoffeeidDeletePathParameters.AdditionalPropertiesBoxed](#additionalpropertiesboxed)
sealed interface for validated payloads | +| record | [FakedeletecoffeeidDeletePathParameters.AdditionalPropertiesBoxedVoid](#additionalpropertiesboxedvoid)
boxed class to store validated null payloads | +| record | [FakedeletecoffeeidDeletePathParameters.AdditionalPropertiesBoxedBoolean](#additionalpropertiesboxedboolean)
boxed class to store validated boolean payloads | +| record | [FakedeletecoffeeidDeletePathParameters.AdditionalPropertiesBoxedNumber](#additionalpropertiesboxednumber)
boxed class to store validated Number payloads | +| record | [FakedeletecoffeeidDeletePathParameters.AdditionalPropertiesBoxedString](#additionalpropertiesboxedstring)
boxed class to store validated String payloads | +| record | [FakedeletecoffeeidDeletePathParameters.AdditionalPropertiesBoxedList](#additionalpropertiesboxedlist)
boxed class to store validated List payloads | +| record | [FakedeletecoffeeidDeletePathParameters.AdditionalPropertiesBoxedMap](#additionalpropertiesboxedmap)
boxed class to store validated Map payloads | +| static class | [FakedeletecoffeeidDeletePathParameters.AdditionalProperties](#additionalproperties)
schema class | + +## FakedeletecoffeeidDeletePathParameters1Boxed +public sealed interface FakedeletecoffeeidDeletePathParameters1Boxed
+permits
+[FakedeletecoffeeidDeletePathParameters1BoxedMap](#fakedeletecoffeeiddeletepathparameters1boxedmap) + +sealed interface that stores validated payloads using boxed classes + +## FakedeletecoffeeidDeletePathParameters1BoxedMap +public record FakedeletecoffeeidDeletePathParameters1BoxedMap
+implements [FakedeletecoffeeidDeletePathParameters1Boxed](#fakedeletecoffeeiddeletepathparameters1boxed) + +record that stores validated Map payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| FakedeletecoffeeidDeletePathParameters1BoxedMap([PathParametersMap](#pathparametersmap) data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| [PathParametersMap](#pathparametersmap) | data()
validated payload | +| @Nullable Object | getData()
validated payload | + +## FakedeletecoffeeidDeletePathParameters1 +public static class FakedeletecoffeeidDeletePathParameters1
+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.fakedeletecoffeeid.delete.FakedeletecoffeeidDeletePathParameters; + +import java.util.Arrays; +import java.util.List; +import java.util.AbstractMap; + +static final SchemaConfiguration configuration = new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().build()); + +// Map validation +FakedeletecoffeeidDeletePathParameters.PathParametersMap validatedPayload = + FakedeletecoffeeidDeletePathParameters.FakedeletecoffeeidDeletePathParameters1.validate( + new FakedeletecoffeeidDeletePathParameters.PathParametersMapBuilder() + .id("a") + + .build(), + configuration +); +``` + +### Field Summary +| Modifier and Type | Field and Description | +| ----------------- | ---------------------- | +| Set> | type = Set.of(Map.class) | +| Map> | properties = Map.ofEntries(
    new PropertyEntry("id", [Schema0.Schema01.class](../../../paths/fakedeletecoffeeid/delete/parameters/parameter0/Schema0.md#schema01))
)
| +| Set | required = Set.of(
    "id"
)
| +| Class | additionalProperties = [AdditionalProperties.class](#additionalproperties) | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| [PathParametersMap](#pathparametersmap) | validate([Map<?, ?>](#pathparametersmapbuilder) arg, SchemaConfiguration configuration) | +| [FakedeletecoffeeidDeletePathParameters1BoxedMap](#fakedeletecoffeeiddeletepathparameters1boxedmap) | validateAndBox([Map<?, ?>](#pathparametersmapbuilder) arg, SchemaConfiguration configuration) | +| [FakedeletecoffeeidDeletePathParameters1Boxed](#fakedeletecoffeeiddeletepathparameters1boxed) | validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) | +| @Nullable Object | validate(@Nullable Object arg, SchemaConfiguration configuration) | + +## PathParametersMap0Builder +public class PathParametersMap0Builder
+builder for `Map` + +A class that builds the Map input type + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| PathParametersMap0Builder(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 | + +## PathParametersMapBuilder +public class PathParametersMapBuilder
+builder for `Map` + +A class that builds the Map input type + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| PathParametersMapBuilder()
Creates a builder that contains an empty map | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| [PathParametersMap0Builder](#pathparametersmap0builder) | id(String value) | + +## PathParametersMap +public static class PathParametersMap
+extends FrozenMap + +A class to store validated Map payloads + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| static [PathParametersMap](#pathparametersmap) | of([Map](#pathparametersmapbuilder) arg, SchemaConfiguration configuration) | +| String | id()
| + +## 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(Nothing? data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| Nothing? | 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/kotlin/docs/paths/fakedeletecoffeeid/delete/FakedeletecoffeeidDeleteResponses.md b/samples/client/petstore/kotlin/docs/paths/fakedeletecoffeeid/delete/FakedeletecoffeeidDeleteResponses.md new file mode 100644 index 00000000000..1dcadfe6262 --- /dev/null +++ b/samples/client/petstore/kotlin/docs/paths/fakedeletecoffeeid/delete/FakedeletecoffeeidDeleteResponses.md @@ -0,0 +1,40 @@ +# FakedeletecoffeeidDeleteResponses + +public class FakedeletecoffeeidDeleteResponses + +A class that contains necessary responses classes +- a sealed interface, EndpointResponse, that stores endpoint responses +- records for each endpoint response + +## Nested Class Summary +| Modifier and Type | Class and Description | +| ----------------- | --------------------- | +| sealed interface | [EndpointResponse](#endpointresponse)
stores the endpoint responses | +| record | [EndpointFakedeletecoffeeidDeleteCode200Response](#endpointfakedeletecoffeeiddeletecode200response)
the response for 200 | +| record | [EndpointFakedeletecoffeeidDeleteCodedefaultResponse](#endpointfakedeletecoffeeiddeletecodedefaultresponse)
the response for default | + +## EndpointResponse +public sealed interface EndpointResponse permits
+[EndpointFakedeletecoffeeidDeleteCode200Response](#endpointfakedeletecoffeeiddeletecode200response), +[EndpointFakedeletecoffeeidDeleteCodedefaultResponse](#endpointfakedeletecoffeeiddeletecodedefaultresponse) + +a sealed interface that stores endpoint responses + +## EndpointFakedeletecoffeeidDeleteCode200Response +public record EndpointFakedeletecoffeeidDeleteCode200Response( + HttpResponse response, + Nothing? body, + Nothing? headers +) implements EndpointResponse, ApiResponse
+ +a class that stores an endpoint response + +## EndpointFakedeletecoffeeidDeleteCodedefaultResponse +public record EndpointFakedeletecoffeeidDeleteCodedefaultResponse( + HttpResponse response, + Nothing? body, + Nothing? headers +) implements EndpointResponse, ApiResponse
+ +a class that stores an endpoint response + diff --git a/samples/client/petstore/kotlin/docs/paths/fakedeletecoffeeid/delete/parameters/parameter0/Schema0.md b/samples/client/petstore/kotlin/docs/paths/fakedeletecoffeeid/delete/parameters/parameter0/Schema0.md new file mode 100644 index 00000000000..9ff90e0bc35 --- /dev/null +++ b/samples/client/petstore/kotlin/docs/paths/fakedeletecoffeeid/delete/parameters/parameter0/Schema0.md @@ -0,0 +1,49 @@ +# Schema0 +public class Schema0
+ +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 + +## Nested Class Summary +| Modifier and Type | Class and Description | +| ----------------- | ---------------------- | +| sealed interface | [Schema0.Schema01Boxed](#schema01boxed)
sealed interface for validated payloads | +| record | [Schema0.Schema01BoxedString](#schema01boxedstring)
boxed class to store validated String payloads | +| static class | [Schema0.Schema01](#schema01)
schema class | + +## Schema01Boxed +public sealed interface Schema01Boxed
+permits
+[Schema01BoxedString](#schema01boxedstring) + +sealed interface that stores validated payloads using boxed classes + +## Schema01BoxedString +public record Schema01BoxedString
+implements [Schema01Boxed](#schema01boxed) + +record that stores validated String payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| Schema01BoxedString(String data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| String | data()
validated payload | +| @Nullable Object | getData()
validated payload | + +## Schema01 +public static class Schema01
+extends StringJsonSchema.StringJsonSchema1 + +A schema class that validates payloads + +| Methods Inherited from class org.openapijsonschematools.client.schemas.StringJsonSchema.StringJsonSchema1 | +| ------------------------------------------------------------------ | +| validate | +| validateAndBox | diff --git a/samples/client/petstore/kotlin/docs/paths/fakedeletecoffeeid/delete/responses/FakedeletecoffeeidDeleteCode200Response.md b/samples/client/petstore/kotlin/docs/paths/fakedeletecoffeeid/delete/responses/FakedeletecoffeeidDeleteCode200Response.md new file mode 100644 index 00000000000..6c115aadfcf --- /dev/null +++ b/samples/client/petstore/kotlin/docs/paths/fakedeletecoffeeid/delete/responses/FakedeletecoffeeidDeleteCode200Response.md @@ -0,0 +1,17 @@ +# FakedeletecoffeeidDeleteCode200Response + +public class FakedeletecoffeeidDeleteCode200Response extends [SuccessDescriptionOnly](../../components/responses/SuccessDescriptionOnly.md) + +A class (extended from the $ref class) that contains necessary nested response classes +- a class that extends ResponseDeserializer and is used to deserialize responses + +## Nested Class Summary +| Modifier and Type | Class and Description | +| ----------------- | --------------------- | +| static class | [FakedeletecoffeeidDeleteCode200Response.FakedeletecoffeeidDeleteCode200Response1](#fakedeletecoffeeiddeletecode200response1)
class that deserializes responses | + +## FakedeletecoffeeidDeleteCode200Response1 +public static class FakedeletecoffeeidDeleteCode200Response1 extends [SuccessDescriptionOnly1](../../components/responses/SuccessDescriptionOnly.md#successdescriptiononly1)
+ +a class that deserializes responses, extended from the $ref class + diff --git a/samples/client/petstore/kotlin/docs/paths/fakedeletecoffeeid/delete/responses/FakedeletecoffeeidDeleteCodedefaultResponse.md b/samples/client/petstore/kotlin/docs/paths/fakedeletecoffeeid/delete/responses/FakedeletecoffeeidDeleteCodedefaultResponse.md new file mode 100644 index 00000000000..2b26c4cf967 --- /dev/null +++ b/samples/client/petstore/kotlin/docs/paths/fakedeletecoffeeid/delete/responses/FakedeletecoffeeidDeleteCodedefaultResponse.md @@ -0,0 +1,32 @@ +# FakedeletecoffeeidDeleteCodedefaultResponse + +public class FakedeletecoffeeidDeleteCodedefaultResponse + +A class that contains necessary nested response classes +- a class that extends ResponseDeserializer and is used to deserialize responses + +## Nested Class Summary +| Modifier and Type | Class and Description | +| ----------------- | --------------------- | +| static class | [FakedeletecoffeeidDeleteCodedefaultResponse.FakedeletecoffeeidDeleteCodedefaultResponse1](#fakedeletecoffeeiddeletecodedefaultresponse1)
class that deserializes responses | + +## FakedeletecoffeeidDeleteCodedefaultResponse1 +public static class FakedeletecoffeeidDeleteCodedefaultResponse1
+extends ResponseDeserializer + +a class that deserializes responses + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| FakedeletecoffeeidDeleteCodedefaultResponse1()
Creates an instance | + +### Field Summary +| Modifier and Type | Field and Description | +| ----------------- | --------------------- | +| Map | content = MapUtils.makeMap(
)
the contentType to schema info | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| ApiResponse | deserialize(HttpResponse response, SchemaConfiguration configuration)
called by endpoint when deserialize responses | diff --git a/samples/client/petstore/kotlin/docs/paths/fakehealth/FakehealthGet.md b/samples/client/petstore/kotlin/docs/paths/fakehealth/FakehealthGet.md new file mode 100644 index 00000000000..d6b572bc19f --- /dev/null +++ b/samples/client/petstore/kotlin/docs/paths/fakehealth/FakehealthGet.md @@ -0,0 +1,144 @@ +# FakehealthGet + +public class FakehealthGet + +A class that contains necessary endpoint classes +- a class that calls the endpoint method using the http verb +- a class that calls the endpoint method using the operationId name +- class(es) to store the request inputs +- builder(s) to set the request input data + +## Nested Class Summary +| Modifier and Type | Class and Description | +| ----------------- | --------------------- | +| static class | [Get](#get)
The class that has a get method to call the endpoint | +| interface | [FakeHealthGetOperation](#fakehealthgetoperation)
The interface that has a fakeHealthGet method to call the endpoint | +| static class | [GetRequest](#getrequest)
The request inputs class | +| static class | [GetRequestBuilder](#getrequestbuilder)
A builder for the request input class | + +## Get +public static class Get extends ApiClient.ApiClient1 implements GetOperation
+ +a class that allows one to call the endpoint using a method named get + +### 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.servers.RootServer0; +import org.openapijsonschematools.client.servers.RootServer1; +import org.openapijsonschematools.client.servers.RootServer2; +import org.openapijsonschematools.client.paths.fakehealth.get.responses.FakehealthGetCode200Response; +import org.openapijsonschematools.client.servers.RootServerInfo; +import org.openapijsonschematools.client.paths.fakehealth.FakehealthGet; +import org.openapijsonschematools.client.paths.fakehealth.get.FakehealthGetResponses; + +import java.io.IOException; +import java.util.Arrays; +import java.util.List; +import java.util.Map; +import java.util.AbstractMap; + +// if you want to use a server that is not SERVER_0 pass it in here and change the ServerIndex input below +ApiConfiguration.ServerInfo serverInfo = new ApiConfiguration.ServerInfoBuilder() + .rootServerInfo( + new RootServerInfo.RootServerInfoBuilder() + .rootServer0(new RootServer0()) + .build() + ) + .build(); +ApiConfiguration.ServerIndexInfo serverIndexInfo = new ApiConfiguration.ServerIndexInfoBuilder() + .rootServerInfoServerIndex(RootServerInfo.ServerIndex.SERVER_0) + .build(); +Duration timeout = Duration.ofSeconds(1L); +Map> defaultHeaders = Map.of("User-Agent", List.of("OpenAPI-JSON-Schema-Generator/1.0.0/java")); +ApiConfiguration apiConfiguration = new ApiConfiguration( + serverInfo + serverIndexInfo, + timeout, + defaultHeaders +); +SchemaConfiguration schemaConfiguration = new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().build()); +FakehealthGet.Get apiClient = new FakehealthGet.Get(apiConfiguration, schemaConfiguration); + + +var request = new FakehealthGet.GetRequestBuilder().build(); + +FakehealthGetResponses.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; +} +FakehealthGetResponses.EndpointFakehealthGetCode200Response castResponse = (FakehealthGetResponses.EndpointFakehealthGetCode200Response) response; +FakehealthGetCode200Response.ApplicationjsonResponseBody deserializedBody = (FakehealthGetCode200Response.ApplicationjsonResponseBody) castResponse.body; +// handle deserialized body here +``` +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| Get(ApiConfiguration apiConfiguration, SchemaConfiguration schemaConfiguration)
Creates an instance | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| [FakehealthGetResponses.EndpointResponse](../../paths/fakehealth/get/FakehealthGetResponses.md#endpointresponse) | get([GetRequest](#getrequest) request) | + +## FakeHealthGetOperation +public interface FakeHealthGetOperation
+ +an interface that allows one to call the endpoint using a method named fakeHealthGet by the operationId + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| [FakehealthGetResponses.EndpointResponse](../../paths/fakehealth/get/FakehealthGetResponses.md#endpointresponse) | fakeHealthGet([GetRequest](#getrequest) request) | + +## GetRequest +public static class GetRequest
+ +a class that stores the final request inputs + +### Field Summary +| Modifier and Type | Field and Description | +| ----------------- | --------------------- | +| [RootServerInfo.@Nullable ServerIndex](../../RootServerInfo.md#serverindex) | serverIndex
optional. Note: this will override the value in apiConfiguration | +| @Nullable Duration | timeout
optional. Note: this will override the value in apiConfiguration | + +## GetRequestBuilder +public static class GetRequestBuilder
+ +a builder for request inputs + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| GetRequestBuilder()
Creates a builder that contains null for all parameters | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| [GetRequest](#getrequest) | build()
Returns the request input used to call an endpoint method | +| [GetRequestBuilder](#getrequestbuilder) | serverIndex([RootServerInfo.ServerIndex](../../RootServerInfo.md#serverindex) serverIndex)
sets the optional property. Note: this will override the value in apiConfiguration | +| [GetRequestBuilder](#getrequestbuilder) | timeout(Duration timeout)
sets the optional property. Note: this will override the value in apiConfiguration | + +[[Back to top]](#top) [[Back to README]](../../../README.md) diff --git a/samples/client/petstore/kotlin/docs/paths/fakehealth/get/FakehealthGetResponses.md b/samples/client/petstore/kotlin/docs/paths/fakehealth/get/FakehealthGetResponses.md new file mode 100644 index 00000000000..14cf426c478 --- /dev/null +++ b/samples/client/petstore/kotlin/docs/paths/fakehealth/get/FakehealthGetResponses.md @@ -0,0 +1,29 @@ +# FakehealthGetResponses + +public class FakehealthGetResponses + +A class that contains necessary responses classes +- a sealed interface, EndpointResponse, that stores endpoint responses +- records for each endpoint response + +## Nested Class Summary +| Modifier and Type | Class and Description | +| ----------------- | --------------------- | +| sealed interface | [EndpointResponse](#endpointresponse)
stores the endpoint responses | +| record | [EndpointFakehealthGetCode200Response](#endpointfakehealthgetcode200response)
the response for 200 | + +## EndpointResponse +public sealed interface EndpointResponse permits
+[EndpointFakehealthGetCode200Response](#endpointfakehealthgetcode200response) + +a sealed interface that stores endpoint responses + +## EndpointFakehealthGetCode200Response +public record EndpointFakehealthGetCode200Response( + HttpResponse response, + [FakehealthGetCode200Response.SealedResponseBody](../../../paths/fakehealth/get/responses/FakehealthGetCode200Response.md#sealedresponsebody) body, + Nothing? headers +) implements EndpointResponse, ApiResponse
+ +a class that stores an endpoint response + diff --git a/samples/client/petstore/kotlin/docs/paths/fakehealth/get/responses/FakehealthGetCode200Response.md b/samples/client/petstore/kotlin/docs/paths/fakehealth/get/responses/FakehealthGetCode200Response.md new file mode 100644 index 00000000000..8157b3f5f0b --- /dev/null +++ b/samples/client/petstore/kotlin/docs/paths/fakehealth/get/responses/FakehealthGetCode200Response.md @@ -0,0 +1,87 @@ +# FakehealthGetCode200Response + +public class FakehealthGetCode200Response + +A class that contains necessary nested response classes +- SealedMediaType, a sealed interface which contains all the schema/encoding info for each contentType +- records which implement SealedMediaType, the concrete media types +- SealedResponseBody, a sealed interface which contains all the contentType/schema types +- records which implement SealedResponseBody, the concrete response body types +- a class that extends ResponseDeserializer and is used to deserialize responses + +## Nested Class Summary +| Modifier and Type | Class and Description | +| ----------------- | --------------------- | +| sealed interface | [FakehealthGetCode200Response.SealedMediaType](#sealedmediatype)
media type sealed interface | +| record | [FakehealthGetCode200Response.ApplicationjsonMediaType](#applicationjsonmediatype)
record storing schema + encoding for a specific contentType | +| sealed interface | [FakehealthGetCode200Response.SealedResponseBody](#sealedresponsebody)
response body sealed interface | +| record | [FakehealthGetCode200Response.ApplicationjsonResponseBody](#applicationjsonresponsebody)
implements sealed interface to store response body | +| static class | [FakehealthGetCode200Response.FakehealthGetCode200Response1](#fakehealthgetcode200response1)
class that deserializes responses | + +## SealedMediaType +public sealed interface SealedMediaType
+permits
+[ApplicationjsonMediaType](#applicationjsonmediatype) + +sealed interface that stores schema and encoding info + +## ApplicationjsonMediaType +public record ApplicationjsonMediaType
+implements [SealedMediaType](#sealedmediatype), MediaType<[ApplicationjsonSchema.ApplicationjsonSchema1](../../../../paths/fakehealth/get/responses/code200response/content/applicationjson/ApplicationjsonSchema.md#applicationjsonschema1), Nothing?> + +class storing schema info for a specific contentType + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| ApplicationjsonMediaType()
Creates an instance | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| [ApplicationjsonSchema.ApplicationjsonSchema1](../../../../paths/fakehealth/get/responses/code200response/content/applicationjson/ApplicationjsonSchema.md#applicationjsonschema1) | schema()
the schema for this MediaType | +| Nothing? | encoding()
the encoding info | + +## SealedResponseBody +public sealed interface SealedResponseBody
+permits
+[ApplicationjsonResponseBody](#applicationjsonresponsebody) + +sealed interface that stores response body + +## ApplicationjsonResponseBody +public record ApplicationjsonResponseBody
+implements [SealedResponseBody](#sealedresponsebody) + +A record class to store response body for contentType="application/json" + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| ApplicationjsonResponseBody(ApplicationjsonSchema.[HealthCheckResult1Boxed](../../../../components/schemas/HealthCheckResult.md#healthcheckresult1boxed) body)
Creates an instance | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| ApplicationjsonSchema.[HealthCheckResult1Boxed](../../../../components/schemas/HealthCheckResult.md#healthcheckresult1boxed) | body()
returns the body passed in in the constructor | + +## FakehealthGetCode200Response1 +public static class FakehealthGetCode200Response1
+extends ResponseDeserializer<[SealedResponseBody](#sealedresponsebody), Nothing?, [SealedMediaType](#sealedmediatype)> + +a class that deserializes responses + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| FakehealthGetCode200Response1()
Creates an instance | + +### Field Summary +| Modifier and Type | Field and Description | +| ----------------- | --------------------- | +| 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 | +| ----------------- | ---------------------- | +| ApiResponse<[SealedResponseBody](#sealedresponsebody), Nothing?> | deserialize(HttpResponse response, SchemaConfiguration configuration)
called by endpoint when deserialize responses | diff --git a/samples/client/petstore/kotlin/docs/paths/fakehealth/get/responses/code200response/content/applicationjson/ApplicationjsonSchema.md b/samples/client/petstore/kotlin/docs/paths/fakehealth/get/responses/code200response/content/applicationjson/ApplicationjsonSchema.md new file mode 100644 index 00000000000..4b80f3aefdb --- /dev/null +++ b/samples/client/petstore/kotlin/docs/paths/fakehealth/get/responses/code200response/content/applicationjson/ApplicationjsonSchema.md @@ -0,0 +1,19 @@ +# ApplicationjsonSchema +public class ApplicationjsonSchema
+extends [HealthCheckResult1](../../../../../../../components/schemas/HealthCheckResult.md#healthcheckresult) + +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 + +## Nested Class Summary +| Modifier and Type | Class and Description | +| ----------------- | ---------------------- | +| static class | [ApplicationjsonSchema.ApplicationjsonSchema1](#applicationjsonschema1)
schema class | + +## ApplicationjsonSchema1 +public static class ApplicationjsonSchema1
+extends [HealthCheckResult.HealthCheckResult1](../../../../../../../components/schemas/HealthCheckResult.md#healthcheckresult1) + +A schema class that validates payloads diff --git a/samples/client/petstore/kotlin/docs/paths/fakeinlineadditionalproperties/FakeinlineadditionalpropertiesPost.md b/samples/client/petstore/kotlin/docs/paths/fakeinlineadditionalproperties/FakeinlineadditionalpropertiesPost.md new file mode 100644 index 00000000000..ea4e8d93b7e --- /dev/null +++ b/samples/client/petstore/kotlin/docs/paths/fakeinlineadditionalproperties/FakeinlineadditionalpropertiesPost.md @@ -0,0 +1,186 @@ +# FakeinlineadditionalpropertiesPost + +public class FakeinlineadditionalpropertiesPost + +A class that contains necessary endpoint classes +- a class that calls the endpoint method using the http verb +- a class that calls the endpoint method using the operationId name +- class(es) to store the request inputs +- builder(s) to set the request input data + +## Nested Class Summary +| Modifier and Type | Class and Description | +| ----------------- | --------------------- | +| static class | [Post](#post)
The class that has a post method to call the endpoint | +| interface | [InlineAdditionalPropertiesOperation](#inlineadditionalpropertiesoperation)
The interface that has a inlineAdditionalProperties method to call the endpoint | +| static class | [PostRequest](#postrequest)
The final request inputs class | +| static class | [PostNullableRequest](#postnullablerequest)
The initial request inputs class | +| static class | [Post0RequestBuilder](#post0requestbuilder)
A builder for the request input class | +| static class | [PostRequestBuilder](#postrequestbuilder)
A builder for the request input class | + +## Post +public static class Post 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.fakeinlineadditionalproperties.post.FakeinlineadditionalpropertiesPostRequestBody; +import org.openapijsonschematools.client.paths.fakeinlineadditionalproperties.post.requestbody.content.applicationjson.ApplicationjsonSchema; +import org.openapijsonschematools.client.servers.RootServer0; +import org.openapijsonschematools.client.servers.RootServer1; +import org.openapijsonschematools.client.servers.RootServer2; +import org.openapijsonschematools.client.paths.fakeinlineadditionalproperties.post.responses.FakeinlineadditionalpropertiesPostCode200Response; +import org.openapijsonschematools.client.servers.RootServerInfo; +import org.openapijsonschematools.client.paths.fakeinlineadditionalproperties.FakeinlineadditionalpropertiesPost; +import org.openapijsonschematools.client.paths.fakeinlineadditionalproperties.post.FakeinlineadditionalpropertiesPostResponses; + +import java.io.IOException; +import java.util.Arrays; +import java.util.List; +import java.util.Map; +import java.util.AbstractMap; + +// if you want to use a server that is not SERVER_0 pass it in here and change the ServerIndex input below +ApiConfiguration.ServerInfo serverInfo = new ApiConfiguration.ServerInfoBuilder() + .rootServerInfo( + new RootServerInfo.RootServerInfoBuilder() + .rootServer0(new RootServer0()) + .build() + ) + .build(); +ApiConfiguration.ServerIndexInfo serverIndexInfo = new ApiConfiguration.ServerIndexInfoBuilder() + .rootServerInfoServerIndex(RootServerInfo.ServerIndex.SERVER_0) + .build(); +Duration timeout = Duration.ofSeconds(1L); +Map> defaultHeaders = Map.of("User-Agent", List.of("OpenAPI-JSON-Schema-Generator/1.0.0/java")); +ApiConfiguration apiConfiguration = new ApiConfiguration( + serverInfo + serverIndexInfo, + timeout, + defaultHeaders +); +SchemaConfiguration schemaConfiguration = new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().build()); +FakeinlineadditionalpropertiesPost.Post apiClient = new FakeinlineadditionalpropertiesPost.Post(apiConfiguration, schemaConfiguration); + + +ApplicationjsonSchema1BoxedMap requestBodyPayload = + ApplicationjsonSchema.ApplicationjsonSchema1.validateAndBox( + new ApplicationjsonSchema.ApplicationjsonSchemaMapBuilder() + .additionalProperty("someAdditionalProperty", "a") + + .build(), + schemaConfiguration +); +FakeinlineadditionalpropertiesPost.SealedRequestBody requestBody = new FakeinlineadditionalpropertiesPost.ApplicationjsonRequestBody(requestBodyPayload); + +var request = new FakeinlineadditionalpropertiesPost.PostRequestBuilder() + .requestBody(requestBody) + .build(); + +FakeinlineadditionalpropertiesPostResponses.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; +} +FakeinlineadditionalpropertiesPostResponses.EndpointFakeinlineadditionalpropertiesPostCode200Response castResponse = (FakeinlineadditionalpropertiesPostResponses.EndpointFakeinlineadditionalpropertiesPostCode200Response) response; +``` +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| Post(ApiConfiguration apiConfiguration, SchemaConfiguration schemaConfiguration)
Creates an instance | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| [FakeinlineadditionalpropertiesPostResponses.EndpointResponse](../../paths/fakeinlineadditionalproperties/post/FakeinlineadditionalpropertiesPostResponses.md#endpointresponse) | post([PostRequest](#postrequest) request) | + +## InlineAdditionalPropertiesOperation +public interface InlineAdditionalPropertiesOperation
+ +an interface that allows one to call the endpoint using a method named inlineAdditionalProperties by the operationId + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| [FakeinlineadditionalpropertiesPostResponses.EndpointResponse](../../paths/fakeinlineadditionalproperties/post/FakeinlineadditionalpropertiesPostResponses.md#endpointresponse) | inlineAdditionalProperties([PostRequest](#postrequest) request) | + +## PostRequest +public static class PostRequest
+ +a class that stores the final request inputs + +### Field Summary +| Modifier and Type | Field and Description | +| ----------------- | --------------------- | +| [FakeinlineadditionalpropertiesPostRequestBody.SealedRequestBody](../../paths/fakeinlineadditionalproperties/post/FakeinlineadditionalpropertiesPostRequestBody.md#sealedrequestbody) | requestBody | +| [RootServerInfo.@Nullable ServerIndex](../../RootServerInfo.md#serverindex) | serverIndex
optional. Note: this will override the value in apiConfiguration | +| @Nullable Duration | timeout
optional. Note: this will override the value in apiConfiguration | + +## PostNullableRequest +public static class PostNullableRequest
+ +a class that stores the initial request inputs + +### Field Summary +| Modifier and Type | Field and Description | +| ----------------- | --------------------- | +| [FakeinlineadditionalpropertiesPostRequestBody.@Nullable SealedRequestBody](../../paths/fakeinlineadditionalproperties/post/FakeinlineadditionalpropertiesPostRequestBody.md#sealedrequestbody) | requestBody | +| [RootServerInfo.@Nullable ServerIndex](../../RootServerInfo.md#serverindex) | serverIndex | +| @Nullable Duration | timeout | + +## Post0RequestBuilder +public static class Post0RequestBuilder
+ +a builder for request inputs + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| Post0RequestBuilder(Post0RequestBuilder instance)
Creates a builder that contains the passed instance | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| [PostRequest](#postrequest) | build()
Returns the request input used to call an endpoint method | +| [Post0RequestBuilder](#post0requestbuilder) | serverIndex([RootServerInfo.ServerIndex](../../RootServerInfo.md#serverindex) serverIndex)
sets the optional property. Note: this will override the value in apiConfiguration | +| [Post0RequestBuilder](#post0requestbuilder) | timeout(Duration timeout)
sets the optional property. Note: this will override the value in apiConfiguration | + +## PostRequestBuilder +public static class PostRequestBuilder
+ +a builder for request inputs + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| PostRequestBuilder()
Creates a builder that contains null for all parameters | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| [Post0RequestBuilder](#post0requestbuilder) | requestBody([FakeinlineadditionalpropertiesPostRequestBody.SealedRequestBody](../../paths/fakeinlineadditionalproperties/post/FakeinlineadditionalpropertiesPostRequestBody.md#sealedrequestbody) requestBody)
sets the property | + +[[Back to top]](#top) [[Back to README]](../../../README.md) diff --git a/samples/client/petstore/kotlin/docs/paths/fakeinlineadditionalproperties/post/FakeinlineadditionalpropertiesPostRequestBody.md b/samples/client/petstore/kotlin/docs/paths/fakeinlineadditionalproperties/post/FakeinlineadditionalpropertiesPostRequestBody.md new file mode 100644 index 00000000000..cead4807700 --- /dev/null +++ b/samples/client/petstore/kotlin/docs/paths/fakeinlineadditionalproperties/post/FakeinlineadditionalpropertiesPostRequestBody.md @@ -0,0 +1,90 @@ +# FakeinlineadditionalpropertiesPostRequestBody + +public class FakeinlineadditionalpropertiesPostRequestBody + +A class that contains necessary nested request body classes +- SealedMediaType, a sealed interface which contains all the schema/encoding info for each contentType +- records which implement SealedMediaType, the concrete media types +- a class that extends RequestBodySerializer and is used to serialize input SealedRequestBody instances +- SealedRequestBody, a sealed interface which contains all the contentType/schema input types +- records which implement SealedRequestBody, the concrete request body types + +## Nested Class Summary +| Modifier and Type | Class and Description | +| ----------------- | --------------------- | +| sealed interface | [FakeinlineadditionalpropertiesPostRequestBody.SealedMediaType](#sealedmediatype)
media type sealed interface | +| record | [FakeinlineadditionalpropertiesPostRequestBody.ApplicationjsonMediaType](#applicationjsonmediatype)
record storing schema + encoding for a specific contentType | +| static class | [FakeinlineadditionalpropertiesPostRequestBody.FakeinlineadditionalpropertiesPostRequestBody1](#fakeinlineadditionalpropertiespostrequestbody1)
class that serializes request bodies | +| sealed interface | [FakeinlineadditionalpropertiesPostRequestBody.SealedRequestBody](#sealedrequestbody)
request body sealed interface | +| record | [FakeinlineadditionalpropertiesPostRequestBody.ApplicationjsonRequestBody](#applicationjsonrequestbody)
implements sealed interface to store request body input | + +## SealedMediaType +public sealed interface SealedMediaType
+permits
+[ApplicationjsonMediaType](#applicationjsonmediatype) + +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), Nothing?> + +class storing schema info for a specific contentType + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| ApplicationjsonMediaType()
Creates an instance | + +### 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 | +| Nothing? | encoding()
the encoding info | + +## FakeinlineadditionalpropertiesPostRequestBody1 +public static class FakeinlineadditionalpropertiesPostRequestBody1
+ +a class that serializes SealedRequestBody request bodies + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| FakeinlineadditionalpropertiesPostRequestBody1()
Creates an instance | + +### Field Summary +| Modifier and Type | Field and Description | +| ----------------- | --------------------- | +| boolean | required = true
whether the request body is required | +| 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 | +| ----------------- | ---------------------- | +| SerializedRequestBody | serialize([SealedRequestBody](#sealedrequestbody) requestBody)
called by endpoint when creating request body bytes | + +## SealedRequestBody +public sealed interface SealedRequestBody
+permits
+[ApplicationjsonRequestBody](#applicationjsonrequestbody) + +sealed interface that stores request contentType + validated schema data + +## ApplicationjsonRequestBody +public record ApplicationjsonRequestBody
+implements [SealedRequestBody](#sealedrequestbody),
+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 | + +### 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 | diff --git a/samples/client/petstore/kotlin/docs/paths/fakeinlineadditionalproperties/post/FakeinlineadditionalpropertiesPostResponses.md b/samples/client/petstore/kotlin/docs/paths/fakeinlineadditionalproperties/post/FakeinlineadditionalpropertiesPostResponses.md new file mode 100644 index 00000000000..7a9ad96cdf4 --- /dev/null +++ b/samples/client/petstore/kotlin/docs/paths/fakeinlineadditionalproperties/post/FakeinlineadditionalpropertiesPostResponses.md @@ -0,0 +1,29 @@ +# FakeinlineadditionalpropertiesPostResponses + +public class FakeinlineadditionalpropertiesPostResponses + +A class that contains necessary responses classes +- a sealed interface, EndpointResponse, that stores endpoint responses +- records for each endpoint response + +## Nested Class Summary +| Modifier and Type | Class and Description | +| ----------------- | --------------------- | +| sealed interface | [EndpointResponse](#endpointresponse)
stores the endpoint responses | +| record | [EndpointFakeinlineadditionalpropertiesPostCode200Response](#endpointfakeinlineadditionalpropertiespostcode200response)
the response for 200 | + +## EndpointResponse +public sealed interface EndpointResponse permits
+[EndpointFakeinlineadditionalpropertiesPostCode200Response](#endpointfakeinlineadditionalpropertiespostcode200response) + +a sealed interface that stores endpoint responses + +## EndpointFakeinlineadditionalpropertiesPostCode200Response +public record EndpointFakeinlineadditionalpropertiesPostCode200Response( + HttpResponse response, + Nothing? body, + Nothing? headers +) implements EndpointResponse, ApiResponse
+ +a class that stores an endpoint response + diff --git a/samples/client/petstore/kotlin/docs/paths/fakeinlineadditionalproperties/post/requestbody/content/applicationjson/ApplicationjsonSchema.md b/samples/client/petstore/kotlin/docs/paths/fakeinlineadditionalproperties/post/requestbody/content/applicationjson/ApplicationjsonSchema.md new file mode 100644 index 00000000000..99e2db386dc --- /dev/null +++ b/samples/client/petstore/kotlin/docs/paths/fakeinlineadditionalproperties/post/requestbody/content/applicationjson/ApplicationjsonSchema.md @@ -0,0 +1,156 @@ +# ApplicationjsonSchema +public class ApplicationjsonSchema
+ +A class that contains necessary nested +- schema classes (which validate payloads), extends JsonSchema +- sealed interfaces which store validated payloads, java version of a sum type +- boxed classes which store validated payloads, sealed permits class implementations +- classes to store validated map payloads, extends FrozenMap +- classes to build inputs for map payloads + +## Nested Class Summary +| Modifier and Type | Class and Description | +| ----------------- | ---------------------- | +| sealed interface | [ApplicationjsonSchema.ApplicationjsonSchema1Boxed](#applicationjsonschema1boxed)
sealed interface for validated payloads | +| record | [ApplicationjsonSchema.ApplicationjsonSchema1BoxedMap](#applicationjsonschema1boxedmap)
boxed class to store validated Map payloads | +| static class | [ApplicationjsonSchema.ApplicationjsonSchema1](#applicationjsonschema1)
schema class | +| static class | [ApplicationjsonSchema.ApplicationjsonSchemaMapBuilder](#applicationjsonschemamapbuilder)
builder for Map payloads | +| static class | [ApplicationjsonSchema.ApplicationjsonSchemaMap](#applicationjsonschemamap)
output class for Map payloads | +| sealed interface | [ApplicationjsonSchema.ApplicationjsonAdditionalPropertiesBoxed](#applicationjsonadditionalpropertiesboxed)
sealed interface for validated payloads | +| record | [ApplicationjsonSchema.ApplicationjsonAdditionalPropertiesBoxedString](#applicationjsonadditionalpropertiesboxedstring)
boxed class to store validated String payloads | +| static class | [ApplicationjsonSchema.ApplicationjsonAdditionalProperties](#applicationjsonadditionalproperties)
schema class | + +## ApplicationjsonSchema1Boxed +public sealed interface ApplicationjsonSchema1Boxed
+permits
+[ApplicationjsonSchema1BoxedMap](#applicationjsonschema1boxedmap) + +sealed interface that stores validated payloads using boxed classes + +## ApplicationjsonSchema1BoxedMap +public record ApplicationjsonSchema1BoxedMap
+implements [ApplicationjsonSchema1Boxed](#applicationjsonschema1boxed) + +record that stores validated Map payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| ApplicationjsonSchema1BoxedMap([ApplicationjsonSchemaMap](#applicationjsonschemamap) data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| [ApplicationjsonSchemaMap](#applicationjsonschemamap) | data()
validated payload | +| @Nullable Object | getData()
validated payload | + +## ApplicationjsonSchema1 +public static class ApplicationjsonSchema1
+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.fakeinlineadditionalproperties.post.requestbody.content.applicationjson.ApplicationjsonSchema; + +import java.util.Arrays; +import java.util.List; +import java.util.AbstractMap; + +static final SchemaConfiguration configuration = new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().build()); + +// Map validation +ApplicationjsonSchema.ApplicationjsonSchemaMap validatedPayload = + ApplicationjsonSchema.ApplicationjsonSchema1.validate( + new ApplicationjsonSchema.ApplicationjsonSchemaMapBuilder() + .additionalProperty("someAdditionalProperty", "a") + + .build(), + configuration +); +``` + +### Field Summary +| Modifier and Type | Field and Description | +| ----------------- | ---------------------- | +| Set> | type = Set.of(Map.class) | +| Class | additionalProperties = [ApplicationjsonAdditionalProperties.class](#applicationjsonadditionalproperties) | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| [ApplicationjsonSchemaMap](#applicationjsonschemamap) | validate([Map<?, ?>](#applicationjsonschemamapbuilder) arg, SchemaConfiguration configuration) | +| [ApplicationjsonSchema1BoxedMap](#applicationjsonschema1boxedmap) | validateAndBox([Map<?, ?>](#applicationjsonschemamapbuilder) arg, SchemaConfiguration configuration) | +| [ApplicationjsonSchema1Boxed](#applicationjsonschema1boxed) | validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) | +| @Nullable Object | validate(@Nullable Object arg, SchemaConfiguration configuration) | + +## ApplicationjsonSchemaMapBuilder +public class ApplicationjsonSchemaMapBuilder
+builder for `Map` + +A class that builds the Map input type + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| ApplicationjsonSchemaMapBuilder()
Creates a builder that contains an empty map | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| Map | build()
Returns map input that should be used with Schema.validate | +| [ApplicationjsonSchemaMapBuilder](#applicationjsonschemamapbuilder) | additionalProperty(String key, String value) | + +## ApplicationjsonSchemaMap +public static class ApplicationjsonSchemaMap
+extends FrozenMap + +A class to store validated Map payloads + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| static [ApplicationjsonSchemaMap](#applicationjsonschemamap) | of([Map](#applicationjsonschemamapbuilder) arg, SchemaConfiguration configuration) | +| String | getAdditionalProperty(String name)
provides type safety for additional properties | + +## ApplicationjsonAdditionalPropertiesBoxed +public sealed interface ApplicationjsonAdditionalPropertiesBoxed
+permits
+[ApplicationjsonAdditionalPropertiesBoxedString](#applicationjsonadditionalpropertiesboxedstring) + +sealed interface that stores validated payloads using boxed classes + +## ApplicationjsonAdditionalPropertiesBoxedString +public record ApplicationjsonAdditionalPropertiesBoxedString
+implements [ApplicationjsonAdditionalPropertiesBoxed](#applicationjsonadditionalpropertiesboxed) + +record that stores validated String payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| ApplicationjsonAdditionalPropertiesBoxedString(String data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| String | data()
validated payload | +| @Nullable Object | getData()
validated payload | + +## ApplicationjsonAdditionalProperties +public static class ApplicationjsonAdditionalProperties
+extends StringJsonSchema.StringJsonSchema1 + +A schema class that validates payloads + +| Methods Inherited from class org.openapijsonschematools.client.schemas.StringJsonSchema.StringJsonSchema1 | +| ------------------------------------------------------------------ | +| validate | +| validateAndBox | diff --git a/samples/client/petstore/kotlin/docs/paths/fakeinlineadditionalproperties/post/responses/FakeinlineadditionalpropertiesPostCode200Response.md b/samples/client/petstore/kotlin/docs/paths/fakeinlineadditionalproperties/post/responses/FakeinlineadditionalpropertiesPostCode200Response.md new file mode 100644 index 00000000000..2c23bf79f3b --- /dev/null +++ b/samples/client/petstore/kotlin/docs/paths/fakeinlineadditionalproperties/post/responses/FakeinlineadditionalpropertiesPostCode200Response.md @@ -0,0 +1,17 @@ +# FakeinlineadditionalpropertiesPostCode200Response + +public class FakeinlineadditionalpropertiesPostCode200Response extends [SuccessDescriptionOnly](../../components/responses/SuccessDescriptionOnly.md) + +A class (extended from the $ref class) that contains necessary nested response classes +- a class that extends ResponseDeserializer and is used to deserialize responses + +## Nested Class Summary +| Modifier and Type | Class and Description | +| ----------------- | --------------------- | +| static class | [FakeinlineadditionalpropertiesPostCode200Response.FakeinlineadditionalpropertiesPostCode200Response1](#fakeinlineadditionalpropertiespostcode200response1)
class that deserializes responses | + +## FakeinlineadditionalpropertiesPostCode200Response1 +public static class FakeinlineadditionalpropertiesPostCode200Response1 extends [SuccessDescriptionOnly1](../../components/responses/SuccessDescriptionOnly.md#successdescriptiononly1)
+ +a class that deserializes responses, extended from the $ref class + diff --git a/samples/client/petstore/kotlin/docs/paths/fakeinlinecomposition/FakeinlinecompositionPost.md b/samples/client/petstore/kotlin/docs/paths/fakeinlinecomposition/FakeinlinecompositionPost.md new file mode 100644 index 00000000000..8a6f721e5cd --- /dev/null +++ b/samples/client/petstore/kotlin/docs/paths/fakeinlinecomposition/FakeinlinecompositionPost.md @@ -0,0 +1,155 @@ +# FakeinlinecompositionPost + +public class FakeinlinecompositionPost + +A class that contains necessary endpoint classes +- a class that calls the endpoint method using the http verb +- a class that calls the endpoint method using the operationId name +- class(es) to store the request inputs +- builder(s) to set the request input data + +## Nested Class Summary +| Modifier and Type | Class and Description | +| ----------------- | --------------------- | +| static class | [Post](#post)
The class that has a post method to call the endpoint | +| interface | [InlineCompositionOperation](#inlinecompositionoperation)
The interface that has a inlineComposition method to call the endpoint | +| static class | [PostRequest](#postrequest)
The request inputs class | +| static class | [PostRequestBuilder](#postrequestbuilder)
A builder for the request input class | + +## Post +public static class Post 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.FakeinlinecompositionPostRequestBody; +import org.openapijsonschematools.client.paths.fakeinlinecomposition.post.requestbody.content.applicationjson.ApplicationjsonSchema; +import org.openapijsonschematools.client.paths.fakeinlinecomposition.post.FakeinlinecompositionPostQueryParameters; +import org.openapijsonschematools.client.RootServerInfo; +import org.openapijsonschematools.client.servers.RootServer0; +import org.openapijsonschematools.client.servers.RootServer1; +import org.openapijsonschematools.client.servers.RootServer2; +import org.openapijsonschematools.client.paths.fakeinlinecomposition.post.responses.FakeinlinecompositionPostCode200Response; +import org.openapijsonschematools.client.servers.RootServerInfo; +import org.openapijsonschematools.client.paths.fakeinlinecomposition.FakeinlinecompositionPost; +import org.openapijsonschematools.client.paths.fakeinlinecomposition.post.FakeinlinecompositionPostResponses; + +import java.io.IOException; +import java.util.Arrays; +import java.util.List; +import java.util.Map; +import java.util.AbstractMap; + +// if you want to use a server that is not SERVER_0 pass it in here and change the ServerIndex input below +ApiConfiguration.ServerInfo serverInfo = new ApiConfiguration.ServerInfoBuilder() + .rootServerInfo( + new RootServerInfo.RootServerInfoBuilder() + .rootServer0(new RootServer0()) + .build() + ) + .build(); +ApiConfiguration.ServerIndexInfo serverIndexInfo = new ApiConfiguration.ServerIndexInfoBuilder() + .rootServerInfoServerIndex(RootServerInfo.ServerIndex.SERVER_0) + .build(); +Duration timeout = Duration.ofSeconds(1L); +Map> defaultHeaders = Map.of("User-Agent", List.of("OpenAPI-JSON-Schema-Generator/1.0.0/java")); +ApiConfiguration apiConfiguration = new ApiConfiguration( + serverInfo + serverIndexInfo, + timeout, + defaultHeaders +); +SchemaConfiguration schemaConfiguration = new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().build()); +FakeinlinecompositionPost.Post apiClient = new FakeinlinecompositionPost.Post(apiConfiguration, schemaConfiguration); + + +var request = new FakeinlinecompositionPost.PostRequestBuilder().build(); + +FakeinlinecompositionPostResponses.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; +} +FakeinlinecompositionPostResponses.EndpointFakeinlinecompositionPostCode200Response castResponse = (FakeinlinecompositionPostResponses.EndpointFakeinlinecompositionPostCode200Response) response; +if (castResponse.body instanceof FakeinlinecompositionPostCode200Response.ApplicationjsonResponseBody deserializedBody) { + // handle deserialized body here +} else { + FakeinlinecompositionPostCode200Response.MultipartformdataResponseBody deserializedBody = (FakeinlinecompositionPostCode200Response.MultipartformdataResponseBody) castResponse.body; + // handle deserialized body here +} +``` +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| Post(ApiConfiguration apiConfiguration, SchemaConfiguration schemaConfiguration)
Creates an instance | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| [FakeinlinecompositionPostResponses.EndpointResponse](../../paths/fakeinlinecomposition/post/FakeinlinecompositionPostResponses.md#endpointresponse) | post([PostRequest](#postrequest) request) | + +## InlineCompositionOperation +public interface InlineCompositionOperation
+ +an interface that allows one to call the endpoint using a method named inlineComposition by the operationId + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| [FakeinlinecompositionPostResponses.EndpointResponse](../../paths/fakeinlinecomposition/post/FakeinlinecompositionPostResponses.md#endpointresponse) | inlineComposition([PostRequest](#postrequest) request) | + +## PostRequest +public static class PostRequest
+ +a class that stores the final request inputs + +### Field Summary +| Modifier and Type | Field and Description | +| ----------------- | --------------------- | +| [FakeinlinecompositionPostRequestBody.@Nullable SealedRequestBody](../../paths/fakeinlinecomposition/post/FakeinlinecompositionPostRequestBody.md#sealedrequestbody) | requestBody
optional | +| [FakeinlinecompositionPostQueryParameters.@Nullable QueryParametersMap](../../paths/fakeinlinecomposition/post/FakeinlinecompositionPostQueryParameters.md#queryparametersmap) | queryParameters
optional | +| [RootServerInfo.@Nullable ServerIndex](../../RootServerInfo.md#serverindex) | serverIndex
optional. Note: this will override the value in apiConfiguration | +| @Nullable Duration | timeout
optional. Note: this will override the value in apiConfiguration | + +## PostRequestBuilder +public static class PostRequestBuilder
+ +a builder for request inputs + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| PostRequestBuilder()
Creates a builder that contains null for all parameters | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| [PostRequest](#postrequest) | build()
Returns the request input used to call an endpoint method | +| [PostRequestBuilder](#postrequestbuilder) | requestBody([FakeinlinecompositionPostRequestBody.SealedRequestBody](../../paths/fakeinlinecomposition/post/FakeinlinecompositionPostRequestBody.md#sealedrequestbody) requestBody)
sets the optional property | +| [PostRequestBuilder](#postrequestbuilder) | queryParameters([FakeinlinecompositionPostQueryParametersQueryParametersMap](../../paths/fakeinlinecomposition/post/FakeinlinecompositionPostQueryParameters.md#queryparametersmap) queryParameters)
sets the optional property | +| [PostRequestBuilder](#postrequestbuilder) | serverIndex([RootServerInfo.ServerIndex](../../RootServerInfo.md#serverindex) serverIndex)
sets the optional property. Note: this will override the value in apiConfiguration | +| [PostRequestBuilder](#postrequestbuilder) | timeout(Duration timeout)
sets the optional property. Note: this will override the value in apiConfiguration | + +[[Back to top]](#top) [[Back to README]](../../../README.md) diff --git a/samples/client/petstore/kotlin/docs/paths/fakeinlinecomposition/post/FakeinlinecompositionPostQueryParameters.md b/samples/client/petstore/kotlin/docs/paths/fakeinlinecomposition/post/FakeinlinecompositionPostQueryParameters.md new file mode 100644 index 00000000000..320f389493c --- /dev/null +++ b/samples/client/petstore/kotlin/docs/paths/fakeinlinecomposition/post/FakeinlinecompositionPostQueryParameters.md @@ -0,0 +1,264 @@ +# FakeinlinecompositionPostQueryParameters +public class FakeinlinecompositionPostQueryParameters
+ +A class that contains necessary nested +- schema classes (which validate payloads), extends JsonSchema +- sealed interfaces which store validated payloads, java version of a sum type +- boxed classes which store validated payloads, sealed permits class implementations +- classes to store validated map payloads, extends FrozenMap +- classes to build inputs for map payloads + +## Nested Class Summary +| Modifier and Type | Class and Description | +| ----------------- | ---------------------- | +| sealed interface | [FakeinlinecompositionPostQueryParameters.FakeinlinecompositionPostQueryParameters1Boxed](#fakeinlinecompositionpostqueryparameters1boxed)
sealed interface for validated payloads | +| record | [FakeinlinecompositionPostQueryParameters.FakeinlinecompositionPostQueryParameters1BoxedMap](#fakeinlinecompositionpostqueryparameters1boxedmap)
boxed class to store validated Map payloads | +| static class | [FakeinlinecompositionPostQueryParameters.FakeinlinecompositionPostQueryParameters1](#fakeinlinecompositionpostqueryparameters1)
schema class | +| static class | [FakeinlinecompositionPostQueryParameters.QueryParametersMapBuilder](#queryparametersmapbuilder)
builder for Map payloads | +| static class | [FakeinlinecompositionPostQueryParameters.QueryParametersMap](#queryparametersmap)
output class for Map payloads | +| sealed interface | [FakeinlinecompositionPostQueryParameters.AdditionalPropertiesBoxed](#additionalpropertiesboxed)
sealed interface for validated payloads | +| record | [FakeinlinecompositionPostQueryParameters.AdditionalPropertiesBoxedVoid](#additionalpropertiesboxedvoid)
boxed class to store validated null payloads | +| record | [FakeinlinecompositionPostQueryParameters.AdditionalPropertiesBoxedBoolean](#additionalpropertiesboxedboolean)
boxed class to store validated boolean payloads | +| record | [FakeinlinecompositionPostQueryParameters.AdditionalPropertiesBoxedNumber](#additionalpropertiesboxednumber)
boxed class to store validated Number payloads | +| record | [FakeinlinecompositionPostQueryParameters.AdditionalPropertiesBoxedString](#additionalpropertiesboxedstring)
boxed class to store validated String payloads | +| record | [FakeinlinecompositionPostQueryParameters.AdditionalPropertiesBoxedList](#additionalpropertiesboxedlist)
boxed class to store validated List payloads | +| record | [FakeinlinecompositionPostQueryParameters.AdditionalPropertiesBoxedMap](#additionalpropertiesboxedmap)
boxed class to store validated Map payloads | +| static class | [FakeinlinecompositionPostQueryParameters.AdditionalProperties](#additionalproperties)
schema class | + +## FakeinlinecompositionPostQueryParameters1Boxed +public sealed interface FakeinlinecompositionPostQueryParameters1Boxed
+permits
+[FakeinlinecompositionPostQueryParameters1BoxedMap](#fakeinlinecompositionpostqueryparameters1boxedmap) + +sealed interface that stores validated payloads using boxed classes + +## FakeinlinecompositionPostQueryParameters1BoxedMap +public record FakeinlinecompositionPostQueryParameters1BoxedMap
+implements [FakeinlinecompositionPostQueryParameters1Boxed](#fakeinlinecompositionpostqueryparameters1boxed) + +record that stores validated Map payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| FakeinlinecompositionPostQueryParameters1BoxedMap([QueryParametersMap](#queryparametersmap) data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| [QueryParametersMap](#queryparametersmap) | data()
validated payload | +| @Nullable Object | getData()
validated payload | + +## FakeinlinecompositionPostQueryParameters1 +public static class FakeinlinecompositionPostQueryParameters1
+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.fakeinlinecomposition.post.FakeinlinecompositionPostQueryParameters; + +import java.util.Arrays; +import java.util.List; +import java.util.AbstractMap; + +static final SchemaConfiguration configuration = new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().build()); + +// Map validation +FakeinlinecompositionPostQueryParameters.QueryParametersMap validatedPayload = + FakeinlinecompositionPostQueryParameters.FakeinlinecompositionPostQueryParameters1.validate( + new FakeinlinecompositionPostQueryParameters.QueryParametersMapBuilder() + .compositionInProperty( + MapUtils.makeMap( + ) + ) + .build(), + configuration +); +``` + +### Field Summary +| Modifier and Type | Field and Description | +| ----------------- | ---------------------- | +| Set> | type = Set.of(Map.class) | +| Map> | properties = Map.ofEntries(
    new PropertyEntry("compositionAtRoot", [Schema0.Schema01.class](../../../paths/fakeinlinecomposition/post/parameters/parameter0/Schema0.md#schema01)),
    new PropertyEntry("compositionInProperty", [Schema1.Schema11.class](../../../paths/fakeinlinecomposition/post/parameters/parameter1/Schema1.md#schema11))
)
| +| Class | additionalProperties = [AdditionalProperties.class](#additionalproperties) | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| [QueryParametersMap](#queryparametersmap) | validate([Map<?, ?>](#queryparametersmapbuilder) arg, SchemaConfiguration configuration) | +| [FakeinlinecompositionPostQueryParameters1BoxedMap](#fakeinlinecompositionpostqueryparameters1boxedmap) | validateAndBox([Map<?, ?>](#queryparametersmapbuilder) arg, SchemaConfiguration configuration) | +| [FakeinlinecompositionPostQueryParameters1Boxed](#fakeinlinecompositionpostqueryparameters1boxed) | validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) | +| @Nullable Object | validate(@Nullable Object arg, SchemaConfiguration configuration) | + +## QueryParametersMapBuilder +public class QueryParametersMapBuilder
+builder for `Map` + +A class that builds the Map input type + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| QueryParametersMapBuilder()
Creates a builder that contains an empty map | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| Map | build()
Returns map input that should be used with Schema.validate | +| [QueryParametersMapBuilder](#queryparametersmapbuilder) | compositionAtRoot(Nothing? value) | +| [QueryParametersMapBuilder](#queryparametersmapbuilder) | compositionAtRoot(boolean value) | +| [QueryParametersMapBuilder](#queryparametersmapbuilder) | compositionAtRoot(String value) | +| [QueryParametersMapBuilder](#queryparametersmapbuilder) | compositionAtRoot(int value) | +| [QueryParametersMapBuilder](#queryparametersmapbuilder) | compositionAtRoot(float value) | +| [QueryParametersMapBuilder](#queryparametersmapbuilder) | compositionAtRoot(long value) | +| [QueryParametersMapBuilder](#queryparametersmapbuilder) | compositionAtRoot(double value) | +| [QueryParametersMapBuilder](#queryparametersmapbuilder) | compositionAtRoot(List value) | +| [QueryParametersMapBuilder](#queryparametersmapbuilder) | compositionAtRoot(Map value) | +| [QueryParametersMapBuilder](#queryparametersmapbuilder) | compositionInProperty(Map value) | + +## QueryParametersMap +public static class QueryParametersMap
+extends FrozenMap + +A class to store validated Map payloads + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| static [QueryParametersMap](#queryparametersmap) | of([Map](#queryparametersmapbuilder) arg, SchemaConfiguration configuration) | +| @Nullable Object | compositionAtRoot()
[optional] | +| [Schema1.SchemaMap1](../../../paths/fakeinlinecomposition/post/parameters/parameter1/Schema1.md#schemamap1) | compositionInProperty()
[optional] | + +## 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(Nothing? data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| Nothing? | 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/kotlin/docs/paths/fakeinlinecomposition/post/FakeinlinecompositionPostRequestBody.md b/samples/client/petstore/kotlin/docs/paths/fakeinlinecomposition/post/FakeinlinecompositionPostRequestBody.md new file mode 100644 index 00000000000..b30d7b48634 --- /dev/null +++ b/samples/client/petstore/kotlin/docs/paths/fakeinlinecomposition/post/FakeinlinecompositionPostRequestBody.md @@ -0,0 +1,128 @@ +# FakeinlinecompositionPostRequestBody + +public class FakeinlinecompositionPostRequestBody + +A class that contains necessary nested request body classes +- SealedMediaType, a sealed interface which contains all the schema/encoding info for each contentType +- records which implement SealedMediaType, the concrete media types +- a class that extends RequestBodySerializer and is used to serialize input SealedRequestBody instances +- SealedRequestBody, a sealed interface which contains all the contentType/schema input types +- records which implement SealedRequestBody, the concrete request body types + +## Nested Class Summary +| Modifier and Type | Class and Description | +| ----------------- | --------------------- | +| sealed interface | [FakeinlinecompositionPostRequestBody.SealedMediaType](#sealedmediatype)
media type sealed interface | +| record | [FakeinlinecompositionPostRequestBody.ApplicationjsonMediaType](#applicationjsonmediatype)
record storing schema + encoding for a specific contentType | +| record | [FakeinlinecompositionPostRequestBody.MultipartformdataMediaType](#multipartformdatamediatype)
record storing schema + encoding for a specific contentType | +| static class | [FakeinlinecompositionPostRequestBody.FakeinlinecompositionPostRequestBody1](#fakeinlinecompositionpostrequestbody1)
class that serializes request bodies | +| sealed interface | [FakeinlinecompositionPostRequestBody.SealedRequestBody](#sealedrequestbody)
request body sealed interface | +| record | [FakeinlinecompositionPostRequestBody.ApplicationjsonRequestBody](#applicationjsonrequestbody)
implements sealed interface to store request body input | +| record | [FakeinlinecompositionPostRequestBody.MultipartformdataRequestBody](#multipartformdatarequestbody)
implements sealed interface to store request body input | + +## SealedMediaType +public sealed interface SealedMediaType
+permits
+[ApplicationjsonMediaType](#applicationjsonmediatype), +[MultipartformdataMediaType](#multipartformdatamediatype) + +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), Nothing?> + +class storing schema info for a specific contentType + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| ApplicationjsonMediaType()
Creates an instance | + +### 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 | +| Nothing? | encoding()
the encoding info | + +## MultipartformdataMediaType +public record MultipartformdataMediaType
+implements [SealedMediaType](#sealedmediatype), MediaType<[MultipartformdataSchema.MultipartformdataSchema1](../../../paths/fakeinlinecomposition/post/requestbody/content/multipartformdata/MultipartformdataSchema.md#multipartformdataschema1), Nothing?> + +class storing schema info for a specific contentType + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| MultipartformdataMediaType()
Creates an instance | + +### 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 | +| Nothing? | encoding()
the encoding info | + +## FakeinlinecompositionPostRequestBody1 +public static class FakeinlinecompositionPostRequestBody1
+ +a class that serializes SealedRequestBody request bodies + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| FakeinlinecompositionPostRequestBody1()
Creates an instance | + +### Field Summary +| Modifier and Type | Field and Description | +| ----------------- | --------------------- | +| boolean | required = false
whether the request body is required | +| Map | content = Map.ofEntries(
    new AbstractMap.SimpleEntry<>("application/json", new [ApplicationjsonMediaType](#applicationjsonmediatype)()),
    new AbstractMap.SimpleEntry<>("multipart/form-data", new [MultipartformdataMediaType](#multipartformdatamediatype)())
)
the contentType to schema info | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| SerializedRequestBody | serialize([SealedRequestBody](#sealedrequestbody) requestBody)
called by endpoint when creating request body bytes | + +## SealedRequestBody +public sealed interface SealedRequestBody
+permits
+[ApplicationjsonRequestBody](#applicationjsonrequestbody), +[MultipartformdataRequestBody](#multipartformdatarequestbody) + +sealed interface that stores request contentType + validated schema data + +## ApplicationjsonRequestBody +public record ApplicationjsonRequestBody
+implements [SealedRequestBody](#sealedrequestbody),
+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 | + +### 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 | +## MultipartformdataRequestBody +public record MultipartformdataRequestBody
+implements [SealedRequestBody](#sealedrequestbody),
+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 | + +### 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 | diff --git a/samples/client/petstore/kotlin/docs/paths/fakeinlinecomposition/post/FakeinlinecompositionPostResponses.md b/samples/client/petstore/kotlin/docs/paths/fakeinlinecomposition/post/FakeinlinecompositionPostResponses.md new file mode 100644 index 00000000000..adf05cf26fe --- /dev/null +++ b/samples/client/petstore/kotlin/docs/paths/fakeinlinecomposition/post/FakeinlinecompositionPostResponses.md @@ -0,0 +1,29 @@ +# FakeinlinecompositionPostResponses + +public class FakeinlinecompositionPostResponses + +A class that contains necessary responses classes +- a sealed interface, EndpointResponse, that stores endpoint responses +- records for each endpoint response + +## Nested Class Summary +| Modifier and Type | Class and Description | +| ----------------- | --------------------- | +| sealed interface | [EndpointResponse](#endpointresponse)
stores the endpoint responses | +| record | [EndpointFakeinlinecompositionPostCode200Response](#endpointfakeinlinecompositionpostcode200response)
the response for 200 | + +## EndpointResponse +public sealed interface EndpointResponse permits
+[EndpointFakeinlinecompositionPostCode200Response](#endpointfakeinlinecompositionpostcode200response) + +a sealed interface that stores endpoint responses + +## EndpointFakeinlinecompositionPostCode200Response +public record EndpointFakeinlinecompositionPostCode200Response( + HttpResponse response, + [FakeinlinecompositionPostCode200Response.SealedResponseBody](../../../paths/fakeinlinecomposition/post/responses/FakeinlinecompositionPostCode200Response.md#sealedresponsebody) body, + Nothing? headers +) implements EndpointResponse, ApiResponse
+ +a class that stores an endpoint response + diff --git a/samples/client/petstore/kotlin/docs/paths/fakeinlinecomposition/post/parameters/parameter0/Schema0.md b/samples/client/petstore/kotlin/docs/paths/fakeinlinecomposition/post/parameters/parameter0/Schema0.md new file mode 100644 index 00000000000..ba6a38f1749 --- /dev/null +++ b/samples/client/petstore/kotlin/docs/paths/fakeinlinecomposition/post/parameters/parameter0/Schema0.md @@ -0,0 +1,236 @@ +# Schema0 +public class Schema0
+ +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 + +## Nested Class Summary +| Modifier and Type | Class and Description | +| ----------------- | ---------------------- | +| sealed interface | [Schema0.Schema01Boxed](#schema01boxed)
sealed interface for validated payloads | +| record | [Schema0.Schema01BoxedVoid](#schema01boxedvoid)
boxed class to store validated null payloads | +| record | [Schema0.Schema01BoxedBoolean](#schema01boxedboolean)
boxed class to store validated boolean payloads | +| record | [Schema0.Schema01BoxedNumber](#schema01boxednumber)
boxed class to store validated Number payloads | +| record | [Schema0.Schema01BoxedString](#schema01boxedstring)
boxed class to store validated String payloads | +| record | [Schema0.Schema01BoxedList](#schema01boxedlist)
boxed class to store validated List payloads | +| record | [Schema0.Schema01BoxedMap](#schema01boxedmap)
boxed class to store validated Map payloads | +| static class | [Schema0.Schema01](#schema01)
schema class | +| sealed interface | [Schema0.Schema00Boxed](#schema00boxed)
sealed interface for validated payloads | +| record | [Schema0.Schema00BoxedString](#schema00boxedstring)
boxed class to store validated String payloads | +| static class | [Schema0.Schema00](#schema00)
schema class | + +## Schema01Boxed +public sealed interface Schema01Boxed
+permits
+[Schema01BoxedVoid](#schema01boxedvoid), +[Schema01BoxedBoolean](#schema01boxedboolean), +[Schema01BoxedNumber](#schema01boxednumber), +[Schema01BoxedString](#schema01boxedstring), +[Schema01BoxedList](#schema01boxedlist), +[Schema01BoxedMap](#schema01boxedmap) + +sealed interface that stores validated payloads using boxed classes + +## Schema01BoxedVoid +public record Schema01BoxedVoid
+implements [Schema01Boxed](#schema01boxed) + +record that stores validated null payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| Schema01BoxedVoid(Nothing? data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| Nothing? | data()
validated payload | +| @Nullable Object | getData()
validated payload | + +## Schema01BoxedBoolean +public record Schema01BoxedBoolean
+implements [Schema01Boxed](#schema01boxed) + +record that stores validated boolean payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| Schema01BoxedBoolean(boolean data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| boolean | data()
validated payload | +| @Nullable Object | getData()
validated payload | + +## Schema01BoxedNumber +public record Schema01BoxedNumber
+implements [Schema01Boxed](#schema01boxed) + +record that stores validated Number payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| Schema01BoxedNumber(Number data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| Number | data()
validated payload | +| @Nullable Object | getData()
validated payload | + +## Schema01BoxedString +public record Schema01BoxedString
+implements [Schema01Boxed](#schema01boxed) + +record that stores validated String payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| Schema01BoxedString(String data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| String | data()
validated payload | +| @Nullable Object | getData()
validated payload | + +## Schema01BoxedList +public record Schema01BoxedList
+implements [Schema01Boxed](#schema01boxed) + +record that stores validated List payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| Schema01BoxedList(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 | + +## Schema01BoxedMap +public record Schema01BoxedMap
+implements [Schema01Boxed](#schema01boxed) + +record that stores validated Map payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| Schema01BoxedMap(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 | + +## Schema01 +public static class Schema01
+extends JsonSchema + +A schema class that validates payloads + +### Field Summary +| Modifier and Type | Field and Description | +| ----------------- | ---------------------- | +| List> | allOf = List.of(
    [Schema00.class](#schema00)
;)
| + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| String | validate(String arg, SchemaConfiguration configuration) | +| Nothing? | validate(Nothing? arg, SchemaConfiguration configuration) | +| int | validate(int arg, SchemaConfiguration configuration) | +| long | validate(long arg, SchemaConfiguration configuration) | +| float | validate(float arg, SchemaConfiguration configuration) | +| double | validate(double arg, SchemaConfiguration configuration) | +| Number | validate(Number arg, SchemaConfiguration configuration) | +| boolean | validate(boolean arg, SchemaConfiguration configuration) | +| FrozenMap<@Nullable Object> | validate(Map<?, ?> arg, SchemaConfiguration configuration) | +| FrozenList<@Nullable Object> | validate(List arg, SchemaConfiguration configuration) | +| [Schema01BoxedString](#schema01boxedstring) | validateAndBox(String arg, SchemaConfiguration configuration) | +| [Schema01BoxedVoid](#schema01boxedvoid) | validateAndBox(Nothing? arg, SchemaConfiguration configuration) | +| [Schema01BoxedNumber](#schema01boxednumber) | validateAndBox(Number arg, SchemaConfiguration configuration) | +| [Schema01BoxedBoolean](#schema01boxedboolean) | validateAndBox(boolean arg, SchemaConfiguration configuration) | +| [Schema01BoxedMap](#schema01boxedmap) | validateAndBox(Map<?, ?> arg, SchemaConfiguration configuration) | +| [Schema01BoxedList](#schema01boxedlist) | validateAndBox(List arg, SchemaConfiguration configuration) | +| [Schema01Boxed](#schema01boxed) | validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) | +| @Nullable Object | validate(@Nullable Object arg, SchemaConfiguration configuration) | + +## Schema00Boxed +public sealed interface Schema00Boxed
+permits
+[Schema00BoxedString](#schema00boxedstring) + +sealed interface that stores validated payloads using boxed classes + +## Schema00BoxedString +public record Schema00BoxedString
+implements [Schema00Boxed](#schema00boxed) + +record that stores validated String payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| Schema00BoxedString(String data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| String | data()
validated payload | +| @Nullable Object | getData()
validated payload | + +## Schema00 +public static class Schema00
+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.fakeinlinecomposition.post.parameters.parameter0.Schema0; + +import java.util.Arrays; +import java.util.List; +import java.util.AbstractMap; + +static final SchemaConfiguration configuration = new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().build()); + +// String validation +String validatedPayload = Schema0.Schema00.validate( + "a", + configuration +); +``` + +### Field Summary +| Modifier and Type | Field and Description | +| ----------------- | ---------------------- | +| Set> | type = Set.of(
    String.class
)
| +| Integer | minLength = 1 | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| String | validate(String arg, SchemaConfiguration configuration) | +| [Schema00BoxedString](#schema00boxedstring) | validateAndBox(String arg, SchemaConfiguration configuration) | +| [Schema00Boxed](#schema00boxed) | validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) | +| @Nullable Object | validate(@Nullable Object arg, SchemaConfiguration configuration) | diff --git a/samples/client/petstore/kotlin/docs/paths/fakeinlinecomposition/post/parameters/parameter1/Schema1.md b/samples/client/petstore/kotlin/docs/paths/fakeinlinecomposition/post/parameters/parameter1/Schema1.md new file mode 100644 index 00000000000..a46f468b1d1 --- /dev/null +++ b/samples/client/petstore/kotlin/docs/paths/fakeinlinecomposition/post/parameters/parameter1/Schema1.md @@ -0,0 +1,359 @@ +# Schema1 +public class Schema1
+ +A class that contains necessary nested +- schema classes (which validate payloads), extends JsonSchema +- sealed interfaces which store validated payloads, java version of a sum type +- boxed classes which store validated payloads, sealed permits class implementations +- classes to store validated map payloads, extends FrozenMap +- classes to build inputs for map payloads + +## Nested Class Summary +| Modifier and Type | Class and Description | +| ----------------- | ---------------------- | +| sealed interface | [Schema1.Schema11Boxed](#schema11boxed)
sealed interface for validated payloads | +| record | [Schema1.Schema11BoxedMap](#schema11boxedmap)
boxed class to store validated Map payloads | +| static class | [Schema1.Schema11](#schema11)
schema class | +| static class | [Schema1.SchemaMapBuilder1](#schemamapbuilder1)
builder for Map payloads | +| static class | [Schema1.SchemaMap1](#schemamap1)
output class for Map payloads | +| sealed interface | [Schema1.SomeProp1Boxed](#someprop1boxed)
sealed interface for validated payloads | +| record | [Schema1.SomeProp1BoxedVoid](#someprop1boxedvoid)
boxed class to store validated null payloads | +| record | [Schema1.SomeProp1BoxedBoolean](#someprop1boxedboolean)
boxed class to store validated boolean payloads | +| record | [Schema1.SomeProp1BoxedNumber](#someprop1boxednumber)
boxed class to store validated Number payloads | +| record | [Schema1.SomeProp1BoxedString](#someprop1boxedstring)
boxed class to store validated String payloads | +| record | [Schema1.SomeProp1BoxedList](#someprop1boxedlist)
boxed class to store validated List payloads | +| record | [Schema1.SomeProp1BoxedMap](#someprop1boxedmap)
boxed class to store validated Map payloads | +| static class | [Schema1.SomeProp1](#someprop1)
schema class | +| sealed interface | [Schema1.Schema01Boxed](#schema01boxed)
sealed interface for validated payloads | +| record | [Schema1.Schema01BoxedString](#schema01boxedstring)
boxed class to store validated String payloads | +| static class | [Schema1.Schema01](#schema01)
schema class | + +## Schema11Boxed +public sealed interface Schema11Boxed
+permits
+[Schema11BoxedMap](#schema11boxedmap) + +sealed interface that stores validated payloads using boxed classes + +## Schema11BoxedMap +public record Schema11BoxedMap
+implements [Schema11Boxed](#schema11boxed) + +record that stores validated Map payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| Schema11BoxedMap([SchemaMap1](#schemamap1) data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| [SchemaMap1](#schemamap1) | data()
validated payload | +| @Nullable Object | getData()
validated payload | + +## Schema11 +public static class Schema11
+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.fakeinlinecomposition.post.parameters.parameter1.Schema1; + +import java.util.Arrays; +import java.util.List; +import java.util.AbstractMap; + +static final SchemaConfiguration configuration = new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().build()); + +// Map validation +Schema1.SchemaMap1 validatedPayload = + Schema1.Schema11.validate( + new Schema1.SchemaMapBuilder1() + .build(), + configuration +); +``` + +### Field Summary +| Modifier and Type | Field and Description | +| ----------------- | ---------------------- | +| Set> | type = Set.of(Map.class) | +| Map> | properties = Map.ofEntries(
    new PropertyEntry("someProp", [SomeProp1.class](#someprop1)))
)
| + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| [SchemaMap1](#schemamap1) | validate([Map<?, ?>](#schemamapbuilder1) arg, SchemaConfiguration configuration) | +| [Schema11BoxedMap](#schema11boxedmap) | validateAndBox([Map<?, ?>](#schemamapbuilder1) arg, SchemaConfiguration configuration) | +| [Schema11Boxed](#schema11boxed) | validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) | +| @Nullable Object | validate(@Nullable Object arg, SchemaConfiguration configuration) | + +## SchemaMapBuilder1 +public class SchemaMapBuilder1
+builder for `Map` + +A class that builds the Map input type + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| SchemaMapBuilder1()
Creates a builder that contains an empty map | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| Map | build()
Returns map input that should be used with Schema.validate | +| [SchemaMapBuilder1](#schemamapbuilder1) | someProp(Nothing? value) | +| [SchemaMapBuilder1](#schemamapbuilder1) | someProp(boolean value) | +| [SchemaMapBuilder1](#schemamapbuilder1) | someProp(String value) | +| [SchemaMapBuilder1](#schemamapbuilder1) | someProp(int value) | +| [SchemaMapBuilder1](#schemamapbuilder1) | someProp(float value) | +| [SchemaMapBuilder1](#schemamapbuilder1) | someProp(long value) | +| [SchemaMapBuilder1](#schemamapbuilder1) | someProp(double value) | +| [SchemaMapBuilder1](#schemamapbuilder1) | someProp(List value) | +| [SchemaMapBuilder1](#schemamapbuilder1) | someProp(Map value) | +| [SchemaMapBuilder1](#schemamapbuilder1) | additionalProperty(String key, Nothing? value) | +| [SchemaMapBuilder1](#schemamapbuilder1) | additionalProperty(String key, boolean value) | +| [SchemaMapBuilder1](#schemamapbuilder1) | additionalProperty(String key, String value) | +| [SchemaMapBuilder1](#schemamapbuilder1) | additionalProperty(String key, int value) | +| [SchemaMapBuilder1](#schemamapbuilder1) | additionalProperty(String key, float value) | +| [SchemaMapBuilder1](#schemamapbuilder1) | additionalProperty(String key, long value) | +| [SchemaMapBuilder1](#schemamapbuilder1) | additionalProperty(String key, double value) | +| [SchemaMapBuilder1](#schemamapbuilder1) | additionalProperty(String key, List value) | +| [SchemaMapBuilder1](#schemamapbuilder1) | additionalProperty(String key, Map value) | + +## SchemaMap1 +public static class SchemaMap1
+extends FrozenMap + +A class to store validated Map payloads + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| static [SchemaMap1](#schemamap1) | of([Map](#schemamapbuilder1) arg, SchemaConfiguration configuration) | +| @Nullable Object | someProp()
[optional] | +| @Nullable Object | getAdditionalProperty(String name)
provides type safety for additional properties | + +## SomeProp1Boxed +public sealed interface SomeProp1Boxed
+permits
+[SomeProp1BoxedVoid](#someprop1boxedvoid), +[SomeProp1BoxedBoolean](#someprop1boxedboolean), +[SomeProp1BoxedNumber](#someprop1boxednumber), +[SomeProp1BoxedString](#someprop1boxedstring), +[SomeProp1BoxedList](#someprop1boxedlist), +[SomeProp1BoxedMap](#someprop1boxedmap) + +sealed interface that stores validated payloads using boxed classes + +## SomeProp1BoxedVoid +public record SomeProp1BoxedVoid
+implements [SomeProp1Boxed](#someprop1boxed) + +record that stores validated null payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| SomeProp1BoxedVoid(Nothing? data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| Nothing? | data()
validated payload | +| @Nullable Object | getData()
validated payload | + +## SomeProp1BoxedBoolean +public record SomeProp1BoxedBoolean
+implements [SomeProp1Boxed](#someprop1boxed) + +record that stores validated boolean payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| SomeProp1BoxedBoolean(boolean data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| boolean | data()
validated payload | +| @Nullable Object | getData()
validated payload | + +## SomeProp1BoxedNumber +public record SomeProp1BoxedNumber
+implements [SomeProp1Boxed](#someprop1boxed) + +record that stores validated Number payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| SomeProp1BoxedNumber(Number data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| Number | data()
validated payload | +| @Nullable Object | getData()
validated payload | + +## SomeProp1BoxedString +public record SomeProp1BoxedString
+implements [SomeProp1Boxed](#someprop1boxed) + +record that stores validated String payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| SomeProp1BoxedString(String data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| String | data()
validated payload | +| @Nullable Object | getData()
validated payload | + +## SomeProp1BoxedList +public record SomeProp1BoxedList
+implements [SomeProp1Boxed](#someprop1boxed) + +record that stores validated List payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| SomeProp1BoxedList(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 | + +## SomeProp1BoxedMap +public record SomeProp1BoxedMap
+implements [SomeProp1Boxed](#someprop1boxed) + +record that stores validated Map payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| SomeProp1BoxedMap(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 | + +## SomeProp1 +public static class SomeProp1
+extends JsonSchema + +A schema class that validates payloads + +### Field Summary +| Modifier and Type | Field and Description | +| ----------------- | ---------------------- | +| List> | allOf = List.of(
    [Schema01.class](#schema01)
;)
| + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| String | validate(String arg, SchemaConfiguration configuration) | +| Nothing? | validate(Nothing? arg, SchemaConfiguration configuration) | +| int | validate(int arg, SchemaConfiguration configuration) | +| long | validate(long arg, SchemaConfiguration configuration) | +| float | validate(float arg, SchemaConfiguration configuration) | +| double | validate(double arg, SchemaConfiguration configuration) | +| Number | validate(Number arg, SchemaConfiguration configuration) | +| boolean | validate(boolean arg, SchemaConfiguration configuration) | +| FrozenMap<@Nullable Object> | validate(Map<?, ?> arg, SchemaConfiguration configuration) | +| FrozenList<@Nullable Object> | validate(List arg, SchemaConfiguration configuration) | +| [SomeProp1BoxedString](#someprop1boxedstring) | validateAndBox(String arg, SchemaConfiguration configuration) | +| [SomeProp1BoxedVoid](#someprop1boxedvoid) | validateAndBox(Nothing? arg, SchemaConfiguration configuration) | +| [SomeProp1BoxedNumber](#someprop1boxednumber) | validateAndBox(Number arg, SchemaConfiguration configuration) | +| [SomeProp1BoxedBoolean](#someprop1boxedboolean) | validateAndBox(boolean arg, SchemaConfiguration configuration) | +| [SomeProp1BoxedMap](#someprop1boxedmap) | validateAndBox(Map<?, ?> arg, SchemaConfiguration configuration) | +| [SomeProp1BoxedList](#someprop1boxedlist) | validateAndBox(List arg, SchemaConfiguration configuration) | +| [SomeProp1Boxed](#someprop1boxed) | validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) | +| @Nullable Object | validate(@Nullable Object arg, SchemaConfiguration configuration) | + +## Schema01Boxed +public sealed interface Schema01Boxed
+permits
+[Schema01BoxedString](#schema01boxedstring) + +sealed interface that stores validated payloads using boxed classes + +## Schema01BoxedString +public record Schema01BoxedString
+implements [Schema01Boxed](#schema01boxed) + +record that stores validated String payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| Schema01BoxedString(String data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| String | data()
validated payload | +| @Nullable Object | getData()
validated payload | + +## Schema01 +public static class Schema01
+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.fakeinlinecomposition.post.parameters.parameter1.Schema1; + +import java.util.Arrays; +import java.util.List; +import java.util.AbstractMap; + +static final SchemaConfiguration configuration = new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().build()); + +// String validation +String validatedPayload = Schema1.Schema01.validate( + "a", + configuration +); +``` + +### Field Summary +| Modifier and Type | Field and Description | +| ----------------- | ---------------------- | +| Set> | type = Set.of(
    String.class
)
| +| Integer | minLength = 1 | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| String | validate(String arg, SchemaConfiguration configuration) | +| [Schema01BoxedString](#schema01boxedstring) | validateAndBox(String arg, SchemaConfiguration configuration) | +| [Schema01Boxed](#schema01boxed) | validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) | +| @Nullable Object | validate(@Nullable Object arg, SchemaConfiguration configuration) | diff --git a/samples/client/petstore/kotlin/docs/paths/fakeinlinecomposition/post/requestbody/content/applicationjson/ApplicationjsonSchema.md b/samples/client/petstore/kotlin/docs/paths/fakeinlinecomposition/post/requestbody/content/applicationjson/ApplicationjsonSchema.md new file mode 100644 index 00000000000..c75e2cc8dda --- /dev/null +++ b/samples/client/petstore/kotlin/docs/paths/fakeinlinecomposition/post/requestbody/content/applicationjson/ApplicationjsonSchema.md @@ -0,0 +1,236 @@ +# ApplicationjsonSchema +public class ApplicationjsonSchema
+ +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 + +## Nested Class Summary +| Modifier and Type | Class and Description | +| ----------------- | ---------------------- | +| sealed interface | [ApplicationjsonSchema.ApplicationjsonSchema1Boxed](#applicationjsonschema1boxed)
sealed interface for validated payloads | +| record | [ApplicationjsonSchema.ApplicationjsonSchema1BoxedVoid](#applicationjsonschema1boxedvoid)
boxed class to store validated null payloads | +| record | [ApplicationjsonSchema.ApplicationjsonSchema1BoxedBoolean](#applicationjsonschema1boxedboolean)
boxed class to store validated boolean payloads | +| record | [ApplicationjsonSchema.ApplicationjsonSchema1BoxedNumber](#applicationjsonschema1boxednumber)
boxed class to store validated Number payloads | +| record | [ApplicationjsonSchema.ApplicationjsonSchema1BoxedString](#applicationjsonschema1boxedstring)
boxed class to store validated String payloads | +| record | [ApplicationjsonSchema.ApplicationjsonSchema1BoxedList](#applicationjsonschema1boxedlist)
boxed class to store validated List payloads | +| record | [ApplicationjsonSchema.ApplicationjsonSchema1BoxedMap](#applicationjsonschema1boxedmap)
boxed class to store validated Map payloads | +| static class | [ApplicationjsonSchema.ApplicationjsonSchema1](#applicationjsonschema1)
schema class | +| sealed interface | [ApplicationjsonSchema.Applicationjson0Boxed](#applicationjson0boxed)
sealed interface for validated payloads | +| record | [ApplicationjsonSchema.Applicationjson0BoxedString](#applicationjson0boxedstring)
boxed class to store validated String payloads | +| static class | [ApplicationjsonSchema.Applicationjson0](#applicationjson0)
schema class | + +## ApplicationjsonSchema1Boxed +public sealed interface ApplicationjsonSchema1Boxed
+permits
+[ApplicationjsonSchema1BoxedVoid](#applicationjsonschema1boxedvoid), +[ApplicationjsonSchema1BoxedBoolean](#applicationjsonschema1boxedboolean), +[ApplicationjsonSchema1BoxedNumber](#applicationjsonschema1boxednumber), +[ApplicationjsonSchema1BoxedString](#applicationjsonschema1boxedstring), +[ApplicationjsonSchema1BoxedList](#applicationjsonschema1boxedlist), +[ApplicationjsonSchema1BoxedMap](#applicationjsonschema1boxedmap) + +sealed interface that stores validated payloads using boxed classes + +## ApplicationjsonSchema1BoxedVoid +public record ApplicationjsonSchema1BoxedVoid
+implements [ApplicationjsonSchema1Boxed](#applicationjsonschema1boxed) + +record that stores validated null payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| ApplicationjsonSchema1BoxedVoid(Nothing? data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| Nothing? | data()
validated payload | +| @Nullable Object | getData()
validated payload | + +## ApplicationjsonSchema1BoxedBoolean +public record ApplicationjsonSchema1BoxedBoolean
+implements [ApplicationjsonSchema1Boxed](#applicationjsonschema1boxed) + +record that stores validated boolean payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| ApplicationjsonSchema1BoxedBoolean(boolean data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| boolean | data()
validated payload | +| @Nullable Object | getData()
validated payload | + +## ApplicationjsonSchema1BoxedNumber +public record ApplicationjsonSchema1BoxedNumber
+implements [ApplicationjsonSchema1Boxed](#applicationjsonschema1boxed) + +record that stores validated Number payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| ApplicationjsonSchema1BoxedNumber(Number data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| Number | data()
validated payload | +| @Nullable Object | getData()
validated payload | + +## ApplicationjsonSchema1BoxedString +public record ApplicationjsonSchema1BoxedString
+implements [ApplicationjsonSchema1Boxed](#applicationjsonschema1boxed) + +record that stores validated String payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| ApplicationjsonSchema1BoxedString(String data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| String | data()
validated payload | +| @Nullable Object | getData()
validated payload | + +## ApplicationjsonSchema1BoxedList +public record ApplicationjsonSchema1BoxedList
+implements [ApplicationjsonSchema1Boxed](#applicationjsonschema1boxed) + +record that stores validated List payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| ApplicationjsonSchema1BoxedList(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 | + +## ApplicationjsonSchema1BoxedMap +public record ApplicationjsonSchema1BoxedMap
+implements [ApplicationjsonSchema1Boxed](#applicationjsonschema1boxed) + +record that stores validated Map payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| ApplicationjsonSchema1BoxedMap(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 | + +## ApplicationjsonSchema1 +public static class ApplicationjsonSchema1
+extends JsonSchema + +A schema class that validates payloads + +### Field Summary +| Modifier and Type | Field and Description | +| ----------------- | ---------------------- | +| List> | allOf = List.of(
    [Applicationjson0.class](#applicationjson0)
;)
| + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| String | validate(String arg, SchemaConfiguration configuration) | +| Nothing? | validate(Nothing? arg, SchemaConfiguration configuration) | +| int | validate(int arg, SchemaConfiguration configuration) | +| long | validate(long arg, SchemaConfiguration configuration) | +| float | validate(float arg, SchemaConfiguration configuration) | +| double | validate(double arg, SchemaConfiguration configuration) | +| Number | validate(Number arg, SchemaConfiguration configuration) | +| boolean | validate(boolean arg, SchemaConfiguration configuration) | +| FrozenMap<@Nullable Object> | validate(Map<?, ?> arg, SchemaConfiguration configuration) | +| FrozenList<@Nullable Object> | validate(List arg, SchemaConfiguration configuration) | +| [ApplicationjsonSchema1BoxedString](#applicationjsonschema1boxedstring) | validateAndBox(String arg, SchemaConfiguration configuration) | +| [ApplicationjsonSchema1BoxedVoid](#applicationjsonschema1boxedvoid) | validateAndBox(Nothing? arg, SchemaConfiguration configuration) | +| [ApplicationjsonSchema1BoxedNumber](#applicationjsonschema1boxednumber) | validateAndBox(Number arg, SchemaConfiguration configuration) | +| [ApplicationjsonSchema1BoxedBoolean](#applicationjsonschema1boxedboolean) | validateAndBox(boolean arg, SchemaConfiguration configuration) | +| [ApplicationjsonSchema1BoxedMap](#applicationjsonschema1boxedmap) | validateAndBox(Map<?, ?> arg, SchemaConfiguration configuration) | +| [ApplicationjsonSchema1BoxedList](#applicationjsonschema1boxedlist) | validateAndBox(List arg, SchemaConfiguration configuration) | +| [ApplicationjsonSchema1Boxed](#applicationjsonschema1boxed) | validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) | +| @Nullable Object | validate(@Nullable Object arg, SchemaConfiguration configuration) | + +## Applicationjson0Boxed +public sealed interface Applicationjson0Boxed
+permits
+[Applicationjson0BoxedString](#applicationjson0boxedstring) + +sealed interface that stores validated payloads using boxed classes + +## Applicationjson0BoxedString +public record Applicationjson0BoxedString
+implements [Applicationjson0Boxed](#applicationjson0boxed) + +record that stores validated String payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| Applicationjson0BoxedString(String data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| String | data()
validated payload | +| @Nullable Object | getData()
validated payload | + +## Applicationjson0 +public static class Applicationjson0
+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.fakeinlinecomposition.post.requestbody.content.applicationjson.ApplicationjsonSchema; + +import java.util.Arrays; +import java.util.List; +import java.util.AbstractMap; + +static final SchemaConfiguration configuration = new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().build()); + +// String validation +String validatedPayload = ApplicationjsonSchema.Applicationjson0.validate( + "a", + configuration +); +``` + +### Field Summary +| Modifier and Type | Field and Description | +| ----------------- | ---------------------- | +| Set> | type = Set.of(
    String.class
)
| +| Integer | minLength = 1 | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| String | validate(String arg, SchemaConfiguration configuration) | +| [Applicationjson0BoxedString](#applicationjson0boxedstring) | validateAndBox(String arg, SchemaConfiguration configuration) | +| [Applicationjson0Boxed](#applicationjson0boxed) | validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) | +| @Nullable Object | validate(@Nullable Object arg, SchemaConfiguration configuration) | diff --git a/samples/client/petstore/kotlin/docs/paths/fakeinlinecomposition/post/requestbody/content/multipartformdata/MultipartformdataSchema.md b/samples/client/petstore/kotlin/docs/paths/fakeinlinecomposition/post/requestbody/content/multipartformdata/MultipartformdataSchema.md new file mode 100644 index 00000000000..15ac80ffd6e --- /dev/null +++ b/samples/client/petstore/kotlin/docs/paths/fakeinlinecomposition/post/requestbody/content/multipartformdata/MultipartformdataSchema.md @@ -0,0 +1,359 @@ +# MultipartformdataSchema +public class MultipartformdataSchema
+ +A class that contains necessary nested +- schema classes (which validate payloads), extends JsonSchema +- sealed interfaces which store validated payloads, java version of a sum type +- boxed classes which store validated payloads, sealed permits class implementations +- classes to store validated map payloads, extends FrozenMap +- classes to build inputs for map payloads + +## Nested Class Summary +| Modifier and Type | Class and Description | +| ----------------- | ---------------------- | +| sealed interface | [MultipartformdataSchema.MultipartformdataSchema1Boxed](#multipartformdataschema1boxed)
sealed interface for validated payloads | +| record | [MultipartformdataSchema.MultipartformdataSchema1BoxedMap](#multipartformdataschema1boxedmap)
boxed class to store validated Map payloads | +| static class | [MultipartformdataSchema.MultipartformdataSchema1](#multipartformdataschema1)
schema class | +| static class | [MultipartformdataSchema.MultipartformdataSchemaMapBuilder](#multipartformdataschemamapbuilder)
builder for Map payloads | +| static class | [MultipartformdataSchema.MultipartformdataSchemaMap](#multipartformdataschemamap)
output class for Map payloads | +| sealed interface | [MultipartformdataSchema.MultipartformdataSomePropBoxed](#multipartformdatasomepropboxed)
sealed interface for validated payloads | +| record | [MultipartformdataSchema.MultipartformdataSomePropBoxedVoid](#multipartformdatasomepropboxedvoid)
boxed class to store validated null payloads | +| record | [MultipartformdataSchema.MultipartformdataSomePropBoxedBoolean](#multipartformdatasomepropboxedboolean)
boxed class to store validated boolean payloads | +| record | [MultipartformdataSchema.MultipartformdataSomePropBoxedNumber](#multipartformdatasomepropboxednumber)
boxed class to store validated Number payloads | +| record | [MultipartformdataSchema.MultipartformdataSomePropBoxedString](#multipartformdatasomepropboxedstring)
boxed class to store validated String payloads | +| record | [MultipartformdataSchema.MultipartformdataSomePropBoxedList](#multipartformdatasomepropboxedlist)
boxed class to store validated List payloads | +| record | [MultipartformdataSchema.MultipartformdataSomePropBoxedMap](#multipartformdatasomepropboxedmap)
boxed class to store validated Map payloads | +| static class | [MultipartformdataSchema.MultipartformdataSomeProp](#multipartformdatasomeprop)
schema class | +| sealed interface | [MultipartformdataSchema.Multipartformdata0Boxed](#multipartformdata0boxed)
sealed interface for validated payloads | +| record | [MultipartformdataSchema.Multipartformdata0BoxedString](#multipartformdata0boxedstring)
boxed class to store validated String payloads | +| static class | [MultipartformdataSchema.Multipartformdata0](#multipartformdata0)
schema class | + +## MultipartformdataSchema1Boxed +public sealed interface MultipartformdataSchema1Boxed
+permits
+[MultipartformdataSchema1BoxedMap](#multipartformdataschema1boxedmap) + +sealed interface that stores validated payloads using boxed classes + +## MultipartformdataSchema1BoxedMap +public record MultipartformdataSchema1BoxedMap
+implements [MultipartformdataSchema1Boxed](#multipartformdataschema1boxed) + +record that stores validated Map payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| MultipartformdataSchema1BoxedMap([MultipartformdataSchemaMap](#multipartformdataschemamap) data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| [MultipartformdataSchemaMap](#multipartformdataschemamap) | data()
validated payload | +| @Nullable Object | getData()
validated payload | + +## MultipartformdataSchema1 +public static class MultipartformdataSchema1
+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.fakeinlinecomposition.post.requestbody.content.multipartformdata.MultipartformdataSchema; + +import java.util.Arrays; +import java.util.List; +import java.util.AbstractMap; + +static final SchemaConfiguration configuration = new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().build()); + +// Map validation +MultipartformdataSchema.MultipartformdataSchemaMap validatedPayload = + MultipartformdataSchema.MultipartformdataSchema1.validate( + new MultipartformdataSchema.MultipartformdataSchemaMapBuilder() + .build(), + configuration +); +``` + +### Field Summary +| Modifier and Type | Field and Description | +| ----------------- | ---------------------- | +| Set> | type = Set.of(Map.class) | +| Map> | properties = Map.ofEntries(
    new PropertyEntry("someProp", [MultipartformdataSomeProp.class](#multipartformdatasomeprop)))
)
| + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| [MultipartformdataSchemaMap](#multipartformdataschemamap) | validate([Map<?, ?>](#multipartformdataschemamapbuilder) arg, SchemaConfiguration configuration) | +| [MultipartformdataSchema1BoxedMap](#multipartformdataschema1boxedmap) | validateAndBox([Map<?, ?>](#multipartformdataschemamapbuilder) arg, SchemaConfiguration configuration) | +| [MultipartformdataSchema1Boxed](#multipartformdataschema1boxed) | validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) | +| @Nullable Object | validate(@Nullable Object arg, SchemaConfiguration configuration) | + +## MultipartformdataSchemaMapBuilder +public class MultipartformdataSchemaMapBuilder
+builder for `Map` + +A class that builds the Map input type + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| MultipartformdataSchemaMapBuilder()
Creates a builder that contains an empty map | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| Map | build()
Returns map input that should be used with Schema.validate | +| [MultipartformdataSchemaMapBuilder](#multipartformdataschemamapbuilder) | someProp(Nothing? value) | +| [MultipartformdataSchemaMapBuilder](#multipartformdataschemamapbuilder) | someProp(boolean value) | +| [MultipartformdataSchemaMapBuilder](#multipartformdataschemamapbuilder) | someProp(String value) | +| [MultipartformdataSchemaMapBuilder](#multipartformdataschemamapbuilder) | someProp(int value) | +| [MultipartformdataSchemaMapBuilder](#multipartformdataschemamapbuilder) | someProp(float value) | +| [MultipartformdataSchemaMapBuilder](#multipartformdataschemamapbuilder) | someProp(long value) | +| [MultipartformdataSchemaMapBuilder](#multipartformdataschemamapbuilder) | someProp(double value) | +| [MultipartformdataSchemaMapBuilder](#multipartformdataschemamapbuilder) | someProp(List value) | +| [MultipartformdataSchemaMapBuilder](#multipartformdataschemamapbuilder) | someProp(Map value) | +| [MultipartformdataSchemaMapBuilder](#multipartformdataschemamapbuilder) | additionalProperty(String key, Nothing? value) | +| [MultipartformdataSchemaMapBuilder](#multipartformdataschemamapbuilder) | additionalProperty(String key, boolean value) | +| [MultipartformdataSchemaMapBuilder](#multipartformdataschemamapbuilder) | additionalProperty(String key, String value) | +| [MultipartformdataSchemaMapBuilder](#multipartformdataschemamapbuilder) | additionalProperty(String key, int value) | +| [MultipartformdataSchemaMapBuilder](#multipartformdataschemamapbuilder) | additionalProperty(String key, float value) | +| [MultipartformdataSchemaMapBuilder](#multipartformdataschemamapbuilder) | additionalProperty(String key, long value) | +| [MultipartformdataSchemaMapBuilder](#multipartformdataschemamapbuilder) | additionalProperty(String key, double value) | +| [MultipartformdataSchemaMapBuilder](#multipartformdataschemamapbuilder) | additionalProperty(String key, List value) | +| [MultipartformdataSchemaMapBuilder](#multipartformdataschemamapbuilder) | additionalProperty(String key, Map value) | + +## MultipartformdataSchemaMap +public static class MultipartformdataSchemaMap
+extends FrozenMap + +A class to store validated Map payloads + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| static [MultipartformdataSchemaMap](#multipartformdataschemamap) | of([Map](#multipartformdataschemamapbuilder) arg, SchemaConfiguration configuration) | +| @Nullable Object | someProp()
[optional] | +| @Nullable Object | getAdditionalProperty(String name)
provides type safety for additional properties | + +## MultipartformdataSomePropBoxed +public sealed interface MultipartformdataSomePropBoxed
+permits
+[MultipartformdataSomePropBoxedVoid](#multipartformdatasomepropboxedvoid), +[MultipartformdataSomePropBoxedBoolean](#multipartformdatasomepropboxedboolean), +[MultipartformdataSomePropBoxedNumber](#multipartformdatasomepropboxednumber), +[MultipartformdataSomePropBoxedString](#multipartformdatasomepropboxedstring), +[MultipartformdataSomePropBoxedList](#multipartformdatasomepropboxedlist), +[MultipartformdataSomePropBoxedMap](#multipartformdatasomepropboxedmap) + +sealed interface that stores validated payloads using boxed classes + +## MultipartformdataSomePropBoxedVoid +public record MultipartformdataSomePropBoxedVoid
+implements [MultipartformdataSomePropBoxed](#multipartformdatasomepropboxed) + +record that stores validated null payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| MultipartformdataSomePropBoxedVoid(Nothing? data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| Nothing? | data()
validated payload | +| @Nullable Object | getData()
validated payload | + +## MultipartformdataSomePropBoxedBoolean +public record MultipartformdataSomePropBoxedBoolean
+implements [MultipartformdataSomePropBoxed](#multipartformdatasomepropboxed) + +record that stores validated boolean payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| MultipartformdataSomePropBoxedBoolean(boolean data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| boolean | data()
validated payload | +| @Nullable Object | getData()
validated payload | + +## MultipartformdataSomePropBoxedNumber +public record MultipartformdataSomePropBoxedNumber
+implements [MultipartformdataSomePropBoxed](#multipartformdatasomepropboxed) + +record that stores validated Number payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| MultipartformdataSomePropBoxedNumber(Number data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| Number | data()
validated payload | +| @Nullable Object | getData()
validated payload | + +## MultipartformdataSomePropBoxedString +public record MultipartformdataSomePropBoxedString
+implements [MultipartformdataSomePropBoxed](#multipartformdatasomepropboxed) + +record that stores validated String payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| MultipartformdataSomePropBoxedString(String data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| String | data()
validated payload | +| @Nullable Object | getData()
validated payload | + +## MultipartformdataSomePropBoxedList +public record MultipartformdataSomePropBoxedList
+implements [MultipartformdataSomePropBoxed](#multipartformdatasomepropboxed) + +record that stores validated List payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| MultipartformdataSomePropBoxedList(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 | + +## MultipartformdataSomePropBoxedMap +public record MultipartformdataSomePropBoxedMap
+implements [MultipartformdataSomePropBoxed](#multipartformdatasomepropboxed) + +record that stores validated Map payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| MultipartformdataSomePropBoxedMap(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 | + +## MultipartformdataSomeProp +public static class MultipartformdataSomeProp
+extends JsonSchema + +A schema class that validates payloads + +### Field Summary +| Modifier and Type | Field and Description | +| ----------------- | ---------------------- | +| List> | allOf = List.of(
    [Multipartformdata0.class](#multipartformdata0)
;)
| + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| String | validate(String arg, SchemaConfiguration configuration) | +| Nothing? | validate(Nothing? arg, SchemaConfiguration configuration) | +| int | validate(int arg, SchemaConfiguration configuration) | +| long | validate(long arg, SchemaConfiguration configuration) | +| float | validate(float arg, SchemaConfiguration configuration) | +| double | validate(double arg, SchemaConfiguration configuration) | +| Number | validate(Number arg, SchemaConfiguration configuration) | +| boolean | validate(boolean arg, SchemaConfiguration configuration) | +| FrozenMap<@Nullable Object> | validate(Map<?, ?> arg, SchemaConfiguration configuration) | +| FrozenList<@Nullable Object> | validate(List arg, SchemaConfiguration configuration) | +| [MultipartformdataSomePropBoxedString](#multipartformdatasomepropboxedstring) | validateAndBox(String arg, SchemaConfiguration configuration) | +| [MultipartformdataSomePropBoxedVoid](#multipartformdatasomepropboxedvoid) | validateAndBox(Nothing? arg, SchemaConfiguration configuration) | +| [MultipartformdataSomePropBoxedNumber](#multipartformdatasomepropboxednumber) | validateAndBox(Number arg, SchemaConfiguration configuration) | +| [MultipartformdataSomePropBoxedBoolean](#multipartformdatasomepropboxedboolean) | validateAndBox(boolean arg, SchemaConfiguration configuration) | +| [MultipartformdataSomePropBoxedMap](#multipartformdatasomepropboxedmap) | validateAndBox(Map<?, ?> arg, SchemaConfiguration configuration) | +| [MultipartformdataSomePropBoxedList](#multipartformdatasomepropboxedlist) | validateAndBox(List arg, SchemaConfiguration configuration) | +| [MultipartformdataSomePropBoxed](#multipartformdatasomepropboxed) | validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) | +| @Nullable Object | validate(@Nullable Object arg, SchemaConfiguration configuration) | + +## Multipartformdata0Boxed +public sealed interface Multipartformdata0Boxed
+permits
+[Multipartformdata0BoxedString](#multipartformdata0boxedstring) + +sealed interface that stores validated payloads using boxed classes + +## Multipartformdata0BoxedString +public record Multipartformdata0BoxedString
+implements [Multipartformdata0Boxed](#multipartformdata0boxed) + +record that stores validated String payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| Multipartformdata0BoxedString(String data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| String | data()
validated payload | +| @Nullable Object | getData()
validated payload | + +## Multipartformdata0 +public static class Multipartformdata0
+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.fakeinlinecomposition.post.requestbody.content.multipartformdata.MultipartformdataSchema; + +import java.util.Arrays; +import java.util.List; +import java.util.AbstractMap; + +static final SchemaConfiguration configuration = new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().build()); + +// String validation +String validatedPayload = MultipartformdataSchema.Multipartformdata0.validate( + "a", + configuration +); +``` + +### Field Summary +| Modifier and Type | Field and Description | +| ----------------- | ---------------------- | +| Set> | type = Set.of(
    String.class
)
| +| Integer | minLength = 1 | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| String | validate(String arg, SchemaConfiguration configuration) | +| [Multipartformdata0BoxedString](#multipartformdata0boxedstring) | validateAndBox(String arg, SchemaConfiguration configuration) | +| [Multipartformdata0Boxed](#multipartformdata0boxed) | validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) | +| @Nullable Object | validate(@Nullable Object arg, SchemaConfiguration configuration) | diff --git a/samples/client/petstore/kotlin/docs/paths/fakeinlinecomposition/post/responses/FakeinlinecompositionPostCode200Response.md b/samples/client/petstore/kotlin/docs/paths/fakeinlinecomposition/post/responses/FakeinlinecompositionPostCode200Response.md new file mode 100644 index 00000000000..78b44969fbf --- /dev/null +++ b/samples/client/petstore/kotlin/docs/paths/fakeinlinecomposition/post/responses/FakeinlinecompositionPostCode200Response.md @@ -0,0 +1,123 @@ +# FakeinlinecompositionPostCode200Response + +public class FakeinlinecompositionPostCode200Response + +A class that contains necessary nested response classes +- SealedMediaType, a sealed interface which contains all the schema/encoding info for each contentType +- records which implement SealedMediaType, the concrete media types +- SealedResponseBody, a sealed interface which contains all the contentType/schema types +- records which implement SealedResponseBody, the concrete response body types +- a class that extends ResponseDeserializer and is used to deserialize responses + +## Nested Class Summary +| Modifier and Type | Class and Description | +| ----------------- | --------------------- | +| sealed interface | [FakeinlinecompositionPostCode200Response.SealedMediaType](#sealedmediatype)
media type sealed interface | +| record | [FakeinlinecompositionPostCode200Response.ApplicationjsonMediaType](#applicationjsonmediatype)
record storing schema + encoding for a specific contentType | +| record | [FakeinlinecompositionPostCode200Response.MultipartformdataMediaType](#multipartformdatamediatype)
record storing schema + encoding for a specific contentType | +| sealed interface | [FakeinlinecompositionPostCode200Response.SealedResponseBody](#sealedresponsebody)
response body sealed interface | +| record | [FakeinlinecompositionPostCode200Response.ApplicationjsonResponseBody](#applicationjsonresponsebody)
implements sealed interface to store response body | +| record | [FakeinlinecompositionPostCode200Response.MultipartformdataResponseBody](#multipartformdataresponsebody)
implements sealed interface to store response body | +| static class | [FakeinlinecompositionPostCode200Response.FakeinlinecompositionPostCode200Response1](#fakeinlinecompositionpostcode200response1)
class that deserializes responses | + +## SealedMediaType +public sealed interface SealedMediaType
+permits
+[ApplicationjsonMediaType](#applicationjsonmediatype), +[MultipartformdataMediaType](#multipartformdatamediatype) + +sealed interface that stores schema and encoding info + +## ApplicationjsonMediaType +public record ApplicationjsonMediaType
+implements [SealedMediaType](#sealedmediatype), MediaType<[ApplicationjsonSchema.ApplicationjsonSchema1](../../../../paths/fakeinlinecomposition/post/responses/code200response/content/applicationjson/ApplicationjsonSchema.md#applicationjsonschema1), Nothing?> + +class storing schema info for a specific contentType + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| ApplicationjsonMediaType()
Creates an instance | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| [ApplicationjsonSchema.ApplicationjsonSchema1](../../../../paths/fakeinlinecomposition/post/responses/code200response/content/applicationjson/ApplicationjsonSchema.md#applicationjsonschema1) | schema()
the schema for this MediaType | +| Nothing? | encoding()
the encoding info | + +## MultipartformdataMediaType +public record MultipartformdataMediaType
+implements [SealedMediaType](#sealedmediatype), MediaType<[MultipartformdataSchema.MultipartformdataSchema1](../../../../paths/fakeinlinecomposition/post/responses/code200response/content/multipartformdata/MultipartformdataSchema.md#multipartformdataschema1), Nothing?> + +class storing schema info for a specific contentType + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| MultipartformdataMediaType()
Creates an instance | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| [MultipartformdataSchema.MultipartformdataSchema1](../../../../paths/fakeinlinecomposition/post/responses/code200response/content/multipartformdata/MultipartformdataSchema.md#multipartformdataschema1) | schema()
the schema for this MediaType | +| Nothing? | encoding()
the encoding info | + +## SealedResponseBody +public sealed interface SealedResponseBody
+permits
+[ApplicationjsonResponseBody](#applicationjsonresponsebody), +[MultipartformdataResponseBody](#multipartformdataresponsebody) + +sealed interface that stores response body + +## ApplicationjsonResponseBody +public record ApplicationjsonResponseBody
+implements [SealedResponseBody](#sealedresponsebody) + +A record class to store response body for contentType="application/json" + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| ApplicationjsonResponseBody(ApplicationjsonSchema.[ApplicationjsonSchema1Boxed](../../../../paths/fakeinlinecomposition/post/responses/code200response/content/applicationjson/ApplicationjsonSchema.md#applicationjsonschema1boxed) body)
Creates an instance | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| ApplicationjsonSchema.[ApplicationjsonSchema1Boxed](../../../../paths/fakeinlinecomposition/post/responses/code200response/content/applicationjson/ApplicationjsonSchema.md#applicationjsonschema1boxed) | body()
returns the body passed in in the constructor | +## MultipartformdataResponseBody +public record MultipartformdataResponseBody
+implements [SealedResponseBody](#sealedresponsebody) + +A record class to store response body for contentType="multipart/form-data" + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| MultipartformdataResponseBody(MultipartformdataSchema.[MultipartformdataSchema1Boxed](../../../../paths/fakeinlinecomposition/post/responses/code200response/content/multipartformdata/MultipartformdataSchema.md#multipartformdataschema1boxed) body)
Creates an instance | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| MultipartformdataSchema.[MultipartformdataSchema1Boxed](../../../../paths/fakeinlinecomposition/post/responses/code200response/content/multipartformdata/MultipartformdataSchema.md#multipartformdataschema1boxed) | body()
returns the body passed in in the constructor | + +## FakeinlinecompositionPostCode200Response1 +public static class FakeinlinecompositionPostCode200Response1
+extends ResponseDeserializer<[SealedResponseBody](#sealedresponsebody), Nothing?, [SealedMediaType](#sealedmediatype)> + +a class that deserializes responses + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| FakeinlinecompositionPostCode200Response1()
Creates an instance | + +### Field Summary +| Modifier and Type | Field and Description | +| ----------------- | --------------------- | +| Map | content = Map.ofEntries(
    new AbstractMap.SimpleEntry<>("application/json", new [ApplicationjsonMediaType](#applicationjsonmediatype)()),
    new AbstractMap.SimpleEntry<>("multipart/form-data", new [MultipartformdataMediaType](#multipartformdatamediatype)())
)
the contentType to schema info | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| ApiResponse<[SealedResponseBody](#sealedresponsebody), Nothing?> | deserialize(HttpResponse response, SchemaConfiguration configuration)
called by endpoint when deserialize responses | diff --git a/samples/client/petstore/kotlin/docs/paths/fakeinlinecomposition/post/responses/code200response/content/applicationjson/ApplicationjsonSchema.md b/samples/client/petstore/kotlin/docs/paths/fakeinlinecomposition/post/responses/code200response/content/applicationjson/ApplicationjsonSchema.md new file mode 100644 index 00000000000..b2cea57a2d7 --- /dev/null +++ b/samples/client/petstore/kotlin/docs/paths/fakeinlinecomposition/post/responses/code200response/content/applicationjson/ApplicationjsonSchema.md @@ -0,0 +1,236 @@ +# ApplicationjsonSchema +public class ApplicationjsonSchema
+ +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 + +## Nested Class Summary +| Modifier and Type | Class and Description | +| ----------------- | ---------------------- | +| sealed interface | [ApplicationjsonSchema.ApplicationjsonSchema1Boxed](#applicationjsonschema1boxed)
sealed interface for validated payloads | +| record | [ApplicationjsonSchema.ApplicationjsonSchema1BoxedVoid](#applicationjsonschema1boxedvoid)
boxed class to store validated null payloads | +| record | [ApplicationjsonSchema.ApplicationjsonSchema1BoxedBoolean](#applicationjsonschema1boxedboolean)
boxed class to store validated boolean payloads | +| record | [ApplicationjsonSchema.ApplicationjsonSchema1BoxedNumber](#applicationjsonschema1boxednumber)
boxed class to store validated Number payloads | +| record | [ApplicationjsonSchema.ApplicationjsonSchema1BoxedString](#applicationjsonschema1boxedstring)
boxed class to store validated String payloads | +| record | [ApplicationjsonSchema.ApplicationjsonSchema1BoxedList](#applicationjsonschema1boxedlist)
boxed class to store validated List payloads | +| record | [ApplicationjsonSchema.ApplicationjsonSchema1BoxedMap](#applicationjsonschema1boxedmap)
boxed class to store validated Map payloads | +| static class | [ApplicationjsonSchema.ApplicationjsonSchema1](#applicationjsonschema1)
schema class | +| sealed interface | [ApplicationjsonSchema.Applicationjson0Boxed](#applicationjson0boxed)
sealed interface for validated payloads | +| record | [ApplicationjsonSchema.Applicationjson0BoxedString](#applicationjson0boxedstring)
boxed class to store validated String payloads | +| static class | [ApplicationjsonSchema.Applicationjson0](#applicationjson0)
schema class | + +## ApplicationjsonSchema1Boxed +public sealed interface ApplicationjsonSchema1Boxed
+permits
+[ApplicationjsonSchema1BoxedVoid](#applicationjsonschema1boxedvoid), +[ApplicationjsonSchema1BoxedBoolean](#applicationjsonschema1boxedboolean), +[ApplicationjsonSchema1BoxedNumber](#applicationjsonschema1boxednumber), +[ApplicationjsonSchema1BoxedString](#applicationjsonschema1boxedstring), +[ApplicationjsonSchema1BoxedList](#applicationjsonschema1boxedlist), +[ApplicationjsonSchema1BoxedMap](#applicationjsonschema1boxedmap) + +sealed interface that stores validated payloads using boxed classes + +## ApplicationjsonSchema1BoxedVoid +public record ApplicationjsonSchema1BoxedVoid
+implements [ApplicationjsonSchema1Boxed](#applicationjsonschema1boxed) + +record that stores validated null payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| ApplicationjsonSchema1BoxedVoid(Nothing? data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| Nothing? | data()
validated payload | +| @Nullable Object | getData()
validated payload | + +## ApplicationjsonSchema1BoxedBoolean +public record ApplicationjsonSchema1BoxedBoolean
+implements [ApplicationjsonSchema1Boxed](#applicationjsonschema1boxed) + +record that stores validated boolean payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| ApplicationjsonSchema1BoxedBoolean(boolean data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| boolean | data()
validated payload | +| @Nullable Object | getData()
validated payload | + +## ApplicationjsonSchema1BoxedNumber +public record ApplicationjsonSchema1BoxedNumber
+implements [ApplicationjsonSchema1Boxed](#applicationjsonschema1boxed) + +record that stores validated Number payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| ApplicationjsonSchema1BoxedNumber(Number data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| Number | data()
validated payload | +| @Nullable Object | getData()
validated payload | + +## ApplicationjsonSchema1BoxedString +public record ApplicationjsonSchema1BoxedString
+implements [ApplicationjsonSchema1Boxed](#applicationjsonschema1boxed) + +record that stores validated String payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| ApplicationjsonSchema1BoxedString(String data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| String | data()
validated payload | +| @Nullable Object | getData()
validated payload | + +## ApplicationjsonSchema1BoxedList +public record ApplicationjsonSchema1BoxedList
+implements [ApplicationjsonSchema1Boxed](#applicationjsonschema1boxed) + +record that stores validated List payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| ApplicationjsonSchema1BoxedList(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 | + +## ApplicationjsonSchema1BoxedMap +public record ApplicationjsonSchema1BoxedMap
+implements [ApplicationjsonSchema1Boxed](#applicationjsonschema1boxed) + +record that stores validated Map payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| ApplicationjsonSchema1BoxedMap(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 | + +## ApplicationjsonSchema1 +public static class ApplicationjsonSchema1
+extends JsonSchema + +A schema class that validates payloads + +### Field Summary +| Modifier and Type | Field and Description | +| ----------------- | ---------------------- | +| List> | allOf = List.of(
    [Applicationjson0.class](#applicationjson0)
;)
| + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| String | validate(String arg, SchemaConfiguration configuration) | +| Nothing? | validate(Nothing? arg, SchemaConfiguration configuration) | +| int | validate(int arg, SchemaConfiguration configuration) | +| long | validate(long arg, SchemaConfiguration configuration) | +| float | validate(float arg, SchemaConfiguration configuration) | +| double | validate(double arg, SchemaConfiguration configuration) | +| Number | validate(Number arg, SchemaConfiguration configuration) | +| boolean | validate(boolean arg, SchemaConfiguration configuration) | +| FrozenMap<@Nullable Object> | validate(Map<?, ?> arg, SchemaConfiguration configuration) | +| FrozenList<@Nullable Object> | validate(List arg, SchemaConfiguration configuration) | +| [ApplicationjsonSchema1BoxedString](#applicationjsonschema1boxedstring) | validateAndBox(String arg, SchemaConfiguration configuration) | +| [ApplicationjsonSchema1BoxedVoid](#applicationjsonschema1boxedvoid) | validateAndBox(Nothing? arg, SchemaConfiguration configuration) | +| [ApplicationjsonSchema1BoxedNumber](#applicationjsonschema1boxednumber) | validateAndBox(Number arg, SchemaConfiguration configuration) | +| [ApplicationjsonSchema1BoxedBoolean](#applicationjsonschema1boxedboolean) | validateAndBox(boolean arg, SchemaConfiguration configuration) | +| [ApplicationjsonSchema1BoxedMap](#applicationjsonschema1boxedmap) | validateAndBox(Map<?, ?> arg, SchemaConfiguration configuration) | +| [ApplicationjsonSchema1BoxedList](#applicationjsonschema1boxedlist) | validateAndBox(List arg, SchemaConfiguration configuration) | +| [ApplicationjsonSchema1Boxed](#applicationjsonschema1boxed) | validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) | +| @Nullable Object | validate(@Nullable Object arg, SchemaConfiguration configuration) | + +## Applicationjson0Boxed +public sealed interface Applicationjson0Boxed
+permits
+[Applicationjson0BoxedString](#applicationjson0boxedstring) + +sealed interface that stores validated payloads using boxed classes + +## Applicationjson0BoxedString +public record Applicationjson0BoxedString
+implements [Applicationjson0Boxed](#applicationjson0boxed) + +record that stores validated String payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| Applicationjson0BoxedString(String data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| String | data()
validated payload | +| @Nullable Object | getData()
validated payload | + +## Applicationjson0 +public static class Applicationjson0
+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.fakeinlinecomposition.post.responses.code200response.content.applicationjson.ApplicationjsonSchema; + +import java.util.Arrays; +import java.util.List; +import java.util.AbstractMap; + +static final SchemaConfiguration configuration = new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().build()); + +// String validation +String validatedPayload = ApplicationjsonSchema.Applicationjson0.validate( + "a", + configuration +); +``` + +### Field Summary +| Modifier and Type | Field and Description | +| ----------------- | ---------------------- | +| Set> | type = Set.of(
    String.class
)
| +| Integer | minLength = 1 | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| String | validate(String arg, SchemaConfiguration configuration) | +| [Applicationjson0BoxedString](#applicationjson0boxedstring) | validateAndBox(String arg, SchemaConfiguration configuration) | +| [Applicationjson0Boxed](#applicationjson0boxed) | validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) | +| @Nullable Object | validate(@Nullable Object arg, SchemaConfiguration configuration) | diff --git a/samples/client/petstore/kotlin/docs/paths/fakeinlinecomposition/post/responses/code200response/content/multipartformdata/MultipartformdataSchema.md b/samples/client/petstore/kotlin/docs/paths/fakeinlinecomposition/post/responses/code200response/content/multipartformdata/MultipartformdataSchema.md new file mode 100644 index 00000000000..717b6b1a45d --- /dev/null +++ b/samples/client/petstore/kotlin/docs/paths/fakeinlinecomposition/post/responses/code200response/content/multipartformdata/MultipartformdataSchema.md @@ -0,0 +1,359 @@ +# MultipartformdataSchema +public class MultipartformdataSchema
+ +A class that contains necessary nested +- schema classes (which validate payloads), extends JsonSchema +- sealed interfaces which store validated payloads, java version of a sum type +- boxed classes which store validated payloads, sealed permits class implementations +- classes to store validated map payloads, extends FrozenMap +- classes to build inputs for map payloads + +## Nested Class Summary +| Modifier and Type | Class and Description | +| ----------------- | ---------------------- | +| sealed interface | [MultipartformdataSchema.MultipartformdataSchema1Boxed](#multipartformdataschema1boxed)
sealed interface for validated payloads | +| record | [MultipartformdataSchema.MultipartformdataSchema1BoxedMap](#multipartformdataschema1boxedmap)
boxed class to store validated Map payloads | +| static class | [MultipartformdataSchema.MultipartformdataSchema1](#multipartformdataschema1)
schema class | +| static class | [MultipartformdataSchema.MultipartformdataSchemaMapBuilder](#multipartformdataschemamapbuilder)
builder for Map payloads | +| static class | [MultipartformdataSchema.MultipartformdataSchemaMap](#multipartformdataschemamap)
output class for Map payloads | +| sealed interface | [MultipartformdataSchema.MultipartformdataSomePropBoxed](#multipartformdatasomepropboxed)
sealed interface for validated payloads | +| record | [MultipartformdataSchema.MultipartformdataSomePropBoxedVoid](#multipartformdatasomepropboxedvoid)
boxed class to store validated null payloads | +| record | [MultipartformdataSchema.MultipartformdataSomePropBoxedBoolean](#multipartformdatasomepropboxedboolean)
boxed class to store validated boolean payloads | +| record | [MultipartformdataSchema.MultipartformdataSomePropBoxedNumber](#multipartformdatasomepropboxednumber)
boxed class to store validated Number payloads | +| record | [MultipartformdataSchema.MultipartformdataSomePropBoxedString](#multipartformdatasomepropboxedstring)
boxed class to store validated String payloads | +| record | [MultipartformdataSchema.MultipartformdataSomePropBoxedList](#multipartformdatasomepropboxedlist)
boxed class to store validated List payloads | +| record | [MultipartformdataSchema.MultipartformdataSomePropBoxedMap](#multipartformdatasomepropboxedmap)
boxed class to store validated Map payloads | +| static class | [MultipartformdataSchema.MultipartformdataSomeProp](#multipartformdatasomeprop)
schema class | +| sealed interface | [MultipartformdataSchema.Multipartformdata0Boxed](#multipartformdata0boxed)
sealed interface for validated payloads | +| record | [MultipartformdataSchema.Multipartformdata0BoxedString](#multipartformdata0boxedstring)
boxed class to store validated String payloads | +| static class | [MultipartformdataSchema.Multipartformdata0](#multipartformdata0)
schema class | + +## MultipartformdataSchema1Boxed +public sealed interface MultipartformdataSchema1Boxed
+permits
+[MultipartformdataSchema1BoxedMap](#multipartformdataschema1boxedmap) + +sealed interface that stores validated payloads using boxed classes + +## MultipartformdataSchema1BoxedMap +public record MultipartformdataSchema1BoxedMap
+implements [MultipartformdataSchema1Boxed](#multipartformdataschema1boxed) + +record that stores validated Map payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| MultipartformdataSchema1BoxedMap([MultipartformdataSchemaMap](#multipartformdataschemamap) data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| [MultipartformdataSchemaMap](#multipartformdataschemamap) | data()
validated payload | +| @Nullable Object | getData()
validated payload | + +## MultipartformdataSchema1 +public static class MultipartformdataSchema1
+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.fakeinlinecomposition.post.responses.code200response.content.multipartformdata.MultipartformdataSchema; + +import java.util.Arrays; +import java.util.List; +import java.util.AbstractMap; + +static final SchemaConfiguration configuration = new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().build()); + +// Map validation +MultipartformdataSchema.MultipartformdataSchemaMap validatedPayload = + MultipartformdataSchema.MultipartformdataSchema1.validate( + new MultipartformdataSchema.MultipartformdataSchemaMapBuilder() + .build(), + configuration +); +``` + +### Field Summary +| Modifier and Type | Field and Description | +| ----------------- | ---------------------- | +| Set> | type = Set.of(Map.class) | +| Map> | properties = Map.ofEntries(
    new PropertyEntry("someProp", [MultipartformdataSomeProp.class](#multipartformdatasomeprop)))
)
| + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| [MultipartformdataSchemaMap](#multipartformdataschemamap) | validate([Map<?, ?>](#multipartformdataschemamapbuilder) arg, SchemaConfiguration configuration) | +| [MultipartformdataSchema1BoxedMap](#multipartformdataschema1boxedmap) | validateAndBox([Map<?, ?>](#multipartformdataschemamapbuilder) arg, SchemaConfiguration configuration) | +| [MultipartformdataSchema1Boxed](#multipartformdataschema1boxed) | validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) | +| @Nullable Object | validate(@Nullable Object arg, SchemaConfiguration configuration) | + +## MultipartformdataSchemaMapBuilder +public class MultipartformdataSchemaMapBuilder
+builder for `Map` + +A class that builds the Map input type + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| MultipartformdataSchemaMapBuilder()
Creates a builder that contains an empty map | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| Map | build()
Returns map input that should be used with Schema.validate | +| [MultipartformdataSchemaMapBuilder](#multipartformdataschemamapbuilder) | someProp(Nothing? value) | +| [MultipartformdataSchemaMapBuilder](#multipartformdataschemamapbuilder) | someProp(boolean value) | +| [MultipartformdataSchemaMapBuilder](#multipartformdataschemamapbuilder) | someProp(String value) | +| [MultipartformdataSchemaMapBuilder](#multipartformdataschemamapbuilder) | someProp(int value) | +| [MultipartformdataSchemaMapBuilder](#multipartformdataschemamapbuilder) | someProp(float value) | +| [MultipartformdataSchemaMapBuilder](#multipartformdataschemamapbuilder) | someProp(long value) | +| [MultipartformdataSchemaMapBuilder](#multipartformdataschemamapbuilder) | someProp(double value) | +| [MultipartformdataSchemaMapBuilder](#multipartformdataschemamapbuilder) | someProp(List value) | +| [MultipartformdataSchemaMapBuilder](#multipartformdataschemamapbuilder) | someProp(Map value) | +| [MultipartformdataSchemaMapBuilder](#multipartformdataschemamapbuilder) | additionalProperty(String key, Nothing? value) | +| [MultipartformdataSchemaMapBuilder](#multipartformdataschemamapbuilder) | additionalProperty(String key, boolean value) | +| [MultipartformdataSchemaMapBuilder](#multipartformdataschemamapbuilder) | additionalProperty(String key, String value) | +| [MultipartformdataSchemaMapBuilder](#multipartformdataschemamapbuilder) | additionalProperty(String key, int value) | +| [MultipartformdataSchemaMapBuilder](#multipartformdataschemamapbuilder) | additionalProperty(String key, float value) | +| [MultipartformdataSchemaMapBuilder](#multipartformdataschemamapbuilder) | additionalProperty(String key, long value) | +| [MultipartformdataSchemaMapBuilder](#multipartformdataschemamapbuilder) | additionalProperty(String key, double value) | +| [MultipartformdataSchemaMapBuilder](#multipartformdataschemamapbuilder) | additionalProperty(String key, List value) | +| [MultipartformdataSchemaMapBuilder](#multipartformdataschemamapbuilder) | additionalProperty(String key, Map value) | + +## MultipartformdataSchemaMap +public static class MultipartformdataSchemaMap
+extends FrozenMap + +A class to store validated Map payloads + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| static [MultipartformdataSchemaMap](#multipartformdataschemamap) | of([Map](#multipartformdataschemamapbuilder) arg, SchemaConfiguration configuration) | +| @Nullable Object | someProp()
[optional] | +| @Nullable Object | getAdditionalProperty(String name)
provides type safety for additional properties | + +## MultipartformdataSomePropBoxed +public sealed interface MultipartformdataSomePropBoxed
+permits
+[MultipartformdataSomePropBoxedVoid](#multipartformdatasomepropboxedvoid), +[MultipartformdataSomePropBoxedBoolean](#multipartformdatasomepropboxedboolean), +[MultipartformdataSomePropBoxedNumber](#multipartformdatasomepropboxednumber), +[MultipartformdataSomePropBoxedString](#multipartformdatasomepropboxedstring), +[MultipartformdataSomePropBoxedList](#multipartformdatasomepropboxedlist), +[MultipartformdataSomePropBoxedMap](#multipartformdatasomepropboxedmap) + +sealed interface that stores validated payloads using boxed classes + +## MultipartformdataSomePropBoxedVoid +public record MultipartformdataSomePropBoxedVoid
+implements [MultipartformdataSomePropBoxed](#multipartformdatasomepropboxed) + +record that stores validated null payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| MultipartformdataSomePropBoxedVoid(Nothing? data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| Nothing? | data()
validated payload | +| @Nullable Object | getData()
validated payload | + +## MultipartformdataSomePropBoxedBoolean +public record MultipartformdataSomePropBoxedBoolean
+implements [MultipartformdataSomePropBoxed](#multipartformdatasomepropboxed) + +record that stores validated boolean payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| MultipartformdataSomePropBoxedBoolean(boolean data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| boolean | data()
validated payload | +| @Nullable Object | getData()
validated payload | + +## MultipartformdataSomePropBoxedNumber +public record MultipartformdataSomePropBoxedNumber
+implements [MultipartformdataSomePropBoxed](#multipartformdatasomepropboxed) + +record that stores validated Number payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| MultipartformdataSomePropBoxedNumber(Number data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| Number | data()
validated payload | +| @Nullable Object | getData()
validated payload | + +## MultipartformdataSomePropBoxedString +public record MultipartformdataSomePropBoxedString
+implements [MultipartformdataSomePropBoxed](#multipartformdatasomepropboxed) + +record that stores validated String payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| MultipartformdataSomePropBoxedString(String data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| String | data()
validated payload | +| @Nullable Object | getData()
validated payload | + +## MultipartformdataSomePropBoxedList +public record MultipartformdataSomePropBoxedList
+implements [MultipartformdataSomePropBoxed](#multipartformdatasomepropboxed) + +record that stores validated List payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| MultipartformdataSomePropBoxedList(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 | + +## MultipartformdataSomePropBoxedMap +public record MultipartformdataSomePropBoxedMap
+implements [MultipartformdataSomePropBoxed](#multipartformdatasomepropboxed) + +record that stores validated Map payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| MultipartformdataSomePropBoxedMap(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 | + +## MultipartformdataSomeProp +public static class MultipartformdataSomeProp
+extends JsonSchema + +A schema class that validates payloads + +### Field Summary +| Modifier and Type | Field and Description | +| ----------------- | ---------------------- | +| List> | allOf = List.of(
    [Multipartformdata0.class](#multipartformdata0)
;)
| + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| String | validate(String arg, SchemaConfiguration configuration) | +| Nothing? | validate(Nothing? arg, SchemaConfiguration configuration) | +| int | validate(int arg, SchemaConfiguration configuration) | +| long | validate(long arg, SchemaConfiguration configuration) | +| float | validate(float arg, SchemaConfiguration configuration) | +| double | validate(double arg, SchemaConfiguration configuration) | +| Number | validate(Number arg, SchemaConfiguration configuration) | +| boolean | validate(boolean arg, SchemaConfiguration configuration) | +| FrozenMap<@Nullable Object> | validate(Map<?, ?> arg, SchemaConfiguration configuration) | +| FrozenList<@Nullable Object> | validate(List arg, SchemaConfiguration configuration) | +| [MultipartformdataSomePropBoxedString](#multipartformdatasomepropboxedstring) | validateAndBox(String arg, SchemaConfiguration configuration) | +| [MultipartformdataSomePropBoxedVoid](#multipartformdatasomepropboxedvoid) | validateAndBox(Nothing? arg, SchemaConfiguration configuration) | +| [MultipartformdataSomePropBoxedNumber](#multipartformdatasomepropboxednumber) | validateAndBox(Number arg, SchemaConfiguration configuration) | +| [MultipartformdataSomePropBoxedBoolean](#multipartformdatasomepropboxedboolean) | validateAndBox(boolean arg, SchemaConfiguration configuration) | +| [MultipartformdataSomePropBoxedMap](#multipartformdatasomepropboxedmap) | validateAndBox(Map<?, ?> arg, SchemaConfiguration configuration) | +| [MultipartformdataSomePropBoxedList](#multipartformdatasomepropboxedlist) | validateAndBox(List arg, SchemaConfiguration configuration) | +| [MultipartformdataSomePropBoxed](#multipartformdatasomepropboxed) | validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) | +| @Nullable Object | validate(@Nullable Object arg, SchemaConfiguration configuration) | + +## Multipartformdata0Boxed +public sealed interface Multipartformdata0Boxed
+permits
+[Multipartformdata0BoxedString](#multipartformdata0boxedstring) + +sealed interface that stores validated payloads using boxed classes + +## Multipartformdata0BoxedString +public record Multipartformdata0BoxedString
+implements [Multipartformdata0Boxed](#multipartformdata0boxed) + +record that stores validated String payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| Multipartformdata0BoxedString(String data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| String | data()
validated payload | +| @Nullable Object | getData()
validated payload | + +## Multipartformdata0 +public static class Multipartformdata0
+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.fakeinlinecomposition.post.responses.code200response.content.multipartformdata.MultipartformdataSchema; + +import java.util.Arrays; +import java.util.List; +import java.util.AbstractMap; + +static final SchemaConfiguration configuration = new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().build()); + +// String validation +String validatedPayload = MultipartformdataSchema.Multipartformdata0.validate( + "a", + configuration +); +``` + +### Field Summary +| Modifier and Type | Field and Description | +| ----------------- | ---------------------- | +| Set> | type = Set.of(
    String.class
)
| +| Integer | minLength = 1 | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| String | validate(String arg, SchemaConfiguration configuration) | +| [Multipartformdata0BoxedString](#multipartformdata0boxedstring) | validateAndBox(String arg, SchemaConfiguration configuration) | +| [Multipartformdata0Boxed](#multipartformdata0boxed) | validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) | +| @Nullable Object | validate(@Nullable Object arg, SchemaConfiguration configuration) | diff --git a/samples/client/petstore/kotlin/docs/paths/fakejsonformdata/FakejsonformdataGet.md b/samples/client/petstore/kotlin/docs/paths/fakejsonformdata/FakejsonformdataGet.md new file mode 100644 index 00000000000..d7cfc4e3192 --- /dev/null +++ b/samples/client/petstore/kotlin/docs/paths/fakejsonformdata/FakejsonformdataGet.md @@ -0,0 +1,146 @@ +# FakejsonformdataGet + +public class FakejsonformdataGet + +A class that contains necessary endpoint classes +- a class that calls the endpoint method using the http verb +- a class that calls the endpoint method using the operationId name +- class(es) to store the request inputs +- builder(s) to set the request input data + +## Nested Class Summary +| Modifier and Type | Class and Description | +| ----------------- | --------------------- | +| static class | [Get](#get)
The class that has a get method to call the endpoint | +| interface | [JsonFormDataOperation](#jsonformdataoperation)
The interface that has a jsonFormData method to call the endpoint | +| static class | [GetRequest](#getrequest)
The request inputs class | +| static class | [GetRequestBuilder](#getrequestbuilder)
A builder for the request input class | + +## Get +public static class Get extends ApiClient.ApiClient1 implements GetOperation
+ +a class that allows one to call the endpoint using a method named get + +### 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.fakejsonformdata.get.FakejsonformdataGetRequestBody; +import org.openapijsonschematools.client.paths.fakejsonformdata.get.requestbody.content.applicationxwwwformurlencoded.ApplicationxwwwformurlencodedSchema; +import org.openapijsonschematools.client.RootServerInfo; +import org.openapijsonschematools.client.servers.RootServer0; +import org.openapijsonschematools.client.servers.RootServer1; +import org.openapijsonschematools.client.servers.RootServer2; +import org.openapijsonschematools.client.paths.fakejsonformdata.get.responses.FakejsonformdataGetCode200Response; +import org.openapijsonschematools.client.servers.RootServerInfo; +import org.openapijsonschematools.client.paths.fakejsonformdata.FakejsonformdataGet; +import org.openapijsonschematools.client.paths.fakejsonformdata.get.FakejsonformdataGetResponses; + +import java.io.IOException; +import java.util.Arrays; +import java.util.List; +import java.util.Map; +import java.util.AbstractMap; + +// if you want to use a server that is not SERVER_0 pass it in here and change the ServerIndex input below +ApiConfiguration.ServerInfo serverInfo = new ApiConfiguration.ServerInfoBuilder() + .rootServerInfo( + new RootServerInfo.RootServerInfoBuilder() + .rootServer0(new RootServer0()) + .build() + ) + .build(); +ApiConfiguration.ServerIndexInfo serverIndexInfo = new ApiConfiguration.ServerIndexInfoBuilder() + .rootServerInfoServerIndex(RootServerInfo.ServerIndex.SERVER_0) + .build(); +Duration timeout = Duration.ofSeconds(1L); +Map> defaultHeaders = Map.of("User-Agent", List.of("OpenAPI-JSON-Schema-Generator/1.0.0/java")); +ApiConfiguration apiConfiguration = new ApiConfiguration( + serverInfo + serverIndexInfo, + timeout, + defaultHeaders +); +SchemaConfiguration schemaConfiguration = new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().build()); +FakejsonformdataGet.Get apiClient = new FakejsonformdataGet.Get(apiConfiguration, schemaConfiguration); + + +var request = new FakejsonformdataGet.GetRequestBuilder().build(); + +FakejsonformdataGetResponses.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; +} +FakejsonformdataGetResponses.EndpointFakejsonformdataGetCode200Response castResponse = (FakejsonformdataGetResponses.EndpointFakejsonformdataGetCode200Response) response; +``` +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| Get(ApiConfiguration apiConfiguration, SchemaConfiguration schemaConfiguration)
Creates an instance | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| [FakejsonformdataGetResponses.EndpointResponse](../../paths/fakejsonformdata/get/FakejsonformdataGetResponses.md#endpointresponse) | get([GetRequest](#getrequest) request) | + +## JsonFormDataOperation +public interface JsonFormDataOperation
+ +an interface that allows one to call the endpoint using a method named jsonFormData by the operationId + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| [FakejsonformdataGetResponses.EndpointResponse](../../paths/fakejsonformdata/get/FakejsonformdataGetResponses.md#endpointresponse) | jsonFormData([GetRequest](#getrequest) request) | + +## GetRequest +public static class GetRequest
+ +a class that stores the final request inputs + +### Field Summary +| Modifier and Type | Field and Description | +| ----------------- | --------------------- | +| [FakejsonformdataGetRequestBody.@Nullable SealedRequestBody](../../paths/fakejsonformdata/get/FakejsonformdataGetRequestBody.md#sealedrequestbody) | requestBody
optional | +| [RootServerInfo.@Nullable ServerIndex](../../RootServerInfo.md#serverindex) | serverIndex
optional. Note: this will override the value in apiConfiguration | +| @Nullable Duration | timeout
optional. Note: this will override the value in apiConfiguration | + +## GetRequestBuilder +public static class GetRequestBuilder
+ +a builder for request inputs + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| GetRequestBuilder()
Creates a builder that contains null for all parameters | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| [GetRequest](#getrequest) | build()
Returns the request input used to call an endpoint method | +| [GetRequestBuilder](#getrequestbuilder) | requestBody([FakejsonformdataGetRequestBody.SealedRequestBody](../../paths/fakejsonformdata/get/FakejsonformdataGetRequestBody.md#sealedrequestbody) requestBody)
sets the optional property | +| [GetRequestBuilder](#getrequestbuilder) | serverIndex([RootServerInfo.ServerIndex](../../RootServerInfo.md#serverindex) serverIndex)
sets the optional property. Note: this will override the value in apiConfiguration | +| [GetRequestBuilder](#getrequestbuilder) | timeout(Duration timeout)
sets the optional property. Note: this will override the value in apiConfiguration | + +[[Back to top]](#top) [[Back to README]](../../../README.md) diff --git a/samples/client/petstore/kotlin/docs/paths/fakejsonformdata/get/FakejsonformdataGetRequestBody.md b/samples/client/petstore/kotlin/docs/paths/fakejsonformdata/get/FakejsonformdataGetRequestBody.md new file mode 100644 index 00000000000..8480a0cda2e --- /dev/null +++ b/samples/client/petstore/kotlin/docs/paths/fakejsonformdata/get/FakejsonformdataGetRequestBody.md @@ -0,0 +1,90 @@ +# FakejsonformdataGetRequestBody + +public class FakejsonformdataGetRequestBody + +A class that contains necessary nested request body classes +- SealedMediaType, a sealed interface which contains all the schema/encoding info for each contentType +- records which implement SealedMediaType, the concrete media types +- a class that extends RequestBodySerializer and is used to serialize input SealedRequestBody instances +- SealedRequestBody, a sealed interface which contains all the contentType/schema input types +- records which implement SealedRequestBody, the concrete request body types + +## Nested Class Summary +| Modifier and Type | Class and Description | +| ----------------- | --------------------- | +| sealed interface | [FakejsonformdataGetRequestBody.SealedMediaType](#sealedmediatype)
media type sealed interface | +| record | [FakejsonformdataGetRequestBody.ApplicationxwwwformurlencodedMediaType](#applicationxwwwformurlencodedmediatype)
record storing schema + encoding for a specific contentType | +| static class | [FakejsonformdataGetRequestBody.FakejsonformdataGetRequestBody1](#fakejsonformdatagetrequestbody1)
class that serializes request bodies | +| sealed interface | [FakejsonformdataGetRequestBody.SealedRequestBody](#sealedrequestbody)
request body sealed interface | +| record | [FakejsonformdataGetRequestBody.ApplicationxwwwformurlencodedRequestBody](#applicationxwwwformurlencodedrequestbody)
implements sealed interface to store request body input | + +## SealedMediaType +public sealed interface SealedMediaType
+permits
+[ApplicationxwwwformurlencodedMediaType](#applicationxwwwformurlencodedmediatype) + +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), Nothing?> + +class storing schema info for a specific contentType + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| ApplicationxwwwformurlencodedMediaType()
Creates an instance | + +### 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 | +| Nothing? | encoding()
the encoding info | + +## FakejsonformdataGetRequestBody1 +public static class FakejsonformdataGetRequestBody1
+ +a class that serializes SealedRequestBody request bodies + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| FakejsonformdataGetRequestBody1()
Creates an instance | + +### Field Summary +| Modifier and Type | Field and Description | +| ----------------- | --------------------- | +| boolean | required = false
whether the request body is required | +| Map | content = Map.ofEntries(
    new AbstractMap.SimpleEntry<>("application/x-www-form-urlencoded", new [ApplicationxwwwformurlencodedMediaType](#applicationxwwwformurlencodedmediatype)())
)
the contentType to schema info | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| SerializedRequestBody | serialize([SealedRequestBody](#sealedrequestbody) requestBody)
called by endpoint when creating request body bytes | + +## SealedRequestBody +public sealed interface SealedRequestBody
+permits
+[ApplicationxwwwformurlencodedRequestBody](#applicationxwwwformurlencodedrequestbody) + +sealed interface that stores request contentType + validated schema data + +## ApplicationxwwwformurlencodedRequestBody +public record ApplicationxwwwformurlencodedRequestBody
+implements [SealedRequestBody](#sealedrequestbody),
+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 | + +### 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 | diff --git a/samples/client/petstore/kotlin/docs/paths/fakejsonformdata/get/FakejsonformdataGetResponses.md b/samples/client/petstore/kotlin/docs/paths/fakejsonformdata/get/FakejsonformdataGetResponses.md new file mode 100644 index 00000000000..0dca33e8171 --- /dev/null +++ b/samples/client/petstore/kotlin/docs/paths/fakejsonformdata/get/FakejsonformdataGetResponses.md @@ -0,0 +1,29 @@ +# FakejsonformdataGetResponses + +public class FakejsonformdataGetResponses + +A class that contains necessary responses classes +- a sealed interface, EndpointResponse, that stores endpoint responses +- records for each endpoint response + +## Nested Class Summary +| Modifier and Type | Class and Description | +| ----------------- | --------------------- | +| sealed interface | [EndpointResponse](#endpointresponse)
stores the endpoint responses | +| record | [EndpointFakejsonformdataGetCode200Response](#endpointfakejsonformdatagetcode200response)
the response for 200 | + +## EndpointResponse +public sealed interface EndpointResponse permits
+[EndpointFakejsonformdataGetCode200Response](#endpointfakejsonformdatagetcode200response) + +a sealed interface that stores endpoint responses + +## EndpointFakejsonformdataGetCode200Response +public record EndpointFakejsonformdataGetCode200Response( + HttpResponse response, + Nothing? body, + Nothing? headers +) implements EndpointResponse, ApiResponse
+ +a class that stores an endpoint response + diff --git a/samples/client/petstore/kotlin/docs/paths/fakejsonformdata/get/requestbody/content/applicationxwwwformurlencoded/ApplicationxwwwformurlencodedSchema.md b/samples/client/petstore/kotlin/docs/paths/fakejsonformdata/get/requestbody/content/applicationxwwwformurlencoded/ApplicationxwwwformurlencodedSchema.md new file mode 100644 index 00000000000..94222eb71d4 --- /dev/null +++ b/samples/client/petstore/kotlin/docs/paths/fakejsonformdata/get/requestbody/content/applicationxwwwformurlencoded/ApplicationxwwwformurlencodedSchema.md @@ -0,0 +1,262 @@ +# ApplicationxwwwformurlencodedSchema +public class ApplicationxwwwformurlencodedSchema
+ +A class that contains necessary nested +- schema classes (which validate payloads), extends JsonSchema +- sealed interfaces which store validated payloads, java version of a sum type +- boxed classes which store validated payloads, sealed permits class implementations +- classes to store validated map payloads, extends FrozenMap +- classes to build inputs for map payloads + +## Nested Class Summary +| Modifier and Type | Class and Description | +| ----------------- | ---------------------- | +| sealed interface | [ApplicationxwwwformurlencodedSchema.ApplicationxwwwformurlencodedSchema1Boxed](#applicationxwwwformurlencodedschema1boxed)
sealed interface for validated payloads | +| record | [ApplicationxwwwformurlencodedSchema.ApplicationxwwwformurlencodedSchema1BoxedMap](#applicationxwwwformurlencodedschema1boxedmap)
boxed class to store validated Map payloads | +| static class | [ApplicationxwwwformurlencodedSchema.ApplicationxwwwformurlencodedSchema1](#applicationxwwwformurlencodedschema1)
schema class | +| static class | [ApplicationxwwwformurlencodedSchema.ApplicationxwwwformurlencodedSchemaMapBuilder](#applicationxwwwformurlencodedschemamapbuilder)
builder for Map payloads | +| static class | [ApplicationxwwwformurlencodedSchema.ApplicationxwwwformurlencodedSchemaMap](#applicationxwwwformurlencodedschemamap)
output class for Map payloads | +| sealed interface | [ApplicationxwwwformurlencodedSchema.ApplicationxwwwformurlencodedParam2Boxed](#applicationxwwwformurlencodedparam2boxed)
sealed interface for validated payloads | +| record | [ApplicationxwwwformurlencodedSchema.ApplicationxwwwformurlencodedParam2BoxedString](#applicationxwwwformurlencodedparam2boxedstring)
boxed class to store validated String payloads | +| static class | [ApplicationxwwwformurlencodedSchema.ApplicationxwwwformurlencodedParam2](#applicationxwwwformurlencodedparam2)
schema class | +| sealed interface | [ApplicationxwwwformurlencodedSchema.ApplicationxwwwformurlencodedParamBoxed](#applicationxwwwformurlencodedparamboxed)
sealed interface for validated payloads | +| record | [ApplicationxwwwformurlencodedSchema.ApplicationxwwwformurlencodedParamBoxedString](#applicationxwwwformurlencodedparamboxedstring)
boxed class to store validated String payloads | +| static class | [ApplicationxwwwformurlencodedSchema.ApplicationxwwwformurlencodedParam](#applicationxwwwformurlencodedparam)
schema class | + +## ApplicationxwwwformurlencodedSchema1Boxed +public sealed interface ApplicationxwwwformurlencodedSchema1Boxed
+permits
+[ApplicationxwwwformurlencodedSchema1BoxedMap](#applicationxwwwformurlencodedschema1boxedmap) + +sealed interface that stores validated payloads using boxed classes + +## ApplicationxwwwformurlencodedSchema1BoxedMap +public record ApplicationxwwwformurlencodedSchema1BoxedMap
+implements [ApplicationxwwwformurlencodedSchema1Boxed](#applicationxwwwformurlencodedschema1boxed) + +record that stores validated Map payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| ApplicationxwwwformurlencodedSchema1BoxedMap([ApplicationxwwwformurlencodedSchemaMap](#applicationxwwwformurlencodedschemamap) data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| [ApplicationxwwwformurlencodedSchemaMap](#applicationxwwwformurlencodedschemamap) | data()
validated payload | +| @Nullable Object | getData()
validated payload | + +## ApplicationxwwwformurlencodedSchema1 +public static class ApplicationxwwwformurlencodedSchema1
+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.fakejsonformdata.get.requestbody.content.applicationxwwwformurlencoded.ApplicationxwwwformurlencodedSchema; + +import java.util.Arrays; +import java.util.List; +import java.util.AbstractMap; + +static final SchemaConfiguration configuration = new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().build()); + +// Map validation +ApplicationxwwwformurlencodedSchema.ApplicationxwwwformurlencodedSchemaMap validatedPayload = + ApplicationxwwwformurlencodedSchema.ApplicationxwwwformurlencodedSchema1.validate( + new ApplicationxwwwformurlencodedSchema.ApplicationxwwwformurlencodedSchemaMapBuilder() + .param("a") + + .param2("a") + + .build(), + configuration +); +``` + +### Field Summary +| Modifier and Type | Field and Description | +| ----------------- | ---------------------- | +| Set> | type = Set.of(Map.class) | +| Map> | properties = Map.ofEntries(
    new PropertyEntry("param", [ApplicationxwwwformurlencodedParam.class](#applicationxwwwformurlencodedparam))),
    new PropertyEntry("param2", [ApplicationxwwwformurlencodedParam2.class](#applicationxwwwformurlencodedparam2)))
)
| +| Set | required = Set.of(
    "param",
    "param2"
)
| + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| [ApplicationxwwwformurlencodedSchemaMap](#applicationxwwwformurlencodedschemamap) | validate([Map<?, ?>](#applicationxwwwformurlencodedschemamapbuilder) arg, SchemaConfiguration configuration) | +| [ApplicationxwwwformurlencodedSchema1BoxedMap](#applicationxwwwformurlencodedschema1boxedmap) | validateAndBox([Map<?, ?>](#applicationxwwwformurlencodedschemamapbuilder) arg, SchemaConfiguration configuration) | +| [ApplicationxwwwformurlencodedSchema1Boxed](#applicationxwwwformurlencodedschema1boxed) | validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) | +| @Nullable Object | validate(@Nullable Object arg, SchemaConfiguration configuration) | + +## ApplicationxwwwformurlencodedSchemaMap00Builder +public class ApplicationxwwwformurlencodedSchemaMap00Builder
+builder for `Map` + +A class that builds the Map input type + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| ApplicationxwwwformurlencodedSchemaMap00Builder(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 | +| [ApplicationxwwwformurlencodedSchemaMap00Builder](#applicationxwwwformurlencodedschemamap00builder) | additionalProperty(String key, Nothing? value) | +| [ApplicationxwwwformurlencodedSchemaMap00Builder](#applicationxwwwformurlencodedschemamap00builder) | additionalProperty(String key, boolean value) | +| [ApplicationxwwwformurlencodedSchemaMap00Builder](#applicationxwwwformurlencodedschemamap00builder) | additionalProperty(String key, String value) | +| [ApplicationxwwwformurlencodedSchemaMap00Builder](#applicationxwwwformurlencodedschemamap00builder) | additionalProperty(String key, int value) | +| [ApplicationxwwwformurlencodedSchemaMap00Builder](#applicationxwwwformurlencodedschemamap00builder) | additionalProperty(String key, float value) | +| [ApplicationxwwwformurlencodedSchemaMap00Builder](#applicationxwwwformurlencodedschemamap00builder) | additionalProperty(String key, long value) | +| [ApplicationxwwwformurlencodedSchemaMap00Builder](#applicationxwwwformurlencodedschemamap00builder) | additionalProperty(String key, double value) | +| [ApplicationxwwwformurlencodedSchemaMap00Builder](#applicationxwwwformurlencodedschemamap00builder) | additionalProperty(String key, List value) | +| [ApplicationxwwwformurlencodedSchemaMap00Builder](#applicationxwwwformurlencodedschemamap00builder) | additionalProperty(String key, Map value) | + +## ApplicationxwwwformurlencodedSchemaMap01Builder +public class ApplicationxwwwformurlencodedSchemaMap01Builder
+builder for `Map` + +A class that builds the Map input type + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| ApplicationxwwwformurlencodedSchemaMap01Builder(Map instance)
Creates a builder that contains the passed instance | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| [ApplicationxwwwformurlencodedSchemaMap00Builder](#applicationxwwwformurlencodedschemamap00builder) | param2(String value) | + +## ApplicationxwwwformurlencodedSchemaMap10Builder +public class ApplicationxwwwformurlencodedSchemaMap10Builder
+builder for `Map` + +A class that builds the Map input type + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| ApplicationxwwwformurlencodedSchemaMap10Builder(Map instance)
Creates a builder that contains the passed instance | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| [ApplicationxwwwformurlencodedSchemaMap00Builder](#applicationxwwwformurlencodedschemamap00builder) | param(String value) | + +## ApplicationxwwwformurlencodedSchemaMapBuilder +public class ApplicationxwwwformurlencodedSchemaMapBuilder
+builder for `Map` + +A class that builds the Map input type + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| ApplicationxwwwformurlencodedSchemaMapBuilder()
Creates a builder that contains an empty map | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| [ApplicationxwwwformurlencodedSchemaMap01Builder](#applicationxwwwformurlencodedschemamap01builder) | param(String value) | +| [ApplicationxwwwformurlencodedSchemaMap10Builder](#applicationxwwwformurlencodedschemamap10builder) | param2(String value) | + +## ApplicationxwwwformurlencodedSchemaMap +public static class ApplicationxwwwformurlencodedSchemaMap
+extends FrozenMap + +A class to store validated Map payloads + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| static [ApplicationxwwwformurlencodedSchemaMap](#applicationxwwwformurlencodedschemamap) | of([Map](#applicationxwwwformurlencodedschemamapbuilder) arg, SchemaConfiguration configuration) | +| String | param()
| +| String | param2()
| +| @Nullable Object | getAdditionalProperty(String name)
provides type safety for additional properties | + +## ApplicationxwwwformurlencodedParam2Boxed +public sealed interface ApplicationxwwwformurlencodedParam2Boxed
+permits
+[ApplicationxwwwformurlencodedParam2BoxedString](#applicationxwwwformurlencodedparam2boxedstring) + +sealed interface that stores validated payloads using boxed classes + +## ApplicationxwwwformurlencodedParam2BoxedString +public record ApplicationxwwwformurlencodedParam2BoxedString
+implements [ApplicationxwwwformurlencodedParam2Boxed](#applicationxwwwformurlencodedparam2boxed) + +record that stores validated String payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| ApplicationxwwwformurlencodedParam2BoxedString(String data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| String | data()
validated payload | +| @Nullable Object | getData()
validated payload | + +## ApplicationxwwwformurlencodedParam2 +public static class ApplicationxwwwformurlencodedParam2
+extends StringJsonSchema.StringJsonSchema1 + +A schema class that validates payloads + +## Description +field2 + +| Methods Inherited from class org.openapijsonschematools.client.schemas.StringJsonSchema.StringJsonSchema1 | +| ------------------------------------------------------------------ | +| validate | +| validateAndBox | + +## ApplicationxwwwformurlencodedParamBoxed +public sealed interface ApplicationxwwwformurlencodedParamBoxed
+permits
+[ApplicationxwwwformurlencodedParamBoxedString](#applicationxwwwformurlencodedparamboxedstring) + +sealed interface that stores validated payloads using boxed classes + +## ApplicationxwwwformurlencodedParamBoxedString +public record ApplicationxwwwformurlencodedParamBoxedString
+implements [ApplicationxwwwformurlencodedParamBoxed](#applicationxwwwformurlencodedparamboxed) + +record that stores validated String payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| ApplicationxwwwformurlencodedParamBoxedString(String data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| String | data()
validated payload | +| @Nullable Object | getData()
validated payload | + +## ApplicationxwwwformurlencodedParam +public static class ApplicationxwwwformurlencodedParam
+extends StringJsonSchema.StringJsonSchema1 + +A schema class that validates payloads + +## Description +field1 + +| Methods Inherited from class org.openapijsonschematools.client.schemas.StringJsonSchema.StringJsonSchema1 | +| ------------------------------------------------------------------ | +| validate | +| validateAndBox | diff --git a/samples/client/petstore/kotlin/docs/paths/fakejsonformdata/get/responses/FakejsonformdataGetCode200Response.md b/samples/client/petstore/kotlin/docs/paths/fakejsonformdata/get/responses/FakejsonformdataGetCode200Response.md new file mode 100644 index 00000000000..c7ae900e122 --- /dev/null +++ b/samples/client/petstore/kotlin/docs/paths/fakejsonformdata/get/responses/FakejsonformdataGetCode200Response.md @@ -0,0 +1,17 @@ +# FakejsonformdataGetCode200Response + +public class FakejsonformdataGetCode200Response extends [SuccessDescriptionOnly](../../components/responses/SuccessDescriptionOnly.md) + +A class (extended from the $ref class) that contains necessary nested response classes +- a class that extends ResponseDeserializer and is used to deserialize responses + +## Nested Class Summary +| Modifier and Type | Class and Description | +| ----------------- | --------------------- | +| static class | [FakejsonformdataGetCode200Response.FakejsonformdataGetCode200Response1](#fakejsonformdatagetcode200response1)
class that deserializes responses | + +## FakejsonformdataGetCode200Response1 +public static class FakejsonformdataGetCode200Response1 extends [SuccessDescriptionOnly1](../../components/responses/SuccessDescriptionOnly.md#successdescriptiononly1)
+ +a class that deserializes responses, extended from the $ref class + diff --git a/samples/client/petstore/kotlin/docs/paths/fakejsonpatch/FakejsonpatchPatch.md b/samples/client/petstore/kotlin/docs/paths/fakejsonpatch/FakejsonpatchPatch.md new file mode 100644 index 00000000000..28d3b8c040d --- /dev/null +++ b/samples/client/petstore/kotlin/docs/paths/fakejsonpatch/FakejsonpatchPatch.md @@ -0,0 +1,146 @@ +# FakejsonpatchPatch + +public class FakejsonpatchPatch + +A class that contains necessary endpoint classes +- a class that calls the endpoint method using the http verb +- a class that calls the endpoint method using the operationId name +- class(es) to store the request inputs +- builder(s) to set the request input data + +## Nested Class Summary +| Modifier and Type | Class and Description | +| ----------------- | --------------------- | +| static class | [Patch](#patch)
The class that has a patch method to call the endpoint | +| interface | [JsonPatchOperation](#jsonpatchoperation)
The interface that has a jsonPatch method to call the endpoint | +| static class | [PatchRequest](#patchrequest)
The request inputs class | +| static class | [PatchRequestBuilder](#patchrequestbuilder)
A builder for the request input class | + +## Patch +public static class Patch extends ApiClient.ApiClient1 implements PatchOperation
+ +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.FakejsonpatchPatchRequestBody; +import org.openapijsonschematools.client.components.schemas.JSONPatchRequest; +import org.openapijsonschematools.client.RootServerInfo; +import org.openapijsonschematools.client.servers.RootServer0; +import org.openapijsonschematools.client.servers.RootServer1; +import org.openapijsonschematools.client.servers.RootServer2; +import org.openapijsonschematools.client.paths.fakejsonpatch.patch.responses.FakejsonpatchPatchCode200Response; +import org.openapijsonschematools.client.servers.RootServerInfo; +import org.openapijsonschematools.client.paths.fakejsonpatch.FakejsonpatchPatch; +import org.openapijsonschematools.client.paths.fakejsonpatch.patch.FakejsonpatchPatchResponses; + +import java.io.IOException; +import java.util.Arrays; +import java.util.List; +import java.util.Map; +import java.util.AbstractMap; + +// if you want to use a server that is not SERVER_0 pass it in here and change the ServerIndex input below +ApiConfiguration.ServerInfo serverInfo = new ApiConfiguration.ServerInfoBuilder() + .rootServerInfo( + new RootServerInfo.RootServerInfoBuilder() + .rootServer0(new RootServer0()) + .build() + ) + .build(); +ApiConfiguration.ServerIndexInfo serverIndexInfo = new ApiConfiguration.ServerIndexInfoBuilder() + .rootServerInfoServerIndex(RootServerInfo.ServerIndex.SERVER_0) + .build(); +Duration timeout = Duration.ofSeconds(1L); +Map> defaultHeaders = Map.of("User-Agent", List.of("OpenAPI-JSON-Schema-Generator/1.0.0/java")); +ApiConfiguration apiConfiguration = new ApiConfiguration( + serverInfo + serverIndexInfo, + timeout, + defaultHeaders +); +SchemaConfiguration schemaConfiguration = new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().build()); +FakejsonpatchPatch.Patch apiClient = new FakejsonpatchPatch.Patch(apiConfiguration, schemaConfiguration); + + +var request = new FakejsonpatchPatch.PatchRequestBuilder().build(); + +FakejsonpatchPatchResponses.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; +} +FakejsonpatchPatchResponses.EndpointFakejsonpatchPatchCode200Response castResponse = (FakejsonpatchPatchResponses.EndpointFakejsonpatchPatchCode200Response) response; +``` +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| Patch(ApiConfiguration apiConfiguration, SchemaConfiguration schemaConfiguration)
Creates an instance | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| [FakejsonpatchPatchResponses.EndpointResponse](../../paths/fakejsonpatch/patch/FakejsonpatchPatchResponses.md#endpointresponse) | patch([PatchRequest](#patchrequest) request) | + +## JsonPatchOperation +public interface JsonPatchOperation
+ +an interface that allows one to call the endpoint using a method named jsonPatch by the operationId + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| [FakejsonpatchPatchResponses.EndpointResponse](../../paths/fakejsonpatch/patch/FakejsonpatchPatchResponses.md#endpointresponse) | jsonPatch([PatchRequest](#patchrequest) request) | + +## PatchRequest +public static class PatchRequest
+ +a class that stores the final request inputs + +### Field Summary +| Modifier and Type | Field and Description | +| ----------------- | --------------------- | +| [FakejsonpatchPatchRequestBody.@Nullable SealedRequestBody](../../paths/fakejsonpatch/patch/FakejsonpatchPatchRequestBody.md#sealedrequestbody) | requestBody
optional | +| [RootServerInfo.@Nullable ServerIndex](../../RootServerInfo.md#serverindex) | serverIndex
optional. Note: this will override the value in apiConfiguration | +| @Nullable Duration | timeout
optional. Note: this will override the value in apiConfiguration | + +## PatchRequestBuilder +public static class PatchRequestBuilder
+ +a builder for request inputs + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| PatchRequestBuilder()
Creates a builder that contains null for all parameters | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| [PatchRequest](#patchrequest) | build()
Returns the request input used to call an endpoint method | +| [PatchRequestBuilder](#patchrequestbuilder) | requestBody([FakejsonpatchPatchRequestBody.SealedRequestBody](../../paths/fakejsonpatch/patch/FakejsonpatchPatchRequestBody.md#sealedrequestbody) requestBody)
sets the optional property | +| [PatchRequestBuilder](#patchrequestbuilder) | serverIndex([RootServerInfo.ServerIndex](../../RootServerInfo.md#serverindex) serverIndex)
sets the optional property. Note: this will override the value in apiConfiguration | +| [PatchRequestBuilder](#patchrequestbuilder) | timeout(Duration timeout)
sets the optional property. Note: this will override the value in apiConfiguration | + +[[Back to top]](#top) [[Back to README]](../../../README.md) diff --git a/samples/client/petstore/kotlin/docs/paths/fakejsonpatch/patch/FakejsonpatchPatchRequestBody.md b/samples/client/petstore/kotlin/docs/paths/fakejsonpatch/patch/FakejsonpatchPatchRequestBody.md new file mode 100644 index 00000000000..2dafa6d19b3 --- /dev/null +++ b/samples/client/petstore/kotlin/docs/paths/fakejsonpatch/patch/FakejsonpatchPatchRequestBody.md @@ -0,0 +1,90 @@ +# FakejsonpatchPatchRequestBody + +public class FakejsonpatchPatchRequestBody + +A class that contains necessary nested request body classes +- SealedMediaType, a sealed interface which contains all the schema/encoding info for each contentType +- records which implement SealedMediaType, the concrete media types +- a class that extends RequestBodySerializer and is used to serialize input SealedRequestBody instances +- SealedRequestBody, a sealed interface which contains all the contentType/schema input types +- records which implement SealedRequestBody, the concrete request body types + +## Nested Class Summary +| Modifier and Type | Class and Description | +| ----------------- | --------------------- | +| sealed interface | [FakejsonpatchPatchRequestBody.SealedMediaType](#sealedmediatype)
media type sealed interface | +| record | [FakejsonpatchPatchRequestBody.ApplicationjsonpatchjsonMediaType](#applicationjsonpatchjsonmediatype)
record storing schema + encoding for a specific contentType | +| static class | [FakejsonpatchPatchRequestBody.FakejsonpatchPatchRequestBody1](#fakejsonpatchpatchrequestbody1)
class that serializes request bodies | +| sealed interface | [FakejsonpatchPatchRequestBody.SealedRequestBody](#sealedrequestbody)
request body sealed interface | +| record | [FakejsonpatchPatchRequestBody.ApplicationjsonpatchjsonRequestBody](#applicationjsonpatchjsonrequestbody)
implements sealed interface to store request body input | + +## SealedMediaType +public sealed interface SealedMediaType
+permits
+[ApplicationjsonpatchjsonMediaType](#applicationjsonpatchjsonmediatype) + +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), Nothing?> + +class storing schema info for a specific contentType + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| ApplicationjsonpatchjsonMediaType()
Creates an instance | + +### 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 | +| Nothing? | encoding()
the encoding info | + +## FakejsonpatchPatchRequestBody1 +public static class FakejsonpatchPatchRequestBody1
+ +a class that serializes SealedRequestBody request bodies + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| FakejsonpatchPatchRequestBody1()
Creates an instance | + +### Field Summary +| Modifier and Type | Field and Description | +| ----------------- | --------------------- | +| boolean | required = false
whether the request body is required | +| Map | content = Map.ofEntries(
    new AbstractMap.SimpleEntry<>("application/json-patch+json", new [ApplicationjsonpatchjsonMediaType](#applicationjsonpatchjsonmediatype)())
)
the contentType to schema info | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| SerializedRequestBody | serialize([SealedRequestBody](#sealedrequestbody) requestBody)
called by endpoint when creating request body bytes | + +## SealedRequestBody +public sealed interface SealedRequestBody
+permits
+[ApplicationjsonpatchjsonRequestBody](#applicationjsonpatchjsonrequestbody) + +sealed interface that stores request contentType + validated schema data + +## ApplicationjsonpatchjsonRequestBody +public record ApplicationjsonpatchjsonRequestBody
+implements [SealedRequestBody](#sealedrequestbody),
+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 | + +### 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 | diff --git a/samples/client/petstore/kotlin/docs/paths/fakejsonpatch/patch/FakejsonpatchPatchResponses.md b/samples/client/petstore/kotlin/docs/paths/fakejsonpatch/patch/FakejsonpatchPatchResponses.md new file mode 100644 index 00000000000..8f0e60d3c15 --- /dev/null +++ b/samples/client/petstore/kotlin/docs/paths/fakejsonpatch/patch/FakejsonpatchPatchResponses.md @@ -0,0 +1,29 @@ +# FakejsonpatchPatchResponses + +public class FakejsonpatchPatchResponses + +A class that contains necessary responses classes +- a sealed interface, EndpointResponse, that stores endpoint responses +- records for each endpoint response + +## Nested Class Summary +| Modifier and Type | Class and Description | +| ----------------- | --------------------- | +| sealed interface | [EndpointResponse](#endpointresponse)
stores the endpoint responses | +| record | [EndpointFakejsonpatchPatchCode200Response](#endpointfakejsonpatchpatchcode200response)
the response for 200 | + +## EndpointResponse +public sealed interface EndpointResponse permits
+[EndpointFakejsonpatchPatchCode200Response](#endpointfakejsonpatchpatchcode200response) + +a sealed interface that stores endpoint responses + +## EndpointFakejsonpatchPatchCode200Response +public record EndpointFakejsonpatchPatchCode200Response( + HttpResponse response, + Nothing? body, + Nothing? headers +) implements EndpointResponse, ApiResponse
+ +a class that stores an endpoint response + diff --git a/samples/client/petstore/kotlin/docs/paths/fakejsonpatch/patch/requestbody/content/applicationjsonpatchjson/ApplicationjsonpatchjsonSchema.md b/samples/client/petstore/kotlin/docs/paths/fakejsonpatch/patch/requestbody/content/applicationjsonpatchjson/ApplicationjsonpatchjsonSchema.md new file mode 100644 index 00000000000..c8f50418586 --- /dev/null +++ b/samples/client/petstore/kotlin/docs/paths/fakejsonpatch/patch/requestbody/content/applicationjsonpatchjson/ApplicationjsonpatchjsonSchema.md @@ -0,0 +1,19 @@ +# ApplicationjsonpatchjsonSchema +public class ApplicationjsonpatchjsonSchema
+extends [JSONPatchRequest1](../../../../../../components/schemas/JSONPatchRequest.md#jsonpatchrequest) + +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 + +## Nested Class Summary +| Modifier and Type | Class and Description | +| ----------------- | ---------------------- | +| static class | [ApplicationjsonpatchjsonSchema.ApplicationjsonpatchjsonSchema1](#applicationjsonpatchjsonschema1)
schema class | + +## ApplicationjsonpatchjsonSchema1 +public static class ApplicationjsonpatchjsonSchema1
+extends [JSONPatchRequest.JSONPatchRequest1](../../../../../../components/schemas/JSONPatchRequest.md#jsonpatchrequest1) + +A schema class that validates payloads diff --git a/samples/client/petstore/kotlin/docs/paths/fakejsonpatch/patch/responses/FakejsonpatchPatchCode200Response.md b/samples/client/petstore/kotlin/docs/paths/fakejsonpatch/patch/responses/FakejsonpatchPatchCode200Response.md new file mode 100644 index 00000000000..72f6aff6618 --- /dev/null +++ b/samples/client/petstore/kotlin/docs/paths/fakejsonpatch/patch/responses/FakejsonpatchPatchCode200Response.md @@ -0,0 +1,17 @@ +# FakejsonpatchPatchCode200Response + +public class FakejsonpatchPatchCode200Response extends [SuccessDescriptionOnly](../../components/responses/SuccessDescriptionOnly.md) + +A class (extended from the $ref class) that contains necessary nested response classes +- a class that extends ResponseDeserializer and is used to deserialize responses + +## Nested Class Summary +| Modifier and Type | Class and Description | +| ----------------- | --------------------- | +| static class | [FakejsonpatchPatchCode200Response.FakejsonpatchPatchCode200Response1](#fakejsonpatchpatchcode200response1)
class that deserializes responses | + +## FakejsonpatchPatchCode200Response1 +public static class FakejsonpatchPatchCode200Response1 extends [SuccessDescriptionOnly1](../../components/responses/SuccessDescriptionOnly.md#successdescriptiononly1)
+ +a class that deserializes responses, extended from the $ref class + diff --git a/samples/client/petstore/kotlin/docs/paths/fakejsonwithcharset/FakejsonwithcharsetPost.md b/samples/client/petstore/kotlin/docs/paths/fakejsonwithcharset/FakejsonwithcharsetPost.md new file mode 100644 index 00000000000..9456e893032 --- /dev/null +++ b/samples/client/petstore/kotlin/docs/paths/fakejsonwithcharset/FakejsonwithcharsetPost.md @@ -0,0 +1,148 @@ +# FakejsonwithcharsetPost + +public class FakejsonwithcharsetPost + +A class that contains necessary endpoint classes +- a class that calls the endpoint method using the http verb +- a class that calls the endpoint method using the operationId name +- class(es) to store the request inputs +- builder(s) to set the request input data + +## Nested Class Summary +| Modifier and Type | Class and Description | +| ----------------- | --------------------- | +| static class | [Post](#post)
The class that has a post method to call the endpoint | +| interface | [JsonWithCharsetOperation](#jsonwithcharsetoperation)
The interface that has a jsonWithCharset method to call the endpoint | +| static class | [PostRequest](#postrequest)
The request inputs class | +| static class | [PostRequestBuilder](#postrequestbuilder)
A builder for the request input class | + +## Post +public static class Post 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.FakejsonwithcharsetPostRequestBody; +import org.openapijsonschematools.client.paths.fakejsonwithcharset.post.requestbody.content.applicationjsoncharsetutf8.Applicationjsoncharsetutf8Schema; +import org.openapijsonschematools.client.RootServerInfo; +import org.openapijsonschematools.client.servers.RootServer0; +import org.openapijsonschematools.client.servers.RootServer1; +import org.openapijsonschematools.client.servers.RootServer2; +import org.openapijsonschematools.client.paths.fakejsonwithcharset.post.responses.FakejsonwithcharsetPostCode200Response; +import org.openapijsonschematools.client.servers.RootServerInfo; +import org.openapijsonschematools.client.paths.fakejsonwithcharset.FakejsonwithcharsetPost; +import org.openapijsonschematools.client.paths.fakejsonwithcharset.post.FakejsonwithcharsetPostResponses; + +import java.io.IOException; +import java.util.Arrays; +import java.util.List; +import java.util.Map; +import java.util.AbstractMap; + +// if you want to use a server that is not SERVER_0 pass it in here and change the ServerIndex input below +ApiConfiguration.ServerInfo serverInfo = new ApiConfiguration.ServerInfoBuilder() + .rootServerInfo( + new RootServerInfo.RootServerInfoBuilder() + .rootServer0(new RootServer0()) + .build() + ) + .build(); +ApiConfiguration.ServerIndexInfo serverIndexInfo = new ApiConfiguration.ServerIndexInfoBuilder() + .rootServerInfoServerIndex(RootServerInfo.ServerIndex.SERVER_0) + .build(); +Duration timeout = Duration.ofSeconds(1L); +Map> defaultHeaders = Map.of("User-Agent", List.of("OpenAPI-JSON-Schema-Generator/1.0.0/java")); +ApiConfiguration apiConfiguration = new ApiConfiguration( + serverInfo + serverIndexInfo, + timeout, + defaultHeaders +); +SchemaConfiguration schemaConfiguration = new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().build()); +FakejsonwithcharsetPost.Post apiClient = new FakejsonwithcharsetPost.Post(apiConfiguration, schemaConfiguration); + + +var request = new FakejsonwithcharsetPost.PostRequestBuilder().build(); + +FakejsonwithcharsetPostResponses.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; +} +FakejsonwithcharsetPostResponses.EndpointFakejsonwithcharsetPostCode200Response castResponse = (FakejsonwithcharsetPostResponses.EndpointFakejsonwithcharsetPostCode200Response) response; +FakejsonwithcharsetPostCode200Response.Applicationjsoncharsetutf8ResponseBody deserializedBody = (FakejsonwithcharsetPostCode200Response.Applicationjsoncharsetutf8ResponseBody) castResponse.body; +// handle deserialized body here +``` +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| Post(ApiConfiguration apiConfiguration, SchemaConfiguration schemaConfiguration)
Creates an instance | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| [FakejsonwithcharsetPostResponses.EndpointResponse](../../paths/fakejsonwithcharset/post/FakejsonwithcharsetPostResponses.md#endpointresponse) | post([PostRequest](#postrequest) request) | + +## JsonWithCharsetOperation +public interface JsonWithCharsetOperation
+ +an interface that allows one to call the endpoint using a method named jsonWithCharset by the operationId + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| [FakejsonwithcharsetPostResponses.EndpointResponse](../../paths/fakejsonwithcharset/post/FakejsonwithcharsetPostResponses.md#endpointresponse) | jsonWithCharset([PostRequest](#postrequest) request) | + +## PostRequest +public static class PostRequest
+ +a class that stores the final request inputs + +### Field Summary +| Modifier and Type | Field and Description | +| ----------------- | --------------------- | +| [FakejsonwithcharsetPostRequestBody.@Nullable SealedRequestBody](../../paths/fakejsonwithcharset/post/FakejsonwithcharsetPostRequestBody.md#sealedrequestbody) | requestBody
optional | +| [RootServerInfo.@Nullable ServerIndex](../../RootServerInfo.md#serverindex) | serverIndex
optional. Note: this will override the value in apiConfiguration | +| @Nullable Duration | timeout
optional. Note: this will override the value in apiConfiguration | + +## PostRequestBuilder +public static class PostRequestBuilder
+ +a builder for request inputs + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| PostRequestBuilder()
Creates a builder that contains null for all parameters | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| [PostRequest](#postrequest) | build()
Returns the request input used to call an endpoint method | +| [PostRequestBuilder](#postrequestbuilder) | requestBody([FakejsonwithcharsetPostRequestBody.SealedRequestBody](../../paths/fakejsonwithcharset/post/FakejsonwithcharsetPostRequestBody.md#sealedrequestbody) requestBody)
sets the optional property | +| [PostRequestBuilder](#postrequestbuilder) | serverIndex([RootServerInfo.ServerIndex](../../RootServerInfo.md#serverindex) serverIndex)
sets the optional property. Note: this will override the value in apiConfiguration | +| [PostRequestBuilder](#postrequestbuilder) | timeout(Duration timeout)
sets the optional property. Note: this will override the value in apiConfiguration | + +[[Back to top]](#top) [[Back to README]](../../../README.md) diff --git a/samples/client/petstore/kotlin/docs/paths/fakejsonwithcharset/post/FakejsonwithcharsetPostRequestBody.md b/samples/client/petstore/kotlin/docs/paths/fakejsonwithcharset/post/FakejsonwithcharsetPostRequestBody.md new file mode 100644 index 00000000000..08b63448804 --- /dev/null +++ b/samples/client/petstore/kotlin/docs/paths/fakejsonwithcharset/post/FakejsonwithcharsetPostRequestBody.md @@ -0,0 +1,90 @@ +# FakejsonwithcharsetPostRequestBody + +public class FakejsonwithcharsetPostRequestBody + +A class that contains necessary nested request body classes +- SealedMediaType, a sealed interface which contains all the schema/encoding info for each contentType +- records which implement SealedMediaType, the concrete media types +- a class that extends RequestBodySerializer and is used to serialize input SealedRequestBody instances +- SealedRequestBody, a sealed interface which contains all the contentType/schema input types +- records which implement SealedRequestBody, the concrete request body types + +## Nested Class Summary +| Modifier and Type | Class and Description | +| ----------------- | --------------------- | +| sealed interface | [FakejsonwithcharsetPostRequestBody.SealedMediaType](#sealedmediatype)
media type sealed interface | +| record | [FakejsonwithcharsetPostRequestBody.Applicationjsoncharsetutf8MediaType](#applicationjsoncharsetutf8mediatype)
record storing schema + encoding for a specific contentType | +| static class | [FakejsonwithcharsetPostRequestBody.FakejsonwithcharsetPostRequestBody1](#fakejsonwithcharsetpostrequestbody1)
class that serializes request bodies | +| sealed interface | [FakejsonwithcharsetPostRequestBody.SealedRequestBody](#sealedrequestbody)
request body sealed interface | +| record | [FakejsonwithcharsetPostRequestBody.Applicationjsoncharsetutf8RequestBody](#applicationjsoncharsetutf8requestbody)
implements sealed interface to store request body input | + +## SealedMediaType +public sealed interface SealedMediaType
+permits
+[Applicationjsoncharsetutf8MediaType](#applicationjsoncharsetutf8mediatype) + +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), Nothing?> + +class storing schema info for a specific contentType + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| Applicationjsoncharsetutf8MediaType()
Creates an instance | + +### 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 | +| Nothing? | encoding()
the encoding info | + +## FakejsonwithcharsetPostRequestBody1 +public static class FakejsonwithcharsetPostRequestBody1
+ +a class that serializes SealedRequestBody request bodies + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| FakejsonwithcharsetPostRequestBody1()
Creates an instance | + +### Field Summary +| Modifier and Type | Field and Description | +| ----------------- | --------------------- | +| boolean | required = false
whether the request body is required | +| Map | content = Map.ofEntries(
    new AbstractMap.SimpleEntry<>("application/json; charset=utf-8", new [Applicationjsoncharsetutf8MediaType](#applicationjsoncharsetutf8mediatype)())
)
the contentType to schema info | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| SerializedRequestBody | serialize([SealedRequestBody](#sealedrequestbody) requestBody)
called by endpoint when creating request body bytes | + +## SealedRequestBody +public sealed interface SealedRequestBody
+permits
+[Applicationjsoncharsetutf8RequestBody](#applicationjsoncharsetutf8requestbody) + +sealed interface that stores request contentType + validated schema data + +## Applicationjsoncharsetutf8RequestBody +public record Applicationjsoncharsetutf8RequestBody
+implements [SealedRequestBody](#sealedrequestbody),
+GenericRequestBody
+ +A record class to store request body input for contentType="application/json; charset=utf-8" + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| Applicationjsoncharsetutf8RequestBody(Applicationjsoncharsetutf8Schema.AnyTypeJsonSchema1Boxed body)
Creates an instance | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| String | contentType()
always returns "application/json; charset=utf-8" | +| Applicationjsoncharsetutf8Schema.AnyTypeJsonSchema1Boxed | body()
returns the body passed in in the constructor | diff --git a/samples/client/petstore/kotlin/docs/paths/fakejsonwithcharset/post/FakejsonwithcharsetPostResponses.md b/samples/client/petstore/kotlin/docs/paths/fakejsonwithcharset/post/FakejsonwithcharsetPostResponses.md new file mode 100644 index 00000000000..51564a92e48 --- /dev/null +++ b/samples/client/petstore/kotlin/docs/paths/fakejsonwithcharset/post/FakejsonwithcharsetPostResponses.md @@ -0,0 +1,29 @@ +# FakejsonwithcharsetPostResponses + +public class FakejsonwithcharsetPostResponses + +A class that contains necessary responses classes +- a sealed interface, EndpointResponse, that stores endpoint responses +- records for each endpoint response + +## Nested Class Summary +| Modifier and Type | Class and Description | +| ----------------- | --------------------- | +| sealed interface | [EndpointResponse](#endpointresponse)
stores the endpoint responses | +| record | [EndpointFakejsonwithcharsetPostCode200Response](#endpointfakejsonwithcharsetpostcode200response)
the response for 200 | + +## EndpointResponse +public sealed interface EndpointResponse permits
+[EndpointFakejsonwithcharsetPostCode200Response](#endpointfakejsonwithcharsetpostcode200response) + +a sealed interface that stores endpoint responses + +## EndpointFakejsonwithcharsetPostCode200Response +public record EndpointFakejsonwithcharsetPostCode200Response( + HttpResponse response, + [FakejsonwithcharsetPostCode200Response.SealedResponseBody](../../../paths/fakejsonwithcharset/post/responses/FakejsonwithcharsetPostCode200Response.md#sealedresponsebody) body, + Nothing? headers +) implements EndpointResponse, ApiResponse
+ +a class that stores an endpoint response + diff --git a/samples/client/petstore/kotlin/docs/paths/fakejsonwithcharset/post/requestbody/content/applicationjsoncharsetutf8/Applicationjsoncharsetutf8Schema.md b/samples/client/petstore/kotlin/docs/paths/fakejsonwithcharset/post/requestbody/content/applicationjsoncharsetutf8/Applicationjsoncharsetutf8Schema.md new file mode 100644 index 00000000000..4f06773c467 --- /dev/null +++ b/samples/client/petstore/kotlin/docs/paths/fakejsonwithcharset/post/requestbody/content/applicationjsoncharsetutf8/Applicationjsoncharsetutf8Schema.md @@ -0,0 +1,144 @@ +# Applicationjsoncharsetutf8Schema +public class Applicationjsoncharsetutf8Schema
+ +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 + +## Nested Class Summary +| Modifier and Type | Class and Description | +| ----------------- | ---------------------- | +| sealed interface | [Applicationjsoncharsetutf8Schema.Applicationjsoncharsetutf8Schema1Boxed](#applicationjsoncharsetutf8schema1boxed)
sealed interface for validated payloads | +| record | [Applicationjsoncharsetutf8Schema.Applicationjsoncharsetutf8Schema1BoxedVoid](#applicationjsoncharsetutf8schema1boxedvoid)
boxed class to store validated null payloads | +| record | [Applicationjsoncharsetutf8Schema.Applicationjsoncharsetutf8Schema1BoxedBoolean](#applicationjsoncharsetutf8schema1boxedboolean)
boxed class to store validated boolean payloads | +| record | [Applicationjsoncharsetutf8Schema.Applicationjsoncharsetutf8Schema1BoxedNumber](#applicationjsoncharsetutf8schema1boxednumber)
boxed class to store validated Number payloads | +| record | [Applicationjsoncharsetutf8Schema.Applicationjsoncharsetutf8Schema1BoxedString](#applicationjsoncharsetutf8schema1boxedstring)
boxed class to store validated String payloads | +| record | [Applicationjsoncharsetutf8Schema.Applicationjsoncharsetutf8Schema1BoxedList](#applicationjsoncharsetutf8schema1boxedlist)
boxed class to store validated List payloads | +| record | [Applicationjsoncharsetutf8Schema.Applicationjsoncharsetutf8Schema1BoxedMap](#applicationjsoncharsetutf8schema1boxedmap)
boxed class to store validated Map payloads | +| static class | [Applicationjsoncharsetutf8Schema.Applicationjsoncharsetutf8Schema1](#applicationjsoncharsetutf8schema1)
schema class | + +## Applicationjsoncharsetutf8Schema1Boxed +public sealed interface Applicationjsoncharsetutf8Schema1Boxed
+permits
+[Applicationjsoncharsetutf8Schema1BoxedVoid](#applicationjsoncharsetutf8schema1boxedvoid), +[Applicationjsoncharsetutf8Schema1BoxedBoolean](#applicationjsoncharsetutf8schema1boxedboolean), +[Applicationjsoncharsetutf8Schema1BoxedNumber](#applicationjsoncharsetutf8schema1boxednumber), +[Applicationjsoncharsetutf8Schema1BoxedString](#applicationjsoncharsetutf8schema1boxedstring), +[Applicationjsoncharsetutf8Schema1BoxedList](#applicationjsoncharsetutf8schema1boxedlist), +[Applicationjsoncharsetutf8Schema1BoxedMap](#applicationjsoncharsetutf8schema1boxedmap) + +sealed interface that stores validated payloads using boxed classes + +## Applicationjsoncharsetutf8Schema1BoxedVoid +public record Applicationjsoncharsetutf8Schema1BoxedVoid
+implements [Applicationjsoncharsetutf8Schema1Boxed](#applicationjsoncharsetutf8schema1boxed) + +record that stores validated null payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| Applicationjsoncharsetutf8Schema1BoxedVoid(Nothing? data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| Nothing? | data()
validated payload | +| @Nullable Object | getData()
validated payload | + +## Applicationjsoncharsetutf8Schema1BoxedBoolean +public record Applicationjsoncharsetutf8Schema1BoxedBoolean
+implements [Applicationjsoncharsetutf8Schema1Boxed](#applicationjsoncharsetutf8schema1boxed) + +record that stores validated boolean payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| Applicationjsoncharsetutf8Schema1BoxedBoolean(boolean data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| boolean | data()
validated payload | +| @Nullable Object | getData()
validated payload | + +## Applicationjsoncharsetutf8Schema1BoxedNumber +public record Applicationjsoncharsetutf8Schema1BoxedNumber
+implements [Applicationjsoncharsetutf8Schema1Boxed](#applicationjsoncharsetutf8schema1boxed) + +record that stores validated Number payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| Applicationjsoncharsetutf8Schema1BoxedNumber(Number data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| Number | data()
validated payload | +| @Nullable Object | getData()
validated payload | + +## Applicationjsoncharsetutf8Schema1BoxedString +public record Applicationjsoncharsetutf8Schema1BoxedString
+implements [Applicationjsoncharsetutf8Schema1Boxed](#applicationjsoncharsetutf8schema1boxed) + +record that stores validated String payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| Applicationjsoncharsetutf8Schema1BoxedString(String data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| String | data()
validated payload | +| @Nullable Object | getData()
validated payload | + +## Applicationjsoncharsetutf8Schema1BoxedList +public record Applicationjsoncharsetutf8Schema1BoxedList
+implements [Applicationjsoncharsetutf8Schema1Boxed](#applicationjsoncharsetutf8schema1boxed) + +record that stores validated List payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| Applicationjsoncharsetutf8Schema1BoxedList(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 | + +## Applicationjsoncharsetutf8Schema1BoxedMap +public record Applicationjsoncharsetutf8Schema1BoxedMap
+implements [Applicationjsoncharsetutf8Schema1Boxed](#applicationjsoncharsetutf8schema1boxed) + +record that stores validated Map payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| Applicationjsoncharsetutf8Schema1BoxedMap(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 | + +## Applicationjsoncharsetutf8Schema1 +public static class Applicationjsoncharsetutf8Schema1
+extends AnyTypeJsonSchema.AnyTypeJsonSchema1 + +A schema class that validates payloads + +| Methods Inherited from class org.openapijsonschematools.client.schemas.AnyTypeJsonSchema.AnyTypeJsonSchema1 | +| ------------------------------------------------------------------ | +| validate | +| validateAndBox | diff --git a/samples/client/petstore/kotlin/docs/paths/fakejsonwithcharset/post/responses/FakejsonwithcharsetPostCode200Response.md b/samples/client/petstore/kotlin/docs/paths/fakejsonwithcharset/post/responses/FakejsonwithcharsetPostCode200Response.md new file mode 100644 index 00000000000..8f0eae05795 --- /dev/null +++ b/samples/client/petstore/kotlin/docs/paths/fakejsonwithcharset/post/responses/FakejsonwithcharsetPostCode200Response.md @@ -0,0 +1,87 @@ +# FakejsonwithcharsetPostCode200Response + +public class FakejsonwithcharsetPostCode200Response + +A class that contains necessary nested response classes +- SealedMediaType, a sealed interface which contains all the schema/encoding info for each contentType +- records which implement SealedMediaType, the concrete media types +- SealedResponseBody, a sealed interface which contains all the contentType/schema types +- records which implement SealedResponseBody, the concrete response body types +- a class that extends ResponseDeserializer and is used to deserialize responses + +## Nested Class Summary +| Modifier and Type | Class and Description | +| ----------------- | --------------------- | +| sealed interface | [FakejsonwithcharsetPostCode200Response.SealedMediaType](#sealedmediatype)
media type sealed interface | +| record | [FakejsonwithcharsetPostCode200Response.Applicationjsoncharsetutf8MediaType](#applicationjsoncharsetutf8mediatype)
record storing schema + encoding for a specific contentType | +| sealed interface | [FakejsonwithcharsetPostCode200Response.SealedResponseBody](#sealedresponsebody)
response body sealed interface | +| record | [FakejsonwithcharsetPostCode200Response.Applicationjsoncharsetutf8ResponseBody](#applicationjsoncharsetutf8responsebody)
implements sealed interface to store response body | +| static class | [FakejsonwithcharsetPostCode200Response.FakejsonwithcharsetPostCode200Response1](#fakejsonwithcharsetpostcode200response1)
class that deserializes responses | + +## SealedMediaType +public sealed interface SealedMediaType
+permits
+[Applicationjsoncharsetutf8MediaType](#applicationjsoncharsetutf8mediatype) + +sealed interface that stores schema and encoding info + +## Applicationjsoncharsetutf8MediaType +public record Applicationjsoncharsetutf8MediaType
+implements [SealedMediaType](#sealedmediatype), MediaType<[Applicationjsoncharsetutf8Schema.Applicationjsoncharsetutf8Schema1](../../../../paths/fakejsonwithcharset/post/responses/code200response/content/applicationjsoncharsetutf8/Applicationjsoncharsetutf8Schema.md#applicationjsoncharsetutf8schema1), Nothing?> + +class storing schema info for a specific contentType + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| Applicationjsoncharsetutf8MediaType()
Creates an instance | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| [Applicationjsoncharsetutf8Schema.Applicationjsoncharsetutf8Schema1](../../../../paths/fakejsonwithcharset/post/responses/code200response/content/applicationjsoncharsetutf8/Applicationjsoncharsetutf8Schema.md#applicationjsoncharsetutf8schema1) | schema()
the schema for this MediaType | +| Nothing? | encoding()
the encoding info | + +## SealedResponseBody +public sealed interface SealedResponseBody
+permits
+[Applicationjsoncharsetutf8ResponseBody](#applicationjsoncharsetutf8responsebody) + +sealed interface that stores response body + +## Applicationjsoncharsetutf8ResponseBody +public record Applicationjsoncharsetutf8ResponseBody
+implements [SealedResponseBody](#sealedresponsebody) + +A record class to store response body for contentType="application/json; charset=utf-8" + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| Applicationjsoncharsetutf8ResponseBody(Applicationjsoncharsetutf8Schema.AnyTypeJsonSchema1Boxed body)
Creates an instance | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| Applicationjsoncharsetutf8Schema.AnyTypeJsonSchema1Boxed | body()
returns the body passed in in the constructor | + +## FakejsonwithcharsetPostCode200Response1 +public static class FakejsonwithcharsetPostCode200Response1
+extends ResponseDeserializer<[SealedResponseBody](#sealedresponsebody), Nothing?, [SealedMediaType](#sealedmediatype)> + +a class that deserializes responses + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| FakejsonwithcharsetPostCode200Response1()
Creates an instance | + +### Field Summary +| Modifier and Type | Field and Description | +| ----------------- | --------------------- | +| Map | content = Map.ofEntries(
    new AbstractMap.SimpleEntry<>("application/json; charset=utf-8", new [Applicationjsoncharsetutf8MediaType](#applicationjsoncharsetutf8mediatype)())
)
the contentType to schema info | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| ApiResponse<[SealedResponseBody](#sealedresponsebody), Nothing?> | deserialize(HttpResponse response, SchemaConfiguration configuration)
called by endpoint when deserialize responses | diff --git a/samples/client/petstore/kotlin/docs/paths/fakejsonwithcharset/post/responses/code200response/content/applicationjsoncharsetutf8/Applicationjsoncharsetutf8Schema.md b/samples/client/petstore/kotlin/docs/paths/fakejsonwithcharset/post/responses/code200response/content/applicationjsoncharsetutf8/Applicationjsoncharsetutf8Schema.md new file mode 100644 index 00000000000..4f06773c467 --- /dev/null +++ b/samples/client/petstore/kotlin/docs/paths/fakejsonwithcharset/post/responses/code200response/content/applicationjsoncharsetutf8/Applicationjsoncharsetutf8Schema.md @@ -0,0 +1,144 @@ +# Applicationjsoncharsetutf8Schema +public class Applicationjsoncharsetutf8Schema
+ +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 + +## Nested Class Summary +| Modifier and Type | Class and Description | +| ----------------- | ---------------------- | +| sealed interface | [Applicationjsoncharsetutf8Schema.Applicationjsoncharsetutf8Schema1Boxed](#applicationjsoncharsetutf8schema1boxed)
sealed interface for validated payloads | +| record | [Applicationjsoncharsetutf8Schema.Applicationjsoncharsetutf8Schema1BoxedVoid](#applicationjsoncharsetutf8schema1boxedvoid)
boxed class to store validated null payloads | +| record | [Applicationjsoncharsetutf8Schema.Applicationjsoncharsetutf8Schema1BoxedBoolean](#applicationjsoncharsetutf8schema1boxedboolean)
boxed class to store validated boolean payloads | +| record | [Applicationjsoncharsetutf8Schema.Applicationjsoncharsetutf8Schema1BoxedNumber](#applicationjsoncharsetutf8schema1boxednumber)
boxed class to store validated Number payloads | +| record | [Applicationjsoncharsetutf8Schema.Applicationjsoncharsetutf8Schema1BoxedString](#applicationjsoncharsetutf8schema1boxedstring)
boxed class to store validated String payloads | +| record | [Applicationjsoncharsetutf8Schema.Applicationjsoncharsetutf8Schema1BoxedList](#applicationjsoncharsetutf8schema1boxedlist)
boxed class to store validated List payloads | +| record | [Applicationjsoncharsetutf8Schema.Applicationjsoncharsetutf8Schema1BoxedMap](#applicationjsoncharsetutf8schema1boxedmap)
boxed class to store validated Map payloads | +| static class | [Applicationjsoncharsetutf8Schema.Applicationjsoncharsetutf8Schema1](#applicationjsoncharsetutf8schema1)
schema class | + +## Applicationjsoncharsetutf8Schema1Boxed +public sealed interface Applicationjsoncharsetutf8Schema1Boxed
+permits
+[Applicationjsoncharsetutf8Schema1BoxedVoid](#applicationjsoncharsetutf8schema1boxedvoid), +[Applicationjsoncharsetutf8Schema1BoxedBoolean](#applicationjsoncharsetutf8schema1boxedboolean), +[Applicationjsoncharsetutf8Schema1BoxedNumber](#applicationjsoncharsetutf8schema1boxednumber), +[Applicationjsoncharsetutf8Schema1BoxedString](#applicationjsoncharsetutf8schema1boxedstring), +[Applicationjsoncharsetutf8Schema1BoxedList](#applicationjsoncharsetutf8schema1boxedlist), +[Applicationjsoncharsetutf8Schema1BoxedMap](#applicationjsoncharsetutf8schema1boxedmap) + +sealed interface that stores validated payloads using boxed classes + +## Applicationjsoncharsetutf8Schema1BoxedVoid +public record Applicationjsoncharsetutf8Schema1BoxedVoid
+implements [Applicationjsoncharsetutf8Schema1Boxed](#applicationjsoncharsetutf8schema1boxed) + +record that stores validated null payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| Applicationjsoncharsetutf8Schema1BoxedVoid(Nothing? data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| Nothing? | data()
validated payload | +| @Nullable Object | getData()
validated payload | + +## Applicationjsoncharsetutf8Schema1BoxedBoolean +public record Applicationjsoncharsetutf8Schema1BoxedBoolean
+implements [Applicationjsoncharsetutf8Schema1Boxed](#applicationjsoncharsetutf8schema1boxed) + +record that stores validated boolean payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| Applicationjsoncharsetutf8Schema1BoxedBoolean(boolean data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| boolean | data()
validated payload | +| @Nullable Object | getData()
validated payload | + +## Applicationjsoncharsetutf8Schema1BoxedNumber +public record Applicationjsoncharsetutf8Schema1BoxedNumber
+implements [Applicationjsoncharsetutf8Schema1Boxed](#applicationjsoncharsetutf8schema1boxed) + +record that stores validated Number payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| Applicationjsoncharsetutf8Schema1BoxedNumber(Number data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| Number | data()
validated payload | +| @Nullable Object | getData()
validated payload | + +## Applicationjsoncharsetutf8Schema1BoxedString +public record Applicationjsoncharsetutf8Schema1BoxedString
+implements [Applicationjsoncharsetutf8Schema1Boxed](#applicationjsoncharsetutf8schema1boxed) + +record that stores validated String payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| Applicationjsoncharsetutf8Schema1BoxedString(String data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| String | data()
validated payload | +| @Nullable Object | getData()
validated payload | + +## Applicationjsoncharsetutf8Schema1BoxedList +public record Applicationjsoncharsetutf8Schema1BoxedList
+implements [Applicationjsoncharsetutf8Schema1Boxed](#applicationjsoncharsetutf8schema1boxed) + +record that stores validated List payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| Applicationjsoncharsetutf8Schema1BoxedList(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 | + +## Applicationjsoncharsetutf8Schema1BoxedMap +public record Applicationjsoncharsetutf8Schema1BoxedMap
+implements [Applicationjsoncharsetutf8Schema1Boxed](#applicationjsoncharsetutf8schema1boxed) + +record that stores validated Map payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| Applicationjsoncharsetutf8Schema1BoxedMap(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 | + +## Applicationjsoncharsetutf8Schema1 +public static class Applicationjsoncharsetutf8Schema1
+extends AnyTypeJsonSchema.AnyTypeJsonSchema1 + +A schema class that validates payloads + +| Methods Inherited from class org.openapijsonschematools.client.schemas.AnyTypeJsonSchema.AnyTypeJsonSchema1 | +| ------------------------------------------------------------------ | +| validate | +| validateAndBox | diff --git a/samples/client/petstore/kotlin/docs/paths/fakemultiplerequestbodycontenttypes/FakemultiplerequestbodycontenttypesPost.md b/samples/client/petstore/kotlin/docs/paths/fakemultiplerequestbodycontenttypes/FakemultiplerequestbodycontenttypesPost.md new file mode 100644 index 00000000000..a4581c24d6e --- /dev/null +++ b/samples/client/petstore/kotlin/docs/paths/fakemultiplerequestbodycontenttypes/FakemultiplerequestbodycontenttypesPost.md @@ -0,0 +1,148 @@ +# FakemultiplerequestbodycontenttypesPost + +public class FakemultiplerequestbodycontenttypesPost + +A class that contains necessary endpoint classes +- a class that calls the endpoint method using the http verb +- a class that calls the endpoint method using the operationId name +- class(es) to store the request inputs +- builder(s) to set the request input data + +## Nested Class Summary +| Modifier and Type | Class and Description | +| ----------------- | --------------------- | +| static class | [Post](#post)
The class that has a post method to call the endpoint | +| interface | [MultipleRequestBodyContentTypesOperation](#multiplerequestbodycontenttypesoperation)
The interface that has a multipleRequestBodyContentTypes method to call the endpoint | +| static class | [PostRequest](#postrequest)
The request inputs class | +| static class | [PostRequestBuilder](#postrequestbuilder)
A builder for the request input class | + +## Post +public static class Post 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.FakemultiplerequestbodycontenttypesPostRequestBody; +import org.openapijsonschematools.client.paths.fakemultiplerequestbodycontenttypes.post.requestbody.content.applicationjson.ApplicationjsonSchema; +import org.openapijsonschematools.client.RootServerInfo; +import org.openapijsonschematools.client.servers.RootServer0; +import org.openapijsonschematools.client.servers.RootServer1; +import org.openapijsonschematools.client.servers.RootServer2; +import org.openapijsonschematools.client.paths.fakemultiplerequestbodycontenttypes.post.responses.FakemultiplerequestbodycontenttypesPostCode200Response; +import org.openapijsonschematools.client.servers.RootServerInfo; +import org.openapijsonschematools.client.paths.fakemultiplerequestbodycontenttypes.FakemultiplerequestbodycontenttypesPost; +import org.openapijsonschematools.client.paths.fakemultiplerequestbodycontenttypes.post.FakemultiplerequestbodycontenttypesPostResponses; + +import java.io.IOException; +import java.util.Arrays; +import java.util.List; +import java.util.Map; +import java.util.AbstractMap; + +// if you want to use a server that is not SERVER_0 pass it in here and change the ServerIndex input below +ApiConfiguration.ServerInfo serverInfo = new ApiConfiguration.ServerInfoBuilder() + .rootServerInfo( + new RootServerInfo.RootServerInfoBuilder() + .rootServer0(new RootServer0()) + .build() + ) + .build(); +ApiConfiguration.ServerIndexInfo serverIndexInfo = new ApiConfiguration.ServerIndexInfoBuilder() + .rootServerInfoServerIndex(RootServerInfo.ServerIndex.SERVER_0) + .build(); +Duration timeout = Duration.ofSeconds(1L); +Map> defaultHeaders = Map.of("User-Agent", List.of("OpenAPI-JSON-Schema-Generator/1.0.0/java")); +ApiConfiguration apiConfiguration = new ApiConfiguration( + serverInfo + serverIndexInfo, + timeout, + defaultHeaders +); +SchemaConfiguration schemaConfiguration = new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().build()); +FakemultiplerequestbodycontenttypesPost.Post apiClient = new FakemultiplerequestbodycontenttypesPost.Post(apiConfiguration, schemaConfiguration); + + +var request = new FakemultiplerequestbodycontenttypesPost.PostRequestBuilder().build(); + +FakemultiplerequestbodycontenttypesPostResponses.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; +} +FakemultiplerequestbodycontenttypesPostResponses.EndpointFakemultiplerequestbodycontenttypesPostCode200Response castResponse = (FakemultiplerequestbodycontenttypesPostResponses.EndpointFakemultiplerequestbodycontenttypesPostCode200Response) response; +FakemultiplerequestbodycontenttypesPostCode200Response.ApplicationjsonResponseBody deserializedBody = (FakemultiplerequestbodycontenttypesPostCode200Response.ApplicationjsonResponseBody) castResponse.body; +// handle deserialized body here +``` +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| Post(ApiConfiguration apiConfiguration, SchemaConfiguration schemaConfiguration)
Creates an instance | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| [FakemultiplerequestbodycontenttypesPostResponses.EndpointResponse](../../paths/fakemultiplerequestbodycontenttypes/post/FakemultiplerequestbodycontenttypesPostResponses.md#endpointresponse) | post([PostRequest](#postrequest) request) | + +## MultipleRequestBodyContentTypesOperation +public interface MultipleRequestBodyContentTypesOperation
+ +an interface that allows one to call the endpoint using a method named multipleRequestBodyContentTypes by the operationId + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| [FakemultiplerequestbodycontenttypesPostResponses.EndpointResponse](../../paths/fakemultiplerequestbodycontenttypes/post/FakemultiplerequestbodycontenttypesPostResponses.md#endpointresponse) | multipleRequestBodyContentTypes([PostRequest](#postrequest) request) | + +## PostRequest +public static class PostRequest
+ +a class that stores the final request inputs + +### Field Summary +| Modifier and Type | Field and Description | +| ----------------- | --------------------- | +| [FakemultiplerequestbodycontenttypesPostRequestBody.@Nullable SealedRequestBody](../../paths/fakemultiplerequestbodycontenttypes/post/FakemultiplerequestbodycontenttypesPostRequestBody.md#sealedrequestbody) | requestBody
optional | +| [RootServerInfo.@Nullable ServerIndex](../../RootServerInfo.md#serverindex) | serverIndex
optional. Note: this will override the value in apiConfiguration | +| @Nullable Duration | timeout
optional. Note: this will override the value in apiConfiguration | + +## PostRequestBuilder +public static class PostRequestBuilder
+ +a builder for request inputs + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| PostRequestBuilder()
Creates a builder that contains null for all parameters | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| [PostRequest](#postrequest) | build()
Returns the request input used to call an endpoint method | +| [PostRequestBuilder](#postrequestbuilder) | requestBody([FakemultiplerequestbodycontenttypesPostRequestBody.SealedRequestBody](../../paths/fakemultiplerequestbodycontenttypes/post/FakemultiplerequestbodycontenttypesPostRequestBody.md#sealedrequestbody) requestBody)
sets the optional property | +| [PostRequestBuilder](#postrequestbuilder) | serverIndex([RootServerInfo.ServerIndex](../../RootServerInfo.md#serverindex) serverIndex)
sets the optional property. Note: this will override the value in apiConfiguration | +| [PostRequestBuilder](#postrequestbuilder) | timeout(Duration timeout)
sets the optional property. Note: this will override the value in apiConfiguration | + +[[Back to top]](#top) [[Back to README]](../../../README.md) diff --git a/samples/client/petstore/kotlin/docs/paths/fakemultiplerequestbodycontenttypes/post/FakemultiplerequestbodycontenttypesPostRequestBody.md b/samples/client/petstore/kotlin/docs/paths/fakemultiplerequestbodycontenttypes/post/FakemultiplerequestbodycontenttypesPostRequestBody.md new file mode 100644 index 00000000000..34099d1a175 --- /dev/null +++ b/samples/client/petstore/kotlin/docs/paths/fakemultiplerequestbodycontenttypes/post/FakemultiplerequestbodycontenttypesPostRequestBody.md @@ -0,0 +1,128 @@ +# FakemultiplerequestbodycontenttypesPostRequestBody + +public class FakemultiplerequestbodycontenttypesPostRequestBody + +A class that contains necessary nested request body classes +- SealedMediaType, a sealed interface which contains all the schema/encoding info for each contentType +- records which implement SealedMediaType, the concrete media types +- a class that extends RequestBodySerializer and is used to serialize input SealedRequestBody instances +- SealedRequestBody, a sealed interface which contains all the contentType/schema input types +- records which implement SealedRequestBody, the concrete request body types + +## Nested Class Summary +| Modifier and Type | Class and Description | +| ----------------- | --------------------- | +| sealed interface | [FakemultiplerequestbodycontenttypesPostRequestBody.SealedMediaType](#sealedmediatype)
media type sealed interface | +| record | [FakemultiplerequestbodycontenttypesPostRequestBody.ApplicationjsonMediaType](#applicationjsonmediatype)
record storing schema + encoding for a specific contentType | +| record | [FakemultiplerequestbodycontenttypesPostRequestBody.MultipartformdataMediaType](#multipartformdatamediatype)
record storing schema + encoding for a specific contentType | +| static class | [FakemultiplerequestbodycontenttypesPostRequestBody.FakemultiplerequestbodycontenttypesPostRequestBody1](#fakemultiplerequestbodycontenttypespostrequestbody1)
class that serializes request bodies | +| sealed interface | [FakemultiplerequestbodycontenttypesPostRequestBody.SealedRequestBody](#sealedrequestbody)
request body sealed interface | +| record | [FakemultiplerequestbodycontenttypesPostRequestBody.ApplicationjsonRequestBody](#applicationjsonrequestbody)
implements sealed interface to store request body input | +| record | [FakemultiplerequestbodycontenttypesPostRequestBody.MultipartformdataRequestBody](#multipartformdatarequestbody)
implements sealed interface to store request body input | + +## SealedMediaType +public sealed interface SealedMediaType
+permits
+[ApplicationjsonMediaType](#applicationjsonmediatype), +[MultipartformdataMediaType](#multipartformdatamediatype) + +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), Nothing?> + +class storing schema info for a specific contentType + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| ApplicationjsonMediaType()
Creates an instance | + +### 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 | +| Nothing? | encoding()
the encoding info | + +## MultipartformdataMediaType +public record MultipartformdataMediaType
+implements [SealedMediaType](#sealedmediatype), MediaType<[MultipartformdataSchema.MultipartformdataSchema1](../../../paths/fakemultiplerequestbodycontenttypes/post/requestbody/content/multipartformdata/MultipartformdataSchema.md#multipartformdataschema1), Nothing?> + +class storing schema info for a specific contentType + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| MultipartformdataMediaType()
Creates an instance | + +### 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 | +| Nothing? | encoding()
the encoding info | + +## FakemultiplerequestbodycontenttypesPostRequestBody1 +public static class FakemultiplerequestbodycontenttypesPostRequestBody1
+ +a class that serializes SealedRequestBody request bodies + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| FakemultiplerequestbodycontenttypesPostRequestBody1()
Creates an instance | + +### Field Summary +| Modifier and Type | Field and Description | +| ----------------- | --------------------- | +| boolean | required = false
whether the request body is required | +| Map | content = Map.ofEntries(
    new AbstractMap.SimpleEntry<>("application/json", new [ApplicationjsonMediaType](#applicationjsonmediatype)()),
    new AbstractMap.SimpleEntry<>("multipart/form-data", new [MultipartformdataMediaType](#multipartformdatamediatype)())
)
the contentType to schema info | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| SerializedRequestBody | serialize([SealedRequestBody](#sealedrequestbody) requestBody)
called by endpoint when creating request body bytes | + +## SealedRequestBody +public sealed interface SealedRequestBody
+permits
+[ApplicationjsonRequestBody](#applicationjsonrequestbody), +[MultipartformdataRequestBody](#multipartformdatarequestbody) + +sealed interface that stores request contentType + validated schema data + +## ApplicationjsonRequestBody +public record ApplicationjsonRequestBody
+implements [SealedRequestBody](#sealedrequestbody),
+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 | + +### 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 | +## MultipartformdataRequestBody +public record MultipartformdataRequestBody
+implements [SealedRequestBody](#sealedrequestbody),
+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 | + +### 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 | diff --git a/samples/client/petstore/kotlin/docs/paths/fakemultiplerequestbodycontenttypes/post/FakemultiplerequestbodycontenttypesPostResponses.md b/samples/client/petstore/kotlin/docs/paths/fakemultiplerequestbodycontenttypes/post/FakemultiplerequestbodycontenttypesPostResponses.md new file mode 100644 index 00000000000..79a05e7c5fb --- /dev/null +++ b/samples/client/petstore/kotlin/docs/paths/fakemultiplerequestbodycontenttypes/post/FakemultiplerequestbodycontenttypesPostResponses.md @@ -0,0 +1,29 @@ +# FakemultiplerequestbodycontenttypesPostResponses + +public class FakemultiplerequestbodycontenttypesPostResponses + +A class that contains necessary responses classes +- a sealed interface, EndpointResponse, that stores endpoint responses +- records for each endpoint response + +## Nested Class Summary +| Modifier and Type | Class and Description | +| ----------------- | --------------------- | +| sealed interface | [EndpointResponse](#endpointresponse)
stores the endpoint responses | +| record | [EndpointFakemultiplerequestbodycontenttypesPostCode200Response](#endpointfakemultiplerequestbodycontenttypespostcode200response)
the response for 200 | + +## EndpointResponse +public sealed interface EndpointResponse permits
+[EndpointFakemultiplerequestbodycontenttypesPostCode200Response](#endpointfakemultiplerequestbodycontenttypespostcode200response) + +a sealed interface that stores endpoint responses + +## EndpointFakemultiplerequestbodycontenttypesPostCode200Response +public record EndpointFakemultiplerequestbodycontenttypesPostCode200Response( + HttpResponse response, + [FakemultiplerequestbodycontenttypesPostCode200Response.SealedResponseBody](../../../paths/fakemultiplerequestbodycontenttypes/post/responses/FakemultiplerequestbodycontenttypesPostCode200Response.md#sealedresponsebody) body, + Nothing? headers +) implements EndpointResponse, ApiResponse
+ +a class that stores an endpoint response + diff --git a/samples/client/petstore/kotlin/docs/paths/fakemultiplerequestbodycontenttypes/post/requestbody/content/applicationjson/ApplicationjsonSchema.md b/samples/client/petstore/kotlin/docs/paths/fakemultiplerequestbodycontenttypes/post/requestbody/content/applicationjson/ApplicationjsonSchema.md new file mode 100644 index 00000000000..b9f5d512ebc --- /dev/null +++ b/samples/client/petstore/kotlin/docs/paths/fakemultiplerequestbodycontenttypes/post/requestbody/content/applicationjson/ApplicationjsonSchema.md @@ -0,0 +1,166 @@ +# ApplicationjsonSchema +public class ApplicationjsonSchema
+ +A class that contains necessary nested +- schema classes (which validate payloads), extends JsonSchema +- sealed interfaces which store validated payloads, java version of a sum type +- boxed classes which store validated payloads, sealed permits class implementations +- classes to store validated map payloads, extends FrozenMap +- classes to build inputs for map payloads + +## Nested Class Summary +| Modifier and Type | Class and Description | +| ----------------- | ---------------------- | +| sealed interface | [ApplicationjsonSchema.ApplicationjsonSchema1Boxed](#applicationjsonschema1boxed)
sealed interface for validated payloads | +| record | [ApplicationjsonSchema.ApplicationjsonSchema1BoxedMap](#applicationjsonschema1boxedmap)
boxed class to store validated Map payloads | +| static class | [ApplicationjsonSchema.ApplicationjsonSchema1](#applicationjsonschema1)
schema class | +| static class | [ApplicationjsonSchema.ApplicationjsonSchemaMapBuilder](#applicationjsonschemamapbuilder)
builder for Map payloads | +| static class | [ApplicationjsonSchema.ApplicationjsonSchemaMap](#applicationjsonschemamap)
output class for Map payloads | +| sealed interface | [ApplicationjsonSchema.ApplicationjsonABoxed](#applicationjsonaboxed)
sealed interface for validated payloads | +| record | [ApplicationjsonSchema.ApplicationjsonABoxedString](#applicationjsonaboxedstring)
boxed class to store validated String payloads | +| static class | [ApplicationjsonSchema.ApplicationjsonA](#applicationjsona)
schema class | + +## ApplicationjsonSchema1Boxed +public sealed interface ApplicationjsonSchema1Boxed
+permits
+[ApplicationjsonSchema1BoxedMap](#applicationjsonschema1boxedmap) + +sealed interface that stores validated payloads using boxed classes + +## ApplicationjsonSchema1BoxedMap +public record ApplicationjsonSchema1BoxedMap
+implements [ApplicationjsonSchema1Boxed](#applicationjsonschema1boxed) + +record that stores validated Map payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| ApplicationjsonSchema1BoxedMap([ApplicationjsonSchemaMap](#applicationjsonschemamap) data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| [ApplicationjsonSchemaMap](#applicationjsonschemamap) | data()
validated payload | +| @Nullable Object | getData()
validated payload | + +## ApplicationjsonSchema1 +public static class ApplicationjsonSchema1
+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.fakemultiplerequestbodycontenttypes.post.requestbody.content.applicationjson.ApplicationjsonSchema; + +import java.util.Arrays; +import java.util.List; +import java.util.AbstractMap; + +static final SchemaConfiguration configuration = new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().build()); + +// Map validation +ApplicationjsonSchema.ApplicationjsonSchemaMap validatedPayload = + ApplicationjsonSchema.ApplicationjsonSchema1.validate( + new ApplicationjsonSchema.ApplicationjsonSchemaMapBuilder() + .a("a") + + .build(), + configuration +); +``` + +### Field Summary +| Modifier and Type | Field and Description | +| ----------------- | ---------------------- | +| Set> | type = Set.of(Map.class) | +| Map> | properties = Map.ofEntries(
    new PropertyEntry("a", [ApplicationjsonA.class](#applicationjsona)))
)
| + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| [ApplicationjsonSchemaMap](#applicationjsonschemamap) | validate([Map<?, ?>](#applicationjsonschemamapbuilder) arg, SchemaConfiguration configuration) | +| [ApplicationjsonSchema1BoxedMap](#applicationjsonschema1boxedmap) | validateAndBox([Map<?, ?>](#applicationjsonschemamapbuilder) arg, SchemaConfiguration configuration) | +| [ApplicationjsonSchema1Boxed](#applicationjsonschema1boxed) | validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) | +| @Nullable Object | validate(@Nullable Object arg, SchemaConfiguration configuration) | + +## ApplicationjsonSchemaMapBuilder +public class ApplicationjsonSchemaMapBuilder
+builder for `Map` + +A class that builds the Map input type + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| ApplicationjsonSchemaMapBuilder()
Creates a builder that contains an empty map | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| Map | build()
Returns map input that should be used with Schema.validate | +| [ApplicationjsonSchemaMapBuilder](#applicationjsonschemamapbuilder) | a(String value) | +| [ApplicationjsonSchemaMapBuilder](#applicationjsonschemamapbuilder) | additionalProperty(String key, Nothing? value) | +| [ApplicationjsonSchemaMapBuilder](#applicationjsonschemamapbuilder) | additionalProperty(String key, boolean value) | +| [ApplicationjsonSchemaMapBuilder](#applicationjsonschemamapbuilder) | additionalProperty(String key, String value) | +| [ApplicationjsonSchemaMapBuilder](#applicationjsonschemamapbuilder) | additionalProperty(String key, int value) | +| [ApplicationjsonSchemaMapBuilder](#applicationjsonschemamapbuilder) | additionalProperty(String key, float value) | +| [ApplicationjsonSchemaMapBuilder](#applicationjsonschemamapbuilder) | additionalProperty(String key, long value) | +| [ApplicationjsonSchemaMapBuilder](#applicationjsonschemamapbuilder) | additionalProperty(String key, double value) | +| [ApplicationjsonSchemaMapBuilder](#applicationjsonschemamapbuilder) | additionalProperty(String key, List value) | +| [ApplicationjsonSchemaMapBuilder](#applicationjsonschemamapbuilder) | additionalProperty(String key, Map value) | + +## ApplicationjsonSchemaMap +public static class ApplicationjsonSchemaMap
+extends FrozenMap + +A class to store validated Map payloads + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| static [ApplicationjsonSchemaMap](#applicationjsonschemamap) | of([Map](#applicationjsonschemamapbuilder) arg, SchemaConfiguration configuration) | +| String | a()
[optional] | +| @Nullable Object | getAdditionalProperty(String name)
provides type safety for additional properties | + +## ApplicationjsonABoxed +public sealed interface ApplicationjsonABoxed
+permits
+[ApplicationjsonABoxedString](#applicationjsonaboxedstring) + +sealed interface that stores validated payloads using boxed classes + +## ApplicationjsonABoxedString +public record ApplicationjsonABoxedString
+implements [ApplicationjsonABoxed](#applicationjsonaboxed) + +record that stores validated String payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| ApplicationjsonABoxedString(String data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| String | data()
validated payload | +| @Nullable Object | getData()
validated payload | + +## ApplicationjsonA +public static class ApplicationjsonA
+extends StringJsonSchema.StringJsonSchema1 + +A schema class that validates payloads + +| Methods Inherited from class org.openapijsonschematools.client.schemas.StringJsonSchema.StringJsonSchema1 | +| ------------------------------------------------------------------ | +| validate | +| validateAndBox | diff --git a/samples/client/petstore/kotlin/docs/paths/fakemultiplerequestbodycontenttypes/post/requestbody/content/multipartformdata/MultipartformdataSchema.md b/samples/client/petstore/kotlin/docs/paths/fakemultiplerequestbodycontenttypes/post/requestbody/content/multipartformdata/MultipartformdataSchema.md new file mode 100644 index 00000000000..ab121c6df87 --- /dev/null +++ b/samples/client/petstore/kotlin/docs/paths/fakemultiplerequestbodycontenttypes/post/requestbody/content/multipartformdata/MultipartformdataSchema.md @@ -0,0 +1,166 @@ +# MultipartformdataSchema +public class MultipartformdataSchema
+ +A class that contains necessary nested +- schema classes (which validate payloads), extends JsonSchema +- sealed interfaces which store validated payloads, java version of a sum type +- boxed classes which store validated payloads, sealed permits class implementations +- classes to store validated map payloads, extends FrozenMap +- classes to build inputs for map payloads + +## Nested Class Summary +| Modifier and Type | Class and Description | +| ----------------- | ---------------------- | +| sealed interface | [MultipartformdataSchema.MultipartformdataSchema1Boxed](#multipartformdataschema1boxed)
sealed interface for validated payloads | +| record | [MultipartformdataSchema.MultipartformdataSchema1BoxedMap](#multipartformdataschema1boxedmap)
boxed class to store validated Map payloads | +| static class | [MultipartformdataSchema.MultipartformdataSchema1](#multipartformdataschema1)
schema class | +| static class | [MultipartformdataSchema.MultipartformdataSchemaMapBuilder](#multipartformdataschemamapbuilder)
builder for Map payloads | +| static class | [MultipartformdataSchema.MultipartformdataSchemaMap](#multipartformdataschemamap)
output class for Map payloads | +| sealed interface | [MultipartformdataSchema.MultipartformdataBBoxed](#multipartformdatabboxed)
sealed interface for validated payloads | +| record | [MultipartformdataSchema.MultipartformdataBBoxedString](#multipartformdatabboxedstring)
boxed class to store validated String payloads | +| static class | [MultipartformdataSchema.MultipartformdataB](#multipartformdatab)
schema class | + +## MultipartformdataSchema1Boxed +public sealed interface MultipartformdataSchema1Boxed
+permits
+[MultipartformdataSchema1BoxedMap](#multipartformdataschema1boxedmap) + +sealed interface that stores validated payloads using boxed classes + +## MultipartformdataSchema1BoxedMap +public record MultipartformdataSchema1BoxedMap
+implements [MultipartformdataSchema1Boxed](#multipartformdataschema1boxed) + +record that stores validated Map payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| MultipartformdataSchema1BoxedMap([MultipartformdataSchemaMap](#multipartformdataschemamap) data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| [MultipartformdataSchemaMap](#multipartformdataschemamap) | data()
validated payload | +| @Nullable Object | getData()
validated payload | + +## MultipartformdataSchema1 +public static class MultipartformdataSchema1
+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.fakemultiplerequestbodycontenttypes.post.requestbody.content.multipartformdata.MultipartformdataSchema; + +import java.util.Arrays; +import java.util.List; +import java.util.AbstractMap; + +static final SchemaConfiguration configuration = new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().build()); + +// Map validation +MultipartformdataSchema.MultipartformdataSchemaMap validatedPayload = + MultipartformdataSchema.MultipartformdataSchema1.validate( + new MultipartformdataSchema.MultipartformdataSchemaMapBuilder() + .b("a") + + .build(), + configuration +); +``` + +### Field Summary +| Modifier and Type | Field and Description | +| ----------------- | ---------------------- | +| Set> | type = Set.of(Map.class) | +| Map> | properties = Map.ofEntries(
    new PropertyEntry("b", [MultipartformdataB.class](#multipartformdatab)))
)
| + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| [MultipartformdataSchemaMap](#multipartformdataschemamap) | validate([Map<?, ?>](#multipartformdataschemamapbuilder) arg, SchemaConfiguration configuration) | +| [MultipartformdataSchema1BoxedMap](#multipartformdataschema1boxedmap) | validateAndBox([Map<?, ?>](#multipartformdataschemamapbuilder) arg, SchemaConfiguration configuration) | +| [MultipartformdataSchema1Boxed](#multipartformdataschema1boxed) | validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) | +| @Nullable Object | validate(@Nullable Object arg, SchemaConfiguration configuration) | + +## MultipartformdataSchemaMapBuilder +public class MultipartformdataSchemaMapBuilder
+builder for `Map` + +A class that builds the Map input type + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| MultipartformdataSchemaMapBuilder()
Creates a builder that contains an empty map | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| Map | build()
Returns map input that should be used with Schema.validate | +| [MultipartformdataSchemaMapBuilder](#multipartformdataschemamapbuilder) | b(String value) | +| [MultipartformdataSchemaMapBuilder](#multipartformdataschemamapbuilder) | additionalProperty(String key, Nothing? value) | +| [MultipartformdataSchemaMapBuilder](#multipartformdataschemamapbuilder) | additionalProperty(String key, boolean value) | +| [MultipartformdataSchemaMapBuilder](#multipartformdataschemamapbuilder) | additionalProperty(String key, String value) | +| [MultipartformdataSchemaMapBuilder](#multipartformdataschemamapbuilder) | additionalProperty(String key, int value) | +| [MultipartformdataSchemaMapBuilder](#multipartformdataschemamapbuilder) | additionalProperty(String key, float value) | +| [MultipartformdataSchemaMapBuilder](#multipartformdataschemamapbuilder) | additionalProperty(String key, long value) | +| [MultipartformdataSchemaMapBuilder](#multipartformdataschemamapbuilder) | additionalProperty(String key, double value) | +| [MultipartformdataSchemaMapBuilder](#multipartformdataschemamapbuilder) | additionalProperty(String key, List value) | +| [MultipartformdataSchemaMapBuilder](#multipartformdataschemamapbuilder) | additionalProperty(String key, Map value) | + +## MultipartformdataSchemaMap +public static class MultipartformdataSchemaMap
+extends FrozenMap + +A class to store validated Map payloads + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| static [MultipartformdataSchemaMap](#multipartformdataschemamap) | of([Map](#multipartformdataschemamapbuilder) arg, SchemaConfiguration configuration) | +| String | b()
[optional] | +| @Nullable Object | getAdditionalProperty(String name)
provides type safety for additional properties | + +## MultipartformdataBBoxed +public sealed interface MultipartformdataBBoxed
+permits
+[MultipartformdataBBoxedString](#multipartformdatabboxedstring) + +sealed interface that stores validated payloads using boxed classes + +## MultipartformdataBBoxedString +public record MultipartformdataBBoxedString
+implements [MultipartformdataBBoxed](#multipartformdatabboxed) + +record that stores validated String payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| MultipartformdataBBoxedString(String data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| String | data()
validated payload | +| @Nullable Object | getData()
validated payload | + +## MultipartformdataB +public static class MultipartformdataB
+extends StringJsonSchema.StringJsonSchema1 + +A schema class that validates payloads + +| Methods Inherited from class org.openapijsonschematools.client.schemas.StringJsonSchema.StringJsonSchema1 | +| ------------------------------------------------------------------ | +| validate | +| validateAndBox | diff --git a/samples/client/petstore/kotlin/docs/paths/fakemultiplerequestbodycontenttypes/post/responses/FakemultiplerequestbodycontenttypesPostCode200Response.md b/samples/client/petstore/kotlin/docs/paths/fakemultiplerequestbodycontenttypes/post/responses/FakemultiplerequestbodycontenttypesPostCode200Response.md new file mode 100644 index 00000000000..73038b6c3c7 --- /dev/null +++ b/samples/client/petstore/kotlin/docs/paths/fakemultiplerequestbodycontenttypes/post/responses/FakemultiplerequestbodycontenttypesPostCode200Response.md @@ -0,0 +1,87 @@ +# FakemultiplerequestbodycontenttypesPostCode200Response + +public class FakemultiplerequestbodycontenttypesPostCode200Response + +A class that contains necessary nested response classes +- SealedMediaType, a sealed interface which contains all the schema/encoding info for each contentType +- records which implement SealedMediaType, the concrete media types +- SealedResponseBody, a sealed interface which contains all the contentType/schema types +- records which implement SealedResponseBody, the concrete response body types +- a class that extends ResponseDeserializer and is used to deserialize responses + +## Nested Class Summary +| Modifier and Type | Class and Description | +| ----------------- | --------------------- | +| sealed interface | [FakemultiplerequestbodycontenttypesPostCode200Response.SealedMediaType](#sealedmediatype)
media type sealed interface | +| record | [FakemultiplerequestbodycontenttypesPostCode200Response.ApplicationjsonMediaType](#applicationjsonmediatype)
record storing schema + encoding for a specific contentType | +| sealed interface | [FakemultiplerequestbodycontenttypesPostCode200Response.SealedResponseBody](#sealedresponsebody)
response body sealed interface | +| record | [FakemultiplerequestbodycontenttypesPostCode200Response.ApplicationjsonResponseBody](#applicationjsonresponsebody)
implements sealed interface to store response body | +| static class | [FakemultiplerequestbodycontenttypesPostCode200Response.FakemultiplerequestbodycontenttypesPostCode200Response1](#fakemultiplerequestbodycontenttypespostcode200response1)
class that deserializes responses | + +## SealedMediaType +public sealed interface SealedMediaType
+permits
+[ApplicationjsonMediaType](#applicationjsonmediatype) + +sealed interface that stores schema and encoding info + +## ApplicationjsonMediaType +public record ApplicationjsonMediaType
+implements [SealedMediaType](#sealedmediatype), MediaType<[ApplicationjsonSchema.ApplicationjsonSchema1](../../../../paths/fakemultiplerequestbodycontenttypes/post/responses/code200response/content/applicationjson/ApplicationjsonSchema.md#applicationjsonschema1), Nothing?> + +class storing schema info for a specific contentType + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| ApplicationjsonMediaType()
Creates an instance | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| [ApplicationjsonSchema.ApplicationjsonSchema1](../../../../paths/fakemultiplerequestbodycontenttypes/post/responses/code200response/content/applicationjson/ApplicationjsonSchema.md#applicationjsonschema1) | schema()
the schema for this MediaType | +| Nothing? | encoding()
the encoding info | + +## SealedResponseBody +public sealed interface SealedResponseBody
+permits
+[ApplicationjsonResponseBody](#applicationjsonresponsebody) + +sealed interface that stores response body + +## ApplicationjsonResponseBody +public record ApplicationjsonResponseBody
+implements [SealedResponseBody](#sealedresponsebody) + +A record class to store response body for contentType="application/json" + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| ApplicationjsonResponseBody(ApplicationjsonSchema.AnyTypeJsonSchema1Boxed body)
Creates an instance | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| ApplicationjsonSchema.AnyTypeJsonSchema1Boxed | body()
returns the body passed in in the constructor | + +## FakemultiplerequestbodycontenttypesPostCode200Response1 +public static class FakemultiplerequestbodycontenttypesPostCode200Response1
+extends ResponseDeserializer<[SealedResponseBody](#sealedresponsebody), Nothing?, [SealedMediaType](#sealedmediatype)> + +a class that deserializes responses + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| FakemultiplerequestbodycontenttypesPostCode200Response1()
Creates an instance | + +### Field Summary +| Modifier and Type | Field and Description | +| ----------------- | --------------------- | +| 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 | +| ----------------- | ---------------------- | +| ApiResponse<[SealedResponseBody](#sealedresponsebody), Nothing?> | deserialize(HttpResponse response, SchemaConfiguration configuration)
called by endpoint when deserialize responses | diff --git a/samples/client/petstore/kotlin/docs/paths/fakemultiplerequestbodycontenttypes/post/responses/code200response/content/applicationjson/ApplicationjsonSchema.md b/samples/client/petstore/kotlin/docs/paths/fakemultiplerequestbodycontenttypes/post/responses/code200response/content/applicationjson/ApplicationjsonSchema.md new file mode 100644 index 00000000000..b05260b1abf --- /dev/null +++ b/samples/client/petstore/kotlin/docs/paths/fakemultiplerequestbodycontenttypes/post/responses/code200response/content/applicationjson/ApplicationjsonSchema.md @@ -0,0 +1,144 @@ +# ApplicationjsonSchema +public class ApplicationjsonSchema
+ +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 + +## Nested Class Summary +| Modifier and Type | Class and Description | +| ----------------- | ---------------------- | +| sealed interface | [ApplicationjsonSchema.ApplicationjsonSchema1Boxed](#applicationjsonschema1boxed)
sealed interface for validated payloads | +| record | [ApplicationjsonSchema.ApplicationjsonSchema1BoxedVoid](#applicationjsonschema1boxedvoid)
boxed class to store validated null payloads | +| record | [ApplicationjsonSchema.ApplicationjsonSchema1BoxedBoolean](#applicationjsonschema1boxedboolean)
boxed class to store validated boolean payloads | +| record | [ApplicationjsonSchema.ApplicationjsonSchema1BoxedNumber](#applicationjsonschema1boxednumber)
boxed class to store validated Number payloads | +| record | [ApplicationjsonSchema.ApplicationjsonSchema1BoxedString](#applicationjsonschema1boxedstring)
boxed class to store validated String payloads | +| record | [ApplicationjsonSchema.ApplicationjsonSchema1BoxedList](#applicationjsonschema1boxedlist)
boxed class to store validated List payloads | +| record | [ApplicationjsonSchema.ApplicationjsonSchema1BoxedMap](#applicationjsonschema1boxedmap)
boxed class to store validated Map payloads | +| static class | [ApplicationjsonSchema.ApplicationjsonSchema1](#applicationjsonschema1)
schema class | + +## ApplicationjsonSchema1Boxed +public sealed interface ApplicationjsonSchema1Boxed
+permits
+[ApplicationjsonSchema1BoxedVoid](#applicationjsonschema1boxedvoid), +[ApplicationjsonSchema1BoxedBoolean](#applicationjsonschema1boxedboolean), +[ApplicationjsonSchema1BoxedNumber](#applicationjsonschema1boxednumber), +[ApplicationjsonSchema1BoxedString](#applicationjsonschema1boxedstring), +[ApplicationjsonSchema1BoxedList](#applicationjsonschema1boxedlist), +[ApplicationjsonSchema1BoxedMap](#applicationjsonschema1boxedmap) + +sealed interface that stores validated payloads using boxed classes + +## ApplicationjsonSchema1BoxedVoid +public record ApplicationjsonSchema1BoxedVoid
+implements [ApplicationjsonSchema1Boxed](#applicationjsonschema1boxed) + +record that stores validated null payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| ApplicationjsonSchema1BoxedVoid(Nothing? data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| Nothing? | data()
validated payload | +| @Nullable Object | getData()
validated payload | + +## ApplicationjsonSchema1BoxedBoolean +public record ApplicationjsonSchema1BoxedBoolean
+implements [ApplicationjsonSchema1Boxed](#applicationjsonschema1boxed) + +record that stores validated boolean payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| ApplicationjsonSchema1BoxedBoolean(boolean data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| boolean | data()
validated payload | +| @Nullable Object | getData()
validated payload | + +## ApplicationjsonSchema1BoxedNumber +public record ApplicationjsonSchema1BoxedNumber
+implements [ApplicationjsonSchema1Boxed](#applicationjsonschema1boxed) + +record that stores validated Number payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| ApplicationjsonSchema1BoxedNumber(Number data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| Number | data()
validated payload | +| @Nullable Object | getData()
validated payload | + +## ApplicationjsonSchema1BoxedString +public record ApplicationjsonSchema1BoxedString
+implements [ApplicationjsonSchema1Boxed](#applicationjsonschema1boxed) + +record that stores validated String payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| ApplicationjsonSchema1BoxedString(String data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| String | data()
validated payload | +| @Nullable Object | getData()
validated payload | + +## ApplicationjsonSchema1BoxedList +public record ApplicationjsonSchema1BoxedList
+implements [ApplicationjsonSchema1Boxed](#applicationjsonschema1boxed) + +record that stores validated List payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| ApplicationjsonSchema1BoxedList(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 | + +## ApplicationjsonSchema1BoxedMap +public record ApplicationjsonSchema1BoxedMap
+implements [ApplicationjsonSchema1Boxed](#applicationjsonschema1boxed) + +record that stores validated Map payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| ApplicationjsonSchema1BoxedMap(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 | + +## ApplicationjsonSchema1 +public static class ApplicationjsonSchema1
+extends AnyTypeJsonSchema.AnyTypeJsonSchema1 + +A schema class that validates payloads + +| Methods Inherited from class org.openapijsonschematools.client.schemas.AnyTypeJsonSchema.AnyTypeJsonSchema1 | +| ------------------------------------------------------------------ | +| validate | +| validateAndBox | diff --git a/samples/client/petstore/kotlin/docs/paths/fakemultipleresponsebodies/FakemultipleresponsebodiesGet.md b/samples/client/petstore/kotlin/docs/paths/fakemultipleresponsebodies/FakemultipleresponsebodiesGet.md new file mode 100644 index 00000000000..dc5be34e68f --- /dev/null +++ b/samples/client/petstore/kotlin/docs/paths/fakemultipleresponsebodies/FakemultipleresponsebodiesGet.md @@ -0,0 +1,150 @@ +# FakemultipleresponsebodiesGet + +public class FakemultipleresponsebodiesGet + +A class that contains necessary endpoint classes +- a class that calls the endpoint method using the http verb +- a class that calls the endpoint method using the operationId name +- class(es) to store the request inputs +- builder(s) to set the request input data + +## Nested Class Summary +| Modifier and Type | Class and Description | +| ----------------- | --------------------- | +| static class | [Get](#get)
The class that has a get method to call the endpoint | +| interface | [MultipleResponseBodiesOperation](#multipleresponsebodiesoperation)
The interface that has a multipleResponseBodies method to call the endpoint | +| static class | [GetRequest](#getrequest)
The request inputs class | +| static class | [GetRequestBuilder](#getrequestbuilder)
A builder for the request input class | + +## Get +public static class Get extends ApiClient.ApiClient1 implements GetOperation
+ +a class that allows one to call the endpoint using a method named get + +### 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.servers.RootServer0; +import org.openapijsonschematools.client.servers.RootServer1; +import org.openapijsonschematools.client.servers.RootServer2; +import org.openapijsonschematools.client.paths.fakemultipleresponsebodies.get.responses.FakemultipleresponsebodiesGetCode200Response; +import org.openapijsonschematools.client.paths.fakemultipleresponsebodies.get.responses.FakemultipleresponsebodiesGetCode202Response; +import org.openapijsonschematools.client.servers.RootServerInfo; +import org.openapijsonschematools.client.paths.fakemultipleresponsebodies.FakemultipleresponsebodiesGet; +import org.openapijsonschematools.client.paths.fakemultipleresponsebodies.get.FakemultipleresponsebodiesGetResponses; + +import java.io.IOException; +import java.util.Arrays; +import java.util.List; +import java.util.Map; +import java.util.AbstractMap; + +// if you want to use a server that is not SERVER_0 pass it in here and change the ServerIndex input below +ApiConfiguration.ServerInfo serverInfo = new ApiConfiguration.ServerInfoBuilder() + .rootServerInfo( + new RootServerInfo.RootServerInfoBuilder() + .rootServer0(new RootServer0()) + .build() + ) + .build(); +ApiConfiguration.ServerIndexInfo serverIndexInfo = new ApiConfiguration.ServerIndexInfoBuilder() + .rootServerInfoServerIndex(RootServerInfo.ServerIndex.SERVER_0) + .build(); +Duration timeout = Duration.ofSeconds(1L); +Map> defaultHeaders = Map.of("User-Agent", List.of("OpenAPI-JSON-Schema-Generator/1.0.0/java")); +ApiConfiguration apiConfiguration = new ApiConfiguration( + serverInfo + serverIndexInfo, + timeout, + defaultHeaders +); +SchemaConfiguration schemaConfiguration = new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().build()); +FakemultipleresponsebodiesGet.Get apiClient = new FakemultipleresponsebodiesGet.Get(apiConfiguration, schemaConfiguration); + + +var request = new FakemultipleresponsebodiesGet.GetRequestBuilder().build(); + +FakemultipleresponsebodiesGetResponses.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; +} +if (response instanceof FakemultipleresponsebodiesGetResponses.EndpointFakemultipleresponsebodiesGetCode200Response castResponse) { + FakemultipleresponsebodiesGetCode200Response.ApplicationjsonResponseBody deserializedBody = (FakemultipleresponsebodiesGetCode200Response.ApplicationjsonResponseBody) castResponse.body; + // handle deserialized body here +} else { + FakemultipleresponsebodiesGetResponses.EndpointFakemultipleresponsebodiesGetCode202Response castResponse = (FakemultipleresponsebodiesGetResponses.EndpointFakemultipleresponsebodiesGetCode202Response) response; + FakemultipleresponsebodiesGetCode202Response.ApplicationjsonResponseBody deserializedBody = (FakemultipleresponsebodiesGetCode202Response.ApplicationjsonResponseBody) castResponse.body; + // handle deserialized body here +} +``` +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| Get(ApiConfiguration apiConfiguration, SchemaConfiguration schemaConfiguration)
Creates an instance | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| [FakemultipleresponsebodiesGetResponses.EndpointResponse](../../paths/fakemultipleresponsebodies/get/FakemultipleresponsebodiesGetResponses.md#endpointresponse) | get([GetRequest](#getrequest) request) | + +## MultipleResponseBodiesOperation +public interface MultipleResponseBodiesOperation
+ +an interface that allows one to call the endpoint using a method named multipleResponseBodies by the operationId + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| [FakemultipleresponsebodiesGetResponses.EndpointResponse](../../paths/fakemultipleresponsebodies/get/FakemultipleresponsebodiesGetResponses.md#endpointresponse) | multipleResponseBodies([GetRequest](#getrequest) request) | + +## GetRequest +public static class GetRequest
+ +a class that stores the final request inputs + +### Field Summary +| Modifier and Type | Field and Description | +| ----------------- | --------------------- | +| [RootServerInfo.@Nullable ServerIndex](../../RootServerInfo.md#serverindex) | serverIndex
optional. Note: this will override the value in apiConfiguration | +| @Nullable Duration | timeout
optional. Note: this will override the value in apiConfiguration | + +## GetRequestBuilder +public static class GetRequestBuilder
+ +a builder for request inputs + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| GetRequestBuilder()
Creates a builder that contains null for all parameters | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| [GetRequest](#getrequest) | build()
Returns the request input used to call an endpoint method | +| [GetRequestBuilder](#getrequestbuilder) | serverIndex([RootServerInfo.ServerIndex](../../RootServerInfo.md#serverindex) serverIndex)
sets the optional property. Note: this will override the value in apiConfiguration | +| [GetRequestBuilder](#getrequestbuilder) | timeout(Duration timeout)
sets the optional property. Note: this will override the value in apiConfiguration | + +[[Back to top]](#top) [[Back to README]](../../../README.md) diff --git a/samples/client/petstore/kotlin/docs/paths/fakemultipleresponsebodies/get/FakemultipleresponsebodiesGetResponses.md b/samples/client/petstore/kotlin/docs/paths/fakemultipleresponsebodies/get/FakemultipleresponsebodiesGetResponses.md new file mode 100644 index 00000000000..974c15a2235 --- /dev/null +++ b/samples/client/petstore/kotlin/docs/paths/fakemultipleresponsebodies/get/FakemultipleresponsebodiesGetResponses.md @@ -0,0 +1,40 @@ +# FakemultipleresponsebodiesGetResponses + +public class FakemultipleresponsebodiesGetResponses + +A class that contains necessary responses classes +- a sealed interface, EndpointResponse, that stores endpoint responses +- records for each endpoint response + +## Nested Class Summary +| Modifier and Type | Class and Description | +| ----------------- | --------------------- | +| sealed interface | [EndpointResponse](#endpointresponse)
stores the endpoint responses | +| record | [EndpointFakemultipleresponsebodiesGetCode200Response](#endpointfakemultipleresponsebodiesgetcode200response)
the response for 200 | +| record | [EndpointFakemultipleresponsebodiesGetCode202Response](#endpointfakemultipleresponsebodiesgetcode202response)
the response for 202 | + +## EndpointResponse +public sealed interface EndpointResponse permits
+[EndpointFakemultipleresponsebodiesGetCode200Response](#endpointfakemultipleresponsebodiesgetcode200response), +[EndpointFakemultipleresponsebodiesGetCode202Response](#endpointfakemultipleresponsebodiesgetcode202response) + +a sealed interface that stores endpoint responses + +## EndpointFakemultipleresponsebodiesGetCode200Response +public record EndpointFakemultipleresponsebodiesGetCode200Response( + HttpResponse response, + [FakemultipleresponsebodiesGetCode200Response.SealedResponseBody](../../../paths/fakemultipleresponsebodies/get/responses/FakemultipleresponsebodiesGetCode200Response.md#sealedresponsebody) body, + Nothing? headers +) implements EndpointResponse, ApiResponse
+ +a class that stores an endpoint response + +## EndpointFakemultipleresponsebodiesGetCode202Response +public record EndpointFakemultipleresponsebodiesGetCode202Response( + HttpResponse response, + [FakemultipleresponsebodiesGetCode202Response.SealedResponseBody](../../../paths/fakemultipleresponsebodies/get/responses/FakemultipleresponsebodiesGetCode202Response.md#sealedresponsebody) body, + Nothing? headers +) implements EndpointResponse, ApiResponse
+ +a class that stores an endpoint response + diff --git a/samples/client/petstore/kotlin/docs/paths/fakemultipleresponsebodies/get/responses/FakemultipleresponsebodiesGetCode200Response.md b/samples/client/petstore/kotlin/docs/paths/fakemultipleresponsebodies/get/responses/FakemultipleresponsebodiesGetCode200Response.md new file mode 100644 index 00000000000..73c87087c99 --- /dev/null +++ b/samples/client/petstore/kotlin/docs/paths/fakemultipleresponsebodies/get/responses/FakemultipleresponsebodiesGetCode200Response.md @@ -0,0 +1,87 @@ +# FakemultipleresponsebodiesGetCode200Response + +public class FakemultipleresponsebodiesGetCode200Response + +A class that contains necessary nested response classes +- SealedMediaType, a sealed interface which contains all the schema/encoding info for each contentType +- records which implement SealedMediaType, the concrete media types +- SealedResponseBody, a sealed interface which contains all the contentType/schema types +- records which implement SealedResponseBody, the concrete response body types +- a class that extends ResponseDeserializer and is used to deserialize responses + +## Nested Class Summary +| Modifier and Type | Class and Description | +| ----------------- | --------------------- | +| sealed interface | [FakemultipleresponsebodiesGetCode200Response.SealedMediaType](#sealedmediatype)
media type sealed interface | +| record | [FakemultipleresponsebodiesGetCode200Response.ApplicationjsonMediaType](#applicationjsonmediatype)
record storing schema + encoding for a specific contentType | +| sealed interface | [FakemultipleresponsebodiesGetCode200Response.SealedResponseBody](#sealedresponsebody)
response body sealed interface | +| record | [FakemultipleresponsebodiesGetCode200Response.ApplicationjsonResponseBody](#applicationjsonresponsebody)
implements sealed interface to store response body | +| static class | [FakemultipleresponsebodiesGetCode200Response.FakemultipleresponsebodiesGetCode200Response1](#fakemultipleresponsebodiesgetcode200response1)
class that deserializes responses | + +## SealedMediaType +public sealed interface SealedMediaType
+permits
+[ApplicationjsonMediaType](#applicationjsonmediatype) + +sealed interface that stores schema and encoding info + +## ApplicationjsonMediaType +public record ApplicationjsonMediaType
+implements [SealedMediaType](#sealedmediatype), MediaType<[ApplicationjsonSchema.ApplicationjsonSchema1](../../../../paths/fakemultipleresponsebodies/get/responses/code200response/content/applicationjson/ApplicationjsonSchema.md#applicationjsonschema1), Nothing?> + +class storing schema info for a specific contentType + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| ApplicationjsonMediaType()
Creates an instance | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| [ApplicationjsonSchema.ApplicationjsonSchema1](../../../../paths/fakemultipleresponsebodies/get/responses/code200response/content/applicationjson/ApplicationjsonSchema.md#applicationjsonschema1) | schema()
the schema for this MediaType | +| Nothing? | encoding()
the encoding info | + +## SealedResponseBody +public sealed interface SealedResponseBody
+permits
+[ApplicationjsonResponseBody](#applicationjsonresponsebody) + +sealed interface that stores response body + +## ApplicationjsonResponseBody +public record ApplicationjsonResponseBody
+implements [SealedResponseBody](#sealedresponsebody) + +A record class to store response body for contentType="application/json" + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| ApplicationjsonResponseBody(ApplicationjsonSchema.AnyTypeJsonSchema1Boxed body)
Creates an instance | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| ApplicationjsonSchema.AnyTypeJsonSchema1Boxed | body()
returns the body passed in in the constructor | + +## FakemultipleresponsebodiesGetCode200Response1 +public static class FakemultipleresponsebodiesGetCode200Response1
+extends ResponseDeserializer<[SealedResponseBody](#sealedresponsebody), Nothing?, [SealedMediaType](#sealedmediatype)> + +a class that deserializes responses + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| FakemultipleresponsebodiesGetCode200Response1()
Creates an instance | + +### Field Summary +| Modifier and Type | Field and Description | +| ----------------- | --------------------- | +| 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 | +| ----------------- | ---------------------- | +| ApiResponse<[SealedResponseBody](#sealedresponsebody), Nothing?> | deserialize(HttpResponse response, SchemaConfiguration configuration)
called by endpoint when deserialize responses | diff --git a/samples/client/petstore/kotlin/docs/paths/fakemultipleresponsebodies/get/responses/FakemultipleresponsebodiesGetCode202Response.md b/samples/client/petstore/kotlin/docs/paths/fakemultipleresponsebodies/get/responses/FakemultipleresponsebodiesGetCode202Response.md new file mode 100644 index 00000000000..3bd916b9b72 --- /dev/null +++ b/samples/client/petstore/kotlin/docs/paths/fakemultipleresponsebodies/get/responses/FakemultipleresponsebodiesGetCode202Response.md @@ -0,0 +1,87 @@ +# FakemultipleresponsebodiesGetCode202Response + +public class FakemultipleresponsebodiesGetCode202Response + +A class that contains necessary nested response classes +- SealedMediaType, a sealed interface which contains all the schema/encoding info for each contentType +- records which implement SealedMediaType, the concrete media types +- SealedResponseBody, a sealed interface which contains all the contentType/schema types +- records which implement SealedResponseBody, the concrete response body types +- a class that extends ResponseDeserializer and is used to deserialize responses + +## Nested Class Summary +| Modifier and Type | Class and Description | +| ----------------- | --------------------- | +| sealed interface | [FakemultipleresponsebodiesGetCode202Response.SealedMediaType](#sealedmediatype)
media type sealed interface | +| record | [FakemultipleresponsebodiesGetCode202Response.ApplicationjsonMediaType](#applicationjsonmediatype)
record storing schema + encoding for a specific contentType | +| sealed interface | [FakemultipleresponsebodiesGetCode202Response.SealedResponseBody](#sealedresponsebody)
response body sealed interface | +| record | [FakemultipleresponsebodiesGetCode202Response.ApplicationjsonResponseBody](#applicationjsonresponsebody)
implements sealed interface to store response body | +| static class | [FakemultipleresponsebodiesGetCode202Response.FakemultipleresponsebodiesGetCode202Response1](#fakemultipleresponsebodiesgetcode202response1)
class that deserializes responses | + +## SealedMediaType +public sealed interface SealedMediaType
+permits
+[ApplicationjsonMediaType](#applicationjsonmediatype) + +sealed interface that stores schema and encoding info + +## ApplicationjsonMediaType +public record ApplicationjsonMediaType
+implements [SealedMediaType](#sealedmediatype), MediaType<[ApplicationjsonSchema.ApplicationjsonSchema1](../../../../paths/fakemultipleresponsebodies/get/responses/code202response/content/applicationjson/ApplicationjsonSchema.md#applicationjsonschema1), Nothing?> + +class storing schema info for a specific contentType + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| ApplicationjsonMediaType()
Creates an instance | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| [ApplicationjsonSchema.ApplicationjsonSchema1](../../../../paths/fakemultipleresponsebodies/get/responses/code202response/content/applicationjson/ApplicationjsonSchema.md#applicationjsonschema1) | schema()
the schema for this MediaType | +| Nothing? | encoding()
the encoding info | + +## SealedResponseBody +public sealed interface SealedResponseBody
+permits
+[ApplicationjsonResponseBody](#applicationjsonresponsebody) + +sealed interface that stores response body + +## ApplicationjsonResponseBody +public record ApplicationjsonResponseBody
+implements [SealedResponseBody](#sealedresponsebody) + +A record class to store response body for contentType="application/json" + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| ApplicationjsonResponseBody(ApplicationjsonSchema.AnyTypeJsonSchema1Boxed body)
Creates an instance | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| ApplicationjsonSchema.AnyTypeJsonSchema1Boxed | body()
returns the body passed in in the constructor | + +## FakemultipleresponsebodiesGetCode202Response1 +public static class FakemultipleresponsebodiesGetCode202Response1
+extends ResponseDeserializer<[SealedResponseBody](#sealedresponsebody), Nothing?, [SealedMediaType](#sealedmediatype)> + +a class that deserializes responses + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| FakemultipleresponsebodiesGetCode202Response1()
Creates an instance | + +### Field Summary +| Modifier and Type | Field and Description | +| ----------------- | --------------------- | +| 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 | +| ----------------- | ---------------------- | +| ApiResponse<[SealedResponseBody](#sealedresponsebody), Nothing?> | deserialize(HttpResponse response, SchemaConfiguration configuration)
called by endpoint when deserialize responses | diff --git a/samples/client/petstore/kotlin/docs/paths/fakemultipleresponsebodies/get/responses/code200response/content/applicationjson/ApplicationjsonSchema.md b/samples/client/petstore/kotlin/docs/paths/fakemultipleresponsebodies/get/responses/code200response/content/applicationjson/ApplicationjsonSchema.md new file mode 100644 index 00000000000..b05260b1abf --- /dev/null +++ b/samples/client/petstore/kotlin/docs/paths/fakemultipleresponsebodies/get/responses/code200response/content/applicationjson/ApplicationjsonSchema.md @@ -0,0 +1,144 @@ +# ApplicationjsonSchema +public class ApplicationjsonSchema
+ +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 + +## Nested Class Summary +| Modifier and Type | Class and Description | +| ----------------- | ---------------------- | +| sealed interface | [ApplicationjsonSchema.ApplicationjsonSchema1Boxed](#applicationjsonschema1boxed)
sealed interface for validated payloads | +| record | [ApplicationjsonSchema.ApplicationjsonSchema1BoxedVoid](#applicationjsonschema1boxedvoid)
boxed class to store validated null payloads | +| record | [ApplicationjsonSchema.ApplicationjsonSchema1BoxedBoolean](#applicationjsonschema1boxedboolean)
boxed class to store validated boolean payloads | +| record | [ApplicationjsonSchema.ApplicationjsonSchema1BoxedNumber](#applicationjsonschema1boxednumber)
boxed class to store validated Number payloads | +| record | [ApplicationjsonSchema.ApplicationjsonSchema1BoxedString](#applicationjsonschema1boxedstring)
boxed class to store validated String payloads | +| record | [ApplicationjsonSchema.ApplicationjsonSchema1BoxedList](#applicationjsonschema1boxedlist)
boxed class to store validated List payloads | +| record | [ApplicationjsonSchema.ApplicationjsonSchema1BoxedMap](#applicationjsonschema1boxedmap)
boxed class to store validated Map payloads | +| static class | [ApplicationjsonSchema.ApplicationjsonSchema1](#applicationjsonschema1)
schema class | + +## ApplicationjsonSchema1Boxed +public sealed interface ApplicationjsonSchema1Boxed
+permits
+[ApplicationjsonSchema1BoxedVoid](#applicationjsonschema1boxedvoid), +[ApplicationjsonSchema1BoxedBoolean](#applicationjsonschema1boxedboolean), +[ApplicationjsonSchema1BoxedNumber](#applicationjsonschema1boxednumber), +[ApplicationjsonSchema1BoxedString](#applicationjsonschema1boxedstring), +[ApplicationjsonSchema1BoxedList](#applicationjsonschema1boxedlist), +[ApplicationjsonSchema1BoxedMap](#applicationjsonschema1boxedmap) + +sealed interface that stores validated payloads using boxed classes + +## ApplicationjsonSchema1BoxedVoid +public record ApplicationjsonSchema1BoxedVoid
+implements [ApplicationjsonSchema1Boxed](#applicationjsonschema1boxed) + +record that stores validated null payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| ApplicationjsonSchema1BoxedVoid(Nothing? data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| Nothing? | data()
validated payload | +| @Nullable Object | getData()
validated payload | + +## ApplicationjsonSchema1BoxedBoolean +public record ApplicationjsonSchema1BoxedBoolean
+implements [ApplicationjsonSchema1Boxed](#applicationjsonschema1boxed) + +record that stores validated boolean payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| ApplicationjsonSchema1BoxedBoolean(boolean data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| boolean | data()
validated payload | +| @Nullable Object | getData()
validated payload | + +## ApplicationjsonSchema1BoxedNumber +public record ApplicationjsonSchema1BoxedNumber
+implements [ApplicationjsonSchema1Boxed](#applicationjsonschema1boxed) + +record that stores validated Number payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| ApplicationjsonSchema1BoxedNumber(Number data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| Number | data()
validated payload | +| @Nullable Object | getData()
validated payload | + +## ApplicationjsonSchema1BoxedString +public record ApplicationjsonSchema1BoxedString
+implements [ApplicationjsonSchema1Boxed](#applicationjsonschema1boxed) + +record that stores validated String payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| ApplicationjsonSchema1BoxedString(String data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| String | data()
validated payload | +| @Nullable Object | getData()
validated payload | + +## ApplicationjsonSchema1BoxedList +public record ApplicationjsonSchema1BoxedList
+implements [ApplicationjsonSchema1Boxed](#applicationjsonschema1boxed) + +record that stores validated List payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| ApplicationjsonSchema1BoxedList(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 | + +## ApplicationjsonSchema1BoxedMap +public record ApplicationjsonSchema1BoxedMap
+implements [ApplicationjsonSchema1Boxed](#applicationjsonschema1boxed) + +record that stores validated Map payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| ApplicationjsonSchema1BoxedMap(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 | + +## ApplicationjsonSchema1 +public static class ApplicationjsonSchema1
+extends AnyTypeJsonSchema.AnyTypeJsonSchema1 + +A schema class that validates payloads + +| Methods Inherited from class org.openapijsonschematools.client.schemas.AnyTypeJsonSchema.AnyTypeJsonSchema1 | +| ------------------------------------------------------------------ | +| validate | +| validateAndBox | diff --git a/samples/client/petstore/kotlin/docs/paths/fakemultipleresponsebodies/get/responses/code202response/content/applicationjson/ApplicationjsonSchema.md b/samples/client/petstore/kotlin/docs/paths/fakemultipleresponsebodies/get/responses/code202response/content/applicationjson/ApplicationjsonSchema.md new file mode 100644 index 00000000000..b05260b1abf --- /dev/null +++ b/samples/client/petstore/kotlin/docs/paths/fakemultipleresponsebodies/get/responses/code202response/content/applicationjson/ApplicationjsonSchema.md @@ -0,0 +1,144 @@ +# ApplicationjsonSchema +public class ApplicationjsonSchema
+ +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 + +## Nested Class Summary +| Modifier and Type | Class and Description | +| ----------------- | ---------------------- | +| sealed interface | [ApplicationjsonSchema.ApplicationjsonSchema1Boxed](#applicationjsonschema1boxed)
sealed interface for validated payloads | +| record | [ApplicationjsonSchema.ApplicationjsonSchema1BoxedVoid](#applicationjsonschema1boxedvoid)
boxed class to store validated null payloads | +| record | [ApplicationjsonSchema.ApplicationjsonSchema1BoxedBoolean](#applicationjsonschema1boxedboolean)
boxed class to store validated boolean payloads | +| record | [ApplicationjsonSchema.ApplicationjsonSchema1BoxedNumber](#applicationjsonschema1boxednumber)
boxed class to store validated Number payloads | +| record | [ApplicationjsonSchema.ApplicationjsonSchema1BoxedString](#applicationjsonschema1boxedstring)
boxed class to store validated String payloads | +| record | [ApplicationjsonSchema.ApplicationjsonSchema1BoxedList](#applicationjsonschema1boxedlist)
boxed class to store validated List payloads | +| record | [ApplicationjsonSchema.ApplicationjsonSchema1BoxedMap](#applicationjsonschema1boxedmap)
boxed class to store validated Map payloads | +| static class | [ApplicationjsonSchema.ApplicationjsonSchema1](#applicationjsonschema1)
schema class | + +## ApplicationjsonSchema1Boxed +public sealed interface ApplicationjsonSchema1Boxed
+permits
+[ApplicationjsonSchema1BoxedVoid](#applicationjsonschema1boxedvoid), +[ApplicationjsonSchema1BoxedBoolean](#applicationjsonschema1boxedboolean), +[ApplicationjsonSchema1BoxedNumber](#applicationjsonschema1boxednumber), +[ApplicationjsonSchema1BoxedString](#applicationjsonschema1boxedstring), +[ApplicationjsonSchema1BoxedList](#applicationjsonschema1boxedlist), +[ApplicationjsonSchema1BoxedMap](#applicationjsonschema1boxedmap) + +sealed interface that stores validated payloads using boxed classes + +## ApplicationjsonSchema1BoxedVoid +public record ApplicationjsonSchema1BoxedVoid
+implements [ApplicationjsonSchema1Boxed](#applicationjsonschema1boxed) + +record that stores validated null payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| ApplicationjsonSchema1BoxedVoid(Nothing? data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| Nothing? | data()
validated payload | +| @Nullable Object | getData()
validated payload | + +## ApplicationjsonSchema1BoxedBoolean +public record ApplicationjsonSchema1BoxedBoolean
+implements [ApplicationjsonSchema1Boxed](#applicationjsonschema1boxed) + +record that stores validated boolean payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| ApplicationjsonSchema1BoxedBoolean(boolean data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| boolean | data()
validated payload | +| @Nullable Object | getData()
validated payload | + +## ApplicationjsonSchema1BoxedNumber +public record ApplicationjsonSchema1BoxedNumber
+implements [ApplicationjsonSchema1Boxed](#applicationjsonschema1boxed) + +record that stores validated Number payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| ApplicationjsonSchema1BoxedNumber(Number data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| Number | data()
validated payload | +| @Nullable Object | getData()
validated payload | + +## ApplicationjsonSchema1BoxedString +public record ApplicationjsonSchema1BoxedString
+implements [ApplicationjsonSchema1Boxed](#applicationjsonschema1boxed) + +record that stores validated String payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| ApplicationjsonSchema1BoxedString(String data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| String | data()
validated payload | +| @Nullable Object | getData()
validated payload | + +## ApplicationjsonSchema1BoxedList +public record ApplicationjsonSchema1BoxedList
+implements [ApplicationjsonSchema1Boxed](#applicationjsonschema1boxed) + +record that stores validated List payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| ApplicationjsonSchema1BoxedList(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 | + +## ApplicationjsonSchema1BoxedMap +public record ApplicationjsonSchema1BoxedMap
+implements [ApplicationjsonSchema1Boxed](#applicationjsonschema1boxed) + +record that stores validated Map payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| ApplicationjsonSchema1BoxedMap(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 | + +## ApplicationjsonSchema1 +public static class ApplicationjsonSchema1
+extends AnyTypeJsonSchema.AnyTypeJsonSchema1 + +A schema class that validates payloads + +| Methods Inherited from class org.openapijsonschematools.client.schemas.AnyTypeJsonSchema.AnyTypeJsonSchema1 | +| ------------------------------------------------------------------ | +| validate | +| validateAndBox | diff --git a/samples/client/petstore/kotlin/docs/paths/fakemultiplesecurities/FakemultiplesecuritiesGet.md b/samples/client/petstore/kotlin/docs/paths/fakemultiplesecurities/FakemultiplesecuritiesGet.md new file mode 100644 index 00000000000..4ce19768eab --- /dev/null +++ b/samples/client/petstore/kotlin/docs/paths/fakemultiplesecurities/FakemultiplesecuritiesGet.md @@ -0,0 +1,163 @@ +# FakemultiplesecuritiesGet + +public class FakemultiplesecuritiesGet + +A class that contains necessary endpoint classes +- a class that calls the endpoint method using the http verb +- a class that calls the endpoint method using the operationId name +- class(es) to store the request inputs +- builder(s) to set the request input data + +## Nested Class Summary +| Modifier and Type | Class and Description | +| ----------------- | --------------------- | +| static class | [Get](#get)
The class that has a get method to call the endpoint | +| interface | [MultipleSecuritiesOperation](#multiplesecuritiesoperation)
The interface that has a multipleSecurities method to call the endpoint | +| static class | [GetRequest](#getrequest)
The request inputs class | +| static class | [GetRequestBuilder](#getrequestbuilder)
A builder for the request input class | + +## Get +public static class Get extends ApiClient.ApiClient1 implements GetOperation
+ +a class that allows one to call the endpoint using a method named get + +### 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.fakemultiplesecurities.get.FakemultiplesecuritiesGetSecurityInfo; +import org.openapijsonschematools.client.servers.RootServer0; +import org.openapijsonschematools.client.servers.RootServer1; +import org.openapijsonschematools.client.servers.RootServer2; +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.FakemultiplesecuritiesGetCode200Response; +import org.openapijsonschematools.client.servers.RootServerInfo; +import org.openapijsonschematools.client.paths.fakemultiplesecurities.FakemultiplesecuritiesGet; +import org.openapijsonschematools.client.paths.fakemultiplesecurities.get.FakemultiplesecuritiesGetResponses; + +import java.io.IOException; +import java.util.Arrays; +import java.util.List; +import java.util.Map; +import java.util.AbstractMap; + +// if you want to use a server that is not SERVER_0 pass it in here and change the ServerIndex input below +ApiConfiguration.ServerInfo serverInfo = new ApiConfiguration.ServerInfoBuilder() + .rootServerInfo( + new RootServerInfo.RootServerInfoBuilder() + .rootServer0(new RootServer0()) + .build() + ) + .build(); +ApiConfiguration.ServerIndexInfo serverIndexInfo = new ApiConfiguration.ServerIndexInfoBuilder() + .rootServerInfoServerIndex(RootServerInfo.ServerIndex.SERVER_0) + .build(); +List securitySchemes = new ArrayList(); +securitySchemes.add( + new HttpBasicTest("someUserId", "somePassword"); +); +securitySchemes.add( + new ApiKey("someApiKey"); +); +ApiConfiguration.SecurityIndexInfo securityIndexInfo = new ApiConfiguration.SecurityIndexInfoBuilder() + .fakemultiplesecuritiesGetSecurityRequirementObject0SecurityIndex(FakemultiplesecuritiesGetSecurityRequirementObject0.SecurityIndex.SECURITY_0) + .build(); +Duration timeout = Duration.ofSeconds(1L); +Map> defaultHeaders = Map.of("User-Agent", List.of("OpenAPI-JSON-Schema-Generator/1.0.0/java")); +ApiConfiguration apiConfiguration = new ApiConfiguration( + serverInfo + serverIndexInfo, + securitySchemes, + securityIndexInfo, + timeout, + defaultHeaders +); +SchemaConfiguration schemaConfiguration = new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().build()); +FakemultiplesecuritiesGet.Get apiClient = new FakemultiplesecuritiesGet.Get(apiConfiguration, schemaConfiguration); + + +var request = new FakemultiplesecuritiesGet.GetRequestBuilder().build(); + +FakemultiplesecuritiesGetResponses.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; +} +FakemultiplesecuritiesGetResponses.EndpointFakemultiplesecuritiesGetCode200Response castResponse = (FakemultiplesecuritiesGetResponses.EndpointFakemultiplesecuritiesGetCode200Response) response; +FakemultiplesecuritiesGetCode200Response.ApplicationjsonResponseBody deserializedBody = (FakemultiplesecuritiesGetCode200Response.ApplicationjsonResponseBody) castResponse.body; +// handle deserialized body here +``` +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| Get(ApiConfiguration apiConfiguration, SchemaConfiguration schemaConfiguration)
Creates an instance | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| [FakemultiplesecuritiesGetResponses.EndpointResponse](../../paths/fakemultiplesecurities/get/FakemultiplesecuritiesGetResponses.md#endpointresponse) | get([GetRequest](#getrequest) request) | + +## MultipleSecuritiesOperation +public interface MultipleSecuritiesOperation
+ +an interface that allows one to call the endpoint using a method named multipleSecurities by the operationId + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| [FakemultiplesecuritiesGetResponses.EndpointResponse](../../paths/fakemultiplesecurities/get/FakemultiplesecuritiesGetResponses.md#endpointresponse) | multipleSecurities([GetRequest](#getrequest) request) | + +## GetRequest +public static class GetRequest
+ +a class that stores the final request inputs + +### Field Summary +| Modifier and Type | Field and Description | +| ----------------- | --------------------- | +| [RootServerInfo.@Nullable ServerIndex](../../RootServerInfo.md#serverindex) | serverIndex
optional. Note: this will override the value in apiConfiguration | +| [FakemultiplesecuritiesGetSecurityInfo.@Nullable SecurityIndex](../../paths/fakemultiplesecurities/get/FakemultiplesecuritiesGetSecurityInfo.md#securityindex) | securityIndex
optional. Note: this will override the value in apiConfiguration | +| @Nullable Duration | timeout
optional. Note: this will override the value in apiConfiguration | + +## GetRequestBuilder +public static class GetRequestBuilder
+ +a builder for request inputs + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| GetRequestBuilder()
Creates a builder that contains null for all parameters | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| [GetRequest](#getrequest) | build()
Returns the request input used to call an endpoint method | +| [GetRequestBuilder](#getrequestbuilder) | serverIndex([RootServerInfo.ServerIndex](../../RootServerInfo.md#serverindex) serverIndex)
sets the optional property. Note: this will override the value in apiConfiguration | +| [GetRequestBuilder](#getrequestbuilder) | securityIndex([FakemultiplesecuritiesGetSecurityInfo.SecurityIndex](../../paths/fakemultiplesecurities/get/FakemultiplesecuritiesGetSecurityInfo.md#securityindex) securityIndex)
sets the optional property. Note: this will override the value in apiConfiguration | +| [GetRequestBuilder](#getrequestbuilder) | timeout(Duration timeout)
sets the optional property. Note: this will override the value in apiConfiguration | + +[[Back to top]](#top) [[Back to README]](../../../README.md) diff --git a/samples/client/petstore/kotlin/docs/paths/fakemultiplesecurities/get/FakemultiplesecuritiesGetResponses.md b/samples/client/petstore/kotlin/docs/paths/fakemultiplesecurities/get/FakemultiplesecuritiesGetResponses.md new file mode 100644 index 00000000000..ae5d846c207 --- /dev/null +++ b/samples/client/petstore/kotlin/docs/paths/fakemultiplesecurities/get/FakemultiplesecuritiesGetResponses.md @@ -0,0 +1,29 @@ +# FakemultiplesecuritiesGetResponses + +public class FakemultiplesecuritiesGetResponses + +A class that contains necessary responses classes +- a sealed interface, EndpointResponse, that stores endpoint responses +- records for each endpoint response + +## Nested Class Summary +| Modifier and Type | Class and Description | +| ----------------- | --------------------- | +| sealed interface | [EndpointResponse](#endpointresponse)
stores the endpoint responses | +| record | [EndpointFakemultiplesecuritiesGetCode200Response](#endpointfakemultiplesecuritiesgetcode200response)
the response for 200 | + +## EndpointResponse +public sealed interface EndpointResponse permits
+[EndpointFakemultiplesecuritiesGetCode200Response](#endpointfakemultiplesecuritiesgetcode200response) + +a sealed interface that stores endpoint responses + +## EndpointFakemultiplesecuritiesGetCode200Response +public record EndpointFakemultiplesecuritiesGetCode200Response( + HttpResponse response, + [FakemultiplesecuritiesGetCode200Response.SealedResponseBody](../../../paths/fakemultiplesecurities/get/responses/FakemultiplesecuritiesGetCode200Response.md#sealedresponsebody) body, + Nothing? headers +) implements EndpointResponse, ApiResponse
+ +a class that stores an endpoint response + diff --git a/samples/client/petstore/kotlin/docs/paths/fakemultiplesecurities/get/FakemultiplesecuritiesGetSecurityInfo.md b/samples/client/petstore/kotlin/docs/paths/fakemultiplesecurities/get/FakemultiplesecuritiesGetSecurityInfo.md new file mode 100644 index 00000000000..dfdd24f765d --- /dev/null +++ b/samples/client/petstore/kotlin/docs/paths/fakemultiplesecurities/get/FakemultiplesecuritiesGetSecurityInfo.md @@ -0,0 +1,44 @@ +# FakemultiplesecuritiesGetSecurityInfo +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 +- an enum class that describes security index values + +## Nested Class Summary +| Modifier and Type | Class and Description | +| ----------------- | --------------------- | +| static class | [FakemultiplesecuritiesGetSecurityInfo.FakemultiplesecuritiesGetSecurityInfo1](#fakemultiplesecuritiesgetsecurityinfo1)
SecurityRequirementObjectProvider +| enum | [FakemultiplesecuritiesGetSecurityInfo.SecurityIndex](#securityindex)
class that stores a security index | + +## FakemultiplesecuritiesGetSecurityInfo1 +implements SecurityRequirementObjectProvider<[SecurityIndex](#securityindex)> + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| FakemultiplesecuritiesGetSecurityInfo1()
Creates an instance | + +### 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 | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| SecurityRequirementObject | getSecurityRequirementObject(@Nullable [SecurityIndex](#securityindex) securityIndex)
If null is input, then the instance's securityIndex will be used | + +## SecurityIndex +enum SecurityIndex
+ +### Enum Constant Summary +| Enum Constant And Description | +| ----------------------------- | +| SECURITY_0
security 0 | +| SECURITY_1
security 1 | +| SECURITY_2
security 2 | diff --git a/samples/client/petstore/kotlin/docs/paths/fakemultiplesecurities/get/responses/FakemultiplesecuritiesGetCode200Response.md b/samples/client/petstore/kotlin/docs/paths/fakemultiplesecurities/get/responses/FakemultiplesecuritiesGetCode200Response.md new file mode 100644 index 00000000000..fec728526f9 --- /dev/null +++ b/samples/client/petstore/kotlin/docs/paths/fakemultiplesecurities/get/responses/FakemultiplesecuritiesGetCode200Response.md @@ -0,0 +1,87 @@ +# FakemultiplesecuritiesGetCode200Response + +public class FakemultiplesecuritiesGetCode200Response + +A class that contains necessary nested response classes +- SealedMediaType, a sealed interface which contains all the schema/encoding info for each contentType +- records which implement SealedMediaType, the concrete media types +- SealedResponseBody, a sealed interface which contains all the contentType/schema types +- records which implement SealedResponseBody, the concrete response body types +- a class that extends ResponseDeserializer and is used to deserialize responses + +## Nested Class Summary +| Modifier and Type | Class and Description | +| ----------------- | --------------------- | +| sealed interface | [FakemultiplesecuritiesGetCode200Response.SealedMediaType](#sealedmediatype)
media type sealed interface | +| record | [FakemultiplesecuritiesGetCode200Response.ApplicationjsonMediaType](#applicationjsonmediatype)
record storing schema + encoding for a specific contentType | +| sealed interface | [FakemultiplesecuritiesGetCode200Response.SealedResponseBody](#sealedresponsebody)
response body sealed interface | +| record | [FakemultiplesecuritiesGetCode200Response.ApplicationjsonResponseBody](#applicationjsonresponsebody)
implements sealed interface to store response body | +| static class | [FakemultiplesecuritiesGetCode200Response.FakemultiplesecuritiesGetCode200Response1](#fakemultiplesecuritiesgetcode200response1)
class that deserializes responses | + +## SealedMediaType +public sealed interface SealedMediaType
+permits
+[ApplicationjsonMediaType](#applicationjsonmediatype) + +sealed interface that stores schema and encoding info + +## ApplicationjsonMediaType +public record ApplicationjsonMediaType
+implements [SealedMediaType](#sealedmediatype), MediaType<[ApplicationjsonSchema.ApplicationjsonSchema1](../../../../paths/fakemultiplesecurities/get/responses/code200response/content/applicationjson/ApplicationjsonSchema.md#applicationjsonschema1), Nothing?> + +class storing schema info for a specific contentType + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| ApplicationjsonMediaType()
Creates an instance | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| [ApplicationjsonSchema.ApplicationjsonSchema1](../../../../paths/fakemultiplesecurities/get/responses/code200response/content/applicationjson/ApplicationjsonSchema.md#applicationjsonschema1) | schema()
the schema for this MediaType | +| Nothing? | encoding()
the encoding info | + +## SealedResponseBody +public sealed interface SealedResponseBody
+permits
+[ApplicationjsonResponseBody](#applicationjsonresponsebody) + +sealed interface that stores response body + +## ApplicationjsonResponseBody +public record ApplicationjsonResponseBody
+implements [SealedResponseBody](#sealedresponsebody) + +A record class to store response body for contentType="application/json" + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| ApplicationjsonResponseBody(ApplicationjsonSchema.AnyTypeJsonSchema1Boxed body)
Creates an instance | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| ApplicationjsonSchema.AnyTypeJsonSchema1Boxed | body()
returns the body passed in in the constructor | + +## FakemultiplesecuritiesGetCode200Response1 +public static class FakemultiplesecuritiesGetCode200Response1
+extends ResponseDeserializer<[SealedResponseBody](#sealedresponsebody), Nothing?, [SealedMediaType](#sealedmediatype)> + +a class that deserializes responses + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| FakemultiplesecuritiesGetCode200Response1()
Creates an instance | + +### Field Summary +| Modifier and Type | Field and Description | +| ----------------- | --------------------- | +| 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 | +| ----------------- | ---------------------- | +| ApiResponse<[SealedResponseBody](#sealedresponsebody), Nothing?> | deserialize(HttpResponse response, SchemaConfiguration configuration)
called by endpoint when deserialize responses | diff --git a/samples/client/petstore/kotlin/docs/paths/fakemultiplesecurities/get/responses/code200response/content/applicationjson/ApplicationjsonSchema.md b/samples/client/petstore/kotlin/docs/paths/fakemultiplesecurities/get/responses/code200response/content/applicationjson/ApplicationjsonSchema.md new file mode 100644 index 00000000000..b05260b1abf --- /dev/null +++ b/samples/client/petstore/kotlin/docs/paths/fakemultiplesecurities/get/responses/code200response/content/applicationjson/ApplicationjsonSchema.md @@ -0,0 +1,144 @@ +# ApplicationjsonSchema +public class ApplicationjsonSchema
+ +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 + +## Nested Class Summary +| Modifier and Type | Class and Description | +| ----------------- | ---------------------- | +| sealed interface | [ApplicationjsonSchema.ApplicationjsonSchema1Boxed](#applicationjsonschema1boxed)
sealed interface for validated payloads | +| record | [ApplicationjsonSchema.ApplicationjsonSchema1BoxedVoid](#applicationjsonschema1boxedvoid)
boxed class to store validated null payloads | +| record | [ApplicationjsonSchema.ApplicationjsonSchema1BoxedBoolean](#applicationjsonschema1boxedboolean)
boxed class to store validated boolean payloads | +| record | [ApplicationjsonSchema.ApplicationjsonSchema1BoxedNumber](#applicationjsonschema1boxednumber)
boxed class to store validated Number payloads | +| record | [ApplicationjsonSchema.ApplicationjsonSchema1BoxedString](#applicationjsonschema1boxedstring)
boxed class to store validated String payloads | +| record | [ApplicationjsonSchema.ApplicationjsonSchema1BoxedList](#applicationjsonschema1boxedlist)
boxed class to store validated List payloads | +| record | [ApplicationjsonSchema.ApplicationjsonSchema1BoxedMap](#applicationjsonschema1boxedmap)
boxed class to store validated Map payloads | +| static class | [ApplicationjsonSchema.ApplicationjsonSchema1](#applicationjsonschema1)
schema class | + +## ApplicationjsonSchema1Boxed +public sealed interface ApplicationjsonSchema1Boxed
+permits
+[ApplicationjsonSchema1BoxedVoid](#applicationjsonschema1boxedvoid), +[ApplicationjsonSchema1BoxedBoolean](#applicationjsonschema1boxedboolean), +[ApplicationjsonSchema1BoxedNumber](#applicationjsonschema1boxednumber), +[ApplicationjsonSchema1BoxedString](#applicationjsonschema1boxedstring), +[ApplicationjsonSchema1BoxedList](#applicationjsonschema1boxedlist), +[ApplicationjsonSchema1BoxedMap](#applicationjsonschema1boxedmap) + +sealed interface that stores validated payloads using boxed classes + +## ApplicationjsonSchema1BoxedVoid +public record ApplicationjsonSchema1BoxedVoid
+implements [ApplicationjsonSchema1Boxed](#applicationjsonschema1boxed) + +record that stores validated null payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| ApplicationjsonSchema1BoxedVoid(Nothing? data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| Nothing? | data()
validated payload | +| @Nullable Object | getData()
validated payload | + +## ApplicationjsonSchema1BoxedBoolean +public record ApplicationjsonSchema1BoxedBoolean
+implements [ApplicationjsonSchema1Boxed](#applicationjsonschema1boxed) + +record that stores validated boolean payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| ApplicationjsonSchema1BoxedBoolean(boolean data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| boolean | data()
validated payload | +| @Nullable Object | getData()
validated payload | + +## ApplicationjsonSchema1BoxedNumber +public record ApplicationjsonSchema1BoxedNumber
+implements [ApplicationjsonSchema1Boxed](#applicationjsonschema1boxed) + +record that stores validated Number payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| ApplicationjsonSchema1BoxedNumber(Number data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| Number | data()
validated payload | +| @Nullable Object | getData()
validated payload | + +## ApplicationjsonSchema1BoxedString +public record ApplicationjsonSchema1BoxedString
+implements [ApplicationjsonSchema1Boxed](#applicationjsonschema1boxed) + +record that stores validated String payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| ApplicationjsonSchema1BoxedString(String data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| String | data()
validated payload | +| @Nullable Object | getData()
validated payload | + +## ApplicationjsonSchema1BoxedList +public record ApplicationjsonSchema1BoxedList
+implements [ApplicationjsonSchema1Boxed](#applicationjsonschema1boxed) + +record that stores validated List payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| ApplicationjsonSchema1BoxedList(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 | + +## ApplicationjsonSchema1BoxedMap +public record ApplicationjsonSchema1BoxedMap
+implements [ApplicationjsonSchema1Boxed](#applicationjsonschema1boxed) + +record that stores validated Map payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| ApplicationjsonSchema1BoxedMap(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 | + +## ApplicationjsonSchema1 +public static class ApplicationjsonSchema1
+extends AnyTypeJsonSchema.AnyTypeJsonSchema1 + +A schema class that validates payloads + +| Methods Inherited from class org.openapijsonschematools.client.schemas.AnyTypeJsonSchema.AnyTypeJsonSchema1 | +| ------------------------------------------------------------------ | +| validate | +| validateAndBox | diff --git a/samples/client/petstore/kotlin/docs/paths/fakemultiplesecurities/get/security/FakemultiplesecuritiesGetSecurityRequirementObject0.md b/samples/client/petstore/kotlin/docs/paths/fakemultiplesecurities/get/security/FakemultiplesecuritiesGetSecurityRequirementObject0.md new file mode 100644 index 00000000000..e762a030213 --- /dev/null +++ b/samples/client/petstore/kotlin/docs/paths/fakemultiplesecurities/get/security/FakemultiplesecuritiesGetSecurityRequirementObject0.md @@ -0,0 +1,15 @@ +# FakemultiplesecuritiesGetSecurityRequirementObject0 +FakemultiplesecuritiesGetSecurityRequirementObject0.java + +public class FakemultiplesecuritiesGetSecurityRequirementObject0 +extends EmptySecurityRequirementObject + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| FakemultiplesecuritiesGetSecurityRequirementObject0()
Creates an instance | + +### Field Summary +| Modifier and Type | Field and Description | +| ----------------- | --------------------- | +| Map, List> | securitySchemeToScopes = Map.ofEntries() | diff --git a/samples/client/petstore/kotlin/docs/paths/fakemultiplesecurities/get/security/FakemultiplesecuritiesGetSecurityRequirementObject1.md b/samples/client/petstore/kotlin/docs/paths/fakemultiplesecurities/get/security/FakemultiplesecuritiesGetSecurityRequirementObject1.md new file mode 100644 index 00000000000..2fc62ae0497 --- /dev/null +++ b/samples/client/petstore/kotlin/docs/paths/fakemultiplesecurities/get/security/FakemultiplesecuritiesGetSecurityRequirementObject1.md @@ -0,0 +1,15 @@ +# FakemultiplesecuritiesGetSecurityRequirementObject1 +FakemultiplesecuritiesGetSecurityRequirementObject1.java + +public class FakemultiplesecuritiesGetSecurityRequirementObject1 +extends SecurityRequirementObject + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| FakemultiplesecuritiesGetSecurityRequirementObject1()
Creates an instance | + +### 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()
    )) | diff --git a/samples/client/petstore/kotlin/docs/paths/fakemultiplesecurities/get/security/FakemultiplesecuritiesGetSecurityRequirementObject2.md b/samples/client/petstore/kotlin/docs/paths/fakemultiplesecurities/get/security/FakemultiplesecuritiesGetSecurityRequirementObject2.md new file mode 100644 index 00000000000..b073e315c8b --- /dev/null +++ b/samples/client/petstore/kotlin/docs/paths/fakemultiplesecurities/get/security/FakemultiplesecuritiesGetSecurityRequirementObject2.md @@ -0,0 +1,15 @@ +# FakemultiplesecuritiesGetSecurityRequirementObject2 +FakemultiplesecuritiesGetSecurityRequirementObject2.java + +public class FakemultiplesecuritiesGetSecurityRequirementObject2 +extends SecurityRequirementObject + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| FakemultiplesecuritiesGetSecurityRequirementObject2()
Creates an instance | + +### 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")
    )) | diff --git a/samples/client/petstore/kotlin/docs/paths/fakeobjinquery/FakeobjinqueryGet.md b/samples/client/petstore/kotlin/docs/paths/fakeobjinquery/FakeobjinqueryGet.md new file mode 100644 index 00000000000..0fdd2d46e90 --- /dev/null +++ b/samples/client/petstore/kotlin/docs/paths/fakeobjinquery/FakeobjinqueryGet.md @@ -0,0 +1,145 @@ +# FakeobjinqueryGet + +public class FakeobjinqueryGet + +A class that contains necessary endpoint classes +- a class that calls the endpoint method using the http verb +- a class that calls the endpoint method using the operationId name +- class(es) to store the request inputs +- builder(s) to set the request input data + +## Nested Class Summary +| Modifier and Type | Class and Description | +| ----------------- | --------------------- | +| static class | [Get](#get)
The class that has a get method to call the endpoint | +| interface | [ObjectInQueryOperation](#objectinqueryoperation)
The interface that has a objectInQuery method to call the endpoint | +| static class | [GetRequest](#getrequest)
The request inputs class | +| static class | [GetRequestBuilder](#getrequestbuilder)
A builder for the request input class | + +## Get +public static class Get extends ApiClient.ApiClient1 implements GetOperation
+ +a class that allows one to call the endpoint using a method named get + +### 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.fakeobjinquery.get.FakeobjinqueryGetQueryParameters; +import org.openapijsonschematools.client.RootServerInfo; +import org.openapijsonschematools.client.servers.RootServer0; +import org.openapijsonschematools.client.servers.RootServer1; +import org.openapijsonschematools.client.servers.RootServer2; +import org.openapijsonschematools.client.paths.fakeobjinquery.get.responses.FakeobjinqueryGetCode200Response; +import org.openapijsonschematools.client.servers.RootServerInfo; +import org.openapijsonschematools.client.paths.fakeobjinquery.FakeobjinqueryGet; +import org.openapijsonschematools.client.paths.fakeobjinquery.get.FakeobjinqueryGetResponses; + +import java.io.IOException; +import java.util.Arrays; +import java.util.List; +import java.util.Map; +import java.util.AbstractMap; + +// if you want to use a server that is not SERVER_0 pass it in here and change the ServerIndex input below +ApiConfiguration.ServerInfo serverInfo = new ApiConfiguration.ServerInfoBuilder() + .rootServerInfo( + new RootServerInfo.RootServerInfoBuilder() + .rootServer0(new RootServer0()) + .build() + ) + .build(); +ApiConfiguration.ServerIndexInfo serverIndexInfo = new ApiConfiguration.ServerIndexInfoBuilder() + .rootServerInfoServerIndex(RootServerInfo.ServerIndex.SERVER_0) + .build(); +Duration timeout = Duration.ofSeconds(1L); +Map> defaultHeaders = Map.of("User-Agent", List.of("OpenAPI-JSON-Schema-Generator/1.0.0/java")); +ApiConfiguration apiConfiguration = new ApiConfiguration( + serverInfo + serverIndexInfo, + timeout, + defaultHeaders +); +SchemaConfiguration schemaConfiguration = new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().build()); +FakeobjinqueryGet.Get apiClient = new FakeobjinqueryGet.Get(apiConfiguration, schemaConfiguration); + + +var request = new FakeobjinqueryGet.GetRequestBuilder().build(); + +FakeobjinqueryGetResponses.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; +} +FakeobjinqueryGetResponses.EndpointFakeobjinqueryGetCode200Response castResponse = (FakeobjinqueryGetResponses.EndpointFakeobjinqueryGetCode200Response) response; +``` +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| Get(ApiConfiguration apiConfiguration, SchemaConfiguration schemaConfiguration)
Creates an instance | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| [FakeobjinqueryGetResponses.EndpointResponse](../../paths/fakeobjinquery/get/FakeobjinqueryGetResponses.md#endpointresponse) | get([GetRequest](#getrequest) request) | + +## ObjectInQueryOperation +public interface ObjectInQueryOperation
+ +an interface that allows one to call the endpoint using a method named objectInQuery by the operationId + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| [FakeobjinqueryGetResponses.EndpointResponse](../../paths/fakeobjinquery/get/FakeobjinqueryGetResponses.md#endpointresponse) | objectInQuery([GetRequest](#getrequest) request) | + +## GetRequest +public static class GetRequest
+ +a class that stores the final request inputs + +### Field Summary +| Modifier and Type | Field and Description | +| ----------------- | --------------------- | +| [FakeobjinqueryGetQueryParameters.@Nullable QueryParametersMap](../../paths/fakeobjinquery/get/FakeobjinqueryGetQueryParameters.md#queryparametersmap) | queryParameters
optional | +| [RootServerInfo.@Nullable ServerIndex](../../RootServerInfo.md#serverindex) | serverIndex
optional. Note: this will override the value in apiConfiguration | +| @Nullable Duration | timeout
optional. Note: this will override the value in apiConfiguration | + +## GetRequestBuilder +public static class GetRequestBuilder
+ +a builder for request inputs + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| GetRequestBuilder()
Creates a builder that contains null for all parameters | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| [GetRequest](#getrequest) | build()
Returns the request input used to call an endpoint method | +| [GetRequestBuilder](#getrequestbuilder) | queryParameters([FakeobjinqueryGetQueryParametersQueryParametersMap](../../paths/fakeobjinquery/get/FakeobjinqueryGetQueryParameters.md#queryparametersmap) queryParameters)
sets the optional property | +| [GetRequestBuilder](#getrequestbuilder) | serverIndex([RootServerInfo.ServerIndex](../../RootServerInfo.md#serverindex) serverIndex)
sets the optional property. Note: this will override the value in apiConfiguration | +| [GetRequestBuilder](#getrequestbuilder) | timeout(Duration timeout)
sets the optional property. Note: this will override the value in apiConfiguration | + +[[Back to top]](#top) [[Back to README]](../../../README.md) diff --git a/samples/client/petstore/kotlin/docs/paths/fakeobjinquery/get/FakeobjinqueryGetQueryParameters.md b/samples/client/petstore/kotlin/docs/paths/fakeobjinquery/get/FakeobjinqueryGetQueryParameters.md new file mode 100644 index 00000000000..a68a087e940 --- /dev/null +++ b/samples/client/petstore/kotlin/docs/paths/fakeobjinquery/get/FakeobjinqueryGetQueryParameters.md @@ -0,0 +1,258 @@ +# FakeobjinqueryGetQueryParameters +public class FakeobjinqueryGetQueryParameters
+ +A class that contains necessary nested +- schema classes (which validate payloads), extends JsonSchema +- sealed interfaces which store validated payloads, java version of a sum type +- boxed classes which store validated payloads, sealed permits class implementations +- classes to store validated map payloads, extends FrozenMap +- classes to build inputs for map payloads + +## Nested Class Summary +| Modifier and Type | Class and Description | +| ----------------- | ---------------------- | +| sealed interface | [FakeobjinqueryGetQueryParameters.FakeobjinqueryGetQueryParameters1Boxed](#fakeobjinquerygetqueryparameters1boxed)
sealed interface for validated payloads | +| record | [FakeobjinqueryGetQueryParameters.FakeobjinqueryGetQueryParameters1BoxedMap](#fakeobjinquerygetqueryparameters1boxedmap)
boxed class to store validated Map payloads | +| static class | [FakeobjinqueryGetQueryParameters.FakeobjinqueryGetQueryParameters1](#fakeobjinquerygetqueryparameters1)
schema class | +| static class | [FakeobjinqueryGetQueryParameters.QueryParametersMapBuilder](#queryparametersmapbuilder)
builder for Map payloads | +| static class | [FakeobjinqueryGetQueryParameters.QueryParametersMap](#queryparametersmap)
output class for Map payloads | +| sealed interface | [FakeobjinqueryGetQueryParameters.AdditionalPropertiesBoxed](#additionalpropertiesboxed)
sealed interface for validated payloads | +| record | [FakeobjinqueryGetQueryParameters.AdditionalPropertiesBoxedVoid](#additionalpropertiesboxedvoid)
boxed class to store validated null payloads | +| record | [FakeobjinqueryGetQueryParameters.AdditionalPropertiesBoxedBoolean](#additionalpropertiesboxedboolean)
boxed class to store validated boolean payloads | +| record | [FakeobjinqueryGetQueryParameters.AdditionalPropertiesBoxedNumber](#additionalpropertiesboxednumber)
boxed class to store validated Number payloads | +| record | [FakeobjinqueryGetQueryParameters.AdditionalPropertiesBoxedString](#additionalpropertiesboxedstring)
boxed class to store validated String payloads | +| record | [FakeobjinqueryGetQueryParameters.AdditionalPropertiesBoxedList](#additionalpropertiesboxedlist)
boxed class to store validated List payloads | +| record | [FakeobjinqueryGetQueryParameters.AdditionalPropertiesBoxedMap](#additionalpropertiesboxedmap)
boxed class to store validated Map payloads | +| static class | [FakeobjinqueryGetQueryParameters.AdditionalProperties](#additionalproperties)
schema class | + +## FakeobjinqueryGetQueryParameters1Boxed +public sealed interface FakeobjinqueryGetQueryParameters1Boxed
+permits
+[FakeobjinqueryGetQueryParameters1BoxedMap](#fakeobjinquerygetqueryparameters1boxedmap) + +sealed interface that stores validated payloads using boxed classes + +## FakeobjinqueryGetQueryParameters1BoxedMap +public record FakeobjinqueryGetQueryParameters1BoxedMap
+implements [FakeobjinqueryGetQueryParameters1Boxed](#fakeobjinquerygetqueryparameters1boxed) + +record that stores validated Map payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| FakeobjinqueryGetQueryParameters1BoxedMap([QueryParametersMap](#queryparametersmap) data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| [QueryParametersMap](#queryparametersmap) | data()
validated payload | +| @Nullable Object | getData()
validated payload | + +## FakeobjinqueryGetQueryParameters1 +public static class FakeobjinqueryGetQueryParameters1
+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.fakeobjinquery.get.FakeobjinqueryGetQueryParameters; + +import java.util.Arrays; +import java.util.List; +import java.util.AbstractMap; + +static final SchemaConfiguration configuration = new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().build()); + +// Map validation +FakeobjinqueryGetQueryParameters.QueryParametersMap validatedPayload = + FakeobjinqueryGetQueryParameters.FakeobjinqueryGetQueryParameters1.validate( + new FakeobjinqueryGetQueryParameters.QueryParametersMapBuilder() + .mapBean( + MapUtils.makeMap( + new AbstractMap.SimpleEntry( + "keyword", + "a" + ) + ) + ) + .build(), + configuration +); +``` + +### Field Summary +| Modifier and Type | Field and Description | +| ----------------- | ---------------------- | +| Set> | type = Set.of(Map.class) | +| Map> | properties = Map.ofEntries(
    new PropertyEntry("mapBean", [Schema0.Schema01.class](../../../paths/fakeobjinquery/get/parameters/parameter0/Schema0.md#schema01))
)
| +| Class | additionalProperties = [AdditionalProperties.class](#additionalproperties) | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| [QueryParametersMap](#queryparametersmap) | validate([Map<?, ?>](#queryparametersmapbuilder) arg, SchemaConfiguration configuration) | +| [FakeobjinqueryGetQueryParameters1BoxedMap](#fakeobjinquerygetqueryparameters1boxedmap) | validateAndBox([Map<?, ?>](#queryparametersmapbuilder) arg, SchemaConfiguration configuration) | +| [FakeobjinqueryGetQueryParameters1Boxed](#fakeobjinquerygetqueryparameters1boxed) | validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) | +| @Nullable Object | validate(@Nullable Object arg, SchemaConfiguration configuration) | + +## QueryParametersMapBuilder +public class QueryParametersMapBuilder
+builder for `Map>` + +A class that builds the Map input type + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| QueryParametersMapBuilder()
Creates a builder that contains an empty map | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| Map> | build()
Returns map input that should be used with Schema.validate | +| [QueryParametersMapBuilder](#queryparametersmapbuilder) | mapBean(Map value) | + +## QueryParametersMap +public static class QueryParametersMap
+extends FrozenMap + +A class to store validated Map payloads + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| static [QueryParametersMap](#queryparametersmap) | of([Map>](#queryparametersmapbuilder) arg, SchemaConfiguration configuration) | +| [Schema0.SchemaMap0](../../../paths/fakeobjinquery/get/parameters/parameter0/Schema0.md#schemamap0) | mapBean()
[optional] | + +## 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(Nothing? data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| Nothing? | 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/kotlin/docs/paths/fakeobjinquery/get/FakeobjinqueryGetResponses.md b/samples/client/petstore/kotlin/docs/paths/fakeobjinquery/get/FakeobjinqueryGetResponses.md new file mode 100644 index 00000000000..423bb32fe9e --- /dev/null +++ b/samples/client/petstore/kotlin/docs/paths/fakeobjinquery/get/FakeobjinqueryGetResponses.md @@ -0,0 +1,29 @@ +# FakeobjinqueryGetResponses + +public class FakeobjinqueryGetResponses + +A class that contains necessary responses classes +- a sealed interface, EndpointResponse, that stores endpoint responses +- records for each endpoint response + +## Nested Class Summary +| Modifier and Type | Class and Description | +| ----------------- | --------------------- | +| sealed interface | [EndpointResponse](#endpointresponse)
stores the endpoint responses | +| record | [EndpointFakeobjinqueryGetCode200Response](#endpointfakeobjinquerygetcode200response)
the response for 200 | + +## EndpointResponse +public sealed interface EndpointResponse permits
+[EndpointFakeobjinqueryGetCode200Response](#endpointfakeobjinquerygetcode200response) + +a sealed interface that stores endpoint responses + +## EndpointFakeobjinqueryGetCode200Response +public record EndpointFakeobjinqueryGetCode200Response( + HttpResponse response, + Nothing? body, + Nothing? headers +) implements EndpointResponse, ApiResponse
+ +a class that stores an endpoint response + diff --git a/samples/client/petstore/kotlin/docs/paths/fakeobjinquery/get/parameters/parameter0/Schema0.md b/samples/client/petstore/kotlin/docs/paths/fakeobjinquery/get/parameters/parameter0/Schema0.md new file mode 100644 index 00000000000..a6ee5eee38a --- /dev/null +++ b/samples/client/petstore/kotlin/docs/paths/fakeobjinquery/get/parameters/parameter0/Schema0.md @@ -0,0 +1,166 @@ +# Schema0 +public class Schema0
+ +A class that contains necessary nested +- schema classes (which validate payloads), extends JsonSchema +- sealed interfaces which store validated payloads, java version of a sum type +- boxed classes which store validated payloads, sealed permits class implementations +- classes to store validated map payloads, extends FrozenMap +- classes to build inputs for map payloads + +## Nested Class Summary +| Modifier and Type | Class and Description | +| ----------------- | ---------------------- | +| sealed interface | [Schema0.Schema01Boxed](#schema01boxed)
sealed interface for validated payloads | +| record | [Schema0.Schema01BoxedMap](#schema01boxedmap)
boxed class to store validated Map payloads | +| static class | [Schema0.Schema01](#schema01)
schema class | +| static class | [Schema0.SchemaMapBuilder0](#schemamapbuilder0)
builder for Map payloads | +| static class | [Schema0.SchemaMap0](#schemamap0)
output class for Map payloads | +| sealed interface | [Schema0.Keyword0Boxed](#keyword0boxed)
sealed interface for validated payloads | +| record | [Schema0.Keyword0BoxedString](#keyword0boxedstring)
boxed class to store validated String payloads | +| static class | [Schema0.Keyword0](#keyword0)
schema class | + +## Schema01Boxed +public sealed interface Schema01Boxed
+permits
+[Schema01BoxedMap](#schema01boxedmap) + +sealed interface that stores validated payloads using boxed classes + +## Schema01BoxedMap +public record Schema01BoxedMap
+implements [Schema01Boxed](#schema01boxed) + +record that stores validated Map payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| Schema01BoxedMap([SchemaMap0](#schemamap0) data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| [SchemaMap0](#schemamap0) | data()
validated payload | +| @Nullable Object | getData()
validated payload | + +## Schema01 +public static class Schema01
+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.fakeobjinquery.get.parameters.parameter0.Schema0; + +import java.util.Arrays; +import java.util.List; +import java.util.AbstractMap; + +static final SchemaConfiguration configuration = new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().build()); + +// Map validation +Schema0.SchemaMap0 validatedPayload = + Schema0.Schema01.validate( + new Schema0.SchemaMapBuilder0() + .keyword("a") + + .build(), + configuration +); +``` + +### Field Summary +| Modifier and Type | Field and Description | +| ----------------- | ---------------------- | +| Set> | type = Set.of(Map.class) | +| Map> | properties = Map.ofEntries(
    new PropertyEntry("keyword", [Keyword0.class](#keyword0)))
)
| + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| [SchemaMap0](#schemamap0) | validate([Map<?, ?>](#schemamapbuilder0) arg, SchemaConfiguration configuration) | +| [Schema01BoxedMap](#schema01boxedmap) | validateAndBox([Map<?, ?>](#schemamapbuilder0) arg, SchemaConfiguration configuration) | +| [Schema01Boxed](#schema01boxed) | validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) | +| @Nullable Object | validate(@Nullable Object arg, SchemaConfiguration configuration) | + +## SchemaMapBuilder0 +public class SchemaMapBuilder0
+builder for `Map` + +A class that builds the Map input type + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| SchemaMapBuilder0()
Creates a builder that contains an empty map | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| Map | build()
Returns map input that should be used with Schema.validate | +| [SchemaMapBuilder0](#schemamapbuilder0) | keyword(String value) | +| [SchemaMapBuilder0](#schemamapbuilder0) | additionalProperty(String key, Nothing? value) | +| [SchemaMapBuilder0](#schemamapbuilder0) | additionalProperty(String key, boolean value) | +| [SchemaMapBuilder0](#schemamapbuilder0) | additionalProperty(String key, String value) | +| [SchemaMapBuilder0](#schemamapbuilder0) | additionalProperty(String key, int value) | +| [SchemaMapBuilder0](#schemamapbuilder0) | additionalProperty(String key, float value) | +| [SchemaMapBuilder0](#schemamapbuilder0) | additionalProperty(String key, long value) | +| [SchemaMapBuilder0](#schemamapbuilder0) | additionalProperty(String key, double value) | +| [SchemaMapBuilder0](#schemamapbuilder0) | additionalProperty(String key, List value) | +| [SchemaMapBuilder0](#schemamapbuilder0) | additionalProperty(String key, Map value) | + +## SchemaMap0 +public static class SchemaMap0
+extends FrozenMap + +A class to store validated Map payloads + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| static [SchemaMap0](#schemamap0) | of([Map](#schemamapbuilder0) arg, SchemaConfiguration configuration) | +| String | keyword()
[optional] | +| @Nullable Object | getAdditionalProperty(String name)
provides type safety for additional properties | + +## Keyword0Boxed +public sealed interface Keyword0Boxed
+permits
+[Keyword0BoxedString](#keyword0boxedstring) + +sealed interface that stores validated payloads using boxed classes + +## Keyword0BoxedString +public record Keyword0BoxedString
+implements [Keyword0Boxed](#keyword0boxed) + +record that stores validated String payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| Keyword0BoxedString(String data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| String | data()
validated payload | +| @Nullable Object | getData()
validated payload | + +## Keyword0 +public static class Keyword0
+extends StringJsonSchema.StringJsonSchema1 + +A schema class that validates payloads + +| Methods Inherited from class org.openapijsonschematools.client.schemas.StringJsonSchema.StringJsonSchema1 | +| ------------------------------------------------------------------ | +| validate | +| validateAndBox | diff --git a/samples/client/petstore/kotlin/docs/paths/fakeobjinquery/get/responses/FakeobjinqueryGetCode200Response.md b/samples/client/petstore/kotlin/docs/paths/fakeobjinquery/get/responses/FakeobjinqueryGetCode200Response.md new file mode 100644 index 00000000000..6ff3fdb9b67 --- /dev/null +++ b/samples/client/petstore/kotlin/docs/paths/fakeobjinquery/get/responses/FakeobjinqueryGetCode200Response.md @@ -0,0 +1,17 @@ +# FakeobjinqueryGetCode200Response + +public class FakeobjinqueryGetCode200Response extends [SuccessDescriptionOnly](../../components/responses/SuccessDescriptionOnly.md) + +A class (extended from the $ref class) that contains necessary nested response classes +- a class that extends ResponseDeserializer and is used to deserialize responses + +## Nested Class Summary +| Modifier and Type | Class and Description | +| ----------------- | --------------------- | +| static class | [FakeobjinqueryGetCode200Response.FakeobjinqueryGetCode200Response1](#fakeobjinquerygetcode200response1)
class that deserializes responses | + +## FakeobjinqueryGetCode200Response1 +public static class FakeobjinqueryGetCode200Response1 extends [SuccessDescriptionOnly1](../../components/responses/SuccessDescriptionOnly.md#successdescriptiononly1)
+ +a class that deserializes responses, extended from the $ref class + diff --git a/samples/client/petstore/kotlin/docs/paths/fakeparametercollisions1ababselfab/Fakeparametercollisions1ababselfabPost.md b/samples/client/petstore/kotlin/docs/paths/fakeparametercollisions1ababselfab/Fakeparametercollisions1ababselfabPost.md new file mode 100644 index 00000000000..69f3676cb5e --- /dev/null +++ b/samples/client/petstore/kotlin/docs/paths/fakeparametercollisions1ababselfab/Fakeparametercollisions1ababselfabPost.md @@ -0,0 +1,211 @@ +# Fakeparametercollisions1ababselfabPost + +public class Fakeparametercollisions1ababselfabPost + +A class that contains necessary endpoint classes +- a class that calls the endpoint method using the http verb +- a class that calls the endpoint method using the operationId name +- class(es) to store the request inputs +- builder(s) to set the request input data + +## Nested Class Summary +| Modifier and Type | Class and Description | +| ----------------- | --------------------- | +| static class | [Post](#post)
The class that has a post method to call the endpoint | +| interface | [ParameterCollisionsOperation](#parametercollisionsoperation)
The interface that has a parameterCollisions method to call the endpoint | +| static class | [PostRequest](#postrequest)
The final request inputs class | +| static class | [PostNullableRequest](#postnullablerequest)
The initial request inputs class | +| static class | [Post0RequestBuilder](#post0requestbuilder)
A builder for the request input class | +| static class | [PostRequestBuilder](#postrequestbuilder)
A builder for the request input class | + +## Post +public static class Post 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.fakeparametercollisions1ababselfab.post.Fakeparametercollisions1ababselfabPostRequestBody; +import org.openapijsonschematools.client.paths.fakeparametercollisions1ababselfab.post.Fakeparametercollisions1ababselfabPostHeaderParameters; +import org.openapijsonschematools.client.paths.fakeparametercollisions1ababselfab.post.Fakeparametercollisions1ababselfabPostQueryParameters; +import org.openapijsonschematools.client.paths.fakeparametercollisions1ababselfab.post.Fakeparametercollisions1ababselfabPostCookieParameters; +import org.openapijsonschematools.client.RootServerInfo; +import org.openapijsonschematools.client.paths.fakeparametercollisions1ababselfab.post.Fakeparametercollisions1ababselfabPostPathParameters; +import org.openapijsonschematools.client.servers.RootServer0; +import org.openapijsonschematools.client.servers.RootServer1; +import org.openapijsonschematools.client.servers.RootServer2; +import org.openapijsonschematools.client.paths.fakeparametercollisions1ababselfab.post.responses.Fakeparametercollisions1ababselfabPostCode200Response; +import org.openapijsonschematools.client.servers.RootServerInfo; +import org.openapijsonschematools.client.paths.fakeparametercollisions1ababselfab.Fakeparametercollisions1ababselfabPost; +import org.openapijsonschematools.client.paths.fakeparametercollisions1ababselfab.post.Fakeparametercollisions1ababselfabPostResponses; + +import java.io.IOException; +import java.util.Arrays; +import java.util.List; +import java.util.Map; +import java.util.AbstractMap; + +// if you want to use a server that is not SERVER_0 pass it in here and change the ServerIndex input below +ApiConfiguration.ServerInfo serverInfo = new ApiConfiguration.ServerInfoBuilder() + .rootServerInfo( + new RootServerInfo.RootServerInfoBuilder() + .rootServer0(new RootServer0()) + .build() + ) + .build(); +ApiConfiguration.ServerIndexInfo serverIndexInfo = new ApiConfiguration.ServerIndexInfoBuilder() + .rootServerInfoServerIndex(RootServerInfo.ServerIndex.SERVER_0) + .build(); +Duration timeout = Duration.ofSeconds(1L); +Map> defaultHeaders = Map.of("User-Agent", List.of("OpenAPI-JSON-Schema-Generator/1.0.0/java")); +ApiConfiguration apiConfiguration = new ApiConfiguration( + serverInfo + serverIndexInfo, + timeout, + defaultHeaders +); +SchemaConfiguration schemaConfiguration = new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().build()); +Fakeparametercollisions1ababselfabPost.Post apiClient = new Fakeparametercollisions1ababselfabPost.Post(apiConfiguration, schemaConfiguration); + + +// Map validation +Fakeparametercollisions1ababselfabPostPathParameters.PathParametersMap pathParameters = + Fakeparametercollisions1ababselfabPostPathParameters.Fakeparametercollisions1ababselfabPostPathParameters1.validate( + new Fakeparametercollisions1ababselfabPostPathParameters.PathParametersMapBuilder() + .positive1("a") + + .aHyphenMinusB("a") + + .Ab("a") + + .aB("a") + + .self("a") + + .build(), + schemaConfiguration +); + +var request = new Fakeparametercollisions1ababselfabPost.PostRequestBuilder() + .pathParameters(pathParameters) + .build(); + +Fakeparametercollisions1ababselfabPostResponses.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; +} +Fakeparametercollisions1ababselfabPostResponses.EndpointFakeparametercollisions1ababselfabPostCode200Response castResponse = (Fakeparametercollisions1ababselfabPostResponses.EndpointFakeparametercollisions1ababselfabPostCode200Response) response; +Fakeparametercollisions1ababselfabPostCode200Response.ApplicationjsonResponseBody deserializedBody = (Fakeparametercollisions1ababselfabPostCode200Response.ApplicationjsonResponseBody) castResponse.body; +// handle deserialized body here +``` +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| Post(ApiConfiguration apiConfiguration, SchemaConfiguration schemaConfiguration)
Creates an instance | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| [Fakeparametercollisions1ababselfabPostResponses.EndpointResponse](../../paths/fakeparametercollisions1ababselfab/post/Fakeparametercollisions1ababselfabPostResponses.md#endpointresponse) | post([PostRequest](#postrequest) request) | + +## ParameterCollisionsOperation +public interface ParameterCollisionsOperation
+ +an interface that allows one to call the endpoint using a method named parameterCollisions by the operationId + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| [Fakeparametercollisions1ababselfabPostResponses.EndpointResponse](../../paths/fakeparametercollisions1ababselfab/post/Fakeparametercollisions1ababselfabPostResponses.md#endpointresponse) | parameterCollisions([PostRequest](#postrequest) request) | + +## PostRequest +public static class PostRequest
+ +a class that stores the final request inputs + +### Field Summary +| Modifier and Type | Field and Description | +| ----------------- | --------------------- | +| [Fakeparametercollisions1ababselfabPostPathParameters.PathParametersMap](../../paths/fakeparametercollisions1ababselfab/post/Fakeparametercollisions1ababselfabPostPathParameters.md#pathparametersmap) | pathParameters | +| [Fakeparametercollisions1ababselfabPostRequestBody.@Nullable SealedRequestBody](../../paths/fakeparametercollisions1ababselfab/post/Fakeparametercollisions1ababselfabPostRequestBody.md#sealedrequestbody) | requestBody
optional | +| [Fakeparametercollisions1ababselfabPostHeaderParameters.@Nullable HeaderParametersMap](../../paths/fakeparametercollisions1ababselfab/post/Fakeparametercollisions1ababselfabPostHeaderParameters.md#headerparametersmap) | headerParameters
optional | +| [Fakeparametercollisions1ababselfabPostQueryParameters.@Nullable QueryParametersMap](../../paths/fakeparametercollisions1ababselfab/post/Fakeparametercollisions1ababselfabPostQueryParameters.md#queryparametersmap) | queryParameters
optional | +| [Fakeparametercollisions1ababselfabPostCookieParameters.@Nullable CookieParametersMap](../../paths/fakeparametercollisions1ababselfab/post/Fakeparametercollisions1ababselfabPostCookieParameters.md#cookieparametersmap) | cookieParameters
optional | +| [RootServerInfo.@Nullable ServerIndex](../../RootServerInfo.md#serverindex) | serverIndex
optional. Note: this will override the value in apiConfiguration | +| @Nullable Duration | timeout
optional. Note: this will override the value in apiConfiguration | + +## PostNullableRequest +public static class PostNullableRequest
+ +a class that stores the initial request inputs + +### Field Summary +| Modifier and Type | Field and Description | +| ----------------- | --------------------- | +| [Fakeparametercollisions1ababselfabPostPathParameters.@Nullable PathParametersMap](../../paths/fakeparametercollisions1ababselfab/post/Fakeparametercollisions1ababselfabPostPathParameters.md#pathparametersmap) | pathParameters | +| [Fakeparametercollisions1ababselfabPostRequestBody.@Nullable SealedRequestBody](../../paths/fakeparametercollisions1ababselfab/post/Fakeparametercollisions1ababselfabPostRequestBody.md#sealedrequestbody) | requestBody | +| [Fakeparametercollisions1ababselfabPostHeaderParameters.@Nullable HeaderParametersMap](../../paths/fakeparametercollisions1ababselfab/post/Fakeparametercollisions1ababselfabPostHeaderParameters.md#headerparametersmap) | headerParameters | +| [Fakeparametercollisions1ababselfabPostQueryParameters.@Nullable QueryParametersMap](../../paths/fakeparametercollisions1ababselfab/post/Fakeparametercollisions1ababselfabPostQueryParameters.md#queryparametersmap) | queryParameters | +| [Fakeparametercollisions1ababselfabPostCookieParameters.@Nullable CookieParametersMap](../../paths/fakeparametercollisions1ababselfab/post/Fakeparametercollisions1ababselfabPostCookieParameters.md#cookieparametersmap) | cookieParameters | +| [RootServerInfo.@Nullable ServerIndex](../../RootServerInfo.md#serverindex) | serverIndex | +| @Nullable Duration | timeout | + +## Post0RequestBuilder +public static class Post0RequestBuilder
+ +a builder for request inputs + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| Post0RequestBuilder(Post0RequestBuilder instance)
Creates a builder that contains the passed instance | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| [PostRequest](#postrequest) | build()
Returns the request input used to call an endpoint method | +| [Post0RequestBuilder](#post0requestbuilder) | requestBody([Fakeparametercollisions1ababselfabPostRequestBody.SealedRequestBody](../../paths/fakeparametercollisions1ababselfab/post/Fakeparametercollisions1ababselfabPostRequestBody.md#sealedrequestbody) requestBody)
sets the optional property | +| [Post0RequestBuilder](#post0requestbuilder) | headerParameters([Fakeparametercollisions1ababselfabPostHeaderParametersHeaderParametersMap](../../paths/fakeparametercollisions1ababselfab/post/Fakeparametercollisions1ababselfabPostHeaderParameters.md#headerparametersmap) headerParameters)
sets the optional property | +| [Post0RequestBuilder](#post0requestbuilder) | queryParameters([Fakeparametercollisions1ababselfabPostQueryParametersQueryParametersMap](../../paths/fakeparametercollisions1ababselfab/post/Fakeparametercollisions1ababselfabPostQueryParameters.md#queryparametersmap) queryParameters)
sets the optional property | +| [Post0RequestBuilder](#post0requestbuilder) | cookieParameters([Fakeparametercollisions1ababselfabPostCookieParametersCookieParametersMap](../../paths/fakeparametercollisions1ababselfab/post/Fakeparametercollisions1ababselfabPostCookieParameters.md#cookieparametersmap) cookieParameters)
sets the optional property | +| [Post0RequestBuilder](#post0requestbuilder) | serverIndex([RootServerInfo.ServerIndex](../../RootServerInfo.md#serverindex) serverIndex)
sets the optional property. Note: this will override the value in apiConfiguration | +| [Post0RequestBuilder](#post0requestbuilder) | timeout(Duration timeout)
sets the optional property. Note: this will override the value in apiConfiguration | + +## PostRequestBuilder +public static class PostRequestBuilder
+ +a builder for request inputs + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| PostRequestBuilder()
Creates a builder that contains null for all parameters | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| [Post0RequestBuilder](#post0requestbuilder) | pathParameters([Fakeparametercollisions1ababselfabPostPathParametersPathParametersMap](../../paths/fakeparametercollisions1ababselfab/post/Fakeparametercollisions1ababselfabPostPathParameters.md#pathparametersmap) pathParameters)
sets the property | + +[[Back to top]](#top) [[Back to README]](../../../README.md) diff --git a/samples/client/petstore/kotlin/docs/paths/fakeparametercollisions1ababselfab/post/Fakeparametercollisions1ababselfabPostCookieParameters.md b/samples/client/petstore/kotlin/docs/paths/fakeparametercollisions1ababselfab/post/Fakeparametercollisions1ababselfabPostCookieParameters.md new file mode 100644 index 00000000000..d5abecc77c4 --- /dev/null +++ b/samples/client/petstore/kotlin/docs/paths/fakeparametercollisions1ababselfab/post/Fakeparametercollisions1ababselfabPostCookieParameters.md @@ -0,0 +1,267 @@ +# Fakeparametercollisions1ababselfabPostCookieParameters +public class Fakeparametercollisions1ababselfabPostCookieParameters
+ +A class that contains necessary nested +- schema classes (which validate payloads), extends JsonSchema +- sealed interfaces which store validated payloads, java version of a sum type +- boxed classes which store validated payloads, sealed permits class implementations +- classes to store validated map payloads, extends FrozenMap +- classes to build inputs for map payloads + +## Nested Class Summary +| Modifier and Type | Class and Description | +| ----------------- | ---------------------- | +| sealed interface | [Fakeparametercollisions1ababselfabPostCookieParameters.Fakeparametercollisions1ababselfabPostCookieParameters1Boxed](#fakeparametercollisions1ababselfabpostcookieparameters1boxed)
sealed interface for validated payloads | +| record | [Fakeparametercollisions1ababselfabPostCookieParameters.Fakeparametercollisions1ababselfabPostCookieParameters1BoxedMap](#fakeparametercollisions1ababselfabpostcookieparameters1boxedmap)
boxed class to store validated Map payloads | +| static class | [Fakeparametercollisions1ababselfabPostCookieParameters.Fakeparametercollisions1ababselfabPostCookieParameters1](#fakeparametercollisions1ababselfabpostcookieparameters1)
schema class | +| static class | [Fakeparametercollisions1ababselfabPostCookieParameters.CookieParametersMapBuilder](#cookieparametersmapbuilder)
builder for Map payloads | +| static class | [Fakeparametercollisions1ababselfabPostCookieParameters.CookieParametersMap](#cookieparametersmap)
output class for Map payloads | +| sealed interface | [Fakeparametercollisions1ababselfabPostCookieParameters.AdditionalPropertiesBoxed](#additionalpropertiesboxed)
sealed interface for validated payloads | +| record | [Fakeparametercollisions1ababselfabPostCookieParameters.AdditionalPropertiesBoxedVoid](#additionalpropertiesboxedvoid)
boxed class to store validated null payloads | +| record | [Fakeparametercollisions1ababselfabPostCookieParameters.AdditionalPropertiesBoxedBoolean](#additionalpropertiesboxedboolean)
boxed class to store validated boolean payloads | +| record | [Fakeparametercollisions1ababselfabPostCookieParameters.AdditionalPropertiesBoxedNumber](#additionalpropertiesboxednumber)
boxed class to store validated Number payloads | +| record | [Fakeparametercollisions1ababselfabPostCookieParameters.AdditionalPropertiesBoxedString](#additionalpropertiesboxedstring)
boxed class to store validated String payloads | +| record | [Fakeparametercollisions1ababselfabPostCookieParameters.AdditionalPropertiesBoxedList](#additionalpropertiesboxedlist)
boxed class to store validated List payloads | +| record | [Fakeparametercollisions1ababselfabPostCookieParameters.AdditionalPropertiesBoxedMap](#additionalpropertiesboxedmap)
boxed class to store validated Map payloads | +| static class | [Fakeparametercollisions1ababselfabPostCookieParameters.AdditionalProperties](#additionalproperties)
schema class | + +## Fakeparametercollisions1ababselfabPostCookieParameters1Boxed +public sealed interface Fakeparametercollisions1ababselfabPostCookieParameters1Boxed
+permits
+[Fakeparametercollisions1ababselfabPostCookieParameters1BoxedMap](#fakeparametercollisions1ababselfabpostcookieparameters1boxedmap) + +sealed interface that stores validated payloads using boxed classes + +## Fakeparametercollisions1ababselfabPostCookieParameters1BoxedMap +public record Fakeparametercollisions1ababselfabPostCookieParameters1BoxedMap
+implements [Fakeparametercollisions1ababselfabPostCookieParameters1Boxed](#fakeparametercollisions1ababselfabpostcookieparameters1boxed) + +record that stores validated Map payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| Fakeparametercollisions1ababselfabPostCookieParameters1BoxedMap([CookieParametersMap](#cookieparametersmap) data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| [CookieParametersMap](#cookieparametersmap) | data()
validated payload | +| @Nullable Object | getData()
validated payload | + +## Fakeparametercollisions1ababselfabPostCookieParameters1 +public static class Fakeparametercollisions1ababselfabPostCookieParameters1
+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.fakeparametercollisions1ababselfab.post.Fakeparametercollisions1ababselfabPostCookieParameters; + +import java.util.Arrays; +import java.util.List; +import java.util.AbstractMap; + +static final SchemaConfiguration configuration = new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().build()); + +// Map validation +Fakeparametercollisions1ababselfabPostCookieParameters.CookieParametersMap validatedPayload = + Fakeparametercollisions1ababselfabPostCookieParameters.Fakeparametercollisions1ababselfabPostCookieParameters1.validate( + new Fakeparametercollisions1ababselfabPostCookieParameters.CookieParametersMapBuilder() + .positive1("a") + + .aB("a") + + .Ab("a") + + .aHyphenMinusB("a") + + .self("a") + + .build(), + configuration +); +``` + +### Field Summary +| Modifier and Type | Field and Description | +| ----------------- | ---------------------- | +| Set> | type = Set.of(Map.class) | +| Map> | properties = Map.ofEntries(
    new PropertyEntry("1", [Schema14.Schema141.class](../../../paths/fakeparametercollisions1ababselfab/post/parameters/parameter14/Schema14.md#schema141)),
    new PropertyEntry("aB", [Schema15.Schema151.class](../../../paths/fakeparametercollisions1ababselfab/post/parameters/parameter15/Schema15.md#schema151)),
    new PropertyEntry("Ab", [Schema16.Schema161.class](../../../paths/fakeparametercollisions1ababselfab/post/parameters/parameter16/Schema16.md#schema161)),
    new PropertyEntry("A-B", [Schema18.Schema181.class](../../../paths/fakeparametercollisions1ababselfab/post/parameters/parameter18/Schema18.md#schema181)),
    new PropertyEntry("self", [Schema17.Schema171.class](../../../paths/fakeparametercollisions1ababselfab/post/parameters/parameter17/Schema17.md#schema171))
)
| +| Class | additionalProperties = [AdditionalProperties.class](#additionalproperties) | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| [CookieParametersMap](#cookieparametersmap) | validate([Map<?, ?>](#cookieparametersmapbuilder) arg, SchemaConfiguration configuration) | +| [Fakeparametercollisions1ababselfabPostCookieParameters1BoxedMap](#fakeparametercollisions1ababselfabpostcookieparameters1boxedmap) | validateAndBox([Map<?, ?>](#cookieparametersmapbuilder) arg, SchemaConfiguration configuration) | +| [Fakeparametercollisions1ababselfabPostCookieParameters1Boxed](#fakeparametercollisions1ababselfabpostcookieparameters1boxed) | validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) | +| @Nullable Object | validate(@Nullable Object arg, SchemaConfiguration configuration) | + +## CookieParametersMapBuilder +public class CookieParametersMapBuilder
+builder for `Map` + +A class that builds the Map input type + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| CookieParametersMapBuilder()
Creates a builder that contains an empty map | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| Map | build()
Returns map input that should be used with Schema.validate | +| [CookieParametersMapBuilder](#cookieparametersmapbuilder) | positive1(String value) | +| [CookieParametersMapBuilder](#cookieparametersmapbuilder) | aB(String value) | +| [CookieParametersMapBuilder](#cookieparametersmapbuilder) | Ab(String value) | +| [CookieParametersMapBuilder](#cookieparametersmapbuilder) | aHyphenMinusB(String value) | +| [CookieParametersMapBuilder](#cookieparametersmapbuilder) | self(String value) | + +## CookieParametersMap +public static class CookieParametersMap
+extends FrozenMap + +A class to store validated Map payloads + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| static [CookieParametersMap](#cookieparametersmap) | of([Map](#cookieparametersmapbuilder) arg, SchemaConfiguration configuration) | +| String | aB()
[optional] | +| String | Ab()
[optional] | +| String | self()
[optional] | +| @Nullable Object | get(String key)
This schema has invalid Java names so this method must be used when you access instance["1"], instance["A-B"], | + +## 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(Nothing? data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| Nothing? | 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/kotlin/docs/paths/fakeparametercollisions1ababselfab/post/Fakeparametercollisions1ababselfabPostHeaderParameters.md b/samples/client/petstore/kotlin/docs/paths/fakeparametercollisions1ababselfab/post/Fakeparametercollisions1ababselfabPostHeaderParameters.md new file mode 100644 index 00000000000..10026a181e7 --- /dev/null +++ b/samples/client/petstore/kotlin/docs/paths/fakeparametercollisions1ababselfab/post/Fakeparametercollisions1ababselfabPostHeaderParameters.md @@ -0,0 +1,263 @@ +# Fakeparametercollisions1ababselfabPostHeaderParameters +public class Fakeparametercollisions1ababselfabPostHeaderParameters
+ +A class that contains necessary nested +- schema classes (which validate payloads), extends JsonSchema +- sealed interfaces which store validated payloads, java version of a sum type +- boxed classes which store validated payloads, sealed permits class implementations +- classes to store validated map payloads, extends FrozenMap +- classes to build inputs for map payloads + +## Nested Class Summary +| Modifier and Type | Class and Description | +| ----------------- | ---------------------- | +| sealed interface | [Fakeparametercollisions1ababselfabPostHeaderParameters.Fakeparametercollisions1ababselfabPostHeaderParameters1Boxed](#fakeparametercollisions1ababselfabpostheaderparameters1boxed)
sealed interface for validated payloads | +| record | [Fakeparametercollisions1ababselfabPostHeaderParameters.Fakeparametercollisions1ababselfabPostHeaderParameters1BoxedMap](#fakeparametercollisions1ababselfabpostheaderparameters1boxedmap)
boxed class to store validated Map payloads | +| static class | [Fakeparametercollisions1ababselfabPostHeaderParameters.Fakeparametercollisions1ababselfabPostHeaderParameters1](#fakeparametercollisions1ababselfabpostheaderparameters1)
schema class | +| static class | [Fakeparametercollisions1ababselfabPostHeaderParameters.HeaderParametersMapBuilder](#headerparametersmapbuilder)
builder for Map payloads | +| static class | [Fakeparametercollisions1ababselfabPostHeaderParameters.HeaderParametersMap](#headerparametersmap)
output class for Map payloads | +| sealed interface | [Fakeparametercollisions1ababselfabPostHeaderParameters.AdditionalPropertiesBoxed](#additionalpropertiesboxed)
sealed interface for validated payloads | +| record | [Fakeparametercollisions1ababselfabPostHeaderParameters.AdditionalPropertiesBoxedVoid](#additionalpropertiesboxedvoid)
boxed class to store validated null payloads | +| record | [Fakeparametercollisions1ababselfabPostHeaderParameters.AdditionalPropertiesBoxedBoolean](#additionalpropertiesboxedboolean)
boxed class to store validated boolean payloads | +| record | [Fakeparametercollisions1ababselfabPostHeaderParameters.AdditionalPropertiesBoxedNumber](#additionalpropertiesboxednumber)
boxed class to store validated Number payloads | +| record | [Fakeparametercollisions1ababselfabPostHeaderParameters.AdditionalPropertiesBoxedString](#additionalpropertiesboxedstring)
boxed class to store validated String payloads | +| record | [Fakeparametercollisions1ababselfabPostHeaderParameters.AdditionalPropertiesBoxedList](#additionalpropertiesboxedlist)
boxed class to store validated List payloads | +| record | [Fakeparametercollisions1ababselfabPostHeaderParameters.AdditionalPropertiesBoxedMap](#additionalpropertiesboxedmap)
boxed class to store validated Map payloads | +| static class | [Fakeparametercollisions1ababselfabPostHeaderParameters.AdditionalProperties](#additionalproperties)
schema class | + +## Fakeparametercollisions1ababselfabPostHeaderParameters1Boxed +public sealed interface Fakeparametercollisions1ababselfabPostHeaderParameters1Boxed
+permits
+[Fakeparametercollisions1ababselfabPostHeaderParameters1BoxedMap](#fakeparametercollisions1ababselfabpostheaderparameters1boxedmap) + +sealed interface that stores validated payloads using boxed classes + +## Fakeparametercollisions1ababselfabPostHeaderParameters1BoxedMap +public record Fakeparametercollisions1ababselfabPostHeaderParameters1BoxedMap
+implements [Fakeparametercollisions1ababselfabPostHeaderParameters1Boxed](#fakeparametercollisions1ababselfabpostheaderparameters1boxed) + +record that stores validated Map payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| Fakeparametercollisions1ababselfabPostHeaderParameters1BoxedMap([HeaderParametersMap](#headerparametersmap) data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| [HeaderParametersMap](#headerparametersmap) | data()
validated payload | +| @Nullable Object | getData()
validated payload | + +## Fakeparametercollisions1ababselfabPostHeaderParameters1 +public static class Fakeparametercollisions1ababselfabPostHeaderParameters1
+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.fakeparametercollisions1ababselfab.post.Fakeparametercollisions1ababselfabPostHeaderParameters; + +import java.util.Arrays; +import java.util.List; +import java.util.AbstractMap; + +static final SchemaConfiguration configuration = new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().build()); + +// Map validation +Fakeparametercollisions1ababselfabPostHeaderParameters.HeaderParametersMap validatedPayload = + Fakeparametercollisions1ababselfabPostHeaderParameters.Fakeparametercollisions1ababselfabPostHeaderParameters1.validate( + new Fakeparametercollisions1ababselfabPostHeaderParameters.HeaderParametersMapBuilder() + .positive1("a") + + .aB("a") + + .aHyphenMinusB("a") + + .self("a") + + .build(), + configuration +); +``` + +### Field Summary +| Modifier and Type | Field and Description | +| ----------------- | ---------------------- | +| Set> | type = Set.of(Map.class) | +| Map> | properties = Map.ofEntries(
    new PropertyEntry("1", [Schema5.Schema51.class](../../../paths/fakeparametercollisions1ababselfab/post/parameters/parameter5/Schema5.md#schema51)),
    new PropertyEntry("aB", [Schema6.Schema61.class](../../../paths/fakeparametercollisions1ababselfab/post/parameters/parameter6/Schema6.md#schema61)),
    new PropertyEntry("A-B", [Schema8.Schema81.class](../../../paths/fakeparametercollisions1ababselfab/post/parameters/parameter8/Schema8.md#schema81)),
    new PropertyEntry("self", [Schema7.Schema71.class](../../../paths/fakeparametercollisions1ababselfab/post/parameters/parameter7/Schema7.md#schema71))
)
| +| Class | additionalProperties = [AdditionalProperties.class](#additionalproperties) | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| [HeaderParametersMap](#headerparametersmap) | validate([Map<?, ?>](#headerparametersmapbuilder) arg, SchemaConfiguration configuration) | +| [Fakeparametercollisions1ababselfabPostHeaderParameters1BoxedMap](#fakeparametercollisions1ababselfabpostheaderparameters1boxedmap) | validateAndBox([Map<?, ?>](#headerparametersmapbuilder) arg, SchemaConfiguration configuration) | +| [Fakeparametercollisions1ababselfabPostHeaderParameters1Boxed](#fakeparametercollisions1ababselfabpostheaderparameters1boxed) | validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) | +| @Nullable Object | validate(@Nullable Object arg, SchemaConfiguration configuration) | + +## HeaderParametersMapBuilder +public class HeaderParametersMapBuilder
+builder for `Map` + +A class that builds the Map input type + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| HeaderParametersMapBuilder()
Creates a builder that contains an empty map | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| Map | build()
Returns map input that should be used with Schema.validate | +| [HeaderParametersMapBuilder](#headerparametersmapbuilder) | positive1(String value) | +| [HeaderParametersMapBuilder](#headerparametersmapbuilder) | aB(String value) | +| [HeaderParametersMapBuilder](#headerparametersmapbuilder) | aHyphenMinusB(String value) | +| [HeaderParametersMapBuilder](#headerparametersmapbuilder) | self(String value) | + +## HeaderParametersMap +public static class HeaderParametersMap
+extends FrozenMap + +A class to store validated Map payloads + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| static [HeaderParametersMap](#headerparametersmap) | of([Map](#headerparametersmapbuilder) arg, SchemaConfiguration configuration) | +| String | aB()
[optional] | +| String | self()
[optional] | +| @Nullable Object | get(String key)
This schema has invalid Java names so this method must be used when you access instance["1"], instance["A-B"], | + +## 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(Nothing? data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| Nothing? | 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/kotlin/docs/paths/fakeparametercollisions1ababselfab/post/Fakeparametercollisions1ababselfabPostPathParameters.md b/samples/client/petstore/kotlin/docs/paths/fakeparametercollisions1ababselfab/post/Fakeparametercollisions1ababselfabPostPathParameters.md new file mode 100644 index 00000000000..6200137f2c2 --- /dev/null +++ b/samples/client/petstore/kotlin/docs/paths/fakeparametercollisions1ababselfab/post/Fakeparametercollisions1ababselfabPostPathParameters.md @@ -0,0 +1,808 @@ +# Fakeparametercollisions1ababselfabPostPathParameters +public class Fakeparametercollisions1ababselfabPostPathParameters
+ +A class that contains necessary nested +- schema classes (which validate payloads), extends JsonSchema +- sealed interfaces which store validated payloads, java version of a sum type +- boxed classes which store validated payloads, sealed permits class implementations +- classes to store validated map payloads, extends FrozenMap +- classes to build inputs for map payloads + +## Nested Class Summary +| Modifier and Type | Class and Description | +| ----------------- | ---------------------- | +| sealed interface | [Fakeparametercollisions1ababselfabPostPathParameters.Fakeparametercollisions1ababselfabPostPathParameters1Boxed](#fakeparametercollisions1ababselfabpostpathparameters1boxed)
sealed interface for validated payloads | +| record | [Fakeparametercollisions1ababselfabPostPathParameters.Fakeparametercollisions1ababselfabPostPathParameters1BoxedMap](#fakeparametercollisions1ababselfabpostpathparameters1boxedmap)
boxed class to store validated Map payloads | +| static class | [Fakeparametercollisions1ababselfabPostPathParameters.Fakeparametercollisions1ababselfabPostPathParameters1](#fakeparametercollisions1ababselfabpostpathparameters1)
schema class | +| static class | [Fakeparametercollisions1ababselfabPostPathParameters.PathParametersMapBuilder](#pathparametersmapbuilder)
builder for Map payloads | +| static class | [Fakeparametercollisions1ababselfabPostPathParameters.PathParametersMap](#pathparametersmap)
output class for Map payloads | +| sealed interface | [Fakeparametercollisions1ababselfabPostPathParameters.AdditionalPropertiesBoxed](#additionalpropertiesboxed)
sealed interface for validated payloads | +| record | [Fakeparametercollisions1ababselfabPostPathParameters.AdditionalPropertiesBoxedVoid](#additionalpropertiesboxedvoid)
boxed class to store validated null payloads | +| record | [Fakeparametercollisions1ababselfabPostPathParameters.AdditionalPropertiesBoxedBoolean](#additionalpropertiesboxedboolean)
boxed class to store validated boolean payloads | +| record | [Fakeparametercollisions1ababselfabPostPathParameters.AdditionalPropertiesBoxedNumber](#additionalpropertiesboxednumber)
boxed class to store validated Number payloads | +| record | [Fakeparametercollisions1ababselfabPostPathParameters.AdditionalPropertiesBoxedString](#additionalpropertiesboxedstring)
boxed class to store validated String payloads | +| record | [Fakeparametercollisions1ababselfabPostPathParameters.AdditionalPropertiesBoxedList](#additionalpropertiesboxedlist)
boxed class to store validated List payloads | +| record | [Fakeparametercollisions1ababselfabPostPathParameters.AdditionalPropertiesBoxedMap](#additionalpropertiesboxedmap)
boxed class to store validated Map payloads | +| static class | [Fakeparametercollisions1ababselfabPostPathParameters.AdditionalProperties](#additionalproperties)
schema class | + +## Fakeparametercollisions1ababselfabPostPathParameters1Boxed +public sealed interface Fakeparametercollisions1ababselfabPostPathParameters1Boxed
+permits
+[Fakeparametercollisions1ababselfabPostPathParameters1BoxedMap](#fakeparametercollisions1ababselfabpostpathparameters1boxedmap) + +sealed interface that stores validated payloads using boxed classes + +## Fakeparametercollisions1ababselfabPostPathParameters1BoxedMap +public record Fakeparametercollisions1ababselfabPostPathParameters1BoxedMap
+implements [Fakeparametercollisions1ababselfabPostPathParameters1Boxed](#fakeparametercollisions1ababselfabpostpathparameters1boxed) + +record that stores validated Map payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| Fakeparametercollisions1ababselfabPostPathParameters1BoxedMap([PathParametersMap](#pathparametersmap) data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| [PathParametersMap](#pathparametersmap) | data()
validated payload | +| @Nullable Object | getData()
validated payload | + +## Fakeparametercollisions1ababselfabPostPathParameters1 +public static class Fakeparametercollisions1ababselfabPostPathParameters1
+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.fakeparametercollisions1ababselfab.post.Fakeparametercollisions1ababselfabPostPathParameters; + +import java.util.Arrays; +import java.util.List; +import java.util.AbstractMap; + +static final SchemaConfiguration configuration = new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().build()); + +// Map validation +Fakeparametercollisions1ababselfabPostPathParameters.PathParametersMap validatedPayload = + Fakeparametercollisions1ababselfabPostPathParameters.Fakeparametercollisions1ababselfabPostPathParameters1.validate( + new Fakeparametercollisions1ababselfabPostPathParameters.PathParametersMapBuilder() + .positive1("a") + + .aHyphenMinusB("a") + + .Ab("a") + + .aB("a") + + .self("a") + + .build(), + configuration +); +``` + +### Field Summary +| Modifier and Type | Field and Description | +| ----------------- | ---------------------- | +| Set> | type = Set.of(Map.class) | +| Map> | properties = Map.ofEntries(
    new PropertyEntry("1", [Schema9.Schema91.class](../../../paths/fakeparametercollisions1ababselfab/post/parameters/parameter9/Schema9.md#schema91)),
    new PropertyEntry("aB", [Schema10.Schema101.class](../../../paths/fakeparametercollisions1ababselfab/post/parameters/parameter10/Schema10.md#schema101)),
    new PropertyEntry("Ab", [Schema11.Schema111.class](../../../paths/fakeparametercollisions1ababselfab/post/parameters/parameter11/Schema11.md#schema111)),
    new PropertyEntry("A-B", [Schema13.Schema131.class](../../../paths/fakeparametercollisions1ababselfab/post/parameters/parameter13/Schema13.md#schema131)),
    new PropertyEntry("self", [Schema12.Schema121.class](../../../paths/fakeparametercollisions1ababselfab/post/parameters/parameter12/Schema12.md#schema121))
)
| +| Set | required = Set.of(
    "1",
    "A-B",
    "Ab",
    "aB",
    "self"
)
| +| Class | additionalProperties = [AdditionalProperties.class](#additionalproperties) | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| [PathParametersMap](#pathparametersmap) | validate([Map<?, ?>](#pathparametersmapbuilder) arg, SchemaConfiguration configuration) | +| [Fakeparametercollisions1ababselfabPostPathParameters1BoxedMap](#fakeparametercollisions1ababselfabpostpathparameters1boxedmap) | validateAndBox([Map<?, ?>](#pathparametersmapbuilder) arg, SchemaConfiguration configuration) | +| [Fakeparametercollisions1ababselfabPostPathParameters1Boxed](#fakeparametercollisions1ababselfabpostpathparameters1boxed) | validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) | +| @Nullable Object | validate(@Nullable Object arg, SchemaConfiguration configuration) | + +## PathParametersMap00000Builder +public class PathParametersMap00000Builder
+builder for `Map` + +A class that builds the Map input type + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| PathParametersMap00000Builder(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 | + +## PathParametersMap00001Builder +public class PathParametersMap00001Builder
+builder for `Map` + +A class that builds the Map input type + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| PathParametersMap00001Builder(Map instance)
Creates a builder that contains the passed instance | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| [PathParametersMap00000Builder](#pathparametersmap00000builder) | self(String value) | + +## PathParametersMap00010Builder +public class PathParametersMap00010Builder
+builder for `Map` + +A class that builds the Map input type + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| PathParametersMap00010Builder(Map instance)
Creates a builder that contains the passed instance | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| [PathParametersMap00000Builder](#pathparametersmap00000builder) | aB(String value) | + +## PathParametersMap00011Builder +public class PathParametersMap00011Builder
+builder for `Map` + +A class that builds the Map input type + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| PathParametersMap00011Builder(Map instance)
Creates a builder that contains the passed instance | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| [PathParametersMap00001Builder](#pathparametersmap00001builder) | aB(String value) | +| [PathParametersMap00010Builder](#pathparametersmap00010builder) | self(String value) | + +## PathParametersMap00100Builder +public class PathParametersMap00100Builder
+builder for `Map` + +A class that builds the Map input type + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| PathParametersMap00100Builder(Map instance)
Creates a builder that contains the passed instance | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| [PathParametersMap00000Builder](#pathparametersmap00000builder) | Ab(String value) | + +## PathParametersMap00101Builder +public class PathParametersMap00101Builder
+builder for `Map` + +A class that builds the Map input type + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| PathParametersMap00101Builder(Map instance)
Creates a builder that contains the passed instance | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| [PathParametersMap00001Builder](#pathparametersmap00001builder) | Ab(String value) | +| [PathParametersMap00100Builder](#pathparametersmap00100builder) | self(String value) | + +## PathParametersMap00110Builder +public class PathParametersMap00110Builder
+builder for `Map` + +A class that builds the Map input type + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| PathParametersMap00110Builder(Map instance)
Creates a builder that contains the passed instance | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| [PathParametersMap00010Builder](#pathparametersmap00010builder) | Ab(String value) | +| [PathParametersMap00100Builder](#pathparametersmap00100builder) | aB(String value) | + +## PathParametersMap00111Builder +public class PathParametersMap00111Builder
+builder for `Map` + +A class that builds the Map input type + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| PathParametersMap00111Builder(Map instance)
Creates a builder that contains the passed instance | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| [PathParametersMap00011Builder](#pathparametersmap00011builder) | Ab(String value) | +| [PathParametersMap00101Builder](#pathparametersmap00101builder) | aB(String value) | +| [PathParametersMap00110Builder](#pathparametersmap00110builder) | self(String value) | + +## PathParametersMap01000Builder +public class PathParametersMap01000Builder
+builder for `Map` + +A class that builds the Map input type + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| PathParametersMap01000Builder(Map instance)
Creates a builder that contains the passed instance | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| [PathParametersMap00000Builder](#pathparametersmap00000builder) | aHyphenMinusB(String value) | + +## PathParametersMap01001Builder +public class PathParametersMap01001Builder
+builder for `Map` + +A class that builds the Map input type + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| PathParametersMap01001Builder(Map instance)
Creates a builder that contains the passed instance | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| [PathParametersMap00001Builder](#pathparametersmap00001builder) | aHyphenMinusB(String value) | +| [PathParametersMap01000Builder](#pathparametersmap01000builder) | self(String value) | + +## PathParametersMap01010Builder +public class PathParametersMap01010Builder
+builder for `Map` + +A class that builds the Map input type + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| PathParametersMap01010Builder(Map instance)
Creates a builder that contains the passed instance | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| [PathParametersMap00010Builder](#pathparametersmap00010builder) | aHyphenMinusB(String value) | +| [PathParametersMap01000Builder](#pathparametersmap01000builder) | aB(String value) | + +## PathParametersMap01011Builder +public class PathParametersMap01011Builder
+builder for `Map` + +A class that builds the Map input type + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| PathParametersMap01011Builder(Map instance)
Creates a builder that contains the passed instance | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| [PathParametersMap00011Builder](#pathparametersmap00011builder) | aHyphenMinusB(String value) | +| [PathParametersMap01001Builder](#pathparametersmap01001builder) | aB(String value) | +| [PathParametersMap01010Builder](#pathparametersmap01010builder) | self(String value) | + +## PathParametersMap01100Builder +public class PathParametersMap01100Builder
+builder for `Map` + +A class that builds the Map input type + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| PathParametersMap01100Builder(Map instance)
Creates a builder that contains the passed instance | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| [PathParametersMap00100Builder](#pathparametersmap00100builder) | aHyphenMinusB(String value) | +| [PathParametersMap01000Builder](#pathparametersmap01000builder) | Ab(String value) | + +## PathParametersMap01101Builder +public class PathParametersMap01101Builder
+builder for `Map` + +A class that builds the Map input type + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| PathParametersMap01101Builder(Map instance)
Creates a builder that contains the passed instance | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| [PathParametersMap00101Builder](#pathparametersmap00101builder) | aHyphenMinusB(String value) | +| [PathParametersMap01001Builder](#pathparametersmap01001builder) | Ab(String value) | +| [PathParametersMap01100Builder](#pathparametersmap01100builder) | self(String value) | + +## PathParametersMap01110Builder +public class PathParametersMap01110Builder
+builder for `Map` + +A class that builds the Map input type + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| PathParametersMap01110Builder(Map instance)
Creates a builder that contains the passed instance | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| [PathParametersMap00110Builder](#pathparametersmap00110builder) | aHyphenMinusB(String value) | +| [PathParametersMap01010Builder](#pathparametersmap01010builder) | Ab(String value) | +| [PathParametersMap01100Builder](#pathparametersmap01100builder) | aB(String value) | + +## PathParametersMap01111Builder +public class PathParametersMap01111Builder
+builder for `Map` + +A class that builds the Map input type + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| PathParametersMap01111Builder(Map instance)
Creates a builder that contains the passed instance | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| [PathParametersMap00111Builder](#pathparametersmap00111builder) | aHyphenMinusB(String value) | +| [PathParametersMap01011Builder](#pathparametersmap01011builder) | Ab(String value) | +| [PathParametersMap01101Builder](#pathparametersmap01101builder) | aB(String value) | +| [PathParametersMap01110Builder](#pathparametersmap01110builder) | self(String value) | + +## PathParametersMap10000Builder +public class PathParametersMap10000Builder
+builder for `Map` + +A class that builds the Map input type + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| PathParametersMap10000Builder(Map instance)
Creates a builder that contains the passed instance | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| [PathParametersMap00000Builder](#pathparametersmap00000builder) | positive1(String value) | + +## PathParametersMap10001Builder +public class PathParametersMap10001Builder
+builder for `Map` + +A class that builds the Map input type + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| PathParametersMap10001Builder(Map instance)
Creates a builder that contains the passed instance | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| [PathParametersMap00001Builder](#pathparametersmap00001builder) | positive1(String value) | +| [PathParametersMap10000Builder](#pathparametersmap10000builder) | self(String value) | + +## PathParametersMap10010Builder +public class PathParametersMap10010Builder
+builder for `Map` + +A class that builds the Map input type + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| PathParametersMap10010Builder(Map instance)
Creates a builder that contains the passed instance | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| [PathParametersMap00010Builder](#pathparametersmap00010builder) | positive1(String value) | +| [PathParametersMap10000Builder](#pathparametersmap10000builder) | aB(String value) | + +## PathParametersMap10011Builder +public class PathParametersMap10011Builder
+builder for `Map` + +A class that builds the Map input type + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| PathParametersMap10011Builder(Map instance)
Creates a builder that contains the passed instance | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| [PathParametersMap00011Builder](#pathparametersmap00011builder) | positive1(String value) | +| [PathParametersMap10001Builder](#pathparametersmap10001builder) | aB(String value) | +| [PathParametersMap10010Builder](#pathparametersmap10010builder) | self(String value) | + +## PathParametersMap10100Builder +public class PathParametersMap10100Builder
+builder for `Map` + +A class that builds the Map input type + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| PathParametersMap10100Builder(Map instance)
Creates a builder that contains the passed instance | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| [PathParametersMap00100Builder](#pathparametersmap00100builder) | positive1(String value) | +| [PathParametersMap10000Builder](#pathparametersmap10000builder) | Ab(String value) | + +## PathParametersMap10101Builder +public class PathParametersMap10101Builder
+builder for `Map` + +A class that builds the Map input type + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| PathParametersMap10101Builder(Map instance)
Creates a builder that contains the passed instance | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| [PathParametersMap00101Builder](#pathparametersmap00101builder) | positive1(String value) | +| [PathParametersMap10001Builder](#pathparametersmap10001builder) | Ab(String value) | +| [PathParametersMap10100Builder](#pathparametersmap10100builder) | self(String value) | + +## PathParametersMap10110Builder +public class PathParametersMap10110Builder
+builder for `Map` + +A class that builds the Map input type + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| PathParametersMap10110Builder(Map instance)
Creates a builder that contains the passed instance | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| [PathParametersMap00110Builder](#pathparametersmap00110builder) | positive1(String value) | +| [PathParametersMap10010Builder](#pathparametersmap10010builder) | Ab(String value) | +| [PathParametersMap10100Builder](#pathparametersmap10100builder) | aB(String value) | + +## PathParametersMap10111Builder +public class PathParametersMap10111Builder
+builder for `Map` + +A class that builds the Map input type + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| PathParametersMap10111Builder(Map instance)
Creates a builder that contains the passed instance | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| [PathParametersMap00111Builder](#pathparametersmap00111builder) | positive1(String value) | +| [PathParametersMap10011Builder](#pathparametersmap10011builder) | Ab(String value) | +| [PathParametersMap10101Builder](#pathparametersmap10101builder) | aB(String value) | +| [PathParametersMap10110Builder](#pathparametersmap10110builder) | self(String value) | + +## PathParametersMap11000Builder +public class PathParametersMap11000Builder
+builder for `Map` + +A class that builds the Map input type + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| PathParametersMap11000Builder(Map instance)
Creates a builder that contains the passed instance | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| [PathParametersMap01000Builder](#pathparametersmap01000builder) | positive1(String value) | +| [PathParametersMap10000Builder](#pathparametersmap10000builder) | aHyphenMinusB(String value) | + +## PathParametersMap11001Builder +public class PathParametersMap11001Builder
+builder for `Map` + +A class that builds the Map input type + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| PathParametersMap11001Builder(Map instance)
Creates a builder that contains the passed instance | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| [PathParametersMap01001Builder](#pathparametersmap01001builder) | positive1(String value) | +| [PathParametersMap10001Builder](#pathparametersmap10001builder) | aHyphenMinusB(String value) | +| [PathParametersMap11000Builder](#pathparametersmap11000builder) | self(String value) | + +## PathParametersMap11010Builder +public class PathParametersMap11010Builder
+builder for `Map` + +A class that builds the Map input type + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| PathParametersMap11010Builder(Map instance)
Creates a builder that contains the passed instance | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| [PathParametersMap01010Builder](#pathparametersmap01010builder) | positive1(String value) | +| [PathParametersMap10010Builder](#pathparametersmap10010builder) | aHyphenMinusB(String value) | +| [PathParametersMap11000Builder](#pathparametersmap11000builder) | aB(String value) | + +## PathParametersMap11011Builder +public class PathParametersMap11011Builder
+builder for `Map` + +A class that builds the Map input type + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| PathParametersMap11011Builder(Map instance)
Creates a builder that contains the passed instance | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| [PathParametersMap01011Builder](#pathparametersmap01011builder) | positive1(String value) | +| [PathParametersMap10011Builder](#pathparametersmap10011builder) | aHyphenMinusB(String value) | +| [PathParametersMap11001Builder](#pathparametersmap11001builder) | aB(String value) | +| [PathParametersMap11010Builder](#pathparametersmap11010builder) | self(String value) | + +## PathParametersMap11100Builder +public class PathParametersMap11100Builder
+builder for `Map` + +A class that builds the Map input type + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| PathParametersMap11100Builder(Map instance)
Creates a builder that contains the passed instance | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| [PathParametersMap01100Builder](#pathparametersmap01100builder) | positive1(String value) | +| [PathParametersMap10100Builder](#pathparametersmap10100builder) | aHyphenMinusB(String value) | +| [PathParametersMap11000Builder](#pathparametersmap11000builder) | Ab(String value) | + +## PathParametersMap11101Builder +public class PathParametersMap11101Builder
+builder for `Map` + +A class that builds the Map input type + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| PathParametersMap11101Builder(Map instance)
Creates a builder that contains the passed instance | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| [PathParametersMap01101Builder](#pathparametersmap01101builder) | positive1(String value) | +| [PathParametersMap10101Builder](#pathparametersmap10101builder) | aHyphenMinusB(String value) | +| [PathParametersMap11001Builder](#pathparametersmap11001builder) | Ab(String value) | +| [PathParametersMap11100Builder](#pathparametersmap11100builder) | self(String value) | + +## PathParametersMap11110Builder +public class PathParametersMap11110Builder
+builder for `Map` + +A class that builds the Map input type + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| PathParametersMap11110Builder(Map instance)
Creates a builder that contains the passed instance | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| [PathParametersMap01110Builder](#pathparametersmap01110builder) | positive1(String value) | +| [PathParametersMap10110Builder](#pathparametersmap10110builder) | aHyphenMinusB(String value) | +| [PathParametersMap11010Builder](#pathparametersmap11010builder) | Ab(String value) | +| [PathParametersMap11100Builder](#pathparametersmap11100builder) | aB(String value) | + +## PathParametersMapBuilder +public class PathParametersMapBuilder
+builder for `Map` + +A class that builds the Map input type + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| PathParametersMapBuilder()
Creates a builder that contains an empty map | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| [PathParametersMap01111Builder](#pathparametersmap01111builder) | positive1(String value) | +| [PathParametersMap10111Builder](#pathparametersmap10111builder) | aHyphenMinusB(String value) | +| [PathParametersMap11011Builder](#pathparametersmap11011builder) | Ab(String value) | +| [PathParametersMap11101Builder](#pathparametersmap11101builder) | aB(String value) | +| [PathParametersMap11110Builder](#pathparametersmap11110builder) | self(String value) | + +## PathParametersMap +public static class PathParametersMap
+extends FrozenMap + +A class to store validated Map payloads + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| static [PathParametersMap](#pathparametersmap) | of([Map](#pathparametersmapbuilder) arg, SchemaConfiguration configuration) | +| String | Ab()
| +| String | aB()
| +| String | self()
| +| @Nullable Object | get(String key)
This schema has invalid Java names so this method must be used when you access instance["1"], instance["A-B"], | + +## 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(Nothing? data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| Nothing? | 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/kotlin/docs/paths/fakeparametercollisions1ababselfab/post/Fakeparametercollisions1ababselfabPostQueryParameters.md b/samples/client/petstore/kotlin/docs/paths/fakeparametercollisions1ababselfab/post/Fakeparametercollisions1ababselfabPostQueryParameters.md new file mode 100644 index 00000000000..a491db22458 --- /dev/null +++ b/samples/client/petstore/kotlin/docs/paths/fakeparametercollisions1ababselfab/post/Fakeparametercollisions1ababselfabPostQueryParameters.md @@ -0,0 +1,267 @@ +# Fakeparametercollisions1ababselfabPostQueryParameters +public class Fakeparametercollisions1ababselfabPostQueryParameters
+ +A class that contains necessary nested +- schema classes (which validate payloads), extends JsonSchema +- sealed interfaces which store validated payloads, java version of a sum type +- boxed classes which store validated payloads, sealed permits class implementations +- classes to store validated map payloads, extends FrozenMap +- classes to build inputs for map payloads + +## Nested Class Summary +| Modifier and Type | Class and Description | +| ----------------- | ---------------------- | +| sealed interface | [Fakeparametercollisions1ababselfabPostQueryParameters.Fakeparametercollisions1ababselfabPostQueryParameters1Boxed](#fakeparametercollisions1ababselfabpostqueryparameters1boxed)
sealed interface for validated payloads | +| record | [Fakeparametercollisions1ababselfabPostQueryParameters.Fakeparametercollisions1ababselfabPostQueryParameters1BoxedMap](#fakeparametercollisions1ababselfabpostqueryparameters1boxedmap)
boxed class to store validated Map payloads | +| static class | [Fakeparametercollisions1ababselfabPostQueryParameters.Fakeparametercollisions1ababselfabPostQueryParameters1](#fakeparametercollisions1ababselfabpostqueryparameters1)
schema class | +| static class | [Fakeparametercollisions1ababselfabPostQueryParameters.QueryParametersMapBuilder](#queryparametersmapbuilder)
builder for Map payloads | +| static class | [Fakeparametercollisions1ababselfabPostQueryParameters.QueryParametersMap](#queryparametersmap)
output class for Map payloads | +| sealed interface | [Fakeparametercollisions1ababselfabPostQueryParameters.AdditionalPropertiesBoxed](#additionalpropertiesboxed)
sealed interface for validated payloads | +| record | [Fakeparametercollisions1ababselfabPostQueryParameters.AdditionalPropertiesBoxedVoid](#additionalpropertiesboxedvoid)
boxed class to store validated null payloads | +| record | [Fakeparametercollisions1ababselfabPostQueryParameters.AdditionalPropertiesBoxedBoolean](#additionalpropertiesboxedboolean)
boxed class to store validated boolean payloads | +| record | [Fakeparametercollisions1ababselfabPostQueryParameters.AdditionalPropertiesBoxedNumber](#additionalpropertiesboxednumber)
boxed class to store validated Number payloads | +| record | [Fakeparametercollisions1ababselfabPostQueryParameters.AdditionalPropertiesBoxedString](#additionalpropertiesboxedstring)
boxed class to store validated String payloads | +| record | [Fakeparametercollisions1ababselfabPostQueryParameters.AdditionalPropertiesBoxedList](#additionalpropertiesboxedlist)
boxed class to store validated List payloads | +| record | [Fakeparametercollisions1ababselfabPostQueryParameters.AdditionalPropertiesBoxedMap](#additionalpropertiesboxedmap)
boxed class to store validated Map payloads | +| static class | [Fakeparametercollisions1ababselfabPostQueryParameters.AdditionalProperties](#additionalproperties)
schema class | + +## Fakeparametercollisions1ababselfabPostQueryParameters1Boxed +public sealed interface Fakeparametercollisions1ababselfabPostQueryParameters1Boxed
+permits
+[Fakeparametercollisions1ababselfabPostQueryParameters1BoxedMap](#fakeparametercollisions1ababselfabpostqueryparameters1boxedmap) + +sealed interface that stores validated payloads using boxed classes + +## Fakeparametercollisions1ababselfabPostQueryParameters1BoxedMap +public record Fakeparametercollisions1ababselfabPostQueryParameters1BoxedMap
+implements [Fakeparametercollisions1ababselfabPostQueryParameters1Boxed](#fakeparametercollisions1ababselfabpostqueryparameters1boxed) + +record that stores validated Map payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| Fakeparametercollisions1ababselfabPostQueryParameters1BoxedMap([QueryParametersMap](#queryparametersmap) data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| [QueryParametersMap](#queryparametersmap) | data()
validated payload | +| @Nullable Object | getData()
validated payload | + +## Fakeparametercollisions1ababselfabPostQueryParameters1 +public static class Fakeparametercollisions1ababselfabPostQueryParameters1
+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.fakeparametercollisions1ababselfab.post.Fakeparametercollisions1ababselfabPostQueryParameters; + +import java.util.Arrays; +import java.util.List; +import java.util.AbstractMap; + +static final SchemaConfiguration configuration = new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().build()); + +// Map validation +Fakeparametercollisions1ababselfabPostQueryParameters.QueryParametersMap validatedPayload = + Fakeparametercollisions1ababselfabPostQueryParameters.Fakeparametercollisions1ababselfabPostQueryParameters1.validate( + new Fakeparametercollisions1ababselfabPostQueryParameters.QueryParametersMapBuilder() + .positive1("a") + + .aB("a") + + .Ab("a") + + .aHyphenMinusB("a") + + .self("a") + + .build(), + configuration +); +``` + +### Field Summary +| Modifier and Type | Field and Description | +| ----------------- | ---------------------- | +| Set> | type = Set.of(Map.class) | +| Map> | properties = Map.ofEntries(
    new PropertyEntry("1", [Schema0.Schema01.class](../../../paths/fakeparametercollisions1ababselfab/post/parameters/parameter0/Schema0.md#schema01)),
    new PropertyEntry("aB", [Schema1.Schema11.class](../../../paths/fakeparametercollisions1ababselfab/post/parameters/parameter1/Schema1.md#schema11)),
    new PropertyEntry("Ab", [Schema2.Schema21.class](../../../paths/fakeparametercollisions1ababselfab/post/parameters/parameter2/Schema2.md#schema21)),
    new PropertyEntry("A-B", [Schema4.Schema41.class](../../../paths/fakeparametercollisions1ababselfab/post/parameters/parameter4/Schema4.md#schema41)),
    new PropertyEntry("self", [Schema3.Schema31.class](../../../paths/fakeparametercollisions1ababselfab/post/parameters/parameter3/Schema3.md#schema31))
)
| +| Class | additionalProperties = [AdditionalProperties.class](#additionalproperties) | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| [QueryParametersMap](#queryparametersmap) | validate([Map<?, ?>](#queryparametersmapbuilder) arg, SchemaConfiguration configuration) | +| [Fakeparametercollisions1ababselfabPostQueryParameters1BoxedMap](#fakeparametercollisions1ababselfabpostqueryparameters1boxedmap) | validateAndBox([Map<?, ?>](#queryparametersmapbuilder) arg, SchemaConfiguration configuration) | +| [Fakeparametercollisions1ababselfabPostQueryParameters1Boxed](#fakeparametercollisions1ababselfabpostqueryparameters1boxed) | validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) | +| @Nullable Object | validate(@Nullable Object arg, SchemaConfiguration configuration) | + +## QueryParametersMapBuilder +public class QueryParametersMapBuilder
+builder for `Map` + +A class that builds the Map input type + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| QueryParametersMapBuilder()
Creates a builder that contains an empty map | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| Map | build()
Returns map input that should be used with Schema.validate | +| [QueryParametersMapBuilder](#queryparametersmapbuilder) | positive1(String value) | +| [QueryParametersMapBuilder](#queryparametersmapbuilder) | aB(String value) | +| [QueryParametersMapBuilder](#queryparametersmapbuilder) | Ab(String value) | +| [QueryParametersMapBuilder](#queryparametersmapbuilder) | aHyphenMinusB(String value) | +| [QueryParametersMapBuilder](#queryparametersmapbuilder) | self(String value) | + +## QueryParametersMap +public static class QueryParametersMap
+extends FrozenMap + +A class to store validated Map payloads + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| static [QueryParametersMap](#queryparametersmap) | of([Map](#queryparametersmapbuilder) arg, SchemaConfiguration configuration) | +| String | aB()
[optional] | +| String | Ab()
[optional] | +| String | self()
[optional] | +| @Nullable Object | get(String key)
This schema has invalid Java names so this method must be used when you access instance["1"], instance["A-B"], | + +## 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(Nothing? data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| Nothing? | 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/kotlin/docs/paths/fakeparametercollisions1ababselfab/post/Fakeparametercollisions1ababselfabPostRequestBody.md b/samples/client/petstore/kotlin/docs/paths/fakeparametercollisions1ababselfab/post/Fakeparametercollisions1ababselfabPostRequestBody.md new file mode 100644 index 00000000000..f28eaffd37c --- /dev/null +++ b/samples/client/petstore/kotlin/docs/paths/fakeparametercollisions1ababselfab/post/Fakeparametercollisions1ababselfabPostRequestBody.md @@ -0,0 +1,90 @@ +# Fakeparametercollisions1ababselfabPostRequestBody + +public class Fakeparametercollisions1ababselfabPostRequestBody + +A class that contains necessary nested request body classes +- SealedMediaType, a sealed interface which contains all the schema/encoding info for each contentType +- records which implement SealedMediaType, the concrete media types +- a class that extends RequestBodySerializer and is used to serialize input SealedRequestBody instances +- SealedRequestBody, a sealed interface which contains all the contentType/schema input types +- records which implement SealedRequestBody, the concrete request body types + +## Nested Class Summary +| Modifier and Type | Class and Description | +| ----------------- | --------------------- | +| sealed interface | [Fakeparametercollisions1ababselfabPostRequestBody.SealedMediaType](#sealedmediatype)
media type sealed interface | +| record | [Fakeparametercollisions1ababselfabPostRequestBody.ApplicationjsonMediaType](#applicationjsonmediatype)
record storing schema + encoding for a specific contentType | +| static class | [Fakeparametercollisions1ababselfabPostRequestBody.Fakeparametercollisions1ababselfabPostRequestBody1](#fakeparametercollisions1ababselfabpostrequestbody1)
class that serializes request bodies | +| sealed interface | [Fakeparametercollisions1ababselfabPostRequestBody.SealedRequestBody](#sealedrequestbody)
request body sealed interface | +| record | [Fakeparametercollisions1ababselfabPostRequestBody.ApplicationjsonRequestBody](#applicationjsonrequestbody)
implements sealed interface to store request body input | + +## SealedMediaType +public sealed interface SealedMediaType
+permits
+[ApplicationjsonMediaType](#applicationjsonmediatype) + +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), Nothing?> + +class storing schema info for a specific contentType + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| ApplicationjsonMediaType()
Creates an instance | + +### 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 | +| Nothing? | encoding()
the encoding info | + +## Fakeparametercollisions1ababselfabPostRequestBody1 +public static class Fakeparametercollisions1ababselfabPostRequestBody1
+ +a class that serializes SealedRequestBody request bodies + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| Fakeparametercollisions1ababselfabPostRequestBody1()
Creates an instance | + +### Field Summary +| Modifier and Type | Field and Description | +| ----------------- | --------------------- | +| boolean | required = false
whether the request body is required | +| 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 | +| ----------------- | ---------------------- | +| SerializedRequestBody | serialize([SealedRequestBody](#sealedrequestbody) requestBody)
called by endpoint when creating request body bytes | + +## SealedRequestBody +public sealed interface SealedRequestBody
+permits
+[ApplicationjsonRequestBody](#applicationjsonrequestbody) + +sealed interface that stores request contentType + validated schema data + +## ApplicationjsonRequestBody +public record ApplicationjsonRequestBody
+implements [SealedRequestBody](#sealedrequestbody),
+GenericRequestBody
+ +A record class to store request body input for contentType="application/json" + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| ApplicationjsonRequestBody(ApplicationjsonSchema.AnyTypeJsonSchema1Boxed body)
Creates an instance | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| String | contentType()
always returns "application/json" | +| ApplicationjsonSchema.AnyTypeJsonSchema1Boxed | body()
returns the body passed in in the constructor | diff --git a/samples/client/petstore/kotlin/docs/paths/fakeparametercollisions1ababselfab/post/Fakeparametercollisions1ababselfabPostResponses.md b/samples/client/petstore/kotlin/docs/paths/fakeparametercollisions1ababselfab/post/Fakeparametercollisions1ababselfabPostResponses.md new file mode 100644 index 00000000000..9dbfaf17ffa --- /dev/null +++ b/samples/client/petstore/kotlin/docs/paths/fakeparametercollisions1ababselfab/post/Fakeparametercollisions1ababselfabPostResponses.md @@ -0,0 +1,29 @@ +# Fakeparametercollisions1ababselfabPostResponses + +public class Fakeparametercollisions1ababselfabPostResponses + +A class that contains necessary responses classes +- a sealed interface, EndpointResponse, that stores endpoint responses +- records for each endpoint response + +## Nested Class Summary +| Modifier and Type | Class and Description | +| ----------------- | --------------------- | +| sealed interface | [EndpointResponse](#endpointresponse)
stores the endpoint responses | +| record | [EndpointFakeparametercollisions1ababselfabPostCode200Response](#endpointfakeparametercollisions1ababselfabpostcode200response)
the response for 200 | + +## EndpointResponse +public sealed interface EndpointResponse permits
+[EndpointFakeparametercollisions1ababselfabPostCode200Response](#endpointfakeparametercollisions1ababselfabpostcode200response) + +a sealed interface that stores endpoint responses + +## EndpointFakeparametercollisions1ababselfabPostCode200Response +public record EndpointFakeparametercollisions1ababselfabPostCode200Response( + HttpResponse response, + [Fakeparametercollisions1ababselfabPostCode200Response.SealedResponseBody](../../../paths/fakeparametercollisions1ababselfab/post/responses/Fakeparametercollisions1ababselfabPostCode200Response.md#sealedresponsebody) body, + Nothing? headers +) implements EndpointResponse, ApiResponse
+ +a class that stores an endpoint response + diff --git a/samples/client/petstore/kotlin/docs/paths/fakeparametercollisions1ababselfab/post/parameters/parameter0/Schema0.md b/samples/client/petstore/kotlin/docs/paths/fakeparametercollisions1ababselfab/post/parameters/parameter0/Schema0.md new file mode 100644 index 00000000000..9ff90e0bc35 --- /dev/null +++ b/samples/client/petstore/kotlin/docs/paths/fakeparametercollisions1ababselfab/post/parameters/parameter0/Schema0.md @@ -0,0 +1,49 @@ +# Schema0 +public class Schema0
+ +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 + +## Nested Class Summary +| Modifier and Type | Class and Description | +| ----------------- | ---------------------- | +| sealed interface | [Schema0.Schema01Boxed](#schema01boxed)
sealed interface for validated payloads | +| record | [Schema0.Schema01BoxedString](#schema01boxedstring)
boxed class to store validated String payloads | +| static class | [Schema0.Schema01](#schema01)
schema class | + +## Schema01Boxed +public sealed interface Schema01Boxed
+permits
+[Schema01BoxedString](#schema01boxedstring) + +sealed interface that stores validated payloads using boxed classes + +## Schema01BoxedString +public record Schema01BoxedString
+implements [Schema01Boxed](#schema01boxed) + +record that stores validated String payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| Schema01BoxedString(String data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| String | data()
validated payload | +| @Nullable Object | getData()
validated payload | + +## Schema01 +public static class Schema01
+extends StringJsonSchema.StringJsonSchema1 + +A schema class that validates payloads + +| Methods Inherited from class org.openapijsonschematools.client.schemas.StringJsonSchema.StringJsonSchema1 | +| ------------------------------------------------------------------ | +| validate | +| validateAndBox | diff --git a/samples/client/petstore/kotlin/docs/paths/fakeparametercollisions1ababselfab/post/parameters/parameter1/Schema1.md b/samples/client/petstore/kotlin/docs/paths/fakeparametercollisions1ababselfab/post/parameters/parameter1/Schema1.md new file mode 100644 index 00000000000..63ec3a884fc --- /dev/null +++ b/samples/client/petstore/kotlin/docs/paths/fakeparametercollisions1ababselfab/post/parameters/parameter1/Schema1.md @@ -0,0 +1,49 @@ +# Schema1 +public class Schema1
+ +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 + +## Nested Class Summary +| Modifier and Type | Class and Description | +| ----------------- | ---------------------- | +| sealed interface | [Schema1.Schema11Boxed](#schema11boxed)
sealed interface for validated payloads | +| record | [Schema1.Schema11BoxedString](#schema11boxedstring)
boxed class to store validated String payloads | +| static class | [Schema1.Schema11](#schema11)
schema class | + +## Schema11Boxed +public sealed interface Schema11Boxed
+permits
+[Schema11BoxedString](#schema11boxedstring) + +sealed interface that stores validated payloads using boxed classes + +## Schema11BoxedString +public record Schema11BoxedString
+implements [Schema11Boxed](#schema11boxed) + +record that stores validated String payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| Schema11BoxedString(String data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| String | data()
validated payload | +| @Nullable Object | getData()
validated payload | + +## Schema11 +public static class Schema11
+extends StringJsonSchema.StringJsonSchema1 + +A schema class that validates payloads + +| Methods Inherited from class org.openapijsonschematools.client.schemas.StringJsonSchema.StringJsonSchema1 | +| ------------------------------------------------------------------ | +| validate | +| validateAndBox | diff --git a/samples/client/petstore/kotlin/docs/paths/fakeparametercollisions1ababselfab/post/parameters/parameter10/Schema10.md b/samples/client/petstore/kotlin/docs/paths/fakeparametercollisions1ababselfab/post/parameters/parameter10/Schema10.md new file mode 100644 index 00000000000..f2313e921f9 --- /dev/null +++ b/samples/client/petstore/kotlin/docs/paths/fakeparametercollisions1ababselfab/post/parameters/parameter10/Schema10.md @@ -0,0 +1,49 @@ +# Schema10 +public class Schema10
+ +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 + +## Nested Class Summary +| Modifier and Type | Class and Description | +| ----------------- | ---------------------- | +| sealed interface | [Schema10.Schema101Boxed](#schema101boxed)
sealed interface for validated payloads | +| record | [Schema10.Schema101BoxedString](#schema101boxedstring)
boxed class to store validated String payloads | +| static class | [Schema10.Schema101](#schema101)
schema class | + +## Schema101Boxed +public sealed interface Schema101Boxed
+permits
+[Schema101BoxedString](#schema101boxedstring) + +sealed interface that stores validated payloads using boxed classes + +## Schema101BoxedString +public record Schema101BoxedString
+implements [Schema101Boxed](#schema101boxed) + +record that stores validated String payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| Schema101BoxedString(String data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| String | data()
validated payload | +| @Nullable Object | getData()
validated payload | + +## Schema101 +public static class Schema101
+extends StringJsonSchema.StringJsonSchema1 + +A schema class that validates payloads + +| Methods Inherited from class org.openapijsonschematools.client.schemas.StringJsonSchema.StringJsonSchema1 | +| ------------------------------------------------------------------ | +| validate | +| validateAndBox | diff --git a/samples/client/petstore/kotlin/docs/paths/fakeparametercollisions1ababselfab/post/parameters/parameter11/Schema11.md b/samples/client/petstore/kotlin/docs/paths/fakeparametercollisions1ababselfab/post/parameters/parameter11/Schema11.md new file mode 100644 index 00000000000..c309cbd677b --- /dev/null +++ b/samples/client/petstore/kotlin/docs/paths/fakeparametercollisions1ababselfab/post/parameters/parameter11/Schema11.md @@ -0,0 +1,49 @@ +# Schema11 +public class Schema11
+ +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 + +## Nested Class Summary +| Modifier and Type | Class and Description | +| ----------------- | ---------------------- | +| sealed interface | [Schema11.Schema111Boxed](#schema111boxed)
sealed interface for validated payloads | +| record | [Schema11.Schema111BoxedString](#schema111boxedstring)
boxed class to store validated String payloads | +| static class | [Schema11.Schema111](#schema111)
schema class | + +## Schema111Boxed +public sealed interface Schema111Boxed
+permits
+[Schema111BoxedString](#schema111boxedstring) + +sealed interface that stores validated payloads using boxed classes + +## Schema111BoxedString +public record Schema111BoxedString
+implements [Schema111Boxed](#schema111boxed) + +record that stores validated String payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| Schema111BoxedString(String data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| String | data()
validated payload | +| @Nullable Object | getData()
validated payload | + +## Schema111 +public static class Schema111
+extends StringJsonSchema.StringJsonSchema1 + +A schema class that validates payloads + +| Methods Inherited from class org.openapijsonschematools.client.schemas.StringJsonSchema.StringJsonSchema1 | +| ------------------------------------------------------------------ | +| validate | +| validateAndBox | diff --git a/samples/client/petstore/kotlin/docs/paths/fakeparametercollisions1ababselfab/post/parameters/parameter12/Schema12.md b/samples/client/petstore/kotlin/docs/paths/fakeparametercollisions1ababselfab/post/parameters/parameter12/Schema12.md new file mode 100644 index 00000000000..fa969e69734 --- /dev/null +++ b/samples/client/petstore/kotlin/docs/paths/fakeparametercollisions1ababselfab/post/parameters/parameter12/Schema12.md @@ -0,0 +1,49 @@ +# Schema12 +public class Schema12
+ +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 + +## Nested Class Summary +| Modifier and Type | Class and Description | +| ----------------- | ---------------------- | +| sealed interface | [Schema12.Schema121Boxed](#schema121boxed)
sealed interface for validated payloads | +| record | [Schema12.Schema121BoxedString](#schema121boxedstring)
boxed class to store validated String payloads | +| static class | [Schema12.Schema121](#schema121)
schema class | + +## Schema121Boxed +public sealed interface Schema121Boxed
+permits
+[Schema121BoxedString](#schema121boxedstring) + +sealed interface that stores validated payloads using boxed classes + +## Schema121BoxedString +public record Schema121BoxedString
+implements [Schema121Boxed](#schema121boxed) + +record that stores validated String payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| Schema121BoxedString(String data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| String | data()
validated payload | +| @Nullable Object | getData()
validated payload | + +## Schema121 +public static class Schema121
+extends StringJsonSchema.StringJsonSchema1 + +A schema class that validates payloads + +| Methods Inherited from class org.openapijsonschematools.client.schemas.StringJsonSchema.StringJsonSchema1 | +| ------------------------------------------------------------------ | +| validate | +| validateAndBox | diff --git a/samples/client/petstore/kotlin/docs/paths/fakeparametercollisions1ababselfab/post/parameters/parameter13/Schema13.md b/samples/client/petstore/kotlin/docs/paths/fakeparametercollisions1ababselfab/post/parameters/parameter13/Schema13.md new file mode 100644 index 00000000000..8b6ce934c35 --- /dev/null +++ b/samples/client/petstore/kotlin/docs/paths/fakeparametercollisions1ababselfab/post/parameters/parameter13/Schema13.md @@ -0,0 +1,49 @@ +# Schema13 +public class Schema13
+ +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 + +## Nested Class Summary +| Modifier and Type | Class and Description | +| ----------------- | ---------------------- | +| sealed interface | [Schema13.Schema131Boxed](#schema131boxed)
sealed interface for validated payloads | +| record | [Schema13.Schema131BoxedString](#schema131boxedstring)
boxed class to store validated String payloads | +| static class | [Schema13.Schema131](#schema131)
schema class | + +## Schema131Boxed +public sealed interface Schema131Boxed
+permits
+[Schema131BoxedString](#schema131boxedstring) + +sealed interface that stores validated payloads using boxed classes + +## Schema131BoxedString +public record Schema131BoxedString
+implements [Schema131Boxed](#schema131boxed) + +record that stores validated String payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| Schema131BoxedString(String data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| String | data()
validated payload | +| @Nullable Object | getData()
validated payload | + +## Schema131 +public static class Schema131
+extends StringJsonSchema.StringJsonSchema1 + +A schema class that validates payloads + +| Methods Inherited from class org.openapijsonschematools.client.schemas.StringJsonSchema.StringJsonSchema1 | +| ------------------------------------------------------------------ | +| validate | +| validateAndBox | diff --git a/samples/client/petstore/kotlin/docs/paths/fakeparametercollisions1ababselfab/post/parameters/parameter14/Schema14.md b/samples/client/petstore/kotlin/docs/paths/fakeparametercollisions1ababselfab/post/parameters/parameter14/Schema14.md new file mode 100644 index 00000000000..b6987c8c80f --- /dev/null +++ b/samples/client/petstore/kotlin/docs/paths/fakeparametercollisions1ababselfab/post/parameters/parameter14/Schema14.md @@ -0,0 +1,49 @@ +# Schema14 +public class Schema14
+ +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 + +## Nested Class Summary +| Modifier and Type | Class and Description | +| ----------------- | ---------------------- | +| sealed interface | [Schema14.Schema141Boxed](#schema141boxed)
sealed interface for validated payloads | +| record | [Schema14.Schema141BoxedString](#schema141boxedstring)
boxed class to store validated String payloads | +| static class | [Schema14.Schema141](#schema141)
schema class | + +## Schema141Boxed +public sealed interface Schema141Boxed
+permits
+[Schema141BoxedString](#schema141boxedstring) + +sealed interface that stores validated payloads using boxed classes + +## Schema141BoxedString +public record Schema141BoxedString
+implements [Schema141Boxed](#schema141boxed) + +record that stores validated String payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| Schema141BoxedString(String data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| String | data()
validated payload | +| @Nullable Object | getData()
validated payload | + +## Schema141 +public static class Schema141
+extends StringJsonSchema.StringJsonSchema1 + +A schema class that validates payloads + +| Methods Inherited from class org.openapijsonschematools.client.schemas.StringJsonSchema.StringJsonSchema1 | +| ------------------------------------------------------------------ | +| validate | +| validateAndBox | diff --git a/samples/client/petstore/kotlin/docs/paths/fakeparametercollisions1ababselfab/post/parameters/parameter15/Schema15.md b/samples/client/petstore/kotlin/docs/paths/fakeparametercollisions1ababselfab/post/parameters/parameter15/Schema15.md new file mode 100644 index 00000000000..272a98b600d --- /dev/null +++ b/samples/client/petstore/kotlin/docs/paths/fakeparametercollisions1ababselfab/post/parameters/parameter15/Schema15.md @@ -0,0 +1,49 @@ +# Schema15 +public class Schema15
+ +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 + +## Nested Class Summary +| Modifier and Type | Class and Description | +| ----------------- | ---------------------- | +| sealed interface | [Schema15.Schema151Boxed](#schema151boxed)
sealed interface for validated payloads | +| record | [Schema15.Schema151BoxedString](#schema151boxedstring)
boxed class to store validated String payloads | +| static class | [Schema15.Schema151](#schema151)
schema class | + +## Schema151Boxed +public sealed interface Schema151Boxed
+permits
+[Schema151BoxedString](#schema151boxedstring) + +sealed interface that stores validated payloads using boxed classes + +## Schema151BoxedString +public record Schema151BoxedString
+implements [Schema151Boxed](#schema151boxed) + +record that stores validated String payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| Schema151BoxedString(String data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| String | data()
validated payload | +| @Nullable Object | getData()
validated payload | + +## Schema151 +public static class Schema151
+extends StringJsonSchema.StringJsonSchema1 + +A schema class that validates payloads + +| Methods Inherited from class org.openapijsonschematools.client.schemas.StringJsonSchema.StringJsonSchema1 | +| ------------------------------------------------------------------ | +| validate | +| validateAndBox | diff --git a/samples/client/petstore/kotlin/docs/paths/fakeparametercollisions1ababselfab/post/parameters/parameter16/Schema16.md b/samples/client/petstore/kotlin/docs/paths/fakeparametercollisions1ababselfab/post/parameters/parameter16/Schema16.md new file mode 100644 index 00000000000..059eeb943a7 --- /dev/null +++ b/samples/client/petstore/kotlin/docs/paths/fakeparametercollisions1ababselfab/post/parameters/parameter16/Schema16.md @@ -0,0 +1,49 @@ +# Schema16 +public class Schema16
+ +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 + +## Nested Class Summary +| Modifier and Type | Class and Description | +| ----------------- | ---------------------- | +| sealed interface | [Schema16.Schema161Boxed](#schema161boxed)
sealed interface for validated payloads | +| record | [Schema16.Schema161BoxedString](#schema161boxedstring)
boxed class to store validated String payloads | +| static class | [Schema16.Schema161](#schema161)
schema class | + +## Schema161Boxed +public sealed interface Schema161Boxed
+permits
+[Schema161BoxedString](#schema161boxedstring) + +sealed interface that stores validated payloads using boxed classes + +## Schema161BoxedString +public record Schema161BoxedString
+implements [Schema161Boxed](#schema161boxed) + +record that stores validated String payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| Schema161BoxedString(String data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| String | data()
validated payload | +| @Nullable Object | getData()
validated payload | + +## Schema161 +public static class Schema161
+extends StringJsonSchema.StringJsonSchema1 + +A schema class that validates payloads + +| Methods Inherited from class org.openapijsonschematools.client.schemas.StringJsonSchema.StringJsonSchema1 | +| ------------------------------------------------------------------ | +| validate | +| validateAndBox | diff --git a/samples/client/petstore/kotlin/docs/paths/fakeparametercollisions1ababselfab/post/parameters/parameter17/Schema17.md b/samples/client/petstore/kotlin/docs/paths/fakeparametercollisions1ababselfab/post/parameters/parameter17/Schema17.md new file mode 100644 index 00000000000..4bf4ae7e510 --- /dev/null +++ b/samples/client/petstore/kotlin/docs/paths/fakeparametercollisions1ababselfab/post/parameters/parameter17/Schema17.md @@ -0,0 +1,49 @@ +# Schema17 +public class Schema17
+ +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 + +## Nested Class Summary +| Modifier and Type | Class and Description | +| ----------------- | ---------------------- | +| sealed interface | [Schema17.Schema171Boxed](#schema171boxed)
sealed interface for validated payloads | +| record | [Schema17.Schema171BoxedString](#schema171boxedstring)
boxed class to store validated String payloads | +| static class | [Schema17.Schema171](#schema171)
schema class | + +## Schema171Boxed +public sealed interface Schema171Boxed
+permits
+[Schema171BoxedString](#schema171boxedstring) + +sealed interface that stores validated payloads using boxed classes + +## Schema171BoxedString +public record Schema171BoxedString
+implements [Schema171Boxed](#schema171boxed) + +record that stores validated String payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| Schema171BoxedString(String data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| String | data()
validated payload | +| @Nullable Object | getData()
validated payload | + +## Schema171 +public static class Schema171
+extends StringJsonSchema.StringJsonSchema1 + +A schema class that validates payloads + +| Methods Inherited from class org.openapijsonschematools.client.schemas.StringJsonSchema.StringJsonSchema1 | +| ------------------------------------------------------------------ | +| validate | +| validateAndBox | diff --git a/samples/client/petstore/kotlin/docs/paths/fakeparametercollisions1ababselfab/post/parameters/parameter18/Schema18.md b/samples/client/petstore/kotlin/docs/paths/fakeparametercollisions1ababselfab/post/parameters/parameter18/Schema18.md new file mode 100644 index 00000000000..962dca4cbb3 --- /dev/null +++ b/samples/client/petstore/kotlin/docs/paths/fakeparametercollisions1ababselfab/post/parameters/parameter18/Schema18.md @@ -0,0 +1,49 @@ +# Schema18 +public class Schema18
+ +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 + +## Nested Class Summary +| Modifier and Type | Class and Description | +| ----------------- | ---------------------- | +| sealed interface | [Schema18.Schema181Boxed](#schema181boxed)
sealed interface for validated payloads | +| record | [Schema18.Schema181BoxedString](#schema181boxedstring)
boxed class to store validated String payloads | +| static class | [Schema18.Schema181](#schema181)
schema class | + +## Schema181Boxed +public sealed interface Schema181Boxed
+permits
+[Schema181BoxedString](#schema181boxedstring) + +sealed interface that stores validated payloads using boxed classes + +## Schema181BoxedString +public record Schema181BoxedString
+implements [Schema181Boxed](#schema181boxed) + +record that stores validated String payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| Schema181BoxedString(String data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| String | data()
validated payload | +| @Nullable Object | getData()
validated payload | + +## Schema181 +public static class Schema181
+extends StringJsonSchema.StringJsonSchema1 + +A schema class that validates payloads + +| Methods Inherited from class org.openapijsonschematools.client.schemas.StringJsonSchema.StringJsonSchema1 | +| ------------------------------------------------------------------ | +| validate | +| validateAndBox | diff --git a/samples/client/petstore/kotlin/docs/paths/fakeparametercollisions1ababselfab/post/parameters/parameter2/Schema2.md b/samples/client/petstore/kotlin/docs/paths/fakeparametercollisions1ababselfab/post/parameters/parameter2/Schema2.md new file mode 100644 index 00000000000..4a7d57953eb --- /dev/null +++ b/samples/client/petstore/kotlin/docs/paths/fakeparametercollisions1ababselfab/post/parameters/parameter2/Schema2.md @@ -0,0 +1,49 @@ +# Schema2 +public class Schema2
+ +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 + +## Nested Class Summary +| Modifier and Type | Class and Description | +| ----------------- | ---------------------- | +| sealed interface | [Schema2.Schema21Boxed](#schema21boxed)
sealed interface for validated payloads | +| record | [Schema2.Schema21BoxedString](#schema21boxedstring)
boxed class to store validated String payloads | +| static class | [Schema2.Schema21](#schema21)
schema class | + +## Schema21Boxed +public sealed interface Schema21Boxed
+permits
+[Schema21BoxedString](#schema21boxedstring) + +sealed interface that stores validated payloads using boxed classes + +## Schema21BoxedString +public record Schema21BoxedString
+implements [Schema21Boxed](#schema21boxed) + +record that stores validated String payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| Schema21BoxedString(String data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| String | data()
validated payload | +| @Nullable Object | getData()
validated payload | + +## Schema21 +public static class Schema21
+extends StringJsonSchema.StringJsonSchema1 + +A schema class that validates payloads + +| Methods Inherited from class org.openapijsonschematools.client.schemas.StringJsonSchema.StringJsonSchema1 | +| ------------------------------------------------------------------ | +| validate | +| validateAndBox | diff --git a/samples/client/petstore/kotlin/docs/paths/fakeparametercollisions1ababselfab/post/parameters/parameter3/Schema3.md b/samples/client/petstore/kotlin/docs/paths/fakeparametercollisions1ababselfab/post/parameters/parameter3/Schema3.md new file mode 100644 index 00000000000..41d54a1d930 --- /dev/null +++ b/samples/client/petstore/kotlin/docs/paths/fakeparametercollisions1ababselfab/post/parameters/parameter3/Schema3.md @@ -0,0 +1,49 @@ +# Schema3 +public class Schema3
+ +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 + +## Nested Class Summary +| Modifier and Type | Class and Description | +| ----------------- | ---------------------- | +| sealed interface | [Schema3.Schema31Boxed](#schema31boxed)
sealed interface for validated payloads | +| record | [Schema3.Schema31BoxedString](#schema31boxedstring)
boxed class to store validated String payloads | +| static class | [Schema3.Schema31](#schema31)
schema class | + +## Schema31Boxed +public sealed interface Schema31Boxed
+permits
+[Schema31BoxedString](#schema31boxedstring) + +sealed interface that stores validated payloads using boxed classes + +## Schema31BoxedString +public record Schema31BoxedString
+implements [Schema31Boxed](#schema31boxed) + +record that stores validated String payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| Schema31BoxedString(String data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| String | data()
validated payload | +| @Nullable Object | getData()
validated payload | + +## Schema31 +public static class Schema31
+extends StringJsonSchema.StringJsonSchema1 + +A schema class that validates payloads + +| Methods Inherited from class org.openapijsonschematools.client.schemas.StringJsonSchema.StringJsonSchema1 | +| ------------------------------------------------------------------ | +| validate | +| validateAndBox | diff --git a/samples/client/petstore/kotlin/docs/paths/fakeparametercollisions1ababselfab/post/parameters/parameter4/Schema4.md b/samples/client/petstore/kotlin/docs/paths/fakeparametercollisions1ababselfab/post/parameters/parameter4/Schema4.md new file mode 100644 index 00000000000..7bc2523d7af --- /dev/null +++ b/samples/client/petstore/kotlin/docs/paths/fakeparametercollisions1ababselfab/post/parameters/parameter4/Schema4.md @@ -0,0 +1,49 @@ +# Schema4 +public class Schema4
+ +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 + +## Nested Class Summary +| Modifier and Type | Class and Description | +| ----------------- | ---------------------- | +| sealed interface | [Schema4.Schema41Boxed](#schema41boxed)
sealed interface for validated payloads | +| record | [Schema4.Schema41BoxedString](#schema41boxedstring)
boxed class to store validated String payloads | +| static class | [Schema4.Schema41](#schema41)
schema class | + +## Schema41Boxed +public sealed interface Schema41Boxed
+permits
+[Schema41BoxedString](#schema41boxedstring) + +sealed interface that stores validated payloads using boxed classes + +## Schema41BoxedString +public record Schema41BoxedString
+implements [Schema41Boxed](#schema41boxed) + +record that stores validated String payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| Schema41BoxedString(String data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| String | data()
validated payload | +| @Nullable Object | getData()
validated payload | + +## Schema41 +public static class Schema41
+extends StringJsonSchema.StringJsonSchema1 + +A schema class that validates payloads + +| Methods Inherited from class org.openapijsonschematools.client.schemas.StringJsonSchema.StringJsonSchema1 | +| ------------------------------------------------------------------ | +| validate | +| validateAndBox | diff --git a/samples/client/petstore/kotlin/docs/paths/fakeparametercollisions1ababselfab/post/parameters/parameter5/Schema5.md b/samples/client/petstore/kotlin/docs/paths/fakeparametercollisions1ababselfab/post/parameters/parameter5/Schema5.md new file mode 100644 index 00000000000..ff888c33afd --- /dev/null +++ b/samples/client/petstore/kotlin/docs/paths/fakeparametercollisions1ababselfab/post/parameters/parameter5/Schema5.md @@ -0,0 +1,49 @@ +# Schema5 +public class Schema5
+ +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 + +## Nested Class Summary +| Modifier and Type | Class and Description | +| ----------------- | ---------------------- | +| sealed interface | [Schema5.Schema51Boxed](#schema51boxed)
sealed interface for validated payloads | +| record | [Schema5.Schema51BoxedString](#schema51boxedstring)
boxed class to store validated String payloads | +| static class | [Schema5.Schema51](#schema51)
schema class | + +## Schema51Boxed +public sealed interface Schema51Boxed
+permits
+[Schema51BoxedString](#schema51boxedstring) + +sealed interface that stores validated payloads using boxed classes + +## Schema51BoxedString +public record Schema51BoxedString
+implements [Schema51Boxed](#schema51boxed) + +record that stores validated String payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| Schema51BoxedString(String data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| String | data()
validated payload | +| @Nullable Object | getData()
validated payload | + +## Schema51 +public static class Schema51
+extends StringJsonSchema.StringJsonSchema1 + +A schema class that validates payloads + +| Methods Inherited from class org.openapijsonschematools.client.schemas.StringJsonSchema.StringJsonSchema1 | +| ------------------------------------------------------------------ | +| validate | +| validateAndBox | diff --git a/samples/client/petstore/kotlin/docs/paths/fakeparametercollisions1ababselfab/post/parameters/parameter6/Schema6.md b/samples/client/petstore/kotlin/docs/paths/fakeparametercollisions1ababselfab/post/parameters/parameter6/Schema6.md new file mode 100644 index 00000000000..ba0b2fad7df --- /dev/null +++ b/samples/client/petstore/kotlin/docs/paths/fakeparametercollisions1ababselfab/post/parameters/parameter6/Schema6.md @@ -0,0 +1,49 @@ +# Schema6 +public class Schema6
+ +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 + +## Nested Class Summary +| Modifier and Type | Class and Description | +| ----------------- | ---------------------- | +| sealed interface | [Schema6.Schema61Boxed](#schema61boxed)
sealed interface for validated payloads | +| record | [Schema6.Schema61BoxedString](#schema61boxedstring)
boxed class to store validated String payloads | +| static class | [Schema6.Schema61](#schema61)
schema class | + +## Schema61Boxed +public sealed interface Schema61Boxed
+permits
+[Schema61BoxedString](#schema61boxedstring) + +sealed interface that stores validated payloads using boxed classes + +## Schema61BoxedString +public record Schema61BoxedString
+implements [Schema61Boxed](#schema61boxed) + +record that stores validated String payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| Schema61BoxedString(String data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| String | data()
validated payload | +| @Nullable Object | getData()
validated payload | + +## Schema61 +public static class Schema61
+extends StringJsonSchema.StringJsonSchema1 + +A schema class that validates payloads + +| Methods Inherited from class org.openapijsonschematools.client.schemas.StringJsonSchema.StringJsonSchema1 | +| ------------------------------------------------------------------ | +| validate | +| validateAndBox | diff --git a/samples/client/petstore/kotlin/docs/paths/fakeparametercollisions1ababselfab/post/parameters/parameter7/Schema7.md b/samples/client/petstore/kotlin/docs/paths/fakeparametercollisions1ababselfab/post/parameters/parameter7/Schema7.md new file mode 100644 index 00000000000..a4e0ad0106a --- /dev/null +++ b/samples/client/petstore/kotlin/docs/paths/fakeparametercollisions1ababselfab/post/parameters/parameter7/Schema7.md @@ -0,0 +1,49 @@ +# Schema7 +public class Schema7
+ +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 + +## Nested Class Summary +| Modifier and Type | Class and Description | +| ----------------- | ---------------------- | +| sealed interface | [Schema7.Schema71Boxed](#schema71boxed)
sealed interface for validated payloads | +| record | [Schema7.Schema71BoxedString](#schema71boxedstring)
boxed class to store validated String payloads | +| static class | [Schema7.Schema71](#schema71)
schema class | + +## Schema71Boxed +public sealed interface Schema71Boxed
+permits
+[Schema71BoxedString](#schema71boxedstring) + +sealed interface that stores validated payloads using boxed classes + +## Schema71BoxedString +public record Schema71BoxedString
+implements [Schema71Boxed](#schema71boxed) + +record that stores validated String payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| Schema71BoxedString(String data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| String | data()
validated payload | +| @Nullable Object | getData()
validated payload | + +## Schema71 +public static class Schema71
+extends StringJsonSchema.StringJsonSchema1 + +A schema class that validates payloads + +| Methods Inherited from class org.openapijsonschematools.client.schemas.StringJsonSchema.StringJsonSchema1 | +| ------------------------------------------------------------------ | +| validate | +| validateAndBox | diff --git a/samples/client/petstore/kotlin/docs/paths/fakeparametercollisions1ababselfab/post/parameters/parameter8/Schema8.md b/samples/client/petstore/kotlin/docs/paths/fakeparametercollisions1ababselfab/post/parameters/parameter8/Schema8.md new file mode 100644 index 00000000000..63b13965df9 --- /dev/null +++ b/samples/client/petstore/kotlin/docs/paths/fakeparametercollisions1ababselfab/post/parameters/parameter8/Schema8.md @@ -0,0 +1,49 @@ +# Schema8 +public class Schema8
+ +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 + +## Nested Class Summary +| Modifier and Type | Class and Description | +| ----------------- | ---------------------- | +| sealed interface | [Schema8.Schema81Boxed](#schema81boxed)
sealed interface for validated payloads | +| record | [Schema8.Schema81BoxedString](#schema81boxedstring)
boxed class to store validated String payloads | +| static class | [Schema8.Schema81](#schema81)
schema class | + +## Schema81Boxed +public sealed interface Schema81Boxed
+permits
+[Schema81BoxedString](#schema81boxedstring) + +sealed interface that stores validated payloads using boxed classes + +## Schema81BoxedString +public record Schema81BoxedString
+implements [Schema81Boxed](#schema81boxed) + +record that stores validated String payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| Schema81BoxedString(String data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| String | data()
validated payload | +| @Nullable Object | getData()
validated payload | + +## Schema81 +public static class Schema81
+extends StringJsonSchema.StringJsonSchema1 + +A schema class that validates payloads + +| Methods Inherited from class org.openapijsonschematools.client.schemas.StringJsonSchema.StringJsonSchema1 | +| ------------------------------------------------------------------ | +| validate | +| validateAndBox | diff --git a/samples/client/petstore/kotlin/docs/paths/fakeparametercollisions1ababselfab/post/parameters/parameter9/Schema9.md b/samples/client/petstore/kotlin/docs/paths/fakeparametercollisions1ababselfab/post/parameters/parameter9/Schema9.md new file mode 100644 index 00000000000..359fd15e9c6 --- /dev/null +++ b/samples/client/petstore/kotlin/docs/paths/fakeparametercollisions1ababselfab/post/parameters/parameter9/Schema9.md @@ -0,0 +1,49 @@ +# Schema9 +public class Schema9
+ +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 + +## Nested Class Summary +| Modifier and Type | Class and Description | +| ----------------- | ---------------------- | +| sealed interface | [Schema9.Schema91Boxed](#schema91boxed)
sealed interface for validated payloads | +| record | [Schema9.Schema91BoxedString](#schema91boxedstring)
boxed class to store validated String payloads | +| static class | [Schema9.Schema91](#schema91)
schema class | + +## Schema91Boxed +public sealed interface Schema91Boxed
+permits
+[Schema91BoxedString](#schema91boxedstring) + +sealed interface that stores validated payloads using boxed classes + +## Schema91BoxedString +public record Schema91BoxedString
+implements [Schema91Boxed](#schema91boxed) + +record that stores validated String payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| Schema91BoxedString(String data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| String | data()
validated payload | +| @Nullable Object | getData()
validated payload | + +## Schema91 +public static class Schema91
+extends StringJsonSchema.StringJsonSchema1 + +A schema class that validates payloads + +| Methods Inherited from class org.openapijsonschematools.client.schemas.StringJsonSchema.StringJsonSchema1 | +| ------------------------------------------------------------------ | +| validate | +| validateAndBox | diff --git a/samples/client/petstore/kotlin/docs/paths/fakeparametercollisions1ababselfab/post/requestbody/content/applicationjson/ApplicationjsonSchema.md b/samples/client/petstore/kotlin/docs/paths/fakeparametercollisions1ababselfab/post/requestbody/content/applicationjson/ApplicationjsonSchema.md new file mode 100644 index 00000000000..b05260b1abf --- /dev/null +++ b/samples/client/petstore/kotlin/docs/paths/fakeparametercollisions1ababselfab/post/requestbody/content/applicationjson/ApplicationjsonSchema.md @@ -0,0 +1,144 @@ +# ApplicationjsonSchema +public class ApplicationjsonSchema
+ +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 + +## Nested Class Summary +| Modifier and Type | Class and Description | +| ----------------- | ---------------------- | +| sealed interface | [ApplicationjsonSchema.ApplicationjsonSchema1Boxed](#applicationjsonschema1boxed)
sealed interface for validated payloads | +| record | [ApplicationjsonSchema.ApplicationjsonSchema1BoxedVoid](#applicationjsonschema1boxedvoid)
boxed class to store validated null payloads | +| record | [ApplicationjsonSchema.ApplicationjsonSchema1BoxedBoolean](#applicationjsonschema1boxedboolean)
boxed class to store validated boolean payloads | +| record | [ApplicationjsonSchema.ApplicationjsonSchema1BoxedNumber](#applicationjsonschema1boxednumber)
boxed class to store validated Number payloads | +| record | [ApplicationjsonSchema.ApplicationjsonSchema1BoxedString](#applicationjsonschema1boxedstring)
boxed class to store validated String payloads | +| record | [ApplicationjsonSchema.ApplicationjsonSchema1BoxedList](#applicationjsonschema1boxedlist)
boxed class to store validated List payloads | +| record | [ApplicationjsonSchema.ApplicationjsonSchema1BoxedMap](#applicationjsonschema1boxedmap)
boxed class to store validated Map payloads | +| static class | [ApplicationjsonSchema.ApplicationjsonSchema1](#applicationjsonschema1)
schema class | + +## ApplicationjsonSchema1Boxed +public sealed interface ApplicationjsonSchema1Boxed
+permits
+[ApplicationjsonSchema1BoxedVoid](#applicationjsonschema1boxedvoid), +[ApplicationjsonSchema1BoxedBoolean](#applicationjsonschema1boxedboolean), +[ApplicationjsonSchema1BoxedNumber](#applicationjsonschema1boxednumber), +[ApplicationjsonSchema1BoxedString](#applicationjsonschema1boxedstring), +[ApplicationjsonSchema1BoxedList](#applicationjsonschema1boxedlist), +[ApplicationjsonSchema1BoxedMap](#applicationjsonschema1boxedmap) + +sealed interface that stores validated payloads using boxed classes + +## ApplicationjsonSchema1BoxedVoid +public record ApplicationjsonSchema1BoxedVoid
+implements [ApplicationjsonSchema1Boxed](#applicationjsonschema1boxed) + +record that stores validated null payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| ApplicationjsonSchema1BoxedVoid(Nothing? data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| Nothing? | data()
validated payload | +| @Nullable Object | getData()
validated payload | + +## ApplicationjsonSchema1BoxedBoolean +public record ApplicationjsonSchema1BoxedBoolean
+implements [ApplicationjsonSchema1Boxed](#applicationjsonschema1boxed) + +record that stores validated boolean payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| ApplicationjsonSchema1BoxedBoolean(boolean data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| boolean | data()
validated payload | +| @Nullable Object | getData()
validated payload | + +## ApplicationjsonSchema1BoxedNumber +public record ApplicationjsonSchema1BoxedNumber
+implements [ApplicationjsonSchema1Boxed](#applicationjsonschema1boxed) + +record that stores validated Number payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| ApplicationjsonSchema1BoxedNumber(Number data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| Number | data()
validated payload | +| @Nullable Object | getData()
validated payload | + +## ApplicationjsonSchema1BoxedString +public record ApplicationjsonSchema1BoxedString
+implements [ApplicationjsonSchema1Boxed](#applicationjsonschema1boxed) + +record that stores validated String payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| ApplicationjsonSchema1BoxedString(String data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| String | data()
validated payload | +| @Nullable Object | getData()
validated payload | + +## ApplicationjsonSchema1BoxedList +public record ApplicationjsonSchema1BoxedList
+implements [ApplicationjsonSchema1Boxed](#applicationjsonschema1boxed) + +record that stores validated List payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| ApplicationjsonSchema1BoxedList(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 | + +## ApplicationjsonSchema1BoxedMap +public record ApplicationjsonSchema1BoxedMap
+implements [ApplicationjsonSchema1Boxed](#applicationjsonschema1boxed) + +record that stores validated Map payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| ApplicationjsonSchema1BoxedMap(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 | + +## ApplicationjsonSchema1 +public static class ApplicationjsonSchema1
+extends AnyTypeJsonSchema.AnyTypeJsonSchema1 + +A schema class that validates payloads + +| Methods Inherited from class org.openapijsonschematools.client.schemas.AnyTypeJsonSchema.AnyTypeJsonSchema1 | +| ------------------------------------------------------------------ | +| validate | +| validateAndBox | diff --git a/samples/client/petstore/kotlin/docs/paths/fakeparametercollisions1ababselfab/post/responses/Fakeparametercollisions1ababselfabPostCode200Response.md b/samples/client/petstore/kotlin/docs/paths/fakeparametercollisions1ababselfab/post/responses/Fakeparametercollisions1ababselfabPostCode200Response.md new file mode 100644 index 00000000000..a781f4d4e59 --- /dev/null +++ b/samples/client/petstore/kotlin/docs/paths/fakeparametercollisions1ababselfab/post/responses/Fakeparametercollisions1ababselfabPostCode200Response.md @@ -0,0 +1,87 @@ +# Fakeparametercollisions1ababselfabPostCode200Response + +public class Fakeparametercollisions1ababselfabPostCode200Response + +A class that contains necessary nested response classes +- SealedMediaType, a sealed interface which contains all the schema/encoding info for each contentType +- records which implement SealedMediaType, the concrete media types +- SealedResponseBody, a sealed interface which contains all the contentType/schema types +- records which implement SealedResponseBody, the concrete response body types +- a class that extends ResponseDeserializer and is used to deserialize responses + +## Nested Class Summary +| Modifier and Type | Class and Description | +| ----------------- | --------------------- | +| sealed interface | [Fakeparametercollisions1ababselfabPostCode200Response.SealedMediaType](#sealedmediatype)
media type sealed interface | +| record | [Fakeparametercollisions1ababselfabPostCode200Response.ApplicationjsonMediaType](#applicationjsonmediatype)
record storing schema + encoding for a specific contentType | +| sealed interface | [Fakeparametercollisions1ababselfabPostCode200Response.SealedResponseBody](#sealedresponsebody)
response body sealed interface | +| record | [Fakeparametercollisions1ababselfabPostCode200Response.ApplicationjsonResponseBody](#applicationjsonresponsebody)
implements sealed interface to store response body | +| static class | [Fakeparametercollisions1ababselfabPostCode200Response.Fakeparametercollisions1ababselfabPostCode200Response1](#fakeparametercollisions1ababselfabpostcode200response1)
class that deserializes responses | + +## SealedMediaType +public sealed interface SealedMediaType
+permits
+[ApplicationjsonMediaType](#applicationjsonmediatype) + +sealed interface that stores schema and encoding info + +## ApplicationjsonMediaType +public record ApplicationjsonMediaType
+implements [SealedMediaType](#sealedmediatype), MediaType<[ApplicationjsonSchema.ApplicationjsonSchema1](../../../../paths/fakeparametercollisions1ababselfab/post/responses/code200response/content/applicationjson/ApplicationjsonSchema.md#applicationjsonschema1), Nothing?> + +class storing schema info for a specific contentType + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| ApplicationjsonMediaType()
Creates an instance | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| [ApplicationjsonSchema.ApplicationjsonSchema1](../../../../paths/fakeparametercollisions1ababselfab/post/responses/code200response/content/applicationjson/ApplicationjsonSchema.md#applicationjsonschema1) | schema()
the schema for this MediaType | +| Nothing? | encoding()
the encoding info | + +## SealedResponseBody +public sealed interface SealedResponseBody
+permits
+[ApplicationjsonResponseBody](#applicationjsonresponsebody) + +sealed interface that stores response body + +## ApplicationjsonResponseBody +public record ApplicationjsonResponseBody
+implements [SealedResponseBody](#sealedresponsebody) + +A record class to store response body for contentType="application/json" + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| ApplicationjsonResponseBody(ApplicationjsonSchema.AnyTypeJsonSchema1Boxed body)
Creates an instance | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| ApplicationjsonSchema.AnyTypeJsonSchema1Boxed | body()
returns the body passed in in the constructor | + +## Fakeparametercollisions1ababselfabPostCode200Response1 +public static class Fakeparametercollisions1ababselfabPostCode200Response1
+extends ResponseDeserializer<[SealedResponseBody](#sealedresponsebody), Nothing?, [SealedMediaType](#sealedmediatype)> + +a class that deserializes responses + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| Fakeparametercollisions1ababselfabPostCode200Response1()
Creates an instance | + +### Field Summary +| Modifier and Type | Field and Description | +| ----------------- | --------------------- | +| 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 | +| ----------------- | ---------------------- | +| ApiResponse<[SealedResponseBody](#sealedresponsebody), Nothing?> | deserialize(HttpResponse response, SchemaConfiguration configuration)
called by endpoint when deserialize responses | diff --git a/samples/client/petstore/kotlin/docs/paths/fakeparametercollisions1ababselfab/post/responses/code200response/content/applicationjson/ApplicationjsonSchema.md b/samples/client/petstore/kotlin/docs/paths/fakeparametercollisions1ababselfab/post/responses/code200response/content/applicationjson/ApplicationjsonSchema.md new file mode 100644 index 00000000000..b05260b1abf --- /dev/null +++ b/samples/client/petstore/kotlin/docs/paths/fakeparametercollisions1ababselfab/post/responses/code200response/content/applicationjson/ApplicationjsonSchema.md @@ -0,0 +1,144 @@ +# ApplicationjsonSchema +public class ApplicationjsonSchema
+ +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 + +## Nested Class Summary +| Modifier and Type | Class and Description | +| ----------------- | ---------------------- | +| sealed interface | [ApplicationjsonSchema.ApplicationjsonSchema1Boxed](#applicationjsonschema1boxed)
sealed interface for validated payloads | +| record | [ApplicationjsonSchema.ApplicationjsonSchema1BoxedVoid](#applicationjsonschema1boxedvoid)
boxed class to store validated null payloads | +| record | [ApplicationjsonSchema.ApplicationjsonSchema1BoxedBoolean](#applicationjsonschema1boxedboolean)
boxed class to store validated boolean payloads | +| record | [ApplicationjsonSchema.ApplicationjsonSchema1BoxedNumber](#applicationjsonschema1boxednumber)
boxed class to store validated Number payloads | +| record | [ApplicationjsonSchema.ApplicationjsonSchema1BoxedString](#applicationjsonschema1boxedstring)
boxed class to store validated String payloads | +| record | [ApplicationjsonSchema.ApplicationjsonSchema1BoxedList](#applicationjsonschema1boxedlist)
boxed class to store validated List payloads | +| record | [ApplicationjsonSchema.ApplicationjsonSchema1BoxedMap](#applicationjsonschema1boxedmap)
boxed class to store validated Map payloads | +| static class | [ApplicationjsonSchema.ApplicationjsonSchema1](#applicationjsonschema1)
schema class | + +## ApplicationjsonSchema1Boxed +public sealed interface ApplicationjsonSchema1Boxed
+permits
+[ApplicationjsonSchema1BoxedVoid](#applicationjsonschema1boxedvoid), +[ApplicationjsonSchema1BoxedBoolean](#applicationjsonschema1boxedboolean), +[ApplicationjsonSchema1BoxedNumber](#applicationjsonschema1boxednumber), +[ApplicationjsonSchema1BoxedString](#applicationjsonschema1boxedstring), +[ApplicationjsonSchema1BoxedList](#applicationjsonschema1boxedlist), +[ApplicationjsonSchema1BoxedMap](#applicationjsonschema1boxedmap) + +sealed interface that stores validated payloads using boxed classes + +## ApplicationjsonSchema1BoxedVoid +public record ApplicationjsonSchema1BoxedVoid
+implements [ApplicationjsonSchema1Boxed](#applicationjsonschema1boxed) + +record that stores validated null payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| ApplicationjsonSchema1BoxedVoid(Nothing? data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| Nothing? | data()
validated payload | +| @Nullable Object | getData()
validated payload | + +## ApplicationjsonSchema1BoxedBoolean +public record ApplicationjsonSchema1BoxedBoolean
+implements [ApplicationjsonSchema1Boxed](#applicationjsonschema1boxed) + +record that stores validated boolean payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| ApplicationjsonSchema1BoxedBoolean(boolean data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| boolean | data()
validated payload | +| @Nullable Object | getData()
validated payload | + +## ApplicationjsonSchema1BoxedNumber +public record ApplicationjsonSchema1BoxedNumber
+implements [ApplicationjsonSchema1Boxed](#applicationjsonschema1boxed) + +record that stores validated Number payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| ApplicationjsonSchema1BoxedNumber(Number data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| Number | data()
validated payload | +| @Nullable Object | getData()
validated payload | + +## ApplicationjsonSchema1BoxedString +public record ApplicationjsonSchema1BoxedString
+implements [ApplicationjsonSchema1Boxed](#applicationjsonschema1boxed) + +record that stores validated String payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| ApplicationjsonSchema1BoxedString(String data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| String | data()
validated payload | +| @Nullable Object | getData()
validated payload | + +## ApplicationjsonSchema1BoxedList +public record ApplicationjsonSchema1BoxedList
+implements [ApplicationjsonSchema1Boxed](#applicationjsonschema1boxed) + +record that stores validated List payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| ApplicationjsonSchema1BoxedList(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 | + +## ApplicationjsonSchema1BoxedMap +public record ApplicationjsonSchema1BoxedMap
+implements [ApplicationjsonSchema1Boxed](#applicationjsonschema1boxed) + +record that stores validated Map payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| ApplicationjsonSchema1BoxedMap(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 | + +## ApplicationjsonSchema1 +public static class ApplicationjsonSchema1
+extends AnyTypeJsonSchema.AnyTypeJsonSchema1 + +A schema class that validates payloads + +| Methods Inherited from class org.openapijsonschematools.client.schemas.AnyTypeJsonSchema.AnyTypeJsonSchema1 | +| ------------------------------------------------------------------ | +| validate | +| validateAndBox | diff --git a/samples/client/petstore/kotlin/docs/paths/fakepemcontenttype/FakepemcontenttypeGet.md b/samples/client/petstore/kotlin/docs/paths/fakepemcontenttype/FakepemcontenttypeGet.md new file mode 100644 index 00000000000..85a6c160680 --- /dev/null +++ b/samples/client/petstore/kotlin/docs/paths/fakepemcontenttype/FakepemcontenttypeGet.md @@ -0,0 +1,148 @@ +# FakepemcontenttypeGet + +public class FakepemcontenttypeGet + +A class that contains necessary endpoint classes +- a class that calls the endpoint method using the http verb +- a class that calls the endpoint method using the operationId name +- class(es) to store the request inputs +- builder(s) to set the request input data + +## Nested Class Summary +| Modifier and Type | Class and Description | +| ----------------- | --------------------- | +| static class | [Get](#get)
The class that has a get method to call the endpoint | +| interface | [PemContentTypeOperation](#pemcontenttypeoperation)
The interface that has a pemContentType method to call the endpoint | +| static class | [GetRequest](#getrequest)
The request inputs class | +| static class | [GetRequestBuilder](#getrequestbuilder)
A builder for the request input class | + +## Get +public static class Get extends ApiClient.ApiClient1 implements GetOperation
+ +a class that allows one to call the endpoint using a method named get + +### 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.fakepemcontenttype.get.FakepemcontenttypeGetRequestBody; +import org.openapijsonschematools.client.paths.fakepemcontenttype.get.requestbody.content.applicationxpemfile.ApplicationxpemfileSchema; +import org.openapijsonschematools.client.RootServerInfo; +import org.openapijsonschematools.client.servers.RootServer0; +import org.openapijsonschematools.client.servers.RootServer1; +import org.openapijsonschematools.client.servers.RootServer2; +import org.openapijsonschematools.client.paths.fakepemcontenttype.get.responses.FakepemcontenttypeGetCode200Response; +import org.openapijsonschematools.client.servers.RootServerInfo; +import org.openapijsonschematools.client.paths.fakepemcontenttype.FakepemcontenttypeGet; +import org.openapijsonschematools.client.paths.fakepemcontenttype.get.FakepemcontenttypeGetResponses; + +import java.io.IOException; +import java.util.Arrays; +import java.util.List; +import java.util.Map; +import java.util.AbstractMap; + +// if you want to use a server that is not SERVER_0 pass it in here and change the ServerIndex input below +ApiConfiguration.ServerInfo serverInfo = new ApiConfiguration.ServerInfoBuilder() + .rootServerInfo( + new RootServerInfo.RootServerInfoBuilder() + .rootServer0(new RootServer0()) + .build() + ) + .build(); +ApiConfiguration.ServerIndexInfo serverIndexInfo = new ApiConfiguration.ServerIndexInfoBuilder() + .rootServerInfoServerIndex(RootServerInfo.ServerIndex.SERVER_0) + .build(); +Duration timeout = Duration.ofSeconds(1L); +Map> defaultHeaders = Map.of("User-Agent", List.of("OpenAPI-JSON-Schema-Generator/1.0.0/java")); +ApiConfiguration apiConfiguration = new ApiConfiguration( + serverInfo + serverIndexInfo, + timeout, + defaultHeaders +); +SchemaConfiguration schemaConfiguration = new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().build()); +FakepemcontenttypeGet.Get apiClient = new FakepemcontenttypeGet.Get(apiConfiguration, schemaConfiguration); + + +var request = new FakepemcontenttypeGet.GetRequestBuilder().build(); + +FakepemcontenttypeGetResponses.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; +} +FakepemcontenttypeGetResponses.EndpointFakepemcontenttypeGetCode200Response castResponse = (FakepemcontenttypeGetResponses.EndpointFakepemcontenttypeGetCode200Response) response; +FakepemcontenttypeGetCode200Response.ApplicationxpemfileResponseBody deserializedBody = (FakepemcontenttypeGetCode200Response.ApplicationxpemfileResponseBody) castResponse.body; +// handle deserialized body here +``` +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| Get(ApiConfiguration apiConfiguration, SchemaConfiguration schemaConfiguration)
Creates an instance | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| [FakepemcontenttypeGetResponses.EndpointResponse](../../paths/fakepemcontenttype/get/FakepemcontenttypeGetResponses.md#endpointresponse) | get([GetRequest](#getrequest) request) | + +## PemContentTypeOperation +public interface PemContentTypeOperation
+ +an interface that allows one to call the endpoint using a method named pemContentType by the operationId + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| [FakepemcontenttypeGetResponses.EndpointResponse](../../paths/fakepemcontenttype/get/FakepemcontenttypeGetResponses.md#endpointresponse) | pemContentType([GetRequest](#getrequest) request) | + +## GetRequest +public static class GetRequest
+ +a class that stores the final request inputs + +### Field Summary +| Modifier and Type | Field and Description | +| ----------------- | --------------------- | +| [FakepemcontenttypeGetRequestBody.@Nullable SealedRequestBody](../../paths/fakepemcontenttype/get/FakepemcontenttypeGetRequestBody.md#sealedrequestbody) | requestBody
optional | +| [RootServerInfo.@Nullable ServerIndex](../../RootServerInfo.md#serverindex) | serverIndex
optional. Note: this will override the value in apiConfiguration | +| @Nullable Duration | timeout
optional. Note: this will override the value in apiConfiguration | + +## GetRequestBuilder +public static class GetRequestBuilder
+ +a builder for request inputs + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| GetRequestBuilder()
Creates a builder that contains null for all parameters | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| [GetRequest](#getrequest) | build()
Returns the request input used to call an endpoint method | +| [GetRequestBuilder](#getrequestbuilder) | requestBody([FakepemcontenttypeGetRequestBody.SealedRequestBody](../../paths/fakepemcontenttype/get/FakepemcontenttypeGetRequestBody.md#sealedrequestbody) requestBody)
sets the optional property | +| [GetRequestBuilder](#getrequestbuilder) | serverIndex([RootServerInfo.ServerIndex](../../RootServerInfo.md#serverindex) serverIndex)
sets the optional property. Note: this will override the value in apiConfiguration | +| [GetRequestBuilder](#getrequestbuilder) | timeout(Duration timeout)
sets the optional property. Note: this will override the value in apiConfiguration | + +[[Back to top]](#top) [[Back to README]](../../../README.md) diff --git a/samples/client/petstore/kotlin/docs/paths/fakepemcontenttype/get/FakepemcontenttypeGetRequestBody.md b/samples/client/petstore/kotlin/docs/paths/fakepemcontenttype/get/FakepemcontenttypeGetRequestBody.md new file mode 100644 index 00000000000..3bf6549245f --- /dev/null +++ b/samples/client/petstore/kotlin/docs/paths/fakepemcontenttype/get/FakepemcontenttypeGetRequestBody.md @@ -0,0 +1,90 @@ +# FakepemcontenttypeGetRequestBody + +public class FakepemcontenttypeGetRequestBody + +A class that contains necessary nested request body classes +- SealedMediaType, a sealed interface which contains all the schema/encoding info for each contentType +- records which implement SealedMediaType, the concrete media types +- a class that extends RequestBodySerializer and is used to serialize input SealedRequestBody instances +- SealedRequestBody, a sealed interface which contains all the contentType/schema input types +- records which implement SealedRequestBody, the concrete request body types + +## Nested Class Summary +| Modifier and Type | Class and Description | +| ----------------- | --------------------- | +| sealed interface | [FakepemcontenttypeGetRequestBody.SealedMediaType](#sealedmediatype)
media type sealed interface | +| record | [FakepemcontenttypeGetRequestBody.ApplicationxpemfileMediaType](#applicationxpemfilemediatype)
record storing schema + encoding for a specific contentType | +| static class | [FakepemcontenttypeGetRequestBody.FakepemcontenttypeGetRequestBody1](#fakepemcontenttypegetrequestbody1)
class that serializes request bodies | +| sealed interface | [FakepemcontenttypeGetRequestBody.SealedRequestBody](#sealedrequestbody)
request body sealed interface | +| record | [FakepemcontenttypeGetRequestBody.ApplicationxpemfileRequestBody](#applicationxpemfilerequestbody)
implements sealed interface to store request body input | + +## SealedMediaType +public sealed interface SealedMediaType
+permits
+[ApplicationxpemfileMediaType](#applicationxpemfilemediatype) + +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), Nothing?> + +class storing schema info for a specific contentType + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| ApplicationxpemfileMediaType()
Creates an instance | + +### 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 | +| Nothing? | encoding()
the encoding info | + +## FakepemcontenttypeGetRequestBody1 +public static class FakepemcontenttypeGetRequestBody1
+ +a class that serializes SealedRequestBody request bodies + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| FakepemcontenttypeGetRequestBody1()
Creates an instance | + +### Field Summary +| Modifier and Type | Field and Description | +| ----------------- | --------------------- | +| boolean | required = false
whether the request body is required | +| Map | content = Map.ofEntries(
    new AbstractMap.SimpleEntry<>("application/x-pem-file", new [ApplicationxpemfileMediaType](#applicationxpemfilemediatype)())
)
the contentType to schema info | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| SerializedRequestBody | serialize([SealedRequestBody](#sealedrequestbody) requestBody)
called by endpoint when creating request body bytes | + +## SealedRequestBody +public sealed interface SealedRequestBody
+permits
+[ApplicationxpemfileRequestBody](#applicationxpemfilerequestbody) + +sealed interface that stores request contentType + validated schema data + +## ApplicationxpemfileRequestBody +public record ApplicationxpemfileRequestBody
+implements [SealedRequestBody](#sealedrequestbody),
+GenericRequestBody
+ +A record class to store request body input for contentType="application/x-pem-file" + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| ApplicationxpemfileRequestBody(ApplicationxpemfileSchema.StringJsonSchema1Boxed body)
Creates an instance | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| String | contentType()
always returns "application/x-pem-file" | +| ApplicationxpemfileSchema.StringJsonSchema1Boxed | body()
returns the body passed in in the constructor | diff --git a/samples/client/petstore/kotlin/docs/paths/fakepemcontenttype/get/FakepemcontenttypeGetResponses.md b/samples/client/petstore/kotlin/docs/paths/fakepemcontenttype/get/FakepemcontenttypeGetResponses.md new file mode 100644 index 00000000000..8a3ded7dac3 --- /dev/null +++ b/samples/client/petstore/kotlin/docs/paths/fakepemcontenttype/get/FakepemcontenttypeGetResponses.md @@ -0,0 +1,29 @@ +# FakepemcontenttypeGetResponses + +public class FakepemcontenttypeGetResponses + +A class that contains necessary responses classes +- a sealed interface, EndpointResponse, that stores endpoint responses +- records for each endpoint response + +## Nested Class Summary +| Modifier and Type | Class and Description | +| ----------------- | --------------------- | +| sealed interface | [EndpointResponse](#endpointresponse)
stores the endpoint responses | +| record | [EndpointFakepemcontenttypeGetCode200Response](#endpointfakepemcontenttypegetcode200response)
the response for 200 | + +## EndpointResponse +public sealed interface EndpointResponse permits
+[EndpointFakepemcontenttypeGetCode200Response](#endpointfakepemcontenttypegetcode200response) + +a sealed interface that stores endpoint responses + +## EndpointFakepemcontenttypeGetCode200Response +public record EndpointFakepemcontenttypeGetCode200Response( + HttpResponse response, + [FakepemcontenttypeGetCode200Response.SealedResponseBody](../../../paths/fakepemcontenttype/get/responses/FakepemcontenttypeGetCode200Response.md#sealedresponsebody) body, + Nothing? headers +) implements EndpointResponse, ApiResponse
+ +a class that stores an endpoint response + diff --git a/samples/client/petstore/kotlin/docs/paths/fakepemcontenttype/get/requestbody/content/applicationxpemfile/ApplicationxpemfileSchema.md b/samples/client/petstore/kotlin/docs/paths/fakepemcontenttype/get/requestbody/content/applicationxpemfile/ApplicationxpemfileSchema.md new file mode 100644 index 00000000000..91a1e361623 --- /dev/null +++ b/samples/client/petstore/kotlin/docs/paths/fakepemcontenttype/get/requestbody/content/applicationxpemfile/ApplicationxpemfileSchema.md @@ -0,0 +1,49 @@ +# ApplicationxpemfileSchema +public class ApplicationxpemfileSchema
+ +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 + +## Nested Class Summary +| Modifier and Type | Class and Description | +| ----------------- | ---------------------- | +| sealed interface | [ApplicationxpemfileSchema.ApplicationxpemfileSchema1Boxed](#applicationxpemfileschema1boxed)
sealed interface for validated payloads | +| record | [ApplicationxpemfileSchema.ApplicationxpemfileSchema1BoxedString](#applicationxpemfileschema1boxedstring)
boxed class to store validated String payloads | +| static class | [ApplicationxpemfileSchema.ApplicationxpemfileSchema1](#applicationxpemfileschema1)
schema class | + +## ApplicationxpemfileSchema1Boxed +public sealed interface ApplicationxpemfileSchema1Boxed
+permits
+[ApplicationxpemfileSchema1BoxedString](#applicationxpemfileschema1boxedstring) + +sealed interface that stores validated payloads using boxed classes + +## ApplicationxpemfileSchema1BoxedString +public record ApplicationxpemfileSchema1BoxedString
+implements [ApplicationxpemfileSchema1Boxed](#applicationxpemfileschema1boxed) + +record that stores validated String payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| ApplicationxpemfileSchema1BoxedString(String data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| String | data()
validated payload | +| @Nullable Object | getData()
validated payload | + +## ApplicationxpemfileSchema1 +public static class ApplicationxpemfileSchema1
+extends StringJsonSchema.StringJsonSchema1 + +A schema class that validates payloads + +| Methods Inherited from class org.openapijsonschematools.client.schemas.StringJsonSchema.StringJsonSchema1 | +| ------------------------------------------------------------------ | +| validate | +| validateAndBox | diff --git a/samples/client/petstore/kotlin/docs/paths/fakepemcontenttype/get/responses/FakepemcontenttypeGetCode200Response.md b/samples/client/petstore/kotlin/docs/paths/fakepemcontenttype/get/responses/FakepemcontenttypeGetCode200Response.md new file mode 100644 index 00000000000..5a5b6b3499e --- /dev/null +++ b/samples/client/petstore/kotlin/docs/paths/fakepemcontenttype/get/responses/FakepemcontenttypeGetCode200Response.md @@ -0,0 +1,87 @@ +# FakepemcontenttypeGetCode200Response + +public class FakepemcontenttypeGetCode200Response + +A class that contains necessary nested response classes +- SealedMediaType, a sealed interface which contains all the schema/encoding info for each contentType +- records which implement SealedMediaType, the concrete media types +- SealedResponseBody, a sealed interface which contains all the contentType/schema types +- records which implement SealedResponseBody, the concrete response body types +- a class that extends ResponseDeserializer and is used to deserialize responses + +## Nested Class Summary +| Modifier and Type | Class and Description | +| ----------------- | --------------------- | +| sealed interface | [FakepemcontenttypeGetCode200Response.SealedMediaType](#sealedmediatype)
media type sealed interface | +| record | [FakepemcontenttypeGetCode200Response.ApplicationxpemfileMediaType](#applicationxpemfilemediatype)
record storing schema + encoding for a specific contentType | +| sealed interface | [FakepemcontenttypeGetCode200Response.SealedResponseBody](#sealedresponsebody)
response body sealed interface | +| record | [FakepemcontenttypeGetCode200Response.ApplicationxpemfileResponseBody](#applicationxpemfileresponsebody)
implements sealed interface to store response body | +| static class | [FakepemcontenttypeGetCode200Response.FakepemcontenttypeGetCode200Response1](#fakepemcontenttypegetcode200response1)
class that deserializes responses | + +## SealedMediaType +public sealed interface SealedMediaType
+permits
+[ApplicationxpemfileMediaType](#applicationxpemfilemediatype) + +sealed interface that stores schema and encoding info + +## ApplicationxpemfileMediaType +public record ApplicationxpemfileMediaType
+implements [SealedMediaType](#sealedmediatype), MediaType<[ApplicationxpemfileSchema.ApplicationxpemfileSchema1](../../../../paths/fakepemcontenttype/get/responses/code200response/content/applicationxpemfile/ApplicationxpemfileSchema.md#applicationxpemfileschema1), Nothing?> + +class storing schema info for a specific contentType + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| ApplicationxpemfileMediaType()
Creates an instance | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| [ApplicationxpemfileSchema.ApplicationxpemfileSchema1](../../../../paths/fakepemcontenttype/get/responses/code200response/content/applicationxpemfile/ApplicationxpemfileSchema.md#applicationxpemfileschema1) | schema()
the schema for this MediaType | +| Nothing? | encoding()
the encoding info | + +## SealedResponseBody +public sealed interface SealedResponseBody
+permits
+[ApplicationxpemfileResponseBody](#applicationxpemfileresponsebody) + +sealed interface that stores response body + +## ApplicationxpemfileResponseBody +public record ApplicationxpemfileResponseBody
+implements [SealedResponseBody](#sealedresponsebody) + +A record class to store response body for contentType="application/x-pem-file" + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| ApplicationxpemfileResponseBody(ApplicationxpemfileSchema.StringJsonSchema1Boxed body)
Creates an instance | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| ApplicationxpemfileSchema.StringJsonSchema1Boxed | body()
returns the body passed in in the constructor | + +## FakepemcontenttypeGetCode200Response1 +public static class FakepemcontenttypeGetCode200Response1
+extends ResponseDeserializer<[SealedResponseBody](#sealedresponsebody), Nothing?, [SealedMediaType](#sealedmediatype)> + +a class that deserializes responses + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| FakepemcontenttypeGetCode200Response1()
Creates an instance | + +### Field Summary +| Modifier and Type | Field and Description | +| ----------------- | --------------------- | +| Map | content = Map.ofEntries(
    new AbstractMap.SimpleEntry<>("application/x-pem-file", new [ApplicationxpemfileMediaType](#applicationxpemfilemediatype)())
)
the contentType to schema info | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| ApiResponse<[SealedResponseBody](#sealedresponsebody), Nothing?> | deserialize(HttpResponse response, SchemaConfiguration configuration)
called by endpoint when deserialize responses | diff --git a/samples/client/petstore/kotlin/docs/paths/fakepemcontenttype/get/responses/code200response/content/applicationxpemfile/ApplicationxpemfileSchema.md b/samples/client/petstore/kotlin/docs/paths/fakepemcontenttype/get/responses/code200response/content/applicationxpemfile/ApplicationxpemfileSchema.md new file mode 100644 index 00000000000..91a1e361623 --- /dev/null +++ b/samples/client/petstore/kotlin/docs/paths/fakepemcontenttype/get/responses/code200response/content/applicationxpemfile/ApplicationxpemfileSchema.md @@ -0,0 +1,49 @@ +# ApplicationxpemfileSchema +public class ApplicationxpemfileSchema
+ +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 + +## Nested Class Summary +| Modifier and Type | Class and Description | +| ----------------- | ---------------------- | +| sealed interface | [ApplicationxpemfileSchema.ApplicationxpemfileSchema1Boxed](#applicationxpemfileschema1boxed)
sealed interface for validated payloads | +| record | [ApplicationxpemfileSchema.ApplicationxpemfileSchema1BoxedString](#applicationxpemfileschema1boxedstring)
boxed class to store validated String payloads | +| static class | [ApplicationxpemfileSchema.ApplicationxpemfileSchema1](#applicationxpemfileschema1)
schema class | + +## ApplicationxpemfileSchema1Boxed +public sealed interface ApplicationxpemfileSchema1Boxed
+permits
+[ApplicationxpemfileSchema1BoxedString](#applicationxpemfileschema1boxedstring) + +sealed interface that stores validated payloads using boxed classes + +## ApplicationxpemfileSchema1BoxedString +public record ApplicationxpemfileSchema1BoxedString
+implements [ApplicationxpemfileSchema1Boxed](#applicationxpemfileschema1boxed) + +record that stores validated String payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| ApplicationxpemfileSchema1BoxedString(String data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| String | data()
validated payload | +| @Nullable Object | getData()
validated payload | + +## ApplicationxpemfileSchema1 +public static class ApplicationxpemfileSchema1
+extends StringJsonSchema.StringJsonSchema1 + +A schema class that validates payloads + +| Methods Inherited from class org.openapijsonschematools.client.schemas.StringJsonSchema.StringJsonSchema1 | +| ------------------------------------------------------------------ | +| validate | +| validateAndBox | diff --git a/samples/client/petstore/kotlin/docs/paths/fakepetiduploadimagewithrequiredfile/FakepetiduploadimagewithrequiredfilePost.md b/samples/client/petstore/kotlin/docs/paths/fakepetiduploadimagewithrequiredfile/FakepetiduploadimagewithrequiredfilePost.md new file mode 100644 index 00000000000..0f305d0f1aa --- /dev/null +++ b/samples/client/petstore/kotlin/docs/paths/fakepetiduploadimagewithrequiredfile/FakepetiduploadimagewithrequiredfilePost.md @@ -0,0 +1,203 @@ +# FakepetiduploadimagewithrequiredfilePost + +public class FakepetiduploadimagewithrequiredfilePost + +A class that contains necessary endpoint classes +- a class that calls the endpoint method using the http verb +- a class that calls the endpoint method using the operationId name +- class(es) to store the request inputs +- builder(s) to set the request input data + +## Nested Class Summary +| Modifier and Type | Class and Description | +| ----------------- | --------------------- | +| static class | [Post](#post)
The class that has a post method to call the endpoint | +| interface | [UploadFileWithRequiredFileOperation](#uploadfilewithrequiredfileoperation)
The interface that has a uploadFileWithRequiredFile method to call the endpoint | +| static class | [PostRequest](#postrequest)
The final request inputs class | +| static class | [PostNullableRequest](#postnullablerequest)
The initial request inputs class | +| static class | [Post0RequestBuilder](#post0requestbuilder)
A builder for the request input class | +| static class | [PostRequestBuilder](#postrequestbuilder)
A builder for the request input class | + +## Post +public static class Post 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.FakepetiduploadimagewithrequiredfilePostRequestBody; +import org.openapijsonschematools.client.RootServerInfo; +import org.openapijsonschematools.client.paths.fakepetiduploadimagewithrequiredfile.post.FakepetiduploadimagewithrequiredfilePostSecurityInfo; +import org.openapijsonschematools.client.paths.fakepetiduploadimagewithrequiredfile.post.FakepetiduploadimagewithrequiredfilePostPathParameters; +import org.openapijsonschematools.client.servers.RootServer0; +import org.openapijsonschematools.client.servers.RootServer1; +import org.openapijsonschematools.client.servers.RootServer2; +import org.openapijsonschematools.client.securityschemes.SecurityScheme; +import org.openapijsonschematools.client.components.securityschemes.PetstoreAuth; +import org.openapijsonschematools.client.paths.fakepetiduploadimagewithrequiredfile.post.responses.FakepetiduploadimagewithrequiredfilePostCode200Response; +import org.openapijsonschematools.client.servers.RootServerInfo; +import org.openapijsonschematools.client.paths.fakepetiduploadimagewithrequiredfile.FakepetiduploadimagewithrequiredfilePost; +import org.openapijsonschematools.client.paths.fakepetiduploadimagewithrequiredfile.post.FakepetiduploadimagewithrequiredfilePostResponses; + +import java.io.IOException; +import java.util.Arrays; +import java.util.List; +import java.util.Map; +import java.util.AbstractMap; + +// if you want to use a server that is not SERVER_0 pass it in here and change the ServerIndex input below +ApiConfiguration.ServerInfo serverInfo = new ApiConfiguration.ServerInfoBuilder() + .rootServerInfo( + new RootServerInfo.RootServerInfoBuilder() + .rootServer0(new RootServer0()) + .build() + ) + .build(); +ApiConfiguration.ServerIndexInfo serverIndexInfo = new ApiConfiguration.ServerIndexInfoBuilder() + .rootServerInfoServerIndex(RootServerInfo.ServerIndex.SERVER_0) + .build(); +List securitySchemes = new ArrayList(); +ApiConfiguration.SecurityIndexInfo securityIndexInfo = new ApiConfiguration.SecurityIndexInfoBuilder() + .fakepetiduploadimagewithrequiredfilePostSecurityRequirementObject0SecurityIndex(FakepetiduploadimagewithrequiredfilePostSecurityRequirementObject0.SecurityIndex.SECURITY_0) + .build(); +Duration timeout = Duration.ofSeconds(1L); +Map> defaultHeaders = Map.of("User-Agent", List.of("OpenAPI-JSON-Schema-Generator/1.0.0/java")); +ApiConfiguration apiConfiguration = new ApiConfiguration( + serverInfo + serverIndexInfo, + securitySchemes, + securityIndexInfo, + timeout, + defaultHeaders +); +SchemaConfiguration schemaConfiguration = new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().build()); +FakepetiduploadimagewithrequiredfilePost.Post apiClient = new FakepetiduploadimagewithrequiredfilePost.Post(apiConfiguration, schemaConfiguration); + + +// Map validation +FakepetiduploadimagewithrequiredfilePostPathParameters.PathParametersMap pathParameters = + FakepetiduploadimagewithrequiredfilePostPathParameters.FakepetiduploadimagewithrequiredfilePostPathParameters1.validate( + new FakepetiduploadimagewithrequiredfilePostPathParameters.PathParametersMapBuilder() + .petId(1L) + + .build(), + schemaConfiguration +); + +var request = new FakepetiduploadimagewithrequiredfilePost.PostRequestBuilder() + .pathParameters(pathParameters) + .build(); + +FakepetiduploadimagewithrequiredfilePostResponses.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; +} +FakepetiduploadimagewithrequiredfilePostResponses.EndpointFakepetiduploadimagewithrequiredfilePostCode200Response castResponse = (FakepetiduploadimagewithrequiredfilePostResponses.EndpointFakepetiduploadimagewithrequiredfilePostCode200Response) response; +FakepetiduploadimagewithrequiredfilePostCode200Response.ApplicationjsonResponseBody deserializedBody = (FakepetiduploadimagewithrequiredfilePostCode200Response.ApplicationjsonResponseBody) castResponse.body; +// handle deserialized body here +``` +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| Post(ApiConfiguration apiConfiguration, SchemaConfiguration schemaConfiguration)
Creates an instance | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| [FakepetiduploadimagewithrequiredfilePostResponses.EndpointResponse](../../paths/fakepetiduploadimagewithrequiredfile/post/FakepetiduploadimagewithrequiredfilePostResponses.md#endpointresponse) | post([PostRequest](#postrequest) request) | + +## UploadFileWithRequiredFileOperation +public interface UploadFileWithRequiredFileOperation
+ +an interface that allows one to call the endpoint using a method named uploadFileWithRequiredFile by the operationId + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| [FakepetiduploadimagewithrequiredfilePostResponses.EndpointResponse](../../paths/fakepetiduploadimagewithrequiredfile/post/FakepetiduploadimagewithrequiredfilePostResponses.md#endpointresponse) | uploadFileWithRequiredFile([PostRequest](#postrequest) request) | + +## PostRequest +public static class PostRequest
+ +a class that stores the final request inputs + +### Field Summary +| Modifier and Type | Field and Description | +| ----------------- | --------------------- | +| [FakepetiduploadimagewithrequiredfilePostPathParameters.PathParametersMap](../../paths/fakepetiduploadimagewithrequiredfile/post/FakepetiduploadimagewithrequiredfilePostPathParameters.md#pathparametersmap) | pathParameters | +| [FakepetiduploadimagewithrequiredfilePostRequestBody.@Nullable SealedRequestBody](../../paths/fakepetiduploadimagewithrequiredfile/post/FakepetiduploadimagewithrequiredfilePostRequestBody.md#sealedrequestbody) | requestBody
optional | +| [RootServerInfo.@Nullable ServerIndex](../../RootServerInfo.md#serverindex) | serverIndex
optional. Note: this will override the value in apiConfiguration | +| [FakepetiduploadimagewithrequiredfilePostSecurityInfo.@Nullable SecurityIndex](../../paths/fakepetiduploadimagewithrequiredfile/post/FakepetiduploadimagewithrequiredfilePostSecurityInfo.md#securityindex) | securityIndex
optional. Note: this will override the value in apiConfiguration | +| @Nullable Duration | timeout
optional. Note: this will override the value in apiConfiguration | + +## PostNullableRequest +public static class PostNullableRequest
+ +a class that stores the initial request inputs + +### Field Summary +| Modifier and Type | Field and Description | +| ----------------- | --------------------- | +| [FakepetiduploadimagewithrequiredfilePostPathParameters.@Nullable PathParametersMap](../../paths/fakepetiduploadimagewithrequiredfile/post/FakepetiduploadimagewithrequiredfilePostPathParameters.md#pathparametersmap) | pathParameters | +| [FakepetiduploadimagewithrequiredfilePostRequestBody.@Nullable SealedRequestBody](../../paths/fakepetiduploadimagewithrequiredfile/post/FakepetiduploadimagewithrequiredfilePostRequestBody.md#sealedrequestbody) | requestBody | +| [RootServerInfo.@Nullable ServerIndex](../../RootServerInfo.md#serverindex) | serverIndex | +| [FakepetiduploadimagewithrequiredfilePostSecurityInfo.@Nullable SecurityIndex](../../paths/fakepetiduploadimagewithrequiredfile/post/FakepetiduploadimagewithrequiredfilePostSecurityInfo.md#securityindex) | securityIndex | +| @Nullable Duration | timeout | + +## Post0RequestBuilder +public static class Post0RequestBuilder
+ +a builder for request inputs + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| Post0RequestBuilder(Post0RequestBuilder instance)
Creates a builder that contains the passed instance | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| [PostRequest](#postrequest) | build()
Returns the request input used to call an endpoint method | +| [Post0RequestBuilder](#post0requestbuilder) | requestBody([FakepetiduploadimagewithrequiredfilePostRequestBody.SealedRequestBody](../../paths/fakepetiduploadimagewithrequiredfile/post/FakepetiduploadimagewithrequiredfilePostRequestBody.md#sealedrequestbody) requestBody)
sets the optional property | +| [Post0RequestBuilder](#post0requestbuilder) | serverIndex([RootServerInfo.ServerIndex](../../RootServerInfo.md#serverindex) serverIndex)
sets the optional property. Note: this will override the value in apiConfiguration | +| [Post0RequestBuilder](#post0requestbuilder) | securityIndex([FakepetiduploadimagewithrequiredfilePostSecurityInfo.SecurityIndex](../../paths/fakepetiduploadimagewithrequiredfile/post/FakepetiduploadimagewithrequiredfilePostSecurityInfo.md#securityindex) securityIndex)
sets the optional property. Note: this will override the value in apiConfiguration | +| [Post0RequestBuilder](#post0requestbuilder) | timeout(Duration timeout)
sets the optional property. Note: this will override the value in apiConfiguration | + +## PostRequestBuilder +public static class PostRequestBuilder
+ +a builder for request inputs + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| PostRequestBuilder()
Creates a builder that contains null for all parameters | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| [Post0RequestBuilder](#post0requestbuilder) | pathParameters([FakepetiduploadimagewithrequiredfilePostPathParametersPathParametersMap](../../paths/fakepetiduploadimagewithrequiredfile/post/FakepetiduploadimagewithrequiredfilePostPathParameters.md#pathparametersmap) pathParameters)
sets the property | + +[[Back to top]](#top) [[Back to README]](../../../README.md) diff --git a/samples/client/petstore/kotlin/docs/paths/fakepetiduploadimagewithrequiredfile/post/FakepetiduploadimagewithrequiredfilePostPathParameters.md b/samples/client/petstore/kotlin/docs/paths/fakepetiduploadimagewithrequiredfile/post/FakepetiduploadimagewithrequiredfilePostPathParameters.md new file mode 100644 index 00000000000..381179e8327 --- /dev/null +++ b/samples/client/petstore/kotlin/docs/paths/fakepetiduploadimagewithrequiredfile/post/FakepetiduploadimagewithrequiredfilePostPathParameters.md @@ -0,0 +1,271 @@ +# FakepetiduploadimagewithrequiredfilePostPathParameters +public class FakepetiduploadimagewithrequiredfilePostPathParameters
+ +A class that contains necessary nested +- schema classes (which validate payloads), extends JsonSchema +- sealed interfaces which store validated payloads, java version of a sum type +- boxed classes which store validated payloads, sealed permits class implementations +- classes to store validated map payloads, extends FrozenMap +- classes to build inputs for map payloads + +## Nested Class Summary +| Modifier and Type | Class and Description | +| ----------------- | ---------------------- | +| sealed interface | [FakepetiduploadimagewithrequiredfilePostPathParameters.FakepetiduploadimagewithrequiredfilePostPathParameters1Boxed](#fakepetiduploadimagewithrequiredfilepostpathparameters1boxed)
sealed interface for validated payloads | +| record | [FakepetiduploadimagewithrequiredfilePostPathParameters.FakepetiduploadimagewithrequiredfilePostPathParameters1BoxedMap](#fakepetiduploadimagewithrequiredfilepostpathparameters1boxedmap)
boxed class to store validated Map payloads | +| static class | [FakepetiduploadimagewithrequiredfilePostPathParameters.FakepetiduploadimagewithrequiredfilePostPathParameters1](#fakepetiduploadimagewithrequiredfilepostpathparameters1)
schema class | +| static class | [FakepetiduploadimagewithrequiredfilePostPathParameters.PathParametersMapBuilder](#pathparametersmapbuilder)
builder for Map payloads | +| static class | [FakepetiduploadimagewithrequiredfilePostPathParameters.PathParametersMap](#pathparametersmap)
output class for Map payloads | +| sealed interface | [FakepetiduploadimagewithrequiredfilePostPathParameters.AdditionalPropertiesBoxed](#additionalpropertiesboxed)
sealed interface for validated payloads | +| record | [FakepetiduploadimagewithrequiredfilePostPathParameters.AdditionalPropertiesBoxedVoid](#additionalpropertiesboxedvoid)
boxed class to store validated null payloads | +| record | [FakepetiduploadimagewithrequiredfilePostPathParameters.AdditionalPropertiesBoxedBoolean](#additionalpropertiesboxedboolean)
boxed class to store validated boolean payloads | +| record | [FakepetiduploadimagewithrequiredfilePostPathParameters.AdditionalPropertiesBoxedNumber](#additionalpropertiesboxednumber)
boxed class to store validated Number payloads | +| record | [FakepetiduploadimagewithrequiredfilePostPathParameters.AdditionalPropertiesBoxedString](#additionalpropertiesboxedstring)
boxed class to store validated String payloads | +| record | [FakepetiduploadimagewithrequiredfilePostPathParameters.AdditionalPropertiesBoxedList](#additionalpropertiesboxedlist)
boxed class to store validated List payloads | +| record | [FakepetiduploadimagewithrequiredfilePostPathParameters.AdditionalPropertiesBoxedMap](#additionalpropertiesboxedmap)
boxed class to store validated Map payloads | +| static class | [FakepetiduploadimagewithrequiredfilePostPathParameters.AdditionalProperties](#additionalproperties)
schema class | + +## FakepetiduploadimagewithrequiredfilePostPathParameters1Boxed +public sealed interface FakepetiduploadimagewithrequiredfilePostPathParameters1Boxed
+permits
+[FakepetiduploadimagewithrequiredfilePostPathParameters1BoxedMap](#fakepetiduploadimagewithrequiredfilepostpathparameters1boxedmap) + +sealed interface that stores validated payloads using boxed classes + +## FakepetiduploadimagewithrequiredfilePostPathParameters1BoxedMap +public record FakepetiduploadimagewithrequiredfilePostPathParameters1BoxedMap
+implements [FakepetiduploadimagewithrequiredfilePostPathParameters1Boxed](#fakepetiduploadimagewithrequiredfilepostpathparameters1boxed) + +record that stores validated Map payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| FakepetiduploadimagewithrequiredfilePostPathParameters1BoxedMap([PathParametersMap](#pathparametersmap) data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| [PathParametersMap](#pathparametersmap) | data()
validated payload | +| @Nullable Object | getData()
validated payload | + +## FakepetiduploadimagewithrequiredfilePostPathParameters1 +public static class FakepetiduploadimagewithrequiredfilePostPathParameters1
+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.fakepetiduploadimagewithrequiredfile.post.FakepetiduploadimagewithrequiredfilePostPathParameters; + +import java.util.Arrays; +import java.util.List; +import java.util.AbstractMap; + +static final SchemaConfiguration configuration = new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().build()); + +// Map validation +FakepetiduploadimagewithrequiredfilePostPathParameters.PathParametersMap validatedPayload = + FakepetiduploadimagewithrequiredfilePostPathParameters.FakepetiduploadimagewithrequiredfilePostPathParameters1.validate( + new FakepetiduploadimagewithrequiredfilePostPathParameters.PathParametersMapBuilder() + .petId(1L) + + .build(), + configuration +); +``` + +### Field Summary +| Modifier and Type | Field and Description | +| ----------------- | ---------------------- | +| Set> | type = Set.of(Map.class) | +| Map> | properties = Map.ofEntries(
    new PropertyEntry("petId", [Schema0.Schema01.class](../../../paths/fakepetiduploadimagewithrequiredfile/post/parameters/parameter0/Schema0.md#schema01))
)
| +| Set | required = Set.of(
    "petId"
)
| +| Class | additionalProperties = [AdditionalProperties.class](#additionalproperties) | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| [PathParametersMap](#pathparametersmap) | validate([Map<?, ?>](#pathparametersmapbuilder) arg, SchemaConfiguration configuration) | +| [FakepetiduploadimagewithrequiredfilePostPathParameters1BoxedMap](#fakepetiduploadimagewithrequiredfilepostpathparameters1boxedmap) | validateAndBox([Map<?, ?>](#pathparametersmapbuilder) arg, SchemaConfiguration configuration) | +| [FakepetiduploadimagewithrequiredfilePostPathParameters1Boxed](#fakepetiduploadimagewithrequiredfilepostpathparameters1boxed) | validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) | +| @Nullable Object | validate(@Nullable Object arg, SchemaConfiguration configuration) | + +## PathParametersMap0Builder +public class PathParametersMap0Builder
+builder for `Map` + +A class that builds the Map input type + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| PathParametersMap0Builder(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 | + +## PathParametersMapBuilder +public class PathParametersMapBuilder
+builder for `Map` + +A class that builds the Map input type + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| PathParametersMapBuilder()
Creates a builder that contains an empty map | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| [PathParametersMap0Builder](#pathparametersmap0builder) | petId(int value) | +| [PathParametersMap0Builder](#pathparametersmap0builder) | petId(float value) | +| [PathParametersMap0Builder](#pathparametersmap0builder) | petId(long value) | +| [PathParametersMap0Builder](#pathparametersmap0builder) | petId(double value) | + +## PathParametersMap +public static class PathParametersMap
+extends FrozenMap + +A class to store validated Map payloads + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| static [PathParametersMap](#pathparametersmap) | of([Map](#pathparametersmapbuilder) arg, SchemaConfiguration configuration) | +| Number | petId()
| + +## 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(Nothing? data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| Nothing? | 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/kotlin/docs/paths/fakepetiduploadimagewithrequiredfile/post/FakepetiduploadimagewithrequiredfilePostRequestBody.md b/samples/client/petstore/kotlin/docs/paths/fakepetiduploadimagewithrequiredfile/post/FakepetiduploadimagewithrequiredfilePostRequestBody.md new file mode 100644 index 00000000000..59c267e0298 --- /dev/null +++ b/samples/client/petstore/kotlin/docs/paths/fakepetiduploadimagewithrequiredfile/post/FakepetiduploadimagewithrequiredfilePostRequestBody.md @@ -0,0 +1,90 @@ +# FakepetiduploadimagewithrequiredfilePostRequestBody + +public class FakepetiduploadimagewithrequiredfilePostRequestBody + +A class that contains necessary nested request body classes +- SealedMediaType, a sealed interface which contains all the schema/encoding info for each contentType +- records which implement SealedMediaType, the concrete media types +- a class that extends RequestBodySerializer and is used to serialize input SealedRequestBody instances +- SealedRequestBody, a sealed interface which contains all the contentType/schema input types +- records which implement SealedRequestBody, the concrete request body types + +## Nested Class Summary +| Modifier and Type | Class and Description | +| ----------------- | --------------------- | +| sealed interface | [FakepetiduploadimagewithrequiredfilePostRequestBody.SealedMediaType](#sealedmediatype)
media type sealed interface | +| record | [FakepetiduploadimagewithrequiredfilePostRequestBody.MultipartformdataMediaType](#multipartformdatamediatype)
record storing schema + encoding for a specific contentType | +| static class | [FakepetiduploadimagewithrequiredfilePostRequestBody.FakepetiduploadimagewithrequiredfilePostRequestBody1](#fakepetiduploadimagewithrequiredfilepostrequestbody1)
class that serializes request bodies | +| sealed interface | [FakepetiduploadimagewithrequiredfilePostRequestBody.SealedRequestBody](#sealedrequestbody)
request body sealed interface | +| record | [FakepetiduploadimagewithrequiredfilePostRequestBody.MultipartformdataRequestBody](#multipartformdatarequestbody)
implements sealed interface to store request body input | + +## SealedMediaType +public sealed interface SealedMediaType
+permits
+[MultipartformdataMediaType](#multipartformdatamediatype) + +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), Nothing?> + +class storing schema info for a specific contentType + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| MultipartformdataMediaType()
Creates an instance | + +### 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 | +| Nothing? | encoding()
the encoding info | + +## FakepetiduploadimagewithrequiredfilePostRequestBody1 +public static class FakepetiduploadimagewithrequiredfilePostRequestBody1
+ +a class that serializes SealedRequestBody request bodies + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| FakepetiduploadimagewithrequiredfilePostRequestBody1()
Creates an instance | + +### Field Summary +| Modifier and Type | Field and Description | +| ----------------- | --------------------- | +| boolean | required = false
whether the request body is required | +| Map | content = Map.ofEntries(
    new AbstractMap.SimpleEntry<>("multipart/form-data", new [MultipartformdataMediaType](#multipartformdatamediatype)())
)
the contentType to schema info | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| SerializedRequestBody | serialize([SealedRequestBody](#sealedrequestbody) requestBody)
called by endpoint when creating request body bytes | + +## SealedRequestBody +public sealed interface SealedRequestBody
+permits
+[MultipartformdataRequestBody](#multipartformdatarequestbody) + +sealed interface that stores request contentType + validated schema data + +## MultipartformdataRequestBody +public record MultipartformdataRequestBody
+implements [SealedRequestBody](#sealedrequestbody),
+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 | + +### 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 | diff --git a/samples/client/petstore/kotlin/docs/paths/fakepetiduploadimagewithrequiredfile/post/FakepetiduploadimagewithrequiredfilePostResponses.md b/samples/client/petstore/kotlin/docs/paths/fakepetiduploadimagewithrequiredfile/post/FakepetiduploadimagewithrequiredfilePostResponses.md new file mode 100644 index 00000000000..264b1071b7a --- /dev/null +++ b/samples/client/petstore/kotlin/docs/paths/fakepetiduploadimagewithrequiredfile/post/FakepetiduploadimagewithrequiredfilePostResponses.md @@ -0,0 +1,29 @@ +# FakepetiduploadimagewithrequiredfilePostResponses + +public class FakepetiduploadimagewithrequiredfilePostResponses + +A class that contains necessary responses classes +- a sealed interface, EndpointResponse, that stores endpoint responses +- records for each endpoint response + +## Nested Class Summary +| Modifier and Type | Class and Description | +| ----------------- | --------------------- | +| sealed interface | [EndpointResponse](#endpointresponse)
stores the endpoint responses | +| record | [EndpointFakepetiduploadimagewithrequiredfilePostCode200Response](#endpointfakepetiduploadimagewithrequiredfilepostcode200response)
the response for 200 | + +## EndpointResponse +public sealed interface EndpointResponse permits
+[EndpointFakepetiduploadimagewithrequiredfilePostCode200Response](#endpointfakepetiduploadimagewithrequiredfilepostcode200response) + +a sealed interface that stores endpoint responses + +## EndpointFakepetiduploadimagewithrequiredfilePostCode200Response +public record EndpointFakepetiduploadimagewithrequiredfilePostCode200Response( + HttpResponse response, + [FakepetiduploadimagewithrequiredfilePostCode200Response.SealedResponseBody](../../../paths/fakepetiduploadimagewithrequiredfile/post/responses/FakepetiduploadimagewithrequiredfilePostCode200Response.md#sealedresponsebody) body, + Nothing? headers +) implements EndpointResponse, ApiResponse
+ +a class that stores an endpoint response + diff --git a/samples/client/petstore/kotlin/docs/paths/fakepetiduploadimagewithrequiredfile/post/FakepetiduploadimagewithrequiredfilePostSecurityInfo.md b/samples/client/petstore/kotlin/docs/paths/fakepetiduploadimagewithrequiredfile/post/FakepetiduploadimagewithrequiredfilePostSecurityInfo.md new file mode 100644 index 00000000000..7d31590a6a5 --- /dev/null +++ b/samples/client/petstore/kotlin/docs/paths/fakepetiduploadimagewithrequiredfile/post/FakepetiduploadimagewithrequiredfilePostSecurityInfo.md @@ -0,0 +1,40 @@ +# FakepetiduploadimagewithrequiredfilePostSecurityInfo +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 +- an enum class that describes security index values + +## Nested Class Summary +| Modifier and Type | Class and Description | +| ----------------- | --------------------- | +| static class | [FakepetiduploadimagewithrequiredfilePostSecurityInfo.FakepetiduploadimagewithrequiredfilePostSecurityInfo1](#fakepetiduploadimagewithrequiredfilepostsecurityinfo1)
SecurityRequirementObjectProvider +| enum | [FakepetiduploadimagewithrequiredfilePostSecurityInfo.SecurityIndex](#securityindex)
class that stores a security index | + +## FakepetiduploadimagewithrequiredfilePostSecurityInfo1 +implements SecurityRequirementObjectProvider<[SecurityIndex](#securityindex)> + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| FakepetiduploadimagewithrequiredfilePostSecurityInfo1()
Creates an instance | + +### Field Summary +| Modifier and Type | Field and Description | +| ----------------- | --------------------- | +| [FakepetiduploadimagewithrequiredfilePostSecurityRequirementObject0](../../../paths/fakepetiduploadimagewithrequiredfile/post/security/FakepetiduploadimagewithrequiredfilePostSecurityRequirementObject0.md) | security0 | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| SecurityRequirementObject | getSecurityRequirementObject(@Nullable [SecurityIndex](#securityindex) securityIndex)
If null is input, then the instance's securityIndex will be used | + +## SecurityIndex +enum SecurityIndex
+ +### Enum Constant Summary +| Enum Constant And Description | +| ----------------------------- | +| SECURITY_0
security 0 | diff --git a/samples/client/petstore/kotlin/docs/paths/fakepetiduploadimagewithrequiredfile/post/parameters/parameter0/Schema0.md b/samples/client/petstore/kotlin/docs/paths/fakepetiduploadimagewithrequiredfile/post/parameters/parameter0/Schema0.md new file mode 100644 index 00000000000..55e4e5cb238 --- /dev/null +++ b/samples/client/petstore/kotlin/docs/paths/fakepetiduploadimagewithrequiredfile/post/parameters/parameter0/Schema0.md @@ -0,0 +1,49 @@ +# Schema0 +public class Schema0
+ +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 + +## Nested Class Summary +| Modifier and Type | Class and Description | +| ----------------- | ---------------------- | +| sealed interface | [Schema0.Schema01Boxed](#schema01boxed)
sealed interface for validated payloads | +| record | [Schema0.Schema01BoxedNumber](#schema01boxednumber)
boxed class to store validated Number payloads | +| static class | [Schema0.Schema01](#schema01)
schema class | + +## Schema01Boxed +public sealed interface Schema01Boxed
+permits
+[Schema01BoxedNumber](#schema01boxednumber) + +sealed interface that stores validated payloads using boxed classes + +## Schema01BoxedNumber +public record Schema01BoxedNumber
+implements [Schema01Boxed](#schema01boxed) + +record that stores validated Number payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| Schema01BoxedNumber(Number data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| Number | data()
validated payload | +| @Nullable Object | getData()
validated payload | + +## Schema01 +public static class Schema01
+extends Int64JsonSchema.Int64JsonSchema1 + +A schema class that validates payloads + +| Methods Inherited from class org.openapijsonschematools.client.schemas.Int64JsonSchema.Int64JsonSchema1 | +| ------------------------------------------------------------------ | +| validate | +| validateAndBox | diff --git a/samples/client/petstore/kotlin/docs/paths/fakepetiduploadimagewithrequiredfile/post/requestbody/content/multipartformdata/MultipartformdataSchema.md b/samples/client/petstore/kotlin/docs/paths/fakepetiduploadimagewithrequiredfile/post/requestbody/content/multipartformdata/MultipartformdataSchema.md new file mode 100644 index 00000000000..180e48073aa --- /dev/null +++ b/samples/client/petstore/kotlin/docs/paths/fakepetiduploadimagewithrequiredfile/post/requestbody/content/multipartformdata/MultipartformdataSchema.md @@ -0,0 +1,206 @@ +# MultipartformdataSchema +public class MultipartformdataSchema
+ +A class that contains necessary nested +- schema classes (which validate payloads), extends JsonSchema +- sealed interfaces which store validated payloads, java version of a sum type +- boxed classes which store validated payloads, sealed permits class implementations +- classes to store validated map payloads, extends FrozenMap +- classes to build inputs for map payloads + +## Nested Class Summary +| Modifier and Type | Class and Description | +| ----------------- | ---------------------- | +| sealed interface | [MultipartformdataSchema.MultipartformdataSchema1Boxed](#multipartformdataschema1boxed)
sealed interface for validated payloads | +| record | [MultipartformdataSchema.MultipartformdataSchema1BoxedMap](#multipartformdataschema1boxedmap)
boxed class to store validated Map payloads | +| static class | [MultipartformdataSchema.MultipartformdataSchema1](#multipartformdataschema1)
schema class | +| static class | [MultipartformdataSchema.MultipartformdataSchemaMapBuilder](#multipartformdataschemamapbuilder)
builder for Map payloads | +| static class | [MultipartformdataSchema.MultipartformdataSchemaMap](#multipartformdataschemamap)
output class for Map payloads | +| sealed interface | [MultipartformdataSchema.MultipartformdataRequiredFileBoxed](#multipartformdatarequiredfileboxed)
sealed interface for validated payloads | +| static class | [MultipartformdataSchema.MultipartformdataRequiredFile](#multipartformdatarequiredfile)
schema class | +| sealed interface | [MultipartformdataSchema.MultipartformdataAdditionalMetadataBoxed](#multipartformdataadditionalmetadataboxed)
sealed interface for validated payloads | +| record | [MultipartformdataSchema.MultipartformdataAdditionalMetadataBoxedString](#multipartformdataadditionalmetadataboxedstring)
boxed class to store validated String payloads | +| static class | [MultipartformdataSchema.MultipartformdataAdditionalMetadata](#multipartformdataadditionalmetadata)
schema class | + +## MultipartformdataSchema1Boxed +public sealed interface MultipartformdataSchema1Boxed
+permits
+[MultipartformdataSchema1BoxedMap](#multipartformdataschema1boxedmap) + +sealed interface that stores validated payloads using boxed classes + +## MultipartformdataSchema1BoxedMap +public record MultipartformdataSchema1BoxedMap
+implements [MultipartformdataSchema1Boxed](#multipartformdataschema1boxed) + +record that stores validated Map payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| MultipartformdataSchema1BoxedMap([MultipartformdataSchemaMap](#multipartformdataschemamap) data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| [MultipartformdataSchemaMap](#multipartformdataschemamap) | data()
validated payload | +| @Nullable Object | getData()
validated payload | + +## MultipartformdataSchema1 +public static class MultipartformdataSchema1
+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.fakepetiduploadimagewithrequiredfile.post.requestbody.content.multipartformdata.MultipartformdataSchema; + +import java.util.Arrays; +import java.util.List; +import java.util.AbstractMap; + +static final SchemaConfiguration configuration = new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().build()); + +// Map validation +MultipartformdataSchema.MultipartformdataSchemaMap validatedPayload = + MultipartformdataSchema.MultipartformdataSchema1.validate( + new MultipartformdataSchema.MultipartformdataSchemaMapBuilder() + .requiredFile("a") + + .additionalMetadata("a") + + .build(), + configuration +); +``` + +### Field Summary +| Modifier and Type | Field and Description | +| ----------------- | ---------------------- | +| Set> | type = Set.of(Map.class) | +| Map> | properties = Map.ofEntries(
    new PropertyEntry("additionalMetadata", [MultipartformdataAdditionalMetadata.class](#multipartformdataadditionalmetadata))),
    new PropertyEntry("requiredFile", [MultipartformdataRequiredFile.class](#multipartformdatarequiredfile)))
)
| +| Set | required = Set.of(
    "requiredFile"
)
| + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| [MultipartformdataSchemaMap](#multipartformdataschemamap) | validate([Map<?, ?>](#multipartformdataschemamapbuilder) arg, SchemaConfiguration configuration) | +| [MultipartformdataSchema1BoxedMap](#multipartformdataschema1boxedmap) | validateAndBox([Map<?, ?>](#multipartformdataschemamapbuilder) arg, SchemaConfiguration configuration) | +| [MultipartformdataSchema1Boxed](#multipartformdataschema1boxed) | validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) | +| @Nullable Object | validate(@Nullable Object arg, SchemaConfiguration configuration) | + +## MultipartformdataSchemaMap0Builder +public class MultipartformdataSchemaMap0Builder
+builder for `Map` + +A class that builds the Map input type + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| MultipartformdataSchemaMap0Builder(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 | +| [MultipartformdataSchemaMap0Builder](#multipartformdataschemamap0builder) | additionalMetadata(String value) | +| [MultipartformdataSchemaMap0Builder](#multipartformdataschemamap0builder) | additionalProperty(String key, Nothing? value) | +| [MultipartformdataSchemaMap0Builder](#multipartformdataschemamap0builder) | additionalProperty(String key, boolean value) | +| [MultipartformdataSchemaMap0Builder](#multipartformdataschemamap0builder) | additionalProperty(String key, String value) | +| [MultipartformdataSchemaMap0Builder](#multipartformdataschemamap0builder) | additionalProperty(String key, int value) | +| [MultipartformdataSchemaMap0Builder](#multipartformdataschemamap0builder) | additionalProperty(String key, float value) | +| [MultipartformdataSchemaMap0Builder](#multipartformdataschemamap0builder) | additionalProperty(String key, long value) | +| [MultipartformdataSchemaMap0Builder](#multipartformdataschemamap0builder) | additionalProperty(String key, double value) | +| [MultipartformdataSchemaMap0Builder](#multipartformdataschemamap0builder) | additionalProperty(String key, List value) | +| [MultipartformdataSchemaMap0Builder](#multipartformdataschemamap0builder) | additionalProperty(String key, Map value) | + +## MultipartformdataSchemaMapBuilder +public class MultipartformdataSchemaMapBuilder
+builder for `Map` + +A class that builds the Map input type + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| MultipartformdataSchemaMapBuilder()
Creates a builder that contains an empty map | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| [MultipartformdataSchemaMap0Builder](#multipartformdataschemamap0builder) | requiredFile(String value) | + +## MultipartformdataSchemaMap +public static class MultipartformdataSchemaMap
+extends FrozenMap + +A class to store validated Map payloads + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| static [MultipartformdataSchemaMap](#multipartformdataschemamap) | of([Map](#multipartformdataschemamapbuilder) arg, SchemaConfiguration configuration) | +| String | requiredFile()
| +| String | additionalMetadata()
[optional] | +| @Nullable Object | getAdditionalProperty(String name)
provides type safety for additional properties | + +## MultipartformdataRequiredFileBoxed +public sealed interface MultipartformdataRequiredFileBoxed
+permits
+ +sealed interface that stores validated payloads using boxed classes + +## MultipartformdataRequiredFile +public static class MultipartformdataRequiredFile
+extends JsonSchema + +A schema class that validates payloads + +## Description +file to upload + +## MultipartformdataAdditionalMetadataBoxed +public sealed interface MultipartformdataAdditionalMetadataBoxed
+permits
+[MultipartformdataAdditionalMetadataBoxedString](#multipartformdataadditionalmetadataboxedstring) + +sealed interface that stores validated payloads using boxed classes + +## MultipartformdataAdditionalMetadataBoxedString +public record MultipartformdataAdditionalMetadataBoxedString
+implements [MultipartformdataAdditionalMetadataBoxed](#multipartformdataadditionalmetadataboxed) + +record that stores validated String payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| MultipartformdataAdditionalMetadataBoxedString(String data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| String | data()
validated payload | +| @Nullable Object | getData()
validated payload | + +## MultipartformdataAdditionalMetadata +public static class MultipartformdataAdditionalMetadata
+extends StringJsonSchema.StringJsonSchema1 + +A schema class that validates payloads + +## Description +Additional data to pass to server + +| Methods Inherited from class org.openapijsonschematools.client.schemas.StringJsonSchema.StringJsonSchema1 | +| ------------------------------------------------------------------ | +| validate | +| validateAndBox | diff --git a/samples/client/petstore/kotlin/docs/paths/fakepetiduploadimagewithrequiredfile/post/responses/FakepetiduploadimagewithrequiredfilePostCode200Response.md b/samples/client/petstore/kotlin/docs/paths/fakepetiduploadimagewithrequiredfile/post/responses/FakepetiduploadimagewithrequiredfilePostCode200Response.md new file mode 100644 index 00000000000..72c77fc7a61 --- /dev/null +++ b/samples/client/petstore/kotlin/docs/paths/fakepetiduploadimagewithrequiredfile/post/responses/FakepetiduploadimagewithrequiredfilePostCode200Response.md @@ -0,0 +1,87 @@ +# FakepetiduploadimagewithrequiredfilePostCode200Response + +public class FakepetiduploadimagewithrequiredfilePostCode200Response + +A class that contains necessary nested response classes +- SealedMediaType, a sealed interface which contains all the schema/encoding info for each contentType +- records which implement SealedMediaType, the concrete media types +- SealedResponseBody, a sealed interface which contains all the contentType/schema types +- records which implement SealedResponseBody, the concrete response body types +- a class that extends ResponseDeserializer and is used to deserialize responses + +## Nested Class Summary +| Modifier and Type | Class and Description | +| ----------------- | --------------------- | +| sealed interface | [FakepetiduploadimagewithrequiredfilePostCode200Response.SealedMediaType](#sealedmediatype)
media type sealed interface | +| record | [FakepetiduploadimagewithrequiredfilePostCode200Response.ApplicationjsonMediaType](#applicationjsonmediatype)
record storing schema + encoding for a specific contentType | +| sealed interface | [FakepetiduploadimagewithrequiredfilePostCode200Response.SealedResponseBody](#sealedresponsebody)
response body sealed interface | +| record | [FakepetiduploadimagewithrequiredfilePostCode200Response.ApplicationjsonResponseBody](#applicationjsonresponsebody)
implements sealed interface to store response body | +| static class | [FakepetiduploadimagewithrequiredfilePostCode200Response.FakepetiduploadimagewithrequiredfilePostCode200Response1](#fakepetiduploadimagewithrequiredfilepostcode200response1)
class that deserializes responses | + +## SealedMediaType +public sealed interface SealedMediaType
+permits
+[ApplicationjsonMediaType](#applicationjsonmediatype) + +sealed interface that stores schema and encoding info + +## ApplicationjsonMediaType +public record ApplicationjsonMediaType
+implements [SealedMediaType](#sealedmediatype), MediaType<[ApplicationjsonSchema.ApplicationjsonSchema1](../../../../paths/fakepetiduploadimagewithrequiredfile/post/responses/code200response/content/applicationjson/ApplicationjsonSchema.md#applicationjsonschema1), Nothing?> + +class storing schema info for a specific contentType + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| ApplicationjsonMediaType()
Creates an instance | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| [ApplicationjsonSchema.ApplicationjsonSchema1](../../../../paths/fakepetiduploadimagewithrequiredfile/post/responses/code200response/content/applicationjson/ApplicationjsonSchema.md#applicationjsonschema1) | schema()
the schema for this MediaType | +| Nothing? | encoding()
the encoding info | + +## SealedResponseBody +public sealed interface SealedResponseBody
+permits
+[ApplicationjsonResponseBody](#applicationjsonresponsebody) + +sealed interface that stores response body + +## ApplicationjsonResponseBody +public record ApplicationjsonResponseBody
+implements [SealedResponseBody](#sealedresponsebody) + +A record class to store response body for contentType="application/json" + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| ApplicationjsonResponseBody(ApplicationjsonSchema.[ApiResponseSchema1Boxed](../../../../components/schemas/ApiResponseSchema.md#apiresponseschema1boxed) body)
Creates an instance | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| ApplicationjsonSchema.[ApiResponseSchema1Boxed](../../../../components/schemas/ApiResponseSchema.md#apiresponseschema1boxed) | body()
returns the body passed in in the constructor | + +## FakepetiduploadimagewithrequiredfilePostCode200Response1 +public static class FakepetiduploadimagewithrequiredfilePostCode200Response1
+extends ResponseDeserializer<[SealedResponseBody](#sealedresponsebody), Nothing?, [SealedMediaType](#sealedmediatype)> + +a class that deserializes responses + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| FakepetiduploadimagewithrequiredfilePostCode200Response1()
Creates an instance | + +### Field Summary +| Modifier and Type | Field and Description | +| ----------------- | --------------------- | +| 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 | +| ----------------- | ---------------------- | +| ApiResponse<[SealedResponseBody](#sealedresponsebody), Nothing?> | deserialize(HttpResponse response, SchemaConfiguration configuration)
called by endpoint when deserialize responses | diff --git a/samples/client/petstore/kotlin/docs/paths/fakepetiduploadimagewithrequiredfile/post/responses/code200response/content/applicationjson/ApplicationjsonSchema.md b/samples/client/petstore/kotlin/docs/paths/fakepetiduploadimagewithrequiredfile/post/responses/code200response/content/applicationjson/ApplicationjsonSchema.md new file mode 100644 index 00000000000..bb60c5776fb --- /dev/null +++ b/samples/client/petstore/kotlin/docs/paths/fakepetiduploadimagewithrequiredfile/post/responses/code200response/content/applicationjson/ApplicationjsonSchema.md @@ -0,0 +1,19 @@ +# ApplicationjsonSchema +public class ApplicationjsonSchema
+extends [ApiResponseSchema1](../../../../../../../components/schemas/ApiResponseSchema.md#apiresponseschema) + +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 + +## Nested Class Summary +| Modifier and Type | Class and Description | +| ----------------- | ---------------------- | +| static class | [ApplicationjsonSchema.ApplicationjsonSchema1](#applicationjsonschema1)
schema class | + +## ApplicationjsonSchema1 +public static class ApplicationjsonSchema1
+extends [ApiResponseSchema.ApiResponseSchema1](../../../../../../../components/schemas/ApiResponseSchema.md#apiresponseschema1) + +A schema class that validates payloads diff --git a/samples/client/petstore/kotlin/docs/paths/fakepetiduploadimagewithrequiredfile/post/security/FakepetiduploadimagewithrequiredfilePostSecurityRequirementObject0.md b/samples/client/petstore/kotlin/docs/paths/fakepetiduploadimagewithrequiredfile/post/security/FakepetiduploadimagewithrequiredfilePostSecurityRequirementObject0.md new file mode 100644 index 00000000000..3e58c101d48 --- /dev/null +++ b/samples/client/petstore/kotlin/docs/paths/fakepetiduploadimagewithrequiredfile/post/security/FakepetiduploadimagewithrequiredfilePostSecurityRequirementObject0.md @@ -0,0 +1,15 @@ +# FakepetiduploadimagewithrequiredfilePostSecurityRequirementObject0 +FakepetiduploadimagewithrequiredfilePostSecurityRequirementObject0.java + +public class FakepetiduploadimagewithrequiredfilePostSecurityRequirementObject0 +extends SecurityRequirementObject + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| FakepetiduploadimagewithrequiredfilePostSecurityRequirementObject0()
Creates an instance | + +### 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")
    )) | diff --git a/samples/client/petstore/kotlin/docs/paths/fakequeryparamwithjsoncontenttype/FakequeryparamwithjsoncontenttypeGet.md b/samples/client/petstore/kotlin/docs/paths/fakequeryparamwithjsoncontenttype/FakequeryparamwithjsoncontenttypeGet.md new file mode 100644 index 00000000000..7371ae8d0dc --- /dev/null +++ b/samples/client/petstore/kotlin/docs/paths/fakequeryparamwithjsoncontenttype/FakequeryparamwithjsoncontenttypeGet.md @@ -0,0 +1,185 @@ +# FakequeryparamwithjsoncontenttypeGet + +public class FakequeryparamwithjsoncontenttypeGet + +A class that contains necessary endpoint classes +- a class that calls the endpoint method using the http verb +- a class that calls the endpoint method using the operationId name +- class(es) to store the request inputs +- builder(s) to set the request input data + +## Nested Class Summary +| Modifier and Type | Class and Description | +| ----------------- | --------------------- | +| static class | [Get](#get)
The class that has a get method to call the endpoint | +| interface | [QueryParamWithJsonContentTypeOperation](#queryparamwithjsoncontenttypeoperation)
The interface that has a queryParamWithJsonContentType method to call the endpoint | +| static class | [GetRequest](#getrequest)
The final request inputs class | +| static class | [GetNullableRequest](#getnullablerequest)
The initial request inputs class | +| static class | [Get0RequestBuilder](#get0requestbuilder)
A builder for the request input class | +| static class | [GetRequestBuilder](#getrequestbuilder)
A builder for the request input class | + +## Get +public static class Get extends ApiClient.ApiClient1 implements GetOperation
+ +a class that allows one to call the endpoint using a method named get + +### 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.fakequeryparamwithjsoncontenttype.get.FakequeryparamwithjsoncontenttypeGetQueryParameters; +import org.openapijsonschematools.client.servers.RootServer0; +import org.openapijsonschematools.client.servers.RootServer1; +import org.openapijsonschematools.client.servers.RootServer2; +import org.openapijsonschematools.client.paths.fakequeryparamwithjsoncontenttype.get.responses.FakequeryparamwithjsoncontenttypeGetCode200Response; +import org.openapijsonschematools.client.servers.RootServerInfo; +import org.openapijsonschematools.client.paths.fakequeryparamwithjsoncontenttype.FakequeryparamwithjsoncontenttypeGet; +import org.openapijsonschematools.client.paths.fakequeryparamwithjsoncontenttype.get.FakequeryparamwithjsoncontenttypeGetResponses; + +import java.io.IOException; +import java.util.Arrays; +import java.util.List; +import java.util.Map; +import java.util.AbstractMap; + +// if you want to use a server that is not SERVER_0 pass it in here and change the ServerIndex input below +ApiConfiguration.ServerInfo serverInfo = new ApiConfiguration.ServerInfoBuilder() + .rootServerInfo( + new RootServerInfo.RootServerInfoBuilder() + .rootServer0(new RootServer0()) + .build() + ) + .build(); +ApiConfiguration.ServerIndexInfo serverIndexInfo = new ApiConfiguration.ServerIndexInfoBuilder() + .rootServerInfoServerIndex(RootServerInfo.ServerIndex.SERVER_0) + .build(); +Duration timeout = Duration.ofSeconds(1L); +Map> defaultHeaders = Map.of("User-Agent", List.of("OpenAPI-JSON-Schema-Generator/1.0.0/java")); +ApiConfiguration apiConfiguration = new ApiConfiguration( + serverInfo + serverIndexInfo, + timeout, + defaultHeaders +); +SchemaConfiguration schemaConfiguration = new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().build()); +FakequeryparamwithjsoncontenttypeGet.Get apiClient = new FakequeryparamwithjsoncontenttypeGet.Get(apiConfiguration, schemaConfiguration); + + +// Map validation +FakequeryparamwithjsoncontenttypeGetQueryParameters.QueryParametersMap queryParameters = + FakequeryparamwithjsoncontenttypeGetQueryParameters.FakequeryparamwithjsoncontenttypeGetQueryParameters1.validate( + new FakequeryparamwithjsoncontenttypeGetQueryParameters.QueryParametersMapBuilder() + .build(), + schemaConfiguration +); + +var request = new FakequeryparamwithjsoncontenttypeGet.GetRequestBuilder() + .queryParameters(queryParameters) + .build(); + +FakequeryparamwithjsoncontenttypeGetResponses.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; +} +FakequeryparamwithjsoncontenttypeGetResponses.EndpointFakequeryparamwithjsoncontenttypeGetCode200Response castResponse = (FakequeryparamwithjsoncontenttypeGetResponses.EndpointFakequeryparamwithjsoncontenttypeGetCode200Response) response; +FakequeryparamwithjsoncontenttypeGetCode200Response.ApplicationjsonResponseBody deserializedBody = (FakequeryparamwithjsoncontenttypeGetCode200Response.ApplicationjsonResponseBody) castResponse.body; +// handle deserialized body here +``` +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| Get(ApiConfiguration apiConfiguration, SchemaConfiguration schemaConfiguration)
Creates an instance | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| [FakequeryparamwithjsoncontenttypeGetResponses.EndpointResponse](../../paths/fakequeryparamwithjsoncontenttype/get/FakequeryparamwithjsoncontenttypeGetResponses.md#endpointresponse) | get([GetRequest](#getrequest) request) | + +## QueryParamWithJsonContentTypeOperation +public interface QueryParamWithJsonContentTypeOperation
+ +an interface that allows one to call the endpoint using a method named queryParamWithJsonContentType by the operationId + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| [FakequeryparamwithjsoncontenttypeGetResponses.EndpointResponse](../../paths/fakequeryparamwithjsoncontenttype/get/FakequeryparamwithjsoncontenttypeGetResponses.md#endpointresponse) | queryParamWithJsonContentType([GetRequest](#getrequest) request) | + +## GetRequest +public static class GetRequest
+ +a class that stores the final request inputs + +### Field Summary +| Modifier and Type | Field and Description | +| ----------------- | --------------------- | +| [FakequeryparamwithjsoncontenttypeGetQueryParameters.QueryParametersMap](../../paths/fakequeryparamwithjsoncontenttype/get/FakequeryparamwithjsoncontenttypeGetQueryParameters.md#queryparametersmap) | queryParameters | +| [RootServerInfo.@Nullable ServerIndex](../../RootServerInfo.md#serverindex) | serverIndex
optional. Note: this will override the value in apiConfiguration | +| @Nullable Duration | timeout
optional. Note: this will override the value in apiConfiguration | + +## GetNullableRequest +public static class GetNullableRequest
+ +a class that stores the initial request inputs + +### Field Summary +| Modifier and Type | Field and Description | +| ----------------- | --------------------- | +| [FakequeryparamwithjsoncontenttypeGetQueryParameters.@Nullable QueryParametersMap](../../paths/fakequeryparamwithjsoncontenttype/get/FakequeryparamwithjsoncontenttypeGetQueryParameters.md#queryparametersmap) | queryParameters | +| [RootServerInfo.@Nullable ServerIndex](../../RootServerInfo.md#serverindex) | serverIndex | +| @Nullable Duration | timeout | + +## Get0RequestBuilder +public static class Get0RequestBuilder
+ +a builder for request inputs + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| Get0RequestBuilder(Get0RequestBuilder instance)
Creates a builder that contains the passed instance | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| [GetRequest](#getrequest) | build()
Returns the request input used to call an endpoint method | +| [Get0RequestBuilder](#get0requestbuilder) | serverIndex([RootServerInfo.ServerIndex](../../RootServerInfo.md#serverindex) serverIndex)
sets the optional property. Note: this will override the value in apiConfiguration | +| [Get0RequestBuilder](#get0requestbuilder) | timeout(Duration timeout)
sets the optional property. Note: this will override the value in apiConfiguration | + +## GetRequestBuilder +public static class GetRequestBuilder
+ +a builder for request inputs + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| GetRequestBuilder()
Creates a builder that contains null for all parameters | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| [Get0RequestBuilder](#get0requestbuilder) | queryParameters([FakequeryparamwithjsoncontenttypeGetQueryParametersQueryParametersMap](../../paths/fakequeryparamwithjsoncontenttype/get/FakequeryparamwithjsoncontenttypeGetQueryParameters.md#queryparametersmap) queryParameters)
sets the property | + +[[Back to top]](#top) [[Back to README]](../../../README.md) diff --git a/samples/client/petstore/kotlin/docs/paths/fakequeryparamwithjsoncontenttype/get/FakequeryparamwithjsoncontenttypeGetQueryParameters.md b/samples/client/petstore/kotlin/docs/paths/fakequeryparamwithjsoncontenttype/get/FakequeryparamwithjsoncontenttypeGetQueryParameters.md new file mode 100644 index 00000000000..d846ab685ae --- /dev/null +++ b/samples/client/petstore/kotlin/docs/paths/fakequeryparamwithjsoncontenttype/get/FakequeryparamwithjsoncontenttypeGetQueryParameters.md @@ -0,0 +1,274 @@ +# FakequeryparamwithjsoncontenttypeGetQueryParameters +public class FakequeryparamwithjsoncontenttypeGetQueryParameters
+ +A class that contains necessary nested +- schema classes (which validate payloads), extends JsonSchema +- sealed interfaces which store validated payloads, java version of a sum type +- boxed classes which store validated payloads, sealed permits class implementations +- classes to store validated map payloads, extends FrozenMap +- classes to build inputs for map payloads + +## Nested Class Summary +| Modifier and Type | Class and Description | +| ----------------- | ---------------------- | +| sealed interface | [FakequeryparamwithjsoncontenttypeGetQueryParameters.FakequeryparamwithjsoncontenttypeGetQueryParameters1Boxed](#fakequeryparamwithjsoncontenttypegetqueryparameters1boxed)
sealed interface for validated payloads | +| record | [FakequeryparamwithjsoncontenttypeGetQueryParameters.FakequeryparamwithjsoncontenttypeGetQueryParameters1BoxedMap](#fakequeryparamwithjsoncontenttypegetqueryparameters1boxedmap)
boxed class to store validated Map payloads | +| static class | [FakequeryparamwithjsoncontenttypeGetQueryParameters.FakequeryparamwithjsoncontenttypeGetQueryParameters1](#fakequeryparamwithjsoncontenttypegetqueryparameters1)
schema class | +| static class | [FakequeryparamwithjsoncontenttypeGetQueryParameters.QueryParametersMapBuilder](#queryparametersmapbuilder)
builder for Map payloads | +| static class | [FakequeryparamwithjsoncontenttypeGetQueryParameters.QueryParametersMap](#queryparametersmap)
output class for Map payloads | +| sealed interface | [FakequeryparamwithjsoncontenttypeGetQueryParameters.AdditionalPropertiesBoxed](#additionalpropertiesboxed)
sealed interface for validated payloads | +| record | [FakequeryparamwithjsoncontenttypeGetQueryParameters.AdditionalPropertiesBoxedVoid](#additionalpropertiesboxedvoid)
boxed class to store validated null payloads | +| record | [FakequeryparamwithjsoncontenttypeGetQueryParameters.AdditionalPropertiesBoxedBoolean](#additionalpropertiesboxedboolean)
boxed class to store validated boolean payloads | +| record | [FakequeryparamwithjsoncontenttypeGetQueryParameters.AdditionalPropertiesBoxedNumber](#additionalpropertiesboxednumber)
boxed class to store validated Number payloads | +| record | [FakequeryparamwithjsoncontenttypeGetQueryParameters.AdditionalPropertiesBoxedString](#additionalpropertiesboxedstring)
boxed class to store validated String payloads | +| record | [FakequeryparamwithjsoncontenttypeGetQueryParameters.AdditionalPropertiesBoxedList](#additionalpropertiesboxedlist)
boxed class to store validated List payloads | +| record | [FakequeryparamwithjsoncontenttypeGetQueryParameters.AdditionalPropertiesBoxedMap](#additionalpropertiesboxedmap)
boxed class to store validated Map payloads | +| static class | [FakequeryparamwithjsoncontenttypeGetQueryParameters.AdditionalProperties](#additionalproperties)
schema class | + +## FakequeryparamwithjsoncontenttypeGetQueryParameters1Boxed +public sealed interface FakequeryparamwithjsoncontenttypeGetQueryParameters1Boxed
+permits
+[FakequeryparamwithjsoncontenttypeGetQueryParameters1BoxedMap](#fakequeryparamwithjsoncontenttypegetqueryparameters1boxedmap) + +sealed interface that stores validated payloads using boxed classes + +## FakequeryparamwithjsoncontenttypeGetQueryParameters1BoxedMap +public record FakequeryparamwithjsoncontenttypeGetQueryParameters1BoxedMap
+implements [FakequeryparamwithjsoncontenttypeGetQueryParameters1Boxed](#fakequeryparamwithjsoncontenttypegetqueryparameters1boxed) + +record that stores validated Map payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| FakequeryparamwithjsoncontenttypeGetQueryParameters1BoxedMap([QueryParametersMap](#queryparametersmap) data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| [QueryParametersMap](#queryparametersmap) | data()
validated payload | +| @Nullable Object | getData()
validated payload | + +## FakequeryparamwithjsoncontenttypeGetQueryParameters1 +public static class FakequeryparamwithjsoncontenttypeGetQueryParameters1
+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.fakequeryparamwithjsoncontenttype.get.FakequeryparamwithjsoncontenttypeGetQueryParameters; + +import java.util.Arrays; +import java.util.List; +import java.util.AbstractMap; + +static final SchemaConfiguration configuration = new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().build()); + +// Map validation +FakequeryparamwithjsoncontenttypeGetQueryParameters.QueryParametersMap validatedPayload = + FakequeryparamwithjsoncontenttypeGetQueryParameters.FakequeryparamwithjsoncontenttypeGetQueryParameters1.validate( + new FakequeryparamwithjsoncontenttypeGetQueryParameters.QueryParametersMapBuilder() + .build(), + configuration +); +``` + +### Field Summary +| Modifier and Type | Field and Description | +| ----------------- | ---------------------- | +| Set> | type = Set.of(Map.class) | +| Map> | properties = Map.ofEntries(
    new PropertyEntry("someParam", [Schema0.Schema01.class](../../../paths/fakequeryparamwithjsoncontenttype/get/parameters/parameter0/content/applicationjson/Schema0.md#schema01))
)
| +| Set | required = Set.of(
    "someParam"
)
| +| Class | additionalProperties = [AdditionalProperties.class](#additionalproperties) | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| [QueryParametersMap](#queryparametersmap) | validate([Map<?, ?>](#queryparametersmapbuilder) arg, SchemaConfiguration configuration) | +| [FakequeryparamwithjsoncontenttypeGetQueryParameters1BoxedMap](#fakequeryparamwithjsoncontenttypegetqueryparameters1boxedmap) | validateAndBox([Map<?, ?>](#queryparametersmapbuilder) arg, SchemaConfiguration configuration) | +| [FakequeryparamwithjsoncontenttypeGetQueryParameters1Boxed](#fakequeryparamwithjsoncontenttypegetqueryparameters1boxed) | validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) | +| @Nullable Object | validate(@Nullable Object arg, SchemaConfiguration configuration) | + +## QueryParametersMap0Builder +public class QueryParametersMap0Builder
+builder for `Map` + +A class that builds the Map input type + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| QueryParametersMap0Builder(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 | + +## QueryParametersMapBuilder +public class QueryParametersMapBuilder
+builder for `Map` + +A class that builds the Map input type + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| QueryParametersMapBuilder()
Creates a builder that contains an empty map | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| [QueryParametersMap0Builder](#queryparametersmap0builder) | someParam(Nothing? value) | +| [QueryParametersMap0Builder](#queryparametersmap0builder) | someParam(boolean value) | +| [QueryParametersMap0Builder](#queryparametersmap0builder) | someParam(String value) | +| [QueryParametersMap0Builder](#queryparametersmap0builder) | someParam(int value) | +| [QueryParametersMap0Builder](#queryparametersmap0builder) | someParam(float value) | +| [QueryParametersMap0Builder](#queryparametersmap0builder) | someParam(long value) | +| [QueryParametersMap0Builder](#queryparametersmap0builder) | someParam(double value) | +| [QueryParametersMap0Builder](#queryparametersmap0builder) | someParam(List value) | +| [QueryParametersMap0Builder](#queryparametersmap0builder) | someParam(Map value) | + +## QueryParametersMap +public static class QueryParametersMap
+extends FrozenMap + +A class to store validated Map payloads + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| static [QueryParametersMap](#queryparametersmap) | of([Map](#queryparametersmapbuilder) arg, SchemaConfiguration configuration) | +| @Nullable Object | someParam()
| + +## 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(Nothing? data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| Nothing? | 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/kotlin/docs/paths/fakequeryparamwithjsoncontenttype/get/FakequeryparamwithjsoncontenttypeGetResponses.md b/samples/client/petstore/kotlin/docs/paths/fakequeryparamwithjsoncontenttype/get/FakequeryparamwithjsoncontenttypeGetResponses.md new file mode 100644 index 00000000000..ba1b35aa4ef --- /dev/null +++ b/samples/client/petstore/kotlin/docs/paths/fakequeryparamwithjsoncontenttype/get/FakequeryparamwithjsoncontenttypeGetResponses.md @@ -0,0 +1,29 @@ +# FakequeryparamwithjsoncontenttypeGetResponses + +public class FakequeryparamwithjsoncontenttypeGetResponses + +A class that contains necessary responses classes +- a sealed interface, EndpointResponse, that stores endpoint responses +- records for each endpoint response + +## Nested Class Summary +| Modifier and Type | Class and Description | +| ----------------- | --------------------- | +| sealed interface | [EndpointResponse](#endpointresponse)
stores the endpoint responses | +| record | [EndpointFakequeryparamwithjsoncontenttypeGetCode200Response](#endpointfakequeryparamwithjsoncontenttypegetcode200response)
the response for 200 | + +## EndpointResponse +public sealed interface EndpointResponse permits
+[EndpointFakequeryparamwithjsoncontenttypeGetCode200Response](#endpointfakequeryparamwithjsoncontenttypegetcode200response) + +a sealed interface that stores endpoint responses + +## EndpointFakequeryparamwithjsoncontenttypeGetCode200Response +public record EndpointFakequeryparamwithjsoncontenttypeGetCode200Response( + HttpResponse response, + [FakequeryparamwithjsoncontenttypeGetCode200Response.SealedResponseBody](../../../paths/fakequeryparamwithjsoncontenttype/get/responses/FakequeryparamwithjsoncontenttypeGetCode200Response.md#sealedresponsebody) body, + Nothing? headers +) implements EndpointResponse, ApiResponse
+ +a class that stores an endpoint response + diff --git a/samples/client/petstore/kotlin/docs/paths/fakequeryparamwithjsoncontenttype/get/parameters/parameter0/content/applicationjson/Schema0.md b/samples/client/petstore/kotlin/docs/paths/fakequeryparamwithjsoncontenttype/get/parameters/parameter0/content/applicationjson/Schema0.md new file mode 100644 index 00000000000..9cf0dc4f86c --- /dev/null +++ b/samples/client/petstore/kotlin/docs/paths/fakequeryparamwithjsoncontenttype/get/parameters/parameter0/content/applicationjson/Schema0.md @@ -0,0 +1,144 @@ +# Schema0 +public class Schema0
+ +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 + +## Nested Class Summary +| Modifier and Type | Class and Description | +| ----------------- | ---------------------- | +| sealed interface | [Schema0.Schema01Boxed](#schema01boxed)
sealed interface for validated payloads | +| record | [Schema0.Schema01BoxedVoid](#schema01boxedvoid)
boxed class to store validated null payloads | +| record | [Schema0.Schema01BoxedBoolean](#schema01boxedboolean)
boxed class to store validated boolean payloads | +| record | [Schema0.Schema01BoxedNumber](#schema01boxednumber)
boxed class to store validated Number payloads | +| record | [Schema0.Schema01BoxedString](#schema01boxedstring)
boxed class to store validated String payloads | +| record | [Schema0.Schema01BoxedList](#schema01boxedlist)
boxed class to store validated List payloads | +| record | [Schema0.Schema01BoxedMap](#schema01boxedmap)
boxed class to store validated Map payloads | +| static class | [Schema0.Schema01](#schema01)
schema class | + +## Schema01Boxed +public sealed interface Schema01Boxed
+permits
+[Schema01BoxedVoid](#schema01boxedvoid), +[Schema01BoxedBoolean](#schema01boxedboolean), +[Schema01BoxedNumber](#schema01boxednumber), +[Schema01BoxedString](#schema01boxedstring), +[Schema01BoxedList](#schema01boxedlist), +[Schema01BoxedMap](#schema01boxedmap) + +sealed interface that stores validated payloads using boxed classes + +## Schema01BoxedVoid +public record Schema01BoxedVoid
+implements [Schema01Boxed](#schema01boxed) + +record that stores validated null payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| Schema01BoxedVoid(Nothing? data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| Nothing? | data()
validated payload | +| @Nullable Object | getData()
validated payload | + +## Schema01BoxedBoolean +public record Schema01BoxedBoolean
+implements [Schema01Boxed](#schema01boxed) + +record that stores validated boolean payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| Schema01BoxedBoolean(boolean data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| boolean | data()
validated payload | +| @Nullable Object | getData()
validated payload | + +## Schema01BoxedNumber +public record Schema01BoxedNumber
+implements [Schema01Boxed](#schema01boxed) + +record that stores validated Number payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| Schema01BoxedNumber(Number data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| Number | data()
validated payload | +| @Nullable Object | getData()
validated payload | + +## Schema01BoxedString +public record Schema01BoxedString
+implements [Schema01Boxed](#schema01boxed) + +record that stores validated String payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| Schema01BoxedString(String data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| String | data()
validated payload | +| @Nullable Object | getData()
validated payload | + +## Schema01BoxedList +public record Schema01BoxedList
+implements [Schema01Boxed](#schema01boxed) + +record that stores validated List payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| Schema01BoxedList(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 | + +## Schema01BoxedMap +public record Schema01BoxedMap
+implements [Schema01Boxed](#schema01boxed) + +record that stores validated Map payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| Schema01BoxedMap(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 | + +## Schema01 +public static class Schema01
+extends AnyTypeJsonSchema.AnyTypeJsonSchema1 + +A schema class that validates payloads + +| Methods Inherited from class org.openapijsonschematools.client.schemas.AnyTypeJsonSchema.AnyTypeJsonSchema1 | +| ------------------------------------------------------------------ | +| validate | +| validateAndBox | diff --git a/samples/client/petstore/kotlin/docs/paths/fakequeryparamwithjsoncontenttype/get/responses/FakequeryparamwithjsoncontenttypeGetCode200Response.md b/samples/client/petstore/kotlin/docs/paths/fakequeryparamwithjsoncontenttype/get/responses/FakequeryparamwithjsoncontenttypeGetCode200Response.md new file mode 100644 index 00000000000..f1bc0044a76 --- /dev/null +++ b/samples/client/petstore/kotlin/docs/paths/fakequeryparamwithjsoncontenttype/get/responses/FakequeryparamwithjsoncontenttypeGetCode200Response.md @@ -0,0 +1,87 @@ +# FakequeryparamwithjsoncontenttypeGetCode200Response + +public class FakequeryparamwithjsoncontenttypeGetCode200Response + +A class that contains necessary nested response classes +- SealedMediaType, a sealed interface which contains all the schema/encoding info for each contentType +- records which implement SealedMediaType, the concrete media types +- SealedResponseBody, a sealed interface which contains all the contentType/schema types +- records which implement SealedResponseBody, the concrete response body types +- a class that extends ResponseDeserializer and is used to deserialize responses + +## Nested Class Summary +| Modifier and Type | Class and Description | +| ----------------- | --------------------- | +| sealed interface | [FakequeryparamwithjsoncontenttypeGetCode200Response.SealedMediaType](#sealedmediatype)
media type sealed interface | +| record | [FakequeryparamwithjsoncontenttypeGetCode200Response.ApplicationjsonMediaType](#applicationjsonmediatype)
record storing schema + encoding for a specific contentType | +| sealed interface | [FakequeryparamwithjsoncontenttypeGetCode200Response.SealedResponseBody](#sealedresponsebody)
response body sealed interface | +| record | [FakequeryparamwithjsoncontenttypeGetCode200Response.ApplicationjsonResponseBody](#applicationjsonresponsebody)
implements sealed interface to store response body | +| static class | [FakequeryparamwithjsoncontenttypeGetCode200Response.FakequeryparamwithjsoncontenttypeGetCode200Response1](#fakequeryparamwithjsoncontenttypegetcode200response1)
class that deserializes responses | + +## SealedMediaType +public sealed interface SealedMediaType
+permits
+[ApplicationjsonMediaType](#applicationjsonmediatype) + +sealed interface that stores schema and encoding info + +## ApplicationjsonMediaType +public record ApplicationjsonMediaType
+implements [SealedMediaType](#sealedmediatype), MediaType<[ApplicationjsonSchema.ApplicationjsonSchema1](../../../../paths/fakequeryparamwithjsoncontenttype/get/responses/code200response/content/applicationjson/ApplicationjsonSchema.md#applicationjsonschema1), Nothing?> + +class storing schema info for a specific contentType + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| ApplicationjsonMediaType()
Creates an instance | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| [ApplicationjsonSchema.ApplicationjsonSchema1](../../../../paths/fakequeryparamwithjsoncontenttype/get/responses/code200response/content/applicationjson/ApplicationjsonSchema.md#applicationjsonschema1) | schema()
the schema for this MediaType | +| Nothing? | encoding()
the encoding info | + +## SealedResponseBody +public sealed interface SealedResponseBody
+permits
+[ApplicationjsonResponseBody](#applicationjsonresponsebody) + +sealed interface that stores response body + +## ApplicationjsonResponseBody +public record ApplicationjsonResponseBody
+implements [SealedResponseBody](#sealedresponsebody) + +A record class to store response body for contentType="application/json" + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| ApplicationjsonResponseBody(ApplicationjsonSchema.AnyTypeJsonSchema1Boxed body)
Creates an instance | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| ApplicationjsonSchema.AnyTypeJsonSchema1Boxed | body()
returns the body passed in in the constructor | + +## FakequeryparamwithjsoncontenttypeGetCode200Response1 +public static class FakequeryparamwithjsoncontenttypeGetCode200Response1
+extends ResponseDeserializer<[SealedResponseBody](#sealedresponsebody), Nothing?, [SealedMediaType](#sealedmediatype)> + +a class that deserializes responses + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| FakequeryparamwithjsoncontenttypeGetCode200Response1()
Creates an instance | + +### Field Summary +| Modifier and Type | Field and Description | +| ----------------- | --------------------- | +| 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 | +| ----------------- | ---------------------- | +| ApiResponse<[SealedResponseBody](#sealedresponsebody), Nothing?> | deserialize(HttpResponse response, SchemaConfiguration configuration)
called by endpoint when deserialize responses | diff --git a/samples/client/petstore/kotlin/docs/paths/fakequeryparamwithjsoncontenttype/get/responses/code200response/content/applicationjson/ApplicationjsonSchema.md b/samples/client/petstore/kotlin/docs/paths/fakequeryparamwithjsoncontenttype/get/responses/code200response/content/applicationjson/ApplicationjsonSchema.md new file mode 100644 index 00000000000..b05260b1abf --- /dev/null +++ b/samples/client/petstore/kotlin/docs/paths/fakequeryparamwithjsoncontenttype/get/responses/code200response/content/applicationjson/ApplicationjsonSchema.md @@ -0,0 +1,144 @@ +# ApplicationjsonSchema +public class ApplicationjsonSchema
+ +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 + +## Nested Class Summary +| Modifier and Type | Class and Description | +| ----------------- | ---------------------- | +| sealed interface | [ApplicationjsonSchema.ApplicationjsonSchema1Boxed](#applicationjsonschema1boxed)
sealed interface for validated payloads | +| record | [ApplicationjsonSchema.ApplicationjsonSchema1BoxedVoid](#applicationjsonschema1boxedvoid)
boxed class to store validated null payloads | +| record | [ApplicationjsonSchema.ApplicationjsonSchema1BoxedBoolean](#applicationjsonschema1boxedboolean)
boxed class to store validated boolean payloads | +| record | [ApplicationjsonSchema.ApplicationjsonSchema1BoxedNumber](#applicationjsonschema1boxednumber)
boxed class to store validated Number payloads | +| record | [ApplicationjsonSchema.ApplicationjsonSchema1BoxedString](#applicationjsonschema1boxedstring)
boxed class to store validated String payloads | +| record | [ApplicationjsonSchema.ApplicationjsonSchema1BoxedList](#applicationjsonschema1boxedlist)
boxed class to store validated List payloads | +| record | [ApplicationjsonSchema.ApplicationjsonSchema1BoxedMap](#applicationjsonschema1boxedmap)
boxed class to store validated Map payloads | +| static class | [ApplicationjsonSchema.ApplicationjsonSchema1](#applicationjsonschema1)
schema class | + +## ApplicationjsonSchema1Boxed +public sealed interface ApplicationjsonSchema1Boxed
+permits
+[ApplicationjsonSchema1BoxedVoid](#applicationjsonschema1boxedvoid), +[ApplicationjsonSchema1BoxedBoolean](#applicationjsonschema1boxedboolean), +[ApplicationjsonSchema1BoxedNumber](#applicationjsonschema1boxednumber), +[ApplicationjsonSchema1BoxedString](#applicationjsonschema1boxedstring), +[ApplicationjsonSchema1BoxedList](#applicationjsonschema1boxedlist), +[ApplicationjsonSchema1BoxedMap](#applicationjsonschema1boxedmap) + +sealed interface that stores validated payloads using boxed classes + +## ApplicationjsonSchema1BoxedVoid +public record ApplicationjsonSchema1BoxedVoid
+implements [ApplicationjsonSchema1Boxed](#applicationjsonschema1boxed) + +record that stores validated null payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| ApplicationjsonSchema1BoxedVoid(Nothing? data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| Nothing? | data()
validated payload | +| @Nullable Object | getData()
validated payload | + +## ApplicationjsonSchema1BoxedBoolean +public record ApplicationjsonSchema1BoxedBoolean
+implements [ApplicationjsonSchema1Boxed](#applicationjsonschema1boxed) + +record that stores validated boolean payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| ApplicationjsonSchema1BoxedBoolean(boolean data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| boolean | data()
validated payload | +| @Nullable Object | getData()
validated payload | + +## ApplicationjsonSchema1BoxedNumber +public record ApplicationjsonSchema1BoxedNumber
+implements [ApplicationjsonSchema1Boxed](#applicationjsonschema1boxed) + +record that stores validated Number payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| ApplicationjsonSchema1BoxedNumber(Number data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| Number | data()
validated payload | +| @Nullable Object | getData()
validated payload | + +## ApplicationjsonSchema1BoxedString +public record ApplicationjsonSchema1BoxedString
+implements [ApplicationjsonSchema1Boxed](#applicationjsonschema1boxed) + +record that stores validated String payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| ApplicationjsonSchema1BoxedString(String data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| String | data()
validated payload | +| @Nullable Object | getData()
validated payload | + +## ApplicationjsonSchema1BoxedList +public record ApplicationjsonSchema1BoxedList
+implements [ApplicationjsonSchema1Boxed](#applicationjsonschema1boxed) + +record that stores validated List payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| ApplicationjsonSchema1BoxedList(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 | + +## ApplicationjsonSchema1BoxedMap +public record ApplicationjsonSchema1BoxedMap
+implements [ApplicationjsonSchema1Boxed](#applicationjsonschema1boxed) + +record that stores validated Map payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| ApplicationjsonSchema1BoxedMap(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 | + +## ApplicationjsonSchema1 +public static class ApplicationjsonSchema1
+extends AnyTypeJsonSchema.AnyTypeJsonSchema1 + +A schema class that validates payloads + +| Methods Inherited from class org.openapijsonschematools.client.schemas.AnyTypeJsonSchema.AnyTypeJsonSchema1 | +| ------------------------------------------------------------------ | +| validate | +| validateAndBox | diff --git a/samples/client/petstore/kotlin/docs/paths/fakeredirection/FakeredirectionGet.md b/samples/client/petstore/kotlin/docs/paths/fakeredirection/FakeredirectionGet.md new file mode 100644 index 00000000000..fc63432c009 --- /dev/null +++ b/samples/client/petstore/kotlin/docs/paths/fakeredirection/FakeredirectionGet.md @@ -0,0 +1,146 @@ +# FakeredirectionGet + +public class FakeredirectionGet + +A class that contains necessary endpoint classes +- a class that calls the endpoint method using the http verb +- a class that calls the endpoint method using the operationId name +- class(es) to store the request inputs +- builder(s) to set the request input data + +## Nested Class Summary +| Modifier and Type | Class and Description | +| ----------------- | --------------------- | +| static class | [Get](#get)
The class that has a get method to call the endpoint | +| interface | [RedirectionOperation](#redirectionoperation)
The interface that has a redirection method to call the endpoint | +| static class | [GetRequest](#getrequest)
The request inputs class | +| static class | [GetRequestBuilder](#getrequestbuilder)
A builder for the request input class | + +## Get +public static class Get extends ApiClient.ApiClient1 implements GetOperation
+ +a class that allows one to call the endpoint using a method named get + +### 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.servers.RootServer0; +import org.openapijsonschematools.client.servers.RootServer1; +import org.openapijsonschematools.client.servers.RootServer2; +import org.openapijsonschematools.client.paths.fakeredirection.get.responses.FakeredirectionGetCode303Response; +import org.openapijsonschematools.client.paths.fakeredirection.get.responses.FakeredirectionGetCode3XXResponse; +import org.openapijsonschematools.client.servers.RootServerInfo; +import org.openapijsonschematools.client.paths.fakeredirection.FakeredirectionGet; +import org.openapijsonschematools.client.paths.fakeredirection.get.FakeredirectionGetResponses; + +import java.io.IOException; +import java.util.Arrays; +import java.util.List; +import java.util.Map; +import java.util.AbstractMap; + +// if you want to use a server that is not SERVER_0 pass it in here and change the ServerIndex input below +ApiConfiguration.ServerInfo serverInfo = new ApiConfiguration.ServerInfoBuilder() + .rootServerInfo( + new RootServerInfo.RootServerInfoBuilder() + .rootServer0(new RootServer0()) + .build() + ) + .build(); +ApiConfiguration.ServerIndexInfo serverIndexInfo = new ApiConfiguration.ServerIndexInfoBuilder() + .rootServerInfoServerIndex(RootServerInfo.ServerIndex.SERVER_0) + .build(); +Duration timeout = Duration.ofSeconds(1L); +Map> defaultHeaders = Map.of("User-Agent", List.of("OpenAPI-JSON-Schema-Generator/1.0.0/java")); +ApiConfiguration apiConfiguration = new ApiConfiguration( + serverInfo + serverIndexInfo, + timeout, + defaultHeaders +); +SchemaConfiguration schemaConfiguration = new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().build()); +FakeredirectionGet.Get apiClient = new FakeredirectionGet.Get(apiConfiguration, schemaConfiguration); + + +var request = new FakeredirectionGet.GetRequestBuilder().build(); + +FakeredirectionGetResponses.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; +} +if (response instanceof FakeredirectionGetResponses.EndpointFakeredirectionGetCode3XXResponse castResponse) { +} else { + FakeredirectionGetResponses.EndpointFakeredirectionGetCode303Response castResponse = (FakeredirectionGetResponses.EndpointFakeredirectionGetCode303Response) response; +} +``` +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| Get(ApiConfiguration apiConfiguration, SchemaConfiguration schemaConfiguration)
Creates an instance | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| [FakeredirectionGetResponses.EndpointResponse](../../paths/fakeredirection/get/FakeredirectionGetResponses.md#endpointresponse) | get([GetRequest](#getrequest) request) | + +## RedirectionOperation +public interface RedirectionOperation
+ +an interface that allows one to call the endpoint using a method named redirection by the operationId + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| [FakeredirectionGetResponses.EndpointResponse](../../paths/fakeredirection/get/FakeredirectionGetResponses.md#endpointresponse) | redirection([GetRequest](#getrequest) request) | + +## GetRequest +public static class GetRequest
+ +a class that stores the final request inputs + +### Field Summary +| Modifier and Type | Field and Description | +| ----------------- | --------------------- | +| [RootServerInfo.@Nullable ServerIndex](../../RootServerInfo.md#serverindex) | serverIndex
optional. Note: this will override the value in apiConfiguration | +| @Nullable Duration | timeout
optional. Note: this will override the value in apiConfiguration | + +## GetRequestBuilder +public static class GetRequestBuilder
+ +a builder for request inputs + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| GetRequestBuilder()
Creates a builder that contains null for all parameters | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| [GetRequest](#getrequest) | build()
Returns the request input used to call an endpoint method | +| [GetRequestBuilder](#getrequestbuilder) | serverIndex([RootServerInfo.ServerIndex](../../RootServerInfo.md#serverindex) serverIndex)
sets the optional property. Note: this will override the value in apiConfiguration | +| [GetRequestBuilder](#getrequestbuilder) | timeout(Duration timeout)
sets the optional property. Note: this will override the value in apiConfiguration | + +[[Back to top]](#top) [[Back to README]](../../../README.md) diff --git a/samples/client/petstore/kotlin/docs/paths/fakeredirection/get/FakeredirectionGetResponses.md b/samples/client/petstore/kotlin/docs/paths/fakeredirection/get/FakeredirectionGetResponses.md new file mode 100644 index 00000000000..ae99e3b60b0 --- /dev/null +++ b/samples/client/petstore/kotlin/docs/paths/fakeredirection/get/FakeredirectionGetResponses.md @@ -0,0 +1,40 @@ +# FakeredirectionGetResponses + +public class FakeredirectionGetResponses + +A class that contains necessary responses classes +- a sealed interface, EndpointResponse, that stores endpoint responses +- records for each endpoint response + +## Nested Class Summary +| Modifier and Type | Class and Description | +| ----------------- | --------------------- | +| sealed interface | [EndpointResponse](#endpointresponse)
stores the endpoint responses | +| record | [EndpointFakeredirectionGetCode3XXResponse](#endpointfakeredirectiongetcode3xxresponse)
the response for 3XX | +| record | [EndpointFakeredirectionGetCode303Response](#endpointfakeredirectiongetcode303response)
the response for 303 | + +## EndpointResponse +public sealed interface EndpointResponse permits
+[EndpointFakeredirectionGetCode3XXResponse](#endpointfakeredirectiongetcode3xxresponse), +[EndpointFakeredirectionGetCode303Response](#endpointfakeredirectiongetcode303response) + +a sealed interface that stores endpoint responses + +## EndpointFakeredirectionGetCode3XXResponse +public record EndpointFakeredirectionGetCode3XXResponse( + HttpResponse response, + Nothing? body, + Nothing? headers +) implements EndpointResponse, ApiResponse
+ +a class that stores an endpoint response + +## EndpointFakeredirectionGetCode303Response +public record EndpointFakeredirectionGetCode303Response( + HttpResponse response, + Nothing? body, + Nothing? headers +) implements EndpointResponse, ApiResponse
+ +a class that stores an endpoint response + diff --git a/samples/client/petstore/kotlin/docs/paths/fakeredirection/get/responses/FakeredirectionGetCode303Response.md b/samples/client/petstore/kotlin/docs/paths/fakeredirection/get/responses/FakeredirectionGetCode303Response.md new file mode 100644 index 00000000000..bfce98f22a9 --- /dev/null +++ b/samples/client/petstore/kotlin/docs/paths/fakeredirection/get/responses/FakeredirectionGetCode303Response.md @@ -0,0 +1,32 @@ +# FakeredirectionGetCode303Response + +public class FakeredirectionGetCode303Response + +A class that contains necessary nested response classes +- a class that extends ResponseDeserializer and is used to deserialize responses + +## Nested Class Summary +| Modifier and Type | Class and Description | +| ----------------- | --------------------- | +| static class | [FakeredirectionGetCode303Response.FakeredirectionGetCode303Response1](#fakeredirectiongetcode303response1)
class that deserializes responses | + +## FakeredirectionGetCode303Response1 +public static class FakeredirectionGetCode303Response1
+extends ResponseDeserializer + +a class that deserializes responses + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| FakeredirectionGetCode303Response1()
Creates an instance | + +### Field Summary +| Modifier and Type | Field and Description | +| ----------------- | --------------------- | +| Map | content = MapUtils.makeMap(
)
the contentType to schema info | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| ApiResponse | deserialize(HttpResponse response, SchemaConfiguration configuration)
called by endpoint when deserialize responses | diff --git a/samples/client/petstore/kotlin/docs/paths/fakeredirection/get/responses/FakeredirectionGetCode3XXResponse.md b/samples/client/petstore/kotlin/docs/paths/fakeredirection/get/responses/FakeredirectionGetCode3XXResponse.md new file mode 100644 index 00000000000..25858ebb406 --- /dev/null +++ b/samples/client/petstore/kotlin/docs/paths/fakeredirection/get/responses/FakeredirectionGetCode3XXResponse.md @@ -0,0 +1,32 @@ +# FakeredirectionGetCode3XXResponse + +public class FakeredirectionGetCode3XXResponse + +A class that contains necessary nested response classes +- a class that extends ResponseDeserializer and is used to deserialize responses + +## Nested Class Summary +| Modifier and Type | Class and Description | +| ----------------- | --------------------- | +| static class | [FakeredirectionGetCode3XXResponse.FakeredirectionGetCode3XXResponse1](#fakeredirectiongetcode3xxresponse1)
class that deserializes responses | + +## FakeredirectionGetCode3XXResponse1 +public static class FakeredirectionGetCode3XXResponse1
+extends ResponseDeserializer + +a class that deserializes responses + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| FakeredirectionGetCode3XXResponse1()
Creates an instance | + +### Field Summary +| Modifier and Type | Field and Description | +| ----------------- | --------------------- | +| Map | content = MapUtils.makeMap(
)
the contentType to schema info | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| ApiResponse | deserialize(HttpResponse response, SchemaConfiguration configuration)
called by endpoint when deserialize responses | diff --git a/samples/client/petstore/kotlin/docs/paths/fakerefobjinquery/FakerefobjinqueryGet.md b/samples/client/petstore/kotlin/docs/paths/fakerefobjinquery/FakerefobjinqueryGet.md new file mode 100644 index 00000000000..ee25be0a844 --- /dev/null +++ b/samples/client/petstore/kotlin/docs/paths/fakerefobjinquery/FakerefobjinqueryGet.md @@ -0,0 +1,145 @@ +# FakerefobjinqueryGet + +public class FakerefobjinqueryGet + +A class that contains necessary endpoint classes +- a class that calls the endpoint method using the http verb +- a class that calls the endpoint method using the operationId name +- class(es) to store the request inputs +- builder(s) to set the request input data + +## Nested Class Summary +| Modifier and Type | Class and Description | +| ----------------- | --------------------- | +| static class | [Get](#get)
The class that has a get method to call the endpoint | +| interface | [RefObjectInQueryOperation](#refobjectinqueryoperation)
The interface that has a refObjectInQuery method to call the endpoint | +| static class | [GetRequest](#getrequest)
The request inputs class | +| static class | [GetRequestBuilder](#getrequestbuilder)
A builder for the request input class | + +## Get +public static class Get extends ApiClient.ApiClient1 implements GetOperation
+ +a class that allows one to call the endpoint using a method named get + +### 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.fakerefobjinquery.get.FakerefobjinqueryGetQueryParameters; +import org.openapijsonschematools.client.RootServerInfo; +import org.openapijsonschematools.client.servers.RootServer0; +import org.openapijsonschematools.client.servers.RootServer1; +import org.openapijsonschematools.client.servers.RootServer2; +import org.openapijsonschematools.client.paths.fakerefobjinquery.get.responses.FakerefobjinqueryGetCode200Response; +import org.openapijsonschematools.client.servers.RootServerInfo; +import org.openapijsonschematools.client.paths.fakerefobjinquery.FakerefobjinqueryGet; +import org.openapijsonschematools.client.paths.fakerefobjinquery.get.FakerefobjinqueryGetResponses; + +import java.io.IOException; +import java.util.Arrays; +import java.util.List; +import java.util.Map; +import java.util.AbstractMap; + +// if you want to use a server that is not SERVER_0 pass it in here and change the ServerIndex input below +ApiConfiguration.ServerInfo serverInfo = new ApiConfiguration.ServerInfoBuilder() + .rootServerInfo( + new RootServerInfo.RootServerInfoBuilder() + .rootServer0(new RootServer0()) + .build() + ) + .build(); +ApiConfiguration.ServerIndexInfo serverIndexInfo = new ApiConfiguration.ServerIndexInfoBuilder() + .rootServerInfoServerIndex(RootServerInfo.ServerIndex.SERVER_0) + .build(); +Duration timeout = Duration.ofSeconds(1L); +Map> defaultHeaders = Map.of("User-Agent", List.of("OpenAPI-JSON-Schema-Generator/1.0.0/java")); +ApiConfiguration apiConfiguration = new ApiConfiguration( + serverInfo + serverIndexInfo, + timeout, + defaultHeaders +); +SchemaConfiguration schemaConfiguration = new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().build()); +FakerefobjinqueryGet.Get apiClient = new FakerefobjinqueryGet.Get(apiConfiguration, schemaConfiguration); + + +var request = new FakerefobjinqueryGet.GetRequestBuilder().build(); + +FakerefobjinqueryGetResponses.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; +} +FakerefobjinqueryGetResponses.EndpointFakerefobjinqueryGetCode200Response castResponse = (FakerefobjinqueryGetResponses.EndpointFakerefobjinqueryGetCode200Response) response; +``` +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| Get(ApiConfiguration apiConfiguration, SchemaConfiguration schemaConfiguration)
Creates an instance | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| [FakerefobjinqueryGetResponses.EndpointResponse](../../paths/fakerefobjinquery/get/FakerefobjinqueryGetResponses.md#endpointresponse) | get([GetRequest](#getrequest) request) | + +## RefObjectInQueryOperation +public interface RefObjectInQueryOperation
+ +an interface that allows one to call the endpoint using a method named refObjectInQuery by the operationId + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| [FakerefobjinqueryGetResponses.EndpointResponse](../../paths/fakerefobjinquery/get/FakerefobjinqueryGetResponses.md#endpointresponse) | refObjectInQuery([GetRequest](#getrequest) request) | + +## GetRequest +public static class GetRequest
+ +a class that stores the final request inputs + +### Field Summary +| Modifier and Type | Field and Description | +| ----------------- | --------------------- | +| [FakerefobjinqueryGetQueryParameters.@Nullable QueryParametersMap](../../paths/fakerefobjinquery/get/FakerefobjinqueryGetQueryParameters.md#queryparametersmap) | queryParameters
optional | +| [RootServerInfo.@Nullable ServerIndex](../../RootServerInfo.md#serverindex) | serverIndex
optional. Note: this will override the value in apiConfiguration | +| @Nullable Duration | timeout
optional. Note: this will override the value in apiConfiguration | + +## GetRequestBuilder +public static class GetRequestBuilder
+ +a builder for request inputs + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| GetRequestBuilder()
Creates a builder that contains null for all parameters | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| [GetRequest](#getrequest) | build()
Returns the request input used to call an endpoint method | +| [GetRequestBuilder](#getrequestbuilder) | queryParameters([FakerefobjinqueryGetQueryParametersQueryParametersMap](../../paths/fakerefobjinquery/get/FakerefobjinqueryGetQueryParameters.md#queryparametersmap) queryParameters)
sets the optional property | +| [GetRequestBuilder](#getrequestbuilder) | serverIndex([RootServerInfo.ServerIndex](../../RootServerInfo.md#serverindex) serverIndex)
sets the optional property. Note: this will override the value in apiConfiguration | +| [GetRequestBuilder](#getrequestbuilder) | timeout(Duration timeout)
sets the optional property. Note: this will override the value in apiConfiguration | + +[[Back to top]](#top) [[Back to README]](../../../README.md) diff --git a/samples/client/petstore/kotlin/docs/paths/fakerefobjinquery/get/FakerefobjinqueryGetQueryParameters.md b/samples/client/petstore/kotlin/docs/paths/fakerefobjinquery/get/FakerefobjinqueryGetQueryParameters.md new file mode 100644 index 00000000000..7d96f638a5b --- /dev/null +++ b/samples/client/petstore/kotlin/docs/paths/fakerefobjinquery/get/FakerefobjinqueryGetQueryParameters.md @@ -0,0 +1,258 @@ +# FakerefobjinqueryGetQueryParameters +public class FakerefobjinqueryGetQueryParameters
+ +A class that contains necessary nested +- schema classes (which validate payloads), extends JsonSchema +- sealed interfaces which store validated payloads, java version of a sum type +- boxed classes which store validated payloads, sealed permits class implementations +- classes to store validated map payloads, extends FrozenMap +- classes to build inputs for map payloads + +## Nested Class Summary +| Modifier and Type | Class and Description | +| ----------------- | ---------------------- | +| sealed interface | [FakerefobjinqueryGetQueryParameters.FakerefobjinqueryGetQueryParameters1Boxed](#fakerefobjinquerygetqueryparameters1boxed)
sealed interface for validated payloads | +| record | [FakerefobjinqueryGetQueryParameters.FakerefobjinqueryGetQueryParameters1BoxedMap](#fakerefobjinquerygetqueryparameters1boxedmap)
boxed class to store validated Map payloads | +| static class | [FakerefobjinqueryGetQueryParameters.FakerefobjinqueryGetQueryParameters1](#fakerefobjinquerygetqueryparameters1)
schema class | +| static class | [FakerefobjinqueryGetQueryParameters.QueryParametersMapBuilder](#queryparametersmapbuilder)
builder for Map payloads | +| static class | [FakerefobjinqueryGetQueryParameters.QueryParametersMap](#queryparametersmap)
output class for Map payloads | +| sealed interface | [FakerefobjinqueryGetQueryParameters.AdditionalPropertiesBoxed](#additionalpropertiesboxed)
sealed interface for validated payloads | +| record | [FakerefobjinqueryGetQueryParameters.AdditionalPropertiesBoxedVoid](#additionalpropertiesboxedvoid)
boxed class to store validated null payloads | +| record | [FakerefobjinqueryGetQueryParameters.AdditionalPropertiesBoxedBoolean](#additionalpropertiesboxedboolean)
boxed class to store validated boolean payloads | +| record | [FakerefobjinqueryGetQueryParameters.AdditionalPropertiesBoxedNumber](#additionalpropertiesboxednumber)
boxed class to store validated Number payloads | +| record | [FakerefobjinqueryGetQueryParameters.AdditionalPropertiesBoxedString](#additionalpropertiesboxedstring)
boxed class to store validated String payloads | +| record | [FakerefobjinqueryGetQueryParameters.AdditionalPropertiesBoxedList](#additionalpropertiesboxedlist)
boxed class to store validated List payloads | +| record | [FakerefobjinqueryGetQueryParameters.AdditionalPropertiesBoxedMap](#additionalpropertiesboxedmap)
boxed class to store validated Map payloads | +| static class | [FakerefobjinqueryGetQueryParameters.AdditionalProperties](#additionalproperties)
schema class | + +## FakerefobjinqueryGetQueryParameters1Boxed +public sealed interface FakerefobjinqueryGetQueryParameters1Boxed
+permits
+[FakerefobjinqueryGetQueryParameters1BoxedMap](#fakerefobjinquerygetqueryparameters1boxedmap) + +sealed interface that stores validated payloads using boxed classes + +## FakerefobjinqueryGetQueryParameters1BoxedMap +public record FakerefobjinqueryGetQueryParameters1BoxedMap
+implements [FakerefobjinqueryGetQueryParameters1Boxed](#fakerefobjinquerygetqueryparameters1boxed) + +record that stores validated Map payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| FakerefobjinqueryGetQueryParameters1BoxedMap([QueryParametersMap](#queryparametersmap) data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| [QueryParametersMap](#queryparametersmap) | data()
validated payload | +| @Nullable Object | getData()
validated payload | + +## FakerefobjinqueryGetQueryParameters1 +public static class FakerefobjinqueryGetQueryParameters1
+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.fakerefobjinquery.get.FakerefobjinqueryGetQueryParameters; + +import java.util.Arrays; +import java.util.List; +import java.util.AbstractMap; + +static final SchemaConfiguration configuration = new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().build()); + +// Map validation +FakerefobjinqueryGetQueryParameters.QueryParametersMap validatedPayload = + FakerefobjinqueryGetQueryParameters.FakerefobjinqueryGetQueryParameters1.validate( + new FakerefobjinqueryGetQueryParameters.QueryParametersMapBuilder() + .mapBean( + MapUtils.makeMap( + new AbstractMap.SimpleEntry( + "bar", + "a" + ) + ) + ) + .build(), + configuration +); +``` + +### Field Summary +| Modifier and Type | Field and Description | +| ----------------- | ---------------------- | +| Set> | type = Set.of(Map.class) | +| Map> | properties = Map.ofEntries(
    new PropertyEntry("mapBean", [Foo.Foo1.class](../../../components/schemas/Foo.md#foo1))
)
| +| Class | additionalProperties = [AdditionalProperties.class](#additionalproperties) | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| [QueryParametersMap](#queryparametersmap) | validate([Map<?, ?>](#queryparametersmapbuilder) arg, SchemaConfiguration configuration) | +| [FakerefobjinqueryGetQueryParameters1BoxedMap](#fakerefobjinquerygetqueryparameters1boxedmap) | validateAndBox([Map<?, ?>](#queryparametersmapbuilder) arg, SchemaConfiguration configuration) | +| [FakerefobjinqueryGetQueryParameters1Boxed](#fakerefobjinquerygetqueryparameters1boxed) | validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) | +| @Nullable Object | validate(@Nullable Object arg, SchemaConfiguration configuration) | + +## QueryParametersMapBuilder +public class QueryParametersMapBuilder
+builder for `Map>` + +A class that builds the Map input type + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| QueryParametersMapBuilder()
Creates a builder that contains an empty map | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| Map> | build()
Returns map input that should be used with Schema.validate | +| [QueryParametersMapBuilder](#queryparametersmapbuilder) | mapBean(Map value) | + +## QueryParametersMap +public static class QueryParametersMap
+extends FrozenMap + +A class to store validated Map payloads + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| static [QueryParametersMap](#queryparametersmap) | of([Map>](#queryparametersmapbuilder) arg, SchemaConfiguration configuration) | +| [Foo.FooMap](../../../components/schemas/Foo.md#foomap) | mapBean()
[optional] | + +## 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(Nothing? data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| Nothing? | 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/kotlin/docs/paths/fakerefobjinquery/get/FakerefobjinqueryGetResponses.md b/samples/client/petstore/kotlin/docs/paths/fakerefobjinquery/get/FakerefobjinqueryGetResponses.md new file mode 100644 index 00000000000..31c750e35b9 --- /dev/null +++ b/samples/client/petstore/kotlin/docs/paths/fakerefobjinquery/get/FakerefobjinqueryGetResponses.md @@ -0,0 +1,29 @@ +# FakerefobjinqueryGetResponses + +public class FakerefobjinqueryGetResponses + +A class that contains necessary responses classes +- a sealed interface, EndpointResponse, that stores endpoint responses +- records for each endpoint response + +## Nested Class Summary +| Modifier and Type | Class and Description | +| ----------------- | --------------------- | +| sealed interface | [EndpointResponse](#endpointresponse)
stores the endpoint responses | +| record | [EndpointFakerefobjinqueryGetCode200Response](#endpointfakerefobjinquerygetcode200response)
the response for 200 | + +## EndpointResponse +public sealed interface EndpointResponse permits
+[EndpointFakerefobjinqueryGetCode200Response](#endpointfakerefobjinquerygetcode200response) + +a sealed interface that stores endpoint responses + +## EndpointFakerefobjinqueryGetCode200Response +public record EndpointFakerefobjinqueryGetCode200Response( + HttpResponse response, + Nothing? body, + Nothing? headers +) implements EndpointResponse, ApiResponse
+ +a class that stores an endpoint response + diff --git a/samples/client/petstore/kotlin/docs/paths/fakerefobjinquery/get/parameters/parameter0/Schema0.md b/samples/client/petstore/kotlin/docs/paths/fakerefobjinquery/get/parameters/parameter0/Schema0.md new file mode 100644 index 00000000000..22b82242cfb --- /dev/null +++ b/samples/client/petstore/kotlin/docs/paths/fakerefobjinquery/get/parameters/parameter0/Schema0.md @@ -0,0 +1,19 @@ +# Schema0 +public class Schema0
+extends [Foo1](../../../components/schemas/Foo.md#foo) + +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 + +## Nested Class Summary +| Modifier and Type | Class and Description | +| ----------------- | ---------------------- | +| static class | [Schema0.Schema01](#schema01)
schema class | + +## Schema01 +public static class Schema01
+extends [Foo.Foo1](../../../components/schemas/Foo.md#foo1) + +A schema class that validates payloads diff --git a/samples/client/petstore/kotlin/docs/paths/fakerefobjinquery/get/responses/FakerefobjinqueryGetCode200Response.md b/samples/client/petstore/kotlin/docs/paths/fakerefobjinquery/get/responses/FakerefobjinqueryGetCode200Response.md new file mode 100644 index 00000000000..01ca962f7f5 --- /dev/null +++ b/samples/client/petstore/kotlin/docs/paths/fakerefobjinquery/get/responses/FakerefobjinqueryGetCode200Response.md @@ -0,0 +1,17 @@ +# FakerefobjinqueryGetCode200Response + +public class FakerefobjinqueryGetCode200Response extends [SuccessDescriptionOnly](../../components/responses/SuccessDescriptionOnly.md) + +A class (extended from the $ref class) that contains necessary nested response classes +- a class that extends ResponseDeserializer and is used to deserialize responses + +## Nested Class Summary +| Modifier and Type | Class and Description | +| ----------------- | --------------------- | +| static class | [FakerefobjinqueryGetCode200Response.FakerefobjinqueryGetCode200Response1](#fakerefobjinquerygetcode200response1)
class that deserializes responses | + +## FakerefobjinqueryGetCode200Response1 +public static class FakerefobjinqueryGetCode200Response1 extends [SuccessDescriptionOnly1](../../components/responses/SuccessDescriptionOnly.md#successdescriptiononly1)
+ +a class that deserializes responses, extended from the $ref class + diff --git a/samples/client/petstore/kotlin/docs/paths/fakerefsarraymodel/FakerefsarraymodelPost.md b/samples/client/petstore/kotlin/docs/paths/fakerefsarraymodel/FakerefsarraymodelPost.md new file mode 100644 index 00000000000..f6ec0996f3a --- /dev/null +++ b/samples/client/petstore/kotlin/docs/paths/fakerefsarraymodel/FakerefsarraymodelPost.md @@ -0,0 +1,148 @@ +# FakerefsarraymodelPost + +public class FakerefsarraymodelPost + +A class that contains necessary endpoint classes +- a class that calls the endpoint method using the http verb +- a class that calls the endpoint method using the operationId name +- class(es) to store the request inputs +- builder(s) to set the request input data + +## Nested Class Summary +| Modifier and Type | Class and Description | +| ----------------- | --------------------- | +| static class | [Post](#post)
The class that has a post method to call the endpoint | +| interface | [ArrayModelOperation](#arraymodeloperation)
The interface that has a arrayModel method to call the endpoint | +| static class | [PostRequest](#postrequest)
The request inputs class | +| static class | [PostRequestBuilder](#postrequestbuilder)
A builder for the request input class | + +## Post +public static class Post 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.fakerefsarraymodel.post.FakerefsarraymodelPostRequestBody; +import org.openapijsonschematools.client.components.schemas.AnimalFarm; +import org.openapijsonschematools.client.RootServerInfo; +import org.openapijsonschematools.client.servers.RootServer0; +import org.openapijsonschematools.client.servers.RootServer1; +import org.openapijsonschematools.client.servers.RootServer2; +import org.openapijsonschematools.client.paths.fakerefsarraymodel.post.responses.FakerefsarraymodelPostCode200Response; +import org.openapijsonschematools.client.servers.RootServerInfo; +import org.openapijsonschematools.client.paths.fakerefsarraymodel.FakerefsarraymodelPost; +import org.openapijsonschematools.client.paths.fakerefsarraymodel.post.FakerefsarraymodelPostResponses; + +import java.io.IOException; +import java.util.Arrays; +import java.util.List; +import java.util.Map; +import java.util.AbstractMap; + +// if you want to use a server that is not SERVER_0 pass it in here and change the ServerIndex input below +ApiConfiguration.ServerInfo serverInfo = new ApiConfiguration.ServerInfoBuilder() + .rootServerInfo( + new RootServerInfo.RootServerInfoBuilder() + .rootServer0(new RootServer0()) + .build() + ) + .build(); +ApiConfiguration.ServerIndexInfo serverIndexInfo = new ApiConfiguration.ServerIndexInfoBuilder() + .rootServerInfoServerIndex(RootServerInfo.ServerIndex.SERVER_0) + .build(); +Duration timeout = Duration.ofSeconds(1L); +Map> defaultHeaders = Map.of("User-Agent", List.of("OpenAPI-JSON-Schema-Generator/1.0.0/java")); +ApiConfiguration apiConfiguration = new ApiConfiguration( + serverInfo + serverIndexInfo, + timeout, + defaultHeaders +); +SchemaConfiguration schemaConfiguration = new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().build()); +FakerefsarraymodelPost.Post apiClient = new FakerefsarraymodelPost.Post(apiConfiguration, schemaConfiguration); + + +var request = new FakerefsarraymodelPost.PostRequestBuilder().build(); + +FakerefsarraymodelPostResponses.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; +} +FakerefsarraymodelPostResponses.EndpointFakerefsarraymodelPostCode200Response castResponse = (FakerefsarraymodelPostResponses.EndpointFakerefsarraymodelPostCode200Response) response; +FakerefsarraymodelPostCode200Response.ApplicationjsonResponseBody deserializedBody = (FakerefsarraymodelPostCode200Response.ApplicationjsonResponseBody) castResponse.body; +// handle deserialized body here +``` +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| Post(ApiConfiguration apiConfiguration, SchemaConfiguration schemaConfiguration)
Creates an instance | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| [FakerefsarraymodelPostResponses.EndpointResponse](../../paths/fakerefsarraymodel/post/FakerefsarraymodelPostResponses.md#endpointresponse) | post([PostRequest](#postrequest) request) | + +## ArrayModelOperation +public interface ArrayModelOperation
+ +an interface that allows one to call the endpoint using a method named arrayModel by the operationId + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| [FakerefsarraymodelPostResponses.EndpointResponse](../../paths/fakerefsarraymodel/post/FakerefsarraymodelPostResponses.md#endpointresponse) | arrayModel([PostRequest](#postrequest) request) | + +## PostRequest +public static class PostRequest
+ +a class that stores the final request inputs + +### Field Summary +| Modifier and Type | Field and Description | +| ----------------- | --------------------- | +| [FakerefsarraymodelPostRequestBody.@Nullable SealedRequestBody](../../paths/fakerefsarraymodel/post/FakerefsarraymodelPostRequestBody.md#sealedrequestbody) | requestBody
optional | +| [RootServerInfo.@Nullable ServerIndex](../../RootServerInfo.md#serverindex) | serverIndex
optional. Note: this will override the value in apiConfiguration | +| @Nullable Duration | timeout
optional. Note: this will override the value in apiConfiguration | + +## PostRequestBuilder +public static class PostRequestBuilder
+ +a builder for request inputs + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| PostRequestBuilder()
Creates a builder that contains null for all parameters | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| [PostRequest](#postrequest) | build()
Returns the request input used to call an endpoint method | +| [PostRequestBuilder](#postrequestbuilder) | requestBody([FakerefsarraymodelPostRequestBody.SealedRequestBody](../../paths/fakerefsarraymodel/post/FakerefsarraymodelPostRequestBody.md#sealedrequestbody) requestBody)
sets the optional property | +| [PostRequestBuilder](#postrequestbuilder) | serverIndex([RootServerInfo.ServerIndex](../../RootServerInfo.md#serverindex) serverIndex)
sets the optional property. Note: this will override the value in apiConfiguration | +| [PostRequestBuilder](#postrequestbuilder) | timeout(Duration timeout)
sets the optional property. Note: this will override the value in apiConfiguration | + +[[Back to top]](#top) [[Back to README]](../../../README.md) diff --git a/samples/client/petstore/kotlin/docs/paths/fakerefsarraymodel/post/FakerefsarraymodelPostRequestBody.md b/samples/client/petstore/kotlin/docs/paths/fakerefsarraymodel/post/FakerefsarraymodelPostRequestBody.md new file mode 100644 index 00000000000..ad39f5baa4a --- /dev/null +++ b/samples/client/petstore/kotlin/docs/paths/fakerefsarraymodel/post/FakerefsarraymodelPostRequestBody.md @@ -0,0 +1,90 @@ +# FakerefsarraymodelPostRequestBody + +public class FakerefsarraymodelPostRequestBody + +A class that contains necessary nested request body classes +- SealedMediaType, a sealed interface which contains all the schema/encoding info for each contentType +- records which implement SealedMediaType, the concrete media types +- a class that extends RequestBodySerializer and is used to serialize input SealedRequestBody instances +- SealedRequestBody, a sealed interface which contains all the contentType/schema input types +- records which implement SealedRequestBody, the concrete request body types + +## Nested Class Summary +| Modifier and Type | Class and Description | +| ----------------- | --------------------- | +| sealed interface | [FakerefsarraymodelPostRequestBody.SealedMediaType](#sealedmediatype)
media type sealed interface | +| record | [FakerefsarraymodelPostRequestBody.ApplicationjsonMediaType](#applicationjsonmediatype)
record storing schema + encoding for a specific contentType | +| static class | [FakerefsarraymodelPostRequestBody.FakerefsarraymodelPostRequestBody1](#fakerefsarraymodelpostrequestbody1)
class that serializes request bodies | +| sealed interface | [FakerefsarraymodelPostRequestBody.SealedRequestBody](#sealedrequestbody)
request body sealed interface | +| record | [FakerefsarraymodelPostRequestBody.ApplicationjsonRequestBody](#applicationjsonrequestbody)
implements sealed interface to store request body input | + +## SealedMediaType +public sealed interface SealedMediaType
+permits
+[ApplicationjsonMediaType](#applicationjsonmediatype) + +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), Nothing?> + +class storing schema info for a specific contentType + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| ApplicationjsonMediaType()
Creates an instance | + +### 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 | +| Nothing? | encoding()
the encoding info | + +## FakerefsarraymodelPostRequestBody1 +public static class FakerefsarraymodelPostRequestBody1
+ +a class that serializes SealedRequestBody request bodies + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| FakerefsarraymodelPostRequestBody1()
Creates an instance | + +### Field Summary +| Modifier and Type | Field and Description | +| ----------------- | --------------------- | +| boolean | required = false
whether the request body is required | +| 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 | +| ----------------- | ---------------------- | +| SerializedRequestBody | serialize([SealedRequestBody](#sealedrequestbody) requestBody)
called by endpoint when creating request body bytes | + +## SealedRequestBody +public sealed interface SealedRequestBody
+permits
+[ApplicationjsonRequestBody](#applicationjsonrequestbody) + +sealed interface that stores request contentType + validated schema data + +## ApplicationjsonRequestBody +public record ApplicationjsonRequestBody
+implements [SealedRequestBody](#sealedrequestbody),
+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 | + +### 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 | diff --git a/samples/client/petstore/kotlin/docs/paths/fakerefsarraymodel/post/FakerefsarraymodelPostResponses.md b/samples/client/petstore/kotlin/docs/paths/fakerefsarraymodel/post/FakerefsarraymodelPostResponses.md new file mode 100644 index 00000000000..df6d66583f8 --- /dev/null +++ b/samples/client/petstore/kotlin/docs/paths/fakerefsarraymodel/post/FakerefsarraymodelPostResponses.md @@ -0,0 +1,29 @@ +# FakerefsarraymodelPostResponses + +public class FakerefsarraymodelPostResponses + +A class that contains necessary responses classes +- a sealed interface, EndpointResponse, that stores endpoint responses +- records for each endpoint response + +## Nested Class Summary +| Modifier and Type | Class and Description | +| ----------------- | --------------------- | +| sealed interface | [EndpointResponse](#endpointresponse)
stores the endpoint responses | +| record | [EndpointFakerefsarraymodelPostCode200Response](#endpointfakerefsarraymodelpostcode200response)
the response for 200 | + +## EndpointResponse +public sealed interface EndpointResponse permits
+[EndpointFakerefsarraymodelPostCode200Response](#endpointfakerefsarraymodelpostcode200response) + +a sealed interface that stores endpoint responses + +## EndpointFakerefsarraymodelPostCode200Response +public record EndpointFakerefsarraymodelPostCode200Response( + HttpResponse response, + [FakerefsarraymodelPostCode200Response.SealedResponseBody](../../../paths/fakerefsarraymodel/post/responses/FakerefsarraymodelPostCode200Response.md#sealedresponsebody) body, + Nothing? headers +) implements EndpointResponse, ApiResponse
+ +a class that stores an endpoint response + diff --git a/samples/client/petstore/kotlin/docs/paths/fakerefsarraymodel/post/requestbody/content/applicationjson/ApplicationjsonSchema.md b/samples/client/petstore/kotlin/docs/paths/fakerefsarraymodel/post/requestbody/content/applicationjson/ApplicationjsonSchema.md new file mode 100644 index 00000000000..1418728fbd4 --- /dev/null +++ b/samples/client/petstore/kotlin/docs/paths/fakerefsarraymodel/post/requestbody/content/applicationjson/ApplicationjsonSchema.md @@ -0,0 +1,19 @@ +# ApplicationjsonSchema +public class ApplicationjsonSchema
+extends [AnimalFarm1](../../../../../../components/schemas/AnimalFarm.md#animalfarm) + +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 + +## Nested Class Summary +| Modifier and Type | Class and Description | +| ----------------- | ---------------------- | +| static class | [ApplicationjsonSchema.ApplicationjsonSchema1](#applicationjsonschema1)
schema class | + +## ApplicationjsonSchema1 +public static class ApplicationjsonSchema1
+extends [AnimalFarm.AnimalFarm1](../../../../../../components/schemas/AnimalFarm.md#animalfarm1) + +A schema class that validates payloads diff --git a/samples/client/petstore/kotlin/docs/paths/fakerefsarraymodel/post/responses/FakerefsarraymodelPostCode200Response.md b/samples/client/petstore/kotlin/docs/paths/fakerefsarraymodel/post/responses/FakerefsarraymodelPostCode200Response.md new file mode 100644 index 00000000000..d59ace399a1 --- /dev/null +++ b/samples/client/petstore/kotlin/docs/paths/fakerefsarraymodel/post/responses/FakerefsarraymodelPostCode200Response.md @@ -0,0 +1,87 @@ +# FakerefsarraymodelPostCode200Response + +public class FakerefsarraymodelPostCode200Response + +A class that contains necessary nested response classes +- SealedMediaType, a sealed interface which contains all the schema/encoding info for each contentType +- records which implement SealedMediaType, the concrete media types +- SealedResponseBody, a sealed interface which contains all the contentType/schema types +- records which implement SealedResponseBody, the concrete response body types +- a class that extends ResponseDeserializer and is used to deserialize responses + +## Nested Class Summary +| Modifier and Type | Class and Description | +| ----------------- | --------------------- | +| sealed interface | [FakerefsarraymodelPostCode200Response.SealedMediaType](#sealedmediatype)
media type sealed interface | +| record | [FakerefsarraymodelPostCode200Response.ApplicationjsonMediaType](#applicationjsonmediatype)
record storing schema + encoding for a specific contentType | +| sealed interface | [FakerefsarraymodelPostCode200Response.SealedResponseBody](#sealedresponsebody)
response body sealed interface | +| record | [FakerefsarraymodelPostCode200Response.ApplicationjsonResponseBody](#applicationjsonresponsebody)
implements sealed interface to store response body | +| static class | [FakerefsarraymodelPostCode200Response.FakerefsarraymodelPostCode200Response1](#fakerefsarraymodelpostcode200response1)
class that deserializes responses | + +## SealedMediaType +public sealed interface SealedMediaType
+permits
+[ApplicationjsonMediaType](#applicationjsonmediatype) + +sealed interface that stores schema and encoding info + +## ApplicationjsonMediaType +public record ApplicationjsonMediaType
+implements [SealedMediaType](#sealedmediatype), MediaType<[ApplicationjsonSchema.ApplicationjsonSchema1](../../../../paths/fakerefsarraymodel/post/responses/code200response/content/applicationjson/ApplicationjsonSchema.md#applicationjsonschema1), Nothing?> + +class storing schema info for a specific contentType + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| ApplicationjsonMediaType()
Creates an instance | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| [ApplicationjsonSchema.ApplicationjsonSchema1](../../../../paths/fakerefsarraymodel/post/responses/code200response/content/applicationjson/ApplicationjsonSchema.md#applicationjsonschema1) | schema()
the schema for this MediaType | +| Nothing? | encoding()
the encoding info | + +## SealedResponseBody +public sealed interface SealedResponseBody
+permits
+[ApplicationjsonResponseBody](#applicationjsonresponsebody) + +sealed interface that stores response body + +## ApplicationjsonResponseBody +public record ApplicationjsonResponseBody
+implements [SealedResponseBody](#sealedresponsebody) + +A record class to store response body for contentType="application/json" + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| ApplicationjsonResponseBody(ApplicationjsonSchema.[AnimalFarm1Boxed](../../../../components/schemas/AnimalFarm.md#animalfarm1boxed) body)
Creates an instance | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| ApplicationjsonSchema.[AnimalFarm1Boxed](../../../../components/schemas/AnimalFarm.md#animalfarm1boxed) | body()
returns the body passed in in the constructor | + +## FakerefsarraymodelPostCode200Response1 +public static class FakerefsarraymodelPostCode200Response1
+extends ResponseDeserializer<[SealedResponseBody](#sealedresponsebody), Nothing?, [SealedMediaType](#sealedmediatype)> + +a class that deserializes responses + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| FakerefsarraymodelPostCode200Response1()
Creates an instance | + +### Field Summary +| Modifier and Type | Field and Description | +| ----------------- | --------------------- | +| 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 | +| ----------------- | ---------------------- | +| ApiResponse<[SealedResponseBody](#sealedresponsebody), Nothing?> | deserialize(HttpResponse response, SchemaConfiguration configuration)
called by endpoint when deserialize responses | diff --git a/samples/client/petstore/kotlin/docs/paths/fakerefsarraymodel/post/responses/code200response/content/applicationjson/ApplicationjsonSchema.md b/samples/client/petstore/kotlin/docs/paths/fakerefsarraymodel/post/responses/code200response/content/applicationjson/ApplicationjsonSchema.md new file mode 100644 index 00000000000..f4786efc35d --- /dev/null +++ b/samples/client/petstore/kotlin/docs/paths/fakerefsarraymodel/post/responses/code200response/content/applicationjson/ApplicationjsonSchema.md @@ -0,0 +1,19 @@ +# ApplicationjsonSchema +public class ApplicationjsonSchema
+extends [AnimalFarm1](../../../../../../../components/schemas/AnimalFarm.md#animalfarm) + +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 + +## Nested Class Summary +| Modifier and Type | Class and Description | +| ----------------- | ---------------------- | +| static class | [ApplicationjsonSchema.ApplicationjsonSchema1](#applicationjsonschema1)
schema class | + +## ApplicationjsonSchema1 +public static class ApplicationjsonSchema1
+extends [AnimalFarm.AnimalFarm1](../../../../../../../components/schemas/AnimalFarm.md#animalfarm1) + +A schema class that validates payloads diff --git a/samples/client/petstore/kotlin/docs/paths/fakerefsarrayofenums/FakerefsarrayofenumsPost.md b/samples/client/petstore/kotlin/docs/paths/fakerefsarrayofenums/FakerefsarrayofenumsPost.md new file mode 100644 index 00000000000..bad74ab9f4c --- /dev/null +++ b/samples/client/petstore/kotlin/docs/paths/fakerefsarrayofenums/FakerefsarrayofenumsPost.md @@ -0,0 +1,148 @@ +# FakerefsarrayofenumsPost + +public class FakerefsarrayofenumsPost + +A class that contains necessary endpoint classes +- a class that calls the endpoint method using the http verb +- a class that calls the endpoint method using the operationId name +- class(es) to store the request inputs +- builder(s) to set the request input data + +## Nested Class Summary +| Modifier and Type | Class and Description | +| ----------------- | --------------------- | +| static class | [Post](#post)
The class that has a post method to call the endpoint | +| interface | [ArrayOfEnumsOperation](#arrayofenumsoperation)
The interface that has a arrayOfEnums method to call the endpoint | +| static class | [PostRequest](#postrequest)
The request inputs class | +| static class | [PostRequestBuilder](#postrequestbuilder)
A builder for the request input class | + +## Post +public static class Post 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.FakerefsarrayofenumsPostRequestBody; +import org.openapijsonschematools.client.components.schemas.ArrayOfEnums; +import org.openapijsonschematools.client.RootServerInfo; +import org.openapijsonschematools.client.servers.RootServer0; +import org.openapijsonschematools.client.servers.RootServer1; +import org.openapijsonschematools.client.servers.RootServer2; +import org.openapijsonschematools.client.paths.fakerefsarrayofenums.post.responses.FakerefsarrayofenumsPostCode200Response; +import org.openapijsonschematools.client.servers.RootServerInfo; +import org.openapijsonschematools.client.paths.fakerefsarrayofenums.FakerefsarrayofenumsPost; +import org.openapijsonschematools.client.paths.fakerefsarrayofenums.post.FakerefsarrayofenumsPostResponses; + +import java.io.IOException; +import java.util.Arrays; +import java.util.List; +import java.util.Map; +import java.util.AbstractMap; + +// if you want to use a server that is not SERVER_0 pass it in here and change the ServerIndex input below +ApiConfiguration.ServerInfo serverInfo = new ApiConfiguration.ServerInfoBuilder() + .rootServerInfo( + new RootServerInfo.RootServerInfoBuilder() + .rootServer0(new RootServer0()) + .build() + ) + .build(); +ApiConfiguration.ServerIndexInfo serverIndexInfo = new ApiConfiguration.ServerIndexInfoBuilder() + .rootServerInfoServerIndex(RootServerInfo.ServerIndex.SERVER_0) + .build(); +Duration timeout = Duration.ofSeconds(1L); +Map> defaultHeaders = Map.of("User-Agent", List.of("OpenAPI-JSON-Schema-Generator/1.0.0/java")); +ApiConfiguration apiConfiguration = new ApiConfiguration( + serverInfo + serverIndexInfo, + timeout, + defaultHeaders +); +SchemaConfiguration schemaConfiguration = new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().build()); +FakerefsarrayofenumsPost.Post apiClient = new FakerefsarrayofenumsPost.Post(apiConfiguration, schemaConfiguration); + + +var request = new FakerefsarrayofenumsPost.PostRequestBuilder().build(); + +FakerefsarrayofenumsPostResponses.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; +} +FakerefsarrayofenumsPostResponses.EndpointFakerefsarrayofenumsPostCode200Response castResponse = (FakerefsarrayofenumsPostResponses.EndpointFakerefsarrayofenumsPostCode200Response) response; +FakerefsarrayofenumsPostCode200Response.ApplicationjsonResponseBody deserializedBody = (FakerefsarrayofenumsPostCode200Response.ApplicationjsonResponseBody) castResponse.body; +// handle deserialized body here +``` +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| Post(ApiConfiguration apiConfiguration, SchemaConfiguration schemaConfiguration)
Creates an instance | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| [FakerefsarrayofenumsPostResponses.EndpointResponse](../../paths/fakerefsarrayofenums/post/FakerefsarrayofenumsPostResponses.md#endpointresponse) | post([PostRequest](#postrequest) request) | + +## ArrayOfEnumsOperation +public interface ArrayOfEnumsOperation
+ +an interface that allows one to call the endpoint using a method named arrayOfEnums by the operationId + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| [FakerefsarrayofenumsPostResponses.EndpointResponse](../../paths/fakerefsarrayofenums/post/FakerefsarrayofenumsPostResponses.md#endpointresponse) | arrayOfEnums([PostRequest](#postrequest) request) | + +## PostRequest +public static class PostRequest
+ +a class that stores the final request inputs + +### Field Summary +| Modifier and Type | Field and Description | +| ----------------- | --------------------- | +| [FakerefsarrayofenumsPostRequestBody.@Nullable SealedRequestBody](../../paths/fakerefsarrayofenums/post/FakerefsarrayofenumsPostRequestBody.md#sealedrequestbody) | requestBody
optional | +| [RootServerInfo.@Nullable ServerIndex](../../RootServerInfo.md#serverindex) | serverIndex
optional. Note: this will override the value in apiConfiguration | +| @Nullable Duration | timeout
optional. Note: this will override the value in apiConfiguration | + +## PostRequestBuilder +public static class PostRequestBuilder
+ +a builder for request inputs + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| PostRequestBuilder()
Creates a builder that contains null for all parameters | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| [PostRequest](#postrequest) | build()
Returns the request input used to call an endpoint method | +| [PostRequestBuilder](#postrequestbuilder) | requestBody([FakerefsarrayofenumsPostRequestBody.SealedRequestBody](../../paths/fakerefsarrayofenums/post/FakerefsarrayofenumsPostRequestBody.md#sealedrequestbody) requestBody)
sets the optional property | +| [PostRequestBuilder](#postrequestbuilder) | serverIndex([RootServerInfo.ServerIndex](../../RootServerInfo.md#serverindex) serverIndex)
sets the optional property. Note: this will override the value in apiConfiguration | +| [PostRequestBuilder](#postrequestbuilder) | timeout(Duration timeout)
sets the optional property. Note: this will override the value in apiConfiguration | + +[[Back to top]](#top) [[Back to README]](../../../README.md) diff --git a/samples/client/petstore/kotlin/docs/paths/fakerefsarrayofenums/post/FakerefsarrayofenumsPostRequestBody.md b/samples/client/petstore/kotlin/docs/paths/fakerefsarrayofenums/post/FakerefsarrayofenumsPostRequestBody.md new file mode 100644 index 00000000000..7c08fd60fea --- /dev/null +++ b/samples/client/petstore/kotlin/docs/paths/fakerefsarrayofenums/post/FakerefsarrayofenumsPostRequestBody.md @@ -0,0 +1,90 @@ +# FakerefsarrayofenumsPostRequestBody + +public class FakerefsarrayofenumsPostRequestBody + +A class that contains necessary nested request body classes +- SealedMediaType, a sealed interface which contains all the schema/encoding info for each contentType +- records which implement SealedMediaType, the concrete media types +- a class that extends RequestBodySerializer and is used to serialize input SealedRequestBody instances +- SealedRequestBody, a sealed interface which contains all the contentType/schema input types +- records which implement SealedRequestBody, the concrete request body types + +## Nested Class Summary +| Modifier and Type | Class and Description | +| ----------------- | --------------------- | +| sealed interface | [FakerefsarrayofenumsPostRequestBody.SealedMediaType](#sealedmediatype)
media type sealed interface | +| record | [FakerefsarrayofenumsPostRequestBody.ApplicationjsonMediaType](#applicationjsonmediatype)
record storing schema + encoding for a specific contentType | +| static class | [FakerefsarrayofenumsPostRequestBody.FakerefsarrayofenumsPostRequestBody1](#fakerefsarrayofenumspostrequestbody1)
class that serializes request bodies | +| sealed interface | [FakerefsarrayofenumsPostRequestBody.SealedRequestBody](#sealedrequestbody)
request body sealed interface | +| record | [FakerefsarrayofenumsPostRequestBody.ApplicationjsonRequestBody](#applicationjsonrequestbody)
implements sealed interface to store request body input | + +## SealedMediaType +public sealed interface SealedMediaType
+permits
+[ApplicationjsonMediaType](#applicationjsonmediatype) + +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), Nothing?> + +class storing schema info for a specific contentType + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| ApplicationjsonMediaType()
Creates an instance | + +### 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 | +| Nothing? | encoding()
the encoding info | + +## FakerefsarrayofenumsPostRequestBody1 +public static class FakerefsarrayofenumsPostRequestBody1
+ +a class that serializes SealedRequestBody request bodies + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| FakerefsarrayofenumsPostRequestBody1()
Creates an instance | + +### Field Summary +| Modifier and Type | Field and Description | +| ----------------- | --------------------- | +| boolean | required = false
whether the request body is required | +| 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 | +| ----------------- | ---------------------- | +| SerializedRequestBody | serialize([SealedRequestBody](#sealedrequestbody) requestBody)
called by endpoint when creating request body bytes | + +## SealedRequestBody +public sealed interface SealedRequestBody
+permits
+[ApplicationjsonRequestBody](#applicationjsonrequestbody) + +sealed interface that stores request contentType + validated schema data + +## ApplicationjsonRequestBody +public record ApplicationjsonRequestBody
+implements [SealedRequestBody](#sealedrequestbody),
+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 | + +### 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 | diff --git a/samples/client/petstore/kotlin/docs/paths/fakerefsarrayofenums/post/FakerefsarrayofenumsPostResponses.md b/samples/client/petstore/kotlin/docs/paths/fakerefsarrayofenums/post/FakerefsarrayofenumsPostResponses.md new file mode 100644 index 00000000000..9e0cd26ec18 --- /dev/null +++ b/samples/client/petstore/kotlin/docs/paths/fakerefsarrayofenums/post/FakerefsarrayofenumsPostResponses.md @@ -0,0 +1,29 @@ +# FakerefsarrayofenumsPostResponses + +public class FakerefsarrayofenumsPostResponses + +A class that contains necessary responses classes +- a sealed interface, EndpointResponse, that stores endpoint responses +- records for each endpoint response + +## Nested Class Summary +| Modifier and Type | Class and Description | +| ----------------- | --------------------- | +| sealed interface | [EndpointResponse](#endpointresponse)
stores the endpoint responses | +| record | [EndpointFakerefsarrayofenumsPostCode200Response](#endpointfakerefsarrayofenumspostcode200response)
the response for 200 | + +## EndpointResponse +public sealed interface EndpointResponse permits
+[EndpointFakerefsarrayofenumsPostCode200Response](#endpointfakerefsarrayofenumspostcode200response) + +a sealed interface that stores endpoint responses + +## EndpointFakerefsarrayofenumsPostCode200Response +public record EndpointFakerefsarrayofenumsPostCode200Response( + HttpResponse response, + [FakerefsarrayofenumsPostCode200Response.SealedResponseBody](../../../paths/fakerefsarrayofenums/post/responses/FakerefsarrayofenumsPostCode200Response.md#sealedresponsebody) body, + Nothing? headers +) implements EndpointResponse, ApiResponse
+ +a class that stores an endpoint response + diff --git a/samples/client/petstore/kotlin/docs/paths/fakerefsarrayofenums/post/requestbody/content/applicationjson/ApplicationjsonSchema.md b/samples/client/petstore/kotlin/docs/paths/fakerefsarrayofenums/post/requestbody/content/applicationjson/ApplicationjsonSchema.md new file mode 100644 index 00000000000..c49c361c228 --- /dev/null +++ b/samples/client/petstore/kotlin/docs/paths/fakerefsarrayofenums/post/requestbody/content/applicationjson/ApplicationjsonSchema.md @@ -0,0 +1,19 @@ +# ApplicationjsonSchema +public class ApplicationjsonSchema
+extends [ArrayOfEnums1](../../../../../../components/schemas/ArrayOfEnums.md#arrayofenums) + +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 + +## Nested Class Summary +| Modifier and Type | Class and Description | +| ----------------- | ---------------------- | +| static class | [ApplicationjsonSchema.ApplicationjsonSchema1](#applicationjsonschema1)
schema class | + +## ApplicationjsonSchema1 +public static class ApplicationjsonSchema1
+extends [ArrayOfEnums.ArrayOfEnums1](../../../../../../components/schemas/ArrayOfEnums.md#arrayofenums1) + +A schema class that validates payloads diff --git a/samples/client/petstore/kotlin/docs/paths/fakerefsarrayofenums/post/responses/FakerefsarrayofenumsPostCode200Response.md b/samples/client/petstore/kotlin/docs/paths/fakerefsarrayofenums/post/responses/FakerefsarrayofenumsPostCode200Response.md new file mode 100644 index 00000000000..e56c2bfa7a8 --- /dev/null +++ b/samples/client/petstore/kotlin/docs/paths/fakerefsarrayofenums/post/responses/FakerefsarrayofenumsPostCode200Response.md @@ -0,0 +1,87 @@ +# FakerefsarrayofenumsPostCode200Response + +public class FakerefsarrayofenumsPostCode200Response + +A class that contains necessary nested response classes +- SealedMediaType, a sealed interface which contains all the schema/encoding info for each contentType +- records which implement SealedMediaType, the concrete media types +- SealedResponseBody, a sealed interface which contains all the contentType/schema types +- records which implement SealedResponseBody, the concrete response body types +- a class that extends ResponseDeserializer and is used to deserialize responses + +## Nested Class Summary +| Modifier and Type | Class and Description | +| ----------------- | --------------------- | +| sealed interface | [FakerefsarrayofenumsPostCode200Response.SealedMediaType](#sealedmediatype)
media type sealed interface | +| record | [FakerefsarrayofenumsPostCode200Response.ApplicationjsonMediaType](#applicationjsonmediatype)
record storing schema + encoding for a specific contentType | +| sealed interface | [FakerefsarrayofenumsPostCode200Response.SealedResponseBody](#sealedresponsebody)
response body sealed interface | +| record | [FakerefsarrayofenumsPostCode200Response.ApplicationjsonResponseBody](#applicationjsonresponsebody)
implements sealed interface to store response body | +| static class | [FakerefsarrayofenumsPostCode200Response.FakerefsarrayofenumsPostCode200Response1](#fakerefsarrayofenumspostcode200response1)
class that deserializes responses | + +## SealedMediaType +public sealed interface SealedMediaType
+permits
+[ApplicationjsonMediaType](#applicationjsonmediatype) + +sealed interface that stores schema and encoding info + +## ApplicationjsonMediaType +public record ApplicationjsonMediaType
+implements [SealedMediaType](#sealedmediatype), MediaType<[ApplicationjsonSchema.ApplicationjsonSchema1](../../../../paths/fakerefsarrayofenums/post/responses/code200response/content/applicationjson/ApplicationjsonSchema.md#applicationjsonschema1), Nothing?> + +class storing schema info for a specific contentType + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| ApplicationjsonMediaType()
Creates an instance | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| [ApplicationjsonSchema.ApplicationjsonSchema1](../../../../paths/fakerefsarrayofenums/post/responses/code200response/content/applicationjson/ApplicationjsonSchema.md#applicationjsonschema1) | schema()
the schema for this MediaType | +| Nothing? | encoding()
the encoding info | + +## SealedResponseBody +public sealed interface SealedResponseBody
+permits
+[ApplicationjsonResponseBody](#applicationjsonresponsebody) + +sealed interface that stores response body + +## ApplicationjsonResponseBody +public record ApplicationjsonResponseBody
+implements [SealedResponseBody](#sealedresponsebody) + +A record class to store response body for contentType="application/json" + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| ApplicationjsonResponseBody(ApplicationjsonSchema.[ArrayOfEnums1Boxed](../../../../components/schemas/ArrayOfEnums.md#arrayofenums1boxed) body)
Creates an instance | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| ApplicationjsonSchema.[ArrayOfEnums1Boxed](../../../../components/schemas/ArrayOfEnums.md#arrayofenums1boxed) | body()
returns the body passed in in the constructor | + +## FakerefsarrayofenumsPostCode200Response1 +public static class FakerefsarrayofenumsPostCode200Response1
+extends ResponseDeserializer<[SealedResponseBody](#sealedresponsebody), Nothing?, [SealedMediaType](#sealedmediatype)> + +a class that deserializes responses + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| FakerefsarrayofenumsPostCode200Response1()
Creates an instance | + +### Field Summary +| Modifier and Type | Field and Description | +| ----------------- | --------------------- | +| 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 | +| ----------------- | ---------------------- | +| ApiResponse<[SealedResponseBody](#sealedresponsebody), Nothing?> | deserialize(HttpResponse response, SchemaConfiguration configuration)
called by endpoint when deserialize responses | diff --git a/samples/client/petstore/kotlin/docs/paths/fakerefsarrayofenums/post/responses/code200response/content/applicationjson/ApplicationjsonSchema.md b/samples/client/petstore/kotlin/docs/paths/fakerefsarrayofenums/post/responses/code200response/content/applicationjson/ApplicationjsonSchema.md new file mode 100644 index 00000000000..82450aa4900 --- /dev/null +++ b/samples/client/petstore/kotlin/docs/paths/fakerefsarrayofenums/post/responses/code200response/content/applicationjson/ApplicationjsonSchema.md @@ -0,0 +1,19 @@ +# ApplicationjsonSchema +public class ApplicationjsonSchema
+extends [ArrayOfEnums1](../../../../../../../components/schemas/ArrayOfEnums.md#arrayofenums) + +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 + +## Nested Class Summary +| Modifier and Type | Class and Description | +| ----------------- | ---------------------- | +| static class | [ApplicationjsonSchema.ApplicationjsonSchema1](#applicationjsonschema1)
schema class | + +## ApplicationjsonSchema1 +public static class ApplicationjsonSchema1
+extends [ArrayOfEnums.ArrayOfEnums1](../../../../../../../components/schemas/ArrayOfEnums.md#arrayofenums1) + +A schema class that validates payloads diff --git a/samples/client/petstore/kotlin/docs/paths/fakerefsboolean/FakerefsbooleanPost.md b/samples/client/petstore/kotlin/docs/paths/fakerefsboolean/FakerefsbooleanPost.md new file mode 100644 index 00000000000..e24e63e6ee3 --- /dev/null +++ b/samples/client/petstore/kotlin/docs/paths/fakerefsboolean/FakerefsbooleanPost.md @@ -0,0 +1,148 @@ +# FakerefsbooleanPost + +public class FakerefsbooleanPost + +A class that contains necessary endpoint classes +- a class that calls the endpoint method using the http verb +- a class that calls the endpoint method using the operationId name +- class(es) to store the request inputs +- builder(s) to set the request input data + +## Nested Class Summary +| Modifier and Type | Class and Description | +| ----------------- | --------------------- | +| static class | [Post](#post)
The class that has a post method to call the endpoint | +| interface | [ModelBooleanOperation](#modelbooleanoperation)
The interface that has a modelBoolean method to call the endpoint | +| static class | [PostRequest](#postrequest)
The request inputs class | +| static class | [PostRequestBuilder](#postrequestbuilder)
A builder for the request input class | + +## Post +public static class Post 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.FakerefsbooleanPostRequestBody; +import org.openapijsonschematools.client.components.schemas.BooleanSchema; +import org.openapijsonschematools.client.RootServerInfo; +import org.openapijsonschematools.client.servers.RootServer0; +import org.openapijsonschematools.client.servers.RootServer1; +import org.openapijsonschematools.client.servers.RootServer2; +import org.openapijsonschematools.client.paths.fakerefsboolean.post.responses.FakerefsbooleanPostCode200Response; +import org.openapijsonschematools.client.servers.RootServerInfo; +import org.openapijsonschematools.client.paths.fakerefsboolean.FakerefsbooleanPost; +import org.openapijsonschematools.client.paths.fakerefsboolean.post.FakerefsbooleanPostResponses; + +import java.io.IOException; +import java.util.Arrays; +import java.util.List; +import java.util.Map; +import java.util.AbstractMap; + +// if you want to use a server that is not SERVER_0 pass it in here and change the ServerIndex input below +ApiConfiguration.ServerInfo serverInfo = new ApiConfiguration.ServerInfoBuilder() + .rootServerInfo( + new RootServerInfo.RootServerInfoBuilder() + .rootServer0(new RootServer0()) + .build() + ) + .build(); +ApiConfiguration.ServerIndexInfo serverIndexInfo = new ApiConfiguration.ServerIndexInfoBuilder() + .rootServerInfoServerIndex(RootServerInfo.ServerIndex.SERVER_0) + .build(); +Duration timeout = Duration.ofSeconds(1L); +Map> defaultHeaders = Map.of("User-Agent", List.of("OpenAPI-JSON-Schema-Generator/1.0.0/java")); +ApiConfiguration apiConfiguration = new ApiConfiguration( + serverInfo + serverIndexInfo, + timeout, + defaultHeaders +); +SchemaConfiguration schemaConfiguration = new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().build()); +FakerefsbooleanPost.Post apiClient = new FakerefsbooleanPost.Post(apiConfiguration, schemaConfiguration); + + +var request = new FakerefsbooleanPost.PostRequestBuilder().build(); + +FakerefsbooleanPostResponses.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; +} +FakerefsbooleanPostResponses.EndpointFakerefsbooleanPostCode200Response castResponse = (FakerefsbooleanPostResponses.EndpointFakerefsbooleanPostCode200Response) response; +FakerefsbooleanPostCode200Response.ApplicationjsonResponseBody deserializedBody = (FakerefsbooleanPostCode200Response.ApplicationjsonResponseBody) castResponse.body; +// handle deserialized body here +``` +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| Post(ApiConfiguration apiConfiguration, SchemaConfiguration schemaConfiguration)
Creates an instance | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| [FakerefsbooleanPostResponses.EndpointResponse](../../paths/fakerefsboolean/post/FakerefsbooleanPostResponses.md#endpointresponse) | post([PostRequest](#postrequest) request) | + +## ModelBooleanOperation +public interface ModelBooleanOperation
+ +an interface that allows one to call the endpoint using a method named modelBoolean by the operationId + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| [FakerefsbooleanPostResponses.EndpointResponse](../../paths/fakerefsboolean/post/FakerefsbooleanPostResponses.md#endpointresponse) | modelBoolean([PostRequest](#postrequest) request) | + +## PostRequest +public static class PostRequest
+ +a class that stores the final request inputs + +### Field Summary +| Modifier and Type | Field and Description | +| ----------------- | --------------------- | +| [FakerefsbooleanPostRequestBody.@Nullable SealedRequestBody](../../paths/fakerefsboolean/post/FakerefsbooleanPostRequestBody.md#sealedrequestbody) | requestBody
optional | +| [RootServerInfo.@Nullable ServerIndex](../../RootServerInfo.md#serverindex) | serverIndex
optional. Note: this will override the value in apiConfiguration | +| @Nullable Duration | timeout
optional. Note: this will override the value in apiConfiguration | + +## PostRequestBuilder +public static class PostRequestBuilder
+ +a builder for request inputs + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| PostRequestBuilder()
Creates a builder that contains null for all parameters | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| [PostRequest](#postrequest) | build()
Returns the request input used to call an endpoint method | +| [PostRequestBuilder](#postrequestbuilder) | requestBody([FakerefsbooleanPostRequestBody.SealedRequestBody](../../paths/fakerefsboolean/post/FakerefsbooleanPostRequestBody.md#sealedrequestbody) requestBody)
sets the optional property | +| [PostRequestBuilder](#postrequestbuilder) | serverIndex([RootServerInfo.ServerIndex](../../RootServerInfo.md#serverindex) serverIndex)
sets the optional property. Note: this will override the value in apiConfiguration | +| [PostRequestBuilder](#postrequestbuilder) | timeout(Duration timeout)
sets the optional property. Note: this will override the value in apiConfiguration | + +[[Back to top]](#top) [[Back to README]](../../../README.md) diff --git a/samples/client/petstore/kotlin/docs/paths/fakerefsboolean/post/FakerefsbooleanPostRequestBody.md b/samples/client/petstore/kotlin/docs/paths/fakerefsboolean/post/FakerefsbooleanPostRequestBody.md new file mode 100644 index 00000000000..4ea0943cd69 --- /dev/null +++ b/samples/client/petstore/kotlin/docs/paths/fakerefsboolean/post/FakerefsbooleanPostRequestBody.md @@ -0,0 +1,90 @@ +# FakerefsbooleanPostRequestBody + +public class FakerefsbooleanPostRequestBody + +A class that contains necessary nested request body classes +- SealedMediaType, a sealed interface which contains all the schema/encoding info for each contentType +- records which implement SealedMediaType, the concrete media types +- a class that extends RequestBodySerializer and is used to serialize input SealedRequestBody instances +- SealedRequestBody, a sealed interface which contains all the contentType/schema input types +- records which implement SealedRequestBody, the concrete request body types + +## Nested Class Summary +| Modifier and Type | Class and Description | +| ----------------- | --------------------- | +| sealed interface | [FakerefsbooleanPostRequestBody.SealedMediaType](#sealedmediatype)
media type sealed interface | +| record | [FakerefsbooleanPostRequestBody.ApplicationjsonMediaType](#applicationjsonmediatype)
record storing schema + encoding for a specific contentType | +| static class | [FakerefsbooleanPostRequestBody.FakerefsbooleanPostRequestBody1](#fakerefsbooleanpostrequestbody1)
class that serializes request bodies | +| sealed interface | [FakerefsbooleanPostRequestBody.SealedRequestBody](#sealedrequestbody)
request body sealed interface | +| record | [FakerefsbooleanPostRequestBody.ApplicationjsonRequestBody](#applicationjsonrequestbody)
implements sealed interface to store request body input | + +## SealedMediaType +public sealed interface SealedMediaType
+permits
+[ApplicationjsonMediaType](#applicationjsonmediatype) + +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), Nothing?> + +class storing schema info for a specific contentType + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| ApplicationjsonMediaType()
Creates an instance | + +### 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 | +| Nothing? | encoding()
the encoding info | + +## FakerefsbooleanPostRequestBody1 +public static class FakerefsbooleanPostRequestBody1
+ +a class that serializes SealedRequestBody request bodies + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| FakerefsbooleanPostRequestBody1()
Creates an instance | + +### Field Summary +| Modifier and Type | Field and Description | +| ----------------- | --------------------- | +| boolean | required = false
whether the request body is required | +| 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 | +| ----------------- | ---------------------- | +| SerializedRequestBody | serialize([SealedRequestBody](#sealedrequestbody) requestBody)
called by endpoint when creating request body bytes | + +## SealedRequestBody +public sealed interface SealedRequestBody
+permits
+[ApplicationjsonRequestBody](#applicationjsonrequestbody) + +sealed interface that stores request contentType + validated schema data + +## ApplicationjsonRequestBody +public record ApplicationjsonRequestBody
+implements [SealedRequestBody](#sealedrequestbody),
+GenericRequestBody
+ +A record class to store request body input for contentType="application/json" + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| ApplicationjsonRequestBody(ApplicationjsonSchema.BooleanJsonSchema1Boxed body)
Creates an instance | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| String | contentType()
always returns "application/json" | +| ApplicationjsonSchema.BooleanJsonSchema1Boxed | body()
returns the body passed in in the constructor | diff --git a/samples/client/petstore/kotlin/docs/paths/fakerefsboolean/post/FakerefsbooleanPostResponses.md b/samples/client/petstore/kotlin/docs/paths/fakerefsboolean/post/FakerefsbooleanPostResponses.md new file mode 100644 index 00000000000..88deacbf059 --- /dev/null +++ b/samples/client/petstore/kotlin/docs/paths/fakerefsboolean/post/FakerefsbooleanPostResponses.md @@ -0,0 +1,29 @@ +# FakerefsbooleanPostResponses + +public class FakerefsbooleanPostResponses + +A class that contains necessary responses classes +- a sealed interface, EndpointResponse, that stores endpoint responses +- records for each endpoint response + +## Nested Class Summary +| Modifier and Type | Class and Description | +| ----------------- | --------------------- | +| sealed interface | [EndpointResponse](#endpointresponse)
stores the endpoint responses | +| record | [EndpointFakerefsbooleanPostCode200Response](#endpointfakerefsbooleanpostcode200response)
the response for 200 | + +## EndpointResponse +public sealed interface EndpointResponse permits
+[EndpointFakerefsbooleanPostCode200Response](#endpointfakerefsbooleanpostcode200response) + +a sealed interface that stores endpoint responses + +## EndpointFakerefsbooleanPostCode200Response +public record EndpointFakerefsbooleanPostCode200Response( + HttpResponse response, + [FakerefsbooleanPostCode200Response.SealedResponseBody](../../../paths/fakerefsboolean/post/responses/FakerefsbooleanPostCode200Response.md#sealedresponsebody) body, + Nothing? headers +) implements EndpointResponse, ApiResponse
+ +a class that stores an endpoint response + diff --git a/samples/client/petstore/kotlin/docs/paths/fakerefsboolean/post/requestbody/content/applicationjson/ApplicationjsonSchema.md b/samples/client/petstore/kotlin/docs/paths/fakerefsboolean/post/requestbody/content/applicationjson/ApplicationjsonSchema.md new file mode 100644 index 00000000000..d0446d3d804 --- /dev/null +++ b/samples/client/petstore/kotlin/docs/paths/fakerefsboolean/post/requestbody/content/applicationjson/ApplicationjsonSchema.md @@ -0,0 +1,19 @@ +# ApplicationjsonSchema +public class ApplicationjsonSchema
+extends [BooleanSchema1](../../../../../../components/schemas/BooleanSchema.md#booleanschema) + +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 + +## Nested Class Summary +| Modifier and Type | Class and Description | +| ----------------- | ---------------------- | +| static class | [ApplicationjsonSchema.ApplicationjsonSchema1](#applicationjsonschema1)
schema class | + +## ApplicationjsonSchema1 +public static class ApplicationjsonSchema1
+extends [BooleanSchema.BooleanSchema1](../../../../../../components/schemas/BooleanSchema.md#booleanschema1) + +A schema class that validates payloads diff --git a/samples/client/petstore/kotlin/docs/paths/fakerefsboolean/post/responses/FakerefsbooleanPostCode200Response.md b/samples/client/petstore/kotlin/docs/paths/fakerefsboolean/post/responses/FakerefsbooleanPostCode200Response.md new file mode 100644 index 00000000000..a3df212e20e --- /dev/null +++ b/samples/client/petstore/kotlin/docs/paths/fakerefsboolean/post/responses/FakerefsbooleanPostCode200Response.md @@ -0,0 +1,87 @@ +# FakerefsbooleanPostCode200Response + +public class FakerefsbooleanPostCode200Response + +A class that contains necessary nested response classes +- SealedMediaType, a sealed interface which contains all the schema/encoding info for each contentType +- records which implement SealedMediaType, the concrete media types +- SealedResponseBody, a sealed interface which contains all the contentType/schema types +- records which implement SealedResponseBody, the concrete response body types +- a class that extends ResponseDeserializer and is used to deserialize responses + +## Nested Class Summary +| Modifier and Type | Class and Description | +| ----------------- | --------------------- | +| sealed interface | [FakerefsbooleanPostCode200Response.SealedMediaType](#sealedmediatype)
media type sealed interface | +| record | [FakerefsbooleanPostCode200Response.ApplicationjsonMediaType](#applicationjsonmediatype)
record storing schema + encoding for a specific contentType | +| sealed interface | [FakerefsbooleanPostCode200Response.SealedResponseBody](#sealedresponsebody)
response body sealed interface | +| record | [FakerefsbooleanPostCode200Response.ApplicationjsonResponseBody](#applicationjsonresponsebody)
implements sealed interface to store response body | +| static class | [FakerefsbooleanPostCode200Response.FakerefsbooleanPostCode200Response1](#fakerefsbooleanpostcode200response1)
class that deserializes responses | + +## SealedMediaType +public sealed interface SealedMediaType
+permits
+[ApplicationjsonMediaType](#applicationjsonmediatype) + +sealed interface that stores schema and encoding info + +## ApplicationjsonMediaType +public record ApplicationjsonMediaType
+implements [SealedMediaType](#sealedmediatype), MediaType<[ApplicationjsonSchema.ApplicationjsonSchema1](../../../../paths/fakerefsboolean/post/responses/code200response/content/applicationjson/ApplicationjsonSchema.md#applicationjsonschema1), Nothing?> + +class storing schema info for a specific contentType + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| ApplicationjsonMediaType()
Creates an instance | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| [ApplicationjsonSchema.ApplicationjsonSchema1](../../../../paths/fakerefsboolean/post/responses/code200response/content/applicationjson/ApplicationjsonSchema.md#applicationjsonschema1) | schema()
the schema for this MediaType | +| Nothing? | encoding()
the encoding info | + +## SealedResponseBody +public sealed interface SealedResponseBody
+permits
+[ApplicationjsonResponseBody](#applicationjsonresponsebody) + +sealed interface that stores response body + +## ApplicationjsonResponseBody +public record ApplicationjsonResponseBody
+implements [SealedResponseBody](#sealedresponsebody) + +A record class to store response body for contentType="application/json" + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| ApplicationjsonResponseBody(ApplicationjsonSchema.BooleanJsonSchema1Boxed body)
Creates an instance | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| ApplicationjsonSchema.BooleanJsonSchema1Boxed | body()
returns the body passed in in the constructor | + +## FakerefsbooleanPostCode200Response1 +public static class FakerefsbooleanPostCode200Response1
+extends ResponseDeserializer<[SealedResponseBody](#sealedresponsebody), Nothing?, [SealedMediaType](#sealedmediatype)> + +a class that deserializes responses + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| FakerefsbooleanPostCode200Response1()
Creates an instance | + +### Field Summary +| Modifier and Type | Field and Description | +| ----------------- | --------------------- | +| 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 | +| ----------------- | ---------------------- | +| ApiResponse<[SealedResponseBody](#sealedresponsebody), Nothing?> | deserialize(HttpResponse response, SchemaConfiguration configuration)
called by endpoint when deserialize responses | diff --git a/samples/client/petstore/kotlin/docs/paths/fakerefsboolean/post/responses/code200response/content/applicationjson/ApplicationjsonSchema.md b/samples/client/petstore/kotlin/docs/paths/fakerefsboolean/post/responses/code200response/content/applicationjson/ApplicationjsonSchema.md new file mode 100644 index 00000000000..1694ac4a00a --- /dev/null +++ b/samples/client/petstore/kotlin/docs/paths/fakerefsboolean/post/responses/code200response/content/applicationjson/ApplicationjsonSchema.md @@ -0,0 +1,19 @@ +# ApplicationjsonSchema +public class ApplicationjsonSchema
+extends [BooleanSchema1](../../../../../../../components/schemas/BooleanSchema.md#booleanschema) + +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 + +## Nested Class Summary +| Modifier and Type | Class and Description | +| ----------------- | ---------------------- | +| static class | [ApplicationjsonSchema.ApplicationjsonSchema1](#applicationjsonschema1)
schema class | + +## ApplicationjsonSchema1 +public static class ApplicationjsonSchema1
+extends [BooleanSchema.BooleanSchema1](../../../../../../../components/schemas/BooleanSchema.md#booleanschema1) + +A schema class that validates payloads diff --git a/samples/client/petstore/kotlin/docs/paths/fakerefscomposedoneofnumberwithvalidations/FakerefscomposedoneofnumberwithvalidationsPost.md b/samples/client/petstore/kotlin/docs/paths/fakerefscomposedoneofnumberwithvalidations/FakerefscomposedoneofnumberwithvalidationsPost.md new file mode 100644 index 00000000000..731a2d4015d --- /dev/null +++ b/samples/client/petstore/kotlin/docs/paths/fakerefscomposedoneofnumberwithvalidations/FakerefscomposedoneofnumberwithvalidationsPost.md @@ -0,0 +1,148 @@ +# FakerefscomposedoneofnumberwithvalidationsPost + +public class FakerefscomposedoneofnumberwithvalidationsPost + +A class that contains necessary endpoint classes +- a class that calls the endpoint method using the http verb +- a class that calls the endpoint method using the operationId name +- class(es) to store the request inputs +- builder(s) to set the request input data + +## Nested Class Summary +| Modifier and Type | Class and Description | +| ----------------- | --------------------- | +| static class | [Post](#post)
The class that has a post method to call the endpoint | +| interface | [ComposedOneOfDifferentTypesOperation](#composedoneofdifferenttypesoperation)
The interface that has a composedOneOfDifferentTypes method to call the endpoint | +| static class | [PostRequest](#postrequest)
The request inputs class | +| static class | [PostRequestBuilder](#postrequestbuilder)
A builder for the request input class | + +## Post +public static class Post 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.FakerefscomposedoneofnumberwithvalidationsPostRequestBody; +import org.openapijsonschematools.client.components.schemas.ComposedOneOfDifferentTypes; +import org.openapijsonschematools.client.RootServerInfo; +import org.openapijsonschematools.client.servers.RootServer0; +import org.openapijsonschematools.client.servers.RootServer1; +import org.openapijsonschematools.client.servers.RootServer2; +import org.openapijsonschematools.client.paths.fakerefscomposedoneofnumberwithvalidations.post.responses.FakerefscomposedoneofnumberwithvalidationsPostCode200Response; +import org.openapijsonschematools.client.servers.RootServerInfo; +import org.openapijsonschematools.client.paths.fakerefscomposedoneofnumberwithvalidations.FakerefscomposedoneofnumberwithvalidationsPost; +import org.openapijsonschematools.client.paths.fakerefscomposedoneofnumberwithvalidations.post.FakerefscomposedoneofnumberwithvalidationsPostResponses; + +import java.io.IOException; +import java.util.Arrays; +import java.util.List; +import java.util.Map; +import java.util.AbstractMap; + +// if you want to use a server that is not SERVER_0 pass it in here and change the ServerIndex input below +ApiConfiguration.ServerInfo serverInfo = new ApiConfiguration.ServerInfoBuilder() + .rootServerInfo( + new RootServerInfo.RootServerInfoBuilder() + .rootServer0(new RootServer0()) + .build() + ) + .build(); +ApiConfiguration.ServerIndexInfo serverIndexInfo = new ApiConfiguration.ServerIndexInfoBuilder() + .rootServerInfoServerIndex(RootServerInfo.ServerIndex.SERVER_0) + .build(); +Duration timeout = Duration.ofSeconds(1L); +Map> defaultHeaders = Map.of("User-Agent", List.of("OpenAPI-JSON-Schema-Generator/1.0.0/java")); +ApiConfiguration apiConfiguration = new ApiConfiguration( + serverInfo + serverIndexInfo, + timeout, + defaultHeaders +); +SchemaConfiguration schemaConfiguration = new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().build()); +FakerefscomposedoneofnumberwithvalidationsPost.Post apiClient = new FakerefscomposedoneofnumberwithvalidationsPost.Post(apiConfiguration, schemaConfiguration); + + +var request = new FakerefscomposedoneofnumberwithvalidationsPost.PostRequestBuilder().build(); + +FakerefscomposedoneofnumberwithvalidationsPostResponses.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; +} +FakerefscomposedoneofnumberwithvalidationsPostResponses.EndpointFakerefscomposedoneofnumberwithvalidationsPostCode200Response castResponse = (FakerefscomposedoneofnumberwithvalidationsPostResponses.EndpointFakerefscomposedoneofnumberwithvalidationsPostCode200Response) response; +FakerefscomposedoneofnumberwithvalidationsPostCode200Response.ApplicationjsonResponseBody deserializedBody = (FakerefscomposedoneofnumberwithvalidationsPostCode200Response.ApplicationjsonResponseBody) castResponse.body; +// handle deserialized body here +``` +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| Post(ApiConfiguration apiConfiguration, SchemaConfiguration schemaConfiguration)
Creates an instance | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| [FakerefscomposedoneofnumberwithvalidationsPostResponses.EndpointResponse](../../paths/fakerefscomposedoneofnumberwithvalidations/post/FakerefscomposedoneofnumberwithvalidationsPostResponses.md#endpointresponse) | post([PostRequest](#postrequest) request) | + +## ComposedOneOfDifferentTypesOperation +public interface ComposedOneOfDifferentTypesOperation
+ +an interface that allows one to call the endpoint using a method named composedOneOfDifferentTypes by the operationId + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| [FakerefscomposedoneofnumberwithvalidationsPostResponses.EndpointResponse](../../paths/fakerefscomposedoneofnumberwithvalidations/post/FakerefscomposedoneofnumberwithvalidationsPostResponses.md#endpointresponse) | composedOneOfDifferentTypes([PostRequest](#postrequest) request) | + +## PostRequest +public static class PostRequest
+ +a class that stores the final request inputs + +### Field Summary +| Modifier and Type | Field and Description | +| ----------------- | --------------------- | +| [FakerefscomposedoneofnumberwithvalidationsPostRequestBody.@Nullable SealedRequestBody](../../paths/fakerefscomposedoneofnumberwithvalidations/post/FakerefscomposedoneofnumberwithvalidationsPostRequestBody.md#sealedrequestbody) | requestBody
optional | +| [RootServerInfo.@Nullable ServerIndex](../../RootServerInfo.md#serverindex) | serverIndex
optional. Note: this will override the value in apiConfiguration | +| @Nullable Duration | timeout
optional. Note: this will override the value in apiConfiguration | + +## PostRequestBuilder +public static class PostRequestBuilder
+ +a builder for request inputs + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| PostRequestBuilder()
Creates a builder that contains null for all parameters | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| [PostRequest](#postrequest) | build()
Returns the request input used to call an endpoint method | +| [PostRequestBuilder](#postrequestbuilder) | requestBody([FakerefscomposedoneofnumberwithvalidationsPostRequestBody.SealedRequestBody](../../paths/fakerefscomposedoneofnumberwithvalidations/post/FakerefscomposedoneofnumberwithvalidationsPostRequestBody.md#sealedrequestbody) requestBody)
sets the optional property | +| [PostRequestBuilder](#postrequestbuilder) | serverIndex([RootServerInfo.ServerIndex](../../RootServerInfo.md#serverindex) serverIndex)
sets the optional property. Note: this will override the value in apiConfiguration | +| [PostRequestBuilder](#postrequestbuilder) | timeout(Duration timeout)
sets the optional property. Note: this will override the value in apiConfiguration | + +[[Back to top]](#top) [[Back to README]](../../../README.md) diff --git a/samples/client/petstore/kotlin/docs/paths/fakerefscomposedoneofnumberwithvalidations/post/FakerefscomposedoneofnumberwithvalidationsPostRequestBody.md b/samples/client/petstore/kotlin/docs/paths/fakerefscomposedoneofnumberwithvalidations/post/FakerefscomposedoneofnumberwithvalidationsPostRequestBody.md new file mode 100644 index 00000000000..1a19679e0c2 --- /dev/null +++ b/samples/client/petstore/kotlin/docs/paths/fakerefscomposedoneofnumberwithvalidations/post/FakerefscomposedoneofnumberwithvalidationsPostRequestBody.md @@ -0,0 +1,90 @@ +# FakerefscomposedoneofnumberwithvalidationsPostRequestBody + +public class FakerefscomposedoneofnumberwithvalidationsPostRequestBody + +A class that contains necessary nested request body classes +- SealedMediaType, a sealed interface which contains all the schema/encoding info for each contentType +- records which implement SealedMediaType, the concrete media types +- a class that extends RequestBodySerializer and is used to serialize input SealedRequestBody instances +- SealedRequestBody, a sealed interface which contains all the contentType/schema input types +- records which implement SealedRequestBody, the concrete request body types + +## Nested Class Summary +| Modifier and Type | Class and Description | +| ----------------- | --------------------- | +| sealed interface | [FakerefscomposedoneofnumberwithvalidationsPostRequestBody.SealedMediaType](#sealedmediatype)
media type sealed interface | +| record | [FakerefscomposedoneofnumberwithvalidationsPostRequestBody.ApplicationjsonMediaType](#applicationjsonmediatype)
record storing schema + encoding for a specific contentType | +| static class | [FakerefscomposedoneofnumberwithvalidationsPostRequestBody.FakerefscomposedoneofnumberwithvalidationsPostRequestBody1](#fakerefscomposedoneofnumberwithvalidationspostrequestbody1)
class that serializes request bodies | +| sealed interface | [FakerefscomposedoneofnumberwithvalidationsPostRequestBody.SealedRequestBody](#sealedrequestbody)
request body sealed interface | +| record | [FakerefscomposedoneofnumberwithvalidationsPostRequestBody.ApplicationjsonRequestBody](#applicationjsonrequestbody)
implements sealed interface to store request body input | + +## SealedMediaType +public sealed interface SealedMediaType
+permits
+[ApplicationjsonMediaType](#applicationjsonmediatype) + +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), Nothing?> + +class storing schema info for a specific contentType + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| ApplicationjsonMediaType()
Creates an instance | + +### 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 | +| Nothing? | encoding()
the encoding info | + +## FakerefscomposedoneofnumberwithvalidationsPostRequestBody1 +public static class FakerefscomposedoneofnumberwithvalidationsPostRequestBody1
+ +a class that serializes SealedRequestBody request bodies + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| FakerefscomposedoneofnumberwithvalidationsPostRequestBody1()
Creates an instance | + +### Field Summary +| Modifier and Type | Field and Description | +| ----------------- | --------------------- | +| boolean | required = false
whether the request body is required | +| 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 | +| ----------------- | ---------------------- | +| SerializedRequestBody | serialize([SealedRequestBody](#sealedrequestbody) requestBody)
called by endpoint when creating request body bytes | + +## SealedRequestBody +public sealed interface SealedRequestBody
+permits
+[ApplicationjsonRequestBody](#applicationjsonrequestbody) + +sealed interface that stores request contentType + validated schema data + +## ApplicationjsonRequestBody +public record ApplicationjsonRequestBody
+implements [SealedRequestBody](#sealedrequestbody),
+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 | + +### 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 | diff --git a/samples/client/petstore/kotlin/docs/paths/fakerefscomposedoneofnumberwithvalidations/post/FakerefscomposedoneofnumberwithvalidationsPostResponses.md b/samples/client/petstore/kotlin/docs/paths/fakerefscomposedoneofnumberwithvalidations/post/FakerefscomposedoneofnumberwithvalidationsPostResponses.md new file mode 100644 index 00000000000..79622065b82 --- /dev/null +++ b/samples/client/petstore/kotlin/docs/paths/fakerefscomposedoneofnumberwithvalidations/post/FakerefscomposedoneofnumberwithvalidationsPostResponses.md @@ -0,0 +1,29 @@ +# FakerefscomposedoneofnumberwithvalidationsPostResponses + +public class FakerefscomposedoneofnumberwithvalidationsPostResponses + +A class that contains necessary responses classes +- a sealed interface, EndpointResponse, that stores endpoint responses +- records for each endpoint response + +## Nested Class Summary +| Modifier and Type | Class and Description | +| ----------------- | --------------------- | +| sealed interface | [EndpointResponse](#endpointresponse)
stores the endpoint responses | +| record | [EndpointFakerefscomposedoneofnumberwithvalidationsPostCode200Response](#endpointfakerefscomposedoneofnumberwithvalidationspostcode200response)
the response for 200 | + +## EndpointResponse +public sealed interface EndpointResponse permits
+[EndpointFakerefscomposedoneofnumberwithvalidationsPostCode200Response](#endpointfakerefscomposedoneofnumberwithvalidationspostcode200response) + +a sealed interface that stores endpoint responses + +## EndpointFakerefscomposedoneofnumberwithvalidationsPostCode200Response +public record EndpointFakerefscomposedoneofnumberwithvalidationsPostCode200Response( + HttpResponse response, + [FakerefscomposedoneofnumberwithvalidationsPostCode200Response.SealedResponseBody](../../../paths/fakerefscomposedoneofnumberwithvalidations/post/responses/FakerefscomposedoneofnumberwithvalidationsPostCode200Response.md#sealedresponsebody) body, + Nothing? headers +) implements EndpointResponse, ApiResponse
+ +a class that stores an endpoint response + diff --git a/samples/client/petstore/kotlin/docs/paths/fakerefscomposedoneofnumberwithvalidations/post/requestbody/content/applicationjson/ApplicationjsonSchema.md b/samples/client/petstore/kotlin/docs/paths/fakerefscomposedoneofnumberwithvalidations/post/requestbody/content/applicationjson/ApplicationjsonSchema.md new file mode 100644 index 00000000000..6d15e5f1438 --- /dev/null +++ b/samples/client/petstore/kotlin/docs/paths/fakerefscomposedoneofnumberwithvalidations/post/requestbody/content/applicationjson/ApplicationjsonSchema.md @@ -0,0 +1,19 @@ +# ApplicationjsonSchema +public class ApplicationjsonSchema
+extends [ComposedOneOfDifferentTypes1](../../../../../../components/schemas/ComposedOneOfDifferentTypes.md#composedoneofdifferenttypes) + +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 + +## Nested Class Summary +| Modifier and Type | Class and Description | +| ----------------- | ---------------------- | +| static class | [ApplicationjsonSchema.ApplicationjsonSchema1](#applicationjsonschema1)
schema class | + +## ApplicationjsonSchema1 +public static class ApplicationjsonSchema1
+extends [ComposedOneOfDifferentTypes.ComposedOneOfDifferentTypes1](../../../../../../components/schemas/ComposedOneOfDifferentTypes.md#composedoneofdifferenttypes1) + +A schema class that validates payloads diff --git a/samples/client/petstore/kotlin/docs/paths/fakerefscomposedoneofnumberwithvalidations/post/responses/FakerefscomposedoneofnumberwithvalidationsPostCode200Response.md b/samples/client/petstore/kotlin/docs/paths/fakerefscomposedoneofnumberwithvalidations/post/responses/FakerefscomposedoneofnumberwithvalidationsPostCode200Response.md new file mode 100644 index 00000000000..a66b2ce4c32 --- /dev/null +++ b/samples/client/petstore/kotlin/docs/paths/fakerefscomposedoneofnumberwithvalidations/post/responses/FakerefscomposedoneofnumberwithvalidationsPostCode200Response.md @@ -0,0 +1,87 @@ +# FakerefscomposedoneofnumberwithvalidationsPostCode200Response + +public class FakerefscomposedoneofnumberwithvalidationsPostCode200Response + +A class that contains necessary nested response classes +- SealedMediaType, a sealed interface which contains all the schema/encoding info for each contentType +- records which implement SealedMediaType, the concrete media types +- SealedResponseBody, a sealed interface which contains all the contentType/schema types +- records which implement SealedResponseBody, the concrete response body types +- a class that extends ResponseDeserializer and is used to deserialize responses + +## Nested Class Summary +| Modifier and Type | Class and Description | +| ----------------- | --------------------- | +| sealed interface | [FakerefscomposedoneofnumberwithvalidationsPostCode200Response.SealedMediaType](#sealedmediatype)
media type sealed interface | +| record | [FakerefscomposedoneofnumberwithvalidationsPostCode200Response.ApplicationjsonMediaType](#applicationjsonmediatype)
record storing schema + encoding for a specific contentType | +| sealed interface | [FakerefscomposedoneofnumberwithvalidationsPostCode200Response.SealedResponseBody](#sealedresponsebody)
response body sealed interface | +| record | [FakerefscomposedoneofnumberwithvalidationsPostCode200Response.ApplicationjsonResponseBody](#applicationjsonresponsebody)
implements sealed interface to store response body | +| static class | [FakerefscomposedoneofnumberwithvalidationsPostCode200Response.FakerefscomposedoneofnumberwithvalidationsPostCode200Response1](#fakerefscomposedoneofnumberwithvalidationspostcode200response1)
class that deserializes responses | + +## SealedMediaType +public sealed interface SealedMediaType
+permits
+[ApplicationjsonMediaType](#applicationjsonmediatype) + +sealed interface that stores schema and encoding info + +## ApplicationjsonMediaType +public record ApplicationjsonMediaType
+implements [SealedMediaType](#sealedmediatype), MediaType<[ApplicationjsonSchema.ApplicationjsonSchema1](../../../../paths/fakerefscomposedoneofnumberwithvalidations/post/responses/code200response/content/applicationjson/ApplicationjsonSchema.md#applicationjsonschema1), Nothing?> + +class storing schema info for a specific contentType + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| ApplicationjsonMediaType()
Creates an instance | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| [ApplicationjsonSchema.ApplicationjsonSchema1](../../../../paths/fakerefscomposedoneofnumberwithvalidations/post/responses/code200response/content/applicationjson/ApplicationjsonSchema.md#applicationjsonschema1) | schema()
the schema for this MediaType | +| Nothing? | encoding()
the encoding info | + +## SealedResponseBody +public sealed interface SealedResponseBody
+permits
+[ApplicationjsonResponseBody](#applicationjsonresponsebody) + +sealed interface that stores response body + +## ApplicationjsonResponseBody +public record ApplicationjsonResponseBody
+implements [SealedResponseBody](#sealedresponsebody) + +A record class to store response body for contentType="application/json" + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| ApplicationjsonResponseBody(ApplicationjsonSchema.[ComposedOneOfDifferentTypes1Boxed](../../../../components/schemas/ComposedOneOfDifferentTypes.md#composedoneofdifferenttypes1boxed) body)
Creates an instance | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| ApplicationjsonSchema.[ComposedOneOfDifferentTypes1Boxed](../../../../components/schemas/ComposedOneOfDifferentTypes.md#composedoneofdifferenttypes1boxed) | body()
returns the body passed in in the constructor | + +## FakerefscomposedoneofnumberwithvalidationsPostCode200Response1 +public static class FakerefscomposedoneofnumberwithvalidationsPostCode200Response1
+extends ResponseDeserializer<[SealedResponseBody](#sealedresponsebody), Nothing?, [SealedMediaType](#sealedmediatype)> + +a class that deserializes responses + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| FakerefscomposedoneofnumberwithvalidationsPostCode200Response1()
Creates an instance | + +### Field Summary +| Modifier and Type | Field and Description | +| ----------------- | --------------------- | +| 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 | +| ----------------- | ---------------------- | +| ApiResponse<[SealedResponseBody](#sealedresponsebody), Nothing?> | deserialize(HttpResponse response, SchemaConfiguration configuration)
called by endpoint when deserialize responses | diff --git a/samples/client/petstore/kotlin/docs/paths/fakerefscomposedoneofnumberwithvalidations/post/responses/code200response/content/applicationjson/ApplicationjsonSchema.md b/samples/client/petstore/kotlin/docs/paths/fakerefscomposedoneofnumberwithvalidations/post/responses/code200response/content/applicationjson/ApplicationjsonSchema.md new file mode 100644 index 00000000000..1e3738551c2 --- /dev/null +++ b/samples/client/petstore/kotlin/docs/paths/fakerefscomposedoneofnumberwithvalidations/post/responses/code200response/content/applicationjson/ApplicationjsonSchema.md @@ -0,0 +1,19 @@ +# ApplicationjsonSchema +public class ApplicationjsonSchema
+extends [ComposedOneOfDifferentTypes1](../../../../../../../components/schemas/ComposedOneOfDifferentTypes.md#composedoneofdifferenttypes) + +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 + +## Nested Class Summary +| Modifier and Type | Class and Description | +| ----------------- | ---------------------- | +| static class | [ApplicationjsonSchema.ApplicationjsonSchema1](#applicationjsonschema1)
schema class | + +## ApplicationjsonSchema1 +public static class ApplicationjsonSchema1
+extends [ComposedOneOfDifferentTypes.ComposedOneOfDifferentTypes1](../../../../../../../components/schemas/ComposedOneOfDifferentTypes.md#composedoneofdifferenttypes1) + +A schema class that validates payloads diff --git a/samples/client/petstore/kotlin/docs/paths/fakerefsenum/FakerefsenumPost.md b/samples/client/petstore/kotlin/docs/paths/fakerefsenum/FakerefsenumPost.md new file mode 100644 index 00000000000..25dd52297ca --- /dev/null +++ b/samples/client/petstore/kotlin/docs/paths/fakerefsenum/FakerefsenumPost.md @@ -0,0 +1,148 @@ +# FakerefsenumPost + +public class FakerefsenumPost + +A class that contains necessary endpoint classes +- a class that calls the endpoint method using the http verb +- a class that calls the endpoint method using the operationId name +- class(es) to store the request inputs +- builder(s) to set the request input data + +## Nested Class Summary +| Modifier and Type | Class and Description | +| ----------------- | --------------------- | +| static class | [Post](#post)
The class that has a post method to call the endpoint | +| interface | [StringEnumOperation](#stringenumoperation)
The interface that has a stringEnum method to call the endpoint | +| static class | [PostRequest](#postrequest)
The request inputs class | +| static class | [PostRequestBuilder](#postrequestbuilder)
A builder for the request input class | + +## Post +public static class Post 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.FakerefsenumPostRequestBody; +import org.openapijsonschematools.client.components.schemas.StringEnum; +import org.openapijsonschematools.client.RootServerInfo; +import org.openapijsonschematools.client.servers.RootServer0; +import org.openapijsonschematools.client.servers.RootServer1; +import org.openapijsonschematools.client.servers.RootServer2; +import org.openapijsonschematools.client.paths.fakerefsenum.post.responses.FakerefsenumPostCode200Response; +import org.openapijsonschematools.client.servers.RootServerInfo; +import org.openapijsonschematools.client.paths.fakerefsenum.FakerefsenumPost; +import org.openapijsonschematools.client.paths.fakerefsenum.post.FakerefsenumPostResponses; + +import java.io.IOException; +import java.util.Arrays; +import java.util.List; +import java.util.Map; +import java.util.AbstractMap; + +// if you want to use a server that is not SERVER_0 pass it in here and change the ServerIndex input below +ApiConfiguration.ServerInfo serverInfo = new ApiConfiguration.ServerInfoBuilder() + .rootServerInfo( + new RootServerInfo.RootServerInfoBuilder() + .rootServer0(new RootServer0()) + .build() + ) + .build(); +ApiConfiguration.ServerIndexInfo serverIndexInfo = new ApiConfiguration.ServerIndexInfoBuilder() + .rootServerInfoServerIndex(RootServerInfo.ServerIndex.SERVER_0) + .build(); +Duration timeout = Duration.ofSeconds(1L); +Map> defaultHeaders = Map.of("User-Agent", List.of("OpenAPI-JSON-Schema-Generator/1.0.0/java")); +ApiConfiguration apiConfiguration = new ApiConfiguration( + serverInfo + serverIndexInfo, + timeout, + defaultHeaders +); +SchemaConfiguration schemaConfiguration = new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().build()); +FakerefsenumPost.Post apiClient = new FakerefsenumPost.Post(apiConfiguration, schemaConfiguration); + + +var request = new FakerefsenumPost.PostRequestBuilder().build(); + +FakerefsenumPostResponses.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; +} +FakerefsenumPostResponses.EndpointFakerefsenumPostCode200Response castResponse = (FakerefsenumPostResponses.EndpointFakerefsenumPostCode200Response) response; +FakerefsenumPostCode200Response.ApplicationjsonResponseBody deserializedBody = (FakerefsenumPostCode200Response.ApplicationjsonResponseBody) castResponse.body; +// handle deserialized body here +``` +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| Post(ApiConfiguration apiConfiguration, SchemaConfiguration schemaConfiguration)
Creates an instance | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| [FakerefsenumPostResponses.EndpointResponse](../../paths/fakerefsenum/post/FakerefsenumPostResponses.md#endpointresponse) | post([PostRequest](#postrequest) request) | + +## StringEnumOperation +public interface StringEnumOperation
+ +an interface that allows one to call the endpoint using a method named stringEnum by the operationId + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| [FakerefsenumPostResponses.EndpointResponse](../../paths/fakerefsenum/post/FakerefsenumPostResponses.md#endpointresponse) | stringEnum([PostRequest](#postrequest) request) | + +## PostRequest +public static class PostRequest
+ +a class that stores the final request inputs + +### Field Summary +| Modifier and Type | Field and Description | +| ----------------- | --------------------- | +| [FakerefsenumPostRequestBody.@Nullable SealedRequestBody](../../paths/fakerefsenum/post/FakerefsenumPostRequestBody.md#sealedrequestbody) | requestBody
optional | +| [RootServerInfo.@Nullable ServerIndex](../../RootServerInfo.md#serverindex) | serverIndex
optional. Note: this will override the value in apiConfiguration | +| @Nullable Duration | timeout
optional. Note: this will override the value in apiConfiguration | + +## PostRequestBuilder +public static class PostRequestBuilder
+ +a builder for request inputs + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| PostRequestBuilder()
Creates a builder that contains null for all parameters | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| [PostRequest](#postrequest) | build()
Returns the request input used to call an endpoint method | +| [PostRequestBuilder](#postrequestbuilder) | requestBody([FakerefsenumPostRequestBody.SealedRequestBody](../../paths/fakerefsenum/post/FakerefsenumPostRequestBody.md#sealedrequestbody) requestBody)
sets the optional property | +| [PostRequestBuilder](#postrequestbuilder) | serverIndex([RootServerInfo.ServerIndex](../../RootServerInfo.md#serverindex) serverIndex)
sets the optional property. Note: this will override the value in apiConfiguration | +| [PostRequestBuilder](#postrequestbuilder) | timeout(Duration timeout)
sets the optional property. Note: this will override the value in apiConfiguration | + +[[Back to top]](#top) [[Back to README]](../../../README.md) diff --git a/samples/client/petstore/kotlin/docs/paths/fakerefsenum/post/FakerefsenumPostRequestBody.md b/samples/client/petstore/kotlin/docs/paths/fakerefsenum/post/FakerefsenumPostRequestBody.md new file mode 100644 index 00000000000..b28d9e3b6e9 --- /dev/null +++ b/samples/client/petstore/kotlin/docs/paths/fakerefsenum/post/FakerefsenumPostRequestBody.md @@ -0,0 +1,90 @@ +# FakerefsenumPostRequestBody + +public class FakerefsenumPostRequestBody + +A class that contains necessary nested request body classes +- SealedMediaType, a sealed interface which contains all the schema/encoding info for each contentType +- records which implement SealedMediaType, the concrete media types +- a class that extends RequestBodySerializer and is used to serialize input SealedRequestBody instances +- SealedRequestBody, a sealed interface which contains all the contentType/schema input types +- records which implement SealedRequestBody, the concrete request body types + +## Nested Class Summary +| Modifier and Type | Class and Description | +| ----------------- | --------------------- | +| sealed interface | [FakerefsenumPostRequestBody.SealedMediaType](#sealedmediatype)
media type sealed interface | +| record | [FakerefsenumPostRequestBody.ApplicationjsonMediaType](#applicationjsonmediatype)
record storing schema + encoding for a specific contentType | +| static class | [FakerefsenumPostRequestBody.FakerefsenumPostRequestBody1](#fakerefsenumpostrequestbody1)
class that serializes request bodies | +| sealed interface | [FakerefsenumPostRequestBody.SealedRequestBody](#sealedrequestbody)
request body sealed interface | +| record | [FakerefsenumPostRequestBody.ApplicationjsonRequestBody](#applicationjsonrequestbody)
implements sealed interface to store request body input | + +## SealedMediaType +public sealed interface SealedMediaType
+permits
+[ApplicationjsonMediaType](#applicationjsonmediatype) + +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), Nothing?> + +class storing schema info for a specific contentType + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| ApplicationjsonMediaType()
Creates an instance | + +### 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 | +| Nothing? | encoding()
the encoding info | + +## FakerefsenumPostRequestBody1 +public static class FakerefsenumPostRequestBody1
+ +a class that serializes SealedRequestBody request bodies + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| FakerefsenumPostRequestBody1()
Creates an instance | + +### Field Summary +| Modifier and Type | Field and Description | +| ----------------- | --------------------- | +| boolean | required = false
whether the request body is required | +| 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 | +| ----------------- | ---------------------- | +| SerializedRequestBody | serialize([SealedRequestBody](#sealedrequestbody) requestBody)
called by endpoint when creating request body bytes | + +## SealedRequestBody +public sealed interface SealedRequestBody
+permits
+[ApplicationjsonRequestBody](#applicationjsonrequestbody) + +sealed interface that stores request contentType + validated schema data + +## ApplicationjsonRequestBody +public record ApplicationjsonRequestBody
+implements [SealedRequestBody](#sealedrequestbody),
+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 | + +### 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 | diff --git a/samples/client/petstore/kotlin/docs/paths/fakerefsenum/post/FakerefsenumPostResponses.md b/samples/client/petstore/kotlin/docs/paths/fakerefsenum/post/FakerefsenumPostResponses.md new file mode 100644 index 00000000000..572faa88116 --- /dev/null +++ b/samples/client/petstore/kotlin/docs/paths/fakerefsenum/post/FakerefsenumPostResponses.md @@ -0,0 +1,29 @@ +# FakerefsenumPostResponses + +public class FakerefsenumPostResponses + +A class that contains necessary responses classes +- a sealed interface, EndpointResponse, that stores endpoint responses +- records for each endpoint response + +## Nested Class Summary +| Modifier and Type | Class and Description | +| ----------------- | --------------------- | +| sealed interface | [EndpointResponse](#endpointresponse)
stores the endpoint responses | +| record | [EndpointFakerefsenumPostCode200Response](#endpointfakerefsenumpostcode200response)
the response for 200 | + +## EndpointResponse +public sealed interface EndpointResponse permits
+[EndpointFakerefsenumPostCode200Response](#endpointfakerefsenumpostcode200response) + +a sealed interface that stores endpoint responses + +## EndpointFakerefsenumPostCode200Response +public record EndpointFakerefsenumPostCode200Response( + HttpResponse response, + [FakerefsenumPostCode200Response.SealedResponseBody](../../../paths/fakerefsenum/post/responses/FakerefsenumPostCode200Response.md#sealedresponsebody) body, + Nothing? headers +) implements EndpointResponse, ApiResponse
+ +a class that stores an endpoint response + diff --git a/samples/client/petstore/kotlin/docs/paths/fakerefsenum/post/requestbody/content/applicationjson/ApplicationjsonSchema.md b/samples/client/petstore/kotlin/docs/paths/fakerefsenum/post/requestbody/content/applicationjson/ApplicationjsonSchema.md new file mode 100644 index 00000000000..d83adaf246f --- /dev/null +++ b/samples/client/petstore/kotlin/docs/paths/fakerefsenum/post/requestbody/content/applicationjson/ApplicationjsonSchema.md @@ -0,0 +1,19 @@ +# ApplicationjsonSchema +public class ApplicationjsonSchema
+extends [StringEnum1](../../../../../../components/schemas/StringEnum.md#stringenum) + +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 + +## Nested Class Summary +| Modifier and Type | Class and Description | +| ----------------- | ---------------------- | +| static class | [ApplicationjsonSchema.ApplicationjsonSchema1](#applicationjsonschema1)
schema class | + +## ApplicationjsonSchema1 +public static class ApplicationjsonSchema1
+extends [StringEnum.StringEnum1](../../../../../../components/schemas/StringEnum.md#stringenum1) + +A schema class that validates payloads diff --git a/samples/client/petstore/kotlin/docs/paths/fakerefsenum/post/responses/FakerefsenumPostCode200Response.md b/samples/client/petstore/kotlin/docs/paths/fakerefsenum/post/responses/FakerefsenumPostCode200Response.md new file mode 100644 index 00000000000..e29827ba69d --- /dev/null +++ b/samples/client/petstore/kotlin/docs/paths/fakerefsenum/post/responses/FakerefsenumPostCode200Response.md @@ -0,0 +1,87 @@ +# FakerefsenumPostCode200Response + +public class FakerefsenumPostCode200Response + +A class that contains necessary nested response classes +- SealedMediaType, a sealed interface which contains all the schema/encoding info for each contentType +- records which implement SealedMediaType, the concrete media types +- SealedResponseBody, a sealed interface which contains all the contentType/schema types +- records which implement SealedResponseBody, the concrete response body types +- a class that extends ResponseDeserializer and is used to deserialize responses + +## Nested Class Summary +| Modifier and Type | Class and Description | +| ----------------- | --------------------- | +| sealed interface | [FakerefsenumPostCode200Response.SealedMediaType](#sealedmediatype)
media type sealed interface | +| record | [FakerefsenumPostCode200Response.ApplicationjsonMediaType](#applicationjsonmediatype)
record storing schema + encoding for a specific contentType | +| sealed interface | [FakerefsenumPostCode200Response.SealedResponseBody](#sealedresponsebody)
response body sealed interface | +| record | [FakerefsenumPostCode200Response.ApplicationjsonResponseBody](#applicationjsonresponsebody)
implements sealed interface to store response body | +| static class | [FakerefsenumPostCode200Response.FakerefsenumPostCode200Response1](#fakerefsenumpostcode200response1)
class that deserializes responses | + +## SealedMediaType +public sealed interface SealedMediaType
+permits
+[ApplicationjsonMediaType](#applicationjsonmediatype) + +sealed interface that stores schema and encoding info + +## ApplicationjsonMediaType +public record ApplicationjsonMediaType
+implements [SealedMediaType](#sealedmediatype), MediaType<[ApplicationjsonSchema.ApplicationjsonSchema1](../../../../paths/fakerefsenum/post/responses/code200response/content/applicationjson/ApplicationjsonSchema.md#applicationjsonschema1), Nothing?> + +class storing schema info for a specific contentType + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| ApplicationjsonMediaType()
Creates an instance | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| [ApplicationjsonSchema.ApplicationjsonSchema1](../../../../paths/fakerefsenum/post/responses/code200response/content/applicationjson/ApplicationjsonSchema.md#applicationjsonschema1) | schema()
the schema for this MediaType | +| Nothing? | encoding()
the encoding info | + +## SealedResponseBody +public sealed interface SealedResponseBody
+permits
+[ApplicationjsonResponseBody](#applicationjsonresponsebody) + +sealed interface that stores response body + +## ApplicationjsonResponseBody +public record ApplicationjsonResponseBody
+implements [SealedResponseBody](#sealedresponsebody) + +A record class to store response body for contentType="application/json" + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| ApplicationjsonResponseBody(ApplicationjsonSchema.[StringEnum1Boxed](../../../../components/schemas/StringEnum.md#stringenum1boxed) body)
Creates an instance | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| ApplicationjsonSchema.[StringEnum1Boxed](../../../../components/schemas/StringEnum.md#stringenum1boxed) | body()
returns the body passed in in the constructor | + +## FakerefsenumPostCode200Response1 +public static class FakerefsenumPostCode200Response1
+extends ResponseDeserializer<[SealedResponseBody](#sealedresponsebody), Nothing?, [SealedMediaType](#sealedmediatype)> + +a class that deserializes responses + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| FakerefsenumPostCode200Response1()
Creates an instance | + +### Field Summary +| Modifier and Type | Field and Description | +| ----------------- | --------------------- | +| 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 | +| ----------------- | ---------------------- | +| ApiResponse<[SealedResponseBody](#sealedresponsebody), Nothing?> | deserialize(HttpResponse response, SchemaConfiguration configuration)
called by endpoint when deserialize responses | diff --git a/samples/client/petstore/kotlin/docs/paths/fakerefsenum/post/responses/code200response/content/applicationjson/ApplicationjsonSchema.md b/samples/client/petstore/kotlin/docs/paths/fakerefsenum/post/responses/code200response/content/applicationjson/ApplicationjsonSchema.md new file mode 100644 index 00000000000..2ac02fd09b9 --- /dev/null +++ b/samples/client/petstore/kotlin/docs/paths/fakerefsenum/post/responses/code200response/content/applicationjson/ApplicationjsonSchema.md @@ -0,0 +1,19 @@ +# ApplicationjsonSchema +public class ApplicationjsonSchema
+extends [StringEnum1](../../../../../../../components/schemas/StringEnum.md#stringenum) + +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 + +## Nested Class Summary +| Modifier and Type | Class and Description | +| ----------------- | ---------------------- | +| static class | [ApplicationjsonSchema.ApplicationjsonSchema1](#applicationjsonschema1)
schema class | + +## ApplicationjsonSchema1 +public static class ApplicationjsonSchema1
+extends [StringEnum.StringEnum1](../../../../../../../components/schemas/StringEnum.md#stringenum1) + +A schema class that validates payloads diff --git a/samples/client/petstore/kotlin/docs/paths/fakerefsmammal/FakerefsmammalPost.md b/samples/client/petstore/kotlin/docs/paths/fakerefsmammal/FakerefsmammalPost.md new file mode 100644 index 00000000000..0cd434caa3f --- /dev/null +++ b/samples/client/petstore/kotlin/docs/paths/fakerefsmammal/FakerefsmammalPost.md @@ -0,0 +1,179 @@ +# FakerefsmammalPost + +public class FakerefsmammalPost + +A class that contains necessary endpoint classes +- a class that calls the endpoint method using the http verb +- a class that calls the endpoint method using the operationId name +- class(es) to store the request inputs +- builder(s) to set the request input data + +## Nested Class Summary +| Modifier and Type | Class and Description | +| ----------------- | --------------------- | +| static class | [Post](#post)
The class that has a post method to call the endpoint | +| interface | [MammalOperation](#mammaloperation)
The interface that has a mammal method to call the endpoint | +| static class | [PostRequest](#postrequest)
The final request inputs class | +| static class | [PostNullableRequest](#postnullablerequest)
The initial request inputs class | +| static class | [Post0RequestBuilder](#post0requestbuilder)
A builder for the request input class | +| static class | [PostRequestBuilder](#postrequestbuilder)
A builder for the request input class | + +## Post +public static class Post 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.FakerefsmammalPostRequestBody; +import org.openapijsonschematools.client.components.schemas.Mammal; +import org.openapijsonschematools.client.servers.RootServer0; +import org.openapijsonschematools.client.servers.RootServer1; +import org.openapijsonschematools.client.servers.RootServer2; +import org.openapijsonschematools.client.paths.fakerefsmammal.post.responses.FakerefsmammalPostCode200Response; +import org.openapijsonschematools.client.servers.RootServerInfo; +import org.openapijsonschematools.client.paths.fakerefsmammal.FakerefsmammalPost; +import org.openapijsonschematools.client.paths.fakerefsmammal.post.FakerefsmammalPostResponses; + +import java.io.IOException; +import java.util.Arrays; +import java.util.List; +import java.util.Map; +import java.util.AbstractMap; + +// if you want to use a server that is not SERVER_0 pass it in here and change the ServerIndex input below +ApiConfiguration.ServerInfo serverInfo = new ApiConfiguration.ServerInfoBuilder() + .rootServerInfo( + new RootServerInfo.RootServerInfoBuilder() + .rootServer0(new RootServer0()) + .build() + ) + .build(); +ApiConfiguration.ServerIndexInfo serverIndexInfo = new ApiConfiguration.ServerIndexInfoBuilder() + .rootServerInfoServerIndex(RootServerInfo.ServerIndex.SERVER_0) + .build(); +Duration timeout = Duration.ofSeconds(1L); +Map> defaultHeaders = Map.of("User-Agent", List.of("OpenAPI-JSON-Schema-Generator/1.0.0/java")); +ApiConfiguration apiConfiguration = new ApiConfiguration( + serverInfo + serverIndexInfo, + timeout, + defaultHeaders +); +SchemaConfiguration schemaConfiguration = new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().build()); +FakerefsmammalPost.Post apiClient = new FakerefsmammalPost.Post(apiConfiguration, schemaConfiguration); + +FakerefsmammalPost.SealedRequestBody requestBody = new FakerefsmammalPost.ApplicationjsonRequestBody(requestBodyPayload); + +var request = new FakerefsmammalPost.PostRequestBuilder() + .requestBody(requestBody) + .build(); + +FakerefsmammalPostResponses.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; +} +FakerefsmammalPostResponses.EndpointFakerefsmammalPostCode200Response castResponse = (FakerefsmammalPostResponses.EndpointFakerefsmammalPostCode200Response) response; +FakerefsmammalPostCode200Response.ApplicationjsonResponseBody deserializedBody = (FakerefsmammalPostCode200Response.ApplicationjsonResponseBody) castResponse.body; +// handle deserialized body here +``` +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| Post(ApiConfiguration apiConfiguration, SchemaConfiguration schemaConfiguration)
Creates an instance | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| [FakerefsmammalPostResponses.EndpointResponse](../../paths/fakerefsmammal/post/FakerefsmammalPostResponses.md#endpointresponse) | post([PostRequest](#postrequest) request) | + +## MammalOperation +public interface MammalOperation
+ +an interface that allows one to call the endpoint using a method named mammal by the operationId + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| [FakerefsmammalPostResponses.EndpointResponse](../../paths/fakerefsmammal/post/FakerefsmammalPostResponses.md#endpointresponse) | mammal([PostRequest](#postrequest) request) | + +## PostRequest +public static class PostRequest
+ +a class that stores the final request inputs + +### Field Summary +| Modifier and Type | Field and Description | +| ----------------- | --------------------- | +| [FakerefsmammalPostRequestBody.SealedRequestBody](../../paths/fakerefsmammal/post/FakerefsmammalPostRequestBody.md#sealedrequestbody) | requestBody | +| [RootServerInfo.@Nullable ServerIndex](../../RootServerInfo.md#serverindex) | serverIndex
optional. Note: this will override the value in apiConfiguration | +| @Nullable Duration | timeout
optional. Note: this will override the value in apiConfiguration | + +## PostNullableRequest +public static class PostNullableRequest
+ +a class that stores the initial request inputs + +### Field Summary +| Modifier and Type | Field and Description | +| ----------------- | --------------------- | +| [FakerefsmammalPostRequestBody.@Nullable SealedRequestBody](../../paths/fakerefsmammal/post/FakerefsmammalPostRequestBody.md#sealedrequestbody) | requestBody | +| [RootServerInfo.@Nullable ServerIndex](../../RootServerInfo.md#serverindex) | serverIndex | +| @Nullable Duration | timeout | + +## Post0RequestBuilder +public static class Post0RequestBuilder
+ +a builder for request inputs + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| Post0RequestBuilder(Post0RequestBuilder instance)
Creates a builder that contains the passed instance | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| [PostRequest](#postrequest) | build()
Returns the request input used to call an endpoint method | +| [Post0RequestBuilder](#post0requestbuilder) | serverIndex([RootServerInfo.ServerIndex](../../RootServerInfo.md#serverindex) serverIndex)
sets the optional property. Note: this will override the value in apiConfiguration | +| [Post0RequestBuilder](#post0requestbuilder) | timeout(Duration timeout)
sets the optional property. Note: this will override the value in apiConfiguration | + +## PostRequestBuilder +public static class PostRequestBuilder
+ +a builder for request inputs + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| PostRequestBuilder()
Creates a builder that contains null for all parameters | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| [Post0RequestBuilder](#post0requestbuilder) | requestBody([FakerefsmammalPostRequestBody.SealedRequestBody](../../paths/fakerefsmammal/post/FakerefsmammalPostRequestBody.md#sealedrequestbody) requestBody)
sets the property | + +[[Back to top]](#top) [[Back to README]](../../../README.md) diff --git a/samples/client/petstore/kotlin/docs/paths/fakerefsmammal/post/FakerefsmammalPostRequestBody.md b/samples/client/petstore/kotlin/docs/paths/fakerefsmammal/post/FakerefsmammalPostRequestBody.md new file mode 100644 index 00000000000..a038d9b1d1b --- /dev/null +++ b/samples/client/petstore/kotlin/docs/paths/fakerefsmammal/post/FakerefsmammalPostRequestBody.md @@ -0,0 +1,90 @@ +# FakerefsmammalPostRequestBody + +public class FakerefsmammalPostRequestBody + +A class that contains necessary nested request body classes +- SealedMediaType, a sealed interface which contains all the schema/encoding info for each contentType +- records which implement SealedMediaType, the concrete media types +- a class that extends RequestBodySerializer and is used to serialize input SealedRequestBody instances +- SealedRequestBody, a sealed interface which contains all the contentType/schema input types +- records which implement SealedRequestBody, the concrete request body types + +## Nested Class Summary +| Modifier and Type | Class and Description | +| ----------------- | --------------------- | +| sealed interface | [FakerefsmammalPostRequestBody.SealedMediaType](#sealedmediatype)
media type sealed interface | +| record | [FakerefsmammalPostRequestBody.ApplicationjsonMediaType](#applicationjsonmediatype)
record storing schema + encoding for a specific contentType | +| static class | [FakerefsmammalPostRequestBody.FakerefsmammalPostRequestBody1](#fakerefsmammalpostrequestbody1)
class that serializes request bodies | +| sealed interface | [FakerefsmammalPostRequestBody.SealedRequestBody](#sealedrequestbody)
request body sealed interface | +| record | [FakerefsmammalPostRequestBody.ApplicationjsonRequestBody](#applicationjsonrequestbody)
implements sealed interface to store request body input | + +## SealedMediaType +public sealed interface SealedMediaType
+permits
+[ApplicationjsonMediaType](#applicationjsonmediatype) + +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), Nothing?> + +class storing schema info for a specific contentType + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| ApplicationjsonMediaType()
Creates an instance | + +### 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 | +| Nothing? | encoding()
the encoding info | + +## FakerefsmammalPostRequestBody1 +public static class FakerefsmammalPostRequestBody1
+ +a class that serializes SealedRequestBody request bodies + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| FakerefsmammalPostRequestBody1()
Creates an instance | + +### Field Summary +| Modifier and Type | Field and Description | +| ----------------- | --------------------- | +| boolean | required = true
whether the request body is required | +| 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 | +| ----------------- | ---------------------- | +| SerializedRequestBody | serialize([SealedRequestBody](#sealedrequestbody) requestBody)
called by endpoint when creating request body bytes | + +## SealedRequestBody +public sealed interface SealedRequestBody
+permits
+[ApplicationjsonRequestBody](#applicationjsonrequestbody) + +sealed interface that stores request contentType + validated schema data + +## ApplicationjsonRequestBody +public record ApplicationjsonRequestBody
+implements [SealedRequestBody](#sealedrequestbody),
+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 | + +### 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 | diff --git a/samples/client/petstore/kotlin/docs/paths/fakerefsmammal/post/FakerefsmammalPostResponses.md b/samples/client/petstore/kotlin/docs/paths/fakerefsmammal/post/FakerefsmammalPostResponses.md new file mode 100644 index 00000000000..c57c6f073e7 --- /dev/null +++ b/samples/client/petstore/kotlin/docs/paths/fakerefsmammal/post/FakerefsmammalPostResponses.md @@ -0,0 +1,29 @@ +# FakerefsmammalPostResponses + +public class FakerefsmammalPostResponses + +A class that contains necessary responses classes +- a sealed interface, EndpointResponse, that stores endpoint responses +- records for each endpoint response + +## Nested Class Summary +| Modifier and Type | Class and Description | +| ----------------- | --------------------- | +| sealed interface | [EndpointResponse](#endpointresponse)
stores the endpoint responses | +| record | [EndpointFakerefsmammalPostCode200Response](#endpointfakerefsmammalpostcode200response)
the response for 200 | + +## EndpointResponse +public sealed interface EndpointResponse permits
+[EndpointFakerefsmammalPostCode200Response](#endpointfakerefsmammalpostcode200response) + +a sealed interface that stores endpoint responses + +## EndpointFakerefsmammalPostCode200Response +public record EndpointFakerefsmammalPostCode200Response( + HttpResponse response, + [FakerefsmammalPostCode200Response.SealedResponseBody](../../../paths/fakerefsmammal/post/responses/FakerefsmammalPostCode200Response.md#sealedresponsebody) body, + Nothing? headers +) implements EndpointResponse, ApiResponse
+ +a class that stores an endpoint response + diff --git a/samples/client/petstore/kotlin/docs/paths/fakerefsmammal/post/requestbody/content/applicationjson/ApplicationjsonSchema.md b/samples/client/petstore/kotlin/docs/paths/fakerefsmammal/post/requestbody/content/applicationjson/ApplicationjsonSchema.md new file mode 100644 index 00000000000..b1b525d94da --- /dev/null +++ b/samples/client/petstore/kotlin/docs/paths/fakerefsmammal/post/requestbody/content/applicationjson/ApplicationjsonSchema.md @@ -0,0 +1,19 @@ +# ApplicationjsonSchema +public class ApplicationjsonSchema
+extends [Mammal1](../../../../../../components/schemas/Mammal.md#mammal) + +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 + +## Nested Class Summary +| Modifier and Type | Class and Description | +| ----------------- | ---------------------- | +| static class | [ApplicationjsonSchema.ApplicationjsonSchema1](#applicationjsonschema1)
schema class | + +## ApplicationjsonSchema1 +public static class ApplicationjsonSchema1
+extends [Mammal.Mammal1](../../../../../../components/schemas/Mammal.md#mammal1) + +A schema class that validates payloads diff --git a/samples/client/petstore/kotlin/docs/paths/fakerefsmammal/post/responses/FakerefsmammalPostCode200Response.md b/samples/client/petstore/kotlin/docs/paths/fakerefsmammal/post/responses/FakerefsmammalPostCode200Response.md new file mode 100644 index 00000000000..4e1883f4f5c --- /dev/null +++ b/samples/client/petstore/kotlin/docs/paths/fakerefsmammal/post/responses/FakerefsmammalPostCode200Response.md @@ -0,0 +1,87 @@ +# FakerefsmammalPostCode200Response + +public class FakerefsmammalPostCode200Response + +A class that contains necessary nested response classes +- SealedMediaType, a sealed interface which contains all the schema/encoding info for each contentType +- records which implement SealedMediaType, the concrete media types +- SealedResponseBody, a sealed interface which contains all the contentType/schema types +- records which implement SealedResponseBody, the concrete response body types +- a class that extends ResponseDeserializer and is used to deserialize responses + +## Nested Class Summary +| Modifier and Type | Class and Description | +| ----------------- | --------------------- | +| sealed interface | [FakerefsmammalPostCode200Response.SealedMediaType](#sealedmediatype)
media type sealed interface | +| record | [FakerefsmammalPostCode200Response.ApplicationjsonMediaType](#applicationjsonmediatype)
record storing schema + encoding for a specific contentType | +| sealed interface | [FakerefsmammalPostCode200Response.SealedResponseBody](#sealedresponsebody)
response body sealed interface | +| record | [FakerefsmammalPostCode200Response.ApplicationjsonResponseBody](#applicationjsonresponsebody)
implements sealed interface to store response body | +| static class | [FakerefsmammalPostCode200Response.FakerefsmammalPostCode200Response1](#fakerefsmammalpostcode200response1)
class that deserializes responses | + +## SealedMediaType +public sealed interface SealedMediaType
+permits
+[ApplicationjsonMediaType](#applicationjsonmediatype) + +sealed interface that stores schema and encoding info + +## ApplicationjsonMediaType +public record ApplicationjsonMediaType
+implements [SealedMediaType](#sealedmediatype), MediaType<[ApplicationjsonSchema.ApplicationjsonSchema1](../../../../paths/fakerefsmammal/post/responses/code200response/content/applicationjson/ApplicationjsonSchema.md#applicationjsonschema1), Nothing?> + +class storing schema info for a specific contentType + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| ApplicationjsonMediaType()
Creates an instance | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| [ApplicationjsonSchema.ApplicationjsonSchema1](../../../../paths/fakerefsmammal/post/responses/code200response/content/applicationjson/ApplicationjsonSchema.md#applicationjsonschema1) | schema()
the schema for this MediaType | +| Nothing? | encoding()
the encoding info | + +## SealedResponseBody +public sealed interface SealedResponseBody
+permits
+[ApplicationjsonResponseBody](#applicationjsonresponsebody) + +sealed interface that stores response body + +## ApplicationjsonResponseBody +public record ApplicationjsonResponseBody
+implements [SealedResponseBody](#sealedresponsebody) + +A record class to store response body for contentType="application/json" + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| ApplicationjsonResponseBody(ApplicationjsonSchema.[Mammal1Boxed](../../../../components/schemas/Mammal.md#mammal1boxed) body)
Creates an instance | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| ApplicationjsonSchema.[Mammal1Boxed](../../../../components/schemas/Mammal.md#mammal1boxed) | body()
returns the body passed in in the constructor | + +## FakerefsmammalPostCode200Response1 +public static class FakerefsmammalPostCode200Response1
+extends ResponseDeserializer<[SealedResponseBody](#sealedresponsebody), Nothing?, [SealedMediaType](#sealedmediatype)> + +a class that deserializes responses + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| FakerefsmammalPostCode200Response1()
Creates an instance | + +### Field Summary +| Modifier and Type | Field and Description | +| ----------------- | --------------------- | +| 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 | +| ----------------- | ---------------------- | +| ApiResponse<[SealedResponseBody](#sealedresponsebody), Nothing?> | deserialize(HttpResponse response, SchemaConfiguration configuration)
called by endpoint when deserialize responses | diff --git a/samples/client/petstore/kotlin/docs/paths/fakerefsmammal/post/responses/code200response/content/applicationjson/ApplicationjsonSchema.md b/samples/client/petstore/kotlin/docs/paths/fakerefsmammal/post/responses/code200response/content/applicationjson/ApplicationjsonSchema.md new file mode 100644 index 00000000000..f0a5b53544f --- /dev/null +++ b/samples/client/petstore/kotlin/docs/paths/fakerefsmammal/post/responses/code200response/content/applicationjson/ApplicationjsonSchema.md @@ -0,0 +1,19 @@ +# ApplicationjsonSchema +public class ApplicationjsonSchema
+extends [Mammal1](../../../../../../../components/schemas/Mammal.md#mammal) + +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 + +## Nested Class Summary +| Modifier and Type | Class and Description | +| ----------------- | ---------------------- | +| static class | [ApplicationjsonSchema.ApplicationjsonSchema1](#applicationjsonschema1)
schema class | + +## ApplicationjsonSchema1 +public static class ApplicationjsonSchema1
+extends [Mammal.Mammal1](../../../../../../../components/schemas/Mammal.md#mammal1) + +A schema class that validates payloads diff --git a/samples/client/petstore/kotlin/docs/paths/fakerefsnumber/FakerefsnumberPost.md b/samples/client/petstore/kotlin/docs/paths/fakerefsnumber/FakerefsnumberPost.md new file mode 100644 index 00000000000..8bfc7f4c81f --- /dev/null +++ b/samples/client/petstore/kotlin/docs/paths/fakerefsnumber/FakerefsnumberPost.md @@ -0,0 +1,148 @@ +# FakerefsnumberPost + +public class FakerefsnumberPost + +A class that contains necessary endpoint classes +- a class that calls the endpoint method using the http verb +- a class that calls the endpoint method using the operationId name +- class(es) to store the request inputs +- builder(s) to set the request input data + +## Nested Class Summary +| Modifier and Type | Class and Description | +| ----------------- | --------------------- | +| static class | [Post](#post)
The class that has a post method to call the endpoint | +| interface | [NumberWithValidationsOperation](#numberwithvalidationsoperation)
The interface that has a numberWithValidations method to call the endpoint | +| static class | [PostRequest](#postrequest)
The request inputs class | +| static class | [PostRequestBuilder](#postrequestbuilder)
A builder for the request input class | + +## Post +public static class Post 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.FakerefsnumberPostRequestBody; +import org.openapijsonschematools.client.components.schemas.NumberWithValidations; +import org.openapijsonschematools.client.RootServerInfo; +import org.openapijsonschematools.client.servers.RootServer0; +import org.openapijsonschematools.client.servers.RootServer1; +import org.openapijsonschematools.client.servers.RootServer2; +import org.openapijsonschematools.client.paths.fakerefsnumber.post.responses.FakerefsnumberPostCode200Response; +import org.openapijsonschematools.client.servers.RootServerInfo; +import org.openapijsonschematools.client.paths.fakerefsnumber.FakerefsnumberPost; +import org.openapijsonschematools.client.paths.fakerefsnumber.post.FakerefsnumberPostResponses; + +import java.io.IOException; +import java.util.Arrays; +import java.util.List; +import java.util.Map; +import java.util.AbstractMap; + +// if you want to use a server that is not SERVER_0 pass it in here and change the ServerIndex input below +ApiConfiguration.ServerInfo serverInfo = new ApiConfiguration.ServerInfoBuilder() + .rootServerInfo( + new RootServerInfo.RootServerInfoBuilder() + .rootServer0(new RootServer0()) + .build() + ) + .build(); +ApiConfiguration.ServerIndexInfo serverIndexInfo = new ApiConfiguration.ServerIndexInfoBuilder() + .rootServerInfoServerIndex(RootServerInfo.ServerIndex.SERVER_0) + .build(); +Duration timeout = Duration.ofSeconds(1L); +Map> defaultHeaders = Map.of("User-Agent", List.of("OpenAPI-JSON-Schema-Generator/1.0.0/java")); +ApiConfiguration apiConfiguration = new ApiConfiguration( + serverInfo + serverIndexInfo, + timeout, + defaultHeaders +); +SchemaConfiguration schemaConfiguration = new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().build()); +FakerefsnumberPost.Post apiClient = new FakerefsnumberPost.Post(apiConfiguration, schemaConfiguration); + + +var request = new FakerefsnumberPost.PostRequestBuilder().build(); + +FakerefsnumberPostResponses.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; +} +FakerefsnumberPostResponses.EndpointFakerefsnumberPostCode200Response castResponse = (FakerefsnumberPostResponses.EndpointFakerefsnumberPostCode200Response) response; +FakerefsnumberPostCode200Response.ApplicationjsonResponseBody deserializedBody = (FakerefsnumberPostCode200Response.ApplicationjsonResponseBody) castResponse.body; +// handle deserialized body here +``` +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| Post(ApiConfiguration apiConfiguration, SchemaConfiguration schemaConfiguration)
Creates an instance | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| [FakerefsnumberPostResponses.EndpointResponse](../../paths/fakerefsnumber/post/FakerefsnumberPostResponses.md#endpointresponse) | post([PostRequest](#postrequest) request) | + +## NumberWithValidationsOperation +public interface NumberWithValidationsOperation
+ +an interface that allows one to call the endpoint using a method named numberWithValidations by the operationId + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| [FakerefsnumberPostResponses.EndpointResponse](../../paths/fakerefsnumber/post/FakerefsnumberPostResponses.md#endpointresponse) | numberWithValidations([PostRequest](#postrequest) request) | + +## PostRequest +public static class PostRequest
+ +a class that stores the final request inputs + +### Field Summary +| Modifier and Type | Field and Description | +| ----------------- | --------------------- | +| [FakerefsnumberPostRequestBody.@Nullable SealedRequestBody](../../paths/fakerefsnumber/post/FakerefsnumberPostRequestBody.md#sealedrequestbody) | requestBody
optional | +| [RootServerInfo.@Nullable ServerIndex](../../RootServerInfo.md#serverindex) | serverIndex
optional. Note: this will override the value in apiConfiguration | +| @Nullable Duration | timeout
optional. Note: this will override the value in apiConfiguration | + +## PostRequestBuilder +public static class PostRequestBuilder
+ +a builder for request inputs + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| PostRequestBuilder()
Creates a builder that contains null for all parameters | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| [PostRequest](#postrequest) | build()
Returns the request input used to call an endpoint method | +| [PostRequestBuilder](#postrequestbuilder) | requestBody([FakerefsnumberPostRequestBody.SealedRequestBody](../../paths/fakerefsnumber/post/FakerefsnumberPostRequestBody.md#sealedrequestbody) requestBody)
sets the optional property | +| [PostRequestBuilder](#postrequestbuilder) | serverIndex([RootServerInfo.ServerIndex](../../RootServerInfo.md#serverindex) serverIndex)
sets the optional property. Note: this will override the value in apiConfiguration | +| [PostRequestBuilder](#postrequestbuilder) | timeout(Duration timeout)
sets the optional property. Note: this will override the value in apiConfiguration | + +[[Back to top]](#top) [[Back to README]](../../../README.md) diff --git a/samples/client/petstore/kotlin/docs/paths/fakerefsnumber/post/FakerefsnumberPostRequestBody.md b/samples/client/petstore/kotlin/docs/paths/fakerefsnumber/post/FakerefsnumberPostRequestBody.md new file mode 100644 index 00000000000..ab2bbbc531e --- /dev/null +++ b/samples/client/petstore/kotlin/docs/paths/fakerefsnumber/post/FakerefsnumberPostRequestBody.md @@ -0,0 +1,90 @@ +# FakerefsnumberPostRequestBody + +public class FakerefsnumberPostRequestBody + +A class that contains necessary nested request body classes +- SealedMediaType, a sealed interface which contains all the schema/encoding info for each contentType +- records which implement SealedMediaType, the concrete media types +- a class that extends RequestBodySerializer and is used to serialize input SealedRequestBody instances +- SealedRequestBody, a sealed interface which contains all the contentType/schema input types +- records which implement SealedRequestBody, the concrete request body types + +## Nested Class Summary +| Modifier and Type | Class and Description | +| ----------------- | --------------------- | +| sealed interface | [FakerefsnumberPostRequestBody.SealedMediaType](#sealedmediatype)
media type sealed interface | +| record | [FakerefsnumberPostRequestBody.ApplicationjsonMediaType](#applicationjsonmediatype)
record storing schema + encoding for a specific contentType | +| static class | [FakerefsnumberPostRequestBody.FakerefsnumberPostRequestBody1](#fakerefsnumberpostrequestbody1)
class that serializes request bodies | +| sealed interface | [FakerefsnumberPostRequestBody.SealedRequestBody](#sealedrequestbody)
request body sealed interface | +| record | [FakerefsnumberPostRequestBody.ApplicationjsonRequestBody](#applicationjsonrequestbody)
implements sealed interface to store request body input | + +## SealedMediaType +public sealed interface SealedMediaType
+permits
+[ApplicationjsonMediaType](#applicationjsonmediatype) + +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), Nothing?> + +class storing schema info for a specific contentType + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| ApplicationjsonMediaType()
Creates an instance | + +### 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 | +| Nothing? | encoding()
the encoding info | + +## FakerefsnumberPostRequestBody1 +public static class FakerefsnumberPostRequestBody1
+ +a class that serializes SealedRequestBody request bodies + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| FakerefsnumberPostRequestBody1()
Creates an instance | + +### Field Summary +| Modifier and Type | Field and Description | +| ----------------- | --------------------- | +| boolean | required = false
whether the request body is required | +| 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 | +| ----------------- | ---------------------- | +| SerializedRequestBody | serialize([SealedRequestBody](#sealedrequestbody) requestBody)
called by endpoint when creating request body bytes | + +## SealedRequestBody +public sealed interface SealedRequestBody
+permits
+[ApplicationjsonRequestBody](#applicationjsonrequestbody) + +sealed interface that stores request contentType + validated schema data + +## ApplicationjsonRequestBody +public record ApplicationjsonRequestBody
+implements [SealedRequestBody](#sealedrequestbody),
+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 | + +### 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 | diff --git a/samples/client/petstore/kotlin/docs/paths/fakerefsnumber/post/FakerefsnumberPostResponses.md b/samples/client/petstore/kotlin/docs/paths/fakerefsnumber/post/FakerefsnumberPostResponses.md new file mode 100644 index 00000000000..3f5ac86f022 --- /dev/null +++ b/samples/client/petstore/kotlin/docs/paths/fakerefsnumber/post/FakerefsnumberPostResponses.md @@ -0,0 +1,29 @@ +# FakerefsnumberPostResponses + +public class FakerefsnumberPostResponses + +A class that contains necessary responses classes +- a sealed interface, EndpointResponse, that stores endpoint responses +- records for each endpoint response + +## Nested Class Summary +| Modifier and Type | Class and Description | +| ----------------- | --------------------- | +| sealed interface | [EndpointResponse](#endpointresponse)
stores the endpoint responses | +| record | [EndpointFakerefsnumberPostCode200Response](#endpointfakerefsnumberpostcode200response)
the response for 200 | + +## EndpointResponse +public sealed interface EndpointResponse permits
+[EndpointFakerefsnumberPostCode200Response](#endpointfakerefsnumberpostcode200response) + +a sealed interface that stores endpoint responses + +## EndpointFakerefsnumberPostCode200Response +public record EndpointFakerefsnumberPostCode200Response( + HttpResponse response, + [FakerefsnumberPostCode200Response.SealedResponseBody](../../../paths/fakerefsnumber/post/responses/FakerefsnumberPostCode200Response.md#sealedresponsebody) body, + Nothing? headers +) implements EndpointResponse, ApiResponse
+ +a class that stores an endpoint response + diff --git a/samples/client/petstore/kotlin/docs/paths/fakerefsnumber/post/requestbody/content/applicationjson/ApplicationjsonSchema.md b/samples/client/petstore/kotlin/docs/paths/fakerefsnumber/post/requestbody/content/applicationjson/ApplicationjsonSchema.md new file mode 100644 index 00000000000..a6a485e5657 --- /dev/null +++ b/samples/client/petstore/kotlin/docs/paths/fakerefsnumber/post/requestbody/content/applicationjson/ApplicationjsonSchema.md @@ -0,0 +1,19 @@ +# ApplicationjsonSchema +public class ApplicationjsonSchema
+extends [NumberWithValidations1](../../../../../../components/schemas/NumberWithValidations.md#numberwithvalidations) + +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 + +## Nested Class Summary +| Modifier and Type | Class and Description | +| ----------------- | ---------------------- | +| static class | [ApplicationjsonSchema.ApplicationjsonSchema1](#applicationjsonschema1)
schema class | + +## ApplicationjsonSchema1 +public static class ApplicationjsonSchema1
+extends [NumberWithValidations.NumberWithValidations1](../../../../../../components/schemas/NumberWithValidations.md#numberwithvalidations1) + +A schema class that validates payloads diff --git a/samples/client/petstore/kotlin/docs/paths/fakerefsnumber/post/responses/FakerefsnumberPostCode200Response.md b/samples/client/petstore/kotlin/docs/paths/fakerefsnumber/post/responses/FakerefsnumberPostCode200Response.md new file mode 100644 index 00000000000..e51d59b9439 --- /dev/null +++ b/samples/client/petstore/kotlin/docs/paths/fakerefsnumber/post/responses/FakerefsnumberPostCode200Response.md @@ -0,0 +1,87 @@ +# FakerefsnumberPostCode200Response + +public class FakerefsnumberPostCode200Response + +A class that contains necessary nested response classes +- SealedMediaType, a sealed interface which contains all the schema/encoding info for each contentType +- records which implement SealedMediaType, the concrete media types +- SealedResponseBody, a sealed interface which contains all the contentType/schema types +- records which implement SealedResponseBody, the concrete response body types +- a class that extends ResponseDeserializer and is used to deserialize responses + +## Nested Class Summary +| Modifier and Type | Class and Description | +| ----------------- | --------------------- | +| sealed interface | [FakerefsnumberPostCode200Response.SealedMediaType](#sealedmediatype)
media type sealed interface | +| record | [FakerefsnumberPostCode200Response.ApplicationjsonMediaType](#applicationjsonmediatype)
record storing schema + encoding for a specific contentType | +| sealed interface | [FakerefsnumberPostCode200Response.SealedResponseBody](#sealedresponsebody)
response body sealed interface | +| record | [FakerefsnumberPostCode200Response.ApplicationjsonResponseBody](#applicationjsonresponsebody)
implements sealed interface to store response body | +| static class | [FakerefsnumberPostCode200Response.FakerefsnumberPostCode200Response1](#fakerefsnumberpostcode200response1)
class that deserializes responses | + +## SealedMediaType +public sealed interface SealedMediaType
+permits
+[ApplicationjsonMediaType](#applicationjsonmediatype) + +sealed interface that stores schema and encoding info + +## ApplicationjsonMediaType +public record ApplicationjsonMediaType
+implements [SealedMediaType](#sealedmediatype), MediaType<[ApplicationjsonSchema.ApplicationjsonSchema1](../../../../paths/fakerefsnumber/post/responses/code200response/content/applicationjson/ApplicationjsonSchema.md#applicationjsonschema1), Nothing?> + +class storing schema info for a specific contentType + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| ApplicationjsonMediaType()
Creates an instance | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| [ApplicationjsonSchema.ApplicationjsonSchema1](../../../../paths/fakerefsnumber/post/responses/code200response/content/applicationjson/ApplicationjsonSchema.md#applicationjsonschema1) | schema()
the schema for this MediaType | +| Nothing? | encoding()
the encoding info | + +## SealedResponseBody +public sealed interface SealedResponseBody
+permits
+[ApplicationjsonResponseBody](#applicationjsonresponsebody) + +sealed interface that stores response body + +## ApplicationjsonResponseBody +public record ApplicationjsonResponseBody
+implements [SealedResponseBody](#sealedresponsebody) + +A record class to store response body for contentType="application/json" + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| ApplicationjsonResponseBody(ApplicationjsonSchema.[NumberWithValidations1Boxed](../../../../components/schemas/NumberWithValidations.md#numberwithvalidations1boxed) body)
Creates an instance | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| ApplicationjsonSchema.[NumberWithValidations1Boxed](../../../../components/schemas/NumberWithValidations.md#numberwithvalidations1boxed) | body()
returns the body passed in in the constructor | + +## FakerefsnumberPostCode200Response1 +public static class FakerefsnumberPostCode200Response1
+extends ResponseDeserializer<[SealedResponseBody](#sealedresponsebody), Nothing?, [SealedMediaType](#sealedmediatype)> + +a class that deserializes responses + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| FakerefsnumberPostCode200Response1()
Creates an instance | + +### Field Summary +| Modifier and Type | Field and Description | +| ----------------- | --------------------- | +| 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 | +| ----------------- | ---------------------- | +| ApiResponse<[SealedResponseBody](#sealedresponsebody), Nothing?> | deserialize(HttpResponse response, SchemaConfiguration configuration)
called by endpoint when deserialize responses | diff --git a/samples/client/petstore/kotlin/docs/paths/fakerefsnumber/post/responses/code200response/content/applicationjson/ApplicationjsonSchema.md b/samples/client/petstore/kotlin/docs/paths/fakerefsnumber/post/responses/code200response/content/applicationjson/ApplicationjsonSchema.md new file mode 100644 index 00000000000..a903474b2ee --- /dev/null +++ b/samples/client/petstore/kotlin/docs/paths/fakerefsnumber/post/responses/code200response/content/applicationjson/ApplicationjsonSchema.md @@ -0,0 +1,19 @@ +# ApplicationjsonSchema +public class ApplicationjsonSchema
+extends [NumberWithValidations1](../../../../../../../components/schemas/NumberWithValidations.md#numberwithvalidations) + +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 + +## Nested Class Summary +| Modifier and Type | Class and Description | +| ----------------- | ---------------------- | +| static class | [ApplicationjsonSchema.ApplicationjsonSchema1](#applicationjsonschema1)
schema class | + +## ApplicationjsonSchema1 +public static class ApplicationjsonSchema1
+extends [NumberWithValidations.NumberWithValidations1](../../../../../../../components/schemas/NumberWithValidations.md#numberwithvalidations1) + +A schema class that validates payloads diff --git a/samples/client/petstore/kotlin/docs/paths/fakerefsobjectmodelwithrefprops/FakerefsobjectmodelwithrefpropsPost.md b/samples/client/petstore/kotlin/docs/paths/fakerefsobjectmodelwithrefprops/FakerefsobjectmodelwithrefpropsPost.md new file mode 100644 index 00000000000..0b6534762de --- /dev/null +++ b/samples/client/petstore/kotlin/docs/paths/fakerefsobjectmodelwithrefprops/FakerefsobjectmodelwithrefpropsPost.md @@ -0,0 +1,148 @@ +# FakerefsobjectmodelwithrefpropsPost + +public class FakerefsobjectmodelwithrefpropsPost + +A class that contains necessary endpoint classes +- a class that calls the endpoint method using the http verb +- a class that calls the endpoint method using the operationId name +- class(es) to store the request inputs +- builder(s) to set the request input data + +## Nested Class Summary +| Modifier and Type | Class and Description | +| ----------------- | --------------------- | +| static class | [Post](#post)
The class that has a post method to call the endpoint | +| interface | [ObjectModelWithRefPropsOperation](#objectmodelwithrefpropsoperation)
The interface that has a objectModelWithRefProps method to call the endpoint | +| static class | [PostRequest](#postrequest)
The request inputs class | +| static class | [PostRequestBuilder](#postrequestbuilder)
A builder for the request input class | + +## Post +public static class Post 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.FakerefsobjectmodelwithrefpropsPostRequestBody; +import org.openapijsonschematools.client.components.schemas.ObjectModelWithRefProps; +import org.openapijsonschematools.client.RootServerInfo; +import org.openapijsonschematools.client.servers.RootServer0; +import org.openapijsonschematools.client.servers.RootServer1; +import org.openapijsonschematools.client.servers.RootServer2; +import org.openapijsonschematools.client.paths.fakerefsobjectmodelwithrefprops.post.responses.FakerefsobjectmodelwithrefpropsPostCode200Response; +import org.openapijsonschematools.client.servers.RootServerInfo; +import org.openapijsonschematools.client.paths.fakerefsobjectmodelwithrefprops.FakerefsobjectmodelwithrefpropsPost; +import org.openapijsonschematools.client.paths.fakerefsobjectmodelwithrefprops.post.FakerefsobjectmodelwithrefpropsPostResponses; + +import java.io.IOException; +import java.util.Arrays; +import java.util.List; +import java.util.Map; +import java.util.AbstractMap; + +// if you want to use a server that is not SERVER_0 pass it in here and change the ServerIndex input below +ApiConfiguration.ServerInfo serverInfo = new ApiConfiguration.ServerInfoBuilder() + .rootServerInfo( + new RootServerInfo.RootServerInfoBuilder() + .rootServer0(new RootServer0()) + .build() + ) + .build(); +ApiConfiguration.ServerIndexInfo serverIndexInfo = new ApiConfiguration.ServerIndexInfoBuilder() + .rootServerInfoServerIndex(RootServerInfo.ServerIndex.SERVER_0) + .build(); +Duration timeout = Duration.ofSeconds(1L); +Map> defaultHeaders = Map.of("User-Agent", List.of("OpenAPI-JSON-Schema-Generator/1.0.0/java")); +ApiConfiguration apiConfiguration = new ApiConfiguration( + serverInfo + serverIndexInfo, + timeout, + defaultHeaders +); +SchemaConfiguration schemaConfiguration = new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().build()); +FakerefsobjectmodelwithrefpropsPost.Post apiClient = new FakerefsobjectmodelwithrefpropsPost.Post(apiConfiguration, schemaConfiguration); + + +var request = new FakerefsobjectmodelwithrefpropsPost.PostRequestBuilder().build(); + +FakerefsobjectmodelwithrefpropsPostResponses.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; +} +FakerefsobjectmodelwithrefpropsPostResponses.EndpointFakerefsobjectmodelwithrefpropsPostCode200Response castResponse = (FakerefsobjectmodelwithrefpropsPostResponses.EndpointFakerefsobjectmodelwithrefpropsPostCode200Response) response; +FakerefsobjectmodelwithrefpropsPostCode200Response.ApplicationjsonResponseBody deserializedBody = (FakerefsobjectmodelwithrefpropsPostCode200Response.ApplicationjsonResponseBody) castResponse.body; +// handle deserialized body here +``` +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| Post(ApiConfiguration apiConfiguration, SchemaConfiguration schemaConfiguration)
Creates an instance | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| [FakerefsobjectmodelwithrefpropsPostResponses.EndpointResponse](../../paths/fakerefsobjectmodelwithrefprops/post/FakerefsobjectmodelwithrefpropsPostResponses.md#endpointresponse) | post([PostRequest](#postrequest) request) | + +## ObjectModelWithRefPropsOperation +public interface ObjectModelWithRefPropsOperation
+ +an interface that allows one to call the endpoint using a method named objectModelWithRefProps by the operationId + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| [FakerefsobjectmodelwithrefpropsPostResponses.EndpointResponse](../../paths/fakerefsobjectmodelwithrefprops/post/FakerefsobjectmodelwithrefpropsPostResponses.md#endpointresponse) | objectModelWithRefProps([PostRequest](#postrequest) request) | + +## PostRequest +public static class PostRequest
+ +a class that stores the final request inputs + +### Field Summary +| Modifier and Type | Field and Description | +| ----------------- | --------------------- | +| [FakerefsobjectmodelwithrefpropsPostRequestBody.@Nullable SealedRequestBody](../../paths/fakerefsobjectmodelwithrefprops/post/FakerefsobjectmodelwithrefpropsPostRequestBody.md#sealedrequestbody) | requestBody
optional | +| [RootServerInfo.@Nullable ServerIndex](../../RootServerInfo.md#serverindex) | serverIndex
optional. Note: this will override the value in apiConfiguration | +| @Nullable Duration | timeout
optional. Note: this will override the value in apiConfiguration | + +## PostRequestBuilder +public static class PostRequestBuilder
+ +a builder for request inputs + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| PostRequestBuilder()
Creates a builder that contains null for all parameters | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| [PostRequest](#postrequest) | build()
Returns the request input used to call an endpoint method | +| [PostRequestBuilder](#postrequestbuilder) | requestBody([FakerefsobjectmodelwithrefpropsPostRequestBody.SealedRequestBody](../../paths/fakerefsobjectmodelwithrefprops/post/FakerefsobjectmodelwithrefpropsPostRequestBody.md#sealedrequestbody) requestBody)
sets the optional property | +| [PostRequestBuilder](#postrequestbuilder) | serverIndex([RootServerInfo.ServerIndex](../../RootServerInfo.md#serverindex) serverIndex)
sets the optional property. Note: this will override the value in apiConfiguration | +| [PostRequestBuilder](#postrequestbuilder) | timeout(Duration timeout)
sets the optional property. Note: this will override the value in apiConfiguration | + +[[Back to top]](#top) [[Back to README]](../../../README.md) diff --git a/samples/client/petstore/kotlin/docs/paths/fakerefsobjectmodelwithrefprops/post/FakerefsobjectmodelwithrefpropsPostRequestBody.md b/samples/client/petstore/kotlin/docs/paths/fakerefsobjectmodelwithrefprops/post/FakerefsobjectmodelwithrefpropsPostRequestBody.md new file mode 100644 index 00000000000..cd1403df034 --- /dev/null +++ b/samples/client/petstore/kotlin/docs/paths/fakerefsobjectmodelwithrefprops/post/FakerefsobjectmodelwithrefpropsPostRequestBody.md @@ -0,0 +1,90 @@ +# FakerefsobjectmodelwithrefpropsPostRequestBody + +public class FakerefsobjectmodelwithrefpropsPostRequestBody + +A class that contains necessary nested request body classes +- SealedMediaType, a sealed interface which contains all the schema/encoding info for each contentType +- records which implement SealedMediaType, the concrete media types +- a class that extends RequestBodySerializer and is used to serialize input SealedRequestBody instances +- SealedRequestBody, a sealed interface which contains all the contentType/schema input types +- records which implement SealedRequestBody, the concrete request body types + +## Nested Class Summary +| Modifier and Type | Class and Description | +| ----------------- | --------------------- | +| sealed interface | [FakerefsobjectmodelwithrefpropsPostRequestBody.SealedMediaType](#sealedmediatype)
media type sealed interface | +| record | [FakerefsobjectmodelwithrefpropsPostRequestBody.ApplicationjsonMediaType](#applicationjsonmediatype)
record storing schema + encoding for a specific contentType | +| static class | [FakerefsobjectmodelwithrefpropsPostRequestBody.FakerefsobjectmodelwithrefpropsPostRequestBody1](#fakerefsobjectmodelwithrefpropspostrequestbody1)
class that serializes request bodies | +| sealed interface | [FakerefsobjectmodelwithrefpropsPostRequestBody.SealedRequestBody](#sealedrequestbody)
request body sealed interface | +| record | [FakerefsobjectmodelwithrefpropsPostRequestBody.ApplicationjsonRequestBody](#applicationjsonrequestbody)
implements sealed interface to store request body input | + +## SealedMediaType +public sealed interface SealedMediaType
+permits
+[ApplicationjsonMediaType](#applicationjsonmediatype) + +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), Nothing?> + +class storing schema info for a specific contentType + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| ApplicationjsonMediaType()
Creates an instance | + +### 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 | +| Nothing? | encoding()
the encoding info | + +## FakerefsobjectmodelwithrefpropsPostRequestBody1 +public static class FakerefsobjectmodelwithrefpropsPostRequestBody1
+ +a class that serializes SealedRequestBody request bodies + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| FakerefsobjectmodelwithrefpropsPostRequestBody1()
Creates an instance | + +### Field Summary +| Modifier and Type | Field and Description | +| ----------------- | --------------------- | +| boolean | required = false
whether the request body is required | +| 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 | +| ----------------- | ---------------------- | +| SerializedRequestBody | serialize([SealedRequestBody](#sealedrequestbody) requestBody)
called by endpoint when creating request body bytes | + +## SealedRequestBody +public sealed interface SealedRequestBody
+permits
+[ApplicationjsonRequestBody](#applicationjsonrequestbody) + +sealed interface that stores request contentType + validated schema data + +## ApplicationjsonRequestBody +public record ApplicationjsonRequestBody
+implements [SealedRequestBody](#sealedrequestbody),
+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 | + +### 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 | diff --git a/samples/client/petstore/kotlin/docs/paths/fakerefsobjectmodelwithrefprops/post/FakerefsobjectmodelwithrefpropsPostResponses.md b/samples/client/petstore/kotlin/docs/paths/fakerefsobjectmodelwithrefprops/post/FakerefsobjectmodelwithrefpropsPostResponses.md new file mode 100644 index 00000000000..08061091baf --- /dev/null +++ b/samples/client/petstore/kotlin/docs/paths/fakerefsobjectmodelwithrefprops/post/FakerefsobjectmodelwithrefpropsPostResponses.md @@ -0,0 +1,29 @@ +# FakerefsobjectmodelwithrefpropsPostResponses + +public class FakerefsobjectmodelwithrefpropsPostResponses + +A class that contains necessary responses classes +- a sealed interface, EndpointResponse, that stores endpoint responses +- records for each endpoint response + +## Nested Class Summary +| Modifier and Type | Class and Description | +| ----------------- | --------------------- | +| sealed interface | [EndpointResponse](#endpointresponse)
stores the endpoint responses | +| record | [EndpointFakerefsobjectmodelwithrefpropsPostCode200Response](#endpointfakerefsobjectmodelwithrefpropspostcode200response)
the response for 200 | + +## EndpointResponse +public sealed interface EndpointResponse permits
+[EndpointFakerefsobjectmodelwithrefpropsPostCode200Response](#endpointfakerefsobjectmodelwithrefpropspostcode200response) + +a sealed interface that stores endpoint responses + +## EndpointFakerefsobjectmodelwithrefpropsPostCode200Response +public record EndpointFakerefsobjectmodelwithrefpropsPostCode200Response( + HttpResponse response, + [FakerefsobjectmodelwithrefpropsPostCode200Response.SealedResponseBody](../../../paths/fakerefsobjectmodelwithrefprops/post/responses/FakerefsobjectmodelwithrefpropsPostCode200Response.md#sealedresponsebody) body, + Nothing? headers +) implements EndpointResponse, ApiResponse
+ +a class that stores an endpoint response + diff --git a/samples/client/petstore/kotlin/docs/paths/fakerefsobjectmodelwithrefprops/post/requestbody/content/applicationjson/ApplicationjsonSchema.md b/samples/client/petstore/kotlin/docs/paths/fakerefsobjectmodelwithrefprops/post/requestbody/content/applicationjson/ApplicationjsonSchema.md new file mode 100644 index 00000000000..0cdc2140e3a --- /dev/null +++ b/samples/client/petstore/kotlin/docs/paths/fakerefsobjectmodelwithrefprops/post/requestbody/content/applicationjson/ApplicationjsonSchema.md @@ -0,0 +1,19 @@ +# ApplicationjsonSchema +public class ApplicationjsonSchema
+extends [ObjectModelWithRefProps1](../../../../../../components/schemas/ObjectModelWithRefProps.md#objectmodelwithrefprops) + +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 + +## Nested Class Summary +| Modifier and Type | Class and Description | +| ----------------- | ---------------------- | +| static class | [ApplicationjsonSchema.ApplicationjsonSchema1](#applicationjsonschema1)
schema class | + +## ApplicationjsonSchema1 +public static class ApplicationjsonSchema1
+extends [ObjectModelWithRefProps.ObjectModelWithRefProps1](../../../../../../components/schemas/ObjectModelWithRefProps.md#objectmodelwithrefprops1) + +A schema class that validates payloads diff --git a/samples/client/petstore/kotlin/docs/paths/fakerefsobjectmodelwithrefprops/post/responses/FakerefsobjectmodelwithrefpropsPostCode200Response.md b/samples/client/petstore/kotlin/docs/paths/fakerefsobjectmodelwithrefprops/post/responses/FakerefsobjectmodelwithrefpropsPostCode200Response.md new file mode 100644 index 00000000000..3ed79b631f0 --- /dev/null +++ b/samples/client/petstore/kotlin/docs/paths/fakerefsobjectmodelwithrefprops/post/responses/FakerefsobjectmodelwithrefpropsPostCode200Response.md @@ -0,0 +1,87 @@ +# FakerefsobjectmodelwithrefpropsPostCode200Response + +public class FakerefsobjectmodelwithrefpropsPostCode200Response + +A class that contains necessary nested response classes +- SealedMediaType, a sealed interface which contains all the schema/encoding info for each contentType +- records which implement SealedMediaType, the concrete media types +- SealedResponseBody, a sealed interface which contains all the contentType/schema types +- records which implement SealedResponseBody, the concrete response body types +- a class that extends ResponseDeserializer and is used to deserialize responses + +## Nested Class Summary +| Modifier and Type | Class and Description | +| ----------------- | --------------------- | +| sealed interface | [FakerefsobjectmodelwithrefpropsPostCode200Response.SealedMediaType](#sealedmediatype)
media type sealed interface | +| record | [FakerefsobjectmodelwithrefpropsPostCode200Response.ApplicationjsonMediaType](#applicationjsonmediatype)
record storing schema + encoding for a specific contentType | +| sealed interface | [FakerefsobjectmodelwithrefpropsPostCode200Response.SealedResponseBody](#sealedresponsebody)
response body sealed interface | +| record | [FakerefsobjectmodelwithrefpropsPostCode200Response.ApplicationjsonResponseBody](#applicationjsonresponsebody)
implements sealed interface to store response body | +| static class | [FakerefsobjectmodelwithrefpropsPostCode200Response.FakerefsobjectmodelwithrefpropsPostCode200Response1](#fakerefsobjectmodelwithrefpropspostcode200response1)
class that deserializes responses | + +## SealedMediaType +public sealed interface SealedMediaType
+permits
+[ApplicationjsonMediaType](#applicationjsonmediatype) + +sealed interface that stores schema and encoding info + +## ApplicationjsonMediaType +public record ApplicationjsonMediaType
+implements [SealedMediaType](#sealedmediatype), MediaType<[ApplicationjsonSchema.ApplicationjsonSchema1](../../../../paths/fakerefsobjectmodelwithrefprops/post/responses/code200response/content/applicationjson/ApplicationjsonSchema.md#applicationjsonschema1), Nothing?> + +class storing schema info for a specific contentType + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| ApplicationjsonMediaType()
Creates an instance | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| [ApplicationjsonSchema.ApplicationjsonSchema1](../../../../paths/fakerefsobjectmodelwithrefprops/post/responses/code200response/content/applicationjson/ApplicationjsonSchema.md#applicationjsonschema1) | schema()
the schema for this MediaType | +| Nothing? | encoding()
the encoding info | + +## SealedResponseBody +public sealed interface SealedResponseBody
+permits
+[ApplicationjsonResponseBody](#applicationjsonresponsebody) + +sealed interface that stores response body + +## ApplicationjsonResponseBody +public record ApplicationjsonResponseBody
+implements [SealedResponseBody](#sealedresponsebody) + +A record class to store response body for contentType="application/json" + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| ApplicationjsonResponseBody(ApplicationjsonSchema.[ObjectModelWithRefProps1Boxed](../../../../components/schemas/ObjectModelWithRefProps.md#objectmodelwithrefprops1boxed) body)
Creates an instance | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| ApplicationjsonSchema.[ObjectModelWithRefProps1Boxed](../../../../components/schemas/ObjectModelWithRefProps.md#objectmodelwithrefprops1boxed) | body()
returns the body passed in in the constructor | + +## FakerefsobjectmodelwithrefpropsPostCode200Response1 +public static class FakerefsobjectmodelwithrefpropsPostCode200Response1
+extends ResponseDeserializer<[SealedResponseBody](#sealedresponsebody), Nothing?, [SealedMediaType](#sealedmediatype)> + +a class that deserializes responses + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| FakerefsobjectmodelwithrefpropsPostCode200Response1()
Creates an instance | + +### Field Summary +| Modifier and Type | Field and Description | +| ----------------- | --------------------- | +| 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 | +| ----------------- | ---------------------- | +| ApiResponse<[SealedResponseBody](#sealedresponsebody), Nothing?> | deserialize(HttpResponse response, SchemaConfiguration configuration)
called by endpoint when deserialize responses | diff --git a/samples/client/petstore/kotlin/docs/paths/fakerefsobjectmodelwithrefprops/post/responses/code200response/content/applicationjson/ApplicationjsonSchema.md b/samples/client/petstore/kotlin/docs/paths/fakerefsobjectmodelwithrefprops/post/responses/code200response/content/applicationjson/ApplicationjsonSchema.md new file mode 100644 index 00000000000..495e07e6094 --- /dev/null +++ b/samples/client/petstore/kotlin/docs/paths/fakerefsobjectmodelwithrefprops/post/responses/code200response/content/applicationjson/ApplicationjsonSchema.md @@ -0,0 +1,19 @@ +# ApplicationjsonSchema +public class ApplicationjsonSchema
+extends [ObjectModelWithRefProps1](../../../../../../../components/schemas/ObjectModelWithRefProps.md#objectmodelwithrefprops) + +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 + +## Nested Class Summary +| Modifier and Type | Class and Description | +| ----------------- | ---------------------- | +| static class | [ApplicationjsonSchema.ApplicationjsonSchema1](#applicationjsonschema1)
schema class | + +## ApplicationjsonSchema1 +public static class ApplicationjsonSchema1
+extends [ObjectModelWithRefProps.ObjectModelWithRefProps1](../../../../../../../components/schemas/ObjectModelWithRefProps.md#objectmodelwithrefprops1) + +A schema class that validates payloads diff --git a/samples/client/petstore/kotlin/docs/paths/fakerefsstring/FakerefsstringPost.md b/samples/client/petstore/kotlin/docs/paths/fakerefsstring/FakerefsstringPost.md new file mode 100644 index 00000000000..0a83e8e30bd --- /dev/null +++ b/samples/client/petstore/kotlin/docs/paths/fakerefsstring/FakerefsstringPost.md @@ -0,0 +1,148 @@ +# FakerefsstringPost + +public class FakerefsstringPost + +A class that contains necessary endpoint classes +- a class that calls the endpoint method using the http verb +- a class that calls the endpoint method using the operationId name +- class(es) to store the request inputs +- builder(s) to set the request input data + +## Nested Class Summary +| Modifier and Type | Class and Description | +| ----------------- | --------------------- | +| static class | [Post](#post)
The class that has a post method to call the endpoint | +| interface | [ModelStringOperation](#modelstringoperation)
The interface that has a modelString method to call the endpoint | +| static class | [PostRequest](#postrequest)
The request inputs class | +| static class | [PostRequestBuilder](#postrequestbuilder)
A builder for the request input class | + +## Post +public static class Post 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.FakerefsstringPostRequestBody; +import org.openapijsonschematools.client.components.schemas.StringSchema; +import org.openapijsonschematools.client.RootServerInfo; +import org.openapijsonschematools.client.servers.RootServer0; +import org.openapijsonschematools.client.servers.RootServer1; +import org.openapijsonschematools.client.servers.RootServer2; +import org.openapijsonschematools.client.paths.fakerefsstring.post.responses.FakerefsstringPostCode200Response; +import org.openapijsonschematools.client.servers.RootServerInfo; +import org.openapijsonschematools.client.paths.fakerefsstring.FakerefsstringPost; +import org.openapijsonschematools.client.paths.fakerefsstring.post.FakerefsstringPostResponses; + +import java.io.IOException; +import java.util.Arrays; +import java.util.List; +import java.util.Map; +import java.util.AbstractMap; + +// if you want to use a server that is not SERVER_0 pass it in here and change the ServerIndex input below +ApiConfiguration.ServerInfo serverInfo = new ApiConfiguration.ServerInfoBuilder() + .rootServerInfo( + new RootServerInfo.RootServerInfoBuilder() + .rootServer0(new RootServer0()) + .build() + ) + .build(); +ApiConfiguration.ServerIndexInfo serverIndexInfo = new ApiConfiguration.ServerIndexInfoBuilder() + .rootServerInfoServerIndex(RootServerInfo.ServerIndex.SERVER_0) + .build(); +Duration timeout = Duration.ofSeconds(1L); +Map> defaultHeaders = Map.of("User-Agent", List.of("OpenAPI-JSON-Schema-Generator/1.0.0/java")); +ApiConfiguration apiConfiguration = new ApiConfiguration( + serverInfo + serverIndexInfo, + timeout, + defaultHeaders +); +SchemaConfiguration schemaConfiguration = new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().build()); +FakerefsstringPost.Post apiClient = new FakerefsstringPost.Post(apiConfiguration, schemaConfiguration); + + +var request = new FakerefsstringPost.PostRequestBuilder().build(); + +FakerefsstringPostResponses.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; +} +FakerefsstringPostResponses.EndpointFakerefsstringPostCode200Response castResponse = (FakerefsstringPostResponses.EndpointFakerefsstringPostCode200Response) response; +FakerefsstringPostCode200Response.ApplicationjsonResponseBody deserializedBody = (FakerefsstringPostCode200Response.ApplicationjsonResponseBody) castResponse.body; +// handle deserialized body here +``` +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| Post(ApiConfiguration apiConfiguration, SchemaConfiguration schemaConfiguration)
Creates an instance | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| [FakerefsstringPostResponses.EndpointResponse](../../paths/fakerefsstring/post/FakerefsstringPostResponses.md#endpointresponse) | post([PostRequest](#postrequest) request) | + +## ModelStringOperation +public interface ModelStringOperation
+ +an interface that allows one to call the endpoint using a method named modelString by the operationId + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| [FakerefsstringPostResponses.EndpointResponse](../../paths/fakerefsstring/post/FakerefsstringPostResponses.md#endpointresponse) | modelString([PostRequest](#postrequest) request) | + +## PostRequest +public static class PostRequest
+ +a class that stores the final request inputs + +### Field Summary +| Modifier and Type | Field and Description | +| ----------------- | --------------------- | +| [FakerefsstringPostRequestBody.@Nullable SealedRequestBody](../../paths/fakerefsstring/post/FakerefsstringPostRequestBody.md#sealedrequestbody) | requestBody
optional | +| [RootServerInfo.@Nullable ServerIndex](../../RootServerInfo.md#serverindex) | serverIndex
optional. Note: this will override the value in apiConfiguration | +| @Nullable Duration | timeout
optional. Note: this will override the value in apiConfiguration | + +## PostRequestBuilder +public static class PostRequestBuilder
+ +a builder for request inputs + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| PostRequestBuilder()
Creates a builder that contains null for all parameters | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| [PostRequest](#postrequest) | build()
Returns the request input used to call an endpoint method | +| [PostRequestBuilder](#postrequestbuilder) | requestBody([FakerefsstringPostRequestBody.SealedRequestBody](../../paths/fakerefsstring/post/FakerefsstringPostRequestBody.md#sealedrequestbody) requestBody)
sets the optional property | +| [PostRequestBuilder](#postrequestbuilder) | serverIndex([RootServerInfo.ServerIndex](../../RootServerInfo.md#serverindex) serverIndex)
sets the optional property. Note: this will override the value in apiConfiguration | +| [PostRequestBuilder](#postrequestbuilder) | timeout(Duration timeout)
sets the optional property. Note: this will override the value in apiConfiguration | + +[[Back to top]](#top) [[Back to README]](../../../README.md) diff --git a/samples/client/petstore/kotlin/docs/paths/fakerefsstring/post/FakerefsstringPostRequestBody.md b/samples/client/petstore/kotlin/docs/paths/fakerefsstring/post/FakerefsstringPostRequestBody.md new file mode 100644 index 00000000000..98df41e8065 --- /dev/null +++ b/samples/client/petstore/kotlin/docs/paths/fakerefsstring/post/FakerefsstringPostRequestBody.md @@ -0,0 +1,90 @@ +# FakerefsstringPostRequestBody + +public class FakerefsstringPostRequestBody + +A class that contains necessary nested request body classes +- SealedMediaType, a sealed interface which contains all the schema/encoding info for each contentType +- records which implement SealedMediaType, the concrete media types +- a class that extends RequestBodySerializer and is used to serialize input SealedRequestBody instances +- SealedRequestBody, a sealed interface which contains all the contentType/schema input types +- records which implement SealedRequestBody, the concrete request body types + +## Nested Class Summary +| Modifier and Type | Class and Description | +| ----------------- | --------------------- | +| sealed interface | [FakerefsstringPostRequestBody.SealedMediaType](#sealedmediatype)
media type sealed interface | +| record | [FakerefsstringPostRequestBody.ApplicationjsonMediaType](#applicationjsonmediatype)
record storing schema + encoding for a specific contentType | +| static class | [FakerefsstringPostRequestBody.FakerefsstringPostRequestBody1](#fakerefsstringpostrequestbody1)
class that serializes request bodies | +| sealed interface | [FakerefsstringPostRequestBody.SealedRequestBody](#sealedrequestbody)
request body sealed interface | +| record | [FakerefsstringPostRequestBody.ApplicationjsonRequestBody](#applicationjsonrequestbody)
implements sealed interface to store request body input | + +## SealedMediaType +public sealed interface SealedMediaType
+permits
+[ApplicationjsonMediaType](#applicationjsonmediatype) + +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), Nothing?> + +class storing schema info for a specific contentType + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| ApplicationjsonMediaType()
Creates an instance | + +### 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 | +| Nothing? | encoding()
the encoding info | + +## FakerefsstringPostRequestBody1 +public static class FakerefsstringPostRequestBody1
+ +a class that serializes SealedRequestBody request bodies + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| FakerefsstringPostRequestBody1()
Creates an instance | + +### Field Summary +| Modifier and Type | Field and Description | +| ----------------- | --------------------- | +| boolean | required = false
whether the request body is required | +| 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 | +| ----------------- | ---------------------- | +| SerializedRequestBody | serialize([SealedRequestBody](#sealedrequestbody) requestBody)
called by endpoint when creating request body bytes | + +## SealedRequestBody +public sealed interface SealedRequestBody
+permits
+[ApplicationjsonRequestBody](#applicationjsonrequestbody) + +sealed interface that stores request contentType + validated schema data + +## ApplicationjsonRequestBody +public record ApplicationjsonRequestBody
+implements [SealedRequestBody](#sealedrequestbody),
+GenericRequestBody
+ +A record class to store request body input for contentType="application/json" + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| ApplicationjsonRequestBody(ApplicationjsonSchema.StringJsonSchema1Boxed body)
Creates an instance | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| String | contentType()
always returns "application/json" | +| ApplicationjsonSchema.StringJsonSchema1Boxed | body()
returns the body passed in in the constructor | diff --git a/samples/client/petstore/kotlin/docs/paths/fakerefsstring/post/FakerefsstringPostResponses.md b/samples/client/petstore/kotlin/docs/paths/fakerefsstring/post/FakerefsstringPostResponses.md new file mode 100644 index 00000000000..cf90e75c73b --- /dev/null +++ b/samples/client/petstore/kotlin/docs/paths/fakerefsstring/post/FakerefsstringPostResponses.md @@ -0,0 +1,29 @@ +# FakerefsstringPostResponses + +public class FakerefsstringPostResponses + +A class that contains necessary responses classes +- a sealed interface, EndpointResponse, that stores endpoint responses +- records for each endpoint response + +## Nested Class Summary +| Modifier and Type | Class and Description | +| ----------------- | --------------------- | +| sealed interface | [EndpointResponse](#endpointresponse)
stores the endpoint responses | +| record | [EndpointFakerefsstringPostCode200Response](#endpointfakerefsstringpostcode200response)
the response for 200 | + +## EndpointResponse +public sealed interface EndpointResponse permits
+[EndpointFakerefsstringPostCode200Response](#endpointfakerefsstringpostcode200response) + +a sealed interface that stores endpoint responses + +## EndpointFakerefsstringPostCode200Response +public record EndpointFakerefsstringPostCode200Response( + HttpResponse response, + [FakerefsstringPostCode200Response.SealedResponseBody](../../../paths/fakerefsstring/post/responses/FakerefsstringPostCode200Response.md#sealedresponsebody) body, + Nothing? headers +) implements EndpointResponse, ApiResponse
+ +a class that stores an endpoint response + diff --git a/samples/client/petstore/kotlin/docs/paths/fakerefsstring/post/requestbody/content/applicationjson/ApplicationjsonSchema.md b/samples/client/petstore/kotlin/docs/paths/fakerefsstring/post/requestbody/content/applicationjson/ApplicationjsonSchema.md new file mode 100644 index 00000000000..abe4f0713c9 --- /dev/null +++ b/samples/client/petstore/kotlin/docs/paths/fakerefsstring/post/requestbody/content/applicationjson/ApplicationjsonSchema.md @@ -0,0 +1,19 @@ +# ApplicationjsonSchema +public class ApplicationjsonSchema
+extends [StringSchema1](../../../../../../components/schemas/StringSchema.md#stringschema) + +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 + +## Nested Class Summary +| Modifier and Type | Class and Description | +| ----------------- | ---------------------- | +| static class | [ApplicationjsonSchema.ApplicationjsonSchema1](#applicationjsonschema1)
schema class | + +## ApplicationjsonSchema1 +public static class ApplicationjsonSchema1
+extends [StringSchema.StringSchema1](../../../../../../components/schemas/StringSchema.md#stringschema1) + +A schema class that validates payloads diff --git a/samples/client/petstore/kotlin/docs/paths/fakerefsstring/post/responses/FakerefsstringPostCode200Response.md b/samples/client/petstore/kotlin/docs/paths/fakerefsstring/post/responses/FakerefsstringPostCode200Response.md new file mode 100644 index 00000000000..bea2ebfdb19 --- /dev/null +++ b/samples/client/petstore/kotlin/docs/paths/fakerefsstring/post/responses/FakerefsstringPostCode200Response.md @@ -0,0 +1,87 @@ +# FakerefsstringPostCode200Response + +public class FakerefsstringPostCode200Response + +A class that contains necessary nested response classes +- SealedMediaType, a sealed interface which contains all the schema/encoding info for each contentType +- records which implement SealedMediaType, the concrete media types +- SealedResponseBody, a sealed interface which contains all the contentType/schema types +- records which implement SealedResponseBody, the concrete response body types +- a class that extends ResponseDeserializer and is used to deserialize responses + +## Nested Class Summary +| Modifier and Type | Class and Description | +| ----------------- | --------------------- | +| sealed interface | [FakerefsstringPostCode200Response.SealedMediaType](#sealedmediatype)
media type sealed interface | +| record | [FakerefsstringPostCode200Response.ApplicationjsonMediaType](#applicationjsonmediatype)
record storing schema + encoding for a specific contentType | +| sealed interface | [FakerefsstringPostCode200Response.SealedResponseBody](#sealedresponsebody)
response body sealed interface | +| record | [FakerefsstringPostCode200Response.ApplicationjsonResponseBody](#applicationjsonresponsebody)
implements sealed interface to store response body | +| static class | [FakerefsstringPostCode200Response.FakerefsstringPostCode200Response1](#fakerefsstringpostcode200response1)
class that deserializes responses | + +## SealedMediaType +public sealed interface SealedMediaType
+permits
+[ApplicationjsonMediaType](#applicationjsonmediatype) + +sealed interface that stores schema and encoding info + +## ApplicationjsonMediaType +public record ApplicationjsonMediaType
+implements [SealedMediaType](#sealedmediatype), MediaType<[ApplicationjsonSchema.ApplicationjsonSchema1](../../../../paths/fakerefsstring/post/responses/code200response/content/applicationjson/ApplicationjsonSchema.md#applicationjsonschema1), Nothing?> + +class storing schema info for a specific contentType + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| ApplicationjsonMediaType()
Creates an instance | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| [ApplicationjsonSchema.ApplicationjsonSchema1](../../../../paths/fakerefsstring/post/responses/code200response/content/applicationjson/ApplicationjsonSchema.md#applicationjsonschema1) | schema()
the schema for this MediaType | +| Nothing? | encoding()
the encoding info | + +## SealedResponseBody +public sealed interface SealedResponseBody
+permits
+[ApplicationjsonResponseBody](#applicationjsonresponsebody) + +sealed interface that stores response body + +## ApplicationjsonResponseBody +public record ApplicationjsonResponseBody
+implements [SealedResponseBody](#sealedresponsebody) + +A record class to store response body for contentType="application/json" + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| ApplicationjsonResponseBody(ApplicationjsonSchema.StringJsonSchema1Boxed body)
Creates an instance | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| ApplicationjsonSchema.StringJsonSchema1Boxed | body()
returns the body passed in in the constructor | + +## FakerefsstringPostCode200Response1 +public static class FakerefsstringPostCode200Response1
+extends ResponseDeserializer<[SealedResponseBody](#sealedresponsebody), Nothing?, [SealedMediaType](#sealedmediatype)> + +a class that deserializes responses + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| FakerefsstringPostCode200Response1()
Creates an instance | + +### Field Summary +| Modifier and Type | Field and Description | +| ----------------- | --------------------- | +| 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 | +| ----------------- | ---------------------- | +| ApiResponse<[SealedResponseBody](#sealedresponsebody), Nothing?> | deserialize(HttpResponse response, SchemaConfiguration configuration)
called by endpoint when deserialize responses | diff --git a/samples/client/petstore/kotlin/docs/paths/fakerefsstring/post/responses/code200response/content/applicationjson/ApplicationjsonSchema.md b/samples/client/petstore/kotlin/docs/paths/fakerefsstring/post/responses/code200response/content/applicationjson/ApplicationjsonSchema.md new file mode 100644 index 00000000000..8fadd779761 --- /dev/null +++ b/samples/client/petstore/kotlin/docs/paths/fakerefsstring/post/responses/code200response/content/applicationjson/ApplicationjsonSchema.md @@ -0,0 +1,19 @@ +# ApplicationjsonSchema +public class ApplicationjsonSchema
+extends [StringSchema1](../../../../../../../components/schemas/StringSchema.md#stringschema) + +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 + +## Nested Class Summary +| Modifier and Type | Class and Description | +| ----------------- | ---------------------- | +| static class | [ApplicationjsonSchema.ApplicationjsonSchema1](#applicationjsonschema1)
schema class | + +## ApplicationjsonSchema1 +public static class ApplicationjsonSchema1
+extends [StringSchema.StringSchema1](../../../../../../../components/schemas/StringSchema.md#stringschema1) + +A schema class that validates payloads diff --git a/samples/client/petstore/kotlin/docs/paths/fakeresponsewithoutschema/FakeresponsewithoutschemaGet.md b/samples/client/petstore/kotlin/docs/paths/fakeresponsewithoutschema/FakeresponsewithoutschemaGet.md new file mode 100644 index 00000000000..71fbe73307e --- /dev/null +++ b/samples/client/petstore/kotlin/docs/paths/fakeresponsewithoutschema/FakeresponsewithoutschemaGet.md @@ -0,0 +1,142 @@ +# FakeresponsewithoutschemaGet + +public class FakeresponsewithoutschemaGet + +A class that contains necessary endpoint classes +- a class that calls the endpoint method using the http verb +- a class that calls the endpoint method using the operationId name +- class(es) to store the request inputs +- builder(s) to set the request input data + +## Nested Class Summary +| Modifier and Type | Class and Description | +| ----------------- | --------------------- | +| static class | [Get](#get)
The class that has a get method to call the endpoint | +| interface | [ResponseWithoutSchemaOperation](#responsewithoutschemaoperation)
The interface that has a responseWithoutSchema method to call the endpoint | +| static class | [GetRequest](#getrequest)
The request inputs class | +| static class | [GetRequestBuilder](#getrequestbuilder)
A builder for the request input class | + +## Get +public static class Get extends ApiClient.ApiClient1 implements GetOperation
+ +a class that allows one to call the endpoint using a method named get + +### 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.servers.RootServer0; +import org.openapijsonschematools.client.servers.RootServer1; +import org.openapijsonschematools.client.servers.RootServer2; +import org.openapijsonschematools.client.paths.fakeresponsewithoutschema.get.responses.FakeresponsewithoutschemaGetCode200Response; +import org.openapijsonschematools.client.servers.RootServerInfo; +import org.openapijsonschematools.client.paths.fakeresponsewithoutschema.FakeresponsewithoutschemaGet; +import org.openapijsonschematools.client.paths.fakeresponsewithoutschema.get.FakeresponsewithoutschemaGetResponses; + +import java.io.IOException; +import java.util.Arrays; +import java.util.List; +import java.util.Map; +import java.util.AbstractMap; + +// if you want to use a server that is not SERVER_0 pass it in here and change the ServerIndex input below +ApiConfiguration.ServerInfo serverInfo = new ApiConfiguration.ServerInfoBuilder() + .rootServerInfo( + new RootServerInfo.RootServerInfoBuilder() + .rootServer0(new RootServer0()) + .build() + ) + .build(); +ApiConfiguration.ServerIndexInfo serverIndexInfo = new ApiConfiguration.ServerIndexInfoBuilder() + .rootServerInfoServerIndex(RootServerInfo.ServerIndex.SERVER_0) + .build(); +Duration timeout = Duration.ofSeconds(1L); +Map> defaultHeaders = Map.of("User-Agent", List.of("OpenAPI-JSON-Schema-Generator/1.0.0/java")); +ApiConfiguration apiConfiguration = new ApiConfiguration( + serverInfo + serverIndexInfo, + timeout, + defaultHeaders +); +SchemaConfiguration schemaConfiguration = new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().build()); +FakeresponsewithoutschemaGet.Get apiClient = new FakeresponsewithoutschemaGet.Get(apiConfiguration, schemaConfiguration); + + +var request = new FakeresponsewithoutschemaGet.GetRequestBuilder().build(); + +FakeresponsewithoutschemaGetResponses.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; +} +FakeresponsewithoutschemaGetResponses.EndpointFakeresponsewithoutschemaGetCode200Response castResponse = (FakeresponsewithoutschemaGetResponses.EndpointFakeresponsewithoutschemaGetCode200Response) response; +``` +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| Get(ApiConfiguration apiConfiguration, SchemaConfiguration schemaConfiguration)
Creates an instance | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| [FakeresponsewithoutschemaGetResponses.EndpointResponse](../../paths/fakeresponsewithoutschema/get/FakeresponsewithoutschemaGetResponses.md#endpointresponse) | get([GetRequest](#getrequest) request) | + +## ResponseWithoutSchemaOperation +public interface ResponseWithoutSchemaOperation
+ +an interface that allows one to call the endpoint using a method named responseWithoutSchema by the operationId + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| [FakeresponsewithoutschemaGetResponses.EndpointResponse](../../paths/fakeresponsewithoutschema/get/FakeresponsewithoutschemaGetResponses.md#endpointresponse) | responseWithoutSchema([GetRequest](#getrequest) request) | + +## GetRequest +public static class GetRequest
+ +a class that stores the final request inputs + +### Field Summary +| Modifier and Type | Field and Description | +| ----------------- | --------------------- | +| [RootServerInfo.@Nullable ServerIndex](../../RootServerInfo.md#serverindex) | serverIndex
optional. Note: this will override the value in apiConfiguration | +| @Nullable Duration | timeout
optional. Note: this will override the value in apiConfiguration | + +## GetRequestBuilder +public static class GetRequestBuilder
+ +a builder for request inputs + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| GetRequestBuilder()
Creates a builder that contains null for all parameters | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| [GetRequest](#getrequest) | build()
Returns the request input used to call an endpoint method | +| [GetRequestBuilder](#getrequestbuilder) | serverIndex([RootServerInfo.ServerIndex](../../RootServerInfo.md#serverindex) serverIndex)
sets the optional property. Note: this will override the value in apiConfiguration | +| [GetRequestBuilder](#getrequestbuilder) | timeout(Duration timeout)
sets the optional property. Note: this will override the value in apiConfiguration | + +[[Back to top]](#top) [[Back to README]](../../../README.md) diff --git a/samples/client/petstore/kotlin/docs/paths/fakeresponsewithoutschema/get/FakeresponsewithoutschemaGetResponses.md b/samples/client/petstore/kotlin/docs/paths/fakeresponsewithoutschema/get/FakeresponsewithoutschemaGetResponses.md new file mode 100644 index 00000000000..cd5796003b5 --- /dev/null +++ b/samples/client/petstore/kotlin/docs/paths/fakeresponsewithoutschema/get/FakeresponsewithoutschemaGetResponses.md @@ -0,0 +1,29 @@ +# FakeresponsewithoutschemaGetResponses + +public class FakeresponsewithoutschemaGetResponses + +A class that contains necessary responses classes +- a sealed interface, EndpointResponse, that stores endpoint responses +- records for each endpoint response + +## Nested Class Summary +| Modifier and Type | Class and Description | +| ----------------- | --------------------- | +| sealed interface | [EndpointResponse](#endpointresponse)
stores the endpoint responses | +| record | [EndpointFakeresponsewithoutschemaGetCode200Response](#endpointfakeresponsewithoutschemagetcode200response)
the response for 200 | + +## EndpointResponse +public sealed interface EndpointResponse permits
+[EndpointFakeresponsewithoutschemaGetCode200Response](#endpointfakeresponsewithoutschemagetcode200response) + +a sealed interface that stores endpoint responses + +## EndpointFakeresponsewithoutschemaGetCode200Response +public record EndpointFakeresponsewithoutschemaGetCode200Response( + HttpResponse response, + Nothing? body, + Nothing? headers +) implements EndpointResponse, ApiResponse
+ +a class that stores an endpoint response + diff --git a/samples/client/petstore/kotlin/docs/paths/fakeresponsewithoutschema/get/responses/FakeresponsewithoutschemaGetCode200Response.md b/samples/client/petstore/kotlin/docs/paths/fakeresponsewithoutschema/get/responses/FakeresponsewithoutschemaGetCode200Response.md new file mode 100644 index 00000000000..8d5f2f94e67 --- /dev/null +++ b/samples/client/petstore/kotlin/docs/paths/fakeresponsewithoutschema/get/responses/FakeresponsewithoutschemaGetCode200Response.md @@ -0,0 +1,32 @@ +# FakeresponsewithoutschemaGetCode200Response + +public class FakeresponsewithoutschemaGetCode200Response + +A class that contains necessary nested response classes +- a class that extends ResponseDeserializer and is used to deserialize responses + +## Nested Class Summary +| Modifier and Type | Class and Description | +| ----------------- | --------------------- | +| static class | [FakeresponsewithoutschemaGetCode200Response.FakeresponsewithoutschemaGetCode200Response1](#fakeresponsewithoutschemagetcode200response1)
class that deserializes responses | + +## FakeresponsewithoutschemaGetCode200Response1 +public static class FakeresponsewithoutschemaGetCode200Response1
+extends ResponseDeserializer + +a class that deserializes responses + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| FakeresponsewithoutschemaGetCode200Response1()
Creates an instance | + +### Field Summary +| Modifier and Type | Field and Description | +| ----------------- | --------------------- | +| Map | content = MapUtils.makeMap(
    new AbstractMap.SimpleEntry<>("application/json", null),
    new AbstractMap.SimpleEntry<>("application/xml", null)
)
the contentType to schema info | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| ApiResponse | deserialize(HttpResponse response, SchemaConfiguration configuration)
called by endpoint when deserialize responses | diff --git a/samples/client/petstore/kotlin/docs/paths/faketestqueryparamters/FaketestqueryparamtersPut.md b/samples/client/petstore/kotlin/docs/paths/faketestqueryparamters/FaketestqueryparamtersPut.md new file mode 100644 index 00000000000..7c0c5bcc689 --- /dev/null +++ b/samples/client/petstore/kotlin/docs/paths/faketestqueryparamters/FaketestqueryparamtersPut.md @@ -0,0 +1,210 @@ +# FaketestqueryparamtersPut + +public class FaketestqueryparamtersPut + +A class that contains necessary endpoint classes +- a class that calls the endpoint method using the http verb +- a class that calls the endpoint method using the operationId name +- class(es) to store the request inputs +- builder(s) to set the request input data + +## Nested Class Summary +| Modifier and Type | Class and Description | +| ----------------- | --------------------- | +| static class | [Put](#put)
The class that has a put method to call the endpoint | +| interface | [QueryParameterCollectionFormatOperation](#queryparametercollectionformatoperation)
The interface that has a queryParameterCollectionFormat method to call the endpoint | +| static class | [PutRequest](#putrequest)
The final request inputs class | +| static class | [PutNullableRequest](#putnullablerequest)
The initial request inputs class | +| static class | [Put0RequestBuilder](#put0requestbuilder)
A builder for the request input class | +| static class | [PutRequestBuilder](#putrequestbuilder)
A builder for the request input class | + +## Put +public static class Put extends ApiClient.ApiClient1 implements PutOperation
+ +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.faketestqueryparamters.put.FaketestqueryparamtersPutQueryParameters; +import org.openapijsonschematools.client.servers.RootServer0; +import org.openapijsonschematools.client.servers.RootServer1; +import org.openapijsonschematools.client.servers.RootServer2; +import org.openapijsonschematools.client.paths.faketestqueryparamters.put.responses.FaketestqueryparamtersPutCode200Response; +import org.openapijsonschematools.client.servers.RootServerInfo; +import org.openapijsonschematools.client.paths.faketestqueryparamters.FaketestqueryparamtersPut; +import org.openapijsonschematools.client.paths.faketestqueryparamters.put.FaketestqueryparamtersPutResponses; + +import java.io.IOException; +import java.util.Arrays; +import java.util.List; +import java.util.Map; +import java.util.AbstractMap; + +// if you want to use a server that is not SERVER_0 pass it in here and change the ServerIndex input below +ApiConfiguration.ServerInfo serverInfo = new ApiConfiguration.ServerInfoBuilder() + .rootServerInfo( + new RootServerInfo.RootServerInfoBuilder() + .rootServer0(new RootServer0()) + .build() + ) + .build(); +ApiConfiguration.ServerIndexInfo serverIndexInfo = new ApiConfiguration.ServerIndexInfoBuilder() + .rootServerInfoServerIndex(RootServerInfo.ServerIndex.SERVER_0) + .build(); +Duration timeout = Duration.ofSeconds(1L); +Map> defaultHeaders = Map.of("User-Agent", List.of("OpenAPI-JSON-Schema-Generator/1.0.0/java")); +ApiConfiguration apiConfiguration = new ApiConfiguration( + serverInfo + serverIndexInfo, + timeout, + defaultHeaders +); +SchemaConfiguration schemaConfiguration = new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().build()); +FaketestqueryparamtersPut.Put apiClient = new FaketestqueryparamtersPut.Put(apiConfiguration, schemaConfiguration); + + +// Map validation +FaketestqueryparamtersPutQueryParameters.QueryParametersMap queryParameters = + FaketestqueryparamtersPutQueryParameters.FaketestqueryparamtersPutQueryParameters1.validate( + new FaketestqueryparamtersPutQueryParameters.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 +); + +var request = new FaketestqueryparamtersPut.PutRequestBuilder() + .queryParameters(queryParameters) + .build(); + +FaketestqueryparamtersPutResponses.EndpointResponse response; +try { + response = apiClient.put(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; +} +FaketestqueryparamtersPutResponses.EndpointFaketestqueryparamtersPutCode200Response castResponse = (FaketestqueryparamtersPutResponses.EndpointFaketestqueryparamtersPutCode200Response) response; +``` +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| Put(ApiConfiguration apiConfiguration, SchemaConfiguration schemaConfiguration)
Creates an instance | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| [FaketestqueryparamtersPutResponses.EndpointResponse](../../paths/faketestqueryparamters/put/FaketestqueryparamtersPutResponses.md#endpointresponse) | put([PutRequest](#putrequest) request) | + +## QueryParameterCollectionFormatOperation +public interface QueryParameterCollectionFormatOperation
+ +an interface that allows one to call the endpoint using a method named queryParameterCollectionFormat by the operationId + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| [FaketestqueryparamtersPutResponses.EndpointResponse](../../paths/faketestqueryparamters/put/FaketestqueryparamtersPutResponses.md#endpointresponse) | queryParameterCollectionFormat([PutRequest](#putrequest) request) | + +## PutRequest +public static class PutRequest
+ +a class that stores the final request inputs + +### Field Summary +| Modifier and Type | Field and Description | +| ----------------- | --------------------- | +| [FaketestqueryparamtersPutQueryParameters.QueryParametersMap](../../paths/faketestqueryparamters/put/FaketestqueryparamtersPutQueryParameters.md#queryparametersmap) | queryParameters | +| [RootServerInfo.@Nullable ServerIndex](../../RootServerInfo.md#serverindex) | serverIndex
optional. Note: this will override the value in apiConfiguration | +| @Nullable Duration | timeout
optional. Note: this will override the value in apiConfiguration | + +## PutNullableRequest +public static class PutNullableRequest
+ +a class that stores the initial request inputs + +### Field Summary +| Modifier and Type | Field and Description | +| ----------------- | --------------------- | +| [FaketestqueryparamtersPutQueryParameters.@Nullable QueryParametersMap](../../paths/faketestqueryparamters/put/FaketestqueryparamtersPutQueryParameters.md#queryparametersmap) | queryParameters | +| [RootServerInfo.@Nullable ServerIndex](../../RootServerInfo.md#serverindex) | serverIndex | +| @Nullable Duration | timeout | + +## Put0RequestBuilder +public static class Put0RequestBuilder
+ +a builder for request inputs + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| Put0RequestBuilder(Put0RequestBuilder instance)
Creates a builder that contains the passed instance | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| [PutRequest](#putrequest) | build()
Returns the request input used to call an endpoint method | +| [Put0RequestBuilder](#put0requestbuilder) | serverIndex([RootServerInfo.ServerIndex](../../RootServerInfo.md#serverindex) serverIndex)
sets the optional property. Note: this will override the value in apiConfiguration | +| [Put0RequestBuilder](#put0requestbuilder) | timeout(Duration timeout)
sets the optional property. Note: this will override the value in apiConfiguration | + +## PutRequestBuilder +public static class PutRequestBuilder
+ +a builder for request inputs + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| PutRequestBuilder()
Creates a builder that contains null for all parameters | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| [Put0RequestBuilder](#put0requestbuilder) | queryParameters([FaketestqueryparamtersPutQueryParametersQueryParametersMap](../../paths/faketestqueryparamters/put/FaketestqueryparamtersPutQueryParameters.md#queryparametersmap) queryParameters)
sets the property | + +[[Back to top]](#top) [[Back to README]](../../../README.md) diff --git a/samples/client/petstore/kotlin/docs/paths/faketestqueryparamters/put/FaketestqueryparamtersPutQueryParameters.md b/samples/client/petstore/kotlin/docs/paths/faketestqueryparamters/put/FaketestqueryparamtersPutQueryParameters.md new file mode 100644 index 00000000000..6444b0b3515 --- /dev/null +++ b/samples/client/petstore/kotlin/docs/paths/faketestqueryparamters/put/FaketestqueryparamtersPutQueryParameters.md @@ -0,0 +1,1419 @@ +# FaketestqueryparamtersPutQueryParameters +public class FaketestqueryparamtersPutQueryParameters
+ +A class that contains necessary nested +- schema classes (which validate payloads), extends JsonSchema +- sealed interfaces which store validated payloads, java version of a sum type +- boxed classes which store validated payloads, sealed permits class implementations +- classes to store validated map payloads, extends FrozenMap +- classes to build inputs for map payloads + +## Nested Class Summary +| Modifier and Type | Class and Description | +| ----------------- | ---------------------- | +| sealed interface | [FaketestqueryparamtersPutQueryParameters.FaketestqueryparamtersPutQueryParameters1Boxed](#faketestqueryparamtersputqueryparameters1boxed)
sealed interface for validated payloads | +| record | [FaketestqueryparamtersPutQueryParameters.FaketestqueryparamtersPutQueryParameters1BoxedMap](#faketestqueryparamtersputqueryparameters1boxedmap)
boxed class to store validated Map payloads | +| static class | [FaketestqueryparamtersPutQueryParameters.FaketestqueryparamtersPutQueryParameters1](#faketestqueryparamtersputqueryparameters1)
schema class | +| static class | [FaketestqueryparamtersPutQueryParameters.QueryParametersMapBuilder](#queryparametersmapbuilder)
builder for Map payloads | +| static class | [FaketestqueryparamtersPutQueryParameters.QueryParametersMap](#queryparametersmap)
output class for Map payloads | +| sealed interface | [FaketestqueryparamtersPutQueryParameters.AdditionalPropertiesBoxed](#additionalpropertiesboxed)
sealed interface for validated payloads | +| record | [FaketestqueryparamtersPutQueryParameters.AdditionalPropertiesBoxedVoid](#additionalpropertiesboxedvoid)
boxed class to store validated null payloads | +| record | [FaketestqueryparamtersPutQueryParameters.AdditionalPropertiesBoxedBoolean](#additionalpropertiesboxedboolean)
boxed class to store validated boolean payloads | +| record | [FaketestqueryparamtersPutQueryParameters.AdditionalPropertiesBoxedNumber](#additionalpropertiesboxednumber)
boxed class to store validated Number payloads | +| record | [FaketestqueryparamtersPutQueryParameters.AdditionalPropertiesBoxedString](#additionalpropertiesboxedstring)
boxed class to store validated String payloads | +| record | [FaketestqueryparamtersPutQueryParameters.AdditionalPropertiesBoxedList](#additionalpropertiesboxedlist)
boxed class to store validated List payloads | +| record | [FaketestqueryparamtersPutQueryParameters.AdditionalPropertiesBoxedMap](#additionalpropertiesboxedmap)
boxed class to store validated Map payloads | +| static class | [FaketestqueryparamtersPutQueryParameters.AdditionalProperties](#additionalproperties)
schema class | + +## FaketestqueryparamtersPutQueryParameters1Boxed +public sealed interface FaketestqueryparamtersPutQueryParameters1Boxed
+permits
+[FaketestqueryparamtersPutQueryParameters1BoxedMap](#faketestqueryparamtersputqueryparameters1boxedmap) + +sealed interface that stores validated payloads using boxed classes + +## FaketestqueryparamtersPutQueryParameters1BoxedMap +public record FaketestqueryparamtersPutQueryParameters1BoxedMap
+implements [FaketestqueryparamtersPutQueryParameters1Boxed](#faketestqueryparamtersputqueryparameters1boxed) + +record that stores validated Map payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| FaketestqueryparamtersPutQueryParameters1BoxedMap([QueryParametersMap](#queryparametersmap) data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| [QueryParametersMap](#queryparametersmap) | data()
validated payload | +| @Nullable Object | getData()
validated payload | + +## FaketestqueryparamtersPutQueryParameters1 +public static class FaketestqueryparamtersPutQueryParameters1
+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.faketestqueryparamters.put.FaketestqueryparamtersPutQueryParameters; + +import java.util.Arrays; +import java.util.List; +import java.util.AbstractMap; + +static final SchemaConfiguration configuration = new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().build()); + +// Map validation +FaketestqueryparamtersPutQueryParameters.QueryParametersMap validatedPayload = + FaketestqueryparamtersPutQueryParameters.FaketestqueryparamtersPutQueryParameters1.validate( + new FaketestqueryparamtersPutQueryParameters.QueryParametersMapBuilder() + .context( + Arrays.asList( + "a" + ) + ) + .http( + Arrays.asList( + "a" + ) + ) + .ioutil( + Arrays.asList( + "a" + ) + ) + .pipe( + Arrays.asList( + "a" + ) + ) + .refParam("a") + + .url( + Arrays.asList( + "a" + ) + ) + .build(), + configuration +); +``` + +### Field Summary +| Modifier and Type | Field and Description | +| ----------------- | ---------------------- | +| Set> | type = Set.of(Map.class) | +| Map> | properties = Map.ofEntries(
    new PropertyEntry("refParam", [StringWithValidation.StringWithValidation1.class](../../../components/schemas/StringWithValidation.md#stringwithvalidation1)),
    new PropertyEntry("ioutil", [Schema1.Schema11.class](../../../paths/faketestqueryparamters/put/parameters/parameter1/Schema1.md#schema11)),
    new PropertyEntry("context", [Schema4.Schema41.class](../../../paths/faketestqueryparamters/put/parameters/parameter4/Schema4.md#schema41)),
    new PropertyEntry("http", [Schema2.Schema21.class](../../../paths/faketestqueryparamters/put/parameters/parameter2/Schema2.md#schema21)),
    new PropertyEntry("pipe", [Schema0.Schema01.class](../../../paths/faketestqueryparamters/put/parameters/parameter0/Schema0.md#schema01)),
    new PropertyEntry("url", [Schema3.Schema31.class](../../../paths/faketestqueryparamters/put/parameters/parameter3/Schema3.md#schema31))
)
| +| Set | required = Set.of(
    "context",
    "http",
    "ioutil",
    "pipe",
    "refParam",
    "url"
)
| +| Class | additionalProperties = [AdditionalProperties.class](#additionalproperties) | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| [QueryParametersMap](#queryparametersmap) | validate([Map<?, ?>](#queryparametersmapbuilder) arg, SchemaConfiguration configuration) | +| [FaketestqueryparamtersPutQueryParameters1BoxedMap](#faketestqueryparamtersputqueryparameters1boxedmap) | validateAndBox([Map<?, ?>](#queryparametersmapbuilder) arg, SchemaConfiguration configuration) | +| [FaketestqueryparamtersPutQueryParameters1Boxed](#faketestqueryparamtersputqueryparameters1boxed) | validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) | +| @Nullable Object | validate(@Nullable Object arg, SchemaConfiguration configuration) | + +## QueryParametersMap000000Builder +public class QueryParametersMap000000Builder
+builder for `Map` + +A class that builds the Map input type + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| QueryParametersMap000000Builder(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 | + +## QueryParametersMap000001Builder +public class QueryParametersMap000001Builder
+builder for `Map` + +A class that builds the Map input type + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| QueryParametersMap000001Builder(Map instance)
Creates a builder that contains the passed instance | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| [QueryParametersMap000000Builder](#queryparametersmap000000builder) | url(List value) | + +## QueryParametersMap000010Builder +public class QueryParametersMap000010Builder
+builder for `Map` + +A class that builds the Map input type + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| QueryParametersMap000010Builder(Map instance)
Creates a builder that contains the passed instance | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| [QueryParametersMap000000Builder](#queryparametersmap000000builder) | refParam(String value) | + +## QueryParametersMap000011Builder +public class QueryParametersMap000011Builder
+builder for `Map` + +A class that builds the Map input type + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| QueryParametersMap000011Builder(Map instance)
Creates a builder that contains the passed instance | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| [QueryParametersMap000001Builder](#queryparametersmap000001builder) | refParam(String value) | +| [QueryParametersMap000010Builder](#queryparametersmap000010builder) | url(List value) | + +## QueryParametersMap000100Builder +public class QueryParametersMap000100Builder
+builder for `Map` + +A class that builds the Map input type + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| QueryParametersMap000100Builder(Map instance)
Creates a builder that contains the passed instance | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| [QueryParametersMap000000Builder](#queryparametersmap000000builder) | pipe(List value) | + +## QueryParametersMap000101Builder +public class QueryParametersMap000101Builder
+builder for `Map` + +A class that builds the Map input type + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| QueryParametersMap000101Builder(Map instance)
Creates a builder that contains the passed instance | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| [QueryParametersMap000001Builder](#queryparametersmap000001builder) | pipe(List value) | +| [QueryParametersMap000100Builder](#queryparametersmap000100builder) | url(List value) | + +## QueryParametersMap000110Builder +public class QueryParametersMap000110Builder
+builder for `Map` + +A class that builds the Map input type + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| QueryParametersMap000110Builder(Map instance)
Creates a builder that contains the passed instance | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| [QueryParametersMap000010Builder](#queryparametersmap000010builder) | pipe(List value) | +| [QueryParametersMap000100Builder](#queryparametersmap000100builder) | refParam(String value) | + +## QueryParametersMap000111Builder +public class QueryParametersMap000111Builder
+builder for `Map` + +A class that builds the Map input type + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| QueryParametersMap000111Builder(Map instance)
Creates a builder that contains the passed instance | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| [QueryParametersMap000011Builder](#queryparametersmap000011builder) | pipe(List value) | +| [QueryParametersMap000101Builder](#queryparametersmap000101builder) | refParam(String value) | +| [QueryParametersMap000110Builder](#queryparametersmap000110builder) | url(List value) | + +## QueryParametersMap001000Builder +public class QueryParametersMap001000Builder
+builder for `Map` + +A class that builds the Map input type + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| QueryParametersMap001000Builder(Map instance)
Creates a builder that contains the passed instance | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| [QueryParametersMap000000Builder](#queryparametersmap000000builder) | ioutil(List value) | + +## QueryParametersMap001001Builder +public class QueryParametersMap001001Builder
+builder for `Map` + +A class that builds the Map input type + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| QueryParametersMap001001Builder(Map instance)
Creates a builder that contains the passed instance | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| [QueryParametersMap000001Builder](#queryparametersmap000001builder) | ioutil(List value) | +| [QueryParametersMap001000Builder](#queryparametersmap001000builder) | url(List value) | + +## QueryParametersMap001010Builder +public class QueryParametersMap001010Builder
+builder for `Map` + +A class that builds the Map input type + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| QueryParametersMap001010Builder(Map instance)
Creates a builder that contains the passed instance | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| [QueryParametersMap000010Builder](#queryparametersmap000010builder) | ioutil(List value) | +| [QueryParametersMap001000Builder](#queryparametersmap001000builder) | refParam(String value) | + +## QueryParametersMap001011Builder +public class QueryParametersMap001011Builder
+builder for `Map` + +A class that builds the Map input type + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| QueryParametersMap001011Builder(Map instance)
Creates a builder that contains the passed instance | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| [QueryParametersMap000011Builder](#queryparametersmap000011builder) | ioutil(List value) | +| [QueryParametersMap001001Builder](#queryparametersmap001001builder) | refParam(String value) | +| [QueryParametersMap001010Builder](#queryparametersmap001010builder) | url(List value) | + +## QueryParametersMap001100Builder +public class QueryParametersMap001100Builder
+builder for `Map` + +A class that builds the Map input type + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| QueryParametersMap001100Builder(Map instance)
Creates a builder that contains the passed instance | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| [QueryParametersMap000100Builder](#queryparametersmap000100builder) | ioutil(List value) | +| [QueryParametersMap001000Builder](#queryparametersmap001000builder) | pipe(List value) | + +## QueryParametersMap001101Builder +public class QueryParametersMap001101Builder
+builder for `Map` + +A class that builds the Map input type + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| QueryParametersMap001101Builder(Map instance)
Creates a builder that contains the passed instance | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| [QueryParametersMap000101Builder](#queryparametersmap000101builder) | ioutil(List value) | +| [QueryParametersMap001001Builder](#queryparametersmap001001builder) | pipe(List value) | +| [QueryParametersMap001100Builder](#queryparametersmap001100builder) | url(List value) | + +## QueryParametersMap001110Builder +public class QueryParametersMap001110Builder
+builder for `Map` + +A class that builds the Map input type + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| QueryParametersMap001110Builder(Map instance)
Creates a builder that contains the passed instance | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| [QueryParametersMap000110Builder](#queryparametersmap000110builder) | ioutil(List value) | +| [QueryParametersMap001010Builder](#queryparametersmap001010builder) | pipe(List value) | +| [QueryParametersMap001100Builder](#queryparametersmap001100builder) | refParam(String value) | + +## QueryParametersMap001111Builder +public class QueryParametersMap001111Builder
+builder for `Map` + +A class that builds the Map input type + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| QueryParametersMap001111Builder(Map instance)
Creates a builder that contains the passed instance | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| [QueryParametersMap000111Builder](#queryparametersmap000111builder) | ioutil(List value) | +| [QueryParametersMap001011Builder](#queryparametersmap001011builder) | pipe(List value) | +| [QueryParametersMap001101Builder](#queryparametersmap001101builder) | refParam(String value) | +| [QueryParametersMap001110Builder](#queryparametersmap001110builder) | url(List value) | + +## QueryParametersMap010000Builder +public class QueryParametersMap010000Builder
+builder for `Map` + +A class that builds the Map input type + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| QueryParametersMap010000Builder(Map instance)
Creates a builder that contains the passed instance | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| [QueryParametersMap000000Builder](#queryparametersmap000000builder) | http(List value) | + +## QueryParametersMap010001Builder +public class QueryParametersMap010001Builder
+builder for `Map` + +A class that builds the Map input type + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| QueryParametersMap010001Builder(Map instance)
Creates a builder that contains the passed instance | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| [QueryParametersMap000001Builder](#queryparametersmap000001builder) | http(List value) | +| [QueryParametersMap010000Builder](#queryparametersmap010000builder) | url(List value) | + +## QueryParametersMap010010Builder +public class QueryParametersMap010010Builder
+builder for `Map` + +A class that builds the Map input type + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| QueryParametersMap010010Builder(Map instance)
Creates a builder that contains the passed instance | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| [QueryParametersMap000010Builder](#queryparametersmap000010builder) | http(List value) | +| [QueryParametersMap010000Builder](#queryparametersmap010000builder) | refParam(String value) | + +## QueryParametersMap010011Builder +public class QueryParametersMap010011Builder
+builder for `Map` + +A class that builds the Map input type + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| QueryParametersMap010011Builder(Map instance)
Creates a builder that contains the passed instance | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| [QueryParametersMap000011Builder](#queryparametersmap000011builder) | http(List value) | +| [QueryParametersMap010001Builder](#queryparametersmap010001builder) | refParam(String value) | +| [QueryParametersMap010010Builder](#queryparametersmap010010builder) | url(List value) | + +## QueryParametersMap010100Builder +public class QueryParametersMap010100Builder
+builder for `Map` + +A class that builds the Map input type + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| QueryParametersMap010100Builder(Map instance)
Creates a builder that contains the passed instance | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| [QueryParametersMap000100Builder](#queryparametersmap000100builder) | http(List value) | +| [QueryParametersMap010000Builder](#queryparametersmap010000builder) | pipe(List value) | + +## QueryParametersMap010101Builder +public class QueryParametersMap010101Builder
+builder for `Map` + +A class that builds the Map input type + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| QueryParametersMap010101Builder(Map instance)
Creates a builder that contains the passed instance | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| [QueryParametersMap000101Builder](#queryparametersmap000101builder) | http(List value) | +| [QueryParametersMap010001Builder](#queryparametersmap010001builder) | pipe(List value) | +| [QueryParametersMap010100Builder](#queryparametersmap010100builder) | url(List value) | + +## QueryParametersMap010110Builder +public class QueryParametersMap010110Builder
+builder for `Map` + +A class that builds the Map input type + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| QueryParametersMap010110Builder(Map instance)
Creates a builder that contains the passed instance | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| [QueryParametersMap000110Builder](#queryparametersmap000110builder) | http(List value) | +| [QueryParametersMap010010Builder](#queryparametersmap010010builder) | pipe(List value) | +| [QueryParametersMap010100Builder](#queryparametersmap010100builder) | refParam(String value) | + +## QueryParametersMap010111Builder +public class QueryParametersMap010111Builder
+builder for `Map` + +A class that builds the Map input type + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| QueryParametersMap010111Builder(Map instance)
Creates a builder that contains the passed instance | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| [QueryParametersMap000111Builder](#queryparametersmap000111builder) | http(List value) | +| [QueryParametersMap010011Builder](#queryparametersmap010011builder) | pipe(List value) | +| [QueryParametersMap010101Builder](#queryparametersmap010101builder) | refParam(String value) | +| [QueryParametersMap010110Builder](#queryparametersmap010110builder) | url(List value) | + +## QueryParametersMap011000Builder +public class QueryParametersMap011000Builder
+builder for `Map` + +A class that builds the Map input type + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| QueryParametersMap011000Builder(Map instance)
Creates a builder that contains the passed instance | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| [QueryParametersMap001000Builder](#queryparametersmap001000builder) | http(List value) | +| [QueryParametersMap010000Builder](#queryparametersmap010000builder) | ioutil(List value) | + +## QueryParametersMap011001Builder +public class QueryParametersMap011001Builder
+builder for `Map` + +A class that builds the Map input type + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| QueryParametersMap011001Builder(Map instance)
Creates a builder that contains the passed instance | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| [QueryParametersMap001001Builder](#queryparametersmap001001builder) | http(List value) | +| [QueryParametersMap010001Builder](#queryparametersmap010001builder) | ioutil(List value) | +| [QueryParametersMap011000Builder](#queryparametersmap011000builder) | url(List value) | + +## QueryParametersMap011010Builder +public class QueryParametersMap011010Builder
+builder for `Map` + +A class that builds the Map input type + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| QueryParametersMap011010Builder(Map instance)
Creates a builder that contains the passed instance | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| [QueryParametersMap001010Builder](#queryparametersmap001010builder) | http(List value) | +| [QueryParametersMap010010Builder](#queryparametersmap010010builder) | ioutil(List value) | +| [QueryParametersMap011000Builder](#queryparametersmap011000builder) | refParam(String value) | + +## QueryParametersMap011011Builder +public class QueryParametersMap011011Builder
+builder for `Map` + +A class that builds the Map input type + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| QueryParametersMap011011Builder(Map instance)
Creates a builder that contains the passed instance | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| [QueryParametersMap001011Builder](#queryparametersmap001011builder) | http(List value) | +| [QueryParametersMap010011Builder](#queryparametersmap010011builder) | ioutil(List value) | +| [QueryParametersMap011001Builder](#queryparametersmap011001builder) | refParam(String value) | +| [QueryParametersMap011010Builder](#queryparametersmap011010builder) | url(List value) | + +## QueryParametersMap011100Builder +public class QueryParametersMap011100Builder
+builder for `Map` + +A class that builds the Map input type + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| QueryParametersMap011100Builder(Map instance)
Creates a builder that contains the passed instance | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| [QueryParametersMap001100Builder](#queryparametersmap001100builder) | http(List value) | +| [QueryParametersMap010100Builder](#queryparametersmap010100builder) | ioutil(List value) | +| [QueryParametersMap011000Builder](#queryparametersmap011000builder) | pipe(List value) | + +## QueryParametersMap011101Builder +public class QueryParametersMap011101Builder
+builder for `Map` + +A class that builds the Map input type + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| QueryParametersMap011101Builder(Map instance)
Creates a builder that contains the passed instance | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| [QueryParametersMap001101Builder](#queryparametersmap001101builder) | http(List value) | +| [QueryParametersMap010101Builder](#queryparametersmap010101builder) | ioutil(List value) | +| [QueryParametersMap011001Builder](#queryparametersmap011001builder) | pipe(List value) | +| [QueryParametersMap011100Builder](#queryparametersmap011100builder) | url(List value) | + +## QueryParametersMap011110Builder +public class QueryParametersMap011110Builder
+builder for `Map` + +A class that builds the Map input type + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| QueryParametersMap011110Builder(Map instance)
Creates a builder that contains the passed instance | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| [QueryParametersMap001110Builder](#queryparametersmap001110builder) | http(List value) | +| [QueryParametersMap010110Builder](#queryparametersmap010110builder) | ioutil(List value) | +| [QueryParametersMap011010Builder](#queryparametersmap011010builder) | pipe(List value) | +| [QueryParametersMap011100Builder](#queryparametersmap011100builder) | refParam(String value) | + +## QueryParametersMap011111Builder +public class QueryParametersMap011111Builder
+builder for `Map` + +A class that builds the Map input type + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| QueryParametersMap011111Builder(Map instance)
Creates a builder that contains the passed instance | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| [QueryParametersMap001111Builder](#queryparametersmap001111builder) | http(List value) | +| [QueryParametersMap010111Builder](#queryparametersmap010111builder) | ioutil(List value) | +| [QueryParametersMap011011Builder](#queryparametersmap011011builder) | pipe(List value) | +| [QueryParametersMap011101Builder](#queryparametersmap011101builder) | refParam(String value) | +| [QueryParametersMap011110Builder](#queryparametersmap011110builder) | url(List value) | + +## QueryParametersMap100000Builder +public class QueryParametersMap100000Builder
+builder for `Map` + +A class that builds the Map input type + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| QueryParametersMap100000Builder(Map instance)
Creates a builder that contains the passed instance | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| [QueryParametersMap000000Builder](#queryparametersmap000000builder) | context(List value) | + +## QueryParametersMap100001Builder +public class QueryParametersMap100001Builder
+builder for `Map` + +A class that builds the Map input type + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| QueryParametersMap100001Builder(Map instance)
Creates a builder that contains the passed instance | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| [QueryParametersMap000001Builder](#queryparametersmap000001builder) | context(List value) | +| [QueryParametersMap100000Builder](#queryparametersmap100000builder) | url(List value) | + +## QueryParametersMap100010Builder +public class QueryParametersMap100010Builder
+builder for `Map` + +A class that builds the Map input type + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| QueryParametersMap100010Builder(Map instance)
Creates a builder that contains the passed instance | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| [QueryParametersMap000010Builder](#queryparametersmap000010builder) | context(List value) | +| [QueryParametersMap100000Builder](#queryparametersmap100000builder) | refParam(String value) | + +## QueryParametersMap100011Builder +public class QueryParametersMap100011Builder
+builder for `Map` + +A class that builds the Map input type + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| QueryParametersMap100011Builder(Map instance)
Creates a builder that contains the passed instance | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| [QueryParametersMap000011Builder](#queryparametersmap000011builder) | context(List value) | +| [QueryParametersMap100001Builder](#queryparametersmap100001builder) | refParam(String value) | +| [QueryParametersMap100010Builder](#queryparametersmap100010builder) | url(List value) | + +## QueryParametersMap100100Builder +public class QueryParametersMap100100Builder
+builder for `Map` + +A class that builds the Map input type + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| QueryParametersMap100100Builder(Map instance)
Creates a builder that contains the passed instance | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| [QueryParametersMap000100Builder](#queryparametersmap000100builder) | context(List value) | +| [QueryParametersMap100000Builder](#queryparametersmap100000builder) | pipe(List value) | + +## QueryParametersMap100101Builder +public class QueryParametersMap100101Builder
+builder for `Map` + +A class that builds the Map input type + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| QueryParametersMap100101Builder(Map instance)
Creates a builder that contains the passed instance | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| [QueryParametersMap000101Builder](#queryparametersmap000101builder) | context(List value) | +| [QueryParametersMap100001Builder](#queryparametersmap100001builder) | pipe(List value) | +| [QueryParametersMap100100Builder](#queryparametersmap100100builder) | url(List value) | + +## QueryParametersMap100110Builder +public class QueryParametersMap100110Builder
+builder for `Map` + +A class that builds the Map input type + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| QueryParametersMap100110Builder(Map instance)
Creates a builder that contains the passed instance | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| [QueryParametersMap000110Builder](#queryparametersmap000110builder) | context(List value) | +| [QueryParametersMap100010Builder](#queryparametersmap100010builder) | pipe(List value) | +| [QueryParametersMap100100Builder](#queryparametersmap100100builder) | refParam(String value) | + +## QueryParametersMap100111Builder +public class QueryParametersMap100111Builder
+builder for `Map` + +A class that builds the Map input type + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| QueryParametersMap100111Builder(Map instance)
Creates a builder that contains the passed instance | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| [QueryParametersMap000111Builder](#queryparametersmap000111builder) | context(List value) | +| [QueryParametersMap100011Builder](#queryparametersmap100011builder) | pipe(List value) | +| [QueryParametersMap100101Builder](#queryparametersmap100101builder) | refParam(String value) | +| [QueryParametersMap100110Builder](#queryparametersmap100110builder) | url(List value) | + +## QueryParametersMap101000Builder +public class QueryParametersMap101000Builder
+builder for `Map` + +A class that builds the Map input type + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| QueryParametersMap101000Builder(Map instance)
Creates a builder that contains the passed instance | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| [QueryParametersMap001000Builder](#queryparametersmap001000builder) | context(List value) | +| [QueryParametersMap100000Builder](#queryparametersmap100000builder) | ioutil(List value) | + +## QueryParametersMap101001Builder +public class QueryParametersMap101001Builder
+builder for `Map` + +A class that builds the Map input type + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| QueryParametersMap101001Builder(Map instance)
Creates a builder that contains the passed instance | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| [QueryParametersMap001001Builder](#queryparametersmap001001builder) | context(List value) | +| [QueryParametersMap100001Builder](#queryparametersmap100001builder) | ioutil(List value) | +| [QueryParametersMap101000Builder](#queryparametersmap101000builder) | url(List value) | + +## QueryParametersMap101010Builder +public class QueryParametersMap101010Builder
+builder for `Map` + +A class that builds the Map input type + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| QueryParametersMap101010Builder(Map instance)
Creates a builder that contains the passed instance | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| [QueryParametersMap001010Builder](#queryparametersmap001010builder) | context(List value) | +| [QueryParametersMap100010Builder](#queryparametersmap100010builder) | ioutil(List value) | +| [QueryParametersMap101000Builder](#queryparametersmap101000builder) | refParam(String value) | + +## QueryParametersMap101011Builder +public class QueryParametersMap101011Builder
+builder for `Map` + +A class that builds the Map input type + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| QueryParametersMap101011Builder(Map instance)
Creates a builder that contains the passed instance | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| [QueryParametersMap001011Builder](#queryparametersmap001011builder) | context(List value) | +| [QueryParametersMap100011Builder](#queryparametersmap100011builder) | ioutil(List value) | +| [QueryParametersMap101001Builder](#queryparametersmap101001builder) | refParam(String value) | +| [QueryParametersMap101010Builder](#queryparametersmap101010builder) | url(List value) | + +## QueryParametersMap101100Builder +public class QueryParametersMap101100Builder
+builder for `Map` + +A class that builds the Map input type + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| QueryParametersMap101100Builder(Map instance)
Creates a builder that contains the passed instance | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| [QueryParametersMap001100Builder](#queryparametersmap001100builder) | context(List value) | +| [QueryParametersMap100100Builder](#queryparametersmap100100builder) | ioutil(List value) | +| [QueryParametersMap101000Builder](#queryparametersmap101000builder) | pipe(List value) | + +## QueryParametersMap101101Builder +public class QueryParametersMap101101Builder
+builder for `Map` + +A class that builds the Map input type + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| QueryParametersMap101101Builder(Map instance)
Creates a builder that contains the passed instance | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| [QueryParametersMap001101Builder](#queryparametersmap001101builder) | context(List value) | +| [QueryParametersMap100101Builder](#queryparametersmap100101builder) | ioutil(List value) | +| [QueryParametersMap101001Builder](#queryparametersmap101001builder) | pipe(List value) | +| [QueryParametersMap101100Builder](#queryparametersmap101100builder) | url(List value) | + +## QueryParametersMap101110Builder +public class QueryParametersMap101110Builder
+builder for `Map` + +A class that builds the Map input type + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| QueryParametersMap101110Builder(Map instance)
Creates a builder that contains the passed instance | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| [QueryParametersMap001110Builder](#queryparametersmap001110builder) | context(List value) | +| [QueryParametersMap100110Builder](#queryparametersmap100110builder) | ioutil(List value) | +| [QueryParametersMap101010Builder](#queryparametersmap101010builder) | pipe(List value) | +| [QueryParametersMap101100Builder](#queryparametersmap101100builder) | refParam(String value) | + +## QueryParametersMap101111Builder +public class QueryParametersMap101111Builder
+builder for `Map` + +A class that builds the Map input type + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| QueryParametersMap101111Builder(Map instance)
Creates a builder that contains the passed instance | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| [QueryParametersMap001111Builder](#queryparametersmap001111builder) | context(List value) | +| [QueryParametersMap100111Builder](#queryparametersmap100111builder) | ioutil(List value) | +| [QueryParametersMap101011Builder](#queryparametersmap101011builder) | pipe(List value) | +| [QueryParametersMap101101Builder](#queryparametersmap101101builder) | refParam(String value) | +| [QueryParametersMap101110Builder](#queryparametersmap101110builder) | url(List value) | + +## QueryParametersMap110000Builder +public class QueryParametersMap110000Builder
+builder for `Map` + +A class that builds the Map input type + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| QueryParametersMap110000Builder(Map instance)
Creates a builder that contains the passed instance | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| [QueryParametersMap010000Builder](#queryparametersmap010000builder) | context(List value) | +| [QueryParametersMap100000Builder](#queryparametersmap100000builder) | http(List value) | + +## QueryParametersMap110001Builder +public class QueryParametersMap110001Builder
+builder for `Map` + +A class that builds the Map input type + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| QueryParametersMap110001Builder(Map instance)
Creates a builder that contains the passed instance | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| [QueryParametersMap010001Builder](#queryparametersmap010001builder) | context(List value) | +| [QueryParametersMap100001Builder](#queryparametersmap100001builder) | http(List value) | +| [QueryParametersMap110000Builder](#queryparametersmap110000builder) | url(List value) | + +## QueryParametersMap110010Builder +public class QueryParametersMap110010Builder
+builder for `Map` + +A class that builds the Map input type + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| QueryParametersMap110010Builder(Map instance)
Creates a builder that contains the passed instance | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| [QueryParametersMap010010Builder](#queryparametersmap010010builder) | context(List value) | +| [QueryParametersMap100010Builder](#queryparametersmap100010builder) | http(List value) | +| [QueryParametersMap110000Builder](#queryparametersmap110000builder) | refParam(String value) | + +## QueryParametersMap110011Builder +public class QueryParametersMap110011Builder
+builder for `Map` + +A class that builds the Map input type + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| QueryParametersMap110011Builder(Map instance)
Creates a builder that contains the passed instance | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| [QueryParametersMap010011Builder](#queryparametersmap010011builder) | context(List value) | +| [QueryParametersMap100011Builder](#queryparametersmap100011builder) | http(List value) | +| [QueryParametersMap110001Builder](#queryparametersmap110001builder) | refParam(String value) | +| [QueryParametersMap110010Builder](#queryparametersmap110010builder) | url(List value) | + +## QueryParametersMap110100Builder +public class QueryParametersMap110100Builder
+builder for `Map` + +A class that builds the Map input type + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| QueryParametersMap110100Builder(Map instance)
Creates a builder that contains the passed instance | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| [QueryParametersMap010100Builder](#queryparametersmap010100builder) | context(List value) | +| [QueryParametersMap100100Builder](#queryparametersmap100100builder) | http(List value) | +| [QueryParametersMap110000Builder](#queryparametersmap110000builder) | pipe(List value) | + +## QueryParametersMap110101Builder +public class QueryParametersMap110101Builder
+builder for `Map` + +A class that builds the Map input type + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| QueryParametersMap110101Builder(Map instance)
Creates a builder that contains the passed instance | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| [QueryParametersMap010101Builder](#queryparametersmap010101builder) | context(List value) | +| [QueryParametersMap100101Builder](#queryparametersmap100101builder) | http(List value) | +| [QueryParametersMap110001Builder](#queryparametersmap110001builder) | pipe(List value) | +| [QueryParametersMap110100Builder](#queryparametersmap110100builder) | url(List value) | + +## QueryParametersMap110110Builder +public class QueryParametersMap110110Builder
+builder for `Map` + +A class that builds the Map input type + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| QueryParametersMap110110Builder(Map instance)
Creates a builder that contains the passed instance | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| [QueryParametersMap010110Builder](#queryparametersmap010110builder) | context(List value) | +| [QueryParametersMap100110Builder](#queryparametersmap100110builder) | http(List value) | +| [QueryParametersMap110010Builder](#queryparametersmap110010builder) | pipe(List value) | +| [QueryParametersMap110100Builder](#queryparametersmap110100builder) | refParam(String value) | + +## QueryParametersMap110111Builder +public class QueryParametersMap110111Builder
+builder for `Map` + +A class that builds the Map input type + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| QueryParametersMap110111Builder(Map instance)
Creates a builder that contains the passed instance | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| [QueryParametersMap010111Builder](#queryparametersmap010111builder) | context(List value) | +| [QueryParametersMap100111Builder](#queryparametersmap100111builder) | http(List value) | +| [QueryParametersMap110011Builder](#queryparametersmap110011builder) | pipe(List value) | +| [QueryParametersMap110101Builder](#queryparametersmap110101builder) | refParam(String value) | +| [QueryParametersMap110110Builder](#queryparametersmap110110builder) | url(List value) | + +## QueryParametersMap111000Builder +public class QueryParametersMap111000Builder
+builder for `Map` + +A class that builds the Map input type + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| QueryParametersMap111000Builder(Map instance)
Creates a builder that contains the passed instance | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| [QueryParametersMap011000Builder](#queryparametersmap011000builder) | context(List value) | +| [QueryParametersMap101000Builder](#queryparametersmap101000builder) | http(List value) | +| [QueryParametersMap110000Builder](#queryparametersmap110000builder) | ioutil(List value) | + +## QueryParametersMap111001Builder +public class QueryParametersMap111001Builder
+builder for `Map` + +A class that builds the Map input type + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| QueryParametersMap111001Builder(Map instance)
Creates a builder that contains the passed instance | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| [QueryParametersMap011001Builder](#queryparametersmap011001builder) | context(List value) | +| [QueryParametersMap101001Builder](#queryparametersmap101001builder) | http(List value) | +| [QueryParametersMap110001Builder](#queryparametersmap110001builder) | ioutil(List value) | +| [QueryParametersMap111000Builder](#queryparametersmap111000builder) | url(List value) | + +## QueryParametersMap111010Builder +public class QueryParametersMap111010Builder
+builder for `Map` + +A class that builds the Map input type + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| QueryParametersMap111010Builder(Map instance)
Creates a builder that contains the passed instance | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| [QueryParametersMap011010Builder](#queryparametersmap011010builder) | context(List value) | +| [QueryParametersMap101010Builder](#queryparametersmap101010builder) | http(List value) | +| [QueryParametersMap110010Builder](#queryparametersmap110010builder) | ioutil(List value) | +| [QueryParametersMap111000Builder](#queryparametersmap111000builder) | refParam(String value) | + +## QueryParametersMap111011Builder +public class QueryParametersMap111011Builder
+builder for `Map` + +A class that builds the Map input type + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| QueryParametersMap111011Builder(Map instance)
Creates a builder that contains the passed instance | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| [QueryParametersMap011011Builder](#queryparametersmap011011builder) | context(List value) | +| [QueryParametersMap101011Builder](#queryparametersmap101011builder) | http(List value) | +| [QueryParametersMap110011Builder](#queryparametersmap110011builder) | ioutil(List value) | +| [QueryParametersMap111001Builder](#queryparametersmap111001builder) | refParam(String value) | +| [QueryParametersMap111010Builder](#queryparametersmap111010builder) | url(List value) | + +## QueryParametersMap111100Builder +public class QueryParametersMap111100Builder
+builder for `Map` + +A class that builds the Map input type + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| QueryParametersMap111100Builder(Map instance)
Creates a builder that contains the passed instance | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| [QueryParametersMap011100Builder](#queryparametersmap011100builder) | context(List value) | +| [QueryParametersMap101100Builder](#queryparametersmap101100builder) | http(List value) | +| [QueryParametersMap110100Builder](#queryparametersmap110100builder) | ioutil(List value) | +| [QueryParametersMap111000Builder](#queryparametersmap111000builder) | pipe(List value) | + +## QueryParametersMap111101Builder +public class QueryParametersMap111101Builder
+builder for `Map` + +A class that builds the Map input type + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| QueryParametersMap111101Builder(Map instance)
Creates a builder that contains the passed instance | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| [QueryParametersMap011101Builder](#queryparametersmap011101builder) | context(List value) | +| [QueryParametersMap101101Builder](#queryparametersmap101101builder) | http(List value) | +| [QueryParametersMap110101Builder](#queryparametersmap110101builder) | ioutil(List value) | +| [QueryParametersMap111001Builder](#queryparametersmap111001builder) | pipe(List value) | +| [QueryParametersMap111100Builder](#queryparametersmap111100builder) | url(List value) | + +## QueryParametersMap111110Builder +public class QueryParametersMap111110Builder
+builder for `Map` + +A class that builds the Map input type + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| QueryParametersMap111110Builder(Map instance)
Creates a builder that contains the passed instance | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| [QueryParametersMap011110Builder](#queryparametersmap011110builder) | context(List value) | +| [QueryParametersMap101110Builder](#queryparametersmap101110builder) | http(List value) | +| [QueryParametersMap110110Builder](#queryparametersmap110110builder) | ioutil(List value) | +| [QueryParametersMap111010Builder](#queryparametersmap111010builder) | pipe(List value) | +| [QueryParametersMap111100Builder](#queryparametersmap111100builder) | refParam(String value) | + +## QueryParametersMapBuilder +public class QueryParametersMapBuilder
+builder for `Map` + +A class that builds the Map input type + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| QueryParametersMapBuilder()
Creates a builder that contains an empty map | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| [QueryParametersMap011111Builder](#queryparametersmap011111builder) | context(List value) | +| [QueryParametersMap101111Builder](#queryparametersmap101111builder) | http(List value) | +| [QueryParametersMap110111Builder](#queryparametersmap110111builder) | ioutil(List value) | +| [QueryParametersMap111011Builder](#queryparametersmap111011builder) | pipe(List value) | +| [QueryParametersMap111101Builder](#queryparametersmap111101builder) | refParam(String value) | +| [QueryParametersMap111110Builder](#queryparametersmap111110builder) | url(List value) | + +## QueryParametersMap +public static class QueryParametersMap
+extends FrozenMap + +A class to store validated Map payloads + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| static [QueryParametersMap](#queryparametersmap) | of([Map](#queryparametersmapbuilder) arg, SchemaConfiguration configuration) | +| [Schema4.SchemaList4](../../../paths/faketestqueryparamters/put/parameters/parameter4/Schema4.md#schemalist4) | context()
| +| [Schema2.SchemaList2](../../../paths/faketestqueryparamters/put/parameters/parameter2/Schema2.md#schemalist2) | http()
| +| [Schema1.SchemaList1](../../../paths/faketestqueryparamters/put/parameters/parameter1/Schema1.md#schemalist1) | ioutil()
| +| [Schema0.SchemaList0](../../../paths/faketestqueryparamters/put/parameters/parameter0/Schema0.md#schemalist0) | pipe()
| +| String | refParam()
| +| [Schema3.SchemaList3](../../../paths/faketestqueryparamters/put/parameters/parameter3/Schema3.md#schemalist3) | url()
| + +## 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(Nothing? data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| Nothing? | 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/kotlin/docs/paths/faketestqueryparamters/put/FaketestqueryparamtersPutResponses.md b/samples/client/petstore/kotlin/docs/paths/faketestqueryparamters/put/FaketestqueryparamtersPutResponses.md new file mode 100644 index 00000000000..6b0ed25e35f --- /dev/null +++ b/samples/client/petstore/kotlin/docs/paths/faketestqueryparamters/put/FaketestqueryparamtersPutResponses.md @@ -0,0 +1,29 @@ +# FaketestqueryparamtersPutResponses + +public class FaketestqueryparamtersPutResponses + +A class that contains necessary responses classes +- a sealed interface, EndpointResponse, that stores endpoint responses +- records for each endpoint response + +## Nested Class Summary +| Modifier and Type | Class and Description | +| ----------------- | --------------------- | +| sealed interface | [EndpointResponse](#endpointresponse)
stores the endpoint responses | +| record | [EndpointFaketestqueryparamtersPutCode200Response](#endpointfaketestqueryparamtersputcode200response)
the response for 200 | + +## EndpointResponse +public sealed interface EndpointResponse permits
+[EndpointFaketestqueryparamtersPutCode200Response](#endpointfaketestqueryparamtersputcode200response) + +a sealed interface that stores endpoint responses + +## EndpointFaketestqueryparamtersPutCode200Response +public record EndpointFaketestqueryparamtersPutCode200Response( + HttpResponse response, + Nothing? body, + Nothing? headers +) implements EndpointResponse, ApiResponse
+ +a class that stores an endpoint response + diff --git a/samples/client/petstore/kotlin/docs/paths/faketestqueryparamters/put/parameters/parameter0/Schema0.md b/samples/client/petstore/kotlin/docs/paths/faketestqueryparamters/put/parameters/parameter0/Schema0.md new file mode 100644 index 00000000000..a4efd071e64 --- /dev/null +++ b/samples/client/petstore/kotlin/docs/paths/faketestqueryparamters/put/parameters/parameter0/Schema0.md @@ -0,0 +1,156 @@ +# Schema0 +public class Schema0
+ +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 list payloads, extends FrozenList +- classes to build inputs for list payloads + +## Nested Class Summary +| Modifier and Type | Class and Description | +| ----------------- | ---------------------- | +| sealed interface | [Schema0.Schema01Boxed](#schema01boxed)
sealed interface for validated payloads | +| record | [Schema0.Schema01BoxedList](#schema01boxedlist)
boxed class to store validated List payloads | +| static class | [Schema0.Schema01](#schema01)
schema class | +| static class | [Schema0.SchemaListBuilder0](#schemalistbuilder0)
builder for List payloads | +| static class | [Schema0.SchemaList0](#schemalist0)
output class for List payloads | +| sealed interface | [Schema0.Items0Boxed](#items0boxed)
sealed interface for validated payloads | +| record | [Schema0.Items0BoxedString](#items0boxedstring)
boxed class to store validated String payloads | +| static class | [Schema0.Items0](#items0)
schema class | + +## Schema01Boxed +public sealed interface Schema01Boxed
+permits
+[Schema01BoxedList](#schema01boxedlist) + +sealed interface that stores validated payloads using boxed classes + +## Schema01BoxedList +public record Schema01BoxedList
+implements [Schema01Boxed](#schema01boxed) + +record that stores validated List payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| Schema01BoxedList([SchemaList0](#schemalist0) data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| [SchemaList0](#schemalist0) | data()
validated payload | +| @Nullable Object | getData()
validated payload | + +## Schema01 +public static class Schema01
+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.faketestqueryparamters.put.parameters.parameter0.Schema0; + +import java.util.Arrays; +import java.util.List; +import java.util.AbstractMap; + +static final SchemaConfiguration configuration = new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().build()); + +// List validation +Schema0.SchemaList0 validatedPayload = + Schema0.Schema01.validate( + new Schema0.SchemaListBuilder0() + .add("a") + + .build(), + configuration +); +``` + +### Field Summary +| Modifier and Type | Field and Description | +| ----------------- | ---------------------- | +| Set> | type = Set.of(List.class) | +| Class | items = [Items0.class](#items0) | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| [SchemaList0](#schemalist0) | validate([List](#schemalistbuilder0) arg, SchemaConfiguration configuration) | +| [Schema01BoxedList](#schema01boxedlist) | validateAndBox([List](#schemalistbuilder0) arg, SchemaConfiguration configuration) | +| [Schema01Boxed](#schema01boxed) | validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) | +| @Nullable Object | validate(@Nullable Object arg, SchemaConfiguration configuration) | + +## SchemaListBuilder0 +public class SchemaListBuilder0
+builder for `List` + +A class that builds the List input type + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| SchemaListBuilder0()
Creates an empty list | +| SchemaListBuilder0(List items)
Stores the items in a list | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| SchemaListBuilder0 | add(String item) | +| List | build()
Returns list input that should be used with Schema.validate | + +## SchemaList0 +public class SchemaList0
+extends `FrozenList` + +A class to store validated List payloads + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| static [SchemaList0](#schemalist0) | of([List](#schemalistbuilder0) arg, SchemaConfiguration configuration) | + +## Items0Boxed +public sealed interface Items0Boxed
+permits
+[Items0BoxedString](#items0boxedstring) + +sealed interface that stores validated payloads using boxed classes + +## Items0BoxedString +public record Items0BoxedString
+implements [Items0Boxed](#items0boxed) + +record that stores validated String payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| Items0BoxedString(String data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| String | data()
validated payload | +| @Nullable Object | getData()
validated payload | + +## Items0 +public static class Items0
+extends StringJsonSchema.StringJsonSchema1 + +A schema class that validates payloads + +| Methods Inherited from class org.openapijsonschematools.client.schemas.StringJsonSchema.StringJsonSchema1 | +| ------------------------------------------------------------------ | +| validate | +| validateAndBox | diff --git a/samples/client/petstore/kotlin/docs/paths/faketestqueryparamters/put/parameters/parameter1/Schema1.md b/samples/client/petstore/kotlin/docs/paths/faketestqueryparamters/put/parameters/parameter1/Schema1.md new file mode 100644 index 00000000000..d0d8efab32e --- /dev/null +++ b/samples/client/petstore/kotlin/docs/paths/faketestqueryparamters/put/parameters/parameter1/Schema1.md @@ -0,0 +1,156 @@ +# Schema1 +public class Schema1
+ +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 list payloads, extends FrozenList +- classes to build inputs for list payloads + +## Nested Class Summary +| Modifier and Type | Class and Description | +| ----------------- | ---------------------- | +| sealed interface | [Schema1.Schema11Boxed](#schema11boxed)
sealed interface for validated payloads | +| record | [Schema1.Schema11BoxedList](#schema11boxedlist)
boxed class to store validated List payloads | +| static class | [Schema1.Schema11](#schema11)
schema class | +| static class | [Schema1.SchemaListBuilder1](#schemalistbuilder1)
builder for List payloads | +| static class | [Schema1.SchemaList1](#schemalist1)
output class for List payloads | +| sealed interface | [Schema1.Items1Boxed](#items1boxed)
sealed interface for validated payloads | +| record | [Schema1.Items1BoxedString](#items1boxedstring)
boxed class to store validated String payloads | +| static class | [Schema1.Items1](#items1)
schema class | + +## Schema11Boxed +public sealed interface Schema11Boxed
+permits
+[Schema11BoxedList](#schema11boxedlist) + +sealed interface that stores validated payloads using boxed classes + +## Schema11BoxedList +public record Schema11BoxedList
+implements [Schema11Boxed](#schema11boxed) + +record that stores validated List payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| Schema11BoxedList([SchemaList1](#schemalist1) data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| [SchemaList1](#schemalist1) | data()
validated payload | +| @Nullable Object | getData()
validated payload | + +## Schema11 +public static class Schema11
+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.faketestqueryparamters.put.parameters.parameter1.Schema1; + +import java.util.Arrays; +import java.util.List; +import java.util.AbstractMap; + +static final SchemaConfiguration configuration = new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().build()); + +// List validation +Schema1.SchemaList1 validatedPayload = + Schema1.Schema11.validate( + new Schema1.SchemaListBuilder1() + .add("a") + + .build(), + configuration +); +``` + +### Field Summary +| Modifier and Type | Field and Description | +| ----------------- | ---------------------- | +| Set> | type = Set.of(List.class) | +| Class | items = [Items1.class](#items1) | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| [SchemaList1](#schemalist1) | validate([List](#schemalistbuilder1) arg, SchemaConfiguration configuration) | +| [Schema11BoxedList](#schema11boxedlist) | validateAndBox([List](#schemalistbuilder1) arg, SchemaConfiguration configuration) | +| [Schema11Boxed](#schema11boxed) | validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) | +| @Nullable Object | validate(@Nullable Object arg, SchemaConfiguration configuration) | + +## SchemaListBuilder1 +public class SchemaListBuilder1
+builder for `List` + +A class that builds the List input type + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| SchemaListBuilder1()
Creates an empty list | +| SchemaListBuilder1(List items)
Stores the items in a list | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| SchemaListBuilder1 | add(String item) | +| List | build()
Returns list input that should be used with Schema.validate | + +## SchemaList1 +public class SchemaList1
+extends `FrozenList` + +A class to store validated List payloads + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| static [SchemaList1](#schemalist1) | of([List](#schemalistbuilder1) arg, SchemaConfiguration configuration) | + +## Items1Boxed +public sealed interface Items1Boxed
+permits
+[Items1BoxedString](#items1boxedstring) + +sealed interface that stores validated payloads using boxed classes + +## Items1BoxedString +public record Items1BoxedString
+implements [Items1Boxed](#items1boxed) + +record that stores validated String payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| Items1BoxedString(String data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| String | data()
validated payload | +| @Nullable Object | getData()
validated payload | + +## Items1 +public static class Items1
+extends StringJsonSchema.StringJsonSchema1 + +A schema class that validates payloads + +| Methods Inherited from class org.openapijsonschematools.client.schemas.StringJsonSchema.StringJsonSchema1 | +| ------------------------------------------------------------------ | +| validate | +| validateAndBox | diff --git a/samples/client/petstore/kotlin/docs/paths/faketestqueryparamters/put/parameters/parameter2/Schema2.md b/samples/client/petstore/kotlin/docs/paths/faketestqueryparamters/put/parameters/parameter2/Schema2.md new file mode 100644 index 00000000000..3357a64749a --- /dev/null +++ b/samples/client/petstore/kotlin/docs/paths/faketestqueryparamters/put/parameters/parameter2/Schema2.md @@ -0,0 +1,156 @@ +# Schema2 +public class Schema2
+ +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 list payloads, extends FrozenList +- classes to build inputs for list payloads + +## Nested Class Summary +| Modifier and Type | Class and Description | +| ----------------- | ---------------------- | +| sealed interface | [Schema2.Schema21Boxed](#schema21boxed)
sealed interface for validated payloads | +| record | [Schema2.Schema21BoxedList](#schema21boxedlist)
boxed class to store validated List payloads | +| static class | [Schema2.Schema21](#schema21)
schema class | +| static class | [Schema2.SchemaListBuilder2](#schemalistbuilder2)
builder for List payloads | +| static class | [Schema2.SchemaList2](#schemalist2)
output class for List payloads | +| sealed interface | [Schema2.Items2Boxed](#items2boxed)
sealed interface for validated payloads | +| record | [Schema2.Items2BoxedString](#items2boxedstring)
boxed class to store validated String payloads | +| static class | [Schema2.Items2](#items2)
schema class | + +## Schema21Boxed +public sealed interface Schema21Boxed
+permits
+[Schema21BoxedList](#schema21boxedlist) + +sealed interface that stores validated payloads using boxed classes + +## Schema21BoxedList +public record Schema21BoxedList
+implements [Schema21Boxed](#schema21boxed) + +record that stores validated List payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| Schema21BoxedList([SchemaList2](#schemalist2) data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| [SchemaList2](#schemalist2) | data()
validated payload | +| @Nullable Object | getData()
validated payload | + +## Schema21 +public static class Schema21
+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.faketestqueryparamters.put.parameters.parameter2.Schema2; + +import java.util.Arrays; +import java.util.List; +import java.util.AbstractMap; + +static final SchemaConfiguration configuration = new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().build()); + +// List validation +Schema2.SchemaList2 validatedPayload = + Schema2.Schema21.validate( + new Schema2.SchemaListBuilder2() + .add("a") + + .build(), + configuration +); +``` + +### Field Summary +| Modifier and Type | Field and Description | +| ----------------- | ---------------------- | +| Set> | type = Set.of(List.class) | +| Class | items = [Items2.class](#items2) | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| [SchemaList2](#schemalist2) | validate([List](#schemalistbuilder2) arg, SchemaConfiguration configuration) | +| [Schema21BoxedList](#schema21boxedlist) | validateAndBox([List](#schemalistbuilder2) arg, SchemaConfiguration configuration) | +| [Schema21Boxed](#schema21boxed) | validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) | +| @Nullable Object | validate(@Nullable Object arg, SchemaConfiguration configuration) | + +## SchemaListBuilder2 +public class SchemaListBuilder2
+builder for `List` + +A class that builds the List input type + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| SchemaListBuilder2()
Creates an empty list | +| SchemaListBuilder2(List items)
Stores the items in a list | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| SchemaListBuilder2 | add(String item) | +| List | build()
Returns list input that should be used with Schema.validate | + +## SchemaList2 +public class SchemaList2
+extends `FrozenList` + +A class to store validated List payloads + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| static [SchemaList2](#schemalist2) | of([List](#schemalistbuilder2) arg, SchemaConfiguration configuration) | + +## Items2Boxed +public sealed interface Items2Boxed
+permits
+[Items2BoxedString](#items2boxedstring) + +sealed interface that stores validated payloads using boxed classes + +## Items2BoxedString +public record Items2BoxedString
+implements [Items2Boxed](#items2boxed) + +record that stores validated String payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| Items2BoxedString(String data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| String | data()
validated payload | +| @Nullable Object | getData()
validated payload | + +## Items2 +public static class Items2
+extends StringJsonSchema.StringJsonSchema1 + +A schema class that validates payloads + +| Methods Inherited from class org.openapijsonschematools.client.schemas.StringJsonSchema.StringJsonSchema1 | +| ------------------------------------------------------------------ | +| validate | +| validateAndBox | diff --git a/samples/client/petstore/kotlin/docs/paths/faketestqueryparamters/put/parameters/parameter3/Schema3.md b/samples/client/petstore/kotlin/docs/paths/faketestqueryparamters/put/parameters/parameter3/Schema3.md new file mode 100644 index 00000000000..cede783379d --- /dev/null +++ b/samples/client/petstore/kotlin/docs/paths/faketestqueryparamters/put/parameters/parameter3/Schema3.md @@ -0,0 +1,156 @@ +# Schema3 +public class Schema3
+ +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 list payloads, extends FrozenList +- classes to build inputs for list payloads + +## Nested Class Summary +| Modifier and Type | Class and Description | +| ----------------- | ---------------------- | +| sealed interface | [Schema3.Schema31Boxed](#schema31boxed)
sealed interface for validated payloads | +| record | [Schema3.Schema31BoxedList](#schema31boxedlist)
boxed class to store validated List payloads | +| static class | [Schema3.Schema31](#schema31)
schema class | +| static class | [Schema3.SchemaListBuilder3](#schemalistbuilder3)
builder for List payloads | +| static class | [Schema3.SchemaList3](#schemalist3)
output class for List payloads | +| sealed interface | [Schema3.Items3Boxed](#items3boxed)
sealed interface for validated payloads | +| record | [Schema3.Items3BoxedString](#items3boxedstring)
boxed class to store validated String payloads | +| static class | [Schema3.Items3](#items3)
schema class | + +## Schema31Boxed +public sealed interface Schema31Boxed
+permits
+[Schema31BoxedList](#schema31boxedlist) + +sealed interface that stores validated payloads using boxed classes + +## Schema31BoxedList +public record Schema31BoxedList
+implements [Schema31Boxed](#schema31boxed) + +record that stores validated List payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| Schema31BoxedList([SchemaList3](#schemalist3) data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| [SchemaList3](#schemalist3) | data()
validated payload | +| @Nullable Object | getData()
validated payload | + +## Schema31 +public static class Schema31
+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.faketestqueryparamters.put.parameters.parameter3.Schema3; + +import java.util.Arrays; +import java.util.List; +import java.util.AbstractMap; + +static final SchemaConfiguration configuration = new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().build()); + +// List validation +Schema3.SchemaList3 validatedPayload = + Schema3.Schema31.validate( + new Schema3.SchemaListBuilder3() + .add("a") + + .build(), + configuration +); +``` + +### Field Summary +| Modifier and Type | Field and Description | +| ----------------- | ---------------------- | +| Set> | type = Set.of(List.class) | +| Class | items = [Items3.class](#items3) | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| [SchemaList3](#schemalist3) | validate([List](#schemalistbuilder3) arg, SchemaConfiguration configuration) | +| [Schema31BoxedList](#schema31boxedlist) | validateAndBox([List](#schemalistbuilder3) arg, SchemaConfiguration configuration) | +| [Schema31Boxed](#schema31boxed) | validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) | +| @Nullable Object | validate(@Nullable Object arg, SchemaConfiguration configuration) | + +## SchemaListBuilder3 +public class SchemaListBuilder3
+builder for `List` + +A class that builds the List input type + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| SchemaListBuilder3()
Creates an empty list | +| SchemaListBuilder3(List items)
Stores the items in a list | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| SchemaListBuilder3 | add(String item) | +| List | build()
Returns list input that should be used with Schema.validate | + +## SchemaList3 +public class SchemaList3
+extends `FrozenList` + +A class to store validated List payloads + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| static [SchemaList3](#schemalist3) | of([List](#schemalistbuilder3) arg, SchemaConfiguration configuration) | + +## Items3Boxed +public sealed interface Items3Boxed
+permits
+[Items3BoxedString](#items3boxedstring) + +sealed interface that stores validated payloads using boxed classes + +## Items3BoxedString +public record Items3BoxedString
+implements [Items3Boxed](#items3boxed) + +record that stores validated String payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| Items3BoxedString(String data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| String | data()
validated payload | +| @Nullable Object | getData()
validated payload | + +## Items3 +public static class Items3
+extends StringJsonSchema.StringJsonSchema1 + +A schema class that validates payloads + +| Methods Inherited from class org.openapijsonschematools.client.schemas.StringJsonSchema.StringJsonSchema1 | +| ------------------------------------------------------------------ | +| validate | +| validateAndBox | diff --git a/samples/client/petstore/kotlin/docs/paths/faketestqueryparamters/put/parameters/parameter4/Schema4.md b/samples/client/petstore/kotlin/docs/paths/faketestqueryparamters/put/parameters/parameter4/Schema4.md new file mode 100644 index 00000000000..17c3da4dab2 --- /dev/null +++ b/samples/client/petstore/kotlin/docs/paths/faketestqueryparamters/put/parameters/parameter4/Schema4.md @@ -0,0 +1,156 @@ +# Schema4 +public class Schema4
+ +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 list payloads, extends FrozenList +- classes to build inputs for list payloads + +## Nested Class Summary +| Modifier and Type | Class and Description | +| ----------------- | ---------------------- | +| sealed interface | [Schema4.Schema41Boxed](#schema41boxed)
sealed interface for validated payloads | +| record | [Schema4.Schema41BoxedList](#schema41boxedlist)
boxed class to store validated List payloads | +| static class | [Schema4.Schema41](#schema41)
schema class | +| static class | [Schema4.SchemaListBuilder4](#schemalistbuilder4)
builder for List payloads | +| static class | [Schema4.SchemaList4](#schemalist4)
output class for List payloads | +| sealed interface | [Schema4.Items4Boxed](#items4boxed)
sealed interface for validated payloads | +| record | [Schema4.Items4BoxedString](#items4boxedstring)
boxed class to store validated String payloads | +| static class | [Schema4.Items4](#items4)
schema class | + +## Schema41Boxed +public sealed interface Schema41Boxed
+permits
+[Schema41BoxedList](#schema41boxedlist) + +sealed interface that stores validated payloads using boxed classes + +## Schema41BoxedList +public record Schema41BoxedList
+implements [Schema41Boxed](#schema41boxed) + +record that stores validated List payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| Schema41BoxedList([SchemaList4](#schemalist4) data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| [SchemaList4](#schemalist4) | data()
validated payload | +| @Nullable Object | getData()
validated payload | + +## Schema41 +public static class Schema41
+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.faketestqueryparamters.put.parameters.parameter4.Schema4; + +import java.util.Arrays; +import java.util.List; +import java.util.AbstractMap; + +static final SchemaConfiguration configuration = new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().build()); + +// List validation +Schema4.SchemaList4 validatedPayload = + Schema4.Schema41.validate( + new Schema4.SchemaListBuilder4() + .add("a") + + .build(), + configuration +); +``` + +### Field Summary +| Modifier and Type | Field and Description | +| ----------------- | ---------------------- | +| Set> | type = Set.of(List.class) | +| Class | items = [Items4.class](#items4) | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| [SchemaList4](#schemalist4) | validate([List](#schemalistbuilder4) arg, SchemaConfiguration configuration) | +| [Schema41BoxedList](#schema41boxedlist) | validateAndBox([List](#schemalistbuilder4) arg, SchemaConfiguration configuration) | +| [Schema41Boxed](#schema41boxed) | validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) | +| @Nullable Object | validate(@Nullable Object arg, SchemaConfiguration configuration) | + +## SchemaListBuilder4 +public class SchemaListBuilder4
+builder for `List` + +A class that builds the List input type + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| SchemaListBuilder4()
Creates an empty list | +| SchemaListBuilder4(List items)
Stores the items in a list | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| SchemaListBuilder4 | add(String item) | +| List | build()
Returns list input that should be used with Schema.validate | + +## SchemaList4 +public class SchemaList4
+extends `FrozenList` + +A class to store validated List payloads + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| static [SchemaList4](#schemalist4) | of([List](#schemalistbuilder4) arg, SchemaConfiguration configuration) | + +## Items4Boxed +public sealed interface Items4Boxed
+permits
+[Items4BoxedString](#items4boxedstring) + +sealed interface that stores validated payloads using boxed classes + +## Items4BoxedString +public record Items4BoxedString
+implements [Items4Boxed](#items4boxed) + +record that stores validated String payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| Items4BoxedString(String data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| String | data()
validated payload | +| @Nullable Object | getData()
validated payload | + +## Items4 +public static class Items4
+extends StringJsonSchema.StringJsonSchema1 + +A schema class that validates payloads + +| Methods Inherited from class org.openapijsonschematools.client.schemas.StringJsonSchema.StringJsonSchema1 | +| ------------------------------------------------------------------ | +| validate | +| validateAndBox | diff --git a/samples/client/petstore/kotlin/docs/paths/faketestqueryparamters/put/parameters/parameter5/Schema5.md b/samples/client/petstore/kotlin/docs/paths/faketestqueryparamters/put/parameters/parameter5/Schema5.md new file mode 100644 index 00000000000..f566af62cf0 --- /dev/null +++ b/samples/client/petstore/kotlin/docs/paths/faketestqueryparamters/put/parameters/parameter5/Schema5.md @@ -0,0 +1,19 @@ +# Schema5 +public class Schema5
+extends [StringWithValidation1](../../../components/schemas/StringWithValidation.md#stringwithvalidation) + +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 + +## Nested Class Summary +| Modifier and Type | Class and Description | +| ----------------- | ---------------------- | +| static class | [Schema5.Schema51](#schema51)
schema class | + +## Schema51 +public static class Schema51
+extends [StringWithValidation.StringWithValidation1](../../../components/schemas/StringWithValidation.md#stringwithvalidation1) + +A schema class that validates payloads diff --git a/samples/client/petstore/kotlin/docs/paths/faketestqueryparamters/put/responses/FaketestqueryparamtersPutCode200Response.md b/samples/client/petstore/kotlin/docs/paths/faketestqueryparamters/put/responses/FaketestqueryparamtersPutCode200Response.md new file mode 100644 index 00000000000..078eb74fdbe --- /dev/null +++ b/samples/client/petstore/kotlin/docs/paths/faketestqueryparamters/put/responses/FaketestqueryparamtersPutCode200Response.md @@ -0,0 +1,17 @@ +# FaketestqueryparamtersPutCode200Response + +public class FaketestqueryparamtersPutCode200Response extends [SuccessDescriptionOnly](../../components/responses/SuccessDescriptionOnly.md) + +A class (extended from the $ref class) that contains necessary nested response classes +- a class that extends ResponseDeserializer and is used to deserialize responses + +## Nested Class Summary +| Modifier and Type | Class and Description | +| ----------------- | --------------------- | +| static class | [FaketestqueryparamtersPutCode200Response.FaketestqueryparamtersPutCode200Response1](#faketestqueryparamtersputcode200response1)
class that deserializes responses | + +## FaketestqueryparamtersPutCode200Response1 +public static class FaketestqueryparamtersPutCode200Response1 extends [SuccessDescriptionOnly1](../../components/responses/SuccessDescriptionOnly.md#successdescriptiononly1)
+ +a class that deserializes responses, extended from the $ref class + diff --git a/samples/client/petstore/kotlin/docs/paths/fakeuploaddownloadfile/FakeuploaddownloadfilePost.md b/samples/client/petstore/kotlin/docs/paths/fakeuploaddownloadfile/FakeuploaddownloadfilePost.md new file mode 100644 index 00000000000..70ad30f02e8 --- /dev/null +++ b/samples/client/petstore/kotlin/docs/paths/fakeuploaddownloadfile/FakeuploaddownloadfilePost.md @@ -0,0 +1,184 @@ +# FakeuploaddownloadfilePost + +public class FakeuploaddownloadfilePost + +A class that contains necessary endpoint classes +- a class that calls the endpoint method using the http verb +- a class that calls the endpoint method using the operationId name +- class(es) to store the request inputs +- builder(s) to set the request input data + +## Nested Class Summary +| Modifier and Type | Class and Description | +| ----------------- | --------------------- | +| static class | [Post](#post)
The class that has a post method to call the endpoint | +| interface | [UploadDownloadFileOperation](#uploaddownloadfileoperation)
The interface that has a uploadDownloadFile method to call the endpoint | +| static class | [PostRequest](#postrequest)
The final request inputs class | +| static class | [PostNullableRequest](#postnullablerequest)
The initial request inputs class | +| static class | [Post0RequestBuilder](#post0requestbuilder)
A builder for the request input class | +| static class | [PostRequestBuilder](#postrequestbuilder)
A builder for the request input class | + +## Post +public static class Post 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.fakeuploaddownloadfile.post.FakeuploaddownloadfilePostRequestBody; +import org.openapijsonschematools.client.paths.fakeuploaddownloadfile.post.requestbody.content.applicationoctetstream.ApplicationoctetstreamSchema; +import org.openapijsonschematools.client.servers.RootServer0; +import org.openapijsonschematools.client.servers.RootServer1; +import org.openapijsonschematools.client.servers.RootServer2; +import org.openapijsonschematools.client.paths.fakeuploaddownloadfile.post.responses.FakeuploaddownloadfilePostCode200Response; +import org.openapijsonschematools.client.servers.RootServerInfo; +import org.openapijsonschematools.client.paths.fakeuploaddownloadfile.FakeuploaddownloadfilePost; +import org.openapijsonschematools.client.paths.fakeuploaddownloadfile.post.FakeuploaddownloadfilePostResponses; + +import java.io.IOException; +import java.util.Arrays; +import java.util.List; +import java.util.Map; +import java.util.AbstractMap; + +// if you want to use a server that is not SERVER_0 pass it in here and change the ServerIndex input below +ApiConfiguration.ServerInfo serverInfo = new ApiConfiguration.ServerInfoBuilder() + .rootServerInfo( + new RootServerInfo.RootServerInfoBuilder() + .rootServer0(new RootServer0()) + .build() + ) + .build(); +ApiConfiguration.ServerIndexInfo serverIndexInfo = new ApiConfiguration.ServerIndexInfoBuilder() + .rootServerInfoServerIndex(RootServerInfo.ServerIndex.SERVER_0) + .build(); +Duration timeout = Duration.ofSeconds(1L); +Map> defaultHeaders = Map.of("User-Agent", List.of("OpenAPI-JSON-Schema-Generator/1.0.0/java")); +ApiConfiguration apiConfiguration = new ApiConfiguration( + serverInfo + serverIndexInfo, + timeout, + defaultHeaders +); +SchemaConfiguration schemaConfiguration = new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().build()); +FakeuploaddownloadfilePost.Post apiClient = new FakeuploaddownloadfilePost.Post(apiConfiguration, schemaConfiguration); + + +ApplicationoctetstreamSchema1BoxedString requestBodyPayload = ApplicationoctetstreamSchema.ApplicationoctetstreamSchema1.validateAndBox( + "a", + schemaConfiguration +); +FakeuploaddownloadfilePost.SealedRequestBody requestBody = new FakeuploaddownloadfilePost.ApplicationoctetstreamRequestBody(requestBodyPayload); + +var request = new FakeuploaddownloadfilePost.PostRequestBuilder() + .requestBody(requestBody) + .build(); + +FakeuploaddownloadfilePostResponses.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; +} +FakeuploaddownloadfilePostResponses.EndpointFakeuploaddownloadfilePostCode200Response castResponse = (FakeuploaddownloadfilePostResponses.EndpointFakeuploaddownloadfilePostCode200Response) response; +FakeuploaddownloadfilePostCode200Response.ApplicationoctetstreamResponseBody deserializedBody = (FakeuploaddownloadfilePostCode200Response.ApplicationoctetstreamResponseBody) castResponse.body; +// handle deserialized body here +``` +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| Post(ApiConfiguration apiConfiguration, SchemaConfiguration schemaConfiguration)
Creates an instance | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| [FakeuploaddownloadfilePostResponses.EndpointResponse](../../paths/fakeuploaddownloadfile/post/FakeuploaddownloadfilePostResponses.md#endpointresponse) | post([PostRequest](#postrequest) request) | + +## UploadDownloadFileOperation +public interface UploadDownloadFileOperation
+ +an interface that allows one to call the endpoint using a method named uploadDownloadFile by the operationId + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| [FakeuploaddownloadfilePostResponses.EndpointResponse](../../paths/fakeuploaddownloadfile/post/FakeuploaddownloadfilePostResponses.md#endpointresponse) | uploadDownloadFile([PostRequest](#postrequest) request) | + +## PostRequest +public static class PostRequest
+ +a class that stores the final request inputs + +### Field Summary +| Modifier and Type | Field and Description | +| ----------------- | --------------------- | +| [FakeuploaddownloadfilePostRequestBody.SealedRequestBody](../../paths/fakeuploaddownloadfile/post/FakeuploaddownloadfilePostRequestBody.md#sealedrequestbody) | requestBody | +| [RootServerInfo.@Nullable ServerIndex](../../RootServerInfo.md#serverindex) | serverIndex
optional. Note: this will override the value in apiConfiguration | +| @Nullable Duration | timeout
optional. Note: this will override the value in apiConfiguration | + +## PostNullableRequest +public static class PostNullableRequest
+ +a class that stores the initial request inputs + +### Field Summary +| Modifier and Type | Field and Description | +| ----------------- | --------------------- | +| [FakeuploaddownloadfilePostRequestBody.@Nullable SealedRequestBody](../../paths/fakeuploaddownloadfile/post/FakeuploaddownloadfilePostRequestBody.md#sealedrequestbody) | requestBody | +| [RootServerInfo.@Nullable ServerIndex](../../RootServerInfo.md#serverindex) | serverIndex | +| @Nullable Duration | timeout | + +## Post0RequestBuilder +public static class Post0RequestBuilder
+ +a builder for request inputs + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| Post0RequestBuilder(Post0RequestBuilder instance)
Creates a builder that contains the passed instance | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| [PostRequest](#postrequest) | build()
Returns the request input used to call an endpoint method | +| [Post0RequestBuilder](#post0requestbuilder) | serverIndex([RootServerInfo.ServerIndex](../../RootServerInfo.md#serverindex) serverIndex)
sets the optional property. Note: this will override the value in apiConfiguration | +| [Post0RequestBuilder](#post0requestbuilder) | timeout(Duration timeout)
sets the optional property. Note: this will override the value in apiConfiguration | + +## PostRequestBuilder +public static class PostRequestBuilder
+ +a builder for request inputs + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| PostRequestBuilder()
Creates a builder that contains null for all parameters | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| [Post0RequestBuilder](#post0requestbuilder) | requestBody([FakeuploaddownloadfilePostRequestBody.SealedRequestBody](../../paths/fakeuploaddownloadfile/post/FakeuploaddownloadfilePostRequestBody.md#sealedrequestbody) requestBody)
sets the property | + +[[Back to top]](#top) [[Back to README]](../../../README.md) diff --git a/samples/client/petstore/kotlin/docs/paths/fakeuploaddownloadfile/post/FakeuploaddownloadfilePostRequestBody.md b/samples/client/petstore/kotlin/docs/paths/fakeuploaddownloadfile/post/FakeuploaddownloadfilePostRequestBody.md new file mode 100644 index 00000000000..cf48f85a1f1 --- /dev/null +++ b/samples/client/petstore/kotlin/docs/paths/fakeuploaddownloadfile/post/FakeuploaddownloadfilePostRequestBody.md @@ -0,0 +1,90 @@ +# FakeuploaddownloadfilePostRequestBody + +public class FakeuploaddownloadfilePostRequestBody + +A class that contains necessary nested request body classes +- SealedMediaType, a sealed interface which contains all the schema/encoding info for each contentType +- records which implement SealedMediaType, the concrete media types +- a class that extends RequestBodySerializer and is used to serialize input SealedRequestBody instances +- SealedRequestBody, a sealed interface which contains all the contentType/schema input types +- records which implement SealedRequestBody, the concrete request body types + +## Nested Class Summary +| Modifier and Type | Class and Description | +| ----------------- | --------------------- | +| sealed interface | [FakeuploaddownloadfilePostRequestBody.SealedMediaType](#sealedmediatype)
media type sealed interface | +| record | [FakeuploaddownloadfilePostRequestBody.ApplicationoctetstreamMediaType](#applicationoctetstreammediatype)
record storing schema + encoding for a specific contentType | +| static class | [FakeuploaddownloadfilePostRequestBody.FakeuploaddownloadfilePostRequestBody1](#fakeuploaddownloadfilepostrequestbody1)
class that serializes request bodies | +| sealed interface | [FakeuploaddownloadfilePostRequestBody.SealedRequestBody](#sealedrequestbody)
request body sealed interface | +| record | [FakeuploaddownloadfilePostRequestBody.ApplicationoctetstreamRequestBody](#applicationoctetstreamrequestbody)
implements sealed interface to store request body input | + +## SealedMediaType +public sealed interface SealedMediaType
+permits
+[ApplicationoctetstreamMediaType](#applicationoctetstreammediatype) + +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), Nothing?> + +class storing schema info for a specific contentType + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| ApplicationoctetstreamMediaType()
Creates an instance | + +### 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 | +| Nothing? | encoding()
the encoding info | + +## FakeuploaddownloadfilePostRequestBody1 +public static class FakeuploaddownloadfilePostRequestBody1
+ +a class that serializes SealedRequestBody request bodies + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| FakeuploaddownloadfilePostRequestBody1()
Creates an instance | + +### Field Summary +| Modifier and Type | Field and Description | +| ----------------- | --------------------- | +| boolean | required = true
whether the request body is required | +| Map | content = Map.ofEntries(
    new AbstractMap.SimpleEntry<>("application/octet-stream", new [ApplicationoctetstreamMediaType](#applicationoctetstreammediatype)())
)
the contentType to schema info | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| SerializedRequestBody | serialize([SealedRequestBody](#sealedrequestbody) requestBody)
called by endpoint when creating request body bytes | + +## SealedRequestBody +public sealed interface SealedRequestBody
+permits
+[ApplicationoctetstreamRequestBody](#applicationoctetstreamrequestbody) + +sealed interface that stores request contentType + validated schema data + +## ApplicationoctetstreamRequestBody +public record ApplicationoctetstreamRequestBody
+implements [SealedRequestBody](#sealedrequestbody),
+GenericRequestBody
+ +A record class to store request body input for contentType="application/octet-stream" + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| ApplicationoctetstreamRequestBody(ApplicationoctetstreamSchema.StringJsonSchema1Boxed body)
Creates an instance | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| String | contentType()
always returns "application/octet-stream" | +| ApplicationoctetstreamSchema.StringJsonSchema1Boxed | body()
returns the body passed in in the constructor | diff --git a/samples/client/petstore/kotlin/docs/paths/fakeuploaddownloadfile/post/FakeuploaddownloadfilePostResponses.md b/samples/client/petstore/kotlin/docs/paths/fakeuploaddownloadfile/post/FakeuploaddownloadfilePostResponses.md new file mode 100644 index 00000000000..1bf87111739 --- /dev/null +++ b/samples/client/petstore/kotlin/docs/paths/fakeuploaddownloadfile/post/FakeuploaddownloadfilePostResponses.md @@ -0,0 +1,29 @@ +# FakeuploaddownloadfilePostResponses + +public class FakeuploaddownloadfilePostResponses + +A class that contains necessary responses classes +- a sealed interface, EndpointResponse, that stores endpoint responses +- records for each endpoint response + +## Nested Class Summary +| Modifier and Type | Class and Description | +| ----------------- | --------------------- | +| sealed interface | [EndpointResponse](#endpointresponse)
stores the endpoint responses | +| record | [EndpointFakeuploaddownloadfilePostCode200Response](#endpointfakeuploaddownloadfilepostcode200response)
the response for 200 | + +## EndpointResponse +public sealed interface EndpointResponse permits
+[EndpointFakeuploaddownloadfilePostCode200Response](#endpointfakeuploaddownloadfilepostcode200response) + +a sealed interface that stores endpoint responses + +## EndpointFakeuploaddownloadfilePostCode200Response +public record EndpointFakeuploaddownloadfilePostCode200Response( + HttpResponse response, + [FakeuploaddownloadfilePostCode200Response.SealedResponseBody](../../../paths/fakeuploaddownloadfile/post/responses/FakeuploaddownloadfilePostCode200Response.md#sealedresponsebody) body, + Nothing? headers +) implements EndpointResponse, ApiResponse
+ +a class that stores an endpoint response + diff --git a/samples/client/petstore/kotlin/docs/paths/fakeuploaddownloadfile/post/requestbody/content/applicationoctetstream/ApplicationoctetstreamSchema.md b/samples/client/petstore/kotlin/docs/paths/fakeuploaddownloadfile/post/requestbody/content/applicationoctetstream/ApplicationoctetstreamSchema.md new file mode 100644 index 00000000000..757329e0634 --- /dev/null +++ b/samples/client/petstore/kotlin/docs/paths/fakeuploaddownloadfile/post/requestbody/content/applicationoctetstream/ApplicationoctetstreamSchema.md @@ -0,0 +1,28 @@ +# ApplicationoctetstreamSchema +public class ApplicationoctetstreamSchema
+ +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 + +## Nested Class Summary +| Modifier and Type | Class and Description | +| ----------------- | ---------------------- | +| sealed interface | [ApplicationoctetstreamSchema.ApplicationoctetstreamSchema1Boxed](#applicationoctetstreamschema1boxed)
sealed interface for validated payloads | +| static class | [ApplicationoctetstreamSchema.ApplicationoctetstreamSchema1](#applicationoctetstreamschema1)
schema class | + +## ApplicationoctetstreamSchema1Boxed +public sealed interface ApplicationoctetstreamSchema1Boxed
+permits
+ +sealed interface that stores validated payloads using boxed classes + +## ApplicationoctetstreamSchema1 +public static class ApplicationoctetstreamSchema1
+extends JsonSchema + +A schema class that validates payloads + +## Description +file to upload diff --git a/samples/client/petstore/kotlin/docs/paths/fakeuploaddownloadfile/post/responses/FakeuploaddownloadfilePostCode200Response.md b/samples/client/petstore/kotlin/docs/paths/fakeuploaddownloadfile/post/responses/FakeuploaddownloadfilePostCode200Response.md new file mode 100644 index 00000000000..7d8c5c4b14c --- /dev/null +++ b/samples/client/petstore/kotlin/docs/paths/fakeuploaddownloadfile/post/responses/FakeuploaddownloadfilePostCode200Response.md @@ -0,0 +1,87 @@ +# FakeuploaddownloadfilePostCode200Response + +public class FakeuploaddownloadfilePostCode200Response + +A class that contains necessary nested response classes +- SealedMediaType, a sealed interface which contains all the schema/encoding info for each contentType +- records which implement SealedMediaType, the concrete media types +- SealedResponseBody, a sealed interface which contains all the contentType/schema types +- records which implement SealedResponseBody, the concrete response body types +- a class that extends ResponseDeserializer and is used to deserialize responses + +## Nested Class Summary +| Modifier and Type | Class and Description | +| ----------------- | --------------------- | +| sealed interface | [FakeuploaddownloadfilePostCode200Response.SealedMediaType](#sealedmediatype)
media type sealed interface | +| record | [FakeuploaddownloadfilePostCode200Response.ApplicationoctetstreamMediaType](#applicationoctetstreammediatype)
record storing schema + encoding for a specific contentType | +| sealed interface | [FakeuploaddownloadfilePostCode200Response.SealedResponseBody](#sealedresponsebody)
response body sealed interface | +| record | [FakeuploaddownloadfilePostCode200Response.ApplicationoctetstreamResponseBody](#applicationoctetstreamresponsebody)
implements sealed interface to store response body | +| static class | [FakeuploaddownloadfilePostCode200Response.FakeuploaddownloadfilePostCode200Response1](#fakeuploaddownloadfilepostcode200response1)
class that deserializes responses | + +## SealedMediaType +public sealed interface SealedMediaType
+permits
+[ApplicationoctetstreamMediaType](#applicationoctetstreammediatype) + +sealed interface that stores schema and encoding info + +## ApplicationoctetstreamMediaType +public record ApplicationoctetstreamMediaType
+implements [SealedMediaType](#sealedmediatype), MediaType<[ApplicationoctetstreamSchema.ApplicationoctetstreamSchema1](../../../../paths/fakeuploaddownloadfile/post/responses/code200response/content/applicationoctetstream/ApplicationoctetstreamSchema.md#applicationoctetstreamschema1), Nothing?> + +class storing schema info for a specific contentType + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| ApplicationoctetstreamMediaType()
Creates an instance | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| [ApplicationoctetstreamSchema.ApplicationoctetstreamSchema1](../../../../paths/fakeuploaddownloadfile/post/responses/code200response/content/applicationoctetstream/ApplicationoctetstreamSchema.md#applicationoctetstreamschema1) | schema()
the schema for this MediaType | +| Nothing? | encoding()
the encoding info | + +## SealedResponseBody +public sealed interface SealedResponseBody
+permits
+[ApplicationoctetstreamResponseBody](#applicationoctetstreamresponsebody) + +sealed interface that stores response body + +## ApplicationoctetstreamResponseBody +public record ApplicationoctetstreamResponseBody
+implements [SealedResponseBody](#sealedresponsebody) + +A record class to store response body for contentType="application/octet-stream" + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| ApplicationoctetstreamResponseBody(ApplicationoctetstreamSchema.StringJsonSchema1Boxed body)
Creates an instance | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| ApplicationoctetstreamSchema.StringJsonSchema1Boxed | body()
returns the body passed in in the constructor | + +## FakeuploaddownloadfilePostCode200Response1 +public static class FakeuploaddownloadfilePostCode200Response1
+extends ResponseDeserializer<[SealedResponseBody](#sealedresponsebody), Nothing?, [SealedMediaType](#sealedmediatype)> + +a class that deserializes responses + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| FakeuploaddownloadfilePostCode200Response1()
Creates an instance | + +### Field Summary +| Modifier and Type | Field and Description | +| ----------------- | --------------------- | +| Map | content = Map.ofEntries(
    new AbstractMap.SimpleEntry<>("application/octet-stream", new [ApplicationoctetstreamMediaType](#applicationoctetstreammediatype)())
)
the contentType to schema info | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| ApiResponse<[SealedResponseBody](#sealedresponsebody), Nothing?> | deserialize(HttpResponse response, SchemaConfiguration configuration)
called by endpoint when deserialize responses | diff --git a/samples/client/petstore/kotlin/docs/paths/fakeuploaddownloadfile/post/responses/code200response/content/applicationoctetstream/ApplicationoctetstreamSchema.md b/samples/client/petstore/kotlin/docs/paths/fakeuploaddownloadfile/post/responses/code200response/content/applicationoctetstream/ApplicationoctetstreamSchema.md new file mode 100644 index 00000000000..c1498d3a5a3 --- /dev/null +++ b/samples/client/petstore/kotlin/docs/paths/fakeuploaddownloadfile/post/responses/code200response/content/applicationoctetstream/ApplicationoctetstreamSchema.md @@ -0,0 +1,28 @@ +# ApplicationoctetstreamSchema +public class ApplicationoctetstreamSchema
+ +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 + +## Nested Class Summary +| Modifier and Type | Class and Description | +| ----------------- | ---------------------- | +| sealed interface | [ApplicationoctetstreamSchema.ApplicationoctetstreamSchema1Boxed](#applicationoctetstreamschema1boxed)
sealed interface for validated payloads | +| static class | [ApplicationoctetstreamSchema.ApplicationoctetstreamSchema1](#applicationoctetstreamschema1)
schema class | + +## ApplicationoctetstreamSchema1Boxed +public sealed interface ApplicationoctetstreamSchema1Boxed
+permits
+ +sealed interface that stores validated payloads using boxed classes + +## ApplicationoctetstreamSchema1 +public static class ApplicationoctetstreamSchema1
+extends JsonSchema + +A schema class that validates payloads + +## Description +file to download diff --git a/samples/client/petstore/kotlin/docs/paths/fakeuploadfile/FakeuploadfilePost.md b/samples/client/petstore/kotlin/docs/paths/fakeuploadfile/FakeuploadfilePost.md new file mode 100644 index 00000000000..aeb3fc0520d --- /dev/null +++ b/samples/client/petstore/kotlin/docs/paths/fakeuploadfile/FakeuploadfilePost.md @@ -0,0 +1,148 @@ +# FakeuploadfilePost + +public class FakeuploadfilePost + +A class that contains necessary endpoint classes +- a class that calls the endpoint method using the http verb +- a class that calls the endpoint method using the operationId name +- class(es) to store the request inputs +- builder(s) to set the request input data + +## Nested Class Summary +| Modifier and Type | Class and Description | +| ----------------- | --------------------- | +| static class | [Post](#post)
The class that has a post method to call the endpoint | +| interface | [UploadFileOperation](#uploadfileoperation)
The interface that has a uploadFile method to call the endpoint | +| static class | [PostRequest](#postrequest)
The request inputs class | +| static class | [PostRequestBuilder](#postrequestbuilder)
A builder for the request input class | + +## Post +public static class Post 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.FakeuploadfilePostRequestBody; +import org.openapijsonschematools.client.paths.fakeuploadfile.post.requestbody.content.multipartformdata.MultipartformdataSchema; +import org.openapijsonschematools.client.RootServerInfo; +import org.openapijsonschematools.client.servers.RootServer0; +import org.openapijsonschematools.client.servers.RootServer1; +import org.openapijsonschematools.client.servers.RootServer2; +import org.openapijsonschematools.client.paths.fakeuploadfile.post.responses.FakeuploadfilePostCode200Response; +import org.openapijsonschematools.client.servers.RootServerInfo; +import org.openapijsonschematools.client.paths.fakeuploadfile.FakeuploadfilePost; +import org.openapijsonschematools.client.paths.fakeuploadfile.post.FakeuploadfilePostResponses; + +import java.io.IOException; +import java.util.Arrays; +import java.util.List; +import java.util.Map; +import java.util.AbstractMap; + +// if you want to use a server that is not SERVER_0 pass it in here and change the ServerIndex input below +ApiConfiguration.ServerInfo serverInfo = new ApiConfiguration.ServerInfoBuilder() + .rootServerInfo( + new RootServerInfo.RootServerInfoBuilder() + .rootServer0(new RootServer0()) + .build() + ) + .build(); +ApiConfiguration.ServerIndexInfo serverIndexInfo = new ApiConfiguration.ServerIndexInfoBuilder() + .rootServerInfoServerIndex(RootServerInfo.ServerIndex.SERVER_0) + .build(); +Duration timeout = Duration.ofSeconds(1L); +Map> defaultHeaders = Map.of("User-Agent", List.of("OpenAPI-JSON-Schema-Generator/1.0.0/java")); +ApiConfiguration apiConfiguration = new ApiConfiguration( + serverInfo + serverIndexInfo, + timeout, + defaultHeaders +); +SchemaConfiguration schemaConfiguration = new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().build()); +FakeuploadfilePost.Post apiClient = new FakeuploadfilePost.Post(apiConfiguration, schemaConfiguration); + + +var request = new FakeuploadfilePost.PostRequestBuilder().build(); + +FakeuploadfilePostResponses.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; +} +FakeuploadfilePostResponses.EndpointFakeuploadfilePostCode200Response castResponse = (FakeuploadfilePostResponses.EndpointFakeuploadfilePostCode200Response) response; +FakeuploadfilePostCode200Response.ApplicationjsonResponseBody deserializedBody = (FakeuploadfilePostCode200Response.ApplicationjsonResponseBody) castResponse.body; +// handle deserialized body here +``` +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| Post(ApiConfiguration apiConfiguration, SchemaConfiguration schemaConfiguration)
Creates an instance | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| [FakeuploadfilePostResponses.EndpointResponse](../../paths/fakeuploadfile/post/FakeuploadfilePostResponses.md#endpointresponse) | post([PostRequest](#postrequest) request) | + +## UploadFileOperation +public interface UploadFileOperation
+ +an interface that allows one to call the endpoint using a method named uploadFile by the operationId + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| [FakeuploadfilePostResponses.EndpointResponse](../../paths/fakeuploadfile/post/FakeuploadfilePostResponses.md#endpointresponse) | uploadFile([PostRequest](#postrequest) request) | + +## PostRequest +public static class PostRequest
+ +a class that stores the final request inputs + +### Field Summary +| Modifier and Type | Field and Description | +| ----------------- | --------------------- | +| [FakeuploadfilePostRequestBody.@Nullable SealedRequestBody](../../paths/fakeuploadfile/post/FakeuploadfilePostRequestBody.md#sealedrequestbody) | requestBody
optional | +| [RootServerInfo.@Nullable ServerIndex](../../RootServerInfo.md#serverindex) | serverIndex
optional. Note: this will override the value in apiConfiguration | +| @Nullable Duration | timeout
optional. Note: this will override the value in apiConfiguration | + +## PostRequestBuilder +public static class PostRequestBuilder
+ +a builder for request inputs + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| PostRequestBuilder()
Creates a builder that contains null for all parameters | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| [PostRequest](#postrequest) | build()
Returns the request input used to call an endpoint method | +| [PostRequestBuilder](#postrequestbuilder) | requestBody([FakeuploadfilePostRequestBody.SealedRequestBody](../../paths/fakeuploadfile/post/FakeuploadfilePostRequestBody.md#sealedrequestbody) requestBody)
sets the optional property | +| [PostRequestBuilder](#postrequestbuilder) | serverIndex([RootServerInfo.ServerIndex](../../RootServerInfo.md#serverindex) serverIndex)
sets the optional property. Note: this will override the value in apiConfiguration | +| [PostRequestBuilder](#postrequestbuilder) | timeout(Duration timeout)
sets the optional property. Note: this will override the value in apiConfiguration | + +[[Back to top]](#top) [[Back to README]](../../../README.md) diff --git a/samples/client/petstore/kotlin/docs/paths/fakeuploadfile/post/FakeuploadfilePostRequestBody.md b/samples/client/petstore/kotlin/docs/paths/fakeuploadfile/post/FakeuploadfilePostRequestBody.md new file mode 100644 index 00000000000..b5a1ed59013 --- /dev/null +++ b/samples/client/petstore/kotlin/docs/paths/fakeuploadfile/post/FakeuploadfilePostRequestBody.md @@ -0,0 +1,90 @@ +# FakeuploadfilePostRequestBody + +public class FakeuploadfilePostRequestBody + +A class that contains necessary nested request body classes +- SealedMediaType, a sealed interface which contains all the schema/encoding info for each contentType +- records which implement SealedMediaType, the concrete media types +- a class that extends RequestBodySerializer and is used to serialize input SealedRequestBody instances +- SealedRequestBody, a sealed interface which contains all the contentType/schema input types +- records which implement SealedRequestBody, the concrete request body types + +## Nested Class Summary +| Modifier and Type | Class and Description | +| ----------------- | --------------------- | +| sealed interface | [FakeuploadfilePostRequestBody.SealedMediaType](#sealedmediatype)
media type sealed interface | +| record | [FakeuploadfilePostRequestBody.MultipartformdataMediaType](#multipartformdatamediatype)
record storing schema + encoding for a specific contentType | +| static class | [FakeuploadfilePostRequestBody.FakeuploadfilePostRequestBody1](#fakeuploadfilepostrequestbody1)
class that serializes request bodies | +| sealed interface | [FakeuploadfilePostRequestBody.SealedRequestBody](#sealedrequestbody)
request body sealed interface | +| record | [FakeuploadfilePostRequestBody.MultipartformdataRequestBody](#multipartformdatarequestbody)
implements sealed interface to store request body input | + +## SealedMediaType +public sealed interface SealedMediaType
+permits
+[MultipartformdataMediaType](#multipartformdatamediatype) + +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), Nothing?> + +class storing schema info for a specific contentType + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| MultipartformdataMediaType()
Creates an instance | + +### 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 | +| Nothing? | encoding()
the encoding info | + +## FakeuploadfilePostRequestBody1 +public static class FakeuploadfilePostRequestBody1
+ +a class that serializes SealedRequestBody request bodies + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| FakeuploadfilePostRequestBody1()
Creates an instance | + +### Field Summary +| Modifier and Type | Field and Description | +| ----------------- | --------------------- | +| boolean | required = false
whether the request body is required | +| Map | content = Map.ofEntries(
    new AbstractMap.SimpleEntry<>("multipart/form-data", new [MultipartformdataMediaType](#multipartformdatamediatype)())
)
the contentType to schema info | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| SerializedRequestBody | serialize([SealedRequestBody](#sealedrequestbody) requestBody)
called by endpoint when creating request body bytes | + +## SealedRequestBody +public sealed interface SealedRequestBody
+permits
+[MultipartformdataRequestBody](#multipartformdatarequestbody) + +sealed interface that stores request contentType + validated schema data + +## MultipartformdataRequestBody +public record MultipartformdataRequestBody
+implements [SealedRequestBody](#sealedrequestbody),
+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 | + +### 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 | diff --git a/samples/client/petstore/kotlin/docs/paths/fakeuploadfile/post/FakeuploadfilePostResponses.md b/samples/client/petstore/kotlin/docs/paths/fakeuploadfile/post/FakeuploadfilePostResponses.md new file mode 100644 index 00000000000..e55284be383 --- /dev/null +++ b/samples/client/petstore/kotlin/docs/paths/fakeuploadfile/post/FakeuploadfilePostResponses.md @@ -0,0 +1,29 @@ +# FakeuploadfilePostResponses + +public class FakeuploadfilePostResponses + +A class that contains necessary responses classes +- a sealed interface, EndpointResponse, that stores endpoint responses +- records for each endpoint response + +## Nested Class Summary +| Modifier and Type | Class and Description | +| ----------------- | --------------------- | +| sealed interface | [EndpointResponse](#endpointresponse)
stores the endpoint responses | +| record | [EndpointFakeuploadfilePostCode200Response](#endpointfakeuploadfilepostcode200response)
the response for 200 | + +## EndpointResponse +public sealed interface EndpointResponse permits
+[EndpointFakeuploadfilePostCode200Response](#endpointfakeuploadfilepostcode200response) + +a sealed interface that stores endpoint responses + +## EndpointFakeuploadfilePostCode200Response +public record EndpointFakeuploadfilePostCode200Response( + HttpResponse response, + [FakeuploadfilePostCode200Response.SealedResponseBody](../../../paths/fakeuploadfile/post/responses/FakeuploadfilePostCode200Response.md#sealedresponsebody) body, + Nothing? headers +) implements EndpointResponse, ApiResponse
+ +a class that stores an endpoint response + diff --git a/samples/client/petstore/kotlin/docs/paths/fakeuploadfile/post/requestbody/content/multipartformdata/MultipartformdataSchema.md b/samples/client/petstore/kotlin/docs/paths/fakeuploadfile/post/requestbody/content/multipartformdata/MultipartformdataSchema.md new file mode 100644 index 00000000000..a34c929dfcb --- /dev/null +++ b/samples/client/petstore/kotlin/docs/paths/fakeuploadfile/post/requestbody/content/multipartformdata/MultipartformdataSchema.md @@ -0,0 +1,206 @@ +# MultipartformdataSchema +public class MultipartformdataSchema
+ +A class that contains necessary nested +- schema classes (which validate payloads), extends JsonSchema +- sealed interfaces which store validated payloads, java version of a sum type +- boxed classes which store validated payloads, sealed permits class implementations +- classes to store validated map payloads, extends FrozenMap +- classes to build inputs for map payloads + +## Nested Class Summary +| Modifier and Type | Class and Description | +| ----------------- | ---------------------- | +| sealed interface | [MultipartformdataSchema.MultipartformdataSchema1Boxed](#multipartformdataschema1boxed)
sealed interface for validated payloads | +| record | [MultipartformdataSchema.MultipartformdataSchema1BoxedMap](#multipartformdataschema1boxedmap)
boxed class to store validated Map payloads | +| static class | [MultipartformdataSchema.MultipartformdataSchema1](#multipartformdataschema1)
schema class | +| static class | [MultipartformdataSchema.MultipartformdataSchemaMapBuilder](#multipartformdataschemamapbuilder)
builder for Map payloads | +| static class | [MultipartformdataSchema.MultipartformdataSchemaMap](#multipartformdataschemamap)
output class for Map payloads | +| sealed interface | [MultipartformdataSchema.MultipartformdataFileBoxed](#multipartformdatafileboxed)
sealed interface for validated payloads | +| static class | [MultipartformdataSchema.MultipartformdataFile](#multipartformdatafile)
schema class | +| sealed interface | [MultipartformdataSchema.MultipartformdataAdditionalMetadataBoxed](#multipartformdataadditionalmetadataboxed)
sealed interface for validated payloads | +| record | [MultipartformdataSchema.MultipartformdataAdditionalMetadataBoxedString](#multipartformdataadditionalmetadataboxedstring)
boxed class to store validated String payloads | +| static class | [MultipartformdataSchema.MultipartformdataAdditionalMetadata](#multipartformdataadditionalmetadata)
schema class | + +## MultipartformdataSchema1Boxed +public sealed interface MultipartformdataSchema1Boxed
+permits
+[MultipartformdataSchema1BoxedMap](#multipartformdataschema1boxedmap) + +sealed interface that stores validated payloads using boxed classes + +## MultipartformdataSchema1BoxedMap +public record MultipartformdataSchema1BoxedMap
+implements [MultipartformdataSchema1Boxed](#multipartformdataschema1boxed) + +record that stores validated Map payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| MultipartformdataSchema1BoxedMap([MultipartformdataSchemaMap](#multipartformdataschemamap) data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| [MultipartformdataSchemaMap](#multipartformdataschemamap) | data()
validated payload | +| @Nullable Object | getData()
validated payload | + +## MultipartformdataSchema1 +public static class MultipartformdataSchema1
+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.fakeuploadfile.post.requestbody.content.multipartformdata.MultipartformdataSchema; + +import java.util.Arrays; +import java.util.List; +import java.util.AbstractMap; + +static final SchemaConfiguration configuration = new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().build()); + +// Map validation +MultipartformdataSchema.MultipartformdataSchemaMap validatedPayload = + MultipartformdataSchema.MultipartformdataSchema1.validate( + new MultipartformdataSchema.MultipartformdataSchemaMapBuilder() + .file("a") + + .additionalMetadata("a") + + .build(), + configuration +); +``` + +### Field Summary +| Modifier and Type | Field and Description | +| ----------------- | ---------------------- | +| Set> | type = Set.of(Map.class) | +| Map> | properties = Map.ofEntries(
    new PropertyEntry("additionalMetadata", [MultipartformdataAdditionalMetadata.class](#multipartformdataadditionalmetadata))),
    new PropertyEntry("file", [MultipartformdataFile.class](#multipartformdatafile)))
)
| +| Set | required = Set.of(
    "file"
)
| + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| [MultipartformdataSchemaMap](#multipartformdataschemamap) | validate([Map<?, ?>](#multipartformdataschemamapbuilder) arg, SchemaConfiguration configuration) | +| [MultipartformdataSchema1BoxedMap](#multipartformdataschema1boxedmap) | validateAndBox([Map<?, ?>](#multipartformdataschemamapbuilder) arg, SchemaConfiguration configuration) | +| [MultipartformdataSchema1Boxed](#multipartformdataschema1boxed) | validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) | +| @Nullable Object | validate(@Nullable Object arg, SchemaConfiguration configuration) | + +## MultipartformdataSchemaMap0Builder +public class MultipartformdataSchemaMap0Builder
+builder for `Map` + +A class that builds the Map input type + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| MultipartformdataSchemaMap0Builder(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 | +| [MultipartformdataSchemaMap0Builder](#multipartformdataschemamap0builder) | additionalMetadata(String value) | +| [MultipartformdataSchemaMap0Builder](#multipartformdataschemamap0builder) | additionalProperty(String key, Nothing? value) | +| [MultipartformdataSchemaMap0Builder](#multipartformdataschemamap0builder) | additionalProperty(String key, boolean value) | +| [MultipartformdataSchemaMap0Builder](#multipartformdataschemamap0builder) | additionalProperty(String key, String value) | +| [MultipartformdataSchemaMap0Builder](#multipartformdataschemamap0builder) | additionalProperty(String key, int value) | +| [MultipartformdataSchemaMap0Builder](#multipartformdataschemamap0builder) | additionalProperty(String key, float value) | +| [MultipartformdataSchemaMap0Builder](#multipartformdataschemamap0builder) | additionalProperty(String key, long value) | +| [MultipartformdataSchemaMap0Builder](#multipartformdataschemamap0builder) | additionalProperty(String key, double value) | +| [MultipartformdataSchemaMap0Builder](#multipartformdataschemamap0builder) | additionalProperty(String key, List value) | +| [MultipartformdataSchemaMap0Builder](#multipartformdataschemamap0builder) | additionalProperty(String key, Map value) | + +## MultipartformdataSchemaMapBuilder +public class MultipartformdataSchemaMapBuilder
+builder for `Map` + +A class that builds the Map input type + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| MultipartformdataSchemaMapBuilder()
Creates a builder that contains an empty map | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| [MultipartformdataSchemaMap0Builder](#multipartformdataschemamap0builder) | file(String value) | + +## MultipartformdataSchemaMap +public static class MultipartformdataSchemaMap
+extends FrozenMap + +A class to store validated Map payloads + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| static [MultipartformdataSchemaMap](#multipartformdataschemamap) | of([Map](#multipartformdataschemamapbuilder) arg, SchemaConfiguration configuration) | +| String | file()
| +| String | additionalMetadata()
[optional] | +| @Nullable Object | getAdditionalProperty(String name)
provides type safety for additional properties | + +## MultipartformdataFileBoxed +public sealed interface MultipartformdataFileBoxed
+permits
+ +sealed interface that stores validated payloads using boxed classes + +## MultipartformdataFile +public static class MultipartformdataFile
+extends JsonSchema + +A schema class that validates payloads + +## Description +file to upload + +## MultipartformdataAdditionalMetadataBoxed +public sealed interface MultipartformdataAdditionalMetadataBoxed
+permits
+[MultipartformdataAdditionalMetadataBoxedString](#multipartformdataadditionalmetadataboxedstring) + +sealed interface that stores validated payloads using boxed classes + +## MultipartformdataAdditionalMetadataBoxedString +public record MultipartformdataAdditionalMetadataBoxedString
+implements [MultipartformdataAdditionalMetadataBoxed](#multipartformdataadditionalmetadataboxed) + +record that stores validated String payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| MultipartformdataAdditionalMetadataBoxedString(String data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| String | data()
validated payload | +| @Nullable Object | getData()
validated payload | + +## MultipartformdataAdditionalMetadata +public static class MultipartformdataAdditionalMetadata
+extends StringJsonSchema.StringJsonSchema1 + +A schema class that validates payloads + +## Description +Additional data to pass to server + +| Methods Inherited from class org.openapijsonschematools.client.schemas.StringJsonSchema.StringJsonSchema1 | +| ------------------------------------------------------------------ | +| validate | +| validateAndBox | diff --git a/samples/client/petstore/kotlin/docs/paths/fakeuploadfile/post/responses/FakeuploadfilePostCode200Response.md b/samples/client/petstore/kotlin/docs/paths/fakeuploadfile/post/responses/FakeuploadfilePostCode200Response.md new file mode 100644 index 00000000000..b26fdd70404 --- /dev/null +++ b/samples/client/petstore/kotlin/docs/paths/fakeuploadfile/post/responses/FakeuploadfilePostCode200Response.md @@ -0,0 +1,87 @@ +# FakeuploadfilePostCode200Response + +public class FakeuploadfilePostCode200Response + +A class that contains necessary nested response classes +- SealedMediaType, a sealed interface which contains all the schema/encoding info for each contentType +- records which implement SealedMediaType, the concrete media types +- SealedResponseBody, a sealed interface which contains all the contentType/schema types +- records which implement SealedResponseBody, the concrete response body types +- a class that extends ResponseDeserializer and is used to deserialize responses + +## Nested Class Summary +| Modifier and Type | Class and Description | +| ----------------- | --------------------- | +| sealed interface | [FakeuploadfilePostCode200Response.SealedMediaType](#sealedmediatype)
media type sealed interface | +| record | [FakeuploadfilePostCode200Response.ApplicationjsonMediaType](#applicationjsonmediatype)
record storing schema + encoding for a specific contentType | +| sealed interface | [FakeuploadfilePostCode200Response.SealedResponseBody](#sealedresponsebody)
response body sealed interface | +| record | [FakeuploadfilePostCode200Response.ApplicationjsonResponseBody](#applicationjsonresponsebody)
implements sealed interface to store response body | +| static class | [FakeuploadfilePostCode200Response.FakeuploadfilePostCode200Response1](#fakeuploadfilepostcode200response1)
class that deserializes responses | + +## SealedMediaType +public sealed interface SealedMediaType
+permits
+[ApplicationjsonMediaType](#applicationjsonmediatype) + +sealed interface that stores schema and encoding info + +## ApplicationjsonMediaType +public record ApplicationjsonMediaType
+implements [SealedMediaType](#sealedmediatype), MediaType<[ApplicationjsonSchema.ApplicationjsonSchema1](../../../../paths/fakeuploadfile/post/responses/code200response/content/applicationjson/ApplicationjsonSchema.md#applicationjsonschema1), Nothing?> + +class storing schema info for a specific contentType + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| ApplicationjsonMediaType()
Creates an instance | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| [ApplicationjsonSchema.ApplicationjsonSchema1](../../../../paths/fakeuploadfile/post/responses/code200response/content/applicationjson/ApplicationjsonSchema.md#applicationjsonschema1) | schema()
the schema for this MediaType | +| Nothing? | encoding()
the encoding info | + +## SealedResponseBody +public sealed interface SealedResponseBody
+permits
+[ApplicationjsonResponseBody](#applicationjsonresponsebody) + +sealed interface that stores response body + +## ApplicationjsonResponseBody +public record ApplicationjsonResponseBody
+implements [SealedResponseBody](#sealedresponsebody) + +A record class to store response body for contentType="application/json" + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| ApplicationjsonResponseBody(ApplicationjsonSchema.[ApiResponseSchema1Boxed](../../../../components/schemas/ApiResponseSchema.md#apiresponseschema1boxed) body)
Creates an instance | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| ApplicationjsonSchema.[ApiResponseSchema1Boxed](../../../../components/schemas/ApiResponseSchema.md#apiresponseschema1boxed) | body()
returns the body passed in in the constructor | + +## FakeuploadfilePostCode200Response1 +public static class FakeuploadfilePostCode200Response1
+extends ResponseDeserializer<[SealedResponseBody](#sealedresponsebody), Nothing?, [SealedMediaType](#sealedmediatype)> + +a class that deserializes responses + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| FakeuploadfilePostCode200Response1()
Creates an instance | + +### Field Summary +| Modifier and Type | Field and Description | +| ----------------- | --------------------- | +| 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 | +| ----------------- | ---------------------- | +| ApiResponse<[SealedResponseBody](#sealedresponsebody), Nothing?> | deserialize(HttpResponse response, SchemaConfiguration configuration)
called by endpoint when deserialize responses | diff --git a/samples/client/petstore/kotlin/docs/paths/fakeuploadfile/post/responses/code200response/content/applicationjson/ApplicationjsonSchema.md b/samples/client/petstore/kotlin/docs/paths/fakeuploadfile/post/responses/code200response/content/applicationjson/ApplicationjsonSchema.md new file mode 100644 index 00000000000..bb60c5776fb --- /dev/null +++ b/samples/client/petstore/kotlin/docs/paths/fakeuploadfile/post/responses/code200response/content/applicationjson/ApplicationjsonSchema.md @@ -0,0 +1,19 @@ +# ApplicationjsonSchema +public class ApplicationjsonSchema
+extends [ApiResponseSchema1](../../../../../../../components/schemas/ApiResponseSchema.md#apiresponseschema) + +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 + +## Nested Class Summary +| Modifier and Type | Class and Description | +| ----------------- | ---------------------- | +| static class | [ApplicationjsonSchema.ApplicationjsonSchema1](#applicationjsonschema1)
schema class | + +## ApplicationjsonSchema1 +public static class ApplicationjsonSchema1
+extends [ApiResponseSchema.ApiResponseSchema1](../../../../../../../components/schemas/ApiResponseSchema.md#apiresponseschema1) + +A schema class that validates payloads diff --git a/samples/client/petstore/kotlin/docs/paths/fakeuploadfiles/FakeuploadfilesPost.md b/samples/client/petstore/kotlin/docs/paths/fakeuploadfiles/FakeuploadfilesPost.md new file mode 100644 index 00000000000..5f1bd2c0a8d --- /dev/null +++ b/samples/client/petstore/kotlin/docs/paths/fakeuploadfiles/FakeuploadfilesPost.md @@ -0,0 +1,148 @@ +# FakeuploadfilesPost + +public class FakeuploadfilesPost + +A class that contains necessary endpoint classes +- a class that calls the endpoint method using the http verb +- a class that calls the endpoint method using the operationId name +- class(es) to store the request inputs +- builder(s) to set the request input data + +## Nested Class Summary +| Modifier and Type | Class and Description | +| ----------------- | --------------------- | +| static class | [Post](#post)
The class that has a post method to call the endpoint | +| interface | [UploadFilesOperation](#uploadfilesoperation)
The interface that has a uploadFiles method to call the endpoint | +| static class | [PostRequest](#postrequest)
The request inputs class | +| static class | [PostRequestBuilder](#postrequestbuilder)
A builder for the request input class | + +## Post +public static class Post 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.FakeuploadfilesPostRequestBody; +import org.openapijsonschematools.client.paths.fakeuploadfiles.post.requestbody.content.multipartformdata.MultipartformdataSchema; +import org.openapijsonschematools.client.RootServerInfo; +import org.openapijsonschematools.client.servers.RootServer0; +import org.openapijsonschematools.client.servers.RootServer1; +import org.openapijsonschematools.client.servers.RootServer2; +import org.openapijsonschematools.client.paths.fakeuploadfiles.post.responses.FakeuploadfilesPostCode200Response; +import org.openapijsonschematools.client.servers.RootServerInfo; +import org.openapijsonschematools.client.paths.fakeuploadfiles.FakeuploadfilesPost; +import org.openapijsonschematools.client.paths.fakeuploadfiles.post.FakeuploadfilesPostResponses; + +import java.io.IOException; +import java.util.Arrays; +import java.util.List; +import java.util.Map; +import java.util.AbstractMap; + +// if you want to use a server that is not SERVER_0 pass it in here and change the ServerIndex input below +ApiConfiguration.ServerInfo serverInfo = new ApiConfiguration.ServerInfoBuilder() + .rootServerInfo( + new RootServerInfo.RootServerInfoBuilder() + .rootServer0(new RootServer0()) + .build() + ) + .build(); +ApiConfiguration.ServerIndexInfo serverIndexInfo = new ApiConfiguration.ServerIndexInfoBuilder() + .rootServerInfoServerIndex(RootServerInfo.ServerIndex.SERVER_0) + .build(); +Duration timeout = Duration.ofSeconds(1L); +Map> defaultHeaders = Map.of("User-Agent", List.of("OpenAPI-JSON-Schema-Generator/1.0.0/java")); +ApiConfiguration apiConfiguration = new ApiConfiguration( + serverInfo + serverIndexInfo, + timeout, + defaultHeaders +); +SchemaConfiguration schemaConfiguration = new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().build()); +FakeuploadfilesPost.Post apiClient = new FakeuploadfilesPost.Post(apiConfiguration, schemaConfiguration); + + +var request = new FakeuploadfilesPost.PostRequestBuilder().build(); + +FakeuploadfilesPostResponses.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; +} +FakeuploadfilesPostResponses.EndpointFakeuploadfilesPostCode200Response castResponse = (FakeuploadfilesPostResponses.EndpointFakeuploadfilesPostCode200Response) response; +FakeuploadfilesPostCode200Response.ApplicationjsonResponseBody deserializedBody = (FakeuploadfilesPostCode200Response.ApplicationjsonResponseBody) castResponse.body; +// handle deserialized body here +``` +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| Post(ApiConfiguration apiConfiguration, SchemaConfiguration schemaConfiguration)
Creates an instance | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| [FakeuploadfilesPostResponses.EndpointResponse](../../paths/fakeuploadfiles/post/FakeuploadfilesPostResponses.md#endpointresponse) | post([PostRequest](#postrequest) request) | + +## UploadFilesOperation +public interface UploadFilesOperation
+ +an interface that allows one to call the endpoint using a method named uploadFiles by the operationId + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| [FakeuploadfilesPostResponses.EndpointResponse](../../paths/fakeuploadfiles/post/FakeuploadfilesPostResponses.md#endpointresponse) | uploadFiles([PostRequest](#postrequest) request) | + +## PostRequest +public static class PostRequest
+ +a class that stores the final request inputs + +### Field Summary +| Modifier and Type | Field and Description | +| ----------------- | --------------------- | +| [FakeuploadfilesPostRequestBody.@Nullable SealedRequestBody](../../paths/fakeuploadfiles/post/FakeuploadfilesPostRequestBody.md#sealedrequestbody) | requestBody
optional | +| [RootServerInfo.@Nullable ServerIndex](../../RootServerInfo.md#serverindex) | serverIndex
optional. Note: this will override the value in apiConfiguration | +| @Nullable Duration | timeout
optional. Note: this will override the value in apiConfiguration | + +## PostRequestBuilder +public static class PostRequestBuilder
+ +a builder for request inputs + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| PostRequestBuilder()
Creates a builder that contains null for all parameters | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| [PostRequest](#postrequest) | build()
Returns the request input used to call an endpoint method | +| [PostRequestBuilder](#postrequestbuilder) | requestBody([FakeuploadfilesPostRequestBody.SealedRequestBody](../../paths/fakeuploadfiles/post/FakeuploadfilesPostRequestBody.md#sealedrequestbody) requestBody)
sets the optional property | +| [PostRequestBuilder](#postrequestbuilder) | serverIndex([RootServerInfo.ServerIndex](../../RootServerInfo.md#serverindex) serverIndex)
sets the optional property. Note: this will override the value in apiConfiguration | +| [PostRequestBuilder](#postrequestbuilder) | timeout(Duration timeout)
sets the optional property. Note: this will override the value in apiConfiguration | + +[[Back to top]](#top) [[Back to README]](../../../README.md) diff --git a/samples/client/petstore/kotlin/docs/paths/fakeuploadfiles/post/FakeuploadfilesPostRequestBody.md b/samples/client/petstore/kotlin/docs/paths/fakeuploadfiles/post/FakeuploadfilesPostRequestBody.md new file mode 100644 index 00000000000..ce187406bfb --- /dev/null +++ b/samples/client/petstore/kotlin/docs/paths/fakeuploadfiles/post/FakeuploadfilesPostRequestBody.md @@ -0,0 +1,90 @@ +# FakeuploadfilesPostRequestBody + +public class FakeuploadfilesPostRequestBody + +A class that contains necessary nested request body classes +- SealedMediaType, a sealed interface which contains all the schema/encoding info for each contentType +- records which implement SealedMediaType, the concrete media types +- a class that extends RequestBodySerializer and is used to serialize input SealedRequestBody instances +- SealedRequestBody, a sealed interface which contains all the contentType/schema input types +- records which implement SealedRequestBody, the concrete request body types + +## Nested Class Summary +| Modifier and Type | Class and Description | +| ----------------- | --------------------- | +| sealed interface | [FakeuploadfilesPostRequestBody.SealedMediaType](#sealedmediatype)
media type sealed interface | +| record | [FakeuploadfilesPostRequestBody.MultipartformdataMediaType](#multipartformdatamediatype)
record storing schema + encoding for a specific contentType | +| static class | [FakeuploadfilesPostRequestBody.FakeuploadfilesPostRequestBody1](#fakeuploadfilespostrequestbody1)
class that serializes request bodies | +| sealed interface | [FakeuploadfilesPostRequestBody.SealedRequestBody](#sealedrequestbody)
request body sealed interface | +| record | [FakeuploadfilesPostRequestBody.MultipartformdataRequestBody](#multipartformdatarequestbody)
implements sealed interface to store request body input | + +## SealedMediaType +public sealed interface SealedMediaType
+permits
+[MultipartformdataMediaType](#multipartformdatamediatype) + +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), Nothing?> + +class storing schema info for a specific contentType + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| MultipartformdataMediaType()
Creates an instance | + +### 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 | +| Nothing? | encoding()
the encoding info | + +## FakeuploadfilesPostRequestBody1 +public static class FakeuploadfilesPostRequestBody1
+ +a class that serializes SealedRequestBody request bodies + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| FakeuploadfilesPostRequestBody1()
Creates an instance | + +### Field Summary +| Modifier and Type | Field and Description | +| ----------------- | --------------------- | +| boolean | required = false
whether the request body is required | +| Map | content = Map.ofEntries(
    new AbstractMap.SimpleEntry<>("multipart/form-data", new [MultipartformdataMediaType](#multipartformdatamediatype)())
)
the contentType to schema info | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| SerializedRequestBody | serialize([SealedRequestBody](#sealedrequestbody) requestBody)
called by endpoint when creating request body bytes | + +## SealedRequestBody +public sealed interface SealedRequestBody
+permits
+[MultipartformdataRequestBody](#multipartformdatarequestbody) + +sealed interface that stores request contentType + validated schema data + +## MultipartformdataRequestBody +public record MultipartformdataRequestBody
+implements [SealedRequestBody](#sealedrequestbody),
+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 | + +### 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 | diff --git a/samples/client/petstore/kotlin/docs/paths/fakeuploadfiles/post/FakeuploadfilesPostResponses.md b/samples/client/petstore/kotlin/docs/paths/fakeuploadfiles/post/FakeuploadfilesPostResponses.md new file mode 100644 index 00000000000..674aa6c746d --- /dev/null +++ b/samples/client/petstore/kotlin/docs/paths/fakeuploadfiles/post/FakeuploadfilesPostResponses.md @@ -0,0 +1,29 @@ +# FakeuploadfilesPostResponses + +public class FakeuploadfilesPostResponses + +A class that contains necessary responses classes +- a sealed interface, EndpointResponse, that stores endpoint responses +- records for each endpoint response + +## Nested Class Summary +| Modifier and Type | Class and Description | +| ----------------- | --------------------- | +| sealed interface | [EndpointResponse](#endpointresponse)
stores the endpoint responses | +| record | [EndpointFakeuploadfilesPostCode200Response](#endpointfakeuploadfilespostcode200response)
the response for 200 | + +## EndpointResponse +public sealed interface EndpointResponse permits
+[EndpointFakeuploadfilesPostCode200Response](#endpointfakeuploadfilespostcode200response) + +a sealed interface that stores endpoint responses + +## EndpointFakeuploadfilesPostCode200Response +public record EndpointFakeuploadfilesPostCode200Response( + HttpResponse response, + [FakeuploadfilesPostCode200Response.SealedResponseBody](../../../paths/fakeuploadfiles/post/responses/FakeuploadfilesPostCode200Response.md#sealedresponsebody) body, + Nothing? headers +) implements EndpointResponse, ApiResponse
+ +a class that stores an endpoint response + diff --git a/samples/client/petstore/kotlin/docs/paths/fakeuploadfiles/post/requestbody/content/multipartformdata/MultipartformdataSchema.md b/samples/client/petstore/kotlin/docs/paths/fakeuploadfiles/post/requestbody/content/multipartformdata/MultipartformdataSchema.md new file mode 100644 index 00000000000..b71409490f1 --- /dev/null +++ b/samples/client/petstore/kotlin/docs/paths/fakeuploadfiles/post/requestbody/content/multipartformdata/MultipartformdataSchema.md @@ -0,0 +1,252 @@ +# MultipartformdataSchema +public class MultipartformdataSchema
+ +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 list payloads, extends FrozenList +- classes to build inputs for list payloads +- classes to store validated map payloads, extends FrozenMap +- classes to build inputs for map payloads + +## Nested Class Summary +| Modifier and Type | Class and Description | +| ----------------- | ---------------------- | +| sealed interface | [MultipartformdataSchema.MultipartformdataSchema1Boxed](#multipartformdataschema1boxed)
sealed interface for validated payloads | +| record | [MultipartformdataSchema.MultipartformdataSchema1BoxedMap](#multipartformdataschema1boxedmap)
boxed class to store validated Map payloads | +| static class | [MultipartformdataSchema.MultipartformdataSchema1](#multipartformdataschema1)
schema class | +| static class | [MultipartformdataSchema.MultipartformdataSchemaMapBuilder](#multipartformdataschemamapbuilder)
builder for Map payloads | +| static class | [MultipartformdataSchema.MultipartformdataSchemaMap](#multipartformdataschemamap)
output class for Map payloads | +| sealed interface | [MultipartformdataSchema.MultipartformdataFilesBoxed](#multipartformdatafilesboxed)
sealed interface for validated payloads | +| record | [MultipartformdataSchema.MultipartformdataFilesBoxedList](#multipartformdatafilesboxedlist)
boxed class to store validated List payloads | +| static class | [MultipartformdataSchema.MultipartformdataFiles](#multipartformdatafiles)
schema class | +| static class | [MultipartformdataSchema.MultipartformdataFilesListBuilder](#multipartformdatafileslistbuilder)
builder for List payloads | +| static class | [MultipartformdataSchema.MultipartformdataFilesList](#multipartformdatafileslist)
output class for List payloads | +| sealed interface | [MultipartformdataSchema.MultipartformdataItemsBoxed](#multipartformdataitemsboxed)
sealed interface for validated payloads | +| static class | [MultipartformdataSchema.MultipartformdataItems](#multipartformdataitems)
schema class | + +## MultipartformdataSchema1Boxed +public sealed interface MultipartformdataSchema1Boxed
+permits
+[MultipartformdataSchema1BoxedMap](#multipartformdataschema1boxedmap) + +sealed interface that stores validated payloads using boxed classes + +## MultipartformdataSchema1BoxedMap +public record MultipartformdataSchema1BoxedMap
+implements [MultipartformdataSchema1Boxed](#multipartformdataschema1boxed) + +record that stores validated Map payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| MultipartformdataSchema1BoxedMap([MultipartformdataSchemaMap](#multipartformdataschemamap) data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| [MultipartformdataSchemaMap](#multipartformdataschemamap) | data()
validated payload | +| @Nullable Object | getData()
validated payload | + +## MultipartformdataSchema1 +public static class MultipartformdataSchema1
+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.fakeuploadfiles.post.requestbody.content.multipartformdata.MultipartformdataSchema; + +import java.util.Arrays; +import java.util.List; +import java.util.AbstractMap; + +static final SchemaConfiguration configuration = new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().build()); + +// Map validation +MultipartformdataSchema.MultipartformdataSchemaMap validatedPayload = + MultipartformdataSchema.MultipartformdataSchema1.validate( + new MultipartformdataSchema.MultipartformdataSchemaMapBuilder() + .files( + Arrays.asList( + "a" + ) + ) + .build(), + configuration +); +``` + +### Field Summary +| Modifier and Type | Field and Description | +| ----------------- | ---------------------- | +| Set> | type = Set.of(Map.class) | +| Map> | properties = Map.ofEntries(
    new PropertyEntry("files", [MultipartformdataFiles.class](#multipartformdatafiles)))
)
| + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| [MultipartformdataSchemaMap](#multipartformdataschemamap) | validate([Map<?, ?>](#multipartformdataschemamapbuilder) arg, SchemaConfiguration configuration) | +| [MultipartformdataSchema1BoxedMap](#multipartformdataschema1boxedmap) | validateAndBox([Map<?, ?>](#multipartformdataschemamapbuilder) arg, SchemaConfiguration configuration) | +| [MultipartformdataSchema1Boxed](#multipartformdataschema1boxed) | validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) | +| @Nullable Object | validate(@Nullable Object arg, SchemaConfiguration configuration) | + +## MultipartformdataSchemaMapBuilder +public class MultipartformdataSchemaMapBuilder
+builder for `Map` + +A class that builds the Map input type + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| MultipartformdataSchemaMapBuilder()
Creates a builder that contains an empty map | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| Map | build()
Returns map input that should be used with Schema.validate | +| [MultipartformdataSchemaMapBuilder](#multipartformdataschemamapbuilder) | files(List value) | +| [MultipartformdataSchemaMapBuilder](#multipartformdataschemamapbuilder) | additionalProperty(String key, Nothing? value) | +| [MultipartformdataSchemaMapBuilder](#multipartformdataschemamapbuilder) | additionalProperty(String key, boolean value) | +| [MultipartformdataSchemaMapBuilder](#multipartformdataschemamapbuilder) | additionalProperty(String key, String value) | +| [MultipartformdataSchemaMapBuilder](#multipartformdataschemamapbuilder) | additionalProperty(String key, int value) | +| [MultipartformdataSchemaMapBuilder](#multipartformdataschemamapbuilder) | additionalProperty(String key, float value) | +| [MultipartformdataSchemaMapBuilder](#multipartformdataschemamapbuilder) | additionalProperty(String key, long value) | +| [MultipartformdataSchemaMapBuilder](#multipartformdataschemamapbuilder) | additionalProperty(String key, double value) | +| [MultipartformdataSchemaMapBuilder](#multipartformdataschemamapbuilder) | additionalProperty(String key, List value) | +| [MultipartformdataSchemaMapBuilder](#multipartformdataschemamapbuilder) | additionalProperty(String key, Map value) | + +## MultipartformdataSchemaMap +public static class MultipartformdataSchemaMap
+extends FrozenMap + +A class to store validated Map payloads + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| static [MultipartformdataSchemaMap](#multipartformdataschemamap) | of([Map](#multipartformdataschemamapbuilder) arg, SchemaConfiguration configuration) | +| [MultipartformdataFilesList](#multipartformdatafileslist) | files()
[optional] | +| @Nullable Object | getAdditionalProperty(String name)
provides type safety for additional properties | + +## MultipartformdataFilesBoxed +public sealed interface MultipartformdataFilesBoxed
+permits
+[MultipartformdataFilesBoxedList](#multipartformdatafilesboxedlist) + +sealed interface that stores validated payloads using boxed classes + +## MultipartformdataFilesBoxedList +public record MultipartformdataFilesBoxedList
+implements [MultipartformdataFilesBoxed](#multipartformdatafilesboxed) + +record that stores validated List payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| MultipartformdataFilesBoxedList([MultipartformdataFilesList](#multipartformdatafileslist) data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| [MultipartformdataFilesList](#multipartformdatafileslist) | data()
validated payload | +| @Nullable Object | getData()
validated payload | + +## MultipartformdataFiles +public static class MultipartformdataFiles
+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.fakeuploadfiles.post.requestbody.content.multipartformdata.MultipartformdataSchema; + +import java.util.Arrays; +import java.util.List; +import java.util.AbstractMap; + +static final SchemaConfiguration configuration = new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().build()); + +// List validation +MultipartformdataSchema.MultipartformdataFilesList validatedPayload = + MultipartformdataSchema.MultipartformdataFiles.validate( + new MultipartformdataSchema.MultipartformdataFilesListBuilder() + .add("a") + + .build(), + configuration +); +``` + +### Field Summary +| Modifier and Type | Field and Description | +| ----------------- | ---------------------- | +| Set> | type = Set.of(List.class) | +| Class | items = [MultipartformdataItems.class](#multipartformdataitems) | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| [MultipartformdataFilesList](#multipartformdatafileslist) | validate([List](#multipartformdatafileslistbuilder) arg, SchemaConfiguration configuration) | +| [MultipartformdataFilesBoxedList](#multipartformdatafilesboxedlist) | validateAndBox([List](#multipartformdatafileslistbuilder) arg, SchemaConfiguration configuration) | +| [MultipartformdataFilesBoxed](#multipartformdatafilesboxed) | validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) | +| @Nullable Object | validate(@Nullable Object arg, SchemaConfiguration configuration) | + +## MultipartformdataFilesListBuilder +public class MultipartformdataFilesListBuilder
+builder for `List` + +A class that builds the List input type + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| MultipartformdataFilesListBuilder()
Creates an empty list | +| MultipartformdataFilesListBuilder(List items)
Stores the items in a list | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| MultipartformdataFilesListBuilder | add(String item) | +| List | build()
Returns list input that should be used with Schema.validate | + +## MultipartformdataFilesList +public class MultipartformdataFilesList
+extends `FrozenList` + +A class to store validated List payloads + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| static [MultipartformdataFilesList](#multipartformdatafileslist) | of([List](#multipartformdatafileslistbuilder) arg, SchemaConfiguration configuration) | + +## MultipartformdataItemsBoxed +public sealed interface MultipartformdataItemsBoxed
+permits
+ +sealed interface that stores validated payloads using boxed classes + +## MultipartformdataItems +public static class MultipartformdataItems
+extends JsonSchema + +A schema class that validates payloads diff --git a/samples/client/petstore/kotlin/docs/paths/fakeuploadfiles/post/responses/FakeuploadfilesPostCode200Response.md b/samples/client/petstore/kotlin/docs/paths/fakeuploadfiles/post/responses/FakeuploadfilesPostCode200Response.md new file mode 100644 index 00000000000..b45d0bb35dc --- /dev/null +++ b/samples/client/petstore/kotlin/docs/paths/fakeuploadfiles/post/responses/FakeuploadfilesPostCode200Response.md @@ -0,0 +1,87 @@ +# FakeuploadfilesPostCode200Response + +public class FakeuploadfilesPostCode200Response + +A class that contains necessary nested response classes +- SealedMediaType, a sealed interface which contains all the schema/encoding info for each contentType +- records which implement SealedMediaType, the concrete media types +- SealedResponseBody, a sealed interface which contains all the contentType/schema types +- records which implement SealedResponseBody, the concrete response body types +- a class that extends ResponseDeserializer and is used to deserialize responses + +## Nested Class Summary +| Modifier and Type | Class and Description | +| ----------------- | --------------------- | +| sealed interface | [FakeuploadfilesPostCode200Response.SealedMediaType](#sealedmediatype)
media type sealed interface | +| record | [FakeuploadfilesPostCode200Response.ApplicationjsonMediaType](#applicationjsonmediatype)
record storing schema + encoding for a specific contentType | +| sealed interface | [FakeuploadfilesPostCode200Response.SealedResponseBody](#sealedresponsebody)
response body sealed interface | +| record | [FakeuploadfilesPostCode200Response.ApplicationjsonResponseBody](#applicationjsonresponsebody)
implements sealed interface to store response body | +| static class | [FakeuploadfilesPostCode200Response.FakeuploadfilesPostCode200Response1](#fakeuploadfilespostcode200response1)
class that deserializes responses | + +## SealedMediaType +public sealed interface SealedMediaType
+permits
+[ApplicationjsonMediaType](#applicationjsonmediatype) + +sealed interface that stores schema and encoding info + +## ApplicationjsonMediaType +public record ApplicationjsonMediaType
+implements [SealedMediaType](#sealedmediatype), MediaType<[ApplicationjsonSchema.ApplicationjsonSchema1](../../../../paths/fakeuploadfiles/post/responses/code200response/content/applicationjson/ApplicationjsonSchema.md#applicationjsonschema1), Nothing?> + +class storing schema info for a specific contentType + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| ApplicationjsonMediaType()
Creates an instance | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| [ApplicationjsonSchema.ApplicationjsonSchema1](../../../../paths/fakeuploadfiles/post/responses/code200response/content/applicationjson/ApplicationjsonSchema.md#applicationjsonschema1) | schema()
the schema for this MediaType | +| Nothing? | encoding()
the encoding info | + +## SealedResponseBody +public sealed interface SealedResponseBody
+permits
+[ApplicationjsonResponseBody](#applicationjsonresponsebody) + +sealed interface that stores response body + +## ApplicationjsonResponseBody +public record ApplicationjsonResponseBody
+implements [SealedResponseBody](#sealedresponsebody) + +A record class to store response body for contentType="application/json" + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| ApplicationjsonResponseBody(ApplicationjsonSchema.[ApiResponseSchema1Boxed](../../../../components/schemas/ApiResponseSchema.md#apiresponseschema1boxed) body)
Creates an instance | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| ApplicationjsonSchema.[ApiResponseSchema1Boxed](../../../../components/schemas/ApiResponseSchema.md#apiresponseschema1boxed) | body()
returns the body passed in in the constructor | + +## FakeuploadfilesPostCode200Response1 +public static class FakeuploadfilesPostCode200Response1
+extends ResponseDeserializer<[SealedResponseBody](#sealedresponsebody), Nothing?, [SealedMediaType](#sealedmediatype)> + +a class that deserializes responses + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| FakeuploadfilesPostCode200Response1()
Creates an instance | + +### Field Summary +| Modifier and Type | Field and Description | +| ----------------- | --------------------- | +| 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 | +| ----------------- | ---------------------- | +| ApiResponse<[SealedResponseBody](#sealedresponsebody), Nothing?> | deserialize(HttpResponse response, SchemaConfiguration configuration)
called by endpoint when deserialize responses | diff --git a/samples/client/petstore/kotlin/docs/paths/fakeuploadfiles/post/responses/code200response/content/applicationjson/ApplicationjsonSchema.md b/samples/client/petstore/kotlin/docs/paths/fakeuploadfiles/post/responses/code200response/content/applicationjson/ApplicationjsonSchema.md new file mode 100644 index 00000000000..bb60c5776fb --- /dev/null +++ b/samples/client/petstore/kotlin/docs/paths/fakeuploadfiles/post/responses/code200response/content/applicationjson/ApplicationjsonSchema.md @@ -0,0 +1,19 @@ +# ApplicationjsonSchema +public class ApplicationjsonSchema
+extends [ApiResponseSchema1](../../../../../../../components/schemas/ApiResponseSchema.md#apiresponseschema) + +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 + +## Nested Class Summary +| Modifier and Type | Class and Description | +| ----------------- | ---------------------- | +| static class | [ApplicationjsonSchema.ApplicationjsonSchema1](#applicationjsonschema1)
schema class | + +## ApplicationjsonSchema1 +public static class ApplicationjsonSchema1
+extends [ApiResponseSchema.ApiResponseSchema1](../../../../../../../components/schemas/ApiResponseSchema.md#apiresponseschema1) + +A schema class that validates payloads diff --git a/samples/client/petstore/kotlin/docs/paths/fakewildcardresponses/FakewildcardresponsesGet.md b/samples/client/petstore/kotlin/docs/paths/fakewildcardresponses/FakewildcardresponsesGet.md new file mode 100644 index 00000000000..f0e232db0bd --- /dev/null +++ b/samples/client/petstore/kotlin/docs/paths/fakewildcardresponses/FakewildcardresponsesGet.md @@ -0,0 +1,163 @@ +# FakewildcardresponsesGet + +public class FakewildcardresponsesGet + +A class that contains necessary endpoint classes +- a class that calls the endpoint method using the http verb +- a class that calls the endpoint method using the operationId name +- class(es) to store the request inputs +- builder(s) to set the request input data + +## Nested Class Summary +| Modifier and Type | Class and Description | +| ----------------- | --------------------- | +| static class | [Get](#get)
The class that has a get method to call the endpoint | +| interface | [WildCardResponsesOperation](#wildcardresponsesoperation)
The interface that has a wildCardResponses method to call the endpoint | +| static class | [GetRequest](#getrequest)
The request inputs class | +| static class | [GetRequestBuilder](#getrequestbuilder)
A builder for the request input class | + +## Get +public static class Get extends ApiClient.ApiClient1 implements GetOperation
+ +a class that allows one to call the endpoint using a method named get + +### 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.servers.RootServer0; +import org.openapijsonschematools.client.servers.RootServer1; +import org.openapijsonschematools.client.servers.RootServer2; +import org.openapijsonschematools.client.paths.fakewildcardresponses.get.responses.FakewildcardresponsesGetCode1XXResponse; +import org.openapijsonschematools.client.paths.fakewildcardresponses.get.responses.FakewildcardresponsesGetCode200Response; +import org.openapijsonschematools.client.paths.fakewildcardresponses.get.responses.FakewildcardresponsesGetCode2XXResponse; +import org.openapijsonschematools.client.paths.fakewildcardresponses.get.responses.FakewildcardresponsesGetCode3XXResponse; +import org.openapijsonschematools.client.paths.fakewildcardresponses.get.responses.FakewildcardresponsesGetCode4XXResponse; +import org.openapijsonschematools.client.paths.fakewildcardresponses.get.responses.FakewildcardresponsesGetCode5XXResponse; +import org.openapijsonschematools.client.servers.RootServerInfo; +import org.openapijsonschematools.client.paths.fakewildcardresponses.FakewildcardresponsesGet; +import org.openapijsonschematools.client.paths.fakewildcardresponses.get.FakewildcardresponsesGetResponses; + +import java.io.IOException; +import java.util.Arrays; +import java.util.List; +import java.util.Map; +import java.util.AbstractMap; + +// if you want to use a server that is not SERVER_0 pass it in here and change the ServerIndex input below +ApiConfiguration.ServerInfo serverInfo = new ApiConfiguration.ServerInfoBuilder() + .rootServerInfo( + new RootServerInfo.RootServerInfoBuilder() + .rootServer0(new RootServer0()) + .build() + ) + .build(); +ApiConfiguration.ServerIndexInfo serverIndexInfo = new ApiConfiguration.ServerIndexInfoBuilder() + .rootServerInfoServerIndex(RootServerInfo.ServerIndex.SERVER_0) + .build(); +Duration timeout = Duration.ofSeconds(1L); +Map> defaultHeaders = Map.of("User-Agent", List.of("OpenAPI-JSON-Schema-Generator/1.0.0/java")); +ApiConfiguration apiConfiguration = new ApiConfiguration( + serverInfo + serverIndexInfo, + timeout, + defaultHeaders +); +SchemaConfiguration schemaConfiguration = new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().build()); +FakewildcardresponsesGet.Get apiClient = new FakewildcardresponsesGet.Get(apiConfiguration, schemaConfiguration); + + +var request = new FakewildcardresponsesGet.GetRequestBuilder().build(); + +FakewildcardresponsesGetResponses.EndpointResponse response; +try { + response = apiClient.get(request); +} catch (FakewildcardresponsesGetCode4XXResponse.ResponseApiException | FakewildcardresponsesGetCode5XXResponse.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; +} +if (response instanceof FakewildcardresponsesGetResponses.EndpointFakewildcardresponsesGetCode1XXResponse castResponse) { + FakewildcardresponsesGetCode1XXResponse.ApplicationjsonResponseBody deserializedBody = (FakewildcardresponsesGetCode1XXResponse.ApplicationjsonResponseBody) castResponse.body; + // handle deserialized body here +} else if (response instanceof FakewildcardresponsesGetResponses.EndpointFakewildcardresponsesGetCode2XXResponse castResponse) { + FakewildcardresponsesGetCode2XXResponse.ApplicationjsonResponseBody deserializedBody = (FakewildcardresponsesGetCode2XXResponse.ApplicationjsonResponseBody) castResponse.body; + // handle deserialized body here +} else if (response instanceof FakewildcardresponsesGetResponses.EndpointFakewildcardresponsesGetCode200Response castResponse) { + FakewildcardresponsesGetCode200Response.ApplicationjsonResponseBody deserializedBody = (FakewildcardresponsesGetCode200Response.ApplicationjsonResponseBody) castResponse.body; + // handle deserialized body here +} else { + FakewildcardresponsesGetResponses.EndpointFakewildcardresponsesGetCode3XXResponse castResponse = (FakewildcardresponsesGetResponses.EndpointFakewildcardresponsesGetCode3XXResponse) response; + FakewildcardresponsesGetCode3XXResponse.ApplicationjsonResponseBody deserializedBody = (FakewildcardresponsesGetCode3XXResponse.ApplicationjsonResponseBody) castResponse.body; + // handle deserialized body here +} +``` +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| Get(ApiConfiguration apiConfiguration, SchemaConfiguration schemaConfiguration)
Creates an instance | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| [FakewildcardresponsesGetResponses.EndpointResponse](../../paths/fakewildcardresponses/get/FakewildcardresponsesGetResponses.md#endpointresponse) | get([GetRequest](#getrequest) request) | + +## WildCardResponsesOperation +public interface WildCardResponsesOperation
+ +an interface that allows one to call the endpoint using a method named wildCardResponses by the operationId + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| [FakewildcardresponsesGetResponses.EndpointResponse](../../paths/fakewildcardresponses/get/FakewildcardresponsesGetResponses.md#endpointresponse) | wildCardResponses([GetRequest](#getrequest) request) | + +## GetRequest +public static class GetRequest
+ +a class that stores the final request inputs + +### Field Summary +| Modifier and Type | Field and Description | +| ----------------- | --------------------- | +| [RootServerInfo.@Nullable ServerIndex](../../RootServerInfo.md#serverindex) | serverIndex
optional. Note: this will override the value in apiConfiguration | +| @Nullable Duration | timeout
optional. Note: this will override the value in apiConfiguration | + +## GetRequestBuilder +public static class GetRequestBuilder
+ +a builder for request inputs + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| GetRequestBuilder()
Creates a builder that contains null for all parameters | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| [GetRequest](#getrequest) | build()
Returns the request input used to call an endpoint method | +| [GetRequestBuilder](#getrequestbuilder) | serverIndex([RootServerInfo.ServerIndex](../../RootServerInfo.md#serverindex) serverIndex)
sets the optional property. Note: this will override the value in apiConfiguration | +| [GetRequestBuilder](#getrequestbuilder) | timeout(Duration timeout)
sets the optional property. Note: this will override the value in apiConfiguration | + +[[Back to top]](#top) [[Back to README]](../../../README.md) diff --git a/samples/client/petstore/kotlin/docs/paths/fakewildcardresponses/get/FakewildcardresponsesGetResponses.md b/samples/client/petstore/kotlin/docs/paths/fakewildcardresponses/get/FakewildcardresponsesGetResponses.md new file mode 100644 index 00000000000..10047a6de1b --- /dev/null +++ b/samples/client/petstore/kotlin/docs/paths/fakewildcardresponses/get/FakewildcardresponsesGetResponses.md @@ -0,0 +1,62 @@ +# FakewildcardresponsesGetResponses + +public class FakewildcardresponsesGetResponses + +A class that contains necessary responses classes +- a sealed interface, EndpointResponse, that stores endpoint responses +- records for each endpoint response + +## Nested Class Summary +| Modifier and Type | Class and Description | +| ----------------- | --------------------- | +| sealed interface | [EndpointResponse](#endpointresponse)
stores the endpoint responses | +| record | [EndpointFakewildcardresponsesGetCode1XXResponse](#endpointfakewildcardresponsesgetcode1xxresponse)
the response for 1XX | +| record | [EndpointFakewildcardresponsesGetCode2XXResponse](#endpointfakewildcardresponsesgetcode2xxresponse)
the response for 2XX | +| record | [EndpointFakewildcardresponsesGetCode200Response](#endpointfakewildcardresponsesgetcode200response)
the response for 200 | +| record | [EndpointFakewildcardresponsesGetCode3XXResponse](#endpointfakewildcardresponsesgetcode3xxresponse)
the response for 3XX | + +## EndpointResponse +public sealed interface EndpointResponse permits
+[EndpointFakewildcardresponsesGetCode1XXResponse](#endpointfakewildcardresponsesgetcode1xxresponse), +[EndpointFakewildcardresponsesGetCode2XXResponse](#endpointfakewildcardresponsesgetcode2xxresponse), +[EndpointFakewildcardresponsesGetCode200Response](#endpointfakewildcardresponsesgetcode200response), +[EndpointFakewildcardresponsesGetCode3XXResponse](#endpointfakewildcardresponsesgetcode3xxresponse) + +a sealed interface that stores endpoint responses + +## EndpointFakewildcardresponsesGetCode1XXResponse +public record EndpointFakewildcardresponsesGetCode1XXResponse( + HttpResponse response, + [FakewildcardresponsesGetCode1XXResponse.SealedResponseBody](../../../paths/fakewildcardresponses/get/responses/FakewildcardresponsesGetCode1XXResponse.md#sealedresponsebody) body, + Nothing? headers +) implements EndpointResponse, ApiResponse
+ +a class that stores an endpoint response + +## EndpointFakewildcardresponsesGetCode2XXResponse +public record EndpointFakewildcardresponsesGetCode2XXResponse( + HttpResponse response, + [FakewildcardresponsesGetCode2XXResponse.SealedResponseBody](../../../paths/fakewildcardresponses/get/responses/FakewildcardresponsesGetCode2XXResponse.md#sealedresponsebody) body, + Nothing? headers +) implements EndpointResponse, ApiResponse
+ +a class that stores an endpoint response + +## EndpointFakewildcardresponsesGetCode200Response +public record EndpointFakewildcardresponsesGetCode200Response( + HttpResponse response, + [FakewildcardresponsesGetCode200Response.SealedResponseBody](../../../paths/fakewildcardresponses/get/responses/FakewildcardresponsesGetCode200Response.md#sealedresponsebody) body, + Nothing? headers +) implements EndpointResponse, ApiResponse
+ +a class that stores an endpoint response + +## EndpointFakewildcardresponsesGetCode3XXResponse +public record EndpointFakewildcardresponsesGetCode3XXResponse( + HttpResponse response, + [FakewildcardresponsesGetCode3XXResponse.SealedResponseBody](../../../paths/fakewildcardresponses/get/responses/FakewildcardresponsesGetCode3XXResponse.md#sealedresponsebody) body, + Nothing? headers +) implements EndpointResponse, ApiResponse
+ +a class that stores an endpoint response + diff --git a/samples/client/petstore/kotlin/docs/paths/fakewildcardresponses/get/responses/FakewildcardresponsesGetCode1XXResponse.md b/samples/client/petstore/kotlin/docs/paths/fakewildcardresponses/get/responses/FakewildcardresponsesGetCode1XXResponse.md new file mode 100644 index 00000000000..37acdf84652 --- /dev/null +++ b/samples/client/petstore/kotlin/docs/paths/fakewildcardresponses/get/responses/FakewildcardresponsesGetCode1XXResponse.md @@ -0,0 +1,87 @@ +# FakewildcardresponsesGetCode1XXResponse + +public class FakewildcardresponsesGetCode1XXResponse + +A class that contains necessary nested response classes +- SealedMediaType, a sealed interface which contains all the schema/encoding info for each contentType +- records which implement SealedMediaType, the concrete media types +- SealedResponseBody, a sealed interface which contains all the contentType/schema types +- records which implement SealedResponseBody, the concrete response body types +- a class that extends ResponseDeserializer and is used to deserialize responses + +## Nested Class Summary +| Modifier and Type | Class and Description | +| ----------------- | --------------------- | +| sealed interface | [FakewildcardresponsesGetCode1XXResponse.SealedMediaType](#sealedmediatype)
media type sealed interface | +| record | [FakewildcardresponsesGetCode1XXResponse.ApplicationjsonMediaType](#applicationjsonmediatype)
record storing schema + encoding for a specific contentType | +| sealed interface | [FakewildcardresponsesGetCode1XXResponse.SealedResponseBody](#sealedresponsebody)
response body sealed interface | +| record | [FakewildcardresponsesGetCode1XXResponse.ApplicationjsonResponseBody](#applicationjsonresponsebody)
implements sealed interface to store response body | +| static class | [FakewildcardresponsesGetCode1XXResponse.FakewildcardresponsesGetCode1XXResponse1](#fakewildcardresponsesgetcode1xxresponse1)
class that deserializes responses | + +## SealedMediaType +public sealed interface SealedMediaType
+permits
+[ApplicationjsonMediaType](#applicationjsonmediatype) + +sealed interface that stores schema and encoding info + +## ApplicationjsonMediaType +public record ApplicationjsonMediaType
+implements [SealedMediaType](#sealedmediatype), MediaType<[ApplicationjsonSchema.ApplicationjsonSchema1](../../../../paths/fakewildcardresponses/get/responses/code1xxresponse/content/applicationjson/ApplicationjsonSchema.md#applicationjsonschema1), Nothing?> + +class storing schema info for a specific contentType + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| ApplicationjsonMediaType()
Creates an instance | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| [ApplicationjsonSchema.ApplicationjsonSchema1](../../../../paths/fakewildcardresponses/get/responses/code1xxresponse/content/applicationjson/ApplicationjsonSchema.md#applicationjsonschema1) | schema()
the schema for this MediaType | +| Nothing? | encoding()
the encoding info | + +## SealedResponseBody +public sealed interface SealedResponseBody
+permits
+[ApplicationjsonResponseBody](#applicationjsonresponsebody) + +sealed interface that stores response body + +## ApplicationjsonResponseBody +public record ApplicationjsonResponseBody
+implements [SealedResponseBody](#sealedresponsebody) + +A record class to store response body for contentType="application/json" + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| ApplicationjsonResponseBody(ApplicationjsonSchema.AnyTypeJsonSchema1Boxed body)
Creates an instance | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| ApplicationjsonSchema.AnyTypeJsonSchema1Boxed | body()
returns the body passed in in the constructor | + +## FakewildcardresponsesGetCode1XXResponse1 +public static class FakewildcardresponsesGetCode1XXResponse1
+extends ResponseDeserializer<[SealedResponseBody](#sealedresponsebody), Nothing?, [SealedMediaType](#sealedmediatype)> + +a class that deserializes responses + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| FakewildcardresponsesGetCode1XXResponse1()
Creates an instance | + +### Field Summary +| Modifier and Type | Field and Description | +| ----------------- | --------------------- | +| 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 | +| ----------------- | ---------------------- | +| ApiResponse<[SealedResponseBody](#sealedresponsebody), Nothing?> | deserialize(HttpResponse response, SchemaConfiguration configuration)
called by endpoint when deserialize responses | diff --git a/samples/client/petstore/kotlin/docs/paths/fakewildcardresponses/get/responses/FakewildcardresponsesGetCode200Response.md b/samples/client/petstore/kotlin/docs/paths/fakewildcardresponses/get/responses/FakewildcardresponsesGetCode200Response.md new file mode 100644 index 00000000000..22174a2e3da --- /dev/null +++ b/samples/client/petstore/kotlin/docs/paths/fakewildcardresponses/get/responses/FakewildcardresponsesGetCode200Response.md @@ -0,0 +1,87 @@ +# FakewildcardresponsesGetCode200Response + +public class FakewildcardresponsesGetCode200Response + +A class that contains necessary nested response classes +- SealedMediaType, a sealed interface which contains all the schema/encoding info for each contentType +- records which implement SealedMediaType, the concrete media types +- SealedResponseBody, a sealed interface which contains all the contentType/schema types +- records which implement SealedResponseBody, the concrete response body types +- a class that extends ResponseDeserializer and is used to deserialize responses + +## Nested Class Summary +| Modifier and Type | Class and Description | +| ----------------- | --------------------- | +| sealed interface | [FakewildcardresponsesGetCode200Response.SealedMediaType](#sealedmediatype)
media type sealed interface | +| record | [FakewildcardresponsesGetCode200Response.ApplicationjsonMediaType](#applicationjsonmediatype)
record storing schema + encoding for a specific contentType | +| sealed interface | [FakewildcardresponsesGetCode200Response.SealedResponseBody](#sealedresponsebody)
response body sealed interface | +| record | [FakewildcardresponsesGetCode200Response.ApplicationjsonResponseBody](#applicationjsonresponsebody)
implements sealed interface to store response body | +| static class | [FakewildcardresponsesGetCode200Response.FakewildcardresponsesGetCode200Response1](#fakewildcardresponsesgetcode200response1)
class that deserializes responses | + +## SealedMediaType +public sealed interface SealedMediaType
+permits
+[ApplicationjsonMediaType](#applicationjsonmediatype) + +sealed interface that stores schema and encoding info + +## ApplicationjsonMediaType +public record ApplicationjsonMediaType
+implements [SealedMediaType](#sealedmediatype), MediaType<[ApplicationjsonSchema.ApplicationjsonSchema1](../../../../paths/fakewildcardresponses/get/responses/code200response/content/applicationjson/ApplicationjsonSchema.md#applicationjsonschema1), Nothing?> + +class storing schema info for a specific contentType + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| ApplicationjsonMediaType()
Creates an instance | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| [ApplicationjsonSchema.ApplicationjsonSchema1](../../../../paths/fakewildcardresponses/get/responses/code200response/content/applicationjson/ApplicationjsonSchema.md#applicationjsonschema1) | schema()
the schema for this MediaType | +| Nothing? | encoding()
the encoding info | + +## SealedResponseBody +public sealed interface SealedResponseBody
+permits
+[ApplicationjsonResponseBody](#applicationjsonresponsebody) + +sealed interface that stores response body + +## ApplicationjsonResponseBody +public record ApplicationjsonResponseBody
+implements [SealedResponseBody](#sealedresponsebody) + +A record class to store response body for contentType="application/json" + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| ApplicationjsonResponseBody(ApplicationjsonSchema.AnyTypeJsonSchema1Boxed body)
Creates an instance | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| ApplicationjsonSchema.AnyTypeJsonSchema1Boxed | body()
returns the body passed in in the constructor | + +## FakewildcardresponsesGetCode200Response1 +public static class FakewildcardresponsesGetCode200Response1
+extends ResponseDeserializer<[SealedResponseBody](#sealedresponsebody), Nothing?, [SealedMediaType](#sealedmediatype)> + +a class that deserializes responses + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| FakewildcardresponsesGetCode200Response1()
Creates an instance | + +### Field Summary +| Modifier and Type | Field and Description | +| ----------------- | --------------------- | +| 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 | +| ----------------- | ---------------------- | +| ApiResponse<[SealedResponseBody](#sealedresponsebody), Nothing?> | deserialize(HttpResponse response, SchemaConfiguration configuration)
called by endpoint when deserialize responses | diff --git a/samples/client/petstore/kotlin/docs/paths/fakewildcardresponses/get/responses/FakewildcardresponsesGetCode2XXResponse.md b/samples/client/petstore/kotlin/docs/paths/fakewildcardresponses/get/responses/FakewildcardresponsesGetCode2XXResponse.md new file mode 100644 index 00000000000..890576595c6 --- /dev/null +++ b/samples/client/petstore/kotlin/docs/paths/fakewildcardresponses/get/responses/FakewildcardresponsesGetCode2XXResponse.md @@ -0,0 +1,87 @@ +# FakewildcardresponsesGetCode2XXResponse + +public class FakewildcardresponsesGetCode2XXResponse + +A class that contains necessary nested response classes +- SealedMediaType, a sealed interface which contains all the schema/encoding info for each contentType +- records which implement SealedMediaType, the concrete media types +- SealedResponseBody, a sealed interface which contains all the contentType/schema types +- records which implement SealedResponseBody, the concrete response body types +- a class that extends ResponseDeserializer and is used to deserialize responses + +## Nested Class Summary +| Modifier and Type | Class and Description | +| ----------------- | --------------------- | +| sealed interface | [FakewildcardresponsesGetCode2XXResponse.SealedMediaType](#sealedmediatype)
media type sealed interface | +| record | [FakewildcardresponsesGetCode2XXResponse.ApplicationjsonMediaType](#applicationjsonmediatype)
record storing schema + encoding for a specific contentType | +| sealed interface | [FakewildcardresponsesGetCode2XXResponse.SealedResponseBody](#sealedresponsebody)
response body sealed interface | +| record | [FakewildcardresponsesGetCode2XXResponse.ApplicationjsonResponseBody](#applicationjsonresponsebody)
implements sealed interface to store response body | +| static class | [FakewildcardresponsesGetCode2XXResponse.FakewildcardresponsesGetCode2XXResponse1](#fakewildcardresponsesgetcode2xxresponse1)
class that deserializes responses | + +## SealedMediaType +public sealed interface SealedMediaType
+permits
+[ApplicationjsonMediaType](#applicationjsonmediatype) + +sealed interface that stores schema and encoding info + +## ApplicationjsonMediaType +public record ApplicationjsonMediaType
+implements [SealedMediaType](#sealedmediatype), MediaType<[ApplicationjsonSchema.ApplicationjsonSchema1](../../../../paths/fakewildcardresponses/get/responses/code2xxresponse/content/applicationjson/ApplicationjsonSchema.md#applicationjsonschema1), Nothing?> + +class storing schema info for a specific contentType + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| ApplicationjsonMediaType()
Creates an instance | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| [ApplicationjsonSchema.ApplicationjsonSchema1](../../../../paths/fakewildcardresponses/get/responses/code2xxresponse/content/applicationjson/ApplicationjsonSchema.md#applicationjsonschema1) | schema()
the schema for this MediaType | +| Nothing? | encoding()
the encoding info | + +## SealedResponseBody +public sealed interface SealedResponseBody
+permits
+[ApplicationjsonResponseBody](#applicationjsonresponsebody) + +sealed interface that stores response body + +## ApplicationjsonResponseBody +public record ApplicationjsonResponseBody
+implements [SealedResponseBody](#sealedresponsebody) + +A record class to store response body for contentType="application/json" + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| ApplicationjsonResponseBody(ApplicationjsonSchema.AnyTypeJsonSchema1Boxed body)
Creates an instance | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| ApplicationjsonSchema.AnyTypeJsonSchema1Boxed | body()
returns the body passed in in the constructor | + +## FakewildcardresponsesGetCode2XXResponse1 +public static class FakewildcardresponsesGetCode2XXResponse1
+extends ResponseDeserializer<[SealedResponseBody](#sealedresponsebody), Nothing?, [SealedMediaType](#sealedmediatype)> + +a class that deserializes responses + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| FakewildcardresponsesGetCode2XXResponse1()
Creates an instance | + +### Field Summary +| Modifier and Type | Field and Description | +| ----------------- | --------------------- | +| 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 | +| ----------------- | ---------------------- | +| ApiResponse<[SealedResponseBody](#sealedresponsebody), Nothing?> | deserialize(HttpResponse response, SchemaConfiguration configuration)
called by endpoint when deserialize responses | diff --git a/samples/client/petstore/kotlin/docs/paths/fakewildcardresponses/get/responses/FakewildcardresponsesGetCode3XXResponse.md b/samples/client/petstore/kotlin/docs/paths/fakewildcardresponses/get/responses/FakewildcardresponsesGetCode3XXResponse.md new file mode 100644 index 00000000000..9edfeef9d33 --- /dev/null +++ b/samples/client/petstore/kotlin/docs/paths/fakewildcardresponses/get/responses/FakewildcardresponsesGetCode3XXResponse.md @@ -0,0 +1,87 @@ +# FakewildcardresponsesGetCode3XXResponse + +public class FakewildcardresponsesGetCode3XXResponse + +A class that contains necessary nested response classes +- SealedMediaType, a sealed interface which contains all the schema/encoding info for each contentType +- records which implement SealedMediaType, the concrete media types +- SealedResponseBody, a sealed interface which contains all the contentType/schema types +- records which implement SealedResponseBody, the concrete response body types +- a class that extends ResponseDeserializer and is used to deserialize responses + +## Nested Class Summary +| Modifier and Type | Class and Description | +| ----------------- | --------------------- | +| sealed interface | [FakewildcardresponsesGetCode3XXResponse.SealedMediaType](#sealedmediatype)
media type sealed interface | +| record | [FakewildcardresponsesGetCode3XXResponse.ApplicationjsonMediaType](#applicationjsonmediatype)
record storing schema + encoding for a specific contentType | +| sealed interface | [FakewildcardresponsesGetCode3XXResponse.SealedResponseBody](#sealedresponsebody)
response body sealed interface | +| record | [FakewildcardresponsesGetCode3XXResponse.ApplicationjsonResponseBody](#applicationjsonresponsebody)
implements sealed interface to store response body | +| static class | [FakewildcardresponsesGetCode3XXResponse.FakewildcardresponsesGetCode3XXResponse1](#fakewildcardresponsesgetcode3xxresponse1)
class that deserializes responses | + +## SealedMediaType +public sealed interface SealedMediaType
+permits
+[ApplicationjsonMediaType](#applicationjsonmediatype) + +sealed interface that stores schema and encoding info + +## ApplicationjsonMediaType +public record ApplicationjsonMediaType
+implements [SealedMediaType](#sealedmediatype), MediaType<[ApplicationjsonSchema.ApplicationjsonSchema1](../../../../paths/fakewildcardresponses/get/responses/code3xxresponse/content/applicationjson/ApplicationjsonSchema.md#applicationjsonschema1), Nothing?> + +class storing schema info for a specific contentType + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| ApplicationjsonMediaType()
Creates an instance | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| [ApplicationjsonSchema.ApplicationjsonSchema1](../../../../paths/fakewildcardresponses/get/responses/code3xxresponse/content/applicationjson/ApplicationjsonSchema.md#applicationjsonschema1) | schema()
the schema for this MediaType | +| Nothing? | encoding()
the encoding info | + +## SealedResponseBody +public sealed interface SealedResponseBody
+permits
+[ApplicationjsonResponseBody](#applicationjsonresponsebody) + +sealed interface that stores response body + +## ApplicationjsonResponseBody +public record ApplicationjsonResponseBody
+implements [SealedResponseBody](#sealedresponsebody) + +A record class to store response body for contentType="application/json" + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| ApplicationjsonResponseBody(ApplicationjsonSchema.AnyTypeJsonSchema1Boxed body)
Creates an instance | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| ApplicationjsonSchema.AnyTypeJsonSchema1Boxed | body()
returns the body passed in in the constructor | + +## FakewildcardresponsesGetCode3XXResponse1 +public static class FakewildcardresponsesGetCode3XXResponse1
+extends ResponseDeserializer<[SealedResponseBody](#sealedresponsebody), Nothing?, [SealedMediaType](#sealedmediatype)> + +a class that deserializes responses + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| FakewildcardresponsesGetCode3XXResponse1()
Creates an instance | + +### Field Summary +| Modifier and Type | Field and Description | +| ----------------- | --------------------- | +| 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 | +| ----------------- | ---------------------- | +| ApiResponse<[SealedResponseBody](#sealedresponsebody), Nothing?> | deserialize(HttpResponse response, SchemaConfiguration configuration)
called by endpoint when deserialize responses | diff --git a/samples/client/petstore/kotlin/docs/paths/fakewildcardresponses/get/responses/FakewildcardresponsesGetCode4XXResponse.md b/samples/client/petstore/kotlin/docs/paths/fakewildcardresponses/get/responses/FakewildcardresponsesGetCode4XXResponse.md new file mode 100644 index 00000000000..c703e8baa23 --- /dev/null +++ b/samples/client/petstore/kotlin/docs/paths/fakewildcardresponses/get/responses/FakewildcardresponsesGetCode4XXResponse.md @@ -0,0 +1,87 @@ +# FakewildcardresponsesGetCode4XXResponse + +public class FakewildcardresponsesGetCode4XXResponse + +A class that contains necessary nested response classes +- SealedMediaType, a sealed interface which contains all the schema/encoding info for each contentType +- records which implement SealedMediaType, the concrete media types +- SealedResponseBody, a sealed interface which contains all the contentType/schema types +- records which implement SealedResponseBody, the concrete response body types +- a class that extends ResponseDeserializer and is used to deserialize responses + +## Nested Class Summary +| Modifier and Type | Class and Description | +| ----------------- | --------------------- | +| sealed interface | [FakewildcardresponsesGetCode4XXResponse.SealedMediaType](#sealedmediatype)
media type sealed interface | +| record | [FakewildcardresponsesGetCode4XXResponse.ApplicationjsonMediaType](#applicationjsonmediatype)
record storing schema + encoding for a specific contentType | +| sealed interface | [FakewildcardresponsesGetCode4XXResponse.SealedResponseBody](#sealedresponsebody)
response body sealed interface | +| record | [FakewildcardresponsesGetCode4XXResponse.ApplicationjsonResponseBody](#applicationjsonresponsebody)
implements sealed interface to store response body | +| static class | [FakewildcardresponsesGetCode4XXResponse.FakewildcardresponsesGetCode4XXResponse1](#fakewildcardresponsesgetcode4xxresponse1)
class that deserializes responses | + +## SealedMediaType +public sealed interface SealedMediaType
+permits
+[ApplicationjsonMediaType](#applicationjsonmediatype) + +sealed interface that stores schema and encoding info + +## ApplicationjsonMediaType +public record ApplicationjsonMediaType
+implements [SealedMediaType](#sealedmediatype), MediaType<[ApplicationjsonSchema.ApplicationjsonSchema1](../../../../paths/fakewildcardresponses/get/responses/code4xxresponse/content/applicationjson/ApplicationjsonSchema.md#applicationjsonschema1), Nothing?> + +class storing schema info for a specific contentType + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| ApplicationjsonMediaType()
Creates an instance | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| [ApplicationjsonSchema.ApplicationjsonSchema1](../../../../paths/fakewildcardresponses/get/responses/code4xxresponse/content/applicationjson/ApplicationjsonSchema.md#applicationjsonschema1) | schema()
the schema for this MediaType | +| Nothing? | encoding()
the encoding info | + +## SealedResponseBody +public sealed interface SealedResponseBody
+permits
+[ApplicationjsonResponseBody](#applicationjsonresponsebody) + +sealed interface that stores response body + +## ApplicationjsonResponseBody +public record ApplicationjsonResponseBody
+implements [SealedResponseBody](#sealedresponsebody) + +A record class to store response body for contentType="application/json" + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| ApplicationjsonResponseBody(ApplicationjsonSchema.AnyTypeJsonSchema1Boxed body)
Creates an instance | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| ApplicationjsonSchema.AnyTypeJsonSchema1Boxed | body()
returns the body passed in in the constructor | + +## FakewildcardresponsesGetCode4XXResponse1 +public static class FakewildcardresponsesGetCode4XXResponse1
+extends ResponseDeserializer<[SealedResponseBody](#sealedresponsebody), Nothing?, [SealedMediaType](#sealedmediatype)> + +a class that deserializes responses + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| FakewildcardresponsesGetCode4XXResponse1()
Creates an instance | + +### Field Summary +| Modifier and Type | Field and Description | +| ----------------- | --------------------- | +| 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 | +| ----------------- | ---------------------- | +| ApiResponse<[SealedResponseBody](#sealedresponsebody), Nothing?> | deserialize(HttpResponse response, SchemaConfiguration configuration)
called by endpoint when deserialize responses | diff --git a/samples/client/petstore/kotlin/docs/paths/fakewildcardresponses/get/responses/FakewildcardresponsesGetCode5XXResponse.md b/samples/client/petstore/kotlin/docs/paths/fakewildcardresponses/get/responses/FakewildcardresponsesGetCode5XXResponse.md new file mode 100644 index 00000000000..e032cb6c199 --- /dev/null +++ b/samples/client/petstore/kotlin/docs/paths/fakewildcardresponses/get/responses/FakewildcardresponsesGetCode5XXResponse.md @@ -0,0 +1,87 @@ +# FakewildcardresponsesGetCode5XXResponse + +public class FakewildcardresponsesGetCode5XXResponse + +A class that contains necessary nested response classes +- SealedMediaType, a sealed interface which contains all the schema/encoding info for each contentType +- records which implement SealedMediaType, the concrete media types +- SealedResponseBody, a sealed interface which contains all the contentType/schema types +- records which implement SealedResponseBody, the concrete response body types +- a class that extends ResponseDeserializer and is used to deserialize responses + +## Nested Class Summary +| Modifier and Type | Class and Description | +| ----------------- | --------------------- | +| sealed interface | [FakewildcardresponsesGetCode5XXResponse.SealedMediaType](#sealedmediatype)
media type sealed interface | +| record | [FakewildcardresponsesGetCode5XXResponse.ApplicationjsonMediaType](#applicationjsonmediatype)
record storing schema + encoding for a specific contentType | +| sealed interface | [FakewildcardresponsesGetCode5XXResponse.SealedResponseBody](#sealedresponsebody)
response body sealed interface | +| record | [FakewildcardresponsesGetCode5XXResponse.ApplicationjsonResponseBody](#applicationjsonresponsebody)
implements sealed interface to store response body | +| static class | [FakewildcardresponsesGetCode5XXResponse.FakewildcardresponsesGetCode5XXResponse1](#fakewildcardresponsesgetcode5xxresponse1)
class that deserializes responses | + +## SealedMediaType +public sealed interface SealedMediaType
+permits
+[ApplicationjsonMediaType](#applicationjsonmediatype) + +sealed interface that stores schema and encoding info + +## ApplicationjsonMediaType +public record ApplicationjsonMediaType
+implements [SealedMediaType](#sealedmediatype), MediaType<[ApplicationjsonSchema.ApplicationjsonSchema1](../../../../paths/fakewildcardresponses/get/responses/code5xxresponse/content/applicationjson/ApplicationjsonSchema.md#applicationjsonschema1), Nothing?> + +class storing schema info for a specific contentType + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| ApplicationjsonMediaType()
Creates an instance | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| [ApplicationjsonSchema.ApplicationjsonSchema1](../../../../paths/fakewildcardresponses/get/responses/code5xxresponse/content/applicationjson/ApplicationjsonSchema.md#applicationjsonschema1) | schema()
the schema for this MediaType | +| Nothing? | encoding()
the encoding info | + +## SealedResponseBody +public sealed interface SealedResponseBody
+permits
+[ApplicationjsonResponseBody](#applicationjsonresponsebody) + +sealed interface that stores response body + +## ApplicationjsonResponseBody +public record ApplicationjsonResponseBody
+implements [SealedResponseBody](#sealedresponsebody) + +A record class to store response body for contentType="application/json" + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| ApplicationjsonResponseBody(ApplicationjsonSchema.AnyTypeJsonSchema1Boxed body)
Creates an instance | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| ApplicationjsonSchema.AnyTypeJsonSchema1Boxed | body()
returns the body passed in in the constructor | + +## FakewildcardresponsesGetCode5XXResponse1 +public static class FakewildcardresponsesGetCode5XXResponse1
+extends ResponseDeserializer<[SealedResponseBody](#sealedresponsebody), Nothing?, [SealedMediaType](#sealedmediatype)> + +a class that deserializes responses + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| FakewildcardresponsesGetCode5XXResponse1()
Creates an instance | + +### Field Summary +| Modifier and Type | Field and Description | +| ----------------- | --------------------- | +| 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 | +| ----------------- | ---------------------- | +| ApiResponse<[SealedResponseBody](#sealedresponsebody), Nothing?> | deserialize(HttpResponse response, SchemaConfiguration configuration)
called by endpoint when deserialize responses | diff --git a/samples/client/petstore/kotlin/docs/paths/fakewildcardresponses/get/responses/code1xxresponse/content/applicationjson/ApplicationjsonSchema.md b/samples/client/petstore/kotlin/docs/paths/fakewildcardresponses/get/responses/code1xxresponse/content/applicationjson/ApplicationjsonSchema.md new file mode 100644 index 00000000000..b05260b1abf --- /dev/null +++ b/samples/client/petstore/kotlin/docs/paths/fakewildcardresponses/get/responses/code1xxresponse/content/applicationjson/ApplicationjsonSchema.md @@ -0,0 +1,144 @@ +# ApplicationjsonSchema +public class ApplicationjsonSchema
+ +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 + +## Nested Class Summary +| Modifier and Type | Class and Description | +| ----------------- | ---------------------- | +| sealed interface | [ApplicationjsonSchema.ApplicationjsonSchema1Boxed](#applicationjsonschema1boxed)
sealed interface for validated payloads | +| record | [ApplicationjsonSchema.ApplicationjsonSchema1BoxedVoid](#applicationjsonschema1boxedvoid)
boxed class to store validated null payloads | +| record | [ApplicationjsonSchema.ApplicationjsonSchema1BoxedBoolean](#applicationjsonschema1boxedboolean)
boxed class to store validated boolean payloads | +| record | [ApplicationjsonSchema.ApplicationjsonSchema1BoxedNumber](#applicationjsonschema1boxednumber)
boxed class to store validated Number payloads | +| record | [ApplicationjsonSchema.ApplicationjsonSchema1BoxedString](#applicationjsonschema1boxedstring)
boxed class to store validated String payloads | +| record | [ApplicationjsonSchema.ApplicationjsonSchema1BoxedList](#applicationjsonschema1boxedlist)
boxed class to store validated List payloads | +| record | [ApplicationjsonSchema.ApplicationjsonSchema1BoxedMap](#applicationjsonschema1boxedmap)
boxed class to store validated Map payloads | +| static class | [ApplicationjsonSchema.ApplicationjsonSchema1](#applicationjsonschema1)
schema class | + +## ApplicationjsonSchema1Boxed +public sealed interface ApplicationjsonSchema1Boxed
+permits
+[ApplicationjsonSchema1BoxedVoid](#applicationjsonschema1boxedvoid), +[ApplicationjsonSchema1BoxedBoolean](#applicationjsonschema1boxedboolean), +[ApplicationjsonSchema1BoxedNumber](#applicationjsonschema1boxednumber), +[ApplicationjsonSchema1BoxedString](#applicationjsonschema1boxedstring), +[ApplicationjsonSchema1BoxedList](#applicationjsonschema1boxedlist), +[ApplicationjsonSchema1BoxedMap](#applicationjsonschema1boxedmap) + +sealed interface that stores validated payloads using boxed classes + +## ApplicationjsonSchema1BoxedVoid +public record ApplicationjsonSchema1BoxedVoid
+implements [ApplicationjsonSchema1Boxed](#applicationjsonschema1boxed) + +record that stores validated null payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| ApplicationjsonSchema1BoxedVoid(Nothing? data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| Nothing? | data()
validated payload | +| @Nullable Object | getData()
validated payload | + +## ApplicationjsonSchema1BoxedBoolean +public record ApplicationjsonSchema1BoxedBoolean
+implements [ApplicationjsonSchema1Boxed](#applicationjsonschema1boxed) + +record that stores validated boolean payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| ApplicationjsonSchema1BoxedBoolean(boolean data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| boolean | data()
validated payload | +| @Nullable Object | getData()
validated payload | + +## ApplicationjsonSchema1BoxedNumber +public record ApplicationjsonSchema1BoxedNumber
+implements [ApplicationjsonSchema1Boxed](#applicationjsonschema1boxed) + +record that stores validated Number payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| ApplicationjsonSchema1BoxedNumber(Number data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| Number | data()
validated payload | +| @Nullable Object | getData()
validated payload | + +## ApplicationjsonSchema1BoxedString +public record ApplicationjsonSchema1BoxedString
+implements [ApplicationjsonSchema1Boxed](#applicationjsonschema1boxed) + +record that stores validated String payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| ApplicationjsonSchema1BoxedString(String data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| String | data()
validated payload | +| @Nullable Object | getData()
validated payload | + +## ApplicationjsonSchema1BoxedList +public record ApplicationjsonSchema1BoxedList
+implements [ApplicationjsonSchema1Boxed](#applicationjsonschema1boxed) + +record that stores validated List payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| ApplicationjsonSchema1BoxedList(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 | + +## ApplicationjsonSchema1BoxedMap +public record ApplicationjsonSchema1BoxedMap
+implements [ApplicationjsonSchema1Boxed](#applicationjsonschema1boxed) + +record that stores validated Map payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| ApplicationjsonSchema1BoxedMap(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 | + +## ApplicationjsonSchema1 +public static class ApplicationjsonSchema1
+extends AnyTypeJsonSchema.AnyTypeJsonSchema1 + +A schema class that validates payloads + +| Methods Inherited from class org.openapijsonschematools.client.schemas.AnyTypeJsonSchema.AnyTypeJsonSchema1 | +| ------------------------------------------------------------------ | +| validate | +| validateAndBox | diff --git a/samples/client/petstore/kotlin/docs/paths/fakewildcardresponses/get/responses/code200response/content/applicationjson/ApplicationjsonSchema.md b/samples/client/petstore/kotlin/docs/paths/fakewildcardresponses/get/responses/code200response/content/applicationjson/ApplicationjsonSchema.md new file mode 100644 index 00000000000..b05260b1abf --- /dev/null +++ b/samples/client/petstore/kotlin/docs/paths/fakewildcardresponses/get/responses/code200response/content/applicationjson/ApplicationjsonSchema.md @@ -0,0 +1,144 @@ +# ApplicationjsonSchema +public class ApplicationjsonSchema
+ +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 + +## Nested Class Summary +| Modifier and Type | Class and Description | +| ----------------- | ---------------------- | +| sealed interface | [ApplicationjsonSchema.ApplicationjsonSchema1Boxed](#applicationjsonschema1boxed)
sealed interface for validated payloads | +| record | [ApplicationjsonSchema.ApplicationjsonSchema1BoxedVoid](#applicationjsonschema1boxedvoid)
boxed class to store validated null payloads | +| record | [ApplicationjsonSchema.ApplicationjsonSchema1BoxedBoolean](#applicationjsonschema1boxedboolean)
boxed class to store validated boolean payloads | +| record | [ApplicationjsonSchema.ApplicationjsonSchema1BoxedNumber](#applicationjsonschema1boxednumber)
boxed class to store validated Number payloads | +| record | [ApplicationjsonSchema.ApplicationjsonSchema1BoxedString](#applicationjsonschema1boxedstring)
boxed class to store validated String payloads | +| record | [ApplicationjsonSchema.ApplicationjsonSchema1BoxedList](#applicationjsonschema1boxedlist)
boxed class to store validated List payloads | +| record | [ApplicationjsonSchema.ApplicationjsonSchema1BoxedMap](#applicationjsonschema1boxedmap)
boxed class to store validated Map payloads | +| static class | [ApplicationjsonSchema.ApplicationjsonSchema1](#applicationjsonschema1)
schema class | + +## ApplicationjsonSchema1Boxed +public sealed interface ApplicationjsonSchema1Boxed
+permits
+[ApplicationjsonSchema1BoxedVoid](#applicationjsonschema1boxedvoid), +[ApplicationjsonSchema1BoxedBoolean](#applicationjsonschema1boxedboolean), +[ApplicationjsonSchema1BoxedNumber](#applicationjsonschema1boxednumber), +[ApplicationjsonSchema1BoxedString](#applicationjsonschema1boxedstring), +[ApplicationjsonSchema1BoxedList](#applicationjsonschema1boxedlist), +[ApplicationjsonSchema1BoxedMap](#applicationjsonschema1boxedmap) + +sealed interface that stores validated payloads using boxed classes + +## ApplicationjsonSchema1BoxedVoid +public record ApplicationjsonSchema1BoxedVoid
+implements [ApplicationjsonSchema1Boxed](#applicationjsonschema1boxed) + +record that stores validated null payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| ApplicationjsonSchema1BoxedVoid(Nothing? data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| Nothing? | data()
validated payload | +| @Nullable Object | getData()
validated payload | + +## ApplicationjsonSchema1BoxedBoolean +public record ApplicationjsonSchema1BoxedBoolean
+implements [ApplicationjsonSchema1Boxed](#applicationjsonschema1boxed) + +record that stores validated boolean payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| ApplicationjsonSchema1BoxedBoolean(boolean data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| boolean | data()
validated payload | +| @Nullable Object | getData()
validated payload | + +## ApplicationjsonSchema1BoxedNumber +public record ApplicationjsonSchema1BoxedNumber
+implements [ApplicationjsonSchema1Boxed](#applicationjsonschema1boxed) + +record that stores validated Number payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| ApplicationjsonSchema1BoxedNumber(Number data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| Number | data()
validated payload | +| @Nullable Object | getData()
validated payload | + +## ApplicationjsonSchema1BoxedString +public record ApplicationjsonSchema1BoxedString
+implements [ApplicationjsonSchema1Boxed](#applicationjsonschema1boxed) + +record that stores validated String payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| ApplicationjsonSchema1BoxedString(String data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| String | data()
validated payload | +| @Nullable Object | getData()
validated payload | + +## ApplicationjsonSchema1BoxedList +public record ApplicationjsonSchema1BoxedList
+implements [ApplicationjsonSchema1Boxed](#applicationjsonschema1boxed) + +record that stores validated List payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| ApplicationjsonSchema1BoxedList(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 | + +## ApplicationjsonSchema1BoxedMap +public record ApplicationjsonSchema1BoxedMap
+implements [ApplicationjsonSchema1Boxed](#applicationjsonschema1boxed) + +record that stores validated Map payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| ApplicationjsonSchema1BoxedMap(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 | + +## ApplicationjsonSchema1 +public static class ApplicationjsonSchema1
+extends AnyTypeJsonSchema.AnyTypeJsonSchema1 + +A schema class that validates payloads + +| Methods Inherited from class org.openapijsonschematools.client.schemas.AnyTypeJsonSchema.AnyTypeJsonSchema1 | +| ------------------------------------------------------------------ | +| validate | +| validateAndBox | diff --git a/samples/client/petstore/kotlin/docs/paths/fakewildcardresponses/get/responses/code2xxresponse/content/applicationjson/ApplicationjsonSchema.md b/samples/client/petstore/kotlin/docs/paths/fakewildcardresponses/get/responses/code2xxresponse/content/applicationjson/ApplicationjsonSchema.md new file mode 100644 index 00000000000..b05260b1abf --- /dev/null +++ b/samples/client/petstore/kotlin/docs/paths/fakewildcardresponses/get/responses/code2xxresponse/content/applicationjson/ApplicationjsonSchema.md @@ -0,0 +1,144 @@ +# ApplicationjsonSchema +public class ApplicationjsonSchema
+ +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 + +## Nested Class Summary +| Modifier and Type | Class and Description | +| ----------------- | ---------------------- | +| sealed interface | [ApplicationjsonSchema.ApplicationjsonSchema1Boxed](#applicationjsonschema1boxed)
sealed interface for validated payloads | +| record | [ApplicationjsonSchema.ApplicationjsonSchema1BoxedVoid](#applicationjsonschema1boxedvoid)
boxed class to store validated null payloads | +| record | [ApplicationjsonSchema.ApplicationjsonSchema1BoxedBoolean](#applicationjsonschema1boxedboolean)
boxed class to store validated boolean payloads | +| record | [ApplicationjsonSchema.ApplicationjsonSchema1BoxedNumber](#applicationjsonschema1boxednumber)
boxed class to store validated Number payloads | +| record | [ApplicationjsonSchema.ApplicationjsonSchema1BoxedString](#applicationjsonschema1boxedstring)
boxed class to store validated String payloads | +| record | [ApplicationjsonSchema.ApplicationjsonSchema1BoxedList](#applicationjsonschema1boxedlist)
boxed class to store validated List payloads | +| record | [ApplicationjsonSchema.ApplicationjsonSchema1BoxedMap](#applicationjsonschema1boxedmap)
boxed class to store validated Map payloads | +| static class | [ApplicationjsonSchema.ApplicationjsonSchema1](#applicationjsonschema1)
schema class | + +## ApplicationjsonSchema1Boxed +public sealed interface ApplicationjsonSchema1Boxed
+permits
+[ApplicationjsonSchema1BoxedVoid](#applicationjsonschema1boxedvoid), +[ApplicationjsonSchema1BoxedBoolean](#applicationjsonschema1boxedboolean), +[ApplicationjsonSchema1BoxedNumber](#applicationjsonschema1boxednumber), +[ApplicationjsonSchema1BoxedString](#applicationjsonschema1boxedstring), +[ApplicationjsonSchema1BoxedList](#applicationjsonschema1boxedlist), +[ApplicationjsonSchema1BoxedMap](#applicationjsonschema1boxedmap) + +sealed interface that stores validated payloads using boxed classes + +## ApplicationjsonSchema1BoxedVoid +public record ApplicationjsonSchema1BoxedVoid
+implements [ApplicationjsonSchema1Boxed](#applicationjsonschema1boxed) + +record that stores validated null payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| ApplicationjsonSchema1BoxedVoid(Nothing? data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| Nothing? | data()
validated payload | +| @Nullable Object | getData()
validated payload | + +## ApplicationjsonSchema1BoxedBoolean +public record ApplicationjsonSchema1BoxedBoolean
+implements [ApplicationjsonSchema1Boxed](#applicationjsonschema1boxed) + +record that stores validated boolean payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| ApplicationjsonSchema1BoxedBoolean(boolean data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| boolean | data()
validated payload | +| @Nullable Object | getData()
validated payload | + +## ApplicationjsonSchema1BoxedNumber +public record ApplicationjsonSchema1BoxedNumber
+implements [ApplicationjsonSchema1Boxed](#applicationjsonschema1boxed) + +record that stores validated Number payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| ApplicationjsonSchema1BoxedNumber(Number data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| Number | data()
validated payload | +| @Nullable Object | getData()
validated payload | + +## ApplicationjsonSchema1BoxedString +public record ApplicationjsonSchema1BoxedString
+implements [ApplicationjsonSchema1Boxed](#applicationjsonschema1boxed) + +record that stores validated String payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| ApplicationjsonSchema1BoxedString(String data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| String | data()
validated payload | +| @Nullable Object | getData()
validated payload | + +## ApplicationjsonSchema1BoxedList +public record ApplicationjsonSchema1BoxedList
+implements [ApplicationjsonSchema1Boxed](#applicationjsonschema1boxed) + +record that stores validated List payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| ApplicationjsonSchema1BoxedList(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 | + +## ApplicationjsonSchema1BoxedMap +public record ApplicationjsonSchema1BoxedMap
+implements [ApplicationjsonSchema1Boxed](#applicationjsonschema1boxed) + +record that stores validated Map payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| ApplicationjsonSchema1BoxedMap(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 | + +## ApplicationjsonSchema1 +public static class ApplicationjsonSchema1
+extends AnyTypeJsonSchema.AnyTypeJsonSchema1 + +A schema class that validates payloads + +| Methods Inherited from class org.openapijsonschematools.client.schemas.AnyTypeJsonSchema.AnyTypeJsonSchema1 | +| ------------------------------------------------------------------ | +| validate | +| validateAndBox | diff --git a/samples/client/petstore/kotlin/docs/paths/fakewildcardresponses/get/responses/code3xxresponse/content/applicationjson/ApplicationjsonSchema.md b/samples/client/petstore/kotlin/docs/paths/fakewildcardresponses/get/responses/code3xxresponse/content/applicationjson/ApplicationjsonSchema.md new file mode 100644 index 00000000000..b05260b1abf --- /dev/null +++ b/samples/client/petstore/kotlin/docs/paths/fakewildcardresponses/get/responses/code3xxresponse/content/applicationjson/ApplicationjsonSchema.md @@ -0,0 +1,144 @@ +# ApplicationjsonSchema +public class ApplicationjsonSchema
+ +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 + +## Nested Class Summary +| Modifier and Type | Class and Description | +| ----------------- | ---------------------- | +| sealed interface | [ApplicationjsonSchema.ApplicationjsonSchema1Boxed](#applicationjsonschema1boxed)
sealed interface for validated payloads | +| record | [ApplicationjsonSchema.ApplicationjsonSchema1BoxedVoid](#applicationjsonschema1boxedvoid)
boxed class to store validated null payloads | +| record | [ApplicationjsonSchema.ApplicationjsonSchema1BoxedBoolean](#applicationjsonschema1boxedboolean)
boxed class to store validated boolean payloads | +| record | [ApplicationjsonSchema.ApplicationjsonSchema1BoxedNumber](#applicationjsonschema1boxednumber)
boxed class to store validated Number payloads | +| record | [ApplicationjsonSchema.ApplicationjsonSchema1BoxedString](#applicationjsonschema1boxedstring)
boxed class to store validated String payloads | +| record | [ApplicationjsonSchema.ApplicationjsonSchema1BoxedList](#applicationjsonschema1boxedlist)
boxed class to store validated List payloads | +| record | [ApplicationjsonSchema.ApplicationjsonSchema1BoxedMap](#applicationjsonschema1boxedmap)
boxed class to store validated Map payloads | +| static class | [ApplicationjsonSchema.ApplicationjsonSchema1](#applicationjsonschema1)
schema class | + +## ApplicationjsonSchema1Boxed +public sealed interface ApplicationjsonSchema1Boxed
+permits
+[ApplicationjsonSchema1BoxedVoid](#applicationjsonschema1boxedvoid), +[ApplicationjsonSchema1BoxedBoolean](#applicationjsonschema1boxedboolean), +[ApplicationjsonSchema1BoxedNumber](#applicationjsonschema1boxednumber), +[ApplicationjsonSchema1BoxedString](#applicationjsonschema1boxedstring), +[ApplicationjsonSchema1BoxedList](#applicationjsonschema1boxedlist), +[ApplicationjsonSchema1BoxedMap](#applicationjsonschema1boxedmap) + +sealed interface that stores validated payloads using boxed classes + +## ApplicationjsonSchema1BoxedVoid +public record ApplicationjsonSchema1BoxedVoid
+implements [ApplicationjsonSchema1Boxed](#applicationjsonschema1boxed) + +record that stores validated null payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| ApplicationjsonSchema1BoxedVoid(Nothing? data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| Nothing? | data()
validated payload | +| @Nullable Object | getData()
validated payload | + +## ApplicationjsonSchema1BoxedBoolean +public record ApplicationjsonSchema1BoxedBoolean
+implements [ApplicationjsonSchema1Boxed](#applicationjsonschema1boxed) + +record that stores validated boolean payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| ApplicationjsonSchema1BoxedBoolean(boolean data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| boolean | data()
validated payload | +| @Nullable Object | getData()
validated payload | + +## ApplicationjsonSchema1BoxedNumber +public record ApplicationjsonSchema1BoxedNumber
+implements [ApplicationjsonSchema1Boxed](#applicationjsonschema1boxed) + +record that stores validated Number payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| ApplicationjsonSchema1BoxedNumber(Number data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| Number | data()
validated payload | +| @Nullable Object | getData()
validated payload | + +## ApplicationjsonSchema1BoxedString +public record ApplicationjsonSchema1BoxedString
+implements [ApplicationjsonSchema1Boxed](#applicationjsonschema1boxed) + +record that stores validated String payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| ApplicationjsonSchema1BoxedString(String data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| String | data()
validated payload | +| @Nullable Object | getData()
validated payload | + +## ApplicationjsonSchema1BoxedList +public record ApplicationjsonSchema1BoxedList
+implements [ApplicationjsonSchema1Boxed](#applicationjsonschema1boxed) + +record that stores validated List payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| ApplicationjsonSchema1BoxedList(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 | + +## ApplicationjsonSchema1BoxedMap +public record ApplicationjsonSchema1BoxedMap
+implements [ApplicationjsonSchema1Boxed](#applicationjsonschema1boxed) + +record that stores validated Map payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| ApplicationjsonSchema1BoxedMap(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 | + +## ApplicationjsonSchema1 +public static class ApplicationjsonSchema1
+extends AnyTypeJsonSchema.AnyTypeJsonSchema1 + +A schema class that validates payloads + +| Methods Inherited from class org.openapijsonschematools.client.schemas.AnyTypeJsonSchema.AnyTypeJsonSchema1 | +| ------------------------------------------------------------------ | +| validate | +| validateAndBox | diff --git a/samples/client/petstore/kotlin/docs/paths/fakewildcardresponses/get/responses/code4xxresponse/content/applicationjson/ApplicationjsonSchema.md b/samples/client/petstore/kotlin/docs/paths/fakewildcardresponses/get/responses/code4xxresponse/content/applicationjson/ApplicationjsonSchema.md new file mode 100644 index 00000000000..b05260b1abf --- /dev/null +++ b/samples/client/petstore/kotlin/docs/paths/fakewildcardresponses/get/responses/code4xxresponse/content/applicationjson/ApplicationjsonSchema.md @@ -0,0 +1,144 @@ +# ApplicationjsonSchema +public class ApplicationjsonSchema
+ +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 + +## Nested Class Summary +| Modifier and Type | Class and Description | +| ----------------- | ---------------------- | +| sealed interface | [ApplicationjsonSchema.ApplicationjsonSchema1Boxed](#applicationjsonschema1boxed)
sealed interface for validated payloads | +| record | [ApplicationjsonSchema.ApplicationjsonSchema1BoxedVoid](#applicationjsonschema1boxedvoid)
boxed class to store validated null payloads | +| record | [ApplicationjsonSchema.ApplicationjsonSchema1BoxedBoolean](#applicationjsonschema1boxedboolean)
boxed class to store validated boolean payloads | +| record | [ApplicationjsonSchema.ApplicationjsonSchema1BoxedNumber](#applicationjsonschema1boxednumber)
boxed class to store validated Number payloads | +| record | [ApplicationjsonSchema.ApplicationjsonSchema1BoxedString](#applicationjsonschema1boxedstring)
boxed class to store validated String payloads | +| record | [ApplicationjsonSchema.ApplicationjsonSchema1BoxedList](#applicationjsonschema1boxedlist)
boxed class to store validated List payloads | +| record | [ApplicationjsonSchema.ApplicationjsonSchema1BoxedMap](#applicationjsonschema1boxedmap)
boxed class to store validated Map payloads | +| static class | [ApplicationjsonSchema.ApplicationjsonSchema1](#applicationjsonschema1)
schema class | + +## ApplicationjsonSchema1Boxed +public sealed interface ApplicationjsonSchema1Boxed
+permits
+[ApplicationjsonSchema1BoxedVoid](#applicationjsonschema1boxedvoid), +[ApplicationjsonSchema1BoxedBoolean](#applicationjsonschema1boxedboolean), +[ApplicationjsonSchema1BoxedNumber](#applicationjsonschema1boxednumber), +[ApplicationjsonSchema1BoxedString](#applicationjsonschema1boxedstring), +[ApplicationjsonSchema1BoxedList](#applicationjsonschema1boxedlist), +[ApplicationjsonSchema1BoxedMap](#applicationjsonschema1boxedmap) + +sealed interface that stores validated payloads using boxed classes + +## ApplicationjsonSchema1BoxedVoid +public record ApplicationjsonSchema1BoxedVoid
+implements [ApplicationjsonSchema1Boxed](#applicationjsonschema1boxed) + +record that stores validated null payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| ApplicationjsonSchema1BoxedVoid(Nothing? data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| Nothing? | data()
validated payload | +| @Nullable Object | getData()
validated payload | + +## ApplicationjsonSchema1BoxedBoolean +public record ApplicationjsonSchema1BoxedBoolean
+implements [ApplicationjsonSchema1Boxed](#applicationjsonschema1boxed) + +record that stores validated boolean payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| ApplicationjsonSchema1BoxedBoolean(boolean data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| boolean | data()
validated payload | +| @Nullable Object | getData()
validated payload | + +## ApplicationjsonSchema1BoxedNumber +public record ApplicationjsonSchema1BoxedNumber
+implements [ApplicationjsonSchema1Boxed](#applicationjsonschema1boxed) + +record that stores validated Number payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| ApplicationjsonSchema1BoxedNumber(Number data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| Number | data()
validated payload | +| @Nullable Object | getData()
validated payload | + +## ApplicationjsonSchema1BoxedString +public record ApplicationjsonSchema1BoxedString
+implements [ApplicationjsonSchema1Boxed](#applicationjsonschema1boxed) + +record that stores validated String payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| ApplicationjsonSchema1BoxedString(String data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| String | data()
validated payload | +| @Nullable Object | getData()
validated payload | + +## ApplicationjsonSchema1BoxedList +public record ApplicationjsonSchema1BoxedList
+implements [ApplicationjsonSchema1Boxed](#applicationjsonschema1boxed) + +record that stores validated List payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| ApplicationjsonSchema1BoxedList(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 | + +## ApplicationjsonSchema1BoxedMap +public record ApplicationjsonSchema1BoxedMap
+implements [ApplicationjsonSchema1Boxed](#applicationjsonschema1boxed) + +record that stores validated Map payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| ApplicationjsonSchema1BoxedMap(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 | + +## ApplicationjsonSchema1 +public static class ApplicationjsonSchema1
+extends AnyTypeJsonSchema.AnyTypeJsonSchema1 + +A schema class that validates payloads + +| Methods Inherited from class org.openapijsonschematools.client.schemas.AnyTypeJsonSchema.AnyTypeJsonSchema1 | +| ------------------------------------------------------------------ | +| validate | +| validateAndBox | diff --git a/samples/client/petstore/kotlin/docs/paths/fakewildcardresponses/get/responses/code5xxresponse/content/applicationjson/ApplicationjsonSchema.md b/samples/client/petstore/kotlin/docs/paths/fakewildcardresponses/get/responses/code5xxresponse/content/applicationjson/ApplicationjsonSchema.md new file mode 100644 index 00000000000..b05260b1abf --- /dev/null +++ b/samples/client/petstore/kotlin/docs/paths/fakewildcardresponses/get/responses/code5xxresponse/content/applicationjson/ApplicationjsonSchema.md @@ -0,0 +1,144 @@ +# ApplicationjsonSchema +public class ApplicationjsonSchema
+ +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 + +## Nested Class Summary +| Modifier and Type | Class and Description | +| ----------------- | ---------------------- | +| sealed interface | [ApplicationjsonSchema.ApplicationjsonSchema1Boxed](#applicationjsonschema1boxed)
sealed interface for validated payloads | +| record | [ApplicationjsonSchema.ApplicationjsonSchema1BoxedVoid](#applicationjsonschema1boxedvoid)
boxed class to store validated null payloads | +| record | [ApplicationjsonSchema.ApplicationjsonSchema1BoxedBoolean](#applicationjsonschema1boxedboolean)
boxed class to store validated boolean payloads | +| record | [ApplicationjsonSchema.ApplicationjsonSchema1BoxedNumber](#applicationjsonschema1boxednumber)
boxed class to store validated Number payloads | +| record | [ApplicationjsonSchema.ApplicationjsonSchema1BoxedString](#applicationjsonschema1boxedstring)
boxed class to store validated String payloads | +| record | [ApplicationjsonSchema.ApplicationjsonSchema1BoxedList](#applicationjsonschema1boxedlist)
boxed class to store validated List payloads | +| record | [ApplicationjsonSchema.ApplicationjsonSchema1BoxedMap](#applicationjsonschema1boxedmap)
boxed class to store validated Map payloads | +| static class | [ApplicationjsonSchema.ApplicationjsonSchema1](#applicationjsonschema1)
schema class | + +## ApplicationjsonSchema1Boxed +public sealed interface ApplicationjsonSchema1Boxed
+permits
+[ApplicationjsonSchema1BoxedVoid](#applicationjsonschema1boxedvoid), +[ApplicationjsonSchema1BoxedBoolean](#applicationjsonschema1boxedboolean), +[ApplicationjsonSchema1BoxedNumber](#applicationjsonschema1boxednumber), +[ApplicationjsonSchema1BoxedString](#applicationjsonschema1boxedstring), +[ApplicationjsonSchema1BoxedList](#applicationjsonschema1boxedlist), +[ApplicationjsonSchema1BoxedMap](#applicationjsonschema1boxedmap) + +sealed interface that stores validated payloads using boxed classes + +## ApplicationjsonSchema1BoxedVoid +public record ApplicationjsonSchema1BoxedVoid
+implements [ApplicationjsonSchema1Boxed](#applicationjsonschema1boxed) + +record that stores validated null payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| ApplicationjsonSchema1BoxedVoid(Nothing? data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| Nothing? | data()
validated payload | +| @Nullable Object | getData()
validated payload | + +## ApplicationjsonSchema1BoxedBoolean +public record ApplicationjsonSchema1BoxedBoolean
+implements [ApplicationjsonSchema1Boxed](#applicationjsonschema1boxed) + +record that stores validated boolean payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| ApplicationjsonSchema1BoxedBoolean(boolean data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| boolean | data()
validated payload | +| @Nullable Object | getData()
validated payload | + +## ApplicationjsonSchema1BoxedNumber +public record ApplicationjsonSchema1BoxedNumber
+implements [ApplicationjsonSchema1Boxed](#applicationjsonschema1boxed) + +record that stores validated Number payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| ApplicationjsonSchema1BoxedNumber(Number data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| Number | data()
validated payload | +| @Nullable Object | getData()
validated payload | + +## ApplicationjsonSchema1BoxedString +public record ApplicationjsonSchema1BoxedString
+implements [ApplicationjsonSchema1Boxed](#applicationjsonschema1boxed) + +record that stores validated String payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| ApplicationjsonSchema1BoxedString(String data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| String | data()
validated payload | +| @Nullable Object | getData()
validated payload | + +## ApplicationjsonSchema1BoxedList +public record ApplicationjsonSchema1BoxedList
+implements [ApplicationjsonSchema1Boxed](#applicationjsonschema1boxed) + +record that stores validated List payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| ApplicationjsonSchema1BoxedList(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 | + +## ApplicationjsonSchema1BoxedMap +public record ApplicationjsonSchema1BoxedMap
+implements [ApplicationjsonSchema1Boxed](#applicationjsonschema1boxed) + +record that stores validated Map payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| ApplicationjsonSchema1BoxedMap(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 | + +## ApplicationjsonSchema1 +public static class ApplicationjsonSchema1
+extends AnyTypeJsonSchema.AnyTypeJsonSchema1 + +A schema class that validates payloads + +| Methods Inherited from class org.openapijsonschematools.client.schemas.AnyTypeJsonSchema.AnyTypeJsonSchema1 | +| ------------------------------------------------------------------ | +| validate | +| validateAndBox | diff --git a/samples/client/petstore/kotlin/docs/paths/foo/FooGet.md b/samples/client/petstore/kotlin/docs/paths/foo/FooGet.md new file mode 100644 index 00000000000..da4a2fc69ce --- /dev/null +++ b/samples/client/petstore/kotlin/docs/paths/foo/FooGet.md @@ -0,0 +1,143 @@ +# FooGet + +public class FooGet + +A class that contains necessary endpoint classes +- a class that calls the endpoint method using the http verb +- a class that calls the endpoint method using the operationId name +- class(es) to store the request inputs +- builder(s) to set the request input data + +## Nested Class Summary +| Modifier and Type | Class and Description | +| ----------------- | --------------------- | +| static class | [Get](#get)
The class that has a get method to call the endpoint | +| interface | [FooGetOperation](#foogetoperation)
The interface that has a fooGet method to call the endpoint | +| static class | [GetRequest](#getrequest)
The request inputs class | +| static class | [GetRequestBuilder](#getrequestbuilder)
A builder for the request input class | + +## Get +public static class Get extends ApiClient.ApiClient1 implements GetOperation
+ +a class that allows one to call the endpoint using a method named get + +### 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.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.FooGetCodedefaultResponse; +import org.openapijsonschematools.client.paths.foo.get.FooGetServerInfo; +import org.openapijsonschematools.client.paths.foo.FooGet; +import org.openapijsonschematools.client.paths.foo.get.FooGetResponses; + +import java.io.IOException; +import java.util.Arrays; +import java.util.List; +import java.util.Map; +import java.util.AbstractMap; + +// if you want to use a server that is not SERVER_0 pass it in here and change the ServerIndex input below +ApiConfiguration.ServerInfo serverInfo = new ApiConfiguration.ServerInfoBuilder() + .fooGetServerInfo( + new FooGetServerInfo.FooGetServerInfoBuilder() + .fooGetServer0(new FooGetServer0()) + .build() + ) + .build(); +ApiConfiguration.ServerIndexInfo serverIndexInfo = new ApiConfiguration.ServerIndexInfoBuilder() + .fooGetServerInfoServerIndex(FooGetServerInfo.ServerIndex.SERVER_0) + .build(); +Duration timeout = Duration.ofSeconds(1L); +Map> defaultHeaders = Map.of("User-Agent", List.of("OpenAPI-JSON-Schema-Generator/1.0.0/java")); +ApiConfiguration apiConfiguration = new ApiConfiguration( + serverInfo + serverIndexInfo, + timeout, + defaultHeaders +); +SchemaConfiguration schemaConfiguration = new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().build()); +FooGet.Get apiClient = new FooGet.Get(apiConfiguration, schemaConfiguration); + + +var request = new FooGet.GetRequestBuilder().build(); + +FooGetResponses.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; +} +FooGetResponses.EndpointFooGetCodedefaultResponse castResponse = (FooGetResponses.EndpointFooGetCodedefaultResponse) response; +FooGetCodedefaultResponse.ApplicationjsonResponseBody deserializedBody = (FooGetCodedefaultResponse.ApplicationjsonResponseBody) castResponse.body; +// handle deserialized body here +``` +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| Get(ApiConfiguration apiConfiguration, SchemaConfiguration schemaConfiguration)
Creates an instance | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| [FooGetResponses.EndpointResponse](../../paths/foo/get/FooGetResponses.md#endpointresponse) | get([GetRequest](#getrequest) request) | + +## FooGetOperation +public interface FooGetOperation
+ +an interface that allows one to call the endpoint using a method named fooGet by the operationId + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| [FooGetResponses.EndpointResponse](../../paths/foo/get/FooGetResponses.md#endpointresponse) | fooGet([GetRequest](#getrequest) request) | + +## GetRequest +public static class GetRequest
+ +a class that stores the final request inputs + +### Field Summary +| Modifier and Type | Field and Description | +| ----------------- | --------------------- | +| [FooGetServerInfo.@Nullable ServerIndex](../../paths/foo/get/FooGetServerInfo.md#serverindex) | serverIndex
optional. Note: this will override the value in apiConfiguration | +| @Nullable Duration | timeout
optional. Note: this will override the value in apiConfiguration | + +## GetRequestBuilder +public static class GetRequestBuilder
+ +a builder for request inputs + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| GetRequestBuilder()
Creates a builder that contains null for all parameters | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| [GetRequest](#getrequest) | build()
Returns the request input used to call an endpoint method | +| [GetRequestBuilder](#getrequestbuilder) | serverIndex([FooGetServerInfo.ServerIndex](../../paths/foo/get/FooGetServerInfo.md#serverindex) serverIndex)
sets the optional property. Note: this will override the value in apiConfiguration | +| [GetRequestBuilder](#getrequestbuilder) | timeout(Duration timeout)
sets the optional property. Note: this will override the value in apiConfiguration | + +[[Back to top]](#top) [[Back to README]](../../../README.md) diff --git a/samples/client/petstore/kotlin/docs/paths/foo/get/FooGetResponses.md b/samples/client/petstore/kotlin/docs/paths/foo/get/FooGetResponses.md new file mode 100644 index 00000000000..ab23aea0db5 --- /dev/null +++ b/samples/client/petstore/kotlin/docs/paths/foo/get/FooGetResponses.md @@ -0,0 +1,29 @@ +# FooGetResponses + +public class FooGetResponses + +A class that contains necessary responses classes +- a sealed interface, EndpointResponse, that stores endpoint responses +- records for each endpoint response + +## Nested Class Summary +| Modifier and Type | Class and Description | +| ----------------- | --------------------- | +| sealed interface | [EndpointResponse](#endpointresponse)
stores the endpoint responses | +| record | [EndpointFooGetCodedefaultResponse](#endpointfoogetcodedefaultresponse)
the response for default | + +## EndpointResponse +public sealed interface EndpointResponse permits
+[EndpointFooGetCodedefaultResponse](#endpointfoogetcodedefaultresponse) + +a sealed interface that stores endpoint responses + +## EndpointFooGetCodedefaultResponse +public record EndpointFooGetCodedefaultResponse( + HttpResponse response, + [FooGetCodedefaultResponse.SealedResponseBody](../../../paths/foo/get/responses/FooGetCodedefaultResponse.md#sealedresponsebody) body, + Nothing? headers +) implements EndpointResponse, ApiResponse
+ +a class that stores an endpoint response + diff --git a/samples/client/petstore/kotlin/docs/paths/foo/get/FooGetServerInfo.md b/samples/client/petstore/kotlin/docs/paths/foo/get/FooGetServerInfo.md new file mode 100644 index 00000000000..67aede6fd0e --- /dev/null +++ b/samples/client/petstore/kotlin/docs/paths/foo/get/FooGetServerInfo.md @@ -0,0 +1,62 @@ +# FooGetServerInfo +FooGetServerInfo.java + +public class FooGetServerInfo + +A class that provides a server, and any needed server info classes +- a class that is a ServerProvider +- a builder for the ServerProvider +- an enum class that stores server index values + +## Nested Class Summary +| Modifier and Type | Class and Description | +| ----------------- | --------------------- | +| static class | [FooGetServerInfo.FooGetServerInfo1](#foogetserverinfo1)
class that stores a server index | +| static class | [FooGetServerInfo.FooGetServerInfoBuilder](#foogetserverinfobuilder)
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(@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) | + +## FooGetServerInfoBuilder + +a builder for [FooGetServerInfo1](#foogetserverinfo1) + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| FooGetServerInfoBuilder()
Creates an instance | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| [FooGetServerInfoBuilder](#foogetserverinfobuilder) | fooGetServer0([FooGetServer0](../../../paths/foo/get/servers/FooGetServer0.md) server0)
sets the server | +| [FooGetServerInfoBuilder](#foogetserverinfobuilder) | fooGetServer1([FooGetServer1](../../../paths/foo/get/servers/FooGetServer1.md) server1)
sets the server | +| [FooGetServerInfo1](#foogetserverinfo1) | build() | + +## ServerIndex +enum ServerIndex
+ +### Enum Constant Summary +| Enum Constant And Description | +| ----------------------------- | +| SERVER_0
server 0 | +| SERVER_1
server 1 | diff --git a/samples/client/petstore/kotlin/docs/paths/foo/get/responses/FooGetCodedefaultResponse.md b/samples/client/petstore/kotlin/docs/paths/foo/get/responses/FooGetCodedefaultResponse.md new file mode 100644 index 00000000000..0a25708c1c2 --- /dev/null +++ b/samples/client/petstore/kotlin/docs/paths/foo/get/responses/FooGetCodedefaultResponse.md @@ -0,0 +1,87 @@ +# FooGetCodedefaultResponse + +public class FooGetCodedefaultResponse + +A class that contains necessary nested response classes +- SealedMediaType, a sealed interface which contains all the schema/encoding info for each contentType +- records which implement SealedMediaType, the concrete media types +- SealedResponseBody, a sealed interface which contains all the contentType/schema types +- records which implement SealedResponseBody, the concrete response body types +- a class that extends ResponseDeserializer and is used to deserialize responses + +## Nested Class Summary +| Modifier and Type | Class and Description | +| ----------------- | --------------------- | +| sealed interface | [FooGetCodedefaultResponse.SealedMediaType](#sealedmediatype)
media type sealed interface | +| record | [FooGetCodedefaultResponse.ApplicationjsonMediaType](#applicationjsonmediatype)
record storing schema + encoding for a specific contentType | +| sealed interface | [FooGetCodedefaultResponse.SealedResponseBody](#sealedresponsebody)
response body sealed interface | +| record | [FooGetCodedefaultResponse.ApplicationjsonResponseBody](#applicationjsonresponsebody)
implements sealed interface to store response body | +| static class | [FooGetCodedefaultResponse.FooGetCodedefaultResponse1](#foogetcodedefaultresponse1)
class that deserializes responses | + +## SealedMediaType +public sealed interface SealedMediaType
+permits
+[ApplicationjsonMediaType](#applicationjsonmediatype) + +sealed interface that stores schema and encoding info + +## ApplicationjsonMediaType +public record ApplicationjsonMediaType
+implements [SealedMediaType](#sealedmediatype), MediaType<[ApplicationjsonSchema.ApplicationjsonSchema1](../../../../paths/foo/get/responses/codedefaultresponse/content/applicationjson/ApplicationjsonSchema.md#applicationjsonschema1), Nothing?> + +class storing schema info for a specific contentType + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| ApplicationjsonMediaType()
Creates an instance | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| [ApplicationjsonSchema.ApplicationjsonSchema1](../../../../paths/foo/get/responses/codedefaultresponse/content/applicationjson/ApplicationjsonSchema.md#applicationjsonschema1) | schema()
the schema for this MediaType | +| Nothing? | encoding()
the encoding info | + +## SealedResponseBody +public sealed interface SealedResponseBody
+permits
+[ApplicationjsonResponseBody](#applicationjsonresponsebody) + +sealed interface that stores response body + +## ApplicationjsonResponseBody +public record ApplicationjsonResponseBody
+implements [SealedResponseBody](#sealedresponsebody) + +A record class to store response body for contentType="application/json" + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| ApplicationjsonResponseBody(ApplicationjsonSchema.[ApplicationjsonSchema1Boxed](../../../../paths/foo/get/responses/codedefaultresponse/content/applicationjson/ApplicationjsonSchema.md#applicationjsonschema1boxed) body)
Creates an instance | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| ApplicationjsonSchema.[ApplicationjsonSchema1Boxed](../../../../paths/foo/get/responses/codedefaultresponse/content/applicationjson/ApplicationjsonSchema.md#applicationjsonschema1boxed) | body()
returns the body passed in in the constructor | + +## FooGetCodedefaultResponse1 +public static class FooGetCodedefaultResponse1
+extends ResponseDeserializer<[SealedResponseBody](#sealedresponsebody), Nothing?, [SealedMediaType](#sealedmediatype)> + +a class that deserializes responses + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| FooGetCodedefaultResponse1()
Creates an instance | + +### Field Summary +| Modifier and Type | Field and Description | +| ----------------- | --------------------- | +| 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 | +| ----------------- | ---------------------- | +| ApiResponse<[SealedResponseBody](#sealedresponsebody), Nothing?> | deserialize(HttpResponse response, SchemaConfiguration configuration)
called by endpoint when deserialize responses | diff --git a/samples/client/petstore/kotlin/docs/paths/foo/get/responses/codedefaultresponse/content/applicationjson/ApplicationjsonSchema.md b/samples/client/petstore/kotlin/docs/paths/foo/get/responses/codedefaultresponse/content/applicationjson/ApplicationjsonSchema.md new file mode 100644 index 00000000000..666f6014f03 --- /dev/null +++ b/samples/client/petstore/kotlin/docs/paths/foo/get/responses/codedefaultresponse/content/applicationjson/ApplicationjsonSchema.md @@ -0,0 +1,134 @@ +# ApplicationjsonSchema +public class ApplicationjsonSchema
+ +A class that contains necessary nested +- schema classes (which validate payloads), extends JsonSchema +- sealed interfaces which store validated payloads, java version of a sum type +- boxed classes which store validated payloads, sealed permits class implementations +- classes to store validated map payloads, extends FrozenMap +- classes to build inputs for map payloads + +## Nested Class Summary +| Modifier and Type | Class and Description | +| ----------------- | ---------------------- | +| sealed interface | [ApplicationjsonSchema.ApplicationjsonSchema1Boxed](#applicationjsonschema1boxed)
sealed interface for validated payloads | +| record | [ApplicationjsonSchema.ApplicationjsonSchema1BoxedMap](#applicationjsonschema1boxedmap)
boxed class to store validated Map payloads | +| static class | [ApplicationjsonSchema.ApplicationjsonSchema1](#applicationjsonschema1)
schema class | +| static class | [ApplicationjsonSchema.ApplicationjsonSchemaMapBuilder](#applicationjsonschemamapbuilder)
builder for Map payloads | +| static class | [ApplicationjsonSchema.ApplicationjsonSchemaMap](#applicationjsonschemamap)
output class for Map payloads | + +## ApplicationjsonSchema1Boxed +public sealed interface ApplicationjsonSchema1Boxed
+permits
+[ApplicationjsonSchema1BoxedMap](#applicationjsonschema1boxedmap) + +sealed interface that stores validated payloads using boxed classes + +## ApplicationjsonSchema1BoxedMap +public record ApplicationjsonSchema1BoxedMap
+implements [ApplicationjsonSchema1Boxed](#applicationjsonschema1boxed) + +record that stores validated Map payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| ApplicationjsonSchema1BoxedMap([ApplicationjsonSchemaMap](#applicationjsonschemamap) data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| [ApplicationjsonSchemaMap](#applicationjsonschemamap) | data()
validated payload | +| @Nullable Object | getData()
validated payload | + +## ApplicationjsonSchema1 +public static class ApplicationjsonSchema1
+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.responses.codedefaultresponse.content.applicationjson.ApplicationjsonSchema; + +import java.util.Arrays; +import java.util.List; +import java.util.AbstractMap; + +static final SchemaConfiguration configuration = new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().build()); + +// Map validation +ApplicationjsonSchema.ApplicationjsonSchemaMap validatedPayload = + ApplicationjsonSchema.ApplicationjsonSchema1.validate( + new ApplicationjsonSchema.ApplicationjsonSchemaMapBuilder() + .setString( + MapUtils.makeMap( + new AbstractMap.SimpleEntry( + "bar", + "a" + ) + ) + ) + .build(), + configuration +); +``` + +### Field Summary +| Modifier and Type | Field and Description | +| ----------------- | ---------------------- | +| Set> | type = Set.of(Map.class) | +| Map> | properties = Map.ofEntries(
    new PropertyEntry("string", [Foo.Foo1.class](../../../../../../../components/schemas/Foo.md#foo1))
)
| + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| [ApplicationjsonSchemaMap](#applicationjsonschemamap) | validate([Map<?, ?>](#applicationjsonschemamapbuilder) arg, SchemaConfiguration configuration) | +| [ApplicationjsonSchema1BoxedMap](#applicationjsonschema1boxedmap) | validateAndBox([Map<?, ?>](#applicationjsonschemamapbuilder) arg, SchemaConfiguration configuration) | +| [ApplicationjsonSchema1Boxed](#applicationjsonschema1boxed) | validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) | +| @Nullable Object | validate(@Nullable Object arg, SchemaConfiguration configuration) | + +## ApplicationjsonSchemaMapBuilder +public class ApplicationjsonSchemaMapBuilder
+builder for `Map` + +A class that builds the Map input type + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| ApplicationjsonSchemaMapBuilder()
Creates a builder that contains an empty map | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| Map | build()
Returns map input that should be used with Schema.validate | +| [ApplicationjsonSchemaMapBuilder](#applicationjsonschemamapbuilder) | setString(Map value) | +| [ApplicationjsonSchemaMapBuilder](#applicationjsonschemamapbuilder) | additionalProperty(String key, Nothing? value) | +| [ApplicationjsonSchemaMapBuilder](#applicationjsonschemamapbuilder) | additionalProperty(String key, boolean value) | +| [ApplicationjsonSchemaMapBuilder](#applicationjsonschemamapbuilder) | additionalProperty(String key, String value) | +| [ApplicationjsonSchemaMapBuilder](#applicationjsonschemamapbuilder) | additionalProperty(String key, int value) | +| [ApplicationjsonSchemaMapBuilder](#applicationjsonschemamapbuilder) | additionalProperty(String key, float value) | +| [ApplicationjsonSchemaMapBuilder](#applicationjsonschemamapbuilder) | additionalProperty(String key, long value) | +| [ApplicationjsonSchemaMapBuilder](#applicationjsonschemamapbuilder) | additionalProperty(String key, double value) | +| [ApplicationjsonSchemaMapBuilder](#applicationjsonschemamapbuilder) | additionalProperty(String key, List value) | +| [ApplicationjsonSchemaMapBuilder](#applicationjsonschemamapbuilder) | additionalProperty(String key, Map value) | + +## ApplicationjsonSchemaMap +public static class ApplicationjsonSchemaMap
+extends FrozenMap + +A class to store validated Map payloads + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| static [ApplicationjsonSchemaMap](#applicationjsonschemamap) | of([Map](#applicationjsonschemamapbuilder) arg, SchemaConfiguration configuration) | +| @Nullable Object | get(String key)
This schema has invalid Java names so this method must be used when you access instance["string"], | +| @Nullable Object | getAdditionalProperty(String name)
provides type safety for additional properties | diff --git a/samples/client/petstore/kotlin/docs/paths/foo/get/servers/FooGetServer0.md b/samples/client/petstore/kotlin/docs/paths/foo/get/servers/FooGetServer0.md new file mode 100644 index 00000000000..31c72b6c42f --- /dev/null +++ b/samples/client/petstore/kotlin/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/kotlin/docs/paths/foo/get/servers/FooGetServer1.md b/samples/client/petstore/kotlin/docs/paths/foo/get/servers/FooGetServer1.md new file mode 100644 index 00000000000..a993b2627e9 --- /dev/null +++ b/samples/client/petstore/kotlin/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([FooGetServer1Variables.VariablesMap](../../../../paths/foo/get/servers/server1/FooGetServer1Variables.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}" | +| [FooGetServer1Variables.VariablesMap](../../../../paths/foo/get/servers/server1/FooGetServer1Variables.md#variablesmap) | variables | diff --git a/samples/client/petstore/kotlin/docs/paths/foo/get/servers/server1/FooGetServer1Variables.md b/samples/client/petstore/kotlin/docs/paths/foo/get/servers/server1/FooGetServer1Variables.md new file mode 100644 index 00000000000..9eb0202effb --- /dev/null +++ b/samples/client/petstore/kotlin/docs/paths/foo/get/servers/server1/FooGetServer1Variables.md @@ -0,0 +1,355 @@ +# FooGetServer1Variables +public class FooGetServer1Variables
+ +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 | [FooGetServer1Variables.FooGetServer1Variables1Boxed](#foogetserver1variables1boxed)
sealed interface for validated payloads | +| record | [FooGetServer1Variables.FooGetServer1Variables1BoxedMap](#foogetserver1variables1boxedmap)
boxed class to store validated Map payloads | +| static class | [FooGetServer1Variables.FooGetServer1Variables1](#foogetserver1variables1)
schema class | +| static class | [FooGetServer1Variables.VariablesMapBuilder](#variablesmapbuilder)
builder for Map payloads | +| static class | [FooGetServer1Variables.VariablesMap](#variablesmap)
output class for Map payloads | +| sealed interface | [FooGetServer1Variables.VersionBoxed](#versionboxed)
sealed interface for validated payloads | +| record | [FooGetServer1Variables.VersionBoxedString](#versionboxedstring)
boxed class to store validated String payloads | +| static class | [FooGetServer1Variables.Version](#version)
schema class | +| enum | [FooGetServer1Variables.StringVersionEnums](#stringversionenums)
String enum | +| sealed interface | [FooGetServer1Variables.AdditionalPropertiesBoxed](#additionalpropertiesboxed)
sealed interface for validated payloads | +| record | [FooGetServer1Variables.AdditionalPropertiesBoxedVoid](#additionalpropertiesboxedvoid)
boxed class to store validated null payloads | +| record | [FooGetServer1Variables.AdditionalPropertiesBoxedBoolean](#additionalpropertiesboxedboolean)
boxed class to store validated boolean payloads | +| record | [FooGetServer1Variables.AdditionalPropertiesBoxedNumber](#additionalpropertiesboxednumber)
boxed class to store validated Number payloads | +| record | [FooGetServer1Variables.AdditionalPropertiesBoxedString](#additionalpropertiesboxedstring)
boxed class to store validated String payloads | +| record | [FooGetServer1Variables.AdditionalPropertiesBoxedList](#additionalpropertiesboxedlist)
boxed class to store validated List payloads | +| record | [FooGetServer1Variables.AdditionalPropertiesBoxedMap](#additionalpropertiesboxedmap)
boxed class to store validated Map payloads | +| static class | [FooGetServer1Variables.AdditionalProperties](#additionalproperties)
schema class | + +## FooGetServer1Variables1Boxed +public sealed interface FooGetServer1Variables1Boxed
+permits
+[FooGetServer1Variables1BoxedMap](#foogetserver1variables1boxedmap) + +sealed interface that stores validated payloads using boxed classes + +## FooGetServer1Variables1BoxedMap +public record FooGetServer1Variables1BoxedMap
+implements [FooGetServer1Variables1Boxed](#foogetserver1variables1boxed) + +record that stores validated Map payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| FooGetServer1Variables1BoxedMap([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 | + +## FooGetServer1Variables1 +public static class FooGetServer1Variables1
+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.FooGetServer1Variables; + +import java.util.Arrays; +import java.util.List; +import java.util.AbstractMap; + +static final SchemaConfiguration configuration = new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().build()); + +// Map validation +FooGetServer1Variables.VariablesMap validatedPayload = + FooGetServer1Variables.FooGetServer1Variables1.validate( + new FooGetServer1Variables.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) | +| [FooGetServer1Variables1BoxedMap](#foogetserver1variables1boxedmap) | validateAndBox([Map<?, ?>](#variablesmapbuilder) arg, SchemaConfiguration configuration) | +| [FooGetServer1Variables1Boxed](#foogetserver1variables1boxed) | 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.FooGetServer1Variables; + +import java.util.Arrays; +import java.util.List; +import java.util.AbstractMap; + +static final SchemaConfiguration configuration = new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().build()); + +// String validation +String validatedPayload = FooGetServer1Variables.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(Nothing? data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| Nothing? | 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/kotlin/docs/paths/pet/PetPost.md b/samples/client/petstore/kotlin/docs/paths/pet/PetPost.md new file mode 100644 index 00000000000..25e3707601c --- /dev/null +++ b/samples/client/petstore/kotlin/docs/paths/pet/PetPost.md @@ -0,0 +1,238 @@ +# PetPost + +public class PetPost + +A class that contains necessary endpoint classes +- a class that calls the endpoint method using the http verb +- a class that calls the endpoint method using the operationId name +- class(es) to store the request inputs +- builder(s) to set the request input data + +## Nested Class Summary +| Modifier and Type | Class and Description | +| ----------------- | --------------------- | +| static class | [Post](#post)
The class that has a post method to call the endpoint | +| interface | [AddPetOperation](#addpetoperation)
The interface that has a addPet method to call the endpoint | +| static class | [PostRequest](#postrequest)
The final request inputs class | +| static class | [PostNullableRequest](#postnullablerequest)
The initial request inputs class | +| static class | [Post0RequestBuilder](#post0requestbuilder)
A builder for the request input class | +| static class | [PostRequestBuilder](#postrequestbuilder)
A builder for the request input class | + +## Post +public static class Post 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.PetPostRequestBody; +import org.openapijsonschematools.client.components.schemas.Pet; +import org.openapijsonschematools.client.servers.RootServer0; +import org.openapijsonschematools.client.servers.RootServer1; +import org.openapijsonschematools.client.servers.RootServer2; +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.PetPostCode200Response; +import org.openapijsonschematools.client.paths.pet.post.responses.PetPostCode405Response; +import org.openapijsonschematools.client.servers.RootServerInfo; +import org.openapijsonschematools.client.paths.pet.PetPost; +import org.openapijsonschematools.client.paths.pet.post.PetPostResponses; + +import java.io.IOException; +import java.util.Arrays; +import java.util.List; +import java.util.Map; +import java.util.AbstractMap; + +// if you want to use a server that is not SERVER_0 pass it in here and change the ServerIndex input below +ApiConfiguration.ServerInfo serverInfo = new ApiConfiguration.ServerInfoBuilder() + .rootServerInfo( + new RootServerInfo.RootServerInfoBuilder() + .rootServer0(new RootServer0()) + .build() + ) + .build(); +ApiConfiguration.ServerIndexInfo serverIndexInfo = new ApiConfiguration.ServerIndexInfoBuilder() + .rootServerInfoServerIndex(RootServerInfo.ServerIndex.SERVER_0) + .build(); +List securitySchemes = new ArrayList(); +securitySchemes.add( + new ApiKey("someApiKey"); +); +ApiConfiguration.SecurityIndexInfo securityIndexInfo = new ApiConfiguration.SecurityIndexInfoBuilder() + .petPostSecurityRequirementObject0SecurityIndex(PetPostSecurityRequirementObject0.SecurityIndex.SECURITY_0) + .build(); +Duration timeout = Duration.ofSeconds(1L); +Map> defaultHeaders = Map.of("User-Agent", List.of("OpenAPI-JSON-Schema-Generator/1.0.0/java")); +ApiConfiguration apiConfiguration = new ApiConfiguration( + serverInfo + serverIndexInfo, + securitySchemes, + securityIndexInfo, + timeout, + defaultHeaders +); +SchemaConfiguration schemaConfiguration = new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().build()); +PetPost.Post apiClient = new PetPost.Post(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 +); +PetPostRequestBody.SealedRequestBody requestBody = new PetPostRequestBody.ApplicationjsonRequestBody(requestBodyPayload); + +var request = new PetPost.PostRequestBuilder() + .requestBody(requestBody) + .build(); + +PetPostResponses.EndpointResponse response; +try { + response = apiClient.post(request); +} catch (PetPostCode405Response.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; +} +PetPostResponses.EndpointPetPostCode200Response castResponse = (PetPostResponses.EndpointPetPostCode200Response) response; +``` +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| Post(ApiConfiguration apiConfiguration, SchemaConfiguration schemaConfiguration)
Creates an instance | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| [PetPostResponses.EndpointResponse](../../paths/pet/post/PetPostResponses.md#endpointresponse) | post([PostRequest](#postrequest) request) | + +## AddPetOperation +public interface AddPetOperation
+ +an interface that allows one to call the endpoint using a method named addPet by the operationId + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| [PetPostResponses.EndpointResponse](../../paths/pet/post/PetPostResponses.md#endpointresponse) | addPet([PostRequest](#postrequest) request) | + +## PostRequest +public static class PostRequest
+ +a class that stores the final request inputs + +### Field Summary +| Modifier and Type | Field and Description | +| ----------------- | --------------------- | +| [PetPostRequestBody.SealedRequestBody](../../paths/pet/post/PetPostRequestBody.md#sealedrequestbody) | requestBody | +| [RootServerInfo.@Nullable ServerIndex](../../RootServerInfo.md#serverindex) | serverIndex
optional. Note: this will override the value in apiConfiguration | +| [PetPostSecurityInfo.@Nullable SecurityIndex](../../paths/pet/post/PetPostSecurityInfo.md#securityindex) | securityIndex
optional. Note: this will override the value in apiConfiguration | +| @Nullable Duration | timeout
optional. Note: this will override the value in apiConfiguration | + +## PostNullableRequest +public static class PostNullableRequest
+ +a class that stores the initial request inputs + +### Field Summary +| Modifier and Type | Field and Description | +| ----------------- | --------------------- | +| [PetPostRequestBody.@Nullable SealedRequestBody](../../paths/pet/post/PetPostRequestBody.md#sealedrequestbody) | requestBody | +| [RootServerInfo.@Nullable ServerIndex](../../RootServerInfo.md#serverindex) | serverIndex | +| [PetPostSecurityInfo.@Nullable SecurityIndex](../../paths/pet/post/PetPostSecurityInfo.md#securityindex) | securityIndex | +| @Nullable Duration | timeout | + +## Post0RequestBuilder +public static class Post0RequestBuilder
+ +a builder for request inputs + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| Post0RequestBuilder(Post0RequestBuilder instance)
Creates a builder that contains the passed instance | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| [PostRequest](#postrequest) | build()
Returns the request input used to call an endpoint method | +| [Post0RequestBuilder](#post0requestbuilder) | serverIndex([RootServerInfo.ServerIndex](../../RootServerInfo.md#serverindex) serverIndex)
sets the optional property. Note: this will override the value in apiConfiguration | +| [Post0RequestBuilder](#post0requestbuilder) | securityIndex([PetPostSecurityInfo.SecurityIndex](../../paths/pet/post/PetPostSecurityInfo.md#securityindex) securityIndex)
sets the optional property. Note: this will override the value in apiConfiguration | +| [Post0RequestBuilder](#post0requestbuilder) | timeout(Duration timeout)
sets the optional property. Note: this will override the value in apiConfiguration | + +## PostRequestBuilder +public static class PostRequestBuilder
+ +a builder for request inputs + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| PostRequestBuilder()
Creates a builder that contains null for all parameters | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| [Post0RequestBuilder](#post0requestbuilder) | requestBody([PetPostRequestBody.SealedRequestBody](../../paths/pet/post/PetPostRequestBody.md#sealedrequestbody) requestBody)
sets the property | + +[[Back to top]](#top) [[Back to README]](../../../README.md) diff --git a/samples/client/petstore/kotlin/docs/paths/pet/PetPut.md b/samples/client/petstore/kotlin/docs/paths/pet/PetPut.md new file mode 100644 index 00000000000..404ddd48a9f --- /dev/null +++ b/samples/client/petstore/kotlin/docs/paths/pet/PetPut.md @@ -0,0 +1,234 @@ +# PetPut + +public class PetPut + +A class that contains necessary endpoint classes +- a class that calls the endpoint method using the http verb +- a class that calls the endpoint method using the operationId name +- class(es) to store the request inputs +- builder(s) to set the request input data + +## Nested Class Summary +| Modifier and Type | Class and Description | +| ----------------- | --------------------- | +| static class | [Put](#put)
The class that has a put method to call the endpoint | +| interface | [UpdatePetOperation](#updatepetoperation)
The interface that has a updatePet method to call the endpoint | +| static class | [PutRequest](#putrequest)
The final request inputs class | +| static class | [PutNullableRequest](#putnullablerequest)
The initial request inputs class | +| static class | [Put0RequestBuilder](#put0requestbuilder)
A builder for the request input class | +| static class | [PutRequestBuilder](#putrequestbuilder)
A builder for the request input class | + +## Put +public static class Put extends ApiClient.ApiClient1 implements PutOperation
+ +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.PetPutRequestBody; +import org.openapijsonschematools.client.components.schemas.Pet; +import org.openapijsonschematools.client.servers.RootServer0; +import org.openapijsonschematools.client.servers.RootServer1; +import org.openapijsonschematools.client.servers.RootServer2; +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.pet.put.responses.PetPutCode400Response; +import org.openapijsonschematools.client.paths.pet.put.responses.PetPutCode404Response; +import org.openapijsonschematools.client.paths.pet.put.responses.PetPutCode405Response; +import org.openapijsonschematools.client.servers.RootServerInfo; +import org.openapijsonschematools.client.paths.pet.PetPut; +import org.openapijsonschematools.client.paths.pet.put.PetPutResponses; + +import java.io.IOException; +import java.util.Arrays; +import java.util.List; +import java.util.Map; +import java.util.AbstractMap; + +// if you want to use a server that is not SERVER_0 pass it in here and change the ServerIndex input below +ApiConfiguration.ServerInfo serverInfo = new ApiConfiguration.ServerInfoBuilder() + .rootServerInfo( + new RootServerInfo.RootServerInfoBuilder() + .rootServer0(new RootServer0()) + .build() + ) + .build(); +ApiConfiguration.ServerIndexInfo serverIndexInfo = new ApiConfiguration.ServerIndexInfoBuilder() + .rootServerInfoServerIndex(RootServerInfo.ServerIndex.SERVER_0) + .build(); +List securitySchemes = new ArrayList(); +ApiConfiguration.SecurityIndexInfo securityIndexInfo = new ApiConfiguration.SecurityIndexInfoBuilder() + .petPutSecurityRequirementObject0SecurityIndex(PetPutSecurityRequirementObject0.SecurityIndex.SECURITY_0) + .build(); +Duration timeout = Duration.ofSeconds(1L); +Map> defaultHeaders = Map.of("User-Agent", List.of("OpenAPI-JSON-Schema-Generator/1.0.0/java")); +ApiConfiguration apiConfiguration = new ApiConfiguration( + serverInfo + serverIndexInfo, + securitySchemes, + securityIndexInfo, + timeout, + defaultHeaders +); +SchemaConfiguration schemaConfiguration = new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().build()); +PetPut.Put apiClient = new PetPut.Put(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 +); +PetPutRequestBody.SealedRequestBody requestBody = new PetPutRequestBody.ApplicationjsonRequestBody(requestBodyPayload); + +var request = new PetPut.PutRequestBuilder() + .requestBody(requestBody) + .build(); + +Nothing? response; +try { + response = apiClient.put(request); +} catch (PetPutCode400Response.ResponseApiException | PetPutCode404Response.ResponseApiException | PetPutCode405Response.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 | +| --------------------------- | +| Put(ApiConfiguration apiConfiguration, SchemaConfiguration schemaConfiguration)
Creates an instance | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| Nothing? | put([PutRequest](#putrequest) request) | + +## UpdatePetOperation +public interface UpdatePetOperation
+ +an interface that allows one to call the endpoint using a method named updatePet by the operationId + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| Nothing? | updatePet([PutRequest](#putrequest) request) | + +## PutRequest +public static class PutRequest
+ +a class that stores the final request inputs + +### Field Summary +| Modifier and Type | Field and Description | +| ----------------- | --------------------- | +| [PetPutRequestBody.SealedRequestBody](../../paths/pet/put/PetPutRequestBody.md#sealedrequestbody) | requestBody | +| [RootServerInfo.@Nullable ServerIndex](../../RootServerInfo.md#serverindex) | serverIndex
optional. Note: this will override the value in apiConfiguration | +| [PetPutSecurityInfo.@Nullable SecurityIndex](../../paths/pet/put/PetPutSecurityInfo.md#securityindex) | securityIndex
optional. Note: this will override the value in apiConfiguration | +| @Nullable Duration | timeout
optional. Note: this will override the value in apiConfiguration | + +## PutNullableRequest +public static class PutNullableRequest
+ +a class that stores the initial request inputs + +### Field Summary +| Modifier and Type | Field and Description | +| ----------------- | --------------------- | +| [PetPutRequestBody.@Nullable SealedRequestBody](../../paths/pet/put/PetPutRequestBody.md#sealedrequestbody) | requestBody | +| [RootServerInfo.@Nullable ServerIndex](../../RootServerInfo.md#serverindex) | serverIndex | +| [PetPutSecurityInfo.@Nullable SecurityIndex](../../paths/pet/put/PetPutSecurityInfo.md#securityindex) | securityIndex | +| @Nullable Duration | timeout | + +## Put0RequestBuilder +public static class Put0RequestBuilder
+ +a builder for request inputs + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| Put0RequestBuilder(Put0RequestBuilder instance)
Creates a builder that contains the passed instance | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| [PutRequest](#putrequest) | build()
Returns the request input used to call an endpoint method | +| [Put0RequestBuilder](#put0requestbuilder) | serverIndex([RootServerInfo.ServerIndex](../../RootServerInfo.md#serverindex) serverIndex)
sets the optional property. Note: this will override the value in apiConfiguration | +| [Put0RequestBuilder](#put0requestbuilder) | securityIndex([PetPutSecurityInfo.SecurityIndex](../../paths/pet/put/PetPutSecurityInfo.md#securityindex) securityIndex)
sets the optional property. Note: this will override the value in apiConfiguration | +| [Put0RequestBuilder](#put0requestbuilder) | timeout(Duration timeout)
sets the optional property. Note: this will override the value in apiConfiguration | + +## PutRequestBuilder +public static class PutRequestBuilder
+ +a builder for request inputs + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| PutRequestBuilder()
Creates a builder that contains null for all parameters | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| [Put0RequestBuilder](#put0requestbuilder) | requestBody([PetPutRequestBody.SealedRequestBody](../../paths/pet/put/PetPutRequestBody.md#sealedrequestbody) requestBody)
sets the property | + +[[Back to top]](#top) [[Back to README]](../../../README.md) diff --git a/samples/client/petstore/kotlin/docs/paths/pet/post/PetPostRequestBody.md b/samples/client/petstore/kotlin/docs/paths/pet/post/PetPostRequestBody.md new file mode 100644 index 00000000000..bd9f8d276f1 --- /dev/null +++ b/samples/client/petstore/kotlin/docs/paths/pet/post/PetPostRequestBody.md @@ -0,0 +1,17 @@ +# PetPostRequestBody + +public class PetPostRequestBody 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 + +## Nested Class Summary +| Modifier and Type | Class and Description | +| ----------------- | --------------------- | +| static class | [PetPostRequestBody.PetPostRequestBody1](#petpostrequestbody1)
class that serializes request bodies | + +## PetPostRequestBody1 +public static class PetPostRequestBody1 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/kotlin/docs/paths/pet/post/PetPostResponses.md b/samples/client/petstore/kotlin/docs/paths/pet/post/PetPostResponses.md new file mode 100644 index 00000000000..dcc8c53edf5 --- /dev/null +++ b/samples/client/petstore/kotlin/docs/paths/pet/post/PetPostResponses.md @@ -0,0 +1,29 @@ +# PetPostResponses + +public class PetPostResponses + +A class that contains necessary responses classes +- a sealed interface, EndpointResponse, that stores endpoint responses +- records for each endpoint response + +## Nested Class Summary +| Modifier and Type | Class and Description | +| ----------------- | --------------------- | +| sealed interface | [EndpointResponse](#endpointresponse)
stores the endpoint responses | +| record | [EndpointPetPostCode200Response](#endpointpetpostcode200response)
the response for 200 | + +## EndpointResponse +public sealed interface EndpointResponse permits
+[EndpointPetPostCode200Response](#endpointpetpostcode200response) + +a sealed interface that stores endpoint responses + +## EndpointPetPostCode200Response +public record EndpointPetPostCode200Response( + HttpResponse response, + Nothing? body, + Nothing? headers +) implements EndpointResponse, ApiResponse
+ +a class that stores an endpoint response + diff --git a/samples/client/petstore/kotlin/docs/paths/pet/post/PetPostSecurityInfo.md b/samples/client/petstore/kotlin/docs/paths/pet/post/PetPostSecurityInfo.md new file mode 100644 index 00000000000..233fdd10e78 --- /dev/null +++ b/samples/client/petstore/kotlin/docs/paths/pet/post/PetPostSecurityInfo.md @@ -0,0 +1,44 @@ +# PetPostSecurityInfo +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 +- an enum class that describes security index values + +## Nested Class Summary +| Modifier and Type | Class and Description | +| ----------------- | --------------------- | +| static class | [PetPostSecurityInfo.PetPostSecurityInfo1](#petpostsecurityinfo1)
SecurityRequirementObjectProvider +| enum | [PetPostSecurityInfo.SecurityIndex](#securityindex)
class that stores a security index | + +## PetPostSecurityInfo1 +implements SecurityRequirementObjectProvider<[SecurityIndex](#securityindex)> + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| PetPostSecurityInfo1()
Creates an instance | + +### 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 | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| SecurityRequirementObject | getSecurityRequirementObject(@Nullable [SecurityIndex](#securityindex) securityIndex)
If null is input, then the instance's securityIndex will be used | + +## SecurityIndex +enum SecurityIndex
+ +### Enum Constant Summary +| Enum Constant And Description | +| ----------------------------- | +| SECURITY_0
security 0 | +| SECURITY_1
security 1 | +| SECURITY_2
security 2 | diff --git a/samples/client/petstore/kotlin/docs/paths/pet/post/responses/PetPostCode200Response.md b/samples/client/petstore/kotlin/docs/paths/pet/post/responses/PetPostCode200Response.md new file mode 100644 index 00000000000..3c59da4cc88 --- /dev/null +++ b/samples/client/petstore/kotlin/docs/paths/pet/post/responses/PetPostCode200Response.md @@ -0,0 +1,17 @@ +# PetPostCode200Response + +public class PetPostCode200Response extends [SuccessDescriptionOnly](../../components/responses/SuccessDescriptionOnly.md) + +A class (extended from the $ref class) that contains necessary nested response classes +- a class that extends ResponseDeserializer and is used to deserialize responses + +## Nested Class Summary +| Modifier and Type | Class and Description | +| ----------------- | --------------------- | +| static class | [PetPostCode200Response.PetPostCode200Response1](#petpostcode200response1)
class that deserializes responses | + +## PetPostCode200Response1 +public static class PetPostCode200Response1 extends [SuccessDescriptionOnly1](../../components/responses/SuccessDescriptionOnly.md#successdescriptiononly1)
+ +a class that deserializes responses, extended from the $ref class + diff --git a/samples/client/petstore/kotlin/docs/paths/pet/post/responses/PetPostCode405Response.md b/samples/client/petstore/kotlin/docs/paths/pet/post/responses/PetPostCode405Response.md new file mode 100644 index 00000000000..e0612c2d821 --- /dev/null +++ b/samples/client/petstore/kotlin/docs/paths/pet/post/responses/PetPostCode405Response.md @@ -0,0 +1,32 @@ +# PetPostCode405Response + +public class PetPostCode405Response + +A class that contains necessary nested response classes +- a class that extends ResponseDeserializer and is used to deserialize responses + +## Nested Class Summary +| Modifier and Type | Class and Description | +| ----------------- | --------------------- | +| static class | [PetPostCode405Response.PetPostCode405Response1](#petpostcode405response1)
class that deserializes responses | + +## PetPostCode405Response1 +public static class PetPostCode405Response1
+extends ResponseDeserializer + +a class that deserializes responses + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| PetPostCode405Response1()
Creates an instance | + +### Field Summary +| Modifier and Type | Field and Description | +| ----------------- | --------------------- | +| Map | content = MapUtils.makeMap(
)
the contentType to schema info | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| ApiResponse | deserialize(HttpResponse response, SchemaConfiguration configuration)
called by endpoint when deserialize responses | diff --git a/samples/client/petstore/kotlin/docs/paths/pet/post/security/PetPostSecurityRequirementObject0.md b/samples/client/petstore/kotlin/docs/paths/pet/post/security/PetPostSecurityRequirementObject0.md new file mode 100644 index 00000000000..dc904ae9529 --- /dev/null +++ b/samples/client/petstore/kotlin/docs/paths/pet/post/security/PetPostSecurityRequirementObject0.md @@ -0,0 +1,15 @@ +# PetPostSecurityRequirementObject0 +PetPostSecurityRequirementObject0.java + +public class PetPostSecurityRequirementObject0 +extends SecurityRequirementObject + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| PetPostSecurityRequirementObject0()
Creates an instance | + +### 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()
    )) | diff --git a/samples/client/petstore/kotlin/docs/paths/pet/post/security/PetPostSecurityRequirementObject1.md b/samples/client/petstore/kotlin/docs/paths/pet/post/security/PetPostSecurityRequirementObject1.md new file mode 100644 index 00000000000..4ffc2e46b31 --- /dev/null +++ b/samples/client/petstore/kotlin/docs/paths/pet/post/security/PetPostSecurityRequirementObject1.md @@ -0,0 +1,15 @@ +# PetPostSecurityRequirementObject1 +PetPostSecurityRequirementObject1.java + +public class PetPostSecurityRequirementObject1 +extends SecurityRequirementObject + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| PetPostSecurityRequirementObject1()
Creates an instance | + +### 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()
    )) | diff --git a/samples/client/petstore/kotlin/docs/paths/pet/post/security/PetPostSecurityRequirementObject2.md b/samples/client/petstore/kotlin/docs/paths/pet/post/security/PetPostSecurityRequirementObject2.md new file mode 100644 index 00000000000..88db581a2d6 --- /dev/null +++ b/samples/client/petstore/kotlin/docs/paths/pet/post/security/PetPostSecurityRequirementObject2.md @@ -0,0 +1,15 @@ +# PetPostSecurityRequirementObject2 +PetPostSecurityRequirementObject2.java + +public class PetPostSecurityRequirementObject2 +extends SecurityRequirementObject + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| PetPostSecurityRequirementObject2()
Creates an instance | + +### 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")
    )) | diff --git a/samples/client/petstore/kotlin/docs/paths/pet/put/PetPutRequestBody.md b/samples/client/petstore/kotlin/docs/paths/pet/put/PetPutRequestBody.md new file mode 100644 index 00000000000..e732123f8df --- /dev/null +++ b/samples/client/petstore/kotlin/docs/paths/pet/put/PetPutRequestBody.md @@ -0,0 +1,17 @@ +# PetPutRequestBody + +public class PetPutRequestBody 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 + +## Nested Class Summary +| Modifier and Type | Class and Description | +| ----------------- | --------------------- | +| static class | [PetPutRequestBody.PetPutRequestBody1](#petputrequestbody1)
class that serializes request bodies | + +## PetPutRequestBody1 +public static class PetPutRequestBody1 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/kotlin/docs/paths/pet/put/PetPutResponses.md b/samples/client/petstore/kotlin/docs/paths/pet/put/PetPutResponses.md new file mode 100644 index 00000000000..fb9a8a6388a --- /dev/null +++ b/samples/client/petstore/kotlin/docs/paths/pet/put/PetPutResponses.md @@ -0,0 +1,10 @@ +# PetPutResponses + +public class PetPutResponses + +A class that contains necessary responses classes + +## Nested Class Summary +| Modifier and Type | Class and Description | +| ----------------- | --------------------- | + diff --git a/samples/client/petstore/kotlin/docs/paths/pet/put/PetPutSecurityInfo.md b/samples/client/petstore/kotlin/docs/paths/pet/put/PetPutSecurityInfo.md new file mode 100644 index 00000000000..1136055dad2 --- /dev/null +++ b/samples/client/petstore/kotlin/docs/paths/pet/put/PetPutSecurityInfo.md @@ -0,0 +1,42 @@ +# PetPutSecurityInfo +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 +- an enum class that describes security index values + +## Nested Class Summary +| Modifier and Type | Class and Description | +| ----------------- | --------------------- | +| static class | [PetPutSecurityInfo.PetPutSecurityInfo1](#petputsecurityinfo1)
SecurityRequirementObjectProvider +| enum | [PetPutSecurityInfo.SecurityIndex](#securityindex)
class that stores a security index | + +## PetPutSecurityInfo1 +implements SecurityRequirementObjectProvider<[SecurityIndex](#securityindex)> + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| PetPutSecurityInfo1()
Creates an instance | + +### Field Summary +| Modifier and Type | Field and Description | +| ----------------- | --------------------- | +| [PetPutSecurityRequirementObject0](../../../paths/pet/put/security/PetPutSecurityRequirementObject0.md) | security0 | +| [PetPutSecurityRequirementObject1](../../../paths/pet/put/security/PetPutSecurityRequirementObject1.md) | security1 | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| SecurityRequirementObject | getSecurityRequirementObject(@Nullable [SecurityIndex](#securityindex) securityIndex)
If null is input, then the instance's securityIndex will be used | + +## SecurityIndex +enum SecurityIndex
+ +### Enum Constant Summary +| Enum Constant And Description | +| ----------------------------- | +| SECURITY_0
security 0 | +| SECURITY_1
security 1 | diff --git a/samples/client/petstore/kotlin/docs/paths/pet/put/responses/PetPutCode400Response.md b/samples/client/petstore/kotlin/docs/paths/pet/put/responses/PetPutCode400Response.md new file mode 100644 index 00000000000..19b5acf6249 --- /dev/null +++ b/samples/client/petstore/kotlin/docs/paths/pet/put/responses/PetPutCode400Response.md @@ -0,0 +1,32 @@ +# PetPutCode400Response + +public class PetPutCode400Response + +A class that contains necessary nested response classes +- a class that extends ResponseDeserializer and is used to deserialize responses + +## Nested Class Summary +| Modifier and Type | Class and Description | +| ----------------- | --------------------- | +| static class | [PetPutCode400Response.PetPutCode400Response1](#petputcode400response1)
class that deserializes responses | + +## PetPutCode400Response1 +public static class PetPutCode400Response1
+extends ResponseDeserializer + +a class that deserializes responses + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| PetPutCode400Response1()
Creates an instance | + +### Field Summary +| Modifier and Type | Field and Description | +| ----------------- | --------------------- | +| Map | content = MapUtils.makeMap(
)
the contentType to schema info | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| ApiResponse | deserialize(HttpResponse response, SchemaConfiguration configuration)
called by endpoint when deserialize responses | diff --git a/samples/client/petstore/kotlin/docs/paths/pet/put/responses/PetPutCode404Response.md b/samples/client/petstore/kotlin/docs/paths/pet/put/responses/PetPutCode404Response.md new file mode 100644 index 00000000000..dac89b4928c --- /dev/null +++ b/samples/client/petstore/kotlin/docs/paths/pet/put/responses/PetPutCode404Response.md @@ -0,0 +1,32 @@ +# PetPutCode404Response + +public class PetPutCode404Response + +A class that contains necessary nested response classes +- a class that extends ResponseDeserializer and is used to deserialize responses + +## Nested Class Summary +| Modifier and Type | Class and Description | +| ----------------- | --------------------- | +| static class | [PetPutCode404Response.PetPutCode404Response1](#petputcode404response1)
class that deserializes responses | + +## PetPutCode404Response1 +public static class PetPutCode404Response1
+extends ResponseDeserializer + +a class that deserializes responses + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| PetPutCode404Response1()
Creates an instance | + +### Field Summary +| Modifier and Type | Field and Description | +| ----------------- | --------------------- | +| Map | content = MapUtils.makeMap(
)
the contentType to schema info | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| ApiResponse | deserialize(HttpResponse response, SchemaConfiguration configuration)
called by endpoint when deserialize responses | diff --git a/samples/client/petstore/kotlin/docs/paths/pet/put/responses/PetPutCode405Response.md b/samples/client/petstore/kotlin/docs/paths/pet/put/responses/PetPutCode405Response.md new file mode 100644 index 00000000000..8bc74258d27 --- /dev/null +++ b/samples/client/petstore/kotlin/docs/paths/pet/put/responses/PetPutCode405Response.md @@ -0,0 +1,32 @@ +# PetPutCode405Response + +public class PetPutCode405Response + +A class that contains necessary nested response classes +- a class that extends ResponseDeserializer and is used to deserialize responses + +## Nested Class Summary +| Modifier and Type | Class and Description | +| ----------------- | --------------------- | +| static class | [PetPutCode405Response.PetPutCode405Response1](#petputcode405response1)
class that deserializes responses | + +## PetPutCode405Response1 +public static class PetPutCode405Response1
+extends ResponseDeserializer + +a class that deserializes responses + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| PetPutCode405Response1()
Creates an instance | + +### Field Summary +| Modifier and Type | Field and Description | +| ----------------- | --------------------- | +| Map | content = MapUtils.makeMap(
)
the contentType to schema info | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| ApiResponse | deserialize(HttpResponse response, SchemaConfiguration configuration)
called by endpoint when deserialize responses | diff --git a/samples/client/petstore/kotlin/docs/paths/pet/put/security/PetPutSecurityRequirementObject0.md b/samples/client/petstore/kotlin/docs/paths/pet/put/security/PetPutSecurityRequirementObject0.md new file mode 100644 index 00000000000..a0bb52235ba --- /dev/null +++ b/samples/client/petstore/kotlin/docs/paths/pet/put/security/PetPutSecurityRequirementObject0.md @@ -0,0 +1,15 @@ +# PetPutSecurityRequirementObject0 +PetPutSecurityRequirementObject0.java + +public class PetPutSecurityRequirementObject0 +extends SecurityRequirementObject + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| PetPutSecurityRequirementObject0()
Creates an instance | + +### 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()
    )) | diff --git a/samples/client/petstore/kotlin/docs/paths/pet/put/security/PetPutSecurityRequirementObject1.md b/samples/client/petstore/kotlin/docs/paths/pet/put/security/PetPutSecurityRequirementObject1.md new file mode 100644 index 00000000000..9dd305982f5 --- /dev/null +++ b/samples/client/petstore/kotlin/docs/paths/pet/put/security/PetPutSecurityRequirementObject1.md @@ -0,0 +1,15 @@ +# PetPutSecurityRequirementObject1 +PetPutSecurityRequirementObject1.java + +public class PetPutSecurityRequirementObject1 +extends SecurityRequirementObject + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| PetPutSecurityRequirementObject1()
Creates an instance | + +### 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")
    )) | diff --git a/samples/client/petstore/kotlin/docs/paths/petfindbystatus/PetfindbystatusGet.md b/samples/client/petstore/kotlin/docs/paths/petfindbystatus/PetfindbystatusGet.md new file mode 100644 index 00000000000..209dbc6912b --- /dev/null +++ b/samples/client/petstore/kotlin/docs/paths/petfindbystatus/PetfindbystatusGet.md @@ -0,0 +1,209 @@ +# PetfindbystatusGet + +public class PetfindbystatusGet + +A class that contains necessary endpoint classes +- a class that calls the endpoint method using the http verb +- a class that calls the endpoint method using the operationId name +- class(es) to store the request inputs +- builder(s) to set the request input data + +## Nested Class Summary +| Modifier and Type | Class and Description | +| ----------------- | --------------------- | +| static class | [Get](#get)
The class that has a get method to call the endpoint | +| interface | [FindPetsByStatusOperation](#findpetsbystatusoperation)
The interface that has a findPetsByStatus method to call the endpoint | +| static class | [GetRequest](#getrequest)
The final request inputs class | +| static class | [GetNullableRequest](#getnullablerequest)
The initial request inputs class | +| static class | [Get0RequestBuilder](#get0requestbuilder)
A builder for the request input class | +| static class | [GetRequestBuilder](#getrequestbuilder)
A builder for the request input class | + +## Get +public static class Get extends ApiClient.ApiClient1 implements GetOperation
+ +a class that allows one to call the endpoint using a method named get + +### 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.petfindbystatus.PetfindbystatusServerInfo; +import org.openapijsonschematools.client.paths.petfindbystatus.get.PetfindbystatusGetSecurityInfo; +import org.openapijsonschematools.client.paths.petfindbystatus.get.PetfindbystatusGetQueryParameters; +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.PetfindbystatusGetCode200Response; +import org.openapijsonschematools.client.paths.petfindbystatus.get.responses.PetfindbystatusGetCode400Response; +import org.openapijsonschematools.client.paths.petfindbystatus.PetfindbystatusServerInfo; +import org.openapijsonschematools.client.paths.petfindbystatus.PetfindbystatusGet; +import org.openapijsonschematools.client.paths.petfindbystatus.get.PetfindbystatusGetResponses; + +import java.io.IOException; +import java.util.Arrays; +import java.util.List; +import java.util.Map; +import java.util.AbstractMap; + +// if you want to use a server that is not SERVER_0 pass it in here and change the ServerIndex input below +ApiConfiguration.ServerInfo serverInfo = new ApiConfiguration.ServerInfoBuilder() + .petfindbystatusServerInfo( + new PetfindbystatusServerInfo.PetfindbystatusServerInfoBuilder() + .petfindbystatusServer0(new PetfindbystatusServer0()) + .build() + ) + .build(); +ApiConfiguration.ServerIndexInfo serverIndexInfo = new ApiConfiguration.ServerIndexInfoBuilder() + .petfindbystatusServerInfoServerIndex(PetfindbystatusServerInfo.ServerIndex.SERVER_0) + .build(); +List securitySchemes = new ArrayList(); +securitySchemes.add( + new ApiKey("someApiKey"); +); +ApiConfiguration.SecurityIndexInfo securityIndexInfo = new ApiConfiguration.SecurityIndexInfoBuilder() + .petfindbystatusGetSecurityRequirementObject0SecurityIndex(PetfindbystatusGetSecurityRequirementObject0.SecurityIndex.SECURITY_0) + .build(); +Duration timeout = Duration.ofSeconds(1L); +Map> defaultHeaders = Map.of("User-Agent", List.of("OpenAPI-JSON-Schema-Generator/1.0.0/java")); +ApiConfiguration apiConfiguration = new ApiConfiguration( + serverInfo + serverIndexInfo, + securitySchemes, + securityIndexInfo, + timeout, + defaultHeaders +); +SchemaConfiguration schemaConfiguration = new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().build()); +PetfindbystatusGet.Get apiClient = new PetfindbystatusGet.Get(apiConfiguration, schemaConfiguration); + + +// Map validation +PetfindbystatusGetQueryParameters.QueryParametersMap queryParameters = + PetfindbystatusGetQueryParameters.PetfindbystatusGetQueryParameters1.validate( + new PetfindbystatusGetQueryParameters.QueryParametersMapBuilder() + .status( + Arrays.asList( + "available" + ) + ) + .build(), + schemaConfiguration +); + +var request = new PetfindbystatusGet.GetRequestBuilder() + .queryParameters(queryParameters) + .build(); + +PetfindbystatusGetResponses.EndpointResponse response; +try { + response = apiClient.get(request); +} catch (PetfindbystatusGetCode400Response.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; +} +PetfindbystatusGetResponses.EndpointPetfindbystatusGetCode200Response castResponse = (PetfindbystatusGetResponses.EndpointPetfindbystatusGetCode200Response) response; +} +``` +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| Get(ApiConfiguration apiConfiguration, SchemaConfiguration schemaConfiguration)
Creates an instance | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| [PetfindbystatusGetResponses.EndpointResponse](../../paths/petfindbystatus/get/PetfindbystatusGetResponses.md#endpointresponse) | get([GetRequest](#getrequest) request) | + +## FindPetsByStatusOperation +public interface FindPetsByStatusOperation
+ +an interface that allows one to call the endpoint using a method named findPetsByStatus by the operationId + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| [PetfindbystatusGetResponses.EndpointResponse](../../paths/petfindbystatus/get/PetfindbystatusGetResponses.md#endpointresponse) | findPetsByStatus([GetRequest](#getrequest) request) | + +## GetRequest +public static class GetRequest
+ +a class that stores the final request inputs + +### Field Summary +| Modifier and Type | Field and Description | +| ----------------- | --------------------- | +| [PetfindbystatusGetQueryParameters.QueryParametersMap](../../paths/petfindbystatus/get/PetfindbystatusGetQueryParameters.md#queryparametersmap) | queryParameters | +| [PetfindbystatusServerInfo.@Nullable ServerIndex](../../paths/petfindbystatus/PetfindbystatusServerInfo.md#serverindex) | serverIndex
optional. Note: this will override the value in apiConfiguration | +| [PetfindbystatusGetSecurityInfo.@Nullable SecurityIndex](../../paths/petfindbystatus/get/PetfindbystatusGetSecurityInfo.md#securityindex) | securityIndex
optional. Note: this will override the value in apiConfiguration | +| @Nullable Duration | timeout
optional. Note: this will override the value in apiConfiguration | + +## GetNullableRequest +public static class GetNullableRequest
+ +a class that stores the initial request inputs + +### Field Summary +| Modifier and Type | Field and Description | +| ----------------- | --------------------- | +| [PetfindbystatusGetQueryParameters.@Nullable QueryParametersMap](../../paths/petfindbystatus/get/PetfindbystatusGetQueryParameters.md#queryparametersmap) | queryParameters | +| [PetfindbystatusServerInfo.@Nullable ServerIndex](../../paths/petfindbystatus/PetfindbystatusServerInfo.md#serverindex) | serverIndex | +| [PetfindbystatusGetSecurityInfo.@Nullable SecurityIndex](../../paths/petfindbystatus/get/PetfindbystatusGetSecurityInfo.md#securityindex) | securityIndex | +| @Nullable Duration | timeout | + +## Get0RequestBuilder +public static class Get0RequestBuilder
+ +a builder for request inputs + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| Get0RequestBuilder(Get0RequestBuilder instance)
Creates a builder that contains the passed instance | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| [GetRequest](#getrequest) | build()
Returns the request input used to call an endpoint method | +| [Get0RequestBuilder](#get0requestbuilder) | serverIndex([PetfindbystatusServerInfo.ServerIndex](../../paths/petfindbystatus/PetfindbystatusServerInfo.md#serverindex) serverIndex)
sets the optional property. Note: this will override the value in apiConfiguration | +| [Get0RequestBuilder](#get0requestbuilder) | securityIndex([PetfindbystatusGetSecurityInfo.SecurityIndex](../../paths/petfindbystatus/get/PetfindbystatusGetSecurityInfo.md#securityindex) securityIndex)
sets the optional property. Note: this will override the value in apiConfiguration | +| [Get0RequestBuilder](#get0requestbuilder) | timeout(Duration timeout)
sets the optional property. Note: this will override the value in apiConfiguration | + +## GetRequestBuilder +public static class GetRequestBuilder
+ +a builder for request inputs + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| GetRequestBuilder()
Creates a builder that contains null for all parameters | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| [Get0RequestBuilder](#get0requestbuilder) | queryParameters([PetfindbystatusGetQueryParametersQueryParametersMap](../../paths/petfindbystatus/get/PetfindbystatusGetQueryParameters.md#queryparametersmap) queryParameters)
sets the property | + +[[Back to top]](#top) [[Back to README]](../../../README.md) diff --git a/samples/client/petstore/kotlin/docs/paths/petfindbystatus/PetfindbystatusServerInfo.md b/samples/client/petstore/kotlin/docs/paths/petfindbystatus/PetfindbystatusServerInfo.md new file mode 100644 index 00000000000..fefcf6ae3de --- /dev/null +++ b/samples/client/petstore/kotlin/docs/paths/petfindbystatus/PetfindbystatusServerInfo.md @@ -0,0 +1,62 @@ +# PetfindbystatusServerInfo +PetfindbystatusServerInfo.java + +public class PetfindbystatusServerInfo + +A class that provides a server, and any needed server info classes +- a class that is a ServerProvider +- a builder for the ServerProvider +- an enum class that stores server index values + +## Nested Class Summary +| Modifier and Type | Class and Description | +| ----------------- | --------------------- | +| static class | [PetfindbystatusServerInfo.PetfindbystatusServerInfo1](#petfindbystatusserverinfo1)
class that stores a server index | +| static class | [PetfindbystatusServerInfo.PetfindbystatusServerInfoBuilder](#petfindbystatusserverinfobuilder)
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(@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) | + +## PetfindbystatusServerInfoBuilder + +a builder for [PetfindbystatusServerInfo1](#petfindbystatusserverinfo1) + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| PetfindbystatusServerInfoBuilder()
Creates an instance | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| [PetfindbystatusServerInfoBuilder](#petfindbystatusserverinfobuilder) | petfindbystatusServer0([PetfindbystatusServer0](../../paths/petfindbystatus/servers/PetfindbystatusServer0.md) server0)
sets the server | +| [PetfindbystatusServerInfoBuilder](#petfindbystatusserverinfobuilder) | petfindbystatusServer1([PetfindbystatusServer1](../../paths/petfindbystatus/servers/PetfindbystatusServer1.md) server1)
sets the server | +| [PetfindbystatusServerInfo1](#petfindbystatusserverinfo1) | build() | + +## ServerIndex +enum ServerIndex
+ +### Enum Constant Summary +| Enum Constant And Description | +| ----------------------------- | +| SERVER_0
server 0 | +| SERVER_1
server 1 | diff --git a/samples/client/petstore/kotlin/docs/paths/petfindbystatus/get/PetfindbystatusGetQueryParameters.md b/samples/client/petstore/kotlin/docs/paths/petfindbystatus/get/PetfindbystatusGetQueryParameters.md new file mode 100644 index 00000000000..ee1e7068fda --- /dev/null +++ b/samples/client/petstore/kotlin/docs/paths/petfindbystatus/get/PetfindbystatusGetQueryParameters.md @@ -0,0 +1,271 @@ +# PetfindbystatusGetQueryParameters +public class PetfindbystatusGetQueryParameters
+ +A class that contains necessary nested +- schema classes (which validate payloads), extends JsonSchema +- sealed interfaces which store validated payloads, java version of a sum type +- boxed classes which store validated payloads, sealed permits class implementations +- classes to store validated map payloads, extends FrozenMap +- classes to build inputs for map payloads + +## Nested Class Summary +| Modifier and Type | Class and Description | +| ----------------- | ---------------------- | +| sealed interface | [PetfindbystatusGetQueryParameters.PetfindbystatusGetQueryParameters1Boxed](#petfindbystatusgetqueryparameters1boxed)
sealed interface for validated payloads | +| record | [PetfindbystatusGetQueryParameters.PetfindbystatusGetQueryParameters1BoxedMap](#petfindbystatusgetqueryparameters1boxedmap)
boxed class to store validated Map payloads | +| static class | [PetfindbystatusGetQueryParameters.PetfindbystatusGetQueryParameters1](#petfindbystatusgetqueryparameters1)
schema class | +| static class | [PetfindbystatusGetQueryParameters.QueryParametersMapBuilder](#queryparametersmapbuilder)
builder for Map payloads | +| static class | [PetfindbystatusGetQueryParameters.QueryParametersMap](#queryparametersmap)
output class for Map payloads | +| sealed interface | [PetfindbystatusGetQueryParameters.AdditionalPropertiesBoxed](#additionalpropertiesboxed)
sealed interface for validated payloads | +| record | [PetfindbystatusGetQueryParameters.AdditionalPropertiesBoxedVoid](#additionalpropertiesboxedvoid)
boxed class to store validated null payloads | +| record | [PetfindbystatusGetQueryParameters.AdditionalPropertiesBoxedBoolean](#additionalpropertiesboxedboolean)
boxed class to store validated boolean payloads | +| record | [PetfindbystatusGetQueryParameters.AdditionalPropertiesBoxedNumber](#additionalpropertiesboxednumber)
boxed class to store validated Number payloads | +| record | [PetfindbystatusGetQueryParameters.AdditionalPropertiesBoxedString](#additionalpropertiesboxedstring)
boxed class to store validated String payloads | +| record | [PetfindbystatusGetQueryParameters.AdditionalPropertiesBoxedList](#additionalpropertiesboxedlist)
boxed class to store validated List payloads | +| record | [PetfindbystatusGetQueryParameters.AdditionalPropertiesBoxedMap](#additionalpropertiesboxedmap)
boxed class to store validated Map payloads | +| static class | [PetfindbystatusGetQueryParameters.AdditionalProperties](#additionalproperties)
schema class | + +## PetfindbystatusGetQueryParameters1Boxed +public sealed interface PetfindbystatusGetQueryParameters1Boxed
+permits
+[PetfindbystatusGetQueryParameters1BoxedMap](#petfindbystatusgetqueryparameters1boxedmap) + +sealed interface that stores validated payloads using boxed classes + +## PetfindbystatusGetQueryParameters1BoxedMap +public record PetfindbystatusGetQueryParameters1BoxedMap
+implements [PetfindbystatusGetQueryParameters1Boxed](#petfindbystatusgetqueryparameters1boxed) + +record that stores validated Map payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| PetfindbystatusGetQueryParameters1BoxedMap([QueryParametersMap](#queryparametersmap) data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| [QueryParametersMap](#queryparametersmap) | data()
validated payload | +| @Nullable Object | getData()
validated payload | + +## PetfindbystatusGetQueryParameters1 +public static class PetfindbystatusGetQueryParameters1
+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.get.PetfindbystatusGetQueryParameters; + +import java.util.Arrays; +import java.util.List; +import java.util.AbstractMap; + +static final SchemaConfiguration configuration = new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().build()); + +// Map validation +PetfindbystatusGetQueryParameters.QueryParametersMap validatedPayload = + PetfindbystatusGetQueryParameters.PetfindbystatusGetQueryParameters1.validate( + new PetfindbystatusGetQueryParameters.QueryParametersMapBuilder() + .status( + Arrays.asList( + "available" + ) + ) + .build(), + configuration +); +``` + +### Field Summary +| Modifier and Type | Field and Description | +| ----------------- | ---------------------- | +| Set> | type = Set.of(Map.class) | +| Map> | properties = Map.ofEntries(
    new PropertyEntry("status", [Schema0.Schema01.class](../../../paths/petfindbystatus/get/parameters/parameter0/Schema0.md#schema01))
)
| +| Set | required = Set.of(
    "status"
)
| +| Class | additionalProperties = [AdditionalProperties.class](#additionalproperties) | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| [QueryParametersMap](#queryparametersmap) | validate([Map<?, ?>](#queryparametersmapbuilder) arg, SchemaConfiguration configuration) | +| [PetfindbystatusGetQueryParameters1BoxedMap](#petfindbystatusgetqueryparameters1boxedmap) | validateAndBox([Map<?, ?>](#queryparametersmapbuilder) arg, SchemaConfiguration configuration) | +| [PetfindbystatusGetQueryParameters1Boxed](#petfindbystatusgetqueryparameters1boxed) | validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) | +| @Nullable Object | validate(@Nullable Object arg, SchemaConfiguration configuration) | + +## QueryParametersMap0Builder +public class QueryParametersMap0Builder
+builder for `Map>` + +A class that builds the Map input type + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| QueryParametersMap0Builder(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 | + +## QueryParametersMapBuilder +public class QueryParametersMapBuilder
+builder for `Map>` + +A class that builds the Map input type + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| QueryParametersMapBuilder()
Creates a builder that contains an empty map | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| [QueryParametersMap0Builder](#queryparametersmap0builder) | status(List value) | + +## QueryParametersMap +public static class QueryParametersMap
+extends FrozenMap + +A class to store validated Map payloads + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| static [QueryParametersMap](#queryparametersmap) | of([Map>](#queryparametersmapbuilder) arg, SchemaConfiguration configuration) | +| [Schema0.SchemaList0](../../../paths/petfindbystatus/get/parameters/parameter0/Schema0.md#schemalist0) | status()
| + +## 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(Nothing? data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| Nothing? | 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/kotlin/docs/paths/petfindbystatus/get/PetfindbystatusGetResponses.md b/samples/client/petstore/kotlin/docs/paths/petfindbystatus/get/PetfindbystatusGetResponses.md new file mode 100644 index 00000000000..c93f98c5ef6 --- /dev/null +++ b/samples/client/petstore/kotlin/docs/paths/petfindbystatus/get/PetfindbystatusGetResponses.md @@ -0,0 +1,29 @@ +# PetfindbystatusGetResponses + +public class PetfindbystatusGetResponses + +A class that contains necessary responses classes +- a sealed interface, EndpointResponse, that stores endpoint responses +- records for each endpoint response + +## Nested Class Summary +| Modifier and Type | Class and Description | +| ----------------- | --------------------- | +| sealed interface | [EndpointResponse](#endpointresponse)
stores the endpoint responses | +| record | [EndpointPetfindbystatusGetCode200Response](#endpointpetfindbystatusgetcode200response)
the response for 200 | + +## EndpointResponse +public sealed interface EndpointResponse permits
+[EndpointPetfindbystatusGetCode200Response](#endpointpetfindbystatusgetcode200response) + +a sealed interface that stores endpoint responses + +## EndpointPetfindbystatusGetCode200Response +public record EndpointPetfindbystatusGetCode200Response( + HttpResponse response, + [PetfindbystatusGetCode200Response.SealedResponseBody](../../../paths/petfindbystatus/get/responses/PetfindbystatusGetCode200Response.md#sealedresponsebody) body, + Nothing? headers +) implements EndpointResponse, ApiResponse
+ +a class that stores an endpoint response + diff --git a/samples/client/petstore/kotlin/docs/paths/petfindbystatus/get/PetfindbystatusGetSecurityInfo.md b/samples/client/petstore/kotlin/docs/paths/petfindbystatus/get/PetfindbystatusGetSecurityInfo.md new file mode 100644 index 00000000000..a0bc58eb967 --- /dev/null +++ b/samples/client/petstore/kotlin/docs/paths/petfindbystatus/get/PetfindbystatusGetSecurityInfo.md @@ -0,0 +1,44 @@ +# PetfindbystatusGetSecurityInfo +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 +- an enum class that describes security index values + +## Nested Class Summary +| Modifier and Type | Class and Description | +| ----------------- | --------------------- | +| static class | [PetfindbystatusGetSecurityInfo.PetfindbystatusGetSecurityInfo1](#petfindbystatusgetsecurityinfo1)
SecurityRequirementObjectProvider +| enum | [PetfindbystatusGetSecurityInfo.SecurityIndex](#securityindex)
class that stores a security index | + +## PetfindbystatusGetSecurityInfo1 +implements SecurityRequirementObjectProvider<[SecurityIndex](#securityindex)> + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| PetfindbystatusGetSecurityInfo1()
Creates an instance | + +### 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 | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| SecurityRequirementObject | getSecurityRequirementObject(@Nullable [SecurityIndex](#securityindex) securityIndex)
If null is input, then the instance's securityIndex will be used | + +## SecurityIndex +enum SecurityIndex
+ +### Enum Constant Summary +| Enum Constant And Description | +| ----------------------------- | +| SECURITY_0
security 0 | +| SECURITY_1
security 1 | +| SECURITY_2
security 2 | diff --git a/samples/client/petstore/kotlin/docs/paths/petfindbystatus/get/parameters/parameter0/Schema0.md b/samples/client/petstore/kotlin/docs/paths/petfindbystatus/get/parameters/parameter0/Schema0.md new file mode 100644 index 00000000000..cbe534fe3c5 --- /dev/null +++ b/samples/client/petstore/kotlin/docs/paths/petfindbystatus/get/parameters/parameter0/Schema0.md @@ -0,0 +1,206 @@ +# Schema0 +public class Schema0
+ +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 list payloads, extends FrozenList +- classes to build inputs for list payloads +- enum classes + +## Nested Class Summary +| Modifier and Type | Class and Description | +| ----------------- | ---------------------- | +| sealed interface | [Schema0.Schema01Boxed](#schema01boxed)
sealed interface for validated payloads | +| record | [Schema0.Schema01BoxedList](#schema01boxedlist)
boxed class to store validated List payloads | +| static class | [Schema0.Schema01](#schema01)
schema class | +| static class | [Schema0.SchemaListBuilder0](#schemalistbuilder0)
builder for List payloads | +| static class | [Schema0.SchemaList0](#schemalist0)
output class for List payloads | +| sealed interface | [Schema0.Items0Boxed](#items0boxed)
sealed interface for validated payloads | +| record | [Schema0.Items0BoxedString](#items0boxedstring)
boxed class to store validated String payloads | +| static class | [Schema0.Items0](#items0)
schema class | +| enum | [Schema0.StringItemsEnums0](#stringitemsenums0)
String enum | + +## Schema01Boxed +public sealed interface Schema01Boxed
+permits
+[Schema01BoxedList](#schema01boxedlist) + +sealed interface that stores validated payloads using boxed classes + +## Schema01BoxedList +public record Schema01BoxedList
+implements [Schema01Boxed](#schema01boxed) + +record that stores validated List payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| Schema01BoxedList([SchemaList0](#schemalist0) data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| [SchemaList0](#schemalist0) | data()
validated payload | +| @Nullable Object | getData()
validated payload | + +## Schema01 +public static class Schema01
+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.get.parameters.parameter0.Schema0; + +import java.util.Arrays; +import java.util.List; +import java.util.AbstractMap; + +static final SchemaConfiguration configuration = new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().build()); + +// List validation +Schema0.SchemaList0 validatedPayload = + Schema0.Schema01.validate( + new Schema0.SchemaListBuilder0() + .add("available") + + .build(), + configuration +); +``` + +### Field Summary +| Modifier and Type | Field and Description | +| ----------------- | ---------------------- | +| Set> | type = Set.of(List.class) | +| Class | items = [Items0.class](#items0) | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| [SchemaList0](#schemalist0) | validate([List](#schemalistbuilder0) arg, SchemaConfiguration configuration) | +| [Schema01BoxedList](#schema01boxedlist) | validateAndBox([List](#schemalistbuilder0) arg, SchemaConfiguration configuration) | +| [Schema01Boxed](#schema01boxed) | validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) | +| @Nullable Object | validate(@Nullable Object arg, SchemaConfiguration configuration) | + +## SchemaListBuilder0 +public class SchemaListBuilder0
+builder for `List` + +A class that builds the List input type + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| SchemaListBuilder0()
Creates an empty list | +| SchemaListBuilder0(List items)
Stores the items in a list | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| SchemaListBuilder0 | add(String item) | +| SchemaListBuilder0 | add([StringItemsEnums0](#stringitemsenums0) item) | +| List | build()
Returns list input that should be used with Schema.validate | + +## SchemaList0 +public class SchemaList0
+extends `FrozenList` + +A class to store validated List payloads + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| static [SchemaList0](#schemalist0) | of([List](#schemalistbuilder0) arg, SchemaConfiguration configuration) | + +## Items0Boxed +public sealed interface Items0Boxed
+permits
+[Items0BoxedString](#items0boxedstring) + +sealed interface that stores validated payloads using boxed classes + +## Items0BoxedString +public record Items0BoxedString
+implements [Items0Boxed](#items0boxed) + +record that stores validated String payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| Items0BoxedString(String data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| String | data()
validated payload | +| @Nullable Object | getData()
validated payload | + +## Items0 +public static class Items0
+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.get.parameters.parameter0.Schema0; + +import java.util.Arrays; +import java.util.List; +import java.util.AbstractMap; + +static final SchemaConfiguration configuration = new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().build()); + +// String validation +String validatedPayload = Schema0.Items0.validate( + "available", + configuration +); +``` + +### Field Summary +| Modifier and Type | Field and Description | +| ----------------- | ---------------------- | +| Set> | type = Set.of(
    String.class
)
| +| Set | enumValues = SetMaker.makeSet(
    "available",
    "pending",
    "sold"
)
| +| @Nullable Object | defaultValue = "available" | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| String | validate(String arg, SchemaConfiguration configuration) | +| String | validate([StringItemsEnums0](#stringitemsenums0) arg, SchemaConfiguration configuration) | +| [Items0BoxedString](#items0boxedstring) | validateAndBox(String arg, SchemaConfiguration configuration) | +| [Items0Boxed](#items0boxed) | validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) | +| @Nullable Object | validate(@Nullable Object arg, SchemaConfiguration configuration) | + +## StringItemsEnums0 +public enum StringItemsEnums0
+extends `Enum` + +A class that stores String enum values + +### Enum Constant Summary +| Enum Constant | Description | +| ------------- | ----------- | +| AVAILABLE | value = "available" | +| PENDING | value = "pending" | +| SOLD | value = "sold" | diff --git a/samples/client/petstore/kotlin/docs/paths/petfindbystatus/get/responses/PetfindbystatusGetCode200Response.md b/samples/client/petstore/kotlin/docs/paths/petfindbystatus/get/responses/PetfindbystatusGetCode200Response.md new file mode 100644 index 00000000000..a6a3459b37a --- /dev/null +++ b/samples/client/petstore/kotlin/docs/paths/petfindbystatus/get/responses/PetfindbystatusGetCode200Response.md @@ -0,0 +1,17 @@ +# PetfindbystatusGetCode200Response + +public class PetfindbystatusGetCode200Response extends [SuccessfulXmlAndJsonArrayOfPet](../../components/responses/SuccessfulXmlAndJsonArrayOfPet.md) + +A class (extended from the $ref class) that contains necessary nested response classes +- a class that extends ResponseDeserializer and is used to deserialize responses + +## Nested Class Summary +| Modifier and Type | Class and Description | +| ----------------- | --------------------- | +| static class | [PetfindbystatusGetCode200Response.PetfindbystatusGetCode200Response1](#petfindbystatusgetcode200response1)
class that deserializes responses | + +## PetfindbystatusGetCode200Response1 +public static class PetfindbystatusGetCode200Response1 extends [SuccessfulXmlAndJsonArrayOfPet1](../../components/responses/SuccessfulXmlAndJsonArrayOfPet.md#successfulxmlandjsonarrayofpet1)
+ +a class that deserializes responses, extended from the $ref class + diff --git a/samples/client/petstore/kotlin/docs/paths/petfindbystatus/get/responses/PetfindbystatusGetCode400Response.md b/samples/client/petstore/kotlin/docs/paths/petfindbystatus/get/responses/PetfindbystatusGetCode400Response.md new file mode 100644 index 00000000000..9ef759215f9 --- /dev/null +++ b/samples/client/petstore/kotlin/docs/paths/petfindbystatus/get/responses/PetfindbystatusGetCode400Response.md @@ -0,0 +1,32 @@ +# PetfindbystatusGetCode400Response + +public class PetfindbystatusGetCode400Response + +A class that contains necessary nested response classes +- a class that extends ResponseDeserializer and is used to deserialize responses + +## Nested Class Summary +| Modifier and Type | Class and Description | +| ----------------- | --------------------- | +| static class | [PetfindbystatusGetCode400Response.PetfindbystatusGetCode400Response1](#petfindbystatusgetcode400response1)
class that deserializes responses | + +## PetfindbystatusGetCode400Response1 +public static class PetfindbystatusGetCode400Response1
+extends ResponseDeserializer + +a class that deserializes responses + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| PetfindbystatusGetCode400Response1()
Creates an instance | + +### Field Summary +| Modifier and Type | Field and Description | +| ----------------- | --------------------- | +| Map | content = MapUtils.makeMap(
)
the contentType to schema info | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| ApiResponse | deserialize(HttpResponse response, SchemaConfiguration configuration)
called by endpoint when deserialize responses | diff --git a/samples/client/petstore/kotlin/docs/paths/petfindbystatus/get/security/PetfindbystatusGetSecurityRequirementObject0.md b/samples/client/petstore/kotlin/docs/paths/petfindbystatus/get/security/PetfindbystatusGetSecurityRequirementObject0.md new file mode 100644 index 00000000000..608eb248028 --- /dev/null +++ b/samples/client/petstore/kotlin/docs/paths/petfindbystatus/get/security/PetfindbystatusGetSecurityRequirementObject0.md @@ -0,0 +1,15 @@ +# PetfindbystatusGetSecurityRequirementObject0 +PetfindbystatusGetSecurityRequirementObject0.java + +public class PetfindbystatusGetSecurityRequirementObject0 +extends SecurityRequirementObject + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| PetfindbystatusGetSecurityRequirementObject0()
Creates an instance | + +### 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()
    )) | diff --git a/samples/client/petstore/kotlin/docs/paths/petfindbystatus/get/security/PetfindbystatusGetSecurityRequirementObject1.md b/samples/client/petstore/kotlin/docs/paths/petfindbystatus/get/security/PetfindbystatusGetSecurityRequirementObject1.md new file mode 100644 index 00000000000..6749160f760 --- /dev/null +++ b/samples/client/petstore/kotlin/docs/paths/petfindbystatus/get/security/PetfindbystatusGetSecurityRequirementObject1.md @@ -0,0 +1,15 @@ +# PetfindbystatusGetSecurityRequirementObject1 +PetfindbystatusGetSecurityRequirementObject1.java + +public class PetfindbystatusGetSecurityRequirementObject1 +extends SecurityRequirementObject + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| PetfindbystatusGetSecurityRequirementObject1()
Creates an instance | + +### 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()
    )) | diff --git a/samples/client/petstore/kotlin/docs/paths/petfindbystatus/get/security/PetfindbystatusGetSecurityRequirementObject2.md b/samples/client/petstore/kotlin/docs/paths/petfindbystatus/get/security/PetfindbystatusGetSecurityRequirementObject2.md new file mode 100644 index 00000000000..7f0527ce9f7 --- /dev/null +++ b/samples/client/petstore/kotlin/docs/paths/petfindbystatus/get/security/PetfindbystatusGetSecurityRequirementObject2.md @@ -0,0 +1,15 @@ +# PetfindbystatusGetSecurityRequirementObject2 +PetfindbystatusGetSecurityRequirementObject2.java + +public class PetfindbystatusGetSecurityRequirementObject2 +extends SecurityRequirementObject + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| PetfindbystatusGetSecurityRequirementObject2()
Creates an instance | + +### 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")
    )) | diff --git a/samples/client/petstore/kotlin/docs/paths/petfindbystatus/servers/PetfindbystatusServer0.md b/samples/client/petstore/kotlin/docs/paths/petfindbystatus/servers/PetfindbystatusServer0.md new file mode 100644 index 00000000000..475550269b3 --- /dev/null +++ b/samples/client/petstore/kotlin/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/kotlin/docs/paths/petfindbystatus/servers/PetfindbystatusServer1.md b/samples/client/petstore/kotlin/docs/paths/petfindbystatus/servers/PetfindbystatusServer1.md new file mode 100644 index 00000000000..66dbb2170be --- /dev/null +++ b/samples/client/petstore/kotlin/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([PetfindbystatusServer1Variables.VariablesMap](../../../paths/petfindbystatus/servers/server1/PetfindbystatusServer1Variables.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}" | +| [PetfindbystatusServer1Variables.VariablesMap](../../../paths/petfindbystatus/servers/server1/PetfindbystatusServer1Variables.md#variablesmap) | variables | diff --git a/samples/client/petstore/kotlin/docs/paths/petfindbystatus/servers/server1/PetfindbystatusServer1Variables.md b/samples/client/petstore/kotlin/docs/paths/petfindbystatus/servers/server1/PetfindbystatusServer1Variables.md new file mode 100644 index 00000000000..df668b94ef7 --- /dev/null +++ b/samples/client/petstore/kotlin/docs/paths/petfindbystatus/servers/server1/PetfindbystatusServer1Variables.md @@ -0,0 +1,355 @@ +# PetfindbystatusServer1Variables +public class PetfindbystatusServer1Variables
+ +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 | [PetfindbystatusServer1Variables.PetfindbystatusServer1Variables1Boxed](#petfindbystatusserver1variables1boxed)
sealed interface for validated payloads | +| record | [PetfindbystatusServer1Variables.PetfindbystatusServer1Variables1BoxedMap](#petfindbystatusserver1variables1boxedmap)
boxed class to store validated Map payloads | +| static class | [PetfindbystatusServer1Variables.PetfindbystatusServer1Variables1](#petfindbystatusserver1variables1)
schema class | +| static class | [PetfindbystatusServer1Variables.VariablesMapBuilder](#variablesmapbuilder)
builder for Map payloads | +| static class | [PetfindbystatusServer1Variables.VariablesMap](#variablesmap)
output class for Map payloads | +| sealed interface | [PetfindbystatusServer1Variables.VersionBoxed](#versionboxed)
sealed interface for validated payloads | +| record | [PetfindbystatusServer1Variables.VersionBoxedString](#versionboxedstring)
boxed class to store validated String payloads | +| static class | [PetfindbystatusServer1Variables.Version](#version)
schema class | +| enum | [PetfindbystatusServer1Variables.StringVersionEnums](#stringversionenums)
String enum | +| sealed interface | [PetfindbystatusServer1Variables.AdditionalPropertiesBoxed](#additionalpropertiesboxed)
sealed interface for validated payloads | +| record | [PetfindbystatusServer1Variables.AdditionalPropertiesBoxedVoid](#additionalpropertiesboxedvoid)
boxed class to store validated null payloads | +| record | [PetfindbystatusServer1Variables.AdditionalPropertiesBoxedBoolean](#additionalpropertiesboxedboolean)
boxed class to store validated boolean payloads | +| record | [PetfindbystatusServer1Variables.AdditionalPropertiesBoxedNumber](#additionalpropertiesboxednumber)
boxed class to store validated Number payloads | +| record | [PetfindbystatusServer1Variables.AdditionalPropertiesBoxedString](#additionalpropertiesboxedstring)
boxed class to store validated String payloads | +| record | [PetfindbystatusServer1Variables.AdditionalPropertiesBoxedList](#additionalpropertiesboxedlist)
boxed class to store validated List payloads | +| record | [PetfindbystatusServer1Variables.AdditionalPropertiesBoxedMap](#additionalpropertiesboxedmap)
boxed class to store validated Map payloads | +| static class | [PetfindbystatusServer1Variables.AdditionalProperties](#additionalproperties)
schema class | + +## PetfindbystatusServer1Variables1Boxed +public sealed interface PetfindbystatusServer1Variables1Boxed
+permits
+[PetfindbystatusServer1Variables1BoxedMap](#petfindbystatusserver1variables1boxedmap) + +sealed interface that stores validated payloads using boxed classes + +## PetfindbystatusServer1Variables1BoxedMap +public record PetfindbystatusServer1Variables1BoxedMap
+implements [PetfindbystatusServer1Variables1Boxed](#petfindbystatusserver1variables1boxed) + +record that stores validated Map payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| PetfindbystatusServer1Variables1BoxedMap([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 | + +## PetfindbystatusServer1Variables1 +public static class PetfindbystatusServer1Variables1
+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.PetfindbystatusServer1Variables; + +import java.util.Arrays; +import java.util.List; +import java.util.AbstractMap; + +static final SchemaConfiguration configuration = new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().build()); + +// Map validation +PetfindbystatusServer1Variables.VariablesMap validatedPayload = + PetfindbystatusServer1Variables.PetfindbystatusServer1Variables1.validate( + new PetfindbystatusServer1Variables.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) | +| [PetfindbystatusServer1Variables1BoxedMap](#petfindbystatusserver1variables1boxedmap) | validateAndBox([Map<?, ?>](#variablesmapbuilder) arg, SchemaConfiguration configuration) | +| [PetfindbystatusServer1Variables1Boxed](#petfindbystatusserver1variables1boxed) | 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.PetfindbystatusServer1Variables; + +import java.util.Arrays; +import java.util.List; +import java.util.AbstractMap; + +static final SchemaConfiguration configuration = new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().build()); + +// String validation +String validatedPayload = PetfindbystatusServer1Variables.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(Nothing? data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| Nothing? | 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/kotlin/docs/paths/petfindbytags/PetfindbytagsGet.md b/samples/client/petstore/kotlin/docs/paths/petfindbytags/PetfindbytagsGet.md new file mode 100644 index 00000000000..2053c4b2596 --- /dev/null +++ b/samples/client/petstore/kotlin/docs/paths/petfindbytags/PetfindbytagsGet.md @@ -0,0 +1,206 @@ +# PetfindbytagsGet + +public class PetfindbytagsGet + +A class that contains necessary endpoint classes +- a class that calls the endpoint method using the http verb +- a class that calls the endpoint method using the operationId name +- class(es) to store the request inputs +- builder(s) to set the request input data + +## Nested Class Summary +| Modifier and Type | Class and Description | +| ----------------- | --------------------- | +| static class | [Get](#get)
The class that has a get method to call the endpoint | +| interface | [FindPetsByTagsOperation](#findpetsbytagsoperation)
The interface that has a findPetsByTags method to call the endpoint | +| static class | [GetRequest](#getrequest)
The final request inputs class | +| static class | [GetNullableRequest](#getnullablerequest)
The initial request inputs class | +| static class | [Get0RequestBuilder](#get0requestbuilder)
A builder for the request input class | +| static class | [GetRequestBuilder](#getrequestbuilder)
A builder for the request input class | + +## Get +public static class Get extends ApiClient.ApiClient1 implements GetOperation
+ +a class that allows one to call the endpoint using a method named get + +### 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.petfindbytags.get.PetfindbytagsGetSecurityInfo; +import org.openapijsonschematools.client.paths.petfindbytags.get.PetfindbytagsGetQueryParameters; +import org.openapijsonschematools.client.servers.RootServer0; +import org.openapijsonschematools.client.servers.RootServer1; +import org.openapijsonschematools.client.servers.RootServer2; +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.PetfindbytagsGetCode200Response; +import org.openapijsonschematools.client.paths.petfindbytags.get.responses.PetfindbytagsGetCode400Response; +import org.openapijsonschematools.client.servers.RootServerInfo; +import org.openapijsonschematools.client.paths.petfindbytags.PetfindbytagsGet; +import org.openapijsonschematools.client.paths.petfindbytags.get.PetfindbytagsGetResponses; + +import java.io.IOException; +import java.util.Arrays; +import java.util.List; +import java.util.Map; +import java.util.AbstractMap; + +// if you want to use a server that is not SERVER_0 pass it in here and change the ServerIndex input below +ApiConfiguration.ServerInfo serverInfo = new ApiConfiguration.ServerInfoBuilder() + .rootServerInfo( + new RootServerInfo.RootServerInfoBuilder() + .rootServer0(new RootServer0()) + .build() + ) + .build(); +ApiConfiguration.ServerIndexInfo serverIndexInfo = new ApiConfiguration.ServerIndexInfoBuilder() + .rootServerInfoServerIndex(RootServerInfo.ServerIndex.SERVER_0) + .build(); +List securitySchemes = new ArrayList(); +ApiConfiguration.SecurityIndexInfo securityIndexInfo = new ApiConfiguration.SecurityIndexInfoBuilder() + .petfindbytagsGetSecurityRequirementObject0SecurityIndex(PetfindbytagsGetSecurityRequirementObject0.SecurityIndex.SECURITY_0) + .build(); +Duration timeout = Duration.ofSeconds(1L); +Map> defaultHeaders = Map.of("User-Agent", List.of("OpenAPI-JSON-Schema-Generator/1.0.0/java")); +ApiConfiguration apiConfiguration = new ApiConfiguration( + serverInfo + serverIndexInfo, + securitySchemes, + securityIndexInfo, + timeout, + defaultHeaders +); +SchemaConfiguration schemaConfiguration = new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().build()); +PetfindbytagsGet.Get apiClient = new PetfindbytagsGet.Get(apiConfiguration, schemaConfiguration); + + +// Map validation +PetfindbytagsGetQueryParameters.QueryParametersMap queryParameters = + PetfindbytagsGetQueryParameters.PetfindbytagsGetQueryParameters1.validate( + new PetfindbytagsGetQueryParameters.QueryParametersMapBuilder() + .tags( + Arrays.asList( + "a" + ) + ) + .build(), + schemaConfiguration +); + +var request = new PetfindbytagsGet.GetRequestBuilder() + .queryParameters(queryParameters) + .build(); + +PetfindbytagsGetResponses.EndpointResponse response; +try { + response = apiClient.get(request); +} catch (PetfindbytagsGetCode400Response.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; +} +PetfindbytagsGetResponses.EndpointPetfindbytagsGetCode200Response castResponse = (PetfindbytagsGetResponses.EndpointPetfindbytagsGetCode200Response) response; +} +``` +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| Get(ApiConfiguration apiConfiguration, SchemaConfiguration schemaConfiguration)
Creates an instance | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| [PetfindbytagsGetResponses.EndpointResponse](../../paths/petfindbytags/get/PetfindbytagsGetResponses.md#endpointresponse) | get([GetRequest](#getrequest) request) | + +## FindPetsByTagsOperation +public interface FindPetsByTagsOperation
+ +an interface that allows one to call the endpoint using a method named findPetsByTags by the operationId + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| [PetfindbytagsGetResponses.EndpointResponse](../../paths/petfindbytags/get/PetfindbytagsGetResponses.md#endpointresponse) | findPetsByTags([GetRequest](#getrequest) request) | + +## GetRequest +public static class GetRequest
+ +a class that stores the final request inputs + +### Field Summary +| Modifier and Type | Field and Description | +| ----------------- | --------------------- | +| [PetfindbytagsGetQueryParameters.QueryParametersMap](../../paths/petfindbytags/get/PetfindbytagsGetQueryParameters.md#queryparametersmap) | queryParameters | +| [RootServerInfo.@Nullable ServerIndex](../../RootServerInfo.md#serverindex) | serverIndex
optional. Note: this will override the value in apiConfiguration | +| [PetfindbytagsGetSecurityInfo.@Nullable SecurityIndex](../../paths/petfindbytags/get/PetfindbytagsGetSecurityInfo.md#securityindex) | securityIndex
optional. Note: this will override the value in apiConfiguration | +| @Nullable Duration | timeout
optional. Note: this will override the value in apiConfiguration | + +## GetNullableRequest +public static class GetNullableRequest
+ +a class that stores the initial request inputs + +### Field Summary +| Modifier and Type | Field and Description | +| ----------------- | --------------------- | +| [PetfindbytagsGetQueryParameters.@Nullable QueryParametersMap](../../paths/petfindbytags/get/PetfindbytagsGetQueryParameters.md#queryparametersmap) | queryParameters | +| [RootServerInfo.@Nullable ServerIndex](../../RootServerInfo.md#serverindex) | serverIndex | +| [PetfindbytagsGetSecurityInfo.@Nullable SecurityIndex](../../paths/petfindbytags/get/PetfindbytagsGetSecurityInfo.md#securityindex) | securityIndex | +| @Nullable Duration | timeout | + +## Get0RequestBuilder +public static class Get0RequestBuilder
+ +a builder for request inputs + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| Get0RequestBuilder(Get0RequestBuilder instance)
Creates a builder that contains the passed instance | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| [GetRequest](#getrequest) | build()
Returns the request input used to call an endpoint method | +| [Get0RequestBuilder](#get0requestbuilder) | serverIndex([RootServerInfo.ServerIndex](../../RootServerInfo.md#serverindex) serverIndex)
sets the optional property. Note: this will override the value in apiConfiguration | +| [Get0RequestBuilder](#get0requestbuilder) | securityIndex([PetfindbytagsGetSecurityInfo.SecurityIndex](../../paths/petfindbytags/get/PetfindbytagsGetSecurityInfo.md#securityindex) securityIndex)
sets the optional property. Note: this will override the value in apiConfiguration | +| [Get0RequestBuilder](#get0requestbuilder) | timeout(Duration timeout)
sets the optional property. Note: this will override the value in apiConfiguration | + +## GetRequestBuilder +public static class GetRequestBuilder
+ +a builder for request inputs + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| GetRequestBuilder()
Creates a builder that contains null for all parameters | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| [Get0RequestBuilder](#get0requestbuilder) | queryParameters([PetfindbytagsGetQueryParametersQueryParametersMap](../../paths/petfindbytags/get/PetfindbytagsGetQueryParameters.md#queryparametersmap) queryParameters)
sets the property | + +[[Back to top]](#top) [[Back to README]](../../../README.md) diff --git a/samples/client/petstore/kotlin/docs/paths/petfindbytags/get/PetfindbytagsGetQueryParameters.md b/samples/client/petstore/kotlin/docs/paths/petfindbytags/get/PetfindbytagsGetQueryParameters.md new file mode 100644 index 00000000000..b879671fc74 --- /dev/null +++ b/samples/client/petstore/kotlin/docs/paths/petfindbytags/get/PetfindbytagsGetQueryParameters.md @@ -0,0 +1,271 @@ +# PetfindbytagsGetQueryParameters +public class PetfindbytagsGetQueryParameters
+ +A class that contains necessary nested +- schema classes (which validate payloads), extends JsonSchema +- sealed interfaces which store validated payloads, java version of a sum type +- boxed classes which store validated payloads, sealed permits class implementations +- classes to store validated map payloads, extends FrozenMap +- classes to build inputs for map payloads + +## Nested Class Summary +| Modifier and Type | Class and Description | +| ----------------- | ---------------------- | +| sealed interface | [PetfindbytagsGetQueryParameters.PetfindbytagsGetQueryParameters1Boxed](#petfindbytagsgetqueryparameters1boxed)
sealed interface for validated payloads | +| record | [PetfindbytagsGetQueryParameters.PetfindbytagsGetQueryParameters1BoxedMap](#petfindbytagsgetqueryparameters1boxedmap)
boxed class to store validated Map payloads | +| static class | [PetfindbytagsGetQueryParameters.PetfindbytagsGetQueryParameters1](#petfindbytagsgetqueryparameters1)
schema class | +| static class | [PetfindbytagsGetQueryParameters.QueryParametersMapBuilder](#queryparametersmapbuilder)
builder for Map payloads | +| static class | [PetfindbytagsGetQueryParameters.QueryParametersMap](#queryparametersmap)
output class for Map payloads | +| sealed interface | [PetfindbytagsGetQueryParameters.AdditionalPropertiesBoxed](#additionalpropertiesboxed)
sealed interface for validated payloads | +| record | [PetfindbytagsGetQueryParameters.AdditionalPropertiesBoxedVoid](#additionalpropertiesboxedvoid)
boxed class to store validated null payloads | +| record | [PetfindbytagsGetQueryParameters.AdditionalPropertiesBoxedBoolean](#additionalpropertiesboxedboolean)
boxed class to store validated boolean payloads | +| record | [PetfindbytagsGetQueryParameters.AdditionalPropertiesBoxedNumber](#additionalpropertiesboxednumber)
boxed class to store validated Number payloads | +| record | [PetfindbytagsGetQueryParameters.AdditionalPropertiesBoxedString](#additionalpropertiesboxedstring)
boxed class to store validated String payloads | +| record | [PetfindbytagsGetQueryParameters.AdditionalPropertiesBoxedList](#additionalpropertiesboxedlist)
boxed class to store validated List payloads | +| record | [PetfindbytagsGetQueryParameters.AdditionalPropertiesBoxedMap](#additionalpropertiesboxedmap)
boxed class to store validated Map payloads | +| static class | [PetfindbytagsGetQueryParameters.AdditionalProperties](#additionalproperties)
schema class | + +## PetfindbytagsGetQueryParameters1Boxed +public sealed interface PetfindbytagsGetQueryParameters1Boxed
+permits
+[PetfindbytagsGetQueryParameters1BoxedMap](#petfindbytagsgetqueryparameters1boxedmap) + +sealed interface that stores validated payloads using boxed classes + +## PetfindbytagsGetQueryParameters1BoxedMap +public record PetfindbytagsGetQueryParameters1BoxedMap
+implements [PetfindbytagsGetQueryParameters1Boxed](#petfindbytagsgetqueryparameters1boxed) + +record that stores validated Map payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| PetfindbytagsGetQueryParameters1BoxedMap([QueryParametersMap](#queryparametersmap) data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| [QueryParametersMap](#queryparametersmap) | data()
validated payload | +| @Nullable Object | getData()
validated payload | + +## PetfindbytagsGetQueryParameters1 +public static class PetfindbytagsGetQueryParameters1
+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.petfindbytags.get.PetfindbytagsGetQueryParameters; + +import java.util.Arrays; +import java.util.List; +import java.util.AbstractMap; + +static final SchemaConfiguration configuration = new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().build()); + +// Map validation +PetfindbytagsGetQueryParameters.QueryParametersMap validatedPayload = + PetfindbytagsGetQueryParameters.PetfindbytagsGetQueryParameters1.validate( + new PetfindbytagsGetQueryParameters.QueryParametersMapBuilder() + .tags( + Arrays.asList( + "a" + ) + ) + .build(), + configuration +); +``` + +### Field Summary +| Modifier and Type | Field and Description | +| ----------------- | ---------------------- | +| Set> | type = Set.of(Map.class) | +| Map> | properties = Map.ofEntries(
    new PropertyEntry("tags", [Schema0.Schema01.class](../../../paths/petfindbytags/get/parameters/parameter0/Schema0.md#schema01))
)
| +| Set | required = Set.of(
    "tags"
)
| +| Class | additionalProperties = [AdditionalProperties.class](#additionalproperties) | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| [QueryParametersMap](#queryparametersmap) | validate([Map<?, ?>](#queryparametersmapbuilder) arg, SchemaConfiguration configuration) | +| [PetfindbytagsGetQueryParameters1BoxedMap](#petfindbytagsgetqueryparameters1boxedmap) | validateAndBox([Map<?, ?>](#queryparametersmapbuilder) arg, SchemaConfiguration configuration) | +| [PetfindbytagsGetQueryParameters1Boxed](#petfindbytagsgetqueryparameters1boxed) | validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) | +| @Nullable Object | validate(@Nullable Object arg, SchemaConfiguration configuration) | + +## QueryParametersMap0Builder +public class QueryParametersMap0Builder
+builder for `Map>` + +A class that builds the Map input type + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| QueryParametersMap0Builder(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 | + +## QueryParametersMapBuilder +public class QueryParametersMapBuilder
+builder for `Map>` + +A class that builds the Map input type + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| QueryParametersMapBuilder()
Creates a builder that contains an empty map | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| [QueryParametersMap0Builder](#queryparametersmap0builder) | tags(List value) | + +## QueryParametersMap +public static class QueryParametersMap
+extends FrozenMap + +A class to store validated Map payloads + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| static [QueryParametersMap](#queryparametersmap) | of([Map>](#queryparametersmapbuilder) arg, SchemaConfiguration configuration) | +| [Schema0.SchemaList0](../../../paths/petfindbytags/get/parameters/parameter0/Schema0.md#schemalist0) | tags()
| + +## 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(Nothing? data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| Nothing? | 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/kotlin/docs/paths/petfindbytags/get/PetfindbytagsGetResponses.md b/samples/client/petstore/kotlin/docs/paths/petfindbytags/get/PetfindbytagsGetResponses.md new file mode 100644 index 00000000000..bbad709d795 --- /dev/null +++ b/samples/client/petstore/kotlin/docs/paths/petfindbytags/get/PetfindbytagsGetResponses.md @@ -0,0 +1,29 @@ +# PetfindbytagsGetResponses + +public class PetfindbytagsGetResponses + +A class that contains necessary responses classes +- a sealed interface, EndpointResponse, that stores endpoint responses +- records for each endpoint response + +## Nested Class Summary +| Modifier and Type | Class and Description | +| ----------------- | --------------------- | +| sealed interface | [EndpointResponse](#endpointresponse)
stores the endpoint responses | +| record | [EndpointPetfindbytagsGetCode200Response](#endpointpetfindbytagsgetcode200response)
the response for 200 | + +## EndpointResponse +public sealed interface EndpointResponse permits
+[EndpointPetfindbytagsGetCode200Response](#endpointpetfindbytagsgetcode200response) + +a sealed interface that stores endpoint responses + +## EndpointPetfindbytagsGetCode200Response +public record EndpointPetfindbytagsGetCode200Response( + HttpResponse response, + [PetfindbytagsGetCode200Response.SealedResponseBody](../../../paths/petfindbytags/get/responses/PetfindbytagsGetCode200Response.md#sealedresponsebody) body, + Nothing? headers +) implements EndpointResponse, ApiResponse
+ +a class that stores an endpoint response + diff --git a/samples/client/petstore/kotlin/docs/paths/petfindbytags/get/PetfindbytagsGetSecurityInfo.md b/samples/client/petstore/kotlin/docs/paths/petfindbytags/get/PetfindbytagsGetSecurityInfo.md new file mode 100644 index 00000000000..ea6339e8f26 --- /dev/null +++ b/samples/client/petstore/kotlin/docs/paths/petfindbytags/get/PetfindbytagsGetSecurityInfo.md @@ -0,0 +1,42 @@ +# PetfindbytagsGetSecurityInfo +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 +- an enum class that describes security index values + +## Nested Class Summary +| Modifier and Type | Class and Description | +| ----------------- | --------------------- | +| static class | [PetfindbytagsGetSecurityInfo.PetfindbytagsGetSecurityInfo1](#petfindbytagsgetsecurityinfo1)
SecurityRequirementObjectProvider +| enum | [PetfindbytagsGetSecurityInfo.SecurityIndex](#securityindex)
class that stores a security index | + +## PetfindbytagsGetSecurityInfo1 +implements SecurityRequirementObjectProvider<[SecurityIndex](#securityindex)> + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| PetfindbytagsGetSecurityInfo1()
Creates an instance | + +### Field Summary +| Modifier and Type | Field and Description | +| ----------------- | --------------------- | +| [PetfindbytagsGetSecurityRequirementObject0](../../../paths/petfindbytags/get/security/PetfindbytagsGetSecurityRequirementObject0.md) | security0 | +| [PetfindbytagsGetSecurityRequirementObject1](../../../paths/petfindbytags/get/security/PetfindbytagsGetSecurityRequirementObject1.md) | security1 | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| SecurityRequirementObject | getSecurityRequirementObject(@Nullable [SecurityIndex](#securityindex) securityIndex)
If null is input, then the instance's securityIndex will be used | + +## SecurityIndex +enum SecurityIndex
+ +### Enum Constant Summary +| Enum Constant And Description | +| ----------------------------- | +| SECURITY_0
security 0 | +| SECURITY_1
security 1 | diff --git a/samples/client/petstore/kotlin/docs/paths/petfindbytags/get/parameters/parameter0/Schema0.md b/samples/client/petstore/kotlin/docs/paths/petfindbytags/get/parameters/parameter0/Schema0.md new file mode 100644 index 00000000000..8c3322c09f9 --- /dev/null +++ b/samples/client/petstore/kotlin/docs/paths/petfindbytags/get/parameters/parameter0/Schema0.md @@ -0,0 +1,156 @@ +# Schema0 +public class Schema0
+ +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 list payloads, extends FrozenList +- classes to build inputs for list payloads + +## Nested Class Summary +| Modifier and Type | Class and Description | +| ----------------- | ---------------------- | +| sealed interface | [Schema0.Schema01Boxed](#schema01boxed)
sealed interface for validated payloads | +| record | [Schema0.Schema01BoxedList](#schema01boxedlist)
boxed class to store validated List payloads | +| static class | [Schema0.Schema01](#schema01)
schema class | +| static class | [Schema0.SchemaListBuilder0](#schemalistbuilder0)
builder for List payloads | +| static class | [Schema0.SchemaList0](#schemalist0)
output class for List payloads | +| sealed interface | [Schema0.Items0Boxed](#items0boxed)
sealed interface for validated payloads | +| record | [Schema0.Items0BoxedString](#items0boxedstring)
boxed class to store validated String payloads | +| static class | [Schema0.Items0](#items0)
schema class | + +## Schema01Boxed +public sealed interface Schema01Boxed
+permits
+[Schema01BoxedList](#schema01boxedlist) + +sealed interface that stores validated payloads using boxed classes + +## Schema01BoxedList +public record Schema01BoxedList
+implements [Schema01Boxed](#schema01boxed) + +record that stores validated List payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| Schema01BoxedList([SchemaList0](#schemalist0) data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| [SchemaList0](#schemalist0) | data()
validated payload | +| @Nullable Object | getData()
validated payload | + +## Schema01 +public static class Schema01
+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.petfindbytags.get.parameters.parameter0.Schema0; + +import java.util.Arrays; +import java.util.List; +import java.util.AbstractMap; + +static final SchemaConfiguration configuration = new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().build()); + +// List validation +Schema0.SchemaList0 validatedPayload = + Schema0.Schema01.validate( + new Schema0.SchemaListBuilder0() + .add("a") + + .build(), + configuration +); +``` + +### Field Summary +| Modifier and Type | Field and Description | +| ----------------- | ---------------------- | +| Set> | type = Set.of(List.class) | +| Class | items = [Items0.class](#items0) | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| [SchemaList0](#schemalist0) | validate([List](#schemalistbuilder0) arg, SchemaConfiguration configuration) | +| [Schema01BoxedList](#schema01boxedlist) | validateAndBox([List](#schemalistbuilder0) arg, SchemaConfiguration configuration) | +| [Schema01Boxed](#schema01boxed) | validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) | +| @Nullable Object | validate(@Nullable Object arg, SchemaConfiguration configuration) | + +## SchemaListBuilder0 +public class SchemaListBuilder0
+builder for `List` + +A class that builds the List input type + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| SchemaListBuilder0()
Creates an empty list | +| SchemaListBuilder0(List items)
Stores the items in a list | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| SchemaListBuilder0 | add(String item) | +| List | build()
Returns list input that should be used with Schema.validate | + +## SchemaList0 +public class SchemaList0
+extends `FrozenList` + +A class to store validated List payloads + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| static [SchemaList0](#schemalist0) | of([List](#schemalistbuilder0) arg, SchemaConfiguration configuration) | + +## Items0Boxed +public sealed interface Items0Boxed
+permits
+[Items0BoxedString](#items0boxedstring) + +sealed interface that stores validated payloads using boxed classes + +## Items0BoxedString +public record Items0BoxedString
+implements [Items0Boxed](#items0boxed) + +record that stores validated String payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| Items0BoxedString(String data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| String | data()
validated payload | +| @Nullable Object | getData()
validated payload | + +## Items0 +public static class Items0
+extends StringJsonSchema.StringJsonSchema1 + +A schema class that validates payloads + +| Methods Inherited from class org.openapijsonschematools.client.schemas.StringJsonSchema.StringJsonSchema1 | +| ------------------------------------------------------------------ | +| validate | +| validateAndBox | diff --git a/samples/client/petstore/kotlin/docs/paths/petfindbytags/get/responses/PetfindbytagsGetCode200Response.md b/samples/client/petstore/kotlin/docs/paths/petfindbytags/get/responses/PetfindbytagsGetCode200Response.md new file mode 100644 index 00000000000..e2de5e1fab7 --- /dev/null +++ b/samples/client/petstore/kotlin/docs/paths/petfindbytags/get/responses/PetfindbytagsGetCode200Response.md @@ -0,0 +1,17 @@ +# PetfindbytagsGetCode200Response + +public class PetfindbytagsGetCode200Response extends [RefSuccessfulXmlAndJsonArrayOfPet](../../components/responses/RefSuccessfulXmlAndJsonArrayOfPet.md) + +A class (extended from the $ref class) that contains necessary nested response classes +- a class that extends ResponseDeserializer and is used to deserialize responses + +## Nested Class Summary +| Modifier and Type | Class and Description | +| ----------------- | --------------------- | +| static class | [PetfindbytagsGetCode200Response.PetfindbytagsGetCode200Response1](#petfindbytagsgetcode200response1)
class that deserializes responses | + +## PetfindbytagsGetCode200Response1 +public static class PetfindbytagsGetCode200Response1 extends [RefSuccessfulXmlAndJsonArrayOfPet1](../../components/responses/RefSuccessfulXmlAndJsonArrayOfPet.md#refsuccessfulxmlandjsonarrayofpet1)
+ +a class that deserializes responses, extended from the $ref class + diff --git a/samples/client/petstore/kotlin/docs/paths/petfindbytags/get/responses/PetfindbytagsGetCode400Response.md b/samples/client/petstore/kotlin/docs/paths/petfindbytags/get/responses/PetfindbytagsGetCode400Response.md new file mode 100644 index 00000000000..eb3a796fd49 --- /dev/null +++ b/samples/client/petstore/kotlin/docs/paths/petfindbytags/get/responses/PetfindbytagsGetCode400Response.md @@ -0,0 +1,32 @@ +# PetfindbytagsGetCode400Response + +public class PetfindbytagsGetCode400Response + +A class that contains necessary nested response classes +- a class that extends ResponseDeserializer and is used to deserialize responses + +## Nested Class Summary +| Modifier and Type | Class and Description | +| ----------------- | --------------------- | +| static class | [PetfindbytagsGetCode400Response.PetfindbytagsGetCode400Response1](#petfindbytagsgetcode400response1)
class that deserializes responses | + +## PetfindbytagsGetCode400Response1 +public static class PetfindbytagsGetCode400Response1
+extends ResponseDeserializer + +a class that deserializes responses + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| PetfindbytagsGetCode400Response1()
Creates an instance | + +### Field Summary +| Modifier and Type | Field and Description | +| ----------------- | --------------------- | +| Map | content = MapUtils.makeMap(
)
the contentType to schema info | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| ApiResponse | deserialize(HttpResponse response, SchemaConfiguration configuration)
called by endpoint when deserialize responses | diff --git a/samples/client/petstore/kotlin/docs/paths/petfindbytags/get/security/PetfindbytagsGetSecurityRequirementObject0.md b/samples/client/petstore/kotlin/docs/paths/petfindbytags/get/security/PetfindbytagsGetSecurityRequirementObject0.md new file mode 100644 index 00000000000..256a672a40f --- /dev/null +++ b/samples/client/petstore/kotlin/docs/paths/petfindbytags/get/security/PetfindbytagsGetSecurityRequirementObject0.md @@ -0,0 +1,15 @@ +# PetfindbytagsGetSecurityRequirementObject0 +PetfindbytagsGetSecurityRequirementObject0.java + +public class PetfindbytagsGetSecurityRequirementObject0 +extends SecurityRequirementObject + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| PetfindbytagsGetSecurityRequirementObject0()
Creates an instance | + +### 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()
    )) | diff --git a/samples/client/petstore/kotlin/docs/paths/petfindbytags/get/security/PetfindbytagsGetSecurityRequirementObject1.md b/samples/client/petstore/kotlin/docs/paths/petfindbytags/get/security/PetfindbytagsGetSecurityRequirementObject1.md new file mode 100644 index 00000000000..39a130b834f --- /dev/null +++ b/samples/client/petstore/kotlin/docs/paths/petfindbytags/get/security/PetfindbytagsGetSecurityRequirementObject1.md @@ -0,0 +1,15 @@ +# PetfindbytagsGetSecurityRequirementObject1 +PetfindbytagsGetSecurityRequirementObject1.java + +public class PetfindbytagsGetSecurityRequirementObject1 +extends SecurityRequirementObject + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| PetfindbytagsGetSecurityRequirementObject1()
Creates an instance | + +### 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")
    )) | diff --git a/samples/client/petstore/kotlin/docs/paths/petpetid/PetpetidDelete.md b/samples/client/petstore/kotlin/docs/paths/petpetid/PetpetidDelete.md new file mode 100644 index 00000000000..6c4053692d4 --- /dev/null +++ b/samples/client/petstore/kotlin/docs/paths/petpetid/PetpetidDelete.md @@ -0,0 +1,207 @@ +# PetpetidDelete + +public class PetpetidDelete + +A class that contains necessary endpoint classes +- a class that calls the endpoint method using the http verb +- a class that calls the endpoint method using the operationId name +- class(es) to store the request inputs +- builder(s) to set the request input data + +## Nested Class Summary +| Modifier and Type | Class and Description | +| ----------------- | --------------------- | +| static class | [Delete](#delete)
The class that has a delete method to call the endpoint | +| interface | [DeletePetOperation](#deletepetoperation)
The interface that has a deletePet method to call the endpoint | +| static class | [DeleteRequest](#deleterequest)
The final request inputs class | +| static class | [DeleteNullableRequest](#deletenullablerequest)
The initial request inputs class | +| static class | [Delete0RequestBuilder](#delete0requestbuilder)
A builder for the request input class | +| static class | [DeleteRequestBuilder](#deleterequestbuilder)
A builder for the request input class | + +## Delete +public static class Delete extends ApiClient.ApiClient1 implements DeleteOperation
+ +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.PetpetidDeleteHeaderParameters; +import org.openapijsonschematools.client.RootServerInfo; +import org.openapijsonschematools.client.paths.petpetid.delete.PetpetidDeleteSecurityInfo; +import org.openapijsonschematools.client.paths.petpetid.delete.PetpetidDeletePathParameters; +import org.openapijsonschematools.client.servers.RootServer0; +import org.openapijsonschematools.client.servers.RootServer1; +import org.openapijsonschematools.client.servers.RootServer2; +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.PetpetidDeleteCode400Response; +import org.openapijsonschematools.client.servers.RootServerInfo; +import org.openapijsonschematools.client.paths.petpetid.PetpetidDelete; +import org.openapijsonschematools.client.paths.petpetid.delete.PetpetidDeleteResponses; + +import java.io.IOException; +import java.util.Arrays; +import java.util.List; +import java.util.Map; +import java.util.AbstractMap; + +// if you want to use a server that is not SERVER_0 pass it in here and change the ServerIndex input below +ApiConfiguration.ServerInfo serverInfo = new ApiConfiguration.ServerInfoBuilder() + .rootServerInfo( + new RootServerInfo.RootServerInfoBuilder() + .rootServer0(new RootServer0()) + .build() + ) + .build(); +ApiConfiguration.ServerIndexInfo serverIndexInfo = new ApiConfiguration.ServerIndexInfoBuilder() + .rootServerInfoServerIndex(RootServerInfo.ServerIndex.SERVER_0) + .build(); +List securitySchemes = new ArrayList(); +securitySchemes.add( + new ApiKey("someApiKey"); +); +ApiConfiguration.SecurityIndexInfo securityIndexInfo = new ApiConfiguration.SecurityIndexInfoBuilder() + .petpetidDeleteSecurityRequirementObject0SecurityIndex(PetpetidDeleteSecurityRequirementObject0.SecurityIndex.SECURITY_0) + .build(); +Duration timeout = Duration.ofSeconds(1L); +Map> defaultHeaders = Map.of("User-Agent", List.of("OpenAPI-JSON-Schema-Generator/1.0.0/java")); +ApiConfiguration apiConfiguration = new ApiConfiguration( + serverInfo + serverIndexInfo, + securitySchemes, + securityIndexInfo, + timeout, + defaultHeaders +); +SchemaConfiguration schemaConfiguration = new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().build()); +PetpetidDelete.Delete apiClient = new PetpetidDelete.Delete(apiConfiguration, schemaConfiguration); + + +// Map validation +PetpetidDeletePathParameters.PathParametersMap pathParameters = + PetpetidDeletePathParameters.PetpetidDeletePathParameters1.validate( + new PetpetidDeletePathParameters.PathParametersMapBuilder() + .petId(1L) + + .build(), + schemaConfiguration +); + +var request = new PetpetidDelete.DeleteRequestBuilder() + .pathParameters(pathParameters) + .build(); + +Nothing? response; +try { + response = apiClient.delete(request); +} catch (PetpetidDeleteCode400Response.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 | +| --------------------------- | +| Delete(ApiConfiguration apiConfiguration, SchemaConfiguration schemaConfiguration)
Creates an instance | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| Nothing? | delete([DeleteRequest](#deleterequest) request) | + +## DeletePetOperation +public interface DeletePetOperation
+ +an interface that allows one to call the endpoint using a method named deletePet by the operationId + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| Nothing? | deletePet([DeleteRequest](#deleterequest) request) | + +## DeleteRequest +public static class DeleteRequest
+ +a class that stores the final request inputs + +### Field Summary +| Modifier and Type | Field and Description | +| ----------------- | --------------------- | +| [PetpetidDeletePathParameters.PathParametersMap](../../paths/petpetid/delete/PetpetidDeletePathParameters.md#pathparametersmap) | pathParameters | +| [PetpetidDeleteHeaderParameters.@Nullable HeaderParametersMap](../../paths/petpetid/delete/PetpetidDeleteHeaderParameters.md#headerparametersmap) | headerParameters
optional | +| [RootServerInfo.@Nullable ServerIndex](../../RootServerInfo.md#serverindex) | serverIndex
optional. Note: this will override the value in apiConfiguration | +| [PetpetidDeleteSecurityInfo.@Nullable SecurityIndex](../../paths/petpetid/delete/PetpetidDeleteSecurityInfo.md#securityindex) | securityIndex
optional. Note: this will override the value in apiConfiguration | +| @Nullable Duration | timeout
optional. Note: this will override the value in apiConfiguration | + +## DeleteNullableRequest +public static class DeleteNullableRequest
+ +a class that stores the initial request inputs + +### Field Summary +| Modifier and Type | Field and Description | +| ----------------- | --------------------- | +| [PetpetidDeletePathParameters.@Nullable PathParametersMap](../../paths/petpetid/delete/PetpetidDeletePathParameters.md#pathparametersmap) | pathParameters | +| [PetpetidDeleteHeaderParameters.@Nullable HeaderParametersMap](../../paths/petpetid/delete/PetpetidDeleteHeaderParameters.md#headerparametersmap) | headerParameters | +| [RootServerInfo.@Nullable ServerIndex](../../RootServerInfo.md#serverindex) | serverIndex | +| [PetpetidDeleteSecurityInfo.@Nullable SecurityIndex](../../paths/petpetid/delete/PetpetidDeleteSecurityInfo.md#securityindex) | securityIndex | +| @Nullable Duration | timeout | + +## Delete0RequestBuilder +public static class Delete0RequestBuilder
+ +a builder for request inputs + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| Delete0RequestBuilder(Delete0RequestBuilder instance)
Creates a builder that contains the passed instance | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| [DeleteRequest](#deleterequest) | build()
Returns the request input used to call an endpoint method | +| [Delete0RequestBuilder](#delete0requestbuilder) | headerParameters([PetpetidDeleteHeaderParametersHeaderParametersMap](../../paths/petpetid/delete/PetpetidDeleteHeaderParameters.md#headerparametersmap) headerParameters)
sets the optional property | +| [Delete0RequestBuilder](#delete0requestbuilder) | serverIndex([RootServerInfo.ServerIndex](../../RootServerInfo.md#serverindex) serverIndex)
sets the optional property. Note: this will override the value in apiConfiguration | +| [Delete0RequestBuilder](#delete0requestbuilder) | securityIndex([PetpetidDeleteSecurityInfo.SecurityIndex](../../paths/petpetid/delete/PetpetidDeleteSecurityInfo.md#securityindex) securityIndex)
sets the optional property. Note: this will override the value in apiConfiguration | +| [Delete0RequestBuilder](#delete0requestbuilder) | timeout(Duration timeout)
sets the optional property. Note: this will override the value in apiConfiguration | + +## DeleteRequestBuilder +public static class DeleteRequestBuilder
+ +a builder for request inputs + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| DeleteRequestBuilder()
Creates a builder that contains null for all parameters | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| [Delete0RequestBuilder](#delete0requestbuilder) | pathParameters([PetpetidDeletePathParametersPathParametersMap](../../paths/petpetid/delete/PetpetidDeletePathParameters.md#pathparametersmap) pathParameters)
sets the property | + +[[Back to top]](#top) [[Back to README]](../../../README.md) diff --git a/samples/client/petstore/kotlin/docs/paths/petpetid/PetpetidGet.md b/samples/client/petstore/kotlin/docs/paths/petpetid/PetpetidGet.md new file mode 100644 index 00000000000..8ce13efbb4b --- /dev/null +++ b/samples/client/petstore/kotlin/docs/paths/petpetid/PetpetidGet.md @@ -0,0 +1,211 @@ +# PetpetidGet + +public class PetpetidGet + +A class that contains necessary endpoint classes +- a class that calls the endpoint method using the http verb +- a class that calls the endpoint method using the operationId name +- class(es) to store the request inputs +- builder(s) to set the request input data + +## Nested Class Summary +| Modifier and Type | Class and Description | +| ----------------- | --------------------- | +| static class | [Get](#get)
The class that has a get method to call the endpoint | +| interface | [GetPetByIdOperation](#getpetbyidoperation)
The interface that has a getPetById method to call the endpoint | +| static class | [GetRequest](#getrequest)
The final request inputs class | +| static class | [GetNullableRequest](#getnullablerequest)
The initial request inputs class | +| static class | [Get0RequestBuilder](#get0requestbuilder)
A builder for the request input class | +| static class | [GetRequestBuilder](#getrequestbuilder)
A builder for the request input class | + +## Get +public static class Get extends ApiClient.ApiClient1 implements GetOperation
+ +a class that allows one to call the endpoint using a method named get + +### 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.petpetid.get.PetpetidGetSecurityInfo; +import org.openapijsonschematools.client.paths.petpetid.get.PetpetidGetPathParameters; +import org.openapijsonschematools.client.servers.RootServer0; +import org.openapijsonschematools.client.servers.RootServer1; +import org.openapijsonschematools.client.servers.RootServer2; +import org.openapijsonschematools.client.securityschemes.SecurityScheme; +import org.openapijsonschematools.client.components.securityschemes.ApiKey; +import org.openapijsonschematools.client.paths.petpetid.get.responses.PetpetidGetCode200Response; +import org.openapijsonschematools.client.paths.petpetid.get.responses.PetpetidGetCode400Response; +import org.openapijsonschematools.client.paths.petpetid.get.responses.PetpetidGetCode404Response; +import org.openapijsonschematools.client.servers.RootServerInfo; +import org.openapijsonschematools.client.paths.petpetid.PetpetidGet; +import org.openapijsonschematools.client.paths.petpetid.get.PetpetidGetResponses; + +import java.io.IOException; +import java.util.Arrays; +import java.util.List; +import java.util.Map; +import java.util.AbstractMap; + +// if you want to use a server that is not SERVER_0 pass it in here and change the ServerIndex input below +ApiConfiguration.ServerInfo serverInfo = new ApiConfiguration.ServerInfoBuilder() + .rootServerInfo( + new RootServerInfo.RootServerInfoBuilder() + .rootServer0(new RootServer0()) + .build() + ) + .build(); +ApiConfiguration.ServerIndexInfo serverIndexInfo = new ApiConfiguration.ServerIndexInfoBuilder() + .rootServerInfoServerIndex(RootServerInfo.ServerIndex.SERVER_0) + .build(); +List securitySchemes = new ArrayList(); +securitySchemes.add( + new ApiKey("someApiKey"); +); +ApiConfiguration.SecurityIndexInfo securityIndexInfo = new ApiConfiguration.SecurityIndexInfoBuilder() + .petpetidGetSecurityRequirementObject0SecurityIndex(PetpetidGetSecurityRequirementObject0.SecurityIndex.SECURITY_0) + .build(); +Duration timeout = Duration.ofSeconds(1L); +Map> defaultHeaders = Map.of("User-Agent", List.of("OpenAPI-JSON-Schema-Generator/1.0.0/java")); +ApiConfiguration apiConfiguration = new ApiConfiguration( + serverInfo + serverIndexInfo, + securitySchemes, + securityIndexInfo, + timeout, + defaultHeaders +); +SchemaConfiguration schemaConfiguration = new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().build()); +PetpetidGet.Get apiClient = new PetpetidGet.Get(apiConfiguration, schemaConfiguration); + + +// Map validation +PetpetidGetPathParameters.PathParametersMap pathParameters = + PetpetidGetPathParameters.PetpetidGetPathParameters1.validate( + new PetpetidGetPathParameters.PathParametersMapBuilder() + .petId(1L) + + .build(), + schemaConfiguration +); + +var request = new PetpetidGet.GetRequestBuilder() + .pathParameters(pathParameters) + .build(); + +PetpetidGetResponses.EndpointResponse response; +try { + response = apiClient.get(request); +} catch (PetpetidGetCode400Response.ResponseApiException | PetpetidGetCode404Response.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; +} +PetpetidGetResponses.EndpointPetpetidGetCode200Response castResponse = (PetpetidGetResponses.EndpointPetpetidGetCode200Response) response; +if (castResponse.body instanceof PetpetidGetCode200Response.ApplicationxmlResponseBody deserializedBody) { + // handle deserialized body here +} else { + PetpetidGetCode200Response.ApplicationjsonResponseBody deserializedBody = (PetpetidGetCode200Response.ApplicationjsonResponseBody) castResponse.body; + // handle deserialized body here +} +``` +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| Get(ApiConfiguration apiConfiguration, SchemaConfiguration schemaConfiguration)
Creates an instance | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| [PetpetidGetResponses.EndpointResponse](../../paths/petpetid/get/PetpetidGetResponses.md#endpointresponse) | get([GetRequest](#getrequest) request) | + +## GetPetByIdOperation +public interface GetPetByIdOperation
+ +an interface that allows one to call the endpoint using a method named getPetById by the operationId + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| [PetpetidGetResponses.EndpointResponse](../../paths/petpetid/get/PetpetidGetResponses.md#endpointresponse) | getPetById([GetRequest](#getrequest) request) | + +## GetRequest +public static class GetRequest
+ +a class that stores the final request inputs + +### Field Summary +| Modifier and Type | Field and Description | +| ----------------- | --------------------- | +| [PetpetidGetPathParameters.PathParametersMap](../../paths/petpetid/get/PetpetidGetPathParameters.md#pathparametersmap) | pathParameters | +| [RootServerInfo.@Nullable ServerIndex](../../RootServerInfo.md#serverindex) | serverIndex
optional. Note: this will override the value in apiConfiguration | +| [PetpetidGetSecurityInfo.@Nullable SecurityIndex](../../paths/petpetid/get/PetpetidGetSecurityInfo.md#securityindex) | securityIndex
optional. Note: this will override the value in apiConfiguration | +| @Nullable Duration | timeout
optional. Note: this will override the value in apiConfiguration | + +## GetNullableRequest +public static class GetNullableRequest
+ +a class that stores the initial request inputs + +### Field Summary +| Modifier and Type | Field and Description | +| ----------------- | --------------------- | +| [PetpetidGetPathParameters.@Nullable PathParametersMap](../../paths/petpetid/get/PetpetidGetPathParameters.md#pathparametersmap) | pathParameters | +| [RootServerInfo.@Nullable ServerIndex](../../RootServerInfo.md#serverindex) | serverIndex | +| [PetpetidGetSecurityInfo.@Nullable SecurityIndex](../../paths/petpetid/get/PetpetidGetSecurityInfo.md#securityindex) | securityIndex | +| @Nullable Duration | timeout | + +## Get0RequestBuilder +public static class Get0RequestBuilder
+ +a builder for request inputs + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| Get0RequestBuilder(Get0RequestBuilder instance)
Creates a builder that contains the passed instance | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| [GetRequest](#getrequest) | build()
Returns the request input used to call an endpoint method | +| [Get0RequestBuilder](#get0requestbuilder) | serverIndex([RootServerInfo.ServerIndex](../../RootServerInfo.md#serverindex) serverIndex)
sets the optional property. Note: this will override the value in apiConfiguration | +| [Get0RequestBuilder](#get0requestbuilder) | securityIndex([PetpetidGetSecurityInfo.SecurityIndex](../../paths/petpetid/get/PetpetidGetSecurityInfo.md#securityindex) securityIndex)
sets the optional property. Note: this will override the value in apiConfiguration | +| [Get0RequestBuilder](#get0requestbuilder) | timeout(Duration timeout)
sets the optional property. Note: this will override the value in apiConfiguration | + +## GetRequestBuilder +public static class GetRequestBuilder
+ +a builder for request inputs + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| GetRequestBuilder()
Creates a builder that contains null for all parameters | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| [Get0RequestBuilder](#get0requestbuilder) | pathParameters([PetpetidGetPathParametersPathParametersMap](../../paths/petpetid/get/PetpetidGetPathParameters.md#pathparametersmap) pathParameters)
sets the property | + +[[Back to top]](#top) [[Back to README]](../../../README.md) diff --git a/samples/client/petstore/kotlin/docs/paths/petpetid/PetpetidPost.md b/samples/client/petstore/kotlin/docs/paths/petpetid/PetpetidPost.md new file mode 100644 index 00000000000..caed33b21ad --- /dev/null +++ b/samples/client/petstore/kotlin/docs/paths/petpetid/PetpetidPost.md @@ -0,0 +1,207 @@ +# PetpetidPost + +public class PetpetidPost + +A class that contains necessary endpoint classes +- a class that calls the endpoint method using the http verb +- a class that calls the endpoint method using the operationId name +- class(es) to store the request inputs +- builder(s) to set the request input data + +## Nested Class Summary +| Modifier and Type | Class and Description | +| ----------------- | --------------------- | +| static class | [Post](#post)
The class that has a post method to call the endpoint | +| interface | [UpdatePetWithFormOperation](#updatepetwithformoperation)
The interface that has a updatePetWithForm method to call the endpoint | +| static class | [PostRequest](#postrequest)
The final request inputs class | +| static class | [PostNullableRequest](#postnullablerequest)
The initial request inputs class | +| static class | [Post0RequestBuilder](#post0requestbuilder)
A builder for the request input class | +| static class | [PostRequestBuilder](#postrequestbuilder)
A builder for the request input class | + +## Post +public static class Post 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.PetpetidPostRequestBody; +import org.openapijsonschematools.client.RootServerInfo; +import org.openapijsonschematools.client.paths.petpetid.post.PetpetidPostSecurityInfo; +import org.openapijsonschematools.client.paths.petpetid.post.PetpetidPostPathParameters; +import org.openapijsonschematools.client.servers.RootServer0; +import org.openapijsonschematools.client.servers.RootServer1; +import org.openapijsonschematools.client.servers.RootServer2; +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.PetpetidPostCode405Response; +import org.openapijsonschematools.client.servers.RootServerInfo; +import org.openapijsonschematools.client.paths.petpetid.PetpetidPost; +import org.openapijsonschematools.client.paths.petpetid.post.PetpetidPostResponses; + +import java.io.IOException; +import java.util.Arrays; +import java.util.List; +import java.util.Map; +import java.util.AbstractMap; + +// if you want to use a server that is not SERVER_0 pass it in here and change the ServerIndex input below +ApiConfiguration.ServerInfo serverInfo = new ApiConfiguration.ServerInfoBuilder() + .rootServerInfo( + new RootServerInfo.RootServerInfoBuilder() + .rootServer0(new RootServer0()) + .build() + ) + .build(); +ApiConfiguration.ServerIndexInfo serverIndexInfo = new ApiConfiguration.ServerIndexInfoBuilder() + .rootServerInfoServerIndex(RootServerInfo.ServerIndex.SERVER_0) + .build(); +List securitySchemes = new ArrayList(); +securitySchemes.add( + new ApiKey("someApiKey"); +); +ApiConfiguration.SecurityIndexInfo securityIndexInfo = new ApiConfiguration.SecurityIndexInfoBuilder() + .petpetidPostSecurityRequirementObject0SecurityIndex(PetpetidPostSecurityRequirementObject0.SecurityIndex.SECURITY_0) + .build(); +Duration timeout = Duration.ofSeconds(1L); +Map> defaultHeaders = Map.of("User-Agent", List.of("OpenAPI-JSON-Schema-Generator/1.0.0/java")); +ApiConfiguration apiConfiguration = new ApiConfiguration( + serverInfo + serverIndexInfo, + securitySchemes, + securityIndexInfo, + timeout, + defaultHeaders +); +SchemaConfiguration schemaConfiguration = new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().build()); +PetpetidPost.Post apiClient = new PetpetidPost.Post(apiConfiguration, schemaConfiguration); + + +// Map validation +PetpetidPostPathParameters.PathParametersMap pathParameters = + PetpetidPostPathParameters.PetpetidPostPathParameters1.validate( + new PetpetidPostPathParameters.PathParametersMapBuilder() + .petId(1L) + + .build(), + schemaConfiguration +); + +var request = new PetpetidPost.PostRequestBuilder() + .pathParameters(pathParameters) + .build(); + +Nothing? response; +try { + response = apiClient.post(request); +} catch (PetpetidPostCode405Response.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 | +| --------------------------- | +| Post(ApiConfiguration apiConfiguration, SchemaConfiguration schemaConfiguration)
Creates an instance | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| Nothing? | post([PostRequest](#postrequest) request) | + +## UpdatePetWithFormOperation +public interface UpdatePetWithFormOperation
+ +an interface that allows one to call the endpoint using a method named updatePetWithForm by the operationId + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| Nothing? | updatePetWithForm([PostRequest](#postrequest) request) | + +## PostRequest +public static class PostRequest
+ +a class that stores the final request inputs + +### Field Summary +| Modifier and Type | Field and Description | +| ----------------- | --------------------- | +| [PetpetidPostPathParameters.PathParametersMap](../../paths/petpetid/post/PetpetidPostPathParameters.md#pathparametersmap) | pathParameters | +| [PetpetidPostRequestBody.@Nullable SealedRequestBody](../../paths/petpetid/post/PetpetidPostRequestBody.md#sealedrequestbody) | requestBody
optional | +| [RootServerInfo.@Nullable ServerIndex](../../RootServerInfo.md#serverindex) | serverIndex
optional. Note: this will override the value in apiConfiguration | +| [PetpetidPostSecurityInfo.@Nullable SecurityIndex](../../paths/petpetid/post/PetpetidPostSecurityInfo.md#securityindex) | securityIndex
optional. Note: this will override the value in apiConfiguration | +| @Nullable Duration | timeout
optional. Note: this will override the value in apiConfiguration | + +## PostNullableRequest +public static class PostNullableRequest
+ +a class that stores the initial request inputs + +### Field Summary +| Modifier and Type | Field and Description | +| ----------------- | --------------------- | +| [PetpetidPostPathParameters.@Nullable PathParametersMap](../../paths/petpetid/post/PetpetidPostPathParameters.md#pathparametersmap) | pathParameters | +| [PetpetidPostRequestBody.@Nullable SealedRequestBody](../../paths/petpetid/post/PetpetidPostRequestBody.md#sealedrequestbody) | requestBody | +| [RootServerInfo.@Nullable ServerIndex](../../RootServerInfo.md#serverindex) | serverIndex | +| [PetpetidPostSecurityInfo.@Nullable SecurityIndex](../../paths/petpetid/post/PetpetidPostSecurityInfo.md#securityindex) | securityIndex | +| @Nullable Duration | timeout | + +## Post0RequestBuilder +public static class Post0RequestBuilder
+ +a builder for request inputs + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| Post0RequestBuilder(Post0RequestBuilder instance)
Creates a builder that contains the passed instance | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| [PostRequest](#postrequest) | build()
Returns the request input used to call an endpoint method | +| [Post0RequestBuilder](#post0requestbuilder) | requestBody([PetpetidPostRequestBody.SealedRequestBody](../../paths/petpetid/post/PetpetidPostRequestBody.md#sealedrequestbody) requestBody)
sets the optional property | +| [Post0RequestBuilder](#post0requestbuilder) | serverIndex([RootServerInfo.ServerIndex](../../RootServerInfo.md#serverindex) serverIndex)
sets the optional property. Note: this will override the value in apiConfiguration | +| [Post0RequestBuilder](#post0requestbuilder) | securityIndex([PetpetidPostSecurityInfo.SecurityIndex](../../paths/petpetid/post/PetpetidPostSecurityInfo.md#securityindex) securityIndex)
sets the optional property. Note: this will override the value in apiConfiguration | +| [Post0RequestBuilder](#post0requestbuilder) | timeout(Duration timeout)
sets the optional property. Note: this will override the value in apiConfiguration | + +## PostRequestBuilder +public static class PostRequestBuilder
+ +a builder for request inputs + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| PostRequestBuilder()
Creates a builder that contains null for all parameters | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| [Post0RequestBuilder](#post0requestbuilder) | pathParameters([PetpetidPostPathParametersPathParametersMap](../../paths/petpetid/post/PetpetidPostPathParameters.md#pathparametersmap) pathParameters)
sets the property | + +[[Back to top]](#top) [[Back to README]](../../../README.md) diff --git a/samples/client/petstore/kotlin/docs/paths/petpetid/delete/PetpetidDeleteHeaderParameters.md b/samples/client/petstore/kotlin/docs/paths/petpetid/delete/PetpetidDeleteHeaderParameters.md new file mode 100644 index 00000000000..3b03678d1e5 --- /dev/null +++ b/samples/client/petstore/kotlin/docs/paths/petpetid/delete/PetpetidDeleteHeaderParameters.md @@ -0,0 +1,252 @@ +# PetpetidDeleteHeaderParameters +public class PetpetidDeleteHeaderParameters
+ +A class that contains necessary nested +- schema classes (which validate payloads), extends JsonSchema +- sealed interfaces which store validated payloads, java version of a sum type +- boxed classes which store validated payloads, sealed permits class implementations +- classes to store validated map payloads, extends FrozenMap +- classes to build inputs for map payloads + +## Nested Class Summary +| Modifier and Type | Class and Description | +| ----------------- | ---------------------- | +| sealed interface | [PetpetidDeleteHeaderParameters.PetpetidDeleteHeaderParameters1Boxed](#petpetiddeleteheaderparameters1boxed)
sealed interface for validated payloads | +| record | [PetpetidDeleteHeaderParameters.PetpetidDeleteHeaderParameters1BoxedMap](#petpetiddeleteheaderparameters1boxedmap)
boxed class to store validated Map payloads | +| static class | [PetpetidDeleteHeaderParameters.PetpetidDeleteHeaderParameters1](#petpetiddeleteheaderparameters1)
schema class | +| static class | [PetpetidDeleteHeaderParameters.HeaderParametersMapBuilder](#headerparametersmapbuilder)
builder for Map payloads | +| static class | [PetpetidDeleteHeaderParameters.HeaderParametersMap](#headerparametersmap)
output class for Map payloads | +| sealed interface | [PetpetidDeleteHeaderParameters.AdditionalPropertiesBoxed](#additionalpropertiesboxed)
sealed interface for validated payloads | +| record | [PetpetidDeleteHeaderParameters.AdditionalPropertiesBoxedVoid](#additionalpropertiesboxedvoid)
boxed class to store validated null payloads | +| record | [PetpetidDeleteHeaderParameters.AdditionalPropertiesBoxedBoolean](#additionalpropertiesboxedboolean)
boxed class to store validated boolean payloads | +| record | [PetpetidDeleteHeaderParameters.AdditionalPropertiesBoxedNumber](#additionalpropertiesboxednumber)
boxed class to store validated Number payloads | +| record | [PetpetidDeleteHeaderParameters.AdditionalPropertiesBoxedString](#additionalpropertiesboxedstring)
boxed class to store validated String payloads | +| record | [PetpetidDeleteHeaderParameters.AdditionalPropertiesBoxedList](#additionalpropertiesboxedlist)
boxed class to store validated List payloads | +| record | [PetpetidDeleteHeaderParameters.AdditionalPropertiesBoxedMap](#additionalpropertiesboxedmap)
boxed class to store validated Map payloads | +| static class | [PetpetidDeleteHeaderParameters.AdditionalProperties](#additionalproperties)
schema class | + +## PetpetidDeleteHeaderParameters1Boxed +public sealed interface PetpetidDeleteHeaderParameters1Boxed
+permits
+[PetpetidDeleteHeaderParameters1BoxedMap](#petpetiddeleteheaderparameters1boxedmap) + +sealed interface that stores validated payloads using boxed classes + +## PetpetidDeleteHeaderParameters1BoxedMap +public record PetpetidDeleteHeaderParameters1BoxedMap
+implements [PetpetidDeleteHeaderParameters1Boxed](#petpetiddeleteheaderparameters1boxed) + +record that stores validated Map payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| PetpetidDeleteHeaderParameters1BoxedMap([HeaderParametersMap](#headerparametersmap) data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| [HeaderParametersMap](#headerparametersmap) | data()
validated payload | +| @Nullable Object | getData()
validated payload | + +## PetpetidDeleteHeaderParameters1 +public static class PetpetidDeleteHeaderParameters1
+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.petpetid.delete.PetpetidDeleteHeaderParameters; + +import java.util.Arrays; +import java.util.List; +import java.util.AbstractMap; + +static final SchemaConfiguration configuration = new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().build()); + +// Map validation +PetpetidDeleteHeaderParameters.HeaderParametersMap validatedPayload = + PetpetidDeleteHeaderParameters.PetpetidDeleteHeaderParameters1.validate( + new PetpetidDeleteHeaderParameters.HeaderParametersMapBuilder() + .api_key("a") + + .build(), + configuration +); +``` + +### Field Summary +| Modifier and Type | Field and Description | +| ----------------- | ---------------------- | +| Set> | type = Set.of(Map.class) | +| Map> | properties = Map.ofEntries(
    new PropertyEntry("api_key", [Schema0.Schema01.class](../../../paths/petpetid/delete/parameters/parameter0/Schema0.md#schema01))
)
| +| Class | additionalProperties = [AdditionalProperties.class](#additionalproperties) | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| [HeaderParametersMap](#headerparametersmap) | validate([Map<?, ?>](#headerparametersmapbuilder) arg, SchemaConfiguration configuration) | +| [PetpetidDeleteHeaderParameters1BoxedMap](#petpetiddeleteheaderparameters1boxedmap) | validateAndBox([Map<?, ?>](#headerparametersmapbuilder) arg, SchemaConfiguration configuration) | +| [PetpetidDeleteHeaderParameters1Boxed](#petpetiddeleteheaderparameters1boxed) | validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) | +| @Nullable Object | validate(@Nullable Object arg, SchemaConfiguration configuration) | + +## HeaderParametersMapBuilder +public class HeaderParametersMapBuilder
+builder for `Map` + +A class that builds the Map input type + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| HeaderParametersMapBuilder()
Creates a builder that contains an empty map | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| Map | build()
Returns map input that should be used with Schema.validate | +| [HeaderParametersMapBuilder](#headerparametersmapbuilder) | api_key(String value) | + +## HeaderParametersMap +public static class HeaderParametersMap
+extends FrozenMap + +A class to store validated Map payloads + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| static [HeaderParametersMap](#headerparametersmap) | of([Map](#headerparametersmapbuilder) arg, SchemaConfiguration configuration) | +| String | api_key()
[optional] | + +## 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(Nothing? data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| Nothing? | 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/kotlin/docs/paths/petpetid/delete/PetpetidDeletePathParameters.md b/samples/client/petstore/kotlin/docs/paths/petpetid/delete/PetpetidDeletePathParameters.md new file mode 100644 index 00000000000..4ee36dc8075 --- /dev/null +++ b/samples/client/petstore/kotlin/docs/paths/petpetid/delete/PetpetidDeletePathParameters.md @@ -0,0 +1,271 @@ +# PetpetidDeletePathParameters +public class PetpetidDeletePathParameters
+ +A class that contains necessary nested +- schema classes (which validate payloads), extends JsonSchema +- sealed interfaces which store validated payloads, java version of a sum type +- boxed classes which store validated payloads, sealed permits class implementations +- classes to store validated map payloads, extends FrozenMap +- classes to build inputs for map payloads + +## Nested Class Summary +| Modifier and Type | Class and Description | +| ----------------- | ---------------------- | +| sealed interface | [PetpetidDeletePathParameters.PetpetidDeletePathParameters1Boxed](#petpetiddeletepathparameters1boxed)
sealed interface for validated payloads | +| record | [PetpetidDeletePathParameters.PetpetidDeletePathParameters1BoxedMap](#petpetiddeletepathparameters1boxedmap)
boxed class to store validated Map payloads | +| static class | [PetpetidDeletePathParameters.PetpetidDeletePathParameters1](#petpetiddeletepathparameters1)
schema class | +| static class | [PetpetidDeletePathParameters.PathParametersMapBuilder](#pathparametersmapbuilder)
builder for Map payloads | +| static class | [PetpetidDeletePathParameters.PathParametersMap](#pathparametersmap)
output class for Map payloads | +| sealed interface | [PetpetidDeletePathParameters.AdditionalPropertiesBoxed](#additionalpropertiesboxed)
sealed interface for validated payloads | +| record | [PetpetidDeletePathParameters.AdditionalPropertiesBoxedVoid](#additionalpropertiesboxedvoid)
boxed class to store validated null payloads | +| record | [PetpetidDeletePathParameters.AdditionalPropertiesBoxedBoolean](#additionalpropertiesboxedboolean)
boxed class to store validated boolean payloads | +| record | [PetpetidDeletePathParameters.AdditionalPropertiesBoxedNumber](#additionalpropertiesboxednumber)
boxed class to store validated Number payloads | +| record | [PetpetidDeletePathParameters.AdditionalPropertiesBoxedString](#additionalpropertiesboxedstring)
boxed class to store validated String payloads | +| record | [PetpetidDeletePathParameters.AdditionalPropertiesBoxedList](#additionalpropertiesboxedlist)
boxed class to store validated List payloads | +| record | [PetpetidDeletePathParameters.AdditionalPropertiesBoxedMap](#additionalpropertiesboxedmap)
boxed class to store validated Map payloads | +| static class | [PetpetidDeletePathParameters.AdditionalProperties](#additionalproperties)
schema class | + +## PetpetidDeletePathParameters1Boxed +public sealed interface PetpetidDeletePathParameters1Boxed
+permits
+[PetpetidDeletePathParameters1BoxedMap](#petpetiddeletepathparameters1boxedmap) + +sealed interface that stores validated payloads using boxed classes + +## PetpetidDeletePathParameters1BoxedMap +public record PetpetidDeletePathParameters1BoxedMap
+implements [PetpetidDeletePathParameters1Boxed](#petpetiddeletepathparameters1boxed) + +record that stores validated Map payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| PetpetidDeletePathParameters1BoxedMap([PathParametersMap](#pathparametersmap) data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| [PathParametersMap](#pathparametersmap) | data()
validated payload | +| @Nullable Object | getData()
validated payload | + +## PetpetidDeletePathParameters1 +public static class PetpetidDeletePathParameters1
+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.petpetid.delete.PetpetidDeletePathParameters; + +import java.util.Arrays; +import java.util.List; +import java.util.AbstractMap; + +static final SchemaConfiguration configuration = new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().build()); + +// Map validation +PetpetidDeletePathParameters.PathParametersMap validatedPayload = + PetpetidDeletePathParameters.PetpetidDeletePathParameters1.validate( + new PetpetidDeletePathParameters.PathParametersMapBuilder() + .petId(1L) + + .build(), + configuration +); +``` + +### Field Summary +| Modifier and Type | Field and Description | +| ----------------- | ---------------------- | +| Set> | type = Set.of(Map.class) | +| Map> | properties = Map.ofEntries(
    new PropertyEntry("petId", [Schema1.Schema11.class](../../../paths/petpetid/delete/parameters/parameter1/Schema1.md#schema11))
)
| +| Set | required = Set.of(
    "petId"
)
| +| Class | additionalProperties = [AdditionalProperties.class](#additionalproperties) | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| [PathParametersMap](#pathparametersmap) | validate([Map<?, ?>](#pathparametersmapbuilder) arg, SchemaConfiguration configuration) | +| [PetpetidDeletePathParameters1BoxedMap](#petpetiddeletepathparameters1boxedmap) | validateAndBox([Map<?, ?>](#pathparametersmapbuilder) arg, SchemaConfiguration configuration) | +| [PetpetidDeletePathParameters1Boxed](#petpetiddeletepathparameters1boxed) | validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) | +| @Nullable Object | validate(@Nullable Object arg, SchemaConfiguration configuration) | + +## PathParametersMap0Builder +public class PathParametersMap0Builder
+builder for `Map` + +A class that builds the Map input type + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| PathParametersMap0Builder(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 | + +## PathParametersMapBuilder +public class PathParametersMapBuilder
+builder for `Map` + +A class that builds the Map input type + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| PathParametersMapBuilder()
Creates a builder that contains an empty map | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| [PathParametersMap0Builder](#pathparametersmap0builder) | petId(int value) | +| [PathParametersMap0Builder](#pathparametersmap0builder) | petId(float value) | +| [PathParametersMap0Builder](#pathparametersmap0builder) | petId(long value) | +| [PathParametersMap0Builder](#pathparametersmap0builder) | petId(double value) | + +## PathParametersMap +public static class PathParametersMap
+extends FrozenMap + +A class to store validated Map payloads + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| static [PathParametersMap](#pathparametersmap) | of([Map](#pathparametersmapbuilder) arg, SchemaConfiguration configuration) | +| Number | petId()
| + +## 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(Nothing? data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| Nothing? | 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/kotlin/docs/paths/petpetid/delete/PetpetidDeleteResponses.md b/samples/client/petstore/kotlin/docs/paths/petpetid/delete/PetpetidDeleteResponses.md new file mode 100644 index 00000000000..393d3ca7126 --- /dev/null +++ b/samples/client/petstore/kotlin/docs/paths/petpetid/delete/PetpetidDeleteResponses.md @@ -0,0 +1,10 @@ +# PetpetidDeleteResponses + +public class PetpetidDeleteResponses + +A class that contains necessary responses classes + +## Nested Class Summary +| Modifier and Type | Class and Description | +| ----------------- | --------------------- | + diff --git a/samples/client/petstore/kotlin/docs/paths/petpetid/delete/PetpetidDeleteSecurityInfo.md b/samples/client/petstore/kotlin/docs/paths/petpetid/delete/PetpetidDeleteSecurityInfo.md new file mode 100644 index 00000000000..0a71b0d01f1 --- /dev/null +++ b/samples/client/petstore/kotlin/docs/paths/petpetid/delete/PetpetidDeleteSecurityInfo.md @@ -0,0 +1,42 @@ +# PetpetidDeleteSecurityInfo +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 +- an enum class that describes security index values + +## Nested Class Summary +| Modifier and Type | Class and Description | +| ----------------- | --------------------- | +| static class | [PetpetidDeleteSecurityInfo.PetpetidDeleteSecurityInfo1](#petpetiddeletesecurityinfo1)
SecurityRequirementObjectProvider +| enum | [PetpetidDeleteSecurityInfo.SecurityIndex](#securityindex)
class that stores a security index | + +## PetpetidDeleteSecurityInfo1 +implements SecurityRequirementObjectProvider<[SecurityIndex](#securityindex)> + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| PetpetidDeleteSecurityInfo1()
Creates an instance | + +### Field Summary +| Modifier and Type | Field and Description | +| ----------------- | --------------------- | +| [PetpetidDeleteSecurityRequirementObject0](../../../paths/petpetid/delete/security/PetpetidDeleteSecurityRequirementObject0.md) | security0 | +| [PetpetidDeleteSecurityRequirementObject1](../../../paths/petpetid/delete/security/PetpetidDeleteSecurityRequirementObject1.md) | security1 | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| SecurityRequirementObject | getSecurityRequirementObject(@Nullable [SecurityIndex](#securityindex) securityIndex)
If null is input, then the instance's securityIndex will be used | + +## SecurityIndex +enum SecurityIndex
+ +### Enum Constant Summary +| Enum Constant And Description | +| ----------------------------- | +| SECURITY_0
security 0 | +| SECURITY_1
security 1 | diff --git a/samples/client/petstore/kotlin/docs/paths/petpetid/delete/parameters/parameter0/Schema0.md b/samples/client/petstore/kotlin/docs/paths/petpetid/delete/parameters/parameter0/Schema0.md new file mode 100644 index 00000000000..9ff90e0bc35 --- /dev/null +++ b/samples/client/petstore/kotlin/docs/paths/petpetid/delete/parameters/parameter0/Schema0.md @@ -0,0 +1,49 @@ +# Schema0 +public class Schema0
+ +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 + +## Nested Class Summary +| Modifier and Type | Class and Description | +| ----------------- | ---------------------- | +| sealed interface | [Schema0.Schema01Boxed](#schema01boxed)
sealed interface for validated payloads | +| record | [Schema0.Schema01BoxedString](#schema01boxedstring)
boxed class to store validated String payloads | +| static class | [Schema0.Schema01](#schema01)
schema class | + +## Schema01Boxed +public sealed interface Schema01Boxed
+permits
+[Schema01BoxedString](#schema01boxedstring) + +sealed interface that stores validated payloads using boxed classes + +## Schema01BoxedString +public record Schema01BoxedString
+implements [Schema01Boxed](#schema01boxed) + +record that stores validated String payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| Schema01BoxedString(String data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| String | data()
validated payload | +| @Nullable Object | getData()
validated payload | + +## Schema01 +public static class Schema01
+extends StringJsonSchema.StringJsonSchema1 + +A schema class that validates payloads + +| Methods Inherited from class org.openapijsonschematools.client.schemas.StringJsonSchema.StringJsonSchema1 | +| ------------------------------------------------------------------ | +| validate | +| validateAndBox | diff --git a/samples/client/petstore/kotlin/docs/paths/petpetid/delete/parameters/parameter1/Schema1.md b/samples/client/petstore/kotlin/docs/paths/petpetid/delete/parameters/parameter1/Schema1.md new file mode 100644 index 00000000000..d8a770d95a5 --- /dev/null +++ b/samples/client/petstore/kotlin/docs/paths/petpetid/delete/parameters/parameter1/Schema1.md @@ -0,0 +1,49 @@ +# Schema1 +public class Schema1
+ +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 + +## Nested Class Summary +| Modifier and Type | Class and Description | +| ----------------- | ---------------------- | +| sealed interface | [Schema1.Schema11Boxed](#schema11boxed)
sealed interface for validated payloads | +| record | [Schema1.Schema11BoxedNumber](#schema11boxednumber)
boxed class to store validated Number payloads | +| static class | [Schema1.Schema11](#schema11)
schema class | + +## Schema11Boxed +public sealed interface Schema11Boxed
+permits
+[Schema11BoxedNumber](#schema11boxednumber) + +sealed interface that stores validated payloads using boxed classes + +## Schema11BoxedNumber +public record Schema11BoxedNumber
+implements [Schema11Boxed](#schema11boxed) + +record that stores validated Number payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| Schema11BoxedNumber(Number data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| Number | data()
validated payload | +| @Nullable Object | getData()
validated payload | + +## Schema11 +public static class Schema11
+extends Int64JsonSchema.Int64JsonSchema1 + +A schema class that validates payloads + +| Methods Inherited from class org.openapijsonschematools.client.schemas.Int64JsonSchema.Int64JsonSchema1 | +| ------------------------------------------------------------------ | +| validate | +| validateAndBox | diff --git a/samples/client/petstore/kotlin/docs/paths/petpetid/delete/responses/PetpetidDeleteCode400Response.md b/samples/client/petstore/kotlin/docs/paths/petpetid/delete/responses/PetpetidDeleteCode400Response.md new file mode 100644 index 00000000000..94810ff7246 --- /dev/null +++ b/samples/client/petstore/kotlin/docs/paths/petpetid/delete/responses/PetpetidDeleteCode400Response.md @@ -0,0 +1,32 @@ +# PetpetidDeleteCode400Response + +public class PetpetidDeleteCode400Response + +A class that contains necessary nested response classes +- a class that extends ResponseDeserializer and is used to deserialize responses + +## Nested Class Summary +| Modifier and Type | Class and Description | +| ----------------- | --------------------- | +| static class | [PetpetidDeleteCode400Response.PetpetidDeleteCode400Response1](#petpetiddeletecode400response1)
class that deserializes responses | + +## PetpetidDeleteCode400Response1 +public static class PetpetidDeleteCode400Response1
+extends ResponseDeserializer + +a class that deserializes responses + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| PetpetidDeleteCode400Response1()
Creates an instance | + +### Field Summary +| Modifier and Type | Field and Description | +| ----------------- | --------------------- | +| Map | content = MapUtils.makeMap(
)
the contentType to schema info | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| ApiResponse | deserialize(HttpResponse response, SchemaConfiguration configuration)
called by endpoint when deserialize responses | diff --git a/samples/client/petstore/kotlin/docs/paths/petpetid/delete/security/PetpetidDeleteSecurityRequirementObject0.md b/samples/client/petstore/kotlin/docs/paths/petpetid/delete/security/PetpetidDeleteSecurityRequirementObject0.md new file mode 100644 index 00000000000..f80b6f15b40 --- /dev/null +++ b/samples/client/petstore/kotlin/docs/paths/petpetid/delete/security/PetpetidDeleteSecurityRequirementObject0.md @@ -0,0 +1,15 @@ +# PetpetidDeleteSecurityRequirementObject0 +PetpetidDeleteSecurityRequirementObject0.java + +public class PetpetidDeleteSecurityRequirementObject0 +extends SecurityRequirementObject + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| PetpetidDeleteSecurityRequirementObject0()
Creates an instance | + +### 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()
    )) | diff --git a/samples/client/petstore/kotlin/docs/paths/petpetid/delete/security/PetpetidDeleteSecurityRequirementObject1.md b/samples/client/petstore/kotlin/docs/paths/petpetid/delete/security/PetpetidDeleteSecurityRequirementObject1.md new file mode 100644 index 00000000000..8877bdea9a3 --- /dev/null +++ b/samples/client/petstore/kotlin/docs/paths/petpetid/delete/security/PetpetidDeleteSecurityRequirementObject1.md @@ -0,0 +1,15 @@ +# PetpetidDeleteSecurityRequirementObject1 +PetpetidDeleteSecurityRequirementObject1.java + +public class PetpetidDeleteSecurityRequirementObject1 +extends SecurityRequirementObject + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| PetpetidDeleteSecurityRequirementObject1()
Creates an instance | + +### 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")
    )) | diff --git a/samples/client/petstore/kotlin/docs/paths/petpetid/get/PetpetidGetPathParameters.md b/samples/client/petstore/kotlin/docs/paths/petpetid/get/PetpetidGetPathParameters.md new file mode 100644 index 00000000000..058f1414af6 --- /dev/null +++ b/samples/client/petstore/kotlin/docs/paths/petpetid/get/PetpetidGetPathParameters.md @@ -0,0 +1,271 @@ +# PetpetidGetPathParameters +public class PetpetidGetPathParameters
+ +A class that contains necessary nested +- schema classes (which validate payloads), extends JsonSchema +- sealed interfaces which store validated payloads, java version of a sum type +- boxed classes which store validated payloads, sealed permits class implementations +- classes to store validated map payloads, extends FrozenMap +- classes to build inputs for map payloads + +## Nested Class Summary +| Modifier and Type | Class and Description | +| ----------------- | ---------------------- | +| sealed interface | [PetpetidGetPathParameters.PetpetidGetPathParameters1Boxed](#petpetidgetpathparameters1boxed)
sealed interface for validated payloads | +| record | [PetpetidGetPathParameters.PetpetidGetPathParameters1BoxedMap](#petpetidgetpathparameters1boxedmap)
boxed class to store validated Map payloads | +| static class | [PetpetidGetPathParameters.PetpetidGetPathParameters1](#petpetidgetpathparameters1)
schema class | +| static class | [PetpetidGetPathParameters.PathParametersMapBuilder](#pathparametersmapbuilder)
builder for Map payloads | +| static class | [PetpetidGetPathParameters.PathParametersMap](#pathparametersmap)
output class for Map payloads | +| sealed interface | [PetpetidGetPathParameters.AdditionalPropertiesBoxed](#additionalpropertiesboxed)
sealed interface for validated payloads | +| record | [PetpetidGetPathParameters.AdditionalPropertiesBoxedVoid](#additionalpropertiesboxedvoid)
boxed class to store validated null payloads | +| record | [PetpetidGetPathParameters.AdditionalPropertiesBoxedBoolean](#additionalpropertiesboxedboolean)
boxed class to store validated boolean payloads | +| record | [PetpetidGetPathParameters.AdditionalPropertiesBoxedNumber](#additionalpropertiesboxednumber)
boxed class to store validated Number payloads | +| record | [PetpetidGetPathParameters.AdditionalPropertiesBoxedString](#additionalpropertiesboxedstring)
boxed class to store validated String payloads | +| record | [PetpetidGetPathParameters.AdditionalPropertiesBoxedList](#additionalpropertiesboxedlist)
boxed class to store validated List payloads | +| record | [PetpetidGetPathParameters.AdditionalPropertiesBoxedMap](#additionalpropertiesboxedmap)
boxed class to store validated Map payloads | +| static class | [PetpetidGetPathParameters.AdditionalProperties](#additionalproperties)
schema class | + +## PetpetidGetPathParameters1Boxed +public sealed interface PetpetidGetPathParameters1Boxed
+permits
+[PetpetidGetPathParameters1BoxedMap](#petpetidgetpathparameters1boxedmap) + +sealed interface that stores validated payloads using boxed classes + +## PetpetidGetPathParameters1BoxedMap +public record PetpetidGetPathParameters1BoxedMap
+implements [PetpetidGetPathParameters1Boxed](#petpetidgetpathparameters1boxed) + +record that stores validated Map payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| PetpetidGetPathParameters1BoxedMap([PathParametersMap](#pathparametersmap) data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| [PathParametersMap](#pathparametersmap) | data()
validated payload | +| @Nullable Object | getData()
validated payload | + +## PetpetidGetPathParameters1 +public static class PetpetidGetPathParameters1
+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.petpetid.get.PetpetidGetPathParameters; + +import java.util.Arrays; +import java.util.List; +import java.util.AbstractMap; + +static final SchemaConfiguration configuration = new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().build()); + +// Map validation +PetpetidGetPathParameters.PathParametersMap validatedPayload = + PetpetidGetPathParameters.PetpetidGetPathParameters1.validate( + new PetpetidGetPathParameters.PathParametersMapBuilder() + .petId(1L) + + .build(), + configuration +); +``` + +### Field Summary +| Modifier and Type | Field and Description | +| ----------------- | ---------------------- | +| Set> | type = Set.of(Map.class) | +| Map> | properties = Map.ofEntries(
    new PropertyEntry("petId", [Schema0.Schema01.class](../../../paths/petpetid/get/parameters/parameter0/Schema0.md#schema01))
)
| +| Set | required = Set.of(
    "petId"
)
| +| Class | additionalProperties = [AdditionalProperties.class](#additionalproperties) | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| [PathParametersMap](#pathparametersmap) | validate([Map<?, ?>](#pathparametersmapbuilder) arg, SchemaConfiguration configuration) | +| [PetpetidGetPathParameters1BoxedMap](#petpetidgetpathparameters1boxedmap) | validateAndBox([Map<?, ?>](#pathparametersmapbuilder) arg, SchemaConfiguration configuration) | +| [PetpetidGetPathParameters1Boxed](#petpetidgetpathparameters1boxed) | validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) | +| @Nullable Object | validate(@Nullable Object arg, SchemaConfiguration configuration) | + +## PathParametersMap0Builder +public class PathParametersMap0Builder
+builder for `Map` + +A class that builds the Map input type + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| PathParametersMap0Builder(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 | + +## PathParametersMapBuilder +public class PathParametersMapBuilder
+builder for `Map` + +A class that builds the Map input type + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| PathParametersMapBuilder()
Creates a builder that contains an empty map | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| [PathParametersMap0Builder](#pathparametersmap0builder) | petId(int value) | +| [PathParametersMap0Builder](#pathparametersmap0builder) | petId(float value) | +| [PathParametersMap0Builder](#pathparametersmap0builder) | petId(long value) | +| [PathParametersMap0Builder](#pathparametersmap0builder) | petId(double value) | + +## PathParametersMap +public static class PathParametersMap
+extends FrozenMap + +A class to store validated Map payloads + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| static [PathParametersMap](#pathparametersmap) | of([Map](#pathparametersmapbuilder) arg, SchemaConfiguration configuration) | +| Number | petId()
| + +## 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(Nothing? data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| Nothing? | 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/kotlin/docs/paths/petpetid/get/PetpetidGetResponses.md b/samples/client/petstore/kotlin/docs/paths/petpetid/get/PetpetidGetResponses.md new file mode 100644 index 00000000000..6dff9daa460 --- /dev/null +++ b/samples/client/petstore/kotlin/docs/paths/petpetid/get/PetpetidGetResponses.md @@ -0,0 +1,29 @@ +# PetpetidGetResponses + +public class PetpetidGetResponses + +A class that contains necessary responses classes +- a sealed interface, EndpointResponse, that stores endpoint responses +- records for each endpoint response + +## Nested Class Summary +| Modifier and Type | Class and Description | +| ----------------- | --------------------- | +| sealed interface | [EndpointResponse](#endpointresponse)
stores the endpoint responses | +| record | [EndpointPetpetidGetCode200Response](#endpointpetpetidgetcode200response)
the response for 200 | + +## EndpointResponse +public sealed interface EndpointResponse permits
+[EndpointPetpetidGetCode200Response](#endpointpetpetidgetcode200response) + +a sealed interface that stores endpoint responses + +## EndpointPetpetidGetCode200Response +public record EndpointPetpetidGetCode200Response( + HttpResponse response, + [PetpetidGetCode200Response.SealedResponseBody](../../../paths/petpetid/get/responses/PetpetidGetCode200Response.md#sealedresponsebody) body, + Nothing? headers +) implements EndpointResponse, ApiResponse
+ +a class that stores an endpoint response + diff --git a/samples/client/petstore/kotlin/docs/paths/petpetid/get/PetpetidGetSecurityInfo.md b/samples/client/petstore/kotlin/docs/paths/petpetid/get/PetpetidGetSecurityInfo.md new file mode 100644 index 00000000000..c6615ea3fa9 --- /dev/null +++ b/samples/client/petstore/kotlin/docs/paths/petpetid/get/PetpetidGetSecurityInfo.md @@ -0,0 +1,40 @@ +# PetpetidGetSecurityInfo +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 +- an enum class that describes security index values + +## Nested Class Summary +| Modifier and Type | Class and Description | +| ----------------- | --------------------- | +| static class | [PetpetidGetSecurityInfo.PetpetidGetSecurityInfo1](#petpetidgetsecurityinfo1)
SecurityRequirementObjectProvider +| enum | [PetpetidGetSecurityInfo.SecurityIndex](#securityindex)
class that stores a security index | + +## PetpetidGetSecurityInfo1 +implements SecurityRequirementObjectProvider<[SecurityIndex](#securityindex)> + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| PetpetidGetSecurityInfo1()
Creates an instance | + +### Field Summary +| Modifier and Type | Field and Description | +| ----------------- | --------------------- | +| [PetpetidGetSecurityRequirementObject0](../../../paths/petpetid/get/security/PetpetidGetSecurityRequirementObject0.md) | security0 | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| SecurityRequirementObject | getSecurityRequirementObject(@Nullable [SecurityIndex](#securityindex) securityIndex)
If null is input, then the instance's securityIndex will be used | + +## SecurityIndex +enum SecurityIndex
+ +### Enum Constant Summary +| Enum Constant And Description | +| ----------------------------- | +| SECURITY_0
security 0 | diff --git a/samples/client/petstore/kotlin/docs/paths/petpetid/get/parameters/parameter0/Schema0.md b/samples/client/petstore/kotlin/docs/paths/petpetid/get/parameters/parameter0/Schema0.md new file mode 100644 index 00000000000..55e4e5cb238 --- /dev/null +++ b/samples/client/petstore/kotlin/docs/paths/petpetid/get/parameters/parameter0/Schema0.md @@ -0,0 +1,49 @@ +# Schema0 +public class Schema0
+ +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 + +## Nested Class Summary +| Modifier and Type | Class and Description | +| ----------------- | ---------------------- | +| sealed interface | [Schema0.Schema01Boxed](#schema01boxed)
sealed interface for validated payloads | +| record | [Schema0.Schema01BoxedNumber](#schema01boxednumber)
boxed class to store validated Number payloads | +| static class | [Schema0.Schema01](#schema01)
schema class | + +## Schema01Boxed +public sealed interface Schema01Boxed
+permits
+[Schema01BoxedNumber](#schema01boxednumber) + +sealed interface that stores validated payloads using boxed classes + +## Schema01BoxedNumber +public record Schema01BoxedNumber
+implements [Schema01Boxed](#schema01boxed) + +record that stores validated Number payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| Schema01BoxedNumber(Number data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| Number | data()
validated payload | +| @Nullable Object | getData()
validated payload | + +## Schema01 +public static class Schema01
+extends Int64JsonSchema.Int64JsonSchema1 + +A schema class that validates payloads + +| Methods Inherited from class org.openapijsonschematools.client.schemas.Int64JsonSchema.Int64JsonSchema1 | +| ------------------------------------------------------------------ | +| validate | +| validateAndBox | diff --git a/samples/client/petstore/kotlin/docs/paths/petpetid/get/responses/PetpetidGetCode200Response.md b/samples/client/petstore/kotlin/docs/paths/petpetid/get/responses/PetpetidGetCode200Response.md new file mode 100644 index 00000000000..d4d5628d5b2 --- /dev/null +++ b/samples/client/petstore/kotlin/docs/paths/petpetid/get/responses/PetpetidGetCode200Response.md @@ -0,0 +1,123 @@ +# PetpetidGetCode200Response + +public class PetpetidGetCode200Response + +A class that contains necessary nested response classes +- SealedMediaType, a sealed interface which contains all the schema/encoding info for each contentType +- records which implement SealedMediaType, the concrete media types +- SealedResponseBody, a sealed interface which contains all the contentType/schema types +- records which implement SealedResponseBody, the concrete response body types +- a class that extends ResponseDeserializer and is used to deserialize responses + +## Nested Class Summary +| Modifier and Type | Class and Description | +| ----------------- | --------------------- | +| sealed interface | [PetpetidGetCode200Response.SealedMediaType](#sealedmediatype)
media type sealed interface | +| record | [PetpetidGetCode200Response.ApplicationxmlMediaType](#applicationxmlmediatype)
record storing schema + encoding for a specific contentType | +| record | [PetpetidGetCode200Response.ApplicationjsonMediaType](#applicationjsonmediatype)
record storing schema + encoding for a specific contentType | +| sealed interface | [PetpetidGetCode200Response.SealedResponseBody](#sealedresponsebody)
response body sealed interface | +| record | [PetpetidGetCode200Response.ApplicationxmlResponseBody](#applicationxmlresponsebody)
implements sealed interface to store response body | +| record | [PetpetidGetCode200Response.ApplicationjsonResponseBody](#applicationjsonresponsebody)
implements sealed interface to store response body | +| static class | [PetpetidGetCode200Response.PetpetidGetCode200Response1](#petpetidgetcode200response1)
class that deserializes responses | + +## SealedMediaType +public sealed interface SealedMediaType
+permits
+[ApplicationxmlMediaType](#applicationxmlmediatype), +[ApplicationjsonMediaType](#applicationjsonmediatype) + +sealed interface that stores schema and encoding info + +## ApplicationxmlMediaType +public record ApplicationxmlMediaType
+implements [SealedMediaType](#sealedmediatype), MediaType<[ApplicationxmlSchema.ApplicationxmlSchema1](../../../../paths/petpetid/get/responses/code200response/content/applicationxml/ApplicationxmlSchema.md#applicationxmlschema1), Nothing?> + +class storing schema info for a specific contentType + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| ApplicationxmlMediaType()
Creates an instance | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| [ApplicationxmlSchema.ApplicationxmlSchema1](../../../../paths/petpetid/get/responses/code200response/content/applicationxml/ApplicationxmlSchema.md#applicationxmlschema1) | schema()
the schema for this MediaType | +| Nothing? | encoding()
the encoding info | + +## ApplicationjsonMediaType +public record ApplicationjsonMediaType
+implements [SealedMediaType](#sealedmediatype), MediaType<[ApplicationjsonSchema.ApplicationjsonSchema1](../../../../paths/petpetid/get/responses/code200response/content/applicationjson/ApplicationjsonSchema.md#applicationjsonschema1), Nothing?> + +class storing schema info for a specific contentType + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| ApplicationjsonMediaType()
Creates an instance | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| [ApplicationjsonSchema.ApplicationjsonSchema1](../../../../paths/petpetid/get/responses/code200response/content/applicationjson/ApplicationjsonSchema.md#applicationjsonschema1) | schema()
the schema for this MediaType | +| Nothing? | encoding()
the encoding info | + +## SealedResponseBody +public sealed interface SealedResponseBody
+permits
+[ApplicationxmlResponseBody](#applicationxmlresponsebody), +[ApplicationjsonResponseBody](#applicationjsonresponsebody) + +sealed interface that stores response body + +## ApplicationxmlResponseBody +public record ApplicationxmlResponseBody
+implements [SealedResponseBody](#sealedresponsebody) + +A record class to store response body for contentType="application/xml" + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| ApplicationxmlResponseBody(ApplicationxmlSchema.[Pet1Boxed](../../../../components/schemas/Pet.md#pet1boxed) body)
Creates an instance | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| ApplicationxmlSchema.[Pet1Boxed](../../../../components/schemas/Pet.md#pet1boxed) | body()
returns the body passed in in the constructor | +## ApplicationjsonResponseBody +public record ApplicationjsonResponseBody
+implements [SealedResponseBody](#sealedresponsebody) + +A record class to store response body for contentType="application/json" + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| ApplicationjsonResponseBody(ApplicationjsonSchema.[Pet1Boxed](../../../../components/schemas/Pet.md#pet1boxed) body)
Creates an instance | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| ApplicationjsonSchema.[Pet1Boxed](../../../../components/schemas/Pet.md#pet1boxed) | body()
returns the body passed in in the constructor | + +## PetpetidGetCode200Response1 +public static class PetpetidGetCode200Response1
+extends ResponseDeserializer<[SealedResponseBody](#sealedresponsebody), Nothing?, [SealedMediaType](#sealedmediatype)> + +a class that deserializes responses + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| PetpetidGetCode200Response1()
Creates an instance | + +### Field Summary +| Modifier and Type | Field and Description | +| ----------------- | --------------------- | +| Map | content = Map.ofEntries(
    new AbstractMap.SimpleEntry<>("application/xml", new [ApplicationxmlMediaType](#applicationxmlmediatype)()),
    new AbstractMap.SimpleEntry<>("application/json", new [ApplicationjsonMediaType](#applicationjsonmediatype)())
)
the contentType to schema info | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| ApiResponse<[SealedResponseBody](#sealedresponsebody), Nothing?> | deserialize(HttpResponse response, SchemaConfiguration configuration)
called by endpoint when deserialize responses | diff --git a/samples/client/petstore/kotlin/docs/paths/petpetid/get/responses/PetpetidGetCode400Response.md b/samples/client/petstore/kotlin/docs/paths/petpetid/get/responses/PetpetidGetCode400Response.md new file mode 100644 index 00000000000..4774fd3ff6e --- /dev/null +++ b/samples/client/petstore/kotlin/docs/paths/petpetid/get/responses/PetpetidGetCode400Response.md @@ -0,0 +1,32 @@ +# PetpetidGetCode400Response + +public class PetpetidGetCode400Response + +A class that contains necessary nested response classes +- a class that extends ResponseDeserializer and is used to deserialize responses + +## Nested Class Summary +| Modifier and Type | Class and Description | +| ----------------- | --------------------- | +| static class | [PetpetidGetCode400Response.PetpetidGetCode400Response1](#petpetidgetcode400response1)
class that deserializes responses | + +## PetpetidGetCode400Response1 +public static class PetpetidGetCode400Response1
+extends ResponseDeserializer + +a class that deserializes responses + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| PetpetidGetCode400Response1()
Creates an instance | + +### Field Summary +| Modifier and Type | Field and Description | +| ----------------- | --------------------- | +| Map | content = MapUtils.makeMap(
)
the contentType to schema info | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| ApiResponse | deserialize(HttpResponse response, SchemaConfiguration configuration)
called by endpoint when deserialize responses | diff --git a/samples/client/petstore/kotlin/docs/paths/petpetid/get/responses/PetpetidGetCode404Response.md b/samples/client/petstore/kotlin/docs/paths/petpetid/get/responses/PetpetidGetCode404Response.md new file mode 100644 index 00000000000..ef56994e489 --- /dev/null +++ b/samples/client/petstore/kotlin/docs/paths/petpetid/get/responses/PetpetidGetCode404Response.md @@ -0,0 +1,32 @@ +# PetpetidGetCode404Response + +public class PetpetidGetCode404Response + +A class that contains necessary nested response classes +- a class that extends ResponseDeserializer and is used to deserialize responses + +## Nested Class Summary +| Modifier and Type | Class and Description | +| ----------------- | --------------------- | +| static class | [PetpetidGetCode404Response.PetpetidGetCode404Response1](#petpetidgetcode404response1)
class that deserializes responses | + +## PetpetidGetCode404Response1 +public static class PetpetidGetCode404Response1
+extends ResponseDeserializer + +a class that deserializes responses + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| PetpetidGetCode404Response1()
Creates an instance | + +### Field Summary +| Modifier and Type | Field and Description | +| ----------------- | --------------------- | +| Map | content = MapUtils.makeMap(
)
the contentType to schema info | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| ApiResponse | deserialize(HttpResponse response, SchemaConfiguration configuration)
called by endpoint when deserialize responses | diff --git a/samples/client/petstore/kotlin/docs/paths/petpetid/get/responses/code200response/content/applicationjson/ApplicationjsonSchema.md b/samples/client/petstore/kotlin/docs/paths/petpetid/get/responses/code200response/content/applicationjson/ApplicationjsonSchema.md new file mode 100644 index 00000000000..d5c13efb07f --- /dev/null +++ b/samples/client/petstore/kotlin/docs/paths/petpetid/get/responses/code200response/content/applicationjson/ApplicationjsonSchema.md @@ -0,0 +1,19 @@ +# ApplicationjsonSchema +public class ApplicationjsonSchema
+extends [RefPet1](../../../../../../../components/schemas/RefPet.md#refpet) + +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 + +## Nested Class Summary +| Modifier and Type | Class and Description | +| ----------------- | ---------------------- | +| static class | [ApplicationjsonSchema.ApplicationjsonSchema1](#applicationjsonschema1)
schema class | + +## ApplicationjsonSchema1 +public static class ApplicationjsonSchema1
+extends [RefPet.RefPet1](../../../../../../../components/schemas/RefPet.md#refpet1) + +A schema class that validates payloads diff --git a/samples/client/petstore/kotlin/docs/paths/petpetid/get/responses/code200response/content/applicationxml/ApplicationxmlSchema.md b/samples/client/petstore/kotlin/docs/paths/petpetid/get/responses/code200response/content/applicationxml/ApplicationxmlSchema.md new file mode 100644 index 00000000000..be8b3ac53c8 --- /dev/null +++ b/samples/client/petstore/kotlin/docs/paths/petpetid/get/responses/code200response/content/applicationxml/ApplicationxmlSchema.md @@ -0,0 +1,19 @@ +# ApplicationxmlSchema +public class ApplicationxmlSchema
+extends [Pet1](../../../../../../../components/schemas/Pet.md#pet) + +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 + +## Nested Class Summary +| Modifier and Type | Class and Description | +| ----------------- | ---------------------- | +| static class | [ApplicationxmlSchema.ApplicationxmlSchema1](#applicationxmlschema1)
schema class | + +## ApplicationxmlSchema1 +public static class ApplicationxmlSchema1
+extends [Pet.Pet1](../../../../../../../components/schemas/Pet.md#pet1) + +A schema class that validates payloads diff --git a/samples/client/petstore/kotlin/docs/paths/petpetid/get/security/PetpetidGetSecurityRequirementObject0.md b/samples/client/petstore/kotlin/docs/paths/petpetid/get/security/PetpetidGetSecurityRequirementObject0.md new file mode 100644 index 00000000000..77bfdbe2448 --- /dev/null +++ b/samples/client/petstore/kotlin/docs/paths/petpetid/get/security/PetpetidGetSecurityRequirementObject0.md @@ -0,0 +1,15 @@ +# PetpetidGetSecurityRequirementObject0 +PetpetidGetSecurityRequirementObject0.java + +public class PetpetidGetSecurityRequirementObject0 +extends SecurityRequirementObject + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| PetpetidGetSecurityRequirementObject0()
Creates an instance | + +### 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()
    )) | diff --git a/samples/client/petstore/kotlin/docs/paths/petpetid/post/PetpetidPostPathParameters.md b/samples/client/petstore/kotlin/docs/paths/petpetid/post/PetpetidPostPathParameters.md new file mode 100644 index 00000000000..55e9e695ee2 --- /dev/null +++ b/samples/client/petstore/kotlin/docs/paths/petpetid/post/PetpetidPostPathParameters.md @@ -0,0 +1,271 @@ +# PetpetidPostPathParameters +public class PetpetidPostPathParameters
+ +A class that contains necessary nested +- schema classes (which validate payloads), extends JsonSchema +- sealed interfaces which store validated payloads, java version of a sum type +- boxed classes which store validated payloads, sealed permits class implementations +- classes to store validated map payloads, extends FrozenMap +- classes to build inputs for map payloads + +## Nested Class Summary +| Modifier and Type | Class and Description | +| ----------------- | ---------------------- | +| sealed interface | [PetpetidPostPathParameters.PetpetidPostPathParameters1Boxed](#petpetidpostpathparameters1boxed)
sealed interface for validated payloads | +| record | [PetpetidPostPathParameters.PetpetidPostPathParameters1BoxedMap](#petpetidpostpathparameters1boxedmap)
boxed class to store validated Map payloads | +| static class | [PetpetidPostPathParameters.PetpetidPostPathParameters1](#petpetidpostpathparameters1)
schema class | +| static class | [PetpetidPostPathParameters.PathParametersMapBuilder](#pathparametersmapbuilder)
builder for Map payloads | +| static class | [PetpetidPostPathParameters.PathParametersMap](#pathparametersmap)
output class for Map payloads | +| sealed interface | [PetpetidPostPathParameters.AdditionalPropertiesBoxed](#additionalpropertiesboxed)
sealed interface for validated payloads | +| record | [PetpetidPostPathParameters.AdditionalPropertiesBoxedVoid](#additionalpropertiesboxedvoid)
boxed class to store validated null payloads | +| record | [PetpetidPostPathParameters.AdditionalPropertiesBoxedBoolean](#additionalpropertiesboxedboolean)
boxed class to store validated boolean payloads | +| record | [PetpetidPostPathParameters.AdditionalPropertiesBoxedNumber](#additionalpropertiesboxednumber)
boxed class to store validated Number payloads | +| record | [PetpetidPostPathParameters.AdditionalPropertiesBoxedString](#additionalpropertiesboxedstring)
boxed class to store validated String payloads | +| record | [PetpetidPostPathParameters.AdditionalPropertiesBoxedList](#additionalpropertiesboxedlist)
boxed class to store validated List payloads | +| record | [PetpetidPostPathParameters.AdditionalPropertiesBoxedMap](#additionalpropertiesboxedmap)
boxed class to store validated Map payloads | +| static class | [PetpetidPostPathParameters.AdditionalProperties](#additionalproperties)
schema class | + +## PetpetidPostPathParameters1Boxed +public sealed interface PetpetidPostPathParameters1Boxed
+permits
+[PetpetidPostPathParameters1BoxedMap](#petpetidpostpathparameters1boxedmap) + +sealed interface that stores validated payloads using boxed classes + +## PetpetidPostPathParameters1BoxedMap +public record PetpetidPostPathParameters1BoxedMap
+implements [PetpetidPostPathParameters1Boxed](#petpetidpostpathparameters1boxed) + +record that stores validated Map payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| PetpetidPostPathParameters1BoxedMap([PathParametersMap](#pathparametersmap) data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| [PathParametersMap](#pathparametersmap) | data()
validated payload | +| @Nullable Object | getData()
validated payload | + +## PetpetidPostPathParameters1 +public static class PetpetidPostPathParameters1
+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.petpetid.post.PetpetidPostPathParameters; + +import java.util.Arrays; +import java.util.List; +import java.util.AbstractMap; + +static final SchemaConfiguration configuration = new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().build()); + +// Map validation +PetpetidPostPathParameters.PathParametersMap validatedPayload = + PetpetidPostPathParameters.PetpetidPostPathParameters1.validate( + new PetpetidPostPathParameters.PathParametersMapBuilder() + .petId(1L) + + .build(), + configuration +); +``` + +### Field Summary +| Modifier and Type | Field and Description | +| ----------------- | ---------------------- | +| Set> | type = Set.of(Map.class) | +| Map> | properties = Map.ofEntries(
    new PropertyEntry("petId", [Schema0.Schema01.class](../../../paths/petpetid/post/parameters/parameter0/Schema0.md#schema01))
)
| +| Set | required = Set.of(
    "petId"
)
| +| Class | additionalProperties = [AdditionalProperties.class](#additionalproperties) | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| [PathParametersMap](#pathparametersmap) | validate([Map<?, ?>](#pathparametersmapbuilder) arg, SchemaConfiguration configuration) | +| [PetpetidPostPathParameters1BoxedMap](#petpetidpostpathparameters1boxedmap) | validateAndBox([Map<?, ?>](#pathparametersmapbuilder) arg, SchemaConfiguration configuration) | +| [PetpetidPostPathParameters1Boxed](#petpetidpostpathparameters1boxed) | validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) | +| @Nullable Object | validate(@Nullable Object arg, SchemaConfiguration configuration) | + +## PathParametersMap0Builder +public class PathParametersMap0Builder
+builder for `Map` + +A class that builds the Map input type + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| PathParametersMap0Builder(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 | + +## PathParametersMapBuilder +public class PathParametersMapBuilder
+builder for `Map` + +A class that builds the Map input type + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| PathParametersMapBuilder()
Creates a builder that contains an empty map | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| [PathParametersMap0Builder](#pathparametersmap0builder) | petId(int value) | +| [PathParametersMap0Builder](#pathparametersmap0builder) | petId(float value) | +| [PathParametersMap0Builder](#pathparametersmap0builder) | petId(long value) | +| [PathParametersMap0Builder](#pathparametersmap0builder) | petId(double value) | + +## PathParametersMap +public static class PathParametersMap
+extends FrozenMap + +A class to store validated Map payloads + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| static [PathParametersMap](#pathparametersmap) | of([Map](#pathparametersmapbuilder) arg, SchemaConfiguration configuration) | +| Number | petId()
| + +## 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(Nothing? data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| Nothing? | 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/kotlin/docs/paths/petpetid/post/PetpetidPostRequestBody.md b/samples/client/petstore/kotlin/docs/paths/petpetid/post/PetpetidPostRequestBody.md new file mode 100644 index 00000000000..b220010f891 --- /dev/null +++ b/samples/client/petstore/kotlin/docs/paths/petpetid/post/PetpetidPostRequestBody.md @@ -0,0 +1,90 @@ +# PetpetidPostRequestBody + +public class PetpetidPostRequestBody + +A class that contains necessary nested request body classes +- SealedMediaType, a sealed interface which contains all the schema/encoding info for each contentType +- records which implement SealedMediaType, the concrete media types +- a class that extends RequestBodySerializer and is used to serialize input SealedRequestBody instances +- SealedRequestBody, a sealed interface which contains all the contentType/schema input types +- records which implement SealedRequestBody, the concrete request body types + +## Nested Class Summary +| Modifier and Type | Class and Description | +| ----------------- | --------------------- | +| sealed interface | [PetpetidPostRequestBody.SealedMediaType](#sealedmediatype)
media type sealed interface | +| record | [PetpetidPostRequestBody.ApplicationxwwwformurlencodedMediaType](#applicationxwwwformurlencodedmediatype)
record storing schema + encoding for a specific contentType | +| static class | [PetpetidPostRequestBody.PetpetidPostRequestBody1](#petpetidpostrequestbody1)
class that serializes request bodies | +| sealed interface | [PetpetidPostRequestBody.SealedRequestBody](#sealedrequestbody)
request body sealed interface | +| record | [PetpetidPostRequestBody.ApplicationxwwwformurlencodedRequestBody](#applicationxwwwformurlencodedrequestbody)
implements sealed interface to store request body input | + +## SealedMediaType +public sealed interface SealedMediaType
+permits
+[ApplicationxwwwformurlencodedMediaType](#applicationxwwwformurlencodedmediatype) + +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), Nothing?> + +class storing schema info for a specific contentType + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| ApplicationxwwwformurlencodedMediaType()
Creates an instance | + +### 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 | +| Nothing? | encoding()
the encoding info | + +## PetpetidPostRequestBody1 +public static class PetpetidPostRequestBody1
+ +a class that serializes SealedRequestBody request bodies + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| PetpetidPostRequestBody1()
Creates an instance | + +### Field Summary +| Modifier and Type | Field and Description | +| ----------------- | --------------------- | +| boolean | required = false
whether the request body is required | +| Map | content = Map.ofEntries(
    new AbstractMap.SimpleEntry<>("application/x-www-form-urlencoded", new [ApplicationxwwwformurlencodedMediaType](#applicationxwwwformurlencodedmediatype)())
)
the contentType to schema info | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| SerializedRequestBody | serialize([SealedRequestBody](#sealedrequestbody) requestBody)
called by endpoint when creating request body bytes | + +## SealedRequestBody +public sealed interface SealedRequestBody
+permits
+[ApplicationxwwwformurlencodedRequestBody](#applicationxwwwformurlencodedrequestbody) + +sealed interface that stores request contentType + validated schema data + +## ApplicationxwwwformurlencodedRequestBody +public record ApplicationxwwwformurlencodedRequestBody
+implements [SealedRequestBody](#sealedrequestbody),
+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 | + +### 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 | diff --git a/samples/client/petstore/kotlin/docs/paths/petpetid/post/PetpetidPostResponses.md b/samples/client/petstore/kotlin/docs/paths/petpetid/post/PetpetidPostResponses.md new file mode 100644 index 00000000000..1372e9116b3 --- /dev/null +++ b/samples/client/petstore/kotlin/docs/paths/petpetid/post/PetpetidPostResponses.md @@ -0,0 +1,10 @@ +# PetpetidPostResponses + +public class PetpetidPostResponses + +A class that contains necessary responses classes + +## Nested Class Summary +| Modifier and Type | Class and Description | +| ----------------- | --------------------- | + diff --git a/samples/client/petstore/kotlin/docs/paths/petpetid/post/PetpetidPostSecurityInfo.md b/samples/client/petstore/kotlin/docs/paths/petpetid/post/PetpetidPostSecurityInfo.md new file mode 100644 index 00000000000..915b9ce6f7c --- /dev/null +++ b/samples/client/petstore/kotlin/docs/paths/petpetid/post/PetpetidPostSecurityInfo.md @@ -0,0 +1,42 @@ +# PetpetidPostSecurityInfo +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 +- an enum class that describes security index values + +## Nested Class Summary +| Modifier and Type | Class and Description | +| ----------------- | --------------------- | +| static class | [PetpetidPostSecurityInfo.PetpetidPostSecurityInfo1](#petpetidpostsecurityinfo1)
SecurityRequirementObjectProvider +| enum | [PetpetidPostSecurityInfo.SecurityIndex](#securityindex)
class that stores a security index | + +## PetpetidPostSecurityInfo1 +implements SecurityRequirementObjectProvider<[SecurityIndex](#securityindex)> + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| PetpetidPostSecurityInfo1()
Creates an instance | + +### Field Summary +| Modifier and Type | Field and Description | +| ----------------- | --------------------- | +| [PetpetidPostSecurityRequirementObject0](../../../paths/petpetid/post/security/PetpetidPostSecurityRequirementObject0.md) | security0 | +| [PetpetidPostSecurityRequirementObject1](../../../paths/petpetid/post/security/PetpetidPostSecurityRequirementObject1.md) | security1 | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| SecurityRequirementObject | getSecurityRequirementObject(@Nullable [SecurityIndex](#securityindex) securityIndex)
If null is input, then the instance's securityIndex will be used | + +## SecurityIndex +enum SecurityIndex
+ +### Enum Constant Summary +| Enum Constant And Description | +| ----------------------------- | +| SECURITY_0
security 0 | +| SECURITY_1
security 1 | diff --git a/samples/client/petstore/kotlin/docs/paths/petpetid/post/parameters/parameter0/Schema0.md b/samples/client/petstore/kotlin/docs/paths/petpetid/post/parameters/parameter0/Schema0.md new file mode 100644 index 00000000000..55e4e5cb238 --- /dev/null +++ b/samples/client/petstore/kotlin/docs/paths/petpetid/post/parameters/parameter0/Schema0.md @@ -0,0 +1,49 @@ +# Schema0 +public class Schema0
+ +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 + +## Nested Class Summary +| Modifier and Type | Class and Description | +| ----------------- | ---------------------- | +| sealed interface | [Schema0.Schema01Boxed](#schema01boxed)
sealed interface for validated payloads | +| record | [Schema0.Schema01BoxedNumber](#schema01boxednumber)
boxed class to store validated Number payloads | +| static class | [Schema0.Schema01](#schema01)
schema class | + +## Schema01Boxed +public sealed interface Schema01Boxed
+permits
+[Schema01BoxedNumber](#schema01boxednumber) + +sealed interface that stores validated payloads using boxed classes + +## Schema01BoxedNumber +public record Schema01BoxedNumber
+implements [Schema01Boxed](#schema01boxed) + +record that stores validated Number payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| Schema01BoxedNumber(Number data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| Number | data()
validated payload | +| @Nullable Object | getData()
validated payload | + +## Schema01 +public static class Schema01
+extends Int64JsonSchema.Int64JsonSchema1 + +A schema class that validates payloads + +| Methods Inherited from class org.openapijsonschematools.client.schemas.Int64JsonSchema.Int64JsonSchema1 | +| ------------------------------------------------------------------ | +| validate | +| validateAndBox | diff --git a/samples/client/petstore/kotlin/docs/paths/petpetid/post/requestbody/content/applicationxwwwformurlencoded/ApplicationxwwwformurlencodedSchema.md b/samples/client/petstore/kotlin/docs/paths/petpetid/post/requestbody/content/applicationxwwwformurlencoded/ApplicationxwwwformurlencodedSchema.md new file mode 100644 index 00000000000..9a55a49da6a --- /dev/null +++ b/samples/client/petstore/kotlin/docs/paths/petpetid/post/requestbody/content/applicationxwwwformurlencoded/ApplicationxwwwformurlencodedSchema.md @@ -0,0 +1,214 @@ +# ApplicationxwwwformurlencodedSchema +public class ApplicationxwwwformurlencodedSchema
+ +A class that contains necessary nested +- schema classes (which validate payloads), extends JsonSchema +- sealed interfaces which store validated payloads, java version of a sum type +- boxed classes which store validated payloads, sealed permits class implementations +- classes to store validated map payloads, extends FrozenMap +- classes to build inputs for map payloads + +## Nested Class Summary +| Modifier and Type | Class and Description | +| ----------------- | ---------------------- | +| sealed interface | [ApplicationxwwwformurlencodedSchema.ApplicationxwwwformurlencodedSchema1Boxed](#applicationxwwwformurlencodedschema1boxed)
sealed interface for validated payloads | +| record | [ApplicationxwwwformurlencodedSchema.ApplicationxwwwformurlencodedSchema1BoxedMap](#applicationxwwwformurlencodedschema1boxedmap)
boxed class to store validated Map payloads | +| static class | [ApplicationxwwwformurlencodedSchema.ApplicationxwwwformurlencodedSchema1](#applicationxwwwformurlencodedschema1)
schema class | +| static class | [ApplicationxwwwformurlencodedSchema.ApplicationxwwwformurlencodedSchemaMapBuilder](#applicationxwwwformurlencodedschemamapbuilder)
builder for Map payloads | +| static class | [ApplicationxwwwformurlencodedSchema.ApplicationxwwwformurlencodedSchemaMap](#applicationxwwwformurlencodedschemamap)
output class for Map payloads | +| sealed interface | [ApplicationxwwwformurlencodedSchema.ApplicationxwwwformurlencodedStatusBoxed](#applicationxwwwformurlencodedstatusboxed)
sealed interface for validated payloads | +| record | [ApplicationxwwwformurlencodedSchema.ApplicationxwwwformurlencodedStatusBoxedString](#applicationxwwwformurlencodedstatusboxedstring)
boxed class to store validated String payloads | +| static class | [ApplicationxwwwformurlencodedSchema.ApplicationxwwwformurlencodedStatus](#applicationxwwwformurlencodedstatus)
schema class | +| sealed interface | [ApplicationxwwwformurlencodedSchema.ApplicationxwwwformurlencodedNameBoxed](#applicationxwwwformurlencodednameboxed)
sealed interface for validated payloads | +| record | [ApplicationxwwwformurlencodedSchema.ApplicationxwwwformurlencodedNameBoxedString](#applicationxwwwformurlencodednameboxedstring)
boxed class to store validated String payloads | +| static class | [ApplicationxwwwformurlencodedSchema.ApplicationxwwwformurlencodedName](#applicationxwwwformurlencodedname)
schema class | + +## ApplicationxwwwformurlencodedSchema1Boxed +public sealed interface ApplicationxwwwformurlencodedSchema1Boxed
+permits
+[ApplicationxwwwformurlencodedSchema1BoxedMap](#applicationxwwwformurlencodedschema1boxedmap) + +sealed interface that stores validated payloads using boxed classes + +## ApplicationxwwwformurlencodedSchema1BoxedMap +public record ApplicationxwwwformurlencodedSchema1BoxedMap
+implements [ApplicationxwwwformurlencodedSchema1Boxed](#applicationxwwwformurlencodedschema1boxed) + +record that stores validated Map payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| ApplicationxwwwformurlencodedSchema1BoxedMap([ApplicationxwwwformurlencodedSchemaMap](#applicationxwwwformurlencodedschemamap) data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| [ApplicationxwwwformurlencodedSchemaMap](#applicationxwwwformurlencodedschemamap) | data()
validated payload | +| @Nullable Object | getData()
validated payload | + +## ApplicationxwwwformurlencodedSchema1 +public static class ApplicationxwwwformurlencodedSchema1
+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.petpetid.post.requestbody.content.applicationxwwwformurlencoded.ApplicationxwwwformurlencodedSchema; + +import java.util.Arrays; +import java.util.List; +import java.util.AbstractMap; + +static final SchemaConfiguration configuration = new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().build()); + +// Map validation +ApplicationxwwwformurlencodedSchema.ApplicationxwwwformurlencodedSchemaMap validatedPayload = + ApplicationxwwwformurlencodedSchema.ApplicationxwwwformurlencodedSchema1.validate( + new ApplicationxwwwformurlencodedSchema.ApplicationxwwwformurlencodedSchemaMapBuilder() + .name("a") + + .status("a") + + .build(), + configuration +); +``` + +### Field Summary +| Modifier and Type | Field and Description | +| ----------------- | ---------------------- | +| Set> | type = Set.of(Map.class) | +| Map> | properties = Map.ofEntries(
    new PropertyEntry("name", [ApplicationxwwwformurlencodedName.class](#applicationxwwwformurlencodedname))),
    new PropertyEntry("status", [ApplicationxwwwformurlencodedStatus.class](#applicationxwwwformurlencodedstatus)))
)
| + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| [ApplicationxwwwformurlencodedSchemaMap](#applicationxwwwformurlencodedschemamap) | validate([Map<?, ?>](#applicationxwwwformurlencodedschemamapbuilder) arg, SchemaConfiguration configuration) | +| [ApplicationxwwwformurlencodedSchema1BoxedMap](#applicationxwwwformurlencodedschema1boxedmap) | validateAndBox([Map<?, ?>](#applicationxwwwformurlencodedschemamapbuilder) arg, SchemaConfiguration configuration) | +| [ApplicationxwwwformurlencodedSchema1Boxed](#applicationxwwwformurlencodedschema1boxed) | validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) | +| @Nullable Object | validate(@Nullable Object arg, SchemaConfiguration configuration) | + +## ApplicationxwwwformurlencodedSchemaMapBuilder +public class ApplicationxwwwformurlencodedSchemaMapBuilder
+builder for `Map` + +A class that builds the Map input type + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| ApplicationxwwwformurlencodedSchemaMapBuilder()
Creates a builder that contains an empty map | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| Map | build()
Returns map input that should be used with Schema.validate | +| [ApplicationxwwwformurlencodedSchemaMapBuilder](#applicationxwwwformurlencodedschemamapbuilder) | name(String value) | +| [ApplicationxwwwformurlencodedSchemaMapBuilder](#applicationxwwwformurlencodedschemamapbuilder) | status(String value) | +| [ApplicationxwwwformurlencodedSchemaMapBuilder](#applicationxwwwformurlencodedschemamapbuilder) | additionalProperty(String key, Nothing? value) | +| [ApplicationxwwwformurlencodedSchemaMapBuilder](#applicationxwwwformurlencodedschemamapbuilder) | additionalProperty(String key, boolean value) | +| [ApplicationxwwwformurlencodedSchemaMapBuilder](#applicationxwwwformurlencodedschemamapbuilder) | additionalProperty(String key, String value) | +| [ApplicationxwwwformurlencodedSchemaMapBuilder](#applicationxwwwformurlencodedschemamapbuilder) | additionalProperty(String key, int value) | +| [ApplicationxwwwformurlencodedSchemaMapBuilder](#applicationxwwwformurlencodedschemamapbuilder) | additionalProperty(String key, float value) | +| [ApplicationxwwwformurlencodedSchemaMapBuilder](#applicationxwwwformurlencodedschemamapbuilder) | additionalProperty(String key, long value) | +| [ApplicationxwwwformurlencodedSchemaMapBuilder](#applicationxwwwformurlencodedschemamapbuilder) | additionalProperty(String key, double value) | +| [ApplicationxwwwformurlencodedSchemaMapBuilder](#applicationxwwwformurlencodedschemamapbuilder) | additionalProperty(String key, List value) | +| [ApplicationxwwwformurlencodedSchemaMapBuilder](#applicationxwwwformurlencodedschemamapbuilder) | additionalProperty(String key, Map value) | + +## ApplicationxwwwformurlencodedSchemaMap +public static class ApplicationxwwwformurlencodedSchemaMap
+extends FrozenMap + +A class to store validated Map payloads + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| static [ApplicationxwwwformurlencodedSchemaMap](#applicationxwwwformurlencodedschemamap) | of([Map](#applicationxwwwformurlencodedschemamapbuilder) arg, SchemaConfiguration configuration) | +| String | name()
[optional] | +| String | status()
[optional] | +| @Nullable Object | getAdditionalProperty(String name)
provides type safety for additional properties | + +## ApplicationxwwwformurlencodedStatusBoxed +public sealed interface ApplicationxwwwformurlencodedStatusBoxed
+permits
+[ApplicationxwwwformurlencodedStatusBoxedString](#applicationxwwwformurlencodedstatusboxedstring) + +sealed interface that stores validated payloads using boxed classes + +## ApplicationxwwwformurlencodedStatusBoxedString +public record ApplicationxwwwformurlencodedStatusBoxedString
+implements [ApplicationxwwwformurlencodedStatusBoxed](#applicationxwwwformurlencodedstatusboxed) + +record that stores validated String payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| ApplicationxwwwformurlencodedStatusBoxedString(String data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| String | data()
validated payload | +| @Nullable Object | getData()
validated payload | + +## ApplicationxwwwformurlencodedStatus +public static class ApplicationxwwwformurlencodedStatus
+extends StringJsonSchema.StringJsonSchema1 + +A schema class that validates payloads + +## Description +Updated status of the pet + +| Methods Inherited from class org.openapijsonschematools.client.schemas.StringJsonSchema.StringJsonSchema1 | +| ------------------------------------------------------------------ | +| validate | +| validateAndBox | + +## ApplicationxwwwformurlencodedNameBoxed +public sealed interface ApplicationxwwwformurlencodedNameBoxed
+permits
+[ApplicationxwwwformurlencodedNameBoxedString](#applicationxwwwformurlencodednameboxedstring) + +sealed interface that stores validated payloads using boxed classes + +## ApplicationxwwwformurlencodedNameBoxedString +public record ApplicationxwwwformurlencodedNameBoxedString
+implements [ApplicationxwwwformurlencodedNameBoxed](#applicationxwwwformurlencodednameboxed) + +record that stores validated String payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| ApplicationxwwwformurlencodedNameBoxedString(String data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| String | data()
validated payload | +| @Nullable Object | getData()
validated payload | + +## ApplicationxwwwformurlencodedName +public static class ApplicationxwwwformurlencodedName
+extends StringJsonSchema.StringJsonSchema1 + +A schema class that validates payloads + +## Description +Updated name of the pet + +| Methods Inherited from class org.openapijsonschematools.client.schemas.StringJsonSchema.StringJsonSchema1 | +| ------------------------------------------------------------------ | +| validate | +| validateAndBox | diff --git a/samples/client/petstore/kotlin/docs/paths/petpetid/post/responses/PetpetidPostCode405Response.md b/samples/client/petstore/kotlin/docs/paths/petpetid/post/responses/PetpetidPostCode405Response.md new file mode 100644 index 00000000000..b3693ccc7cd --- /dev/null +++ b/samples/client/petstore/kotlin/docs/paths/petpetid/post/responses/PetpetidPostCode405Response.md @@ -0,0 +1,32 @@ +# PetpetidPostCode405Response + +public class PetpetidPostCode405Response + +A class that contains necessary nested response classes +- a class that extends ResponseDeserializer and is used to deserialize responses + +## Nested Class Summary +| Modifier and Type | Class and Description | +| ----------------- | --------------------- | +| static class | [PetpetidPostCode405Response.PetpetidPostCode405Response1](#petpetidpostcode405response1)
class that deserializes responses | + +## PetpetidPostCode405Response1 +public static class PetpetidPostCode405Response1
+extends ResponseDeserializer + +a class that deserializes responses + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| PetpetidPostCode405Response1()
Creates an instance | + +### Field Summary +| Modifier and Type | Field and Description | +| ----------------- | --------------------- | +| Map | content = MapUtils.makeMap(
)
the contentType to schema info | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| ApiResponse | deserialize(HttpResponse response, SchemaConfiguration configuration)
called by endpoint when deserialize responses | diff --git a/samples/client/petstore/kotlin/docs/paths/petpetid/post/security/PetpetidPostSecurityRequirementObject0.md b/samples/client/petstore/kotlin/docs/paths/petpetid/post/security/PetpetidPostSecurityRequirementObject0.md new file mode 100644 index 00000000000..0e8d3540345 --- /dev/null +++ b/samples/client/petstore/kotlin/docs/paths/petpetid/post/security/PetpetidPostSecurityRequirementObject0.md @@ -0,0 +1,15 @@ +# PetpetidPostSecurityRequirementObject0 +PetpetidPostSecurityRequirementObject0.java + +public class PetpetidPostSecurityRequirementObject0 +extends SecurityRequirementObject + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| PetpetidPostSecurityRequirementObject0()
Creates an instance | + +### 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()
    )) | diff --git a/samples/client/petstore/kotlin/docs/paths/petpetid/post/security/PetpetidPostSecurityRequirementObject1.md b/samples/client/petstore/kotlin/docs/paths/petpetid/post/security/PetpetidPostSecurityRequirementObject1.md new file mode 100644 index 00000000000..fb9621d4c1e --- /dev/null +++ b/samples/client/petstore/kotlin/docs/paths/petpetid/post/security/PetpetidPostSecurityRequirementObject1.md @@ -0,0 +1,15 @@ +# PetpetidPostSecurityRequirementObject1 +PetpetidPostSecurityRequirementObject1.java + +public class PetpetidPostSecurityRequirementObject1 +extends SecurityRequirementObject + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| PetpetidPostSecurityRequirementObject1()
Creates an instance | + +### 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")
    )) | diff --git a/samples/client/petstore/kotlin/docs/paths/petpetiduploadimage/PetpetiduploadimagePost.md b/samples/client/petstore/kotlin/docs/paths/petpetiduploadimage/PetpetiduploadimagePost.md new file mode 100644 index 00000000000..53d0aedf3a0 --- /dev/null +++ b/samples/client/petstore/kotlin/docs/paths/petpetiduploadimage/PetpetiduploadimagePost.md @@ -0,0 +1,203 @@ +# PetpetiduploadimagePost + +public class PetpetiduploadimagePost + +A class that contains necessary endpoint classes +- a class that calls the endpoint method using the http verb +- a class that calls the endpoint method using the operationId name +- class(es) to store the request inputs +- builder(s) to set the request input data + +## Nested Class Summary +| Modifier and Type | Class and Description | +| ----------------- | --------------------- | +| static class | [Post](#post)
The class that has a post method to call the endpoint | +| interface | [UploadImageOperation](#uploadimageoperation)
The interface that has a uploadImage method to call the endpoint | +| static class | [PostRequest](#postrequest)
The final request inputs class | +| static class | [PostNullableRequest](#postnullablerequest)
The initial request inputs class | +| static class | [Post0RequestBuilder](#post0requestbuilder)
A builder for the request input class | +| static class | [PostRequestBuilder](#postrequestbuilder)
A builder for the request input class | + +## Post +public static class Post 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.PetpetiduploadimagePostRequestBody; +import org.openapijsonschematools.client.RootServerInfo; +import org.openapijsonschematools.client.paths.petpetiduploadimage.post.PetpetiduploadimagePostSecurityInfo; +import org.openapijsonschematools.client.paths.petpetiduploadimage.post.PetpetiduploadimagePostPathParameters; +import org.openapijsonschematools.client.servers.RootServer0; +import org.openapijsonschematools.client.servers.RootServer1; +import org.openapijsonschematools.client.servers.RootServer2; +import org.openapijsonschematools.client.securityschemes.SecurityScheme; +import org.openapijsonschematools.client.components.securityschemes.PetstoreAuth; +import org.openapijsonschematools.client.paths.petpetiduploadimage.post.responses.PetpetiduploadimagePostCode200Response; +import org.openapijsonschematools.client.components.responses.successwithjsonapiresponse.SuccessWithJsonApiResponseHeadersSchema; +import org.openapijsonschematools.client.servers.RootServerInfo; +import org.openapijsonschematools.client.paths.petpetiduploadimage.PetpetiduploadimagePost; +import org.openapijsonschematools.client.paths.petpetiduploadimage.post.PetpetiduploadimagePostResponses; + +import java.io.IOException; +import java.util.Arrays; +import java.util.List; +import java.util.Map; +import java.util.AbstractMap; + +// if you want to use a server that is not SERVER_0 pass it in here and change the ServerIndex input below +ApiConfiguration.ServerInfo serverInfo = new ApiConfiguration.ServerInfoBuilder() + .rootServerInfo( + new RootServerInfo.RootServerInfoBuilder() + .rootServer0(new RootServer0()) + .build() + ) + .build(); +ApiConfiguration.ServerIndexInfo serverIndexInfo = new ApiConfiguration.ServerIndexInfoBuilder() + .rootServerInfoServerIndex(RootServerInfo.ServerIndex.SERVER_0) + .build(); +List securitySchemes = new ArrayList(); +ApiConfiguration.SecurityIndexInfo securityIndexInfo = new ApiConfiguration.SecurityIndexInfoBuilder() + .petpetiduploadimagePostSecurityRequirementObject0SecurityIndex(PetpetiduploadimagePostSecurityRequirementObject0.SecurityIndex.SECURITY_0) + .build(); +Duration timeout = Duration.ofSeconds(1L); +Map> defaultHeaders = Map.of("User-Agent", List.of("OpenAPI-JSON-Schema-Generator/1.0.0/java")); +ApiConfiguration apiConfiguration = new ApiConfiguration( + serverInfo + serverIndexInfo, + securitySchemes, + securityIndexInfo, + timeout, + defaultHeaders +); +SchemaConfiguration schemaConfiguration = new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().build()); +PetpetiduploadimagePost.Post apiClient = new PetpetiduploadimagePost.Post(apiConfiguration, schemaConfiguration); + + +// Map validation +PetpetiduploadimagePostPathParameters.PathParametersMap pathParameters = + PetpetiduploadimagePostPathParameters.PetpetiduploadimagePostPathParameters1.validate( + new PetpetiduploadimagePostPathParameters.PathParametersMapBuilder() + .petId(1L) + + .build(), + schemaConfiguration +); + +var request = new PetpetiduploadimagePost.PostRequestBuilder() + .pathParameters(pathParameters) + .build(); + +PetpetiduploadimagePostResponses.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; +} +PetpetiduploadimagePostResponses.EndpointPetpetiduploadimagePostCode200Response castResponse = (PetpetiduploadimagePostResponses.EndpointPetpetiduploadimagePostCode200Response) response; +} +``` +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| Post(ApiConfiguration apiConfiguration, SchemaConfiguration schemaConfiguration)
Creates an instance | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| [PetpetiduploadimagePostResponses.EndpointResponse](../../paths/petpetiduploadimage/post/PetpetiduploadimagePostResponses.md#endpointresponse) | post([PostRequest](#postrequest) request) | + +## UploadImageOperation +public interface UploadImageOperation
+ +an interface that allows one to call the endpoint using a method named uploadImage by the operationId + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| [PetpetiduploadimagePostResponses.EndpointResponse](../../paths/petpetiduploadimage/post/PetpetiduploadimagePostResponses.md#endpointresponse) | uploadImage([PostRequest](#postrequest) request) | + +## PostRequest +public static class PostRequest
+ +a class that stores the final request inputs + +### Field Summary +| Modifier and Type | Field and Description | +| ----------------- | --------------------- | +| [PetpetiduploadimagePostPathParameters.PathParametersMap](../../paths/petpetiduploadimage/post/PetpetiduploadimagePostPathParameters.md#pathparametersmap) | pathParameters | +| [PetpetiduploadimagePostRequestBody.@Nullable SealedRequestBody](../../paths/petpetiduploadimage/post/PetpetiduploadimagePostRequestBody.md#sealedrequestbody) | requestBody
optional | +| [RootServerInfo.@Nullable ServerIndex](../../RootServerInfo.md#serverindex) | serverIndex
optional. Note: this will override the value in apiConfiguration | +| [PetpetiduploadimagePostSecurityInfo.@Nullable SecurityIndex](../../paths/petpetiduploadimage/post/PetpetiduploadimagePostSecurityInfo.md#securityindex) | securityIndex
optional. Note: this will override the value in apiConfiguration | +| @Nullable Duration | timeout
optional. Note: this will override the value in apiConfiguration | + +## PostNullableRequest +public static class PostNullableRequest
+ +a class that stores the initial request inputs + +### Field Summary +| Modifier and Type | Field and Description | +| ----------------- | --------------------- | +| [PetpetiduploadimagePostPathParameters.@Nullable PathParametersMap](../../paths/petpetiduploadimage/post/PetpetiduploadimagePostPathParameters.md#pathparametersmap) | pathParameters | +| [PetpetiduploadimagePostRequestBody.@Nullable SealedRequestBody](../../paths/petpetiduploadimage/post/PetpetiduploadimagePostRequestBody.md#sealedrequestbody) | requestBody | +| [RootServerInfo.@Nullable ServerIndex](../../RootServerInfo.md#serverindex) | serverIndex | +| [PetpetiduploadimagePostSecurityInfo.@Nullable SecurityIndex](../../paths/petpetiduploadimage/post/PetpetiduploadimagePostSecurityInfo.md#securityindex) | securityIndex | +| @Nullable Duration | timeout | + +## Post0RequestBuilder +public static class Post0RequestBuilder
+ +a builder for request inputs + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| Post0RequestBuilder(Post0RequestBuilder instance)
Creates a builder that contains the passed instance | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| [PostRequest](#postrequest) | build()
Returns the request input used to call an endpoint method | +| [Post0RequestBuilder](#post0requestbuilder) | requestBody([PetpetiduploadimagePostRequestBody.SealedRequestBody](../../paths/petpetiduploadimage/post/PetpetiduploadimagePostRequestBody.md#sealedrequestbody) requestBody)
sets the optional property | +| [Post0RequestBuilder](#post0requestbuilder) | serverIndex([RootServerInfo.ServerIndex](../../RootServerInfo.md#serverindex) serverIndex)
sets the optional property. Note: this will override the value in apiConfiguration | +| [Post0RequestBuilder](#post0requestbuilder) | securityIndex([PetpetiduploadimagePostSecurityInfo.SecurityIndex](../../paths/petpetiduploadimage/post/PetpetiduploadimagePostSecurityInfo.md#securityindex) securityIndex)
sets the optional property. Note: this will override the value in apiConfiguration | +| [Post0RequestBuilder](#post0requestbuilder) | timeout(Duration timeout)
sets the optional property. Note: this will override the value in apiConfiguration | + +## PostRequestBuilder +public static class PostRequestBuilder
+ +a builder for request inputs + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| PostRequestBuilder()
Creates a builder that contains null for all parameters | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| [Post0RequestBuilder](#post0requestbuilder) | pathParameters([PetpetiduploadimagePostPathParametersPathParametersMap](../../paths/petpetiduploadimage/post/PetpetiduploadimagePostPathParameters.md#pathparametersmap) pathParameters)
sets the property | + +[[Back to top]](#top) [[Back to README]](../../../README.md) diff --git a/samples/client/petstore/kotlin/docs/paths/petpetiduploadimage/post/PetpetiduploadimagePostPathParameters.md b/samples/client/petstore/kotlin/docs/paths/petpetiduploadimage/post/PetpetiduploadimagePostPathParameters.md new file mode 100644 index 00000000000..2ab0aa08198 --- /dev/null +++ b/samples/client/petstore/kotlin/docs/paths/petpetiduploadimage/post/PetpetiduploadimagePostPathParameters.md @@ -0,0 +1,271 @@ +# PetpetiduploadimagePostPathParameters +public class PetpetiduploadimagePostPathParameters
+ +A class that contains necessary nested +- schema classes (which validate payloads), extends JsonSchema +- sealed interfaces which store validated payloads, java version of a sum type +- boxed classes which store validated payloads, sealed permits class implementations +- classes to store validated map payloads, extends FrozenMap +- classes to build inputs for map payloads + +## Nested Class Summary +| Modifier and Type | Class and Description | +| ----------------- | ---------------------- | +| sealed interface | [PetpetiduploadimagePostPathParameters.PetpetiduploadimagePostPathParameters1Boxed](#petpetiduploadimagepostpathparameters1boxed)
sealed interface for validated payloads | +| record | [PetpetiduploadimagePostPathParameters.PetpetiduploadimagePostPathParameters1BoxedMap](#petpetiduploadimagepostpathparameters1boxedmap)
boxed class to store validated Map payloads | +| static class | [PetpetiduploadimagePostPathParameters.PetpetiduploadimagePostPathParameters1](#petpetiduploadimagepostpathparameters1)
schema class | +| static class | [PetpetiduploadimagePostPathParameters.PathParametersMapBuilder](#pathparametersmapbuilder)
builder for Map payloads | +| static class | [PetpetiduploadimagePostPathParameters.PathParametersMap](#pathparametersmap)
output class for Map payloads | +| sealed interface | [PetpetiduploadimagePostPathParameters.AdditionalPropertiesBoxed](#additionalpropertiesboxed)
sealed interface for validated payloads | +| record | [PetpetiduploadimagePostPathParameters.AdditionalPropertiesBoxedVoid](#additionalpropertiesboxedvoid)
boxed class to store validated null payloads | +| record | [PetpetiduploadimagePostPathParameters.AdditionalPropertiesBoxedBoolean](#additionalpropertiesboxedboolean)
boxed class to store validated boolean payloads | +| record | [PetpetiduploadimagePostPathParameters.AdditionalPropertiesBoxedNumber](#additionalpropertiesboxednumber)
boxed class to store validated Number payloads | +| record | [PetpetiduploadimagePostPathParameters.AdditionalPropertiesBoxedString](#additionalpropertiesboxedstring)
boxed class to store validated String payloads | +| record | [PetpetiduploadimagePostPathParameters.AdditionalPropertiesBoxedList](#additionalpropertiesboxedlist)
boxed class to store validated List payloads | +| record | [PetpetiduploadimagePostPathParameters.AdditionalPropertiesBoxedMap](#additionalpropertiesboxedmap)
boxed class to store validated Map payloads | +| static class | [PetpetiduploadimagePostPathParameters.AdditionalProperties](#additionalproperties)
schema class | + +## PetpetiduploadimagePostPathParameters1Boxed +public sealed interface PetpetiduploadimagePostPathParameters1Boxed
+permits
+[PetpetiduploadimagePostPathParameters1BoxedMap](#petpetiduploadimagepostpathparameters1boxedmap) + +sealed interface that stores validated payloads using boxed classes + +## PetpetiduploadimagePostPathParameters1BoxedMap +public record PetpetiduploadimagePostPathParameters1BoxedMap
+implements [PetpetiduploadimagePostPathParameters1Boxed](#petpetiduploadimagepostpathparameters1boxed) + +record that stores validated Map payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| PetpetiduploadimagePostPathParameters1BoxedMap([PathParametersMap](#pathparametersmap) data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| [PathParametersMap](#pathparametersmap) | data()
validated payload | +| @Nullable Object | getData()
validated payload | + +## PetpetiduploadimagePostPathParameters1 +public static class PetpetiduploadimagePostPathParameters1
+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.petpetiduploadimage.post.PetpetiduploadimagePostPathParameters; + +import java.util.Arrays; +import java.util.List; +import java.util.AbstractMap; + +static final SchemaConfiguration configuration = new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().build()); + +// Map validation +PetpetiduploadimagePostPathParameters.PathParametersMap validatedPayload = + PetpetiduploadimagePostPathParameters.PetpetiduploadimagePostPathParameters1.validate( + new PetpetiduploadimagePostPathParameters.PathParametersMapBuilder() + .petId(1L) + + .build(), + configuration +); +``` + +### Field Summary +| Modifier and Type | Field and Description | +| ----------------- | ---------------------- | +| Set> | type = Set.of(Map.class) | +| Map> | properties = Map.ofEntries(
    new PropertyEntry("petId", [Schema0.Schema01.class](../../../paths/petpetiduploadimage/post/parameters/parameter0/Schema0.md#schema01))
)
| +| Set | required = Set.of(
    "petId"
)
| +| Class | additionalProperties = [AdditionalProperties.class](#additionalproperties) | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| [PathParametersMap](#pathparametersmap) | validate([Map<?, ?>](#pathparametersmapbuilder) arg, SchemaConfiguration configuration) | +| [PetpetiduploadimagePostPathParameters1BoxedMap](#petpetiduploadimagepostpathparameters1boxedmap) | validateAndBox([Map<?, ?>](#pathparametersmapbuilder) arg, SchemaConfiguration configuration) | +| [PetpetiduploadimagePostPathParameters1Boxed](#petpetiduploadimagepostpathparameters1boxed) | validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) | +| @Nullable Object | validate(@Nullable Object arg, SchemaConfiguration configuration) | + +## PathParametersMap0Builder +public class PathParametersMap0Builder
+builder for `Map` + +A class that builds the Map input type + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| PathParametersMap0Builder(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 | + +## PathParametersMapBuilder +public class PathParametersMapBuilder
+builder for `Map` + +A class that builds the Map input type + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| PathParametersMapBuilder()
Creates a builder that contains an empty map | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| [PathParametersMap0Builder](#pathparametersmap0builder) | petId(int value) | +| [PathParametersMap0Builder](#pathparametersmap0builder) | petId(float value) | +| [PathParametersMap0Builder](#pathparametersmap0builder) | petId(long value) | +| [PathParametersMap0Builder](#pathparametersmap0builder) | petId(double value) | + +## PathParametersMap +public static class PathParametersMap
+extends FrozenMap + +A class to store validated Map payloads + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| static [PathParametersMap](#pathparametersmap) | of([Map](#pathparametersmapbuilder) arg, SchemaConfiguration configuration) | +| Number | petId()
| + +## 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(Nothing? data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| Nothing? | 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/kotlin/docs/paths/petpetiduploadimage/post/PetpetiduploadimagePostRequestBody.md b/samples/client/petstore/kotlin/docs/paths/petpetiduploadimage/post/PetpetiduploadimagePostRequestBody.md new file mode 100644 index 00000000000..7f856bff9b9 --- /dev/null +++ b/samples/client/petstore/kotlin/docs/paths/petpetiduploadimage/post/PetpetiduploadimagePostRequestBody.md @@ -0,0 +1,90 @@ +# PetpetiduploadimagePostRequestBody + +public class PetpetiduploadimagePostRequestBody + +A class that contains necessary nested request body classes +- SealedMediaType, a sealed interface which contains all the schema/encoding info for each contentType +- records which implement SealedMediaType, the concrete media types +- a class that extends RequestBodySerializer and is used to serialize input SealedRequestBody instances +- SealedRequestBody, a sealed interface which contains all the contentType/schema input types +- records which implement SealedRequestBody, the concrete request body types + +## Nested Class Summary +| Modifier and Type | Class and Description | +| ----------------- | --------------------- | +| sealed interface | [PetpetiduploadimagePostRequestBody.SealedMediaType](#sealedmediatype)
media type sealed interface | +| record | [PetpetiduploadimagePostRequestBody.MultipartformdataMediaType](#multipartformdatamediatype)
record storing schema + encoding for a specific contentType | +| static class | [PetpetiduploadimagePostRequestBody.PetpetiduploadimagePostRequestBody1](#petpetiduploadimagepostrequestbody1)
class that serializes request bodies | +| sealed interface | [PetpetiduploadimagePostRequestBody.SealedRequestBody](#sealedrequestbody)
request body sealed interface | +| record | [PetpetiduploadimagePostRequestBody.MultipartformdataRequestBody](#multipartformdatarequestbody)
implements sealed interface to store request body input | + +## SealedMediaType +public sealed interface SealedMediaType
+permits
+[MultipartformdataMediaType](#multipartformdatamediatype) + +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), Nothing?> + +class storing schema info for a specific contentType + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| MultipartformdataMediaType()
Creates an instance | + +### 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 | +| Nothing? | encoding()
the encoding info | + +## PetpetiduploadimagePostRequestBody1 +public static class PetpetiduploadimagePostRequestBody1
+ +a class that serializes SealedRequestBody request bodies + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| PetpetiduploadimagePostRequestBody1()
Creates an instance | + +### Field Summary +| Modifier and Type | Field and Description | +| ----------------- | --------------------- | +| boolean | required = false
whether the request body is required | +| Map | content = Map.ofEntries(
    new AbstractMap.SimpleEntry<>("multipart/form-data", new [MultipartformdataMediaType](#multipartformdatamediatype)())
)
the contentType to schema info | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| SerializedRequestBody | serialize([SealedRequestBody](#sealedrequestbody) requestBody)
called by endpoint when creating request body bytes | + +## SealedRequestBody +public sealed interface SealedRequestBody
+permits
+[MultipartformdataRequestBody](#multipartformdatarequestbody) + +sealed interface that stores request contentType + validated schema data + +## MultipartformdataRequestBody +public record MultipartformdataRequestBody
+implements [SealedRequestBody](#sealedrequestbody),
+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 | + +### 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 | diff --git a/samples/client/petstore/kotlin/docs/paths/petpetiduploadimage/post/PetpetiduploadimagePostResponses.md b/samples/client/petstore/kotlin/docs/paths/petpetiduploadimage/post/PetpetiduploadimagePostResponses.md new file mode 100644 index 00000000000..b961dc0e86b --- /dev/null +++ b/samples/client/petstore/kotlin/docs/paths/petpetiduploadimage/post/PetpetiduploadimagePostResponses.md @@ -0,0 +1,29 @@ +# PetpetiduploadimagePostResponses + +public class PetpetiduploadimagePostResponses + +A class that contains necessary responses classes +- a sealed interface, EndpointResponse, that stores endpoint responses +- records for each endpoint response + +## Nested Class Summary +| Modifier and Type | Class and Description | +| ----------------- | --------------------- | +| sealed interface | [EndpointResponse](#endpointresponse)
stores the endpoint responses | +| record | [EndpointPetpetiduploadimagePostCode200Response](#endpointpetpetiduploadimagepostcode200response)
the response for 200 | + +## EndpointResponse +public sealed interface EndpointResponse permits
+[EndpointPetpetiduploadimagePostCode200Response](#endpointpetpetiduploadimagepostcode200response) + +a sealed interface that stores endpoint responses + +## EndpointPetpetiduploadimagePostCode200Response +public record EndpointPetpetiduploadimagePostCode200Response( + HttpResponse response, + [PetpetiduploadimagePostCode200Response.SealedResponseBody](../../../paths/petpetiduploadimage/post/responses/PetpetiduploadimagePostCode200Response.md#sealedresponsebody) body, + [SuccessWithJsonApiResponseHeadersSchema.SuccessWithJsonApiResponseHeadersSchemaMap](../../../components/responses/successwithjsonapiresponse/SuccessWithJsonApiResponseHeadersSchema.md#successwithjsonapiresponseheadersschemamap) headers +) implements EndpointResponse, ApiResponse
+ +a class that stores an endpoint response + diff --git a/samples/client/petstore/kotlin/docs/paths/petpetiduploadimage/post/PetpetiduploadimagePostSecurityInfo.md b/samples/client/petstore/kotlin/docs/paths/petpetiduploadimage/post/PetpetiduploadimagePostSecurityInfo.md new file mode 100644 index 00000000000..a6c84397204 --- /dev/null +++ b/samples/client/petstore/kotlin/docs/paths/petpetiduploadimage/post/PetpetiduploadimagePostSecurityInfo.md @@ -0,0 +1,40 @@ +# PetpetiduploadimagePostSecurityInfo +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 +- an enum class that describes security index values + +## Nested Class Summary +| Modifier and Type | Class and Description | +| ----------------- | --------------------- | +| static class | [PetpetiduploadimagePostSecurityInfo.PetpetiduploadimagePostSecurityInfo1](#petpetiduploadimagepostsecurityinfo1)
SecurityRequirementObjectProvider +| enum | [PetpetiduploadimagePostSecurityInfo.SecurityIndex](#securityindex)
class that stores a security index | + +## PetpetiduploadimagePostSecurityInfo1 +implements SecurityRequirementObjectProvider<[SecurityIndex](#securityindex)> + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| PetpetiduploadimagePostSecurityInfo1()
Creates an instance | + +### Field Summary +| Modifier and Type | Field and Description | +| ----------------- | --------------------- | +| [PetpetiduploadimagePostSecurityRequirementObject0](../../../paths/petpetiduploadimage/post/security/PetpetiduploadimagePostSecurityRequirementObject0.md) | security0 | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| SecurityRequirementObject | getSecurityRequirementObject(@Nullable [SecurityIndex](#securityindex) securityIndex)
If null is input, then the instance's securityIndex will be used | + +## SecurityIndex +enum SecurityIndex
+ +### Enum Constant Summary +| Enum Constant And Description | +| ----------------------------- | +| SECURITY_0
security 0 | diff --git a/samples/client/petstore/kotlin/docs/paths/petpetiduploadimage/post/parameters/parameter0/Schema0.md b/samples/client/petstore/kotlin/docs/paths/petpetiduploadimage/post/parameters/parameter0/Schema0.md new file mode 100644 index 00000000000..55e4e5cb238 --- /dev/null +++ b/samples/client/petstore/kotlin/docs/paths/petpetiduploadimage/post/parameters/parameter0/Schema0.md @@ -0,0 +1,49 @@ +# Schema0 +public class Schema0
+ +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 + +## Nested Class Summary +| Modifier and Type | Class and Description | +| ----------------- | ---------------------- | +| sealed interface | [Schema0.Schema01Boxed](#schema01boxed)
sealed interface for validated payloads | +| record | [Schema0.Schema01BoxedNumber](#schema01boxednumber)
boxed class to store validated Number payloads | +| static class | [Schema0.Schema01](#schema01)
schema class | + +## Schema01Boxed +public sealed interface Schema01Boxed
+permits
+[Schema01BoxedNumber](#schema01boxednumber) + +sealed interface that stores validated payloads using boxed classes + +## Schema01BoxedNumber +public record Schema01BoxedNumber
+implements [Schema01Boxed](#schema01boxed) + +record that stores validated Number payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| Schema01BoxedNumber(Number data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| Number | data()
validated payload | +| @Nullable Object | getData()
validated payload | + +## Schema01 +public static class Schema01
+extends Int64JsonSchema.Int64JsonSchema1 + +A schema class that validates payloads + +| Methods Inherited from class org.openapijsonschematools.client.schemas.Int64JsonSchema.Int64JsonSchema1 | +| ------------------------------------------------------------------ | +| validate | +| validateAndBox | diff --git a/samples/client/petstore/kotlin/docs/paths/petpetiduploadimage/post/requestbody/content/multipartformdata/MultipartformdataSchema.md b/samples/client/petstore/kotlin/docs/paths/petpetiduploadimage/post/requestbody/content/multipartformdata/MultipartformdataSchema.md new file mode 100644 index 00000000000..2c718414bef --- /dev/null +++ b/samples/client/petstore/kotlin/docs/paths/petpetiduploadimage/post/requestbody/content/multipartformdata/MultipartformdataSchema.md @@ -0,0 +1,190 @@ +# MultipartformdataSchema +public class MultipartformdataSchema
+ +A class that contains necessary nested +- schema classes (which validate payloads), extends JsonSchema +- sealed interfaces which store validated payloads, java version of a sum type +- boxed classes which store validated payloads, sealed permits class implementations +- classes to store validated map payloads, extends FrozenMap +- classes to build inputs for map payloads + +## Nested Class Summary +| Modifier and Type | Class and Description | +| ----------------- | ---------------------- | +| sealed interface | [MultipartformdataSchema.MultipartformdataSchema1Boxed](#multipartformdataschema1boxed)
sealed interface for validated payloads | +| record | [MultipartformdataSchema.MultipartformdataSchema1BoxedMap](#multipartformdataschema1boxedmap)
boxed class to store validated Map payloads | +| static class | [MultipartformdataSchema.MultipartformdataSchema1](#multipartformdataschema1)
schema class | +| static class | [MultipartformdataSchema.MultipartformdataSchemaMapBuilder](#multipartformdataschemamapbuilder)
builder for Map payloads | +| static class | [MultipartformdataSchema.MultipartformdataSchemaMap](#multipartformdataschemamap)
output class for Map payloads | +| sealed interface | [MultipartformdataSchema.MultipartformdataFileBoxed](#multipartformdatafileboxed)
sealed interface for validated payloads | +| static class | [MultipartformdataSchema.MultipartformdataFile](#multipartformdatafile)
schema class | +| sealed interface | [MultipartformdataSchema.MultipartformdataAdditionalMetadataBoxed](#multipartformdataadditionalmetadataboxed)
sealed interface for validated payloads | +| record | [MultipartformdataSchema.MultipartformdataAdditionalMetadataBoxedString](#multipartformdataadditionalmetadataboxedstring)
boxed class to store validated String payloads | +| static class | [MultipartformdataSchema.MultipartformdataAdditionalMetadata](#multipartformdataadditionalmetadata)
schema class | + +## MultipartformdataSchema1Boxed +public sealed interface MultipartformdataSchema1Boxed
+permits
+[MultipartformdataSchema1BoxedMap](#multipartformdataschema1boxedmap) + +sealed interface that stores validated payloads using boxed classes + +## MultipartformdataSchema1BoxedMap +public record MultipartformdataSchema1BoxedMap
+implements [MultipartformdataSchema1Boxed](#multipartformdataschema1boxed) + +record that stores validated Map payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| MultipartformdataSchema1BoxedMap([MultipartformdataSchemaMap](#multipartformdataschemamap) data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| [MultipartformdataSchemaMap](#multipartformdataschemamap) | data()
validated payload | +| @Nullable Object | getData()
validated payload | + +## MultipartformdataSchema1 +public static class MultipartformdataSchema1
+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.petpetiduploadimage.post.requestbody.content.multipartformdata.MultipartformdataSchema; + +import java.util.Arrays; +import java.util.List; +import java.util.AbstractMap; + +static final SchemaConfiguration configuration = new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().build()); + +// Map validation +MultipartformdataSchema.MultipartformdataSchemaMap validatedPayload = + MultipartformdataSchema.MultipartformdataSchema1.validate( + new MultipartformdataSchema.MultipartformdataSchemaMapBuilder() + .additionalMetadata("a") + + .file("a") + + .build(), + configuration +); +``` + +### Field Summary +| Modifier and Type | Field and Description | +| ----------------- | ---------------------- | +| Set> | type = Set.of(Map.class) | +| Map> | properties = Map.ofEntries(
    new PropertyEntry("additionalMetadata", [MultipartformdataAdditionalMetadata.class](#multipartformdataadditionalmetadata))),
    new PropertyEntry("file", [MultipartformdataFile.class](#multipartformdatafile)))
)
| + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| [MultipartformdataSchemaMap](#multipartformdataschemamap) | validate([Map<?, ?>](#multipartformdataschemamapbuilder) arg, SchemaConfiguration configuration) | +| [MultipartformdataSchema1BoxedMap](#multipartformdataschema1boxedmap) | validateAndBox([Map<?, ?>](#multipartformdataschemamapbuilder) arg, SchemaConfiguration configuration) | +| [MultipartformdataSchema1Boxed](#multipartformdataschema1boxed) | validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) | +| @Nullable Object | validate(@Nullable Object arg, SchemaConfiguration configuration) | + +## MultipartformdataSchemaMapBuilder +public class MultipartformdataSchemaMapBuilder
+builder for `Map` + +A class that builds the Map input type + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| MultipartformdataSchemaMapBuilder()
Creates a builder that contains an empty map | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| Map | build()
Returns map input that should be used with Schema.validate | +| [MultipartformdataSchemaMapBuilder](#multipartformdataschemamapbuilder) | additionalMetadata(String value) | +| [MultipartformdataSchemaMapBuilder](#multipartformdataschemamapbuilder) | file(String value) | +| [MultipartformdataSchemaMapBuilder](#multipartformdataschemamapbuilder) | additionalProperty(String key, Nothing? value) | +| [MultipartformdataSchemaMapBuilder](#multipartformdataschemamapbuilder) | additionalProperty(String key, boolean value) | +| [MultipartformdataSchemaMapBuilder](#multipartformdataschemamapbuilder) | additionalProperty(String key, String value) | +| [MultipartformdataSchemaMapBuilder](#multipartformdataschemamapbuilder) | additionalProperty(String key, int value) | +| [MultipartformdataSchemaMapBuilder](#multipartformdataschemamapbuilder) | additionalProperty(String key, float value) | +| [MultipartformdataSchemaMapBuilder](#multipartformdataschemamapbuilder) | additionalProperty(String key, long value) | +| [MultipartformdataSchemaMapBuilder](#multipartformdataschemamapbuilder) | additionalProperty(String key, double value) | +| [MultipartformdataSchemaMapBuilder](#multipartformdataschemamapbuilder) | additionalProperty(String key, List value) | +| [MultipartformdataSchemaMapBuilder](#multipartformdataschemamapbuilder) | additionalProperty(String key, Map value) | + +## MultipartformdataSchemaMap +public static class MultipartformdataSchemaMap
+extends FrozenMap + +A class to store validated Map payloads + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| static [MultipartformdataSchemaMap](#multipartformdataschemamap) | of([Map](#multipartformdataschemamapbuilder) arg, SchemaConfiguration configuration) | +| String | additionalMetadata()
[optional] | +| String | file()
[optional] | +| @Nullable Object | getAdditionalProperty(String name)
provides type safety for additional properties | + +## MultipartformdataFileBoxed +public sealed interface MultipartformdataFileBoxed
+permits
+ +sealed interface that stores validated payloads using boxed classes + +## MultipartformdataFile +public static class MultipartformdataFile
+extends JsonSchema + +A schema class that validates payloads + +## Description +file to upload + +## MultipartformdataAdditionalMetadataBoxed +public sealed interface MultipartformdataAdditionalMetadataBoxed
+permits
+[MultipartformdataAdditionalMetadataBoxedString](#multipartformdataadditionalmetadataboxedstring) + +sealed interface that stores validated payloads using boxed classes + +## MultipartformdataAdditionalMetadataBoxedString +public record MultipartformdataAdditionalMetadataBoxedString
+implements [MultipartformdataAdditionalMetadataBoxed](#multipartformdataadditionalmetadataboxed) + +record that stores validated String payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| MultipartformdataAdditionalMetadataBoxedString(String data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| String | data()
validated payload | +| @Nullable Object | getData()
validated payload | + +## MultipartformdataAdditionalMetadata +public static class MultipartformdataAdditionalMetadata
+extends StringJsonSchema.StringJsonSchema1 + +A schema class that validates payloads + +## Description +Additional data to pass to server + +| Methods Inherited from class org.openapijsonschematools.client.schemas.StringJsonSchema.StringJsonSchema1 | +| ------------------------------------------------------------------ | +| validate | +| validateAndBox | diff --git a/samples/client/petstore/kotlin/docs/paths/petpetiduploadimage/post/responses/PetpetiduploadimagePostCode200Response.md b/samples/client/petstore/kotlin/docs/paths/petpetiduploadimage/post/responses/PetpetiduploadimagePostCode200Response.md new file mode 100644 index 00000000000..0be7cd47d32 --- /dev/null +++ b/samples/client/petstore/kotlin/docs/paths/petpetiduploadimage/post/responses/PetpetiduploadimagePostCode200Response.md @@ -0,0 +1,17 @@ +# PetpetiduploadimagePostCode200Response + +public class PetpetiduploadimagePostCode200Response extends [SuccessWithJsonApiResponse](../../components/responses/SuccessWithJsonApiResponse.md) + +A class (extended from the $ref class) that contains necessary nested response classes +- a class that extends ResponseDeserializer and is used to deserialize responses + +## Nested Class Summary +| Modifier and Type | Class and Description | +| ----------------- | --------------------- | +| static class | [PetpetiduploadimagePostCode200Response.PetpetiduploadimagePostCode200Response1](#petpetiduploadimagepostcode200response1)
class that deserializes responses | + +## PetpetiduploadimagePostCode200Response1 +public static class PetpetiduploadimagePostCode200Response1 extends [SuccessWithJsonApiResponse1](../../components/responses/SuccessWithJsonApiResponse.md#successwithjsonapiresponse1)
+ +a class that deserializes responses, extended from the $ref class + diff --git a/samples/client/petstore/kotlin/docs/paths/petpetiduploadimage/post/security/PetpetiduploadimagePostSecurityRequirementObject0.md b/samples/client/petstore/kotlin/docs/paths/petpetiduploadimage/post/security/PetpetiduploadimagePostSecurityRequirementObject0.md new file mode 100644 index 00000000000..adb3502a449 --- /dev/null +++ b/samples/client/petstore/kotlin/docs/paths/petpetiduploadimage/post/security/PetpetiduploadimagePostSecurityRequirementObject0.md @@ -0,0 +1,15 @@ +# PetpetiduploadimagePostSecurityRequirementObject0 +PetpetiduploadimagePostSecurityRequirementObject0.java + +public class PetpetiduploadimagePostSecurityRequirementObject0 +extends SecurityRequirementObject + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| PetpetiduploadimagePostSecurityRequirementObject0()
Creates an instance | + +### 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")
    )) | diff --git a/samples/client/petstore/kotlin/docs/paths/solidus/SolidusGet.md b/samples/client/petstore/kotlin/docs/paths/solidus/SolidusGet.md new file mode 100644 index 00000000000..3d689bca199 --- /dev/null +++ b/samples/client/petstore/kotlin/docs/paths/solidus/SolidusGet.md @@ -0,0 +1,142 @@ +# SolidusGet + +public class SolidusGet + +A class that contains necessary endpoint classes +- a class that calls the endpoint method using the http verb +- a class that calls the endpoint method using the operationId name +- class(es) to store the request inputs +- builder(s) to set the request input data + +## Nested Class Summary +| Modifier and Type | Class and Description | +| ----------------- | --------------------- | +| static class | [Get](#get)
The class that has a get method to call the endpoint | +| interface | [SlashRouteOperation](#slashrouteoperation)
The interface that has a slashRoute method to call the endpoint | +| static class | [GetRequest](#getrequest)
The request inputs class | +| static class | [GetRequestBuilder](#getrequestbuilder)
A builder for the request input class | + +## Get +public static class Get extends ApiClient.ApiClient1 implements GetOperation
+ +a class that allows one to call the endpoint using a method named get + +### 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.servers.RootServer0; +import org.openapijsonschematools.client.servers.RootServer1; +import org.openapijsonschematools.client.servers.RootServer2; +import org.openapijsonschematools.client.paths.solidus.get.responses.SolidusGetCode200Response; +import org.openapijsonschematools.client.servers.RootServerInfo; +import org.openapijsonschematools.client.paths.solidus.SolidusGet; +import org.openapijsonschematools.client.paths.solidus.get.SolidusGetResponses; + +import java.io.IOException; +import java.util.Arrays; +import java.util.List; +import java.util.Map; +import java.util.AbstractMap; + +// if you want to use a server that is not SERVER_0 pass it in here and change the ServerIndex input below +ApiConfiguration.ServerInfo serverInfo = new ApiConfiguration.ServerInfoBuilder() + .rootServerInfo( + new RootServerInfo.RootServerInfoBuilder() + .rootServer0(new RootServer0()) + .build() + ) + .build(); +ApiConfiguration.ServerIndexInfo serverIndexInfo = new ApiConfiguration.ServerIndexInfoBuilder() + .rootServerInfoServerIndex(RootServerInfo.ServerIndex.SERVER_0) + .build(); +Duration timeout = Duration.ofSeconds(1L); +Map> defaultHeaders = Map.of("User-Agent", List.of("OpenAPI-JSON-Schema-Generator/1.0.0/java")); +ApiConfiguration apiConfiguration = new ApiConfiguration( + serverInfo + serverIndexInfo, + timeout, + defaultHeaders +); +SchemaConfiguration schemaConfiguration = new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().build()); +SolidusGet.Get apiClient = new SolidusGet.Get(apiConfiguration, schemaConfiguration); + + +var request = new SolidusGet.GetRequestBuilder().build(); + +SolidusGetResponses.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; +} +SolidusGetResponses.EndpointSolidusGetCode200Response castResponse = (SolidusGetResponses.EndpointSolidusGetCode200Response) response; +``` +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| Get(ApiConfiguration apiConfiguration, SchemaConfiguration schemaConfiguration)
Creates an instance | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| [SolidusGetResponses.EndpointResponse](../../paths/solidus/get/SolidusGetResponses.md#endpointresponse) | get([GetRequest](#getrequest) request) | + +## SlashRouteOperation +public interface SlashRouteOperation
+ +an interface that allows one to call the endpoint using a method named slashRoute by the operationId + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| [SolidusGetResponses.EndpointResponse](../../paths/solidus/get/SolidusGetResponses.md#endpointresponse) | slashRoute([GetRequest](#getrequest) request) | + +## GetRequest +public static class GetRequest
+ +a class that stores the final request inputs + +### Field Summary +| Modifier and Type | Field and Description | +| ----------------- | --------------------- | +| [RootServerInfo.@Nullable ServerIndex](../../RootServerInfo.md#serverindex) | serverIndex
optional. Note: this will override the value in apiConfiguration | +| @Nullable Duration | timeout
optional. Note: this will override the value in apiConfiguration | + +## GetRequestBuilder +public static class GetRequestBuilder
+ +a builder for request inputs + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| GetRequestBuilder()
Creates a builder that contains null for all parameters | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| [GetRequest](#getrequest) | build()
Returns the request input used to call an endpoint method | +| [GetRequestBuilder](#getrequestbuilder) | serverIndex([RootServerInfo.ServerIndex](../../RootServerInfo.md#serverindex) serverIndex)
sets the optional property. Note: this will override the value in apiConfiguration | +| [GetRequestBuilder](#getrequestbuilder) | timeout(Duration timeout)
sets the optional property. Note: this will override the value in apiConfiguration | + +[[Back to top]](#top) [[Back to README]](../../../README.md) diff --git a/samples/client/petstore/kotlin/docs/paths/solidus/get/SolidusGetResponses.md b/samples/client/petstore/kotlin/docs/paths/solidus/get/SolidusGetResponses.md new file mode 100644 index 00000000000..2d87b4e42f2 --- /dev/null +++ b/samples/client/petstore/kotlin/docs/paths/solidus/get/SolidusGetResponses.md @@ -0,0 +1,29 @@ +# SolidusGetResponses + +public class SolidusGetResponses + +A class that contains necessary responses classes +- a sealed interface, EndpointResponse, that stores endpoint responses +- records for each endpoint response + +## Nested Class Summary +| Modifier and Type | Class and Description | +| ----------------- | --------------------- | +| sealed interface | [EndpointResponse](#endpointresponse)
stores the endpoint responses | +| record | [EndpointSolidusGetCode200Response](#endpointsolidusgetcode200response)
the response for 200 | + +## EndpointResponse +public sealed interface EndpointResponse permits
+[EndpointSolidusGetCode200Response](#endpointsolidusgetcode200response) + +a sealed interface that stores endpoint responses + +## EndpointSolidusGetCode200Response +public record EndpointSolidusGetCode200Response( + HttpResponse response, + Nothing? body, + Nothing? headers +) implements EndpointResponse, ApiResponse
+ +a class that stores an endpoint response + diff --git a/samples/client/petstore/kotlin/docs/paths/solidus/get/responses/SolidusGetCode200Response.md b/samples/client/petstore/kotlin/docs/paths/solidus/get/responses/SolidusGetCode200Response.md new file mode 100644 index 00000000000..e00fe1ece0e --- /dev/null +++ b/samples/client/petstore/kotlin/docs/paths/solidus/get/responses/SolidusGetCode200Response.md @@ -0,0 +1,17 @@ +# SolidusGetCode200Response + +public class SolidusGetCode200Response extends [SuccessDescriptionOnly](../../components/responses/SuccessDescriptionOnly.md) + +A class (extended from the $ref class) that contains necessary nested response classes +- a class that extends ResponseDeserializer and is used to deserialize responses + +## Nested Class Summary +| Modifier and Type | Class and Description | +| ----------------- | --------------------- | +| static class | [SolidusGetCode200Response.SolidusGetCode200Response1](#solidusgetcode200response1)
class that deserializes responses | + +## SolidusGetCode200Response1 +public static class SolidusGetCode200Response1 extends [SuccessDescriptionOnly1](../../components/responses/SuccessDescriptionOnly.md#successdescriptiononly1)
+ +a class that deserializes responses, extended from the $ref class + diff --git a/samples/client/petstore/kotlin/docs/paths/storeinventory/StoreinventoryGet.md b/samples/client/petstore/kotlin/docs/paths/storeinventory/StoreinventoryGet.md new file mode 100644 index 00000000000..3ae46788229 --- /dev/null +++ b/samples/client/petstore/kotlin/docs/paths/storeinventory/StoreinventoryGet.md @@ -0,0 +1,158 @@ +# StoreinventoryGet + +public class StoreinventoryGet + +A class that contains necessary endpoint classes +- a class that calls the endpoint method using the http verb +- a class that calls the endpoint method using the operationId name +- class(es) to store the request inputs +- builder(s) to set the request input data + +## Nested Class Summary +| Modifier and Type | Class and Description | +| ----------------- | --------------------- | +| static class | [Get](#get)
The class that has a get method to call the endpoint | +| interface | [GetInventoryOperation](#getinventoryoperation)
The interface that has a getInventory method to call the endpoint | +| static class | [GetRequest](#getrequest)
The request inputs class | +| static class | [GetRequestBuilder](#getrequestbuilder)
A builder for the request input class | + +## Get +public static class Get extends ApiClient.ApiClient1 implements GetOperation
+ +a class that allows one to call the endpoint using a method named get + +### 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.storeinventory.get.StoreinventoryGetSecurityInfo; +import org.openapijsonschematools.client.servers.RootServer0; +import org.openapijsonschematools.client.servers.RootServer1; +import org.openapijsonschematools.client.servers.RootServer2; +import org.openapijsonschematools.client.securityschemes.SecurityScheme; +import org.openapijsonschematools.client.components.securityschemes.ApiKey; +import org.openapijsonschematools.client.paths.storeinventory.get.responses.StoreinventoryGetCode200Response; +import org.openapijsonschematools.client.components.responses.successinlinecontentandheader.SuccessInlineContentAndHeaderHeadersSchema; +import org.openapijsonschematools.client.servers.RootServerInfo; +import org.openapijsonschematools.client.paths.storeinventory.StoreinventoryGet; +import org.openapijsonschematools.client.paths.storeinventory.get.StoreinventoryGetResponses; + +import java.io.IOException; +import java.util.Arrays; +import java.util.List; +import java.util.Map; +import java.util.AbstractMap; + +// if you want to use a server that is not SERVER_0 pass it in here and change the ServerIndex input below +ApiConfiguration.ServerInfo serverInfo = new ApiConfiguration.ServerInfoBuilder() + .rootServerInfo( + new RootServerInfo.RootServerInfoBuilder() + .rootServer0(new RootServer0()) + .build() + ) + .build(); +ApiConfiguration.ServerIndexInfo serverIndexInfo = new ApiConfiguration.ServerIndexInfoBuilder() + .rootServerInfoServerIndex(RootServerInfo.ServerIndex.SERVER_0) + .build(); +List securitySchemes = new ArrayList(); +securitySchemes.add( + new ApiKey("someApiKey"); +); +ApiConfiguration.SecurityIndexInfo securityIndexInfo = new ApiConfiguration.SecurityIndexInfoBuilder() + .storeinventoryGetSecurityRequirementObject0SecurityIndex(StoreinventoryGetSecurityRequirementObject0.SecurityIndex.SECURITY_0) + .build(); +Duration timeout = Duration.ofSeconds(1L); +Map> defaultHeaders = Map.of("User-Agent", List.of("OpenAPI-JSON-Schema-Generator/1.0.0/java")); +ApiConfiguration apiConfiguration = new ApiConfiguration( + serverInfo + serverIndexInfo, + securitySchemes, + securityIndexInfo, + timeout, + defaultHeaders +); +SchemaConfiguration schemaConfiguration = new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().build()); +StoreinventoryGet.Get apiClient = new StoreinventoryGet.Get(apiConfiguration, schemaConfiguration); + + +var request = new StoreinventoryGet.GetRequestBuilder().build(); + +StoreinventoryGetResponses.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; +} +StoreinventoryGetResponses.EndpointStoreinventoryGetCode200Response castResponse = (StoreinventoryGetResponses.EndpointStoreinventoryGetCode200Response) response; +} +``` +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| Get(ApiConfiguration apiConfiguration, SchemaConfiguration schemaConfiguration)
Creates an instance | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| [StoreinventoryGetResponses.EndpointResponse](../../paths/storeinventory/get/StoreinventoryGetResponses.md#endpointresponse) | get([GetRequest](#getrequest) request) | + +## GetInventoryOperation +public interface GetInventoryOperation
+ +an interface that allows one to call the endpoint using a method named getInventory by the operationId + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| [StoreinventoryGetResponses.EndpointResponse](../../paths/storeinventory/get/StoreinventoryGetResponses.md#endpointresponse) | getInventory([GetRequest](#getrequest) request) | + +## GetRequest +public static class GetRequest
+ +a class that stores the final request inputs + +### Field Summary +| Modifier and Type | Field and Description | +| ----------------- | --------------------- | +| [RootServerInfo.@Nullable ServerIndex](../../RootServerInfo.md#serverindex) | serverIndex
optional. Note: this will override the value in apiConfiguration | +| [StoreinventoryGetSecurityInfo.@Nullable SecurityIndex](../../paths/storeinventory/get/StoreinventoryGetSecurityInfo.md#securityindex) | securityIndex
optional. Note: this will override the value in apiConfiguration | +| @Nullable Duration | timeout
optional. Note: this will override the value in apiConfiguration | + +## GetRequestBuilder +public static class GetRequestBuilder
+ +a builder for request inputs + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| GetRequestBuilder()
Creates a builder that contains null for all parameters | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| [GetRequest](#getrequest) | build()
Returns the request input used to call an endpoint method | +| [GetRequestBuilder](#getrequestbuilder) | serverIndex([RootServerInfo.ServerIndex](../../RootServerInfo.md#serverindex) serverIndex)
sets the optional property. Note: this will override the value in apiConfiguration | +| [GetRequestBuilder](#getrequestbuilder) | securityIndex([StoreinventoryGetSecurityInfo.SecurityIndex](../../paths/storeinventory/get/StoreinventoryGetSecurityInfo.md#securityindex) securityIndex)
sets the optional property. Note: this will override the value in apiConfiguration | +| [GetRequestBuilder](#getrequestbuilder) | timeout(Duration timeout)
sets the optional property. Note: this will override the value in apiConfiguration | + +[[Back to top]](#top) [[Back to README]](../../../README.md) diff --git a/samples/client/petstore/kotlin/docs/paths/storeinventory/get/StoreinventoryGetResponses.md b/samples/client/petstore/kotlin/docs/paths/storeinventory/get/StoreinventoryGetResponses.md new file mode 100644 index 00000000000..9f064be5958 --- /dev/null +++ b/samples/client/petstore/kotlin/docs/paths/storeinventory/get/StoreinventoryGetResponses.md @@ -0,0 +1,29 @@ +# StoreinventoryGetResponses + +public class StoreinventoryGetResponses + +A class that contains necessary responses classes +- a sealed interface, EndpointResponse, that stores endpoint responses +- records for each endpoint response + +## Nested Class Summary +| Modifier and Type | Class and Description | +| ----------------- | --------------------- | +| sealed interface | [EndpointResponse](#endpointresponse)
stores the endpoint responses | +| record | [EndpointStoreinventoryGetCode200Response](#endpointstoreinventorygetcode200response)
the response for 200 | + +## EndpointResponse +public sealed interface EndpointResponse permits
+[EndpointStoreinventoryGetCode200Response](#endpointstoreinventorygetcode200response) + +a sealed interface that stores endpoint responses + +## EndpointStoreinventoryGetCode200Response +public record EndpointStoreinventoryGetCode200Response( + HttpResponse response, + [StoreinventoryGetCode200Response.SealedResponseBody](../../../paths/storeinventory/get/responses/StoreinventoryGetCode200Response.md#sealedresponsebody) body, + [SuccessInlineContentAndHeaderHeadersSchema.SuccessInlineContentAndHeaderHeadersSchemaMap](../../../components/responses/successinlinecontentandheader/SuccessInlineContentAndHeaderHeadersSchema.md#successinlinecontentandheaderheadersschemamap) headers +) implements EndpointResponse, ApiResponse
+ +a class that stores an endpoint response + diff --git a/samples/client/petstore/kotlin/docs/paths/storeinventory/get/StoreinventoryGetSecurityInfo.md b/samples/client/petstore/kotlin/docs/paths/storeinventory/get/StoreinventoryGetSecurityInfo.md new file mode 100644 index 00000000000..2f5f07f0f26 --- /dev/null +++ b/samples/client/petstore/kotlin/docs/paths/storeinventory/get/StoreinventoryGetSecurityInfo.md @@ -0,0 +1,40 @@ +# StoreinventoryGetSecurityInfo +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 +- an enum class that describes security index values + +## Nested Class Summary +| Modifier and Type | Class and Description | +| ----------------- | --------------------- | +| static class | [StoreinventoryGetSecurityInfo.StoreinventoryGetSecurityInfo1](#storeinventorygetsecurityinfo1)
SecurityRequirementObjectProvider +| enum | [StoreinventoryGetSecurityInfo.SecurityIndex](#securityindex)
class that stores a security index | + +## StoreinventoryGetSecurityInfo1 +implements SecurityRequirementObjectProvider<[SecurityIndex](#securityindex)> + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| StoreinventoryGetSecurityInfo1()
Creates an instance | + +### Field Summary +| Modifier and Type | Field and Description | +| ----------------- | --------------------- | +| [StoreinventoryGetSecurityRequirementObject0](../../../paths/storeinventory/get/security/StoreinventoryGetSecurityRequirementObject0.md) | security0 | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| SecurityRequirementObject | getSecurityRequirementObject(@Nullable [SecurityIndex](#securityindex) securityIndex)
If null is input, then the instance's securityIndex will be used | + +## SecurityIndex +enum SecurityIndex
+ +### Enum Constant Summary +| Enum Constant And Description | +| ----------------------------- | +| SECURITY_0
security 0 | diff --git a/samples/client/petstore/kotlin/docs/paths/storeinventory/get/responses/StoreinventoryGetCode200Response.md b/samples/client/petstore/kotlin/docs/paths/storeinventory/get/responses/StoreinventoryGetCode200Response.md new file mode 100644 index 00000000000..969b8dc35f3 --- /dev/null +++ b/samples/client/petstore/kotlin/docs/paths/storeinventory/get/responses/StoreinventoryGetCode200Response.md @@ -0,0 +1,17 @@ +# StoreinventoryGetCode200Response + +public class StoreinventoryGetCode200Response extends [SuccessInlineContentAndHeader](../../components/responses/SuccessInlineContentAndHeader.md) + +A class (extended from the $ref class) that contains necessary nested response classes +- a class that extends ResponseDeserializer and is used to deserialize responses + +## Nested Class Summary +| Modifier and Type | Class and Description | +| ----------------- | --------------------- | +| static class | [StoreinventoryGetCode200Response.StoreinventoryGetCode200Response1](#storeinventorygetcode200response1)
class that deserializes responses | + +## StoreinventoryGetCode200Response1 +public static class StoreinventoryGetCode200Response1 extends [SuccessInlineContentAndHeader1](../../components/responses/SuccessInlineContentAndHeader.md#successinlinecontentandheader1)
+ +a class that deserializes responses, extended from the $ref class + diff --git a/samples/client/petstore/kotlin/docs/paths/storeinventory/get/security/StoreinventoryGetSecurityRequirementObject0.md b/samples/client/petstore/kotlin/docs/paths/storeinventory/get/security/StoreinventoryGetSecurityRequirementObject0.md new file mode 100644 index 00000000000..d979d8cb08c --- /dev/null +++ b/samples/client/petstore/kotlin/docs/paths/storeinventory/get/security/StoreinventoryGetSecurityRequirementObject0.md @@ -0,0 +1,15 @@ +# StoreinventoryGetSecurityRequirementObject0 +StoreinventoryGetSecurityRequirementObject0.java + +public class StoreinventoryGetSecurityRequirementObject0 +extends SecurityRequirementObject + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| StoreinventoryGetSecurityRequirementObject0()
Creates an instance | + +### 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()
    )) | diff --git a/samples/client/petstore/kotlin/docs/paths/storeorder/StoreorderPost.md b/samples/client/petstore/kotlin/docs/paths/storeorder/StoreorderPost.md new file mode 100644 index 00000000000..220d4837c94 --- /dev/null +++ b/samples/client/petstore/kotlin/docs/paths/storeorder/StoreorderPost.md @@ -0,0 +1,206 @@ +# StoreorderPost + +public class StoreorderPost + +A class that contains necessary endpoint classes +- a class that calls the endpoint method using the http verb +- a class that calls the endpoint method using the operationId name +- class(es) to store the request inputs +- builder(s) to set the request input data + +## Nested Class Summary +| Modifier and Type | Class and Description | +| ----------------- | --------------------- | +| static class | [Post](#post)
The class that has a post method to call the endpoint | +| interface | [PlaceOrderOperation](#placeorderoperation)
The interface that has a placeOrder method to call the endpoint | +| static class | [PostRequest](#postrequest)
The final request inputs class | +| static class | [PostNullableRequest](#postnullablerequest)
The initial request inputs class | +| static class | [Post0RequestBuilder](#post0requestbuilder)
A builder for the request input class | +| static class | [PostRequestBuilder](#postrequestbuilder)
A builder for the request input class | + +## Post +public static class Post 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.StoreorderPostRequestBody; +import org.openapijsonschematools.client.components.schemas.Order; +import org.openapijsonschematools.client.servers.RootServer0; +import org.openapijsonschematools.client.servers.RootServer1; +import org.openapijsonschematools.client.servers.RootServer2; +import org.openapijsonschematools.client.paths.storeorder.post.responses.StoreorderPostCode200Response; +import org.openapijsonschematools.client.paths.storeorder.post.responses.StoreorderPostCode400Response; +import org.openapijsonschematools.client.servers.RootServerInfo; +import org.openapijsonschematools.client.paths.storeorder.StoreorderPost; +import org.openapijsonschematools.client.paths.storeorder.post.StoreorderPostResponses; + +import java.io.IOException; +import java.util.Arrays; +import java.util.List; +import java.util.Map; +import java.util.AbstractMap; + +// if you want to use a server that is not SERVER_0 pass it in here and change the ServerIndex input below +ApiConfiguration.ServerInfo serverInfo = new ApiConfiguration.ServerInfoBuilder() + .rootServerInfo( + new RootServerInfo.RootServerInfoBuilder() + .rootServer0(new RootServer0()) + .build() + ) + .build(); +ApiConfiguration.ServerIndexInfo serverIndexInfo = new ApiConfiguration.ServerIndexInfoBuilder() + .rootServerInfoServerIndex(RootServerInfo.ServerIndex.SERVER_0) + .build(); +Duration timeout = Duration.ofSeconds(1L); +Map> defaultHeaders = Map.of("User-Agent", List.of("OpenAPI-JSON-Schema-Generator/1.0.0/java")); +ApiConfiguration apiConfiguration = new ApiConfiguration( + serverInfo + serverIndexInfo, + timeout, + defaultHeaders +); +SchemaConfiguration schemaConfiguration = new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().build()); +StoreorderPost.Post apiClient = new StoreorderPost.Post(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 +); +StoreorderPost.SealedRequestBody requestBody = new StoreorderPost.ApplicationjsonRequestBody(requestBodyPayload); + +var request = new StoreorderPost.PostRequestBuilder() + .requestBody(requestBody) + .build(); + +StoreorderPostResponses.EndpointResponse response; +try { + response = apiClient.post(request); +} catch (StoreorderPostCode400Response.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; +} +StoreorderPostResponses.EndpointStoreorderPostCode200Response castResponse = (StoreorderPostResponses.EndpointStoreorderPostCode200Response) response; +if (castResponse.body instanceof StoreorderPostCode200Response.ApplicationxmlResponseBody deserializedBody) { + // handle deserialized body here +} else { + StoreorderPostCode200Response.ApplicationjsonResponseBody deserializedBody = (StoreorderPostCode200Response.ApplicationjsonResponseBody) castResponse.body; + // handle deserialized body here +} +``` +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| Post(ApiConfiguration apiConfiguration, SchemaConfiguration schemaConfiguration)
Creates an instance | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| [StoreorderPostResponses.EndpointResponse](../../paths/storeorder/post/StoreorderPostResponses.md#endpointresponse) | post([PostRequest](#postrequest) request) | + +## PlaceOrderOperation +public interface PlaceOrderOperation
+ +an interface that allows one to call the endpoint using a method named placeOrder by the operationId + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| [StoreorderPostResponses.EndpointResponse](../../paths/storeorder/post/StoreorderPostResponses.md#endpointresponse) | placeOrder([PostRequest](#postrequest) request) | + +## PostRequest +public static class PostRequest
+ +a class that stores the final request inputs + +### Field Summary +| Modifier and Type | Field and Description | +| ----------------- | --------------------- | +| [StoreorderPostRequestBody.SealedRequestBody](../../paths/storeorder/post/StoreorderPostRequestBody.md#sealedrequestbody) | requestBody | +| [RootServerInfo.@Nullable ServerIndex](../../RootServerInfo.md#serverindex) | serverIndex
optional. Note: this will override the value in apiConfiguration | +| @Nullable Duration | timeout
optional. Note: this will override the value in apiConfiguration | + +## PostNullableRequest +public static class PostNullableRequest
+ +a class that stores the initial request inputs + +### Field Summary +| Modifier and Type | Field and Description | +| ----------------- | --------------------- | +| [StoreorderPostRequestBody.@Nullable SealedRequestBody](../../paths/storeorder/post/StoreorderPostRequestBody.md#sealedrequestbody) | requestBody | +| [RootServerInfo.@Nullable ServerIndex](../../RootServerInfo.md#serverindex) | serverIndex | +| @Nullable Duration | timeout | + +## Post0RequestBuilder +public static class Post0RequestBuilder
+ +a builder for request inputs + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| Post0RequestBuilder(Post0RequestBuilder instance)
Creates a builder that contains the passed instance | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| [PostRequest](#postrequest) | build()
Returns the request input used to call an endpoint method | +| [Post0RequestBuilder](#post0requestbuilder) | serverIndex([RootServerInfo.ServerIndex](../../RootServerInfo.md#serverindex) serverIndex)
sets the optional property. Note: this will override the value in apiConfiguration | +| [Post0RequestBuilder](#post0requestbuilder) | timeout(Duration timeout)
sets the optional property. Note: this will override the value in apiConfiguration | + +## PostRequestBuilder +public static class PostRequestBuilder
+ +a builder for request inputs + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| PostRequestBuilder()
Creates a builder that contains null for all parameters | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| [Post0RequestBuilder](#post0requestbuilder) | requestBody([StoreorderPostRequestBody.SealedRequestBody](../../paths/storeorder/post/StoreorderPostRequestBody.md#sealedrequestbody) requestBody)
sets the property | + +[[Back to top]](#top) [[Back to README]](../../../README.md) diff --git a/samples/client/petstore/kotlin/docs/paths/storeorder/post/StoreorderPostRequestBody.md b/samples/client/petstore/kotlin/docs/paths/storeorder/post/StoreorderPostRequestBody.md new file mode 100644 index 00000000000..dedc13741f6 --- /dev/null +++ b/samples/client/petstore/kotlin/docs/paths/storeorder/post/StoreorderPostRequestBody.md @@ -0,0 +1,90 @@ +# StoreorderPostRequestBody + +public class StoreorderPostRequestBody + +A class that contains necessary nested request body classes +- SealedMediaType, a sealed interface which contains all the schema/encoding info for each contentType +- records which implement SealedMediaType, the concrete media types +- a class that extends RequestBodySerializer and is used to serialize input SealedRequestBody instances +- SealedRequestBody, a sealed interface which contains all the contentType/schema input types +- records which implement SealedRequestBody, the concrete request body types + +## Nested Class Summary +| Modifier and Type | Class and Description | +| ----------------- | --------------------- | +| sealed interface | [StoreorderPostRequestBody.SealedMediaType](#sealedmediatype)
media type sealed interface | +| record | [StoreorderPostRequestBody.ApplicationjsonMediaType](#applicationjsonmediatype)
record storing schema + encoding for a specific contentType | +| static class | [StoreorderPostRequestBody.StoreorderPostRequestBody1](#storeorderpostrequestbody1)
class that serializes request bodies | +| sealed interface | [StoreorderPostRequestBody.SealedRequestBody](#sealedrequestbody)
request body sealed interface | +| record | [StoreorderPostRequestBody.ApplicationjsonRequestBody](#applicationjsonrequestbody)
implements sealed interface to store request body input | + +## SealedMediaType +public sealed interface SealedMediaType
+permits
+[ApplicationjsonMediaType](#applicationjsonmediatype) + +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), Nothing?> + +class storing schema info for a specific contentType + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| ApplicationjsonMediaType()
Creates an instance | + +### 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 | +| Nothing? | encoding()
the encoding info | + +## StoreorderPostRequestBody1 +public static class StoreorderPostRequestBody1
+ +a class that serializes SealedRequestBody request bodies + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| StoreorderPostRequestBody1()
Creates an instance | + +### Field Summary +| Modifier and Type | Field and Description | +| ----------------- | --------------------- | +| boolean | required = true
whether the request body is required | +| 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 | +| ----------------- | ---------------------- | +| SerializedRequestBody | serialize([SealedRequestBody](#sealedrequestbody) requestBody)
called by endpoint when creating request body bytes | + +## SealedRequestBody +public sealed interface SealedRequestBody
+permits
+[ApplicationjsonRequestBody](#applicationjsonrequestbody) + +sealed interface that stores request contentType + validated schema data + +## ApplicationjsonRequestBody +public record ApplicationjsonRequestBody
+implements [SealedRequestBody](#sealedrequestbody),
+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 | + +### 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 | diff --git a/samples/client/petstore/kotlin/docs/paths/storeorder/post/StoreorderPostResponses.md b/samples/client/petstore/kotlin/docs/paths/storeorder/post/StoreorderPostResponses.md new file mode 100644 index 00000000000..ce063899945 --- /dev/null +++ b/samples/client/petstore/kotlin/docs/paths/storeorder/post/StoreorderPostResponses.md @@ -0,0 +1,29 @@ +# StoreorderPostResponses + +public class StoreorderPostResponses + +A class that contains necessary responses classes +- a sealed interface, EndpointResponse, that stores endpoint responses +- records for each endpoint response + +## Nested Class Summary +| Modifier and Type | Class and Description | +| ----------------- | --------------------- | +| sealed interface | [EndpointResponse](#endpointresponse)
stores the endpoint responses | +| record | [EndpointStoreorderPostCode200Response](#endpointstoreorderpostcode200response)
the response for 200 | + +## EndpointResponse +public sealed interface EndpointResponse permits
+[EndpointStoreorderPostCode200Response](#endpointstoreorderpostcode200response) + +a sealed interface that stores endpoint responses + +## EndpointStoreorderPostCode200Response +public record EndpointStoreorderPostCode200Response( + HttpResponse response, + [StoreorderPostCode200Response.SealedResponseBody](../../../paths/storeorder/post/responses/StoreorderPostCode200Response.md#sealedresponsebody) body, + Nothing? headers +) implements EndpointResponse, ApiResponse
+ +a class that stores an endpoint response + diff --git a/samples/client/petstore/kotlin/docs/paths/storeorder/post/requestbody/content/applicationjson/ApplicationjsonSchema.md b/samples/client/petstore/kotlin/docs/paths/storeorder/post/requestbody/content/applicationjson/ApplicationjsonSchema.md new file mode 100644 index 00000000000..25524457185 --- /dev/null +++ b/samples/client/petstore/kotlin/docs/paths/storeorder/post/requestbody/content/applicationjson/ApplicationjsonSchema.md @@ -0,0 +1,19 @@ +# ApplicationjsonSchema +public class ApplicationjsonSchema
+extends [Order1](../../../../../../components/schemas/Order.md#order) + +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 + +## Nested Class Summary +| Modifier and Type | Class and Description | +| ----------------- | ---------------------- | +| static class | [ApplicationjsonSchema.ApplicationjsonSchema1](#applicationjsonschema1)
schema class | + +## ApplicationjsonSchema1 +public static class ApplicationjsonSchema1
+extends [Order.Order1](../../../../../../components/schemas/Order.md#order1) + +A schema class that validates payloads diff --git a/samples/client/petstore/kotlin/docs/paths/storeorder/post/responses/StoreorderPostCode200Response.md b/samples/client/petstore/kotlin/docs/paths/storeorder/post/responses/StoreorderPostCode200Response.md new file mode 100644 index 00000000000..23e93844e0c --- /dev/null +++ b/samples/client/petstore/kotlin/docs/paths/storeorder/post/responses/StoreorderPostCode200Response.md @@ -0,0 +1,123 @@ +# StoreorderPostCode200Response + +public class StoreorderPostCode200Response + +A class that contains necessary nested response classes +- SealedMediaType, a sealed interface which contains all the schema/encoding info for each contentType +- records which implement SealedMediaType, the concrete media types +- SealedResponseBody, a sealed interface which contains all the contentType/schema types +- records which implement SealedResponseBody, the concrete response body types +- a class that extends ResponseDeserializer and is used to deserialize responses + +## Nested Class Summary +| Modifier and Type | Class and Description | +| ----------------- | --------------------- | +| sealed interface | [StoreorderPostCode200Response.SealedMediaType](#sealedmediatype)
media type sealed interface | +| record | [StoreorderPostCode200Response.ApplicationxmlMediaType](#applicationxmlmediatype)
record storing schema + encoding for a specific contentType | +| record | [StoreorderPostCode200Response.ApplicationjsonMediaType](#applicationjsonmediatype)
record storing schema + encoding for a specific contentType | +| sealed interface | [StoreorderPostCode200Response.SealedResponseBody](#sealedresponsebody)
response body sealed interface | +| record | [StoreorderPostCode200Response.ApplicationxmlResponseBody](#applicationxmlresponsebody)
implements sealed interface to store response body | +| record | [StoreorderPostCode200Response.ApplicationjsonResponseBody](#applicationjsonresponsebody)
implements sealed interface to store response body | +| static class | [StoreorderPostCode200Response.StoreorderPostCode200Response1](#storeorderpostcode200response1)
class that deserializes responses | + +## SealedMediaType +public sealed interface SealedMediaType
+permits
+[ApplicationxmlMediaType](#applicationxmlmediatype), +[ApplicationjsonMediaType](#applicationjsonmediatype) + +sealed interface that stores schema and encoding info + +## ApplicationxmlMediaType +public record ApplicationxmlMediaType
+implements [SealedMediaType](#sealedmediatype), MediaType<[ApplicationxmlSchema.ApplicationxmlSchema1](../../../../paths/storeorder/post/responses/code200response/content/applicationxml/ApplicationxmlSchema.md#applicationxmlschema1), Nothing?> + +class storing schema info for a specific contentType + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| ApplicationxmlMediaType()
Creates an instance | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| [ApplicationxmlSchema.ApplicationxmlSchema1](../../../../paths/storeorder/post/responses/code200response/content/applicationxml/ApplicationxmlSchema.md#applicationxmlschema1) | schema()
the schema for this MediaType | +| Nothing? | encoding()
the encoding info | + +## ApplicationjsonMediaType +public record ApplicationjsonMediaType
+implements [SealedMediaType](#sealedmediatype), MediaType<[ApplicationjsonSchema.ApplicationjsonSchema1](../../../../paths/storeorder/post/responses/code200response/content/applicationjson/ApplicationjsonSchema.md#applicationjsonschema1), Nothing?> + +class storing schema info for a specific contentType + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| ApplicationjsonMediaType()
Creates an instance | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| [ApplicationjsonSchema.ApplicationjsonSchema1](../../../../paths/storeorder/post/responses/code200response/content/applicationjson/ApplicationjsonSchema.md#applicationjsonschema1) | schema()
the schema for this MediaType | +| Nothing? | encoding()
the encoding info | + +## SealedResponseBody +public sealed interface SealedResponseBody
+permits
+[ApplicationxmlResponseBody](#applicationxmlresponsebody), +[ApplicationjsonResponseBody](#applicationjsonresponsebody) + +sealed interface that stores response body + +## ApplicationxmlResponseBody +public record ApplicationxmlResponseBody
+implements [SealedResponseBody](#sealedresponsebody) + +A record class to store response body for contentType="application/xml" + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| ApplicationxmlResponseBody(ApplicationxmlSchema.[Order1Boxed](../../../../components/schemas/Order.md#order1boxed) body)
Creates an instance | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| ApplicationxmlSchema.[Order1Boxed](../../../../components/schemas/Order.md#order1boxed) | body()
returns the body passed in in the constructor | +## ApplicationjsonResponseBody +public record ApplicationjsonResponseBody
+implements [SealedResponseBody](#sealedresponsebody) + +A record class to store response body for contentType="application/json" + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| ApplicationjsonResponseBody(ApplicationjsonSchema.[Order1Boxed](../../../../components/schemas/Order.md#order1boxed) body)
Creates an instance | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| ApplicationjsonSchema.[Order1Boxed](../../../../components/schemas/Order.md#order1boxed) | body()
returns the body passed in in the constructor | + +## StoreorderPostCode200Response1 +public static class StoreorderPostCode200Response1
+extends ResponseDeserializer<[SealedResponseBody](#sealedresponsebody), Nothing?, [SealedMediaType](#sealedmediatype)> + +a class that deserializes responses + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| StoreorderPostCode200Response1()
Creates an instance | + +### Field Summary +| Modifier and Type | Field and Description | +| ----------------- | --------------------- | +| Map | content = Map.ofEntries(
    new AbstractMap.SimpleEntry<>("application/xml", new [ApplicationxmlMediaType](#applicationxmlmediatype)()),
    new AbstractMap.SimpleEntry<>("application/json", new [ApplicationjsonMediaType](#applicationjsonmediatype)())
)
the contentType to schema info | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| ApiResponse<[SealedResponseBody](#sealedresponsebody), Nothing?> | deserialize(HttpResponse response, SchemaConfiguration configuration)
called by endpoint when deserialize responses | diff --git a/samples/client/petstore/kotlin/docs/paths/storeorder/post/responses/StoreorderPostCode400Response.md b/samples/client/petstore/kotlin/docs/paths/storeorder/post/responses/StoreorderPostCode400Response.md new file mode 100644 index 00000000000..28d7dfe5625 --- /dev/null +++ b/samples/client/petstore/kotlin/docs/paths/storeorder/post/responses/StoreorderPostCode400Response.md @@ -0,0 +1,32 @@ +# StoreorderPostCode400Response + +public class StoreorderPostCode400Response + +A class that contains necessary nested response classes +- a class that extends ResponseDeserializer and is used to deserialize responses + +## Nested Class Summary +| Modifier and Type | Class and Description | +| ----------------- | --------------------- | +| static class | [StoreorderPostCode400Response.StoreorderPostCode400Response1](#storeorderpostcode400response1)
class that deserializes responses | + +## StoreorderPostCode400Response1 +public static class StoreorderPostCode400Response1
+extends ResponseDeserializer + +a class that deserializes responses + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| StoreorderPostCode400Response1()
Creates an instance | + +### Field Summary +| Modifier and Type | Field and Description | +| ----------------- | --------------------- | +| Map | content = MapUtils.makeMap(
)
the contentType to schema info | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| ApiResponse | deserialize(HttpResponse response, SchemaConfiguration configuration)
called by endpoint when deserialize responses | diff --git a/samples/client/petstore/kotlin/docs/paths/storeorder/post/responses/code200response/content/applicationjson/ApplicationjsonSchema.md b/samples/client/petstore/kotlin/docs/paths/storeorder/post/responses/code200response/content/applicationjson/ApplicationjsonSchema.md new file mode 100644 index 00000000000..e069f9c21c8 --- /dev/null +++ b/samples/client/petstore/kotlin/docs/paths/storeorder/post/responses/code200response/content/applicationjson/ApplicationjsonSchema.md @@ -0,0 +1,19 @@ +# ApplicationjsonSchema +public class ApplicationjsonSchema
+extends [Order1](../../../../../../../components/schemas/Order.md#order) + +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 + +## Nested Class Summary +| Modifier and Type | Class and Description | +| ----------------- | ---------------------- | +| static class | [ApplicationjsonSchema.ApplicationjsonSchema1](#applicationjsonschema1)
schema class | + +## ApplicationjsonSchema1 +public static class ApplicationjsonSchema1
+extends [Order.Order1](../../../../../../../components/schemas/Order.md#order1) + +A schema class that validates payloads diff --git a/samples/client/petstore/kotlin/docs/paths/storeorder/post/responses/code200response/content/applicationxml/ApplicationxmlSchema.md b/samples/client/petstore/kotlin/docs/paths/storeorder/post/responses/code200response/content/applicationxml/ApplicationxmlSchema.md new file mode 100644 index 00000000000..751649039e1 --- /dev/null +++ b/samples/client/petstore/kotlin/docs/paths/storeorder/post/responses/code200response/content/applicationxml/ApplicationxmlSchema.md @@ -0,0 +1,19 @@ +# ApplicationxmlSchema +public class ApplicationxmlSchema
+extends [Order1](../../../../../../../components/schemas/Order.md#order) + +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 + +## Nested Class Summary +| Modifier and Type | Class and Description | +| ----------------- | ---------------------- | +| static class | [ApplicationxmlSchema.ApplicationxmlSchema1](#applicationxmlschema1)
schema class | + +## ApplicationxmlSchema1 +public static class ApplicationxmlSchema1
+extends [Order.Order1](../../../../../../../components/schemas/Order.md#order1) + +A schema class that validates payloads diff --git a/samples/client/petstore/kotlin/docs/paths/storeorderorderid/StoreorderorderidDelete.md b/samples/client/petstore/kotlin/docs/paths/storeorderorderid/StoreorderorderidDelete.md new file mode 100644 index 00000000000..3af14480c82 --- /dev/null +++ b/samples/client/petstore/kotlin/docs/paths/storeorderorderid/StoreorderorderidDelete.md @@ -0,0 +1,188 @@ +# StoreorderorderidDelete + +public class StoreorderorderidDelete + +A class that contains necessary endpoint classes +- a class that calls the endpoint method using the http verb +- a class that calls the endpoint method using the operationId name +- class(es) to store the request inputs +- builder(s) to set the request input data + +## Nested Class Summary +| Modifier and Type | Class and Description | +| ----------------- | --------------------- | +| static class | [Delete](#delete)
The class that has a delete method to call the endpoint | +| interface | [DeleteOrderOperation](#deleteorderoperation)
The interface that has a deleteOrder method to call the endpoint | +| static class | [DeleteRequest](#deleterequest)
The final request inputs class | +| static class | [DeleteNullableRequest](#deletenullablerequest)
The initial request inputs class | +| static class | [Delete0RequestBuilder](#delete0requestbuilder)
A builder for the request input class | +| static class | [DeleteRequestBuilder](#deleterequestbuilder)
A builder for the request input class | + +## Delete +public static class Delete extends ApiClient.ApiClient1 implements DeleteOperation
+ +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.StoreorderorderidDeletePathParameters; +import org.openapijsonschematools.client.servers.RootServer0; +import org.openapijsonschematools.client.servers.RootServer1; +import org.openapijsonschematools.client.servers.RootServer2; +import org.openapijsonschematools.client.paths.storeorderorderid.delete.responses.StoreorderorderidDeleteCode400Response; +import org.openapijsonschematools.client.paths.storeorderorderid.delete.responses.StoreorderorderidDeleteCode404Response; +import org.openapijsonschematools.client.servers.RootServerInfo; +import org.openapijsonschematools.client.paths.storeorderorderid.StoreorderorderidDelete; +import org.openapijsonschematools.client.paths.storeorderorderid.delete.StoreorderorderidDeleteResponses; + +import java.io.IOException; +import java.util.Arrays; +import java.util.List; +import java.util.Map; +import java.util.AbstractMap; + +// if you want to use a server that is not SERVER_0 pass it in here and change the ServerIndex input below +ApiConfiguration.ServerInfo serverInfo = new ApiConfiguration.ServerInfoBuilder() + .rootServerInfo( + new RootServerInfo.RootServerInfoBuilder() + .rootServer0(new RootServer0()) + .build() + ) + .build(); +ApiConfiguration.ServerIndexInfo serverIndexInfo = new ApiConfiguration.ServerIndexInfoBuilder() + .rootServerInfoServerIndex(RootServerInfo.ServerIndex.SERVER_0) + .build(); +Duration timeout = Duration.ofSeconds(1L); +Map> defaultHeaders = Map.of("User-Agent", List.of("OpenAPI-JSON-Schema-Generator/1.0.0/java")); +ApiConfiguration apiConfiguration = new ApiConfiguration( + serverInfo + serverIndexInfo, + timeout, + defaultHeaders +); +SchemaConfiguration schemaConfiguration = new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().build()); +StoreorderorderidDelete.Delete apiClient = new StoreorderorderidDelete.Delete(apiConfiguration, schemaConfiguration); + + +// Map validation +StoreorderorderidDeletePathParameters.PathParametersMap pathParameters = + StoreorderorderidDeletePathParameters.StoreorderorderidDeletePathParameters1.validate( + new StoreorderorderidDeletePathParameters.PathParametersMapBuilder() + .order_id("a") + + .build(), + schemaConfiguration +); + +var request = new StoreorderorderidDelete.DeleteRequestBuilder() + .pathParameters(pathParameters) + .build(); + +Nothing? response; +try { + response = apiClient.delete(request); +} catch (StoreorderorderidDeleteCode400Response.ResponseApiException | StoreorderorderidDeleteCode404Response.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 | +| --------------------------- | +| Delete(ApiConfiguration apiConfiguration, SchemaConfiguration schemaConfiguration)
Creates an instance | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| Nothing? | delete([DeleteRequest](#deleterequest) request) | + +## DeleteOrderOperation +public interface DeleteOrderOperation
+ +an interface that allows one to call the endpoint using a method named deleteOrder by the operationId + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| Nothing? | deleteOrder([DeleteRequest](#deleterequest) request) | + +## DeleteRequest +public static class DeleteRequest
+ +a class that stores the final request inputs + +### Field Summary +| Modifier and Type | Field and Description | +| ----------------- | --------------------- | +| [StoreorderorderidDeletePathParameters.PathParametersMap](../../paths/storeorderorderid/delete/StoreorderorderidDeletePathParameters.md#pathparametersmap) | pathParameters | +| [RootServerInfo.@Nullable ServerIndex](../../RootServerInfo.md#serverindex) | serverIndex
optional. Note: this will override the value in apiConfiguration | +| @Nullable Duration | timeout
optional. Note: this will override the value in apiConfiguration | + +## DeleteNullableRequest +public static class DeleteNullableRequest
+ +a class that stores the initial request inputs + +### Field Summary +| Modifier and Type | Field and Description | +| ----------------- | --------------------- | +| [StoreorderorderidDeletePathParameters.@Nullable PathParametersMap](../../paths/storeorderorderid/delete/StoreorderorderidDeletePathParameters.md#pathparametersmap) | pathParameters | +| [RootServerInfo.@Nullable ServerIndex](../../RootServerInfo.md#serverindex) | serverIndex | +| @Nullable Duration | timeout | + +## Delete0RequestBuilder +public static class Delete0RequestBuilder
+ +a builder for request inputs + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| Delete0RequestBuilder(Delete0RequestBuilder instance)
Creates a builder that contains the passed instance | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| [DeleteRequest](#deleterequest) | build()
Returns the request input used to call an endpoint method | +| [Delete0RequestBuilder](#delete0requestbuilder) | serverIndex([RootServerInfo.ServerIndex](../../RootServerInfo.md#serverindex) serverIndex)
sets the optional property. Note: this will override the value in apiConfiguration | +| [Delete0RequestBuilder](#delete0requestbuilder) | timeout(Duration timeout)
sets the optional property. Note: this will override the value in apiConfiguration | + +## DeleteRequestBuilder +public static class DeleteRequestBuilder
+ +a builder for request inputs + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| DeleteRequestBuilder()
Creates a builder that contains null for all parameters | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| [Delete0RequestBuilder](#delete0requestbuilder) | pathParameters([StoreorderorderidDeletePathParametersPathParametersMap](../../paths/storeorderorderid/delete/StoreorderorderidDeletePathParameters.md#pathparametersmap) pathParameters)
sets the property | + +[[Back to top]](#top) [[Back to README]](../../../README.md) diff --git a/samples/client/petstore/kotlin/docs/paths/storeorderorderid/StoreorderorderidGet.md b/samples/client/petstore/kotlin/docs/paths/storeorderorderid/StoreorderorderidGet.md new file mode 100644 index 00000000000..2605c3ef410 --- /dev/null +++ b/samples/client/petstore/kotlin/docs/paths/storeorderorderid/StoreorderorderidGet.md @@ -0,0 +1,196 @@ +# StoreorderorderidGet + +public class StoreorderorderidGet + +A class that contains necessary endpoint classes +- a class that calls the endpoint method using the http verb +- a class that calls the endpoint method using the operationId name +- class(es) to store the request inputs +- builder(s) to set the request input data + +## Nested Class Summary +| Modifier and Type | Class and Description | +| ----------------- | --------------------- | +| static class | [Get](#get)
The class that has a get method to call the endpoint | +| interface | [GetOrderByIdOperation](#getorderbyidoperation)
The interface that has a getOrderById method to call the endpoint | +| static class | [GetRequest](#getrequest)
The final request inputs class | +| static class | [GetNullableRequest](#getnullablerequest)
The initial request inputs class | +| static class | [Get0RequestBuilder](#get0requestbuilder)
A builder for the request input class | +| static class | [GetRequestBuilder](#getrequestbuilder)
A builder for the request input class | + +## Get +public static class Get extends ApiClient.ApiClient1 implements GetOperation
+ +a class that allows one to call the endpoint using a method named get + +### 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.get.StoreorderorderidGetPathParameters; +import org.openapijsonschematools.client.servers.RootServer0; +import org.openapijsonschematools.client.servers.RootServer1; +import org.openapijsonschematools.client.servers.RootServer2; +import org.openapijsonschematools.client.paths.storeorderorderid.get.responses.StoreorderorderidGetCode200Response; +import org.openapijsonschematools.client.paths.storeorderorderid.get.responses.StoreorderorderidGetCode400Response; +import org.openapijsonschematools.client.paths.storeorderorderid.get.responses.StoreorderorderidGetCode404Response; +import org.openapijsonschematools.client.servers.RootServerInfo; +import org.openapijsonschematools.client.paths.storeorderorderid.StoreorderorderidGet; +import org.openapijsonschematools.client.paths.storeorderorderid.get.StoreorderorderidGetResponses; + +import java.io.IOException; +import java.util.Arrays; +import java.util.List; +import java.util.Map; +import java.util.AbstractMap; + +// if you want to use a server that is not SERVER_0 pass it in here and change the ServerIndex input below +ApiConfiguration.ServerInfo serverInfo = new ApiConfiguration.ServerInfoBuilder() + .rootServerInfo( + new RootServerInfo.RootServerInfoBuilder() + .rootServer0(new RootServer0()) + .build() + ) + .build(); +ApiConfiguration.ServerIndexInfo serverIndexInfo = new ApiConfiguration.ServerIndexInfoBuilder() + .rootServerInfoServerIndex(RootServerInfo.ServerIndex.SERVER_0) + .build(); +Duration timeout = Duration.ofSeconds(1L); +Map> defaultHeaders = Map.of("User-Agent", List.of("OpenAPI-JSON-Schema-Generator/1.0.0/java")); +ApiConfiguration apiConfiguration = new ApiConfiguration( + serverInfo + serverIndexInfo, + timeout, + defaultHeaders +); +SchemaConfiguration schemaConfiguration = new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().build()); +StoreorderorderidGet.Get apiClient = new StoreorderorderidGet.Get(apiConfiguration, schemaConfiguration); + + +// Map validation +StoreorderorderidGetPathParameters.PathParametersMap pathParameters = + StoreorderorderidGetPathParameters.StoreorderorderidGetPathParameters1.validate( + new StoreorderorderidGetPathParameters.PathParametersMapBuilder() + .order_id(1L) + + .build(), + schemaConfiguration +); + +var request = new StoreorderorderidGet.GetRequestBuilder() + .pathParameters(pathParameters) + .build(); + +StoreorderorderidGetResponses.EndpointResponse response; +try { + response = apiClient.get(request); +} catch (StoreorderorderidGetCode400Response.ResponseApiException | StoreorderorderidGetCode404Response.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; +} +StoreorderorderidGetResponses.EndpointStoreorderorderidGetCode200Response castResponse = (StoreorderorderidGetResponses.EndpointStoreorderorderidGetCode200Response) response; +if (castResponse.body instanceof StoreorderorderidGetCode200Response.ApplicationxmlResponseBody deserializedBody) { + // handle deserialized body here +} else { + StoreorderorderidGetCode200Response.ApplicationjsonResponseBody deserializedBody = (StoreorderorderidGetCode200Response.ApplicationjsonResponseBody) castResponse.body; + // handle deserialized body here +} +``` +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| Get(ApiConfiguration apiConfiguration, SchemaConfiguration schemaConfiguration)
Creates an instance | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| [StoreorderorderidGetResponses.EndpointResponse](../../paths/storeorderorderid/get/StoreorderorderidGetResponses.md#endpointresponse) | get([GetRequest](#getrequest) request) | + +## GetOrderByIdOperation +public interface GetOrderByIdOperation
+ +an interface that allows one to call the endpoint using a method named getOrderById by the operationId + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| [StoreorderorderidGetResponses.EndpointResponse](../../paths/storeorderorderid/get/StoreorderorderidGetResponses.md#endpointresponse) | getOrderById([GetRequest](#getrequest) request) | + +## GetRequest +public static class GetRequest
+ +a class that stores the final request inputs + +### Field Summary +| Modifier and Type | Field and Description | +| ----------------- | --------------------- | +| [StoreorderorderidGetPathParameters.PathParametersMap](../../paths/storeorderorderid/get/StoreorderorderidGetPathParameters.md#pathparametersmap) | pathParameters | +| [RootServerInfo.@Nullable ServerIndex](../../RootServerInfo.md#serverindex) | serverIndex
optional. Note: this will override the value in apiConfiguration | +| @Nullable Duration | timeout
optional. Note: this will override the value in apiConfiguration | + +## GetNullableRequest +public static class GetNullableRequest
+ +a class that stores the initial request inputs + +### Field Summary +| Modifier and Type | Field and Description | +| ----------------- | --------------------- | +| [StoreorderorderidGetPathParameters.@Nullable PathParametersMap](../../paths/storeorderorderid/get/StoreorderorderidGetPathParameters.md#pathparametersmap) | pathParameters | +| [RootServerInfo.@Nullable ServerIndex](../../RootServerInfo.md#serverindex) | serverIndex | +| @Nullable Duration | timeout | + +## Get0RequestBuilder +public static class Get0RequestBuilder
+ +a builder for request inputs + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| Get0RequestBuilder(Get0RequestBuilder instance)
Creates a builder that contains the passed instance | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| [GetRequest](#getrequest) | build()
Returns the request input used to call an endpoint method | +| [Get0RequestBuilder](#get0requestbuilder) | serverIndex([RootServerInfo.ServerIndex](../../RootServerInfo.md#serverindex) serverIndex)
sets the optional property. Note: this will override the value in apiConfiguration | +| [Get0RequestBuilder](#get0requestbuilder) | timeout(Duration timeout)
sets the optional property. Note: this will override the value in apiConfiguration | + +## GetRequestBuilder +public static class GetRequestBuilder
+ +a builder for request inputs + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| GetRequestBuilder()
Creates a builder that contains null for all parameters | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| [Get0RequestBuilder](#get0requestbuilder) | pathParameters([StoreorderorderidGetPathParametersPathParametersMap](../../paths/storeorderorderid/get/StoreorderorderidGetPathParameters.md#pathparametersmap) pathParameters)
sets the property | + +[[Back to top]](#top) [[Back to README]](../../../README.md) diff --git a/samples/client/petstore/kotlin/docs/paths/storeorderorderid/delete/StoreorderorderidDeletePathParameters.md b/samples/client/petstore/kotlin/docs/paths/storeorderorderid/delete/StoreorderorderidDeletePathParameters.md new file mode 100644 index 00000000000..3c27c5e441d --- /dev/null +++ b/samples/client/petstore/kotlin/docs/paths/storeorderorderid/delete/StoreorderorderidDeletePathParameters.md @@ -0,0 +1,268 @@ +# StoreorderorderidDeletePathParameters +public class StoreorderorderidDeletePathParameters
+ +A class that contains necessary nested +- schema classes (which validate payloads), extends JsonSchema +- sealed interfaces which store validated payloads, java version of a sum type +- boxed classes which store validated payloads, sealed permits class implementations +- classes to store validated map payloads, extends FrozenMap +- classes to build inputs for map payloads + +## Nested Class Summary +| Modifier and Type | Class and Description | +| ----------------- | ---------------------- | +| sealed interface | [StoreorderorderidDeletePathParameters.StoreorderorderidDeletePathParameters1Boxed](#storeorderorderiddeletepathparameters1boxed)
sealed interface for validated payloads | +| record | [StoreorderorderidDeletePathParameters.StoreorderorderidDeletePathParameters1BoxedMap](#storeorderorderiddeletepathparameters1boxedmap)
boxed class to store validated Map payloads | +| static class | [StoreorderorderidDeletePathParameters.StoreorderorderidDeletePathParameters1](#storeorderorderiddeletepathparameters1)
schema class | +| static class | [StoreorderorderidDeletePathParameters.PathParametersMapBuilder](#pathparametersmapbuilder)
builder for Map payloads | +| static class | [StoreorderorderidDeletePathParameters.PathParametersMap](#pathparametersmap)
output class for Map payloads | +| sealed interface | [StoreorderorderidDeletePathParameters.AdditionalPropertiesBoxed](#additionalpropertiesboxed)
sealed interface for validated payloads | +| record | [StoreorderorderidDeletePathParameters.AdditionalPropertiesBoxedVoid](#additionalpropertiesboxedvoid)
boxed class to store validated null payloads | +| record | [StoreorderorderidDeletePathParameters.AdditionalPropertiesBoxedBoolean](#additionalpropertiesboxedboolean)
boxed class to store validated boolean payloads | +| record | [StoreorderorderidDeletePathParameters.AdditionalPropertiesBoxedNumber](#additionalpropertiesboxednumber)
boxed class to store validated Number payloads | +| record | [StoreorderorderidDeletePathParameters.AdditionalPropertiesBoxedString](#additionalpropertiesboxedstring)
boxed class to store validated String payloads | +| record | [StoreorderorderidDeletePathParameters.AdditionalPropertiesBoxedList](#additionalpropertiesboxedlist)
boxed class to store validated List payloads | +| record | [StoreorderorderidDeletePathParameters.AdditionalPropertiesBoxedMap](#additionalpropertiesboxedmap)
boxed class to store validated Map payloads | +| static class | [StoreorderorderidDeletePathParameters.AdditionalProperties](#additionalproperties)
schema class | + +## StoreorderorderidDeletePathParameters1Boxed +public sealed interface StoreorderorderidDeletePathParameters1Boxed
+permits
+[StoreorderorderidDeletePathParameters1BoxedMap](#storeorderorderiddeletepathparameters1boxedmap) + +sealed interface that stores validated payloads using boxed classes + +## StoreorderorderidDeletePathParameters1BoxedMap +public record StoreorderorderidDeletePathParameters1BoxedMap
+implements [StoreorderorderidDeletePathParameters1Boxed](#storeorderorderiddeletepathparameters1boxed) + +record that stores validated Map payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| StoreorderorderidDeletePathParameters1BoxedMap([PathParametersMap](#pathparametersmap) data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| [PathParametersMap](#pathparametersmap) | data()
validated payload | +| @Nullable Object | getData()
validated payload | + +## StoreorderorderidDeletePathParameters1 +public static class StoreorderorderidDeletePathParameters1
+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.storeorderorderid.delete.StoreorderorderidDeletePathParameters; + +import java.util.Arrays; +import java.util.List; +import java.util.AbstractMap; + +static final SchemaConfiguration configuration = new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().build()); + +// Map validation +StoreorderorderidDeletePathParameters.PathParametersMap validatedPayload = + StoreorderorderidDeletePathParameters.StoreorderorderidDeletePathParameters1.validate( + new StoreorderorderidDeletePathParameters.PathParametersMapBuilder() + .order_id("a") + + .build(), + configuration +); +``` + +### Field Summary +| Modifier and Type | Field and Description | +| ----------------- | ---------------------- | +| Set> | type = Set.of(Map.class) | +| Map> | properties = Map.ofEntries(
    new PropertyEntry("order_id", [Schema0.Schema01.class](../../../paths/storeorderorderid/delete/parameters/parameter0/Schema0.md#schema01))
)
| +| Set | required = Set.of(
    "order_id"
)
| +| Class | additionalProperties = [AdditionalProperties.class](#additionalproperties) | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| [PathParametersMap](#pathparametersmap) | validate([Map<?, ?>](#pathparametersmapbuilder) arg, SchemaConfiguration configuration) | +| [StoreorderorderidDeletePathParameters1BoxedMap](#storeorderorderiddeletepathparameters1boxedmap) | validateAndBox([Map<?, ?>](#pathparametersmapbuilder) arg, SchemaConfiguration configuration) | +| [StoreorderorderidDeletePathParameters1Boxed](#storeorderorderiddeletepathparameters1boxed) | validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) | +| @Nullable Object | validate(@Nullable Object arg, SchemaConfiguration configuration) | + +## PathParametersMap0Builder +public class PathParametersMap0Builder
+builder for `Map` + +A class that builds the Map input type + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| PathParametersMap0Builder(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 | + +## PathParametersMapBuilder +public class PathParametersMapBuilder
+builder for `Map` + +A class that builds the Map input type + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| PathParametersMapBuilder()
Creates a builder that contains an empty map | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| [PathParametersMap0Builder](#pathparametersmap0builder) | order_id(String value) | + +## PathParametersMap +public static class PathParametersMap
+extends FrozenMap + +A class to store validated Map payloads + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| static [PathParametersMap](#pathparametersmap) | of([Map](#pathparametersmapbuilder) arg, SchemaConfiguration configuration) | +| String | order_id()
| + +## 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(Nothing? data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| Nothing? | 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/kotlin/docs/paths/storeorderorderid/delete/StoreorderorderidDeleteResponses.md b/samples/client/petstore/kotlin/docs/paths/storeorderorderid/delete/StoreorderorderidDeleteResponses.md new file mode 100644 index 00000000000..e4447a09189 --- /dev/null +++ b/samples/client/petstore/kotlin/docs/paths/storeorderorderid/delete/StoreorderorderidDeleteResponses.md @@ -0,0 +1,10 @@ +# StoreorderorderidDeleteResponses + +public class StoreorderorderidDeleteResponses + +A class that contains necessary responses classes + +## Nested Class Summary +| Modifier and Type | Class and Description | +| ----------------- | --------------------- | + diff --git a/samples/client/petstore/kotlin/docs/paths/storeorderorderid/delete/parameters/parameter0/Schema0.md b/samples/client/petstore/kotlin/docs/paths/storeorderorderid/delete/parameters/parameter0/Schema0.md new file mode 100644 index 00000000000..9ff90e0bc35 --- /dev/null +++ b/samples/client/petstore/kotlin/docs/paths/storeorderorderid/delete/parameters/parameter0/Schema0.md @@ -0,0 +1,49 @@ +# Schema0 +public class Schema0
+ +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 + +## Nested Class Summary +| Modifier and Type | Class and Description | +| ----------------- | ---------------------- | +| sealed interface | [Schema0.Schema01Boxed](#schema01boxed)
sealed interface for validated payloads | +| record | [Schema0.Schema01BoxedString](#schema01boxedstring)
boxed class to store validated String payloads | +| static class | [Schema0.Schema01](#schema01)
schema class | + +## Schema01Boxed +public sealed interface Schema01Boxed
+permits
+[Schema01BoxedString](#schema01boxedstring) + +sealed interface that stores validated payloads using boxed classes + +## Schema01BoxedString +public record Schema01BoxedString
+implements [Schema01Boxed](#schema01boxed) + +record that stores validated String payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| Schema01BoxedString(String data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| String | data()
validated payload | +| @Nullable Object | getData()
validated payload | + +## Schema01 +public static class Schema01
+extends StringJsonSchema.StringJsonSchema1 + +A schema class that validates payloads + +| Methods Inherited from class org.openapijsonschematools.client.schemas.StringJsonSchema.StringJsonSchema1 | +| ------------------------------------------------------------------ | +| validate | +| validateAndBox | diff --git a/samples/client/petstore/kotlin/docs/paths/storeorderorderid/delete/responses/StoreorderorderidDeleteCode400Response.md b/samples/client/petstore/kotlin/docs/paths/storeorderorderid/delete/responses/StoreorderorderidDeleteCode400Response.md new file mode 100644 index 00000000000..57c9f648969 --- /dev/null +++ b/samples/client/petstore/kotlin/docs/paths/storeorderorderid/delete/responses/StoreorderorderidDeleteCode400Response.md @@ -0,0 +1,32 @@ +# StoreorderorderidDeleteCode400Response + +public class StoreorderorderidDeleteCode400Response + +A class that contains necessary nested response classes +- a class that extends ResponseDeserializer and is used to deserialize responses + +## Nested Class Summary +| Modifier and Type | Class and Description | +| ----------------- | --------------------- | +| static class | [StoreorderorderidDeleteCode400Response.StoreorderorderidDeleteCode400Response1](#storeorderorderiddeletecode400response1)
class that deserializes responses | + +## StoreorderorderidDeleteCode400Response1 +public static class StoreorderorderidDeleteCode400Response1
+extends ResponseDeserializer + +a class that deserializes responses + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| StoreorderorderidDeleteCode400Response1()
Creates an instance | + +### Field Summary +| Modifier and Type | Field and Description | +| ----------------- | --------------------- | +| Map | content = MapUtils.makeMap(
)
the contentType to schema info | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| ApiResponse | deserialize(HttpResponse response, SchemaConfiguration configuration)
called by endpoint when deserialize responses | diff --git a/samples/client/petstore/kotlin/docs/paths/storeorderorderid/delete/responses/StoreorderorderidDeleteCode404Response.md b/samples/client/petstore/kotlin/docs/paths/storeorderorderid/delete/responses/StoreorderorderidDeleteCode404Response.md new file mode 100644 index 00000000000..c840323d5c4 --- /dev/null +++ b/samples/client/petstore/kotlin/docs/paths/storeorderorderid/delete/responses/StoreorderorderidDeleteCode404Response.md @@ -0,0 +1,32 @@ +# StoreorderorderidDeleteCode404Response + +public class StoreorderorderidDeleteCode404Response + +A class that contains necessary nested response classes +- a class that extends ResponseDeserializer and is used to deserialize responses + +## Nested Class Summary +| Modifier and Type | Class and Description | +| ----------------- | --------------------- | +| static class | [StoreorderorderidDeleteCode404Response.StoreorderorderidDeleteCode404Response1](#storeorderorderiddeletecode404response1)
class that deserializes responses | + +## StoreorderorderidDeleteCode404Response1 +public static class StoreorderorderidDeleteCode404Response1
+extends ResponseDeserializer + +a class that deserializes responses + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| StoreorderorderidDeleteCode404Response1()
Creates an instance | + +### Field Summary +| Modifier and Type | Field and Description | +| ----------------- | --------------------- | +| Map | content = MapUtils.makeMap(
)
the contentType to schema info | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| ApiResponse | deserialize(HttpResponse response, SchemaConfiguration configuration)
called by endpoint when deserialize responses | diff --git a/samples/client/petstore/kotlin/docs/paths/storeorderorderid/get/StoreorderorderidGetPathParameters.md b/samples/client/petstore/kotlin/docs/paths/storeorderorderid/get/StoreorderorderidGetPathParameters.md new file mode 100644 index 00000000000..002e516da27 --- /dev/null +++ b/samples/client/petstore/kotlin/docs/paths/storeorderorderid/get/StoreorderorderidGetPathParameters.md @@ -0,0 +1,271 @@ +# StoreorderorderidGetPathParameters +public class StoreorderorderidGetPathParameters
+ +A class that contains necessary nested +- schema classes (which validate payloads), extends JsonSchema +- sealed interfaces which store validated payloads, java version of a sum type +- boxed classes which store validated payloads, sealed permits class implementations +- classes to store validated map payloads, extends FrozenMap +- classes to build inputs for map payloads + +## Nested Class Summary +| Modifier and Type | Class and Description | +| ----------------- | ---------------------- | +| sealed interface | [StoreorderorderidGetPathParameters.StoreorderorderidGetPathParameters1Boxed](#storeorderorderidgetpathparameters1boxed)
sealed interface for validated payloads | +| record | [StoreorderorderidGetPathParameters.StoreorderorderidGetPathParameters1BoxedMap](#storeorderorderidgetpathparameters1boxedmap)
boxed class to store validated Map payloads | +| static class | [StoreorderorderidGetPathParameters.StoreorderorderidGetPathParameters1](#storeorderorderidgetpathparameters1)
schema class | +| static class | [StoreorderorderidGetPathParameters.PathParametersMapBuilder](#pathparametersmapbuilder)
builder for Map payloads | +| static class | [StoreorderorderidGetPathParameters.PathParametersMap](#pathparametersmap)
output class for Map payloads | +| sealed interface | [StoreorderorderidGetPathParameters.AdditionalPropertiesBoxed](#additionalpropertiesboxed)
sealed interface for validated payloads | +| record | [StoreorderorderidGetPathParameters.AdditionalPropertiesBoxedVoid](#additionalpropertiesboxedvoid)
boxed class to store validated null payloads | +| record | [StoreorderorderidGetPathParameters.AdditionalPropertiesBoxedBoolean](#additionalpropertiesboxedboolean)
boxed class to store validated boolean payloads | +| record | [StoreorderorderidGetPathParameters.AdditionalPropertiesBoxedNumber](#additionalpropertiesboxednumber)
boxed class to store validated Number payloads | +| record | [StoreorderorderidGetPathParameters.AdditionalPropertiesBoxedString](#additionalpropertiesboxedstring)
boxed class to store validated String payloads | +| record | [StoreorderorderidGetPathParameters.AdditionalPropertiesBoxedList](#additionalpropertiesboxedlist)
boxed class to store validated List payloads | +| record | [StoreorderorderidGetPathParameters.AdditionalPropertiesBoxedMap](#additionalpropertiesboxedmap)
boxed class to store validated Map payloads | +| static class | [StoreorderorderidGetPathParameters.AdditionalProperties](#additionalproperties)
schema class | + +## StoreorderorderidGetPathParameters1Boxed +public sealed interface StoreorderorderidGetPathParameters1Boxed
+permits
+[StoreorderorderidGetPathParameters1BoxedMap](#storeorderorderidgetpathparameters1boxedmap) + +sealed interface that stores validated payloads using boxed classes + +## StoreorderorderidGetPathParameters1BoxedMap +public record StoreorderorderidGetPathParameters1BoxedMap
+implements [StoreorderorderidGetPathParameters1Boxed](#storeorderorderidgetpathparameters1boxed) + +record that stores validated Map payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| StoreorderorderidGetPathParameters1BoxedMap([PathParametersMap](#pathparametersmap) data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| [PathParametersMap](#pathparametersmap) | data()
validated payload | +| @Nullable Object | getData()
validated payload | + +## StoreorderorderidGetPathParameters1 +public static class StoreorderorderidGetPathParameters1
+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.storeorderorderid.get.StoreorderorderidGetPathParameters; + +import java.util.Arrays; +import java.util.List; +import java.util.AbstractMap; + +static final SchemaConfiguration configuration = new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().build()); + +// Map validation +StoreorderorderidGetPathParameters.PathParametersMap validatedPayload = + StoreorderorderidGetPathParameters.StoreorderorderidGetPathParameters1.validate( + new StoreorderorderidGetPathParameters.PathParametersMapBuilder() + .order_id(1L) + + .build(), + configuration +); +``` + +### Field Summary +| Modifier and Type | Field and Description | +| ----------------- | ---------------------- | +| Set> | type = Set.of(Map.class) | +| Map> | properties = Map.ofEntries(
    new PropertyEntry("order_id", [Schema0.Schema01.class](../../../paths/storeorderorderid/get/parameters/parameter0/Schema0.md#schema01))
)
| +| Set | required = Set.of(
    "order_id"
)
| +| Class | additionalProperties = [AdditionalProperties.class](#additionalproperties) | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| [PathParametersMap](#pathparametersmap) | validate([Map<?, ?>](#pathparametersmapbuilder) arg, SchemaConfiguration configuration) | +| [StoreorderorderidGetPathParameters1BoxedMap](#storeorderorderidgetpathparameters1boxedmap) | validateAndBox([Map<?, ?>](#pathparametersmapbuilder) arg, SchemaConfiguration configuration) | +| [StoreorderorderidGetPathParameters1Boxed](#storeorderorderidgetpathparameters1boxed) | validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) | +| @Nullable Object | validate(@Nullable Object arg, SchemaConfiguration configuration) | + +## PathParametersMap0Builder +public class PathParametersMap0Builder
+builder for `Map` + +A class that builds the Map input type + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| PathParametersMap0Builder(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 | + +## PathParametersMapBuilder +public class PathParametersMapBuilder
+builder for `Map` + +A class that builds the Map input type + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| PathParametersMapBuilder()
Creates a builder that contains an empty map | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| [PathParametersMap0Builder](#pathparametersmap0builder) | order_id(int value) | +| [PathParametersMap0Builder](#pathparametersmap0builder) | order_id(float value) | +| [PathParametersMap0Builder](#pathparametersmap0builder) | order_id(long value) | +| [PathParametersMap0Builder](#pathparametersmap0builder) | order_id(double value) | + +## PathParametersMap +public static class PathParametersMap
+extends FrozenMap + +A class to store validated Map payloads + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| static [PathParametersMap](#pathparametersmap) | of([Map](#pathparametersmapbuilder) arg, SchemaConfiguration configuration) | +| Number | order_id()
| + +## 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(Nothing? data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| Nothing? | 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/kotlin/docs/paths/storeorderorderid/get/StoreorderorderidGetResponses.md b/samples/client/petstore/kotlin/docs/paths/storeorderorderid/get/StoreorderorderidGetResponses.md new file mode 100644 index 00000000000..e673e2affbc --- /dev/null +++ b/samples/client/petstore/kotlin/docs/paths/storeorderorderid/get/StoreorderorderidGetResponses.md @@ -0,0 +1,29 @@ +# StoreorderorderidGetResponses + +public class StoreorderorderidGetResponses + +A class that contains necessary responses classes +- a sealed interface, EndpointResponse, that stores endpoint responses +- records for each endpoint response + +## Nested Class Summary +| Modifier and Type | Class and Description | +| ----------------- | --------------------- | +| sealed interface | [EndpointResponse](#endpointresponse)
stores the endpoint responses | +| record | [EndpointStoreorderorderidGetCode200Response](#endpointstoreorderorderidgetcode200response)
the response for 200 | + +## EndpointResponse +public sealed interface EndpointResponse permits
+[EndpointStoreorderorderidGetCode200Response](#endpointstoreorderorderidgetcode200response) + +a sealed interface that stores endpoint responses + +## EndpointStoreorderorderidGetCode200Response +public record EndpointStoreorderorderidGetCode200Response( + HttpResponse response, + [StoreorderorderidGetCode200Response.SealedResponseBody](../../../paths/storeorderorderid/get/responses/StoreorderorderidGetCode200Response.md#sealedresponsebody) body, + Nothing? headers +) implements EndpointResponse, ApiResponse
+ +a class that stores an endpoint response + diff --git a/samples/client/petstore/kotlin/docs/paths/storeorderorderid/get/parameters/parameter0/Schema0.md b/samples/client/petstore/kotlin/docs/paths/storeorderorderid/get/parameters/parameter0/Schema0.md new file mode 100644 index 00000000000..d6ff718bbf9 --- /dev/null +++ b/samples/client/petstore/kotlin/docs/paths/storeorderorderid/get/parameters/parameter0/Schema0.md @@ -0,0 +1,83 @@ +# Schema0 +public class Schema0
+ +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 + +## Nested Class Summary +| Modifier and Type | Class and Description | +| ----------------- | ---------------------- | +| sealed interface | [Schema0.Schema01Boxed](#schema01boxed)
sealed interface for validated payloads | +| record | [Schema0.Schema01BoxedNumber](#schema01boxednumber)
boxed class to store validated Number payloads | +| static class | [Schema0.Schema01](#schema01)
schema class | + +## Schema01Boxed +public sealed interface Schema01Boxed
+permits
+[Schema01BoxedNumber](#schema01boxednumber) + +sealed interface that stores validated payloads using boxed classes + +## Schema01BoxedNumber +public record Schema01BoxedNumber
+implements [Schema01Boxed](#schema01boxed) + +record that stores validated Number payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| Schema01BoxedNumber(Number data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| Number | data()
validated payload | +| @Nullable Object | getData()
validated payload | + +## Schema01 +public static class Schema01
+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.storeorderorderid.get.parameters.parameter0.Schema0; + +import java.util.Arrays; +import java.util.List; +import java.util.AbstractMap; + +static final SchemaConfiguration configuration = new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().build()); + +// long validation +long validatedPayload = Schema0.Schema01.validate( + 1L, + configuration +); +``` + +### Field Summary +| Modifier and Type | Field and Description | +| ----------------- | ---------------------- | +| Set> | type = Set.of(
    Integer.class,
    Long.class,
    Float.class,
    Double.class
)
| +| String | type = "int64"; | +| Number | maximum = 5 | +| Number | minimum = 1 | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| long | validate(long arg, SchemaConfiguration configuration) | +| [Schema01BoxedNumber](#schema01boxednumber) | validateAndBox(Number arg, SchemaConfiguration configuration) | +| [Schema01Boxed](#schema01boxed) | validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) | +| @Nullable Object | validate(@Nullable Object arg, SchemaConfiguration configuration) | diff --git a/samples/client/petstore/kotlin/docs/paths/storeorderorderid/get/responses/StoreorderorderidGetCode200Response.md b/samples/client/petstore/kotlin/docs/paths/storeorderorderid/get/responses/StoreorderorderidGetCode200Response.md new file mode 100644 index 00000000000..8f350b2c6fc --- /dev/null +++ b/samples/client/petstore/kotlin/docs/paths/storeorderorderid/get/responses/StoreorderorderidGetCode200Response.md @@ -0,0 +1,123 @@ +# StoreorderorderidGetCode200Response + +public class StoreorderorderidGetCode200Response + +A class that contains necessary nested response classes +- SealedMediaType, a sealed interface which contains all the schema/encoding info for each contentType +- records which implement SealedMediaType, the concrete media types +- SealedResponseBody, a sealed interface which contains all the contentType/schema types +- records which implement SealedResponseBody, the concrete response body types +- a class that extends ResponseDeserializer and is used to deserialize responses + +## Nested Class Summary +| Modifier and Type | Class and Description | +| ----------------- | --------------------- | +| sealed interface | [StoreorderorderidGetCode200Response.SealedMediaType](#sealedmediatype)
media type sealed interface | +| record | [StoreorderorderidGetCode200Response.ApplicationxmlMediaType](#applicationxmlmediatype)
record storing schema + encoding for a specific contentType | +| record | [StoreorderorderidGetCode200Response.ApplicationjsonMediaType](#applicationjsonmediatype)
record storing schema + encoding for a specific contentType | +| sealed interface | [StoreorderorderidGetCode200Response.SealedResponseBody](#sealedresponsebody)
response body sealed interface | +| record | [StoreorderorderidGetCode200Response.ApplicationxmlResponseBody](#applicationxmlresponsebody)
implements sealed interface to store response body | +| record | [StoreorderorderidGetCode200Response.ApplicationjsonResponseBody](#applicationjsonresponsebody)
implements sealed interface to store response body | +| static class | [StoreorderorderidGetCode200Response.StoreorderorderidGetCode200Response1](#storeorderorderidgetcode200response1)
class that deserializes responses | + +## SealedMediaType +public sealed interface SealedMediaType
+permits
+[ApplicationxmlMediaType](#applicationxmlmediatype), +[ApplicationjsonMediaType](#applicationjsonmediatype) + +sealed interface that stores schema and encoding info + +## ApplicationxmlMediaType +public record ApplicationxmlMediaType
+implements [SealedMediaType](#sealedmediatype), MediaType<[ApplicationxmlSchema.ApplicationxmlSchema1](../../../../paths/storeorderorderid/get/responses/code200response/content/applicationxml/ApplicationxmlSchema.md#applicationxmlschema1), Nothing?> + +class storing schema info for a specific contentType + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| ApplicationxmlMediaType()
Creates an instance | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| [ApplicationxmlSchema.ApplicationxmlSchema1](../../../../paths/storeorderorderid/get/responses/code200response/content/applicationxml/ApplicationxmlSchema.md#applicationxmlschema1) | schema()
the schema for this MediaType | +| Nothing? | encoding()
the encoding info | + +## ApplicationjsonMediaType +public record ApplicationjsonMediaType
+implements [SealedMediaType](#sealedmediatype), MediaType<[ApplicationjsonSchema.ApplicationjsonSchema1](../../../../paths/storeorderorderid/get/responses/code200response/content/applicationjson/ApplicationjsonSchema.md#applicationjsonschema1), Nothing?> + +class storing schema info for a specific contentType + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| ApplicationjsonMediaType()
Creates an instance | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| [ApplicationjsonSchema.ApplicationjsonSchema1](../../../../paths/storeorderorderid/get/responses/code200response/content/applicationjson/ApplicationjsonSchema.md#applicationjsonschema1) | schema()
the schema for this MediaType | +| Nothing? | encoding()
the encoding info | + +## SealedResponseBody +public sealed interface SealedResponseBody
+permits
+[ApplicationxmlResponseBody](#applicationxmlresponsebody), +[ApplicationjsonResponseBody](#applicationjsonresponsebody) + +sealed interface that stores response body + +## ApplicationxmlResponseBody +public record ApplicationxmlResponseBody
+implements [SealedResponseBody](#sealedresponsebody) + +A record class to store response body for contentType="application/xml" + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| ApplicationxmlResponseBody(ApplicationxmlSchema.[Order1Boxed](../../../../components/schemas/Order.md#order1boxed) body)
Creates an instance | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| ApplicationxmlSchema.[Order1Boxed](../../../../components/schemas/Order.md#order1boxed) | body()
returns the body passed in in the constructor | +## ApplicationjsonResponseBody +public record ApplicationjsonResponseBody
+implements [SealedResponseBody](#sealedresponsebody) + +A record class to store response body for contentType="application/json" + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| ApplicationjsonResponseBody(ApplicationjsonSchema.[Order1Boxed](../../../../components/schemas/Order.md#order1boxed) body)
Creates an instance | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| ApplicationjsonSchema.[Order1Boxed](../../../../components/schemas/Order.md#order1boxed) | body()
returns the body passed in in the constructor | + +## StoreorderorderidGetCode200Response1 +public static class StoreorderorderidGetCode200Response1
+extends ResponseDeserializer<[SealedResponseBody](#sealedresponsebody), Nothing?, [SealedMediaType](#sealedmediatype)> + +a class that deserializes responses + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| StoreorderorderidGetCode200Response1()
Creates an instance | + +### Field Summary +| Modifier and Type | Field and Description | +| ----------------- | --------------------- | +| Map | content = Map.ofEntries(
    new AbstractMap.SimpleEntry<>("application/xml", new [ApplicationxmlMediaType](#applicationxmlmediatype)()),
    new AbstractMap.SimpleEntry<>("application/json", new [ApplicationjsonMediaType](#applicationjsonmediatype)())
)
the contentType to schema info | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| ApiResponse<[SealedResponseBody](#sealedresponsebody), Nothing?> | deserialize(HttpResponse response, SchemaConfiguration configuration)
called by endpoint when deserialize responses | diff --git a/samples/client/petstore/kotlin/docs/paths/storeorderorderid/get/responses/StoreorderorderidGetCode400Response.md b/samples/client/petstore/kotlin/docs/paths/storeorderorderid/get/responses/StoreorderorderidGetCode400Response.md new file mode 100644 index 00000000000..9e766c6e881 --- /dev/null +++ b/samples/client/petstore/kotlin/docs/paths/storeorderorderid/get/responses/StoreorderorderidGetCode400Response.md @@ -0,0 +1,32 @@ +# StoreorderorderidGetCode400Response + +public class StoreorderorderidGetCode400Response + +A class that contains necessary nested response classes +- a class that extends ResponseDeserializer and is used to deserialize responses + +## Nested Class Summary +| Modifier and Type | Class and Description | +| ----------------- | --------------------- | +| static class | [StoreorderorderidGetCode400Response.StoreorderorderidGetCode400Response1](#storeorderorderidgetcode400response1)
class that deserializes responses | + +## StoreorderorderidGetCode400Response1 +public static class StoreorderorderidGetCode400Response1
+extends ResponseDeserializer + +a class that deserializes responses + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| StoreorderorderidGetCode400Response1()
Creates an instance | + +### Field Summary +| Modifier and Type | Field and Description | +| ----------------- | --------------------- | +| Map | content = MapUtils.makeMap(
)
the contentType to schema info | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| ApiResponse | deserialize(HttpResponse response, SchemaConfiguration configuration)
called by endpoint when deserialize responses | diff --git a/samples/client/petstore/kotlin/docs/paths/storeorderorderid/get/responses/StoreorderorderidGetCode404Response.md b/samples/client/petstore/kotlin/docs/paths/storeorderorderid/get/responses/StoreorderorderidGetCode404Response.md new file mode 100644 index 00000000000..857ead34d38 --- /dev/null +++ b/samples/client/petstore/kotlin/docs/paths/storeorderorderid/get/responses/StoreorderorderidGetCode404Response.md @@ -0,0 +1,32 @@ +# StoreorderorderidGetCode404Response + +public class StoreorderorderidGetCode404Response + +A class that contains necessary nested response classes +- a class that extends ResponseDeserializer and is used to deserialize responses + +## Nested Class Summary +| Modifier and Type | Class and Description | +| ----------------- | --------------------- | +| static class | [StoreorderorderidGetCode404Response.StoreorderorderidGetCode404Response1](#storeorderorderidgetcode404response1)
class that deserializes responses | + +## StoreorderorderidGetCode404Response1 +public static class StoreorderorderidGetCode404Response1
+extends ResponseDeserializer + +a class that deserializes responses + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| StoreorderorderidGetCode404Response1()
Creates an instance | + +### Field Summary +| Modifier and Type | Field and Description | +| ----------------- | --------------------- | +| Map | content = MapUtils.makeMap(
)
the contentType to schema info | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| ApiResponse | deserialize(HttpResponse response, SchemaConfiguration configuration)
called by endpoint when deserialize responses | diff --git a/samples/client/petstore/kotlin/docs/paths/storeorderorderid/get/responses/code200response/content/applicationjson/ApplicationjsonSchema.md b/samples/client/petstore/kotlin/docs/paths/storeorderorderid/get/responses/code200response/content/applicationjson/ApplicationjsonSchema.md new file mode 100644 index 00000000000..e069f9c21c8 --- /dev/null +++ b/samples/client/petstore/kotlin/docs/paths/storeorderorderid/get/responses/code200response/content/applicationjson/ApplicationjsonSchema.md @@ -0,0 +1,19 @@ +# ApplicationjsonSchema +public class ApplicationjsonSchema
+extends [Order1](../../../../../../../components/schemas/Order.md#order) + +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 + +## Nested Class Summary +| Modifier and Type | Class and Description | +| ----------------- | ---------------------- | +| static class | [ApplicationjsonSchema.ApplicationjsonSchema1](#applicationjsonschema1)
schema class | + +## ApplicationjsonSchema1 +public static class ApplicationjsonSchema1
+extends [Order.Order1](../../../../../../../components/schemas/Order.md#order1) + +A schema class that validates payloads diff --git a/samples/client/petstore/kotlin/docs/paths/storeorderorderid/get/responses/code200response/content/applicationxml/ApplicationxmlSchema.md b/samples/client/petstore/kotlin/docs/paths/storeorderorderid/get/responses/code200response/content/applicationxml/ApplicationxmlSchema.md new file mode 100644 index 00000000000..751649039e1 --- /dev/null +++ b/samples/client/petstore/kotlin/docs/paths/storeorderorderid/get/responses/code200response/content/applicationxml/ApplicationxmlSchema.md @@ -0,0 +1,19 @@ +# ApplicationxmlSchema +public class ApplicationxmlSchema
+extends [Order1](../../../../../../../components/schemas/Order.md#order) + +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 + +## Nested Class Summary +| Modifier and Type | Class and Description | +| ----------------- | ---------------------- | +| static class | [ApplicationxmlSchema.ApplicationxmlSchema1](#applicationxmlschema1)
schema class | + +## ApplicationxmlSchema1 +public static class ApplicationxmlSchema1
+extends [Order.Order1](../../../../../../../components/schemas/Order.md#order1) + +A schema class that validates payloads diff --git a/samples/client/petstore/kotlin/docs/paths/user/UserPost.md b/samples/client/petstore/kotlin/docs/paths/user/UserPost.md new file mode 100644 index 00000000000..956ce5f8ba3 --- /dev/null +++ b/samples/client/petstore/kotlin/docs/paths/user/UserPost.md @@ -0,0 +1,202 @@ +# UserPost + +public class UserPost + +A class that contains necessary endpoint classes +- a class that calls the endpoint method using the http verb +- a class that calls the endpoint method using the operationId name +- class(es) to store the request inputs +- builder(s) to set the request input data + +## Nested Class Summary +| Modifier and Type | Class and Description | +| ----------------- | --------------------- | +| static class | [Post](#post)
The class that has a post method to call the endpoint | +| interface | [CreateUserOperation](#createuseroperation)
The interface that has a createUser method to call the endpoint | +| static class | [PostRequest](#postrequest)
The final request inputs class | +| static class | [PostNullableRequest](#postnullablerequest)
The initial request inputs class | +| static class | [Post0RequestBuilder](#post0requestbuilder)
A builder for the request input class | +| static class | [PostRequestBuilder](#postrequestbuilder)
A builder for the request input class | + +## Post +public static class Post 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.user.post.UserPostRequestBody; +import org.openapijsonschematools.client.components.schemas.User; +import org.openapijsonschematools.client.servers.RootServer0; +import org.openapijsonschematools.client.servers.RootServer1; +import org.openapijsonschematools.client.servers.RootServer2; +import org.openapijsonschematools.client.paths.user.post.responses.UserPostCodedefaultResponse; +import org.openapijsonschematools.client.servers.RootServerInfo; +import org.openapijsonschematools.client.paths.user.UserPost; +import org.openapijsonschematools.client.paths.user.post.UserPostResponses; + +import java.io.IOException; +import java.util.Arrays; +import java.util.List; +import java.util.Map; +import java.util.AbstractMap; + +// if you want to use a server that is not SERVER_0 pass it in here and change the ServerIndex input below +ApiConfiguration.ServerInfo serverInfo = new ApiConfiguration.ServerInfoBuilder() + .rootServerInfo( + new RootServerInfo.RootServerInfoBuilder() + .rootServer0(new RootServer0()) + .build() + ) + .build(); +ApiConfiguration.ServerIndexInfo serverIndexInfo = new ApiConfiguration.ServerIndexInfoBuilder() + .rootServerInfoServerIndex(RootServerInfo.ServerIndex.SERVER_0) + .build(); +Duration timeout = Duration.ofSeconds(1L); +Map> defaultHeaders = Map.of("User-Agent", List.of("OpenAPI-JSON-Schema-Generator/1.0.0/java")); +ApiConfiguration apiConfiguration = new ApiConfiguration( + serverInfo + serverIndexInfo, + timeout, + defaultHeaders +); +SchemaConfiguration schemaConfiguration = new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().build()); +UserPost.Post apiClient = new UserPost.Post(apiConfiguration, schemaConfiguration); + + +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 +); +UserPost.SealedRequestBody requestBody = new UserPost.ApplicationjsonRequestBody(requestBodyPayload); + +var request = new UserPost.PostRequestBuilder() + .requestBody(requestBody) + .build(); + +UserPostResponses.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; +} +UserPostResponses.EndpointUserPostCodedefaultResponse castResponse = (UserPostResponses.EndpointUserPostCodedefaultResponse) response; +``` +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| Post(ApiConfiguration apiConfiguration, SchemaConfiguration schemaConfiguration)
Creates an instance | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| [UserPostResponses.EndpointResponse](../../paths/user/post/UserPostResponses.md#endpointresponse) | post([PostRequest](#postrequest) request) | + +## CreateUserOperation +public interface CreateUserOperation
+ +an interface that allows one to call the endpoint using a method named createUser by the operationId + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| [UserPostResponses.EndpointResponse](../../paths/user/post/UserPostResponses.md#endpointresponse) | createUser([PostRequest](#postrequest) request) | + +## PostRequest +public static class PostRequest
+ +a class that stores the final request inputs + +### Field Summary +| Modifier and Type | Field and Description | +| ----------------- | --------------------- | +| [UserPostRequestBody.SealedRequestBody](../../paths/user/post/UserPostRequestBody.md#sealedrequestbody) | requestBody | +| [RootServerInfo.@Nullable ServerIndex](../../RootServerInfo.md#serverindex) | serverIndex
optional. Note: this will override the value in apiConfiguration | +| @Nullable Duration | timeout
optional. Note: this will override the value in apiConfiguration | + +## PostNullableRequest +public static class PostNullableRequest
+ +a class that stores the initial request inputs + +### Field Summary +| Modifier and Type | Field and Description | +| ----------------- | --------------------- | +| [UserPostRequestBody.@Nullable SealedRequestBody](../../paths/user/post/UserPostRequestBody.md#sealedrequestbody) | requestBody | +| [RootServerInfo.@Nullable ServerIndex](../../RootServerInfo.md#serverindex) | serverIndex | +| @Nullable Duration | timeout | + +## Post0RequestBuilder +public static class Post0RequestBuilder
+ +a builder for request inputs + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| Post0RequestBuilder(Post0RequestBuilder instance)
Creates a builder that contains the passed instance | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| [PostRequest](#postrequest) | build()
Returns the request input used to call an endpoint method | +| [Post0RequestBuilder](#post0requestbuilder) | serverIndex([RootServerInfo.ServerIndex](../../RootServerInfo.md#serverindex) serverIndex)
sets the optional property. Note: this will override the value in apiConfiguration | +| [Post0RequestBuilder](#post0requestbuilder) | timeout(Duration timeout)
sets the optional property. Note: this will override the value in apiConfiguration | + +## PostRequestBuilder +public static class PostRequestBuilder
+ +a builder for request inputs + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| PostRequestBuilder()
Creates a builder that contains null for all parameters | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| [Post0RequestBuilder](#post0requestbuilder) | requestBody([UserPostRequestBody.SealedRequestBody](../../paths/user/post/UserPostRequestBody.md#sealedrequestbody) requestBody)
sets the property | + +[[Back to top]](#top) [[Back to README]](../../../README.md) diff --git a/samples/client/petstore/kotlin/docs/paths/user/post/UserPostRequestBody.md b/samples/client/petstore/kotlin/docs/paths/user/post/UserPostRequestBody.md new file mode 100644 index 00000000000..3d9c6d9e137 --- /dev/null +++ b/samples/client/petstore/kotlin/docs/paths/user/post/UserPostRequestBody.md @@ -0,0 +1,90 @@ +# UserPostRequestBody + +public class UserPostRequestBody + +A class that contains necessary nested request body classes +- SealedMediaType, a sealed interface which contains all the schema/encoding info for each contentType +- records which implement SealedMediaType, the concrete media types +- a class that extends RequestBodySerializer and is used to serialize input SealedRequestBody instances +- SealedRequestBody, a sealed interface which contains all the contentType/schema input types +- records which implement SealedRequestBody, the concrete request body types + +## Nested Class Summary +| Modifier and Type | Class and Description | +| ----------------- | --------------------- | +| sealed interface | [UserPostRequestBody.SealedMediaType](#sealedmediatype)
media type sealed interface | +| record | [UserPostRequestBody.ApplicationjsonMediaType](#applicationjsonmediatype)
record storing schema + encoding for a specific contentType | +| static class | [UserPostRequestBody.UserPostRequestBody1](#userpostrequestbody1)
class that serializes request bodies | +| sealed interface | [UserPostRequestBody.SealedRequestBody](#sealedrequestbody)
request body sealed interface | +| record | [UserPostRequestBody.ApplicationjsonRequestBody](#applicationjsonrequestbody)
implements sealed interface to store request body input | + +## SealedMediaType +public sealed interface SealedMediaType
+permits
+[ApplicationjsonMediaType](#applicationjsonmediatype) + +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), Nothing?> + +class storing schema info for a specific contentType + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| ApplicationjsonMediaType()
Creates an instance | + +### 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 | +| Nothing? | encoding()
the encoding info | + +## UserPostRequestBody1 +public static class UserPostRequestBody1
+ +a class that serializes SealedRequestBody request bodies + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| UserPostRequestBody1()
Creates an instance | + +### Field Summary +| Modifier and Type | Field and Description | +| ----------------- | --------------------- | +| boolean | required = true
whether the request body is required | +| 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 | +| ----------------- | ---------------------- | +| SerializedRequestBody | serialize([SealedRequestBody](#sealedrequestbody) requestBody)
called by endpoint when creating request body bytes | + +## SealedRequestBody +public sealed interface SealedRequestBody
+permits
+[ApplicationjsonRequestBody](#applicationjsonrequestbody) + +sealed interface that stores request contentType + validated schema data + +## ApplicationjsonRequestBody +public record ApplicationjsonRequestBody
+implements [SealedRequestBody](#sealedrequestbody),
+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 | + +### 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 | diff --git a/samples/client/petstore/kotlin/docs/paths/user/post/UserPostResponses.md b/samples/client/petstore/kotlin/docs/paths/user/post/UserPostResponses.md new file mode 100644 index 00000000000..763acac4e00 --- /dev/null +++ b/samples/client/petstore/kotlin/docs/paths/user/post/UserPostResponses.md @@ -0,0 +1,29 @@ +# UserPostResponses + +public class UserPostResponses + +A class that contains necessary responses classes +- a sealed interface, EndpointResponse, that stores endpoint responses +- records for each endpoint response + +## Nested Class Summary +| Modifier and Type | Class and Description | +| ----------------- | --------------------- | +| sealed interface | [EndpointResponse](#endpointresponse)
stores the endpoint responses | +| record | [EndpointUserPostCodedefaultResponse](#endpointuserpostcodedefaultresponse)
the response for default | + +## EndpointResponse +public sealed interface EndpointResponse permits
+[EndpointUserPostCodedefaultResponse](#endpointuserpostcodedefaultresponse) + +a sealed interface that stores endpoint responses + +## EndpointUserPostCodedefaultResponse +public record EndpointUserPostCodedefaultResponse( + HttpResponse response, + Nothing? body, + Nothing? headers +) implements EndpointResponse, ApiResponse
+ +a class that stores an endpoint response + diff --git a/samples/client/petstore/kotlin/docs/paths/user/post/requestbody/content/applicationjson/ApplicationjsonSchema.md b/samples/client/petstore/kotlin/docs/paths/user/post/requestbody/content/applicationjson/ApplicationjsonSchema.md new file mode 100644 index 00000000000..87ec51870cc --- /dev/null +++ b/samples/client/petstore/kotlin/docs/paths/user/post/requestbody/content/applicationjson/ApplicationjsonSchema.md @@ -0,0 +1,19 @@ +# ApplicationjsonSchema +public class ApplicationjsonSchema
+extends [User1](../../../../../../components/schemas/User.md#user) + +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 + +## Nested Class Summary +| Modifier and Type | Class and Description | +| ----------------- | ---------------------- | +| static class | [ApplicationjsonSchema.ApplicationjsonSchema1](#applicationjsonschema1)
schema class | + +## ApplicationjsonSchema1 +public static class ApplicationjsonSchema1
+extends [User.User1](../../../../../../components/schemas/User.md#user1) + +A schema class that validates payloads diff --git a/samples/client/petstore/kotlin/docs/paths/user/post/responses/UserPostCodedefaultResponse.md b/samples/client/petstore/kotlin/docs/paths/user/post/responses/UserPostCodedefaultResponse.md new file mode 100644 index 00000000000..4b45657c98c --- /dev/null +++ b/samples/client/petstore/kotlin/docs/paths/user/post/responses/UserPostCodedefaultResponse.md @@ -0,0 +1,32 @@ +# UserPostCodedefaultResponse + +public class UserPostCodedefaultResponse + +A class that contains necessary nested response classes +- a class that extends ResponseDeserializer and is used to deserialize responses + +## Nested Class Summary +| Modifier and Type | Class and Description | +| ----------------- | --------------------- | +| static class | [UserPostCodedefaultResponse.UserPostCodedefaultResponse1](#userpostcodedefaultresponse1)
class that deserializes responses | + +## UserPostCodedefaultResponse1 +public static class UserPostCodedefaultResponse1
+extends ResponseDeserializer + +a class that deserializes responses + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| UserPostCodedefaultResponse1()
Creates an instance | + +### Field Summary +| Modifier and Type | Field and Description | +| ----------------- | --------------------- | +| Map | content = MapUtils.makeMap(
)
the contentType to schema info | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| ApiResponse | deserialize(HttpResponse response, SchemaConfiguration configuration)
called by endpoint when deserialize responses | diff --git a/samples/client/petstore/kotlin/docs/paths/usercreatewitharray/UsercreatewitharrayPost.md b/samples/client/petstore/kotlin/docs/paths/usercreatewitharray/UsercreatewitharrayPost.md new file mode 100644 index 00000000000..d9c648dfa57 --- /dev/null +++ b/samples/client/petstore/kotlin/docs/paths/usercreatewitharray/UsercreatewitharrayPost.md @@ -0,0 +1,224 @@ +# UsercreatewitharrayPost + +public class UsercreatewitharrayPost + +A class that contains necessary endpoint classes +- a class that calls the endpoint method using the http verb +- a class that calls the endpoint method using the operationId name +- class(es) to store the request inputs +- builder(s) to set the request input data + +## Nested Class Summary +| Modifier and Type | Class and Description | +| ----------------- | --------------------- | +| static class | [Post](#post)
The class that has a post method to call the endpoint | +| interface | [CreateUsersWithArrayInputOperation](#createuserswitharrayinputoperation)
The interface that has a createUsersWithArrayInput method to call the endpoint | +| static class | [PostRequest](#postrequest)
The final request inputs class | +| static class | [PostNullableRequest](#postnullablerequest)
The initial request inputs class | +| static class | [Post0RequestBuilder](#post0requestbuilder)
A builder for the request input class | +| static class | [PostRequestBuilder](#postrequestbuilder)
A builder for the request input class | + +## Post +public static class Post 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.UsercreatewitharrayPostRequestBody; +import org.openapijsonschematools.client.components.requestbodies.userarray.content.applicationjson.ApplicationjsonSchema; +import org.openapijsonschematools.client.servers.RootServer0; +import org.openapijsonschematools.client.servers.RootServer1; +import org.openapijsonschematools.client.servers.RootServer2; +import org.openapijsonschematools.client.paths.usercreatewitharray.post.responses.UsercreatewitharrayPostCodedefaultResponse; +import org.openapijsonschematools.client.servers.RootServerInfo; +import org.openapijsonschematools.client.paths.usercreatewitharray.UsercreatewitharrayPost; +import org.openapijsonschematools.client.paths.usercreatewitharray.post.UsercreatewitharrayPostResponses; + +import java.io.IOException; +import java.util.Arrays; +import java.util.List; +import java.util.Map; +import java.util.AbstractMap; + +// if you want to use a server that is not SERVER_0 pass it in here and change the ServerIndex input below +ApiConfiguration.ServerInfo serverInfo = new ApiConfiguration.ServerInfoBuilder() + .rootServerInfo( + new RootServerInfo.RootServerInfoBuilder() + .rootServer0(new RootServer0()) + .build() + ) + .build(); +ApiConfiguration.ServerIndexInfo serverIndexInfo = new ApiConfiguration.ServerIndexInfoBuilder() + .rootServerInfoServerIndex(RootServerInfo.ServerIndex.SERVER_0) + .build(); +Duration timeout = Duration.ofSeconds(1L); +Map> defaultHeaders = Map.of("User-Agent", List.of("OpenAPI-JSON-Schema-Generator/1.0.0/java")); +ApiConfiguration apiConfiguration = new ApiConfiguration( + serverInfo + serverIndexInfo, + timeout, + defaultHeaders +); +SchemaConfiguration schemaConfiguration = new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().build()); +UsercreatewitharrayPost.Post apiClient = new UsercreatewitharrayPost.Post(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 +); +UsercreatewitharrayPostRequestBody.SealedRequestBody requestBody = new UsercreatewitharrayPostRequestBody.ApplicationjsonRequestBody(requestBodyPayload); + +var request = new UsercreatewitharrayPost.PostRequestBuilder() + .requestBody(requestBody) + .build(); + +UsercreatewitharrayPostResponses.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; +} +UsercreatewitharrayPostResponses.EndpointUsercreatewitharrayPostCodedefaultResponse castResponse = (UsercreatewitharrayPostResponses.EndpointUsercreatewitharrayPostCodedefaultResponse) response; +``` +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| Post(ApiConfiguration apiConfiguration, SchemaConfiguration schemaConfiguration)
Creates an instance | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| [UsercreatewitharrayPostResponses.EndpointResponse](../../paths/usercreatewitharray/post/UsercreatewitharrayPostResponses.md#endpointresponse) | post([PostRequest](#postrequest) request) | + +## CreateUsersWithArrayInputOperation +public interface CreateUsersWithArrayInputOperation
+ +an interface that allows one to call the endpoint using a method named createUsersWithArrayInput by the operationId + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| [UsercreatewitharrayPostResponses.EndpointResponse](../../paths/usercreatewitharray/post/UsercreatewitharrayPostResponses.md#endpointresponse) | createUsersWithArrayInput([PostRequest](#postrequest) request) | + +## PostRequest +public static class PostRequest
+ +a class that stores the final request inputs + +### Field Summary +| Modifier and Type | Field and Description | +| ----------------- | --------------------- | +| [UsercreatewitharrayPostRequestBody.SealedRequestBody](../../paths/usercreatewitharray/post/UsercreatewitharrayPostRequestBody.md#sealedrequestbody) | requestBody | +| [RootServerInfo.@Nullable ServerIndex](../../RootServerInfo.md#serverindex) | serverIndex
optional. Note: this will override the value in apiConfiguration | +| @Nullable Duration | timeout
optional. Note: this will override the value in apiConfiguration | + +## PostNullableRequest +public static class PostNullableRequest
+ +a class that stores the initial request inputs + +### Field Summary +| Modifier and Type | Field and Description | +| ----------------- | --------------------- | +| [UsercreatewitharrayPostRequestBody.@Nullable SealedRequestBody](../../paths/usercreatewitharray/post/UsercreatewitharrayPostRequestBody.md#sealedrequestbody) | requestBody | +| [RootServerInfo.@Nullable ServerIndex](../../RootServerInfo.md#serverindex) | serverIndex | +| @Nullable Duration | timeout | + +## Post0RequestBuilder +public static class Post0RequestBuilder
+ +a builder for request inputs + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| Post0RequestBuilder(Post0RequestBuilder instance)
Creates a builder that contains the passed instance | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| [PostRequest](#postrequest) | build()
Returns the request input used to call an endpoint method | +| [Post0RequestBuilder](#post0requestbuilder) | serverIndex([RootServerInfo.ServerIndex](../../RootServerInfo.md#serverindex) serverIndex)
sets the optional property. Note: this will override the value in apiConfiguration | +| [Post0RequestBuilder](#post0requestbuilder) | timeout(Duration timeout)
sets the optional property. Note: this will override the value in apiConfiguration | + +## PostRequestBuilder +public static class PostRequestBuilder
+ +a builder for request inputs + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| PostRequestBuilder()
Creates a builder that contains null for all parameters | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| [Post0RequestBuilder](#post0requestbuilder) | requestBody([UsercreatewitharrayPostRequestBody.SealedRequestBody](../../paths/usercreatewitharray/post/UsercreatewitharrayPostRequestBody.md#sealedrequestbody) requestBody)
sets the property | + +[[Back to top]](#top) [[Back to README]](../../../README.md) diff --git a/samples/client/petstore/kotlin/docs/paths/usercreatewitharray/post/UsercreatewitharrayPostRequestBody.md b/samples/client/petstore/kotlin/docs/paths/usercreatewitharray/post/UsercreatewitharrayPostRequestBody.md new file mode 100644 index 00000000000..b96ec049cfe --- /dev/null +++ b/samples/client/petstore/kotlin/docs/paths/usercreatewitharray/post/UsercreatewitharrayPostRequestBody.md @@ -0,0 +1,17 @@ +# UsercreatewitharrayPostRequestBody + +public class UsercreatewitharrayPostRequestBody 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 + +## Nested Class Summary +| Modifier and Type | Class and Description | +| ----------------- | --------------------- | +| static class | [UsercreatewitharrayPostRequestBody.UsercreatewitharrayPostRequestBody1](#usercreatewitharraypostrequestbody1)
class that serializes request bodies | + +## UsercreatewitharrayPostRequestBody1 +public static class UsercreatewitharrayPostRequestBody1 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/kotlin/docs/paths/usercreatewitharray/post/UsercreatewitharrayPostResponses.md b/samples/client/petstore/kotlin/docs/paths/usercreatewitharray/post/UsercreatewitharrayPostResponses.md new file mode 100644 index 00000000000..3a8bf5083b7 --- /dev/null +++ b/samples/client/petstore/kotlin/docs/paths/usercreatewitharray/post/UsercreatewitharrayPostResponses.md @@ -0,0 +1,29 @@ +# UsercreatewitharrayPostResponses + +public class UsercreatewitharrayPostResponses + +A class that contains necessary responses classes +- a sealed interface, EndpointResponse, that stores endpoint responses +- records for each endpoint response + +## Nested Class Summary +| Modifier and Type | Class and Description | +| ----------------- | --------------------- | +| sealed interface | [EndpointResponse](#endpointresponse)
stores the endpoint responses | +| record | [EndpointUsercreatewitharrayPostCodedefaultResponse](#endpointusercreatewitharraypostcodedefaultresponse)
the response for default | + +## EndpointResponse +public sealed interface EndpointResponse permits
+[EndpointUsercreatewitharrayPostCodedefaultResponse](#endpointusercreatewitharraypostcodedefaultresponse) + +a sealed interface that stores endpoint responses + +## EndpointUsercreatewitharrayPostCodedefaultResponse +public record EndpointUsercreatewitharrayPostCodedefaultResponse( + HttpResponse response, + Nothing? body, + Nothing? headers +) implements EndpointResponse, ApiResponse
+ +a class that stores an endpoint response + diff --git a/samples/client/petstore/kotlin/docs/paths/usercreatewitharray/post/responses/UsercreatewitharrayPostCodedefaultResponse.md b/samples/client/petstore/kotlin/docs/paths/usercreatewitharray/post/responses/UsercreatewitharrayPostCodedefaultResponse.md new file mode 100644 index 00000000000..cfe169953b4 --- /dev/null +++ b/samples/client/petstore/kotlin/docs/paths/usercreatewitharray/post/responses/UsercreatewitharrayPostCodedefaultResponse.md @@ -0,0 +1,32 @@ +# UsercreatewitharrayPostCodedefaultResponse + +public class UsercreatewitharrayPostCodedefaultResponse + +A class that contains necessary nested response classes +- a class that extends ResponseDeserializer and is used to deserialize responses + +## Nested Class Summary +| Modifier and Type | Class and Description | +| ----------------- | --------------------- | +| static class | [UsercreatewitharrayPostCodedefaultResponse.UsercreatewitharrayPostCodedefaultResponse1](#usercreatewitharraypostcodedefaultresponse1)
class that deserializes responses | + +## UsercreatewitharrayPostCodedefaultResponse1 +public static class UsercreatewitharrayPostCodedefaultResponse1
+extends ResponseDeserializer + +a class that deserializes responses + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| UsercreatewitharrayPostCodedefaultResponse1()
Creates an instance | + +### Field Summary +| Modifier and Type | Field and Description | +| ----------------- | --------------------- | +| Map | content = MapUtils.makeMap(
)
the contentType to schema info | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| ApiResponse | deserialize(HttpResponse response, SchemaConfiguration configuration)
called by endpoint when deserialize responses | diff --git a/samples/client/petstore/kotlin/docs/paths/usercreatewithlist/UsercreatewithlistPost.md b/samples/client/petstore/kotlin/docs/paths/usercreatewithlist/UsercreatewithlistPost.md new file mode 100644 index 00000000000..856224740e5 --- /dev/null +++ b/samples/client/petstore/kotlin/docs/paths/usercreatewithlist/UsercreatewithlistPost.md @@ -0,0 +1,224 @@ +# UsercreatewithlistPost + +public class UsercreatewithlistPost + +A class that contains necessary endpoint classes +- a class that calls the endpoint method using the http verb +- a class that calls the endpoint method using the operationId name +- class(es) to store the request inputs +- builder(s) to set the request input data + +## Nested Class Summary +| Modifier and Type | Class and Description | +| ----------------- | --------------------- | +| static class | [Post](#post)
The class that has a post method to call the endpoint | +| interface | [CreateUsersWithListInputOperation](#createuserswithlistinputoperation)
The interface that has a createUsersWithListInput method to call the endpoint | +| static class | [PostRequest](#postrequest)
The final request inputs class | +| static class | [PostNullableRequest](#postnullablerequest)
The initial request inputs class | +| static class | [Post0RequestBuilder](#post0requestbuilder)
A builder for the request input class | +| static class | [PostRequestBuilder](#postrequestbuilder)
A builder for the request input class | + +## Post +public static class Post 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.UsercreatewithlistPostRequestBody; +import org.openapijsonschematools.client.components.requestbodies.userarray.content.applicationjson.ApplicationjsonSchema; +import org.openapijsonschematools.client.servers.RootServer0; +import org.openapijsonschematools.client.servers.RootServer1; +import org.openapijsonschematools.client.servers.RootServer2; +import org.openapijsonschematools.client.paths.usercreatewithlist.post.responses.UsercreatewithlistPostCodedefaultResponse; +import org.openapijsonschematools.client.servers.RootServerInfo; +import org.openapijsonschematools.client.paths.usercreatewithlist.UsercreatewithlistPost; +import org.openapijsonschematools.client.paths.usercreatewithlist.post.UsercreatewithlistPostResponses; + +import java.io.IOException; +import java.util.Arrays; +import java.util.List; +import java.util.Map; +import java.util.AbstractMap; + +// if you want to use a server that is not SERVER_0 pass it in here and change the ServerIndex input below +ApiConfiguration.ServerInfo serverInfo = new ApiConfiguration.ServerInfoBuilder() + .rootServerInfo( + new RootServerInfo.RootServerInfoBuilder() + .rootServer0(new RootServer0()) + .build() + ) + .build(); +ApiConfiguration.ServerIndexInfo serverIndexInfo = new ApiConfiguration.ServerIndexInfoBuilder() + .rootServerInfoServerIndex(RootServerInfo.ServerIndex.SERVER_0) + .build(); +Duration timeout = Duration.ofSeconds(1L); +Map> defaultHeaders = Map.of("User-Agent", List.of("OpenAPI-JSON-Schema-Generator/1.0.0/java")); +ApiConfiguration apiConfiguration = new ApiConfiguration( + serverInfo + serverIndexInfo, + timeout, + defaultHeaders +); +SchemaConfiguration schemaConfiguration = new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().build()); +UsercreatewithlistPost.Post apiClient = new UsercreatewithlistPost.Post(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 +); +UsercreatewithlistPostRequestBody.SealedRequestBody requestBody = new UsercreatewithlistPostRequestBody.ApplicationjsonRequestBody(requestBodyPayload); + +var request = new UsercreatewithlistPost.PostRequestBuilder() + .requestBody(requestBody) + .build(); + +UsercreatewithlistPostResponses.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; +} +UsercreatewithlistPostResponses.EndpointUsercreatewithlistPostCodedefaultResponse castResponse = (UsercreatewithlistPostResponses.EndpointUsercreatewithlistPostCodedefaultResponse) response; +``` +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| Post(ApiConfiguration apiConfiguration, SchemaConfiguration schemaConfiguration)
Creates an instance | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| [UsercreatewithlistPostResponses.EndpointResponse](../../paths/usercreatewithlist/post/UsercreatewithlistPostResponses.md#endpointresponse) | post([PostRequest](#postrequest) request) | + +## CreateUsersWithListInputOperation +public interface CreateUsersWithListInputOperation
+ +an interface that allows one to call the endpoint using a method named createUsersWithListInput by the operationId + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| [UsercreatewithlistPostResponses.EndpointResponse](../../paths/usercreatewithlist/post/UsercreatewithlistPostResponses.md#endpointresponse) | createUsersWithListInput([PostRequest](#postrequest) request) | + +## PostRequest +public static class PostRequest
+ +a class that stores the final request inputs + +### Field Summary +| Modifier and Type | Field and Description | +| ----------------- | --------------------- | +| [UsercreatewithlistPostRequestBody.SealedRequestBody](../../paths/usercreatewithlist/post/UsercreatewithlistPostRequestBody.md#sealedrequestbody) | requestBody | +| [RootServerInfo.@Nullable ServerIndex](../../RootServerInfo.md#serverindex) | serverIndex
optional. Note: this will override the value in apiConfiguration | +| @Nullable Duration | timeout
optional. Note: this will override the value in apiConfiguration | + +## PostNullableRequest +public static class PostNullableRequest
+ +a class that stores the initial request inputs + +### Field Summary +| Modifier and Type | Field and Description | +| ----------------- | --------------------- | +| [UsercreatewithlistPostRequestBody.@Nullable SealedRequestBody](../../paths/usercreatewithlist/post/UsercreatewithlistPostRequestBody.md#sealedrequestbody) | requestBody | +| [RootServerInfo.@Nullable ServerIndex](../../RootServerInfo.md#serverindex) | serverIndex | +| @Nullable Duration | timeout | + +## Post0RequestBuilder +public static class Post0RequestBuilder
+ +a builder for request inputs + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| Post0RequestBuilder(Post0RequestBuilder instance)
Creates a builder that contains the passed instance | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| [PostRequest](#postrequest) | build()
Returns the request input used to call an endpoint method | +| [Post0RequestBuilder](#post0requestbuilder) | serverIndex([RootServerInfo.ServerIndex](../../RootServerInfo.md#serverindex) serverIndex)
sets the optional property. Note: this will override the value in apiConfiguration | +| [Post0RequestBuilder](#post0requestbuilder) | timeout(Duration timeout)
sets the optional property. Note: this will override the value in apiConfiguration | + +## PostRequestBuilder +public static class PostRequestBuilder
+ +a builder for request inputs + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| PostRequestBuilder()
Creates a builder that contains null for all parameters | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| [Post0RequestBuilder](#post0requestbuilder) | requestBody([UsercreatewithlistPostRequestBody.SealedRequestBody](../../paths/usercreatewithlist/post/UsercreatewithlistPostRequestBody.md#sealedrequestbody) requestBody)
sets the property | + +[[Back to top]](#top) [[Back to README]](../../../README.md) diff --git a/samples/client/petstore/kotlin/docs/paths/usercreatewithlist/post/UsercreatewithlistPostRequestBody.md b/samples/client/petstore/kotlin/docs/paths/usercreatewithlist/post/UsercreatewithlistPostRequestBody.md new file mode 100644 index 00000000000..872f7a38709 --- /dev/null +++ b/samples/client/petstore/kotlin/docs/paths/usercreatewithlist/post/UsercreatewithlistPostRequestBody.md @@ -0,0 +1,17 @@ +# UsercreatewithlistPostRequestBody + +public class UsercreatewithlistPostRequestBody 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 + +## Nested Class Summary +| Modifier and Type | Class and Description | +| ----------------- | --------------------- | +| static class | [UsercreatewithlistPostRequestBody.UsercreatewithlistPostRequestBody1](#usercreatewithlistpostrequestbody1)
class that serializes request bodies | + +## UsercreatewithlistPostRequestBody1 +public static class UsercreatewithlistPostRequestBody1 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/kotlin/docs/paths/usercreatewithlist/post/UsercreatewithlistPostResponses.md b/samples/client/petstore/kotlin/docs/paths/usercreatewithlist/post/UsercreatewithlistPostResponses.md new file mode 100644 index 00000000000..260f259b080 --- /dev/null +++ b/samples/client/petstore/kotlin/docs/paths/usercreatewithlist/post/UsercreatewithlistPostResponses.md @@ -0,0 +1,29 @@ +# UsercreatewithlistPostResponses + +public class UsercreatewithlistPostResponses + +A class that contains necessary responses classes +- a sealed interface, EndpointResponse, that stores endpoint responses +- records for each endpoint response + +## Nested Class Summary +| Modifier and Type | Class and Description | +| ----------------- | --------------------- | +| sealed interface | [EndpointResponse](#endpointresponse)
stores the endpoint responses | +| record | [EndpointUsercreatewithlistPostCodedefaultResponse](#endpointusercreatewithlistpostcodedefaultresponse)
the response for default | + +## EndpointResponse +public sealed interface EndpointResponse permits
+[EndpointUsercreatewithlistPostCodedefaultResponse](#endpointusercreatewithlistpostcodedefaultresponse) + +a sealed interface that stores endpoint responses + +## EndpointUsercreatewithlistPostCodedefaultResponse +public record EndpointUsercreatewithlistPostCodedefaultResponse( + HttpResponse response, + Nothing? body, + Nothing? headers +) implements EndpointResponse, ApiResponse
+ +a class that stores an endpoint response + diff --git a/samples/client/petstore/kotlin/docs/paths/usercreatewithlist/post/responses/UsercreatewithlistPostCodedefaultResponse.md b/samples/client/petstore/kotlin/docs/paths/usercreatewithlist/post/responses/UsercreatewithlistPostCodedefaultResponse.md new file mode 100644 index 00000000000..8128056fdb8 --- /dev/null +++ b/samples/client/petstore/kotlin/docs/paths/usercreatewithlist/post/responses/UsercreatewithlistPostCodedefaultResponse.md @@ -0,0 +1,32 @@ +# UsercreatewithlistPostCodedefaultResponse + +public class UsercreatewithlistPostCodedefaultResponse + +A class that contains necessary nested response classes +- a class that extends ResponseDeserializer and is used to deserialize responses + +## Nested Class Summary +| Modifier and Type | Class and Description | +| ----------------- | --------------------- | +| static class | [UsercreatewithlistPostCodedefaultResponse.UsercreatewithlistPostCodedefaultResponse1](#usercreatewithlistpostcodedefaultresponse1)
class that deserializes responses | + +## UsercreatewithlistPostCodedefaultResponse1 +public static class UsercreatewithlistPostCodedefaultResponse1
+extends ResponseDeserializer + +a class that deserializes responses + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| UsercreatewithlistPostCodedefaultResponse1()
Creates an instance | + +### Field Summary +| Modifier and Type | Field and Description | +| ----------------- | --------------------- | +| Map | content = MapUtils.makeMap(
)
the contentType to schema info | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| ApiResponse | deserialize(HttpResponse response, SchemaConfiguration configuration)
called by endpoint when deserialize responses | diff --git a/samples/client/petstore/kotlin/docs/paths/userlogin/UserloginGet.md b/samples/client/petstore/kotlin/docs/paths/userlogin/UserloginGet.md new file mode 100644 index 00000000000..97e30c4cba6 --- /dev/null +++ b/samples/client/petstore/kotlin/docs/paths/userlogin/UserloginGet.md @@ -0,0 +1,198 @@ +# UserloginGet + +public class UserloginGet + +A class that contains necessary endpoint classes +- a class that calls the endpoint method using the http verb +- a class that calls the endpoint method using the operationId name +- class(es) to store the request inputs +- builder(s) to set the request input data + +## Nested Class Summary +| Modifier and Type | Class and Description | +| ----------------- | --------------------- | +| static class | [Get](#get)
The class that has a get method to call the endpoint | +| interface | [LoginUserOperation](#loginuseroperation)
The interface that has a loginUser method to call the endpoint | +| static class | [GetRequest](#getrequest)
The final request inputs class | +| static class | [GetNullableRequest](#getnullablerequest)
The initial request inputs class | +| static class | [Get0RequestBuilder](#get0requestbuilder)
A builder for the request input class | +| static class | [GetRequestBuilder](#getrequestbuilder)
A builder for the request input class | + +## Get +public static class Get extends ApiClient.ApiClient1 implements GetOperation
+ +a class that allows one to call the endpoint using a method named get + +### 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.userlogin.get.UserloginGetQueryParameters; +import org.openapijsonschematools.client.servers.RootServer0; +import org.openapijsonschematools.client.servers.RootServer1; +import org.openapijsonschematools.client.servers.RootServer2; +import org.openapijsonschematools.client.paths.userlogin.get.responses.UserloginGetCode200Response; +import org.openapijsonschematools.client.paths.userlogin.get.responses.code200response.UserloginGetCode200ResponseHeadersSchema; +import org.openapijsonschematools.client.paths.userlogin.get.responses.UserloginGetCode400Response; +import org.openapijsonschematools.client.servers.RootServerInfo; +import org.openapijsonschematools.client.paths.userlogin.UserloginGet; +import org.openapijsonschematools.client.paths.userlogin.get.UserloginGetResponses; + +import java.io.IOException; +import java.util.Arrays; +import java.util.List; +import java.util.Map; +import java.util.AbstractMap; + +// if you want to use a server that is not SERVER_0 pass it in here and change the ServerIndex input below +ApiConfiguration.ServerInfo serverInfo = new ApiConfiguration.ServerInfoBuilder() + .rootServerInfo( + new RootServerInfo.RootServerInfoBuilder() + .rootServer0(new RootServer0()) + .build() + ) + .build(); +ApiConfiguration.ServerIndexInfo serverIndexInfo = new ApiConfiguration.ServerIndexInfoBuilder() + .rootServerInfoServerIndex(RootServerInfo.ServerIndex.SERVER_0) + .build(); +Duration timeout = Duration.ofSeconds(1L); +Map> defaultHeaders = Map.of("User-Agent", List.of("OpenAPI-JSON-Schema-Generator/1.0.0/java")); +ApiConfiguration apiConfiguration = new ApiConfiguration( + serverInfo + serverIndexInfo, + timeout, + defaultHeaders +); +SchemaConfiguration schemaConfiguration = new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().build()); +UserloginGet.Get apiClient = new UserloginGet.Get(apiConfiguration, schemaConfiguration); + + +// Map validation +UserloginGetQueryParameters.QueryParametersMap queryParameters = + UserloginGetQueryParameters.UserloginGetQueryParameters1.validate( + new UserloginGetQueryParameters.QueryParametersMapBuilder() + .password("a") + + .username("a") + + .build(), + schemaConfiguration +); + +var request = new UserloginGet.GetRequestBuilder() + .queryParameters(queryParameters) + .build(); + +UserloginGetResponses.EndpointResponse response; +try { + response = apiClient.get(request); +} catch (UserloginGetCode400Response.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; +} +UserloginGetResponses.EndpointUserloginGetCode200Response castResponse = (UserloginGetResponses.EndpointUserloginGetCode200Response) response; +if (castResponse.body instanceof UserloginGetCode200Response.ApplicationxmlResponseBody deserializedBody) { + // handle deserialized body here +} else { + UserloginGetCode200Response.ApplicationjsonResponseBody deserializedBody = (UserloginGetCode200Response.ApplicationjsonResponseBody) castResponse.body; + // handle deserialized body here +} +``` +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| Get(ApiConfiguration apiConfiguration, SchemaConfiguration schemaConfiguration)
Creates an instance | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| [UserloginGetResponses.EndpointResponse](../../paths/userlogin/get/UserloginGetResponses.md#endpointresponse) | get([GetRequest](#getrequest) request) | + +## LoginUserOperation +public interface LoginUserOperation
+ +an interface that allows one to call the endpoint using a method named loginUser by the operationId + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| [UserloginGetResponses.EndpointResponse](../../paths/userlogin/get/UserloginGetResponses.md#endpointresponse) | loginUser([GetRequest](#getrequest) request) | + +## GetRequest +public static class GetRequest
+ +a class that stores the final request inputs + +### Field Summary +| Modifier and Type | Field and Description | +| ----------------- | --------------------- | +| [UserloginGetQueryParameters.QueryParametersMap](../../paths/userlogin/get/UserloginGetQueryParameters.md#queryparametersmap) | queryParameters | +| [RootServerInfo.@Nullable ServerIndex](../../RootServerInfo.md#serverindex) | serverIndex
optional. Note: this will override the value in apiConfiguration | +| @Nullable Duration | timeout
optional. Note: this will override the value in apiConfiguration | + +## GetNullableRequest +public static class GetNullableRequest
+ +a class that stores the initial request inputs + +### Field Summary +| Modifier and Type | Field and Description | +| ----------------- | --------------------- | +| [UserloginGetQueryParameters.@Nullable QueryParametersMap](../../paths/userlogin/get/UserloginGetQueryParameters.md#queryparametersmap) | queryParameters | +| [RootServerInfo.@Nullable ServerIndex](../../RootServerInfo.md#serverindex) | serverIndex | +| @Nullable Duration | timeout | + +## Get0RequestBuilder +public static class Get0RequestBuilder
+ +a builder for request inputs + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| Get0RequestBuilder(Get0RequestBuilder instance)
Creates a builder that contains the passed instance | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| [GetRequest](#getrequest) | build()
Returns the request input used to call an endpoint method | +| [Get0RequestBuilder](#get0requestbuilder) | serverIndex([RootServerInfo.ServerIndex](../../RootServerInfo.md#serverindex) serverIndex)
sets the optional property. Note: this will override the value in apiConfiguration | +| [Get0RequestBuilder](#get0requestbuilder) | timeout(Duration timeout)
sets the optional property. Note: this will override the value in apiConfiguration | + +## GetRequestBuilder +public static class GetRequestBuilder
+ +a builder for request inputs + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| GetRequestBuilder()
Creates a builder that contains null for all parameters | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| [Get0RequestBuilder](#get0requestbuilder) | queryParameters([UserloginGetQueryParametersQueryParametersMap](../../paths/userlogin/get/UserloginGetQueryParameters.md#queryparametersmap) queryParameters)
sets the property | + +[[Back to top]](#top) [[Back to README]](../../../README.md) diff --git a/samples/client/petstore/kotlin/docs/paths/userlogin/get/UserloginGetQueryParameters.md b/samples/client/petstore/kotlin/docs/paths/userlogin/get/UserloginGetQueryParameters.md new file mode 100644 index 00000000000..05824e01652 --- /dev/null +++ b/samples/client/petstore/kotlin/docs/paths/userlogin/get/UserloginGetQueryParameters.md @@ -0,0 +1,304 @@ +# UserloginGetQueryParameters +public class UserloginGetQueryParameters
+ +A class that contains necessary nested +- schema classes (which validate payloads), extends JsonSchema +- sealed interfaces which store validated payloads, java version of a sum type +- boxed classes which store validated payloads, sealed permits class implementations +- classes to store validated map payloads, extends FrozenMap +- classes to build inputs for map payloads + +## Nested Class Summary +| Modifier and Type | Class and Description | +| ----------------- | ---------------------- | +| sealed interface | [UserloginGetQueryParameters.UserloginGetQueryParameters1Boxed](#userlogingetqueryparameters1boxed)
sealed interface for validated payloads | +| record | [UserloginGetQueryParameters.UserloginGetQueryParameters1BoxedMap](#userlogingetqueryparameters1boxedmap)
boxed class to store validated Map payloads | +| static class | [UserloginGetQueryParameters.UserloginGetQueryParameters1](#userlogingetqueryparameters1)
schema class | +| static class | [UserloginGetQueryParameters.QueryParametersMapBuilder](#queryparametersmapbuilder)
builder for Map payloads | +| static class | [UserloginGetQueryParameters.QueryParametersMap](#queryparametersmap)
output class for Map payloads | +| sealed interface | [UserloginGetQueryParameters.AdditionalPropertiesBoxed](#additionalpropertiesboxed)
sealed interface for validated payloads | +| record | [UserloginGetQueryParameters.AdditionalPropertiesBoxedVoid](#additionalpropertiesboxedvoid)
boxed class to store validated null payloads | +| record | [UserloginGetQueryParameters.AdditionalPropertiesBoxedBoolean](#additionalpropertiesboxedboolean)
boxed class to store validated boolean payloads | +| record | [UserloginGetQueryParameters.AdditionalPropertiesBoxedNumber](#additionalpropertiesboxednumber)
boxed class to store validated Number payloads | +| record | [UserloginGetQueryParameters.AdditionalPropertiesBoxedString](#additionalpropertiesboxedstring)
boxed class to store validated String payloads | +| record | [UserloginGetQueryParameters.AdditionalPropertiesBoxedList](#additionalpropertiesboxedlist)
boxed class to store validated List payloads | +| record | [UserloginGetQueryParameters.AdditionalPropertiesBoxedMap](#additionalpropertiesboxedmap)
boxed class to store validated Map payloads | +| static class | [UserloginGetQueryParameters.AdditionalProperties](#additionalproperties)
schema class | + +## UserloginGetQueryParameters1Boxed +public sealed interface UserloginGetQueryParameters1Boxed
+permits
+[UserloginGetQueryParameters1BoxedMap](#userlogingetqueryparameters1boxedmap) + +sealed interface that stores validated payloads using boxed classes + +## UserloginGetQueryParameters1BoxedMap +public record UserloginGetQueryParameters1BoxedMap
+implements [UserloginGetQueryParameters1Boxed](#userlogingetqueryparameters1boxed) + +record that stores validated Map payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| UserloginGetQueryParameters1BoxedMap([QueryParametersMap](#queryparametersmap) data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| [QueryParametersMap](#queryparametersmap) | data()
validated payload | +| @Nullable Object | getData()
validated payload | + +## UserloginGetQueryParameters1 +public static class UserloginGetQueryParameters1
+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.userlogin.get.UserloginGetQueryParameters; + +import java.util.Arrays; +import java.util.List; +import java.util.AbstractMap; + +static final SchemaConfiguration configuration = new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().build()); + +// Map validation +UserloginGetQueryParameters.QueryParametersMap validatedPayload = + UserloginGetQueryParameters.UserloginGetQueryParameters1.validate( + new UserloginGetQueryParameters.QueryParametersMapBuilder() + .password("a") + + .username("a") + + .build(), + configuration +); +``` + +### Field Summary +| Modifier and Type | Field and Description | +| ----------------- | ---------------------- | +| Set> | type = Set.of(Map.class) | +| Map> | properties = Map.ofEntries(
    new PropertyEntry("password", [Schema1.Schema11.class](../../../paths/userlogin/get/parameters/parameter1/Schema1.md#schema11)),
    new PropertyEntry("username", [Schema0.Schema01.class](../../../paths/userlogin/get/parameters/parameter0/Schema0.md#schema01))
)
| +| Set | required = Set.of(
    "password",
    "username"
)
| +| Class | additionalProperties = [AdditionalProperties.class](#additionalproperties) | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| [QueryParametersMap](#queryparametersmap) | validate([Map<?, ?>](#queryparametersmapbuilder) arg, SchemaConfiguration configuration) | +| [UserloginGetQueryParameters1BoxedMap](#userlogingetqueryparameters1boxedmap) | validateAndBox([Map<?, ?>](#queryparametersmapbuilder) arg, SchemaConfiguration configuration) | +| [UserloginGetQueryParameters1Boxed](#userlogingetqueryparameters1boxed) | validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) | +| @Nullable Object | validate(@Nullable Object arg, SchemaConfiguration configuration) | + +## QueryParametersMap00Builder +public class QueryParametersMap00Builder
+builder for `Map` + +A class that builds the Map input type + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| QueryParametersMap00Builder(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 | + +## QueryParametersMap01Builder +public class QueryParametersMap01Builder
+builder for `Map` + +A class that builds the Map input type + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| QueryParametersMap01Builder(Map instance)
Creates a builder that contains the passed instance | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| [QueryParametersMap00Builder](#queryparametersmap00builder) | username(String value) | + +## QueryParametersMap10Builder +public class QueryParametersMap10Builder
+builder for `Map` + +A class that builds the Map input type + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| QueryParametersMap10Builder(Map instance)
Creates a builder that contains the passed instance | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| [QueryParametersMap00Builder](#queryparametersmap00builder) | password(String value) | + +## QueryParametersMapBuilder +public class QueryParametersMapBuilder
+builder for `Map` + +A class that builds the Map input type + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| QueryParametersMapBuilder()
Creates a builder that contains an empty map | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| [QueryParametersMap01Builder](#queryparametersmap01builder) | password(String value) | +| [QueryParametersMap10Builder](#queryparametersmap10builder) | username(String value) | + +## QueryParametersMap +public static class QueryParametersMap
+extends FrozenMap + +A class to store validated Map payloads + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| static [QueryParametersMap](#queryparametersmap) | of([Map](#queryparametersmapbuilder) arg, SchemaConfiguration configuration) | +| String | password()
| +| String | username()
| + +## 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(Nothing? data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| Nothing? | 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/kotlin/docs/paths/userlogin/get/UserloginGetResponses.md b/samples/client/petstore/kotlin/docs/paths/userlogin/get/UserloginGetResponses.md new file mode 100644 index 00000000000..2bec55a9491 --- /dev/null +++ b/samples/client/petstore/kotlin/docs/paths/userlogin/get/UserloginGetResponses.md @@ -0,0 +1,29 @@ +# UserloginGetResponses + +public class UserloginGetResponses + +A class that contains necessary responses classes +- a sealed interface, EndpointResponse, that stores endpoint responses +- records for each endpoint response + +## Nested Class Summary +| Modifier and Type | Class and Description | +| ----------------- | --------------------- | +| sealed interface | [EndpointResponse](#endpointresponse)
stores the endpoint responses | +| record | [EndpointUserloginGetCode200Response](#endpointuserlogingetcode200response)
the response for 200 | + +## EndpointResponse +public sealed interface EndpointResponse permits
+[EndpointUserloginGetCode200Response](#endpointuserlogingetcode200response) + +a sealed interface that stores endpoint responses + +## EndpointUserloginGetCode200Response +public record EndpointUserloginGetCode200Response( + HttpResponse response, + [UserloginGetCode200Response.SealedResponseBody](../../../paths/userlogin/get/responses/UserloginGetCode200Response.md#sealedresponsebody) body, + [UserloginGetCode200ResponseHeadersSchema.UserloginGetCode200ResponseHeadersSchemaMap](../../../paths/userlogin/get/responses/code200response/UserloginGetCode200ResponseHeadersSchema.md#userlogingetcode200responseheadersschemamap) headers +) implements EndpointResponse, ApiResponse
+ +a class that stores an endpoint response + diff --git a/samples/client/petstore/kotlin/docs/paths/userlogin/get/parameters/parameter0/Schema0.md b/samples/client/petstore/kotlin/docs/paths/userlogin/get/parameters/parameter0/Schema0.md new file mode 100644 index 00000000000..9ff90e0bc35 --- /dev/null +++ b/samples/client/petstore/kotlin/docs/paths/userlogin/get/parameters/parameter0/Schema0.md @@ -0,0 +1,49 @@ +# Schema0 +public class Schema0
+ +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 + +## Nested Class Summary +| Modifier and Type | Class and Description | +| ----------------- | ---------------------- | +| sealed interface | [Schema0.Schema01Boxed](#schema01boxed)
sealed interface for validated payloads | +| record | [Schema0.Schema01BoxedString](#schema01boxedstring)
boxed class to store validated String payloads | +| static class | [Schema0.Schema01](#schema01)
schema class | + +## Schema01Boxed +public sealed interface Schema01Boxed
+permits
+[Schema01BoxedString](#schema01boxedstring) + +sealed interface that stores validated payloads using boxed classes + +## Schema01BoxedString +public record Schema01BoxedString
+implements [Schema01Boxed](#schema01boxed) + +record that stores validated String payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| Schema01BoxedString(String data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| String | data()
validated payload | +| @Nullable Object | getData()
validated payload | + +## Schema01 +public static class Schema01
+extends StringJsonSchema.StringJsonSchema1 + +A schema class that validates payloads + +| Methods Inherited from class org.openapijsonschematools.client.schemas.StringJsonSchema.StringJsonSchema1 | +| ------------------------------------------------------------------ | +| validate | +| validateAndBox | diff --git a/samples/client/petstore/kotlin/docs/paths/userlogin/get/parameters/parameter1/Schema1.md b/samples/client/petstore/kotlin/docs/paths/userlogin/get/parameters/parameter1/Schema1.md new file mode 100644 index 00000000000..63ec3a884fc --- /dev/null +++ b/samples/client/petstore/kotlin/docs/paths/userlogin/get/parameters/parameter1/Schema1.md @@ -0,0 +1,49 @@ +# Schema1 +public class Schema1
+ +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 + +## Nested Class Summary +| Modifier and Type | Class and Description | +| ----------------- | ---------------------- | +| sealed interface | [Schema1.Schema11Boxed](#schema11boxed)
sealed interface for validated payloads | +| record | [Schema1.Schema11BoxedString](#schema11boxedstring)
boxed class to store validated String payloads | +| static class | [Schema1.Schema11](#schema11)
schema class | + +## Schema11Boxed +public sealed interface Schema11Boxed
+permits
+[Schema11BoxedString](#schema11boxedstring) + +sealed interface that stores validated payloads using boxed classes + +## Schema11BoxedString +public record Schema11BoxedString
+implements [Schema11Boxed](#schema11boxed) + +record that stores validated String payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| Schema11BoxedString(String data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| String | data()
validated payload | +| @Nullable Object | getData()
validated payload | + +## Schema11 +public static class Schema11
+extends StringJsonSchema.StringJsonSchema1 + +A schema class that validates payloads + +| Methods Inherited from class org.openapijsonschematools.client.schemas.StringJsonSchema.StringJsonSchema1 | +| ------------------------------------------------------------------ | +| validate | +| validateAndBox | diff --git a/samples/client/petstore/kotlin/docs/paths/userlogin/get/responses/UserloginGetCode200Response.md b/samples/client/petstore/kotlin/docs/paths/userlogin/get/responses/UserloginGetCode200Response.md new file mode 100644 index 00000000000..c2719cbebc0 --- /dev/null +++ b/samples/client/petstore/kotlin/docs/paths/userlogin/get/responses/UserloginGetCode200Response.md @@ -0,0 +1,123 @@ +# UserloginGetCode200Response + +public class UserloginGetCode200Response + +A class that contains necessary nested response classes +- SealedMediaType, a sealed interface which contains all the schema/encoding info for each contentType +- records which implement SealedMediaType, the concrete media types +- SealedResponseBody, a sealed interface which contains all the contentType/schema types +- records which implement SealedResponseBody, the concrete response body types +- a class that extends ResponseDeserializer and is used to deserialize responses + +## Nested Class Summary +| Modifier and Type | Class and Description | +| ----------------- | --------------------- | +| sealed interface | [UserloginGetCode200Response.SealedMediaType](#sealedmediatype)
media type sealed interface | +| record | [UserloginGetCode200Response.ApplicationxmlMediaType](#applicationxmlmediatype)
record storing schema + encoding for a specific contentType | +| record | [UserloginGetCode200Response.ApplicationjsonMediaType](#applicationjsonmediatype)
record storing schema + encoding for a specific contentType | +| sealed interface | [UserloginGetCode200Response.SealedResponseBody](#sealedresponsebody)
response body sealed interface | +| record | [UserloginGetCode200Response.ApplicationxmlResponseBody](#applicationxmlresponsebody)
implements sealed interface to store response body | +| record | [UserloginGetCode200Response.ApplicationjsonResponseBody](#applicationjsonresponsebody)
implements sealed interface to store response body | +| static class | [UserloginGetCode200Response.UserloginGetCode200Response1](#userlogingetcode200response1)
class that deserializes responses | + +## SealedMediaType +public sealed interface SealedMediaType
+permits
+[ApplicationxmlMediaType](#applicationxmlmediatype), +[ApplicationjsonMediaType](#applicationjsonmediatype) + +sealed interface that stores schema and encoding info + +## ApplicationxmlMediaType +public record ApplicationxmlMediaType
+implements [SealedMediaType](#sealedmediatype), MediaType<[ApplicationxmlSchema.ApplicationxmlSchema1](../../../../paths/userlogin/get/responses/code200response/content/applicationxml/ApplicationxmlSchema.md#applicationxmlschema1), Nothing?> + +class storing schema info for a specific contentType + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| ApplicationxmlMediaType()
Creates an instance | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| [ApplicationxmlSchema.ApplicationxmlSchema1](../../../../paths/userlogin/get/responses/code200response/content/applicationxml/ApplicationxmlSchema.md#applicationxmlschema1) | schema()
the schema for this MediaType | +| Nothing? | encoding()
the encoding info | + +## ApplicationjsonMediaType +public record ApplicationjsonMediaType
+implements [SealedMediaType](#sealedmediatype), MediaType<[ApplicationjsonSchema.ApplicationjsonSchema1](../../../../paths/userlogin/get/responses/code200response/content/applicationjson/ApplicationjsonSchema.md#applicationjsonschema1), Nothing?> + +class storing schema info for a specific contentType + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| ApplicationjsonMediaType()
Creates an instance | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| [ApplicationjsonSchema.ApplicationjsonSchema1](../../../../paths/userlogin/get/responses/code200response/content/applicationjson/ApplicationjsonSchema.md#applicationjsonschema1) | schema()
the schema for this MediaType | +| Nothing? | encoding()
the encoding info | + +## SealedResponseBody +public sealed interface SealedResponseBody
+permits
+[ApplicationxmlResponseBody](#applicationxmlresponsebody), +[ApplicationjsonResponseBody](#applicationjsonresponsebody) + +sealed interface that stores response body + +## ApplicationxmlResponseBody +public record ApplicationxmlResponseBody
+implements [SealedResponseBody](#sealedresponsebody) + +A record class to store response body for contentType="application/xml" + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| ApplicationxmlResponseBody(ApplicationxmlSchema.StringJsonSchema1Boxed body)
Creates an instance | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| ApplicationxmlSchema.StringJsonSchema1Boxed | body()
returns the body passed in in the constructor | +## ApplicationjsonResponseBody +public record ApplicationjsonResponseBody
+implements [SealedResponseBody](#sealedresponsebody) + +A record class to store response body for contentType="application/json" + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| ApplicationjsonResponseBody(ApplicationjsonSchema.StringJsonSchema1Boxed body)
Creates an instance | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| ApplicationjsonSchema.StringJsonSchema1Boxed | body()
returns the body passed in in the constructor | + +## UserloginGetCode200Response1 +public static class UserloginGetCode200Response1
+extends ResponseDeserializer<[SealedResponseBody](#sealedresponsebody), [UserloginGetCode200ResponseHeadersSchema.UserloginGetCode200ResponseHeadersSchemaMap](../../../../paths/userlogin/get/responses/code200response/UserloginGetCode200ResponseHeadersSchema.md#userlogingetcode200responseheadersschemamap), [SealedMediaType](#sealedmediatype)> + +a class that deserializes responses + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| UserloginGetCode200Response1()
Creates an instance | + +### Field Summary +| Modifier and Type | Field and Description | +| ----------------- | --------------------- | +| Map | content = Map.ofEntries(
    new AbstractMap.SimpleEntry<>("application/xml", new [ApplicationxmlMediaType](#applicationxmlmediatype)()),
    new AbstractMap.SimpleEntry<>("application/json", new [ApplicationjsonMediaType](#applicationjsonmediatype)())
)
the contentType to schema info | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| ApiResponse<[SealedResponseBody](#sealedresponsebody), [UserloginGetCode200ResponseHeadersSchema.UserloginGetCode200ResponseHeadersSchemaMap](../../../../paths/userlogin/get/responses/code200response/UserloginGetCode200ResponseHeadersSchema.md#userlogingetcode200responseheadersschemamap)> | deserialize(HttpResponse response, SchemaConfiguration configuration)
called by endpoint when deserialize responses | diff --git a/samples/client/petstore/kotlin/docs/paths/userlogin/get/responses/UserloginGetCode400Response.md b/samples/client/petstore/kotlin/docs/paths/userlogin/get/responses/UserloginGetCode400Response.md new file mode 100644 index 00000000000..f093cb99296 --- /dev/null +++ b/samples/client/petstore/kotlin/docs/paths/userlogin/get/responses/UserloginGetCode400Response.md @@ -0,0 +1,32 @@ +# UserloginGetCode400Response + +public class UserloginGetCode400Response + +A class that contains necessary nested response classes +- a class that extends ResponseDeserializer and is used to deserialize responses + +## Nested Class Summary +| Modifier and Type | Class and Description | +| ----------------- | --------------------- | +| static class | [UserloginGetCode400Response.UserloginGetCode400Response1](#userlogingetcode400response1)
class that deserializes responses | + +## UserloginGetCode400Response1 +public static class UserloginGetCode400Response1
+extends ResponseDeserializer + +a class that deserializes responses + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| UserloginGetCode400Response1()
Creates an instance | + +### Field Summary +| Modifier and Type | Field and Description | +| ----------------- | --------------------- | +| Map | content = MapUtils.makeMap(
)
the contentType to schema info | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| ApiResponse | deserialize(HttpResponse response, SchemaConfiguration configuration)
called by endpoint when deserialize responses | diff --git a/samples/client/petstore/kotlin/docs/paths/userlogin/get/responses/code200response/UserloginGetCode200ResponseHeadersSchema.md b/samples/client/petstore/kotlin/docs/paths/userlogin/get/responses/code200response/UserloginGetCode200ResponseHeadersSchema.md new file mode 100644 index 00000000000..21bf75ce299 --- /dev/null +++ b/samples/client/petstore/kotlin/docs/paths/userlogin/get/responses/code200response/UserloginGetCode200ResponseHeadersSchema.md @@ -0,0 +1,389 @@ +# UserloginGetCode200ResponseHeadersSchema +public class UserloginGetCode200ResponseHeadersSchema
+ +A class that contains necessary nested +- schema classes (which validate payloads), extends JsonSchema +- sealed interfaces which store validated payloads, java version of a sum type +- boxed classes which store validated payloads, sealed permits class implementations +- classes to store validated map payloads, extends FrozenMap +- classes to build inputs for map payloads + +## Nested Class Summary +| Modifier and Type | Class and Description | +| ----------------- | ---------------------- | +| sealed interface | [UserloginGetCode200ResponseHeadersSchema.UserloginGetCode200ResponseHeadersSchema1Boxed](#userlogingetcode200responseheadersschema1boxed)
sealed interface for validated payloads | +| record | [UserloginGetCode200ResponseHeadersSchema.UserloginGetCode200ResponseHeadersSchema1BoxedMap](#userlogingetcode200responseheadersschema1boxedmap)
boxed class to store validated Map payloads | +| static class | [UserloginGetCode200ResponseHeadersSchema.UserloginGetCode200ResponseHeadersSchema1](#userlogingetcode200responseheadersschema1)
schema class | +| static class | [UserloginGetCode200ResponseHeadersSchema.UserloginGetCode200ResponseHeadersSchemaMapBuilder](#userlogingetcode200responseheadersschemamapbuilder)
builder for Map payloads | +| static class | [UserloginGetCode200ResponseHeadersSchema.UserloginGetCode200ResponseHeadersSchemaMap](#userlogingetcode200responseheadersschemamap)
output class for Map payloads | +| sealed interface | [UserloginGetCode200ResponseHeadersSchema.UserloginGetCode200ResponseAdditionalPropertiesBoxed](#userlogingetcode200responseadditionalpropertiesboxed)
sealed interface for validated payloads | +| record | [UserloginGetCode200ResponseHeadersSchema.UserloginGetCode200ResponseAdditionalPropertiesBoxedVoid](#userlogingetcode200responseadditionalpropertiesboxedvoid)
boxed class to store validated null payloads | +| record | [UserloginGetCode200ResponseHeadersSchema.UserloginGetCode200ResponseAdditionalPropertiesBoxedBoolean](#userlogingetcode200responseadditionalpropertiesboxedboolean)
boxed class to store validated boolean payloads | +| record | [UserloginGetCode200ResponseHeadersSchema.UserloginGetCode200ResponseAdditionalPropertiesBoxedNumber](#userlogingetcode200responseadditionalpropertiesboxednumber)
boxed class to store validated Number payloads | +| record | [UserloginGetCode200ResponseHeadersSchema.UserloginGetCode200ResponseAdditionalPropertiesBoxedString](#userlogingetcode200responseadditionalpropertiesboxedstring)
boxed class to store validated String payloads | +| record | [UserloginGetCode200ResponseHeadersSchema.UserloginGetCode200ResponseAdditionalPropertiesBoxedList](#userlogingetcode200responseadditionalpropertiesboxedlist)
boxed class to store validated List payloads | +| record | [UserloginGetCode200ResponseHeadersSchema.UserloginGetCode200ResponseAdditionalPropertiesBoxedMap](#userlogingetcode200responseadditionalpropertiesboxedmap)
boxed class to store validated Map payloads | +| static class | [UserloginGetCode200ResponseHeadersSchema.UserloginGetCode200ResponseAdditionalProperties](#userlogingetcode200responseadditionalproperties)
schema class | + +## UserloginGetCode200ResponseHeadersSchema1Boxed +public sealed interface UserloginGetCode200ResponseHeadersSchema1Boxed
+permits
+[UserloginGetCode200ResponseHeadersSchema1BoxedMap](#userlogingetcode200responseheadersschema1boxedmap) + +sealed interface that stores validated payloads using boxed classes + +## UserloginGetCode200ResponseHeadersSchema1BoxedMap +public record UserloginGetCode200ResponseHeadersSchema1BoxedMap
+implements [UserloginGetCode200ResponseHeadersSchema1Boxed](#userlogingetcode200responseheadersschema1boxed) + +record that stores validated Map payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| UserloginGetCode200ResponseHeadersSchema1BoxedMap([UserloginGetCode200ResponseHeadersSchemaMap](#userlogingetcode200responseheadersschemamap) data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| [UserloginGetCode200ResponseHeadersSchemaMap](#userlogingetcode200responseheadersschemamap) | data()
validated payload | +| @Nullable Object | getData()
validated payload | + +## UserloginGetCode200ResponseHeadersSchema1 +public static class UserloginGetCode200ResponseHeadersSchema1
+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.userlogin.get.responses.code200response.UserloginGetCode200ResponseHeadersSchema; + +import java.util.Arrays; +import java.util.List; +import java.util.AbstractMap; + +static final SchemaConfiguration configuration = new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().build()); + +// Map validation +UserloginGetCode200ResponseHeadersSchema.UserloginGetCode200ResponseHeadersSchemaMap validatedPayload = + UserloginGetCode200ResponseHeadersSchema.UserloginGetCode200ResponseHeadersSchema1.validate( + new UserloginGetCode200ResponseHeadersSchema.UserloginGetCode200ResponseHeadersSchemaMapBuilder() + .xHyphenMinusRateHyphenMinusLimit(1) + + .int32(1) + + .refHyphenMinusContentHyphenMinusSchemaHyphenMinusHeader("a") + + .xHyphenMinusExpiresHyphenMinusAfter("1970-01-01T00:00:00.00Z") + + .numberHeader("3.14") + + .build(), + configuration +); +``` + +### Field Summary +| Modifier and Type | Field and Description | +| ----------------- | ---------------------- | +| Set> | type = Set.of(Map.class) | +| Map> | properties = Map.ofEntries(
    new PropertyEntry("X-Rate-Limit", [XRateLimitSchema.XRateLimitSchema1.class](../../../../../paths/userlogin/get/responses/code200response/headers/xratelimit/content/applicationjson/XRateLimitSchema.md#xratelimitschema1)),
    new PropertyEntry("int32", [Int32JsonContentTypeHeaderSchema.Int32JsonContentTypeHeaderSchema1.class](../../../../../components/headers/int32jsoncontenttypeheader/content/applicationjson/Int32JsonContentTypeHeaderSchema.md#int32jsoncontenttypeheaderschema1)),
    new PropertyEntry("X-Expires-After", [XExpiresAfterSchema.XExpiresAfterSchema1.class](../../../../../paths/userlogin/get/responses/code200response/headers/xexpiresafter/XExpiresAfterSchema.md#xexpiresafterschema1)),
    new PropertyEntry("ref-content-schema-header", [StringWithValidation.StringWithValidation1.class](../../../../../components/schemas/StringWithValidation.md#stringwithvalidation1)),
    new PropertyEntry("numberHeader", [NumberHeaderSchema.NumberHeaderSchema1.class](../../../../../components/headers/numberheader/NumberHeaderSchema.md#numberheaderschema1))
)
| +| Set | required = Set.of(
    "X-Rate-Limit",
    "int32",
    "ref-content-schema-header"
)
| +| Class | additionalProperties = [UserloginGetCode200ResponseAdditionalProperties.class](#userlogingetcode200responseadditionalproperties) | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| [UserloginGetCode200ResponseHeadersSchemaMap](#userlogingetcode200responseheadersschemamap) | validate([Map<?, ?>](#userlogingetcode200responseheadersschemamapbuilder) arg, SchemaConfiguration configuration) | +| [UserloginGetCode200ResponseHeadersSchema1BoxedMap](#userlogingetcode200responseheadersschema1boxedmap) | validateAndBox([Map<?, ?>](#userlogingetcode200responseheadersschemamapbuilder) arg, SchemaConfiguration configuration) | +| [UserloginGetCode200ResponseHeadersSchema1Boxed](#userlogingetcode200responseheadersschema1boxed) | validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) | +| @Nullable Object | validate(@Nullable Object arg, SchemaConfiguration configuration) | + +## UserloginGetCode200ResponseHeadersSchemaMap000Builder +public class UserloginGetCode200ResponseHeadersSchemaMap000Builder
+builder for `Map` + +A class that builds the Map input type + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| UserloginGetCode200ResponseHeadersSchemaMap000Builder(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 | +| [UserloginGetCode200ResponseHeadersSchemaMap000Builder](#userlogingetcode200responseheadersschemamap000builder) | xHyphenMinusExpiresHyphenMinusAfter(String value) | +| [UserloginGetCode200ResponseHeadersSchemaMap000Builder](#userlogingetcode200responseheadersschemamap000builder) | numberHeader(String value) | + +## UserloginGetCode200ResponseHeadersSchemaMap001Builder +public class UserloginGetCode200ResponseHeadersSchemaMap001Builder
+builder for `Map` + +A class that builds the Map input type + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| UserloginGetCode200ResponseHeadersSchemaMap001Builder(Map instance)
Creates a builder that contains the passed instance | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| [UserloginGetCode200ResponseHeadersSchemaMap000Builder](#userlogingetcode200responseheadersschemamap000builder) | refHyphenMinusContentHyphenMinusSchemaHyphenMinusHeader(String value) | + +## UserloginGetCode200ResponseHeadersSchemaMap010Builder +public class UserloginGetCode200ResponseHeadersSchemaMap010Builder
+builder for `Map` + +A class that builds the Map input type + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| UserloginGetCode200ResponseHeadersSchemaMap010Builder(Map instance)
Creates a builder that contains the passed instance | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| [UserloginGetCode200ResponseHeadersSchemaMap000Builder](#userlogingetcode200responseheadersschemamap000builder) | int32(int value) | +| [UserloginGetCode200ResponseHeadersSchemaMap000Builder](#userlogingetcode200responseheadersschemamap000builder) | int32(float value) | + +## UserloginGetCode200ResponseHeadersSchemaMap011Builder +public class UserloginGetCode200ResponseHeadersSchemaMap011Builder
+builder for `Map` + +A class that builds the Map input type + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| UserloginGetCode200ResponseHeadersSchemaMap011Builder(Map instance)
Creates a builder that contains the passed instance | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| [UserloginGetCode200ResponseHeadersSchemaMap001Builder](#userlogingetcode200responseheadersschemamap001builder) | int32(int value) | +| [UserloginGetCode200ResponseHeadersSchemaMap001Builder](#userlogingetcode200responseheadersschemamap001builder) | int32(float value) | +| [UserloginGetCode200ResponseHeadersSchemaMap010Builder](#userlogingetcode200responseheadersschemamap010builder) | refHyphenMinusContentHyphenMinusSchemaHyphenMinusHeader(String value) | + +## UserloginGetCode200ResponseHeadersSchemaMap100Builder +public class UserloginGetCode200ResponseHeadersSchemaMap100Builder
+builder for `Map` + +A class that builds the Map input type + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| UserloginGetCode200ResponseHeadersSchemaMap100Builder(Map instance)
Creates a builder that contains the passed instance | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| [UserloginGetCode200ResponseHeadersSchemaMap000Builder](#userlogingetcode200responseheadersschemamap000builder) | xHyphenMinusRateHyphenMinusLimit(int value) | +| [UserloginGetCode200ResponseHeadersSchemaMap000Builder](#userlogingetcode200responseheadersschemamap000builder) | xHyphenMinusRateHyphenMinusLimit(float value) | + +## UserloginGetCode200ResponseHeadersSchemaMap101Builder +public class UserloginGetCode200ResponseHeadersSchemaMap101Builder
+builder for `Map` + +A class that builds the Map input type + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| UserloginGetCode200ResponseHeadersSchemaMap101Builder(Map instance)
Creates a builder that contains the passed instance | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| [UserloginGetCode200ResponseHeadersSchemaMap001Builder](#userlogingetcode200responseheadersschemamap001builder) | xHyphenMinusRateHyphenMinusLimit(int value) | +| [UserloginGetCode200ResponseHeadersSchemaMap001Builder](#userlogingetcode200responseheadersschemamap001builder) | xHyphenMinusRateHyphenMinusLimit(float value) | +| [UserloginGetCode200ResponseHeadersSchemaMap100Builder](#userlogingetcode200responseheadersschemamap100builder) | refHyphenMinusContentHyphenMinusSchemaHyphenMinusHeader(String value) | + +## UserloginGetCode200ResponseHeadersSchemaMap110Builder +public class UserloginGetCode200ResponseHeadersSchemaMap110Builder
+builder for `Map` + +A class that builds the Map input type + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| UserloginGetCode200ResponseHeadersSchemaMap110Builder(Map instance)
Creates a builder that contains the passed instance | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| [UserloginGetCode200ResponseHeadersSchemaMap010Builder](#userlogingetcode200responseheadersschemamap010builder) | xHyphenMinusRateHyphenMinusLimit(int value) | +| [UserloginGetCode200ResponseHeadersSchemaMap010Builder](#userlogingetcode200responseheadersschemamap010builder) | xHyphenMinusRateHyphenMinusLimit(float value) | +| [UserloginGetCode200ResponseHeadersSchemaMap100Builder](#userlogingetcode200responseheadersschemamap100builder) | int32(int value) | +| [UserloginGetCode200ResponseHeadersSchemaMap100Builder](#userlogingetcode200responseheadersschemamap100builder) | int32(float value) | + +## UserloginGetCode200ResponseHeadersSchemaMapBuilder +public class UserloginGetCode200ResponseHeadersSchemaMapBuilder
+builder for `Map` + +A class that builds the Map input type + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| UserloginGetCode200ResponseHeadersSchemaMapBuilder()
Creates a builder that contains an empty map | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| [UserloginGetCode200ResponseHeadersSchemaMap011Builder](#userlogingetcode200responseheadersschemamap011builder) | xHyphenMinusRateHyphenMinusLimit(int value) | +| [UserloginGetCode200ResponseHeadersSchemaMap011Builder](#userlogingetcode200responseheadersschemamap011builder) | xHyphenMinusRateHyphenMinusLimit(float value) | +| [UserloginGetCode200ResponseHeadersSchemaMap101Builder](#userlogingetcode200responseheadersschemamap101builder) | int32(int value) | +| [UserloginGetCode200ResponseHeadersSchemaMap101Builder](#userlogingetcode200responseheadersschemamap101builder) | int32(float value) | +| [UserloginGetCode200ResponseHeadersSchemaMap110Builder](#userlogingetcode200responseheadersschemamap110builder) | refHyphenMinusContentHyphenMinusSchemaHyphenMinusHeader(String value) | + +## UserloginGetCode200ResponseHeadersSchemaMap +public static class UserloginGetCode200ResponseHeadersSchemaMap
+extends FrozenMap + +A class to store validated Map payloads + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| static [UserloginGetCode200ResponseHeadersSchemaMap](#userlogingetcode200responseheadersschemamap) | of([Map](#userlogingetcode200responseheadersschemamapbuilder) arg, SchemaConfiguration configuration) | +| Number | int32()
| +| String | numberHeader()
[optional] | +| @Nullable Object | get(String key)
This schema has invalid Java names so this method must be used when you access instance["X-Rate-Limit"], instance["ref-content-schema-header"], instance["X-Expires-After"], | + +## UserloginGetCode200ResponseAdditionalPropertiesBoxed +public sealed interface UserloginGetCode200ResponseAdditionalPropertiesBoxed
+permits
+[UserloginGetCode200ResponseAdditionalPropertiesBoxedVoid](#userlogingetcode200responseadditionalpropertiesboxedvoid), +[UserloginGetCode200ResponseAdditionalPropertiesBoxedBoolean](#userlogingetcode200responseadditionalpropertiesboxedboolean), +[UserloginGetCode200ResponseAdditionalPropertiesBoxedNumber](#userlogingetcode200responseadditionalpropertiesboxednumber), +[UserloginGetCode200ResponseAdditionalPropertiesBoxedString](#userlogingetcode200responseadditionalpropertiesboxedstring), +[UserloginGetCode200ResponseAdditionalPropertiesBoxedList](#userlogingetcode200responseadditionalpropertiesboxedlist), +[UserloginGetCode200ResponseAdditionalPropertiesBoxedMap](#userlogingetcode200responseadditionalpropertiesboxedmap) + +sealed interface that stores validated payloads using boxed classes + +## UserloginGetCode200ResponseAdditionalPropertiesBoxedVoid +public record UserloginGetCode200ResponseAdditionalPropertiesBoxedVoid
+implements [UserloginGetCode200ResponseAdditionalPropertiesBoxed](#userlogingetcode200responseadditionalpropertiesboxed) + +record that stores validated null payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| UserloginGetCode200ResponseAdditionalPropertiesBoxedVoid(Nothing? data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| Nothing? | data()
validated payload | +| @Nullable Object | getData()
validated payload | + +## UserloginGetCode200ResponseAdditionalPropertiesBoxedBoolean +public record UserloginGetCode200ResponseAdditionalPropertiesBoxedBoolean
+implements [UserloginGetCode200ResponseAdditionalPropertiesBoxed](#userlogingetcode200responseadditionalpropertiesboxed) + +record that stores validated boolean payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| UserloginGetCode200ResponseAdditionalPropertiesBoxedBoolean(boolean data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| boolean | data()
validated payload | +| @Nullable Object | getData()
validated payload | + +## UserloginGetCode200ResponseAdditionalPropertiesBoxedNumber +public record UserloginGetCode200ResponseAdditionalPropertiesBoxedNumber
+implements [UserloginGetCode200ResponseAdditionalPropertiesBoxed](#userlogingetcode200responseadditionalpropertiesboxed) + +record that stores validated Number payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| UserloginGetCode200ResponseAdditionalPropertiesBoxedNumber(Number data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| Number | data()
validated payload | +| @Nullable Object | getData()
validated payload | + +## UserloginGetCode200ResponseAdditionalPropertiesBoxedString +public record UserloginGetCode200ResponseAdditionalPropertiesBoxedString
+implements [UserloginGetCode200ResponseAdditionalPropertiesBoxed](#userlogingetcode200responseadditionalpropertiesboxed) + +record that stores validated String payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| UserloginGetCode200ResponseAdditionalPropertiesBoxedString(String data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| String | data()
validated payload | +| @Nullable Object | getData()
validated payload | + +## UserloginGetCode200ResponseAdditionalPropertiesBoxedList +public record UserloginGetCode200ResponseAdditionalPropertiesBoxedList
+implements [UserloginGetCode200ResponseAdditionalPropertiesBoxed](#userlogingetcode200responseadditionalpropertiesboxed) + +record that stores validated List payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| UserloginGetCode200ResponseAdditionalPropertiesBoxedList(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 | + +## UserloginGetCode200ResponseAdditionalPropertiesBoxedMap +public record UserloginGetCode200ResponseAdditionalPropertiesBoxedMap
+implements [UserloginGetCode200ResponseAdditionalPropertiesBoxed](#userlogingetcode200responseadditionalpropertiesboxed) + +record that stores validated Map payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| UserloginGetCode200ResponseAdditionalPropertiesBoxedMap(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 | + +## UserloginGetCode200ResponseAdditionalProperties +public static class UserloginGetCode200ResponseAdditionalProperties
+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/kotlin/docs/paths/userlogin/get/responses/code200response/content/applicationjson/ApplicationjsonSchema.md b/samples/client/petstore/kotlin/docs/paths/userlogin/get/responses/code200response/content/applicationjson/ApplicationjsonSchema.md new file mode 100644 index 00000000000..fe0b32c3b81 --- /dev/null +++ b/samples/client/petstore/kotlin/docs/paths/userlogin/get/responses/code200response/content/applicationjson/ApplicationjsonSchema.md @@ -0,0 +1,49 @@ +# ApplicationjsonSchema +public class ApplicationjsonSchema
+ +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 + +## Nested Class Summary +| Modifier and Type | Class and Description | +| ----------------- | ---------------------- | +| sealed interface | [ApplicationjsonSchema.ApplicationjsonSchema1Boxed](#applicationjsonschema1boxed)
sealed interface for validated payloads | +| record | [ApplicationjsonSchema.ApplicationjsonSchema1BoxedString](#applicationjsonschema1boxedstring)
boxed class to store validated String payloads | +| static class | [ApplicationjsonSchema.ApplicationjsonSchema1](#applicationjsonschema1)
schema class | + +## ApplicationjsonSchema1Boxed +public sealed interface ApplicationjsonSchema1Boxed
+permits
+[ApplicationjsonSchema1BoxedString](#applicationjsonschema1boxedstring) + +sealed interface that stores validated payloads using boxed classes + +## ApplicationjsonSchema1BoxedString +public record ApplicationjsonSchema1BoxedString
+implements [ApplicationjsonSchema1Boxed](#applicationjsonschema1boxed) + +record that stores validated String payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| ApplicationjsonSchema1BoxedString(String data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| String | data()
validated payload | +| @Nullable Object | getData()
validated payload | + +## ApplicationjsonSchema1 +public static class ApplicationjsonSchema1
+extends StringJsonSchema.StringJsonSchema1 + +A schema class that validates payloads + +| Methods Inherited from class org.openapijsonschematools.client.schemas.StringJsonSchema.StringJsonSchema1 | +| ------------------------------------------------------------------ | +| validate | +| validateAndBox | diff --git a/samples/client/petstore/kotlin/docs/paths/userlogin/get/responses/code200response/content/applicationxml/ApplicationxmlSchema.md b/samples/client/petstore/kotlin/docs/paths/userlogin/get/responses/code200response/content/applicationxml/ApplicationxmlSchema.md new file mode 100644 index 00000000000..81b5c1d6689 --- /dev/null +++ b/samples/client/petstore/kotlin/docs/paths/userlogin/get/responses/code200response/content/applicationxml/ApplicationxmlSchema.md @@ -0,0 +1,49 @@ +# ApplicationxmlSchema +public class ApplicationxmlSchema
+ +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 + +## Nested Class Summary +| Modifier and Type | Class and Description | +| ----------------- | ---------------------- | +| sealed interface | [ApplicationxmlSchema.ApplicationxmlSchema1Boxed](#applicationxmlschema1boxed)
sealed interface for validated payloads | +| record | [ApplicationxmlSchema.ApplicationxmlSchema1BoxedString](#applicationxmlschema1boxedstring)
boxed class to store validated String payloads | +| static class | [ApplicationxmlSchema.ApplicationxmlSchema1](#applicationxmlschema1)
schema class | + +## ApplicationxmlSchema1Boxed +public sealed interface ApplicationxmlSchema1Boxed
+permits
+[ApplicationxmlSchema1BoxedString](#applicationxmlschema1boxedstring) + +sealed interface that stores validated payloads using boxed classes + +## ApplicationxmlSchema1BoxedString +public record ApplicationxmlSchema1BoxedString
+implements [ApplicationxmlSchema1Boxed](#applicationxmlschema1boxed) + +record that stores validated String payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| ApplicationxmlSchema1BoxedString(String data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| String | data()
validated payload | +| @Nullable Object | getData()
validated payload | + +## ApplicationxmlSchema1 +public static class ApplicationxmlSchema1
+extends StringJsonSchema.StringJsonSchema1 + +A schema class that validates payloads + +| Methods Inherited from class org.openapijsonschematools.client.schemas.StringJsonSchema.StringJsonSchema1 | +| ------------------------------------------------------------------ | +| validate | +| validateAndBox | diff --git a/samples/client/petstore/kotlin/docs/paths/userlogin/get/responses/code200response/headers/xexpiresafter/XExpiresAfterSchema.md b/samples/client/petstore/kotlin/docs/paths/userlogin/get/responses/code200response/headers/xexpiresafter/XExpiresAfterSchema.md new file mode 100644 index 00000000000..20c88d889d0 --- /dev/null +++ b/samples/client/petstore/kotlin/docs/paths/userlogin/get/responses/code200response/headers/xexpiresafter/XExpiresAfterSchema.md @@ -0,0 +1,49 @@ +# XExpiresAfterSchema +public class XExpiresAfterSchema
+ +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 + +## Nested Class Summary +| Modifier and Type | Class and Description | +| ----------------- | ---------------------- | +| sealed interface | [XExpiresAfterSchema.XExpiresAfterSchema1Boxed](#xexpiresafterschema1boxed)
sealed interface for validated payloads | +| record | [XExpiresAfterSchema.XExpiresAfterSchema1BoxedString](#xexpiresafterschema1boxedstring)
boxed class to store validated String payloads | +| static class | [XExpiresAfterSchema.XExpiresAfterSchema1](#xexpiresafterschema1)
schema class | + +## XExpiresAfterSchema1Boxed +public sealed interface XExpiresAfterSchema1Boxed
+permits
+[XExpiresAfterSchema1BoxedString](#xexpiresafterschema1boxedstring) + +sealed interface that stores validated payloads using boxed classes + +## XExpiresAfterSchema1BoxedString +public record XExpiresAfterSchema1BoxedString
+implements [XExpiresAfterSchema1Boxed](#xexpiresafterschema1boxed) + +record that stores validated String payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| XExpiresAfterSchema1BoxedString(String data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| String | data()
validated payload | +| @Nullable Object | getData()
validated payload | + +## XExpiresAfterSchema1 +public static class XExpiresAfterSchema1
+extends DateTimeJsonSchema.DateTimeJsonSchema1 + +A schema class that validates payloads + +| Methods Inherited from class org.openapijsonschematools.client.schemas.DateTimeJsonSchema.DateTimeJsonSchema1 | +| ------------------------------------------------------------------ | +| validate | +| validateAndBox | diff --git a/samples/client/petstore/kotlin/docs/paths/userlogin/get/responses/code200response/headers/xratelimit/content/applicationjson/XRateLimitSchema.md b/samples/client/petstore/kotlin/docs/paths/userlogin/get/responses/code200response/headers/xratelimit/content/applicationjson/XRateLimitSchema.md new file mode 100644 index 00000000000..76dfd4f33af --- /dev/null +++ b/samples/client/petstore/kotlin/docs/paths/userlogin/get/responses/code200response/headers/xratelimit/content/applicationjson/XRateLimitSchema.md @@ -0,0 +1,49 @@ +# XRateLimitSchema +public class XRateLimitSchema
+ +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 + +## Nested Class Summary +| Modifier and Type | Class and Description | +| ----------------- | ---------------------- | +| sealed interface | [XRateLimitSchema.XRateLimitSchema1Boxed](#xratelimitschema1boxed)
sealed interface for validated payloads | +| record | [XRateLimitSchema.XRateLimitSchema1BoxedNumber](#xratelimitschema1boxednumber)
boxed class to store validated Number payloads | +| static class | [XRateLimitSchema.XRateLimitSchema1](#xratelimitschema1)
schema class | + +## XRateLimitSchema1Boxed +public sealed interface XRateLimitSchema1Boxed
+permits
+[XRateLimitSchema1BoxedNumber](#xratelimitschema1boxednumber) + +sealed interface that stores validated payloads using boxed classes + +## XRateLimitSchema1BoxedNumber +public record XRateLimitSchema1BoxedNumber
+implements [XRateLimitSchema1Boxed](#xratelimitschema1boxed) + +record that stores validated Number payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| XRateLimitSchema1BoxedNumber(Number data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| Number | data()
validated payload | +| @Nullable Object | getData()
validated payload | + +## XRateLimitSchema1 +public static class XRateLimitSchema1
+extends Int32JsonSchema.Int32JsonSchema1 + +A schema class that validates payloads + +| Methods Inherited from class org.openapijsonschematools.client.schemas.Int32JsonSchema.Int32JsonSchema1 | +| ------------------------------------------------------------------ | +| validate | +| validateAndBox | diff --git a/samples/client/petstore/kotlin/docs/paths/userlogout/UserlogoutGet.md b/samples/client/petstore/kotlin/docs/paths/userlogout/UserlogoutGet.md new file mode 100644 index 00000000000..6329d5a2ccd --- /dev/null +++ b/samples/client/petstore/kotlin/docs/paths/userlogout/UserlogoutGet.md @@ -0,0 +1,142 @@ +# UserlogoutGet + +public class UserlogoutGet + +A class that contains necessary endpoint classes +- a class that calls the endpoint method using the http verb +- a class that calls the endpoint method using the operationId name +- class(es) to store the request inputs +- builder(s) to set the request input data + +## Nested Class Summary +| Modifier and Type | Class and Description | +| ----------------- | --------------------- | +| static class | [Get](#get)
The class that has a get method to call the endpoint | +| interface | [LogoutUserOperation](#logoutuseroperation)
The interface that has a logoutUser method to call the endpoint | +| static class | [GetRequest](#getrequest)
The request inputs class | +| static class | [GetRequestBuilder](#getrequestbuilder)
A builder for the request input class | + +## Get +public static class Get extends ApiClient.ApiClient1 implements GetOperation
+ +a class that allows one to call the endpoint using a method named get + +### 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.servers.RootServer0; +import org.openapijsonschematools.client.servers.RootServer1; +import org.openapijsonschematools.client.servers.RootServer2; +import org.openapijsonschematools.client.paths.userlogout.get.responses.UserlogoutGetCodedefaultResponse; +import org.openapijsonschematools.client.servers.RootServerInfo; +import org.openapijsonschematools.client.paths.userlogout.UserlogoutGet; +import org.openapijsonschematools.client.paths.userlogout.get.UserlogoutGetResponses; + +import java.io.IOException; +import java.util.Arrays; +import java.util.List; +import java.util.Map; +import java.util.AbstractMap; + +// if you want to use a server that is not SERVER_0 pass it in here and change the ServerIndex input below +ApiConfiguration.ServerInfo serverInfo = new ApiConfiguration.ServerInfoBuilder() + .rootServerInfo( + new RootServerInfo.RootServerInfoBuilder() + .rootServer0(new RootServer0()) + .build() + ) + .build(); +ApiConfiguration.ServerIndexInfo serverIndexInfo = new ApiConfiguration.ServerIndexInfoBuilder() + .rootServerInfoServerIndex(RootServerInfo.ServerIndex.SERVER_0) + .build(); +Duration timeout = Duration.ofSeconds(1L); +Map> defaultHeaders = Map.of("User-Agent", List.of("OpenAPI-JSON-Schema-Generator/1.0.0/java")); +ApiConfiguration apiConfiguration = new ApiConfiguration( + serverInfo + serverIndexInfo, + timeout, + defaultHeaders +); +SchemaConfiguration schemaConfiguration = new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().build()); +UserlogoutGet.Get apiClient = new UserlogoutGet.Get(apiConfiguration, schemaConfiguration); + + +var request = new UserlogoutGet.GetRequestBuilder().build(); + +UserlogoutGetResponses.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; +} +UserlogoutGetResponses.EndpointUserlogoutGetCodedefaultResponse castResponse = (UserlogoutGetResponses.EndpointUserlogoutGetCodedefaultResponse) response; +``` +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| Get(ApiConfiguration apiConfiguration, SchemaConfiguration schemaConfiguration)
Creates an instance | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| [UserlogoutGetResponses.EndpointResponse](../../paths/userlogout/get/UserlogoutGetResponses.md#endpointresponse) | get([GetRequest](#getrequest) request) | + +## LogoutUserOperation +public interface LogoutUserOperation
+ +an interface that allows one to call the endpoint using a method named logoutUser by the operationId + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| [UserlogoutGetResponses.EndpointResponse](../../paths/userlogout/get/UserlogoutGetResponses.md#endpointresponse) | logoutUser([GetRequest](#getrequest) request) | + +## GetRequest +public static class GetRequest
+ +a class that stores the final request inputs + +### Field Summary +| Modifier and Type | Field and Description | +| ----------------- | --------------------- | +| [RootServerInfo.@Nullable ServerIndex](../../RootServerInfo.md#serverindex) | serverIndex
optional. Note: this will override the value in apiConfiguration | +| @Nullable Duration | timeout
optional. Note: this will override the value in apiConfiguration | + +## GetRequestBuilder +public static class GetRequestBuilder
+ +a builder for request inputs + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| GetRequestBuilder()
Creates a builder that contains null for all parameters | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| [GetRequest](#getrequest) | build()
Returns the request input used to call an endpoint method | +| [GetRequestBuilder](#getrequestbuilder) | serverIndex([RootServerInfo.ServerIndex](../../RootServerInfo.md#serverindex) serverIndex)
sets the optional property. Note: this will override the value in apiConfiguration | +| [GetRequestBuilder](#getrequestbuilder) | timeout(Duration timeout)
sets the optional property. Note: this will override the value in apiConfiguration | + +[[Back to top]](#top) [[Back to README]](../../../README.md) diff --git a/samples/client/petstore/kotlin/docs/paths/userlogout/get/UserlogoutGetResponses.md b/samples/client/petstore/kotlin/docs/paths/userlogout/get/UserlogoutGetResponses.md new file mode 100644 index 00000000000..8bd75b7e6fa --- /dev/null +++ b/samples/client/petstore/kotlin/docs/paths/userlogout/get/UserlogoutGetResponses.md @@ -0,0 +1,29 @@ +# UserlogoutGetResponses + +public class UserlogoutGetResponses + +A class that contains necessary responses classes +- a sealed interface, EndpointResponse, that stores endpoint responses +- records for each endpoint response + +## Nested Class Summary +| Modifier and Type | Class and Description | +| ----------------- | --------------------- | +| sealed interface | [EndpointResponse](#endpointresponse)
stores the endpoint responses | +| record | [EndpointUserlogoutGetCodedefaultResponse](#endpointuserlogoutgetcodedefaultresponse)
the response for default | + +## EndpointResponse +public sealed interface EndpointResponse permits
+[EndpointUserlogoutGetCodedefaultResponse](#endpointuserlogoutgetcodedefaultresponse) + +a sealed interface that stores endpoint responses + +## EndpointUserlogoutGetCodedefaultResponse +public record EndpointUserlogoutGetCodedefaultResponse( + HttpResponse response, + Nothing? body, + Nothing? headers +) implements EndpointResponse, ApiResponse
+ +a class that stores an endpoint response + diff --git a/samples/client/petstore/kotlin/docs/paths/userlogout/get/responses/UserlogoutGetCodedefaultResponse.md b/samples/client/petstore/kotlin/docs/paths/userlogout/get/responses/UserlogoutGetCodedefaultResponse.md new file mode 100644 index 00000000000..7f34ffefe37 --- /dev/null +++ b/samples/client/petstore/kotlin/docs/paths/userlogout/get/responses/UserlogoutGetCodedefaultResponse.md @@ -0,0 +1,17 @@ +# UserlogoutGetCodedefaultResponse + +public class UserlogoutGetCodedefaultResponse extends [RefSuccessDescriptionOnly](../../components/responses/RefSuccessDescriptionOnly.md) + +A class (extended from the $ref class) that contains necessary nested response classes +- a class that extends ResponseDeserializer and is used to deserialize responses + +## Nested Class Summary +| Modifier and Type | Class and Description | +| ----------------- | --------------------- | +| static class | [UserlogoutGetCodedefaultResponse.UserlogoutGetCodedefaultResponse1](#userlogoutgetcodedefaultresponse1)
class that deserializes responses | + +## UserlogoutGetCodedefaultResponse1 +public static class UserlogoutGetCodedefaultResponse1 extends [RefSuccessDescriptionOnly1](../../components/responses/RefSuccessDescriptionOnly.md#refsuccessdescriptiononly1)
+ +a class that deserializes responses, extended from the $ref class + diff --git a/samples/client/petstore/kotlin/docs/paths/userusername/UserusernameDelete.md b/samples/client/petstore/kotlin/docs/paths/userusername/UserusernameDelete.md new file mode 100644 index 00000000000..6215a06f511 --- /dev/null +++ b/samples/client/petstore/kotlin/docs/paths/userusername/UserusernameDelete.md @@ -0,0 +1,189 @@ +# UserusernameDelete + +public class UserusernameDelete + +A class that contains necessary endpoint classes +- a class that calls the endpoint method using the http verb +- a class that calls the endpoint method using the operationId name +- class(es) to store the request inputs +- builder(s) to set the request input data + +## Nested Class Summary +| Modifier and Type | Class and Description | +| ----------------- | --------------------- | +| static class | [Delete](#delete)
The class that has a delete method to call the endpoint | +| interface | [DeleteUserOperation](#deleteuseroperation)
The interface that has a deleteUser method to call the endpoint | +| static class | [DeleteRequest](#deleterequest)
The final request inputs class | +| static class | [DeleteNullableRequest](#deletenullablerequest)
The initial request inputs class | +| static class | [Delete0RequestBuilder](#delete0requestbuilder)
A builder for the request input class | +| static class | [DeleteRequestBuilder](#deleterequestbuilder)
A builder for the request input class | + +## Delete +public static class Delete extends ApiClient.ApiClient1 implements DeleteOperation
+ +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.userusername.delete.UserusernameDeletePathParameters; +import org.openapijsonschematools.client.servers.RootServer0; +import org.openapijsonschematools.client.servers.RootServer1; +import org.openapijsonschematools.client.servers.RootServer2; +import org.openapijsonschematools.client.paths.userusername.delete.responses.UserusernameDeleteCode200Response; +import org.openapijsonschematools.client.paths.userusername.delete.responses.UserusernameDeleteCode404Response; +import org.openapijsonschematools.client.servers.RootServerInfo; +import org.openapijsonschematools.client.paths.userusername.UserusernameDelete; +import org.openapijsonschematools.client.paths.userusername.delete.UserusernameDeleteResponses; + +import java.io.IOException; +import java.util.Arrays; +import java.util.List; +import java.util.Map; +import java.util.AbstractMap; + +// if you want to use a server that is not SERVER_0 pass it in here and change the ServerIndex input below +ApiConfiguration.ServerInfo serverInfo = new ApiConfiguration.ServerInfoBuilder() + .rootServerInfo( + new RootServerInfo.RootServerInfoBuilder() + .rootServer0(new RootServer0()) + .build() + ) + .build(); +ApiConfiguration.ServerIndexInfo serverIndexInfo = new ApiConfiguration.ServerIndexInfoBuilder() + .rootServerInfoServerIndex(RootServerInfo.ServerIndex.SERVER_0) + .build(); +Duration timeout = Duration.ofSeconds(1L); +Map> defaultHeaders = Map.of("User-Agent", List.of("OpenAPI-JSON-Schema-Generator/1.0.0/java")); +ApiConfiguration apiConfiguration = new ApiConfiguration( + serverInfo + serverIndexInfo, + timeout, + defaultHeaders +); +SchemaConfiguration schemaConfiguration = new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().build()); +UserusernameDelete.Delete apiClient = new UserusernameDelete.Delete(apiConfiguration, schemaConfiguration); + + +// Map validation +UserusernameDeletePathParameters.PathParametersMap pathParameters = + UserusernameDeletePathParameters.UserusernameDeletePathParameters1.validate( + new UserusernameDeletePathParameters.PathParametersMapBuilder() + .username("a") + + .build(), + schemaConfiguration +); + +var request = new UserusernameDelete.DeleteRequestBuilder() + .pathParameters(pathParameters) + .build(); + +UserusernameDeleteResponses.EndpointResponse response; +try { + response = apiClient.delete(request); +} catch (UserusernameDeleteCode404Response.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; +} +UserusernameDeleteResponses.EndpointUserusernameDeleteCode200Response castResponse = (UserusernameDeleteResponses.EndpointUserusernameDeleteCode200Response) response; +``` +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| Delete(ApiConfiguration apiConfiguration, SchemaConfiguration schemaConfiguration)
Creates an instance | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| [UserusernameDeleteResponses.EndpointResponse](../../paths/userusername/delete/UserusernameDeleteResponses.md#endpointresponse) | delete([DeleteRequest](#deleterequest) request) | + +## DeleteUserOperation +public interface DeleteUserOperation
+ +an interface that allows one to call the endpoint using a method named deleteUser by the operationId + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| [UserusernameDeleteResponses.EndpointResponse](../../paths/userusername/delete/UserusernameDeleteResponses.md#endpointresponse) | deleteUser([DeleteRequest](#deleterequest) request) | + +## DeleteRequest +public static class DeleteRequest
+ +a class that stores the final request inputs + +### Field Summary +| Modifier and Type | Field and Description | +| ----------------- | --------------------- | +| [UserusernameDeletePathParameters.PathParametersMap](../../paths/userusername/delete/UserusernameDeletePathParameters.md#pathparametersmap) | pathParameters | +| [RootServerInfo.@Nullable ServerIndex](../../RootServerInfo.md#serverindex) | serverIndex
optional. Note: this will override the value in apiConfiguration | +| @Nullable Duration | timeout
optional. Note: this will override the value in apiConfiguration | + +## DeleteNullableRequest +public static class DeleteNullableRequest
+ +a class that stores the initial request inputs + +### Field Summary +| Modifier and Type | Field and Description | +| ----------------- | --------------------- | +| [UserusernameDeletePathParameters.@Nullable PathParametersMap](../../paths/userusername/delete/UserusernameDeletePathParameters.md#pathparametersmap) | pathParameters | +| [RootServerInfo.@Nullable ServerIndex](../../RootServerInfo.md#serverindex) | serverIndex | +| @Nullable Duration | timeout | + +## Delete0RequestBuilder +public static class Delete0RequestBuilder
+ +a builder for request inputs + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| Delete0RequestBuilder(Delete0RequestBuilder instance)
Creates a builder that contains the passed instance | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| [DeleteRequest](#deleterequest) | build()
Returns the request input used to call an endpoint method | +| [Delete0RequestBuilder](#delete0requestbuilder) | serverIndex([RootServerInfo.ServerIndex](../../RootServerInfo.md#serverindex) serverIndex)
sets the optional property. Note: this will override the value in apiConfiguration | +| [Delete0RequestBuilder](#delete0requestbuilder) | timeout(Duration timeout)
sets the optional property. Note: this will override the value in apiConfiguration | + +## DeleteRequestBuilder +public static class DeleteRequestBuilder
+ +a builder for request inputs + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| DeleteRequestBuilder()
Creates a builder that contains null for all parameters | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| [Delete0RequestBuilder](#delete0requestbuilder) | pathParameters([UserusernameDeletePathParametersPathParametersMap](../../paths/userusername/delete/UserusernameDeletePathParameters.md#pathparametersmap) pathParameters)
sets the property | + +[[Back to top]](#top) [[Back to README]](../../../README.md) diff --git a/samples/client/petstore/kotlin/docs/paths/userusername/UserusernameGet.md b/samples/client/petstore/kotlin/docs/paths/userusername/UserusernameGet.md new file mode 100644 index 00000000000..b0313b2f26f --- /dev/null +++ b/samples/client/petstore/kotlin/docs/paths/userusername/UserusernameGet.md @@ -0,0 +1,196 @@ +# UserusernameGet + +public class UserusernameGet + +A class that contains necessary endpoint classes +- a class that calls the endpoint method using the http verb +- a class that calls the endpoint method using the operationId name +- class(es) to store the request inputs +- builder(s) to set the request input data + +## Nested Class Summary +| Modifier and Type | Class and Description | +| ----------------- | --------------------- | +| static class | [Get](#get)
The class that has a get method to call the endpoint | +| interface | [GetUserByNameOperation](#getuserbynameoperation)
The interface that has a getUserByName method to call the endpoint | +| static class | [GetRequest](#getrequest)
The final request inputs class | +| static class | [GetNullableRequest](#getnullablerequest)
The initial request inputs class | +| static class | [Get0RequestBuilder](#get0requestbuilder)
A builder for the request input class | +| static class | [GetRequestBuilder](#getrequestbuilder)
A builder for the request input class | + +## Get +public static class Get extends ApiClient.ApiClient1 implements GetOperation
+ +a class that allows one to call the endpoint using a method named get + +### 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.userusername.get.UserusernameGetPathParameters; +import org.openapijsonschematools.client.servers.RootServer0; +import org.openapijsonschematools.client.servers.RootServer1; +import org.openapijsonschematools.client.servers.RootServer2; +import org.openapijsonschematools.client.paths.userusername.get.responses.UserusernameGetCode200Response; +import org.openapijsonschematools.client.paths.userusername.get.responses.UserusernameGetCode400Response; +import org.openapijsonschematools.client.paths.userusername.get.responses.UserusernameGetCode404Response; +import org.openapijsonschematools.client.servers.RootServerInfo; +import org.openapijsonschematools.client.paths.userusername.UserusernameGet; +import org.openapijsonschematools.client.paths.userusername.get.UserusernameGetResponses; + +import java.io.IOException; +import java.util.Arrays; +import java.util.List; +import java.util.Map; +import java.util.AbstractMap; + +// if you want to use a server that is not SERVER_0 pass it in here and change the ServerIndex input below +ApiConfiguration.ServerInfo serverInfo = new ApiConfiguration.ServerInfoBuilder() + .rootServerInfo( + new RootServerInfo.RootServerInfoBuilder() + .rootServer0(new RootServer0()) + .build() + ) + .build(); +ApiConfiguration.ServerIndexInfo serverIndexInfo = new ApiConfiguration.ServerIndexInfoBuilder() + .rootServerInfoServerIndex(RootServerInfo.ServerIndex.SERVER_0) + .build(); +Duration timeout = Duration.ofSeconds(1L); +Map> defaultHeaders = Map.of("User-Agent", List.of("OpenAPI-JSON-Schema-Generator/1.0.0/java")); +ApiConfiguration apiConfiguration = new ApiConfiguration( + serverInfo + serverIndexInfo, + timeout, + defaultHeaders +); +SchemaConfiguration schemaConfiguration = new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().build()); +UserusernameGet.Get apiClient = new UserusernameGet.Get(apiConfiguration, schemaConfiguration); + + +// Map validation +UserusernameGetPathParameters.PathParametersMap pathParameters = + UserusernameGetPathParameters.UserusernameGetPathParameters1.validate( + new UserusernameGetPathParameters.PathParametersMapBuilder() + .username("a") + + .build(), + schemaConfiguration +); + +var request = new UserusernameGet.GetRequestBuilder() + .pathParameters(pathParameters) + .build(); + +UserusernameGetResponses.EndpointResponse response; +try { + response = apiClient.get(request); +} catch (UserusernameGetCode400Response.ResponseApiException | UserusernameGetCode404Response.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; +} +UserusernameGetResponses.EndpointUserusernameGetCode200Response castResponse = (UserusernameGetResponses.EndpointUserusernameGetCode200Response) response; +if (castResponse.body instanceof UserusernameGetCode200Response.ApplicationxmlResponseBody deserializedBody) { + // handle deserialized body here +} else { + UserusernameGetCode200Response.ApplicationjsonResponseBody deserializedBody = (UserusernameGetCode200Response.ApplicationjsonResponseBody) castResponse.body; + // handle deserialized body here +} +``` +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| Get(ApiConfiguration apiConfiguration, SchemaConfiguration schemaConfiguration)
Creates an instance | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| [UserusernameGetResponses.EndpointResponse](../../paths/userusername/get/UserusernameGetResponses.md#endpointresponse) | get([GetRequest](#getrequest) request) | + +## GetUserByNameOperation +public interface GetUserByNameOperation
+ +an interface that allows one to call the endpoint using a method named getUserByName by the operationId + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| [UserusernameGetResponses.EndpointResponse](../../paths/userusername/get/UserusernameGetResponses.md#endpointresponse) | getUserByName([GetRequest](#getrequest) request) | + +## GetRequest +public static class GetRequest
+ +a class that stores the final request inputs + +### Field Summary +| Modifier and Type | Field and Description | +| ----------------- | --------------------- | +| [UserusernameGetPathParameters.PathParametersMap](../../paths/userusername/get/UserusernameGetPathParameters.md#pathparametersmap) | pathParameters | +| [RootServerInfo.@Nullable ServerIndex](../../RootServerInfo.md#serverindex) | serverIndex
optional. Note: this will override the value in apiConfiguration | +| @Nullable Duration | timeout
optional. Note: this will override the value in apiConfiguration | + +## GetNullableRequest +public static class GetNullableRequest
+ +a class that stores the initial request inputs + +### Field Summary +| Modifier and Type | Field and Description | +| ----------------- | --------------------- | +| [UserusernameGetPathParameters.@Nullable PathParametersMap](../../paths/userusername/get/UserusernameGetPathParameters.md#pathparametersmap) | pathParameters | +| [RootServerInfo.@Nullable ServerIndex](../../RootServerInfo.md#serverindex) | serverIndex | +| @Nullable Duration | timeout | + +## Get0RequestBuilder +public static class Get0RequestBuilder
+ +a builder for request inputs + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| Get0RequestBuilder(Get0RequestBuilder instance)
Creates a builder that contains the passed instance | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| [GetRequest](#getrequest) | build()
Returns the request input used to call an endpoint method | +| [Get0RequestBuilder](#get0requestbuilder) | serverIndex([RootServerInfo.ServerIndex](../../RootServerInfo.md#serverindex) serverIndex)
sets the optional property. Note: this will override the value in apiConfiguration | +| [Get0RequestBuilder](#get0requestbuilder) | timeout(Duration timeout)
sets the optional property. Note: this will override the value in apiConfiguration | + +## GetRequestBuilder +public static class GetRequestBuilder
+ +a builder for request inputs + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| GetRequestBuilder()
Creates a builder that contains null for all parameters | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| [Get0RequestBuilder](#get0requestbuilder) | pathParameters([UserusernameGetPathParametersPathParametersMap](../../paths/userusername/get/UserusernameGetPathParameters.md#pathparametersmap) pathParameters)
sets the property | + +[[Back to top]](#top) [[Back to README]](../../../README.md) diff --git a/samples/client/petstore/kotlin/docs/paths/userusername/UserusernamePut.md b/samples/client/petstore/kotlin/docs/paths/userusername/UserusernamePut.md new file mode 100644 index 00000000000..b8830085972 --- /dev/null +++ b/samples/client/petstore/kotlin/docs/paths/userusername/UserusernamePut.md @@ -0,0 +1,252 @@ +# UserusernamePut + +public class UserusernamePut + +A class that contains necessary endpoint classes +- a class that calls the endpoint method using the http verb +- a class that calls the endpoint method using the operationId name +- class(es) to store the request inputs +- builder(s) to set the request input data + +## Nested Class Summary +| Modifier and Type | Class and Description | +| ----------------- | --------------------- | +| static class | [Put](#put)
The class that has a put method to call the endpoint | +| interface | [UpdateUserOperation](#updateuseroperation)
The interface that has a updateUser method to call the endpoint | +| static class | [PutRequest](#putrequest)
The final request inputs class | +| static class | [PutNullableRequest](#putnullablerequest)
The initial request inputs class | +| static class | [Put00RequestBuilder](#put00requestbuilder)
A builder for the request input class | +| static class | [Put01RequestBuilder](#put01requestbuilder)
A builder for the request input class | +| static class | [Put10RequestBuilder](#put10requestbuilder)
A builder for the request input class | +| static class | [PutRequestBuilder](#putrequestbuilder)
A builder for the request input class | + +## Put +public static class Put extends ApiClient.ApiClient1 implements PutOperation
+ +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.userusername.put.UserusernamePutRequestBody; +import org.openapijsonschematools.client.components.schemas.User; +import org.openapijsonschematools.client.paths.userusername.put.UserusernamePutPathParameters; +import org.openapijsonschematools.client.servers.RootServer0; +import org.openapijsonschematools.client.servers.RootServer1; +import org.openapijsonschematools.client.servers.RootServer2; +import org.openapijsonschematools.client.paths.userusername.put.responses.UserusernamePutCode400Response; +import org.openapijsonschematools.client.paths.userusername.put.responses.UserusernamePutCode404Response; +import org.openapijsonschematools.client.servers.RootServerInfo; +import org.openapijsonschematools.client.paths.userusername.UserusernamePut; +import org.openapijsonschematools.client.paths.userusername.put.UserusernamePutResponses; + +import java.io.IOException; +import java.util.Arrays; +import java.util.List; +import java.util.Map; +import java.util.AbstractMap; + +// if you want to use a server that is not SERVER_0 pass it in here and change the ServerIndex input below +ApiConfiguration.ServerInfo serverInfo = new ApiConfiguration.ServerInfoBuilder() + .rootServerInfo( + new RootServerInfo.RootServerInfoBuilder() + .rootServer0(new RootServer0()) + .build() + ) + .build(); +ApiConfiguration.ServerIndexInfo serverIndexInfo = new ApiConfiguration.ServerIndexInfoBuilder() + .rootServerInfoServerIndex(RootServerInfo.ServerIndex.SERVER_0) + .build(); +Duration timeout = Duration.ofSeconds(1L); +Map> defaultHeaders = Map.of("User-Agent", List.of("OpenAPI-JSON-Schema-Generator/1.0.0/java")); +ApiConfiguration apiConfiguration = new ApiConfiguration( + serverInfo + serverIndexInfo, + timeout, + defaultHeaders +); +SchemaConfiguration schemaConfiguration = new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().build()); +UserusernamePut.Put apiClient = new UserusernamePut.Put(apiConfiguration, schemaConfiguration); + + +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 +); +UserusernamePut.SealedRequestBody requestBody = new UserusernamePut.ApplicationjsonRequestBody(requestBodyPayload); + +// Map validation +UserusernamePutPathParameters.PathParametersMap pathParameters = + UserusernamePutPathParameters.UserusernamePutPathParameters1.validate( + new UserusernamePutPathParameters.PathParametersMapBuilder() + .username("a") + + .build(), + schemaConfiguration +); + +var request = new UserusernamePut.PutRequestBuilder() + .requestBody(requestBody) + .pathParameters(pathParameters) + .build(); + +Nothing? response; +try { + response = apiClient.put(request); +} catch (UserusernamePutCode400Response.ResponseApiException | UserusernamePutCode404Response.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 | +| --------------------------- | +| Put(ApiConfiguration apiConfiguration, SchemaConfiguration schemaConfiguration)
Creates an instance | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| Nothing? | put([PutRequest](#putrequest) request) | + +## UpdateUserOperation +public interface UpdateUserOperation
+ +an interface that allows one to call the endpoint using a method named updateUser by the operationId + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| Nothing? | updateUser([PutRequest](#putrequest) request) | + +## PutRequest +public static class PutRequest
+ +a class that stores the final request inputs + +### Field Summary +| Modifier and Type | Field and Description | +| ----------------- | --------------------- | +| [UserusernamePutRequestBody.SealedRequestBody](../../paths/userusername/put/UserusernamePutRequestBody.md#sealedrequestbody) | requestBody | +| [UserusernamePutPathParameters.PathParametersMap](../../paths/userusername/put/UserusernamePutPathParameters.md#pathparametersmap) | pathParameters | +| [RootServerInfo.@Nullable ServerIndex](../../RootServerInfo.md#serverindex) | serverIndex
optional. Note: this will override the value in apiConfiguration | +| @Nullable Duration | timeout
optional. Note: this will override the value in apiConfiguration | + +## PutNullableRequest +public static class PutNullableRequest
+ +a class that stores the initial request inputs + +### Field Summary +| Modifier and Type | Field and Description | +| ----------------- | --------------------- | +| [UserusernamePutRequestBody.@Nullable SealedRequestBody](../../paths/userusername/put/UserusernamePutRequestBody.md#sealedrequestbody) | requestBody | +| [UserusernamePutPathParameters.@Nullable PathParametersMap](../../paths/userusername/put/UserusernamePutPathParameters.md#pathparametersmap) | pathParameters | +| [RootServerInfo.@Nullable ServerIndex](../../RootServerInfo.md#serverindex) | serverIndex | +| @Nullable Duration | timeout | + +## Put00RequestBuilder +public static class Put00RequestBuilder
+ +a builder for request inputs + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| Put00RequestBuilder(Put00RequestBuilder instance)
Creates a builder that contains the passed instance | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| [PutRequest](#putrequest) | build()
Returns the request input used to call an endpoint method | +| [Put00RequestBuilder](#put00requestbuilder) | serverIndex([RootServerInfo.ServerIndex](../../RootServerInfo.md#serverindex) serverIndex)
sets the optional property. Note: this will override the value in apiConfiguration | +| [Put00RequestBuilder](#put00requestbuilder) | timeout(Duration timeout)
sets the optional property. Note: this will override the value in apiConfiguration | + +## Put01RequestBuilder +public static class Put01RequestBuilder
+ +a builder for request inputs + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| Put01RequestBuilder(Put01RequestBuilder instance)
Creates a builder that contains the passed instance | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| [Put00RequestBuilder](#put00requestbuilder) | pathParameters([UserusernamePutPathParametersPathParametersMap](../../paths/userusername/put/UserusernamePutPathParameters.md#pathparametersmap) pathParameters)
sets the property | + +## Put10RequestBuilder +public static class Put10RequestBuilder
+ +a builder for request inputs + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| Put10RequestBuilder(Put10RequestBuilder instance)
Creates a builder that contains the passed instance | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| [Put00RequestBuilder](#put00requestbuilder) | requestBody([UserusernamePutRequestBody.SealedRequestBody](../../paths/userusername/put/UserusernamePutRequestBody.md#sealedrequestbody) requestBody)
sets the property | + +## PutRequestBuilder +public static class PutRequestBuilder
+ +a builder for request inputs + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| PutRequestBuilder()
Creates a builder that contains null for all parameters | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| [Put01RequestBuilder](#put01requestbuilder) | requestBody([UserusernamePutRequestBody.SealedRequestBody](../../paths/userusername/put/UserusernamePutRequestBody.md#sealedrequestbody) requestBody)
sets the property | +| [Put10RequestBuilder](#put10requestbuilder) | pathParameters([UserusernamePutPathParametersPathParametersMap](../../paths/userusername/put/UserusernamePutPathParameters.md#pathparametersmap) pathParameters)
sets the property | + +[[Back to top]](#top) [[Back to README]](../../../README.md) diff --git a/samples/client/petstore/kotlin/docs/paths/userusername/delete/UserusernameDeletePathParameters.md b/samples/client/petstore/kotlin/docs/paths/userusername/delete/UserusernameDeletePathParameters.md new file mode 100644 index 00000000000..b632f34100b --- /dev/null +++ b/samples/client/petstore/kotlin/docs/paths/userusername/delete/UserusernameDeletePathParameters.md @@ -0,0 +1,268 @@ +# UserusernameDeletePathParameters +public class UserusernameDeletePathParameters
+ +A class that contains necessary nested +- schema classes (which validate payloads), extends JsonSchema +- sealed interfaces which store validated payloads, java version of a sum type +- boxed classes which store validated payloads, sealed permits class implementations +- classes to store validated map payloads, extends FrozenMap +- classes to build inputs for map payloads + +## Nested Class Summary +| Modifier and Type | Class and Description | +| ----------------- | ---------------------- | +| sealed interface | [UserusernameDeletePathParameters.UserusernameDeletePathParameters1Boxed](#userusernamedeletepathparameters1boxed)
sealed interface for validated payloads | +| record | [UserusernameDeletePathParameters.UserusernameDeletePathParameters1BoxedMap](#userusernamedeletepathparameters1boxedmap)
boxed class to store validated Map payloads | +| static class | [UserusernameDeletePathParameters.UserusernameDeletePathParameters1](#userusernamedeletepathparameters1)
schema class | +| static class | [UserusernameDeletePathParameters.PathParametersMapBuilder](#pathparametersmapbuilder)
builder for Map payloads | +| static class | [UserusernameDeletePathParameters.PathParametersMap](#pathparametersmap)
output class for Map payloads | +| sealed interface | [UserusernameDeletePathParameters.AdditionalPropertiesBoxed](#additionalpropertiesboxed)
sealed interface for validated payloads | +| record | [UserusernameDeletePathParameters.AdditionalPropertiesBoxedVoid](#additionalpropertiesboxedvoid)
boxed class to store validated null payloads | +| record | [UserusernameDeletePathParameters.AdditionalPropertiesBoxedBoolean](#additionalpropertiesboxedboolean)
boxed class to store validated boolean payloads | +| record | [UserusernameDeletePathParameters.AdditionalPropertiesBoxedNumber](#additionalpropertiesboxednumber)
boxed class to store validated Number payloads | +| record | [UserusernameDeletePathParameters.AdditionalPropertiesBoxedString](#additionalpropertiesboxedstring)
boxed class to store validated String payloads | +| record | [UserusernameDeletePathParameters.AdditionalPropertiesBoxedList](#additionalpropertiesboxedlist)
boxed class to store validated List payloads | +| record | [UserusernameDeletePathParameters.AdditionalPropertiesBoxedMap](#additionalpropertiesboxedmap)
boxed class to store validated Map payloads | +| static class | [UserusernameDeletePathParameters.AdditionalProperties](#additionalproperties)
schema class | + +## UserusernameDeletePathParameters1Boxed +public sealed interface UserusernameDeletePathParameters1Boxed
+permits
+[UserusernameDeletePathParameters1BoxedMap](#userusernamedeletepathparameters1boxedmap) + +sealed interface that stores validated payloads using boxed classes + +## UserusernameDeletePathParameters1BoxedMap +public record UserusernameDeletePathParameters1BoxedMap
+implements [UserusernameDeletePathParameters1Boxed](#userusernamedeletepathparameters1boxed) + +record that stores validated Map payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| UserusernameDeletePathParameters1BoxedMap([PathParametersMap](#pathparametersmap) data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| [PathParametersMap](#pathparametersmap) | data()
validated payload | +| @Nullable Object | getData()
validated payload | + +## UserusernameDeletePathParameters1 +public static class UserusernameDeletePathParameters1
+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.userusername.delete.UserusernameDeletePathParameters; + +import java.util.Arrays; +import java.util.List; +import java.util.AbstractMap; + +static final SchemaConfiguration configuration = new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().build()); + +// Map validation +UserusernameDeletePathParameters.PathParametersMap validatedPayload = + UserusernameDeletePathParameters.UserusernameDeletePathParameters1.validate( + new UserusernameDeletePathParameters.PathParametersMapBuilder() + .username("a") + + .build(), + configuration +); +``` + +### Field Summary +| Modifier and Type | Field and Description | +| ----------------- | ---------------------- | +| Set> | type = Set.of(Map.class) | +| Map> | properties = Map.ofEntries(
    new PropertyEntry("username", [Schema.Schema1.class](../../../components/parameters/pathusername/Schema.md#schema1))
)
| +| Set | required = Set.of(
    "username"
)
| +| Class | additionalProperties = [AdditionalProperties.class](#additionalproperties) | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| [PathParametersMap](#pathparametersmap) | validate([Map<?, ?>](#pathparametersmapbuilder) arg, SchemaConfiguration configuration) | +| [UserusernameDeletePathParameters1BoxedMap](#userusernamedeletepathparameters1boxedmap) | validateAndBox([Map<?, ?>](#pathparametersmapbuilder) arg, SchemaConfiguration configuration) | +| [UserusernameDeletePathParameters1Boxed](#userusernamedeletepathparameters1boxed) | validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) | +| @Nullable Object | validate(@Nullable Object arg, SchemaConfiguration configuration) | + +## PathParametersMap0Builder +public class PathParametersMap0Builder
+builder for `Map` + +A class that builds the Map input type + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| PathParametersMap0Builder(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 | + +## PathParametersMapBuilder +public class PathParametersMapBuilder
+builder for `Map` + +A class that builds the Map input type + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| PathParametersMapBuilder()
Creates a builder that contains an empty map | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| [PathParametersMap0Builder](#pathparametersmap0builder) | username(String value) | + +## PathParametersMap +public static class PathParametersMap
+extends FrozenMap + +A class to store validated Map payloads + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| static [PathParametersMap](#pathparametersmap) | of([Map](#pathparametersmapbuilder) arg, SchemaConfiguration configuration) | +| String | username()
| + +## 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(Nothing? data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| Nothing? | 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/kotlin/docs/paths/userusername/delete/UserusernameDeleteResponses.md b/samples/client/petstore/kotlin/docs/paths/userusername/delete/UserusernameDeleteResponses.md new file mode 100644 index 00000000000..030157ef886 --- /dev/null +++ b/samples/client/petstore/kotlin/docs/paths/userusername/delete/UserusernameDeleteResponses.md @@ -0,0 +1,29 @@ +# UserusernameDeleteResponses + +public class UserusernameDeleteResponses + +A class that contains necessary responses classes +- a sealed interface, EndpointResponse, that stores endpoint responses +- records for each endpoint response + +## Nested Class Summary +| Modifier and Type | Class and Description | +| ----------------- | --------------------- | +| sealed interface | [EndpointResponse](#endpointresponse)
stores the endpoint responses | +| record | [EndpointUserusernameDeleteCode200Response](#endpointuserusernamedeletecode200response)
the response for 200 | + +## EndpointResponse +public sealed interface EndpointResponse permits
+[EndpointUserusernameDeleteCode200Response](#endpointuserusernamedeletecode200response) + +a sealed interface that stores endpoint responses + +## EndpointUserusernameDeleteCode200Response +public record EndpointUserusernameDeleteCode200Response( + HttpResponse response, + Nothing? body, + Nothing? headers +) implements EndpointResponse, ApiResponse
+ +a class that stores an endpoint response + diff --git a/samples/client/petstore/kotlin/docs/paths/userusername/delete/responses/UserusernameDeleteCode200Response.md b/samples/client/petstore/kotlin/docs/paths/userusername/delete/responses/UserusernameDeleteCode200Response.md new file mode 100644 index 00000000000..bf7c6aee09d --- /dev/null +++ b/samples/client/petstore/kotlin/docs/paths/userusername/delete/responses/UserusernameDeleteCode200Response.md @@ -0,0 +1,17 @@ +# UserusernameDeleteCode200Response + +public class UserusernameDeleteCode200Response extends [SuccessDescriptionOnly](../../components/responses/SuccessDescriptionOnly.md) + +A class (extended from the $ref class) that contains necessary nested response classes +- a class that extends ResponseDeserializer and is used to deserialize responses + +## Nested Class Summary +| Modifier and Type | Class and Description | +| ----------------- | --------------------- | +| static class | [UserusernameDeleteCode200Response.UserusernameDeleteCode200Response1](#userusernamedeletecode200response1)
class that deserializes responses | + +## UserusernameDeleteCode200Response1 +public static class UserusernameDeleteCode200Response1 extends [SuccessDescriptionOnly1](../../components/responses/SuccessDescriptionOnly.md#successdescriptiononly1)
+ +a class that deserializes responses, extended from the $ref class + diff --git a/samples/client/petstore/kotlin/docs/paths/userusername/delete/responses/UserusernameDeleteCode404Response.md b/samples/client/petstore/kotlin/docs/paths/userusername/delete/responses/UserusernameDeleteCode404Response.md new file mode 100644 index 00000000000..a467362d7d0 --- /dev/null +++ b/samples/client/petstore/kotlin/docs/paths/userusername/delete/responses/UserusernameDeleteCode404Response.md @@ -0,0 +1,32 @@ +# UserusernameDeleteCode404Response + +public class UserusernameDeleteCode404Response + +A class that contains necessary nested response classes +- a class that extends ResponseDeserializer and is used to deserialize responses + +## Nested Class Summary +| Modifier and Type | Class and Description | +| ----------------- | --------------------- | +| static class | [UserusernameDeleteCode404Response.UserusernameDeleteCode404Response1](#userusernamedeletecode404response1)
class that deserializes responses | + +## UserusernameDeleteCode404Response1 +public static class UserusernameDeleteCode404Response1
+extends ResponseDeserializer + +a class that deserializes responses + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| UserusernameDeleteCode404Response1()
Creates an instance | + +### Field Summary +| Modifier and Type | Field and Description | +| ----------------- | --------------------- | +| Map | content = MapUtils.makeMap(
)
the contentType to schema info | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| ApiResponse | deserialize(HttpResponse response, SchemaConfiguration configuration)
called by endpoint when deserialize responses | diff --git a/samples/client/petstore/kotlin/docs/paths/userusername/get/UserusernameGetPathParameters.md b/samples/client/petstore/kotlin/docs/paths/userusername/get/UserusernameGetPathParameters.md new file mode 100644 index 00000000000..6b6f65cf799 --- /dev/null +++ b/samples/client/petstore/kotlin/docs/paths/userusername/get/UserusernameGetPathParameters.md @@ -0,0 +1,268 @@ +# UserusernameGetPathParameters +public class UserusernameGetPathParameters
+ +A class that contains necessary nested +- schema classes (which validate payloads), extends JsonSchema +- sealed interfaces which store validated payloads, java version of a sum type +- boxed classes which store validated payloads, sealed permits class implementations +- classes to store validated map payloads, extends FrozenMap +- classes to build inputs for map payloads + +## Nested Class Summary +| Modifier and Type | Class and Description | +| ----------------- | ---------------------- | +| sealed interface | [UserusernameGetPathParameters.UserusernameGetPathParameters1Boxed](#userusernamegetpathparameters1boxed)
sealed interface for validated payloads | +| record | [UserusernameGetPathParameters.UserusernameGetPathParameters1BoxedMap](#userusernamegetpathparameters1boxedmap)
boxed class to store validated Map payloads | +| static class | [UserusernameGetPathParameters.UserusernameGetPathParameters1](#userusernamegetpathparameters1)
schema class | +| static class | [UserusernameGetPathParameters.PathParametersMapBuilder](#pathparametersmapbuilder)
builder for Map payloads | +| static class | [UserusernameGetPathParameters.PathParametersMap](#pathparametersmap)
output class for Map payloads | +| sealed interface | [UserusernameGetPathParameters.AdditionalPropertiesBoxed](#additionalpropertiesboxed)
sealed interface for validated payloads | +| record | [UserusernameGetPathParameters.AdditionalPropertiesBoxedVoid](#additionalpropertiesboxedvoid)
boxed class to store validated null payloads | +| record | [UserusernameGetPathParameters.AdditionalPropertiesBoxedBoolean](#additionalpropertiesboxedboolean)
boxed class to store validated boolean payloads | +| record | [UserusernameGetPathParameters.AdditionalPropertiesBoxedNumber](#additionalpropertiesboxednumber)
boxed class to store validated Number payloads | +| record | [UserusernameGetPathParameters.AdditionalPropertiesBoxedString](#additionalpropertiesboxedstring)
boxed class to store validated String payloads | +| record | [UserusernameGetPathParameters.AdditionalPropertiesBoxedList](#additionalpropertiesboxedlist)
boxed class to store validated List payloads | +| record | [UserusernameGetPathParameters.AdditionalPropertiesBoxedMap](#additionalpropertiesboxedmap)
boxed class to store validated Map payloads | +| static class | [UserusernameGetPathParameters.AdditionalProperties](#additionalproperties)
schema class | + +## UserusernameGetPathParameters1Boxed +public sealed interface UserusernameGetPathParameters1Boxed
+permits
+[UserusernameGetPathParameters1BoxedMap](#userusernamegetpathparameters1boxedmap) + +sealed interface that stores validated payloads using boxed classes + +## UserusernameGetPathParameters1BoxedMap +public record UserusernameGetPathParameters1BoxedMap
+implements [UserusernameGetPathParameters1Boxed](#userusernamegetpathparameters1boxed) + +record that stores validated Map payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| UserusernameGetPathParameters1BoxedMap([PathParametersMap](#pathparametersmap) data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| [PathParametersMap](#pathparametersmap) | data()
validated payload | +| @Nullable Object | getData()
validated payload | + +## UserusernameGetPathParameters1 +public static class UserusernameGetPathParameters1
+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.userusername.get.UserusernameGetPathParameters; + +import java.util.Arrays; +import java.util.List; +import java.util.AbstractMap; + +static final SchemaConfiguration configuration = new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().build()); + +// Map validation +UserusernameGetPathParameters.PathParametersMap validatedPayload = + UserusernameGetPathParameters.UserusernameGetPathParameters1.validate( + new UserusernameGetPathParameters.PathParametersMapBuilder() + .username("a") + + .build(), + configuration +); +``` + +### Field Summary +| Modifier and Type | Field and Description | +| ----------------- | ---------------------- | +| Set> | type = Set.of(Map.class) | +| Map> | properties = Map.ofEntries(
    new PropertyEntry("username", [Schema.Schema1.class](../../../components/parameters/pathusername/Schema.md#schema1))
)
| +| Set | required = Set.of(
    "username"
)
| +| Class | additionalProperties = [AdditionalProperties.class](#additionalproperties) | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| [PathParametersMap](#pathparametersmap) | validate([Map<?, ?>](#pathparametersmapbuilder) arg, SchemaConfiguration configuration) | +| [UserusernameGetPathParameters1BoxedMap](#userusernamegetpathparameters1boxedmap) | validateAndBox([Map<?, ?>](#pathparametersmapbuilder) arg, SchemaConfiguration configuration) | +| [UserusernameGetPathParameters1Boxed](#userusernamegetpathparameters1boxed) | validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) | +| @Nullable Object | validate(@Nullable Object arg, SchemaConfiguration configuration) | + +## PathParametersMap0Builder +public class PathParametersMap0Builder
+builder for `Map` + +A class that builds the Map input type + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| PathParametersMap0Builder(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 | + +## PathParametersMapBuilder +public class PathParametersMapBuilder
+builder for `Map` + +A class that builds the Map input type + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| PathParametersMapBuilder()
Creates a builder that contains an empty map | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| [PathParametersMap0Builder](#pathparametersmap0builder) | username(String value) | + +## PathParametersMap +public static class PathParametersMap
+extends FrozenMap + +A class to store validated Map payloads + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| static [PathParametersMap](#pathparametersmap) | of([Map](#pathparametersmapbuilder) arg, SchemaConfiguration configuration) | +| String | username()
| + +## 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(Nothing? data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| Nothing? | 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/kotlin/docs/paths/userusername/get/UserusernameGetResponses.md b/samples/client/petstore/kotlin/docs/paths/userusername/get/UserusernameGetResponses.md new file mode 100644 index 00000000000..4e86dca325f --- /dev/null +++ b/samples/client/petstore/kotlin/docs/paths/userusername/get/UserusernameGetResponses.md @@ -0,0 +1,29 @@ +# UserusernameGetResponses + +public class UserusernameGetResponses + +A class that contains necessary responses classes +- a sealed interface, EndpointResponse, that stores endpoint responses +- records for each endpoint response + +## Nested Class Summary +| Modifier and Type | Class and Description | +| ----------------- | --------------------- | +| sealed interface | [EndpointResponse](#endpointresponse)
stores the endpoint responses | +| record | [EndpointUserusernameGetCode200Response](#endpointuserusernamegetcode200response)
the response for 200 | + +## EndpointResponse +public sealed interface EndpointResponse permits
+[EndpointUserusernameGetCode200Response](#endpointuserusernamegetcode200response) + +a sealed interface that stores endpoint responses + +## EndpointUserusernameGetCode200Response +public record EndpointUserusernameGetCode200Response( + HttpResponse response, + [UserusernameGetCode200Response.SealedResponseBody](../../../paths/userusername/get/responses/UserusernameGetCode200Response.md#sealedresponsebody) body, + Nothing? headers +) implements EndpointResponse, ApiResponse
+ +a class that stores an endpoint response + diff --git a/samples/client/petstore/kotlin/docs/paths/userusername/get/responses/UserusernameGetCode200Response.md b/samples/client/petstore/kotlin/docs/paths/userusername/get/responses/UserusernameGetCode200Response.md new file mode 100644 index 00000000000..6436e92af14 --- /dev/null +++ b/samples/client/petstore/kotlin/docs/paths/userusername/get/responses/UserusernameGetCode200Response.md @@ -0,0 +1,123 @@ +# UserusernameGetCode200Response + +public class UserusernameGetCode200Response + +A class that contains necessary nested response classes +- SealedMediaType, a sealed interface which contains all the schema/encoding info for each contentType +- records which implement SealedMediaType, the concrete media types +- SealedResponseBody, a sealed interface which contains all the contentType/schema types +- records which implement SealedResponseBody, the concrete response body types +- a class that extends ResponseDeserializer and is used to deserialize responses + +## Nested Class Summary +| Modifier and Type | Class and Description | +| ----------------- | --------------------- | +| sealed interface | [UserusernameGetCode200Response.SealedMediaType](#sealedmediatype)
media type sealed interface | +| record | [UserusernameGetCode200Response.ApplicationxmlMediaType](#applicationxmlmediatype)
record storing schema + encoding for a specific contentType | +| record | [UserusernameGetCode200Response.ApplicationjsonMediaType](#applicationjsonmediatype)
record storing schema + encoding for a specific contentType | +| sealed interface | [UserusernameGetCode200Response.SealedResponseBody](#sealedresponsebody)
response body sealed interface | +| record | [UserusernameGetCode200Response.ApplicationxmlResponseBody](#applicationxmlresponsebody)
implements sealed interface to store response body | +| record | [UserusernameGetCode200Response.ApplicationjsonResponseBody](#applicationjsonresponsebody)
implements sealed interface to store response body | +| static class | [UserusernameGetCode200Response.UserusernameGetCode200Response1](#userusernamegetcode200response1)
class that deserializes responses | + +## SealedMediaType +public sealed interface SealedMediaType
+permits
+[ApplicationxmlMediaType](#applicationxmlmediatype), +[ApplicationjsonMediaType](#applicationjsonmediatype) + +sealed interface that stores schema and encoding info + +## ApplicationxmlMediaType +public record ApplicationxmlMediaType
+implements [SealedMediaType](#sealedmediatype), MediaType<[ApplicationxmlSchema.ApplicationxmlSchema1](../../../../paths/userusername/get/responses/code200response/content/applicationxml/ApplicationxmlSchema.md#applicationxmlschema1), Nothing?> + +class storing schema info for a specific contentType + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| ApplicationxmlMediaType()
Creates an instance | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| [ApplicationxmlSchema.ApplicationxmlSchema1](../../../../paths/userusername/get/responses/code200response/content/applicationxml/ApplicationxmlSchema.md#applicationxmlschema1) | schema()
the schema for this MediaType | +| Nothing? | encoding()
the encoding info | + +## ApplicationjsonMediaType +public record ApplicationjsonMediaType
+implements [SealedMediaType](#sealedmediatype), MediaType<[ApplicationjsonSchema.ApplicationjsonSchema1](../../../../paths/userusername/get/responses/code200response/content/applicationjson/ApplicationjsonSchema.md#applicationjsonschema1), Nothing?> + +class storing schema info for a specific contentType + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| ApplicationjsonMediaType()
Creates an instance | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| [ApplicationjsonSchema.ApplicationjsonSchema1](../../../../paths/userusername/get/responses/code200response/content/applicationjson/ApplicationjsonSchema.md#applicationjsonschema1) | schema()
the schema for this MediaType | +| Nothing? | encoding()
the encoding info | + +## SealedResponseBody +public sealed interface SealedResponseBody
+permits
+[ApplicationxmlResponseBody](#applicationxmlresponsebody), +[ApplicationjsonResponseBody](#applicationjsonresponsebody) + +sealed interface that stores response body + +## ApplicationxmlResponseBody +public record ApplicationxmlResponseBody
+implements [SealedResponseBody](#sealedresponsebody) + +A record class to store response body for contentType="application/xml" + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| ApplicationxmlResponseBody(ApplicationxmlSchema.[User1Boxed](../../../../components/schemas/User.md#user1boxed) body)
Creates an instance | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| ApplicationxmlSchema.[User1Boxed](../../../../components/schemas/User.md#user1boxed) | body()
returns the body passed in in the constructor | +## ApplicationjsonResponseBody +public record ApplicationjsonResponseBody
+implements [SealedResponseBody](#sealedresponsebody) + +A record class to store response body for contentType="application/json" + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| ApplicationjsonResponseBody(ApplicationjsonSchema.[User1Boxed](../../../../components/schemas/User.md#user1boxed) body)
Creates an instance | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| ApplicationjsonSchema.[User1Boxed](../../../../components/schemas/User.md#user1boxed) | body()
returns the body passed in in the constructor | + +## UserusernameGetCode200Response1 +public static class UserusernameGetCode200Response1
+extends ResponseDeserializer<[SealedResponseBody](#sealedresponsebody), Nothing?, [SealedMediaType](#sealedmediatype)> + +a class that deserializes responses + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| UserusernameGetCode200Response1()
Creates an instance | + +### Field Summary +| Modifier and Type | Field and Description | +| ----------------- | --------------------- | +| Map | content = Map.ofEntries(
    new AbstractMap.SimpleEntry<>("application/xml", new [ApplicationxmlMediaType](#applicationxmlmediatype)()),
    new AbstractMap.SimpleEntry<>("application/json", new [ApplicationjsonMediaType](#applicationjsonmediatype)())
)
the contentType to schema info | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| ApiResponse<[SealedResponseBody](#sealedresponsebody), Nothing?> | deserialize(HttpResponse response, SchemaConfiguration configuration)
called by endpoint when deserialize responses | diff --git a/samples/client/petstore/kotlin/docs/paths/userusername/get/responses/UserusernameGetCode400Response.md b/samples/client/petstore/kotlin/docs/paths/userusername/get/responses/UserusernameGetCode400Response.md new file mode 100644 index 00000000000..cd71d6f9d39 --- /dev/null +++ b/samples/client/petstore/kotlin/docs/paths/userusername/get/responses/UserusernameGetCode400Response.md @@ -0,0 +1,32 @@ +# UserusernameGetCode400Response + +public class UserusernameGetCode400Response + +A class that contains necessary nested response classes +- a class that extends ResponseDeserializer and is used to deserialize responses + +## Nested Class Summary +| Modifier and Type | Class and Description | +| ----------------- | --------------------- | +| static class | [UserusernameGetCode400Response.UserusernameGetCode400Response1](#userusernamegetcode400response1)
class that deserializes responses | + +## UserusernameGetCode400Response1 +public static class UserusernameGetCode400Response1
+extends ResponseDeserializer + +a class that deserializes responses + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| UserusernameGetCode400Response1()
Creates an instance | + +### Field Summary +| Modifier and Type | Field and Description | +| ----------------- | --------------------- | +| Map | content = MapUtils.makeMap(
)
the contentType to schema info | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| ApiResponse | deserialize(HttpResponse response, SchemaConfiguration configuration)
called by endpoint when deserialize responses | diff --git a/samples/client/petstore/kotlin/docs/paths/userusername/get/responses/UserusernameGetCode404Response.md b/samples/client/petstore/kotlin/docs/paths/userusername/get/responses/UserusernameGetCode404Response.md new file mode 100644 index 00000000000..d7ae0ed42b4 --- /dev/null +++ b/samples/client/petstore/kotlin/docs/paths/userusername/get/responses/UserusernameGetCode404Response.md @@ -0,0 +1,32 @@ +# UserusernameGetCode404Response + +public class UserusernameGetCode404Response + +A class that contains necessary nested response classes +- a class that extends ResponseDeserializer and is used to deserialize responses + +## Nested Class Summary +| Modifier and Type | Class and Description | +| ----------------- | --------------------- | +| static class | [UserusernameGetCode404Response.UserusernameGetCode404Response1](#userusernamegetcode404response1)
class that deserializes responses | + +## UserusernameGetCode404Response1 +public static class UserusernameGetCode404Response1
+extends ResponseDeserializer + +a class that deserializes responses + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| UserusernameGetCode404Response1()
Creates an instance | + +### Field Summary +| Modifier and Type | Field and Description | +| ----------------- | --------------------- | +| Map | content = MapUtils.makeMap(
)
the contentType to schema info | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| ApiResponse | deserialize(HttpResponse response, SchemaConfiguration configuration)
called by endpoint when deserialize responses | diff --git a/samples/client/petstore/kotlin/docs/paths/userusername/get/responses/code200response/content/applicationjson/ApplicationjsonSchema.md b/samples/client/petstore/kotlin/docs/paths/userusername/get/responses/code200response/content/applicationjson/ApplicationjsonSchema.md new file mode 100644 index 00000000000..3433b43b8a4 --- /dev/null +++ b/samples/client/petstore/kotlin/docs/paths/userusername/get/responses/code200response/content/applicationjson/ApplicationjsonSchema.md @@ -0,0 +1,19 @@ +# ApplicationjsonSchema +public class ApplicationjsonSchema
+extends [User1](../../../../../../../components/schemas/User.md#user) + +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 + +## Nested Class Summary +| Modifier and Type | Class and Description | +| ----------------- | ---------------------- | +| static class | [ApplicationjsonSchema.ApplicationjsonSchema1](#applicationjsonschema1)
schema class | + +## ApplicationjsonSchema1 +public static class ApplicationjsonSchema1
+extends [User.User1](../../../../../../../components/schemas/User.md#user1) + +A schema class that validates payloads diff --git a/samples/client/petstore/kotlin/docs/paths/userusername/get/responses/code200response/content/applicationxml/ApplicationxmlSchema.md b/samples/client/petstore/kotlin/docs/paths/userusername/get/responses/code200response/content/applicationxml/ApplicationxmlSchema.md new file mode 100644 index 00000000000..b5aa20f221c --- /dev/null +++ b/samples/client/petstore/kotlin/docs/paths/userusername/get/responses/code200response/content/applicationxml/ApplicationxmlSchema.md @@ -0,0 +1,19 @@ +# ApplicationxmlSchema +public class ApplicationxmlSchema
+extends [User1](../../../../../../../components/schemas/User.md#user) + +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 + +## Nested Class Summary +| Modifier and Type | Class and Description | +| ----------------- | ---------------------- | +| static class | [ApplicationxmlSchema.ApplicationxmlSchema1](#applicationxmlschema1)
schema class | + +## ApplicationxmlSchema1 +public static class ApplicationxmlSchema1
+extends [User.User1](../../../../../../../components/schemas/User.md#user1) + +A schema class that validates payloads diff --git a/samples/client/petstore/kotlin/docs/paths/userusername/put/UserusernamePutPathParameters.md b/samples/client/petstore/kotlin/docs/paths/userusername/put/UserusernamePutPathParameters.md new file mode 100644 index 00000000000..a3a3e58336e --- /dev/null +++ b/samples/client/petstore/kotlin/docs/paths/userusername/put/UserusernamePutPathParameters.md @@ -0,0 +1,268 @@ +# UserusernamePutPathParameters +public class UserusernamePutPathParameters
+ +A class that contains necessary nested +- schema classes (which validate payloads), extends JsonSchema +- sealed interfaces which store validated payloads, java version of a sum type +- boxed classes which store validated payloads, sealed permits class implementations +- classes to store validated map payloads, extends FrozenMap +- classes to build inputs for map payloads + +## Nested Class Summary +| Modifier and Type | Class and Description | +| ----------------- | ---------------------- | +| sealed interface | [UserusernamePutPathParameters.UserusernamePutPathParameters1Boxed](#userusernameputpathparameters1boxed)
sealed interface for validated payloads | +| record | [UserusernamePutPathParameters.UserusernamePutPathParameters1BoxedMap](#userusernameputpathparameters1boxedmap)
boxed class to store validated Map payloads | +| static class | [UserusernamePutPathParameters.UserusernamePutPathParameters1](#userusernameputpathparameters1)
schema class | +| static class | [UserusernamePutPathParameters.PathParametersMapBuilder](#pathparametersmapbuilder)
builder for Map payloads | +| static class | [UserusernamePutPathParameters.PathParametersMap](#pathparametersmap)
output class for Map payloads | +| sealed interface | [UserusernamePutPathParameters.AdditionalPropertiesBoxed](#additionalpropertiesboxed)
sealed interface for validated payloads | +| record | [UserusernamePutPathParameters.AdditionalPropertiesBoxedVoid](#additionalpropertiesboxedvoid)
boxed class to store validated null payloads | +| record | [UserusernamePutPathParameters.AdditionalPropertiesBoxedBoolean](#additionalpropertiesboxedboolean)
boxed class to store validated boolean payloads | +| record | [UserusernamePutPathParameters.AdditionalPropertiesBoxedNumber](#additionalpropertiesboxednumber)
boxed class to store validated Number payloads | +| record | [UserusernamePutPathParameters.AdditionalPropertiesBoxedString](#additionalpropertiesboxedstring)
boxed class to store validated String payloads | +| record | [UserusernamePutPathParameters.AdditionalPropertiesBoxedList](#additionalpropertiesboxedlist)
boxed class to store validated List payloads | +| record | [UserusernamePutPathParameters.AdditionalPropertiesBoxedMap](#additionalpropertiesboxedmap)
boxed class to store validated Map payloads | +| static class | [UserusernamePutPathParameters.AdditionalProperties](#additionalproperties)
schema class | + +## UserusernamePutPathParameters1Boxed +public sealed interface UserusernamePutPathParameters1Boxed
+permits
+[UserusernamePutPathParameters1BoxedMap](#userusernameputpathparameters1boxedmap) + +sealed interface that stores validated payloads using boxed classes + +## UserusernamePutPathParameters1BoxedMap +public record UserusernamePutPathParameters1BoxedMap
+implements [UserusernamePutPathParameters1Boxed](#userusernameputpathparameters1boxed) + +record that stores validated Map payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| UserusernamePutPathParameters1BoxedMap([PathParametersMap](#pathparametersmap) data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| [PathParametersMap](#pathparametersmap) | data()
validated payload | +| @Nullable Object | getData()
validated payload | + +## UserusernamePutPathParameters1 +public static class UserusernamePutPathParameters1
+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.userusername.put.UserusernamePutPathParameters; + +import java.util.Arrays; +import java.util.List; +import java.util.AbstractMap; + +static final SchemaConfiguration configuration = new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().build()); + +// Map validation +UserusernamePutPathParameters.PathParametersMap validatedPayload = + UserusernamePutPathParameters.UserusernamePutPathParameters1.validate( + new UserusernamePutPathParameters.PathParametersMapBuilder() + .username("a") + + .build(), + configuration +); +``` + +### Field Summary +| Modifier and Type | Field and Description | +| ----------------- | ---------------------- | +| Set> | type = Set.of(Map.class) | +| Map> | properties = Map.ofEntries(
    new PropertyEntry("username", [Schema.Schema1.class](../../../components/parameters/pathusername/Schema.md#schema1))
)
| +| Set | required = Set.of(
    "username"
)
| +| Class | additionalProperties = [AdditionalProperties.class](#additionalproperties) | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| [PathParametersMap](#pathparametersmap) | validate([Map<?, ?>](#pathparametersmapbuilder) arg, SchemaConfiguration configuration) | +| [UserusernamePutPathParameters1BoxedMap](#userusernameputpathparameters1boxedmap) | validateAndBox([Map<?, ?>](#pathparametersmapbuilder) arg, SchemaConfiguration configuration) | +| [UserusernamePutPathParameters1Boxed](#userusernameputpathparameters1boxed) | validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) | +| @Nullable Object | validate(@Nullable Object arg, SchemaConfiguration configuration) | + +## PathParametersMap0Builder +public class PathParametersMap0Builder
+builder for `Map` + +A class that builds the Map input type + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| PathParametersMap0Builder(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 | + +## PathParametersMapBuilder +public class PathParametersMapBuilder
+builder for `Map` + +A class that builds the Map input type + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| PathParametersMapBuilder()
Creates a builder that contains an empty map | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| [PathParametersMap0Builder](#pathparametersmap0builder) | username(String value) | + +## PathParametersMap +public static class PathParametersMap
+extends FrozenMap + +A class to store validated Map payloads + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| static [PathParametersMap](#pathparametersmap) | of([Map](#pathparametersmapbuilder) arg, SchemaConfiguration configuration) | +| String | username()
| + +## 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(Nothing? data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| Nothing? | 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/kotlin/docs/paths/userusername/put/UserusernamePutRequestBody.md b/samples/client/petstore/kotlin/docs/paths/userusername/put/UserusernamePutRequestBody.md new file mode 100644 index 00000000000..5712e2d3fa7 --- /dev/null +++ b/samples/client/petstore/kotlin/docs/paths/userusername/put/UserusernamePutRequestBody.md @@ -0,0 +1,90 @@ +# UserusernamePutRequestBody + +public class UserusernamePutRequestBody + +A class that contains necessary nested request body classes +- SealedMediaType, a sealed interface which contains all the schema/encoding info for each contentType +- records which implement SealedMediaType, the concrete media types +- a class that extends RequestBodySerializer and is used to serialize input SealedRequestBody instances +- SealedRequestBody, a sealed interface which contains all the contentType/schema input types +- records which implement SealedRequestBody, the concrete request body types + +## Nested Class Summary +| Modifier and Type | Class and Description | +| ----------------- | --------------------- | +| sealed interface | [UserusernamePutRequestBody.SealedMediaType](#sealedmediatype)
media type sealed interface | +| record | [UserusernamePutRequestBody.ApplicationjsonMediaType](#applicationjsonmediatype)
record storing schema + encoding for a specific contentType | +| static class | [UserusernamePutRequestBody.UserusernamePutRequestBody1](#userusernameputrequestbody1)
class that serializes request bodies | +| sealed interface | [UserusernamePutRequestBody.SealedRequestBody](#sealedrequestbody)
request body sealed interface | +| record | [UserusernamePutRequestBody.ApplicationjsonRequestBody](#applicationjsonrequestbody)
implements sealed interface to store request body input | + +## SealedMediaType +public sealed interface SealedMediaType
+permits
+[ApplicationjsonMediaType](#applicationjsonmediatype) + +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), Nothing?> + +class storing schema info for a specific contentType + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| ApplicationjsonMediaType()
Creates an instance | + +### 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 | +| Nothing? | encoding()
the encoding info | + +## UserusernamePutRequestBody1 +public static class UserusernamePutRequestBody1
+ +a class that serializes SealedRequestBody request bodies + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| UserusernamePutRequestBody1()
Creates an instance | + +### Field Summary +| Modifier and Type | Field and Description | +| ----------------- | --------------------- | +| boolean | required = true
whether the request body is required | +| 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 | +| ----------------- | ---------------------- | +| SerializedRequestBody | serialize([SealedRequestBody](#sealedrequestbody) requestBody)
called by endpoint when creating request body bytes | + +## SealedRequestBody +public sealed interface SealedRequestBody
+permits
+[ApplicationjsonRequestBody](#applicationjsonrequestbody) + +sealed interface that stores request contentType + validated schema data + +## ApplicationjsonRequestBody +public record ApplicationjsonRequestBody
+implements [SealedRequestBody](#sealedrequestbody),
+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 | + +### 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 | diff --git a/samples/client/petstore/kotlin/docs/paths/userusername/put/UserusernamePutResponses.md b/samples/client/petstore/kotlin/docs/paths/userusername/put/UserusernamePutResponses.md new file mode 100644 index 00000000000..13a79a9fefe --- /dev/null +++ b/samples/client/petstore/kotlin/docs/paths/userusername/put/UserusernamePutResponses.md @@ -0,0 +1,10 @@ +# UserusernamePutResponses + +public class UserusernamePutResponses + +A class that contains necessary responses classes + +## Nested Class Summary +| Modifier and Type | Class and Description | +| ----------------- | --------------------- | + diff --git a/samples/client/petstore/kotlin/docs/paths/userusername/put/requestbody/content/applicationjson/ApplicationjsonSchema.md b/samples/client/petstore/kotlin/docs/paths/userusername/put/requestbody/content/applicationjson/ApplicationjsonSchema.md new file mode 100644 index 00000000000..87ec51870cc --- /dev/null +++ b/samples/client/petstore/kotlin/docs/paths/userusername/put/requestbody/content/applicationjson/ApplicationjsonSchema.md @@ -0,0 +1,19 @@ +# ApplicationjsonSchema +public class ApplicationjsonSchema
+extends [User1](../../../../../../components/schemas/User.md#user) + +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 + +## Nested Class Summary +| Modifier and Type | Class and Description | +| ----------------- | ---------------------- | +| static class | [ApplicationjsonSchema.ApplicationjsonSchema1](#applicationjsonschema1)
schema class | + +## ApplicationjsonSchema1 +public static class ApplicationjsonSchema1
+extends [User.User1](../../../../../../components/schemas/User.md#user1) + +A schema class that validates payloads diff --git a/samples/client/petstore/kotlin/docs/paths/userusername/put/responses/UserusernamePutCode400Response.md b/samples/client/petstore/kotlin/docs/paths/userusername/put/responses/UserusernamePutCode400Response.md new file mode 100644 index 00000000000..ae52ec6d807 --- /dev/null +++ b/samples/client/petstore/kotlin/docs/paths/userusername/put/responses/UserusernamePutCode400Response.md @@ -0,0 +1,32 @@ +# UserusernamePutCode400Response + +public class UserusernamePutCode400Response + +A class that contains necessary nested response classes +- a class that extends ResponseDeserializer and is used to deserialize responses + +## Nested Class Summary +| Modifier and Type | Class and Description | +| ----------------- | --------------------- | +| static class | [UserusernamePutCode400Response.UserusernamePutCode400Response1](#userusernameputcode400response1)
class that deserializes responses | + +## UserusernamePutCode400Response1 +public static class UserusernamePutCode400Response1
+extends ResponseDeserializer + +a class that deserializes responses + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| UserusernamePutCode400Response1()
Creates an instance | + +### Field Summary +| Modifier and Type | Field and Description | +| ----------------- | --------------------- | +| Map | content = MapUtils.makeMap(
)
the contentType to schema info | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| ApiResponse | deserialize(HttpResponse response, SchemaConfiguration configuration)
called by endpoint when deserialize responses | diff --git a/samples/client/petstore/kotlin/docs/paths/userusername/put/responses/UserusernamePutCode404Response.md b/samples/client/petstore/kotlin/docs/paths/userusername/put/responses/UserusernamePutCode404Response.md new file mode 100644 index 00000000000..b696e708667 --- /dev/null +++ b/samples/client/petstore/kotlin/docs/paths/userusername/put/responses/UserusernamePutCode404Response.md @@ -0,0 +1,32 @@ +# UserusernamePutCode404Response + +public class UserusernamePutCode404Response + +A class that contains necessary nested response classes +- a class that extends ResponseDeserializer and is used to deserialize responses + +## Nested Class Summary +| Modifier and Type | Class and Description | +| ----------------- | --------------------- | +| static class | [UserusernamePutCode404Response.UserusernamePutCode404Response1](#userusernameputcode404response1)
class that deserializes responses | + +## UserusernamePutCode404Response1 +public static class UserusernamePutCode404Response1
+extends ResponseDeserializer + +a class that deserializes responses + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| UserusernamePutCode404Response1()
Creates an instance | + +### Field Summary +| Modifier and Type | Field and Description | +| ----------------- | --------------------- | +| Map | content = MapUtils.makeMap(
)
the contentType to schema info | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| ApiResponse | deserialize(HttpResponse response, SchemaConfiguration configuration)
called by endpoint when deserialize responses | diff --git a/samples/client/petstore/kotlin/docs/servers/RootServer0.md b/samples/client/petstore/kotlin/docs/servers/RootServer0.md new file mode 100644 index 00000000000..d7bce71f647 --- /dev/null +++ b/samples/client/petstore/kotlin/docs/servers/RootServer0.md @@ -0,0 +1,22 @@ +org.openapijsonschematools.client.servers.RootServer0 +# Server RootServer0 +public class RootServer0 + +A class that stores a server url + +## Description +petstore server + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| RootServer0()
Creates a server using default values for variables | +| RootServer0([RootServer0Variables.VariablesMap](../servers/rootserver0/RootServer0Variables.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" | +| [RootServer0Variables.VariablesMap](../servers/rootserver0/RootServer0Variables.md#variablesmap) | variables | + +[[Back to top]](#top) [[Back to Servers]](../../README.md#Servers) [[Back to README]](../../README.md) diff --git a/samples/client/petstore/kotlin/docs/servers/RootServer1.md b/samples/client/petstore/kotlin/docs/servers/RootServer1.md new file mode 100644 index 00000000000..4f78ced374a --- /dev/null +++ b/samples/client/petstore/kotlin/docs/servers/RootServer1.md @@ -0,0 +1,22 @@ +org.openapijsonschematools.client.servers.RootServer1 +# Server RootServer1 +public class RootServer1 + +A class that stores a server url + +## Description +The local server + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| RootServer1()
Creates a server using default values for variables | +| RootServer1([RootServer1Variables.VariablesMap](../servers/rootserver1/RootServer1Variables.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}" | +| [RootServer1Variables.VariablesMap](../servers/rootserver1/RootServer1Variables.md#variablesmap) | variables | + +[[Back to top]](#top) [[Back to Servers]](../../README.md#Servers) [[Back to README]](../../README.md) diff --git a/samples/client/petstore/kotlin/docs/servers/RootServer2.md b/samples/client/petstore/kotlin/docs/servers/RootServer2.md new file mode 100644 index 00000000000..e220476499a --- /dev/null +++ b/samples/client/petstore/kotlin/docs/servers/RootServer2.md @@ -0,0 +1,20 @@ +org.openapijsonschematools.client.servers.RootServer2 +# Server RootServer2 +public class RootServer2 + +A class that stores a server url + +## Description +staging server with no variables + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| RootServer2()
Creates a server | + +### Field Summary +| Modifier and Type | Field and Description | +| ----------------- | --------------------- | +| String | url = "https://localhost:8080" | + +[[Back to top]](#top) [[Back to Servers]](../../README.md#Servers) [[Back to README]](../../README.md) diff --git a/samples/client/petstore/kotlin/docs/servers/rootserver0/RootServer0Variables.md b/samples/client/petstore/kotlin/docs/servers/rootserver0/RootServer0Variables.md new file mode 100644 index 00000000000..c84105ef023 --- /dev/null +++ b/samples/client/petstore/kotlin/docs/servers/rootserver0/RootServer0Variables.md @@ -0,0 +1,486 @@ +# RootServer0Variables +public class RootServer0Variables
+ +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 | [RootServer0Variables.RootServer0Variables1Boxed](#rootserver0variables1boxed)
sealed interface for validated payloads | +| record | [RootServer0Variables.RootServer0Variables1BoxedMap](#rootserver0variables1boxedmap)
boxed class to store validated Map payloads | +| static class | [RootServer0Variables.RootServer0Variables1](#rootserver0variables1)
schema class | +| static class | [RootServer0Variables.VariablesMapBuilder](#variablesmapbuilder)
builder for Map payloads | +| static class | [RootServer0Variables.VariablesMap](#variablesmap)
output class for Map payloads | +| sealed interface | [RootServer0Variables.PortBoxed](#portboxed)
sealed interface for validated payloads | +| record | [RootServer0Variables.PortBoxedString](#portboxedstring)
boxed class to store validated String payloads | +| static class | [RootServer0Variables.Port](#port)
schema class | +| enum | [RootServer0Variables.StringPortEnums](#stringportenums)
String enum | +| sealed interface | [RootServer0Variables.ServerBoxed](#serverboxed)
sealed interface for validated payloads | +| record | [RootServer0Variables.ServerBoxedString](#serverboxedstring)
boxed class to store validated String payloads | +| static class | [RootServer0Variables.Server](#server)
schema class | +| enum | [RootServer0Variables.StringServerEnums](#stringserverenums)
String enum | +| sealed interface | [RootServer0Variables.AdditionalPropertiesBoxed](#additionalpropertiesboxed)
sealed interface for validated payloads | +| record | [RootServer0Variables.AdditionalPropertiesBoxedVoid](#additionalpropertiesboxedvoid)
boxed class to store validated null payloads | +| record | [RootServer0Variables.AdditionalPropertiesBoxedBoolean](#additionalpropertiesboxedboolean)
boxed class to store validated boolean payloads | +| record | [RootServer0Variables.AdditionalPropertiesBoxedNumber](#additionalpropertiesboxednumber)
boxed class to store validated Number payloads | +| record | [RootServer0Variables.AdditionalPropertiesBoxedString](#additionalpropertiesboxedstring)
boxed class to store validated String payloads | +| record | [RootServer0Variables.AdditionalPropertiesBoxedList](#additionalpropertiesboxedlist)
boxed class to store validated List payloads | +| record | [RootServer0Variables.AdditionalPropertiesBoxedMap](#additionalpropertiesboxedmap)
boxed class to store validated Map payloads | +| static class | [RootServer0Variables.AdditionalProperties](#additionalproperties)
schema class | + +## RootServer0Variables1Boxed +public sealed interface RootServer0Variables1Boxed
+permits
+[RootServer0Variables1BoxedMap](#rootserver0variables1boxedmap) + +sealed interface that stores validated payloads using boxed classes + +## RootServer0Variables1BoxedMap +public record RootServer0Variables1BoxedMap
+implements [RootServer0Variables1Boxed](#rootserver0variables1boxed) + +record that stores validated Map payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| RootServer0Variables1BoxedMap([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 | + +## RootServer0Variables1 +public static class RootServer0Variables1
+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.rootserver0.RootServer0Variables; + +import java.util.Arrays; +import java.util.List; +import java.util.AbstractMap; + +static final SchemaConfiguration configuration = new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().build()); + +// Map validation +RootServer0Variables.VariablesMap validatedPayload = + RootServer0Variables.RootServer0Variables1.validate( + new RootServer0Variables.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) | +| [RootServer0Variables1BoxedMap](#rootserver0variables1boxedmap) | validateAndBox([Map<?, ?>](#variablesmapbuilder) arg, SchemaConfiguration configuration) | +| [RootServer0Variables1Boxed](#rootserver0variables1boxed) | 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.rootserver0.RootServer0Variables; + +import java.util.Arrays; +import java.util.List; +import java.util.AbstractMap; + +static final SchemaConfiguration configuration = new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().build()); + +// String validation +String validatedPayload = RootServer0Variables.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.rootserver0.RootServer0Variables; + +import java.util.Arrays; +import java.util.List; +import java.util.AbstractMap; + +static final SchemaConfiguration configuration = new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().build()); + +// String validation +String validatedPayload = RootServer0Variables.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(Nothing? data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| Nothing? | 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/kotlin/docs/servers/rootserver1/RootServer1Variables.md b/samples/client/petstore/kotlin/docs/servers/rootserver1/RootServer1Variables.md new file mode 100644 index 00000000000..ba464ecc52f --- /dev/null +++ b/samples/client/petstore/kotlin/docs/servers/rootserver1/RootServer1Variables.md @@ -0,0 +1,355 @@ +# RootServer1Variables +public class RootServer1Variables
+ +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 | [RootServer1Variables.RootServer1Variables1Boxed](#rootserver1variables1boxed)
sealed interface for validated payloads | +| record | [RootServer1Variables.RootServer1Variables1BoxedMap](#rootserver1variables1boxedmap)
boxed class to store validated Map payloads | +| static class | [RootServer1Variables.RootServer1Variables1](#rootserver1variables1)
schema class | +| static class | [RootServer1Variables.VariablesMapBuilder](#variablesmapbuilder)
builder for Map payloads | +| static class | [RootServer1Variables.VariablesMap](#variablesmap)
output class for Map payloads | +| sealed interface | [RootServer1Variables.VersionBoxed](#versionboxed)
sealed interface for validated payloads | +| record | [RootServer1Variables.VersionBoxedString](#versionboxedstring)
boxed class to store validated String payloads | +| static class | [RootServer1Variables.Version](#version)
schema class | +| enum | [RootServer1Variables.StringVersionEnums](#stringversionenums)
String enum | +| sealed interface | [RootServer1Variables.AdditionalPropertiesBoxed](#additionalpropertiesboxed)
sealed interface for validated payloads | +| record | [RootServer1Variables.AdditionalPropertiesBoxedVoid](#additionalpropertiesboxedvoid)
boxed class to store validated null payloads | +| record | [RootServer1Variables.AdditionalPropertiesBoxedBoolean](#additionalpropertiesboxedboolean)
boxed class to store validated boolean payloads | +| record | [RootServer1Variables.AdditionalPropertiesBoxedNumber](#additionalpropertiesboxednumber)
boxed class to store validated Number payloads | +| record | [RootServer1Variables.AdditionalPropertiesBoxedString](#additionalpropertiesboxedstring)
boxed class to store validated String payloads | +| record | [RootServer1Variables.AdditionalPropertiesBoxedList](#additionalpropertiesboxedlist)
boxed class to store validated List payloads | +| record | [RootServer1Variables.AdditionalPropertiesBoxedMap](#additionalpropertiesboxedmap)
boxed class to store validated Map payloads | +| static class | [RootServer1Variables.AdditionalProperties](#additionalproperties)
schema class | + +## RootServer1Variables1Boxed +public sealed interface RootServer1Variables1Boxed
+permits
+[RootServer1Variables1BoxedMap](#rootserver1variables1boxedmap) + +sealed interface that stores validated payloads using boxed classes + +## RootServer1Variables1BoxedMap +public record RootServer1Variables1BoxedMap
+implements [RootServer1Variables1Boxed](#rootserver1variables1boxed) + +record that stores validated Map payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| RootServer1Variables1BoxedMap([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 | + +## RootServer1Variables1 +public static class RootServer1Variables1
+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.rootserver1.RootServer1Variables; + +import java.util.Arrays; +import java.util.List; +import java.util.AbstractMap; + +static final SchemaConfiguration configuration = new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().build()); + +// Map validation +RootServer1Variables.VariablesMap validatedPayload = + RootServer1Variables.RootServer1Variables1.validate( + new RootServer1Variables.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) | +| [RootServer1Variables1BoxedMap](#rootserver1variables1boxedmap) | validateAndBox([Map<?, ?>](#variablesmapbuilder) arg, SchemaConfiguration configuration) | +| [RootServer1Variables1Boxed](#rootserver1variables1boxed) | 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.rootserver1.RootServer1Variables; + +import java.util.Arrays; +import java.util.List; +import java.util.AbstractMap; + +static final SchemaConfiguration configuration = new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().build()); + +// String validation +String validatedPayload = RootServer1Variables.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(Nothing? data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| Nothing? | 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/kotlin/settings.gradle.kts b/samples/client/petstore/kotlin/settings.gradle.kts new file mode 100644 index 00000000000..588673f49ca --- /dev/null +++ b/samples/client/petstore/kotlin/settings.gradle.kts @@ -0,0 +1,2 @@ +rootProject.name = "petstore" + diff --git a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/RootServerInfo.kt b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/RootServerInfo.kt new file mode 100644 index 00000000000..2f47da779f1 --- /dev/null +++ b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/RootServerInfo.kt @@ -0,0 +1,77 @@ +package org.openapijsonschematools.client; + +import org.openapijsonschematools.client.servers.RootServer0; +import org.openapijsonschematools.client.servers.RootServer1; +import org.openapijsonschematools.client.servers.RootServer2; +import org.openapijsonschematools.client.servers.Server; +import org.openapijsonschematools.client.servers.ServerProvider; +import org.checkerframework.checker.nullness.qual.Nullable; + +import java.util.Objects; + +public class RootServerInfo { + public static class RootServerInfo1 implements ServerProvider { + private final RootServer0 server0; + private final RootServer1 server1; + private final RootServer2 server2; + + RootServerInfo1( + @Nullable RootServer0 server0, + @Nullable RootServer1 server1, + @Nullable RootServer2 server2 + ) { + this.server0 = Objects.requireNonNullElseGet(server0, RootServer0::new); + this.server1 = Objects.requireNonNullElseGet(server1, RootServer1::new); + this.server2 = Objects.requireNonNullElseGet(server2, RootServer2::new); + } + + @Override + public Server getServer(ServerIndex serverIndex) { + switch (serverIndex) { + case SERVER_0: + return server0; + case SERVER_1: + return server1; + default: + return server2; + } + } + } + + public static class RootServerInfoBuilder { + private @Nullable RootServer0 server0; + private @Nullable RootServer1 server1; + private @Nullable RootServer2 server2; + + public RootServerInfoBuilder() {} + + public RootServerInfoBuilder rootServer0(RootServer0 server0) { + this.server0 = server0; + return this; + } + + public RootServerInfoBuilder rootServer1(RootServer1 server1) { + this.server1 = server1; + return this; + } + + public RootServerInfoBuilder rootServer2(RootServer2 server2) { + this.server2 = server2; + return this; + } + + public RootServerInfo1 build() { + return new RootServerInfo1( + server0, + server1, + server2 + ); + } + } + + public enum ServerIndex { + SERVER_0, + SERVER_1, + SERVER_2 + } +} \ No newline at end of file diff --git a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/apiclient/ApiClient.kt b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/apiclient/ApiClient.kt new file mode 100644 index 00000000000..425e3a1b17f --- /dev/null +++ b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/apiclient/ApiClient.kt @@ -0,0 +1,39 @@ +package org.openapijsonschematools.client.apiclient; + +import org.checkerframework.checker.nullness.qual.Nullable; +import org.openapijsonschematools.client.configurations.ApiConfiguration; +import org.openapijsonschematools.client.configurations.SchemaConfiguration; + +import java.net.http.HttpClient; +import java.time.Duration; + +public class ApiClient { + protected final ApiConfiguration apiConfiguration; + protected final SchemaConfiguration schemaConfiguration; + protected final HttpClient client; + + public ApiClient(ApiConfiguration apiConfiguration, SchemaConfiguration schemaConfiguration) { + this.apiConfiguration = apiConfiguration; + this.schemaConfiguration = schemaConfiguration; + @Nullable Duration timeout = apiConfiguration.getTimeout(); + if (timeout != null) { + this.client = HttpClient.newBuilder() + .connectTimeout(timeout) + .build(); + } else { + this.client = HttpClient.newHttpClient(); + } + } + + public ApiConfiguration getApiConfiguration() { + return apiConfiguration; + } + + public SchemaConfiguration getSchemaConfiguration() { + return schemaConfiguration; + } + + public HttpClient getClient() { + return client; + } +} diff --git a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/apis/paths/Anotherfakedummy.kt b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/apis/paths/Anotherfakedummy.kt new file mode 100644 index 00000000000..b687c5fc891 --- /dev/null +++ b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/apis/paths/Anotherfakedummy.kt @@ -0,0 +1,14 @@ +package org.openapijsonschematools.client.apis.paths; + +import org.openapijsonschematools.client.apiclient.ApiClient; +import org.openapijsonschematools.client.configurations.ApiConfiguration; +import org.openapijsonschematools.client.configurations.SchemaConfiguration; +import org.openapijsonschematools.client.paths.anotherfakedummy.AnotherfakedummyPatch; + +public class Anotherfakedummy extends ApiClient implements + AnotherfakedummyPatch.PatchOperation +{ + public Anotherfakedummy(ApiConfiguration apiConfiguration, SchemaConfiguration schemaConfiguration) { + super(apiConfiguration, schemaConfiguration); + } +} \ No newline at end of file diff --git a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/apis/paths/Commonparamsubdir.kt b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/apis/paths/Commonparamsubdir.kt new file mode 100644 index 00000000000..400521401ea --- /dev/null +++ b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/apis/paths/Commonparamsubdir.kt @@ -0,0 +1,18 @@ +package org.openapijsonschematools.client.apis.paths; + +import org.openapijsonschematools.client.apiclient.ApiClient; +import org.openapijsonschematools.client.configurations.ApiConfiguration; +import org.openapijsonschematools.client.configurations.SchemaConfiguration; +import org.openapijsonschematools.client.paths.commonparamsubdir.CommonparamsubdirDelete; +import org.openapijsonschematools.client.paths.commonparamsubdir.CommonparamsubdirGet; +import org.openapijsonschematools.client.paths.commonparamsubdir.CommonparamsubdirPost; + +public class Commonparamsubdir extends ApiClient implements + CommonparamsubdirDelete.DeleteOperation, + CommonparamsubdirGet.GetOperation, + CommonparamsubdirPost.PostOperation +{ + public Commonparamsubdir(ApiConfiguration apiConfiguration, SchemaConfiguration schemaConfiguration) { + super(apiConfiguration, schemaConfiguration); + } +} \ No newline at end of file diff --git a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/apis/paths/Fake.kt b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/apis/paths/Fake.kt new file mode 100644 index 00000000000..ac3c467aeb1 --- /dev/null +++ b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/apis/paths/Fake.kt @@ -0,0 +1,20 @@ +package org.openapijsonschematools.client.apis.paths; + +import org.openapijsonschematools.client.apiclient.ApiClient; +import org.openapijsonschematools.client.configurations.ApiConfiguration; +import org.openapijsonschematools.client.configurations.SchemaConfiguration; +import org.openapijsonschematools.client.paths.fake.FakeDelete; +import org.openapijsonschematools.client.paths.fake.FakeGet; +import org.openapijsonschematools.client.paths.fake.FakePatch; +import org.openapijsonschematools.client.paths.fake.FakePost; + +public class Fake extends ApiClient implements + FakeDelete.DeleteOperation, + FakeGet.GetOperation, + FakePatch.PatchOperation, + FakePost.PostOperation +{ + public Fake(ApiConfiguration apiConfiguration, SchemaConfiguration schemaConfiguration) { + super(apiConfiguration, schemaConfiguration); + } +} \ No newline at end of file diff --git a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/apis/paths/Fakeadditionalpropertieswitharrayofenums.kt b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/apis/paths/Fakeadditionalpropertieswitharrayofenums.kt new file mode 100644 index 00000000000..4bf9d268646 --- /dev/null +++ b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/apis/paths/Fakeadditionalpropertieswitharrayofenums.kt @@ -0,0 +1,14 @@ +package org.openapijsonschematools.client.apis.paths; + +import org.openapijsonschematools.client.apiclient.ApiClient; +import org.openapijsonschematools.client.configurations.ApiConfiguration; +import org.openapijsonschematools.client.configurations.SchemaConfiguration; +import org.openapijsonschematools.client.paths.fakeadditionalpropertieswitharrayofenums.FakeadditionalpropertieswitharrayofenumsGet; + +public class Fakeadditionalpropertieswitharrayofenums extends ApiClient implements + FakeadditionalpropertieswitharrayofenumsGet.GetOperation +{ + public Fakeadditionalpropertieswitharrayofenums(ApiConfiguration apiConfiguration, SchemaConfiguration schemaConfiguration) { + super(apiConfiguration, schemaConfiguration); + } +} \ No newline at end of file diff --git a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/apis/paths/Fakebodywithfileschema.kt b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/apis/paths/Fakebodywithfileschema.kt new file mode 100644 index 00000000000..a89c0f20cb9 --- /dev/null +++ b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/apis/paths/Fakebodywithfileschema.kt @@ -0,0 +1,14 @@ +package org.openapijsonschematools.client.apis.paths; + +import org.openapijsonschematools.client.apiclient.ApiClient; +import org.openapijsonschematools.client.configurations.ApiConfiguration; +import org.openapijsonschematools.client.configurations.SchemaConfiguration; +import org.openapijsonschematools.client.paths.fakebodywithfileschema.FakebodywithfileschemaPut; + +public class Fakebodywithfileschema extends ApiClient implements + FakebodywithfileschemaPut.PutOperation +{ + public Fakebodywithfileschema(ApiConfiguration apiConfiguration, SchemaConfiguration schemaConfiguration) { + super(apiConfiguration, schemaConfiguration); + } +} \ No newline at end of file diff --git a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/apis/paths/Fakebodywithqueryparams.kt b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/apis/paths/Fakebodywithqueryparams.kt new file mode 100644 index 00000000000..6d592293a3d --- /dev/null +++ b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/apis/paths/Fakebodywithqueryparams.kt @@ -0,0 +1,14 @@ +package org.openapijsonschematools.client.apis.paths; + +import org.openapijsonschematools.client.apiclient.ApiClient; +import org.openapijsonschematools.client.configurations.ApiConfiguration; +import org.openapijsonschematools.client.configurations.SchemaConfiguration; +import org.openapijsonschematools.client.paths.fakebodywithqueryparams.FakebodywithqueryparamsPut; + +public class Fakebodywithqueryparams extends ApiClient implements + FakebodywithqueryparamsPut.PutOperation +{ + public Fakebodywithqueryparams(ApiConfiguration apiConfiguration, SchemaConfiguration schemaConfiguration) { + super(apiConfiguration, schemaConfiguration); + } +} \ No newline at end of file diff --git a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/apis/paths/Fakecasesensitiveparams.kt b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/apis/paths/Fakecasesensitiveparams.kt new file mode 100644 index 00000000000..efbc1ef7ff2 --- /dev/null +++ b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/apis/paths/Fakecasesensitiveparams.kt @@ -0,0 +1,14 @@ +package org.openapijsonschematools.client.apis.paths; + +import org.openapijsonschematools.client.apiclient.ApiClient; +import org.openapijsonschematools.client.configurations.ApiConfiguration; +import org.openapijsonschematools.client.configurations.SchemaConfiguration; +import org.openapijsonschematools.client.paths.fakecasesensitiveparams.FakecasesensitiveparamsPut; + +public class Fakecasesensitiveparams extends ApiClient implements + FakecasesensitiveparamsPut.PutOperation +{ + public Fakecasesensitiveparams(ApiConfiguration apiConfiguration, SchemaConfiguration schemaConfiguration) { + super(apiConfiguration, schemaConfiguration); + } +} \ No newline at end of file diff --git a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/apis/paths/Fakeclassnametest.kt b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/apis/paths/Fakeclassnametest.kt new file mode 100644 index 00000000000..53160a2beb8 --- /dev/null +++ b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/apis/paths/Fakeclassnametest.kt @@ -0,0 +1,14 @@ +package org.openapijsonschematools.client.apis.paths; + +import org.openapijsonschematools.client.apiclient.ApiClient; +import org.openapijsonschematools.client.configurations.ApiConfiguration; +import org.openapijsonschematools.client.configurations.SchemaConfiguration; +import org.openapijsonschematools.client.paths.fakeclassnametest.FakeclassnametestPatch; + +public class Fakeclassnametest extends ApiClient implements + FakeclassnametestPatch.PatchOperation +{ + public Fakeclassnametest(ApiConfiguration apiConfiguration, SchemaConfiguration schemaConfiguration) { + super(apiConfiguration, schemaConfiguration); + } +} \ No newline at end of file diff --git a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/apis/paths/Fakedeletecoffeeid.kt b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/apis/paths/Fakedeletecoffeeid.kt new file mode 100644 index 00000000000..5bd8e4f21a5 --- /dev/null +++ b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/apis/paths/Fakedeletecoffeeid.kt @@ -0,0 +1,14 @@ +package org.openapijsonschematools.client.apis.paths; + +import org.openapijsonschematools.client.apiclient.ApiClient; +import org.openapijsonschematools.client.configurations.ApiConfiguration; +import org.openapijsonschematools.client.configurations.SchemaConfiguration; +import org.openapijsonschematools.client.paths.fakedeletecoffeeid.FakedeletecoffeeidDelete; + +public class Fakedeletecoffeeid extends ApiClient implements + FakedeletecoffeeidDelete.DeleteOperation +{ + public Fakedeletecoffeeid(ApiConfiguration apiConfiguration, SchemaConfiguration schemaConfiguration) { + super(apiConfiguration, schemaConfiguration); + } +} \ No newline at end of file diff --git a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/apis/paths/Fakehealth.kt b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/apis/paths/Fakehealth.kt new file mode 100644 index 00000000000..391f0afd3a0 --- /dev/null +++ b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/apis/paths/Fakehealth.kt @@ -0,0 +1,14 @@ +package org.openapijsonschematools.client.apis.paths; + +import org.openapijsonschematools.client.apiclient.ApiClient; +import org.openapijsonschematools.client.configurations.ApiConfiguration; +import org.openapijsonschematools.client.configurations.SchemaConfiguration; +import org.openapijsonschematools.client.paths.fakehealth.FakehealthGet; + +public class Fakehealth extends ApiClient implements + FakehealthGet.GetOperation +{ + public Fakehealth(ApiConfiguration apiConfiguration, SchemaConfiguration schemaConfiguration) { + super(apiConfiguration, schemaConfiguration); + } +} \ No newline at end of file diff --git a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/apis/paths/Fakeinlineadditionalproperties.kt b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/apis/paths/Fakeinlineadditionalproperties.kt new file mode 100644 index 00000000000..600ba72edd3 --- /dev/null +++ b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/apis/paths/Fakeinlineadditionalproperties.kt @@ -0,0 +1,14 @@ +package org.openapijsonschematools.client.apis.paths; + +import org.openapijsonschematools.client.apiclient.ApiClient; +import org.openapijsonschematools.client.configurations.ApiConfiguration; +import org.openapijsonschematools.client.configurations.SchemaConfiguration; +import org.openapijsonschematools.client.paths.fakeinlineadditionalproperties.FakeinlineadditionalpropertiesPost; + +public class Fakeinlineadditionalproperties extends ApiClient implements + FakeinlineadditionalpropertiesPost.PostOperation +{ + public Fakeinlineadditionalproperties(ApiConfiguration apiConfiguration, SchemaConfiguration schemaConfiguration) { + super(apiConfiguration, schemaConfiguration); + } +} \ No newline at end of file diff --git a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/apis/paths/Fakeinlinecomposition.kt b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/apis/paths/Fakeinlinecomposition.kt new file mode 100644 index 00000000000..694beae690f --- /dev/null +++ b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/apis/paths/Fakeinlinecomposition.kt @@ -0,0 +1,14 @@ +package org.openapijsonschematools.client.apis.paths; + +import org.openapijsonschematools.client.apiclient.ApiClient; +import org.openapijsonschematools.client.configurations.ApiConfiguration; +import org.openapijsonschematools.client.configurations.SchemaConfiguration; +import org.openapijsonschematools.client.paths.fakeinlinecomposition.FakeinlinecompositionPost; + +public class Fakeinlinecomposition extends ApiClient implements + FakeinlinecompositionPost.PostOperation +{ + public Fakeinlinecomposition(ApiConfiguration apiConfiguration, SchemaConfiguration schemaConfiguration) { + super(apiConfiguration, schemaConfiguration); + } +} \ No newline at end of file diff --git a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/apis/paths/Fakejsonformdata.kt b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/apis/paths/Fakejsonformdata.kt new file mode 100644 index 00000000000..aa70adcb670 --- /dev/null +++ b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/apis/paths/Fakejsonformdata.kt @@ -0,0 +1,14 @@ +package org.openapijsonschematools.client.apis.paths; + +import org.openapijsonschematools.client.apiclient.ApiClient; +import org.openapijsonschematools.client.configurations.ApiConfiguration; +import org.openapijsonschematools.client.configurations.SchemaConfiguration; +import org.openapijsonschematools.client.paths.fakejsonformdata.FakejsonformdataGet; + +public class Fakejsonformdata extends ApiClient implements + FakejsonformdataGet.GetOperation +{ + public Fakejsonformdata(ApiConfiguration apiConfiguration, SchemaConfiguration schemaConfiguration) { + super(apiConfiguration, schemaConfiguration); + } +} \ No newline at end of file diff --git a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/apis/paths/Fakejsonpatch.kt b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/apis/paths/Fakejsonpatch.kt new file mode 100644 index 00000000000..373069d8e7e --- /dev/null +++ b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/apis/paths/Fakejsonpatch.kt @@ -0,0 +1,14 @@ +package org.openapijsonschematools.client.apis.paths; + +import org.openapijsonschematools.client.apiclient.ApiClient; +import org.openapijsonschematools.client.configurations.ApiConfiguration; +import org.openapijsonschematools.client.configurations.SchemaConfiguration; +import org.openapijsonschematools.client.paths.fakejsonpatch.FakejsonpatchPatch; + +public class Fakejsonpatch extends ApiClient implements + FakejsonpatchPatch.PatchOperation +{ + public Fakejsonpatch(ApiConfiguration apiConfiguration, SchemaConfiguration schemaConfiguration) { + super(apiConfiguration, schemaConfiguration); + } +} \ No newline at end of file diff --git a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/apis/paths/Fakejsonwithcharset.kt b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/apis/paths/Fakejsonwithcharset.kt new file mode 100644 index 00000000000..abf3406ac4d --- /dev/null +++ b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/apis/paths/Fakejsonwithcharset.kt @@ -0,0 +1,14 @@ +package org.openapijsonschematools.client.apis.paths; + +import org.openapijsonschematools.client.apiclient.ApiClient; +import org.openapijsonschematools.client.configurations.ApiConfiguration; +import org.openapijsonschematools.client.configurations.SchemaConfiguration; +import org.openapijsonschematools.client.paths.fakejsonwithcharset.FakejsonwithcharsetPost; + +public class Fakejsonwithcharset extends ApiClient implements + FakejsonwithcharsetPost.PostOperation +{ + public Fakejsonwithcharset(ApiConfiguration apiConfiguration, SchemaConfiguration schemaConfiguration) { + super(apiConfiguration, schemaConfiguration); + } +} \ No newline at end of file diff --git a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/apis/paths/Fakemultiplerequestbodycontenttypes.kt b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/apis/paths/Fakemultiplerequestbodycontenttypes.kt new file mode 100644 index 00000000000..9e1ca236245 --- /dev/null +++ b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/apis/paths/Fakemultiplerequestbodycontenttypes.kt @@ -0,0 +1,14 @@ +package org.openapijsonschematools.client.apis.paths; + +import org.openapijsonschematools.client.apiclient.ApiClient; +import org.openapijsonschematools.client.configurations.ApiConfiguration; +import org.openapijsonschematools.client.configurations.SchemaConfiguration; +import org.openapijsonschematools.client.paths.fakemultiplerequestbodycontenttypes.FakemultiplerequestbodycontenttypesPost; + +public class Fakemultiplerequestbodycontenttypes extends ApiClient implements + FakemultiplerequestbodycontenttypesPost.PostOperation +{ + public Fakemultiplerequestbodycontenttypes(ApiConfiguration apiConfiguration, SchemaConfiguration schemaConfiguration) { + super(apiConfiguration, schemaConfiguration); + } +} \ No newline at end of file diff --git a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/apis/paths/Fakemultipleresponsebodies.kt b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/apis/paths/Fakemultipleresponsebodies.kt new file mode 100644 index 00000000000..91d15710637 --- /dev/null +++ b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/apis/paths/Fakemultipleresponsebodies.kt @@ -0,0 +1,14 @@ +package org.openapijsonschematools.client.apis.paths; + +import org.openapijsonschematools.client.apiclient.ApiClient; +import org.openapijsonschematools.client.configurations.ApiConfiguration; +import org.openapijsonschematools.client.configurations.SchemaConfiguration; +import org.openapijsonschematools.client.paths.fakemultipleresponsebodies.FakemultipleresponsebodiesGet; + +public class Fakemultipleresponsebodies extends ApiClient implements + FakemultipleresponsebodiesGet.GetOperation +{ + public Fakemultipleresponsebodies(ApiConfiguration apiConfiguration, SchemaConfiguration schemaConfiguration) { + super(apiConfiguration, schemaConfiguration); + } +} \ No newline at end of file diff --git a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/apis/paths/Fakemultiplesecurities.kt b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/apis/paths/Fakemultiplesecurities.kt new file mode 100644 index 00000000000..d7cc6cbbcc6 --- /dev/null +++ b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/apis/paths/Fakemultiplesecurities.kt @@ -0,0 +1,14 @@ +package org.openapijsonschematools.client.apis.paths; + +import org.openapijsonschematools.client.apiclient.ApiClient; +import org.openapijsonschematools.client.configurations.ApiConfiguration; +import org.openapijsonschematools.client.configurations.SchemaConfiguration; +import org.openapijsonschematools.client.paths.fakemultiplesecurities.FakemultiplesecuritiesGet; + +public class Fakemultiplesecurities extends ApiClient implements + FakemultiplesecuritiesGet.GetOperation +{ + public Fakemultiplesecurities(ApiConfiguration apiConfiguration, SchemaConfiguration schemaConfiguration) { + super(apiConfiguration, schemaConfiguration); + } +} \ No newline at end of file diff --git a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/apis/paths/Fakeobjinquery.kt b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/apis/paths/Fakeobjinquery.kt new file mode 100644 index 00000000000..793a01568fd --- /dev/null +++ b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/apis/paths/Fakeobjinquery.kt @@ -0,0 +1,14 @@ +package org.openapijsonschematools.client.apis.paths; + +import org.openapijsonschematools.client.apiclient.ApiClient; +import org.openapijsonschematools.client.configurations.ApiConfiguration; +import org.openapijsonschematools.client.configurations.SchemaConfiguration; +import org.openapijsonschematools.client.paths.fakeobjinquery.FakeobjinqueryGet; + +public class Fakeobjinquery extends ApiClient implements + FakeobjinqueryGet.GetOperation +{ + public Fakeobjinquery(ApiConfiguration apiConfiguration, SchemaConfiguration schemaConfiguration) { + super(apiConfiguration, schemaConfiguration); + } +} \ No newline at end of file diff --git a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/apis/paths/Fakeparametercollisions1ababselfab.kt b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/apis/paths/Fakeparametercollisions1ababselfab.kt new file mode 100644 index 00000000000..8b399939b4c --- /dev/null +++ b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/apis/paths/Fakeparametercollisions1ababselfab.kt @@ -0,0 +1,14 @@ +package org.openapijsonschematools.client.apis.paths; + +import org.openapijsonschematools.client.apiclient.ApiClient; +import org.openapijsonschematools.client.configurations.ApiConfiguration; +import org.openapijsonschematools.client.configurations.SchemaConfiguration; +import org.openapijsonschematools.client.paths.fakeparametercollisions1ababselfab.Fakeparametercollisions1ababselfabPost; + +public class Fakeparametercollisions1ababselfab extends ApiClient implements + Fakeparametercollisions1ababselfabPost.PostOperation +{ + public Fakeparametercollisions1ababselfab(ApiConfiguration apiConfiguration, SchemaConfiguration schemaConfiguration) { + super(apiConfiguration, schemaConfiguration); + } +} \ No newline at end of file diff --git a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/apis/paths/Fakepemcontenttype.kt b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/apis/paths/Fakepemcontenttype.kt new file mode 100644 index 00000000000..4ca9fe02e9e --- /dev/null +++ b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/apis/paths/Fakepemcontenttype.kt @@ -0,0 +1,14 @@ +package org.openapijsonschematools.client.apis.paths; + +import org.openapijsonschematools.client.apiclient.ApiClient; +import org.openapijsonschematools.client.configurations.ApiConfiguration; +import org.openapijsonschematools.client.configurations.SchemaConfiguration; +import org.openapijsonschematools.client.paths.fakepemcontenttype.FakepemcontenttypeGet; + +public class Fakepemcontenttype extends ApiClient implements + FakepemcontenttypeGet.GetOperation +{ + public Fakepemcontenttype(ApiConfiguration apiConfiguration, SchemaConfiguration schemaConfiguration) { + super(apiConfiguration, schemaConfiguration); + } +} \ No newline at end of file diff --git a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/apis/paths/Fakepetiduploadimagewithrequiredfile.kt b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/apis/paths/Fakepetiduploadimagewithrequiredfile.kt new file mode 100644 index 00000000000..bbd2557c597 --- /dev/null +++ b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/apis/paths/Fakepetiduploadimagewithrequiredfile.kt @@ -0,0 +1,14 @@ +package org.openapijsonschematools.client.apis.paths; + +import org.openapijsonschematools.client.apiclient.ApiClient; +import org.openapijsonschematools.client.configurations.ApiConfiguration; +import org.openapijsonschematools.client.configurations.SchemaConfiguration; +import org.openapijsonschematools.client.paths.fakepetiduploadimagewithrequiredfile.FakepetiduploadimagewithrequiredfilePost; + +public class Fakepetiduploadimagewithrequiredfile extends ApiClient implements + FakepetiduploadimagewithrequiredfilePost.PostOperation +{ + public Fakepetiduploadimagewithrequiredfile(ApiConfiguration apiConfiguration, SchemaConfiguration schemaConfiguration) { + super(apiConfiguration, schemaConfiguration); + } +} \ No newline at end of file diff --git a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/apis/paths/Fakequeryparamwithjsoncontenttype.kt b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/apis/paths/Fakequeryparamwithjsoncontenttype.kt new file mode 100644 index 00000000000..553ed3c4117 --- /dev/null +++ b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/apis/paths/Fakequeryparamwithjsoncontenttype.kt @@ -0,0 +1,14 @@ +package org.openapijsonschematools.client.apis.paths; + +import org.openapijsonschematools.client.apiclient.ApiClient; +import org.openapijsonschematools.client.configurations.ApiConfiguration; +import org.openapijsonschematools.client.configurations.SchemaConfiguration; +import org.openapijsonschematools.client.paths.fakequeryparamwithjsoncontenttype.FakequeryparamwithjsoncontenttypeGet; + +public class Fakequeryparamwithjsoncontenttype extends ApiClient implements + FakequeryparamwithjsoncontenttypeGet.GetOperation +{ + public Fakequeryparamwithjsoncontenttype(ApiConfiguration apiConfiguration, SchemaConfiguration schemaConfiguration) { + super(apiConfiguration, schemaConfiguration); + } +} \ No newline at end of file diff --git a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/apis/paths/Fakeredirection.kt b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/apis/paths/Fakeredirection.kt new file mode 100644 index 00000000000..828e7ba3327 --- /dev/null +++ b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/apis/paths/Fakeredirection.kt @@ -0,0 +1,14 @@ +package org.openapijsonschematools.client.apis.paths; + +import org.openapijsonschematools.client.apiclient.ApiClient; +import org.openapijsonschematools.client.configurations.ApiConfiguration; +import org.openapijsonschematools.client.configurations.SchemaConfiguration; +import org.openapijsonschematools.client.paths.fakeredirection.FakeredirectionGet; + +public class Fakeredirection extends ApiClient implements + FakeredirectionGet.GetOperation +{ + public Fakeredirection(ApiConfiguration apiConfiguration, SchemaConfiguration schemaConfiguration) { + super(apiConfiguration, schemaConfiguration); + } +} \ No newline at end of file diff --git a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/apis/paths/Fakerefobjinquery.kt b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/apis/paths/Fakerefobjinquery.kt new file mode 100644 index 00000000000..15bc931dce8 --- /dev/null +++ b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/apis/paths/Fakerefobjinquery.kt @@ -0,0 +1,14 @@ +package org.openapijsonschematools.client.apis.paths; + +import org.openapijsonschematools.client.apiclient.ApiClient; +import org.openapijsonschematools.client.configurations.ApiConfiguration; +import org.openapijsonschematools.client.configurations.SchemaConfiguration; +import org.openapijsonschematools.client.paths.fakerefobjinquery.FakerefobjinqueryGet; + +public class Fakerefobjinquery extends ApiClient implements + FakerefobjinqueryGet.GetOperation +{ + public Fakerefobjinquery(ApiConfiguration apiConfiguration, SchemaConfiguration schemaConfiguration) { + super(apiConfiguration, schemaConfiguration); + } +} \ No newline at end of file diff --git a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/apis/paths/Fakerefsarraymodel.kt b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/apis/paths/Fakerefsarraymodel.kt new file mode 100644 index 00000000000..250a772fbc1 --- /dev/null +++ b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/apis/paths/Fakerefsarraymodel.kt @@ -0,0 +1,14 @@ +package org.openapijsonschematools.client.apis.paths; + +import org.openapijsonschematools.client.apiclient.ApiClient; +import org.openapijsonschematools.client.configurations.ApiConfiguration; +import org.openapijsonschematools.client.configurations.SchemaConfiguration; +import org.openapijsonschematools.client.paths.fakerefsarraymodel.FakerefsarraymodelPost; + +public class Fakerefsarraymodel extends ApiClient implements + FakerefsarraymodelPost.PostOperation +{ + public Fakerefsarraymodel(ApiConfiguration apiConfiguration, SchemaConfiguration schemaConfiguration) { + super(apiConfiguration, schemaConfiguration); + } +} \ No newline at end of file diff --git a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/apis/paths/Fakerefsarrayofenums.kt b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/apis/paths/Fakerefsarrayofenums.kt new file mode 100644 index 00000000000..988912d6318 --- /dev/null +++ b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/apis/paths/Fakerefsarrayofenums.kt @@ -0,0 +1,14 @@ +package org.openapijsonschematools.client.apis.paths; + +import org.openapijsonschematools.client.apiclient.ApiClient; +import org.openapijsonschematools.client.configurations.ApiConfiguration; +import org.openapijsonschematools.client.configurations.SchemaConfiguration; +import org.openapijsonschematools.client.paths.fakerefsarrayofenums.FakerefsarrayofenumsPost; + +public class Fakerefsarrayofenums extends ApiClient implements + FakerefsarrayofenumsPost.PostOperation +{ + public Fakerefsarrayofenums(ApiConfiguration apiConfiguration, SchemaConfiguration schemaConfiguration) { + super(apiConfiguration, schemaConfiguration); + } +} \ No newline at end of file diff --git a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/apis/paths/Fakerefsboolean.kt b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/apis/paths/Fakerefsboolean.kt new file mode 100644 index 00000000000..85159625e64 --- /dev/null +++ b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/apis/paths/Fakerefsboolean.kt @@ -0,0 +1,14 @@ +package org.openapijsonschematools.client.apis.paths; + +import org.openapijsonschematools.client.apiclient.ApiClient; +import org.openapijsonschematools.client.configurations.ApiConfiguration; +import org.openapijsonschematools.client.configurations.SchemaConfiguration; +import org.openapijsonschematools.client.paths.fakerefsboolean.FakerefsbooleanPost; + +public class Fakerefsboolean extends ApiClient implements + FakerefsbooleanPost.PostOperation +{ + public Fakerefsboolean(ApiConfiguration apiConfiguration, SchemaConfiguration schemaConfiguration) { + super(apiConfiguration, schemaConfiguration); + } +} \ No newline at end of file diff --git a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/apis/paths/Fakerefscomposedoneofnumberwithvalidations.kt b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/apis/paths/Fakerefscomposedoneofnumberwithvalidations.kt new file mode 100644 index 00000000000..a129e1082de --- /dev/null +++ b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/apis/paths/Fakerefscomposedoneofnumberwithvalidations.kt @@ -0,0 +1,14 @@ +package org.openapijsonschematools.client.apis.paths; + +import org.openapijsonschematools.client.apiclient.ApiClient; +import org.openapijsonschematools.client.configurations.ApiConfiguration; +import org.openapijsonschematools.client.configurations.SchemaConfiguration; +import org.openapijsonschematools.client.paths.fakerefscomposedoneofnumberwithvalidations.FakerefscomposedoneofnumberwithvalidationsPost; + +public class Fakerefscomposedoneofnumberwithvalidations extends ApiClient implements + FakerefscomposedoneofnumberwithvalidationsPost.PostOperation +{ + public Fakerefscomposedoneofnumberwithvalidations(ApiConfiguration apiConfiguration, SchemaConfiguration schemaConfiguration) { + super(apiConfiguration, schemaConfiguration); + } +} \ No newline at end of file diff --git a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/apis/paths/Fakerefsenum.kt b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/apis/paths/Fakerefsenum.kt new file mode 100644 index 00000000000..8ba08ff3be7 --- /dev/null +++ b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/apis/paths/Fakerefsenum.kt @@ -0,0 +1,14 @@ +package org.openapijsonschematools.client.apis.paths; + +import org.openapijsonschematools.client.apiclient.ApiClient; +import org.openapijsonschematools.client.configurations.ApiConfiguration; +import org.openapijsonschematools.client.configurations.SchemaConfiguration; +import org.openapijsonschematools.client.paths.fakerefsenum.FakerefsenumPost; + +public class Fakerefsenum extends ApiClient implements + FakerefsenumPost.PostOperation +{ + public Fakerefsenum(ApiConfiguration apiConfiguration, SchemaConfiguration schemaConfiguration) { + super(apiConfiguration, schemaConfiguration); + } +} \ No newline at end of file diff --git a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/apis/paths/Fakerefsmammal.kt b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/apis/paths/Fakerefsmammal.kt new file mode 100644 index 00000000000..2ccab524251 --- /dev/null +++ b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/apis/paths/Fakerefsmammal.kt @@ -0,0 +1,14 @@ +package org.openapijsonschematools.client.apis.paths; + +import org.openapijsonschematools.client.apiclient.ApiClient; +import org.openapijsonschematools.client.configurations.ApiConfiguration; +import org.openapijsonschematools.client.configurations.SchemaConfiguration; +import org.openapijsonschematools.client.paths.fakerefsmammal.FakerefsmammalPost; + +public class Fakerefsmammal extends ApiClient implements + FakerefsmammalPost.PostOperation +{ + public Fakerefsmammal(ApiConfiguration apiConfiguration, SchemaConfiguration schemaConfiguration) { + super(apiConfiguration, schemaConfiguration); + } +} \ No newline at end of file diff --git a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/apis/paths/Fakerefsnumber.kt b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/apis/paths/Fakerefsnumber.kt new file mode 100644 index 00000000000..f1427e288f3 --- /dev/null +++ b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/apis/paths/Fakerefsnumber.kt @@ -0,0 +1,14 @@ +package org.openapijsonschematools.client.apis.paths; + +import org.openapijsonschematools.client.apiclient.ApiClient; +import org.openapijsonschematools.client.configurations.ApiConfiguration; +import org.openapijsonschematools.client.configurations.SchemaConfiguration; +import org.openapijsonschematools.client.paths.fakerefsnumber.FakerefsnumberPost; + +public class Fakerefsnumber extends ApiClient implements + FakerefsnumberPost.PostOperation +{ + public Fakerefsnumber(ApiConfiguration apiConfiguration, SchemaConfiguration schemaConfiguration) { + super(apiConfiguration, schemaConfiguration); + } +} \ No newline at end of file diff --git a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/apis/paths/Fakerefsobjectmodelwithrefprops.kt b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/apis/paths/Fakerefsobjectmodelwithrefprops.kt new file mode 100644 index 00000000000..ed6b1aff9fc --- /dev/null +++ b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/apis/paths/Fakerefsobjectmodelwithrefprops.kt @@ -0,0 +1,14 @@ +package org.openapijsonschematools.client.apis.paths; + +import org.openapijsonschematools.client.apiclient.ApiClient; +import org.openapijsonschematools.client.configurations.ApiConfiguration; +import org.openapijsonschematools.client.configurations.SchemaConfiguration; +import org.openapijsonschematools.client.paths.fakerefsobjectmodelwithrefprops.FakerefsobjectmodelwithrefpropsPost; + +public class Fakerefsobjectmodelwithrefprops extends ApiClient implements + FakerefsobjectmodelwithrefpropsPost.PostOperation +{ + public Fakerefsobjectmodelwithrefprops(ApiConfiguration apiConfiguration, SchemaConfiguration schemaConfiguration) { + super(apiConfiguration, schemaConfiguration); + } +} \ No newline at end of file diff --git a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/apis/paths/Fakerefsstring.kt b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/apis/paths/Fakerefsstring.kt new file mode 100644 index 00000000000..bc6044ae3df --- /dev/null +++ b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/apis/paths/Fakerefsstring.kt @@ -0,0 +1,14 @@ +package org.openapijsonschematools.client.apis.paths; + +import org.openapijsonschematools.client.apiclient.ApiClient; +import org.openapijsonschematools.client.configurations.ApiConfiguration; +import org.openapijsonschematools.client.configurations.SchemaConfiguration; +import org.openapijsonschematools.client.paths.fakerefsstring.FakerefsstringPost; + +public class Fakerefsstring extends ApiClient implements + FakerefsstringPost.PostOperation +{ + public Fakerefsstring(ApiConfiguration apiConfiguration, SchemaConfiguration schemaConfiguration) { + super(apiConfiguration, schemaConfiguration); + } +} \ No newline at end of file diff --git a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/apis/paths/Fakeresponsewithoutschema.kt b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/apis/paths/Fakeresponsewithoutschema.kt new file mode 100644 index 00000000000..6219862cf7d --- /dev/null +++ b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/apis/paths/Fakeresponsewithoutschema.kt @@ -0,0 +1,14 @@ +package org.openapijsonschematools.client.apis.paths; + +import org.openapijsonschematools.client.apiclient.ApiClient; +import org.openapijsonschematools.client.configurations.ApiConfiguration; +import org.openapijsonschematools.client.configurations.SchemaConfiguration; +import org.openapijsonschematools.client.paths.fakeresponsewithoutschema.FakeresponsewithoutschemaGet; + +public class Fakeresponsewithoutschema extends ApiClient implements + FakeresponsewithoutschemaGet.GetOperation +{ + public Fakeresponsewithoutschema(ApiConfiguration apiConfiguration, SchemaConfiguration schemaConfiguration) { + super(apiConfiguration, schemaConfiguration); + } +} \ No newline at end of file diff --git a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/apis/paths/Faketestqueryparamters.kt b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/apis/paths/Faketestqueryparamters.kt new file mode 100644 index 00000000000..cc22cfe66be --- /dev/null +++ b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/apis/paths/Faketestqueryparamters.kt @@ -0,0 +1,14 @@ +package org.openapijsonschematools.client.apis.paths; + +import org.openapijsonschematools.client.apiclient.ApiClient; +import org.openapijsonschematools.client.configurations.ApiConfiguration; +import org.openapijsonschematools.client.configurations.SchemaConfiguration; +import org.openapijsonschematools.client.paths.faketestqueryparamters.FaketestqueryparamtersPut; + +public class Faketestqueryparamters extends ApiClient implements + FaketestqueryparamtersPut.PutOperation +{ + public Faketestqueryparamters(ApiConfiguration apiConfiguration, SchemaConfiguration schemaConfiguration) { + super(apiConfiguration, schemaConfiguration); + } +} \ No newline at end of file diff --git a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/apis/paths/Fakeuploaddownloadfile.kt b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/apis/paths/Fakeuploaddownloadfile.kt new file mode 100644 index 00000000000..87b8ed880ff --- /dev/null +++ b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/apis/paths/Fakeuploaddownloadfile.kt @@ -0,0 +1,14 @@ +package org.openapijsonschematools.client.apis.paths; + +import org.openapijsonschematools.client.apiclient.ApiClient; +import org.openapijsonschematools.client.configurations.ApiConfiguration; +import org.openapijsonschematools.client.configurations.SchemaConfiguration; +import org.openapijsonschematools.client.paths.fakeuploaddownloadfile.FakeuploaddownloadfilePost; + +public class Fakeuploaddownloadfile extends ApiClient implements + FakeuploaddownloadfilePost.PostOperation +{ + public Fakeuploaddownloadfile(ApiConfiguration apiConfiguration, SchemaConfiguration schemaConfiguration) { + super(apiConfiguration, schemaConfiguration); + } +} \ No newline at end of file diff --git a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/apis/paths/Fakeuploadfile.kt b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/apis/paths/Fakeuploadfile.kt new file mode 100644 index 00000000000..8b8f6ce8678 --- /dev/null +++ b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/apis/paths/Fakeuploadfile.kt @@ -0,0 +1,14 @@ +package org.openapijsonschematools.client.apis.paths; + +import org.openapijsonschematools.client.apiclient.ApiClient; +import org.openapijsonschematools.client.configurations.ApiConfiguration; +import org.openapijsonschematools.client.configurations.SchemaConfiguration; +import org.openapijsonschematools.client.paths.fakeuploadfile.FakeuploadfilePost; + +public class Fakeuploadfile extends ApiClient implements + FakeuploadfilePost.PostOperation +{ + public Fakeuploadfile(ApiConfiguration apiConfiguration, SchemaConfiguration schemaConfiguration) { + super(apiConfiguration, schemaConfiguration); + } +} \ No newline at end of file diff --git a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/apis/paths/Fakeuploadfiles.kt b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/apis/paths/Fakeuploadfiles.kt new file mode 100644 index 00000000000..1a95591c6ac --- /dev/null +++ b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/apis/paths/Fakeuploadfiles.kt @@ -0,0 +1,14 @@ +package org.openapijsonschematools.client.apis.paths; + +import org.openapijsonschematools.client.apiclient.ApiClient; +import org.openapijsonschematools.client.configurations.ApiConfiguration; +import org.openapijsonschematools.client.configurations.SchemaConfiguration; +import org.openapijsonschematools.client.paths.fakeuploadfiles.FakeuploadfilesPost; + +public class Fakeuploadfiles extends ApiClient implements + FakeuploadfilesPost.PostOperation +{ + public Fakeuploadfiles(ApiConfiguration apiConfiguration, SchemaConfiguration schemaConfiguration) { + super(apiConfiguration, schemaConfiguration); + } +} \ No newline at end of file diff --git a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/apis/paths/Fakewildcardresponses.kt b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/apis/paths/Fakewildcardresponses.kt new file mode 100644 index 00000000000..7abc3e972d0 --- /dev/null +++ b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/apis/paths/Fakewildcardresponses.kt @@ -0,0 +1,14 @@ +package org.openapijsonschematools.client.apis.paths; + +import org.openapijsonschematools.client.apiclient.ApiClient; +import org.openapijsonschematools.client.configurations.ApiConfiguration; +import org.openapijsonschematools.client.configurations.SchemaConfiguration; +import org.openapijsonschematools.client.paths.fakewildcardresponses.FakewildcardresponsesGet; + +public class Fakewildcardresponses extends ApiClient implements + FakewildcardresponsesGet.GetOperation +{ + public Fakewildcardresponses(ApiConfiguration apiConfiguration, SchemaConfiguration schemaConfiguration) { + super(apiConfiguration, schemaConfiguration); + } +} \ No newline at end of file diff --git a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/apis/paths/Foo.kt b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/apis/paths/Foo.kt new file mode 100644 index 00000000000..f17acf763b0 --- /dev/null +++ b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/apis/paths/Foo.kt @@ -0,0 +1,14 @@ +package org.openapijsonschematools.client.apis.paths; + +import org.openapijsonschematools.client.apiclient.ApiClient; +import org.openapijsonschematools.client.configurations.ApiConfiguration; +import org.openapijsonschematools.client.configurations.SchemaConfiguration; +import org.openapijsonschematools.client.paths.foo.FooGet; + +public class Foo extends ApiClient implements + FooGet.GetOperation +{ + public Foo(ApiConfiguration apiConfiguration, SchemaConfiguration schemaConfiguration) { + super(apiConfiguration, schemaConfiguration); + } +} \ No newline at end of file diff --git a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/apis/paths/Pet.kt b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/apis/paths/Pet.kt new file mode 100644 index 00000000000..47a158d79f1 --- /dev/null +++ b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/apis/paths/Pet.kt @@ -0,0 +1,16 @@ +package org.openapijsonschematools.client.apis.paths; + +import org.openapijsonschematools.client.apiclient.ApiClient; +import org.openapijsonschematools.client.configurations.ApiConfiguration; +import org.openapijsonschematools.client.configurations.SchemaConfiguration; +import org.openapijsonschematools.client.paths.pet.PetPost; +import org.openapijsonschematools.client.paths.pet.PetPut; + +public class Pet extends ApiClient implements + PetPost.PostOperation, + PetPut.PutOperation +{ + public Pet(ApiConfiguration apiConfiguration, SchemaConfiguration schemaConfiguration) { + super(apiConfiguration, schemaConfiguration); + } +} \ No newline at end of file diff --git a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/apis/paths/Petfindbystatus.kt b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/apis/paths/Petfindbystatus.kt new file mode 100644 index 00000000000..0c4c1996263 --- /dev/null +++ b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/apis/paths/Petfindbystatus.kt @@ -0,0 +1,14 @@ +package org.openapijsonschematools.client.apis.paths; + +import org.openapijsonschematools.client.apiclient.ApiClient; +import org.openapijsonschematools.client.configurations.ApiConfiguration; +import org.openapijsonschematools.client.configurations.SchemaConfiguration; +import org.openapijsonschematools.client.paths.petfindbystatus.PetfindbystatusGet; + +public class Petfindbystatus extends ApiClient implements + PetfindbystatusGet.GetOperation +{ + public Petfindbystatus(ApiConfiguration apiConfiguration, SchemaConfiguration schemaConfiguration) { + super(apiConfiguration, schemaConfiguration); + } +} \ No newline at end of file diff --git a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/apis/paths/Petfindbytags.kt b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/apis/paths/Petfindbytags.kt new file mode 100644 index 00000000000..10c9d0081b3 --- /dev/null +++ b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/apis/paths/Petfindbytags.kt @@ -0,0 +1,14 @@ +package org.openapijsonschematools.client.apis.paths; + +import org.openapijsonschematools.client.apiclient.ApiClient; +import org.openapijsonschematools.client.configurations.ApiConfiguration; +import org.openapijsonschematools.client.configurations.SchemaConfiguration; +import org.openapijsonschematools.client.paths.petfindbytags.PetfindbytagsGet; + +public class Petfindbytags extends ApiClient implements + PetfindbytagsGet.GetOperation +{ + public Petfindbytags(ApiConfiguration apiConfiguration, SchemaConfiguration schemaConfiguration) { + super(apiConfiguration, schemaConfiguration); + } +} \ No newline at end of file diff --git a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/apis/paths/Petpetid.kt b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/apis/paths/Petpetid.kt new file mode 100644 index 00000000000..a1fb089c3d3 --- /dev/null +++ b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/apis/paths/Petpetid.kt @@ -0,0 +1,18 @@ +package org.openapijsonschematools.client.apis.paths; + +import org.openapijsonschematools.client.apiclient.ApiClient; +import org.openapijsonschematools.client.configurations.ApiConfiguration; +import org.openapijsonschematools.client.configurations.SchemaConfiguration; +import org.openapijsonschematools.client.paths.petpetid.PetpetidDelete; +import org.openapijsonschematools.client.paths.petpetid.PetpetidGet; +import org.openapijsonschematools.client.paths.petpetid.PetpetidPost; + +public class Petpetid extends ApiClient implements + PetpetidDelete.DeleteOperation, + PetpetidGet.GetOperation, + PetpetidPost.PostOperation +{ + public Petpetid(ApiConfiguration apiConfiguration, SchemaConfiguration schemaConfiguration) { + super(apiConfiguration, schemaConfiguration); + } +} \ No newline at end of file diff --git a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/apis/paths/Petpetiduploadimage.kt b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/apis/paths/Petpetiduploadimage.kt new file mode 100644 index 00000000000..2e66215c65e --- /dev/null +++ b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/apis/paths/Petpetiduploadimage.kt @@ -0,0 +1,14 @@ +package org.openapijsonschematools.client.apis.paths; + +import org.openapijsonschematools.client.apiclient.ApiClient; +import org.openapijsonschematools.client.configurations.ApiConfiguration; +import org.openapijsonschematools.client.configurations.SchemaConfiguration; +import org.openapijsonschematools.client.paths.petpetiduploadimage.PetpetiduploadimagePost; + +public class Petpetiduploadimage extends ApiClient implements + PetpetiduploadimagePost.PostOperation +{ + public Petpetiduploadimage(ApiConfiguration apiConfiguration, SchemaConfiguration schemaConfiguration) { + super(apiConfiguration, schemaConfiguration); + } +} \ No newline at end of file diff --git a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/apis/paths/Solidus.kt b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/apis/paths/Solidus.kt new file mode 100644 index 00000000000..cf5e430d52a --- /dev/null +++ b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/apis/paths/Solidus.kt @@ -0,0 +1,14 @@ +package org.openapijsonschematools.client.apis.paths; + +import org.openapijsonschematools.client.apiclient.ApiClient; +import org.openapijsonschematools.client.configurations.ApiConfiguration; +import org.openapijsonschematools.client.configurations.SchemaConfiguration; +import org.openapijsonschematools.client.paths.solidus.SolidusGet; + +public class Solidus extends ApiClient implements + SolidusGet.GetOperation +{ + public Solidus(ApiConfiguration apiConfiguration, SchemaConfiguration schemaConfiguration) { + super(apiConfiguration, schemaConfiguration); + } +} \ No newline at end of file diff --git a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/apis/paths/Storeinventory.kt b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/apis/paths/Storeinventory.kt new file mode 100644 index 00000000000..bcab950278d --- /dev/null +++ b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/apis/paths/Storeinventory.kt @@ -0,0 +1,14 @@ +package org.openapijsonschematools.client.apis.paths; + +import org.openapijsonschematools.client.apiclient.ApiClient; +import org.openapijsonschematools.client.configurations.ApiConfiguration; +import org.openapijsonschematools.client.configurations.SchemaConfiguration; +import org.openapijsonschematools.client.paths.storeinventory.StoreinventoryGet; + +public class Storeinventory extends ApiClient implements + StoreinventoryGet.GetOperation +{ + public Storeinventory(ApiConfiguration apiConfiguration, SchemaConfiguration schemaConfiguration) { + super(apiConfiguration, schemaConfiguration); + } +} \ No newline at end of file diff --git a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/apis/paths/Storeorder.kt b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/apis/paths/Storeorder.kt new file mode 100644 index 00000000000..e7e03c2bffa --- /dev/null +++ b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/apis/paths/Storeorder.kt @@ -0,0 +1,14 @@ +package org.openapijsonschematools.client.apis.paths; + +import org.openapijsonschematools.client.apiclient.ApiClient; +import org.openapijsonschematools.client.configurations.ApiConfiguration; +import org.openapijsonschematools.client.configurations.SchemaConfiguration; +import org.openapijsonschematools.client.paths.storeorder.StoreorderPost; + +public class Storeorder extends ApiClient implements + StoreorderPost.PostOperation +{ + public Storeorder(ApiConfiguration apiConfiguration, SchemaConfiguration schemaConfiguration) { + super(apiConfiguration, schemaConfiguration); + } +} \ No newline at end of file diff --git a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/apis/paths/Storeorderorderid.kt b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/apis/paths/Storeorderorderid.kt new file mode 100644 index 00000000000..4a6c78c4428 --- /dev/null +++ b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/apis/paths/Storeorderorderid.kt @@ -0,0 +1,16 @@ +package org.openapijsonschematools.client.apis.paths; + +import org.openapijsonschematools.client.apiclient.ApiClient; +import org.openapijsonschematools.client.configurations.ApiConfiguration; +import org.openapijsonschematools.client.configurations.SchemaConfiguration; +import org.openapijsonschematools.client.paths.storeorderorderid.StoreorderorderidDelete; +import org.openapijsonschematools.client.paths.storeorderorderid.StoreorderorderidGet; + +public class Storeorderorderid extends ApiClient implements + StoreorderorderidDelete.DeleteOperation, + StoreorderorderidGet.GetOperation +{ + public Storeorderorderid(ApiConfiguration apiConfiguration, SchemaConfiguration schemaConfiguration) { + super(apiConfiguration, schemaConfiguration); + } +} \ No newline at end of file diff --git a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/apis/paths/User.kt b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/apis/paths/User.kt new file mode 100644 index 00000000000..d5797033de0 --- /dev/null +++ b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/apis/paths/User.kt @@ -0,0 +1,14 @@ +package org.openapijsonschematools.client.apis.paths; + +import org.openapijsonschematools.client.apiclient.ApiClient; +import org.openapijsonschematools.client.configurations.ApiConfiguration; +import org.openapijsonschematools.client.configurations.SchemaConfiguration; +import org.openapijsonschematools.client.paths.user.UserPost; + +public class User extends ApiClient implements + UserPost.PostOperation +{ + public User(ApiConfiguration apiConfiguration, SchemaConfiguration schemaConfiguration) { + super(apiConfiguration, schemaConfiguration); + } +} \ No newline at end of file diff --git a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/apis/paths/Usercreatewitharray.kt b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/apis/paths/Usercreatewitharray.kt new file mode 100644 index 00000000000..ad5b8a37613 --- /dev/null +++ b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/apis/paths/Usercreatewitharray.kt @@ -0,0 +1,14 @@ +package org.openapijsonschematools.client.apis.paths; + +import org.openapijsonschematools.client.apiclient.ApiClient; +import org.openapijsonschematools.client.configurations.ApiConfiguration; +import org.openapijsonschematools.client.configurations.SchemaConfiguration; +import org.openapijsonschematools.client.paths.usercreatewitharray.UsercreatewitharrayPost; + +public class Usercreatewitharray extends ApiClient implements + UsercreatewitharrayPost.PostOperation +{ + public Usercreatewitharray(ApiConfiguration apiConfiguration, SchemaConfiguration schemaConfiguration) { + super(apiConfiguration, schemaConfiguration); + } +} \ No newline at end of file diff --git a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/apis/paths/Usercreatewithlist.kt b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/apis/paths/Usercreatewithlist.kt new file mode 100644 index 00000000000..e110f8de79b --- /dev/null +++ b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/apis/paths/Usercreatewithlist.kt @@ -0,0 +1,14 @@ +package org.openapijsonschematools.client.apis.paths; + +import org.openapijsonschematools.client.apiclient.ApiClient; +import org.openapijsonschematools.client.configurations.ApiConfiguration; +import org.openapijsonschematools.client.configurations.SchemaConfiguration; +import org.openapijsonschematools.client.paths.usercreatewithlist.UsercreatewithlistPost; + +public class Usercreatewithlist extends ApiClient implements + UsercreatewithlistPost.PostOperation +{ + public Usercreatewithlist(ApiConfiguration apiConfiguration, SchemaConfiguration schemaConfiguration) { + super(apiConfiguration, schemaConfiguration); + } +} \ No newline at end of file diff --git a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/apis/paths/Userlogin.kt b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/apis/paths/Userlogin.kt new file mode 100644 index 00000000000..5059623c6d1 --- /dev/null +++ b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/apis/paths/Userlogin.kt @@ -0,0 +1,14 @@ +package org.openapijsonschematools.client.apis.paths; + +import org.openapijsonschematools.client.apiclient.ApiClient; +import org.openapijsonschematools.client.configurations.ApiConfiguration; +import org.openapijsonschematools.client.configurations.SchemaConfiguration; +import org.openapijsonschematools.client.paths.userlogin.UserloginGet; + +public class Userlogin extends ApiClient implements + UserloginGet.GetOperation +{ + public Userlogin(ApiConfiguration apiConfiguration, SchemaConfiguration schemaConfiguration) { + super(apiConfiguration, schemaConfiguration); + } +} \ No newline at end of file diff --git a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/apis/paths/Userlogout.kt b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/apis/paths/Userlogout.kt new file mode 100644 index 00000000000..00de9ce4f8d --- /dev/null +++ b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/apis/paths/Userlogout.kt @@ -0,0 +1,14 @@ +package org.openapijsonschematools.client.apis.paths; + +import org.openapijsonschematools.client.apiclient.ApiClient; +import org.openapijsonschematools.client.configurations.ApiConfiguration; +import org.openapijsonschematools.client.configurations.SchemaConfiguration; +import org.openapijsonschematools.client.paths.userlogout.UserlogoutGet; + +public class Userlogout extends ApiClient implements + UserlogoutGet.GetOperation +{ + public Userlogout(ApiConfiguration apiConfiguration, SchemaConfiguration schemaConfiguration) { + super(apiConfiguration, schemaConfiguration); + } +} \ No newline at end of file diff --git a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/apis/paths/Userusername.kt b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/apis/paths/Userusername.kt new file mode 100644 index 00000000000..9fc5cde71ca --- /dev/null +++ b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/apis/paths/Userusername.kt @@ -0,0 +1,18 @@ +package org.openapijsonschematools.client.apis.paths; + +import org.openapijsonschematools.client.apiclient.ApiClient; +import org.openapijsonschematools.client.configurations.ApiConfiguration; +import org.openapijsonschematools.client.configurations.SchemaConfiguration; +import org.openapijsonschematools.client.paths.userusername.UserusernameDelete; +import org.openapijsonschematools.client.paths.userusername.UserusernameGet; +import org.openapijsonschematools.client.paths.userusername.UserusernamePut; + +public class Userusername extends ApiClient implements + UserusernameDelete.DeleteOperation, + UserusernameGet.GetOperation, + UserusernamePut.PutOperation +{ + public Userusername(ApiConfiguration apiConfiguration, SchemaConfiguration schemaConfiguration) { + super(apiConfiguration, schemaConfiguration); + } +} \ No newline at end of file diff --git a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/apis/tags/Anotherfake.kt b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/apis/tags/Anotherfake.kt new file mode 100644 index 00000000000..844875c8f4b --- /dev/null +++ b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/apis/tags/Anotherfake.kt @@ -0,0 +1,14 @@ +package org.openapijsonschematools.client.apis.tags; + +import org.openapijsonschematools.client.apiclient.ApiClient; +import org.openapijsonschematools.client.configurations.ApiConfiguration; +import org.openapijsonschematools.client.configurations.SchemaConfiguration; +import org.openapijsonschematools.client.paths.anotherfakedummy.AnotherfakedummyPatch; + +public class Anotherfake extends ApiClient implements + AnotherfakedummyPatch.Model123TestSpecialTagsOperation +{ + public Anotherfake(ApiConfiguration apiConfiguration, SchemaConfiguration schemaConfiguration) { + super(apiConfiguration, schemaConfiguration); + } +} \ No newline at end of file diff --git a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/apis/tags/Default.kt b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/apis/tags/Default.kt new file mode 100644 index 00000000000..b55a09a58f4 --- /dev/null +++ b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/apis/tags/Default.kt @@ -0,0 +1,14 @@ +package org.openapijsonschematools.client.apis.tags; + +import org.openapijsonschematools.client.apiclient.ApiClient; +import org.openapijsonschematools.client.configurations.ApiConfiguration; +import org.openapijsonschematools.client.configurations.SchemaConfiguration; +import org.openapijsonschematools.client.paths.foo.FooGet; + +public class Default extends ApiClient implements + FooGet.FooGetOperation +{ + public Default(ApiConfiguration apiConfiguration, SchemaConfiguration schemaConfiguration) { + super(apiConfiguration, schemaConfiguration); + } +} \ No newline at end of file diff --git a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/apis/tags/Fake.kt b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/apis/tags/Fake.kt new file mode 100644 index 00000000000..2694e40d4c0 --- /dev/null +++ b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/apis/tags/Fake.kt @@ -0,0 +1,98 @@ +package org.openapijsonschematools.client.apis.tags; + +import org.openapijsonschematools.client.apiclient.ApiClient; +import org.openapijsonschematools.client.configurations.ApiConfiguration; +import org.openapijsonschematools.client.configurations.SchemaConfiguration; +import org.openapijsonschematools.client.paths.fakejsonpatch.FakejsonpatchPatch; +import org.openapijsonschematools.client.paths.fakerefsarrayofenums.FakerefsarrayofenumsPost; +import org.openapijsonschematools.client.paths.commonparamsubdir.CommonparamsubdirDelete; +import org.openapijsonschematools.client.paths.commonparamsubdir.CommonparamsubdirGet; +import org.openapijsonschematools.client.paths.commonparamsubdir.CommonparamsubdirPost; +import org.openapijsonschematools.client.paths.fakecasesensitiveparams.FakecasesensitiveparamsPut; +import org.openapijsonschematools.client.paths.fakewildcardresponses.FakewildcardresponsesGet; +import org.openapijsonschematools.client.paths.fakebodywithqueryparams.FakebodywithqueryparamsPut; +import org.openapijsonschematools.client.paths.fakejsonwithcharset.FakejsonwithcharsetPost; +import org.openapijsonschematools.client.paths.fakerefsarraymodel.FakerefsarraymodelPost; +import org.openapijsonschematools.client.paths.fakehealth.FakehealthGet; +import org.openapijsonschematools.client.paths.fakerefscomposedoneofnumberwithvalidations.FakerefscomposedoneofnumberwithvalidationsPost; +import org.openapijsonschematools.client.paths.fakerefobjinquery.FakerefobjinqueryGet; +import org.openapijsonschematools.client.paths.fakebodywithfileschema.FakebodywithfileschemaPut; +import org.openapijsonschematools.client.paths.fakerefsenum.FakerefsenumPost; +import org.openapijsonschematools.client.paths.fakeredirection.FakeredirectionGet; +import org.openapijsonschematools.client.paths.fakeuploadfile.FakeuploadfilePost; +import org.openapijsonschematools.client.paths.fakeinlinecomposition.FakeinlinecompositionPost; +import org.openapijsonschematools.client.paths.fake.FakeDelete; +import org.openapijsonschematools.client.paths.fake.FakeGet; +import org.openapijsonschematools.client.paths.fake.FakePatch; +import org.openapijsonschematools.client.paths.fake.FakePost; +import org.openapijsonschematools.client.paths.fakerefsobjectmodelwithrefprops.FakerefsobjectmodelwithrefpropsPost; +import org.openapijsonschematools.client.paths.fakepemcontenttype.FakepemcontenttypeGet; +import org.openapijsonschematools.client.paths.fakerefsnumber.FakerefsnumberPost; +import org.openapijsonschematools.client.paths.fakerefsstring.FakerefsstringPost; +import org.openapijsonschematools.client.paths.fakeinlineadditionalproperties.FakeinlineadditionalpropertiesPost; +import org.openapijsonschematools.client.paths.fakerefsmammal.FakerefsmammalPost; +import org.openapijsonschematools.client.paths.solidus.SolidusGet; +import org.openapijsonschematools.client.paths.fakerefsboolean.FakerefsbooleanPost; +import org.openapijsonschematools.client.paths.fakejsonformdata.FakejsonformdataGet; +import org.openapijsonschematools.client.paths.fakeparametercollisions1ababselfab.Fakeparametercollisions1ababselfabPost; +import org.openapijsonschematools.client.paths.fakequeryparamwithjsoncontenttype.FakequeryparamwithjsoncontenttypeGet; +import org.openapijsonschematools.client.paths.fakeobjinquery.FakeobjinqueryGet; +import org.openapijsonschematools.client.paths.fakemultiplesecurities.FakemultiplesecuritiesGet; +import org.openapijsonschematools.client.paths.faketestqueryparamters.FaketestqueryparamtersPut; +import org.openapijsonschematools.client.paths.fakemultipleresponsebodies.FakemultipleresponsebodiesGet; +import org.openapijsonschematools.client.paths.fakeresponsewithoutschema.FakeresponsewithoutschemaGet; +import org.openapijsonschematools.client.paths.fakemultiplerequestbodycontenttypes.FakemultiplerequestbodycontenttypesPost; +import org.openapijsonschematools.client.paths.fakeuploaddownloadfile.FakeuploaddownloadfilePost; +import org.openapijsonschematools.client.paths.fakeuploadfiles.FakeuploadfilesPost; +import org.openapijsonschematools.client.paths.fakeadditionalpropertieswitharrayofenums.FakeadditionalpropertieswitharrayofenumsGet; +import org.openapijsonschematools.client.paths.fakedeletecoffeeid.FakedeletecoffeeidDelete; + +public class Fake extends ApiClient implements + FakejsonpatchPatch.JsonPatchOperation, + FakerefsarrayofenumsPost.ArrayOfEnumsOperation, + CommonparamsubdirDelete.DeleteCommonParamOperation, + CommonparamsubdirGet.GetCommonParamOperation, + CommonparamsubdirPost.PostCommonParamOperation, + FakecasesensitiveparamsPut.CaseSensitiveParamsOperation, + FakewildcardresponsesGet.WildCardResponsesOperation, + FakebodywithqueryparamsPut.BodyWithQueryParamsOperation, + FakejsonwithcharsetPost.JsonWithCharsetOperation, + FakerefsarraymodelPost.ArrayModelOperation, + FakehealthGet.FakeHealthGetOperation, + FakerefscomposedoneofnumberwithvalidationsPost.ComposedOneOfDifferentTypesOperation, + FakerefobjinqueryGet.RefObjectInQueryOperation, + FakebodywithfileschemaPut.BodyWithFileSchemaOperation, + FakerefsenumPost.StringEnumOperation, + FakeredirectionGet.RedirectionOperation, + FakeuploadfilePost.UploadFileOperation, + FakeinlinecompositionPost.InlineCompositionOperation, + FakeDelete.GroupParametersOperation, + FakeGet.EnumParametersOperation, + FakePatch.ClientModelOperation, + FakePost.EndpointParametersOperation, + FakerefsobjectmodelwithrefpropsPost.ObjectModelWithRefPropsOperation, + FakepemcontenttypeGet.PemContentTypeOperation, + FakerefsnumberPost.NumberWithValidationsOperation, + FakerefsstringPost.ModelStringOperation, + FakeinlineadditionalpropertiesPost.InlineAdditionalPropertiesOperation, + FakerefsmammalPost.MammalOperation, + SolidusGet.SlashRouteOperation, + FakerefsbooleanPost.ModelBooleanOperation, + FakejsonformdataGet.JsonFormDataOperation, + Fakeparametercollisions1ababselfabPost.ParameterCollisionsOperation, + FakequeryparamwithjsoncontenttypeGet.QueryParamWithJsonContentTypeOperation, + FakeobjinqueryGet.ObjectInQueryOperation, + FakemultiplesecuritiesGet.MultipleSecuritiesOperation, + FaketestqueryparamtersPut.QueryParameterCollectionFormatOperation, + FakemultipleresponsebodiesGet.MultipleResponseBodiesOperation, + FakeresponsewithoutschemaGet.ResponseWithoutSchemaOperation, + FakemultiplerequestbodycontenttypesPost.MultipleRequestBodyContentTypesOperation, + FakeuploaddownloadfilePost.UploadDownloadFileOperation, + FakeuploadfilesPost.UploadFilesOperation, + FakeadditionalpropertieswitharrayofenumsGet.AdditionalPropertiesWithArrayOfEnumsOperation, + FakedeletecoffeeidDelete.DeleteCoffeeOperation +{ + public Fake(ApiConfiguration apiConfiguration, SchemaConfiguration schemaConfiguration) { + super(apiConfiguration, schemaConfiguration); + } +} \ No newline at end of file diff --git a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/apis/tags/Fakeclassnametags123.kt b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/apis/tags/Fakeclassnametags123.kt new file mode 100644 index 00000000000..2a727a57e08 --- /dev/null +++ b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/apis/tags/Fakeclassnametags123.kt @@ -0,0 +1,14 @@ +package org.openapijsonschematools.client.apis.tags; + +import org.openapijsonschematools.client.apiclient.ApiClient; +import org.openapijsonschematools.client.configurations.ApiConfiguration; +import org.openapijsonschematools.client.configurations.SchemaConfiguration; +import org.openapijsonschematools.client.paths.fakeclassnametest.FakeclassnametestPatch; + +public class Fakeclassnametags123 extends ApiClient implements + FakeclassnametestPatch.ClassnameOperation +{ + public Fakeclassnametags123(ApiConfiguration apiConfiguration, SchemaConfiguration schemaConfiguration) { + super(apiConfiguration, schemaConfiguration); + } +} \ No newline at end of file diff --git a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/apis/tags/Pet.kt b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/apis/tags/Pet.kt new file mode 100644 index 00000000000..5c0c6e39569 --- /dev/null +++ b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/apis/tags/Pet.kt @@ -0,0 +1,30 @@ +package org.openapijsonschematools.client.apis.tags; + +import org.openapijsonschematools.client.apiclient.ApiClient; +import org.openapijsonschematools.client.configurations.ApiConfiguration; +import org.openapijsonschematools.client.configurations.SchemaConfiguration; +import org.openapijsonschematools.client.paths.fakepetiduploadimagewithrequiredfile.FakepetiduploadimagewithrequiredfilePost; +import org.openapijsonschematools.client.paths.pet.PetPost; +import org.openapijsonschematools.client.paths.pet.PetPut; +import org.openapijsonschematools.client.paths.petfindbytags.PetfindbytagsGet; +import org.openapijsonschematools.client.paths.petfindbystatus.PetfindbystatusGet; +import org.openapijsonschematools.client.paths.petpetiduploadimage.PetpetiduploadimagePost; +import org.openapijsonschematools.client.paths.petpetid.PetpetidDelete; +import org.openapijsonschematools.client.paths.petpetid.PetpetidGet; +import org.openapijsonschematools.client.paths.petpetid.PetpetidPost; + +public class Pet extends ApiClient implements + FakepetiduploadimagewithrequiredfilePost.UploadFileWithRequiredFileOperation, + PetPost.AddPetOperation, + PetPut.UpdatePetOperation, + PetfindbytagsGet.FindPetsByTagsOperation, + PetfindbystatusGet.FindPetsByStatusOperation, + PetpetiduploadimagePost.UploadImageOperation, + PetpetidDelete.DeletePetOperation, + PetpetidGet.GetPetByIdOperation, + PetpetidPost.UpdatePetWithFormOperation +{ + public Pet(ApiConfiguration apiConfiguration, SchemaConfiguration schemaConfiguration) { + super(apiConfiguration, schemaConfiguration); + } +} \ No newline at end of file diff --git a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/apis/tags/Store.kt b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/apis/tags/Store.kt new file mode 100644 index 00000000000..04d51443ec5 --- /dev/null +++ b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/apis/tags/Store.kt @@ -0,0 +1,20 @@ +package org.openapijsonschematools.client.apis.tags; + +import org.openapijsonschematools.client.apiclient.ApiClient; +import org.openapijsonschematools.client.configurations.ApiConfiguration; +import org.openapijsonschematools.client.configurations.SchemaConfiguration; +import org.openapijsonschematools.client.paths.storeinventory.StoreinventoryGet; +import org.openapijsonschematools.client.paths.storeorderorderid.StoreorderorderidDelete; +import org.openapijsonschematools.client.paths.storeorderorderid.StoreorderorderidGet; +import org.openapijsonschematools.client.paths.storeorder.StoreorderPost; + +public class Store extends ApiClient implements + StoreinventoryGet.GetInventoryOperation, + StoreorderorderidDelete.DeleteOrderOperation, + StoreorderorderidGet.GetOrderByIdOperation, + StoreorderPost.PlaceOrderOperation +{ + public Store(ApiConfiguration apiConfiguration, SchemaConfiguration schemaConfiguration) { + super(apiConfiguration, schemaConfiguration); + } +} \ No newline at end of file diff --git a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/apis/tags/User.kt b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/apis/tags/User.kt new file mode 100644 index 00000000000..f8c47d501e1 --- /dev/null +++ b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/apis/tags/User.kt @@ -0,0 +1,28 @@ +package org.openapijsonschematools.client.apis.tags; + +import org.openapijsonschematools.client.apiclient.ApiClient; +import org.openapijsonschematools.client.configurations.ApiConfiguration; +import org.openapijsonschematools.client.configurations.SchemaConfiguration; +import org.openapijsonschematools.client.paths.userlogout.UserlogoutGet; +import org.openapijsonschematools.client.paths.usercreatewitharray.UsercreatewitharrayPost; +import org.openapijsonschematools.client.paths.user.UserPost; +import org.openapijsonschematools.client.paths.userlogin.UserloginGet; +import org.openapijsonschematools.client.paths.userusername.UserusernameDelete; +import org.openapijsonschematools.client.paths.userusername.UserusernameGet; +import org.openapijsonschematools.client.paths.userusername.UserusernamePut; +import org.openapijsonschematools.client.paths.usercreatewithlist.UsercreatewithlistPost; + +public class User extends ApiClient implements + UserlogoutGet.LogoutUserOperation, + UsercreatewitharrayPost.CreateUsersWithArrayInputOperation, + UserPost.CreateUserOperation, + UserloginGet.LoginUserOperation, + UserusernameDelete.DeleteUserOperation, + UserusernameGet.GetUserByNameOperation, + UserusernamePut.UpdateUserOperation, + UsercreatewithlistPost.CreateUsersWithListInputOperation +{ + public User(ApiConfiguration apiConfiguration, SchemaConfiguration schemaConfiguration) { + super(apiConfiguration, schemaConfiguration); + } +} \ No newline at end of file diff --git a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/headers/Int32JsonContentTypeHeader.kt b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/headers/Int32JsonContentTypeHeader.kt new file mode 100644 index 00000000000..298d3fcd6b9 --- /dev/null +++ b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/headers/Int32JsonContentTypeHeader.kt @@ -0,0 +1,31 @@ +package org.openapijsonschematools.client.components.headers; + +import org.openapijsonschematools.client.header.ContentHeader; +import org.openapijsonschematools.client.mediatype.MediaType; +import org.openapijsonschematools.client.components.headers.int32jsoncontenttypeheader.content.applicationjson.Int32JsonContentTypeHeaderSchema; + +import java.util.AbstractMap; + +public class Int32JsonContentTypeHeader { + + public record ApplicationjsonMediaType(Int32JsonContentTypeHeaderSchema.Int32JsonContentTypeHeaderSchema1 schema) implements MediaType { + public ApplicationjsonMediaType() { + this(Int32JsonContentTypeHeaderSchema.Int32JsonContentTypeHeaderSchema1.getInstance()); + } + @Override + public Nothing? encoding() { + return null; + } + } + + public static class Int32JsonContentTypeHeader1 extends ContentHeader { + public Int32JsonContentTypeHeader1() { + super( + true, + null, + false, + new AbstractMap.SimpleEntry<>("application/json", new ApplicationjsonMediaType()) + ); + } + } +} diff --git a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/headers/NumberHeader.kt b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/headers/NumberHeader.kt new file mode 100644 index 00000000000..703f95cd089 --- /dev/null +++ b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/headers/NumberHeader.kt @@ -0,0 +1,18 @@ +package org.openapijsonschematools.client.components.headers; + +import org.openapijsonschematools.client.header.SchemaHeader; +import org.openapijsonschematools.client.components.headers.numberheader.NumberHeaderSchema; + +public class NumberHeader { + + public static class NumberHeader1 extends SchemaHeader { + public NumberHeader1() { + super( + false, + null, + false, + NumberHeaderSchema.NumberHeaderSchema1.getInstance() + ); + } + } +} diff --git a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/headers/RefContentSchemaHeader.kt b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/headers/RefContentSchemaHeader.kt new file mode 100644 index 00000000000..3d0ce933eae --- /dev/null +++ b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/headers/RefContentSchemaHeader.kt @@ -0,0 +1,31 @@ +package org.openapijsonschematools.client.components.headers; + +import org.openapijsonschematools.client.header.ContentHeader; +import org.openapijsonschematools.client.mediatype.MediaType; +import org.openapijsonschematools.client.components.headers.refcontentschemaheader.content.applicationjson.RefContentSchemaHeaderSchema; + +import java.util.AbstractMap; + +public class RefContentSchemaHeader { + + public record ApplicationjsonMediaType(RefContentSchemaHeaderSchema.RefContentSchemaHeaderSchema1 schema) implements MediaType { + public ApplicationjsonMediaType() { + this(RefContentSchemaHeaderSchema.RefContentSchemaHeaderSchema1.getInstance()); + } + @Override + public Nothing? encoding() { + return null; + } + } + + public static class RefContentSchemaHeader1 extends ContentHeader { + public RefContentSchemaHeader1() { + super( + true, + null, + false, + new AbstractMap.SimpleEntry<>("application/json", new ApplicationjsonMediaType()) + ); + } + } +} diff --git a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/headers/RefSchemaHeader.kt b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/headers/RefSchemaHeader.kt new file mode 100644 index 00000000000..21487d79b1f --- /dev/null +++ b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/headers/RefSchemaHeader.kt @@ -0,0 +1,18 @@ +package org.openapijsonschematools.client.components.headers; + +import org.openapijsonschematools.client.header.SchemaHeader; +import org.openapijsonschematools.client.components.headers.refschemaheader.RefSchemaHeaderSchema; + +public class RefSchemaHeader { + + public static class RefSchemaHeader1 extends SchemaHeader { + public RefSchemaHeader1() { + super( + true, + null, + false, + RefSchemaHeaderSchema.RefSchemaHeaderSchema1.getInstance() + ); + } + } +} diff --git a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/headers/RefStringHeader.kt b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/headers/RefStringHeader.kt new file mode 100644 index 00000000000..ef2dde6549f --- /dev/null +++ b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/headers/RefStringHeader.kt @@ -0,0 +1,6 @@ +package org.openapijsonschematools.client.components.headers; + + +public class RefStringHeader extends StringHeader { + public static class RefStringHeader1 extends StringHeader1 {} +} diff --git a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/headers/StringHeader.kt b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/headers/StringHeader.kt new file mode 100644 index 00000000000..ce2701d1c66 --- /dev/null +++ b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/headers/StringHeader.kt @@ -0,0 +1,18 @@ +package org.openapijsonschematools.client.components.headers; + +import org.openapijsonschematools.client.header.SchemaHeader; +import org.openapijsonschematools.client.components.headers.stringheader.StringHeaderSchema; + +public class StringHeader { + + public static class StringHeader1 extends SchemaHeader { + public StringHeader1() { + super( + true, + null, + false, + StringHeaderSchema.StringHeaderSchema1.getInstance() + ); + } + } +} diff --git a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/headers/int32jsoncontenttypeheader/content/applicationjson/Int32JsonContentTypeHeaderSchema.kt b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/headers/int32jsoncontenttypeheader/content/applicationjson/Int32JsonContentTypeHeaderSchema.kt new file mode 100644 index 00000000000..820e50bb2c8 --- /dev/null +++ b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/headers/int32jsoncontenttypeheader/content/applicationjson/Int32JsonContentTypeHeaderSchema.kt @@ -0,0 +1,19 @@ +package org.openapijsonschematools.client.components.headers.int32jsoncontenttypeheader.content.applicationjson; +import org.checkerframework.checker.nullness.qual.Nullable; +import org.openapijsonschematools.client.schemas.Int32JsonSchema; + +public class Int32JsonContentTypeHeaderSchema extends Int32JsonSchema { + // nest classes so all schemas and input/output classes can be public + + + public static class Int32JsonContentTypeHeaderSchema1 extends Int32JsonSchema.Int32JsonSchema1 { + private static @Nullable Int32JsonContentTypeHeaderSchema1 instance = null; + public static Int32JsonContentTypeHeaderSchema1 getInstance() { + if (instance == null) { + instance = new Int32JsonContentTypeHeaderSchema1(); + } + return instance; + } + } + +} diff --git a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/headers/numberheader/NumberHeaderSchema.kt b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/headers/numberheader/NumberHeaderSchema.kt new file mode 100644 index 00000000000..ba135e61f6d --- /dev/null +++ b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/headers/numberheader/NumberHeaderSchema.kt @@ -0,0 +1,19 @@ +package org.openapijsonschematools.client.components.headers.numberheader; +import org.checkerframework.checker.nullness.qual.Nullable; +import org.openapijsonschematools.client.schemas.DecimalJsonSchema; + +public class NumberHeaderSchema extends DecimalJsonSchema { + // nest classes so all schemas and input/output classes can be public + + + public static class NumberHeaderSchema1 extends DecimalJsonSchema.DecimalJsonSchema1 { + private static @Nullable NumberHeaderSchema1 instance = null; + public static NumberHeaderSchema1 getInstance() { + if (instance == null) { + instance = new NumberHeaderSchema1(); + } + return instance; + } + } + +} diff --git a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/headers/refcontentschemaheader/content/applicationjson/RefContentSchemaHeaderSchema.kt b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/headers/refcontentschemaheader/content/applicationjson/RefContentSchemaHeaderSchema.kt new file mode 100644 index 00000000000..9d4202c7d98 --- /dev/null +++ b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/headers/refcontentschemaheader/content/applicationjson/RefContentSchemaHeaderSchema.kt @@ -0,0 +1,19 @@ +package org.openapijsonschematools.client.components.headers.refcontentschemaheader.content.applicationjson; + +import org.checkerframework.checker.nullness.qual.Nullable; +import org.openapijsonschematools.client.components.schemas.StringWithValidation; + +public class RefContentSchemaHeaderSchema extends StringWithValidation { + // $refed class + + + public static class RefContentSchemaHeaderSchema1 extends StringWithValidation1 { + private static @Nullable RefContentSchemaHeaderSchema1 instance = null; + public static RefContentSchemaHeaderSchema1 getInstance() { + if (instance == null) { + instance = new RefContentSchemaHeaderSchema1(); + } + return instance; + } + } +} diff --git a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/headers/refschemaheader/RefSchemaHeaderSchema.kt b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/headers/refschemaheader/RefSchemaHeaderSchema.kt new file mode 100644 index 00000000000..23f9dfa54bd --- /dev/null +++ b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/headers/refschemaheader/RefSchemaHeaderSchema.kt @@ -0,0 +1,19 @@ +package org.openapijsonschematools.client.components.headers.refschemaheader; + +import org.checkerframework.checker.nullness.qual.Nullable; +import org.openapijsonschematools.client.components.schemas.StringWithValidation; + +public class RefSchemaHeaderSchema extends StringWithValidation { + // $refed class + + + public static class RefSchemaHeaderSchema1 extends StringWithValidation1 { + private static @Nullable RefSchemaHeaderSchema1 instance = null; + public static RefSchemaHeaderSchema1 getInstance() { + if (instance == null) { + instance = new RefSchemaHeaderSchema1(); + } + return instance; + } + } +} diff --git a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/headers/stringheader/StringHeaderSchema.kt b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/headers/stringheader/StringHeaderSchema.kt new file mode 100644 index 00000000000..57855e645f7 --- /dev/null +++ b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/headers/stringheader/StringHeaderSchema.kt @@ -0,0 +1,19 @@ +package org.openapijsonschematools.client.components.headers.stringheader; +import org.checkerframework.checker.nullness.qual.Nullable; +import org.openapijsonschematools.client.schemas.StringJsonSchema; + +public class StringHeaderSchema extends StringJsonSchema { + // nest classes so all schemas and input/output classes can be public + + + public static class StringHeaderSchema1 extends StringJsonSchema.StringJsonSchema1 { + private static @Nullable StringHeaderSchema1 instance = null; + public static StringHeaderSchema1 getInstance() { + if (instance == null) { + instance = new StringHeaderSchema1(); + } + return instance; + } + } + +} diff --git a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/parameters/ComponentRefSchemaStringWithValidation.kt b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/parameters/ComponentRefSchemaStringWithValidation.kt new file mode 100644 index 00000000000..eb055645374 --- /dev/null +++ b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/parameters/ComponentRefSchemaStringWithValidation.kt @@ -0,0 +1,35 @@ +package org.openapijsonschematools.client.components.parameters; + +import org.openapijsonschematools.client.parameter.ParameterInType; +import org.openapijsonschematools.client.parameter.ContentParameter; +import org.openapijsonschematools.client.mediatype.MediaType; +import org.openapijsonschematools.client.components.parameters.componentrefschemastringwithvalidation.content.applicationjson.ApplicationjsonSchema; + +import java.util.AbstractMap; + +public class ComponentRefSchemaStringWithValidation { + + public record ApplicationjsonMediaType(ApplicationjsonSchema.ApplicationjsonSchema1 schema) implements MediaType { + public ApplicationjsonMediaType() { + this(ApplicationjsonSchema.ApplicationjsonSchema1.getInstance()); + } + @Override + public Nothing? encoding() { + return null; + } + } + + public static class ComponentRefSchemaStringWithValidation1 extends ContentParameter { + public ComponentRefSchemaStringWithValidation1() { + super( + "CRSstringWithValidation", + ParameterInType.PATH, + true, + null, + null, + false, + new AbstractMap.SimpleEntry<>("application/json", new ApplicationjsonMediaType()) + ); + } + } +} diff --git a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/parameters/PathUserName.kt b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/parameters/PathUserName.kt new file mode 100644 index 00000000000..4fb19f6d4a7 --- /dev/null +++ b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/parameters/PathUserName.kt @@ -0,0 +1,23 @@ +package org.openapijsonschematools.client.components.parameters; + +import org.openapijsonschematools.client.parameter.ParameterStyle; +import org.openapijsonschematools.client.parameter.ParameterInType; +import org.openapijsonschematools.client.parameter.SchemaParameter; +import org.openapijsonschematools.client.components.parameters.pathusername.Schema; + +public class PathUserName { + + public static class PathUserName1 extends SchemaParameter { + public PathUserName1() { + super( + "username", + ParameterInType.PATH, + true, + ParameterStyle.SIMPLE, + false, + false, + Schema.Schema1.getInstance() + ); + } + } +} diff --git a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/parameters/RefPathUserName.kt b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/parameters/RefPathUserName.kt new file mode 100644 index 00000000000..b6547f8af52 --- /dev/null +++ b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/parameters/RefPathUserName.kt @@ -0,0 +1,6 @@ +package org.openapijsonschematools.client.components.parameters; + + +public class RefPathUserName extends PathUserName { + public static class RefPathUserName1 extends PathUserName1 {} +} diff --git a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/parameters/RefSchemaStringWithValidation.kt b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/parameters/RefSchemaStringWithValidation.kt new file mode 100644 index 00000000000..20939147771 --- /dev/null +++ b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/parameters/RefSchemaStringWithValidation.kt @@ -0,0 +1,23 @@ +package org.openapijsonschematools.client.components.parameters; + +import org.openapijsonschematools.client.parameter.ParameterStyle; +import org.openapijsonschematools.client.parameter.ParameterInType; +import org.openapijsonschematools.client.parameter.SchemaParameter; +import org.openapijsonschematools.client.components.parameters.refschemastringwithvalidation.Schema; + +public class RefSchemaStringWithValidation { + + public static class RefSchemaStringWithValidation1 extends SchemaParameter { + public RefSchemaStringWithValidation1() { + super( + "RSstringWithValidation", + ParameterInType.PATH, + true, + ParameterStyle.SIMPLE, + false, + false, + Schema.Schema1.getInstance() + ); + } + } +} diff --git a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/parameters/componentrefschemastringwithvalidation/content/applicationjson/ApplicationjsonSchema.kt b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/parameters/componentrefschemastringwithvalidation/content/applicationjson/ApplicationjsonSchema.kt new file mode 100644 index 00000000000..e99d0dbcb4a --- /dev/null +++ b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/parameters/componentrefschemastringwithvalidation/content/applicationjson/ApplicationjsonSchema.kt @@ -0,0 +1,19 @@ +package org.openapijsonschematools.client.components.parameters.componentrefschemastringwithvalidation.content.applicationjson; + +import org.checkerframework.checker.nullness.qual.Nullable; +import org.openapijsonschematools.client.components.schemas.StringWithValidation; + +public class ApplicationjsonSchema extends StringWithValidation { + // $refed class + + + public static class ApplicationjsonSchema1 extends StringWithValidation1 { + private static @Nullable ApplicationjsonSchema1 instance = null; + public static ApplicationjsonSchema1 getInstance() { + if (instance == null) { + instance = new ApplicationjsonSchema1(); + } + return instance; + } + } +} diff --git a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/parameters/pathusername/Schema.kt b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/parameters/pathusername/Schema.kt new file mode 100644 index 00000000000..4dd7d5e772b --- /dev/null +++ b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/parameters/pathusername/Schema.kt @@ -0,0 +1,19 @@ +package org.openapijsonschematools.client.components.parameters.pathusername; +import org.checkerframework.checker.nullness.qual.Nullable; +import org.openapijsonschematools.client.schemas.StringJsonSchema; + +public class Schema extends StringJsonSchema { + // nest classes so all schemas and input/output classes can be public + + + public static class Schema1 extends StringJsonSchema.StringJsonSchema1 { + private static @Nullable Schema1 instance = null; + public static Schema1 getInstance() { + if (instance == null) { + instance = new Schema1(); + } + return instance; + } + } + +} diff --git a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/parameters/refschemastringwithvalidation/Schema.kt b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/parameters/refschemastringwithvalidation/Schema.kt new file mode 100644 index 00000000000..e812e290473 --- /dev/null +++ b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/parameters/refschemastringwithvalidation/Schema.kt @@ -0,0 +1,19 @@ +package org.openapijsonschematools.client.components.parameters.refschemastringwithvalidation; + +import org.checkerframework.checker.nullness.qual.Nullable; +import org.openapijsonschematools.client.components.schemas.StringWithValidation; + +public class Schema extends StringWithValidation { + // $refed class + + + public static class Schema1 extends StringWithValidation1 { + private static @Nullable Schema1 instance = null; + public static Schema1 getInstance() { + if (instance == null) { + instance = new Schema1(); + } + return instance; + } + } +} diff --git a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/requestbodies/Client.kt b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/requestbodies/Client.kt new file mode 100644 index 00000000000..8401f082008 --- /dev/null +++ b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/requestbodies/Client.kt @@ -0,0 +1,49 @@ +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; +import org.openapijsonschematools.client.mediatype.MediaType; +import org.openapijsonschematools.client.components.requestbodies.client.content.applicationjson.ApplicationjsonSchema; + +import java.util.AbstractMap; +import java.util.Map; + +public class Client { + public sealed interface SealedMediaType permits ApplicationjsonMediaType {} + + public record ApplicationjsonMediaType(ApplicationjsonSchema.ApplicationjsonSchema1 schema) implements SealedMediaType, MediaType { + public ApplicationjsonMediaType() { + this(ApplicationjsonSchema.ApplicationjsonSchema1.getInstance()); + } + @Override + public Nothing? encoding() { + return null; + } + } + + public static class Client1 extends RequestBodySerializer { + public Client1() { + super( + Map.ofEntries( + new AbstractMap.SimpleEntry<>("application/json", new ApplicationjsonMediaType()) + ), + true + ); + } + + public SerializedRequestBody serialize(SealedRequestBody requestBody) throws NotImplementedException { + ApplicationjsonRequestBody requestBody0 = (ApplicationjsonRequestBody) requestBody; + return serialize(requestBody0.contentType(), requestBody0.body().getData()); + } + } + + public sealed interface SealedRequestBody permits ApplicationjsonRequestBody {} + public record ApplicationjsonRequestBody(ApplicationjsonSchema.Client1Boxed body) implements SealedRequestBody, GenericRequestBody { + @Override + public String contentType() { + return "application/json"; + } + } +} diff --git a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/requestbodies/Pet.kt b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/requestbodies/Pet.kt new file mode 100644 index 00000000000..0df3a51cc6b --- /dev/null +++ b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/requestbodies/Pet.kt @@ -0,0 +1,71 @@ +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; +import org.openapijsonschematools.client.mediatype.MediaType; +import org.openapijsonschematools.client.components.requestbodies.pet.content.applicationjson.ApplicationjsonSchema; +import org.openapijsonschematools.client.components.requestbodies.pet.content.applicationxml.ApplicationxmlSchema; + +import java.util.AbstractMap; +import java.util.Map; + +public class Pet { + public sealed interface SealedMediaType permits ApplicationjsonMediaType, ApplicationxmlMediaType {} + + public record ApplicationjsonMediaType(ApplicationjsonSchema.ApplicationjsonSchema1 schema) implements SealedMediaType, MediaType { + public ApplicationjsonMediaType() { + this(ApplicationjsonSchema.ApplicationjsonSchema1.getInstance()); + } + @Override + public Nothing? encoding() { + return null; + } + } + + public record ApplicationxmlMediaType(ApplicationxmlSchema.ApplicationxmlSchema1 schema) implements SealedMediaType, MediaType { + public ApplicationxmlMediaType() { + this(ApplicationxmlSchema.ApplicationxmlSchema1.getInstance()); + } + @Override + public Nothing? encoding() { + return null; + } + } + + public static class Pet1 extends RequestBodySerializer { + public Pet1() { + super( + Map.ofEntries( + new AbstractMap.SimpleEntry<>("application/json", new ApplicationjsonMediaType()), + new AbstractMap.SimpleEntry<>("application/xml", new ApplicationxmlMediaType()) + ), + true + ); + } + + public SerializedRequestBody serialize(SealedRequestBody requestBody) throws NotImplementedException { + if (requestBody instanceof ApplicationjsonRequestBody requestBody0) { + return serialize(requestBody0.contentType(), requestBody0.body().getData()); + } else { + ApplicationxmlRequestBody requestBody1 = (ApplicationxmlRequestBody) requestBody; + return serialize(requestBody1.contentType(), requestBody1.body().getData()); + } + } + } + + public sealed interface SealedRequestBody permits ApplicationjsonRequestBody, ApplicationxmlRequestBody {} + public record ApplicationjsonRequestBody(ApplicationjsonSchema.Pet1Boxed body) implements SealedRequestBody, GenericRequestBody { + @Override + public String contentType() { + return "application/json"; + } + } + public record ApplicationxmlRequestBody(ApplicationxmlSchema.Pet1Boxed body) implements SealedRequestBody, GenericRequestBody { + @Override + public String contentType() { + return "application/xml"; + } + } +} diff --git a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/requestbodies/RefUserArray.kt b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/requestbodies/RefUserArray.kt new file mode 100644 index 00000000000..5b4af4408d0 --- /dev/null +++ b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/requestbodies/RefUserArray.kt @@ -0,0 +1,6 @@ +package org.openapijsonschematools.client.components.requestbodies; + + +public class RefUserArray extends UserArray { + public static class RefUserArray1 extends UserArray1 {} +} diff --git a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/requestbodies/UserArray.kt b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/requestbodies/UserArray.kt new file mode 100644 index 00000000000..25fc82c45c2 --- /dev/null +++ b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/requestbodies/UserArray.kt @@ -0,0 +1,49 @@ +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; +import org.openapijsonschematools.client.mediatype.MediaType; +import org.openapijsonschematools.client.components.requestbodies.userarray.content.applicationjson.ApplicationjsonSchema; + +import java.util.AbstractMap; +import java.util.Map; + +public class UserArray { + public sealed interface SealedMediaType permits ApplicationjsonMediaType {} + + public record ApplicationjsonMediaType(ApplicationjsonSchema.ApplicationjsonSchema1 schema) implements SealedMediaType, MediaType { + public ApplicationjsonMediaType() { + this(ApplicationjsonSchema.ApplicationjsonSchema1.getInstance()); + } + @Override + public Nothing? encoding() { + return null; + } + } + + public static class UserArray1 extends RequestBodySerializer { + public UserArray1() { + super( + Map.ofEntries( + new AbstractMap.SimpleEntry<>("application/json", new ApplicationjsonMediaType()) + ), + true + ); + } + + public SerializedRequestBody serialize(SealedRequestBody requestBody) throws NotImplementedException { + ApplicationjsonRequestBody requestBody0 = (ApplicationjsonRequestBody) requestBody; + return serialize(requestBody0.contentType(), requestBody0.body().getData()); + } + } + + public sealed interface SealedRequestBody permits ApplicationjsonRequestBody {} + public record ApplicationjsonRequestBody(ApplicationjsonSchema.ApplicationjsonSchema1Boxed body) implements SealedRequestBody, GenericRequestBody { + @Override + public String contentType() { + return "application/json"; + } + } +} diff --git a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/requestbodies/client/content/applicationjson/ApplicationjsonSchema.kt b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/requestbodies/client/content/applicationjson/ApplicationjsonSchema.kt new file mode 100644 index 00000000000..aaebccb5ab2 --- /dev/null +++ b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/requestbodies/client/content/applicationjson/ApplicationjsonSchema.kt @@ -0,0 +1,19 @@ +package org.openapijsonschematools.client.components.requestbodies.client.content.applicationjson; + +import org.checkerframework.checker.nullness.qual.Nullable; +import org.openapijsonschematools.client.components.schemas.Client; + +public class ApplicationjsonSchema extends Client { + // $refed class + + + public static class ApplicationjsonSchema1 extends Client1 { + private static @Nullable ApplicationjsonSchema1 instance = null; + public static ApplicationjsonSchema1 getInstance() { + if (instance == null) { + instance = new ApplicationjsonSchema1(); + } + return instance; + } + } +} diff --git a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/requestbodies/pet/content/applicationjson/ApplicationjsonSchema.kt b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/requestbodies/pet/content/applicationjson/ApplicationjsonSchema.kt new file mode 100644 index 00000000000..212fb352a2e --- /dev/null +++ b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/requestbodies/pet/content/applicationjson/ApplicationjsonSchema.kt @@ -0,0 +1,19 @@ +package org.openapijsonschematools.client.components.requestbodies.pet.content.applicationjson; + +import org.checkerframework.checker.nullness.qual.Nullable; +import org.openapijsonschematools.client.components.schemas.Pet; + +public class ApplicationjsonSchema extends Pet { + // $refed class + + + public static class ApplicationjsonSchema1 extends Pet1 { + private static @Nullable ApplicationjsonSchema1 instance = null; + public static ApplicationjsonSchema1 getInstance() { + if (instance == null) { + instance = new ApplicationjsonSchema1(); + } + return instance; + } + } +} diff --git a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/requestbodies/pet/content/applicationxml/ApplicationxmlSchema.kt b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/requestbodies/pet/content/applicationxml/ApplicationxmlSchema.kt new file mode 100644 index 00000000000..dd16e13e321 --- /dev/null +++ b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/requestbodies/pet/content/applicationxml/ApplicationxmlSchema.kt @@ -0,0 +1,20 @@ +package org.openapijsonschematools.client.components.requestbodies.pet.content.applicationxml; + +import org.checkerframework.checker.nullness.qual.Nullable; +import org.openapijsonschematools.client.components.schemas.Pet; +import org.openapijsonschematools.client.components.schemas.RefPet; + +public class ApplicationxmlSchema extends RefPet { + // $refed class + + + public static class ApplicationxmlSchema1 extends Pet1 { + private static @Nullable ApplicationxmlSchema1 instance = null; + public static ApplicationxmlSchema1 getInstance() { + if (instance == null) { + instance = new ApplicationxmlSchema1(); + } + return instance; + } + } +} diff --git a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/requestbodies/userarray/content/applicationjson/ApplicationjsonSchema.kt b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/requestbodies/userarray/content/applicationjson/ApplicationjsonSchema.kt new file mode 100644 index 00000000000..1cfab7e9e11 --- /dev/null +++ b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/requestbodies/userarray/content/applicationjson/ApplicationjsonSchema.kt @@ -0,0 +1,148 @@ +package org.openapijsonschematools.client.components.requestbodies.userarray.content.applicationjson; +import java.util.ArrayList; +import java.util.HashSet; +import java.util.LinkedHashMap; +import java.util.LinkedHashSet; +import java.util.List; +import java.util.Map; +import java.util.Objects; +import java.util.Set; +import org.checkerframework.checker.nullness.qual.Nullable; +import org.openapijsonschematools.client.components.schemas.User; +import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags; +import org.openapijsonschematools.client.configurations.SchemaConfiguration; +import org.openapijsonschematools.client.exceptions.ValidationException; +import org.openapijsonschematools.client.schemas.validation.FrozenList; +import org.openapijsonschematools.client.schemas.validation.FrozenMap; +import org.openapijsonschematools.client.schemas.validation.JsonSchema; +import org.openapijsonschematools.client.schemas.validation.JsonSchemaInfo; +import org.openapijsonschematools.client.schemas.validation.ListSchemaValidator; +import org.openapijsonschematools.client.schemas.validation.PathToSchemasMap; +import org.openapijsonschematools.client.schemas.validation.ValidationMetadata; + +public class ApplicationjsonSchema { + // nest classes so all schemas and input/output classes can be public + + + public static class ApplicationjsonSchemaList extends FrozenList { + protected ApplicationjsonSchemaList(FrozenList m) { + super(m); + } + public static ApplicationjsonSchemaList of(List> arg, SchemaConfiguration configuration) throws ValidationException { + return ApplicationjsonSchema1.getInstance().validate(arg, configuration); + } + } + + public static class ApplicationjsonSchemaListBuilder { + // class to build List> + private final List> list; + + public ApplicationjsonSchemaListBuilder() { + list = new ArrayList<>(); + } + + public ApplicationjsonSchemaListBuilder(List> list) { + this.list = list; + } + + public ApplicationjsonSchemaListBuilder add(Map item) { + list.add(item); + return this; + } + + public List> build() { + return list; + } + } + + + public sealed interface ApplicationjsonSchema1Boxed permits ApplicationjsonSchema1BoxedList { + @Nullable Object getData(); + } + + public record ApplicationjsonSchema1BoxedList(ApplicationjsonSchemaList data) implements ApplicationjsonSchema1Boxed { + @Override + public @Nullable Object getData() { + return data; + } + } + + + + public static class ApplicationjsonSchema1 extends JsonSchema implements ListSchemaValidator { + private static @Nullable ApplicationjsonSchema1 instance = null; + + protected ApplicationjsonSchema1() { + super(new JsonSchemaInfo() + .type(Set.of(List.class)) + .items(User.User1.class) + ); + } + + public static ApplicationjsonSchema1 getInstance() { + if (instance == null) { + instance = new ApplicationjsonSchema1(); + } + return instance; + } + + @Override + public ApplicationjsonSchemaList getNewInstance(List arg, List pathToItem, PathToSchemasMap pathToSchemas) { + List items = new ArrayList<>(); + int i = 0; + for (Object item: arg) { + List itemPathToItem = new ArrayList<>(pathToItem); + itemPathToItem.add(i); + LinkedHashMap, Nothing?> schemas = pathToSchemas.get(itemPathToItem); + if (schemas == null) { + throw new RuntimeException("Validation 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"); + } + items.add((User.UserMap) itemInstance); + i += 1; + } + FrozenList newInstanceItems = new FrozenList<>(items); + return new ApplicationjsonSchemaList(newInstanceItems); + } + + 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); + SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().build())); + ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, new PathToSchemasMap(), new LinkedHashSet<>()); + PathToSchemasMap pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet); + return getNewInstance(castArg, validationMetadata.pathToItem(), pathToSchemasMap); + } + + @Override + public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws 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"); + } + @Override + public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { + 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"); + } + @Override + 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 { + 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"); + } + } +} diff --git a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/responses/HeadersWithNoBody.kt b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/responses/HeadersWithNoBody.kt new file mode 100644 index 00000000000..6b4b40d824e --- /dev/null +++ b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/responses/HeadersWithNoBody.kt @@ -0,0 +1,47 @@ +package org.openapijsonschematools.client.components.responses; + +import org.openapijsonschematools.client.configurations.SchemaConfiguration; +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; + +import java.util.Map; +import java.net.http.HttpResponse; +import java.net.http.HttpHeaders; + +public class HeadersWithNoBody { + + public static class HeadersWithNoBody1 extends ResponseDeserializer { + public HeadersWithNoBody1() { + super( + MapUtils.makeMap( + ) + ); + } + + @Override + protected Nothing? getBody(String contentType, Nothing? mediaType, byte[] body, SchemaConfiguration configuration) { + return null; + } + + @Override + protected HeadersWithNoBodyHeadersSchema.HeadersWithNoBodyHeadersSchemaMap getHeaders(HttpHeaders headers, SchemaConfiguration configuration) throws ValidationException, NotImplementedException { + return new Headers().deserialize(headers, configuration); + } + } + + @SuppressWarnings("serial") + public static class ResponseApiException extends ApiException { + public DeserializedHttpResponse deserializedResponse; + + public ResponseApiException(String s, HttpResponse response, DeserializedHttpResponse deserializedResponse) { + super(s, response); + this.deserializedResponse = deserializedResponse; + } + } +} diff --git a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/responses/RefSuccessDescriptionOnly.kt b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/responses/RefSuccessDescriptionOnly.kt new file mode 100644 index 00000000000..13509546a1f --- /dev/null +++ b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/responses/RefSuccessDescriptionOnly.kt @@ -0,0 +1,6 @@ +package org.openapijsonschematools.client.components.responses; + + +public class RefSuccessDescriptionOnly extends SuccessDescriptionOnly { + public static class RefSuccessDescriptionOnly1 extends SuccessDescriptionOnly1 {} +} diff --git a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/responses/RefSuccessfulXmlAndJsonArrayOfPet.kt b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/responses/RefSuccessfulXmlAndJsonArrayOfPet.kt new file mode 100644 index 00000000000..c4276b6db9c --- /dev/null +++ b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/responses/RefSuccessfulXmlAndJsonArrayOfPet.kt @@ -0,0 +1,6 @@ +package org.openapijsonschematools.client.components.responses; + + +public class RefSuccessfulXmlAndJsonArrayOfPet extends SuccessfulXmlAndJsonArrayOfPet { + public static class RefSuccessfulXmlAndJsonArrayOfPet1 extends SuccessfulXmlAndJsonArrayOfPet1 {} +} diff --git a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/responses/SuccessDescriptionOnly.kt b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/responses/SuccessDescriptionOnly.kt new file mode 100644 index 00000000000..c2760832d29 --- /dev/null +++ b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/responses/SuccessDescriptionOnly.kt @@ -0,0 +1,45 @@ +package org.openapijsonschematools.client.components.responses; + +import org.openapijsonschematools.client.configurations.SchemaConfiguration; +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; +import java.net.http.HttpResponse; +import java.net.http.HttpHeaders; + +public class SuccessDescriptionOnly { + + public static class SuccessDescriptionOnly1 extends ResponseDeserializer { + public SuccessDescriptionOnly1() { + super( + MapUtils.makeMap( + ) + ); + } + + @Override + protected Nothing? getBody(String contentType, Nothing? mediaType, byte[] body, SchemaConfiguration configuration) { + return null; + } + + @Override + protected Nothing? getHeaders(HttpHeaders headers, SchemaConfiguration configuration) { + return null; + } + } + + @SuppressWarnings("serial") + public static class ResponseApiException extends ApiException { + public DeserializedHttpResponse deserializedResponse; + + public ResponseApiException(String s, HttpResponse response, DeserializedHttpResponse deserializedResponse) { + super(s, response); + this.deserializedResponse = deserializedResponse; + } + } +} diff --git a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/responses/SuccessInlineContentAndHeader.kt b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/responses/SuccessInlineContentAndHeader.kt new file mode 100644 index 00000000000..fb00d84450f --- /dev/null +++ b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/responses/SuccessInlineContentAndHeader.kt @@ -0,0 +1,65 @@ +package org.openapijsonschematools.client.components.responses; + +import org.openapijsonschematools.client.configurations.SchemaConfiguration; +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; +import org.openapijsonschematools.client.components.responses.successinlinecontentandheader.Headers; + +import java.util.AbstractMap; +import java.util.Map; +import java.net.http.HttpResponse; +import java.net.http.HttpHeaders; + +public class SuccessInlineContentAndHeader { + public sealed interface SealedMediaType permits ApplicationjsonMediaType {} + + public record ApplicationjsonMediaType(ApplicationjsonSchema.ApplicationjsonSchema1 schema) implements SealedMediaType, MediaType { + public ApplicationjsonMediaType() { + this(ApplicationjsonSchema.ApplicationjsonSchema1.getInstance()); + } + @Override + public Nothing? encoding() { + return null; + } + } + public sealed interface SealedResponseBody permits ApplicationjsonResponseBody {} + public record ApplicationjsonResponseBody(ApplicationjsonSchema.ApplicationjsonSchema1Boxed body) implements SealedResponseBody { } + + public static class SuccessInlineContentAndHeader1 extends ResponseDeserializer { + public SuccessInlineContentAndHeader1() { + super( + Map.ofEntries( + new AbstractMap.SimpleEntry<>("application/json", new ApplicationjsonMediaType()) + ) + ); + } + + @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); + } + + @Override + protected SuccessInlineContentAndHeaderHeadersSchema.SuccessInlineContentAndHeaderHeadersSchemaMap getHeaders(HttpHeaders headers, SchemaConfiguration configuration) throws ValidationException, NotImplementedException { + return new Headers().deserialize(headers, configuration); + } + } + + @SuppressWarnings("serial") + public static class ResponseApiException extends ApiException { + public DeserializedHttpResponse deserializedResponse; + + public ResponseApiException(String s, HttpResponse response, DeserializedHttpResponse deserializedResponse) { + super(s, response); + this.deserializedResponse = deserializedResponse; + } + } +} diff --git a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/responses/SuccessWithJsonApiResponse.kt b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/responses/SuccessWithJsonApiResponse.kt new file mode 100644 index 00000000000..08fac81a2fa --- /dev/null +++ b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/responses/SuccessWithJsonApiResponse.kt @@ -0,0 +1,65 @@ +package org.openapijsonschematools.client.components.responses; + +import org.openapijsonschematools.client.configurations.SchemaConfiguration; +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; +import org.openapijsonschematools.client.components.responses.successwithjsonapiresponse.Headers; + +import java.util.AbstractMap; +import java.util.Map; +import java.net.http.HttpResponse; +import java.net.http.HttpHeaders; + +public class SuccessWithJsonApiResponse { + public sealed interface SealedMediaType permits ApplicationjsonMediaType {} + + public record ApplicationjsonMediaType(ApplicationjsonSchema.ApplicationjsonSchema1 schema) implements SealedMediaType, MediaType { + public ApplicationjsonMediaType() { + this(ApplicationjsonSchema.ApplicationjsonSchema1.getInstance()); + } + @Override + public Nothing? encoding() { + return null; + } + } + public sealed interface SealedResponseBody permits ApplicationjsonResponseBody {} + public record ApplicationjsonResponseBody(ApplicationjsonSchema.ApiResponseSchema1Boxed body) implements SealedResponseBody { } + + public static class SuccessWithJsonApiResponse1 extends ResponseDeserializer { + public SuccessWithJsonApiResponse1() { + super( + Map.ofEntries( + new AbstractMap.SimpleEntry<>("application/json", new ApplicationjsonMediaType()) + ) + ); + } + + @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); + } + + @Override + protected SuccessWithJsonApiResponseHeadersSchema.SuccessWithJsonApiResponseHeadersSchemaMap getHeaders(HttpHeaders headers, SchemaConfiguration configuration) throws ValidationException, NotImplementedException { + return new Headers().deserialize(headers, configuration); + } + } + + @SuppressWarnings("serial") + public static class ResponseApiException extends ApiException { + public DeserializedHttpResponse deserializedResponse; + + public ResponseApiException(String s, HttpResponse response, DeserializedHttpResponse deserializedResponse) { + super(s, response); + this.deserializedResponse = deserializedResponse; + } + } +} diff --git a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/responses/SuccessfulXmlAndJsonArrayOfPet.kt b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/responses/SuccessfulXmlAndJsonArrayOfPet.kt new file mode 100644 index 00000000000..26526e55201 --- /dev/null +++ b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/responses/SuccessfulXmlAndJsonArrayOfPet.kt @@ -0,0 +1,81 @@ +package org.openapijsonschematools.client.components.responses; + +import org.openapijsonschematools.client.configurations.SchemaConfiguration; +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; + +import java.util.AbstractMap; +import java.util.Map; +import java.net.http.HttpResponse; +import java.net.http.HttpHeaders; + +public class SuccessfulXmlAndJsonArrayOfPet { + public sealed interface SealedMediaType permits ApplicationxmlMediaType, ApplicationjsonMediaType {} + + public record ApplicationxmlMediaType(ApplicationxmlSchema.ApplicationxmlSchema1 schema) implements SealedMediaType, MediaType { + public ApplicationxmlMediaType() { + this(ApplicationxmlSchema.ApplicationxmlSchema1.getInstance()); + } + @Override + public Nothing? encoding() { + return null; + } + } + + public record ApplicationjsonMediaType(ApplicationjsonSchema.ApplicationjsonSchema1 schema) implements SealedMediaType, MediaType { + public ApplicationjsonMediaType() { + this(ApplicationjsonSchema.ApplicationjsonSchema1.getInstance()); + } + @Override + public Nothing? encoding() { + return null; + } + } + public sealed interface SealedResponseBody permits ApplicationxmlResponseBody, ApplicationjsonResponseBody {} + public record ApplicationxmlResponseBody(ApplicationxmlSchema.ApplicationxmlSchema1Boxed body) implements SealedResponseBody { } + public record ApplicationjsonResponseBody(ApplicationjsonSchema.ApplicationjsonSchema1Boxed body) implements SealedResponseBody { } + + public static class SuccessfulXmlAndJsonArrayOfPet1 extends ResponseDeserializer { + public SuccessfulXmlAndJsonArrayOfPet1() { + super( + Map.ofEntries( + new AbstractMap.SimpleEntry<>("application/xml", new ApplicationxmlMediaType()), + new AbstractMap.SimpleEntry<>("application/json", new ApplicationjsonMediaType()) + ) + ); + } + + @Override + 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 { + ApplicationjsonMediaType thisMediaType = (ApplicationjsonMediaType) mediaType; + var deserializedBody = deserializeBody(contentType, body, thisMediaType.schema(), configuration); + return new ApplicationjsonResponseBody(deserializedBody); + } + } + + @Override + protected Nothing? getHeaders(HttpHeaders headers, SchemaConfiguration configuration) { + return null; + } + } + + @SuppressWarnings("serial") + public static class ResponseApiException extends ApiException { + public DeserializedHttpResponse deserializedResponse; + + public ResponseApiException(String s, HttpResponse response, DeserializedHttpResponse deserializedResponse) { + super(s, response); + this.deserializedResponse = deserializedResponse; + } + } +} diff --git a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/responses/headerswithnobody/Headers.kt b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/responses/headerswithnobody/Headers.kt new file mode 100644 index 00000000000..dacfb5ee075 --- /dev/null +++ b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/responses/headerswithnobody/Headers.kt @@ -0,0 +1,18 @@ +package org.openapijsonschematools.client.components.responses.headerswithnobody; + +import org.openapijsonschematools.client.response.HeadersDeserializer; +import org.openapijsonschematools.client.components.responses.headerswithnobody.headers.Location; + +import java.util.Map; +import java.util.AbstractMap; + +public class Headers extends HeadersDeserializer { + public Headers() { + super( + Map.ofEntries( + new AbstractMap.SimpleEntry<>("location", new Location.Location1()) + ), + HeadersWithNoBodyHeadersSchema.HeadersWithNoBodyHeadersSchema1.getInstance() + ); + } +} \ No newline at end of file diff --git a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/responses/headerswithnobody/HeadersWithNoBodyHeadersSchema.kt b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/responses/headerswithnobody/HeadersWithNoBodyHeadersSchema.kt new file mode 100644 index 00000000000..2ee26178149 --- /dev/null +++ b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/responses/headerswithnobody/HeadersWithNoBodyHeadersSchema.kt @@ -0,0 +1,191 @@ +package org.openapijsonschematools.client.components.responses.headerswithnobody; +import java.util.ArrayList; +import java.util.HashSet; +import java.util.LinkedHashMap; +import java.util.LinkedHashSet; +import java.util.List; +import java.util.Map; +import java.util.Objects; +import java.util.Set; +import org.checkerframework.checker.nullness.qual.Nullable; +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.UnsetPropertyException; +import org.openapijsonschematools.client.exceptions.ValidationException; +import org.openapijsonschematools.client.schemas.AnyTypeJsonSchema; +import org.openapijsonschematools.client.schemas.GenericBuilder; +import org.openapijsonschematools.client.schemas.NotAnyTypeJsonSchema; +import org.openapijsonschematools.client.schemas.validation.FrozenMap; +import org.openapijsonschematools.client.schemas.validation.JsonSchema; +import org.openapijsonschematools.client.schemas.validation.JsonSchemaInfo; +import org.openapijsonschematools.client.schemas.validation.MapSchemaValidator; +import org.openapijsonschematools.client.schemas.validation.MapUtils; +import org.openapijsonschematools.client.schemas.validation.PathToSchemasMap; +import org.openapijsonschematools.client.schemas.validation.PropertyEntry; +import org.openapijsonschematools.client.schemas.validation.ValidationMetadata; + +public class HeadersWithNoBodyHeadersSchema { + // nest classes so all schemas and input/output classes can be public + + + public static class HeadersWithNoBodyAdditionalProperties extends NotAnyTypeJsonSchema.NotAnyTypeJsonSchema1 { + // NotAnyTypeSchema + private static @Nullable HeadersWithNoBodyAdditionalProperties instance = null; + public static HeadersWithNoBodyAdditionalProperties getInstance() { + if (instance == null) { + instance = new HeadersWithNoBodyAdditionalProperties(); + } + return instance; + } + } + + + public static class HeadersWithNoBodyHeadersSchemaMap extends FrozenMap { + protected HeadersWithNoBodyHeadersSchemaMap(FrozenMap m) { + super(m); + } + public static final Set requiredKeys = Set.of(); + public static final Set optionalKeys = Set.of( + "location" + ); + public static HeadersWithNoBodyHeadersSchemaMap of(Map arg, SchemaConfiguration configuration) throws ValidationException { + return HeadersWithNoBodyHeadersSchema1.getInstance().validate(arg, configuration); + } + + public String location() throws UnsetPropertyException { + return getOrThrow("location"); + } + } + + public interface SetterForHeadersWithNoBodyLocation { + Map getInstance(); + T getBuilderAfterHeadersWithNoBodyLocation(Map instance); + + default T location(String value) { + var instance = getInstance(); + instance.put("location", value); + return getBuilderAfterHeadersWithNoBodyLocation(instance); + } + } + + public static class HeadersWithNoBodyHeadersSchemaMapBuilder implements GenericBuilder>, SetterForHeadersWithNoBodyLocation { + private final Map instance; + private static final Set knownKeys = Set.of( + "location" + ); + public Set getKnownKeys() { + return knownKeys; + } + public HeadersWithNoBodyHeadersSchemaMapBuilder() { + this.instance = new LinkedHashMap<>(); + } + public Map build() { + return instance; + } + public Map getInstance() { + return instance; + } + public HeadersWithNoBodyHeadersSchemaMapBuilder getBuilderAfterHeadersWithNoBodyLocation(Map instance) { + return this; + } + } + + + public sealed interface HeadersWithNoBodyHeadersSchema1Boxed permits HeadersWithNoBodyHeadersSchema1BoxedMap { + @Nullable Object getData(); + } + + public record HeadersWithNoBodyHeadersSchema1BoxedMap(HeadersWithNoBodyHeadersSchemaMap data) implements HeadersWithNoBodyHeadersSchema1Boxed { + @Override + public @Nullable Object getData() { + return data; + } + } + + + public static class HeadersWithNoBodyHeadersSchema1 extends JsonSchema implements MapSchemaValidator { + private static @Nullable HeadersWithNoBodyHeadersSchema1 instance = null; + + protected HeadersWithNoBodyHeadersSchema1() { + super(new JsonSchemaInfo() + .type(Set.of(Map.class)) + .properties(Map.ofEntries( + new PropertyEntry("location", LocationSchema.LocationSchema1.class) + )) + .additionalProperties(HeadersWithNoBodyAdditionalProperties.class) + ); + } + + public static HeadersWithNoBodyHeadersSchema1 getInstance() { + if (instance == null) { + instance = new HeadersWithNoBodyHeadersSchema1(); + } + return instance; + } + + 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 RuntimeException("Invalid non-string key value"); + } + String propertyName = (String) entryKey; + List propertyPathToItem = new ArrayList<>(pathToItem); + propertyPathToItem.add(propertyName); + Object value = entry.getValue(); + LinkedHashMap, Nothing?> schemas = pathToSchemas.get(propertyPathToItem); + if (schemas == null) { + throw new RuntimeException("Validation 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"); + } + properties.put(propertyName, (String) propertyInstance); + } + FrozenMap castProperties = new FrozenMap<>(properties); + return new HeadersWithNoBodyHeadersSchemaMap(castProperties); + } + + 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); + SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().build())); + ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, new PathToSchemasMap(), new LinkedHashSet<>()); + PathToSchemasMap pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet); + return getNewInstance(castArg, validationMetadata.pathToItem(), pathToSchemasMap); + } + + + @Override + public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws 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"); + } + @Override + public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { + if (arg instanceof Map) { + return getNewInstance((Map) arg, pathToItem, pathToSchemas); + } + 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 { + return new HeadersWithNoBodyHeadersSchema1BoxedMap(validate(arg, configuration)); + } + @Override + public HeadersWithNoBodyHeadersSchema1Boxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { + 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"); + } + } + +} diff --git a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/responses/headerswithnobody/headers/Location.kt b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/responses/headerswithnobody/headers/Location.kt new file mode 100644 index 00000000000..9f172e1f922 --- /dev/null +++ b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/responses/headerswithnobody/headers/Location.kt @@ -0,0 +1,18 @@ +package org.openapijsonschematools.client.components.responses.headerswithnobody.headers; + +import org.openapijsonschematools.client.header.SchemaHeader; +import org.openapijsonschematools.client.components.responses.headerswithnobody.headers.location.LocationSchema; + +public class Location { + + public static class Location1 extends SchemaHeader { + public Location1() { + super( + false, + null, + false, + LocationSchema.LocationSchema1.getInstance() + ); + } + } +} diff --git a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/responses/headerswithnobody/headers/location/LocationSchema.kt b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/responses/headerswithnobody/headers/location/LocationSchema.kt new file mode 100644 index 00000000000..74b5a5f48c8 --- /dev/null +++ b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/responses/headerswithnobody/headers/location/LocationSchema.kt @@ -0,0 +1,19 @@ +package org.openapijsonschematools.client.components.responses.headerswithnobody.headers.location; +import org.checkerframework.checker.nullness.qual.Nullable; +import org.openapijsonschematools.client.schemas.StringJsonSchema; + +public class LocationSchema extends StringJsonSchema { + // nest classes so all schemas and input/output classes can be public + + + public static class LocationSchema1 extends StringJsonSchema.StringJsonSchema1 { + private static @Nullable LocationSchema1 instance = null; + public static LocationSchema1 getInstance() { + if (instance == null) { + instance = new LocationSchema1(); + } + return instance; + } + } + +} diff --git a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/responses/successfulxmlandjsonarrayofpet/content/applicationjson/ApplicationjsonSchema.kt b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/responses/successfulxmlandjsonarrayofpet/content/applicationjson/ApplicationjsonSchema.kt new file mode 100644 index 00000000000..f9f549b50d7 --- /dev/null +++ b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/responses/successfulxmlandjsonarrayofpet/content/applicationjson/ApplicationjsonSchema.kt @@ -0,0 +1,149 @@ +package org.openapijsonschematools.client.components.responses.successfulxmlandjsonarrayofpet.content.applicationjson; +import java.util.ArrayList; +import java.util.HashSet; +import java.util.LinkedHashMap; +import java.util.LinkedHashSet; +import java.util.List; +import java.util.Map; +import java.util.Objects; +import java.util.Set; +import org.checkerframework.checker.nullness.qual.Nullable; +import org.openapijsonschematools.client.components.schemas.Pet; +import org.openapijsonschematools.client.components.schemas.RefPet; +import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags; +import org.openapijsonschematools.client.configurations.SchemaConfiguration; +import org.openapijsonschematools.client.exceptions.ValidationException; +import org.openapijsonschematools.client.schemas.validation.FrozenList; +import org.openapijsonschematools.client.schemas.validation.FrozenMap; +import org.openapijsonschematools.client.schemas.validation.JsonSchema; +import org.openapijsonschematools.client.schemas.validation.JsonSchemaInfo; +import org.openapijsonschematools.client.schemas.validation.ListSchemaValidator; +import org.openapijsonschematools.client.schemas.validation.PathToSchemasMap; +import org.openapijsonschematools.client.schemas.validation.ValidationMetadata; + +public class ApplicationjsonSchema { + // nest classes so all schemas and input/output classes can be public + + + public static class ApplicationjsonSchemaList extends FrozenList { + protected ApplicationjsonSchemaList(FrozenList m) { + super(m); + } + public static ApplicationjsonSchemaList of(List> arg, SchemaConfiguration configuration) throws ValidationException { + return ApplicationjsonSchema1.getInstance().validate(arg, configuration); + } + } + + public static class ApplicationjsonSchemaListBuilder { + // class to build List> + private final List> list; + + public ApplicationjsonSchemaListBuilder() { + list = new ArrayList<>(); + } + + public ApplicationjsonSchemaListBuilder(List> list) { + this.list = list; + } + + public ApplicationjsonSchemaListBuilder add(Map item) { + list.add(item); + return this; + } + + public List> build() { + return list; + } + } + + + public sealed interface ApplicationjsonSchema1Boxed permits ApplicationjsonSchema1BoxedList { + @Nullable Object getData(); + } + + public record ApplicationjsonSchema1BoxedList(ApplicationjsonSchemaList data) implements ApplicationjsonSchema1Boxed { + @Override + public @Nullable Object getData() { + return data; + } + } + + + + public static class ApplicationjsonSchema1 extends JsonSchema implements ListSchemaValidator { + private static @Nullable ApplicationjsonSchema1 instance = null; + + protected ApplicationjsonSchema1() { + super(new JsonSchemaInfo() + .type(Set.of(List.class)) + .items(RefPet.RefPet1.class) + ); + } + + public static ApplicationjsonSchema1 getInstance() { + if (instance == null) { + instance = new ApplicationjsonSchema1(); + } + return instance; + } + + @Override + public ApplicationjsonSchemaList getNewInstance(List arg, List pathToItem, PathToSchemasMap pathToSchemas) { + List items = new ArrayList<>(); + int i = 0; + for (Object item: arg) { + List itemPathToItem = new ArrayList<>(pathToItem); + itemPathToItem.add(i); + LinkedHashMap, Nothing?> schemas = pathToSchemas.get(itemPathToItem); + if (schemas == null) { + throw new RuntimeException("Validation 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"); + } + items.add((Pet.PetMap) itemInstance); + i += 1; + } + FrozenList newInstanceItems = new FrozenList<>(items); + return new ApplicationjsonSchemaList(newInstanceItems); + } + + 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); + SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().build())); + ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, new PathToSchemasMap(), new LinkedHashSet<>()); + PathToSchemasMap pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet); + return getNewInstance(castArg, validationMetadata.pathToItem(), pathToSchemasMap); + } + + @Override + public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws 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"); + } + @Override + public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { + 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"); + } + @Override + 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 { + 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"); + } + } +} diff --git a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/responses/successfulxmlandjsonarrayofpet/content/applicationxml/ApplicationxmlSchema.kt b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/responses/successfulxmlandjsonarrayofpet/content/applicationxml/ApplicationxmlSchema.kt new file mode 100644 index 00000000000..94cf4c63c67 --- /dev/null +++ b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/responses/successfulxmlandjsonarrayofpet/content/applicationxml/ApplicationxmlSchema.kt @@ -0,0 +1,148 @@ +package org.openapijsonschematools.client.components.responses.successfulxmlandjsonarrayofpet.content.applicationxml; +import java.util.ArrayList; +import java.util.HashSet; +import java.util.LinkedHashMap; +import java.util.LinkedHashSet; +import java.util.List; +import java.util.Map; +import java.util.Objects; +import java.util.Set; +import org.checkerframework.checker.nullness.qual.Nullable; +import org.openapijsonschematools.client.components.schemas.Pet; +import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags; +import org.openapijsonschematools.client.configurations.SchemaConfiguration; +import org.openapijsonschematools.client.exceptions.ValidationException; +import org.openapijsonschematools.client.schemas.validation.FrozenList; +import org.openapijsonschematools.client.schemas.validation.FrozenMap; +import org.openapijsonschematools.client.schemas.validation.JsonSchema; +import org.openapijsonschematools.client.schemas.validation.JsonSchemaInfo; +import org.openapijsonschematools.client.schemas.validation.ListSchemaValidator; +import org.openapijsonschematools.client.schemas.validation.PathToSchemasMap; +import org.openapijsonschematools.client.schemas.validation.ValidationMetadata; + +public class ApplicationxmlSchema { + // nest classes so all schemas and input/output classes can be public + + + public static class ApplicationxmlSchemaList extends FrozenList { + protected ApplicationxmlSchemaList(FrozenList m) { + super(m); + } + public static ApplicationxmlSchemaList of(List> arg, SchemaConfiguration configuration) throws ValidationException { + return ApplicationxmlSchema1.getInstance().validate(arg, configuration); + } + } + + public static class ApplicationxmlSchemaListBuilder { + // class to build List> + private final List> list; + + public ApplicationxmlSchemaListBuilder() { + list = new ArrayList<>(); + } + + public ApplicationxmlSchemaListBuilder(List> list) { + this.list = list; + } + + public ApplicationxmlSchemaListBuilder add(Map item) { + list.add(item); + return this; + } + + public List> build() { + return list; + } + } + + + public sealed interface ApplicationxmlSchema1Boxed permits ApplicationxmlSchema1BoxedList { + @Nullable Object getData(); + } + + public record ApplicationxmlSchema1BoxedList(ApplicationxmlSchemaList data) implements ApplicationxmlSchema1Boxed { + @Override + public @Nullable Object getData() { + return data; + } + } + + + + public static class ApplicationxmlSchema1 extends JsonSchema implements ListSchemaValidator { + private static @Nullable ApplicationxmlSchema1 instance = null; + + protected ApplicationxmlSchema1() { + super(new JsonSchemaInfo() + .type(Set.of(List.class)) + .items(Pet.Pet1.class) + ); + } + + public static ApplicationxmlSchema1 getInstance() { + if (instance == null) { + instance = new ApplicationxmlSchema1(); + } + return instance; + } + + @Override + public ApplicationxmlSchemaList getNewInstance(List arg, List pathToItem, PathToSchemasMap pathToSchemas) { + List items = new ArrayList<>(); + int i = 0; + for (Object item: arg) { + List itemPathToItem = new ArrayList<>(pathToItem); + itemPathToItem.add(i); + LinkedHashMap, Nothing?> schemas = pathToSchemas.get(itemPathToItem); + if (schemas == null) { + throw new RuntimeException("Validation 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"); + } + items.add((Pet.PetMap) itemInstance); + i += 1; + } + FrozenList newInstanceItems = new FrozenList<>(items); + return new ApplicationxmlSchemaList(newInstanceItems); + } + + 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); + SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().build())); + ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, new PathToSchemasMap(), new LinkedHashSet<>()); + PathToSchemasMap pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet); + return getNewInstance(castArg, validationMetadata.pathToItem(), pathToSchemasMap); + } + + @Override + public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws 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"); + } + @Override + public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { + 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"); + } + @Override + 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 { + 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"); + } + } +} diff --git a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/responses/successinlinecontentandheader/Headers.kt b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/responses/successinlinecontentandheader/Headers.kt new file mode 100644 index 00000000000..dece46b982e --- /dev/null +++ b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/responses/successinlinecontentandheader/Headers.kt @@ -0,0 +1,18 @@ +package org.openapijsonschematools.client.components.responses.successinlinecontentandheader; + +import org.openapijsonschematools.client.response.HeadersDeserializer; +import org.openapijsonschematools.client.components.responses.successinlinecontentandheader.headers.SomeHeader; + +import java.util.Map; +import java.util.AbstractMap; + +public class Headers extends HeadersDeserializer { + public Headers() { + super( + Map.ofEntries( + new AbstractMap.SimpleEntry<>("someHeader", new SomeHeader.SomeHeader1()) + ), + SuccessInlineContentAndHeaderHeadersSchema.SuccessInlineContentAndHeaderHeadersSchema1.getInstance() + ); + } +} \ No newline at end of file diff --git a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/responses/successinlinecontentandheader/SuccessInlineContentAndHeaderHeadersSchema.kt b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/responses/successinlinecontentandheader/SuccessInlineContentAndHeaderHeadersSchema.kt new file mode 100644 index 00000000000..96c9737d130 --- /dev/null +++ b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/responses/successinlinecontentandheader/SuccessInlineContentAndHeaderHeadersSchema.kt @@ -0,0 +1,191 @@ +package org.openapijsonschematools.client.components.responses.successinlinecontentandheader; +import java.util.ArrayList; +import java.util.HashSet; +import java.util.LinkedHashMap; +import java.util.LinkedHashSet; +import java.util.List; +import java.util.Map; +import java.util.Objects; +import java.util.Set; +import org.checkerframework.checker.nullness.qual.Nullable; +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.UnsetPropertyException; +import org.openapijsonschematools.client.exceptions.ValidationException; +import org.openapijsonschematools.client.schemas.AnyTypeJsonSchema; +import org.openapijsonschematools.client.schemas.GenericBuilder; +import org.openapijsonschematools.client.schemas.NotAnyTypeJsonSchema; +import org.openapijsonschematools.client.schemas.validation.FrozenMap; +import org.openapijsonschematools.client.schemas.validation.JsonSchema; +import org.openapijsonschematools.client.schemas.validation.JsonSchemaInfo; +import org.openapijsonschematools.client.schemas.validation.MapSchemaValidator; +import org.openapijsonschematools.client.schemas.validation.MapUtils; +import org.openapijsonschematools.client.schemas.validation.PathToSchemasMap; +import org.openapijsonschematools.client.schemas.validation.PropertyEntry; +import org.openapijsonschematools.client.schemas.validation.ValidationMetadata; + +public class SuccessInlineContentAndHeaderHeadersSchema { + // nest classes so all schemas and input/output classes can be public + + + public static class SuccessInlineContentAndHeaderAdditionalProperties extends NotAnyTypeJsonSchema.NotAnyTypeJsonSchema1 { + // NotAnyTypeSchema + private static @Nullable SuccessInlineContentAndHeaderAdditionalProperties instance = null; + public static SuccessInlineContentAndHeaderAdditionalProperties getInstance() { + if (instance == null) { + instance = new SuccessInlineContentAndHeaderAdditionalProperties(); + } + return instance; + } + } + + + public static class SuccessInlineContentAndHeaderHeadersSchemaMap extends FrozenMap { + protected SuccessInlineContentAndHeaderHeadersSchemaMap(FrozenMap m) { + super(m); + } + public static final Set requiredKeys = Set.of(); + public static final Set optionalKeys = Set.of( + "someHeader" + ); + public static SuccessInlineContentAndHeaderHeadersSchemaMap of(Map arg, SchemaConfiguration configuration) throws ValidationException { + return SuccessInlineContentAndHeaderHeadersSchema1.getInstance().validate(arg, configuration); + } + + public String someHeader() throws UnsetPropertyException { + return getOrThrow("someHeader"); + } + } + + public interface SetterForSuccessInlineContentAndHeaderSomeHeader { + Map getInstance(); + T getBuilderAfterSuccessInlineContentAndHeaderSomeHeader(Map instance); + + default T someHeader(String value) { + var instance = getInstance(); + instance.put("someHeader", value); + return getBuilderAfterSuccessInlineContentAndHeaderSomeHeader(instance); + } + } + + public static class SuccessInlineContentAndHeaderHeadersSchemaMapBuilder implements GenericBuilder>, SetterForSuccessInlineContentAndHeaderSomeHeader { + private final Map instance; + private static final Set knownKeys = Set.of( + "someHeader" + ); + public Set getKnownKeys() { + return knownKeys; + } + public SuccessInlineContentAndHeaderHeadersSchemaMapBuilder() { + this.instance = new LinkedHashMap<>(); + } + public Map build() { + return instance; + } + public Map getInstance() { + return instance; + } + public SuccessInlineContentAndHeaderHeadersSchemaMapBuilder getBuilderAfterSuccessInlineContentAndHeaderSomeHeader(Map instance) { + return this; + } + } + + + public sealed interface SuccessInlineContentAndHeaderHeadersSchema1Boxed permits SuccessInlineContentAndHeaderHeadersSchema1BoxedMap { + @Nullable Object getData(); + } + + public record SuccessInlineContentAndHeaderHeadersSchema1BoxedMap(SuccessInlineContentAndHeaderHeadersSchemaMap data) implements SuccessInlineContentAndHeaderHeadersSchema1Boxed { + @Override + public @Nullable Object getData() { + return data; + } + } + + + public static class SuccessInlineContentAndHeaderHeadersSchema1 extends JsonSchema implements MapSchemaValidator { + private static @Nullable SuccessInlineContentAndHeaderHeadersSchema1 instance = null; + + protected SuccessInlineContentAndHeaderHeadersSchema1() { + super(new JsonSchemaInfo() + .type(Set.of(Map.class)) + .properties(Map.ofEntries( + new PropertyEntry("someHeader", SomeHeaderSchema.SomeHeaderSchema1.class) + )) + .additionalProperties(SuccessInlineContentAndHeaderAdditionalProperties.class) + ); + } + + public static SuccessInlineContentAndHeaderHeadersSchema1 getInstance() { + if (instance == null) { + instance = new SuccessInlineContentAndHeaderHeadersSchema1(); + } + return instance; + } + + 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 RuntimeException("Invalid non-string key value"); + } + String propertyName = (String) entryKey; + List propertyPathToItem = new ArrayList<>(pathToItem); + propertyPathToItem.add(propertyName); + Object value = entry.getValue(); + LinkedHashMap, Nothing?> schemas = pathToSchemas.get(propertyPathToItem); + if (schemas == null) { + throw new RuntimeException("Validation 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"); + } + properties.put(propertyName, (String) propertyInstance); + } + FrozenMap castProperties = new FrozenMap<>(properties); + return new SuccessInlineContentAndHeaderHeadersSchemaMap(castProperties); + } + + 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); + SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().build())); + ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, new PathToSchemasMap(), new LinkedHashSet<>()); + PathToSchemasMap pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet); + return getNewInstance(castArg, validationMetadata.pathToItem(), pathToSchemasMap); + } + + + @Override + public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws 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"); + } + @Override + public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { + if (arg instanceof Map) { + return getNewInstance((Map) arg, pathToItem, pathToSchemas); + } + 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 { + return new SuccessInlineContentAndHeaderHeadersSchema1BoxedMap(validate(arg, configuration)); + } + @Override + public SuccessInlineContentAndHeaderHeadersSchema1Boxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { + 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"); + } + } + +} diff --git a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/responses/successinlinecontentandheader/content/applicationjson/ApplicationjsonSchema.kt b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/responses/successinlinecontentandheader/content/applicationjson/ApplicationjsonSchema.kt new file mode 100644 index 00000000000..73cc093b356 --- /dev/null +++ b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/responses/successinlinecontentandheader/content/applicationjson/ApplicationjsonSchema.kt @@ -0,0 +1,190 @@ +package org.openapijsonschematools.client.components.responses.successinlinecontentandheader.content.applicationjson; +import java.util.ArrayList; +import java.util.HashSet; +import java.util.LinkedHashMap; +import java.util.LinkedHashSet; +import java.util.List; +import java.util.Map; +import java.util.Objects; +import java.util.Set; +import org.checkerframework.checker.nullness.qual.Nullable; +import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags; +import org.openapijsonschematools.client.configurations.SchemaConfiguration; +import org.openapijsonschematools.client.exceptions.InvalidAdditionalPropertyException; +import org.openapijsonschematools.client.exceptions.UnsetPropertyException; +import org.openapijsonschematools.client.exceptions.ValidationException; +import org.openapijsonschematools.client.schemas.GenericBuilder; +import org.openapijsonschematools.client.schemas.Int32JsonSchema; +import org.openapijsonschematools.client.schemas.validation.FrozenMap; +import org.openapijsonschematools.client.schemas.validation.JsonSchema; +import org.openapijsonschematools.client.schemas.validation.JsonSchemaInfo; +import org.openapijsonschematools.client.schemas.validation.MapSchemaValidator; +import org.openapijsonschematools.client.schemas.validation.MapUtils; +import org.openapijsonschematools.client.schemas.validation.PathToSchemasMap; +import org.openapijsonschematools.client.schemas.validation.ValidationMetadata; + +public class ApplicationjsonSchema { + // nest classes so all schemas and input/output classes can be public + + + public static class ApplicationjsonAdditionalProperties extends Int32JsonSchema.Int32JsonSchema1 { + private static @Nullable ApplicationjsonAdditionalProperties instance = null; + public static ApplicationjsonAdditionalProperties getInstance() { + if (instance == null) { + instance = new ApplicationjsonAdditionalProperties(); + } + return instance; + } + } + + + public static class ApplicationjsonSchemaMap extends FrozenMap { + protected ApplicationjsonSchemaMap(FrozenMap m) { + super(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 { + return ApplicationjsonSchema1.getInstance().validate(arg, configuration); + } + + public Number getAdditionalProperty(String name) throws UnsetPropertyException { + return getOrThrow(name); + } + } + + public interface SetterForApplicationjsonAdditionalProperties { + Set getKnownKeys(); + Map getInstance(); + T getBuilderAfterAdditionalProperty(Map instance); + + default T additionalProperty(String key, int value) throws InvalidAdditionalPropertyException { + MapUtils.throwIfKeyKnown(key, getKnownKeys(), true); + var instance = getInstance(); + instance.put(key, value); + return getBuilderAfterAdditionalProperty(instance); + } + + default T additionalProperty(String key, float value) throws InvalidAdditionalPropertyException { + MapUtils.throwIfKeyKnown(key, getKnownKeys(), true); + var instance = getInstance(); + instance.put(key, value); + return getBuilderAfterAdditionalProperty(instance); + } + } + + public static class ApplicationjsonSchemaMapBuilder implements GenericBuilder>, SetterForApplicationjsonAdditionalProperties { + private final Map instance; + private static final Set knownKeys = Set.of(); + public Set getKnownKeys() { + return knownKeys; + } + public ApplicationjsonSchemaMapBuilder() { + this.instance = new LinkedHashMap<>(); + } + public Map build() { + return instance; + } + public Map getInstance() { + return instance; + } + public ApplicationjsonSchemaMapBuilder getBuilderAfterAdditionalProperty(Map instance) { + return this; + } + } + + + public sealed interface ApplicationjsonSchema1Boxed permits ApplicationjsonSchema1BoxedMap { + @Nullable Object getData(); + } + + public record ApplicationjsonSchema1BoxedMap(ApplicationjsonSchemaMap data) implements ApplicationjsonSchema1Boxed { + @Override + public @Nullable Object getData() { + return data; + } + } + + + public static class ApplicationjsonSchema1 extends JsonSchema implements MapSchemaValidator { + private static @Nullable ApplicationjsonSchema1 instance = null; + + protected ApplicationjsonSchema1() { + super(new JsonSchemaInfo() + .type(Set.of(Map.class)) + .additionalProperties(ApplicationjsonAdditionalProperties.class) + ); + } + + public static ApplicationjsonSchema1 getInstance() { + if (instance == null) { + instance = new ApplicationjsonSchema1(); + } + return instance; + } + + 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 RuntimeException("Invalid non-string key value"); + } + String propertyName = (String) entryKey; + List propertyPathToItem = new ArrayList<>(pathToItem); + propertyPathToItem.add(propertyName); + Object value = entry.getValue(); + LinkedHashMap, Nothing?> schemas = pathToSchemas.get(propertyPathToItem); + if (schemas == null) { + throw new RuntimeException("Validation 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"); + } + properties.put(propertyName, (Number) propertyInstance); + } + FrozenMap castProperties = new FrozenMap<>(properties); + return new ApplicationjsonSchemaMap(castProperties); + } + + 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); + SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().build())); + ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, new PathToSchemasMap(), new LinkedHashSet<>()); + PathToSchemasMap pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet); + return getNewInstance(castArg, validationMetadata.pathToItem(), pathToSchemasMap); + } + + + @Override + public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws 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"); + } + @Override + public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { + if (arg instanceof Map) { + return getNewInstance((Map) arg, pathToItem, pathToSchemas); + } + 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 { + return new ApplicationjsonSchema1BoxedMap(validate(arg, configuration)); + } + @Override + public ApplicationjsonSchema1Boxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { + 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"); + } + } + +} diff --git a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/responses/successinlinecontentandheader/headers/SomeHeader.kt b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/responses/successinlinecontentandheader/headers/SomeHeader.kt new file mode 100644 index 00000000000..f0146d6c5d6 --- /dev/null +++ b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/responses/successinlinecontentandheader/headers/SomeHeader.kt @@ -0,0 +1,18 @@ +package org.openapijsonschematools.client.components.responses.successinlinecontentandheader.headers; + +import org.openapijsonschematools.client.header.SchemaHeader; +import org.openapijsonschematools.client.components.responses.successinlinecontentandheader.headers.someheader.SomeHeaderSchema; + +public class SomeHeader { + + public static class SomeHeader1 extends SchemaHeader { + public SomeHeader1() { + super( + false, + null, + false, + SomeHeaderSchema.SomeHeaderSchema1.getInstance() + ); + } + } +} diff --git a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/responses/successinlinecontentandheader/headers/someheader/SomeHeaderSchema.kt b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/responses/successinlinecontentandheader/headers/someheader/SomeHeaderSchema.kt new file mode 100644 index 00000000000..64929f2e4d2 --- /dev/null +++ b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/responses/successinlinecontentandheader/headers/someheader/SomeHeaderSchema.kt @@ -0,0 +1,19 @@ +package org.openapijsonschematools.client.components.responses.successinlinecontentandheader.headers.someheader; +import org.checkerframework.checker.nullness.qual.Nullable; +import org.openapijsonschematools.client.schemas.StringJsonSchema; + +public class SomeHeaderSchema extends StringJsonSchema { + // nest classes so all schemas and input/output classes can be public + + + public static class SomeHeaderSchema1 extends StringJsonSchema.StringJsonSchema1 { + private static @Nullable SomeHeaderSchema1 instance = null; + public static SomeHeaderSchema1 getInstance() { + if (instance == null) { + instance = new SomeHeaderSchema1(); + } + return instance; + } + } + +} diff --git a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/responses/successwithjsonapiresponse/Headers.kt b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/responses/successwithjsonapiresponse/Headers.kt new file mode 100644 index 00000000000..d762e053d69 --- /dev/null +++ b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/responses/successwithjsonapiresponse/Headers.kt @@ -0,0 +1,26 @@ +package org.openapijsonschematools.client.components.responses.successwithjsonapiresponse; + +import org.openapijsonschematools.client.response.HeadersDeserializer; +import org.openapijsonschematools.client.components.responses.successwithjsonapiresponse.headers.Refschemaheader; +import org.openapijsonschematools.client.components.responses.successwithjsonapiresponse.headers.Int32; +import org.openapijsonschematools.client.components.responses.successwithjsonapiresponse.headers.Refcontentschemaheader; +import org.openapijsonschematools.client.components.responses.successwithjsonapiresponse.headers.StringHeader; +import org.openapijsonschematools.client.components.responses.successwithjsonapiresponse.headers.NumberHeader; + +import java.util.Map; +import java.util.AbstractMap; + +public class Headers extends HeadersDeserializer { + public Headers() { + super( + Map.ofEntries( + new AbstractMap.SimpleEntry<>("ref-schema-header", new Refschemaheader.Refschemaheader1()), + new AbstractMap.SimpleEntry<>("int32", new Int32.Int321()), + new AbstractMap.SimpleEntry<>("ref-content-schema-header", new Refcontentschemaheader.Refcontentschemaheader1()), + new AbstractMap.SimpleEntry<>("stringHeader", new StringHeader.StringHeader1()), + new AbstractMap.SimpleEntry<>("numberHeader", new NumberHeader.NumberHeader1()) + ), + SuccessWithJsonApiResponseHeadersSchema.SuccessWithJsonApiResponseHeadersSchema1.getInstance() + ); + } +} \ No newline at end of file diff --git a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/responses/successwithjsonapiresponse/SuccessWithJsonApiResponseHeadersSchema.kt b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/responses/successwithjsonapiresponse/SuccessWithJsonApiResponseHeadersSchema.kt new file mode 100644 index 00000000000..13f3499e106 --- /dev/null +++ b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/responses/successwithjsonapiresponse/SuccessWithJsonApiResponseHeadersSchema.kt @@ -0,0 +1,528 @@ +package org.openapijsonschematools.client.components.responses.successwithjsonapiresponse; +import java.util.ArrayList; +import java.util.HashSet; +import java.util.LinkedHashMap; +import java.util.LinkedHashSet; +import java.util.List; +import java.util.Map; +import java.util.Objects; +import java.util.Set; +import org.checkerframework.checker.nullness.qual.Nullable; +import org.openapijsonschematools.client.components.headers.int32jsoncontenttypeheader.content.applicationjson.Int32JsonContentTypeHeaderSchema; +import org.openapijsonschematools.client.components.headers.numberheader.NumberHeaderSchema; +import org.openapijsonschematools.client.components.headers.stringheader.StringHeaderSchema; +import org.openapijsonschematools.client.components.schemas.StringWithValidation; +import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags; +import org.openapijsonschematools.client.configurations.SchemaConfiguration; +import org.openapijsonschematools.client.exceptions.UnsetPropertyException; +import org.openapijsonschematools.client.exceptions.ValidationException; +import org.openapijsonschematools.client.schemas.AnyTypeJsonSchema; +import org.openapijsonschematools.client.schemas.GenericBuilder; +import org.openapijsonschematools.client.schemas.NotAnyTypeJsonSchema; +import org.openapijsonschematools.client.schemas.validation.FrozenMap; +import org.openapijsonschematools.client.schemas.validation.JsonSchema; +import org.openapijsonschematools.client.schemas.validation.JsonSchemaInfo; +import org.openapijsonschematools.client.schemas.validation.MapSchemaValidator; +import org.openapijsonschematools.client.schemas.validation.MapUtils; +import org.openapijsonschematools.client.schemas.validation.PathToSchemasMap; +import org.openapijsonschematools.client.schemas.validation.PropertyEntry; +import org.openapijsonschematools.client.schemas.validation.ValidationMetadata; + +public class SuccessWithJsonApiResponseHeadersSchema { + // nest classes so all schemas and input/output classes can be public + + + public static class SuccessWithJsonApiResponseAdditionalProperties extends NotAnyTypeJsonSchema.NotAnyTypeJsonSchema1 { + // NotAnyTypeSchema + private static @Nullable SuccessWithJsonApiResponseAdditionalProperties instance = null; + public static SuccessWithJsonApiResponseAdditionalProperties getInstance() { + if (instance == null) { + instance = new SuccessWithJsonApiResponseAdditionalProperties(); + } + return instance; + } + } + + + public static class SuccessWithJsonApiResponseHeadersSchemaMap extends FrozenMap<@Nullable Object> { + protected SuccessWithJsonApiResponseHeadersSchemaMap(FrozenMap<@Nullable Object> m) { + super(m); + } + public static final Set requiredKeys = Set.of( + "int32", + "ref-content-schema-header", + "ref-schema-header", + "stringHeader" + ); + public static final Set optionalKeys = Set.of( + "numberHeader" + ); + public static SuccessWithJsonApiResponseHeadersSchemaMap of(Map arg, SchemaConfiguration configuration) throws ValidationException { + return SuccessWithJsonApiResponseHeadersSchema1.getInstance().validate(arg, configuration); + } + + public Number int32() { + @Nullable Object value = get("int32"); + if (!(value instanceof Number)) { + throw new RuntimeException("Invalid value stored for int32"); + } + return (Number) value; + } + + public String stringHeader() { + @Nullable Object value = get("stringHeader"); + if (!(value instanceof String)) { + throw new RuntimeException("Invalid value stored for stringHeader"); + } + return (String) value; + } + + public String numberHeader() throws UnsetPropertyException { + String key = "numberHeader"; + throwIfKeyNotPresent(key); + @Nullable Object value = get(key); + if (!(value instanceof String)) { + throw new RuntimeException("Invalid value stored for numberHeader"); + } + return (String) value; + } + } + + public interface SetterForSuccessWithJsonApiResponseInt32 { + Map getInstance(); + T getBuilderAfterSuccessWithJsonApiResponseInt32(Map instance); + + default T int32(int value) { + var instance = getInstance(); + instance.put("int32", value); + return getBuilderAfterSuccessWithJsonApiResponseInt32(instance); + } + + default T int32(float value) { + var instance = getInstance(); + instance.put("int32", value); + return getBuilderAfterSuccessWithJsonApiResponseInt32(instance); + } + } + + public interface SetterForSuccessWithJsonApiResponseRefcontentschemaheader { + Map getInstance(); + T getBuilderAfterSuccessWithJsonApiResponseRefcontentschemaheader(Map instance); + + default T refHyphenMinusContentHyphenMinusSchemaHyphenMinusHeader(String value) { + var instance = getInstance(); + instance.put("ref-content-schema-header", value); + return getBuilderAfterSuccessWithJsonApiResponseRefcontentschemaheader(instance); + } + } + + public interface SetterForSuccessWithJsonApiResponseRefschemaheader { + Map getInstance(); + T getBuilderAfterSuccessWithJsonApiResponseRefschemaheader(Map instance); + + default T refHyphenMinusSchemaHyphenMinusHeader(String value) { + var instance = getInstance(); + instance.put("ref-schema-header", value); + return getBuilderAfterSuccessWithJsonApiResponseRefschemaheader(instance); + } + } + + public interface SetterForSuccessWithJsonApiResponseStringHeader { + Map getInstance(); + T getBuilderAfterSuccessWithJsonApiResponseStringHeader(Map instance); + + default T stringHeader(String value) { + var instance = getInstance(); + instance.put("stringHeader", value); + return getBuilderAfterSuccessWithJsonApiResponseStringHeader(instance); + } + } + + public interface SetterForSuccessWithJsonApiResponseNumberHeader { + Map getInstance(); + T getBuilderAfterSuccessWithJsonApiResponseNumberHeader(Map instance); + + default T numberHeader(String value) { + var instance = getInstance(); + instance.put("numberHeader", value); + return getBuilderAfterSuccessWithJsonApiResponseNumberHeader(instance); + } + } + + public static class SuccessWithJsonApiResponseHeadersSchemaMap0000Builder implements GenericBuilder>, SetterForSuccessWithJsonApiResponseNumberHeader { + private final Map instance; + private static final Set knownKeys = Set.of( + "int32", + "ref-content-schema-header", + "ref-schema-header", + "stringHeader", + "numberHeader" + ); + public Set getKnownKeys() { + return knownKeys; + } + public SuccessWithJsonApiResponseHeadersSchemaMap0000Builder(Map instance) { + this.instance = instance; + } + public Map build() { + return instance; + } + public Map getInstance() { + return instance; + } + public SuccessWithJsonApiResponseHeadersSchemaMap0000Builder getBuilderAfterSuccessWithJsonApiResponseNumberHeader(Map instance) { + return this; + } + } + + public static class SuccessWithJsonApiResponseHeadersSchemaMap0001Builder implements SetterForSuccessWithJsonApiResponseStringHeader { + private final Map instance; + public SuccessWithJsonApiResponseHeadersSchemaMap0001Builder(Map instance) { + this.instance = instance; + } + public Map getInstance() { + return instance; + } + public SuccessWithJsonApiResponseHeadersSchemaMap0000Builder getBuilderAfterSuccessWithJsonApiResponseStringHeader(Map instance) { + return new SuccessWithJsonApiResponseHeadersSchemaMap0000Builder(instance); + } + } + + public static class SuccessWithJsonApiResponseHeadersSchemaMap0010Builder implements SetterForSuccessWithJsonApiResponseRefschemaheader { + private final Map instance; + public SuccessWithJsonApiResponseHeadersSchemaMap0010Builder(Map instance) { + this.instance = instance; + } + public Map getInstance() { + return instance; + } + public SuccessWithJsonApiResponseHeadersSchemaMap0000Builder getBuilderAfterSuccessWithJsonApiResponseRefschemaheader(Map instance) { + return new SuccessWithJsonApiResponseHeadersSchemaMap0000Builder(instance); + } + } + + public static class SuccessWithJsonApiResponseHeadersSchemaMap0011Builder implements SetterForSuccessWithJsonApiResponseRefschemaheader, SetterForSuccessWithJsonApiResponseStringHeader { + private final Map instance; + public SuccessWithJsonApiResponseHeadersSchemaMap0011Builder(Map instance) { + this.instance = instance; + } + public Map getInstance() { + return instance; + } + public SuccessWithJsonApiResponseHeadersSchemaMap0001Builder getBuilderAfterSuccessWithJsonApiResponseRefschemaheader(Map instance) { + return new SuccessWithJsonApiResponseHeadersSchemaMap0001Builder(instance); + } + public SuccessWithJsonApiResponseHeadersSchemaMap0010Builder getBuilderAfterSuccessWithJsonApiResponseStringHeader(Map instance) { + return new SuccessWithJsonApiResponseHeadersSchemaMap0010Builder(instance); + } + } + + public static class SuccessWithJsonApiResponseHeadersSchemaMap0100Builder implements SetterForSuccessWithJsonApiResponseRefcontentschemaheader { + private final Map instance; + public SuccessWithJsonApiResponseHeadersSchemaMap0100Builder(Map instance) { + this.instance = instance; + } + public Map getInstance() { + return instance; + } + public SuccessWithJsonApiResponseHeadersSchemaMap0000Builder getBuilderAfterSuccessWithJsonApiResponseRefcontentschemaheader(Map instance) { + return new SuccessWithJsonApiResponseHeadersSchemaMap0000Builder(instance); + } + } + + public static class SuccessWithJsonApiResponseHeadersSchemaMap0101Builder implements SetterForSuccessWithJsonApiResponseRefcontentschemaheader, SetterForSuccessWithJsonApiResponseStringHeader { + private final Map instance; + public SuccessWithJsonApiResponseHeadersSchemaMap0101Builder(Map instance) { + this.instance = instance; + } + public Map getInstance() { + return instance; + } + public SuccessWithJsonApiResponseHeadersSchemaMap0001Builder getBuilderAfterSuccessWithJsonApiResponseRefcontentschemaheader(Map instance) { + return new SuccessWithJsonApiResponseHeadersSchemaMap0001Builder(instance); + } + public SuccessWithJsonApiResponseHeadersSchemaMap0100Builder getBuilderAfterSuccessWithJsonApiResponseStringHeader(Map instance) { + return new SuccessWithJsonApiResponseHeadersSchemaMap0100Builder(instance); + } + } + + public static class SuccessWithJsonApiResponseHeadersSchemaMap0110Builder implements SetterForSuccessWithJsonApiResponseRefcontentschemaheader, SetterForSuccessWithJsonApiResponseRefschemaheader { + private final Map instance; + public SuccessWithJsonApiResponseHeadersSchemaMap0110Builder(Map instance) { + this.instance = instance; + } + public Map getInstance() { + return instance; + } + public SuccessWithJsonApiResponseHeadersSchemaMap0010Builder getBuilderAfterSuccessWithJsonApiResponseRefcontentschemaheader(Map instance) { + return new SuccessWithJsonApiResponseHeadersSchemaMap0010Builder(instance); + } + public SuccessWithJsonApiResponseHeadersSchemaMap0100Builder getBuilderAfterSuccessWithJsonApiResponseRefschemaheader(Map instance) { + return new SuccessWithJsonApiResponseHeadersSchemaMap0100Builder(instance); + } + } + + public static class SuccessWithJsonApiResponseHeadersSchemaMap0111Builder implements SetterForSuccessWithJsonApiResponseRefcontentschemaheader, SetterForSuccessWithJsonApiResponseRefschemaheader, SetterForSuccessWithJsonApiResponseStringHeader { + private final Map instance; + public SuccessWithJsonApiResponseHeadersSchemaMap0111Builder(Map instance) { + this.instance = instance; + } + public Map getInstance() { + return instance; + } + public SuccessWithJsonApiResponseHeadersSchemaMap0011Builder getBuilderAfterSuccessWithJsonApiResponseRefcontentschemaheader(Map instance) { + return new SuccessWithJsonApiResponseHeadersSchemaMap0011Builder(instance); + } + public SuccessWithJsonApiResponseHeadersSchemaMap0101Builder getBuilderAfterSuccessWithJsonApiResponseRefschemaheader(Map instance) { + return new SuccessWithJsonApiResponseHeadersSchemaMap0101Builder(instance); + } + public SuccessWithJsonApiResponseHeadersSchemaMap0110Builder getBuilderAfterSuccessWithJsonApiResponseStringHeader(Map instance) { + return new SuccessWithJsonApiResponseHeadersSchemaMap0110Builder(instance); + } + } + + public static class SuccessWithJsonApiResponseHeadersSchemaMap1000Builder implements SetterForSuccessWithJsonApiResponseInt32 { + private final Map instance; + public SuccessWithJsonApiResponseHeadersSchemaMap1000Builder(Map instance) { + this.instance = instance; + } + public Map getInstance() { + return instance; + } + public SuccessWithJsonApiResponseHeadersSchemaMap0000Builder getBuilderAfterSuccessWithJsonApiResponseInt32(Map instance) { + return new SuccessWithJsonApiResponseHeadersSchemaMap0000Builder(instance); + } + } + + public static class SuccessWithJsonApiResponseHeadersSchemaMap1001Builder implements SetterForSuccessWithJsonApiResponseInt32, SetterForSuccessWithJsonApiResponseStringHeader { + private final Map instance; + public SuccessWithJsonApiResponseHeadersSchemaMap1001Builder(Map instance) { + this.instance = instance; + } + public Map getInstance() { + return instance; + } + public SuccessWithJsonApiResponseHeadersSchemaMap0001Builder getBuilderAfterSuccessWithJsonApiResponseInt32(Map instance) { + return new SuccessWithJsonApiResponseHeadersSchemaMap0001Builder(instance); + } + public SuccessWithJsonApiResponseHeadersSchemaMap1000Builder getBuilderAfterSuccessWithJsonApiResponseStringHeader(Map instance) { + return new SuccessWithJsonApiResponseHeadersSchemaMap1000Builder(instance); + } + } + + public static class SuccessWithJsonApiResponseHeadersSchemaMap1010Builder implements SetterForSuccessWithJsonApiResponseInt32, SetterForSuccessWithJsonApiResponseRefschemaheader { + private final Map instance; + public SuccessWithJsonApiResponseHeadersSchemaMap1010Builder(Map instance) { + this.instance = instance; + } + public Map getInstance() { + return instance; + } + public SuccessWithJsonApiResponseHeadersSchemaMap0010Builder getBuilderAfterSuccessWithJsonApiResponseInt32(Map instance) { + return new SuccessWithJsonApiResponseHeadersSchemaMap0010Builder(instance); + } + public SuccessWithJsonApiResponseHeadersSchemaMap1000Builder getBuilderAfterSuccessWithJsonApiResponseRefschemaheader(Map instance) { + return new SuccessWithJsonApiResponseHeadersSchemaMap1000Builder(instance); + } + } + + public static class SuccessWithJsonApiResponseHeadersSchemaMap1011Builder implements SetterForSuccessWithJsonApiResponseInt32, SetterForSuccessWithJsonApiResponseRefschemaheader, SetterForSuccessWithJsonApiResponseStringHeader { + private final Map instance; + public SuccessWithJsonApiResponseHeadersSchemaMap1011Builder(Map instance) { + this.instance = instance; + } + public Map getInstance() { + return instance; + } + public SuccessWithJsonApiResponseHeadersSchemaMap0011Builder getBuilderAfterSuccessWithJsonApiResponseInt32(Map instance) { + return new SuccessWithJsonApiResponseHeadersSchemaMap0011Builder(instance); + } + public SuccessWithJsonApiResponseHeadersSchemaMap1001Builder getBuilderAfterSuccessWithJsonApiResponseRefschemaheader(Map instance) { + return new SuccessWithJsonApiResponseHeadersSchemaMap1001Builder(instance); + } + public SuccessWithJsonApiResponseHeadersSchemaMap1010Builder getBuilderAfterSuccessWithJsonApiResponseStringHeader(Map instance) { + return new SuccessWithJsonApiResponseHeadersSchemaMap1010Builder(instance); + } + } + + public static class SuccessWithJsonApiResponseHeadersSchemaMap1100Builder implements SetterForSuccessWithJsonApiResponseInt32, SetterForSuccessWithJsonApiResponseRefcontentschemaheader { + private final Map instance; + public SuccessWithJsonApiResponseHeadersSchemaMap1100Builder(Map instance) { + this.instance = instance; + } + public Map getInstance() { + return instance; + } + public SuccessWithJsonApiResponseHeadersSchemaMap0100Builder getBuilderAfterSuccessWithJsonApiResponseInt32(Map instance) { + return new SuccessWithJsonApiResponseHeadersSchemaMap0100Builder(instance); + } + public SuccessWithJsonApiResponseHeadersSchemaMap1000Builder getBuilderAfterSuccessWithJsonApiResponseRefcontentschemaheader(Map instance) { + return new SuccessWithJsonApiResponseHeadersSchemaMap1000Builder(instance); + } + } + + public static class SuccessWithJsonApiResponseHeadersSchemaMap1101Builder implements SetterForSuccessWithJsonApiResponseInt32, SetterForSuccessWithJsonApiResponseRefcontentschemaheader, SetterForSuccessWithJsonApiResponseStringHeader { + private final Map instance; + public SuccessWithJsonApiResponseHeadersSchemaMap1101Builder(Map instance) { + this.instance = instance; + } + public Map getInstance() { + return instance; + } + public SuccessWithJsonApiResponseHeadersSchemaMap0101Builder getBuilderAfterSuccessWithJsonApiResponseInt32(Map instance) { + return new SuccessWithJsonApiResponseHeadersSchemaMap0101Builder(instance); + } + public SuccessWithJsonApiResponseHeadersSchemaMap1001Builder getBuilderAfterSuccessWithJsonApiResponseRefcontentschemaheader(Map instance) { + return new SuccessWithJsonApiResponseHeadersSchemaMap1001Builder(instance); + } + public SuccessWithJsonApiResponseHeadersSchemaMap1100Builder getBuilderAfterSuccessWithJsonApiResponseStringHeader(Map instance) { + return new SuccessWithJsonApiResponseHeadersSchemaMap1100Builder(instance); + } + } + + public static class SuccessWithJsonApiResponseHeadersSchemaMap1110Builder implements SetterForSuccessWithJsonApiResponseInt32, SetterForSuccessWithJsonApiResponseRefcontentschemaheader, SetterForSuccessWithJsonApiResponseRefschemaheader { + private final Map instance; + public SuccessWithJsonApiResponseHeadersSchemaMap1110Builder(Map instance) { + this.instance = instance; + } + public Map getInstance() { + return instance; + } + public SuccessWithJsonApiResponseHeadersSchemaMap0110Builder getBuilderAfterSuccessWithJsonApiResponseInt32(Map instance) { + return new SuccessWithJsonApiResponseHeadersSchemaMap0110Builder(instance); + } + public SuccessWithJsonApiResponseHeadersSchemaMap1010Builder getBuilderAfterSuccessWithJsonApiResponseRefcontentschemaheader(Map instance) { + return new SuccessWithJsonApiResponseHeadersSchemaMap1010Builder(instance); + } + public SuccessWithJsonApiResponseHeadersSchemaMap1100Builder getBuilderAfterSuccessWithJsonApiResponseRefschemaheader(Map instance) { + return new SuccessWithJsonApiResponseHeadersSchemaMap1100Builder(instance); + } + } + + public static class SuccessWithJsonApiResponseHeadersSchemaMapBuilder implements SetterForSuccessWithJsonApiResponseInt32, SetterForSuccessWithJsonApiResponseRefcontentschemaheader, SetterForSuccessWithJsonApiResponseRefschemaheader, SetterForSuccessWithJsonApiResponseStringHeader { + private final Map instance; + public SuccessWithJsonApiResponseHeadersSchemaMapBuilder() { + this.instance = new LinkedHashMap<>(); + } + public Map getInstance() { + return instance; + } + public SuccessWithJsonApiResponseHeadersSchemaMap0111Builder getBuilderAfterSuccessWithJsonApiResponseInt32(Map instance) { + return new SuccessWithJsonApiResponseHeadersSchemaMap0111Builder(instance); + } + public SuccessWithJsonApiResponseHeadersSchemaMap1011Builder getBuilderAfterSuccessWithJsonApiResponseRefcontentschemaheader(Map instance) { + return new SuccessWithJsonApiResponseHeadersSchemaMap1011Builder(instance); + } + public SuccessWithJsonApiResponseHeadersSchemaMap1101Builder getBuilderAfterSuccessWithJsonApiResponseRefschemaheader(Map instance) { + return new SuccessWithJsonApiResponseHeadersSchemaMap1101Builder(instance); + } + public SuccessWithJsonApiResponseHeadersSchemaMap1110Builder getBuilderAfterSuccessWithJsonApiResponseStringHeader(Map instance) { + return new SuccessWithJsonApiResponseHeadersSchemaMap1110Builder(instance); + } + } + + + public sealed interface SuccessWithJsonApiResponseHeadersSchema1Boxed permits SuccessWithJsonApiResponseHeadersSchema1BoxedMap { + @Nullable Object getData(); + } + + public record SuccessWithJsonApiResponseHeadersSchema1BoxedMap(SuccessWithJsonApiResponseHeadersSchemaMap data) implements SuccessWithJsonApiResponseHeadersSchema1Boxed { + @Override + public @Nullable Object getData() { + return data; + } + } + + + public static class SuccessWithJsonApiResponseHeadersSchema1 extends JsonSchema implements MapSchemaValidator { + private static @Nullable SuccessWithJsonApiResponseHeadersSchema1 instance = null; + + protected SuccessWithJsonApiResponseHeadersSchema1() { + super(new JsonSchemaInfo() + .type(Set.of(Map.class)) + .properties(Map.ofEntries( + new PropertyEntry("ref-schema-header", StringWithValidation.StringWithValidation1.class), + new PropertyEntry("int32", Int32JsonContentTypeHeaderSchema.Int32JsonContentTypeHeaderSchema1.class), + new PropertyEntry("ref-content-schema-header", StringWithValidation.StringWithValidation1.class), + new PropertyEntry("stringHeader", StringHeaderSchema.StringHeaderSchema1.class), + new PropertyEntry("numberHeader", NumberHeaderSchema.NumberHeaderSchema1.class) + )) + .required(Set.of( + "int32", + "ref-content-schema-header", + "ref-schema-header", + "stringHeader" + )) + .additionalProperties(SuccessWithJsonApiResponseAdditionalProperties.class) + ); + } + + public static SuccessWithJsonApiResponseHeadersSchema1 getInstance() { + if (instance == null) { + instance = new SuccessWithJsonApiResponseHeadersSchema1(); + } + return instance; + } + + 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 RuntimeException("Invalid non-string key value"); + } + String propertyName = (String) entryKey; + List propertyPathToItem = new ArrayList<>(pathToItem); + propertyPathToItem.add(propertyName); + Object value = entry.getValue(); + LinkedHashMap, Nothing?> schemas = pathToSchemas.get(propertyPathToItem); + if (schemas == null) { + throw new RuntimeException("Validation result is invalid, schemas must exist for a pathToItem"); + } + JsonSchema propertySchema = schemas.entrySet().iterator().next().getKey(); + @Nullable Object propertyInstance = propertySchema.getNewInstance(value, propertyPathToItem, pathToSchemas); + properties.put(propertyName, propertyInstance); + } + FrozenMap<@Nullable Object> castProperties = new FrozenMap<>(properties); + return new SuccessWithJsonApiResponseHeadersSchemaMap(castProperties); + } + + 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); + SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().build())); + ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, new PathToSchemasMap(), new LinkedHashSet<>()); + PathToSchemasMap pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet); + return getNewInstance(castArg, validationMetadata.pathToItem(), pathToSchemasMap); + } + + + @Override + public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws 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"); + } + @Override + public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { + if (arg instanceof Map) { + return getNewInstance((Map) arg, pathToItem, pathToSchemas); + } + 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 { + return new SuccessWithJsonApiResponseHeadersSchema1BoxedMap(validate(arg, configuration)); + } + @Override + public SuccessWithJsonApiResponseHeadersSchema1Boxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { + 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"); + } + } + +} diff --git a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/responses/successwithjsonapiresponse/content/applicationjson/ApplicationjsonSchema.kt b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/responses/successwithjsonapiresponse/content/applicationjson/ApplicationjsonSchema.kt new file mode 100644 index 00000000000..b8f8b6efa4a --- /dev/null +++ b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/responses/successwithjsonapiresponse/content/applicationjson/ApplicationjsonSchema.kt @@ -0,0 +1,19 @@ +package org.openapijsonschematools.client.components.responses.successwithjsonapiresponse.content.applicationjson; + +import org.checkerframework.checker.nullness.qual.Nullable; +import org.openapijsonschematools.client.components.schemas.ApiResponseSchema; + +public class ApplicationjsonSchema extends ApiResponseSchema { + // $refed class + + + public static class ApplicationjsonSchema1 extends ApiResponseSchema1 { + private static @Nullable ApplicationjsonSchema1 instance = null; + public static ApplicationjsonSchema1 getInstance() { + if (instance == null) { + instance = new ApplicationjsonSchema1(); + } + return instance; + } + } +} diff --git a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/responses/successwithjsonapiresponse/headers/Int32.kt b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/responses/successwithjsonapiresponse/headers/Int32.kt new file mode 100644 index 00000000000..335c486ac51 --- /dev/null +++ b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/responses/successwithjsonapiresponse/headers/Int32.kt @@ -0,0 +1,7 @@ +package org.openapijsonschematools.client.components.responses.successwithjsonapiresponse.headers; + +import org.openapijsonschematools.client.components.headers.Int32JsonContentTypeHeader; + +public class Int32 extends Int32JsonContentTypeHeader { + public static class Int321 extends Int32JsonContentTypeHeader1 {} +} diff --git a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/responses/successwithjsonapiresponse/headers/NumberHeader.kt b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/responses/successwithjsonapiresponse/headers/NumberHeader.kt new file mode 100644 index 00000000000..0fd5232f8d9 --- /dev/null +++ b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/responses/successwithjsonapiresponse/headers/NumberHeader.kt @@ -0,0 +1,3 @@ +package org.openapijsonschematools.client.components.responses.successwithjsonapiresponse.headers; + +public class NumberHeader extends org.openapijsonschematools.client.components.headers.NumberHeader {} diff --git a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/responses/successwithjsonapiresponse/headers/Refcontentschemaheader.kt b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/responses/successwithjsonapiresponse/headers/Refcontentschemaheader.kt new file mode 100644 index 00000000000..4f5df9abe04 --- /dev/null +++ b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/responses/successwithjsonapiresponse/headers/Refcontentschemaheader.kt @@ -0,0 +1,7 @@ +package org.openapijsonschematools.client.components.responses.successwithjsonapiresponse.headers; + +import org.openapijsonschematools.client.components.headers.RefContentSchemaHeader; + +public class Refcontentschemaheader extends RefContentSchemaHeader { + public static class Refcontentschemaheader1 extends RefContentSchemaHeader1 {} +} diff --git a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/responses/successwithjsonapiresponse/headers/Refschemaheader.kt b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/responses/successwithjsonapiresponse/headers/Refschemaheader.kt new file mode 100644 index 00000000000..ab531e35e1f --- /dev/null +++ b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/responses/successwithjsonapiresponse/headers/Refschemaheader.kt @@ -0,0 +1,7 @@ +package org.openapijsonschematools.client.components.responses.successwithjsonapiresponse.headers; + +import org.openapijsonschematools.client.components.headers.RefSchemaHeader; + +public class Refschemaheader extends RefSchemaHeader { + public static class Refschemaheader1 extends RefSchemaHeader1 {} +} diff --git a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/responses/successwithjsonapiresponse/headers/StringHeader.kt b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/responses/successwithjsonapiresponse/headers/StringHeader.kt new file mode 100644 index 00000000000..339328f5b28 --- /dev/null +++ b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/responses/successwithjsonapiresponse/headers/StringHeader.kt @@ -0,0 +1,7 @@ +package org.openapijsonschematools.client.components.responses.successwithjsonapiresponse.headers; + +import org.openapijsonschematools.client.components.headers.RefStringHeader; + +public class StringHeader extends RefStringHeader { + public static class StringHeader1 extends RefStringHeader1 {} +} diff --git a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/schemas/AbstractStepMessage.kt b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/schemas/AbstractStepMessage.kt new file mode 100644 index 00000000000..3a8efe21ea9 --- /dev/null +++ b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/schemas/AbstractStepMessage.kt @@ -0,0 +1,455 @@ +package org.openapijsonschematools.client.components.schemas; +import java.util.ArrayList; +import java.util.HashSet; +import java.util.LinkedHashMap; +import java.util.LinkedHashSet; +import java.util.List; +import java.util.Map; +import java.util.Objects; +import java.util.Set; +import org.checkerframework.checker.nullness.qual.Nullable; +import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags; +import org.openapijsonschematools.client.configurations.SchemaConfiguration; +import org.openapijsonschematools.client.exceptions.InvalidAdditionalPropertyException; +import org.openapijsonschematools.client.exceptions.UnsetPropertyException; +import org.openapijsonschematools.client.exceptions.ValidationException; +import org.openapijsonschematools.client.schemas.GenericBuilder; +import org.openapijsonschematools.client.schemas.StringJsonSchema; +import org.openapijsonschematools.client.schemas.UnsetAddPropsSetter; +import org.openapijsonschematools.client.schemas.validation.FrozenMap; +import org.openapijsonschematools.client.schemas.validation.JsonSchema; +import org.openapijsonschematools.client.schemas.validation.JsonSchemaInfo; +import org.openapijsonschematools.client.schemas.validation.MapSchemaValidator; +import org.openapijsonschematools.client.schemas.validation.PathToSchemasMap; +import org.openapijsonschematools.client.schemas.validation.PropertyEntry; +import org.openapijsonschematools.client.schemas.validation.ValidationMetadata; + +public class AbstractStepMessage { + // nest classes so all schemas and input/output classes can be public + + + public static class Discriminator extends StringJsonSchema.StringJsonSchema1 { + private static @Nullable Discriminator instance = null; + public static Discriminator getInstance() { + if (instance == null) { + instance = new Discriminator(); + } + return instance; + } + } + + + public static class AbstractStepMessageMap extends FrozenMap<@Nullable Object> { + protected AbstractStepMessageMap(FrozenMap<@Nullable Object> m) { + super(m); + } + public static final Set requiredKeys = Set.of( + "description", + "discriminator", + "sequenceNumber" + ); + public static final Set optionalKeys = Set.of(); + public static AbstractStepMessageMap of(Map arg, SchemaConfiguration configuration) throws ValidationException { + return AbstractStepMessage1.getInstance().validate(arg, configuration); + } + + public @Nullable Object 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 RuntimeException("Invalid value stored for discriminator"); + } + return (String) value; + } + + public @Nullable Object sequenceNumber() { + try { + return getOrThrow("version"); + } catch (UnsetPropertyException e) { + throw new RuntimeException(e); + } + } + + public @Nullable Object getAdditionalProperty(String name) throws UnsetPropertyException, InvalidAdditionalPropertyException { + throwIfKeyKnown(name, requiredKeys, optionalKeys); + throwIfKeyNotPresent(name); + return get(name); + } + } + + public interface SetterForDescription { + Map getInstance(); + T getBuilderAfterDescription(Map instance); + + default T description(Nothing? value) { + var instance = getInstance(); + instance.put("description", null); + return getBuilderAfterDescription(instance); + } + + default T description(boolean value) { + var instance = getInstance(); + instance.put("description", value); + return getBuilderAfterDescription(instance); + } + + default T description(String value) { + var instance = getInstance(); + instance.put("description", value); + return getBuilderAfterDescription(instance); + } + + default T description(int value) { + var instance = getInstance(); + instance.put("description", value); + return getBuilderAfterDescription(instance); + } + + default T description(float value) { + var instance = getInstance(); + instance.put("description", value); + return getBuilderAfterDescription(instance); + } + + default T description(long value) { + var instance = getInstance(); + instance.put("description", value); + return getBuilderAfterDescription(instance); + } + + default T description(double value) { + var instance = getInstance(); + instance.put("description", value); + return getBuilderAfterDescription(instance); + } + + default T description(List value) { + var instance = getInstance(); + instance.put("description", value); + return getBuilderAfterDescription(instance); + } + + default T description(Map value) { + var instance = getInstance(); + instance.put("description", value); + return getBuilderAfterDescription(instance); + } + } + + public interface SetterForDiscriminator { + Map getInstance(); + T getBuilderAfterDiscriminator(Map instance); + + default T discriminator(String value) { + var instance = getInstance(); + instance.put("discriminator", value); + return getBuilderAfterDiscriminator(instance); + } + } + + public interface SetterForSequenceNumber { + Map getInstance(); + T getBuilderAfterSequenceNumber(Map instance); + + default T sequenceNumber(Nothing? value) { + var instance = getInstance(); + instance.put("sequenceNumber", null); + return getBuilderAfterSequenceNumber(instance); + } + + default T sequenceNumber(boolean value) { + var instance = getInstance(); + instance.put("sequenceNumber", value); + return getBuilderAfterSequenceNumber(instance); + } + + default T sequenceNumber(String value) { + var instance = getInstance(); + instance.put("sequenceNumber", value); + return getBuilderAfterSequenceNumber(instance); + } + + default T sequenceNumber(int value) { + var instance = getInstance(); + instance.put("sequenceNumber", value); + return getBuilderAfterSequenceNumber(instance); + } + + default T sequenceNumber(float value) { + var instance = getInstance(); + instance.put("sequenceNumber", value); + return getBuilderAfterSequenceNumber(instance); + } + + default T sequenceNumber(long value) { + var instance = getInstance(); + instance.put("sequenceNumber", value); + return getBuilderAfterSequenceNumber(instance); + } + + default T sequenceNumber(double value) { + var instance = getInstance(); + instance.put("sequenceNumber", value); + return getBuilderAfterSequenceNumber(instance); + } + + default T sequenceNumber(List value) { + var instance = getInstance(); + instance.put("sequenceNumber", value); + return getBuilderAfterSequenceNumber(instance); + } + + default T sequenceNumber(Map value) { + var instance = getInstance(); + instance.put("sequenceNumber", value); + return getBuilderAfterSequenceNumber(instance); + } + } + + public static class AbstractStepMessageMap000Builder extends UnsetAddPropsSetter implements GenericBuilder> { + private final Map instance; + private static final Set knownKeys = Set.of( + "description", + "discriminator", + "sequenceNumber" + ); + public Set getKnownKeys() { + return knownKeys; + } + public AbstractStepMessageMap000Builder(Map instance) { + this.instance = instance; + } + public Map build() { + return instance; + } + public Map getInstance() { + return instance; + } + public AbstractStepMessageMap000Builder getBuilderAfterAdditionalProperty(Map instance) { + return this; + } + } + + public static class AbstractStepMessageMap001Builder implements SetterForSequenceNumber { + private final Map instance; + public AbstractStepMessageMap001Builder(Map instance) { + this.instance = instance; + } + public Map getInstance() { + return instance; + } + public AbstractStepMessageMap000Builder getBuilderAfterSequenceNumber(Map instance) { + return new AbstractStepMessageMap000Builder(instance); + } + } + + public static class AbstractStepMessageMap010Builder implements SetterForDiscriminator { + private final Map instance; + public AbstractStepMessageMap010Builder(Map instance) { + this.instance = instance; + } + public Map getInstance() { + return instance; + } + public AbstractStepMessageMap000Builder getBuilderAfterDiscriminator(Map instance) { + return new AbstractStepMessageMap000Builder(instance); + } + } + + public static class AbstractStepMessageMap011Builder implements SetterForDiscriminator, SetterForSequenceNumber { + private final Map instance; + public AbstractStepMessageMap011Builder(Map instance) { + this.instance = instance; + } + public Map getInstance() { + return instance; + } + public AbstractStepMessageMap001Builder getBuilderAfterDiscriminator(Map instance) { + return new AbstractStepMessageMap001Builder(instance); + } + public AbstractStepMessageMap010Builder getBuilderAfterSequenceNumber(Map instance) { + return new AbstractStepMessageMap010Builder(instance); + } + } + + public static class AbstractStepMessageMap100Builder implements SetterForDescription { + private final Map instance; + public AbstractStepMessageMap100Builder(Map instance) { + this.instance = instance; + } + public Map getInstance() { + return instance; + } + public AbstractStepMessageMap000Builder getBuilderAfterDescription(Map instance) { + return new AbstractStepMessageMap000Builder(instance); + } + } + + public static class AbstractStepMessageMap101Builder implements SetterForDescription, SetterForSequenceNumber { + private final Map instance; + public AbstractStepMessageMap101Builder(Map instance) { + this.instance = instance; + } + public Map getInstance() { + return instance; + } + public AbstractStepMessageMap001Builder getBuilderAfterDescription(Map instance) { + return new AbstractStepMessageMap001Builder(instance); + } + public AbstractStepMessageMap100Builder getBuilderAfterSequenceNumber(Map instance) { + return new AbstractStepMessageMap100Builder(instance); + } + } + + public static class AbstractStepMessageMap110Builder implements SetterForDescription, SetterForDiscriminator { + private final Map instance; + public AbstractStepMessageMap110Builder(Map instance) { + this.instance = instance; + } + public Map getInstance() { + return instance; + } + public AbstractStepMessageMap010Builder getBuilderAfterDescription(Map instance) { + return new AbstractStepMessageMap010Builder(instance); + } + public AbstractStepMessageMap100Builder getBuilderAfterDiscriminator(Map instance) { + return new AbstractStepMessageMap100Builder(instance); + } + } + + public static class AbstractStepMessageMapBuilder implements SetterForDescription, SetterForDiscriminator, SetterForSequenceNumber { + private final Map instance; + public AbstractStepMessageMapBuilder() { + this.instance = new LinkedHashMap<>(); + } + public Map getInstance() { + return instance; + } + public AbstractStepMessageMap011Builder getBuilderAfterDescription(Map instance) { + return new AbstractStepMessageMap011Builder(instance); + } + public AbstractStepMessageMap101Builder getBuilderAfterDiscriminator(Map instance) { + return new AbstractStepMessageMap101Builder(instance); + } + public AbstractStepMessageMap110Builder getBuilderAfterSequenceNumber(Map instance) { + return new AbstractStepMessageMap110Builder(instance); + } + } + + + public sealed interface AbstractStepMessage1Boxed permits AbstractStepMessage1BoxedMap { + @Nullable Object getData(); + } + + public record AbstractStepMessage1BoxedMap(AbstractStepMessageMap data) implements AbstractStepMessage1Boxed { + @Override + public @Nullable Object getData() { + return data; + } + } + + + public static class AbstractStepMessage1 extends JsonSchema implements MapSchemaValidator { + /* + NOTE: This class is auto generated by OpenAPI JSON Schema Generator. + Ref: https://github.com/openapi-json-schema-tools/openapi-json-schema-generator + + Do not edit the class manually. + + Abstract Step + */ + private static @Nullable AbstractStepMessage1 instance = null; + + protected AbstractStepMessage1() { + super(new JsonSchemaInfo() + .type(Set.of(Map.class)) + .properties(Map.ofEntries( + new PropertyEntry("discriminator", Discriminator.class) + )) + .required(Set.of( + "description", + "discriminator", + "sequenceNumber" + )) + .anyOf(List.of( + AbstractStepMessage1.class + )) + ); + } + + public static AbstractStepMessage1 getInstance() { + if (instance == null) { + instance = new AbstractStepMessage1(); + } + return instance; + } + + 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 RuntimeException("Invalid non-string key value"); + } + String propertyName = (String) entryKey; + List propertyPathToItem = new ArrayList<>(pathToItem); + propertyPathToItem.add(propertyName); + Object value = entry.getValue(); + LinkedHashMap, Nothing?> schemas = pathToSchemas.get(propertyPathToItem); + if (schemas == null) { + throw new RuntimeException("Validation result is invalid, schemas must exist for a pathToItem"); + } + JsonSchema propertySchema = schemas.entrySet().iterator().next().getKey(); + @Nullable Object propertyInstance = propertySchema.getNewInstance(value, propertyPathToItem, pathToSchemas); + properties.put(propertyName, propertyInstance); + } + FrozenMap<@Nullable Object> castProperties = new FrozenMap<>(properties); + return new AbstractStepMessageMap(castProperties); + } + + 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); + SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().build())); + ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, new PathToSchemasMap(), new LinkedHashSet<>()); + PathToSchemasMap pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet); + return getNewInstance(castArg, validationMetadata.pathToItem(), pathToSchemasMap); + } + + + @Override + public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws 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"); + } + @Override + public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { + if (arg instanceof Map) { + return getNewInstance((Map) arg, pathToItem, pathToSchemas); + } + 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 { + return new AbstractStepMessage1BoxedMap(validate(arg, configuration)); + } + @Override + public AbstractStepMessage1Boxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { + 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"); + } + } + +} diff --git a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/schemas/AdditionalPropertiesClass.kt b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/schemas/AdditionalPropertiesClass.kt new file mode 100644 index 00000000000..3b28278419b --- /dev/null +++ b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/schemas/AdditionalPropertiesClass.kt @@ -0,0 +1,1405 @@ +package org.openapijsonschematools.client.components.schemas; +import java.util.ArrayList; +import java.util.HashSet; +import java.util.LinkedHashMap; +import java.util.LinkedHashSet; +import java.util.List; +import java.util.Map; +import java.util.Objects; +import java.util.Set; +import org.checkerframework.checker.nullness.qual.Nullable; +import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags; +import org.openapijsonschematools.client.configurations.SchemaConfiguration; +import org.openapijsonschematools.client.exceptions.InvalidAdditionalPropertyException; +import org.openapijsonschematools.client.exceptions.UnsetPropertyException; +import org.openapijsonschematools.client.exceptions.ValidationException; +import org.openapijsonschematools.client.schemas.AnyTypeJsonSchema; +import org.openapijsonschematools.client.schemas.GenericBuilder; +import org.openapijsonschematools.client.schemas.MapJsonSchema; +import org.openapijsonschematools.client.schemas.NotAnyTypeJsonSchema; +import org.openapijsonschematools.client.schemas.StringJsonSchema; +import org.openapijsonschematools.client.schemas.UnsetAddPropsSetter; +import org.openapijsonschematools.client.schemas.validation.FrozenMap; +import org.openapijsonschematools.client.schemas.validation.JsonSchema; +import org.openapijsonschematools.client.schemas.validation.JsonSchemaInfo; +import org.openapijsonschematools.client.schemas.validation.MapSchemaValidator; +import org.openapijsonschematools.client.schemas.validation.MapUtils; +import org.openapijsonschematools.client.schemas.validation.PathToSchemasMap; +import org.openapijsonschematools.client.schemas.validation.PropertyEntry; +import org.openapijsonschematools.client.schemas.validation.ValidationMetadata; + +public class AdditionalPropertiesClass { + // nest classes so all schemas and input/output classes can be public + + + public static class AdditionalProperties extends StringJsonSchema.StringJsonSchema1 { + private static @Nullable AdditionalProperties instance = null; + public static AdditionalProperties getInstance() { + if (instance == null) { + instance = new AdditionalProperties(); + } + return instance; + } + } + + + public static class MapPropertyMap extends FrozenMap { + protected MapPropertyMap(FrozenMap m) { + super(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 { + return MapProperty.getInstance().validate(arg, configuration); + } + + public String getAdditionalProperty(String name) throws UnsetPropertyException { + return getOrThrow(name); + } + } + + public interface SetterForAdditionalProperties { + Set getKnownKeys(); + Map getInstance(); + T getBuilderAfterAdditionalProperty(Map instance); + + default T additionalProperty(String key, String value) throws InvalidAdditionalPropertyException { + MapUtils.throwIfKeyKnown(key, getKnownKeys(), true); + var instance = getInstance(); + instance.put(key, value); + return getBuilderAfterAdditionalProperty(instance); + } + } + + public static class MapPropertyMapBuilder implements GenericBuilder>, SetterForAdditionalProperties { + private final Map instance; + private static final Set knownKeys = Set.of(); + public Set getKnownKeys() { + return knownKeys; + } + public MapPropertyMapBuilder() { + this.instance = new LinkedHashMap<>(); + } + public Map build() { + return instance; + } + public Map getInstance() { + return instance; + } + public MapPropertyMapBuilder getBuilderAfterAdditionalProperty(Map instance) { + return this; + } + } + + + public sealed interface MapPropertyBoxed permits MapPropertyBoxedMap { + @Nullable Object getData(); + } + + public record MapPropertyBoxedMap(MapPropertyMap data) implements MapPropertyBoxed { + @Override + public @Nullable Object getData() { + return data; + } + } + + + public static class MapProperty extends JsonSchema implements MapSchemaValidator { + private static @Nullable MapProperty instance = null; + + protected MapProperty() { + super(new JsonSchemaInfo() + .type(Set.of(Map.class)) + .additionalProperties(AdditionalProperties.class) + ); + } + + public static MapProperty getInstance() { + if (instance == null) { + instance = new MapProperty(); + } + return instance; + } + + 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 RuntimeException("Invalid non-string key value"); + } + String propertyName = (String) entryKey; + List propertyPathToItem = new ArrayList<>(pathToItem); + propertyPathToItem.add(propertyName); + Object value = entry.getValue(); + LinkedHashMap, Nothing?> schemas = pathToSchemas.get(propertyPathToItem); + if (schemas == null) { + throw new RuntimeException("Validation 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"); + } + properties.put(propertyName, (String) propertyInstance); + } + FrozenMap castProperties = new FrozenMap<>(properties); + return new MapPropertyMap(castProperties); + } + + 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); + SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().build())); + ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, new PathToSchemasMap(), new LinkedHashSet<>()); + PathToSchemasMap pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet); + return getNewInstance(castArg, validationMetadata.pathToItem(), pathToSchemasMap); + } + + + @Override + public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws 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"); + } + @Override + public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { + if (arg instanceof Map) { + return getNewInstance((Map) arg, pathToItem, pathToSchemas); + } + 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 { + return new MapPropertyBoxedMap(validate(arg, configuration)); + } + @Override + public MapPropertyBoxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { + 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"); + } + } + + + public static class AdditionalProperties2 extends StringJsonSchema.StringJsonSchema1 { + private static @Nullable AdditionalProperties2 instance = null; + public static AdditionalProperties2 getInstance() { + if (instance == null) { + instance = new AdditionalProperties2(); + } + return instance; + } + } + + + public static class AdditionalPropertiesMap extends FrozenMap { + protected AdditionalPropertiesMap(FrozenMap m) { + super(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 { + return AdditionalProperties1.getInstance().validate(arg, configuration); + } + + public String getAdditionalProperty(String name) throws UnsetPropertyException { + return getOrThrow(name); + } + } + + public interface SetterForAdditionalProperties2 { + Set getKnownKeys(); + Map getInstance(); + T getBuilderAfterAdditionalProperty(Map instance); + + default T additionalProperty(String key, String value) throws InvalidAdditionalPropertyException { + MapUtils.throwIfKeyKnown(key, getKnownKeys(), true); + var instance = getInstance(); + instance.put(key, value); + return getBuilderAfterAdditionalProperty(instance); + } + } + + public static class AdditionalPropertiesMapBuilder2 implements GenericBuilder>, SetterForAdditionalProperties2 { + private final Map instance; + private static final Set knownKeys = Set.of(); + public Set getKnownKeys() { + return knownKeys; + } + public AdditionalPropertiesMapBuilder2() { + this.instance = new LinkedHashMap<>(); + } + public Map build() { + return instance; + } + public Map getInstance() { + return instance; + } + public AdditionalPropertiesMapBuilder2 getBuilderAfterAdditionalProperty(Map instance) { + return this; + } + } + + + public sealed interface AdditionalProperties1Boxed permits AdditionalProperties1BoxedMap { + @Nullable Object getData(); + } + + public record AdditionalProperties1BoxedMap(AdditionalPropertiesMap data) implements AdditionalProperties1Boxed { + @Override + public @Nullable Object getData() { + return data; + } + } + + + public static class AdditionalProperties1 extends JsonSchema implements MapSchemaValidator { + private static @Nullable AdditionalProperties1 instance = null; + + protected AdditionalProperties1() { + super(new JsonSchemaInfo() + .type(Set.of(Map.class)) + .additionalProperties(AdditionalProperties2.class) + ); + } + + public static AdditionalProperties1 getInstance() { + if (instance == null) { + instance = new AdditionalProperties1(); + } + return instance; + } + + 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 RuntimeException("Invalid non-string key value"); + } + String propertyName = (String) entryKey; + List propertyPathToItem = new ArrayList<>(pathToItem); + propertyPathToItem.add(propertyName); + Object value = entry.getValue(); + LinkedHashMap, Nothing?> schemas = pathToSchemas.get(propertyPathToItem); + if (schemas == null) { + throw new RuntimeException("Validation 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"); + } + properties.put(propertyName, (String) propertyInstance); + } + FrozenMap castProperties = new FrozenMap<>(properties); + return new AdditionalPropertiesMap(castProperties); + } + + 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); + SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().build())); + ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, new PathToSchemasMap(), new LinkedHashSet<>()); + PathToSchemasMap pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet); + return getNewInstance(castArg, validationMetadata.pathToItem(), pathToSchemasMap); + } + + + @Override + public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws 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"); + } + @Override + public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { + if (arg instanceof Map) { + return getNewInstance((Map) arg, pathToItem, pathToSchemas); + } + 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 { + return new AdditionalProperties1BoxedMap(validate(arg, configuration)); + } + @Override + public AdditionalProperties1Boxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { + 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"); + } + } + + + public static class MapOfMapPropertyMap extends FrozenMap { + protected MapOfMapPropertyMap(FrozenMap m) { + super(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 { + return MapOfMapProperty.getInstance().validate(arg, configuration); + } + + public AdditionalPropertiesMap getAdditionalProperty(String name) throws UnsetPropertyException { + return getOrThrow(name); + } + } + + public interface SetterForAdditionalProperties1 { + Set getKnownKeys(); + Map> getInstance(); + T getBuilderAfterAdditionalProperty(Map> instance); + + default T additionalProperty(String key, Map value) throws InvalidAdditionalPropertyException { + MapUtils.throwIfKeyKnown(key, getKnownKeys(), true); + var instance = getInstance(); + instance.put(key, value); + return getBuilderAfterAdditionalProperty(instance); + } + } + + public static class MapOfMapPropertyMapBuilder implements GenericBuilder>>, SetterForAdditionalProperties1 { + private final Map> instance; + private static final Set knownKeys = Set.of(); + public Set getKnownKeys() { + return knownKeys; + } + public MapOfMapPropertyMapBuilder() { + this.instance = new LinkedHashMap<>(); + } + public Map> build() { + return instance; + } + public Map> getInstance() { + return instance; + } + public MapOfMapPropertyMapBuilder getBuilderAfterAdditionalProperty(Map> instance) { + return this; + } + } + + + public sealed interface MapOfMapPropertyBoxed permits MapOfMapPropertyBoxedMap { + @Nullable Object getData(); + } + + public record MapOfMapPropertyBoxedMap(MapOfMapPropertyMap data) implements MapOfMapPropertyBoxed { + @Override + public @Nullable Object getData() { + return data; + } + } + + + public static class MapOfMapProperty extends JsonSchema implements MapSchemaValidator { + private static @Nullable MapOfMapProperty instance = null; + + protected MapOfMapProperty() { + super(new JsonSchemaInfo() + .type(Set.of(Map.class)) + .additionalProperties(AdditionalProperties1.class) + ); + } + + public static MapOfMapProperty getInstance() { + if (instance == null) { + instance = new MapOfMapProperty(); + } + return instance; + } + + 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 RuntimeException("Invalid non-string key value"); + } + String propertyName = (String) entryKey; + List propertyPathToItem = new ArrayList<>(pathToItem); + propertyPathToItem.add(propertyName); + Object value = entry.getValue(); + LinkedHashMap, Nothing?> schemas = pathToSchemas.get(propertyPathToItem); + if (schemas == null) { + throw new RuntimeException("Validation 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"); + } + properties.put(propertyName, (AdditionalPropertiesMap) propertyInstance); + } + FrozenMap castProperties = new FrozenMap<>(properties); + return new MapOfMapPropertyMap(castProperties); + } + + 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); + SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().build())); + ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, new PathToSchemasMap(), new LinkedHashSet<>()); + PathToSchemasMap pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet); + return getNewInstance(castArg, validationMetadata.pathToItem(), pathToSchemasMap); + } + + + @Override + public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws 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"); + } + @Override + public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { + if (arg instanceof Map) { + return getNewInstance((Map) arg, pathToItem, pathToSchemas); + } + 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 { + return new MapOfMapPropertyBoxedMap(validate(arg, configuration)); + } + @Override + public MapOfMapPropertyBoxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { + 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"); + } + } + + + public static class Anytype1 extends AnyTypeJsonSchema.AnyTypeJsonSchema1 { + private static @Nullable Anytype1 instance = null; + public static Anytype1 getInstance() { + if (instance == null) { + instance = new Anytype1(); + } + return instance; + } + } + + + public static class MapWithUndeclaredPropertiesAnytype1 extends MapJsonSchema.MapJsonSchema1 { + private static @Nullable MapWithUndeclaredPropertiesAnytype1 instance = null; + public static MapWithUndeclaredPropertiesAnytype1 getInstance() { + if (instance == null) { + instance = new MapWithUndeclaredPropertiesAnytype1(); + } + return instance; + } + } + + + public static class MapWithUndeclaredPropertiesAnytype2 extends MapJsonSchema.MapJsonSchema1 { + private static @Nullable MapWithUndeclaredPropertiesAnytype2 instance = null; + public static MapWithUndeclaredPropertiesAnytype2 getInstance() { + if (instance == null) { + instance = new MapWithUndeclaredPropertiesAnytype2(); + } + return instance; + } + } + + + public static class AdditionalProperties3 extends AnyTypeJsonSchema.AnyTypeJsonSchema1 { + private static @Nullable AdditionalProperties3 instance = null; + public static AdditionalProperties3 getInstance() { + if (instance == null) { + instance = new AdditionalProperties3(); + } + return instance; + } + } + + + public static class MapWithUndeclaredPropertiesAnytype3Map extends FrozenMap<@Nullable Object> { + protected MapWithUndeclaredPropertiesAnytype3Map(FrozenMap<@Nullable Object> m) { + super(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 { + return MapWithUndeclaredPropertiesAnytype3.getInstance().validate(arg, configuration); + } + + public @Nullable Object getAdditionalProperty(String name) throws UnsetPropertyException { + return getOrThrow(name); + } + } + + public interface SetterForAdditionalProperties3 { + Set getKnownKeys(); + Map getInstance(); + T getBuilderAfterAdditionalProperty(Map instance); + + default T additionalProperty(String key, Nothing? value) throws InvalidAdditionalPropertyException { + MapUtils.throwIfKeyKnown(key, getKnownKeys(), true); + var instance = getInstance(); + instance.put(key, null); + return getBuilderAfterAdditionalProperty(instance); + } + + default T additionalProperty(String key, boolean value) throws InvalidAdditionalPropertyException { + MapUtils.throwIfKeyKnown(key, getKnownKeys(), true); + var instance = getInstance(); + instance.put(key, value); + return getBuilderAfterAdditionalProperty(instance); + } + + default T additionalProperty(String key, String value) throws InvalidAdditionalPropertyException { + MapUtils.throwIfKeyKnown(key, getKnownKeys(), true); + var instance = getInstance(); + instance.put(key, value); + return getBuilderAfterAdditionalProperty(instance); + } + + default T additionalProperty(String key, int value) throws InvalidAdditionalPropertyException { + MapUtils.throwIfKeyKnown(key, getKnownKeys(), true); + var instance = getInstance(); + instance.put(key, value); + return getBuilderAfterAdditionalProperty(instance); + } + + default T additionalProperty(String key, float value) throws InvalidAdditionalPropertyException { + MapUtils.throwIfKeyKnown(key, getKnownKeys(), true); + var instance = getInstance(); + instance.put(key, value); + return getBuilderAfterAdditionalProperty(instance); + } + + default T additionalProperty(String key, long value) throws InvalidAdditionalPropertyException { + MapUtils.throwIfKeyKnown(key, getKnownKeys(), true); + var instance = getInstance(); + instance.put(key, value); + return getBuilderAfterAdditionalProperty(instance); + } + + default T additionalProperty(String key, double value) throws InvalidAdditionalPropertyException { + MapUtils.throwIfKeyKnown(key, getKnownKeys(), true); + var instance = getInstance(); + instance.put(key, value); + return getBuilderAfterAdditionalProperty(instance); + } + + default T additionalProperty(String key, List value) throws InvalidAdditionalPropertyException { + MapUtils.throwIfKeyKnown(key, getKnownKeys(), true); + var instance = getInstance(); + instance.put(key, value); + return getBuilderAfterAdditionalProperty(instance); + } + + default T additionalProperty(String key, Map value) throws InvalidAdditionalPropertyException { + MapUtils.throwIfKeyKnown(key, getKnownKeys(), true); + var instance = getInstance(); + instance.put(key, value); + return getBuilderAfterAdditionalProperty(instance); + } + } + + public static class MapWithUndeclaredPropertiesAnytype3MapBuilder implements GenericBuilder>, SetterForAdditionalProperties3 { + private final Map instance; + private static final Set knownKeys = Set.of(); + public Set getKnownKeys() { + return knownKeys; + } + public MapWithUndeclaredPropertiesAnytype3MapBuilder() { + this.instance = new LinkedHashMap<>(); + } + public Map build() { + return instance; + } + public Map getInstance() { + return instance; + } + public MapWithUndeclaredPropertiesAnytype3MapBuilder getBuilderAfterAdditionalProperty(Map instance) { + return this; + } + } + + + public sealed interface MapWithUndeclaredPropertiesAnytype3Boxed permits MapWithUndeclaredPropertiesAnytype3BoxedMap { + @Nullable Object getData(); + } + + public record MapWithUndeclaredPropertiesAnytype3BoxedMap(MapWithUndeclaredPropertiesAnytype3Map data) implements MapWithUndeclaredPropertiesAnytype3Boxed { + @Override + public @Nullable Object getData() { + return data; + } + } + + + public static class MapWithUndeclaredPropertiesAnytype3 extends JsonSchema implements MapSchemaValidator { + private static @Nullable MapWithUndeclaredPropertiesAnytype3 instance = null; + + protected MapWithUndeclaredPropertiesAnytype3() { + super(new JsonSchemaInfo() + .type(Set.of(Map.class)) + .additionalProperties(AdditionalProperties3.class) + ); + } + + public static MapWithUndeclaredPropertiesAnytype3 getInstance() { + if (instance == null) { + instance = new MapWithUndeclaredPropertiesAnytype3(); + } + return instance; + } + + 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 RuntimeException("Invalid non-string key value"); + } + String propertyName = (String) entryKey; + List propertyPathToItem = new ArrayList<>(pathToItem); + propertyPathToItem.add(propertyName); + Object value = entry.getValue(); + LinkedHashMap, Nothing?> schemas = pathToSchemas.get(propertyPathToItem); + if (schemas == null) { + throw new RuntimeException("Validation result is invalid, schemas must exist for a pathToItem"); + } + JsonSchema propertySchema = schemas.entrySet().iterator().next().getKey(); + @Nullable Object propertyInstance = propertySchema.getNewInstance(value, propertyPathToItem, pathToSchemas); + properties.put(propertyName, propertyInstance); + } + FrozenMap<@Nullable Object> castProperties = new FrozenMap<>(properties); + return new MapWithUndeclaredPropertiesAnytype3Map(castProperties); + } + + 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); + SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().build())); + ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, new PathToSchemasMap(), new LinkedHashSet<>()); + PathToSchemasMap pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet); + return getNewInstance(castArg, validationMetadata.pathToItem(), pathToSchemasMap); + } + + + @Override + public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws 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"); + } + @Override + public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { + if (arg instanceof Map) { + return getNewInstance((Map) arg, pathToItem, pathToSchemas); + } + 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 { + return new MapWithUndeclaredPropertiesAnytype3BoxedMap(validate(arg, configuration)); + } + @Override + public MapWithUndeclaredPropertiesAnytype3Boxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { + 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"); + } + } + + + public static class AdditionalProperties4 extends NotAnyTypeJsonSchema.NotAnyTypeJsonSchema1 { + // NotAnyTypeSchema + private static @Nullable AdditionalProperties4 instance = null; + public static AdditionalProperties4 getInstance() { + if (instance == null) { + instance = new AdditionalProperties4(); + } + return instance; + } + } + + + public static class EmptyMapMap extends FrozenMap<@Nullable Object> { + protected EmptyMapMap(FrozenMap<@Nullable Object> m) { + super(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 { + return EmptyMap.getInstance().validate(arg, configuration); + } + } + + public static class EmptyMapMapBuilder implements GenericBuilder> { + private final Map instance; + private static final Set knownKeys = Set.of(); + public Set getKnownKeys() { + return knownKeys; + } + public EmptyMapMapBuilder() { + this.instance = new LinkedHashMap<>(); + } + public Map build() { + return instance; + } + } + + + public sealed interface EmptyMapBoxed permits EmptyMapBoxedMap { + @Nullable Object getData(); + } + + public record EmptyMapBoxedMap(EmptyMapMap data) implements EmptyMapBoxed { + @Override + public @Nullable Object getData() { + return data; + } + } + + + public static class EmptyMap extends JsonSchema implements MapSchemaValidator { + private static @Nullable EmptyMap instance = null; + + protected EmptyMap() { + super(new JsonSchemaInfo() + .type(Set.of(Map.class)) + .additionalProperties(AdditionalProperties4.class) + ); + } + + public static EmptyMap getInstance() { + if (instance == null) { + instance = new EmptyMap(); + } + return instance; + } + + 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 RuntimeException("Invalid non-string key value"); + } + String propertyName = (String) entryKey; + List propertyPathToItem = new ArrayList<>(pathToItem); + propertyPathToItem.add(propertyName); + Object value = entry.getValue(); + LinkedHashMap, Nothing?> schemas = pathToSchemas.get(propertyPathToItem); + if (schemas == null) { + throw new RuntimeException("Validation result is invalid, schemas must exist for a pathToItem"); + } + JsonSchema propertySchema = schemas.entrySet().iterator().next().getKey(); + @Nullable Object propertyInstance = propertySchema.getNewInstance(value, propertyPathToItem, pathToSchemas); + properties.put(propertyName, propertyInstance); + } + FrozenMap<@Nullable Object> castProperties = new FrozenMap<>(properties); + return new EmptyMapMap(castProperties); + } + + 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); + SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().build())); + ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, new PathToSchemasMap(), new LinkedHashSet<>()); + PathToSchemasMap pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet); + return getNewInstance(castArg, validationMetadata.pathToItem(), pathToSchemasMap); + } + + + @Override + public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws 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"); + } + @Override + public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { + if (arg instanceof Map) { + return getNewInstance((Map) arg, pathToItem, pathToSchemas); + } + 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 { + return new EmptyMapBoxedMap(validate(arg, configuration)); + } + @Override + public EmptyMapBoxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { + 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"); + } + } + + + public static class AdditionalProperties5 extends StringJsonSchema.StringJsonSchema1 { + private static @Nullable AdditionalProperties5 instance = null; + public static AdditionalProperties5 getInstance() { + if (instance == null) { + instance = new AdditionalProperties5(); + } + return instance; + } + } + + + public static class MapWithUndeclaredPropertiesStringMap extends FrozenMap { + protected MapWithUndeclaredPropertiesStringMap(FrozenMap m) { + super(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 { + return MapWithUndeclaredPropertiesString.getInstance().validate(arg, configuration); + } + + public String getAdditionalProperty(String name) throws UnsetPropertyException { + return getOrThrow(name); + } + } + + public interface SetterForAdditionalProperties5 { + Set getKnownKeys(); + Map getInstance(); + T getBuilderAfterAdditionalProperty(Map instance); + + default T additionalProperty(String key, String value) throws InvalidAdditionalPropertyException { + MapUtils.throwIfKeyKnown(key, getKnownKeys(), true); + var instance = getInstance(); + instance.put(key, value); + return getBuilderAfterAdditionalProperty(instance); + } + } + + public static class MapWithUndeclaredPropertiesStringMapBuilder implements GenericBuilder>, SetterForAdditionalProperties5 { + private final Map instance; + private static final Set knownKeys = Set.of(); + public Set getKnownKeys() { + return knownKeys; + } + public MapWithUndeclaredPropertiesStringMapBuilder() { + this.instance = new LinkedHashMap<>(); + } + public Map build() { + return instance; + } + public Map getInstance() { + return instance; + } + public MapWithUndeclaredPropertiesStringMapBuilder getBuilderAfterAdditionalProperty(Map instance) { + return this; + } + } + + + public sealed interface MapWithUndeclaredPropertiesStringBoxed permits MapWithUndeclaredPropertiesStringBoxedMap { + @Nullable Object getData(); + } + + public record MapWithUndeclaredPropertiesStringBoxedMap(MapWithUndeclaredPropertiesStringMap data) implements MapWithUndeclaredPropertiesStringBoxed { + @Override + public @Nullable Object getData() { + return data; + } + } + + + public static class MapWithUndeclaredPropertiesString extends JsonSchema implements MapSchemaValidator { + private static @Nullable MapWithUndeclaredPropertiesString instance = null; + + protected MapWithUndeclaredPropertiesString() { + super(new JsonSchemaInfo() + .type(Set.of(Map.class)) + .additionalProperties(AdditionalProperties5.class) + ); + } + + public static MapWithUndeclaredPropertiesString getInstance() { + if (instance == null) { + instance = new MapWithUndeclaredPropertiesString(); + } + return instance; + } + + 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 RuntimeException("Invalid non-string key value"); + } + String propertyName = (String) entryKey; + List propertyPathToItem = new ArrayList<>(pathToItem); + propertyPathToItem.add(propertyName); + Object value = entry.getValue(); + LinkedHashMap, Nothing?> schemas = pathToSchemas.get(propertyPathToItem); + if (schemas == null) { + throw new RuntimeException("Validation 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"); + } + properties.put(propertyName, (String) propertyInstance); + } + FrozenMap castProperties = new FrozenMap<>(properties); + return new MapWithUndeclaredPropertiesStringMap(castProperties); + } + + 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); + SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().build())); + ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, new PathToSchemasMap(), new LinkedHashSet<>()); + PathToSchemasMap pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet); + return getNewInstance(castArg, validationMetadata.pathToItem(), pathToSchemasMap); + } + + + @Override + public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws 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"); + } + @Override + public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { + if (arg instanceof Map) { + return getNewInstance((Map) arg, pathToItem, pathToSchemas); + } + 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 { + return new MapWithUndeclaredPropertiesStringBoxedMap(validate(arg, configuration)); + } + @Override + public MapWithUndeclaredPropertiesStringBoxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { + 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"); + } + } + + + public static class AdditionalPropertiesClassMap extends FrozenMap<@Nullable Object> { + protected AdditionalPropertiesClassMap(FrozenMap<@Nullable Object> m) { + super(m); + } + public static final Set requiredKeys = Set.of(); + public static final Set optionalKeys = Set.of( + "map_property", + "map_of_map_property", + "anytype_1", + "map_with_undeclared_properties_anytype_1", + "map_with_undeclared_properties_anytype_2", + "map_with_undeclared_properties_anytype_3", + "empty_map", + "map_with_undeclared_properties_string" + ); + public static AdditionalPropertiesClassMap of(Map arg, SchemaConfiguration configuration) throws ValidationException { + return AdditionalPropertiesClass1.getInstance().validate(arg, configuration); + } + + public MapPropertyMap map_property() throws UnsetPropertyException { + String key = "map_property"; + throwIfKeyNotPresent(key); + @Nullable Object value = get(key); + if (!(value instanceof MapPropertyMap)) { + throw new RuntimeException("Invalid value stored for map_property"); + } + return (MapPropertyMap) value; + } + + public MapOfMapPropertyMap map_of_map_property() throws UnsetPropertyException { + String key = "map_of_map_property"; + throwIfKeyNotPresent(key); + @Nullable Object value = get(key); + if (!(value instanceof MapOfMapPropertyMap)) { + throw new RuntimeException("Invalid value stored for map_of_map_property"); + } + return (MapOfMapPropertyMap) value; + } + + public @Nullable Object anytype_1() throws UnsetPropertyException { + return getOrThrow("anytype_1"); + } + + public FrozenMap map_with_undeclared_properties_anytype_1() throws UnsetPropertyException { + String key = "map_with_undeclared_properties_anytype_1"; + throwIfKeyNotPresent(key); + @Nullable Object value = get(key); + if (!(value instanceof FrozenMap)) { + throw new RuntimeException("Invalid value stored for map_with_undeclared_properties_anytype_1"); + } + return (FrozenMap) value; + } + + public FrozenMap map_with_undeclared_properties_anytype_2() throws UnsetPropertyException { + String key = "map_with_undeclared_properties_anytype_2"; + throwIfKeyNotPresent(key); + @Nullable Object value = get(key); + if (!(value instanceof FrozenMap)) { + throw new RuntimeException("Invalid value stored for map_with_undeclared_properties_anytype_2"); + } + return (FrozenMap) value; + } + + public MapWithUndeclaredPropertiesAnytype3Map map_with_undeclared_properties_anytype_3() throws UnsetPropertyException { + String key = "map_with_undeclared_properties_anytype_3"; + throwIfKeyNotPresent(key); + @Nullable Object value = get(key); + if (!(value instanceof MapWithUndeclaredPropertiesAnytype3Map)) { + throw new RuntimeException("Invalid value stored for map_with_undeclared_properties_anytype_3"); + } + return (MapWithUndeclaredPropertiesAnytype3Map) value; + } + + public EmptyMapMap empty_map() throws UnsetPropertyException { + String key = "empty_map"; + throwIfKeyNotPresent(key); + @Nullable Object value = get(key); + if (!(value instanceof EmptyMapMap)) { + throw new RuntimeException("Invalid value stored for empty_map"); + } + return (EmptyMapMap) value; + } + + public MapWithUndeclaredPropertiesStringMap map_with_undeclared_properties_string() throws UnsetPropertyException { + String key = "map_with_undeclared_properties_string"; + throwIfKeyNotPresent(key); + @Nullable Object value = get(key); + if (!(value instanceof MapWithUndeclaredPropertiesStringMap)) { + throw new RuntimeException("Invalid value stored for map_with_undeclared_properties_string"); + } + return (MapWithUndeclaredPropertiesStringMap) value; + } + + public @Nullable Object getAdditionalProperty(String name) throws UnsetPropertyException, InvalidAdditionalPropertyException { + throwIfKeyKnown(name, requiredKeys, optionalKeys); + throwIfKeyNotPresent(name); + return get(name); + } + } + + public interface SetterForMapProperty { + Map getInstance(); + T getBuilderAfterMapProperty(Map instance); + + default T map_property(Map value) { + var instance = getInstance(); + instance.put("map_property", value); + return getBuilderAfterMapProperty(instance); + } + } + + public interface SetterForMapOfMapProperty { + Map getInstance(); + T getBuilderAfterMapOfMapProperty(Map instance); + + default T map_of_map_property(Map> value) { + var instance = getInstance(); + instance.put("map_of_map_property", value); + return getBuilderAfterMapOfMapProperty(instance); + } + } + + public interface SetterForAnytype1 { + Map getInstance(); + T getBuilderAfterAnytype1(Map instance); + + default T anytype_1(Nothing? value) { + var instance = getInstance(); + instance.put("anytype_1", null); + return getBuilderAfterAnytype1(instance); + } + + default T anytype_1(boolean value) { + var instance = getInstance(); + instance.put("anytype_1", value); + return getBuilderAfterAnytype1(instance); + } + + default T anytype_1(String value) { + var instance = getInstance(); + instance.put("anytype_1", value); + return getBuilderAfterAnytype1(instance); + } + + default T anytype_1(int value) { + var instance = getInstance(); + instance.put("anytype_1", value); + return getBuilderAfterAnytype1(instance); + } + + default T anytype_1(float value) { + var instance = getInstance(); + instance.put("anytype_1", value); + return getBuilderAfterAnytype1(instance); + } + + default T anytype_1(long value) { + var instance = getInstance(); + instance.put("anytype_1", value); + return getBuilderAfterAnytype1(instance); + } + + default T anytype_1(double value) { + var instance = getInstance(); + instance.put("anytype_1", value); + return getBuilderAfterAnytype1(instance); + } + + default T anytype_1(List value) { + var instance = getInstance(); + instance.put("anytype_1", value); + return getBuilderAfterAnytype1(instance); + } + + default T anytype_1(Map value) { + var instance = getInstance(); + instance.put("anytype_1", value); + return getBuilderAfterAnytype1(instance); + } + } + + public interface SetterForMapWithUndeclaredPropertiesAnytype1 { + Map getInstance(); + T getBuilderAfterMapWithUndeclaredPropertiesAnytype1(Map instance); + + default T map_with_undeclared_properties_anytype_1(Map value) { + var instance = getInstance(); + instance.put("map_with_undeclared_properties_anytype_1", value); + return getBuilderAfterMapWithUndeclaredPropertiesAnytype1(instance); + } + } + + public interface SetterForMapWithUndeclaredPropertiesAnytype2 { + Map getInstance(); + T getBuilderAfterMapWithUndeclaredPropertiesAnytype2(Map instance); + + default T map_with_undeclared_properties_anytype_2(Map value) { + var instance = getInstance(); + instance.put("map_with_undeclared_properties_anytype_2", value); + return getBuilderAfterMapWithUndeclaredPropertiesAnytype2(instance); + } + } + + public interface SetterForMapWithUndeclaredPropertiesAnytype3 { + Map getInstance(); + T getBuilderAfterMapWithUndeclaredPropertiesAnytype3(Map instance); + + default T map_with_undeclared_properties_anytype_3(Map value) { + var instance = getInstance(); + instance.put("map_with_undeclared_properties_anytype_3", value); + return getBuilderAfterMapWithUndeclaredPropertiesAnytype3(instance); + } + } + + public interface SetterForEmptyMap { + Map getInstance(); + T getBuilderAfterEmptyMap(Map instance); + + default T empty_map(Map value) { + var instance = getInstance(); + instance.put("empty_map", value); + return getBuilderAfterEmptyMap(instance); + } + } + + public interface SetterForMapWithUndeclaredPropertiesString { + Map getInstance(); + T getBuilderAfterMapWithUndeclaredPropertiesString(Map instance); + + default T map_with_undeclared_properties_string(Map value) { + var instance = getInstance(); + instance.put("map_with_undeclared_properties_string", value); + return getBuilderAfterMapWithUndeclaredPropertiesString(instance); + } + } + + public static class AdditionalPropertiesClassMapBuilder extends UnsetAddPropsSetter implements GenericBuilder>, SetterForMapProperty, SetterForMapOfMapProperty, SetterForAnytype1, SetterForMapWithUndeclaredPropertiesAnytype1, SetterForMapWithUndeclaredPropertiesAnytype2, SetterForMapWithUndeclaredPropertiesAnytype3, SetterForEmptyMap, SetterForMapWithUndeclaredPropertiesString { + private final Map instance; + private static final Set knownKeys = Set.of( + "map_property", + "map_of_map_property", + "anytype_1", + "map_with_undeclared_properties_anytype_1", + "map_with_undeclared_properties_anytype_2", + "map_with_undeclared_properties_anytype_3", + "empty_map", + "map_with_undeclared_properties_string" + ); + public Set getKnownKeys() { + return knownKeys; + } + public AdditionalPropertiesClassMapBuilder() { + this.instance = new LinkedHashMap<>(); + } + public Map build() { + return instance; + } + public Map getInstance() { + return instance; + } + public AdditionalPropertiesClassMapBuilder getBuilderAfterMapProperty(Map instance) { + return this; + } + public AdditionalPropertiesClassMapBuilder getBuilderAfterMapOfMapProperty(Map instance) { + return this; + } + public AdditionalPropertiesClassMapBuilder getBuilderAfterAnytype1(Map instance) { + return this; + } + public AdditionalPropertiesClassMapBuilder getBuilderAfterMapWithUndeclaredPropertiesAnytype1(Map instance) { + return this; + } + public AdditionalPropertiesClassMapBuilder getBuilderAfterMapWithUndeclaredPropertiesAnytype2(Map instance) { + return this; + } + public AdditionalPropertiesClassMapBuilder getBuilderAfterMapWithUndeclaredPropertiesAnytype3(Map instance) { + return this; + } + public AdditionalPropertiesClassMapBuilder getBuilderAfterEmptyMap(Map instance) { + return this; + } + public AdditionalPropertiesClassMapBuilder getBuilderAfterMapWithUndeclaredPropertiesString(Map instance) { + return this; + } + public AdditionalPropertiesClassMapBuilder getBuilderAfterAdditionalProperty(Map instance) { + return this; + } + } + + + public sealed interface AdditionalPropertiesClass1Boxed permits AdditionalPropertiesClass1BoxedMap { + @Nullable Object getData(); + } + + public record AdditionalPropertiesClass1BoxedMap(AdditionalPropertiesClassMap data) implements AdditionalPropertiesClass1Boxed { + @Override + public @Nullable Object getData() { + return data; + } + } + + + public static class AdditionalPropertiesClass1 extends JsonSchema implements MapSchemaValidator { + /* + NOTE: This class is auto generated by OpenAPI JSON Schema Generator. + Ref: https://github.com/openapi-json-schema-tools/openapi-json-schema-generator + + Do not edit the class manually. + */ + private static @Nullable AdditionalPropertiesClass1 instance = null; + + protected AdditionalPropertiesClass1() { + super(new JsonSchemaInfo() + .type(Set.of(Map.class)) + .properties(Map.ofEntries( + new PropertyEntry("map_property", MapProperty.class), + new PropertyEntry("map_of_map_property", MapOfMapProperty.class), + new PropertyEntry("anytype_1", Anytype1.class), + new PropertyEntry("map_with_undeclared_properties_anytype_1", MapWithUndeclaredPropertiesAnytype1.class), + new PropertyEntry("map_with_undeclared_properties_anytype_2", MapWithUndeclaredPropertiesAnytype2.class), + new PropertyEntry("map_with_undeclared_properties_anytype_3", MapWithUndeclaredPropertiesAnytype3.class), + new PropertyEntry("empty_map", EmptyMap.class), + new PropertyEntry("map_with_undeclared_properties_string", MapWithUndeclaredPropertiesString.class) + )) + ); + } + + public static AdditionalPropertiesClass1 getInstance() { + if (instance == null) { + instance = new AdditionalPropertiesClass1(); + } + return instance; + } + + 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 RuntimeException("Invalid non-string key value"); + } + String propertyName = (String) entryKey; + List propertyPathToItem = new ArrayList<>(pathToItem); + propertyPathToItem.add(propertyName); + Object value = entry.getValue(); + LinkedHashMap, Nothing?> schemas = pathToSchemas.get(propertyPathToItem); + if (schemas == null) { + throw new RuntimeException("Validation result is invalid, schemas must exist for a pathToItem"); + } + JsonSchema propertySchema = schemas.entrySet().iterator().next().getKey(); + @Nullable Object propertyInstance = propertySchema.getNewInstance(value, propertyPathToItem, pathToSchemas); + properties.put(propertyName, propertyInstance); + } + FrozenMap<@Nullable Object> castProperties = new FrozenMap<>(properties); + return new AdditionalPropertiesClassMap(castProperties); + } + + 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); + SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().build())); + ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, new PathToSchemasMap(), new LinkedHashSet<>()); + PathToSchemasMap pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet); + return getNewInstance(castArg, validationMetadata.pathToItem(), pathToSchemasMap); + } + + + @Override + public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws 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"); + } + @Override + public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { + if (arg instanceof Map) { + return getNewInstance((Map) arg, pathToItem, pathToSchemas); + } + 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 { + return new AdditionalPropertiesClass1BoxedMap(validate(arg, configuration)); + } + @Override + public AdditionalPropertiesClass1Boxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { + 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"); + } + } + +} diff --git a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/schemas/AdditionalPropertiesSchema.kt b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/schemas/AdditionalPropertiesSchema.kt new file mode 100644 index 00000000000..842951a945d --- /dev/null +++ b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/schemas/AdditionalPropertiesSchema.kt @@ -0,0 +1,1309 @@ +package org.openapijsonschematools.client.components.schemas; +import java.time.LocalDate; +import java.time.ZonedDateTime; +import java.util.ArrayList; +import java.util.HashSet; +import java.util.LinkedHashMap; +import java.util.LinkedHashSet; +import java.util.List; +import java.util.Map; +import java.util.Objects; +import java.util.Set; +import java.util.UUID; +import org.checkerframework.checker.nullness.qual.Nullable; +import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags; +import org.openapijsonschematools.client.configurations.SchemaConfiguration; +import org.openapijsonschematools.client.exceptions.InvalidAdditionalPropertyException; +import org.openapijsonschematools.client.exceptions.UnsetPropertyException; +import org.openapijsonschematools.client.exceptions.ValidationException; +import org.openapijsonschematools.client.schemas.AnyTypeJsonSchema; +import org.openapijsonschematools.client.schemas.GenericBuilder; +import org.openapijsonschematools.client.schemas.UnsetAddPropsSetter; +import org.openapijsonschematools.client.schemas.validation.BooleanSchemaValidator; +import org.openapijsonschematools.client.schemas.validation.FrozenList; +import org.openapijsonschematools.client.schemas.validation.FrozenMap; +import org.openapijsonschematools.client.schemas.validation.JsonSchema; +import org.openapijsonschematools.client.schemas.validation.JsonSchemaInfo; +import org.openapijsonschematools.client.schemas.validation.ListSchemaValidator; +import org.openapijsonschematools.client.schemas.validation.MapSchemaValidator; +import org.openapijsonschematools.client.schemas.validation.MapUtils; +import org.openapijsonschematools.client.schemas.validation.NullSchemaValidator; +import org.openapijsonschematools.client.schemas.validation.NumberSchemaValidator; +import org.openapijsonschematools.client.schemas.validation.PathToSchemasMap; +import org.openapijsonschematools.client.schemas.validation.StringSchemaValidator; +import org.openapijsonschematools.client.schemas.validation.ValidationMetadata; + +public class AdditionalPropertiesSchema { + // nest classes so all schemas and input/output classes can be public + + + public static class AdditionalProperties extends AnyTypeJsonSchema.AnyTypeJsonSchema1 { + private static @Nullable AdditionalProperties instance = null; + public static AdditionalProperties getInstance() { + if (instance == null) { + instance = new AdditionalProperties(); + } + return instance; + } + } + + + public static class Schema0Map extends FrozenMap<@Nullable Object> { + protected Schema0Map(FrozenMap<@Nullable Object> m) { + super(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 { + return Schema0.getInstance().validate(arg, configuration); + } + + public @Nullable Object getAdditionalProperty(String name) throws UnsetPropertyException { + return getOrThrow(name); + } + } + + public interface SetterForAdditionalProperties { + Set getKnownKeys(); + Map getInstance(); + T getBuilderAfterAdditionalProperty(Map instance); + + default T additionalProperty(String key, Nothing? value) throws InvalidAdditionalPropertyException { + MapUtils.throwIfKeyKnown(key, getKnownKeys(), true); + var instance = getInstance(); + instance.put(key, null); + return getBuilderAfterAdditionalProperty(instance); + } + + default T additionalProperty(String key, boolean value) throws InvalidAdditionalPropertyException { + MapUtils.throwIfKeyKnown(key, getKnownKeys(), true); + var instance = getInstance(); + instance.put(key, value); + return getBuilderAfterAdditionalProperty(instance); + } + + default T additionalProperty(String key, String value) throws InvalidAdditionalPropertyException { + MapUtils.throwIfKeyKnown(key, getKnownKeys(), true); + var instance = getInstance(); + instance.put(key, value); + return getBuilderAfterAdditionalProperty(instance); + } + + default T additionalProperty(String key, int value) throws InvalidAdditionalPropertyException { + MapUtils.throwIfKeyKnown(key, getKnownKeys(), true); + var instance = getInstance(); + instance.put(key, value); + return getBuilderAfterAdditionalProperty(instance); + } + + default T additionalProperty(String key, float value) throws InvalidAdditionalPropertyException { + MapUtils.throwIfKeyKnown(key, getKnownKeys(), true); + var instance = getInstance(); + instance.put(key, value); + return getBuilderAfterAdditionalProperty(instance); + } + + default T additionalProperty(String key, long value) throws InvalidAdditionalPropertyException { + MapUtils.throwIfKeyKnown(key, getKnownKeys(), true); + var instance = getInstance(); + instance.put(key, value); + return getBuilderAfterAdditionalProperty(instance); + } + + default T additionalProperty(String key, double value) throws InvalidAdditionalPropertyException { + MapUtils.throwIfKeyKnown(key, getKnownKeys(), true); + var instance = getInstance(); + instance.put(key, value); + return getBuilderAfterAdditionalProperty(instance); + } + + default T additionalProperty(String key, List value) throws InvalidAdditionalPropertyException { + MapUtils.throwIfKeyKnown(key, getKnownKeys(), true); + var instance = getInstance(); + instance.put(key, value); + return getBuilderAfterAdditionalProperty(instance); + } + + default T additionalProperty(String key, Map value) throws InvalidAdditionalPropertyException { + MapUtils.throwIfKeyKnown(key, getKnownKeys(), true); + var instance = getInstance(); + instance.put(key, value); + return getBuilderAfterAdditionalProperty(instance); + } + } + + public static class Schema0MapBuilder implements GenericBuilder>, SetterForAdditionalProperties { + private final Map instance; + private static final Set knownKeys = Set.of(); + public Set getKnownKeys() { + return knownKeys; + } + public Schema0MapBuilder() { + this.instance = new LinkedHashMap<>(); + } + public Map build() { + return instance; + } + public Map getInstance() { + return instance; + } + public Schema0MapBuilder getBuilderAfterAdditionalProperty(Map instance) { + return this; + } + } + + + public sealed interface Schema0Boxed permits Schema0BoxedMap { + @Nullable Object getData(); + } + + public record Schema0BoxedMap(Schema0Map data) implements Schema0Boxed { + @Override + public @Nullable Object getData() { + return data; + } + } + + + public static class Schema0 extends JsonSchema implements MapSchemaValidator { + private static @Nullable Schema0 instance = null; + + protected Schema0() { + super(new JsonSchemaInfo() + .type(Set.of(Map.class)) + .additionalProperties(AdditionalProperties.class) + ); + } + + public static Schema0 getInstance() { + if (instance == null) { + instance = new Schema0(); + } + return instance; + } + + 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 RuntimeException("Invalid non-string key value"); + } + String propertyName = (String) entryKey; + List propertyPathToItem = new ArrayList<>(pathToItem); + propertyPathToItem.add(propertyName); + Object value = entry.getValue(); + LinkedHashMap, Nothing?> schemas = pathToSchemas.get(propertyPathToItem); + if (schemas == null) { + throw new RuntimeException("Validation result is invalid, schemas must exist for a pathToItem"); + } + JsonSchema propertySchema = schemas.entrySet().iterator().next().getKey(); + @Nullable Object propertyInstance = propertySchema.getNewInstance(value, propertyPathToItem, pathToSchemas); + properties.put(propertyName, propertyInstance); + } + FrozenMap<@Nullable Object> castProperties = new FrozenMap<>(properties); + return new Schema0Map(castProperties); + } + + 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); + SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().build())); + ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, new PathToSchemasMap(), new LinkedHashSet<>()); + PathToSchemasMap pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet); + return getNewInstance(castArg, validationMetadata.pathToItem(), pathToSchemasMap); + } + + + @Override + public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws 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"); + } + @Override + public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { + if (arg instanceof Map) { + return getNewInstance((Map) arg, pathToItem, pathToSchemas); + } + 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 { + return new Schema0BoxedMap(validate(arg, configuration)); + } + @Override + public Schema0Boxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { + 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"); + } + } + + + public sealed interface AdditionalProperties1Boxed permits AdditionalProperties1BoxedVoid, AdditionalProperties1BoxedBoolean, AdditionalProperties1BoxedNumber, AdditionalProperties1BoxedString, AdditionalProperties1BoxedList, AdditionalProperties1BoxedMap { + @Nullable Object getData(); + } + + public record AdditionalProperties1BoxedVoid(Nothing? data) implements AdditionalProperties1Boxed { + @Override + public @Nullable Object getData() { + return data; + } + } + + public record AdditionalProperties1BoxedBoolean(boolean data) implements AdditionalProperties1Boxed { + @Override + public @Nullable Object getData() { + return data; + } + } + + public record AdditionalProperties1BoxedNumber(Number data) implements AdditionalProperties1Boxed { + @Override + public @Nullable Object getData() { + return data; + } + } + + public record AdditionalProperties1BoxedString(String data) implements AdditionalProperties1Boxed { + @Override + public @Nullable Object getData() { + return data; + } + } + + public record AdditionalProperties1BoxedList(FrozenList<@Nullable Object> data) implements AdditionalProperties1Boxed { + @Override + public @Nullable Object getData() { + return data; + } + } + + public record AdditionalProperties1BoxedMap(FrozenMap<@Nullable Object> data) implements AdditionalProperties1Boxed { + @Override + public @Nullable Object getData() { + return data; + } + } + + + public static class AdditionalProperties1 extends JsonSchema implements NullSchemaValidator, BooleanSchemaValidator, NumberSchemaValidator, StringSchemaValidator, ListSchemaValidator, AdditionalProperties1BoxedList>, MapSchemaValidator, AdditionalProperties1BoxedMap> { + private static @Nullable AdditionalProperties1 instance = null; + + protected AdditionalProperties1() { + super(new JsonSchemaInfo() + .minLength(3) + ); + } + + public static AdditionalProperties1 getInstance() { + if (instance == null) { + instance = new AdditionalProperties1(); + } + return instance; + } + + @Override + public Nothing? validate(Nothing? arg, SchemaConfiguration configuration) throws ValidationException { + Set> pathSet = new HashSet<>(); + List pathToItem = List.of("args[0]"); + Nothing? castArg = castToAllowedTypes(arg, pathToItem, pathSet); + SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().build())); + PathToSchemasMap validatedPathToSchemas = new PathToSchemasMap(); + ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, new LinkedHashSet<>()); + getPathToSchemas(this, castArg, validationMetadata, pathSet); + return castArg; + } + + @Override + public boolean validate(boolean arg, SchemaConfiguration configuration) throws ValidationException { + Set> pathSet = new HashSet<>(); + List pathToItem = List.of("args[0]"); + boolean castArg = castToAllowedTypes(arg, pathToItem, pathSet); + SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().build())); + PathToSchemasMap validatedPathToSchemas = new PathToSchemasMap(); + ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, new LinkedHashSet<>()); + getPathToSchemas(this, castArg, validationMetadata, pathSet); + return castArg; + } + + @Override + public Number validate(Number arg, SchemaConfiguration configuration) throws ValidationException { + Set> pathSet = new HashSet<>(); + List pathToItem = List.of("args[0]"); + Number castArg = castToAllowedTypes(arg, pathToItem, pathSet); + SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().build())); + PathToSchemasMap validatedPathToSchemas = new PathToSchemasMap(); + ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, new LinkedHashSet<>()); + getPathToSchemas(this, castArg, validationMetadata, pathSet); + return castArg; + } + + public int validate(int arg, SchemaConfiguration configuration) throws ValidationException { + return (int) validate((Number) arg, configuration); + } + + public long validate(long arg, SchemaConfiguration configuration) throws ValidationException { + return (long) validate((Number) arg, configuration); + } + + public float validate(float arg, SchemaConfiguration configuration) throws ValidationException { + return (float) validate((Number) arg, configuration); + } + + public double validate(double arg, SchemaConfiguration configuration) throws ValidationException { + return (double) validate((Number) arg, configuration); + } + + @Override + public String validate(String arg, SchemaConfiguration configuration) throws ValidationException { + Set> pathSet = new HashSet<>(); + List pathToItem = List.of("args[0]"); + String castArg = castToAllowedTypes(arg, pathToItem, pathSet); + SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().build())); + PathToSchemasMap validatedPathToSchemas = new PathToSchemasMap(); + ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, new LinkedHashSet<>()); + getPathToSchemas(this, castArg, validationMetadata, pathSet); + return castArg; + } + + public String validate(LocalDate arg, SchemaConfiguration configuration) throws ValidationException { + return validate(arg.toString(), configuration); + } + + public String validate(ZonedDateTime arg, SchemaConfiguration configuration) throws ValidationException { + return validate(arg.toString(), configuration); + } + + public String validate(UUID arg, SchemaConfiguration configuration) throws ValidationException { + return validate(arg.toString(), configuration); + } + + @Override + public FrozenList<@Nullable Object> getNewInstance(List arg, List pathToItem, PathToSchemasMap pathToSchemas) { + List<@Nullable Object> items = new ArrayList<>(); + int i = 0; + for (Object item: arg) { + List itemPathToItem = new ArrayList<>(pathToItem); + itemPathToItem.add(i); + LinkedHashMap, Nothing?> schemas = pathToSchemas.get(itemPathToItem); + if (schemas == null) { + throw new RuntimeException("Validation result is invalid, schemas must exist for a pathToItem"); + } + JsonSchema itemSchema = schemas.entrySet().iterator().next().getKey(); + @Nullable Object itemInstance = itemSchema.getNewInstance(item, itemPathToItem, pathToSchemas); + items.add(itemInstance); + i += 1; + } + FrozenList<@Nullable Object> newInstanceItems = new FrozenList<>(items); + return newInstanceItems; + } + + 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); + SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().build())); + ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, new PathToSchemasMap(), new LinkedHashSet<>()); + PathToSchemasMap pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet); + return getNewInstance(castArg, validationMetadata.pathToItem(), pathToSchemasMap); + } + + @Override + 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 RuntimeException("Invalid non-string key value"); + } + String propertyName = (String) entryKey; + List propertyPathToItem = new ArrayList<>(pathToItem); + propertyPathToItem.add(propertyName); + Object value = entry.getValue(); + LinkedHashMap, Nothing?> schemas = pathToSchemas.get(propertyPathToItem); + if (schemas == null) { + throw new RuntimeException("Validation result is invalid, schemas must exist for a pathToItem"); + } + JsonSchema propertySchema = schemas.entrySet().iterator().next().getKey(); + @Nullable Object propertyInstance = propertySchema.getNewInstance(value, propertyPathToItem, pathToSchemas); + properties.put(propertyName, propertyInstance); + } + FrozenMap<@Nullable Object> castProperties = new FrozenMap<>(properties); + return castProperties; + } + + public FrozenMap<@Nullable Object> validate(Map arg, SchemaConfiguration configuration) throws ValidationException { + Set> pathSet = new HashSet<>(); + List pathToItem = List.of("args[0]"); + Map castArg = castToAllowedTypes(arg, pathToItem, pathSet); + SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().build())); + PathToSchemasMap validatedPathToSchemas = new PathToSchemasMap(); + ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, new LinkedHashSet<>()); + PathToSchemasMap pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet); + return getNewInstance(castArg, validationMetadata.pathToItem(), pathToSchemasMap); + } + + @Override + public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { + if (arg == null) { + return validate((Nothing?) null, configuration); + } else if (arg instanceof Boolean) { + boolean boolArg = (Boolean) arg; + return validate(boolArg, configuration); + } else if (arg instanceof Number) { + return validate((Number) arg, configuration); + } else if (arg instanceof String) { + return validate((String) arg, configuration); + } else if (arg instanceof List) { + return validate((List) arg, 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"); + } + @Override + public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { + if (arg == null) { + return getNewInstance((Nothing?) null, pathToItem, pathToSchemas); + } else if (arg instanceof Boolean) { + boolean boolArg = (Boolean) arg; + return getNewInstance(boolArg, pathToItem, pathToSchemas); + } else if (arg instanceof Number) { + return getNewInstance((Number) arg, pathToItem, pathToSchemas); + } else if (arg instanceof String) { + return getNewInstance((String) arg, pathToItem, pathToSchemas); + } else if (arg instanceof List) { + return getNewInstance((List) arg, 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"); + } + @Override + public AdditionalProperties1BoxedVoid validateAndBox(Nothing? arg, SchemaConfiguration configuration) throws ValidationException { + return new AdditionalProperties1BoxedVoid(validate(arg, configuration)); + } + @Override + 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 { + return new AdditionalProperties1BoxedNumber(validate(arg, configuration)); + } + @Override + 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 { + return new AdditionalProperties1BoxedList(validate(arg, configuration)); + } + @Override + 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 { + if (arg == null) { + Nothing? castArg = (Nothing?) arg; + return validateAndBox(castArg, configuration); + } else if (arg instanceof Boolean booleanArg) { + boolean castArg = booleanArg; + return validateAndBox(castArg, configuration); + } else if (arg instanceof String castArg) { + return validateAndBox(castArg, configuration); + } else if (arg instanceof Number castArg) { + return validateAndBox(castArg, configuration); + } else if (arg instanceof List castArg) { + 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"); + } + } + + public static class Schema1Map extends FrozenMap<@Nullable Object> { + protected Schema1Map(FrozenMap<@Nullable Object> m) { + super(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 { + return Schema1.getInstance().validate(arg, configuration); + } + + public @Nullable Object getAdditionalProperty(String name) throws UnsetPropertyException { + return getOrThrow(name); + } + } + + public interface SetterForAdditionalProperties1 { + Set getKnownKeys(); + Map getInstance(); + T getBuilderAfterAdditionalProperty(Map instance); + + default T additionalProperty(String key, Nothing? value) throws InvalidAdditionalPropertyException { + MapUtils.throwIfKeyKnown(key, getKnownKeys(), true); + var instance = getInstance(); + instance.put(key, null); + return getBuilderAfterAdditionalProperty(instance); + } + + default T additionalProperty(String key, boolean value) throws InvalidAdditionalPropertyException { + MapUtils.throwIfKeyKnown(key, getKnownKeys(), true); + var instance = getInstance(); + instance.put(key, value); + return getBuilderAfterAdditionalProperty(instance); + } + + default T additionalProperty(String key, String value) throws InvalidAdditionalPropertyException { + MapUtils.throwIfKeyKnown(key, getKnownKeys(), true); + var instance = getInstance(); + instance.put(key, value); + return getBuilderAfterAdditionalProperty(instance); + } + + default T additionalProperty(String key, int value) throws InvalidAdditionalPropertyException { + MapUtils.throwIfKeyKnown(key, getKnownKeys(), true); + var instance = getInstance(); + instance.put(key, value); + return getBuilderAfterAdditionalProperty(instance); + } + + default T additionalProperty(String key, float value) throws InvalidAdditionalPropertyException { + MapUtils.throwIfKeyKnown(key, getKnownKeys(), true); + var instance = getInstance(); + instance.put(key, value); + return getBuilderAfterAdditionalProperty(instance); + } + + default T additionalProperty(String key, long value) throws InvalidAdditionalPropertyException { + MapUtils.throwIfKeyKnown(key, getKnownKeys(), true); + var instance = getInstance(); + instance.put(key, value); + return getBuilderAfterAdditionalProperty(instance); + } + + default T additionalProperty(String key, double value) throws InvalidAdditionalPropertyException { + MapUtils.throwIfKeyKnown(key, getKnownKeys(), true); + var instance = getInstance(); + instance.put(key, value); + return getBuilderAfterAdditionalProperty(instance); + } + + default T additionalProperty(String key, List value) throws InvalidAdditionalPropertyException { + MapUtils.throwIfKeyKnown(key, getKnownKeys(), true); + var instance = getInstance(); + instance.put(key, value); + return getBuilderAfterAdditionalProperty(instance); + } + + default T additionalProperty(String key, Map value) throws InvalidAdditionalPropertyException { + MapUtils.throwIfKeyKnown(key, getKnownKeys(), true); + var instance = getInstance(); + instance.put(key, value); + return getBuilderAfterAdditionalProperty(instance); + } + } + + public static class Schema1MapBuilder implements GenericBuilder>, SetterForAdditionalProperties1 { + private final Map instance; + private static final Set knownKeys = Set.of(); + public Set getKnownKeys() { + return knownKeys; + } + public Schema1MapBuilder() { + this.instance = new LinkedHashMap<>(); + } + public Map build() { + return instance; + } + public Map getInstance() { + return instance; + } + public Schema1MapBuilder getBuilderAfterAdditionalProperty(Map instance) { + return this; + } + } + + + public sealed interface Schema1Boxed permits Schema1BoxedMap { + @Nullable Object getData(); + } + + public record Schema1BoxedMap(Schema1Map data) implements Schema1Boxed { + @Override + public @Nullable Object getData() { + return data; + } + } + + + public static class Schema1 extends JsonSchema implements MapSchemaValidator { + private static @Nullable Schema1 instance = null; + + protected Schema1() { + super(new JsonSchemaInfo() + .type(Set.of(Map.class)) + .additionalProperties(AdditionalProperties1.class) + ); + } + + public static Schema1 getInstance() { + if (instance == null) { + instance = new Schema1(); + } + return instance; + } + + 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 RuntimeException("Invalid non-string key value"); + } + String propertyName = (String) entryKey; + List propertyPathToItem = new ArrayList<>(pathToItem); + propertyPathToItem.add(propertyName); + Object value = entry.getValue(); + LinkedHashMap, Nothing?> schemas = pathToSchemas.get(propertyPathToItem); + if (schemas == null) { + throw new RuntimeException("Validation result is invalid, schemas must exist for a pathToItem"); + } + JsonSchema propertySchema = schemas.entrySet().iterator().next().getKey(); + @Nullable Object propertyInstance = propertySchema.getNewInstance(value, propertyPathToItem, pathToSchemas); + properties.put(propertyName, propertyInstance); + } + FrozenMap<@Nullable Object> castProperties = new FrozenMap<>(properties); + return new Schema1Map(castProperties); + } + + 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); + SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().build())); + ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, new PathToSchemasMap(), new LinkedHashSet<>()); + PathToSchemasMap pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet); + return getNewInstance(castArg, validationMetadata.pathToItem(), pathToSchemasMap); + } + + + @Override + public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws 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"); + } + @Override + public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { + if (arg instanceof Map) { + return getNewInstance((Map) arg, pathToItem, pathToSchemas); + } + 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 { + return new Schema1BoxedMap(validate(arg, configuration)); + } + @Override + public Schema1Boxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { + 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"); + } + } + + + public sealed interface AdditionalProperties2Boxed permits AdditionalProperties2BoxedVoid, AdditionalProperties2BoxedBoolean, AdditionalProperties2BoxedNumber, AdditionalProperties2BoxedString, AdditionalProperties2BoxedList, AdditionalProperties2BoxedMap { + @Nullable Object getData(); + } + + public record AdditionalProperties2BoxedVoid(Nothing? data) implements AdditionalProperties2Boxed { + @Override + public @Nullable Object getData() { + return data; + } + } + + public record AdditionalProperties2BoxedBoolean(boolean data) implements AdditionalProperties2Boxed { + @Override + public @Nullable Object getData() { + return data; + } + } + + public record AdditionalProperties2BoxedNumber(Number data) implements AdditionalProperties2Boxed { + @Override + public @Nullable Object getData() { + return data; + } + } + + public record AdditionalProperties2BoxedString(String data) implements AdditionalProperties2Boxed { + @Override + public @Nullable Object getData() { + return data; + } + } + + public record AdditionalProperties2BoxedList(FrozenList<@Nullable Object> data) implements AdditionalProperties2Boxed { + @Override + public @Nullable Object getData() { + return data; + } + } + + public record AdditionalProperties2BoxedMap(FrozenMap<@Nullable Object> data) implements AdditionalProperties2Boxed { + @Override + public @Nullable Object getData() { + return data; + } + } + + + public static class AdditionalProperties2 extends JsonSchema implements NullSchemaValidator, BooleanSchemaValidator, NumberSchemaValidator, StringSchemaValidator, ListSchemaValidator, AdditionalProperties2BoxedList>, MapSchemaValidator, AdditionalProperties2BoxedMap> { + private static @Nullable AdditionalProperties2 instance = null; + + protected AdditionalProperties2() { + super(new JsonSchemaInfo() + .maxLength(5) + ); + } + + public static AdditionalProperties2 getInstance() { + if (instance == null) { + instance = new AdditionalProperties2(); + } + return instance; + } + + @Override + public Nothing? validate(Nothing? arg, SchemaConfiguration configuration) throws ValidationException { + Set> pathSet = new HashSet<>(); + List pathToItem = List.of("args[0]"); + Nothing? castArg = castToAllowedTypes(arg, pathToItem, pathSet); + SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().build())); + PathToSchemasMap validatedPathToSchemas = new PathToSchemasMap(); + ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, new LinkedHashSet<>()); + getPathToSchemas(this, castArg, validationMetadata, pathSet); + return castArg; + } + + @Override + public boolean validate(boolean arg, SchemaConfiguration configuration) throws ValidationException { + Set> pathSet = new HashSet<>(); + List pathToItem = List.of("args[0]"); + boolean castArg = castToAllowedTypes(arg, pathToItem, pathSet); + SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().build())); + PathToSchemasMap validatedPathToSchemas = new PathToSchemasMap(); + ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, new LinkedHashSet<>()); + getPathToSchemas(this, castArg, validationMetadata, pathSet); + return castArg; + } + + @Override + public Number validate(Number arg, SchemaConfiguration configuration) throws ValidationException { + Set> pathSet = new HashSet<>(); + List pathToItem = List.of("args[0]"); + Number castArg = castToAllowedTypes(arg, pathToItem, pathSet); + SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().build())); + PathToSchemasMap validatedPathToSchemas = new PathToSchemasMap(); + ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, new LinkedHashSet<>()); + getPathToSchemas(this, castArg, validationMetadata, pathSet); + return castArg; + } + + public int validate(int arg, SchemaConfiguration configuration) throws ValidationException { + return (int) validate((Number) arg, configuration); + } + + public long validate(long arg, SchemaConfiguration configuration) throws ValidationException { + return (long) validate((Number) arg, configuration); + } + + public float validate(float arg, SchemaConfiguration configuration) throws ValidationException { + return (float) validate((Number) arg, configuration); + } + + public double validate(double arg, SchemaConfiguration configuration) throws ValidationException { + return (double) validate((Number) arg, configuration); + } + + @Override + public String validate(String arg, SchemaConfiguration configuration) throws ValidationException { + Set> pathSet = new HashSet<>(); + List pathToItem = List.of("args[0]"); + String castArg = castToAllowedTypes(arg, pathToItem, pathSet); + SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().build())); + PathToSchemasMap validatedPathToSchemas = new PathToSchemasMap(); + ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, new LinkedHashSet<>()); + getPathToSchemas(this, castArg, validationMetadata, pathSet); + return castArg; + } + + public String validate(LocalDate arg, SchemaConfiguration configuration) throws ValidationException { + return validate(arg.toString(), configuration); + } + + public String validate(ZonedDateTime arg, SchemaConfiguration configuration) throws ValidationException { + return validate(arg.toString(), configuration); + } + + public String validate(UUID arg, SchemaConfiguration configuration) throws ValidationException { + return validate(arg.toString(), configuration); + } + + @Override + public FrozenList<@Nullable Object> getNewInstance(List arg, List pathToItem, PathToSchemasMap pathToSchemas) { + List<@Nullable Object> items = new ArrayList<>(); + int i = 0; + for (Object item: arg) { + List itemPathToItem = new ArrayList<>(pathToItem); + itemPathToItem.add(i); + LinkedHashMap, Nothing?> schemas = pathToSchemas.get(itemPathToItem); + if (schemas == null) { + throw new RuntimeException("Validation result is invalid, schemas must exist for a pathToItem"); + } + JsonSchema itemSchema = schemas.entrySet().iterator().next().getKey(); + @Nullable Object itemInstance = itemSchema.getNewInstance(item, itemPathToItem, pathToSchemas); + items.add(itemInstance); + i += 1; + } + FrozenList<@Nullable Object> newInstanceItems = new FrozenList<>(items); + return newInstanceItems; + } + + 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); + SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().build())); + ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, new PathToSchemasMap(), new LinkedHashSet<>()); + PathToSchemasMap pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet); + return getNewInstance(castArg, validationMetadata.pathToItem(), pathToSchemasMap); + } + + @Override + 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 RuntimeException("Invalid non-string key value"); + } + String propertyName = (String) entryKey; + List propertyPathToItem = new ArrayList<>(pathToItem); + propertyPathToItem.add(propertyName); + Object value = entry.getValue(); + LinkedHashMap, Nothing?> schemas = pathToSchemas.get(propertyPathToItem); + if (schemas == null) { + throw new RuntimeException("Validation result is invalid, schemas must exist for a pathToItem"); + } + JsonSchema propertySchema = schemas.entrySet().iterator().next().getKey(); + @Nullable Object propertyInstance = propertySchema.getNewInstance(value, propertyPathToItem, pathToSchemas); + properties.put(propertyName, propertyInstance); + } + FrozenMap<@Nullable Object> castProperties = new FrozenMap<>(properties); + return castProperties; + } + + public FrozenMap<@Nullable Object> validate(Map arg, SchemaConfiguration configuration) throws ValidationException { + Set> pathSet = new HashSet<>(); + List pathToItem = List.of("args[0]"); + Map castArg = castToAllowedTypes(arg, pathToItem, pathSet); + SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().build())); + PathToSchemasMap validatedPathToSchemas = new PathToSchemasMap(); + ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, new LinkedHashSet<>()); + PathToSchemasMap pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet); + return getNewInstance(castArg, validationMetadata.pathToItem(), pathToSchemasMap); + } + + @Override + public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { + if (arg == null) { + return validate((Nothing?) null, configuration); + } else if (arg instanceof Boolean) { + boolean boolArg = (Boolean) arg; + return validate(boolArg, configuration); + } else if (arg instanceof Number) { + return validate((Number) arg, configuration); + } else if (arg instanceof String) { + return validate((String) arg, configuration); + } else if (arg instanceof List) { + return validate((List) arg, 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"); + } + @Override + public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { + if (arg == null) { + return getNewInstance((Nothing?) null, pathToItem, pathToSchemas); + } else if (arg instanceof Boolean) { + boolean boolArg = (Boolean) arg; + return getNewInstance(boolArg, pathToItem, pathToSchemas); + } else if (arg instanceof Number) { + return getNewInstance((Number) arg, pathToItem, pathToSchemas); + } else if (arg instanceof String) { + return getNewInstance((String) arg, pathToItem, pathToSchemas); + } else if (arg instanceof List) { + return getNewInstance((List) arg, 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"); + } + @Override + public AdditionalProperties2BoxedVoid validateAndBox(Nothing? arg, SchemaConfiguration configuration) throws ValidationException { + return new AdditionalProperties2BoxedVoid(validate(arg, configuration)); + } + @Override + 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 { + return new AdditionalProperties2BoxedNumber(validate(arg, configuration)); + } + @Override + 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 { + return new AdditionalProperties2BoxedList(validate(arg, configuration)); + } + @Override + 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 { + if (arg == null) { + Nothing? castArg = (Nothing?) arg; + return validateAndBox(castArg, configuration); + } else if (arg instanceof Boolean booleanArg) { + boolean castArg = booleanArg; + return validateAndBox(castArg, configuration); + } else if (arg instanceof String castArg) { + return validateAndBox(castArg, configuration); + } else if (arg instanceof Number castArg) { + return validateAndBox(castArg, configuration); + } else if (arg instanceof List castArg) { + 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"); + } + } + + public static class Schema2Map extends FrozenMap<@Nullable Object> { + protected Schema2Map(FrozenMap<@Nullable Object> m) { + super(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 { + return Schema2.getInstance().validate(arg, configuration); + } + + public @Nullable Object getAdditionalProperty(String name) throws UnsetPropertyException { + return getOrThrow(name); + } + } + + public interface SetterForAdditionalProperties2 { + Set getKnownKeys(); + Map getInstance(); + T getBuilderAfterAdditionalProperty(Map instance); + + default T additionalProperty(String key, Nothing? value) throws InvalidAdditionalPropertyException { + MapUtils.throwIfKeyKnown(key, getKnownKeys(), true); + var instance = getInstance(); + instance.put(key, null); + return getBuilderAfterAdditionalProperty(instance); + } + + default T additionalProperty(String key, boolean value) throws InvalidAdditionalPropertyException { + MapUtils.throwIfKeyKnown(key, getKnownKeys(), true); + var instance = getInstance(); + instance.put(key, value); + return getBuilderAfterAdditionalProperty(instance); + } + + default T additionalProperty(String key, String value) throws InvalidAdditionalPropertyException { + MapUtils.throwIfKeyKnown(key, getKnownKeys(), true); + var instance = getInstance(); + instance.put(key, value); + return getBuilderAfterAdditionalProperty(instance); + } + + default T additionalProperty(String key, int value) throws InvalidAdditionalPropertyException { + MapUtils.throwIfKeyKnown(key, getKnownKeys(), true); + var instance = getInstance(); + instance.put(key, value); + return getBuilderAfterAdditionalProperty(instance); + } + + default T additionalProperty(String key, float value) throws InvalidAdditionalPropertyException { + MapUtils.throwIfKeyKnown(key, getKnownKeys(), true); + var instance = getInstance(); + instance.put(key, value); + return getBuilderAfterAdditionalProperty(instance); + } + + default T additionalProperty(String key, long value) throws InvalidAdditionalPropertyException { + MapUtils.throwIfKeyKnown(key, getKnownKeys(), true); + var instance = getInstance(); + instance.put(key, value); + return getBuilderAfterAdditionalProperty(instance); + } + + default T additionalProperty(String key, double value) throws InvalidAdditionalPropertyException { + MapUtils.throwIfKeyKnown(key, getKnownKeys(), true); + var instance = getInstance(); + instance.put(key, value); + return getBuilderAfterAdditionalProperty(instance); + } + + default T additionalProperty(String key, List value) throws InvalidAdditionalPropertyException { + MapUtils.throwIfKeyKnown(key, getKnownKeys(), true); + var instance = getInstance(); + instance.put(key, value); + return getBuilderAfterAdditionalProperty(instance); + } + + default T additionalProperty(String key, Map value) throws InvalidAdditionalPropertyException { + MapUtils.throwIfKeyKnown(key, getKnownKeys(), true); + var instance = getInstance(); + instance.put(key, value); + return getBuilderAfterAdditionalProperty(instance); + } + } + + public static class Schema2MapBuilder implements GenericBuilder>, SetterForAdditionalProperties2 { + private final Map instance; + private static final Set knownKeys = Set.of(); + public Set getKnownKeys() { + return knownKeys; + } + public Schema2MapBuilder() { + this.instance = new LinkedHashMap<>(); + } + public Map build() { + return instance; + } + public Map getInstance() { + return instance; + } + public Schema2MapBuilder getBuilderAfterAdditionalProperty(Map instance) { + return this; + } + } + + + public sealed interface Schema2Boxed permits Schema2BoxedMap { + @Nullable Object getData(); + } + + public record Schema2BoxedMap(Schema2Map data) implements Schema2Boxed { + @Override + public @Nullable Object getData() { + return data; + } + } + + + public static class Schema2 extends JsonSchema implements MapSchemaValidator { + private static @Nullable Schema2 instance = null; + + protected Schema2() { + super(new JsonSchemaInfo() + .type(Set.of(Map.class)) + .additionalProperties(AdditionalProperties2.class) + ); + } + + public static Schema2 getInstance() { + if (instance == null) { + instance = new Schema2(); + } + return instance; + } + + 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 RuntimeException("Invalid non-string key value"); + } + String propertyName = (String) entryKey; + List propertyPathToItem = new ArrayList<>(pathToItem); + propertyPathToItem.add(propertyName); + Object value = entry.getValue(); + LinkedHashMap, Nothing?> schemas = pathToSchemas.get(propertyPathToItem); + if (schemas == null) { + throw new RuntimeException("Validation result is invalid, schemas must exist for a pathToItem"); + } + JsonSchema propertySchema = schemas.entrySet().iterator().next().getKey(); + @Nullable Object propertyInstance = propertySchema.getNewInstance(value, propertyPathToItem, pathToSchemas); + properties.put(propertyName, propertyInstance); + } + FrozenMap<@Nullable Object> castProperties = new FrozenMap<>(properties); + return new Schema2Map(castProperties); + } + + 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); + SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().build())); + ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, new PathToSchemasMap(), new LinkedHashSet<>()); + PathToSchemasMap pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet); + return getNewInstance(castArg, validationMetadata.pathToItem(), pathToSchemasMap); + } + + + @Override + public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws 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"); + } + @Override + public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { + if (arg instanceof Map) { + return getNewInstance((Map) arg, pathToItem, pathToSchemas); + } + 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 { + return new Schema2BoxedMap(validate(arg, configuration)); + } + @Override + public Schema2Boxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { + 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"); + } + } + + + public sealed interface AdditionalPropertiesSchema1Boxed permits AdditionalPropertiesSchema1BoxedMap { + @Nullable Object getData(); + } + + public record AdditionalPropertiesSchema1BoxedMap(FrozenMap<@Nullable Object> data) implements AdditionalPropertiesSchema1Boxed { + @Override + public @Nullable Object getData() { + return data; + } + } + + + public static class AdditionalPropertiesSchema1 extends JsonSchema implements MapSchemaValidator, AdditionalPropertiesSchema1BoxedMap> { + /* + NOTE: This class is auto generated by OpenAPI JSON Schema Generator. + Ref: https://github.com/openapi-json-schema-tools/openapi-json-schema-generator + + Do not edit the class manually. + */ + private static @Nullable AdditionalPropertiesSchema1 instance = null; + + protected AdditionalPropertiesSchema1() { + super(new JsonSchemaInfo() + .type(Set.of(Map.class)) + .allOf(List.of( + Schema0.class, + Schema1.class, + Schema2.class + )) + ); + } + + public static AdditionalPropertiesSchema1 getInstance() { + if (instance == null) { + instance = new AdditionalPropertiesSchema1(); + } + return instance; + } + + 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 RuntimeException("Invalid non-string key value"); + } + String propertyName = (String) entryKey; + List propertyPathToItem = new ArrayList<>(pathToItem); + propertyPathToItem.add(propertyName); + Object value = entry.getValue(); + LinkedHashMap, Nothing?> schemas = pathToSchemas.get(propertyPathToItem); + if (schemas == null) { + throw new RuntimeException("Validation result is invalid, schemas must exist for a pathToItem"); + } + JsonSchema propertySchema = schemas.entrySet().iterator().next().getKey(); + @Nullable Object propertyInstance = propertySchema.getNewInstance(value, propertyPathToItem, pathToSchemas); + properties.put(propertyName, propertyInstance); + } + FrozenMap<@Nullable Object> castProperties = new FrozenMap<>(properties); + return castProperties; + } + + public FrozenMap<@Nullable Object> validate(Map arg, SchemaConfiguration configuration) throws ValidationException { + Set> pathSet = new HashSet<>(); + List pathToItem = List.of("args[0"); + Map castArg = castToAllowedTypes(arg, pathToItem, pathSet); + SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().build())); + ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, new PathToSchemasMap(), new LinkedHashSet<>()); + PathToSchemasMap pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet); + return getNewInstance(castArg, validationMetadata.pathToItem(), pathToSchemasMap); + } + + + @Override + public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws 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"); + } + @Override + public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { + if (arg instanceof Map) { + return getNewInstance((Map) arg, pathToItem, pathToSchemas); + } + 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 { + return new AdditionalPropertiesSchema1BoxedMap(validate(arg, configuration)); + } + @Override + public AdditionalPropertiesSchema1Boxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { + 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"); + } + } + +} diff --git a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/schemas/AdditionalPropertiesWithArrayOfEnums.kt b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/schemas/AdditionalPropertiesWithArrayOfEnums.kt new file mode 100644 index 00000000000..8630730c47b --- /dev/null +++ b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/schemas/AdditionalPropertiesWithArrayOfEnums.kt @@ -0,0 +1,310 @@ +package org.openapijsonschematools.client.components.schemas; +import java.util.ArrayList; +import java.util.HashSet; +import java.util.LinkedHashMap; +import java.util.LinkedHashSet; +import java.util.List; +import java.util.Map; +import java.util.Objects; +import java.util.Set; +import org.checkerframework.checker.nullness.qual.Nullable; +import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags; +import org.openapijsonschematools.client.configurations.SchemaConfiguration; +import org.openapijsonschematools.client.exceptions.InvalidAdditionalPropertyException; +import org.openapijsonschematools.client.exceptions.UnsetPropertyException; +import org.openapijsonschematools.client.exceptions.ValidationException; +import org.openapijsonschematools.client.schemas.GenericBuilder; +import org.openapijsonschematools.client.schemas.validation.FrozenList; +import org.openapijsonschematools.client.schemas.validation.FrozenMap; +import org.openapijsonschematools.client.schemas.validation.JsonSchema; +import org.openapijsonschematools.client.schemas.validation.JsonSchemaInfo; +import org.openapijsonschematools.client.schemas.validation.ListSchemaValidator; +import org.openapijsonschematools.client.schemas.validation.MapSchemaValidator; +import org.openapijsonschematools.client.schemas.validation.MapUtils; +import org.openapijsonschematools.client.schemas.validation.PathToSchemasMap; +import org.openapijsonschematools.client.schemas.validation.ValidationMetadata; + +public class AdditionalPropertiesWithArrayOfEnums { + // nest classes so all schemas and input/output classes can be public + + + public static class AdditionalPropertiesList extends FrozenList { + protected AdditionalPropertiesList(FrozenList m) { + super(m); + } + public static AdditionalPropertiesList of(List arg, SchemaConfiguration configuration) throws ValidationException { + return AdditionalProperties.getInstance().validate(arg, configuration); + } + } + + public static class AdditionalPropertiesListBuilder { + // class to build List + private final List list; + + public AdditionalPropertiesListBuilder() { + list = new ArrayList<>(); + } + + public AdditionalPropertiesListBuilder(List list) { + this.list = list; + } + + public AdditionalPropertiesListBuilder add(String item) { + list.add(item); + return this; + } + + public AdditionalPropertiesListBuilder add(EnumClass.StringEnumClassEnums item) { + list.add(item.value()); + return this; + } + + public List build() { + return list; + } + } + + + public sealed interface AdditionalPropertiesBoxed permits AdditionalPropertiesBoxedList { + @Nullable Object getData(); + } + + public record AdditionalPropertiesBoxedList(AdditionalPropertiesList data) implements AdditionalPropertiesBoxed { + @Override + public @Nullable Object getData() { + return data; + } + } + + + + public static class AdditionalProperties extends JsonSchema implements ListSchemaValidator { + private static @Nullable AdditionalProperties instance = null; + + protected AdditionalProperties() { + super(new JsonSchemaInfo() + .type(Set.of(List.class)) + .items(EnumClass.EnumClass1.class) + ); + } + + public static AdditionalProperties getInstance() { + if (instance == null) { + instance = new AdditionalProperties(); + } + return instance; + } + + @Override + public AdditionalPropertiesList getNewInstance(List arg, List pathToItem, PathToSchemasMap pathToSchemas) { + List items = new ArrayList<>(); + int i = 0; + for (Object item: arg) { + List itemPathToItem = new ArrayList<>(pathToItem); + itemPathToItem.add(i); + LinkedHashMap, Nothing?> schemas = pathToSchemas.get(itemPathToItem); + if (schemas == null) { + throw new RuntimeException("Validation 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"); + } + items.add((String) itemInstance); + i += 1; + } + FrozenList newInstanceItems = new FrozenList<>(items); + return new AdditionalPropertiesList(newInstanceItems); + } + + 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); + SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().build())); + ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, new PathToSchemasMap(), new LinkedHashSet<>()); + PathToSchemasMap pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet); + return getNewInstance(castArg, validationMetadata.pathToItem(), pathToSchemasMap); + } + + @Override + public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws 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"); + } + @Override + public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { + 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"); + } + @Override + 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 { + 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"); + } + } + + public static class AdditionalPropertiesWithArrayOfEnumsMap extends FrozenMap { + protected AdditionalPropertiesWithArrayOfEnumsMap(FrozenMap m) { + super(m); + } + public static final Set requiredKeys = Set.of(); + public static final Set optionalKeys = Set.of(); + public static AdditionalPropertiesWithArrayOfEnumsMap of(Map> arg, SchemaConfiguration configuration) throws ValidationException { + return AdditionalPropertiesWithArrayOfEnums1.getInstance().validate(arg, configuration); + } + + public AdditionalPropertiesList getAdditionalProperty(String name) throws UnsetPropertyException { + var value = getOrThrow(name); + if (!(value instanceof AdditionalPropertiesList)) { + throw new RuntimeException("Invalid value stored for " + name); + } + return (AdditionalPropertiesList) value; + } + } + + public interface SetterForAdditionalProperties { + Set getKnownKeys(); + Map> getInstance(); + T getBuilderAfterAdditionalProperty(Map> instance); + + default T additionalProperty(String key, List value) throws InvalidAdditionalPropertyException { + MapUtils.throwIfKeyKnown(key, getKnownKeys(), true); + var instance = getInstance(); + instance.put(key, value); + return getBuilderAfterAdditionalProperty(instance); + } + } + + public static class AdditionalPropertiesWithArrayOfEnumsMapBuilder implements GenericBuilder>>, SetterForAdditionalProperties { + private final Map> instance; + private static final Set knownKeys = Set.of(); + public Set getKnownKeys() { + return knownKeys; + } + public AdditionalPropertiesWithArrayOfEnumsMapBuilder() { + this.instance = new LinkedHashMap<>(); + } + public Map> build() { + return instance; + } + public Map> getInstance() { + return instance; + } + public AdditionalPropertiesWithArrayOfEnumsMapBuilder getBuilderAfterAdditionalProperty(Map> instance) { + return this; + } + } + + + public sealed interface AdditionalPropertiesWithArrayOfEnums1Boxed permits AdditionalPropertiesWithArrayOfEnums1BoxedMap { + @Nullable Object getData(); + } + + public record AdditionalPropertiesWithArrayOfEnums1BoxedMap(AdditionalPropertiesWithArrayOfEnumsMap data) implements AdditionalPropertiesWithArrayOfEnums1Boxed { + @Override + public @Nullable Object getData() { + return data; + } + } + + + public static class AdditionalPropertiesWithArrayOfEnums1 extends JsonSchema implements MapSchemaValidator { + /* + NOTE: This class is auto generated by OpenAPI JSON Schema Generator. + Ref: https://github.com/openapi-json-schema-tools/openapi-json-schema-generator + + Do not edit the class manually. + */ + private static @Nullable AdditionalPropertiesWithArrayOfEnums1 instance = null; + + protected AdditionalPropertiesWithArrayOfEnums1() { + super(new JsonSchemaInfo() + .type(Set.of(Map.class)) + .additionalProperties(AdditionalProperties.class) + ); + } + + public static AdditionalPropertiesWithArrayOfEnums1 getInstance() { + if (instance == null) { + instance = new AdditionalPropertiesWithArrayOfEnums1(); + } + return instance; + } + + 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 RuntimeException("Invalid non-string key value"); + } + String propertyName = (String) entryKey; + List propertyPathToItem = new ArrayList<>(pathToItem); + propertyPathToItem.add(propertyName); + Object value = entry.getValue(); + LinkedHashMap, Nothing?> schemas = pathToSchemas.get(propertyPathToItem); + if (schemas == null) { + throw new RuntimeException("Validation 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"); + } + properties.put(propertyName, (AdditionalPropertiesList) propertyInstance); + } + FrozenMap castProperties = new FrozenMap<>(properties); + return new AdditionalPropertiesWithArrayOfEnumsMap(castProperties); + } + + 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); + SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().build())); + ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, new PathToSchemasMap(), new LinkedHashSet<>()); + PathToSchemasMap pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet); + return getNewInstance(castArg, validationMetadata.pathToItem(), pathToSchemasMap); + } + + + @Override + public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws 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"); + } + @Override + public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { + if (arg instanceof Map) { + return getNewInstance((Map) arg, pathToItem, pathToSchemas); + } + 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 { + return new AdditionalPropertiesWithArrayOfEnums1BoxedMap(validate(arg, configuration)); + } + @Override + public AdditionalPropertiesWithArrayOfEnums1Boxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { + 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"); + } + } + +} diff --git a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/schemas/Address.kt b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/schemas/Address.kt new file mode 100644 index 00000000000..3c8f31022f0 --- /dev/null +++ b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/schemas/Address.kt @@ -0,0 +1,210 @@ +package org.openapijsonschematools.client.components.schemas; +import java.util.ArrayList; +import java.util.HashSet; +import java.util.LinkedHashMap; +import java.util.LinkedHashSet; +import java.util.List; +import java.util.Map; +import java.util.Objects; +import java.util.Set; +import org.checkerframework.checker.nullness.qual.Nullable; +import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags; +import org.openapijsonschematools.client.configurations.SchemaConfiguration; +import org.openapijsonschematools.client.exceptions.InvalidAdditionalPropertyException; +import org.openapijsonschematools.client.exceptions.UnsetPropertyException; +import org.openapijsonschematools.client.exceptions.ValidationException; +import org.openapijsonschematools.client.schemas.GenericBuilder; +import org.openapijsonschematools.client.schemas.IntJsonSchema; +import org.openapijsonschematools.client.schemas.validation.FrozenMap; +import org.openapijsonschematools.client.schemas.validation.JsonSchema; +import org.openapijsonschematools.client.schemas.validation.JsonSchemaInfo; +import org.openapijsonschematools.client.schemas.validation.MapSchemaValidator; +import org.openapijsonschematools.client.schemas.validation.MapUtils; +import org.openapijsonschematools.client.schemas.validation.PathToSchemasMap; +import org.openapijsonschematools.client.schemas.validation.ValidationMetadata; + +public class Address { + // nest classes so all schemas and input/output classes can be public + + + public static class AdditionalProperties extends IntJsonSchema.IntJsonSchema1 { + private static @Nullable AdditionalProperties instance = null; + public static AdditionalProperties getInstance() { + if (instance == null) { + instance = new AdditionalProperties(); + } + return instance; + } + } + + + public static class AddressMap extends FrozenMap { + protected AddressMap(FrozenMap m) { + super(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 { + return Address1.getInstance().validate(arg, configuration); + } + + public Number getAdditionalProperty(String name) throws UnsetPropertyException { + return getOrThrow(name); + } + } + + public interface SetterForAdditionalProperties { + Set getKnownKeys(); + Map getInstance(); + T getBuilderAfterAdditionalProperty(Map instance); + + default T additionalProperty(String key, int value) throws InvalidAdditionalPropertyException { + MapUtils.throwIfKeyKnown(key, getKnownKeys(), true); + var instance = getInstance(); + instance.put(key, value); + return getBuilderAfterAdditionalProperty(instance); + } + + default T additionalProperty(String key, float value) throws InvalidAdditionalPropertyException { + MapUtils.throwIfKeyKnown(key, getKnownKeys(), true); + var instance = getInstance(); + instance.put(key, value); + return getBuilderAfterAdditionalProperty(instance); + } + + default T additionalProperty(String key, long value) throws InvalidAdditionalPropertyException { + MapUtils.throwIfKeyKnown(key, getKnownKeys(), true); + var instance = getInstance(); + instance.put(key, value); + return getBuilderAfterAdditionalProperty(instance); + } + + default T additionalProperty(String key, double value) throws InvalidAdditionalPropertyException { + MapUtils.throwIfKeyKnown(key, getKnownKeys(), true); + var instance = getInstance(); + instance.put(key, value); + return getBuilderAfterAdditionalProperty(instance); + } + } + + public static class AddressMapBuilder implements GenericBuilder>, SetterForAdditionalProperties { + private final Map instance; + private static final Set knownKeys = Set.of(); + public Set getKnownKeys() { + return knownKeys; + } + public AddressMapBuilder() { + this.instance = new LinkedHashMap<>(); + } + public Map build() { + return instance; + } + public Map getInstance() { + return instance; + } + public AddressMapBuilder getBuilderAfterAdditionalProperty(Map instance) { + return this; + } + } + + + public sealed interface Address1Boxed permits Address1BoxedMap { + @Nullable Object getData(); + } + + public record Address1BoxedMap(AddressMap data) implements Address1Boxed { + @Override + public @Nullable Object getData() { + return data; + } + } + + + public static class Address1 extends JsonSchema implements MapSchemaValidator { + /* + NOTE: This class is auto generated by OpenAPI JSON Schema Generator. + Ref: https://github.com/openapi-json-schema-tools/openapi-json-schema-generator + + Do not edit the class manually. + */ + private static @Nullable Address1 instance = null; + + protected Address1() { + super(new JsonSchemaInfo() + .type(Set.of(Map.class)) + .additionalProperties(AdditionalProperties.class) + ); + } + + public static Address1 getInstance() { + if (instance == null) { + instance = new Address1(); + } + return instance; + } + + 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 RuntimeException("Invalid non-string key value"); + } + String propertyName = (String) entryKey; + List propertyPathToItem = new ArrayList<>(pathToItem); + propertyPathToItem.add(propertyName); + Object value = entry.getValue(); + LinkedHashMap, Nothing?> schemas = pathToSchemas.get(propertyPathToItem); + if (schemas == null) { + throw new RuntimeException("Validation 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"); + } + properties.put(propertyName, (Number) propertyInstance); + } + FrozenMap castProperties = new FrozenMap<>(properties); + return new AddressMap(castProperties); + } + + 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); + SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().build())); + ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, new PathToSchemasMap(), new LinkedHashSet<>()); + PathToSchemasMap pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet); + return getNewInstance(castArg, validationMetadata.pathToItem(), pathToSchemasMap); + } + + + @Override + public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws 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"); + } + @Override + public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { + if (arg instanceof Map) { + return getNewInstance((Map) arg, pathToItem, pathToSchemas); + } + 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 { + return new Address1BoxedMap(validate(arg, configuration)); + } + @Override + public Address1Boxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { + 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"); + } + } + +} diff --git a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/schemas/Animal.kt b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/schemas/Animal.kt new file mode 100644 index 00000000000..2d4a97082e9 --- /dev/null +++ b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/schemas/Animal.kt @@ -0,0 +1,323 @@ +package org.openapijsonschematools.client.components.schemas; +import java.util.ArrayList; +import java.util.HashSet; +import java.util.LinkedHashMap; +import java.util.LinkedHashSet; +import java.util.List; +import java.util.Map; +import java.util.Objects; +import java.util.Set; +import org.checkerframework.checker.nullness.qual.Nullable; +import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags; +import org.openapijsonschematools.client.configurations.SchemaConfiguration; +import org.openapijsonschematools.client.exceptions.InvalidAdditionalPropertyException; +import org.openapijsonschematools.client.exceptions.UnsetPropertyException; +import org.openapijsonschematools.client.exceptions.ValidationException; +import org.openapijsonschematools.client.schemas.GenericBuilder; +import org.openapijsonschematools.client.schemas.StringJsonSchema; +import org.openapijsonschematools.client.schemas.UnsetAddPropsSetter; +import org.openapijsonschematools.client.schemas.validation.DefaultValueMethod; +import org.openapijsonschematools.client.schemas.validation.FrozenMap; +import org.openapijsonschematools.client.schemas.validation.JsonSchema; +import org.openapijsonschematools.client.schemas.validation.JsonSchemaInfo; +import org.openapijsonschematools.client.schemas.validation.MapSchemaValidator; +import org.openapijsonschematools.client.schemas.validation.PathToSchemasMap; +import org.openapijsonschematools.client.schemas.validation.PropertyEntry; +import org.openapijsonschematools.client.schemas.validation.StringSchemaValidator; +import org.openapijsonschematools.client.schemas.validation.ValidationMetadata; + +public class Animal { + // nest classes so all schemas and input/output classes can be public + + + public static class ClassName extends StringJsonSchema.StringJsonSchema1 { + private static @Nullable ClassName instance = null; + public static ClassName getInstance() { + if (instance == null) { + instance = new ClassName(); + } + return instance; + } + } + + + public sealed interface ColorBoxed permits ColorBoxedString { + @Nullable Object getData(); + } + + public record ColorBoxedString(String data) implements ColorBoxed { + @Override + public @Nullable Object getData() { + return data; + } + } + + + + public static class Color extends JsonSchema implements StringSchemaValidator, DefaultValueMethod { + private static @Nullable Color instance = null; + + protected Color() { + super(new JsonSchemaInfo() + .type(Set.of( + String.class + )) + .defaultValue("red") + ); + } + + public static Color getInstance() { + if (instance == null) { + instance = new Color(); + } + return instance; + } + + @Override + public String validate(String arg, SchemaConfiguration configuration) throws ValidationException { + Set> pathSet = new HashSet<>(); + List pathToItem = List.of("args[0"); + String castArg = castToAllowedTypes(arg, pathToItem, pathSet); + SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().build())); + ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, new PathToSchemasMap(), new LinkedHashSet<>()); + getPathToSchemas(this, castArg, validationMetadata, pathSet); + return castArg; + } + + @Override + public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws 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"); + } + @Override + public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { + 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"); + } + public String defaultValue() throws ValidationException { + if (defaultValue instanceof String) { + return (String) defaultValue; + } + throw new ValidationException("Invalid type stored in defaultValue"); + } + @Override + 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 { + 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"); + } + } + + public static class AnimalMap extends FrozenMap<@Nullable Object> { + protected AnimalMap(FrozenMap<@Nullable Object> m) { + super(m); + } + public static final Set requiredKeys = Set.of( + "className" + ); + public static final Set optionalKeys = Set.of( + "color" + ); + public static AnimalMap of(Map arg, SchemaConfiguration configuration) throws ValidationException { + return Animal1.getInstance().validate(arg, configuration); + } + + public String className() { + @Nullable Object value = get("className"); + if (!(value instanceof String)) { + throw new RuntimeException("Invalid value stored for className"); + } + return (String) value; + } + + public String color() throws UnsetPropertyException { + String key = "color"; + throwIfKeyNotPresent(key); + @Nullable Object value = get(key); + if (!(value instanceof String)) { + throw new RuntimeException("Invalid value stored for color"); + } + return (String) value; + } + + public @Nullable Object getAdditionalProperty(String name) throws UnsetPropertyException, InvalidAdditionalPropertyException { + throwIfKeyKnown(name, requiredKeys, optionalKeys); + throwIfKeyNotPresent(name); + return get(name); + } + } + + public interface SetterForClassName { + Map getInstance(); + T getBuilderAfterClassName(Map instance); + + default T className(String value) { + var instance = getInstance(); + instance.put("className", value); + return getBuilderAfterClassName(instance); + } + } + + public interface SetterForColor { + Map getInstance(); + T getBuilderAfterColor(Map instance); + + default T color(String value) { + var instance = getInstance(); + instance.put("color", value); + return getBuilderAfterColor(instance); + } + } + + public static class AnimalMap0Builder extends UnsetAddPropsSetter implements GenericBuilder>, SetterForColor { + private final Map instance; + private static final Set knownKeys = Set.of( + "className", + "color" + ); + public Set getKnownKeys() { + return knownKeys; + } + public AnimalMap0Builder(Map instance) { + this.instance = instance; + } + public Map build() { + return instance; + } + public Map getInstance() { + return instance; + } + public AnimalMap0Builder getBuilderAfterColor(Map instance) { + return this; + } + public AnimalMap0Builder getBuilderAfterAdditionalProperty(Map instance) { + return this; + } + } + + public static class AnimalMapBuilder implements SetterForClassName { + private final Map instance; + public AnimalMapBuilder() { + this.instance = new LinkedHashMap<>(); + } + public Map getInstance() { + return instance; + } + public AnimalMap0Builder getBuilderAfterClassName(Map instance) { + return new AnimalMap0Builder(instance); + } + } + + + public sealed interface Animal1Boxed permits Animal1BoxedMap { + @Nullable Object getData(); + } + + public record Animal1BoxedMap(AnimalMap data) implements Animal1Boxed { + @Override + public @Nullable Object getData() { + return data; + } + } + + + public static class Animal1 extends JsonSchema implements MapSchemaValidator { + /* + NOTE: This class is auto generated by OpenAPI JSON Schema Generator. + Ref: https://github.com/openapi-json-schema-tools/openapi-json-schema-generator + + Do not edit the class manually. + */ + private static @Nullable Animal1 instance = null; + + protected Animal1() { + super(new JsonSchemaInfo() + .type(Set.of(Map.class)) + .properties(Map.ofEntries( + new PropertyEntry("className", ClassName.class), + new PropertyEntry("color", Color.class) + )) + .required(Set.of( + "className" + )) + ); + } + + public static Animal1 getInstance() { + if (instance == null) { + instance = new Animal1(); + } + return instance; + } + + 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 RuntimeException("Invalid non-string key value"); + } + String propertyName = (String) entryKey; + List propertyPathToItem = new ArrayList<>(pathToItem); + propertyPathToItem.add(propertyName); + Object value = entry.getValue(); + LinkedHashMap, Nothing?> schemas = pathToSchemas.get(propertyPathToItem); + if (schemas == null) { + throw new RuntimeException("Validation result is invalid, schemas must exist for a pathToItem"); + } + JsonSchema propertySchema = schemas.entrySet().iterator().next().getKey(); + @Nullable Object propertyInstance = propertySchema.getNewInstance(value, propertyPathToItem, pathToSchemas); + properties.put(propertyName, propertyInstance); + } + FrozenMap<@Nullable Object> castProperties = new FrozenMap<>(properties); + return new AnimalMap(castProperties); + } + + 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); + SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().build())); + ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, new PathToSchemasMap(), new LinkedHashSet<>()); + PathToSchemasMap pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet); + return getNewInstance(castArg, validationMetadata.pathToItem(), pathToSchemasMap); + } + + + @Override + public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws 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"); + } + @Override + public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { + if (arg instanceof Map) { + return getNewInstance((Map) arg, pathToItem, pathToSchemas); + } + 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 { + return new Animal1BoxedMap(validate(arg, configuration)); + } + @Override + public Animal1Boxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { + 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"); + } + } + +} diff --git a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/schemas/AnimalFarm.kt b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/schemas/AnimalFarm.kt new file mode 100644 index 00000000000..c837ba2ce71 --- /dev/null +++ b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/schemas/AnimalFarm.kt @@ -0,0 +1,153 @@ +package org.openapijsonschematools.client.components.schemas; +import java.util.ArrayList; +import java.util.HashSet; +import java.util.LinkedHashMap; +import java.util.LinkedHashSet; +import java.util.List; +import java.util.Map; +import java.util.Objects; +import java.util.Set; +import org.checkerframework.checker.nullness.qual.Nullable; +import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags; +import org.openapijsonschematools.client.configurations.SchemaConfiguration; +import org.openapijsonschematools.client.exceptions.ValidationException; +import org.openapijsonschematools.client.schemas.validation.FrozenList; +import org.openapijsonschematools.client.schemas.validation.FrozenMap; +import org.openapijsonschematools.client.schemas.validation.JsonSchema; +import org.openapijsonschematools.client.schemas.validation.JsonSchemaInfo; +import org.openapijsonschematools.client.schemas.validation.ListSchemaValidator; +import org.openapijsonschematools.client.schemas.validation.PathToSchemasMap; +import org.openapijsonschematools.client.schemas.validation.ValidationMetadata; + +public class AnimalFarm { + // nest classes so all schemas and input/output classes can be public + + + public static class AnimalFarmList extends FrozenList { + protected AnimalFarmList(FrozenList m) { + super(m); + } + public static AnimalFarmList of(List> arg, SchemaConfiguration configuration) throws ValidationException { + return AnimalFarm1.getInstance().validate(arg, configuration); + } + } + + public static class AnimalFarmListBuilder { + // class to build List> + private final List> list; + + public AnimalFarmListBuilder() { + list = new ArrayList<>(); + } + + public AnimalFarmListBuilder(List> list) { + this.list = list; + } + + public AnimalFarmListBuilder add(Map item) { + list.add(item); + return this; + } + + public List> build() { + return list; + } + } + + + public sealed interface AnimalFarm1Boxed permits AnimalFarm1BoxedList { + @Nullable Object getData(); + } + + public record AnimalFarm1BoxedList(AnimalFarmList data) implements AnimalFarm1Boxed { + @Override + public @Nullable Object getData() { + return data; + } + } + + + + public static class AnimalFarm1 extends JsonSchema implements ListSchemaValidator { + /* + NOTE: This class is auto generated by OpenAPI JSON Schema Generator. + Ref: https://github.com/openapi-json-schema-tools/openapi-json-schema-generator + + Do not edit the class manually. + */ + private static @Nullable AnimalFarm1 instance = null; + + protected AnimalFarm1() { + super(new JsonSchemaInfo() + .type(Set.of(List.class)) + .items(Animal.Animal1.class) + ); + } + + public static AnimalFarm1 getInstance() { + if (instance == null) { + instance = new AnimalFarm1(); + } + return instance; + } + + @Override + public AnimalFarmList getNewInstance(List arg, List pathToItem, PathToSchemasMap pathToSchemas) { + List items = new ArrayList<>(); + int i = 0; + for (Object item: arg) { + List itemPathToItem = new ArrayList<>(pathToItem); + itemPathToItem.add(i); + LinkedHashMap, Nothing?> schemas = pathToSchemas.get(itemPathToItem); + if (schemas == null) { + throw new RuntimeException("Validation 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"); + } + items.add((Animal.AnimalMap) itemInstance); + i += 1; + } + FrozenList newInstanceItems = new FrozenList<>(items); + return new AnimalFarmList(newInstanceItems); + } + + 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); + SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().build())); + ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, new PathToSchemasMap(), new LinkedHashSet<>()); + PathToSchemasMap pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet); + return getNewInstance(castArg, validationMetadata.pathToItem(), pathToSchemasMap); + } + + @Override + public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws 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"); + } + @Override + public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { + 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"); + } + @Override + 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 { + 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"); + } + } +} diff --git a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/schemas/AnyTypeAndFormat.kt b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/schemas/AnyTypeAndFormat.kt new file mode 100644 index 00000000000..6ecf522580f --- /dev/null +++ b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/schemas/AnyTypeAndFormat.kt @@ -0,0 +1,3342 @@ +package org.openapijsonschematools.client.components.schemas; +import java.time.LocalDate; +import java.time.ZonedDateTime; +import java.util.ArrayList; +import java.util.HashSet; +import java.util.LinkedHashMap; +import java.util.LinkedHashSet; +import java.util.List; +import java.util.Map; +import java.util.Objects; +import java.util.Set; +import java.util.UUID; +import org.checkerframework.checker.nullness.qual.Nullable; +import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags; +import org.openapijsonschematools.client.configurations.SchemaConfiguration; +import org.openapijsonschematools.client.exceptions.InvalidAdditionalPropertyException; +import org.openapijsonschematools.client.exceptions.UnsetPropertyException; +import org.openapijsonschematools.client.exceptions.ValidationException; +import org.openapijsonschematools.client.schemas.GenericBuilder; +import org.openapijsonschematools.client.schemas.UnsetAddPropsSetter; +import org.openapijsonschematools.client.schemas.validation.BooleanSchemaValidator; +import org.openapijsonschematools.client.schemas.validation.FrozenList; +import org.openapijsonschematools.client.schemas.validation.FrozenMap; +import org.openapijsonschematools.client.schemas.validation.JsonSchema; +import org.openapijsonschematools.client.schemas.validation.JsonSchemaInfo; +import org.openapijsonschematools.client.schemas.validation.ListSchemaValidator; +import org.openapijsonschematools.client.schemas.validation.MapSchemaValidator; +import org.openapijsonschematools.client.schemas.validation.NullSchemaValidator; +import org.openapijsonschematools.client.schemas.validation.NumberSchemaValidator; +import org.openapijsonschematools.client.schemas.validation.PathToSchemasMap; +import org.openapijsonschematools.client.schemas.validation.PropertyEntry; +import org.openapijsonschematools.client.schemas.validation.StringSchemaValidator; +import org.openapijsonschematools.client.schemas.validation.ValidationMetadata; + +public class AnyTypeAndFormat { + // nest classes so all schemas and input/output classes can be public + + + public sealed interface UuidSchemaBoxed permits UuidSchemaBoxedVoid, UuidSchemaBoxedBoolean, UuidSchemaBoxedNumber, UuidSchemaBoxedString, UuidSchemaBoxedList, UuidSchemaBoxedMap { + @Nullable Object getData(); + } + + public record UuidSchemaBoxedVoid(Nothing? data) implements UuidSchemaBoxed { + @Override + public @Nullable Object getData() { + return data; + } + } + + public record UuidSchemaBoxedBoolean(boolean data) implements UuidSchemaBoxed { + @Override + public @Nullable Object getData() { + return data; + } + } + + public record UuidSchemaBoxedNumber(Number data) implements UuidSchemaBoxed { + @Override + public @Nullable Object getData() { + return data; + } + } + + public record UuidSchemaBoxedString(String data) implements UuidSchemaBoxed { + @Override + public @Nullable Object getData() { + return data; + } + } + + public record UuidSchemaBoxedList(FrozenList<@Nullable Object> data) implements UuidSchemaBoxed { + @Override + public @Nullable Object getData() { + return data; + } + } + + public record UuidSchemaBoxedMap(FrozenMap<@Nullable Object> data) implements UuidSchemaBoxed { + @Override + public @Nullable Object getData() { + return data; + } + } + + + public static class UuidSchema extends JsonSchema implements NullSchemaValidator, BooleanSchemaValidator, NumberSchemaValidator, StringSchemaValidator, ListSchemaValidator, UuidSchemaBoxedList>, MapSchemaValidator, UuidSchemaBoxedMap> { + private static @Nullable UuidSchema instance = null; + + protected UuidSchema() { + super(new JsonSchemaInfo() + .format("uuid") + ); + } + + public static UuidSchema getInstance() { + if (instance == null) { + instance = new UuidSchema(); + } + return instance; + } + + @Override + public Nothing? validate(Nothing? arg, SchemaConfiguration configuration) throws ValidationException { + Set> pathSet = new HashSet<>(); + List pathToItem = List.of("args[0]"); + Nothing? castArg = castToAllowedTypes(arg, pathToItem, pathSet); + SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().build())); + PathToSchemasMap validatedPathToSchemas = new PathToSchemasMap(); + ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, new LinkedHashSet<>()); + getPathToSchemas(this, castArg, validationMetadata, pathSet); + return castArg; + } + + @Override + public boolean validate(boolean arg, SchemaConfiguration configuration) throws ValidationException { + Set> pathSet = new HashSet<>(); + List pathToItem = List.of("args[0]"); + boolean castArg = castToAllowedTypes(arg, pathToItem, pathSet); + SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().build())); + PathToSchemasMap validatedPathToSchemas = new PathToSchemasMap(); + ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, new LinkedHashSet<>()); + getPathToSchemas(this, castArg, validationMetadata, pathSet); + return castArg; + } + + @Override + public Number validate(Number arg, SchemaConfiguration configuration) throws ValidationException { + Set> pathSet = new HashSet<>(); + List pathToItem = List.of("args[0]"); + Number castArg = castToAllowedTypes(arg, pathToItem, pathSet); + SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().build())); + PathToSchemasMap validatedPathToSchemas = new PathToSchemasMap(); + ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, new LinkedHashSet<>()); + getPathToSchemas(this, castArg, validationMetadata, pathSet); + return castArg; + } + + public int validate(int arg, SchemaConfiguration configuration) throws ValidationException { + return (int) validate((Number) arg, configuration); + } + + public long validate(long arg, SchemaConfiguration configuration) throws ValidationException { + return (long) validate((Number) arg, configuration); + } + + public float validate(float arg, SchemaConfiguration configuration) throws ValidationException { + return (float) validate((Number) arg, configuration); + } + + public double validate(double arg, SchemaConfiguration configuration) throws ValidationException { + return (double) validate((Number) arg, configuration); + } + + @Override + public String validate(String arg, SchemaConfiguration configuration) throws ValidationException { + Set> pathSet = new HashSet<>(); + List pathToItem = List.of("args[0]"); + String castArg = castToAllowedTypes(arg, pathToItem, pathSet); + SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().build())); + PathToSchemasMap validatedPathToSchemas = new PathToSchemasMap(); + ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, new LinkedHashSet<>()); + getPathToSchemas(this, castArg, validationMetadata, pathSet); + return castArg; + } + + public String validate(LocalDate arg, SchemaConfiguration configuration) throws ValidationException { + return validate(arg.toString(), configuration); + } + + public String validate(ZonedDateTime arg, SchemaConfiguration configuration) throws ValidationException { + return validate(arg.toString(), configuration); + } + + public String validate(UUID arg, SchemaConfiguration configuration) throws ValidationException { + return validate(arg.toString(), configuration); + } + + @Override + public FrozenList<@Nullable Object> getNewInstance(List arg, List pathToItem, PathToSchemasMap pathToSchemas) { + List<@Nullable Object> items = new ArrayList<>(); + int i = 0; + for (Object item: arg) { + List itemPathToItem = new ArrayList<>(pathToItem); + itemPathToItem.add(i); + LinkedHashMap, Nothing?> schemas = pathToSchemas.get(itemPathToItem); + if (schemas == null) { + throw new RuntimeException("Validation result is invalid, schemas must exist for a pathToItem"); + } + JsonSchema itemSchema = schemas.entrySet().iterator().next().getKey(); + @Nullable Object itemInstance = itemSchema.getNewInstance(item, itemPathToItem, pathToSchemas); + items.add(itemInstance); + i += 1; + } + FrozenList<@Nullable Object> newInstanceItems = new FrozenList<>(items); + return newInstanceItems; + } + + 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); + SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().build())); + ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, new PathToSchemasMap(), new LinkedHashSet<>()); + PathToSchemasMap pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet); + return getNewInstance(castArg, validationMetadata.pathToItem(), pathToSchemasMap); + } + + @Override + 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 RuntimeException("Invalid non-string key value"); + } + String propertyName = (String) entryKey; + List propertyPathToItem = new ArrayList<>(pathToItem); + propertyPathToItem.add(propertyName); + Object value = entry.getValue(); + LinkedHashMap, Nothing?> schemas = pathToSchemas.get(propertyPathToItem); + if (schemas == null) { + throw new RuntimeException("Validation result is invalid, schemas must exist for a pathToItem"); + } + JsonSchema propertySchema = schemas.entrySet().iterator().next().getKey(); + @Nullable Object propertyInstance = propertySchema.getNewInstance(value, propertyPathToItem, pathToSchemas); + properties.put(propertyName, propertyInstance); + } + FrozenMap<@Nullable Object> castProperties = new FrozenMap<>(properties); + return castProperties; + } + + public FrozenMap<@Nullable Object> validate(Map arg, SchemaConfiguration configuration) throws ValidationException { + Set> pathSet = new HashSet<>(); + List pathToItem = List.of("args[0]"); + Map castArg = castToAllowedTypes(arg, pathToItem, pathSet); + SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().build())); + PathToSchemasMap validatedPathToSchemas = new PathToSchemasMap(); + ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, new LinkedHashSet<>()); + PathToSchemasMap pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet); + return getNewInstance(castArg, validationMetadata.pathToItem(), pathToSchemasMap); + } + + @Override + public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { + if (arg == null) { + return validate((Nothing?) null, configuration); + } else if (arg instanceof Boolean) { + boolean boolArg = (Boolean) arg; + return validate(boolArg, configuration); + } else if (arg instanceof Number) { + return validate((Number) arg, configuration); + } else if (arg instanceof String) { + return validate((String) arg, configuration); + } else if (arg instanceof List) { + return validate((List) arg, 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"); + } + @Override + public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { + if (arg == null) { + return getNewInstance((Nothing?) null, pathToItem, pathToSchemas); + } else if (arg instanceof Boolean) { + boolean boolArg = (Boolean) arg; + return getNewInstance(boolArg, pathToItem, pathToSchemas); + } else if (arg instanceof Number) { + return getNewInstance((Number) arg, pathToItem, pathToSchemas); + } else if (arg instanceof String) { + return getNewInstance((String) arg, pathToItem, pathToSchemas); + } else if (arg instanceof List) { + return getNewInstance((List) arg, 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"); + } + @Override + public UuidSchemaBoxedVoid validateAndBox(Nothing? arg, SchemaConfiguration configuration) throws ValidationException { + return new UuidSchemaBoxedVoid(validate(arg, configuration)); + } + @Override + 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 { + return new UuidSchemaBoxedNumber(validate(arg, configuration)); + } + @Override + 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 { + return new UuidSchemaBoxedList(validate(arg, configuration)); + } + @Override + 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 { + if (arg == null) { + Nothing? castArg = (Nothing?) arg; + return validateAndBox(castArg, configuration); + } else if (arg instanceof Boolean booleanArg) { + boolean castArg = booleanArg; + return validateAndBox(castArg, configuration); + } else if (arg instanceof String castArg) { + return validateAndBox(castArg, configuration); + } else if (arg instanceof Number castArg) { + return validateAndBox(castArg, configuration); + } else if (arg instanceof List castArg) { + 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"); + } + } + + public sealed interface DateBoxed permits DateBoxedVoid, DateBoxedBoolean, DateBoxedNumber, DateBoxedString, DateBoxedList, DateBoxedMap { + @Nullable Object getData(); + } + + public record DateBoxedVoid(Nothing? data) implements DateBoxed { + @Override + public @Nullable Object getData() { + return data; + } + } + + public record DateBoxedBoolean(boolean data) implements DateBoxed { + @Override + public @Nullable Object getData() { + return data; + } + } + + public record DateBoxedNumber(Number data) implements DateBoxed { + @Override + public @Nullable Object getData() { + return data; + } + } + + public record DateBoxedString(String data) implements DateBoxed { + @Override + public @Nullable Object getData() { + return data; + } + } + + public record DateBoxedList(FrozenList<@Nullable Object> data) implements DateBoxed { + @Override + public @Nullable Object getData() { + return data; + } + } + + public record DateBoxedMap(FrozenMap<@Nullable Object> data) implements DateBoxed { + @Override + public @Nullable Object getData() { + return data; + } + } + + + public static class Date extends JsonSchema implements NullSchemaValidator, BooleanSchemaValidator, NumberSchemaValidator, StringSchemaValidator, ListSchemaValidator, DateBoxedList>, MapSchemaValidator, DateBoxedMap> { + private static @Nullable Date instance = null; + + protected Date() { + super(new JsonSchemaInfo() + .format("date") + ); + } + + public static Date getInstance() { + if (instance == null) { + instance = new Date(); + } + return instance; + } + + @Override + public Nothing? validate(Nothing? arg, SchemaConfiguration configuration) throws ValidationException { + Set> pathSet = new HashSet<>(); + List pathToItem = List.of("args[0]"); + Nothing? castArg = castToAllowedTypes(arg, pathToItem, pathSet); + SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().build())); + PathToSchemasMap validatedPathToSchemas = new PathToSchemasMap(); + ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, new LinkedHashSet<>()); + getPathToSchemas(this, castArg, validationMetadata, pathSet); + return castArg; + } + + @Override + public boolean validate(boolean arg, SchemaConfiguration configuration) throws ValidationException { + Set> pathSet = new HashSet<>(); + List pathToItem = List.of("args[0]"); + boolean castArg = castToAllowedTypes(arg, pathToItem, pathSet); + SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().build())); + PathToSchemasMap validatedPathToSchemas = new PathToSchemasMap(); + ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, new LinkedHashSet<>()); + getPathToSchemas(this, castArg, validationMetadata, pathSet); + return castArg; + } + + @Override + public Number validate(Number arg, SchemaConfiguration configuration) throws ValidationException { + Set> pathSet = new HashSet<>(); + List pathToItem = List.of("args[0]"); + Number castArg = castToAllowedTypes(arg, pathToItem, pathSet); + SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().build())); + PathToSchemasMap validatedPathToSchemas = new PathToSchemasMap(); + ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, new LinkedHashSet<>()); + getPathToSchemas(this, castArg, validationMetadata, pathSet); + return castArg; + } + + public int validate(int arg, SchemaConfiguration configuration) throws ValidationException { + return (int) validate((Number) arg, configuration); + } + + public long validate(long arg, SchemaConfiguration configuration) throws ValidationException { + return (long) validate((Number) arg, configuration); + } + + public float validate(float arg, SchemaConfiguration configuration) throws ValidationException { + return (float) validate((Number) arg, configuration); + } + + public double validate(double arg, SchemaConfiguration configuration) throws ValidationException { + return (double) validate((Number) arg, configuration); + } + + @Override + public String validate(String arg, SchemaConfiguration configuration) throws ValidationException { + Set> pathSet = new HashSet<>(); + List pathToItem = List.of("args[0]"); + String castArg = castToAllowedTypes(arg, pathToItem, pathSet); + SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().build())); + PathToSchemasMap validatedPathToSchemas = new PathToSchemasMap(); + ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, new LinkedHashSet<>()); + getPathToSchemas(this, castArg, validationMetadata, pathSet); + return castArg; + } + + public String validate(LocalDate arg, SchemaConfiguration configuration) throws ValidationException { + return validate(arg.toString(), configuration); + } + + public String validate(ZonedDateTime arg, SchemaConfiguration configuration) throws ValidationException { + return validate(arg.toString(), configuration); + } + + public String validate(UUID arg, SchemaConfiguration configuration) throws ValidationException { + return validate(arg.toString(), configuration); + } + + @Override + public FrozenList<@Nullable Object> getNewInstance(List arg, List pathToItem, PathToSchemasMap pathToSchemas) { + List<@Nullable Object> items = new ArrayList<>(); + int i = 0; + for (Object item: arg) { + List itemPathToItem = new ArrayList<>(pathToItem); + itemPathToItem.add(i); + LinkedHashMap, Nothing?> schemas = pathToSchemas.get(itemPathToItem); + if (schemas == null) { + throw new RuntimeException("Validation result is invalid, schemas must exist for a pathToItem"); + } + JsonSchema itemSchema = schemas.entrySet().iterator().next().getKey(); + @Nullable Object itemInstance = itemSchema.getNewInstance(item, itemPathToItem, pathToSchemas); + items.add(itemInstance); + i += 1; + } + FrozenList<@Nullable Object> newInstanceItems = new FrozenList<>(items); + return newInstanceItems; + } + + 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); + SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().build())); + ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, new PathToSchemasMap(), new LinkedHashSet<>()); + PathToSchemasMap pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet); + return getNewInstance(castArg, validationMetadata.pathToItem(), pathToSchemasMap); + } + + @Override + 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 RuntimeException("Invalid non-string key value"); + } + String propertyName = (String) entryKey; + List propertyPathToItem = new ArrayList<>(pathToItem); + propertyPathToItem.add(propertyName); + Object value = entry.getValue(); + LinkedHashMap, Nothing?> schemas = pathToSchemas.get(propertyPathToItem); + if (schemas == null) { + throw new RuntimeException("Validation result is invalid, schemas must exist for a pathToItem"); + } + JsonSchema propertySchema = schemas.entrySet().iterator().next().getKey(); + @Nullable Object propertyInstance = propertySchema.getNewInstance(value, propertyPathToItem, pathToSchemas); + properties.put(propertyName, propertyInstance); + } + FrozenMap<@Nullable Object> castProperties = new FrozenMap<>(properties); + return castProperties; + } + + public FrozenMap<@Nullable Object> validate(Map arg, SchemaConfiguration configuration) throws ValidationException { + Set> pathSet = new HashSet<>(); + List pathToItem = List.of("args[0]"); + Map castArg = castToAllowedTypes(arg, pathToItem, pathSet); + SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().build())); + PathToSchemasMap validatedPathToSchemas = new PathToSchemasMap(); + ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, new LinkedHashSet<>()); + PathToSchemasMap pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet); + return getNewInstance(castArg, validationMetadata.pathToItem(), pathToSchemasMap); + } + + @Override + public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { + if (arg == null) { + return validate((Nothing?) null, configuration); + } else if (arg instanceof Boolean) { + boolean boolArg = (Boolean) arg; + return validate(boolArg, configuration); + } else if (arg instanceof Number) { + return validate((Number) arg, configuration); + } else if (arg instanceof String) { + return validate((String) arg, configuration); + } else if (arg instanceof List) { + return validate((List) arg, 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"); + } + @Override + public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { + if (arg == null) { + return getNewInstance((Nothing?) null, pathToItem, pathToSchemas); + } else if (arg instanceof Boolean) { + boolean boolArg = (Boolean) arg; + return getNewInstance(boolArg, pathToItem, pathToSchemas); + } else if (arg instanceof Number) { + return getNewInstance((Number) arg, pathToItem, pathToSchemas); + } else if (arg instanceof String) { + return getNewInstance((String) arg, pathToItem, pathToSchemas); + } else if (arg instanceof List) { + return getNewInstance((List) arg, 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"); + } + @Override + public DateBoxedVoid validateAndBox(Nothing? arg, SchemaConfiguration configuration) throws ValidationException { + return new DateBoxedVoid(validate(arg, configuration)); + } + @Override + 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 { + return new DateBoxedNumber(validate(arg, configuration)); + } + @Override + 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 { + return new DateBoxedList(validate(arg, configuration)); + } + @Override + 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 { + if (arg == null) { + Nothing? castArg = (Nothing?) arg; + return validateAndBox(castArg, configuration); + } else if (arg instanceof Boolean booleanArg) { + boolean castArg = booleanArg; + return validateAndBox(castArg, configuration); + } else if (arg instanceof String castArg) { + return validateAndBox(castArg, configuration); + } else if (arg instanceof Number castArg) { + return validateAndBox(castArg, configuration); + } else if (arg instanceof List castArg) { + 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"); + } + } + + public sealed interface DatetimeBoxed permits DatetimeBoxedVoid, DatetimeBoxedBoolean, DatetimeBoxedNumber, DatetimeBoxedString, DatetimeBoxedList, DatetimeBoxedMap { + @Nullable Object getData(); + } + + public record DatetimeBoxedVoid(Nothing? data) implements DatetimeBoxed { + @Override + public @Nullable Object getData() { + return data; + } + } + + public record DatetimeBoxedBoolean(boolean data) implements DatetimeBoxed { + @Override + public @Nullable Object getData() { + return data; + } + } + + public record DatetimeBoxedNumber(Number data) implements DatetimeBoxed { + @Override + public @Nullable Object getData() { + return data; + } + } + + public record DatetimeBoxedString(String data) implements DatetimeBoxed { + @Override + public @Nullable Object getData() { + return data; + } + } + + public record DatetimeBoxedList(FrozenList<@Nullable Object> data) implements DatetimeBoxed { + @Override + public @Nullable Object getData() { + return data; + } + } + + public record DatetimeBoxedMap(FrozenMap<@Nullable Object> data) implements DatetimeBoxed { + @Override + public @Nullable Object getData() { + return data; + } + } + + + public static class Datetime extends JsonSchema implements NullSchemaValidator, BooleanSchemaValidator, NumberSchemaValidator, StringSchemaValidator, ListSchemaValidator, DatetimeBoxedList>, MapSchemaValidator, DatetimeBoxedMap> { + private static @Nullable Datetime instance = null; + + protected Datetime() { + super(new JsonSchemaInfo() + .format("date-time") + ); + } + + public static Datetime getInstance() { + if (instance == null) { + instance = new Datetime(); + } + return instance; + } + + @Override + public Nothing? validate(Nothing? arg, SchemaConfiguration configuration) throws ValidationException { + Set> pathSet = new HashSet<>(); + List pathToItem = List.of("args[0]"); + Nothing? castArg = castToAllowedTypes(arg, pathToItem, pathSet); + SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().build())); + PathToSchemasMap validatedPathToSchemas = new PathToSchemasMap(); + ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, new LinkedHashSet<>()); + getPathToSchemas(this, castArg, validationMetadata, pathSet); + return castArg; + } + + @Override + public boolean validate(boolean arg, SchemaConfiguration configuration) throws ValidationException { + Set> pathSet = new HashSet<>(); + List pathToItem = List.of("args[0]"); + boolean castArg = castToAllowedTypes(arg, pathToItem, pathSet); + SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().build())); + PathToSchemasMap validatedPathToSchemas = new PathToSchemasMap(); + ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, new LinkedHashSet<>()); + getPathToSchemas(this, castArg, validationMetadata, pathSet); + return castArg; + } + + @Override + public Number validate(Number arg, SchemaConfiguration configuration) throws ValidationException { + Set> pathSet = new HashSet<>(); + List pathToItem = List.of("args[0]"); + Number castArg = castToAllowedTypes(arg, pathToItem, pathSet); + SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().build())); + PathToSchemasMap validatedPathToSchemas = new PathToSchemasMap(); + ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, new LinkedHashSet<>()); + getPathToSchemas(this, castArg, validationMetadata, pathSet); + return castArg; + } + + public int validate(int arg, SchemaConfiguration configuration) throws ValidationException { + return (int) validate((Number) arg, configuration); + } + + public long validate(long arg, SchemaConfiguration configuration) throws ValidationException { + return (long) validate((Number) arg, configuration); + } + + public float validate(float arg, SchemaConfiguration configuration) throws ValidationException { + return (float) validate((Number) arg, configuration); + } + + public double validate(double arg, SchemaConfiguration configuration) throws ValidationException { + return (double) validate((Number) arg, configuration); + } + + @Override + public String validate(String arg, SchemaConfiguration configuration) throws ValidationException { + Set> pathSet = new HashSet<>(); + List pathToItem = List.of("args[0]"); + String castArg = castToAllowedTypes(arg, pathToItem, pathSet); + SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().build())); + PathToSchemasMap validatedPathToSchemas = new PathToSchemasMap(); + ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, new LinkedHashSet<>()); + getPathToSchemas(this, castArg, validationMetadata, pathSet); + return castArg; + } + + public String validate(LocalDate arg, SchemaConfiguration configuration) throws ValidationException { + return validate(arg.toString(), configuration); + } + + public String validate(ZonedDateTime arg, SchemaConfiguration configuration) throws ValidationException { + return validate(arg.toString(), configuration); + } + + public String validate(UUID arg, SchemaConfiguration configuration) throws ValidationException { + return validate(arg.toString(), configuration); + } + + @Override + public FrozenList<@Nullable Object> getNewInstance(List arg, List pathToItem, PathToSchemasMap pathToSchemas) { + List<@Nullable Object> items = new ArrayList<>(); + int i = 0; + for (Object item: arg) { + List itemPathToItem = new ArrayList<>(pathToItem); + itemPathToItem.add(i); + LinkedHashMap, Nothing?> schemas = pathToSchemas.get(itemPathToItem); + if (schemas == null) { + throw new RuntimeException("Validation result is invalid, schemas must exist for a pathToItem"); + } + JsonSchema itemSchema = schemas.entrySet().iterator().next().getKey(); + @Nullable Object itemInstance = itemSchema.getNewInstance(item, itemPathToItem, pathToSchemas); + items.add(itemInstance); + i += 1; + } + FrozenList<@Nullable Object> newInstanceItems = new FrozenList<>(items); + return newInstanceItems; + } + + 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); + SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().build())); + ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, new PathToSchemasMap(), new LinkedHashSet<>()); + PathToSchemasMap pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet); + return getNewInstance(castArg, validationMetadata.pathToItem(), pathToSchemasMap); + } + + @Override + 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 RuntimeException("Invalid non-string key value"); + } + String propertyName = (String) entryKey; + List propertyPathToItem = new ArrayList<>(pathToItem); + propertyPathToItem.add(propertyName); + Object value = entry.getValue(); + LinkedHashMap, Nothing?> schemas = pathToSchemas.get(propertyPathToItem); + if (schemas == null) { + throw new RuntimeException("Validation result is invalid, schemas must exist for a pathToItem"); + } + JsonSchema propertySchema = schemas.entrySet().iterator().next().getKey(); + @Nullable Object propertyInstance = propertySchema.getNewInstance(value, propertyPathToItem, pathToSchemas); + properties.put(propertyName, propertyInstance); + } + FrozenMap<@Nullable Object> castProperties = new FrozenMap<>(properties); + return castProperties; + } + + public FrozenMap<@Nullable Object> validate(Map arg, SchemaConfiguration configuration) throws ValidationException { + Set> pathSet = new HashSet<>(); + List pathToItem = List.of("args[0]"); + Map castArg = castToAllowedTypes(arg, pathToItem, pathSet); + SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().build())); + PathToSchemasMap validatedPathToSchemas = new PathToSchemasMap(); + ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, new LinkedHashSet<>()); + PathToSchemasMap pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet); + return getNewInstance(castArg, validationMetadata.pathToItem(), pathToSchemasMap); + } + + @Override + public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { + if (arg == null) { + return validate((Nothing?) null, configuration); + } else if (arg instanceof Boolean) { + boolean boolArg = (Boolean) arg; + return validate(boolArg, configuration); + } else if (arg instanceof Number) { + return validate((Number) arg, configuration); + } else if (arg instanceof String) { + return validate((String) arg, configuration); + } else if (arg instanceof List) { + return validate((List) arg, 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"); + } + @Override + public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { + if (arg == null) { + return getNewInstance((Nothing?) null, pathToItem, pathToSchemas); + } else if (arg instanceof Boolean) { + boolean boolArg = (Boolean) arg; + return getNewInstance(boolArg, pathToItem, pathToSchemas); + } else if (arg instanceof Number) { + return getNewInstance((Number) arg, pathToItem, pathToSchemas); + } else if (arg instanceof String) { + return getNewInstance((String) arg, pathToItem, pathToSchemas); + } else if (arg instanceof List) { + return getNewInstance((List) arg, 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"); + } + @Override + public DatetimeBoxedVoid validateAndBox(Nothing? arg, SchemaConfiguration configuration) throws ValidationException { + return new DatetimeBoxedVoid(validate(arg, configuration)); + } + @Override + 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 { + return new DatetimeBoxedNumber(validate(arg, configuration)); + } + @Override + 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 { + return new DatetimeBoxedList(validate(arg, configuration)); + } + @Override + 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 { + if (arg == null) { + Nothing? castArg = (Nothing?) arg; + return validateAndBox(castArg, configuration); + } else if (arg instanceof Boolean booleanArg) { + boolean castArg = booleanArg; + return validateAndBox(castArg, configuration); + } else if (arg instanceof String castArg) { + return validateAndBox(castArg, configuration); + } else if (arg instanceof Number castArg) { + return validateAndBox(castArg, configuration); + } else if (arg instanceof List castArg) { + 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"); + } + } + + public sealed interface NumberSchemaBoxed permits NumberSchemaBoxedVoid, NumberSchemaBoxedBoolean, NumberSchemaBoxedNumber, NumberSchemaBoxedString, NumberSchemaBoxedList, NumberSchemaBoxedMap { + @Nullable Object getData(); + } + + public record NumberSchemaBoxedVoid(Nothing? data) implements NumberSchemaBoxed { + @Override + public @Nullable Object getData() { + return data; + } + } + + public record NumberSchemaBoxedBoolean(boolean data) implements NumberSchemaBoxed { + @Override + public @Nullable Object getData() { + return data; + } + } + + public record NumberSchemaBoxedNumber(Number data) implements NumberSchemaBoxed { + @Override + public @Nullable Object getData() { + return data; + } + } + + public record NumberSchemaBoxedString(String data) implements NumberSchemaBoxed { + @Override + public @Nullable Object getData() { + return data; + } + } + + public record NumberSchemaBoxedList(FrozenList<@Nullable Object> data) implements NumberSchemaBoxed { + @Override + public @Nullable Object getData() { + return data; + } + } + + public record NumberSchemaBoxedMap(FrozenMap<@Nullable Object> data) implements NumberSchemaBoxed { + @Override + public @Nullable Object getData() { + return data; + } + } + + + public static class NumberSchema extends JsonSchema implements NullSchemaValidator, BooleanSchemaValidator, NumberSchemaValidator, StringSchemaValidator, ListSchemaValidator, NumberSchemaBoxedList>, MapSchemaValidator, NumberSchemaBoxedMap> { + private static @Nullable NumberSchema instance = null; + + protected NumberSchema() { + super(new JsonSchemaInfo() + .format("number") + ); + } + + public static NumberSchema getInstance() { + if (instance == null) { + instance = new NumberSchema(); + } + return instance; + } + + @Override + public Nothing? validate(Nothing? arg, SchemaConfiguration configuration) throws ValidationException { + Set> pathSet = new HashSet<>(); + List pathToItem = List.of("args[0]"); + Nothing? castArg = castToAllowedTypes(arg, pathToItem, pathSet); + SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().build())); + PathToSchemasMap validatedPathToSchemas = new PathToSchemasMap(); + ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, new LinkedHashSet<>()); + getPathToSchemas(this, castArg, validationMetadata, pathSet); + return castArg; + } + + @Override + public boolean validate(boolean arg, SchemaConfiguration configuration) throws ValidationException { + Set> pathSet = new HashSet<>(); + List pathToItem = List.of("args[0]"); + boolean castArg = castToAllowedTypes(arg, pathToItem, pathSet); + SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().build())); + PathToSchemasMap validatedPathToSchemas = new PathToSchemasMap(); + ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, new LinkedHashSet<>()); + getPathToSchemas(this, castArg, validationMetadata, pathSet); + return castArg; + } + + @Override + public Number validate(Number arg, SchemaConfiguration configuration) throws ValidationException { + Set> pathSet = new HashSet<>(); + List pathToItem = List.of("args[0]"); + Number castArg = castToAllowedTypes(arg, pathToItem, pathSet); + SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().build())); + PathToSchemasMap validatedPathToSchemas = new PathToSchemasMap(); + ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, new LinkedHashSet<>()); + getPathToSchemas(this, castArg, validationMetadata, pathSet); + return castArg; + } + + public int validate(int arg, SchemaConfiguration configuration) throws ValidationException { + return (int) validate((Number) arg, configuration); + } + + public long validate(long arg, SchemaConfiguration configuration) throws ValidationException { + return (long) validate((Number) arg, configuration); + } + + public float validate(float arg, SchemaConfiguration configuration) throws ValidationException { + return (float) validate((Number) arg, configuration); + } + + public double validate(double arg, SchemaConfiguration configuration) throws ValidationException { + return (double) validate((Number) arg, configuration); + } + + @Override + public String validate(String arg, SchemaConfiguration configuration) throws ValidationException { + Set> pathSet = new HashSet<>(); + List pathToItem = List.of("args[0]"); + String castArg = castToAllowedTypes(arg, pathToItem, pathSet); + SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().build())); + PathToSchemasMap validatedPathToSchemas = new PathToSchemasMap(); + ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, new LinkedHashSet<>()); + getPathToSchemas(this, castArg, validationMetadata, pathSet); + return castArg; + } + + public String validate(LocalDate arg, SchemaConfiguration configuration) throws ValidationException { + return validate(arg.toString(), configuration); + } + + public String validate(ZonedDateTime arg, SchemaConfiguration configuration) throws ValidationException { + return validate(arg.toString(), configuration); + } + + public String validate(UUID arg, SchemaConfiguration configuration) throws ValidationException { + return validate(arg.toString(), configuration); + } + + @Override + public FrozenList<@Nullable Object> getNewInstance(List arg, List pathToItem, PathToSchemasMap pathToSchemas) { + List<@Nullable Object> items = new ArrayList<>(); + int i = 0; + for (Object item: arg) { + List itemPathToItem = new ArrayList<>(pathToItem); + itemPathToItem.add(i); + LinkedHashMap, Nothing?> schemas = pathToSchemas.get(itemPathToItem); + if (schemas == null) { + throw new RuntimeException("Validation result is invalid, schemas must exist for a pathToItem"); + } + JsonSchema itemSchema = schemas.entrySet().iterator().next().getKey(); + @Nullable Object itemInstance = itemSchema.getNewInstance(item, itemPathToItem, pathToSchemas); + items.add(itemInstance); + i += 1; + } + FrozenList<@Nullable Object> newInstanceItems = new FrozenList<>(items); + return newInstanceItems; + } + + 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); + SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().build())); + ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, new PathToSchemasMap(), new LinkedHashSet<>()); + PathToSchemasMap pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet); + return getNewInstance(castArg, validationMetadata.pathToItem(), pathToSchemasMap); + } + + @Override + 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 RuntimeException("Invalid non-string key value"); + } + String propertyName = (String) entryKey; + List propertyPathToItem = new ArrayList<>(pathToItem); + propertyPathToItem.add(propertyName); + Object value = entry.getValue(); + LinkedHashMap, Nothing?> schemas = pathToSchemas.get(propertyPathToItem); + if (schemas == null) { + throw new RuntimeException("Validation result is invalid, schemas must exist for a pathToItem"); + } + JsonSchema propertySchema = schemas.entrySet().iterator().next().getKey(); + @Nullable Object propertyInstance = propertySchema.getNewInstance(value, propertyPathToItem, pathToSchemas); + properties.put(propertyName, propertyInstance); + } + FrozenMap<@Nullable Object> castProperties = new FrozenMap<>(properties); + return castProperties; + } + + public FrozenMap<@Nullable Object> validate(Map arg, SchemaConfiguration configuration) throws ValidationException { + Set> pathSet = new HashSet<>(); + List pathToItem = List.of("args[0]"); + Map castArg = castToAllowedTypes(arg, pathToItem, pathSet); + SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().build())); + PathToSchemasMap validatedPathToSchemas = new PathToSchemasMap(); + ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, new LinkedHashSet<>()); + PathToSchemasMap pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet); + return getNewInstance(castArg, validationMetadata.pathToItem(), pathToSchemasMap); + } + + @Override + public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { + if (arg == null) { + return validate((Nothing?) null, configuration); + } else if (arg instanceof Boolean) { + boolean boolArg = (Boolean) arg; + return validate(boolArg, configuration); + } else if (arg instanceof Number) { + return validate((Number) arg, configuration); + } else if (arg instanceof String) { + return validate((String) arg, configuration); + } else if (arg instanceof List) { + return validate((List) arg, 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"); + } + @Override + public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { + if (arg == null) { + return getNewInstance((Nothing?) null, pathToItem, pathToSchemas); + } else if (arg instanceof Boolean) { + boolean boolArg = (Boolean) arg; + return getNewInstance(boolArg, pathToItem, pathToSchemas); + } else if (arg instanceof Number) { + return getNewInstance((Number) arg, pathToItem, pathToSchemas); + } else if (arg instanceof String) { + return getNewInstance((String) arg, pathToItem, pathToSchemas); + } else if (arg instanceof List) { + return getNewInstance((List) arg, 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"); + } + @Override + public NumberSchemaBoxedVoid validateAndBox(Nothing? arg, SchemaConfiguration configuration) throws ValidationException { + return new NumberSchemaBoxedVoid(validate(arg, configuration)); + } + @Override + 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 { + return new NumberSchemaBoxedNumber(validate(arg, configuration)); + } + @Override + 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 { + return new NumberSchemaBoxedList(validate(arg, configuration)); + } + @Override + 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 { + if (arg == null) { + Nothing? castArg = (Nothing?) arg; + return validateAndBox(castArg, configuration); + } else if (arg instanceof Boolean booleanArg) { + boolean castArg = booleanArg; + return validateAndBox(castArg, configuration); + } else if (arg instanceof String castArg) { + return validateAndBox(castArg, configuration); + } else if (arg instanceof Number castArg) { + return validateAndBox(castArg, configuration); + } else if (arg instanceof List castArg) { + 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"); + } + } + + public sealed interface BinaryBoxed permits BinaryBoxedVoid, BinaryBoxedBoolean, BinaryBoxedNumber, BinaryBoxedString, BinaryBoxedList, BinaryBoxedMap { + @Nullable Object getData(); + } + + public record BinaryBoxedVoid(Nothing? data) implements BinaryBoxed { + @Override + public @Nullable Object getData() { + return data; + } + } + + public record BinaryBoxedBoolean(boolean data) implements BinaryBoxed { + @Override + public @Nullable Object getData() { + return data; + } + } + + public record BinaryBoxedNumber(Number data) implements BinaryBoxed { + @Override + public @Nullable Object getData() { + return data; + } + } + + public record BinaryBoxedString(String data) implements BinaryBoxed { + @Override + public @Nullable Object getData() { + return data; + } + } + + public record BinaryBoxedList(FrozenList<@Nullable Object> data) implements BinaryBoxed { + @Override + public @Nullable Object getData() { + return data; + } + } + + public record BinaryBoxedMap(FrozenMap<@Nullable Object> data) implements BinaryBoxed { + @Override + public @Nullable Object getData() { + return data; + } + } + + + public static class Binary extends JsonSchema implements NullSchemaValidator, BooleanSchemaValidator, NumberSchemaValidator, StringSchemaValidator, ListSchemaValidator, BinaryBoxedList>, MapSchemaValidator, BinaryBoxedMap> { + private static @Nullable Binary instance = null; + + protected Binary() { + super(new JsonSchemaInfo() + .format("binary") + ); + } + + public static Binary getInstance() { + if (instance == null) { + instance = new Binary(); + } + return instance; + } + + @Override + public Nothing? validate(Nothing? arg, SchemaConfiguration configuration) throws ValidationException { + Set> pathSet = new HashSet<>(); + List pathToItem = List.of("args[0]"); + Nothing? castArg = castToAllowedTypes(arg, pathToItem, pathSet); + SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().build())); + PathToSchemasMap validatedPathToSchemas = new PathToSchemasMap(); + ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, new LinkedHashSet<>()); + getPathToSchemas(this, castArg, validationMetadata, pathSet); + return castArg; + } + + @Override + public boolean validate(boolean arg, SchemaConfiguration configuration) throws ValidationException { + Set> pathSet = new HashSet<>(); + List pathToItem = List.of("args[0]"); + boolean castArg = castToAllowedTypes(arg, pathToItem, pathSet); + SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().build())); + PathToSchemasMap validatedPathToSchemas = new PathToSchemasMap(); + ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, new LinkedHashSet<>()); + getPathToSchemas(this, castArg, validationMetadata, pathSet); + return castArg; + } + + @Override + public Number validate(Number arg, SchemaConfiguration configuration) throws ValidationException { + Set> pathSet = new HashSet<>(); + List pathToItem = List.of("args[0]"); + Number castArg = castToAllowedTypes(arg, pathToItem, pathSet); + SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().build())); + PathToSchemasMap validatedPathToSchemas = new PathToSchemasMap(); + ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, new LinkedHashSet<>()); + getPathToSchemas(this, castArg, validationMetadata, pathSet); + return castArg; + } + + public int validate(int arg, SchemaConfiguration configuration) throws ValidationException { + return (int) validate((Number) arg, configuration); + } + + public long validate(long arg, SchemaConfiguration configuration) throws ValidationException { + return (long) validate((Number) arg, configuration); + } + + public float validate(float arg, SchemaConfiguration configuration) throws ValidationException { + return (float) validate((Number) arg, configuration); + } + + public double validate(double arg, SchemaConfiguration configuration) throws ValidationException { + return (double) validate((Number) arg, configuration); + } + + @Override + public String validate(String arg, SchemaConfiguration configuration) throws ValidationException { + Set> pathSet = new HashSet<>(); + List pathToItem = List.of("args[0]"); + String castArg = castToAllowedTypes(arg, pathToItem, pathSet); + SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().build())); + PathToSchemasMap validatedPathToSchemas = new PathToSchemasMap(); + ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, new LinkedHashSet<>()); + getPathToSchemas(this, castArg, validationMetadata, pathSet); + return castArg; + } + + public String validate(LocalDate arg, SchemaConfiguration configuration) throws ValidationException { + return validate(arg.toString(), configuration); + } + + public String validate(ZonedDateTime arg, SchemaConfiguration configuration) throws ValidationException { + return validate(arg.toString(), configuration); + } + + public String validate(UUID arg, SchemaConfiguration configuration) throws ValidationException { + return validate(arg.toString(), configuration); + } + + @Override + public FrozenList<@Nullable Object> getNewInstance(List arg, List pathToItem, PathToSchemasMap pathToSchemas) { + List<@Nullable Object> items = new ArrayList<>(); + int i = 0; + for (Object item: arg) { + List itemPathToItem = new ArrayList<>(pathToItem); + itemPathToItem.add(i); + LinkedHashMap, Nothing?> schemas = pathToSchemas.get(itemPathToItem); + if (schemas == null) { + throw new RuntimeException("Validation result is invalid, schemas must exist for a pathToItem"); + } + JsonSchema itemSchema = schemas.entrySet().iterator().next().getKey(); + @Nullable Object itemInstance = itemSchema.getNewInstance(item, itemPathToItem, pathToSchemas); + items.add(itemInstance); + i += 1; + } + FrozenList<@Nullable Object> newInstanceItems = new FrozenList<>(items); + return newInstanceItems; + } + + 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); + SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().build())); + ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, new PathToSchemasMap(), new LinkedHashSet<>()); + PathToSchemasMap pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet); + return getNewInstance(castArg, validationMetadata.pathToItem(), pathToSchemasMap); + } + + @Override + 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 RuntimeException("Invalid non-string key value"); + } + String propertyName = (String) entryKey; + List propertyPathToItem = new ArrayList<>(pathToItem); + propertyPathToItem.add(propertyName); + Object value = entry.getValue(); + LinkedHashMap, Nothing?> schemas = pathToSchemas.get(propertyPathToItem); + if (schemas == null) { + throw new RuntimeException("Validation result is invalid, schemas must exist for a pathToItem"); + } + JsonSchema propertySchema = schemas.entrySet().iterator().next().getKey(); + @Nullable Object propertyInstance = propertySchema.getNewInstance(value, propertyPathToItem, pathToSchemas); + properties.put(propertyName, propertyInstance); + } + FrozenMap<@Nullable Object> castProperties = new FrozenMap<>(properties); + return castProperties; + } + + public FrozenMap<@Nullable Object> validate(Map arg, SchemaConfiguration configuration) throws ValidationException { + Set> pathSet = new HashSet<>(); + List pathToItem = List.of("args[0]"); + Map castArg = castToAllowedTypes(arg, pathToItem, pathSet); + SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().build())); + PathToSchemasMap validatedPathToSchemas = new PathToSchemasMap(); + ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, new LinkedHashSet<>()); + PathToSchemasMap pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet); + return getNewInstance(castArg, validationMetadata.pathToItem(), pathToSchemasMap); + } + + @Override + public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { + if (arg == null) { + return validate((Nothing?) null, configuration); + } else if (arg instanceof Boolean) { + boolean boolArg = (Boolean) arg; + return validate(boolArg, configuration); + } else if (arg instanceof Number) { + return validate((Number) arg, configuration); + } else if (arg instanceof String) { + return validate((String) arg, configuration); + } else if (arg instanceof List) { + return validate((List) arg, 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"); + } + @Override + public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { + if (arg == null) { + return getNewInstance((Nothing?) null, pathToItem, pathToSchemas); + } else if (arg instanceof Boolean) { + boolean boolArg = (Boolean) arg; + return getNewInstance(boolArg, pathToItem, pathToSchemas); + } else if (arg instanceof Number) { + return getNewInstance((Number) arg, pathToItem, pathToSchemas); + } else if (arg instanceof String) { + return getNewInstance((String) arg, pathToItem, pathToSchemas); + } else if (arg instanceof List) { + return getNewInstance((List) arg, 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"); + } + @Override + public BinaryBoxedVoid validateAndBox(Nothing? arg, SchemaConfiguration configuration) throws ValidationException { + return new BinaryBoxedVoid(validate(arg, configuration)); + } + @Override + 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 { + return new BinaryBoxedNumber(validate(arg, configuration)); + } + @Override + 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 { + return new BinaryBoxedList(validate(arg, configuration)); + } + @Override + 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 { + if (arg == null) { + Nothing? castArg = (Nothing?) arg; + return validateAndBox(castArg, configuration); + } else if (arg instanceof Boolean booleanArg) { + boolean castArg = booleanArg; + return validateAndBox(castArg, configuration); + } else if (arg instanceof String castArg) { + return validateAndBox(castArg, configuration); + } else if (arg instanceof Number castArg) { + return validateAndBox(castArg, configuration); + } else if (arg instanceof List castArg) { + 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"); + } + } + + public sealed interface Int32Boxed permits Int32BoxedVoid, Int32BoxedBoolean, Int32BoxedNumber, Int32BoxedString, Int32BoxedList, Int32BoxedMap { + @Nullable Object getData(); + } + + public record Int32BoxedVoid(Nothing? data) implements Int32Boxed { + @Override + public @Nullable Object getData() { + return data; + } + } + + public record Int32BoxedBoolean(boolean data) implements Int32Boxed { + @Override + public @Nullable Object getData() { + return data; + } + } + + public record Int32BoxedNumber(Number data) implements Int32Boxed { + @Override + public @Nullable Object getData() { + return data; + } + } + + public record Int32BoxedString(String data) implements Int32Boxed { + @Override + public @Nullable Object getData() { + return data; + } + } + + public record Int32BoxedList(FrozenList<@Nullable Object> data) implements Int32Boxed { + @Override + public @Nullable Object getData() { + return data; + } + } + + public record Int32BoxedMap(FrozenMap<@Nullable Object> data) implements Int32Boxed { + @Override + public @Nullable Object getData() { + return data; + } + } + + + public static class Int32 extends JsonSchema implements NullSchemaValidator, BooleanSchemaValidator, NumberSchemaValidator, StringSchemaValidator, ListSchemaValidator, Int32BoxedList>, MapSchemaValidator, Int32BoxedMap> { + private static @Nullable Int32 instance = null; + + protected Int32() { + super(new JsonSchemaInfo() + .format("int32") + ); + } + + public static Int32 getInstance() { + if (instance == null) { + instance = new Int32(); + } + return instance; + } + + @Override + public Nothing? validate(Nothing? arg, SchemaConfiguration configuration) throws ValidationException { + Set> pathSet = new HashSet<>(); + List pathToItem = List.of("args[0]"); + Nothing? castArg = castToAllowedTypes(arg, pathToItem, pathSet); + SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().build())); + PathToSchemasMap validatedPathToSchemas = new PathToSchemasMap(); + ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, new LinkedHashSet<>()); + getPathToSchemas(this, castArg, validationMetadata, pathSet); + return castArg; + } + + @Override + public boolean validate(boolean arg, SchemaConfiguration configuration) throws ValidationException { + Set> pathSet = new HashSet<>(); + List pathToItem = List.of("args[0]"); + boolean castArg = castToAllowedTypes(arg, pathToItem, pathSet); + SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().build())); + PathToSchemasMap validatedPathToSchemas = new PathToSchemasMap(); + ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, new LinkedHashSet<>()); + getPathToSchemas(this, castArg, validationMetadata, pathSet); + return castArg; + } + + @Override + public Number validate(Number arg, SchemaConfiguration configuration) throws ValidationException { + Set> pathSet = new HashSet<>(); + List pathToItem = List.of("args[0]"); + Number castArg = castToAllowedTypes(arg, pathToItem, pathSet); + SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().build())); + PathToSchemasMap validatedPathToSchemas = new PathToSchemasMap(); + ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, new LinkedHashSet<>()); + getPathToSchemas(this, castArg, validationMetadata, pathSet); + return castArg; + } + + public int validate(int arg, SchemaConfiguration configuration) throws ValidationException { + return (int) validate((Number) arg, configuration); + } + + public long validate(long arg, SchemaConfiguration configuration) throws ValidationException { + return (long) validate((Number) arg, configuration); + } + + public float validate(float arg, SchemaConfiguration configuration) throws ValidationException { + return (float) validate((Number) arg, configuration); + } + + public double validate(double arg, SchemaConfiguration configuration) throws ValidationException { + return (double) validate((Number) arg, configuration); + } + + @Override + public String validate(String arg, SchemaConfiguration configuration) throws ValidationException { + Set> pathSet = new HashSet<>(); + List pathToItem = List.of("args[0]"); + String castArg = castToAllowedTypes(arg, pathToItem, pathSet); + SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().build())); + PathToSchemasMap validatedPathToSchemas = new PathToSchemasMap(); + ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, new LinkedHashSet<>()); + getPathToSchemas(this, castArg, validationMetadata, pathSet); + return castArg; + } + + public String validate(LocalDate arg, SchemaConfiguration configuration) throws ValidationException { + return validate(arg.toString(), configuration); + } + + public String validate(ZonedDateTime arg, SchemaConfiguration configuration) throws ValidationException { + return validate(arg.toString(), configuration); + } + + public String validate(UUID arg, SchemaConfiguration configuration) throws ValidationException { + return validate(arg.toString(), configuration); + } + + @Override + public FrozenList<@Nullable Object> getNewInstance(List arg, List pathToItem, PathToSchemasMap pathToSchemas) { + List<@Nullable Object> items = new ArrayList<>(); + int i = 0; + for (Object item: arg) { + List itemPathToItem = new ArrayList<>(pathToItem); + itemPathToItem.add(i); + LinkedHashMap, Nothing?> schemas = pathToSchemas.get(itemPathToItem); + if (schemas == null) { + throw new RuntimeException("Validation result is invalid, schemas must exist for a pathToItem"); + } + JsonSchema itemSchema = schemas.entrySet().iterator().next().getKey(); + @Nullable Object itemInstance = itemSchema.getNewInstance(item, itemPathToItem, pathToSchemas); + items.add(itemInstance); + i += 1; + } + FrozenList<@Nullable Object> newInstanceItems = new FrozenList<>(items); + return newInstanceItems; + } + + 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); + SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().build())); + ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, new PathToSchemasMap(), new LinkedHashSet<>()); + PathToSchemasMap pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet); + return getNewInstance(castArg, validationMetadata.pathToItem(), pathToSchemasMap); + } + + @Override + 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 RuntimeException("Invalid non-string key value"); + } + String propertyName = (String) entryKey; + List propertyPathToItem = new ArrayList<>(pathToItem); + propertyPathToItem.add(propertyName); + Object value = entry.getValue(); + LinkedHashMap, Nothing?> schemas = pathToSchemas.get(propertyPathToItem); + if (schemas == null) { + throw new RuntimeException("Validation result is invalid, schemas must exist for a pathToItem"); + } + JsonSchema propertySchema = schemas.entrySet().iterator().next().getKey(); + @Nullable Object propertyInstance = propertySchema.getNewInstance(value, propertyPathToItem, pathToSchemas); + properties.put(propertyName, propertyInstance); + } + FrozenMap<@Nullable Object> castProperties = new FrozenMap<>(properties); + return castProperties; + } + + public FrozenMap<@Nullable Object> validate(Map arg, SchemaConfiguration configuration) throws ValidationException { + Set> pathSet = new HashSet<>(); + List pathToItem = List.of("args[0]"); + Map castArg = castToAllowedTypes(arg, pathToItem, pathSet); + SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().build())); + PathToSchemasMap validatedPathToSchemas = new PathToSchemasMap(); + ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, new LinkedHashSet<>()); + PathToSchemasMap pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet); + return getNewInstance(castArg, validationMetadata.pathToItem(), pathToSchemasMap); + } + + @Override + public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { + if (arg == null) { + return validate((Nothing?) null, configuration); + } else if (arg instanceof Boolean) { + boolean boolArg = (Boolean) arg; + return validate(boolArg, configuration); + } else if (arg instanceof Number) { + return validate((Number) arg, configuration); + } else if (arg instanceof String) { + return validate((String) arg, configuration); + } else if (arg instanceof List) { + return validate((List) arg, 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"); + } + @Override + public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { + if (arg == null) { + return getNewInstance((Nothing?) null, pathToItem, pathToSchemas); + } else if (arg instanceof Boolean) { + boolean boolArg = (Boolean) arg; + return getNewInstance(boolArg, pathToItem, pathToSchemas); + } else if (arg instanceof Number) { + return getNewInstance((Number) arg, pathToItem, pathToSchemas); + } else if (arg instanceof String) { + return getNewInstance((String) arg, pathToItem, pathToSchemas); + } else if (arg instanceof List) { + return getNewInstance((List) arg, 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"); + } + @Override + public Int32BoxedVoid validateAndBox(Nothing? arg, SchemaConfiguration configuration) throws ValidationException { + return new Int32BoxedVoid(validate(arg, configuration)); + } + @Override + 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 { + return new Int32BoxedNumber(validate(arg, configuration)); + } + @Override + 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 { + return new Int32BoxedList(validate(arg, configuration)); + } + @Override + 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 { + if (arg == null) { + Nothing? castArg = (Nothing?) arg; + return validateAndBox(castArg, configuration); + } else if (arg instanceof Boolean booleanArg) { + boolean castArg = booleanArg; + return validateAndBox(castArg, configuration); + } else if (arg instanceof String castArg) { + return validateAndBox(castArg, configuration); + } else if (arg instanceof Number castArg) { + return validateAndBox(castArg, configuration); + } else if (arg instanceof List castArg) { + 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"); + } + } + + public sealed interface Int64Boxed permits Int64BoxedVoid, Int64BoxedBoolean, Int64BoxedNumber, Int64BoxedString, Int64BoxedList, Int64BoxedMap { + @Nullable Object getData(); + } + + public record Int64BoxedVoid(Nothing? data) implements Int64Boxed { + @Override + public @Nullable Object getData() { + return data; + } + } + + public record Int64BoxedBoolean(boolean data) implements Int64Boxed { + @Override + public @Nullable Object getData() { + return data; + } + } + + public record Int64BoxedNumber(Number data) implements Int64Boxed { + @Override + public @Nullable Object getData() { + return data; + } + } + + public record Int64BoxedString(String data) implements Int64Boxed { + @Override + public @Nullable Object getData() { + return data; + } + } + + public record Int64BoxedList(FrozenList<@Nullable Object> data) implements Int64Boxed { + @Override + public @Nullable Object getData() { + return data; + } + } + + public record Int64BoxedMap(FrozenMap<@Nullable Object> data) implements Int64Boxed { + @Override + public @Nullable Object getData() { + return data; + } + } + + + public static class Int64 extends JsonSchema implements NullSchemaValidator, BooleanSchemaValidator, NumberSchemaValidator, StringSchemaValidator, ListSchemaValidator, Int64BoxedList>, MapSchemaValidator, Int64BoxedMap> { + private static @Nullable Int64 instance = null; + + protected Int64() { + super(new JsonSchemaInfo() + .format("int64") + ); + } + + public static Int64 getInstance() { + if (instance == null) { + instance = new Int64(); + } + return instance; + } + + @Override + public Nothing? validate(Nothing? arg, SchemaConfiguration configuration) throws ValidationException { + Set> pathSet = new HashSet<>(); + List pathToItem = List.of("args[0]"); + Nothing? castArg = castToAllowedTypes(arg, pathToItem, pathSet); + SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().build())); + PathToSchemasMap validatedPathToSchemas = new PathToSchemasMap(); + ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, new LinkedHashSet<>()); + getPathToSchemas(this, castArg, validationMetadata, pathSet); + return castArg; + } + + @Override + public boolean validate(boolean arg, SchemaConfiguration configuration) throws ValidationException { + Set> pathSet = new HashSet<>(); + List pathToItem = List.of("args[0]"); + boolean castArg = castToAllowedTypes(arg, pathToItem, pathSet); + SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().build())); + PathToSchemasMap validatedPathToSchemas = new PathToSchemasMap(); + ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, new LinkedHashSet<>()); + getPathToSchemas(this, castArg, validationMetadata, pathSet); + return castArg; + } + + @Override + public Number validate(Number arg, SchemaConfiguration configuration) throws ValidationException { + Set> pathSet = new HashSet<>(); + List pathToItem = List.of("args[0]"); + Number castArg = castToAllowedTypes(arg, pathToItem, pathSet); + SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().build())); + PathToSchemasMap validatedPathToSchemas = new PathToSchemasMap(); + ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, new LinkedHashSet<>()); + getPathToSchemas(this, castArg, validationMetadata, pathSet); + return castArg; + } + + public int validate(int arg, SchemaConfiguration configuration) throws ValidationException { + return (int) validate((Number) arg, configuration); + } + + public long validate(long arg, SchemaConfiguration configuration) throws ValidationException { + return (long) validate((Number) arg, configuration); + } + + public float validate(float arg, SchemaConfiguration configuration) throws ValidationException { + return (float) validate((Number) arg, configuration); + } + + public double validate(double arg, SchemaConfiguration configuration) throws ValidationException { + return (double) validate((Number) arg, configuration); + } + + @Override + public String validate(String arg, SchemaConfiguration configuration) throws ValidationException { + Set> pathSet = new HashSet<>(); + List pathToItem = List.of("args[0]"); + String castArg = castToAllowedTypes(arg, pathToItem, pathSet); + SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().build())); + PathToSchemasMap validatedPathToSchemas = new PathToSchemasMap(); + ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, new LinkedHashSet<>()); + getPathToSchemas(this, castArg, validationMetadata, pathSet); + return castArg; + } + + public String validate(LocalDate arg, SchemaConfiguration configuration) throws ValidationException { + return validate(arg.toString(), configuration); + } + + public String validate(ZonedDateTime arg, SchemaConfiguration configuration) throws ValidationException { + return validate(arg.toString(), configuration); + } + + public String validate(UUID arg, SchemaConfiguration configuration) throws ValidationException { + return validate(arg.toString(), configuration); + } + + @Override + public FrozenList<@Nullable Object> getNewInstance(List arg, List pathToItem, PathToSchemasMap pathToSchemas) { + List<@Nullable Object> items = new ArrayList<>(); + int i = 0; + for (Object item: arg) { + List itemPathToItem = new ArrayList<>(pathToItem); + itemPathToItem.add(i); + LinkedHashMap, Nothing?> schemas = pathToSchemas.get(itemPathToItem); + if (schemas == null) { + throw new RuntimeException("Validation result is invalid, schemas must exist for a pathToItem"); + } + JsonSchema itemSchema = schemas.entrySet().iterator().next().getKey(); + @Nullable Object itemInstance = itemSchema.getNewInstance(item, itemPathToItem, pathToSchemas); + items.add(itemInstance); + i += 1; + } + FrozenList<@Nullable Object> newInstanceItems = new FrozenList<>(items); + return newInstanceItems; + } + + 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); + SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().build())); + ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, new PathToSchemasMap(), new LinkedHashSet<>()); + PathToSchemasMap pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet); + return getNewInstance(castArg, validationMetadata.pathToItem(), pathToSchemasMap); + } + + @Override + 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 RuntimeException("Invalid non-string key value"); + } + String propertyName = (String) entryKey; + List propertyPathToItem = new ArrayList<>(pathToItem); + propertyPathToItem.add(propertyName); + Object value = entry.getValue(); + LinkedHashMap, Nothing?> schemas = pathToSchemas.get(propertyPathToItem); + if (schemas == null) { + throw new RuntimeException("Validation result is invalid, schemas must exist for a pathToItem"); + } + JsonSchema propertySchema = schemas.entrySet().iterator().next().getKey(); + @Nullable Object propertyInstance = propertySchema.getNewInstance(value, propertyPathToItem, pathToSchemas); + properties.put(propertyName, propertyInstance); + } + FrozenMap<@Nullable Object> castProperties = new FrozenMap<>(properties); + return castProperties; + } + + public FrozenMap<@Nullable Object> validate(Map arg, SchemaConfiguration configuration) throws ValidationException { + Set> pathSet = new HashSet<>(); + List pathToItem = List.of("args[0]"); + Map castArg = castToAllowedTypes(arg, pathToItem, pathSet); + SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().build())); + PathToSchemasMap validatedPathToSchemas = new PathToSchemasMap(); + ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, new LinkedHashSet<>()); + PathToSchemasMap pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet); + return getNewInstance(castArg, validationMetadata.pathToItem(), pathToSchemasMap); + } + + @Override + public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { + if (arg == null) { + return validate((Nothing?) null, configuration); + } else if (arg instanceof Boolean) { + boolean boolArg = (Boolean) arg; + return validate(boolArg, configuration); + } else if (arg instanceof Number) { + return validate((Number) arg, configuration); + } else if (arg instanceof String) { + return validate((String) arg, configuration); + } else if (arg instanceof List) { + return validate((List) arg, 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"); + } + @Override + public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { + if (arg == null) { + return getNewInstance((Nothing?) null, pathToItem, pathToSchemas); + } else if (arg instanceof Boolean) { + boolean boolArg = (Boolean) arg; + return getNewInstance(boolArg, pathToItem, pathToSchemas); + } else if (arg instanceof Number) { + return getNewInstance((Number) arg, pathToItem, pathToSchemas); + } else if (arg instanceof String) { + return getNewInstance((String) arg, pathToItem, pathToSchemas); + } else if (arg instanceof List) { + return getNewInstance((List) arg, 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"); + } + @Override + public Int64BoxedVoid validateAndBox(Nothing? arg, SchemaConfiguration configuration) throws ValidationException { + return new Int64BoxedVoid(validate(arg, configuration)); + } + @Override + 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 { + return new Int64BoxedNumber(validate(arg, configuration)); + } + @Override + 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 { + return new Int64BoxedList(validate(arg, configuration)); + } + @Override + 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 { + if (arg == null) { + Nothing? castArg = (Nothing?) arg; + return validateAndBox(castArg, configuration); + } else if (arg instanceof Boolean booleanArg) { + boolean castArg = booleanArg; + return validateAndBox(castArg, configuration); + } else if (arg instanceof String castArg) { + return validateAndBox(castArg, configuration); + } else if (arg instanceof Number castArg) { + return validateAndBox(castArg, configuration); + } else if (arg instanceof List castArg) { + 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"); + } + } + + public sealed interface DoubleSchemaBoxed permits DoubleSchemaBoxedVoid, DoubleSchemaBoxedBoolean, DoubleSchemaBoxedNumber, DoubleSchemaBoxedString, DoubleSchemaBoxedList, DoubleSchemaBoxedMap { + @Nullable Object getData(); + } + + public record DoubleSchemaBoxedVoid(Nothing? data) implements DoubleSchemaBoxed { + @Override + public @Nullable Object getData() { + return data; + } + } + + public record DoubleSchemaBoxedBoolean(boolean data) implements DoubleSchemaBoxed { + @Override + public @Nullable Object getData() { + return data; + } + } + + public record DoubleSchemaBoxedNumber(Number data) implements DoubleSchemaBoxed { + @Override + public @Nullable Object getData() { + return data; + } + } + + public record DoubleSchemaBoxedString(String data) implements DoubleSchemaBoxed { + @Override + public @Nullable Object getData() { + return data; + } + } + + public record DoubleSchemaBoxedList(FrozenList<@Nullable Object> data) implements DoubleSchemaBoxed { + @Override + public @Nullable Object getData() { + return data; + } + } + + public record DoubleSchemaBoxedMap(FrozenMap<@Nullable Object> data) implements DoubleSchemaBoxed { + @Override + public @Nullable Object getData() { + return data; + } + } + + + public static class DoubleSchema extends JsonSchema implements NullSchemaValidator, BooleanSchemaValidator, NumberSchemaValidator, StringSchemaValidator, ListSchemaValidator, DoubleSchemaBoxedList>, MapSchemaValidator, DoubleSchemaBoxedMap> { + private static @Nullable DoubleSchema instance = null; + + protected DoubleSchema() { + super(new JsonSchemaInfo() + .format("double") + ); + } + + public static DoubleSchema getInstance() { + if (instance == null) { + instance = new DoubleSchema(); + } + return instance; + } + + @Override + public Nothing? validate(Nothing? arg, SchemaConfiguration configuration) throws ValidationException { + Set> pathSet = new HashSet<>(); + List pathToItem = List.of("args[0]"); + Nothing? castArg = castToAllowedTypes(arg, pathToItem, pathSet); + SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().build())); + PathToSchemasMap validatedPathToSchemas = new PathToSchemasMap(); + ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, new LinkedHashSet<>()); + getPathToSchemas(this, castArg, validationMetadata, pathSet); + return castArg; + } + + @Override + public boolean validate(boolean arg, SchemaConfiguration configuration) throws ValidationException { + Set> pathSet = new HashSet<>(); + List pathToItem = List.of("args[0]"); + boolean castArg = castToAllowedTypes(arg, pathToItem, pathSet); + SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().build())); + PathToSchemasMap validatedPathToSchemas = new PathToSchemasMap(); + ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, new LinkedHashSet<>()); + getPathToSchemas(this, castArg, validationMetadata, pathSet); + return castArg; + } + + @Override + public Number validate(Number arg, SchemaConfiguration configuration) throws ValidationException { + Set> pathSet = new HashSet<>(); + List pathToItem = List.of("args[0]"); + Number castArg = castToAllowedTypes(arg, pathToItem, pathSet); + SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().build())); + PathToSchemasMap validatedPathToSchemas = new PathToSchemasMap(); + ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, new LinkedHashSet<>()); + getPathToSchemas(this, castArg, validationMetadata, pathSet); + return castArg; + } + + public int validate(int arg, SchemaConfiguration configuration) throws ValidationException { + return (int) validate((Number) arg, configuration); + } + + public long validate(long arg, SchemaConfiguration configuration) throws ValidationException { + return (long) validate((Number) arg, configuration); + } + + public float validate(float arg, SchemaConfiguration configuration) throws ValidationException { + return (float) validate((Number) arg, configuration); + } + + public double validate(double arg, SchemaConfiguration configuration) throws ValidationException { + return (double) validate((Number) arg, configuration); + } + + @Override + public String validate(String arg, SchemaConfiguration configuration) throws ValidationException { + Set> pathSet = new HashSet<>(); + List pathToItem = List.of("args[0]"); + String castArg = castToAllowedTypes(arg, pathToItem, pathSet); + SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().build())); + PathToSchemasMap validatedPathToSchemas = new PathToSchemasMap(); + ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, new LinkedHashSet<>()); + getPathToSchemas(this, castArg, validationMetadata, pathSet); + return castArg; + } + + public String validate(LocalDate arg, SchemaConfiguration configuration) throws ValidationException { + return validate(arg.toString(), configuration); + } + + public String validate(ZonedDateTime arg, SchemaConfiguration configuration) throws ValidationException { + return validate(arg.toString(), configuration); + } + + public String validate(UUID arg, SchemaConfiguration configuration) throws ValidationException { + return validate(arg.toString(), configuration); + } + + @Override + public FrozenList<@Nullable Object> getNewInstance(List arg, List pathToItem, PathToSchemasMap pathToSchemas) { + List<@Nullable Object> items = new ArrayList<>(); + int i = 0; + for (Object item: arg) { + List itemPathToItem = new ArrayList<>(pathToItem); + itemPathToItem.add(i); + LinkedHashMap, Nothing?> schemas = pathToSchemas.get(itemPathToItem); + if (schemas == null) { + throw new RuntimeException("Validation result is invalid, schemas must exist for a pathToItem"); + } + JsonSchema itemSchema = schemas.entrySet().iterator().next().getKey(); + @Nullable Object itemInstance = itemSchema.getNewInstance(item, itemPathToItem, pathToSchemas); + items.add(itemInstance); + i += 1; + } + FrozenList<@Nullable Object> newInstanceItems = new FrozenList<>(items); + return newInstanceItems; + } + + 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); + SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().build())); + ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, new PathToSchemasMap(), new LinkedHashSet<>()); + PathToSchemasMap pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet); + return getNewInstance(castArg, validationMetadata.pathToItem(), pathToSchemasMap); + } + + @Override + 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 RuntimeException("Invalid non-string key value"); + } + String propertyName = (String) entryKey; + List propertyPathToItem = new ArrayList<>(pathToItem); + propertyPathToItem.add(propertyName); + Object value = entry.getValue(); + LinkedHashMap, Nothing?> schemas = pathToSchemas.get(propertyPathToItem); + if (schemas == null) { + throw new RuntimeException("Validation result is invalid, schemas must exist for a pathToItem"); + } + JsonSchema propertySchema = schemas.entrySet().iterator().next().getKey(); + @Nullable Object propertyInstance = propertySchema.getNewInstance(value, propertyPathToItem, pathToSchemas); + properties.put(propertyName, propertyInstance); + } + FrozenMap<@Nullable Object> castProperties = new FrozenMap<>(properties); + return castProperties; + } + + public FrozenMap<@Nullable Object> validate(Map arg, SchemaConfiguration configuration) throws ValidationException { + Set> pathSet = new HashSet<>(); + List pathToItem = List.of("args[0]"); + Map castArg = castToAllowedTypes(arg, pathToItem, pathSet); + SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().build())); + PathToSchemasMap validatedPathToSchemas = new PathToSchemasMap(); + ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, new LinkedHashSet<>()); + PathToSchemasMap pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet); + return getNewInstance(castArg, validationMetadata.pathToItem(), pathToSchemasMap); + } + + @Override + public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { + if (arg == null) { + return validate((Nothing?) null, configuration); + } else if (arg instanceof Boolean) { + boolean boolArg = (Boolean) arg; + return validate(boolArg, configuration); + } else if (arg instanceof Number) { + return validate((Number) arg, configuration); + } else if (arg instanceof String) { + return validate((String) arg, configuration); + } else if (arg instanceof List) { + return validate((List) arg, 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"); + } + @Override + public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { + if (arg == null) { + return getNewInstance((Nothing?) null, pathToItem, pathToSchemas); + } else if (arg instanceof Boolean) { + boolean boolArg = (Boolean) arg; + return getNewInstance(boolArg, pathToItem, pathToSchemas); + } else if (arg instanceof Number) { + return getNewInstance((Number) arg, pathToItem, pathToSchemas); + } else if (arg instanceof String) { + return getNewInstance((String) arg, pathToItem, pathToSchemas); + } else if (arg instanceof List) { + return getNewInstance((List) arg, 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"); + } + @Override + public DoubleSchemaBoxedVoid validateAndBox(Nothing? arg, SchemaConfiguration configuration) throws ValidationException { + return new DoubleSchemaBoxedVoid(validate(arg, configuration)); + } + @Override + 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 { + return new DoubleSchemaBoxedNumber(validate(arg, configuration)); + } + @Override + 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 { + return new DoubleSchemaBoxedList(validate(arg, configuration)); + } + @Override + 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 { + if (arg == null) { + Nothing? castArg = (Nothing?) arg; + return validateAndBox(castArg, configuration); + } else if (arg instanceof Boolean booleanArg) { + boolean castArg = booleanArg; + return validateAndBox(castArg, configuration); + } else if (arg instanceof String castArg) { + return validateAndBox(castArg, configuration); + } else if (arg instanceof Number castArg) { + return validateAndBox(castArg, configuration); + } else if (arg instanceof List castArg) { + 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"); + } + } + + public sealed interface FloatSchemaBoxed permits FloatSchemaBoxedVoid, FloatSchemaBoxedBoolean, FloatSchemaBoxedNumber, FloatSchemaBoxedString, FloatSchemaBoxedList, FloatSchemaBoxedMap { + @Nullable Object getData(); + } + + public record FloatSchemaBoxedVoid(Nothing? data) implements FloatSchemaBoxed { + @Override + public @Nullable Object getData() { + return data; + } + } + + public record FloatSchemaBoxedBoolean(boolean data) implements FloatSchemaBoxed { + @Override + public @Nullable Object getData() { + return data; + } + } + + public record FloatSchemaBoxedNumber(Number data) implements FloatSchemaBoxed { + @Override + public @Nullable Object getData() { + return data; + } + } + + public record FloatSchemaBoxedString(String data) implements FloatSchemaBoxed { + @Override + public @Nullable Object getData() { + return data; + } + } + + public record FloatSchemaBoxedList(FrozenList<@Nullable Object> data) implements FloatSchemaBoxed { + @Override + public @Nullable Object getData() { + return data; + } + } + + public record FloatSchemaBoxedMap(FrozenMap<@Nullable Object> data) implements FloatSchemaBoxed { + @Override + public @Nullable Object getData() { + return data; + } + } + + + public static class FloatSchema extends JsonSchema implements NullSchemaValidator, BooleanSchemaValidator, NumberSchemaValidator, StringSchemaValidator, ListSchemaValidator, FloatSchemaBoxedList>, MapSchemaValidator, FloatSchemaBoxedMap> { + private static @Nullable FloatSchema instance = null; + + protected FloatSchema() { + super(new JsonSchemaInfo() + .format("float") + ); + } + + public static FloatSchema getInstance() { + if (instance == null) { + instance = new FloatSchema(); + } + return instance; + } + + @Override + public Nothing? validate(Nothing? arg, SchemaConfiguration configuration) throws ValidationException { + Set> pathSet = new HashSet<>(); + List pathToItem = List.of("args[0]"); + Nothing? castArg = castToAllowedTypes(arg, pathToItem, pathSet); + SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().build())); + PathToSchemasMap validatedPathToSchemas = new PathToSchemasMap(); + ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, new LinkedHashSet<>()); + getPathToSchemas(this, castArg, validationMetadata, pathSet); + return castArg; + } + + @Override + public boolean validate(boolean arg, SchemaConfiguration configuration) throws ValidationException { + Set> pathSet = new HashSet<>(); + List pathToItem = List.of("args[0]"); + boolean castArg = castToAllowedTypes(arg, pathToItem, pathSet); + SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().build())); + PathToSchemasMap validatedPathToSchemas = new PathToSchemasMap(); + ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, new LinkedHashSet<>()); + getPathToSchemas(this, castArg, validationMetadata, pathSet); + return castArg; + } + + @Override + public Number validate(Number arg, SchemaConfiguration configuration) throws ValidationException { + Set> pathSet = new HashSet<>(); + List pathToItem = List.of("args[0]"); + Number castArg = castToAllowedTypes(arg, pathToItem, pathSet); + SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().build())); + PathToSchemasMap validatedPathToSchemas = new PathToSchemasMap(); + ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, new LinkedHashSet<>()); + getPathToSchemas(this, castArg, validationMetadata, pathSet); + return castArg; + } + + public int validate(int arg, SchemaConfiguration configuration) throws ValidationException { + return (int) validate((Number) arg, configuration); + } + + public long validate(long arg, SchemaConfiguration configuration) throws ValidationException { + return (long) validate((Number) arg, configuration); + } + + public float validate(float arg, SchemaConfiguration configuration) throws ValidationException { + return (float) validate((Number) arg, configuration); + } + + public double validate(double arg, SchemaConfiguration configuration) throws ValidationException { + return (double) validate((Number) arg, configuration); + } + + @Override + public String validate(String arg, SchemaConfiguration configuration) throws ValidationException { + Set> pathSet = new HashSet<>(); + List pathToItem = List.of("args[0]"); + String castArg = castToAllowedTypes(arg, pathToItem, pathSet); + SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().build())); + PathToSchemasMap validatedPathToSchemas = new PathToSchemasMap(); + ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, new LinkedHashSet<>()); + getPathToSchemas(this, castArg, validationMetadata, pathSet); + return castArg; + } + + public String validate(LocalDate arg, SchemaConfiguration configuration) throws ValidationException { + return validate(arg.toString(), configuration); + } + + public String validate(ZonedDateTime arg, SchemaConfiguration configuration) throws ValidationException { + return validate(arg.toString(), configuration); + } + + public String validate(UUID arg, SchemaConfiguration configuration) throws ValidationException { + return validate(arg.toString(), configuration); + } + + @Override + public FrozenList<@Nullable Object> getNewInstance(List arg, List pathToItem, PathToSchemasMap pathToSchemas) { + List<@Nullable Object> items = new ArrayList<>(); + int i = 0; + for (Object item: arg) { + List itemPathToItem = new ArrayList<>(pathToItem); + itemPathToItem.add(i); + LinkedHashMap, Nothing?> schemas = pathToSchemas.get(itemPathToItem); + if (schemas == null) { + throw new RuntimeException("Validation result is invalid, schemas must exist for a pathToItem"); + } + JsonSchema itemSchema = schemas.entrySet().iterator().next().getKey(); + @Nullable Object itemInstance = itemSchema.getNewInstance(item, itemPathToItem, pathToSchemas); + items.add(itemInstance); + i += 1; + } + FrozenList<@Nullable Object> newInstanceItems = new FrozenList<>(items); + return newInstanceItems; + } + + 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); + SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().build())); + ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, new PathToSchemasMap(), new LinkedHashSet<>()); + PathToSchemasMap pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet); + return getNewInstance(castArg, validationMetadata.pathToItem(), pathToSchemasMap); + } + + @Override + 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 RuntimeException("Invalid non-string key value"); + } + String propertyName = (String) entryKey; + List propertyPathToItem = new ArrayList<>(pathToItem); + propertyPathToItem.add(propertyName); + Object value = entry.getValue(); + LinkedHashMap, Nothing?> schemas = pathToSchemas.get(propertyPathToItem); + if (schemas == null) { + throw new RuntimeException("Validation result is invalid, schemas must exist for a pathToItem"); + } + JsonSchema propertySchema = schemas.entrySet().iterator().next().getKey(); + @Nullable Object propertyInstance = propertySchema.getNewInstance(value, propertyPathToItem, pathToSchemas); + properties.put(propertyName, propertyInstance); + } + FrozenMap<@Nullable Object> castProperties = new FrozenMap<>(properties); + return castProperties; + } + + public FrozenMap<@Nullable Object> validate(Map arg, SchemaConfiguration configuration) throws ValidationException { + Set> pathSet = new HashSet<>(); + List pathToItem = List.of("args[0]"); + Map castArg = castToAllowedTypes(arg, pathToItem, pathSet); + SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().build())); + PathToSchemasMap validatedPathToSchemas = new PathToSchemasMap(); + ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, new LinkedHashSet<>()); + PathToSchemasMap pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet); + return getNewInstance(castArg, validationMetadata.pathToItem(), pathToSchemasMap); + } + + @Override + public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { + if (arg == null) { + return validate((Nothing?) null, configuration); + } else if (arg instanceof Boolean) { + boolean boolArg = (Boolean) arg; + return validate(boolArg, configuration); + } else if (arg instanceof Number) { + return validate((Number) arg, configuration); + } else if (arg instanceof String) { + return validate((String) arg, configuration); + } else if (arg instanceof List) { + return validate((List) arg, 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"); + } + @Override + public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { + if (arg == null) { + return getNewInstance((Nothing?) null, pathToItem, pathToSchemas); + } else if (arg instanceof Boolean) { + boolean boolArg = (Boolean) arg; + return getNewInstance(boolArg, pathToItem, pathToSchemas); + } else if (arg instanceof Number) { + return getNewInstance((Number) arg, pathToItem, pathToSchemas); + } else if (arg instanceof String) { + return getNewInstance((String) arg, pathToItem, pathToSchemas); + } else if (arg instanceof List) { + return getNewInstance((List) arg, 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"); + } + @Override + public FloatSchemaBoxedVoid validateAndBox(Nothing? arg, SchemaConfiguration configuration) throws ValidationException { + return new FloatSchemaBoxedVoid(validate(arg, configuration)); + } + @Override + 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 { + return new FloatSchemaBoxedNumber(validate(arg, configuration)); + } + @Override + 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 { + return new FloatSchemaBoxedList(validate(arg, configuration)); + } + @Override + 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 { + if (arg == null) { + Nothing? castArg = (Nothing?) arg; + return validateAndBox(castArg, configuration); + } else if (arg instanceof Boolean booleanArg) { + boolean castArg = booleanArg; + return validateAndBox(castArg, configuration); + } else if (arg instanceof String castArg) { + return validateAndBox(castArg, configuration); + } else if (arg instanceof Number castArg) { + return validateAndBox(castArg, configuration); + } else if (arg instanceof List castArg) { + 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"); + } + } + + public static class AnyTypeAndFormatMap extends FrozenMap<@Nullable Object> { + protected AnyTypeAndFormatMap(FrozenMap<@Nullable Object> m) { + super(m); + } + public static final Set requiredKeys = Set.of(); + public static final Set optionalKeys = Set.of( + "uuid", + "date", + "date-time", + "number", + "binary", + "int32", + "int64", + "double", + "float" + ); + public static AnyTypeAndFormatMap of(Map arg, SchemaConfiguration configuration) throws ValidationException { + return AnyTypeAndFormat1.getInstance().validate(arg, configuration); + } + + public @Nullable Object date() throws UnsetPropertyException { + return getOrThrow("date"); + } + + public @Nullable Object binary() throws UnsetPropertyException { + return getOrThrow("binary"); + } + + public @Nullable Object int32() throws UnsetPropertyException { + return getOrThrow("int32"); + } + + public @Nullable Object int64() throws UnsetPropertyException { + return getOrThrow("int64"); + } + + public @Nullable Object getAdditionalProperty(String name) throws UnsetPropertyException, InvalidAdditionalPropertyException { + throwIfKeyKnown(name, requiredKeys, optionalKeys); + throwIfKeyNotPresent(name); + return get(name); + } + } + + public interface SetterForUuidSchema { + Map getInstance(); + T getBuilderAfterUuidSchema(Map instance); + + default T setUuid(Nothing? value) { + var instance = getInstance(); + instance.put("uuid", null); + return getBuilderAfterUuidSchema(instance); + } + + default T setUuid(boolean value) { + var instance = getInstance(); + instance.put("uuid", value); + return getBuilderAfterUuidSchema(instance); + } + + default T setUuid(String value) { + var instance = getInstance(); + instance.put("uuid", value); + return getBuilderAfterUuidSchema(instance); + } + + default T setUuid(int value) { + var instance = getInstance(); + instance.put("uuid", value); + return getBuilderAfterUuidSchema(instance); + } + + default T setUuid(float value) { + var instance = getInstance(); + instance.put("uuid", value); + return getBuilderAfterUuidSchema(instance); + } + + default T setUuid(long value) { + var instance = getInstance(); + instance.put("uuid", value); + return getBuilderAfterUuidSchema(instance); + } + + default T setUuid(double value) { + var instance = getInstance(); + instance.put("uuid", value); + return getBuilderAfterUuidSchema(instance); + } + + default T setUuid(List value) { + var instance = getInstance(); + instance.put("uuid", value); + return getBuilderAfterUuidSchema(instance); + } + + default T setUuid(Map value) { + var instance = getInstance(); + instance.put("uuid", value); + return getBuilderAfterUuidSchema(instance); + } + } + + public interface SetterForDate { + Map getInstance(); + T getBuilderAfterDate(Map instance); + + default T date(Nothing? value) { + var instance = getInstance(); + instance.put("date", null); + return getBuilderAfterDate(instance); + } + + default T date(boolean value) { + var instance = getInstance(); + instance.put("date", value); + return getBuilderAfterDate(instance); + } + + default T date(String value) { + var instance = getInstance(); + instance.put("date", value); + return getBuilderAfterDate(instance); + } + + default T date(int value) { + var instance = getInstance(); + instance.put("date", value); + return getBuilderAfterDate(instance); + } + + default T date(float value) { + var instance = getInstance(); + instance.put("date", value); + return getBuilderAfterDate(instance); + } + + default T date(long value) { + var instance = getInstance(); + instance.put("date", value); + return getBuilderAfterDate(instance); + } + + default T date(double value) { + var instance = getInstance(); + instance.put("date", value); + return getBuilderAfterDate(instance); + } + + default T date(List value) { + var instance = getInstance(); + instance.put("date", value); + return getBuilderAfterDate(instance); + } + + default T date(Map value) { + var instance = getInstance(); + instance.put("date", value); + return getBuilderAfterDate(instance); + } + } + + public interface SetterForDatetime { + Map getInstance(); + T getBuilderAfterDatetime(Map instance); + + default T dateHyphenMinusTime(Nothing? value) { + var instance = getInstance(); + instance.put("date-time", null); + return getBuilderAfterDatetime(instance); + } + + default T dateHyphenMinusTime(boolean value) { + var instance = getInstance(); + instance.put("date-time", value); + return getBuilderAfterDatetime(instance); + } + + default T dateHyphenMinusTime(String value) { + var instance = getInstance(); + instance.put("date-time", value); + return getBuilderAfterDatetime(instance); + } + + default T dateHyphenMinusTime(int value) { + var instance = getInstance(); + instance.put("date-time", value); + return getBuilderAfterDatetime(instance); + } + + default T dateHyphenMinusTime(float value) { + var instance = getInstance(); + instance.put("date-time", value); + return getBuilderAfterDatetime(instance); + } + + default T dateHyphenMinusTime(long value) { + var instance = getInstance(); + instance.put("date-time", value); + return getBuilderAfterDatetime(instance); + } + + default T dateHyphenMinusTime(double value) { + var instance = getInstance(); + instance.put("date-time", value); + return getBuilderAfterDatetime(instance); + } + + default T dateHyphenMinusTime(List value) { + var instance = getInstance(); + instance.put("date-time", value); + return getBuilderAfterDatetime(instance); + } + + default T dateHyphenMinusTime(Map value) { + var instance = getInstance(); + instance.put("date-time", value); + return getBuilderAfterDatetime(instance); + } + } + + public interface SetterForNumberSchema { + Map getInstance(); + T getBuilderAfterNumberSchema(Map instance); + + default T setNumber(Nothing? value) { + var instance = getInstance(); + instance.put("number", null); + return getBuilderAfterNumberSchema(instance); + } + + default T setNumber(boolean value) { + var instance = getInstance(); + instance.put("number", value); + return getBuilderAfterNumberSchema(instance); + } + + default T setNumber(String value) { + var instance = getInstance(); + instance.put("number", value); + return getBuilderAfterNumberSchema(instance); + } + + default T setNumber(int value) { + var instance = getInstance(); + instance.put("number", value); + return getBuilderAfterNumberSchema(instance); + } + + default T setNumber(float value) { + var instance = getInstance(); + instance.put("number", value); + return getBuilderAfterNumberSchema(instance); + } + + default T setNumber(long value) { + var instance = getInstance(); + instance.put("number", value); + return getBuilderAfterNumberSchema(instance); + } + + default T setNumber(double value) { + var instance = getInstance(); + instance.put("number", value); + return getBuilderAfterNumberSchema(instance); + } + + default T setNumber(List value) { + var instance = getInstance(); + instance.put("number", value); + return getBuilderAfterNumberSchema(instance); + } + + default T setNumber(Map value) { + var instance = getInstance(); + instance.put("number", value); + return getBuilderAfterNumberSchema(instance); + } + } + + public interface SetterForBinary { + Map getInstance(); + T getBuilderAfterBinary(Map instance); + + default T binary(Nothing? value) { + var instance = getInstance(); + instance.put("binary", null); + return getBuilderAfterBinary(instance); + } + + default T binary(boolean value) { + var instance = getInstance(); + instance.put("binary", value); + return getBuilderAfterBinary(instance); + } + + default T binary(String value) { + var instance = getInstance(); + instance.put("binary", value); + return getBuilderAfterBinary(instance); + } + + default T binary(int value) { + var instance = getInstance(); + instance.put("binary", value); + return getBuilderAfterBinary(instance); + } + + default T binary(float value) { + var instance = getInstance(); + instance.put("binary", value); + return getBuilderAfterBinary(instance); + } + + default T binary(long value) { + var instance = getInstance(); + instance.put("binary", value); + return getBuilderAfterBinary(instance); + } + + default T binary(double value) { + var instance = getInstance(); + instance.put("binary", value); + return getBuilderAfterBinary(instance); + } + + default T binary(List value) { + var instance = getInstance(); + instance.put("binary", value); + return getBuilderAfterBinary(instance); + } + + default T binary(Map value) { + var instance = getInstance(); + instance.put("binary", value); + return getBuilderAfterBinary(instance); + } + } + + public interface SetterForInt32 { + Map getInstance(); + T getBuilderAfterInt32(Map instance); + + default T int32(Nothing? value) { + var instance = getInstance(); + instance.put("int32", null); + return getBuilderAfterInt32(instance); + } + + default T int32(boolean value) { + var instance = getInstance(); + instance.put("int32", value); + return getBuilderAfterInt32(instance); + } + + default T int32(String value) { + var instance = getInstance(); + instance.put("int32", value); + return getBuilderAfterInt32(instance); + } + + default T int32(int value) { + var instance = getInstance(); + instance.put("int32", value); + return getBuilderAfterInt32(instance); + } + + default T int32(float value) { + var instance = getInstance(); + instance.put("int32", value); + return getBuilderAfterInt32(instance); + } + + default T int32(long value) { + var instance = getInstance(); + instance.put("int32", value); + return getBuilderAfterInt32(instance); + } + + default T int32(double value) { + var instance = getInstance(); + instance.put("int32", value); + return getBuilderAfterInt32(instance); + } + + default T int32(List value) { + var instance = getInstance(); + instance.put("int32", value); + return getBuilderAfterInt32(instance); + } + + default T int32(Map value) { + var instance = getInstance(); + instance.put("int32", value); + return getBuilderAfterInt32(instance); + } + } + + public interface SetterForInt64 { + Map getInstance(); + T getBuilderAfterInt64(Map instance); + + default T int64(Nothing? value) { + var instance = getInstance(); + instance.put("int64", null); + return getBuilderAfterInt64(instance); + } + + default T int64(boolean value) { + var instance = getInstance(); + instance.put("int64", value); + return getBuilderAfterInt64(instance); + } + + default T int64(String value) { + var instance = getInstance(); + instance.put("int64", value); + return getBuilderAfterInt64(instance); + } + + default T int64(int value) { + var instance = getInstance(); + instance.put("int64", value); + return getBuilderAfterInt64(instance); + } + + default T int64(float value) { + var instance = getInstance(); + instance.put("int64", value); + return getBuilderAfterInt64(instance); + } + + default T int64(long value) { + var instance = getInstance(); + instance.put("int64", value); + return getBuilderAfterInt64(instance); + } + + default T int64(double value) { + var instance = getInstance(); + instance.put("int64", value); + return getBuilderAfterInt64(instance); + } + + default T int64(List value) { + var instance = getInstance(); + instance.put("int64", value); + return getBuilderAfterInt64(instance); + } + + default T int64(Map value) { + var instance = getInstance(); + instance.put("int64", value); + return getBuilderAfterInt64(instance); + } + } + + public interface SetterForDoubleSchema { + Map getInstance(); + T getBuilderAfterDoubleSchema(Map instance); + + default T setDouble(Nothing? value) { + var instance = getInstance(); + instance.put("double", null); + return getBuilderAfterDoubleSchema(instance); + } + + default T setDouble(boolean value) { + var instance = getInstance(); + instance.put("double", value); + return getBuilderAfterDoubleSchema(instance); + } + + default T setDouble(String value) { + var instance = getInstance(); + instance.put("double", value); + return getBuilderAfterDoubleSchema(instance); + } + + default T setDouble(int value) { + var instance = getInstance(); + instance.put("double", value); + return getBuilderAfterDoubleSchema(instance); + } + + default T setDouble(float value) { + var instance = getInstance(); + instance.put("double", value); + return getBuilderAfterDoubleSchema(instance); + } + + default T setDouble(long value) { + var instance = getInstance(); + instance.put("double", value); + return getBuilderAfterDoubleSchema(instance); + } + + default T setDouble(double value) { + var instance = getInstance(); + instance.put("double", value); + return getBuilderAfterDoubleSchema(instance); + } + + default T setDouble(List value) { + var instance = getInstance(); + instance.put("double", value); + return getBuilderAfterDoubleSchema(instance); + } + + default T setDouble(Map value) { + var instance = getInstance(); + instance.put("double", value); + return getBuilderAfterDoubleSchema(instance); + } + } + + public interface SetterForFloatSchema { + Map getInstance(); + T getBuilderAfterFloatSchema(Map instance); + + default T setFloat(Nothing? value) { + var instance = getInstance(); + instance.put("float", null); + return getBuilderAfterFloatSchema(instance); + } + + default T setFloat(boolean value) { + var instance = getInstance(); + instance.put("float", value); + return getBuilderAfterFloatSchema(instance); + } + + default T setFloat(String value) { + var instance = getInstance(); + instance.put("float", value); + return getBuilderAfterFloatSchema(instance); + } + + default T setFloat(int value) { + var instance = getInstance(); + instance.put("float", value); + return getBuilderAfterFloatSchema(instance); + } + + default T setFloat(float value) { + var instance = getInstance(); + instance.put("float", value); + return getBuilderAfterFloatSchema(instance); + } + + default T setFloat(long value) { + var instance = getInstance(); + instance.put("float", value); + return getBuilderAfterFloatSchema(instance); + } + + default T setFloat(double value) { + var instance = getInstance(); + instance.put("float", value); + return getBuilderAfterFloatSchema(instance); + } + + default T setFloat(List value) { + var instance = getInstance(); + instance.put("float", value); + return getBuilderAfterFloatSchema(instance); + } + + default T setFloat(Map value) { + var instance = getInstance(); + instance.put("float", value); + return getBuilderAfterFloatSchema(instance); + } + } + + public static class AnyTypeAndFormatMapBuilder extends UnsetAddPropsSetter implements GenericBuilder>, SetterForUuidSchema, SetterForDate, SetterForDatetime, SetterForNumberSchema, SetterForBinary, SetterForInt32, SetterForInt64, SetterForDoubleSchema, SetterForFloatSchema { + private final Map instance; + private static final Set knownKeys = Set.of( + "uuid", + "date", + "date-time", + "number", + "binary", + "int32", + "int64", + "double", + "float" + ); + public Set getKnownKeys() { + return knownKeys; + } + public AnyTypeAndFormatMapBuilder() { + this.instance = new LinkedHashMap<>(); + } + public Map build() { + return instance; + } + public Map getInstance() { + return instance; + } + public AnyTypeAndFormatMapBuilder getBuilderAfterUuidSchema(Map instance) { + return this; + } + public AnyTypeAndFormatMapBuilder getBuilderAfterDate(Map instance) { + return this; + } + public AnyTypeAndFormatMapBuilder getBuilderAfterDatetime(Map instance) { + return this; + } + public AnyTypeAndFormatMapBuilder getBuilderAfterNumberSchema(Map instance) { + return this; + } + public AnyTypeAndFormatMapBuilder getBuilderAfterBinary(Map instance) { + return this; + } + public AnyTypeAndFormatMapBuilder getBuilderAfterInt32(Map instance) { + return this; + } + public AnyTypeAndFormatMapBuilder getBuilderAfterInt64(Map instance) { + return this; + } + public AnyTypeAndFormatMapBuilder getBuilderAfterDoubleSchema(Map instance) { + return this; + } + public AnyTypeAndFormatMapBuilder getBuilderAfterFloatSchema(Map instance) { + return this; + } + public AnyTypeAndFormatMapBuilder getBuilderAfterAdditionalProperty(Map instance) { + return this; + } + } + + + public sealed interface AnyTypeAndFormat1Boxed permits AnyTypeAndFormat1BoxedMap { + @Nullable Object getData(); + } + + public record AnyTypeAndFormat1BoxedMap(AnyTypeAndFormatMap data) implements AnyTypeAndFormat1Boxed { + @Override + public @Nullable Object getData() { + return data; + } + } + + + public static class AnyTypeAndFormat1 extends JsonSchema implements MapSchemaValidator { + /* + NOTE: This class is auto generated by OpenAPI JSON Schema Generator. + Ref: https://github.com/openapi-json-schema-tools/openapi-json-schema-generator + + Do not edit the class manually. + */ + private static @Nullable AnyTypeAndFormat1 instance = null; + + protected AnyTypeAndFormat1() { + super(new JsonSchemaInfo() + .type(Set.of(Map.class)) + .properties(Map.ofEntries( + new PropertyEntry("uuid", UuidSchema.class), + new PropertyEntry("date", Date.class), + new PropertyEntry("date-time", Datetime.class), + new PropertyEntry("number", NumberSchema.class), + new PropertyEntry("binary", Binary.class), + new PropertyEntry("int32", Int32.class), + new PropertyEntry("int64", Int64.class), + new PropertyEntry("double", DoubleSchema.class), + new PropertyEntry("float", FloatSchema.class) + )) + ); + } + + public static AnyTypeAndFormat1 getInstance() { + if (instance == null) { + instance = new AnyTypeAndFormat1(); + } + return instance; + } + + 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 RuntimeException("Invalid non-string key value"); + } + String propertyName = (String) entryKey; + List propertyPathToItem = new ArrayList<>(pathToItem); + propertyPathToItem.add(propertyName); + Object value = entry.getValue(); + LinkedHashMap, Nothing?> schemas = pathToSchemas.get(propertyPathToItem); + if (schemas == null) { + throw new RuntimeException("Validation result is invalid, schemas must exist for a pathToItem"); + } + JsonSchema propertySchema = schemas.entrySet().iterator().next().getKey(); + @Nullable Object propertyInstance = propertySchema.getNewInstance(value, propertyPathToItem, pathToSchemas); + properties.put(propertyName, propertyInstance); + } + FrozenMap<@Nullable Object> castProperties = new FrozenMap<>(properties); + return new AnyTypeAndFormatMap(castProperties); + } + + 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); + SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().build())); + ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, new PathToSchemasMap(), new LinkedHashSet<>()); + PathToSchemasMap pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet); + return getNewInstance(castArg, validationMetadata.pathToItem(), pathToSchemasMap); + } + + + @Override + public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws 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"); + } + @Override + public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { + if (arg instanceof Map) { + return getNewInstance((Map) arg, pathToItem, pathToSchemas); + } + 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 { + return new AnyTypeAndFormat1BoxedMap(validate(arg, configuration)); + } + @Override + public AnyTypeAndFormat1Boxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { + 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"); + } + } + +} diff --git a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/schemas/AnyTypeNotString.kt b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/schemas/AnyTypeNotString.kt new file mode 100644 index 00000000000..e1fc92d61ae --- /dev/null +++ b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/schemas/AnyTypeNotString.kt @@ -0,0 +1,339 @@ +package org.openapijsonschematools.client.components.schemas; +import java.time.LocalDate; +import java.time.ZonedDateTime; +import java.util.ArrayList; +import java.util.HashSet; +import java.util.LinkedHashMap; +import java.util.LinkedHashSet; +import java.util.List; +import java.util.Map; +import java.util.Objects; +import java.util.Set; +import java.util.UUID; +import org.checkerframework.checker.nullness.qual.Nullable; +import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags; +import org.openapijsonschematools.client.configurations.SchemaConfiguration; +import org.openapijsonschematools.client.exceptions.InvalidAdditionalPropertyException; +import org.openapijsonschematools.client.exceptions.UnsetPropertyException; +import org.openapijsonschematools.client.exceptions.ValidationException; +import org.openapijsonschematools.client.schemas.StringJsonSchema; +import org.openapijsonschematools.client.schemas.UnsetAddPropsSetter; +import org.openapijsonschematools.client.schemas.validation.BooleanSchemaValidator; +import org.openapijsonschematools.client.schemas.validation.FrozenList; +import org.openapijsonschematools.client.schemas.validation.FrozenMap; +import org.openapijsonschematools.client.schemas.validation.JsonSchema; +import org.openapijsonschematools.client.schemas.validation.JsonSchemaInfo; +import org.openapijsonschematools.client.schemas.validation.ListSchemaValidator; +import org.openapijsonschematools.client.schemas.validation.MapSchemaValidator; +import org.openapijsonschematools.client.schemas.validation.NullSchemaValidator; +import org.openapijsonschematools.client.schemas.validation.NumberSchemaValidator; +import org.openapijsonschematools.client.schemas.validation.PathToSchemasMap; +import org.openapijsonschematools.client.schemas.validation.StringSchemaValidator; +import org.openapijsonschematools.client.schemas.validation.ValidationMetadata; + +public class AnyTypeNotString { + // nest classes so all schemas and input/output classes can be public + + + public static class Not extends StringJsonSchema.StringJsonSchema1 { + private static @Nullable Not instance = null; + public static Not getInstance() { + if (instance == null) { + instance = new Not(); + } + return instance; + } + } + + + public sealed interface AnyTypeNotString1Boxed permits AnyTypeNotString1BoxedVoid, AnyTypeNotString1BoxedBoolean, AnyTypeNotString1BoxedNumber, AnyTypeNotString1BoxedString, AnyTypeNotString1BoxedList, AnyTypeNotString1BoxedMap { + @Nullable Object getData(); + } + + public record AnyTypeNotString1BoxedVoid(Nothing? data) implements AnyTypeNotString1Boxed { + @Override + public @Nullable Object getData() { + return data; + } + } + + public record AnyTypeNotString1BoxedBoolean(boolean data) implements AnyTypeNotString1Boxed { + @Override + public @Nullable Object getData() { + return data; + } + } + + public record AnyTypeNotString1BoxedNumber(Number data) implements AnyTypeNotString1Boxed { + @Override + public @Nullable Object getData() { + return data; + } + } + + public record AnyTypeNotString1BoxedString(String data) implements AnyTypeNotString1Boxed { + @Override + public @Nullable Object getData() { + return data; + } + } + + public record AnyTypeNotString1BoxedList(FrozenList<@Nullable Object> data) implements AnyTypeNotString1Boxed { + @Override + public @Nullable Object getData() { + return data; + } + } + + public record AnyTypeNotString1BoxedMap(FrozenMap<@Nullable Object> data) implements AnyTypeNotString1Boxed { + @Override + public @Nullable Object getData() { + return data; + } + } + + + public static class AnyTypeNotString1 extends JsonSchema implements NullSchemaValidator, BooleanSchemaValidator, NumberSchemaValidator, StringSchemaValidator, ListSchemaValidator, AnyTypeNotString1BoxedList>, MapSchemaValidator, AnyTypeNotString1BoxedMap> { + /* + NOTE: This class is auto generated by OpenAPI JSON Schema Generator. + Ref: https://github.com/openapi-json-schema-tools/openapi-json-schema-generator + + Do not edit the class manually. + */ + private static @Nullable AnyTypeNotString1 instance = null; + + protected AnyTypeNotString1() { + super(new JsonSchemaInfo() + .not(Not.class) + ); + } + + public static AnyTypeNotString1 getInstance() { + if (instance == null) { + instance = new AnyTypeNotString1(); + } + return instance; + } + + @Override + public Nothing? validate(Nothing? arg, SchemaConfiguration configuration) throws ValidationException { + Set> pathSet = new HashSet<>(); + List pathToItem = List.of("args[0]"); + Nothing? castArg = castToAllowedTypes(arg, pathToItem, pathSet); + SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().build())); + PathToSchemasMap validatedPathToSchemas = new PathToSchemasMap(); + ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, new LinkedHashSet<>()); + getPathToSchemas(this, castArg, validationMetadata, pathSet); + return castArg; + } + + @Override + public boolean validate(boolean arg, SchemaConfiguration configuration) throws ValidationException { + Set> pathSet = new HashSet<>(); + List pathToItem = List.of("args[0]"); + boolean castArg = castToAllowedTypes(arg, pathToItem, pathSet); + SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().build())); + PathToSchemasMap validatedPathToSchemas = new PathToSchemasMap(); + ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, new LinkedHashSet<>()); + getPathToSchemas(this, castArg, validationMetadata, pathSet); + return castArg; + } + + @Override + public Number validate(Number arg, SchemaConfiguration configuration) throws ValidationException { + Set> pathSet = new HashSet<>(); + List pathToItem = List.of("args[0]"); + Number castArg = castToAllowedTypes(arg, pathToItem, pathSet); + SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().build())); + PathToSchemasMap validatedPathToSchemas = new PathToSchemasMap(); + ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, new LinkedHashSet<>()); + getPathToSchemas(this, castArg, validationMetadata, pathSet); + return castArg; + } + + public int validate(int arg, SchemaConfiguration configuration) throws ValidationException { + return (int) validate((Number) arg, configuration); + } + + public long validate(long arg, SchemaConfiguration configuration) throws ValidationException { + return (long) validate((Number) arg, configuration); + } + + public float validate(float arg, SchemaConfiguration configuration) throws ValidationException { + return (float) validate((Number) arg, configuration); + } + + public double validate(double arg, SchemaConfiguration configuration) throws ValidationException { + return (double) validate((Number) arg, configuration); + } + + @Override + public String validate(String arg, SchemaConfiguration configuration) throws ValidationException { + Set> pathSet = new HashSet<>(); + List pathToItem = List.of("args[0]"); + String castArg = castToAllowedTypes(arg, pathToItem, pathSet); + SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().build())); + PathToSchemasMap validatedPathToSchemas = new PathToSchemasMap(); + ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, new LinkedHashSet<>()); + getPathToSchemas(this, castArg, validationMetadata, pathSet); + return castArg; + } + + public String validate(LocalDate arg, SchemaConfiguration configuration) throws ValidationException { + return validate(arg.toString(), configuration); + } + + public String validate(ZonedDateTime arg, SchemaConfiguration configuration) throws ValidationException { + return validate(arg.toString(), configuration); + } + + public String validate(UUID arg, SchemaConfiguration configuration) throws ValidationException { + return validate(arg.toString(), configuration); + } + + @Override + public FrozenList<@Nullable Object> getNewInstance(List arg, List pathToItem, PathToSchemasMap pathToSchemas) { + List<@Nullable Object> items = new ArrayList<>(); + int i = 0; + for (Object item: arg) { + List itemPathToItem = new ArrayList<>(pathToItem); + itemPathToItem.add(i); + LinkedHashMap, Nothing?> schemas = pathToSchemas.get(itemPathToItem); + if (schemas == null) { + throw new RuntimeException("Validation result is invalid, schemas must exist for a pathToItem"); + } + JsonSchema itemSchema = schemas.entrySet().iterator().next().getKey(); + @Nullable Object itemInstance = itemSchema.getNewInstance(item, itemPathToItem, pathToSchemas); + items.add(itemInstance); + i += 1; + } + FrozenList<@Nullable Object> newInstanceItems = new FrozenList<>(items); + return newInstanceItems; + } + + 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); + SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().build())); + ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, new PathToSchemasMap(), new LinkedHashSet<>()); + PathToSchemasMap pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet); + return getNewInstance(castArg, validationMetadata.pathToItem(), pathToSchemasMap); + } + + @Override + 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 RuntimeException("Invalid non-string key value"); + } + String propertyName = (String) entryKey; + List propertyPathToItem = new ArrayList<>(pathToItem); + propertyPathToItem.add(propertyName); + Object value = entry.getValue(); + LinkedHashMap, Nothing?> schemas = pathToSchemas.get(propertyPathToItem); + if (schemas == null) { + throw new RuntimeException("Validation result is invalid, schemas must exist for a pathToItem"); + } + JsonSchema propertySchema = schemas.entrySet().iterator().next().getKey(); + @Nullable Object propertyInstance = propertySchema.getNewInstance(value, propertyPathToItem, pathToSchemas); + properties.put(propertyName, propertyInstance); + } + FrozenMap<@Nullable Object> castProperties = new FrozenMap<>(properties); + return castProperties; + } + + public FrozenMap<@Nullable Object> validate(Map arg, SchemaConfiguration configuration) throws ValidationException { + Set> pathSet = new HashSet<>(); + List pathToItem = List.of("args[0]"); + Map castArg = castToAllowedTypes(arg, pathToItem, pathSet); + SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().build())); + PathToSchemasMap validatedPathToSchemas = new PathToSchemasMap(); + ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, new LinkedHashSet<>()); + PathToSchemasMap pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet); + return getNewInstance(castArg, validationMetadata.pathToItem(), pathToSchemasMap); + } + + @Override + public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { + if (arg == null) { + return validate((Nothing?) null, configuration); + } else if (arg instanceof Boolean) { + boolean boolArg = (Boolean) arg; + return validate(boolArg, configuration); + } else if (arg instanceof Number) { + return validate((Number) arg, configuration); + } else if (arg instanceof String) { + return validate((String) arg, configuration); + } else if (arg instanceof List) { + return validate((List) arg, 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"); + } + @Override + public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { + if (arg == null) { + return getNewInstance((Nothing?) null, pathToItem, pathToSchemas); + } else if (arg instanceof Boolean) { + boolean boolArg = (Boolean) arg; + return getNewInstance(boolArg, pathToItem, pathToSchemas); + } else if (arg instanceof Number) { + return getNewInstance((Number) arg, pathToItem, pathToSchemas); + } else if (arg instanceof String) { + return getNewInstance((String) arg, pathToItem, pathToSchemas); + } else if (arg instanceof List) { + return getNewInstance((List) arg, 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"); + } + @Override + public AnyTypeNotString1BoxedVoid validateAndBox(Nothing? arg, SchemaConfiguration configuration) throws ValidationException { + return new AnyTypeNotString1BoxedVoid(validate(arg, configuration)); + } + @Override + 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 { + return new AnyTypeNotString1BoxedNumber(validate(arg, configuration)); + } + @Override + 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 { + return new AnyTypeNotString1BoxedList(validate(arg, configuration)); + } + @Override + 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 { + if (arg == null) { + Nothing? castArg = (Nothing?) arg; + return validateAndBox(castArg, configuration); + } else if (arg instanceof Boolean booleanArg) { + boolean castArg = booleanArg; + return validateAndBox(castArg, configuration); + } else if (arg instanceof String castArg) { + return validateAndBox(castArg, configuration); + } else if (arg instanceof Number castArg) { + return validateAndBox(castArg, configuration); + } else if (arg instanceof List castArg) { + 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"); + } + } +} diff --git a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/schemas/ApiResponseSchema.kt b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/schemas/ApiResponseSchema.kt new file mode 100644 index 00000000000..eb7876838e7 --- /dev/null +++ b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/schemas/ApiResponseSchema.kt @@ -0,0 +1,289 @@ +package org.openapijsonschematools.client.components.schemas; +import java.util.ArrayList; +import java.util.HashSet; +import java.util.LinkedHashMap; +import java.util.LinkedHashSet; +import java.util.List; +import java.util.Map; +import java.util.Objects; +import java.util.Set; +import org.checkerframework.checker.nullness.qual.Nullable; +import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags; +import org.openapijsonschematools.client.configurations.SchemaConfiguration; +import org.openapijsonschematools.client.exceptions.InvalidAdditionalPropertyException; +import org.openapijsonschematools.client.exceptions.UnsetPropertyException; +import org.openapijsonschematools.client.exceptions.ValidationException; +import org.openapijsonschematools.client.schemas.GenericBuilder; +import org.openapijsonschematools.client.schemas.Int32JsonSchema; +import org.openapijsonschematools.client.schemas.StringJsonSchema; +import org.openapijsonschematools.client.schemas.UnsetAddPropsSetter; +import org.openapijsonschematools.client.schemas.validation.FrozenMap; +import org.openapijsonschematools.client.schemas.validation.JsonSchema; +import org.openapijsonschematools.client.schemas.validation.JsonSchemaInfo; +import org.openapijsonschematools.client.schemas.validation.MapSchemaValidator; +import org.openapijsonschematools.client.schemas.validation.PathToSchemasMap; +import org.openapijsonschematools.client.schemas.validation.PropertyEntry; +import org.openapijsonschematools.client.schemas.validation.ValidationMetadata; + +public class ApiResponseSchema { + // nest classes so all schemas and input/output classes can be public + + + public static class Code extends Int32JsonSchema.Int32JsonSchema1 { + private static @Nullable Code instance = null; + public static Code getInstance() { + if (instance == null) { + instance = new Code(); + } + return instance; + } + } + + + public static class Type extends StringJsonSchema.StringJsonSchema1 { + private static @Nullable Type instance = null; + public static Type getInstance() { + if (instance == null) { + instance = new Type(); + } + return instance; + } + } + + + public static class Message extends StringJsonSchema.StringJsonSchema1 { + private static @Nullable Message instance = null; + public static Message getInstance() { + if (instance == null) { + instance = new Message(); + } + return instance; + } + } + + + public static class ApiResponseMap extends FrozenMap<@Nullable Object> { + protected ApiResponseMap(FrozenMap<@Nullable Object> m) { + super(m); + } + public static final Set requiredKeys = Set.of(); + public static final Set optionalKeys = Set.of( + "code", + "type", + "message" + ); + public static ApiResponseMap of(Map arg, SchemaConfiguration configuration) throws ValidationException { + return ApiResponseSchema1.getInstance().validate(arg, configuration); + } + + public Number code() throws UnsetPropertyException { + String key = "code"; + throwIfKeyNotPresent(key); + @Nullable Object value = get(key); + if (!(value instanceof Number)) { + throw new RuntimeException("Invalid value stored for code"); + } + return (Number) value; + } + + public String type() throws UnsetPropertyException { + String key = "type"; + throwIfKeyNotPresent(key); + @Nullable Object value = get(key); + if (!(value instanceof String)) { + throw new RuntimeException("Invalid value stored for type"); + } + return (String) value; + } + + public String message() throws UnsetPropertyException { + String key = "message"; + throwIfKeyNotPresent(key); + @Nullable Object value = get(key); + if (!(value instanceof String)) { + throw new RuntimeException("Invalid value stored for message"); + } + return (String) value; + } + + public @Nullable Object getAdditionalProperty(String name) throws UnsetPropertyException, InvalidAdditionalPropertyException { + throwIfKeyKnown(name, requiredKeys, optionalKeys); + throwIfKeyNotPresent(name); + return get(name); + } + } + + public interface SetterForCode { + Map getInstance(); + T getBuilderAfterCode(Map instance); + + default T code(int value) { + var instance = getInstance(); + instance.put("code", value); + return getBuilderAfterCode(instance); + } + + default T code(float value) { + var instance = getInstance(); + instance.put("code", value); + return getBuilderAfterCode(instance); + } + } + + public interface SetterForType { + Map getInstance(); + T getBuilderAfterType(Map instance); + + default T type(String value) { + var instance = getInstance(); + instance.put("type", value); + return getBuilderAfterType(instance); + } + } + + public interface SetterForMessage { + Map getInstance(); + T getBuilderAfterMessage(Map instance); + + default T message(String value) { + var instance = getInstance(); + instance.put("message", value); + return getBuilderAfterMessage(instance); + } + } + + public static class ApiResponseMapBuilder extends UnsetAddPropsSetter implements GenericBuilder>, SetterForCode, SetterForType, SetterForMessage { + private final Map instance; + private static final Set knownKeys = Set.of( + "code", + "type", + "message" + ); + public Set getKnownKeys() { + return knownKeys; + } + public ApiResponseMapBuilder() { + this.instance = new LinkedHashMap<>(); + } + public Map build() { + return instance; + } + public Map getInstance() { + return instance; + } + public ApiResponseMapBuilder getBuilderAfterCode(Map instance) { + return this; + } + public ApiResponseMapBuilder getBuilderAfterType(Map instance) { + return this; + } + public ApiResponseMapBuilder getBuilderAfterMessage(Map instance) { + return this; + } + public ApiResponseMapBuilder getBuilderAfterAdditionalProperty(Map instance) { + return this; + } + } + + + public sealed interface ApiResponseSchema1Boxed permits ApiResponseSchema1BoxedMap { + @Nullable Object getData(); + } + + public record ApiResponseSchema1BoxedMap(ApiResponseMap data) implements ApiResponseSchema1Boxed { + @Override + public @Nullable Object getData() { + return data; + } + } + + + public static class ApiResponseSchema1 extends JsonSchema implements MapSchemaValidator { + /* + NOTE: This class is auto generated by OpenAPI JSON Schema Generator. + Ref: https://github.com/openapi-json-schema-tools/openapi-json-schema-generator + + Do not edit the class manually. + */ + private static @Nullable ApiResponseSchema1 instance = null; + + protected ApiResponseSchema1() { + super(new JsonSchemaInfo() + .type(Set.of(Map.class)) + .properties(Map.ofEntries( + new PropertyEntry("code", Code.class), + new PropertyEntry("type", Type.class), + new PropertyEntry("message", Message.class) + )) + ); + } + + public static ApiResponseSchema1 getInstance() { + if (instance == null) { + instance = new ApiResponseSchema1(); + } + return instance; + } + + 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 RuntimeException("Invalid non-string key value"); + } + String propertyName = (String) entryKey; + List propertyPathToItem = new ArrayList<>(pathToItem); + propertyPathToItem.add(propertyName); + Object value = entry.getValue(); + LinkedHashMap, Nothing?> schemas = pathToSchemas.get(propertyPathToItem); + if (schemas == null) { + throw new RuntimeException("Validation result is invalid, schemas must exist for a pathToItem"); + } + JsonSchema propertySchema = schemas.entrySet().iterator().next().getKey(); + @Nullable Object propertyInstance = propertySchema.getNewInstance(value, propertyPathToItem, pathToSchemas); + properties.put(propertyName, propertyInstance); + } + FrozenMap<@Nullable Object> castProperties = new FrozenMap<>(properties); + return new ApiResponseMap(castProperties); + } + + 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); + SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().build())); + ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, new PathToSchemasMap(), new LinkedHashSet<>()); + PathToSchemasMap pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet); + return getNewInstance(castArg, validationMetadata.pathToItem(), pathToSchemasMap); + } + + + @Override + public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws 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"); + } + @Override + public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { + if (arg instanceof Map) { + return getNewInstance((Map) arg, pathToItem, pathToSchemas); + } + 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 { + return new ApiResponseSchema1BoxedMap(validate(arg, configuration)); + } + @Override + public ApiResponseSchema1Boxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { + 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"); + } + } + +} diff --git a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/schemas/Apple.kt b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/schemas/Apple.kt new file mode 100644 index 00000000000..1d546b70cdb --- /dev/null +++ b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/schemas/Apple.kt @@ -0,0 +1,412 @@ +package org.openapijsonschematools.client.components.schemas; +import java.util.ArrayList; +import java.util.HashSet; +import java.util.LinkedHashMap; +import java.util.LinkedHashSet; +import java.util.List; +import java.util.Map; +import java.util.Objects; +import java.util.Set; +import java.util.regex.Pattern; +import org.checkerframework.checker.nullness.qual.Nullable; +import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags; +import org.openapijsonschematools.client.configurations.SchemaConfiguration; +import org.openapijsonschematools.client.exceptions.InvalidAdditionalPropertyException; +import org.openapijsonschematools.client.exceptions.UnsetPropertyException; +import org.openapijsonschematools.client.exceptions.ValidationException; +import org.openapijsonschematools.client.schemas.GenericBuilder; +import org.openapijsonschematools.client.schemas.UnsetAddPropsSetter; +import org.openapijsonschematools.client.schemas.validation.FrozenMap; +import org.openapijsonschematools.client.schemas.validation.JsonSchema; +import org.openapijsonschematools.client.schemas.validation.JsonSchemaInfo; +import org.openapijsonschematools.client.schemas.validation.MapSchemaValidator; +import org.openapijsonschematools.client.schemas.validation.NullSchemaValidator; +import org.openapijsonschematools.client.schemas.validation.PathToSchemasMap; +import org.openapijsonschematools.client.schemas.validation.PropertyEntry; +import org.openapijsonschematools.client.schemas.validation.StringSchemaValidator; +import org.openapijsonschematools.client.schemas.validation.ValidationMetadata; + +public class Apple { + // nest classes so all schemas and input/output classes can be public + + + public sealed interface CultivarBoxed permits CultivarBoxedString { + @Nullable Object getData(); + } + + public record CultivarBoxedString(String data) implements CultivarBoxed { + @Override + public @Nullable Object getData() { + return data; + } + } + + + + public static class Cultivar extends JsonSchema implements StringSchemaValidator { + private static @Nullable Cultivar instance = null; + + protected Cultivar() { + super(new JsonSchemaInfo() + .type(Set.of( + String.class + )) + .pattern(Pattern.compile( + "^[a-zA-Z\\s]*$" + )) + ); + } + + public static Cultivar getInstance() { + if (instance == null) { + instance = new Cultivar(); + } + return instance; + } + + @Override + public String validate(String arg, SchemaConfiguration configuration) throws ValidationException { + Set> pathSet = new HashSet<>(); + List pathToItem = List.of("args[0"); + String castArg = castToAllowedTypes(arg, pathToItem, pathSet); + SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().build())); + ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, new PathToSchemasMap(), new LinkedHashSet<>()); + getPathToSchemas(this, castArg, validationMetadata, pathSet); + return castArg; + } + + @Override + public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws 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"); + } + @Override + public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { + 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"); + } + @Override + 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 { + 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"); + } + } + + public sealed interface OriginBoxed permits OriginBoxedString { + @Nullable Object getData(); + } + + public record OriginBoxedString(String data) implements OriginBoxed { + @Override + public @Nullable Object getData() { + return data; + } + } + + + + public static class Origin extends JsonSchema implements StringSchemaValidator { + private static @Nullable Origin instance = null; + + protected Origin() { + super(new JsonSchemaInfo() + .type(Set.of( + String.class + )) + .pattern(Pattern.compile( + "^[A-Z\\s]*$", + Pattern.CASE_INSENSITIVE + )) + ); + } + + public static Origin getInstance() { + if (instance == null) { + instance = new Origin(); + } + return instance; + } + + @Override + public String validate(String arg, SchemaConfiguration configuration) throws ValidationException { + Set> pathSet = new HashSet<>(); + List pathToItem = List.of("args[0"); + String castArg = castToAllowedTypes(arg, pathToItem, pathSet); + SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().build())); + ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, new PathToSchemasMap(), new LinkedHashSet<>()); + getPathToSchemas(this, castArg, validationMetadata, pathSet); + return castArg; + } + + @Override + public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws 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"); + } + @Override + public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { + 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"); + } + @Override + 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 { + 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"); + } + } + + public static class AppleMap extends FrozenMap<@Nullable Object> { + protected AppleMap(FrozenMap<@Nullable Object> m) { + super(m); + } + public static final Set requiredKeys = Set.of( + "cultivar" + ); + public static final Set optionalKeys = Set.of( + "origin" + ); + public static AppleMap of(Map arg, SchemaConfiguration configuration) throws ValidationException { + return Apple1.getInstance().validate(arg, configuration); + } + + public String cultivar() { + @Nullable Object value = get("cultivar"); + if (!(value instanceof String)) { + throw new RuntimeException("Invalid value stored for cultivar"); + } + return (String) value; + } + + public String origin() throws UnsetPropertyException { + String key = "origin"; + throwIfKeyNotPresent(key); + @Nullable Object value = get(key); + if (!(value instanceof String)) { + throw new RuntimeException("Invalid value stored for origin"); + } + return (String) value; + } + + public @Nullable Object getAdditionalProperty(String name) throws UnsetPropertyException, InvalidAdditionalPropertyException { + throwIfKeyKnown(name, requiredKeys, optionalKeys); + throwIfKeyNotPresent(name); + return get(name); + } + } + + public interface SetterForCultivar { + Map getInstance(); + T getBuilderAfterCultivar(Map instance); + + default T cultivar(String value) { + var instance = getInstance(); + instance.put("cultivar", value); + return getBuilderAfterCultivar(instance); + } + } + + public interface SetterForOrigin { + Map getInstance(); + T getBuilderAfterOrigin(Map instance); + + default T origin(String value) { + var instance = getInstance(); + instance.put("origin", value); + return getBuilderAfterOrigin(instance); + } + } + + public static class AppleMap0Builder extends UnsetAddPropsSetter implements GenericBuilder>, SetterForOrigin { + private final Map instance; + private static final Set knownKeys = Set.of( + "cultivar", + "origin" + ); + public Set getKnownKeys() { + return knownKeys; + } + public AppleMap0Builder(Map instance) { + this.instance = instance; + } + public Map build() { + return instance; + } + public Map getInstance() { + return instance; + } + public AppleMap0Builder getBuilderAfterOrigin(Map instance) { + return this; + } + public AppleMap0Builder getBuilderAfterAdditionalProperty(Map instance) { + return this; + } + } + + public static class AppleMapBuilder implements SetterForCultivar { + private final Map instance; + public AppleMapBuilder() { + this.instance = new LinkedHashMap<>(); + } + public Map getInstance() { + return instance; + } + public AppleMap0Builder getBuilderAfterCultivar(Map instance) { + return new AppleMap0Builder(instance); + } + } + + + public sealed interface Apple1Boxed permits Apple1BoxedNothing?, Apple1BoxedMap { + @Nullable Object getData(); + } + + public record Apple1BoxedVoid(Nothing? data) implements Apple1Boxed { + @Override + public @Nullable Object getData() { + return data; + } + } + + public record Apple1BoxedMap(AppleMap data) implements Apple1Boxed { + @Override + public @Nullable Object getData() { + return data; + } + } + + + public static class Apple1 extends JsonSchema implements NullSchemaValidator, MapSchemaValidator { + /* + NOTE: This class is auto generated by OpenAPI JSON Schema Generator. + Ref: https://github.com/openapi-json-schema-tools/openapi-json-schema-generator + + Do not edit the class manually. + */ + private static @Nullable Apple1 instance = null; + + protected Apple1() { + super(new JsonSchemaInfo() + .type(Set.of( + Nothing?.class, + Map.class + )) + .properties(Map.ofEntries( + new PropertyEntry("cultivar", Cultivar.class), + new PropertyEntry("origin", Origin.class) + )) + .required(Set.of( + "cultivar" + )) + ); + } + + public static Apple1 getInstance() { + if (instance == null) { + instance = new Apple1(); + } + return instance; + } + + @Override + public Nothing? validate(Nothing? arg, SchemaConfiguration configuration) throws ValidationException { + Set> pathSet = new HashSet<>(); + List pathToItem = List.of("args[0"); + Nothing? castArg = castToAllowedTypes(arg, pathToItem, pathSet); + SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().build())); + ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, new PathToSchemasMap(), new LinkedHashSet<>()); + getPathToSchemas(this, castArg, validationMetadata, pathSet); + return castArg; + } + + 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 RuntimeException("Invalid non-string key value"); + } + String propertyName = (String) entryKey; + List propertyPathToItem = new ArrayList<>(pathToItem); + propertyPathToItem.add(propertyName); + Object value = entry.getValue(); + LinkedHashMap, Nothing?> schemas = pathToSchemas.get(propertyPathToItem); + if (schemas == null) { + throw new RuntimeException("Validation result is invalid, schemas must exist for a pathToItem"); + } + JsonSchema propertySchema = schemas.entrySet().iterator().next().getKey(); + @Nullable Object propertyInstance = propertySchema.getNewInstance(value, propertyPathToItem, pathToSchemas); + properties.put(propertyName, propertyInstance); + } + FrozenMap<@Nullable Object> castProperties = new FrozenMap<>(properties); + return new AppleMap(castProperties); + } + + 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); + SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().build())); + ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, new PathToSchemasMap(), new LinkedHashSet<>()); + PathToSchemasMap pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet); + return getNewInstance(castArg, validationMetadata.pathToItem(), pathToSchemasMap); + } + + + @Override + public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { + if (arg == null) { + return validate((Nothing?) 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"); + } + @Override + public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { + if (arg == null) { + return getNewInstance((Nothing?) 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"); + } + @Override + public Apple1BoxedVoid validateAndBox(Nothing? arg, SchemaConfiguration configuration) throws ValidationException { + return new Apple1BoxedVoid(validate(arg, configuration)); + } + @Override + 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 { + if (arg == null) { + Nothing? castArg = (Nothing?) 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"); + } + } +} diff --git a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/schemas/AppleReq.kt b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/schemas/AppleReq.kt new file mode 100644 index 00000000000..6ee8fce1ee7 --- /dev/null +++ b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/schemas/AppleReq.kt @@ -0,0 +1,265 @@ +package org.openapijsonschematools.client.components.schemas; +import java.util.ArrayList; +import java.util.HashSet; +import java.util.LinkedHashMap; +import java.util.LinkedHashSet; +import java.util.List; +import java.util.Map; +import java.util.Objects; +import java.util.Set; +import org.checkerframework.checker.nullness.qual.Nullable; +import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags; +import org.openapijsonschematools.client.configurations.SchemaConfiguration; +import org.openapijsonschematools.client.exceptions.UnsetPropertyException; +import org.openapijsonschematools.client.exceptions.ValidationException; +import org.openapijsonschematools.client.schemas.AnyTypeJsonSchema; +import org.openapijsonschematools.client.schemas.BooleanJsonSchema; +import org.openapijsonschematools.client.schemas.GenericBuilder; +import org.openapijsonschematools.client.schemas.NotAnyTypeJsonSchema; +import org.openapijsonschematools.client.schemas.StringJsonSchema; +import org.openapijsonschematools.client.schemas.validation.FrozenMap; +import org.openapijsonschematools.client.schemas.validation.JsonSchema; +import org.openapijsonschematools.client.schemas.validation.JsonSchemaInfo; +import org.openapijsonschematools.client.schemas.validation.MapSchemaValidator; +import org.openapijsonschematools.client.schemas.validation.MapUtils; +import org.openapijsonschematools.client.schemas.validation.PathToSchemasMap; +import org.openapijsonschematools.client.schemas.validation.PropertyEntry; +import org.openapijsonschematools.client.schemas.validation.ValidationMetadata; + +public class AppleReq { + // nest classes so all schemas and input/output classes can be public + + + public static class AdditionalProperties extends NotAnyTypeJsonSchema.NotAnyTypeJsonSchema1 { + // NotAnyTypeSchema + private static @Nullable AdditionalProperties instance = null; + public static AdditionalProperties getInstance() { + if (instance == null) { + instance = new AdditionalProperties(); + } + return instance; + } + } + + + public static class Cultivar extends StringJsonSchema.StringJsonSchema1 { + private static @Nullable Cultivar instance = null; + public static Cultivar getInstance() { + if (instance == null) { + instance = new Cultivar(); + } + return instance; + } + } + + + public static class Mealy extends BooleanJsonSchema.BooleanJsonSchema1 { + private static @Nullable Mealy instance = null; + public static Mealy getInstance() { + if (instance == null) { + instance = new Mealy(); + } + return instance; + } + } + + + public static class AppleReqMap extends FrozenMap { + protected AppleReqMap(FrozenMap m) { + super(m); + } + public static final Set requiredKeys = Set.of( + "cultivar" + ); + public static final Set optionalKeys = Set.of( + "mealy" + ); + public static AppleReqMap of(Map arg, SchemaConfiguration configuration) throws ValidationException { + return AppleReq1.getInstance().validate(arg, configuration); + } + + public String cultivar() { + Object value = get("cultivar"); + if (!(value instanceof String)) { + throw new RuntimeException("Invalid value stored for cultivar"); + } + return (String) value; + } + + public boolean mealy() throws UnsetPropertyException { + String key = "mealy"; + throwIfKeyNotPresent(key); + Object value = get(key); + if (!(value instanceof Boolean)) { + throw new RuntimeException("Invalid value stored for mealy"); + } + return (boolean) value; + } + } + + public interface SetterForCultivar { + Map getInstance(); + T getBuilderAfterCultivar(Map instance); + + default T cultivar(String value) { + var instance = getInstance(); + instance.put("cultivar", value); + return getBuilderAfterCultivar(instance); + } + } + + public interface SetterForMealy { + Map getInstance(); + T getBuilderAfterMealy(Map instance); + + default T mealy(boolean value) { + var instance = getInstance(); + instance.put("mealy", value); + return getBuilderAfterMealy(instance); + } + } + + public static class AppleReqMap0Builder implements GenericBuilder>, SetterForMealy { + private final Map instance; + private static final Set knownKeys = Set.of( + "cultivar", + "mealy" + ); + public Set getKnownKeys() { + return knownKeys; + } + public AppleReqMap0Builder(Map instance) { + this.instance = instance; + } + public Map build() { + return instance; + } + public Map getInstance() { + return instance; + } + public AppleReqMap0Builder getBuilderAfterMealy(Map instance) { + return this; + } + } + + public static class AppleReqMapBuilder implements SetterForCultivar { + private final Map instance; + public AppleReqMapBuilder() { + this.instance = new LinkedHashMap<>(); + } + public Map getInstance() { + return instance; + } + public AppleReqMap0Builder getBuilderAfterCultivar(Map instance) { + return new AppleReqMap0Builder(instance); + } + } + + + public sealed interface AppleReq1Boxed permits AppleReq1BoxedMap { + @Nullable Object getData(); + } + + public record AppleReq1BoxedMap(AppleReqMap data) implements AppleReq1Boxed { + @Override + public @Nullable Object getData() { + return data; + } + } + + + public static class AppleReq1 extends JsonSchema implements MapSchemaValidator { + /* + NOTE: This class is auto generated by OpenAPI JSON Schema Generator. + Ref: https://github.com/openapi-json-schema-tools/openapi-json-schema-generator + + Do not edit the class manually. + */ + private static @Nullable AppleReq1 instance = null; + + protected AppleReq1() { + super(new JsonSchemaInfo() + .type(Set.of(Map.class)) + .properties(Map.ofEntries( + new PropertyEntry("cultivar", Cultivar.class), + new PropertyEntry("mealy", Mealy.class) + )) + .required(Set.of( + "cultivar" + )) + .additionalProperties(AdditionalProperties.class) + ); + } + + public static AppleReq1 getInstance() { + if (instance == null) { + instance = new AppleReq1(); + } + return instance; + } + + 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 RuntimeException("Invalid non-string key value"); + } + String propertyName = (String) entryKey; + List propertyPathToItem = new ArrayList<>(pathToItem); + propertyPathToItem.add(propertyName); + Object value = entry.getValue(); + LinkedHashMap, Nothing?> schemas = pathToSchemas.get(propertyPathToItem); + if (schemas == null) { + throw new RuntimeException("Validation 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"); + } + properties.put(propertyName, (Object) propertyInstance); + } + FrozenMap castProperties = new FrozenMap<>(properties); + return new AppleReqMap(castProperties); + } + + 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); + SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().build())); + ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, new PathToSchemasMap(), new LinkedHashSet<>()); + PathToSchemasMap pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet); + return getNewInstance(castArg, validationMetadata.pathToItem(), pathToSchemasMap); + } + + + @Override + public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws 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"); + } + @Override + public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { + if (arg instanceof Map) { + return getNewInstance((Map) arg, pathToItem, pathToSchemas); + } + 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 { + return new AppleReq1BoxedMap(validate(arg, configuration)); + } + @Override + public AppleReq1Boxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { + 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"); + } + } + +} diff --git a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/schemas/ArrayHoldingAnyType.kt b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/schemas/ArrayHoldingAnyType.kt new file mode 100644 index 00000000000..cf3ad57a540 --- /dev/null +++ b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/schemas/ArrayHoldingAnyType.kt @@ -0,0 +1,201 @@ +package org.openapijsonschematools.client.components.schemas; +import java.util.ArrayList; +import java.util.HashSet; +import java.util.LinkedHashMap; +import java.util.LinkedHashSet; +import java.util.List; +import java.util.Map; +import java.util.Objects; +import java.util.Set; +import org.checkerframework.checker.nullness.qual.Nullable; +import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags; +import org.openapijsonschematools.client.configurations.SchemaConfiguration; +import org.openapijsonschematools.client.exceptions.ValidationException; +import org.openapijsonschematools.client.schemas.AnyTypeJsonSchema; +import org.openapijsonschematools.client.schemas.validation.FrozenList; +import org.openapijsonschematools.client.schemas.validation.JsonSchema; +import org.openapijsonschematools.client.schemas.validation.JsonSchemaInfo; +import org.openapijsonschematools.client.schemas.validation.ListSchemaValidator; +import org.openapijsonschematools.client.schemas.validation.PathToSchemasMap; +import org.openapijsonschematools.client.schemas.validation.ValidationMetadata; + +public class ArrayHoldingAnyType { + // nest classes so all schemas and input/output classes can be public + + + public static class Items extends AnyTypeJsonSchema.AnyTypeJsonSchema1 { + private static @Nullable Items instance = null; + public static Items getInstance() { + if (instance == null) { + instance = new Items(); + } + return instance; + } + } + + + 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 { + return ArrayHoldingAnyType1.getInstance().validate(arg, configuration); + } + } + + public static class ArrayHoldingAnyTypeListBuilder { + // class to build List<@Nullable Object> + private final List<@Nullable Object> list; + + public ArrayHoldingAnyTypeListBuilder() { + list = new ArrayList<>(); + } + + public ArrayHoldingAnyTypeListBuilder(List<@Nullable Object> list) { + this.list = list; + } + + public ArrayHoldingAnyTypeListBuilder add(Nothing? item) { + list.add(null); + return this; + } + + public ArrayHoldingAnyTypeListBuilder add(boolean item) { + list.add(item); + return this; + } + + public ArrayHoldingAnyTypeListBuilder add(String item) { + list.add(item); + return this; + } + + public ArrayHoldingAnyTypeListBuilder add(int item) { + list.add(item); + return this; + } + + public ArrayHoldingAnyTypeListBuilder add(float item) { + list.add(item); + return this; + } + + public ArrayHoldingAnyTypeListBuilder add(long item) { + list.add(item); + return this; + } + + public ArrayHoldingAnyTypeListBuilder add(double item) { + list.add(item); + return this; + } + + public ArrayHoldingAnyTypeListBuilder add(List item) { + list.add(item); + return this; + } + + public ArrayHoldingAnyTypeListBuilder add(Map item) { + list.add(item); + return this; + } + + public List<@Nullable Object> build() { + return list; + } + } + + + public sealed interface ArrayHoldingAnyType1Boxed permits ArrayHoldingAnyType1BoxedList { + @Nullable Object getData(); + } + + public record ArrayHoldingAnyType1BoxedList(ArrayHoldingAnyTypeList data) implements ArrayHoldingAnyType1Boxed { + @Override + public @Nullable Object getData() { + return data; + } + } + + + + public static class ArrayHoldingAnyType1 extends JsonSchema implements ListSchemaValidator { + /* + NOTE: This class is auto generated by OpenAPI JSON Schema Generator. + Ref: https://github.com/openapi-json-schema-tools/openapi-json-schema-generator + + Do not edit the class manually. + */ + private static @Nullable ArrayHoldingAnyType1 instance = null; + + protected ArrayHoldingAnyType1() { + super(new JsonSchemaInfo() + .type(Set.of(List.class)) + .items(Items.class) + ); + } + + public static ArrayHoldingAnyType1 getInstance() { + if (instance == null) { + instance = new ArrayHoldingAnyType1(); + } + return instance; + } + + @Override + public ArrayHoldingAnyTypeList getNewInstance(List arg, List pathToItem, PathToSchemasMap pathToSchemas) { + List<@Nullable Object> items = new ArrayList<>(); + int i = 0; + for (Object item: arg) { + List itemPathToItem = new ArrayList<>(pathToItem); + itemPathToItem.add(i); + LinkedHashMap, Nothing?> schemas = pathToSchemas.get(itemPathToItem); + if (schemas == null) { + throw new RuntimeException("Validation result is invalid, schemas must exist for a pathToItem"); + } + JsonSchema itemSchema = schemas.entrySet().iterator().next().getKey(); + @Nullable Object itemInstance = itemSchema.getNewInstance(item, itemPathToItem, pathToSchemas); + items.add(itemInstance); + i += 1; + } + FrozenList<@Nullable Object> newInstanceItems = new FrozenList<>(items); + return new ArrayHoldingAnyTypeList(newInstanceItems); + } + + 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); + SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().build())); + ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, new PathToSchemasMap(), new LinkedHashSet<>()); + PathToSchemasMap pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet); + return getNewInstance(castArg, validationMetadata.pathToItem(), pathToSchemasMap); + } + + @Override + public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws 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"); + } + @Override + public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { + 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"); + } + @Override + 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 { + 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"); + } + } +} diff --git a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/schemas/ArrayOfArrayOfNumberOnly.kt b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/schemas/ArrayOfArrayOfNumberOnly.kt new file mode 100644 index 00000000000..b389fcf7d61 --- /dev/null +++ b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/schemas/ArrayOfArrayOfNumberOnly.kt @@ -0,0 +1,467 @@ +package org.openapijsonschematools.client.components.schemas; +import java.util.ArrayList; +import java.util.HashSet; +import java.util.LinkedHashMap; +import java.util.LinkedHashSet; +import java.util.List; +import java.util.Map; +import java.util.Objects; +import java.util.Set; +import org.checkerframework.checker.nullness.qual.Nullable; +import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags; +import org.openapijsonschematools.client.configurations.SchemaConfiguration; +import org.openapijsonschematools.client.exceptions.InvalidAdditionalPropertyException; +import org.openapijsonschematools.client.exceptions.UnsetPropertyException; +import org.openapijsonschematools.client.exceptions.ValidationException; +import org.openapijsonschematools.client.schemas.GenericBuilder; +import org.openapijsonschematools.client.schemas.NumberJsonSchema; +import org.openapijsonschematools.client.schemas.UnsetAddPropsSetter; +import org.openapijsonschematools.client.schemas.validation.FrozenList; +import org.openapijsonschematools.client.schemas.validation.FrozenMap; +import org.openapijsonschematools.client.schemas.validation.JsonSchema; +import org.openapijsonschematools.client.schemas.validation.JsonSchemaInfo; +import org.openapijsonschematools.client.schemas.validation.ListSchemaValidator; +import org.openapijsonschematools.client.schemas.validation.MapSchemaValidator; +import org.openapijsonschematools.client.schemas.validation.PathToSchemasMap; +import org.openapijsonschematools.client.schemas.validation.PropertyEntry; +import org.openapijsonschematools.client.schemas.validation.ValidationMetadata; + +public class ArrayOfArrayOfNumberOnly { + // nest classes so all schemas and input/output classes can be public + + + public static class Items1 extends NumberJsonSchema.NumberJsonSchema1 { + private static @Nullable Items1 instance = null; + public static Items1 getInstance() { + if (instance == null) { + instance = new Items1(); + } + return instance; + } + } + + + public static class ItemsList extends FrozenList { + protected ItemsList(FrozenList m) { + super(m); + } + public static ItemsList of(List arg, SchemaConfiguration configuration) throws ValidationException { + return Items.getInstance().validate(arg, configuration); + } + } + + public static class ItemsListBuilder { + // class to build List + private final List list; + + public ItemsListBuilder() { + list = new ArrayList<>(); + } + + public ItemsListBuilder(List list) { + this.list = list; + } + + public ItemsListBuilder add(int item) { + list.add(item); + return this; + } + + public ItemsListBuilder add(float item) { + list.add(item); + return this; + } + + public ItemsListBuilder add(long item) { + list.add(item); + return this; + } + + public ItemsListBuilder add(double item) { + list.add(item); + return this; + } + + public List build() { + return list; + } + } + + + public sealed interface ItemsBoxed permits ItemsBoxedList { + @Nullable Object getData(); + } + + public record ItemsBoxedList(ItemsList data) implements ItemsBoxed { + @Override + public @Nullable Object getData() { + return data; + } + } + + + + public static class Items extends JsonSchema implements ListSchemaValidator { + private static @Nullable Items instance = null; + + protected Items() { + super(new JsonSchemaInfo() + .type(Set.of(List.class)) + .items(Items1.class) + ); + } + + public static Items getInstance() { + if (instance == null) { + instance = new Items(); + } + return instance; + } + + @Override + public ItemsList getNewInstance(List arg, List pathToItem, PathToSchemasMap pathToSchemas) { + List items = new ArrayList<>(); + int i = 0; + for (Object item: arg) { + List itemPathToItem = new ArrayList<>(pathToItem); + itemPathToItem.add(i); + LinkedHashMap, Nothing?> schemas = pathToSchemas.get(itemPathToItem); + if (schemas == null) { + throw new RuntimeException("Validation 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"); + } + items.add((Number) itemInstance); + i += 1; + } + FrozenList newInstanceItems = new FrozenList<>(items); + return new ItemsList(newInstanceItems); + } + + 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); + SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().build())); + ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, new PathToSchemasMap(), new LinkedHashSet<>()); + PathToSchemasMap pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet); + return getNewInstance(castArg, validationMetadata.pathToItem(), pathToSchemasMap); + } + + @Override + public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws 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"); + } + @Override + public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { + 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"); + } + @Override + 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 { + 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"); + } + } + + public static class ArrayArrayNumberList extends FrozenList { + protected ArrayArrayNumberList(FrozenList m) { + super(m); + } + public static ArrayArrayNumberList of(List> arg, SchemaConfiguration configuration) throws ValidationException { + return ArrayArrayNumber.getInstance().validate(arg, configuration); + } + } + + public static class ArrayArrayNumberListBuilder { + // class to build List> + private final List> list; + + public ArrayArrayNumberListBuilder() { + list = new ArrayList<>(); + } + + public ArrayArrayNumberListBuilder(List> list) { + this.list = list; + } + + public ArrayArrayNumberListBuilder add(List item) { + list.add(item); + return this; + } + + public List> build() { + return list; + } + } + + + public sealed interface ArrayArrayNumberBoxed permits ArrayArrayNumberBoxedList { + @Nullable Object getData(); + } + + public record ArrayArrayNumberBoxedList(ArrayArrayNumberList data) implements ArrayArrayNumberBoxed { + @Override + public @Nullable Object getData() { + return data; + } + } + + + + public static class ArrayArrayNumber extends JsonSchema implements ListSchemaValidator { + private static @Nullable ArrayArrayNumber instance = null; + + protected ArrayArrayNumber() { + super(new JsonSchemaInfo() + .type(Set.of(List.class)) + .items(Items.class) + ); + } + + public static ArrayArrayNumber getInstance() { + if (instance == null) { + instance = new ArrayArrayNumber(); + } + return instance; + } + + @Override + public ArrayArrayNumberList getNewInstance(List arg, List pathToItem, PathToSchemasMap pathToSchemas) { + List items = new ArrayList<>(); + int i = 0; + for (Object item: arg) { + List itemPathToItem = new ArrayList<>(pathToItem); + itemPathToItem.add(i); + LinkedHashMap, Nothing?> schemas = pathToSchemas.get(itemPathToItem); + if (schemas == null) { + throw new RuntimeException("Validation 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"); + } + items.add((ItemsList) itemInstance); + i += 1; + } + FrozenList newInstanceItems = new FrozenList<>(items); + return new ArrayArrayNumberList(newInstanceItems); + } + + 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); + SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().build())); + ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, new PathToSchemasMap(), new LinkedHashSet<>()); + PathToSchemasMap pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet); + return getNewInstance(castArg, validationMetadata.pathToItem(), pathToSchemasMap); + } + + @Override + public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws 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"); + } + @Override + public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { + 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"); + } + @Override + 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 { + 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"); + } + } + + public static class ArrayOfArrayOfNumberOnlyMap extends FrozenMap<@Nullable Object> { + protected ArrayOfArrayOfNumberOnlyMap(FrozenMap<@Nullable Object> m) { + super(m); + } + public static final Set requiredKeys = Set.of(); + public static final Set optionalKeys = Set.of( + "ArrayArrayNumber" + ); + public static ArrayOfArrayOfNumberOnlyMap of(Map arg, SchemaConfiguration configuration) throws ValidationException { + return ArrayOfArrayOfNumberOnly1.getInstance().validate(arg, configuration); + } + + public ArrayArrayNumberList ArrayArrayNumber() throws UnsetPropertyException { + String key = "ArrayArrayNumber"; + throwIfKeyNotPresent(key); + @Nullable Object value = get(key); + if (!(value instanceof ArrayArrayNumberList)) { + throw new RuntimeException("Invalid value stored for ArrayArrayNumber"); + } + return (ArrayArrayNumberList) value; + } + + public @Nullable Object getAdditionalProperty(String name) throws UnsetPropertyException, InvalidAdditionalPropertyException { + throwIfKeyKnown(name, requiredKeys, optionalKeys); + throwIfKeyNotPresent(name); + return get(name); + } + } + + public interface SetterForArrayArrayNumber { + Map getInstance(); + T getBuilderAfterArrayArrayNumber(Map instance); + + default T ArrayArrayNumber(List> value) { + var instance = getInstance(); + instance.put("ArrayArrayNumber", value); + return getBuilderAfterArrayArrayNumber(instance); + } + } + + public static class ArrayOfArrayOfNumberOnlyMapBuilder extends UnsetAddPropsSetter implements GenericBuilder>, SetterForArrayArrayNumber { + private final Map instance; + private static final Set knownKeys = Set.of( + "ArrayArrayNumber" + ); + public Set getKnownKeys() { + return knownKeys; + } + public ArrayOfArrayOfNumberOnlyMapBuilder() { + this.instance = new LinkedHashMap<>(); + } + public Map build() { + return instance; + } + public Map getInstance() { + return instance; + } + public ArrayOfArrayOfNumberOnlyMapBuilder getBuilderAfterArrayArrayNumber(Map instance) { + return this; + } + public ArrayOfArrayOfNumberOnlyMapBuilder getBuilderAfterAdditionalProperty(Map instance) { + return this; + } + } + + + public sealed interface ArrayOfArrayOfNumberOnly1Boxed permits ArrayOfArrayOfNumberOnly1BoxedMap { + @Nullable Object getData(); + } + + public record ArrayOfArrayOfNumberOnly1BoxedMap(ArrayOfArrayOfNumberOnlyMap data) implements ArrayOfArrayOfNumberOnly1Boxed { + @Override + public @Nullable Object getData() { + return data; + } + } + + + public static class ArrayOfArrayOfNumberOnly1 extends JsonSchema implements MapSchemaValidator { + /* + NOTE: This class is auto generated by OpenAPI JSON Schema Generator. + Ref: https://github.com/openapi-json-schema-tools/openapi-json-schema-generator + + Do not edit the class manually. + */ + private static @Nullable ArrayOfArrayOfNumberOnly1 instance = null; + + protected ArrayOfArrayOfNumberOnly1() { + super(new JsonSchemaInfo() + .type(Set.of(Map.class)) + .properties(Map.ofEntries( + new PropertyEntry("ArrayArrayNumber", ArrayArrayNumber.class) + )) + ); + } + + public static ArrayOfArrayOfNumberOnly1 getInstance() { + if (instance == null) { + instance = new ArrayOfArrayOfNumberOnly1(); + } + return instance; + } + + 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 RuntimeException("Invalid non-string key value"); + } + String propertyName = (String) entryKey; + List propertyPathToItem = new ArrayList<>(pathToItem); + propertyPathToItem.add(propertyName); + Object value = entry.getValue(); + LinkedHashMap, Nothing?> schemas = pathToSchemas.get(propertyPathToItem); + if (schemas == null) { + throw new RuntimeException("Validation result is invalid, schemas must exist for a pathToItem"); + } + JsonSchema propertySchema = schemas.entrySet().iterator().next().getKey(); + @Nullable Object propertyInstance = propertySchema.getNewInstance(value, propertyPathToItem, pathToSchemas); + properties.put(propertyName, propertyInstance); + } + FrozenMap<@Nullable Object> castProperties = new FrozenMap<>(properties); + return new ArrayOfArrayOfNumberOnlyMap(castProperties); + } + + 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); + SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().build())); + ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, new PathToSchemasMap(), new LinkedHashSet<>()); + PathToSchemasMap pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet); + return getNewInstance(castArg, validationMetadata.pathToItem(), pathToSchemasMap); + } + + + @Override + public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws 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"); + } + @Override + public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { + if (arg instanceof Map) { + return getNewInstance((Map) arg, pathToItem, pathToSchemas); + } + 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 { + return new ArrayOfArrayOfNumberOnly1BoxedMap(validate(arg, configuration)); + } + @Override + public ArrayOfArrayOfNumberOnly1Boxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { + 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"); + } + } + +} diff --git a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/schemas/ArrayOfEnums.kt b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/schemas/ArrayOfEnums.kt new file mode 100644 index 00000000000..7c33b03af15 --- /dev/null +++ b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/schemas/ArrayOfEnums.kt @@ -0,0 +1,166 @@ +package org.openapijsonschematools.client.components.schemas; +import java.util.ArrayList; +import java.util.HashSet; +import java.util.LinkedHashMap; +import java.util.LinkedHashSet; +import java.util.List; +import java.util.Objects; +import java.util.Set; +import org.checkerframework.checker.nullness.qual.Nullable; +import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags; +import org.openapijsonschematools.client.configurations.SchemaConfiguration; +import org.openapijsonschematools.client.exceptions.ValidationException; +import org.openapijsonschematools.client.schemas.validation.FrozenList; +import org.openapijsonschematools.client.schemas.validation.JsonSchema; +import org.openapijsonschematools.client.schemas.validation.JsonSchemaInfo; +import org.openapijsonschematools.client.schemas.validation.ListSchemaValidator; +import org.openapijsonschematools.client.schemas.validation.PathToSchemasMap; +import org.openapijsonschematools.client.schemas.validation.ValidationMetadata; + +public class ArrayOfEnums { + // nest classes so all schemas and input/output classes can be public + + + 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 { + return ArrayOfEnums1.getInstance().validate(arg, configuration); + } + } + + public static class ArrayOfEnumsListBuilder { + // class to build List<@Nullable String> + private final List<@Nullable String> list; + + public ArrayOfEnumsListBuilder() { + list = new ArrayList<>(); + } + + public ArrayOfEnumsListBuilder(List<@Nullable String> list) { + this.list = list; + } + + public ArrayOfEnumsListBuilder add(Nothing? item) { + list.add(null); + return this; + } + + public ArrayOfEnumsListBuilder add(String item) { + list.add(item); + return this; + } + + public ArrayOfEnumsListBuilder add(StringEnum.StringStringEnumEnums item) { + list.add(item.value()); + return this; + } + + public ArrayOfEnumsListBuilder add(StringEnum.NullStringEnumEnums item) { + list.add(null); + return this; + } + + public List<@Nullable String> build() { + return list; + } + } + + + public sealed interface ArrayOfEnums1Boxed permits ArrayOfEnums1BoxedList { + @Nullable Object getData(); + } + + public record ArrayOfEnums1BoxedList(ArrayOfEnumsList data) implements ArrayOfEnums1Boxed { + @Override + public @Nullable Object getData() { + return data; + } + } + + + + public static class ArrayOfEnums1 extends JsonSchema implements ListSchemaValidator { + /* + NOTE: This class is auto generated by OpenAPI JSON Schema Generator. + Ref: https://github.com/openapi-json-schema-tools/openapi-json-schema-generator + + Do not edit the class manually. + */ + private static @Nullable ArrayOfEnums1 instance = null; + + protected ArrayOfEnums1() { + super(new JsonSchemaInfo() + .type(Set.of(List.class)) + .items(StringEnum.StringEnum1.class) + ); + } + + public static ArrayOfEnums1 getInstance() { + if (instance == null) { + instance = new ArrayOfEnums1(); + } + return instance; + } + + @Override + public ArrayOfEnumsList getNewInstance(List arg, List pathToItem, PathToSchemasMap pathToSchemas) { + List<@Nullable String> items = new ArrayList<>(); + int i = 0; + for (Object item: arg) { + List itemPathToItem = new ArrayList<>(pathToItem); + itemPathToItem.add(i); + LinkedHashMap, Nothing?> schemas = pathToSchemas.get(itemPathToItem); + if (schemas == null) { + throw new RuntimeException("Validation 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"); + } + items.add((@Nullable String) itemInstance); + i += 1; + } + FrozenList<@Nullable String> newInstanceItems = new FrozenList<>(items); + return new ArrayOfEnumsList(newInstanceItems); + } + + 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); + SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().build())); + ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, new PathToSchemasMap(), new LinkedHashSet<>()); + PathToSchemasMap pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet); + return getNewInstance(castArg, validationMetadata.pathToItem(), pathToSchemasMap); + } + + @Override + public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws 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"); + } + @Override + public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { + 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"); + } + @Override + 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 { + 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"); + } + } +} diff --git a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/schemas/ArrayOfNumberOnly.kt b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/schemas/ArrayOfNumberOnly.kt new file mode 100644 index 00000000000..4cbe80c9753 --- /dev/null +++ b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/schemas/ArrayOfNumberOnly.kt @@ -0,0 +1,345 @@ +package org.openapijsonschematools.client.components.schemas; +import java.util.ArrayList; +import java.util.HashSet; +import java.util.LinkedHashMap; +import java.util.LinkedHashSet; +import java.util.List; +import java.util.Map; +import java.util.Objects; +import java.util.Set; +import org.checkerframework.checker.nullness.qual.Nullable; +import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags; +import org.openapijsonschematools.client.configurations.SchemaConfiguration; +import org.openapijsonschematools.client.exceptions.InvalidAdditionalPropertyException; +import org.openapijsonschematools.client.exceptions.UnsetPropertyException; +import org.openapijsonschematools.client.exceptions.ValidationException; +import org.openapijsonschematools.client.schemas.GenericBuilder; +import org.openapijsonschematools.client.schemas.NumberJsonSchema; +import org.openapijsonschematools.client.schemas.UnsetAddPropsSetter; +import org.openapijsonschematools.client.schemas.validation.FrozenList; +import org.openapijsonschematools.client.schemas.validation.FrozenMap; +import org.openapijsonschematools.client.schemas.validation.JsonSchema; +import org.openapijsonschematools.client.schemas.validation.JsonSchemaInfo; +import org.openapijsonschematools.client.schemas.validation.ListSchemaValidator; +import org.openapijsonschematools.client.schemas.validation.MapSchemaValidator; +import org.openapijsonschematools.client.schemas.validation.PathToSchemasMap; +import org.openapijsonschematools.client.schemas.validation.PropertyEntry; +import org.openapijsonschematools.client.schemas.validation.ValidationMetadata; + +public class ArrayOfNumberOnly { + // nest classes so all schemas and input/output classes can be public + + + public static class Items extends NumberJsonSchema.NumberJsonSchema1 { + private static @Nullable Items instance = null; + public static Items getInstance() { + if (instance == null) { + instance = new Items(); + } + return instance; + } + } + + + public static class ArrayNumberList extends FrozenList { + protected ArrayNumberList(FrozenList m) { + super(m); + } + public static ArrayNumberList of(List arg, SchemaConfiguration configuration) throws ValidationException { + return ArrayNumber.getInstance().validate(arg, configuration); + } + } + + public static class ArrayNumberListBuilder { + // class to build List + private final List list; + + public ArrayNumberListBuilder() { + list = new ArrayList<>(); + } + + public ArrayNumberListBuilder(List list) { + this.list = list; + } + + public ArrayNumberListBuilder add(int item) { + list.add(item); + return this; + } + + public ArrayNumberListBuilder add(float item) { + list.add(item); + return this; + } + + public ArrayNumberListBuilder add(long item) { + list.add(item); + return this; + } + + public ArrayNumberListBuilder add(double item) { + list.add(item); + return this; + } + + public List build() { + return list; + } + } + + + public sealed interface ArrayNumberBoxed permits ArrayNumberBoxedList { + @Nullable Object getData(); + } + + public record ArrayNumberBoxedList(ArrayNumberList data) implements ArrayNumberBoxed { + @Override + public @Nullable Object getData() { + return data; + } + } + + + + public static class ArrayNumber extends JsonSchema implements ListSchemaValidator { + private static @Nullable ArrayNumber instance = null; + + protected ArrayNumber() { + super(new JsonSchemaInfo() + .type(Set.of(List.class)) + .items(Items.class) + ); + } + + public static ArrayNumber getInstance() { + if (instance == null) { + instance = new ArrayNumber(); + } + return instance; + } + + @Override + public ArrayNumberList getNewInstance(List arg, List pathToItem, PathToSchemasMap pathToSchemas) { + List items = new ArrayList<>(); + int i = 0; + for (Object item: arg) { + List itemPathToItem = new ArrayList<>(pathToItem); + itemPathToItem.add(i); + LinkedHashMap, Nothing?> schemas = pathToSchemas.get(itemPathToItem); + if (schemas == null) { + throw new RuntimeException("Validation 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"); + } + items.add((Number) itemInstance); + i += 1; + } + FrozenList newInstanceItems = new FrozenList<>(items); + return new ArrayNumberList(newInstanceItems); + } + + 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); + SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().build())); + ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, new PathToSchemasMap(), new LinkedHashSet<>()); + PathToSchemasMap pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet); + return getNewInstance(castArg, validationMetadata.pathToItem(), pathToSchemasMap); + } + + @Override + public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws 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"); + } + @Override + public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { + 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"); + } + @Override + 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 { + 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"); + } + } + + public static class ArrayOfNumberOnlyMap extends FrozenMap<@Nullable Object> { + protected ArrayOfNumberOnlyMap(FrozenMap<@Nullable Object> m) { + super(m); + } + public static final Set requiredKeys = Set.of(); + public static final Set optionalKeys = Set.of( + "ArrayNumber" + ); + public static ArrayOfNumberOnlyMap of(Map arg, SchemaConfiguration configuration) throws ValidationException { + return ArrayOfNumberOnly1.getInstance().validate(arg, configuration); + } + + public ArrayNumberList ArrayNumber() throws UnsetPropertyException { + String key = "ArrayNumber"; + throwIfKeyNotPresent(key); + @Nullable Object value = get(key); + if (!(value instanceof ArrayNumberList)) { + throw new RuntimeException("Invalid value stored for ArrayNumber"); + } + return (ArrayNumberList) value; + } + + public @Nullable Object getAdditionalProperty(String name) throws UnsetPropertyException, InvalidAdditionalPropertyException { + throwIfKeyKnown(name, requiredKeys, optionalKeys); + throwIfKeyNotPresent(name); + return get(name); + } + } + + public interface SetterForArrayNumber { + Map getInstance(); + T getBuilderAfterArrayNumber(Map instance); + + default T ArrayNumber(List value) { + var instance = getInstance(); + instance.put("ArrayNumber", value); + return getBuilderAfterArrayNumber(instance); + } + } + + public static class ArrayOfNumberOnlyMapBuilder extends UnsetAddPropsSetter implements GenericBuilder>, SetterForArrayNumber { + private final Map instance; + private static final Set knownKeys = Set.of( + "ArrayNumber" + ); + public Set getKnownKeys() { + return knownKeys; + } + public ArrayOfNumberOnlyMapBuilder() { + this.instance = new LinkedHashMap<>(); + } + public Map build() { + return instance; + } + public Map getInstance() { + return instance; + } + public ArrayOfNumberOnlyMapBuilder getBuilderAfterArrayNumber(Map instance) { + return this; + } + public ArrayOfNumberOnlyMapBuilder getBuilderAfterAdditionalProperty(Map instance) { + return this; + } + } + + + public sealed interface ArrayOfNumberOnly1Boxed permits ArrayOfNumberOnly1BoxedMap { + @Nullable Object getData(); + } + + public record ArrayOfNumberOnly1BoxedMap(ArrayOfNumberOnlyMap data) implements ArrayOfNumberOnly1Boxed { + @Override + public @Nullable Object getData() { + return data; + } + } + + + public static class ArrayOfNumberOnly1 extends JsonSchema implements MapSchemaValidator { + /* + NOTE: This class is auto generated by OpenAPI JSON Schema Generator. + Ref: https://github.com/openapi-json-schema-tools/openapi-json-schema-generator + + Do not edit the class manually. + */ + private static @Nullable ArrayOfNumberOnly1 instance = null; + + protected ArrayOfNumberOnly1() { + super(new JsonSchemaInfo() + .type(Set.of(Map.class)) + .properties(Map.ofEntries( + new PropertyEntry("ArrayNumber", ArrayNumber.class) + )) + ); + } + + public static ArrayOfNumberOnly1 getInstance() { + if (instance == null) { + instance = new ArrayOfNumberOnly1(); + } + return instance; + } + + 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 RuntimeException("Invalid non-string key value"); + } + String propertyName = (String) entryKey; + List propertyPathToItem = new ArrayList<>(pathToItem); + propertyPathToItem.add(propertyName); + Object value = entry.getValue(); + LinkedHashMap, Nothing?> schemas = pathToSchemas.get(propertyPathToItem); + if (schemas == null) { + throw new RuntimeException("Validation result is invalid, schemas must exist for a pathToItem"); + } + JsonSchema propertySchema = schemas.entrySet().iterator().next().getKey(); + @Nullable Object propertyInstance = propertySchema.getNewInstance(value, propertyPathToItem, pathToSchemas); + properties.put(propertyName, propertyInstance); + } + FrozenMap<@Nullable Object> castProperties = new FrozenMap<>(properties); + return new ArrayOfNumberOnlyMap(castProperties); + } + + 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); + SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().build())); + ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, new PathToSchemasMap(), new LinkedHashSet<>()); + PathToSchemasMap pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet); + return getNewInstance(castArg, validationMetadata.pathToItem(), pathToSchemasMap); + } + + + @Override + public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws 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"); + } + @Override + public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { + if (arg instanceof Map) { + return getNewInstance((Map) arg, pathToItem, pathToSchemas); + } + 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 { + return new ArrayOfNumberOnly1BoxedMap(validate(arg, configuration)); + } + @Override + public ArrayOfNumberOnly1Boxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { + 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"); + } + } + +} diff --git a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/schemas/ArrayTest.kt b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/schemas/ArrayTest.kt new file mode 100644 index 00000000000..65aad8374af --- /dev/null +++ b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/schemas/ArrayTest.kt @@ -0,0 +1,899 @@ +package org.openapijsonschematools.client.components.schemas; +import java.util.ArrayList; +import java.util.HashSet; +import java.util.LinkedHashMap; +import java.util.LinkedHashSet; +import java.util.List; +import java.util.Map; +import java.util.Objects; +import java.util.Set; +import org.checkerframework.checker.nullness.qual.Nullable; +import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags; +import org.openapijsonschematools.client.configurations.SchemaConfiguration; +import org.openapijsonschematools.client.exceptions.InvalidAdditionalPropertyException; +import org.openapijsonschematools.client.exceptions.UnsetPropertyException; +import org.openapijsonschematools.client.exceptions.ValidationException; +import org.openapijsonschematools.client.schemas.GenericBuilder; +import org.openapijsonschematools.client.schemas.Int64JsonSchema; +import org.openapijsonschematools.client.schemas.StringJsonSchema; +import org.openapijsonschematools.client.schemas.UnsetAddPropsSetter; +import org.openapijsonschematools.client.schemas.validation.FrozenList; +import org.openapijsonschematools.client.schemas.validation.FrozenMap; +import org.openapijsonschematools.client.schemas.validation.JsonSchema; +import org.openapijsonschematools.client.schemas.validation.JsonSchemaInfo; +import org.openapijsonschematools.client.schemas.validation.ListSchemaValidator; +import org.openapijsonschematools.client.schemas.validation.MapSchemaValidator; +import org.openapijsonschematools.client.schemas.validation.PathToSchemasMap; +import org.openapijsonschematools.client.schemas.validation.PropertyEntry; +import org.openapijsonschematools.client.schemas.validation.ValidationMetadata; + +public class ArrayTest { + // nest classes so all schemas and input/output classes can be public + + + public static class Items extends StringJsonSchema.StringJsonSchema1 { + private static @Nullable Items instance = null; + public static Items getInstance() { + if (instance == null) { + instance = new Items(); + } + return instance; + } + } + + + public static class ArrayOfStringList extends FrozenList { + protected ArrayOfStringList(FrozenList m) { + super(m); + } + public static ArrayOfStringList of(List arg, SchemaConfiguration configuration) throws ValidationException { + return ArrayOfString.getInstance().validate(arg, configuration); + } + } + + public static class ArrayOfStringListBuilder { + // class to build List + private final List list; + + public ArrayOfStringListBuilder() { + list = new ArrayList<>(); + } + + public ArrayOfStringListBuilder(List list) { + this.list = list; + } + + public ArrayOfStringListBuilder add(String item) { + list.add(item); + return this; + } + + public List build() { + return list; + } + } + + + public sealed interface ArrayOfStringBoxed permits ArrayOfStringBoxedList { + @Nullable Object getData(); + } + + public record ArrayOfStringBoxedList(ArrayOfStringList data) implements ArrayOfStringBoxed { + @Override + public @Nullable Object getData() { + return data; + } + } + + + + public static class ArrayOfString extends JsonSchema implements ListSchemaValidator { + private static @Nullable ArrayOfString instance = null; + + protected ArrayOfString() { + super(new JsonSchemaInfo() + .type(Set.of(List.class)) + .items(Items.class) + ); + } + + public static ArrayOfString getInstance() { + if (instance == null) { + instance = new ArrayOfString(); + } + return instance; + } + + @Override + public ArrayOfStringList getNewInstance(List arg, List pathToItem, PathToSchemasMap pathToSchemas) { + List items = new ArrayList<>(); + int i = 0; + for (Object item: arg) { + List itemPathToItem = new ArrayList<>(pathToItem); + itemPathToItem.add(i); + LinkedHashMap, Nothing?> schemas = pathToSchemas.get(itemPathToItem); + if (schemas == null) { + throw new RuntimeException("Validation 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"); + } + items.add((String) itemInstance); + i += 1; + } + FrozenList newInstanceItems = new FrozenList<>(items); + return new ArrayOfStringList(newInstanceItems); + } + + 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); + SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().build())); + ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, new PathToSchemasMap(), new LinkedHashSet<>()); + PathToSchemasMap pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet); + return getNewInstance(castArg, validationMetadata.pathToItem(), pathToSchemasMap); + } + + @Override + public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws 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"); + } + @Override + public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { + 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"); + } + @Override + 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 { + 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"); + } + } + + public static class Items2 extends Int64JsonSchema.Int64JsonSchema1 { + private static @Nullable Items2 instance = null; + public static Items2 getInstance() { + if (instance == null) { + instance = new Items2(); + } + return instance; + } + } + + + public static class ItemsList extends FrozenList { + protected ItemsList(FrozenList m) { + super(m); + } + public static ItemsList of(List arg, SchemaConfiguration configuration) throws ValidationException { + return Items1.getInstance().validate(arg, configuration); + } + } + + public static class ItemsListBuilder { + // class to build List + private final List list; + + public ItemsListBuilder() { + list = new ArrayList<>(); + } + + public ItemsListBuilder(List list) { + this.list = list; + } + + public ItemsListBuilder add(int item) { + list.add(item); + return this; + } + + public ItemsListBuilder add(float item) { + list.add(item); + return this; + } + + public ItemsListBuilder add(long item) { + list.add(item); + return this; + } + + public ItemsListBuilder add(double item) { + list.add(item); + return this; + } + + public List build() { + return list; + } + } + + + public sealed interface Items1Boxed permits Items1BoxedList { + @Nullable Object getData(); + } + + public record Items1BoxedList(ItemsList data) implements Items1Boxed { + @Override + public @Nullable Object getData() { + return data; + } + } + + + + public static class Items1 extends JsonSchema implements ListSchemaValidator { + private static @Nullable Items1 instance = null; + + protected Items1() { + super(new JsonSchemaInfo() + .type(Set.of(List.class)) + .items(Items2.class) + ); + } + + public static Items1 getInstance() { + if (instance == null) { + instance = new Items1(); + } + return instance; + } + + @Override + public ItemsList getNewInstance(List arg, List pathToItem, PathToSchemasMap pathToSchemas) { + List items = new ArrayList<>(); + int i = 0; + for (Object item: arg) { + List itemPathToItem = new ArrayList<>(pathToItem); + itemPathToItem.add(i); + LinkedHashMap, Nothing?> schemas = pathToSchemas.get(itemPathToItem); + if (schemas == null) { + throw new RuntimeException("Validation 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"); + } + items.add((Number) itemInstance); + i += 1; + } + FrozenList newInstanceItems = new FrozenList<>(items); + return new ItemsList(newInstanceItems); + } + + 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); + SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().build())); + ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, new PathToSchemasMap(), new LinkedHashSet<>()); + PathToSchemasMap pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet); + return getNewInstance(castArg, validationMetadata.pathToItem(), pathToSchemasMap); + } + + @Override + public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws 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"); + } + @Override + public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { + 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"); + } + @Override + 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 { + 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"); + } + } + + public static class ArrayArrayOfIntegerList extends FrozenList { + protected ArrayArrayOfIntegerList(FrozenList m) { + super(m); + } + public static ArrayArrayOfIntegerList of(List> arg, SchemaConfiguration configuration) throws ValidationException { + return ArrayArrayOfInteger.getInstance().validate(arg, configuration); + } + } + + public static class ArrayArrayOfIntegerListBuilder { + // class to build List> + private final List> list; + + public ArrayArrayOfIntegerListBuilder() { + list = new ArrayList<>(); + } + + public ArrayArrayOfIntegerListBuilder(List> list) { + this.list = list; + } + + public ArrayArrayOfIntegerListBuilder add(List item) { + list.add(item); + return this; + } + + public List> build() { + return list; + } + } + + + public sealed interface ArrayArrayOfIntegerBoxed permits ArrayArrayOfIntegerBoxedList { + @Nullable Object getData(); + } + + public record ArrayArrayOfIntegerBoxedList(ArrayArrayOfIntegerList data) implements ArrayArrayOfIntegerBoxed { + @Override + public @Nullable Object getData() { + return data; + } + } + + + + public static class ArrayArrayOfInteger extends JsonSchema implements ListSchemaValidator { + private static @Nullable ArrayArrayOfInteger instance = null; + + protected ArrayArrayOfInteger() { + super(new JsonSchemaInfo() + .type(Set.of(List.class)) + .items(Items1.class) + ); + } + + public static ArrayArrayOfInteger getInstance() { + if (instance == null) { + instance = new ArrayArrayOfInteger(); + } + return instance; + } + + @Override + public ArrayArrayOfIntegerList getNewInstance(List arg, List pathToItem, PathToSchemasMap pathToSchemas) { + List items = new ArrayList<>(); + int i = 0; + for (Object item: arg) { + List itemPathToItem = new ArrayList<>(pathToItem); + itemPathToItem.add(i); + LinkedHashMap, Nothing?> schemas = pathToSchemas.get(itemPathToItem); + if (schemas == null) { + throw new RuntimeException("Validation 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"); + } + items.add((ItemsList) itemInstance); + i += 1; + } + FrozenList newInstanceItems = new FrozenList<>(items); + return new ArrayArrayOfIntegerList(newInstanceItems); + } + + 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); + SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().build())); + ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, new PathToSchemasMap(), new LinkedHashSet<>()); + PathToSchemasMap pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet); + return getNewInstance(castArg, validationMetadata.pathToItem(), pathToSchemasMap); + } + + @Override + public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws 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"); + } + @Override + public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { + 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"); + } + @Override + 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 { + 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"); + } + } + + public static class ItemsList1 extends FrozenList { + protected ItemsList1(FrozenList m) { + super(m); + } + public static ItemsList1 of(List> arg, SchemaConfiguration configuration) throws ValidationException { + return Items3.getInstance().validate(arg, configuration); + } + } + + public static class ItemsListBuilder1 { + // class to build List> + private final List> list; + + public ItemsListBuilder1() { + list = new ArrayList<>(); + } + + public ItemsListBuilder1(List> list) { + this.list = list; + } + + public ItemsListBuilder1 add(Map item) { + list.add(item); + return this; + } + + public List> build() { + return list; + } + } + + + public sealed interface Items3Boxed permits Items3BoxedList { + @Nullable Object getData(); + } + + public record Items3BoxedList(ItemsList1 data) implements Items3Boxed { + @Override + public @Nullable Object getData() { + return data; + } + } + + + + public static class Items3 extends JsonSchema implements ListSchemaValidator { + private static @Nullable Items3 instance = null; + + protected Items3() { + super(new JsonSchemaInfo() + .type(Set.of(List.class)) + .items(ReadOnlyFirst.ReadOnlyFirst1.class) + ); + } + + public static Items3 getInstance() { + if (instance == null) { + instance = new Items3(); + } + return instance; + } + + @Override + public ItemsList1 getNewInstance(List arg, List pathToItem, PathToSchemasMap pathToSchemas) { + List items = new ArrayList<>(); + int i = 0; + for (Object item: arg) { + List itemPathToItem = new ArrayList<>(pathToItem); + itemPathToItem.add(i); + LinkedHashMap, Nothing?> schemas = pathToSchemas.get(itemPathToItem); + if (schemas == null) { + throw new RuntimeException("Validation 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"); + } + items.add((ReadOnlyFirst.ReadOnlyFirstMap) itemInstance); + i += 1; + } + FrozenList newInstanceItems = new FrozenList<>(items); + return new ItemsList1(newInstanceItems); + } + + 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); + SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().build())); + ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, new PathToSchemasMap(), new LinkedHashSet<>()); + PathToSchemasMap pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet); + return getNewInstance(castArg, validationMetadata.pathToItem(), pathToSchemasMap); + } + + @Override + public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws 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"); + } + @Override + public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { + 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"); + } + @Override + 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 { + 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"); + } + } + + public static class ArrayArrayOfModelList extends FrozenList { + protected ArrayArrayOfModelList(FrozenList m) { + super(m); + } + public static ArrayArrayOfModelList of(List>> arg, SchemaConfiguration configuration) throws ValidationException { + return ArrayArrayOfModel.getInstance().validate(arg, configuration); + } + } + + public static class ArrayArrayOfModelListBuilder { + // class to build List>> + private final List>> list; + + public ArrayArrayOfModelListBuilder() { + list = new ArrayList<>(); + } + + public ArrayArrayOfModelListBuilder(List>> list) { + this.list = list; + } + + public ArrayArrayOfModelListBuilder add(List> item) { + list.add(item); + return this; + } + + public List>> build() { + return list; + } + } + + + public sealed interface ArrayArrayOfModelBoxed permits ArrayArrayOfModelBoxedList { + @Nullable Object getData(); + } + + public record ArrayArrayOfModelBoxedList(ArrayArrayOfModelList data) implements ArrayArrayOfModelBoxed { + @Override + public @Nullable Object getData() { + return data; + } + } + + + + public static class ArrayArrayOfModel extends JsonSchema implements ListSchemaValidator { + private static @Nullable ArrayArrayOfModel instance = null; + + protected ArrayArrayOfModel() { + super(new JsonSchemaInfo() + .type(Set.of(List.class)) + .items(Items3.class) + ); + } + + public static ArrayArrayOfModel getInstance() { + if (instance == null) { + instance = new ArrayArrayOfModel(); + } + return instance; + } + + @Override + public ArrayArrayOfModelList getNewInstance(List arg, List pathToItem, PathToSchemasMap pathToSchemas) { + List items = new ArrayList<>(); + int i = 0; + for (Object item: arg) { + List itemPathToItem = new ArrayList<>(pathToItem); + itemPathToItem.add(i); + LinkedHashMap, Nothing?> schemas = pathToSchemas.get(itemPathToItem); + if (schemas == null) { + throw new RuntimeException("Validation 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"); + } + items.add((ItemsList1) itemInstance); + i += 1; + } + FrozenList newInstanceItems = new FrozenList<>(items); + return new ArrayArrayOfModelList(newInstanceItems); + } + + 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); + SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().build())); + ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, new PathToSchemasMap(), new LinkedHashSet<>()); + PathToSchemasMap pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet); + return getNewInstance(castArg, validationMetadata.pathToItem(), pathToSchemasMap); + } + + @Override + public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws 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"); + } + @Override + public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { + 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"); + } + @Override + 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 { + 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"); + } + } + + public static class ArrayTestMap extends FrozenMap<@Nullable Object> { + protected ArrayTestMap(FrozenMap<@Nullable Object> m) { + super(m); + } + public static final Set requiredKeys = Set.of(); + public static final Set optionalKeys = Set.of( + "array_of_string", + "array_array_of_integer", + "array_array_of_model" + ); + public static ArrayTestMap of(Map arg, SchemaConfiguration configuration) throws ValidationException { + return ArrayTest1.getInstance().validate(arg, configuration); + } + + public ArrayOfStringList array_of_string() throws UnsetPropertyException { + String key = "array_of_string"; + throwIfKeyNotPresent(key); + @Nullable Object value = get(key); + if (!(value instanceof ArrayOfStringList)) { + throw new RuntimeException("Invalid value stored for array_of_string"); + } + return (ArrayOfStringList) value; + } + + public ArrayArrayOfIntegerList array_array_of_integer() throws UnsetPropertyException { + String key = "array_array_of_integer"; + throwIfKeyNotPresent(key); + @Nullable Object value = get(key); + if (!(value instanceof ArrayArrayOfIntegerList)) { + throw new RuntimeException("Invalid value stored for array_array_of_integer"); + } + return (ArrayArrayOfIntegerList) value; + } + + public ArrayArrayOfModelList array_array_of_model() throws UnsetPropertyException { + String key = "array_array_of_model"; + throwIfKeyNotPresent(key); + @Nullable Object value = get(key); + if (!(value instanceof ArrayArrayOfModelList)) { + throw new RuntimeException("Invalid value stored for array_array_of_model"); + } + return (ArrayArrayOfModelList) value; + } + + public @Nullable Object getAdditionalProperty(String name) throws UnsetPropertyException, InvalidAdditionalPropertyException { + throwIfKeyKnown(name, requiredKeys, optionalKeys); + throwIfKeyNotPresent(name); + return get(name); + } + } + + public interface SetterForArrayOfString { + Map getInstance(); + T getBuilderAfterArrayOfString(Map instance); + + default T array_of_string(List value) { + var instance = getInstance(); + instance.put("array_of_string", value); + return getBuilderAfterArrayOfString(instance); + } + } + + public interface SetterForArrayArrayOfInteger { + Map getInstance(); + T getBuilderAfterArrayArrayOfInteger(Map instance); + + default T array_array_of_integer(List> value) { + var instance = getInstance(); + instance.put("array_array_of_integer", value); + return getBuilderAfterArrayArrayOfInteger(instance); + } + } + + public interface SetterForArrayArrayOfModel { + Map getInstance(); + T getBuilderAfterArrayArrayOfModel(Map instance); + + default T array_array_of_model(List>> value) { + var instance = getInstance(); + instance.put("array_array_of_model", value); + return getBuilderAfterArrayArrayOfModel(instance); + } + } + + public static class ArrayTestMapBuilder extends UnsetAddPropsSetter implements GenericBuilder>, SetterForArrayOfString, SetterForArrayArrayOfInteger, SetterForArrayArrayOfModel { + private final Map instance; + private static final Set knownKeys = Set.of( + "array_of_string", + "array_array_of_integer", + "array_array_of_model" + ); + public Set getKnownKeys() { + return knownKeys; + } + public ArrayTestMapBuilder() { + this.instance = new LinkedHashMap<>(); + } + public Map build() { + return instance; + } + public Map getInstance() { + return instance; + } + public ArrayTestMapBuilder getBuilderAfterArrayOfString(Map instance) { + return this; + } + public ArrayTestMapBuilder getBuilderAfterArrayArrayOfInteger(Map instance) { + return this; + } + public ArrayTestMapBuilder getBuilderAfterArrayArrayOfModel(Map instance) { + return this; + } + public ArrayTestMapBuilder getBuilderAfterAdditionalProperty(Map instance) { + return this; + } + } + + + public sealed interface ArrayTest1Boxed permits ArrayTest1BoxedMap { + @Nullable Object getData(); + } + + public record ArrayTest1BoxedMap(ArrayTestMap data) implements ArrayTest1Boxed { + @Override + public @Nullable Object getData() { + return data; + } + } + + + public static class ArrayTest1 extends JsonSchema implements MapSchemaValidator { + /* + NOTE: This class is auto generated by OpenAPI JSON Schema Generator. + Ref: https://github.com/openapi-json-schema-tools/openapi-json-schema-generator + + Do not edit the class manually. + */ + private static @Nullable ArrayTest1 instance = null; + + protected ArrayTest1() { + super(new JsonSchemaInfo() + .type(Set.of(Map.class)) + .properties(Map.ofEntries( + new PropertyEntry("array_of_string", ArrayOfString.class), + new PropertyEntry("array_array_of_integer", ArrayArrayOfInteger.class), + new PropertyEntry("array_array_of_model", ArrayArrayOfModel.class) + )) + ); + } + + public static ArrayTest1 getInstance() { + if (instance == null) { + instance = new ArrayTest1(); + } + return instance; + } + + 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 RuntimeException("Invalid non-string key value"); + } + String propertyName = (String) entryKey; + List propertyPathToItem = new ArrayList<>(pathToItem); + propertyPathToItem.add(propertyName); + Object value = entry.getValue(); + LinkedHashMap, Nothing?> schemas = pathToSchemas.get(propertyPathToItem); + if (schemas == null) { + throw new RuntimeException("Validation result is invalid, schemas must exist for a pathToItem"); + } + JsonSchema propertySchema = schemas.entrySet().iterator().next().getKey(); + @Nullable Object propertyInstance = propertySchema.getNewInstance(value, propertyPathToItem, pathToSchemas); + properties.put(propertyName, propertyInstance); + } + FrozenMap<@Nullable Object> castProperties = new FrozenMap<>(properties); + return new ArrayTestMap(castProperties); + } + + 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); + SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().build())); + ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, new PathToSchemasMap(), new LinkedHashSet<>()); + PathToSchemasMap pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet); + return getNewInstance(castArg, validationMetadata.pathToItem(), pathToSchemasMap); + } + + + @Override + public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws 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"); + } + @Override + public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { + if (arg instanceof Map) { + return getNewInstance((Map) arg, pathToItem, pathToSchemas); + } + 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 { + return new ArrayTest1BoxedMap(validate(arg, configuration)); + } + @Override + public ArrayTest1Boxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { + 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"); + } + } + +} diff --git a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/schemas/ArrayWithValidationsInItems.kt b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/schemas/ArrayWithValidationsInItems.kt new file mode 100644 index 00000000000..22f3a639470 --- /dev/null +++ b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/schemas/ArrayWithValidationsInItems.kt @@ -0,0 +1,258 @@ +package org.openapijsonschematools.client.components.schemas; +import java.util.ArrayList; +import java.util.HashSet; +import java.util.LinkedHashMap; +import java.util.LinkedHashSet; +import java.util.List; +import java.util.Objects; +import java.util.Set; +import org.checkerframework.checker.nullness.qual.Nullable; +import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags; +import org.openapijsonschematools.client.configurations.SchemaConfiguration; +import org.openapijsonschematools.client.exceptions.ValidationException; +import org.openapijsonschematools.client.schemas.validation.FrozenList; +import org.openapijsonschematools.client.schemas.validation.JsonSchema; +import org.openapijsonschematools.client.schemas.validation.JsonSchemaInfo; +import org.openapijsonschematools.client.schemas.validation.ListSchemaValidator; +import org.openapijsonschematools.client.schemas.validation.NumberSchemaValidator; +import org.openapijsonschematools.client.schemas.validation.PathToSchemasMap; +import org.openapijsonschematools.client.schemas.validation.ValidationMetadata; + +public class ArrayWithValidationsInItems { + // nest classes so all schemas and input/output classes can be public + + + public sealed interface ItemsBoxed permits ItemsBoxedNumber { + @Nullable Object getData(); + } + + public record ItemsBoxedNumber(Number data) implements ItemsBoxed { + @Override + public @Nullable Object getData() { + return data; + } + } + + + + public static class Items extends JsonSchema implements NumberSchemaValidator { + private static @Nullable Items instance = null; + + protected Items() { + super(new JsonSchemaInfo() + .type(Set.of( + Integer.class, + Long.class, + Float.class, + Double.class + )) + .format("int64") + .maximum(7) + ); + } + + public static Items getInstance() { + if (instance == null) { + instance = new Items(); + } + return instance; + } + + @Override + public Number validate(Number arg, SchemaConfiguration configuration) throws ValidationException { + Set> pathSet = new HashSet<>(); + List pathToItem = List.of("args[0"); + Number castArg = castToAllowedTypes(arg, pathToItem, pathSet); + SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().build())); + ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, new PathToSchemasMap(), new LinkedHashSet<>()); + getPathToSchemas(this, castArg, validationMetadata, pathSet); + return castArg; + } + + public int validate(int arg, SchemaConfiguration configuration) throws ValidationException { + return (int) validate((Number) arg, configuration); + } + + public float validate(float arg, SchemaConfiguration configuration) throws ValidationException { + return (float) validate((Number) arg, configuration); + } + + public long validate(long arg, SchemaConfiguration configuration) throws ValidationException { + return (long) validate((Number) arg, configuration); + } + + 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 { + 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"); + } + @Override + public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { + 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"); + } + @Override + 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 { + 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"); + } + } + + public static class ArrayWithValidationsInItemsList extends FrozenList { + protected ArrayWithValidationsInItemsList(FrozenList m) { + super(m); + } + public static ArrayWithValidationsInItemsList of(List arg, SchemaConfiguration configuration) throws ValidationException { + return ArrayWithValidationsInItems1.getInstance().validate(arg, configuration); + } + } + + public static class ArrayWithValidationsInItemsListBuilder { + // class to build List + private final List list; + + public ArrayWithValidationsInItemsListBuilder() { + list = new ArrayList<>(); + } + + public ArrayWithValidationsInItemsListBuilder(List list) { + this.list = list; + } + + public ArrayWithValidationsInItemsListBuilder add(int item) { + list.add(item); + return this; + } + + public ArrayWithValidationsInItemsListBuilder add(float item) { + list.add(item); + return this; + } + + public ArrayWithValidationsInItemsListBuilder add(long item) { + list.add(item); + return this; + } + + public ArrayWithValidationsInItemsListBuilder add(double item) { + list.add(item); + return this; + } + + public List build() { + return list; + } + } + + + public sealed interface ArrayWithValidationsInItems1Boxed permits ArrayWithValidationsInItems1BoxedList { + @Nullable Object getData(); + } + + public record ArrayWithValidationsInItems1BoxedList(ArrayWithValidationsInItemsList data) implements ArrayWithValidationsInItems1Boxed { + @Override + public @Nullable Object getData() { + return data; + } + } + + + + public static class ArrayWithValidationsInItems1 extends JsonSchema implements ListSchemaValidator { + /* + NOTE: This class is auto generated by OpenAPI JSON Schema Generator. + Ref: https://github.com/openapi-json-schema-tools/openapi-json-schema-generator + + Do not edit the class manually. + */ + private static @Nullable ArrayWithValidationsInItems1 instance = null; + + protected ArrayWithValidationsInItems1() { + super(new JsonSchemaInfo() + .type(Set.of(List.class)) + .items(Items.class) + .maxItems(2) + ); + } + + public static ArrayWithValidationsInItems1 getInstance() { + if (instance == null) { + instance = new ArrayWithValidationsInItems1(); + } + return instance; + } + + @Override + public ArrayWithValidationsInItemsList getNewInstance(List arg, List pathToItem, PathToSchemasMap pathToSchemas) { + List items = new ArrayList<>(); + int i = 0; + for (Object item: arg) { + List itemPathToItem = new ArrayList<>(pathToItem); + itemPathToItem.add(i); + LinkedHashMap, Nothing?> schemas = pathToSchemas.get(itemPathToItem); + if (schemas == null) { + throw new RuntimeException("Validation 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"); + } + items.add((Number) itemInstance); + i += 1; + } + FrozenList newInstanceItems = new FrozenList<>(items); + return new ArrayWithValidationsInItemsList(newInstanceItems); + } + + 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); + SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().build())); + ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, new PathToSchemasMap(), new LinkedHashSet<>()); + PathToSchemasMap pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet); + return getNewInstance(castArg, validationMetadata.pathToItem(), pathToSchemasMap); + } + + @Override + public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws 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"); + } + @Override + public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { + 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"); + } + @Override + 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 { + 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"); + } + } +} diff --git a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/schemas/Banana.kt b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/schemas/Banana.kt new file mode 100644 index 00000000000..114af31b2aa --- /dev/null +++ b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/schemas/Banana.kt @@ -0,0 +1,235 @@ +package org.openapijsonschematools.client.components.schemas; +import java.util.ArrayList; +import java.util.HashSet; +import java.util.LinkedHashMap; +import java.util.LinkedHashSet; +import java.util.List; +import java.util.Map; +import java.util.Objects; +import java.util.Set; +import org.checkerframework.checker.nullness.qual.Nullable; +import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags; +import org.openapijsonschematools.client.configurations.SchemaConfiguration; +import org.openapijsonschematools.client.exceptions.InvalidAdditionalPropertyException; +import org.openapijsonschematools.client.exceptions.UnsetPropertyException; +import org.openapijsonschematools.client.exceptions.ValidationException; +import org.openapijsonschematools.client.schemas.GenericBuilder; +import org.openapijsonschematools.client.schemas.NumberJsonSchema; +import org.openapijsonschematools.client.schemas.UnsetAddPropsSetter; +import org.openapijsonschematools.client.schemas.validation.FrozenMap; +import org.openapijsonschematools.client.schemas.validation.JsonSchema; +import org.openapijsonschematools.client.schemas.validation.JsonSchemaInfo; +import org.openapijsonschematools.client.schemas.validation.MapSchemaValidator; +import org.openapijsonschematools.client.schemas.validation.PathToSchemasMap; +import org.openapijsonschematools.client.schemas.validation.PropertyEntry; +import org.openapijsonschematools.client.schemas.validation.ValidationMetadata; + +public class Banana { + // nest classes so all schemas and input/output classes can be public + + + public static class LengthCm extends NumberJsonSchema.NumberJsonSchema1 { + private static @Nullable LengthCm instance = null; + public static LengthCm getInstance() { + if (instance == null) { + instance = new LengthCm(); + } + return instance; + } + } + + + public static class BananaMap extends FrozenMap<@Nullable Object> { + protected BananaMap(FrozenMap<@Nullable Object> m) { + super(m); + } + public static final Set requiredKeys = Set.of( + "lengthCm" + ); + public static final Set optionalKeys = Set.of(); + public static BananaMap of(Map arg, SchemaConfiguration configuration) throws ValidationException { + return Banana1.getInstance().validate(arg, configuration); + } + + public Number lengthCm() { + @Nullable Object value = get("lengthCm"); + if (!(value instanceof Number)) { + throw new RuntimeException("Invalid value stored for lengthCm"); + } + return (Number) value; + } + + public @Nullable Object getAdditionalProperty(String name) throws UnsetPropertyException, InvalidAdditionalPropertyException { + throwIfKeyKnown(name, requiredKeys, optionalKeys); + throwIfKeyNotPresent(name); + return get(name); + } + } + + public interface SetterForLengthCm { + Map getInstance(); + T getBuilderAfterLengthCm(Map instance); + + default T lengthCm(int value) { + var instance = getInstance(); + instance.put("lengthCm", value); + return getBuilderAfterLengthCm(instance); + } + + default T lengthCm(float value) { + var instance = getInstance(); + instance.put("lengthCm", value); + return getBuilderAfterLengthCm(instance); + } + + default T lengthCm(long value) { + var instance = getInstance(); + instance.put("lengthCm", value); + return getBuilderAfterLengthCm(instance); + } + + default T lengthCm(double value) { + var instance = getInstance(); + instance.put("lengthCm", value); + return getBuilderAfterLengthCm(instance); + } + } + + public static class BananaMap0Builder extends UnsetAddPropsSetter implements GenericBuilder> { + private final Map instance; + private static final Set knownKeys = Set.of( + "lengthCm" + ); + public Set getKnownKeys() { + return knownKeys; + } + public BananaMap0Builder(Map instance) { + this.instance = instance; + } + public Map build() { + return instance; + } + public Map getInstance() { + return instance; + } + public BananaMap0Builder getBuilderAfterAdditionalProperty(Map instance) { + return this; + } + } + + public static class BananaMapBuilder implements SetterForLengthCm { + private final Map instance; + public BananaMapBuilder() { + this.instance = new LinkedHashMap<>(); + } + public Map getInstance() { + return instance; + } + public BananaMap0Builder getBuilderAfterLengthCm(Map instance) { + return new BananaMap0Builder(instance); + } + } + + + public sealed interface Banana1Boxed permits Banana1BoxedMap { + @Nullable Object getData(); + } + + public record Banana1BoxedMap(BananaMap data) implements Banana1Boxed { + @Override + public @Nullable Object getData() { + return data; + } + } + + + public static class Banana1 extends JsonSchema implements MapSchemaValidator { + /* + NOTE: This class is auto generated by OpenAPI JSON Schema Generator. + Ref: https://github.com/openapi-json-schema-tools/openapi-json-schema-generator + + Do not edit the class manually. + */ + private static @Nullable Banana1 instance = null; + + protected Banana1() { + super(new JsonSchemaInfo() + .type(Set.of(Map.class)) + .properties(Map.ofEntries( + new PropertyEntry("lengthCm", LengthCm.class) + )) + .required(Set.of( + "lengthCm" + )) + ); + } + + public static Banana1 getInstance() { + if (instance == null) { + instance = new Banana1(); + } + return instance; + } + + 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 RuntimeException("Invalid non-string key value"); + } + String propertyName = (String) entryKey; + List propertyPathToItem = new ArrayList<>(pathToItem); + propertyPathToItem.add(propertyName); + Object value = entry.getValue(); + LinkedHashMap, Nothing?> schemas = pathToSchemas.get(propertyPathToItem); + if (schemas == null) { + throw new RuntimeException("Validation result is invalid, schemas must exist for a pathToItem"); + } + JsonSchema propertySchema = schemas.entrySet().iterator().next().getKey(); + @Nullable Object propertyInstance = propertySchema.getNewInstance(value, propertyPathToItem, pathToSchemas); + properties.put(propertyName, propertyInstance); + } + FrozenMap<@Nullable Object> castProperties = new FrozenMap<>(properties); + return new BananaMap(castProperties); + } + + 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); + SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().build())); + ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, new PathToSchemasMap(), new LinkedHashSet<>()); + PathToSchemasMap pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet); + return getNewInstance(castArg, validationMetadata.pathToItem(), pathToSchemasMap); + } + + + @Override + public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws 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"); + } + @Override + public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { + if (arg instanceof Map) { + return getNewInstance((Map) arg, pathToItem, pathToSchemas); + } + 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 { + return new Banana1BoxedMap(validate(arg, configuration)); + } + @Override + public Banana1Boxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { + 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"); + } + } + +} diff --git a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/schemas/BananaReq.kt b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/schemas/BananaReq.kt new file mode 100644 index 00000000000..a51291305c7 --- /dev/null +++ b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/schemas/BananaReq.kt @@ -0,0 +1,283 @@ +package org.openapijsonschematools.client.components.schemas; +import java.util.ArrayList; +import java.util.HashSet; +import java.util.LinkedHashMap; +import java.util.LinkedHashSet; +import java.util.List; +import java.util.Map; +import java.util.Objects; +import java.util.Set; +import org.checkerframework.checker.nullness.qual.Nullable; +import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags; +import org.openapijsonschematools.client.configurations.SchemaConfiguration; +import org.openapijsonschematools.client.exceptions.UnsetPropertyException; +import org.openapijsonschematools.client.exceptions.ValidationException; +import org.openapijsonschematools.client.schemas.AnyTypeJsonSchema; +import org.openapijsonschematools.client.schemas.BooleanJsonSchema; +import org.openapijsonschematools.client.schemas.GenericBuilder; +import org.openapijsonschematools.client.schemas.NotAnyTypeJsonSchema; +import org.openapijsonschematools.client.schemas.NumberJsonSchema; +import org.openapijsonschematools.client.schemas.validation.FrozenMap; +import org.openapijsonschematools.client.schemas.validation.JsonSchema; +import org.openapijsonschematools.client.schemas.validation.JsonSchemaInfo; +import org.openapijsonschematools.client.schemas.validation.MapSchemaValidator; +import org.openapijsonschematools.client.schemas.validation.MapUtils; +import org.openapijsonschematools.client.schemas.validation.PathToSchemasMap; +import org.openapijsonschematools.client.schemas.validation.PropertyEntry; +import org.openapijsonschematools.client.schemas.validation.ValidationMetadata; + +public class BananaReq { + // nest classes so all schemas and input/output classes can be public + + + public static class AdditionalProperties extends NotAnyTypeJsonSchema.NotAnyTypeJsonSchema1 { + // NotAnyTypeSchema + private static @Nullable AdditionalProperties instance = null; + public static AdditionalProperties getInstance() { + if (instance == null) { + instance = new AdditionalProperties(); + } + return instance; + } + } + + + public static class LengthCm extends NumberJsonSchema.NumberJsonSchema1 { + private static @Nullable LengthCm instance = null; + public static LengthCm getInstance() { + if (instance == null) { + instance = new LengthCm(); + } + return instance; + } + } + + + public static class Sweet extends BooleanJsonSchema.BooleanJsonSchema1 { + private static @Nullable Sweet instance = null; + public static Sweet getInstance() { + if (instance == null) { + instance = new Sweet(); + } + return instance; + } + } + + + public static class BananaReqMap extends FrozenMap { + protected BananaReqMap(FrozenMap m) { + super(m); + } + public static final Set requiredKeys = Set.of( + "lengthCm" + ); + public static final Set optionalKeys = Set.of( + "sweet" + ); + public static BananaReqMap of(Map arg, SchemaConfiguration configuration) throws ValidationException { + return BananaReq1.getInstance().validate(arg, configuration); + } + + public Number lengthCm() { + Object value = get("lengthCm"); + if (!(value instanceof Number)) { + throw new RuntimeException("Invalid value stored for lengthCm"); + } + return (Number) value; + } + + public boolean sweet() throws UnsetPropertyException { + String key = "sweet"; + throwIfKeyNotPresent(key); + Object value = get(key); + if (!(value instanceof Boolean)) { + throw new RuntimeException("Invalid value stored for sweet"); + } + return (boolean) value; + } + } + + public interface SetterForLengthCm { + Map getInstance(); + T getBuilderAfterLengthCm(Map instance); + + default T lengthCm(int value) { + var instance = getInstance(); + instance.put("lengthCm", value); + return getBuilderAfterLengthCm(instance); + } + + default T lengthCm(float value) { + var instance = getInstance(); + instance.put("lengthCm", value); + return getBuilderAfterLengthCm(instance); + } + + default T lengthCm(long value) { + var instance = getInstance(); + instance.put("lengthCm", value); + return getBuilderAfterLengthCm(instance); + } + + default T lengthCm(double value) { + var instance = getInstance(); + instance.put("lengthCm", value); + return getBuilderAfterLengthCm(instance); + } + } + + public interface SetterForSweet { + Map getInstance(); + T getBuilderAfterSweet(Map instance); + + default T sweet(boolean value) { + var instance = getInstance(); + instance.put("sweet", value); + return getBuilderAfterSweet(instance); + } + } + + public static class BananaReqMap0Builder implements GenericBuilder>, SetterForSweet { + private final Map instance; + private static final Set knownKeys = Set.of( + "lengthCm", + "sweet" + ); + public Set getKnownKeys() { + return knownKeys; + } + public BananaReqMap0Builder(Map instance) { + this.instance = instance; + } + public Map build() { + return instance; + } + public Map getInstance() { + return instance; + } + public BananaReqMap0Builder getBuilderAfterSweet(Map instance) { + return this; + } + } + + public static class BananaReqMapBuilder implements SetterForLengthCm { + private final Map instance; + public BananaReqMapBuilder() { + this.instance = new LinkedHashMap<>(); + } + public Map getInstance() { + return instance; + } + public BananaReqMap0Builder getBuilderAfterLengthCm(Map instance) { + return new BananaReqMap0Builder(instance); + } + } + + + public sealed interface BananaReq1Boxed permits BananaReq1BoxedMap { + @Nullable Object getData(); + } + + public record BananaReq1BoxedMap(BananaReqMap data) implements BananaReq1Boxed { + @Override + public @Nullable Object getData() { + return data; + } + } + + + public static class BananaReq1 extends JsonSchema implements MapSchemaValidator { + /* + NOTE: This class is auto generated by OpenAPI JSON Schema Generator. + Ref: https://github.com/openapi-json-schema-tools/openapi-json-schema-generator + + Do not edit the class manually. + */ + private static @Nullable BananaReq1 instance = null; + + protected BananaReq1() { + super(new JsonSchemaInfo() + .type(Set.of(Map.class)) + .properties(Map.ofEntries( + new PropertyEntry("lengthCm", LengthCm.class), + new PropertyEntry("sweet", Sweet.class) + )) + .required(Set.of( + "lengthCm" + )) + .additionalProperties(AdditionalProperties.class) + ); + } + + public static BananaReq1 getInstance() { + if (instance == null) { + instance = new BananaReq1(); + } + return instance; + } + + 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 RuntimeException("Invalid non-string key value"); + } + String propertyName = (String) entryKey; + List propertyPathToItem = new ArrayList<>(pathToItem); + propertyPathToItem.add(propertyName); + Object value = entry.getValue(); + LinkedHashMap, Nothing?> schemas = pathToSchemas.get(propertyPathToItem); + if (schemas == null) { + throw new RuntimeException("Validation 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"); + } + properties.put(propertyName, (Object) propertyInstance); + } + FrozenMap castProperties = new FrozenMap<>(properties); + return new BananaReqMap(castProperties); + } + + 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); + SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().build())); + ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, new PathToSchemasMap(), new LinkedHashSet<>()); + PathToSchemasMap pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet); + return getNewInstance(castArg, validationMetadata.pathToItem(), pathToSchemasMap); + } + + + @Override + public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws 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"); + } + @Override + public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { + if (arg instanceof Map) { + return getNewInstance((Map) arg, pathToItem, pathToSchemas); + } + 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 { + return new BananaReq1BoxedMap(validate(arg, configuration)); + } + @Override + public BananaReq1Boxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { + 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"); + } + } + +} diff --git a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/schemas/Bar.kt b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/schemas/Bar.kt new file mode 100644 index 00000000000..72288a40e46 --- /dev/null +++ b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/schemas/Bar.kt @@ -0,0 +1,103 @@ +package org.openapijsonschematools.client.components.schemas; +import java.util.HashSet; +import java.util.LinkedHashSet; +import java.util.List; +import java.util.Objects; +import java.util.Set; +import org.checkerframework.checker.nullness.qual.Nullable; +import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags; +import org.openapijsonschematools.client.configurations.SchemaConfiguration; +import org.openapijsonschematools.client.exceptions.ValidationException; +import org.openapijsonschematools.client.schemas.validation.DefaultValueMethod; +import org.openapijsonschematools.client.schemas.validation.JsonSchema; +import org.openapijsonschematools.client.schemas.validation.JsonSchemaInfo; +import org.openapijsonschematools.client.schemas.validation.PathToSchemasMap; +import org.openapijsonschematools.client.schemas.validation.StringSchemaValidator; +import org.openapijsonschematools.client.schemas.validation.ValidationMetadata; + +public class Bar { + // nest classes so all schemas and input/output classes can be public + + + public sealed interface Bar1Boxed permits Bar1BoxedString { + @Nullable Object getData(); + } + + public record Bar1BoxedString(String data) implements Bar1Boxed { + @Override + public @Nullable Object getData() { + return data; + } + } + + + + public static class Bar1 extends JsonSchema implements StringSchemaValidator, DefaultValueMethod { + /* + NOTE: This class is auto generated by OpenAPI JSON Schema Generator. + Ref: https://github.com/openapi-json-schema-tools/openapi-json-schema-generator + + Do not edit the class manually. + */ + private static @Nullable Bar1 instance = null; + + protected Bar1() { + super(new JsonSchemaInfo() + .type(Set.of( + String.class + )) + .defaultValue("bar") + ); + } + + public static Bar1 getInstance() { + if (instance == null) { + instance = new Bar1(); + } + return instance; + } + + @Override + public String validate(String arg, SchemaConfiguration configuration) throws ValidationException { + Set> pathSet = new HashSet<>(); + List pathToItem = List.of("args[0"); + String castArg = castToAllowedTypes(arg, pathToItem, pathSet); + SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().build())); + ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, new PathToSchemasMap(), new LinkedHashSet<>()); + getPathToSchemas(this, castArg, validationMetadata, pathSet); + return castArg; + } + + @Override + public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws 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"); + } + @Override + public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { + 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"); + } + public String defaultValue() throws ValidationException { + if (defaultValue instanceof String) { + return (String) defaultValue; + } + throw new ValidationException("Invalid type stored in defaultValue"); + } + @Override + 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 { + 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"); + } + } +} diff --git a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/schemas/BasquePig.kt b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/schemas/BasquePig.kt new file mode 100644 index 00000000000..a3a584e7d3f --- /dev/null +++ b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/schemas/BasquePig.kt @@ -0,0 +1,304 @@ +package org.openapijsonschematools.client.components.schemas; +import java.util.ArrayList; +import java.util.HashSet; +import java.util.LinkedHashMap; +import java.util.LinkedHashSet; +import java.util.List; +import java.util.Map; +import java.util.Objects; +import java.util.Set; +import org.checkerframework.checker.nullness.qual.Nullable; +import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags; +import org.openapijsonschematools.client.configurations.SchemaConfiguration; +import org.openapijsonschematools.client.exceptions.InvalidAdditionalPropertyException; +import org.openapijsonschematools.client.exceptions.UnsetPropertyException; +import org.openapijsonschematools.client.exceptions.ValidationException; +import org.openapijsonschematools.client.schemas.GenericBuilder; +import org.openapijsonschematools.client.schemas.SetMaker; +import org.openapijsonschematools.client.schemas.UnsetAddPropsSetter; +import org.openapijsonschematools.client.schemas.validation.FrozenMap; +import org.openapijsonschematools.client.schemas.validation.JsonSchema; +import org.openapijsonschematools.client.schemas.validation.JsonSchemaInfo; +import org.openapijsonschematools.client.schemas.validation.MapSchemaValidator; +import org.openapijsonschematools.client.schemas.validation.PathToSchemasMap; +import org.openapijsonschematools.client.schemas.validation.PropertyEntry; +import org.openapijsonschematools.client.schemas.validation.StringEnumValidator; +import org.openapijsonschematools.client.schemas.validation.StringSchemaValidator; +import org.openapijsonschematools.client.schemas.validation.StringValueMethod; +import org.openapijsonschematools.client.schemas.validation.ValidationMetadata; + +public class BasquePig { + // nest classes so all schemas and input/output classes can be public + + public enum StringClassNameEnums implements StringValueMethod { + BASQUE_PIG("BasquePig"); + private final String value; + + StringClassNameEnums(String value) { + this.value = value; + } + public String value() { + return this.value; + } + } + + + public sealed interface ClassNameBoxed permits ClassNameBoxedString { + @Nullable Object getData(); + } + + public record ClassNameBoxedString(String data) implements ClassNameBoxed { + @Override + public @Nullable Object getData() { + return data; + } + } + + + + public static class ClassName extends JsonSchema implements StringSchemaValidator, StringEnumValidator { + private static @Nullable ClassName instance = null; + + protected ClassName() { + super(new JsonSchemaInfo() + .type(Set.of( + String.class + )) + .enumValues(SetMaker.makeSet( + "BasquePig" + )) + ); + } + + public static ClassName getInstance() { + if (instance == null) { + instance = new ClassName(); + } + return instance; + } + + @Override + public String validate(String arg, SchemaConfiguration configuration) throws ValidationException { + Set> pathSet = new HashSet<>(); + List pathToItem = List.of("args[0"); + String castArg = castToAllowedTypes(arg, pathToItem, pathSet); + SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().build())); + ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, new PathToSchemasMap(), new LinkedHashSet<>()); + getPathToSchemas(this, castArg, validationMetadata, pathSet); + return castArg; + } + + @Override + 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 { + 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"); + } + @Override + public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { + 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"); + } + @Override + 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 { + 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"); + } + } + + public static class BasquePigMap extends FrozenMap<@Nullable Object> { + protected BasquePigMap(FrozenMap<@Nullable Object> m) { + super(m); + } + public static final Set requiredKeys = Set.of( + "className" + ); + public static final Set optionalKeys = Set.of(); + public static BasquePigMap of(Map arg, SchemaConfiguration configuration) throws ValidationException { + return BasquePig1.getInstance().validate(arg, configuration); + } + + public String className() { + @Nullable Object value = get("className"); + if (!(value instanceof String)) { + throw new RuntimeException("Invalid value stored for className"); + } + return (String) value; + } + + public @Nullable Object getAdditionalProperty(String name) throws UnsetPropertyException, InvalidAdditionalPropertyException { + throwIfKeyKnown(name, requiredKeys, optionalKeys); + throwIfKeyNotPresent(name); + return get(name); + } + } + + public interface SetterForClassName { + Map getInstance(); + T getBuilderAfterClassName(Map instance); + + default T className(String value) { + var instance = getInstance(); + instance.put("className", value); + return getBuilderAfterClassName(instance); + } + + default T className(StringClassNameEnums value) { + var instance = getInstance(); + instance.put("className", value.value()); + return getBuilderAfterClassName(instance); + } + } + + public static class BasquePigMap0Builder extends UnsetAddPropsSetter implements GenericBuilder> { + private final Map instance; + private static final Set knownKeys = Set.of( + "className" + ); + public Set getKnownKeys() { + return knownKeys; + } + public BasquePigMap0Builder(Map instance) { + this.instance = instance; + } + public Map build() { + return instance; + } + public Map getInstance() { + return instance; + } + public BasquePigMap0Builder getBuilderAfterAdditionalProperty(Map instance) { + return this; + } + } + + public static class BasquePigMapBuilder implements SetterForClassName { + private final Map instance; + public BasquePigMapBuilder() { + this.instance = new LinkedHashMap<>(); + } + public Map getInstance() { + return instance; + } + public BasquePigMap0Builder getBuilderAfterClassName(Map instance) { + return new BasquePigMap0Builder(instance); + } + } + + + public sealed interface BasquePig1Boxed permits BasquePig1BoxedMap { + @Nullable Object getData(); + } + + public record BasquePig1BoxedMap(BasquePigMap data) implements BasquePig1Boxed { + @Override + public @Nullable Object getData() { + return data; + } + } + + + public static class BasquePig1 extends JsonSchema implements MapSchemaValidator { + /* + NOTE: This class is auto generated by OpenAPI JSON Schema Generator. + Ref: https://github.com/openapi-json-schema-tools/openapi-json-schema-generator + + Do not edit the class manually. + */ + private static @Nullable BasquePig1 instance = null; + + protected BasquePig1() { + super(new JsonSchemaInfo() + .type(Set.of(Map.class)) + .properties(Map.ofEntries( + new PropertyEntry("className", ClassName.class) + )) + .required(Set.of( + "className" + )) + ); + } + + public static BasquePig1 getInstance() { + if (instance == null) { + instance = new BasquePig1(); + } + return instance; + } + + 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 RuntimeException("Invalid non-string key value"); + } + String propertyName = (String) entryKey; + List propertyPathToItem = new ArrayList<>(pathToItem); + propertyPathToItem.add(propertyName); + Object value = entry.getValue(); + LinkedHashMap, Nothing?> schemas = pathToSchemas.get(propertyPathToItem); + if (schemas == null) { + throw new RuntimeException("Validation result is invalid, schemas must exist for a pathToItem"); + } + JsonSchema propertySchema = schemas.entrySet().iterator().next().getKey(); + @Nullable Object propertyInstance = propertySchema.getNewInstance(value, propertyPathToItem, pathToSchemas); + properties.put(propertyName, propertyInstance); + } + FrozenMap<@Nullable Object> castProperties = new FrozenMap<>(properties); + return new BasquePigMap(castProperties); + } + + 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); + SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().build())); + ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, new PathToSchemasMap(), new LinkedHashSet<>()); + PathToSchemasMap pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet); + return getNewInstance(castArg, validationMetadata.pathToItem(), pathToSchemasMap); + } + + + @Override + public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws 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"); + } + @Override + public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { + if (arg instanceof Map) { + return getNewInstance((Map) arg, pathToItem, pathToSchemas); + } + 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 { + return new BasquePig1BoxedMap(validate(arg, configuration)); + } + @Override + public BasquePig1Boxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { + 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"); + } + } + +} diff --git a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/schemas/BooleanEnum.kt b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/schemas/BooleanEnum.kt new file mode 100644 index 00000000000..02c9acce67a --- /dev/null +++ b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/schemas/BooleanEnum.kt @@ -0,0 +1,119 @@ +package org.openapijsonschematools.client.components.schemas; +import java.util.HashSet; +import java.util.LinkedHashSet; +import java.util.List; +import java.util.Objects; +import java.util.Set; +import org.checkerframework.checker.nullness.qual.Nullable; +import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags; +import org.openapijsonschematools.client.configurations.SchemaConfiguration; +import org.openapijsonschematools.client.exceptions.ValidationException; +import org.openapijsonschematools.client.schemas.SetMaker; +import org.openapijsonschematools.client.schemas.validation.BooleanEnumValidator; +import org.openapijsonschematools.client.schemas.validation.BooleanSchemaValidator; +import org.openapijsonschematools.client.schemas.validation.BooleanValueMethod; +import org.openapijsonschematools.client.schemas.validation.JsonSchema; +import org.openapijsonschematools.client.schemas.validation.JsonSchemaInfo; +import org.openapijsonschematools.client.schemas.validation.PathToSchemasMap; +import org.openapijsonschematools.client.schemas.validation.ValidationMetadata; + +public class BooleanEnum { + // nest classes so all schemas and input/output classes can be public + + public enum BooleanBooleanEnumEnums implements BooleanValueMethod { + TRUE(true); + private final boolean value; + + BooleanBooleanEnumEnums(boolean value) { + this.value = value; + } + public boolean value() { + return this.value; + } + } + + + public sealed interface BooleanEnum1Boxed permits BooleanEnum1BoxedBoolean { + @Nullable Object getData(); + } + + public record BooleanEnum1BoxedBoolean(boolean data) implements BooleanEnum1Boxed { + @Override + public @Nullable Object getData() { + return data; + } + } + + + + public static class BooleanEnum1 extends JsonSchema implements BooleanSchemaValidator, BooleanEnumValidator { + /* + NOTE: This class is auto generated by OpenAPI JSON Schema Generator. + Ref: https://github.com/openapi-json-schema-tools/openapi-json-schema-generator + + Do not edit the class manually. + */ + private static @Nullable BooleanEnum1 instance = null; + + protected BooleanEnum1() { + super(new JsonSchemaInfo() + .type(Set.of(Boolean.class)) + .enumValues(SetMaker.makeSet( + true + )) + ); + } + + public static BooleanEnum1 getInstance() { + if (instance == null) { + instance = new BooleanEnum1(); + } + return instance; + } + + @Override + public boolean validate(boolean arg, SchemaConfiguration configuration) throws ValidationException { + Set> pathSet = new HashSet<>(); + List pathToItem = List.of("args[0"); + boolean castArg = castToAllowedTypes(arg, pathToItem, pathSet); + SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().build())); + ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, new PathToSchemasMap(), new LinkedHashSet<>()); + getPathToSchemas(this, castArg, validationMetadata, pathSet); + return castArg; + } + + @Override + 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 { + 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"); + } + @Override + 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 RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); + } + @Override + 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 { + 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"); + } + } +} diff --git a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/schemas/BooleanSchema.kt b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/schemas/BooleanSchema.kt new file mode 100644 index 00000000000..8253de14589 --- /dev/null +++ b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/schemas/BooleanSchema.kt @@ -0,0 +1,19 @@ +package org.openapijsonschematools.client.components.schemas; +import org.checkerframework.checker.nullness.qual.Nullable; +import org.openapijsonschematools.client.schemas.BooleanJsonSchema; + +public class BooleanSchema extends BooleanJsonSchema { + // nest classes so all schemas and input/output classes can be public + + + public static class BooleanSchema1 extends BooleanJsonSchema.BooleanJsonSchema1 { + private static @Nullable BooleanSchema1 instance = null; + public static BooleanSchema1 getInstance() { + if (instance == null) { + instance = new BooleanSchema1(); + } + return instance; + } + } + +} diff --git a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/schemas/Capitalization.kt b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/schemas/Capitalization.kt new file mode 100644 index 00000000000..d080f6df578 --- /dev/null +++ b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/schemas/Capitalization.kt @@ -0,0 +1,396 @@ +package org.openapijsonschematools.client.components.schemas; +import java.util.ArrayList; +import java.util.HashSet; +import java.util.LinkedHashMap; +import java.util.LinkedHashSet; +import java.util.List; +import java.util.Map; +import java.util.Objects; +import java.util.Set; +import org.checkerframework.checker.nullness.qual.Nullable; +import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags; +import org.openapijsonschematools.client.configurations.SchemaConfiguration; +import org.openapijsonschematools.client.exceptions.InvalidAdditionalPropertyException; +import org.openapijsonschematools.client.exceptions.UnsetPropertyException; +import org.openapijsonschematools.client.exceptions.ValidationException; +import org.openapijsonschematools.client.schemas.GenericBuilder; +import org.openapijsonschematools.client.schemas.StringJsonSchema; +import org.openapijsonschematools.client.schemas.UnsetAddPropsSetter; +import org.openapijsonschematools.client.schemas.validation.FrozenMap; +import org.openapijsonschematools.client.schemas.validation.JsonSchema; +import org.openapijsonschematools.client.schemas.validation.JsonSchemaInfo; +import org.openapijsonschematools.client.schemas.validation.MapSchemaValidator; +import org.openapijsonschematools.client.schemas.validation.PathToSchemasMap; +import org.openapijsonschematools.client.schemas.validation.PropertyEntry; +import org.openapijsonschematools.client.schemas.validation.ValidationMetadata; + +public class Capitalization { + // nest classes so all schemas and input/output classes can be public + + + public static class SmallCamel extends StringJsonSchema.StringJsonSchema1 { + private static @Nullable SmallCamel instance = null; + public static SmallCamel getInstance() { + if (instance == null) { + instance = new SmallCamel(); + } + return instance; + } + } + + + public static class CapitalCamel extends StringJsonSchema.StringJsonSchema1 { + private static @Nullable CapitalCamel instance = null; + public static CapitalCamel getInstance() { + if (instance == null) { + instance = new CapitalCamel(); + } + return instance; + } + } + + + public static class SmallSnake extends StringJsonSchema.StringJsonSchema1 { + private static @Nullable SmallSnake instance = null; + public static SmallSnake getInstance() { + if (instance == null) { + instance = new SmallSnake(); + } + return instance; + } + } + + + public static class CapitalSnake extends StringJsonSchema.StringJsonSchema1 { + private static @Nullable CapitalSnake instance = null; + public static CapitalSnake getInstance() { + if (instance == null) { + instance = new CapitalSnake(); + } + return instance; + } + } + + + public static class SCAETHFlowPoints extends StringJsonSchema.StringJsonSchema1 { + private static @Nullable SCAETHFlowPoints instance = null; + public static SCAETHFlowPoints getInstance() { + if (instance == null) { + instance = new SCAETHFlowPoints(); + } + return instance; + } + } + + + public static class ATTNAME extends StringJsonSchema.StringJsonSchema1 { + private static @Nullable ATTNAME instance = null; + public static ATTNAME getInstance() { + if (instance == null) { + instance = new ATTNAME(); + } + return instance; + } + } + + + public static class CapitalizationMap extends FrozenMap<@Nullable Object> { + protected CapitalizationMap(FrozenMap<@Nullable Object> m) { + super(m); + } + public static final Set requiredKeys = Set.of(); + public static final Set optionalKeys = Set.of( + "smallCamel", + "CapitalCamel", + "small_Snake", + "Capital_Snake", + "SCA_ETH_Flow_Points", + "ATT_NAME" + ); + public static CapitalizationMap of(Map arg, SchemaConfiguration configuration) throws ValidationException { + return Capitalization1.getInstance().validate(arg, configuration); + } + + public String smallCamel() throws UnsetPropertyException { + String key = "smallCamel"; + throwIfKeyNotPresent(key); + @Nullable Object value = get(key); + if (!(value instanceof String)) { + throw new RuntimeException("Invalid value stored for smallCamel"); + } + return (String) value; + } + + public String CapitalCamel() throws UnsetPropertyException { + String key = "CapitalCamel"; + throwIfKeyNotPresent(key); + @Nullable Object value = get(key); + if (!(value instanceof String)) { + throw new RuntimeException("Invalid value stored for CapitalCamel"); + } + return (String) value; + } + + public String small_Snake() throws UnsetPropertyException { + String key = "small_Snake"; + throwIfKeyNotPresent(key); + @Nullable Object value = get(key); + if (!(value instanceof String)) { + throw new RuntimeException("Invalid value stored for small_Snake"); + } + return (String) value; + } + + public String Capital_Snake() throws UnsetPropertyException { + String key = "Capital_Snake"; + throwIfKeyNotPresent(key); + @Nullable Object value = get(key); + if (!(value instanceof String)) { + throw new RuntimeException("Invalid value stored for Capital_Snake"); + } + return (String) value; + } + + public String SCA_ETH_Flow_Points() throws UnsetPropertyException { + String key = "SCA_ETH_Flow_Points"; + throwIfKeyNotPresent(key); + @Nullable Object value = get(key); + if (!(value instanceof String)) { + throw new RuntimeException("Invalid value stored for SCA_ETH_Flow_Points"); + } + return (String) value; + } + + public String ATT_NAME() throws UnsetPropertyException { + String key = "ATT_NAME"; + throwIfKeyNotPresent(key); + @Nullable Object value = get(key); + if (!(value instanceof String)) { + throw new RuntimeException("Invalid value stored for ATT_NAME"); + } + return (String) value; + } + + public @Nullable Object getAdditionalProperty(String name) throws UnsetPropertyException, InvalidAdditionalPropertyException { + throwIfKeyKnown(name, requiredKeys, optionalKeys); + throwIfKeyNotPresent(name); + return get(name); + } + } + + public interface SetterForSmallCamel { + Map getInstance(); + T getBuilderAfterSmallCamel(Map instance); + + default T smallCamel(String value) { + var instance = getInstance(); + instance.put("smallCamel", value); + return getBuilderAfterSmallCamel(instance); + } + } + + public interface SetterForCapitalCamel { + Map getInstance(); + T getBuilderAfterCapitalCamel(Map instance); + + default T CapitalCamel(String value) { + var instance = getInstance(); + instance.put("CapitalCamel", value); + return getBuilderAfterCapitalCamel(instance); + } + } + + public interface SetterForSmallSnake { + Map getInstance(); + T getBuilderAfterSmallSnake(Map instance); + + default T small_Snake(String value) { + var instance = getInstance(); + instance.put("small_Snake", value); + return getBuilderAfterSmallSnake(instance); + } + } + + public interface SetterForCapitalSnake { + Map getInstance(); + T getBuilderAfterCapitalSnake(Map instance); + + default T Capital_Snake(String value) { + var instance = getInstance(); + instance.put("Capital_Snake", value); + return getBuilderAfterCapitalSnake(instance); + } + } + + public interface SetterForSCAETHFlowPoints { + Map getInstance(); + T getBuilderAfterSCAETHFlowPoints(Map instance); + + default T SCA_ETH_Flow_Points(String value) { + var instance = getInstance(); + instance.put("SCA_ETH_Flow_Points", value); + return getBuilderAfterSCAETHFlowPoints(instance); + } + } + + public interface SetterForATTNAME { + Map getInstance(); + T getBuilderAfterATTNAME(Map instance); + + default T ATT_NAME(String value) { + var instance = getInstance(); + instance.put("ATT_NAME", value); + return getBuilderAfterATTNAME(instance); + } + } + + public static class CapitalizationMapBuilder extends UnsetAddPropsSetter implements GenericBuilder>, SetterForSmallCamel, SetterForCapitalCamel, SetterForSmallSnake, SetterForCapitalSnake, SetterForSCAETHFlowPoints, SetterForATTNAME { + private final Map instance; + private static final Set knownKeys = Set.of( + "smallCamel", + "CapitalCamel", + "small_Snake", + "Capital_Snake", + "SCA_ETH_Flow_Points", + "ATT_NAME" + ); + public Set getKnownKeys() { + return knownKeys; + } + public CapitalizationMapBuilder() { + this.instance = new LinkedHashMap<>(); + } + public Map build() { + return instance; + } + public Map getInstance() { + return instance; + } + public CapitalizationMapBuilder getBuilderAfterSmallCamel(Map instance) { + return this; + } + public CapitalizationMapBuilder getBuilderAfterCapitalCamel(Map instance) { + return this; + } + public CapitalizationMapBuilder getBuilderAfterSmallSnake(Map instance) { + return this; + } + public CapitalizationMapBuilder getBuilderAfterCapitalSnake(Map instance) { + return this; + } + public CapitalizationMapBuilder getBuilderAfterSCAETHFlowPoints(Map instance) { + return this; + } + public CapitalizationMapBuilder getBuilderAfterATTNAME(Map instance) { + return this; + } + public CapitalizationMapBuilder getBuilderAfterAdditionalProperty(Map instance) { + return this; + } + } + + + public sealed interface Capitalization1Boxed permits Capitalization1BoxedMap { + @Nullable Object getData(); + } + + public record Capitalization1BoxedMap(CapitalizationMap data) implements Capitalization1Boxed { + @Override + public @Nullable Object getData() { + return data; + } + } + + + public static class Capitalization1 extends JsonSchema implements MapSchemaValidator { + /* + NOTE: This class is auto generated by OpenAPI JSON Schema Generator. + Ref: https://github.com/openapi-json-schema-tools/openapi-json-schema-generator + + Do not edit the class manually. + */ + private static @Nullable Capitalization1 instance = null; + + protected Capitalization1() { + super(new JsonSchemaInfo() + .type(Set.of(Map.class)) + .properties(Map.ofEntries( + new PropertyEntry("smallCamel", SmallCamel.class), + new PropertyEntry("CapitalCamel", CapitalCamel.class), + new PropertyEntry("small_Snake", SmallSnake.class), + new PropertyEntry("Capital_Snake", CapitalSnake.class), + new PropertyEntry("SCA_ETH_Flow_Points", SCAETHFlowPoints.class), + new PropertyEntry("ATT_NAME", ATTNAME.class) + )) + ); + } + + public static Capitalization1 getInstance() { + if (instance == null) { + instance = new Capitalization1(); + } + return instance; + } + + 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 RuntimeException("Invalid non-string key value"); + } + String propertyName = (String) entryKey; + List propertyPathToItem = new ArrayList<>(pathToItem); + propertyPathToItem.add(propertyName); + Object value = entry.getValue(); + LinkedHashMap, Nothing?> schemas = pathToSchemas.get(propertyPathToItem); + if (schemas == null) { + throw new RuntimeException("Validation result is invalid, schemas must exist for a pathToItem"); + } + JsonSchema propertySchema = schemas.entrySet().iterator().next().getKey(); + @Nullable Object propertyInstance = propertySchema.getNewInstance(value, propertyPathToItem, pathToSchemas); + properties.put(propertyName, propertyInstance); + } + FrozenMap<@Nullable Object> castProperties = new FrozenMap<>(properties); + return new CapitalizationMap(castProperties); + } + + 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); + SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().build())); + ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, new PathToSchemasMap(), new LinkedHashSet<>()); + PathToSchemasMap pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet); + return getNewInstance(castArg, validationMetadata.pathToItem(), pathToSchemasMap); + } + + + @Override + public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws 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"); + } + @Override + public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { + if (arg instanceof Map) { + return getNewInstance((Map) arg, pathToItem, pathToSchemas); + } + 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 { + return new Capitalization1BoxedMap(validate(arg, configuration)); + } + @Override + public Capitalization1Boxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { + 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"); + } + } + +} diff --git a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/schemas/Cat.kt b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/schemas/Cat.kt new file mode 100644 index 00000000000..8d72279c906 --- /dev/null +++ b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/schemas/Cat.kt @@ -0,0 +1,503 @@ +package org.openapijsonschematools.client.components.schemas; +import java.time.LocalDate; +import java.time.ZonedDateTime; +import java.util.ArrayList; +import java.util.HashSet; +import java.util.LinkedHashMap; +import java.util.LinkedHashSet; +import java.util.List; +import java.util.Map; +import java.util.Objects; +import java.util.Set; +import java.util.UUID; +import org.checkerframework.checker.nullness.qual.Nullable; +import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags; +import org.openapijsonschematools.client.configurations.SchemaConfiguration; +import org.openapijsonschematools.client.exceptions.InvalidAdditionalPropertyException; +import org.openapijsonschematools.client.exceptions.UnsetPropertyException; +import org.openapijsonschematools.client.exceptions.ValidationException; +import org.openapijsonschematools.client.schemas.BooleanJsonSchema; +import org.openapijsonschematools.client.schemas.GenericBuilder; +import org.openapijsonschematools.client.schemas.UnsetAddPropsSetter; +import org.openapijsonschematools.client.schemas.validation.BooleanSchemaValidator; +import org.openapijsonschematools.client.schemas.validation.FrozenList; +import org.openapijsonschematools.client.schemas.validation.FrozenMap; +import org.openapijsonschematools.client.schemas.validation.JsonSchema; +import org.openapijsonschematools.client.schemas.validation.JsonSchemaInfo; +import org.openapijsonschematools.client.schemas.validation.ListSchemaValidator; +import org.openapijsonschematools.client.schemas.validation.MapSchemaValidator; +import org.openapijsonschematools.client.schemas.validation.NullSchemaValidator; +import org.openapijsonschematools.client.schemas.validation.NumberSchemaValidator; +import org.openapijsonschematools.client.schemas.validation.PathToSchemasMap; +import org.openapijsonschematools.client.schemas.validation.PropertyEntry; +import org.openapijsonschematools.client.schemas.validation.StringSchemaValidator; +import org.openapijsonschematools.client.schemas.validation.ValidationMetadata; + +public class Cat { + // nest classes so all schemas and input/output classes can be public + + + public static class Declawed extends BooleanJsonSchema.BooleanJsonSchema1 { + private static @Nullable Declawed instance = null; + public static Declawed getInstance() { + if (instance == null) { + instance = new Declawed(); + } + return instance; + } + } + + + public static class Schema1Map extends FrozenMap<@Nullable Object> { + protected Schema1Map(FrozenMap<@Nullable Object> m) { + super(m); + } + public static final Set requiredKeys = Set.of(); + public static final Set optionalKeys = Set.of( + "declawed" + ); + public static Schema1Map of(Map arg, SchemaConfiguration configuration) throws ValidationException { + return Schema1.getInstance().validate(arg, configuration); + } + + public boolean declawed() throws UnsetPropertyException { + String key = "declawed"; + throwIfKeyNotPresent(key); + @Nullable Object value = get(key); + if (!(value instanceof Boolean)) { + throw new RuntimeException("Invalid value stored for declawed"); + } + return (boolean) value; + } + + public @Nullable Object getAdditionalProperty(String name) throws UnsetPropertyException, InvalidAdditionalPropertyException { + throwIfKeyKnown(name, requiredKeys, optionalKeys); + throwIfKeyNotPresent(name); + return get(name); + } + } + + public interface SetterForDeclawed { + Map getInstance(); + T getBuilderAfterDeclawed(Map instance); + + default T declawed(boolean value) { + var instance = getInstance(); + instance.put("declawed", value); + return getBuilderAfterDeclawed(instance); + } + } + + public static class Schema1MapBuilder extends UnsetAddPropsSetter implements GenericBuilder>, SetterForDeclawed { + private final Map instance; + private static final Set knownKeys = Set.of( + "declawed" + ); + public Set getKnownKeys() { + return knownKeys; + } + public Schema1MapBuilder() { + this.instance = new LinkedHashMap<>(); + } + public Map build() { + return instance; + } + public Map getInstance() { + return instance; + } + public Schema1MapBuilder getBuilderAfterDeclawed(Map instance) { + return this; + } + public Schema1MapBuilder getBuilderAfterAdditionalProperty(Map instance) { + return this; + } + } + + + public sealed interface Schema1Boxed permits Schema1BoxedMap { + @Nullable Object getData(); + } + + public record Schema1BoxedMap(Schema1Map data) implements Schema1Boxed { + @Override + public @Nullable Object getData() { + return data; + } + } + + + public static class Schema1 extends JsonSchema implements MapSchemaValidator { + private static @Nullable Schema1 instance = null; + + protected Schema1() { + super(new JsonSchemaInfo() + .type(Set.of(Map.class)) + .properties(Map.ofEntries( + new PropertyEntry("declawed", Declawed.class) + )) + ); + } + + public static Schema1 getInstance() { + if (instance == null) { + instance = new Schema1(); + } + return instance; + } + + 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 RuntimeException("Invalid non-string key value"); + } + String propertyName = (String) entryKey; + List propertyPathToItem = new ArrayList<>(pathToItem); + propertyPathToItem.add(propertyName); + Object value = entry.getValue(); + LinkedHashMap, Nothing?> schemas = pathToSchemas.get(propertyPathToItem); + if (schemas == null) { + throw new RuntimeException("Validation result is invalid, schemas must exist for a pathToItem"); + } + JsonSchema propertySchema = schemas.entrySet().iterator().next().getKey(); + @Nullable Object propertyInstance = propertySchema.getNewInstance(value, propertyPathToItem, pathToSchemas); + properties.put(propertyName, propertyInstance); + } + FrozenMap<@Nullable Object> castProperties = new FrozenMap<>(properties); + return new Schema1Map(castProperties); + } + + 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); + SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().build())); + ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, new PathToSchemasMap(), new LinkedHashSet<>()); + PathToSchemasMap pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet); + return getNewInstance(castArg, validationMetadata.pathToItem(), pathToSchemasMap); + } + + + @Override + public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws 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"); + } + @Override + public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { + if (arg instanceof Map) { + return getNewInstance((Map) arg, pathToItem, pathToSchemas); + } + 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 { + return new Schema1BoxedMap(validate(arg, configuration)); + } + @Override + public Schema1Boxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { + 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"); + } + } + + + public sealed interface Cat1Boxed permits Cat1BoxedVoid, Cat1BoxedBoolean, Cat1BoxedNumber, Cat1BoxedString, Cat1BoxedList, Cat1BoxedMap { + @Nullable Object getData(); + } + + public record Cat1BoxedVoid(Nothing? data) implements Cat1Boxed { + @Override + public @Nullable Object getData() { + return data; + } + } + + public record Cat1BoxedBoolean(boolean data) implements Cat1Boxed { + @Override + public @Nullable Object getData() { + return data; + } + } + + public record Cat1BoxedNumber(Number data) implements Cat1Boxed { + @Override + public @Nullable Object getData() { + return data; + } + } + + public record Cat1BoxedString(String data) implements Cat1Boxed { + @Override + public @Nullable Object getData() { + return data; + } + } + + public record Cat1BoxedList(FrozenList<@Nullable Object> data) implements Cat1Boxed { + @Override + public @Nullable Object getData() { + return data; + } + } + + public record Cat1BoxedMap(FrozenMap<@Nullable Object> data) implements Cat1Boxed { + @Override + public @Nullable Object getData() { + return data; + } + } + + + public static class Cat1 extends JsonSchema implements NullSchemaValidator, BooleanSchemaValidator, NumberSchemaValidator, StringSchemaValidator, ListSchemaValidator, Cat1BoxedList>, MapSchemaValidator, Cat1BoxedMap> { + /* + NOTE: This class is auto generated by OpenAPI JSON Schema Generator. + Ref: https://github.com/openapi-json-schema-tools/openapi-json-schema-generator + + Do not edit the class manually. + */ + private static @Nullable Cat1 instance = null; + + protected Cat1() { + super(new JsonSchemaInfo() + .allOf(List.of( + Animal.Animal1.class, + Schema1.class + )) + ); + } + + public static Cat1 getInstance() { + if (instance == null) { + instance = new Cat1(); + } + return instance; + } + + @Override + public Nothing? validate(Nothing? arg, SchemaConfiguration configuration) throws ValidationException { + Set> pathSet = new HashSet<>(); + List pathToItem = List.of("args[0]"); + Nothing? castArg = castToAllowedTypes(arg, pathToItem, pathSet); + SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().build())); + PathToSchemasMap validatedPathToSchemas = new PathToSchemasMap(); + ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, new LinkedHashSet<>()); + getPathToSchemas(this, castArg, validationMetadata, pathSet); + return castArg; + } + + @Override + public boolean validate(boolean arg, SchemaConfiguration configuration) throws ValidationException { + Set> pathSet = new HashSet<>(); + List pathToItem = List.of("args[0]"); + boolean castArg = castToAllowedTypes(arg, pathToItem, pathSet); + SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().build())); + PathToSchemasMap validatedPathToSchemas = new PathToSchemasMap(); + ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, new LinkedHashSet<>()); + getPathToSchemas(this, castArg, validationMetadata, pathSet); + return castArg; + } + + @Override + public Number validate(Number arg, SchemaConfiguration configuration) throws ValidationException { + Set> pathSet = new HashSet<>(); + List pathToItem = List.of("args[0]"); + Number castArg = castToAllowedTypes(arg, pathToItem, pathSet); + SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().build())); + PathToSchemasMap validatedPathToSchemas = new PathToSchemasMap(); + ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, new LinkedHashSet<>()); + getPathToSchemas(this, castArg, validationMetadata, pathSet); + return castArg; + } + + public int validate(int arg, SchemaConfiguration configuration) throws ValidationException { + return (int) validate((Number) arg, configuration); + } + + public long validate(long arg, SchemaConfiguration configuration) throws ValidationException { + return (long) validate((Number) arg, configuration); + } + + public float validate(float arg, SchemaConfiguration configuration) throws ValidationException { + return (float) validate((Number) arg, configuration); + } + + public double validate(double arg, SchemaConfiguration configuration) throws ValidationException { + return (double) validate((Number) arg, configuration); + } + + @Override + public String validate(String arg, SchemaConfiguration configuration) throws ValidationException { + Set> pathSet = new HashSet<>(); + List pathToItem = List.of("args[0]"); + String castArg = castToAllowedTypes(arg, pathToItem, pathSet); + SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().build())); + PathToSchemasMap validatedPathToSchemas = new PathToSchemasMap(); + ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, new LinkedHashSet<>()); + getPathToSchemas(this, castArg, validationMetadata, pathSet); + return castArg; + } + + public String validate(LocalDate arg, SchemaConfiguration configuration) throws ValidationException { + return validate(arg.toString(), configuration); + } + + public String validate(ZonedDateTime arg, SchemaConfiguration configuration) throws ValidationException { + return validate(arg.toString(), configuration); + } + + public String validate(UUID arg, SchemaConfiguration configuration) throws ValidationException { + return validate(arg.toString(), configuration); + } + + @Override + public FrozenList<@Nullable Object> getNewInstance(List arg, List pathToItem, PathToSchemasMap pathToSchemas) { + List<@Nullable Object> items = new ArrayList<>(); + int i = 0; + for (Object item: arg) { + List itemPathToItem = new ArrayList<>(pathToItem); + itemPathToItem.add(i); + LinkedHashMap, Nothing?> schemas = pathToSchemas.get(itemPathToItem); + if (schemas == null) { + throw new RuntimeException("Validation result is invalid, schemas must exist for a pathToItem"); + } + JsonSchema itemSchema = schemas.entrySet().iterator().next().getKey(); + @Nullable Object itemInstance = itemSchema.getNewInstance(item, itemPathToItem, pathToSchemas); + items.add(itemInstance); + i += 1; + } + FrozenList<@Nullable Object> newInstanceItems = new FrozenList<>(items); + return newInstanceItems; + } + + 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); + SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().build())); + ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, new PathToSchemasMap(), new LinkedHashSet<>()); + PathToSchemasMap pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet); + return getNewInstance(castArg, validationMetadata.pathToItem(), pathToSchemasMap); + } + + @Override + 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 RuntimeException("Invalid non-string key value"); + } + String propertyName = (String) entryKey; + List propertyPathToItem = new ArrayList<>(pathToItem); + propertyPathToItem.add(propertyName); + Object value = entry.getValue(); + LinkedHashMap, Nothing?> schemas = pathToSchemas.get(propertyPathToItem); + if (schemas == null) { + throw new RuntimeException("Validation result is invalid, schemas must exist for a pathToItem"); + } + JsonSchema propertySchema = schemas.entrySet().iterator().next().getKey(); + @Nullable Object propertyInstance = propertySchema.getNewInstance(value, propertyPathToItem, pathToSchemas); + properties.put(propertyName, propertyInstance); + } + FrozenMap<@Nullable Object> castProperties = new FrozenMap<>(properties); + return castProperties; + } + + public FrozenMap<@Nullable Object> validate(Map arg, SchemaConfiguration configuration) throws ValidationException { + Set> pathSet = new HashSet<>(); + List pathToItem = List.of("args[0]"); + Map castArg = castToAllowedTypes(arg, pathToItem, pathSet); + SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().build())); + PathToSchemasMap validatedPathToSchemas = new PathToSchemasMap(); + ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, new LinkedHashSet<>()); + PathToSchemasMap pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet); + return getNewInstance(castArg, validationMetadata.pathToItem(), pathToSchemasMap); + } + + @Override + public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { + if (arg == null) { + return validate((Nothing?) null, configuration); + } else if (arg instanceof Boolean) { + boolean boolArg = (Boolean) arg; + return validate(boolArg, configuration); + } else if (arg instanceof Number) { + return validate((Number) arg, configuration); + } else if (arg instanceof String) { + return validate((String) arg, configuration); + } else if (arg instanceof List) { + return validate((List) arg, 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"); + } + @Override + public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { + if (arg == null) { + return getNewInstance((Nothing?) null, pathToItem, pathToSchemas); + } else if (arg instanceof Boolean) { + boolean boolArg = (Boolean) arg; + return getNewInstance(boolArg, pathToItem, pathToSchemas); + } else if (arg instanceof Number) { + return getNewInstance((Number) arg, pathToItem, pathToSchemas); + } else if (arg instanceof String) { + return getNewInstance((String) arg, pathToItem, pathToSchemas); + } else if (arg instanceof List) { + return getNewInstance((List) arg, 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"); + } + @Override + public Cat1BoxedVoid validateAndBox(Nothing? arg, SchemaConfiguration configuration) throws ValidationException { + return new Cat1BoxedVoid(validate(arg, configuration)); + } + @Override + 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 { + return new Cat1BoxedNumber(validate(arg, configuration)); + } + @Override + 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 { + return new Cat1BoxedList(validate(arg, configuration)); + } + @Override + 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 { + if (arg == null) { + Nothing? castArg = (Nothing?) arg; + return validateAndBox(castArg, configuration); + } else if (arg instanceof Boolean booleanArg) { + boolean castArg = booleanArg; + return validateAndBox(castArg, configuration); + } else if (arg instanceof String castArg) { + return validateAndBox(castArg, configuration); + } else if (arg instanceof Number castArg) { + return validateAndBox(castArg, configuration); + } else if (arg instanceof List castArg) { + 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"); + } + } +} diff --git a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/schemas/Category.kt b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/schemas/Category.kt new file mode 100644 index 00000000000..df36d6e43b4 --- /dev/null +++ b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/schemas/Category.kt @@ -0,0 +1,341 @@ +package org.openapijsonschematools.client.components.schemas; +import java.util.ArrayList; +import java.util.HashSet; +import java.util.LinkedHashMap; +import java.util.LinkedHashSet; +import java.util.List; +import java.util.Map; +import java.util.Objects; +import java.util.Set; +import org.checkerframework.checker.nullness.qual.Nullable; +import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags; +import org.openapijsonschematools.client.configurations.SchemaConfiguration; +import org.openapijsonschematools.client.exceptions.InvalidAdditionalPropertyException; +import org.openapijsonschematools.client.exceptions.UnsetPropertyException; +import org.openapijsonschematools.client.exceptions.ValidationException; +import org.openapijsonschematools.client.schemas.GenericBuilder; +import org.openapijsonschematools.client.schemas.Int64JsonSchema; +import org.openapijsonschematools.client.schemas.UnsetAddPropsSetter; +import org.openapijsonschematools.client.schemas.validation.DefaultValueMethod; +import org.openapijsonschematools.client.schemas.validation.FrozenMap; +import org.openapijsonschematools.client.schemas.validation.JsonSchema; +import org.openapijsonschematools.client.schemas.validation.JsonSchemaInfo; +import org.openapijsonschematools.client.schemas.validation.MapSchemaValidator; +import org.openapijsonschematools.client.schemas.validation.PathToSchemasMap; +import org.openapijsonschematools.client.schemas.validation.PropertyEntry; +import org.openapijsonschematools.client.schemas.validation.StringSchemaValidator; +import org.openapijsonschematools.client.schemas.validation.ValidationMetadata; + +public class Category { + // nest classes so all schemas and input/output classes can be public + + + public static class Id extends Int64JsonSchema.Int64JsonSchema1 { + private static @Nullable Id instance = null; + public static Id getInstance() { + if (instance == null) { + instance = new Id(); + } + return instance; + } + } + + + public sealed interface NameBoxed permits NameBoxedString { + @Nullable Object getData(); + } + + public record NameBoxedString(String data) implements NameBoxed { + @Override + public @Nullable Object getData() { + return data; + } + } + + + + public static class Name extends JsonSchema implements StringSchemaValidator, DefaultValueMethod { + private static @Nullable Name instance = null; + + protected Name() { + super(new JsonSchemaInfo() + .type(Set.of( + String.class + )) + .defaultValue("default-name") + ); + } + + public static Name getInstance() { + if (instance == null) { + instance = new Name(); + } + return instance; + } + + @Override + public String validate(String arg, SchemaConfiguration configuration) throws ValidationException { + Set> pathSet = new HashSet<>(); + List pathToItem = List.of("args[0"); + String castArg = castToAllowedTypes(arg, pathToItem, pathSet); + SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().build())); + ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, new PathToSchemasMap(), new LinkedHashSet<>()); + getPathToSchemas(this, castArg, validationMetadata, pathSet); + return castArg; + } + + @Override + public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws 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"); + } + @Override + public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { + 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"); + } + public String defaultValue() throws ValidationException { + if (defaultValue instanceof String) { + return (String) defaultValue; + } + throw new ValidationException("Invalid type stored in defaultValue"); + } + @Override + 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 { + 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"); + } + } + + public static class CategoryMap extends FrozenMap<@Nullable Object> { + protected CategoryMap(FrozenMap<@Nullable Object> m) { + super(m); + } + public static final Set requiredKeys = Set.of( + "name" + ); + public static final Set optionalKeys = Set.of( + "id" + ); + public static CategoryMap of(Map arg, SchemaConfiguration configuration) throws ValidationException { + return Category1.getInstance().validate(arg, configuration); + } + + public String name() { + @Nullable Object value = get("name"); + if (!(value instanceof String)) { + throw new RuntimeException("Invalid value stored for name"); + } + return (String) value; + } + + public Number id() throws UnsetPropertyException { + String key = "id"; + throwIfKeyNotPresent(key); + @Nullable Object value = get(key); + if (!(value instanceof Number)) { + throw new RuntimeException("Invalid value stored for id"); + } + return (Number) value; + } + + public @Nullable Object getAdditionalProperty(String name) throws UnsetPropertyException, InvalidAdditionalPropertyException { + throwIfKeyKnown(name, requiredKeys, optionalKeys); + throwIfKeyNotPresent(name); + return get(name); + } + } + + public interface SetterForName { + Map getInstance(); + T getBuilderAfterName(Map instance); + + default T name(String value) { + var instance = getInstance(); + instance.put("name", value); + return getBuilderAfterName(instance); + } + } + + public interface SetterForId { + Map getInstance(); + T getBuilderAfterId(Map instance); + + default T id(int value) { + var instance = getInstance(); + instance.put("id", value); + return getBuilderAfterId(instance); + } + + default T id(float value) { + var instance = getInstance(); + instance.put("id", value); + return getBuilderAfterId(instance); + } + + default T id(long value) { + var instance = getInstance(); + instance.put("id", value); + return getBuilderAfterId(instance); + } + + default T id(double value) { + var instance = getInstance(); + instance.put("id", value); + return getBuilderAfterId(instance); + } + } + + public static class CategoryMap0Builder extends UnsetAddPropsSetter implements GenericBuilder>, SetterForId { + private final Map instance; + private static final Set knownKeys = Set.of( + "name", + "id" + ); + public Set getKnownKeys() { + return knownKeys; + } + public CategoryMap0Builder(Map instance) { + this.instance = instance; + } + public Map build() { + return instance; + } + public Map getInstance() { + return instance; + } + public CategoryMap0Builder getBuilderAfterId(Map instance) { + return this; + } + public CategoryMap0Builder getBuilderAfterAdditionalProperty(Map instance) { + return this; + } + } + + public static class CategoryMapBuilder implements SetterForName { + private final Map instance; + public CategoryMapBuilder() { + this.instance = new LinkedHashMap<>(); + } + public Map getInstance() { + return instance; + } + public CategoryMap0Builder getBuilderAfterName(Map instance) { + return new CategoryMap0Builder(instance); + } + } + + + public sealed interface Category1Boxed permits Category1BoxedMap { + @Nullable Object getData(); + } + + public record Category1BoxedMap(CategoryMap data) implements Category1Boxed { + @Override + public @Nullable Object getData() { + return data; + } + } + + + public static class Category1 extends JsonSchema implements MapSchemaValidator { + /* + NOTE: This class is auto generated by OpenAPI JSON Schema Generator. + Ref: https://github.com/openapi-json-schema-tools/openapi-json-schema-generator + + Do not edit the class manually. + */ + private static @Nullable Category1 instance = null; + + protected Category1() { + super(new JsonSchemaInfo() + .type(Set.of(Map.class)) + .properties(Map.ofEntries( + new PropertyEntry("id", Id.class), + new PropertyEntry("name", Name.class) + )) + .required(Set.of( + "name" + )) + ); + } + + public static Category1 getInstance() { + if (instance == null) { + instance = new Category1(); + } + return instance; + } + + 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 RuntimeException("Invalid non-string key value"); + } + String propertyName = (String) entryKey; + List propertyPathToItem = new ArrayList<>(pathToItem); + propertyPathToItem.add(propertyName); + Object value = entry.getValue(); + LinkedHashMap, Nothing?> schemas = pathToSchemas.get(propertyPathToItem); + if (schemas == null) { + throw new RuntimeException("Validation result is invalid, schemas must exist for a pathToItem"); + } + JsonSchema propertySchema = schemas.entrySet().iterator().next().getKey(); + @Nullable Object propertyInstance = propertySchema.getNewInstance(value, propertyPathToItem, pathToSchemas); + properties.put(propertyName, propertyInstance); + } + FrozenMap<@Nullable Object> castProperties = new FrozenMap<>(properties); + return new CategoryMap(castProperties); + } + + 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); + SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().build())); + ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, new PathToSchemasMap(), new LinkedHashSet<>()); + PathToSchemasMap pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet); + return getNewInstance(castArg, validationMetadata.pathToItem(), pathToSchemasMap); + } + + + @Override + public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws 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"); + } + @Override + public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { + if (arg instanceof Map) { + return getNewInstance((Map) arg, pathToItem, pathToSchemas); + } + 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 { + return new Category1BoxedMap(validate(arg, configuration)); + } + @Override + public Category1Boxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { + 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"); + } + } + +} diff --git a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/schemas/ChildCat.kt b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/schemas/ChildCat.kt new file mode 100644 index 00000000000..ebb949fd2f5 --- /dev/null +++ b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/schemas/ChildCat.kt @@ -0,0 +1,503 @@ +package org.openapijsonschematools.client.components.schemas; +import java.time.LocalDate; +import java.time.ZonedDateTime; +import java.util.ArrayList; +import java.util.HashSet; +import java.util.LinkedHashMap; +import java.util.LinkedHashSet; +import java.util.List; +import java.util.Map; +import java.util.Objects; +import java.util.Set; +import java.util.UUID; +import org.checkerframework.checker.nullness.qual.Nullable; +import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags; +import org.openapijsonschematools.client.configurations.SchemaConfiguration; +import org.openapijsonschematools.client.exceptions.InvalidAdditionalPropertyException; +import org.openapijsonschematools.client.exceptions.UnsetPropertyException; +import org.openapijsonschematools.client.exceptions.ValidationException; +import org.openapijsonschematools.client.schemas.GenericBuilder; +import org.openapijsonschematools.client.schemas.StringJsonSchema; +import org.openapijsonschematools.client.schemas.UnsetAddPropsSetter; +import org.openapijsonschematools.client.schemas.validation.BooleanSchemaValidator; +import org.openapijsonschematools.client.schemas.validation.FrozenList; +import org.openapijsonschematools.client.schemas.validation.FrozenMap; +import org.openapijsonschematools.client.schemas.validation.JsonSchema; +import org.openapijsonschematools.client.schemas.validation.JsonSchemaInfo; +import org.openapijsonschematools.client.schemas.validation.ListSchemaValidator; +import org.openapijsonschematools.client.schemas.validation.MapSchemaValidator; +import org.openapijsonschematools.client.schemas.validation.NullSchemaValidator; +import org.openapijsonschematools.client.schemas.validation.NumberSchemaValidator; +import org.openapijsonschematools.client.schemas.validation.PathToSchemasMap; +import org.openapijsonschematools.client.schemas.validation.PropertyEntry; +import org.openapijsonschematools.client.schemas.validation.StringSchemaValidator; +import org.openapijsonschematools.client.schemas.validation.ValidationMetadata; + +public class ChildCat { + // nest classes so all schemas and input/output classes can be public + + + public static class Name extends StringJsonSchema.StringJsonSchema1 { + private static @Nullable Name instance = null; + public static Name getInstance() { + if (instance == null) { + instance = new Name(); + } + return instance; + } + } + + + public static class Schema1Map extends FrozenMap<@Nullable Object> { + protected Schema1Map(FrozenMap<@Nullable Object> m) { + super(m); + } + public static final Set requiredKeys = Set.of(); + public static final Set optionalKeys = Set.of( + "name" + ); + public static Schema1Map of(Map arg, SchemaConfiguration configuration) throws ValidationException { + return Schema1.getInstance().validate(arg, configuration); + } + + public String name() throws UnsetPropertyException { + String key = "name"; + throwIfKeyNotPresent(key); + @Nullable Object value = get(key); + if (!(value instanceof String)) { + throw new RuntimeException("Invalid value stored for name"); + } + return (String) value; + } + + public @Nullable Object getAdditionalProperty(String name) throws UnsetPropertyException, InvalidAdditionalPropertyException { + throwIfKeyKnown(name, requiredKeys, optionalKeys); + throwIfKeyNotPresent(name); + return get(name); + } + } + + public interface SetterForName { + Map getInstance(); + T getBuilderAfterName(Map instance); + + default T name(String value) { + var instance = getInstance(); + instance.put("name", value); + return getBuilderAfterName(instance); + } + } + + public static class Schema1MapBuilder extends UnsetAddPropsSetter implements GenericBuilder>, SetterForName { + private final Map instance; + private static final Set knownKeys = Set.of( + "name" + ); + public Set getKnownKeys() { + return knownKeys; + } + public Schema1MapBuilder() { + this.instance = new LinkedHashMap<>(); + } + public Map build() { + return instance; + } + public Map getInstance() { + return instance; + } + public Schema1MapBuilder getBuilderAfterName(Map instance) { + return this; + } + public Schema1MapBuilder getBuilderAfterAdditionalProperty(Map instance) { + return this; + } + } + + + public sealed interface Schema1Boxed permits Schema1BoxedMap { + @Nullable Object getData(); + } + + public record Schema1BoxedMap(Schema1Map data) implements Schema1Boxed { + @Override + public @Nullable Object getData() { + return data; + } + } + + + public static class Schema1 extends JsonSchema implements MapSchemaValidator { + private static @Nullable Schema1 instance = null; + + protected Schema1() { + super(new JsonSchemaInfo() + .type(Set.of(Map.class)) + .properties(Map.ofEntries( + new PropertyEntry("name", Name.class) + )) + ); + } + + public static Schema1 getInstance() { + if (instance == null) { + instance = new Schema1(); + } + return instance; + } + + 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 RuntimeException("Invalid non-string key value"); + } + String propertyName = (String) entryKey; + List propertyPathToItem = new ArrayList<>(pathToItem); + propertyPathToItem.add(propertyName); + Object value = entry.getValue(); + LinkedHashMap, Nothing?> schemas = pathToSchemas.get(propertyPathToItem); + if (schemas == null) { + throw new RuntimeException("Validation result is invalid, schemas must exist for a pathToItem"); + } + JsonSchema propertySchema = schemas.entrySet().iterator().next().getKey(); + @Nullable Object propertyInstance = propertySchema.getNewInstance(value, propertyPathToItem, pathToSchemas); + properties.put(propertyName, propertyInstance); + } + FrozenMap<@Nullable Object> castProperties = new FrozenMap<>(properties); + return new Schema1Map(castProperties); + } + + 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); + SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().build())); + ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, new PathToSchemasMap(), new LinkedHashSet<>()); + PathToSchemasMap pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet); + return getNewInstance(castArg, validationMetadata.pathToItem(), pathToSchemasMap); + } + + + @Override + public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws 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"); + } + @Override + public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { + if (arg instanceof Map) { + return getNewInstance((Map) arg, pathToItem, pathToSchemas); + } + 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 { + return new Schema1BoxedMap(validate(arg, configuration)); + } + @Override + public Schema1Boxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { + 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"); + } + } + + + public sealed interface ChildCat1Boxed permits ChildCat1BoxedVoid, ChildCat1BoxedBoolean, ChildCat1BoxedNumber, ChildCat1BoxedString, ChildCat1BoxedList, ChildCat1BoxedMap { + @Nullable Object getData(); + } + + public record ChildCat1BoxedVoid(Nothing? data) implements ChildCat1Boxed { + @Override + public @Nullable Object getData() { + return data; + } + } + + public record ChildCat1BoxedBoolean(boolean data) implements ChildCat1Boxed { + @Override + public @Nullable Object getData() { + return data; + } + } + + public record ChildCat1BoxedNumber(Number data) implements ChildCat1Boxed { + @Override + public @Nullable Object getData() { + return data; + } + } + + public record ChildCat1BoxedString(String data) implements ChildCat1Boxed { + @Override + public @Nullable Object getData() { + return data; + } + } + + public record ChildCat1BoxedList(FrozenList<@Nullable Object> data) implements ChildCat1Boxed { + @Override + public @Nullable Object getData() { + return data; + } + } + + public record ChildCat1BoxedMap(FrozenMap<@Nullable Object> data) implements ChildCat1Boxed { + @Override + public @Nullable Object getData() { + return data; + } + } + + + public static class ChildCat1 extends JsonSchema implements NullSchemaValidator, BooleanSchemaValidator, NumberSchemaValidator, StringSchemaValidator, ListSchemaValidator, ChildCat1BoxedList>, MapSchemaValidator, ChildCat1BoxedMap> { + /* + NOTE: This class is auto generated by OpenAPI JSON Schema Generator. + Ref: https://github.com/openapi-json-schema-tools/openapi-json-schema-generator + + Do not edit the class manually. + */ + private static @Nullable ChildCat1 instance = null; + + protected ChildCat1() { + super(new JsonSchemaInfo() + .allOf(List.of( + ParentPet.ParentPet1.class, + Schema1.class + )) + ); + } + + public static ChildCat1 getInstance() { + if (instance == null) { + instance = new ChildCat1(); + } + return instance; + } + + @Override + public Nothing? validate(Nothing? arg, SchemaConfiguration configuration) throws ValidationException { + Set> pathSet = new HashSet<>(); + List pathToItem = List.of("args[0]"); + Nothing? castArg = castToAllowedTypes(arg, pathToItem, pathSet); + SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().build())); + PathToSchemasMap validatedPathToSchemas = new PathToSchemasMap(); + ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, new LinkedHashSet<>()); + getPathToSchemas(this, castArg, validationMetadata, pathSet); + return castArg; + } + + @Override + public boolean validate(boolean arg, SchemaConfiguration configuration) throws ValidationException { + Set> pathSet = new HashSet<>(); + List pathToItem = List.of("args[0]"); + boolean castArg = castToAllowedTypes(arg, pathToItem, pathSet); + SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().build())); + PathToSchemasMap validatedPathToSchemas = new PathToSchemasMap(); + ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, new LinkedHashSet<>()); + getPathToSchemas(this, castArg, validationMetadata, pathSet); + return castArg; + } + + @Override + public Number validate(Number arg, SchemaConfiguration configuration) throws ValidationException { + Set> pathSet = new HashSet<>(); + List pathToItem = List.of("args[0]"); + Number castArg = castToAllowedTypes(arg, pathToItem, pathSet); + SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().build())); + PathToSchemasMap validatedPathToSchemas = new PathToSchemasMap(); + ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, new LinkedHashSet<>()); + getPathToSchemas(this, castArg, validationMetadata, pathSet); + return castArg; + } + + public int validate(int arg, SchemaConfiguration configuration) throws ValidationException { + return (int) validate((Number) arg, configuration); + } + + public long validate(long arg, SchemaConfiguration configuration) throws ValidationException { + return (long) validate((Number) arg, configuration); + } + + public float validate(float arg, SchemaConfiguration configuration) throws ValidationException { + return (float) validate((Number) arg, configuration); + } + + public double validate(double arg, SchemaConfiguration configuration) throws ValidationException { + return (double) validate((Number) arg, configuration); + } + + @Override + public String validate(String arg, SchemaConfiguration configuration) throws ValidationException { + Set> pathSet = new HashSet<>(); + List pathToItem = List.of("args[0]"); + String castArg = castToAllowedTypes(arg, pathToItem, pathSet); + SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().build())); + PathToSchemasMap validatedPathToSchemas = new PathToSchemasMap(); + ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, new LinkedHashSet<>()); + getPathToSchemas(this, castArg, validationMetadata, pathSet); + return castArg; + } + + public String validate(LocalDate arg, SchemaConfiguration configuration) throws ValidationException { + return validate(arg.toString(), configuration); + } + + public String validate(ZonedDateTime arg, SchemaConfiguration configuration) throws ValidationException { + return validate(arg.toString(), configuration); + } + + public String validate(UUID arg, SchemaConfiguration configuration) throws ValidationException { + return validate(arg.toString(), configuration); + } + + @Override + public FrozenList<@Nullable Object> getNewInstance(List arg, List pathToItem, PathToSchemasMap pathToSchemas) { + List<@Nullable Object> items = new ArrayList<>(); + int i = 0; + for (Object item: arg) { + List itemPathToItem = new ArrayList<>(pathToItem); + itemPathToItem.add(i); + LinkedHashMap, Nothing?> schemas = pathToSchemas.get(itemPathToItem); + if (schemas == null) { + throw new RuntimeException("Validation result is invalid, schemas must exist for a pathToItem"); + } + JsonSchema itemSchema = schemas.entrySet().iterator().next().getKey(); + @Nullable Object itemInstance = itemSchema.getNewInstance(item, itemPathToItem, pathToSchemas); + items.add(itemInstance); + i += 1; + } + FrozenList<@Nullable Object> newInstanceItems = new FrozenList<>(items); + return newInstanceItems; + } + + 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); + SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().build())); + ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, new PathToSchemasMap(), new LinkedHashSet<>()); + PathToSchemasMap pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet); + return getNewInstance(castArg, validationMetadata.pathToItem(), pathToSchemasMap); + } + + @Override + 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 RuntimeException("Invalid non-string key value"); + } + String propertyName = (String) entryKey; + List propertyPathToItem = new ArrayList<>(pathToItem); + propertyPathToItem.add(propertyName); + Object value = entry.getValue(); + LinkedHashMap, Nothing?> schemas = pathToSchemas.get(propertyPathToItem); + if (schemas == null) { + throw new RuntimeException("Validation result is invalid, schemas must exist for a pathToItem"); + } + JsonSchema propertySchema = schemas.entrySet().iterator().next().getKey(); + @Nullable Object propertyInstance = propertySchema.getNewInstance(value, propertyPathToItem, pathToSchemas); + properties.put(propertyName, propertyInstance); + } + FrozenMap<@Nullable Object> castProperties = new FrozenMap<>(properties); + return castProperties; + } + + public FrozenMap<@Nullable Object> validate(Map arg, SchemaConfiguration configuration) throws ValidationException { + Set> pathSet = new HashSet<>(); + List pathToItem = List.of("args[0]"); + Map castArg = castToAllowedTypes(arg, pathToItem, pathSet); + SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().build())); + PathToSchemasMap validatedPathToSchemas = new PathToSchemasMap(); + ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, new LinkedHashSet<>()); + PathToSchemasMap pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet); + return getNewInstance(castArg, validationMetadata.pathToItem(), pathToSchemasMap); + } + + @Override + public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { + if (arg == null) { + return validate((Nothing?) null, configuration); + } else if (arg instanceof Boolean) { + boolean boolArg = (Boolean) arg; + return validate(boolArg, configuration); + } else if (arg instanceof Number) { + return validate((Number) arg, configuration); + } else if (arg instanceof String) { + return validate((String) arg, configuration); + } else if (arg instanceof List) { + return validate((List) arg, 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"); + } + @Override + public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { + if (arg == null) { + return getNewInstance((Nothing?) null, pathToItem, pathToSchemas); + } else if (arg instanceof Boolean) { + boolean boolArg = (Boolean) arg; + return getNewInstance(boolArg, pathToItem, pathToSchemas); + } else if (arg instanceof Number) { + return getNewInstance((Number) arg, pathToItem, pathToSchemas); + } else if (arg instanceof String) { + return getNewInstance((String) arg, pathToItem, pathToSchemas); + } else if (arg instanceof List) { + return getNewInstance((List) arg, 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"); + } + @Override + public ChildCat1BoxedVoid validateAndBox(Nothing? arg, SchemaConfiguration configuration) throws ValidationException { + return new ChildCat1BoxedVoid(validate(arg, configuration)); + } + @Override + 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 { + return new ChildCat1BoxedNumber(validate(arg, configuration)); + } + @Override + 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 { + return new ChildCat1BoxedList(validate(arg, configuration)); + } + @Override + 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 { + if (arg == null) { + Nothing? castArg = (Nothing?) arg; + return validateAndBox(castArg, configuration); + } else if (arg instanceof Boolean booleanArg) { + boolean castArg = booleanArg; + return validateAndBox(castArg, configuration); + } else if (arg instanceof String castArg) { + return validateAndBox(castArg, configuration); + } else if (arg instanceof Number castArg) { + return validateAndBox(castArg, configuration); + } else if (arg instanceof List castArg) { + 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"); + } + } +} diff --git a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/schemas/ClassModel.kt b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/schemas/ClassModel.kt new file mode 100644 index 00000000000..49761ad9652 --- /dev/null +++ b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/schemas/ClassModel.kt @@ -0,0 +1,401 @@ +package org.openapijsonschematools.client.components.schemas; +import java.time.LocalDate; +import java.time.ZonedDateTime; +import java.util.ArrayList; +import java.util.HashSet; +import java.util.LinkedHashMap; +import java.util.LinkedHashSet; +import java.util.List; +import java.util.Map; +import java.util.Objects; +import java.util.Set; +import java.util.UUID; +import org.checkerframework.checker.nullness.qual.Nullable; +import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags; +import org.openapijsonschematools.client.configurations.SchemaConfiguration; +import org.openapijsonschematools.client.exceptions.InvalidAdditionalPropertyException; +import org.openapijsonschematools.client.exceptions.UnsetPropertyException; +import org.openapijsonschematools.client.exceptions.ValidationException; +import org.openapijsonschematools.client.schemas.GenericBuilder; +import org.openapijsonschematools.client.schemas.StringJsonSchema; +import org.openapijsonschematools.client.schemas.UnsetAddPropsSetter; +import org.openapijsonschematools.client.schemas.validation.BooleanSchemaValidator; +import org.openapijsonschematools.client.schemas.validation.FrozenList; +import org.openapijsonschematools.client.schemas.validation.FrozenMap; +import org.openapijsonschematools.client.schemas.validation.JsonSchema; +import org.openapijsonschematools.client.schemas.validation.JsonSchemaInfo; +import org.openapijsonschematools.client.schemas.validation.ListSchemaValidator; +import org.openapijsonschematools.client.schemas.validation.MapSchemaValidator; +import org.openapijsonschematools.client.schemas.validation.NullSchemaValidator; +import org.openapijsonschematools.client.schemas.validation.NumberSchemaValidator; +import org.openapijsonschematools.client.schemas.validation.PathToSchemasMap; +import org.openapijsonschematools.client.schemas.validation.PropertyEntry; +import org.openapijsonschematools.client.schemas.validation.StringSchemaValidator; +import org.openapijsonschematools.client.schemas.validation.ValidationMetadata; + +public class ClassModel { + // nest classes so all schemas and input/output classes can be public + + + public static class ClassSchema extends StringJsonSchema.StringJsonSchema1 { + private static @Nullable ClassSchema instance = null; + public static ClassSchema getInstance() { + if (instance == null) { + instance = new ClassSchema(); + } + return instance; + } + } + + + public static class ClassModelMap extends FrozenMap<@Nullable Object> { + protected ClassModelMap(FrozenMap<@Nullable Object> m) { + super(m); + } + public static final Set requiredKeys = Set.of(); + public static final Set optionalKeys = Set.of( + "_class" + ); + public static ClassModelMap of(Map arg, SchemaConfiguration configuration) throws ValidationException { + return ClassModel1.getInstance().validate(arg, configuration); + } + + public @Nullable Object getAdditionalProperty(String name) throws UnsetPropertyException, InvalidAdditionalPropertyException { + throwIfKeyKnown(name, requiredKeys, optionalKeys); + throwIfKeyNotPresent(name); + return get(name); + } + } + + public interface SetterForClassSchema { + Map getInstance(); + T getBuilderAfterClassSchema(Map instance); + + default T lowLineClass(String value) { + var instance = getInstance(); + instance.put("_class", value); + return getBuilderAfterClassSchema(instance); + } + } + + public static class ClassModelMapBuilder extends UnsetAddPropsSetter implements GenericBuilder>, SetterForClassSchema { + private final Map instance; + private static final Set knownKeys = Set.of( + "_class" + ); + public Set getKnownKeys() { + return knownKeys; + } + public ClassModelMapBuilder() { + this.instance = new LinkedHashMap<>(); + } + public Map build() { + return instance; + } + public Map getInstance() { + return instance; + } + public ClassModelMapBuilder getBuilderAfterClassSchema(Map instance) { + return this; + } + public ClassModelMapBuilder getBuilderAfterAdditionalProperty(Map instance) { + return this; + } + } + + + public sealed interface ClassModel1Boxed permits ClassModel1BoxedVoid, ClassModel1BoxedBoolean, ClassModel1BoxedNumber, ClassModel1BoxedString, ClassModel1BoxedList, ClassModel1BoxedMap { + @Nullable Object getData(); + } + + public record ClassModel1BoxedVoid(Nothing? data) implements ClassModel1Boxed { + @Override + public @Nullable Object getData() { + return data; + } + } + + public record ClassModel1BoxedBoolean(boolean data) implements ClassModel1Boxed { + @Override + public @Nullable Object getData() { + return data; + } + } + + public record ClassModel1BoxedNumber(Number data) implements ClassModel1Boxed { + @Override + public @Nullable Object getData() { + return data; + } + } + + public record ClassModel1BoxedString(String data) implements ClassModel1Boxed { + @Override + public @Nullable Object getData() { + return data; + } + } + + public record ClassModel1BoxedList(FrozenList<@Nullable Object> data) implements ClassModel1Boxed { + @Override + public @Nullable Object getData() { + return data; + } + } + + public record ClassModel1BoxedMap(ClassModelMap data) implements ClassModel1Boxed { + @Override + public @Nullable Object getData() { + return data; + } + } + + + public static class ClassModel1 extends JsonSchema implements NullSchemaValidator, BooleanSchemaValidator, NumberSchemaValidator, StringSchemaValidator, ListSchemaValidator, ClassModel1BoxedList>, MapSchemaValidator { + /* + NOTE: This class is auto generated by OpenAPI JSON Schema Generator. + Ref: https://github.com/openapi-json-schema-tools/openapi-json-schema-generator + + Do not edit the class manually. + + Model for testing model with "_class" property + */ + private static @Nullable ClassModel1 instance = null; + + protected ClassModel1() { + super(new JsonSchemaInfo() + .properties(Map.ofEntries( + new PropertyEntry("_class", ClassSchema.class) + )) + ); + } + + public static ClassModel1 getInstance() { + if (instance == null) { + instance = new ClassModel1(); + } + return instance; + } + + @Override + public Nothing? validate(Nothing? arg, SchemaConfiguration configuration) throws ValidationException { + Set> pathSet = new HashSet<>(); + List pathToItem = List.of("args[0]"); + Nothing? castArg = castToAllowedTypes(arg, pathToItem, pathSet); + SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().build())); + PathToSchemasMap validatedPathToSchemas = new PathToSchemasMap(); + ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, new LinkedHashSet<>()); + getPathToSchemas(this, castArg, validationMetadata, pathSet); + return castArg; + } + + @Override + public boolean validate(boolean arg, SchemaConfiguration configuration) throws ValidationException { + Set> pathSet = new HashSet<>(); + List pathToItem = List.of("args[0]"); + boolean castArg = castToAllowedTypes(arg, pathToItem, pathSet); + SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().build())); + PathToSchemasMap validatedPathToSchemas = new PathToSchemasMap(); + ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, new LinkedHashSet<>()); + getPathToSchemas(this, castArg, validationMetadata, pathSet); + return castArg; + } + + @Override + public Number validate(Number arg, SchemaConfiguration configuration) throws ValidationException { + Set> pathSet = new HashSet<>(); + List pathToItem = List.of("args[0]"); + Number castArg = castToAllowedTypes(arg, pathToItem, pathSet); + SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().build())); + PathToSchemasMap validatedPathToSchemas = new PathToSchemasMap(); + ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, new LinkedHashSet<>()); + getPathToSchemas(this, castArg, validationMetadata, pathSet); + return castArg; + } + + public int validate(int arg, SchemaConfiguration configuration) throws ValidationException { + return (int) validate((Number) arg, configuration); + } + + public long validate(long arg, SchemaConfiguration configuration) throws ValidationException { + return (long) validate((Number) arg, configuration); + } + + public float validate(float arg, SchemaConfiguration configuration) throws ValidationException { + return (float) validate((Number) arg, configuration); + } + + public double validate(double arg, SchemaConfiguration configuration) throws ValidationException { + return (double) validate((Number) arg, configuration); + } + + @Override + public String validate(String arg, SchemaConfiguration configuration) throws ValidationException { + Set> pathSet = new HashSet<>(); + List pathToItem = List.of("args[0]"); + String castArg = castToAllowedTypes(arg, pathToItem, pathSet); + SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().build())); + PathToSchemasMap validatedPathToSchemas = new PathToSchemasMap(); + ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, new LinkedHashSet<>()); + getPathToSchemas(this, castArg, validationMetadata, pathSet); + return castArg; + } + + public String validate(LocalDate arg, SchemaConfiguration configuration) throws ValidationException { + return validate(arg.toString(), configuration); + } + + public String validate(ZonedDateTime arg, SchemaConfiguration configuration) throws ValidationException { + return validate(arg.toString(), configuration); + } + + public String validate(UUID arg, SchemaConfiguration configuration) throws ValidationException { + return validate(arg.toString(), configuration); + } + + @Override + public FrozenList<@Nullable Object> getNewInstance(List arg, List pathToItem, PathToSchemasMap pathToSchemas) { + List<@Nullable Object> items = new ArrayList<>(); + int i = 0; + for (Object item: arg) { + List itemPathToItem = new ArrayList<>(pathToItem); + itemPathToItem.add(i); + LinkedHashMap, Nothing?> schemas = pathToSchemas.get(itemPathToItem); + if (schemas == null) { + throw new RuntimeException("Validation result is invalid, schemas must exist for a pathToItem"); + } + JsonSchema itemSchema = schemas.entrySet().iterator().next().getKey(); + @Nullable Object itemInstance = itemSchema.getNewInstance(item, itemPathToItem, pathToSchemas); + items.add(itemInstance); + i += 1; + } + FrozenList<@Nullable Object> newInstanceItems = new FrozenList<>(items); + return newInstanceItems; + } + + 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); + SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().build())); + ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, new PathToSchemasMap(), new LinkedHashSet<>()); + PathToSchemasMap pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet); + return getNewInstance(castArg, validationMetadata.pathToItem(), pathToSchemasMap); + } + + @Override + 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 RuntimeException("Invalid non-string key value"); + } + String propertyName = (String) entryKey; + List propertyPathToItem = new ArrayList<>(pathToItem); + propertyPathToItem.add(propertyName); + Object value = entry.getValue(); + LinkedHashMap, Nothing?> schemas = pathToSchemas.get(propertyPathToItem); + if (schemas == null) { + throw new RuntimeException("Validation result is invalid, schemas must exist for a pathToItem"); + } + JsonSchema propertySchema = schemas.entrySet().iterator().next().getKey(); + @Nullable Object propertyInstance = propertySchema.getNewInstance(value, propertyPathToItem, pathToSchemas); + properties.put(propertyName, propertyInstance); + } + FrozenMap<@Nullable Object> castProperties = new FrozenMap<>(properties); + return new ClassModelMap(castProperties); + } + + 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); + SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().build())); + PathToSchemasMap validatedPathToSchemas = new PathToSchemasMap(); + ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, new LinkedHashSet<>()); + PathToSchemasMap pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet); + return getNewInstance(castArg, validationMetadata.pathToItem(), pathToSchemasMap); + } + + @Override + public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { + if (arg == null) { + return validate((Nothing?) null, configuration); + } else if (arg instanceof Boolean) { + boolean boolArg = (Boolean) arg; + return validate(boolArg, configuration); + } else if (arg instanceof Number) { + return validate((Number) arg, configuration); + } else if (arg instanceof String) { + return validate((String) arg, configuration); + } else if (arg instanceof List) { + return validate((List) arg, 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"); + } + @Override + public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { + if (arg == null) { + return getNewInstance((Nothing?) null, pathToItem, pathToSchemas); + } else if (arg instanceof Boolean) { + boolean boolArg = (Boolean) arg; + return getNewInstance(boolArg, pathToItem, pathToSchemas); + } else if (arg instanceof Number) { + return getNewInstance((Number) arg, pathToItem, pathToSchemas); + } else if (arg instanceof String) { + return getNewInstance((String) arg, pathToItem, pathToSchemas); + } else if (arg instanceof List) { + return getNewInstance((List) arg, 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"); + } + @Override + public ClassModel1BoxedVoid validateAndBox(Nothing? arg, SchemaConfiguration configuration) throws ValidationException { + return new ClassModel1BoxedVoid(validate(arg, configuration)); + } + @Override + 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 { + return new ClassModel1BoxedNumber(validate(arg, configuration)); + } + @Override + 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 { + return new ClassModel1BoxedList(validate(arg, configuration)); + } + @Override + 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 { + if (arg == null) { + Nothing? castArg = (Nothing?) arg; + return validateAndBox(castArg, configuration); + } else if (arg instanceof Boolean booleanArg) { + boolean castArg = booleanArg; + return validateAndBox(castArg, configuration); + } else if (arg instanceof String castArg) { + return validateAndBox(castArg, configuration); + } else if (arg instanceof Number castArg) { + return validateAndBox(castArg, configuration); + } else if (arg instanceof List castArg) { + 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"); + } + } +} diff --git a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/schemas/Client.kt b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/schemas/Client.kt new file mode 100644 index 00000000000..2042b415a6f --- /dev/null +++ b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/schemas/Client.kt @@ -0,0 +1,206 @@ +package org.openapijsonschematools.client.components.schemas; +import java.util.ArrayList; +import java.util.HashSet; +import java.util.LinkedHashMap; +import java.util.LinkedHashSet; +import java.util.List; +import java.util.Map; +import java.util.Objects; +import java.util.Set; +import org.checkerframework.checker.nullness.qual.Nullable; +import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags; +import org.openapijsonschematools.client.configurations.SchemaConfiguration; +import org.openapijsonschematools.client.exceptions.InvalidAdditionalPropertyException; +import org.openapijsonschematools.client.exceptions.UnsetPropertyException; +import org.openapijsonschematools.client.exceptions.ValidationException; +import org.openapijsonschematools.client.schemas.GenericBuilder; +import org.openapijsonschematools.client.schemas.StringJsonSchema; +import org.openapijsonschematools.client.schemas.UnsetAddPropsSetter; +import org.openapijsonschematools.client.schemas.validation.FrozenMap; +import org.openapijsonschematools.client.schemas.validation.JsonSchema; +import org.openapijsonschematools.client.schemas.validation.JsonSchemaInfo; +import org.openapijsonschematools.client.schemas.validation.MapSchemaValidator; +import org.openapijsonschematools.client.schemas.validation.PathToSchemasMap; +import org.openapijsonschematools.client.schemas.validation.PropertyEntry; +import org.openapijsonschematools.client.schemas.validation.ValidationMetadata; + +public class Client { + // nest classes so all schemas and input/output classes can be public + + + public static class Client2 extends StringJsonSchema.StringJsonSchema1 { + private static @Nullable Client2 instance = null; + public static Client2 getInstance() { + if (instance == null) { + instance = new Client2(); + } + return instance; + } + } + + + public static class ClientMap extends FrozenMap<@Nullable Object> { + protected ClientMap(FrozenMap<@Nullable Object> m) { + super(m); + } + public static final Set requiredKeys = Set.of(); + public static final Set optionalKeys = Set.of( + "client" + ); + public static ClientMap of(Map arg, SchemaConfiguration configuration) throws ValidationException { + return Client1.getInstance().validate(arg, configuration); + } + + public String client() throws UnsetPropertyException { + String key = "client"; + throwIfKeyNotPresent(key); + @Nullable Object value = get(key); + if (!(value instanceof String)) { + throw new RuntimeException("Invalid value stored for client"); + } + return (String) value; + } + + public @Nullable Object getAdditionalProperty(String name) throws UnsetPropertyException, InvalidAdditionalPropertyException { + throwIfKeyKnown(name, requiredKeys, optionalKeys); + throwIfKeyNotPresent(name); + return get(name); + } + } + + public interface SetterForClient2 { + Map getInstance(); + T getBuilderAfterClient2(Map instance); + + default T client(String value) { + var instance = getInstance(); + instance.put("client", value); + return getBuilderAfterClient2(instance); + } + } + + public static class ClientMapBuilder1 extends UnsetAddPropsSetter implements GenericBuilder>, SetterForClient2 { + private final Map instance; + private static final Set knownKeys = Set.of( + "client" + ); + public Set getKnownKeys() { + return knownKeys; + } + public ClientMapBuilder1() { + this.instance = new LinkedHashMap<>(); + } + public Map build() { + return instance; + } + public Map getInstance() { + return instance; + } + public ClientMapBuilder1 getBuilderAfterClient2(Map instance) { + return this; + } + public ClientMapBuilder1 getBuilderAfterAdditionalProperty(Map instance) { + return this; + } + } + + + public sealed interface Client1Boxed permits Client1BoxedMap { + @Nullable Object getData(); + } + + public record Client1BoxedMap(ClientMap data) implements Client1Boxed { + @Override + public @Nullable Object getData() { + return data; + } + } + + + public static class Client1 extends JsonSchema implements MapSchemaValidator { + /* + NOTE: This class is auto generated by OpenAPI JSON Schema Generator. + Ref: https://github.com/openapi-json-schema-tools/openapi-json-schema-generator + + Do not edit the class manually. + */ + private static @Nullable Client1 instance = null; + + protected Client1() { + super(new JsonSchemaInfo() + .type(Set.of(Map.class)) + .properties(Map.ofEntries( + new PropertyEntry("client", Client2.class) + )) + ); + } + + public static Client1 getInstance() { + if (instance == null) { + instance = new Client1(); + } + return instance; + } + + 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 RuntimeException("Invalid non-string key value"); + } + String propertyName = (String) entryKey; + List propertyPathToItem = new ArrayList<>(pathToItem); + propertyPathToItem.add(propertyName); + Object value = entry.getValue(); + LinkedHashMap, Nothing?> schemas = pathToSchemas.get(propertyPathToItem); + if (schemas == null) { + throw new RuntimeException("Validation result is invalid, schemas must exist for a pathToItem"); + } + JsonSchema propertySchema = schemas.entrySet().iterator().next().getKey(); + @Nullable Object propertyInstance = propertySchema.getNewInstance(value, propertyPathToItem, pathToSchemas); + properties.put(propertyName, propertyInstance); + } + FrozenMap<@Nullable Object> castProperties = new FrozenMap<>(properties); + return new ClientMap(castProperties); + } + + 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); + SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().build())); + ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, new PathToSchemasMap(), new LinkedHashSet<>()); + PathToSchemasMap pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet); + return getNewInstance(castArg, validationMetadata.pathToItem(), pathToSchemasMap); + } + + + @Override + public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws 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"); + } + @Override + public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { + if (arg instanceof Map) { + return getNewInstance((Map) arg, pathToItem, pathToSchemas); + } + 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 { + return new Client1BoxedMap(validate(arg, configuration)); + } + @Override + public Client1Boxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { + 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"); + } + } + +} diff --git a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/schemas/ComplexQuadrilateral.kt b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/schemas/ComplexQuadrilateral.kt new file mode 100644 index 00000000000..e6a458be9c3 --- /dev/null +++ b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/schemas/ComplexQuadrilateral.kt @@ -0,0 +1,589 @@ +package org.openapijsonschematools.client.components.schemas; +import java.time.LocalDate; +import java.time.ZonedDateTime; +import java.util.ArrayList; +import java.util.HashSet; +import java.util.LinkedHashMap; +import java.util.LinkedHashSet; +import java.util.List; +import java.util.Map; +import java.util.Objects; +import java.util.Set; +import java.util.UUID; +import org.checkerframework.checker.nullness.qual.Nullable; +import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags; +import org.openapijsonschematools.client.configurations.SchemaConfiguration; +import org.openapijsonschematools.client.exceptions.InvalidAdditionalPropertyException; +import org.openapijsonschematools.client.exceptions.UnsetPropertyException; +import org.openapijsonschematools.client.exceptions.ValidationException; +import org.openapijsonschematools.client.schemas.GenericBuilder; +import org.openapijsonschematools.client.schemas.SetMaker; +import org.openapijsonschematools.client.schemas.UnsetAddPropsSetter; +import org.openapijsonschematools.client.schemas.validation.BooleanSchemaValidator; +import org.openapijsonschematools.client.schemas.validation.FrozenList; +import org.openapijsonschematools.client.schemas.validation.FrozenMap; +import org.openapijsonschematools.client.schemas.validation.JsonSchema; +import org.openapijsonschematools.client.schemas.validation.JsonSchemaInfo; +import org.openapijsonschematools.client.schemas.validation.ListSchemaValidator; +import org.openapijsonschematools.client.schemas.validation.MapSchemaValidator; +import org.openapijsonschematools.client.schemas.validation.NullSchemaValidator; +import org.openapijsonschematools.client.schemas.validation.NumberSchemaValidator; +import org.openapijsonschematools.client.schemas.validation.PathToSchemasMap; +import org.openapijsonschematools.client.schemas.validation.PropertyEntry; +import org.openapijsonschematools.client.schemas.validation.StringEnumValidator; +import org.openapijsonschematools.client.schemas.validation.StringSchemaValidator; +import org.openapijsonschematools.client.schemas.validation.StringValueMethod; +import org.openapijsonschematools.client.schemas.validation.ValidationMetadata; + +public class ComplexQuadrilateral { + // nest classes so all schemas and input/output classes can be public + + public enum StringQuadrilateralTypeEnums implements StringValueMethod { + COMPLEX_QUADRILATERAL("ComplexQuadrilateral"); + private final String value; + + StringQuadrilateralTypeEnums(String value) { + this.value = value; + } + public String value() { + return this.value; + } + } + + + public sealed interface QuadrilateralTypeBoxed permits QuadrilateralTypeBoxedString { + @Nullable Object getData(); + } + + public record QuadrilateralTypeBoxedString(String data) implements QuadrilateralTypeBoxed { + @Override + public @Nullable Object getData() { + return data; + } + } + + + + public static class QuadrilateralType extends JsonSchema implements StringSchemaValidator, StringEnumValidator { + private static @Nullable QuadrilateralType instance = null; + + protected QuadrilateralType() { + super(new JsonSchemaInfo() + .type(Set.of( + String.class + )) + .enumValues(SetMaker.makeSet( + "ComplexQuadrilateral" + )) + ); + } + + public static QuadrilateralType getInstance() { + if (instance == null) { + instance = new QuadrilateralType(); + } + return instance; + } + + @Override + public String validate(String arg, SchemaConfiguration configuration) throws ValidationException { + Set> pathSet = new HashSet<>(); + List pathToItem = List.of("args[0"); + String castArg = castToAllowedTypes(arg, pathToItem, pathSet); + SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().build())); + ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, new PathToSchemasMap(), new LinkedHashSet<>()); + getPathToSchemas(this, castArg, validationMetadata, pathSet); + return castArg; + } + + @Override + 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 { + 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"); + } + @Override + public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { + 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"); + } + @Override + 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 { + 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"); + } + } + + public static class Schema1Map extends FrozenMap<@Nullable Object> { + protected Schema1Map(FrozenMap<@Nullable Object> m) { + super(m); + } + public static final Set requiredKeys = Set.of(); + public static final Set optionalKeys = Set.of( + "quadrilateralType" + ); + public static Schema1Map of(Map arg, SchemaConfiguration configuration) throws ValidationException { + return Schema1.getInstance().validate(arg, configuration); + } + + public String quadrilateralType() throws UnsetPropertyException { + String key = "quadrilateralType"; + throwIfKeyNotPresent(key); + @Nullable Object value = get(key); + if (!(value instanceof String)) { + throw new RuntimeException("Invalid value stored for quadrilateralType"); + } + return (String) value; + } + + public @Nullable Object getAdditionalProperty(String name) throws UnsetPropertyException, InvalidAdditionalPropertyException { + throwIfKeyKnown(name, requiredKeys, optionalKeys); + throwIfKeyNotPresent(name); + return get(name); + } + } + + public interface SetterForQuadrilateralType { + Map getInstance(); + T getBuilderAfterQuadrilateralType(Map instance); + + default T quadrilateralType(String value) { + var instance = getInstance(); + instance.put("quadrilateralType", value); + return getBuilderAfterQuadrilateralType(instance); + } + + default T quadrilateralType(StringQuadrilateralTypeEnums value) { + var instance = getInstance(); + instance.put("quadrilateralType", value.value()); + return getBuilderAfterQuadrilateralType(instance); + } + } + + public static class Schema1MapBuilder extends UnsetAddPropsSetter implements GenericBuilder>, SetterForQuadrilateralType { + private final Map instance; + private static final Set knownKeys = Set.of( + "quadrilateralType" + ); + public Set getKnownKeys() { + return knownKeys; + } + public Schema1MapBuilder() { + this.instance = new LinkedHashMap<>(); + } + public Map build() { + return instance; + } + public Map getInstance() { + return instance; + } + public Schema1MapBuilder getBuilderAfterQuadrilateralType(Map instance) { + return this; + } + public Schema1MapBuilder getBuilderAfterAdditionalProperty(Map instance) { + return this; + } + } + + + public sealed interface Schema1Boxed permits Schema1BoxedMap { + @Nullable Object getData(); + } + + public record Schema1BoxedMap(Schema1Map data) implements Schema1Boxed { + @Override + public @Nullable Object getData() { + return data; + } + } + + + public static class Schema1 extends JsonSchema implements MapSchemaValidator { + private static @Nullable Schema1 instance = null; + + protected Schema1() { + super(new JsonSchemaInfo() + .type(Set.of(Map.class)) + .properties(Map.ofEntries( + new PropertyEntry("quadrilateralType", QuadrilateralType.class) + )) + ); + } + + public static Schema1 getInstance() { + if (instance == null) { + instance = new Schema1(); + } + return instance; + } + + 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 RuntimeException("Invalid non-string key value"); + } + String propertyName = (String) entryKey; + List propertyPathToItem = new ArrayList<>(pathToItem); + propertyPathToItem.add(propertyName); + Object value = entry.getValue(); + LinkedHashMap, Nothing?> schemas = pathToSchemas.get(propertyPathToItem); + if (schemas == null) { + throw new RuntimeException("Validation result is invalid, schemas must exist for a pathToItem"); + } + JsonSchema propertySchema = schemas.entrySet().iterator().next().getKey(); + @Nullable Object propertyInstance = propertySchema.getNewInstance(value, propertyPathToItem, pathToSchemas); + properties.put(propertyName, propertyInstance); + } + FrozenMap<@Nullable Object> castProperties = new FrozenMap<>(properties); + return new Schema1Map(castProperties); + } + + 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); + SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().build())); + ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, new PathToSchemasMap(), new LinkedHashSet<>()); + PathToSchemasMap pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet); + return getNewInstance(castArg, validationMetadata.pathToItem(), pathToSchemasMap); + } + + + @Override + public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws 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"); + } + @Override + public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { + if (arg instanceof Map) { + return getNewInstance((Map) arg, pathToItem, pathToSchemas); + } + 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 { + return new Schema1BoxedMap(validate(arg, configuration)); + } + @Override + public Schema1Boxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { + 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"); + } + } + + + public sealed interface ComplexQuadrilateral1Boxed permits ComplexQuadrilateral1BoxedVoid, ComplexQuadrilateral1BoxedBoolean, ComplexQuadrilateral1BoxedNumber, ComplexQuadrilateral1BoxedString, ComplexQuadrilateral1BoxedList, ComplexQuadrilateral1BoxedMap { + @Nullable Object getData(); + } + + public record ComplexQuadrilateral1BoxedVoid(Nothing? data) implements ComplexQuadrilateral1Boxed { + @Override + public @Nullable Object getData() { + return data; + } + } + + public record ComplexQuadrilateral1BoxedBoolean(boolean data) implements ComplexQuadrilateral1Boxed { + @Override + public @Nullable Object getData() { + return data; + } + } + + public record ComplexQuadrilateral1BoxedNumber(Number data) implements ComplexQuadrilateral1Boxed { + @Override + public @Nullable Object getData() { + return data; + } + } + + public record ComplexQuadrilateral1BoxedString(String data) implements ComplexQuadrilateral1Boxed { + @Override + public @Nullable Object getData() { + return data; + } + } + + public record ComplexQuadrilateral1BoxedList(FrozenList<@Nullable Object> data) implements ComplexQuadrilateral1Boxed { + @Override + public @Nullable Object getData() { + return data; + } + } + + public record ComplexQuadrilateral1BoxedMap(FrozenMap<@Nullable Object> data) implements ComplexQuadrilateral1Boxed { + @Override + public @Nullable Object getData() { + return data; + } + } + + + public static class ComplexQuadrilateral1 extends JsonSchema implements NullSchemaValidator, BooleanSchemaValidator, NumberSchemaValidator, StringSchemaValidator, ListSchemaValidator, ComplexQuadrilateral1BoxedList>, MapSchemaValidator, ComplexQuadrilateral1BoxedMap> { + /* + NOTE: This class is auto generated by OpenAPI JSON Schema Generator. + Ref: https://github.com/openapi-json-schema-tools/openapi-json-schema-generator + + Do not edit the class manually. + */ + private static @Nullable ComplexQuadrilateral1 instance = null; + + protected ComplexQuadrilateral1() { + super(new JsonSchemaInfo() + .allOf(List.of( + QuadrilateralInterface.QuadrilateralInterface1.class, + Schema1.class + )) + ); + } + + public static ComplexQuadrilateral1 getInstance() { + if (instance == null) { + instance = new ComplexQuadrilateral1(); + } + return instance; + } + + @Override + public Nothing? validate(Nothing? arg, SchemaConfiguration configuration) throws ValidationException { + Set> pathSet = new HashSet<>(); + List pathToItem = List.of("args[0]"); + Nothing? castArg = castToAllowedTypes(arg, pathToItem, pathSet); + SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().build())); + PathToSchemasMap validatedPathToSchemas = new PathToSchemasMap(); + ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, new LinkedHashSet<>()); + getPathToSchemas(this, castArg, validationMetadata, pathSet); + return castArg; + } + + @Override + public boolean validate(boolean arg, SchemaConfiguration configuration) throws ValidationException { + Set> pathSet = new HashSet<>(); + List pathToItem = List.of("args[0]"); + boolean castArg = castToAllowedTypes(arg, pathToItem, pathSet); + SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().build())); + PathToSchemasMap validatedPathToSchemas = new PathToSchemasMap(); + ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, new LinkedHashSet<>()); + getPathToSchemas(this, castArg, validationMetadata, pathSet); + return castArg; + } + + @Override + public Number validate(Number arg, SchemaConfiguration configuration) throws ValidationException { + Set> pathSet = new HashSet<>(); + List pathToItem = List.of("args[0]"); + Number castArg = castToAllowedTypes(arg, pathToItem, pathSet); + SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().build())); + PathToSchemasMap validatedPathToSchemas = new PathToSchemasMap(); + ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, new LinkedHashSet<>()); + getPathToSchemas(this, castArg, validationMetadata, pathSet); + return castArg; + } + + public int validate(int arg, SchemaConfiguration configuration) throws ValidationException { + return (int) validate((Number) arg, configuration); + } + + public long validate(long arg, SchemaConfiguration configuration) throws ValidationException { + return (long) validate((Number) arg, configuration); + } + + public float validate(float arg, SchemaConfiguration configuration) throws ValidationException { + return (float) validate((Number) arg, configuration); + } + + public double validate(double arg, SchemaConfiguration configuration) throws ValidationException { + return (double) validate((Number) arg, configuration); + } + + @Override + public String validate(String arg, SchemaConfiguration configuration) throws ValidationException { + Set> pathSet = new HashSet<>(); + List pathToItem = List.of("args[0]"); + String castArg = castToAllowedTypes(arg, pathToItem, pathSet); + SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().build())); + PathToSchemasMap validatedPathToSchemas = new PathToSchemasMap(); + ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, new LinkedHashSet<>()); + getPathToSchemas(this, castArg, validationMetadata, pathSet); + return castArg; + } + + public String validate(LocalDate arg, SchemaConfiguration configuration) throws ValidationException { + return validate(arg.toString(), configuration); + } + + public String validate(ZonedDateTime arg, SchemaConfiguration configuration) throws ValidationException { + return validate(arg.toString(), configuration); + } + + public String validate(UUID arg, SchemaConfiguration configuration) throws ValidationException { + return validate(arg.toString(), configuration); + } + + @Override + public FrozenList<@Nullable Object> getNewInstance(List arg, List pathToItem, PathToSchemasMap pathToSchemas) { + List<@Nullable Object> items = new ArrayList<>(); + int i = 0; + for (Object item: arg) { + List itemPathToItem = new ArrayList<>(pathToItem); + itemPathToItem.add(i); + LinkedHashMap, Nothing?> schemas = pathToSchemas.get(itemPathToItem); + if (schemas == null) { + throw new RuntimeException("Validation result is invalid, schemas must exist for a pathToItem"); + } + JsonSchema itemSchema = schemas.entrySet().iterator().next().getKey(); + @Nullable Object itemInstance = itemSchema.getNewInstance(item, itemPathToItem, pathToSchemas); + items.add(itemInstance); + i += 1; + } + FrozenList<@Nullable Object> newInstanceItems = new FrozenList<>(items); + return newInstanceItems; + } + + 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); + SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().build())); + ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, new PathToSchemasMap(), new LinkedHashSet<>()); + PathToSchemasMap pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet); + return getNewInstance(castArg, validationMetadata.pathToItem(), pathToSchemasMap); + } + + @Override + 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 RuntimeException("Invalid non-string key value"); + } + String propertyName = (String) entryKey; + List propertyPathToItem = new ArrayList<>(pathToItem); + propertyPathToItem.add(propertyName); + Object value = entry.getValue(); + LinkedHashMap, Nothing?> schemas = pathToSchemas.get(propertyPathToItem); + if (schemas == null) { + throw new RuntimeException("Validation result is invalid, schemas must exist for a pathToItem"); + } + JsonSchema propertySchema = schemas.entrySet().iterator().next().getKey(); + @Nullable Object propertyInstance = propertySchema.getNewInstance(value, propertyPathToItem, pathToSchemas); + properties.put(propertyName, propertyInstance); + } + FrozenMap<@Nullable Object> castProperties = new FrozenMap<>(properties); + return castProperties; + } + + public FrozenMap<@Nullable Object> validate(Map arg, SchemaConfiguration configuration) throws ValidationException { + Set> pathSet = new HashSet<>(); + List pathToItem = List.of("args[0]"); + Map castArg = castToAllowedTypes(arg, pathToItem, pathSet); + SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().build())); + PathToSchemasMap validatedPathToSchemas = new PathToSchemasMap(); + ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, new LinkedHashSet<>()); + PathToSchemasMap pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet); + return getNewInstance(castArg, validationMetadata.pathToItem(), pathToSchemasMap); + } + + @Override + public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { + if (arg == null) { + return validate((Nothing?) null, configuration); + } else if (arg instanceof Boolean) { + boolean boolArg = (Boolean) arg; + return validate(boolArg, configuration); + } else if (arg instanceof Number) { + return validate((Number) arg, configuration); + } else if (arg instanceof String) { + return validate((String) arg, configuration); + } else if (arg instanceof List) { + return validate((List) arg, 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"); + } + @Override + public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { + if (arg == null) { + return getNewInstance((Nothing?) null, pathToItem, pathToSchemas); + } else if (arg instanceof Boolean) { + boolean boolArg = (Boolean) arg; + return getNewInstance(boolArg, pathToItem, pathToSchemas); + } else if (arg instanceof Number) { + return getNewInstance((Number) arg, pathToItem, pathToSchemas); + } else if (arg instanceof String) { + return getNewInstance((String) arg, pathToItem, pathToSchemas); + } else if (arg instanceof List) { + return getNewInstance((List) arg, 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"); + } + @Override + public ComplexQuadrilateral1BoxedVoid validateAndBox(Nothing? arg, SchemaConfiguration configuration) throws ValidationException { + return new ComplexQuadrilateral1BoxedVoid(validate(arg, configuration)); + } + @Override + 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 { + return new ComplexQuadrilateral1BoxedNumber(validate(arg, configuration)); + } + @Override + 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 { + return new ComplexQuadrilateral1BoxedList(validate(arg, configuration)); + } + @Override + 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 { + if (arg == null) { + Nothing? castArg = (Nothing?) arg; + return validateAndBox(castArg, configuration); + } else if (arg instanceof Boolean booleanArg) { + boolean castArg = booleanArg; + return validateAndBox(castArg, configuration); + } else if (arg instanceof String castArg) { + return validateAndBox(castArg, configuration); + } else if (arg instanceof Number castArg) { + return validateAndBox(castArg, configuration); + } else if (arg instanceof List castArg) { + 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"); + } + } +} diff --git a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/schemas/ComposedAnyOfDifferentTypesNoValidations.kt b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/schemas/ComposedAnyOfDifferentTypesNoValidations.kt new file mode 100644 index 00000000000..fe0fbfb318f --- /dev/null +++ b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/schemas/ComposedAnyOfDifferentTypesNoValidations.kt @@ -0,0 +1,693 @@ +package org.openapijsonschematools.client.components.schemas; +import java.time.LocalDate; +import java.time.ZonedDateTime; +import java.util.ArrayList; +import java.util.HashSet; +import java.util.LinkedHashMap; +import java.util.LinkedHashSet; +import java.util.List; +import java.util.Map; +import java.util.Objects; +import java.util.Set; +import java.util.UUID; +import org.checkerframework.checker.nullness.qual.Nullable; +import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags; +import org.openapijsonschematools.client.configurations.SchemaConfiguration; +import org.openapijsonschematools.client.exceptions.InvalidAdditionalPropertyException; +import org.openapijsonschematools.client.exceptions.UnsetPropertyException; +import org.openapijsonschematools.client.exceptions.ValidationException; +import org.openapijsonschematools.client.schemas.AnyTypeJsonSchema; +import org.openapijsonschematools.client.schemas.BooleanJsonSchema; +import org.openapijsonschematools.client.schemas.DateJsonSchema; +import org.openapijsonschematools.client.schemas.DateTimeJsonSchema; +import org.openapijsonschematools.client.schemas.DoubleJsonSchema; +import org.openapijsonschematools.client.schemas.FloatJsonSchema; +import org.openapijsonschematools.client.schemas.Int32JsonSchema; +import org.openapijsonschematools.client.schemas.Int64JsonSchema; +import org.openapijsonschematools.client.schemas.IntJsonSchema; +import org.openapijsonschematools.client.schemas.MapJsonSchema; +import org.openapijsonschematools.client.schemas.NullJsonSchema; +import org.openapijsonschematools.client.schemas.NumberJsonSchema; +import org.openapijsonschematools.client.schemas.StringJsonSchema; +import org.openapijsonschematools.client.schemas.UnsetAddPropsSetter; +import org.openapijsonschematools.client.schemas.validation.BooleanSchemaValidator; +import org.openapijsonschematools.client.schemas.validation.FrozenList; +import org.openapijsonschematools.client.schemas.validation.FrozenMap; +import org.openapijsonschematools.client.schemas.validation.JsonSchema; +import org.openapijsonschematools.client.schemas.validation.JsonSchemaInfo; +import org.openapijsonschematools.client.schemas.validation.ListSchemaValidator; +import org.openapijsonschematools.client.schemas.validation.MapSchemaValidator; +import org.openapijsonschematools.client.schemas.validation.NullSchemaValidator; +import org.openapijsonschematools.client.schemas.validation.NumberSchemaValidator; +import org.openapijsonschematools.client.schemas.validation.PathToSchemasMap; +import org.openapijsonschematools.client.schemas.validation.StringSchemaValidator; +import org.openapijsonschematools.client.schemas.validation.ValidationMetadata; + +public class ComposedAnyOfDifferentTypesNoValidations { + // nest classes so all schemas and input/output classes can be public + + + public static class Schema0 extends MapJsonSchema.MapJsonSchema1 { + private static @Nullable Schema0 instance = null; + public static Schema0 getInstance() { + if (instance == null) { + instance = new Schema0(); + } + return instance; + } + } + + + public static class Schema1 extends DateJsonSchema.DateJsonSchema1 { + private static @Nullable Schema1 instance = null; + public static Schema1 getInstance() { + if (instance == null) { + instance = new Schema1(); + } + return instance; + } + } + + + public static class Schema2 extends DateTimeJsonSchema.DateTimeJsonSchema1 { + private static @Nullable Schema2 instance = null; + public static Schema2 getInstance() { + if (instance == null) { + instance = new Schema2(); + } + return instance; + } + } + + + public static class Schema3 extends StringJsonSchema.StringJsonSchema1 { + // BinarySchema + private static @Nullable Schema3 instance = null; + public static Schema3 getInstance() { + if (instance == null) { + instance = new Schema3(); + } + return instance; + } + } + + + public static class Schema4 extends StringJsonSchema.StringJsonSchema1 { + private static @Nullable Schema4 instance = null; + public static Schema4 getInstance() { + if (instance == null) { + instance = new Schema4(); + } + return instance; + } + } + + + public static class Schema5 extends StringJsonSchema.StringJsonSchema1 { + private static @Nullable Schema5 instance = null; + public static Schema5 getInstance() { + if (instance == null) { + instance = new Schema5(); + } + return instance; + } + } + + + public static class Schema6 extends MapJsonSchema.MapJsonSchema1 { + private static @Nullable Schema6 instance = null; + public static Schema6 getInstance() { + if (instance == null) { + instance = new Schema6(); + } + return instance; + } + } + + + public static class Schema7 extends BooleanJsonSchema.BooleanJsonSchema1 { + private static @Nullable Schema7 instance = null; + public static Schema7 getInstance() { + if (instance == null) { + instance = new Schema7(); + } + return instance; + } + } + + + public static class Schema8 extends NullJsonSchema.NullJsonSchema1 { + private static @Nullable Schema8 instance = null; + public static Schema8 getInstance() { + if (instance == null) { + instance = new Schema8(); + } + return instance; + } + } + + + public static class Items extends AnyTypeJsonSchema.AnyTypeJsonSchema1 { + private static @Nullable Items instance = null; + public static Items getInstance() { + if (instance == null) { + instance = new Items(); + } + return instance; + } + } + + + 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 { + return Schema9.getInstance().validate(arg, configuration); + } + } + + public static class Schema9ListBuilder { + // class to build List<@Nullable Object> + private final List<@Nullable Object> list; + + public Schema9ListBuilder() { + list = new ArrayList<>(); + } + + public Schema9ListBuilder(List<@Nullable Object> list) { + this.list = list; + } + + public Schema9ListBuilder add(Nothing? item) { + list.add(null); + return this; + } + + public Schema9ListBuilder add(boolean item) { + list.add(item); + return this; + } + + public Schema9ListBuilder add(String item) { + list.add(item); + return this; + } + + public Schema9ListBuilder add(int item) { + list.add(item); + return this; + } + + public Schema9ListBuilder add(float item) { + list.add(item); + return this; + } + + public Schema9ListBuilder add(long item) { + list.add(item); + return this; + } + + public Schema9ListBuilder add(double item) { + list.add(item); + return this; + } + + public Schema9ListBuilder add(List item) { + list.add(item); + return this; + } + + public Schema9ListBuilder add(Map item) { + list.add(item); + return this; + } + + public List<@Nullable Object> build() { + return list; + } + } + + + public sealed interface Schema9Boxed permits Schema9BoxedList { + @Nullable Object getData(); + } + + public record Schema9BoxedList(Schema9List data) implements Schema9Boxed { + @Override + public @Nullable Object getData() { + return data; + } + } + + + + public static class Schema9 extends JsonSchema implements ListSchemaValidator { + private static @Nullable Schema9 instance = null; + + protected Schema9() { + super(new JsonSchemaInfo() + .type(Set.of(List.class)) + .items(Items.class) + ); + } + + public static Schema9 getInstance() { + if (instance == null) { + instance = new Schema9(); + } + return instance; + } + + @Override + public Schema9List getNewInstance(List arg, List pathToItem, PathToSchemasMap pathToSchemas) { + List<@Nullable Object> items = new ArrayList<>(); + int i = 0; + for (Object item: arg) { + List itemPathToItem = new ArrayList<>(pathToItem); + itemPathToItem.add(i); + LinkedHashMap, Nothing?> schemas = pathToSchemas.get(itemPathToItem); + if (schemas == null) { + throw new RuntimeException("Validation result is invalid, schemas must exist for a pathToItem"); + } + JsonSchema itemSchema = schemas.entrySet().iterator().next().getKey(); + @Nullable Object itemInstance = itemSchema.getNewInstance(item, itemPathToItem, pathToSchemas); + items.add(itemInstance); + i += 1; + } + FrozenList<@Nullable Object> newInstanceItems = new FrozenList<>(items); + return new Schema9List(newInstanceItems); + } + + 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); + SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().build())); + ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, new PathToSchemasMap(), new LinkedHashSet<>()); + PathToSchemasMap pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet); + return getNewInstance(castArg, validationMetadata.pathToItem(), pathToSchemasMap); + } + + @Override + public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws 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"); + } + @Override + public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { + 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"); + } + @Override + 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 { + 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"); + } + } + + public static class Schema10 extends NumberJsonSchema.NumberJsonSchema1 { + private static @Nullable Schema10 instance = null; + public static Schema10 getInstance() { + if (instance == null) { + instance = new Schema10(); + } + return instance; + } + } + + + public static class Schema11 extends FloatJsonSchema.FloatJsonSchema1 { + private static @Nullable Schema11 instance = null; + public static Schema11 getInstance() { + if (instance == null) { + instance = new Schema11(); + } + return instance; + } + } + + + public static class Schema12 extends DoubleJsonSchema.DoubleJsonSchema1 { + private static @Nullable Schema12 instance = null; + public static Schema12 getInstance() { + if (instance == null) { + instance = new Schema12(); + } + return instance; + } + } + + + public static class Schema13 extends IntJsonSchema.IntJsonSchema1 { + private static @Nullable Schema13 instance = null; + public static Schema13 getInstance() { + if (instance == null) { + instance = new Schema13(); + } + return instance; + } + } + + + public static class Schema14 extends Int32JsonSchema.Int32JsonSchema1 { + private static @Nullable Schema14 instance = null; + public static Schema14 getInstance() { + if (instance == null) { + instance = new Schema14(); + } + return instance; + } + } + + + public static class Schema15 extends Int64JsonSchema.Int64JsonSchema1 { + private static @Nullable Schema15 instance = null; + public static Schema15 getInstance() { + if (instance == null) { + instance = new Schema15(); + } + return instance; + } + } + + + public sealed interface ComposedAnyOfDifferentTypesNoValidations1Boxed permits ComposedAnyOfDifferentTypesNoValidations1BoxedVoid, ComposedAnyOfDifferentTypesNoValidations1BoxedBoolean, ComposedAnyOfDifferentTypesNoValidations1BoxedNumber, ComposedAnyOfDifferentTypesNoValidations1BoxedString, ComposedAnyOfDifferentTypesNoValidations1BoxedList, ComposedAnyOfDifferentTypesNoValidations1BoxedMap { + @Nullable Object getData(); + } + + public record ComposedAnyOfDifferentTypesNoValidations1BoxedVoid(Nothing? data) implements ComposedAnyOfDifferentTypesNoValidations1Boxed { + @Override + public @Nullable Object getData() { + return data; + } + } + + public record ComposedAnyOfDifferentTypesNoValidations1BoxedBoolean(boolean data) implements ComposedAnyOfDifferentTypesNoValidations1Boxed { + @Override + public @Nullable Object getData() { + return data; + } + } + + public record ComposedAnyOfDifferentTypesNoValidations1BoxedNumber(Number data) implements ComposedAnyOfDifferentTypesNoValidations1Boxed { + @Override + public @Nullable Object getData() { + return data; + } + } + + public record ComposedAnyOfDifferentTypesNoValidations1BoxedString(String data) implements ComposedAnyOfDifferentTypesNoValidations1Boxed { + @Override + public @Nullable Object getData() { + return data; + } + } + + public record ComposedAnyOfDifferentTypesNoValidations1BoxedList(FrozenList<@Nullable Object> data) implements ComposedAnyOfDifferentTypesNoValidations1Boxed { + @Override + public @Nullable Object getData() { + return data; + } + } + + public record ComposedAnyOfDifferentTypesNoValidations1BoxedMap(FrozenMap<@Nullable Object> data) implements ComposedAnyOfDifferentTypesNoValidations1Boxed { + @Override + public @Nullable Object getData() { + return data; + } + } + + + public static class ComposedAnyOfDifferentTypesNoValidations1 extends JsonSchema implements NullSchemaValidator, BooleanSchemaValidator, NumberSchemaValidator, StringSchemaValidator, ListSchemaValidator, ComposedAnyOfDifferentTypesNoValidations1BoxedList>, MapSchemaValidator, ComposedAnyOfDifferentTypesNoValidations1BoxedMap> { + /* + NOTE: This class is auto generated by OpenAPI JSON Schema Generator. + Ref: https://github.com/openapi-json-schema-tools/openapi-json-schema-generator + + Do not edit the class manually. + */ + private static @Nullable ComposedAnyOfDifferentTypesNoValidations1 instance = null; + + protected ComposedAnyOfDifferentTypesNoValidations1() { + super(new JsonSchemaInfo() + .anyOf(List.of( + Schema0.class, + Schema1.class, + Schema2.class, + Schema3.class, + Schema4.class, + Schema5.class, + Schema6.class, + Schema7.class, + Schema8.class, + Schema9.class, + Schema10.class, + Schema11.class, + Schema12.class, + Schema13.class, + Schema14.class, + Schema15.class + )) + ); + } + + public static ComposedAnyOfDifferentTypesNoValidations1 getInstance() { + if (instance == null) { + instance = new ComposedAnyOfDifferentTypesNoValidations1(); + } + return instance; + } + + @Override + public Nothing? validate(Nothing? arg, SchemaConfiguration configuration) throws ValidationException { + Set> pathSet = new HashSet<>(); + List pathToItem = List.of("args[0]"); + Nothing? castArg = castToAllowedTypes(arg, pathToItem, pathSet); + SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().build())); + PathToSchemasMap validatedPathToSchemas = new PathToSchemasMap(); + ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, new LinkedHashSet<>()); + getPathToSchemas(this, castArg, validationMetadata, pathSet); + return castArg; + } + + @Override + public boolean validate(boolean arg, SchemaConfiguration configuration) throws ValidationException { + Set> pathSet = new HashSet<>(); + List pathToItem = List.of("args[0]"); + boolean castArg = castToAllowedTypes(arg, pathToItem, pathSet); + SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().build())); + PathToSchemasMap validatedPathToSchemas = new PathToSchemasMap(); + ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, new LinkedHashSet<>()); + getPathToSchemas(this, castArg, validationMetadata, pathSet); + return castArg; + } + + @Override + public Number validate(Number arg, SchemaConfiguration configuration) throws ValidationException { + Set> pathSet = new HashSet<>(); + List pathToItem = List.of("args[0]"); + Number castArg = castToAllowedTypes(arg, pathToItem, pathSet); + SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().build())); + PathToSchemasMap validatedPathToSchemas = new PathToSchemasMap(); + ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, new LinkedHashSet<>()); + getPathToSchemas(this, castArg, validationMetadata, pathSet); + return castArg; + } + + public int validate(int arg, SchemaConfiguration configuration) throws ValidationException { + return (int) validate((Number) arg, configuration); + } + + public long validate(long arg, SchemaConfiguration configuration) throws ValidationException { + return (long) validate((Number) arg, configuration); + } + + public float validate(float arg, SchemaConfiguration configuration) throws ValidationException { + return (float) validate((Number) arg, configuration); + } + + public double validate(double arg, SchemaConfiguration configuration) throws ValidationException { + return (double) validate((Number) arg, configuration); + } + + @Override + public String validate(String arg, SchemaConfiguration configuration) throws ValidationException { + Set> pathSet = new HashSet<>(); + List pathToItem = List.of("args[0]"); + String castArg = castToAllowedTypes(arg, pathToItem, pathSet); + SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().build())); + PathToSchemasMap validatedPathToSchemas = new PathToSchemasMap(); + ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, new LinkedHashSet<>()); + getPathToSchemas(this, castArg, validationMetadata, pathSet); + return castArg; + } + + public String validate(LocalDate arg, SchemaConfiguration configuration) throws ValidationException { + return validate(arg.toString(), configuration); + } + + public String validate(ZonedDateTime arg, SchemaConfiguration configuration) throws ValidationException { + return validate(arg.toString(), configuration); + } + + public String validate(UUID arg, SchemaConfiguration configuration) throws ValidationException { + return validate(arg.toString(), configuration); + } + + @Override + public FrozenList<@Nullable Object> getNewInstance(List arg, List pathToItem, PathToSchemasMap pathToSchemas) { + List<@Nullable Object> items = new ArrayList<>(); + int i = 0; + for (Object item: arg) { + List itemPathToItem = new ArrayList<>(pathToItem); + itemPathToItem.add(i); + LinkedHashMap, Nothing?> schemas = pathToSchemas.get(itemPathToItem); + if (schemas == null) { + throw new RuntimeException("Validation result is invalid, schemas must exist for a pathToItem"); + } + JsonSchema itemSchema = schemas.entrySet().iterator().next().getKey(); + @Nullable Object itemInstance = itemSchema.getNewInstance(item, itemPathToItem, pathToSchemas); + items.add(itemInstance); + i += 1; + } + FrozenList<@Nullable Object> newInstanceItems = new FrozenList<>(items); + return newInstanceItems; + } + + 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); + SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().build())); + ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, new PathToSchemasMap(), new LinkedHashSet<>()); + PathToSchemasMap pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet); + return getNewInstance(castArg, validationMetadata.pathToItem(), pathToSchemasMap); + } + + @Override + 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 RuntimeException("Invalid non-string key value"); + } + String propertyName = (String) entryKey; + List propertyPathToItem = new ArrayList<>(pathToItem); + propertyPathToItem.add(propertyName); + Object value = entry.getValue(); + LinkedHashMap, Nothing?> schemas = pathToSchemas.get(propertyPathToItem); + if (schemas == null) { + throw new RuntimeException("Validation result is invalid, schemas must exist for a pathToItem"); + } + JsonSchema propertySchema = schemas.entrySet().iterator().next().getKey(); + @Nullable Object propertyInstance = propertySchema.getNewInstance(value, propertyPathToItem, pathToSchemas); + properties.put(propertyName, propertyInstance); + } + FrozenMap<@Nullable Object> castProperties = new FrozenMap<>(properties); + return castProperties; + } + + public FrozenMap<@Nullable Object> validate(Map arg, SchemaConfiguration configuration) throws ValidationException { + Set> pathSet = new HashSet<>(); + List pathToItem = List.of("args[0]"); + Map castArg = castToAllowedTypes(arg, pathToItem, pathSet); + SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().build())); + PathToSchemasMap validatedPathToSchemas = new PathToSchemasMap(); + ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, new LinkedHashSet<>()); + PathToSchemasMap pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet); + return getNewInstance(castArg, validationMetadata.pathToItem(), pathToSchemasMap); + } + + @Override + public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { + if (arg == null) { + return validate((Nothing?) null, configuration); + } else if (arg instanceof Boolean) { + boolean boolArg = (Boolean) arg; + return validate(boolArg, configuration); + } else if (arg instanceof Number) { + return validate((Number) arg, configuration); + } else if (arg instanceof String) { + return validate((String) arg, configuration); + } else if (arg instanceof List) { + return validate((List) arg, 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"); + } + @Override + public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { + if (arg == null) { + return getNewInstance((Nothing?) null, pathToItem, pathToSchemas); + } else if (arg instanceof Boolean) { + boolean boolArg = (Boolean) arg; + return getNewInstance(boolArg, pathToItem, pathToSchemas); + } else if (arg instanceof Number) { + return getNewInstance((Number) arg, pathToItem, pathToSchemas); + } else if (arg instanceof String) { + return getNewInstance((String) arg, pathToItem, pathToSchemas); + } else if (arg instanceof List) { + return getNewInstance((List) arg, 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"); + } + @Override + public ComposedAnyOfDifferentTypesNoValidations1BoxedVoid validateAndBox(Nothing? arg, SchemaConfiguration configuration) throws ValidationException { + return new ComposedAnyOfDifferentTypesNoValidations1BoxedVoid(validate(arg, configuration)); + } + @Override + 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 { + return new ComposedAnyOfDifferentTypesNoValidations1BoxedNumber(validate(arg, configuration)); + } + @Override + 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 { + return new ComposedAnyOfDifferentTypesNoValidations1BoxedList(validate(arg, configuration)); + } + @Override + 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 { + if (arg == null) { + Nothing? castArg = (Nothing?) arg; + return validateAndBox(castArg, configuration); + } else if (arg instanceof Boolean booleanArg) { + boolean castArg = booleanArg; + return validateAndBox(castArg, configuration); + } else if (arg instanceof String castArg) { + return validateAndBox(castArg, configuration); + } else if (arg instanceof Number castArg) { + return validateAndBox(castArg, configuration); + } else if (arg instanceof List castArg) { + 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"); + } + } +} diff --git a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/schemas/ComposedArray.kt b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/schemas/ComposedArray.kt new file mode 100644 index 00000000000..1bc378734b8 --- /dev/null +++ b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/schemas/ComposedArray.kt @@ -0,0 +1,201 @@ +package org.openapijsonschematools.client.components.schemas; +import java.util.ArrayList; +import java.util.HashSet; +import java.util.LinkedHashMap; +import java.util.LinkedHashSet; +import java.util.List; +import java.util.Map; +import java.util.Objects; +import java.util.Set; +import org.checkerframework.checker.nullness.qual.Nullable; +import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags; +import org.openapijsonschematools.client.configurations.SchemaConfiguration; +import org.openapijsonschematools.client.exceptions.ValidationException; +import org.openapijsonschematools.client.schemas.AnyTypeJsonSchema; +import org.openapijsonschematools.client.schemas.validation.FrozenList; +import org.openapijsonschematools.client.schemas.validation.JsonSchema; +import org.openapijsonschematools.client.schemas.validation.JsonSchemaInfo; +import org.openapijsonschematools.client.schemas.validation.ListSchemaValidator; +import org.openapijsonschematools.client.schemas.validation.PathToSchemasMap; +import org.openapijsonschematools.client.schemas.validation.ValidationMetadata; + +public class ComposedArray { + // nest classes so all schemas and input/output classes can be public + + + public static class Items extends AnyTypeJsonSchema.AnyTypeJsonSchema1 { + private static @Nullable Items instance = null; + public static Items getInstance() { + if (instance == null) { + instance = new Items(); + } + return instance; + } + } + + + 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 { + return ComposedArray1.getInstance().validate(arg, configuration); + } + } + + public static class ComposedArrayListBuilder { + // class to build List<@Nullable Object> + private final List<@Nullable Object> list; + + public ComposedArrayListBuilder() { + list = new ArrayList<>(); + } + + public ComposedArrayListBuilder(List<@Nullable Object> list) { + this.list = list; + } + + public ComposedArrayListBuilder add(Nothing? item) { + list.add(null); + return this; + } + + public ComposedArrayListBuilder add(boolean item) { + list.add(item); + return this; + } + + public ComposedArrayListBuilder add(String item) { + list.add(item); + return this; + } + + public ComposedArrayListBuilder add(int item) { + list.add(item); + return this; + } + + public ComposedArrayListBuilder add(float item) { + list.add(item); + return this; + } + + public ComposedArrayListBuilder add(long item) { + list.add(item); + return this; + } + + public ComposedArrayListBuilder add(double item) { + list.add(item); + return this; + } + + public ComposedArrayListBuilder add(List item) { + list.add(item); + return this; + } + + public ComposedArrayListBuilder add(Map item) { + list.add(item); + return this; + } + + public List<@Nullable Object> build() { + return list; + } + } + + + public sealed interface ComposedArray1Boxed permits ComposedArray1BoxedList { + @Nullable Object getData(); + } + + public record ComposedArray1BoxedList(ComposedArrayList data) implements ComposedArray1Boxed { + @Override + public @Nullable Object getData() { + return data; + } + } + + + + public static class ComposedArray1 extends JsonSchema implements ListSchemaValidator { + /* + NOTE: This class is auto generated by OpenAPI JSON Schema Generator. + Ref: https://github.com/openapi-json-schema-tools/openapi-json-schema-generator + + Do not edit the class manually. + */ + private static @Nullable ComposedArray1 instance = null; + + protected ComposedArray1() { + super(new JsonSchemaInfo() + .type(Set.of(List.class)) + .items(Items.class) + ); + } + + public static ComposedArray1 getInstance() { + if (instance == null) { + instance = new ComposedArray1(); + } + return instance; + } + + @Override + public ComposedArrayList getNewInstance(List arg, List pathToItem, PathToSchemasMap pathToSchemas) { + List<@Nullable Object> items = new ArrayList<>(); + int i = 0; + for (Object item: arg) { + List itemPathToItem = new ArrayList<>(pathToItem); + itemPathToItem.add(i); + LinkedHashMap, Nothing?> schemas = pathToSchemas.get(itemPathToItem); + if (schemas == null) { + throw new RuntimeException("Validation result is invalid, schemas must exist for a pathToItem"); + } + JsonSchema itemSchema = schemas.entrySet().iterator().next().getKey(); + @Nullable Object itemInstance = itemSchema.getNewInstance(item, itemPathToItem, pathToSchemas); + items.add(itemInstance); + i += 1; + } + FrozenList<@Nullable Object> newInstanceItems = new FrozenList<>(items); + return new ComposedArrayList(newInstanceItems); + } + + 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); + SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().build())); + ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, new PathToSchemasMap(), new LinkedHashSet<>()); + PathToSchemasMap pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet); + return getNewInstance(castArg, validationMetadata.pathToItem(), pathToSchemasMap); + } + + @Override + public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws 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"); + } + @Override + public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { + 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"); + } + @Override + 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 { + 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"); + } + } +} diff --git a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/schemas/ComposedBool.kt b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/schemas/ComposedBool.kt new file mode 100644 index 00000000000..6e3fc408ed7 --- /dev/null +++ b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/schemas/ComposedBool.kt @@ -0,0 +1,111 @@ +package org.openapijsonschematools.client.components.schemas; +import java.util.HashSet; +import java.util.LinkedHashSet; +import java.util.List; +import java.util.Objects; +import java.util.Set; +import org.checkerframework.checker.nullness.qual.Nullable; +import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags; +import org.openapijsonschematools.client.configurations.SchemaConfiguration; +import org.openapijsonschematools.client.exceptions.ValidationException; +import org.openapijsonschematools.client.schemas.AnyTypeJsonSchema; +import org.openapijsonschematools.client.schemas.validation.BooleanSchemaValidator; +import org.openapijsonschematools.client.schemas.validation.JsonSchema; +import org.openapijsonschematools.client.schemas.validation.JsonSchemaInfo; +import org.openapijsonschematools.client.schemas.validation.PathToSchemasMap; +import org.openapijsonschematools.client.schemas.validation.ValidationMetadata; + +public class ComposedBool { + // nest classes so all schemas and input/output classes can be public + + + public static class Schema0 extends AnyTypeJsonSchema.AnyTypeJsonSchema1 { + private static @Nullable Schema0 instance = null; + public static Schema0 getInstance() { + if (instance == null) { + instance = new Schema0(); + } + return instance; + } + } + + + public sealed interface ComposedBool1Boxed permits ComposedBool1BoxedBoolean { + @Nullable Object getData(); + } + + public record ComposedBool1BoxedBoolean(boolean data) implements ComposedBool1Boxed { + @Override + public @Nullable Object getData() { + return data; + } + } + + + + public static class ComposedBool1 extends JsonSchema implements BooleanSchemaValidator { + /* + NOTE: This class is auto generated by OpenAPI JSON Schema Generator. + Ref: https://github.com/openapi-json-schema-tools/openapi-json-schema-generator + + Do not edit the class manually. + */ + private static @Nullable ComposedBool1 instance = null; + + protected ComposedBool1() { + super(new JsonSchemaInfo() + .type(Set.of(Boolean.class)) + .allOf(List.of( + Schema0.class + )) + ); + } + + public static ComposedBool1 getInstance() { + if (instance == null) { + instance = new ComposedBool1(); + } + return instance; + } + + @Override + public boolean validate(boolean arg, SchemaConfiguration configuration) throws ValidationException { + Set> pathSet = new HashSet<>(); + List pathToItem = List.of("args[0"); + boolean castArg = castToAllowedTypes(arg, pathToItem, pathSet); + SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().build())); + ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, new PathToSchemasMap(), new LinkedHashSet<>()); + getPathToSchemas(this, castArg, validationMetadata, pathSet); + return castArg; + } + + @Override + 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 ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + } + @Override + 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 RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); + } + @Override + 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 { + 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"); + } + } +} diff --git a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/schemas/ComposedNone.kt b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/schemas/ComposedNone.kt new file mode 100644 index 00000000000..c9aa0cbd2bf --- /dev/null +++ b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/schemas/ComposedNone.kt @@ -0,0 +1,109 @@ +package org.openapijsonschematools.client.components.schemas; +import java.util.HashSet; +import java.util.LinkedHashSet; +import java.util.List; +import java.util.Objects; +import java.util.Set; +import org.checkerframework.checker.nullness.qual.Nullable; +import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags; +import org.openapijsonschematools.client.configurations.SchemaConfiguration; +import org.openapijsonschematools.client.exceptions.ValidationException; +import org.openapijsonschematools.client.schemas.AnyTypeJsonSchema; +import org.openapijsonschematools.client.schemas.validation.JsonSchema; +import org.openapijsonschematools.client.schemas.validation.JsonSchemaInfo; +import org.openapijsonschematools.client.schemas.validation.NullSchemaValidator; +import org.openapijsonschematools.client.schemas.validation.PathToSchemasMap; +import org.openapijsonschematools.client.schemas.validation.ValidationMetadata; + +public class ComposedNone { + // nest classes so all schemas and input/output classes can be public + + + public static class Schema0 extends AnyTypeJsonSchema.AnyTypeJsonSchema1 { + private static @Nullable Schema0 instance = null; + public static Schema0 getInstance() { + if (instance == null) { + instance = new Schema0(); + } + return instance; + } + } + + + public sealed interface ComposedNone1Boxed permits ComposedNone1BoxedNothing? { + @Nullable Object getData(); + } + + public record ComposedNone1BoxedVoid(Nothing? data) implements ComposedNone1Boxed { + @Override + public @Nullable Object getData() { + return data; + } + } + + + + public static class ComposedNone1 extends JsonSchema implements NullSchemaValidator { + /* + NOTE: This class is auto generated by OpenAPI JSON Schema Generator. + Ref: https://github.com/openapi-json-schema-tools/openapi-json-schema-generator + + Do not edit the class manually. + */ + private static @Nullable ComposedNone1 instance = null; + + protected ComposedNone1() { + super(new JsonSchemaInfo() + .type(Set.of(Nothing?.class)) + .allOf(List.of( + Schema0.class + )) + ); + } + + public static ComposedNone1 getInstance() { + if (instance == null) { + instance = new ComposedNone1(); + } + return instance; + } + + @Override + public Nothing? validate(Nothing? arg, SchemaConfiguration configuration) throws ValidationException { + Set> pathSet = new HashSet<>(); + List pathToItem = List.of("args[0"); + Nothing? castArg = castToAllowedTypes(arg, pathToItem, pathSet); + SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().build())); + ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, new PathToSchemasMap(), new LinkedHashSet<>()); + getPathToSchemas(this, castArg, validationMetadata, pathSet); + return castArg; + } + + @Override + public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { + if (arg == null) { + return validate((Nothing?) null, configuration); + } + throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + } + @Override + public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { + if (arg == null) { + return getNewInstance((Nothing?) null, pathToItem, pathToSchemas); + } + throw new RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); + } + @Override + public ComposedNone1BoxedVoid validateAndBox(Nothing? arg, SchemaConfiguration configuration) throws ValidationException { + return new ComposedNone1BoxedVoid(validate(arg, configuration)); + } + @Override + public ComposedNone1Boxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { + if (arg == null) { + Nothing? castArg = (Nothing?) arg; + return validateAndBox(castArg, configuration); + } + throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + } + } +} diff --git a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/schemas/ComposedNumber.kt b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/schemas/ComposedNumber.kt new file mode 100644 index 00000000000..44bb713e4de --- /dev/null +++ b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/schemas/ComposedNumber.kt @@ -0,0 +1,129 @@ +package org.openapijsonschematools.client.components.schemas; +import java.util.HashSet; +import java.util.LinkedHashSet; +import java.util.List; +import java.util.Objects; +import java.util.Set; +import org.checkerframework.checker.nullness.qual.Nullable; +import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags; +import org.openapijsonschematools.client.configurations.SchemaConfiguration; +import org.openapijsonschematools.client.exceptions.ValidationException; +import org.openapijsonschematools.client.schemas.AnyTypeJsonSchema; +import org.openapijsonschematools.client.schemas.validation.JsonSchema; +import org.openapijsonschematools.client.schemas.validation.JsonSchemaInfo; +import org.openapijsonschematools.client.schemas.validation.NumberSchemaValidator; +import org.openapijsonschematools.client.schemas.validation.PathToSchemasMap; +import org.openapijsonschematools.client.schemas.validation.ValidationMetadata; + +public class ComposedNumber { + // nest classes so all schemas and input/output classes can be public + + + public static class Schema0 extends AnyTypeJsonSchema.AnyTypeJsonSchema1 { + private static @Nullable Schema0 instance = null; + public static Schema0 getInstance() { + if (instance == null) { + instance = new Schema0(); + } + return instance; + } + } + + + public sealed interface ComposedNumber1Boxed permits ComposedNumber1BoxedNumber { + @Nullable Object getData(); + } + + public record ComposedNumber1BoxedNumber(Number data) implements ComposedNumber1Boxed { + @Override + public @Nullable Object getData() { + return data; + } + } + + + + public static class ComposedNumber1 extends JsonSchema implements NumberSchemaValidator { + /* + NOTE: This class is auto generated by OpenAPI JSON Schema Generator. + Ref: https://github.com/openapi-json-schema-tools/openapi-json-schema-generator + + Do not edit the class manually. + */ + private static @Nullable ComposedNumber1 instance = null; + + protected ComposedNumber1() { + super(new JsonSchemaInfo() + .type(Set.of( + Integer.class, + Long.class, + Float.class, + Double.class + )) + .allOf(List.of( + Schema0.class + )) + ); + } + + public static ComposedNumber1 getInstance() { + if (instance == null) { + instance = new ComposedNumber1(); + } + return instance; + } + + @Override + public Number validate(Number arg, SchemaConfiguration configuration) throws ValidationException { + Set> pathSet = new HashSet<>(); + List pathToItem = List.of("args[0"); + Number castArg = castToAllowedTypes(arg, pathToItem, pathSet); + SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().build())); + ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, new PathToSchemasMap(), new LinkedHashSet<>()); + PathToSchemasMap pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet); + return castArg; + } + + public int validate(int arg, SchemaConfiguration configuration) throws ValidationException { + return (int) validate((Number) arg, configuration); + } + + public long validate(long arg, SchemaConfiguration configuration) throws ValidationException { + return (long) validate((Number) arg, configuration); + } + + public float validate(float arg, SchemaConfiguration configuration) throws ValidationException { + return (float) validate((Number) arg, configuration); + } + + 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 { + 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"); + } + @Override + public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { + 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"); + } + @Override + 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 { + 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"); + } + } +} diff --git a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/schemas/ComposedObject.kt b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/schemas/ComposedObject.kt new file mode 100644 index 00000000000..3a641bad085 --- /dev/null +++ b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/schemas/ComposedObject.kt @@ -0,0 +1,138 @@ +package org.openapijsonschematools.client.components.schemas; +import java.util.ArrayList; +import java.util.HashSet; +import java.util.LinkedHashMap; +import java.util.LinkedHashSet; +import java.util.List; +import java.util.Map; +import java.util.Objects; +import java.util.Set; +import org.checkerframework.checker.nullness.qual.Nullable; +import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags; +import org.openapijsonschematools.client.configurations.SchemaConfiguration; +import org.openapijsonschematools.client.exceptions.InvalidAdditionalPropertyException; +import org.openapijsonschematools.client.exceptions.UnsetPropertyException; +import org.openapijsonschematools.client.exceptions.ValidationException; +import org.openapijsonschematools.client.schemas.AnyTypeJsonSchema; +import org.openapijsonschematools.client.schemas.UnsetAddPropsSetter; +import org.openapijsonschematools.client.schemas.validation.FrozenMap; +import org.openapijsonschematools.client.schemas.validation.JsonSchema; +import org.openapijsonschematools.client.schemas.validation.JsonSchemaInfo; +import org.openapijsonschematools.client.schemas.validation.MapSchemaValidator; +import org.openapijsonschematools.client.schemas.validation.PathToSchemasMap; +import org.openapijsonschematools.client.schemas.validation.ValidationMetadata; + +public class ComposedObject { + // nest classes so all schemas and input/output classes can be public + + + public static class Schema0 extends AnyTypeJsonSchema.AnyTypeJsonSchema1 { + private static @Nullable Schema0 instance = null; + public static Schema0 getInstance() { + if (instance == null) { + instance = new Schema0(); + } + return instance; + } + } + + + public sealed interface ComposedObject1Boxed permits ComposedObject1BoxedMap { + @Nullable Object getData(); + } + + public record ComposedObject1BoxedMap(FrozenMap<@Nullable Object> data) implements ComposedObject1Boxed { + @Override + public @Nullable Object getData() { + return data; + } + } + + + public static class ComposedObject1 extends JsonSchema implements MapSchemaValidator, ComposedObject1BoxedMap> { + /* + NOTE: This class is auto generated by OpenAPI JSON Schema Generator. + Ref: https://github.com/openapi-json-schema-tools/openapi-json-schema-generator + + Do not edit the class manually. + */ + private static @Nullable ComposedObject1 instance = null; + + protected ComposedObject1() { + super(new JsonSchemaInfo() + .type(Set.of(Map.class)) + .allOf(List.of( + Schema0.class + )) + ); + } + + public static ComposedObject1 getInstance() { + if (instance == null) { + instance = new ComposedObject1(); + } + return instance; + } + + 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 RuntimeException("Invalid non-string key value"); + } + String propertyName = (String) entryKey; + List propertyPathToItem = new ArrayList<>(pathToItem); + propertyPathToItem.add(propertyName); + Object value = entry.getValue(); + LinkedHashMap, Nothing?> schemas = pathToSchemas.get(propertyPathToItem); + if (schemas == null) { + throw new RuntimeException("Validation result is invalid, schemas must exist for a pathToItem"); + } + JsonSchema propertySchema = schemas.entrySet().iterator().next().getKey(); + @Nullable Object propertyInstance = propertySchema.getNewInstance(value, propertyPathToItem, pathToSchemas); + properties.put(propertyName, propertyInstance); + } + FrozenMap<@Nullable Object> castProperties = new FrozenMap<>(properties); + return castProperties; + } + + public FrozenMap<@Nullable Object> validate(Map arg, SchemaConfiguration configuration) throws ValidationException { + Set> pathSet = new HashSet<>(); + List pathToItem = List.of("args[0"); + Map castArg = castToAllowedTypes(arg, pathToItem, pathSet); + SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().build())); + ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, new PathToSchemasMap(), new LinkedHashSet<>()); + PathToSchemasMap pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet); + return getNewInstance(castArg, validationMetadata.pathToItem(), pathToSchemasMap); + } + + + @Override + public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws 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"); + } + @Override + public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { + if (arg instanceof Map) { + return getNewInstance((Map) arg, pathToItem, pathToSchemas); + } + 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 { + return new ComposedObject1BoxedMap(validate(arg, configuration)); + } + @Override + public ComposedObject1Boxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { + 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"); + } + } + +} diff --git a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/schemas/ComposedOneOfDifferentTypes.kt b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/schemas/ComposedOneOfDifferentTypes.kt new file mode 100644 index 00000000000..56e644f0af4 --- /dev/null +++ b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/schemas/ComposedOneOfDifferentTypes.kt @@ -0,0 +1,700 @@ +package org.openapijsonschematools.client.components.schemas; +import java.time.LocalDate; +import java.time.ZonedDateTime; +import java.util.ArrayList; +import java.util.HashSet; +import java.util.LinkedHashMap; +import java.util.LinkedHashSet; +import java.util.List; +import java.util.Map; +import java.util.Objects; +import java.util.Set; +import java.util.UUID; +import java.util.regex.Pattern; +import org.checkerframework.checker.nullness.qual.Nullable; +import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags; +import org.openapijsonschematools.client.configurations.SchemaConfiguration; +import org.openapijsonschematools.client.exceptions.InvalidAdditionalPropertyException; +import org.openapijsonschematools.client.exceptions.UnsetPropertyException; +import org.openapijsonschematools.client.exceptions.ValidationException; +import org.openapijsonschematools.client.schemas.AnyTypeJsonSchema; +import org.openapijsonschematools.client.schemas.DateJsonSchema; +import org.openapijsonschematools.client.schemas.NullJsonSchema; +import org.openapijsonschematools.client.schemas.UnsetAddPropsSetter; +import org.openapijsonschematools.client.schemas.validation.BooleanSchemaValidator; +import org.openapijsonschematools.client.schemas.validation.FrozenList; +import org.openapijsonschematools.client.schemas.validation.FrozenMap; +import org.openapijsonschematools.client.schemas.validation.JsonSchema; +import org.openapijsonschematools.client.schemas.validation.JsonSchemaInfo; +import org.openapijsonschematools.client.schemas.validation.ListSchemaValidator; +import org.openapijsonschematools.client.schemas.validation.MapSchemaValidator; +import org.openapijsonschematools.client.schemas.validation.NullSchemaValidator; +import org.openapijsonschematools.client.schemas.validation.NumberSchemaValidator; +import org.openapijsonschematools.client.schemas.validation.PathToSchemasMap; +import org.openapijsonschematools.client.schemas.validation.StringSchemaValidator; +import org.openapijsonschematools.client.schemas.validation.ValidationMetadata; + +public class ComposedOneOfDifferentTypes { + // nest classes so all schemas and input/output classes can be public + + + public static class Schema2 extends NullJsonSchema.NullJsonSchema1 { + private static @Nullable Schema2 instance = null; + public static Schema2 getInstance() { + if (instance == null) { + instance = new Schema2(); + } + return instance; + } + } + + + public static class Schema3 extends DateJsonSchema.DateJsonSchema1 { + private static @Nullable Schema3 instance = null; + public static Schema3 getInstance() { + if (instance == null) { + instance = new Schema3(); + } + return instance; + } + } + + + public sealed interface Schema4Boxed permits Schema4BoxedMap { + @Nullable Object getData(); + } + + public record Schema4BoxedMap(FrozenMap<@Nullable Object> data) implements Schema4Boxed { + @Override + public @Nullable Object getData() { + return data; + } + } + + + public static class Schema4 extends JsonSchema implements MapSchemaValidator, Schema4BoxedMap> { + private static @Nullable Schema4 instance = null; + + protected Schema4() { + super(new JsonSchemaInfo() + .type(Set.of(Map.class)) + .maxProperties(4) + .minProperties(4) + ); + } + + public static Schema4 getInstance() { + if (instance == null) { + instance = new Schema4(); + } + return instance; + } + + 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 RuntimeException("Invalid non-string key value"); + } + String propertyName = (String) entryKey; + List propertyPathToItem = new ArrayList<>(pathToItem); + propertyPathToItem.add(propertyName); + Object value = entry.getValue(); + LinkedHashMap, Nothing?> schemas = pathToSchemas.get(propertyPathToItem); + if (schemas == null) { + throw new RuntimeException("Validation result is invalid, schemas must exist for a pathToItem"); + } + JsonSchema propertySchema = schemas.entrySet().iterator().next().getKey(); + @Nullable Object propertyInstance = propertySchema.getNewInstance(value, propertyPathToItem, pathToSchemas); + properties.put(propertyName, propertyInstance); + } + FrozenMap<@Nullable Object> castProperties = new FrozenMap<>(properties); + return castProperties; + } + + public FrozenMap<@Nullable Object> validate(Map arg, SchemaConfiguration configuration) throws ValidationException { + Set> pathSet = new HashSet<>(); + List pathToItem = List.of("args[0"); + Map castArg = castToAllowedTypes(arg, pathToItem, pathSet); + SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().build())); + ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, new PathToSchemasMap(), new LinkedHashSet<>()); + PathToSchemasMap pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet); + return getNewInstance(castArg, validationMetadata.pathToItem(), pathToSchemasMap); + } + + + @Override + public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws 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"); + } + @Override + public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { + if (arg instanceof Map) { + return getNewInstance((Map) arg, pathToItem, pathToSchemas); + } + 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 { + return new Schema4BoxedMap(validate(arg, configuration)); + } + @Override + public Schema4Boxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { + 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"); + } + } + + + public static class Items extends AnyTypeJsonSchema.AnyTypeJsonSchema1 { + private static @Nullable Items instance = null; + public static Items getInstance() { + if (instance == null) { + instance = new Items(); + } + return instance; + } + } + + + 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 { + return Schema5.getInstance().validate(arg, configuration); + } + } + + public static class Schema5ListBuilder { + // class to build List<@Nullable Object> + private final List<@Nullable Object> list; + + public Schema5ListBuilder() { + list = new ArrayList<>(); + } + + public Schema5ListBuilder(List<@Nullable Object> list) { + this.list = list; + } + + public Schema5ListBuilder add(Nothing? item) { + list.add(null); + return this; + } + + public Schema5ListBuilder add(boolean item) { + list.add(item); + return this; + } + + public Schema5ListBuilder add(String item) { + list.add(item); + return this; + } + + public Schema5ListBuilder add(int item) { + list.add(item); + return this; + } + + public Schema5ListBuilder add(float item) { + list.add(item); + return this; + } + + public Schema5ListBuilder add(long item) { + list.add(item); + return this; + } + + public Schema5ListBuilder add(double item) { + list.add(item); + return this; + } + + public Schema5ListBuilder add(List item) { + list.add(item); + return this; + } + + public Schema5ListBuilder add(Map item) { + list.add(item); + return this; + } + + public List<@Nullable Object> build() { + return list; + } + } + + + public sealed interface Schema5Boxed permits Schema5BoxedList { + @Nullable Object getData(); + } + + public record Schema5BoxedList(Schema5List data) implements Schema5Boxed { + @Override + public @Nullable Object getData() { + return data; + } + } + + + + public static class Schema5 extends JsonSchema implements ListSchemaValidator { + private static @Nullable Schema5 instance = null; + + protected Schema5() { + super(new JsonSchemaInfo() + .type(Set.of(List.class)) + .items(Items.class) + .maxItems(4) + .minItems(4) + ); + } + + public static Schema5 getInstance() { + if (instance == null) { + instance = new Schema5(); + } + return instance; + } + + @Override + public Schema5List getNewInstance(List arg, List pathToItem, PathToSchemasMap pathToSchemas) { + List<@Nullable Object> items = new ArrayList<>(); + int i = 0; + for (Object item: arg) { + List itemPathToItem = new ArrayList<>(pathToItem); + itemPathToItem.add(i); + LinkedHashMap, Nothing?> schemas = pathToSchemas.get(itemPathToItem); + if (schemas == null) { + throw new RuntimeException("Validation result is invalid, schemas must exist for a pathToItem"); + } + JsonSchema itemSchema = schemas.entrySet().iterator().next().getKey(); + @Nullable Object itemInstance = itemSchema.getNewInstance(item, itemPathToItem, pathToSchemas); + items.add(itemInstance); + i += 1; + } + FrozenList<@Nullable Object> newInstanceItems = new FrozenList<>(items); + return new Schema5List(newInstanceItems); + } + + 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); + SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().build())); + ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, new PathToSchemasMap(), new LinkedHashSet<>()); + PathToSchemasMap pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet); + return getNewInstance(castArg, validationMetadata.pathToItem(), pathToSchemasMap); + } + + @Override + public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws 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"); + } + @Override + public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { + 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"); + } + @Override + 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 { + 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"); + } + } + + public sealed interface Schema6Boxed permits Schema6BoxedString { + @Nullable Object getData(); + } + + public record Schema6BoxedString(String data) implements Schema6Boxed { + @Override + public @Nullable Object getData() { + return data; + } + } + + + + public static class Schema6 extends JsonSchema implements StringSchemaValidator { + private static @Nullable Schema6 instance = null; + + protected Schema6() { + super(new JsonSchemaInfo() + .type(Set.of( + String.class + )) + .format("date-time") + .pattern(Pattern.compile( + "^2020.*" + )) + ); + } + + public static Schema6 getInstance() { + if (instance == null) { + instance = new Schema6(); + } + return instance; + } + + @Override + public String validate(String arg, SchemaConfiguration configuration) throws ValidationException { + Set> pathSet = new HashSet<>(); + List pathToItem = List.of("args[0"); + String castArg = castToAllowedTypes(arg, pathToItem, pathSet); + SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().build())); + ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, new PathToSchemasMap(), new LinkedHashSet<>()); + getPathToSchemas(this, castArg, validationMetadata, pathSet); + return castArg; + } + + @Override + public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws 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"); + } + @Override + public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { + 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"); + } + @Override + 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 { + 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"); + } + } + + public sealed interface ComposedOneOfDifferentTypes1Boxed permits ComposedOneOfDifferentTypes1BoxedVoid, ComposedOneOfDifferentTypes1BoxedBoolean, ComposedOneOfDifferentTypes1BoxedNumber, ComposedOneOfDifferentTypes1BoxedString, ComposedOneOfDifferentTypes1BoxedList, ComposedOneOfDifferentTypes1BoxedMap { + @Nullable Object getData(); + } + + public record ComposedOneOfDifferentTypes1BoxedVoid(Nothing? data) implements ComposedOneOfDifferentTypes1Boxed { + @Override + public @Nullable Object getData() { + return data; + } + } + + public record ComposedOneOfDifferentTypes1BoxedBoolean(boolean data) implements ComposedOneOfDifferentTypes1Boxed { + @Override + public @Nullable Object getData() { + return data; + } + } + + public record ComposedOneOfDifferentTypes1BoxedNumber(Number data) implements ComposedOneOfDifferentTypes1Boxed { + @Override + public @Nullable Object getData() { + return data; + } + } + + public record ComposedOneOfDifferentTypes1BoxedString(String data) implements ComposedOneOfDifferentTypes1Boxed { + @Override + public @Nullable Object getData() { + return data; + } + } + + public record ComposedOneOfDifferentTypes1BoxedList(FrozenList<@Nullable Object> data) implements ComposedOneOfDifferentTypes1Boxed { + @Override + public @Nullable Object getData() { + return data; + } + } + + public record ComposedOneOfDifferentTypes1BoxedMap(FrozenMap<@Nullable Object> data) implements ComposedOneOfDifferentTypes1Boxed { + @Override + public @Nullable Object getData() { + return data; + } + } + + + public static class ComposedOneOfDifferentTypes1 extends JsonSchema implements NullSchemaValidator, BooleanSchemaValidator, NumberSchemaValidator, StringSchemaValidator, ListSchemaValidator, ComposedOneOfDifferentTypes1BoxedList>, MapSchemaValidator, ComposedOneOfDifferentTypes1BoxedMap> { + /* + NOTE: This class is auto generated by OpenAPI JSON Schema Generator. + Ref: https://github.com/openapi-json-schema-tools/openapi-json-schema-generator + + Do not edit the class manually. + + this is a model that allows payloads of type object or number + */ + private static @Nullable ComposedOneOfDifferentTypes1 instance = null; + + protected ComposedOneOfDifferentTypes1() { + super(new JsonSchemaInfo() + .oneOf(List.of( + NumberWithValidations.NumberWithValidations1.class, + Animal.Animal1.class, + Schema2.class, + Schema3.class, + Schema4.class, + Schema5.class, + Schema6.class + )) + ); + } + + public static ComposedOneOfDifferentTypes1 getInstance() { + if (instance == null) { + instance = new ComposedOneOfDifferentTypes1(); + } + return instance; + } + + @Override + public Nothing? validate(Nothing? arg, SchemaConfiguration configuration) throws ValidationException { + Set> pathSet = new HashSet<>(); + List pathToItem = List.of("args[0]"); + Nothing? castArg = castToAllowedTypes(arg, pathToItem, pathSet); + SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().build())); + PathToSchemasMap validatedPathToSchemas = new PathToSchemasMap(); + ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, new LinkedHashSet<>()); + getPathToSchemas(this, castArg, validationMetadata, pathSet); + return castArg; + } + + @Override + public boolean validate(boolean arg, SchemaConfiguration configuration) throws ValidationException { + Set> pathSet = new HashSet<>(); + List pathToItem = List.of("args[0]"); + boolean castArg = castToAllowedTypes(arg, pathToItem, pathSet); + SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().build())); + PathToSchemasMap validatedPathToSchemas = new PathToSchemasMap(); + ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, new LinkedHashSet<>()); + getPathToSchemas(this, castArg, validationMetadata, pathSet); + return castArg; + } + + @Override + public Number validate(Number arg, SchemaConfiguration configuration) throws ValidationException { + Set> pathSet = new HashSet<>(); + List pathToItem = List.of("args[0]"); + Number castArg = castToAllowedTypes(arg, pathToItem, pathSet); + SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().build())); + PathToSchemasMap validatedPathToSchemas = new PathToSchemasMap(); + ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, new LinkedHashSet<>()); + getPathToSchemas(this, castArg, validationMetadata, pathSet); + return castArg; + } + + public int validate(int arg, SchemaConfiguration configuration) throws ValidationException { + return (int) validate((Number) arg, configuration); + } + + public long validate(long arg, SchemaConfiguration configuration) throws ValidationException { + return (long) validate((Number) arg, configuration); + } + + public float validate(float arg, SchemaConfiguration configuration) throws ValidationException { + return (float) validate((Number) arg, configuration); + } + + public double validate(double arg, SchemaConfiguration configuration) throws ValidationException { + return (double) validate((Number) arg, configuration); + } + + @Override + public String validate(String arg, SchemaConfiguration configuration) throws ValidationException { + Set> pathSet = new HashSet<>(); + List pathToItem = List.of("args[0]"); + String castArg = castToAllowedTypes(arg, pathToItem, pathSet); + SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().build())); + PathToSchemasMap validatedPathToSchemas = new PathToSchemasMap(); + ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, new LinkedHashSet<>()); + getPathToSchemas(this, castArg, validationMetadata, pathSet); + return castArg; + } + + public String validate(LocalDate arg, SchemaConfiguration configuration) throws ValidationException { + return validate(arg.toString(), configuration); + } + + public String validate(ZonedDateTime arg, SchemaConfiguration configuration) throws ValidationException { + return validate(arg.toString(), configuration); + } + + public String validate(UUID arg, SchemaConfiguration configuration) throws ValidationException { + return validate(arg.toString(), configuration); + } + + @Override + public FrozenList<@Nullable Object> getNewInstance(List arg, List pathToItem, PathToSchemasMap pathToSchemas) { + List<@Nullable Object> items = new ArrayList<>(); + int i = 0; + for (Object item: arg) { + List itemPathToItem = new ArrayList<>(pathToItem); + itemPathToItem.add(i); + LinkedHashMap, Nothing?> schemas = pathToSchemas.get(itemPathToItem); + if (schemas == null) { + throw new RuntimeException("Validation result is invalid, schemas must exist for a pathToItem"); + } + JsonSchema itemSchema = schemas.entrySet().iterator().next().getKey(); + @Nullable Object itemInstance = itemSchema.getNewInstance(item, itemPathToItem, pathToSchemas); + items.add(itemInstance); + i += 1; + } + FrozenList<@Nullable Object> newInstanceItems = new FrozenList<>(items); + return newInstanceItems; + } + + 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); + SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().build())); + ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, new PathToSchemasMap(), new LinkedHashSet<>()); + PathToSchemasMap pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet); + return getNewInstance(castArg, validationMetadata.pathToItem(), pathToSchemasMap); + } + + @Override + 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 RuntimeException("Invalid non-string key value"); + } + String propertyName = (String) entryKey; + List propertyPathToItem = new ArrayList<>(pathToItem); + propertyPathToItem.add(propertyName); + Object value = entry.getValue(); + LinkedHashMap, Nothing?> schemas = pathToSchemas.get(propertyPathToItem); + if (schemas == null) { + throw new RuntimeException("Validation result is invalid, schemas must exist for a pathToItem"); + } + JsonSchema propertySchema = schemas.entrySet().iterator().next().getKey(); + @Nullable Object propertyInstance = propertySchema.getNewInstance(value, propertyPathToItem, pathToSchemas); + properties.put(propertyName, propertyInstance); + } + FrozenMap<@Nullable Object> castProperties = new FrozenMap<>(properties); + return castProperties; + } + + public FrozenMap<@Nullable Object> validate(Map arg, SchemaConfiguration configuration) throws ValidationException { + Set> pathSet = new HashSet<>(); + List pathToItem = List.of("args[0]"); + Map castArg = castToAllowedTypes(arg, pathToItem, pathSet); + SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().build())); + PathToSchemasMap validatedPathToSchemas = new PathToSchemasMap(); + ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, new LinkedHashSet<>()); + PathToSchemasMap pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet); + return getNewInstance(castArg, validationMetadata.pathToItem(), pathToSchemasMap); + } + + @Override + public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { + if (arg == null) { + return validate((Nothing?) null, configuration); + } else if (arg instanceof Boolean) { + boolean boolArg = (Boolean) arg; + return validate(boolArg, configuration); + } else if (arg instanceof Number) { + return validate((Number) arg, configuration); + } else if (arg instanceof String) { + return validate((String) arg, configuration); + } else if (arg instanceof List) { + return validate((List) arg, 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"); + } + @Override + public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { + if (arg == null) { + return getNewInstance((Nothing?) null, pathToItem, pathToSchemas); + } else if (arg instanceof Boolean) { + boolean boolArg = (Boolean) arg; + return getNewInstance(boolArg, pathToItem, pathToSchemas); + } else if (arg instanceof Number) { + return getNewInstance((Number) arg, pathToItem, pathToSchemas); + } else if (arg instanceof String) { + return getNewInstance((String) arg, pathToItem, pathToSchemas); + } else if (arg instanceof List) { + return getNewInstance((List) arg, 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"); + } + @Override + public ComposedOneOfDifferentTypes1BoxedVoid validateAndBox(Nothing? arg, SchemaConfiguration configuration) throws ValidationException { + return new ComposedOneOfDifferentTypes1BoxedVoid(validate(arg, configuration)); + } + @Override + 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 { + return new ComposedOneOfDifferentTypes1BoxedNumber(validate(arg, configuration)); + } + @Override + 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 { + return new ComposedOneOfDifferentTypes1BoxedList(validate(arg, configuration)); + } + @Override + 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 { + if (arg == null) { + Nothing? castArg = (Nothing?) arg; + return validateAndBox(castArg, configuration); + } else if (arg instanceof Boolean booleanArg) { + boolean castArg = booleanArg; + return validateAndBox(castArg, configuration); + } else if (arg instanceof String castArg) { + return validateAndBox(castArg, configuration); + } else if (arg instanceof Number castArg) { + return validateAndBox(castArg, configuration); + } else if (arg instanceof List castArg) { + 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"); + } + } +} diff --git a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/schemas/ComposedString.kt b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/schemas/ComposedString.kt new file mode 100644 index 00000000000..73214362cf6 --- /dev/null +++ b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/schemas/ComposedString.kt @@ -0,0 +1,110 @@ +package org.openapijsonschematools.client.components.schemas; +import java.util.HashSet; +import java.util.LinkedHashSet; +import java.util.List; +import java.util.Objects; +import java.util.Set; +import org.checkerframework.checker.nullness.qual.Nullable; +import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags; +import org.openapijsonschematools.client.configurations.SchemaConfiguration; +import org.openapijsonschematools.client.exceptions.ValidationException; +import org.openapijsonschematools.client.schemas.AnyTypeJsonSchema; +import org.openapijsonschematools.client.schemas.validation.JsonSchema; +import org.openapijsonschematools.client.schemas.validation.JsonSchemaInfo; +import org.openapijsonschematools.client.schemas.validation.PathToSchemasMap; +import org.openapijsonschematools.client.schemas.validation.StringSchemaValidator; +import org.openapijsonschematools.client.schemas.validation.ValidationMetadata; + +public class ComposedString { + // nest classes so all schemas and input/output classes can be public + + + public static class Schema0 extends AnyTypeJsonSchema.AnyTypeJsonSchema1 { + private static @Nullable Schema0 instance = null; + public static Schema0 getInstance() { + if (instance == null) { + instance = new Schema0(); + } + return instance; + } + } + + + public sealed interface ComposedString1Boxed permits ComposedString1BoxedString { + @Nullable Object getData(); + } + + public record ComposedString1BoxedString(String data) implements ComposedString1Boxed { + @Override + public @Nullable Object getData() { + return data; + } + } + + + + public static class ComposedString1 extends JsonSchema implements StringSchemaValidator { + /* + NOTE: This class is auto generated by OpenAPI JSON Schema Generator. + Ref: https://github.com/openapi-json-schema-tools/openapi-json-schema-generator + + Do not edit the class manually. + */ + private static @Nullable ComposedString1 instance = null; + + protected ComposedString1() { + super(new JsonSchemaInfo() + .type(Set.of( + String.class + )) + .allOf(List.of( + Schema0.class + )) + ); + } + + public static ComposedString1 getInstance() { + if (instance == null) { + instance = new ComposedString1(); + } + return instance; + } + + @Override + public String validate(String arg, SchemaConfiguration configuration) throws ValidationException { + Set> pathSet = new HashSet<>(); + List pathToItem = List.of("args[0"); + String castArg = castToAllowedTypes(arg, pathToItem, pathSet); + SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().build())); + ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, new PathToSchemasMap(), new LinkedHashSet<>()); + getPathToSchemas(this, castArg, validationMetadata, pathSet); + return castArg; + } + + @Override + public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws 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"); + } + @Override + public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { + 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"); + } + @Override + 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 { + 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"); + } + } +} diff --git a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/schemas/Currency.kt b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/schemas/Currency.kt new file mode 100644 index 00000000000..863e5f2b21e --- /dev/null +++ b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/schemas/Currency.kt @@ -0,0 +1,120 @@ +package org.openapijsonschematools.client.components.schemas; +import java.util.HashSet; +import java.util.LinkedHashSet; +import java.util.List; +import java.util.Objects; +import java.util.Set; +import org.checkerframework.checker.nullness.qual.Nullable; +import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags; +import org.openapijsonschematools.client.configurations.SchemaConfiguration; +import org.openapijsonschematools.client.exceptions.ValidationException; +import org.openapijsonschematools.client.schemas.SetMaker; +import org.openapijsonschematools.client.schemas.validation.JsonSchema; +import org.openapijsonschematools.client.schemas.validation.JsonSchemaInfo; +import org.openapijsonschematools.client.schemas.validation.PathToSchemasMap; +import org.openapijsonschematools.client.schemas.validation.StringEnumValidator; +import org.openapijsonschematools.client.schemas.validation.StringSchemaValidator; +import org.openapijsonschematools.client.schemas.validation.StringValueMethod; +import org.openapijsonschematools.client.schemas.validation.ValidationMetadata; + +public class Currency { + // nest classes so all schemas and input/output classes can be public + + public enum StringCurrencyEnums implements StringValueMethod { + EUR("eur"), + USD("usd"); + private final String value; + + StringCurrencyEnums(String value) { + this.value = value; + } + public String value() { + return this.value; + } + } + + + public sealed interface Currency1Boxed permits Currency1BoxedString { + @Nullable Object getData(); + } + + public record Currency1BoxedString(String data) implements Currency1Boxed { + @Override + public @Nullable Object getData() { + return data; + } + } + + + + public static class Currency1 extends JsonSchema implements StringSchemaValidator, StringEnumValidator { + /* + NOTE: This class is auto generated by OpenAPI JSON Schema Generator. + Ref: https://github.com/openapi-json-schema-tools/openapi-json-schema-generator + + Do not edit the class manually. + */ + private static @Nullable Currency1 instance = null; + + protected Currency1() { + super(new JsonSchemaInfo() + .type(Set.of( + String.class + )) + .enumValues(SetMaker.makeSet( + "eur", + "usd" + )) + ); + } + + public static Currency1 getInstance() { + if (instance == null) { + instance = new Currency1(); + } + return instance; + } + + @Override + public String validate(String arg, SchemaConfiguration configuration) throws ValidationException { + Set> pathSet = new HashSet<>(); + List pathToItem = List.of("args[0"); + String castArg = castToAllowedTypes(arg, pathToItem, pathSet); + SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().build())); + ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, new PathToSchemasMap(), new LinkedHashSet<>()); + getPathToSchemas(this, castArg, validationMetadata, pathSet); + return castArg; + } + + @Override + 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 { + 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"); + } + @Override + public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { + 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"); + } + @Override + 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 { + 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"); + } + } +} diff --git a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/schemas/DanishPig.kt b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/schemas/DanishPig.kt new file mode 100644 index 00000000000..4f2c28c2398 --- /dev/null +++ b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/schemas/DanishPig.kt @@ -0,0 +1,304 @@ +package org.openapijsonschematools.client.components.schemas; +import java.util.ArrayList; +import java.util.HashSet; +import java.util.LinkedHashMap; +import java.util.LinkedHashSet; +import java.util.List; +import java.util.Map; +import java.util.Objects; +import java.util.Set; +import org.checkerframework.checker.nullness.qual.Nullable; +import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags; +import org.openapijsonschematools.client.configurations.SchemaConfiguration; +import org.openapijsonschematools.client.exceptions.InvalidAdditionalPropertyException; +import org.openapijsonschematools.client.exceptions.UnsetPropertyException; +import org.openapijsonschematools.client.exceptions.ValidationException; +import org.openapijsonschematools.client.schemas.GenericBuilder; +import org.openapijsonschematools.client.schemas.SetMaker; +import org.openapijsonschematools.client.schemas.UnsetAddPropsSetter; +import org.openapijsonschematools.client.schemas.validation.FrozenMap; +import org.openapijsonschematools.client.schemas.validation.JsonSchema; +import org.openapijsonschematools.client.schemas.validation.JsonSchemaInfo; +import org.openapijsonschematools.client.schemas.validation.MapSchemaValidator; +import org.openapijsonschematools.client.schemas.validation.PathToSchemasMap; +import org.openapijsonschematools.client.schemas.validation.PropertyEntry; +import org.openapijsonschematools.client.schemas.validation.StringEnumValidator; +import org.openapijsonschematools.client.schemas.validation.StringSchemaValidator; +import org.openapijsonschematools.client.schemas.validation.StringValueMethod; +import org.openapijsonschematools.client.schemas.validation.ValidationMetadata; + +public class DanishPig { + // nest classes so all schemas and input/output classes can be public + + public enum StringClassNameEnums implements StringValueMethod { + DANISH_PIG("DanishPig"); + private final String value; + + StringClassNameEnums(String value) { + this.value = value; + } + public String value() { + return this.value; + } + } + + + public sealed interface ClassNameBoxed permits ClassNameBoxedString { + @Nullable Object getData(); + } + + public record ClassNameBoxedString(String data) implements ClassNameBoxed { + @Override + public @Nullable Object getData() { + return data; + } + } + + + + public static class ClassName extends JsonSchema implements StringSchemaValidator, StringEnumValidator { + private static @Nullable ClassName instance = null; + + protected ClassName() { + super(new JsonSchemaInfo() + .type(Set.of( + String.class + )) + .enumValues(SetMaker.makeSet( + "DanishPig" + )) + ); + } + + public static ClassName getInstance() { + if (instance == null) { + instance = new ClassName(); + } + return instance; + } + + @Override + public String validate(String arg, SchemaConfiguration configuration) throws ValidationException { + Set> pathSet = new HashSet<>(); + List pathToItem = List.of("args[0"); + String castArg = castToAllowedTypes(arg, pathToItem, pathSet); + SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().build())); + ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, new PathToSchemasMap(), new LinkedHashSet<>()); + getPathToSchemas(this, castArg, validationMetadata, pathSet); + return castArg; + } + + @Override + 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 { + 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"); + } + @Override + public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { + 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"); + } + @Override + 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 { + 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"); + } + } + + public static class DanishPigMap extends FrozenMap<@Nullable Object> { + protected DanishPigMap(FrozenMap<@Nullable Object> m) { + super(m); + } + public static final Set requiredKeys = Set.of( + "className" + ); + public static final Set optionalKeys = Set.of(); + public static DanishPigMap of(Map arg, SchemaConfiguration configuration) throws ValidationException { + return DanishPig1.getInstance().validate(arg, configuration); + } + + public String className() { + @Nullable Object value = get("className"); + if (!(value instanceof String)) { + throw new RuntimeException("Invalid value stored for className"); + } + return (String) value; + } + + public @Nullable Object getAdditionalProperty(String name) throws UnsetPropertyException, InvalidAdditionalPropertyException { + throwIfKeyKnown(name, requiredKeys, optionalKeys); + throwIfKeyNotPresent(name); + return get(name); + } + } + + public interface SetterForClassName { + Map getInstance(); + T getBuilderAfterClassName(Map instance); + + default T className(String value) { + var instance = getInstance(); + instance.put("className", value); + return getBuilderAfterClassName(instance); + } + + default T className(StringClassNameEnums value) { + var instance = getInstance(); + instance.put("className", value.value()); + return getBuilderAfterClassName(instance); + } + } + + public static class DanishPigMap0Builder extends UnsetAddPropsSetter implements GenericBuilder> { + private final Map instance; + private static final Set knownKeys = Set.of( + "className" + ); + public Set getKnownKeys() { + return knownKeys; + } + public DanishPigMap0Builder(Map instance) { + this.instance = instance; + } + public Map build() { + return instance; + } + public Map getInstance() { + return instance; + } + public DanishPigMap0Builder getBuilderAfterAdditionalProperty(Map instance) { + return this; + } + } + + public static class DanishPigMapBuilder implements SetterForClassName { + private final Map instance; + public DanishPigMapBuilder() { + this.instance = new LinkedHashMap<>(); + } + public Map getInstance() { + return instance; + } + public DanishPigMap0Builder getBuilderAfterClassName(Map instance) { + return new DanishPigMap0Builder(instance); + } + } + + + public sealed interface DanishPig1Boxed permits DanishPig1BoxedMap { + @Nullable Object getData(); + } + + public record DanishPig1BoxedMap(DanishPigMap data) implements DanishPig1Boxed { + @Override + public @Nullable Object getData() { + return data; + } + } + + + public static class DanishPig1 extends JsonSchema implements MapSchemaValidator { + /* + NOTE: This class is auto generated by OpenAPI JSON Schema Generator. + Ref: https://github.com/openapi-json-schema-tools/openapi-json-schema-generator + + Do not edit the class manually. + */ + private static @Nullable DanishPig1 instance = null; + + protected DanishPig1() { + super(new JsonSchemaInfo() + .type(Set.of(Map.class)) + .properties(Map.ofEntries( + new PropertyEntry("className", ClassName.class) + )) + .required(Set.of( + "className" + )) + ); + } + + public static DanishPig1 getInstance() { + if (instance == null) { + instance = new DanishPig1(); + } + return instance; + } + + 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 RuntimeException("Invalid non-string key value"); + } + String propertyName = (String) entryKey; + List propertyPathToItem = new ArrayList<>(pathToItem); + propertyPathToItem.add(propertyName); + Object value = entry.getValue(); + LinkedHashMap, Nothing?> schemas = pathToSchemas.get(propertyPathToItem); + if (schemas == null) { + throw new RuntimeException("Validation result is invalid, schemas must exist for a pathToItem"); + } + JsonSchema propertySchema = schemas.entrySet().iterator().next().getKey(); + @Nullable Object propertyInstance = propertySchema.getNewInstance(value, propertyPathToItem, pathToSchemas); + properties.put(propertyName, propertyInstance); + } + FrozenMap<@Nullable Object> castProperties = new FrozenMap<>(properties); + return new DanishPigMap(castProperties); + } + + 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); + SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().build())); + ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, new PathToSchemasMap(), new LinkedHashSet<>()); + PathToSchemasMap pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet); + return getNewInstance(castArg, validationMetadata.pathToItem(), pathToSchemasMap); + } + + + @Override + public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws 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"); + } + @Override + public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { + if (arg instanceof Map) { + return getNewInstance((Map) arg, pathToItem, pathToSchemas); + } + 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 { + return new DanishPig1BoxedMap(validate(arg, configuration)); + } + @Override + public DanishPig1Boxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { + 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"); + } + } + +} diff --git a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/schemas/DateTimeTest.kt b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/schemas/DateTimeTest.kt new file mode 100644 index 00000000000..54cebf78aeb --- /dev/null +++ b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/schemas/DateTimeTest.kt @@ -0,0 +1,105 @@ +package org.openapijsonschematools.client.components.schemas; +import java.time.ZonedDateTime; +import java.util.HashSet; +import java.util.LinkedHashSet; +import java.util.List; +import java.util.Objects; +import java.util.Set; +import org.checkerframework.checker.nullness.qual.Nullable; +import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags; +import org.openapijsonschematools.client.configurations.SchemaConfiguration; +import org.openapijsonschematools.client.exceptions.ValidationException; +import org.openapijsonschematools.client.schemas.validation.DefaultValueMethod; +import org.openapijsonschematools.client.schemas.validation.JsonSchema; +import org.openapijsonschematools.client.schemas.validation.JsonSchemaInfo; +import org.openapijsonschematools.client.schemas.validation.PathToSchemasMap; +import org.openapijsonschematools.client.schemas.validation.StringSchemaValidator; +import org.openapijsonschematools.client.schemas.validation.ValidationMetadata; + +public class DateTimeTest { + // nest classes so all schemas and input/output classes can be public + + + public sealed interface DateTimeTest1Boxed permits DateTimeTest1BoxedString { + @Nullable Object getData(); + } + + public record DateTimeTest1BoxedString(String data) implements DateTimeTest1Boxed { + @Override + public @Nullable Object getData() { + return data; + } + } + + + + public static class DateTimeTest1 extends JsonSchema implements StringSchemaValidator, DefaultValueMethod { + /* + NOTE: This class is auto generated by OpenAPI JSON Schema Generator. + Ref: https://github.com/openapi-json-schema-tools/openapi-json-schema-generator + + Do not edit the class manually. + */ + private static @Nullable DateTimeTest1 instance = null; + + protected DateTimeTest1() { + super(new JsonSchemaInfo() + .type(Set.of( + String.class + )) + .format("date-time") + .defaultValue("2010-01-01T10:10:10.000111+01:00") + ); + } + + public static DateTimeTest1 getInstance() { + if (instance == null) { + instance = new DateTimeTest1(); + } + return instance; + } + + @Override + public String validate(String arg, SchemaConfiguration configuration) throws ValidationException { + Set> pathSet = new HashSet<>(); + List pathToItem = List.of("args[0"); + String castArg = castToAllowedTypes(arg, pathToItem, pathSet); + SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().build())); + ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, new PathToSchemasMap(), new LinkedHashSet<>()); + getPathToSchemas(this, castArg, validationMetadata, pathSet); + return castArg; + } + + @Override + public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws 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"); + } + @Override + public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { + 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"); + } + public String defaultValue() throws ValidationException { + if (defaultValue instanceof String) { + return (String) defaultValue; + } + throw new ValidationException("Invalid type stored in defaultValue"); + } + @Override + 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 { + 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"); + } + } +} diff --git a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/schemas/DateTimeWithValidations.kt b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/schemas/DateTimeWithValidations.kt new file mode 100644 index 00000000000..5fa8cfa1bf7 --- /dev/null +++ b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/schemas/DateTimeWithValidations.kt @@ -0,0 +1,101 @@ +package org.openapijsonschematools.client.components.schemas; +import java.time.ZonedDateTime; +import java.util.HashSet; +import java.util.LinkedHashSet; +import java.util.List; +import java.util.Objects; +import java.util.Set; +import java.util.regex.Pattern; +import org.checkerframework.checker.nullness.qual.Nullable; +import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags; +import org.openapijsonschematools.client.configurations.SchemaConfiguration; +import org.openapijsonschematools.client.exceptions.ValidationException; +import org.openapijsonschematools.client.schemas.validation.JsonSchema; +import org.openapijsonschematools.client.schemas.validation.JsonSchemaInfo; +import org.openapijsonschematools.client.schemas.validation.PathToSchemasMap; +import org.openapijsonschematools.client.schemas.validation.StringSchemaValidator; +import org.openapijsonschematools.client.schemas.validation.ValidationMetadata; + +public class DateTimeWithValidations { + // nest classes so all schemas and input/output classes can be public + + + public sealed interface DateTimeWithValidations1Boxed permits DateTimeWithValidations1BoxedString { + @Nullable Object getData(); + } + + public record DateTimeWithValidations1BoxedString(String data) implements DateTimeWithValidations1Boxed { + @Override + public @Nullable Object getData() { + return data; + } + } + + + + public static class DateTimeWithValidations1 extends JsonSchema implements StringSchemaValidator { + /* + NOTE: This class is auto generated by OpenAPI JSON Schema Generator. + Ref: https://github.com/openapi-json-schema-tools/openapi-json-schema-generator + + Do not edit the class manually. + */ + private static @Nullable DateTimeWithValidations1 instance = null; + + protected DateTimeWithValidations1() { + super(new JsonSchemaInfo() + .type(Set.of( + String.class + )) + .format("date-time") + .pattern(Pattern.compile( + "^2020.*" + )) + ); + } + + public static DateTimeWithValidations1 getInstance() { + if (instance == null) { + instance = new DateTimeWithValidations1(); + } + return instance; + } + + @Override + public String validate(String arg, SchemaConfiguration configuration) throws ValidationException { + Set> pathSet = new HashSet<>(); + List pathToItem = List.of("args[0"); + String castArg = castToAllowedTypes(arg, pathToItem, pathSet); + SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().build())); + ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, new PathToSchemasMap(), new LinkedHashSet<>()); + getPathToSchemas(this, castArg, validationMetadata, pathSet); + return castArg; + } + + @Override + public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws 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"); + } + @Override + public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { + 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"); + } + @Override + 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 { + 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"); + } + } +} diff --git a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/schemas/DateWithValidations.kt b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/schemas/DateWithValidations.kt new file mode 100644 index 00000000000..37e06a9b8ee --- /dev/null +++ b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/schemas/DateWithValidations.kt @@ -0,0 +1,101 @@ +package org.openapijsonschematools.client.components.schemas; +import java.time.LocalDate; +import java.util.HashSet; +import java.util.LinkedHashSet; +import java.util.List; +import java.util.Objects; +import java.util.Set; +import java.util.regex.Pattern; +import org.checkerframework.checker.nullness.qual.Nullable; +import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags; +import org.openapijsonschematools.client.configurations.SchemaConfiguration; +import org.openapijsonschematools.client.exceptions.ValidationException; +import org.openapijsonschematools.client.schemas.validation.JsonSchema; +import org.openapijsonschematools.client.schemas.validation.JsonSchemaInfo; +import org.openapijsonschematools.client.schemas.validation.PathToSchemasMap; +import org.openapijsonschematools.client.schemas.validation.StringSchemaValidator; +import org.openapijsonschematools.client.schemas.validation.ValidationMetadata; + +public class DateWithValidations { + // nest classes so all schemas and input/output classes can be public + + + public sealed interface DateWithValidations1Boxed permits DateWithValidations1BoxedString { + @Nullable Object getData(); + } + + public record DateWithValidations1BoxedString(String data) implements DateWithValidations1Boxed { + @Override + public @Nullable Object getData() { + return data; + } + } + + + + public static class DateWithValidations1 extends JsonSchema implements StringSchemaValidator { + /* + NOTE: This class is auto generated by OpenAPI JSON Schema Generator. + Ref: https://github.com/openapi-json-schema-tools/openapi-json-schema-generator + + Do not edit the class manually. + */ + private static @Nullable DateWithValidations1 instance = null; + + protected DateWithValidations1() { + super(new JsonSchemaInfo() + .type(Set.of( + String.class + )) + .format("date") + .pattern(Pattern.compile( + "^2020.*" + )) + ); + } + + public static DateWithValidations1 getInstance() { + if (instance == null) { + instance = new DateWithValidations1(); + } + return instance; + } + + @Override + public String validate(String arg, SchemaConfiguration configuration) throws ValidationException { + Set> pathSet = new HashSet<>(); + List pathToItem = List.of("args[0"); + String castArg = castToAllowedTypes(arg, pathToItem, pathSet); + SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().build())); + ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, new PathToSchemasMap(), new LinkedHashSet<>()); + getPathToSchemas(this, castArg, validationMetadata, pathSet); + return castArg; + } + + @Override + public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws 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"); + } + @Override + public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { + 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"); + } + @Override + 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 { + 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"); + } + } +} diff --git a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/schemas/DecimalPayload.kt b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/schemas/DecimalPayload.kt new file mode 100644 index 00000000000..e2388b2f7b9 --- /dev/null +++ b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/schemas/DecimalPayload.kt @@ -0,0 +1,19 @@ +package org.openapijsonschematools.client.components.schemas; +import org.checkerframework.checker.nullness.qual.Nullable; +import org.openapijsonschematools.client.schemas.DecimalJsonSchema; + +public class DecimalPayload extends DecimalJsonSchema { + // nest classes so all schemas and input/output classes can be public + + + public static class DecimalPayload1 extends DecimalJsonSchema.DecimalJsonSchema1 { + private static @Nullable DecimalPayload1 instance = null; + public static DecimalPayload1 getInstance() { + if (instance == null) { + instance = new DecimalPayload1(); + } + return instance; + } + } + +} diff --git a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/schemas/Dog.kt b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/schemas/Dog.kt new file mode 100644 index 00000000000..a76f7e42185 --- /dev/null +++ b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/schemas/Dog.kt @@ -0,0 +1,503 @@ +package org.openapijsonschematools.client.components.schemas; +import java.time.LocalDate; +import java.time.ZonedDateTime; +import java.util.ArrayList; +import java.util.HashSet; +import java.util.LinkedHashMap; +import java.util.LinkedHashSet; +import java.util.List; +import java.util.Map; +import java.util.Objects; +import java.util.Set; +import java.util.UUID; +import org.checkerframework.checker.nullness.qual.Nullable; +import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags; +import org.openapijsonschematools.client.configurations.SchemaConfiguration; +import org.openapijsonschematools.client.exceptions.InvalidAdditionalPropertyException; +import org.openapijsonschematools.client.exceptions.UnsetPropertyException; +import org.openapijsonschematools.client.exceptions.ValidationException; +import org.openapijsonschematools.client.schemas.GenericBuilder; +import org.openapijsonschematools.client.schemas.StringJsonSchema; +import org.openapijsonschematools.client.schemas.UnsetAddPropsSetter; +import org.openapijsonschematools.client.schemas.validation.BooleanSchemaValidator; +import org.openapijsonschematools.client.schemas.validation.FrozenList; +import org.openapijsonschematools.client.schemas.validation.FrozenMap; +import org.openapijsonschematools.client.schemas.validation.JsonSchema; +import org.openapijsonschematools.client.schemas.validation.JsonSchemaInfo; +import org.openapijsonschematools.client.schemas.validation.ListSchemaValidator; +import org.openapijsonschematools.client.schemas.validation.MapSchemaValidator; +import org.openapijsonschematools.client.schemas.validation.NullSchemaValidator; +import org.openapijsonschematools.client.schemas.validation.NumberSchemaValidator; +import org.openapijsonschematools.client.schemas.validation.PathToSchemasMap; +import org.openapijsonschematools.client.schemas.validation.PropertyEntry; +import org.openapijsonschematools.client.schemas.validation.StringSchemaValidator; +import org.openapijsonschematools.client.schemas.validation.ValidationMetadata; + +public class Dog { + // nest classes so all schemas and input/output classes can be public + + + public static class Breed extends StringJsonSchema.StringJsonSchema1 { + private static @Nullable Breed instance = null; + public static Breed getInstance() { + if (instance == null) { + instance = new Breed(); + } + return instance; + } + } + + + public static class Schema1Map extends FrozenMap<@Nullable Object> { + protected Schema1Map(FrozenMap<@Nullable Object> m) { + super(m); + } + public static final Set requiredKeys = Set.of(); + public static final Set optionalKeys = Set.of( + "breed" + ); + public static Schema1Map of(Map arg, SchemaConfiguration configuration) throws ValidationException { + return Schema1.getInstance().validate(arg, configuration); + } + + public String breed() throws UnsetPropertyException { + String key = "breed"; + throwIfKeyNotPresent(key); + @Nullable Object value = get(key); + if (!(value instanceof String)) { + throw new RuntimeException("Invalid value stored for breed"); + } + return (String) value; + } + + public @Nullable Object getAdditionalProperty(String name) throws UnsetPropertyException, InvalidAdditionalPropertyException { + throwIfKeyKnown(name, requiredKeys, optionalKeys); + throwIfKeyNotPresent(name); + return get(name); + } + } + + public interface SetterForBreed { + Map getInstance(); + T getBuilderAfterBreed(Map instance); + + default T breed(String value) { + var instance = getInstance(); + instance.put("breed", value); + return getBuilderAfterBreed(instance); + } + } + + public static class Schema1MapBuilder extends UnsetAddPropsSetter implements GenericBuilder>, SetterForBreed { + private final Map instance; + private static final Set knownKeys = Set.of( + "breed" + ); + public Set getKnownKeys() { + return knownKeys; + } + public Schema1MapBuilder() { + this.instance = new LinkedHashMap<>(); + } + public Map build() { + return instance; + } + public Map getInstance() { + return instance; + } + public Schema1MapBuilder getBuilderAfterBreed(Map instance) { + return this; + } + public Schema1MapBuilder getBuilderAfterAdditionalProperty(Map instance) { + return this; + } + } + + + public sealed interface Schema1Boxed permits Schema1BoxedMap { + @Nullable Object getData(); + } + + public record Schema1BoxedMap(Schema1Map data) implements Schema1Boxed { + @Override + public @Nullable Object getData() { + return data; + } + } + + + public static class Schema1 extends JsonSchema implements MapSchemaValidator { + private static @Nullable Schema1 instance = null; + + protected Schema1() { + super(new JsonSchemaInfo() + .type(Set.of(Map.class)) + .properties(Map.ofEntries( + new PropertyEntry("breed", Breed.class) + )) + ); + } + + public static Schema1 getInstance() { + if (instance == null) { + instance = new Schema1(); + } + return instance; + } + + 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 RuntimeException("Invalid non-string key value"); + } + String propertyName = (String) entryKey; + List propertyPathToItem = new ArrayList<>(pathToItem); + propertyPathToItem.add(propertyName); + Object value = entry.getValue(); + LinkedHashMap, Nothing?> schemas = pathToSchemas.get(propertyPathToItem); + if (schemas == null) { + throw new RuntimeException("Validation result is invalid, schemas must exist for a pathToItem"); + } + JsonSchema propertySchema = schemas.entrySet().iterator().next().getKey(); + @Nullable Object propertyInstance = propertySchema.getNewInstance(value, propertyPathToItem, pathToSchemas); + properties.put(propertyName, propertyInstance); + } + FrozenMap<@Nullable Object> castProperties = new FrozenMap<>(properties); + return new Schema1Map(castProperties); + } + + 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); + SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().build())); + ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, new PathToSchemasMap(), new LinkedHashSet<>()); + PathToSchemasMap pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet); + return getNewInstance(castArg, validationMetadata.pathToItem(), pathToSchemasMap); + } + + + @Override + public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws 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"); + } + @Override + public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { + if (arg instanceof Map) { + return getNewInstance((Map) arg, pathToItem, pathToSchemas); + } + 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 { + return new Schema1BoxedMap(validate(arg, configuration)); + } + @Override + public Schema1Boxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { + 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"); + } + } + + + public sealed interface Dog1Boxed permits Dog1BoxedVoid, Dog1BoxedBoolean, Dog1BoxedNumber, Dog1BoxedString, Dog1BoxedList, Dog1BoxedMap { + @Nullable Object getData(); + } + + public record Dog1BoxedVoid(Nothing? data) implements Dog1Boxed { + @Override + public @Nullable Object getData() { + return data; + } + } + + public record Dog1BoxedBoolean(boolean data) implements Dog1Boxed { + @Override + public @Nullable Object getData() { + return data; + } + } + + public record Dog1BoxedNumber(Number data) implements Dog1Boxed { + @Override + public @Nullable Object getData() { + return data; + } + } + + public record Dog1BoxedString(String data) implements Dog1Boxed { + @Override + public @Nullable Object getData() { + return data; + } + } + + public record Dog1BoxedList(FrozenList<@Nullable Object> data) implements Dog1Boxed { + @Override + public @Nullable Object getData() { + return data; + } + } + + public record Dog1BoxedMap(FrozenMap<@Nullable Object> data) implements Dog1Boxed { + @Override + public @Nullable Object getData() { + return data; + } + } + + + public static class Dog1 extends JsonSchema implements NullSchemaValidator, BooleanSchemaValidator, NumberSchemaValidator, StringSchemaValidator, ListSchemaValidator, Dog1BoxedList>, MapSchemaValidator, Dog1BoxedMap> { + /* + NOTE: This class is auto generated by OpenAPI JSON Schema Generator. + Ref: https://github.com/openapi-json-schema-tools/openapi-json-schema-generator + + Do not edit the class manually. + */ + private static @Nullable Dog1 instance = null; + + protected Dog1() { + super(new JsonSchemaInfo() + .allOf(List.of( + Animal.Animal1.class, + Schema1.class + )) + ); + } + + public static Dog1 getInstance() { + if (instance == null) { + instance = new Dog1(); + } + return instance; + } + + @Override + public Nothing? validate(Nothing? arg, SchemaConfiguration configuration) throws ValidationException { + Set> pathSet = new HashSet<>(); + List pathToItem = List.of("args[0]"); + Nothing? castArg = castToAllowedTypes(arg, pathToItem, pathSet); + SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().build())); + PathToSchemasMap validatedPathToSchemas = new PathToSchemasMap(); + ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, new LinkedHashSet<>()); + getPathToSchemas(this, castArg, validationMetadata, pathSet); + return castArg; + } + + @Override + public boolean validate(boolean arg, SchemaConfiguration configuration) throws ValidationException { + Set> pathSet = new HashSet<>(); + List pathToItem = List.of("args[0]"); + boolean castArg = castToAllowedTypes(arg, pathToItem, pathSet); + SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().build())); + PathToSchemasMap validatedPathToSchemas = new PathToSchemasMap(); + ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, new LinkedHashSet<>()); + getPathToSchemas(this, castArg, validationMetadata, pathSet); + return castArg; + } + + @Override + public Number validate(Number arg, SchemaConfiguration configuration) throws ValidationException { + Set> pathSet = new HashSet<>(); + List pathToItem = List.of("args[0]"); + Number castArg = castToAllowedTypes(arg, pathToItem, pathSet); + SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().build())); + PathToSchemasMap validatedPathToSchemas = new PathToSchemasMap(); + ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, new LinkedHashSet<>()); + getPathToSchemas(this, castArg, validationMetadata, pathSet); + return castArg; + } + + public int validate(int arg, SchemaConfiguration configuration) throws ValidationException { + return (int) validate((Number) arg, configuration); + } + + public long validate(long arg, SchemaConfiguration configuration) throws ValidationException { + return (long) validate((Number) arg, configuration); + } + + public float validate(float arg, SchemaConfiguration configuration) throws ValidationException { + return (float) validate((Number) arg, configuration); + } + + public double validate(double arg, SchemaConfiguration configuration) throws ValidationException { + return (double) validate((Number) arg, configuration); + } + + @Override + public String validate(String arg, SchemaConfiguration configuration) throws ValidationException { + Set> pathSet = new HashSet<>(); + List pathToItem = List.of("args[0]"); + String castArg = castToAllowedTypes(arg, pathToItem, pathSet); + SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().build())); + PathToSchemasMap validatedPathToSchemas = new PathToSchemasMap(); + ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, new LinkedHashSet<>()); + getPathToSchemas(this, castArg, validationMetadata, pathSet); + return castArg; + } + + public String validate(LocalDate arg, SchemaConfiguration configuration) throws ValidationException { + return validate(arg.toString(), configuration); + } + + public String validate(ZonedDateTime arg, SchemaConfiguration configuration) throws ValidationException { + return validate(arg.toString(), configuration); + } + + public String validate(UUID arg, SchemaConfiguration configuration) throws ValidationException { + return validate(arg.toString(), configuration); + } + + @Override + public FrozenList<@Nullable Object> getNewInstance(List arg, List pathToItem, PathToSchemasMap pathToSchemas) { + List<@Nullable Object> items = new ArrayList<>(); + int i = 0; + for (Object item: arg) { + List itemPathToItem = new ArrayList<>(pathToItem); + itemPathToItem.add(i); + LinkedHashMap, Nothing?> schemas = pathToSchemas.get(itemPathToItem); + if (schemas == null) { + throw new RuntimeException("Validation result is invalid, schemas must exist for a pathToItem"); + } + JsonSchema itemSchema = schemas.entrySet().iterator().next().getKey(); + @Nullable Object itemInstance = itemSchema.getNewInstance(item, itemPathToItem, pathToSchemas); + items.add(itemInstance); + i += 1; + } + FrozenList<@Nullable Object> newInstanceItems = new FrozenList<>(items); + return newInstanceItems; + } + + 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); + SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().build())); + ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, new PathToSchemasMap(), new LinkedHashSet<>()); + PathToSchemasMap pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet); + return getNewInstance(castArg, validationMetadata.pathToItem(), pathToSchemasMap); + } + + @Override + 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 RuntimeException("Invalid non-string key value"); + } + String propertyName = (String) entryKey; + List propertyPathToItem = new ArrayList<>(pathToItem); + propertyPathToItem.add(propertyName); + Object value = entry.getValue(); + LinkedHashMap, Nothing?> schemas = pathToSchemas.get(propertyPathToItem); + if (schemas == null) { + throw new RuntimeException("Validation result is invalid, schemas must exist for a pathToItem"); + } + JsonSchema propertySchema = schemas.entrySet().iterator().next().getKey(); + @Nullable Object propertyInstance = propertySchema.getNewInstance(value, propertyPathToItem, pathToSchemas); + properties.put(propertyName, propertyInstance); + } + FrozenMap<@Nullable Object> castProperties = new FrozenMap<>(properties); + return castProperties; + } + + public FrozenMap<@Nullable Object> validate(Map arg, SchemaConfiguration configuration) throws ValidationException { + Set> pathSet = new HashSet<>(); + List pathToItem = List.of("args[0]"); + Map castArg = castToAllowedTypes(arg, pathToItem, pathSet); + SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().build())); + PathToSchemasMap validatedPathToSchemas = new PathToSchemasMap(); + ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, new LinkedHashSet<>()); + PathToSchemasMap pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet); + return getNewInstance(castArg, validationMetadata.pathToItem(), pathToSchemasMap); + } + + @Override + public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { + if (arg == null) { + return validate((Nothing?) null, configuration); + } else if (arg instanceof Boolean) { + boolean boolArg = (Boolean) arg; + return validate(boolArg, configuration); + } else if (arg instanceof Number) { + return validate((Number) arg, configuration); + } else if (arg instanceof String) { + return validate((String) arg, configuration); + } else if (arg instanceof List) { + return validate((List) arg, 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"); + } + @Override + public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { + if (arg == null) { + return getNewInstance((Nothing?) null, pathToItem, pathToSchemas); + } else if (arg instanceof Boolean) { + boolean boolArg = (Boolean) arg; + return getNewInstance(boolArg, pathToItem, pathToSchemas); + } else if (arg instanceof Number) { + return getNewInstance((Number) arg, pathToItem, pathToSchemas); + } else if (arg instanceof String) { + return getNewInstance((String) arg, pathToItem, pathToSchemas); + } else if (arg instanceof List) { + return getNewInstance((List) arg, 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"); + } + @Override + public Dog1BoxedVoid validateAndBox(Nothing? arg, SchemaConfiguration configuration) throws ValidationException { + return new Dog1BoxedVoid(validate(arg, configuration)); + } + @Override + 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 { + return new Dog1BoxedNumber(validate(arg, configuration)); + } + @Override + 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 { + return new Dog1BoxedList(validate(arg, configuration)); + } + @Override + 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 { + if (arg == null) { + Nothing? castArg = (Nothing?) arg; + return validateAndBox(castArg, configuration); + } else if (arg instanceof Boolean booleanArg) { + boolean castArg = booleanArg; + return validateAndBox(castArg, configuration); + } else if (arg instanceof String castArg) { + return validateAndBox(castArg, configuration); + } else if (arg instanceof Number castArg) { + return validateAndBox(castArg, configuration); + } else if (arg instanceof List castArg) { + 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"); + } + } +} diff --git a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/schemas/Drawing.kt b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/schemas/Drawing.kt new file mode 100644 index 00000000000..cd536f89a1d --- /dev/null +++ b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/schemas/Drawing.kt @@ -0,0 +1,656 @@ +package org.openapijsonschematools.client.components.schemas; +import java.util.ArrayList; +import java.util.HashSet; +import java.util.LinkedHashMap; +import java.util.LinkedHashSet; +import java.util.List; +import java.util.Map; +import java.util.Objects; +import java.util.Set; +import org.checkerframework.checker.nullness.qual.Nullable; +import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags; +import org.openapijsonschematools.client.configurations.SchemaConfiguration; +import org.openapijsonschematools.client.exceptions.InvalidAdditionalPropertyException; +import org.openapijsonschematools.client.exceptions.UnsetPropertyException; +import org.openapijsonschematools.client.exceptions.ValidationException; +import org.openapijsonschematools.client.schemas.GenericBuilder; +import org.openapijsonschematools.client.schemas.validation.FrozenList; +import org.openapijsonschematools.client.schemas.validation.FrozenMap; +import org.openapijsonschematools.client.schemas.validation.JsonSchema; +import org.openapijsonschematools.client.schemas.validation.JsonSchemaInfo; +import org.openapijsonschematools.client.schemas.validation.ListSchemaValidator; +import org.openapijsonschematools.client.schemas.validation.MapSchemaValidator; +import org.openapijsonschematools.client.schemas.validation.MapUtils; +import org.openapijsonschematools.client.schemas.validation.PathToSchemasMap; +import org.openapijsonschematools.client.schemas.validation.PropertyEntry; +import org.openapijsonschematools.client.schemas.validation.ValidationMetadata; + +public class Drawing { + // nest classes so all schemas and input/output classes can be public + + + 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 { + return Shapes.getInstance().validate(arg, configuration); + } + } + + public static class ShapesListBuilder { + // class to build List<@Nullable Object> + private final List<@Nullable Object> list; + + public ShapesListBuilder() { + list = new ArrayList<>(); + } + + public ShapesListBuilder(List<@Nullable Object> list) { + this.list = list; + } + + public ShapesListBuilder add(Nothing? item) { + list.add(null); + return this; + } + + public ShapesListBuilder add(boolean item) { + list.add(item); + return this; + } + + public ShapesListBuilder add(String item) { + list.add(item); + return this; + } + + public ShapesListBuilder add(int item) { + list.add(item); + return this; + } + + public ShapesListBuilder add(float item) { + list.add(item); + return this; + } + + public ShapesListBuilder add(long item) { + list.add(item); + return this; + } + + public ShapesListBuilder add(double item) { + list.add(item); + return this; + } + + public ShapesListBuilder add(List item) { + list.add(item); + return this; + } + + public ShapesListBuilder add(Map item) { + list.add(item); + return this; + } + + public List<@Nullable Object> build() { + return list; + } + } + + + public sealed interface ShapesBoxed permits ShapesBoxedList { + @Nullable Object getData(); + } + + public record ShapesBoxedList(ShapesList data) implements ShapesBoxed { + @Override + public @Nullable Object getData() { + return data; + } + } + + + + public static class Shapes extends JsonSchema implements ListSchemaValidator { + private static @Nullable Shapes instance = null; + + protected Shapes() { + super(new JsonSchemaInfo() + .type(Set.of(List.class)) + .items(Shape.Shape1.class) + ); + } + + public static Shapes getInstance() { + if (instance == null) { + instance = new Shapes(); + } + return instance; + } + + @Override + public ShapesList getNewInstance(List arg, List pathToItem, PathToSchemasMap pathToSchemas) { + List<@Nullable Object> items = new ArrayList<>(); + int i = 0; + for (Object item: arg) { + List itemPathToItem = new ArrayList<>(pathToItem); + itemPathToItem.add(i); + LinkedHashMap, Nothing?> schemas = pathToSchemas.get(itemPathToItem); + if (schemas == null) { + throw new RuntimeException("Validation 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"); + } + items.add((@Nullable Object) itemInstance); + i += 1; + } + FrozenList<@Nullable Object> newInstanceItems = new FrozenList<>(items); + return new ShapesList(newInstanceItems); + } + + 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); + SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().build())); + ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, new PathToSchemasMap(), new LinkedHashSet<>()); + PathToSchemasMap pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet); + return getNewInstance(castArg, validationMetadata.pathToItem(), pathToSchemasMap); + } + + @Override + public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws 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"); + } + @Override + public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { + 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"); + } + @Override + 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 { + 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"); + } + } + + public static class DrawingMap extends FrozenMap<@Nullable Object> { + protected DrawingMap(FrozenMap<@Nullable Object> m) { + super(m); + } + public static final Set requiredKeys = Set.of(); + public static final Set optionalKeys = Set.of( + "mainShape", + "shapeOrNull", + "nullableShape", + "shapes" + ); + public static DrawingMap of(Map arg, SchemaConfiguration configuration) throws ValidationException { + return Drawing1.getInstance().validate(arg, configuration); + } + + public @Nullable Object mainShape() throws UnsetPropertyException { + String key = "mainShape"; + throwIfKeyNotPresent(key); + @Nullable Object value = get(key); + if (!(value instanceof Object)) { + throw new RuntimeException("Invalid value stored for mainShape"); + } + return (@Nullable Object) value; + } + + public @Nullable Object shapeOrNull() throws UnsetPropertyException { + String key = "shapeOrNull"; + throwIfKeyNotPresent(key); + @Nullable Object value = get(key); + if (!(value instanceof Object)) { + throw new RuntimeException("Invalid value stored for shapeOrNull"); + } + return (@Nullable Object) value; + } + + public @Nullable Object nullableShape() throws UnsetPropertyException { + String key = "nullableShape"; + throwIfKeyNotPresent(key); + @Nullable Object value = get(key); + if (!(value instanceof Object)) { + throw new RuntimeException("Invalid value stored for nullableShape"); + } + return (@Nullable Object) value; + } + + public ShapesList shapes() throws UnsetPropertyException { + String key = "shapes"; + throwIfKeyNotPresent(key); + @Nullable Object value = get(key); + if (!(value instanceof ShapesList)) { + throw new RuntimeException("Invalid value stored for shapes"); + } + return (ShapesList) value; + } + + public @Nullable Object getAdditionalProperty(String name) throws UnsetPropertyException, InvalidAdditionalPropertyException { + throwIfKeyKnown(name, requiredKeys, optionalKeys); + var value = getOrThrow(name); + if (!(value instanceof Object)) { + throw new RuntimeException("Invalid value stored for " + name); + } + return (@Nullable Object) value; + } + } + + public interface SetterForMainShape { + Map getInstance(); + T getBuilderAfterMainShape(Map instance); + + default T mainShape(Nothing? value) { + var instance = getInstance(); + instance.put("mainShape", null); + return getBuilderAfterMainShape(instance); + } + + default T mainShape(boolean value) { + var instance = getInstance(); + instance.put("mainShape", value); + return getBuilderAfterMainShape(instance); + } + + default T mainShape(String value) { + var instance = getInstance(); + instance.put("mainShape", value); + return getBuilderAfterMainShape(instance); + } + + default T mainShape(int value) { + var instance = getInstance(); + instance.put("mainShape", value); + return getBuilderAfterMainShape(instance); + } + + default T mainShape(float value) { + var instance = getInstance(); + instance.put("mainShape", value); + return getBuilderAfterMainShape(instance); + } + + default T mainShape(long value) { + var instance = getInstance(); + instance.put("mainShape", value); + return getBuilderAfterMainShape(instance); + } + + default T mainShape(double value) { + var instance = getInstance(); + instance.put("mainShape", value); + return getBuilderAfterMainShape(instance); + } + + default T mainShape(List value) { + var instance = getInstance(); + instance.put("mainShape", value); + return getBuilderAfterMainShape(instance); + } + + default T mainShape(Map value) { + var instance = getInstance(); + instance.put("mainShape", value); + return getBuilderAfterMainShape(instance); + } + } + + public interface SetterForShapeOrNull { + Map getInstance(); + T getBuilderAfterShapeOrNull(Map instance); + + default T shapeOrNull(Nothing? value) { + var instance = getInstance(); + instance.put("shapeOrNull", null); + return getBuilderAfterShapeOrNull(instance); + } + + default T shapeOrNull(boolean value) { + var instance = getInstance(); + instance.put("shapeOrNull", value); + return getBuilderAfterShapeOrNull(instance); + } + + default T shapeOrNull(String value) { + var instance = getInstance(); + instance.put("shapeOrNull", value); + return getBuilderAfterShapeOrNull(instance); + } + + default T shapeOrNull(int value) { + var instance = getInstance(); + instance.put("shapeOrNull", value); + return getBuilderAfterShapeOrNull(instance); + } + + default T shapeOrNull(float value) { + var instance = getInstance(); + instance.put("shapeOrNull", value); + return getBuilderAfterShapeOrNull(instance); + } + + default T shapeOrNull(long value) { + var instance = getInstance(); + instance.put("shapeOrNull", value); + return getBuilderAfterShapeOrNull(instance); + } + + default T shapeOrNull(double value) { + var instance = getInstance(); + instance.put("shapeOrNull", value); + return getBuilderAfterShapeOrNull(instance); + } + + default T shapeOrNull(List value) { + var instance = getInstance(); + instance.put("shapeOrNull", value); + return getBuilderAfterShapeOrNull(instance); + } + + default T shapeOrNull(Map value) { + var instance = getInstance(); + instance.put("shapeOrNull", value); + return getBuilderAfterShapeOrNull(instance); + } + } + + public interface SetterForNullableShape { + Map getInstance(); + T getBuilderAfterNullableShape(Map instance); + + default T nullableShape(Nothing? value) { + var instance = getInstance(); + instance.put("nullableShape", null); + return getBuilderAfterNullableShape(instance); + } + + default T nullableShape(boolean value) { + var instance = getInstance(); + instance.put("nullableShape", value); + return getBuilderAfterNullableShape(instance); + } + + default T nullableShape(String value) { + var instance = getInstance(); + instance.put("nullableShape", value); + return getBuilderAfterNullableShape(instance); + } + + default T nullableShape(int value) { + var instance = getInstance(); + instance.put("nullableShape", value); + return getBuilderAfterNullableShape(instance); + } + + default T nullableShape(float value) { + var instance = getInstance(); + instance.put("nullableShape", value); + return getBuilderAfterNullableShape(instance); + } + + default T nullableShape(long value) { + var instance = getInstance(); + instance.put("nullableShape", value); + return getBuilderAfterNullableShape(instance); + } + + default T nullableShape(double value) { + var instance = getInstance(); + instance.put("nullableShape", value); + return getBuilderAfterNullableShape(instance); + } + + default T nullableShape(List value) { + var instance = getInstance(); + instance.put("nullableShape", value); + return getBuilderAfterNullableShape(instance); + } + + default T nullableShape(Map value) { + var instance = getInstance(); + instance.put("nullableShape", value); + return getBuilderAfterNullableShape(instance); + } + } + + public interface SetterForShapes { + Map getInstance(); + T getBuilderAfterShapes(Map instance); + + default T shapes(List<@Nullable Object> value) { + var instance = getInstance(); + instance.put("shapes", value); + return getBuilderAfterShapes(instance); + } + } + + public interface SetterForAdditionalProperties { + Set getKnownKeys(); + Map getInstance(); + T getBuilderAfterAdditionalProperty(Map instance); + + default T additionalProperty(String key, Nothing? value) throws InvalidAdditionalPropertyException { + MapUtils.throwIfKeyKnown(key, getKnownKeys(), true); + var instance = getInstance(); + instance.put(key, null); + return getBuilderAfterAdditionalProperty(instance); + } + + default T additionalProperty(String key, boolean value) throws InvalidAdditionalPropertyException { + MapUtils.throwIfKeyKnown(key, getKnownKeys(), true); + var instance = getInstance(); + instance.put(key, value); + return getBuilderAfterAdditionalProperty(instance); + } + + default T additionalProperty(String key, String value) throws InvalidAdditionalPropertyException { + MapUtils.throwIfKeyKnown(key, getKnownKeys(), true); + var instance = getInstance(); + instance.put(key, value); + return getBuilderAfterAdditionalProperty(instance); + } + + default T additionalProperty(String key, int value) throws InvalidAdditionalPropertyException { + MapUtils.throwIfKeyKnown(key, getKnownKeys(), true); + var instance = getInstance(); + instance.put(key, value); + return getBuilderAfterAdditionalProperty(instance); + } + + default T additionalProperty(String key, float value) throws InvalidAdditionalPropertyException { + MapUtils.throwIfKeyKnown(key, getKnownKeys(), true); + var instance = getInstance(); + instance.put(key, value); + return getBuilderAfterAdditionalProperty(instance); + } + + default T additionalProperty(String key, long value) throws InvalidAdditionalPropertyException { + MapUtils.throwIfKeyKnown(key, getKnownKeys(), true); + var instance = getInstance(); + instance.put(key, value); + return getBuilderAfterAdditionalProperty(instance); + } + + default T additionalProperty(String key, double value) throws InvalidAdditionalPropertyException { + MapUtils.throwIfKeyKnown(key, getKnownKeys(), true); + var instance = getInstance(); + instance.put(key, value); + return getBuilderAfterAdditionalProperty(instance); + } + + default T additionalProperty(String key, List value) throws InvalidAdditionalPropertyException { + MapUtils.throwIfKeyKnown(key, getKnownKeys(), true); + var instance = getInstance(); + instance.put(key, value); + return getBuilderAfterAdditionalProperty(instance); + } + + default T additionalProperty(String key, Map value) throws InvalidAdditionalPropertyException { + MapUtils.throwIfKeyKnown(key, getKnownKeys(), true); + var instance = getInstance(); + instance.put(key, value); + return getBuilderAfterAdditionalProperty(instance); + } + } + + public static class DrawingMapBuilder implements GenericBuilder>, SetterForMainShape, SetterForShapeOrNull, SetterForNullableShape, SetterForShapes, SetterForAdditionalProperties { + private final Map instance; + private static final Set knownKeys = Set.of( + "mainShape", + "shapeOrNull", + "nullableShape", + "shapes" + ); + public Set getKnownKeys() { + return knownKeys; + } + public DrawingMapBuilder() { + this.instance = new LinkedHashMap<>(); + } + public Map build() { + return instance; + } + public Map getInstance() { + return instance; + } + public DrawingMapBuilder getBuilderAfterMainShape(Map instance) { + return this; + } + public DrawingMapBuilder getBuilderAfterShapeOrNull(Map instance) { + return this; + } + public DrawingMapBuilder getBuilderAfterNullableShape(Map instance) { + return this; + } + public DrawingMapBuilder getBuilderAfterShapes(Map instance) { + return this; + } + public DrawingMapBuilder getBuilderAfterAdditionalProperty(Map instance) { + return this; + } + } + + + public sealed interface Drawing1Boxed permits Drawing1BoxedMap { + @Nullable Object getData(); + } + + public record Drawing1BoxedMap(DrawingMap data) implements Drawing1Boxed { + @Override + public @Nullable Object getData() { + return data; + } + } + + + public static class Drawing1 extends JsonSchema implements MapSchemaValidator { + /* + NOTE: This class is auto generated by OpenAPI JSON Schema Generator. + Ref: https://github.com/openapi-json-schema-tools/openapi-json-schema-generator + + Do not edit the class manually. + */ + private static @Nullable Drawing1 instance = null; + + protected Drawing1() { + super(new JsonSchemaInfo() + .type(Set.of(Map.class)) + .properties(Map.ofEntries( + new PropertyEntry("mainShape", Shape.Shape1.class), + new PropertyEntry("shapeOrNull", ShapeOrNull.ShapeOrNull1.class), + new PropertyEntry("nullableShape", NullableShape.NullableShape1.class), + new PropertyEntry("shapes", Shapes.class) + )) + .additionalProperties(Fruit.Fruit1.class) + ); + } + + public static Drawing1 getInstance() { + if (instance == null) { + instance = new Drawing1(); + } + return instance; + } + + 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 RuntimeException("Invalid non-string key value"); + } + String propertyName = (String) entryKey; + List propertyPathToItem = new ArrayList<>(pathToItem); + propertyPathToItem.add(propertyName); + Object value = entry.getValue(); + LinkedHashMap, Nothing?> schemas = pathToSchemas.get(propertyPathToItem); + if (schemas == null) { + throw new RuntimeException("Validation result is invalid, schemas must exist for a pathToItem"); + } + JsonSchema propertySchema = schemas.entrySet().iterator().next().getKey(); + @Nullable Object propertyInstance = propertySchema.getNewInstance(value, propertyPathToItem, pathToSchemas); + properties.put(propertyName, propertyInstance); + } + FrozenMap<@Nullable Object> castProperties = new FrozenMap<>(properties); + return new DrawingMap(castProperties); + } + + 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); + SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().build())); + ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, new PathToSchemasMap(), new LinkedHashSet<>()); + PathToSchemasMap pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet); + return getNewInstance(castArg, validationMetadata.pathToItem(), pathToSchemasMap); + } + + + @Override + public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws 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"); + } + @Override + public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { + if (arg instanceof Map) { + return getNewInstance((Map) arg, pathToItem, pathToSchemas); + } + 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 { + return new Drawing1BoxedMap(validate(arg, configuration)); + } + @Override + public Drawing1Boxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { + 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"); + } + } + +} diff --git a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/schemas/EnumArrays.kt b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/schemas/EnumArrays.kt new file mode 100644 index 00000000000..c9d26d014fe --- /dev/null +++ b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/schemas/EnumArrays.kt @@ -0,0 +1,542 @@ +package org.openapijsonschematools.client.components.schemas; +import java.util.ArrayList; +import java.util.HashSet; +import java.util.LinkedHashMap; +import java.util.LinkedHashSet; +import java.util.List; +import java.util.Map; +import java.util.Objects; +import java.util.Set; +import org.checkerframework.checker.nullness.qual.Nullable; +import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags; +import org.openapijsonschematools.client.configurations.SchemaConfiguration; +import org.openapijsonschematools.client.exceptions.InvalidAdditionalPropertyException; +import org.openapijsonschematools.client.exceptions.UnsetPropertyException; +import org.openapijsonschematools.client.exceptions.ValidationException; +import org.openapijsonschematools.client.schemas.GenericBuilder; +import org.openapijsonschematools.client.schemas.SetMaker; +import org.openapijsonschematools.client.schemas.UnsetAddPropsSetter; +import org.openapijsonschematools.client.schemas.validation.FrozenList; +import org.openapijsonschematools.client.schemas.validation.FrozenMap; +import org.openapijsonschematools.client.schemas.validation.JsonSchema; +import org.openapijsonschematools.client.schemas.validation.JsonSchemaInfo; +import org.openapijsonschematools.client.schemas.validation.ListSchemaValidator; +import org.openapijsonschematools.client.schemas.validation.MapSchemaValidator; +import org.openapijsonschematools.client.schemas.validation.PathToSchemasMap; +import org.openapijsonschematools.client.schemas.validation.PropertyEntry; +import org.openapijsonschematools.client.schemas.validation.StringEnumValidator; +import org.openapijsonschematools.client.schemas.validation.StringSchemaValidator; +import org.openapijsonschematools.client.schemas.validation.StringValueMethod; +import org.openapijsonschematools.client.schemas.validation.ValidationMetadata; + +public class EnumArrays { + // nest classes so all schemas and input/output classes can be public + + public enum StringJustSymbolEnums implements StringValueMethod { + GREATER_THAN_SIGN_EQUALS_SIGN(">="), + DOLLAR_SIGN("$"); + private final String value; + + StringJustSymbolEnums(String value) { + this.value = value; + } + public String value() { + return this.value; + } + } + + + public sealed interface JustSymbolBoxed permits JustSymbolBoxedString { + @Nullable Object getData(); + } + + public record JustSymbolBoxedString(String data) implements JustSymbolBoxed { + @Override + public @Nullable Object getData() { + return data; + } + } + + + + public static class JustSymbol extends JsonSchema implements StringSchemaValidator, StringEnumValidator { + private static @Nullable JustSymbol instance = null; + + protected JustSymbol() { + super(new JsonSchemaInfo() + .type(Set.of( + String.class + )) + .enumValues(SetMaker.makeSet( + ">=", + "$" + )) + ); + } + + public static JustSymbol getInstance() { + if (instance == null) { + instance = new JustSymbol(); + } + return instance; + } + + @Override + public String validate(String arg, SchemaConfiguration configuration) throws ValidationException { + Set> pathSet = new HashSet<>(); + List pathToItem = List.of("args[0"); + String castArg = castToAllowedTypes(arg, pathToItem, pathSet); + SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().build())); + ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, new PathToSchemasMap(), new LinkedHashSet<>()); + getPathToSchemas(this, castArg, validationMetadata, pathSet); + return castArg; + } + + @Override + 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 { + 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"); + } + @Override + public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { + 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"); + } + @Override + 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 { + 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"); + } + } + public enum StringItemsEnums implements StringValueMethod { + FISH("fish"), + CRAB("crab"); + private final String value; + + StringItemsEnums(String value) { + this.value = value; + } + public String value() { + return this.value; + } + } + + + public sealed interface ItemsBoxed permits ItemsBoxedString { + @Nullable Object getData(); + } + + public record ItemsBoxedString(String data) implements ItemsBoxed { + @Override + public @Nullable Object getData() { + return data; + } + } + + + + public static class Items extends JsonSchema implements StringSchemaValidator, StringEnumValidator { + private static @Nullable Items instance = null; + + protected Items() { + super(new JsonSchemaInfo() + .type(Set.of( + String.class + )) + .enumValues(SetMaker.makeSet( + "fish", + "crab" + )) + ); + } + + public static Items getInstance() { + if (instance == null) { + instance = new Items(); + } + return instance; + } + + @Override + public String validate(String arg, SchemaConfiguration configuration) throws ValidationException { + Set> pathSet = new HashSet<>(); + List pathToItem = List.of("args[0"); + String castArg = castToAllowedTypes(arg, pathToItem, pathSet); + SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().build())); + ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, new PathToSchemasMap(), new LinkedHashSet<>()); + getPathToSchemas(this, castArg, validationMetadata, pathSet); + return castArg; + } + + @Override + 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 { + 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"); + } + @Override + public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { + 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"); + } + @Override + 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 { + 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"); + } + } + + public static class ArrayEnumList extends FrozenList { + protected ArrayEnumList(FrozenList m) { + super(m); + } + public static ArrayEnumList of(List arg, SchemaConfiguration configuration) throws ValidationException { + return ArrayEnum.getInstance().validate(arg, configuration); + } + } + + public static class ArrayEnumListBuilder { + // class to build List + private final List list; + + public ArrayEnumListBuilder() { + list = new ArrayList<>(); + } + + public ArrayEnumListBuilder(List list) { + this.list = list; + } + + public ArrayEnumListBuilder add(String item) { + list.add(item); + return this; + } + + public ArrayEnumListBuilder add(StringItemsEnums item) { + list.add(item.value()); + return this; + } + + public List build() { + return list; + } + } + + + public sealed interface ArrayEnumBoxed permits ArrayEnumBoxedList { + @Nullable Object getData(); + } + + public record ArrayEnumBoxedList(ArrayEnumList data) implements ArrayEnumBoxed { + @Override + public @Nullable Object getData() { + return data; + } + } + + + + public static class ArrayEnum extends JsonSchema implements ListSchemaValidator { + private static @Nullable ArrayEnum instance = null; + + protected ArrayEnum() { + super(new JsonSchemaInfo() + .type(Set.of(List.class)) + .items(Items.class) + ); + } + + public static ArrayEnum getInstance() { + if (instance == null) { + instance = new ArrayEnum(); + } + return instance; + } + + @Override + public ArrayEnumList getNewInstance(List arg, List pathToItem, PathToSchemasMap pathToSchemas) { + List items = new ArrayList<>(); + int i = 0; + for (Object item: arg) { + List itemPathToItem = new ArrayList<>(pathToItem); + itemPathToItem.add(i); + LinkedHashMap, Nothing?> schemas = pathToSchemas.get(itemPathToItem); + if (schemas == null) { + throw new RuntimeException("Validation 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"); + } + items.add((String) itemInstance); + i += 1; + } + FrozenList newInstanceItems = new FrozenList<>(items); + return new ArrayEnumList(newInstanceItems); + } + + 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); + SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().build())); + ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, new PathToSchemasMap(), new LinkedHashSet<>()); + PathToSchemasMap pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet); + return getNewInstance(castArg, validationMetadata.pathToItem(), pathToSchemasMap); + } + + @Override + public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws 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"); + } + @Override + public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { + 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"); + } + @Override + 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 { + 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"); + } + } + + public static class EnumArraysMap extends FrozenMap<@Nullable Object> { + protected EnumArraysMap(FrozenMap<@Nullable Object> m) { + super(m); + } + public static final Set requiredKeys = Set.of(); + public static final Set optionalKeys = Set.of( + "just_symbol", + "array_enum" + ); + public static EnumArraysMap of(Map arg, SchemaConfiguration configuration) throws ValidationException { + return EnumArrays1.getInstance().validate(arg, configuration); + } + + public String just_symbol() throws UnsetPropertyException { + String key = "just_symbol"; + throwIfKeyNotPresent(key); + @Nullable Object value = get(key); + if (!(value instanceof String)) { + throw new RuntimeException("Invalid value stored for just_symbol"); + } + return (String) value; + } + + public ArrayEnumList array_enum() throws UnsetPropertyException { + String key = "array_enum"; + throwIfKeyNotPresent(key); + @Nullable Object value = get(key); + if (!(value instanceof ArrayEnumList)) { + throw new RuntimeException("Invalid value stored for array_enum"); + } + return (ArrayEnumList) value; + } + + public @Nullable Object getAdditionalProperty(String name) throws UnsetPropertyException, InvalidAdditionalPropertyException { + throwIfKeyKnown(name, requiredKeys, optionalKeys); + throwIfKeyNotPresent(name); + return get(name); + } + } + + public interface SetterForJustSymbol { + Map getInstance(); + T getBuilderAfterJustSymbol(Map instance); + + default T just_symbol(String value) { + var instance = getInstance(); + instance.put("just_symbol", value); + return getBuilderAfterJustSymbol(instance); + } + + default T just_symbol(StringJustSymbolEnums value) { + var instance = getInstance(); + instance.put("just_symbol", value.value()); + return getBuilderAfterJustSymbol(instance); + } + } + + public interface SetterForArrayEnum { + Map getInstance(); + T getBuilderAfterArrayEnum(Map instance); + + default T array_enum(List value) { + var instance = getInstance(); + instance.put("array_enum", value); + return getBuilderAfterArrayEnum(instance); + } + } + + public static class EnumArraysMapBuilder extends UnsetAddPropsSetter implements GenericBuilder>, SetterForJustSymbol, SetterForArrayEnum { + private final Map instance; + private static final Set knownKeys = Set.of( + "just_symbol", + "array_enum" + ); + public Set getKnownKeys() { + return knownKeys; + } + public EnumArraysMapBuilder() { + this.instance = new LinkedHashMap<>(); + } + public Map build() { + return instance; + } + public Map getInstance() { + return instance; + } + public EnumArraysMapBuilder getBuilderAfterJustSymbol(Map instance) { + return this; + } + public EnumArraysMapBuilder getBuilderAfterArrayEnum(Map instance) { + return this; + } + public EnumArraysMapBuilder getBuilderAfterAdditionalProperty(Map instance) { + return this; + } + } + + + public sealed interface EnumArrays1Boxed permits EnumArrays1BoxedMap { + @Nullable Object getData(); + } + + public record EnumArrays1BoxedMap(EnumArraysMap data) implements EnumArrays1Boxed { + @Override + public @Nullable Object getData() { + return data; + } + } + + + public static class EnumArrays1 extends JsonSchema implements MapSchemaValidator { + /* + NOTE: This class is auto generated by OpenAPI JSON Schema Generator. + Ref: https://github.com/openapi-json-schema-tools/openapi-json-schema-generator + + Do not edit the class manually. + */ + private static @Nullable EnumArrays1 instance = null; + + protected EnumArrays1() { + super(new JsonSchemaInfo() + .type(Set.of(Map.class)) + .properties(Map.ofEntries( + new PropertyEntry("just_symbol", JustSymbol.class), + new PropertyEntry("array_enum", ArrayEnum.class) + )) + ); + } + + public static EnumArrays1 getInstance() { + if (instance == null) { + instance = new EnumArrays1(); + } + return instance; + } + + 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 RuntimeException("Invalid non-string key value"); + } + String propertyName = (String) entryKey; + List propertyPathToItem = new ArrayList<>(pathToItem); + propertyPathToItem.add(propertyName); + Object value = entry.getValue(); + LinkedHashMap, Nothing?> schemas = pathToSchemas.get(propertyPathToItem); + if (schemas == null) { + throw new RuntimeException("Validation result is invalid, schemas must exist for a pathToItem"); + } + JsonSchema propertySchema = schemas.entrySet().iterator().next().getKey(); + @Nullable Object propertyInstance = propertySchema.getNewInstance(value, propertyPathToItem, pathToSchemas); + properties.put(propertyName, propertyInstance); + } + FrozenMap<@Nullable Object> castProperties = new FrozenMap<>(properties); + return new EnumArraysMap(castProperties); + } + + 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); + SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().build())); + ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, new PathToSchemasMap(), new LinkedHashSet<>()); + PathToSchemasMap pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet); + return getNewInstance(castArg, validationMetadata.pathToItem(), pathToSchemasMap); + } + + + @Override + public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws 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"); + } + @Override + public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { + if (arg instanceof Map) { + return getNewInstance((Map) arg, pathToItem, pathToSchemas); + } + 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 { + return new EnumArrays1BoxedMap(validate(arg, configuration)); + } + @Override + public EnumArrays1Boxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { + 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"); + } + } + +} diff --git a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/schemas/EnumClass.kt b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/schemas/EnumClass.kt new file mode 100644 index 00000000000..210abc01cb8 --- /dev/null +++ b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/schemas/EnumClass.kt @@ -0,0 +1,134 @@ +package org.openapijsonschematools.client.components.schemas; +import java.util.HashSet; +import java.util.LinkedHashSet; +import java.util.List; +import java.util.Objects; +import java.util.Set; +import org.checkerframework.checker.nullness.qual.Nullable; +import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags; +import org.openapijsonschematools.client.configurations.SchemaConfiguration; +import org.openapijsonschematools.client.exceptions.ValidationException; +import org.openapijsonschematools.client.schemas.SetMaker; +import org.openapijsonschematools.client.schemas.validation.DefaultValueMethod; +import org.openapijsonschematools.client.schemas.validation.JsonSchema; +import org.openapijsonschematools.client.schemas.validation.JsonSchemaInfo; +import org.openapijsonschematools.client.schemas.validation.PathToSchemasMap; +import org.openapijsonschematools.client.schemas.validation.StringEnumValidator; +import org.openapijsonschematools.client.schemas.validation.StringSchemaValidator; +import org.openapijsonschematools.client.schemas.validation.StringValueMethod; +import org.openapijsonschematools.client.schemas.validation.ValidationMetadata; + +public class EnumClass { + // nest classes so all schemas and input/output classes can be public + + public enum StringEnumClassEnums implements StringValueMethod { + LOW_LINE_ABC("_abc"), + HYPHEN_MINUS_EFG("-efg"), + LEFT_PARENTHESIS_XYZ_RIGHT_PARENTHESIS("(xyz)"), + COUNT_1M("COUNT_1M"), + COUNT_50M("COUNT_50M"); + private final String value; + + StringEnumClassEnums(String value) { + this.value = value; + } + public String value() { + return this.value; + } + } + + + public sealed interface EnumClass1Boxed permits EnumClass1BoxedString { + @Nullable Object getData(); + } + + public record EnumClass1BoxedString(String data) implements EnumClass1Boxed { + @Override + public @Nullable Object getData() { + return data; + } + } + + + + public static class EnumClass1 extends JsonSchema implements StringSchemaValidator, StringEnumValidator, DefaultValueMethod { + /* + NOTE: This class is auto generated by OpenAPI JSON Schema Generator. + Ref: https://github.com/openapi-json-schema-tools/openapi-json-schema-generator + + Do not edit the class manually. + */ + private static @Nullable EnumClass1 instance = null; + + protected EnumClass1() { + super(new JsonSchemaInfo() + .type(Set.of( + String.class + )) + .enumValues(SetMaker.makeSet( + "_abc", + "-efg", + "(xyz)", + "COUNT_1M", + "COUNT_50M" + )) + .defaultValue("-efg") + ); + } + + public static EnumClass1 getInstance() { + if (instance == null) { + instance = new EnumClass1(); + } + return instance; + } + + @Override + public String validate(String arg, SchemaConfiguration configuration) throws ValidationException { + Set> pathSet = new HashSet<>(); + List pathToItem = List.of("args[0"); + String castArg = castToAllowedTypes(arg, pathToItem, pathSet); + SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().build())); + ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, new PathToSchemasMap(), new LinkedHashSet<>()); + getPathToSchemas(this, castArg, validationMetadata, pathSet); + return castArg; + } + + @Override + 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 { + 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"); + } + @Override + public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { + 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"); + } + public String defaultValue() throws ValidationException { + if (defaultValue instanceof String) { + return (String) defaultValue; + } + throw new ValidationException("Invalid type stored in defaultValue"); + } + @Override + 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 { + 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"); + } + } +} diff --git a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/schemas/EnumTest.kt b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/schemas/EnumTest.kt new file mode 100644 index 00000000000..e2312abcb78 --- /dev/null +++ b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/schemas/EnumTest.kt @@ -0,0 +1,1117 @@ +package org.openapijsonschematools.client.components.schemas; +import java.math.BigDecimal; +import java.util.ArrayList; +import java.util.HashSet; +import java.util.LinkedHashMap; +import java.util.LinkedHashSet; +import java.util.List; +import java.util.Map; +import java.util.Objects; +import java.util.Set; +import org.checkerframework.checker.nullness.qual.Nullable; +import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags; +import org.openapijsonschematools.client.configurations.SchemaConfiguration; +import org.openapijsonschematools.client.exceptions.InvalidAdditionalPropertyException; +import org.openapijsonschematools.client.exceptions.UnsetPropertyException; +import org.openapijsonschematools.client.exceptions.ValidationException; +import org.openapijsonschematools.client.schemas.GenericBuilder; +import org.openapijsonschematools.client.schemas.SetMaker; +import org.openapijsonschematools.client.schemas.UnsetAddPropsSetter; +import org.openapijsonschematools.client.schemas.validation.DoubleEnumValidator; +import org.openapijsonschematools.client.schemas.validation.DoubleValueMethod; +import org.openapijsonschematools.client.schemas.validation.FloatEnumValidator; +import org.openapijsonschematools.client.schemas.validation.FloatValueMethod; +import org.openapijsonschematools.client.schemas.validation.FrozenMap; +import org.openapijsonschematools.client.schemas.validation.IntegerEnumValidator; +import org.openapijsonschematools.client.schemas.validation.IntegerValueMethod; +import org.openapijsonschematools.client.schemas.validation.JsonSchema; +import org.openapijsonschematools.client.schemas.validation.JsonSchemaInfo; +import org.openapijsonschematools.client.schemas.validation.LongEnumValidator; +import org.openapijsonschematools.client.schemas.validation.LongValueMethod; +import org.openapijsonschematools.client.schemas.validation.MapSchemaValidator; +import org.openapijsonschematools.client.schemas.validation.NumberSchemaValidator; +import org.openapijsonschematools.client.schemas.validation.PathToSchemasMap; +import org.openapijsonschematools.client.schemas.validation.PropertyEntry; +import org.openapijsonschematools.client.schemas.validation.StringEnumValidator; +import org.openapijsonschematools.client.schemas.validation.StringSchemaValidator; +import org.openapijsonschematools.client.schemas.validation.StringValueMethod; +import org.openapijsonschematools.client.schemas.validation.ValidationMetadata; + +public class EnumTest { + // nest classes so all schemas and input/output classes can be public + + public enum StringEnumStringEnums implements StringValueMethod { + UPPER("UPPER"), + LOWER("lower"), + EMPTY(""); + private final String value; + + StringEnumStringEnums(String value) { + this.value = value; + } + public String value() { + return this.value; + } + } + + + public sealed interface EnumStringBoxed permits EnumStringBoxedString { + @Nullable Object getData(); + } + + public record EnumStringBoxedString(String data) implements EnumStringBoxed { + @Override + public @Nullable Object getData() { + return data; + } + } + + + + public static class EnumString extends JsonSchema implements StringSchemaValidator, StringEnumValidator { + private static @Nullable EnumString instance = null; + + protected EnumString() { + super(new JsonSchemaInfo() + .type(Set.of( + String.class + )) + .enumValues(SetMaker.makeSet( + "UPPER", + "lower", + "" + )) + ); + } + + public static EnumString getInstance() { + if (instance == null) { + instance = new EnumString(); + } + return instance; + } + + @Override + public String validate(String arg, SchemaConfiguration configuration) throws ValidationException { + Set> pathSet = new HashSet<>(); + List pathToItem = List.of("args[0"); + String castArg = castToAllowedTypes(arg, pathToItem, pathSet); + SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().build())); + ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, new PathToSchemasMap(), new LinkedHashSet<>()); + getPathToSchemas(this, castArg, validationMetadata, pathSet); + return castArg; + } + + @Override + 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 { + 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"); + } + @Override + public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { + 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"); + } + @Override + 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 { + 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"); + } + } + public enum StringEnumStringRequiredEnums implements StringValueMethod { + UPPER("UPPER"), + LOWER("lower"), + EMPTY(""); + private final String value; + + StringEnumStringRequiredEnums(String value) { + this.value = value; + } + public String value() { + return this.value; + } + } + + + public sealed interface EnumStringRequiredBoxed permits EnumStringRequiredBoxedString { + @Nullable Object getData(); + } + + public record EnumStringRequiredBoxedString(String data) implements EnumStringRequiredBoxed { + @Override + public @Nullable Object getData() { + return data; + } + } + + + + public static class EnumStringRequired extends JsonSchema implements StringSchemaValidator, StringEnumValidator { + private static @Nullable EnumStringRequired instance = null; + + protected EnumStringRequired() { + super(new JsonSchemaInfo() + .type(Set.of( + String.class + )) + .enumValues(SetMaker.makeSet( + "UPPER", + "lower", + "" + )) + ); + } + + public static EnumStringRequired getInstance() { + if (instance == null) { + instance = new EnumStringRequired(); + } + return instance; + } + + @Override + public String validate(String arg, SchemaConfiguration configuration) throws ValidationException { + Set> pathSet = new HashSet<>(); + List pathToItem = List.of("args[0"); + String castArg = castToAllowedTypes(arg, pathToItem, pathSet); + SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().build())); + ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, new PathToSchemasMap(), new LinkedHashSet<>()); + getPathToSchemas(this, castArg, validationMetadata, pathSet); + return castArg; + } + + @Override + 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 { + 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"); + } + @Override + public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { + 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"); + } + @Override + 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 { + 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"); + } + } + public enum IntegerEnumIntegerEnums implements IntegerValueMethod { + POSITIVE_1(1), + NEGATIVE_1(-1); + private final int value; + + IntegerEnumIntegerEnums(int value) { + this.value = value; + } + public int value() { + return this.value; + } + } + + public enum LongEnumIntegerEnums implements LongValueMethod { + POSITIVE_1(1L), + NEGATIVE_1(-1L); + private final long value; + + LongEnumIntegerEnums(long value) { + this.value = value; + } + public long value() { + return this.value; + } + } + + public enum FloatEnumIntegerEnums implements FloatValueMethod { + POSITIVE_1(1.0f), + NEGATIVE_1(-1.0f); + private final float value; + + FloatEnumIntegerEnums(float value) { + this.value = value; + } + public float value() { + return this.value; + } + } + + public enum DoubleEnumIntegerEnums implements DoubleValueMethod { + POSITIVE_1(1.0d), + NEGATIVE_1(-1.0d); + private final double value; + + DoubleEnumIntegerEnums(double value) { + this.value = value; + } + public double value() { + return this.value; + } + } + + + public sealed interface EnumIntegerBoxed permits EnumIntegerBoxedNumber { + @Nullable Object getData(); + } + + public record EnumIntegerBoxedNumber(Number data) implements EnumIntegerBoxed { + @Override + public @Nullable Object getData() { + return data; + } + } + + + + public static class EnumInteger extends JsonSchema implements IntegerEnumValidator, LongEnumValidator, FloatEnumValidator, DoubleEnumValidator, NumberSchemaValidator { + private static @Nullable EnumInteger instance = null; + + protected EnumInteger() { + super(new JsonSchemaInfo() + .type(Set.of( + Integer.class, + Long.class, + Float.class, + Double.class + )) + .format("int32") + .enumValues(SetMaker.makeSet( + new BigDecimal("1"), + new BigDecimal("-1") + )) + ); + } + + public static EnumInteger getInstance() { + if (instance == null) { + instance = new EnumInteger(); + } + return instance; + } + + @Override + public Number validate(Number arg, SchemaConfiguration configuration) throws ValidationException { + Set> pathSet = new HashSet<>(); + List pathToItem = List.of("args[0"); + Number castArg = castToAllowedTypes(arg, pathToItem, pathSet); + SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().build())); + ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, new PathToSchemasMap(), new LinkedHashSet<>()); + getPathToSchemas(this, castArg, validationMetadata, pathSet); + return castArg; + } + + public int validate(int arg, SchemaConfiguration configuration) throws ValidationException { + return (int) validate((Number) arg, configuration); + } + + public float validate(float arg, SchemaConfiguration configuration) throws ValidationException { + return (float) validate((Number) arg, configuration); + } + + @Override + 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 ValidationException { + return (long) validate((Number) arg.value(), configuration); + } + + @Override + 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 ValidationException { + return (double) validate((Number) arg.value(), configuration); + } + + @Override + public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws 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"); + } + @Override + public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { + 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"); + } + @Override + 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 { + 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"); + } + } + public enum DoubleEnumNumberEnums implements DoubleValueMethod { + POSITIVE_1_PT_1(1.1d), + NEGATIVE_1_PT_2(-1.2d); + private final double value; + + DoubleEnumNumberEnums(double value) { + this.value = value; + } + public double value() { + return this.value; + } + } + + public enum FloatEnumNumberEnums implements FloatValueMethod { + POSITIVE_1_PT_1(1.1f), + NEGATIVE_1_PT_2(-1.2f); + private final float value; + + FloatEnumNumberEnums(float value) { + this.value = value; + } + public float value() { + return this.value; + } + } + + + public sealed interface EnumNumberBoxed permits EnumNumberBoxedNumber { + @Nullable Object getData(); + } + + public record EnumNumberBoxedNumber(Number data) implements EnumNumberBoxed { + @Override + public @Nullable Object getData() { + return data; + } + } + + + + public static class EnumNumber extends JsonSchema implements FloatEnumValidator, DoubleEnumValidator, NumberSchemaValidator { + private static @Nullable EnumNumber instance = null; + + protected EnumNumber() { + super(new JsonSchemaInfo() + .type(Set.of( + Integer.class, + Long.class, + Float.class, + Double.class + )) + .format("double") + .enumValues(SetMaker.makeSet( + new BigDecimal("1.1"), + new BigDecimal("-1.2") + )) + ); + } + + public static EnumNumber getInstance() { + if (instance == null) { + instance = new EnumNumber(); + } + return instance; + } + + @Override + public Number validate(Number arg, SchemaConfiguration configuration) throws ValidationException { + Set> pathSet = new HashSet<>(); + List pathToItem = List.of("args[0"); + Number castArg = castToAllowedTypes(arg, pathToItem, pathSet); + SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().build())); + ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, new PathToSchemasMap(), new LinkedHashSet<>()); + PathToSchemasMap pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet); + return castArg; + } + public double validate(double arg, SchemaConfiguration configuration) throws ValidationException { + return (double) validate((Number) arg, configuration); + } + + @Override + 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 ValidationException { + return (double) validate((Number) arg.value(), configuration); + } + + @Override + public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws 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"); + } + @Override + public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { + 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"); + } + @Override + 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 { + 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"); + } + } + + public static class EnumTestMap extends FrozenMap<@Nullable Object> { + protected EnumTestMap(FrozenMap<@Nullable Object> m) { + super(m); + } + public static final Set requiredKeys = Set.of( + "enum_string_required" + ); + public static final Set optionalKeys = Set.of( + "enum_string", + "enum_integer", + "enum_number", + "stringEnum", + "IntegerEnum", + "StringEnumWithDefaultValue", + "IntegerEnumWithDefaultValue", + "IntegerEnumOneValue" + ); + public static EnumTestMap of(Map arg, SchemaConfiguration configuration) throws ValidationException { + return EnumTest1.getInstance().validate(arg, configuration); + } + + 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"); + } + return (String) value; + } + + public String enum_string() throws UnsetPropertyException { + String key = "enum_string"; + throwIfKeyNotPresent(key); + @Nullable Object value = get(key); + if (!(value instanceof String)) { + throw new RuntimeException("Invalid value stored for enum_string"); + } + return (String) value; + } + + public Number enum_integer() throws UnsetPropertyException { + String key = "enum_integer"; + throwIfKeyNotPresent(key); + @Nullable Object value = get(key); + if (!(value instanceof Number)) { + throw new RuntimeException("Invalid value stored for enum_integer"); + } + return (Number) value; + } + + public Number enum_number() throws UnsetPropertyException { + String key = "enum_number"; + throwIfKeyNotPresent(key); + @Nullable Object value = get(key); + if (!(value instanceof Number)) { + throw new RuntimeException("Invalid value stored for enum_number"); + } + return (Number) value; + } + + public @Nullable String stringEnum() throws UnsetPropertyException { + String key = "stringEnum"; + throwIfKeyNotPresent(key); + @Nullable Object value = get(key); + if (!(value instanceof String)) { + throw new RuntimeException("Invalid value stored for stringEnum"); + } + return (@Nullable String) value; + } + + public Number IntegerEnum() throws UnsetPropertyException { + String key = "IntegerEnum"; + throwIfKeyNotPresent(key); + @Nullable Object value = get(key); + if (!(value instanceof Number)) { + throw new RuntimeException("Invalid value stored for IntegerEnum"); + } + return (Number) value; + } + + public String StringEnumWithDefaultValue() throws UnsetPropertyException { + String key = "StringEnumWithDefaultValue"; + throwIfKeyNotPresent(key); + @Nullable Object value = get(key); + if (!(value instanceof String)) { + throw new RuntimeException("Invalid value stored for StringEnumWithDefaultValue"); + } + return (String) value; + } + + public Number IntegerEnumWithDefaultValue() throws UnsetPropertyException { + String key = "IntegerEnumWithDefaultValue"; + throwIfKeyNotPresent(key); + @Nullable Object value = get(key); + if (!(value instanceof Number)) { + throw new RuntimeException("Invalid value stored for IntegerEnumWithDefaultValue"); + } + return (Number) value; + } + + public Number IntegerEnumOneValue() throws UnsetPropertyException { + String key = "IntegerEnumOneValue"; + throwIfKeyNotPresent(key); + @Nullable Object value = get(key); + if (!(value instanceof Number)) { + throw new RuntimeException("Invalid value stored for IntegerEnumOneValue"); + } + return (Number) value; + } + + public @Nullable Object getAdditionalProperty(String name) throws UnsetPropertyException, InvalidAdditionalPropertyException { + throwIfKeyKnown(name, requiredKeys, optionalKeys); + throwIfKeyNotPresent(name); + return get(name); + } + } + + public interface SetterForEnumStringRequired { + Map getInstance(); + T getBuilderAfterEnumStringRequired(Map instance); + + default T enum_string_required(String value) { + var instance = getInstance(); + instance.put("enum_string_required", value); + return getBuilderAfterEnumStringRequired(instance); + } + + default T enum_string_required(StringEnumStringRequiredEnums value) { + var instance = getInstance(); + instance.put("enum_string_required", value.value()); + return getBuilderAfterEnumStringRequired(instance); + } + } + + public interface SetterForEnumString { + Map getInstance(); + T getBuilderAfterEnumString(Map instance); + + default T enum_string(String value) { + var instance = getInstance(); + instance.put("enum_string", value); + return getBuilderAfterEnumString(instance); + } + + default T enum_string(StringEnumStringEnums value) { + var instance = getInstance(); + instance.put("enum_string", value.value()); + return getBuilderAfterEnumString(instance); + } + } + + public interface SetterForEnumInteger { + Map getInstance(); + T getBuilderAfterEnumInteger(Map instance); + + default T enum_integer(int value) { + var instance = getInstance(); + instance.put("enum_integer", value); + return getBuilderAfterEnumInteger(instance); + } + + default T enum_integer(float value) { + var instance = getInstance(); + instance.put("enum_integer", value); + return getBuilderAfterEnumInteger(instance); + } + + default T enum_integer(IntegerEnumIntegerEnums value) { + var instance = getInstance(); + instance.put("enum_integer", value.value()); + return getBuilderAfterEnumInteger(instance); + } + + default T enum_integer(LongEnumIntegerEnums value) { + var instance = getInstance(); + instance.put("enum_integer", value.value()); + return getBuilderAfterEnumInteger(instance); + } + + default T enum_integer(FloatEnumIntegerEnums value) { + var instance = getInstance(); + instance.put("enum_integer", value.value()); + return getBuilderAfterEnumInteger(instance); + } + + default T enum_integer(DoubleEnumIntegerEnums value) { + var instance = getInstance(); + instance.put("enum_integer", value.value()); + return getBuilderAfterEnumInteger(instance); + } + } + + public interface SetterForEnumNumber { + Map getInstance(); + T getBuilderAfterEnumNumber(Map instance); + + default T enum_number(int value) { + var instance = getInstance(); + instance.put("enum_number", value); + return getBuilderAfterEnumNumber(instance); + } + + default T enum_number(float value) { + var instance = getInstance(); + instance.put("enum_number", value); + return getBuilderAfterEnumNumber(instance); + } + + default T enum_number(long value) { + var instance = getInstance(); + instance.put("enum_number", value); + return getBuilderAfterEnumNumber(instance); + } + + default T enum_number(double value) { + var instance = getInstance(); + instance.put("enum_number", value); + return getBuilderAfterEnumNumber(instance); + } + + default T enum_number(DoubleEnumNumberEnums value) { + var instance = getInstance(); + instance.put("enum_number", value.value()); + return getBuilderAfterEnumNumber(instance); + } + + default T enum_number(FloatEnumNumberEnums value) { + var instance = getInstance(); + instance.put("enum_number", value.value()); + return getBuilderAfterEnumNumber(instance); + } + } + + public interface SetterForStringEnum { + Map getInstance(); + T getBuilderAfterStringEnum(Map instance); + + default T stringEnum(Nothing? value) { + var instance = getInstance(); + instance.put("stringEnum", null); + return getBuilderAfterStringEnum(instance); + } + + default T stringEnum(String value) { + var instance = getInstance(); + instance.put("stringEnum", value); + return getBuilderAfterStringEnum(instance); + } + + default T stringEnum(StringEnum.StringStringEnumEnums value) { + var instance = getInstance(); + instance.put("stringEnum", value.value()); + return getBuilderAfterStringEnum(instance); + } + + default T stringEnum(StringEnum.NullStringEnumEnums value) { + var instance = getInstance(); + instance.put("stringEnum", null); + return getBuilderAfterStringEnum(instance); + } + } + + public interface SetterForIntegerEnum { + Map getInstance(); + T getBuilderAfterIntegerEnum(Map instance); + + default T IntegerEnum(int value) { + var instance = getInstance(); + instance.put("IntegerEnum", value); + return getBuilderAfterIntegerEnum(instance); + } + + default T IntegerEnum(float value) { + var instance = getInstance(); + instance.put("IntegerEnum", value); + return getBuilderAfterIntegerEnum(instance); + } + + default T IntegerEnum(long value) { + var instance = getInstance(); + instance.put("IntegerEnum", value); + return getBuilderAfterIntegerEnum(instance); + } + + default T IntegerEnum(double value) { + var instance = getInstance(); + instance.put("IntegerEnum", value); + return getBuilderAfterIntegerEnum(instance); + } + + default T IntegerEnum(IntegerEnum.IntegerIntegerEnumEnums value) { + var instance = getInstance(); + instance.put("IntegerEnum", value.value()); + return getBuilderAfterIntegerEnum(instance); + } + + default T IntegerEnum(IntegerEnum.LongIntegerEnumEnums value) { + var instance = getInstance(); + instance.put("IntegerEnum", value.value()); + return getBuilderAfterIntegerEnum(instance); + } + + default T IntegerEnum(IntegerEnum.FloatIntegerEnumEnums value) { + var instance = getInstance(); + instance.put("IntegerEnum", value.value()); + return getBuilderAfterIntegerEnum(instance); + } + + default T IntegerEnum(IntegerEnum.DoubleIntegerEnumEnums value) { + var instance = getInstance(); + instance.put("IntegerEnum", value.value()); + return getBuilderAfterIntegerEnum(instance); + } + } + + public interface SetterForStringEnumWithDefaultValue { + Map getInstance(); + T getBuilderAfterStringEnumWithDefaultValue(Map instance); + + default T StringEnumWithDefaultValue(String value) { + var instance = getInstance(); + instance.put("StringEnumWithDefaultValue", value); + return getBuilderAfterStringEnumWithDefaultValue(instance); + } + + default T StringEnumWithDefaultValue(StringEnumWithDefaultValue.StringStringEnumWithDefaultValueEnums value) { + var instance = getInstance(); + instance.put("StringEnumWithDefaultValue", value.value()); + return getBuilderAfterStringEnumWithDefaultValue(instance); + } + } + + public interface SetterForIntegerEnumWithDefaultValue { + Map getInstance(); + T getBuilderAfterIntegerEnumWithDefaultValue(Map instance); + + default T IntegerEnumWithDefaultValue(int value) { + var instance = getInstance(); + instance.put("IntegerEnumWithDefaultValue", value); + return getBuilderAfterIntegerEnumWithDefaultValue(instance); + } + + default T IntegerEnumWithDefaultValue(float value) { + var instance = getInstance(); + instance.put("IntegerEnumWithDefaultValue", value); + return getBuilderAfterIntegerEnumWithDefaultValue(instance); + } + + default T IntegerEnumWithDefaultValue(long value) { + var instance = getInstance(); + instance.put("IntegerEnumWithDefaultValue", value); + return getBuilderAfterIntegerEnumWithDefaultValue(instance); + } + + default T IntegerEnumWithDefaultValue(double value) { + var instance = getInstance(); + instance.put("IntegerEnumWithDefaultValue", value); + return getBuilderAfterIntegerEnumWithDefaultValue(instance); + } + + default T IntegerEnumWithDefaultValue(IntegerEnumWithDefaultValue.IntegerIntegerEnumWithDefaultValueEnums value) { + var instance = getInstance(); + instance.put("IntegerEnumWithDefaultValue", value.value()); + return getBuilderAfterIntegerEnumWithDefaultValue(instance); + } + + default T IntegerEnumWithDefaultValue(IntegerEnumWithDefaultValue.LongIntegerEnumWithDefaultValueEnums value) { + var instance = getInstance(); + instance.put("IntegerEnumWithDefaultValue", value.value()); + return getBuilderAfterIntegerEnumWithDefaultValue(instance); + } + + default T IntegerEnumWithDefaultValue(IntegerEnumWithDefaultValue.FloatIntegerEnumWithDefaultValueEnums value) { + var instance = getInstance(); + instance.put("IntegerEnumWithDefaultValue", value.value()); + return getBuilderAfterIntegerEnumWithDefaultValue(instance); + } + + default T IntegerEnumWithDefaultValue(IntegerEnumWithDefaultValue.DoubleIntegerEnumWithDefaultValueEnums value) { + var instance = getInstance(); + instance.put("IntegerEnumWithDefaultValue", value.value()); + return getBuilderAfterIntegerEnumWithDefaultValue(instance); + } + } + + public interface SetterForIntegerEnumOneValue { + Map getInstance(); + T getBuilderAfterIntegerEnumOneValue(Map instance); + + default T IntegerEnumOneValue(int value) { + var instance = getInstance(); + instance.put("IntegerEnumOneValue", value); + return getBuilderAfterIntegerEnumOneValue(instance); + } + + default T IntegerEnumOneValue(float value) { + var instance = getInstance(); + instance.put("IntegerEnumOneValue", value); + return getBuilderAfterIntegerEnumOneValue(instance); + } + + default T IntegerEnumOneValue(long value) { + var instance = getInstance(); + instance.put("IntegerEnumOneValue", value); + return getBuilderAfterIntegerEnumOneValue(instance); + } + + default T IntegerEnumOneValue(double value) { + var instance = getInstance(); + instance.put("IntegerEnumOneValue", value); + return getBuilderAfterIntegerEnumOneValue(instance); + } + + default T IntegerEnumOneValue(IntegerEnumOneValue.IntegerIntegerEnumOneValueEnums value) { + var instance = getInstance(); + instance.put("IntegerEnumOneValue", value.value()); + return getBuilderAfterIntegerEnumOneValue(instance); + } + + default T IntegerEnumOneValue(IntegerEnumOneValue.LongIntegerEnumOneValueEnums value) { + var instance = getInstance(); + instance.put("IntegerEnumOneValue", value.value()); + return getBuilderAfterIntegerEnumOneValue(instance); + } + + default T IntegerEnumOneValue(IntegerEnumOneValue.FloatIntegerEnumOneValueEnums value) { + var instance = getInstance(); + instance.put("IntegerEnumOneValue", value.value()); + return getBuilderAfterIntegerEnumOneValue(instance); + } + + default T IntegerEnumOneValue(IntegerEnumOneValue.DoubleIntegerEnumOneValueEnums value) { + var instance = getInstance(); + instance.put("IntegerEnumOneValue", value.value()); + return getBuilderAfterIntegerEnumOneValue(instance); + } + } + + public static class EnumTestMap0Builder extends UnsetAddPropsSetter implements GenericBuilder>, SetterForEnumString, SetterForEnumInteger, SetterForEnumNumber, SetterForStringEnum, SetterForIntegerEnum, SetterForStringEnumWithDefaultValue, SetterForIntegerEnumWithDefaultValue, SetterForIntegerEnumOneValue { + private final Map instance; + private static final Set knownKeys = Set.of( + "enum_string_required", + "enum_string", + "enum_integer", + "enum_number", + "stringEnum", + "IntegerEnum", + "StringEnumWithDefaultValue", + "IntegerEnumWithDefaultValue", + "IntegerEnumOneValue" + ); + public Set getKnownKeys() { + return knownKeys; + } + public EnumTestMap0Builder(Map instance) { + this.instance = instance; + } + public Map build() { + return instance; + } + public Map getInstance() { + return instance; + } + public EnumTestMap0Builder getBuilderAfterEnumString(Map instance) { + return this; + } + public EnumTestMap0Builder getBuilderAfterEnumInteger(Map instance) { + return this; + } + public EnumTestMap0Builder getBuilderAfterEnumNumber(Map instance) { + return this; + } + public EnumTestMap0Builder getBuilderAfterStringEnum(Map instance) { + return this; + } + public EnumTestMap0Builder getBuilderAfterIntegerEnum(Map instance) { + return this; + } + public EnumTestMap0Builder getBuilderAfterStringEnumWithDefaultValue(Map instance) { + return this; + } + public EnumTestMap0Builder getBuilderAfterIntegerEnumWithDefaultValue(Map instance) { + return this; + } + public EnumTestMap0Builder getBuilderAfterIntegerEnumOneValue(Map instance) { + return this; + } + public EnumTestMap0Builder getBuilderAfterAdditionalProperty(Map instance) { + return this; + } + } + + public static class EnumTestMapBuilder implements SetterForEnumStringRequired { + private final Map instance; + public EnumTestMapBuilder() { + this.instance = new LinkedHashMap<>(); + } + public Map getInstance() { + return instance; + } + public EnumTestMap0Builder getBuilderAfterEnumStringRequired(Map instance) { + return new EnumTestMap0Builder(instance); + } + } + + + public sealed interface EnumTest1Boxed permits EnumTest1BoxedMap { + @Nullable Object getData(); + } + + public record EnumTest1BoxedMap(EnumTestMap data) implements EnumTest1Boxed { + @Override + public @Nullable Object getData() { + return data; + } + } + + + public static class EnumTest1 extends JsonSchema implements MapSchemaValidator { + /* + NOTE: This class is auto generated by OpenAPI JSON Schema Generator. + Ref: https://github.com/openapi-json-schema-tools/openapi-json-schema-generator + + Do not edit the class manually. + */ + private static @Nullable EnumTest1 instance = null; + + protected EnumTest1() { + super(new JsonSchemaInfo() + .type(Set.of(Map.class)) + .properties(Map.ofEntries( + new PropertyEntry("enum_string", EnumString.class), + new PropertyEntry("enum_string_required", EnumStringRequired.class), + new PropertyEntry("enum_integer", EnumInteger.class), + new PropertyEntry("enum_number", EnumNumber.class), + new PropertyEntry("stringEnum", StringEnum.StringEnum1.class), + new PropertyEntry("IntegerEnum", IntegerEnum.IntegerEnum1.class), + new PropertyEntry("StringEnumWithDefaultValue", StringEnumWithDefaultValue.StringEnumWithDefaultValue1.class), + new PropertyEntry("IntegerEnumWithDefaultValue", IntegerEnumWithDefaultValue.IntegerEnumWithDefaultValue1.class), + new PropertyEntry("IntegerEnumOneValue", IntegerEnumOneValue.IntegerEnumOneValue1.class) + )) + .required(Set.of( + "enum_string_required" + )) + ); + } + + public static EnumTest1 getInstance() { + if (instance == null) { + instance = new EnumTest1(); + } + return instance; + } + + 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 RuntimeException("Invalid non-string key value"); + } + String propertyName = (String) entryKey; + List propertyPathToItem = new ArrayList<>(pathToItem); + propertyPathToItem.add(propertyName); + Object value = entry.getValue(); + LinkedHashMap, Nothing?> schemas = pathToSchemas.get(propertyPathToItem); + if (schemas == null) { + throw new RuntimeException("Validation result is invalid, schemas must exist for a pathToItem"); + } + JsonSchema propertySchema = schemas.entrySet().iterator().next().getKey(); + @Nullable Object propertyInstance = propertySchema.getNewInstance(value, propertyPathToItem, pathToSchemas); + properties.put(propertyName, propertyInstance); + } + FrozenMap<@Nullable Object> castProperties = new FrozenMap<>(properties); + return new EnumTestMap(castProperties); + } + + 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); + SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().build())); + ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, new PathToSchemasMap(), new LinkedHashSet<>()); + PathToSchemasMap pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet); + return getNewInstance(castArg, validationMetadata.pathToItem(), pathToSchemasMap); + } + + + @Override + public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws 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"); + } + @Override + public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { + if (arg instanceof Map) { + return getNewInstance((Map) arg, pathToItem, pathToSchemas); + } + 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 { + return new EnumTest1BoxedMap(validate(arg, configuration)); + } + @Override + public EnumTest1Boxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { + 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"); + } + } + +} diff --git a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/schemas/EquilateralTriangle.kt b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/schemas/EquilateralTriangle.kt new file mode 100644 index 00000000000..3a7ef43bfe8 --- /dev/null +++ b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/schemas/EquilateralTriangle.kt @@ -0,0 +1,589 @@ +package org.openapijsonschematools.client.components.schemas; +import java.time.LocalDate; +import java.time.ZonedDateTime; +import java.util.ArrayList; +import java.util.HashSet; +import java.util.LinkedHashMap; +import java.util.LinkedHashSet; +import java.util.List; +import java.util.Map; +import java.util.Objects; +import java.util.Set; +import java.util.UUID; +import org.checkerframework.checker.nullness.qual.Nullable; +import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags; +import org.openapijsonschematools.client.configurations.SchemaConfiguration; +import org.openapijsonschematools.client.exceptions.InvalidAdditionalPropertyException; +import org.openapijsonschematools.client.exceptions.UnsetPropertyException; +import org.openapijsonschematools.client.exceptions.ValidationException; +import org.openapijsonschematools.client.schemas.GenericBuilder; +import org.openapijsonschematools.client.schemas.SetMaker; +import org.openapijsonschematools.client.schemas.UnsetAddPropsSetter; +import org.openapijsonschematools.client.schemas.validation.BooleanSchemaValidator; +import org.openapijsonschematools.client.schemas.validation.FrozenList; +import org.openapijsonschematools.client.schemas.validation.FrozenMap; +import org.openapijsonschematools.client.schemas.validation.JsonSchema; +import org.openapijsonschematools.client.schemas.validation.JsonSchemaInfo; +import org.openapijsonschematools.client.schemas.validation.ListSchemaValidator; +import org.openapijsonschematools.client.schemas.validation.MapSchemaValidator; +import org.openapijsonschematools.client.schemas.validation.NullSchemaValidator; +import org.openapijsonschematools.client.schemas.validation.NumberSchemaValidator; +import org.openapijsonschematools.client.schemas.validation.PathToSchemasMap; +import org.openapijsonschematools.client.schemas.validation.PropertyEntry; +import org.openapijsonschematools.client.schemas.validation.StringEnumValidator; +import org.openapijsonschematools.client.schemas.validation.StringSchemaValidator; +import org.openapijsonschematools.client.schemas.validation.StringValueMethod; +import org.openapijsonschematools.client.schemas.validation.ValidationMetadata; + +public class EquilateralTriangle { + // nest classes so all schemas and input/output classes can be public + + public enum StringTriangleTypeEnums implements StringValueMethod { + EQUILATERAL_TRIANGLE("EquilateralTriangle"); + private final String value; + + StringTriangleTypeEnums(String value) { + this.value = value; + } + public String value() { + return this.value; + } + } + + + public sealed interface TriangleTypeBoxed permits TriangleTypeBoxedString { + @Nullable Object getData(); + } + + public record TriangleTypeBoxedString(String data) implements TriangleTypeBoxed { + @Override + public @Nullable Object getData() { + return data; + } + } + + + + public static class TriangleType extends JsonSchema implements StringSchemaValidator, StringEnumValidator { + private static @Nullable TriangleType instance = null; + + protected TriangleType() { + super(new JsonSchemaInfo() + .type(Set.of( + String.class + )) + .enumValues(SetMaker.makeSet( + "EquilateralTriangle" + )) + ); + } + + public static TriangleType getInstance() { + if (instance == null) { + instance = new TriangleType(); + } + return instance; + } + + @Override + public String validate(String arg, SchemaConfiguration configuration) throws ValidationException { + Set> pathSet = new HashSet<>(); + List pathToItem = List.of("args[0"); + String castArg = castToAllowedTypes(arg, pathToItem, pathSet); + SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().build())); + ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, new PathToSchemasMap(), new LinkedHashSet<>()); + getPathToSchemas(this, castArg, validationMetadata, pathSet); + return castArg; + } + + @Override + 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 { + 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"); + } + @Override + public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { + 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"); + } + @Override + 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 { + 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"); + } + } + + public static class Schema1Map extends FrozenMap<@Nullable Object> { + protected Schema1Map(FrozenMap<@Nullable Object> m) { + super(m); + } + public static final Set requiredKeys = Set.of(); + public static final Set optionalKeys = Set.of( + "triangleType" + ); + public static Schema1Map of(Map arg, SchemaConfiguration configuration) throws ValidationException { + return Schema1.getInstance().validate(arg, configuration); + } + + public String triangleType() throws UnsetPropertyException { + String key = "triangleType"; + throwIfKeyNotPresent(key); + @Nullable Object value = get(key); + if (!(value instanceof String)) { + throw new RuntimeException("Invalid value stored for triangleType"); + } + return (String) value; + } + + public @Nullable Object getAdditionalProperty(String name) throws UnsetPropertyException, InvalidAdditionalPropertyException { + throwIfKeyKnown(name, requiredKeys, optionalKeys); + throwIfKeyNotPresent(name); + return get(name); + } + } + + public interface SetterForTriangleType { + Map getInstance(); + T getBuilderAfterTriangleType(Map instance); + + default T triangleType(String value) { + var instance = getInstance(); + instance.put("triangleType", value); + return getBuilderAfterTriangleType(instance); + } + + default T triangleType(StringTriangleTypeEnums value) { + var instance = getInstance(); + instance.put("triangleType", value.value()); + return getBuilderAfterTriangleType(instance); + } + } + + public static class Schema1MapBuilder extends UnsetAddPropsSetter implements GenericBuilder>, SetterForTriangleType { + private final Map instance; + private static final Set knownKeys = Set.of( + "triangleType" + ); + public Set getKnownKeys() { + return knownKeys; + } + public Schema1MapBuilder() { + this.instance = new LinkedHashMap<>(); + } + public Map build() { + return instance; + } + public Map getInstance() { + return instance; + } + public Schema1MapBuilder getBuilderAfterTriangleType(Map instance) { + return this; + } + public Schema1MapBuilder getBuilderAfterAdditionalProperty(Map instance) { + return this; + } + } + + + public sealed interface Schema1Boxed permits Schema1BoxedMap { + @Nullable Object getData(); + } + + public record Schema1BoxedMap(Schema1Map data) implements Schema1Boxed { + @Override + public @Nullable Object getData() { + return data; + } + } + + + public static class Schema1 extends JsonSchema implements MapSchemaValidator { + private static @Nullable Schema1 instance = null; + + protected Schema1() { + super(new JsonSchemaInfo() + .type(Set.of(Map.class)) + .properties(Map.ofEntries( + new PropertyEntry("triangleType", TriangleType.class) + )) + ); + } + + public static Schema1 getInstance() { + if (instance == null) { + instance = new Schema1(); + } + return instance; + } + + 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 RuntimeException("Invalid non-string key value"); + } + String propertyName = (String) entryKey; + List propertyPathToItem = new ArrayList<>(pathToItem); + propertyPathToItem.add(propertyName); + Object value = entry.getValue(); + LinkedHashMap, Nothing?> schemas = pathToSchemas.get(propertyPathToItem); + if (schemas == null) { + throw new RuntimeException("Validation result is invalid, schemas must exist for a pathToItem"); + } + JsonSchema propertySchema = schemas.entrySet().iterator().next().getKey(); + @Nullable Object propertyInstance = propertySchema.getNewInstance(value, propertyPathToItem, pathToSchemas); + properties.put(propertyName, propertyInstance); + } + FrozenMap<@Nullable Object> castProperties = new FrozenMap<>(properties); + return new Schema1Map(castProperties); + } + + 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); + SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().build())); + ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, new PathToSchemasMap(), new LinkedHashSet<>()); + PathToSchemasMap pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet); + return getNewInstance(castArg, validationMetadata.pathToItem(), pathToSchemasMap); + } + + + @Override + public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws 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"); + } + @Override + public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { + if (arg instanceof Map) { + return getNewInstance((Map) arg, pathToItem, pathToSchemas); + } + 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 { + return new Schema1BoxedMap(validate(arg, configuration)); + } + @Override + public Schema1Boxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { + 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"); + } + } + + + public sealed interface EquilateralTriangle1Boxed permits EquilateralTriangle1BoxedVoid, EquilateralTriangle1BoxedBoolean, EquilateralTriangle1BoxedNumber, EquilateralTriangle1BoxedString, EquilateralTriangle1BoxedList, EquilateralTriangle1BoxedMap { + @Nullable Object getData(); + } + + public record EquilateralTriangle1BoxedVoid(Nothing? data) implements EquilateralTriangle1Boxed { + @Override + public @Nullable Object getData() { + return data; + } + } + + public record EquilateralTriangle1BoxedBoolean(boolean data) implements EquilateralTriangle1Boxed { + @Override + public @Nullable Object getData() { + return data; + } + } + + public record EquilateralTriangle1BoxedNumber(Number data) implements EquilateralTriangle1Boxed { + @Override + public @Nullable Object getData() { + return data; + } + } + + public record EquilateralTriangle1BoxedString(String data) implements EquilateralTriangle1Boxed { + @Override + public @Nullable Object getData() { + return data; + } + } + + public record EquilateralTriangle1BoxedList(FrozenList<@Nullable Object> data) implements EquilateralTriangle1Boxed { + @Override + public @Nullable Object getData() { + return data; + } + } + + public record EquilateralTriangle1BoxedMap(FrozenMap<@Nullable Object> data) implements EquilateralTriangle1Boxed { + @Override + public @Nullable Object getData() { + return data; + } + } + + + public static class EquilateralTriangle1 extends JsonSchema implements NullSchemaValidator, BooleanSchemaValidator, NumberSchemaValidator, StringSchemaValidator, ListSchemaValidator, EquilateralTriangle1BoxedList>, MapSchemaValidator, EquilateralTriangle1BoxedMap> { + /* + NOTE: This class is auto generated by OpenAPI JSON Schema Generator. + Ref: https://github.com/openapi-json-schema-tools/openapi-json-schema-generator + + Do not edit the class manually. + */ + private static @Nullable EquilateralTriangle1 instance = null; + + protected EquilateralTriangle1() { + super(new JsonSchemaInfo() + .allOf(List.of( + TriangleInterface.TriangleInterface1.class, + Schema1.class + )) + ); + } + + public static EquilateralTriangle1 getInstance() { + if (instance == null) { + instance = new EquilateralTriangle1(); + } + return instance; + } + + @Override + public Nothing? validate(Nothing? arg, SchemaConfiguration configuration) throws ValidationException { + Set> pathSet = new HashSet<>(); + List pathToItem = List.of("args[0]"); + Nothing? castArg = castToAllowedTypes(arg, pathToItem, pathSet); + SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().build())); + PathToSchemasMap validatedPathToSchemas = new PathToSchemasMap(); + ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, new LinkedHashSet<>()); + getPathToSchemas(this, castArg, validationMetadata, pathSet); + return castArg; + } + + @Override + public boolean validate(boolean arg, SchemaConfiguration configuration) throws ValidationException { + Set> pathSet = new HashSet<>(); + List pathToItem = List.of("args[0]"); + boolean castArg = castToAllowedTypes(arg, pathToItem, pathSet); + SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().build())); + PathToSchemasMap validatedPathToSchemas = new PathToSchemasMap(); + ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, new LinkedHashSet<>()); + getPathToSchemas(this, castArg, validationMetadata, pathSet); + return castArg; + } + + @Override + public Number validate(Number arg, SchemaConfiguration configuration) throws ValidationException { + Set> pathSet = new HashSet<>(); + List pathToItem = List.of("args[0]"); + Number castArg = castToAllowedTypes(arg, pathToItem, pathSet); + SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().build())); + PathToSchemasMap validatedPathToSchemas = new PathToSchemasMap(); + ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, new LinkedHashSet<>()); + getPathToSchemas(this, castArg, validationMetadata, pathSet); + return castArg; + } + + public int validate(int arg, SchemaConfiguration configuration) throws ValidationException { + return (int) validate((Number) arg, configuration); + } + + public long validate(long arg, SchemaConfiguration configuration) throws ValidationException { + return (long) validate((Number) arg, configuration); + } + + public float validate(float arg, SchemaConfiguration configuration) throws ValidationException { + return (float) validate((Number) arg, configuration); + } + + public double validate(double arg, SchemaConfiguration configuration) throws ValidationException { + return (double) validate((Number) arg, configuration); + } + + @Override + public String validate(String arg, SchemaConfiguration configuration) throws ValidationException { + Set> pathSet = new HashSet<>(); + List pathToItem = List.of("args[0]"); + String castArg = castToAllowedTypes(arg, pathToItem, pathSet); + SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().build())); + PathToSchemasMap validatedPathToSchemas = new PathToSchemasMap(); + ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, new LinkedHashSet<>()); + getPathToSchemas(this, castArg, validationMetadata, pathSet); + return castArg; + } + + public String validate(LocalDate arg, SchemaConfiguration configuration) throws ValidationException { + return validate(arg.toString(), configuration); + } + + public String validate(ZonedDateTime arg, SchemaConfiguration configuration) throws ValidationException { + return validate(arg.toString(), configuration); + } + + public String validate(UUID arg, SchemaConfiguration configuration) throws ValidationException { + return validate(arg.toString(), configuration); + } + + @Override + public FrozenList<@Nullable Object> getNewInstance(List arg, List pathToItem, PathToSchemasMap pathToSchemas) { + List<@Nullable Object> items = new ArrayList<>(); + int i = 0; + for (Object item: arg) { + List itemPathToItem = new ArrayList<>(pathToItem); + itemPathToItem.add(i); + LinkedHashMap, Nothing?> schemas = pathToSchemas.get(itemPathToItem); + if (schemas == null) { + throw new RuntimeException("Validation result is invalid, schemas must exist for a pathToItem"); + } + JsonSchema itemSchema = schemas.entrySet().iterator().next().getKey(); + @Nullable Object itemInstance = itemSchema.getNewInstance(item, itemPathToItem, pathToSchemas); + items.add(itemInstance); + i += 1; + } + FrozenList<@Nullable Object> newInstanceItems = new FrozenList<>(items); + return newInstanceItems; + } + + 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); + SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().build())); + ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, new PathToSchemasMap(), new LinkedHashSet<>()); + PathToSchemasMap pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet); + return getNewInstance(castArg, validationMetadata.pathToItem(), pathToSchemasMap); + } + + @Override + 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 RuntimeException("Invalid non-string key value"); + } + String propertyName = (String) entryKey; + List propertyPathToItem = new ArrayList<>(pathToItem); + propertyPathToItem.add(propertyName); + Object value = entry.getValue(); + LinkedHashMap, Nothing?> schemas = pathToSchemas.get(propertyPathToItem); + if (schemas == null) { + throw new RuntimeException("Validation result is invalid, schemas must exist for a pathToItem"); + } + JsonSchema propertySchema = schemas.entrySet().iterator().next().getKey(); + @Nullable Object propertyInstance = propertySchema.getNewInstance(value, propertyPathToItem, pathToSchemas); + properties.put(propertyName, propertyInstance); + } + FrozenMap<@Nullable Object> castProperties = new FrozenMap<>(properties); + return castProperties; + } + + public FrozenMap<@Nullable Object> validate(Map arg, SchemaConfiguration configuration) throws ValidationException { + Set> pathSet = new HashSet<>(); + List pathToItem = List.of("args[0]"); + Map castArg = castToAllowedTypes(arg, pathToItem, pathSet); + SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().build())); + PathToSchemasMap validatedPathToSchemas = new PathToSchemasMap(); + ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, new LinkedHashSet<>()); + PathToSchemasMap pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet); + return getNewInstance(castArg, validationMetadata.pathToItem(), pathToSchemasMap); + } + + @Override + public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { + if (arg == null) { + return validate((Nothing?) null, configuration); + } else if (arg instanceof Boolean) { + boolean boolArg = (Boolean) arg; + return validate(boolArg, configuration); + } else if (arg instanceof Number) { + return validate((Number) arg, configuration); + } else if (arg instanceof String) { + return validate((String) arg, configuration); + } else if (arg instanceof List) { + return validate((List) arg, 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"); + } + @Override + public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { + if (arg == null) { + return getNewInstance((Nothing?) null, pathToItem, pathToSchemas); + } else if (arg instanceof Boolean) { + boolean boolArg = (Boolean) arg; + return getNewInstance(boolArg, pathToItem, pathToSchemas); + } else if (arg instanceof Number) { + return getNewInstance((Number) arg, pathToItem, pathToSchemas); + } else if (arg instanceof String) { + return getNewInstance((String) arg, pathToItem, pathToSchemas); + } else if (arg instanceof List) { + return getNewInstance((List) arg, 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"); + } + @Override + public EquilateralTriangle1BoxedVoid validateAndBox(Nothing? arg, SchemaConfiguration configuration) throws ValidationException { + return new EquilateralTriangle1BoxedVoid(validate(arg, configuration)); + } + @Override + 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 { + return new EquilateralTriangle1BoxedNumber(validate(arg, configuration)); + } + @Override + 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 { + return new EquilateralTriangle1BoxedList(validate(arg, configuration)); + } + @Override + 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 { + if (arg == null) { + Nothing? castArg = (Nothing?) arg; + return validateAndBox(castArg, configuration); + } else if (arg instanceof Boolean booleanArg) { + boolean castArg = booleanArg; + return validateAndBox(castArg, configuration); + } else if (arg instanceof String castArg) { + return validateAndBox(castArg, configuration); + } else if (arg instanceof Number castArg) { + return validateAndBox(castArg, configuration); + } else if (arg instanceof List castArg) { + 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"); + } + } +} diff --git a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/schemas/File.kt b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/schemas/File.kt new file mode 100644 index 00000000000..ddc771163a0 --- /dev/null +++ b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/schemas/File.kt @@ -0,0 +1,208 @@ +package org.openapijsonschematools.client.components.schemas; +import java.util.ArrayList; +import java.util.HashSet; +import java.util.LinkedHashMap; +import java.util.LinkedHashSet; +import java.util.List; +import java.util.Map; +import java.util.Objects; +import java.util.Set; +import org.checkerframework.checker.nullness.qual.Nullable; +import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags; +import org.openapijsonschematools.client.configurations.SchemaConfiguration; +import org.openapijsonschematools.client.exceptions.InvalidAdditionalPropertyException; +import org.openapijsonschematools.client.exceptions.UnsetPropertyException; +import org.openapijsonschematools.client.exceptions.ValidationException; +import org.openapijsonschematools.client.schemas.GenericBuilder; +import org.openapijsonschematools.client.schemas.StringJsonSchema; +import org.openapijsonschematools.client.schemas.UnsetAddPropsSetter; +import org.openapijsonschematools.client.schemas.validation.FrozenMap; +import org.openapijsonschematools.client.schemas.validation.JsonSchema; +import org.openapijsonschematools.client.schemas.validation.JsonSchemaInfo; +import org.openapijsonschematools.client.schemas.validation.MapSchemaValidator; +import org.openapijsonschematools.client.schemas.validation.PathToSchemasMap; +import org.openapijsonschematools.client.schemas.validation.PropertyEntry; +import org.openapijsonschematools.client.schemas.validation.ValidationMetadata; + +public class File { + // nest classes so all schemas and input/output classes can be public + + + public static class SourceURI extends StringJsonSchema.StringJsonSchema1 { + private static @Nullable SourceURI instance = null; + public static SourceURI getInstance() { + if (instance == null) { + instance = new SourceURI(); + } + return instance; + } + } + + + public static class FileMap extends FrozenMap<@Nullable Object> { + protected FileMap(FrozenMap<@Nullable Object> m) { + super(m); + } + public static final Set requiredKeys = Set.of(); + public static final Set optionalKeys = Set.of( + "sourceURI" + ); + public static FileMap of(Map arg, SchemaConfiguration configuration) throws ValidationException { + return File1.getInstance().validate(arg, configuration); + } + + public String sourceURI() throws UnsetPropertyException { + String key = "sourceURI"; + throwIfKeyNotPresent(key); + @Nullable Object value = get(key); + if (!(value instanceof String)) { + throw new RuntimeException("Invalid value stored for sourceURI"); + } + return (String) value; + } + + public @Nullable Object getAdditionalProperty(String name) throws UnsetPropertyException, InvalidAdditionalPropertyException { + throwIfKeyKnown(name, requiredKeys, optionalKeys); + throwIfKeyNotPresent(name); + return get(name); + } + } + + public interface SetterForSourceURI { + Map getInstance(); + T getBuilderAfterSourceURI(Map instance); + + default T sourceURI(String value) { + var instance = getInstance(); + instance.put("sourceURI", value); + return getBuilderAfterSourceURI(instance); + } + } + + public static class FileMapBuilder extends UnsetAddPropsSetter implements GenericBuilder>, SetterForSourceURI { + private final Map instance; + private static final Set knownKeys = Set.of( + "sourceURI" + ); + public Set getKnownKeys() { + return knownKeys; + } + public FileMapBuilder() { + this.instance = new LinkedHashMap<>(); + } + public Map build() { + return instance; + } + public Map getInstance() { + return instance; + } + public FileMapBuilder getBuilderAfterSourceURI(Map instance) { + return this; + } + public FileMapBuilder getBuilderAfterAdditionalProperty(Map instance) { + return this; + } + } + + + public sealed interface File1Boxed permits File1BoxedMap { + @Nullable Object getData(); + } + + public record File1BoxedMap(FileMap data) implements File1Boxed { + @Override + public @Nullable Object getData() { + return data; + } + } + + + public static class File1 extends JsonSchema implements MapSchemaValidator { + /* + NOTE: This class is auto generated by OpenAPI JSON Schema Generator. + Ref: https://github.com/openapi-json-schema-tools/openapi-json-schema-generator + + Do not edit the class manually. + + Must be named `File` for test. + */ + private static @Nullable File1 instance = null; + + protected File1() { + super(new JsonSchemaInfo() + .type(Set.of(Map.class)) + .properties(Map.ofEntries( + new PropertyEntry("sourceURI", SourceURI.class) + )) + ); + } + + public static File1 getInstance() { + if (instance == null) { + instance = new File1(); + } + return instance; + } + + 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 RuntimeException("Invalid non-string key value"); + } + String propertyName = (String) entryKey; + List propertyPathToItem = new ArrayList<>(pathToItem); + propertyPathToItem.add(propertyName); + Object value = entry.getValue(); + LinkedHashMap, Nothing?> schemas = pathToSchemas.get(propertyPathToItem); + if (schemas == null) { + throw new RuntimeException("Validation result is invalid, schemas must exist for a pathToItem"); + } + JsonSchema propertySchema = schemas.entrySet().iterator().next().getKey(); + @Nullable Object propertyInstance = propertySchema.getNewInstance(value, propertyPathToItem, pathToSchemas); + properties.put(propertyName, propertyInstance); + } + FrozenMap<@Nullable Object> castProperties = new FrozenMap<>(properties); + return new FileMap(castProperties); + } + + 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); + SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().build())); + ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, new PathToSchemasMap(), new LinkedHashSet<>()); + PathToSchemasMap pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet); + return getNewInstance(castArg, validationMetadata.pathToItem(), pathToSchemasMap); + } + + + @Override + public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws 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"); + } + @Override + public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { + if (arg instanceof Map) { + return getNewInstance((Map) arg, pathToItem, pathToSchemas); + } + 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 { + return new File1BoxedMap(validate(arg, configuration)); + } + @Override + public File1Boxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { + 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"); + } + } + +} diff --git a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/schemas/FileSchemaTestClass.kt b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/schemas/FileSchemaTestClass.kt new file mode 100644 index 00000000000..6336a6aab3c --- /dev/null +++ b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/schemas/FileSchemaTestClass.kt @@ -0,0 +1,345 @@ +package org.openapijsonschematools.client.components.schemas; +import java.util.ArrayList; +import java.util.HashSet; +import java.util.LinkedHashMap; +import java.util.LinkedHashSet; +import java.util.List; +import java.util.Map; +import java.util.Objects; +import java.util.Set; +import org.checkerframework.checker.nullness.qual.Nullable; +import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags; +import org.openapijsonschematools.client.configurations.SchemaConfiguration; +import org.openapijsonschematools.client.exceptions.InvalidAdditionalPropertyException; +import org.openapijsonschematools.client.exceptions.UnsetPropertyException; +import org.openapijsonschematools.client.exceptions.ValidationException; +import org.openapijsonschematools.client.schemas.GenericBuilder; +import org.openapijsonschematools.client.schemas.UnsetAddPropsSetter; +import org.openapijsonschematools.client.schemas.validation.FrozenList; +import org.openapijsonschematools.client.schemas.validation.FrozenMap; +import org.openapijsonschematools.client.schemas.validation.JsonSchema; +import org.openapijsonschematools.client.schemas.validation.JsonSchemaInfo; +import org.openapijsonschematools.client.schemas.validation.ListSchemaValidator; +import org.openapijsonschematools.client.schemas.validation.MapSchemaValidator; +import org.openapijsonschematools.client.schemas.validation.PathToSchemasMap; +import org.openapijsonschematools.client.schemas.validation.PropertyEntry; +import org.openapijsonschematools.client.schemas.validation.ValidationMetadata; + +public class FileSchemaTestClass { + // nest classes so all schemas and input/output classes can be public + + + public static class FilesList extends FrozenList { + protected FilesList(FrozenList m) { + super(m); + } + public static FilesList of(List> arg, SchemaConfiguration configuration) throws ValidationException { + return Files.getInstance().validate(arg, configuration); + } + } + + public static class FilesListBuilder { + // class to build List> + private final List> list; + + public FilesListBuilder() { + list = new ArrayList<>(); + } + + public FilesListBuilder(List> list) { + this.list = list; + } + + public FilesListBuilder add(Map item) { + list.add(item); + return this; + } + + public List> build() { + return list; + } + } + + + public sealed interface FilesBoxed permits FilesBoxedList { + @Nullable Object getData(); + } + + public record FilesBoxedList(FilesList data) implements FilesBoxed { + @Override + public @Nullable Object getData() { + return data; + } + } + + + + public static class Files extends JsonSchema implements ListSchemaValidator { + private static @Nullable Files instance = null; + + protected Files() { + super(new JsonSchemaInfo() + .type(Set.of(List.class)) + .items(File.File1.class) + ); + } + + public static Files getInstance() { + if (instance == null) { + instance = new Files(); + } + return instance; + } + + @Override + public FilesList getNewInstance(List arg, List pathToItem, PathToSchemasMap pathToSchemas) { + List items = new ArrayList<>(); + int i = 0; + for (Object item: arg) { + List itemPathToItem = new ArrayList<>(pathToItem); + itemPathToItem.add(i); + LinkedHashMap, Nothing?> schemas = pathToSchemas.get(itemPathToItem); + if (schemas == null) { + throw new RuntimeException("Validation 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"); + } + items.add((File.FileMap) itemInstance); + i += 1; + } + FrozenList newInstanceItems = new FrozenList<>(items); + return new FilesList(newInstanceItems); + } + + 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); + SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().build())); + ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, new PathToSchemasMap(), new LinkedHashSet<>()); + PathToSchemasMap pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet); + return getNewInstance(castArg, validationMetadata.pathToItem(), pathToSchemasMap); + } + + @Override + public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws 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"); + } + @Override + public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { + 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"); + } + @Override + 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 { + 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"); + } + } + + public static class FileSchemaTestClassMap extends FrozenMap<@Nullable Object> { + protected FileSchemaTestClassMap(FrozenMap<@Nullable Object> m) { + super(m); + } + public static final Set requiredKeys = Set.of(); + public static final Set optionalKeys = Set.of( + "file", + "files" + ); + public static FileSchemaTestClassMap of(Map arg, SchemaConfiguration configuration) throws ValidationException { + return FileSchemaTestClass1.getInstance().validate(arg, configuration); + } + + public File.FileMap file() throws UnsetPropertyException { + String key = "file"; + throwIfKeyNotPresent(key); + @Nullable Object value = get(key); + if (!(value instanceof File.FileMap)) { + throw new RuntimeException("Invalid value stored for file"); + } + return (File.FileMap) value; + } + + public FilesList files() throws UnsetPropertyException { + String key = "files"; + throwIfKeyNotPresent(key); + @Nullable Object value = get(key); + if (!(value instanceof FilesList)) { + throw new RuntimeException("Invalid value stored for files"); + } + return (FilesList) value; + } + + public @Nullable Object getAdditionalProperty(String name) throws UnsetPropertyException, InvalidAdditionalPropertyException { + throwIfKeyKnown(name, requiredKeys, optionalKeys); + throwIfKeyNotPresent(name); + return get(name); + } + } + + public interface SetterForFile { + Map getInstance(); + T getBuilderAfterFile(Map instance); + + default T file(Map value) { + var instance = getInstance(); + instance.put("file", value); + return getBuilderAfterFile(instance); + } + } + + public interface SetterForFiles { + Map getInstance(); + T getBuilderAfterFiles(Map instance); + + default T files(List> value) { + var instance = getInstance(); + instance.put("files", value); + return getBuilderAfterFiles(instance); + } + } + + public static class FileSchemaTestClassMapBuilder extends UnsetAddPropsSetter implements GenericBuilder>, SetterForFile, SetterForFiles { + private final Map instance; + private static final Set knownKeys = Set.of( + "file", + "files" + ); + public Set getKnownKeys() { + return knownKeys; + } + public FileSchemaTestClassMapBuilder() { + this.instance = new LinkedHashMap<>(); + } + public Map build() { + return instance; + } + public Map getInstance() { + return instance; + } + public FileSchemaTestClassMapBuilder getBuilderAfterFile(Map instance) { + return this; + } + public FileSchemaTestClassMapBuilder getBuilderAfterFiles(Map instance) { + return this; + } + public FileSchemaTestClassMapBuilder getBuilderAfterAdditionalProperty(Map instance) { + return this; + } + } + + + public sealed interface FileSchemaTestClass1Boxed permits FileSchemaTestClass1BoxedMap { + @Nullable Object getData(); + } + + public record FileSchemaTestClass1BoxedMap(FileSchemaTestClassMap data) implements FileSchemaTestClass1Boxed { + @Override + public @Nullable Object getData() { + return data; + } + } + + + public static class FileSchemaTestClass1 extends JsonSchema implements MapSchemaValidator { + /* + NOTE: This class is auto generated by OpenAPI JSON Schema Generator. + Ref: https://github.com/openapi-json-schema-tools/openapi-json-schema-generator + + Do not edit the class manually. + */ + private static @Nullable FileSchemaTestClass1 instance = null; + + protected FileSchemaTestClass1() { + super(new JsonSchemaInfo() + .type(Set.of(Map.class)) + .properties(Map.ofEntries( + new PropertyEntry("file", File.File1.class), + new PropertyEntry("files", Files.class) + )) + ); + } + + public static FileSchemaTestClass1 getInstance() { + if (instance == null) { + instance = new FileSchemaTestClass1(); + } + return instance; + } + + 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 RuntimeException("Invalid non-string key value"); + } + String propertyName = (String) entryKey; + List propertyPathToItem = new ArrayList<>(pathToItem); + propertyPathToItem.add(propertyName); + Object value = entry.getValue(); + LinkedHashMap, Nothing?> schemas = pathToSchemas.get(propertyPathToItem); + if (schemas == null) { + throw new RuntimeException("Validation result is invalid, schemas must exist for a pathToItem"); + } + JsonSchema propertySchema = schemas.entrySet().iterator().next().getKey(); + @Nullable Object propertyInstance = propertySchema.getNewInstance(value, propertyPathToItem, pathToSchemas); + properties.put(propertyName, propertyInstance); + } + FrozenMap<@Nullable Object> castProperties = new FrozenMap<>(properties); + return new FileSchemaTestClassMap(castProperties); + } + + 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); + SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().build())); + ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, new PathToSchemasMap(), new LinkedHashSet<>()); + PathToSchemasMap pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet); + return getNewInstance(castArg, validationMetadata.pathToItem(), pathToSchemasMap); + } + + + @Override + public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws 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"); + } + @Override + public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { + if (arg instanceof Map) { + return getNewInstance((Map) arg, pathToItem, pathToSchemas); + } + 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 { + return new FileSchemaTestClass1BoxedMap(validate(arg, configuration)); + } + @Override + public FileSchemaTestClass1Boxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { + 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"); + } + } + +} diff --git a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/schemas/Foo.kt b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/schemas/Foo.kt new file mode 100644 index 00000000000..2b293f4ddb7 --- /dev/null +++ b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/schemas/Foo.kt @@ -0,0 +1,194 @@ +package org.openapijsonschematools.client.components.schemas; +import java.util.ArrayList; +import java.util.HashSet; +import java.util.LinkedHashMap; +import java.util.LinkedHashSet; +import java.util.List; +import java.util.Map; +import java.util.Objects; +import java.util.Set; +import org.checkerframework.checker.nullness.qual.Nullable; +import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags; +import org.openapijsonschematools.client.configurations.SchemaConfiguration; +import org.openapijsonschematools.client.exceptions.InvalidAdditionalPropertyException; +import org.openapijsonschematools.client.exceptions.UnsetPropertyException; +import org.openapijsonschematools.client.exceptions.ValidationException; +import org.openapijsonschematools.client.schemas.GenericBuilder; +import org.openapijsonschematools.client.schemas.UnsetAddPropsSetter; +import org.openapijsonschematools.client.schemas.validation.FrozenMap; +import org.openapijsonschematools.client.schemas.validation.JsonSchema; +import org.openapijsonschematools.client.schemas.validation.JsonSchemaInfo; +import org.openapijsonschematools.client.schemas.validation.MapSchemaValidator; +import org.openapijsonschematools.client.schemas.validation.PathToSchemasMap; +import org.openapijsonschematools.client.schemas.validation.PropertyEntry; +import org.openapijsonschematools.client.schemas.validation.ValidationMetadata; + +public class Foo { + // nest classes so all schemas and input/output classes can be public + + + public static class FooMap extends FrozenMap<@Nullable Object> { + protected FooMap(FrozenMap<@Nullable Object> m) { + super(m); + } + public static final Set requiredKeys = Set.of(); + public static final Set optionalKeys = Set.of( + "bar" + ); + public static FooMap of(Map arg, SchemaConfiguration configuration) throws ValidationException { + return Foo1.getInstance().validate(arg, configuration); + } + + public String bar() throws UnsetPropertyException { + String key = "bar"; + throwIfKeyNotPresent(key); + @Nullable Object value = get(key); + if (!(value instanceof String)) { + throw new RuntimeException("Invalid value stored for bar"); + } + return (String) value; + } + + public @Nullable Object getAdditionalProperty(String name) throws UnsetPropertyException, InvalidAdditionalPropertyException { + throwIfKeyKnown(name, requiredKeys, optionalKeys); + throwIfKeyNotPresent(name); + return get(name); + } + } + + public interface SetterForBar { + Map getInstance(); + T getBuilderAfterBar(Map instance); + + default T bar(String value) { + var instance = getInstance(); + instance.put("bar", value); + return getBuilderAfterBar(instance); + } + } + + public static class FooMapBuilder extends UnsetAddPropsSetter implements GenericBuilder>, SetterForBar { + private final Map instance; + private static final Set knownKeys = Set.of( + "bar" + ); + public Set getKnownKeys() { + return knownKeys; + } + public FooMapBuilder() { + this.instance = new LinkedHashMap<>(); + } + public Map build() { + return instance; + } + public Map getInstance() { + return instance; + } + public FooMapBuilder getBuilderAfterBar(Map instance) { + return this; + } + public FooMapBuilder getBuilderAfterAdditionalProperty(Map instance) { + return this; + } + } + + + public sealed interface Foo1Boxed permits Foo1BoxedMap { + @Nullable Object getData(); + } + + public record Foo1BoxedMap(FooMap data) implements Foo1Boxed { + @Override + public @Nullable Object getData() { + return data; + } + } + + + public static class Foo1 extends JsonSchema implements MapSchemaValidator { + /* + NOTE: This class is auto generated by OpenAPI JSON Schema Generator. + Ref: https://github.com/openapi-json-schema-tools/openapi-json-schema-generator + + Do not edit the class manually. + */ + private static @Nullable Foo1 instance = null; + + protected Foo1() { + super(new JsonSchemaInfo() + .type(Set.of(Map.class)) + .properties(Map.ofEntries( + new PropertyEntry("bar", Bar.Bar1.class) + )) + ); + } + + public static Foo1 getInstance() { + if (instance == null) { + instance = new Foo1(); + } + return instance; + } + + 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 RuntimeException("Invalid non-string key value"); + } + String propertyName = (String) entryKey; + List propertyPathToItem = new ArrayList<>(pathToItem); + propertyPathToItem.add(propertyName); + Object value = entry.getValue(); + LinkedHashMap, Nothing?> schemas = pathToSchemas.get(propertyPathToItem); + if (schemas == null) { + throw new RuntimeException("Validation result is invalid, schemas must exist for a pathToItem"); + } + JsonSchema propertySchema = schemas.entrySet().iterator().next().getKey(); + @Nullable Object propertyInstance = propertySchema.getNewInstance(value, propertyPathToItem, pathToSchemas); + properties.put(propertyName, propertyInstance); + } + FrozenMap<@Nullable Object> castProperties = new FrozenMap<>(properties); + return new FooMap(castProperties); + } + + 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); + SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().build())); + ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, new PathToSchemasMap(), new LinkedHashSet<>()); + PathToSchemasMap pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet); + return getNewInstance(castArg, validationMetadata.pathToItem(), pathToSchemasMap); + } + + + @Override + public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws 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"); + } + @Override + public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { + if (arg instanceof Map) { + return getNewInstance((Map) arg, pathToItem, pathToSchemas); + } + 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 { + return new Foo1BoxedMap(validate(arg, configuration)); + } + @Override + public Foo1Boxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { + 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"); + } + } + +} diff --git a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/schemas/FormatTest.kt b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/schemas/FormatTest.kt new file mode 100644 index 00000000000..d6a31f4c867 --- /dev/null +++ b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/schemas/FormatTest.kt @@ -0,0 +1,2038 @@ +package org.openapijsonschematools.client.components.schemas; +import java.math.BigDecimal; +import java.util.ArrayList; +import java.util.HashSet; +import java.util.LinkedHashMap; +import java.util.LinkedHashSet; +import java.util.List; +import java.util.Map; +import java.util.Objects; +import java.util.Set; +import java.util.regex.Pattern; +import org.checkerframework.checker.nullness.qual.Nullable; +import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags; +import org.openapijsonschematools.client.configurations.SchemaConfiguration; +import org.openapijsonschematools.client.exceptions.InvalidAdditionalPropertyException; +import org.openapijsonschematools.client.exceptions.UnsetPropertyException; +import org.openapijsonschematools.client.exceptions.ValidationException; +import org.openapijsonschematools.client.schemas.DateJsonSchema; +import org.openapijsonschematools.client.schemas.DateTimeJsonSchema; +import org.openapijsonschematools.client.schemas.DoubleJsonSchema; +import org.openapijsonschematools.client.schemas.FloatJsonSchema; +import org.openapijsonschematools.client.schemas.GenericBuilder; +import org.openapijsonschematools.client.schemas.Int32JsonSchema; +import org.openapijsonschematools.client.schemas.Int64JsonSchema; +import org.openapijsonschematools.client.schemas.NullJsonSchema; +import org.openapijsonschematools.client.schemas.NumberJsonSchema; +import org.openapijsonschematools.client.schemas.StringJsonSchema; +import org.openapijsonschematools.client.schemas.UnsetAddPropsSetter; +import org.openapijsonschematools.client.schemas.UuidJsonSchema; +import org.openapijsonschematools.client.schemas.validation.FrozenList; +import org.openapijsonschematools.client.schemas.validation.FrozenMap; +import org.openapijsonschematools.client.schemas.validation.JsonSchema; +import org.openapijsonschematools.client.schemas.validation.JsonSchemaInfo; +import org.openapijsonschematools.client.schemas.validation.ListSchemaValidator; +import org.openapijsonschematools.client.schemas.validation.MapSchemaValidator; +import org.openapijsonschematools.client.schemas.validation.NumberSchemaValidator; +import org.openapijsonschematools.client.schemas.validation.PathToSchemasMap; +import org.openapijsonschematools.client.schemas.validation.PropertyEntry; +import org.openapijsonschematools.client.schemas.validation.StringSchemaValidator; +import org.openapijsonschematools.client.schemas.validation.ValidationMetadata; + +public class FormatTest { + // nest classes so all schemas and input/output classes can be public + + + public sealed interface IntegerSchemaBoxed permits IntegerSchemaBoxedNumber { + @Nullable Object getData(); + } + + public record IntegerSchemaBoxedNumber(Number data) implements IntegerSchemaBoxed { + @Override + public @Nullable Object getData() { + return data; + } + } + + + + public static class IntegerSchema extends JsonSchema implements NumberSchemaValidator { + private static @Nullable IntegerSchema instance = null; + + protected IntegerSchema() { + super(new JsonSchemaInfo() + .type(Set.of( + Integer.class, + Long.class, + Float.class, + Double.class + )) + .format("int") + .maximum(100) + .minimum(10) + .multipleOf(new BigDecimal("2")) + ); + } + + public static IntegerSchema getInstance() { + if (instance == null) { + instance = new IntegerSchema(); + } + return instance; + } + + @Override + public Number validate(Number arg, SchemaConfiguration configuration) throws ValidationException { + Set> pathSet = new HashSet<>(); + List pathToItem = List.of("args[0"); + Number castArg = castToAllowedTypes(arg, pathToItem, pathSet); + SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().build())); + ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, new PathToSchemasMap(), new LinkedHashSet<>()); + getPathToSchemas(this, castArg, validationMetadata, pathSet); + return castArg; + } + + public int validate(int arg, SchemaConfiguration configuration) throws ValidationException { + return (int) validate((Number) arg, configuration); + } + + public float validate(float arg, SchemaConfiguration configuration) throws ValidationException { + return (float) validate((Number) arg, configuration); + } + + public long validate(long arg, SchemaConfiguration configuration) throws ValidationException { + return (long) validate((Number) arg, configuration); + } + + 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 { + 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"); + } + @Override + public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { + 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"); + } + @Override + 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 { + 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"); + } + } + + public static class Int32 extends Int32JsonSchema.Int32JsonSchema1 { + private static @Nullable Int32 instance = null; + public static Int32 getInstance() { + if (instance == null) { + instance = new Int32(); + } + return instance; + } + } + + + public sealed interface Int32withValidationsBoxed permits Int32withValidationsBoxedNumber { + @Nullable Object getData(); + } + + public record Int32withValidationsBoxedNumber(Number data) implements Int32withValidationsBoxed { + @Override + public @Nullable Object getData() { + return data; + } + } + + + + public static class Int32withValidations extends JsonSchema implements NumberSchemaValidator { + private static @Nullable Int32withValidations instance = null; + + protected Int32withValidations() { + super(new JsonSchemaInfo() + .type(Set.of( + Integer.class, + Long.class, + Float.class, + Double.class + )) + .format("int32") + .maximum(200) + .minimum(20) + ); + } + + public static Int32withValidations getInstance() { + if (instance == null) { + instance = new Int32withValidations(); + } + return instance; + } + + @Override + public Number validate(Number arg, SchemaConfiguration configuration) throws ValidationException { + Set> pathSet = new HashSet<>(); + List pathToItem = List.of("args[0"); + Number castArg = castToAllowedTypes(arg, pathToItem, pathSet); + SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().build())); + ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, new PathToSchemasMap(), new LinkedHashSet<>()); + getPathToSchemas(this, castArg, validationMetadata, pathSet); + return castArg; + } + + public int validate(int arg, SchemaConfiguration configuration) throws ValidationException { + return (int) validate((Number) arg, configuration); + } + + 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 { + 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"); + } + @Override + public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { + 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"); + } + @Override + 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 { + 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"); + } + } + + public static class Int64 extends Int64JsonSchema.Int64JsonSchema1 { + private static @Nullable Int64 instance = null; + public static Int64 getInstance() { + if (instance == null) { + instance = new Int64(); + } + return instance; + } + } + + + public sealed interface NumberSchemaBoxed permits NumberSchemaBoxedNumber { + @Nullable Object getData(); + } + + public record NumberSchemaBoxedNumber(Number data) implements NumberSchemaBoxed { + @Override + public @Nullable Object getData() { + return data; + } + } + + + + public static class NumberSchema extends JsonSchema implements NumberSchemaValidator { + private static @Nullable NumberSchema instance = null; + + protected NumberSchema() { + super(new JsonSchemaInfo() + .type(Set.of( + Integer.class, + Long.class, + Float.class, + Double.class + )) + .maximum(543.2) + .minimum(32.1) + .multipleOf(new BigDecimal("32.5")) + ); + } + + public static NumberSchema getInstance() { + if (instance == null) { + instance = new NumberSchema(); + } + return instance; + } + + @Override + public Number validate(Number arg, SchemaConfiguration configuration) throws ValidationException { + Set> pathSet = new HashSet<>(); + List pathToItem = List.of("args[0"); + Number castArg = castToAllowedTypes(arg, pathToItem, pathSet); + SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().build())); + ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, new PathToSchemasMap(), new LinkedHashSet<>()); + PathToSchemasMap pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet); + return castArg; + } + + public int validate(int arg, SchemaConfiguration configuration) throws ValidationException { + return (int) validate((Number) arg, configuration); + } + + public long validate(long arg, SchemaConfiguration configuration) throws ValidationException { + return (long) validate((Number) arg, configuration); + } + + public float validate(float arg, SchemaConfiguration configuration) throws ValidationException { + return (float) validate((Number) arg, configuration); + } + + 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 { + 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"); + } + @Override + public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { + 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"); + } + @Override + 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 { + 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"); + } + } + + public sealed interface FloatSchemaBoxed permits FloatSchemaBoxedNumber { + @Nullable Object getData(); + } + + public record FloatSchemaBoxedNumber(Number data) implements FloatSchemaBoxed { + @Override + public @Nullable Object getData() { + return data; + } + } + + + + public static class FloatSchema extends JsonSchema implements NumberSchemaValidator { + private static @Nullable FloatSchema instance = null; + + protected FloatSchema() { + super(new JsonSchemaInfo() + .type(Set.of( + Integer.class, + Long.class, + Float.class, + Double.class + )) + .format("float") + .maximum(987.6) + .minimum(54.3) + ); + } + + public static FloatSchema getInstance() { + if (instance == null) { + instance = new FloatSchema(); + } + return instance; + } + + @Override + public Number validate(Number arg, SchemaConfiguration configuration) throws ValidationException { + Set> pathSet = new HashSet<>(); + List pathToItem = List.of("args[0"); + Number castArg = castToAllowedTypes(arg, pathToItem, pathSet); + SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().build())); + ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, new PathToSchemasMap(), new LinkedHashSet<>()); + PathToSchemasMap pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet); + return castArg; + } + 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 { + 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"); + } + @Override + public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { + 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"); + } + @Override + 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 { + 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"); + } + } + + public static class Float32 extends FloatJsonSchema.FloatJsonSchema1 { + private static @Nullable Float32 instance = null; + public static Float32 getInstance() { + if (instance == null) { + instance = new Float32(); + } + return instance; + } + } + + + public sealed interface DoubleSchemaBoxed permits DoubleSchemaBoxedNumber { + @Nullable Object getData(); + } + + public record DoubleSchemaBoxedNumber(Number data) implements DoubleSchemaBoxed { + @Override + public @Nullable Object getData() { + return data; + } + } + + + + public static class DoubleSchema extends JsonSchema implements NumberSchemaValidator { + private static @Nullable DoubleSchema instance = null; + + protected DoubleSchema() { + super(new JsonSchemaInfo() + .type(Set.of( + Integer.class, + Long.class, + Float.class, + Double.class + )) + .format("double") + .maximum(123.4) + .minimum(67.8) + ); + } + + public static DoubleSchema getInstance() { + if (instance == null) { + instance = new DoubleSchema(); + } + return instance; + } + + @Override + public Number validate(Number arg, SchemaConfiguration configuration) throws ValidationException { + Set> pathSet = new HashSet<>(); + List pathToItem = List.of("args[0"); + Number castArg = castToAllowedTypes(arg, pathToItem, pathSet); + SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().build())); + ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, new PathToSchemasMap(), new LinkedHashSet<>()); + PathToSchemasMap pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet); + return castArg; + } + 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 { + 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"); + } + @Override + public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { + 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"); + } + @Override + 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 { + 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"); + } + } + + public static class Float64 extends DoubleJsonSchema.DoubleJsonSchema1 { + private static @Nullable Float64 instance = null; + public static Float64 getInstance() { + if (instance == null) { + instance = new Float64(); + } + return instance; + } + } + + + public static class Items extends NumberJsonSchema.NumberJsonSchema1 { + private static @Nullable Items instance = null; + public static Items getInstance() { + if (instance == null) { + instance = new Items(); + } + return instance; + } + } + + + public static class ArrayWithUniqueItemsList extends FrozenList { + protected ArrayWithUniqueItemsList(FrozenList m) { + super(m); + } + public static ArrayWithUniqueItemsList of(List arg, SchemaConfiguration configuration) throws ValidationException { + return ArrayWithUniqueItems.getInstance().validate(arg, configuration); + } + } + + public static class ArrayWithUniqueItemsListBuilder { + // class to build List + private final List list; + + public ArrayWithUniqueItemsListBuilder() { + list = new ArrayList<>(); + } + + public ArrayWithUniqueItemsListBuilder(List list) { + this.list = list; + } + + public ArrayWithUniqueItemsListBuilder add(int item) { + list.add(item); + return this; + } + + public ArrayWithUniqueItemsListBuilder add(float item) { + list.add(item); + return this; + } + + public ArrayWithUniqueItemsListBuilder add(long item) { + list.add(item); + return this; + } + + public ArrayWithUniqueItemsListBuilder add(double item) { + list.add(item); + return this; + } + + public List build() { + return list; + } + } + + + public sealed interface ArrayWithUniqueItemsBoxed permits ArrayWithUniqueItemsBoxedList { + @Nullable Object getData(); + } + + public record ArrayWithUniqueItemsBoxedList(ArrayWithUniqueItemsList data) implements ArrayWithUniqueItemsBoxed { + @Override + public @Nullable Object getData() { + return data; + } + } + + + + public static class ArrayWithUniqueItems extends JsonSchema implements ListSchemaValidator { + private static @Nullable ArrayWithUniqueItems instance = null; + + protected ArrayWithUniqueItems() { + super(new JsonSchemaInfo() + .type(Set.of(List.class)) + .items(Items.class) + .uniqueItems(true) + ); + } + + public static ArrayWithUniqueItems getInstance() { + if (instance == null) { + instance = new ArrayWithUniqueItems(); + } + return instance; + } + + @Override + public ArrayWithUniqueItemsList getNewInstance(List arg, List pathToItem, PathToSchemasMap pathToSchemas) { + List items = new ArrayList<>(); + int i = 0; + for (Object item: arg) { + List itemPathToItem = new ArrayList<>(pathToItem); + itemPathToItem.add(i); + LinkedHashMap, Nothing?> schemas = pathToSchemas.get(itemPathToItem); + if (schemas == null) { + throw new RuntimeException("Validation 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"); + } + items.add((Number) itemInstance); + i += 1; + } + FrozenList newInstanceItems = new FrozenList<>(items); + return new ArrayWithUniqueItemsList(newInstanceItems); + } + + 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); + SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().build())); + ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, new PathToSchemasMap(), new LinkedHashSet<>()); + PathToSchemasMap pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet); + return getNewInstance(castArg, validationMetadata.pathToItem(), pathToSchemasMap); + } + + @Override + public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws 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"); + } + @Override + public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { + 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"); + } + @Override + 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 { + 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"); + } + } + + public sealed interface StringSchemaBoxed permits StringSchemaBoxedString { + @Nullable Object getData(); + } + + public record StringSchemaBoxedString(String data) implements StringSchemaBoxed { + @Override + public @Nullable Object getData() { + return data; + } + } + + + + public static class StringSchema extends JsonSchema implements StringSchemaValidator { + private static @Nullable StringSchema instance = null; + + protected StringSchema() { + super(new JsonSchemaInfo() + .type(Set.of( + String.class + )) + .pattern(Pattern.compile( + "[a-z]", + Pattern.CASE_INSENSITIVE + )) + ); + } + + public static StringSchema getInstance() { + if (instance == null) { + instance = new StringSchema(); + } + return instance; + } + + @Override + public String validate(String arg, SchemaConfiguration configuration) throws ValidationException { + Set> pathSet = new HashSet<>(); + List pathToItem = List.of("args[0"); + String castArg = castToAllowedTypes(arg, pathToItem, pathSet); + SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().build())); + ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, new PathToSchemasMap(), new LinkedHashSet<>()); + getPathToSchemas(this, castArg, validationMetadata, pathSet); + return castArg; + } + + @Override + public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws 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"); + } + @Override + public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { + 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"); + } + @Override + 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 { + 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"); + } + } + + public static class ByteSchema extends StringJsonSchema.StringJsonSchema1 { + private static @Nullable ByteSchema instance = null; + public static ByteSchema getInstance() { + if (instance == null) { + instance = new ByteSchema(); + } + return instance; + } + } + + + public static class Binary extends StringJsonSchema.StringJsonSchema1 { + // BinarySchema + private static @Nullable Binary instance = null; + public static Binary getInstance() { + if (instance == null) { + instance = new Binary(); + } + return instance; + } + } + + + public static class Date extends DateJsonSchema.DateJsonSchema1 { + private static @Nullable Date instance = null; + public static Date getInstance() { + if (instance == null) { + instance = new Date(); + } + return instance; + } + } + + + public static class DateTime extends DateTimeJsonSchema.DateTimeJsonSchema1 { + private static @Nullable DateTime instance = null; + public static DateTime getInstance() { + if (instance == null) { + instance = new DateTime(); + } + return instance; + } + } + + + public static class UuidSchema extends UuidJsonSchema.UuidJsonSchema1 { + private static @Nullable UuidSchema instance = null; + public static UuidSchema getInstance() { + if (instance == null) { + instance = new UuidSchema(); + } + return instance; + } + } + + + public static class UuidNoExample extends UuidJsonSchema.UuidJsonSchema1 { + private static @Nullable UuidNoExample instance = null; + public static UuidNoExample getInstance() { + if (instance == null) { + instance = new UuidNoExample(); + } + return instance; + } + } + + + public sealed interface PasswordBoxed permits PasswordBoxedString { + @Nullable Object getData(); + } + + public record PasswordBoxedString(String data) implements PasswordBoxed { + @Override + public @Nullable Object getData() { + return data; + } + } + + + + public static class Password extends JsonSchema implements StringSchemaValidator { + private static @Nullable Password instance = null; + + protected Password() { + super(new JsonSchemaInfo() + .type(Set.of( + String.class + )) + .format("password") + .maxLength(64) + .minLength(10) + ); + } + + public static Password getInstance() { + if (instance == null) { + instance = new Password(); + } + return instance; + } + + @Override + public String validate(String arg, SchemaConfiguration configuration) throws ValidationException { + Set> pathSet = new HashSet<>(); + List pathToItem = List.of("args[0"); + String castArg = castToAllowedTypes(arg, pathToItem, pathSet); + SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().build())); + ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, new PathToSchemasMap(), new LinkedHashSet<>()); + getPathToSchemas(this, castArg, validationMetadata, pathSet); + return castArg; + } + + @Override + public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws 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"); + } + @Override + public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { + 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"); + } + @Override + 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 { + 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"); + } + } + + public sealed interface PatternWithDigitsBoxed permits PatternWithDigitsBoxedString { + @Nullable Object getData(); + } + + public record PatternWithDigitsBoxedString(String data) implements PatternWithDigitsBoxed { + @Override + public @Nullable Object getData() { + return data; + } + } + + + + public static class PatternWithDigits extends JsonSchema implements StringSchemaValidator { + private static @Nullable PatternWithDigits instance = null; + + protected PatternWithDigits() { + super(new JsonSchemaInfo() + .type(Set.of( + String.class + )) + .pattern(Pattern.compile( + "^\\d{10}$" + )) + ); + } + + public static PatternWithDigits getInstance() { + if (instance == null) { + instance = new PatternWithDigits(); + } + return instance; + } + + @Override + public String validate(String arg, SchemaConfiguration configuration) throws ValidationException { + Set> pathSet = new HashSet<>(); + List pathToItem = List.of("args[0"); + String castArg = castToAllowedTypes(arg, pathToItem, pathSet); + SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().build())); + ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, new PathToSchemasMap(), new LinkedHashSet<>()); + getPathToSchemas(this, castArg, validationMetadata, pathSet); + return castArg; + } + + @Override + public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws 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"); + } + @Override + public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { + 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"); + } + @Override + 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 { + 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"); + } + } + + public sealed interface PatternWithDigitsAndDelimiterBoxed permits PatternWithDigitsAndDelimiterBoxedString { + @Nullable Object getData(); + } + + public record PatternWithDigitsAndDelimiterBoxedString(String data) implements PatternWithDigitsAndDelimiterBoxed { + @Override + public @Nullable Object getData() { + return data; + } + } + + + + public static class PatternWithDigitsAndDelimiter extends JsonSchema implements StringSchemaValidator { + private static @Nullable PatternWithDigitsAndDelimiter instance = null; + + protected PatternWithDigitsAndDelimiter() { + super(new JsonSchemaInfo() + .type(Set.of( + String.class + )) + .pattern(Pattern.compile( + "^image_\\d{1,3}$", + Pattern.CASE_INSENSITIVE + )) + ); + } + + public static PatternWithDigitsAndDelimiter getInstance() { + if (instance == null) { + instance = new PatternWithDigitsAndDelimiter(); + } + return instance; + } + + @Override + public String validate(String arg, SchemaConfiguration configuration) throws ValidationException { + Set> pathSet = new HashSet<>(); + List pathToItem = List.of("args[0"); + String castArg = castToAllowedTypes(arg, pathToItem, pathSet); + SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().build())); + ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, new PathToSchemasMap(), new LinkedHashSet<>()); + getPathToSchemas(this, castArg, validationMetadata, pathSet); + return castArg; + } + + @Override + public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws 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"); + } + @Override + public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { + 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"); + } + @Override + 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 { + 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"); + } + } + + public static class NoneProp extends NullJsonSchema.NullJsonSchema1 { + private static @Nullable NoneProp instance = null; + public static NoneProp getInstance() { + if (instance == null) { + instance = new NoneProp(); + } + return instance; + } + } + + + public static class FormatTestMap extends FrozenMap<@Nullable Object> { + protected FormatTestMap(FrozenMap<@Nullable Object> m) { + super(m); + } + public static final Set requiredKeys = Set.of( + "byte", + "date", + "number", + "password" + ); + public static final Set optionalKeys = Set.of( + "integer", + "int32", + "int32withValidations", + "int64", + "float", + "float32", + "double", + "float64", + "arrayWithUniqueItems", + "string", + "binary", + "dateTime", + "uuid", + "uuidNoExample", + "pattern_with_digits", + "pattern_with_digits_and_delimiter", + "noneProp" + ); + public static FormatTestMap of(Map arg, SchemaConfiguration configuration) throws ValidationException { + return FormatTest1.getInstance().validate(arg, configuration); + } + + public String date() { + @Nullable Object value = get("date"); + if (!(value instanceof String)) { + throw new RuntimeException("Invalid value stored for date"); + } + return (String) value; + } + + public String password() { + @Nullable Object value = get("password"); + if (!(value instanceof String)) { + throw new RuntimeException("Invalid value stored for password"); + } + return (String) value; + } + + public Number int32() throws UnsetPropertyException { + String key = "int32"; + throwIfKeyNotPresent(key); + @Nullable Object value = get(key); + if (!(value instanceof Number)) { + throw new RuntimeException("Invalid value stored for int32"); + } + return (Number) value; + } + + public Number int32withValidations() throws UnsetPropertyException { + String key = "int32withValidations"; + throwIfKeyNotPresent(key); + @Nullable Object value = get(key); + if (!(value instanceof Number)) { + throw new RuntimeException("Invalid value stored for int32withValidations"); + } + return (Number) value; + } + + public Number int64() throws UnsetPropertyException { + String key = "int64"; + throwIfKeyNotPresent(key); + @Nullable Object value = get(key); + if (!(value instanceof Number)) { + throw new RuntimeException("Invalid value stored for int64"); + } + return (Number) value; + } + + public Number float32() throws UnsetPropertyException { + String key = "float32"; + throwIfKeyNotPresent(key); + @Nullable Object value = get(key); + if (!(value instanceof Number)) { + throw new RuntimeException("Invalid value stored for float32"); + } + return (Number) value; + } + + public Number float64() throws UnsetPropertyException { + String key = "float64"; + throwIfKeyNotPresent(key); + @Nullable Object value = get(key); + if (!(value instanceof Number)) { + throw new RuntimeException("Invalid value stored for float64"); + } + return (Number) value; + } + + public ArrayWithUniqueItemsList arrayWithUniqueItems() throws UnsetPropertyException { + String key = "arrayWithUniqueItems"; + throwIfKeyNotPresent(key); + @Nullable Object value = get(key); + if (!(value instanceof ArrayWithUniqueItemsList)) { + throw new RuntimeException("Invalid value stored for arrayWithUniqueItems"); + } + return (ArrayWithUniqueItemsList) value; + } + + public String binary() throws UnsetPropertyException { + String key = "binary"; + throwIfKeyNotPresent(key); + @Nullable Object value = get(key); + if (!(value instanceof String)) { + throw new RuntimeException("Invalid value stored for binary"); + } + return (String) value; + } + + public String dateTime() throws UnsetPropertyException { + String key = "dateTime"; + throwIfKeyNotPresent(key); + @Nullable Object value = get(key); + if (!(value instanceof String)) { + throw new RuntimeException("Invalid value stored for dateTime"); + } + return (String) value; + } + + public String uuidNoExample() throws UnsetPropertyException { + String key = "uuidNoExample"; + throwIfKeyNotPresent(key); + @Nullable Object value = get(key); + if (!(value instanceof String)) { + throw new RuntimeException("Invalid value stored for uuidNoExample"); + } + return (String) value; + } + + public String pattern_with_digits() throws UnsetPropertyException { + String key = "pattern_with_digits"; + throwIfKeyNotPresent(key); + @Nullable Object value = get(key); + if (!(value instanceof String)) { + throw new RuntimeException("Invalid value stored for pattern_with_digits"); + } + return (String) value; + } + + public String pattern_with_digits_and_delimiter() throws UnsetPropertyException { + String key = "pattern_with_digits_and_delimiter"; + throwIfKeyNotPresent(key); + @Nullable Object value = get(key); + if (!(value instanceof String)) { + throw new RuntimeException("Invalid value stored for pattern_with_digits_and_delimiter"); + } + return (String) value; + } + + public Nothing? noneProp() throws UnsetPropertyException { + String key = "noneProp"; + throwIfKeyNotPresent(key); + @Nullable Object value = get(key); + if (!(value == null || value instanceof Nothing?)) { + throw new RuntimeException("Invalid value stored for noneProp"); + } + return (Nothing?) value; + } + + public @Nullable Object getAdditionalProperty(String name) throws UnsetPropertyException, InvalidAdditionalPropertyException { + throwIfKeyKnown(name, requiredKeys, optionalKeys); + throwIfKeyNotPresent(name); + return get(name); + } + } + + public interface SetterForByteSchema { + Map getInstance(); + T getBuilderAfterByteSchema(Map instance); + + default T setByte(String value) { + var instance = getInstance(); + instance.put("byte", value); + return getBuilderAfterByteSchema(instance); + } + } + + public interface SetterForDate { + Map getInstance(); + T getBuilderAfterDate(Map instance); + + default T date(String value) { + var instance = getInstance(); + instance.put("date", value); + return getBuilderAfterDate(instance); + } + } + + public interface SetterForNumberSchema { + Map getInstance(); + T getBuilderAfterNumberSchema(Map instance); + + default T setNumber(int value) { + var instance = getInstance(); + instance.put("number", value); + return getBuilderAfterNumberSchema(instance); + } + + default T setNumber(float value) { + var instance = getInstance(); + instance.put("number", value); + return getBuilderAfterNumberSchema(instance); + } + + default T setNumber(long value) { + var instance = getInstance(); + instance.put("number", value); + return getBuilderAfterNumberSchema(instance); + } + + default T setNumber(double value) { + var instance = getInstance(); + instance.put("number", value); + return getBuilderAfterNumberSchema(instance); + } + } + + public interface SetterForPassword { + Map getInstance(); + T getBuilderAfterPassword(Map instance); + + default T password(String value) { + var instance = getInstance(); + instance.put("password", value); + return getBuilderAfterPassword(instance); + } + } + + public interface SetterForIntegerSchema { + Map getInstance(); + T getBuilderAfterIntegerSchema(Map instance); + + default T setInteger(int value) { + var instance = getInstance(); + instance.put("integer", value); + return getBuilderAfterIntegerSchema(instance); + } + + default T setInteger(float value) { + var instance = getInstance(); + instance.put("integer", value); + return getBuilderAfterIntegerSchema(instance); + } + + default T setInteger(long value) { + var instance = getInstance(); + instance.put("integer", value); + return getBuilderAfterIntegerSchema(instance); + } + + default T setInteger(double value) { + var instance = getInstance(); + instance.put("integer", value); + return getBuilderAfterIntegerSchema(instance); + } + } + + public interface SetterForInt32 { + Map getInstance(); + T getBuilderAfterInt32(Map instance); + + default T int32(int value) { + var instance = getInstance(); + instance.put("int32", value); + return getBuilderAfterInt32(instance); + } + + default T int32(float value) { + var instance = getInstance(); + instance.put("int32", value); + return getBuilderAfterInt32(instance); + } + } + + public interface SetterForInt32withValidations { + Map getInstance(); + T getBuilderAfterInt32withValidations(Map instance); + + default T int32withValidations(int value) { + var instance = getInstance(); + instance.put("int32withValidations", value); + return getBuilderAfterInt32withValidations(instance); + } + + default T int32withValidations(float value) { + var instance = getInstance(); + instance.put("int32withValidations", value); + return getBuilderAfterInt32withValidations(instance); + } + } + + public interface SetterForInt64 { + Map getInstance(); + T getBuilderAfterInt64(Map instance); + + default T int64(int value) { + var instance = getInstance(); + instance.put("int64", value); + return getBuilderAfterInt64(instance); + } + + default T int64(float value) { + var instance = getInstance(); + instance.put("int64", value); + return getBuilderAfterInt64(instance); + } + + default T int64(long value) { + var instance = getInstance(); + instance.put("int64", value); + return getBuilderAfterInt64(instance); + } + + default T int64(double value) { + var instance = getInstance(); + instance.put("int64", value); + return getBuilderAfterInt64(instance); + } + } + + public interface SetterForFloatSchema { + Map getInstance(); + T getBuilderAfterFloatSchema(Map instance); + + default T setFloat(int value) { + var instance = getInstance(); + instance.put("float", value); + return getBuilderAfterFloatSchema(instance); + } + + default T setFloat(float value) { + var instance = getInstance(); + instance.put("float", value); + return getBuilderAfterFloatSchema(instance); + } + + default T setFloat(long value) { + var instance = getInstance(); + instance.put("float", value); + return getBuilderAfterFloatSchema(instance); + } + + default T setFloat(double value) { + var instance = getInstance(); + instance.put("float", value); + return getBuilderAfterFloatSchema(instance); + } + } + + public interface SetterForFloat32 { + Map getInstance(); + T getBuilderAfterFloat32(Map instance); + + default T float32(int value) { + var instance = getInstance(); + instance.put("float32", value); + return getBuilderAfterFloat32(instance); + } + + default T float32(float value) { + var instance = getInstance(); + instance.put("float32", value); + return getBuilderAfterFloat32(instance); + } + + default T float32(long value) { + var instance = getInstance(); + instance.put("float32", value); + return getBuilderAfterFloat32(instance); + } + + default T float32(double value) { + var instance = getInstance(); + instance.put("float32", value); + return getBuilderAfterFloat32(instance); + } + } + + public interface SetterForDoubleSchema { + Map getInstance(); + T getBuilderAfterDoubleSchema(Map instance); + + default T setDouble(int value) { + var instance = getInstance(); + instance.put("double", value); + return getBuilderAfterDoubleSchema(instance); + } + + default T setDouble(float value) { + var instance = getInstance(); + instance.put("double", value); + return getBuilderAfterDoubleSchema(instance); + } + + default T setDouble(long value) { + var instance = getInstance(); + instance.put("double", value); + return getBuilderAfterDoubleSchema(instance); + } + + default T setDouble(double value) { + var instance = getInstance(); + instance.put("double", value); + return getBuilderAfterDoubleSchema(instance); + } + } + + public interface SetterForFloat64 { + Map getInstance(); + T getBuilderAfterFloat64(Map instance); + + default T float64(int value) { + var instance = getInstance(); + instance.put("float64", value); + return getBuilderAfterFloat64(instance); + } + + default T float64(float value) { + var instance = getInstance(); + instance.put("float64", value); + return getBuilderAfterFloat64(instance); + } + + default T float64(long value) { + var instance = getInstance(); + instance.put("float64", value); + return getBuilderAfterFloat64(instance); + } + + default T float64(double value) { + var instance = getInstance(); + instance.put("float64", value); + return getBuilderAfterFloat64(instance); + } + } + + public interface SetterForArrayWithUniqueItems { + Map getInstance(); + T getBuilderAfterArrayWithUniqueItems(Map instance); + + default T arrayWithUniqueItems(List value) { + var instance = getInstance(); + instance.put("arrayWithUniqueItems", value); + return getBuilderAfterArrayWithUniqueItems(instance); + } + } + + public interface SetterForStringSchema { + Map getInstance(); + T getBuilderAfterStringSchema(Map instance); + + default T setString(String value) { + var instance = getInstance(); + instance.put("string", value); + return getBuilderAfterStringSchema(instance); + } + } + + public interface SetterForBinary { + Map getInstance(); + T getBuilderAfterBinary(Map instance); + + default T binary(String value) { + var instance = getInstance(); + instance.put("binary", value); + return getBuilderAfterBinary(instance); + } + } + + public interface SetterForDateTime { + Map getInstance(); + T getBuilderAfterDateTime(Map instance); + + default T dateTime(String value) { + var instance = getInstance(); + instance.put("dateTime", value); + return getBuilderAfterDateTime(instance); + } + } + + public interface SetterForUuidSchema { + Map getInstance(); + T getBuilderAfterUuidSchema(Map instance); + + default T setUuid(String value) { + var instance = getInstance(); + instance.put("uuid", value); + return getBuilderAfterUuidSchema(instance); + } + } + + public interface SetterForUuidNoExample { + Map getInstance(); + T getBuilderAfterUuidNoExample(Map instance); + + default T uuidNoExample(String value) { + var instance = getInstance(); + instance.put("uuidNoExample", value); + return getBuilderAfterUuidNoExample(instance); + } + } + + public interface SetterForPatternWithDigits { + Map getInstance(); + T getBuilderAfterPatternWithDigits(Map instance); + + default T pattern_with_digits(String value) { + var instance = getInstance(); + instance.put("pattern_with_digits", value); + return getBuilderAfterPatternWithDigits(instance); + } + } + + public interface SetterForPatternWithDigitsAndDelimiter { + Map getInstance(); + T getBuilderAfterPatternWithDigitsAndDelimiter(Map instance); + + default T pattern_with_digits_and_delimiter(String value) { + var instance = getInstance(); + instance.put("pattern_with_digits_and_delimiter", value); + return getBuilderAfterPatternWithDigitsAndDelimiter(instance); + } + } + + public interface SetterForNoneProp { + Map getInstance(); + T getBuilderAfterNoneProp(Map instance); + + default T noneProp(Nothing? value) { + var instance = getInstance(); + instance.put("noneProp", null); + return getBuilderAfterNoneProp(instance); + } + } + + public static class FormatTestMap0000Builder extends UnsetAddPropsSetter implements GenericBuilder>, SetterForIntegerSchema, SetterForInt32, SetterForInt32withValidations, SetterForInt64, SetterForFloatSchema, SetterForFloat32, SetterForDoubleSchema, SetterForFloat64, SetterForArrayWithUniqueItems, SetterForStringSchema, SetterForBinary, SetterForDateTime, SetterForUuidSchema, SetterForUuidNoExample, SetterForPatternWithDigits, SetterForPatternWithDigitsAndDelimiter, SetterForNoneProp { + private final Map instance; + private static final Set knownKeys = Set.of( + "byte", + "date", + "number", + "password", + "integer", + "int32", + "int32withValidations", + "int64", + "float", + "float32", + "double", + "float64", + "arrayWithUniqueItems", + "string", + "binary", + "dateTime", + "uuid", + "uuidNoExample", + "pattern_with_digits", + "pattern_with_digits_and_delimiter", + "noneProp" + ); + public Set getKnownKeys() { + return knownKeys; + } + public FormatTestMap0000Builder(Map instance) { + this.instance = instance; + } + public Map build() { + return instance; + } + public Map getInstance() { + return instance; + } + public FormatTestMap0000Builder getBuilderAfterIntegerSchema(Map instance) { + return this; + } + public FormatTestMap0000Builder getBuilderAfterInt32(Map instance) { + return this; + } + public FormatTestMap0000Builder getBuilderAfterInt32withValidations(Map instance) { + return this; + } + public FormatTestMap0000Builder getBuilderAfterInt64(Map instance) { + return this; + } + public FormatTestMap0000Builder getBuilderAfterFloatSchema(Map instance) { + return this; + } + public FormatTestMap0000Builder getBuilderAfterFloat32(Map instance) { + return this; + } + public FormatTestMap0000Builder getBuilderAfterDoubleSchema(Map instance) { + return this; + } + public FormatTestMap0000Builder getBuilderAfterFloat64(Map instance) { + return this; + } + public FormatTestMap0000Builder getBuilderAfterArrayWithUniqueItems(Map instance) { + return this; + } + public FormatTestMap0000Builder getBuilderAfterStringSchema(Map instance) { + return this; + } + public FormatTestMap0000Builder getBuilderAfterBinary(Map instance) { + return this; + } + public FormatTestMap0000Builder getBuilderAfterDateTime(Map instance) { + return this; + } + public FormatTestMap0000Builder getBuilderAfterUuidSchema(Map instance) { + return this; + } + public FormatTestMap0000Builder getBuilderAfterUuidNoExample(Map instance) { + return this; + } + public FormatTestMap0000Builder getBuilderAfterPatternWithDigits(Map instance) { + return this; + } + public FormatTestMap0000Builder getBuilderAfterPatternWithDigitsAndDelimiter(Map instance) { + return this; + } + public FormatTestMap0000Builder getBuilderAfterNoneProp(Map instance) { + return this; + } + public FormatTestMap0000Builder getBuilderAfterAdditionalProperty(Map instance) { + return this; + } + } + + public static class FormatTestMap0001Builder implements SetterForPassword { + private final Map instance; + public FormatTestMap0001Builder(Map instance) { + this.instance = instance; + } + public Map getInstance() { + return instance; + } + public FormatTestMap0000Builder getBuilderAfterPassword(Map instance) { + return new FormatTestMap0000Builder(instance); + } + } + + public static class FormatTestMap0010Builder implements SetterForNumberSchema { + private final Map instance; + public FormatTestMap0010Builder(Map instance) { + this.instance = instance; + } + public Map getInstance() { + return instance; + } + public FormatTestMap0000Builder getBuilderAfterNumberSchema(Map instance) { + return new FormatTestMap0000Builder(instance); + } + } + + public static class FormatTestMap0011Builder implements SetterForNumberSchema, SetterForPassword { + private final Map instance; + public FormatTestMap0011Builder(Map instance) { + this.instance = instance; + } + public Map getInstance() { + return instance; + } + public FormatTestMap0001Builder getBuilderAfterNumberSchema(Map instance) { + return new FormatTestMap0001Builder(instance); + } + public FormatTestMap0010Builder getBuilderAfterPassword(Map instance) { + return new FormatTestMap0010Builder(instance); + } + } + + public static class FormatTestMap0100Builder implements SetterForDate { + private final Map instance; + public FormatTestMap0100Builder(Map instance) { + this.instance = instance; + } + public Map getInstance() { + return instance; + } + public FormatTestMap0000Builder getBuilderAfterDate(Map instance) { + return new FormatTestMap0000Builder(instance); + } + } + + public static class FormatTestMap0101Builder implements SetterForDate, SetterForPassword { + private final Map instance; + public FormatTestMap0101Builder(Map instance) { + this.instance = instance; + } + public Map getInstance() { + return instance; + } + public FormatTestMap0001Builder getBuilderAfterDate(Map instance) { + return new FormatTestMap0001Builder(instance); + } + public FormatTestMap0100Builder getBuilderAfterPassword(Map instance) { + return new FormatTestMap0100Builder(instance); + } + } + + public static class FormatTestMap0110Builder implements SetterForDate, SetterForNumberSchema { + private final Map instance; + public FormatTestMap0110Builder(Map instance) { + this.instance = instance; + } + public Map getInstance() { + return instance; + } + public FormatTestMap0010Builder getBuilderAfterDate(Map instance) { + return new FormatTestMap0010Builder(instance); + } + public FormatTestMap0100Builder getBuilderAfterNumberSchema(Map instance) { + return new FormatTestMap0100Builder(instance); + } + } + + public static class FormatTestMap0111Builder implements SetterForDate, SetterForNumberSchema, SetterForPassword { + private final Map instance; + public FormatTestMap0111Builder(Map instance) { + this.instance = instance; + } + public Map getInstance() { + return instance; + } + public FormatTestMap0011Builder getBuilderAfterDate(Map instance) { + return new FormatTestMap0011Builder(instance); + } + public FormatTestMap0101Builder getBuilderAfterNumberSchema(Map instance) { + return new FormatTestMap0101Builder(instance); + } + public FormatTestMap0110Builder getBuilderAfterPassword(Map instance) { + return new FormatTestMap0110Builder(instance); + } + } + + public static class FormatTestMap1000Builder implements SetterForByteSchema { + private final Map instance; + public FormatTestMap1000Builder(Map instance) { + this.instance = instance; + } + public Map getInstance() { + return instance; + } + public FormatTestMap0000Builder getBuilderAfterByteSchema(Map instance) { + return new FormatTestMap0000Builder(instance); + } + } + + public static class FormatTestMap1001Builder implements SetterForByteSchema, SetterForPassword { + private final Map instance; + public FormatTestMap1001Builder(Map instance) { + this.instance = instance; + } + public Map getInstance() { + return instance; + } + public FormatTestMap0001Builder getBuilderAfterByteSchema(Map instance) { + return new FormatTestMap0001Builder(instance); + } + public FormatTestMap1000Builder getBuilderAfterPassword(Map instance) { + return new FormatTestMap1000Builder(instance); + } + } + + public static class FormatTestMap1010Builder implements SetterForByteSchema, SetterForNumberSchema { + private final Map instance; + public FormatTestMap1010Builder(Map instance) { + this.instance = instance; + } + public Map getInstance() { + return instance; + } + public FormatTestMap0010Builder getBuilderAfterByteSchema(Map instance) { + return new FormatTestMap0010Builder(instance); + } + public FormatTestMap1000Builder getBuilderAfterNumberSchema(Map instance) { + return new FormatTestMap1000Builder(instance); + } + } + + public static class FormatTestMap1011Builder implements SetterForByteSchema, SetterForNumberSchema, SetterForPassword { + private final Map instance; + public FormatTestMap1011Builder(Map instance) { + this.instance = instance; + } + public Map getInstance() { + return instance; + } + public FormatTestMap0011Builder getBuilderAfterByteSchema(Map instance) { + return new FormatTestMap0011Builder(instance); + } + public FormatTestMap1001Builder getBuilderAfterNumberSchema(Map instance) { + return new FormatTestMap1001Builder(instance); + } + public FormatTestMap1010Builder getBuilderAfterPassword(Map instance) { + return new FormatTestMap1010Builder(instance); + } + } + + public static class FormatTestMap1100Builder implements SetterForByteSchema, SetterForDate { + private final Map instance; + public FormatTestMap1100Builder(Map instance) { + this.instance = instance; + } + public Map getInstance() { + return instance; + } + public FormatTestMap0100Builder getBuilderAfterByteSchema(Map instance) { + return new FormatTestMap0100Builder(instance); + } + public FormatTestMap1000Builder getBuilderAfterDate(Map instance) { + return new FormatTestMap1000Builder(instance); + } + } + + public static class FormatTestMap1101Builder implements SetterForByteSchema, SetterForDate, SetterForPassword { + private final Map instance; + public FormatTestMap1101Builder(Map instance) { + this.instance = instance; + } + public Map getInstance() { + return instance; + } + public FormatTestMap0101Builder getBuilderAfterByteSchema(Map instance) { + return new FormatTestMap0101Builder(instance); + } + public FormatTestMap1001Builder getBuilderAfterDate(Map instance) { + return new FormatTestMap1001Builder(instance); + } + public FormatTestMap1100Builder getBuilderAfterPassword(Map instance) { + return new FormatTestMap1100Builder(instance); + } + } + + public static class FormatTestMap1110Builder implements SetterForByteSchema, SetterForDate, SetterForNumberSchema { + private final Map instance; + public FormatTestMap1110Builder(Map instance) { + this.instance = instance; + } + public Map getInstance() { + return instance; + } + public FormatTestMap0110Builder getBuilderAfterByteSchema(Map instance) { + return new FormatTestMap0110Builder(instance); + } + public FormatTestMap1010Builder getBuilderAfterDate(Map instance) { + return new FormatTestMap1010Builder(instance); + } + public FormatTestMap1100Builder getBuilderAfterNumberSchema(Map instance) { + return new FormatTestMap1100Builder(instance); + } + } + + public static class FormatTestMapBuilder implements SetterForByteSchema, SetterForDate, SetterForNumberSchema, SetterForPassword { + private final Map instance; + public FormatTestMapBuilder() { + this.instance = new LinkedHashMap<>(); + } + public Map getInstance() { + return instance; + } + public FormatTestMap0111Builder getBuilderAfterByteSchema(Map instance) { + return new FormatTestMap0111Builder(instance); + } + public FormatTestMap1011Builder getBuilderAfterDate(Map instance) { + return new FormatTestMap1011Builder(instance); + } + public FormatTestMap1101Builder getBuilderAfterNumberSchema(Map instance) { + return new FormatTestMap1101Builder(instance); + } + public FormatTestMap1110Builder getBuilderAfterPassword(Map instance) { + return new FormatTestMap1110Builder(instance); + } + } + + + public sealed interface FormatTest1Boxed permits FormatTest1BoxedMap { + @Nullable Object getData(); + } + + public record FormatTest1BoxedMap(FormatTestMap data) implements FormatTest1Boxed { + @Override + public @Nullable Object getData() { + return data; + } + } + + + public static class FormatTest1 extends JsonSchema implements MapSchemaValidator { + /* + NOTE: This class is auto generated by OpenAPI JSON Schema Generator. + Ref: https://github.com/openapi-json-schema-tools/openapi-json-schema-generator + + Do not edit the class manually. + */ + private static @Nullable FormatTest1 instance = null; + + protected FormatTest1() { + super(new JsonSchemaInfo() + .type(Set.of(Map.class)) + .properties(Map.ofEntries( + new PropertyEntry("integer", IntegerSchema.class), + new PropertyEntry("int32", Int32.class), + new PropertyEntry("int32withValidations", Int32withValidations.class), + new PropertyEntry("int64", Int64.class), + new PropertyEntry("number", NumberSchema.class), + new PropertyEntry("float", FloatSchema.class), + new PropertyEntry("float32", Float32.class), + new PropertyEntry("double", DoubleSchema.class), + new PropertyEntry("float64", Float64.class), + new PropertyEntry("arrayWithUniqueItems", ArrayWithUniqueItems.class), + new PropertyEntry("string", StringSchema.class), + new PropertyEntry("byte", ByteSchema.class), + new PropertyEntry("binary", Binary.class), + new PropertyEntry("date", Date.class), + new PropertyEntry("dateTime", DateTime.class), + new PropertyEntry("uuid", UuidSchema.class), + new PropertyEntry("uuidNoExample", UuidNoExample.class), + new PropertyEntry("password", Password.class), + new PropertyEntry("pattern_with_digits", PatternWithDigits.class), + new PropertyEntry("pattern_with_digits_and_delimiter", PatternWithDigitsAndDelimiter.class), + new PropertyEntry("noneProp", NoneProp.class) + )) + .required(Set.of( + "byte", + "date", + "number", + "password" + )) + ); + } + + public static FormatTest1 getInstance() { + if (instance == null) { + instance = new FormatTest1(); + } + return instance; + } + + 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 RuntimeException("Invalid non-string key value"); + } + String propertyName = (String) entryKey; + List propertyPathToItem = new ArrayList<>(pathToItem); + propertyPathToItem.add(propertyName); + Object value = entry.getValue(); + LinkedHashMap, Nothing?> schemas = pathToSchemas.get(propertyPathToItem); + if (schemas == null) { + throw new RuntimeException("Validation result is invalid, schemas must exist for a pathToItem"); + } + JsonSchema propertySchema = schemas.entrySet().iterator().next().getKey(); + @Nullable Object propertyInstance = propertySchema.getNewInstance(value, propertyPathToItem, pathToSchemas); + properties.put(propertyName, propertyInstance); + } + FrozenMap<@Nullable Object> castProperties = new FrozenMap<>(properties); + return new FormatTestMap(castProperties); + } + + 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); + SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().build())); + ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, new PathToSchemasMap(), new LinkedHashSet<>()); + PathToSchemasMap pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet); + return getNewInstance(castArg, validationMetadata.pathToItem(), pathToSchemasMap); + } + + + @Override + public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws 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"); + } + @Override + public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { + if (arg instanceof Map) { + return getNewInstance((Map) arg, pathToItem, pathToSchemas); + } + 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 { + return new FormatTest1BoxedMap(validate(arg, configuration)); + } + @Override + public FormatTest1Boxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { + 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"); + } + } + +} diff --git a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/schemas/FromSchema.kt b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/schemas/FromSchema.kt new file mode 100644 index 00000000000..31f15de6c34 --- /dev/null +++ b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/schemas/FromSchema.kt @@ -0,0 +1,263 @@ +package org.openapijsonschematools.client.components.schemas; +import java.util.ArrayList; +import java.util.HashSet; +import java.util.LinkedHashMap; +import java.util.LinkedHashSet; +import java.util.List; +import java.util.Map; +import java.util.Objects; +import java.util.Set; +import org.checkerframework.checker.nullness.qual.Nullable; +import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags; +import org.openapijsonschematools.client.configurations.SchemaConfiguration; +import org.openapijsonschematools.client.exceptions.InvalidAdditionalPropertyException; +import org.openapijsonschematools.client.exceptions.UnsetPropertyException; +import org.openapijsonschematools.client.exceptions.ValidationException; +import org.openapijsonschematools.client.schemas.GenericBuilder; +import org.openapijsonschematools.client.schemas.IntJsonSchema; +import org.openapijsonschematools.client.schemas.StringJsonSchema; +import org.openapijsonschematools.client.schemas.UnsetAddPropsSetter; +import org.openapijsonschematools.client.schemas.validation.FrozenMap; +import org.openapijsonschematools.client.schemas.validation.JsonSchema; +import org.openapijsonschematools.client.schemas.validation.JsonSchemaInfo; +import org.openapijsonschematools.client.schemas.validation.MapSchemaValidator; +import org.openapijsonschematools.client.schemas.validation.PathToSchemasMap; +import org.openapijsonschematools.client.schemas.validation.PropertyEntry; +import org.openapijsonschematools.client.schemas.validation.ValidationMetadata; + +public class FromSchema { + // nest classes so all schemas and input/output classes can be public + + + public static class Data extends StringJsonSchema.StringJsonSchema1 { + private static @Nullable Data instance = null; + public static Data getInstance() { + if (instance == null) { + instance = new Data(); + } + return instance; + } + } + + + public static class Id extends IntJsonSchema.IntJsonSchema1 { + private static @Nullable Id instance = null; + public static Id getInstance() { + if (instance == null) { + instance = new Id(); + } + return instance; + } + } + + + public static class FromSchemaMap extends FrozenMap<@Nullable Object> { + protected FromSchemaMap(FrozenMap<@Nullable Object> m) { + super(m); + } + public static final Set requiredKeys = Set.of(); + public static final Set optionalKeys = Set.of( + "data", + "id" + ); + public static FromSchemaMap of(Map arg, SchemaConfiguration configuration) throws ValidationException { + return FromSchema1.getInstance().validate(arg, configuration); + } + + public String data() throws UnsetPropertyException { + String key = "data"; + throwIfKeyNotPresent(key); + @Nullable Object value = get(key); + if (!(value instanceof String)) { + throw new RuntimeException("Invalid value stored for data"); + } + return (String) value; + } + + public Number id() throws UnsetPropertyException { + String key = "id"; + throwIfKeyNotPresent(key); + @Nullable Object value = get(key); + if (!(value instanceof Number)) { + throw new RuntimeException("Invalid value stored for id"); + } + return (Number) value; + } + + public @Nullable Object getAdditionalProperty(String name) throws UnsetPropertyException, InvalidAdditionalPropertyException { + throwIfKeyKnown(name, requiredKeys, optionalKeys); + throwIfKeyNotPresent(name); + return get(name); + } + } + + public interface SetterForData { + Map getInstance(); + T getBuilderAfterData(Map instance); + + default T data(String value) { + var instance = getInstance(); + instance.put("data", value); + return getBuilderAfterData(instance); + } + } + + public interface SetterForId { + Map getInstance(); + T getBuilderAfterId(Map instance); + + default T id(int value) { + var instance = getInstance(); + instance.put("id", value); + return getBuilderAfterId(instance); + } + + default T id(float value) { + var instance = getInstance(); + instance.put("id", value); + return getBuilderAfterId(instance); + } + + default T id(long value) { + var instance = getInstance(); + instance.put("id", value); + return getBuilderAfterId(instance); + } + + default T id(double value) { + var instance = getInstance(); + instance.put("id", value); + return getBuilderAfterId(instance); + } + } + + public static class FromSchemaMapBuilder extends UnsetAddPropsSetter implements GenericBuilder>, SetterForData, SetterForId { + private final Map instance; + private static final Set knownKeys = Set.of( + "data", + "id" + ); + public Set getKnownKeys() { + return knownKeys; + } + public FromSchemaMapBuilder() { + this.instance = new LinkedHashMap<>(); + } + public Map build() { + return instance; + } + public Map getInstance() { + return instance; + } + public FromSchemaMapBuilder getBuilderAfterData(Map instance) { + return this; + } + public FromSchemaMapBuilder getBuilderAfterId(Map instance) { + return this; + } + public FromSchemaMapBuilder getBuilderAfterAdditionalProperty(Map instance) { + return this; + } + } + + + public sealed interface FromSchema1Boxed permits FromSchema1BoxedMap { + @Nullable Object getData(); + } + + public record FromSchema1BoxedMap(FromSchemaMap data) implements FromSchema1Boxed { + @Override + public @Nullable Object getData() { + return data; + } + } + + + public static class FromSchema1 extends JsonSchema implements MapSchemaValidator { + /* + NOTE: This class is auto generated by OpenAPI JSON Schema Generator. + Ref: https://github.com/openapi-json-schema-tools/openapi-json-schema-generator + + Do not edit the class manually. + */ + private static @Nullable FromSchema1 instance = null; + + protected FromSchema1() { + super(new JsonSchemaInfo() + .type(Set.of(Map.class)) + .properties(Map.ofEntries( + new PropertyEntry("data", Data.class), + new PropertyEntry("id", Id.class) + )) + ); + } + + public static FromSchema1 getInstance() { + if (instance == null) { + instance = new FromSchema1(); + } + return instance; + } + + 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 RuntimeException("Invalid non-string key value"); + } + String propertyName = (String) entryKey; + List propertyPathToItem = new ArrayList<>(pathToItem); + propertyPathToItem.add(propertyName); + Object value = entry.getValue(); + LinkedHashMap, Nothing?> schemas = pathToSchemas.get(propertyPathToItem); + if (schemas == null) { + throw new RuntimeException("Validation result is invalid, schemas must exist for a pathToItem"); + } + JsonSchema propertySchema = schemas.entrySet().iterator().next().getKey(); + @Nullable Object propertyInstance = propertySchema.getNewInstance(value, propertyPathToItem, pathToSchemas); + properties.put(propertyName, propertyInstance); + } + FrozenMap<@Nullable Object> castProperties = new FrozenMap<>(properties); + return new FromSchemaMap(castProperties); + } + + 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); + SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().build())); + ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, new PathToSchemasMap(), new LinkedHashSet<>()); + PathToSchemasMap pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet); + return getNewInstance(castArg, validationMetadata.pathToItem(), pathToSchemasMap); + } + + + @Override + public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws 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"); + } + @Override + public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { + if (arg instanceof Map) { + return getNewInstance((Map) arg, pathToItem, pathToSchemas); + } + 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 { + return new FromSchema1BoxedMap(validate(arg, configuration)); + } + @Override + public FromSchema1Boxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { + 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"); + } + } + +} diff --git a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/schemas/Fruit.kt b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/schemas/Fruit.kt new file mode 100644 index 00000000000..0b9fff4a2b1 --- /dev/null +++ b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/schemas/Fruit.kt @@ -0,0 +1,413 @@ +package org.openapijsonschematools.client.components.schemas; +import java.time.LocalDate; +import java.time.ZonedDateTime; +import java.util.ArrayList; +import java.util.HashSet; +import java.util.LinkedHashMap; +import java.util.LinkedHashSet; +import java.util.List; +import java.util.Map; +import java.util.Objects; +import java.util.Set; +import java.util.UUID; +import org.checkerframework.checker.nullness.qual.Nullable; +import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags; +import org.openapijsonschematools.client.configurations.SchemaConfiguration; +import org.openapijsonschematools.client.exceptions.InvalidAdditionalPropertyException; +import org.openapijsonschematools.client.exceptions.UnsetPropertyException; +import org.openapijsonschematools.client.exceptions.ValidationException; +import org.openapijsonschematools.client.schemas.GenericBuilder; +import org.openapijsonschematools.client.schemas.StringJsonSchema; +import org.openapijsonschematools.client.schemas.UnsetAddPropsSetter; +import org.openapijsonschematools.client.schemas.validation.BooleanSchemaValidator; +import org.openapijsonschematools.client.schemas.validation.FrozenList; +import org.openapijsonschematools.client.schemas.validation.FrozenMap; +import org.openapijsonschematools.client.schemas.validation.JsonSchema; +import org.openapijsonschematools.client.schemas.validation.JsonSchemaInfo; +import org.openapijsonschematools.client.schemas.validation.ListSchemaValidator; +import org.openapijsonschematools.client.schemas.validation.MapSchemaValidator; +import org.openapijsonschematools.client.schemas.validation.NullSchemaValidator; +import org.openapijsonschematools.client.schemas.validation.NumberSchemaValidator; +import org.openapijsonschematools.client.schemas.validation.PathToSchemasMap; +import org.openapijsonschematools.client.schemas.validation.PropertyEntry; +import org.openapijsonschematools.client.schemas.validation.StringSchemaValidator; +import org.openapijsonschematools.client.schemas.validation.ValidationMetadata; + +public class Fruit { + // nest classes so all schemas and input/output classes can be public + + + public static class Color extends StringJsonSchema.StringJsonSchema1 { + private static @Nullable Color instance = null; + public static Color getInstance() { + if (instance == null) { + instance = new Color(); + } + return instance; + } + } + + + public static class FruitMap extends FrozenMap<@Nullable Object> { + protected FruitMap(FrozenMap<@Nullable Object> m) { + super(m); + } + public static final Set requiredKeys = Set.of(); + public static final Set optionalKeys = Set.of( + "color" + ); + public static FruitMap of(Map arg, SchemaConfiguration configuration) throws ValidationException { + return Fruit1.getInstance().validate(arg, configuration); + } + + public String color() throws UnsetPropertyException { + String key = "color"; + throwIfKeyNotPresent(key); + @Nullable Object value = get(key); + if (!(value instanceof String)) { + throw new RuntimeException("Invalid value stored for color"); + } + return (String) value; + } + + public @Nullable Object getAdditionalProperty(String name) throws UnsetPropertyException, InvalidAdditionalPropertyException { + throwIfKeyKnown(name, requiredKeys, optionalKeys); + throwIfKeyNotPresent(name); + return get(name); + } + } + + public interface SetterForColor { + Map getInstance(); + T getBuilderAfterColor(Map instance); + + default T color(String value) { + var instance = getInstance(); + instance.put("color", value); + return getBuilderAfterColor(instance); + } + } + + public static class FruitMapBuilder extends UnsetAddPropsSetter implements GenericBuilder>, SetterForColor { + private final Map instance; + private static final Set knownKeys = Set.of( + "color" + ); + public Set getKnownKeys() { + return knownKeys; + } + public FruitMapBuilder() { + this.instance = new LinkedHashMap<>(); + } + public Map build() { + return instance; + } + public Map getInstance() { + return instance; + } + public FruitMapBuilder getBuilderAfterColor(Map instance) { + return this; + } + public FruitMapBuilder getBuilderAfterAdditionalProperty(Map instance) { + return this; + } + } + + + public sealed interface Fruit1Boxed permits Fruit1BoxedVoid, Fruit1BoxedBoolean, Fruit1BoxedNumber, Fruit1BoxedString, Fruit1BoxedList, Fruit1BoxedMap { + @Nullable Object getData(); + } + + public record Fruit1BoxedVoid(Nothing? data) implements Fruit1Boxed { + @Override + public @Nullable Object getData() { + return data; + } + } + + public record Fruit1BoxedBoolean(boolean data) implements Fruit1Boxed { + @Override + public @Nullable Object getData() { + return data; + } + } + + public record Fruit1BoxedNumber(Number data) implements Fruit1Boxed { + @Override + public @Nullable Object getData() { + return data; + } + } + + public record Fruit1BoxedString(String data) implements Fruit1Boxed { + @Override + public @Nullable Object getData() { + return data; + } + } + + public record Fruit1BoxedList(FrozenList<@Nullable Object> data) implements Fruit1Boxed { + @Override + public @Nullable Object getData() { + return data; + } + } + + public record Fruit1BoxedMap(FruitMap data) implements Fruit1Boxed { + @Override + public @Nullable Object getData() { + return data; + } + } + + + public static class Fruit1 extends JsonSchema implements NullSchemaValidator, BooleanSchemaValidator, NumberSchemaValidator, StringSchemaValidator, ListSchemaValidator, Fruit1BoxedList>, MapSchemaValidator { + /* + NOTE: This class is auto generated by OpenAPI JSON Schema Generator. + Ref: https://github.com/openapi-json-schema-tools/openapi-json-schema-generator + + Do not edit the class manually. + */ + private static @Nullable Fruit1 instance = null; + + protected Fruit1() { + super(new JsonSchemaInfo() + .properties(Map.ofEntries( + new PropertyEntry("color", Color.class) + )) + .oneOf(List.of( + Apple.Apple1.class, + Banana.Banana1.class + )) + ); + } + + public static Fruit1 getInstance() { + if (instance == null) { + instance = new Fruit1(); + } + return instance; + } + + @Override + public Nothing? validate(Nothing? arg, SchemaConfiguration configuration) throws ValidationException { + Set> pathSet = new HashSet<>(); + List pathToItem = List.of("args[0]"); + Nothing? castArg = castToAllowedTypes(arg, pathToItem, pathSet); + SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().build())); + PathToSchemasMap validatedPathToSchemas = new PathToSchemasMap(); + ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, new LinkedHashSet<>()); + getPathToSchemas(this, castArg, validationMetadata, pathSet); + return castArg; + } + + @Override + public boolean validate(boolean arg, SchemaConfiguration configuration) throws ValidationException { + Set> pathSet = new HashSet<>(); + List pathToItem = List.of("args[0]"); + boolean castArg = castToAllowedTypes(arg, pathToItem, pathSet); + SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().build())); + PathToSchemasMap validatedPathToSchemas = new PathToSchemasMap(); + ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, new LinkedHashSet<>()); + getPathToSchemas(this, castArg, validationMetadata, pathSet); + return castArg; + } + + @Override + public Number validate(Number arg, SchemaConfiguration configuration) throws ValidationException { + Set> pathSet = new HashSet<>(); + List pathToItem = List.of("args[0]"); + Number castArg = castToAllowedTypes(arg, pathToItem, pathSet); + SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().build())); + PathToSchemasMap validatedPathToSchemas = new PathToSchemasMap(); + ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, new LinkedHashSet<>()); + getPathToSchemas(this, castArg, validationMetadata, pathSet); + return castArg; + } + + public int validate(int arg, SchemaConfiguration configuration) throws ValidationException { + return (int) validate((Number) arg, configuration); + } + + public long validate(long arg, SchemaConfiguration configuration) throws ValidationException { + return (long) validate((Number) arg, configuration); + } + + public float validate(float arg, SchemaConfiguration configuration) throws ValidationException { + return (float) validate((Number) arg, configuration); + } + + public double validate(double arg, SchemaConfiguration configuration) throws ValidationException { + return (double) validate((Number) arg, configuration); + } + + @Override + public String validate(String arg, SchemaConfiguration configuration) throws ValidationException { + Set> pathSet = new HashSet<>(); + List pathToItem = List.of("args[0]"); + String castArg = castToAllowedTypes(arg, pathToItem, pathSet); + SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().build())); + PathToSchemasMap validatedPathToSchemas = new PathToSchemasMap(); + ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, new LinkedHashSet<>()); + getPathToSchemas(this, castArg, validationMetadata, pathSet); + return castArg; + } + + public String validate(LocalDate arg, SchemaConfiguration configuration) throws ValidationException { + return validate(arg.toString(), configuration); + } + + public String validate(ZonedDateTime arg, SchemaConfiguration configuration) throws ValidationException { + return validate(arg.toString(), configuration); + } + + public String validate(UUID arg, SchemaConfiguration configuration) throws ValidationException { + return validate(arg.toString(), configuration); + } + + @Override + public FrozenList<@Nullable Object> getNewInstance(List arg, List pathToItem, PathToSchemasMap pathToSchemas) { + List<@Nullable Object> items = new ArrayList<>(); + int i = 0; + for (Object item: arg) { + List itemPathToItem = new ArrayList<>(pathToItem); + itemPathToItem.add(i); + LinkedHashMap, Nothing?> schemas = pathToSchemas.get(itemPathToItem); + if (schemas == null) { + throw new RuntimeException("Validation result is invalid, schemas must exist for a pathToItem"); + } + JsonSchema itemSchema = schemas.entrySet().iterator().next().getKey(); + @Nullable Object itemInstance = itemSchema.getNewInstance(item, itemPathToItem, pathToSchemas); + items.add(itemInstance); + i += 1; + } + FrozenList<@Nullable Object> newInstanceItems = new FrozenList<>(items); + return newInstanceItems; + } + + 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); + SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().build())); + ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, new PathToSchemasMap(), new LinkedHashSet<>()); + PathToSchemasMap pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet); + return getNewInstance(castArg, validationMetadata.pathToItem(), pathToSchemasMap); + } + + @Override + 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 RuntimeException("Invalid non-string key value"); + } + String propertyName = (String) entryKey; + List propertyPathToItem = new ArrayList<>(pathToItem); + propertyPathToItem.add(propertyName); + Object value = entry.getValue(); + LinkedHashMap, Nothing?> schemas = pathToSchemas.get(propertyPathToItem); + if (schemas == null) { + throw new RuntimeException("Validation result is invalid, schemas must exist for a pathToItem"); + } + JsonSchema propertySchema = schemas.entrySet().iterator().next().getKey(); + @Nullable Object propertyInstance = propertySchema.getNewInstance(value, propertyPathToItem, pathToSchemas); + properties.put(propertyName, propertyInstance); + } + FrozenMap<@Nullable Object> castProperties = new FrozenMap<>(properties); + return new FruitMap(castProperties); + } + + 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); + SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().build())); + PathToSchemasMap validatedPathToSchemas = new PathToSchemasMap(); + ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, new LinkedHashSet<>()); + PathToSchemasMap pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet); + return getNewInstance(castArg, validationMetadata.pathToItem(), pathToSchemasMap); + } + + @Override + public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { + if (arg == null) { + return validate((Nothing?) null, configuration); + } else if (arg instanceof Boolean) { + boolean boolArg = (Boolean) arg; + return validate(boolArg, configuration); + } else if (arg instanceof Number) { + return validate((Number) arg, configuration); + } else if (arg instanceof String) { + return validate((String) arg, configuration); + } else if (arg instanceof List) { + return validate((List) arg, 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"); + } + @Override + public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { + if (arg == null) { + return getNewInstance((Nothing?) null, pathToItem, pathToSchemas); + } else if (arg instanceof Boolean) { + boolean boolArg = (Boolean) arg; + return getNewInstance(boolArg, pathToItem, pathToSchemas); + } else if (arg instanceof Number) { + return getNewInstance((Number) arg, pathToItem, pathToSchemas); + } else if (arg instanceof String) { + return getNewInstance((String) arg, pathToItem, pathToSchemas); + } else if (arg instanceof List) { + return getNewInstance((List) arg, 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"); + } + @Override + public Fruit1BoxedVoid validateAndBox(Nothing? arg, SchemaConfiguration configuration) throws ValidationException { + return new Fruit1BoxedVoid(validate(arg, configuration)); + } + @Override + 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 { + return new Fruit1BoxedNumber(validate(arg, configuration)); + } + @Override + 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 { + return new Fruit1BoxedList(validate(arg, configuration)); + } + @Override + 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 { + if (arg == null) { + Nothing? castArg = (Nothing?) arg; + return validateAndBox(castArg, configuration); + } else if (arg instanceof Boolean booleanArg) { + boolean castArg = booleanArg; + return validateAndBox(castArg, configuration); + } else if (arg instanceof String castArg) { + return validateAndBox(castArg, configuration); + } else if (arg instanceof Number castArg) { + return validateAndBox(castArg, configuration); + } else if (arg instanceof List castArg) { + 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"); + } + } +} diff --git a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/schemas/FruitReq.kt b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/schemas/FruitReq.kt new file mode 100644 index 00000000000..7df923b3071 --- /dev/null +++ b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/schemas/FruitReq.kt @@ -0,0 +1,343 @@ +package org.openapijsonschematools.client.components.schemas; +import java.time.LocalDate; +import java.time.ZonedDateTime; +import java.util.ArrayList; +import java.util.HashSet; +import java.util.LinkedHashMap; +import java.util.LinkedHashSet; +import java.util.List; +import java.util.Map; +import java.util.Objects; +import java.util.Set; +import java.util.UUID; +import org.checkerframework.checker.nullness.qual.Nullable; +import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags; +import org.openapijsonschematools.client.configurations.SchemaConfiguration; +import org.openapijsonschematools.client.exceptions.InvalidAdditionalPropertyException; +import org.openapijsonschematools.client.exceptions.UnsetPropertyException; +import org.openapijsonschematools.client.exceptions.ValidationException; +import org.openapijsonschematools.client.schemas.NullJsonSchema; +import org.openapijsonschematools.client.schemas.UnsetAddPropsSetter; +import org.openapijsonschematools.client.schemas.validation.BooleanSchemaValidator; +import org.openapijsonschematools.client.schemas.validation.FrozenList; +import org.openapijsonschematools.client.schemas.validation.FrozenMap; +import org.openapijsonschematools.client.schemas.validation.JsonSchema; +import org.openapijsonschematools.client.schemas.validation.JsonSchemaInfo; +import org.openapijsonschematools.client.schemas.validation.ListSchemaValidator; +import org.openapijsonschematools.client.schemas.validation.MapSchemaValidator; +import org.openapijsonschematools.client.schemas.validation.NullSchemaValidator; +import org.openapijsonschematools.client.schemas.validation.NumberSchemaValidator; +import org.openapijsonschematools.client.schemas.validation.PathToSchemasMap; +import org.openapijsonschematools.client.schemas.validation.StringSchemaValidator; +import org.openapijsonschematools.client.schemas.validation.ValidationMetadata; + +public class FruitReq { + // nest classes so all schemas and input/output classes can be public + + + public static class Schema0 extends NullJsonSchema.NullJsonSchema1 { + private static @Nullable Schema0 instance = null; + public static Schema0 getInstance() { + if (instance == null) { + instance = new Schema0(); + } + return instance; + } + } + + + public sealed interface FruitReq1Boxed permits FruitReq1BoxedVoid, FruitReq1BoxedBoolean, FruitReq1BoxedNumber, FruitReq1BoxedString, FruitReq1BoxedList, FruitReq1BoxedMap { + @Nullable Object getData(); + } + + public record FruitReq1BoxedVoid(Nothing? data) implements FruitReq1Boxed { + @Override + public @Nullable Object getData() { + return data; + } + } + + public record FruitReq1BoxedBoolean(boolean data) implements FruitReq1Boxed { + @Override + public @Nullable Object getData() { + return data; + } + } + + public record FruitReq1BoxedNumber(Number data) implements FruitReq1Boxed { + @Override + public @Nullable Object getData() { + return data; + } + } + + public record FruitReq1BoxedString(String data) implements FruitReq1Boxed { + @Override + public @Nullable Object getData() { + return data; + } + } + + public record FruitReq1BoxedList(FrozenList<@Nullable Object> data) implements FruitReq1Boxed { + @Override + public @Nullable Object getData() { + return data; + } + } + + public record FruitReq1BoxedMap(FrozenMap<@Nullable Object> data) implements FruitReq1Boxed { + @Override + public @Nullable Object getData() { + return data; + } + } + + + public static class FruitReq1 extends JsonSchema implements NullSchemaValidator, BooleanSchemaValidator, NumberSchemaValidator, StringSchemaValidator, ListSchemaValidator, FruitReq1BoxedList>, MapSchemaValidator, FruitReq1BoxedMap> { + /* + NOTE: This class is auto generated by OpenAPI JSON Schema Generator. + Ref: https://github.com/openapi-json-schema-tools/openapi-json-schema-generator + + Do not edit the class manually. + */ + private static @Nullable FruitReq1 instance = null; + + protected FruitReq1() { + super(new JsonSchemaInfo() + .oneOf(List.of( + Schema0.class, + AppleReq.AppleReq1.class, + BananaReq.BananaReq1.class + )) + ); + } + + public static FruitReq1 getInstance() { + if (instance == null) { + instance = new FruitReq1(); + } + return instance; + } + + @Override + public Nothing? validate(Nothing? arg, SchemaConfiguration configuration) throws ValidationException { + Set> pathSet = new HashSet<>(); + List pathToItem = List.of("args[0]"); + Nothing? castArg = castToAllowedTypes(arg, pathToItem, pathSet); + SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().build())); + PathToSchemasMap validatedPathToSchemas = new PathToSchemasMap(); + ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, new LinkedHashSet<>()); + getPathToSchemas(this, castArg, validationMetadata, pathSet); + return castArg; + } + + @Override + public boolean validate(boolean arg, SchemaConfiguration configuration) throws ValidationException { + Set> pathSet = new HashSet<>(); + List pathToItem = List.of("args[0]"); + boolean castArg = castToAllowedTypes(arg, pathToItem, pathSet); + SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().build())); + PathToSchemasMap validatedPathToSchemas = new PathToSchemasMap(); + ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, new LinkedHashSet<>()); + getPathToSchemas(this, castArg, validationMetadata, pathSet); + return castArg; + } + + @Override + public Number validate(Number arg, SchemaConfiguration configuration) throws ValidationException { + Set> pathSet = new HashSet<>(); + List pathToItem = List.of("args[0]"); + Number castArg = castToAllowedTypes(arg, pathToItem, pathSet); + SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().build())); + PathToSchemasMap validatedPathToSchemas = new PathToSchemasMap(); + ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, new LinkedHashSet<>()); + getPathToSchemas(this, castArg, validationMetadata, pathSet); + return castArg; + } + + public int validate(int arg, SchemaConfiguration configuration) throws ValidationException { + return (int) validate((Number) arg, configuration); + } + + public long validate(long arg, SchemaConfiguration configuration) throws ValidationException { + return (long) validate((Number) arg, configuration); + } + + public float validate(float arg, SchemaConfiguration configuration) throws ValidationException { + return (float) validate((Number) arg, configuration); + } + + public double validate(double arg, SchemaConfiguration configuration) throws ValidationException { + return (double) validate((Number) arg, configuration); + } + + @Override + public String validate(String arg, SchemaConfiguration configuration) throws ValidationException { + Set> pathSet = new HashSet<>(); + List pathToItem = List.of("args[0]"); + String castArg = castToAllowedTypes(arg, pathToItem, pathSet); + SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().build())); + PathToSchemasMap validatedPathToSchemas = new PathToSchemasMap(); + ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, new LinkedHashSet<>()); + getPathToSchemas(this, castArg, validationMetadata, pathSet); + return castArg; + } + + public String validate(LocalDate arg, SchemaConfiguration configuration) throws ValidationException { + return validate(arg.toString(), configuration); + } + + public String validate(ZonedDateTime arg, SchemaConfiguration configuration) throws ValidationException { + return validate(arg.toString(), configuration); + } + + public String validate(UUID arg, SchemaConfiguration configuration) throws ValidationException { + return validate(arg.toString(), configuration); + } + + @Override + public FrozenList<@Nullable Object> getNewInstance(List arg, List pathToItem, PathToSchemasMap pathToSchemas) { + List<@Nullable Object> items = new ArrayList<>(); + int i = 0; + for (Object item: arg) { + List itemPathToItem = new ArrayList<>(pathToItem); + itemPathToItem.add(i); + LinkedHashMap, Nothing?> schemas = pathToSchemas.get(itemPathToItem); + if (schemas == null) { + throw new RuntimeException("Validation result is invalid, schemas must exist for a pathToItem"); + } + JsonSchema itemSchema = schemas.entrySet().iterator().next().getKey(); + @Nullable Object itemInstance = itemSchema.getNewInstance(item, itemPathToItem, pathToSchemas); + items.add(itemInstance); + i += 1; + } + FrozenList<@Nullable Object> newInstanceItems = new FrozenList<>(items); + return newInstanceItems; + } + + 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); + SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().build())); + ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, new PathToSchemasMap(), new LinkedHashSet<>()); + PathToSchemasMap pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet); + return getNewInstance(castArg, validationMetadata.pathToItem(), pathToSchemasMap); + } + + @Override + 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 RuntimeException("Invalid non-string key value"); + } + String propertyName = (String) entryKey; + List propertyPathToItem = new ArrayList<>(pathToItem); + propertyPathToItem.add(propertyName); + Object value = entry.getValue(); + LinkedHashMap, Nothing?> schemas = pathToSchemas.get(propertyPathToItem); + if (schemas == null) { + throw new RuntimeException("Validation result is invalid, schemas must exist for a pathToItem"); + } + JsonSchema propertySchema = schemas.entrySet().iterator().next().getKey(); + @Nullable Object propertyInstance = propertySchema.getNewInstance(value, propertyPathToItem, pathToSchemas); + properties.put(propertyName, propertyInstance); + } + FrozenMap<@Nullable Object> castProperties = new FrozenMap<>(properties); + return castProperties; + } + + public FrozenMap<@Nullable Object> validate(Map arg, SchemaConfiguration configuration) throws ValidationException { + Set> pathSet = new HashSet<>(); + List pathToItem = List.of("args[0]"); + Map castArg = castToAllowedTypes(arg, pathToItem, pathSet); + SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().build())); + PathToSchemasMap validatedPathToSchemas = new PathToSchemasMap(); + ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, new LinkedHashSet<>()); + PathToSchemasMap pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet); + return getNewInstance(castArg, validationMetadata.pathToItem(), pathToSchemasMap); + } + + @Override + public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { + if (arg == null) { + return validate((Nothing?) null, configuration); + } else if (arg instanceof Boolean) { + boolean boolArg = (Boolean) arg; + return validate(boolArg, configuration); + } else if (arg instanceof Number) { + return validate((Number) arg, configuration); + } else if (arg instanceof String) { + return validate((String) arg, configuration); + } else if (arg instanceof List) { + return validate((List) arg, 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"); + } + @Override + public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { + if (arg == null) { + return getNewInstance((Nothing?) null, pathToItem, pathToSchemas); + } else if (arg instanceof Boolean) { + boolean boolArg = (Boolean) arg; + return getNewInstance(boolArg, pathToItem, pathToSchemas); + } else if (arg instanceof Number) { + return getNewInstance((Number) arg, pathToItem, pathToSchemas); + } else if (arg instanceof String) { + return getNewInstance((String) arg, pathToItem, pathToSchemas); + } else if (arg instanceof List) { + return getNewInstance((List) arg, 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"); + } + @Override + public FruitReq1BoxedVoid validateAndBox(Nothing? arg, SchemaConfiguration configuration) throws ValidationException { + return new FruitReq1BoxedVoid(validate(arg, configuration)); + } + @Override + 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 { + return new FruitReq1BoxedNumber(validate(arg, configuration)); + } + @Override + 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 { + return new FruitReq1BoxedList(validate(arg, configuration)); + } + @Override + 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 { + if (arg == null) { + Nothing? castArg = (Nothing?) arg; + return validateAndBox(castArg, configuration); + } else if (arg instanceof Boolean booleanArg) { + boolean castArg = booleanArg; + return validateAndBox(castArg, configuration); + } else if (arg instanceof String castArg) { + return validateAndBox(castArg, configuration); + } else if (arg instanceof Number castArg) { + return validateAndBox(castArg, configuration); + } else if (arg instanceof List castArg) { + 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"); + } + } +} diff --git a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/schemas/GmFruit.kt b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/schemas/GmFruit.kt new file mode 100644 index 00000000000..03f8f7f5180 --- /dev/null +++ b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/schemas/GmFruit.kt @@ -0,0 +1,413 @@ +package org.openapijsonschematools.client.components.schemas; +import java.time.LocalDate; +import java.time.ZonedDateTime; +import java.util.ArrayList; +import java.util.HashSet; +import java.util.LinkedHashMap; +import java.util.LinkedHashSet; +import java.util.List; +import java.util.Map; +import java.util.Objects; +import java.util.Set; +import java.util.UUID; +import org.checkerframework.checker.nullness.qual.Nullable; +import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags; +import org.openapijsonschematools.client.configurations.SchemaConfiguration; +import org.openapijsonschematools.client.exceptions.InvalidAdditionalPropertyException; +import org.openapijsonschematools.client.exceptions.UnsetPropertyException; +import org.openapijsonschematools.client.exceptions.ValidationException; +import org.openapijsonschematools.client.schemas.GenericBuilder; +import org.openapijsonschematools.client.schemas.StringJsonSchema; +import org.openapijsonschematools.client.schemas.UnsetAddPropsSetter; +import org.openapijsonschematools.client.schemas.validation.BooleanSchemaValidator; +import org.openapijsonschematools.client.schemas.validation.FrozenList; +import org.openapijsonschematools.client.schemas.validation.FrozenMap; +import org.openapijsonschematools.client.schemas.validation.JsonSchema; +import org.openapijsonschematools.client.schemas.validation.JsonSchemaInfo; +import org.openapijsonschematools.client.schemas.validation.ListSchemaValidator; +import org.openapijsonschematools.client.schemas.validation.MapSchemaValidator; +import org.openapijsonschematools.client.schemas.validation.NullSchemaValidator; +import org.openapijsonschematools.client.schemas.validation.NumberSchemaValidator; +import org.openapijsonschematools.client.schemas.validation.PathToSchemasMap; +import org.openapijsonschematools.client.schemas.validation.PropertyEntry; +import org.openapijsonschematools.client.schemas.validation.StringSchemaValidator; +import org.openapijsonschematools.client.schemas.validation.ValidationMetadata; + +public class GmFruit { + // nest classes so all schemas and input/output classes can be public + + + public static class Color extends StringJsonSchema.StringJsonSchema1 { + private static @Nullable Color instance = null; + public static Color getInstance() { + if (instance == null) { + instance = new Color(); + } + return instance; + } + } + + + public static class GmFruitMap extends FrozenMap<@Nullable Object> { + protected GmFruitMap(FrozenMap<@Nullable Object> m) { + super(m); + } + public static final Set requiredKeys = Set.of(); + public static final Set optionalKeys = Set.of( + "color" + ); + public static GmFruitMap of(Map arg, SchemaConfiguration configuration) throws ValidationException { + return GmFruit1.getInstance().validate(arg, configuration); + } + + public String color() throws UnsetPropertyException { + String key = "color"; + throwIfKeyNotPresent(key); + @Nullable Object value = get(key); + if (!(value instanceof String)) { + throw new RuntimeException("Invalid value stored for color"); + } + return (String) value; + } + + public @Nullable Object getAdditionalProperty(String name) throws UnsetPropertyException, InvalidAdditionalPropertyException { + throwIfKeyKnown(name, requiredKeys, optionalKeys); + throwIfKeyNotPresent(name); + return get(name); + } + } + + public interface SetterForColor { + Map getInstance(); + T getBuilderAfterColor(Map instance); + + default T color(String value) { + var instance = getInstance(); + instance.put("color", value); + return getBuilderAfterColor(instance); + } + } + + public static class GmFruitMapBuilder extends UnsetAddPropsSetter implements GenericBuilder>, SetterForColor { + private final Map instance; + private static final Set knownKeys = Set.of( + "color" + ); + public Set getKnownKeys() { + return knownKeys; + } + public GmFruitMapBuilder() { + this.instance = new LinkedHashMap<>(); + } + public Map build() { + return instance; + } + public Map getInstance() { + return instance; + } + public GmFruitMapBuilder getBuilderAfterColor(Map instance) { + return this; + } + public GmFruitMapBuilder getBuilderAfterAdditionalProperty(Map instance) { + return this; + } + } + + + public sealed interface GmFruit1Boxed permits GmFruit1BoxedVoid, GmFruit1BoxedBoolean, GmFruit1BoxedNumber, GmFruit1BoxedString, GmFruit1BoxedList, GmFruit1BoxedMap { + @Nullable Object getData(); + } + + public record GmFruit1BoxedVoid(Nothing? data) implements GmFruit1Boxed { + @Override + public @Nullable Object getData() { + return data; + } + } + + public record GmFruit1BoxedBoolean(boolean data) implements GmFruit1Boxed { + @Override + public @Nullable Object getData() { + return data; + } + } + + public record GmFruit1BoxedNumber(Number data) implements GmFruit1Boxed { + @Override + public @Nullable Object getData() { + return data; + } + } + + public record GmFruit1BoxedString(String data) implements GmFruit1Boxed { + @Override + public @Nullable Object getData() { + return data; + } + } + + public record GmFruit1BoxedList(FrozenList<@Nullable Object> data) implements GmFruit1Boxed { + @Override + public @Nullable Object getData() { + return data; + } + } + + public record GmFruit1BoxedMap(GmFruitMap data) implements GmFruit1Boxed { + @Override + public @Nullable Object getData() { + return data; + } + } + + + public static class GmFruit1 extends JsonSchema implements NullSchemaValidator, BooleanSchemaValidator, NumberSchemaValidator, StringSchemaValidator, ListSchemaValidator, GmFruit1BoxedList>, MapSchemaValidator { + /* + NOTE: This class is auto generated by OpenAPI JSON Schema Generator. + Ref: https://github.com/openapi-json-schema-tools/openapi-json-schema-generator + + Do not edit the class manually. + */ + private static @Nullable GmFruit1 instance = null; + + protected GmFruit1() { + super(new JsonSchemaInfo() + .properties(Map.ofEntries( + new PropertyEntry("color", Color.class) + )) + .anyOf(List.of( + Apple.Apple1.class, + Banana.Banana1.class + )) + ); + } + + public static GmFruit1 getInstance() { + if (instance == null) { + instance = new GmFruit1(); + } + return instance; + } + + @Override + public Nothing? validate(Nothing? arg, SchemaConfiguration configuration) throws ValidationException { + Set> pathSet = new HashSet<>(); + List pathToItem = List.of("args[0]"); + Nothing? castArg = castToAllowedTypes(arg, pathToItem, pathSet); + SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().build())); + PathToSchemasMap validatedPathToSchemas = new PathToSchemasMap(); + ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, new LinkedHashSet<>()); + getPathToSchemas(this, castArg, validationMetadata, pathSet); + return castArg; + } + + @Override + public boolean validate(boolean arg, SchemaConfiguration configuration) throws ValidationException { + Set> pathSet = new HashSet<>(); + List pathToItem = List.of("args[0]"); + boolean castArg = castToAllowedTypes(arg, pathToItem, pathSet); + SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().build())); + PathToSchemasMap validatedPathToSchemas = new PathToSchemasMap(); + ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, new LinkedHashSet<>()); + getPathToSchemas(this, castArg, validationMetadata, pathSet); + return castArg; + } + + @Override + public Number validate(Number arg, SchemaConfiguration configuration) throws ValidationException { + Set> pathSet = new HashSet<>(); + List pathToItem = List.of("args[0]"); + Number castArg = castToAllowedTypes(arg, pathToItem, pathSet); + SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().build())); + PathToSchemasMap validatedPathToSchemas = new PathToSchemasMap(); + ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, new LinkedHashSet<>()); + getPathToSchemas(this, castArg, validationMetadata, pathSet); + return castArg; + } + + public int validate(int arg, SchemaConfiguration configuration) throws ValidationException { + return (int) validate((Number) arg, configuration); + } + + public long validate(long arg, SchemaConfiguration configuration) throws ValidationException { + return (long) validate((Number) arg, configuration); + } + + public float validate(float arg, SchemaConfiguration configuration) throws ValidationException { + return (float) validate((Number) arg, configuration); + } + + public double validate(double arg, SchemaConfiguration configuration) throws ValidationException { + return (double) validate((Number) arg, configuration); + } + + @Override + public String validate(String arg, SchemaConfiguration configuration) throws ValidationException { + Set> pathSet = new HashSet<>(); + List pathToItem = List.of("args[0]"); + String castArg = castToAllowedTypes(arg, pathToItem, pathSet); + SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().build())); + PathToSchemasMap validatedPathToSchemas = new PathToSchemasMap(); + ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, new LinkedHashSet<>()); + getPathToSchemas(this, castArg, validationMetadata, pathSet); + return castArg; + } + + public String validate(LocalDate arg, SchemaConfiguration configuration) throws ValidationException { + return validate(arg.toString(), configuration); + } + + public String validate(ZonedDateTime arg, SchemaConfiguration configuration) throws ValidationException { + return validate(arg.toString(), configuration); + } + + public String validate(UUID arg, SchemaConfiguration configuration) throws ValidationException { + return validate(arg.toString(), configuration); + } + + @Override + public FrozenList<@Nullable Object> getNewInstance(List arg, List pathToItem, PathToSchemasMap pathToSchemas) { + List<@Nullable Object> items = new ArrayList<>(); + int i = 0; + for (Object item: arg) { + List itemPathToItem = new ArrayList<>(pathToItem); + itemPathToItem.add(i); + LinkedHashMap, Nothing?> schemas = pathToSchemas.get(itemPathToItem); + if (schemas == null) { + throw new RuntimeException("Validation result is invalid, schemas must exist for a pathToItem"); + } + JsonSchema itemSchema = schemas.entrySet().iterator().next().getKey(); + @Nullable Object itemInstance = itemSchema.getNewInstance(item, itemPathToItem, pathToSchemas); + items.add(itemInstance); + i += 1; + } + FrozenList<@Nullable Object> newInstanceItems = new FrozenList<>(items); + return newInstanceItems; + } + + 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); + SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().build())); + ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, new PathToSchemasMap(), new LinkedHashSet<>()); + PathToSchemasMap pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet); + return getNewInstance(castArg, validationMetadata.pathToItem(), pathToSchemasMap); + } + + @Override + 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 RuntimeException("Invalid non-string key value"); + } + String propertyName = (String) entryKey; + List propertyPathToItem = new ArrayList<>(pathToItem); + propertyPathToItem.add(propertyName); + Object value = entry.getValue(); + LinkedHashMap, Nothing?> schemas = pathToSchemas.get(propertyPathToItem); + if (schemas == null) { + throw new RuntimeException("Validation result is invalid, schemas must exist for a pathToItem"); + } + JsonSchema propertySchema = schemas.entrySet().iterator().next().getKey(); + @Nullable Object propertyInstance = propertySchema.getNewInstance(value, propertyPathToItem, pathToSchemas); + properties.put(propertyName, propertyInstance); + } + FrozenMap<@Nullable Object> castProperties = new FrozenMap<>(properties); + return new GmFruitMap(castProperties); + } + + 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); + SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().build())); + PathToSchemasMap validatedPathToSchemas = new PathToSchemasMap(); + ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, new LinkedHashSet<>()); + PathToSchemasMap pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet); + return getNewInstance(castArg, validationMetadata.pathToItem(), pathToSchemasMap); + } + + @Override + public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { + if (arg == null) { + return validate((Nothing?) null, configuration); + } else if (arg instanceof Boolean) { + boolean boolArg = (Boolean) arg; + return validate(boolArg, configuration); + } else if (arg instanceof Number) { + return validate((Number) arg, configuration); + } else if (arg instanceof String) { + return validate((String) arg, configuration); + } else if (arg instanceof List) { + return validate((List) arg, 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"); + } + @Override + public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { + if (arg == null) { + return getNewInstance((Nothing?) null, pathToItem, pathToSchemas); + } else if (arg instanceof Boolean) { + boolean boolArg = (Boolean) arg; + return getNewInstance(boolArg, pathToItem, pathToSchemas); + } else if (arg instanceof Number) { + return getNewInstance((Number) arg, pathToItem, pathToSchemas); + } else if (arg instanceof String) { + return getNewInstance((String) arg, pathToItem, pathToSchemas); + } else if (arg instanceof List) { + return getNewInstance((List) arg, 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"); + } + @Override + public GmFruit1BoxedVoid validateAndBox(Nothing? arg, SchemaConfiguration configuration) throws ValidationException { + return new GmFruit1BoxedVoid(validate(arg, configuration)); + } + @Override + 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 { + return new GmFruit1BoxedNumber(validate(arg, configuration)); + } + @Override + 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 { + return new GmFruit1BoxedList(validate(arg, configuration)); + } + @Override + 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 { + if (arg == null) { + Nothing? castArg = (Nothing?) arg; + return validateAndBox(castArg, configuration); + } else if (arg instanceof Boolean booleanArg) { + boolean castArg = booleanArg; + return validateAndBox(castArg, configuration); + } else if (arg instanceof String castArg) { + return validateAndBox(castArg, configuration); + } else if (arg instanceof Number castArg) { + return validateAndBox(castArg, configuration); + } else if (arg instanceof List castArg) { + 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"); + } + } +} diff --git a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/schemas/GrandparentAnimal.kt b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/schemas/GrandparentAnimal.kt new file mode 100644 index 00000000000..030b6a18914 --- /dev/null +++ b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/schemas/GrandparentAnimal.kt @@ -0,0 +1,217 @@ +package org.openapijsonschematools.client.components.schemas; +import java.util.ArrayList; +import java.util.HashSet; +import java.util.LinkedHashMap; +import java.util.LinkedHashSet; +import java.util.List; +import java.util.Map; +import java.util.Objects; +import java.util.Set; +import org.checkerframework.checker.nullness.qual.Nullable; +import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags; +import org.openapijsonschematools.client.configurations.SchemaConfiguration; +import org.openapijsonschematools.client.exceptions.InvalidAdditionalPropertyException; +import org.openapijsonschematools.client.exceptions.UnsetPropertyException; +import org.openapijsonschematools.client.exceptions.ValidationException; +import org.openapijsonschematools.client.schemas.GenericBuilder; +import org.openapijsonschematools.client.schemas.StringJsonSchema; +import org.openapijsonschematools.client.schemas.UnsetAddPropsSetter; +import org.openapijsonschematools.client.schemas.validation.FrozenMap; +import org.openapijsonschematools.client.schemas.validation.JsonSchema; +import org.openapijsonschematools.client.schemas.validation.JsonSchemaInfo; +import org.openapijsonschematools.client.schemas.validation.MapSchemaValidator; +import org.openapijsonschematools.client.schemas.validation.PathToSchemasMap; +import org.openapijsonschematools.client.schemas.validation.PropertyEntry; +import org.openapijsonschematools.client.schemas.validation.ValidationMetadata; + +public class GrandparentAnimal { + // nest classes so all schemas and input/output classes can be public + + + public static class PetType extends StringJsonSchema.StringJsonSchema1 { + private static @Nullable PetType instance = null; + public static PetType getInstance() { + if (instance == null) { + instance = new PetType(); + } + return instance; + } + } + + + public static class GrandparentAnimalMap extends FrozenMap<@Nullable Object> { + protected GrandparentAnimalMap(FrozenMap<@Nullable Object> m) { + super(m); + } + public static final Set requiredKeys = Set.of( + "pet_type" + ); + public static final Set optionalKeys = Set.of(); + public static GrandparentAnimalMap of(Map arg, SchemaConfiguration configuration) throws ValidationException { + return GrandparentAnimal1.getInstance().validate(arg, configuration); + } + + public String pet_type() { + @Nullable Object value = get("pet_type"); + if (!(value instanceof String)) { + throw new RuntimeException("Invalid value stored for pet_type"); + } + return (String) value; + } + + public @Nullable Object getAdditionalProperty(String name) throws UnsetPropertyException, InvalidAdditionalPropertyException { + throwIfKeyKnown(name, requiredKeys, optionalKeys); + throwIfKeyNotPresent(name); + return get(name); + } + } + + public interface SetterForPetType { + Map getInstance(); + T getBuilderAfterPetType(Map instance); + + default T pet_type(String value) { + var instance = getInstance(); + instance.put("pet_type", value); + return getBuilderAfterPetType(instance); + } + } + + public static class GrandparentAnimalMap0Builder extends UnsetAddPropsSetter implements GenericBuilder> { + private final Map instance; + private static final Set knownKeys = Set.of( + "pet_type" + ); + public Set getKnownKeys() { + return knownKeys; + } + public GrandparentAnimalMap0Builder(Map instance) { + this.instance = instance; + } + public Map build() { + return instance; + } + public Map getInstance() { + return instance; + } + public GrandparentAnimalMap0Builder getBuilderAfterAdditionalProperty(Map instance) { + return this; + } + } + + public static class GrandparentAnimalMapBuilder implements SetterForPetType { + private final Map instance; + public GrandparentAnimalMapBuilder() { + this.instance = new LinkedHashMap<>(); + } + public Map getInstance() { + return instance; + } + public GrandparentAnimalMap0Builder getBuilderAfterPetType(Map instance) { + return new GrandparentAnimalMap0Builder(instance); + } + } + + + public sealed interface GrandparentAnimal1Boxed permits GrandparentAnimal1BoxedMap { + @Nullable Object getData(); + } + + public record GrandparentAnimal1BoxedMap(GrandparentAnimalMap data) implements GrandparentAnimal1Boxed { + @Override + public @Nullable Object getData() { + return data; + } + } + + + public static class GrandparentAnimal1 extends JsonSchema implements MapSchemaValidator { + /* + NOTE: This class is auto generated by OpenAPI JSON Schema Generator. + Ref: https://github.com/openapi-json-schema-tools/openapi-json-schema-generator + + Do not edit the class manually. + */ + private static @Nullable GrandparentAnimal1 instance = null; + + protected GrandparentAnimal1() { + super(new JsonSchemaInfo() + .type(Set.of(Map.class)) + .properties(Map.ofEntries( + new PropertyEntry("pet_type", PetType.class) + )) + .required(Set.of( + "pet_type" + )) + ); + } + + public static GrandparentAnimal1 getInstance() { + if (instance == null) { + instance = new GrandparentAnimal1(); + } + return instance; + } + + 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 RuntimeException("Invalid non-string key value"); + } + String propertyName = (String) entryKey; + List propertyPathToItem = new ArrayList<>(pathToItem); + propertyPathToItem.add(propertyName); + Object value = entry.getValue(); + LinkedHashMap, Nothing?> schemas = pathToSchemas.get(propertyPathToItem); + if (schemas == null) { + throw new RuntimeException("Validation result is invalid, schemas must exist for a pathToItem"); + } + JsonSchema propertySchema = schemas.entrySet().iterator().next().getKey(); + @Nullable Object propertyInstance = propertySchema.getNewInstance(value, propertyPathToItem, pathToSchemas); + properties.put(propertyName, propertyInstance); + } + FrozenMap<@Nullable Object> castProperties = new FrozenMap<>(properties); + return new GrandparentAnimalMap(castProperties); + } + + 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); + SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().build())); + ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, new PathToSchemasMap(), new LinkedHashSet<>()); + PathToSchemasMap pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet); + return getNewInstance(castArg, validationMetadata.pathToItem(), pathToSchemasMap); + } + + + @Override + public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws 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"); + } + @Override + public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { + if (arg instanceof Map) { + return getNewInstance((Map) arg, pathToItem, pathToSchemas); + } + 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 { + return new GrandparentAnimal1BoxedMap(validate(arg, configuration)); + } + @Override + public GrandparentAnimal1Boxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { + 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"); + } + } + +} diff --git a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/schemas/HasOnlyReadOnly.kt b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/schemas/HasOnlyReadOnly.kt new file mode 100644 index 00000000000..6c556c75e4e --- /dev/null +++ b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/schemas/HasOnlyReadOnly.kt @@ -0,0 +1,244 @@ +package org.openapijsonschematools.client.components.schemas; +import java.util.ArrayList; +import java.util.HashSet; +import java.util.LinkedHashMap; +import java.util.LinkedHashSet; +import java.util.List; +import java.util.Map; +import java.util.Objects; +import java.util.Set; +import org.checkerframework.checker.nullness.qual.Nullable; +import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags; +import org.openapijsonschematools.client.configurations.SchemaConfiguration; +import org.openapijsonschematools.client.exceptions.InvalidAdditionalPropertyException; +import org.openapijsonschematools.client.exceptions.UnsetPropertyException; +import org.openapijsonschematools.client.exceptions.ValidationException; +import org.openapijsonschematools.client.schemas.GenericBuilder; +import org.openapijsonschematools.client.schemas.StringJsonSchema; +import org.openapijsonschematools.client.schemas.UnsetAddPropsSetter; +import org.openapijsonschematools.client.schemas.validation.FrozenMap; +import org.openapijsonschematools.client.schemas.validation.JsonSchema; +import org.openapijsonschematools.client.schemas.validation.JsonSchemaInfo; +import org.openapijsonschematools.client.schemas.validation.MapSchemaValidator; +import org.openapijsonschematools.client.schemas.validation.PathToSchemasMap; +import org.openapijsonschematools.client.schemas.validation.PropertyEntry; +import org.openapijsonschematools.client.schemas.validation.ValidationMetadata; + +public class HasOnlyReadOnly { + // nest classes so all schemas and input/output classes can be public + + + public static class Bar extends StringJsonSchema.StringJsonSchema1 { + private static @Nullable Bar instance = null; + public static Bar getInstance() { + if (instance == null) { + instance = new Bar(); + } + return instance; + } + } + + + public static class Foo extends StringJsonSchema.StringJsonSchema1 { + private static @Nullable Foo instance = null; + public static Foo getInstance() { + if (instance == null) { + instance = new Foo(); + } + return instance; + } + } + + + public static class HasOnlyReadOnlyMap extends FrozenMap<@Nullable Object> { + protected HasOnlyReadOnlyMap(FrozenMap<@Nullable Object> m) { + super(m); + } + public static final Set requiredKeys = Set.of(); + public static final Set optionalKeys = Set.of( + "bar", + "foo" + ); + public static HasOnlyReadOnlyMap of(Map arg, SchemaConfiguration configuration) throws ValidationException { + return HasOnlyReadOnly1.getInstance().validate(arg, configuration); + } + + public String bar() throws UnsetPropertyException { + String key = "bar"; + throwIfKeyNotPresent(key); + @Nullable Object value = get(key); + if (!(value instanceof String)) { + throw new RuntimeException("Invalid value stored for bar"); + } + return (String) value; + } + + public String foo() throws UnsetPropertyException { + String key = "foo"; + throwIfKeyNotPresent(key); + @Nullable Object value = get(key); + if (!(value instanceof String)) { + throw new RuntimeException("Invalid value stored for foo"); + } + return (String) value; + } + + public @Nullable Object getAdditionalProperty(String name) throws UnsetPropertyException, InvalidAdditionalPropertyException { + throwIfKeyKnown(name, requiredKeys, optionalKeys); + throwIfKeyNotPresent(name); + return get(name); + } + } + + public interface SetterForBar { + Map getInstance(); + T getBuilderAfterBar(Map instance); + + default T bar(String value) { + var instance = getInstance(); + instance.put("bar", value); + return getBuilderAfterBar(instance); + } + } + + public interface SetterForFoo { + Map getInstance(); + T getBuilderAfterFoo(Map instance); + + default T foo(String value) { + var instance = getInstance(); + instance.put("foo", value); + return getBuilderAfterFoo(instance); + } + } + + public static class HasOnlyReadOnlyMapBuilder extends UnsetAddPropsSetter implements GenericBuilder>, SetterForBar, SetterForFoo { + private final Map instance; + private static final Set knownKeys = Set.of( + "bar", + "foo" + ); + public Set getKnownKeys() { + return knownKeys; + } + public HasOnlyReadOnlyMapBuilder() { + this.instance = new LinkedHashMap<>(); + } + public Map build() { + return instance; + } + public Map getInstance() { + return instance; + } + public HasOnlyReadOnlyMapBuilder getBuilderAfterBar(Map instance) { + return this; + } + public HasOnlyReadOnlyMapBuilder getBuilderAfterFoo(Map instance) { + return this; + } + public HasOnlyReadOnlyMapBuilder getBuilderAfterAdditionalProperty(Map instance) { + return this; + } + } + + + public sealed interface HasOnlyReadOnly1Boxed permits HasOnlyReadOnly1BoxedMap { + @Nullable Object getData(); + } + + public record HasOnlyReadOnly1BoxedMap(HasOnlyReadOnlyMap data) implements HasOnlyReadOnly1Boxed { + @Override + public @Nullable Object getData() { + return data; + } + } + + + public static class HasOnlyReadOnly1 extends JsonSchema implements MapSchemaValidator { + /* + NOTE: This class is auto generated by OpenAPI JSON Schema Generator. + Ref: https://github.com/openapi-json-schema-tools/openapi-json-schema-generator + + Do not edit the class manually. + */ + private static @Nullable HasOnlyReadOnly1 instance = null; + + protected HasOnlyReadOnly1() { + super(new JsonSchemaInfo() + .type(Set.of(Map.class)) + .properties(Map.ofEntries( + new PropertyEntry("bar", Bar.class), + new PropertyEntry("foo", Foo.class) + )) + ); + } + + public static HasOnlyReadOnly1 getInstance() { + if (instance == null) { + instance = new HasOnlyReadOnly1(); + } + return instance; + } + + 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 RuntimeException("Invalid non-string key value"); + } + String propertyName = (String) entryKey; + List propertyPathToItem = new ArrayList<>(pathToItem); + propertyPathToItem.add(propertyName); + Object value = entry.getValue(); + LinkedHashMap, Nothing?> schemas = pathToSchemas.get(propertyPathToItem); + if (schemas == null) { + throw new RuntimeException("Validation result is invalid, schemas must exist for a pathToItem"); + } + JsonSchema propertySchema = schemas.entrySet().iterator().next().getKey(); + @Nullable Object propertyInstance = propertySchema.getNewInstance(value, propertyPathToItem, pathToSchemas); + properties.put(propertyName, propertyInstance); + } + FrozenMap<@Nullable Object> castProperties = new FrozenMap<>(properties); + return new HasOnlyReadOnlyMap(castProperties); + } + + 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); + SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().build())); + ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, new PathToSchemasMap(), new LinkedHashSet<>()); + PathToSchemasMap pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet); + return getNewInstance(castArg, validationMetadata.pathToItem(), pathToSchemasMap); + } + + + @Override + public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws 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"); + } + @Override + public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { + if (arg instanceof Map) { + return getNewInstance((Map) arg, pathToItem, pathToSchemas); + } + 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 { + return new HasOnlyReadOnly1BoxedMap(validate(arg, configuration)); + } + @Override + public HasOnlyReadOnly1Boxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { + 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"); + } + } + +} diff --git a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/schemas/HealthCheckResult.kt b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/schemas/HealthCheckResult.kt new file mode 100644 index 00000000000..bdcfe505d2e --- /dev/null +++ b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/schemas/HealthCheckResult.kt @@ -0,0 +1,303 @@ +package org.openapijsonschematools.client.components.schemas; +import java.util.ArrayList; +import java.util.HashSet; +import java.util.LinkedHashMap; +import java.util.LinkedHashSet; +import java.util.List; +import java.util.Map; +import java.util.Objects; +import java.util.Set; +import org.checkerframework.checker.nullness.qual.Nullable; +import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags; +import org.openapijsonschematools.client.configurations.SchemaConfiguration; +import org.openapijsonschematools.client.exceptions.InvalidAdditionalPropertyException; +import org.openapijsonschematools.client.exceptions.UnsetPropertyException; +import org.openapijsonschematools.client.exceptions.ValidationException; +import org.openapijsonschematools.client.schemas.GenericBuilder; +import org.openapijsonschematools.client.schemas.UnsetAddPropsSetter; +import org.openapijsonschematools.client.schemas.validation.FrozenMap; +import org.openapijsonschematools.client.schemas.validation.JsonSchema; +import org.openapijsonschematools.client.schemas.validation.JsonSchemaInfo; +import org.openapijsonschematools.client.schemas.validation.MapSchemaValidator; +import org.openapijsonschematools.client.schemas.validation.NullSchemaValidator; +import org.openapijsonschematools.client.schemas.validation.PathToSchemasMap; +import org.openapijsonschematools.client.schemas.validation.PropertyEntry; +import org.openapijsonschematools.client.schemas.validation.StringSchemaValidator; +import org.openapijsonschematools.client.schemas.validation.ValidationMetadata; + +public class HealthCheckResult { + // nest classes so all schemas and input/output classes can be public + + + public sealed interface NullableMessageBoxed permits NullableMessageBoxedNothing?, NullableMessageBoxedString { + @Nullable Object getData(); + } + + public record NullableMessageBoxedVoid(Nothing? data) implements NullableMessageBoxed { + @Override + public @Nullable Object getData() { + return data; + } + } + + public record NullableMessageBoxedString(String data) implements NullableMessageBoxed { + @Override + public @Nullable Object getData() { + return data; + } + } + + + + public static class NullableMessage extends JsonSchema implements NullSchemaValidator, StringSchemaValidator { + private static @Nullable NullableMessage instance = null; + + protected NullableMessage() { + super(new JsonSchemaInfo() + .type(Set.of( + Nothing?.class, + String.class + )) + ); + } + + public static NullableMessage getInstance() { + if (instance == null) { + instance = new NullableMessage(); + } + return instance; + } + + @Override + public Nothing? validate(Nothing? arg, SchemaConfiguration configuration) throws ValidationException { + Set> pathSet = new HashSet<>(); + List pathToItem = List.of("args[0"); + Nothing? castArg = castToAllowedTypes(arg, pathToItem, pathSet); + SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().build())); + ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, new PathToSchemasMap(), new LinkedHashSet<>()); + getPathToSchemas(this, castArg, validationMetadata, pathSet); + return castArg; + } + + @Override + public String validate(String arg, SchemaConfiguration configuration) throws ValidationException { + Set> pathSet = new HashSet<>(); + List pathToItem = List.of("args[0"); + String castArg = castToAllowedTypes(arg, pathToItem, pathSet); + SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().build())); + ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, new PathToSchemasMap(), new LinkedHashSet<>()); + getPathToSchemas(this, castArg, validationMetadata, pathSet); + return castArg; + } + + @Override + public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { + if (arg == null) { + return validate((Nothing?) 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"); + } + @Override + public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { + if (arg == null) { + return getNewInstance((Nothing?) 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"); + } + @Override + public NullableMessageBoxedVoid validateAndBox(Nothing? arg, SchemaConfiguration configuration) throws ValidationException { + return new NullableMessageBoxedVoid(validate(arg, configuration)); + } + @Override + 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 { + if (arg == null) { + Nothing? castArg = (Nothing?) 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"); + } + } + + public static class HealthCheckResultMap extends FrozenMap<@Nullable Object> { + protected HealthCheckResultMap(FrozenMap<@Nullable Object> m) { + super(m); + } + public static final Set requiredKeys = Set.of(); + public static final Set optionalKeys = Set.of( + "NullableMessage" + ); + public static HealthCheckResultMap of(Map arg, SchemaConfiguration configuration) throws ValidationException { + return HealthCheckResult1.getInstance().validate(arg, configuration); + } + + public @Nullable String NullableMessage() throws UnsetPropertyException { + String key = "NullableMessage"; + throwIfKeyNotPresent(key); + @Nullable Object value = get(key); + if (!(value == null || value instanceof String)) { + throw new RuntimeException("Invalid value stored for NullableMessage"); + } + return (@Nullable String) value; + } + + public @Nullable Object getAdditionalProperty(String name) throws UnsetPropertyException, InvalidAdditionalPropertyException { + throwIfKeyKnown(name, requiredKeys, optionalKeys); + throwIfKeyNotPresent(name); + return get(name); + } + } + + public interface SetterForNullableMessage { + Map getInstance(); + T getBuilderAfterNullableMessage(Map instance); + + default T NullableMessage(Nothing? value) { + var instance = getInstance(); + instance.put("NullableMessage", null); + return getBuilderAfterNullableMessage(instance); + } + + default T NullableMessage(String value) { + var instance = getInstance(); + instance.put("NullableMessage", value); + return getBuilderAfterNullableMessage(instance); + } + } + + public static class HealthCheckResultMapBuilder extends UnsetAddPropsSetter implements GenericBuilder>, SetterForNullableMessage { + private final Map instance; + private static final Set knownKeys = Set.of( + "NullableMessage" + ); + public Set getKnownKeys() { + return knownKeys; + } + public HealthCheckResultMapBuilder() { + this.instance = new LinkedHashMap<>(); + } + public Map build() { + return instance; + } + public Map getInstance() { + return instance; + } + public HealthCheckResultMapBuilder getBuilderAfterNullableMessage(Map instance) { + return this; + } + public HealthCheckResultMapBuilder getBuilderAfterAdditionalProperty(Map instance) { + return this; + } + } + + + public sealed interface HealthCheckResult1Boxed permits HealthCheckResult1BoxedMap { + @Nullable Object getData(); + } + + public record HealthCheckResult1BoxedMap(HealthCheckResultMap data) implements HealthCheckResult1Boxed { + @Override + public @Nullable Object getData() { + return data; + } + } + + + public static class HealthCheckResult1 extends JsonSchema implements MapSchemaValidator { + /* + NOTE: This class is auto generated by OpenAPI JSON Schema Generator. + Ref: https://github.com/openapi-json-schema-tools/openapi-json-schema-generator + + Do not edit the class manually. + + Just a string to inform instance is up and running. Make it nullable in hope to get it as pointer in generated model. + */ + private static @Nullable HealthCheckResult1 instance = null; + + protected HealthCheckResult1() { + super(new JsonSchemaInfo() + .type(Set.of(Map.class)) + .properties(Map.ofEntries( + new PropertyEntry("NullableMessage", NullableMessage.class) + )) + ); + } + + public static HealthCheckResult1 getInstance() { + if (instance == null) { + instance = new HealthCheckResult1(); + } + return instance; + } + + 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 RuntimeException("Invalid non-string key value"); + } + String propertyName = (String) entryKey; + List propertyPathToItem = new ArrayList<>(pathToItem); + propertyPathToItem.add(propertyName); + Object value = entry.getValue(); + LinkedHashMap, Nothing?> schemas = pathToSchemas.get(propertyPathToItem); + if (schemas == null) { + throw new RuntimeException("Validation result is invalid, schemas must exist for a pathToItem"); + } + JsonSchema propertySchema = schemas.entrySet().iterator().next().getKey(); + @Nullable Object propertyInstance = propertySchema.getNewInstance(value, propertyPathToItem, pathToSchemas); + properties.put(propertyName, propertyInstance); + } + FrozenMap<@Nullable Object> castProperties = new FrozenMap<>(properties); + return new HealthCheckResultMap(castProperties); + } + + 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); + SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().build())); + ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, new PathToSchemasMap(), new LinkedHashSet<>()); + PathToSchemasMap pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet); + return getNewInstance(castArg, validationMetadata.pathToItem(), pathToSchemasMap); + } + + + @Override + public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws 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"); + } + @Override + public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { + if (arg instanceof Map) { + return getNewInstance((Map) arg, pathToItem, pathToSchemas); + } + 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 { + return new HealthCheckResult1BoxedMap(validate(arg, configuration)); + } + @Override + public HealthCheckResult1Boxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { + 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"); + } + } + +} diff --git a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/schemas/IntegerEnum.kt b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/schemas/IntegerEnum.kt new file mode 100644 index 00000000000..bb3b5f6f94f --- /dev/null +++ b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/schemas/IntegerEnum.kt @@ -0,0 +1,206 @@ +package org.openapijsonschematools.client.components.schemas; +import java.math.BigDecimal; +import java.util.HashSet; +import java.util.LinkedHashSet; +import java.util.List; +import java.util.Objects; +import java.util.Set; +import org.checkerframework.checker.nullness.qual.Nullable; +import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags; +import org.openapijsonschematools.client.configurations.SchemaConfiguration; +import org.openapijsonschematools.client.exceptions.ValidationException; +import org.openapijsonschematools.client.schemas.SetMaker; +import org.openapijsonschematools.client.schemas.validation.DoubleEnumValidator; +import org.openapijsonschematools.client.schemas.validation.DoubleValueMethod; +import org.openapijsonschematools.client.schemas.validation.FloatEnumValidator; +import org.openapijsonschematools.client.schemas.validation.FloatValueMethod; +import org.openapijsonschematools.client.schemas.validation.IntegerEnumValidator; +import org.openapijsonschematools.client.schemas.validation.IntegerValueMethod; +import org.openapijsonschematools.client.schemas.validation.JsonSchema; +import org.openapijsonschematools.client.schemas.validation.JsonSchemaInfo; +import org.openapijsonschematools.client.schemas.validation.LongEnumValidator; +import org.openapijsonschematools.client.schemas.validation.LongValueMethod; +import org.openapijsonschematools.client.schemas.validation.NumberSchemaValidator; +import org.openapijsonschematools.client.schemas.validation.PathToSchemasMap; +import org.openapijsonschematools.client.schemas.validation.ValidationMetadata; + +public class IntegerEnum { + // nest classes so all schemas and input/output classes can be public + + public enum IntegerIntegerEnumEnums implements IntegerValueMethod { + POSITIVE_0(0), + POSITIVE_1(1), + POSITIVE_2(2); + private final int value; + + IntegerIntegerEnumEnums(int value) { + this.value = value; + } + public int value() { + return this.value; + } + } + + public enum LongIntegerEnumEnums implements LongValueMethod { + POSITIVE_0(0L), + POSITIVE_1(1L), + POSITIVE_2(2L); + private final long value; + + LongIntegerEnumEnums(long value) { + this.value = value; + } + public long value() { + return this.value; + } + } + + public enum FloatIntegerEnumEnums implements FloatValueMethod { + POSITIVE_0(0.0f), + POSITIVE_1(1.0f), + POSITIVE_2(2.0f); + private final float value; + + FloatIntegerEnumEnums(float value) { + this.value = value; + } + public float value() { + return this.value; + } + } + + public enum DoubleIntegerEnumEnums implements DoubleValueMethod { + POSITIVE_0(0.0d), + POSITIVE_1(1.0d), + POSITIVE_2(2.0d); + private final double value; + + DoubleIntegerEnumEnums(double value) { + this.value = value; + } + public double value() { + return this.value; + } + } + + + public sealed interface IntegerEnum1Boxed permits IntegerEnum1BoxedNumber { + @Nullable Object getData(); + } + + public record IntegerEnum1BoxedNumber(Number data) implements IntegerEnum1Boxed { + @Override + public @Nullable Object getData() { + return data; + } + } + + + + public static class IntegerEnum1 extends JsonSchema implements IntegerEnumValidator, LongEnumValidator, FloatEnumValidator, DoubleEnumValidator, NumberSchemaValidator { + /* + NOTE: This class is auto generated by OpenAPI JSON Schema Generator. + Ref: https://github.com/openapi-json-schema-tools/openapi-json-schema-generator + + Do not edit the class manually. + */ + private static @Nullable IntegerEnum1 instance = null; + + protected IntegerEnum1() { + super(new JsonSchemaInfo() + .type(Set.of( + Integer.class, + Long.class, + Float.class, + Double.class + )) + .format("int") + .enumValues(SetMaker.makeSet( + new BigDecimal("0"), + new BigDecimal("1"), + new BigDecimal("2") + )) + ); + } + + public static IntegerEnum1 getInstance() { + if (instance == null) { + instance = new IntegerEnum1(); + } + return instance; + } + + @Override + public Number validate(Number arg, SchemaConfiguration configuration) throws ValidationException { + Set> pathSet = new HashSet<>(); + List pathToItem = List.of("args[0"); + Number castArg = castToAllowedTypes(arg, pathToItem, pathSet); + SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().build())); + ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, new PathToSchemasMap(), new LinkedHashSet<>()); + getPathToSchemas(this, castArg, validationMetadata, pathSet); + return castArg; + } + + public int validate(int arg, SchemaConfiguration configuration) throws ValidationException { + return (int) validate((Number) arg, configuration); + } + + public float validate(float arg, SchemaConfiguration configuration) throws ValidationException { + return (float) validate((Number) arg, configuration); + } + + public long validate(long arg, SchemaConfiguration configuration) throws ValidationException { + return (long) validate((Number) arg, configuration); + } + + public double validate(double arg, SchemaConfiguration configuration) throws ValidationException { + return (double) validate((Number) arg, configuration); + } + + @Override + 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 ValidationException { + return (long) validate((Number) arg.value(), configuration); + } + + @Override + 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 ValidationException { + return (double) validate((Number) arg.value(), configuration); + } + + @Override + public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws 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"); + } + @Override + public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { + 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"); + } + @Override + 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 { + 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"); + } + } +} diff --git a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/schemas/IntegerEnumBig.kt b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/schemas/IntegerEnumBig.kt new file mode 100644 index 00000000000..01e7b0c0d0b --- /dev/null +++ b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/schemas/IntegerEnumBig.kt @@ -0,0 +1,206 @@ +package org.openapijsonschematools.client.components.schemas; +import java.math.BigDecimal; +import java.util.HashSet; +import java.util.LinkedHashSet; +import java.util.List; +import java.util.Objects; +import java.util.Set; +import org.checkerframework.checker.nullness.qual.Nullable; +import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags; +import org.openapijsonschematools.client.configurations.SchemaConfiguration; +import org.openapijsonschematools.client.exceptions.ValidationException; +import org.openapijsonschematools.client.schemas.SetMaker; +import org.openapijsonschematools.client.schemas.validation.DoubleEnumValidator; +import org.openapijsonschematools.client.schemas.validation.DoubleValueMethod; +import org.openapijsonschematools.client.schemas.validation.FloatEnumValidator; +import org.openapijsonschematools.client.schemas.validation.FloatValueMethod; +import org.openapijsonschematools.client.schemas.validation.IntegerEnumValidator; +import org.openapijsonschematools.client.schemas.validation.IntegerValueMethod; +import org.openapijsonschematools.client.schemas.validation.JsonSchema; +import org.openapijsonschematools.client.schemas.validation.JsonSchemaInfo; +import org.openapijsonschematools.client.schemas.validation.LongEnumValidator; +import org.openapijsonschematools.client.schemas.validation.LongValueMethod; +import org.openapijsonschematools.client.schemas.validation.NumberSchemaValidator; +import org.openapijsonschematools.client.schemas.validation.PathToSchemasMap; +import org.openapijsonschematools.client.schemas.validation.ValidationMetadata; + +public class IntegerEnumBig { + // nest classes so all schemas and input/output classes can be public + + public enum IntegerIntegerEnumBigEnums implements IntegerValueMethod { + POSITIVE_10(10), + POSITIVE_11(11), + POSITIVE_12(12); + private final int value; + + IntegerIntegerEnumBigEnums(int value) { + this.value = value; + } + public int value() { + return this.value; + } + } + + public enum LongIntegerEnumBigEnums implements LongValueMethod { + POSITIVE_10(10L), + POSITIVE_11(11L), + POSITIVE_12(12L); + private final long value; + + LongIntegerEnumBigEnums(long value) { + this.value = value; + } + public long value() { + return this.value; + } + } + + public enum FloatIntegerEnumBigEnums implements FloatValueMethod { + POSITIVE_10(10.0f), + POSITIVE_11(11.0f), + POSITIVE_12(12.0f); + private final float value; + + FloatIntegerEnumBigEnums(float value) { + this.value = value; + } + public float value() { + return this.value; + } + } + + public enum DoubleIntegerEnumBigEnums implements DoubleValueMethod { + POSITIVE_10(10.0d), + POSITIVE_11(11.0d), + POSITIVE_12(12.0d); + private final double value; + + DoubleIntegerEnumBigEnums(double value) { + this.value = value; + } + public double value() { + return this.value; + } + } + + + public sealed interface IntegerEnumBig1Boxed permits IntegerEnumBig1BoxedNumber { + @Nullable Object getData(); + } + + public record IntegerEnumBig1BoxedNumber(Number data) implements IntegerEnumBig1Boxed { + @Override + public @Nullable Object getData() { + return data; + } + } + + + + public static class IntegerEnumBig1 extends JsonSchema implements IntegerEnumValidator, LongEnumValidator, FloatEnumValidator, DoubleEnumValidator, NumberSchemaValidator { + /* + NOTE: This class is auto generated by OpenAPI JSON Schema Generator. + Ref: https://github.com/openapi-json-schema-tools/openapi-json-schema-generator + + Do not edit the class manually. + */ + private static @Nullable IntegerEnumBig1 instance = null; + + protected IntegerEnumBig1() { + super(new JsonSchemaInfo() + .type(Set.of( + Integer.class, + Long.class, + Float.class, + Double.class + )) + .format("int") + .enumValues(SetMaker.makeSet( + new BigDecimal("10"), + new BigDecimal("11"), + new BigDecimal("12") + )) + ); + } + + public static IntegerEnumBig1 getInstance() { + if (instance == null) { + instance = new IntegerEnumBig1(); + } + return instance; + } + + @Override + public Number validate(Number arg, SchemaConfiguration configuration) throws ValidationException { + Set> pathSet = new HashSet<>(); + List pathToItem = List.of("args[0"); + Number castArg = castToAllowedTypes(arg, pathToItem, pathSet); + SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().build())); + ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, new PathToSchemasMap(), new LinkedHashSet<>()); + getPathToSchemas(this, castArg, validationMetadata, pathSet); + return castArg; + } + + public int validate(int arg, SchemaConfiguration configuration) throws ValidationException { + return (int) validate((Number) arg, configuration); + } + + public float validate(float arg, SchemaConfiguration configuration) throws ValidationException { + return (float) validate((Number) arg, configuration); + } + + public long validate(long arg, SchemaConfiguration configuration) throws ValidationException { + return (long) validate((Number) arg, configuration); + } + + public double validate(double arg, SchemaConfiguration configuration) throws ValidationException { + return (double) validate((Number) arg, configuration); + } + + @Override + 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 ValidationException { + return (long) validate((Number) arg.value(), configuration); + } + + @Override + 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 ValidationException { + return (double) validate((Number) arg.value(), configuration); + } + + @Override + public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws 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"); + } + @Override + public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { + 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"); + } + @Override + 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 { + 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"); + } + } +} diff --git a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/schemas/IntegerEnumOneValue.kt b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/schemas/IntegerEnumOneValue.kt new file mode 100644 index 00000000000..68282e3aab5 --- /dev/null +++ b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/schemas/IntegerEnumOneValue.kt @@ -0,0 +1,196 @@ +package org.openapijsonschematools.client.components.schemas; +import java.math.BigDecimal; +import java.util.HashSet; +import java.util.LinkedHashSet; +import java.util.List; +import java.util.Objects; +import java.util.Set; +import org.checkerframework.checker.nullness.qual.Nullable; +import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags; +import org.openapijsonschematools.client.configurations.SchemaConfiguration; +import org.openapijsonschematools.client.exceptions.ValidationException; +import org.openapijsonschematools.client.schemas.SetMaker; +import org.openapijsonschematools.client.schemas.validation.DoubleEnumValidator; +import org.openapijsonschematools.client.schemas.validation.DoubleValueMethod; +import org.openapijsonschematools.client.schemas.validation.FloatEnumValidator; +import org.openapijsonschematools.client.schemas.validation.FloatValueMethod; +import org.openapijsonschematools.client.schemas.validation.IntegerEnumValidator; +import org.openapijsonschematools.client.schemas.validation.IntegerValueMethod; +import org.openapijsonschematools.client.schemas.validation.JsonSchema; +import org.openapijsonschematools.client.schemas.validation.JsonSchemaInfo; +import org.openapijsonschematools.client.schemas.validation.LongEnumValidator; +import org.openapijsonschematools.client.schemas.validation.LongValueMethod; +import org.openapijsonschematools.client.schemas.validation.NumberSchemaValidator; +import org.openapijsonschematools.client.schemas.validation.PathToSchemasMap; +import org.openapijsonschematools.client.schemas.validation.ValidationMetadata; + +public class IntegerEnumOneValue { + // nest classes so all schemas and input/output classes can be public + + public enum IntegerIntegerEnumOneValueEnums implements IntegerValueMethod { + POSITIVE_0(0); + private final int value; + + IntegerIntegerEnumOneValueEnums(int value) { + this.value = value; + } + public int value() { + return this.value; + } + } + + public enum LongIntegerEnumOneValueEnums implements LongValueMethod { + POSITIVE_0(0L); + private final long value; + + LongIntegerEnumOneValueEnums(long value) { + this.value = value; + } + public long value() { + return this.value; + } + } + + public enum FloatIntegerEnumOneValueEnums implements FloatValueMethod { + POSITIVE_0(0.0f); + private final float value; + + FloatIntegerEnumOneValueEnums(float value) { + this.value = value; + } + public float value() { + return this.value; + } + } + + public enum DoubleIntegerEnumOneValueEnums implements DoubleValueMethod { + POSITIVE_0(0.0d); + private final double value; + + DoubleIntegerEnumOneValueEnums(double value) { + this.value = value; + } + public double value() { + return this.value; + } + } + + + public sealed interface IntegerEnumOneValue1Boxed permits IntegerEnumOneValue1BoxedNumber { + @Nullable Object getData(); + } + + public record IntegerEnumOneValue1BoxedNumber(Number data) implements IntegerEnumOneValue1Boxed { + @Override + public @Nullable Object getData() { + return data; + } + } + + + + public static class IntegerEnumOneValue1 extends JsonSchema implements IntegerEnumValidator, LongEnumValidator, FloatEnumValidator, DoubleEnumValidator, NumberSchemaValidator { + /* + NOTE: This class is auto generated by OpenAPI JSON Schema Generator. + Ref: https://github.com/openapi-json-schema-tools/openapi-json-schema-generator + + Do not edit the class manually. + */ + private static @Nullable IntegerEnumOneValue1 instance = null; + + protected IntegerEnumOneValue1() { + super(new JsonSchemaInfo() + .type(Set.of( + Integer.class, + Long.class, + Float.class, + Double.class + )) + .format("int") + .enumValues(SetMaker.makeSet( + new BigDecimal("0") + )) + ); + } + + public static IntegerEnumOneValue1 getInstance() { + if (instance == null) { + instance = new IntegerEnumOneValue1(); + } + return instance; + } + + @Override + public Number validate(Number arg, SchemaConfiguration configuration) throws ValidationException { + Set> pathSet = new HashSet<>(); + List pathToItem = List.of("args[0"); + Number castArg = castToAllowedTypes(arg, pathToItem, pathSet); + SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().build())); + ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, new PathToSchemasMap(), new LinkedHashSet<>()); + getPathToSchemas(this, castArg, validationMetadata, pathSet); + return castArg; + } + + public int validate(int arg, SchemaConfiguration configuration) throws ValidationException { + return (int) validate((Number) arg, configuration); + } + + public float validate(float arg, SchemaConfiguration configuration) throws ValidationException { + return (float) validate((Number) arg, configuration); + } + + public long validate(long arg, SchemaConfiguration configuration) throws ValidationException { + return (long) validate((Number) arg, configuration); + } + + public double validate(double arg, SchemaConfiguration configuration) throws ValidationException { + return (double) validate((Number) arg, configuration); + } + + @Override + 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 ValidationException { + return (long) validate((Number) arg.value(), configuration); + } + + @Override + 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 ValidationException { + return (double) validate((Number) arg.value(), configuration); + } + + @Override + public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws 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"); + } + @Override + public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { + 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"); + } + @Override + 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 { + 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"); + } + } +} diff --git a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/schemas/IntegerEnumWithDefaultValue.kt b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/schemas/IntegerEnumWithDefaultValue.kt new file mode 100644 index 00000000000..e65c48c3cc5 --- /dev/null +++ b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/schemas/IntegerEnumWithDefaultValue.kt @@ -0,0 +1,208 @@ +package org.openapijsonschematools.client.components.schemas; +import java.math.BigDecimal; +import java.util.HashSet; +import java.util.LinkedHashSet; +import java.util.List; +import java.util.Objects; +import java.util.Set; +import org.checkerframework.checker.nullness.qual.Nullable; +import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags; +import org.openapijsonschematools.client.configurations.SchemaConfiguration; +import org.openapijsonschematools.client.exceptions.ValidationException; +import org.openapijsonschematools.client.schemas.SetMaker; +import org.openapijsonschematools.client.schemas.validation.DefaultValueMethod; +import org.openapijsonschematools.client.schemas.validation.DoubleEnumValidator; +import org.openapijsonschematools.client.schemas.validation.DoubleValueMethod; +import org.openapijsonschematools.client.schemas.validation.FloatEnumValidator; +import org.openapijsonschematools.client.schemas.validation.FloatValueMethod; +import org.openapijsonschematools.client.schemas.validation.IntegerEnumValidator; +import org.openapijsonschematools.client.schemas.validation.IntegerValueMethod; +import org.openapijsonschematools.client.schemas.validation.JsonSchema; +import org.openapijsonschematools.client.schemas.validation.JsonSchemaInfo; +import org.openapijsonschematools.client.schemas.validation.LongEnumValidator; +import org.openapijsonschematools.client.schemas.validation.LongValueMethod; +import org.openapijsonschematools.client.schemas.validation.NumberSchemaValidator; +import org.openapijsonschematools.client.schemas.validation.PathToSchemasMap; +import org.openapijsonschematools.client.schemas.validation.ValidationMetadata; + +public class IntegerEnumWithDefaultValue { + // nest classes so all schemas and input/output classes can be public + + public enum IntegerIntegerEnumWithDefaultValueEnums implements IntegerValueMethod { + POSITIVE_0(0), + POSITIVE_1(1), + POSITIVE_2(2); + private final int value; + + IntegerIntegerEnumWithDefaultValueEnums(int value) { + this.value = value; + } + public int value() { + return this.value; + } + } + + public enum LongIntegerEnumWithDefaultValueEnums implements LongValueMethod { + POSITIVE_0(0L), + POSITIVE_1(1L), + POSITIVE_2(2L); + private final long value; + + LongIntegerEnumWithDefaultValueEnums(long value) { + this.value = value; + } + public long value() { + return this.value; + } + } + + public enum FloatIntegerEnumWithDefaultValueEnums implements FloatValueMethod { + POSITIVE_0(0.0f), + POSITIVE_1(1.0f), + POSITIVE_2(2.0f); + private final float value; + + FloatIntegerEnumWithDefaultValueEnums(float value) { + this.value = value; + } + public float value() { + return this.value; + } + } + + public enum DoubleIntegerEnumWithDefaultValueEnums implements DoubleValueMethod { + POSITIVE_0(0.0d), + POSITIVE_1(1.0d), + POSITIVE_2(2.0d); + private final double value; + + DoubleIntegerEnumWithDefaultValueEnums(double value) { + this.value = value; + } + public double value() { + return this.value; + } + } + + + public sealed interface IntegerEnumWithDefaultValue1Boxed permits IntegerEnumWithDefaultValue1BoxedNumber { + @Nullable Object getData(); + } + + public record IntegerEnumWithDefaultValue1BoxedNumber(Number data) implements IntegerEnumWithDefaultValue1Boxed { + @Override + public @Nullable Object getData() { + return data; + } + } + + + + public static class IntegerEnumWithDefaultValue1 extends JsonSchema implements IntegerEnumValidator, LongEnumValidator, FloatEnumValidator, DoubleEnumValidator, NumberSchemaValidator { + /* + NOTE: This class is auto generated by OpenAPI JSON Schema Generator. + Ref: https://github.com/openapi-json-schema-tools/openapi-json-schema-generator + + Do not edit the class manually. + */ + private static @Nullable IntegerEnumWithDefaultValue1 instance = null; + + protected IntegerEnumWithDefaultValue1() { + super(new JsonSchemaInfo() + .type(Set.of( + Integer.class, + Long.class, + Float.class, + Double.class + )) + .format("int") + .enumValues(SetMaker.makeSet( + new BigDecimal("0"), + new BigDecimal("1"), + new BigDecimal("2") + )) + .defaultValue(0) + ); + } + + public static IntegerEnumWithDefaultValue1 getInstance() { + if (instance == null) { + instance = new IntegerEnumWithDefaultValue1(); + } + return instance; + } + + @Override + public Number validate(Number arg, SchemaConfiguration configuration) throws ValidationException { + Set> pathSet = new HashSet<>(); + List pathToItem = List.of("args[0"); + Number castArg = castToAllowedTypes(arg, pathToItem, pathSet); + SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().build())); + ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, new PathToSchemasMap(), new LinkedHashSet<>()); + getPathToSchemas(this, castArg, validationMetadata, pathSet); + return castArg; + } + + public int validate(int arg, SchemaConfiguration configuration) throws ValidationException { + return (int) validate((Number) arg, configuration); + } + + public float validate(float arg, SchemaConfiguration configuration) throws ValidationException { + return (float) validate((Number) arg, configuration); + } + + public long validate(long arg, SchemaConfiguration configuration) throws ValidationException { + return (long) validate((Number) arg, configuration); + } + + public double validate(double arg, SchemaConfiguration configuration) throws ValidationException { + return (double) validate((Number) arg, configuration); + } + + @Override + 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 ValidationException { + return (long) validate((Number) arg.value(), configuration); + } + + @Override + 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 ValidationException { + return (double) validate((Number) arg.value(), configuration); + } + + @Override + public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws 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"); + } + @Override + public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { + 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"); + } + @Override + 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 { + 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"); + } + } +} diff --git a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/schemas/IntegerMax10.kt b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/schemas/IntegerMax10.kt new file mode 100644 index 00000000000..aee3586634b --- /dev/null +++ b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/schemas/IntegerMax10.kt @@ -0,0 +1,116 @@ +package org.openapijsonschematools.client.components.schemas; +import java.util.HashSet; +import java.util.LinkedHashSet; +import java.util.List; +import java.util.Objects; +import java.util.Set; +import org.checkerframework.checker.nullness.qual.Nullable; +import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags; +import org.openapijsonschematools.client.configurations.SchemaConfiguration; +import org.openapijsonschematools.client.exceptions.ValidationException; +import org.openapijsonschematools.client.schemas.validation.JsonSchema; +import org.openapijsonschematools.client.schemas.validation.JsonSchemaInfo; +import org.openapijsonschematools.client.schemas.validation.NumberSchemaValidator; +import org.openapijsonschematools.client.schemas.validation.PathToSchemasMap; +import org.openapijsonschematools.client.schemas.validation.ValidationMetadata; + +public class IntegerMax10 { + // nest classes so all schemas and input/output classes can be public + + + public sealed interface IntegerMax101Boxed permits IntegerMax101BoxedNumber { + @Nullable Object getData(); + } + + public record IntegerMax101BoxedNumber(Number data) implements IntegerMax101Boxed { + @Override + public @Nullable Object getData() { + return data; + } + } + + + + public static class IntegerMax101 extends JsonSchema implements NumberSchemaValidator { + /* + NOTE: This class is auto generated by OpenAPI JSON Schema Generator. + Ref: https://github.com/openapi-json-schema-tools/openapi-json-schema-generator + + Do not edit the class manually. + */ + private static @Nullable IntegerMax101 instance = null; + + protected IntegerMax101() { + super(new JsonSchemaInfo() + .type(Set.of( + Integer.class, + Long.class, + Float.class, + Double.class + )) + .format("int64") + .maximum(10) + ); + } + + public static IntegerMax101 getInstance() { + if (instance == null) { + instance = new IntegerMax101(); + } + return instance; + } + + @Override + public Number validate(Number arg, SchemaConfiguration configuration) throws ValidationException { + Set> pathSet = new HashSet<>(); + List pathToItem = List.of("args[0"); + Number castArg = castToAllowedTypes(arg, pathToItem, pathSet); + SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().build())); + ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, new PathToSchemasMap(), new LinkedHashSet<>()); + getPathToSchemas(this, castArg, validationMetadata, pathSet); + return castArg; + } + + public int validate(int arg, SchemaConfiguration configuration) throws ValidationException { + return (int) validate((Number) arg, configuration); + } + + public float validate(float arg, SchemaConfiguration configuration) throws ValidationException { + return (float) validate((Number) arg, configuration); + } + + public long validate(long arg, SchemaConfiguration configuration) throws ValidationException { + return (long) validate((Number) arg, configuration); + } + + 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 { + 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"); + } + @Override + public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { + 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"); + } + @Override + 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 { + 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"); + } + } +} diff --git a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/schemas/IntegerMin15.kt b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/schemas/IntegerMin15.kt new file mode 100644 index 00000000000..279eb26879c --- /dev/null +++ b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/schemas/IntegerMin15.kt @@ -0,0 +1,116 @@ +package org.openapijsonschematools.client.components.schemas; +import java.util.HashSet; +import java.util.LinkedHashSet; +import java.util.List; +import java.util.Objects; +import java.util.Set; +import org.checkerframework.checker.nullness.qual.Nullable; +import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags; +import org.openapijsonschematools.client.configurations.SchemaConfiguration; +import org.openapijsonschematools.client.exceptions.ValidationException; +import org.openapijsonschematools.client.schemas.validation.JsonSchema; +import org.openapijsonschematools.client.schemas.validation.JsonSchemaInfo; +import org.openapijsonschematools.client.schemas.validation.NumberSchemaValidator; +import org.openapijsonschematools.client.schemas.validation.PathToSchemasMap; +import org.openapijsonschematools.client.schemas.validation.ValidationMetadata; + +public class IntegerMin15 { + // nest classes so all schemas and input/output classes can be public + + + public sealed interface IntegerMin151Boxed permits IntegerMin151BoxedNumber { + @Nullable Object getData(); + } + + public record IntegerMin151BoxedNumber(Number data) implements IntegerMin151Boxed { + @Override + public @Nullable Object getData() { + return data; + } + } + + + + public static class IntegerMin151 extends JsonSchema implements NumberSchemaValidator { + /* + NOTE: This class is auto generated by OpenAPI JSON Schema Generator. + Ref: https://github.com/openapi-json-schema-tools/openapi-json-schema-generator + + Do not edit the class manually. + */ + private static @Nullable IntegerMin151 instance = null; + + protected IntegerMin151() { + super(new JsonSchemaInfo() + .type(Set.of( + Integer.class, + Long.class, + Float.class, + Double.class + )) + .format("int64") + .minimum(15) + ); + } + + public static IntegerMin151 getInstance() { + if (instance == null) { + instance = new IntegerMin151(); + } + return instance; + } + + @Override + public Number validate(Number arg, SchemaConfiguration configuration) throws ValidationException { + Set> pathSet = new HashSet<>(); + List pathToItem = List.of("args[0"); + Number castArg = castToAllowedTypes(arg, pathToItem, pathSet); + SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().build())); + ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, new PathToSchemasMap(), new LinkedHashSet<>()); + getPathToSchemas(this, castArg, validationMetadata, pathSet); + return castArg; + } + + public int validate(int arg, SchemaConfiguration configuration) throws ValidationException { + return (int) validate((Number) arg, configuration); + } + + public float validate(float arg, SchemaConfiguration configuration) throws ValidationException { + return (float) validate((Number) arg, configuration); + } + + public long validate(long arg, SchemaConfiguration configuration) throws ValidationException { + return (long) validate((Number) arg, configuration); + } + + 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 { + 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"); + } + @Override + public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { + 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"); + } + @Override + 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 { + 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"); + } + } +} diff --git a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/schemas/IsoscelesTriangle.kt b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/schemas/IsoscelesTriangle.kt new file mode 100644 index 00000000000..ac25aac6766 --- /dev/null +++ b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/schemas/IsoscelesTriangle.kt @@ -0,0 +1,589 @@ +package org.openapijsonschematools.client.components.schemas; +import java.time.LocalDate; +import java.time.ZonedDateTime; +import java.util.ArrayList; +import java.util.HashSet; +import java.util.LinkedHashMap; +import java.util.LinkedHashSet; +import java.util.List; +import java.util.Map; +import java.util.Objects; +import java.util.Set; +import java.util.UUID; +import org.checkerframework.checker.nullness.qual.Nullable; +import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags; +import org.openapijsonschematools.client.configurations.SchemaConfiguration; +import org.openapijsonschematools.client.exceptions.InvalidAdditionalPropertyException; +import org.openapijsonschematools.client.exceptions.UnsetPropertyException; +import org.openapijsonschematools.client.exceptions.ValidationException; +import org.openapijsonschematools.client.schemas.GenericBuilder; +import org.openapijsonschematools.client.schemas.SetMaker; +import org.openapijsonschematools.client.schemas.UnsetAddPropsSetter; +import org.openapijsonschematools.client.schemas.validation.BooleanSchemaValidator; +import org.openapijsonschematools.client.schemas.validation.FrozenList; +import org.openapijsonschematools.client.schemas.validation.FrozenMap; +import org.openapijsonschematools.client.schemas.validation.JsonSchema; +import org.openapijsonschematools.client.schemas.validation.JsonSchemaInfo; +import org.openapijsonschematools.client.schemas.validation.ListSchemaValidator; +import org.openapijsonschematools.client.schemas.validation.MapSchemaValidator; +import org.openapijsonschematools.client.schemas.validation.NullSchemaValidator; +import org.openapijsonschematools.client.schemas.validation.NumberSchemaValidator; +import org.openapijsonschematools.client.schemas.validation.PathToSchemasMap; +import org.openapijsonschematools.client.schemas.validation.PropertyEntry; +import org.openapijsonschematools.client.schemas.validation.StringEnumValidator; +import org.openapijsonschematools.client.schemas.validation.StringSchemaValidator; +import org.openapijsonschematools.client.schemas.validation.StringValueMethod; +import org.openapijsonschematools.client.schemas.validation.ValidationMetadata; + +public class IsoscelesTriangle { + // nest classes so all schemas and input/output classes can be public + + public enum StringTriangleTypeEnums implements StringValueMethod { + ISOSCELES_TRIANGLE("IsoscelesTriangle"); + private final String value; + + StringTriangleTypeEnums(String value) { + this.value = value; + } + public String value() { + return this.value; + } + } + + + public sealed interface TriangleTypeBoxed permits TriangleTypeBoxedString { + @Nullable Object getData(); + } + + public record TriangleTypeBoxedString(String data) implements TriangleTypeBoxed { + @Override + public @Nullable Object getData() { + return data; + } + } + + + + public static class TriangleType extends JsonSchema implements StringSchemaValidator, StringEnumValidator { + private static @Nullable TriangleType instance = null; + + protected TriangleType() { + super(new JsonSchemaInfo() + .type(Set.of( + String.class + )) + .enumValues(SetMaker.makeSet( + "IsoscelesTriangle" + )) + ); + } + + public static TriangleType getInstance() { + if (instance == null) { + instance = new TriangleType(); + } + return instance; + } + + @Override + public String validate(String arg, SchemaConfiguration configuration) throws ValidationException { + Set> pathSet = new HashSet<>(); + List pathToItem = List.of("args[0"); + String castArg = castToAllowedTypes(arg, pathToItem, pathSet); + SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().build())); + ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, new PathToSchemasMap(), new LinkedHashSet<>()); + getPathToSchemas(this, castArg, validationMetadata, pathSet); + return castArg; + } + + @Override + 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 { + 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"); + } + @Override + public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { + 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"); + } + @Override + 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 { + 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"); + } + } + + public static class Schema1Map extends FrozenMap<@Nullable Object> { + protected Schema1Map(FrozenMap<@Nullable Object> m) { + super(m); + } + public static final Set requiredKeys = Set.of(); + public static final Set optionalKeys = Set.of( + "triangleType" + ); + public static Schema1Map of(Map arg, SchemaConfiguration configuration) throws ValidationException { + return Schema1.getInstance().validate(arg, configuration); + } + + public String triangleType() throws UnsetPropertyException { + String key = "triangleType"; + throwIfKeyNotPresent(key); + @Nullable Object value = get(key); + if (!(value instanceof String)) { + throw new RuntimeException("Invalid value stored for triangleType"); + } + return (String) value; + } + + public @Nullable Object getAdditionalProperty(String name) throws UnsetPropertyException, InvalidAdditionalPropertyException { + throwIfKeyKnown(name, requiredKeys, optionalKeys); + throwIfKeyNotPresent(name); + return get(name); + } + } + + public interface SetterForTriangleType { + Map getInstance(); + T getBuilderAfterTriangleType(Map instance); + + default T triangleType(String value) { + var instance = getInstance(); + instance.put("triangleType", value); + return getBuilderAfterTriangleType(instance); + } + + default T triangleType(StringTriangleTypeEnums value) { + var instance = getInstance(); + instance.put("triangleType", value.value()); + return getBuilderAfterTriangleType(instance); + } + } + + public static class Schema1MapBuilder extends UnsetAddPropsSetter implements GenericBuilder>, SetterForTriangleType { + private final Map instance; + private static final Set knownKeys = Set.of( + "triangleType" + ); + public Set getKnownKeys() { + return knownKeys; + } + public Schema1MapBuilder() { + this.instance = new LinkedHashMap<>(); + } + public Map build() { + return instance; + } + public Map getInstance() { + return instance; + } + public Schema1MapBuilder getBuilderAfterTriangleType(Map instance) { + return this; + } + public Schema1MapBuilder getBuilderAfterAdditionalProperty(Map instance) { + return this; + } + } + + + public sealed interface Schema1Boxed permits Schema1BoxedMap { + @Nullable Object getData(); + } + + public record Schema1BoxedMap(Schema1Map data) implements Schema1Boxed { + @Override + public @Nullable Object getData() { + return data; + } + } + + + public static class Schema1 extends JsonSchema implements MapSchemaValidator { + private static @Nullable Schema1 instance = null; + + protected Schema1() { + super(new JsonSchemaInfo() + .type(Set.of(Map.class)) + .properties(Map.ofEntries( + new PropertyEntry("triangleType", TriangleType.class) + )) + ); + } + + public static Schema1 getInstance() { + if (instance == null) { + instance = new Schema1(); + } + return instance; + } + + 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 RuntimeException("Invalid non-string key value"); + } + String propertyName = (String) entryKey; + List propertyPathToItem = new ArrayList<>(pathToItem); + propertyPathToItem.add(propertyName); + Object value = entry.getValue(); + LinkedHashMap, Nothing?> schemas = pathToSchemas.get(propertyPathToItem); + if (schemas == null) { + throw new RuntimeException("Validation result is invalid, schemas must exist for a pathToItem"); + } + JsonSchema propertySchema = schemas.entrySet().iterator().next().getKey(); + @Nullable Object propertyInstance = propertySchema.getNewInstance(value, propertyPathToItem, pathToSchemas); + properties.put(propertyName, propertyInstance); + } + FrozenMap<@Nullable Object> castProperties = new FrozenMap<>(properties); + return new Schema1Map(castProperties); + } + + 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); + SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().build())); + ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, new PathToSchemasMap(), new LinkedHashSet<>()); + PathToSchemasMap pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet); + return getNewInstance(castArg, validationMetadata.pathToItem(), pathToSchemasMap); + } + + + @Override + public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws 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"); + } + @Override + public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { + if (arg instanceof Map) { + return getNewInstance((Map) arg, pathToItem, pathToSchemas); + } + 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 { + return new Schema1BoxedMap(validate(arg, configuration)); + } + @Override + public Schema1Boxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { + 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"); + } + } + + + public sealed interface IsoscelesTriangle1Boxed permits IsoscelesTriangle1BoxedVoid, IsoscelesTriangle1BoxedBoolean, IsoscelesTriangle1BoxedNumber, IsoscelesTriangle1BoxedString, IsoscelesTriangle1BoxedList, IsoscelesTriangle1BoxedMap { + @Nullable Object getData(); + } + + public record IsoscelesTriangle1BoxedVoid(Nothing? data) implements IsoscelesTriangle1Boxed { + @Override + public @Nullable Object getData() { + return data; + } + } + + public record IsoscelesTriangle1BoxedBoolean(boolean data) implements IsoscelesTriangle1Boxed { + @Override + public @Nullable Object getData() { + return data; + } + } + + public record IsoscelesTriangle1BoxedNumber(Number data) implements IsoscelesTriangle1Boxed { + @Override + public @Nullable Object getData() { + return data; + } + } + + public record IsoscelesTriangle1BoxedString(String data) implements IsoscelesTriangle1Boxed { + @Override + public @Nullable Object getData() { + return data; + } + } + + public record IsoscelesTriangle1BoxedList(FrozenList<@Nullable Object> data) implements IsoscelesTriangle1Boxed { + @Override + public @Nullable Object getData() { + return data; + } + } + + public record IsoscelesTriangle1BoxedMap(FrozenMap<@Nullable Object> data) implements IsoscelesTriangle1Boxed { + @Override + public @Nullable Object getData() { + return data; + } + } + + + public static class IsoscelesTriangle1 extends JsonSchema implements NullSchemaValidator, BooleanSchemaValidator, NumberSchemaValidator, StringSchemaValidator, ListSchemaValidator, IsoscelesTriangle1BoxedList>, MapSchemaValidator, IsoscelesTriangle1BoxedMap> { + /* + NOTE: This class is auto generated by OpenAPI JSON Schema Generator. + Ref: https://github.com/openapi-json-schema-tools/openapi-json-schema-generator + + Do not edit the class manually. + */ + private static @Nullable IsoscelesTriangle1 instance = null; + + protected IsoscelesTriangle1() { + super(new JsonSchemaInfo() + .allOf(List.of( + TriangleInterface.TriangleInterface1.class, + Schema1.class + )) + ); + } + + public static IsoscelesTriangle1 getInstance() { + if (instance == null) { + instance = new IsoscelesTriangle1(); + } + return instance; + } + + @Override + public Nothing? validate(Nothing? arg, SchemaConfiguration configuration) throws ValidationException { + Set> pathSet = new HashSet<>(); + List pathToItem = List.of("args[0]"); + Nothing? castArg = castToAllowedTypes(arg, pathToItem, pathSet); + SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().build())); + PathToSchemasMap validatedPathToSchemas = new PathToSchemasMap(); + ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, new LinkedHashSet<>()); + getPathToSchemas(this, castArg, validationMetadata, pathSet); + return castArg; + } + + @Override + public boolean validate(boolean arg, SchemaConfiguration configuration) throws ValidationException { + Set> pathSet = new HashSet<>(); + List pathToItem = List.of("args[0]"); + boolean castArg = castToAllowedTypes(arg, pathToItem, pathSet); + SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().build())); + PathToSchemasMap validatedPathToSchemas = new PathToSchemasMap(); + ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, new LinkedHashSet<>()); + getPathToSchemas(this, castArg, validationMetadata, pathSet); + return castArg; + } + + @Override + public Number validate(Number arg, SchemaConfiguration configuration) throws ValidationException { + Set> pathSet = new HashSet<>(); + List pathToItem = List.of("args[0]"); + Number castArg = castToAllowedTypes(arg, pathToItem, pathSet); + SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().build())); + PathToSchemasMap validatedPathToSchemas = new PathToSchemasMap(); + ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, new LinkedHashSet<>()); + getPathToSchemas(this, castArg, validationMetadata, pathSet); + return castArg; + } + + public int validate(int arg, SchemaConfiguration configuration) throws ValidationException { + return (int) validate((Number) arg, configuration); + } + + public long validate(long arg, SchemaConfiguration configuration) throws ValidationException { + return (long) validate((Number) arg, configuration); + } + + public float validate(float arg, SchemaConfiguration configuration) throws ValidationException { + return (float) validate((Number) arg, configuration); + } + + public double validate(double arg, SchemaConfiguration configuration) throws ValidationException { + return (double) validate((Number) arg, configuration); + } + + @Override + public String validate(String arg, SchemaConfiguration configuration) throws ValidationException { + Set> pathSet = new HashSet<>(); + List pathToItem = List.of("args[0]"); + String castArg = castToAllowedTypes(arg, pathToItem, pathSet); + SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().build())); + PathToSchemasMap validatedPathToSchemas = new PathToSchemasMap(); + ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, new LinkedHashSet<>()); + getPathToSchemas(this, castArg, validationMetadata, pathSet); + return castArg; + } + + public String validate(LocalDate arg, SchemaConfiguration configuration) throws ValidationException { + return validate(arg.toString(), configuration); + } + + public String validate(ZonedDateTime arg, SchemaConfiguration configuration) throws ValidationException { + return validate(arg.toString(), configuration); + } + + public String validate(UUID arg, SchemaConfiguration configuration) throws ValidationException { + return validate(arg.toString(), configuration); + } + + @Override + public FrozenList<@Nullable Object> getNewInstance(List arg, List pathToItem, PathToSchemasMap pathToSchemas) { + List<@Nullable Object> items = new ArrayList<>(); + int i = 0; + for (Object item: arg) { + List itemPathToItem = new ArrayList<>(pathToItem); + itemPathToItem.add(i); + LinkedHashMap, Nothing?> schemas = pathToSchemas.get(itemPathToItem); + if (schemas == null) { + throw new RuntimeException("Validation result is invalid, schemas must exist for a pathToItem"); + } + JsonSchema itemSchema = schemas.entrySet().iterator().next().getKey(); + @Nullable Object itemInstance = itemSchema.getNewInstance(item, itemPathToItem, pathToSchemas); + items.add(itemInstance); + i += 1; + } + FrozenList<@Nullable Object> newInstanceItems = new FrozenList<>(items); + return newInstanceItems; + } + + 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); + SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().build())); + ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, new PathToSchemasMap(), new LinkedHashSet<>()); + PathToSchemasMap pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet); + return getNewInstance(castArg, validationMetadata.pathToItem(), pathToSchemasMap); + } + + @Override + 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 RuntimeException("Invalid non-string key value"); + } + String propertyName = (String) entryKey; + List propertyPathToItem = new ArrayList<>(pathToItem); + propertyPathToItem.add(propertyName); + Object value = entry.getValue(); + LinkedHashMap, Nothing?> schemas = pathToSchemas.get(propertyPathToItem); + if (schemas == null) { + throw new RuntimeException("Validation result is invalid, schemas must exist for a pathToItem"); + } + JsonSchema propertySchema = schemas.entrySet().iterator().next().getKey(); + @Nullable Object propertyInstance = propertySchema.getNewInstance(value, propertyPathToItem, pathToSchemas); + properties.put(propertyName, propertyInstance); + } + FrozenMap<@Nullable Object> castProperties = new FrozenMap<>(properties); + return castProperties; + } + + public FrozenMap<@Nullable Object> validate(Map arg, SchemaConfiguration configuration) throws ValidationException { + Set> pathSet = new HashSet<>(); + List pathToItem = List.of("args[0]"); + Map castArg = castToAllowedTypes(arg, pathToItem, pathSet); + SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().build())); + PathToSchemasMap validatedPathToSchemas = new PathToSchemasMap(); + ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, new LinkedHashSet<>()); + PathToSchemasMap pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet); + return getNewInstance(castArg, validationMetadata.pathToItem(), pathToSchemasMap); + } + + @Override + public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { + if (arg == null) { + return validate((Nothing?) null, configuration); + } else if (arg instanceof Boolean) { + boolean boolArg = (Boolean) arg; + return validate(boolArg, configuration); + } else if (arg instanceof Number) { + return validate((Number) arg, configuration); + } else if (arg instanceof String) { + return validate((String) arg, configuration); + } else if (arg instanceof List) { + return validate((List) arg, 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"); + } + @Override + public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { + if (arg == null) { + return getNewInstance((Nothing?) null, pathToItem, pathToSchemas); + } else if (arg instanceof Boolean) { + boolean boolArg = (Boolean) arg; + return getNewInstance(boolArg, pathToItem, pathToSchemas); + } else if (arg instanceof Number) { + return getNewInstance((Number) arg, pathToItem, pathToSchemas); + } else if (arg instanceof String) { + return getNewInstance((String) arg, pathToItem, pathToSchemas); + } else if (arg instanceof List) { + return getNewInstance((List) arg, 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"); + } + @Override + public IsoscelesTriangle1BoxedVoid validateAndBox(Nothing? arg, SchemaConfiguration configuration) throws ValidationException { + return new IsoscelesTriangle1BoxedVoid(validate(arg, configuration)); + } + @Override + 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 { + return new IsoscelesTriangle1BoxedNumber(validate(arg, configuration)); + } + @Override + 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 { + return new IsoscelesTriangle1BoxedList(validate(arg, configuration)); + } + @Override + 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 { + if (arg == null) { + Nothing? castArg = (Nothing?) arg; + return validateAndBox(castArg, configuration); + } else if (arg instanceof Boolean booleanArg) { + boolean castArg = booleanArg; + return validateAndBox(castArg, configuration); + } else if (arg instanceof String castArg) { + return validateAndBox(castArg, configuration); + } else if (arg instanceof Number castArg) { + return validateAndBox(castArg, configuration); + } else if (arg instanceof List castArg) { + 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"); + } + } +} diff --git a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/schemas/Items.kt b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/schemas/Items.kt new file mode 100644 index 00000000000..4006c02f963 --- /dev/null +++ b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/schemas/Items.kt @@ -0,0 +1,167 @@ +package org.openapijsonschematools.client.components.schemas; +import java.util.ArrayList; +import java.util.HashSet; +import java.util.LinkedHashMap; +import java.util.LinkedHashSet; +import java.util.List; +import java.util.Map; +import java.util.Objects; +import java.util.Set; +import org.checkerframework.checker.nullness.qual.Nullable; +import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags; +import org.openapijsonschematools.client.configurations.SchemaConfiguration; +import org.openapijsonschematools.client.exceptions.ValidationException; +import org.openapijsonschematools.client.schemas.MapJsonSchema; +import org.openapijsonschematools.client.schemas.validation.FrozenList; +import org.openapijsonschematools.client.schemas.validation.FrozenMap; +import org.openapijsonschematools.client.schemas.validation.JsonSchema; +import org.openapijsonschematools.client.schemas.validation.JsonSchemaInfo; +import org.openapijsonschematools.client.schemas.validation.ListSchemaValidator; +import org.openapijsonschematools.client.schemas.validation.PathToSchemasMap; +import org.openapijsonschematools.client.schemas.validation.ValidationMetadata; + +public class Items { + // nest classes so all schemas and input/output classes can be public + + + public static class Items2 extends MapJsonSchema.MapJsonSchema1 { + private static @Nullable Items2 instance = null; + public static Items2 getInstance() { + if (instance == null) { + instance = new Items2(); + } + return instance; + } + } + + + public static class ItemsList extends FrozenList> { + protected ItemsList(FrozenList> m) { + super(m); + } + public static ItemsList of(List> arg, SchemaConfiguration configuration) throws ValidationException { + return Items1.getInstance().validate(arg, configuration); + } + } + + public static class ItemsListBuilder { + // class to build List> + private final List> list; + + public ItemsListBuilder() { + list = new ArrayList<>(); + } + + public ItemsListBuilder(List> list) { + this.list = list; + } + + public ItemsListBuilder add(Map item) { + list.add(item); + return this; + } + + public List> build() { + return list; + } + } + + + public sealed interface Items1Boxed permits Items1BoxedList { + @Nullable Object getData(); + } + + public record Items1BoxedList(ItemsList data) implements Items1Boxed { + @Override + public @Nullable Object getData() { + return data; + } + } + + + + public static class Items1 extends JsonSchema implements ListSchemaValidator { + /* + NOTE: This class is auto generated by OpenAPI JSON Schema Generator. + Ref: https://github.com/openapi-json-schema-tools/openapi-json-schema-generator + + Do not edit the class manually. + + component's name collides with the inner schema name + */ + private static @Nullable Items1 instance = null; + + protected Items1() { + super(new JsonSchemaInfo() + .type(Set.of(List.class)) + .items(Items2.class) + ); + } + + public static Items1 getInstance() { + if (instance == null) { + instance = new Items1(); + } + return instance; + } + + @Override + public ItemsList getNewInstance(List arg, List pathToItem, PathToSchemasMap pathToSchemas) { + List> items = new ArrayList<>(); + int i = 0; + for (Object item: arg) { + List itemPathToItem = new ArrayList<>(pathToItem); + itemPathToItem.add(i); + LinkedHashMap, Nothing?> schemas = pathToSchemas.get(itemPathToItem); + if (schemas == null) { + throw new RuntimeException("Validation 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"); + } + items.add((FrozenMap) itemInstance); + i += 1; + } + FrozenList> newInstanceItems = new FrozenList<>(items); + return new ItemsList(newInstanceItems); + } + + 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); + SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().build())); + ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, new PathToSchemasMap(), new LinkedHashSet<>()); + PathToSchemasMap pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet); + return getNewInstance(castArg, validationMetadata.pathToItem(), pathToSchemasMap); + } + + @Override + public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws 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"); + } + @Override + public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { + 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"); + } + @Override + 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 { + 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"); + } + } +} diff --git a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/schemas/ItemsSchema.kt b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/schemas/ItemsSchema.kt new file mode 100644 index 00000000000..67f471d0a01 --- /dev/null +++ b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/schemas/ItemsSchema.kt @@ -0,0 +1,282 @@ +package org.openapijsonschematools.client.components.schemas; +import java.util.ArrayList; +import java.util.HashSet; +import java.util.LinkedHashMap; +import java.util.LinkedHashSet; +import java.util.List; +import java.util.Map; +import java.util.Objects; +import java.util.Set; +import org.checkerframework.checker.nullness.qual.Nullable; +import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags; +import org.openapijsonschematools.client.configurations.SchemaConfiguration; +import org.openapijsonschematools.client.exceptions.InvalidAdditionalPropertyException; +import org.openapijsonschematools.client.exceptions.UnsetPropertyException; +import org.openapijsonschematools.client.exceptions.ValidationException; +import org.openapijsonschematools.client.schemas.GenericBuilder; +import org.openapijsonschematools.client.schemas.StringJsonSchema; +import org.openapijsonschematools.client.schemas.UnsetAddPropsSetter; +import org.openapijsonschematools.client.schemas.validation.FrozenMap; +import org.openapijsonschematools.client.schemas.validation.JsonSchema; +import org.openapijsonschematools.client.schemas.validation.JsonSchemaInfo; +import org.openapijsonschematools.client.schemas.validation.MapSchemaValidator; +import org.openapijsonschematools.client.schemas.validation.PathToSchemasMap; +import org.openapijsonschematools.client.schemas.validation.PropertyEntry; +import org.openapijsonschematools.client.schemas.validation.ValidationMetadata; + +public class ItemsSchema { + // nest classes so all schemas and input/output classes can be public + + + public static class Name extends StringJsonSchema.StringJsonSchema1 { + private static @Nullable Name instance = null; + public static Name getInstance() { + if (instance == null) { + instance = new Name(); + } + return instance; + } + } + + + public static class SomeProperty extends StringJsonSchema.StringJsonSchema1 { + private static @Nullable SomeProperty instance = null; + public static SomeProperty getInstance() { + if (instance == null) { + instance = new SomeProperty(); + } + return instance; + } + } + + + public static class SecondAdditionalProperty extends StringJsonSchema.StringJsonSchema1 { + private static @Nullable SecondAdditionalProperty instance = null; + public static SecondAdditionalProperty getInstance() { + if (instance == null) { + instance = new SecondAdditionalProperty(); + } + return instance; + } + } + + + public static class ItemsSchemaMap extends FrozenMap<@Nullable Object> { + protected ItemsSchemaMap(FrozenMap<@Nullable Object> m) { + super(m); + } + public static final Set requiredKeys = Set.of(); + public static final Set optionalKeys = Set.of( + "name", + "someProperty", + "secondAdditionalProperty" + ); + public static ItemsSchemaMap of(Map arg, SchemaConfiguration configuration) throws ValidationException { + return ItemsSchema1.getInstance().validate(arg, configuration); + } + + public String name() throws UnsetPropertyException { + String key = "name"; + throwIfKeyNotPresent(key); + @Nullable Object value = get(key); + if (!(value instanceof String)) { + throw new RuntimeException("Invalid value stored for name"); + } + return (String) value; + } + + public String someProperty() throws UnsetPropertyException { + String key = "someProperty"; + throwIfKeyNotPresent(key); + @Nullable Object value = get(key); + if (!(value instanceof String)) { + throw new RuntimeException("Invalid value stored for someProperty"); + } + return (String) value; + } + + public String secondAdditionalProperty() throws UnsetPropertyException { + String key = "secondAdditionalProperty"; + throwIfKeyNotPresent(key); + @Nullable Object value = get(key); + if (!(value instanceof String)) { + throw new RuntimeException("Invalid value stored for secondAdditionalProperty"); + } + return (String) value; + } + + public @Nullable Object getAdditionalProperty(String name) throws UnsetPropertyException, InvalidAdditionalPropertyException { + throwIfKeyKnown(name, requiredKeys, optionalKeys); + throwIfKeyNotPresent(name); + return get(name); + } + } + + public interface SetterForName { + Map getInstance(); + T getBuilderAfterName(Map instance); + + default T name(String value) { + var instance = getInstance(); + instance.put("name", value); + return getBuilderAfterName(instance); + } + } + + public interface SetterForSomeProperty { + Map getInstance(); + T getBuilderAfterSomeProperty(Map instance); + + default T someProperty(String value) { + var instance = getInstance(); + instance.put("someProperty", value); + return getBuilderAfterSomeProperty(instance); + } + } + + public interface SetterForSecondAdditionalProperty { + Map getInstance(); + T getBuilderAfterSecondAdditionalProperty(Map instance); + + default T secondAdditionalProperty(String value) { + var instance = getInstance(); + instance.put("secondAdditionalProperty", value); + return getBuilderAfterSecondAdditionalProperty(instance); + } + } + + public static class ItemsSchemaMapBuilder extends UnsetAddPropsSetter implements GenericBuilder>, SetterForName, SetterForSomeProperty, SetterForSecondAdditionalProperty { + private final Map instance; + private static final Set knownKeys = Set.of( + "name", + "someProperty", + "secondAdditionalProperty" + ); + public Set getKnownKeys() { + return knownKeys; + } + public ItemsSchemaMapBuilder() { + this.instance = new LinkedHashMap<>(); + } + public Map build() { + return instance; + } + public Map getInstance() { + return instance; + } + public ItemsSchemaMapBuilder getBuilderAfterName(Map instance) { + return this; + } + public ItemsSchemaMapBuilder getBuilderAfterSomeProperty(Map instance) { + return this; + } + public ItemsSchemaMapBuilder getBuilderAfterSecondAdditionalProperty(Map instance) { + return this; + } + public ItemsSchemaMapBuilder getBuilderAfterAdditionalProperty(Map instance) { + return this; + } + } + + + public sealed interface ItemsSchema1Boxed permits ItemsSchema1BoxedMap { + @Nullable Object getData(); + } + + public record ItemsSchema1BoxedMap(ItemsSchemaMap data) implements ItemsSchema1Boxed { + @Override + public @Nullable Object getData() { + return data; + } + } + + + public static class ItemsSchema1 extends JsonSchema implements MapSchemaValidator { + /* + NOTE: This class is auto generated by OpenAPI JSON Schema Generator. + Ref: https://github.com/openapi-json-schema-tools/openapi-json-schema-generator + + Do not edit the class manually. + */ + private static @Nullable ItemsSchema1 instance = null; + + protected ItemsSchema1() { + super(new JsonSchemaInfo() + .type(Set.of(Map.class)) + .properties(Map.ofEntries( + new PropertyEntry("name", Name.class), + new PropertyEntry("someProperty", SomeProperty.class), + new PropertyEntry("secondAdditionalProperty", SecondAdditionalProperty.class) + )) + ); + } + + public static ItemsSchema1 getInstance() { + if (instance == null) { + instance = new ItemsSchema1(); + } + return instance; + } + + public ItemsSchemaMap 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 RuntimeException("Invalid non-string key value"); + } + String propertyName = (String) entryKey; + List propertyPathToItem = new ArrayList<>(pathToItem); + propertyPathToItem.add(propertyName); + Object value = entry.getValue(); + LinkedHashMap, Nothing?> schemas = pathToSchemas.get(propertyPathToItem); + if (schemas == null) { + throw new RuntimeException("Validation result is invalid, schemas must exist for a pathToItem"); + } + JsonSchema propertySchema = schemas.entrySet().iterator().next().getKey(); + @Nullable Object propertyInstance = propertySchema.getNewInstance(value, propertyPathToItem, pathToSchemas); + properties.put(propertyName, propertyInstance); + } + FrozenMap<@Nullable Object> castProperties = new FrozenMap<>(properties); + return new ItemsSchemaMap(castProperties); + } + + public ItemsSchemaMap validate(Map arg, SchemaConfiguration configuration) throws ValidationException { + Set> pathSet = new HashSet<>(); + List pathToItem = List.of("args[0"); + Map castArg = castToAllowedTypes(arg, pathToItem, pathSet); + SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().build())); + ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, new PathToSchemasMap(), new LinkedHashSet<>()); + PathToSchemasMap pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet); + return getNewInstance(castArg, validationMetadata.pathToItem(), pathToSchemasMap); + } + + + @Override + public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws 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"); + } + @Override + public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { + if (arg instanceof Map) { + return getNewInstance((Map) arg, pathToItem, pathToSchemas); + } + throw new RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); + } + @Override + public ItemsSchema1BoxedMap validateAndBox(Map arg, SchemaConfiguration configuration) throws ValidationException { + return new ItemsSchema1BoxedMap(validate(arg, configuration)); + } + @Override + public ItemsSchema1Boxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { + 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"); + } + } + +} diff --git a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/schemas/JSONPatchRequest.kt b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/schemas/JSONPatchRequest.kt new file mode 100644 index 00000000000..b1eeaf6b387 --- /dev/null +++ b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/schemas/JSONPatchRequest.kt @@ -0,0 +1,490 @@ +package org.openapijsonschematools.client.components.schemas; +import java.time.LocalDate; +import java.time.ZonedDateTime; +import java.util.ArrayList; +import java.util.HashSet; +import java.util.LinkedHashMap; +import java.util.LinkedHashSet; +import java.util.List; +import java.util.Map; +import java.util.Objects; +import java.util.Set; +import java.util.UUID; +import org.checkerframework.checker.nullness.qual.Nullable; +import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags; +import org.openapijsonschematools.client.configurations.SchemaConfiguration; +import org.openapijsonschematools.client.exceptions.InvalidAdditionalPropertyException; +import org.openapijsonschematools.client.exceptions.UnsetPropertyException; +import org.openapijsonschematools.client.exceptions.ValidationException; +import org.openapijsonschematools.client.schemas.UnsetAddPropsSetter; +import org.openapijsonschematools.client.schemas.validation.BooleanSchemaValidator; +import org.openapijsonschematools.client.schemas.validation.FrozenList; +import org.openapijsonschematools.client.schemas.validation.FrozenMap; +import org.openapijsonschematools.client.schemas.validation.JsonSchema; +import org.openapijsonschematools.client.schemas.validation.JsonSchemaInfo; +import org.openapijsonschematools.client.schemas.validation.ListSchemaValidator; +import org.openapijsonschematools.client.schemas.validation.MapSchemaValidator; +import org.openapijsonschematools.client.schemas.validation.NullSchemaValidator; +import org.openapijsonschematools.client.schemas.validation.NumberSchemaValidator; +import org.openapijsonschematools.client.schemas.validation.PathToSchemasMap; +import org.openapijsonschematools.client.schemas.validation.StringSchemaValidator; +import org.openapijsonschematools.client.schemas.validation.ValidationMetadata; + +public class JSONPatchRequest { + // nest classes so all schemas and input/output classes can be public + + + public sealed interface ItemsBoxed permits ItemsBoxedVoid, ItemsBoxedBoolean, ItemsBoxedNumber, ItemsBoxedString, ItemsBoxedList, ItemsBoxedMap { + @Nullable Object getData(); + } + + public record ItemsBoxedVoid(Nothing? data) implements ItemsBoxed { + @Override + public @Nullable Object getData() { + return data; + } + } + + public record ItemsBoxedBoolean(boolean data) implements ItemsBoxed { + @Override + public @Nullable Object getData() { + return data; + } + } + + public record ItemsBoxedNumber(Number data) implements ItemsBoxed { + @Override + public @Nullable Object getData() { + return data; + } + } + + public record ItemsBoxedString(String data) implements ItemsBoxed { + @Override + public @Nullable Object getData() { + return data; + } + } + + public record ItemsBoxedList(FrozenList<@Nullable Object> data) implements ItemsBoxed { + @Override + public @Nullable Object getData() { + return data; + } + } + + public record ItemsBoxedMap(FrozenMap<@Nullable Object> data) implements ItemsBoxed { + @Override + public @Nullable Object getData() { + return data; + } + } + + + public static class Items extends JsonSchema implements NullSchemaValidator, BooleanSchemaValidator, NumberSchemaValidator, StringSchemaValidator, ListSchemaValidator, ItemsBoxedList>, MapSchemaValidator, ItemsBoxedMap> { + private static @Nullable Items instance = null; + + protected Items() { + super(new JsonSchemaInfo() + .oneOf(List.of( + JSONPatchRequestAddReplaceTest.JSONPatchRequestAddReplaceTest1.class, + JSONPatchRequestRemove.JSONPatchRequestRemove1.class, + JSONPatchRequestMoveCopy.JSONPatchRequestMoveCopy1.class + )) + ); + } + + public static Items getInstance() { + if (instance == null) { + instance = new Items(); + } + return instance; + } + + @Override + public Nothing? validate(Nothing? arg, SchemaConfiguration configuration) throws ValidationException { + Set> pathSet = new HashSet<>(); + List pathToItem = List.of("args[0]"); + Nothing? castArg = castToAllowedTypes(arg, pathToItem, pathSet); + SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().build())); + PathToSchemasMap validatedPathToSchemas = new PathToSchemasMap(); + ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, new LinkedHashSet<>()); + getPathToSchemas(this, castArg, validationMetadata, pathSet); + return castArg; + } + + @Override + public boolean validate(boolean arg, SchemaConfiguration configuration) throws ValidationException { + Set> pathSet = new HashSet<>(); + List pathToItem = List.of("args[0]"); + boolean castArg = castToAllowedTypes(arg, pathToItem, pathSet); + SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().build())); + PathToSchemasMap validatedPathToSchemas = new PathToSchemasMap(); + ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, new LinkedHashSet<>()); + getPathToSchemas(this, castArg, validationMetadata, pathSet); + return castArg; + } + + @Override + public Number validate(Number arg, SchemaConfiguration configuration) throws ValidationException { + Set> pathSet = new HashSet<>(); + List pathToItem = List.of("args[0]"); + Number castArg = castToAllowedTypes(arg, pathToItem, pathSet); + SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().build())); + PathToSchemasMap validatedPathToSchemas = new PathToSchemasMap(); + ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, new LinkedHashSet<>()); + getPathToSchemas(this, castArg, validationMetadata, pathSet); + return castArg; + } + + public int validate(int arg, SchemaConfiguration configuration) throws ValidationException { + return (int) validate((Number) arg, configuration); + } + + public long validate(long arg, SchemaConfiguration configuration) throws ValidationException { + return (long) validate((Number) arg, configuration); + } + + public float validate(float arg, SchemaConfiguration configuration) throws ValidationException { + return (float) validate((Number) arg, configuration); + } + + public double validate(double arg, SchemaConfiguration configuration) throws ValidationException { + return (double) validate((Number) arg, configuration); + } + + @Override + public String validate(String arg, SchemaConfiguration configuration) throws ValidationException { + Set> pathSet = new HashSet<>(); + List pathToItem = List.of("args[0]"); + String castArg = castToAllowedTypes(arg, pathToItem, pathSet); + SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().build())); + PathToSchemasMap validatedPathToSchemas = new PathToSchemasMap(); + ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, new LinkedHashSet<>()); + getPathToSchemas(this, castArg, validationMetadata, pathSet); + return castArg; + } + + public String validate(LocalDate arg, SchemaConfiguration configuration) throws ValidationException { + return validate(arg.toString(), configuration); + } + + public String validate(ZonedDateTime arg, SchemaConfiguration configuration) throws ValidationException { + return validate(arg.toString(), configuration); + } + + public String validate(UUID arg, SchemaConfiguration configuration) throws ValidationException { + return validate(arg.toString(), configuration); + } + + @Override + public FrozenList<@Nullable Object> getNewInstance(List arg, List pathToItem, PathToSchemasMap pathToSchemas) { + List<@Nullable Object> items = new ArrayList<>(); + int i = 0; + for (Object item: arg) { + List itemPathToItem = new ArrayList<>(pathToItem); + itemPathToItem.add(i); + LinkedHashMap, Nothing?> schemas = pathToSchemas.get(itemPathToItem); + if (schemas == null) { + throw new RuntimeException("Validation result is invalid, schemas must exist for a pathToItem"); + } + JsonSchema itemSchema = schemas.entrySet().iterator().next().getKey(); + @Nullable Object itemInstance = itemSchema.getNewInstance(item, itemPathToItem, pathToSchemas); + items.add(itemInstance); + i += 1; + } + FrozenList<@Nullable Object> newInstanceItems = new FrozenList<>(items); + return newInstanceItems; + } + + 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); + SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().build())); + ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, new PathToSchemasMap(), new LinkedHashSet<>()); + PathToSchemasMap pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet); + return getNewInstance(castArg, validationMetadata.pathToItem(), pathToSchemasMap); + } + + @Override + 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 RuntimeException("Invalid non-string key value"); + } + String propertyName = (String) entryKey; + List propertyPathToItem = new ArrayList<>(pathToItem); + propertyPathToItem.add(propertyName); + Object value = entry.getValue(); + LinkedHashMap, Nothing?> schemas = pathToSchemas.get(propertyPathToItem); + if (schemas == null) { + throw new RuntimeException("Validation result is invalid, schemas must exist for a pathToItem"); + } + JsonSchema propertySchema = schemas.entrySet().iterator().next().getKey(); + @Nullable Object propertyInstance = propertySchema.getNewInstance(value, propertyPathToItem, pathToSchemas); + properties.put(propertyName, propertyInstance); + } + FrozenMap<@Nullable Object> castProperties = new FrozenMap<>(properties); + return castProperties; + } + + public FrozenMap<@Nullable Object> validate(Map arg, SchemaConfiguration configuration) throws ValidationException { + Set> pathSet = new HashSet<>(); + List pathToItem = List.of("args[0]"); + Map castArg = castToAllowedTypes(arg, pathToItem, pathSet); + SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().build())); + PathToSchemasMap validatedPathToSchemas = new PathToSchemasMap(); + ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, new LinkedHashSet<>()); + PathToSchemasMap pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet); + return getNewInstance(castArg, validationMetadata.pathToItem(), pathToSchemasMap); + } + + @Override + public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { + if (arg == null) { + return validate((Nothing?) null, configuration); + } else if (arg instanceof Boolean) { + boolean boolArg = (Boolean) arg; + return validate(boolArg, configuration); + } else if (arg instanceof Number) { + return validate((Number) arg, configuration); + } else if (arg instanceof String) { + return validate((String) arg, configuration); + } else if (arg instanceof List) { + return validate((List) arg, 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"); + } + @Override + public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { + if (arg == null) { + return getNewInstance((Nothing?) null, pathToItem, pathToSchemas); + } else if (arg instanceof Boolean) { + boolean boolArg = (Boolean) arg; + return getNewInstance(boolArg, pathToItem, pathToSchemas); + } else if (arg instanceof Number) { + return getNewInstance((Number) arg, pathToItem, pathToSchemas); + } else if (arg instanceof String) { + return getNewInstance((String) arg, pathToItem, pathToSchemas); + } else if (arg instanceof List) { + return getNewInstance((List) arg, 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"); + } + @Override + public ItemsBoxedVoid validateAndBox(Nothing? arg, SchemaConfiguration configuration) throws ValidationException { + return new ItemsBoxedVoid(validate(arg, configuration)); + } + @Override + 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 { + return new ItemsBoxedNumber(validate(arg, configuration)); + } + @Override + 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 { + return new ItemsBoxedList(validate(arg, configuration)); + } + @Override + 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 { + if (arg == null) { + Nothing? castArg = (Nothing?) arg; + return validateAndBox(castArg, configuration); + } else if (arg instanceof Boolean booleanArg) { + boolean castArg = booleanArg; + return validateAndBox(castArg, configuration); + } else if (arg instanceof String castArg) { + return validateAndBox(castArg, configuration); + } else if (arg instanceof Number castArg) { + return validateAndBox(castArg, configuration); + } else if (arg instanceof List castArg) { + 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"); + } + } + + 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 { + return JSONPatchRequest1.getInstance().validate(arg, configuration); + } + } + + public static class JSONPatchRequestListBuilder { + // class to build List<@Nullable Object> + private final List<@Nullable Object> list; + + public JSONPatchRequestListBuilder() { + list = new ArrayList<>(); + } + + public JSONPatchRequestListBuilder(List<@Nullable Object> list) { + this.list = list; + } + + public JSONPatchRequestListBuilder add(Nothing? item) { + list.add(null); + return this; + } + + public JSONPatchRequestListBuilder add(boolean item) { + list.add(item); + return this; + } + + public JSONPatchRequestListBuilder add(String item) { + list.add(item); + return this; + } + + public JSONPatchRequestListBuilder add(int item) { + list.add(item); + return this; + } + + public JSONPatchRequestListBuilder add(float item) { + list.add(item); + return this; + } + + public JSONPatchRequestListBuilder add(long item) { + list.add(item); + return this; + } + + public JSONPatchRequestListBuilder add(double item) { + list.add(item); + return this; + } + + public JSONPatchRequestListBuilder add(List item) { + list.add(item); + return this; + } + + public JSONPatchRequestListBuilder add(Map item) { + list.add(item); + return this; + } + + public List<@Nullable Object> build() { + return list; + } + } + + + public sealed interface JSONPatchRequest1Boxed permits JSONPatchRequest1BoxedList { + @Nullable Object getData(); + } + + public record JSONPatchRequest1BoxedList(JSONPatchRequestList data) implements JSONPatchRequest1Boxed { + @Override + public @Nullable Object getData() { + return data; + } + } + + + + public static class JSONPatchRequest1 extends JsonSchema implements ListSchemaValidator { + /* + NOTE: This class is auto generated by OpenAPI JSON Schema Generator. + Ref: https://github.com/openapi-json-schema-tools/openapi-json-schema-generator + + Do not edit the class manually. + */ + private static @Nullable JSONPatchRequest1 instance = null; + + protected JSONPatchRequest1() { + super(new JsonSchemaInfo() + .type(Set.of(List.class)) + .items(Items.class) + ); + } + + public static JSONPatchRequest1 getInstance() { + if (instance == null) { + instance = new JSONPatchRequest1(); + } + return instance; + } + + @Override + public JSONPatchRequestList getNewInstance(List arg, List pathToItem, PathToSchemasMap pathToSchemas) { + List<@Nullable Object> items = new ArrayList<>(); + int i = 0; + for (Object item: arg) { + List itemPathToItem = new ArrayList<>(pathToItem); + itemPathToItem.add(i); + LinkedHashMap, Nothing?> schemas = pathToSchemas.get(itemPathToItem); + if (schemas == null) { + throw new RuntimeException("Validation result is invalid, schemas must exist for a pathToItem"); + } + JsonSchema itemSchema = schemas.entrySet().iterator().next().getKey(); + @Nullable Object itemInstance = itemSchema.getNewInstance(item, itemPathToItem, pathToSchemas); + items.add(itemInstance); + i += 1; + } + FrozenList<@Nullable Object> newInstanceItems = new FrozenList<>(items); + return new JSONPatchRequestList(newInstanceItems); + } + + 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); + SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().build())); + ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, new PathToSchemasMap(), new LinkedHashSet<>()); + PathToSchemasMap pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet); + return getNewInstance(castArg, validationMetadata.pathToItem(), pathToSchemasMap); + } + + @Override + public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws 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"); + } + @Override + public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { + 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"); + } + @Override + 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 { + 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"); + } + } +} diff --git a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/schemas/JSONPatchRequestAddReplaceTest.kt b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/schemas/JSONPatchRequestAddReplaceTest.kt new file mode 100644 index 00000000000..d688713b3be --- /dev/null +++ b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/schemas/JSONPatchRequestAddReplaceTest.kt @@ -0,0 +1,520 @@ +package org.openapijsonschematools.client.components.schemas; +import java.util.ArrayList; +import java.util.HashSet; +import java.util.LinkedHashMap; +import java.util.LinkedHashSet; +import java.util.List; +import java.util.Map; +import java.util.Objects; +import java.util.Set; +import org.checkerframework.checker.nullness.qual.Nullable; +import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags; +import org.openapijsonschematools.client.configurations.SchemaConfiguration; +import org.openapijsonschematools.client.exceptions.UnsetPropertyException; +import org.openapijsonschematools.client.exceptions.ValidationException; +import org.openapijsonschematools.client.schemas.AnyTypeJsonSchema; +import org.openapijsonschematools.client.schemas.GenericBuilder; +import org.openapijsonschematools.client.schemas.NotAnyTypeJsonSchema; +import org.openapijsonschematools.client.schemas.SetMaker; +import org.openapijsonschematools.client.schemas.StringJsonSchema; +import org.openapijsonschematools.client.schemas.validation.FrozenMap; +import org.openapijsonschematools.client.schemas.validation.JsonSchema; +import org.openapijsonschematools.client.schemas.validation.JsonSchemaInfo; +import org.openapijsonschematools.client.schemas.validation.MapSchemaValidator; +import org.openapijsonschematools.client.schemas.validation.MapUtils; +import org.openapijsonschematools.client.schemas.validation.PathToSchemasMap; +import org.openapijsonschematools.client.schemas.validation.PropertyEntry; +import org.openapijsonschematools.client.schemas.validation.StringEnumValidator; +import org.openapijsonschematools.client.schemas.validation.StringSchemaValidator; +import org.openapijsonschematools.client.schemas.validation.StringValueMethod; +import org.openapijsonschematools.client.schemas.validation.ValidationMetadata; + +public class JSONPatchRequestAddReplaceTest { + // nest classes so all schemas and input/output classes can be public + + + public static class AdditionalProperties extends NotAnyTypeJsonSchema.NotAnyTypeJsonSchema1 { + // NotAnyTypeSchema + private static @Nullable AdditionalProperties instance = null; + public static AdditionalProperties getInstance() { + if (instance == null) { + instance = new AdditionalProperties(); + } + return instance; + } + } + + + public static class Path extends StringJsonSchema.StringJsonSchema1 { + private static @Nullable Path instance = null; + public static Path getInstance() { + if (instance == null) { + instance = new Path(); + } + return instance; + } + } + + + public static class Value extends AnyTypeJsonSchema.AnyTypeJsonSchema1 { + private static @Nullable Value instance = null; + public static Value getInstance() { + if (instance == null) { + instance = new Value(); + } + return instance; + } + } + + public enum StringOpEnums implements StringValueMethod { + ADD("add"), + REPLACE("replace"), + TEST("test"); + private final String value; + + StringOpEnums(String value) { + this.value = value; + } + public String value() { + return this.value; + } + } + + + public sealed interface OpBoxed permits OpBoxedString { + @Nullable Object getData(); + } + + public record OpBoxedString(String data) implements OpBoxed { + @Override + public @Nullable Object getData() { + return data; + } + } + + + + public static class Op extends JsonSchema implements StringSchemaValidator, StringEnumValidator { + private static @Nullable Op instance = null; + + protected Op() { + super(new JsonSchemaInfo() + .type(Set.of( + String.class + )) + .enumValues(SetMaker.makeSet( + "add", + "replace", + "test" + )) + ); + } + + public static Op getInstance() { + if (instance == null) { + instance = new Op(); + } + return instance; + } + + @Override + public String validate(String arg, SchemaConfiguration configuration) throws ValidationException { + Set> pathSet = new HashSet<>(); + List pathToItem = List.of("args[0"); + String castArg = castToAllowedTypes(arg, pathToItem, pathSet); + SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().build())); + ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, new PathToSchemasMap(), new LinkedHashSet<>()); + getPathToSchemas(this, castArg, validationMetadata, pathSet); + return castArg; + } + + @Override + 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 { + 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"); + } + @Override + public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { + 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"); + } + @Override + 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 { + 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"); + } + } + + public static class JSONPatchRequestAddReplaceTestMap extends FrozenMap<@Nullable Object> { + protected JSONPatchRequestAddReplaceTestMap(FrozenMap<@Nullable Object> m) { + super(m); + } + public static final Set requiredKeys = Set.of( + "op", + "path", + "value" + ); + public static final Set optionalKeys = Set.of(); + public static JSONPatchRequestAddReplaceTestMap of(Map arg, SchemaConfiguration configuration) throws ValidationException { + return JSONPatchRequestAddReplaceTest1.getInstance().validate(arg, configuration); + } + + public String op() { + @Nullable Object value = get("op"); + if (!(value instanceof String)) { + throw new RuntimeException("Invalid value stored for op"); + } + return (String) value; + } + + public String path() { + @Nullable Object value = get("path"); + if (!(value instanceof String)) { + throw new RuntimeException("Invalid value stored for path"); + } + return (String) value; + } + + public @Nullable Object value() { + try { + return getOrThrow("version"); + } catch (UnsetPropertyException e) { + throw new RuntimeException(e); + } + } + } + + public interface SetterForOp { + Map getInstance(); + T getBuilderAfterOp(Map instance); + + default T op(String value) { + var instance = getInstance(); + instance.put("op", value); + return getBuilderAfterOp(instance); + } + + default T op(StringOpEnums value) { + var instance = getInstance(); + instance.put("op", value.value()); + return getBuilderAfterOp(instance); + } + } + + public interface SetterForPath { + Map getInstance(); + T getBuilderAfterPath(Map instance); + + default T path(String value) { + var instance = getInstance(); + instance.put("path", value); + return getBuilderAfterPath(instance); + } + } + + public interface SetterForValue { + Map getInstance(); + T getBuilderAfterValue(Map instance); + + default T value(Nothing? value) { + var instance = getInstance(); + instance.put("value", null); + return getBuilderAfterValue(instance); + } + + default T value(boolean value) { + var instance = getInstance(); + instance.put("value", value); + return getBuilderAfterValue(instance); + } + + default T value(String value) { + var instance = getInstance(); + instance.put("value", value); + return getBuilderAfterValue(instance); + } + + default T value(int value) { + var instance = getInstance(); + instance.put("value", value); + return getBuilderAfterValue(instance); + } + + default T value(float value) { + var instance = getInstance(); + instance.put("value", value); + return getBuilderAfterValue(instance); + } + + default T value(long value) { + var instance = getInstance(); + instance.put("value", value); + return getBuilderAfterValue(instance); + } + + default T value(double value) { + var instance = getInstance(); + instance.put("value", value); + return getBuilderAfterValue(instance); + } + + default T value(List value) { + var instance = getInstance(); + instance.put("value", value); + return getBuilderAfterValue(instance); + } + + default T value(Map value) { + var instance = getInstance(); + instance.put("value", value); + return getBuilderAfterValue(instance); + } + } + + public static class JSONPatchRequestAddReplaceTestMap000Builder implements GenericBuilder> { + private final Map instance; + private static final Set knownKeys = Set.of( + "op", + "path", + "value" + ); + public Set getKnownKeys() { + return knownKeys; + } + public JSONPatchRequestAddReplaceTestMap000Builder(Map instance) { + this.instance = instance; + } + public Map build() { + return instance; + } + } + + public static class JSONPatchRequestAddReplaceTestMap001Builder implements SetterForValue { + private final Map instance; + public JSONPatchRequestAddReplaceTestMap001Builder(Map instance) { + this.instance = instance; + } + public Map getInstance() { + return instance; + } + public JSONPatchRequestAddReplaceTestMap000Builder getBuilderAfterValue(Map instance) { + return new JSONPatchRequestAddReplaceTestMap000Builder(instance); + } + } + + public static class JSONPatchRequestAddReplaceTestMap010Builder implements SetterForPath { + private final Map instance; + public JSONPatchRequestAddReplaceTestMap010Builder(Map instance) { + this.instance = instance; + } + public Map getInstance() { + return instance; + } + public JSONPatchRequestAddReplaceTestMap000Builder getBuilderAfterPath(Map instance) { + return new JSONPatchRequestAddReplaceTestMap000Builder(instance); + } + } + + public static class JSONPatchRequestAddReplaceTestMap011Builder implements SetterForPath, SetterForValue { + private final Map instance; + public JSONPatchRequestAddReplaceTestMap011Builder(Map instance) { + this.instance = instance; + } + public Map getInstance() { + return instance; + } + public JSONPatchRequestAddReplaceTestMap001Builder getBuilderAfterPath(Map instance) { + return new JSONPatchRequestAddReplaceTestMap001Builder(instance); + } + public JSONPatchRequestAddReplaceTestMap010Builder getBuilderAfterValue(Map instance) { + return new JSONPatchRequestAddReplaceTestMap010Builder(instance); + } + } + + public static class JSONPatchRequestAddReplaceTestMap100Builder implements SetterForOp { + private final Map instance; + public JSONPatchRequestAddReplaceTestMap100Builder(Map instance) { + this.instance = instance; + } + public Map getInstance() { + return instance; + } + public JSONPatchRequestAddReplaceTestMap000Builder getBuilderAfterOp(Map instance) { + return new JSONPatchRequestAddReplaceTestMap000Builder(instance); + } + } + + public static class JSONPatchRequestAddReplaceTestMap101Builder implements SetterForOp, SetterForValue { + private final Map instance; + public JSONPatchRequestAddReplaceTestMap101Builder(Map instance) { + this.instance = instance; + } + public Map getInstance() { + return instance; + } + public JSONPatchRequestAddReplaceTestMap001Builder getBuilderAfterOp(Map instance) { + return new JSONPatchRequestAddReplaceTestMap001Builder(instance); + } + public JSONPatchRequestAddReplaceTestMap100Builder getBuilderAfterValue(Map instance) { + return new JSONPatchRequestAddReplaceTestMap100Builder(instance); + } + } + + public static class JSONPatchRequestAddReplaceTestMap110Builder implements SetterForOp, SetterForPath { + private final Map instance; + public JSONPatchRequestAddReplaceTestMap110Builder(Map instance) { + this.instance = instance; + } + public Map getInstance() { + return instance; + } + public JSONPatchRequestAddReplaceTestMap010Builder getBuilderAfterOp(Map instance) { + return new JSONPatchRequestAddReplaceTestMap010Builder(instance); + } + public JSONPatchRequestAddReplaceTestMap100Builder getBuilderAfterPath(Map instance) { + return new JSONPatchRequestAddReplaceTestMap100Builder(instance); + } + } + + public static class JSONPatchRequestAddReplaceTestMapBuilder implements SetterForOp, SetterForPath, SetterForValue { + private final Map instance; + public JSONPatchRequestAddReplaceTestMapBuilder() { + this.instance = new LinkedHashMap<>(); + } + public Map getInstance() { + return instance; + } + public JSONPatchRequestAddReplaceTestMap011Builder getBuilderAfterOp(Map instance) { + return new JSONPatchRequestAddReplaceTestMap011Builder(instance); + } + public JSONPatchRequestAddReplaceTestMap101Builder getBuilderAfterPath(Map instance) { + return new JSONPatchRequestAddReplaceTestMap101Builder(instance); + } + public JSONPatchRequestAddReplaceTestMap110Builder getBuilderAfterValue(Map instance) { + return new JSONPatchRequestAddReplaceTestMap110Builder(instance); + } + } + + + public sealed interface JSONPatchRequestAddReplaceTest1Boxed permits JSONPatchRequestAddReplaceTest1BoxedMap { + @Nullable Object getData(); + } + + public record JSONPatchRequestAddReplaceTest1BoxedMap(JSONPatchRequestAddReplaceTestMap data) implements JSONPatchRequestAddReplaceTest1Boxed { + @Override + public @Nullable Object getData() { + return data; + } + } + + + public static class JSONPatchRequestAddReplaceTest1 extends JsonSchema implements MapSchemaValidator { + /* + NOTE: This class is auto generated by OpenAPI JSON Schema Generator. + Ref: https://github.com/openapi-json-schema-tools/openapi-json-schema-generator + + Do not edit the class manually. + */ + private static @Nullable JSONPatchRequestAddReplaceTest1 instance = null; + + protected JSONPatchRequestAddReplaceTest1() { + super(new JsonSchemaInfo() + .type(Set.of(Map.class)) + .properties(Map.ofEntries( + new PropertyEntry("path", Path.class), + new PropertyEntry("value", Value.class), + new PropertyEntry("op", Op.class) + )) + .required(Set.of( + "op", + "path", + "value" + )) + .additionalProperties(AdditionalProperties.class) + ); + } + + public static JSONPatchRequestAddReplaceTest1 getInstance() { + if (instance == null) { + instance = new JSONPatchRequestAddReplaceTest1(); + } + return instance; + } + + 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 RuntimeException("Invalid non-string key value"); + } + String propertyName = (String) entryKey; + List propertyPathToItem = new ArrayList<>(pathToItem); + propertyPathToItem.add(propertyName); + Object value = entry.getValue(); + LinkedHashMap, Nothing?> schemas = pathToSchemas.get(propertyPathToItem); + if (schemas == null) { + throw new RuntimeException("Validation result is invalid, schemas must exist for a pathToItem"); + } + JsonSchema propertySchema = schemas.entrySet().iterator().next().getKey(); + @Nullable Object propertyInstance = propertySchema.getNewInstance(value, propertyPathToItem, pathToSchemas); + properties.put(propertyName, propertyInstance); + } + FrozenMap<@Nullable Object> castProperties = new FrozenMap<>(properties); + return new JSONPatchRequestAddReplaceTestMap(castProperties); + } + + 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); + SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().build())); + ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, new PathToSchemasMap(), new LinkedHashSet<>()); + PathToSchemasMap pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet); + return getNewInstance(castArg, validationMetadata.pathToItem(), pathToSchemasMap); + } + + + @Override + public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws 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"); + } + @Override + public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { + if (arg instanceof Map) { + return getNewInstance((Map) arg, pathToItem, pathToSchemas); + } + 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 { + return new JSONPatchRequestAddReplaceTest1BoxedMap(validate(arg, configuration)); + } + @Override + public JSONPatchRequestAddReplaceTest1Boxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { + 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"); + } + } + +} diff --git a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/schemas/JSONPatchRequestMoveCopy.kt b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/schemas/JSONPatchRequestMoveCopy.kt new file mode 100644 index 00000000000..d5d1120067c --- /dev/null +++ b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/schemas/JSONPatchRequestMoveCopy.kt @@ -0,0 +1,473 @@ +package org.openapijsonschematools.client.components.schemas; +import java.util.ArrayList; +import java.util.HashSet; +import java.util.LinkedHashMap; +import java.util.LinkedHashSet; +import java.util.List; +import java.util.Map; +import java.util.Objects; +import java.util.Set; +import org.checkerframework.checker.nullness.qual.Nullable; +import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags; +import org.openapijsonschematools.client.configurations.SchemaConfiguration; +import org.openapijsonschematools.client.exceptions.UnsetPropertyException; +import org.openapijsonschematools.client.exceptions.ValidationException; +import org.openapijsonschematools.client.schemas.AnyTypeJsonSchema; +import org.openapijsonschematools.client.schemas.GenericBuilder; +import org.openapijsonschematools.client.schemas.NotAnyTypeJsonSchema; +import org.openapijsonschematools.client.schemas.SetMaker; +import org.openapijsonschematools.client.schemas.StringJsonSchema; +import org.openapijsonschematools.client.schemas.validation.FrozenMap; +import org.openapijsonschematools.client.schemas.validation.JsonSchema; +import org.openapijsonschematools.client.schemas.validation.JsonSchemaInfo; +import org.openapijsonschematools.client.schemas.validation.MapSchemaValidator; +import org.openapijsonschematools.client.schemas.validation.MapUtils; +import org.openapijsonschematools.client.schemas.validation.PathToSchemasMap; +import org.openapijsonschematools.client.schemas.validation.PropertyEntry; +import org.openapijsonschematools.client.schemas.validation.StringEnumValidator; +import org.openapijsonschematools.client.schemas.validation.StringSchemaValidator; +import org.openapijsonschematools.client.schemas.validation.StringValueMethod; +import org.openapijsonschematools.client.schemas.validation.ValidationMetadata; + +public class JSONPatchRequestMoveCopy { + // nest classes so all schemas and input/output classes can be public + + + public static class AdditionalProperties extends NotAnyTypeJsonSchema.NotAnyTypeJsonSchema1 { + // NotAnyTypeSchema + private static @Nullable AdditionalProperties instance = null; + public static AdditionalProperties getInstance() { + if (instance == null) { + instance = new AdditionalProperties(); + } + return instance; + } + } + + + public static class From extends StringJsonSchema.StringJsonSchema1 { + private static @Nullable From instance = null; + public static From getInstance() { + if (instance == null) { + instance = new From(); + } + return instance; + } + } + + + public static class Path extends StringJsonSchema.StringJsonSchema1 { + private static @Nullable Path instance = null; + public static Path getInstance() { + if (instance == null) { + instance = new Path(); + } + return instance; + } + } + + public enum StringOpEnums implements StringValueMethod { + MOVE("move"), + COPY("copy"); + private final String value; + + StringOpEnums(String value) { + this.value = value; + } + public String value() { + return this.value; + } + } + + + public sealed interface OpBoxed permits OpBoxedString { + @Nullable Object getData(); + } + + public record OpBoxedString(String data) implements OpBoxed { + @Override + public @Nullable Object getData() { + return data; + } + } + + + + public static class Op extends JsonSchema implements StringSchemaValidator, StringEnumValidator { + private static @Nullable Op instance = null; + + protected Op() { + super(new JsonSchemaInfo() + .type(Set.of( + String.class + )) + .enumValues(SetMaker.makeSet( + "move", + "copy" + )) + ); + } + + public static Op getInstance() { + if (instance == null) { + instance = new Op(); + } + return instance; + } + + @Override + public String validate(String arg, SchemaConfiguration configuration) throws ValidationException { + Set> pathSet = new HashSet<>(); + List pathToItem = List.of("args[0"); + String castArg = castToAllowedTypes(arg, pathToItem, pathSet); + SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().build())); + ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, new PathToSchemasMap(), new LinkedHashSet<>()); + getPathToSchemas(this, castArg, validationMetadata, pathSet); + return castArg; + } + + @Override + 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 { + 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"); + } + @Override + public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { + 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"); + } + @Override + 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 { + 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"); + } + } + + public static class JSONPatchRequestMoveCopyMap extends FrozenMap { + protected JSONPatchRequestMoveCopyMap(FrozenMap m) { + super(m); + } + public static final Set requiredKeys = Set.of( + "from", + "op", + "path" + ); + public static final Set optionalKeys = Set.of(); + public static JSONPatchRequestMoveCopyMap of(Map arg, SchemaConfiguration configuration) throws ValidationException { + return JSONPatchRequestMoveCopy1.getInstance().validate(arg, configuration); + } + + public String 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 RuntimeException("Invalid value stored for op"); + } + return (String) value; + } + + public String path() { + try { + return getOrThrow("version"); + } catch (UnsetPropertyException e) { + throw new RuntimeException(e); + } + } + } + + public interface SetterForFrom { + Map getInstance(); + T getBuilderAfterFrom(Map instance); + + default T from(String value) { + var instance = getInstance(); + instance.put("from", value); + return getBuilderAfterFrom(instance); + } + } + + public interface SetterForOp { + Map getInstance(); + T getBuilderAfterOp(Map instance); + + default T op(String value) { + var instance = getInstance(); + instance.put("op", value); + return getBuilderAfterOp(instance); + } + + default T op(StringOpEnums value) { + var instance = getInstance(); + instance.put("op", value.value()); + return getBuilderAfterOp(instance); + } + } + + public interface SetterForPath { + Map getInstance(); + T getBuilderAfterPath(Map instance); + + default T path(String value) { + var instance = getInstance(); + instance.put("path", value); + return getBuilderAfterPath(instance); + } + } + + public static class JSONPatchRequestMoveCopyMap000Builder implements GenericBuilder> { + private final Map instance; + private static final Set knownKeys = Set.of( + "from", + "op", + "path" + ); + public Set getKnownKeys() { + return knownKeys; + } + public JSONPatchRequestMoveCopyMap000Builder(Map instance) { + this.instance = instance; + } + public Map build() { + return instance; + } + } + + public static class JSONPatchRequestMoveCopyMap001Builder implements SetterForPath { + private final Map instance; + public JSONPatchRequestMoveCopyMap001Builder(Map instance) { + this.instance = instance; + } + public Map getInstance() { + return instance; + } + public JSONPatchRequestMoveCopyMap000Builder getBuilderAfterPath(Map instance) { + return new JSONPatchRequestMoveCopyMap000Builder(instance); + } + } + + public static class JSONPatchRequestMoveCopyMap010Builder implements SetterForOp { + private final Map instance; + public JSONPatchRequestMoveCopyMap010Builder(Map instance) { + this.instance = instance; + } + public Map getInstance() { + return instance; + } + public JSONPatchRequestMoveCopyMap000Builder getBuilderAfterOp(Map instance) { + return new JSONPatchRequestMoveCopyMap000Builder(instance); + } + } + + public static class JSONPatchRequestMoveCopyMap011Builder implements SetterForOp, SetterForPath { + private final Map instance; + public JSONPatchRequestMoveCopyMap011Builder(Map instance) { + this.instance = instance; + } + public Map getInstance() { + return instance; + } + public JSONPatchRequestMoveCopyMap001Builder getBuilderAfterOp(Map instance) { + return new JSONPatchRequestMoveCopyMap001Builder(instance); + } + public JSONPatchRequestMoveCopyMap010Builder getBuilderAfterPath(Map instance) { + return new JSONPatchRequestMoveCopyMap010Builder(instance); + } + } + + public static class JSONPatchRequestMoveCopyMap100Builder implements SetterForFrom { + private final Map instance; + public JSONPatchRequestMoveCopyMap100Builder(Map instance) { + this.instance = instance; + } + public Map getInstance() { + return instance; + } + public JSONPatchRequestMoveCopyMap000Builder getBuilderAfterFrom(Map instance) { + return new JSONPatchRequestMoveCopyMap000Builder(instance); + } + } + + public static class JSONPatchRequestMoveCopyMap101Builder implements SetterForFrom, SetterForPath { + private final Map instance; + public JSONPatchRequestMoveCopyMap101Builder(Map instance) { + this.instance = instance; + } + public Map getInstance() { + return instance; + } + public JSONPatchRequestMoveCopyMap001Builder getBuilderAfterFrom(Map instance) { + return new JSONPatchRequestMoveCopyMap001Builder(instance); + } + public JSONPatchRequestMoveCopyMap100Builder getBuilderAfterPath(Map instance) { + return new JSONPatchRequestMoveCopyMap100Builder(instance); + } + } + + public static class JSONPatchRequestMoveCopyMap110Builder implements SetterForFrom, SetterForOp { + private final Map instance; + public JSONPatchRequestMoveCopyMap110Builder(Map instance) { + this.instance = instance; + } + public Map getInstance() { + return instance; + } + public JSONPatchRequestMoveCopyMap010Builder getBuilderAfterFrom(Map instance) { + return new JSONPatchRequestMoveCopyMap010Builder(instance); + } + public JSONPatchRequestMoveCopyMap100Builder getBuilderAfterOp(Map instance) { + return new JSONPatchRequestMoveCopyMap100Builder(instance); + } + } + + public static class JSONPatchRequestMoveCopyMapBuilder implements SetterForFrom, SetterForOp, SetterForPath { + private final Map instance; + public JSONPatchRequestMoveCopyMapBuilder() { + this.instance = new LinkedHashMap<>(); + } + public Map getInstance() { + return instance; + } + public JSONPatchRequestMoveCopyMap011Builder getBuilderAfterFrom(Map instance) { + return new JSONPatchRequestMoveCopyMap011Builder(instance); + } + public JSONPatchRequestMoveCopyMap101Builder getBuilderAfterOp(Map instance) { + return new JSONPatchRequestMoveCopyMap101Builder(instance); + } + public JSONPatchRequestMoveCopyMap110Builder getBuilderAfterPath(Map instance) { + return new JSONPatchRequestMoveCopyMap110Builder(instance); + } + } + + + public sealed interface JSONPatchRequestMoveCopy1Boxed permits JSONPatchRequestMoveCopy1BoxedMap { + @Nullable Object getData(); + } + + public record JSONPatchRequestMoveCopy1BoxedMap(JSONPatchRequestMoveCopyMap data) implements JSONPatchRequestMoveCopy1Boxed { + @Override + public @Nullable Object getData() { + return data; + } + } + + + public static class JSONPatchRequestMoveCopy1 extends JsonSchema implements MapSchemaValidator { + /* + NOTE: This class is auto generated by OpenAPI JSON Schema Generator. + Ref: https://github.com/openapi-json-schema-tools/openapi-json-schema-generator + + Do not edit the class manually. + */ + private static @Nullable JSONPatchRequestMoveCopy1 instance = null; + + protected JSONPatchRequestMoveCopy1() { + super(new JsonSchemaInfo() + .type(Set.of(Map.class)) + .properties(Map.ofEntries( + new PropertyEntry("from", From.class), + new PropertyEntry("path", Path.class), + new PropertyEntry("op", Op.class) + )) + .required(Set.of( + "from", + "op", + "path" + )) + .additionalProperties(AdditionalProperties.class) + ); + } + + public static JSONPatchRequestMoveCopy1 getInstance() { + if (instance == null) { + instance = new JSONPatchRequestMoveCopy1(); + } + return instance; + } + + 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 RuntimeException("Invalid non-string key value"); + } + String propertyName = (String) entryKey; + List propertyPathToItem = new ArrayList<>(pathToItem); + propertyPathToItem.add(propertyName); + Object value = entry.getValue(); + LinkedHashMap, Nothing?> schemas = pathToSchemas.get(propertyPathToItem); + if (schemas == null) { + throw new RuntimeException("Validation 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"); + } + properties.put(propertyName, (String) propertyInstance); + } + FrozenMap castProperties = new FrozenMap<>(properties); + return new JSONPatchRequestMoveCopyMap(castProperties); + } + + 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); + SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().build())); + ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, new PathToSchemasMap(), new LinkedHashSet<>()); + PathToSchemasMap pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet); + return getNewInstance(castArg, validationMetadata.pathToItem(), pathToSchemasMap); + } + + + @Override + public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws 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"); + } + @Override + public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { + if (arg instanceof Map) { + return getNewInstance((Map) arg, pathToItem, pathToSchemas); + } + 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 { + return new JSONPatchRequestMoveCopy1BoxedMap(validate(arg, configuration)); + } + @Override + public JSONPatchRequestMoveCopy1Boxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { + 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"); + } + } + +} diff --git a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/schemas/JSONPatchRequestRemove.kt b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/schemas/JSONPatchRequestRemove.kt new file mode 100644 index 00000000000..fabeec56091 --- /dev/null +++ b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/schemas/JSONPatchRequestRemove.kt @@ -0,0 +1,373 @@ +package org.openapijsonschematools.client.components.schemas; +import java.util.ArrayList; +import java.util.HashSet; +import java.util.LinkedHashMap; +import java.util.LinkedHashSet; +import java.util.List; +import java.util.Map; +import java.util.Objects; +import java.util.Set; +import org.checkerframework.checker.nullness.qual.Nullable; +import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags; +import org.openapijsonschematools.client.configurations.SchemaConfiguration; +import org.openapijsonschematools.client.exceptions.UnsetPropertyException; +import org.openapijsonschematools.client.exceptions.ValidationException; +import org.openapijsonschematools.client.schemas.AnyTypeJsonSchema; +import org.openapijsonschematools.client.schemas.GenericBuilder; +import org.openapijsonschematools.client.schemas.NotAnyTypeJsonSchema; +import org.openapijsonschematools.client.schemas.SetMaker; +import org.openapijsonschematools.client.schemas.StringJsonSchema; +import org.openapijsonschematools.client.schemas.validation.FrozenMap; +import org.openapijsonschematools.client.schemas.validation.JsonSchema; +import org.openapijsonschematools.client.schemas.validation.JsonSchemaInfo; +import org.openapijsonschematools.client.schemas.validation.MapSchemaValidator; +import org.openapijsonschematools.client.schemas.validation.MapUtils; +import org.openapijsonschematools.client.schemas.validation.PathToSchemasMap; +import org.openapijsonschematools.client.schemas.validation.PropertyEntry; +import org.openapijsonschematools.client.schemas.validation.StringEnumValidator; +import org.openapijsonschematools.client.schemas.validation.StringSchemaValidator; +import org.openapijsonschematools.client.schemas.validation.StringValueMethod; +import org.openapijsonschematools.client.schemas.validation.ValidationMetadata; + +public class JSONPatchRequestRemove { + // nest classes so all schemas and input/output classes can be public + + + public static class AdditionalProperties extends NotAnyTypeJsonSchema.NotAnyTypeJsonSchema1 { + // NotAnyTypeSchema + private static @Nullable AdditionalProperties instance = null; + public static AdditionalProperties getInstance() { + if (instance == null) { + instance = new AdditionalProperties(); + } + return instance; + } + } + + + public static class Path extends StringJsonSchema.StringJsonSchema1 { + private static @Nullable Path instance = null; + public static Path getInstance() { + if (instance == null) { + instance = new Path(); + } + return instance; + } + } + + public enum StringOpEnums implements StringValueMethod { + REMOVE("remove"); + private final String value; + + StringOpEnums(String value) { + this.value = value; + } + public String value() { + return this.value; + } + } + + + public sealed interface OpBoxed permits OpBoxedString { + @Nullable Object getData(); + } + + public record OpBoxedString(String data) implements OpBoxed { + @Override + public @Nullable Object getData() { + return data; + } + } + + + + public static class Op extends JsonSchema implements StringSchemaValidator, StringEnumValidator { + private static @Nullable Op instance = null; + + protected Op() { + super(new JsonSchemaInfo() + .type(Set.of( + String.class + )) + .enumValues(SetMaker.makeSet( + "remove" + )) + ); + } + + public static Op getInstance() { + if (instance == null) { + instance = new Op(); + } + return instance; + } + + @Override + public String validate(String arg, SchemaConfiguration configuration) throws ValidationException { + Set> pathSet = new HashSet<>(); + List pathToItem = List.of("args[0"); + String castArg = castToAllowedTypes(arg, pathToItem, pathSet); + SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().build())); + ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, new PathToSchemasMap(), new LinkedHashSet<>()); + getPathToSchemas(this, castArg, validationMetadata, pathSet); + return castArg; + } + + @Override + 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 { + 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"); + } + @Override + public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { + 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"); + } + @Override + 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 { + 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"); + } + } + + public static class JSONPatchRequestRemoveMap extends FrozenMap { + protected JSONPatchRequestRemoveMap(FrozenMap m) { + super(m); + } + public static final Set requiredKeys = Set.of( + "op", + "path" + ); + public static final Set optionalKeys = Set.of(); + public static JSONPatchRequestRemoveMap of(Map arg, SchemaConfiguration configuration) throws ValidationException { + return JSONPatchRequestRemove1.getInstance().validate(arg, configuration); + } + + public String op() { + String value = get("op"); + if (!(value instanceof String)) { + throw new RuntimeException("Invalid value stored for op"); + } + return (String) value; + } + + public String path() { + try { + return getOrThrow("version"); + } catch (UnsetPropertyException e) { + throw new RuntimeException(e); + } + } + } + + public interface SetterForOp { + Map getInstance(); + T getBuilderAfterOp(Map instance); + + default T op(String value) { + var instance = getInstance(); + instance.put("op", value); + return getBuilderAfterOp(instance); + } + + default T op(StringOpEnums value) { + var instance = getInstance(); + instance.put("op", value.value()); + return getBuilderAfterOp(instance); + } + } + + public interface SetterForPath { + Map getInstance(); + T getBuilderAfterPath(Map instance); + + default T path(String value) { + var instance = getInstance(); + instance.put("path", value); + return getBuilderAfterPath(instance); + } + } + + public static class JSONPatchRequestRemoveMap00Builder implements GenericBuilder> { + private final Map instance; + private static final Set knownKeys = Set.of( + "op", + "path" + ); + public Set getKnownKeys() { + return knownKeys; + } + public JSONPatchRequestRemoveMap00Builder(Map instance) { + this.instance = instance; + } + public Map build() { + return instance; + } + } + + public static class JSONPatchRequestRemoveMap01Builder implements SetterForPath { + private final Map instance; + public JSONPatchRequestRemoveMap01Builder(Map instance) { + this.instance = instance; + } + public Map getInstance() { + return instance; + } + public JSONPatchRequestRemoveMap00Builder getBuilderAfterPath(Map instance) { + return new JSONPatchRequestRemoveMap00Builder(instance); + } + } + + public static class JSONPatchRequestRemoveMap10Builder implements SetterForOp { + private final Map instance; + public JSONPatchRequestRemoveMap10Builder(Map instance) { + this.instance = instance; + } + public Map getInstance() { + return instance; + } + public JSONPatchRequestRemoveMap00Builder getBuilderAfterOp(Map instance) { + return new JSONPatchRequestRemoveMap00Builder(instance); + } + } + + public static class JSONPatchRequestRemoveMapBuilder implements SetterForOp, SetterForPath { + private final Map instance; + public JSONPatchRequestRemoveMapBuilder() { + this.instance = new LinkedHashMap<>(); + } + public Map getInstance() { + return instance; + } + public JSONPatchRequestRemoveMap01Builder getBuilderAfterOp(Map instance) { + return new JSONPatchRequestRemoveMap01Builder(instance); + } + public JSONPatchRequestRemoveMap10Builder getBuilderAfterPath(Map instance) { + return new JSONPatchRequestRemoveMap10Builder(instance); + } + } + + + public sealed interface JSONPatchRequestRemove1Boxed permits JSONPatchRequestRemove1BoxedMap { + @Nullable Object getData(); + } + + public record JSONPatchRequestRemove1BoxedMap(JSONPatchRequestRemoveMap data) implements JSONPatchRequestRemove1Boxed { + @Override + public @Nullable Object getData() { + return data; + } + } + + + public static class JSONPatchRequestRemove1 extends JsonSchema implements MapSchemaValidator { + /* + NOTE: This class is auto generated by OpenAPI JSON Schema Generator. + Ref: https://github.com/openapi-json-schema-tools/openapi-json-schema-generator + + Do not edit the class manually. + */ + private static @Nullable JSONPatchRequestRemove1 instance = null; + + protected JSONPatchRequestRemove1() { + super(new JsonSchemaInfo() + .type(Set.of(Map.class)) + .properties(Map.ofEntries( + new PropertyEntry("path", Path.class), + new PropertyEntry("op", Op.class) + )) + .required(Set.of( + "op", + "path" + )) + .additionalProperties(AdditionalProperties.class) + ); + } + + public static JSONPatchRequestRemove1 getInstance() { + if (instance == null) { + instance = new JSONPatchRequestRemove1(); + } + return instance; + } + + 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 RuntimeException("Invalid non-string key value"); + } + String propertyName = (String) entryKey; + List propertyPathToItem = new ArrayList<>(pathToItem); + propertyPathToItem.add(propertyName); + Object value = entry.getValue(); + LinkedHashMap, Nothing?> schemas = pathToSchemas.get(propertyPathToItem); + if (schemas == null) { + throw new RuntimeException("Validation 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"); + } + properties.put(propertyName, (String) propertyInstance); + } + FrozenMap castProperties = new FrozenMap<>(properties); + return new JSONPatchRequestRemoveMap(castProperties); + } + + 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); + SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().build())); + ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, new PathToSchemasMap(), new LinkedHashSet<>()); + PathToSchemasMap pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet); + return getNewInstance(castArg, validationMetadata.pathToItem(), pathToSchemasMap); + } + + + @Override + public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws 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"); + } + @Override + public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { + if (arg instanceof Map) { + return getNewInstance((Map) arg, pathToItem, pathToSchemas); + } + 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 { + return new JSONPatchRequestRemove1BoxedMap(validate(arg, configuration)); + } + @Override + public JSONPatchRequestRemove1Boxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { + 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"); + } + } + +} diff --git a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/schemas/Mammal.kt b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/schemas/Mammal.kt new file mode 100644 index 00000000000..cdb9adce4a4 --- /dev/null +++ b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/schemas/Mammal.kt @@ -0,0 +1,331 @@ +package org.openapijsonschematools.client.components.schemas; +import java.time.LocalDate; +import java.time.ZonedDateTime; +import java.util.ArrayList; +import java.util.HashSet; +import java.util.LinkedHashMap; +import java.util.LinkedHashSet; +import java.util.List; +import java.util.Map; +import java.util.Objects; +import java.util.Set; +import java.util.UUID; +import org.checkerframework.checker.nullness.qual.Nullable; +import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags; +import org.openapijsonschematools.client.configurations.SchemaConfiguration; +import org.openapijsonschematools.client.exceptions.InvalidAdditionalPropertyException; +import org.openapijsonschematools.client.exceptions.UnsetPropertyException; +import org.openapijsonschematools.client.exceptions.ValidationException; +import org.openapijsonschematools.client.schemas.UnsetAddPropsSetter; +import org.openapijsonschematools.client.schemas.validation.BooleanSchemaValidator; +import org.openapijsonschematools.client.schemas.validation.FrozenList; +import org.openapijsonschematools.client.schemas.validation.FrozenMap; +import org.openapijsonschematools.client.schemas.validation.JsonSchema; +import org.openapijsonschematools.client.schemas.validation.JsonSchemaInfo; +import org.openapijsonschematools.client.schemas.validation.ListSchemaValidator; +import org.openapijsonschematools.client.schemas.validation.MapSchemaValidator; +import org.openapijsonschematools.client.schemas.validation.NullSchemaValidator; +import org.openapijsonschematools.client.schemas.validation.NumberSchemaValidator; +import org.openapijsonschematools.client.schemas.validation.PathToSchemasMap; +import org.openapijsonschematools.client.schemas.validation.StringSchemaValidator; +import org.openapijsonschematools.client.schemas.validation.ValidationMetadata; + +public class Mammal { + // nest classes so all schemas and input/output classes can be public + + + public sealed interface Mammal1Boxed permits Mammal1BoxedVoid, Mammal1BoxedBoolean, Mammal1BoxedNumber, Mammal1BoxedString, Mammal1BoxedList, Mammal1BoxedMap { + @Nullable Object getData(); + } + + public record Mammal1BoxedVoid(Nothing? data) implements Mammal1Boxed { + @Override + public @Nullable Object getData() { + return data; + } + } + + public record Mammal1BoxedBoolean(boolean data) implements Mammal1Boxed { + @Override + public @Nullable Object getData() { + return data; + } + } + + public record Mammal1BoxedNumber(Number data) implements Mammal1Boxed { + @Override + public @Nullable Object getData() { + return data; + } + } + + public record Mammal1BoxedString(String data) implements Mammal1Boxed { + @Override + public @Nullable Object getData() { + return data; + } + } + + public record Mammal1BoxedList(FrozenList<@Nullable Object> data) implements Mammal1Boxed { + @Override + public @Nullable Object getData() { + return data; + } + } + + public record Mammal1BoxedMap(FrozenMap<@Nullable Object> data) implements Mammal1Boxed { + @Override + public @Nullable Object getData() { + return data; + } + } + + + public static class Mammal1 extends JsonSchema implements NullSchemaValidator, BooleanSchemaValidator, NumberSchemaValidator, StringSchemaValidator, ListSchemaValidator, Mammal1BoxedList>, MapSchemaValidator, Mammal1BoxedMap> { + /* + NOTE: This class is auto generated by OpenAPI JSON Schema Generator. + Ref: https://github.com/openapi-json-schema-tools/openapi-json-schema-generator + + Do not edit the class manually. + */ + private static @Nullable Mammal1 instance = null; + + protected Mammal1() { + super(new JsonSchemaInfo() + .oneOf(List.of( + Whale.Whale1.class, + Zebra.Zebra1.class, + Pig.Pig1.class + )) + ); + } + + public static Mammal1 getInstance() { + if (instance == null) { + instance = new Mammal1(); + } + return instance; + } + + @Override + public Nothing? validate(Nothing? arg, SchemaConfiguration configuration) throws ValidationException { + Set> pathSet = new HashSet<>(); + List pathToItem = List.of("args[0]"); + Nothing? castArg = castToAllowedTypes(arg, pathToItem, pathSet); + SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().build())); + PathToSchemasMap validatedPathToSchemas = new PathToSchemasMap(); + ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, new LinkedHashSet<>()); + getPathToSchemas(this, castArg, validationMetadata, pathSet); + return castArg; + } + + @Override + public boolean validate(boolean arg, SchemaConfiguration configuration) throws ValidationException { + Set> pathSet = new HashSet<>(); + List pathToItem = List.of("args[0]"); + boolean castArg = castToAllowedTypes(arg, pathToItem, pathSet); + SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().build())); + PathToSchemasMap validatedPathToSchemas = new PathToSchemasMap(); + ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, new LinkedHashSet<>()); + getPathToSchemas(this, castArg, validationMetadata, pathSet); + return castArg; + } + + @Override + public Number validate(Number arg, SchemaConfiguration configuration) throws ValidationException { + Set> pathSet = new HashSet<>(); + List pathToItem = List.of("args[0]"); + Number castArg = castToAllowedTypes(arg, pathToItem, pathSet); + SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().build())); + PathToSchemasMap validatedPathToSchemas = new PathToSchemasMap(); + ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, new LinkedHashSet<>()); + getPathToSchemas(this, castArg, validationMetadata, pathSet); + return castArg; + } + + public int validate(int arg, SchemaConfiguration configuration) throws ValidationException { + return (int) validate((Number) arg, configuration); + } + + public long validate(long arg, SchemaConfiguration configuration) throws ValidationException { + return (long) validate((Number) arg, configuration); + } + + public float validate(float arg, SchemaConfiguration configuration) throws ValidationException { + return (float) validate((Number) arg, configuration); + } + + public double validate(double arg, SchemaConfiguration configuration) throws ValidationException { + return (double) validate((Number) arg, configuration); + } + + @Override + public String validate(String arg, SchemaConfiguration configuration) throws ValidationException { + Set> pathSet = new HashSet<>(); + List pathToItem = List.of("args[0]"); + String castArg = castToAllowedTypes(arg, pathToItem, pathSet); + SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().build())); + PathToSchemasMap validatedPathToSchemas = new PathToSchemasMap(); + ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, new LinkedHashSet<>()); + getPathToSchemas(this, castArg, validationMetadata, pathSet); + return castArg; + } + + public String validate(LocalDate arg, SchemaConfiguration configuration) throws ValidationException { + return validate(arg.toString(), configuration); + } + + public String validate(ZonedDateTime arg, SchemaConfiguration configuration) throws ValidationException { + return validate(arg.toString(), configuration); + } + + public String validate(UUID arg, SchemaConfiguration configuration) throws ValidationException { + return validate(arg.toString(), configuration); + } + + @Override + public FrozenList<@Nullable Object> getNewInstance(List arg, List pathToItem, PathToSchemasMap pathToSchemas) { + List<@Nullable Object> items = new ArrayList<>(); + int i = 0; + for (Object item: arg) { + List itemPathToItem = new ArrayList<>(pathToItem); + itemPathToItem.add(i); + LinkedHashMap, Nothing?> schemas = pathToSchemas.get(itemPathToItem); + if (schemas == null) { + throw new RuntimeException("Validation result is invalid, schemas must exist for a pathToItem"); + } + JsonSchema itemSchema = schemas.entrySet().iterator().next().getKey(); + @Nullable Object itemInstance = itemSchema.getNewInstance(item, itemPathToItem, pathToSchemas); + items.add(itemInstance); + i += 1; + } + FrozenList<@Nullable Object> newInstanceItems = new FrozenList<>(items); + return newInstanceItems; + } + + 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); + SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().build())); + ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, new PathToSchemasMap(), new LinkedHashSet<>()); + PathToSchemasMap pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet); + return getNewInstance(castArg, validationMetadata.pathToItem(), pathToSchemasMap); + } + + @Override + 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 RuntimeException("Invalid non-string key value"); + } + String propertyName = (String) entryKey; + List propertyPathToItem = new ArrayList<>(pathToItem); + propertyPathToItem.add(propertyName); + Object value = entry.getValue(); + LinkedHashMap, Nothing?> schemas = pathToSchemas.get(propertyPathToItem); + if (schemas == null) { + throw new RuntimeException("Validation result is invalid, schemas must exist for a pathToItem"); + } + JsonSchema propertySchema = schemas.entrySet().iterator().next().getKey(); + @Nullable Object propertyInstance = propertySchema.getNewInstance(value, propertyPathToItem, pathToSchemas); + properties.put(propertyName, propertyInstance); + } + FrozenMap<@Nullable Object> castProperties = new FrozenMap<>(properties); + return castProperties; + } + + public FrozenMap<@Nullable Object> validate(Map arg, SchemaConfiguration configuration) throws ValidationException { + Set> pathSet = new HashSet<>(); + List pathToItem = List.of("args[0]"); + Map castArg = castToAllowedTypes(arg, pathToItem, pathSet); + SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().build())); + PathToSchemasMap validatedPathToSchemas = new PathToSchemasMap(); + ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, new LinkedHashSet<>()); + PathToSchemasMap pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet); + return getNewInstance(castArg, validationMetadata.pathToItem(), pathToSchemasMap); + } + + @Override + public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { + if (arg == null) { + return validate((Nothing?) null, configuration); + } else if (arg instanceof Boolean) { + boolean boolArg = (Boolean) arg; + return validate(boolArg, configuration); + } else if (arg instanceof Number) { + return validate((Number) arg, configuration); + } else if (arg instanceof String) { + return validate((String) arg, configuration); + } else if (arg instanceof List) { + return validate((List) arg, 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"); + } + @Override + public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { + if (arg == null) { + return getNewInstance((Nothing?) null, pathToItem, pathToSchemas); + } else if (arg instanceof Boolean) { + boolean boolArg = (Boolean) arg; + return getNewInstance(boolArg, pathToItem, pathToSchemas); + } else if (arg instanceof Number) { + return getNewInstance((Number) arg, pathToItem, pathToSchemas); + } else if (arg instanceof String) { + return getNewInstance((String) arg, pathToItem, pathToSchemas); + } else if (arg instanceof List) { + return getNewInstance((List) arg, 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"); + } + @Override + public Mammal1BoxedVoid validateAndBox(Nothing? arg, SchemaConfiguration configuration) throws ValidationException { + return new Mammal1BoxedVoid(validate(arg, configuration)); + } + @Override + 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 { + return new Mammal1BoxedNumber(validate(arg, configuration)); + } + @Override + 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 { + return new Mammal1BoxedList(validate(arg, configuration)); + } + @Override + 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 { + if (arg == null) { + Nothing? castArg = (Nothing?) arg; + return validateAndBox(castArg, configuration); + } else if (arg instanceof Boolean booleanArg) { + boolean castArg = booleanArg; + return validateAndBox(castArg, configuration); + } else if (arg instanceof String castArg) { + return validateAndBox(castArg, configuration); + } else if (arg instanceof Number castArg) { + return validateAndBox(castArg, configuration); + } else if (arg instanceof List castArg) { + 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"); + } + } +} diff --git a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/schemas/MapTest.kt b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/schemas/MapTest.kt new file mode 100644 index 00000000000..cd5f0d6fa5c --- /dev/null +++ b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/schemas/MapTest.kt @@ -0,0 +1,979 @@ +package org.openapijsonschematools.client.components.schemas; +import java.util.ArrayList; +import java.util.HashSet; +import java.util.LinkedHashMap; +import java.util.LinkedHashSet; +import java.util.List; +import java.util.Map; +import java.util.Objects; +import java.util.Set; +import org.checkerframework.checker.nullness.qual.Nullable; +import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags; +import org.openapijsonschematools.client.configurations.SchemaConfiguration; +import org.openapijsonschematools.client.exceptions.InvalidAdditionalPropertyException; +import org.openapijsonschematools.client.exceptions.UnsetPropertyException; +import org.openapijsonschematools.client.exceptions.ValidationException; +import org.openapijsonschematools.client.schemas.BooleanJsonSchema; +import org.openapijsonschematools.client.schemas.GenericBuilder; +import org.openapijsonschematools.client.schemas.SetMaker; +import org.openapijsonschematools.client.schemas.StringJsonSchema; +import org.openapijsonschematools.client.schemas.UnsetAddPropsSetter; +import org.openapijsonschematools.client.schemas.validation.FrozenMap; +import org.openapijsonschematools.client.schemas.validation.JsonSchema; +import org.openapijsonschematools.client.schemas.validation.JsonSchemaInfo; +import org.openapijsonschematools.client.schemas.validation.MapSchemaValidator; +import org.openapijsonschematools.client.schemas.validation.MapUtils; +import org.openapijsonschematools.client.schemas.validation.PathToSchemasMap; +import org.openapijsonschematools.client.schemas.validation.PropertyEntry; +import org.openapijsonschematools.client.schemas.validation.StringEnumValidator; +import org.openapijsonschematools.client.schemas.validation.StringSchemaValidator; +import org.openapijsonschematools.client.schemas.validation.StringValueMethod; +import org.openapijsonschematools.client.schemas.validation.ValidationMetadata; + +public class MapTest { + // nest classes so all schemas and input/output classes can be public + + + public static class AdditionalProperties1 extends StringJsonSchema.StringJsonSchema1 { + private static @Nullable AdditionalProperties1 instance = null; + public static AdditionalProperties1 getInstance() { + if (instance == null) { + instance = new AdditionalProperties1(); + } + return instance; + } + } + + + public static class AdditionalPropertiesMap extends FrozenMap { + protected AdditionalPropertiesMap(FrozenMap m) { + super(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 { + return AdditionalProperties.getInstance().validate(arg, configuration); + } + + public String getAdditionalProperty(String name) throws UnsetPropertyException { + return getOrThrow(name); + } + } + + public interface SetterForAdditionalProperties1 { + Set getKnownKeys(); + Map getInstance(); + T getBuilderAfterAdditionalProperty(Map instance); + + default T additionalProperty(String key, String value) throws InvalidAdditionalPropertyException { + MapUtils.throwIfKeyKnown(key, getKnownKeys(), true); + var instance = getInstance(); + instance.put(key, value); + return getBuilderAfterAdditionalProperty(instance); + } + } + + public static class AdditionalPropertiesMapBuilder1 implements GenericBuilder>, SetterForAdditionalProperties1 { + private final Map instance; + private static final Set knownKeys = Set.of(); + public Set getKnownKeys() { + return knownKeys; + } + public AdditionalPropertiesMapBuilder1() { + this.instance = new LinkedHashMap<>(); + } + public Map build() { + return instance; + } + public Map getInstance() { + return instance; + } + public AdditionalPropertiesMapBuilder1 getBuilderAfterAdditionalProperty(Map instance) { + return this; + } + } + + + public sealed interface AdditionalPropertiesBoxed permits AdditionalPropertiesBoxedMap { + @Nullable Object getData(); + } + + public record AdditionalPropertiesBoxedMap(AdditionalPropertiesMap data) implements AdditionalPropertiesBoxed { + @Override + public @Nullable Object getData() { + return data; + } + } + + + public static class AdditionalProperties extends JsonSchema implements MapSchemaValidator { + private static @Nullable AdditionalProperties instance = null; + + protected AdditionalProperties() { + super(new JsonSchemaInfo() + .type(Set.of(Map.class)) + .additionalProperties(AdditionalProperties1.class) + ); + } + + public static AdditionalProperties getInstance() { + if (instance == null) { + instance = new AdditionalProperties(); + } + return instance; + } + + 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 RuntimeException("Invalid non-string key value"); + } + String propertyName = (String) entryKey; + List propertyPathToItem = new ArrayList<>(pathToItem); + propertyPathToItem.add(propertyName); + Object value = entry.getValue(); + LinkedHashMap, Nothing?> schemas = pathToSchemas.get(propertyPathToItem); + if (schemas == null) { + throw new RuntimeException("Validation 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"); + } + properties.put(propertyName, (String) propertyInstance); + } + FrozenMap castProperties = new FrozenMap<>(properties); + return new AdditionalPropertiesMap(castProperties); + } + + 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); + SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().build())); + ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, new PathToSchemasMap(), new LinkedHashSet<>()); + PathToSchemasMap pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet); + return getNewInstance(castArg, validationMetadata.pathToItem(), pathToSchemasMap); + } + + + @Override + public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws 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"); + } + @Override + public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { + if (arg instanceof Map) { + return getNewInstance((Map) arg, pathToItem, pathToSchemas); + } + 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 { + return new AdditionalPropertiesBoxedMap(validate(arg, configuration)); + } + @Override + public AdditionalPropertiesBoxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { + 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"); + } + } + + + public static class MapMapOfStringMap extends FrozenMap { + protected MapMapOfStringMap(FrozenMap m) { + super(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 { + return MapMapOfString.getInstance().validate(arg, configuration); + } + + public AdditionalPropertiesMap getAdditionalProperty(String name) throws UnsetPropertyException { + return getOrThrow(name); + } + } + + public interface SetterForAdditionalProperties { + Set getKnownKeys(); + Map> getInstance(); + T getBuilderAfterAdditionalProperty(Map> instance); + + default T additionalProperty(String key, Map value) throws InvalidAdditionalPropertyException { + MapUtils.throwIfKeyKnown(key, getKnownKeys(), true); + var instance = getInstance(); + instance.put(key, value); + return getBuilderAfterAdditionalProperty(instance); + } + } + + public static class MapMapOfStringMapBuilder implements GenericBuilder>>, SetterForAdditionalProperties { + private final Map> instance; + private static final Set knownKeys = Set.of(); + public Set getKnownKeys() { + return knownKeys; + } + public MapMapOfStringMapBuilder() { + this.instance = new LinkedHashMap<>(); + } + public Map> build() { + return instance; + } + public Map> getInstance() { + return instance; + } + public MapMapOfStringMapBuilder getBuilderAfterAdditionalProperty(Map> instance) { + return this; + } + } + + + public sealed interface MapMapOfStringBoxed permits MapMapOfStringBoxedMap { + @Nullable Object getData(); + } + + public record MapMapOfStringBoxedMap(MapMapOfStringMap data) implements MapMapOfStringBoxed { + @Override + public @Nullable Object getData() { + return data; + } + } + + + public static class MapMapOfString extends JsonSchema implements MapSchemaValidator { + private static @Nullable MapMapOfString instance = null; + + protected MapMapOfString() { + super(new JsonSchemaInfo() + .type(Set.of(Map.class)) + .additionalProperties(AdditionalProperties.class) + ); + } + + public static MapMapOfString getInstance() { + if (instance == null) { + instance = new MapMapOfString(); + } + return instance; + } + + 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 RuntimeException("Invalid non-string key value"); + } + String propertyName = (String) entryKey; + List propertyPathToItem = new ArrayList<>(pathToItem); + propertyPathToItem.add(propertyName); + Object value = entry.getValue(); + LinkedHashMap, Nothing?> schemas = pathToSchemas.get(propertyPathToItem); + if (schemas == null) { + throw new RuntimeException("Validation 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"); + } + properties.put(propertyName, (AdditionalPropertiesMap) propertyInstance); + } + FrozenMap castProperties = new FrozenMap<>(properties); + return new MapMapOfStringMap(castProperties); + } + + 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); + SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().build())); + ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, new PathToSchemasMap(), new LinkedHashSet<>()); + PathToSchemasMap pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet); + return getNewInstance(castArg, validationMetadata.pathToItem(), pathToSchemasMap); + } + + + @Override + public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws 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"); + } + @Override + public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { + if (arg instanceof Map) { + return getNewInstance((Map) arg, pathToItem, pathToSchemas); + } + 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 { + return new MapMapOfStringBoxedMap(validate(arg, configuration)); + } + @Override + public MapMapOfStringBoxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { + 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"); + } + } + + public enum StringAdditionalPropertiesEnums implements StringValueMethod { + UPPER("UPPER"), + LOWER("lower"); + private final String value; + + StringAdditionalPropertiesEnums(String value) { + this.value = value; + } + public String value() { + return this.value; + } + } + + + public sealed interface AdditionalProperties2Boxed permits AdditionalProperties2BoxedString { + @Nullable Object getData(); + } + + public record AdditionalProperties2BoxedString(String data) implements AdditionalProperties2Boxed { + @Override + public @Nullable Object getData() { + return data; + } + } + + + + public static class AdditionalProperties2 extends JsonSchema implements StringSchemaValidator, StringEnumValidator { + private static @Nullable AdditionalProperties2 instance = null; + + protected AdditionalProperties2() { + super(new JsonSchemaInfo() + .type(Set.of( + String.class + )) + .enumValues(SetMaker.makeSet( + "UPPER", + "lower" + )) + ); + } + + public static AdditionalProperties2 getInstance() { + if (instance == null) { + instance = new AdditionalProperties2(); + } + return instance; + } + + @Override + public String validate(String arg, SchemaConfiguration configuration) throws ValidationException { + Set> pathSet = new HashSet<>(); + List pathToItem = List.of("args[0"); + String castArg = castToAllowedTypes(arg, pathToItem, pathSet); + SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().build())); + ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, new PathToSchemasMap(), new LinkedHashSet<>()); + getPathToSchemas(this, castArg, validationMetadata, pathSet); + return castArg; + } + + @Override + 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 { + 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"); + } + @Override + public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { + 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"); + } + @Override + 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 { + 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"); + } + } + + public static class MapOfEnumStringMap extends FrozenMap { + protected MapOfEnumStringMap(FrozenMap m) { + super(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 { + return MapOfEnumString.getInstance().validate(arg, configuration); + } + + public String getAdditionalProperty(String name) throws UnsetPropertyException { + return getOrThrow(name); + } + } + + public interface SetterForAdditionalProperties2 { + Set getKnownKeys(); + Map getInstance(); + T getBuilderAfterAdditionalProperty(Map instance); + + default T additionalProperty(String key, String value) throws InvalidAdditionalPropertyException { + MapUtils.throwIfKeyKnown(key, getKnownKeys(), true); + var instance = getInstance(); + instance.put(key, value); + return getBuilderAfterAdditionalProperty(instance); + } + + default T additionalProperty(String key, StringAdditionalPropertiesEnums value) throws InvalidAdditionalPropertyException { + MapUtils.throwIfKeyKnown(key, getKnownKeys(), true); + var instance = getInstance(); + instance.put(key, value.value()); + return getBuilderAfterAdditionalProperty(instance); + } + } + + public static class MapOfEnumStringMapBuilder implements GenericBuilder>, SetterForAdditionalProperties2 { + private final Map instance; + private static final Set knownKeys = Set.of(); + public Set getKnownKeys() { + return knownKeys; + } + public MapOfEnumStringMapBuilder() { + this.instance = new LinkedHashMap<>(); + } + public Map build() { + return instance; + } + public Map getInstance() { + return instance; + } + public MapOfEnumStringMapBuilder getBuilderAfterAdditionalProperty(Map instance) { + return this; + } + } + + + public sealed interface MapOfEnumStringBoxed permits MapOfEnumStringBoxedMap { + @Nullable Object getData(); + } + + public record MapOfEnumStringBoxedMap(MapOfEnumStringMap data) implements MapOfEnumStringBoxed { + @Override + public @Nullable Object getData() { + return data; + } + } + + + public static class MapOfEnumString extends JsonSchema implements MapSchemaValidator { + private static @Nullable MapOfEnumString instance = null; + + protected MapOfEnumString() { + super(new JsonSchemaInfo() + .type(Set.of(Map.class)) + .additionalProperties(AdditionalProperties2.class) + ); + } + + public static MapOfEnumString getInstance() { + if (instance == null) { + instance = new MapOfEnumString(); + } + return instance; + } + + 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 RuntimeException("Invalid non-string key value"); + } + String propertyName = (String) entryKey; + List propertyPathToItem = new ArrayList<>(pathToItem); + propertyPathToItem.add(propertyName); + Object value = entry.getValue(); + LinkedHashMap, Nothing?> schemas = pathToSchemas.get(propertyPathToItem); + if (schemas == null) { + throw new RuntimeException("Validation 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"); + } + properties.put(propertyName, (String) propertyInstance); + } + FrozenMap castProperties = new FrozenMap<>(properties); + return new MapOfEnumStringMap(castProperties); + } + + 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); + SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().build())); + ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, new PathToSchemasMap(), new LinkedHashSet<>()); + PathToSchemasMap pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet); + return getNewInstance(castArg, validationMetadata.pathToItem(), pathToSchemasMap); + } + + + @Override + public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws 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"); + } + @Override + public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { + if (arg instanceof Map) { + return getNewInstance((Map) arg, pathToItem, pathToSchemas); + } + 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 { + return new MapOfEnumStringBoxedMap(validate(arg, configuration)); + } + @Override + public MapOfEnumStringBoxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { + 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"); + } + } + + + public static class AdditionalProperties3 extends BooleanJsonSchema.BooleanJsonSchema1 { + private static @Nullable AdditionalProperties3 instance = null; + public static AdditionalProperties3 getInstance() { + if (instance == null) { + instance = new AdditionalProperties3(); + } + return instance; + } + } + + + public static class DirectMapMap extends FrozenMap { + protected DirectMapMap(FrozenMap m) { + super(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 { + return DirectMap.getInstance().validate(arg, configuration); + } + + public boolean getAdditionalProperty(String name) throws UnsetPropertyException { + throwIfKeyNotPresent(name); + Boolean value = get(name); + if (value == null) { + throw new RuntimeException("Value may not be null"); + } + return (boolean) value; + } + } + + public interface SetterForAdditionalProperties3 { + Set getKnownKeys(); + Map getInstance(); + T getBuilderAfterAdditionalProperty(Map instance); + + default T additionalProperty(String key, boolean value) throws InvalidAdditionalPropertyException { + MapUtils.throwIfKeyKnown(key, getKnownKeys(), true); + var instance = getInstance(); + instance.put(key, value); + return getBuilderAfterAdditionalProperty(instance); + } + } + + public static class DirectMapMapBuilder implements GenericBuilder>, SetterForAdditionalProperties3 { + private final Map instance; + private static final Set knownKeys = Set.of(); + public Set getKnownKeys() { + return knownKeys; + } + public DirectMapMapBuilder() { + this.instance = new LinkedHashMap<>(); + } + public Map build() { + return instance; + } + public Map getInstance() { + return instance; + } + public DirectMapMapBuilder getBuilderAfterAdditionalProperty(Map instance) { + return this; + } + } + + + public sealed interface DirectMapBoxed permits DirectMapBoxedMap { + @Nullable Object getData(); + } + + public record DirectMapBoxedMap(DirectMapMap data) implements DirectMapBoxed { + @Override + public @Nullable Object getData() { + return data; + } + } + + + public static class DirectMap extends JsonSchema implements MapSchemaValidator { + private static @Nullable DirectMap instance = null; + + protected DirectMap() { + super(new JsonSchemaInfo() + .type(Set.of(Map.class)) + .additionalProperties(AdditionalProperties3.class) + ); + } + + public static DirectMap getInstance() { + if (instance == null) { + instance = new DirectMap(); + } + return instance; + } + + 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 RuntimeException("Invalid non-string key value"); + } + String propertyName = (String) entryKey; + List propertyPathToItem = new ArrayList<>(pathToItem); + propertyPathToItem.add(propertyName); + Object value = entry.getValue(); + LinkedHashMap, Nothing?> schemas = pathToSchemas.get(propertyPathToItem); + if (schemas == null) { + throw new RuntimeException("Validation 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"); + } + properties.put(propertyName, (Boolean) propertyInstance); + } + FrozenMap castProperties = new FrozenMap<>(properties); + return new DirectMapMap(castProperties); + } + + 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); + SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().build())); + ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, new PathToSchemasMap(), new LinkedHashSet<>()); + PathToSchemasMap pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet); + return getNewInstance(castArg, validationMetadata.pathToItem(), pathToSchemasMap); + } + + + @Override + public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws 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"); + } + @Override + public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { + if (arg instanceof Map) { + return getNewInstance((Map) arg, pathToItem, pathToSchemas); + } + 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 { + return new DirectMapBoxedMap(validate(arg, configuration)); + } + @Override + public DirectMapBoxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { + 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"); + } + } + + + public static class MapTestMap extends FrozenMap<@Nullable Object> { + protected MapTestMap(FrozenMap<@Nullable Object> m) { + super(m); + } + public static final Set requiredKeys = Set.of(); + public static final Set optionalKeys = Set.of( + "map_map_of_string", + "map_of_enum_string", + "direct_map", + "indirect_map" + ); + public static MapTestMap of(Map arg, SchemaConfiguration configuration) throws ValidationException { + return MapTest1.getInstance().validate(arg, configuration); + } + + public MapMapOfStringMap map_map_of_string() throws UnsetPropertyException { + String key = "map_map_of_string"; + throwIfKeyNotPresent(key); + @Nullable Object value = get(key); + if (!(value instanceof MapMapOfStringMap)) { + throw new RuntimeException("Invalid value stored for map_map_of_string"); + } + return (MapMapOfStringMap) value; + } + + public MapOfEnumStringMap map_of_enum_string() throws UnsetPropertyException { + String key = "map_of_enum_string"; + throwIfKeyNotPresent(key); + @Nullable Object value = get(key); + if (!(value instanceof MapOfEnumStringMap)) { + throw new RuntimeException("Invalid value stored for map_of_enum_string"); + } + return (MapOfEnumStringMap) value; + } + + public DirectMapMap direct_map() throws UnsetPropertyException { + String key = "direct_map"; + throwIfKeyNotPresent(key); + @Nullable Object value = get(key); + if (!(value instanceof DirectMapMap)) { + throw new RuntimeException("Invalid value stored for direct_map"); + } + return (DirectMapMap) value; + } + + public StringBooleanMap.StringBooleanMapMap indirect_map() throws UnsetPropertyException { + String key = "indirect_map"; + throwIfKeyNotPresent(key); + @Nullable Object value = get(key); + if (!(value instanceof StringBooleanMap.StringBooleanMapMap)) { + throw new RuntimeException("Invalid value stored for indirect_map"); + } + return (StringBooleanMap.StringBooleanMapMap) value; + } + + public @Nullable Object getAdditionalProperty(String name) throws UnsetPropertyException, InvalidAdditionalPropertyException { + throwIfKeyKnown(name, requiredKeys, optionalKeys); + throwIfKeyNotPresent(name); + return get(name); + } + } + + public interface SetterForMapMapOfString { + Map getInstance(); + T getBuilderAfterMapMapOfString(Map instance); + + default T map_map_of_string(Map> value) { + var instance = getInstance(); + instance.put("map_map_of_string", value); + return getBuilderAfterMapMapOfString(instance); + } + } + + public interface SetterForMapOfEnumString { + Map getInstance(); + T getBuilderAfterMapOfEnumString(Map instance); + + default T map_of_enum_string(Map value) { + var instance = getInstance(); + instance.put("map_of_enum_string", value); + return getBuilderAfterMapOfEnumString(instance); + } + } + + public interface SetterForDirectMap { + Map getInstance(); + T getBuilderAfterDirectMap(Map instance); + + default T direct_map(Map value) { + var instance = getInstance(); + instance.put("direct_map", value); + return getBuilderAfterDirectMap(instance); + } + } + + public interface SetterForIndirectMap { + Map getInstance(); + T getBuilderAfterIndirectMap(Map instance); + + default T indirect_map(Map value) { + var instance = getInstance(); + instance.put("indirect_map", value); + return getBuilderAfterIndirectMap(instance); + } + } + + public static class MapTestMapBuilder extends UnsetAddPropsSetter implements GenericBuilder>, SetterForMapMapOfString, SetterForMapOfEnumString, SetterForDirectMap, SetterForIndirectMap { + private final Map instance; + private static final Set knownKeys = Set.of( + "map_map_of_string", + "map_of_enum_string", + "direct_map", + "indirect_map" + ); + public Set getKnownKeys() { + return knownKeys; + } + public MapTestMapBuilder() { + this.instance = new LinkedHashMap<>(); + } + public Map build() { + return instance; + } + public Map getInstance() { + return instance; + } + public MapTestMapBuilder getBuilderAfterMapMapOfString(Map instance) { + return this; + } + public MapTestMapBuilder getBuilderAfterMapOfEnumString(Map instance) { + return this; + } + public MapTestMapBuilder getBuilderAfterDirectMap(Map instance) { + return this; + } + public MapTestMapBuilder getBuilderAfterIndirectMap(Map instance) { + return this; + } + public MapTestMapBuilder getBuilderAfterAdditionalProperty(Map instance) { + return this; + } + } + + + public sealed interface MapTest1Boxed permits MapTest1BoxedMap { + @Nullable Object getData(); + } + + public record MapTest1BoxedMap(MapTestMap data) implements MapTest1Boxed { + @Override + public @Nullable Object getData() { + return data; + } + } + + + public static class MapTest1 extends JsonSchema implements MapSchemaValidator { + /* + NOTE: This class is auto generated by OpenAPI JSON Schema Generator. + Ref: https://github.com/openapi-json-schema-tools/openapi-json-schema-generator + + Do not edit the class manually. + */ + private static @Nullable MapTest1 instance = null; + + protected MapTest1() { + super(new JsonSchemaInfo() + .type(Set.of(Map.class)) + .properties(Map.ofEntries( + new PropertyEntry("map_map_of_string", MapMapOfString.class), + new PropertyEntry("map_of_enum_string", MapOfEnumString.class), + new PropertyEntry("direct_map", DirectMap.class), + new PropertyEntry("indirect_map", StringBooleanMap.StringBooleanMap1.class) + )) + ); + } + + public static MapTest1 getInstance() { + if (instance == null) { + instance = new MapTest1(); + } + return instance; + } + + 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 RuntimeException("Invalid non-string key value"); + } + String propertyName = (String) entryKey; + List propertyPathToItem = new ArrayList<>(pathToItem); + propertyPathToItem.add(propertyName); + Object value = entry.getValue(); + LinkedHashMap, Nothing?> schemas = pathToSchemas.get(propertyPathToItem); + if (schemas == null) { + throw new RuntimeException("Validation result is invalid, schemas must exist for a pathToItem"); + } + JsonSchema propertySchema = schemas.entrySet().iterator().next().getKey(); + @Nullable Object propertyInstance = propertySchema.getNewInstance(value, propertyPathToItem, pathToSchemas); + properties.put(propertyName, propertyInstance); + } + FrozenMap<@Nullable Object> castProperties = new FrozenMap<>(properties); + return new MapTestMap(castProperties); + } + + 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); + SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().build())); + ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, new PathToSchemasMap(), new LinkedHashSet<>()); + PathToSchemasMap pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet); + return getNewInstance(castArg, validationMetadata.pathToItem(), pathToSchemasMap); + } + + + @Override + public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws 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"); + } + @Override + public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { + if (arg instanceof Map) { + return getNewInstance((Map) arg, pathToItem, pathToSchemas); + } + 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 { + return new MapTest1BoxedMap(validate(arg, configuration)); + } + @Override + public MapTest1Boxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { + 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"); + } + } + +} diff --git a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/schemas/MixedPropertiesAndAdditionalPropertiesClass.kt b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/schemas/MixedPropertiesAndAdditionalPropertiesClass.kt new file mode 100644 index 00000000000..a2e8e4bbfa6 --- /dev/null +++ b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/schemas/MixedPropertiesAndAdditionalPropertiesClass.kt @@ -0,0 +1,396 @@ +package org.openapijsonschematools.client.components.schemas; +import java.util.ArrayList; +import java.util.HashSet; +import java.util.LinkedHashMap; +import java.util.LinkedHashSet; +import java.util.List; +import java.util.Map; +import java.util.Objects; +import java.util.Set; +import org.checkerframework.checker.nullness.qual.Nullable; +import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags; +import org.openapijsonschematools.client.configurations.SchemaConfiguration; +import org.openapijsonschematools.client.exceptions.InvalidAdditionalPropertyException; +import org.openapijsonschematools.client.exceptions.UnsetPropertyException; +import org.openapijsonschematools.client.exceptions.ValidationException; +import org.openapijsonschematools.client.schemas.DateTimeJsonSchema; +import org.openapijsonschematools.client.schemas.GenericBuilder; +import org.openapijsonschematools.client.schemas.UnsetAddPropsSetter; +import org.openapijsonschematools.client.schemas.UuidJsonSchema; +import org.openapijsonschematools.client.schemas.validation.FrozenMap; +import org.openapijsonschematools.client.schemas.validation.JsonSchema; +import org.openapijsonschematools.client.schemas.validation.JsonSchemaInfo; +import org.openapijsonschematools.client.schemas.validation.MapSchemaValidator; +import org.openapijsonschematools.client.schemas.validation.MapUtils; +import org.openapijsonschematools.client.schemas.validation.PathToSchemasMap; +import org.openapijsonschematools.client.schemas.validation.PropertyEntry; +import org.openapijsonschematools.client.schemas.validation.ValidationMetadata; + +public class MixedPropertiesAndAdditionalPropertiesClass { + // nest classes so all schemas and input/output classes can be public + + + public static class UuidSchema extends UuidJsonSchema.UuidJsonSchema1 { + private static @Nullable UuidSchema instance = null; + public static UuidSchema getInstance() { + if (instance == null) { + instance = new UuidSchema(); + } + return instance; + } + } + + + public static class DateTime extends DateTimeJsonSchema.DateTimeJsonSchema1 { + private static @Nullable DateTime instance = null; + public static DateTime getInstance() { + if (instance == null) { + instance = new DateTime(); + } + return instance; + } + } + + + public static class MapMap extends FrozenMap { + protected MapMap(FrozenMap m) { + super(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 { + return MapSchema.getInstance().validate(arg, configuration); + } + + public Animal.AnimalMap getAdditionalProperty(String name) throws UnsetPropertyException { + return getOrThrow(name); + } + } + + public interface SetterForAdditionalProperties { + Set getKnownKeys(); + Map> getInstance(); + T getBuilderAfterAdditionalProperty(Map> instance); + + default T additionalProperty(String key, Map value) throws InvalidAdditionalPropertyException { + MapUtils.throwIfKeyKnown(key, getKnownKeys(), true); + var instance = getInstance(); + instance.put(key, value); + return getBuilderAfterAdditionalProperty(instance); + } + } + + public static class MapMapBuilder implements GenericBuilder>>, SetterForAdditionalProperties { + private final Map> instance; + private static final Set knownKeys = Set.of(); + public Set getKnownKeys() { + return knownKeys; + } + public MapMapBuilder() { + this.instance = new LinkedHashMap<>(); + } + public Map> build() { + return instance; + } + public Map> getInstance() { + return instance; + } + public MapMapBuilder getBuilderAfterAdditionalProperty(Map> instance) { + return this; + } + } + + + public sealed interface MapSchemaBoxed permits MapSchemaBoxedMap { + @Nullable Object getData(); + } + + public record MapSchemaBoxedMap(MapMap data) implements MapSchemaBoxed { + @Override + public @Nullable Object getData() { + return data; + } + } + + + public static class MapSchema extends JsonSchema implements MapSchemaValidator { + private static @Nullable MapSchema instance = null; + + protected MapSchema() { + super(new JsonSchemaInfo() + .type(Set.of(Map.class)) + .additionalProperties(Animal.Animal1.class) + ); + } + + public static MapSchema getInstance() { + if (instance == null) { + instance = new MapSchema(); + } + return instance; + } + + 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 RuntimeException("Invalid non-string key value"); + } + String propertyName = (String) entryKey; + List propertyPathToItem = new ArrayList<>(pathToItem); + propertyPathToItem.add(propertyName); + Object value = entry.getValue(); + LinkedHashMap, Nothing?> schemas = pathToSchemas.get(propertyPathToItem); + if (schemas == null) { + throw new RuntimeException("Validation 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"); + } + properties.put(propertyName, (Animal.AnimalMap) propertyInstance); + } + FrozenMap castProperties = new FrozenMap<>(properties); + return new MapMap(castProperties); + } + + 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); + SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().build())); + ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, new PathToSchemasMap(), new LinkedHashSet<>()); + PathToSchemasMap pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet); + return getNewInstance(castArg, validationMetadata.pathToItem(), pathToSchemasMap); + } + + + @Override + public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws 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"); + } + @Override + public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { + if (arg instanceof Map) { + return getNewInstance((Map) arg, pathToItem, pathToSchemas); + } + 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 { + return new MapSchemaBoxedMap(validate(arg, configuration)); + } + @Override + public MapSchemaBoxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { + 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"); + } + } + + + public static class MixedPropertiesAndAdditionalPropertiesClassMap extends FrozenMap<@Nullable Object> { + protected MixedPropertiesAndAdditionalPropertiesClassMap(FrozenMap<@Nullable Object> m) { + super(m); + } + public static final Set requiredKeys = Set.of(); + public static final Set optionalKeys = Set.of( + "uuid", + "dateTime", + "map" + ); + public static MixedPropertiesAndAdditionalPropertiesClassMap of(Map arg, SchemaConfiguration configuration) throws ValidationException { + return MixedPropertiesAndAdditionalPropertiesClass1.getInstance().validate(arg, configuration); + } + + public String dateTime() throws UnsetPropertyException { + String key = "dateTime"; + throwIfKeyNotPresent(key); + @Nullable Object value = get(key); + if (!(value instanceof String)) { + throw new RuntimeException("Invalid value stored for dateTime"); + } + return (String) value; + } + + public @Nullable Object getAdditionalProperty(String name) throws UnsetPropertyException, InvalidAdditionalPropertyException { + throwIfKeyKnown(name, requiredKeys, optionalKeys); + throwIfKeyNotPresent(name); + return get(name); + } + } + + public interface SetterForUuidSchema { + Map getInstance(); + T getBuilderAfterUuidSchema(Map instance); + + default T setUuid(String value) { + var instance = getInstance(); + instance.put("uuid", value); + return getBuilderAfterUuidSchema(instance); + } + } + + public interface SetterForDateTime { + Map getInstance(); + T getBuilderAfterDateTime(Map instance); + + default T dateTime(String value) { + var instance = getInstance(); + instance.put("dateTime", value); + return getBuilderAfterDateTime(instance); + } + } + + public interface SetterForMapSchema { + Map getInstance(); + T getBuilderAfterMapSchema(Map instance); + + default T setMap(Map> value) { + var instance = getInstance(); + instance.put("map", value); + return getBuilderAfterMapSchema(instance); + } + } + + public static class MixedPropertiesAndAdditionalPropertiesClassMapBuilder extends UnsetAddPropsSetter implements GenericBuilder>, SetterForUuidSchema, SetterForDateTime, SetterForMapSchema { + private final Map instance; + private static final Set knownKeys = Set.of( + "uuid", + "dateTime", + "map" + ); + public Set getKnownKeys() { + return knownKeys; + } + public MixedPropertiesAndAdditionalPropertiesClassMapBuilder() { + this.instance = new LinkedHashMap<>(); + } + public Map build() { + return instance; + } + public Map getInstance() { + return instance; + } + public MixedPropertiesAndAdditionalPropertiesClassMapBuilder getBuilderAfterUuidSchema(Map instance) { + return this; + } + public MixedPropertiesAndAdditionalPropertiesClassMapBuilder getBuilderAfterDateTime(Map instance) { + return this; + } + public MixedPropertiesAndAdditionalPropertiesClassMapBuilder getBuilderAfterMapSchema(Map instance) { + return this; + } + public MixedPropertiesAndAdditionalPropertiesClassMapBuilder getBuilderAfterAdditionalProperty(Map instance) { + return this; + } + } + + + public sealed interface MixedPropertiesAndAdditionalPropertiesClass1Boxed permits MixedPropertiesAndAdditionalPropertiesClass1BoxedMap { + @Nullable Object getData(); + } + + public record MixedPropertiesAndAdditionalPropertiesClass1BoxedMap(MixedPropertiesAndAdditionalPropertiesClassMap data) implements MixedPropertiesAndAdditionalPropertiesClass1Boxed { + @Override + public @Nullable Object getData() { + return data; + } + } + + + public static class MixedPropertiesAndAdditionalPropertiesClass1 extends JsonSchema implements MapSchemaValidator { + /* + NOTE: This class is auto generated by OpenAPI JSON Schema Generator. + Ref: https://github.com/openapi-json-schema-tools/openapi-json-schema-generator + + Do not edit the class manually. + */ + private static @Nullable MixedPropertiesAndAdditionalPropertiesClass1 instance = null; + + protected MixedPropertiesAndAdditionalPropertiesClass1() { + super(new JsonSchemaInfo() + .type(Set.of(Map.class)) + .properties(Map.ofEntries( + new PropertyEntry("uuid", UuidSchema.class), + new PropertyEntry("dateTime", DateTime.class), + new PropertyEntry("map", MapSchema.class) + )) + ); + } + + public static MixedPropertiesAndAdditionalPropertiesClass1 getInstance() { + if (instance == null) { + instance = new MixedPropertiesAndAdditionalPropertiesClass1(); + } + return instance; + } + + 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 RuntimeException("Invalid non-string key value"); + } + String propertyName = (String) entryKey; + List propertyPathToItem = new ArrayList<>(pathToItem); + propertyPathToItem.add(propertyName); + Object value = entry.getValue(); + LinkedHashMap, Nothing?> schemas = pathToSchemas.get(propertyPathToItem); + if (schemas == null) { + throw new RuntimeException("Validation result is invalid, schemas must exist for a pathToItem"); + } + JsonSchema propertySchema = schemas.entrySet().iterator().next().getKey(); + @Nullable Object propertyInstance = propertySchema.getNewInstance(value, propertyPathToItem, pathToSchemas); + properties.put(propertyName, propertyInstance); + } + FrozenMap<@Nullable Object> castProperties = new FrozenMap<>(properties); + return new MixedPropertiesAndAdditionalPropertiesClassMap(castProperties); + } + + 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); + SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().build())); + ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, new PathToSchemasMap(), new LinkedHashSet<>()); + PathToSchemasMap pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet); + return getNewInstance(castArg, validationMetadata.pathToItem(), pathToSchemasMap); + } + + + @Override + public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws 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"); + } + @Override + public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { + if (arg instanceof Map) { + return getNewInstance((Map) arg, pathToItem, pathToSchemas); + } + 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 { + return new MixedPropertiesAndAdditionalPropertiesClass1BoxedMap(validate(arg, configuration)); + } + @Override + public MixedPropertiesAndAdditionalPropertiesClass1Boxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { + 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"); + } + } + +} diff --git a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/schemas/Money.kt b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/schemas/Money.kt new file mode 100644 index 00000000000..265d11ad1d0 --- /dev/null +++ b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/schemas/Money.kt @@ -0,0 +1,277 @@ +package org.openapijsonschematools.client.components.schemas; +import java.util.ArrayList; +import java.util.HashSet; +import java.util.LinkedHashMap; +import java.util.LinkedHashSet; +import java.util.List; +import java.util.Map; +import java.util.Objects; +import java.util.Set; +import org.checkerframework.checker.nullness.qual.Nullable; +import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags; +import org.openapijsonschematools.client.configurations.SchemaConfiguration; +import org.openapijsonschematools.client.exceptions.UnsetPropertyException; +import org.openapijsonschematools.client.exceptions.ValidationException; +import org.openapijsonschematools.client.schemas.AnyTypeJsonSchema; +import org.openapijsonschematools.client.schemas.DecimalJsonSchema; +import org.openapijsonschematools.client.schemas.GenericBuilder; +import org.openapijsonschematools.client.schemas.NotAnyTypeJsonSchema; +import org.openapijsonschematools.client.schemas.validation.FrozenMap; +import org.openapijsonschematools.client.schemas.validation.JsonSchema; +import org.openapijsonschematools.client.schemas.validation.JsonSchemaInfo; +import org.openapijsonschematools.client.schemas.validation.MapSchemaValidator; +import org.openapijsonschematools.client.schemas.validation.MapUtils; +import org.openapijsonschematools.client.schemas.validation.PathToSchemasMap; +import org.openapijsonschematools.client.schemas.validation.PropertyEntry; +import org.openapijsonschematools.client.schemas.validation.ValidationMetadata; + +public class Money { + // nest classes so all schemas and input/output classes can be public + + + public static class AdditionalProperties extends NotAnyTypeJsonSchema.NotAnyTypeJsonSchema1 { + // NotAnyTypeSchema + private static @Nullable AdditionalProperties instance = null; + public static AdditionalProperties getInstance() { + if (instance == null) { + instance = new AdditionalProperties(); + } + return instance; + } + } + + + public static class Amount extends DecimalJsonSchema.DecimalJsonSchema1 { + private static @Nullable Amount instance = null; + public static Amount getInstance() { + if (instance == null) { + instance = new Amount(); + } + return instance; + } + } + + + public static class MoneyMap extends FrozenMap<@Nullable Object> { + protected MoneyMap(FrozenMap<@Nullable Object> m) { + super(m); + } + public static final Set requiredKeys = Set.of( + "amount", + "currency" + ); + public static final Set optionalKeys = Set.of(); + public static MoneyMap of(Map arg, SchemaConfiguration configuration) throws ValidationException { + return Money1.getInstance().validate(arg, configuration); + } + + public String amount() { + @Nullable Object value = get("amount"); + if (!(value instanceof String)) { + throw new RuntimeException("Invalid value stored for amount"); + } + return (String) value; + } + + public String currency() { + @Nullable Object value = get("currency"); + if (!(value instanceof String)) { + throw new RuntimeException("Invalid value stored for currency"); + } + return (String) value; + } + } + + public interface SetterForAmount { + Map getInstance(); + T getBuilderAfterAmount(Map instance); + + default T amount(String value) { + var instance = getInstance(); + instance.put("amount", value); + return getBuilderAfterAmount(instance); + } + } + + public interface SetterForCurrency { + Map getInstance(); + T getBuilderAfterCurrency(Map instance); + + default T currency(String value) { + var instance = getInstance(); + instance.put("currency", value); + return getBuilderAfterCurrency(instance); + } + + default T currency(Currency.StringCurrencyEnums value) { + var instance = getInstance(); + instance.put("currency", value.value()); + return getBuilderAfterCurrency(instance); + } + } + + public static class MoneyMap00Builder implements GenericBuilder> { + private final Map instance; + private static final Set knownKeys = Set.of( + "amount", + "currency" + ); + public Set getKnownKeys() { + return knownKeys; + } + public MoneyMap00Builder(Map instance) { + this.instance = instance; + } + public Map build() { + return instance; + } + } + + public static class MoneyMap01Builder implements SetterForCurrency { + private final Map instance; + public MoneyMap01Builder(Map instance) { + this.instance = instance; + } + public Map getInstance() { + return instance; + } + public MoneyMap00Builder getBuilderAfterCurrency(Map instance) { + return new MoneyMap00Builder(instance); + } + } + + public static class MoneyMap10Builder implements SetterForAmount { + private final Map instance; + public MoneyMap10Builder(Map instance) { + this.instance = instance; + } + public Map getInstance() { + return instance; + } + public MoneyMap00Builder getBuilderAfterAmount(Map instance) { + return new MoneyMap00Builder(instance); + } + } + + public static class MoneyMapBuilder implements SetterForAmount, SetterForCurrency { + private final Map instance; + public MoneyMapBuilder() { + this.instance = new LinkedHashMap<>(); + } + public Map getInstance() { + return instance; + } + public MoneyMap01Builder getBuilderAfterAmount(Map instance) { + return new MoneyMap01Builder(instance); + } + public MoneyMap10Builder getBuilderAfterCurrency(Map instance) { + return new MoneyMap10Builder(instance); + } + } + + + public sealed interface Money1Boxed permits Money1BoxedMap { + @Nullable Object getData(); + } + + public record Money1BoxedMap(MoneyMap data) implements Money1Boxed { + @Override + public @Nullable Object getData() { + return data; + } + } + + + public static class Money1 extends JsonSchema implements MapSchemaValidator { + /* + NOTE: This class is auto generated by OpenAPI JSON Schema Generator. + Ref: https://github.com/openapi-json-schema-tools/openapi-json-schema-generator + + Do not edit the class manually. + */ + private static @Nullable Money1 instance = null; + + protected Money1() { + super(new JsonSchemaInfo() + .type(Set.of(Map.class)) + .properties(Map.ofEntries( + new PropertyEntry("amount", Amount.class), + new PropertyEntry("currency", Currency.Currency1.class) + )) + .required(Set.of( + "amount", + "currency" + )) + .additionalProperties(AdditionalProperties.class) + ); + } + + public static Money1 getInstance() { + if (instance == null) { + instance = new Money1(); + } + return instance; + } + + 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 RuntimeException("Invalid non-string key value"); + } + String propertyName = (String) entryKey; + List propertyPathToItem = new ArrayList<>(pathToItem); + propertyPathToItem.add(propertyName); + Object value = entry.getValue(); + LinkedHashMap, Nothing?> schemas = pathToSchemas.get(propertyPathToItem); + if (schemas == null) { + throw new RuntimeException("Validation result is invalid, schemas must exist for a pathToItem"); + } + JsonSchema propertySchema = schemas.entrySet().iterator().next().getKey(); + @Nullable Object propertyInstance = propertySchema.getNewInstance(value, propertyPathToItem, pathToSchemas); + properties.put(propertyName, propertyInstance); + } + FrozenMap<@Nullable Object> castProperties = new FrozenMap<>(properties); + return new MoneyMap(castProperties); + } + + 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); + SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().build())); + ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, new PathToSchemasMap(), new LinkedHashSet<>()); + PathToSchemasMap pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet); + return getNewInstance(castArg, validationMetadata.pathToItem(), pathToSchemasMap); + } + + + @Override + public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws 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"); + } + @Override + public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { + if (arg instanceof Map) { + return getNewInstance((Map) arg, pathToItem, pathToSchemas); + } + 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 { + return new Money1BoxedMap(validate(arg, configuration)); + } + @Override + public Money1Boxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { + 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"); + } + } + +} diff --git a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/schemas/MultiPropertiesSchema.kt b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/schemas/MultiPropertiesSchema.kt new file mode 100644 index 00000000000..b1c1a23f334 --- /dev/null +++ b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/schemas/MultiPropertiesSchema.kt @@ -0,0 +1,422 @@ +package org.openapijsonschematools.client.components.schemas; +import java.util.ArrayList; +import java.util.HashSet; +import java.util.LinkedHashMap; +import java.util.LinkedHashSet; +import java.util.List; +import java.util.Map; +import java.util.Objects; +import java.util.Set; +import org.checkerframework.checker.nullness.qual.Nullable; +import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags; +import org.openapijsonschematools.client.configurations.SchemaConfiguration; +import org.openapijsonschematools.client.exceptions.UnsetPropertyException; +import org.openapijsonschematools.client.exceptions.ValidationException; +import org.openapijsonschematools.client.schemas.AnyTypeJsonSchema; +import org.openapijsonschematools.client.schemas.GenericBuilder; +import org.openapijsonschematools.client.schemas.Int32JsonSchema; +import org.openapijsonschematools.client.schemas.NotAnyTypeJsonSchema; +import org.openapijsonschematools.client.schemas.StringJsonSchema; +import org.openapijsonschematools.client.schemas.validation.FrozenList; +import org.openapijsonschematools.client.schemas.validation.FrozenMap; +import org.openapijsonschematools.client.schemas.validation.JsonSchema; +import org.openapijsonschematools.client.schemas.validation.JsonSchemaInfo; +import org.openapijsonschematools.client.schemas.validation.ListSchemaValidator; +import org.openapijsonschematools.client.schemas.validation.MapSchemaValidator; +import org.openapijsonschematools.client.schemas.validation.MapUtils; +import org.openapijsonschematools.client.schemas.validation.PathToSchemasMap; +import org.openapijsonschematools.client.schemas.validation.PropertyEntry; +import org.openapijsonschematools.client.schemas.validation.ValidationMetadata; + +public class MultiPropertiesSchema { + // nest classes so all schemas and input/output classes can be public + + + public static class AdditionalProperties extends NotAnyTypeJsonSchema.NotAnyTypeJsonSchema1 { + // NotAnyTypeSchema + private static @Nullable AdditionalProperties instance = null; + public static AdditionalProperties getInstance() { + if (instance == null) { + instance = new AdditionalProperties(); + } + return instance; + } + } + + + public static class Status extends Int32JsonSchema.Int32JsonSchema1 { + private static @Nullable Status instance = null; + public static Status getInstance() { + if (instance == null) { + instance = new Status(); + } + return instance; + } + } + + + public static class Message extends StringJsonSchema.StringJsonSchema1 { + private static @Nullable Message instance = null; + public static Message getInstance() { + if (instance == null) { + instance = new Message(); + } + return instance; + } + } + + + public static class DataList extends FrozenList { + protected DataList(FrozenList m) { + super(m); + } + public static DataList of(List> arg, SchemaConfiguration configuration) throws ValidationException { + return Data.getInstance().validate(arg, configuration); + } + } + + public static class DataListBuilder { + // class to build List> + private final List> list; + + public DataListBuilder() { + list = new ArrayList<>(); + } + + public DataListBuilder(List> list) { + this.list = list; + } + + public DataListBuilder add(Map item) { + list.add(item); + return this; + } + + public List> build() { + return list; + } + } + + + public sealed interface DataBoxed permits DataBoxedList { + @Nullable Object getData(); + } + + public record DataBoxedList(DataList data) implements DataBoxed { + @Override + public @Nullable Object getData() { + return data; + } + } + + + + public static class Data extends JsonSchema implements ListSchemaValidator { + private static @Nullable Data instance = null; + + protected Data() { + super(new JsonSchemaInfo() + .type(Set.of(List.class)) + .items(ItemsSchema.ItemsSchema1.class) + ); + } + + public static Data getInstance() { + if (instance == null) { + instance = new Data(); + } + return instance; + } + + @Override + public DataList getNewInstance(List arg, List pathToItem, PathToSchemasMap pathToSchemas) { + List items = new ArrayList<>(); + int i = 0; + for (Object item: arg) { + List itemPathToItem = new ArrayList<>(pathToItem); + itemPathToItem.add(i); + LinkedHashMap, Nothing?> schemas = pathToSchemas.get(itemPathToItem); + if (schemas == null) { + throw new RuntimeException("Validation 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 ItemsSchema.ItemsSchemaMap)) { + throw new RuntimeException("Invalid instantiated value"); + } + items.add((ItemsSchema.ItemsSchemaMap) itemInstance); + i += 1; + } + FrozenList newInstanceItems = new FrozenList<>(items); + return new DataList(newInstanceItems); + } + + public DataList validate(List arg, SchemaConfiguration configuration) throws ValidationException { + Set> pathSet = new HashSet<>(); + List pathToItem = List.of("args[0"); + List castArg = castToAllowedTypes(arg, pathToItem, pathSet); + SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().build())); + ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, new PathToSchemasMap(), new LinkedHashSet<>()); + PathToSchemasMap pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet); + return getNewInstance(castArg, validationMetadata.pathToItem(), pathToSchemasMap); + } + + @Override + public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws 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"); + } + @Override + public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { + 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"); + } + @Override + public DataBoxedList validateAndBox(List arg, SchemaConfiguration configuration) throws ValidationException { + return new DataBoxedList(validate(arg, configuration)); + } + @Override + public DataBoxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { + 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"); + } + } + + public static class MultiPropertiesSchemaMap extends FrozenMap { + protected MultiPropertiesSchemaMap(FrozenMap m) { + super(m); + } + public static final Set requiredKeys = Set.of( + "status" + ); + public static final Set optionalKeys = Set.of( + "data", + "message" + ); + public static MultiPropertiesSchemaMap of(Map arg, SchemaConfiguration configuration) throws ValidationException { + return MultiPropertiesSchema1.getInstance().validate(arg, configuration); + } + + public Number status() { + Object value = get("status"); + if (!(value instanceof Number)) { + throw new RuntimeException("Invalid value stored for status"); + } + return (Number) value; + } + + public DataList data() throws UnsetPropertyException { + String key = "data"; + throwIfKeyNotPresent(key); + Object value = get(key); + if (!(value instanceof DataList)) { + throw new RuntimeException("Invalid value stored for data"); + } + return (DataList) value; + } + + public String message() throws UnsetPropertyException { + String key = "message"; + throwIfKeyNotPresent(key); + Object value = get(key); + if (!(value instanceof String)) { + throw new RuntimeException("Invalid value stored for message"); + } + return (String) value; + } + } + + public interface SetterForStatus { + Map getInstance(); + T getBuilderAfterStatus(Map instance); + + default T status(int value) { + var instance = getInstance(); + instance.put("status", value); + return getBuilderAfterStatus(instance); + } + + default T status(float value) { + var instance = getInstance(); + instance.put("status", value); + return getBuilderAfterStatus(instance); + } + } + + public interface SetterForData { + Map getInstance(); + T getBuilderAfterData(Map instance); + + default T data(List> value) { + var instance = getInstance(); + instance.put("data", value); + return getBuilderAfterData(instance); + } + } + + public interface SetterForMessage { + Map getInstance(); + T getBuilderAfterMessage(Map instance); + + default T message(String value) { + var instance = getInstance(); + instance.put("message", value); + return getBuilderAfterMessage(instance); + } + } + + public static class MultiPropertiesSchemaMap0Builder implements GenericBuilder>, SetterForData, SetterForMessage { + private final Map instance; + private static final Set knownKeys = Set.of( + "status", + "data", + "message" + ); + public Set getKnownKeys() { + return knownKeys; + } + public MultiPropertiesSchemaMap0Builder(Map instance) { + this.instance = instance; + } + public Map build() { + return instance; + } + public Map getInstance() { + return instance; + } + public MultiPropertiesSchemaMap0Builder getBuilderAfterData(Map instance) { + return this; + } + public MultiPropertiesSchemaMap0Builder getBuilderAfterMessage(Map instance) { + return this; + } + } + + public static class MultiPropertiesSchemaMapBuilder implements SetterForStatus { + private final Map instance; + public MultiPropertiesSchemaMapBuilder() { + this.instance = new LinkedHashMap<>(); + } + public Map getInstance() { + return instance; + } + public MultiPropertiesSchemaMap0Builder getBuilderAfterStatus(Map instance) { + return new MultiPropertiesSchemaMap0Builder(instance); + } + } + + + public sealed interface MultiPropertiesSchema1Boxed permits MultiPropertiesSchema1BoxedMap { + @Nullable Object getData(); + } + + public record MultiPropertiesSchema1BoxedMap(MultiPropertiesSchemaMap data) implements MultiPropertiesSchema1Boxed { + @Override + public @Nullable Object getData() { + return data; + } + } + + + public static class MultiPropertiesSchema1 extends JsonSchema implements MapSchemaValidator { + /* + NOTE: This class is auto generated by OpenAPI JSON Schema Generator. + Ref: https://github.com/openapi-json-schema-tools/openapi-json-schema-generator + + Do not edit the class manually. + */ + private static @Nullable MultiPropertiesSchema1 instance = null; + + protected MultiPropertiesSchema1() { + super(new JsonSchemaInfo() + .type(Set.of(Map.class)) + .properties(Map.ofEntries( + new PropertyEntry("status", Status.class), + new PropertyEntry("data", Data.class), + new PropertyEntry("message", Message.class) + )) + .required(Set.of( + "status" + )) + .additionalProperties(AdditionalProperties.class) + ); + } + + public static MultiPropertiesSchema1 getInstance() { + if (instance == null) { + instance = new MultiPropertiesSchema1(); + } + return instance; + } + + public MultiPropertiesSchemaMap 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 RuntimeException("Invalid non-string key value"); + } + String propertyName = (String) entryKey; + List propertyPathToItem = new ArrayList<>(pathToItem); + propertyPathToItem.add(propertyName); + Object value = entry.getValue(); + LinkedHashMap, Nothing?> schemas = pathToSchemas.get(propertyPathToItem); + if (schemas == null) { + throw new RuntimeException("Validation 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"); + } + properties.put(propertyName, (Object) propertyInstance); + } + FrozenMap castProperties = new FrozenMap<>(properties); + return new MultiPropertiesSchemaMap(castProperties); + } + + public MultiPropertiesSchemaMap validate(Map arg, SchemaConfiguration configuration) throws ValidationException { + Set> pathSet = new HashSet<>(); + List pathToItem = List.of("args[0"); + Map castArg = castToAllowedTypes(arg, pathToItem, pathSet); + SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().build())); + ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, new PathToSchemasMap(), new LinkedHashSet<>()); + PathToSchemasMap pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet); + return getNewInstance(castArg, validationMetadata.pathToItem(), pathToSchemasMap); + } + + + @Override + public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws 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"); + } + @Override + public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { + if (arg instanceof Map) { + return getNewInstance((Map) arg, pathToItem, pathToSchemas); + } + throw new RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); + } + @Override + public MultiPropertiesSchema1BoxedMap validateAndBox(Map arg, SchemaConfiguration configuration) throws ValidationException { + return new MultiPropertiesSchema1BoxedMap(validate(arg, configuration)); + } + @Override + public MultiPropertiesSchema1Boxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { + 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"); + } + } + +} diff --git a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/schemas/MyObjectDto.kt b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/schemas/MyObjectDto.kt new file mode 100644 index 00000000000..3483de6cfc0 --- /dev/null +++ b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/schemas/MyObjectDto.kt @@ -0,0 +1,208 @@ +package org.openapijsonschematools.client.components.schemas; +import java.util.ArrayList; +import java.util.HashSet; +import java.util.LinkedHashMap; +import java.util.LinkedHashSet; +import java.util.List; +import java.util.Map; +import java.util.Objects; +import java.util.Set; +import org.checkerframework.checker.nullness.qual.Nullable; +import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags; +import org.openapijsonschematools.client.configurations.SchemaConfiguration; +import org.openapijsonschematools.client.exceptions.UnsetPropertyException; +import org.openapijsonschematools.client.exceptions.ValidationException; +import org.openapijsonschematools.client.schemas.AnyTypeJsonSchema; +import org.openapijsonschematools.client.schemas.GenericBuilder; +import org.openapijsonschematools.client.schemas.NotAnyTypeJsonSchema; +import org.openapijsonschematools.client.schemas.UuidJsonSchema; +import org.openapijsonschematools.client.schemas.validation.FrozenMap; +import org.openapijsonschematools.client.schemas.validation.JsonSchema; +import org.openapijsonschematools.client.schemas.validation.JsonSchemaInfo; +import org.openapijsonschematools.client.schemas.validation.MapSchemaValidator; +import org.openapijsonschematools.client.schemas.validation.MapUtils; +import org.openapijsonschematools.client.schemas.validation.PathToSchemasMap; +import org.openapijsonschematools.client.schemas.validation.PropertyEntry; +import org.openapijsonschematools.client.schemas.validation.ValidationMetadata; + +public class MyObjectDto { + // nest classes so all schemas and input/output classes can be public + + + public static class AdditionalProperties extends NotAnyTypeJsonSchema.NotAnyTypeJsonSchema1 { + // NotAnyTypeSchema + private static @Nullable AdditionalProperties instance = null; + public static AdditionalProperties getInstance() { + if (instance == null) { + instance = new AdditionalProperties(); + } + return instance; + } + } + + + public static class Id extends UuidJsonSchema.UuidJsonSchema1 { + private static @Nullable Id instance = null; + public static Id getInstance() { + if (instance == null) { + instance = new Id(); + } + return instance; + } + } + + + public static class MyObjectDtoMap extends FrozenMap { + protected MyObjectDtoMap(FrozenMap m) { + super(m); + } + public static final Set requiredKeys = Set.of(); + public static final Set optionalKeys = Set.of( + "id" + ); + public static MyObjectDtoMap of(Map arg, SchemaConfiguration configuration) throws ValidationException { + return MyObjectDto1.getInstance().validate(arg, configuration); + } + + public String id() throws UnsetPropertyException { + return getOrThrow("id"); + } + } + + public interface SetterForId { + Map getInstance(); + T getBuilderAfterId(Map instance); + + default T id(String value) { + var instance = getInstance(); + instance.put("id", value); + return getBuilderAfterId(instance); + } + } + + public static class MyObjectDtoMapBuilder implements GenericBuilder>, SetterForId { + private final Map instance; + private static final Set knownKeys = Set.of( + "id" + ); + public Set getKnownKeys() { + return knownKeys; + } + public MyObjectDtoMapBuilder() { + this.instance = new LinkedHashMap<>(); + } + public Map build() { + return instance; + } + public Map getInstance() { + return instance; + } + public MyObjectDtoMapBuilder getBuilderAfterId(Map instance) { + return this; + } + } + + + public sealed interface MyObjectDto1Boxed permits MyObjectDto1BoxedMap { + @Nullable Object getData(); + } + + public record MyObjectDto1BoxedMap(MyObjectDtoMap data) implements MyObjectDto1Boxed { + @Override + public @Nullable Object getData() { + return data; + } + } + + + public static class MyObjectDto1 extends JsonSchema implements MapSchemaValidator { + /* + NOTE: This class is auto generated by OpenAPI JSON Schema Generator. + Ref: https://github.com/openapi-json-schema-tools/openapi-json-schema-generator + + Do not edit the class manually. + */ + private static @Nullable MyObjectDto1 instance = null; + + protected MyObjectDto1() { + super(new JsonSchemaInfo() + .type(Set.of(Map.class)) + .properties(Map.ofEntries( + new PropertyEntry("id", Id.class) + )) + .additionalProperties(AdditionalProperties.class) + ); + } + + public static MyObjectDto1 getInstance() { + if (instance == null) { + instance = new MyObjectDto1(); + } + return instance; + } + + 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 RuntimeException("Invalid non-string key value"); + } + String propertyName = (String) entryKey; + List propertyPathToItem = new ArrayList<>(pathToItem); + propertyPathToItem.add(propertyName); + Object value = entry.getValue(); + LinkedHashMap, Nothing?> schemas = pathToSchemas.get(propertyPathToItem); + if (schemas == null) { + throw new RuntimeException("Validation 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"); + } + properties.put(propertyName, (String) propertyInstance); + } + FrozenMap castProperties = new FrozenMap<>(properties); + return new MyObjectDtoMap(castProperties); + } + + 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); + SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().build())); + ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, new PathToSchemasMap(), new LinkedHashSet<>()); + PathToSchemasMap pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet); + return getNewInstance(castArg, validationMetadata.pathToItem(), pathToSchemasMap); + } + + + @Override + public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws 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"); + } + @Override + public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { + if (arg instanceof Map) { + return getNewInstance((Map) arg, pathToItem, pathToSchemas); + } + 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 { + return new MyObjectDto1BoxedMap(validate(arg, configuration)); + } + @Override + public MyObjectDto1Boxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { + 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"); + } + } + +} diff --git a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/schemas/Name.kt b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/schemas/Name.kt new file mode 100644 index 00000000000..a66b87538f1 --- /dev/null +++ b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/schemas/Name.kt @@ -0,0 +1,512 @@ +package org.openapijsonschematools.client.components.schemas; +import java.time.LocalDate; +import java.time.ZonedDateTime; +import java.util.ArrayList; +import java.util.HashSet; +import java.util.LinkedHashMap; +import java.util.LinkedHashSet; +import java.util.List; +import java.util.Map; +import java.util.Objects; +import java.util.Set; +import java.util.UUID; +import org.checkerframework.checker.nullness.qual.Nullable; +import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags; +import org.openapijsonschematools.client.configurations.SchemaConfiguration; +import org.openapijsonschematools.client.exceptions.InvalidAdditionalPropertyException; +import org.openapijsonschematools.client.exceptions.UnsetPropertyException; +import org.openapijsonschematools.client.exceptions.ValidationException; +import org.openapijsonschematools.client.schemas.GenericBuilder; +import org.openapijsonschematools.client.schemas.Int32JsonSchema; +import org.openapijsonschematools.client.schemas.StringJsonSchema; +import org.openapijsonschematools.client.schemas.UnsetAddPropsSetter; +import org.openapijsonschematools.client.schemas.validation.BooleanSchemaValidator; +import org.openapijsonschematools.client.schemas.validation.FrozenList; +import org.openapijsonschematools.client.schemas.validation.FrozenMap; +import org.openapijsonschematools.client.schemas.validation.JsonSchema; +import org.openapijsonschematools.client.schemas.validation.JsonSchemaInfo; +import org.openapijsonschematools.client.schemas.validation.ListSchemaValidator; +import org.openapijsonschematools.client.schemas.validation.MapSchemaValidator; +import org.openapijsonschematools.client.schemas.validation.NullSchemaValidator; +import org.openapijsonschematools.client.schemas.validation.NumberSchemaValidator; +import org.openapijsonschematools.client.schemas.validation.PathToSchemasMap; +import org.openapijsonschematools.client.schemas.validation.PropertyEntry; +import org.openapijsonschematools.client.schemas.validation.StringSchemaValidator; +import org.openapijsonschematools.client.schemas.validation.ValidationMetadata; + +public class Name { + // nest classes so all schemas and input/output classes can be public + + + public static class Name2 extends Int32JsonSchema.Int32JsonSchema1 { + private static @Nullable Name2 instance = null; + public static Name2 getInstance() { + if (instance == null) { + instance = new Name2(); + } + return instance; + } + } + + + public static class SnakeCase extends Int32JsonSchema.Int32JsonSchema1 { + private static @Nullable SnakeCase instance = null; + public static SnakeCase getInstance() { + if (instance == null) { + instance = new SnakeCase(); + } + return instance; + } + } + + + public static class Property extends StringJsonSchema.StringJsonSchema1 { + private static @Nullable Property instance = null; + public static Property getInstance() { + if (instance == null) { + instance = new Property(); + } + return instance; + } + } + + + public static class NameMap extends FrozenMap<@Nullable Object> { + protected NameMap(FrozenMap<@Nullable Object> m) { + super(m); + } + public static final Set requiredKeys = Set.of( + "name" + ); + public static final Set optionalKeys = Set.of( + "snake_case", + "property" + ); + public static NameMap of(Map arg, SchemaConfiguration configuration) throws ValidationException { + return Name1.getInstance().validate(arg, configuration); + } + + public Number name() { + @Nullable Object value = get("name"); + if (!(value instanceof Number)) { + throw new RuntimeException("Invalid value stored for name"); + } + return (Number) value; + } + + public Number snake_case() throws UnsetPropertyException { + String key = "snake_case"; + throwIfKeyNotPresent(key); + @Nullable Object value = get(key); + if (!(value instanceof Number)) { + throw new RuntimeException("Invalid value stored for snake_case"); + } + return (Number) value; + } + + public String property() throws UnsetPropertyException { + String key = "property"; + throwIfKeyNotPresent(key); + @Nullable Object value = get(key); + if (!(value instanceof String)) { + throw new RuntimeException("Invalid value stored for property"); + } + return (String) value; + } + + public @Nullable Object getAdditionalProperty(String name) throws UnsetPropertyException, InvalidAdditionalPropertyException { + throwIfKeyKnown(name, requiredKeys, optionalKeys); + throwIfKeyNotPresent(name); + return get(name); + } + } + + public interface SetterForName2 { + Map getInstance(); + T getBuilderAfterName2(Map instance); + + default T name(int value) { + var instance = getInstance(); + instance.put("name", value); + return getBuilderAfterName2(instance); + } + + default T name(float value) { + var instance = getInstance(); + instance.put("name", value); + return getBuilderAfterName2(instance); + } + } + + public interface SetterForSnakeCase { + Map getInstance(); + T getBuilderAfterSnakeCase(Map instance); + + default T snake_case(int value) { + var instance = getInstance(); + instance.put("snake_case", value); + return getBuilderAfterSnakeCase(instance); + } + + default T snake_case(float value) { + var instance = getInstance(); + instance.put("snake_case", value); + return getBuilderAfterSnakeCase(instance); + } + } + + public interface SetterForProperty { + Map getInstance(); + T getBuilderAfterProperty(Map instance); + + default T property(String value) { + var instance = getInstance(); + instance.put("property", value); + return getBuilderAfterProperty(instance); + } + } + + public static class NameMap0Builder extends UnsetAddPropsSetter implements GenericBuilder>, SetterForSnakeCase, SetterForProperty { + private final Map instance; + private static final Set knownKeys = Set.of( + "name", + "snake_case", + "property" + ); + public Set getKnownKeys() { + return knownKeys; + } + public NameMap0Builder(Map instance) { + this.instance = instance; + } + public Map build() { + return instance; + } + public Map getInstance() { + return instance; + } + public NameMap0Builder getBuilderAfterSnakeCase(Map instance) { + return this; + } + public NameMap0Builder getBuilderAfterProperty(Map instance) { + return this; + } + public NameMap0Builder getBuilderAfterAdditionalProperty(Map instance) { + return this; + } + } + + public static class NameMapBuilder1 implements SetterForName2 { + private final Map instance; + public NameMapBuilder1() { + this.instance = new LinkedHashMap<>(); + } + public Map getInstance() { + return instance; + } + public NameMap0Builder getBuilderAfterName2(Map instance) { + return new NameMap0Builder(instance); + } + } + + + public sealed interface Name1Boxed permits Name1BoxedVoid, Name1BoxedBoolean, Name1BoxedNumber, Name1BoxedString, Name1BoxedList, Name1BoxedMap { + @Nullable Object getData(); + } + + public record Name1BoxedVoid(Nothing? data) implements Name1Boxed { + @Override + public @Nullable Object getData() { + return data; + } + } + + public record Name1BoxedBoolean(boolean data) implements Name1Boxed { + @Override + public @Nullable Object getData() { + return data; + } + } + + public record Name1BoxedNumber(Number data) implements Name1Boxed { + @Override + public @Nullable Object getData() { + return data; + } + } + + public record Name1BoxedString(String data) implements Name1Boxed { + @Override + public @Nullable Object getData() { + return data; + } + } + + public record Name1BoxedList(FrozenList<@Nullable Object> data) implements Name1Boxed { + @Override + public @Nullable Object getData() { + return data; + } + } + + public record Name1BoxedMap(NameMap data) implements Name1Boxed { + @Override + public @Nullable Object getData() { + return data; + } + } + + + public static class Name1 extends JsonSchema implements NullSchemaValidator, BooleanSchemaValidator, NumberSchemaValidator, StringSchemaValidator, ListSchemaValidator, Name1BoxedList>, MapSchemaValidator { + /* + NOTE: This class is auto generated by OpenAPI JSON Schema Generator. + Ref: https://github.com/openapi-json-schema-tools/openapi-json-schema-generator + + Do not edit the class manually. + + Model for testing model name same as property name + */ + private static @Nullable Name1 instance = null; + + protected Name1() { + super(new JsonSchemaInfo() + .properties(Map.ofEntries( + new PropertyEntry("name", Name2.class), + new PropertyEntry("snake_case", SnakeCase.class), + new PropertyEntry("property", Property.class) + )) + .required(Set.of( + "name" + )) + ); + } + + public static Name1 getInstance() { + if (instance == null) { + instance = new Name1(); + } + return instance; + } + + @Override + public Nothing? validate(Nothing? arg, SchemaConfiguration configuration) throws ValidationException { + Set> pathSet = new HashSet<>(); + List pathToItem = List.of("args[0]"); + Nothing? castArg = castToAllowedTypes(arg, pathToItem, pathSet); + SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().build())); + PathToSchemasMap validatedPathToSchemas = new PathToSchemasMap(); + ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, new LinkedHashSet<>()); + getPathToSchemas(this, castArg, validationMetadata, pathSet); + return castArg; + } + + @Override + public boolean validate(boolean arg, SchemaConfiguration configuration) throws ValidationException { + Set> pathSet = new HashSet<>(); + List pathToItem = List.of("args[0]"); + boolean castArg = castToAllowedTypes(arg, pathToItem, pathSet); + SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().build())); + PathToSchemasMap validatedPathToSchemas = new PathToSchemasMap(); + ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, new LinkedHashSet<>()); + getPathToSchemas(this, castArg, validationMetadata, pathSet); + return castArg; + } + + @Override + public Number validate(Number arg, SchemaConfiguration configuration) throws ValidationException { + Set> pathSet = new HashSet<>(); + List pathToItem = List.of("args[0]"); + Number castArg = castToAllowedTypes(arg, pathToItem, pathSet); + SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().build())); + PathToSchemasMap validatedPathToSchemas = new PathToSchemasMap(); + ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, new LinkedHashSet<>()); + getPathToSchemas(this, castArg, validationMetadata, pathSet); + return castArg; + } + + public int validate(int arg, SchemaConfiguration configuration) throws ValidationException { + return (int) validate((Number) arg, configuration); + } + + public long validate(long arg, SchemaConfiguration configuration) throws ValidationException { + return (long) validate((Number) arg, configuration); + } + + public float validate(float arg, SchemaConfiguration configuration) throws ValidationException { + return (float) validate((Number) arg, configuration); + } + + public double validate(double arg, SchemaConfiguration configuration) throws ValidationException { + return (double) validate((Number) arg, configuration); + } + + @Override + public String validate(String arg, SchemaConfiguration configuration) throws ValidationException { + Set> pathSet = new HashSet<>(); + List pathToItem = List.of("args[0]"); + String castArg = castToAllowedTypes(arg, pathToItem, pathSet); + SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().build())); + PathToSchemasMap validatedPathToSchemas = new PathToSchemasMap(); + ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, new LinkedHashSet<>()); + getPathToSchemas(this, castArg, validationMetadata, pathSet); + return castArg; + } + + public String validate(LocalDate arg, SchemaConfiguration configuration) throws ValidationException { + return validate(arg.toString(), configuration); + } + + public String validate(ZonedDateTime arg, SchemaConfiguration configuration) throws ValidationException { + return validate(arg.toString(), configuration); + } + + public String validate(UUID arg, SchemaConfiguration configuration) throws ValidationException { + return validate(arg.toString(), configuration); + } + + @Override + public FrozenList<@Nullable Object> getNewInstance(List arg, List pathToItem, PathToSchemasMap pathToSchemas) { + List<@Nullable Object> items = new ArrayList<>(); + int i = 0; + for (Object item: arg) { + List itemPathToItem = new ArrayList<>(pathToItem); + itemPathToItem.add(i); + LinkedHashMap, Nothing?> schemas = pathToSchemas.get(itemPathToItem); + if (schemas == null) { + throw new RuntimeException("Validation result is invalid, schemas must exist for a pathToItem"); + } + JsonSchema itemSchema = schemas.entrySet().iterator().next().getKey(); + @Nullable Object itemInstance = itemSchema.getNewInstance(item, itemPathToItem, pathToSchemas); + items.add(itemInstance); + i += 1; + } + FrozenList<@Nullable Object> newInstanceItems = new FrozenList<>(items); + return newInstanceItems; + } + + 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); + SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().build())); + ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, new PathToSchemasMap(), new LinkedHashSet<>()); + PathToSchemasMap pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet); + return getNewInstance(castArg, validationMetadata.pathToItem(), pathToSchemasMap); + } + + @Override + 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 RuntimeException("Invalid non-string key value"); + } + String propertyName = (String) entryKey; + List propertyPathToItem = new ArrayList<>(pathToItem); + propertyPathToItem.add(propertyName); + Object value = entry.getValue(); + LinkedHashMap, Nothing?> schemas = pathToSchemas.get(propertyPathToItem); + if (schemas == null) { + throw new RuntimeException("Validation result is invalid, schemas must exist for a pathToItem"); + } + JsonSchema propertySchema = schemas.entrySet().iterator().next().getKey(); + @Nullable Object propertyInstance = propertySchema.getNewInstance(value, propertyPathToItem, pathToSchemas); + properties.put(propertyName, propertyInstance); + } + FrozenMap<@Nullable Object> castProperties = new FrozenMap<>(properties); + return new NameMap(castProperties); + } + + 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); + SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().build())); + PathToSchemasMap validatedPathToSchemas = new PathToSchemasMap(); + ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, new LinkedHashSet<>()); + PathToSchemasMap pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet); + return getNewInstance(castArg, validationMetadata.pathToItem(), pathToSchemasMap); + } + + @Override + public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { + if (arg == null) { + return validate((Nothing?) null, configuration); + } else if (arg instanceof Boolean) { + boolean boolArg = (Boolean) arg; + return validate(boolArg, configuration); + } else if (arg instanceof Number) { + return validate((Number) arg, configuration); + } else if (arg instanceof String) { + return validate((String) arg, configuration); + } else if (arg instanceof List) { + return validate((List) arg, 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"); + } + @Override + public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { + if (arg == null) { + return getNewInstance((Nothing?) null, pathToItem, pathToSchemas); + } else if (arg instanceof Boolean) { + boolean boolArg = (Boolean) arg; + return getNewInstance(boolArg, pathToItem, pathToSchemas); + } else if (arg instanceof Number) { + return getNewInstance((Number) arg, pathToItem, pathToSchemas); + } else if (arg instanceof String) { + return getNewInstance((String) arg, pathToItem, pathToSchemas); + } else if (arg instanceof List) { + return getNewInstance((List) arg, 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"); + } + @Override + public Name1BoxedVoid validateAndBox(Nothing? arg, SchemaConfiguration configuration) throws ValidationException { + return new Name1BoxedVoid(validate(arg, configuration)); + } + @Override + 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 { + return new Name1BoxedNumber(validate(arg, configuration)); + } + @Override + 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 { + return new Name1BoxedList(validate(arg, configuration)); + } + @Override + 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 { + if (arg == null) { + Nothing? castArg = (Nothing?) arg; + return validateAndBox(castArg, configuration); + } else if (arg instanceof Boolean booleanArg) { + boolean castArg = booleanArg; + return validateAndBox(castArg, configuration); + } else if (arg instanceof String castArg) { + return validateAndBox(castArg, configuration); + } else if (arg instanceof Number castArg) { + return validateAndBox(castArg, configuration); + } else if (arg instanceof List castArg) { + 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"); + } + } +} diff --git a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/schemas/NoAdditionalProperties.kt b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/schemas/NoAdditionalProperties.kt new file mode 100644 index 00000000000..f21403e41cb --- /dev/null +++ b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/schemas/NoAdditionalProperties.kt @@ -0,0 +1,294 @@ +package org.openapijsonschematools.client.components.schemas; +import java.util.ArrayList; +import java.util.HashSet; +import java.util.LinkedHashMap; +import java.util.LinkedHashSet; +import java.util.List; +import java.util.Map; +import java.util.Objects; +import java.util.Set; +import org.checkerframework.checker.nullness.qual.Nullable; +import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags; +import org.openapijsonschematools.client.configurations.SchemaConfiguration; +import org.openapijsonschematools.client.exceptions.UnsetPropertyException; +import org.openapijsonschematools.client.exceptions.ValidationException; +import org.openapijsonschematools.client.schemas.AnyTypeJsonSchema; +import org.openapijsonschematools.client.schemas.GenericBuilder; +import org.openapijsonschematools.client.schemas.Int64JsonSchema; +import org.openapijsonschematools.client.schemas.NotAnyTypeJsonSchema; +import org.openapijsonschematools.client.schemas.validation.FrozenMap; +import org.openapijsonschematools.client.schemas.validation.JsonSchema; +import org.openapijsonschematools.client.schemas.validation.JsonSchemaInfo; +import org.openapijsonschematools.client.schemas.validation.MapSchemaValidator; +import org.openapijsonschematools.client.schemas.validation.MapUtils; +import org.openapijsonschematools.client.schemas.validation.PathToSchemasMap; +import org.openapijsonschematools.client.schemas.validation.PropertyEntry; +import org.openapijsonschematools.client.schemas.validation.ValidationMetadata; + +public class NoAdditionalProperties { + // nest classes so all schemas and input/output classes can be public + + + public static class AdditionalProperties extends NotAnyTypeJsonSchema.NotAnyTypeJsonSchema1 { + // NotAnyTypeSchema + private static @Nullable AdditionalProperties instance = null; + public static AdditionalProperties getInstance() { + if (instance == null) { + instance = new AdditionalProperties(); + } + return instance; + } + } + + + public static class Id extends Int64JsonSchema.Int64JsonSchema1 { + private static @Nullable Id instance = null; + public static Id getInstance() { + if (instance == null) { + instance = new Id(); + } + return instance; + } + } + + + public static class PetId extends Int64JsonSchema.Int64JsonSchema1 { + private static @Nullable PetId instance = null; + public static PetId getInstance() { + if (instance == null) { + instance = new PetId(); + } + return instance; + } + } + + + public static class NoAdditionalPropertiesMap extends FrozenMap { + protected NoAdditionalPropertiesMap(FrozenMap m) { + super(m); + } + public static final Set requiredKeys = Set.of( + "id" + ); + public static final Set optionalKeys = Set.of( + "petId" + ); + public static NoAdditionalPropertiesMap of(Map arg, SchemaConfiguration configuration) throws ValidationException { + return NoAdditionalProperties1.getInstance().validate(arg, configuration); + } + + public Number id() { + try { + return getOrThrow("version"); + } catch (UnsetPropertyException e) { + throw new RuntimeException(e); + } + } + + public Number petId() throws UnsetPropertyException { + return getOrThrow("petId"); + } + } + + public interface SetterForId { + Map getInstance(); + T getBuilderAfterId(Map instance); + + default T id(int value) { + var instance = getInstance(); + instance.put("id", value); + return getBuilderAfterId(instance); + } + + default T id(float value) { + var instance = getInstance(); + instance.put("id", value); + return getBuilderAfterId(instance); + } + + default T id(long value) { + var instance = getInstance(); + instance.put("id", value); + return getBuilderAfterId(instance); + } + + default T id(double value) { + var instance = getInstance(); + instance.put("id", value); + return getBuilderAfterId(instance); + } + } + + public interface SetterForPetId { + Map getInstance(); + T getBuilderAfterPetId(Map instance); + + default T petId(int value) { + var instance = getInstance(); + instance.put("petId", value); + return getBuilderAfterPetId(instance); + } + + default T petId(float value) { + var instance = getInstance(); + instance.put("petId", value); + return getBuilderAfterPetId(instance); + } + + default T petId(long value) { + var instance = getInstance(); + instance.put("petId", value); + return getBuilderAfterPetId(instance); + } + + default T petId(double value) { + var instance = getInstance(); + instance.put("petId", value); + return getBuilderAfterPetId(instance); + } + } + + public static class NoAdditionalPropertiesMap0Builder implements GenericBuilder>, SetterForPetId { + private final Map instance; + private static final Set knownKeys = Set.of( + "id", + "petId" + ); + public Set getKnownKeys() { + return knownKeys; + } + public NoAdditionalPropertiesMap0Builder(Map instance) { + this.instance = instance; + } + public Map build() { + return instance; + } + public Map getInstance() { + return instance; + } + public NoAdditionalPropertiesMap0Builder getBuilderAfterPetId(Map instance) { + return this; + } + } + + public static class NoAdditionalPropertiesMapBuilder implements SetterForId { + private final Map instance; + public NoAdditionalPropertiesMapBuilder() { + this.instance = new LinkedHashMap<>(); + } + public Map getInstance() { + return instance; + } + public NoAdditionalPropertiesMap0Builder getBuilderAfterId(Map instance) { + return new NoAdditionalPropertiesMap0Builder(instance); + } + } + + + public sealed interface NoAdditionalProperties1Boxed permits NoAdditionalProperties1BoxedMap { + @Nullable Object getData(); + } + + public record NoAdditionalProperties1BoxedMap(NoAdditionalPropertiesMap data) implements NoAdditionalProperties1Boxed { + @Override + public @Nullable Object getData() { + return data; + } + } + + + public static class NoAdditionalProperties1 extends JsonSchema implements MapSchemaValidator { + /* + NOTE: This class is auto generated by OpenAPI JSON Schema Generator. + Ref: https://github.com/openapi-json-schema-tools/openapi-json-schema-generator + + Do not edit the class manually. + */ + private static @Nullable NoAdditionalProperties1 instance = null; + + protected NoAdditionalProperties1() { + super(new JsonSchemaInfo() + .type(Set.of(Map.class)) + .properties(Map.ofEntries( + new PropertyEntry("id", Id.class), + new PropertyEntry("petId", PetId.class) + )) + .required(Set.of( + "id" + )) + .additionalProperties(AdditionalProperties.class) + ); + } + + public static NoAdditionalProperties1 getInstance() { + if (instance == null) { + instance = new NoAdditionalProperties1(); + } + return instance; + } + + 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 RuntimeException("Invalid non-string key value"); + } + String propertyName = (String) entryKey; + List propertyPathToItem = new ArrayList<>(pathToItem); + propertyPathToItem.add(propertyName); + Object value = entry.getValue(); + LinkedHashMap, Nothing?> schemas = pathToSchemas.get(propertyPathToItem); + if (schemas == null) { + throw new RuntimeException("Validation 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"); + } + properties.put(propertyName, (Number) propertyInstance); + } + FrozenMap castProperties = new FrozenMap<>(properties); + return new NoAdditionalPropertiesMap(castProperties); + } + + 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); + SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().build())); + ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, new PathToSchemasMap(), new LinkedHashSet<>()); + PathToSchemasMap pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet); + return getNewInstance(castArg, validationMetadata.pathToItem(), pathToSchemasMap); + } + + + @Override + public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws 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"); + } + @Override + public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { + if (arg instanceof Map) { + return getNewInstance((Map) arg, pathToItem, pathToSchemas); + } + 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 { + return new NoAdditionalProperties1BoxedMap(validate(arg, configuration)); + } + @Override + public NoAdditionalProperties1Boxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { + 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"); + } + } + +} diff --git a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/schemas/NullableClass.kt b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/schemas/NullableClass.kt new file mode 100644 index 00000000000..ee03f17c95d --- /dev/null +++ b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/schemas/NullableClass.kt @@ -0,0 +1,2834 @@ +package org.openapijsonschematools.client.components.schemas; +import java.time.LocalDate; +import java.time.ZonedDateTime; +import java.util.ArrayList; +import java.util.HashSet; +import java.util.LinkedHashMap; +import java.util.LinkedHashSet; +import java.util.List; +import java.util.Map; +import java.util.Objects; +import java.util.Set; +import org.checkerframework.checker.nullness.qual.Nullable; +import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags; +import org.openapijsonschematools.client.configurations.SchemaConfiguration; +import org.openapijsonschematools.client.exceptions.InvalidAdditionalPropertyException; +import org.openapijsonschematools.client.exceptions.UnsetPropertyException; +import org.openapijsonschematools.client.exceptions.ValidationException; +import org.openapijsonschematools.client.schemas.GenericBuilder; +import org.openapijsonschematools.client.schemas.MapJsonSchema; +import org.openapijsonschematools.client.schemas.UnsetAddPropsSetter; +import org.openapijsonschematools.client.schemas.validation.BooleanSchemaValidator; +import org.openapijsonschematools.client.schemas.validation.FrozenList; +import org.openapijsonschematools.client.schemas.validation.FrozenMap; +import org.openapijsonschematools.client.schemas.validation.JsonSchema; +import org.openapijsonschematools.client.schemas.validation.JsonSchemaInfo; +import org.openapijsonschematools.client.schemas.validation.ListSchemaValidator; +import org.openapijsonschematools.client.schemas.validation.MapSchemaValidator; +import org.openapijsonschematools.client.schemas.validation.MapUtils; +import org.openapijsonschematools.client.schemas.validation.NullSchemaValidator; +import org.openapijsonschematools.client.schemas.validation.NumberSchemaValidator; +import org.openapijsonschematools.client.schemas.validation.PathToSchemasMap; +import org.openapijsonschematools.client.schemas.validation.PropertyEntry; +import org.openapijsonschematools.client.schemas.validation.StringSchemaValidator; +import org.openapijsonschematools.client.schemas.validation.ValidationMetadata; + +public class NullableClass { + // nest classes so all schemas and input/output classes can be public + + + public sealed interface AdditionalProperties3Boxed permits AdditionalProperties3BoxedNothing?, AdditionalProperties3BoxedMap { + @Nullable Object getData(); + } + + public record AdditionalProperties3BoxedVoid(Nothing? data) implements AdditionalProperties3Boxed { + @Override + public @Nullable Object getData() { + return data; + } + } + + public record AdditionalProperties3BoxedMap(FrozenMap<@Nullable Object> data) implements AdditionalProperties3Boxed { + @Override + public @Nullable Object getData() { + return data; + } + } + + + public static class AdditionalProperties3 extends JsonSchema implements NullSchemaValidator, MapSchemaValidator, AdditionalProperties3BoxedMap> { + private static @Nullable AdditionalProperties3 instance = null; + + protected AdditionalProperties3() { + super(new JsonSchemaInfo() + .type(Set.of( + Nothing?.class, + Map.class + )) + ); + } + + public static AdditionalProperties3 getInstance() { + if (instance == null) { + instance = new AdditionalProperties3(); + } + return instance; + } + + @Override + public Nothing? validate(Nothing? arg, SchemaConfiguration configuration) throws ValidationException { + Set> pathSet = new HashSet<>(); + List pathToItem = List.of("args[0"); + Nothing? castArg = castToAllowedTypes(arg, pathToItem, pathSet); + SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().build())); + ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, new PathToSchemasMap(), new LinkedHashSet<>()); + getPathToSchemas(this, castArg, validationMetadata, pathSet); + return castArg; + } + + 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 RuntimeException("Invalid non-string key value"); + } + String propertyName = (String) entryKey; + List propertyPathToItem = new ArrayList<>(pathToItem); + propertyPathToItem.add(propertyName); + Object value = entry.getValue(); + LinkedHashMap, Nothing?> schemas = pathToSchemas.get(propertyPathToItem); + if (schemas == null) { + throw new RuntimeException("Validation result is invalid, schemas must exist for a pathToItem"); + } + JsonSchema propertySchema = schemas.entrySet().iterator().next().getKey(); + @Nullable Object propertyInstance = propertySchema.getNewInstance(value, propertyPathToItem, pathToSchemas); + properties.put(propertyName, propertyInstance); + } + FrozenMap<@Nullable Object> castProperties = new FrozenMap<>(properties); + return castProperties; + } + + public FrozenMap<@Nullable Object> validate(Map arg, SchemaConfiguration configuration) throws ValidationException { + Set> pathSet = new HashSet<>(); + List pathToItem = List.of("args[0"); + Map castArg = castToAllowedTypes(arg, pathToItem, pathSet); + SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().build())); + ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, new PathToSchemasMap(), new LinkedHashSet<>()); + PathToSchemasMap pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet); + return getNewInstance(castArg, validationMetadata.pathToItem(), pathToSchemasMap); + } + + + @Override + public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { + if (arg == null) { + return validate((Nothing?) 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"); + } + @Override + public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { + if (arg == null) { + return getNewInstance((Nothing?) 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"); + } + @Override + public AdditionalProperties3BoxedVoid validateAndBox(Nothing? arg, SchemaConfiguration configuration) throws ValidationException { + return new AdditionalProperties3BoxedVoid(validate(arg, configuration)); + } + @Override + 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 { + if (arg == null) { + Nothing? castArg = (Nothing?) 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"); + } + } + + public sealed interface IntegerPropBoxed permits IntegerPropBoxedNothing?, IntegerPropBoxedNumber { + @Nullable Object getData(); + } + + public record IntegerPropBoxedVoid(Nothing? data) implements IntegerPropBoxed { + @Override + public @Nullable Object getData() { + return data; + } + } + + public record IntegerPropBoxedNumber(Number data) implements IntegerPropBoxed { + @Override + public @Nullable Object getData() { + return data; + } + } + + + + public static class IntegerProp extends JsonSchema implements NullSchemaValidator, NumberSchemaValidator { + private static @Nullable IntegerProp instance = null; + + protected IntegerProp() { + super(new JsonSchemaInfo() + .type(Set.of( + Nothing?.class, + Integer.class, + Long.class, + Float.class, + Double.class + )) + .format("int") + ); + } + + public static IntegerProp getInstance() { + if (instance == null) { + instance = new IntegerProp(); + } + return instance; + } + + @Override + public Nothing? validate(Nothing? arg, SchemaConfiguration configuration) throws ValidationException { + Set> pathSet = new HashSet<>(); + List pathToItem = List.of("args[0"); + Nothing? castArg = castToAllowedTypes(arg, pathToItem, pathSet); + SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().build())); + ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, new PathToSchemasMap(), new LinkedHashSet<>()); + getPathToSchemas(this, castArg, validationMetadata, pathSet); + return castArg; + } + + @Override + public Number validate(Number arg, SchemaConfiguration configuration) throws ValidationException { + Set> pathSet = new HashSet<>(); + List pathToItem = List.of("args[0"); + Number castArg = castToAllowedTypes(arg, pathToItem, pathSet); + SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().build())); + ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, new PathToSchemasMap(), new LinkedHashSet<>()); + getPathToSchemas(this, castArg, validationMetadata, pathSet); + return castArg; + } + + public int validate(int arg, SchemaConfiguration configuration) throws ValidationException { + return (int) validate((Number) arg, configuration); + } + + public float validate(float arg, SchemaConfiguration configuration) throws ValidationException { + return (float) validate((Number) arg, configuration); + } + + public long validate(long arg, SchemaConfiguration configuration) throws ValidationException { + return (long) validate((Number) arg, configuration); + } + + 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 { + if (arg == null) { + return validate((Nothing?) 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"); + } + @Override + public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { + if (arg == null) { + return getNewInstance((Nothing?) 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"); + } + @Override + public IntegerPropBoxedVoid validateAndBox(Nothing? arg, SchemaConfiguration configuration) throws ValidationException { + return new IntegerPropBoxedVoid(validate(arg, configuration)); + } + @Override + 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 { + if (arg == null) { + Nothing? castArg = (Nothing?) 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"); + } + } + + public sealed interface NumberPropBoxed permits NumberPropBoxedNothing?, NumberPropBoxedNumber { + @Nullable Object getData(); + } + + public record NumberPropBoxedVoid(Nothing? data) implements NumberPropBoxed { + @Override + public @Nullable Object getData() { + return data; + } + } + + public record NumberPropBoxedNumber(Number data) implements NumberPropBoxed { + @Override + public @Nullable Object getData() { + return data; + } + } + + + + public static class NumberProp extends JsonSchema implements NullSchemaValidator, NumberSchemaValidator { + private static @Nullable NumberProp instance = null; + + protected NumberProp() { + super(new JsonSchemaInfo() + .type(Set.of( + Nothing?.class, + Integer.class, + Long.class, + Float.class, + Double.class + )) + ); + } + + public static NumberProp getInstance() { + if (instance == null) { + instance = new NumberProp(); + } + return instance; + } + + @Override + public Nothing? validate(Nothing? arg, SchemaConfiguration configuration) throws ValidationException { + Set> pathSet = new HashSet<>(); + List pathToItem = List.of("args[0"); + Nothing? castArg = castToAllowedTypes(arg, pathToItem, pathSet); + SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().build())); + ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, new PathToSchemasMap(), new LinkedHashSet<>()); + getPathToSchemas(this, castArg, validationMetadata, pathSet); + return castArg; + } + + @Override + public Number validate(Number arg, SchemaConfiguration configuration) throws ValidationException { + Set> pathSet = new HashSet<>(); + List pathToItem = List.of("args[0"); + Number castArg = castToAllowedTypes(arg, pathToItem, pathSet); + SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().build())); + ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, new PathToSchemasMap(), new LinkedHashSet<>()); + PathToSchemasMap pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet); + return castArg; + } + + public int validate(int arg, SchemaConfiguration configuration) throws ValidationException { + return (int) validate((Number) arg, configuration); + } + + public long validate(long arg, SchemaConfiguration configuration) throws ValidationException { + return (long) validate((Number) arg, configuration); + } + + public float validate(float arg, SchemaConfiguration configuration) throws ValidationException { + return (float) validate((Number) arg, configuration); + } + + 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 { + if (arg == null) { + return validate((Nothing?) 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"); + } + @Override + public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { + if (arg == null) { + return getNewInstance((Nothing?) 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"); + } + @Override + public NumberPropBoxedVoid validateAndBox(Nothing? arg, SchemaConfiguration configuration) throws ValidationException { + return new NumberPropBoxedVoid(validate(arg, configuration)); + } + @Override + 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 { + if (arg == null) { + Nothing? castArg = (Nothing?) 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"); + } + } + + public sealed interface BooleanPropBoxed permits BooleanPropBoxedNothing?, BooleanPropBoxedBoolean { + @Nullable Object getData(); + } + + public record BooleanPropBoxedVoid(Nothing? data) implements BooleanPropBoxed { + @Override + public @Nullable Object getData() { + return data; + } + } + + public record BooleanPropBoxedBoolean(boolean data) implements BooleanPropBoxed { + @Override + public @Nullable Object getData() { + return data; + } + } + + + + public static class BooleanProp extends JsonSchema implements NullSchemaValidator, BooleanSchemaValidator { + private static @Nullable BooleanProp instance = null; + + protected BooleanProp() { + super(new JsonSchemaInfo() + .type(Set.of( + Nothing?.class, + Boolean.class + )) + ); + } + + public static BooleanProp getInstance() { + if (instance == null) { + instance = new BooleanProp(); + } + return instance; + } + + @Override + public Nothing? validate(Nothing? arg, SchemaConfiguration configuration) throws ValidationException { + Set> pathSet = new HashSet<>(); + List pathToItem = List.of("args[0"); + Nothing? castArg = castToAllowedTypes(arg, pathToItem, pathSet); + SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().build())); + ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, new PathToSchemasMap(), new LinkedHashSet<>()); + getPathToSchemas(this, castArg, validationMetadata, pathSet); + return castArg; + } + + @Override + public boolean validate(boolean arg, SchemaConfiguration configuration) throws ValidationException { + Set> pathSet = new HashSet<>(); + List pathToItem = List.of("args[0"); + boolean castArg = castToAllowedTypes(arg, pathToItem, pathSet); + SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().build())); + ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, new PathToSchemasMap(), new LinkedHashSet<>()); + getPathToSchemas(this, castArg, validationMetadata, pathSet); + return castArg; + } + + @Override + public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { + if (arg == null) { + return validate((Nothing?) 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"); + } + @Override + public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { + if (arg == null) { + return getNewInstance((Nothing?) 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"); + } + @Override + public BooleanPropBoxedVoid validateAndBox(Nothing? arg, SchemaConfiguration configuration) throws ValidationException { + return new BooleanPropBoxedVoid(validate(arg, configuration)); + } + @Override + 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 { + if (arg == null) { + Nothing? castArg = (Nothing?) arg; + return validateAndBox(castArg, configuration); + } else 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"); + } + } + + public sealed interface StringPropBoxed permits StringPropBoxedNothing?, StringPropBoxedString { + @Nullable Object getData(); + } + + public record StringPropBoxedVoid(Nothing? data) implements StringPropBoxed { + @Override + public @Nullable Object getData() { + return data; + } + } + + public record StringPropBoxedString(String data) implements StringPropBoxed { + @Override + public @Nullable Object getData() { + return data; + } + } + + + + public static class StringProp extends JsonSchema implements NullSchemaValidator, StringSchemaValidator { + private static @Nullable StringProp instance = null; + + protected StringProp() { + super(new JsonSchemaInfo() + .type(Set.of( + Nothing?.class, + String.class + )) + ); + } + + public static StringProp getInstance() { + if (instance == null) { + instance = new StringProp(); + } + return instance; + } + + @Override + public Nothing? validate(Nothing? arg, SchemaConfiguration configuration) throws ValidationException { + Set> pathSet = new HashSet<>(); + List pathToItem = List.of("args[0"); + Nothing? castArg = castToAllowedTypes(arg, pathToItem, pathSet); + SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().build())); + ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, new PathToSchemasMap(), new LinkedHashSet<>()); + getPathToSchemas(this, castArg, validationMetadata, pathSet); + return castArg; + } + + @Override + public String validate(String arg, SchemaConfiguration configuration) throws ValidationException { + Set> pathSet = new HashSet<>(); + List pathToItem = List.of("args[0"); + String castArg = castToAllowedTypes(arg, pathToItem, pathSet); + SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().build())); + ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, new PathToSchemasMap(), new LinkedHashSet<>()); + getPathToSchemas(this, castArg, validationMetadata, pathSet); + return castArg; + } + + @Override + public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { + if (arg == null) { + return validate((Nothing?) 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"); + } + @Override + public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { + if (arg == null) { + return getNewInstance((Nothing?) 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"); + } + @Override + public StringPropBoxedVoid validateAndBox(Nothing? arg, SchemaConfiguration configuration) throws ValidationException { + return new StringPropBoxedVoid(validate(arg, configuration)); + } + @Override + 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 { + if (arg == null) { + Nothing? castArg = (Nothing?) 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"); + } + } + + public sealed interface DatePropBoxed permits DatePropBoxedNothing?, DatePropBoxedString { + @Nullable Object getData(); + } + + public record DatePropBoxedVoid(Nothing? data) implements DatePropBoxed { + @Override + public @Nullable Object getData() { + return data; + } + } + + public record DatePropBoxedString(String data) implements DatePropBoxed { + @Override + public @Nullable Object getData() { + return data; + } + } + + + + public static class DateProp extends JsonSchema implements NullSchemaValidator, StringSchemaValidator { + private static @Nullable DateProp instance = null; + + protected DateProp() { + super(new JsonSchemaInfo() + .type(Set.of( + Nothing?.class, + String.class + )) + .format("date") + ); + } + + public static DateProp getInstance() { + if (instance == null) { + instance = new DateProp(); + } + return instance; + } + + @Override + public Nothing? validate(Nothing? arg, SchemaConfiguration configuration) throws ValidationException { + Set> pathSet = new HashSet<>(); + List pathToItem = List.of("args[0"); + Nothing? castArg = castToAllowedTypes(arg, pathToItem, pathSet); + SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().build())); + ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, new PathToSchemasMap(), new LinkedHashSet<>()); + getPathToSchemas(this, castArg, validationMetadata, pathSet); + return castArg; + } + + @Override + public String validate(String arg, SchemaConfiguration configuration) throws ValidationException { + Set> pathSet = new HashSet<>(); + List pathToItem = List.of("args[0"); + String castArg = castToAllowedTypes(arg, pathToItem, pathSet); + SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().build())); + ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, new PathToSchemasMap(), new LinkedHashSet<>()); + getPathToSchemas(this, castArg, validationMetadata, pathSet); + return castArg; + } + + @Override + public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { + if (arg == null) { + return validate((Nothing?) 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"); + } + @Override + public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { + if (arg == null) { + return getNewInstance((Nothing?) 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"); + } + @Override + public DatePropBoxedVoid validateAndBox(Nothing? arg, SchemaConfiguration configuration) throws ValidationException { + return new DatePropBoxedVoid(validate(arg, configuration)); + } + @Override + 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 { + if (arg == null) { + Nothing? castArg = (Nothing?) 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"); + } + } + + public sealed interface DatetimePropBoxed permits DatetimePropBoxedNothing?, DatetimePropBoxedString { + @Nullable Object getData(); + } + + public record DatetimePropBoxedVoid(Nothing? data) implements DatetimePropBoxed { + @Override + public @Nullable Object getData() { + return data; + } + } + + public record DatetimePropBoxedString(String data) implements DatetimePropBoxed { + @Override + public @Nullable Object getData() { + return data; + } + } + + + + public static class DatetimeProp extends JsonSchema implements NullSchemaValidator, StringSchemaValidator { + private static @Nullable DatetimeProp instance = null; + + protected DatetimeProp() { + super(new JsonSchemaInfo() + .type(Set.of( + Nothing?.class, + String.class + )) + .format("date-time") + ); + } + + public static DatetimeProp getInstance() { + if (instance == null) { + instance = new DatetimeProp(); + } + return instance; + } + + @Override + public Nothing? validate(Nothing? arg, SchemaConfiguration configuration) throws ValidationException { + Set> pathSet = new HashSet<>(); + List pathToItem = List.of("args[0"); + Nothing? castArg = castToAllowedTypes(arg, pathToItem, pathSet); + SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().build())); + ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, new PathToSchemasMap(), new LinkedHashSet<>()); + getPathToSchemas(this, castArg, validationMetadata, pathSet); + return castArg; + } + + @Override + public String validate(String arg, SchemaConfiguration configuration) throws ValidationException { + Set> pathSet = new HashSet<>(); + List pathToItem = List.of("args[0"); + String castArg = castToAllowedTypes(arg, pathToItem, pathSet); + SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().build())); + ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, new PathToSchemasMap(), new LinkedHashSet<>()); + getPathToSchemas(this, castArg, validationMetadata, pathSet); + return castArg; + } + + @Override + public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { + if (arg == null) { + return validate((Nothing?) 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"); + } + @Override + public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { + if (arg == null) { + return getNewInstance((Nothing?) 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"); + } + @Override + public DatetimePropBoxedVoid validateAndBox(Nothing? arg, SchemaConfiguration configuration) throws ValidationException { + return new DatetimePropBoxedVoid(validate(arg, configuration)); + } + @Override + 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 { + if (arg == null) { + Nothing? castArg = (Nothing?) 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"); + } + } + + public static class Items extends MapJsonSchema.MapJsonSchema1 { + private static @Nullable Items instance = null; + public static Items getInstance() { + if (instance == null) { + instance = new Items(); + } + return instance; + } + } + + + public static class ArrayNullablePropList extends FrozenList> { + protected ArrayNullablePropList(FrozenList> m) { + super(m); + } + public static ArrayNullablePropList of(List> arg, SchemaConfiguration configuration) throws ValidationException { + return ArrayNullableProp.getInstance().validate(arg, configuration); + } + } + + public static class ArrayNullablePropListBuilder { + // class to build List> + private final List> list; + + public ArrayNullablePropListBuilder() { + list = new ArrayList<>(); + } + + public ArrayNullablePropListBuilder(List> list) { + this.list = list; + } + + public ArrayNullablePropListBuilder add(Map item) { + list.add(item); + return this; + } + + public List> build() { + return list; + } + } + + + public sealed interface ArrayNullablePropBoxed permits ArrayNullablePropBoxedNothing?, ArrayNullablePropBoxedList { + @Nullable Object getData(); + } + + public record ArrayNullablePropBoxedVoid(Nothing? data) implements ArrayNullablePropBoxed { + @Override + public @Nullable Object getData() { + return data; + } + } + + public record ArrayNullablePropBoxedList(ArrayNullablePropList data) implements ArrayNullablePropBoxed { + @Override + public @Nullable Object getData() { + return data; + } + } + + + + public static class ArrayNullableProp extends JsonSchema implements NullSchemaValidator, ListSchemaValidator { + private static @Nullable ArrayNullableProp instance = null; + + protected ArrayNullableProp() { + super(new JsonSchemaInfo() + .type(Set.of( + Nothing?.class, + List.class + )) + .items(Items.class) + ); + } + + public static ArrayNullableProp getInstance() { + if (instance == null) { + instance = new ArrayNullableProp(); + } + return instance; + } + + @Override + public Nothing? validate(Nothing? arg, SchemaConfiguration configuration) throws ValidationException { + Set> pathSet = new HashSet<>(); + List pathToItem = List.of("args[0"); + Nothing? castArg = castToAllowedTypes(arg, pathToItem, pathSet); + SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().build())); + ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, new PathToSchemasMap(), new LinkedHashSet<>()); + getPathToSchemas(this, castArg, validationMetadata, pathSet); + return castArg; + } + + @Override + public ArrayNullablePropList getNewInstance(List arg, List pathToItem, PathToSchemasMap pathToSchemas) { + List> items = new ArrayList<>(); + int i = 0; + for (Object item: arg) { + List itemPathToItem = new ArrayList<>(pathToItem); + itemPathToItem.add(i); + LinkedHashMap, Nothing?> schemas = pathToSchemas.get(itemPathToItem); + if (schemas == null) { + throw new RuntimeException("Validation 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"); + } + items.add((FrozenMap) itemInstance); + i += 1; + } + FrozenList> newInstanceItems = new FrozenList<>(items); + return new ArrayNullablePropList(newInstanceItems); + } + + 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); + SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().build())); + ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, new PathToSchemasMap(), new LinkedHashSet<>()); + PathToSchemasMap pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet); + return getNewInstance(castArg, validationMetadata.pathToItem(), pathToSchemasMap); + } + + @Override + public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { + if (arg == null) { + return validate((Nothing?) 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"); + } + @Override + public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { + if (arg == null) { + return getNewInstance((Nothing?) 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"); + } + @Override + public ArrayNullablePropBoxedVoid validateAndBox(Nothing? arg, SchemaConfiguration configuration) throws ValidationException { + return new ArrayNullablePropBoxedVoid(validate(arg, configuration)); + } + @Override + 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 { + if (arg == null) { + Nothing? castArg = (Nothing?) 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"); + } + } + + public sealed interface Items1Boxed permits Items1BoxedNothing?, Items1BoxedMap { + @Nullable Object getData(); + } + + public record Items1BoxedVoid(Nothing? data) implements Items1Boxed { + @Override + public @Nullable Object getData() { + return data; + } + } + + public record Items1BoxedMap(FrozenMap<@Nullable Object> data) implements Items1Boxed { + @Override + public @Nullable Object getData() { + return data; + } + } + + + public static class Items1 extends JsonSchema implements NullSchemaValidator, MapSchemaValidator, Items1BoxedMap> { + private static @Nullable Items1 instance = null; + + protected Items1() { + super(new JsonSchemaInfo() + .type(Set.of( + Nothing?.class, + Map.class + )) + ); + } + + public static Items1 getInstance() { + if (instance == null) { + instance = new Items1(); + } + return instance; + } + + @Override + public Nothing? validate(Nothing? arg, SchemaConfiguration configuration) throws ValidationException { + Set> pathSet = new HashSet<>(); + List pathToItem = List.of("args[0"); + Nothing? castArg = castToAllowedTypes(arg, pathToItem, pathSet); + SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().build())); + ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, new PathToSchemasMap(), new LinkedHashSet<>()); + getPathToSchemas(this, castArg, validationMetadata, pathSet); + return castArg; + } + + 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 RuntimeException("Invalid non-string key value"); + } + String propertyName = (String) entryKey; + List propertyPathToItem = new ArrayList<>(pathToItem); + propertyPathToItem.add(propertyName); + Object value = entry.getValue(); + LinkedHashMap, Nothing?> schemas = pathToSchemas.get(propertyPathToItem); + if (schemas == null) { + throw new RuntimeException("Validation result is invalid, schemas must exist for a pathToItem"); + } + JsonSchema propertySchema = schemas.entrySet().iterator().next().getKey(); + @Nullable Object propertyInstance = propertySchema.getNewInstance(value, propertyPathToItem, pathToSchemas); + properties.put(propertyName, propertyInstance); + } + FrozenMap<@Nullable Object> castProperties = new FrozenMap<>(properties); + return castProperties; + } + + public FrozenMap<@Nullable Object> validate(Map arg, SchemaConfiguration configuration) throws ValidationException { + Set> pathSet = new HashSet<>(); + List pathToItem = List.of("args[0"); + Map castArg = castToAllowedTypes(arg, pathToItem, pathSet); + SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().build())); + ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, new PathToSchemasMap(), new LinkedHashSet<>()); + PathToSchemasMap pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet); + return getNewInstance(castArg, validationMetadata.pathToItem(), pathToSchemasMap); + } + + + @Override + public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { + if (arg == null) { + return validate((Nothing?) 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"); + } + @Override + public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { + if (arg == null) { + return getNewInstance((Nothing?) 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"); + } + @Override + public Items1BoxedVoid validateAndBox(Nothing? arg, SchemaConfiguration configuration) throws ValidationException { + return new Items1BoxedVoid(validate(arg, configuration)); + } + @Override + 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 { + if (arg == null) { + Nothing? castArg = (Nothing?) 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"); + } + } + + public static class ArrayAndItemsNullablePropList extends FrozenList<@Nullable FrozenMap> { + protected ArrayAndItemsNullablePropList(FrozenList<@Nullable FrozenMap> m) { + super(m); + } + public static ArrayAndItemsNullablePropList of(List> arg, SchemaConfiguration configuration) throws ValidationException { + return ArrayAndItemsNullableProp.getInstance().validate(arg, configuration); + } + } + + public static class ArrayAndItemsNullablePropListBuilder { + // class to build List<@Nullable Map> + private final List<@Nullable Map> list; + + public ArrayAndItemsNullablePropListBuilder() { + list = new ArrayList<>(); + } + + public ArrayAndItemsNullablePropListBuilder(List<@Nullable Map> list) { + this.list = list; + } + + public ArrayAndItemsNullablePropListBuilder add(Nothing? item) { + list.add(null); + return this; + } + + public ArrayAndItemsNullablePropListBuilder add(Map item) { + list.add(item); + return this; + } + + public List<@Nullable Map> build() { + return list; + } + } + + + public sealed interface ArrayAndItemsNullablePropBoxed permits ArrayAndItemsNullablePropBoxedNothing?, ArrayAndItemsNullablePropBoxedList { + @Nullable Object getData(); + } + + public record ArrayAndItemsNullablePropBoxedVoid(Nothing? data) implements ArrayAndItemsNullablePropBoxed { + @Override + public @Nullable Object getData() { + return data; + } + } + + public record ArrayAndItemsNullablePropBoxedList(ArrayAndItemsNullablePropList data) implements ArrayAndItemsNullablePropBoxed { + @Override + public @Nullable Object getData() { + return data; + } + } + + + + public static class ArrayAndItemsNullableProp extends JsonSchema implements NullSchemaValidator, ListSchemaValidator { + private static @Nullable ArrayAndItemsNullableProp instance = null; + + protected ArrayAndItemsNullableProp() { + super(new JsonSchemaInfo() + .type(Set.of( + Nothing?.class, + List.class + )) + .items(Items1.class) + ); + } + + public static ArrayAndItemsNullableProp getInstance() { + if (instance == null) { + instance = new ArrayAndItemsNullableProp(); + } + return instance; + } + + @Override + public Nothing? validate(Nothing? arg, SchemaConfiguration configuration) throws ValidationException { + Set> pathSet = new HashSet<>(); + List pathToItem = List.of("args[0"); + Nothing? castArg = castToAllowedTypes(arg, pathToItem, pathSet); + SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().build())); + ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, new PathToSchemasMap(), new LinkedHashSet<>()); + getPathToSchemas(this, castArg, validationMetadata, pathSet); + return castArg; + } + + @Override + public ArrayAndItemsNullablePropList getNewInstance(List arg, List pathToItem, PathToSchemasMap pathToSchemas) { + List<@Nullable FrozenMap> items = new ArrayList<>(); + int i = 0; + for (Object item: arg) { + List itemPathToItem = new ArrayList<>(pathToItem); + itemPathToItem.add(i); + LinkedHashMap, Nothing?> schemas = pathToSchemas.get(itemPathToItem); + if (schemas == null) { + throw new RuntimeException("Validation 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"); + } + items.add((@Nullable FrozenMap) itemInstance); + i += 1; + } + FrozenList<@Nullable FrozenMap> newInstanceItems = new FrozenList<>(items); + return new ArrayAndItemsNullablePropList(newInstanceItems); + } + + 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); + SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().build())); + ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, new PathToSchemasMap(), new LinkedHashSet<>()); + PathToSchemasMap pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet); + return getNewInstance(castArg, validationMetadata.pathToItem(), pathToSchemasMap); + } + + @Override + public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { + if (arg == null) { + return validate((Nothing?) 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"); + } + @Override + public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { + if (arg == null) { + return getNewInstance((Nothing?) 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"); + } + @Override + public ArrayAndItemsNullablePropBoxedVoid validateAndBox(Nothing? arg, SchemaConfiguration configuration) throws ValidationException { + return new ArrayAndItemsNullablePropBoxedVoid(validate(arg, configuration)); + } + @Override + 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 { + if (arg == null) { + Nothing? castArg = (Nothing?) 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"); + } + } + + public sealed interface Items2Boxed permits Items2BoxedNothing?, Items2BoxedMap { + @Nullable Object getData(); + } + + public record Items2BoxedVoid(Nothing? data) implements Items2Boxed { + @Override + public @Nullable Object getData() { + return data; + } + } + + public record Items2BoxedMap(FrozenMap<@Nullable Object> data) implements Items2Boxed { + @Override + public @Nullable Object getData() { + return data; + } + } + + + public static class Items2 extends JsonSchema implements NullSchemaValidator, MapSchemaValidator, Items2BoxedMap> { + private static @Nullable Items2 instance = null; + + protected Items2() { + super(new JsonSchemaInfo() + .type(Set.of( + Nothing?.class, + Map.class + )) + ); + } + + public static Items2 getInstance() { + if (instance == null) { + instance = new Items2(); + } + return instance; + } + + @Override + public Nothing? validate(Nothing? arg, SchemaConfiguration configuration) throws ValidationException { + Set> pathSet = new HashSet<>(); + List pathToItem = List.of("args[0"); + Nothing? castArg = castToAllowedTypes(arg, pathToItem, pathSet); + SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().build())); + ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, new PathToSchemasMap(), new LinkedHashSet<>()); + getPathToSchemas(this, castArg, validationMetadata, pathSet); + return castArg; + } + + 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 RuntimeException("Invalid non-string key value"); + } + String propertyName = (String) entryKey; + List propertyPathToItem = new ArrayList<>(pathToItem); + propertyPathToItem.add(propertyName); + Object value = entry.getValue(); + LinkedHashMap, Nothing?> schemas = pathToSchemas.get(propertyPathToItem); + if (schemas == null) { + throw new RuntimeException("Validation result is invalid, schemas must exist for a pathToItem"); + } + JsonSchema propertySchema = schemas.entrySet().iterator().next().getKey(); + @Nullable Object propertyInstance = propertySchema.getNewInstance(value, propertyPathToItem, pathToSchemas); + properties.put(propertyName, propertyInstance); + } + FrozenMap<@Nullable Object> castProperties = new FrozenMap<>(properties); + return castProperties; + } + + public FrozenMap<@Nullable Object> validate(Map arg, SchemaConfiguration configuration) throws ValidationException { + Set> pathSet = new HashSet<>(); + List pathToItem = List.of("args[0"); + Map castArg = castToAllowedTypes(arg, pathToItem, pathSet); + SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().build())); + ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, new PathToSchemasMap(), new LinkedHashSet<>()); + PathToSchemasMap pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet); + return getNewInstance(castArg, validationMetadata.pathToItem(), pathToSchemasMap); + } + + + @Override + public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { + if (arg == null) { + return validate((Nothing?) 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"); + } + @Override + public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { + if (arg == null) { + return getNewInstance((Nothing?) 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"); + } + @Override + public Items2BoxedVoid validateAndBox(Nothing? arg, SchemaConfiguration configuration) throws ValidationException { + return new Items2BoxedVoid(validate(arg, configuration)); + } + @Override + 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 { + if (arg == null) { + Nothing? castArg = (Nothing?) 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"); + } + } + + public static class ArrayItemsNullableList extends FrozenList<@Nullable FrozenMap> { + protected ArrayItemsNullableList(FrozenList<@Nullable FrozenMap> m) { + super(m); + } + public static ArrayItemsNullableList of(List> arg, SchemaConfiguration configuration) throws ValidationException { + return ArrayItemsNullable.getInstance().validate(arg, configuration); + } + } + + public static class ArrayItemsNullableListBuilder { + // class to build List<@Nullable Map> + private final List<@Nullable Map> list; + + public ArrayItemsNullableListBuilder() { + list = new ArrayList<>(); + } + + public ArrayItemsNullableListBuilder(List<@Nullable Map> list) { + this.list = list; + } + + public ArrayItemsNullableListBuilder add(Nothing? item) { + list.add(null); + return this; + } + + public ArrayItemsNullableListBuilder add(Map item) { + list.add(item); + return this; + } + + public List<@Nullable Map> build() { + return list; + } + } + + + public sealed interface ArrayItemsNullableBoxed permits ArrayItemsNullableBoxedList { + @Nullable Object getData(); + } + + public record ArrayItemsNullableBoxedList(ArrayItemsNullableList data) implements ArrayItemsNullableBoxed { + @Override + public @Nullable Object getData() { + return data; + } + } + + + + public static class ArrayItemsNullable extends JsonSchema implements ListSchemaValidator { + private static @Nullable ArrayItemsNullable instance = null; + + protected ArrayItemsNullable() { + super(new JsonSchemaInfo() + .type(Set.of(List.class)) + .items(Items2.class) + ); + } + + public static ArrayItemsNullable getInstance() { + if (instance == null) { + instance = new ArrayItemsNullable(); + } + return instance; + } + + @Override + public ArrayItemsNullableList getNewInstance(List arg, List pathToItem, PathToSchemasMap pathToSchemas) { + List<@Nullable FrozenMap> items = new ArrayList<>(); + int i = 0; + for (Object item: arg) { + List itemPathToItem = new ArrayList<>(pathToItem); + itemPathToItem.add(i); + LinkedHashMap, Nothing?> schemas = pathToSchemas.get(itemPathToItem); + if (schemas == null) { + throw new RuntimeException("Validation 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"); + } + items.add((@Nullable FrozenMap) itemInstance); + i += 1; + } + FrozenList<@Nullable FrozenMap> newInstanceItems = new FrozenList<>(items); + return new ArrayItemsNullableList(newInstanceItems); + } + + 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); + SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().build())); + ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, new PathToSchemasMap(), new LinkedHashSet<>()); + PathToSchemasMap pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet); + return getNewInstance(castArg, validationMetadata.pathToItem(), pathToSchemasMap); + } + + @Override + public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws 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"); + } + @Override + public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { + 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"); + } + @Override + 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 { + 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"); + } + } + + public static class AdditionalProperties extends MapJsonSchema.MapJsonSchema1 { + private static @Nullable AdditionalProperties instance = null; + public static AdditionalProperties getInstance() { + if (instance == null) { + instance = new AdditionalProperties(); + } + return instance; + } + } + + + public static class ObjectNullablePropMap extends FrozenMap> { + protected ObjectNullablePropMap(FrozenMap> m) { + super(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 { + return ObjectNullableProp.getInstance().validate(arg, configuration); + } + + public FrozenMap getAdditionalProperty(String name) throws UnsetPropertyException { + return getOrThrow(name); + } + } + + public interface SetterForAdditionalProperties { + Set getKnownKeys(); + Map> getInstance(); + T getBuilderAfterAdditionalProperty(Map> instance); + + default T additionalProperty(String key, Map value) throws InvalidAdditionalPropertyException { + MapUtils.throwIfKeyKnown(key, getKnownKeys(), true); + var instance = getInstance(); + instance.put(key, value); + return getBuilderAfterAdditionalProperty(instance); + } + } + + public static class ObjectNullablePropMapBuilder implements GenericBuilder>>, SetterForAdditionalProperties { + private final Map> instance; + private static final Set knownKeys = Set.of(); + public Set getKnownKeys() { + return knownKeys; + } + public ObjectNullablePropMapBuilder() { + this.instance = new LinkedHashMap<>(); + } + public Map> build() { + return instance; + } + public Map> getInstance() { + return instance; + } + public ObjectNullablePropMapBuilder getBuilderAfterAdditionalProperty(Map> instance) { + return this; + } + } + + + public sealed interface ObjectNullablePropBoxed permits ObjectNullablePropBoxedNothing?, ObjectNullablePropBoxedMap { + @Nullable Object getData(); + } + + public record ObjectNullablePropBoxedVoid(Nothing? data) implements ObjectNullablePropBoxed { + @Override + public @Nullable Object getData() { + return data; + } + } + + public record ObjectNullablePropBoxedMap(ObjectNullablePropMap data) implements ObjectNullablePropBoxed { + @Override + public @Nullable Object getData() { + return data; + } + } + + + public static class ObjectNullableProp extends JsonSchema implements NullSchemaValidator, MapSchemaValidator { + private static @Nullable ObjectNullableProp instance = null; + + protected ObjectNullableProp() { + super(new JsonSchemaInfo() + .type(Set.of( + Nothing?.class, + Map.class + )) + .additionalProperties(AdditionalProperties.class) + ); + } + + public static ObjectNullableProp getInstance() { + if (instance == null) { + instance = new ObjectNullableProp(); + } + return instance; + } + + @Override + public Nothing? validate(Nothing? arg, SchemaConfiguration configuration) throws ValidationException { + Set> pathSet = new HashSet<>(); + List pathToItem = List.of("args[0"); + Nothing? castArg = castToAllowedTypes(arg, pathToItem, pathSet); + SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().build())); + ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, new PathToSchemasMap(), new LinkedHashSet<>()); + getPathToSchemas(this, castArg, validationMetadata, pathSet); + return castArg; + } + + 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 RuntimeException("Invalid non-string key value"); + } + String propertyName = (String) entryKey; + List propertyPathToItem = new ArrayList<>(pathToItem); + propertyPathToItem.add(propertyName); + Object value = entry.getValue(); + LinkedHashMap, Nothing?> schemas = pathToSchemas.get(propertyPathToItem); + if (schemas == null) { + throw new RuntimeException("Validation 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"); + } + properties.put(propertyName, (FrozenMap) propertyInstance); + } + FrozenMap> castProperties = new FrozenMap<>(properties); + return new ObjectNullablePropMap(castProperties); + } + + 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); + SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().build())); + ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, new PathToSchemasMap(), new LinkedHashSet<>()); + PathToSchemasMap pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet); + return getNewInstance(castArg, validationMetadata.pathToItem(), pathToSchemasMap); + } + + + @Override + public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { + if (arg == null) { + return validate((Nothing?) 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"); + } + @Override + public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { + if (arg == null) { + return getNewInstance((Nothing?) 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"); + } + @Override + public ObjectNullablePropBoxedVoid validateAndBox(Nothing? arg, SchemaConfiguration configuration) throws ValidationException { + return new ObjectNullablePropBoxedVoid(validate(arg, configuration)); + } + @Override + 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 { + if (arg == null) { + Nothing? castArg = (Nothing?) 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"); + } + } + + public sealed interface AdditionalProperties1Boxed permits AdditionalProperties1BoxedNothing?, AdditionalProperties1BoxedMap { + @Nullable Object getData(); + } + + public record AdditionalProperties1BoxedVoid(Nothing? data) implements AdditionalProperties1Boxed { + @Override + public @Nullable Object getData() { + return data; + } + } + + public record AdditionalProperties1BoxedMap(FrozenMap<@Nullable Object> data) implements AdditionalProperties1Boxed { + @Override + public @Nullable Object getData() { + return data; + } + } + + + public static class AdditionalProperties1 extends JsonSchema implements NullSchemaValidator, MapSchemaValidator, AdditionalProperties1BoxedMap> { + private static @Nullable AdditionalProperties1 instance = null; + + protected AdditionalProperties1() { + super(new JsonSchemaInfo() + .type(Set.of( + Nothing?.class, + Map.class + )) + ); + } + + public static AdditionalProperties1 getInstance() { + if (instance == null) { + instance = new AdditionalProperties1(); + } + return instance; + } + + @Override + public Nothing? validate(Nothing? arg, SchemaConfiguration configuration) throws ValidationException { + Set> pathSet = new HashSet<>(); + List pathToItem = List.of("args[0"); + Nothing? castArg = castToAllowedTypes(arg, pathToItem, pathSet); + SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().build())); + ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, new PathToSchemasMap(), new LinkedHashSet<>()); + getPathToSchemas(this, castArg, validationMetadata, pathSet); + return castArg; + } + + 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 RuntimeException("Invalid non-string key value"); + } + String propertyName = (String) entryKey; + List propertyPathToItem = new ArrayList<>(pathToItem); + propertyPathToItem.add(propertyName); + Object value = entry.getValue(); + LinkedHashMap, Nothing?> schemas = pathToSchemas.get(propertyPathToItem); + if (schemas == null) { + throw new RuntimeException("Validation result is invalid, schemas must exist for a pathToItem"); + } + JsonSchema propertySchema = schemas.entrySet().iterator().next().getKey(); + @Nullable Object propertyInstance = propertySchema.getNewInstance(value, propertyPathToItem, pathToSchemas); + properties.put(propertyName, propertyInstance); + } + FrozenMap<@Nullable Object> castProperties = new FrozenMap<>(properties); + return castProperties; + } + + public FrozenMap<@Nullable Object> validate(Map arg, SchemaConfiguration configuration) throws ValidationException { + Set> pathSet = new HashSet<>(); + List pathToItem = List.of("args[0"); + Map castArg = castToAllowedTypes(arg, pathToItem, pathSet); + SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().build())); + ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, new PathToSchemasMap(), new LinkedHashSet<>()); + PathToSchemasMap pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet); + return getNewInstance(castArg, validationMetadata.pathToItem(), pathToSchemasMap); + } + + + @Override + public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { + if (arg == null) { + return validate((Nothing?) 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"); + } + @Override + public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { + if (arg == null) { + return getNewInstance((Nothing?) 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"); + } + @Override + public AdditionalProperties1BoxedVoid validateAndBox(Nothing? arg, SchemaConfiguration configuration) throws ValidationException { + return new AdditionalProperties1BoxedVoid(validate(arg, configuration)); + } + @Override + 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 { + if (arg == null) { + Nothing? castArg = (Nothing?) 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"); + } + } + + public static class ObjectAndItemsNullablePropMap extends FrozenMap<@Nullable FrozenMap> { + protected ObjectAndItemsNullablePropMap(FrozenMap<@Nullable FrozenMap> m) { + super(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 { + return ObjectAndItemsNullableProp.getInstance().validate(arg, configuration); + } + + public @Nullable FrozenMap getAdditionalProperty(String name) throws UnsetPropertyException { + return getOrThrow(name); + } + } + + public interface SetterForAdditionalProperties1 { + Set getKnownKeys(); + Map> getInstance(); + T getBuilderAfterAdditionalProperty(Map> instance); + + default T additionalProperty(String key, Nothing? value) throws InvalidAdditionalPropertyException { + MapUtils.throwIfKeyKnown(key, getKnownKeys(), true); + var instance = getInstance(); + instance.put(key, null); + return getBuilderAfterAdditionalProperty(instance); + } + + default T additionalProperty(String key, Map value) throws InvalidAdditionalPropertyException { + MapUtils.throwIfKeyKnown(key, getKnownKeys(), true); + var instance = getInstance(); + instance.put(key, value); + return getBuilderAfterAdditionalProperty(instance); + } + } + + public static class ObjectAndItemsNullablePropMapBuilder implements GenericBuilder>>, SetterForAdditionalProperties1 { + private final Map> instance; + private static final Set knownKeys = Set.of(); + public Set getKnownKeys() { + return knownKeys; + } + public ObjectAndItemsNullablePropMapBuilder() { + this.instance = new LinkedHashMap<>(); + } + public Map> build() { + return instance; + } + public Map> getInstance() { + return instance; + } + public ObjectAndItemsNullablePropMapBuilder getBuilderAfterAdditionalProperty(Map> instance) { + return this; + } + } + + + public sealed interface ObjectAndItemsNullablePropBoxed permits ObjectAndItemsNullablePropBoxedNothing?, ObjectAndItemsNullablePropBoxedMap { + @Nullable Object getData(); + } + + public record ObjectAndItemsNullablePropBoxedVoid(Nothing? data) implements ObjectAndItemsNullablePropBoxed { + @Override + public @Nullable Object getData() { + return data; + } + } + + public record ObjectAndItemsNullablePropBoxedMap(ObjectAndItemsNullablePropMap data) implements ObjectAndItemsNullablePropBoxed { + @Override + public @Nullable Object getData() { + return data; + } + } + + + public static class ObjectAndItemsNullableProp extends JsonSchema implements NullSchemaValidator, MapSchemaValidator { + private static @Nullable ObjectAndItemsNullableProp instance = null; + + protected ObjectAndItemsNullableProp() { + super(new JsonSchemaInfo() + .type(Set.of( + Nothing?.class, + Map.class + )) + .additionalProperties(AdditionalProperties1.class) + ); + } + + public static ObjectAndItemsNullableProp getInstance() { + if (instance == null) { + instance = new ObjectAndItemsNullableProp(); + } + return instance; + } + + @Override + public Nothing? validate(Nothing? arg, SchemaConfiguration configuration) throws ValidationException { + Set> pathSet = new HashSet<>(); + List pathToItem = List.of("args[0"); + Nothing? castArg = castToAllowedTypes(arg, pathToItem, pathSet); + SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().build())); + ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, new PathToSchemasMap(), new LinkedHashSet<>()); + getPathToSchemas(this, castArg, validationMetadata, pathSet); + return castArg; + } + + 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 RuntimeException("Invalid non-string key value"); + } + String propertyName = (String) entryKey; + List propertyPathToItem = new ArrayList<>(pathToItem); + propertyPathToItem.add(propertyName); + Object value = entry.getValue(); + LinkedHashMap, Nothing?> schemas = pathToSchemas.get(propertyPathToItem); + if (schemas == null) { + throw new RuntimeException("Validation 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"); + } + properties.put(propertyName, (@Nullable FrozenMap) propertyInstance); + } + FrozenMap<@Nullable FrozenMap> castProperties = new FrozenMap<>(properties); + return new ObjectAndItemsNullablePropMap(castProperties); + } + + 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); + SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().build())); + ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, new PathToSchemasMap(), new LinkedHashSet<>()); + PathToSchemasMap pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet); + return getNewInstance(castArg, validationMetadata.pathToItem(), pathToSchemasMap); + } + + + @Override + public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { + if (arg == null) { + return validate((Nothing?) 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"); + } + @Override + public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { + if (arg == null) { + return getNewInstance((Nothing?) 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"); + } + @Override + public ObjectAndItemsNullablePropBoxedVoid validateAndBox(Nothing? arg, SchemaConfiguration configuration) throws ValidationException { + return new ObjectAndItemsNullablePropBoxedVoid(validate(arg, configuration)); + } + @Override + 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 { + if (arg == null) { + Nothing? castArg = (Nothing?) 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"); + } + } + + public sealed interface AdditionalProperties2Boxed permits AdditionalProperties2BoxedNothing?, AdditionalProperties2BoxedMap { + @Nullable Object getData(); + } + + public record AdditionalProperties2BoxedVoid(Nothing? data) implements AdditionalProperties2Boxed { + @Override + public @Nullable Object getData() { + return data; + } + } + + public record AdditionalProperties2BoxedMap(FrozenMap<@Nullable Object> data) implements AdditionalProperties2Boxed { + @Override + public @Nullable Object getData() { + return data; + } + } + + + public static class AdditionalProperties2 extends JsonSchema implements NullSchemaValidator, MapSchemaValidator, AdditionalProperties2BoxedMap> { + private static @Nullable AdditionalProperties2 instance = null; + + protected AdditionalProperties2() { + super(new JsonSchemaInfo() + .type(Set.of( + Nothing?.class, + Map.class + )) + ); + } + + public static AdditionalProperties2 getInstance() { + if (instance == null) { + instance = new AdditionalProperties2(); + } + return instance; + } + + @Override + public Nothing? validate(Nothing? arg, SchemaConfiguration configuration) throws ValidationException { + Set> pathSet = new HashSet<>(); + List pathToItem = List.of("args[0"); + Nothing? castArg = castToAllowedTypes(arg, pathToItem, pathSet); + SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().build())); + ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, new PathToSchemasMap(), new LinkedHashSet<>()); + getPathToSchemas(this, castArg, validationMetadata, pathSet); + return castArg; + } + + 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 RuntimeException("Invalid non-string key value"); + } + String propertyName = (String) entryKey; + List propertyPathToItem = new ArrayList<>(pathToItem); + propertyPathToItem.add(propertyName); + Object value = entry.getValue(); + LinkedHashMap, Nothing?> schemas = pathToSchemas.get(propertyPathToItem); + if (schemas == null) { + throw new RuntimeException("Validation result is invalid, schemas must exist for a pathToItem"); + } + JsonSchema propertySchema = schemas.entrySet().iterator().next().getKey(); + @Nullable Object propertyInstance = propertySchema.getNewInstance(value, propertyPathToItem, pathToSchemas); + properties.put(propertyName, propertyInstance); + } + FrozenMap<@Nullable Object> castProperties = new FrozenMap<>(properties); + return castProperties; + } + + public FrozenMap<@Nullable Object> validate(Map arg, SchemaConfiguration configuration) throws ValidationException { + Set> pathSet = new HashSet<>(); + List pathToItem = List.of("args[0"); + Map castArg = castToAllowedTypes(arg, pathToItem, pathSet); + SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().build())); + ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, new PathToSchemasMap(), new LinkedHashSet<>()); + PathToSchemasMap pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet); + return getNewInstance(castArg, validationMetadata.pathToItem(), pathToSchemasMap); + } + + + @Override + public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { + if (arg == null) { + return validate((Nothing?) 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"); + } + @Override + public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { + if (arg == null) { + return getNewInstance((Nothing?) 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"); + } + @Override + public AdditionalProperties2BoxedVoid validateAndBox(Nothing? arg, SchemaConfiguration configuration) throws ValidationException { + return new AdditionalProperties2BoxedVoid(validate(arg, configuration)); + } + @Override + 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 { + if (arg == null) { + Nothing? castArg = (Nothing?) 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"); + } + } + + public static class ObjectItemsNullableMap extends FrozenMap<@Nullable FrozenMap> { + protected ObjectItemsNullableMap(FrozenMap<@Nullable FrozenMap> m) { + super(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 { + return ObjectItemsNullable.getInstance().validate(arg, configuration); + } + + public @Nullable FrozenMap getAdditionalProperty(String name) throws UnsetPropertyException { + return getOrThrow(name); + } + } + + public interface SetterForAdditionalProperties2 { + Set getKnownKeys(); + Map> getInstance(); + T getBuilderAfterAdditionalProperty(Map> instance); + + default T additionalProperty(String key, Nothing? value) throws InvalidAdditionalPropertyException { + MapUtils.throwIfKeyKnown(key, getKnownKeys(), true); + var instance = getInstance(); + instance.put(key, null); + return getBuilderAfterAdditionalProperty(instance); + } + + default T additionalProperty(String key, Map value) throws InvalidAdditionalPropertyException { + MapUtils.throwIfKeyKnown(key, getKnownKeys(), true); + var instance = getInstance(); + instance.put(key, value); + return getBuilderAfterAdditionalProperty(instance); + } + } + + public static class ObjectItemsNullableMapBuilder implements GenericBuilder>>, SetterForAdditionalProperties2 { + private final Map> instance; + private static final Set knownKeys = Set.of(); + public Set getKnownKeys() { + return knownKeys; + } + public ObjectItemsNullableMapBuilder() { + this.instance = new LinkedHashMap<>(); + } + public Map> build() { + return instance; + } + public Map> getInstance() { + return instance; + } + public ObjectItemsNullableMapBuilder getBuilderAfterAdditionalProperty(Map> instance) { + return this; + } + } + + + public sealed interface ObjectItemsNullableBoxed permits ObjectItemsNullableBoxedMap { + @Nullable Object getData(); + } + + public record ObjectItemsNullableBoxedMap(ObjectItemsNullableMap data) implements ObjectItemsNullableBoxed { + @Override + public @Nullable Object getData() { + return data; + } + } + + + public static class ObjectItemsNullable extends JsonSchema implements MapSchemaValidator { + private static @Nullable ObjectItemsNullable instance = null; + + protected ObjectItemsNullable() { + super(new JsonSchemaInfo() + .type(Set.of(Map.class)) + .additionalProperties(AdditionalProperties2.class) + ); + } + + public static ObjectItemsNullable getInstance() { + if (instance == null) { + instance = new ObjectItemsNullable(); + } + return instance; + } + + 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 RuntimeException("Invalid non-string key value"); + } + String propertyName = (String) entryKey; + List propertyPathToItem = new ArrayList<>(pathToItem); + propertyPathToItem.add(propertyName); + Object value = entry.getValue(); + LinkedHashMap, Nothing?> schemas = pathToSchemas.get(propertyPathToItem); + if (schemas == null) { + throw new RuntimeException("Validation 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"); + } + properties.put(propertyName, (@Nullable FrozenMap) propertyInstance); + } + FrozenMap<@Nullable FrozenMap> castProperties = new FrozenMap<>(properties); + return new ObjectItemsNullableMap(castProperties); + } + + 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); + SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().build())); + ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, new PathToSchemasMap(), new LinkedHashSet<>()); + PathToSchemasMap pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet); + return getNewInstance(castArg, validationMetadata.pathToItem(), pathToSchemasMap); + } + + + @Override + public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws 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"); + } + @Override + public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { + if (arg instanceof Map) { + return getNewInstance((Map) arg, pathToItem, pathToSchemas); + } + 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 { + return new ObjectItemsNullableBoxedMap(validate(arg, configuration)); + } + @Override + public ObjectItemsNullableBoxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { + 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"); + } + } + + + public static class NullableClassMap extends FrozenMap<@Nullable Object> { + protected NullableClassMap(FrozenMap<@Nullable Object> m) { + super(m); + } + public static final Set requiredKeys = Set.of(); + public static final Set optionalKeys = Set.of( + "integer_prop", + "number_prop", + "boolean_prop", + "string_prop", + "date_prop", + "datetime_prop", + "array_nullable_prop", + "array_and_items_nullable_prop", + "array_items_nullable", + "object_nullable_prop", + "object_and_items_nullable_prop", + "object_items_nullable" + ); + public static NullableClassMap of(Map arg, SchemaConfiguration configuration) throws ValidationException { + return NullableClass1.getInstance().validate(arg, configuration); + } + + public @Nullable Number integer_prop() throws UnsetPropertyException { + String key = "integer_prop"; + throwIfKeyNotPresent(key); + @Nullable Object value = get(key); + if (!(value == null || value instanceof Number)) { + throw new RuntimeException("Invalid value stored for integer_prop"); + } + return (@Nullable Number) value; + } + + public @Nullable Number number_prop() throws UnsetPropertyException { + String key = "number_prop"; + throwIfKeyNotPresent(key); + @Nullable Object value = get(key); + if (!(value == null || value instanceof Number)) { + throw new RuntimeException("Invalid value stored for number_prop"); + } + return (@Nullable Number) value; + } + + public @Nullable Boolean boolean_prop() throws UnsetPropertyException { + String key = "boolean_prop"; + throwIfKeyNotPresent(key); + @Nullable Object value = get(key); + if (!(value == null || value instanceof Boolean)) { + throw new RuntimeException("Invalid value stored for boolean_prop"); + } + return (@Nullable Boolean) value; + } + + public @Nullable String string_prop() throws UnsetPropertyException { + String key = "string_prop"; + throwIfKeyNotPresent(key); + @Nullable Object value = get(key); + if (!(value == null || value instanceof String)) { + throw new RuntimeException("Invalid value stored for string_prop"); + } + return (@Nullable String) value; + } + + public @Nullable String date_prop() throws UnsetPropertyException { + String key = "date_prop"; + throwIfKeyNotPresent(key); + @Nullable Object value = get(key); + if (!(value == null || value instanceof String)) { + throw new RuntimeException("Invalid value stored for date_prop"); + } + return (@Nullable String) value; + } + + public @Nullable String datetime_prop() throws UnsetPropertyException { + String key = "datetime_prop"; + throwIfKeyNotPresent(key); + @Nullable Object value = get(key); + if (!(value == null || value instanceof String)) { + throw new RuntimeException("Invalid value stored for datetime_prop"); + } + return (@Nullable String) value; + } + + public @Nullable ArrayNullablePropList array_nullable_prop() throws UnsetPropertyException { + String key = "array_nullable_prop"; + throwIfKeyNotPresent(key); + @Nullable Object value = get(key); + if (!(value == null || value instanceof ArrayNullablePropList)) { + throw new RuntimeException("Invalid value stored for array_nullable_prop"); + } + return (@Nullable ArrayNullablePropList) value; + } + + public @Nullable ArrayAndItemsNullablePropList array_and_items_nullable_prop() throws UnsetPropertyException { + String key = "array_and_items_nullable_prop"; + 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"); + } + return (@Nullable ArrayAndItemsNullablePropList) value; + } + + public ArrayItemsNullableList array_items_nullable() throws UnsetPropertyException { + String key = "array_items_nullable"; + throwIfKeyNotPresent(key); + @Nullable Object value = get(key); + if (!(value instanceof ArrayItemsNullableList)) { + throw new RuntimeException("Invalid value stored for array_items_nullable"); + } + return (ArrayItemsNullableList) value; + } + + public @Nullable ObjectNullablePropMap object_nullable_prop() throws UnsetPropertyException { + String key = "object_nullable_prop"; + throwIfKeyNotPresent(key); + @Nullable Object value = get(key); + if (!(value == null || value instanceof ObjectNullablePropMap)) { + throw new RuntimeException("Invalid value stored for object_nullable_prop"); + } + return (@Nullable ObjectNullablePropMap) value; + } + + public @Nullable ObjectAndItemsNullablePropMap object_and_items_nullable_prop() throws UnsetPropertyException { + String key = "object_and_items_nullable_prop"; + 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"); + } + return (@Nullable ObjectAndItemsNullablePropMap) value; + } + + public ObjectItemsNullableMap object_items_nullable() throws UnsetPropertyException { + String key = "object_items_nullable"; + throwIfKeyNotPresent(key); + @Nullable Object value = get(key); + if (!(value instanceof ObjectItemsNullableMap)) { + throw new RuntimeException("Invalid value stored for object_items_nullable"); + } + return (ObjectItemsNullableMap) value; + } + + public @Nullable FrozenMap getAdditionalProperty(String name) throws UnsetPropertyException, InvalidAdditionalPropertyException { + throwIfKeyKnown(name, requiredKeys, optionalKeys); + var value = getOrThrow(name); + if (!(value == null || value instanceof FrozenMap)) { + throw new RuntimeException("Invalid value stored for " + name); + } + return (@Nullable FrozenMap) value; + } + } + + public interface SetterForIntegerProp { + Map getInstance(); + T getBuilderAfterIntegerProp(Map instance); + + default T integer_prop(Nothing? value) { + var instance = getInstance(); + instance.put("integer_prop", null); + return getBuilderAfterIntegerProp(instance); + } + + default T integer_prop(int value) { + var instance = getInstance(); + instance.put("integer_prop", value); + return getBuilderAfterIntegerProp(instance); + } + + default T integer_prop(float value) { + var instance = getInstance(); + instance.put("integer_prop", value); + return getBuilderAfterIntegerProp(instance); + } + + default T integer_prop(long value) { + var instance = getInstance(); + instance.put("integer_prop", value); + return getBuilderAfterIntegerProp(instance); + } + + default T integer_prop(double value) { + var instance = getInstance(); + instance.put("integer_prop", value); + return getBuilderAfterIntegerProp(instance); + } + } + + public interface SetterForNumberProp { + Map getInstance(); + T getBuilderAfterNumberProp(Map instance); + + default T number_prop(Nothing? value) { + var instance = getInstance(); + instance.put("number_prop", null); + return getBuilderAfterNumberProp(instance); + } + + default T number_prop(int value) { + var instance = getInstance(); + instance.put("number_prop", value); + return getBuilderAfterNumberProp(instance); + } + + default T number_prop(float value) { + var instance = getInstance(); + instance.put("number_prop", value); + return getBuilderAfterNumberProp(instance); + } + + default T number_prop(long value) { + var instance = getInstance(); + instance.put("number_prop", value); + return getBuilderAfterNumberProp(instance); + } + + default T number_prop(double value) { + var instance = getInstance(); + instance.put("number_prop", value); + return getBuilderAfterNumberProp(instance); + } + } + + public interface SetterForBooleanProp { + Map getInstance(); + T getBuilderAfterBooleanProp(Map instance); + + default T boolean_prop(Nothing? value) { + var instance = getInstance(); + instance.put("boolean_prop", null); + return getBuilderAfterBooleanProp(instance); + } + + default T boolean_prop(boolean value) { + var instance = getInstance(); + instance.put("boolean_prop", value); + return getBuilderAfterBooleanProp(instance); + } + } + + public interface SetterForStringProp { + Map getInstance(); + T getBuilderAfterStringProp(Map instance); + + default T string_prop(Nothing? value) { + var instance = getInstance(); + instance.put("string_prop", null); + return getBuilderAfterStringProp(instance); + } + + default T string_prop(String value) { + var instance = getInstance(); + instance.put("string_prop", value); + return getBuilderAfterStringProp(instance); + } + } + + public interface SetterForDateProp { + Map getInstance(); + T getBuilderAfterDateProp(Map instance); + + default T date_prop(Nothing? value) { + var instance = getInstance(); + instance.put("date_prop", null); + return getBuilderAfterDateProp(instance); + } + + default T date_prop(String value) { + var instance = getInstance(); + instance.put("date_prop", value); + return getBuilderAfterDateProp(instance); + } + } + + public interface SetterForDatetimeProp { + Map getInstance(); + T getBuilderAfterDatetimeProp(Map instance); + + default T datetime_prop(Nothing? value) { + var instance = getInstance(); + instance.put("datetime_prop", null); + return getBuilderAfterDatetimeProp(instance); + } + + default T datetime_prop(String value) { + var instance = getInstance(); + instance.put("datetime_prop", value); + return getBuilderAfterDatetimeProp(instance); + } + } + + public interface SetterForArrayNullableProp { + Map getInstance(); + T getBuilderAfterArrayNullableProp(Map instance); + + default T array_nullable_prop(Nothing? value) { + var instance = getInstance(); + instance.put("array_nullable_prop", null); + return getBuilderAfterArrayNullableProp(instance); + } + + default T array_nullable_prop(List> value) { + var instance = getInstance(); + instance.put("array_nullable_prop", value); + return getBuilderAfterArrayNullableProp(instance); + } + } + + public interface SetterForArrayAndItemsNullableProp { + Map getInstance(); + T getBuilderAfterArrayAndItemsNullableProp(Map instance); + + default T array_and_items_nullable_prop(Nothing? value) { + var instance = getInstance(); + instance.put("array_and_items_nullable_prop", null); + return getBuilderAfterArrayAndItemsNullableProp(instance); + } + + default T array_and_items_nullable_prop(List<@Nullable Map> value) { + var instance = getInstance(); + instance.put("array_and_items_nullable_prop", value); + return getBuilderAfterArrayAndItemsNullableProp(instance); + } + } + + public interface SetterForArrayItemsNullable { + Map getInstance(); + T getBuilderAfterArrayItemsNullable(Map instance); + + default T array_items_nullable(List<@Nullable Map> value) { + var instance = getInstance(); + instance.put("array_items_nullable", value); + return getBuilderAfterArrayItemsNullable(instance); + } + } + + public interface SetterForObjectNullableProp { + Map getInstance(); + T getBuilderAfterObjectNullableProp(Map instance); + + default T object_nullable_prop(Nothing? value) { + var instance = getInstance(); + instance.put("object_nullable_prop", null); + return getBuilderAfterObjectNullableProp(instance); + } + + default T object_nullable_prop(Map> value) { + var instance = getInstance(); + instance.put("object_nullable_prop", value); + return getBuilderAfterObjectNullableProp(instance); + } + } + + public interface SetterForObjectAndItemsNullableProp { + Map getInstance(); + T getBuilderAfterObjectAndItemsNullableProp(Map instance); + + default T object_and_items_nullable_prop(Nothing? value) { + var instance = getInstance(); + instance.put("object_and_items_nullable_prop", null); + return getBuilderAfterObjectAndItemsNullableProp(instance); + } + + default T object_and_items_nullable_prop(Map> value) { + var instance = getInstance(); + instance.put("object_and_items_nullable_prop", value); + return getBuilderAfterObjectAndItemsNullableProp(instance); + } + } + + public interface SetterForObjectItemsNullable { + Map getInstance(); + T getBuilderAfterObjectItemsNullable(Map instance); + + default T object_items_nullable(Map> value) { + var instance = getInstance(); + instance.put("object_items_nullable", value); + return getBuilderAfterObjectItemsNullable(instance); + } + } + + public interface SetterForAdditionalProperties3 { + Set getKnownKeys(); + Map getInstance(); + T getBuilderAfterAdditionalProperty(Map instance); + + default T additionalProperty(String key, Nothing? value) throws InvalidAdditionalPropertyException { + MapUtils.throwIfKeyKnown(key, getKnownKeys(), true); + var instance = getInstance(); + instance.put(key, null); + return getBuilderAfterAdditionalProperty(instance); + } + + default T additionalProperty(String key, Map value) throws InvalidAdditionalPropertyException { + MapUtils.throwIfKeyKnown(key, getKnownKeys(), true); + var instance = getInstance(); + instance.put(key, value); + return getBuilderAfterAdditionalProperty(instance); + } + } + + public static class NullableClassMapBuilder implements GenericBuilder>, SetterForIntegerProp, SetterForNumberProp, SetterForBooleanProp, SetterForStringProp, SetterForDateProp, SetterForDatetimeProp, SetterForArrayNullableProp, SetterForArrayAndItemsNullableProp, SetterForArrayItemsNullable, SetterForObjectNullableProp, SetterForObjectAndItemsNullableProp, SetterForObjectItemsNullable, SetterForAdditionalProperties3 { + private final Map instance; + private static final Set knownKeys = Set.of( + "integer_prop", + "number_prop", + "boolean_prop", + "string_prop", + "date_prop", + "datetime_prop", + "array_nullable_prop", + "array_and_items_nullable_prop", + "array_items_nullable", + "object_nullable_prop", + "object_and_items_nullable_prop", + "object_items_nullable" + ); + public Set getKnownKeys() { + return knownKeys; + } + public NullableClassMapBuilder() { + this.instance = new LinkedHashMap<>(); + } + public Map build() { + return instance; + } + public Map getInstance() { + return instance; + } + public NullableClassMapBuilder getBuilderAfterIntegerProp(Map instance) { + return this; + } + public NullableClassMapBuilder getBuilderAfterNumberProp(Map instance) { + return this; + } + public NullableClassMapBuilder getBuilderAfterBooleanProp(Map instance) { + return this; + } + public NullableClassMapBuilder getBuilderAfterStringProp(Map instance) { + return this; + } + public NullableClassMapBuilder getBuilderAfterDateProp(Map instance) { + return this; + } + public NullableClassMapBuilder getBuilderAfterDatetimeProp(Map instance) { + return this; + } + public NullableClassMapBuilder getBuilderAfterArrayNullableProp(Map instance) { + return this; + } + public NullableClassMapBuilder getBuilderAfterArrayAndItemsNullableProp(Map instance) { + return this; + } + public NullableClassMapBuilder getBuilderAfterArrayItemsNullable(Map instance) { + return this; + } + public NullableClassMapBuilder getBuilderAfterObjectNullableProp(Map instance) { + return this; + } + public NullableClassMapBuilder getBuilderAfterObjectAndItemsNullableProp(Map instance) { + return this; + } + public NullableClassMapBuilder getBuilderAfterObjectItemsNullable(Map instance) { + return this; + } + public NullableClassMapBuilder getBuilderAfterAdditionalProperty(Map instance) { + return this; + } + } + + + public sealed interface NullableClass1Boxed permits NullableClass1BoxedMap { + @Nullable Object getData(); + } + + public record NullableClass1BoxedMap(NullableClassMap data) implements NullableClass1Boxed { + @Override + public @Nullable Object getData() { + return data; + } + } + + + public static class NullableClass1 extends JsonSchema implements MapSchemaValidator { + /* + NOTE: This class is auto generated by OpenAPI JSON Schema Generator. + Ref: https://github.com/openapi-json-schema-tools/openapi-json-schema-generator + + Do not edit the class manually. + */ + private static @Nullable NullableClass1 instance = null; + + protected NullableClass1() { + super(new JsonSchemaInfo() + .type(Set.of(Map.class)) + .properties(Map.ofEntries( + new PropertyEntry("integer_prop", IntegerProp.class), + new PropertyEntry("number_prop", NumberProp.class), + new PropertyEntry("boolean_prop", BooleanProp.class), + new PropertyEntry("string_prop", StringProp.class), + new PropertyEntry("date_prop", DateProp.class), + new PropertyEntry("datetime_prop", DatetimeProp.class), + new PropertyEntry("array_nullable_prop", ArrayNullableProp.class), + new PropertyEntry("array_and_items_nullable_prop", ArrayAndItemsNullableProp.class), + new PropertyEntry("array_items_nullable", ArrayItemsNullable.class), + new PropertyEntry("object_nullable_prop", ObjectNullableProp.class), + new PropertyEntry("object_and_items_nullable_prop", ObjectAndItemsNullableProp.class), + new PropertyEntry("object_items_nullable", ObjectItemsNullable.class) + )) + .additionalProperties(AdditionalProperties3.class) + ); + } + + public static NullableClass1 getInstance() { + if (instance == null) { + instance = new NullableClass1(); + } + return instance; + } + + 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 RuntimeException("Invalid non-string key value"); + } + String propertyName = (String) entryKey; + List propertyPathToItem = new ArrayList<>(pathToItem); + propertyPathToItem.add(propertyName); + Object value = entry.getValue(); + LinkedHashMap, Nothing?> schemas = pathToSchemas.get(propertyPathToItem); + if (schemas == null) { + throw new RuntimeException("Validation 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"); + } + properties.put(propertyName, (@Nullable Object) propertyInstance); + } + FrozenMap<@Nullable Object> castProperties = new FrozenMap<>(properties); + return new NullableClassMap(castProperties); + } + + 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); + SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().build())); + ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, new PathToSchemasMap(), new LinkedHashSet<>()); + PathToSchemasMap pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet); + return getNewInstance(castArg, validationMetadata.pathToItem(), pathToSchemasMap); + } + + + @Override + public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws 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"); + } + @Override + public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { + if (arg instanceof Map) { + return getNewInstance((Map) arg, pathToItem, pathToSchemas); + } + 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 { + return new NullableClass1BoxedMap(validate(arg, configuration)); + } + @Override + public NullableClass1Boxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { + 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"); + } + } + +} diff --git a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/schemas/NullableShape.kt b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/schemas/NullableShape.kt new file mode 100644 index 00000000000..411aff9b896 --- /dev/null +++ b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/schemas/NullableShape.kt @@ -0,0 +1,345 @@ +package org.openapijsonschematools.client.components.schemas; +import java.time.LocalDate; +import java.time.ZonedDateTime; +import java.util.ArrayList; +import java.util.HashSet; +import java.util.LinkedHashMap; +import java.util.LinkedHashSet; +import java.util.List; +import java.util.Map; +import java.util.Objects; +import java.util.Set; +import java.util.UUID; +import org.checkerframework.checker.nullness.qual.Nullable; +import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags; +import org.openapijsonschematools.client.configurations.SchemaConfiguration; +import org.openapijsonschematools.client.exceptions.InvalidAdditionalPropertyException; +import org.openapijsonschematools.client.exceptions.UnsetPropertyException; +import org.openapijsonschematools.client.exceptions.ValidationException; +import org.openapijsonschematools.client.schemas.NullJsonSchema; +import org.openapijsonschematools.client.schemas.UnsetAddPropsSetter; +import org.openapijsonschematools.client.schemas.validation.BooleanSchemaValidator; +import org.openapijsonschematools.client.schemas.validation.FrozenList; +import org.openapijsonschematools.client.schemas.validation.FrozenMap; +import org.openapijsonschematools.client.schemas.validation.JsonSchema; +import org.openapijsonschematools.client.schemas.validation.JsonSchemaInfo; +import org.openapijsonschematools.client.schemas.validation.ListSchemaValidator; +import org.openapijsonschematools.client.schemas.validation.MapSchemaValidator; +import org.openapijsonschematools.client.schemas.validation.NullSchemaValidator; +import org.openapijsonschematools.client.schemas.validation.NumberSchemaValidator; +import org.openapijsonschematools.client.schemas.validation.PathToSchemasMap; +import org.openapijsonschematools.client.schemas.validation.StringSchemaValidator; +import org.openapijsonschematools.client.schemas.validation.ValidationMetadata; + +public class NullableShape { + // nest classes so all schemas and input/output classes can be public + + + public static class Schema2 extends NullJsonSchema.NullJsonSchema1 { + private static @Nullable Schema2 instance = null; + public static Schema2 getInstance() { + if (instance == null) { + instance = new Schema2(); + } + return instance; + } + } + + + public sealed interface NullableShape1Boxed permits NullableShape1BoxedVoid, NullableShape1BoxedBoolean, NullableShape1BoxedNumber, NullableShape1BoxedString, NullableShape1BoxedList, NullableShape1BoxedMap { + @Nullable Object getData(); + } + + public record NullableShape1BoxedVoid(Nothing? data) implements NullableShape1Boxed { + @Override + public @Nullable Object getData() { + return data; + } + } + + public record NullableShape1BoxedBoolean(boolean data) implements NullableShape1Boxed { + @Override + public @Nullable Object getData() { + return data; + } + } + + public record NullableShape1BoxedNumber(Number data) implements NullableShape1Boxed { + @Override + public @Nullable Object getData() { + return data; + } + } + + public record NullableShape1BoxedString(String data) implements NullableShape1Boxed { + @Override + public @Nullable Object getData() { + return data; + } + } + + public record NullableShape1BoxedList(FrozenList<@Nullable Object> data) implements NullableShape1Boxed { + @Override + public @Nullable Object getData() { + return data; + } + } + + public record NullableShape1BoxedMap(FrozenMap<@Nullable Object> data) implements NullableShape1Boxed { + @Override + public @Nullable Object getData() { + return data; + } + } + + + public static class NullableShape1 extends JsonSchema implements NullSchemaValidator, BooleanSchemaValidator, NumberSchemaValidator, StringSchemaValidator, ListSchemaValidator, NullableShape1BoxedList>, MapSchemaValidator, NullableShape1BoxedMap> { + /* + NOTE: This class is auto generated by OpenAPI JSON Schema Generator. + Ref: https://github.com/openapi-json-schema-tools/openapi-json-schema-generator + + Do not edit the class manually. + + The value may be a shape or the 'null' value. For a composed schema to validate a null payload, one of its chosen oneOf schemas must be type null or nullable (introduced in OAS schema >= 3.0) + */ + private static @Nullable NullableShape1 instance = null; + + protected NullableShape1() { + super(new JsonSchemaInfo() + .oneOf(List.of( + Triangle.Triangle1.class, + Quadrilateral.Quadrilateral1.class, + Schema2.class + )) + ); + } + + public static NullableShape1 getInstance() { + if (instance == null) { + instance = new NullableShape1(); + } + return instance; + } + + @Override + public Nothing? validate(Nothing? arg, SchemaConfiguration configuration) throws ValidationException { + Set> pathSet = new HashSet<>(); + List pathToItem = List.of("args[0]"); + Nothing? castArg = castToAllowedTypes(arg, pathToItem, pathSet); + SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().build())); + PathToSchemasMap validatedPathToSchemas = new PathToSchemasMap(); + ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, new LinkedHashSet<>()); + getPathToSchemas(this, castArg, validationMetadata, pathSet); + return castArg; + } + + @Override + public boolean validate(boolean arg, SchemaConfiguration configuration) throws ValidationException { + Set> pathSet = new HashSet<>(); + List pathToItem = List.of("args[0]"); + boolean castArg = castToAllowedTypes(arg, pathToItem, pathSet); + SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().build())); + PathToSchemasMap validatedPathToSchemas = new PathToSchemasMap(); + ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, new LinkedHashSet<>()); + getPathToSchemas(this, castArg, validationMetadata, pathSet); + return castArg; + } + + @Override + public Number validate(Number arg, SchemaConfiguration configuration) throws ValidationException { + Set> pathSet = new HashSet<>(); + List pathToItem = List.of("args[0]"); + Number castArg = castToAllowedTypes(arg, pathToItem, pathSet); + SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().build())); + PathToSchemasMap validatedPathToSchemas = new PathToSchemasMap(); + ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, new LinkedHashSet<>()); + getPathToSchemas(this, castArg, validationMetadata, pathSet); + return castArg; + } + + public int validate(int arg, SchemaConfiguration configuration) throws ValidationException { + return (int) validate((Number) arg, configuration); + } + + public long validate(long arg, SchemaConfiguration configuration) throws ValidationException { + return (long) validate((Number) arg, configuration); + } + + public float validate(float arg, SchemaConfiguration configuration) throws ValidationException { + return (float) validate((Number) arg, configuration); + } + + public double validate(double arg, SchemaConfiguration configuration) throws ValidationException { + return (double) validate((Number) arg, configuration); + } + + @Override + public String validate(String arg, SchemaConfiguration configuration) throws ValidationException { + Set> pathSet = new HashSet<>(); + List pathToItem = List.of("args[0]"); + String castArg = castToAllowedTypes(arg, pathToItem, pathSet); + SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().build())); + PathToSchemasMap validatedPathToSchemas = new PathToSchemasMap(); + ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, new LinkedHashSet<>()); + getPathToSchemas(this, castArg, validationMetadata, pathSet); + return castArg; + } + + public String validate(LocalDate arg, SchemaConfiguration configuration) throws ValidationException { + return validate(arg.toString(), configuration); + } + + public String validate(ZonedDateTime arg, SchemaConfiguration configuration) throws ValidationException { + return validate(arg.toString(), configuration); + } + + public String validate(UUID arg, SchemaConfiguration configuration) throws ValidationException { + return validate(arg.toString(), configuration); + } + + @Override + public FrozenList<@Nullable Object> getNewInstance(List arg, List pathToItem, PathToSchemasMap pathToSchemas) { + List<@Nullable Object> items = new ArrayList<>(); + int i = 0; + for (Object item: arg) { + List itemPathToItem = new ArrayList<>(pathToItem); + itemPathToItem.add(i); + LinkedHashMap, Nothing?> schemas = pathToSchemas.get(itemPathToItem); + if (schemas == null) { + throw new RuntimeException("Validation result is invalid, schemas must exist for a pathToItem"); + } + JsonSchema itemSchema = schemas.entrySet().iterator().next().getKey(); + @Nullable Object itemInstance = itemSchema.getNewInstance(item, itemPathToItem, pathToSchemas); + items.add(itemInstance); + i += 1; + } + FrozenList<@Nullable Object> newInstanceItems = new FrozenList<>(items); + return newInstanceItems; + } + + 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); + SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().build())); + ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, new PathToSchemasMap(), new LinkedHashSet<>()); + PathToSchemasMap pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet); + return getNewInstance(castArg, validationMetadata.pathToItem(), pathToSchemasMap); + } + + @Override + 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 RuntimeException("Invalid non-string key value"); + } + String propertyName = (String) entryKey; + List propertyPathToItem = new ArrayList<>(pathToItem); + propertyPathToItem.add(propertyName); + Object value = entry.getValue(); + LinkedHashMap, Nothing?> schemas = pathToSchemas.get(propertyPathToItem); + if (schemas == null) { + throw new RuntimeException("Validation result is invalid, schemas must exist for a pathToItem"); + } + JsonSchema propertySchema = schemas.entrySet().iterator().next().getKey(); + @Nullable Object propertyInstance = propertySchema.getNewInstance(value, propertyPathToItem, pathToSchemas); + properties.put(propertyName, propertyInstance); + } + FrozenMap<@Nullable Object> castProperties = new FrozenMap<>(properties); + return castProperties; + } + + public FrozenMap<@Nullable Object> validate(Map arg, SchemaConfiguration configuration) throws ValidationException { + Set> pathSet = new HashSet<>(); + List pathToItem = List.of("args[0]"); + Map castArg = castToAllowedTypes(arg, pathToItem, pathSet); + SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().build())); + PathToSchemasMap validatedPathToSchemas = new PathToSchemasMap(); + ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, new LinkedHashSet<>()); + PathToSchemasMap pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet); + return getNewInstance(castArg, validationMetadata.pathToItem(), pathToSchemasMap); + } + + @Override + public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { + if (arg == null) { + return validate((Nothing?) null, configuration); + } else if (arg instanceof Boolean) { + boolean boolArg = (Boolean) arg; + return validate(boolArg, configuration); + } else if (arg instanceof Number) { + return validate((Number) arg, configuration); + } else if (arg instanceof String) { + return validate((String) arg, configuration); + } else if (arg instanceof List) { + return validate((List) arg, 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"); + } + @Override + public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { + if (arg == null) { + return getNewInstance((Nothing?) null, pathToItem, pathToSchemas); + } else if (arg instanceof Boolean) { + boolean boolArg = (Boolean) arg; + return getNewInstance(boolArg, pathToItem, pathToSchemas); + } else if (arg instanceof Number) { + return getNewInstance((Number) arg, pathToItem, pathToSchemas); + } else if (arg instanceof String) { + return getNewInstance((String) arg, pathToItem, pathToSchemas); + } else if (arg instanceof List) { + return getNewInstance((List) arg, 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"); + } + @Override + public NullableShape1BoxedVoid validateAndBox(Nothing? arg, SchemaConfiguration configuration) throws ValidationException { + return new NullableShape1BoxedVoid(validate(arg, configuration)); + } + @Override + 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 { + return new NullableShape1BoxedNumber(validate(arg, configuration)); + } + @Override + 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 { + return new NullableShape1BoxedList(validate(arg, configuration)); + } + @Override + 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 { + if (arg == null) { + Nothing? castArg = (Nothing?) arg; + return validateAndBox(castArg, configuration); + } else if (arg instanceof Boolean booleanArg) { + boolean castArg = booleanArg; + return validateAndBox(castArg, configuration); + } else if (arg instanceof String castArg) { + return validateAndBox(castArg, configuration); + } else if (arg instanceof Number castArg) { + return validateAndBox(castArg, configuration); + } else if (arg instanceof List castArg) { + 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"); + } + } +} diff --git a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/schemas/NullableString.kt b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/schemas/NullableString.kt new file mode 100644 index 00000000000..6fba0f0e912 --- /dev/null +++ b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/schemas/NullableString.kt @@ -0,0 +1,127 @@ +package org.openapijsonschematools.client.components.schemas; +import java.util.HashSet; +import java.util.LinkedHashSet; +import java.util.List; +import java.util.Map; +import java.util.Objects; +import java.util.Set; +import org.checkerframework.checker.nullness.qual.Nullable; +import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags; +import org.openapijsonschematools.client.configurations.SchemaConfiguration; +import org.openapijsonschematools.client.exceptions.ValidationException; +import org.openapijsonschematools.client.schemas.validation.JsonSchema; +import org.openapijsonschematools.client.schemas.validation.JsonSchemaInfo; +import org.openapijsonschematools.client.schemas.validation.NullSchemaValidator; +import org.openapijsonschematools.client.schemas.validation.PathToSchemasMap; +import org.openapijsonschematools.client.schemas.validation.StringSchemaValidator; +import org.openapijsonschematools.client.schemas.validation.ValidationMetadata; + +public class NullableString { + // nest classes so all schemas and input/output classes can be public + + + public sealed interface NullableString1Boxed permits NullableString1BoxedNothing?, NullableString1BoxedString { + @Nullable Object getData(); + } + + public record NullableString1BoxedVoid(Nothing? data) implements NullableString1Boxed { + @Override + public @Nullable Object getData() { + return data; + } + } + + public record NullableString1BoxedString(String data) implements NullableString1Boxed { + @Override + public @Nullable Object getData() { + return data; + } + } + + + + public static class NullableString1 extends JsonSchema implements NullSchemaValidator, StringSchemaValidator { + /* + NOTE: This class is auto generated by OpenAPI JSON Schema Generator. + Ref: https://github.com/openapi-json-schema-tools/openapi-json-schema-generator + + Do not edit the class manually. + */ + private static @Nullable NullableString1 instance = null; + + protected NullableString1() { + super(new JsonSchemaInfo() + .type(Set.of( + Nothing?.class, + String.class + )) + ); + } + + public static NullableString1 getInstance() { + if (instance == null) { + instance = new NullableString1(); + } + return instance; + } + + @Override + public Nothing? validate(Nothing? arg, SchemaConfiguration configuration) throws ValidationException { + Set> pathSet = new HashSet<>(); + List pathToItem = List.of("args[0"); + Nothing? castArg = castToAllowedTypes(arg, pathToItem, pathSet); + SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().build())); + ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, new PathToSchemasMap(), new LinkedHashSet<>()); + getPathToSchemas(this, castArg, validationMetadata, pathSet); + return castArg; + } + + @Override + public String validate(String arg, SchemaConfiguration configuration) throws ValidationException { + Set> pathSet = new HashSet<>(); + List pathToItem = List.of("args[0"); + String castArg = castToAllowedTypes(arg, pathToItem, pathSet); + SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().build())); + ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, new PathToSchemasMap(), new LinkedHashSet<>()); + getPathToSchemas(this, castArg, validationMetadata, pathSet); + return castArg; + } + + @Override + public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { + if (arg == null) { + return validate((Nothing?) 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"); + } + @Override + public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { + if (arg == null) { + return getNewInstance((Nothing?) 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"); + } + @Override + public NullableString1BoxedVoid validateAndBox(Nothing? arg, SchemaConfiguration configuration) throws ValidationException { + return new NullableString1BoxedVoid(validate(arg, configuration)); + } + @Override + 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 { + if (arg == null) { + Nothing? castArg = (Nothing?) 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"); + } + } +} diff --git a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/schemas/NumberOnly.kt b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/schemas/NumberOnly.kt new file mode 100644 index 00000000000..4588c7a1b23 --- /dev/null +++ b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/schemas/NumberOnly.kt @@ -0,0 +1,224 @@ +package org.openapijsonschematools.client.components.schemas; +import java.util.ArrayList; +import java.util.HashSet; +import java.util.LinkedHashMap; +import java.util.LinkedHashSet; +import java.util.List; +import java.util.Map; +import java.util.Objects; +import java.util.Set; +import org.checkerframework.checker.nullness.qual.Nullable; +import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags; +import org.openapijsonschematools.client.configurations.SchemaConfiguration; +import org.openapijsonschematools.client.exceptions.InvalidAdditionalPropertyException; +import org.openapijsonschematools.client.exceptions.UnsetPropertyException; +import org.openapijsonschematools.client.exceptions.ValidationException; +import org.openapijsonschematools.client.schemas.GenericBuilder; +import org.openapijsonschematools.client.schemas.NumberJsonSchema; +import org.openapijsonschematools.client.schemas.UnsetAddPropsSetter; +import org.openapijsonschematools.client.schemas.validation.FrozenMap; +import org.openapijsonschematools.client.schemas.validation.JsonSchema; +import org.openapijsonschematools.client.schemas.validation.JsonSchemaInfo; +import org.openapijsonschematools.client.schemas.validation.MapSchemaValidator; +import org.openapijsonschematools.client.schemas.validation.PathToSchemasMap; +import org.openapijsonschematools.client.schemas.validation.PropertyEntry; +import org.openapijsonschematools.client.schemas.validation.ValidationMetadata; + +public class NumberOnly { + // nest classes so all schemas and input/output classes can be public + + + public static class JustNumber extends NumberJsonSchema.NumberJsonSchema1 { + private static @Nullable JustNumber instance = null; + public static JustNumber getInstance() { + if (instance == null) { + instance = new JustNumber(); + } + return instance; + } + } + + + public static class NumberOnlyMap extends FrozenMap<@Nullable Object> { + protected NumberOnlyMap(FrozenMap<@Nullable Object> m) { + super(m); + } + public static final Set requiredKeys = Set.of(); + public static final Set optionalKeys = Set.of( + "JustNumber" + ); + public static NumberOnlyMap of(Map arg, SchemaConfiguration configuration) throws ValidationException { + return NumberOnly1.getInstance().validate(arg, configuration); + } + + public Number JustNumber() throws UnsetPropertyException { + String key = "JustNumber"; + throwIfKeyNotPresent(key); + @Nullable Object value = get(key); + if (!(value instanceof Number)) { + throw new RuntimeException("Invalid value stored for JustNumber"); + } + return (Number) value; + } + + public @Nullable Object getAdditionalProperty(String name) throws UnsetPropertyException, InvalidAdditionalPropertyException { + throwIfKeyKnown(name, requiredKeys, optionalKeys); + throwIfKeyNotPresent(name); + return get(name); + } + } + + public interface SetterForJustNumber { + Map getInstance(); + T getBuilderAfterJustNumber(Map instance); + + default T JustNumber(int value) { + var instance = getInstance(); + instance.put("JustNumber", value); + return getBuilderAfterJustNumber(instance); + } + + default T JustNumber(float value) { + var instance = getInstance(); + instance.put("JustNumber", value); + return getBuilderAfterJustNumber(instance); + } + + default T JustNumber(long value) { + var instance = getInstance(); + instance.put("JustNumber", value); + return getBuilderAfterJustNumber(instance); + } + + default T JustNumber(double value) { + var instance = getInstance(); + instance.put("JustNumber", value); + return getBuilderAfterJustNumber(instance); + } + } + + public static class NumberOnlyMapBuilder extends UnsetAddPropsSetter implements GenericBuilder>, SetterForJustNumber { + private final Map instance; + private static final Set knownKeys = Set.of( + "JustNumber" + ); + public Set getKnownKeys() { + return knownKeys; + } + public NumberOnlyMapBuilder() { + this.instance = new LinkedHashMap<>(); + } + public Map build() { + return instance; + } + public Map getInstance() { + return instance; + } + public NumberOnlyMapBuilder getBuilderAfterJustNumber(Map instance) { + return this; + } + public NumberOnlyMapBuilder getBuilderAfterAdditionalProperty(Map instance) { + return this; + } + } + + + public sealed interface NumberOnly1Boxed permits NumberOnly1BoxedMap { + @Nullable Object getData(); + } + + public record NumberOnly1BoxedMap(NumberOnlyMap data) implements NumberOnly1Boxed { + @Override + public @Nullable Object getData() { + return data; + } + } + + + public static class NumberOnly1 extends JsonSchema implements MapSchemaValidator { + /* + NOTE: This class is auto generated by OpenAPI JSON Schema Generator. + Ref: https://github.com/openapi-json-schema-tools/openapi-json-schema-generator + + Do not edit the class manually. + */ + private static @Nullable NumberOnly1 instance = null; + + protected NumberOnly1() { + super(new JsonSchemaInfo() + .type(Set.of(Map.class)) + .properties(Map.ofEntries( + new PropertyEntry("JustNumber", JustNumber.class) + )) + ); + } + + public static NumberOnly1 getInstance() { + if (instance == null) { + instance = new NumberOnly1(); + } + return instance; + } + + 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 RuntimeException("Invalid non-string key value"); + } + String propertyName = (String) entryKey; + List propertyPathToItem = new ArrayList<>(pathToItem); + propertyPathToItem.add(propertyName); + Object value = entry.getValue(); + LinkedHashMap, Nothing?> schemas = pathToSchemas.get(propertyPathToItem); + if (schemas == null) { + throw new RuntimeException("Validation result is invalid, schemas must exist for a pathToItem"); + } + JsonSchema propertySchema = schemas.entrySet().iterator().next().getKey(); + @Nullable Object propertyInstance = propertySchema.getNewInstance(value, propertyPathToItem, pathToSchemas); + properties.put(propertyName, propertyInstance); + } + FrozenMap<@Nullable Object> castProperties = new FrozenMap<>(properties); + return new NumberOnlyMap(castProperties); + } + + 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); + SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().build())); + ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, new PathToSchemasMap(), new LinkedHashSet<>()); + PathToSchemasMap pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet); + return getNewInstance(castArg, validationMetadata.pathToItem(), pathToSchemasMap); + } + + + @Override + public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws 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"); + } + @Override + public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { + if (arg instanceof Map) { + return getNewInstance((Map) arg, pathToItem, pathToSchemas); + } + 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 { + return new NumberOnly1BoxedMap(validate(arg, configuration)); + } + @Override + public NumberOnly1Boxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { + 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"); + } + } + +} diff --git a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/schemas/NumberSchema.kt b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/schemas/NumberSchema.kt new file mode 100644 index 00000000000..c28406475e1 --- /dev/null +++ b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/schemas/NumberSchema.kt @@ -0,0 +1,19 @@ +package org.openapijsonschematools.client.components.schemas; +import org.checkerframework.checker.nullness.qual.Nullable; +import org.openapijsonschematools.client.schemas.NumberJsonSchema; + +public class NumberSchema extends NumberJsonSchema { + // nest classes so all schemas and input/output classes can be public + + + public static class NumberSchema1 extends NumberJsonSchema.NumberJsonSchema1 { + private static @Nullable NumberSchema1 instance = null; + public static NumberSchema1 getInstance() { + if (instance == null) { + instance = new NumberSchema1(); + } + return instance; + } + } + +} diff --git a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/schemas/NumberWithExclusiveMinMax.kt b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/schemas/NumberWithExclusiveMinMax.kt new file mode 100644 index 00000000000..12e6b1ceb4b --- /dev/null +++ b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/schemas/NumberWithExclusiveMinMax.kt @@ -0,0 +1,116 @@ +package org.openapijsonschematools.client.components.schemas; +import java.util.HashSet; +import java.util.LinkedHashSet; +import java.util.List; +import java.util.Objects; +import java.util.Set; +import org.checkerframework.checker.nullness.qual.Nullable; +import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags; +import org.openapijsonschematools.client.configurations.SchemaConfiguration; +import org.openapijsonschematools.client.exceptions.ValidationException; +import org.openapijsonschematools.client.schemas.validation.JsonSchema; +import org.openapijsonschematools.client.schemas.validation.JsonSchemaInfo; +import org.openapijsonschematools.client.schemas.validation.NumberSchemaValidator; +import org.openapijsonschematools.client.schemas.validation.PathToSchemasMap; +import org.openapijsonschematools.client.schemas.validation.ValidationMetadata; + +public class NumberWithExclusiveMinMax { + // nest classes so all schemas and input/output classes can be public + + + public sealed interface NumberWithExclusiveMinMax1Boxed permits NumberWithExclusiveMinMax1BoxedNumber { + @Nullable Object getData(); + } + + public record NumberWithExclusiveMinMax1BoxedNumber(Number data) implements NumberWithExclusiveMinMax1Boxed { + @Override + public @Nullable Object getData() { + return data; + } + } + + + + public static class NumberWithExclusiveMinMax1 extends JsonSchema implements NumberSchemaValidator { + /* + NOTE: This class is auto generated by OpenAPI JSON Schema Generator. + Ref: https://github.com/openapi-json-schema-tools/openapi-json-schema-generator + + Do not edit the class manually. + */ + private static @Nullable NumberWithExclusiveMinMax1 instance = null; + + protected NumberWithExclusiveMinMax1() { + super(new JsonSchemaInfo() + .type(Set.of( + Integer.class, + Long.class, + Float.class, + Double.class + )) + .exclusiveMaximum(12) + .exclusiveMinimum(10) + ); + } + + public static NumberWithExclusiveMinMax1 getInstance() { + if (instance == null) { + instance = new NumberWithExclusiveMinMax1(); + } + return instance; + } + + @Override + public Number validate(Number arg, SchemaConfiguration configuration) throws ValidationException { + Set> pathSet = new HashSet<>(); + List pathToItem = List.of("args[0"); + Number castArg = castToAllowedTypes(arg, pathToItem, pathSet); + SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().build())); + ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, new PathToSchemasMap(), new LinkedHashSet<>()); + PathToSchemasMap pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet); + return castArg; + } + + public int validate(int arg, SchemaConfiguration configuration) throws ValidationException { + return (int) validate((Number) arg, configuration); + } + + public long validate(long arg, SchemaConfiguration configuration) throws ValidationException { + return (long) validate((Number) arg, configuration); + } + + public float validate(float arg, SchemaConfiguration configuration) throws ValidationException { + return (float) validate((Number) arg, configuration); + } + + 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 { + 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"); + } + @Override + public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { + 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"); + } + @Override + 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 { + 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"); + } + } +} diff --git a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/schemas/NumberWithValidations.kt b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/schemas/NumberWithValidations.kt new file mode 100644 index 00000000000..8798481a6db --- /dev/null +++ b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/schemas/NumberWithValidations.kt @@ -0,0 +1,116 @@ +package org.openapijsonschematools.client.components.schemas; +import java.util.HashSet; +import java.util.LinkedHashSet; +import java.util.List; +import java.util.Objects; +import java.util.Set; +import org.checkerframework.checker.nullness.qual.Nullable; +import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags; +import org.openapijsonschematools.client.configurations.SchemaConfiguration; +import org.openapijsonschematools.client.exceptions.ValidationException; +import org.openapijsonschematools.client.schemas.validation.JsonSchema; +import org.openapijsonschematools.client.schemas.validation.JsonSchemaInfo; +import org.openapijsonschematools.client.schemas.validation.NumberSchemaValidator; +import org.openapijsonschematools.client.schemas.validation.PathToSchemasMap; +import org.openapijsonschematools.client.schemas.validation.ValidationMetadata; + +public class NumberWithValidations { + // nest classes so all schemas and input/output classes can be public + + + public sealed interface NumberWithValidations1Boxed permits NumberWithValidations1BoxedNumber { + @Nullable Object getData(); + } + + public record NumberWithValidations1BoxedNumber(Number data) implements NumberWithValidations1Boxed { + @Override + public @Nullable Object getData() { + return data; + } + } + + + + public static class NumberWithValidations1 extends JsonSchema implements NumberSchemaValidator { + /* + NOTE: This class is auto generated by OpenAPI JSON Schema Generator. + Ref: https://github.com/openapi-json-schema-tools/openapi-json-schema-generator + + Do not edit the class manually. + */ + private static @Nullable NumberWithValidations1 instance = null; + + protected NumberWithValidations1() { + super(new JsonSchemaInfo() + .type(Set.of( + Integer.class, + Long.class, + Float.class, + Double.class + )) + .maximum(20) + .minimum(10) + ); + } + + public static NumberWithValidations1 getInstance() { + if (instance == null) { + instance = new NumberWithValidations1(); + } + return instance; + } + + @Override + public Number validate(Number arg, SchemaConfiguration configuration) throws ValidationException { + Set> pathSet = new HashSet<>(); + List pathToItem = List.of("args[0"); + Number castArg = castToAllowedTypes(arg, pathToItem, pathSet); + SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().build())); + ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, new PathToSchemasMap(), new LinkedHashSet<>()); + PathToSchemasMap pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet); + return castArg; + } + + public int validate(int arg, SchemaConfiguration configuration) throws ValidationException { + return (int) validate((Number) arg, configuration); + } + + public long validate(long arg, SchemaConfiguration configuration) throws ValidationException { + return (long) validate((Number) arg, configuration); + } + + public float validate(float arg, SchemaConfiguration configuration) throws ValidationException { + return (float) validate((Number) arg, configuration); + } + + 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 { + 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"); + } + @Override + public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { + 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"); + } + @Override + 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 { + 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"); + } + } +} diff --git a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/schemas/ObjWithRequiredProps.kt b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/schemas/ObjWithRequiredProps.kt new file mode 100644 index 00000000000..bdfa8f9aba7 --- /dev/null +++ b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/schemas/ObjWithRequiredProps.kt @@ -0,0 +1,220 @@ +package org.openapijsonschematools.client.components.schemas; +import java.util.ArrayList; +import java.util.HashSet; +import java.util.LinkedHashMap; +import java.util.LinkedHashSet; +import java.util.List; +import java.util.Map; +import java.util.Objects; +import java.util.Set; +import org.checkerframework.checker.nullness.qual.Nullable; +import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags; +import org.openapijsonschematools.client.configurations.SchemaConfiguration; +import org.openapijsonschematools.client.exceptions.InvalidAdditionalPropertyException; +import org.openapijsonschematools.client.exceptions.UnsetPropertyException; +import org.openapijsonschematools.client.exceptions.ValidationException; +import org.openapijsonschematools.client.schemas.GenericBuilder; +import org.openapijsonschematools.client.schemas.StringJsonSchema; +import org.openapijsonschematools.client.schemas.UnsetAddPropsSetter; +import org.openapijsonschematools.client.schemas.validation.FrozenMap; +import org.openapijsonschematools.client.schemas.validation.JsonSchema; +import org.openapijsonschematools.client.schemas.validation.JsonSchemaInfo; +import org.openapijsonschematools.client.schemas.validation.MapSchemaValidator; +import org.openapijsonschematools.client.schemas.validation.PathToSchemasMap; +import org.openapijsonschematools.client.schemas.validation.PropertyEntry; +import org.openapijsonschematools.client.schemas.validation.ValidationMetadata; + +public class ObjWithRequiredProps { + // nest classes so all schemas and input/output classes can be public + + + public static class A extends StringJsonSchema.StringJsonSchema1 { + private static @Nullable A instance = null; + public static A getInstance() { + if (instance == null) { + instance = new A(); + } + return instance; + } + } + + + public static class ObjWithRequiredPropsMap extends FrozenMap<@Nullable Object> { + protected ObjWithRequiredPropsMap(FrozenMap<@Nullable Object> m) { + super(m); + } + public static final Set requiredKeys = Set.of( + "a" + ); + public static final Set optionalKeys = Set.of(); + public static ObjWithRequiredPropsMap of(Map arg, SchemaConfiguration configuration) throws ValidationException { + return ObjWithRequiredProps1.getInstance().validate(arg, configuration); + } + + public String a() { + @Nullable Object value = get("a"); + if (!(value instanceof String)) { + throw new RuntimeException("Invalid value stored for a"); + } + return (String) value; + } + + public @Nullable Object getAdditionalProperty(String name) throws UnsetPropertyException, InvalidAdditionalPropertyException { + throwIfKeyKnown(name, requiredKeys, optionalKeys); + throwIfKeyNotPresent(name); + return get(name); + } + } + + public interface SetterForA { + Map getInstance(); + T getBuilderAfterA(Map instance); + + default T a(String value) { + var instance = getInstance(); + instance.put("a", value); + return getBuilderAfterA(instance); + } + } + + public static class ObjWithRequiredPropsMap0Builder extends UnsetAddPropsSetter implements GenericBuilder> { + private final Map instance; + private static final Set knownKeys = Set.of( + "a" + ); + public Set getKnownKeys() { + return knownKeys; + } + public ObjWithRequiredPropsMap0Builder(Map instance) { + this.instance = instance; + } + public Map build() { + return instance; + } + public Map getInstance() { + return instance; + } + public ObjWithRequiredPropsMap0Builder getBuilderAfterAdditionalProperty(Map instance) { + return this; + } + } + + public static class ObjWithRequiredPropsMapBuilder implements SetterForA { + private final Map instance; + public ObjWithRequiredPropsMapBuilder() { + this.instance = new LinkedHashMap<>(); + } + public Map getInstance() { + return instance; + } + public ObjWithRequiredPropsMap0Builder getBuilderAfterA(Map instance) { + return new ObjWithRequiredPropsMap0Builder(instance); + } + } + + + public sealed interface ObjWithRequiredProps1Boxed permits ObjWithRequiredProps1BoxedMap { + @Nullable Object getData(); + } + + public record ObjWithRequiredProps1BoxedMap(ObjWithRequiredPropsMap data) implements ObjWithRequiredProps1Boxed { + @Override + public @Nullable Object getData() { + return data; + } + } + + + public static class ObjWithRequiredProps1 extends JsonSchema implements MapSchemaValidator { + /* + NOTE: This class is auto generated by OpenAPI JSON Schema Generator. + Ref: https://github.com/openapi-json-schema-tools/openapi-json-schema-generator + + Do not edit the class manually. + */ + private static @Nullable ObjWithRequiredProps1 instance = null; + + protected ObjWithRequiredProps1() { + super(new JsonSchemaInfo() + .type(Set.of(Map.class)) + .properties(Map.ofEntries( + new PropertyEntry("a", A.class) + )) + .required(Set.of( + "a" + )) + .allOf(List.of( + ObjWithRequiredPropsBase.ObjWithRequiredPropsBase1.class + )) + ); + } + + public static ObjWithRequiredProps1 getInstance() { + if (instance == null) { + instance = new ObjWithRequiredProps1(); + } + return instance; + } + + 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 RuntimeException("Invalid non-string key value"); + } + String propertyName = (String) entryKey; + List propertyPathToItem = new ArrayList<>(pathToItem); + propertyPathToItem.add(propertyName); + Object value = entry.getValue(); + LinkedHashMap, Nothing?> schemas = pathToSchemas.get(propertyPathToItem); + if (schemas == null) { + throw new RuntimeException("Validation result is invalid, schemas must exist for a pathToItem"); + } + JsonSchema propertySchema = schemas.entrySet().iterator().next().getKey(); + @Nullable Object propertyInstance = propertySchema.getNewInstance(value, propertyPathToItem, pathToSchemas); + properties.put(propertyName, propertyInstance); + } + FrozenMap<@Nullable Object> castProperties = new FrozenMap<>(properties); + return new ObjWithRequiredPropsMap(castProperties); + } + + 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); + SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().build())); + ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, new PathToSchemasMap(), new LinkedHashSet<>()); + PathToSchemasMap pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet); + return getNewInstance(castArg, validationMetadata.pathToItem(), pathToSchemasMap); + } + + + @Override + public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws 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"); + } + @Override + public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { + if (arg instanceof Map) { + return getNewInstance((Map) arg, pathToItem, pathToSchemas); + } + 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 { + return new ObjWithRequiredProps1BoxedMap(validate(arg, configuration)); + } + @Override + public ObjWithRequiredProps1Boxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { + 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"); + } + } + +} diff --git a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/schemas/ObjWithRequiredPropsBase.kt b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/schemas/ObjWithRequiredPropsBase.kt new file mode 100644 index 00000000000..fb8aebee635 --- /dev/null +++ b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/schemas/ObjWithRequiredPropsBase.kt @@ -0,0 +1,217 @@ +package org.openapijsonschematools.client.components.schemas; +import java.util.ArrayList; +import java.util.HashSet; +import java.util.LinkedHashMap; +import java.util.LinkedHashSet; +import java.util.List; +import java.util.Map; +import java.util.Objects; +import java.util.Set; +import org.checkerframework.checker.nullness.qual.Nullable; +import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags; +import org.openapijsonschematools.client.configurations.SchemaConfiguration; +import org.openapijsonschematools.client.exceptions.InvalidAdditionalPropertyException; +import org.openapijsonschematools.client.exceptions.UnsetPropertyException; +import org.openapijsonschematools.client.exceptions.ValidationException; +import org.openapijsonschematools.client.schemas.GenericBuilder; +import org.openapijsonschematools.client.schemas.StringJsonSchema; +import org.openapijsonschematools.client.schemas.UnsetAddPropsSetter; +import org.openapijsonschematools.client.schemas.validation.FrozenMap; +import org.openapijsonschematools.client.schemas.validation.JsonSchema; +import org.openapijsonschematools.client.schemas.validation.JsonSchemaInfo; +import org.openapijsonschematools.client.schemas.validation.MapSchemaValidator; +import org.openapijsonschematools.client.schemas.validation.PathToSchemasMap; +import org.openapijsonschematools.client.schemas.validation.PropertyEntry; +import org.openapijsonschematools.client.schemas.validation.ValidationMetadata; + +public class ObjWithRequiredPropsBase { + // nest classes so all schemas and input/output classes can be public + + + public static class B extends StringJsonSchema.StringJsonSchema1 { + private static @Nullable B instance = null; + public static B getInstance() { + if (instance == null) { + instance = new B(); + } + return instance; + } + } + + + public static class ObjWithRequiredPropsBaseMap extends FrozenMap<@Nullable Object> { + protected ObjWithRequiredPropsBaseMap(FrozenMap<@Nullable Object> m) { + super(m); + } + public static final Set requiredKeys = Set.of( + "b" + ); + public static final Set optionalKeys = Set.of(); + public static ObjWithRequiredPropsBaseMap of(Map arg, SchemaConfiguration configuration) throws ValidationException { + return ObjWithRequiredPropsBase1.getInstance().validate(arg, configuration); + } + + public String b() { + @Nullable Object value = get("b"); + if (!(value instanceof String)) { + throw new RuntimeException("Invalid value stored for b"); + } + return (String) value; + } + + public @Nullable Object getAdditionalProperty(String name) throws UnsetPropertyException, InvalidAdditionalPropertyException { + throwIfKeyKnown(name, requiredKeys, optionalKeys); + throwIfKeyNotPresent(name); + return get(name); + } + } + + public interface SetterForB { + Map getInstance(); + T getBuilderAfterB(Map instance); + + default T b(String value) { + var instance = getInstance(); + instance.put("b", value); + return getBuilderAfterB(instance); + } + } + + public static class ObjWithRequiredPropsBaseMap0Builder extends UnsetAddPropsSetter implements GenericBuilder> { + private final Map instance; + private static final Set knownKeys = Set.of( + "b" + ); + public Set getKnownKeys() { + return knownKeys; + } + public ObjWithRequiredPropsBaseMap0Builder(Map instance) { + this.instance = instance; + } + public Map build() { + return instance; + } + public Map getInstance() { + return instance; + } + public ObjWithRequiredPropsBaseMap0Builder getBuilderAfterAdditionalProperty(Map instance) { + return this; + } + } + + public static class ObjWithRequiredPropsBaseMapBuilder implements SetterForB { + private final Map instance; + public ObjWithRequiredPropsBaseMapBuilder() { + this.instance = new LinkedHashMap<>(); + } + public Map getInstance() { + return instance; + } + public ObjWithRequiredPropsBaseMap0Builder getBuilderAfterB(Map instance) { + return new ObjWithRequiredPropsBaseMap0Builder(instance); + } + } + + + public sealed interface ObjWithRequiredPropsBase1Boxed permits ObjWithRequiredPropsBase1BoxedMap { + @Nullable Object getData(); + } + + public record ObjWithRequiredPropsBase1BoxedMap(ObjWithRequiredPropsBaseMap data) implements ObjWithRequiredPropsBase1Boxed { + @Override + public @Nullable Object getData() { + return data; + } + } + + + public static class ObjWithRequiredPropsBase1 extends JsonSchema implements MapSchemaValidator { + /* + NOTE: This class is auto generated by OpenAPI JSON Schema Generator. + Ref: https://github.com/openapi-json-schema-tools/openapi-json-schema-generator + + Do not edit the class manually. + */ + private static @Nullable ObjWithRequiredPropsBase1 instance = null; + + protected ObjWithRequiredPropsBase1() { + super(new JsonSchemaInfo() + .type(Set.of(Map.class)) + .properties(Map.ofEntries( + new PropertyEntry("b", B.class) + )) + .required(Set.of( + "b" + )) + ); + } + + public static ObjWithRequiredPropsBase1 getInstance() { + if (instance == null) { + instance = new ObjWithRequiredPropsBase1(); + } + return instance; + } + + 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 RuntimeException("Invalid non-string key value"); + } + String propertyName = (String) entryKey; + List propertyPathToItem = new ArrayList<>(pathToItem); + propertyPathToItem.add(propertyName); + Object value = entry.getValue(); + LinkedHashMap, Nothing?> schemas = pathToSchemas.get(propertyPathToItem); + if (schemas == null) { + throw new RuntimeException("Validation result is invalid, schemas must exist for a pathToItem"); + } + JsonSchema propertySchema = schemas.entrySet().iterator().next().getKey(); + @Nullable Object propertyInstance = propertySchema.getNewInstance(value, propertyPathToItem, pathToSchemas); + properties.put(propertyName, propertyInstance); + } + FrozenMap<@Nullable Object> castProperties = new FrozenMap<>(properties); + return new ObjWithRequiredPropsBaseMap(castProperties); + } + + 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); + SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().build())); + ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, new PathToSchemasMap(), new LinkedHashSet<>()); + PathToSchemasMap pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet); + return getNewInstance(castArg, validationMetadata.pathToItem(), pathToSchemasMap); + } + + + @Override + public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws 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"); + } + @Override + public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { + if (arg instanceof Map) { + return getNewInstance((Map) arg, pathToItem, pathToSchemas); + } + 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 { + return new ObjWithRequiredPropsBase1BoxedMap(validate(arg, configuration)); + } + @Override + public ObjWithRequiredPropsBase1Boxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { + 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"); + } + } + +} diff --git a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/schemas/ObjectInterface.kt b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/schemas/ObjectInterface.kt new file mode 100644 index 00000000000..9c844505d2c --- /dev/null +++ b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/schemas/ObjectInterface.kt @@ -0,0 +1,20 @@ +package org.openapijsonschematools.client.components.schemas; +import org.checkerframework.checker.nullness.qual.Nullable; +import org.openapijsonschematools.client.schemas.MapJsonSchema; +import org.openapijsonschematools.client.schemas.validation.FrozenMap; + +public class ObjectInterface extends MapJsonSchema { + // nest classes so all schemas and input/output classes can be public + + + public static class ObjectInterface1 extends MapJsonSchema.MapJsonSchema1 { + private static @Nullable ObjectInterface1 instance = null; + public static ObjectInterface1 getInstance() { + if (instance == null) { + instance = new ObjectInterface1(); + } + return instance; + } + } + +} diff --git a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/schemas/ObjectModelWithArgAndArgsProperties.kt b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/schemas/ObjectModelWithArgAndArgsProperties.kt new file mode 100644 index 00000000000..d786a0dedde --- /dev/null +++ b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/schemas/ObjectModelWithArgAndArgsProperties.kt @@ -0,0 +1,280 @@ +package org.openapijsonschematools.client.components.schemas; +import java.util.ArrayList; +import java.util.HashSet; +import java.util.LinkedHashMap; +import java.util.LinkedHashSet; +import java.util.List; +import java.util.Map; +import java.util.Objects; +import java.util.Set; +import org.checkerframework.checker.nullness.qual.Nullable; +import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags; +import org.openapijsonschematools.client.configurations.SchemaConfiguration; +import org.openapijsonschematools.client.exceptions.InvalidAdditionalPropertyException; +import org.openapijsonschematools.client.exceptions.UnsetPropertyException; +import org.openapijsonschematools.client.exceptions.ValidationException; +import org.openapijsonschematools.client.schemas.GenericBuilder; +import org.openapijsonschematools.client.schemas.StringJsonSchema; +import org.openapijsonschematools.client.schemas.UnsetAddPropsSetter; +import org.openapijsonschematools.client.schemas.validation.FrozenMap; +import org.openapijsonschematools.client.schemas.validation.JsonSchema; +import org.openapijsonschematools.client.schemas.validation.JsonSchemaInfo; +import org.openapijsonschematools.client.schemas.validation.MapSchemaValidator; +import org.openapijsonschematools.client.schemas.validation.PathToSchemasMap; +import org.openapijsonschematools.client.schemas.validation.PropertyEntry; +import org.openapijsonschematools.client.schemas.validation.ValidationMetadata; + +public class ObjectModelWithArgAndArgsProperties { + // nest classes so all schemas and input/output classes can be public + + + public static class Arg extends StringJsonSchema.StringJsonSchema1 { + private static @Nullable Arg instance = null; + public static Arg getInstance() { + if (instance == null) { + instance = new Arg(); + } + return instance; + } + } + + + public static class Args extends StringJsonSchema.StringJsonSchema1 { + private static @Nullable Args instance = null; + public static Args getInstance() { + if (instance == null) { + instance = new Args(); + } + return instance; + } + } + + + public static class ObjectModelWithArgAndArgsPropertiesMap extends FrozenMap<@Nullable Object> { + protected ObjectModelWithArgAndArgsPropertiesMap(FrozenMap<@Nullable Object> m) { + super(m); + } + public static final Set requiredKeys = Set.of( + "arg", + "args" + ); + public static final Set optionalKeys = Set.of(); + public static ObjectModelWithArgAndArgsPropertiesMap of(Map arg, SchemaConfiguration configuration) throws ValidationException { + return ObjectModelWithArgAndArgsProperties1.getInstance().validate(arg, configuration); + } + + public String arg() { + @Nullable Object value = get("arg"); + if (!(value instanceof String)) { + throw new RuntimeException("Invalid value stored for arg"); + } + return (String) value; + } + + public String args() { + @Nullable Object value = get("args"); + if (!(value instanceof String)) { + throw new RuntimeException("Invalid value stored for args"); + } + return (String) value; + } + + public @Nullable Object getAdditionalProperty(String name) throws UnsetPropertyException, InvalidAdditionalPropertyException { + throwIfKeyKnown(name, requiredKeys, optionalKeys); + throwIfKeyNotPresent(name); + return get(name); + } + } + + public interface SetterForArg { + Map getInstance(); + T getBuilderAfterArg(Map instance); + + default T arg(String value) { + var instance = getInstance(); + instance.put("arg", value); + return getBuilderAfterArg(instance); + } + } + + public interface SetterForArgs { + Map getInstance(); + T getBuilderAfterArgs(Map instance); + + default T args(String value) { + var instance = getInstance(); + instance.put("args", value); + return getBuilderAfterArgs(instance); + } + } + + public static class ObjectModelWithArgAndArgsPropertiesMap00Builder extends UnsetAddPropsSetter implements GenericBuilder> { + private final Map instance; + private static final Set knownKeys = Set.of( + "arg", + "args" + ); + public Set getKnownKeys() { + return knownKeys; + } + public ObjectModelWithArgAndArgsPropertiesMap00Builder(Map instance) { + this.instance = instance; + } + public Map build() { + return instance; + } + public Map getInstance() { + return instance; + } + public ObjectModelWithArgAndArgsPropertiesMap00Builder getBuilderAfterAdditionalProperty(Map instance) { + return this; + } + } + + public static class ObjectModelWithArgAndArgsPropertiesMap01Builder implements SetterForArgs { + private final Map instance; + public ObjectModelWithArgAndArgsPropertiesMap01Builder(Map instance) { + this.instance = instance; + } + public Map getInstance() { + return instance; + } + public ObjectModelWithArgAndArgsPropertiesMap00Builder getBuilderAfterArgs(Map instance) { + return new ObjectModelWithArgAndArgsPropertiesMap00Builder(instance); + } + } + + public static class ObjectModelWithArgAndArgsPropertiesMap10Builder implements SetterForArg { + private final Map instance; + public ObjectModelWithArgAndArgsPropertiesMap10Builder(Map instance) { + this.instance = instance; + } + public Map getInstance() { + return instance; + } + public ObjectModelWithArgAndArgsPropertiesMap00Builder getBuilderAfterArg(Map instance) { + return new ObjectModelWithArgAndArgsPropertiesMap00Builder(instance); + } + } + + public static class ObjectModelWithArgAndArgsPropertiesMapBuilder implements SetterForArg, SetterForArgs { + private final Map instance; + public ObjectModelWithArgAndArgsPropertiesMapBuilder() { + this.instance = new LinkedHashMap<>(); + } + public Map getInstance() { + return instance; + } + public ObjectModelWithArgAndArgsPropertiesMap01Builder getBuilderAfterArg(Map instance) { + return new ObjectModelWithArgAndArgsPropertiesMap01Builder(instance); + } + public ObjectModelWithArgAndArgsPropertiesMap10Builder getBuilderAfterArgs(Map instance) { + return new ObjectModelWithArgAndArgsPropertiesMap10Builder(instance); + } + } + + + public sealed interface ObjectModelWithArgAndArgsProperties1Boxed permits ObjectModelWithArgAndArgsProperties1BoxedMap { + @Nullable Object getData(); + } + + public record ObjectModelWithArgAndArgsProperties1BoxedMap(ObjectModelWithArgAndArgsPropertiesMap data) implements ObjectModelWithArgAndArgsProperties1Boxed { + @Override + public @Nullable Object getData() { + return data; + } + } + + + public static class ObjectModelWithArgAndArgsProperties1 extends JsonSchema implements MapSchemaValidator { + /* + NOTE: This class is auto generated by OpenAPI JSON Schema Generator. + Ref: https://github.com/openapi-json-schema-tools/openapi-json-schema-generator + + Do not edit the class manually. + */ + private static @Nullable ObjectModelWithArgAndArgsProperties1 instance = null; + + protected ObjectModelWithArgAndArgsProperties1() { + super(new JsonSchemaInfo() + .type(Set.of(Map.class)) + .properties(Map.ofEntries( + new PropertyEntry("arg", Arg.class), + new PropertyEntry("args", Args.class) + )) + .required(Set.of( + "arg", + "args" + )) + ); + } + + public static ObjectModelWithArgAndArgsProperties1 getInstance() { + if (instance == null) { + instance = new ObjectModelWithArgAndArgsProperties1(); + } + return instance; + } + + 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 RuntimeException("Invalid non-string key value"); + } + String propertyName = (String) entryKey; + List propertyPathToItem = new ArrayList<>(pathToItem); + propertyPathToItem.add(propertyName); + Object value = entry.getValue(); + LinkedHashMap, Nothing?> schemas = pathToSchemas.get(propertyPathToItem); + if (schemas == null) { + throw new RuntimeException("Validation result is invalid, schemas must exist for a pathToItem"); + } + JsonSchema propertySchema = schemas.entrySet().iterator().next().getKey(); + @Nullable Object propertyInstance = propertySchema.getNewInstance(value, propertyPathToItem, pathToSchemas); + properties.put(propertyName, propertyInstance); + } + FrozenMap<@Nullable Object> castProperties = new FrozenMap<>(properties); + return new ObjectModelWithArgAndArgsPropertiesMap(castProperties); + } + + 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); + SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().build())); + ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, new PathToSchemasMap(), new LinkedHashSet<>()); + PathToSchemasMap pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet); + return getNewInstance(castArg, validationMetadata.pathToItem(), pathToSchemasMap); + } + + + @Override + public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws 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"); + } + @Override + public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { + if (arg instanceof Map) { + return getNewInstance((Map) arg, pathToItem, pathToSchemas); + } + 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 { + return new ObjectModelWithArgAndArgsProperties1BoxedMap(validate(arg, configuration)); + } + @Override + public ObjectModelWithArgAndArgsProperties1Boxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { + 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"); + } + } + +} diff --git a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/schemas/ObjectModelWithRefProps.kt b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/schemas/ObjectModelWithRefProps.kt new file mode 100644 index 00000000000..7b79624f159 --- /dev/null +++ b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/schemas/ObjectModelWithRefProps.kt @@ -0,0 +1,268 @@ +package org.openapijsonschematools.client.components.schemas; +import java.util.ArrayList; +import java.util.HashSet; +import java.util.LinkedHashMap; +import java.util.LinkedHashSet; +import java.util.List; +import java.util.Map; +import java.util.Objects; +import java.util.Set; +import org.checkerframework.checker.nullness.qual.Nullable; +import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags; +import org.openapijsonschematools.client.configurations.SchemaConfiguration; +import org.openapijsonschematools.client.exceptions.InvalidAdditionalPropertyException; +import org.openapijsonschematools.client.exceptions.UnsetPropertyException; +import org.openapijsonschematools.client.exceptions.ValidationException; +import org.openapijsonschematools.client.schemas.GenericBuilder; +import org.openapijsonschematools.client.schemas.UnsetAddPropsSetter; +import org.openapijsonschematools.client.schemas.validation.FrozenMap; +import org.openapijsonschematools.client.schemas.validation.JsonSchema; +import org.openapijsonschematools.client.schemas.validation.JsonSchemaInfo; +import org.openapijsonschematools.client.schemas.validation.MapSchemaValidator; +import org.openapijsonschematools.client.schemas.validation.PathToSchemasMap; +import org.openapijsonschematools.client.schemas.validation.PropertyEntry; +import org.openapijsonschematools.client.schemas.validation.ValidationMetadata; + +public class ObjectModelWithRefProps { + // nest classes so all schemas and input/output classes can be public + + + public static class ObjectModelWithRefPropsMap extends FrozenMap<@Nullable Object> { + protected ObjectModelWithRefPropsMap(FrozenMap<@Nullable Object> m) { + super(m); + } + public static final Set requiredKeys = Set.of(); + public static final Set optionalKeys = Set.of( + "myNumber", + "myString", + "myBoolean" + ); + public static ObjectModelWithRefPropsMap of(Map arg, SchemaConfiguration configuration) throws ValidationException { + return ObjectModelWithRefProps1.getInstance().validate(arg, configuration); + } + + public Number myNumber() throws UnsetPropertyException { + String key = "myNumber"; + throwIfKeyNotPresent(key); + @Nullable Object value = get(key); + if (!(value instanceof Number)) { + throw new RuntimeException("Invalid value stored for myNumber"); + } + return (Number) value; + } + + public String myString() throws UnsetPropertyException { + String key = "myString"; + throwIfKeyNotPresent(key); + @Nullable Object value = get(key); + if (!(value instanceof String)) { + throw new RuntimeException("Invalid value stored for myString"); + } + return (String) value; + } + + public boolean myBoolean() throws UnsetPropertyException { + String key = "myBoolean"; + throwIfKeyNotPresent(key); + @Nullable Object value = get(key); + if (!(value instanceof Boolean)) { + throw new RuntimeException("Invalid value stored for myBoolean"); + } + return (boolean) value; + } + + public @Nullable Object getAdditionalProperty(String name) throws UnsetPropertyException, InvalidAdditionalPropertyException { + throwIfKeyKnown(name, requiredKeys, optionalKeys); + throwIfKeyNotPresent(name); + return get(name); + } + } + + public interface SetterForMyNumber { + Map getInstance(); + T getBuilderAfterMyNumber(Map instance); + + default T myNumber(int value) { + var instance = getInstance(); + instance.put("myNumber", value); + return getBuilderAfterMyNumber(instance); + } + + default T myNumber(float value) { + var instance = getInstance(); + instance.put("myNumber", value); + return getBuilderAfterMyNumber(instance); + } + + default T myNumber(long value) { + var instance = getInstance(); + instance.put("myNumber", value); + return getBuilderAfterMyNumber(instance); + } + + default T myNumber(double value) { + var instance = getInstance(); + instance.put("myNumber", value); + return getBuilderAfterMyNumber(instance); + } + } + + public interface SetterForMyString { + Map getInstance(); + T getBuilderAfterMyString(Map instance); + + default T myString(String value) { + var instance = getInstance(); + instance.put("myString", value); + return getBuilderAfterMyString(instance); + } + } + + public interface SetterForMyBoolean { + Map getInstance(); + T getBuilderAfterMyBoolean(Map instance); + + default T myBoolean(boolean value) { + var instance = getInstance(); + instance.put("myBoolean", value); + return getBuilderAfterMyBoolean(instance); + } + } + + public static class ObjectModelWithRefPropsMapBuilder extends UnsetAddPropsSetter implements GenericBuilder>, SetterForMyNumber, SetterForMyString, SetterForMyBoolean { + private final Map instance; + private static final Set knownKeys = Set.of( + "myNumber", + "myString", + "myBoolean" + ); + public Set getKnownKeys() { + return knownKeys; + } + public ObjectModelWithRefPropsMapBuilder() { + this.instance = new LinkedHashMap<>(); + } + public Map build() { + return instance; + } + public Map getInstance() { + return instance; + } + public ObjectModelWithRefPropsMapBuilder getBuilderAfterMyNumber(Map instance) { + return this; + } + public ObjectModelWithRefPropsMapBuilder getBuilderAfterMyString(Map instance) { + return this; + } + public ObjectModelWithRefPropsMapBuilder getBuilderAfterMyBoolean(Map instance) { + return this; + } + public ObjectModelWithRefPropsMapBuilder getBuilderAfterAdditionalProperty(Map instance) { + return this; + } + } + + + public sealed interface ObjectModelWithRefProps1Boxed permits ObjectModelWithRefProps1BoxedMap { + @Nullable Object getData(); + } + + public record ObjectModelWithRefProps1BoxedMap(ObjectModelWithRefPropsMap data) implements ObjectModelWithRefProps1Boxed { + @Override + public @Nullable Object getData() { + return data; + } + } + + + public static class ObjectModelWithRefProps1 extends JsonSchema implements MapSchemaValidator { + /* + NOTE: This class is auto generated by OpenAPI JSON Schema Generator. + Ref: https://github.com/openapi-json-schema-tools/openapi-json-schema-generator + + Do not edit the class manually. + + a model that includes properties which should stay primitive (String + Boolean) and one which is defined as a class, NumberWithValidations + */ + private static @Nullable ObjectModelWithRefProps1 instance = null; + + protected ObjectModelWithRefProps1() { + super(new JsonSchemaInfo() + .type(Set.of(Map.class)) + .properties(Map.ofEntries( + new PropertyEntry("myNumber", NumberWithValidations.NumberWithValidations1.class), + new PropertyEntry("myString", StringSchema.StringSchema1.class), + new PropertyEntry("myBoolean", BooleanSchema.BooleanSchema1.class) + )) + ); + } + + public static ObjectModelWithRefProps1 getInstance() { + if (instance == null) { + instance = new ObjectModelWithRefProps1(); + } + return instance; + } + + 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 RuntimeException("Invalid non-string key value"); + } + String propertyName = (String) entryKey; + List propertyPathToItem = new ArrayList<>(pathToItem); + propertyPathToItem.add(propertyName); + Object value = entry.getValue(); + LinkedHashMap, Nothing?> schemas = pathToSchemas.get(propertyPathToItem); + if (schemas == null) { + throw new RuntimeException("Validation result is invalid, schemas must exist for a pathToItem"); + } + JsonSchema propertySchema = schemas.entrySet().iterator().next().getKey(); + @Nullable Object propertyInstance = propertySchema.getNewInstance(value, propertyPathToItem, pathToSchemas); + properties.put(propertyName, propertyInstance); + } + FrozenMap<@Nullable Object> castProperties = new FrozenMap<>(properties); + return new ObjectModelWithRefPropsMap(castProperties); + } + + 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); + SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().build())); + ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, new PathToSchemasMap(), new LinkedHashSet<>()); + PathToSchemasMap pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet); + return getNewInstance(castArg, validationMetadata.pathToItem(), pathToSchemasMap); + } + + + @Override + public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws 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"); + } + @Override + public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { + if (arg instanceof Map) { + return getNewInstance((Map) arg, pathToItem, pathToSchemas); + } + 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 { + return new ObjectModelWithRefProps1BoxedMap(validate(arg, configuration)); + } + @Override + public ObjectModelWithRefProps1Boxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { + 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"); + } + } + +} diff --git a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/schemas/ObjectWithAllOfWithReqTestPropFromUnsetAddProp.kt b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/schemas/ObjectWithAllOfWithReqTestPropFromUnsetAddProp.kt new file mode 100644 index 00000000000..8446ab928c2 --- /dev/null +++ b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/schemas/ObjectWithAllOfWithReqTestPropFromUnsetAddProp.kt @@ -0,0 +1,589 @@ +package org.openapijsonschematools.client.components.schemas; +import java.time.LocalDate; +import java.time.ZonedDateTime; +import java.util.ArrayList; +import java.util.HashSet; +import java.util.LinkedHashMap; +import java.util.LinkedHashSet; +import java.util.List; +import java.util.Map; +import java.util.Objects; +import java.util.Set; +import java.util.UUID; +import org.checkerframework.checker.nullness.qual.Nullable; +import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags; +import org.openapijsonschematools.client.configurations.SchemaConfiguration; +import org.openapijsonschematools.client.exceptions.InvalidAdditionalPropertyException; +import org.openapijsonschematools.client.exceptions.UnsetPropertyException; +import org.openapijsonschematools.client.exceptions.ValidationException; +import org.openapijsonschematools.client.schemas.GenericBuilder; +import org.openapijsonschematools.client.schemas.StringJsonSchema; +import org.openapijsonschematools.client.schemas.UnsetAddPropsSetter; +import org.openapijsonschematools.client.schemas.validation.BooleanSchemaValidator; +import org.openapijsonschematools.client.schemas.validation.FrozenList; +import org.openapijsonschematools.client.schemas.validation.FrozenMap; +import org.openapijsonschematools.client.schemas.validation.JsonSchema; +import org.openapijsonschematools.client.schemas.validation.JsonSchemaInfo; +import org.openapijsonschematools.client.schemas.validation.ListSchemaValidator; +import org.openapijsonschematools.client.schemas.validation.MapSchemaValidator; +import org.openapijsonschematools.client.schemas.validation.NullSchemaValidator; +import org.openapijsonschematools.client.schemas.validation.NumberSchemaValidator; +import org.openapijsonschematools.client.schemas.validation.PathToSchemasMap; +import org.openapijsonschematools.client.schemas.validation.PropertyEntry; +import org.openapijsonschematools.client.schemas.validation.StringSchemaValidator; +import org.openapijsonschematools.client.schemas.validation.ValidationMetadata; + +public class ObjectWithAllOfWithReqTestPropFromUnsetAddProp { + // nest classes so all schemas and input/output classes can be public + + + public static class Name extends StringJsonSchema.StringJsonSchema1 { + private static @Nullable Name instance = null; + public static Name getInstance() { + if (instance == null) { + instance = new Name(); + } + return instance; + } + } + + + public static class Schema1Map extends FrozenMap<@Nullable Object> { + protected Schema1Map(FrozenMap<@Nullable Object> m) { + super(m); + } + public static final Set requiredKeys = Set.of( + "test" + ); + public static final Set optionalKeys = Set.of( + "name" + ); + public static Schema1Map of(Map arg, SchemaConfiguration configuration) throws ValidationException { + return Schema1.getInstance().validate(arg, configuration); + } + + public @Nullable Object test() { + try { + return getOrThrow("version"); + } catch (UnsetPropertyException e) { + throw new RuntimeException(e); + } + } + + public String name() throws UnsetPropertyException { + String key = "name"; + throwIfKeyNotPresent(key); + @Nullable Object value = get(key); + if (!(value instanceof String)) { + throw new RuntimeException("Invalid value stored for name"); + } + return (String) value; + } + + public @Nullable Object getAdditionalProperty(String name) throws UnsetPropertyException, InvalidAdditionalPropertyException { + throwIfKeyKnown(name, requiredKeys, optionalKeys); + throwIfKeyNotPresent(name); + return get(name); + } + } + + public interface SetterForTest { + Map getInstance(); + T getBuilderAfterTest(Map instance); + + default T test(Nothing? value) { + var instance = getInstance(); + instance.put("test", null); + return getBuilderAfterTest(instance); + } + + default T test(boolean value) { + var instance = getInstance(); + instance.put("test", value); + return getBuilderAfterTest(instance); + } + + default T test(String value) { + var instance = getInstance(); + instance.put("test", value); + return getBuilderAfterTest(instance); + } + + default T test(int value) { + var instance = getInstance(); + instance.put("test", value); + return getBuilderAfterTest(instance); + } + + default T test(float value) { + var instance = getInstance(); + instance.put("test", value); + return getBuilderAfterTest(instance); + } + + default T test(long value) { + var instance = getInstance(); + instance.put("test", value); + return getBuilderAfterTest(instance); + } + + default T test(double value) { + var instance = getInstance(); + instance.put("test", value); + return getBuilderAfterTest(instance); + } + + default T test(List value) { + var instance = getInstance(); + instance.put("test", value); + return getBuilderAfterTest(instance); + } + + default T test(Map value) { + var instance = getInstance(); + instance.put("test", value); + return getBuilderAfterTest(instance); + } + } + + public interface SetterForName { + Map getInstance(); + T getBuilderAfterName(Map instance); + + default T name(String value) { + var instance = getInstance(); + instance.put("name", value); + return getBuilderAfterName(instance); + } + } + + public static class Schema1Map0Builder extends UnsetAddPropsSetter implements GenericBuilder>, SetterForName { + private final Map instance; + private static final Set knownKeys = Set.of( + "test", + "name" + ); + public Set getKnownKeys() { + return knownKeys; + } + public Schema1Map0Builder(Map instance) { + this.instance = instance; + } + public Map build() { + return instance; + } + public Map getInstance() { + return instance; + } + public Schema1Map0Builder getBuilderAfterName(Map instance) { + return this; + } + public Schema1Map0Builder getBuilderAfterAdditionalProperty(Map instance) { + return this; + } + } + + public static class Schema1MapBuilder implements SetterForTest { + private final Map instance; + public Schema1MapBuilder() { + this.instance = new LinkedHashMap<>(); + } + public Map getInstance() { + return instance; + } + public Schema1Map0Builder getBuilderAfterTest(Map instance) { + return new Schema1Map0Builder(instance); + } + } + + + public sealed interface Schema1Boxed permits Schema1BoxedMap { + @Nullable Object getData(); + } + + public record Schema1BoxedMap(Schema1Map data) implements Schema1Boxed { + @Override + public @Nullable Object getData() { + return data; + } + } + + + public static class Schema1 extends JsonSchema implements MapSchemaValidator { + private static @Nullable Schema1 instance = null; + + protected Schema1() { + super(new JsonSchemaInfo() + .type(Set.of(Map.class)) + .properties(Map.ofEntries( + new PropertyEntry("name", Name.class) + )) + .required(Set.of( + "test" + )) + ); + } + + public static Schema1 getInstance() { + if (instance == null) { + instance = new Schema1(); + } + return instance; + } + + 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 RuntimeException("Invalid non-string key value"); + } + String propertyName = (String) entryKey; + List propertyPathToItem = new ArrayList<>(pathToItem); + propertyPathToItem.add(propertyName); + Object value = entry.getValue(); + LinkedHashMap, Nothing?> schemas = pathToSchemas.get(propertyPathToItem); + if (schemas == null) { + throw new RuntimeException("Validation result is invalid, schemas must exist for a pathToItem"); + } + JsonSchema propertySchema = schemas.entrySet().iterator().next().getKey(); + @Nullable Object propertyInstance = propertySchema.getNewInstance(value, propertyPathToItem, pathToSchemas); + properties.put(propertyName, propertyInstance); + } + FrozenMap<@Nullable Object> castProperties = new FrozenMap<>(properties); + return new Schema1Map(castProperties); + } + + 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); + SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().build())); + ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, new PathToSchemasMap(), new LinkedHashSet<>()); + PathToSchemasMap pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet); + return getNewInstance(castArg, validationMetadata.pathToItem(), pathToSchemasMap); + } + + + @Override + public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws 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"); + } + @Override + public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { + if (arg instanceof Map) { + return getNewInstance((Map) arg, pathToItem, pathToSchemas); + } + 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 { + return new Schema1BoxedMap(validate(arg, configuration)); + } + @Override + public Schema1Boxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { + 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"); + } + } + + + public sealed interface ObjectWithAllOfWithReqTestPropFromUnsetAddProp1Boxed permits ObjectWithAllOfWithReqTestPropFromUnsetAddProp1BoxedVoid, ObjectWithAllOfWithReqTestPropFromUnsetAddProp1BoxedBoolean, ObjectWithAllOfWithReqTestPropFromUnsetAddProp1BoxedNumber, ObjectWithAllOfWithReqTestPropFromUnsetAddProp1BoxedString, ObjectWithAllOfWithReqTestPropFromUnsetAddProp1BoxedList, ObjectWithAllOfWithReqTestPropFromUnsetAddProp1BoxedMap { + @Nullable Object getData(); + } + + public record ObjectWithAllOfWithReqTestPropFromUnsetAddProp1BoxedVoid(Nothing? data) implements ObjectWithAllOfWithReqTestPropFromUnsetAddProp1Boxed { + @Override + public @Nullable Object getData() { + return data; + } + } + + public record ObjectWithAllOfWithReqTestPropFromUnsetAddProp1BoxedBoolean(boolean data) implements ObjectWithAllOfWithReqTestPropFromUnsetAddProp1Boxed { + @Override + public @Nullable Object getData() { + return data; + } + } + + public record ObjectWithAllOfWithReqTestPropFromUnsetAddProp1BoxedNumber(Number data) implements ObjectWithAllOfWithReqTestPropFromUnsetAddProp1Boxed { + @Override + public @Nullable Object getData() { + return data; + } + } + + public record ObjectWithAllOfWithReqTestPropFromUnsetAddProp1BoxedString(String data) implements ObjectWithAllOfWithReqTestPropFromUnsetAddProp1Boxed { + @Override + public @Nullable Object getData() { + return data; + } + } + + public record ObjectWithAllOfWithReqTestPropFromUnsetAddProp1BoxedList(FrozenList<@Nullable Object> data) implements ObjectWithAllOfWithReqTestPropFromUnsetAddProp1Boxed { + @Override + public @Nullable Object getData() { + return data; + } + } + + public record ObjectWithAllOfWithReqTestPropFromUnsetAddProp1BoxedMap(FrozenMap<@Nullable Object> data) implements ObjectWithAllOfWithReqTestPropFromUnsetAddProp1Boxed { + @Override + public @Nullable Object getData() { + return data; + } + } + + + public static class ObjectWithAllOfWithReqTestPropFromUnsetAddProp1 extends JsonSchema implements NullSchemaValidator, BooleanSchemaValidator, NumberSchemaValidator, StringSchemaValidator, ListSchemaValidator, ObjectWithAllOfWithReqTestPropFromUnsetAddProp1BoxedList>, MapSchemaValidator, ObjectWithAllOfWithReqTestPropFromUnsetAddProp1BoxedMap> { + /* + NOTE: This class is auto generated by OpenAPI JSON Schema Generator. + Ref: https://github.com/openapi-json-schema-tools/openapi-json-schema-generator + + Do not edit the class manually. + */ + private static @Nullable ObjectWithAllOfWithReqTestPropFromUnsetAddProp1 instance = null; + + protected ObjectWithAllOfWithReqTestPropFromUnsetAddProp1() { + super(new JsonSchemaInfo() + .allOf(List.of( + ObjectWithOptionalTestProp.ObjectWithOptionalTestProp1.class, + Schema1.class + )) + ); + } + + public static ObjectWithAllOfWithReqTestPropFromUnsetAddProp1 getInstance() { + if (instance == null) { + instance = new ObjectWithAllOfWithReqTestPropFromUnsetAddProp1(); + } + return instance; + } + + @Override + public Nothing? validate(Nothing? arg, SchemaConfiguration configuration) throws ValidationException { + Set> pathSet = new HashSet<>(); + List pathToItem = List.of("args[0]"); + Nothing? castArg = castToAllowedTypes(arg, pathToItem, pathSet); + SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().build())); + PathToSchemasMap validatedPathToSchemas = new PathToSchemasMap(); + ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, new LinkedHashSet<>()); + getPathToSchemas(this, castArg, validationMetadata, pathSet); + return castArg; + } + + @Override + public boolean validate(boolean arg, SchemaConfiguration configuration) throws ValidationException { + Set> pathSet = new HashSet<>(); + List pathToItem = List.of("args[0]"); + boolean castArg = castToAllowedTypes(arg, pathToItem, pathSet); + SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().build())); + PathToSchemasMap validatedPathToSchemas = new PathToSchemasMap(); + ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, new LinkedHashSet<>()); + getPathToSchemas(this, castArg, validationMetadata, pathSet); + return castArg; + } + + @Override + public Number validate(Number arg, SchemaConfiguration configuration) throws ValidationException { + Set> pathSet = new HashSet<>(); + List pathToItem = List.of("args[0]"); + Number castArg = castToAllowedTypes(arg, pathToItem, pathSet); + SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().build())); + PathToSchemasMap validatedPathToSchemas = new PathToSchemasMap(); + ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, new LinkedHashSet<>()); + getPathToSchemas(this, castArg, validationMetadata, pathSet); + return castArg; + } + + public int validate(int arg, SchemaConfiguration configuration) throws ValidationException { + return (int) validate((Number) arg, configuration); + } + + public long validate(long arg, SchemaConfiguration configuration) throws ValidationException { + return (long) validate((Number) arg, configuration); + } + + public float validate(float arg, SchemaConfiguration configuration) throws ValidationException { + return (float) validate((Number) arg, configuration); + } + + public double validate(double arg, SchemaConfiguration configuration) throws ValidationException { + return (double) validate((Number) arg, configuration); + } + + @Override + public String validate(String arg, SchemaConfiguration configuration) throws ValidationException { + Set> pathSet = new HashSet<>(); + List pathToItem = List.of("args[0]"); + String castArg = castToAllowedTypes(arg, pathToItem, pathSet); + SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().build())); + PathToSchemasMap validatedPathToSchemas = new PathToSchemasMap(); + ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, new LinkedHashSet<>()); + getPathToSchemas(this, castArg, validationMetadata, pathSet); + return castArg; + } + + public String validate(LocalDate arg, SchemaConfiguration configuration) throws ValidationException { + return validate(arg.toString(), configuration); + } + + public String validate(ZonedDateTime arg, SchemaConfiguration configuration) throws ValidationException { + return validate(arg.toString(), configuration); + } + + public String validate(UUID arg, SchemaConfiguration configuration) throws ValidationException { + return validate(arg.toString(), configuration); + } + + @Override + public FrozenList<@Nullable Object> getNewInstance(List arg, List pathToItem, PathToSchemasMap pathToSchemas) { + List<@Nullable Object> items = new ArrayList<>(); + int i = 0; + for (Object item: arg) { + List itemPathToItem = new ArrayList<>(pathToItem); + itemPathToItem.add(i); + LinkedHashMap, Nothing?> schemas = pathToSchemas.get(itemPathToItem); + if (schemas == null) { + throw new RuntimeException("Validation result is invalid, schemas must exist for a pathToItem"); + } + JsonSchema itemSchema = schemas.entrySet().iterator().next().getKey(); + @Nullable Object itemInstance = itemSchema.getNewInstance(item, itemPathToItem, pathToSchemas); + items.add(itemInstance); + i += 1; + } + FrozenList<@Nullable Object> newInstanceItems = new FrozenList<>(items); + return newInstanceItems; + } + + 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); + SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().build())); + ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, new PathToSchemasMap(), new LinkedHashSet<>()); + PathToSchemasMap pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet); + return getNewInstance(castArg, validationMetadata.pathToItem(), pathToSchemasMap); + } + + @Override + 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 RuntimeException("Invalid non-string key value"); + } + String propertyName = (String) entryKey; + List propertyPathToItem = new ArrayList<>(pathToItem); + propertyPathToItem.add(propertyName); + Object value = entry.getValue(); + LinkedHashMap, Nothing?> schemas = pathToSchemas.get(propertyPathToItem); + if (schemas == null) { + throw new RuntimeException("Validation result is invalid, schemas must exist for a pathToItem"); + } + JsonSchema propertySchema = schemas.entrySet().iterator().next().getKey(); + @Nullable Object propertyInstance = propertySchema.getNewInstance(value, propertyPathToItem, pathToSchemas); + properties.put(propertyName, propertyInstance); + } + FrozenMap<@Nullable Object> castProperties = new FrozenMap<>(properties); + return castProperties; + } + + public FrozenMap<@Nullable Object> validate(Map arg, SchemaConfiguration configuration) throws ValidationException { + Set> pathSet = new HashSet<>(); + List pathToItem = List.of("args[0]"); + Map castArg = castToAllowedTypes(arg, pathToItem, pathSet); + SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().build())); + PathToSchemasMap validatedPathToSchemas = new PathToSchemasMap(); + ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, new LinkedHashSet<>()); + PathToSchemasMap pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet); + return getNewInstance(castArg, validationMetadata.pathToItem(), pathToSchemasMap); + } + + @Override + public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { + if (arg == null) { + return validate((Nothing?) null, configuration); + } else if (arg instanceof Boolean) { + boolean boolArg = (Boolean) arg; + return validate(boolArg, configuration); + } else if (arg instanceof Number) { + return validate((Number) arg, configuration); + } else if (arg instanceof String) { + return validate((String) arg, configuration); + } else if (arg instanceof List) { + return validate((List) arg, 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"); + } + @Override + public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { + if (arg == null) { + return getNewInstance((Nothing?) null, pathToItem, pathToSchemas); + } else if (arg instanceof Boolean) { + boolean boolArg = (Boolean) arg; + return getNewInstance(boolArg, pathToItem, pathToSchemas); + } else if (arg instanceof Number) { + return getNewInstance((Number) arg, pathToItem, pathToSchemas); + } else if (arg instanceof String) { + return getNewInstance((String) arg, pathToItem, pathToSchemas); + } else if (arg instanceof List) { + return getNewInstance((List) arg, 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"); + } + @Override + public ObjectWithAllOfWithReqTestPropFromUnsetAddProp1BoxedVoid validateAndBox(Nothing? arg, SchemaConfiguration configuration) throws ValidationException { + return new ObjectWithAllOfWithReqTestPropFromUnsetAddProp1BoxedVoid(validate(arg, configuration)); + } + @Override + 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 { + return new ObjectWithAllOfWithReqTestPropFromUnsetAddProp1BoxedNumber(validate(arg, configuration)); + } + @Override + 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 { + return new ObjectWithAllOfWithReqTestPropFromUnsetAddProp1BoxedList(validate(arg, configuration)); + } + @Override + 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 { + if (arg == null) { + Nothing? castArg = (Nothing?) arg; + return validateAndBox(castArg, configuration); + } else if (arg instanceof Boolean booleanArg) { + boolean castArg = booleanArg; + return validateAndBox(castArg, configuration); + } else if (arg instanceof String castArg) { + return validateAndBox(castArg, configuration); + } else if (arg instanceof Number castArg) { + return validateAndBox(castArg, configuration); + } else if (arg instanceof List castArg) { + 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"); + } + } +} diff --git a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/schemas/ObjectWithCollidingProperties.kt b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/schemas/ObjectWithCollidingProperties.kt new file mode 100644 index 00000000000..3fd4b4ed714 --- /dev/null +++ b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/schemas/ObjectWithCollidingProperties.kt @@ -0,0 +1,246 @@ +package org.openapijsonschematools.client.components.schemas; +import java.util.ArrayList; +import java.util.HashSet; +import java.util.LinkedHashMap; +import java.util.LinkedHashSet; +import java.util.List; +import java.util.Map; +import java.util.Objects; +import java.util.Set; +import org.checkerframework.checker.nullness.qual.Nullable; +import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags; +import org.openapijsonschematools.client.configurations.SchemaConfiguration; +import org.openapijsonschematools.client.exceptions.InvalidAdditionalPropertyException; +import org.openapijsonschematools.client.exceptions.UnsetPropertyException; +import org.openapijsonschematools.client.exceptions.ValidationException; +import org.openapijsonschematools.client.schemas.GenericBuilder; +import org.openapijsonschematools.client.schemas.MapJsonSchema; +import org.openapijsonschematools.client.schemas.UnsetAddPropsSetter; +import org.openapijsonschematools.client.schemas.validation.FrozenMap; +import org.openapijsonschematools.client.schemas.validation.JsonSchema; +import org.openapijsonschematools.client.schemas.validation.JsonSchemaInfo; +import org.openapijsonschematools.client.schemas.validation.MapSchemaValidator; +import org.openapijsonschematools.client.schemas.validation.PathToSchemasMap; +import org.openapijsonschematools.client.schemas.validation.PropertyEntry; +import org.openapijsonschematools.client.schemas.validation.ValidationMetadata; + +public class ObjectWithCollidingProperties { + // nest classes so all schemas and input/output classes can be public + + + public static class SomeProp extends MapJsonSchema.MapJsonSchema1 { + private static @Nullable SomeProp instance = null; + public static SomeProp getInstance() { + if (instance == null) { + instance = new SomeProp(); + } + return instance; + } + } + + + public static class Someprop extends MapJsonSchema.MapJsonSchema1 { + private static @Nullable Someprop instance = null; + public static Someprop getInstance() { + if (instance == null) { + instance = new Someprop(); + } + return instance; + } + } + + + public static class ObjectWithCollidingPropertiesMap extends FrozenMap<@Nullable Object> { + protected ObjectWithCollidingPropertiesMap(FrozenMap<@Nullable Object> m) { + super(m); + } + public static final Set requiredKeys = Set.of(); + public static final Set optionalKeys = Set.of( + "someProp", + "someprop" + ); + public static ObjectWithCollidingPropertiesMap of(Map arg, SchemaConfiguration configuration) throws ValidationException { + return ObjectWithCollidingProperties1.getInstance().validate(arg, configuration); + } + + public FrozenMap someProp() throws UnsetPropertyException { + String key = "someProp"; + throwIfKeyNotPresent(key); + @Nullable Object value = get(key); + if (!(value instanceof FrozenMap)) { + throw new RuntimeException("Invalid value stored for someProp"); + } + return (FrozenMap) value; + } + + public FrozenMap someprop() throws UnsetPropertyException { + String key = "someprop"; + throwIfKeyNotPresent(key); + @Nullable Object value = get(key); + if (!(value instanceof FrozenMap)) { + throw new RuntimeException("Invalid value stored for someprop"); + } + return (FrozenMap) value; + } + + public @Nullable Object getAdditionalProperty(String name) throws UnsetPropertyException, InvalidAdditionalPropertyException { + throwIfKeyKnown(name, requiredKeys, optionalKeys); + throwIfKeyNotPresent(name); + return get(name); + } + } + + public interface SetterForSomeProp { + Map getInstance(); + T getBuilderAfterSomeProp(Map instance); + + default T someProp(Map value) { + var instance = getInstance(); + instance.put("someProp", value); + return getBuilderAfterSomeProp(instance); + } + } + + public interface SetterForSomeprop { + Map getInstance(); + T getBuilderAfterSomeprop(Map instance); + + default T someprop(Map value) { + var instance = getInstance(); + instance.put("someprop", value); + return getBuilderAfterSomeprop(instance); + } + } + + public static class ObjectWithCollidingPropertiesMapBuilder extends UnsetAddPropsSetter implements GenericBuilder>, SetterForSomeProp, SetterForSomeprop { + private final Map instance; + private static final Set knownKeys = Set.of( + "someProp", + "someprop" + ); + public Set getKnownKeys() { + return knownKeys; + } + public ObjectWithCollidingPropertiesMapBuilder() { + this.instance = new LinkedHashMap<>(); + } + public Map build() { + return instance; + } + public Map getInstance() { + return instance; + } + public ObjectWithCollidingPropertiesMapBuilder getBuilderAfterSomeProp(Map instance) { + return this; + } + public ObjectWithCollidingPropertiesMapBuilder getBuilderAfterSomeprop(Map instance) { + return this; + } + public ObjectWithCollidingPropertiesMapBuilder getBuilderAfterAdditionalProperty(Map instance) { + return this; + } + } + + + public sealed interface ObjectWithCollidingProperties1Boxed permits ObjectWithCollidingProperties1BoxedMap { + @Nullable Object getData(); + } + + public record ObjectWithCollidingProperties1BoxedMap(ObjectWithCollidingPropertiesMap data) implements ObjectWithCollidingProperties1Boxed { + @Override + public @Nullable Object getData() { + return data; + } + } + + + public static class ObjectWithCollidingProperties1 extends JsonSchema implements MapSchemaValidator { + /* + NOTE: This class is auto generated by OpenAPI JSON Schema Generator. + Ref: https://github.com/openapi-json-schema-tools/openapi-json-schema-generator + + Do not edit the class manually. + + component with properties that have name collisions + */ + private static @Nullable ObjectWithCollidingProperties1 instance = null; + + protected ObjectWithCollidingProperties1() { + super(new JsonSchemaInfo() + .type(Set.of(Map.class)) + .properties(Map.ofEntries( + new PropertyEntry("someProp", SomeProp.class), + new PropertyEntry("someprop", Someprop.class) + )) + ); + } + + public static ObjectWithCollidingProperties1 getInstance() { + if (instance == null) { + instance = new ObjectWithCollidingProperties1(); + } + return instance; + } + + 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 RuntimeException("Invalid non-string key value"); + } + String propertyName = (String) entryKey; + List propertyPathToItem = new ArrayList<>(pathToItem); + propertyPathToItem.add(propertyName); + Object value = entry.getValue(); + LinkedHashMap, Nothing?> schemas = pathToSchemas.get(propertyPathToItem); + if (schemas == null) { + throw new RuntimeException("Validation result is invalid, schemas must exist for a pathToItem"); + } + JsonSchema propertySchema = schemas.entrySet().iterator().next().getKey(); + @Nullable Object propertyInstance = propertySchema.getNewInstance(value, propertyPathToItem, pathToSchemas); + properties.put(propertyName, propertyInstance); + } + FrozenMap<@Nullable Object> castProperties = new FrozenMap<>(properties); + return new ObjectWithCollidingPropertiesMap(castProperties); + } + + 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); + SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().build())); + ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, new PathToSchemasMap(), new LinkedHashSet<>()); + PathToSchemasMap pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet); + return getNewInstance(castArg, validationMetadata.pathToItem(), pathToSchemasMap); + } + + + @Override + public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws 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"); + } + @Override + public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { + if (arg instanceof Map) { + return getNewInstance((Map) arg, pathToItem, pathToSchemas); + } + 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 { + return new ObjectWithCollidingProperties1BoxedMap(validate(arg, configuration)); + } + @Override + public ObjectWithCollidingProperties1Boxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { + 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"); + } + } + +} diff --git a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/schemas/ObjectWithDecimalProperties.kt b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/schemas/ObjectWithDecimalProperties.kt new file mode 100644 index 00000000000..df7bd037680 --- /dev/null +++ b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/schemas/ObjectWithDecimalProperties.kt @@ -0,0 +1,260 @@ +package org.openapijsonschematools.client.components.schemas; +import java.util.ArrayList; +import java.util.HashSet; +import java.util.LinkedHashMap; +import java.util.LinkedHashSet; +import java.util.List; +import java.util.Map; +import java.util.Objects; +import java.util.Set; +import org.checkerframework.checker.nullness.qual.Nullable; +import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags; +import org.openapijsonschematools.client.configurations.SchemaConfiguration; +import org.openapijsonschematools.client.exceptions.InvalidAdditionalPropertyException; +import org.openapijsonschematools.client.exceptions.UnsetPropertyException; +import org.openapijsonschematools.client.exceptions.ValidationException; +import org.openapijsonschematools.client.schemas.DecimalJsonSchema; +import org.openapijsonschematools.client.schemas.GenericBuilder; +import org.openapijsonschematools.client.schemas.UnsetAddPropsSetter; +import org.openapijsonschematools.client.schemas.validation.FrozenMap; +import org.openapijsonschematools.client.schemas.validation.JsonSchema; +import org.openapijsonschematools.client.schemas.validation.JsonSchemaInfo; +import org.openapijsonschematools.client.schemas.validation.MapSchemaValidator; +import org.openapijsonschematools.client.schemas.validation.PathToSchemasMap; +import org.openapijsonschematools.client.schemas.validation.PropertyEntry; +import org.openapijsonschematools.client.schemas.validation.ValidationMetadata; + +public class ObjectWithDecimalProperties { + // nest classes so all schemas and input/output classes can be public + + + public static class Width extends DecimalJsonSchema.DecimalJsonSchema1 { + private static @Nullable Width instance = null; + public static Width getInstance() { + if (instance == null) { + instance = new Width(); + } + return instance; + } + } + + + public static class ObjectWithDecimalPropertiesMap extends FrozenMap<@Nullable Object> { + protected ObjectWithDecimalPropertiesMap(FrozenMap<@Nullable Object> m) { + super(m); + } + public static final Set requiredKeys = Set.of(); + public static final Set optionalKeys = Set.of( + "length", + "width", + "cost" + ); + public static ObjectWithDecimalPropertiesMap of(Map arg, SchemaConfiguration configuration) throws ValidationException { + return ObjectWithDecimalProperties1.getInstance().validate(arg, configuration); + } + + public String length() throws UnsetPropertyException { + String key = "length"; + throwIfKeyNotPresent(key); + @Nullable Object value = get(key); + if (!(value instanceof String)) { + throw new RuntimeException("Invalid value stored for length"); + } + return (String) value; + } + + public String width() throws UnsetPropertyException { + String key = "width"; + throwIfKeyNotPresent(key); + @Nullable Object value = get(key); + if (!(value instanceof String)) { + throw new RuntimeException("Invalid value stored for width"); + } + return (String) value; + } + + public Money.MoneyMap cost() throws UnsetPropertyException { + String key = "cost"; + throwIfKeyNotPresent(key); + @Nullable Object value = get(key); + if (!(value instanceof Money.MoneyMap)) { + throw new RuntimeException("Invalid value stored for cost"); + } + return (Money.MoneyMap) value; + } + + public @Nullable Object getAdditionalProperty(String name) throws UnsetPropertyException, InvalidAdditionalPropertyException { + throwIfKeyKnown(name, requiredKeys, optionalKeys); + throwIfKeyNotPresent(name); + return get(name); + } + } + + public interface SetterForLength { + Map getInstance(); + T getBuilderAfterLength(Map instance); + + default T length(String value) { + var instance = getInstance(); + instance.put("length", value); + return getBuilderAfterLength(instance); + } + } + + public interface SetterForWidth { + Map getInstance(); + T getBuilderAfterWidth(Map instance); + + default T width(String value) { + var instance = getInstance(); + instance.put("width", value); + return getBuilderAfterWidth(instance); + } + } + + public interface SetterForCost { + Map getInstance(); + T getBuilderAfterCost(Map instance); + + default T cost(Map value) { + var instance = getInstance(); + instance.put("cost", value); + return getBuilderAfterCost(instance); + } + } + + public static class ObjectWithDecimalPropertiesMapBuilder extends UnsetAddPropsSetter implements GenericBuilder>, SetterForLength, SetterForWidth, SetterForCost { + private final Map instance; + private static final Set knownKeys = Set.of( + "length", + "width", + "cost" + ); + public Set getKnownKeys() { + return knownKeys; + } + public ObjectWithDecimalPropertiesMapBuilder() { + this.instance = new LinkedHashMap<>(); + } + public Map build() { + return instance; + } + public Map getInstance() { + return instance; + } + public ObjectWithDecimalPropertiesMapBuilder getBuilderAfterLength(Map instance) { + return this; + } + public ObjectWithDecimalPropertiesMapBuilder getBuilderAfterWidth(Map instance) { + return this; + } + public ObjectWithDecimalPropertiesMapBuilder getBuilderAfterCost(Map instance) { + return this; + } + public ObjectWithDecimalPropertiesMapBuilder getBuilderAfterAdditionalProperty(Map instance) { + return this; + } + } + + + public sealed interface ObjectWithDecimalProperties1Boxed permits ObjectWithDecimalProperties1BoxedMap { + @Nullable Object getData(); + } + + public record ObjectWithDecimalProperties1BoxedMap(ObjectWithDecimalPropertiesMap data) implements ObjectWithDecimalProperties1Boxed { + @Override + public @Nullable Object getData() { + return data; + } + } + + + public static class ObjectWithDecimalProperties1 extends JsonSchema implements MapSchemaValidator { + /* + NOTE: This class is auto generated by OpenAPI JSON Schema Generator. + Ref: https://github.com/openapi-json-schema-tools/openapi-json-schema-generator + + Do not edit the class manually. + */ + private static @Nullable ObjectWithDecimalProperties1 instance = null; + + protected ObjectWithDecimalProperties1() { + super(new JsonSchemaInfo() + .type(Set.of(Map.class)) + .properties(Map.ofEntries( + new PropertyEntry("length", DecimalPayload.DecimalPayload1.class), + new PropertyEntry("width", Width.class), + new PropertyEntry("cost", Money.Money1.class) + )) + ); + } + + public static ObjectWithDecimalProperties1 getInstance() { + if (instance == null) { + instance = new ObjectWithDecimalProperties1(); + } + return instance; + } + + 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 RuntimeException("Invalid non-string key value"); + } + String propertyName = (String) entryKey; + List propertyPathToItem = new ArrayList<>(pathToItem); + propertyPathToItem.add(propertyName); + Object value = entry.getValue(); + LinkedHashMap, Nothing?> schemas = pathToSchemas.get(propertyPathToItem); + if (schemas == null) { + throw new RuntimeException("Validation result is invalid, schemas must exist for a pathToItem"); + } + JsonSchema propertySchema = schemas.entrySet().iterator().next().getKey(); + @Nullable Object propertyInstance = propertySchema.getNewInstance(value, propertyPathToItem, pathToSchemas); + properties.put(propertyName, propertyInstance); + } + FrozenMap<@Nullable Object> castProperties = new FrozenMap<>(properties); + return new ObjectWithDecimalPropertiesMap(castProperties); + } + + 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); + SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().build())); + ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, new PathToSchemasMap(), new LinkedHashSet<>()); + PathToSchemasMap pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet); + return getNewInstance(castArg, validationMetadata.pathToItem(), pathToSchemasMap); + } + + + @Override + public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws 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"); + } + @Override + public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { + if (arg instanceof Map) { + return getNewInstance((Map) arg, pathToItem, pathToSchemas); + } + 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 { + return new ObjectWithDecimalProperties1BoxedMap(validate(arg, configuration)); + } + @Override + public ObjectWithDecimalProperties1Boxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { + 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"); + } + } + +} diff --git a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/schemas/ObjectWithDifficultlyNamedProps.kt b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/schemas/ObjectWithDifficultlyNamedProps.kt new file mode 100644 index 00000000000..506f79e01cd --- /dev/null +++ b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/schemas/ObjectWithDifficultlyNamedProps.kt @@ -0,0 +1,306 @@ +package org.openapijsonschematools.client.components.schemas; +import java.util.ArrayList; +import java.util.HashSet; +import java.util.LinkedHashMap; +import java.util.LinkedHashSet; +import java.util.List; +import java.util.Map; +import java.util.Objects; +import java.util.Set; +import org.checkerframework.checker.nullness.qual.Nullable; +import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags; +import org.openapijsonschematools.client.configurations.SchemaConfiguration; +import org.openapijsonschematools.client.exceptions.InvalidAdditionalPropertyException; +import org.openapijsonschematools.client.exceptions.UnsetPropertyException; +import org.openapijsonschematools.client.exceptions.ValidationException; +import org.openapijsonschematools.client.schemas.GenericBuilder; +import org.openapijsonschematools.client.schemas.Int64JsonSchema; +import org.openapijsonschematools.client.schemas.IntJsonSchema; +import org.openapijsonschematools.client.schemas.StringJsonSchema; +import org.openapijsonschematools.client.schemas.UnsetAddPropsSetter; +import org.openapijsonschematools.client.schemas.validation.FrozenMap; +import org.openapijsonschematools.client.schemas.validation.JsonSchema; +import org.openapijsonschematools.client.schemas.validation.JsonSchemaInfo; +import org.openapijsonschematools.client.schemas.validation.MapSchemaValidator; +import org.openapijsonschematools.client.schemas.validation.PathToSchemasMap; +import org.openapijsonschematools.client.schemas.validation.PropertyEntry; +import org.openapijsonschematools.client.schemas.validation.ValidationMetadata; + +public class ObjectWithDifficultlyNamedProps { + // nest classes so all schemas and input/output classes can be public + + + public static class Specialpropertyname extends Int64JsonSchema.Int64JsonSchema1 { + private static @Nullable Specialpropertyname instance = null; + public static Specialpropertyname getInstance() { + if (instance == null) { + instance = new Specialpropertyname(); + } + return instance; + } + } + + + public static class Schema123list extends StringJsonSchema.StringJsonSchema1 { + private static @Nullable Schema123list instance = null; + public static Schema123list getInstance() { + if (instance == null) { + instance = new Schema123list(); + } + return instance; + } + } + + + public static class Schema123Number extends IntJsonSchema.IntJsonSchema1 { + private static @Nullable Schema123Number instance = null; + public static Schema123Number getInstance() { + if (instance == null) { + instance = new Schema123Number(); + } + return instance; + } + } + + + public static class ObjectWithDifficultlyNamedPropsMap extends FrozenMap<@Nullable Object> { + protected ObjectWithDifficultlyNamedPropsMap(FrozenMap<@Nullable Object> m) { + super(m); + } + public static final Set requiredKeys = Set.of( + "123-list" + ); + public static final Set optionalKeys = Set.of( + "$special[property.name]", + "123Number" + ); + public static ObjectWithDifficultlyNamedPropsMap of(Map arg, SchemaConfiguration configuration) throws ValidationException { + return ObjectWithDifficultlyNamedProps1.getInstance().validate(arg, configuration); + } + + public @Nullable Object getAdditionalProperty(String name) throws UnsetPropertyException, InvalidAdditionalPropertyException { + throwIfKeyKnown(name, requiredKeys, optionalKeys); + throwIfKeyNotPresent(name); + return get(name); + } + } + + public interface SetterForSchema123list { + Map getInstance(); + T getBuilderAfterSchema123list(Map instance); + + default T digitOne23HyphenMinusList(String value) { + var instance = getInstance(); + instance.put("123-list", value); + return getBuilderAfterSchema123list(instance); + } + } + + public interface SetterForSpecialpropertyname { + Map getInstance(); + T getBuilderAfterSpecialpropertyname(Map instance); + + default T dollarSignSpecialLeftSquareBracketPropertyFullStopNameRightSquareBracket(int value) { + var instance = getInstance(); + instance.put("$special[property.name]", value); + return getBuilderAfterSpecialpropertyname(instance); + } + + default T dollarSignSpecialLeftSquareBracketPropertyFullStopNameRightSquareBracket(float value) { + var instance = getInstance(); + instance.put("$special[property.name]", value); + return getBuilderAfterSpecialpropertyname(instance); + } + + default T dollarSignSpecialLeftSquareBracketPropertyFullStopNameRightSquareBracket(long value) { + var instance = getInstance(); + instance.put("$special[property.name]", value); + return getBuilderAfterSpecialpropertyname(instance); + } + + default T dollarSignSpecialLeftSquareBracketPropertyFullStopNameRightSquareBracket(double value) { + var instance = getInstance(); + instance.put("$special[property.name]", value); + return getBuilderAfterSpecialpropertyname(instance); + } + } + + public interface SetterForSchema123Number { + Map getInstance(); + T getBuilderAfterSchema123Number(Map instance); + + default T digitOne23number(int value) { + var instance = getInstance(); + instance.put("123Number", value); + return getBuilderAfterSchema123Number(instance); + } + + default T digitOne23number(float value) { + var instance = getInstance(); + instance.put("123Number", value); + return getBuilderAfterSchema123Number(instance); + } + + default T digitOne23number(long value) { + var instance = getInstance(); + instance.put("123Number", value); + return getBuilderAfterSchema123Number(instance); + } + + default T digitOne23number(double value) { + var instance = getInstance(); + instance.put("123Number", value); + return getBuilderAfterSchema123Number(instance); + } + } + + public static class ObjectWithDifficultlyNamedPropsMap0Builder extends UnsetAddPropsSetter implements GenericBuilder>, SetterForSpecialpropertyname, SetterForSchema123Number { + private final Map instance; + private static final Set knownKeys = Set.of( + "123-list", + "$special[property.name]", + "123Number" + ); + public Set getKnownKeys() { + return knownKeys; + } + public ObjectWithDifficultlyNamedPropsMap0Builder(Map instance) { + this.instance = instance; + } + public Map build() { + return instance; + } + public Map getInstance() { + return instance; + } + public ObjectWithDifficultlyNamedPropsMap0Builder getBuilderAfterSpecialpropertyname(Map instance) { + return this; + } + public ObjectWithDifficultlyNamedPropsMap0Builder getBuilderAfterSchema123Number(Map instance) { + return this; + } + public ObjectWithDifficultlyNamedPropsMap0Builder getBuilderAfterAdditionalProperty(Map instance) { + return this; + } + } + + public static class ObjectWithDifficultlyNamedPropsMapBuilder implements SetterForSchema123list { + private final Map instance; + public ObjectWithDifficultlyNamedPropsMapBuilder() { + this.instance = new LinkedHashMap<>(); + } + public Map getInstance() { + return instance; + } + public ObjectWithDifficultlyNamedPropsMap0Builder getBuilderAfterSchema123list(Map instance) { + return new ObjectWithDifficultlyNamedPropsMap0Builder(instance); + } + } + + + public sealed interface ObjectWithDifficultlyNamedProps1Boxed permits ObjectWithDifficultlyNamedProps1BoxedMap { + @Nullable Object getData(); + } + + public record ObjectWithDifficultlyNamedProps1BoxedMap(ObjectWithDifficultlyNamedPropsMap data) implements ObjectWithDifficultlyNamedProps1Boxed { + @Override + public @Nullable Object getData() { + return data; + } + } + + + public static class ObjectWithDifficultlyNamedProps1 extends JsonSchema implements MapSchemaValidator { + /* + NOTE: This class is auto generated by OpenAPI JSON Schema Generator. + Ref: https://github.com/openapi-json-schema-tools/openapi-json-schema-generator + + Do not edit the class manually. + + model with properties that have invalid names for python + */ + private static @Nullable ObjectWithDifficultlyNamedProps1 instance = null; + + protected ObjectWithDifficultlyNamedProps1() { + super(new JsonSchemaInfo() + .type(Set.of(Map.class)) + .properties(Map.ofEntries( + new PropertyEntry("$special[property.name]", Specialpropertyname.class), + new PropertyEntry("123-list", Schema123list.class), + new PropertyEntry("123Number", Schema123Number.class) + )) + .required(Set.of( + "123-list" + )) + ); + } + + public static ObjectWithDifficultlyNamedProps1 getInstance() { + if (instance == null) { + instance = new ObjectWithDifficultlyNamedProps1(); + } + return instance; + } + + 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 RuntimeException("Invalid non-string key value"); + } + String propertyName = (String) entryKey; + List propertyPathToItem = new ArrayList<>(pathToItem); + propertyPathToItem.add(propertyName); + Object value = entry.getValue(); + LinkedHashMap, Nothing?> schemas = pathToSchemas.get(propertyPathToItem); + if (schemas == null) { + throw new RuntimeException("Validation result is invalid, schemas must exist for a pathToItem"); + } + JsonSchema propertySchema = schemas.entrySet().iterator().next().getKey(); + @Nullable Object propertyInstance = propertySchema.getNewInstance(value, propertyPathToItem, pathToSchemas); + properties.put(propertyName, propertyInstance); + } + FrozenMap<@Nullable Object> castProperties = new FrozenMap<>(properties); + return new ObjectWithDifficultlyNamedPropsMap(castProperties); + } + + 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); + SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().build())); + ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, new PathToSchemasMap(), new LinkedHashSet<>()); + PathToSchemasMap pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet); + return getNewInstance(castArg, validationMetadata.pathToItem(), pathToSchemasMap); + } + + + @Override + public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws 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"); + } + @Override + public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { + if (arg instanceof Map) { + return getNewInstance((Map) arg, pathToItem, pathToSchemas); + } + 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 { + return new ObjectWithDifficultlyNamedProps1BoxedMap(validate(arg, configuration)); + } + @Override + public ObjectWithDifficultlyNamedProps1Boxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { + 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"); + } + } + +} diff --git a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/schemas/ObjectWithInlineCompositionProperty.kt b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/schemas/ObjectWithInlineCompositionProperty.kt new file mode 100644 index 00000000000..2dd41f751f3 --- /dev/null +++ b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/schemas/ObjectWithInlineCompositionProperty.kt @@ -0,0 +1,602 @@ +package org.openapijsonschematools.client.components.schemas; +import java.time.LocalDate; +import java.time.ZonedDateTime; +import java.util.ArrayList; +import java.util.HashSet; +import java.util.LinkedHashMap; +import java.util.LinkedHashSet; +import java.util.List; +import java.util.Map; +import java.util.Objects; +import java.util.Set; +import java.util.UUID; +import org.checkerframework.checker.nullness.qual.Nullable; +import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags; +import org.openapijsonschematools.client.configurations.SchemaConfiguration; +import org.openapijsonschematools.client.exceptions.InvalidAdditionalPropertyException; +import org.openapijsonschematools.client.exceptions.UnsetPropertyException; +import org.openapijsonschematools.client.exceptions.ValidationException; +import org.openapijsonschematools.client.schemas.GenericBuilder; +import org.openapijsonschematools.client.schemas.UnsetAddPropsSetter; +import org.openapijsonschematools.client.schemas.validation.BooleanSchemaValidator; +import org.openapijsonschematools.client.schemas.validation.FrozenList; +import org.openapijsonschematools.client.schemas.validation.FrozenMap; +import org.openapijsonschematools.client.schemas.validation.JsonSchema; +import org.openapijsonschematools.client.schemas.validation.JsonSchemaInfo; +import org.openapijsonschematools.client.schemas.validation.ListSchemaValidator; +import org.openapijsonschematools.client.schemas.validation.MapSchemaValidator; +import org.openapijsonschematools.client.schemas.validation.NullSchemaValidator; +import org.openapijsonschematools.client.schemas.validation.NumberSchemaValidator; +import org.openapijsonschematools.client.schemas.validation.PathToSchemasMap; +import org.openapijsonschematools.client.schemas.validation.PropertyEntry; +import org.openapijsonschematools.client.schemas.validation.StringSchemaValidator; +import org.openapijsonschematools.client.schemas.validation.ValidationMetadata; + +public class ObjectWithInlineCompositionProperty { + // nest classes so all schemas and input/output classes can be public + + + public sealed interface Schema0Boxed permits Schema0BoxedString { + @Nullable Object getData(); + } + + public record Schema0BoxedString(String data) implements Schema0Boxed { + @Override + public @Nullable Object getData() { + return data; + } + } + + + + public static class Schema0 extends JsonSchema implements StringSchemaValidator { + private static @Nullable Schema0 instance = null; + + protected Schema0() { + super(new JsonSchemaInfo() + .type(Set.of( + String.class + )) + .minLength(1) + ); + } + + public static Schema0 getInstance() { + if (instance == null) { + instance = new Schema0(); + } + return instance; + } + + @Override + public String validate(String arg, SchemaConfiguration configuration) throws ValidationException { + Set> pathSet = new HashSet<>(); + List pathToItem = List.of("args[0"); + String castArg = castToAllowedTypes(arg, pathToItem, pathSet); + SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().build())); + ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, new PathToSchemasMap(), new LinkedHashSet<>()); + getPathToSchemas(this, castArg, validationMetadata, pathSet); + return castArg; + } + + @Override + public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws 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"); + } + @Override + public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { + 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"); + } + @Override + 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 { + 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"); + } + } + + public sealed interface SomePropBoxed permits SomePropBoxedVoid, SomePropBoxedBoolean, SomePropBoxedNumber, SomePropBoxedString, SomePropBoxedList, SomePropBoxedMap { + @Nullable Object getData(); + } + + public record SomePropBoxedVoid(Nothing? data) implements SomePropBoxed { + @Override + public @Nullable Object getData() { + return data; + } + } + + public record SomePropBoxedBoolean(boolean data) implements SomePropBoxed { + @Override + public @Nullable Object getData() { + return data; + } + } + + public record SomePropBoxedNumber(Number data) implements SomePropBoxed { + @Override + public @Nullable Object getData() { + return data; + } + } + + public record SomePropBoxedString(String data) implements SomePropBoxed { + @Override + public @Nullable Object getData() { + return data; + } + } + + public record SomePropBoxedList(FrozenList<@Nullable Object> data) implements SomePropBoxed { + @Override + public @Nullable Object getData() { + return data; + } + } + + public record SomePropBoxedMap(FrozenMap<@Nullable Object> data) implements SomePropBoxed { + @Override + public @Nullable Object getData() { + return data; + } + } + + + public static class SomeProp extends JsonSchema implements NullSchemaValidator, BooleanSchemaValidator, NumberSchemaValidator, StringSchemaValidator, ListSchemaValidator, SomePropBoxedList>, MapSchemaValidator, SomePropBoxedMap> { + private static @Nullable SomeProp instance = null; + + protected SomeProp() { + super(new JsonSchemaInfo() + .allOf(List.of( + Schema0.class + )) + ); + } + + public static SomeProp getInstance() { + if (instance == null) { + instance = new SomeProp(); + } + return instance; + } + + @Override + public Nothing? validate(Nothing? arg, SchemaConfiguration configuration) throws ValidationException { + Set> pathSet = new HashSet<>(); + List pathToItem = List.of("args[0]"); + Nothing? castArg = castToAllowedTypes(arg, pathToItem, pathSet); + SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().build())); + PathToSchemasMap validatedPathToSchemas = new PathToSchemasMap(); + ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, new LinkedHashSet<>()); + getPathToSchemas(this, castArg, validationMetadata, pathSet); + return castArg; + } + + @Override + public boolean validate(boolean arg, SchemaConfiguration configuration) throws ValidationException { + Set> pathSet = new HashSet<>(); + List pathToItem = List.of("args[0]"); + boolean castArg = castToAllowedTypes(arg, pathToItem, pathSet); + SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().build())); + PathToSchemasMap validatedPathToSchemas = new PathToSchemasMap(); + ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, new LinkedHashSet<>()); + getPathToSchemas(this, castArg, validationMetadata, pathSet); + return castArg; + } + + @Override + public Number validate(Number arg, SchemaConfiguration configuration) throws ValidationException { + Set> pathSet = new HashSet<>(); + List pathToItem = List.of("args[0]"); + Number castArg = castToAllowedTypes(arg, pathToItem, pathSet); + SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().build())); + PathToSchemasMap validatedPathToSchemas = new PathToSchemasMap(); + ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, new LinkedHashSet<>()); + getPathToSchemas(this, castArg, validationMetadata, pathSet); + return castArg; + } + + public int validate(int arg, SchemaConfiguration configuration) throws ValidationException { + return (int) validate((Number) arg, configuration); + } + + public long validate(long arg, SchemaConfiguration configuration) throws ValidationException { + return (long) validate((Number) arg, configuration); + } + + public float validate(float arg, SchemaConfiguration configuration) throws ValidationException { + return (float) validate((Number) arg, configuration); + } + + public double validate(double arg, SchemaConfiguration configuration) throws ValidationException { + return (double) validate((Number) arg, configuration); + } + + @Override + public String validate(String arg, SchemaConfiguration configuration) throws ValidationException { + Set> pathSet = new HashSet<>(); + List pathToItem = List.of("args[0]"); + String castArg = castToAllowedTypes(arg, pathToItem, pathSet); + SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().build())); + PathToSchemasMap validatedPathToSchemas = new PathToSchemasMap(); + ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, new LinkedHashSet<>()); + getPathToSchemas(this, castArg, validationMetadata, pathSet); + return castArg; + } + + public String validate(LocalDate arg, SchemaConfiguration configuration) throws ValidationException { + return validate(arg.toString(), configuration); + } + + public String validate(ZonedDateTime arg, SchemaConfiguration configuration) throws ValidationException { + return validate(arg.toString(), configuration); + } + + public String validate(UUID arg, SchemaConfiguration configuration) throws ValidationException { + return validate(arg.toString(), configuration); + } + + @Override + public FrozenList<@Nullable Object> getNewInstance(List arg, List pathToItem, PathToSchemasMap pathToSchemas) { + List<@Nullable Object> items = new ArrayList<>(); + int i = 0; + for (Object item: arg) { + List itemPathToItem = new ArrayList<>(pathToItem); + itemPathToItem.add(i); + LinkedHashMap, Nothing?> schemas = pathToSchemas.get(itemPathToItem); + if (schemas == null) { + throw new RuntimeException("Validation result is invalid, schemas must exist for a pathToItem"); + } + JsonSchema itemSchema = schemas.entrySet().iterator().next().getKey(); + @Nullable Object itemInstance = itemSchema.getNewInstance(item, itemPathToItem, pathToSchemas); + items.add(itemInstance); + i += 1; + } + FrozenList<@Nullable Object> newInstanceItems = new FrozenList<>(items); + return newInstanceItems; + } + + 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); + SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().build())); + ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, new PathToSchemasMap(), new LinkedHashSet<>()); + PathToSchemasMap pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet); + return getNewInstance(castArg, validationMetadata.pathToItem(), pathToSchemasMap); + } + + @Override + 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 RuntimeException("Invalid non-string key value"); + } + String propertyName = (String) entryKey; + List propertyPathToItem = new ArrayList<>(pathToItem); + propertyPathToItem.add(propertyName); + Object value = entry.getValue(); + LinkedHashMap, Nothing?> schemas = pathToSchemas.get(propertyPathToItem); + if (schemas == null) { + throw new RuntimeException("Validation result is invalid, schemas must exist for a pathToItem"); + } + JsonSchema propertySchema = schemas.entrySet().iterator().next().getKey(); + @Nullable Object propertyInstance = propertySchema.getNewInstance(value, propertyPathToItem, pathToSchemas); + properties.put(propertyName, propertyInstance); + } + FrozenMap<@Nullable Object> castProperties = new FrozenMap<>(properties); + return castProperties; + } + + public FrozenMap<@Nullable Object> validate(Map arg, SchemaConfiguration configuration) throws ValidationException { + Set> pathSet = new HashSet<>(); + List pathToItem = List.of("args[0]"); + Map castArg = castToAllowedTypes(arg, pathToItem, pathSet); + SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().build())); + PathToSchemasMap validatedPathToSchemas = new PathToSchemasMap(); + ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, new LinkedHashSet<>()); + PathToSchemasMap pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet); + return getNewInstance(castArg, validationMetadata.pathToItem(), pathToSchemasMap); + } + + @Override + public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { + if (arg == null) { + return validate((Nothing?) null, configuration); + } else if (arg instanceof Boolean) { + boolean boolArg = (Boolean) arg; + return validate(boolArg, configuration); + } else if (arg instanceof Number) { + return validate((Number) arg, configuration); + } else if (arg instanceof String) { + return validate((String) arg, configuration); + } else if (arg instanceof List) { + return validate((List) arg, 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"); + } + @Override + public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { + if (arg == null) { + return getNewInstance((Nothing?) null, pathToItem, pathToSchemas); + } else if (arg instanceof Boolean) { + boolean boolArg = (Boolean) arg; + return getNewInstance(boolArg, pathToItem, pathToSchemas); + } else if (arg instanceof Number) { + return getNewInstance((Number) arg, pathToItem, pathToSchemas); + } else if (arg instanceof String) { + return getNewInstance((String) arg, pathToItem, pathToSchemas); + } else if (arg instanceof List) { + return getNewInstance((List) arg, 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"); + } + @Override + public SomePropBoxedVoid validateAndBox(Nothing? arg, SchemaConfiguration configuration) throws ValidationException { + return new SomePropBoxedVoid(validate(arg, configuration)); + } + @Override + 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 { + return new SomePropBoxedNumber(validate(arg, configuration)); + } + @Override + 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 { + return new SomePropBoxedList(validate(arg, configuration)); + } + @Override + 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 { + if (arg == null) { + Nothing? castArg = (Nothing?) arg; + return validateAndBox(castArg, configuration); + } else if (arg instanceof Boolean booleanArg) { + boolean castArg = booleanArg; + return validateAndBox(castArg, configuration); + } else if (arg instanceof String castArg) { + return validateAndBox(castArg, configuration); + } else if (arg instanceof Number castArg) { + return validateAndBox(castArg, configuration); + } else if (arg instanceof List castArg) { + 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"); + } + } + + public static class ObjectWithInlineCompositionPropertyMap extends FrozenMap<@Nullable Object> { + protected ObjectWithInlineCompositionPropertyMap(FrozenMap<@Nullable Object> m) { + super(m); + } + public static final Set requiredKeys = Set.of(); + public static final Set optionalKeys = Set.of( + "someProp" + ); + public static ObjectWithInlineCompositionPropertyMap of(Map arg, SchemaConfiguration configuration) throws ValidationException { + return ObjectWithInlineCompositionProperty1.getInstance().validate(arg, configuration); + } + + public @Nullable Object someProp() throws UnsetPropertyException { + return getOrThrow("someProp"); + } + + public @Nullable Object getAdditionalProperty(String name) throws UnsetPropertyException, InvalidAdditionalPropertyException { + throwIfKeyKnown(name, requiredKeys, optionalKeys); + throwIfKeyNotPresent(name); + return get(name); + } + } + + public interface SetterForSomeProp { + Map getInstance(); + T getBuilderAfterSomeProp(Map instance); + + default T someProp(Nothing? value) { + var instance = getInstance(); + instance.put("someProp", null); + return getBuilderAfterSomeProp(instance); + } + + default T someProp(boolean value) { + var instance = getInstance(); + instance.put("someProp", value); + return getBuilderAfterSomeProp(instance); + } + + default T someProp(String value) { + var instance = getInstance(); + instance.put("someProp", value); + return getBuilderAfterSomeProp(instance); + } + + default T someProp(int value) { + var instance = getInstance(); + instance.put("someProp", value); + return getBuilderAfterSomeProp(instance); + } + + default T someProp(float value) { + var instance = getInstance(); + instance.put("someProp", value); + return getBuilderAfterSomeProp(instance); + } + + default T someProp(long value) { + var instance = getInstance(); + instance.put("someProp", value); + return getBuilderAfterSomeProp(instance); + } + + default T someProp(double value) { + var instance = getInstance(); + instance.put("someProp", value); + return getBuilderAfterSomeProp(instance); + } + + default T someProp(List value) { + var instance = getInstance(); + instance.put("someProp", value); + return getBuilderAfterSomeProp(instance); + } + + default T someProp(Map value) { + var instance = getInstance(); + instance.put("someProp", value); + return getBuilderAfterSomeProp(instance); + } + } + + public static class ObjectWithInlineCompositionPropertyMapBuilder extends UnsetAddPropsSetter implements GenericBuilder>, SetterForSomeProp { + private final Map instance; + private static final Set knownKeys = Set.of( + "someProp" + ); + public Set getKnownKeys() { + return knownKeys; + } + public ObjectWithInlineCompositionPropertyMapBuilder() { + this.instance = new LinkedHashMap<>(); + } + public Map build() { + return instance; + } + public Map getInstance() { + return instance; + } + public ObjectWithInlineCompositionPropertyMapBuilder getBuilderAfterSomeProp(Map instance) { + return this; + } + public ObjectWithInlineCompositionPropertyMapBuilder getBuilderAfterAdditionalProperty(Map instance) { + return this; + } + } + + + public sealed interface ObjectWithInlineCompositionProperty1Boxed permits ObjectWithInlineCompositionProperty1BoxedMap { + @Nullable Object getData(); + } + + public record ObjectWithInlineCompositionProperty1BoxedMap(ObjectWithInlineCompositionPropertyMap data) implements ObjectWithInlineCompositionProperty1Boxed { + @Override + public @Nullable Object getData() { + return data; + } + } + + + public static class ObjectWithInlineCompositionProperty1 extends JsonSchema implements MapSchemaValidator { + /* + NOTE: This class is auto generated by OpenAPI JSON Schema Generator. + Ref: https://github.com/openapi-json-schema-tools/openapi-json-schema-generator + + Do not edit the class manually. + */ + private static @Nullable ObjectWithInlineCompositionProperty1 instance = null; + + protected ObjectWithInlineCompositionProperty1() { + super(new JsonSchemaInfo() + .type(Set.of(Map.class)) + .properties(Map.ofEntries( + new PropertyEntry("someProp", SomeProp.class) + )) + ); + } + + public static ObjectWithInlineCompositionProperty1 getInstance() { + if (instance == null) { + instance = new ObjectWithInlineCompositionProperty1(); + } + return instance; + } + + 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 RuntimeException("Invalid non-string key value"); + } + String propertyName = (String) entryKey; + List propertyPathToItem = new ArrayList<>(pathToItem); + propertyPathToItem.add(propertyName); + Object value = entry.getValue(); + LinkedHashMap, Nothing?> schemas = pathToSchemas.get(propertyPathToItem); + if (schemas == null) { + throw new RuntimeException("Validation result is invalid, schemas must exist for a pathToItem"); + } + JsonSchema propertySchema = schemas.entrySet().iterator().next().getKey(); + @Nullable Object propertyInstance = propertySchema.getNewInstance(value, propertyPathToItem, pathToSchemas); + properties.put(propertyName, propertyInstance); + } + FrozenMap<@Nullable Object> castProperties = new FrozenMap<>(properties); + return new ObjectWithInlineCompositionPropertyMap(castProperties); + } + + 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); + SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().build())); + ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, new PathToSchemasMap(), new LinkedHashSet<>()); + PathToSchemasMap pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet); + return getNewInstance(castArg, validationMetadata.pathToItem(), pathToSchemasMap); + } + + + @Override + public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws 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"); + } + @Override + public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { + if (arg instanceof Map) { + return getNewInstance((Map) arg, pathToItem, pathToSchemas); + } + 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 { + return new ObjectWithInlineCompositionProperty1BoxedMap(validate(arg, configuration)); + } + @Override + public ObjectWithInlineCompositionProperty1Boxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { + 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"); + } + } + +} diff --git a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/schemas/ObjectWithInvalidNamedRefedProperties.kt b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/schemas/ObjectWithInvalidNamedRefedProperties.kt new file mode 100644 index 00000000000..b5992953735 --- /dev/null +++ b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/schemas/ObjectWithInvalidNamedRefedProperties.kt @@ -0,0 +1,249 @@ +package org.openapijsonschematools.client.components.schemas; +import java.util.ArrayList; +import java.util.HashSet; +import java.util.LinkedHashMap; +import java.util.LinkedHashSet; +import java.util.List; +import java.util.Map; +import java.util.Objects; +import java.util.Set; +import org.checkerframework.checker.nullness.qual.Nullable; +import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags; +import org.openapijsonschematools.client.configurations.SchemaConfiguration; +import org.openapijsonschematools.client.exceptions.InvalidAdditionalPropertyException; +import org.openapijsonschematools.client.exceptions.UnsetPropertyException; +import org.openapijsonschematools.client.exceptions.ValidationException; +import org.openapijsonschematools.client.schemas.GenericBuilder; +import org.openapijsonschematools.client.schemas.UnsetAddPropsSetter; +import org.openapijsonschematools.client.schemas.validation.FrozenMap; +import org.openapijsonschematools.client.schemas.validation.JsonSchema; +import org.openapijsonschematools.client.schemas.validation.JsonSchemaInfo; +import org.openapijsonschematools.client.schemas.validation.MapSchemaValidator; +import org.openapijsonschematools.client.schemas.validation.PathToSchemasMap; +import org.openapijsonschematools.client.schemas.validation.PropertyEntry; +import org.openapijsonschematools.client.schemas.validation.ValidationMetadata; + +public class ObjectWithInvalidNamedRefedProperties { + // nest classes so all schemas and input/output classes can be public + + + public static class ObjectWithInvalidNamedRefedPropertiesMap extends FrozenMap<@Nullable Object> { + protected ObjectWithInvalidNamedRefedPropertiesMap(FrozenMap<@Nullable Object> m) { + super(m); + } + public static final Set requiredKeys = Set.of( + "!reference", + "from" + ); + public static final Set optionalKeys = Set.of(); + public static ObjectWithInvalidNamedRefedPropertiesMap of(Map arg, SchemaConfiguration configuration) throws ValidationException { + return ObjectWithInvalidNamedRefedProperties1.getInstance().validate(arg, configuration); + } + + public FromSchema.FromSchemaMap from() { + @Nullable Object value = get("from"); + if (!(value instanceof FromSchema.FromSchemaMap)) { + throw new RuntimeException("Invalid value stored for from"); + } + return (FromSchema.FromSchemaMap) value; + } + + public @Nullable Object getAdditionalProperty(String name) throws UnsetPropertyException, InvalidAdditionalPropertyException { + throwIfKeyKnown(name, requiredKeys, optionalKeys); + throwIfKeyNotPresent(name); + return get(name); + } + } + + public interface SetterForReference { + Map getInstance(); + T getBuilderAfterReference(Map instance); + + default T exclamationMarkReference(List value) { + var instance = getInstance(); + instance.put("!reference", value); + return getBuilderAfterReference(instance); + } + } + + public interface SetterForFrom { + Map getInstance(); + T getBuilderAfterFrom(Map instance); + + default T from(Map value) { + var instance = getInstance(); + instance.put("from", value); + return getBuilderAfterFrom(instance); + } + } + + public static class ObjectWithInvalidNamedRefedPropertiesMap00Builder extends UnsetAddPropsSetter implements GenericBuilder> { + private final Map instance; + private static final Set knownKeys = Set.of( + "!reference", + "from" + ); + public Set getKnownKeys() { + return knownKeys; + } + public ObjectWithInvalidNamedRefedPropertiesMap00Builder(Map instance) { + this.instance = instance; + } + public Map build() { + return instance; + } + public Map getInstance() { + return instance; + } + public ObjectWithInvalidNamedRefedPropertiesMap00Builder getBuilderAfterAdditionalProperty(Map instance) { + return this; + } + } + + public static class ObjectWithInvalidNamedRefedPropertiesMap01Builder implements SetterForFrom { + private final Map instance; + public ObjectWithInvalidNamedRefedPropertiesMap01Builder(Map instance) { + this.instance = instance; + } + public Map getInstance() { + return instance; + } + public ObjectWithInvalidNamedRefedPropertiesMap00Builder getBuilderAfterFrom(Map instance) { + return new ObjectWithInvalidNamedRefedPropertiesMap00Builder(instance); + } + } + + public static class ObjectWithInvalidNamedRefedPropertiesMap10Builder implements SetterForReference { + private final Map instance; + public ObjectWithInvalidNamedRefedPropertiesMap10Builder(Map instance) { + this.instance = instance; + } + public Map getInstance() { + return instance; + } + public ObjectWithInvalidNamedRefedPropertiesMap00Builder getBuilderAfterReference(Map instance) { + return new ObjectWithInvalidNamedRefedPropertiesMap00Builder(instance); + } + } + + public static class ObjectWithInvalidNamedRefedPropertiesMapBuilder implements SetterForReference, SetterForFrom { + private final Map instance; + public ObjectWithInvalidNamedRefedPropertiesMapBuilder() { + this.instance = new LinkedHashMap<>(); + } + public Map getInstance() { + return instance; + } + public ObjectWithInvalidNamedRefedPropertiesMap01Builder getBuilderAfterReference(Map instance) { + return new ObjectWithInvalidNamedRefedPropertiesMap01Builder(instance); + } + public ObjectWithInvalidNamedRefedPropertiesMap10Builder getBuilderAfterFrom(Map instance) { + return new ObjectWithInvalidNamedRefedPropertiesMap10Builder(instance); + } + } + + + public sealed interface ObjectWithInvalidNamedRefedProperties1Boxed permits ObjectWithInvalidNamedRefedProperties1BoxedMap { + @Nullable Object getData(); + } + + public record ObjectWithInvalidNamedRefedProperties1BoxedMap(ObjectWithInvalidNamedRefedPropertiesMap data) implements ObjectWithInvalidNamedRefedProperties1Boxed { + @Override + public @Nullable Object getData() { + return data; + } + } + + + public static class ObjectWithInvalidNamedRefedProperties1 extends JsonSchema implements MapSchemaValidator { + /* + NOTE: This class is auto generated by OpenAPI JSON Schema Generator. + Ref: https://github.com/openapi-json-schema-tools/openapi-json-schema-generator + + Do not edit the class manually. + */ + private static @Nullable ObjectWithInvalidNamedRefedProperties1 instance = null; + + protected ObjectWithInvalidNamedRefedProperties1() { + super(new JsonSchemaInfo() + .type(Set.of(Map.class)) + .properties(Map.ofEntries( + new PropertyEntry("from", FromSchema.FromSchema1.class), + new PropertyEntry("!reference", ArrayWithValidationsInItems.ArrayWithValidationsInItems1.class) + )) + .required(Set.of( + "!reference", + "from" + )) + ); + } + + public static ObjectWithInvalidNamedRefedProperties1 getInstance() { + if (instance == null) { + instance = new ObjectWithInvalidNamedRefedProperties1(); + } + return instance; + } + + 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 RuntimeException("Invalid non-string key value"); + } + String propertyName = (String) entryKey; + List propertyPathToItem = new ArrayList<>(pathToItem); + propertyPathToItem.add(propertyName); + Object value = entry.getValue(); + LinkedHashMap, Nothing?> schemas = pathToSchemas.get(propertyPathToItem); + if (schemas == null) { + throw new RuntimeException("Validation result is invalid, schemas must exist for a pathToItem"); + } + JsonSchema propertySchema = schemas.entrySet().iterator().next().getKey(); + @Nullable Object propertyInstance = propertySchema.getNewInstance(value, propertyPathToItem, pathToSchemas); + properties.put(propertyName, propertyInstance); + } + FrozenMap<@Nullable Object> castProperties = new FrozenMap<>(properties); + return new ObjectWithInvalidNamedRefedPropertiesMap(castProperties); + } + + 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); + SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().build())); + ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, new PathToSchemasMap(), new LinkedHashSet<>()); + PathToSchemasMap pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet); + return getNewInstance(castArg, validationMetadata.pathToItem(), pathToSchemasMap); + } + + + @Override + public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws 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"); + } + @Override + public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { + if (arg instanceof Map) { + return getNewInstance((Map) arg, pathToItem, pathToSchemas); + } + 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 { + return new ObjectWithInvalidNamedRefedProperties1BoxedMap(validate(arg, configuration)); + } + @Override + public ObjectWithInvalidNamedRefedProperties1Boxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { + 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"); + } + } + +} diff --git a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/schemas/ObjectWithNonIntersectingValues.kt b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/schemas/ObjectWithNonIntersectingValues.kt new file mode 100644 index 00000000000..4a69c585c8f --- /dev/null +++ b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/schemas/ObjectWithNonIntersectingValues.kt @@ -0,0 +1,256 @@ +package org.openapijsonschematools.client.components.schemas; +import java.util.ArrayList; +import java.util.HashSet; +import java.util.LinkedHashMap; +import java.util.LinkedHashSet; +import java.util.List; +import java.util.Map; +import java.util.Objects; +import java.util.Set; +import org.checkerframework.checker.nullness.qual.Nullable; +import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags; +import org.openapijsonschematools.client.configurations.SchemaConfiguration; +import org.openapijsonschematools.client.exceptions.InvalidAdditionalPropertyException; +import org.openapijsonschematools.client.exceptions.UnsetPropertyException; +import org.openapijsonschematools.client.exceptions.ValidationException; +import org.openapijsonschematools.client.schemas.GenericBuilder; +import org.openapijsonschematools.client.schemas.NumberJsonSchema; +import org.openapijsonschematools.client.schemas.StringJsonSchema; +import org.openapijsonschematools.client.schemas.validation.FrozenMap; +import org.openapijsonschematools.client.schemas.validation.JsonSchema; +import org.openapijsonschematools.client.schemas.validation.JsonSchemaInfo; +import org.openapijsonschematools.client.schemas.validation.MapSchemaValidator; +import org.openapijsonschematools.client.schemas.validation.MapUtils; +import org.openapijsonschematools.client.schemas.validation.PathToSchemasMap; +import org.openapijsonschematools.client.schemas.validation.PropertyEntry; +import org.openapijsonschematools.client.schemas.validation.ValidationMetadata; + +public class ObjectWithNonIntersectingValues { + // nest classes so all schemas and input/output classes can be public + + + public static class AdditionalProperties extends StringJsonSchema.StringJsonSchema1 { + private static @Nullable AdditionalProperties instance = null; + public static AdditionalProperties getInstance() { + if (instance == null) { + instance = new AdditionalProperties(); + } + return instance; + } + } + + + public static class A extends NumberJsonSchema.NumberJsonSchema1 { + private static @Nullable A instance = null; + public static A getInstance() { + if (instance == null) { + instance = new A(); + } + return instance; + } + } + + + public static class ObjectWithNonIntersectingValuesMap extends FrozenMap { + protected ObjectWithNonIntersectingValuesMap(FrozenMap m) { + super(m); + } + public static final Set requiredKeys = Set.of(); + public static final Set optionalKeys = Set.of( + "a" + ); + public static ObjectWithNonIntersectingValuesMap of(Map arg, SchemaConfiguration configuration) throws ValidationException { + return ObjectWithNonIntersectingValues1.getInstance().validate(arg, configuration); + } + + public Number a() throws UnsetPropertyException { + String key = "a"; + throwIfKeyNotPresent(key); + Object value = get(key); + if (!(value instanceof Number)) { + throw new RuntimeException("Invalid value stored for a"); + } + return (Number) value; + } + + public String getAdditionalProperty(String name) throws UnsetPropertyException, InvalidAdditionalPropertyException { + throwIfKeyKnown(name, requiredKeys, optionalKeys); + var value = getOrThrow(name); + if (!(value instanceof String)) { + throw new RuntimeException("Invalid value stored for " + name); + } + return (String) value; + } + } + + public interface SetterForA { + Map getInstance(); + T getBuilderAfterA(Map instance); + + default T a(int value) { + var instance = getInstance(); + instance.put("a", value); + return getBuilderAfterA(instance); + } + + default T a(float value) { + var instance = getInstance(); + instance.put("a", value); + return getBuilderAfterA(instance); + } + + default T a(long value) { + var instance = getInstance(); + instance.put("a", value); + return getBuilderAfterA(instance); + } + + default T a(double value) { + var instance = getInstance(); + instance.put("a", value); + return getBuilderAfterA(instance); + } + } + + public interface SetterForAdditionalProperties { + Set getKnownKeys(); + Map getInstance(); + T getBuilderAfterAdditionalProperty(Map instance); + + default T additionalProperty(String key, String value) throws InvalidAdditionalPropertyException { + MapUtils.throwIfKeyKnown(key, getKnownKeys(), true); + var instance = getInstance(); + instance.put(key, value); + return getBuilderAfterAdditionalProperty(instance); + } + } + + public static class ObjectWithNonIntersectingValuesMapBuilder implements GenericBuilder>, SetterForA, SetterForAdditionalProperties { + private final Map instance; + private static final Set knownKeys = Set.of( + "a" + ); + public Set getKnownKeys() { + return knownKeys; + } + public ObjectWithNonIntersectingValuesMapBuilder() { + this.instance = new LinkedHashMap<>(); + } + public Map build() { + return instance; + } + public Map getInstance() { + return instance; + } + public ObjectWithNonIntersectingValuesMapBuilder getBuilderAfterA(Map instance) { + return this; + } + public ObjectWithNonIntersectingValuesMapBuilder getBuilderAfterAdditionalProperty(Map instance) { + return this; + } + } + + + public sealed interface ObjectWithNonIntersectingValues1Boxed permits ObjectWithNonIntersectingValues1BoxedMap { + @Nullable Object getData(); + } + + public record ObjectWithNonIntersectingValues1BoxedMap(ObjectWithNonIntersectingValuesMap data) implements ObjectWithNonIntersectingValues1Boxed { + @Override + public @Nullable Object getData() { + return data; + } + } + + + public static class ObjectWithNonIntersectingValues1 extends JsonSchema implements MapSchemaValidator { + /* + NOTE: This class is auto generated by OpenAPI JSON Schema Generator. + Ref: https://github.com/openapi-json-schema-tools/openapi-json-schema-generator + + Do not edit the class manually. + */ + private static @Nullable ObjectWithNonIntersectingValues1 instance = null; + + protected ObjectWithNonIntersectingValues1() { + super(new JsonSchemaInfo() + .type(Set.of(Map.class)) + .properties(Map.ofEntries( + new PropertyEntry("a", A.class) + )) + .additionalProperties(AdditionalProperties.class) + ); + } + + public static ObjectWithNonIntersectingValues1 getInstance() { + if (instance == null) { + instance = new ObjectWithNonIntersectingValues1(); + } + return instance; + } + + 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 RuntimeException("Invalid non-string key value"); + } + String propertyName = (String) entryKey; + List propertyPathToItem = new ArrayList<>(pathToItem); + propertyPathToItem.add(propertyName); + Object value = entry.getValue(); + LinkedHashMap, Nothing?> schemas = pathToSchemas.get(propertyPathToItem); + if (schemas == null) { + throw new RuntimeException("Validation 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"); + } + properties.put(propertyName, (Object) propertyInstance); + } + FrozenMap castProperties = new FrozenMap<>(properties); + return new ObjectWithNonIntersectingValuesMap(castProperties); + } + + 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); + SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().build())); + ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, new PathToSchemasMap(), new LinkedHashSet<>()); + PathToSchemasMap pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet); + return getNewInstance(castArg, validationMetadata.pathToItem(), pathToSchemasMap); + } + + + @Override + public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws 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"); + } + @Override + public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { + if (arg instanceof Map) { + return getNewInstance((Map) arg, pathToItem, pathToSchemas); + } + 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 { + return new ObjectWithNonIntersectingValues1BoxedMap(validate(arg, configuration)); + } + @Override + public ObjectWithNonIntersectingValues1Boxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { + 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"); + } + } + +} diff --git a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/schemas/ObjectWithOnlyOptionalProps.kt b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/schemas/ObjectWithOnlyOptionalProps.kt new file mode 100644 index 00000000000..8f7d1238543 --- /dev/null +++ b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/schemas/ObjectWithOnlyOptionalProps.kt @@ -0,0 +1,463 @@ +package org.openapijsonschematools.client.components.schemas; +import java.util.ArrayList; +import java.util.HashSet; +import java.util.LinkedHashMap; +import java.util.LinkedHashSet; +import java.util.List; +import java.util.Map; +import java.util.Objects; +import java.util.Set; +import org.checkerframework.checker.nullness.qual.Nullable; +import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags; +import org.openapijsonschematools.client.configurations.SchemaConfiguration; +import org.openapijsonschematools.client.exceptions.UnsetPropertyException; +import org.openapijsonschematools.client.exceptions.ValidationException; +import org.openapijsonschematools.client.schemas.AnyTypeJsonSchema; +import org.openapijsonschematools.client.schemas.GenericBuilder; +import org.openapijsonschematools.client.schemas.NotAnyTypeJsonSchema; +import org.openapijsonschematools.client.schemas.NumberJsonSchema; +import org.openapijsonschematools.client.schemas.StringJsonSchema; +import org.openapijsonschematools.client.schemas.validation.FrozenList; +import org.openapijsonschematools.client.schemas.validation.FrozenMap; +import org.openapijsonschematools.client.schemas.validation.JsonSchema; +import org.openapijsonschematools.client.schemas.validation.JsonSchemaInfo; +import org.openapijsonschematools.client.schemas.validation.ListSchemaValidator; +import org.openapijsonschematools.client.schemas.validation.MapSchemaValidator; +import org.openapijsonschematools.client.schemas.validation.MapUtils; +import org.openapijsonschematools.client.schemas.validation.NullSchemaValidator; +import org.openapijsonschematools.client.schemas.validation.PathToSchemasMap; +import org.openapijsonschematools.client.schemas.validation.PropertyEntry; +import org.openapijsonschematools.client.schemas.validation.ValidationMetadata; + +public class ObjectWithOnlyOptionalProps { + // nest classes so all schemas and input/output classes can be public + + + public static class AdditionalProperties extends NotAnyTypeJsonSchema.NotAnyTypeJsonSchema1 { + // NotAnyTypeSchema + private static @Nullable AdditionalProperties instance = null; + public static AdditionalProperties getInstance() { + if (instance == null) { + instance = new AdditionalProperties(); + } + return instance; + } + } + + + public static class A extends StringJsonSchema.StringJsonSchema1 { + private static @Nullable A instance = null; + public static A getInstance() { + if (instance == null) { + instance = new A(); + } + return instance; + } + } + + + public static class B extends NumberJsonSchema.NumberJsonSchema1 { + private static @Nullable B instance = null; + public static B getInstance() { + if (instance == null) { + instance = new B(); + } + return instance; + } + } + + + public static class ArrayPropertyList extends FrozenList { + protected ArrayPropertyList(FrozenList m) { + super(m); + } + public static ArrayPropertyList of(List arg, SchemaConfiguration configuration) throws ValidationException { + return ArrayProperty.getInstance().validate(arg, configuration); + } + } + + public static class ArrayPropertyListBuilder { + // class to build List + private final List list; + + public ArrayPropertyListBuilder() { + list = new ArrayList<>(); + } + + public ArrayPropertyListBuilder(List list) { + this.list = list; + } + + public ArrayPropertyListBuilder add(String item) { + list.add(item); + return this; + } + + public ArrayPropertyListBuilder add(EnumClass.StringEnumClassEnums item) { + list.add(item.value()); + return this; + } + + public List build() { + return list; + } + } + + + public sealed interface ArrayPropertyBoxed permits ArrayPropertyBoxedNothing?, ArrayPropertyBoxedList { + @Nullable Object getData(); + } + + public record ArrayPropertyBoxedVoid(Nothing? data) implements ArrayPropertyBoxed { + @Override + public @Nullable Object getData() { + return data; + } + } + + public record ArrayPropertyBoxedList(ArrayPropertyList data) implements ArrayPropertyBoxed { + @Override + public @Nullable Object getData() { + return data; + } + } + + + + public static class ArrayProperty extends JsonSchema implements NullSchemaValidator, ListSchemaValidator { + private static @Nullable ArrayProperty instance = null; + + protected ArrayProperty() { + super(new JsonSchemaInfo() + .type(Set.of( + Nothing?.class, + List.class + )) + .items(EnumClass.EnumClass1.class) + ); + } + + public static ArrayProperty getInstance() { + if (instance == null) { + instance = new ArrayProperty(); + } + return instance; + } + + @Override + public Nothing? validate(Nothing? arg, SchemaConfiguration configuration) throws ValidationException { + Set> pathSet = new HashSet<>(); + List pathToItem = List.of("args[0"); + Nothing? castArg = castToAllowedTypes(arg, pathToItem, pathSet); + SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().build())); + ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, new PathToSchemasMap(), new LinkedHashSet<>()); + getPathToSchemas(this, castArg, validationMetadata, pathSet); + return castArg; + } + + @Override + public ArrayPropertyList getNewInstance(List arg, List pathToItem, PathToSchemasMap pathToSchemas) { + List items = new ArrayList<>(); + int i = 0; + for (Object item: arg) { + List itemPathToItem = new ArrayList<>(pathToItem); + itemPathToItem.add(i); + LinkedHashMap, Nothing?> schemas = pathToSchemas.get(itemPathToItem); + if (schemas == null) { + throw new RuntimeException("Validation 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"); + } + items.add((String) itemInstance); + i += 1; + } + FrozenList newInstanceItems = new FrozenList<>(items); + return new ArrayPropertyList(newInstanceItems); + } + + public ArrayPropertyList validate(List arg, SchemaConfiguration configuration) throws ValidationException { + Set> pathSet = new HashSet<>(); + List pathToItem = List.of("args[0"); + List castArg = castToAllowedTypes(arg, pathToItem, pathSet); + SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().build())); + ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, new PathToSchemasMap(), new LinkedHashSet<>()); + PathToSchemasMap pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet); + return getNewInstance(castArg, validationMetadata.pathToItem(), pathToSchemasMap); + } + + @Override + public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { + if (arg == null) { + return validate((Nothing?) 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"); + } + @Override + public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { + if (arg == null) { + return getNewInstance((Nothing?) 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"); + } + @Override + public ArrayPropertyBoxedVoid validateAndBox(Nothing? arg, SchemaConfiguration configuration) throws ValidationException { + return new ArrayPropertyBoxedVoid(validate(arg, configuration)); + } + @Override + public ArrayPropertyBoxedList validateAndBox(List arg, SchemaConfiguration configuration) throws ValidationException { + return new ArrayPropertyBoxedList(validate(arg, configuration)); + } + @Override + public ArrayPropertyBoxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { + if (arg == null) { + Nothing? castArg = (Nothing?) 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"); + } + } + + public static class ObjectWithOnlyOptionalPropsMap extends FrozenMap<@Nullable Object> { + protected ObjectWithOnlyOptionalPropsMap(FrozenMap<@Nullable Object> m) { + super(m); + } + public static final Set requiredKeys = Set.of(); + public static final Set optionalKeys = Set.of( + "a", + "b", + "ArrayProperty" + ); + public static ObjectWithOnlyOptionalPropsMap of(Map arg, SchemaConfiguration configuration) throws ValidationException { + return ObjectWithOnlyOptionalProps1.getInstance().validate(arg, configuration); + } + + public String a() throws UnsetPropertyException { + String key = "a"; + throwIfKeyNotPresent(key); + @Nullable Object value = get(key); + if (!(value instanceof String)) { + throw new RuntimeException("Invalid value stored for a"); + } + return (String) value; + } + + public Number b() throws UnsetPropertyException { + String key = "b"; + throwIfKeyNotPresent(key); + @Nullable Object value = get(key); + if (!(value instanceof Number)) { + throw new RuntimeException("Invalid value stored for b"); + } + return (Number) value; + } + + public @Nullable ArrayPropertyList ArrayProperty() throws UnsetPropertyException { + String key = "ArrayProperty"; + throwIfKeyNotPresent(key); + @Nullable Object value = get(key); + if (!(value == null || value instanceof ArrayPropertyList)) { + throw new RuntimeException("Invalid value stored for ArrayProperty"); + } + return (@Nullable ArrayPropertyList) value; + } + } + + public interface SetterForA { + Map getInstance(); + T getBuilderAfterA(Map instance); + + default T a(String value) { + var instance = getInstance(); + instance.put("a", value); + return getBuilderAfterA(instance); + } + } + + public interface SetterForB { + Map getInstance(); + T getBuilderAfterB(Map instance); + + default T b(int value) { + var instance = getInstance(); + instance.put("b", value); + return getBuilderAfterB(instance); + } + + default T b(float value) { + var instance = getInstance(); + instance.put("b", value); + return getBuilderAfterB(instance); + } + + default T b(long value) { + var instance = getInstance(); + instance.put("b", value); + return getBuilderAfterB(instance); + } + + default T b(double value) { + var instance = getInstance(); + instance.put("b", value); + return getBuilderAfterB(instance); + } + } + + public interface SetterForArrayProperty { + Map getInstance(); + T getBuilderAfterArrayProperty(Map instance); + + default T ArrayProperty(Nothing? value) { + var instance = getInstance(); + instance.put("ArrayProperty", null); + return getBuilderAfterArrayProperty(instance); + } + + default T ArrayProperty(List value) { + var instance = getInstance(); + instance.put("ArrayProperty", value); + return getBuilderAfterArrayProperty(instance); + } + } + + public static class ObjectWithOnlyOptionalPropsMapBuilder implements GenericBuilder>, SetterForA, SetterForB, SetterForArrayProperty { + private final Map instance; + private static final Set knownKeys = Set.of( + "a", + "b", + "ArrayProperty" + ); + public Set getKnownKeys() { + return knownKeys; + } + public ObjectWithOnlyOptionalPropsMapBuilder() { + this.instance = new LinkedHashMap<>(); + } + public Map build() { + return instance; + } + public Map getInstance() { + return instance; + } + public ObjectWithOnlyOptionalPropsMapBuilder getBuilderAfterA(Map instance) { + return this; + } + public ObjectWithOnlyOptionalPropsMapBuilder getBuilderAfterB(Map instance) { + return this; + } + public ObjectWithOnlyOptionalPropsMapBuilder getBuilderAfterArrayProperty(Map instance) { + return this; + } + } + + + public sealed interface ObjectWithOnlyOptionalProps1Boxed permits ObjectWithOnlyOptionalProps1BoxedMap { + @Nullable Object getData(); + } + + public record ObjectWithOnlyOptionalProps1BoxedMap(ObjectWithOnlyOptionalPropsMap data) implements ObjectWithOnlyOptionalProps1Boxed { + @Override + public @Nullable Object getData() { + return data; + } + } + + + public static class ObjectWithOnlyOptionalProps1 extends JsonSchema implements MapSchemaValidator { + /* + NOTE: This class is auto generated by OpenAPI JSON Schema Generator. + Ref: https://github.com/openapi-json-schema-tools/openapi-json-schema-generator + + Do not edit the class manually. + */ + private static @Nullable ObjectWithOnlyOptionalProps1 instance = null; + + protected ObjectWithOnlyOptionalProps1() { + super(new JsonSchemaInfo() + .type(Set.of(Map.class)) + .properties(Map.ofEntries( + new PropertyEntry("a", A.class), + new PropertyEntry("b", B.class), + new PropertyEntry("ArrayProperty", ArrayProperty.class) + )) + .additionalProperties(AdditionalProperties.class) + ); + } + + public static ObjectWithOnlyOptionalProps1 getInstance() { + if (instance == null) { + instance = new ObjectWithOnlyOptionalProps1(); + } + return instance; + } + + 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 RuntimeException("Invalid non-string key value"); + } + String propertyName = (String) entryKey; + List propertyPathToItem = new ArrayList<>(pathToItem); + propertyPathToItem.add(propertyName); + Object value = entry.getValue(); + LinkedHashMap, Nothing?> schemas = pathToSchemas.get(propertyPathToItem); + if (schemas == null) { + throw new RuntimeException("Validation result is invalid, schemas must exist for a pathToItem"); + } + JsonSchema propertySchema = schemas.entrySet().iterator().next().getKey(); + @Nullable Object propertyInstance = propertySchema.getNewInstance(value, propertyPathToItem, pathToSchemas); + properties.put(propertyName, propertyInstance); + } + FrozenMap<@Nullable Object> castProperties = new FrozenMap<>(properties); + return new ObjectWithOnlyOptionalPropsMap(castProperties); + } + + 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); + SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().build())); + ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, new PathToSchemasMap(), new LinkedHashSet<>()); + PathToSchemasMap pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet); + return getNewInstance(castArg, validationMetadata.pathToItem(), pathToSchemasMap); + } + + + @Override + public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws 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"); + } + @Override + public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { + if (arg instanceof Map) { + return getNewInstance((Map) arg, pathToItem, pathToSchemas); + } + 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 { + return new ObjectWithOnlyOptionalProps1BoxedMap(validate(arg, configuration)); + } + @Override + public ObjectWithOnlyOptionalProps1Boxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { + 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"); + } + } + +} diff --git a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/schemas/ObjectWithOptionalTestProp.kt b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/schemas/ObjectWithOptionalTestProp.kt new file mode 100644 index 00000000000..476f41ddbad --- /dev/null +++ b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/schemas/ObjectWithOptionalTestProp.kt @@ -0,0 +1,206 @@ +package org.openapijsonschematools.client.components.schemas; +import java.util.ArrayList; +import java.util.HashSet; +import java.util.LinkedHashMap; +import java.util.LinkedHashSet; +import java.util.List; +import java.util.Map; +import java.util.Objects; +import java.util.Set; +import org.checkerframework.checker.nullness.qual.Nullable; +import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags; +import org.openapijsonschematools.client.configurations.SchemaConfiguration; +import org.openapijsonschematools.client.exceptions.InvalidAdditionalPropertyException; +import org.openapijsonschematools.client.exceptions.UnsetPropertyException; +import org.openapijsonschematools.client.exceptions.ValidationException; +import org.openapijsonschematools.client.schemas.GenericBuilder; +import org.openapijsonschematools.client.schemas.StringJsonSchema; +import org.openapijsonschematools.client.schemas.UnsetAddPropsSetter; +import org.openapijsonschematools.client.schemas.validation.FrozenMap; +import org.openapijsonschematools.client.schemas.validation.JsonSchema; +import org.openapijsonschematools.client.schemas.validation.JsonSchemaInfo; +import org.openapijsonschematools.client.schemas.validation.MapSchemaValidator; +import org.openapijsonschematools.client.schemas.validation.PathToSchemasMap; +import org.openapijsonschematools.client.schemas.validation.PropertyEntry; +import org.openapijsonschematools.client.schemas.validation.ValidationMetadata; + +public class ObjectWithOptionalTestProp { + // nest classes so all schemas and input/output classes can be public + + + public static class Test extends StringJsonSchema.StringJsonSchema1 { + private static @Nullable Test instance = null; + public static Test getInstance() { + if (instance == null) { + instance = new Test(); + } + return instance; + } + } + + + public static class ObjectWithOptionalTestPropMap extends FrozenMap<@Nullable Object> { + protected ObjectWithOptionalTestPropMap(FrozenMap<@Nullable Object> m) { + super(m); + } + public static final Set requiredKeys = Set.of(); + public static final Set optionalKeys = Set.of( + "test" + ); + public static ObjectWithOptionalTestPropMap of(Map arg, SchemaConfiguration configuration) throws ValidationException { + return ObjectWithOptionalTestProp1.getInstance().validate(arg, configuration); + } + + public String test() throws UnsetPropertyException { + String key = "test"; + throwIfKeyNotPresent(key); + @Nullable Object value = get(key); + if (!(value instanceof String)) { + throw new RuntimeException("Invalid value stored for test"); + } + return (String) value; + } + + public @Nullable Object getAdditionalProperty(String name) throws UnsetPropertyException, InvalidAdditionalPropertyException { + throwIfKeyKnown(name, requiredKeys, optionalKeys); + throwIfKeyNotPresent(name); + return get(name); + } + } + + public interface SetterForTest { + Map getInstance(); + T getBuilderAfterTest(Map instance); + + default T test(String value) { + var instance = getInstance(); + instance.put("test", value); + return getBuilderAfterTest(instance); + } + } + + public static class ObjectWithOptionalTestPropMapBuilder extends UnsetAddPropsSetter implements GenericBuilder>, SetterForTest { + private final Map instance; + private static final Set knownKeys = Set.of( + "test" + ); + public Set getKnownKeys() { + return knownKeys; + } + public ObjectWithOptionalTestPropMapBuilder() { + this.instance = new LinkedHashMap<>(); + } + public Map build() { + return instance; + } + public Map getInstance() { + return instance; + } + public ObjectWithOptionalTestPropMapBuilder getBuilderAfterTest(Map instance) { + return this; + } + public ObjectWithOptionalTestPropMapBuilder getBuilderAfterAdditionalProperty(Map instance) { + return this; + } + } + + + public sealed interface ObjectWithOptionalTestProp1Boxed permits ObjectWithOptionalTestProp1BoxedMap { + @Nullable Object getData(); + } + + public record ObjectWithOptionalTestProp1BoxedMap(ObjectWithOptionalTestPropMap data) implements ObjectWithOptionalTestProp1Boxed { + @Override + public @Nullable Object getData() { + return data; + } + } + + + public static class ObjectWithOptionalTestProp1 extends JsonSchema implements MapSchemaValidator { + /* + NOTE: This class is auto generated by OpenAPI JSON Schema Generator. + Ref: https://github.com/openapi-json-schema-tools/openapi-json-schema-generator + + Do not edit the class manually. + */ + private static @Nullable ObjectWithOptionalTestProp1 instance = null; + + protected ObjectWithOptionalTestProp1() { + super(new JsonSchemaInfo() + .type(Set.of(Map.class)) + .properties(Map.ofEntries( + new PropertyEntry("test", Test.class) + )) + ); + } + + public static ObjectWithOptionalTestProp1 getInstance() { + if (instance == null) { + instance = new ObjectWithOptionalTestProp1(); + } + return instance; + } + + 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 RuntimeException("Invalid non-string key value"); + } + String propertyName = (String) entryKey; + List propertyPathToItem = new ArrayList<>(pathToItem); + propertyPathToItem.add(propertyName); + Object value = entry.getValue(); + LinkedHashMap, Nothing?> schemas = pathToSchemas.get(propertyPathToItem); + if (schemas == null) { + throw new RuntimeException("Validation result is invalid, schemas must exist for a pathToItem"); + } + JsonSchema propertySchema = schemas.entrySet().iterator().next().getKey(); + @Nullable Object propertyInstance = propertySchema.getNewInstance(value, propertyPathToItem, pathToSchemas); + properties.put(propertyName, propertyInstance); + } + FrozenMap<@Nullable Object> castProperties = new FrozenMap<>(properties); + return new ObjectWithOptionalTestPropMap(castProperties); + } + + 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); + SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().build())); + ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, new PathToSchemasMap(), new LinkedHashSet<>()); + PathToSchemasMap pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet); + return getNewInstance(castArg, validationMetadata.pathToItem(), pathToSchemasMap); + } + + + @Override + public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws 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"); + } + @Override + public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { + if (arg instanceof Map) { + return getNewInstance((Map) arg, pathToItem, pathToSchemas); + } + 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 { + return new ObjectWithOptionalTestProp1BoxedMap(validate(arg, configuration)); + } + @Override + public ObjectWithOptionalTestProp1Boxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { + 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"); + } + } + +} diff --git a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/schemas/ObjectWithValidations.kt b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/schemas/ObjectWithValidations.kt new file mode 100644 index 00000000000..f1ca89d5902 --- /dev/null +++ b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/schemas/ObjectWithValidations.kt @@ -0,0 +1,124 @@ +package org.openapijsonschematools.client.components.schemas; +import java.util.ArrayList; +import java.util.HashSet; +import java.util.LinkedHashMap; +import java.util.LinkedHashSet; +import java.util.List; +import java.util.Map; +import java.util.Objects; +import java.util.Set; +import org.checkerframework.checker.nullness.qual.Nullable; +import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags; +import org.openapijsonschematools.client.configurations.SchemaConfiguration; +import org.openapijsonschematools.client.exceptions.InvalidAdditionalPropertyException; +import org.openapijsonschematools.client.exceptions.UnsetPropertyException; +import org.openapijsonschematools.client.exceptions.ValidationException; +import org.openapijsonschematools.client.schemas.UnsetAddPropsSetter; +import org.openapijsonschematools.client.schemas.validation.FrozenMap; +import org.openapijsonschematools.client.schemas.validation.JsonSchema; +import org.openapijsonschematools.client.schemas.validation.JsonSchemaInfo; +import org.openapijsonschematools.client.schemas.validation.MapSchemaValidator; +import org.openapijsonschematools.client.schemas.validation.PathToSchemasMap; +import org.openapijsonschematools.client.schemas.validation.ValidationMetadata; + +public class ObjectWithValidations { + // nest classes so all schemas and input/output classes can be public + + + public sealed interface ObjectWithValidations1Boxed permits ObjectWithValidations1BoxedMap { + @Nullable Object getData(); + } + + public record ObjectWithValidations1BoxedMap(FrozenMap<@Nullable Object> data) implements ObjectWithValidations1Boxed { + @Override + public @Nullable Object getData() { + return data; + } + } + + + public static class ObjectWithValidations1 extends JsonSchema implements MapSchemaValidator, ObjectWithValidations1BoxedMap> { + /* + NOTE: This class is auto generated by OpenAPI JSON Schema Generator. + Ref: https://github.com/openapi-json-schema-tools/openapi-json-schema-generator + + Do not edit the class manually. + */ + private static @Nullable ObjectWithValidations1 instance = null; + + protected ObjectWithValidations1() { + super(new JsonSchemaInfo() + .type(Set.of(Map.class)) + .minProperties(2) + ); + } + + public static ObjectWithValidations1 getInstance() { + if (instance == null) { + instance = new ObjectWithValidations1(); + } + return instance; + } + + 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 RuntimeException("Invalid non-string key value"); + } + String propertyName = (String) entryKey; + List propertyPathToItem = new ArrayList<>(pathToItem); + propertyPathToItem.add(propertyName); + Object value = entry.getValue(); + LinkedHashMap, Nothing?> schemas = pathToSchemas.get(propertyPathToItem); + if (schemas == null) { + throw new RuntimeException("Validation result is invalid, schemas must exist for a pathToItem"); + } + JsonSchema propertySchema = schemas.entrySet().iterator().next().getKey(); + @Nullable Object propertyInstance = propertySchema.getNewInstance(value, propertyPathToItem, pathToSchemas); + properties.put(propertyName, propertyInstance); + } + FrozenMap<@Nullable Object> castProperties = new FrozenMap<>(properties); + return castProperties; + } + + public FrozenMap<@Nullable Object> validate(Map arg, SchemaConfiguration configuration) throws ValidationException { + Set> pathSet = new HashSet<>(); + List pathToItem = List.of("args[0"); + Map castArg = castToAllowedTypes(arg, pathToItem, pathSet); + SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().build())); + ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, new PathToSchemasMap(), new LinkedHashSet<>()); + PathToSchemasMap pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet); + return getNewInstance(castArg, validationMetadata.pathToItem(), pathToSchemasMap); + } + + + @Override + public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws 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"); + } + @Override + public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { + if (arg instanceof Map) { + return getNewInstance((Map) arg, pathToItem, pathToSchemas); + } + 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 { + return new ObjectWithValidations1BoxedMap(validate(arg, configuration)); + } + @Override + public ObjectWithValidations1Boxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { + 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"); + } + } + +} diff --git a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/schemas/Order.kt b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/schemas/Order.kt new file mode 100644 index 00000000000..28039a3de48 --- /dev/null +++ b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/schemas/Order.kt @@ -0,0 +1,533 @@ +package org.openapijsonschematools.client.components.schemas; +import java.util.ArrayList; +import java.util.HashSet; +import java.util.LinkedHashMap; +import java.util.LinkedHashSet; +import java.util.List; +import java.util.Map; +import java.util.Objects; +import java.util.Set; +import org.checkerframework.checker.nullness.qual.Nullable; +import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags; +import org.openapijsonschematools.client.configurations.SchemaConfiguration; +import org.openapijsonschematools.client.exceptions.InvalidAdditionalPropertyException; +import org.openapijsonschematools.client.exceptions.UnsetPropertyException; +import org.openapijsonschematools.client.exceptions.ValidationException; +import org.openapijsonschematools.client.schemas.BooleanJsonSchema; +import org.openapijsonschematools.client.schemas.DateTimeJsonSchema; +import org.openapijsonschematools.client.schemas.GenericBuilder; +import org.openapijsonschematools.client.schemas.Int32JsonSchema; +import org.openapijsonschematools.client.schemas.Int64JsonSchema; +import org.openapijsonschematools.client.schemas.SetMaker; +import org.openapijsonschematools.client.schemas.UnsetAddPropsSetter; +import org.openapijsonschematools.client.schemas.validation.FrozenMap; +import org.openapijsonschematools.client.schemas.validation.JsonSchema; +import org.openapijsonschematools.client.schemas.validation.JsonSchemaInfo; +import org.openapijsonschematools.client.schemas.validation.MapSchemaValidator; +import org.openapijsonschematools.client.schemas.validation.PathToSchemasMap; +import org.openapijsonschematools.client.schemas.validation.PropertyEntry; +import org.openapijsonschematools.client.schemas.validation.StringEnumValidator; +import org.openapijsonschematools.client.schemas.validation.StringSchemaValidator; +import org.openapijsonschematools.client.schemas.validation.StringValueMethod; +import org.openapijsonschematools.client.schemas.validation.ValidationMetadata; + +public class Order { + // nest classes so all schemas and input/output classes can be public + + + public static class Id extends Int64JsonSchema.Int64JsonSchema1 { + private static @Nullable Id instance = null; + public static Id getInstance() { + if (instance == null) { + instance = new Id(); + } + return instance; + } + } + + + public static class PetId extends Int64JsonSchema.Int64JsonSchema1 { + private static @Nullable PetId instance = null; + public static PetId getInstance() { + if (instance == null) { + instance = new PetId(); + } + return instance; + } + } + + + public static class Quantity extends Int32JsonSchema.Int32JsonSchema1 { + private static @Nullable Quantity instance = null; + public static Quantity getInstance() { + if (instance == null) { + instance = new Quantity(); + } + return instance; + } + } + + + public static class ShipDate extends DateTimeJsonSchema.DateTimeJsonSchema1 { + private static @Nullable ShipDate instance = null; + public static ShipDate getInstance() { + if (instance == null) { + instance = new ShipDate(); + } + return instance; + } + } + + public enum StringStatusEnums implements StringValueMethod { + PLACED("placed"), + APPROVED("approved"), + DELIVERED("delivered"); + private final String value; + + StringStatusEnums(String value) { + this.value = value; + } + public String value() { + return this.value; + } + } + + + public sealed interface StatusBoxed permits StatusBoxedString { + @Nullable Object getData(); + } + + public record StatusBoxedString(String data) implements StatusBoxed { + @Override + public @Nullable Object getData() { + return data; + } + } + + + + public static class Status extends JsonSchema implements StringSchemaValidator, StringEnumValidator { + private static @Nullable Status instance = null; + + protected Status() { + super(new JsonSchemaInfo() + .type(Set.of( + String.class + )) + .enumValues(SetMaker.makeSet( + "placed", + "approved", + "delivered" + )) + ); + } + + public static Status getInstance() { + if (instance == null) { + instance = new Status(); + } + return instance; + } + + @Override + public String validate(String arg, SchemaConfiguration configuration) throws ValidationException { + Set> pathSet = new HashSet<>(); + List pathToItem = List.of("args[0"); + String castArg = castToAllowedTypes(arg, pathToItem, pathSet); + SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().build())); + ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, new PathToSchemasMap(), new LinkedHashSet<>()); + getPathToSchemas(this, castArg, validationMetadata, pathSet); + return castArg; + } + + @Override + 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 { + 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"); + } + @Override + public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { + 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"); + } + @Override + 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 { + 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"); + } + } + + public static class Complete extends BooleanJsonSchema.BooleanJsonSchema1 { + private static @Nullable Complete instance = null; + public static Complete getInstance() { + if (instance == null) { + instance = new Complete(); + } + return instance; + } + } + + + public static class OrderMap extends FrozenMap<@Nullable Object> { + protected OrderMap(FrozenMap<@Nullable Object> m) { + super(m); + } + public static final Set requiredKeys = Set.of(); + public static final Set optionalKeys = Set.of( + "id", + "petId", + "quantity", + "shipDate", + "status", + "complete" + ); + public static OrderMap of(Map arg, SchemaConfiguration configuration) throws ValidationException { + return Order1.getInstance().validate(arg, configuration); + } + + public Number id() throws UnsetPropertyException { + String key = "id"; + throwIfKeyNotPresent(key); + @Nullable Object value = get(key); + if (!(value instanceof Number)) { + throw new RuntimeException("Invalid value stored for id"); + } + return (Number) value; + } + + public Number petId() throws UnsetPropertyException { + String key = "petId"; + throwIfKeyNotPresent(key); + @Nullable Object value = get(key); + if (!(value instanceof Number)) { + throw new RuntimeException("Invalid value stored for petId"); + } + return (Number) value; + } + + public Number quantity() throws UnsetPropertyException { + String key = "quantity"; + throwIfKeyNotPresent(key); + @Nullable Object value = get(key); + if (!(value instanceof Number)) { + throw new RuntimeException("Invalid value stored for quantity"); + } + return (Number) value; + } + + public String shipDate() throws UnsetPropertyException { + String key = "shipDate"; + throwIfKeyNotPresent(key); + @Nullable Object value = get(key); + if (!(value instanceof String)) { + throw new RuntimeException("Invalid value stored for shipDate"); + } + return (String) value; + } + + public String status() throws UnsetPropertyException { + String key = "status"; + throwIfKeyNotPresent(key); + @Nullable Object value = get(key); + if (!(value instanceof String)) { + throw new RuntimeException("Invalid value stored for status"); + } + return (String) value; + } + + public boolean complete() throws UnsetPropertyException { + String key = "complete"; + throwIfKeyNotPresent(key); + @Nullable Object value = get(key); + if (!(value instanceof Boolean)) { + throw new RuntimeException("Invalid value stored for complete"); + } + return (boolean) value; + } + + public @Nullable Object getAdditionalProperty(String name) throws UnsetPropertyException, InvalidAdditionalPropertyException { + throwIfKeyKnown(name, requiredKeys, optionalKeys); + throwIfKeyNotPresent(name); + return get(name); + } + } + + public interface SetterForId { + Map getInstance(); + T getBuilderAfterId(Map instance); + + default T id(int value) { + var instance = getInstance(); + instance.put("id", value); + return getBuilderAfterId(instance); + } + + default T id(float value) { + var instance = getInstance(); + instance.put("id", value); + return getBuilderAfterId(instance); + } + + default T id(long value) { + var instance = getInstance(); + instance.put("id", value); + return getBuilderAfterId(instance); + } + + default T id(double value) { + var instance = getInstance(); + instance.put("id", value); + return getBuilderAfterId(instance); + } + } + + public interface SetterForPetId { + Map getInstance(); + T getBuilderAfterPetId(Map instance); + + default T petId(int value) { + var instance = getInstance(); + instance.put("petId", value); + return getBuilderAfterPetId(instance); + } + + default T petId(float value) { + var instance = getInstance(); + instance.put("petId", value); + return getBuilderAfterPetId(instance); + } + + default T petId(long value) { + var instance = getInstance(); + instance.put("petId", value); + return getBuilderAfterPetId(instance); + } + + default T petId(double value) { + var instance = getInstance(); + instance.put("petId", value); + return getBuilderAfterPetId(instance); + } + } + + public interface SetterForQuantity { + Map getInstance(); + T getBuilderAfterQuantity(Map instance); + + default T quantity(int value) { + var instance = getInstance(); + instance.put("quantity", value); + return getBuilderAfterQuantity(instance); + } + + default T quantity(float value) { + var instance = getInstance(); + instance.put("quantity", value); + return getBuilderAfterQuantity(instance); + } + } + + public interface SetterForShipDate { + Map getInstance(); + T getBuilderAfterShipDate(Map instance); + + default T shipDate(String value) { + var instance = getInstance(); + instance.put("shipDate", value); + return getBuilderAfterShipDate(instance); + } + } + + public interface SetterForStatus { + Map getInstance(); + T getBuilderAfterStatus(Map instance); + + default T status(String value) { + var instance = getInstance(); + instance.put("status", value); + return getBuilderAfterStatus(instance); + } + + default T status(StringStatusEnums value) { + var instance = getInstance(); + instance.put("status", value.value()); + return getBuilderAfterStatus(instance); + } + } + + public interface SetterForComplete { + Map getInstance(); + T getBuilderAfterComplete(Map instance); + + default T complete(boolean value) { + var instance = getInstance(); + instance.put("complete", value); + return getBuilderAfterComplete(instance); + } + } + + public static class OrderMapBuilder extends UnsetAddPropsSetter implements GenericBuilder>, SetterForId, SetterForPetId, SetterForQuantity, SetterForShipDate, SetterForStatus, SetterForComplete { + private final Map instance; + private static final Set knownKeys = Set.of( + "id", + "petId", + "quantity", + "shipDate", + "status", + "complete" + ); + public Set getKnownKeys() { + return knownKeys; + } + public OrderMapBuilder() { + this.instance = new LinkedHashMap<>(); + } + public Map build() { + return instance; + } + public Map getInstance() { + return instance; + } + public OrderMapBuilder getBuilderAfterId(Map instance) { + return this; + } + public OrderMapBuilder getBuilderAfterPetId(Map instance) { + return this; + } + public OrderMapBuilder getBuilderAfterQuantity(Map instance) { + return this; + } + public OrderMapBuilder getBuilderAfterShipDate(Map instance) { + return this; + } + public OrderMapBuilder getBuilderAfterStatus(Map instance) { + return this; + } + public OrderMapBuilder getBuilderAfterComplete(Map instance) { + return this; + } + public OrderMapBuilder getBuilderAfterAdditionalProperty(Map instance) { + return this; + } + } + + + public sealed interface Order1Boxed permits Order1BoxedMap { + @Nullable Object getData(); + } + + public record Order1BoxedMap(OrderMap data) implements Order1Boxed { + @Override + public @Nullable Object getData() { + return data; + } + } + + + public static class Order1 extends JsonSchema implements MapSchemaValidator { + /* + NOTE: This class is auto generated by OpenAPI JSON Schema Generator. + Ref: https://github.com/openapi-json-schema-tools/openapi-json-schema-generator + + Do not edit the class manually. + */ + private static @Nullable Order1 instance = null; + + protected Order1() { + super(new JsonSchemaInfo() + .type(Set.of(Map.class)) + .properties(Map.ofEntries( + new PropertyEntry("id", Id.class), + new PropertyEntry("petId", PetId.class), + new PropertyEntry("quantity", Quantity.class), + new PropertyEntry("shipDate", ShipDate.class), + new PropertyEntry("status", Status.class), + new PropertyEntry("complete", Complete.class) + )) + ); + } + + public static Order1 getInstance() { + if (instance == null) { + instance = new Order1(); + } + return instance; + } + + 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 RuntimeException("Invalid non-string key value"); + } + String propertyName = (String) entryKey; + List propertyPathToItem = new ArrayList<>(pathToItem); + propertyPathToItem.add(propertyName); + Object value = entry.getValue(); + LinkedHashMap, Nothing?> schemas = pathToSchemas.get(propertyPathToItem); + if (schemas == null) { + throw new RuntimeException("Validation result is invalid, schemas must exist for a pathToItem"); + } + JsonSchema propertySchema = schemas.entrySet().iterator().next().getKey(); + @Nullable Object propertyInstance = propertySchema.getNewInstance(value, propertyPathToItem, pathToSchemas); + properties.put(propertyName, propertyInstance); + } + FrozenMap<@Nullable Object> castProperties = new FrozenMap<>(properties); + return new OrderMap(castProperties); + } + + 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); + SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().build())); + ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, new PathToSchemasMap(), new LinkedHashSet<>()); + PathToSchemasMap pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet); + return getNewInstance(castArg, validationMetadata.pathToItem(), pathToSchemasMap); + } + + + @Override + public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws 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"); + } + @Override + public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { + if (arg instanceof Map) { + return getNewInstance((Map) arg, pathToItem, pathToSchemas); + } + 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 { + return new Order1BoxedMap(validate(arg, configuration)); + } + @Override + public Order1Boxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { + 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"); + } + } + +} diff --git a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/schemas/PaginatedResultMyObjectDto.kt b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/schemas/PaginatedResultMyObjectDto.kt new file mode 100644 index 00000000000..b27b4338252 --- /dev/null +++ b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/schemas/PaginatedResultMyObjectDto.kt @@ -0,0 +1,416 @@ +package org.openapijsonschematools.client.components.schemas; +import java.util.ArrayList; +import java.util.HashSet; +import java.util.LinkedHashMap; +import java.util.LinkedHashSet; +import java.util.List; +import java.util.Map; +import java.util.Objects; +import java.util.Set; +import org.checkerframework.checker.nullness.qual.Nullable; +import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags; +import org.openapijsonschematools.client.configurations.SchemaConfiguration; +import org.openapijsonschematools.client.exceptions.UnsetPropertyException; +import org.openapijsonschematools.client.exceptions.ValidationException; +import org.openapijsonschematools.client.schemas.AnyTypeJsonSchema; +import org.openapijsonschematools.client.schemas.GenericBuilder; +import org.openapijsonschematools.client.schemas.IntJsonSchema; +import org.openapijsonschematools.client.schemas.NotAnyTypeJsonSchema; +import org.openapijsonschematools.client.schemas.validation.FrozenList; +import org.openapijsonschematools.client.schemas.validation.FrozenMap; +import org.openapijsonschematools.client.schemas.validation.JsonSchema; +import org.openapijsonschematools.client.schemas.validation.JsonSchemaInfo; +import org.openapijsonschematools.client.schemas.validation.ListSchemaValidator; +import org.openapijsonschematools.client.schemas.validation.MapSchemaValidator; +import org.openapijsonschematools.client.schemas.validation.MapUtils; +import org.openapijsonschematools.client.schemas.validation.PathToSchemasMap; +import org.openapijsonschematools.client.schemas.validation.PropertyEntry; +import org.openapijsonschematools.client.schemas.validation.ValidationMetadata; + +public class PaginatedResultMyObjectDto { + // nest classes so all schemas and input/output classes can be public + + + public static class AdditionalProperties extends NotAnyTypeJsonSchema.NotAnyTypeJsonSchema1 { + // NotAnyTypeSchema + private static @Nullable AdditionalProperties instance = null; + public static AdditionalProperties getInstance() { + if (instance == null) { + instance = new AdditionalProperties(); + } + return instance; + } + } + + + public static class Count extends IntJsonSchema.IntJsonSchema1 { + private static @Nullable Count instance = null; + public static Count getInstance() { + if (instance == null) { + instance = new Count(); + } + return instance; + } + } + + + public static class ResultsList extends FrozenList { + protected ResultsList(FrozenList m) { + super(m); + } + public static ResultsList of(List> arg, SchemaConfiguration configuration) throws ValidationException { + return Results.getInstance().validate(arg, configuration); + } + } + + public static class ResultsListBuilder { + // class to build List> + private final List> list; + + public ResultsListBuilder() { + list = new ArrayList<>(); + } + + public ResultsListBuilder(List> list) { + this.list = list; + } + + public ResultsListBuilder add(Map item) { + list.add(item); + return this; + } + + public List> build() { + return list; + } + } + + + public sealed interface ResultsBoxed permits ResultsBoxedList { + @Nullable Object getData(); + } + + public record ResultsBoxedList(ResultsList data) implements ResultsBoxed { + @Override + public @Nullable Object getData() { + return data; + } + } + + + + public static class Results extends JsonSchema implements ListSchemaValidator { + private static @Nullable Results instance = null; + + protected Results() { + super(new JsonSchemaInfo() + .type(Set.of(List.class)) + .items(MyObjectDto.MyObjectDto1.class) + ); + } + + public static Results getInstance() { + if (instance == null) { + instance = new Results(); + } + return instance; + } + + @Override + public ResultsList getNewInstance(List arg, List pathToItem, PathToSchemasMap pathToSchemas) { + List items = new ArrayList<>(); + int i = 0; + for (Object item: arg) { + List itemPathToItem = new ArrayList<>(pathToItem); + itemPathToItem.add(i); + LinkedHashMap, Nothing?> schemas = pathToSchemas.get(itemPathToItem); + if (schemas == null) { + throw new RuntimeException("Validation 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"); + } + items.add((MyObjectDto.MyObjectDtoMap) itemInstance); + i += 1; + } + FrozenList newInstanceItems = new FrozenList<>(items); + return new ResultsList(newInstanceItems); + } + + 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); + SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().build())); + ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, new PathToSchemasMap(), new LinkedHashSet<>()); + PathToSchemasMap pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet); + return getNewInstance(castArg, validationMetadata.pathToItem(), pathToSchemasMap); + } + + @Override + public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws 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"); + } + @Override + public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { + 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"); + } + @Override + 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 { + 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"); + } + } + + public static class PaginatedResultMyObjectDtoMap extends FrozenMap { + protected PaginatedResultMyObjectDtoMap(FrozenMap m) { + super(m); + } + public static final Set requiredKeys = Set.of( + "count", + "results" + ); + public static final Set optionalKeys = Set.of(); + public static PaginatedResultMyObjectDtoMap of(Map arg, SchemaConfiguration configuration) throws ValidationException { + return PaginatedResultMyObjectDto1.getInstance().validate(arg, configuration); + } + + public Number count() { + Object value = get("count"); + if (!(value instanceof Number)) { + throw new RuntimeException("Invalid value stored for count"); + } + return (Number) value; + } + + public ResultsList results() { + Object value = get("results"); + if (!(value instanceof ResultsList)) { + throw new RuntimeException("Invalid value stored for results"); + } + return (ResultsList) value; + } + } + + public interface SetterForCount { + Map getInstance(); + T getBuilderAfterCount(Map instance); + + default T count(int value) { + var instance = getInstance(); + instance.put("count", value); + return getBuilderAfterCount(instance); + } + + default T count(float value) { + var instance = getInstance(); + instance.put("count", value); + return getBuilderAfterCount(instance); + } + + default T count(long value) { + var instance = getInstance(); + instance.put("count", value); + return getBuilderAfterCount(instance); + } + + default T count(double value) { + var instance = getInstance(); + instance.put("count", value); + return getBuilderAfterCount(instance); + } + } + + public interface SetterForResults { + Map getInstance(); + T getBuilderAfterResults(Map instance); + + default T results(List> value) { + var instance = getInstance(); + instance.put("results", value); + return getBuilderAfterResults(instance); + } + } + + public static class PaginatedResultMyObjectDtoMap00Builder implements GenericBuilder> { + private final Map instance; + private static final Set knownKeys = Set.of( + "count", + "results" + ); + public Set getKnownKeys() { + return knownKeys; + } + public PaginatedResultMyObjectDtoMap00Builder(Map instance) { + this.instance = instance; + } + public Map build() { + return instance; + } + } + + public static class PaginatedResultMyObjectDtoMap01Builder implements SetterForResults { + private final Map instance; + public PaginatedResultMyObjectDtoMap01Builder(Map instance) { + this.instance = instance; + } + public Map getInstance() { + return instance; + } + public PaginatedResultMyObjectDtoMap00Builder getBuilderAfterResults(Map instance) { + return new PaginatedResultMyObjectDtoMap00Builder(instance); + } + } + + public static class PaginatedResultMyObjectDtoMap10Builder implements SetterForCount { + private final Map instance; + public PaginatedResultMyObjectDtoMap10Builder(Map instance) { + this.instance = instance; + } + public Map getInstance() { + return instance; + } + public PaginatedResultMyObjectDtoMap00Builder getBuilderAfterCount(Map instance) { + return new PaginatedResultMyObjectDtoMap00Builder(instance); + } + } + + public static class PaginatedResultMyObjectDtoMapBuilder implements SetterForCount, SetterForResults { + private final Map instance; + public PaginatedResultMyObjectDtoMapBuilder() { + this.instance = new LinkedHashMap<>(); + } + public Map getInstance() { + return instance; + } + public PaginatedResultMyObjectDtoMap01Builder getBuilderAfterCount(Map instance) { + return new PaginatedResultMyObjectDtoMap01Builder(instance); + } + public PaginatedResultMyObjectDtoMap10Builder getBuilderAfterResults(Map instance) { + return new PaginatedResultMyObjectDtoMap10Builder(instance); + } + } + + + public sealed interface PaginatedResultMyObjectDto1Boxed permits PaginatedResultMyObjectDto1BoxedMap { + @Nullable Object getData(); + } + + public record PaginatedResultMyObjectDto1BoxedMap(PaginatedResultMyObjectDtoMap data) implements PaginatedResultMyObjectDto1Boxed { + @Override + public @Nullable Object getData() { + return data; + } + } + + + public static class PaginatedResultMyObjectDto1 extends JsonSchema implements MapSchemaValidator { + /* + NOTE: This class is auto generated by OpenAPI JSON Schema Generator. + Ref: https://github.com/openapi-json-schema-tools/openapi-json-schema-generator + + Do not edit the class manually. + */ + private static @Nullable PaginatedResultMyObjectDto1 instance = null; + + protected PaginatedResultMyObjectDto1() { + super(new JsonSchemaInfo() + .type(Set.of(Map.class)) + .properties(Map.ofEntries( + new PropertyEntry("count", Count.class), + new PropertyEntry("results", Results.class) + )) + .required(Set.of( + "count", + "results" + )) + .additionalProperties(AdditionalProperties.class) + ); + } + + public static PaginatedResultMyObjectDto1 getInstance() { + if (instance == null) { + instance = new PaginatedResultMyObjectDto1(); + } + return instance; + } + + 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 RuntimeException("Invalid non-string key value"); + } + String propertyName = (String) entryKey; + List propertyPathToItem = new ArrayList<>(pathToItem); + propertyPathToItem.add(propertyName); + Object value = entry.getValue(); + LinkedHashMap, Nothing?> schemas = pathToSchemas.get(propertyPathToItem); + if (schemas == null) { + throw new RuntimeException("Validation 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"); + } + properties.put(propertyName, (Object) propertyInstance); + } + FrozenMap castProperties = new FrozenMap<>(properties); + return new PaginatedResultMyObjectDtoMap(castProperties); + } + + 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); + SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().build())); + ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, new PathToSchemasMap(), new LinkedHashSet<>()); + PathToSchemasMap pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet); + return getNewInstance(castArg, validationMetadata.pathToItem(), pathToSchemasMap); + } + + + @Override + public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws 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"); + } + @Override + public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { + if (arg instanceof Map) { + return getNewInstance((Map) arg, pathToItem, pathToSchemas); + } + 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 { + return new PaginatedResultMyObjectDto1BoxedMap(validate(arg, configuration)); + } + @Override + public PaginatedResultMyObjectDto1Boxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { + 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"); + } + } + +} diff --git a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/schemas/ParentPet.kt b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/schemas/ParentPet.kt new file mode 100644 index 00000000000..54e907bd68f --- /dev/null +++ b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/schemas/ParentPet.kt @@ -0,0 +1,126 @@ +package org.openapijsonschematools.client.components.schemas; +import java.util.ArrayList; +import java.util.HashSet; +import java.util.LinkedHashMap; +import java.util.LinkedHashSet; +import java.util.List; +import java.util.Map; +import java.util.Objects; +import java.util.Set; +import org.checkerframework.checker.nullness.qual.Nullable; +import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags; +import org.openapijsonschematools.client.configurations.SchemaConfiguration; +import org.openapijsonschematools.client.exceptions.InvalidAdditionalPropertyException; +import org.openapijsonschematools.client.exceptions.UnsetPropertyException; +import org.openapijsonschematools.client.exceptions.ValidationException; +import org.openapijsonschematools.client.schemas.UnsetAddPropsSetter; +import org.openapijsonschematools.client.schemas.validation.FrozenMap; +import org.openapijsonschematools.client.schemas.validation.JsonSchema; +import org.openapijsonschematools.client.schemas.validation.JsonSchemaInfo; +import org.openapijsonschematools.client.schemas.validation.MapSchemaValidator; +import org.openapijsonschematools.client.schemas.validation.PathToSchemasMap; +import org.openapijsonschematools.client.schemas.validation.ValidationMetadata; + +public class ParentPet { + // nest classes so all schemas and input/output classes can be public + + + public sealed interface ParentPet1Boxed permits ParentPet1BoxedMap { + @Nullable Object getData(); + } + + public record ParentPet1BoxedMap(FrozenMap<@Nullable Object> data) implements ParentPet1Boxed { + @Override + public @Nullable Object getData() { + return data; + } + } + + + public static class ParentPet1 extends JsonSchema implements MapSchemaValidator, ParentPet1BoxedMap> { + /* + NOTE: This class is auto generated by OpenAPI JSON Schema Generator. + Ref: https://github.com/openapi-json-schema-tools/openapi-json-schema-generator + + Do not edit the class manually. + */ + private static @Nullable ParentPet1 instance = null; + + protected ParentPet1() { + super(new JsonSchemaInfo() + .type(Set.of(Map.class)) + .allOf(List.of( + GrandparentAnimal.GrandparentAnimal1.class + )) + ); + } + + public static ParentPet1 getInstance() { + if (instance == null) { + instance = new ParentPet1(); + } + return instance; + } + + 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 RuntimeException("Invalid non-string key value"); + } + String propertyName = (String) entryKey; + List propertyPathToItem = new ArrayList<>(pathToItem); + propertyPathToItem.add(propertyName); + Object value = entry.getValue(); + LinkedHashMap, Nothing?> schemas = pathToSchemas.get(propertyPathToItem); + if (schemas == null) { + throw new RuntimeException("Validation result is invalid, schemas must exist for a pathToItem"); + } + JsonSchema propertySchema = schemas.entrySet().iterator().next().getKey(); + @Nullable Object propertyInstance = propertySchema.getNewInstance(value, propertyPathToItem, pathToSchemas); + properties.put(propertyName, propertyInstance); + } + FrozenMap<@Nullable Object> castProperties = new FrozenMap<>(properties); + return castProperties; + } + + public FrozenMap<@Nullable Object> validate(Map arg, SchemaConfiguration configuration) throws ValidationException { + Set> pathSet = new HashSet<>(); + List pathToItem = List.of("args[0"); + Map castArg = castToAllowedTypes(arg, pathToItem, pathSet); + SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().build())); + ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, new PathToSchemasMap(), new LinkedHashSet<>()); + PathToSchemasMap pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet); + return getNewInstance(castArg, validationMetadata.pathToItem(), pathToSchemasMap); + } + + + @Override + public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws 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"); + } + @Override + public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { + if (arg instanceof Map) { + return getNewInstance((Map) arg, pathToItem, pathToSchemas); + } + 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 { + return new ParentPet1BoxedMap(validate(arg, configuration)); + } + @Override + public ParentPet1Boxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { + 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"); + } + } + +} diff --git a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/schemas/Pet.kt b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/schemas/Pet.kt new file mode 100644 index 00000000000..14f0a7796b8 --- /dev/null +++ b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/schemas/Pet.kt @@ -0,0 +1,770 @@ +package org.openapijsonschematools.client.components.schemas; +import java.util.ArrayList; +import java.util.HashSet; +import java.util.LinkedHashMap; +import java.util.LinkedHashSet; +import java.util.List; +import java.util.Map; +import java.util.Objects; +import java.util.Set; +import org.checkerframework.checker.nullness.qual.Nullable; +import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags; +import org.openapijsonschematools.client.configurations.SchemaConfiguration; +import org.openapijsonschematools.client.exceptions.InvalidAdditionalPropertyException; +import org.openapijsonschematools.client.exceptions.UnsetPropertyException; +import org.openapijsonschematools.client.exceptions.ValidationException; +import org.openapijsonschematools.client.schemas.GenericBuilder; +import org.openapijsonschematools.client.schemas.Int64JsonSchema; +import org.openapijsonschematools.client.schemas.SetMaker; +import org.openapijsonschematools.client.schemas.StringJsonSchema; +import org.openapijsonschematools.client.schemas.UnsetAddPropsSetter; +import org.openapijsonschematools.client.schemas.validation.FrozenList; +import org.openapijsonschematools.client.schemas.validation.FrozenMap; +import org.openapijsonschematools.client.schemas.validation.JsonSchema; +import org.openapijsonschematools.client.schemas.validation.JsonSchemaInfo; +import org.openapijsonschematools.client.schemas.validation.ListSchemaValidator; +import org.openapijsonschematools.client.schemas.validation.MapSchemaValidator; +import org.openapijsonschematools.client.schemas.validation.PathToSchemasMap; +import org.openapijsonschematools.client.schemas.validation.PropertyEntry; +import org.openapijsonschematools.client.schemas.validation.StringEnumValidator; +import org.openapijsonschematools.client.schemas.validation.StringSchemaValidator; +import org.openapijsonschematools.client.schemas.validation.StringValueMethod; +import org.openapijsonschematools.client.schemas.validation.ValidationMetadata; + +public class Pet { + // nest classes so all schemas and input/output classes can be public + + + public static class Id extends Int64JsonSchema.Int64JsonSchema1 { + private static @Nullable Id instance = null; + public static Id getInstance() { + if (instance == null) { + instance = new Id(); + } + return instance; + } + } + + + public static class Name extends StringJsonSchema.StringJsonSchema1 { + private static @Nullable Name instance = null; + public static Name getInstance() { + if (instance == null) { + instance = new Name(); + } + return instance; + } + } + + + public static class Items extends StringJsonSchema.StringJsonSchema1 { + private static @Nullable Items instance = null; + public static Items getInstance() { + if (instance == null) { + instance = new Items(); + } + return instance; + } + } + + + public static class PhotoUrlsList extends FrozenList { + protected PhotoUrlsList(FrozenList m) { + super(m); + } + public static PhotoUrlsList of(List arg, SchemaConfiguration configuration) throws ValidationException { + return PhotoUrls.getInstance().validate(arg, configuration); + } + } + + public static class PhotoUrlsListBuilder { + // class to build List + private final List list; + + public PhotoUrlsListBuilder() { + list = new ArrayList<>(); + } + + public PhotoUrlsListBuilder(List list) { + this.list = list; + } + + public PhotoUrlsListBuilder add(String item) { + list.add(item); + return this; + } + + public List build() { + return list; + } + } + + + public sealed interface PhotoUrlsBoxed permits PhotoUrlsBoxedList { + @Nullable Object getData(); + } + + public record PhotoUrlsBoxedList(PhotoUrlsList data) implements PhotoUrlsBoxed { + @Override + public @Nullable Object getData() { + return data; + } + } + + + + public static class PhotoUrls extends JsonSchema implements ListSchemaValidator { + private static @Nullable PhotoUrls instance = null; + + protected PhotoUrls() { + super(new JsonSchemaInfo() + .type(Set.of(List.class)) + .items(Items.class) + ); + } + + public static PhotoUrls getInstance() { + if (instance == null) { + instance = new PhotoUrls(); + } + return instance; + } + + @Override + public PhotoUrlsList getNewInstance(List arg, List pathToItem, PathToSchemasMap pathToSchemas) { + List items = new ArrayList<>(); + int i = 0; + for (Object item: arg) { + List itemPathToItem = new ArrayList<>(pathToItem); + itemPathToItem.add(i); + LinkedHashMap, Nothing?> schemas = pathToSchemas.get(itemPathToItem); + if (schemas == null) { + throw new RuntimeException("Validation 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"); + } + items.add((String) itemInstance); + i += 1; + } + FrozenList newInstanceItems = new FrozenList<>(items); + return new PhotoUrlsList(newInstanceItems); + } + + 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); + SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().build())); + ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, new PathToSchemasMap(), new LinkedHashSet<>()); + PathToSchemasMap pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet); + return getNewInstance(castArg, validationMetadata.pathToItem(), pathToSchemasMap); + } + + @Override + public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws 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"); + } + @Override + public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { + 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"); + } + @Override + 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 { + 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"); + } + } + public enum StringStatusEnums implements StringValueMethod { + AVAILABLE("available"), + PENDING("pending"), + SOLD("sold"); + private final String value; + + StringStatusEnums(String value) { + this.value = value; + } + public String value() { + return this.value; + } + } + + + public sealed interface StatusBoxed permits StatusBoxedString { + @Nullable Object getData(); + } + + public record StatusBoxedString(String data) implements StatusBoxed { + @Override + public @Nullable Object getData() { + return data; + } + } + + + + public static class Status extends JsonSchema implements StringSchemaValidator, StringEnumValidator { + private static @Nullable Status instance = null; + + protected Status() { + super(new JsonSchemaInfo() + .type(Set.of( + String.class + )) + .enumValues(SetMaker.makeSet( + "available", + "pending", + "sold" + )) + ); + } + + public static Status getInstance() { + if (instance == null) { + instance = new Status(); + } + return instance; + } + + @Override + public String validate(String arg, SchemaConfiguration configuration) throws ValidationException { + Set> pathSet = new HashSet<>(); + List pathToItem = List.of("args[0"); + String castArg = castToAllowedTypes(arg, pathToItem, pathSet); + SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().build())); + ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, new PathToSchemasMap(), new LinkedHashSet<>()); + getPathToSchemas(this, castArg, validationMetadata, pathSet); + return castArg; + } + + @Override + 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 { + 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"); + } + @Override + public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { + 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"); + } + @Override + 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 { + 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"); + } + } + + public static class TagsList extends FrozenList { + protected TagsList(FrozenList m) { + super(m); + } + public static TagsList of(List> arg, SchemaConfiguration configuration) throws ValidationException { + return Tags.getInstance().validate(arg, configuration); + } + } + + public static class TagsListBuilder { + // class to build List> + private final List> list; + + public TagsListBuilder() { + list = new ArrayList<>(); + } + + public TagsListBuilder(List> list) { + this.list = list; + } + + public TagsListBuilder add(Map item) { + list.add(item); + return this; + } + + public List> build() { + return list; + } + } + + + public sealed interface TagsBoxed permits TagsBoxedList { + @Nullable Object getData(); + } + + public record TagsBoxedList(TagsList data) implements TagsBoxed { + @Override + public @Nullable Object getData() { + return data; + } + } + + + + public static class Tags extends JsonSchema implements ListSchemaValidator { + private static @Nullable Tags instance = null; + + protected Tags() { + super(new JsonSchemaInfo() + .type(Set.of(List.class)) + .items(Tag.Tag1.class) + ); + } + + public static Tags getInstance() { + if (instance == null) { + instance = new Tags(); + } + return instance; + } + + @Override + public TagsList getNewInstance(List arg, List pathToItem, PathToSchemasMap pathToSchemas) { + List items = new ArrayList<>(); + int i = 0; + for (Object item: arg) { + List itemPathToItem = new ArrayList<>(pathToItem); + itemPathToItem.add(i); + LinkedHashMap, Nothing?> schemas = pathToSchemas.get(itemPathToItem); + if (schemas == null) { + throw new RuntimeException("Validation 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"); + } + items.add((Tag.TagMap) itemInstance); + i += 1; + } + FrozenList newInstanceItems = new FrozenList<>(items); + return new TagsList(newInstanceItems); + } + + 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); + SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().build())); + ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, new PathToSchemasMap(), new LinkedHashSet<>()); + PathToSchemasMap pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet); + return getNewInstance(castArg, validationMetadata.pathToItem(), pathToSchemasMap); + } + + @Override + public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws 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"); + } + @Override + public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { + 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"); + } + @Override + 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 { + 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"); + } + } + + public static class PetMap extends FrozenMap<@Nullable Object> { + protected PetMap(FrozenMap<@Nullable Object> m) { + super(m); + } + public static final Set requiredKeys = Set.of( + "name", + "photoUrls" + ); + public static final Set optionalKeys = Set.of( + "id", + "category", + "tags", + "status" + ); + public static PetMap of(Map arg, SchemaConfiguration configuration) throws ValidationException { + return Pet1.getInstance().validate(arg, configuration); + } + + public String name() { + @Nullable Object value = get("name"); + if (!(value instanceof String)) { + throw new RuntimeException("Invalid value stored for name"); + } + return (String) value; + } + + public PhotoUrlsList photoUrls() { + @Nullable Object value = get("photoUrls"); + if (!(value instanceof PhotoUrlsList)) { + throw new RuntimeException("Invalid value stored for photoUrls"); + } + return (PhotoUrlsList) value; + } + + public Number id() throws UnsetPropertyException { + String key = "id"; + throwIfKeyNotPresent(key); + @Nullable Object value = get(key); + if (!(value instanceof Number)) { + throw new RuntimeException("Invalid value stored for id"); + } + return (Number) value; + } + + public Category.CategoryMap category() throws UnsetPropertyException { + String key = "category"; + throwIfKeyNotPresent(key); + @Nullable Object value = get(key); + if (!(value instanceof Category.CategoryMap)) { + throw new RuntimeException("Invalid value stored for category"); + } + return (Category.CategoryMap) value; + } + + public TagsList tags() throws UnsetPropertyException { + String key = "tags"; + throwIfKeyNotPresent(key); + @Nullable Object value = get(key); + if (!(value instanceof TagsList)) { + throw new RuntimeException("Invalid value stored for tags"); + } + return (TagsList) value; + } + + public String status() throws UnsetPropertyException { + String key = "status"; + throwIfKeyNotPresent(key); + @Nullable Object value = get(key); + if (!(value instanceof String)) { + throw new RuntimeException("Invalid value stored for status"); + } + return (String) value; + } + + public @Nullable Object getAdditionalProperty(String name) throws UnsetPropertyException, InvalidAdditionalPropertyException { + throwIfKeyKnown(name, requiredKeys, optionalKeys); + throwIfKeyNotPresent(name); + return get(name); + } + } + + public interface SetterForName { + Map getInstance(); + T getBuilderAfterName(Map instance); + + default T name(String value) { + var instance = getInstance(); + instance.put("name", value); + return getBuilderAfterName(instance); + } + } + + public interface SetterForPhotoUrls { + Map getInstance(); + T getBuilderAfterPhotoUrls(Map instance); + + default T photoUrls(List value) { + var instance = getInstance(); + instance.put("photoUrls", value); + return getBuilderAfterPhotoUrls(instance); + } + } + + public interface SetterForId { + Map getInstance(); + T getBuilderAfterId(Map instance); + + default T id(int value) { + var instance = getInstance(); + instance.put("id", value); + return getBuilderAfterId(instance); + } + + default T id(float value) { + var instance = getInstance(); + instance.put("id", value); + return getBuilderAfterId(instance); + } + + default T id(long value) { + var instance = getInstance(); + instance.put("id", value); + return getBuilderAfterId(instance); + } + + default T id(double value) { + var instance = getInstance(); + instance.put("id", value); + return getBuilderAfterId(instance); + } + } + + public interface SetterForCategory { + Map getInstance(); + T getBuilderAfterCategory(Map instance); + + default T category(Map value) { + var instance = getInstance(); + instance.put("category", value); + return getBuilderAfterCategory(instance); + } + } + + public interface SetterForTags { + Map getInstance(); + T getBuilderAfterTags(Map instance); + + default T tags(List> value) { + var instance = getInstance(); + instance.put("tags", value); + return getBuilderAfterTags(instance); + } + } + + public interface SetterForStatus { + Map getInstance(); + T getBuilderAfterStatus(Map instance); + + default T status(String value) { + var instance = getInstance(); + instance.put("status", value); + return getBuilderAfterStatus(instance); + } + + default T status(StringStatusEnums value) { + var instance = getInstance(); + instance.put("status", value.value()); + return getBuilderAfterStatus(instance); + } + } + + public static class PetMap00Builder extends UnsetAddPropsSetter implements GenericBuilder>, SetterForId, SetterForCategory, SetterForTags, SetterForStatus { + private final Map instance; + private static final Set knownKeys = Set.of( + "name", + "photoUrls", + "id", + "category", + "tags", + "status" + ); + public Set getKnownKeys() { + return knownKeys; + } + public PetMap00Builder(Map instance) { + this.instance = instance; + } + public Map build() { + return instance; + } + public Map getInstance() { + return instance; + } + public PetMap00Builder getBuilderAfterId(Map instance) { + return this; + } + public PetMap00Builder getBuilderAfterCategory(Map instance) { + return this; + } + public PetMap00Builder getBuilderAfterTags(Map instance) { + return this; + } + public PetMap00Builder getBuilderAfterStatus(Map instance) { + return this; + } + public PetMap00Builder getBuilderAfterAdditionalProperty(Map instance) { + return this; + } + } + + public static class PetMap01Builder implements SetterForPhotoUrls { + private final Map instance; + public PetMap01Builder(Map instance) { + this.instance = instance; + } + public Map getInstance() { + return instance; + } + public PetMap00Builder getBuilderAfterPhotoUrls(Map instance) { + return new PetMap00Builder(instance); + } + } + + public static class PetMap10Builder implements SetterForName { + private final Map instance; + public PetMap10Builder(Map instance) { + this.instance = instance; + } + public Map getInstance() { + return instance; + } + public PetMap00Builder getBuilderAfterName(Map instance) { + return new PetMap00Builder(instance); + } + } + + public static class PetMapBuilder implements SetterForName, SetterForPhotoUrls { + private final Map instance; + public PetMapBuilder() { + this.instance = new LinkedHashMap<>(); + } + public Map getInstance() { + return instance; + } + public PetMap01Builder getBuilderAfterName(Map instance) { + return new PetMap01Builder(instance); + } + public PetMap10Builder getBuilderAfterPhotoUrls(Map instance) { + return new PetMap10Builder(instance); + } + } + + + public sealed interface Pet1Boxed permits Pet1BoxedMap { + @Nullable Object getData(); + } + + public record Pet1BoxedMap(PetMap data) implements Pet1Boxed { + @Override + public @Nullable Object getData() { + return data; + } + } + + + public static class Pet1 extends JsonSchema implements MapSchemaValidator { + /* + NOTE: This class is auto generated by OpenAPI JSON Schema Generator. + Ref: https://github.com/openapi-json-schema-tools/openapi-json-schema-generator + + Do not edit the class manually. + + Pet object that needs to be added to the store + */ + private static @Nullable Pet1 instance = null; + + protected Pet1() { + super(new JsonSchemaInfo() + .type(Set.of(Map.class)) + .properties(Map.ofEntries( + new PropertyEntry("id", Id.class), + new PropertyEntry("category", Category.Category1.class), + new PropertyEntry("name", Name.class), + new PropertyEntry("photoUrls", PhotoUrls.class), + new PropertyEntry("tags", Tags.class), + new PropertyEntry("status", Status.class) + )) + .required(Set.of( + "name", + "photoUrls" + )) + ); + } + + public static Pet1 getInstance() { + if (instance == null) { + instance = new Pet1(); + } + return instance; + } + + 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 RuntimeException("Invalid non-string key value"); + } + String propertyName = (String) entryKey; + List propertyPathToItem = new ArrayList<>(pathToItem); + propertyPathToItem.add(propertyName); + Object value = entry.getValue(); + LinkedHashMap, Nothing?> schemas = pathToSchemas.get(propertyPathToItem); + if (schemas == null) { + throw new RuntimeException("Validation result is invalid, schemas must exist for a pathToItem"); + } + JsonSchema propertySchema = schemas.entrySet().iterator().next().getKey(); + @Nullable Object propertyInstance = propertySchema.getNewInstance(value, propertyPathToItem, pathToSchemas); + properties.put(propertyName, propertyInstance); + } + FrozenMap<@Nullable Object> castProperties = new FrozenMap<>(properties); + return new PetMap(castProperties); + } + + 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); + SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().build())); + ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, new PathToSchemasMap(), new LinkedHashSet<>()); + PathToSchemasMap pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet); + return getNewInstance(castArg, validationMetadata.pathToItem(), pathToSchemasMap); + } + + + @Override + public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws 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"); + } + @Override + public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { + if (arg instanceof Map) { + return getNewInstance((Map) arg, pathToItem, pathToSchemas); + } + 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 { + return new Pet1BoxedMap(validate(arg, configuration)); + } + @Override + public Pet1Boxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { + 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"); + } + } + +} diff --git a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/schemas/Pig.kt b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/schemas/Pig.kt new file mode 100644 index 00000000000..1528499db75 --- /dev/null +++ b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/schemas/Pig.kt @@ -0,0 +1,330 @@ +package org.openapijsonschematools.client.components.schemas; +import java.time.LocalDate; +import java.time.ZonedDateTime; +import java.util.ArrayList; +import java.util.HashSet; +import java.util.LinkedHashMap; +import java.util.LinkedHashSet; +import java.util.List; +import java.util.Map; +import java.util.Objects; +import java.util.Set; +import java.util.UUID; +import org.checkerframework.checker.nullness.qual.Nullable; +import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags; +import org.openapijsonschematools.client.configurations.SchemaConfiguration; +import org.openapijsonschematools.client.exceptions.InvalidAdditionalPropertyException; +import org.openapijsonschematools.client.exceptions.UnsetPropertyException; +import org.openapijsonschematools.client.exceptions.ValidationException; +import org.openapijsonschematools.client.schemas.UnsetAddPropsSetter; +import org.openapijsonschematools.client.schemas.validation.BooleanSchemaValidator; +import org.openapijsonschematools.client.schemas.validation.FrozenList; +import org.openapijsonschematools.client.schemas.validation.FrozenMap; +import org.openapijsonschematools.client.schemas.validation.JsonSchema; +import org.openapijsonschematools.client.schemas.validation.JsonSchemaInfo; +import org.openapijsonschematools.client.schemas.validation.ListSchemaValidator; +import org.openapijsonschematools.client.schemas.validation.MapSchemaValidator; +import org.openapijsonschematools.client.schemas.validation.NullSchemaValidator; +import org.openapijsonschematools.client.schemas.validation.NumberSchemaValidator; +import org.openapijsonschematools.client.schemas.validation.PathToSchemasMap; +import org.openapijsonschematools.client.schemas.validation.StringSchemaValidator; +import org.openapijsonschematools.client.schemas.validation.ValidationMetadata; + +public class Pig { + // nest classes so all schemas and input/output classes can be public + + + public sealed interface Pig1Boxed permits Pig1BoxedVoid, Pig1BoxedBoolean, Pig1BoxedNumber, Pig1BoxedString, Pig1BoxedList, Pig1BoxedMap { + @Nullable Object getData(); + } + + public record Pig1BoxedVoid(Nothing? data) implements Pig1Boxed { + @Override + public @Nullable Object getData() { + return data; + } + } + + public record Pig1BoxedBoolean(boolean data) implements Pig1Boxed { + @Override + public @Nullable Object getData() { + return data; + } + } + + public record Pig1BoxedNumber(Number data) implements Pig1Boxed { + @Override + public @Nullable Object getData() { + return data; + } + } + + public record Pig1BoxedString(String data) implements Pig1Boxed { + @Override + public @Nullable Object getData() { + return data; + } + } + + public record Pig1BoxedList(FrozenList<@Nullable Object> data) implements Pig1Boxed { + @Override + public @Nullable Object getData() { + return data; + } + } + + public record Pig1BoxedMap(FrozenMap<@Nullable Object> data) implements Pig1Boxed { + @Override + public @Nullable Object getData() { + return data; + } + } + + + public static class Pig1 extends JsonSchema implements NullSchemaValidator, BooleanSchemaValidator, NumberSchemaValidator, StringSchemaValidator, ListSchemaValidator, Pig1BoxedList>, MapSchemaValidator, Pig1BoxedMap> { + /* + NOTE: This class is auto generated by OpenAPI JSON Schema Generator. + Ref: https://github.com/openapi-json-schema-tools/openapi-json-schema-generator + + Do not edit the class manually. + */ + private static @Nullable Pig1 instance = null; + + protected Pig1() { + super(new JsonSchemaInfo() + .oneOf(List.of( + BasquePig.BasquePig1.class, + DanishPig.DanishPig1.class + )) + ); + } + + public static Pig1 getInstance() { + if (instance == null) { + instance = new Pig1(); + } + return instance; + } + + @Override + public Nothing? validate(Nothing? arg, SchemaConfiguration configuration) throws ValidationException { + Set> pathSet = new HashSet<>(); + List pathToItem = List.of("args[0]"); + Nothing? castArg = castToAllowedTypes(arg, pathToItem, pathSet); + SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().build())); + PathToSchemasMap validatedPathToSchemas = new PathToSchemasMap(); + ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, new LinkedHashSet<>()); + getPathToSchemas(this, castArg, validationMetadata, pathSet); + return castArg; + } + + @Override + public boolean validate(boolean arg, SchemaConfiguration configuration) throws ValidationException { + Set> pathSet = new HashSet<>(); + List pathToItem = List.of("args[0]"); + boolean castArg = castToAllowedTypes(arg, pathToItem, pathSet); + SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().build())); + PathToSchemasMap validatedPathToSchemas = new PathToSchemasMap(); + ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, new LinkedHashSet<>()); + getPathToSchemas(this, castArg, validationMetadata, pathSet); + return castArg; + } + + @Override + public Number validate(Number arg, SchemaConfiguration configuration) throws ValidationException { + Set> pathSet = new HashSet<>(); + List pathToItem = List.of("args[0]"); + Number castArg = castToAllowedTypes(arg, pathToItem, pathSet); + SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().build())); + PathToSchemasMap validatedPathToSchemas = new PathToSchemasMap(); + ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, new LinkedHashSet<>()); + getPathToSchemas(this, castArg, validationMetadata, pathSet); + return castArg; + } + + public int validate(int arg, SchemaConfiguration configuration) throws ValidationException { + return (int) validate((Number) arg, configuration); + } + + public long validate(long arg, SchemaConfiguration configuration) throws ValidationException { + return (long) validate((Number) arg, configuration); + } + + public float validate(float arg, SchemaConfiguration configuration) throws ValidationException { + return (float) validate((Number) arg, configuration); + } + + public double validate(double arg, SchemaConfiguration configuration) throws ValidationException { + return (double) validate((Number) arg, configuration); + } + + @Override + public String validate(String arg, SchemaConfiguration configuration) throws ValidationException { + Set> pathSet = new HashSet<>(); + List pathToItem = List.of("args[0]"); + String castArg = castToAllowedTypes(arg, pathToItem, pathSet); + SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().build())); + PathToSchemasMap validatedPathToSchemas = new PathToSchemasMap(); + ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, new LinkedHashSet<>()); + getPathToSchemas(this, castArg, validationMetadata, pathSet); + return castArg; + } + + public String validate(LocalDate arg, SchemaConfiguration configuration) throws ValidationException { + return validate(arg.toString(), configuration); + } + + public String validate(ZonedDateTime arg, SchemaConfiguration configuration) throws ValidationException { + return validate(arg.toString(), configuration); + } + + public String validate(UUID arg, SchemaConfiguration configuration) throws ValidationException { + return validate(arg.toString(), configuration); + } + + @Override + public FrozenList<@Nullable Object> getNewInstance(List arg, List pathToItem, PathToSchemasMap pathToSchemas) { + List<@Nullable Object> items = new ArrayList<>(); + int i = 0; + for (Object item: arg) { + List itemPathToItem = new ArrayList<>(pathToItem); + itemPathToItem.add(i); + LinkedHashMap, Nothing?> schemas = pathToSchemas.get(itemPathToItem); + if (schemas == null) { + throw new RuntimeException("Validation result is invalid, schemas must exist for a pathToItem"); + } + JsonSchema itemSchema = schemas.entrySet().iterator().next().getKey(); + @Nullable Object itemInstance = itemSchema.getNewInstance(item, itemPathToItem, pathToSchemas); + items.add(itemInstance); + i += 1; + } + FrozenList<@Nullable Object> newInstanceItems = new FrozenList<>(items); + return newInstanceItems; + } + + 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); + SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().build())); + ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, new PathToSchemasMap(), new LinkedHashSet<>()); + PathToSchemasMap pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet); + return getNewInstance(castArg, validationMetadata.pathToItem(), pathToSchemasMap); + } + + @Override + 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 RuntimeException("Invalid non-string key value"); + } + String propertyName = (String) entryKey; + List propertyPathToItem = new ArrayList<>(pathToItem); + propertyPathToItem.add(propertyName); + Object value = entry.getValue(); + LinkedHashMap, Nothing?> schemas = pathToSchemas.get(propertyPathToItem); + if (schemas == null) { + throw new RuntimeException("Validation result is invalid, schemas must exist for a pathToItem"); + } + JsonSchema propertySchema = schemas.entrySet().iterator().next().getKey(); + @Nullable Object propertyInstance = propertySchema.getNewInstance(value, propertyPathToItem, pathToSchemas); + properties.put(propertyName, propertyInstance); + } + FrozenMap<@Nullable Object> castProperties = new FrozenMap<>(properties); + return castProperties; + } + + public FrozenMap<@Nullable Object> validate(Map arg, SchemaConfiguration configuration) throws ValidationException { + Set> pathSet = new HashSet<>(); + List pathToItem = List.of("args[0]"); + Map castArg = castToAllowedTypes(arg, pathToItem, pathSet); + SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().build())); + PathToSchemasMap validatedPathToSchemas = new PathToSchemasMap(); + ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, new LinkedHashSet<>()); + PathToSchemasMap pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet); + return getNewInstance(castArg, validationMetadata.pathToItem(), pathToSchemasMap); + } + + @Override + public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { + if (arg == null) { + return validate((Nothing?) null, configuration); + } else if (arg instanceof Boolean) { + boolean boolArg = (Boolean) arg; + return validate(boolArg, configuration); + } else if (arg instanceof Number) { + return validate((Number) arg, configuration); + } else if (arg instanceof String) { + return validate((String) arg, configuration); + } else if (arg instanceof List) { + return validate((List) arg, 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"); + } + @Override + public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { + if (arg == null) { + return getNewInstance((Nothing?) null, pathToItem, pathToSchemas); + } else if (arg instanceof Boolean) { + boolean boolArg = (Boolean) arg; + return getNewInstance(boolArg, pathToItem, pathToSchemas); + } else if (arg instanceof Number) { + return getNewInstance((Number) arg, pathToItem, pathToSchemas); + } else if (arg instanceof String) { + return getNewInstance((String) arg, pathToItem, pathToSchemas); + } else if (arg instanceof List) { + return getNewInstance((List) arg, 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"); + } + @Override + public Pig1BoxedVoid validateAndBox(Nothing? arg, SchemaConfiguration configuration) throws ValidationException { + return new Pig1BoxedVoid(validate(arg, configuration)); + } + @Override + 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 { + return new Pig1BoxedNumber(validate(arg, configuration)); + } + @Override + 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 { + return new Pig1BoxedList(validate(arg, configuration)); + } + @Override + 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 { + if (arg == null) { + Nothing? castArg = (Nothing?) arg; + return validateAndBox(castArg, configuration); + } else if (arg instanceof Boolean booleanArg) { + boolean castArg = booleanArg; + return validateAndBox(castArg, configuration); + } else if (arg instanceof String castArg) { + return validateAndBox(castArg, configuration); + } else if (arg instanceof Number castArg) { + return validateAndBox(castArg, configuration); + } else if (arg instanceof List castArg) { + 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"); + } + } +} diff --git a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/schemas/Player.kt b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/schemas/Player.kt new file mode 100644 index 00000000000..02e51a628fa --- /dev/null +++ b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/schemas/Player.kt @@ -0,0 +1,235 @@ +package org.openapijsonschematools.client.components.schemas; +import java.util.ArrayList; +import java.util.HashSet; +import java.util.LinkedHashMap; +import java.util.LinkedHashSet; +import java.util.List; +import java.util.Map; +import java.util.Objects; +import java.util.Set; +import org.checkerframework.checker.nullness.qual.Nullable; +import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags; +import org.openapijsonschematools.client.configurations.SchemaConfiguration; +import org.openapijsonschematools.client.exceptions.InvalidAdditionalPropertyException; +import org.openapijsonschematools.client.exceptions.UnsetPropertyException; +import org.openapijsonschematools.client.exceptions.ValidationException; +import org.openapijsonschematools.client.schemas.GenericBuilder; +import org.openapijsonschematools.client.schemas.StringJsonSchema; +import org.openapijsonschematools.client.schemas.UnsetAddPropsSetter; +import org.openapijsonschematools.client.schemas.validation.FrozenMap; +import org.openapijsonschematools.client.schemas.validation.JsonSchema; +import org.openapijsonschematools.client.schemas.validation.JsonSchemaInfo; +import org.openapijsonschematools.client.schemas.validation.MapSchemaValidator; +import org.openapijsonschematools.client.schemas.validation.PathToSchemasMap; +import org.openapijsonschematools.client.schemas.validation.PropertyEntry; +import org.openapijsonschematools.client.schemas.validation.ValidationMetadata; + +public class Player { + // nest classes so all schemas and input/output classes can be public + + + public static class Name extends StringJsonSchema.StringJsonSchema1 { + private static @Nullable Name instance = null; + public static Name getInstance() { + if (instance == null) { + instance = new Name(); + } + return instance; + } + } + + + public static class PlayerMap extends FrozenMap<@Nullable Object> { + protected PlayerMap(FrozenMap<@Nullable Object> m) { + super(m); + } + public static final Set requiredKeys = Set.of(); + public static final Set optionalKeys = Set.of( + "name", + "enemyPlayer" + ); + public static PlayerMap of(Map arg, SchemaConfiguration configuration) throws ValidationException { + return Player1.getInstance().validate(arg, configuration); + } + + public String name() throws UnsetPropertyException { + String key = "name"; + throwIfKeyNotPresent(key); + @Nullable Object value = get(key); + if (!(value instanceof String)) { + throw new RuntimeException("Invalid value stored for name"); + } + return (String) value; + } + + public PlayerMap enemyPlayer() throws UnsetPropertyException { + String key = "enemyPlayer"; + throwIfKeyNotPresent(key); + @Nullable Object value = get(key); + if (!(value instanceof PlayerMap)) { + throw new RuntimeException("Invalid value stored for enemyPlayer"); + } + return (PlayerMap) value; + } + + public @Nullable Object getAdditionalProperty(String name) throws UnsetPropertyException, InvalidAdditionalPropertyException { + throwIfKeyKnown(name, requiredKeys, optionalKeys); + throwIfKeyNotPresent(name); + return get(name); + } + } + + public interface SetterForName { + Map getInstance(); + T getBuilderAfterName(Map instance); + + default T name(String value) { + var instance = getInstance(); + instance.put("name", value); + return getBuilderAfterName(instance); + } + } + + public interface SetterForEnemyPlayer { + Map getInstance(); + T getBuilderAfterEnemyPlayer(Map instance); + + default T enemyPlayer(Map value) { + var instance = getInstance(); + instance.put("enemyPlayer", value); + return getBuilderAfterEnemyPlayer(instance); + } + } + + public static class PlayerMapBuilder extends UnsetAddPropsSetter implements GenericBuilder>, SetterForName, SetterForEnemyPlayer { + private final Map instance; + private static final Set knownKeys = Set.of( + "name", + "enemyPlayer" + ); + public Set getKnownKeys() { + return knownKeys; + } + public PlayerMapBuilder() { + this.instance = new LinkedHashMap<>(); + } + public Map build() { + return instance; + } + public Map getInstance() { + return instance; + } + public PlayerMapBuilder getBuilderAfterName(Map instance) { + return this; + } + public PlayerMapBuilder getBuilderAfterEnemyPlayer(Map instance) { + return this; + } + public PlayerMapBuilder getBuilderAfterAdditionalProperty(Map instance) { + return this; + } + } + + + public sealed interface Player1Boxed permits Player1BoxedMap { + @Nullable Object getData(); + } + + public record Player1BoxedMap(PlayerMap data) implements Player1Boxed { + @Override + public @Nullable Object getData() { + return data; + } + } + + + public static class Player1 extends JsonSchema implements MapSchemaValidator { + /* + NOTE: This class is auto generated by OpenAPI JSON Schema Generator. + Ref: https://github.com/openapi-json-schema-tools/openapi-json-schema-generator + + Do not edit the class manually. + + a model that includes a self reference this forces properties and additionalProperties to be lazy loaded in python models because the Player class has not fully loaded when defining properties + */ + private static @Nullable Player1 instance = null; + + protected Player1() { + super(new JsonSchemaInfo() + .type(Set.of(Map.class)) + .properties(Map.ofEntries( + new PropertyEntry("name", Name.class), + new PropertyEntry("enemyPlayer", Player1.class) + )) + ); + } + + public static Player1 getInstance() { + if (instance == null) { + instance = new Player1(); + } + return instance; + } + + 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 RuntimeException("Invalid non-string key value"); + } + String propertyName = (String) entryKey; + List propertyPathToItem = new ArrayList<>(pathToItem); + propertyPathToItem.add(propertyName); + Object value = entry.getValue(); + LinkedHashMap, Nothing?> schemas = pathToSchemas.get(propertyPathToItem); + if (schemas == null) { + throw new RuntimeException("Validation result is invalid, schemas must exist for a pathToItem"); + } + JsonSchema propertySchema = schemas.entrySet().iterator().next().getKey(); + @Nullable Object propertyInstance = propertySchema.getNewInstance(value, propertyPathToItem, pathToSchemas); + properties.put(propertyName, propertyInstance); + } + FrozenMap<@Nullable Object> castProperties = new FrozenMap<>(properties); + return new PlayerMap(castProperties); + } + + 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); + SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().build())); + ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, new PathToSchemasMap(), new LinkedHashSet<>()); + PathToSchemasMap pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet); + return getNewInstance(castArg, validationMetadata.pathToItem(), pathToSchemasMap); + } + + + @Override + public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws 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"); + } + @Override + public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { + if (arg instanceof Map) { + return getNewInstance((Map) arg, pathToItem, pathToSchemas); + } + 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 { + return new Player1BoxedMap(validate(arg, configuration)); + } + @Override + public Player1Boxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { + 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"); + } + } + +} diff --git a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/schemas/PublicKey.kt b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/schemas/PublicKey.kt new file mode 100644 index 00000000000..8f3e65e35d0 --- /dev/null +++ b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/schemas/PublicKey.kt @@ -0,0 +1,208 @@ +package org.openapijsonschematools.client.components.schemas; +import java.util.ArrayList; +import java.util.HashSet; +import java.util.LinkedHashMap; +import java.util.LinkedHashSet; +import java.util.List; +import java.util.Map; +import java.util.Objects; +import java.util.Set; +import org.checkerframework.checker.nullness.qual.Nullable; +import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags; +import org.openapijsonschematools.client.configurations.SchemaConfiguration; +import org.openapijsonschematools.client.exceptions.InvalidAdditionalPropertyException; +import org.openapijsonschematools.client.exceptions.UnsetPropertyException; +import org.openapijsonschematools.client.exceptions.ValidationException; +import org.openapijsonschematools.client.schemas.GenericBuilder; +import org.openapijsonschematools.client.schemas.StringJsonSchema; +import org.openapijsonschematools.client.schemas.UnsetAddPropsSetter; +import org.openapijsonschematools.client.schemas.validation.FrozenMap; +import org.openapijsonschematools.client.schemas.validation.JsonSchema; +import org.openapijsonschematools.client.schemas.validation.JsonSchemaInfo; +import org.openapijsonschematools.client.schemas.validation.MapSchemaValidator; +import org.openapijsonschematools.client.schemas.validation.PathToSchemasMap; +import org.openapijsonschematools.client.schemas.validation.PropertyEntry; +import org.openapijsonschematools.client.schemas.validation.ValidationMetadata; + +public class PublicKey { + // nest classes so all schemas and input/output classes can be public + + + public static class Key extends StringJsonSchema.StringJsonSchema1 { + private static @Nullable Key instance = null; + public static Key getInstance() { + if (instance == null) { + instance = new Key(); + } + return instance; + } + } + + + public static class PublicKeyMap extends FrozenMap<@Nullable Object> { + protected PublicKeyMap(FrozenMap<@Nullable Object> m) { + super(m); + } + public static final Set requiredKeys = Set.of(); + public static final Set optionalKeys = Set.of( + "key" + ); + public static PublicKeyMap of(Map arg, SchemaConfiguration configuration) throws ValidationException { + return PublicKey1.getInstance().validate(arg, configuration); + } + + public String key() throws UnsetPropertyException { + String key = "key"; + throwIfKeyNotPresent(key); + @Nullable Object value = get(key); + if (!(value instanceof String)) { + throw new RuntimeException("Invalid value stored for key"); + } + return (String) value; + } + + public @Nullable Object getAdditionalProperty(String name) throws UnsetPropertyException, InvalidAdditionalPropertyException { + throwIfKeyKnown(name, requiredKeys, optionalKeys); + throwIfKeyNotPresent(name); + return get(name); + } + } + + public interface SetterForKey { + Map getInstance(); + T getBuilderAfterKey(Map instance); + + default T key(String value) { + var instance = getInstance(); + instance.put("key", value); + return getBuilderAfterKey(instance); + } + } + + public static class PublicKeyMapBuilder extends UnsetAddPropsSetter implements GenericBuilder>, SetterForKey { + private final Map instance; + private static final Set knownKeys = Set.of( + "key" + ); + public Set getKnownKeys() { + return knownKeys; + } + public PublicKeyMapBuilder() { + this.instance = new LinkedHashMap<>(); + } + public Map build() { + return instance; + } + public Map getInstance() { + return instance; + } + public PublicKeyMapBuilder getBuilderAfterKey(Map instance) { + return this; + } + public PublicKeyMapBuilder getBuilderAfterAdditionalProperty(Map instance) { + return this; + } + } + + + public sealed interface PublicKey1Boxed permits PublicKey1BoxedMap { + @Nullable Object getData(); + } + + public record PublicKey1BoxedMap(PublicKeyMap data) implements PublicKey1Boxed { + @Override + public @Nullable Object getData() { + return data; + } + } + + + public static class PublicKey1 extends JsonSchema implements MapSchemaValidator { + /* + NOTE: This class is auto generated by OpenAPI JSON Schema Generator. + Ref: https://github.com/openapi-json-schema-tools/openapi-json-schema-generator + + Do not edit the class manually. + + schema that contains a property named key + */ + private static @Nullable PublicKey1 instance = null; + + protected PublicKey1() { + super(new JsonSchemaInfo() + .type(Set.of(Map.class)) + .properties(Map.ofEntries( + new PropertyEntry("key", Key.class) + )) + ); + } + + public static PublicKey1 getInstance() { + if (instance == null) { + instance = new PublicKey1(); + } + return instance; + } + + 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 RuntimeException("Invalid non-string key value"); + } + String propertyName = (String) entryKey; + List propertyPathToItem = new ArrayList<>(pathToItem); + propertyPathToItem.add(propertyName); + Object value = entry.getValue(); + LinkedHashMap, Nothing?> schemas = pathToSchemas.get(propertyPathToItem); + if (schemas == null) { + throw new RuntimeException("Validation result is invalid, schemas must exist for a pathToItem"); + } + JsonSchema propertySchema = schemas.entrySet().iterator().next().getKey(); + @Nullable Object propertyInstance = propertySchema.getNewInstance(value, propertyPathToItem, pathToSchemas); + properties.put(propertyName, propertyInstance); + } + FrozenMap<@Nullable Object> castProperties = new FrozenMap<>(properties); + return new PublicKeyMap(castProperties); + } + + 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); + SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().build())); + ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, new PathToSchemasMap(), new LinkedHashSet<>()); + PathToSchemasMap pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet); + return getNewInstance(castArg, validationMetadata.pathToItem(), pathToSchemasMap); + } + + + @Override + public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws 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"); + } + @Override + public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { + if (arg instanceof Map) { + return getNewInstance((Map) arg, pathToItem, pathToSchemas); + } + 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 { + return new PublicKey1BoxedMap(validate(arg, configuration)); + } + @Override + public PublicKey1Boxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { + 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"); + } + } + +} diff --git a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/schemas/Quadrilateral.kt b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/schemas/Quadrilateral.kt new file mode 100644 index 00000000000..17eb261f9d3 --- /dev/null +++ b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/schemas/Quadrilateral.kt @@ -0,0 +1,330 @@ +package org.openapijsonschematools.client.components.schemas; +import java.time.LocalDate; +import java.time.ZonedDateTime; +import java.util.ArrayList; +import java.util.HashSet; +import java.util.LinkedHashMap; +import java.util.LinkedHashSet; +import java.util.List; +import java.util.Map; +import java.util.Objects; +import java.util.Set; +import java.util.UUID; +import org.checkerframework.checker.nullness.qual.Nullable; +import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags; +import org.openapijsonschematools.client.configurations.SchemaConfiguration; +import org.openapijsonschematools.client.exceptions.InvalidAdditionalPropertyException; +import org.openapijsonschematools.client.exceptions.UnsetPropertyException; +import org.openapijsonschematools.client.exceptions.ValidationException; +import org.openapijsonschematools.client.schemas.UnsetAddPropsSetter; +import org.openapijsonschematools.client.schemas.validation.BooleanSchemaValidator; +import org.openapijsonschematools.client.schemas.validation.FrozenList; +import org.openapijsonschematools.client.schemas.validation.FrozenMap; +import org.openapijsonschematools.client.schemas.validation.JsonSchema; +import org.openapijsonschematools.client.schemas.validation.JsonSchemaInfo; +import org.openapijsonschematools.client.schemas.validation.ListSchemaValidator; +import org.openapijsonschematools.client.schemas.validation.MapSchemaValidator; +import org.openapijsonschematools.client.schemas.validation.NullSchemaValidator; +import org.openapijsonschematools.client.schemas.validation.NumberSchemaValidator; +import org.openapijsonschematools.client.schemas.validation.PathToSchemasMap; +import org.openapijsonschematools.client.schemas.validation.StringSchemaValidator; +import org.openapijsonschematools.client.schemas.validation.ValidationMetadata; + +public class Quadrilateral { + // nest classes so all schemas and input/output classes can be public + + + public sealed interface Quadrilateral1Boxed permits Quadrilateral1BoxedVoid, Quadrilateral1BoxedBoolean, Quadrilateral1BoxedNumber, Quadrilateral1BoxedString, Quadrilateral1BoxedList, Quadrilateral1BoxedMap { + @Nullable Object getData(); + } + + public record Quadrilateral1BoxedVoid(Nothing? data) implements Quadrilateral1Boxed { + @Override + public @Nullable Object getData() { + return data; + } + } + + public record Quadrilateral1BoxedBoolean(boolean data) implements Quadrilateral1Boxed { + @Override + public @Nullable Object getData() { + return data; + } + } + + public record Quadrilateral1BoxedNumber(Number data) implements Quadrilateral1Boxed { + @Override + public @Nullable Object getData() { + return data; + } + } + + public record Quadrilateral1BoxedString(String data) implements Quadrilateral1Boxed { + @Override + public @Nullable Object getData() { + return data; + } + } + + public record Quadrilateral1BoxedList(FrozenList<@Nullable Object> data) implements Quadrilateral1Boxed { + @Override + public @Nullable Object getData() { + return data; + } + } + + public record Quadrilateral1BoxedMap(FrozenMap<@Nullable Object> data) implements Quadrilateral1Boxed { + @Override + public @Nullable Object getData() { + return data; + } + } + + + public static class Quadrilateral1 extends JsonSchema implements NullSchemaValidator, BooleanSchemaValidator, NumberSchemaValidator, StringSchemaValidator, ListSchemaValidator, Quadrilateral1BoxedList>, MapSchemaValidator, Quadrilateral1BoxedMap> { + /* + NOTE: This class is auto generated by OpenAPI JSON Schema Generator. + Ref: https://github.com/openapi-json-schema-tools/openapi-json-schema-generator + + Do not edit the class manually. + */ + private static @Nullable Quadrilateral1 instance = null; + + protected Quadrilateral1() { + super(new JsonSchemaInfo() + .oneOf(List.of( + SimpleQuadrilateral.SimpleQuadrilateral1.class, + ComplexQuadrilateral.ComplexQuadrilateral1.class + )) + ); + } + + public static Quadrilateral1 getInstance() { + if (instance == null) { + instance = new Quadrilateral1(); + } + return instance; + } + + @Override + public Nothing? validate(Nothing? arg, SchemaConfiguration configuration) throws ValidationException { + Set> pathSet = new HashSet<>(); + List pathToItem = List.of("args[0]"); + Nothing? castArg = castToAllowedTypes(arg, pathToItem, pathSet); + SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().build())); + PathToSchemasMap validatedPathToSchemas = new PathToSchemasMap(); + ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, new LinkedHashSet<>()); + getPathToSchemas(this, castArg, validationMetadata, pathSet); + return castArg; + } + + @Override + public boolean validate(boolean arg, SchemaConfiguration configuration) throws ValidationException { + Set> pathSet = new HashSet<>(); + List pathToItem = List.of("args[0]"); + boolean castArg = castToAllowedTypes(arg, pathToItem, pathSet); + SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().build())); + PathToSchemasMap validatedPathToSchemas = new PathToSchemasMap(); + ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, new LinkedHashSet<>()); + getPathToSchemas(this, castArg, validationMetadata, pathSet); + return castArg; + } + + @Override + public Number validate(Number arg, SchemaConfiguration configuration) throws ValidationException { + Set> pathSet = new HashSet<>(); + List pathToItem = List.of("args[0]"); + Number castArg = castToAllowedTypes(arg, pathToItem, pathSet); + SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().build())); + PathToSchemasMap validatedPathToSchemas = new PathToSchemasMap(); + ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, new LinkedHashSet<>()); + getPathToSchemas(this, castArg, validationMetadata, pathSet); + return castArg; + } + + public int validate(int arg, SchemaConfiguration configuration) throws ValidationException { + return (int) validate((Number) arg, configuration); + } + + public long validate(long arg, SchemaConfiguration configuration) throws ValidationException { + return (long) validate((Number) arg, configuration); + } + + public float validate(float arg, SchemaConfiguration configuration) throws ValidationException { + return (float) validate((Number) arg, configuration); + } + + public double validate(double arg, SchemaConfiguration configuration) throws ValidationException { + return (double) validate((Number) arg, configuration); + } + + @Override + public String validate(String arg, SchemaConfiguration configuration) throws ValidationException { + Set> pathSet = new HashSet<>(); + List pathToItem = List.of("args[0]"); + String castArg = castToAllowedTypes(arg, pathToItem, pathSet); + SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().build())); + PathToSchemasMap validatedPathToSchemas = new PathToSchemasMap(); + ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, new LinkedHashSet<>()); + getPathToSchemas(this, castArg, validationMetadata, pathSet); + return castArg; + } + + public String validate(LocalDate arg, SchemaConfiguration configuration) throws ValidationException { + return validate(arg.toString(), configuration); + } + + public String validate(ZonedDateTime arg, SchemaConfiguration configuration) throws ValidationException { + return validate(arg.toString(), configuration); + } + + public String validate(UUID arg, SchemaConfiguration configuration) throws ValidationException { + return validate(arg.toString(), configuration); + } + + @Override + public FrozenList<@Nullable Object> getNewInstance(List arg, List pathToItem, PathToSchemasMap pathToSchemas) { + List<@Nullable Object> items = new ArrayList<>(); + int i = 0; + for (Object item: arg) { + List itemPathToItem = new ArrayList<>(pathToItem); + itemPathToItem.add(i); + LinkedHashMap, Nothing?> schemas = pathToSchemas.get(itemPathToItem); + if (schemas == null) { + throw new RuntimeException("Validation result is invalid, schemas must exist for a pathToItem"); + } + JsonSchema itemSchema = schemas.entrySet().iterator().next().getKey(); + @Nullable Object itemInstance = itemSchema.getNewInstance(item, itemPathToItem, pathToSchemas); + items.add(itemInstance); + i += 1; + } + FrozenList<@Nullable Object> newInstanceItems = new FrozenList<>(items); + return newInstanceItems; + } + + 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); + SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().build())); + ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, new PathToSchemasMap(), new LinkedHashSet<>()); + PathToSchemasMap pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet); + return getNewInstance(castArg, validationMetadata.pathToItem(), pathToSchemasMap); + } + + @Override + 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 RuntimeException("Invalid non-string key value"); + } + String propertyName = (String) entryKey; + List propertyPathToItem = new ArrayList<>(pathToItem); + propertyPathToItem.add(propertyName); + Object value = entry.getValue(); + LinkedHashMap, Nothing?> schemas = pathToSchemas.get(propertyPathToItem); + if (schemas == null) { + throw new RuntimeException("Validation result is invalid, schemas must exist for a pathToItem"); + } + JsonSchema propertySchema = schemas.entrySet().iterator().next().getKey(); + @Nullable Object propertyInstance = propertySchema.getNewInstance(value, propertyPathToItem, pathToSchemas); + properties.put(propertyName, propertyInstance); + } + FrozenMap<@Nullable Object> castProperties = new FrozenMap<>(properties); + return castProperties; + } + + public FrozenMap<@Nullable Object> validate(Map arg, SchemaConfiguration configuration) throws ValidationException { + Set> pathSet = new HashSet<>(); + List pathToItem = List.of("args[0]"); + Map castArg = castToAllowedTypes(arg, pathToItem, pathSet); + SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().build())); + PathToSchemasMap validatedPathToSchemas = new PathToSchemasMap(); + ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, new LinkedHashSet<>()); + PathToSchemasMap pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet); + return getNewInstance(castArg, validationMetadata.pathToItem(), pathToSchemasMap); + } + + @Override + public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { + if (arg == null) { + return validate((Nothing?) null, configuration); + } else if (arg instanceof Boolean) { + boolean boolArg = (Boolean) arg; + return validate(boolArg, configuration); + } else if (arg instanceof Number) { + return validate((Number) arg, configuration); + } else if (arg instanceof String) { + return validate((String) arg, configuration); + } else if (arg instanceof List) { + return validate((List) arg, 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"); + } + @Override + public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { + if (arg == null) { + return getNewInstance((Nothing?) null, pathToItem, pathToSchemas); + } else if (arg instanceof Boolean) { + boolean boolArg = (Boolean) arg; + return getNewInstance(boolArg, pathToItem, pathToSchemas); + } else if (arg instanceof Number) { + return getNewInstance((Number) arg, pathToItem, pathToSchemas); + } else if (arg instanceof String) { + return getNewInstance((String) arg, pathToItem, pathToSchemas); + } else if (arg instanceof List) { + return getNewInstance((List) arg, 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"); + } + @Override + public Quadrilateral1BoxedVoid validateAndBox(Nothing? arg, SchemaConfiguration configuration) throws ValidationException { + return new Quadrilateral1BoxedVoid(validate(arg, configuration)); + } + @Override + 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 { + return new Quadrilateral1BoxedNumber(validate(arg, configuration)); + } + @Override + 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 { + return new Quadrilateral1BoxedList(validate(arg, configuration)); + } + @Override + 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 { + if (arg == null) { + Nothing? castArg = (Nothing?) arg; + return validateAndBox(castArg, configuration); + } else if (arg instanceof Boolean booleanArg) { + boolean castArg = booleanArg; + return validateAndBox(castArg, configuration); + } else if (arg instanceof String castArg) { + return validateAndBox(castArg, configuration); + } else if (arg instanceof Number castArg) { + return validateAndBox(castArg, configuration); + } else if (arg instanceof List castArg) { + 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"); + } + } +} diff --git a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/schemas/QuadrilateralInterface.kt b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/schemas/QuadrilateralInterface.kt new file mode 100644 index 00000000000..fa635ecad8d --- /dev/null +++ b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/schemas/QuadrilateralInterface.kt @@ -0,0 +1,570 @@ +package org.openapijsonschematools.client.components.schemas; +import java.time.LocalDate; +import java.time.ZonedDateTime; +import java.util.ArrayList; +import java.util.HashSet; +import java.util.LinkedHashMap; +import java.util.LinkedHashSet; +import java.util.List; +import java.util.Map; +import java.util.Objects; +import java.util.Set; +import java.util.UUID; +import org.checkerframework.checker.nullness.qual.Nullable; +import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags; +import org.openapijsonschematools.client.configurations.SchemaConfiguration; +import org.openapijsonschematools.client.exceptions.InvalidAdditionalPropertyException; +import org.openapijsonschematools.client.exceptions.UnsetPropertyException; +import org.openapijsonschematools.client.exceptions.ValidationException; +import org.openapijsonschematools.client.schemas.GenericBuilder; +import org.openapijsonschematools.client.schemas.SetMaker; +import org.openapijsonschematools.client.schemas.StringJsonSchema; +import org.openapijsonschematools.client.schemas.UnsetAddPropsSetter; +import org.openapijsonschematools.client.schemas.validation.BooleanSchemaValidator; +import org.openapijsonschematools.client.schemas.validation.FrozenList; +import org.openapijsonschematools.client.schemas.validation.FrozenMap; +import org.openapijsonschematools.client.schemas.validation.JsonSchema; +import org.openapijsonschematools.client.schemas.validation.JsonSchemaInfo; +import org.openapijsonschematools.client.schemas.validation.ListSchemaValidator; +import org.openapijsonschematools.client.schemas.validation.MapSchemaValidator; +import org.openapijsonschematools.client.schemas.validation.NullSchemaValidator; +import org.openapijsonschematools.client.schemas.validation.NumberSchemaValidator; +import org.openapijsonschematools.client.schemas.validation.PathToSchemasMap; +import org.openapijsonschematools.client.schemas.validation.PropertyEntry; +import org.openapijsonschematools.client.schemas.validation.StringEnumValidator; +import org.openapijsonschematools.client.schemas.validation.StringSchemaValidator; +import org.openapijsonschematools.client.schemas.validation.StringValueMethod; +import org.openapijsonschematools.client.schemas.validation.ValidationMetadata; + +public class QuadrilateralInterface { + // nest classes so all schemas and input/output classes can be public + + public enum StringShapeTypeEnums implements StringValueMethod { + QUADRILATERAL("Quadrilateral"); + private final String value; + + StringShapeTypeEnums(String value) { + this.value = value; + } + public String value() { + return this.value; + } + } + + + public sealed interface ShapeTypeBoxed permits ShapeTypeBoxedString { + @Nullable Object getData(); + } + + public record ShapeTypeBoxedString(String data) implements ShapeTypeBoxed { + @Override + public @Nullable Object getData() { + return data; + } + } + + + + public static class ShapeType extends JsonSchema implements StringSchemaValidator, StringEnumValidator { + private static @Nullable ShapeType instance = null; + + protected ShapeType() { + super(new JsonSchemaInfo() + .type(Set.of( + String.class + )) + .enumValues(SetMaker.makeSet( + "Quadrilateral" + )) + ); + } + + public static ShapeType getInstance() { + if (instance == null) { + instance = new ShapeType(); + } + return instance; + } + + @Override + public String validate(String arg, SchemaConfiguration configuration) throws ValidationException { + Set> pathSet = new HashSet<>(); + List pathToItem = List.of("args[0"); + String castArg = castToAllowedTypes(arg, pathToItem, pathSet); + SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().build())); + ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, new PathToSchemasMap(), new LinkedHashSet<>()); + getPathToSchemas(this, castArg, validationMetadata, pathSet); + return castArg; + } + + @Override + 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 { + 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"); + } + @Override + public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { + 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"); + } + @Override + 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 { + 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"); + } + } + + public static class QuadrilateralType extends StringJsonSchema.StringJsonSchema1 { + private static @Nullable QuadrilateralType instance = null; + public static QuadrilateralType getInstance() { + if (instance == null) { + instance = new QuadrilateralType(); + } + return instance; + } + } + + + public static class QuadrilateralInterfaceMap extends FrozenMap<@Nullable Object> { + protected QuadrilateralInterfaceMap(FrozenMap<@Nullable Object> m) { + super(m); + } + public static final Set requiredKeys = Set.of( + "quadrilateralType", + "shapeType" + ); + public static final Set optionalKeys = Set.of(); + public static QuadrilateralInterfaceMap of(Map arg, SchemaConfiguration configuration) throws ValidationException { + return QuadrilateralInterface1.getInstance().validate(arg, configuration); + } + + public String quadrilateralType() { + @Nullable Object value = get("quadrilateralType"); + if (!(value instanceof String)) { + throw new RuntimeException("Invalid value stored for quadrilateralType"); + } + return (String) value; + } + + public String shapeType() { + @Nullable Object value = get("shapeType"); + if (!(value instanceof String)) { + throw new RuntimeException("Invalid value stored for shapeType"); + } + return (String) value; + } + + public @Nullable Object getAdditionalProperty(String name) throws UnsetPropertyException, InvalidAdditionalPropertyException { + throwIfKeyKnown(name, requiredKeys, optionalKeys); + throwIfKeyNotPresent(name); + return get(name); + } + } + + public interface SetterForQuadrilateralType { + Map getInstance(); + T getBuilderAfterQuadrilateralType(Map instance); + + default T quadrilateralType(String value) { + var instance = getInstance(); + instance.put("quadrilateralType", value); + return getBuilderAfterQuadrilateralType(instance); + } + } + + public interface SetterForShapeType { + Map getInstance(); + T getBuilderAfterShapeType(Map instance); + + default T shapeType(String value) { + var instance = getInstance(); + instance.put("shapeType", value); + return getBuilderAfterShapeType(instance); + } + + default T shapeType(StringShapeTypeEnums value) { + var instance = getInstance(); + instance.put("shapeType", value.value()); + return getBuilderAfterShapeType(instance); + } + } + + public static class QuadrilateralInterfaceMap00Builder extends UnsetAddPropsSetter implements GenericBuilder> { + private final Map instance; + private static final Set knownKeys = Set.of( + "quadrilateralType", + "shapeType" + ); + public Set getKnownKeys() { + return knownKeys; + } + public QuadrilateralInterfaceMap00Builder(Map instance) { + this.instance = instance; + } + public Map build() { + return instance; + } + public Map getInstance() { + return instance; + } + public QuadrilateralInterfaceMap00Builder getBuilderAfterAdditionalProperty(Map instance) { + return this; + } + } + + public static class QuadrilateralInterfaceMap01Builder implements SetterForShapeType { + private final Map instance; + public QuadrilateralInterfaceMap01Builder(Map instance) { + this.instance = instance; + } + public Map getInstance() { + return instance; + } + public QuadrilateralInterfaceMap00Builder getBuilderAfterShapeType(Map instance) { + return new QuadrilateralInterfaceMap00Builder(instance); + } + } + + public static class QuadrilateralInterfaceMap10Builder implements SetterForQuadrilateralType { + private final Map instance; + public QuadrilateralInterfaceMap10Builder(Map instance) { + this.instance = instance; + } + public Map getInstance() { + return instance; + } + public QuadrilateralInterfaceMap00Builder getBuilderAfterQuadrilateralType(Map instance) { + return new QuadrilateralInterfaceMap00Builder(instance); + } + } + + public static class QuadrilateralInterfaceMapBuilder implements SetterForQuadrilateralType, SetterForShapeType { + private final Map instance; + public QuadrilateralInterfaceMapBuilder() { + this.instance = new LinkedHashMap<>(); + } + public Map getInstance() { + return instance; + } + public QuadrilateralInterfaceMap01Builder getBuilderAfterQuadrilateralType(Map instance) { + return new QuadrilateralInterfaceMap01Builder(instance); + } + public QuadrilateralInterfaceMap10Builder getBuilderAfterShapeType(Map instance) { + return new QuadrilateralInterfaceMap10Builder(instance); + } + } + + + public sealed interface QuadrilateralInterface1Boxed permits QuadrilateralInterface1BoxedVoid, QuadrilateralInterface1BoxedBoolean, QuadrilateralInterface1BoxedNumber, QuadrilateralInterface1BoxedString, QuadrilateralInterface1BoxedList, QuadrilateralInterface1BoxedMap { + @Nullable Object getData(); + } + + public record QuadrilateralInterface1BoxedVoid(Nothing? data) implements QuadrilateralInterface1Boxed { + @Override + public @Nullable Object getData() { + return data; + } + } + + public record QuadrilateralInterface1BoxedBoolean(boolean data) implements QuadrilateralInterface1Boxed { + @Override + public @Nullable Object getData() { + return data; + } + } + + public record QuadrilateralInterface1BoxedNumber(Number data) implements QuadrilateralInterface1Boxed { + @Override + public @Nullable Object getData() { + return data; + } + } + + public record QuadrilateralInterface1BoxedString(String data) implements QuadrilateralInterface1Boxed { + @Override + public @Nullable Object getData() { + return data; + } + } + + public record QuadrilateralInterface1BoxedList(FrozenList<@Nullable Object> data) implements QuadrilateralInterface1Boxed { + @Override + public @Nullable Object getData() { + return data; + } + } + + public record QuadrilateralInterface1BoxedMap(QuadrilateralInterfaceMap data) implements QuadrilateralInterface1Boxed { + @Override + public @Nullable Object getData() { + return data; + } + } + + + public static class QuadrilateralInterface1 extends JsonSchema implements NullSchemaValidator, BooleanSchemaValidator, NumberSchemaValidator, StringSchemaValidator, ListSchemaValidator, QuadrilateralInterface1BoxedList>, MapSchemaValidator { + /* + NOTE: This class is auto generated by OpenAPI JSON Schema Generator. + Ref: https://github.com/openapi-json-schema-tools/openapi-json-schema-generator + + Do not edit the class manually. + */ + private static @Nullable QuadrilateralInterface1 instance = null; + + protected QuadrilateralInterface1() { + super(new JsonSchemaInfo() + .properties(Map.ofEntries( + new PropertyEntry("shapeType", ShapeType.class), + new PropertyEntry("quadrilateralType", QuadrilateralType.class) + )) + .required(Set.of( + "quadrilateralType", + "shapeType" + )) + ); + } + + public static QuadrilateralInterface1 getInstance() { + if (instance == null) { + instance = new QuadrilateralInterface1(); + } + return instance; + } + + @Override + public Nothing? validate(Nothing? arg, SchemaConfiguration configuration) throws ValidationException { + Set> pathSet = new HashSet<>(); + List pathToItem = List.of("args[0]"); + Nothing? castArg = castToAllowedTypes(arg, pathToItem, pathSet); + SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().build())); + PathToSchemasMap validatedPathToSchemas = new PathToSchemasMap(); + ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, new LinkedHashSet<>()); + getPathToSchemas(this, castArg, validationMetadata, pathSet); + return castArg; + } + + @Override + public boolean validate(boolean arg, SchemaConfiguration configuration) throws ValidationException { + Set> pathSet = new HashSet<>(); + List pathToItem = List.of("args[0]"); + boolean castArg = castToAllowedTypes(arg, pathToItem, pathSet); + SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().build())); + PathToSchemasMap validatedPathToSchemas = new PathToSchemasMap(); + ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, new LinkedHashSet<>()); + getPathToSchemas(this, castArg, validationMetadata, pathSet); + return castArg; + } + + @Override + public Number validate(Number arg, SchemaConfiguration configuration) throws ValidationException { + Set> pathSet = new HashSet<>(); + List pathToItem = List.of("args[0]"); + Number castArg = castToAllowedTypes(arg, pathToItem, pathSet); + SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().build())); + PathToSchemasMap validatedPathToSchemas = new PathToSchemasMap(); + ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, new LinkedHashSet<>()); + getPathToSchemas(this, castArg, validationMetadata, pathSet); + return castArg; + } + + public int validate(int arg, SchemaConfiguration configuration) throws ValidationException { + return (int) validate((Number) arg, configuration); + } + + public long validate(long arg, SchemaConfiguration configuration) throws ValidationException { + return (long) validate((Number) arg, configuration); + } + + public float validate(float arg, SchemaConfiguration configuration) throws ValidationException { + return (float) validate((Number) arg, configuration); + } + + public double validate(double arg, SchemaConfiguration configuration) throws ValidationException { + return (double) validate((Number) arg, configuration); + } + + @Override + public String validate(String arg, SchemaConfiguration configuration) throws ValidationException { + Set> pathSet = new HashSet<>(); + List pathToItem = List.of("args[0]"); + String castArg = castToAllowedTypes(arg, pathToItem, pathSet); + SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().build())); + PathToSchemasMap validatedPathToSchemas = new PathToSchemasMap(); + ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, new LinkedHashSet<>()); + getPathToSchemas(this, castArg, validationMetadata, pathSet); + return castArg; + } + + public String validate(LocalDate arg, SchemaConfiguration configuration) throws ValidationException { + return validate(arg.toString(), configuration); + } + + public String validate(ZonedDateTime arg, SchemaConfiguration configuration) throws ValidationException { + return validate(arg.toString(), configuration); + } + + public String validate(UUID arg, SchemaConfiguration configuration) throws ValidationException { + return validate(arg.toString(), configuration); + } + + @Override + public FrozenList<@Nullable Object> getNewInstance(List arg, List pathToItem, PathToSchemasMap pathToSchemas) { + List<@Nullable Object> items = new ArrayList<>(); + int i = 0; + for (Object item: arg) { + List itemPathToItem = new ArrayList<>(pathToItem); + itemPathToItem.add(i); + LinkedHashMap, Nothing?> schemas = pathToSchemas.get(itemPathToItem); + if (schemas == null) { + throw new RuntimeException("Validation result is invalid, schemas must exist for a pathToItem"); + } + JsonSchema itemSchema = schemas.entrySet().iterator().next().getKey(); + @Nullable Object itemInstance = itemSchema.getNewInstance(item, itemPathToItem, pathToSchemas); + items.add(itemInstance); + i += 1; + } + FrozenList<@Nullable Object> newInstanceItems = new FrozenList<>(items); + return newInstanceItems; + } + + 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); + SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().build())); + ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, new PathToSchemasMap(), new LinkedHashSet<>()); + PathToSchemasMap pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet); + return getNewInstance(castArg, validationMetadata.pathToItem(), pathToSchemasMap); + } + + @Override + 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 RuntimeException("Invalid non-string key value"); + } + String propertyName = (String) entryKey; + List propertyPathToItem = new ArrayList<>(pathToItem); + propertyPathToItem.add(propertyName); + Object value = entry.getValue(); + LinkedHashMap, Nothing?> schemas = pathToSchemas.get(propertyPathToItem); + if (schemas == null) { + throw new RuntimeException("Validation result is invalid, schemas must exist for a pathToItem"); + } + JsonSchema propertySchema = schemas.entrySet().iterator().next().getKey(); + @Nullable Object propertyInstance = propertySchema.getNewInstance(value, propertyPathToItem, pathToSchemas); + properties.put(propertyName, propertyInstance); + } + FrozenMap<@Nullable Object> castProperties = new FrozenMap<>(properties); + return new QuadrilateralInterfaceMap(castProperties); + } + + 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); + SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().build())); + PathToSchemasMap validatedPathToSchemas = new PathToSchemasMap(); + ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, new LinkedHashSet<>()); + PathToSchemasMap pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet); + return getNewInstance(castArg, validationMetadata.pathToItem(), pathToSchemasMap); + } + + @Override + public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { + if (arg == null) { + return validate((Nothing?) null, configuration); + } else if (arg instanceof Boolean) { + boolean boolArg = (Boolean) arg; + return validate(boolArg, configuration); + } else if (arg instanceof Number) { + return validate((Number) arg, configuration); + } else if (arg instanceof String) { + return validate((String) arg, configuration); + } else if (arg instanceof List) { + return validate((List) arg, 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"); + } + @Override + public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { + if (arg == null) { + return getNewInstance((Nothing?) null, pathToItem, pathToSchemas); + } else if (arg instanceof Boolean) { + boolean boolArg = (Boolean) arg; + return getNewInstance(boolArg, pathToItem, pathToSchemas); + } else if (arg instanceof Number) { + return getNewInstance((Number) arg, pathToItem, pathToSchemas); + } else if (arg instanceof String) { + return getNewInstance((String) arg, pathToItem, pathToSchemas); + } else if (arg instanceof List) { + return getNewInstance((List) arg, 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"); + } + @Override + public QuadrilateralInterface1BoxedVoid validateAndBox(Nothing? arg, SchemaConfiguration configuration) throws ValidationException { + return new QuadrilateralInterface1BoxedVoid(validate(arg, configuration)); + } + @Override + 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 { + return new QuadrilateralInterface1BoxedNumber(validate(arg, configuration)); + } + @Override + 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 { + return new QuadrilateralInterface1BoxedList(validate(arg, configuration)); + } + @Override + 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 { + if (arg == null) { + Nothing? castArg = (Nothing?) arg; + return validateAndBox(castArg, configuration); + } else if (arg instanceof Boolean booleanArg) { + boolean castArg = booleanArg; + return validateAndBox(castArg, configuration); + } else if (arg instanceof String castArg) { + return validateAndBox(castArg, configuration); + } else if (arg instanceof Number castArg) { + return validateAndBox(castArg, configuration); + } else if (arg instanceof List castArg) { + 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"); + } + } +} diff --git a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/schemas/ReadOnlyFirst.kt b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/schemas/ReadOnlyFirst.kt new file mode 100644 index 00000000000..48da489c9c0 --- /dev/null +++ b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/schemas/ReadOnlyFirst.kt @@ -0,0 +1,244 @@ +package org.openapijsonschematools.client.components.schemas; +import java.util.ArrayList; +import java.util.HashSet; +import java.util.LinkedHashMap; +import java.util.LinkedHashSet; +import java.util.List; +import java.util.Map; +import java.util.Objects; +import java.util.Set; +import org.checkerframework.checker.nullness.qual.Nullable; +import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags; +import org.openapijsonschematools.client.configurations.SchemaConfiguration; +import org.openapijsonschematools.client.exceptions.InvalidAdditionalPropertyException; +import org.openapijsonschematools.client.exceptions.UnsetPropertyException; +import org.openapijsonschematools.client.exceptions.ValidationException; +import org.openapijsonschematools.client.schemas.GenericBuilder; +import org.openapijsonschematools.client.schemas.StringJsonSchema; +import org.openapijsonschematools.client.schemas.UnsetAddPropsSetter; +import org.openapijsonschematools.client.schemas.validation.FrozenMap; +import org.openapijsonschematools.client.schemas.validation.JsonSchema; +import org.openapijsonschematools.client.schemas.validation.JsonSchemaInfo; +import org.openapijsonschematools.client.schemas.validation.MapSchemaValidator; +import org.openapijsonschematools.client.schemas.validation.PathToSchemasMap; +import org.openapijsonschematools.client.schemas.validation.PropertyEntry; +import org.openapijsonschematools.client.schemas.validation.ValidationMetadata; + +public class ReadOnlyFirst { + // nest classes so all schemas and input/output classes can be public + + + public static class Bar extends StringJsonSchema.StringJsonSchema1 { + private static @Nullable Bar instance = null; + public static Bar getInstance() { + if (instance == null) { + instance = new Bar(); + } + return instance; + } + } + + + public static class Baz extends StringJsonSchema.StringJsonSchema1 { + private static @Nullable Baz instance = null; + public static Baz getInstance() { + if (instance == null) { + instance = new Baz(); + } + return instance; + } + } + + + public static class ReadOnlyFirstMap extends FrozenMap<@Nullable Object> { + protected ReadOnlyFirstMap(FrozenMap<@Nullable Object> m) { + super(m); + } + public static final Set requiredKeys = Set.of(); + public static final Set optionalKeys = Set.of( + "bar", + "baz" + ); + public static ReadOnlyFirstMap of(Map arg, SchemaConfiguration configuration) throws ValidationException { + return ReadOnlyFirst1.getInstance().validate(arg, configuration); + } + + public String bar() throws UnsetPropertyException { + String key = "bar"; + throwIfKeyNotPresent(key); + @Nullable Object value = get(key); + if (!(value instanceof String)) { + throw new RuntimeException("Invalid value stored for bar"); + } + return (String) value; + } + + public String baz() throws UnsetPropertyException { + String key = "baz"; + throwIfKeyNotPresent(key); + @Nullable Object value = get(key); + if (!(value instanceof String)) { + throw new RuntimeException("Invalid value stored for baz"); + } + return (String) value; + } + + public @Nullable Object getAdditionalProperty(String name) throws UnsetPropertyException, InvalidAdditionalPropertyException { + throwIfKeyKnown(name, requiredKeys, optionalKeys); + throwIfKeyNotPresent(name); + return get(name); + } + } + + public interface SetterForBar { + Map getInstance(); + T getBuilderAfterBar(Map instance); + + default T bar(String value) { + var instance = getInstance(); + instance.put("bar", value); + return getBuilderAfterBar(instance); + } + } + + public interface SetterForBaz { + Map getInstance(); + T getBuilderAfterBaz(Map instance); + + default T baz(String value) { + var instance = getInstance(); + instance.put("baz", value); + return getBuilderAfterBaz(instance); + } + } + + public static class ReadOnlyFirstMapBuilder extends UnsetAddPropsSetter implements GenericBuilder>, SetterForBar, SetterForBaz { + private final Map instance; + private static final Set knownKeys = Set.of( + "bar", + "baz" + ); + public Set getKnownKeys() { + return knownKeys; + } + public ReadOnlyFirstMapBuilder() { + this.instance = new LinkedHashMap<>(); + } + public Map build() { + return instance; + } + public Map getInstance() { + return instance; + } + public ReadOnlyFirstMapBuilder getBuilderAfterBar(Map instance) { + return this; + } + public ReadOnlyFirstMapBuilder getBuilderAfterBaz(Map instance) { + return this; + } + public ReadOnlyFirstMapBuilder getBuilderAfterAdditionalProperty(Map instance) { + return this; + } + } + + + public sealed interface ReadOnlyFirst1Boxed permits ReadOnlyFirst1BoxedMap { + @Nullable Object getData(); + } + + public record ReadOnlyFirst1BoxedMap(ReadOnlyFirstMap data) implements ReadOnlyFirst1Boxed { + @Override + public @Nullable Object getData() { + return data; + } + } + + + public static class ReadOnlyFirst1 extends JsonSchema implements MapSchemaValidator { + /* + NOTE: This class is auto generated by OpenAPI JSON Schema Generator. + Ref: https://github.com/openapi-json-schema-tools/openapi-json-schema-generator + + Do not edit the class manually. + */ + private static @Nullable ReadOnlyFirst1 instance = null; + + protected ReadOnlyFirst1() { + super(new JsonSchemaInfo() + .type(Set.of(Map.class)) + .properties(Map.ofEntries( + new PropertyEntry("bar", Bar.class), + new PropertyEntry("baz", Baz.class) + )) + ); + } + + public static ReadOnlyFirst1 getInstance() { + if (instance == null) { + instance = new ReadOnlyFirst1(); + } + return instance; + } + + 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 RuntimeException("Invalid non-string key value"); + } + String propertyName = (String) entryKey; + List propertyPathToItem = new ArrayList<>(pathToItem); + propertyPathToItem.add(propertyName); + Object value = entry.getValue(); + LinkedHashMap, Nothing?> schemas = pathToSchemas.get(propertyPathToItem); + if (schemas == null) { + throw new RuntimeException("Validation result is invalid, schemas must exist for a pathToItem"); + } + JsonSchema propertySchema = schemas.entrySet().iterator().next().getKey(); + @Nullable Object propertyInstance = propertySchema.getNewInstance(value, propertyPathToItem, pathToSchemas); + properties.put(propertyName, propertyInstance); + } + FrozenMap<@Nullable Object> castProperties = new FrozenMap<>(properties); + return new ReadOnlyFirstMap(castProperties); + } + + 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); + SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().build())); + ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, new PathToSchemasMap(), new LinkedHashSet<>()); + PathToSchemasMap pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet); + return getNewInstance(castArg, validationMetadata.pathToItem(), pathToSchemasMap); + } + + + @Override + public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws 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"); + } + @Override + public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { + if (arg instanceof Map) { + return getNewInstance((Map) arg, pathToItem, pathToSchemas); + } + 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 { + return new ReadOnlyFirst1BoxedMap(validate(arg, configuration)); + } + @Override + public ReadOnlyFirst1Boxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { + 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"); + } + } + +} diff --git a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/schemas/RefPet.kt b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/schemas/RefPet.kt new file mode 100644 index 00000000000..08574fbbc86 --- /dev/null +++ b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/schemas/RefPet.kt @@ -0,0 +1,18 @@ +package org.openapijsonschematools.client.components.schemas; + +import org.checkerframework.checker.nullness.qual.Nullable; + +public class RefPet extends Pet { + // $refed class + + + public static class RefPet1 extends Pet1 { + private static @Nullable RefPet1 instance = null; + public static RefPet1 getInstance() { + if (instance == null) { + instance = new RefPet1(); + } + return instance; + } + } +} diff --git a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/schemas/ReqPropsFromExplicitAddProps.kt b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/schemas/ReqPropsFromExplicitAddProps.kt new file mode 100644 index 00000000000..ad149650b05 --- /dev/null +++ b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/schemas/ReqPropsFromExplicitAddProps.kt @@ -0,0 +1,272 @@ +package org.openapijsonschematools.client.components.schemas; +import java.util.ArrayList; +import java.util.HashSet; +import java.util.LinkedHashMap; +import java.util.LinkedHashSet; +import java.util.List; +import java.util.Map; +import java.util.Objects; +import java.util.Set; +import org.checkerframework.checker.nullness.qual.Nullable; +import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags; +import org.openapijsonschematools.client.configurations.SchemaConfiguration; +import org.openapijsonschematools.client.exceptions.InvalidAdditionalPropertyException; +import org.openapijsonschematools.client.exceptions.UnsetPropertyException; +import org.openapijsonschematools.client.exceptions.ValidationException; +import org.openapijsonschematools.client.schemas.GenericBuilder; +import org.openapijsonschematools.client.schemas.StringJsonSchema; +import org.openapijsonschematools.client.schemas.validation.FrozenMap; +import org.openapijsonschematools.client.schemas.validation.JsonSchema; +import org.openapijsonschematools.client.schemas.validation.JsonSchemaInfo; +import org.openapijsonschematools.client.schemas.validation.MapSchemaValidator; +import org.openapijsonschematools.client.schemas.validation.MapUtils; +import org.openapijsonschematools.client.schemas.validation.PathToSchemasMap; +import org.openapijsonschematools.client.schemas.validation.ValidationMetadata; + +public class ReqPropsFromExplicitAddProps { + // nest classes so all schemas and input/output classes can be public + + + public static class AdditionalProperties extends StringJsonSchema.StringJsonSchema1 { + private static @Nullable AdditionalProperties instance = null; + public static AdditionalProperties getInstance() { + if (instance == null) { + instance = new AdditionalProperties(); + } + return instance; + } + } + + + public static class ReqPropsFromExplicitAddPropsMap extends FrozenMap { + protected ReqPropsFromExplicitAddPropsMap(FrozenMap m) { + super(m); + } + public static final Set requiredKeys = Set.of( + "invalid-name", + "validName" + ); + public static final Set optionalKeys = Set.of(); + public static ReqPropsFromExplicitAddPropsMap of(Map arg, SchemaConfiguration configuration) throws ValidationException { + return ReqPropsFromExplicitAddProps1.getInstance().validate(arg, configuration); + } + + public String validName() { + try { + return getOrThrow("version"); + } catch (UnsetPropertyException e) { + throw new RuntimeException(e); + } + } + + public String getAdditionalProperty(String name) throws UnsetPropertyException, InvalidAdditionalPropertyException { + throwIfKeyKnown(name, requiredKeys, optionalKeys); + return getOrThrow(name); + } + } + + public interface SetterForInvalidname { + Map getInstance(); + T getBuilderAfterInvalidname(Map instance); + + default T invalidHyphenMinusName(String value) { + var instance = getInstance(); + instance.put("invalid-name", value); + return getBuilderAfterInvalidname(instance); + } + } + + public interface SetterForValidName { + Map getInstance(); + T getBuilderAfterValidName(Map instance); + + default T validName(String value) { + var instance = getInstance(); + instance.put("validName", value); + return getBuilderAfterValidName(instance); + } + } + + public interface SetterForAdditionalProperties { + Set getKnownKeys(); + Map getInstance(); + T getBuilderAfterAdditionalProperty(Map instance); + + default T additionalProperty(String key, String value) throws InvalidAdditionalPropertyException { + MapUtils.throwIfKeyKnown(key, getKnownKeys(), true); + var instance = getInstance(); + instance.put(key, value); + return getBuilderAfterAdditionalProperty(instance); + } + } + + public static class ReqPropsFromExplicitAddPropsMap00Builder implements GenericBuilder>, SetterForAdditionalProperties { + private final Map instance; + private static final Set knownKeys = Set.of( + "invalid-name", + "validName" + ); + public Set getKnownKeys() { + return knownKeys; + } + public ReqPropsFromExplicitAddPropsMap00Builder(Map instance) { + this.instance = instance; + } + public Map build() { + return instance; + } + public Map getInstance() { + return instance; + } + public ReqPropsFromExplicitAddPropsMap00Builder getBuilderAfterAdditionalProperty(Map instance) { + return this; + } + } + + public static class ReqPropsFromExplicitAddPropsMap01Builder implements SetterForValidName { + private final Map instance; + public ReqPropsFromExplicitAddPropsMap01Builder(Map instance) { + this.instance = instance; + } + public Map getInstance() { + return instance; + } + public ReqPropsFromExplicitAddPropsMap00Builder getBuilderAfterValidName(Map instance) { + return new ReqPropsFromExplicitAddPropsMap00Builder(instance); + } + } + + public static class ReqPropsFromExplicitAddPropsMap10Builder implements SetterForInvalidname { + private final Map instance; + public ReqPropsFromExplicitAddPropsMap10Builder(Map instance) { + this.instance = instance; + } + public Map getInstance() { + return instance; + } + public ReqPropsFromExplicitAddPropsMap00Builder getBuilderAfterInvalidname(Map instance) { + return new ReqPropsFromExplicitAddPropsMap00Builder(instance); + } + } + + public static class ReqPropsFromExplicitAddPropsMapBuilder implements SetterForInvalidname, SetterForValidName { + private final Map instance; + public ReqPropsFromExplicitAddPropsMapBuilder() { + this.instance = new LinkedHashMap<>(); + } + public Map getInstance() { + return instance; + } + public ReqPropsFromExplicitAddPropsMap01Builder getBuilderAfterInvalidname(Map instance) { + return new ReqPropsFromExplicitAddPropsMap01Builder(instance); + } + public ReqPropsFromExplicitAddPropsMap10Builder getBuilderAfterValidName(Map instance) { + return new ReqPropsFromExplicitAddPropsMap10Builder(instance); + } + } + + + public sealed interface ReqPropsFromExplicitAddProps1Boxed permits ReqPropsFromExplicitAddProps1BoxedMap { + @Nullable Object getData(); + } + + public record ReqPropsFromExplicitAddProps1BoxedMap(ReqPropsFromExplicitAddPropsMap data) implements ReqPropsFromExplicitAddProps1Boxed { + @Override + public @Nullable Object getData() { + return data; + } + } + + + public static class ReqPropsFromExplicitAddProps1 extends JsonSchema implements MapSchemaValidator { + /* + NOTE: This class is auto generated by OpenAPI JSON Schema Generator. + Ref: https://github.com/openapi-json-schema-tools/openapi-json-schema-generator + + Do not edit the class manually. + */ + private static @Nullable ReqPropsFromExplicitAddProps1 instance = null; + + protected ReqPropsFromExplicitAddProps1() { + super(new JsonSchemaInfo() + .type(Set.of(Map.class)) + .required(Set.of( + "invalid-name", + "validName" + )) + .additionalProperties(AdditionalProperties.class) + ); + } + + public static ReqPropsFromExplicitAddProps1 getInstance() { + if (instance == null) { + instance = new ReqPropsFromExplicitAddProps1(); + } + return instance; + } + + 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 RuntimeException("Invalid non-string key value"); + } + String propertyName = (String) entryKey; + List propertyPathToItem = new ArrayList<>(pathToItem); + propertyPathToItem.add(propertyName); + Object value = entry.getValue(); + LinkedHashMap, Nothing?> schemas = pathToSchemas.get(propertyPathToItem); + if (schemas == null) { + throw new RuntimeException("Validation 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"); + } + properties.put(propertyName, (String) propertyInstance); + } + FrozenMap castProperties = new FrozenMap<>(properties); + return new ReqPropsFromExplicitAddPropsMap(castProperties); + } + + 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); + SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().build())); + ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, new PathToSchemasMap(), new LinkedHashSet<>()); + PathToSchemasMap pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet); + return getNewInstance(castArg, validationMetadata.pathToItem(), pathToSchemasMap); + } + + + @Override + public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws 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"); + } + @Override + public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { + if (arg instanceof Map) { + return getNewInstance((Map) arg, pathToItem, pathToSchemas); + } + 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 { + return new ReqPropsFromExplicitAddProps1BoxedMap(validate(arg, configuration)); + } + @Override + public ReqPropsFromExplicitAddProps1Boxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { + 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"); + } + } + +} diff --git a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/schemas/ReqPropsFromTrueAddProps.kt b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/schemas/ReqPropsFromTrueAddProps.kt new file mode 100644 index 00000000000..062ef60050b --- /dev/null +++ b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/schemas/ReqPropsFromTrueAddProps.kt @@ -0,0 +1,421 @@ +package org.openapijsonschematools.client.components.schemas; +import java.util.ArrayList; +import java.util.HashSet; +import java.util.LinkedHashMap; +import java.util.LinkedHashSet; +import java.util.List; +import java.util.Map; +import java.util.Objects; +import java.util.Set; +import org.checkerframework.checker.nullness.qual.Nullable; +import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags; +import org.openapijsonschematools.client.configurations.SchemaConfiguration; +import org.openapijsonschematools.client.exceptions.InvalidAdditionalPropertyException; +import org.openapijsonschematools.client.exceptions.UnsetPropertyException; +import org.openapijsonschematools.client.exceptions.ValidationException; +import org.openapijsonschematools.client.schemas.AnyTypeJsonSchema; +import org.openapijsonschematools.client.schemas.GenericBuilder; +import org.openapijsonschematools.client.schemas.validation.FrozenMap; +import org.openapijsonschematools.client.schemas.validation.JsonSchema; +import org.openapijsonschematools.client.schemas.validation.JsonSchemaInfo; +import org.openapijsonschematools.client.schemas.validation.MapSchemaValidator; +import org.openapijsonschematools.client.schemas.validation.MapUtils; +import org.openapijsonschematools.client.schemas.validation.PathToSchemasMap; +import org.openapijsonschematools.client.schemas.validation.ValidationMetadata; + +public class ReqPropsFromTrueAddProps { + // nest classes so all schemas and input/output classes can be public + + + public static class AdditionalProperties extends AnyTypeJsonSchema.AnyTypeJsonSchema1 { + private static @Nullable AdditionalProperties instance = null; + public static AdditionalProperties getInstance() { + if (instance == null) { + instance = new AdditionalProperties(); + } + return instance; + } + } + + + public static class ReqPropsFromTrueAddPropsMap extends FrozenMap<@Nullable Object> { + protected ReqPropsFromTrueAddPropsMap(FrozenMap<@Nullable Object> m) { + super(m); + } + public static final Set requiredKeys = Set.of( + "invalid-name", + "validName" + ); + public static final Set optionalKeys = Set.of(); + public static ReqPropsFromTrueAddPropsMap of(Map arg, SchemaConfiguration configuration) throws ValidationException { + return ReqPropsFromTrueAddProps1.getInstance().validate(arg, configuration); + } + + public @Nullable Object validName() { + try { + return getOrThrow("version"); + } catch (UnsetPropertyException e) { + throw new RuntimeException(e); + } + } + + public @Nullable Object getAdditionalProperty(String name) throws UnsetPropertyException, InvalidAdditionalPropertyException { + throwIfKeyKnown(name, requiredKeys, optionalKeys); + return getOrThrow(name); + } + } + + public interface SetterForInvalidname { + Map getInstance(); + T getBuilderAfterInvalidname(Map instance); + + default T invalidHyphenMinusName(Nothing? value) { + var instance = getInstance(); + instance.put("invalid-name", null); + return getBuilderAfterInvalidname(instance); + } + + default T invalidHyphenMinusName(boolean value) { + var instance = getInstance(); + instance.put("invalid-name", value); + return getBuilderAfterInvalidname(instance); + } + + default T invalidHyphenMinusName(String value) { + var instance = getInstance(); + instance.put("invalid-name", value); + return getBuilderAfterInvalidname(instance); + } + + default T invalidHyphenMinusName(int value) { + var instance = getInstance(); + instance.put("invalid-name", value); + return getBuilderAfterInvalidname(instance); + } + + default T invalidHyphenMinusName(float value) { + var instance = getInstance(); + instance.put("invalid-name", value); + return getBuilderAfterInvalidname(instance); + } + + default T invalidHyphenMinusName(long value) { + var instance = getInstance(); + instance.put("invalid-name", value); + return getBuilderAfterInvalidname(instance); + } + + default T invalidHyphenMinusName(double value) { + var instance = getInstance(); + instance.put("invalid-name", value); + return getBuilderAfterInvalidname(instance); + } + + default T invalidHyphenMinusName(List value) { + var instance = getInstance(); + instance.put("invalid-name", value); + return getBuilderAfterInvalidname(instance); + } + + default T invalidHyphenMinusName(Map value) { + var instance = getInstance(); + instance.put("invalid-name", value); + return getBuilderAfterInvalidname(instance); + } + } + + public interface SetterForValidName { + Map getInstance(); + T getBuilderAfterValidName(Map instance); + + default T validName(Nothing? value) { + var instance = getInstance(); + instance.put("validName", null); + return getBuilderAfterValidName(instance); + } + + default T validName(boolean value) { + var instance = getInstance(); + instance.put("validName", value); + return getBuilderAfterValidName(instance); + } + + default T validName(String value) { + var instance = getInstance(); + instance.put("validName", value); + return getBuilderAfterValidName(instance); + } + + default T validName(int value) { + var instance = getInstance(); + instance.put("validName", value); + return getBuilderAfterValidName(instance); + } + + default T validName(float value) { + var instance = getInstance(); + instance.put("validName", value); + return getBuilderAfterValidName(instance); + } + + default T validName(long value) { + var instance = getInstance(); + instance.put("validName", value); + return getBuilderAfterValidName(instance); + } + + default T validName(double value) { + var instance = getInstance(); + instance.put("validName", value); + return getBuilderAfterValidName(instance); + } + + default T validName(List value) { + var instance = getInstance(); + instance.put("validName", value); + return getBuilderAfterValidName(instance); + } + + default T validName(Map value) { + var instance = getInstance(); + instance.put("validName", value); + return getBuilderAfterValidName(instance); + } + } + + public interface SetterForAdditionalProperties { + Set getKnownKeys(); + Map getInstance(); + T getBuilderAfterAdditionalProperty(Map instance); + + default T additionalProperty(String key, Nothing? value) throws InvalidAdditionalPropertyException { + MapUtils.throwIfKeyKnown(key, getKnownKeys(), true); + var instance = getInstance(); + instance.put(key, null); + return getBuilderAfterAdditionalProperty(instance); + } + + default T additionalProperty(String key, boolean value) throws InvalidAdditionalPropertyException { + MapUtils.throwIfKeyKnown(key, getKnownKeys(), true); + var instance = getInstance(); + instance.put(key, value); + return getBuilderAfterAdditionalProperty(instance); + } + + default T additionalProperty(String key, String value) throws InvalidAdditionalPropertyException { + MapUtils.throwIfKeyKnown(key, getKnownKeys(), true); + var instance = getInstance(); + instance.put(key, value); + return getBuilderAfterAdditionalProperty(instance); + } + + default T additionalProperty(String key, int value) throws InvalidAdditionalPropertyException { + MapUtils.throwIfKeyKnown(key, getKnownKeys(), true); + var instance = getInstance(); + instance.put(key, value); + return getBuilderAfterAdditionalProperty(instance); + } + + default T additionalProperty(String key, float value) throws InvalidAdditionalPropertyException { + MapUtils.throwIfKeyKnown(key, getKnownKeys(), true); + var instance = getInstance(); + instance.put(key, value); + return getBuilderAfterAdditionalProperty(instance); + } + + default T additionalProperty(String key, long value) throws InvalidAdditionalPropertyException { + MapUtils.throwIfKeyKnown(key, getKnownKeys(), true); + var instance = getInstance(); + instance.put(key, value); + return getBuilderAfterAdditionalProperty(instance); + } + + default T additionalProperty(String key, double value) throws InvalidAdditionalPropertyException { + MapUtils.throwIfKeyKnown(key, getKnownKeys(), true); + var instance = getInstance(); + instance.put(key, value); + return getBuilderAfterAdditionalProperty(instance); + } + + default T additionalProperty(String key, List value) throws InvalidAdditionalPropertyException { + MapUtils.throwIfKeyKnown(key, getKnownKeys(), true); + var instance = getInstance(); + instance.put(key, value); + return getBuilderAfterAdditionalProperty(instance); + } + + default T additionalProperty(String key, Map value) throws InvalidAdditionalPropertyException { + MapUtils.throwIfKeyKnown(key, getKnownKeys(), true); + var instance = getInstance(); + instance.put(key, value); + return getBuilderAfterAdditionalProperty(instance); + } + } + + public static class ReqPropsFromTrueAddPropsMap00Builder implements GenericBuilder>, SetterForAdditionalProperties { + private final Map instance; + private static final Set knownKeys = Set.of( + "invalid-name", + "validName" + ); + public Set getKnownKeys() { + return knownKeys; + } + public ReqPropsFromTrueAddPropsMap00Builder(Map instance) { + this.instance = instance; + } + public Map build() { + return instance; + } + public Map getInstance() { + return instance; + } + public ReqPropsFromTrueAddPropsMap00Builder getBuilderAfterAdditionalProperty(Map instance) { + return this; + } + } + + public static class ReqPropsFromTrueAddPropsMap01Builder implements SetterForValidName { + private final Map instance; + public ReqPropsFromTrueAddPropsMap01Builder(Map instance) { + this.instance = instance; + } + public Map getInstance() { + return instance; + } + public ReqPropsFromTrueAddPropsMap00Builder getBuilderAfterValidName(Map instance) { + return new ReqPropsFromTrueAddPropsMap00Builder(instance); + } + } + + public static class ReqPropsFromTrueAddPropsMap10Builder implements SetterForInvalidname { + private final Map instance; + public ReqPropsFromTrueAddPropsMap10Builder(Map instance) { + this.instance = instance; + } + public Map getInstance() { + return instance; + } + public ReqPropsFromTrueAddPropsMap00Builder getBuilderAfterInvalidname(Map instance) { + return new ReqPropsFromTrueAddPropsMap00Builder(instance); + } + } + + public static class ReqPropsFromTrueAddPropsMapBuilder implements SetterForInvalidname, SetterForValidName { + private final Map instance; + public ReqPropsFromTrueAddPropsMapBuilder() { + this.instance = new LinkedHashMap<>(); + } + public Map getInstance() { + return instance; + } + public ReqPropsFromTrueAddPropsMap01Builder getBuilderAfterInvalidname(Map instance) { + return new ReqPropsFromTrueAddPropsMap01Builder(instance); + } + public ReqPropsFromTrueAddPropsMap10Builder getBuilderAfterValidName(Map instance) { + return new ReqPropsFromTrueAddPropsMap10Builder(instance); + } + } + + + public sealed interface ReqPropsFromTrueAddProps1Boxed permits ReqPropsFromTrueAddProps1BoxedMap { + @Nullable Object getData(); + } + + public record ReqPropsFromTrueAddProps1BoxedMap(ReqPropsFromTrueAddPropsMap data) implements ReqPropsFromTrueAddProps1Boxed { + @Override + public @Nullable Object getData() { + return data; + } + } + + + public static class ReqPropsFromTrueAddProps1 extends JsonSchema implements MapSchemaValidator { + /* + NOTE: This class is auto generated by OpenAPI JSON Schema Generator. + Ref: https://github.com/openapi-json-schema-tools/openapi-json-schema-generator + + Do not edit the class manually. + */ + private static @Nullable ReqPropsFromTrueAddProps1 instance = null; + + protected ReqPropsFromTrueAddProps1() { + super(new JsonSchemaInfo() + .type(Set.of(Map.class)) + .required(Set.of( + "invalid-name", + "validName" + )) + .additionalProperties(AdditionalProperties.class) + ); + } + + public static ReqPropsFromTrueAddProps1 getInstance() { + if (instance == null) { + instance = new ReqPropsFromTrueAddProps1(); + } + return instance; + } + + 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 RuntimeException("Invalid non-string key value"); + } + String propertyName = (String) entryKey; + List propertyPathToItem = new ArrayList<>(pathToItem); + propertyPathToItem.add(propertyName); + Object value = entry.getValue(); + LinkedHashMap, Nothing?> schemas = pathToSchemas.get(propertyPathToItem); + if (schemas == null) { + throw new RuntimeException("Validation result is invalid, schemas must exist for a pathToItem"); + } + JsonSchema propertySchema = schemas.entrySet().iterator().next().getKey(); + @Nullable Object propertyInstance = propertySchema.getNewInstance(value, propertyPathToItem, pathToSchemas); + properties.put(propertyName, propertyInstance); + } + FrozenMap<@Nullable Object> castProperties = new FrozenMap<>(properties); + return new ReqPropsFromTrueAddPropsMap(castProperties); + } + + 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); + SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().build())); + ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, new PathToSchemasMap(), new LinkedHashSet<>()); + PathToSchemasMap pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet); + return getNewInstance(castArg, validationMetadata.pathToItem(), pathToSchemasMap); + } + + + @Override + public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws 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"); + } + @Override + public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { + if (arg instanceof Map) { + return getNewInstance((Map) arg, pathToItem, pathToSchemas); + } + 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 { + return new ReqPropsFromTrueAddProps1BoxedMap(validate(arg, configuration)); + } + @Override + public ReqPropsFromTrueAddProps1Boxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { + 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"); + } + } + +} diff --git a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/schemas/ReqPropsFromUnsetAddProps.kt b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/schemas/ReqPropsFromUnsetAddProps.kt new file mode 100644 index 00000000000..ef600c19648 --- /dev/null +++ b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/schemas/ReqPropsFromUnsetAddProps.kt @@ -0,0 +1,340 @@ +package org.openapijsonschematools.client.components.schemas; +import java.util.ArrayList; +import java.util.HashSet; +import java.util.LinkedHashMap; +import java.util.LinkedHashSet; +import java.util.List; +import java.util.Map; +import java.util.Objects; +import java.util.Set; +import org.checkerframework.checker.nullness.qual.Nullable; +import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags; +import org.openapijsonschematools.client.configurations.SchemaConfiguration; +import org.openapijsonschematools.client.exceptions.InvalidAdditionalPropertyException; +import org.openapijsonschematools.client.exceptions.UnsetPropertyException; +import org.openapijsonschematools.client.exceptions.ValidationException; +import org.openapijsonschematools.client.schemas.GenericBuilder; +import org.openapijsonschematools.client.schemas.UnsetAddPropsSetter; +import org.openapijsonschematools.client.schemas.validation.FrozenMap; +import org.openapijsonschematools.client.schemas.validation.JsonSchema; +import org.openapijsonschematools.client.schemas.validation.JsonSchemaInfo; +import org.openapijsonschematools.client.schemas.validation.MapSchemaValidator; +import org.openapijsonschematools.client.schemas.validation.PathToSchemasMap; +import org.openapijsonschematools.client.schemas.validation.ValidationMetadata; + +public class ReqPropsFromUnsetAddProps { + // nest classes so all schemas and input/output classes can be public + + + public static class ReqPropsFromUnsetAddPropsMap extends FrozenMap<@Nullable Object> { + protected ReqPropsFromUnsetAddPropsMap(FrozenMap<@Nullable Object> m) { + super(m); + } + public static final Set requiredKeys = Set.of( + "invalid-name", + "validName" + ); + public static final Set optionalKeys = Set.of(); + public static ReqPropsFromUnsetAddPropsMap of(Map arg, SchemaConfiguration configuration) throws ValidationException { + return ReqPropsFromUnsetAddProps1.getInstance().validate(arg, configuration); + } + + public @Nullable Object validName() { + try { + return getOrThrow("version"); + } catch (UnsetPropertyException e) { + throw new RuntimeException(e); + } + } + + public @Nullable Object getAdditionalProperty(String name) throws UnsetPropertyException, InvalidAdditionalPropertyException { + throwIfKeyKnown(name, requiredKeys, optionalKeys); + throwIfKeyNotPresent(name); + return get(name); + } + } + + public interface SetterForInvalidname { + Map getInstance(); + T getBuilderAfterInvalidname(Map instance); + + default T invalidHyphenMinusName(Nothing? value) { + var instance = getInstance(); + instance.put("invalid-name", null); + return getBuilderAfterInvalidname(instance); + } + + default T invalidHyphenMinusName(boolean value) { + var instance = getInstance(); + instance.put("invalid-name", value); + return getBuilderAfterInvalidname(instance); + } + + default T invalidHyphenMinusName(String value) { + var instance = getInstance(); + instance.put("invalid-name", value); + return getBuilderAfterInvalidname(instance); + } + + default T invalidHyphenMinusName(int value) { + var instance = getInstance(); + instance.put("invalid-name", value); + return getBuilderAfterInvalidname(instance); + } + + default T invalidHyphenMinusName(float value) { + var instance = getInstance(); + instance.put("invalid-name", value); + return getBuilderAfterInvalidname(instance); + } + + default T invalidHyphenMinusName(long value) { + var instance = getInstance(); + instance.put("invalid-name", value); + return getBuilderAfterInvalidname(instance); + } + + default T invalidHyphenMinusName(double value) { + var instance = getInstance(); + instance.put("invalid-name", value); + return getBuilderAfterInvalidname(instance); + } + + default T invalidHyphenMinusName(List value) { + var instance = getInstance(); + instance.put("invalid-name", value); + return getBuilderAfterInvalidname(instance); + } + + default T invalidHyphenMinusName(Map value) { + var instance = getInstance(); + instance.put("invalid-name", value); + return getBuilderAfterInvalidname(instance); + } + } + + public interface SetterForValidName { + Map getInstance(); + T getBuilderAfterValidName(Map instance); + + default T validName(Nothing? value) { + var instance = getInstance(); + instance.put("validName", null); + return getBuilderAfterValidName(instance); + } + + default T validName(boolean value) { + var instance = getInstance(); + instance.put("validName", value); + return getBuilderAfterValidName(instance); + } + + default T validName(String value) { + var instance = getInstance(); + instance.put("validName", value); + return getBuilderAfterValidName(instance); + } + + default T validName(int value) { + var instance = getInstance(); + instance.put("validName", value); + return getBuilderAfterValidName(instance); + } + + default T validName(float value) { + var instance = getInstance(); + instance.put("validName", value); + return getBuilderAfterValidName(instance); + } + + default T validName(long value) { + var instance = getInstance(); + instance.put("validName", value); + return getBuilderAfterValidName(instance); + } + + default T validName(double value) { + var instance = getInstance(); + instance.put("validName", value); + return getBuilderAfterValidName(instance); + } + + default T validName(List value) { + var instance = getInstance(); + instance.put("validName", value); + return getBuilderAfterValidName(instance); + } + + default T validName(Map value) { + var instance = getInstance(); + instance.put("validName", value); + return getBuilderAfterValidName(instance); + } + } + + public static class ReqPropsFromUnsetAddPropsMap00Builder extends UnsetAddPropsSetter implements GenericBuilder> { + private final Map instance; + private static final Set knownKeys = Set.of( + "invalid-name", + "validName" + ); + public Set getKnownKeys() { + return knownKeys; + } + public ReqPropsFromUnsetAddPropsMap00Builder(Map instance) { + this.instance = instance; + } + public Map build() { + return instance; + } + public Map getInstance() { + return instance; + } + public ReqPropsFromUnsetAddPropsMap00Builder getBuilderAfterAdditionalProperty(Map instance) { + return this; + } + } + + public static class ReqPropsFromUnsetAddPropsMap01Builder implements SetterForValidName { + private final Map instance; + public ReqPropsFromUnsetAddPropsMap01Builder(Map instance) { + this.instance = instance; + } + public Map getInstance() { + return instance; + } + public ReqPropsFromUnsetAddPropsMap00Builder getBuilderAfterValidName(Map instance) { + return new ReqPropsFromUnsetAddPropsMap00Builder(instance); + } + } + + public static class ReqPropsFromUnsetAddPropsMap10Builder implements SetterForInvalidname { + private final Map instance; + public ReqPropsFromUnsetAddPropsMap10Builder(Map instance) { + this.instance = instance; + } + public Map getInstance() { + return instance; + } + public ReqPropsFromUnsetAddPropsMap00Builder getBuilderAfterInvalidname(Map instance) { + return new ReqPropsFromUnsetAddPropsMap00Builder(instance); + } + } + + public static class ReqPropsFromUnsetAddPropsMapBuilder implements SetterForInvalidname, SetterForValidName { + private final Map instance; + public ReqPropsFromUnsetAddPropsMapBuilder() { + this.instance = new LinkedHashMap<>(); + } + public Map getInstance() { + return instance; + } + public ReqPropsFromUnsetAddPropsMap01Builder getBuilderAfterInvalidname(Map instance) { + return new ReqPropsFromUnsetAddPropsMap01Builder(instance); + } + public ReqPropsFromUnsetAddPropsMap10Builder getBuilderAfterValidName(Map instance) { + return new ReqPropsFromUnsetAddPropsMap10Builder(instance); + } + } + + + public sealed interface ReqPropsFromUnsetAddProps1Boxed permits ReqPropsFromUnsetAddProps1BoxedMap { + @Nullable Object getData(); + } + + public record ReqPropsFromUnsetAddProps1BoxedMap(ReqPropsFromUnsetAddPropsMap data) implements ReqPropsFromUnsetAddProps1Boxed { + @Override + public @Nullable Object getData() { + return data; + } + } + + + public static class ReqPropsFromUnsetAddProps1 extends JsonSchema implements MapSchemaValidator { + /* + NOTE: This class is auto generated by OpenAPI JSON Schema Generator. + Ref: https://github.com/openapi-json-schema-tools/openapi-json-schema-generator + + Do not edit the class manually. + */ + private static @Nullable ReqPropsFromUnsetAddProps1 instance = null; + + protected ReqPropsFromUnsetAddProps1() { + super(new JsonSchemaInfo() + .type(Set.of(Map.class)) + .required(Set.of( + "invalid-name", + "validName" + )) + ); + } + + public static ReqPropsFromUnsetAddProps1 getInstance() { + if (instance == null) { + instance = new ReqPropsFromUnsetAddProps1(); + } + return instance; + } + + 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 RuntimeException("Invalid non-string key value"); + } + String propertyName = (String) entryKey; + List propertyPathToItem = new ArrayList<>(pathToItem); + propertyPathToItem.add(propertyName); + Object value = entry.getValue(); + LinkedHashMap, Nothing?> schemas = pathToSchemas.get(propertyPathToItem); + if (schemas == null) { + throw new RuntimeException("Validation result is invalid, schemas must exist for a pathToItem"); + } + JsonSchema propertySchema = schemas.entrySet().iterator().next().getKey(); + @Nullable Object propertyInstance = propertySchema.getNewInstance(value, propertyPathToItem, pathToSchemas); + properties.put(propertyName, propertyInstance); + } + FrozenMap<@Nullable Object> castProperties = new FrozenMap<>(properties); + return new ReqPropsFromUnsetAddPropsMap(castProperties); + } + + 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); + SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().build())); + ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, new PathToSchemasMap(), new LinkedHashSet<>()); + PathToSchemasMap pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet); + return getNewInstance(castArg, validationMetadata.pathToItem(), pathToSchemasMap); + } + + + @Override + public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws 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"); + } + @Override + public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { + if (arg instanceof Map) { + return getNewInstance((Map) arg, pathToItem, pathToSchemas); + } + 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 { + return new ReqPropsFromUnsetAddProps1BoxedMap(validate(arg, configuration)); + } + @Override + public ReqPropsFromUnsetAddProps1Boxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { + 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"); + } + } + +} diff --git a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/schemas/ReturnSchema.kt b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/schemas/ReturnSchema.kt new file mode 100644 index 00000000000..b4bbc31a404 --- /dev/null +++ b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/schemas/ReturnSchema.kt @@ -0,0 +1,407 @@ +package org.openapijsonschematools.client.components.schemas; +import java.time.LocalDate; +import java.time.ZonedDateTime; +import java.util.ArrayList; +import java.util.HashSet; +import java.util.LinkedHashMap; +import java.util.LinkedHashSet; +import java.util.List; +import java.util.Map; +import java.util.Objects; +import java.util.Set; +import java.util.UUID; +import org.checkerframework.checker.nullness.qual.Nullable; +import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags; +import org.openapijsonschematools.client.configurations.SchemaConfiguration; +import org.openapijsonschematools.client.exceptions.InvalidAdditionalPropertyException; +import org.openapijsonschematools.client.exceptions.UnsetPropertyException; +import org.openapijsonschematools.client.exceptions.ValidationException; +import org.openapijsonschematools.client.schemas.GenericBuilder; +import org.openapijsonschematools.client.schemas.Int32JsonSchema; +import org.openapijsonschematools.client.schemas.UnsetAddPropsSetter; +import org.openapijsonschematools.client.schemas.validation.BooleanSchemaValidator; +import org.openapijsonschematools.client.schemas.validation.FrozenList; +import org.openapijsonschematools.client.schemas.validation.FrozenMap; +import org.openapijsonschematools.client.schemas.validation.JsonSchema; +import org.openapijsonschematools.client.schemas.validation.JsonSchemaInfo; +import org.openapijsonschematools.client.schemas.validation.ListSchemaValidator; +import org.openapijsonschematools.client.schemas.validation.MapSchemaValidator; +import org.openapijsonschematools.client.schemas.validation.NullSchemaValidator; +import org.openapijsonschematools.client.schemas.validation.NumberSchemaValidator; +import org.openapijsonschematools.client.schemas.validation.PathToSchemasMap; +import org.openapijsonschematools.client.schemas.validation.PropertyEntry; +import org.openapijsonschematools.client.schemas.validation.StringSchemaValidator; +import org.openapijsonschematools.client.schemas.validation.ValidationMetadata; + +public class ReturnSchema { + // nest classes so all schemas and input/output classes can be public + + + public static class ReturnSchema2 extends Int32JsonSchema.Int32JsonSchema1 { + private static @Nullable ReturnSchema2 instance = null; + public static ReturnSchema2 getInstance() { + if (instance == null) { + instance = new ReturnSchema2(); + } + return instance; + } + } + + + public static class ReturnMap extends FrozenMap<@Nullable Object> { + protected ReturnMap(FrozenMap<@Nullable Object> m) { + super(m); + } + public static final Set requiredKeys = Set.of(); + public static final Set optionalKeys = Set.of( + "return" + ); + public static ReturnMap of(Map arg, SchemaConfiguration configuration) throws ValidationException { + return ReturnSchema1.getInstance().validate(arg, configuration); + } + + public @Nullable Object getAdditionalProperty(String name) throws UnsetPropertyException, InvalidAdditionalPropertyException { + throwIfKeyKnown(name, requiredKeys, optionalKeys); + throwIfKeyNotPresent(name); + return get(name); + } + } + + public interface SetterForReturnSchema2 { + Map getInstance(); + T getBuilderAfterReturnSchema2(Map instance); + + default T setReturn(int value) { + var instance = getInstance(); + instance.put("return", value); + return getBuilderAfterReturnSchema2(instance); + } + + default T setReturn(float value) { + var instance = getInstance(); + instance.put("return", value); + return getBuilderAfterReturnSchema2(instance); + } + } + + public static class ReturnMapBuilder1 extends UnsetAddPropsSetter implements GenericBuilder>, SetterForReturnSchema2 { + private final Map instance; + private static final Set knownKeys = Set.of( + "return" + ); + public Set getKnownKeys() { + return knownKeys; + } + public ReturnMapBuilder1() { + this.instance = new LinkedHashMap<>(); + } + public Map build() { + return instance; + } + public Map getInstance() { + return instance; + } + public ReturnMapBuilder1 getBuilderAfterReturnSchema2(Map instance) { + return this; + } + public ReturnMapBuilder1 getBuilderAfterAdditionalProperty(Map instance) { + return this; + } + } + + + public sealed interface ReturnSchema1Boxed permits ReturnSchema1BoxedVoid, ReturnSchema1BoxedBoolean, ReturnSchema1BoxedNumber, ReturnSchema1BoxedString, ReturnSchema1BoxedList, ReturnSchema1BoxedMap { + @Nullable Object getData(); + } + + public record ReturnSchema1BoxedVoid(Nothing? data) implements ReturnSchema1Boxed { + @Override + public @Nullable Object getData() { + return data; + } + } + + public record ReturnSchema1BoxedBoolean(boolean data) implements ReturnSchema1Boxed { + @Override + public @Nullable Object getData() { + return data; + } + } + + public record ReturnSchema1BoxedNumber(Number data) implements ReturnSchema1Boxed { + @Override + public @Nullable Object getData() { + return data; + } + } + + public record ReturnSchema1BoxedString(String data) implements ReturnSchema1Boxed { + @Override + public @Nullable Object getData() { + return data; + } + } + + public record ReturnSchema1BoxedList(FrozenList<@Nullable Object> data) implements ReturnSchema1Boxed { + @Override + public @Nullable Object getData() { + return data; + } + } + + public record ReturnSchema1BoxedMap(ReturnMap data) implements ReturnSchema1Boxed { + @Override + public @Nullable Object getData() { + return data; + } + } + + + public static class ReturnSchema1 extends JsonSchema implements NullSchemaValidator, BooleanSchemaValidator, NumberSchemaValidator, StringSchemaValidator, ListSchemaValidator, ReturnSchema1BoxedList>, MapSchemaValidator { + /* + NOTE: This class is auto generated by OpenAPI JSON Schema Generator. + Ref: https://github.com/openapi-json-schema-tools/openapi-json-schema-generator + + Do not edit the class manually. + + Model for testing reserved words + */ + private static @Nullable ReturnSchema1 instance = null; + + protected ReturnSchema1() { + super(new JsonSchemaInfo() + .properties(Map.ofEntries( + new PropertyEntry("return", ReturnSchema2.class) + )) + ); + } + + public static ReturnSchema1 getInstance() { + if (instance == null) { + instance = new ReturnSchema1(); + } + return instance; + } + + @Override + public Nothing? validate(Nothing? arg, SchemaConfiguration configuration) throws ValidationException { + Set> pathSet = new HashSet<>(); + List pathToItem = List.of("args[0]"); + Nothing? castArg = castToAllowedTypes(arg, pathToItem, pathSet); + SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().build())); + PathToSchemasMap validatedPathToSchemas = new PathToSchemasMap(); + ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, new LinkedHashSet<>()); + getPathToSchemas(this, castArg, validationMetadata, pathSet); + return castArg; + } + + @Override + public boolean validate(boolean arg, SchemaConfiguration configuration) throws ValidationException { + Set> pathSet = new HashSet<>(); + List pathToItem = List.of("args[0]"); + boolean castArg = castToAllowedTypes(arg, pathToItem, pathSet); + SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().build())); + PathToSchemasMap validatedPathToSchemas = new PathToSchemasMap(); + ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, new LinkedHashSet<>()); + getPathToSchemas(this, castArg, validationMetadata, pathSet); + return castArg; + } + + @Override + public Number validate(Number arg, SchemaConfiguration configuration) throws ValidationException { + Set> pathSet = new HashSet<>(); + List pathToItem = List.of("args[0]"); + Number castArg = castToAllowedTypes(arg, pathToItem, pathSet); + SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().build())); + PathToSchemasMap validatedPathToSchemas = new PathToSchemasMap(); + ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, new LinkedHashSet<>()); + getPathToSchemas(this, castArg, validationMetadata, pathSet); + return castArg; + } + + public int validate(int arg, SchemaConfiguration configuration) throws ValidationException { + return (int) validate((Number) arg, configuration); + } + + public long validate(long arg, SchemaConfiguration configuration) throws ValidationException { + return (long) validate((Number) arg, configuration); + } + + public float validate(float arg, SchemaConfiguration configuration) throws ValidationException { + return (float) validate((Number) arg, configuration); + } + + public double validate(double arg, SchemaConfiguration configuration) throws ValidationException { + return (double) validate((Number) arg, configuration); + } + + @Override + public String validate(String arg, SchemaConfiguration configuration) throws ValidationException { + Set> pathSet = new HashSet<>(); + List pathToItem = List.of("args[0]"); + String castArg = castToAllowedTypes(arg, pathToItem, pathSet); + SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().build())); + PathToSchemasMap validatedPathToSchemas = new PathToSchemasMap(); + ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, new LinkedHashSet<>()); + getPathToSchemas(this, castArg, validationMetadata, pathSet); + return castArg; + } + + public String validate(LocalDate arg, SchemaConfiguration configuration) throws ValidationException { + return validate(arg.toString(), configuration); + } + + public String validate(ZonedDateTime arg, SchemaConfiguration configuration) throws ValidationException { + return validate(arg.toString(), configuration); + } + + public String validate(UUID arg, SchemaConfiguration configuration) throws ValidationException { + return validate(arg.toString(), configuration); + } + + @Override + public FrozenList<@Nullable Object> getNewInstance(List arg, List pathToItem, PathToSchemasMap pathToSchemas) { + List<@Nullable Object> items = new ArrayList<>(); + int i = 0; + for (Object item: arg) { + List itemPathToItem = new ArrayList<>(pathToItem); + itemPathToItem.add(i); + LinkedHashMap, Nothing?> schemas = pathToSchemas.get(itemPathToItem); + if (schemas == null) { + throw new RuntimeException("Validation result is invalid, schemas must exist for a pathToItem"); + } + JsonSchema itemSchema = schemas.entrySet().iterator().next().getKey(); + @Nullable Object itemInstance = itemSchema.getNewInstance(item, itemPathToItem, pathToSchemas); + items.add(itemInstance); + i += 1; + } + FrozenList<@Nullable Object> newInstanceItems = new FrozenList<>(items); + return newInstanceItems; + } + + 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); + SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().build())); + ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, new PathToSchemasMap(), new LinkedHashSet<>()); + PathToSchemasMap pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet); + return getNewInstance(castArg, validationMetadata.pathToItem(), pathToSchemasMap); + } + + @Override + 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 RuntimeException("Invalid non-string key value"); + } + String propertyName = (String) entryKey; + List propertyPathToItem = new ArrayList<>(pathToItem); + propertyPathToItem.add(propertyName); + Object value = entry.getValue(); + LinkedHashMap, Nothing?> schemas = pathToSchemas.get(propertyPathToItem); + if (schemas == null) { + throw new RuntimeException("Validation result is invalid, schemas must exist for a pathToItem"); + } + JsonSchema propertySchema = schemas.entrySet().iterator().next().getKey(); + @Nullable Object propertyInstance = propertySchema.getNewInstance(value, propertyPathToItem, pathToSchemas); + properties.put(propertyName, propertyInstance); + } + FrozenMap<@Nullable Object> castProperties = new FrozenMap<>(properties); + return new ReturnMap(castProperties); + } + + 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); + SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().build())); + PathToSchemasMap validatedPathToSchemas = new PathToSchemasMap(); + ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, new LinkedHashSet<>()); + PathToSchemasMap pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet); + return getNewInstance(castArg, validationMetadata.pathToItem(), pathToSchemasMap); + } + + @Override + public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { + if (arg == null) { + return validate((Nothing?) null, configuration); + } else if (arg instanceof Boolean) { + boolean boolArg = (Boolean) arg; + return validate(boolArg, configuration); + } else if (arg instanceof Number) { + return validate((Number) arg, configuration); + } else if (arg instanceof String) { + return validate((String) arg, configuration); + } else if (arg instanceof List) { + return validate((List) arg, 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"); + } + @Override + public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { + if (arg == null) { + return getNewInstance((Nothing?) null, pathToItem, pathToSchemas); + } else if (arg instanceof Boolean) { + boolean boolArg = (Boolean) arg; + return getNewInstance(boolArg, pathToItem, pathToSchemas); + } else if (arg instanceof Number) { + return getNewInstance((Number) arg, pathToItem, pathToSchemas); + } else if (arg instanceof String) { + return getNewInstance((String) arg, pathToItem, pathToSchemas); + } else if (arg instanceof List) { + return getNewInstance((List) arg, 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"); + } + @Override + public ReturnSchema1BoxedVoid validateAndBox(Nothing? arg, SchemaConfiguration configuration) throws ValidationException { + return new ReturnSchema1BoxedVoid(validate(arg, configuration)); + } + @Override + 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 { + return new ReturnSchema1BoxedNumber(validate(arg, configuration)); + } + @Override + 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 { + return new ReturnSchema1BoxedList(validate(arg, configuration)); + } + @Override + 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 { + if (arg == null) { + Nothing? castArg = (Nothing?) arg; + return validateAndBox(castArg, configuration); + } else if (arg instanceof Boolean booleanArg) { + boolean castArg = booleanArg; + return validateAndBox(castArg, configuration); + } else if (arg instanceof String castArg) { + return validateAndBox(castArg, configuration); + } else if (arg instanceof Number castArg) { + return validateAndBox(castArg, configuration); + } else if (arg instanceof List castArg) { + 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"); + } + } +} diff --git a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/schemas/ScaleneTriangle.kt b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/schemas/ScaleneTriangle.kt new file mode 100644 index 00000000000..b8da956f796 --- /dev/null +++ b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/schemas/ScaleneTriangle.kt @@ -0,0 +1,589 @@ +package org.openapijsonschematools.client.components.schemas; +import java.time.LocalDate; +import java.time.ZonedDateTime; +import java.util.ArrayList; +import java.util.HashSet; +import java.util.LinkedHashMap; +import java.util.LinkedHashSet; +import java.util.List; +import java.util.Map; +import java.util.Objects; +import java.util.Set; +import java.util.UUID; +import org.checkerframework.checker.nullness.qual.Nullable; +import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags; +import org.openapijsonschematools.client.configurations.SchemaConfiguration; +import org.openapijsonschematools.client.exceptions.InvalidAdditionalPropertyException; +import org.openapijsonschematools.client.exceptions.UnsetPropertyException; +import org.openapijsonschematools.client.exceptions.ValidationException; +import org.openapijsonschematools.client.schemas.GenericBuilder; +import org.openapijsonschematools.client.schemas.SetMaker; +import org.openapijsonschematools.client.schemas.UnsetAddPropsSetter; +import org.openapijsonschematools.client.schemas.validation.BooleanSchemaValidator; +import org.openapijsonschematools.client.schemas.validation.FrozenList; +import org.openapijsonschematools.client.schemas.validation.FrozenMap; +import org.openapijsonschematools.client.schemas.validation.JsonSchema; +import org.openapijsonschematools.client.schemas.validation.JsonSchemaInfo; +import org.openapijsonschematools.client.schemas.validation.ListSchemaValidator; +import org.openapijsonschematools.client.schemas.validation.MapSchemaValidator; +import org.openapijsonschematools.client.schemas.validation.NullSchemaValidator; +import org.openapijsonschematools.client.schemas.validation.NumberSchemaValidator; +import org.openapijsonschematools.client.schemas.validation.PathToSchemasMap; +import org.openapijsonschematools.client.schemas.validation.PropertyEntry; +import org.openapijsonschematools.client.schemas.validation.StringEnumValidator; +import org.openapijsonschematools.client.schemas.validation.StringSchemaValidator; +import org.openapijsonschematools.client.schemas.validation.StringValueMethod; +import org.openapijsonschematools.client.schemas.validation.ValidationMetadata; + +public class ScaleneTriangle { + // nest classes so all schemas and input/output classes can be public + + public enum StringTriangleTypeEnums implements StringValueMethod { + SCALENE_TRIANGLE("ScaleneTriangle"); + private final String value; + + StringTriangleTypeEnums(String value) { + this.value = value; + } + public String value() { + return this.value; + } + } + + + public sealed interface TriangleTypeBoxed permits TriangleTypeBoxedString { + @Nullable Object getData(); + } + + public record TriangleTypeBoxedString(String data) implements TriangleTypeBoxed { + @Override + public @Nullable Object getData() { + return data; + } + } + + + + public static class TriangleType extends JsonSchema implements StringSchemaValidator, StringEnumValidator { + private static @Nullable TriangleType instance = null; + + protected TriangleType() { + super(new JsonSchemaInfo() + .type(Set.of( + String.class + )) + .enumValues(SetMaker.makeSet( + "ScaleneTriangle" + )) + ); + } + + public static TriangleType getInstance() { + if (instance == null) { + instance = new TriangleType(); + } + return instance; + } + + @Override + public String validate(String arg, SchemaConfiguration configuration) throws ValidationException { + Set> pathSet = new HashSet<>(); + List pathToItem = List.of("args[0"); + String castArg = castToAllowedTypes(arg, pathToItem, pathSet); + SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().build())); + ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, new PathToSchemasMap(), new LinkedHashSet<>()); + getPathToSchemas(this, castArg, validationMetadata, pathSet); + return castArg; + } + + @Override + 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 { + 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"); + } + @Override + public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { + 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"); + } + @Override + 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 { + 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"); + } + } + + public static class Schema1Map extends FrozenMap<@Nullable Object> { + protected Schema1Map(FrozenMap<@Nullable Object> m) { + super(m); + } + public static final Set requiredKeys = Set.of(); + public static final Set optionalKeys = Set.of( + "triangleType" + ); + public static Schema1Map of(Map arg, SchemaConfiguration configuration) throws ValidationException { + return Schema1.getInstance().validate(arg, configuration); + } + + public String triangleType() throws UnsetPropertyException { + String key = "triangleType"; + throwIfKeyNotPresent(key); + @Nullable Object value = get(key); + if (!(value instanceof String)) { + throw new RuntimeException("Invalid value stored for triangleType"); + } + return (String) value; + } + + public @Nullable Object getAdditionalProperty(String name) throws UnsetPropertyException, InvalidAdditionalPropertyException { + throwIfKeyKnown(name, requiredKeys, optionalKeys); + throwIfKeyNotPresent(name); + return get(name); + } + } + + public interface SetterForTriangleType { + Map getInstance(); + T getBuilderAfterTriangleType(Map instance); + + default T triangleType(String value) { + var instance = getInstance(); + instance.put("triangleType", value); + return getBuilderAfterTriangleType(instance); + } + + default T triangleType(StringTriangleTypeEnums value) { + var instance = getInstance(); + instance.put("triangleType", value.value()); + return getBuilderAfterTriangleType(instance); + } + } + + public static class Schema1MapBuilder extends UnsetAddPropsSetter implements GenericBuilder>, SetterForTriangleType { + private final Map instance; + private static final Set knownKeys = Set.of( + "triangleType" + ); + public Set getKnownKeys() { + return knownKeys; + } + public Schema1MapBuilder() { + this.instance = new LinkedHashMap<>(); + } + public Map build() { + return instance; + } + public Map getInstance() { + return instance; + } + public Schema1MapBuilder getBuilderAfterTriangleType(Map instance) { + return this; + } + public Schema1MapBuilder getBuilderAfterAdditionalProperty(Map instance) { + return this; + } + } + + + public sealed interface Schema1Boxed permits Schema1BoxedMap { + @Nullable Object getData(); + } + + public record Schema1BoxedMap(Schema1Map data) implements Schema1Boxed { + @Override + public @Nullable Object getData() { + return data; + } + } + + + public static class Schema1 extends JsonSchema implements MapSchemaValidator { + private static @Nullable Schema1 instance = null; + + protected Schema1() { + super(new JsonSchemaInfo() + .type(Set.of(Map.class)) + .properties(Map.ofEntries( + new PropertyEntry("triangleType", TriangleType.class) + )) + ); + } + + public static Schema1 getInstance() { + if (instance == null) { + instance = new Schema1(); + } + return instance; + } + + 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 RuntimeException("Invalid non-string key value"); + } + String propertyName = (String) entryKey; + List propertyPathToItem = new ArrayList<>(pathToItem); + propertyPathToItem.add(propertyName); + Object value = entry.getValue(); + LinkedHashMap, Nothing?> schemas = pathToSchemas.get(propertyPathToItem); + if (schemas == null) { + throw new RuntimeException("Validation result is invalid, schemas must exist for a pathToItem"); + } + JsonSchema propertySchema = schemas.entrySet().iterator().next().getKey(); + @Nullable Object propertyInstance = propertySchema.getNewInstance(value, propertyPathToItem, pathToSchemas); + properties.put(propertyName, propertyInstance); + } + FrozenMap<@Nullable Object> castProperties = new FrozenMap<>(properties); + return new Schema1Map(castProperties); + } + + 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); + SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().build())); + ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, new PathToSchemasMap(), new LinkedHashSet<>()); + PathToSchemasMap pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet); + return getNewInstance(castArg, validationMetadata.pathToItem(), pathToSchemasMap); + } + + + @Override + public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws 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"); + } + @Override + public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { + if (arg instanceof Map) { + return getNewInstance((Map) arg, pathToItem, pathToSchemas); + } + 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 { + return new Schema1BoxedMap(validate(arg, configuration)); + } + @Override + public Schema1Boxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { + 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"); + } + } + + + public sealed interface ScaleneTriangle1Boxed permits ScaleneTriangle1BoxedVoid, ScaleneTriangle1BoxedBoolean, ScaleneTriangle1BoxedNumber, ScaleneTriangle1BoxedString, ScaleneTriangle1BoxedList, ScaleneTriangle1BoxedMap { + @Nullable Object getData(); + } + + public record ScaleneTriangle1BoxedVoid(Nothing? data) implements ScaleneTriangle1Boxed { + @Override + public @Nullable Object getData() { + return data; + } + } + + public record ScaleneTriangle1BoxedBoolean(boolean data) implements ScaleneTriangle1Boxed { + @Override + public @Nullable Object getData() { + return data; + } + } + + public record ScaleneTriangle1BoxedNumber(Number data) implements ScaleneTriangle1Boxed { + @Override + public @Nullable Object getData() { + return data; + } + } + + public record ScaleneTriangle1BoxedString(String data) implements ScaleneTriangle1Boxed { + @Override + public @Nullable Object getData() { + return data; + } + } + + public record ScaleneTriangle1BoxedList(FrozenList<@Nullable Object> data) implements ScaleneTriangle1Boxed { + @Override + public @Nullable Object getData() { + return data; + } + } + + public record ScaleneTriangle1BoxedMap(FrozenMap<@Nullable Object> data) implements ScaleneTriangle1Boxed { + @Override + public @Nullable Object getData() { + return data; + } + } + + + public static class ScaleneTriangle1 extends JsonSchema implements NullSchemaValidator, BooleanSchemaValidator, NumberSchemaValidator, StringSchemaValidator, ListSchemaValidator, ScaleneTriangle1BoxedList>, MapSchemaValidator, ScaleneTriangle1BoxedMap> { + /* + NOTE: This class is auto generated by OpenAPI JSON Schema Generator. + Ref: https://github.com/openapi-json-schema-tools/openapi-json-schema-generator + + Do not edit the class manually. + */ + private static @Nullable ScaleneTriangle1 instance = null; + + protected ScaleneTriangle1() { + super(new JsonSchemaInfo() + .allOf(List.of( + TriangleInterface.TriangleInterface1.class, + Schema1.class + )) + ); + } + + public static ScaleneTriangle1 getInstance() { + if (instance == null) { + instance = new ScaleneTriangle1(); + } + return instance; + } + + @Override + public Nothing? validate(Nothing? arg, SchemaConfiguration configuration) throws ValidationException { + Set> pathSet = new HashSet<>(); + List pathToItem = List.of("args[0]"); + Nothing? castArg = castToAllowedTypes(arg, pathToItem, pathSet); + SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().build())); + PathToSchemasMap validatedPathToSchemas = new PathToSchemasMap(); + ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, new LinkedHashSet<>()); + getPathToSchemas(this, castArg, validationMetadata, pathSet); + return castArg; + } + + @Override + public boolean validate(boolean arg, SchemaConfiguration configuration) throws ValidationException { + Set> pathSet = new HashSet<>(); + List pathToItem = List.of("args[0]"); + boolean castArg = castToAllowedTypes(arg, pathToItem, pathSet); + SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().build())); + PathToSchemasMap validatedPathToSchemas = new PathToSchemasMap(); + ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, new LinkedHashSet<>()); + getPathToSchemas(this, castArg, validationMetadata, pathSet); + return castArg; + } + + @Override + public Number validate(Number arg, SchemaConfiguration configuration) throws ValidationException { + Set> pathSet = new HashSet<>(); + List pathToItem = List.of("args[0]"); + Number castArg = castToAllowedTypes(arg, pathToItem, pathSet); + SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().build())); + PathToSchemasMap validatedPathToSchemas = new PathToSchemasMap(); + ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, new LinkedHashSet<>()); + getPathToSchemas(this, castArg, validationMetadata, pathSet); + return castArg; + } + + public int validate(int arg, SchemaConfiguration configuration) throws ValidationException { + return (int) validate((Number) arg, configuration); + } + + public long validate(long arg, SchemaConfiguration configuration) throws ValidationException { + return (long) validate((Number) arg, configuration); + } + + public float validate(float arg, SchemaConfiguration configuration) throws ValidationException { + return (float) validate((Number) arg, configuration); + } + + public double validate(double arg, SchemaConfiguration configuration) throws ValidationException { + return (double) validate((Number) arg, configuration); + } + + @Override + public String validate(String arg, SchemaConfiguration configuration) throws ValidationException { + Set> pathSet = new HashSet<>(); + List pathToItem = List.of("args[0]"); + String castArg = castToAllowedTypes(arg, pathToItem, pathSet); + SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().build())); + PathToSchemasMap validatedPathToSchemas = new PathToSchemasMap(); + ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, new LinkedHashSet<>()); + getPathToSchemas(this, castArg, validationMetadata, pathSet); + return castArg; + } + + public String validate(LocalDate arg, SchemaConfiguration configuration) throws ValidationException { + return validate(arg.toString(), configuration); + } + + public String validate(ZonedDateTime arg, SchemaConfiguration configuration) throws ValidationException { + return validate(arg.toString(), configuration); + } + + public String validate(UUID arg, SchemaConfiguration configuration) throws ValidationException { + return validate(arg.toString(), configuration); + } + + @Override + public FrozenList<@Nullable Object> getNewInstance(List arg, List pathToItem, PathToSchemasMap pathToSchemas) { + List<@Nullable Object> items = new ArrayList<>(); + int i = 0; + for (Object item: arg) { + List itemPathToItem = new ArrayList<>(pathToItem); + itemPathToItem.add(i); + LinkedHashMap, Nothing?> schemas = pathToSchemas.get(itemPathToItem); + if (schemas == null) { + throw new RuntimeException("Validation result is invalid, schemas must exist for a pathToItem"); + } + JsonSchema itemSchema = schemas.entrySet().iterator().next().getKey(); + @Nullable Object itemInstance = itemSchema.getNewInstance(item, itemPathToItem, pathToSchemas); + items.add(itemInstance); + i += 1; + } + FrozenList<@Nullable Object> newInstanceItems = new FrozenList<>(items); + return newInstanceItems; + } + + 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); + SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().build())); + ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, new PathToSchemasMap(), new LinkedHashSet<>()); + PathToSchemasMap pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet); + return getNewInstance(castArg, validationMetadata.pathToItem(), pathToSchemasMap); + } + + @Override + 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 RuntimeException("Invalid non-string key value"); + } + String propertyName = (String) entryKey; + List propertyPathToItem = new ArrayList<>(pathToItem); + propertyPathToItem.add(propertyName); + Object value = entry.getValue(); + LinkedHashMap, Nothing?> schemas = pathToSchemas.get(propertyPathToItem); + if (schemas == null) { + throw new RuntimeException("Validation result is invalid, schemas must exist for a pathToItem"); + } + JsonSchema propertySchema = schemas.entrySet().iterator().next().getKey(); + @Nullable Object propertyInstance = propertySchema.getNewInstance(value, propertyPathToItem, pathToSchemas); + properties.put(propertyName, propertyInstance); + } + FrozenMap<@Nullable Object> castProperties = new FrozenMap<>(properties); + return castProperties; + } + + public FrozenMap<@Nullable Object> validate(Map arg, SchemaConfiguration configuration) throws ValidationException { + Set> pathSet = new HashSet<>(); + List pathToItem = List.of("args[0]"); + Map castArg = castToAllowedTypes(arg, pathToItem, pathSet); + SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().build())); + PathToSchemasMap validatedPathToSchemas = new PathToSchemasMap(); + ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, new LinkedHashSet<>()); + PathToSchemasMap pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet); + return getNewInstance(castArg, validationMetadata.pathToItem(), pathToSchemasMap); + } + + @Override + public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { + if (arg == null) { + return validate((Nothing?) null, configuration); + } else if (arg instanceof Boolean) { + boolean boolArg = (Boolean) arg; + return validate(boolArg, configuration); + } else if (arg instanceof Number) { + return validate((Number) arg, configuration); + } else if (arg instanceof String) { + return validate((String) arg, configuration); + } else if (arg instanceof List) { + return validate((List) arg, 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"); + } + @Override + public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { + if (arg == null) { + return getNewInstance((Nothing?) null, pathToItem, pathToSchemas); + } else if (arg instanceof Boolean) { + boolean boolArg = (Boolean) arg; + return getNewInstance(boolArg, pathToItem, pathToSchemas); + } else if (arg instanceof Number) { + return getNewInstance((Number) arg, pathToItem, pathToSchemas); + } else if (arg instanceof String) { + return getNewInstance((String) arg, pathToItem, pathToSchemas); + } else if (arg instanceof List) { + return getNewInstance((List) arg, 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"); + } + @Override + public ScaleneTriangle1BoxedVoid validateAndBox(Nothing? arg, SchemaConfiguration configuration) throws ValidationException { + return new ScaleneTriangle1BoxedVoid(validate(arg, configuration)); + } + @Override + 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 { + return new ScaleneTriangle1BoxedNumber(validate(arg, configuration)); + } + @Override + 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 { + return new ScaleneTriangle1BoxedList(validate(arg, configuration)); + } + @Override + 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 { + if (arg == null) { + Nothing? castArg = (Nothing?) arg; + return validateAndBox(castArg, configuration); + } else if (arg instanceof Boolean booleanArg) { + boolean castArg = booleanArg; + return validateAndBox(castArg, configuration); + } else if (arg instanceof String castArg) { + return validateAndBox(castArg, configuration); + } else if (arg instanceof Number castArg) { + return validateAndBox(castArg, configuration); + } else if (arg instanceof List castArg) { + 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"); + } + } +} diff --git a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/schemas/Schema200Response.kt b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/schemas/Schema200Response.kt new file mode 100644 index 00000000000..0098c952421 --- /dev/null +++ b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/schemas/Schema200Response.kt @@ -0,0 +1,446 @@ +package org.openapijsonschematools.client.components.schemas; +import java.time.LocalDate; +import java.time.ZonedDateTime; +import java.util.ArrayList; +import java.util.HashSet; +import java.util.LinkedHashMap; +import java.util.LinkedHashSet; +import java.util.List; +import java.util.Map; +import java.util.Objects; +import java.util.Set; +import java.util.UUID; +import org.checkerframework.checker.nullness.qual.Nullable; +import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags; +import org.openapijsonschematools.client.configurations.SchemaConfiguration; +import org.openapijsonschematools.client.exceptions.InvalidAdditionalPropertyException; +import org.openapijsonschematools.client.exceptions.UnsetPropertyException; +import org.openapijsonschematools.client.exceptions.ValidationException; +import org.openapijsonschematools.client.schemas.GenericBuilder; +import org.openapijsonschematools.client.schemas.Int32JsonSchema; +import org.openapijsonschematools.client.schemas.StringJsonSchema; +import org.openapijsonschematools.client.schemas.UnsetAddPropsSetter; +import org.openapijsonschematools.client.schemas.validation.BooleanSchemaValidator; +import org.openapijsonschematools.client.schemas.validation.FrozenList; +import org.openapijsonschematools.client.schemas.validation.FrozenMap; +import org.openapijsonschematools.client.schemas.validation.JsonSchema; +import org.openapijsonschematools.client.schemas.validation.JsonSchemaInfo; +import org.openapijsonschematools.client.schemas.validation.ListSchemaValidator; +import org.openapijsonschematools.client.schemas.validation.MapSchemaValidator; +import org.openapijsonschematools.client.schemas.validation.NullSchemaValidator; +import org.openapijsonschematools.client.schemas.validation.NumberSchemaValidator; +import org.openapijsonschematools.client.schemas.validation.PathToSchemasMap; +import org.openapijsonschematools.client.schemas.validation.PropertyEntry; +import org.openapijsonschematools.client.schemas.validation.StringSchemaValidator; +import org.openapijsonschematools.client.schemas.validation.ValidationMetadata; + +public class Schema200Response { + // nest classes so all schemas and input/output classes can be public + + + public static class Name extends Int32JsonSchema.Int32JsonSchema1 { + private static @Nullable Name instance = null; + public static Name getInstance() { + if (instance == null) { + instance = new Name(); + } + return instance; + } + } + + + public static class ClassSchema extends StringJsonSchema.StringJsonSchema1 { + private static @Nullable ClassSchema instance = null; + public static ClassSchema getInstance() { + if (instance == null) { + instance = new ClassSchema(); + } + return instance; + } + } + + + public static class Schema200ResponseMap extends FrozenMap<@Nullable Object> { + protected Schema200ResponseMap(FrozenMap<@Nullable Object> m) { + super(m); + } + public static final Set requiredKeys = Set.of(); + public static final Set optionalKeys = Set.of( + "name", + "class" + ); + public static Schema200ResponseMap of(Map arg, SchemaConfiguration configuration) throws ValidationException { + return Schema200Response1.getInstance().validate(arg, configuration); + } + + public Number name() throws UnsetPropertyException { + String key = "name"; + throwIfKeyNotPresent(key); + @Nullable Object value = get(key); + if (!(value instanceof Number)) { + throw new RuntimeException("Invalid value stored for name"); + } + return (Number) value; + } + + public @Nullable Object getAdditionalProperty(String name) throws UnsetPropertyException, InvalidAdditionalPropertyException { + throwIfKeyKnown(name, requiredKeys, optionalKeys); + throwIfKeyNotPresent(name); + return get(name); + } + } + + public interface SetterForName { + Map getInstance(); + T getBuilderAfterName(Map instance); + + default T name(int value) { + var instance = getInstance(); + instance.put("name", value); + return getBuilderAfterName(instance); + } + + default T name(float value) { + var instance = getInstance(); + instance.put("name", value); + return getBuilderAfterName(instance); + } + } + + public interface SetterForClassSchema { + Map getInstance(); + T getBuilderAfterClassSchema(Map instance); + + default T setClass(String value) { + var instance = getInstance(); + instance.put("class", value); + return getBuilderAfterClassSchema(instance); + } + } + + public static class Schema200ResponseMapBuilder extends UnsetAddPropsSetter implements GenericBuilder>, SetterForName, SetterForClassSchema { + private final Map instance; + private static final Set knownKeys = Set.of( + "name", + "class" + ); + public Set getKnownKeys() { + return knownKeys; + } + public Schema200ResponseMapBuilder() { + this.instance = new LinkedHashMap<>(); + } + public Map build() { + return instance; + } + public Map getInstance() { + return instance; + } + public Schema200ResponseMapBuilder getBuilderAfterName(Map instance) { + return this; + } + public Schema200ResponseMapBuilder getBuilderAfterClassSchema(Map instance) { + return this; + } + public Schema200ResponseMapBuilder getBuilderAfterAdditionalProperty(Map instance) { + return this; + } + } + + + public sealed interface Schema200Response1Boxed permits Schema200Response1BoxedVoid, Schema200Response1BoxedBoolean, Schema200Response1BoxedNumber, Schema200Response1BoxedString, Schema200Response1BoxedList, Schema200Response1BoxedMap { + @Nullable Object getData(); + } + + public record Schema200Response1BoxedVoid(Nothing? data) implements Schema200Response1Boxed { + @Override + public @Nullable Object getData() { + return data; + } + } + + public record Schema200Response1BoxedBoolean(boolean data) implements Schema200Response1Boxed { + @Override + public @Nullable Object getData() { + return data; + } + } + + public record Schema200Response1BoxedNumber(Number data) implements Schema200Response1Boxed { + @Override + public @Nullable Object getData() { + return data; + } + } + + public record Schema200Response1BoxedString(String data) implements Schema200Response1Boxed { + @Override + public @Nullable Object getData() { + return data; + } + } + + public record Schema200Response1BoxedList(FrozenList<@Nullable Object> data) implements Schema200Response1Boxed { + @Override + public @Nullable Object getData() { + return data; + } + } + + public record Schema200Response1BoxedMap(Schema200ResponseMap data) implements Schema200Response1Boxed { + @Override + public @Nullable Object getData() { + return data; + } + } + + + public static class Schema200Response1 extends JsonSchema implements NullSchemaValidator, BooleanSchemaValidator, NumberSchemaValidator, StringSchemaValidator, ListSchemaValidator, Schema200Response1BoxedList>, MapSchemaValidator { + /* + NOTE: This class is auto generated by OpenAPI JSON Schema Generator. + Ref: https://github.com/openapi-json-schema-tools/openapi-json-schema-generator + + Do not edit the class manually. + + model with an invalid class name for python, starts with a number + */ + private static @Nullable Schema200Response1 instance = null; + + protected Schema200Response1() { + super(new JsonSchemaInfo() + .properties(Map.ofEntries( + new PropertyEntry("name", Name.class), + new PropertyEntry("class", ClassSchema.class) + )) + ); + } + + public static Schema200Response1 getInstance() { + if (instance == null) { + instance = new Schema200Response1(); + } + return instance; + } + + @Override + public Nothing? validate(Nothing? arg, SchemaConfiguration configuration) throws ValidationException { + Set> pathSet = new HashSet<>(); + List pathToItem = List.of("args[0]"); + Nothing? castArg = castToAllowedTypes(arg, pathToItem, pathSet); + SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().build())); + PathToSchemasMap validatedPathToSchemas = new PathToSchemasMap(); + ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, new LinkedHashSet<>()); + getPathToSchemas(this, castArg, validationMetadata, pathSet); + return castArg; + } + + @Override + public boolean validate(boolean arg, SchemaConfiguration configuration) throws ValidationException { + Set> pathSet = new HashSet<>(); + List pathToItem = List.of("args[0]"); + boolean castArg = castToAllowedTypes(arg, pathToItem, pathSet); + SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().build())); + PathToSchemasMap validatedPathToSchemas = new PathToSchemasMap(); + ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, new LinkedHashSet<>()); + getPathToSchemas(this, castArg, validationMetadata, pathSet); + return castArg; + } + + @Override + public Number validate(Number arg, SchemaConfiguration configuration) throws ValidationException { + Set> pathSet = new HashSet<>(); + List pathToItem = List.of("args[0]"); + Number castArg = castToAllowedTypes(arg, pathToItem, pathSet); + SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().build())); + PathToSchemasMap validatedPathToSchemas = new PathToSchemasMap(); + ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, new LinkedHashSet<>()); + getPathToSchemas(this, castArg, validationMetadata, pathSet); + return castArg; + } + + public int validate(int arg, SchemaConfiguration configuration) throws ValidationException { + return (int) validate((Number) arg, configuration); + } + + public long validate(long arg, SchemaConfiguration configuration) throws ValidationException { + return (long) validate((Number) arg, configuration); + } + + public float validate(float arg, SchemaConfiguration configuration) throws ValidationException { + return (float) validate((Number) arg, configuration); + } + + public double validate(double arg, SchemaConfiguration configuration) throws ValidationException { + return (double) validate((Number) arg, configuration); + } + + @Override + public String validate(String arg, SchemaConfiguration configuration) throws ValidationException { + Set> pathSet = new HashSet<>(); + List pathToItem = List.of("args[0]"); + String castArg = castToAllowedTypes(arg, pathToItem, pathSet); + SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().build())); + PathToSchemasMap validatedPathToSchemas = new PathToSchemasMap(); + ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, new LinkedHashSet<>()); + getPathToSchemas(this, castArg, validationMetadata, pathSet); + return castArg; + } + + public String validate(LocalDate arg, SchemaConfiguration configuration) throws ValidationException { + return validate(arg.toString(), configuration); + } + + public String validate(ZonedDateTime arg, SchemaConfiguration configuration) throws ValidationException { + return validate(arg.toString(), configuration); + } + + public String validate(UUID arg, SchemaConfiguration configuration) throws ValidationException { + return validate(arg.toString(), configuration); + } + + @Override + public FrozenList<@Nullable Object> getNewInstance(List arg, List pathToItem, PathToSchemasMap pathToSchemas) { + List<@Nullable Object> items = new ArrayList<>(); + int i = 0; + for (Object item: arg) { + List itemPathToItem = new ArrayList<>(pathToItem); + itemPathToItem.add(i); + LinkedHashMap, Nothing?> schemas = pathToSchemas.get(itemPathToItem); + if (schemas == null) { + throw new RuntimeException("Validation result is invalid, schemas must exist for a pathToItem"); + } + JsonSchema itemSchema = schemas.entrySet().iterator().next().getKey(); + @Nullable Object itemInstance = itemSchema.getNewInstance(item, itemPathToItem, pathToSchemas); + items.add(itemInstance); + i += 1; + } + FrozenList<@Nullable Object> newInstanceItems = new FrozenList<>(items); + return newInstanceItems; + } + + 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); + SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().build())); + ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, new PathToSchemasMap(), new LinkedHashSet<>()); + PathToSchemasMap pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet); + return getNewInstance(castArg, validationMetadata.pathToItem(), pathToSchemasMap); + } + + @Override + 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 RuntimeException("Invalid non-string key value"); + } + String propertyName = (String) entryKey; + List propertyPathToItem = new ArrayList<>(pathToItem); + propertyPathToItem.add(propertyName); + Object value = entry.getValue(); + LinkedHashMap, Nothing?> schemas = pathToSchemas.get(propertyPathToItem); + if (schemas == null) { + throw new RuntimeException("Validation result is invalid, schemas must exist for a pathToItem"); + } + JsonSchema propertySchema = schemas.entrySet().iterator().next().getKey(); + @Nullable Object propertyInstance = propertySchema.getNewInstance(value, propertyPathToItem, pathToSchemas); + properties.put(propertyName, propertyInstance); + } + FrozenMap<@Nullable Object> castProperties = new FrozenMap<>(properties); + return new Schema200ResponseMap(castProperties); + } + + 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); + SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().build())); + PathToSchemasMap validatedPathToSchemas = new PathToSchemasMap(); + ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, new LinkedHashSet<>()); + PathToSchemasMap pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet); + return getNewInstance(castArg, validationMetadata.pathToItem(), pathToSchemasMap); + } + + @Override + public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { + if (arg == null) { + return validate((Nothing?) null, configuration); + } else if (arg instanceof Boolean) { + boolean boolArg = (Boolean) arg; + return validate(boolArg, configuration); + } else if (arg instanceof Number) { + return validate((Number) arg, configuration); + } else if (arg instanceof String) { + return validate((String) arg, configuration); + } else if (arg instanceof List) { + return validate((List) arg, 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"); + } + @Override + public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { + if (arg == null) { + return getNewInstance((Nothing?) null, pathToItem, pathToSchemas); + } else if (arg instanceof Boolean) { + boolean boolArg = (Boolean) arg; + return getNewInstance(boolArg, pathToItem, pathToSchemas); + } else if (arg instanceof Number) { + return getNewInstance((Number) arg, pathToItem, pathToSchemas); + } else if (arg instanceof String) { + return getNewInstance((String) arg, pathToItem, pathToSchemas); + } else if (arg instanceof List) { + return getNewInstance((List) arg, 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"); + } + @Override + public Schema200Response1BoxedVoid validateAndBox(Nothing? arg, SchemaConfiguration configuration) throws ValidationException { + return new Schema200Response1BoxedVoid(validate(arg, configuration)); + } + @Override + 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 { + return new Schema200Response1BoxedNumber(validate(arg, configuration)); + } + @Override + 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 { + return new Schema200Response1BoxedList(validate(arg, configuration)); + } + @Override + 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 { + if (arg == null) { + Nothing? castArg = (Nothing?) arg; + return validateAndBox(castArg, configuration); + } else if (arg instanceof Boolean booleanArg) { + boolean castArg = booleanArg; + return validateAndBox(castArg, configuration); + } else if (arg instanceof String castArg) { + return validateAndBox(castArg, configuration); + } else if (arg instanceof Number castArg) { + return validateAndBox(castArg, configuration); + } else if (arg instanceof List castArg) { + 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"); + } + } +} diff --git a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/schemas/SelfReferencingArrayModel.kt b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/schemas/SelfReferencingArrayModel.kt new file mode 100644 index 00000000000..b149affb747 --- /dev/null +++ b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/schemas/SelfReferencingArrayModel.kt @@ -0,0 +1,152 @@ +package org.openapijsonschematools.client.components.schemas; +import java.util.ArrayList; +import java.util.HashSet; +import java.util.LinkedHashMap; +import java.util.LinkedHashSet; +import java.util.List; +import java.util.Map; +import java.util.Objects; +import java.util.Set; +import org.checkerframework.checker.nullness.qual.Nullable; +import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags; +import org.openapijsonschematools.client.configurations.SchemaConfiguration; +import org.openapijsonschematools.client.exceptions.ValidationException; +import org.openapijsonschematools.client.schemas.validation.FrozenList; +import org.openapijsonschematools.client.schemas.validation.JsonSchema; +import org.openapijsonschematools.client.schemas.validation.JsonSchemaInfo; +import org.openapijsonschematools.client.schemas.validation.ListSchemaValidator; +import org.openapijsonschematools.client.schemas.validation.PathToSchemasMap; +import org.openapijsonschematools.client.schemas.validation.ValidationMetadata; + +public class SelfReferencingArrayModel { + // nest classes so all schemas and input/output classes can be public + + + public static class SelfReferencingArrayModelList extends FrozenList { + protected SelfReferencingArrayModelList(FrozenList m) { + super(m); + } + public static SelfReferencingArrayModelList of(List> arg, SchemaConfiguration configuration) throws ValidationException { + return SelfReferencingArrayModel1.getInstance().validate(arg, configuration); + } + } + + public static class SelfReferencingArrayModelListBuilder { + // class to build List> + private final List> list; + + public SelfReferencingArrayModelListBuilder() { + list = new ArrayList<>(); + } + + public SelfReferencingArrayModelListBuilder(List> list) { + this.list = list; + } + + public SelfReferencingArrayModelListBuilder add(List item) { + list.add(item); + return this; + } + + public List> build() { + return list; + } + } + + + public sealed interface SelfReferencingArrayModel1Boxed permits SelfReferencingArrayModel1BoxedList { + @Nullable Object getData(); + } + + public record SelfReferencingArrayModel1BoxedList(SelfReferencingArrayModelList data) implements SelfReferencingArrayModel1Boxed { + @Override + public @Nullable Object getData() { + return data; + } + } + + + + public static class SelfReferencingArrayModel1 extends JsonSchema implements ListSchemaValidator { + /* + NOTE: This class is auto generated by OpenAPI JSON Schema Generator. + Ref: https://github.com/openapi-json-schema-tools/openapi-json-schema-generator + + Do not edit the class manually. + */ + private static @Nullable SelfReferencingArrayModel1 instance = null; + + protected SelfReferencingArrayModel1() { + super(new JsonSchemaInfo() + .type(Set.of(List.class)) + .items(SelfReferencingArrayModel1.class) + ); + } + + public static SelfReferencingArrayModel1 getInstance() { + if (instance == null) { + instance = new SelfReferencingArrayModel1(); + } + return instance; + } + + @Override + public SelfReferencingArrayModelList getNewInstance(List arg, List pathToItem, PathToSchemasMap pathToSchemas) { + List items = new ArrayList<>(); + int i = 0; + for (Object item: arg) { + List itemPathToItem = new ArrayList<>(pathToItem); + itemPathToItem.add(i); + LinkedHashMap, Nothing?> schemas = pathToSchemas.get(itemPathToItem); + if (schemas == null) { + throw new RuntimeException("Validation 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"); + } + items.add((SelfReferencingArrayModelList) itemInstance); + i += 1; + } + FrozenList newInstanceItems = new FrozenList<>(items); + return new SelfReferencingArrayModelList(newInstanceItems); + } + + 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); + SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().build())); + ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, new PathToSchemasMap(), new LinkedHashSet<>()); + PathToSchemasMap pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet); + return getNewInstance(castArg, validationMetadata.pathToItem(), pathToSchemasMap); + } + + @Override + public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws 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"); + } + @Override + public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { + 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"); + } + @Override + 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 { + 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"); + } + } +} diff --git a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/schemas/SelfReferencingObjectModel.kt b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/schemas/SelfReferencingObjectModel.kt new file mode 100644 index 00000000000..5b959c73d8a --- /dev/null +++ b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/schemas/SelfReferencingObjectModel.kt @@ -0,0 +1,211 @@ +package org.openapijsonschematools.client.components.schemas; +import java.util.ArrayList; +import java.util.HashSet; +import java.util.LinkedHashMap; +import java.util.LinkedHashSet; +import java.util.List; +import java.util.Map; +import java.util.Objects; +import java.util.Set; +import org.checkerframework.checker.nullness.qual.Nullable; +import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags; +import org.openapijsonschematools.client.configurations.SchemaConfiguration; +import org.openapijsonschematools.client.exceptions.InvalidAdditionalPropertyException; +import org.openapijsonschematools.client.exceptions.UnsetPropertyException; +import org.openapijsonschematools.client.exceptions.ValidationException; +import org.openapijsonschematools.client.schemas.GenericBuilder; +import org.openapijsonschematools.client.schemas.validation.FrozenMap; +import org.openapijsonschematools.client.schemas.validation.JsonSchema; +import org.openapijsonschematools.client.schemas.validation.JsonSchemaInfo; +import org.openapijsonschematools.client.schemas.validation.MapSchemaValidator; +import org.openapijsonschematools.client.schemas.validation.MapUtils; +import org.openapijsonschematools.client.schemas.validation.PathToSchemasMap; +import org.openapijsonschematools.client.schemas.validation.PropertyEntry; +import org.openapijsonschematools.client.schemas.validation.ValidationMetadata; + +public class SelfReferencingObjectModel { + // nest classes so all schemas and input/output classes can be public + + + public static class SelfReferencingObjectModelMap extends FrozenMap<@Nullable Object> { + protected SelfReferencingObjectModelMap(FrozenMap<@Nullable Object> m) { + super(m); + } + public static final Set requiredKeys = Set.of(); + public static final Set optionalKeys = Set.of( + "selfRef" + ); + public static SelfReferencingObjectModelMap of(Map arg, SchemaConfiguration configuration) throws ValidationException { + return SelfReferencingObjectModel1.getInstance().validate(arg, configuration); + } + + public SelfReferencingObjectModelMap selfRef() throws UnsetPropertyException { + String key = "selfRef"; + throwIfKeyNotPresent(key); + @Nullable Object value = get(key); + if (!(value instanceof SelfReferencingObjectModelMap)) { + throw new RuntimeException("Invalid value stored for selfRef"); + } + return (SelfReferencingObjectModelMap) value; + } + + public SelfReferencingObjectModelMap getAdditionalProperty(String name) throws UnsetPropertyException, InvalidAdditionalPropertyException { + throwIfKeyKnown(name, requiredKeys, optionalKeys); + var value = getOrThrow(name); + if (!(value instanceof SelfReferencingObjectModelMap)) { + throw new RuntimeException("Invalid value stored for " + name); + } + return (SelfReferencingObjectModelMap) value; + } + } + + public interface SetterForSelfRef { + Map getInstance(); + T getBuilderAfterSelfRef(Map instance); + + default T selfRef(Map value) { + var instance = getInstance(); + instance.put("selfRef", value); + return getBuilderAfterSelfRef(instance); + } + } + + public interface SetterForAdditionalProperties { + Set getKnownKeys(); + Map getInstance(); + T getBuilderAfterAdditionalProperty(Map instance); + + default T additionalProperty(String key, Map value) throws InvalidAdditionalPropertyException { + MapUtils.throwIfKeyKnown(key, getKnownKeys(), true); + var instance = getInstance(); + instance.put(key, value); + return getBuilderAfterAdditionalProperty(instance); + } + } + + public static class SelfReferencingObjectModelMapBuilder implements GenericBuilder>, SetterForSelfRef, SetterForAdditionalProperties { + private final Map instance; + private static final Set knownKeys = Set.of( + "selfRef" + ); + public Set getKnownKeys() { + return knownKeys; + } + public SelfReferencingObjectModelMapBuilder() { + this.instance = new LinkedHashMap<>(); + } + public Map build() { + return instance; + } + public Map getInstance() { + return instance; + } + public SelfReferencingObjectModelMapBuilder getBuilderAfterSelfRef(Map instance) { + return this; + } + public SelfReferencingObjectModelMapBuilder getBuilderAfterAdditionalProperty(Map instance) { + return this; + } + } + + + public sealed interface SelfReferencingObjectModel1Boxed permits SelfReferencingObjectModel1BoxedMap { + @Nullable Object getData(); + } + + public record SelfReferencingObjectModel1BoxedMap(SelfReferencingObjectModelMap data) implements SelfReferencingObjectModel1Boxed { + @Override + public @Nullable Object getData() { + return data; + } + } + + + public static class SelfReferencingObjectModel1 extends JsonSchema implements MapSchemaValidator { + /* + NOTE: This class is auto generated by OpenAPI JSON Schema Generator. + Ref: https://github.com/openapi-json-schema-tools/openapi-json-schema-generator + + Do not edit the class manually. + */ + private static @Nullable SelfReferencingObjectModel1 instance = null; + + protected SelfReferencingObjectModel1() { + super(new JsonSchemaInfo() + .type(Set.of(Map.class)) + .properties(Map.ofEntries( + new PropertyEntry("selfRef", SelfReferencingObjectModel1.class) + )) + .additionalProperties(SelfReferencingObjectModel1.class) + ); + } + + public static SelfReferencingObjectModel1 getInstance() { + if (instance == null) { + instance = new SelfReferencingObjectModel1(); + } + return instance; + } + + 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 RuntimeException("Invalid non-string key value"); + } + String propertyName = (String) entryKey; + List propertyPathToItem = new ArrayList<>(pathToItem); + propertyPathToItem.add(propertyName); + Object value = entry.getValue(); + LinkedHashMap, Nothing?> schemas = pathToSchemas.get(propertyPathToItem); + if (schemas == null) { + throw new RuntimeException("Validation result is invalid, schemas must exist for a pathToItem"); + } + JsonSchema propertySchema = schemas.entrySet().iterator().next().getKey(); + @Nullable Object propertyInstance = propertySchema.getNewInstance(value, propertyPathToItem, pathToSchemas); + properties.put(propertyName, propertyInstance); + } + FrozenMap<@Nullable Object> castProperties = new FrozenMap<>(properties); + return new SelfReferencingObjectModelMap(castProperties); + } + + 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); + SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().build())); + ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, new PathToSchemasMap(), new LinkedHashSet<>()); + PathToSchemasMap pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet); + return getNewInstance(castArg, validationMetadata.pathToItem(), pathToSchemasMap); + } + + + @Override + public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws 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"); + } + @Override + public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { + if (arg instanceof Map) { + return getNewInstance((Map) arg, pathToItem, pathToSchemas); + } + 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 { + return new SelfReferencingObjectModel1BoxedMap(validate(arg, configuration)); + } + @Override + public SelfReferencingObjectModel1Boxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { + 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"); + } + } + +} diff --git a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/schemas/Shape.kt b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/schemas/Shape.kt new file mode 100644 index 00000000000..5fdca31ab2a --- /dev/null +++ b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/schemas/Shape.kt @@ -0,0 +1,330 @@ +package org.openapijsonschematools.client.components.schemas; +import java.time.LocalDate; +import java.time.ZonedDateTime; +import java.util.ArrayList; +import java.util.HashSet; +import java.util.LinkedHashMap; +import java.util.LinkedHashSet; +import java.util.List; +import java.util.Map; +import java.util.Objects; +import java.util.Set; +import java.util.UUID; +import org.checkerframework.checker.nullness.qual.Nullable; +import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags; +import org.openapijsonschematools.client.configurations.SchemaConfiguration; +import org.openapijsonschematools.client.exceptions.InvalidAdditionalPropertyException; +import org.openapijsonschematools.client.exceptions.UnsetPropertyException; +import org.openapijsonschematools.client.exceptions.ValidationException; +import org.openapijsonschematools.client.schemas.UnsetAddPropsSetter; +import org.openapijsonschematools.client.schemas.validation.BooleanSchemaValidator; +import org.openapijsonschematools.client.schemas.validation.FrozenList; +import org.openapijsonschematools.client.schemas.validation.FrozenMap; +import org.openapijsonschematools.client.schemas.validation.JsonSchema; +import org.openapijsonschematools.client.schemas.validation.JsonSchemaInfo; +import org.openapijsonschematools.client.schemas.validation.ListSchemaValidator; +import org.openapijsonschematools.client.schemas.validation.MapSchemaValidator; +import org.openapijsonschematools.client.schemas.validation.NullSchemaValidator; +import org.openapijsonschematools.client.schemas.validation.NumberSchemaValidator; +import org.openapijsonschematools.client.schemas.validation.PathToSchemasMap; +import org.openapijsonschematools.client.schemas.validation.StringSchemaValidator; +import org.openapijsonschematools.client.schemas.validation.ValidationMetadata; + +public class Shape { + // nest classes so all schemas and input/output classes can be public + + + public sealed interface Shape1Boxed permits Shape1BoxedVoid, Shape1BoxedBoolean, Shape1BoxedNumber, Shape1BoxedString, Shape1BoxedList, Shape1BoxedMap { + @Nullable Object getData(); + } + + public record Shape1BoxedVoid(Nothing? data) implements Shape1Boxed { + @Override + public @Nullable Object getData() { + return data; + } + } + + public record Shape1BoxedBoolean(boolean data) implements Shape1Boxed { + @Override + public @Nullable Object getData() { + return data; + } + } + + public record Shape1BoxedNumber(Number data) implements Shape1Boxed { + @Override + public @Nullable Object getData() { + return data; + } + } + + public record Shape1BoxedString(String data) implements Shape1Boxed { + @Override + public @Nullable Object getData() { + return data; + } + } + + public record Shape1BoxedList(FrozenList<@Nullable Object> data) implements Shape1Boxed { + @Override + public @Nullable Object getData() { + return data; + } + } + + public record Shape1BoxedMap(FrozenMap<@Nullable Object> data) implements Shape1Boxed { + @Override + public @Nullable Object getData() { + return data; + } + } + + + public static class Shape1 extends JsonSchema implements NullSchemaValidator, BooleanSchemaValidator, NumberSchemaValidator, StringSchemaValidator, ListSchemaValidator, Shape1BoxedList>, MapSchemaValidator, Shape1BoxedMap> { + /* + NOTE: This class is auto generated by OpenAPI JSON Schema Generator. + Ref: https://github.com/openapi-json-schema-tools/openapi-json-schema-generator + + Do not edit the class manually. + */ + private static @Nullable Shape1 instance = null; + + protected Shape1() { + super(new JsonSchemaInfo() + .oneOf(List.of( + Triangle.Triangle1.class, + Quadrilateral.Quadrilateral1.class + )) + ); + } + + public static Shape1 getInstance() { + if (instance == null) { + instance = new Shape1(); + } + return instance; + } + + @Override + public Nothing? validate(Nothing? arg, SchemaConfiguration configuration) throws ValidationException { + Set> pathSet = new HashSet<>(); + List pathToItem = List.of("args[0]"); + Nothing? castArg = castToAllowedTypes(arg, pathToItem, pathSet); + SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().build())); + PathToSchemasMap validatedPathToSchemas = new PathToSchemasMap(); + ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, new LinkedHashSet<>()); + getPathToSchemas(this, castArg, validationMetadata, pathSet); + return castArg; + } + + @Override + public boolean validate(boolean arg, SchemaConfiguration configuration) throws ValidationException { + Set> pathSet = new HashSet<>(); + List pathToItem = List.of("args[0]"); + boolean castArg = castToAllowedTypes(arg, pathToItem, pathSet); + SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().build())); + PathToSchemasMap validatedPathToSchemas = new PathToSchemasMap(); + ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, new LinkedHashSet<>()); + getPathToSchemas(this, castArg, validationMetadata, pathSet); + return castArg; + } + + @Override + public Number validate(Number arg, SchemaConfiguration configuration) throws ValidationException { + Set> pathSet = new HashSet<>(); + List pathToItem = List.of("args[0]"); + Number castArg = castToAllowedTypes(arg, pathToItem, pathSet); + SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().build())); + PathToSchemasMap validatedPathToSchemas = new PathToSchemasMap(); + ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, new LinkedHashSet<>()); + getPathToSchemas(this, castArg, validationMetadata, pathSet); + return castArg; + } + + public int validate(int arg, SchemaConfiguration configuration) throws ValidationException { + return (int) validate((Number) arg, configuration); + } + + public long validate(long arg, SchemaConfiguration configuration) throws ValidationException { + return (long) validate((Number) arg, configuration); + } + + public float validate(float arg, SchemaConfiguration configuration) throws ValidationException { + return (float) validate((Number) arg, configuration); + } + + public double validate(double arg, SchemaConfiguration configuration) throws ValidationException { + return (double) validate((Number) arg, configuration); + } + + @Override + public String validate(String arg, SchemaConfiguration configuration) throws ValidationException { + Set> pathSet = new HashSet<>(); + List pathToItem = List.of("args[0]"); + String castArg = castToAllowedTypes(arg, pathToItem, pathSet); + SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().build())); + PathToSchemasMap validatedPathToSchemas = new PathToSchemasMap(); + ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, new LinkedHashSet<>()); + getPathToSchemas(this, castArg, validationMetadata, pathSet); + return castArg; + } + + public String validate(LocalDate arg, SchemaConfiguration configuration) throws ValidationException { + return validate(arg.toString(), configuration); + } + + public String validate(ZonedDateTime arg, SchemaConfiguration configuration) throws ValidationException { + return validate(arg.toString(), configuration); + } + + public String validate(UUID arg, SchemaConfiguration configuration) throws ValidationException { + return validate(arg.toString(), configuration); + } + + @Override + public FrozenList<@Nullable Object> getNewInstance(List arg, List pathToItem, PathToSchemasMap pathToSchemas) { + List<@Nullable Object> items = new ArrayList<>(); + int i = 0; + for (Object item: arg) { + List itemPathToItem = new ArrayList<>(pathToItem); + itemPathToItem.add(i); + LinkedHashMap, Nothing?> schemas = pathToSchemas.get(itemPathToItem); + if (schemas == null) { + throw new RuntimeException("Validation result is invalid, schemas must exist for a pathToItem"); + } + JsonSchema itemSchema = schemas.entrySet().iterator().next().getKey(); + @Nullable Object itemInstance = itemSchema.getNewInstance(item, itemPathToItem, pathToSchemas); + items.add(itemInstance); + i += 1; + } + FrozenList<@Nullable Object> newInstanceItems = new FrozenList<>(items); + return newInstanceItems; + } + + 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); + SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().build())); + ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, new PathToSchemasMap(), new LinkedHashSet<>()); + PathToSchemasMap pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet); + return getNewInstance(castArg, validationMetadata.pathToItem(), pathToSchemasMap); + } + + @Override + 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 RuntimeException("Invalid non-string key value"); + } + String propertyName = (String) entryKey; + List propertyPathToItem = new ArrayList<>(pathToItem); + propertyPathToItem.add(propertyName); + Object value = entry.getValue(); + LinkedHashMap, Nothing?> schemas = pathToSchemas.get(propertyPathToItem); + if (schemas == null) { + throw new RuntimeException("Validation result is invalid, schemas must exist for a pathToItem"); + } + JsonSchema propertySchema = schemas.entrySet().iterator().next().getKey(); + @Nullable Object propertyInstance = propertySchema.getNewInstance(value, propertyPathToItem, pathToSchemas); + properties.put(propertyName, propertyInstance); + } + FrozenMap<@Nullable Object> castProperties = new FrozenMap<>(properties); + return castProperties; + } + + public FrozenMap<@Nullable Object> validate(Map arg, SchemaConfiguration configuration) throws ValidationException { + Set> pathSet = new HashSet<>(); + List pathToItem = List.of("args[0]"); + Map castArg = castToAllowedTypes(arg, pathToItem, pathSet); + SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().build())); + PathToSchemasMap validatedPathToSchemas = new PathToSchemasMap(); + ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, new LinkedHashSet<>()); + PathToSchemasMap pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet); + return getNewInstance(castArg, validationMetadata.pathToItem(), pathToSchemasMap); + } + + @Override + public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { + if (arg == null) { + return validate((Nothing?) null, configuration); + } else if (arg instanceof Boolean) { + boolean boolArg = (Boolean) arg; + return validate(boolArg, configuration); + } else if (arg instanceof Number) { + return validate((Number) arg, configuration); + } else if (arg instanceof String) { + return validate((String) arg, configuration); + } else if (arg instanceof List) { + return validate((List) arg, 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"); + } + @Override + public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { + if (arg == null) { + return getNewInstance((Nothing?) null, pathToItem, pathToSchemas); + } else if (arg instanceof Boolean) { + boolean boolArg = (Boolean) arg; + return getNewInstance(boolArg, pathToItem, pathToSchemas); + } else if (arg instanceof Number) { + return getNewInstance((Number) arg, pathToItem, pathToSchemas); + } else if (arg instanceof String) { + return getNewInstance((String) arg, pathToItem, pathToSchemas); + } else if (arg instanceof List) { + return getNewInstance((List) arg, 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"); + } + @Override + public Shape1BoxedVoid validateAndBox(Nothing? arg, SchemaConfiguration configuration) throws ValidationException { + return new Shape1BoxedVoid(validate(arg, configuration)); + } + @Override + 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 { + return new Shape1BoxedNumber(validate(arg, configuration)); + } + @Override + 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 { + return new Shape1BoxedList(validate(arg, configuration)); + } + @Override + 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 { + if (arg == null) { + Nothing? castArg = (Nothing?) arg; + return validateAndBox(castArg, configuration); + } else if (arg instanceof Boolean booleanArg) { + boolean castArg = booleanArg; + return validateAndBox(castArg, configuration); + } else if (arg instanceof String castArg) { + return validateAndBox(castArg, configuration); + } else if (arg instanceof Number castArg) { + return validateAndBox(castArg, configuration); + } else if (arg instanceof List castArg) { + 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"); + } + } +} diff --git a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/schemas/ShapeOrNull.kt b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/schemas/ShapeOrNull.kt new file mode 100644 index 00000000000..edf65df7aaf --- /dev/null +++ b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/schemas/ShapeOrNull.kt @@ -0,0 +1,345 @@ +package org.openapijsonschematools.client.components.schemas; +import java.time.LocalDate; +import java.time.ZonedDateTime; +import java.util.ArrayList; +import java.util.HashSet; +import java.util.LinkedHashMap; +import java.util.LinkedHashSet; +import java.util.List; +import java.util.Map; +import java.util.Objects; +import java.util.Set; +import java.util.UUID; +import org.checkerframework.checker.nullness.qual.Nullable; +import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags; +import org.openapijsonschematools.client.configurations.SchemaConfiguration; +import org.openapijsonschematools.client.exceptions.InvalidAdditionalPropertyException; +import org.openapijsonschematools.client.exceptions.UnsetPropertyException; +import org.openapijsonschematools.client.exceptions.ValidationException; +import org.openapijsonschematools.client.schemas.NullJsonSchema; +import org.openapijsonschematools.client.schemas.UnsetAddPropsSetter; +import org.openapijsonschematools.client.schemas.validation.BooleanSchemaValidator; +import org.openapijsonschematools.client.schemas.validation.FrozenList; +import org.openapijsonschematools.client.schemas.validation.FrozenMap; +import org.openapijsonschematools.client.schemas.validation.JsonSchema; +import org.openapijsonschematools.client.schemas.validation.JsonSchemaInfo; +import org.openapijsonschematools.client.schemas.validation.ListSchemaValidator; +import org.openapijsonschematools.client.schemas.validation.MapSchemaValidator; +import org.openapijsonschematools.client.schemas.validation.NullSchemaValidator; +import org.openapijsonschematools.client.schemas.validation.NumberSchemaValidator; +import org.openapijsonschematools.client.schemas.validation.PathToSchemasMap; +import org.openapijsonschematools.client.schemas.validation.StringSchemaValidator; +import org.openapijsonschematools.client.schemas.validation.ValidationMetadata; + +public class ShapeOrNull { + // nest classes so all schemas and input/output classes can be public + + + public static class Schema0 extends NullJsonSchema.NullJsonSchema1 { + private static @Nullable Schema0 instance = null; + public static Schema0 getInstance() { + if (instance == null) { + instance = new Schema0(); + } + return instance; + } + } + + + public sealed interface ShapeOrNull1Boxed permits ShapeOrNull1BoxedVoid, ShapeOrNull1BoxedBoolean, ShapeOrNull1BoxedNumber, ShapeOrNull1BoxedString, ShapeOrNull1BoxedList, ShapeOrNull1BoxedMap { + @Nullable Object getData(); + } + + public record ShapeOrNull1BoxedVoid(Nothing? data) implements ShapeOrNull1Boxed { + @Override + public @Nullable Object getData() { + return data; + } + } + + public record ShapeOrNull1BoxedBoolean(boolean data) implements ShapeOrNull1Boxed { + @Override + public @Nullable Object getData() { + return data; + } + } + + public record ShapeOrNull1BoxedNumber(Number data) implements ShapeOrNull1Boxed { + @Override + public @Nullable Object getData() { + return data; + } + } + + public record ShapeOrNull1BoxedString(String data) implements ShapeOrNull1Boxed { + @Override + public @Nullable Object getData() { + return data; + } + } + + public record ShapeOrNull1BoxedList(FrozenList<@Nullable Object> data) implements ShapeOrNull1Boxed { + @Override + public @Nullable Object getData() { + return data; + } + } + + public record ShapeOrNull1BoxedMap(FrozenMap<@Nullable Object> data) implements ShapeOrNull1Boxed { + @Override + public @Nullable Object getData() { + return data; + } + } + + + public static class ShapeOrNull1 extends JsonSchema implements NullSchemaValidator, BooleanSchemaValidator, NumberSchemaValidator, StringSchemaValidator, ListSchemaValidator, ShapeOrNull1BoxedList>, MapSchemaValidator, ShapeOrNull1BoxedMap> { + /* + NOTE: This class is auto generated by OpenAPI JSON Schema Generator. + Ref: https://github.com/openapi-json-schema-tools/openapi-json-schema-generator + + Do not edit the class manually. + + The value may be a shape or the 'null' value. This is introduced in OAS schema >= 3.1. + */ + private static @Nullable ShapeOrNull1 instance = null; + + protected ShapeOrNull1() { + super(new JsonSchemaInfo() + .oneOf(List.of( + Schema0.class, + Triangle.Triangle1.class, + Quadrilateral.Quadrilateral1.class + )) + ); + } + + public static ShapeOrNull1 getInstance() { + if (instance == null) { + instance = new ShapeOrNull1(); + } + return instance; + } + + @Override + public Nothing? validate(Nothing? arg, SchemaConfiguration configuration) throws ValidationException { + Set> pathSet = new HashSet<>(); + List pathToItem = List.of("args[0]"); + Nothing? castArg = castToAllowedTypes(arg, pathToItem, pathSet); + SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().build())); + PathToSchemasMap validatedPathToSchemas = new PathToSchemasMap(); + ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, new LinkedHashSet<>()); + getPathToSchemas(this, castArg, validationMetadata, pathSet); + return castArg; + } + + @Override + public boolean validate(boolean arg, SchemaConfiguration configuration) throws ValidationException { + Set> pathSet = new HashSet<>(); + List pathToItem = List.of("args[0]"); + boolean castArg = castToAllowedTypes(arg, pathToItem, pathSet); + SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().build())); + PathToSchemasMap validatedPathToSchemas = new PathToSchemasMap(); + ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, new LinkedHashSet<>()); + getPathToSchemas(this, castArg, validationMetadata, pathSet); + return castArg; + } + + @Override + public Number validate(Number arg, SchemaConfiguration configuration) throws ValidationException { + Set> pathSet = new HashSet<>(); + List pathToItem = List.of("args[0]"); + Number castArg = castToAllowedTypes(arg, pathToItem, pathSet); + SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().build())); + PathToSchemasMap validatedPathToSchemas = new PathToSchemasMap(); + ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, new LinkedHashSet<>()); + getPathToSchemas(this, castArg, validationMetadata, pathSet); + return castArg; + } + + public int validate(int arg, SchemaConfiguration configuration) throws ValidationException { + return (int) validate((Number) arg, configuration); + } + + public long validate(long arg, SchemaConfiguration configuration) throws ValidationException { + return (long) validate((Number) arg, configuration); + } + + public float validate(float arg, SchemaConfiguration configuration) throws ValidationException { + return (float) validate((Number) arg, configuration); + } + + public double validate(double arg, SchemaConfiguration configuration) throws ValidationException { + return (double) validate((Number) arg, configuration); + } + + @Override + public String validate(String arg, SchemaConfiguration configuration) throws ValidationException { + Set> pathSet = new HashSet<>(); + List pathToItem = List.of("args[0]"); + String castArg = castToAllowedTypes(arg, pathToItem, pathSet); + SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().build())); + PathToSchemasMap validatedPathToSchemas = new PathToSchemasMap(); + ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, new LinkedHashSet<>()); + getPathToSchemas(this, castArg, validationMetadata, pathSet); + return castArg; + } + + public String validate(LocalDate arg, SchemaConfiguration configuration) throws ValidationException { + return validate(arg.toString(), configuration); + } + + public String validate(ZonedDateTime arg, SchemaConfiguration configuration) throws ValidationException { + return validate(arg.toString(), configuration); + } + + public String validate(UUID arg, SchemaConfiguration configuration) throws ValidationException { + return validate(arg.toString(), configuration); + } + + @Override + public FrozenList<@Nullable Object> getNewInstance(List arg, List pathToItem, PathToSchemasMap pathToSchemas) { + List<@Nullable Object> items = new ArrayList<>(); + int i = 0; + for (Object item: arg) { + List itemPathToItem = new ArrayList<>(pathToItem); + itemPathToItem.add(i); + LinkedHashMap, Nothing?> schemas = pathToSchemas.get(itemPathToItem); + if (schemas == null) { + throw new RuntimeException("Validation result is invalid, schemas must exist for a pathToItem"); + } + JsonSchema itemSchema = schemas.entrySet().iterator().next().getKey(); + @Nullable Object itemInstance = itemSchema.getNewInstance(item, itemPathToItem, pathToSchemas); + items.add(itemInstance); + i += 1; + } + FrozenList<@Nullable Object> newInstanceItems = new FrozenList<>(items); + return newInstanceItems; + } + + 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); + SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().build())); + ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, new PathToSchemasMap(), new LinkedHashSet<>()); + PathToSchemasMap pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet); + return getNewInstance(castArg, validationMetadata.pathToItem(), pathToSchemasMap); + } + + @Override + 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 RuntimeException("Invalid non-string key value"); + } + String propertyName = (String) entryKey; + List propertyPathToItem = new ArrayList<>(pathToItem); + propertyPathToItem.add(propertyName); + Object value = entry.getValue(); + LinkedHashMap, Nothing?> schemas = pathToSchemas.get(propertyPathToItem); + if (schemas == null) { + throw new RuntimeException("Validation result is invalid, schemas must exist for a pathToItem"); + } + JsonSchema propertySchema = schemas.entrySet().iterator().next().getKey(); + @Nullable Object propertyInstance = propertySchema.getNewInstance(value, propertyPathToItem, pathToSchemas); + properties.put(propertyName, propertyInstance); + } + FrozenMap<@Nullable Object> castProperties = new FrozenMap<>(properties); + return castProperties; + } + + public FrozenMap<@Nullable Object> validate(Map arg, SchemaConfiguration configuration) throws ValidationException { + Set> pathSet = new HashSet<>(); + List pathToItem = List.of("args[0]"); + Map castArg = castToAllowedTypes(arg, pathToItem, pathSet); + SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().build())); + PathToSchemasMap validatedPathToSchemas = new PathToSchemasMap(); + ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, new LinkedHashSet<>()); + PathToSchemasMap pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet); + return getNewInstance(castArg, validationMetadata.pathToItem(), pathToSchemasMap); + } + + @Override + public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { + if (arg == null) { + return validate((Nothing?) null, configuration); + } else if (arg instanceof Boolean) { + boolean boolArg = (Boolean) arg; + return validate(boolArg, configuration); + } else if (arg instanceof Number) { + return validate((Number) arg, configuration); + } else if (arg instanceof String) { + return validate((String) arg, configuration); + } else if (arg instanceof List) { + return validate((List) arg, 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"); + } + @Override + public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { + if (arg == null) { + return getNewInstance((Nothing?) null, pathToItem, pathToSchemas); + } else if (arg instanceof Boolean) { + boolean boolArg = (Boolean) arg; + return getNewInstance(boolArg, pathToItem, pathToSchemas); + } else if (arg instanceof Number) { + return getNewInstance((Number) arg, pathToItem, pathToSchemas); + } else if (arg instanceof String) { + return getNewInstance((String) arg, pathToItem, pathToSchemas); + } else if (arg instanceof List) { + return getNewInstance((List) arg, 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"); + } + @Override + public ShapeOrNull1BoxedVoid validateAndBox(Nothing? arg, SchemaConfiguration configuration) throws ValidationException { + return new ShapeOrNull1BoxedVoid(validate(arg, configuration)); + } + @Override + 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 { + return new ShapeOrNull1BoxedNumber(validate(arg, configuration)); + } + @Override + 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 { + return new ShapeOrNull1BoxedList(validate(arg, configuration)); + } + @Override + 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 { + if (arg == null) { + Nothing? castArg = (Nothing?) arg; + return validateAndBox(castArg, configuration); + } else if (arg instanceof Boolean booleanArg) { + boolean castArg = booleanArg; + return validateAndBox(castArg, configuration); + } else if (arg instanceof String castArg) { + return validateAndBox(castArg, configuration); + } else if (arg instanceof Number castArg) { + return validateAndBox(castArg, configuration); + } else if (arg instanceof List castArg) { + 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"); + } + } +} diff --git a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/schemas/SimpleQuadrilateral.kt b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/schemas/SimpleQuadrilateral.kt new file mode 100644 index 00000000000..f1edb5ee8e6 --- /dev/null +++ b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/schemas/SimpleQuadrilateral.kt @@ -0,0 +1,589 @@ +package org.openapijsonschematools.client.components.schemas; +import java.time.LocalDate; +import java.time.ZonedDateTime; +import java.util.ArrayList; +import java.util.HashSet; +import java.util.LinkedHashMap; +import java.util.LinkedHashSet; +import java.util.List; +import java.util.Map; +import java.util.Objects; +import java.util.Set; +import java.util.UUID; +import org.checkerframework.checker.nullness.qual.Nullable; +import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags; +import org.openapijsonschematools.client.configurations.SchemaConfiguration; +import org.openapijsonschematools.client.exceptions.InvalidAdditionalPropertyException; +import org.openapijsonschematools.client.exceptions.UnsetPropertyException; +import org.openapijsonschematools.client.exceptions.ValidationException; +import org.openapijsonschematools.client.schemas.GenericBuilder; +import org.openapijsonschematools.client.schemas.SetMaker; +import org.openapijsonschematools.client.schemas.UnsetAddPropsSetter; +import org.openapijsonschematools.client.schemas.validation.BooleanSchemaValidator; +import org.openapijsonschematools.client.schemas.validation.FrozenList; +import org.openapijsonschematools.client.schemas.validation.FrozenMap; +import org.openapijsonschematools.client.schemas.validation.JsonSchema; +import org.openapijsonschematools.client.schemas.validation.JsonSchemaInfo; +import org.openapijsonschematools.client.schemas.validation.ListSchemaValidator; +import org.openapijsonschematools.client.schemas.validation.MapSchemaValidator; +import org.openapijsonschematools.client.schemas.validation.NullSchemaValidator; +import org.openapijsonschematools.client.schemas.validation.NumberSchemaValidator; +import org.openapijsonschematools.client.schemas.validation.PathToSchemasMap; +import org.openapijsonschematools.client.schemas.validation.PropertyEntry; +import org.openapijsonschematools.client.schemas.validation.StringEnumValidator; +import org.openapijsonschematools.client.schemas.validation.StringSchemaValidator; +import org.openapijsonschematools.client.schemas.validation.StringValueMethod; +import org.openapijsonschematools.client.schemas.validation.ValidationMetadata; + +public class SimpleQuadrilateral { + // nest classes so all schemas and input/output classes can be public + + public enum StringQuadrilateralTypeEnums implements StringValueMethod { + SIMPLE_QUADRILATERAL("SimpleQuadrilateral"); + private final String value; + + StringQuadrilateralTypeEnums(String value) { + this.value = value; + } + public String value() { + return this.value; + } + } + + + public sealed interface QuadrilateralTypeBoxed permits QuadrilateralTypeBoxedString { + @Nullable Object getData(); + } + + public record QuadrilateralTypeBoxedString(String data) implements QuadrilateralTypeBoxed { + @Override + public @Nullable Object getData() { + return data; + } + } + + + + public static class QuadrilateralType extends JsonSchema implements StringSchemaValidator, StringEnumValidator { + private static @Nullable QuadrilateralType instance = null; + + protected QuadrilateralType() { + super(new JsonSchemaInfo() + .type(Set.of( + String.class + )) + .enumValues(SetMaker.makeSet( + "SimpleQuadrilateral" + )) + ); + } + + public static QuadrilateralType getInstance() { + if (instance == null) { + instance = new QuadrilateralType(); + } + return instance; + } + + @Override + public String validate(String arg, SchemaConfiguration configuration) throws ValidationException { + Set> pathSet = new HashSet<>(); + List pathToItem = List.of("args[0"); + String castArg = castToAllowedTypes(arg, pathToItem, pathSet); + SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().build())); + ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, new PathToSchemasMap(), new LinkedHashSet<>()); + getPathToSchemas(this, castArg, validationMetadata, pathSet); + return castArg; + } + + @Override + 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 { + 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"); + } + @Override + public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { + 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"); + } + @Override + 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 { + 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"); + } + } + + public static class Schema1Map extends FrozenMap<@Nullable Object> { + protected Schema1Map(FrozenMap<@Nullable Object> m) { + super(m); + } + public static final Set requiredKeys = Set.of(); + public static final Set optionalKeys = Set.of( + "quadrilateralType" + ); + public static Schema1Map of(Map arg, SchemaConfiguration configuration) throws ValidationException { + return Schema1.getInstance().validate(arg, configuration); + } + + public String quadrilateralType() throws UnsetPropertyException { + String key = "quadrilateralType"; + throwIfKeyNotPresent(key); + @Nullable Object value = get(key); + if (!(value instanceof String)) { + throw new RuntimeException("Invalid value stored for quadrilateralType"); + } + return (String) value; + } + + public @Nullable Object getAdditionalProperty(String name) throws UnsetPropertyException, InvalidAdditionalPropertyException { + throwIfKeyKnown(name, requiredKeys, optionalKeys); + throwIfKeyNotPresent(name); + return get(name); + } + } + + public interface SetterForQuadrilateralType { + Map getInstance(); + T getBuilderAfterQuadrilateralType(Map instance); + + default T quadrilateralType(String value) { + var instance = getInstance(); + instance.put("quadrilateralType", value); + return getBuilderAfterQuadrilateralType(instance); + } + + default T quadrilateralType(StringQuadrilateralTypeEnums value) { + var instance = getInstance(); + instance.put("quadrilateralType", value.value()); + return getBuilderAfterQuadrilateralType(instance); + } + } + + public static class Schema1MapBuilder extends UnsetAddPropsSetter implements GenericBuilder>, SetterForQuadrilateralType { + private final Map instance; + private static final Set knownKeys = Set.of( + "quadrilateralType" + ); + public Set getKnownKeys() { + return knownKeys; + } + public Schema1MapBuilder() { + this.instance = new LinkedHashMap<>(); + } + public Map build() { + return instance; + } + public Map getInstance() { + return instance; + } + public Schema1MapBuilder getBuilderAfterQuadrilateralType(Map instance) { + return this; + } + public Schema1MapBuilder getBuilderAfterAdditionalProperty(Map instance) { + return this; + } + } + + + public sealed interface Schema1Boxed permits Schema1BoxedMap { + @Nullable Object getData(); + } + + public record Schema1BoxedMap(Schema1Map data) implements Schema1Boxed { + @Override + public @Nullable Object getData() { + return data; + } + } + + + public static class Schema1 extends JsonSchema implements MapSchemaValidator { + private static @Nullable Schema1 instance = null; + + protected Schema1() { + super(new JsonSchemaInfo() + .type(Set.of(Map.class)) + .properties(Map.ofEntries( + new PropertyEntry("quadrilateralType", QuadrilateralType.class) + )) + ); + } + + public static Schema1 getInstance() { + if (instance == null) { + instance = new Schema1(); + } + return instance; + } + + 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 RuntimeException("Invalid non-string key value"); + } + String propertyName = (String) entryKey; + List propertyPathToItem = new ArrayList<>(pathToItem); + propertyPathToItem.add(propertyName); + Object value = entry.getValue(); + LinkedHashMap, Nothing?> schemas = pathToSchemas.get(propertyPathToItem); + if (schemas == null) { + throw new RuntimeException("Validation result is invalid, schemas must exist for a pathToItem"); + } + JsonSchema propertySchema = schemas.entrySet().iterator().next().getKey(); + @Nullable Object propertyInstance = propertySchema.getNewInstance(value, propertyPathToItem, pathToSchemas); + properties.put(propertyName, propertyInstance); + } + FrozenMap<@Nullable Object> castProperties = new FrozenMap<>(properties); + return new Schema1Map(castProperties); + } + + 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); + SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().build())); + ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, new PathToSchemasMap(), new LinkedHashSet<>()); + PathToSchemasMap pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet); + return getNewInstance(castArg, validationMetadata.pathToItem(), pathToSchemasMap); + } + + + @Override + public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws 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"); + } + @Override + public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { + if (arg instanceof Map) { + return getNewInstance((Map) arg, pathToItem, pathToSchemas); + } + 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 { + return new Schema1BoxedMap(validate(arg, configuration)); + } + @Override + public Schema1Boxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { + 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"); + } + } + + + public sealed interface SimpleQuadrilateral1Boxed permits SimpleQuadrilateral1BoxedVoid, SimpleQuadrilateral1BoxedBoolean, SimpleQuadrilateral1BoxedNumber, SimpleQuadrilateral1BoxedString, SimpleQuadrilateral1BoxedList, SimpleQuadrilateral1BoxedMap { + @Nullable Object getData(); + } + + public record SimpleQuadrilateral1BoxedVoid(Nothing? data) implements SimpleQuadrilateral1Boxed { + @Override + public @Nullable Object getData() { + return data; + } + } + + public record SimpleQuadrilateral1BoxedBoolean(boolean data) implements SimpleQuadrilateral1Boxed { + @Override + public @Nullable Object getData() { + return data; + } + } + + public record SimpleQuadrilateral1BoxedNumber(Number data) implements SimpleQuadrilateral1Boxed { + @Override + public @Nullable Object getData() { + return data; + } + } + + public record SimpleQuadrilateral1BoxedString(String data) implements SimpleQuadrilateral1Boxed { + @Override + public @Nullable Object getData() { + return data; + } + } + + public record SimpleQuadrilateral1BoxedList(FrozenList<@Nullable Object> data) implements SimpleQuadrilateral1Boxed { + @Override + public @Nullable Object getData() { + return data; + } + } + + public record SimpleQuadrilateral1BoxedMap(FrozenMap<@Nullable Object> data) implements SimpleQuadrilateral1Boxed { + @Override + public @Nullable Object getData() { + return data; + } + } + + + public static class SimpleQuadrilateral1 extends JsonSchema implements NullSchemaValidator, BooleanSchemaValidator, NumberSchemaValidator, StringSchemaValidator, ListSchemaValidator, SimpleQuadrilateral1BoxedList>, MapSchemaValidator, SimpleQuadrilateral1BoxedMap> { + /* + NOTE: This class is auto generated by OpenAPI JSON Schema Generator. + Ref: https://github.com/openapi-json-schema-tools/openapi-json-schema-generator + + Do not edit the class manually. + */ + private static @Nullable SimpleQuadrilateral1 instance = null; + + protected SimpleQuadrilateral1() { + super(new JsonSchemaInfo() + .allOf(List.of( + QuadrilateralInterface.QuadrilateralInterface1.class, + Schema1.class + )) + ); + } + + public static SimpleQuadrilateral1 getInstance() { + if (instance == null) { + instance = new SimpleQuadrilateral1(); + } + return instance; + } + + @Override + public Nothing? validate(Nothing? arg, SchemaConfiguration configuration) throws ValidationException { + Set> pathSet = new HashSet<>(); + List pathToItem = List.of("args[0]"); + Nothing? castArg = castToAllowedTypes(arg, pathToItem, pathSet); + SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().build())); + PathToSchemasMap validatedPathToSchemas = new PathToSchemasMap(); + ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, new LinkedHashSet<>()); + getPathToSchemas(this, castArg, validationMetadata, pathSet); + return castArg; + } + + @Override + public boolean validate(boolean arg, SchemaConfiguration configuration) throws ValidationException { + Set> pathSet = new HashSet<>(); + List pathToItem = List.of("args[0]"); + boolean castArg = castToAllowedTypes(arg, pathToItem, pathSet); + SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().build())); + PathToSchemasMap validatedPathToSchemas = new PathToSchemasMap(); + ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, new LinkedHashSet<>()); + getPathToSchemas(this, castArg, validationMetadata, pathSet); + return castArg; + } + + @Override + public Number validate(Number arg, SchemaConfiguration configuration) throws ValidationException { + Set> pathSet = new HashSet<>(); + List pathToItem = List.of("args[0]"); + Number castArg = castToAllowedTypes(arg, pathToItem, pathSet); + SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().build())); + PathToSchemasMap validatedPathToSchemas = new PathToSchemasMap(); + ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, new LinkedHashSet<>()); + getPathToSchemas(this, castArg, validationMetadata, pathSet); + return castArg; + } + + public int validate(int arg, SchemaConfiguration configuration) throws ValidationException { + return (int) validate((Number) arg, configuration); + } + + public long validate(long arg, SchemaConfiguration configuration) throws ValidationException { + return (long) validate((Number) arg, configuration); + } + + public float validate(float arg, SchemaConfiguration configuration) throws ValidationException { + return (float) validate((Number) arg, configuration); + } + + public double validate(double arg, SchemaConfiguration configuration) throws ValidationException { + return (double) validate((Number) arg, configuration); + } + + @Override + public String validate(String arg, SchemaConfiguration configuration) throws ValidationException { + Set> pathSet = new HashSet<>(); + List pathToItem = List.of("args[0]"); + String castArg = castToAllowedTypes(arg, pathToItem, pathSet); + SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().build())); + PathToSchemasMap validatedPathToSchemas = new PathToSchemasMap(); + ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, new LinkedHashSet<>()); + getPathToSchemas(this, castArg, validationMetadata, pathSet); + return castArg; + } + + public String validate(LocalDate arg, SchemaConfiguration configuration) throws ValidationException { + return validate(arg.toString(), configuration); + } + + public String validate(ZonedDateTime arg, SchemaConfiguration configuration) throws ValidationException { + return validate(arg.toString(), configuration); + } + + public String validate(UUID arg, SchemaConfiguration configuration) throws ValidationException { + return validate(arg.toString(), configuration); + } + + @Override + public FrozenList<@Nullable Object> getNewInstance(List arg, List pathToItem, PathToSchemasMap pathToSchemas) { + List<@Nullable Object> items = new ArrayList<>(); + int i = 0; + for (Object item: arg) { + List itemPathToItem = new ArrayList<>(pathToItem); + itemPathToItem.add(i); + LinkedHashMap, Nothing?> schemas = pathToSchemas.get(itemPathToItem); + if (schemas == null) { + throw new RuntimeException("Validation result is invalid, schemas must exist for a pathToItem"); + } + JsonSchema itemSchema = schemas.entrySet().iterator().next().getKey(); + @Nullable Object itemInstance = itemSchema.getNewInstance(item, itemPathToItem, pathToSchemas); + items.add(itemInstance); + i += 1; + } + FrozenList<@Nullable Object> newInstanceItems = new FrozenList<>(items); + return newInstanceItems; + } + + 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); + SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().build())); + ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, new PathToSchemasMap(), new LinkedHashSet<>()); + PathToSchemasMap pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet); + return getNewInstance(castArg, validationMetadata.pathToItem(), pathToSchemasMap); + } + + @Override + 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 RuntimeException("Invalid non-string key value"); + } + String propertyName = (String) entryKey; + List propertyPathToItem = new ArrayList<>(pathToItem); + propertyPathToItem.add(propertyName); + Object value = entry.getValue(); + LinkedHashMap, Nothing?> schemas = pathToSchemas.get(propertyPathToItem); + if (schemas == null) { + throw new RuntimeException("Validation result is invalid, schemas must exist for a pathToItem"); + } + JsonSchema propertySchema = schemas.entrySet().iterator().next().getKey(); + @Nullable Object propertyInstance = propertySchema.getNewInstance(value, propertyPathToItem, pathToSchemas); + properties.put(propertyName, propertyInstance); + } + FrozenMap<@Nullable Object> castProperties = new FrozenMap<>(properties); + return castProperties; + } + + public FrozenMap<@Nullable Object> validate(Map arg, SchemaConfiguration configuration) throws ValidationException { + Set> pathSet = new HashSet<>(); + List pathToItem = List.of("args[0]"); + Map castArg = castToAllowedTypes(arg, pathToItem, pathSet); + SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().build())); + PathToSchemasMap validatedPathToSchemas = new PathToSchemasMap(); + ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, new LinkedHashSet<>()); + PathToSchemasMap pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet); + return getNewInstance(castArg, validationMetadata.pathToItem(), pathToSchemasMap); + } + + @Override + public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { + if (arg == null) { + return validate((Nothing?) null, configuration); + } else if (arg instanceof Boolean) { + boolean boolArg = (Boolean) arg; + return validate(boolArg, configuration); + } else if (arg instanceof Number) { + return validate((Number) arg, configuration); + } else if (arg instanceof String) { + return validate((String) arg, configuration); + } else if (arg instanceof List) { + return validate((List) arg, 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"); + } + @Override + public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { + if (arg == null) { + return getNewInstance((Nothing?) null, pathToItem, pathToSchemas); + } else if (arg instanceof Boolean) { + boolean boolArg = (Boolean) arg; + return getNewInstance(boolArg, pathToItem, pathToSchemas); + } else if (arg instanceof Number) { + return getNewInstance((Number) arg, pathToItem, pathToSchemas); + } else if (arg instanceof String) { + return getNewInstance((String) arg, pathToItem, pathToSchemas); + } else if (arg instanceof List) { + return getNewInstance((List) arg, 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"); + } + @Override + public SimpleQuadrilateral1BoxedVoid validateAndBox(Nothing? arg, SchemaConfiguration configuration) throws ValidationException { + return new SimpleQuadrilateral1BoxedVoid(validate(arg, configuration)); + } + @Override + 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 { + return new SimpleQuadrilateral1BoxedNumber(validate(arg, configuration)); + } + @Override + 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 { + return new SimpleQuadrilateral1BoxedList(validate(arg, configuration)); + } + @Override + 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 { + if (arg == null) { + Nothing? castArg = (Nothing?) arg; + return validateAndBox(castArg, configuration); + } else if (arg instanceof Boolean booleanArg) { + boolean castArg = booleanArg; + return validateAndBox(castArg, configuration); + } else if (arg instanceof String castArg) { + return validateAndBox(castArg, configuration); + } else if (arg instanceof Number castArg) { + return validateAndBox(castArg, configuration); + } else if (arg instanceof List castArg) { + 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"); + } + } +} diff --git a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/schemas/SomeObject.kt b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/schemas/SomeObject.kt new file mode 100644 index 00000000000..daeed20c11e --- /dev/null +++ b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/schemas/SomeObject.kt @@ -0,0 +1,329 @@ +package org.openapijsonschematools.client.components.schemas; +import java.time.LocalDate; +import java.time.ZonedDateTime; +import java.util.ArrayList; +import java.util.HashSet; +import java.util.LinkedHashMap; +import java.util.LinkedHashSet; +import java.util.List; +import java.util.Map; +import java.util.Objects; +import java.util.Set; +import java.util.UUID; +import org.checkerframework.checker.nullness.qual.Nullable; +import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags; +import org.openapijsonschematools.client.configurations.SchemaConfiguration; +import org.openapijsonschematools.client.exceptions.InvalidAdditionalPropertyException; +import org.openapijsonschematools.client.exceptions.UnsetPropertyException; +import org.openapijsonschematools.client.exceptions.ValidationException; +import org.openapijsonschematools.client.schemas.UnsetAddPropsSetter; +import org.openapijsonschematools.client.schemas.validation.BooleanSchemaValidator; +import org.openapijsonschematools.client.schemas.validation.FrozenList; +import org.openapijsonschematools.client.schemas.validation.FrozenMap; +import org.openapijsonschematools.client.schemas.validation.JsonSchema; +import org.openapijsonschematools.client.schemas.validation.JsonSchemaInfo; +import org.openapijsonschematools.client.schemas.validation.ListSchemaValidator; +import org.openapijsonschematools.client.schemas.validation.MapSchemaValidator; +import org.openapijsonschematools.client.schemas.validation.NullSchemaValidator; +import org.openapijsonschematools.client.schemas.validation.NumberSchemaValidator; +import org.openapijsonschematools.client.schemas.validation.PathToSchemasMap; +import org.openapijsonschematools.client.schemas.validation.StringSchemaValidator; +import org.openapijsonschematools.client.schemas.validation.ValidationMetadata; + +public class SomeObject { + // nest classes so all schemas and input/output classes can be public + + + public sealed interface SomeObject1Boxed permits SomeObject1BoxedVoid, SomeObject1BoxedBoolean, SomeObject1BoxedNumber, SomeObject1BoxedString, SomeObject1BoxedList, SomeObject1BoxedMap { + @Nullable Object getData(); + } + + public record SomeObject1BoxedVoid(Nothing? data) implements SomeObject1Boxed { + @Override + public @Nullable Object getData() { + return data; + } + } + + public record SomeObject1BoxedBoolean(boolean data) implements SomeObject1Boxed { + @Override + public @Nullable Object getData() { + return data; + } + } + + public record SomeObject1BoxedNumber(Number data) implements SomeObject1Boxed { + @Override + public @Nullable Object getData() { + return data; + } + } + + public record SomeObject1BoxedString(String data) implements SomeObject1Boxed { + @Override + public @Nullable Object getData() { + return data; + } + } + + public record SomeObject1BoxedList(FrozenList<@Nullable Object> data) implements SomeObject1Boxed { + @Override + public @Nullable Object getData() { + return data; + } + } + + public record SomeObject1BoxedMap(FrozenMap<@Nullable Object> data) implements SomeObject1Boxed { + @Override + public @Nullable Object getData() { + return data; + } + } + + + public static class SomeObject1 extends JsonSchema implements NullSchemaValidator, BooleanSchemaValidator, NumberSchemaValidator, StringSchemaValidator, ListSchemaValidator, SomeObject1BoxedList>, MapSchemaValidator, SomeObject1BoxedMap> { + /* + NOTE: This class is auto generated by OpenAPI JSON Schema Generator. + Ref: https://github.com/openapi-json-schema-tools/openapi-json-schema-generator + + Do not edit the class manually. + */ + private static @Nullable SomeObject1 instance = null; + + protected SomeObject1() { + super(new JsonSchemaInfo() + .allOf(List.of( + ObjectInterface.ObjectInterface1.class + )) + ); + } + + public static SomeObject1 getInstance() { + if (instance == null) { + instance = new SomeObject1(); + } + return instance; + } + + @Override + public Nothing? validate(Nothing? arg, SchemaConfiguration configuration) throws ValidationException { + Set> pathSet = new HashSet<>(); + List pathToItem = List.of("args[0]"); + Nothing? castArg = castToAllowedTypes(arg, pathToItem, pathSet); + SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().build())); + PathToSchemasMap validatedPathToSchemas = new PathToSchemasMap(); + ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, new LinkedHashSet<>()); + getPathToSchemas(this, castArg, validationMetadata, pathSet); + return castArg; + } + + @Override + public boolean validate(boolean arg, SchemaConfiguration configuration) throws ValidationException { + Set> pathSet = new HashSet<>(); + List pathToItem = List.of("args[0]"); + boolean castArg = castToAllowedTypes(arg, pathToItem, pathSet); + SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().build())); + PathToSchemasMap validatedPathToSchemas = new PathToSchemasMap(); + ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, new LinkedHashSet<>()); + getPathToSchemas(this, castArg, validationMetadata, pathSet); + return castArg; + } + + @Override + public Number validate(Number arg, SchemaConfiguration configuration) throws ValidationException { + Set> pathSet = new HashSet<>(); + List pathToItem = List.of("args[0]"); + Number castArg = castToAllowedTypes(arg, pathToItem, pathSet); + SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().build())); + PathToSchemasMap validatedPathToSchemas = new PathToSchemasMap(); + ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, new LinkedHashSet<>()); + getPathToSchemas(this, castArg, validationMetadata, pathSet); + return castArg; + } + + public int validate(int arg, SchemaConfiguration configuration) throws ValidationException { + return (int) validate((Number) arg, configuration); + } + + public long validate(long arg, SchemaConfiguration configuration) throws ValidationException { + return (long) validate((Number) arg, configuration); + } + + public float validate(float arg, SchemaConfiguration configuration) throws ValidationException { + return (float) validate((Number) arg, configuration); + } + + public double validate(double arg, SchemaConfiguration configuration) throws ValidationException { + return (double) validate((Number) arg, configuration); + } + + @Override + public String validate(String arg, SchemaConfiguration configuration) throws ValidationException { + Set> pathSet = new HashSet<>(); + List pathToItem = List.of("args[0]"); + String castArg = castToAllowedTypes(arg, pathToItem, pathSet); + SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().build())); + PathToSchemasMap validatedPathToSchemas = new PathToSchemasMap(); + ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, new LinkedHashSet<>()); + getPathToSchemas(this, castArg, validationMetadata, pathSet); + return castArg; + } + + public String validate(LocalDate arg, SchemaConfiguration configuration) throws ValidationException { + return validate(arg.toString(), configuration); + } + + public String validate(ZonedDateTime arg, SchemaConfiguration configuration) throws ValidationException { + return validate(arg.toString(), configuration); + } + + public String validate(UUID arg, SchemaConfiguration configuration) throws ValidationException { + return validate(arg.toString(), configuration); + } + + @Override + public FrozenList<@Nullable Object> getNewInstance(List arg, List pathToItem, PathToSchemasMap pathToSchemas) { + List<@Nullable Object> items = new ArrayList<>(); + int i = 0; + for (Object item: arg) { + List itemPathToItem = new ArrayList<>(pathToItem); + itemPathToItem.add(i); + LinkedHashMap, Nothing?> schemas = pathToSchemas.get(itemPathToItem); + if (schemas == null) { + throw new RuntimeException("Validation result is invalid, schemas must exist for a pathToItem"); + } + JsonSchema itemSchema = schemas.entrySet().iterator().next().getKey(); + @Nullable Object itemInstance = itemSchema.getNewInstance(item, itemPathToItem, pathToSchemas); + items.add(itemInstance); + i += 1; + } + FrozenList<@Nullable Object> newInstanceItems = new FrozenList<>(items); + return newInstanceItems; + } + + 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); + SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().build())); + ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, new PathToSchemasMap(), new LinkedHashSet<>()); + PathToSchemasMap pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet); + return getNewInstance(castArg, validationMetadata.pathToItem(), pathToSchemasMap); + } + + @Override + 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 RuntimeException("Invalid non-string key value"); + } + String propertyName = (String) entryKey; + List propertyPathToItem = new ArrayList<>(pathToItem); + propertyPathToItem.add(propertyName); + Object value = entry.getValue(); + LinkedHashMap, Nothing?> schemas = pathToSchemas.get(propertyPathToItem); + if (schemas == null) { + throw new RuntimeException("Validation result is invalid, schemas must exist for a pathToItem"); + } + JsonSchema propertySchema = schemas.entrySet().iterator().next().getKey(); + @Nullable Object propertyInstance = propertySchema.getNewInstance(value, propertyPathToItem, pathToSchemas); + properties.put(propertyName, propertyInstance); + } + FrozenMap<@Nullable Object> castProperties = new FrozenMap<>(properties); + return castProperties; + } + + public FrozenMap<@Nullable Object> validate(Map arg, SchemaConfiguration configuration) throws ValidationException { + Set> pathSet = new HashSet<>(); + List pathToItem = List.of("args[0]"); + Map castArg = castToAllowedTypes(arg, pathToItem, pathSet); + SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().build())); + PathToSchemasMap validatedPathToSchemas = new PathToSchemasMap(); + ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, new LinkedHashSet<>()); + PathToSchemasMap pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet); + return getNewInstance(castArg, validationMetadata.pathToItem(), pathToSchemasMap); + } + + @Override + public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { + if (arg == null) { + return validate((Nothing?) null, configuration); + } else if (arg instanceof Boolean) { + boolean boolArg = (Boolean) arg; + return validate(boolArg, configuration); + } else if (arg instanceof Number) { + return validate((Number) arg, configuration); + } else if (arg instanceof String) { + return validate((String) arg, configuration); + } else if (arg instanceof List) { + return validate((List) arg, 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"); + } + @Override + public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { + if (arg == null) { + return getNewInstance((Nothing?) null, pathToItem, pathToSchemas); + } else if (arg instanceof Boolean) { + boolean boolArg = (Boolean) arg; + return getNewInstance(boolArg, pathToItem, pathToSchemas); + } else if (arg instanceof Number) { + return getNewInstance((Number) arg, pathToItem, pathToSchemas); + } else if (arg instanceof String) { + return getNewInstance((String) arg, pathToItem, pathToSchemas); + } else if (arg instanceof List) { + return getNewInstance((List) arg, 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"); + } + @Override + public SomeObject1BoxedVoid validateAndBox(Nothing? arg, SchemaConfiguration configuration) throws ValidationException { + return new SomeObject1BoxedVoid(validate(arg, configuration)); + } + @Override + 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 { + return new SomeObject1BoxedNumber(validate(arg, configuration)); + } + @Override + 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 { + return new SomeObject1BoxedList(validate(arg, configuration)); + } + @Override + 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 { + if (arg == null) { + Nothing? castArg = (Nothing?) arg; + return validateAndBox(castArg, configuration); + } else if (arg instanceof Boolean booleanArg) { + boolean castArg = booleanArg; + return validateAndBox(castArg, configuration); + } else if (arg instanceof String castArg) { + return validateAndBox(castArg, configuration); + } else if (arg instanceof Number castArg) { + return validateAndBox(castArg, configuration); + } else if (arg instanceof List castArg) { + 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"); + } + } +} diff --git a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/schemas/SpecialModelname.kt b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/schemas/SpecialModelname.kt new file mode 100644 index 00000000000..bb17489d327 --- /dev/null +++ b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/schemas/SpecialModelname.kt @@ -0,0 +1,208 @@ +package org.openapijsonschematools.client.components.schemas; +import java.util.ArrayList; +import java.util.HashSet; +import java.util.LinkedHashMap; +import java.util.LinkedHashSet; +import java.util.List; +import java.util.Map; +import java.util.Objects; +import java.util.Set; +import org.checkerframework.checker.nullness.qual.Nullable; +import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags; +import org.openapijsonschematools.client.configurations.SchemaConfiguration; +import org.openapijsonschematools.client.exceptions.InvalidAdditionalPropertyException; +import org.openapijsonschematools.client.exceptions.UnsetPropertyException; +import org.openapijsonschematools.client.exceptions.ValidationException; +import org.openapijsonschematools.client.schemas.GenericBuilder; +import org.openapijsonschematools.client.schemas.StringJsonSchema; +import org.openapijsonschematools.client.schemas.UnsetAddPropsSetter; +import org.openapijsonschematools.client.schemas.validation.FrozenMap; +import org.openapijsonschematools.client.schemas.validation.JsonSchema; +import org.openapijsonschematools.client.schemas.validation.JsonSchemaInfo; +import org.openapijsonschematools.client.schemas.validation.MapSchemaValidator; +import org.openapijsonschematools.client.schemas.validation.PathToSchemasMap; +import org.openapijsonschematools.client.schemas.validation.PropertyEntry; +import org.openapijsonschematools.client.schemas.validation.ValidationMetadata; + +public class SpecialModelname { + // nest classes so all schemas and input/output classes can be public + + + public static class A extends StringJsonSchema.StringJsonSchema1 { + private static @Nullable A instance = null; + public static A getInstance() { + if (instance == null) { + instance = new A(); + } + return instance; + } + } + + + public static class SpecialModelnameMap extends FrozenMap<@Nullable Object> { + protected SpecialModelnameMap(FrozenMap<@Nullable Object> m) { + super(m); + } + public static final Set requiredKeys = Set.of(); + public static final Set optionalKeys = Set.of( + "a" + ); + public static SpecialModelnameMap of(Map arg, SchemaConfiguration configuration) throws ValidationException { + return SpecialModelname1.getInstance().validate(arg, configuration); + } + + public String a() throws UnsetPropertyException { + String key = "a"; + throwIfKeyNotPresent(key); + @Nullable Object value = get(key); + if (!(value instanceof String)) { + throw new RuntimeException("Invalid value stored for a"); + } + return (String) value; + } + + public @Nullable Object getAdditionalProperty(String name) throws UnsetPropertyException, InvalidAdditionalPropertyException { + throwIfKeyKnown(name, requiredKeys, optionalKeys); + throwIfKeyNotPresent(name); + return get(name); + } + } + + public interface SetterForA { + Map getInstance(); + T getBuilderAfterA(Map instance); + + default T a(String value) { + var instance = getInstance(); + instance.put("a", value); + return getBuilderAfterA(instance); + } + } + + public static class SpecialModelnameMapBuilder extends UnsetAddPropsSetter implements GenericBuilder>, SetterForA { + private final Map instance; + private static final Set knownKeys = Set.of( + "a" + ); + public Set getKnownKeys() { + return knownKeys; + } + public SpecialModelnameMapBuilder() { + this.instance = new LinkedHashMap<>(); + } + public Map build() { + return instance; + } + public Map getInstance() { + return instance; + } + public SpecialModelnameMapBuilder getBuilderAfterA(Map instance) { + return this; + } + public SpecialModelnameMapBuilder getBuilderAfterAdditionalProperty(Map instance) { + return this; + } + } + + + public sealed interface SpecialModelname1Boxed permits SpecialModelname1BoxedMap { + @Nullable Object getData(); + } + + public record SpecialModelname1BoxedMap(SpecialModelnameMap data) implements SpecialModelname1Boxed { + @Override + public @Nullable Object getData() { + return data; + } + } + + + public static class SpecialModelname1 extends JsonSchema implements MapSchemaValidator { + /* + NOTE: This class is auto generated by OpenAPI JSON Schema Generator. + Ref: https://github.com/openapi-json-schema-tools/openapi-json-schema-generator + + Do not edit the class manually. + + model with an invalid class name for python + */ + private static @Nullable SpecialModelname1 instance = null; + + protected SpecialModelname1() { + super(new JsonSchemaInfo() + .type(Set.of(Map.class)) + .properties(Map.ofEntries( + new PropertyEntry("a", A.class) + )) + ); + } + + public static SpecialModelname1 getInstance() { + if (instance == null) { + instance = new SpecialModelname1(); + } + return instance; + } + + 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 RuntimeException("Invalid non-string key value"); + } + String propertyName = (String) entryKey; + List propertyPathToItem = new ArrayList<>(pathToItem); + propertyPathToItem.add(propertyName); + Object value = entry.getValue(); + LinkedHashMap, Nothing?> schemas = pathToSchemas.get(propertyPathToItem); + if (schemas == null) { + throw new RuntimeException("Validation result is invalid, schemas must exist for a pathToItem"); + } + JsonSchema propertySchema = schemas.entrySet().iterator().next().getKey(); + @Nullable Object propertyInstance = propertySchema.getNewInstance(value, propertyPathToItem, pathToSchemas); + properties.put(propertyName, propertyInstance); + } + FrozenMap<@Nullable Object> castProperties = new FrozenMap<>(properties); + return new SpecialModelnameMap(castProperties); + } + + 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); + SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().build())); + ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, new PathToSchemasMap(), new LinkedHashSet<>()); + PathToSchemasMap pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet); + return getNewInstance(castArg, validationMetadata.pathToItem(), pathToSchemasMap); + } + + + @Override + public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws 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"); + } + @Override + public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { + if (arg instanceof Map) { + return getNewInstance((Map) arg, pathToItem, pathToSchemas); + } + 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 { + return new SpecialModelname1BoxedMap(validate(arg, configuration)); + } + @Override + public SpecialModelname1Boxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { + 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"); + } + } + +} diff --git a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/schemas/StringBooleanMap.kt b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/schemas/StringBooleanMap.kt new file mode 100644 index 00000000000..bba1d435632 --- /dev/null +++ b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/schemas/StringBooleanMap.kt @@ -0,0 +1,194 @@ +package org.openapijsonschematools.client.components.schemas; +import java.util.ArrayList; +import java.util.HashSet; +import java.util.LinkedHashMap; +import java.util.LinkedHashSet; +import java.util.List; +import java.util.Map; +import java.util.Objects; +import java.util.Set; +import org.checkerframework.checker.nullness.qual.Nullable; +import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags; +import org.openapijsonschematools.client.configurations.SchemaConfiguration; +import org.openapijsonschematools.client.exceptions.InvalidAdditionalPropertyException; +import org.openapijsonschematools.client.exceptions.UnsetPropertyException; +import org.openapijsonschematools.client.exceptions.ValidationException; +import org.openapijsonschematools.client.schemas.BooleanJsonSchema; +import org.openapijsonschematools.client.schemas.GenericBuilder; +import org.openapijsonschematools.client.schemas.validation.FrozenMap; +import org.openapijsonschematools.client.schemas.validation.JsonSchema; +import org.openapijsonschematools.client.schemas.validation.JsonSchemaInfo; +import org.openapijsonschematools.client.schemas.validation.MapSchemaValidator; +import org.openapijsonschematools.client.schemas.validation.MapUtils; +import org.openapijsonschematools.client.schemas.validation.PathToSchemasMap; +import org.openapijsonschematools.client.schemas.validation.ValidationMetadata; + +public class StringBooleanMap { + // nest classes so all schemas and input/output classes can be public + + + public static class AdditionalProperties extends BooleanJsonSchema.BooleanJsonSchema1 { + private static @Nullable AdditionalProperties instance = null; + public static AdditionalProperties getInstance() { + if (instance == null) { + instance = new AdditionalProperties(); + } + return instance; + } + } + + + public static class StringBooleanMapMap extends FrozenMap { + protected StringBooleanMapMap(FrozenMap m) { + super(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 { + return StringBooleanMap1.getInstance().validate(arg, configuration); + } + + public boolean getAdditionalProperty(String name) throws UnsetPropertyException { + throwIfKeyNotPresent(name); + Boolean value = get(name); + if (value == null) { + throw new RuntimeException("Value may not be null"); + } + return (boolean) value; + } + } + + public interface SetterForAdditionalProperties { + Set getKnownKeys(); + Map getInstance(); + T getBuilderAfterAdditionalProperty(Map instance); + + default T additionalProperty(String key, boolean value) throws InvalidAdditionalPropertyException { + MapUtils.throwIfKeyKnown(key, getKnownKeys(), true); + var instance = getInstance(); + instance.put(key, value); + return getBuilderAfterAdditionalProperty(instance); + } + } + + public static class StringBooleanMapMapBuilder implements GenericBuilder>, SetterForAdditionalProperties { + private final Map instance; + private static final Set knownKeys = Set.of(); + public Set getKnownKeys() { + return knownKeys; + } + public StringBooleanMapMapBuilder() { + this.instance = new LinkedHashMap<>(); + } + public Map build() { + return instance; + } + public Map getInstance() { + return instance; + } + public StringBooleanMapMapBuilder getBuilderAfterAdditionalProperty(Map instance) { + return this; + } + } + + + public sealed interface StringBooleanMap1Boxed permits StringBooleanMap1BoxedMap { + @Nullable Object getData(); + } + + public record StringBooleanMap1BoxedMap(StringBooleanMapMap data) implements StringBooleanMap1Boxed { + @Override + public @Nullable Object getData() { + return data; + } + } + + + public static class StringBooleanMap1 extends JsonSchema implements MapSchemaValidator { + /* + NOTE: This class is auto generated by OpenAPI JSON Schema Generator. + Ref: https://github.com/openapi-json-schema-tools/openapi-json-schema-generator + + Do not edit the class manually. + */ + private static @Nullable StringBooleanMap1 instance = null; + + protected StringBooleanMap1() { + super(new JsonSchemaInfo() + .type(Set.of(Map.class)) + .additionalProperties(AdditionalProperties.class) + ); + } + + public static StringBooleanMap1 getInstance() { + if (instance == null) { + instance = new StringBooleanMap1(); + } + return instance; + } + + 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 RuntimeException("Invalid non-string key value"); + } + String propertyName = (String) entryKey; + List propertyPathToItem = new ArrayList<>(pathToItem); + propertyPathToItem.add(propertyName); + Object value = entry.getValue(); + LinkedHashMap, Nothing?> schemas = pathToSchemas.get(propertyPathToItem); + if (schemas == null) { + throw new RuntimeException("Validation 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"); + } + properties.put(propertyName, (Boolean) propertyInstance); + } + FrozenMap castProperties = new FrozenMap<>(properties); + return new StringBooleanMapMap(castProperties); + } + + 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); + SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().build())); + ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, new PathToSchemasMap(), new LinkedHashSet<>()); + PathToSchemasMap pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet); + return getNewInstance(castArg, validationMetadata.pathToItem(), pathToSchemasMap); + } + + + @Override + public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws 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"); + } + @Override + public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { + if (arg instanceof Map) { + return getNewInstance((Map) arg, pathToItem, pathToSchemas); + } + 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 { + return new StringBooleanMap1BoxedMap(validate(arg, configuration)); + } + @Override + public StringBooleanMap1Boxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { + 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"); + } + } + +} diff --git a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/schemas/StringEnum.kt b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/schemas/StringEnum.kt new file mode 100644 index 00000000000..39c7da3e835 --- /dev/null +++ b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/schemas/StringEnum.kt @@ -0,0 +1,180 @@ +package org.openapijsonschematools.client.components.schemas; +import java.util.HashSet; +import java.util.LinkedHashSet; +import java.util.List; +import java.util.Map; +import java.util.Objects; +import java.util.Set; +import org.checkerframework.checker.nullness.qual.Nullable; +import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags; +import org.openapijsonschematools.client.configurations.SchemaConfiguration; +import org.openapijsonschematools.client.exceptions.ValidationException; +import org.openapijsonschematools.client.schemas.SetMaker; +import org.openapijsonschematools.client.schemas.validation.JsonSchema; +import org.openapijsonschematools.client.schemas.validation.JsonSchemaInfo; +import org.openapijsonschematools.client.schemas.validation.NullEnumValidator; +import org.openapijsonschematools.client.schemas.validation.NullSchemaValidator; +import org.openapijsonschematools.client.schemas.validation.NullValueMethod; +import org.openapijsonschematools.client.schemas.validation.PathToSchemasMap; +import org.openapijsonschematools.client.schemas.validation.StringEnumValidator; +import org.openapijsonschematools.client.schemas.validation.StringSchemaValidator; +import org.openapijsonschematools.client.schemas.validation.StringValueMethod; +import org.openapijsonschematools.client.schemas.validation.ValidationMetadata; + +public class StringEnum { + // nest classes so all schemas and input/output classes can be public + + public enum StringStringEnumEnums implements StringValueMethod { + PLACED("placed"), + APPROVED("approved"), + DELIVERED("delivered"), + SINGLE_QUOTED("single quoted"), + MULTIPLE_LINE_FEED_LF_LINES("multiple\nlines"), + DOUBLE_QUOTE_LINE_FEED_LF_WITH_NEWLINE("double quote \n with newline"); + private final String value; + + StringStringEnumEnums(String value) { + this.value = value; + } + public String value() { + return this.value; + } + } + + public enum NullStringEnumEnums implements NullValueMethod { + NONE(null); + private final Nothing? value; + + NullStringEnumEnums(Nothing? value) { + this.value = value; + } + public Nothing? value() { + return this.value; + } + } + + + public sealed interface StringEnum1Boxed permits StringEnum1BoxedNothing?, StringEnum1BoxedString { + @Nullable Object getData(); + } + + public record StringEnum1BoxedVoid(Nothing? data) implements StringEnum1Boxed { + @Override + public @Nullable Object getData() { + return data; + } + } + + public record StringEnum1BoxedString(String data) implements StringEnum1Boxed { + @Override + public @Nullable Object getData() { + return data; + } + } + + + + public static class StringEnum1 extends JsonSchema implements NullEnumValidator, StringEnumValidator, NullSchemaValidator, StringSchemaValidator { + /* + NOTE: This class is auto generated by OpenAPI JSON Schema Generator. + Ref: https://github.com/openapi-json-schema-tools/openapi-json-schema-generator + + Do not edit the class manually. + */ + private static @Nullable StringEnum1 instance = null; + + protected StringEnum1() { + super(new JsonSchemaInfo() + .type(Set.of( + Nothing?.class, + String.class + )) + .enumValues(SetMaker.makeSet( + "placed", + "approved", + "delivered", + "single quoted", + "multiple\nlines", + "double quote \n with newline", + null + )) + ); + } + + public static StringEnum1 getInstance() { + if (instance == null) { + instance = new StringEnum1(); + } + return instance; + } + + @Override + public Nothing? validate(Nothing? arg, SchemaConfiguration configuration) throws ValidationException { + Set> pathSet = new HashSet<>(); + List pathToItem = List.of("args[0"); + Nothing? castArg = castToAllowedTypes(arg, pathToItem, pathSet); + SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().build())); + ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, new PathToSchemasMap(), new LinkedHashSet<>()); + getPathToSchemas(this, castArg, validationMetadata, pathSet); + return castArg; + } + + @Override + public String validate(String arg, SchemaConfiguration configuration) throws ValidationException { + Set> pathSet = new HashSet<>(); + List pathToItem = List.of("args[0"); + String castArg = castToAllowedTypes(arg, pathToItem, pathSet); + SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().build())); + ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, new PathToSchemasMap(), new LinkedHashSet<>()); + getPathToSchemas(this, castArg, validationMetadata, pathSet); + return castArg; + } + + @Override + public Nothing? validate(NullStringEnumEnums arg,SchemaConfiguration configuration) throws ValidationException { + return validate(arg.value(), configuration); + } + + @Override + 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 { + if (arg == null) { + return validate((Nothing?) 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"); + } + @Override + public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { + if (arg == null) { + return getNewInstance((Nothing?) 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"); + } + @Override + public StringEnum1BoxedVoid validateAndBox(Nothing? arg, SchemaConfiguration configuration) throws ValidationException { + return new StringEnum1BoxedVoid(validate(arg, configuration)); + } + @Override + 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 { + if (arg == null) { + Nothing? castArg = (Nothing?) 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"); + } + } +} diff --git a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/schemas/StringEnumWithDefaultValue.kt b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/schemas/StringEnumWithDefaultValue.kt new file mode 100644 index 00000000000..96e3eee226b --- /dev/null +++ b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/schemas/StringEnumWithDefaultValue.kt @@ -0,0 +1,130 @@ +package org.openapijsonschematools.client.components.schemas; +import java.util.HashSet; +import java.util.LinkedHashSet; +import java.util.List; +import java.util.Objects; +import java.util.Set; +import org.checkerframework.checker.nullness.qual.Nullable; +import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags; +import org.openapijsonschematools.client.configurations.SchemaConfiguration; +import org.openapijsonschematools.client.exceptions.ValidationException; +import org.openapijsonschematools.client.schemas.SetMaker; +import org.openapijsonschematools.client.schemas.validation.DefaultValueMethod; +import org.openapijsonschematools.client.schemas.validation.JsonSchema; +import org.openapijsonschematools.client.schemas.validation.JsonSchemaInfo; +import org.openapijsonschematools.client.schemas.validation.PathToSchemasMap; +import org.openapijsonschematools.client.schemas.validation.StringEnumValidator; +import org.openapijsonschematools.client.schemas.validation.StringSchemaValidator; +import org.openapijsonschematools.client.schemas.validation.StringValueMethod; +import org.openapijsonschematools.client.schemas.validation.ValidationMetadata; + +public class StringEnumWithDefaultValue { + // nest classes so all schemas and input/output classes can be public + + public enum StringStringEnumWithDefaultValueEnums implements StringValueMethod { + PLACED("placed"), + APPROVED("approved"), + DELIVERED("delivered"); + private final String value; + + StringStringEnumWithDefaultValueEnums(String value) { + this.value = value; + } + public String value() { + return this.value; + } + } + + + public sealed interface StringEnumWithDefaultValue1Boxed permits StringEnumWithDefaultValue1BoxedString { + @Nullable Object getData(); + } + + public record StringEnumWithDefaultValue1BoxedString(String data) implements StringEnumWithDefaultValue1Boxed { + @Override + public @Nullable Object getData() { + return data; + } + } + + + + public static class StringEnumWithDefaultValue1 extends JsonSchema implements StringSchemaValidator, StringEnumValidator, DefaultValueMethod { + /* + NOTE: This class is auto generated by OpenAPI JSON Schema Generator. + Ref: https://github.com/openapi-json-schema-tools/openapi-json-schema-generator + + Do not edit the class manually. + */ + private static @Nullable StringEnumWithDefaultValue1 instance = null; + + protected StringEnumWithDefaultValue1() { + super(new JsonSchemaInfo() + .type(Set.of( + String.class + )) + .enumValues(SetMaker.makeSet( + "placed", + "approved", + "delivered" + )) + .defaultValue("placed") + ); + } + + public static StringEnumWithDefaultValue1 getInstance() { + if (instance == null) { + instance = new StringEnumWithDefaultValue1(); + } + return instance; + } + + @Override + public String validate(String arg, SchemaConfiguration configuration) throws ValidationException { + Set> pathSet = new HashSet<>(); + List pathToItem = List.of("args[0"); + String castArg = castToAllowedTypes(arg, pathToItem, pathSet); + SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().build())); + ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, new PathToSchemasMap(), new LinkedHashSet<>()); + getPathToSchemas(this, castArg, validationMetadata, pathSet); + return castArg; + } + + @Override + 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 { + 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"); + } + @Override + public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { + 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"); + } + public String defaultValue() throws ValidationException { + if (defaultValue instanceof String) { + return (String) defaultValue; + } + throw new ValidationException("Invalid type stored in defaultValue"); + } + @Override + 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 { + 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"); + } + } +} diff --git a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/schemas/StringSchema.kt b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/schemas/StringSchema.kt new file mode 100644 index 00000000000..29f80f23a68 --- /dev/null +++ b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/schemas/StringSchema.kt @@ -0,0 +1,19 @@ +package org.openapijsonschematools.client.components.schemas; +import org.checkerframework.checker.nullness.qual.Nullable; +import org.openapijsonschematools.client.schemas.StringJsonSchema; + +public class StringSchema extends StringJsonSchema { + // nest classes so all schemas and input/output classes can be public + + + public static class StringSchema1 extends StringJsonSchema.StringJsonSchema1 { + private static @Nullable StringSchema1 instance = null; + public static StringSchema1 getInstance() { + if (instance == null) { + instance = new StringSchema1(); + } + return instance; + } + } + +} diff --git a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/schemas/StringWithValidation.kt b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/schemas/StringWithValidation.kt new file mode 100644 index 00000000000..9771f084f29 --- /dev/null +++ b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/schemas/StringWithValidation.kt @@ -0,0 +1,96 @@ +package org.openapijsonschematools.client.components.schemas; +import java.util.HashSet; +import java.util.LinkedHashSet; +import java.util.List; +import java.util.Objects; +import java.util.Set; +import org.checkerframework.checker.nullness.qual.Nullable; +import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags; +import org.openapijsonschematools.client.configurations.SchemaConfiguration; +import org.openapijsonschematools.client.exceptions.ValidationException; +import org.openapijsonschematools.client.schemas.validation.JsonSchema; +import org.openapijsonschematools.client.schemas.validation.JsonSchemaInfo; +import org.openapijsonschematools.client.schemas.validation.PathToSchemasMap; +import org.openapijsonschematools.client.schemas.validation.StringSchemaValidator; +import org.openapijsonschematools.client.schemas.validation.ValidationMetadata; + +public class StringWithValidation { + // nest classes so all schemas and input/output classes can be public + + + public sealed interface StringWithValidation1Boxed permits StringWithValidation1BoxedString { + @Nullable Object getData(); + } + + public record StringWithValidation1BoxedString(String data) implements StringWithValidation1Boxed { + @Override + public @Nullable Object getData() { + return data; + } + } + + + + public static class StringWithValidation1 extends JsonSchema implements StringSchemaValidator { + /* + NOTE: This class is auto generated by OpenAPI JSON Schema Generator. + Ref: https://github.com/openapi-json-schema-tools/openapi-json-schema-generator + + Do not edit the class manually. + */ + private static @Nullable StringWithValidation1 instance = null; + + protected StringWithValidation1() { + super(new JsonSchemaInfo() + .type(Set.of( + String.class + )) + .minLength(7) + ); + } + + public static StringWithValidation1 getInstance() { + if (instance == null) { + instance = new StringWithValidation1(); + } + return instance; + } + + @Override + public String validate(String arg, SchemaConfiguration configuration) throws ValidationException { + Set> pathSet = new HashSet<>(); + List pathToItem = List.of("args[0"); + String castArg = castToAllowedTypes(arg, pathToItem, pathSet); + SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().build())); + ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, new PathToSchemasMap(), new LinkedHashSet<>()); + getPathToSchemas(this, castArg, validationMetadata, pathSet); + return castArg; + } + + @Override + public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws 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"); + } + @Override + public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { + 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"); + } + @Override + 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 { + 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"); + } + } +} diff --git a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/schemas/Tag.kt b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/schemas/Tag.kt new file mode 100644 index 00000000000..e00dca0a596 --- /dev/null +++ b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/schemas/Tag.kt @@ -0,0 +1,263 @@ +package org.openapijsonschematools.client.components.schemas; +import java.util.ArrayList; +import java.util.HashSet; +import java.util.LinkedHashMap; +import java.util.LinkedHashSet; +import java.util.List; +import java.util.Map; +import java.util.Objects; +import java.util.Set; +import org.checkerframework.checker.nullness.qual.Nullable; +import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags; +import org.openapijsonschematools.client.configurations.SchemaConfiguration; +import org.openapijsonschematools.client.exceptions.InvalidAdditionalPropertyException; +import org.openapijsonschematools.client.exceptions.UnsetPropertyException; +import org.openapijsonschematools.client.exceptions.ValidationException; +import org.openapijsonschematools.client.schemas.GenericBuilder; +import org.openapijsonschematools.client.schemas.Int64JsonSchema; +import org.openapijsonschematools.client.schemas.StringJsonSchema; +import org.openapijsonschematools.client.schemas.UnsetAddPropsSetter; +import org.openapijsonschematools.client.schemas.validation.FrozenMap; +import org.openapijsonschematools.client.schemas.validation.JsonSchema; +import org.openapijsonschematools.client.schemas.validation.JsonSchemaInfo; +import org.openapijsonschematools.client.schemas.validation.MapSchemaValidator; +import org.openapijsonschematools.client.schemas.validation.PathToSchemasMap; +import org.openapijsonschematools.client.schemas.validation.PropertyEntry; +import org.openapijsonschematools.client.schemas.validation.ValidationMetadata; + +public class Tag { + // nest classes so all schemas and input/output classes can be public + + + public static class Id extends Int64JsonSchema.Int64JsonSchema1 { + private static @Nullable Id instance = null; + public static Id getInstance() { + if (instance == null) { + instance = new Id(); + } + return instance; + } + } + + + public static class Name extends StringJsonSchema.StringJsonSchema1 { + private static @Nullable Name instance = null; + public static Name getInstance() { + if (instance == null) { + instance = new Name(); + } + return instance; + } + } + + + public static class TagMap extends FrozenMap<@Nullable Object> { + protected TagMap(FrozenMap<@Nullable Object> m) { + super(m); + } + public static final Set requiredKeys = Set.of(); + public static final Set optionalKeys = Set.of( + "id", + "name" + ); + public static TagMap of(Map arg, SchemaConfiguration configuration) throws ValidationException { + return Tag1.getInstance().validate(arg, configuration); + } + + public Number id() throws UnsetPropertyException { + String key = "id"; + throwIfKeyNotPresent(key); + @Nullable Object value = get(key); + if (!(value instanceof Number)) { + throw new RuntimeException("Invalid value stored for id"); + } + return (Number) value; + } + + public String name() throws UnsetPropertyException { + String key = "name"; + throwIfKeyNotPresent(key); + @Nullable Object value = get(key); + if (!(value instanceof String)) { + throw new RuntimeException("Invalid value stored for name"); + } + return (String) value; + } + + public @Nullable Object getAdditionalProperty(String name) throws UnsetPropertyException, InvalidAdditionalPropertyException { + throwIfKeyKnown(name, requiredKeys, optionalKeys); + throwIfKeyNotPresent(name); + return get(name); + } + } + + public interface SetterForId { + Map getInstance(); + T getBuilderAfterId(Map instance); + + default T id(int value) { + var instance = getInstance(); + instance.put("id", value); + return getBuilderAfterId(instance); + } + + default T id(float value) { + var instance = getInstance(); + instance.put("id", value); + return getBuilderAfterId(instance); + } + + default T id(long value) { + var instance = getInstance(); + instance.put("id", value); + return getBuilderAfterId(instance); + } + + default T id(double value) { + var instance = getInstance(); + instance.put("id", value); + return getBuilderAfterId(instance); + } + } + + public interface SetterForName { + Map getInstance(); + T getBuilderAfterName(Map instance); + + default T name(String value) { + var instance = getInstance(); + instance.put("name", value); + return getBuilderAfterName(instance); + } + } + + public static class TagMapBuilder extends UnsetAddPropsSetter implements GenericBuilder>, SetterForId, SetterForName { + private final Map instance; + private static final Set knownKeys = Set.of( + "id", + "name" + ); + public Set getKnownKeys() { + return knownKeys; + } + public TagMapBuilder() { + this.instance = new LinkedHashMap<>(); + } + public Map build() { + return instance; + } + public Map getInstance() { + return instance; + } + public TagMapBuilder getBuilderAfterId(Map instance) { + return this; + } + public TagMapBuilder getBuilderAfterName(Map instance) { + return this; + } + public TagMapBuilder getBuilderAfterAdditionalProperty(Map instance) { + return this; + } + } + + + public sealed interface Tag1Boxed permits Tag1BoxedMap { + @Nullable Object getData(); + } + + public record Tag1BoxedMap(TagMap data) implements Tag1Boxed { + @Override + public @Nullable Object getData() { + return data; + } + } + + + public static class Tag1 extends JsonSchema implements MapSchemaValidator { + /* + NOTE: This class is auto generated by OpenAPI JSON Schema Generator. + Ref: https://github.com/openapi-json-schema-tools/openapi-json-schema-generator + + Do not edit the class manually. + */ + private static @Nullable Tag1 instance = null; + + protected Tag1() { + super(new JsonSchemaInfo() + .type(Set.of(Map.class)) + .properties(Map.ofEntries( + new PropertyEntry("id", Id.class), + new PropertyEntry("name", Name.class) + )) + ); + } + + public static Tag1 getInstance() { + if (instance == null) { + instance = new Tag1(); + } + return instance; + } + + 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 RuntimeException("Invalid non-string key value"); + } + String propertyName = (String) entryKey; + List propertyPathToItem = new ArrayList<>(pathToItem); + propertyPathToItem.add(propertyName); + Object value = entry.getValue(); + LinkedHashMap, Nothing?> schemas = pathToSchemas.get(propertyPathToItem); + if (schemas == null) { + throw new RuntimeException("Validation result is invalid, schemas must exist for a pathToItem"); + } + JsonSchema propertySchema = schemas.entrySet().iterator().next().getKey(); + @Nullable Object propertyInstance = propertySchema.getNewInstance(value, propertyPathToItem, pathToSchemas); + properties.put(propertyName, propertyInstance); + } + FrozenMap<@Nullable Object> castProperties = new FrozenMap<>(properties); + return new TagMap(castProperties); + } + + 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); + SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().build())); + ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, new PathToSchemasMap(), new LinkedHashSet<>()); + PathToSchemasMap pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet); + return getNewInstance(castArg, validationMetadata.pathToItem(), pathToSchemasMap); + } + + + @Override + public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws 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"); + } + @Override + public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { + if (arg instanceof Map) { + return getNewInstance((Map) arg, pathToItem, pathToSchemas); + } + 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 { + return new Tag1BoxedMap(validate(arg, configuration)); + } + @Override + public Tag1Boxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { + 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"); + } + } + +} diff --git a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/schemas/Triangle.kt b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/schemas/Triangle.kt new file mode 100644 index 00000000000..3cdcd687786 --- /dev/null +++ b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/schemas/Triangle.kt @@ -0,0 +1,331 @@ +package org.openapijsonschematools.client.components.schemas; +import java.time.LocalDate; +import java.time.ZonedDateTime; +import java.util.ArrayList; +import java.util.HashSet; +import java.util.LinkedHashMap; +import java.util.LinkedHashSet; +import java.util.List; +import java.util.Map; +import java.util.Objects; +import java.util.Set; +import java.util.UUID; +import org.checkerframework.checker.nullness.qual.Nullable; +import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags; +import org.openapijsonschematools.client.configurations.SchemaConfiguration; +import org.openapijsonschematools.client.exceptions.InvalidAdditionalPropertyException; +import org.openapijsonschematools.client.exceptions.UnsetPropertyException; +import org.openapijsonschematools.client.exceptions.ValidationException; +import org.openapijsonschematools.client.schemas.UnsetAddPropsSetter; +import org.openapijsonschematools.client.schemas.validation.BooleanSchemaValidator; +import org.openapijsonschematools.client.schemas.validation.FrozenList; +import org.openapijsonschematools.client.schemas.validation.FrozenMap; +import org.openapijsonschematools.client.schemas.validation.JsonSchema; +import org.openapijsonschematools.client.schemas.validation.JsonSchemaInfo; +import org.openapijsonschematools.client.schemas.validation.ListSchemaValidator; +import org.openapijsonschematools.client.schemas.validation.MapSchemaValidator; +import org.openapijsonschematools.client.schemas.validation.NullSchemaValidator; +import org.openapijsonschematools.client.schemas.validation.NumberSchemaValidator; +import org.openapijsonschematools.client.schemas.validation.PathToSchemasMap; +import org.openapijsonschematools.client.schemas.validation.StringSchemaValidator; +import org.openapijsonschematools.client.schemas.validation.ValidationMetadata; + +public class Triangle { + // nest classes so all schemas and input/output classes can be public + + + public sealed interface Triangle1Boxed permits Triangle1BoxedVoid, Triangle1BoxedBoolean, Triangle1BoxedNumber, Triangle1BoxedString, Triangle1BoxedList, Triangle1BoxedMap { + @Nullable Object getData(); + } + + public record Triangle1BoxedVoid(Nothing? data) implements Triangle1Boxed { + @Override + public @Nullable Object getData() { + return data; + } + } + + public record Triangle1BoxedBoolean(boolean data) implements Triangle1Boxed { + @Override + public @Nullable Object getData() { + return data; + } + } + + public record Triangle1BoxedNumber(Number data) implements Triangle1Boxed { + @Override + public @Nullable Object getData() { + return data; + } + } + + public record Triangle1BoxedString(String data) implements Triangle1Boxed { + @Override + public @Nullable Object getData() { + return data; + } + } + + public record Triangle1BoxedList(FrozenList<@Nullable Object> data) implements Triangle1Boxed { + @Override + public @Nullable Object getData() { + return data; + } + } + + public record Triangle1BoxedMap(FrozenMap<@Nullable Object> data) implements Triangle1Boxed { + @Override + public @Nullable Object getData() { + return data; + } + } + + + public static class Triangle1 extends JsonSchema implements NullSchemaValidator, BooleanSchemaValidator, NumberSchemaValidator, StringSchemaValidator, ListSchemaValidator, Triangle1BoxedList>, MapSchemaValidator, Triangle1BoxedMap> { + /* + NOTE: This class is auto generated by OpenAPI JSON Schema Generator. + Ref: https://github.com/openapi-json-schema-tools/openapi-json-schema-generator + + Do not edit the class manually. + */ + private static @Nullable Triangle1 instance = null; + + protected Triangle1() { + super(new JsonSchemaInfo() + .oneOf(List.of( + EquilateralTriangle.EquilateralTriangle1.class, + IsoscelesTriangle.IsoscelesTriangle1.class, + ScaleneTriangle.ScaleneTriangle1.class + )) + ); + } + + public static Triangle1 getInstance() { + if (instance == null) { + instance = new Triangle1(); + } + return instance; + } + + @Override + public Nothing? validate(Nothing? arg, SchemaConfiguration configuration) throws ValidationException { + Set> pathSet = new HashSet<>(); + List pathToItem = List.of("args[0]"); + Nothing? castArg = castToAllowedTypes(arg, pathToItem, pathSet); + SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().build())); + PathToSchemasMap validatedPathToSchemas = new PathToSchemasMap(); + ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, new LinkedHashSet<>()); + getPathToSchemas(this, castArg, validationMetadata, pathSet); + return castArg; + } + + @Override + public boolean validate(boolean arg, SchemaConfiguration configuration) throws ValidationException { + Set> pathSet = new HashSet<>(); + List pathToItem = List.of("args[0]"); + boolean castArg = castToAllowedTypes(arg, pathToItem, pathSet); + SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().build())); + PathToSchemasMap validatedPathToSchemas = new PathToSchemasMap(); + ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, new LinkedHashSet<>()); + getPathToSchemas(this, castArg, validationMetadata, pathSet); + return castArg; + } + + @Override + public Number validate(Number arg, SchemaConfiguration configuration) throws ValidationException { + Set> pathSet = new HashSet<>(); + List pathToItem = List.of("args[0]"); + Number castArg = castToAllowedTypes(arg, pathToItem, pathSet); + SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().build())); + PathToSchemasMap validatedPathToSchemas = new PathToSchemasMap(); + ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, new LinkedHashSet<>()); + getPathToSchemas(this, castArg, validationMetadata, pathSet); + return castArg; + } + + public int validate(int arg, SchemaConfiguration configuration) throws ValidationException { + return (int) validate((Number) arg, configuration); + } + + public long validate(long arg, SchemaConfiguration configuration) throws ValidationException { + return (long) validate((Number) arg, configuration); + } + + public float validate(float arg, SchemaConfiguration configuration) throws ValidationException { + return (float) validate((Number) arg, configuration); + } + + public double validate(double arg, SchemaConfiguration configuration) throws ValidationException { + return (double) validate((Number) arg, configuration); + } + + @Override + public String validate(String arg, SchemaConfiguration configuration) throws ValidationException { + Set> pathSet = new HashSet<>(); + List pathToItem = List.of("args[0]"); + String castArg = castToAllowedTypes(arg, pathToItem, pathSet); + SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().build())); + PathToSchemasMap validatedPathToSchemas = new PathToSchemasMap(); + ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, new LinkedHashSet<>()); + getPathToSchemas(this, castArg, validationMetadata, pathSet); + return castArg; + } + + public String validate(LocalDate arg, SchemaConfiguration configuration) throws ValidationException { + return validate(arg.toString(), configuration); + } + + public String validate(ZonedDateTime arg, SchemaConfiguration configuration) throws ValidationException { + return validate(arg.toString(), configuration); + } + + public String validate(UUID arg, SchemaConfiguration configuration) throws ValidationException { + return validate(arg.toString(), configuration); + } + + @Override + public FrozenList<@Nullable Object> getNewInstance(List arg, List pathToItem, PathToSchemasMap pathToSchemas) { + List<@Nullable Object> items = new ArrayList<>(); + int i = 0; + for (Object item: arg) { + List itemPathToItem = new ArrayList<>(pathToItem); + itemPathToItem.add(i); + LinkedHashMap, Nothing?> schemas = pathToSchemas.get(itemPathToItem); + if (schemas == null) { + throw new RuntimeException("Validation result is invalid, schemas must exist for a pathToItem"); + } + JsonSchema itemSchema = schemas.entrySet().iterator().next().getKey(); + @Nullable Object itemInstance = itemSchema.getNewInstance(item, itemPathToItem, pathToSchemas); + items.add(itemInstance); + i += 1; + } + FrozenList<@Nullable Object> newInstanceItems = new FrozenList<>(items); + return newInstanceItems; + } + + 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); + SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().build())); + ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, new PathToSchemasMap(), new LinkedHashSet<>()); + PathToSchemasMap pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet); + return getNewInstance(castArg, validationMetadata.pathToItem(), pathToSchemasMap); + } + + @Override + 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 RuntimeException("Invalid non-string key value"); + } + String propertyName = (String) entryKey; + List propertyPathToItem = new ArrayList<>(pathToItem); + propertyPathToItem.add(propertyName); + Object value = entry.getValue(); + LinkedHashMap, Nothing?> schemas = pathToSchemas.get(propertyPathToItem); + if (schemas == null) { + throw new RuntimeException("Validation result is invalid, schemas must exist for a pathToItem"); + } + JsonSchema propertySchema = schemas.entrySet().iterator().next().getKey(); + @Nullable Object propertyInstance = propertySchema.getNewInstance(value, propertyPathToItem, pathToSchemas); + properties.put(propertyName, propertyInstance); + } + FrozenMap<@Nullable Object> castProperties = new FrozenMap<>(properties); + return castProperties; + } + + public FrozenMap<@Nullable Object> validate(Map arg, SchemaConfiguration configuration) throws ValidationException { + Set> pathSet = new HashSet<>(); + List pathToItem = List.of("args[0]"); + Map castArg = castToAllowedTypes(arg, pathToItem, pathSet); + SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().build())); + PathToSchemasMap validatedPathToSchemas = new PathToSchemasMap(); + ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, new LinkedHashSet<>()); + PathToSchemasMap pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet); + return getNewInstance(castArg, validationMetadata.pathToItem(), pathToSchemasMap); + } + + @Override + public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { + if (arg == null) { + return validate((Nothing?) null, configuration); + } else if (arg instanceof Boolean) { + boolean boolArg = (Boolean) arg; + return validate(boolArg, configuration); + } else if (arg instanceof Number) { + return validate((Number) arg, configuration); + } else if (arg instanceof String) { + return validate((String) arg, configuration); + } else if (arg instanceof List) { + return validate((List) arg, 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"); + } + @Override + public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { + if (arg == null) { + return getNewInstance((Nothing?) null, pathToItem, pathToSchemas); + } else if (arg instanceof Boolean) { + boolean boolArg = (Boolean) arg; + return getNewInstance(boolArg, pathToItem, pathToSchemas); + } else if (arg instanceof Number) { + return getNewInstance((Number) arg, pathToItem, pathToSchemas); + } else if (arg instanceof String) { + return getNewInstance((String) arg, pathToItem, pathToSchemas); + } else if (arg instanceof List) { + return getNewInstance((List) arg, 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"); + } + @Override + public Triangle1BoxedVoid validateAndBox(Nothing? arg, SchemaConfiguration configuration) throws ValidationException { + return new Triangle1BoxedVoid(validate(arg, configuration)); + } + @Override + 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 { + return new Triangle1BoxedNumber(validate(arg, configuration)); + } + @Override + 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 { + return new Triangle1BoxedList(validate(arg, configuration)); + } + @Override + 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 { + if (arg == null) { + Nothing? castArg = (Nothing?) arg; + return validateAndBox(castArg, configuration); + } else if (arg instanceof Boolean booleanArg) { + boolean castArg = booleanArg; + return validateAndBox(castArg, configuration); + } else if (arg instanceof String castArg) { + return validateAndBox(castArg, configuration); + } else if (arg instanceof Number castArg) { + return validateAndBox(castArg, configuration); + } else if (arg instanceof List castArg) { + 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"); + } + } +} diff --git a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/schemas/TriangleInterface.kt b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/schemas/TriangleInterface.kt new file mode 100644 index 00000000000..e495953694a --- /dev/null +++ b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/schemas/TriangleInterface.kt @@ -0,0 +1,570 @@ +package org.openapijsonschematools.client.components.schemas; +import java.time.LocalDate; +import java.time.ZonedDateTime; +import java.util.ArrayList; +import java.util.HashSet; +import java.util.LinkedHashMap; +import java.util.LinkedHashSet; +import java.util.List; +import java.util.Map; +import java.util.Objects; +import java.util.Set; +import java.util.UUID; +import org.checkerframework.checker.nullness.qual.Nullable; +import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags; +import org.openapijsonschematools.client.configurations.SchemaConfiguration; +import org.openapijsonschematools.client.exceptions.InvalidAdditionalPropertyException; +import org.openapijsonschematools.client.exceptions.UnsetPropertyException; +import org.openapijsonschematools.client.exceptions.ValidationException; +import org.openapijsonschematools.client.schemas.GenericBuilder; +import org.openapijsonschematools.client.schemas.SetMaker; +import org.openapijsonschematools.client.schemas.StringJsonSchema; +import org.openapijsonschematools.client.schemas.UnsetAddPropsSetter; +import org.openapijsonschematools.client.schemas.validation.BooleanSchemaValidator; +import org.openapijsonschematools.client.schemas.validation.FrozenList; +import org.openapijsonschematools.client.schemas.validation.FrozenMap; +import org.openapijsonschematools.client.schemas.validation.JsonSchema; +import org.openapijsonschematools.client.schemas.validation.JsonSchemaInfo; +import org.openapijsonschematools.client.schemas.validation.ListSchemaValidator; +import org.openapijsonschematools.client.schemas.validation.MapSchemaValidator; +import org.openapijsonschematools.client.schemas.validation.NullSchemaValidator; +import org.openapijsonschematools.client.schemas.validation.NumberSchemaValidator; +import org.openapijsonschematools.client.schemas.validation.PathToSchemasMap; +import org.openapijsonschematools.client.schemas.validation.PropertyEntry; +import org.openapijsonschematools.client.schemas.validation.StringEnumValidator; +import org.openapijsonschematools.client.schemas.validation.StringSchemaValidator; +import org.openapijsonschematools.client.schemas.validation.StringValueMethod; +import org.openapijsonschematools.client.schemas.validation.ValidationMetadata; + +public class TriangleInterface { + // nest classes so all schemas and input/output classes can be public + + public enum StringShapeTypeEnums implements StringValueMethod { + TRIANGLE("Triangle"); + private final String value; + + StringShapeTypeEnums(String value) { + this.value = value; + } + public String value() { + return this.value; + } + } + + + public sealed interface ShapeTypeBoxed permits ShapeTypeBoxedString { + @Nullable Object getData(); + } + + public record ShapeTypeBoxedString(String data) implements ShapeTypeBoxed { + @Override + public @Nullable Object getData() { + return data; + } + } + + + + public static class ShapeType extends JsonSchema implements StringSchemaValidator, StringEnumValidator { + private static @Nullable ShapeType instance = null; + + protected ShapeType() { + super(new JsonSchemaInfo() + .type(Set.of( + String.class + )) + .enumValues(SetMaker.makeSet( + "Triangle" + )) + ); + } + + public static ShapeType getInstance() { + if (instance == null) { + instance = new ShapeType(); + } + return instance; + } + + @Override + public String validate(String arg, SchemaConfiguration configuration) throws ValidationException { + Set> pathSet = new HashSet<>(); + List pathToItem = List.of("args[0"); + String castArg = castToAllowedTypes(arg, pathToItem, pathSet); + SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().build())); + ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, new PathToSchemasMap(), new LinkedHashSet<>()); + getPathToSchemas(this, castArg, validationMetadata, pathSet); + return castArg; + } + + @Override + 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 { + 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"); + } + @Override + public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { + 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"); + } + @Override + 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 { + 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"); + } + } + + public static class TriangleType extends StringJsonSchema.StringJsonSchema1 { + private static @Nullable TriangleType instance = null; + public static TriangleType getInstance() { + if (instance == null) { + instance = new TriangleType(); + } + return instance; + } + } + + + public static class TriangleInterfaceMap extends FrozenMap<@Nullable Object> { + protected TriangleInterfaceMap(FrozenMap<@Nullable Object> m) { + super(m); + } + public static final Set requiredKeys = Set.of( + "shapeType", + "triangleType" + ); + public static final Set optionalKeys = Set.of(); + public static TriangleInterfaceMap of(Map arg, SchemaConfiguration configuration) throws ValidationException { + return TriangleInterface1.getInstance().validate(arg, configuration); + } + + public String shapeType() { + @Nullable Object value = get("shapeType"); + if (!(value instanceof String)) { + throw new RuntimeException("Invalid value stored for shapeType"); + } + return (String) value; + } + + public String triangleType() { + @Nullable Object value = get("triangleType"); + if (!(value instanceof String)) { + throw new RuntimeException("Invalid value stored for triangleType"); + } + return (String) value; + } + + public @Nullable Object getAdditionalProperty(String name) throws UnsetPropertyException, InvalidAdditionalPropertyException { + throwIfKeyKnown(name, requiredKeys, optionalKeys); + throwIfKeyNotPresent(name); + return get(name); + } + } + + public interface SetterForShapeType { + Map getInstance(); + T getBuilderAfterShapeType(Map instance); + + default T shapeType(String value) { + var instance = getInstance(); + instance.put("shapeType", value); + return getBuilderAfterShapeType(instance); + } + + default T shapeType(StringShapeTypeEnums value) { + var instance = getInstance(); + instance.put("shapeType", value.value()); + return getBuilderAfterShapeType(instance); + } + } + + public interface SetterForTriangleType { + Map getInstance(); + T getBuilderAfterTriangleType(Map instance); + + default T triangleType(String value) { + var instance = getInstance(); + instance.put("triangleType", value); + return getBuilderAfterTriangleType(instance); + } + } + + public static class TriangleInterfaceMap00Builder extends UnsetAddPropsSetter implements GenericBuilder> { + private final Map instance; + private static final Set knownKeys = Set.of( + "shapeType", + "triangleType" + ); + public Set getKnownKeys() { + return knownKeys; + } + public TriangleInterfaceMap00Builder(Map instance) { + this.instance = instance; + } + public Map build() { + return instance; + } + public Map getInstance() { + return instance; + } + public TriangleInterfaceMap00Builder getBuilderAfterAdditionalProperty(Map instance) { + return this; + } + } + + public static class TriangleInterfaceMap01Builder implements SetterForTriangleType { + private final Map instance; + public TriangleInterfaceMap01Builder(Map instance) { + this.instance = instance; + } + public Map getInstance() { + return instance; + } + public TriangleInterfaceMap00Builder getBuilderAfterTriangleType(Map instance) { + return new TriangleInterfaceMap00Builder(instance); + } + } + + public static class TriangleInterfaceMap10Builder implements SetterForShapeType { + private final Map instance; + public TriangleInterfaceMap10Builder(Map instance) { + this.instance = instance; + } + public Map getInstance() { + return instance; + } + public TriangleInterfaceMap00Builder getBuilderAfterShapeType(Map instance) { + return new TriangleInterfaceMap00Builder(instance); + } + } + + public static class TriangleInterfaceMapBuilder implements SetterForShapeType, SetterForTriangleType { + private final Map instance; + public TriangleInterfaceMapBuilder() { + this.instance = new LinkedHashMap<>(); + } + public Map getInstance() { + return instance; + } + public TriangleInterfaceMap01Builder getBuilderAfterShapeType(Map instance) { + return new TriangleInterfaceMap01Builder(instance); + } + public TriangleInterfaceMap10Builder getBuilderAfterTriangleType(Map instance) { + return new TriangleInterfaceMap10Builder(instance); + } + } + + + public sealed interface TriangleInterface1Boxed permits TriangleInterface1BoxedVoid, TriangleInterface1BoxedBoolean, TriangleInterface1BoxedNumber, TriangleInterface1BoxedString, TriangleInterface1BoxedList, TriangleInterface1BoxedMap { + @Nullable Object getData(); + } + + public record TriangleInterface1BoxedVoid(Nothing? data) implements TriangleInterface1Boxed { + @Override + public @Nullable Object getData() { + return data; + } + } + + public record TriangleInterface1BoxedBoolean(boolean data) implements TriangleInterface1Boxed { + @Override + public @Nullable Object getData() { + return data; + } + } + + public record TriangleInterface1BoxedNumber(Number data) implements TriangleInterface1Boxed { + @Override + public @Nullable Object getData() { + return data; + } + } + + public record TriangleInterface1BoxedString(String data) implements TriangleInterface1Boxed { + @Override + public @Nullable Object getData() { + return data; + } + } + + public record TriangleInterface1BoxedList(FrozenList<@Nullable Object> data) implements TriangleInterface1Boxed { + @Override + public @Nullable Object getData() { + return data; + } + } + + public record TriangleInterface1BoxedMap(TriangleInterfaceMap data) implements TriangleInterface1Boxed { + @Override + public @Nullable Object getData() { + return data; + } + } + + + public static class TriangleInterface1 extends JsonSchema implements NullSchemaValidator, BooleanSchemaValidator, NumberSchemaValidator, StringSchemaValidator, ListSchemaValidator, TriangleInterface1BoxedList>, MapSchemaValidator { + /* + NOTE: This class is auto generated by OpenAPI JSON Schema Generator. + Ref: https://github.com/openapi-json-schema-tools/openapi-json-schema-generator + + Do not edit the class manually. + */ + private static @Nullable TriangleInterface1 instance = null; + + protected TriangleInterface1() { + super(new JsonSchemaInfo() + .properties(Map.ofEntries( + new PropertyEntry("shapeType", ShapeType.class), + new PropertyEntry("triangleType", TriangleType.class) + )) + .required(Set.of( + "shapeType", + "triangleType" + )) + ); + } + + public static TriangleInterface1 getInstance() { + if (instance == null) { + instance = new TriangleInterface1(); + } + return instance; + } + + @Override + public Nothing? validate(Nothing? arg, SchemaConfiguration configuration) throws ValidationException { + Set> pathSet = new HashSet<>(); + List pathToItem = List.of("args[0]"); + Nothing? castArg = castToAllowedTypes(arg, pathToItem, pathSet); + SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().build())); + PathToSchemasMap validatedPathToSchemas = new PathToSchemasMap(); + ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, new LinkedHashSet<>()); + getPathToSchemas(this, castArg, validationMetadata, pathSet); + return castArg; + } + + @Override + public boolean validate(boolean arg, SchemaConfiguration configuration) throws ValidationException { + Set> pathSet = new HashSet<>(); + List pathToItem = List.of("args[0]"); + boolean castArg = castToAllowedTypes(arg, pathToItem, pathSet); + SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().build())); + PathToSchemasMap validatedPathToSchemas = new PathToSchemasMap(); + ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, new LinkedHashSet<>()); + getPathToSchemas(this, castArg, validationMetadata, pathSet); + return castArg; + } + + @Override + public Number validate(Number arg, SchemaConfiguration configuration) throws ValidationException { + Set> pathSet = new HashSet<>(); + List pathToItem = List.of("args[0]"); + Number castArg = castToAllowedTypes(arg, pathToItem, pathSet); + SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().build())); + PathToSchemasMap validatedPathToSchemas = new PathToSchemasMap(); + ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, new LinkedHashSet<>()); + getPathToSchemas(this, castArg, validationMetadata, pathSet); + return castArg; + } + + public int validate(int arg, SchemaConfiguration configuration) throws ValidationException { + return (int) validate((Number) arg, configuration); + } + + public long validate(long arg, SchemaConfiguration configuration) throws ValidationException { + return (long) validate((Number) arg, configuration); + } + + public float validate(float arg, SchemaConfiguration configuration) throws ValidationException { + return (float) validate((Number) arg, configuration); + } + + public double validate(double arg, SchemaConfiguration configuration) throws ValidationException { + return (double) validate((Number) arg, configuration); + } + + @Override + public String validate(String arg, SchemaConfiguration configuration) throws ValidationException { + Set> pathSet = new HashSet<>(); + List pathToItem = List.of("args[0]"); + String castArg = castToAllowedTypes(arg, pathToItem, pathSet); + SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().build())); + PathToSchemasMap validatedPathToSchemas = new PathToSchemasMap(); + ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, new LinkedHashSet<>()); + getPathToSchemas(this, castArg, validationMetadata, pathSet); + return castArg; + } + + public String validate(LocalDate arg, SchemaConfiguration configuration) throws ValidationException { + return validate(arg.toString(), configuration); + } + + public String validate(ZonedDateTime arg, SchemaConfiguration configuration) throws ValidationException { + return validate(arg.toString(), configuration); + } + + public String validate(UUID arg, SchemaConfiguration configuration) throws ValidationException { + return validate(arg.toString(), configuration); + } + + @Override + public FrozenList<@Nullable Object> getNewInstance(List arg, List pathToItem, PathToSchemasMap pathToSchemas) { + List<@Nullable Object> items = new ArrayList<>(); + int i = 0; + for (Object item: arg) { + List itemPathToItem = new ArrayList<>(pathToItem); + itemPathToItem.add(i); + LinkedHashMap, Nothing?> schemas = pathToSchemas.get(itemPathToItem); + if (schemas == null) { + throw new RuntimeException("Validation result is invalid, schemas must exist for a pathToItem"); + } + JsonSchema itemSchema = schemas.entrySet().iterator().next().getKey(); + @Nullable Object itemInstance = itemSchema.getNewInstance(item, itemPathToItem, pathToSchemas); + items.add(itemInstance); + i += 1; + } + FrozenList<@Nullable Object> newInstanceItems = new FrozenList<>(items); + return newInstanceItems; + } + + 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); + SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().build())); + ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, new PathToSchemasMap(), new LinkedHashSet<>()); + PathToSchemasMap pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet); + return getNewInstance(castArg, validationMetadata.pathToItem(), pathToSchemasMap); + } + + @Override + 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 RuntimeException("Invalid non-string key value"); + } + String propertyName = (String) entryKey; + List propertyPathToItem = new ArrayList<>(pathToItem); + propertyPathToItem.add(propertyName); + Object value = entry.getValue(); + LinkedHashMap, Nothing?> schemas = pathToSchemas.get(propertyPathToItem); + if (schemas == null) { + throw new RuntimeException("Validation result is invalid, schemas must exist for a pathToItem"); + } + JsonSchema propertySchema = schemas.entrySet().iterator().next().getKey(); + @Nullable Object propertyInstance = propertySchema.getNewInstance(value, propertyPathToItem, pathToSchemas); + properties.put(propertyName, propertyInstance); + } + FrozenMap<@Nullable Object> castProperties = new FrozenMap<>(properties); + return new TriangleInterfaceMap(castProperties); + } + + 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); + SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().build())); + PathToSchemasMap validatedPathToSchemas = new PathToSchemasMap(); + ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, new LinkedHashSet<>()); + PathToSchemasMap pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet); + return getNewInstance(castArg, validationMetadata.pathToItem(), pathToSchemasMap); + } + + @Override + public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { + if (arg == null) { + return validate((Nothing?) null, configuration); + } else if (arg instanceof Boolean) { + boolean boolArg = (Boolean) arg; + return validate(boolArg, configuration); + } else if (arg instanceof Number) { + return validate((Number) arg, configuration); + } else if (arg instanceof String) { + return validate((String) arg, configuration); + } else if (arg instanceof List) { + return validate((List) arg, 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"); + } + @Override + public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { + if (arg == null) { + return getNewInstance((Nothing?) null, pathToItem, pathToSchemas); + } else if (arg instanceof Boolean) { + boolean boolArg = (Boolean) arg; + return getNewInstance(boolArg, pathToItem, pathToSchemas); + } else if (arg instanceof Number) { + return getNewInstance((Number) arg, pathToItem, pathToSchemas); + } else if (arg instanceof String) { + return getNewInstance((String) arg, pathToItem, pathToSchemas); + } else if (arg instanceof List) { + return getNewInstance((List) arg, 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"); + } + @Override + public TriangleInterface1BoxedVoid validateAndBox(Nothing? arg, SchemaConfiguration configuration) throws ValidationException { + return new TriangleInterface1BoxedVoid(validate(arg, configuration)); + } + @Override + 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 { + return new TriangleInterface1BoxedNumber(validate(arg, configuration)); + } + @Override + 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 { + return new TriangleInterface1BoxedList(validate(arg, configuration)); + } + @Override + 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 { + if (arg == null) { + Nothing? castArg = (Nothing?) arg; + return validateAndBox(castArg, configuration); + } else if (arg instanceof Boolean booleanArg) { + boolean castArg = booleanArg; + return validateAndBox(castArg, configuration); + } else if (arg instanceof String castArg) { + return validateAndBox(castArg, configuration); + } else if (arg instanceof Number castArg) { + return validateAndBox(castArg, configuration); + } else if (arg instanceof List castArg) { + 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"); + } + } +} diff --git a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/schemas/UUIDString.kt b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/schemas/UUIDString.kt new file mode 100644 index 00000000000..d3cb5ec4d9b --- /dev/null +++ b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/schemas/UUIDString.kt @@ -0,0 +1,98 @@ +package org.openapijsonschematools.client.components.schemas; +import java.util.HashSet; +import java.util.LinkedHashSet; +import java.util.List; +import java.util.Objects; +import java.util.Set; +import java.util.UUID; +import org.checkerframework.checker.nullness.qual.Nullable; +import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags; +import org.openapijsonschematools.client.configurations.SchemaConfiguration; +import org.openapijsonschematools.client.exceptions.ValidationException; +import org.openapijsonschematools.client.schemas.validation.JsonSchema; +import org.openapijsonschematools.client.schemas.validation.JsonSchemaInfo; +import org.openapijsonschematools.client.schemas.validation.PathToSchemasMap; +import org.openapijsonschematools.client.schemas.validation.StringSchemaValidator; +import org.openapijsonschematools.client.schemas.validation.ValidationMetadata; + +public class UUIDString { + // nest classes so all schemas and input/output classes can be public + + + public sealed interface UUIDString1Boxed permits UUIDString1BoxedString { + @Nullable Object getData(); + } + + public record UUIDString1BoxedString(String data) implements UUIDString1Boxed { + @Override + public @Nullable Object getData() { + return data; + } + } + + + + public static class UUIDString1 extends JsonSchema implements StringSchemaValidator { + /* + NOTE: This class is auto generated by OpenAPI JSON Schema Generator. + Ref: https://github.com/openapi-json-schema-tools/openapi-json-schema-generator + + Do not edit the class manually. + */ + private static @Nullable UUIDString1 instance = null; + + protected UUIDString1() { + super(new JsonSchemaInfo() + .type(Set.of( + String.class + )) + .format("uuid") + .minLength(1) + ); + } + + public static UUIDString1 getInstance() { + if (instance == null) { + instance = new UUIDString1(); + } + return instance; + } + + @Override + public String validate(String arg, SchemaConfiguration configuration) throws ValidationException { + Set> pathSet = new HashSet<>(); + List pathToItem = List.of("args[0"); + String castArg = castToAllowedTypes(arg, pathToItem, pathSet); + SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().build())); + ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, new PathToSchemasMap(), new LinkedHashSet<>()); + getPathToSchemas(this, castArg, validationMetadata, pathSet); + return castArg; + } + + @Override + public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws 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"); + } + @Override + public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { + 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"); + } + @Override + 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 { + 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"); + } + } +} diff --git a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/schemas/User.kt b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/schemas/User.kt new file mode 100644 index 00000000000..d64db7e4fc0 --- /dev/null +++ b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/schemas/User.kt @@ -0,0 +1,1227 @@ +package org.openapijsonschematools.client.components.schemas; +import java.time.LocalDate; +import java.time.ZonedDateTime; +import java.util.ArrayList; +import java.util.HashSet; +import java.util.LinkedHashMap; +import java.util.LinkedHashSet; +import java.util.List; +import java.util.Map; +import java.util.Objects; +import java.util.Set; +import java.util.UUID; +import org.checkerframework.checker.nullness.qual.Nullable; +import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags; +import org.openapijsonschematools.client.configurations.SchemaConfiguration; +import org.openapijsonschematools.client.exceptions.InvalidAdditionalPropertyException; +import org.openapijsonschematools.client.exceptions.UnsetPropertyException; +import org.openapijsonschematools.client.exceptions.ValidationException; +import org.openapijsonschematools.client.schemas.AnyTypeJsonSchema; +import org.openapijsonschematools.client.schemas.GenericBuilder; +import org.openapijsonschematools.client.schemas.Int32JsonSchema; +import org.openapijsonschematools.client.schemas.Int64JsonSchema; +import org.openapijsonschematools.client.schemas.MapJsonSchema; +import org.openapijsonschematools.client.schemas.NullJsonSchema; +import org.openapijsonschematools.client.schemas.StringJsonSchema; +import org.openapijsonschematools.client.schemas.UnsetAddPropsSetter; +import org.openapijsonschematools.client.schemas.validation.BooleanSchemaValidator; +import org.openapijsonschematools.client.schemas.validation.FrozenList; +import org.openapijsonschematools.client.schemas.validation.FrozenMap; +import org.openapijsonschematools.client.schemas.validation.JsonSchema; +import org.openapijsonschematools.client.schemas.validation.JsonSchemaInfo; +import org.openapijsonschematools.client.schemas.validation.ListSchemaValidator; +import org.openapijsonschematools.client.schemas.validation.MapSchemaValidator; +import org.openapijsonschematools.client.schemas.validation.NullSchemaValidator; +import org.openapijsonschematools.client.schemas.validation.NumberSchemaValidator; +import org.openapijsonschematools.client.schemas.validation.PathToSchemasMap; +import org.openapijsonschematools.client.schemas.validation.PropertyEntry; +import org.openapijsonschematools.client.schemas.validation.StringSchemaValidator; +import org.openapijsonschematools.client.schemas.validation.ValidationMetadata; + +public class User { + // nest classes so all schemas and input/output classes can be public + + + public static class Id extends Int64JsonSchema.Int64JsonSchema1 { + private static @Nullable Id instance = null; + public static Id getInstance() { + if (instance == null) { + instance = new Id(); + } + return instance; + } + } + + + public static class Username extends StringJsonSchema.StringJsonSchema1 { + private static @Nullable Username instance = null; + public static Username getInstance() { + if (instance == null) { + instance = new Username(); + } + return instance; + } + } + + + public static class FirstName extends StringJsonSchema.StringJsonSchema1 { + private static @Nullable FirstName instance = null; + public static FirstName getInstance() { + if (instance == null) { + instance = new FirstName(); + } + return instance; + } + } + + + public static class LastName extends StringJsonSchema.StringJsonSchema1 { + private static @Nullable LastName instance = null; + public static LastName getInstance() { + if (instance == null) { + instance = new LastName(); + } + return instance; + } + } + + + public static class Email extends StringJsonSchema.StringJsonSchema1 { + private static @Nullable Email instance = null; + public static Email getInstance() { + if (instance == null) { + instance = new Email(); + } + return instance; + } + } + + + public static class Password extends StringJsonSchema.StringJsonSchema1 { + private static @Nullable Password instance = null; + public static Password getInstance() { + if (instance == null) { + instance = new Password(); + } + return instance; + } + } + + + public static class Phone extends StringJsonSchema.StringJsonSchema1 { + private static @Nullable Phone instance = null; + public static Phone getInstance() { + if (instance == null) { + instance = new Phone(); + } + return instance; + } + } + + + public static class UserStatus extends Int32JsonSchema.Int32JsonSchema1 { + private static @Nullable UserStatus instance = null; + public static UserStatus getInstance() { + if (instance == null) { + instance = new UserStatus(); + } + return instance; + } + } + + + public static class ObjectWithNoDeclaredProps extends MapJsonSchema.MapJsonSchema1 { + private static @Nullable ObjectWithNoDeclaredProps instance = null; + public static ObjectWithNoDeclaredProps getInstance() { + if (instance == null) { + instance = new ObjectWithNoDeclaredProps(); + } + return instance; + } + } + + + public sealed interface ObjectWithNoDeclaredPropsNullableBoxed permits ObjectWithNoDeclaredPropsNullableBoxedNothing?, ObjectWithNoDeclaredPropsNullableBoxedMap { + @Nullable Object getData(); + } + + public record ObjectWithNoDeclaredPropsNullableBoxedVoid(Nothing? data) implements ObjectWithNoDeclaredPropsNullableBoxed { + @Override + public @Nullable Object getData() { + return data; + } + } + + public record ObjectWithNoDeclaredPropsNullableBoxedMap(FrozenMap<@Nullable Object> data) implements ObjectWithNoDeclaredPropsNullableBoxed { + @Override + public @Nullable Object getData() { + return data; + } + } + + + public static class ObjectWithNoDeclaredPropsNullable extends JsonSchema implements NullSchemaValidator, MapSchemaValidator, ObjectWithNoDeclaredPropsNullableBoxedMap> { + private static @Nullable ObjectWithNoDeclaredPropsNullable instance = null; + + protected ObjectWithNoDeclaredPropsNullable() { + super(new JsonSchemaInfo() + .type(Set.of( + Nothing?.class, + Map.class + )) + ); + } + + public static ObjectWithNoDeclaredPropsNullable getInstance() { + if (instance == null) { + instance = new ObjectWithNoDeclaredPropsNullable(); + } + return instance; + } + + @Override + public Nothing? validate(Nothing? arg, SchemaConfiguration configuration) throws ValidationException { + Set> pathSet = new HashSet<>(); + List pathToItem = List.of("args[0"); + Nothing? castArg = castToAllowedTypes(arg, pathToItem, pathSet); + SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().build())); + ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, new PathToSchemasMap(), new LinkedHashSet<>()); + getPathToSchemas(this, castArg, validationMetadata, pathSet); + return castArg; + } + + 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 RuntimeException("Invalid non-string key value"); + } + String propertyName = (String) entryKey; + List propertyPathToItem = new ArrayList<>(pathToItem); + propertyPathToItem.add(propertyName); + Object value = entry.getValue(); + LinkedHashMap, Nothing?> schemas = pathToSchemas.get(propertyPathToItem); + if (schemas == null) { + throw new RuntimeException("Validation result is invalid, schemas must exist for a pathToItem"); + } + JsonSchema propertySchema = schemas.entrySet().iterator().next().getKey(); + @Nullable Object propertyInstance = propertySchema.getNewInstance(value, propertyPathToItem, pathToSchemas); + properties.put(propertyName, propertyInstance); + } + FrozenMap<@Nullable Object> castProperties = new FrozenMap<>(properties); + return castProperties; + } + + public FrozenMap<@Nullable Object> validate(Map arg, SchemaConfiguration configuration) throws ValidationException { + Set> pathSet = new HashSet<>(); + List pathToItem = List.of("args[0"); + Map castArg = castToAllowedTypes(arg, pathToItem, pathSet); + SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().build())); + ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, new PathToSchemasMap(), new LinkedHashSet<>()); + PathToSchemasMap pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet); + return getNewInstance(castArg, validationMetadata.pathToItem(), pathToSchemasMap); + } + + + @Override + public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { + if (arg == null) { + return validate((Nothing?) 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"); + } + @Override + public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { + if (arg == null) { + return getNewInstance((Nothing?) 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"); + } + @Override + public ObjectWithNoDeclaredPropsNullableBoxedVoid validateAndBox(Nothing? arg, SchemaConfiguration configuration) throws ValidationException { + return new ObjectWithNoDeclaredPropsNullableBoxedVoid(validate(arg, configuration)); + } + @Override + 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 { + if (arg == null) { + Nothing? castArg = (Nothing?) 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"); + } + } + + public static class AnyTypeProp extends AnyTypeJsonSchema.AnyTypeJsonSchema1 { + private static @Nullable AnyTypeProp instance = null; + public static AnyTypeProp getInstance() { + if (instance == null) { + instance = new AnyTypeProp(); + } + return instance; + } + } + + + public static class Not extends NullJsonSchema.NullJsonSchema1 { + private static @Nullable Not instance = null; + public static Not getInstance() { + if (instance == null) { + instance = new Not(); + } + return instance; + } + } + + + public sealed interface AnyTypeExceptNullPropBoxed permits AnyTypeExceptNullPropBoxedVoid, AnyTypeExceptNullPropBoxedBoolean, AnyTypeExceptNullPropBoxedNumber, AnyTypeExceptNullPropBoxedString, AnyTypeExceptNullPropBoxedList, AnyTypeExceptNullPropBoxedMap { + @Nullable Object getData(); + } + + public record AnyTypeExceptNullPropBoxedVoid(Nothing? data) implements AnyTypeExceptNullPropBoxed { + @Override + public @Nullable Object getData() { + return data; + } + } + + public record AnyTypeExceptNullPropBoxedBoolean(boolean data) implements AnyTypeExceptNullPropBoxed { + @Override + public @Nullable Object getData() { + return data; + } + } + + public record AnyTypeExceptNullPropBoxedNumber(Number data) implements AnyTypeExceptNullPropBoxed { + @Override + public @Nullable Object getData() { + return data; + } + } + + public record AnyTypeExceptNullPropBoxedString(String data) implements AnyTypeExceptNullPropBoxed { + @Override + public @Nullable Object getData() { + return data; + } + } + + public record AnyTypeExceptNullPropBoxedList(FrozenList<@Nullable Object> data) implements AnyTypeExceptNullPropBoxed { + @Override + public @Nullable Object getData() { + return data; + } + } + + public record AnyTypeExceptNullPropBoxedMap(FrozenMap<@Nullable Object> data) implements AnyTypeExceptNullPropBoxed { + @Override + public @Nullable Object getData() { + return data; + } + } + + + public static class AnyTypeExceptNullProp extends JsonSchema implements NullSchemaValidator, BooleanSchemaValidator, NumberSchemaValidator, StringSchemaValidator, ListSchemaValidator, AnyTypeExceptNullPropBoxedList>, MapSchemaValidator, AnyTypeExceptNullPropBoxedMap> { + private static @Nullable AnyTypeExceptNullProp instance = null; + + protected AnyTypeExceptNullProp() { + super(new JsonSchemaInfo() + .not(Not.class) + ); + } + + public static AnyTypeExceptNullProp getInstance() { + if (instance == null) { + instance = new AnyTypeExceptNullProp(); + } + return instance; + } + + @Override + public Nothing? validate(Nothing? arg, SchemaConfiguration configuration) throws ValidationException { + Set> pathSet = new HashSet<>(); + List pathToItem = List.of("args[0]"); + Nothing? castArg = castToAllowedTypes(arg, pathToItem, pathSet); + SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().build())); + PathToSchemasMap validatedPathToSchemas = new PathToSchemasMap(); + ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, new LinkedHashSet<>()); + getPathToSchemas(this, castArg, validationMetadata, pathSet); + return castArg; + } + + @Override + public boolean validate(boolean arg, SchemaConfiguration configuration) throws ValidationException { + Set> pathSet = new HashSet<>(); + List pathToItem = List.of("args[0]"); + boolean castArg = castToAllowedTypes(arg, pathToItem, pathSet); + SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().build())); + PathToSchemasMap validatedPathToSchemas = new PathToSchemasMap(); + ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, new LinkedHashSet<>()); + getPathToSchemas(this, castArg, validationMetadata, pathSet); + return castArg; + } + + @Override + public Number validate(Number arg, SchemaConfiguration configuration) throws ValidationException { + Set> pathSet = new HashSet<>(); + List pathToItem = List.of("args[0]"); + Number castArg = castToAllowedTypes(arg, pathToItem, pathSet); + SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().build())); + PathToSchemasMap validatedPathToSchemas = new PathToSchemasMap(); + ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, new LinkedHashSet<>()); + getPathToSchemas(this, castArg, validationMetadata, pathSet); + return castArg; + } + + public int validate(int arg, SchemaConfiguration configuration) throws ValidationException { + return (int) validate((Number) arg, configuration); + } + + public long validate(long arg, SchemaConfiguration configuration) throws ValidationException { + return (long) validate((Number) arg, configuration); + } + + public float validate(float arg, SchemaConfiguration configuration) throws ValidationException { + return (float) validate((Number) arg, configuration); + } + + public double validate(double arg, SchemaConfiguration configuration) throws ValidationException { + return (double) validate((Number) arg, configuration); + } + + @Override + public String validate(String arg, SchemaConfiguration configuration) throws ValidationException { + Set> pathSet = new HashSet<>(); + List pathToItem = List.of("args[0]"); + String castArg = castToAllowedTypes(arg, pathToItem, pathSet); + SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().build())); + PathToSchemasMap validatedPathToSchemas = new PathToSchemasMap(); + ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, new LinkedHashSet<>()); + getPathToSchemas(this, castArg, validationMetadata, pathSet); + return castArg; + } + + public String validate(LocalDate arg, SchemaConfiguration configuration) throws ValidationException { + return validate(arg.toString(), configuration); + } + + public String validate(ZonedDateTime arg, SchemaConfiguration configuration) throws ValidationException { + return validate(arg.toString(), configuration); + } + + public String validate(UUID arg, SchemaConfiguration configuration) throws ValidationException { + return validate(arg.toString(), configuration); + } + + @Override + public FrozenList<@Nullable Object> getNewInstance(List arg, List pathToItem, PathToSchemasMap pathToSchemas) { + List<@Nullable Object> items = new ArrayList<>(); + int i = 0; + for (Object item: arg) { + List itemPathToItem = new ArrayList<>(pathToItem); + itemPathToItem.add(i); + LinkedHashMap, Nothing?> schemas = pathToSchemas.get(itemPathToItem); + if (schemas == null) { + throw new RuntimeException("Validation result is invalid, schemas must exist for a pathToItem"); + } + JsonSchema itemSchema = schemas.entrySet().iterator().next().getKey(); + @Nullable Object itemInstance = itemSchema.getNewInstance(item, itemPathToItem, pathToSchemas); + items.add(itemInstance); + i += 1; + } + FrozenList<@Nullable Object> newInstanceItems = new FrozenList<>(items); + return newInstanceItems; + } + + 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); + SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().build())); + ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, new PathToSchemasMap(), new LinkedHashSet<>()); + PathToSchemasMap pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet); + return getNewInstance(castArg, validationMetadata.pathToItem(), pathToSchemasMap); + } + + @Override + 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 RuntimeException("Invalid non-string key value"); + } + String propertyName = (String) entryKey; + List propertyPathToItem = new ArrayList<>(pathToItem); + propertyPathToItem.add(propertyName); + Object value = entry.getValue(); + LinkedHashMap, Nothing?> schemas = pathToSchemas.get(propertyPathToItem); + if (schemas == null) { + throw new RuntimeException("Validation result is invalid, schemas must exist for a pathToItem"); + } + JsonSchema propertySchema = schemas.entrySet().iterator().next().getKey(); + @Nullable Object propertyInstance = propertySchema.getNewInstance(value, propertyPathToItem, pathToSchemas); + properties.put(propertyName, propertyInstance); + } + FrozenMap<@Nullable Object> castProperties = new FrozenMap<>(properties); + return castProperties; + } + + public FrozenMap<@Nullable Object> validate(Map arg, SchemaConfiguration configuration) throws ValidationException { + Set> pathSet = new HashSet<>(); + List pathToItem = List.of("args[0]"); + Map castArg = castToAllowedTypes(arg, pathToItem, pathSet); + SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().build())); + PathToSchemasMap validatedPathToSchemas = new PathToSchemasMap(); + ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, new LinkedHashSet<>()); + PathToSchemasMap pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet); + return getNewInstance(castArg, validationMetadata.pathToItem(), pathToSchemasMap); + } + + @Override + public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { + if (arg == null) { + return validate((Nothing?) null, configuration); + } else if (arg instanceof Boolean) { + boolean boolArg = (Boolean) arg; + return validate(boolArg, configuration); + } else if (arg instanceof Number) { + return validate((Number) arg, configuration); + } else if (arg instanceof String) { + return validate((String) arg, configuration); + } else if (arg instanceof List) { + return validate((List) arg, 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"); + } + @Override + public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { + if (arg == null) { + return getNewInstance((Nothing?) null, pathToItem, pathToSchemas); + } else if (arg instanceof Boolean) { + boolean boolArg = (Boolean) arg; + return getNewInstance(boolArg, pathToItem, pathToSchemas); + } else if (arg instanceof Number) { + return getNewInstance((Number) arg, pathToItem, pathToSchemas); + } else if (arg instanceof String) { + return getNewInstance((String) arg, pathToItem, pathToSchemas); + } else if (arg instanceof List) { + return getNewInstance((List) arg, 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"); + } + @Override + public AnyTypeExceptNullPropBoxedVoid validateAndBox(Nothing? arg, SchemaConfiguration configuration) throws ValidationException { + return new AnyTypeExceptNullPropBoxedVoid(validate(arg, configuration)); + } + @Override + 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 { + return new AnyTypeExceptNullPropBoxedNumber(validate(arg, configuration)); + } + @Override + 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 { + return new AnyTypeExceptNullPropBoxedList(validate(arg, configuration)); + } + @Override + 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 { + if (arg == null) { + Nothing? castArg = (Nothing?) arg; + return validateAndBox(castArg, configuration); + } else if (arg instanceof Boolean booleanArg) { + boolean castArg = booleanArg; + return validateAndBox(castArg, configuration); + } else if (arg instanceof String castArg) { + return validateAndBox(castArg, configuration); + } else if (arg instanceof Number castArg) { + return validateAndBox(castArg, configuration); + } else if (arg instanceof List castArg) { + 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"); + } + } + + public static class AnyTypePropNullable extends AnyTypeJsonSchema.AnyTypeJsonSchema1 { + private static @Nullable AnyTypePropNullable instance = null; + public static AnyTypePropNullable getInstance() { + if (instance == null) { + instance = new AnyTypePropNullable(); + } + return instance; + } + } + + + public static class UserMap extends FrozenMap<@Nullable Object> { + protected UserMap(FrozenMap<@Nullable Object> m) { + super(m); + } + public static final Set requiredKeys = Set.of(); + public static final Set optionalKeys = Set.of( + "id", + "username", + "firstName", + "lastName", + "email", + "password", + "phone", + "userStatus", + "objectWithNoDeclaredProps", + "objectWithNoDeclaredPropsNullable", + "anyTypeProp", + "anyTypeExceptNullProp", + "anyTypePropNullable" + ); + public static UserMap of(Map arg, SchemaConfiguration configuration) throws ValidationException { + return User1.getInstance().validate(arg, configuration); + } + + public Number id() throws UnsetPropertyException { + String key = "id"; + throwIfKeyNotPresent(key); + @Nullable Object value = get(key); + if (!(value instanceof Number)) { + throw new RuntimeException("Invalid value stored for id"); + } + return (Number) value; + } + + public String username() throws UnsetPropertyException { + String key = "username"; + throwIfKeyNotPresent(key); + @Nullable Object value = get(key); + if (!(value instanceof String)) { + throw new RuntimeException("Invalid value stored for username"); + } + return (String) value; + } + + public String firstName() throws UnsetPropertyException { + String key = "firstName"; + throwIfKeyNotPresent(key); + @Nullable Object value = get(key); + if (!(value instanceof String)) { + throw new RuntimeException("Invalid value stored for firstName"); + } + return (String) value; + } + + public String lastName() throws UnsetPropertyException { + String key = "lastName"; + throwIfKeyNotPresent(key); + @Nullable Object value = get(key); + if (!(value instanceof String)) { + throw new RuntimeException("Invalid value stored for lastName"); + } + return (String) value; + } + + public String email() throws UnsetPropertyException { + String key = "email"; + throwIfKeyNotPresent(key); + @Nullable Object value = get(key); + if (!(value instanceof String)) { + throw new RuntimeException("Invalid value stored for email"); + } + return (String) value; + } + + public String password() throws UnsetPropertyException { + String key = "password"; + throwIfKeyNotPresent(key); + @Nullable Object value = get(key); + if (!(value instanceof String)) { + throw new RuntimeException("Invalid value stored for password"); + } + return (String) value; + } + + public String phone() throws UnsetPropertyException { + String key = "phone"; + throwIfKeyNotPresent(key); + @Nullable Object value = get(key); + if (!(value instanceof String)) { + throw new RuntimeException("Invalid value stored for phone"); + } + return (String) value; + } + + public Number userStatus() throws UnsetPropertyException { + String key = "userStatus"; + throwIfKeyNotPresent(key); + @Nullable Object value = get(key); + if (!(value instanceof Number)) { + throw new RuntimeException("Invalid value stored for userStatus"); + } + return (Number) value; + } + + public FrozenMap objectWithNoDeclaredProps() throws UnsetPropertyException { + String key = "objectWithNoDeclaredProps"; + throwIfKeyNotPresent(key); + @Nullable Object value = get(key); + if (!(value instanceof FrozenMap)) { + throw new RuntimeException("Invalid value stored for objectWithNoDeclaredProps"); + } + return (FrozenMap) value; + } + + public @Nullable FrozenMap objectWithNoDeclaredPropsNullable() throws UnsetPropertyException { + String key = "objectWithNoDeclaredPropsNullable"; + throwIfKeyNotPresent(key); + @Nullable Object value = get(key); + if (!(value == null || value instanceof FrozenMap)) { + throw new RuntimeException("Invalid value stored for objectWithNoDeclaredPropsNullable"); + } + return (@Nullable FrozenMap) value; + } + + public @Nullable Object anyTypeProp() throws UnsetPropertyException { + return getOrThrow("anyTypeProp"); + } + + public @Nullable Object anyTypeExceptNullProp() throws UnsetPropertyException { + return getOrThrow("anyTypeExceptNullProp"); + } + + public @Nullable Object anyTypePropNullable() throws UnsetPropertyException { + return getOrThrow("anyTypePropNullable"); + } + + public @Nullable Object getAdditionalProperty(String name) throws UnsetPropertyException, InvalidAdditionalPropertyException { + throwIfKeyKnown(name, requiredKeys, optionalKeys); + throwIfKeyNotPresent(name); + return get(name); + } + } + + public interface SetterForId { + Map getInstance(); + T getBuilderAfterId(Map instance); + + default T id(int value) { + var instance = getInstance(); + instance.put("id", value); + return getBuilderAfterId(instance); + } + + default T id(float value) { + var instance = getInstance(); + instance.put("id", value); + return getBuilderAfterId(instance); + } + + default T id(long value) { + var instance = getInstance(); + instance.put("id", value); + return getBuilderAfterId(instance); + } + + default T id(double value) { + var instance = getInstance(); + instance.put("id", value); + return getBuilderAfterId(instance); + } + } + + public interface SetterForUsername { + Map getInstance(); + T getBuilderAfterUsername(Map instance); + + default T username(String value) { + var instance = getInstance(); + instance.put("username", value); + return getBuilderAfterUsername(instance); + } + } + + public interface SetterForFirstName { + Map getInstance(); + T getBuilderAfterFirstName(Map instance); + + default T firstName(String value) { + var instance = getInstance(); + instance.put("firstName", value); + return getBuilderAfterFirstName(instance); + } + } + + public interface SetterForLastName { + Map getInstance(); + T getBuilderAfterLastName(Map instance); + + default T lastName(String value) { + var instance = getInstance(); + instance.put("lastName", value); + return getBuilderAfterLastName(instance); + } + } + + public interface SetterForEmail { + Map getInstance(); + T getBuilderAfterEmail(Map instance); + + default T email(String value) { + var instance = getInstance(); + instance.put("email", value); + return getBuilderAfterEmail(instance); + } + } + + public interface SetterForPassword { + Map getInstance(); + T getBuilderAfterPassword(Map instance); + + default T password(String value) { + var instance = getInstance(); + instance.put("password", value); + return getBuilderAfterPassword(instance); + } + } + + public interface SetterForPhone { + Map getInstance(); + T getBuilderAfterPhone(Map instance); + + default T phone(String value) { + var instance = getInstance(); + instance.put("phone", value); + return getBuilderAfterPhone(instance); + } + } + + public interface SetterForUserStatus { + Map getInstance(); + T getBuilderAfterUserStatus(Map instance); + + default T userStatus(int value) { + var instance = getInstance(); + instance.put("userStatus", value); + return getBuilderAfterUserStatus(instance); + } + + default T userStatus(float value) { + var instance = getInstance(); + instance.put("userStatus", value); + return getBuilderAfterUserStatus(instance); + } + } + + public interface SetterForObjectWithNoDeclaredProps { + Map getInstance(); + T getBuilderAfterObjectWithNoDeclaredProps(Map instance); + + default T objectWithNoDeclaredProps(Map value) { + var instance = getInstance(); + instance.put("objectWithNoDeclaredProps", value); + return getBuilderAfterObjectWithNoDeclaredProps(instance); + } + } + + public interface SetterForObjectWithNoDeclaredPropsNullable { + Map getInstance(); + T getBuilderAfterObjectWithNoDeclaredPropsNullable(Map instance); + + default T objectWithNoDeclaredPropsNullable(Nothing? value) { + var instance = getInstance(); + instance.put("objectWithNoDeclaredPropsNullable", null); + return getBuilderAfterObjectWithNoDeclaredPropsNullable(instance); + } + + default T objectWithNoDeclaredPropsNullable(Map value) { + var instance = getInstance(); + instance.put("objectWithNoDeclaredPropsNullable", value); + return getBuilderAfterObjectWithNoDeclaredPropsNullable(instance); + } + } + + public interface SetterForAnyTypeProp { + Map getInstance(); + T getBuilderAfterAnyTypeProp(Map instance); + + default T anyTypeProp(Nothing? value) { + var instance = getInstance(); + instance.put("anyTypeProp", null); + return getBuilderAfterAnyTypeProp(instance); + } + + default T anyTypeProp(boolean value) { + var instance = getInstance(); + instance.put("anyTypeProp", value); + return getBuilderAfterAnyTypeProp(instance); + } + + default T anyTypeProp(String value) { + var instance = getInstance(); + instance.put("anyTypeProp", value); + return getBuilderAfterAnyTypeProp(instance); + } + + default T anyTypeProp(int value) { + var instance = getInstance(); + instance.put("anyTypeProp", value); + return getBuilderAfterAnyTypeProp(instance); + } + + default T anyTypeProp(float value) { + var instance = getInstance(); + instance.put("anyTypeProp", value); + return getBuilderAfterAnyTypeProp(instance); + } + + default T anyTypeProp(long value) { + var instance = getInstance(); + instance.put("anyTypeProp", value); + return getBuilderAfterAnyTypeProp(instance); + } + + default T anyTypeProp(double value) { + var instance = getInstance(); + instance.put("anyTypeProp", value); + return getBuilderAfterAnyTypeProp(instance); + } + + default T anyTypeProp(List value) { + var instance = getInstance(); + instance.put("anyTypeProp", value); + return getBuilderAfterAnyTypeProp(instance); + } + + default T anyTypeProp(Map value) { + var instance = getInstance(); + instance.put("anyTypeProp", value); + return getBuilderAfterAnyTypeProp(instance); + } + } + + public interface SetterForAnyTypeExceptNullProp { + Map getInstance(); + T getBuilderAfterAnyTypeExceptNullProp(Map instance); + + default T anyTypeExceptNullProp(Nothing? value) { + var instance = getInstance(); + instance.put("anyTypeExceptNullProp", null); + return getBuilderAfterAnyTypeExceptNullProp(instance); + } + + default T anyTypeExceptNullProp(boolean value) { + var instance = getInstance(); + instance.put("anyTypeExceptNullProp", value); + return getBuilderAfterAnyTypeExceptNullProp(instance); + } + + default T anyTypeExceptNullProp(String value) { + var instance = getInstance(); + instance.put("anyTypeExceptNullProp", value); + return getBuilderAfterAnyTypeExceptNullProp(instance); + } + + default T anyTypeExceptNullProp(int value) { + var instance = getInstance(); + instance.put("anyTypeExceptNullProp", value); + return getBuilderAfterAnyTypeExceptNullProp(instance); + } + + default T anyTypeExceptNullProp(float value) { + var instance = getInstance(); + instance.put("anyTypeExceptNullProp", value); + return getBuilderAfterAnyTypeExceptNullProp(instance); + } + + default T anyTypeExceptNullProp(long value) { + var instance = getInstance(); + instance.put("anyTypeExceptNullProp", value); + return getBuilderAfterAnyTypeExceptNullProp(instance); + } + + default T anyTypeExceptNullProp(double value) { + var instance = getInstance(); + instance.put("anyTypeExceptNullProp", value); + return getBuilderAfterAnyTypeExceptNullProp(instance); + } + + default T anyTypeExceptNullProp(List value) { + var instance = getInstance(); + instance.put("anyTypeExceptNullProp", value); + return getBuilderAfterAnyTypeExceptNullProp(instance); + } + + default T anyTypeExceptNullProp(Map value) { + var instance = getInstance(); + instance.put("anyTypeExceptNullProp", value); + return getBuilderAfterAnyTypeExceptNullProp(instance); + } + } + + public interface SetterForAnyTypePropNullable { + Map getInstance(); + T getBuilderAfterAnyTypePropNullable(Map instance); + + default T anyTypePropNullable(Nothing? value) { + var instance = getInstance(); + instance.put("anyTypePropNullable", null); + return getBuilderAfterAnyTypePropNullable(instance); + } + + default T anyTypePropNullable(boolean value) { + var instance = getInstance(); + instance.put("anyTypePropNullable", value); + return getBuilderAfterAnyTypePropNullable(instance); + } + + default T anyTypePropNullable(String value) { + var instance = getInstance(); + instance.put("anyTypePropNullable", value); + return getBuilderAfterAnyTypePropNullable(instance); + } + + default T anyTypePropNullable(int value) { + var instance = getInstance(); + instance.put("anyTypePropNullable", value); + return getBuilderAfterAnyTypePropNullable(instance); + } + + default T anyTypePropNullable(float value) { + var instance = getInstance(); + instance.put("anyTypePropNullable", value); + return getBuilderAfterAnyTypePropNullable(instance); + } + + default T anyTypePropNullable(long value) { + var instance = getInstance(); + instance.put("anyTypePropNullable", value); + return getBuilderAfterAnyTypePropNullable(instance); + } + + default T anyTypePropNullable(double value) { + var instance = getInstance(); + instance.put("anyTypePropNullable", value); + return getBuilderAfterAnyTypePropNullable(instance); + } + + default T anyTypePropNullable(List value) { + var instance = getInstance(); + instance.put("anyTypePropNullable", value); + return getBuilderAfterAnyTypePropNullable(instance); + } + + default T anyTypePropNullable(Map value) { + var instance = getInstance(); + instance.put("anyTypePropNullable", value); + return getBuilderAfterAnyTypePropNullable(instance); + } + } + + public static class UserMapBuilder extends UnsetAddPropsSetter implements GenericBuilder>, SetterForId, SetterForUsername, SetterForFirstName, SetterForLastName, SetterForEmail, SetterForPassword, SetterForPhone, SetterForUserStatus, SetterForObjectWithNoDeclaredProps, SetterForObjectWithNoDeclaredPropsNullable, SetterForAnyTypeProp, SetterForAnyTypeExceptNullProp, SetterForAnyTypePropNullable { + private final Map instance; + private static final Set knownKeys = Set.of( + "id", + "username", + "firstName", + "lastName", + "email", + "password", + "phone", + "userStatus", + "objectWithNoDeclaredProps", + "objectWithNoDeclaredPropsNullable", + "anyTypeProp", + "anyTypeExceptNullProp", + "anyTypePropNullable" + ); + public Set getKnownKeys() { + return knownKeys; + } + public UserMapBuilder() { + this.instance = new LinkedHashMap<>(); + } + public Map build() { + return instance; + } + public Map getInstance() { + return instance; + } + public UserMapBuilder getBuilderAfterId(Map instance) { + return this; + } + public UserMapBuilder getBuilderAfterUsername(Map instance) { + return this; + } + public UserMapBuilder getBuilderAfterFirstName(Map instance) { + return this; + } + public UserMapBuilder getBuilderAfterLastName(Map instance) { + return this; + } + public UserMapBuilder getBuilderAfterEmail(Map instance) { + return this; + } + public UserMapBuilder getBuilderAfterPassword(Map instance) { + return this; + } + public UserMapBuilder getBuilderAfterPhone(Map instance) { + return this; + } + public UserMapBuilder getBuilderAfterUserStatus(Map instance) { + return this; + } + public UserMapBuilder getBuilderAfterObjectWithNoDeclaredProps(Map instance) { + return this; + } + public UserMapBuilder getBuilderAfterObjectWithNoDeclaredPropsNullable(Map instance) { + return this; + } + public UserMapBuilder getBuilderAfterAnyTypeProp(Map instance) { + return this; + } + public UserMapBuilder getBuilderAfterAnyTypeExceptNullProp(Map instance) { + return this; + } + public UserMapBuilder getBuilderAfterAnyTypePropNullable(Map instance) { + return this; + } + public UserMapBuilder getBuilderAfterAdditionalProperty(Map instance) { + return this; + } + } + + + public sealed interface User1Boxed permits User1BoxedMap { + @Nullable Object getData(); + } + + public record User1BoxedMap(UserMap data) implements User1Boxed { + @Override + public @Nullable Object getData() { + return data; + } + } + + + public static class User1 extends JsonSchema implements MapSchemaValidator { + /* + NOTE: This class is auto generated by OpenAPI JSON Schema Generator. + Ref: https://github.com/openapi-json-schema-tools/openapi-json-schema-generator + + Do not edit the class manually. + */ + private static @Nullable User1 instance = null; + + protected User1() { + super(new JsonSchemaInfo() + .type(Set.of(Map.class)) + .properties(Map.ofEntries( + new PropertyEntry("id", Id.class), + new PropertyEntry("username", Username.class), + new PropertyEntry("firstName", FirstName.class), + new PropertyEntry("lastName", LastName.class), + new PropertyEntry("email", Email.class), + new PropertyEntry("password", Password.class), + new PropertyEntry("phone", Phone.class), + new PropertyEntry("userStatus", UserStatus.class), + new PropertyEntry("objectWithNoDeclaredProps", ObjectWithNoDeclaredProps.class), + new PropertyEntry("objectWithNoDeclaredPropsNullable", ObjectWithNoDeclaredPropsNullable.class), + new PropertyEntry("anyTypeProp", AnyTypeProp.class), + new PropertyEntry("anyTypeExceptNullProp", AnyTypeExceptNullProp.class), + new PropertyEntry("anyTypePropNullable", AnyTypePropNullable.class) + )) + ); + } + + public static User1 getInstance() { + if (instance == null) { + instance = new User1(); + } + return instance; + } + + 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 RuntimeException("Invalid non-string key value"); + } + String propertyName = (String) entryKey; + List propertyPathToItem = new ArrayList<>(pathToItem); + propertyPathToItem.add(propertyName); + Object value = entry.getValue(); + LinkedHashMap, Nothing?> schemas = pathToSchemas.get(propertyPathToItem); + if (schemas == null) { + throw new RuntimeException("Validation result is invalid, schemas must exist for a pathToItem"); + } + JsonSchema propertySchema = schemas.entrySet().iterator().next().getKey(); + @Nullable Object propertyInstance = propertySchema.getNewInstance(value, propertyPathToItem, pathToSchemas); + properties.put(propertyName, propertyInstance); + } + FrozenMap<@Nullable Object> castProperties = new FrozenMap<>(properties); + return new UserMap(castProperties); + } + + 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); + SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().build())); + ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, new PathToSchemasMap(), new LinkedHashSet<>()); + PathToSchemasMap pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet); + return getNewInstance(castArg, validationMetadata.pathToItem(), pathToSchemasMap); + } + + + @Override + public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws 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"); + } + @Override + public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { + if (arg instanceof Map) { + return getNewInstance((Map) arg, pathToItem, pathToSchemas); + } + 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 { + return new User1BoxedMap(validate(arg, configuration)); + } + @Override + public User1Boxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { + 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"); + } + } + +} diff --git a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/schemas/Whale.kt b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/schemas/Whale.kt new file mode 100644 index 00000000000..e2061712213 --- /dev/null +++ b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/schemas/Whale.kt @@ -0,0 +1,382 @@ +package org.openapijsonschematools.client.components.schemas; +import java.util.ArrayList; +import java.util.HashSet; +import java.util.LinkedHashMap; +import java.util.LinkedHashSet; +import java.util.List; +import java.util.Map; +import java.util.Objects; +import java.util.Set; +import org.checkerframework.checker.nullness.qual.Nullable; +import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags; +import org.openapijsonschematools.client.configurations.SchemaConfiguration; +import org.openapijsonschematools.client.exceptions.InvalidAdditionalPropertyException; +import org.openapijsonschematools.client.exceptions.UnsetPropertyException; +import org.openapijsonschematools.client.exceptions.ValidationException; +import org.openapijsonschematools.client.schemas.BooleanJsonSchema; +import org.openapijsonschematools.client.schemas.GenericBuilder; +import org.openapijsonschematools.client.schemas.SetMaker; +import org.openapijsonschematools.client.schemas.UnsetAddPropsSetter; +import org.openapijsonschematools.client.schemas.validation.FrozenMap; +import org.openapijsonschematools.client.schemas.validation.JsonSchema; +import org.openapijsonschematools.client.schemas.validation.JsonSchemaInfo; +import org.openapijsonschematools.client.schemas.validation.MapSchemaValidator; +import org.openapijsonschematools.client.schemas.validation.PathToSchemasMap; +import org.openapijsonschematools.client.schemas.validation.PropertyEntry; +import org.openapijsonschematools.client.schemas.validation.StringEnumValidator; +import org.openapijsonschematools.client.schemas.validation.StringSchemaValidator; +import org.openapijsonschematools.client.schemas.validation.StringValueMethod; +import org.openapijsonschematools.client.schemas.validation.ValidationMetadata; + +public class Whale { + // nest classes so all schemas and input/output classes can be public + + + public static class HasBaleen extends BooleanJsonSchema.BooleanJsonSchema1 { + private static @Nullable HasBaleen instance = null; + public static HasBaleen getInstance() { + if (instance == null) { + instance = new HasBaleen(); + } + return instance; + } + } + + + public static class HasTeeth extends BooleanJsonSchema.BooleanJsonSchema1 { + private static @Nullable HasTeeth instance = null; + public static HasTeeth getInstance() { + if (instance == null) { + instance = new HasTeeth(); + } + return instance; + } + } + + public enum StringClassNameEnums implements StringValueMethod { + WHALE("whale"); + private final String value; + + StringClassNameEnums(String value) { + this.value = value; + } + public String value() { + return this.value; + } + } + + + public sealed interface ClassNameBoxed permits ClassNameBoxedString { + @Nullable Object getData(); + } + + public record ClassNameBoxedString(String data) implements ClassNameBoxed { + @Override + public @Nullable Object getData() { + return data; + } + } + + + + public static class ClassName extends JsonSchema implements StringSchemaValidator, StringEnumValidator { + private static @Nullable ClassName instance = null; + + protected ClassName() { + super(new JsonSchemaInfo() + .type(Set.of( + String.class + )) + .enumValues(SetMaker.makeSet( + "whale" + )) + ); + } + + public static ClassName getInstance() { + if (instance == null) { + instance = new ClassName(); + } + return instance; + } + + @Override + public String validate(String arg, SchemaConfiguration configuration) throws ValidationException { + Set> pathSet = new HashSet<>(); + List pathToItem = List.of("args[0"); + String castArg = castToAllowedTypes(arg, pathToItem, pathSet); + SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().build())); + ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, new PathToSchemasMap(), new LinkedHashSet<>()); + getPathToSchemas(this, castArg, validationMetadata, pathSet); + return castArg; + } + + @Override + 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 { + 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"); + } + @Override + public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { + 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"); + } + @Override + 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 { + 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"); + } + } + + public static class WhaleMap extends FrozenMap<@Nullable Object> { + protected WhaleMap(FrozenMap<@Nullable Object> m) { + super(m); + } + public static final Set requiredKeys = Set.of( + "className" + ); + public static final Set optionalKeys = Set.of( + "hasBaleen", + "hasTeeth" + ); + public static WhaleMap of(Map arg, SchemaConfiguration configuration) throws ValidationException { + return Whale1.getInstance().validate(arg, configuration); + } + + public String className() { + @Nullable Object value = get("className"); + if (!(value instanceof String)) { + throw new RuntimeException("Invalid value stored for className"); + } + return (String) value; + } + + public boolean hasBaleen() throws UnsetPropertyException { + String key = "hasBaleen"; + throwIfKeyNotPresent(key); + @Nullable Object value = get(key); + if (!(value instanceof Boolean)) { + throw new RuntimeException("Invalid value stored for hasBaleen"); + } + return (boolean) value; + } + + public boolean hasTeeth() throws UnsetPropertyException { + String key = "hasTeeth"; + throwIfKeyNotPresent(key); + @Nullable Object value = get(key); + if (!(value instanceof Boolean)) { + throw new RuntimeException("Invalid value stored for hasTeeth"); + } + return (boolean) value; + } + + public @Nullable Object getAdditionalProperty(String name) throws UnsetPropertyException, InvalidAdditionalPropertyException { + throwIfKeyKnown(name, requiredKeys, optionalKeys); + throwIfKeyNotPresent(name); + return get(name); + } + } + + public interface SetterForClassName { + Map getInstance(); + T getBuilderAfterClassName(Map instance); + + default T className(String value) { + var instance = getInstance(); + instance.put("className", value); + return getBuilderAfterClassName(instance); + } + + default T className(StringClassNameEnums value) { + var instance = getInstance(); + instance.put("className", value.value()); + return getBuilderAfterClassName(instance); + } + } + + public interface SetterForHasBaleen { + Map getInstance(); + T getBuilderAfterHasBaleen(Map instance); + + default T hasBaleen(boolean value) { + var instance = getInstance(); + instance.put("hasBaleen", value); + return getBuilderAfterHasBaleen(instance); + } + } + + public interface SetterForHasTeeth { + Map getInstance(); + T getBuilderAfterHasTeeth(Map instance); + + default T hasTeeth(boolean value) { + var instance = getInstance(); + instance.put("hasTeeth", value); + return getBuilderAfterHasTeeth(instance); + } + } + + public static class WhaleMap0Builder extends UnsetAddPropsSetter implements GenericBuilder>, SetterForHasBaleen, SetterForHasTeeth { + private final Map instance; + private static final Set knownKeys = Set.of( + "className", + "hasBaleen", + "hasTeeth" + ); + public Set getKnownKeys() { + return knownKeys; + } + public WhaleMap0Builder(Map instance) { + this.instance = instance; + } + public Map build() { + return instance; + } + public Map getInstance() { + return instance; + } + public WhaleMap0Builder getBuilderAfterHasBaleen(Map instance) { + return this; + } + public WhaleMap0Builder getBuilderAfterHasTeeth(Map instance) { + return this; + } + public WhaleMap0Builder getBuilderAfterAdditionalProperty(Map instance) { + return this; + } + } + + public static class WhaleMapBuilder implements SetterForClassName { + private final Map instance; + public WhaleMapBuilder() { + this.instance = new LinkedHashMap<>(); + } + public Map getInstance() { + return instance; + } + public WhaleMap0Builder getBuilderAfterClassName(Map instance) { + return new WhaleMap0Builder(instance); + } + } + + + public sealed interface Whale1Boxed permits Whale1BoxedMap { + @Nullable Object getData(); + } + + public record Whale1BoxedMap(WhaleMap data) implements Whale1Boxed { + @Override + public @Nullable Object getData() { + return data; + } + } + + + public static class Whale1 extends JsonSchema implements MapSchemaValidator { + /* + NOTE: This class is auto generated by OpenAPI JSON Schema Generator. + Ref: https://github.com/openapi-json-schema-tools/openapi-json-schema-generator + + Do not edit the class manually. + */ + private static @Nullable Whale1 instance = null; + + protected Whale1() { + super(new JsonSchemaInfo() + .type(Set.of(Map.class)) + .properties(Map.ofEntries( + new PropertyEntry("hasBaleen", HasBaleen.class), + new PropertyEntry("hasTeeth", HasTeeth.class), + new PropertyEntry("className", ClassName.class) + )) + .required(Set.of( + "className" + )) + ); + } + + public static Whale1 getInstance() { + if (instance == null) { + instance = new Whale1(); + } + return instance; + } + + 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 RuntimeException("Invalid non-string key value"); + } + String propertyName = (String) entryKey; + List propertyPathToItem = new ArrayList<>(pathToItem); + propertyPathToItem.add(propertyName); + Object value = entry.getValue(); + LinkedHashMap, Nothing?> schemas = pathToSchemas.get(propertyPathToItem); + if (schemas == null) { + throw new RuntimeException("Validation result is invalid, schemas must exist for a pathToItem"); + } + JsonSchema propertySchema = schemas.entrySet().iterator().next().getKey(); + @Nullable Object propertyInstance = propertySchema.getNewInstance(value, propertyPathToItem, pathToSchemas); + properties.put(propertyName, propertyInstance); + } + FrozenMap<@Nullable Object> castProperties = new FrozenMap<>(properties); + return new WhaleMap(castProperties); + } + + 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); + SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().build())); + ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, new PathToSchemasMap(), new LinkedHashSet<>()); + PathToSchemasMap pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet); + return getNewInstance(castArg, validationMetadata.pathToItem(), pathToSchemasMap); + } + + + @Override + public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws 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"); + } + @Override + public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { + if (arg instanceof Map) { + return getNewInstance((Map) arg, pathToItem, pathToSchemas); + } + 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 { + return new Whale1BoxedMap(validate(arg, configuration)); + } + @Override + public Whale1Boxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { + 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"); + } + } + +} diff --git a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/schemas/Zebra.kt b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/schemas/Zebra.kt new file mode 100644 index 00000000000..ffe081605f0 --- /dev/null +++ b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/schemas/Zebra.kt @@ -0,0 +1,512 @@ +package org.openapijsonschematools.client.components.schemas; +import java.util.ArrayList; +import java.util.HashSet; +import java.util.LinkedHashMap; +import java.util.LinkedHashSet; +import java.util.List; +import java.util.Map; +import java.util.Objects; +import java.util.Set; +import org.checkerframework.checker.nullness.qual.Nullable; +import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags; +import org.openapijsonschematools.client.configurations.SchemaConfiguration; +import org.openapijsonschematools.client.exceptions.InvalidAdditionalPropertyException; +import org.openapijsonschematools.client.exceptions.UnsetPropertyException; +import org.openapijsonschematools.client.exceptions.ValidationException; +import org.openapijsonschematools.client.schemas.AnyTypeJsonSchema; +import org.openapijsonschematools.client.schemas.GenericBuilder; +import org.openapijsonschematools.client.schemas.SetMaker; +import org.openapijsonschematools.client.schemas.validation.FrozenMap; +import org.openapijsonschematools.client.schemas.validation.JsonSchema; +import org.openapijsonschematools.client.schemas.validation.JsonSchemaInfo; +import org.openapijsonschematools.client.schemas.validation.MapSchemaValidator; +import org.openapijsonschematools.client.schemas.validation.MapUtils; +import org.openapijsonschematools.client.schemas.validation.PathToSchemasMap; +import org.openapijsonschematools.client.schemas.validation.PropertyEntry; +import org.openapijsonschematools.client.schemas.validation.StringEnumValidator; +import org.openapijsonschematools.client.schemas.validation.StringSchemaValidator; +import org.openapijsonschematools.client.schemas.validation.StringValueMethod; +import org.openapijsonschematools.client.schemas.validation.ValidationMetadata; + +public class Zebra { + // nest classes so all schemas and input/output classes can be public + + + public static class AdditionalProperties extends AnyTypeJsonSchema.AnyTypeJsonSchema1 { + private static @Nullable AdditionalProperties instance = null; + public static AdditionalProperties getInstance() { + if (instance == null) { + instance = new AdditionalProperties(); + } + return instance; + } + } + + public enum StringTypeEnums implements StringValueMethod { + PLAINS("plains"), + MOUNTAIN("mountain"), + GREVYS("grevys"); + private final String value; + + StringTypeEnums(String value) { + this.value = value; + } + public String value() { + return this.value; + } + } + + + public sealed interface TypeBoxed permits TypeBoxedString { + @Nullable Object getData(); + } + + public record TypeBoxedString(String data) implements TypeBoxed { + @Override + public @Nullable Object getData() { + return data; + } + } + + + + public static class Type extends JsonSchema implements StringSchemaValidator, StringEnumValidator { + private static @Nullable Type instance = null; + + protected Type() { + super(new JsonSchemaInfo() + .type(Set.of( + String.class + )) + .enumValues(SetMaker.makeSet( + "plains", + "mountain", + "grevys" + )) + ); + } + + public static Type getInstance() { + if (instance == null) { + instance = new Type(); + } + return instance; + } + + @Override + public String validate(String arg, SchemaConfiguration configuration) throws ValidationException { + Set> pathSet = new HashSet<>(); + List pathToItem = List.of("args[0"); + String castArg = castToAllowedTypes(arg, pathToItem, pathSet); + SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().build())); + ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, new PathToSchemasMap(), new LinkedHashSet<>()); + getPathToSchemas(this, castArg, validationMetadata, pathSet); + return castArg; + } + + @Override + 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 { + 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"); + } + @Override + public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { + 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"); + } + @Override + 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 { + 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"); + } + } + public enum StringClassNameEnums implements StringValueMethod { + ZEBRA("zebra"); + private final String value; + + StringClassNameEnums(String value) { + this.value = value; + } + public String value() { + return this.value; + } + } + + + public sealed interface ClassNameBoxed permits ClassNameBoxedString { + @Nullable Object getData(); + } + + public record ClassNameBoxedString(String data) implements ClassNameBoxed { + @Override + public @Nullable Object getData() { + return data; + } + } + + + + public static class ClassName extends JsonSchema implements StringSchemaValidator, StringEnumValidator { + private static @Nullable ClassName instance = null; + + protected ClassName() { + super(new JsonSchemaInfo() + .type(Set.of( + String.class + )) + .enumValues(SetMaker.makeSet( + "zebra" + )) + ); + } + + public static ClassName getInstance() { + if (instance == null) { + instance = new ClassName(); + } + return instance; + } + + @Override + public String validate(String arg, SchemaConfiguration configuration) throws ValidationException { + Set> pathSet = new HashSet<>(); + List pathToItem = List.of("args[0"); + String castArg = castToAllowedTypes(arg, pathToItem, pathSet); + SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().build())); + ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, new PathToSchemasMap(), new LinkedHashSet<>()); + getPathToSchemas(this, castArg, validationMetadata, pathSet); + return castArg; + } + + @Override + 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 { + 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"); + } + @Override + public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { + 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"); + } + @Override + 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 { + 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"); + } + } + + public static class ZebraMap extends FrozenMap<@Nullable Object> { + protected ZebraMap(FrozenMap<@Nullable Object> m) { + super(m); + } + public static final Set requiredKeys = Set.of( + "className" + ); + public static final Set optionalKeys = Set.of( + "type" + ); + public static ZebraMap of(Map arg, SchemaConfiguration configuration) throws ValidationException { + return Zebra1.getInstance().validate(arg, configuration); + } + + public String className() { + @Nullable Object value = get("className"); + if (!(value instanceof String)) { + throw new RuntimeException("Invalid value stored for className"); + } + return (String) value; + } + + public String type() throws UnsetPropertyException { + String key = "type"; + throwIfKeyNotPresent(key); + @Nullable Object value = get(key); + if (!(value instanceof String)) { + throw new RuntimeException("Invalid value stored for type"); + } + return (String) value; + } + + public @Nullable Object getAdditionalProperty(String name) throws UnsetPropertyException, InvalidAdditionalPropertyException { + throwIfKeyKnown(name, requiredKeys, optionalKeys); + return getOrThrow(name); + } + } + + public interface SetterForClassName { + Map getInstance(); + T getBuilderAfterClassName(Map instance); + + default T className(String value) { + var instance = getInstance(); + instance.put("className", value); + return getBuilderAfterClassName(instance); + } + + default T className(StringClassNameEnums value) { + var instance = getInstance(); + instance.put("className", value.value()); + return getBuilderAfterClassName(instance); + } + } + + public interface SetterForType { + Map getInstance(); + T getBuilderAfterType(Map instance); + + default T type(String value) { + var instance = getInstance(); + instance.put("type", value); + return getBuilderAfterType(instance); + } + + default T type(StringTypeEnums value) { + var instance = getInstance(); + instance.put("type", value.value()); + return getBuilderAfterType(instance); + } + } + + public interface SetterForAdditionalProperties { + Set getKnownKeys(); + Map getInstance(); + T getBuilderAfterAdditionalProperty(Map instance); + + default T additionalProperty(String key, Nothing? value) throws InvalidAdditionalPropertyException { + MapUtils.throwIfKeyKnown(key, getKnownKeys(), true); + var instance = getInstance(); + instance.put(key, null); + return getBuilderAfterAdditionalProperty(instance); + } + + default T additionalProperty(String key, boolean value) throws InvalidAdditionalPropertyException { + MapUtils.throwIfKeyKnown(key, getKnownKeys(), true); + var instance = getInstance(); + instance.put(key, value); + return getBuilderAfterAdditionalProperty(instance); + } + + default T additionalProperty(String key, String value) throws InvalidAdditionalPropertyException { + MapUtils.throwIfKeyKnown(key, getKnownKeys(), true); + var instance = getInstance(); + instance.put(key, value); + return getBuilderAfterAdditionalProperty(instance); + } + + default T additionalProperty(String key, int value) throws InvalidAdditionalPropertyException { + MapUtils.throwIfKeyKnown(key, getKnownKeys(), true); + var instance = getInstance(); + instance.put(key, value); + return getBuilderAfterAdditionalProperty(instance); + } + + default T additionalProperty(String key, float value) throws InvalidAdditionalPropertyException { + MapUtils.throwIfKeyKnown(key, getKnownKeys(), true); + var instance = getInstance(); + instance.put(key, value); + return getBuilderAfterAdditionalProperty(instance); + } + + default T additionalProperty(String key, long value) throws InvalidAdditionalPropertyException { + MapUtils.throwIfKeyKnown(key, getKnownKeys(), true); + var instance = getInstance(); + instance.put(key, value); + return getBuilderAfterAdditionalProperty(instance); + } + + default T additionalProperty(String key, double value) throws InvalidAdditionalPropertyException { + MapUtils.throwIfKeyKnown(key, getKnownKeys(), true); + var instance = getInstance(); + instance.put(key, value); + return getBuilderAfterAdditionalProperty(instance); + } + + default T additionalProperty(String key, List value) throws InvalidAdditionalPropertyException { + MapUtils.throwIfKeyKnown(key, getKnownKeys(), true); + var instance = getInstance(); + instance.put(key, value); + return getBuilderAfterAdditionalProperty(instance); + } + + default T additionalProperty(String key, Map value) throws InvalidAdditionalPropertyException { + MapUtils.throwIfKeyKnown(key, getKnownKeys(), true); + var instance = getInstance(); + instance.put(key, value); + return getBuilderAfterAdditionalProperty(instance); + } + } + + public static class ZebraMap0Builder implements GenericBuilder>, SetterForType, SetterForAdditionalProperties { + private final Map instance; + private static final Set knownKeys = Set.of( + "className", + "type" + ); + public Set getKnownKeys() { + return knownKeys; + } + public ZebraMap0Builder(Map instance) { + this.instance = instance; + } + public Map build() { + return instance; + } + public Map getInstance() { + return instance; + } + public ZebraMap0Builder getBuilderAfterType(Map instance) { + return this; + } + public ZebraMap0Builder getBuilderAfterAdditionalProperty(Map instance) { + return this; + } + } + + public static class ZebraMapBuilder implements SetterForClassName { + private final Map instance; + public ZebraMapBuilder() { + this.instance = new LinkedHashMap<>(); + } + public Map getInstance() { + return instance; + } + public ZebraMap0Builder getBuilderAfterClassName(Map instance) { + return new ZebraMap0Builder(instance); + } + } + + + public sealed interface Zebra1Boxed permits Zebra1BoxedMap { + @Nullable Object getData(); + } + + public record Zebra1BoxedMap(ZebraMap data) implements Zebra1Boxed { + @Override + public @Nullable Object getData() { + return data; + } + } + + + public static class Zebra1 extends JsonSchema implements MapSchemaValidator { + /* + NOTE: This class is auto generated by OpenAPI JSON Schema Generator. + Ref: https://github.com/openapi-json-schema-tools/openapi-json-schema-generator + + Do not edit the class manually. + */ + private static @Nullable Zebra1 instance = null; + + protected Zebra1() { + super(new JsonSchemaInfo() + .type(Set.of(Map.class)) + .properties(Map.ofEntries( + new PropertyEntry("type", Type.class), + new PropertyEntry("className", ClassName.class) + )) + .required(Set.of( + "className" + )) + .additionalProperties(AdditionalProperties.class) + ); + } + + public static Zebra1 getInstance() { + if (instance == null) { + instance = new Zebra1(); + } + return instance; + } + + 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 RuntimeException("Invalid non-string key value"); + } + String propertyName = (String) entryKey; + List propertyPathToItem = new ArrayList<>(pathToItem); + propertyPathToItem.add(propertyName); + Object value = entry.getValue(); + LinkedHashMap, Nothing?> schemas = pathToSchemas.get(propertyPathToItem); + if (schemas == null) { + throw new RuntimeException("Validation result is invalid, schemas must exist for a pathToItem"); + } + JsonSchema propertySchema = schemas.entrySet().iterator().next().getKey(); + @Nullable Object propertyInstance = propertySchema.getNewInstance(value, propertyPathToItem, pathToSchemas); + properties.put(propertyName, propertyInstance); + } + FrozenMap<@Nullable Object> castProperties = new FrozenMap<>(properties); + return new ZebraMap(castProperties); + } + + 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); + SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().build())); + ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, new PathToSchemasMap(), new LinkedHashSet<>()); + PathToSchemasMap pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet); + return getNewInstance(castArg, validationMetadata.pathToItem(), pathToSchemasMap); + } + + + @Override + public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws 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"); + } + @Override + public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { + if (arg instanceof Map) { + return getNewInstance((Map) arg, pathToItem, pathToSchemas); + } + 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 { + return new Zebra1BoxedMap(validate(arg, configuration)); + } + @Override + public Zebra1Boxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { + 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"); + } + } + +} diff --git a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/securityschemes/ApiKey.kt b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/securityschemes/ApiKey.kt new file mode 100644 index 00000000000..201d3a69593 --- /dev/null +++ b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/securityschemes/ApiKey.kt @@ -0,0 +1,12 @@ +package org.openapijsonschematools.client.components.securityschemes; + +import org.openapijsonschematools.client.securityschemes.ApiKeyHeaderSecurityScheme; + +public class ApiKey extends ApiKeyHeaderSecurityScheme { + /* + apiKey in header + */ + public ApiKey(String apiKey) { + super(apiKey, "api_key"); + } +} diff --git a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/securityschemes/ApiKeyQuery.kt b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/securityschemes/ApiKeyQuery.kt new file mode 100644 index 00000000000..2f33bbf5799 --- /dev/null +++ b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/securityschemes/ApiKeyQuery.kt @@ -0,0 +1,12 @@ +package org.openapijsonschematools.client.components.securityschemes; + +import org.openapijsonschematools.client.securityschemes.ApiKeyQuerySecurityScheme; + +public class ApiKeyQuery extends ApiKeyQuerySecurityScheme { + /* + apiKey in query + */ + public ApiKeyQuery(String apiKey) { + super(apiKey, "api_key_query"); + } +} diff --git a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/securityschemes/BearerTest.kt b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/securityschemes/BearerTest.kt new file mode 100644 index 00000000000..9ed5b4700b4 --- /dev/null +++ b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/securityschemes/BearerTest.kt @@ -0,0 +1,12 @@ +package org.openapijsonschematools.client.components.securityschemes; + +import org.openapijsonschematools.client.securityschemes.HttpBearerSecurityScheme; + +public class BearerTest extends HttpBearerSecurityScheme { + /* + http bearer with JWT bearer format + */ + public BearerTest(String accessToken) { + super(accessToken, "JWT"); + } +} diff --git a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/securityschemes/HttpBasicTest.kt b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/securityschemes/HttpBasicTest.kt new file mode 100644 index 00000000000..2e01c07d4a7 --- /dev/null +++ b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/securityschemes/HttpBasicTest.kt @@ -0,0 +1,12 @@ +package org.openapijsonschematools.client.components.securityschemes; + +import org.openapijsonschematools.client.securityschemes.HttpBasicSecurityScheme; + +public class HttpBasicTest extends HttpBasicSecurityScheme { + /* + http basic + */ + public HttpBasicTest(String userId, String password) { + super(userId, password); + } +} diff --git a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/securityschemes/HttpSignatureTest.kt b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/securityschemes/HttpSignatureTest.kt new file mode 100644 index 00000000000..07e6c3ab676 --- /dev/null +++ b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/securityschemes/HttpSignatureTest.kt @@ -0,0 +1,9 @@ +package org.openapijsonschematools.client.components.securityschemes; + +import org.openapijsonschematools.client.securityschemes.HttpSignatureSecurityScheme; + +public class HttpSignatureTest extends HttpSignatureSecurityScheme { + /* + http + signature + */ +} diff --git a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/securityschemes/OpenIdConnectTest.kt b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/securityschemes/OpenIdConnectTest.kt new file mode 100644 index 00000000000..204c2c47cab --- /dev/null +++ b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/securityschemes/OpenIdConnectTest.kt @@ -0,0 +1,9 @@ +package org.openapijsonschematools.client.components.securityschemes; + +import org.openapijsonschematools.client.securityschemes.OpenIdConnectSecurityScheme; + +public class OpenIdConnectTest extends OpenIdConnectSecurityScheme { + /* + openIdConnect + */ +} diff --git a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/securityschemes/PetstoreAuth.kt b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/securityschemes/PetstoreAuth.kt new file mode 100644 index 00000000000..ad84bd017f6 --- /dev/null +++ b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/securityschemes/PetstoreAuth.kt @@ -0,0 +1,10 @@ +package org.openapijsonschematools.client.components.securityschemes; + +import org.openapijsonschematools.client.securityschemes.OAuth2SecurityScheme; + +public class PetstoreAuth extends OAuth2SecurityScheme { + /* + oauth2 implicit flow with two scopes + */ + // todo add flows info +} diff --git a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/configurations/ApiConfiguration.kt b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/configurations/ApiConfiguration.kt new file mode 100644 index 00000000000..30ee3f8d415 --- /dev/null +++ b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/configurations/ApiConfiguration.kt @@ -0,0 +1,500 @@ +package org.openapijsonschematools.client.configurations; + +import org.openapijsonschematools.client.securityrequirementobjects.SecurityRequirementObject; +import org.openapijsonschematools.client.servers.Server; +import org.openapijsonschematools.client.paths.foo.get.FooGetServerInfo; +import org.openapijsonschematools.client.paths.petfindbystatus.PetfindbystatusServerInfo; +import org.openapijsonschematools.client.RootServerInfo; +import org.openapijsonschematools.client.paths.fake.delete.FakeDeleteSecurityInfo; +import org.openapijsonschematools.client.paths.fake.post.FakePostSecurityInfo; +import org.openapijsonschematools.client.paths.fakeclassnametest.patch.FakeclassnametestPatchSecurityInfo; +import org.openapijsonschematools.client.paths.fakemultiplesecurities.get.FakemultiplesecuritiesGetSecurityInfo; +import org.openapijsonschematools.client.paths.fakepetiduploadimagewithrequiredfile.post.FakepetiduploadimagewithrequiredfilePostSecurityInfo; +import org.openapijsonschematools.client.paths.pet.post.PetPostSecurityInfo; +import org.openapijsonschematools.client.paths.pet.put.PetPutSecurityInfo; +import org.openapijsonschematools.client.paths.petfindbystatus.get.PetfindbystatusGetSecurityInfo; +import org.openapijsonschematools.client.paths.petfindbytags.get.PetfindbytagsGetSecurityInfo; +import org.openapijsonschematools.client.paths.petpetid.delete.PetpetidDeleteSecurityInfo; +import org.openapijsonschematools.client.paths.petpetid.get.PetpetidGetSecurityInfo; +import org.openapijsonschematools.client.paths.petpetid.post.PetpetidPostSecurityInfo; +import org.openapijsonschematools.client.paths.petpetiduploadimage.post.PetpetiduploadimagePostSecurityInfo; +import org.openapijsonschematools.client.paths.storeinventory.get.StoreinventoryGetSecurityInfo; +import org.openapijsonschematools.client.securityschemes.SecurityScheme; +import org.checkerframework.checker.nullness.qual.Nullable; + +import java.time.Duration; +import java.util.List; +import java.util.Map; +import java.util.Objects; +import java.util.HashMap; + +public class ApiConfiguration { + private final ServerInfo serverInfo; + private final ServerIndexInfo serverIndexInfo; + private final SecurityInfo securityInfo; + private final SecurityIndexInfo securityIndexInfo; + private final @Nullable Duration timeout; + private final Map, SecurityScheme> securitySchemeInfo; + private final Map> defaultHeaders; + + public ApiConfiguration() { + serverInfo = new ServerInfoBuilder().build(); + serverIndexInfo = new ServerIndexInfoBuilder().build(); + securityInfo = new SecurityInfo(); + securityIndexInfo = new SecurityIndexInfoBuilder().build(); + securitySchemeInfo = new HashMap<>(); + timeout = null; + defaultHeaders = new HashMap<>(); + } + + public ApiConfiguration(ServerInfo serverInfo, ServerIndexInfo serverIndexInfo, List securitySchemes, SecurityIndexInfo securityIndexInfo, Duration timeout, Map> defaultHeaders) { + this.serverInfo = serverInfo; + this.serverIndexInfo = serverIndexInfo; + this.securityInfo = new SecurityInfo(); + this.securityIndexInfo = securityIndexInfo; + securitySchemeInfo = new HashMap<>(); + for (SecurityScheme securityScheme: securitySchemes) { + securitySchemeInfo.put(securityScheme.getClass(), securityScheme); + } + this.timeout = timeout; + this.defaultHeaders = defaultHeaders; + } + + public static class ServerInfo { + final FooGetServerInfo.FooGetServerInfo1 fooGetServerInfo; + final PetfindbystatusServerInfo.PetfindbystatusServerInfo1 petfindbystatusServerInfo; + final RootServerInfo.RootServerInfo1 rootServerInfo; + + ServerInfo( + FooGetServerInfo. @Nullable FooGetServerInfo1 fooGetServerInfo, + PetfindbystatusServerInfo. @Nullable PetfindbystatusServerInfo1 petfindbystatusServerInfo, + RootServerInfo. @Nullable RootServerInfo1 rootServerInfo + ) { + this.fooGetServerInfo = Objects.requireNonNullElse(fooGetServerInfo, new FooGetServerInfo.FooGetServerInfoBuilder().build()); + this.petfindbystatusServerInfo = Objects.requireNonNullElse(petfindbystatusServerInfo, new PetfindbystatusServerInfo.PetfindbystatusServerInfoBuilder().build()); + this.rootServerInfo = Objects.requireNonNullElse(rootServerInfo, new RootServerInfo.RootServerInfoBuilder().build()); + } + } + + public static class ServerInfoBuilder { + private FooGetServerInfo. @Nullable FooGetServerInfo1 fooGetServerInfo; + private PetfindbystatusServerInfo. @Nullable PetfindbystatusServerInfo1 petfindbystatusServerInfo; + private RootServerInfo. @Nullable RootServerInfo1 rootServerInfo; + public ServerInfoBuilder() {} + + public ServerInfoBuilder fooGetServerInfo(FooGetServerInfo.FooGetServerInfo1 fooGetServerInfo) { + this.fooGetServerInfo = fooGetServerInfo; + return this; + } + + public ServerInfoBuilder petfindbystatusServerInfo(PetfindbystatusServerInfo.PetfindbystatusServerInfo1 petfindbystatusServerInfo) { + this.petfindbystatusServerInfo = petfindbystatusServerInfo; + return this; + } + + public ServerInfoBuilder rootServerInfo(RootServerInfo.RootServerInfo1 rootServerInfo) { + this.rootServerInfo = rootServerInfo; + return this; + } + + public ServerInfo build() { + return new ServerInfo( + fooGetServerInfo, + petfindbystatusServerInfo, + rootServerInfo + ); + } + } + + public static class ServerIndexInfo { + final FooGetServerInfo.ServerIndex fooGetServerInfoServerIndex; + final PetfindbystatusServerInfo.ServerIndex petfindbystatusServerInfoServerIndex; + final RootServerInfo.ServerIndex rootServerInfoServerIndex; + + ServerIndexInfo( + FooGetServerInfo. @Nullable ServerIndex fooGetServerInfoServerIndex, + PetfindbystatusServerInfo. @Nullable ServerIndex petfindbystatusServerInfoServerIndex, + RootServerInfo. @Nullable ServerIndex rootServerInfoServerIndex + ) { + this.fooGetServerInfoServerIndex = Objects.requireNonNullElse(fooGetServerInfoServerIndex, FooGetServerInfo.ServerIndex.SERVER_0); + this.petfindbystatusServerInfoServerIndex = Objects.requireNonNullElse(petfindbystatusServerInfoServerIndex, PetfindbystatusServerInfo.ServerIndex.SERVER_0); + this.rootServerInfoServerIndex = Objects.requireNonNullElse(rootServerInfoServerIndex, RootServerInfo.ServerIndex.SERVER_0); + } + } + + public static class ServerIndexInfoBuilder { + private FooGetServerInfo. @Nullable ServerIndex fooGetServerInfoServerIndex; + private PetfindbystatusServerInfo. @Nullable ServerIndex petfindbystatusServerInfoServerIndex; + private RootServerInfo. @Nullable ServerIndex rootServerInfoServerIndex; + public ServerIndexInfoBuilder() {} + + public ServerIndexInfoBuilder fooGetServerInfoServerIndex(FooGetServerInfo.ServerIndex serverIndex) { + this.fooGetServerInfoServerIndex = serverIndex; + return this; + } + + public ServerIndexInfoBuilder petfindbystatusServerInfoServerIndex(PetfindbystatusServerInfo.ServerIndex serverIndex) { + this.petfindbystatusServerInfoServerIndex = serverIndex; + return this; + } + + public ServerIndexInfoBuilder rootServerInfoServerIndex(RootServerInfo.ServerIndex serverIndex) { + this.rootServerInfoServerIndex = serverIndex; + return this; + } + + public ServerIndexInfo build() { + return new ServerIndexInfo( + fooGetServerInfoServerIndex, + petfindbystatusServerInfoServerIndex, + rootServerInfoServerIndex + ); + } + } + + public Server getServer(FooGetServerInfo. @Nullable ServerIndex serverIndex) { + var serverProvider = serverInfo.fooGetServerInfo; + if (serverIndex == null) { + FooGetServerInfo.ServerIndex configServerIndex = serverIndexInfo.fooGetServerInfoServerIndex; + return serverProvider.getServer(configServerIndex); + } + return serverProvider.getServer(serverIndex); + } + + public Server getServer(PetfindbystatusServerInfo. @Nullable ServerIndex serverIndex) { + var serverProvider = serverInfo.petfindbystatusServerInfo; + if (serverIndex == null) { + PetfindbystatusServerInfo.ServerIndex configServerIndex = serverIndexInfo.petfindbystatusServerInfoServerIndex; + return serverProvider.getServer(configServerIndex); + } + return serverProvider.getServer(serverIndex); + } + + public Server getServer(RootServerInfo. @Nullable ServerIndex serverIndex) { + var serverProvider = serverInfo.rootServerInfo; + if (serverIndex == null) { + RootServerInfo.ServerIndex configServerIndex = serverIndexInfo.rootServerInfoServerIndex; + return serverProvider.getServer(configServerIndex); + } + return serverProvider.getServer(serverIndex); + } + + public static class SecurityInfo { + protected final FakeDeleteSecurityInfo.FakeDeleteSecurityInfo1 fakeDeleteSecurityInfo; + protected final FakePostSecurityInfo.FakePostSecurityInfo1 fakePostSecurityInfo; + protected final FakeclassnametestPatchSecurityInfo.FakeclassnametestPatchSecurityInfo1 fakeclassnametestPatchSecurityInfo; + protected final FakemultiplesecuritiesGetSecurityInfo.FakemultiplesecuritiesGetSecurityInfo1 fakemultiplesecuritiesGetSecurityInfo; + protected final FakepetiduploadimagewithrequiredfilePostSecurityInfo.FakepetiduploadimagewithrequiredfilePostSecurityInfo1 fakepetiduploadimagewithrequiredfilePostSecurityInfo; + protected final PetPostSecurityInfo.PetPostSecurityInfo1 petPostSecurityInfo; + protected final PetPutSecurityInfo.PetPutSecurityInfo1 petPutSecurityInfo; + protected final PetfindbystatusGetSecurityInfo.PetfindbystatusGetSecurityInfo1 petfindbystatusGetSecurityInfo; + protected final PetfindbytagsGetSecurityInfo.PetfindbytagsGetSecurityInfo1 petfindbytagsGetSecurityInfo; + protected final PetpetidDeleteSecurityInfo.PetpetidDeleteSecurityInfo1 petpetidDeleteSecurityInfo; + protected final PetpetidGetSecurityInfo.PetpetidGetSecurityInfo1 petpetidGetSecurityInfo; + protected final PetpetidPostSecurityInfo.PetpetidPostSecurityInfo1 petpetidPostSecurityInfo; + protected final PetpetiduploadimagePostSecurityInfo.PetpetiduploadimagePostSecurityInfo1 petpetiduploadimagePostSecurityInfo; + protected final StoreinventoryGetSecurityInfo.StoreinventoryGetSecurityInfo1 storeinventoryGetSecurityInfo; + + public SecurityInfo() { + this.fakeDeleteSecurityInfo = new FakeDeleteSecurityInfo.FakeDeleteSecurityInfo1(); + this.fakePostSecurityInfo = new FakePostSecurityInfo.FakePostSecurityInfo1(); + this.fakeclassnametestPatchSecurityInfo = new FakeclassnametestPatchSecurityInfo.FakeclassnametestPatchSecurityInfo1(); + this.fakemultiplesecuritiesGetSecurityInfo = new FakemultiplesecuritiesGetSecurityInfo.FakemultiplesecuritiesGetSecurityInfo1(); + this.fakepetiduploadimagewithrequiredfilePostSecurityInfo = new FakepetiduploadimagewithrequiredfilePostSecurityInfo.FakepetiduploadimagewithrequiredfilePostSecurityInfo1(); + this.petPostSecurityInfo = new PetPostSecurityInfo.PetPostSecurityInfo1(); + this.petPutSecurityInfo = new PetPutSecurityInfo.PetPutSecurityInfo1(); + this.petfindbystatusGetSecurityInfo = new PetfindbystatusGetSecurityInfo.PetfindbystatusGetSecurityInfo1(); + this.petfindbytagsGetSecurityInfo = new PetfindbytagsGetSecurityInfo.PetfindbytagsGetSecurityInfo1(); + this.petpetidDeleteSecurityInfo = new PetpetidDeleteSecurityInfo.PetpetidDeleteSecurityInfo1(); + this.petpetidGetSecurityInfo = new PetpetidGetSecurityInfo.PetpetidGetSecurityInfo1(); + this.petpetidPostSecurityInfo = new PetpetidPostSecurityInfo.PetpetidPostSecurityInfo1(); + this.petpetiduploadimagePostSecurityInfo = new PetpetiduploadimagePostSecurityInfo.PetpetiduploadimagePostSecurityInfo1(); + this.storeinventoryGetSecurityInfo = new StoreinventoryGetSecurityInfo.StoreinventoryGetSecurityInfo1(); + } + } + + public static class SecurityIndexInfo { + final FakeDeleteSecurityInfo.SecurityIndex fakeDeleteSecurityInfoSecurityIndex; + final FakePostSecurityInfo.SecurityIndex fakePostSecurityInfoSecurityIndex; + final FakeclassnametestPatchSecurityInfo.SecurityIndex fakeclassnametestPatchSecurityInfoSecurityIndex; + final FakemultiplesecuritiesGetSecurityInfo.SecurityIndex fakemultiplesecuritiesGetSecurityInfoSecurityIndex; + final FakepetiduploadimagewithrequiredfilePostSecurityInfo.SecurityIndex fakepetiduploadimagewithrequiredfilePostSecurityInfoSecurityIndex; + final PetPostSecurityInfo.SecurityIndex petPostSecurityInfoSecurityIndex; + final PetPutSecurityInfo.SecurityIndex petPutSecurityInfoSecurityIndex; + final PetfindbystatusGetSecurityInfo.SecurityIndex petfindbystatusGetSecurityInfoSecurityIndex; + final PetfindbytagsGetSecurityInfo.SecurityIndex petfindbytagsGetSecurityInfoSecurityIndex; + final PetpetidDeleteSecurityInfo.SecurityIndex petpetidDeleteSecurityInfoSecurityIndex; + final PetpetidGetSecurityInfo.SecurityIndex petpetidGetSecurityInfoSecurityIndex; + final PetpetidPostSecurityInfo.SecurityIndex petpetidPostSecurityInfoSecurityIndex; + final PetpetiduploadimagePostSecurityInfo.SecurityIndex petpetiduploadimagePostSecurityInfoSecurityIndex; + final StoreinventoryGetSecurityInfo.SecurityIndex storeinventoryGetSecurityInfoSecurityIndex; + + SecurityIndexInfo( + FakeDeleteSecurityInfo. @Nullable SecurityIndex fakeDeleteSecurityInfoSecurityIndex, + FakePostSecurityInfo. @Nullable SecurityIndex fakePostSecurityInfoSecurityIndex, + FakeclassnametestPatchSecurityInfo. @Nullable SecurityIndex fakeclassnametestPatchSecurityInfoSecurityIndex, + FakemultiplesecuritiesGetSecurityInfo. @Nullable SecurityIndex fakemultiplesecuritiesGetSecurityInfoSecurityIndex, + FakepetiduploadimagewithrequiredfilePostSecurityInfo. @Nullable SecurityIndex fakepetiduploadimagewithrequiredfilePostSecurityInfoSecurityIndex, + PetPostSecurityInfo. @Nullable SecurityIndex petPostSecurityInfoSecurityIndex, + PetPutSecurityInfo. @Nullable SecurityIndex petPutSecurityInfoSecurityIndex, + PetfindbystatusGetSecurityInfo. @Nullable SecurityIndex petfindbystatusGetSecurityInfoSecurityIndex, + PetfindbytagsGetSecurityInfo. @Nullable SecurityIndex petfindbytagsGetSecurityInfoSecurityIndex, + PetpetidDeleteSecurityInfo. @Nullable SecurityIndex petpetidDeleteSecurityInfoSecurityIndex, + PetpetidGetSecurityInfo. @Nullable SecurityIndex petpetidGetSecurityInfoSecurityIndex, + PetpetidPostSecurityInfo. @Nullable SecurityIndex petpetidPostSecurityInfoSecurityIndex, + PetpetiduploadimagePostSecurityInfo. @Nullable SecurityIndex petpetiduploadimagePostSecurityInfoSecurityIndex, + StoreinventoryGetSecurityInfo. @Nullable SecurityIndex storeinventoryGetSecurityInfoSecurityIndex + ) { + this.fakeDeleteSecurityInfoSecurityIndex = Objects.requireNonNullElse(fakeDeleteSecurityInfoSecurityIndex, FakeDeleteSecurityInfo.SecurityIndex.SECURITY_0); + this.fakePostSecurityInfoSecurityIndex = Objects.requireNonNullElse(fakePostSecurityInfoSecurityIndex, FakePostSecurityInfo.SecurityIndex.SECURITY_0); + this.fakeclassnametestPatchSecurityInfoSecurityIndex = Objects.requireNonNullElse(fakeclassnametestPatchSecurityInfoSecurityIndex, FakeclassnametestPatchSecurityInfo.SecurityIndex.SECURITY_0); + this.fakemultiplesecuritiesGetSecurityInfoSecurityIndex = Objects.requireNonNullElse(fakemultiplesecuritiesGetSecurityInfoSecurityIndex, FakemultiplesecuritiesGetSecurityInfo.SecurityIndex.SECURITY_0); + this.fakepetiduploadimagewithrequiredfilePostSecurityInfoSecurityIndex = Objects.requireNonNullElse(fakepetiduploadimagewithrequiredfilePostSecurityInfoSecurityIndex, FakepetiduploadimagewithrequiredfilePostSecurityInfo.SecurityIndex.SECURITY_0); + this.petPostSecurityInfoSecurityIndex = Objects.requireNonNullElse(petPostSecurityInfoSecurityIndex, PetPostSecurityInfo.SecurityIndex.SECURITY_0); + this.petPutSecurityInfoSecurityIndex = Objects.requireNonNullElse(petPutSecurityInfoSecurityIndex, PetPutSecurityInfo.SecurityIndex.SECURITY_0); + this.petfindbystatusGetSecurityInfoSecurityIndex = Objects.requireNonNullElse(petfindbystatusGetSecurityInfoSecurityIndex, PetfindbystatusGetSecurityInfo.SecurityIndex.SECURITY_0); + this.petfindbytagsGetSecurityInfoSecurityIndex = Objects.requireNonNullElse(petfindbytagsGetSecurityInfoSecurityIndex, PetfindbytagsGetSecurityInfo.SecurityIndex.SECURITY_0); + this.petpetidDeleteSecurityInfoSecurityIndex = Objects.requireNonNullElse(petpetidDeleteSecurityInfoSecurityIndex, PetpetidDeleteSecurityInfo.SecurityIndex.SECURITY_0); + this.petpetidGetSecurityInfoSecurityIndex = Objects.requireNonNullElse(petpetidGetSecurityInfoSecurityIndex, PetpetidGetSecurityInfo.SecurityIndex.SECURITY_0); + this.petpetidPostSecurityInfoSecurityIndex = Objects.requireNonNullElse(petpetidPostSecurityInfoSecurityIndex, PetpetidPostSecurityInfo.SecurityIndex.SECURITY_0); + this.petpetiduploadimagePostSecurityInfoSecurityIndex = Objects.requireNonNullElse(petpetiduploadimagePostSecurityInfoSecurityIndex, PetpetiduploadimagePostSecurityInfo.SecurityIndex.SECURITY_0); + this.storeinventoryGetSecurityInfoSecurityIndex = Objects.requireNonNullElse(storeinventoryGetSecurityInfoSecurityIndex, StoreinventoryGetSecurityInfo.SecurityIndex.SECURITY_0); + } + } + + public static class SecurityIndexInfoBuilder { + private FakeDeleteSecurityInfo. @Nullable SecurityIndex fakeDeleteSecurityInfoSecurityIndex; + private FakePostSecurityInfo. @Nullable SecurityIndex fakePostSecurityInfoSecurityIndex; + private FakeclassnametestPatchSecurityInfo. @Nullable SecurityIndex fakeclassnametestPatchSecurityInfoSecurityIndex; + private FakemultiplesecuritiesGetSecurityInfo. @Nullable SecurityIndex fakemultiplesecuritiesGetSecurityInfoSecurityIndex; + private FakepetiduploadimagewithrequiredfilePostSecurityInfo. @Nullable SecurityIndex fakepetiduploadimagewithrequiredfilePostSecurityInfoSecurityIndex; + private PetPostSecurityInfo. @Nullable SecurityIndex petPostSecurityInfoSecurityIndex; + private PetPutSecurityInfo. @Nullable SecurityIndex petPutSecurityInfoSecurityIndex; + private PetfindbystatusGetSecurityInfo. @Nullable SecurityIndex petfindbystatusGetSecurityInfoSecurityIndex; + private PetfindbytagsGetSecurityInfo. @Nullable SecurityIndex petfindbytagsGetSecurityInfoSecurityIndex; + private PetpetidDeleteSecurityInfo. @Nullable SecurityIndex petpetidDeleteSecurityInfoSecurityIndex; + private PetpetidGetSecurityInfo. @Nullable SecurityIndex petpetidGetSecurityInfoSecurityIndex; + private PetpetidPostSecurityInfo. @Nullable SecurityIndex petpetidPostSecurityInfoSecurityIndex; + private PetpetiduploadimagePostSecurityInfo. @Nullable SecurityIndex petpetiduploadimagePostSecurityInfoSecurityIndex; + private StoreinventoryGetSecurityInfo. @Nullable SecurityIndex storeinventoryGetSecurityInfoSecurityIndex; + public SecurityIndexInfoBuilder() {} + + public SecurityIndexInfoBuilder fakeDeleteSecurityInfoSecurityIndex(FakeDeleteSecurityInfo.SecurityIndex securityIndex) { + this.fakeDeleteSecurityInfoSecurityIndex = securityIndex; + return this; + } + + public SecurityIndexInfoBuilder fakePostSecurityInfoSecurityIndex(FakePostSecurityInfo.SecurityIndex securityIndex) { + this.fakePostSecurityInfoSecurityIndex = securityIndex; + return this; + } + + public SecurityIndexInfoBuilder fakeclassnametestPatchSecurityInfoSecurityIndex(FakeclassnametestPatchSecurityInfo.SecurityIndex securityIndex) { + this.fakeclassnametestPatchSecurityInfoSecurityIndex = securityIndex; + return this; + } + + public SecurityIndexInfoBuilder fakemultiplesecuritiesGetSecurityInfoSecurityIndex(FakemultiplesecuritiesGetSecurityInfo.SecurityIndex securityIndex) { + this.fakemultiplesecuritiesGetSecurityInfoSecurityIndex = securityIndex; + return this; + } + + public SecurityIndexInfoBuilder fakepetiduploadimagewithrequiredfilePostSecurityInfoSecurityIndex(FakepetiduploadimagewithrequiredfilePostSecurityInfo.SecurityIndex securityIndex) { + this.fakepetiduploadimagewithrequiredfilePostSecurityInfoSecurityIndex = securityIndex; + return this; + } + + public SecurityIndexInfoBuilder petPostSecurityInfoSecurityIndex(PetPostSecurityInfo.SecurityIndex securityIndex) { + this.petPostSecurityInfoSecurityIndex = securityIndex; + return this; + } + + public SecurityIndexInfoBuilder petPutSecurityInfoSecurityIndex(PetPutSecurityInfo.SecurityIndex securityIndex) { + this.petPutSecurityInfoSecurityIndex = securityIndex; + return this; + } + + public SecurityIndexInfoBuilder petfindbystatusGetSecurityInfoSecurityIndex(PetfindbystatusGetSecurityInfo.SecurityIndex securityIndex) { + this.petfindbystatusGetSecurityInfoSecurityIndex = securityIndex; + return this; + } + + public SecurityIndexInfoBuilder petfindbytagsGetSecurityInfoSecurityIndex(PetfindbytagsGetSecurityInfo.SecurityIndex securityIndex) { + this.petfindbytagsGetSecurityInfoSecurityIndex = securityIndex; + return this; + } + + public SecurityIndexInfoBuilder petpetidDeleteSecurityInfoSecurityIndex(PetpetidDeleteSecurityInfo.SecurityIndex securityIndex) { + this.petpetidDeleteSecurityInfoSecurityIndex = securityIndex; + return this; + } + + public SecurityIndexInfoBuilder petpetidGetSecurityInfoSecurityIndex(PetpetidGetSecurityInfo.SecurityIndex securityIndex) { + this.petpetidGetSecurityInfoSecurityIndex = securityIndex; + return this; + } + + public SecurityIndexInfoBuilder petpetidPostSecurityInfoSecurityIndex(PetpetidPostSecurityInfo.SecurityIndex securityIndex) { + this.petpetidPostSecurityInfoSecurityIndex = securityIndex; + return this; + } + + public SecurityIndexInfoBuilder petpetiduploadimagePostSecurityInfoSecurityIndex(PetpetiduploadimagePostSecurityInfo.SecurityIndex securityIndex) { + this.petpetiduploadimagePostSecurityInfoSecurityIndex = securityIndex; + return this; + } + + public SecurityIndexInfoBuilder storeinventoryGetSecurityInfoSecurityIndex(StoreinventoryGetSecurityInfo.SecurityIndex securityIndex) { + this.storeinventoryGetSecurityInfoSecurityIndex = securityIndex; + return this; + } + + public SecurityIndexInfo build() { + return new SecurityIndexInfo( + fakeDeleteSecurityInfoSecurityIndex, + fakePostSecurityInfoSecurityIndex, + fakeclassnametestPatchSecurityInfoSecurityIndex, + fakemultiplesecuritiesGetSecurityInfoSecurityIndex, + fakepetiduploadimagewithrequiredfilePostSecurityInfoSecurityIndex, + petPostSecurityInfoSecurityIndex, + petPutSecurityInfoSecurityIndex, + petfindbystatusGetSecurityInfoSecurityIndex, + petfindbytagsGetSecurityInfoSecurityIndex, + petpetidDeleteSecurityInfoSecurityIndex, + petpetidGetSecurityInfoSecurityIndex, + petpetidPostSecurityInfoSecurityIndex, + petpetiduploadimagePostSecurityInfoSecurityIndex, + storeinventoryGetSecurityInfoSecurityIndex + ); + } + } + + public SecurityRequirementObject getSecurityRequirementObject(FakeDeleteSecurityInfo. @Nullable SecurityIndex securityIndex) { + var securityInfoInstance = securityInfo.fakeDeleteSecurityInfo; + if (securityIndex == null) { + FakeDeleteSecurityInfo.SecurityIndex configSecurityIndex = securityIndexInfo.fakeDeleteSecurityInfoSecurityIndex; + return securityInfoInstance.getSecurityRequirementObject(configSecurityIndex); + } + return securityInfoInstance.getSecurityRequirementObject(securityIndex); + } + public SecurityRequirementObject getSecurityRequirementObject(FakePostSecurityInfo. @Nullable SecurityIndex securityIndex) { + var securityInfoInstance = securityInfo.fakePostSecurityInfo; + if (securityIndex == null) { + FakePostSecurityInfo.SecurityIndex configSecurityIndex = securityIndexInfo.fakePostSecurityInfoSecurityIndex; + return securityInfoInstance.getSecurityRequirementObject(configSecurityIndex); + } + return securityInfoInstance.getSecurityRequirementObject(securityIndex); + } + public SecurityRequirementObject getSecurityRequirementObject(FakeclassnametestPatchSecurityInfo. @Nullable SecurityIndex securityIndex) { + var securityInfoInstance = securityInfo.fakeclassnametestPatchSecurityInfo; + if (securityIndex == null) { + FakeclassnametestPatchSecurityInfo.SecurityIndex configSecurityIndex = securityIndexInfo.fakeclassnametestPatchSecurityInfoSecurityIndex; + return securityInfoInstance.getSecurityRequirementObject(configSecurityIndex); + } + return securityInfoInstance.getSecurityRequirementObject(securityIndex); + } + public SecurityRequirementObject getSecurityRequirementObject(FakemultiplesecuritiesGetSecurityInfo. @Nullable SecurityIndex securityIndex) { + var securityInfoInstance = securityInfo.fakemultiplesecuritiesGetSecurityInfo; + if (securityIndex == null) { + FakemultiplesecuritiesGetSecurityInfo.SecurityIndex configSecurityIndex = securityIndexInfo.fakemultiplesecuritiesGetSecurityInfoSecurityIndex; + return securityInfoInstance.getSecurityRequirementObject(configSecurityIndex); + } + return securityInfoInstance.getSecurityRequirementObject(securityIndex); + } + public SecurityRequirementObject getSecurityRequirementObject(FakepetiduploadimagewithrequiredfilePostSecurityInfo. @Nullable SecurityIndex securityIndex) { + var securityInfoInstance = securityInfo.fakepetiduploadimagewithrequiredfilePostSecurityInfo; + if (securityIndex == null) { + FakepetiduploadimagewithrequiredfilePostSecurityInfo.SecurityIndex configSecurityIndex = securityIndexInfo.fakepetiduploadimagewithrequiredfilePostSecurityInfoSecurityIndex; + return securityInfoInstance.getSecurityRequirementObject(configSecurityIndex); + } + return securityInfoInstance.getSecurityRequirementObject(securityIndex); + } + public SecurityRequirementObject getSecurityRequirementObject(PetPostSecurityInfo. @Nullable SecurityIndex securityIndex) { + var securityInfoInstance = securityInfo.petPostSecurityInfo; + if (securityIndex == null) { + PetPostSecurityInfo.SecurityIndex configSecurityIndex = securityIndexInfo.petPostSecurityInfoSecurityIndex; + return securityInfoInstance.getSecurityRequirementObject(configSecurityIndex); + } + return securityInfoInstance.getSecurityRequirementObject(securityIndex); + } + public SecurityRequirementObject getSecurityRequirementObject(PetPutSecurityInfo. @Nullable SecurityIndex securityIndex) { + var securityInfoInstance = securityInfo.petPutSecurityInfo; + if (securityIndex == null) { + PetPutSecurityInfo.SecurityIndex configSecurityIndex = securityIndexInfo.petPutSecurityInfoSecurityIndex; + return securityInfoInstance.getSecurityRequirementObject(configSecurityIndex); + } + return securityInfoInstance.getSecurityRequirementObject(securityIndex); + } + public SecurityRequirementObject getSecurityRequirementObject(PetfindbystatusGetSecurityInfo. @Nullable SecurityIndex securityIndex) { + var securityInfoInstance = securityInfo.petfindbystatusGetSecurityInfo; + if (securityIndex == null) { + PetfindbystatusGetSecurityInfo.SecurityIndex configSecurityIndex = securityIndexInfo.petfindbystatusGetSecurityInfoSecurityIndex; + return securityInfoInstance.getSecurityRequirementObject(configSecurityIndex); + } + return securityInfoInstance.getSecurityRequirementObject(securityIndex); + } + public SecurityRequirementObject getSecurityRequirementObject(PetfindbytagsGetSecurityInfo. @Nullable SecurityIndex securityIndex) { + var securityInfoInstance = securityInfo.petfindbytagsGetSecurityInfo; + if (securityIndex == null) { + PetfindbytagsGetSecurityInfo.SecurityIndex configSecurityIndex = securityIndexInfo.petfindbytagsGetSecurityInfoSecurityIndex; + return securityInfoInstance.getSecurityRequirementObject(configSecurityIndex); + } + return securityInfoInstance.getSecurityRequirementObject(securityIndex); + } + public SecurityRequirementObject getSecurityRequirementObject(PetpetidDeleteSecurityInfo. @Nullable SecurityIndex securityIndex) { + var securityInfoInstance = securityInfo.petpetidDeleteSecurityInfo; + if (securityIndex == null) { + PetpetidDeleteSecurityInfo.SecurityIndex configSecurityIndex = securityIndexInfo.petpetidDeleteSecurityInfoSecurityIndex; + return securityInfoInstance.getSecurityRequirementObject(configSecurityIndex); + } + return securityInfoInstance.getSecurityRequirementObject(securityIndex); + } + public SecurityRequirementObject getSecurityRequirementObject(PetpetidGetSecurityInfo. @Nullable SecurityIndex securityIndex) { + var securityInfoInstance = securityInfo.petpetidGetSecurityInfo; + if (securityIndex == null) { + PetpetidGetSecurityInfo.SecurityIndex configSecurityIndex = securityIndexInfo.petpetidGetSecurityInfoSecurityIndex; + return securityInfoInstance.getSecurityRequirementObject(configSecurityIndex); + } + return securityInfoInstance.getSecurityRequirementObject(securityIndex); + } + public SecurityRequirementObject getSecurityRequirementObject(PetpetidPostSecurityInfo. @Nullable SecurityIndex securityIndex) { + var securityInfoInstance = securityInfo.petpetidPostSecurityInfo; + if (securityIndex == null) { + PetpetidPostSecurityInfo.SecurityIndex configSecurityIndex = securityIndexInfo.petpetidPostSecurityInfoSecurityIndex; + return securityInfoInstance.getSecurityRequirementObject(configSecurityIndex); + } + return securityInfoInstance.getSecurityRequirementObject(securityIndex); + } + public SecurityRequirementObject getSecurityRequirementObject(PetpetiduploadimagePostSecurityInfo. @Nullable SecurityIndex securityIndex) { + var securityInfoInstance = securityInfo.petpetiduploadimagePostSecurityInfo; + if (securityIndex == null) { + PetpetiduploadimagePostSecurityInfo.SecurityIndex configSecurityIndex = securityIndexInfo.petpetiduploadimagePostSecurityInfoSecurityIndex; + return securityInfoInstance.getSecurityRequirementObject(configSecurityIndex); + } + return securityInfoInstance.getSecurityRequirementObject(securityIndex); + } + public SecurityRequirementObject getSecurityRequirementObject(StoreinventoryGetSecurityInfo. @Nullable SecurityIndex securityIndex) { + var securityInfoInstance = securityInfo.storeinventoryGetSecurityInfo; + if (securityIndex == null) { + StoreinventoryGetSecurityInfo.SecurityIndex configSecurityIndex = securityIndexInfo.storeinventoryGetSecurityInfoSecurityIndex; + return securityInfoInstance.getSecurityRequirementObject(configSecurityIndex); + } + return securityInfoInstance.getSecurityRequirementObject(securityIndex); + } + + public SecurityScheme getSecurityScheme(Class securitySchemeClass) { + @Nullable SecurityScheme securityScheme = securitySchemeInfo.get(securitySchemeClass); + if (securityScheme == null) { + throw new RuntimeException("SecurityScheme of class " + securitySchemeClass + "cannot be returned because it is unset. Pass in an instance of it in securitySchemes when instantiating ApiConfiguration."); + } + return securityScheme; + } + + public Map> getDefaultHeaders() { + return defaultHeaders; + } + + public @Nullable Duration getTimeout() { + return timeout; + } +} \ No newline at end of file diff --git a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/configurations/JsonSchemaKeywordFlags.kt b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/configurations/JsonSchemaKeywordFlags.kt new file mode 100644 index 00000000000..1223c57764c --- /dev/null +++ b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/configurations/JsonSchemaKeywordFlags.kt @@ -0,0 +1,334 @@ +package org.openapijsonschematools.client.configurations; + +import java.util.LinkedHashSet; + +public record JsonSchemaKeywordFlags( + boolean additionalProperties, + boolean allOf, + boolean anyOf, + boolean const_, + boolean contains, + boolean dependentRequired, + boolean dependentSchemas, + boolean discriminator, + boolean else_, + boolean enum_, + boolean exclusiveMaximum, + boolean exclusiveMinimum, + boolean format, + boolean if_, + boolean maximum, + boolean minimum, + boolean items, + boolean maxContains, + boolean maxItems, + boolean maxLength, + boolean maxProperties, + boolean minContains, + boolean minItems, + boolean minLength, + boolean minProperties, + boolean multipleOf, + boolean not, + boolean oneOf, + boolean pattern, + boolean patternProperties, + boolean prefixItems, + boolean properties, + boolean propertyNames, + boolean required, + boolean then, + boolean type, + boolean uniqueItems, + boolean unevaluatedItems, + boolean unevaluatedProperties + ) { + + public LinkedHashSet getKeywords() { + LinkedHashSet enabledKeywords = new LinkedHashSet<>(); + if (additionalProperties) { enabledKeywords.add("additionalProperties"); } + if (allOf) { enabledKeywords.add("allOf"); } + if (anyOf) { enabledKeywords.add("anyOf"); } + if (const_) { enabledKeywords.add("const"); } + if (contains) { enabledKeywords.add("contains"); } + if (dependentRequired) { enabledKeywords.add("dependentRequired"); } + if (dependentSchemas) { enabledKeywords.add("dependentSchemas"); } + if (discriminator) { enabledKeywords.add("discriminator"); } + if (else_) { enabledKeywords.add("else_"); } + if (enum_) { enabledKeywords.add("enum_"); } + if (exclusiveMaximum) { enabledKeywords.add("exclusiveMaximum"); } + if (exclusiveMinimum) { enabledKeywords.add("exclusiveMinimum"); } + if (format) { enabledKeywords.add("format"); } + if (if_) { enabledKeywords.add("if_"); } + if (maximum) { enabledKeywords.add("maximum"); } + if (minimum) { enabledKeywords.add("minimum"); } + if (items) { enabledKeywords.add("items"); } + if (maxContains) { enabledKeywords.add("maxContains"); } + if (maxItems) { enabledKeywords.add("maxItems"); } + if (maxLength) { enabledKeywords.add("maxLength"); } + if (maxProperties) { enabledKeywords.add("maxProperties"); } + if (minContains) { enabledKeywords.add("minContains"); } + if (minItems) { enabledKeywords.add("minItems"); } + if (minLength) { enabledKeywords.add("minLength"); } + if (minProperties) { enabledKeywords.add("minProperties"); } + if (multipleOf) { enabledKeywords.add("multipleOf"); } + if (not) { enabledKeywords.add("not"); } + if (oneOf) { enabledKeywords.add("oneOf"); } + if (pattern) { enabledKeywords.add("pattern"); } + if (patternProperties) { enabledKeywords.add("patternProperties"); } + if (prefixItems) { enabledKeywords.add("prefixItems"); } + if (properties) { enabledKeywords.add("properties"); } + if (propertyNames) { enabledKeywords.add("propertyNames"); } + if (required) { enabledKeywords.add("required"); } + if (then) { enabledKeywords.add("then"); } + if (type) { enabledKeywords.add("type"); } + if (uniqueItems) { enabledKeywords.add("uniqueItems"); } + if (unevaluatedItems) { enabledKeywords.add("unevaluatedItems"); } + if (unevaluatedProperties) { enabledKeywords.add("unevaluatedProperties"); } + return enabledKeywords; + } + + public static class Builder { + private boolean additionalProperties; + private boolean allOf; + private boolean anyOf; + private boolean const_; + private boolean contains; + private boolean dependentRequired; + private boolean dependentSchemas; + private boolean discriminator; + private boolean else_; + private boolean enum_; + private boolean exclusiveMaximum; + private boolean exclusiveMinimum; + private boolean format; + private boolean if_; + private boolean maximum; + private boolean minimum; + private boolean items; + private boolean maxContains; + private boolean maxItems; + private boolean maxLength; + private boolean maxProperties; + private boolean minContains; + private boolean minItems; + private boolean minLength; + private boolean minProperties; + private boolean multipleOf; + private boolean not; + private boolean oneOf; + private boolean pattern; + private boolean patternProperties; + private boolean prefixItems; + private boolean properties; + private boolean propertyNames; + private boolean required; + private boolean then; + private boolean type; + private boolean uniqueItems; + private boolean unevaluatedItems; + private boolean unevaluatedProperties; + + public Builder() {} + + public Builder additionalProperties() { + additionalProperties = true; + return this; + } + public Builder allOf() { + allOf = true; + return this; + } + public Builder anyOf() { + anyOf = true; + return this; + } + public Builder const_() { + const_ = true; + return this; + } + public Builder contains() { + contains = true; + return this; + } + public Builder dependentRequired() { + dependentRequired = true; + return this; + } + public Builder dependentSchemas() { + dependentSchemas = true; + return this; + } + public Builder discriminator() { + discriminator = true; + return this; + } + public Builder else_() { + else_ = true; + return this; + } + public Builder enum_() { + enum_ = true; + return this; + } + public Builder exclusiveMaximum() { + exclusiveMaximum = true; + return this; + } + public Builder exclusiveMinimum() { + exclusiveMinimum = true; + return this; + } + public Builder format() { + format = true; + return this; + } + public Builder if_() { + if_ = true; + return this; + } + public Builder maximum() { + maximum = true; + return this; + } + public Builder minimum() { + minimum = true; + return this; + } + public Builder items() { + items = true; + return this; + } + public Builder maxContains() { + maxContains = true; + return this; + } + public Builder maxItems() { + maxItems = true; + return this; + } + public Builder maxLength() { + maxLength = true; + return this; + } + public Builder maxProperties() { + maxProperties = true; + return this; + } + public Builder minContains() { + minContains = true; + return this; + } + public Builder minItems() { + minItems = true; + return this; + } + public Builder minLength() { + minLength = true; + return this; + } + public Builder minProperties() { + minProperties = true; + return this; + } + public Builder multipleOf() { + multipleOf = true; + return this; + } + public Builder not() { + not = true; + return this; + } + public Builder oneOf() { + oneOf = true; + return this; + } + public Builder pattern() { + pattern = true; + return this; + } + public Builder patternProperties() { + patternProperties = true; + return this; + } + public Builder prefixItems() { + prefixItems = true; + return this; + } + public Builder properties() { + properties = true; + return this; + } + public Builder propertyNames() { + propertyNames = true; + return this; + } + public Builder required() { + required = true; + return this; + } + public Builder then() { + then = true; + return this; + } + public Builder type() { + type = true; + return this; + } + public Builder uniqueItems() { + uniqueItems = true; + return this; + } + public Builder unevaluatedItems() { + unevaluatedItems = true; + return this; + } + public Builder unevaluatedProperties() { + unevaluatedProperties = true; + return this; + } + public JsonSchemaKeywordFlags build() { + return new JsonSchemaKeywordFlags( + additionalProperties, + allOf, + anyOf, + const_, + contains, + dependentRequired, + dependentSchemas, + discriminator, + else_, + enum_, + exclusiveMaximum, + exclusiveMinimum, + format, + if_, + maximum, + minimum, + items, + maxContains, + maxItems, + maxLength, + maxProperties, + minContains, + minItems, + minLength, + minProperties, + multipleOf, + not, + oneOf, + pattern, + patternProperties, + prefixItems, + properties, + propertyNames, + required, + then, + type, + uniqueItems, + unevaluatedItems, + unevaluatedProperties + ); + } + } +} \ No newline at end of file diff --git a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/configurations/SchemaConfiguration.kt b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/configurations/SchemaConfiguration.kt new file mode 100644 index 00000000000..964a88d900a --- /dev/null +++ b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/configurations/SchemaConfiguration.kt @@ -0,0 +1,4 @@ +package org.openapijsonschematools.client.configurations; + +public record SchemaConfiguration(JsonSchemaKeywordFlags disabledKeywordFlags) { +} \ No newline at end of file diff --git a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/contenttype/ContentTypeDeserializer.kt b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/contenttype/ContentTypeDeserializer.kt new file mode 100644 index 00000000000..f9ef315ea84 --- /dev/null +++ b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/contenttype/ContentTypeDeserializer.kt @@ -0,0 +1,18 @@ +package org.openapijsonschematools.client.contenttype; + +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.ToNumberPolicy; +import org.checkerframework.checker.nullness.qual.Nullable; + +public class ContentTypeDeserializer { + private static final Gson gson = new GsonBuilder() + .setObjectToNumberStrategy(ToNumberPolicy.LONG_OR_DOUBLE) + .setNumberToNumberStrategy(ToNumberPolicy.LONG_OR_DOUBLE) + .create(); + + @SuppressWarnings("nullness") + public static @Nullable Object fromJson(String json) { + return gson.fromJson(json, Object.class); + } +} diff --git a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/contenttype/ContentTypeDetector.kt b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/contenttype/ContentTypeDetector.kt new file mode 100644 index 00000000000..6625c193f6a --- /dev/null +++ b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/contenttype/ContentTypeDetector.kt @@ -0,0 +1,18 @@ +package org.openapijsonschematools.client.contenttype; + +import java.util.regex.Pattern; + +public class ContentTypeDetector { + private static final Pattern jsonContentTypePattern = Pattern.compile( + "application/[^+]*[+]?(json);?.*" + ); + private static final String textPlainContentType = "text/plain"; + + public static boolean contentTypeIsJson(String contentType) { + return jsonContentTypePattern.matcher(contentType).find(); + } + + public static boolean contentTypeIsTextPlain(String contentType) { + return textPlainContentType.equals(contentType); + } +} \ No newline at end of file diff --git a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/contenttype/ContentTypeSerializer.kt b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/contenttype/ContentTypeSerializer.kt new file mode 100644 index 00000000000..51bcdeeddaf --- /dev/null +++ b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/contenttype/ContentTypeSerializer.kt @@ -0,0 +1,18 @@ +package org.openapijsonschematools.client.contenttype; + +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.ToNumberPolicy; +import org.checkerframework.checker.nullness.qual.Nullable; + +public class ContentTypeSerializer { + private static final Gson gson = new GsonBuilder() + .setObjectToNumberStrategy(ToNumberPolicy.LONG_OR_DOUBLE) + .setNumberToNumberStrategy(ToNumberPolicy.LONG_OR_DOUBLE) + .create(); + + @SuppressWarnings("nullness") + public static String toJson(@Nullable Object body) { + return gson.toJson(body); + } +} diff --git a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/exceptions/ApiException.kt b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/exceptions/ApiException.kt new file mode 100644 index 00000000000..d308d4b90a1 --- /dev/null +++ b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/exceptions/ApiException.kt @@ -0,0 +1,13 @@ +package org.openapijsonschematools.client.exceptions; + +import java.net.http.HttpResponse; + +@SuppressWarnings("serial") +public class ApiException extends BaseException { + public HttpResponse response; + + public ApiException(String s, HttpResponse response) { + super(s); + this.response = response; + } +} \ No newline at end of file diff --git a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/exceptions/BaseException.kt b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/exceptions/BaseException.kt new file mode 100644 index 00000000000..268e9373289 --- /dev/null +++ b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/exceptions/BaseException.kt @@ -0,0 +1,8 @@ +package org.openapijsonschematools.client.exceptions; + +@SuppressWarnings("serial") +public class BaseException extends Exception { + public BaseException(String s) { + super(s); + } +} \ No newline at end of file diff --git a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/exceptions/InvalidAdditionalPropertyException.kt b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/exceptions/InvalidAdditionalPropertyException.kt new file mode 100644 index 00000000000..424762f3cc9 --- /dev/null +++ b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/exceptions/InvalidAdditionalPropertyException.kt @@ -0,0 +1,8 @@ +package org.openapijsonschematools.client.exceptions; + +@SuppressWarnings("serial") +public class InvalidAdditionalPropertyException extends BaseException { + public InvalidAdditionalPropertyException(String s) { + super(s); + } +} \ No newline at end of file diff --git a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/exceptions/NotImplementedException.kt b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/exceptions/NotImplementedException.kt new file mode 100644 index 00000000000..4e9633c9d8d --- /dev/null +++ b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/exceptions/NotImplementedException.kt @@ -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/kotlin/src/main/kotlin/org/openapijsonschematools/client/exceptions/UnsetPropertyException.kt b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/exceptions/UnsetPropertyException.kt new file mode 100644 index 00000000000..f709a440cb3 --- /dev/null +++ b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/exceptions/UnsetPropertyException.kt @@ -0,0 +1,8 @@ +package org.openapijsonschematools.client.exceptions; + +@SuppressWarnings("serial") +public class UnsetPropertyException extends BaseException { + public UnsetPropertyException(String s) { + super(s); + } +} \ No newline at end of file diff --git a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/exceptions/ValidationException.kt b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/exceptions/ValidationException.kt new file mode 100644 index 00000000000..bd2e7089700 --- /dev/null +++ b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/exceptions/ValidationException.kt @@ -0,0 +1,8 @@ +package org.openapijsonschematools.client.exceptions; + +@SuppressWarnings("serial") +public class ValidationException extends BaseException { + public ValidationException(String s) { + super(s); + } +} \ No newline at end of file diff --git a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/header/ContentHeader.kt b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/header/ContentHeader.kt new file mode 100644 index 00000000000..0fc91100784 --- /dev/null +++ b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/header/ContentHeader.kt @@ -0,0 +1,59 @@ +package org.openapijsonschematools.client.header; + +import org.checkerframework.checker.nullness.qual.Nullable; +import org.openapijsonschematools.client.configurations.SchemaConfiguration; +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 ContentHeader(boolean required, @Nullable Boolean allowReserved, @Nullable Boolean explode, AbstractMap.SimpleEntry> content) { + super(required, ParameterStyle.SIMPLE, explode, allowReserved); + this.content = content; + } + + private static HttpHeaders toHeaders(String name, String value) { + Map> map = Map.of(name, List.of(value)); + BiPredicate headerFilter = (key, val) -> true; + return HttpHeaders.of(map, headerFilter); + } + + @Override + public HttpHeaders serialize(@Nullable Object inData, String name, boolean validate, SchemaConfiguration configuration) throws NotImplementedException, ValidationException { + var castInData = validate ? content.getValue().schema().validate(inData, configuration) : inData ; + String contentType = content.getKey(); + if (ContentTypeDetector.contentTypeIsJson(contentType)) { + var value = ContentTypeSerializer.toJson(castInData); + return toHeaders(name, value); + } else { + throw new NotImplementedException("Serialization of "+contentType+" has not yet been implemented"); + } + } + + @Override + public @Nullable Object deserialize(List inData, boolean validate, SchemaConfiguration configuration) throws NotImplementedException, ValidationException { + String inDataJoined = String.join(",", inData); // unsure if this is needed + @Nullable Object deserializedJson = ContentTypeDeserializer.fromJson(inDataJoined); + if (validate) { + String contentType = content.getKey(); + if (ContentTypeDetector.contentTypeIsJson(contentType)) { + return content.getValue().schema().validate(deserializedJson, configuration); + } else { + throw new NotImplementedException("Header deserialization of "+contentType+" has not yet been implemented"); + } + } + return deserializedJson; + } +} \ No newline at end of file diff --git a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/header/Header.kt b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/header/Header.kt new file mode 100644 index 00000000000..42387a7859b --- /dev/null +++ b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/header/Header.kt @@ -0,0 +1,14 @@ +package org.openapijsonschematools.client.header; + +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; +} \ No newline at end of file diff --git a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/header/HeaderBase.kt b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/header/HeaderBase.kt new file mode 100644 index 00000000000..23f22ebcf39 --- /dev/null +++ b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/header/HeaderBase.kt @@ -0,0 +1,18 @@ +package org.openapijsonschematools.client.header; + +import org.checkerframework.checker.nullness.qual.Nullable; +import org.openapijsonschematools.client.parameter.ParameterStyle; + +public class HeaderBase { + public final boolean required; + public final @Nullable ParameterStyle style; + public final @Nullable Boolean explode; + public final @Nullable Boolean allowReserved; + + public HeaderBase(boolean required, @Nullable ParameterStyle style, @Nullable Boolean explode, @Nullable Boolean allowReserved) { + this.required = required; + this.style = style; + this.explode = explode; + this.allowReserved = allowReserved; + } +} \ No newline at end of file diff --git a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/header/PrefixSeparatorIterator.kt b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/header/PrefixSeparatorIterator.kt new file mode 100644 index 00000000000..522e71dfce4 --- /dev/null +++ b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/header/PrefixSeparatorIterator.kt @@ -0,0 +1,27 @@ +package org.openapijsonschematools.client.header; + +import java.util.Set; + +public class PrefixSeparatorIterator { + // A class to store prefixes and separators for rfc6570 expansions + public final String prefix; + public final String separator; + private boolean first; + public final String itemSeparator; + private static final Set reusedSeparators = Set.of(".", "|", "%20"); + + public PrefixSeparatorIterator(String prefix, String separator) { + this.prefix = prefix; + this.separator = separator; + itemSeparator = reusedSeparators.contains(separator) ? separator : ","; + first = true; + } + + public String next() { + if (first) { + first = false; + return prefix; + } + return separator; + } +} diff --git a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/header/Rfc6570Serializer.kt b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/header/Rfc6570Serializer.kt new file mode 100644 index 00000000000..5f1d6cc179f --- /dev/null +++ b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/header/Rfc6570Serializer.kt @@ -0,0 +1,197 @@ +package org.openapijsonschematools.client.header; + +import org.checkerframework.checker.nullness.qual.Nullable; +import org.openapijsonschematools.client.exceptions.NotImplementedException; + +import java.io.UnsupportedEncodingException; +import java.net.URLEncoder; +import java.util.ArrayList; +import java.util.LinkedHashMap; +import java.util.List; +import java.util.Map; +import java.util.Set; +import java.util.stream.Collectors; + +public class Rfc6570Serializer { + private static final String ENCODING = "UTF-8"; + private static final Set namedParameterSeparators = Set.of("&", ";"); + + private static String percentEncode(String s) throws NotImplementedException { + if (s == null) { + return ""; + } + try { + return URLEncoder.encode(s, ENCODING) + // OAuth encodes some characters differently: + .replace("+", "%20").replace("*", "%2A") + .replace("%7E", "~"); + // This could be done faster with more hand-crafted code. + } catch (UnsupportedEncodingException wow) { + @Nullable String msg = wow.getMessage(); + if (msg == null) { + throw new NotImplementedException("UnsupportedEncodingException thrown"); + } + throw new NotImplementedException(msg); + } + } + + private static @Nullable String rfc6570ItemValue(@Nullable Object item, boolean percentEncode) throws NotImplementedException { + /* + Get representation if str/float/int/None/items in list/ values in dict + None is returned if an item is undefined, use cases are value= + - None + - [] + - {} + - [None, None None] + - {'a': None, 'b': None} + */ + if (item instanceof String stringItem) { + if (percentEncode) { + return percentEncode(stringItem); + } + return stringItem; + } else if (item instanceof Number numberItem) { + return numberItem.toString(); + } else if (item == null) { + // ignored by the expansion process https://datatracker.ietf.org/doc/html/rfc6570#section-3.2.1 + return null; + } else if (item instanceof List && ((List) item).isEmpty()) { + // ignored by the expansion process https://datatracker.ietf.org/doc/html/rfc6570#section-3.2.1 + return null; + } else if (item instanceof Map && ((Map) item).isEmpty()) { + // ignored by the expansion process https://datatracker.ietf.org/doc/html/rfc6570#section-3.2.1 + return null; + } + throw new NotImplementedException("Unable to generate a rfc6570 item representation of "+item); + } + + private static String rfc6570StrNumberExpansion( + @Nullable Object inData, + boolean percentEncode, + PrefixSeparatorIterator prefixSeparatorIterator, + String varNamePiece, + boolean namedParameterExpansion + ) throws NotImplementedException { + var itemValue = rfc6570ItemValue(inData, percentEncode); + if (itemValue == null || (itemValue.isEmpty() && prefixSeparatorIterator.separator.equals(";"))) { + return prefixSeparatorIterator.next() + varNamePiece; + } + var valuePairEquals = namedParameterExpansion ? "=" : ""; + return prefixSeparatorIterator.next() + varNamePiece + valuePairEquals + itemValue; + } + + private static String rfc6570ListExpansion( + List inData, + boolean explode, + boolean percentEncode, + PrefixSeparatorIterator prefixSeparatorIterator, + String varNamePiece, + boolean namedParameterExpansion + ) throws NotImplementedException { + List itemValues = new ArrayList<>(); + for (Object v: inData) { + @Nullable String value = rfc6570ItemValue(v, percentEncode); + if (value == null) { + continue; + } + itemValues.add(value); + } + if (itemValues.isEmpty()) { + // ignored by the expansion process https://datatracker.ietf.org/doc/html/rfc6570#section-3.2.1 + return ""; + } + var valuePairEquals = namedParameterExpansion ? "=" : ""; + if (!explode) { + return ( + prefixSeparatorIterator.next() + + varNamePiece + + valuePairEquals + + String.join(prefixSeparatorIterator.itemSeparator, itemValues) + ); + } + // exploded + return prefixSeparatorIterator.next() + itemValues.stream().map(v -> varNamePiece + valuePairEquals + v).collect(Collectors.joining(prefixSeparatorIterator.next())); + } + + private static String rfc6570MapExpansion( + Map inData, + boolean explode, + boolean percentEncode, + PrefixSeparatorIterator prefixSeparatorIterator, + String varNamePiece, + boolean namedParameterExpansion + ) throws NotImplementedException { + Map inDataMap = new LinkedHashMap<>(); + for (Map.Entry entry: inData.entrySet()) { + @Nullable String value = rfc6570ItemValue(entry.getValue(), percentEncode); + if (value == null) { + continue; + } + @Nullable Object key = entry.getKey(); + if (!(key instanceof String strKey)) { + continue; + } + inDataMap.put(strKey, value); + } + if (inDataMap.isEmpty()) { + // ignored by the expansion process https://datatracker.ietf.org/doc/html/rfc6570#section-3.2.1 + return ""; + } + var valuePairEquals = namedParameterExpansion ? "=" : ""; + if (!explode) { + return prefixSeparatorIterator.next() + + varNamePiece + + valuePairEquals + + inDataMap.entrySet().stream().map(e -> e.getKey()+prefixSeparatorIterator.itemSeparator+e.getValue()).collect(Collectors.joining(prefixSeparatorIterator.itemSeparator)); + } + // exploded + return prefixSeparatorIterator.next() + inDataMap.entrySet().stream().map(e -> e.getKey() + "=" + e.getValue()).collect(Collectors.joining(prefixSeparatorIterator.next())); + } + + protected static String rfc6570Expansion( + String variableName, + @Nullable Object inData, + boolean explode, + boolean percentEncode, + PrefixSeparatorIterator prefixSeparatorIterator + ) throws NotImplementedException { + /* + Separator is for separate variables like dict with explode true, + not for array item separation + */ + var namedParameterExpansion = namedParameterSeparators.contains(prefixSeparatorIterator.separator); + var varNamePiece = namedParameterExpansion ? variableName : ""; + if (inData instanceof Number || inData instanceof String) { + return rfc6570StrNumberExpansion( + inData, + percentEncode, + prefixSeparatorIterator, + varNamePiece, + namedParameterExpansion + ); + } else if (inData == null) { + // ignored by the expansion process https://datatracker.ietf.org/doc/html/rfc6570#section-3.2.1 + return ""; + } else if (inData instanceof List listData) { + return rfc6570ListExpansion( + listData, + explode, + percentEncode, + prefixSeparatorIterator, + varNamePiece, + namedParameterExpansion + ); + } else if (inData instanceof Map mapData) { + return rfc6570MapExpansion( + mapData, + explode, + percentEncode, + prefixSeparatorIterator, + varNamePiece, + namedParameterExpansion + ); + } + // bool, bytes, etc + throw new NotImplementedException("Unable to generate a rfc6570 representation of "+inData); + } +} \ No newline at end of file diff --git a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/header/SchemaHeader.kt b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/header/SchemaHeader.kt new file mode 100644 index 00000000000..176485c7ed8 --- /dev/null +++ b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/header/SchemaHeader.kt @@ -0,0 +1,97 @@ +package org.openapijsonschematools.client.header; + +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; +import org.openapijsonschematools.client.schemas.validation.UnsetAnyTypeJsonSchema; + +import java.net.http.HttpHeaders; +import java.util.ArrayList; +import java.util.List; +import java.util.Map; +import java.util.Set; +import java.util.function.BiPredicate; + +public class SchemaHeader extends HeaderBase implements Header { + public final JsonSchema schema; + + public SchemaHeader(boolean required, @Nullable Boolean allowReserved, @Nullable Boolean explode, JsonSchema schema) { + super(required, ParameterStyle.SIMPLE, explode, allowReserved); + this.schema = schema; + } + + private static HttpHeaders toHeaders(String name, String value) { + Map> map = Map.of(name, List.of(value)); + BiPredicate headerFilter = (key, val) -> true; + return HttpHeaders.of(map, headerFilter); + } + + @Override + public HttpHeaders serialize(@Nullable Object inData, String name, boolean validate, SchemaConfiguration configuration) throws NotImplementedException, ValidationException { + var castInData = validate ? schema.validate(inData, configuration) : inData; + boolean usedExplode = explode != null && explode; + var value = StyleSerializer.serializeSimple(castInData, name, usedExplode, false); + return toHeaders(name, value); + } + + private static final Set> VOID_TYPES = Set.of(Nothing?.class); + private static final Set> BOOLEAN_TYPES = Set.of(Boolean.class); + private static final Set> NUMERIC_TYPES = Set.of( + Integer.class, + Long.class, + Float.class, + Double.class + ); + private static final Set> STRING_TYPES = Set.of(String.class); + private static final Set> LIST_TYPES = Set.of(List.class); + private static final Set> MAP_TYPES = Set.of(Map.class); + + private List<@Nullable Object> getList(JsonSchema schema, List inData) throws NotImplementedException { + Class> itemsSchemaCls = schema.items == null ? UnsetAnyTypeJsonSchema.UnsetAnyTypeJsonSchema1.class : schema.items; + JsonSchema itemSchema = JsonSchemaFactory.getInstance(itemsSchemaCls); + List<@Nullable Object> castList = new ArrayList<>(); + for (String inDataItem: inData) { + @Nullable Object castInDataItem = getCastInData(itemSchema, List.of(inDataItem)); + castList.add(castInDataItem); + } + return castList; + } + + private @Nullable Object getCastInData(JsonSchema schema, List inData) throws NotImplementedException { + if (schema.type == null) { + if (inData.size() == 1) { + return inData.get(0); + } + return getList(schema, inData); + } else if (schema.type.size() == 1) { + if (schema.type.equals(BOOLEAN_TYPES)) { + throw new NotImplementedException("Boolean serialization is not defined in Rfc6570, there is no agreed upon way to sent a boolean, send a string enum instead"); + } else if (schema.type.equals(VOID_TYPES) && inData.size() == 1 && inData.get(0).isEmpty()) { + return null; + } else if (schema.type.equals(STRING_TYPES) && inData.size() == 1) { + return inData.get(0); + } else if (schema.type.equals(LIST_TYPES)) { + return getList(schema, inData); + } else if (schema.type.equals(MAP_TYPES)) { + throw new NotImplementedException("Header map deserialization has not yet been implemented"); + } + } else if (schema.type.size() == 4 && schema.type.equals(NUMERIC_TYPES) && inData.size() == 1) { + return ContentTypeDeserializer.fromJson(inData.get(0)); + } + throw new NotImplementedException("Header deserialization for schemas with multiple types has not yet been implemented"); + } + + @Override + public @Nullable Object deserialize(List inData, boolean validate, SchemaConfiguration configuration) throws NotImplementedException, ValidationException { + @Nullable Object castInData = getCastInData(schema, inData); + if (validate) { + return schema.validate(castInData, configuration); + } + return castInData; + } +} \ No newline at end of file diff --git a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/header/StyleSerializer.kt b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/header/StyleSerializer.kt new file mode 100644 index 00000000000..f5fa5a0a75b --- /dev/null +++ b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/header/StyleSerializer.kt @@ -0,0 +1,99 @@ +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( + @Nullable Object inData, + String name, + boolean explode, + boolean percentEncode + ) throws NotImplementedException { + var prefixSeparatorIterator = new PrefixSeparatorIterator("", ","); + return rfc6570Expansion( + name, + inData, + explode, + percentEncode, + prefixSeparatorIterator + ); + } + + public static String serializeForm( + @Nullable Object inData, + String name, + boolean explode, + boolean percentEncode + ) throws NotImplementedException { + // todo check that the prefix and suffix matches this one + PrefixSeparatorIterator iterator = new PrefixSeparatorIterator("", "&"); + return rfc6570Expansion( + name, + inData, + explode, + percentEncode, + iterator + ); + } + + public static String serializeMatrix( + @Nullable Object inData, + String name, + boolean explode + ) throws NotImplementedException { + PrefixSeparatorIterator usedIterator = new PrefixSeparatorIterator(";", ";"); + return rfc6570Expansion( + name, + inData, + explode, + true, + usedIterator + ); + } + + public static String serializeLabel( + @Nullable Object inData, + String name, + boolean explode + ) throws NotImplementedException { + PrefixSeparatorIterator usedIterator = new PrefixSeparatorIterator(".", "."); + return rfc6570Expansion( + name, + inData, + explode, + true, + usedIterator + ); + } + + public static String serializeSpaceDelimited( + @Nullable Object inData, + String name, + boolean explode + ) throws NotImplementedException { + PrefixSeparatorIterator usedIterator = new PrefixSeparatorIterator("", "%20"); + return rfc6570Expansion( + name, + inData, + explode, + true, + usedIterator + ); + } + + public static String serializePipeDelimited( + @Nullable Object inData, + String name, + boolean explode + ) throws NotImplementedException { + PrefixSeparatorIterator usedIterator = new PrefixSeparatorIterator("", "|"); + return rfc6570Expansion( + name, + inData, + explode, + true, + usedIterator + ); + } +} \ No newline at end of file diff --git a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/mediatype/Encoding.kt b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/mediatype/Encoding.kt new file mode 100644 index 00000000000..41a088888e8 --- /dev/null +++ b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/mediatype/Encoding.kt @@ -0,0 +1,30 @@ +package org.openapijsonschematools.client.mediatype; + +import org.checkerframework.checker.nullness.qual.Nullable; +import org.openapijsonschematools.client.parameter.ParameterStyle; +import org.openapijsonschematools.client.header.Header; + +import java.util.Map; + +public class Encoding { + public final String contentType; + public final @Nullable Map headers; + public final @Nullable ParameterStyle style; + public final boolean explode; + public final boolean allowReserved; + + public Encoding(String contentType) { + this.contentType = contentType; + headers = null; + style = null; + explode = false; + allowReserved = false; + } + public Encoding(String contentType, @Nullable Map headers) { + this.contentType = contentType; + this.headers = headers; + style = null; + explode = false; + allowReserved = false; + } +} \ No newline at end of file diff --git a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/mediatype/MediaType.kt b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/mediatype/MediaType.kt new file mode 100644 index 00000000000..e8392d15eda --- /dev/null +++ b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/mediatype/MediaType.kt @@ -0,0 +1,16 @@ +package org.openapijsonschematools.client.mediatype; + +import org.openapijsonschematools.client.schemas.validation.JsonSchema; + +public interface MediaType, U> { + /* + * Used to store request and response body schema information + * encoding: + * A map between a property name and its encoding information. + * The key, being the property name, MUST exist in the schema as a property. + * The encoding object SHALL only apply to requestBody objects when the media type is + * multipart or application/x-www-form-urlencoded. + */ + T schema(); + U encoding(); +} \ No newline at end of file diff --git a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/parameter/ContentParameter.kt b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/parameter/ContentParameter.kt new file mode 100644 index 00000000000..d5e00cc2fa9 --- /dev/null +++ b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/parameter/ContentParameter.kt @@ -0,0 +1,30 @@ +package org.openapijsonschematools.client.parameter; + +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 ContentParameter(String name, ParameterInType inType, boolean required, @Nullable ParameterStyle style, @Nullable Boolean explode, @Nullable Boolean allowReserved, AbstractMap.SimpleEntry> content) { + super(name, inType, required, style, explode, allowReserved); + this.content = content; + } + + @Override + public AbstractMap.SimpleEntry serialize(@Nullable Object inData) throws NotImplementedException { + String contentType = content.getKey(); + if (ContentTypeDetector.contentTypeIsJson(contentType)) { + var value = ContentTypeSerializer.toJson(inData); + return new AbstractMap.SimpleEntry<>(name, value); + } else { + throw new NotImplementedException("Serialization of "+contentType+" has not yet been implemented"); + } + } +} \ No newline at end of file diff --git a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/parameter/CookieSerializer.kt b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/parameter/CookieSerializer.kt new file mode 100644 index 00000000000..4ec9f6ef59d --- /dev/null +++ b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/parameter/CookieSerializer.kt @@ -0,0 +1,36 @@ +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; +import java.util.TreeMap; + +public abstract class CookieSerializer { + private final Map parameters; + + protected CookieSerializer(Map parameters) { + this.parameters = parameters; + } + + public String serialize(Map inData) throws NotImplementedException { + String result = ""; + Map sortedData = new TreeMap<>(inData); + for (Map.Entry entry: sortedData.entrySet()) { + String mapKey = entry.getKey(); + @Nullable Parameter parameter = parameters.get(mapKey); + if (parameter == null) { + throw new RuntimeException("Invalid state, a parameter must exist for every key"); + } + @Nullable Object value = entry.getValue(); + AbstractMap.SimpleEntry serialized = parameter.serialize(value); + if (result.isEmpty()) { + result = serialized.getValue(); + } else { + result = result + "; " + serialized.getValue(); + } + } + return result; + } +} diff --git a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/parameter/HeadersSerializer.kt b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/parameter/HeadersSerializer.kt new file mode 100644 index 00000000000..1969f2c0b21 --- /dev/null +++ b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/parameter/HeadersSerializer.kt @@ -0,0 +1,32 @@ +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; +import java.util.Map; +import java.util.List; + +public abstract class HeadersSerializer { + private final Map parameters; + + protected HeadersSerializer(Map parameters) { + this.parameters = parameters; + } + + public Map> serialize(Map inData) throws NotImplementedException { + Map> results = new LinkedHashMap<>(); + for (Map.Entry entry: inData.entrySet()) { + String mapKey = entry.getKey(); + @Nullable Parameter parameter = parameters.get(mapKey); + if (parameter == null) { + throw new RuntimeException("Invalid state, a parameter must exist for every key"); + } + @Nullable Object value = entry.getValue(); + AbstractMap.SimpleEntry serialized = parameter.serialize(value); + results.put(serialized.getKey(), List.of(serialized.getValue())); + } + return results; + } +} diff --git a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/parameter/Parameter.kt b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/parameter/Parameter.kt new file mode 100644 index 00000000000..adf3896d557 --- /dev/null +++ b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/parameter/Parameter.kt @@ -0,0 +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) throws NotImplementedException; +} \ No newline at end of file diff --git a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/parameter/ParameterBase.kt b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/parameter/ParameterBase.kt new file mode 100644 index 00000000000..8d79129b765 --- /dev/null +++ b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/parameter/ParameterBase.kt @@ -0,0 +1,15 @@ +package org.openapijsonschematools.client.parameter; + +import org.checkerframework.checker.nullness.qual.Nullable; +import org.openapijsonschematools.client.header.HeaderBase; + +public class ParameterBase extends HeaderBase { + public final String name; + public final ParameterInType inType; + + public ParameterBase(String name, ParameterInType inType, boolean required, @Nullable ParameterStyle style, @Nullable Boolean explode, @Nullable Boolean allowReserved) { + super(required, style, explode, allowReserved); + this.name = name; + this.inType = inType; + } +} \ No newline at end of file diff --git a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/parameter/ParameterInType.kt b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/parameter/ParameterInType.kt new file mode 100644 index 00000000000..cb8f4b18ba2 --- /dev/null +++ b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/parameter/ParameterInType.kt @@ -0,0 +1,8 @@ +package org.openapijsonschematools.client.parameter; + +public enum ParameterInType { + QUERY, + HEADER, + PATH, + COOKIE +} \ No newline at end of file diff --git a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/parameter/ParameterStyle.kt b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/parameter/ParameterStyle.kt new file mode 100644 index 00000000000..4e402ade76c --- /dev/null +++ b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/parameter/ParameterStyle.kt @@ -0,0 +1,11 @@ +package org.openapijsonschematools.client.parameter; + +public enum ParameterStyle { + MATRIX, + LABEL, + FORM, + SIMPLE, + SPACE_DELIMITED, + PIPE_DELIMITED, + DEEP_OBJECT +} \ No newline at end of file diff --git a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/parameter/PathSerializer.kt b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/parameter/PathSerializer.kt new file mode 100644 index 00000000000..78015037211 --- /dev/null +++ b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/parameter/PathSerializer.kt @@ -0,0 +1,30 @@ +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; + +public abstract class PathSerializer { + private final Map parameters; + + protected PathSerializer(Map parameters) { + this.parameters = parameters; + } + + public String serialize(Map inData, String pathWithPlaceholders) throws NotImplementedException { + String result = pathWithPlaceholders; + for (Map.Entry entry: inData.entrySet()) { + String mapKey = entry.getKey(); + @Nullable Parameter parameter = parameters.get(mapKey); + if (parameter == null) { + throw new RuntimeException("Invalid state, a parameter must exist for every key"); + } + @Nullable Object value = entry.getValue(); + AbstractMap.SimpleEntry serialized = parameter.serialize(value); + result = result.replace("{" + mapKey + "}", serialized.getValue()); + } + return result; + } +} diff --git a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/parameter/QuerySerializer.kt b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/parameter/QuerySerializer.kt new file mode 100644 index 00000000000..880151ed144 --- /dev/null +++ b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/parameter/QuerySerializer.kt @@ -0,0 +1,48 @@ +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; +import java.util.Map; +import java.util.TreeMap; + +public abstract class QuerySerializer { + private final Map parameters; + + protected QuerySerializer(Map parameters) { + this.parameters = parameters; + } + + public Map getQueryMap(Map inData) throws NotImplementedException { + Map results = new HashMap<>(); + for (Map.Entry entry: inData.entrySet()) { + String mapKey = entry.getKey(); + @Nullable Parameter parameter = parameters.get(mapKey); + if (parameter == null) { + throw new RuntimeException("Invalid state, a parameter must exist for every key"); + } + @Nullable Object value = entry.getValue(); + AbstractMap.SimpleEntry serialized = parameter.serialize(value); + results.put(serialized.getKey(), serialized.getValue()); + } + return new TreeMap<>(results); + } + + public String serialize(Map queryMap) { + if (queryMap.isEmpty()) { + return ""; + } + String result = "?"; + for (String serializedValue: queryMap.values()) { + if (result.length() == 1) { + result = result + serializedValue; + } else { + result = result + "&" + serializedValue; + } + } + // TODO what if the style is not FORM? + return result; + } +} diff --git a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/parameter/SchemaParameter.kt b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/parameter/SchemaParameter.kt new file mode 100644 index 00000000000..eef0b6bc371 --- /dev/null +++ b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/parameter/SchemaParameter.kt @@ -0,0 +1,60 @@ +package org.openapijsonschematools.client.parameter; + +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; + +public class SchemaParameter extends ParameterBase implements Parameter { + public final JsonSchema schema; + + public SchemaParameter(String name, ParameterInType inType, boolean required, @Nullable ParameterStyle style, @Nullable Boolean explode, @Nullable Boolean allowReserved, JsonSchema schema) { + super(name, inType, required, style, explode, allowReserved); + this.schema = schema; + } + + private ParameterStyle getStyle() { + if (style != null) { + return style; + } + if (inType == ParameterInType.QUERY || inType == ParameterInType.COOKIE) { + return ParameterStyle.FORM; + } + // ParameterInType.HEADER || ParameterInType.PATH + return ParameterStyle.SIMPLE; + } + + @Override + public AbstractMap.SimpleEntry serialize(@Nullable Object inData) throws NotImplementedException { + ParameterStyle usedStyle = getStyle(); + boolean percentEncode = inType == ParameterInType.QUERY || inType == ParameterInType.PATH; + String value; + boolean usedExplode = explode == null ? usedStyle == ParameterStyle.FORM : explode; + if (usedStyle == ParameterStyle.SIMPLE) { + // header OR path + value = StyleSerializer.serializeSimple(inData, name, usedExplode, percentEncode); + } else if (usedStyle == ParameterStyle.FORM) { + // query OR cookie + value = StyleSerializer.serializeForm(inData, name, usedExplode, percentEncode); + } else if (usedStyle == ParameterStyle.LABEL) { + // path + value = StyleSerializer.serializeLabel(inData, name, usedExplode); + } else if (usedStyle == ParameterStyle.MATRIX) { + // path + value = StyleSerializer.serializeMatrix(inData, name, usedExplode); + } else if (usedStyle == ParameterStyle.SPACE_DELIMITED) { + // query + value = StyleSerializer.serializeSpaceDelimited(inData, name, usedExplode); + } else if (usedStyle == ParameterStyle.PIPE_DELIMITED) { + // query + value = StyleSerializer.serializePipeDelimited(inData, name, usedExplode); + } else { + // usedStyle == ParameterStyle.DEEP_OBJECT + // query + throw new NotImplementedException("Style deep object serialization has not yet been implemented."); + } + return new AbstractMap.SimpleEntry<>(name, value); + } +} \ No newline at end of file diff --git a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/Anotherfakedummy.kt b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/Anotherfakedummy.kt new file mode 100644 index 00000000000..f89bfb988ac --- /dev/null +++ b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/Anotherfakedummy.kt @@ -0,0 +1,5 @@ +package org.openapijsonschematools.client.paths; + +public class Anotherfakedummy { + public static final String path = "/another-fake/dummy"; +} diff --git a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/Commonparamsubdir.kt b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/Commonparamsubdir.kt new file mode 100644 index 00000000000..56057955e78 --- /dev/null +++ b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/Commonparamsubdir.kt @@ -0,0 +1,5 @@ +package org.openapijsonschematools.client.paths; + +public class Commonparamsubdir { + public static final String path = "/commonParam/{subDir}/"; +} diff --git a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/Fake.kt b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/Fake.kt new file mode 100644 index 00000000000..46cde76f450 --- /dev/null +++ b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/Fake.kt @@ -0,0 +1,5 @@ +package org.openapijsonschematools.client.paths; + +public class Fake { + public static final String path = "/fake"; +} diff --git a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/Fakeadditionalpropertieswitharrayofenums.kt b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/Fakeadditionalpropertieswitharrayofenums.kt new file mode 100644 index 00000000000..43effb28488 --- /dev/null +++ b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/Fakeadditionalpropertieswitharrayofenums.kt @@ -0,0 +1,5 @@ +package org.openapijsonschematools.client.paths; + +public class Fakeadditionalpropertieswitharrayofenums { + public static final String path = "/fake/additional-properties-with-array-of-enums"; +} diff --git a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/Fakebodywithfileschema.kt b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/Fakebodywithfileschema.kt new file mode 100644 index 00000000000..ce66c23f4f0 --- /dev/null +++ b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/Fakebodywithfileschema.kt @@ -0,0 +1,5 @@ +package org.openapijsonschematools.client.paths; + +public class Fakebodywithfileschema { + public static final String path = "/fake/body-with-file-schema"; +} diff --git a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/Fakebodywithqueryparams.kt b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/Fakebodywithqueryparams.kt new file mode 100644 index 00000000000..8a4d20a641a --- /dev/null +++ b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/Fakebodywithqueryparams.kt @@ -0,0 +1,5 @@ +package org.openapijsonschematools.client.paths; + +public class Fakebodywithqueryparams { + public static final String path = "/fake/body-with-query-params"; +} diff --git a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/Fakecasesensitiveparams.kt b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/Fakecasesensitiveparams.kt new file mode 100644 index 00000000000..c82acc6d50b --- /dev/null +++ b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/Fakecasesensitiveparams.kt @@ -0,0 +1,5 @@ +package org.openapijsonschematools.client.paths; + +public class Fakecasesensitiveparams { + public static final String path = "/fake/case-sensitive-params"; +} diff --git a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/Fakeclassnametest.kt b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/Fakeclassnametest.kt new file mode 100644 index 00000000000..2ad877f4897 --- /dev/null +++ b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/Fakeclassnametest.kt @@ -0,0 +1,5 @@ +package org.openapijsonschematools.client.paths; + +public class Fakeclassnametest { + public static final String path = "/fake_classname_test"; +} diff --git a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/Fakedeletecoffeeid.kt b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/Fakedeletecoffeeid.kt new file mode 100644 index 00000000000..30eebc6d353 --- /dev/null +++ b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/Fakedeletecoffeeid.kt @@ -0,0 +1,5 @@ +package org.openapijsonschematools.client.paths; + +public class Fakedeletecoffeeid { + public static final String path = "/fake/deleteCoffee/{id}"; +} diff --git a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/Fakehealth.kt b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/Fakehealth.kt new file mode 100644 index 00000000000..73fc63a1954 --- /dev/null +++ b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/Fakehealth.kt @@ -0,0 +1,5 @@ +package org.openapijsonschematools.client.paths; + +public class Fakehealth { + public static final String path = "/fake/health"; +} diff --git a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/Fakeinlineadditionalproperties.kt b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/Fakeinlineadditionalproperties.kt new file mode 100644 index 00000000000..26347f6ed75 --- /dev/null +++ b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/Fakeinlineadditionalproperties.kt @@ -0,0 +1,5 @@ +package org.openapijsonschematools.client.paths; + +public class Fakeinlineadditionalproperties { + public static final String path = "/fake/inline-additionalProperties"; +} diff --git a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/Fakeinlinecomposition.kt b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/Fakeinlinecomposition.kt new file mode 100644 index 00000000000..4c39d95f065 --- /dev/null +++ b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/Fakeinlinecomposition.kt @@ -0,0 +1,5 @@ +package org.openapijsonschematools.client.paths; + +public class Fakeinlinecomposition { + public static final String path = "/fake/inlineComposition/"; +} diff --git a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/Fakejsonformdata.kt b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/Fakejsonformdata.kt new file mode 100644 index 00000000000..f2c24afc0ef --- /dev/null +++ b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/Fakejsonformdata.kt @@ -0,0 +1,5 @@ +package org.openapijsonschematools.client.paths; + +public class Fakejsonformdata { + public static final String path = "/fake/jsonFormData"; +} diff --git a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/Fakejsonpatch.kt b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/Fakejsonpatch.kt new file mode 100644 index 00000000000..2dfcbc73d55 --- /dev/null +++ b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/Fakejsonpatch.kt @@ -0,0 +1,5 @@ +package org.openapijsonschematools.client.paths; + +public class Fakejsonpatch { + public static final String path = "/fake/jsonPatch"; +} diff --git a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/Fakejsonwithcharset.kt b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/Fakejsonwithcharset.kt new file mode 100644 index 00000000000..63ba857f0a0 --- /dev/null +++ b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/Fakejsonwithcharset.kt @@ -0,0 +1,5 @@ +package org.openapijsonschematools.client.paths; + +public class Fakejsonwithcharset { + public static final String path = "/fake/jsonWithCharset"; +} diff --git a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/Fakemultiplerequestbodycontenttypes.kt b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/Fakemultiplerequestbodycontenttypes.kt new file mode 100644 index 00000000000..85fbe08971a --- /dev/null +++ b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/Fakemultiplerequestbodycontenttypes.kt @@ -0,0 +1,5 @@ +package org.openapijsonschematools.client.paths; + +public class Fakemultiplerequestbodycontenttypes { + public static final String path = "/fake/multipleRequestBodyContentTypes/"; +} diff --git a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/Fakemultipleresponsebodies.kt b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/Fakemultipleresponsebodies.kt new file mode 100644 index 00000000000..47bbeb0dbbf --- /dev/null +++ b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/Fakemultipleresponsebodies.kt @@ -0,0 +1,5 @@ +package org.openapijsonschematools.client.paths; + +public class Fakemultipleresponsebodies { + public static final String path = "/fake/multipleResponseBodies"; +} diff --git a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/Fakemultiplesecurities.kt b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/Fakemultiplesecurities.kt new file mode 100644 index 00000000000..4052ed98bd0 --- /dev/null +++ b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/Fakemultiplesecurities.kt @@ -0,0 +1,5 @@ +package org.openapijsonschematools.client.paths; + +public class Fakemultiplesecurities { + public static final String path = "/fake/multipleSecurities"; +} diff --git a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/Fakeobjinquery.kt b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/Fakeobjinquery.kt new file mode 100644 index 00000000000..a4a39ca83b9 --- /dev/null +++ b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/Fakeobjinquery.kt @@ -0,0 +1,5 @@ +package org.openapijsonschematools.client.paths; + +public class Fakeobjinquery { + public static final String path = "/fake/objInQuery"; +} diff --git a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/Fakeparametercollisions1ababselfab.kt b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/Fakeparametercollisions1ababselfab.kt new file mode 100644 index 00000000000..abcc4667520 --- /dev/null +++ b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/Fakeparametercollisions1ababselfab.kt @@ -0,0 +1,5 @@ +package org.openapijsonschematools.client.paths; + +public class Fakeparametercollisions1ababselfab { + public static final String path = "/fake/parameterCollisions/{1}/{aB}/{Ab}/{self}/{A-B}/"; +} diff --git a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/Fakepemcontenttype.kt b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/Fakepemcontenttype.kt new file mode 100644 index 00000000000..b48b1522786 --- /dev/null +++ b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/Fakepemcontenttype.kt @@ -0,0 +1,5 @@ +package org.openapijsonschematools.client.paths; + +public class Fakepemcontenttype { + public static final String path = "/fake/pemContentType"; +} diff --git a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/Fakepetiduploadimagewithrequiredfile.kt b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/Fakepetiduploadimagewithrequiredfile.kt new file mode 100644 index 00000000000..fe1c8da62ed --- /dev/null +++ b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/Fakepetiduploadimagewithrequiredfile.kt @@ -0,0 +1,5 @@ +package org.openapijsonschematools.client.paths; + +public class Fakepetiduploadimagewithrequiredfile { + public static final String path = "/fake/{petId}/uploadImageWithRequiredFile"; +} diff --git a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/Fakequeryparamwithjsoncontenttype.kt b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/Fakequeryparamwithjsoncontenttype.kt new file mode 100644 index 00000000000..adc814cd4e1 --- /dev/null +++ b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/Fakequeryparamwithjsoncontenttype.kt @@ -0,0 +1,5 @@ +package org.openapijsonschematools.client.paths; + +public class Fakequeryparamwithjsoncontenttype { + public static final String path = "/fake/queryParamWithJsonContentType"; +} diff --git a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/Fakeredirection.kt b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/Fakeredirection.kt new file mode 100644 index 00000000000..96ced57ff91 --- /dev/null +++ b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/Fakeredirection.kt @@ -0,0 +1,5 @@ +package org.openapijsonschematools.client.paths; + +public class Fakeredirection { + public static final String path = "/fake/redirection"; +} diff --git a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/Fakerefobjinquery.kt b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/Fakerefobjinquery.kt new file mode 100644 index 00000000000..96194250be7 --- /dev/null +++ b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/Fakerefobjinquery.kt @@ -0,0 +1,5 @@ +package org.openapijsonschematools.client.paths; + +public class Fakerefobjinquery { + public static final String path = "/fake/refObjInQuery"; +} diff --git a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/Fakerefsarraymodel.kt b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/Fakerefsarraymodel.kt new file mode 100644 index 00000000000..c4e1f2d71ba --- /dev/null +++ b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/Fakerefsarraymodel.kt @@ -0,0 +1,5 @@ +package org.openapijsonschematools.client.paths; + +public class Fakerefsarraymodel { + public static final String path = "/fake/refs/arraymodel"; +} diff --git a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/Fakerefsarrayofenums.kt b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/Fakerefsarrayofenums.kt new file mode 100644 index 00000000000..2479d833c60 --- /dev/null +++ b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/Fakerefsarrayofenums.kt @@ -0,0 +1,5 @@ +package org.openapijsonschematools.client.paths; + +public class Fakerefsarrayofenums { + public static final String path = "/fake/refs/array-of-enums"; +} diff --git a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/Fakerefsboolean.kt b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/Fakerefsboolean.kt new file mode 100644 index 00000000000..b795df7fe6b --- /dev/null +++ b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/Fakerefsboolean.kt @@ -0,0 +1,5 @@ +package org.openapijsonschematools.client.paths; + +public class Fakerefsboolean { + public static final String path = "/fake/refs/boolean"; +} diff --git a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/Fakerefscomposedoneofnumberwithvalidations.kt b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/Fakerefscomposedoneofnumberwithvalidations.kt new file mode 100644 index 00000000000..9146b51293f --- /dev/null +++ b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/Fakerefscomposedoneofnumberwithvalidations.kt @@ -0,0 +1,5 @@ +package org.openapijsonschematools.client.paths; + +public class Fakerefscomposedoneofnumberwithvalidations { + public static final String path = "/fake/refs/composed_one_of_number_with_validations"; +} diff --git a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/Fakerefsenum.kt b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/Fakerefsenum.kt new file mode 100644 index 00000000000..5eeb04f8d37 --- /dev/null +++ b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/Fakerefsenum.kt @@ -0,0 +1,5 @@ +package org.openapijsonschematools.client.paths; + +public class Fakerefsenum { + public static final String path = "/fake/refs/enum"; +} diff --git a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/Fakerefsmammal.kt b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/Fakerefsmammal.kt new file mode 100644 index 00000000000..b6271a3061f --- /dev/null +++ b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/Fakerefsmammal.kt @@ -0,0 +1,5 @@ +package org.openapijsonschematools.client.paths; + +public class Fakerefsmammal { + public static final String path = "/fake/refs/mammal"; +} diff --git a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/Fakerefsnumber.kt b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/Fakerefsnumber.kt new file mode 100644 index 00000000000..7dd2b5ace64 --- /dev/null +++ b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/Fakerefsnumber.kt @@ -0,0 +1,5 @@ +package org.openapijsonschematools.client.paths; + +public class Fakerefsnumber { + public static final String path = "/fake/refs/number"; +} diff --git a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/Fakerefsobjectmodelwithrefprops.kt b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/Fakerefsobjectmodelwithrefprops.kt new file mode 100644 index 00000000000..64dd88b6a6a --- /dev/null +++ b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/Fakerefsobjectmodelwithrefprops.kt @@ -0,0 +1,5 @@ +package org.openapijsonschematools.client.paths; + +public class Fakerefsobjectmodelwithrefprops { + public static final String path = "/fake/refs/object_model_with_ref_props"; +} diff --git a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/Fakerefsstring.kt b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/Fakerefsstring.kt new file mode 100644 index 00000000000..08aa4a9afaa --- /dev/null +++ b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/Fakerefsstring.kt @@ -0,0 +1,5 @@ +package org.openapijsonschematools.client.paths; + +public class Fakerefsstring { + public static final String path = "/fake/refs/string"; +} diff --git a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/Fakeresponsewithoutschema.kt b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/Fakeresponsewithoutschema.kt new file mode 100644 index 00000000000..78ae099c8a1 --- /dev/null +++ b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/Fakeresponsewithoutschema.kt @@ -0,0 +1,5 @@ +package org.openapijsonschematools.client.paths; + +public class Fakeresponsewithoutschema { + public static final String path = "/fake/responseWithoutSchema"; +} diff --git a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/Faketestqueryparamters.kt b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/Faketestqueryparamters.kt new file mode 100644 index 00000000000..487d92b4122 --- /dev/null +++ b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/Faketestqueryparamters.kt @@ -0,0 +1,5 @@ +package org.openapijsonschematools.client.paths; + +public class Faketestqueryparamters { + public static final String path = "/fake/test-query-paramters"; +} diff --git a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/Fakeuploaddownloadfile.kt b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/Fakeuploaddownloadfile.kt new file mode 100644 index 00000000000..06871695fc4 --- /dev/null +++ b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/Fakeuploaddownloadfile.kt @@ -0,0 +1,5 @@ +package org.openapijsonschematools.client.paths; + +public class Fakeuploaddownloadfile { + public static final String path = "/fake/uploadDownloadFile"; +} diff --git a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/Fakeuploadfile.kt b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/Fakeuploadfile.kt new file mode 100644 index 00000000000..4f754cd5d46 --- /dev/null +++ b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/Fakeuploadfile.kt @@ -0,0 +1,5 @@ +package org.openapijsonschematools.client.paths; + +public class Fakeuploadfile { + public static final String path = "/fake/uploadFile"; +} diff --git a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/Fakeuploadfiles.kt b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/Fakeuploadfiles.kt new file mode 100644 index 00000000000..4c2ba0ab9a5 --- /dev/null +++ b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/Fakeuploadfiles.kt @@ -0,0 +1,5 @@ +package org.openapijsonschematools.client.paths; + +public class Fakeuploadfiles { + public static final String path = "/fake/uploadFiles"; +} diff --git a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/Fakewildcardresponses.kt b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/Fakewildcardresponses.kt new file mode 100644 index 00000000000..991d78912aa --- /dev/null +++ b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/Fakewildcardresponses.kt @@ -0,0 +1,5 @@ +package org.openapijsonschematools.client.paths; + +public class Fakewildcardresponses { + public static final String path = "/fake/wildCardResponses"; +} diff --git a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/Foo.kt b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/Foo.kt new file mode 100644 index 00000000000..42d8262a389 --- /dev/null +++ b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/Foo.kt @@ -0,0 +1,5 @@ +package org.openapijsonschematools.client.paths; + +public class Foo { + public static final String path = "/foo"; +} diff --git a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/Pet.kt b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/Pet.kt new file mode 100644 index 00000000000..96fb5bcdaf9 --- /dev/null +++ b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/Pet.kt @@ -0,0 +1,5 @@ +package org.openapijsonschematools.client.paths; + +public class Pet { + public static final String path = "/pet"; +} diff --git a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/Petfindbystatus.kt b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/Petfindbystatus.kt new file mode 100644 index 00000000000..7fe26528c22 --- /dev/null +++ b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/Petfindbystatus.kt @@ -0,0 +1,5 @@ +package org.openapijsonschematools.client.paths; + +public class Petfindbystatus { + public static final String path = "/pet/findByStatus"; +} diff --git a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/Petfindbytags.kt b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/Petfindbytags.kt new file mode 100644 index 00000000000..634991ab867 --- /dev/null +++ b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/Petfindbytags.kt @@ -0,0 +1,5 @@ +package org.openapijsonschematools.client.paths; + +public class Petfindbytags { + public static final String path = "/pet/findByTags"; +} diff --git a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/Petpetid.kt b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/Petpetid.kt new file mode 100644 index 00000000000..e376b2b5531 --- /dev/null +++ b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/Petpetid.kt @@ -0,0 +1,5 @@ +package org.openapijsonschematools.client.paths; + +public class Petpetid { + public static final String path = "/pet/{petId}"; +} diff --git a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/Petpetiduploadimage.kt b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/Petpetiduploadimage.kt new file mode 100644 index 00000000000..0c266715daf --- /dev/null +++ b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/Petpetiduploadimage.kt @@ -0,0 +1,5 @@ +package org.openapijsonschematools.client.paths; + +public class Petpetiduploadimage { + public static final String path = "/pet/{petId}/uploadImage"; +} diff --git a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/Solidus.kt b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/Solidus.kt new file mode 100644 index 00000000000..b378bf8aa10 --- /dev/null +++ b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/Solidus.kt @@ -0,0 +1,5 @@ +package org.openapijsonschematools.client.paths; + +public class Solidus { + public static final String path = "/"; +} diff --git a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/Storeinventory.kt b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/Storeinventory.kt new file mode 100644 index 00000000000..38824a730f6 --- /dev/null +++ b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/Storeinventory.kt @@ -0,0 +1,5 @@ +package org.openapijsonschematools.client.paths; + +public class Storeinventory { + public static final String path = "/store/inventory"; +} diff --git a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/Storeorder.kt b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/Storeorder.kt new file mode 100644 index 00000000000..7e037639b4d --- /dev/null +++ b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/Storeorder.kt @@ -0,0 +1,5 @@ +package org.openapijsonschematools.client.paths; + +public class Storeorder { + public static final String path = "/store/order"; +} diff --git a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/Storeorderorderid.kt b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/Storeorderorderid.kt new file mode 100644 index 00000000000..b3d78f384d7 --- /dev/null +++ b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/Storeorderorderid.kt @@ -0,0 +1,5 @@ +package org.openapijsonschematools.client.paths; + +public class Storeorderorderid { + public static final String path = "/store/order/{order_id}"; +} diff --git a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/User.kt b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/User.kt new file mode 100644 index 00000000000..c39366684bd --- /dev/null +++ b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/User.kt @@ -0,0 +1,5 @@ +package org.openapijsonschematools.client.paths; + +public class User { + public static final String path = "/user"; +} diff --git a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/Usercreatewitharray.kt b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/Usercreatewitharray.kt new file mode 100644 index 00000000000..999508b3d42 --- /dev/null +++ b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/Usercreatewitharray.kt @@ -0,0 +1,5 @@ +package org.openapijsonschematools.client.paths; + +public class Usercreatewitharray { + public static final String path = "/user/createWithArray"; +} diff --git a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/Usercreatewithlist.kt b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/Usercreatewithlist.kt new file mode 100644 index 00000000000..a59a7d908a9 --- /dev/null +++ b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/Usercreatewithlist.kt @@ -0,0 +1,5 @@ +package org.openapijsonschematools.client.paths; + +public class Usercreatewithlist { + public static final String path = "/user/createWithList"; +} diff --git a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/Userlogin.kt b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/Userlogin.kt new file mode 100644 index 00000000000..b0d7e4c93f8 --- /dev/null +++ b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/Userlogin.kt @@ -0,0 +1,5 @@ +package org.openapijsonschematools.client.paths; + +public class Userlogin { + public static final String path = "/user/login"; +} diff --git a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/Userlogout.kt b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/Userlogout.kt new file mode 100644 index 00000000000..f98e8b3231b --- /dev/null +++ b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/Userlogout.kt @@ -0,0 +1,5 @@ +package org.openapijsonschematools.client.paths; + +public class Userlogout { + public static final String path = "/user/logout"; +} diff --git a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/Userusername.kt b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/Userusername.kt new file mode 100644 index 00000000000..4a78ea16ff8 --- /dev/null +++ b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/Userusername.kt @@ -0,0 +1,5 @@ +package org.openapijsonschematools.client.paths; + +public class Userusername { + public static final String path = "/user/{username}"; +} diff --git a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/anotherfakedummy/AnotherfakedummyPatch.kt b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/anotherfakedummy/AnotherfakedummyPatch.kt new file mode 100644 index 00000000000..3351c5abf40 --- /dev/null +++ b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/anotherfakedummy/AnotherfakedummyPatch.kt @@ -0,0 +1,183 @@ +package org.openapijsonschematools.client.paths.anotherfakedummy; + +import org.checkerframework.checker.nullness.qual.Nullable; +import org.openapijsonschematools.client.RootServerInfo; +import org.openapijsonschematools.client.paths.anotherfakedummy.patch.AnotherfakedummyPatchRequestBody; +import org.openapijsonschematools.client.paths.anotherfakedummy.patch.AnotherfakedummyPatchResponses; +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.requestbody.SerializedRequestBody; +import org.openapijsonschematools.client.paths.Anotherfakedummy; + +import java.io.IOException; +import java.util.ArrayList; +import java.net.http.HttpClient; +import java.net.http.HttpRequest; +import java.time.Duration; +import java.util.List; +import java.util.Map; + +public class AnotherfakedummyPatch { + private static class PatchProvider { + private static final String method = "patch"; + + public static AnotherfakedummyPatchResponses.EndpointResponse patch( + PatchRequest request, + ApiConfiguration apiConfiguration, + SchemaConfiguration schemaConfiguration, + HttpClient client + ) throws IOException, InterruptedException, ValidationException, NotImplementedException, ApiException { + Map> headers = apiConfiguration.getDefaultHeaders(); + + SerializedRequestBody serializedRequestBody = new AnotherfakedummyPatchRequestBody.AnotherfakedummyPatchRequestBody1().serialize( + request.requestBody + ); + var contentTypeHeaderValues = headers.getOrDefault("Content-Type", new ArrayList<>()); + contentTypeHeaderValues.add(serializedRequestBody.contentType); + HttpRequest.BodyPublisher bodyPublisher = serializedRequestBody.bodyPublisher; + // TODO set this to a map if there is a query security scheme + @Nullable Map queryMap = null; + String host = apiConfiguration.getServer(request.serverIndex).url(); + + String url = host + Anotherfakedummy.path; + var httpRequest = RestClient.getRequest( + url, + method, + bodyPublisher, + headers, + request.timeout + ); + var response = RestClient.getResponse(httpRequest, client); + var responsesDeserializer = new AnotherfakedummyPatchResponses.AnotherfakedummyPatchResponses1(); + return responsesDeserializer.deserialize(response, schemaConfiguration); + } + } + + public interface PatchOperation { + ApiConfiguration getApiConfiguration(); + SchemaConfiguration getSchemaConfiguration(); + HttpClient getClient(); + default AnotherfakedummyPatchResponses.EndpointResponse patch(PatchRequest request) throws IOException, InterruptedException, ValidationException, NotImplementedException, ApiException { + return PatchProvider.patch(request, getApiConfiguration(), getSchemaConfiguration(), getClient()); + } + } + + public interface Model123TestSpecialTagsOperation { + ApiConfiguration getApiConfiguration(); + SchemaConfiguration getSchemaConfiguration(); + HttpClient getClient(); + default AnotherfakedummyPatchResponses.EndpointResponse model123TestSpecialTags(PatchRequest request) throws IOException, InterruptedException, ValidationException, NotImplementedException, ApiException { + return PatchProvider.patch(request, getApiConfiguration(), getSchemaConfiguration(), getClient()); + } + } + + public static class Patch extends ApiClient implements PatchOperation { + public Patch(ApiConfiguration apiConfiguration, SchemaConfiguration schemaConfiguration) { + super(apiConfiguration, schemaConfiguration); + } + } + + public static class PatchRequest { + public AnotherfakedummyPatchRequestBody.SealedRequestBody requestBody; + public RootServerInfo.@Nullable ServerIndex serverIndex; + public @Nullable Duration timeout; + + public PatchRequest( + AnotherfakedummyPatchRequestBody.SealedRequestBody requestBody, + RootServerInfo.@Nullable ServerIndex serverIndex, + @Nullable Duration timeout + ) { + this.requestBody = requestBody; + this.serverIndex = serverIndex; + this.timeout = timeout; + } + } + + public static class PatchNullableRequest { + public AnotherfakedummyPatchRequestBody.@Nullable SealedRequestBody requestBody; + public RootServerInfo.@Nullable ServerIndex serverIndex; + public @Nullable Duration timeout; + } + + public interface SetterForServerIndex { + PatchNullableRequest getInstance(); + T getBuilderAfterServerIndex(PatchNullableRequest instance); + default T serverIndex(RootServerInfo.ServerIndex serverIndex) { + var instance = getInstance(); + instance.serverIndex = serverIndex; + return getBuilderAfterServerIndex(instance); + } + } + + public interface SetterForTimeout { + PatchNullableRequest getInstance(); + T getBuilderAfterTimeout(PatchNullableRequest instance); + default T timeout(Duration timeout) { + var instance = getInstance(); + instance.timeout = timeout; + return getBuilderAfterTimeout(instance); + } + } + + public interface SetterForRequestBody { + PatchNullableRequest getInstance(); + T getBuilderAfterRequestBody(PatchNullableRequest instance); + default T requestBody(AnotherfakedummyPatchRequestBody.SealedRequestBody requestBody) { + var instance = getInstance(); + instance.requestBody = requestBody; + return getBuilderAfterRequestBody(instance); + } + } + + public static class Patch0RequestBuilder implements SetterForServerIndex, SetterForTimeout { + private final PatchNullableRequest instance; + + public Patch0RequestBuilder(PatchNullableRequest instance) { + this.instance = instance; + } + + public PatchRequest build() { + var requestBody = instance.requestBody; + if (requestBody == null) { + throw new RuntimeException("invalid null value for required parameter"); + } + return new PatchRequest( + requestBody, + instance.serverIndex, + instance.timeout + ); + } + + public PatchNullableRequest getInstance() { + return instance; + } + + public Patch0RequestBuilder getBuilderAfterServerIndex(PatchNullableRequest instance) { + return this; + } + + public Patch0RequestBuilder getBuilderAfterTimeout(PatchNullableRequest instance) { + return this; + } + } + public static class PatchRequestBuilder implements SetterForRequestBody { + private final PatchNullableRequest instance; + + public PatchRequestBuilder() { + this.instance = new PatchNullableRequest(); + } + + public PatchNullableRequest getInstance() { + return instance; + } + + public Patch0RequestBuilder getBuilderAfterRequestBody(PatchNullableRequest instance) { + return new Patch0RequestBuilder(instance); + } + } +} diff --git a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/anotherfakedummy/patch/AnotherfakedummyPatchRequestBody.kt b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/anotherfakedummy/patch/AnotherfakedummyPatchRequestBody.kt new file mode 100644 index 00000000000..cc759c48ee1 --- /dev/null +++ b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/anotherfakedummy/patch/AnotherfakedummyPatchRequestBody.kt @@ -0,0 +1,7 @@ +package org.openapijsonschematools.client.paths.anotherfakedummy.patch; + +import org.openapijsonschematools.client.components.requestbodies.Client; + +public class AnotherfakedummyPatchRequestBody extends Client { + public static class AnotherfakedummyPatchRequestBody1 extends Client1 {} +} diff --git a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/anotherfakedummy/patch/AnotherfakedummyPatchResponses.kt b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/anotherfakedummy/patch/AnotherfakedummyPatchResponses.kt new file mode 100644 index 00000000000..00b2eda830a --- /dev/null +++ b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/anotherfakedummy/patch/AnotherfakedummyPatchResponses.kt @@ -0,0 +1,53 @@ +package org.openapijsonschematools.client.paths.anotherfakedummy.patch; + +import org.openapijsonschematools.client.paths.anotherfakedummy.patch.responses.AnotherfakedummyPatchCode200Response; +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; +import org.checkerframework.checker.nullness.qual.Nullable; + +import java.net.http.HttpResponse; +import java.util.Map; +import java.util.AbstractMap; + +public class AnotherfakedummyPatchResponses { + public sealed interface EndpointResponse permits EndpointAnotherfakedummyPatchCode200Response {} + + public record EndpointAnotherfakedummyPatchCode200Response( + HttpResponse response, + AnotherfakedummyPatchCode200Response.SealedResponseBody body, + Nothing? headers + ) implements EndpointResponse, ApiResponse{ + } + + public sealed interface StatusCodeResponseDeserializer permits StatusAnotherfakedummyPatchCode200ResponseDeserializer {} + + public static final class StatusAnotherfakedummyPatchCode200ResponseDeserializer extends AnotherfakedummyPatchCode200Response.AnotherfakedummyPatchCode200Response1 implements StatusCodeResponseDeserializer { + } + + public static final class AnotherfakedummyPatchResponses1 implements ResponsesDeserializer { + private final Map statusCodeToResponseDeserializer; + public AnotherfakedummyPatchResponses1() { + this.statusCodeToResponseDeserializer = Map.ofEntries( + new AbstractMap.SimpleEntry<>("200", new StatusAnotherfakedummyPatchCode200ResponseDeserializer()) + ); + } + + 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) { + throw new ApiException( + "Invalid response statusCode="+statusCode+" has no response defined in the openapi document", + response + ); + } + StatusAnotherfakedummyPatchCode200ResponseDeserializer castDeserializer = (StatusAnotherfakedummyPatchCode200ResponseDeserializer) statusCodeDeserializer; + var deserializedResponse = castDeserializer.deserialize(response, configuration); + return new EndpointAnotherfakedummyPatchCode200Response(response, deserializedResponse.body(), deserializedResponse.headers()); + } + } +} diff --git a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/anotherfakedummy/patch/responses/AnotherfakedummyPatchCode200Response.kt b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/anotherfakedummy/patch/responses/AnotherfakedummyPatchCode200Response.kt new file mode 100644 index 00000000000..f437e943c6e --- /dev/null +++ b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/anotherfakedummy/patch/responses/AnotherfakedummyPatchCode200Response.kt @@ -0,0 +1,63 @@ +package org.openapijsonschematools.client.paths.anotherfakedummy.patch.responses; + +import org.openapijsonschematools.client.configurations.SchemaConfiguration; +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; + +import java.util.AbstractMap; +import java.util.Map; +import java.net.http.HttpResponse; +import java.net.http.HttpHeaders; + +public class AnotherfakedummyPatchCode200Response { + public sealed interface SealedMediaType permits ApplicationjsonMediaType {} + + public record ApplicationjsonMediaType(ApplicationjsonSchema.ApplicationjsonSchema1 schema) implements SealedMediaType, MediaType { + public ApplicationjsonMediaType() { + this(ApplicationjsonSchema.ApplicationjsonSchema1.getInstance()); + } + @Override + public Nothing? encoding() { + return null; + } + } + public sealed interface SealedResponseBody permits ApplicationjsonResponseBody {} + public record ApplicationjsonResponseBody(ApplicationjsonSchema.Client1Boxed body) implements SealedResponseBody { } + + public static class AnotherfakedummyPatchCode200Response1 extends ResponseDeserializer { + public AnotherfakedummyPatchCode200Response1() { + super( + Map.ofEntries( + new AbstractMap.SimpleEntry<>("application/json", new ApplicationjsonMediaType()) + ) + ); + } + + @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); + } + + @Override + protected Nothing? getHeaders(HttpHeaders headers, SchemaConfiguration configuration) { + return null; + } + } + + @SuppressWarnings("serial") + public static class ResponseApiException extends ApiException { + public DeserializedHttpResponse deserializedResponse; + + public ResponseApiException(String s, HttpResponse response, DeserializedHttpResponse deserializedResponse) { + super(s, response); + this.deserializedResponse = deserializedResponse; + } + } +} diff --git a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/anotherfakedummy/patch/responses/code200response/content/applicationjson/ApplicationjsonSchema.kt b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/anotherfakedummy/patch/responses/code200response/content/applicationjson/ApplicationjsonSchema.kt new file mode 100644 index 00000000000..8e0f8a56f68 --- /dev/null +++ b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/anotherfakedummy/patch/responses/code200response/content/applicationjson/ApplicationjsonSchema.kt @@ -0,0 +1,19 @@ +package org.openapijsonschematools.client.paths.anotherfakedummy.patch.responses.code200response.content.applicationjson; + +import org.checkerframework.checker.nullness.qual.Nullable; +import org.openapijsonschematools.client.components.schemas.Client; + +public class ApplicationjsonSchema extends Client { + // $refed class + + + public static class ApplicationjsonSchema1 extends Client1 { + private static @Nullable ApplicationjsonSchema1 instance = null; + public static ApplicationjsonSchema1 getInstance() { + if (instance == null) { + instance = new ApplicationjsonSchema1(); + } + return instance; + } + } +} diff --git a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/commonparamsubdir/CommonparamsubdirDelete.kt b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/commonparamsubdir/CommonparamsubdirDelete.kt new file mode 100644 index 00000000000..082ed31af1a --- /dev/null +++ b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/commonparamsubdir/CommonparamsubdirDelete.kt @@ -0,0 +1,205 @@ +package org.openapijsonschematools.client.paths.commonparamsubdir; + +import org.checkerframework.checker.nullness.qual.Nullable; +import org.openapijsonschematools.client.paths.commonparamsubdir.delete.CommonparamsubdirDeleteHeaderParameters; +import org.openapijsonschematools.client.RootServerInfo; +import org.openapijsonschematools.client.paths.commonparamsubdir.delete.CommonparamsubdirDeletePathParameters; +import org.openapijsonschematools.client.paths.commonparamsubdir.delete.Parameters; +import org.openapijsonschematools.client.paths.commonparamsubdir.delete.CommonparamsubdirDeleteResponses; +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.paths.Commonparamsubdir; + +import java.io.IOException; +import java.net.http.HttpClient; +import java.net.http.HttpRequest; +import java.time.Duration; +import java.util.List; +import java.util.Map; + +public class CommonparamsubdirDelete { + private static class DeleteProvider { + private static final String method = "delete"; + + public static CommonparamsubdirDeleteResponses.EndpointResponse delete( + DeleteRequest request, + ApiConfiguration apiConfiguration, + SchemaConfiguration schemaConfiguration, + HttpClient client + ) throws IOException, InterruptedException, ValidationException, NotImplementedException, ApiException { + Map> headers = apiConfiguration.getDefaultHeaders(); + HttpRequest.BodyPublisher bodyPublisher = HttpRequest.BodyPublishers.noBody(); + + if (request.headerParameters != null) { + var headersSerializer = new Parameters.HeaderParametersSerializer(); + Map> serializedHeaders = headersSerializer.serialize(request.headerParameters); + headers.putAll(serializedHeaders); + } + + var pathSerializer = new Parameters.PathParametersSerializer(); + String updatedPath = pathSerializer.serialize(request.pathParameters, Commonparamsubdir.path); + // TODO set this to a map if there is a query security scheme + @Nullable Map queryMap = null; + String host = apiConfiguration.getServer(request.serverIndex).url(); + + String url = host + updatedPath; + var httpRequest = RestClient.getRequest( + url, + method, + bodyPublisher, + headers, + request.timeout + ); + var response = RestClient.getResponse(httpRequest, client); + var responsesDeserializer = new CommonparamsubdirDeleteResponses.CommonparamsubdirDeleteResponses1(); + return responsesDeserializer.deserialize(response, schemaConfiguration); + } + } + + public interface DeleteOperation { + ApiConfiguration getApiConfiguration(); + SchemaConfiguration getSchemaConfiguration(); + HttpClient getClient(); + default CommonparamsubdirDeleteResponses.EndpointResponse delete(DeleteRequest request) throws IOException, InterruptedException, ValidationException, NotImplementedException, ApiException { + return DeleteProvider.delete(request, getApiConfiguration(), getSchemaConfiguration(), getClient()); + } + } + + public interface DeleteCommonParamOperation { + ApiConfiguration getApiConfiguration(); + SchemaConfiguration getSchemaConfiguration(); + HttpClient getClient(); + default CommonparamsubdirDeleteResponses.EndpointResponse deleteCommonParam(DeleteRequest request) throws IOException, InterruptedException, ValidationException, NotImplementedException, ApiException { + return DeleteProvider.delete(request, getApiConfiguration(), getSchemaConfiguration(), getClient()); + } + } + + public static class Delete extends ApiClient implements DeleteOperation { + public Delete(ApiConfiguration apiConfiguration, SchemaConfiguration schemaConfiguration) { + super(apiConfiguration, schemaConfiguration); + } + } + + public static class DeleteRequest { + public CommonparamsubdirDeletePathParameters.PathParametersMap pathParameters; + public CommonparamsubdirDeleteHeaderParameters.@Nullable HeaderParametersMap headerParameters; + public RootServerInfo.@Nullable ServerIndex serverIndex; + public @Nullable Duration timeout; + + public DeleteRequest( + CommonparamsubdirDeletePathParameters.PathParametersMap pathParameters, + CommonparamsubdirDeleteHeaderParameters.@Nullable HeaderParametersMap headerParameters, + RootServerInfo.@Nullable ServerIndex serverIndex, + @Nullable Duration timeout + ) { + this.pathParameters = pathParameters; + this.headerParameters = headerParameters; + this.serverIndex = serverIndex; + this.timeout = timeout; + } + } + + public static class DeleteNullableRequest { + public CommonparamsubdirDeletePathParameters.@Nullable PathParametersMap pathParameters; + public CommonparamsubdirDeleteHeaderParameters.@Nullable HeaderParametersMap headerParameters; + public RootServerInfo.@Nullable ServerIndex serverIndex; + public @Nullable Duration timeout; + } + + public interface SetterForHeaderParameters { + DeleteNullableRequest getInstance(); + T getBuilderAfterHeaderParameters(DeleteNullableRequest instance); + default T headerParameters(CommonparamsubdirDeleteHeaderParameters.HeaderParametersMap headerParameters) { + var instance = getInstance(); + instance.headerParameters = headerParameters; + return getBuilderAfterHeaderParameters(instance); + } + } + + public interface SetterForServerIndex { + DeleteNullableRequest getInstance(); + T getBuilderAfterServerIndex(DeleteNullableRequest instance); + default T serverIndex(RootServerInfo.ServerIndex serverIndex) { + var instance = getInstance(); + instance.serverIndex = serverIndex; + return getBuilderAfterServerIndex(instance); + } + } + + public interface SetterForTimeout { + DeleteNullableRequest getInstance(); + T getBuilderAfterTimeout(DeleteNullableRequest instance); + default T timeout(Duration timeout) { + var instance = getInstance(); + instance.timeout = timeout; + return getBuilderAfterTimeout(instance); + } + } + + public interface SetterForPathParameters { + DeleteNullableRequest getInstance(); + T getBuilderAfterPathParameters(DeleteNullableRequest instance); + default T pathParameters(CommonparamsubdirDeletePathParameters.PathParametersMap pathParameters) { + var instance = getInstance(); + instance.pathParameters = pathParameters; + return getBuilderAfterPathParameters(instance); + } + } + + public static class Delete0RequestBuilder implements SetterForHeaderParameters, SetterForServerIndex, SetterForTimeout { + private final DeleteNullableRequest instance; + + public Delete0RequestBuilder(DeleteNullableRequest instance) { + this.instance = instance; + } + + public DeleteRequest build() { + var pathParameters = instance.pathParameters; + if (pathParameters == null) { + throw new RuntimeException("invalid null value for required parameter"); + } + return new DeleteRequest( + pathParameters, + instance.headerParameters, + instance.serverIndex, + instance.timeout + ); + } + + public DeleteNullableRequest getInstance() { + return instance; + } + + public Delete0RequestBuilder getBuilderAfterHeaderParameters(DeleteNullableRequest instance) { + return this; + } + + public Delete0RequestBuilder getBuilderAfterServerIndex(DeleteNullableRequest instance) { + return this; + } + + public Delete0RequestBuilder getBuilderAfterTimeout(DeleteNullableRequest instance) { + return this; + } + } + public static class DeleteRequestBuilder implements SetterForPathParameters { + private final DeleteNullableRequest instance; + + public DeleteRequestBuilder() { + this.instance = new DeleteNullableRequest(); + } + + public DeleteNullableRequest getInstance() { + return instance; + } + + public Delete0RequestBuilder getBuilderAfterPathParameters(DeleteNullableRequest instance) { + return new Delete0RequestBuilder(instance); + } + } +} diff --git a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/commonparamsubdir/CommonparamsubdirGet.kt b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/commonparamsubdir/CommonparamsubdirGet.kt new file mode 100644 index 00000000000..87ac84e93c4 --- /dev/null +++ b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/commonparamsubdir/CommonparamsubdirGet.kt @@ -0,0 +1,206 @@ +package org.openapijsonschematools.client.paths.commonparamsubdir; + +import org.checkerframework.checker.nullness.qual.Nullable; +import org.openapijsonschematools.client.paths.commonparamsubdir.get.CommonparamsubdirGetQueryParameters; +import org.openapijsonschematools.client.RootServerInfo; +import org.openapijsonschematools.client.paths.commonparamsubdir.get.CommonparamsubdirGetPathParameters; +import org.openapijsonschematools.client.paths.commonparamsubdir.get.Parameters; +import org.openapijsonschematools.client.paths.commonparamsubdir.get.CommonparamsubdirGetResponses; +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.paths.Commonparamsubdir; + +import java.io.IOException; +import java.net.http.HttpClient; +import java.net.http.HttpRequest; +import java.time.Duration; +import java.util.List; +import java.util.Map; + +public class CommonparamsubdirGet { + private static class GetProvider { + private static final String method = "get"; + + public static CommonparamsubdirGetResponses.EndpointResponse get( + GetRequest request, + ApiConfiguration apiConfiguration, + SchemaConfiguration schemaConfiguration, + HttpClient client + ) throws IOException, InterruptedException, ValidationException, NotImplementedException, ApiException { + Map> headers = apiConfiguration.getDefaultHeaders(); + HttpRequest.BodyPublisher bodyPublisher = HttpRequest.BodyPublishers.noBody(); + + var pathSerializer = new Parameters.PathParametersSerializer(); + String updatedPath = pathSerializer.serialize(request.pathParameters, Commonparamsubdir.path); + + var querySerializer = new Parameters.QueryParametersSerializer(); + @Nullable Map queryMap = null; + if (request.queryParameters != null) { + queryMap = querySerializer.getQueryMap(request.queryParameters); + } + String host = apiConfiguration.getServer(request.serverIndex).url(); + + String url = host + updatedPath; + if (queryMap != null) { + url = url + querySerializer.serialize(queryMap); + } + var httpRequest = RestClient.getRequest( + url, + method, + bodyPublisher, + headers, + request.timeout + ); + var response = RestClient.getResponse(httpRequest, client); + var responsesDeserializer = new CommonparamsubdirGetResponses.CommonparamsubdirGetResponses1(); + return responsesDeserializer.deserialize(response, schemaConfiguration); + } + } + + public interface GetOperation { + ApiConfiguration getApiConfiguration(); + SchemaConfiguration getSchemaConfiguration(); + HttpClient getClient(); + default CommonparamsubdirGetResponses.EndpointResponse get(GetRequest request) throws IOException, InterruptedException, ValidationException, NotImplementedException, ApiException { + return GetProvider.get(request, getApiConfiguration(), getSchemaConfiguration(), getClient()); + } + } + + public interface GetCommonParamOperation { + ApiConfiguration getApiConfiguration(); + SchemaConfiguration getSchemaConfiguration(); + HttpClient getClient(); + default CommonparamsubdirGetResponses.EndpointResponse getCommonParam(GetRequest request) throws IOException, InterruptedException, ValidationException, NotImplementedException, ApiException { + return GetProvider.get(request, getApiConfiguration(), getSchemaConfiguration(), getClient()); + } + } + + public static class Get extends ApiClient implements GetOperation { + public Get(ApiConfiguration apiConfiguration, SchemaConfiguration schemaConfiguration) { + super(apiConfiguration, schemaConfiguration); + } + } + + public static class GetRequest { + public CommonparamsubdirGetPathParameters.PathParametersMap pathParameters; + public CommonparamsubdirGetQueryParameters.@Nullable QueryParametersMap queryParameters; + public RootServerInfo.@Nullable ServerIndex serverIndex; + public @Nullable Duration timeout; + + public GetRequest( + CommonparamsubdirGetPathParameters.PathParametersMap pathParameters, + CommonparamsubdirGetQueryParameters.@Nullable QueryParametersMap queryParameters, + RootServerInfo.@Nullable ServerIndex serverIndex, + @Nullable Duration timeout + ) { + this.pathParameters = pathParameters; + this.queryParameters = queryParameters; + this.serverIndex = serverIndex; + this.timeout = timeout; + } + } + + public static class GetNullableRequest { + public CommonparamsubdirGetPathParameters.@Nullable PathParametersMap pathParameters; + public CommonparamsubdirGetQueryParameters.@Nullable QueryParametersMap queryParameters; + public RootServerInfo.@Nullable ServerIndex serverIndex; + public @Nullable Duration timeout; + } + + public interface SetterForQueryParameters { + GetNullableRequest getInstance(); + T getBuilderAfterQueryParameters(GetNullableRequest instance); + default T queryParameters(CommonparamsubdirGetQueryParameters.QueryParametersMap queryParameters) { + var instance = getInstance(); + instance.queryParameters = queryParameters; + return getBuilderAfterQueryParameters(instance); + } + } + + public interface SetterForServerIndex { + GetNullableRequest getInstance(); + T getBuilderAfterServerIndex(GetNullableRequest instance); + default T serverIndex(RootServerInfo.ServerIndex serverIndex) { + var instance = getInstance(); + instance.serverIndex = serverIndex; + return getBuilderAfterServerIndex(instance); + } + } + + public interface SetterForTimeout { + GetNullableRequest getInstance(); + T getBuilderAfterTimeout(GetNullableRequest instance); + default T timeout(Duration timeout) { + var instance = getInstance(); + instance.timeout = timeout; + return getBuilderAfterTimeout(instance); + } + } + + public interface SetterForPathParameters { + GetNullableRequest getInstance(); + T getBuilderAfterPathParameters(GetNullableRequest instance); + default T pathParameters(CommonparamsubdirGetPathParameters.PathParametersMap pathParameters) { + var instance = getInstance(); + instance.pathParameters = pathParameters; + return getBuilderAfterPathParameters(instance); + } + } + + public static class Get0RequestBuilder implements SetterForQueryParameters, SetterForServerIndex, SetterForTimeout { + private final GetNullableRequest instance; + + public Get0RequestBuilder(GetNullableRequest instance) { + this.instance = instance; + } + + public GetRequest build() { + var pathParameters = instance.pathParameters; + if (pathParameters == null) { + throw new RuntimeException("invalid null value for required parameter"); + } + return new GetRequest( + pathParameters, + instance.queryParameters, + instance.serverIndex, + instance.timeout + ); + } + + public GetNullableRequest getInstance() { + return instance; + } + + public Get0RequestBuilder getBuilderAfterQueryParameters(GetNullableRequest instance) { + return this; + } + + public Get0RequestBuilder getBuilderAfterServerIndex(GetNullableRequest instance) { + return this; + } + + public Get0RequestBuilder getBuilderAfterTimeout(GetNullableRequest instance) { + return this; + } + } + public static class GetRequestBuilder implements SetterForPathParameters { + private final GetNullableRequest instance; + + public GetRequestBuilder() { + this.instance = new GetNullableRequest(); + } + + public GetNullableRequest getInstance() { + return instance; + } + + public Get0RequestBuilder getBuilderAfterPathParameters(GetNullableRequest instance) { + return new Get0RequestBuilder(instance); + } + } +} diff --git a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/commonparamsubdir/CommonparamsubdirPost.kt b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/commonparamsubdir/CommonparamsubdirPost.kt new file mode 100644 index 00000000000..82954fa4a74 --- /dev/null +++ b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/commonparamsubdir/CommonparamsubdirPost.kt @@ -0,0 +1,205 @@ +package org.openapijsonschematools.client.paths.commonparamsubdir; + +import org.checkerframework.checker.nullness.qual.Nullable; +import org.openapijsonschematools.client.paths.commonparamsubdir.post.CommonparamsubdirPostHeaderParameters; +import org.openapijsonschematools.client.RootServerInfo; +import org.openapijsonschematools.client.paths.commonparamsubdir.post.CommonparamsubdirPostPathParameters; +import org.openapijsonschematools.client.paths.commonparamsubdir.post.Parameters; +import org.openapijsonschematools.client.paths.commonparamsubdir.post.CommonparamsubdirPostResponses; +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.paths.Commonparamsubdir; + +import java.io.IOException; +import java.net.http.HttpClient; +import java.net.http.HttpRequest; +import java.time.Duration; +import java.util.List; +import java.util.Map; + +public class CommonparamsubdirPost { + private static class PostProvider { + private static final String method = "post"; + + public static CommonparamsubdirPostResponses.EndpointResponse post( + PostRequest request, + ApiConfiguration apiConfiguration, + SchemaConfiguration schemaConfiguration, + HttpClient client + ) throws IOException, InterruptedException, ValidationException, NotImplementedException, ApiException { + Map> headers = apiConfiguration.getDefaultHeaders(); + HttpRequest.BodyPublisher bodyPublisher = HttpRequest.BodyPublishers.noBody(); + + if (request.headerParameters != null) { + var headersSerializer = new Parameters.HeaderParametersSerializer(); + Map> serializedHeaders = headersSerializer.serialize(request.headerParameters); + headers.putAll(serializedHeaders); + } + + var pathSerializer = new Parameters.PathParametersSerializer(); + String updatedPath = pathSerializer.serialize(request.pathParameters, Commonparamsubdir.path); + // TODO set this to a map if there is a query security scheme + @Nullable Map queryMap = null; + String host = apiConfiguration.getServer(request.serverIndex).url(); + + String url = host + updatedPath; + var httpRequest = RestClient.getRequest( + url, + method, + bodyPublisher, + headers, + request.timeout + ); + var response = RestClient.getResponse(httpRequest, client); + var responsesDeserializer = new CommonparamsubdirPostResponses.CommonparamsubdirPostResponses1(); + return responsesDeserializer.deserialize(response, schemaConfiguration); + } + } + + public interface PostOperation { + ApiConfiguration getApiConfiguration(); + SchemaConfiguration getSchemaConfiguration(); + HttpClient getClient(); + default CommonparamsubdirPostResponses.EndpointResponse post(PostRequest request) throws IOException, InterruptedException, ValidationException, NotImplementedException, ApiException { + return PostProvider.post(request, getApiConfiguration(), getSchemaConfiguration(), getClient()); + } + } + + public interface PostCommonParamOperation { + ApiConfiguration getApiConfiguration(); + SchemaConfiguration getSchemaConfiguration(); + HttpClient getClient(); + default CommonparamsubdirPostResponses.EndpointResponse postCommonParam(PostRequest request) throws IOException, InterruptedException, ValidationException, NotImplementedException, ApiException { + return PostProvider.post(request, getApiConfiguration(), getSchemaConfiguration(), getClient()); + } + } + + public static class Post extends ApiClient implements PostOperation { + public Post(ApiConfiguration apiConfiguration, SchemaConfiguration schemaConfiguration) { + super(apiConfiguration, schemaConfiguration); + } + } + + public static class PostRequest { + public CommonparamsubdirPostPathParameters.PathParametersMap pathParameters; + public CommonparamsubdirPostHeaderParameters.@Nullable HeaderParametersMap headerParameters; + public RootServerInfo.@Nullable ServerIndex serverIndex; + public @Nullable Duration timeout; + + public PostRequest( + CommonparamsubdirPostPathParameters.PathParametersMap pathParameters, + CommonparamsubdirPostHeaderParameters.@Nullable HeaderParametersMap headerParameters, + RootServerInfo.@Nullable ServerIndex serverIndex, + @Nullable Duration timeout + ) { + this.pathParameters = pathParameters; + this.headerParameters = headerParameters; + this.serverIndex = serverIndex; + this.timeout = timeout; + } + } + + public static class PostNullableRequest { + public CommonparamsubdirPostPathParameters.@Nullable PathParametersMap pathParameters; + public CommonparamsubdirPostHeaderParameters.@Nullable HeaderParametersMap headerParameters; + public RootServerInfo.@Nullable ServerIndex serverIndex; + public @Nullable Duration timeout; + } + + public interface SetterForHeaderParameters { + PostNullableRequest getInstance(); + T getBuilderAfterHeaderParameters(PostNullableRequest instance); + default T headerParameters(CommonparamsubdirPostHeaderParameters.HeaderParametersMap headerParameters) { + var instance = getInstance(); + instance.headerParameters = headerParameters; + return getBuilderAfterHeaderParameters(instance); + } + } + + public interface SetterForServerIndex { + PostNullableRequest getInstance(); + T getBuilderAfterServerIndex(PostNullableRequest instance); + default T serverIndex(RootServerInfo.ServerIndex serverIndex) { + var instance = getInstance(); + instance.serverIndex = serverIndex; + return getBuilderAfterServerIndex(instance); + } + } + + public interface SetterForTimeout { + PostNullableRequest getInstance(); + T getBuilderAfterTimeout(PostNullableRequest instance); + default T timeout(Duration timeout) { + var instance = getInstance(); + instance.timeout = timeout; + return getBuilderAfterTimeout(instance); + } + } + + public interface SetterForPathParameters { + PostNullableRequest getInstance(); + T getBuilderAfterPathParameters(PostNullableRequest instance); + default T pathParameters(CommonparamsubdirPostPathParameters.PathParametersMap pathParameters) { + var instance = getInstance(); + instance.pathParameters = pathParameters; + return getBuilderAfterPathParameters(instance); + } + } + + public static class Post0RequestBuilder implements SetterForHeaderParameters, SetterForServerIndex, SetterForTimeout { + private final PostNullableRequest instance; + + public Post0RequestBuilder(PostNullableRequest instance) { + this.instance = instance; + } + + public PostRequest build() { + var pathParameters = instance.pathParameters; + if (pathParameters == null) { + throw new RuntimeException("invalid null value for required parameter"); + } + return new PostRequest( + pathParameters, + instance.headerParameters, + instance.serverIndex, + instance.timeout + ); + } + + public PostNullableRequest getInstance() { + return instance; + } + + public Post0RequestBuilder getBuilderAfterHeaderParameters(PostNullableRequest instance) { + return this; + } + + public Post0RequestBuilder getBuilderAfterServerIndex(PostNullableRequest instance) { + return this; + } + + public Post0RequestBuilder getBuilderAfterTimeout(PostNullableRequest instance) { + return this; + } + } + public static class PostRequestBuilder implements SetterForPathParameters { + private final PostNullableRequest instance; + + public PostRequestBuilder() { + this.instance = new PostNullableRequest(); + } + + public PostNullableRequest getInstance() { + return instance; + } + + public Post0RequestBuilder getBuilderAfterPathParameters(PostNullableRequest instance) { + return new Post0RequestBuilder(instance); + } + } +} diff --git a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/commonparamsubdir/delete/CommonparamsubdirDeleteHeaderParameters.kt b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/commonparamsubdir/delete/CommonparamsubdirDeleteHeaderParameters.kt new file mode 100644 index 00000000000..4eeec2ff8d9 --- /dev/null +++ b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/commonparamsubdir/delete/CommonparamsubdirDeleteHeaderParameters.kt @@ -0,0 +1,191 @@ +package org.openapijsonschematools.client.paths.commonparamsubdir.delete; +import java.util.ArrayList; +import java.util.HashSet; +import java.util.LinkedHashMap; +import java.util.LinkedHashSet; +import java.util.List; +import java.util.Map; +import java.util.Objects; +import java.util.Set; +import org.checkerframework.checker.nullness.qual.Nullable; +import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags; +import org.openapijsonschematools.client.configurations.SchemaConfiguration; +import org.openapijsonschematools.client.exceptions.UnsetPropertyException; +import org.openapijsonschematools.client.exceptions.ValidationException; +import org.openapijsonschematools.client.paths.commonparamsubdir.delete.parameters.parameter0.Schema0; +import org.openapijsonschematools.client.schemas.AnyTypeJsonSchema; +import org.openapijsonschematools.client.schemas.GenericBuilder; +import org.openapijsonschematools.client.schemas.NotAnyTypeJsonSchema; +import org.openapijsonschematools.client.schemas.validation.FrozenMap; +import org.openapijsonschematools.client.schemas.validation.JsonSchema; +import org.openapijsonschematools.client.schemas.validation.JsonSchemaInfo; +import org.openapijsonschematools.client.schemas.validation.MapSchemaValidator; +import org.openapijsonschematools.client.schemas.validation.MapUtils; +import org.openapijsonschematools.client.schemas.validation.PathToSchemasMap; +import org.openapijsonschematools.client.schemas.validation.PropertyEntry; +import org.openapijsonschematools.client.schemas.validation.ValidationMetadata; + +public class CommonparamsubdirDeleteHeaderParameters { + // nest classes so all schemas and input/output classes can be public + + + public static class AdditionalProperties extends NotAnyTypeJsonSchema.NotAnyTypeJsonSchema1 { + // NotAnyTypeSchema + private static @Nullable AdditionalProperties instance = null; + public static AdditionalProperties getInstance() { + if (instance == null) { + instance = new AdditionalProperties(); + } + return instance; + } + } + + + public static class HeaderParametersMap extends FrozenMap { + protected HeaderParametersMap(FrozenMap m) { + super(m); + } + public static final Set requiredKeys = Set.of(); + public static final Set optionalKeys = Set.of( + "someHeader" + ); + public static HeaderParametersMap of(Map arg, SchemaConfiguration configuration) throws ValidationException { + return CommonparamsubdirDeleteHeaderParameters1.getInstance().validate(arg, configuration); + } + + public String someHeader() throws UnsetPropertyException { + return getOrThrow("someHeader"); + } + } + + public interface SetterForSomeHeader { + Map getInstance(); + T getBuilderAfterSomeHeader(Map instance); + + default T someHeader(String value) { + var instance = getInstance(); + instance.put("someHeader", value); + return getBuilderAfterSomeHeader(instance); + } + } + + public static class HeaderParametersMapBuilder implements GenericBuilder>, SetterForSomeHeader { + private final Map instance; + private static final Set knownKeys = Set.of( + "someHeader" + ); + public Set getKnownKeys() { + return knownKeys; + } + public HeaderParametersMapBuilder() { + this.instance = new LinkedHashMap<>(); + } + public Map build() { + return instance; + } + public Map getInstance() { + return instance; + } + public HeaderParametersMapBuilder getBuilderAfterSomeHeader(Map instance) { + return this; + } + } + + + public sealed interface CommonparamsubdirDeleteHeaderParameters1Boxed permits CommonparamsubdirDeleteHeaderParameters1BoxedMap { + @Nullable Object getData(); + } + + public record CommonparamsubdirDeleteHeaderParameters1BoxedMap(HeaderParametersMap data) implements CommonparamsubdirDeleteHeaderParameters1Boxed { + @Override + public @Nullable Object getData() { + return data; + } + } + + + public static class CommonparamsubdirDeleteHeaderParameters1 extends JsonSchema implements MapSchemaValidator { + private static @Nullable CommonparamsubdirDeleteHeaderParameters1 instance = null; + + protected CommonparamsubdirDeleteHeaderParameters1() { + super(new JsonSchemaInfo() + .type(Set.of(Map.class)) + .properties(Map.ofEntries( + new PropertyEntry("someHeader", Schema0.Schema01.class) + )) + .additionalProperties(AdditionalProperties.class) + ); + } + + public static CommonparamsubdirDeleteHeaderParameters1 getInstance() { + if (instance == null) { + instance = new CommonparamsubdirDeleteHeaderParameters1(); + } + return instance; + } + + 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 RuntimeException("Invalid non-string key value"); + } + String propertyName = (String) entryKey; + List propertyPathToItem = new ArrayList<>(pathToItem); + propertyPathToItem.add(propertyName); + Object value = entry.getValue(); + LinkedHashMap, Nothing?> schemas = pathToSchemas.get(propertyPathToItem); + if (schemas == null) { + throw new RuntimeException("Validation 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"); + } + properties.put(propertyName, (String) propertyInstance); + } + FrozenMap castProperties = new FrozenMap<>(properties); + return new HeaderParametersMap(castProperties); + } + + 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); + SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().build())); + ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, new PathToSchemasMap(), new LinkedHashSet<>()); + PathToSchemasMap pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet); + return getNewInstance(castArg, validationMetadata.pathToItem(), pathToSchemasMap); + } + + + @Override + public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws 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"); + } + @Override + public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { + if (arg instanceof Map) { + return getNewInstance((Map) arg, pathToItem, pathToSchemas); + } + throw new RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); + } + @Override + public CommonparamsubdirDeleteHeaderParameters1BoxedMap validateAndBox(Map arg, SchemaConfiguration configuration) throws ValidationException { + return new CommonparamsubdirDeleteHeaderParameters1BoxedMap(validate(arg, configuration)); + } + @Override + public CommonparamsubdirDeleteHeaderParameters1Boxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { + 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"); + } + } + +} diff --git a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/commonparamsubdir/delete/CommonparamsubdirDeletePathParameters.kt b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/commonparamsubdir/delete/CommonparamsubdirDeletePathParameters.kt new file mode 100644 index 00000000000..d8aa1e6e637 --- /dev/null +++ b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/commonparamsubdir/delete/CommonparamsubdirDeletePathParameters.kt @@ -0,0 +1,211 @@ +package org.openapijsonschematools.client.paths.commonparamsubdir.delete; +import java.util.ArrayList; +import java.util.HashSet; +import java.util.LinkedHashMap; +import java.util.LinkedHashSet; +import java.util.List; +import java.util.Map; +import java.util.Objects; +import java.util.Set; +import org.checkerframework.checker.nullness.qual.Nullable; +import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags; +import org.openapijsonschematools.client.configurations.SchemaConfiguration; +import org.openapijsonschematools.client.exceptions.UnsetPropertyException; +import org.openapijsonschematools.client.exceptions.ValidationException; +import org.openapijsonschematools.client.paths.commonparamsubdir.delete.parameters.parameter1.Schema1; +import org.openapijsonschematools.client.schemas.AnyTypeJsonSchema; +import org.openapijsonschematools.client.schemas.GenericBuilder; +import org.openapijsonschematools.client.schemas.NotAnyTypeJsonSchema; +import org.openapijsonschematools.client.schemas.validation.FrozenMap; +import org.openapijsonschematools.client.schemas.validation.JsonSchema; +import org.openapijsonschematools.client.schemas.validation.JsonSchemaInfo; +import org.openapijsonschematools.client.schemas.validation.MapSchemaValidator; +import org.openapijsonschematools.client.schemas.validation.MapUtils; +import org.openapijsonschematools.client.schemas.validation.PathToSchemasMap; +import org.openapijsonschematools.client.schemas.validation.PropertyEntry; +import org.openapijsonschematools.client.schemas.validation.ValidationMetadata; + +public class CommonparamsubdirDeletePathParameters { + // nest classes so all schemas and input/output classes can be public + + + public static class AdditionalProperties extends NotAnyTypeJsonSchema.NotAnyTypeJsonSchema1 { + // NotAnyTypeSchema + private static @Nullable AdditionalProperties instance = null; + public static AdditionalProperties getInstance() { + if (instance == null) { + instance = new AdditionalProperties(); + } + return instance; + } + } + + + public static class PathParametersMap extends FrozenMap { + protected PathParametersMap(FrozenMap m) { + super(m); + } + public static final Set requiredKeys = Set.of( + "subDir" + ); + public static final Set optionalKeys = Set.of(); + public static PathParametersMap of(Map arg, SchemaConfiguration configuration) throws ValidationException { + return CommonparamsubdirDeletePathParameters1.getInstance().validate(arg, configuration); + } + + public String subDir() { + try { + return getOrThrow("version"); + } catch (UnsetPropertyException e) { + throw new RuntimeException(e); + } + } + } + + public interface SetterForSubDir { + Map getInstance(); + T getBuilderAfterSubDir(Map instance); + + default T subDir(String value) { + var instance = getInstance(); + instance.put("subDir", value); + return getBuilderAfterSubDir(instance); + } + + default T subDir(Schema1.StringSchemaEnums1 value) { + var instance = getInstance(); + instance.put("subDir", value.value()); + return getBuilderAfterSubDir(instance); + } + } + + public static class PathParametersMap0Builder implements GenericBuilder> { + private final Map instance; + private static final Set knownKeys = Set.of( + "subDir" + ); + public Set getKnownKeys() { + return knownKeys; + } + public PathParametersMap0Builder(Map instance) { + this.instance = instance; + } + public Map build() { + return instance; + } + } + + public static class PathParametersMapBuilder implements SetterForSubDir { + private final Map instance; + public PathParametersMapBuilder() { + this.instance = new LinkedHashMap<>(); + } + public Map getInstance() { + return instance; + } + public PathParametersMap0Builder getBuilderAfterSubDir(Map instance) { + return new PathParametersMap0Builder(instance); + } + } + + + public sealed interface CommonparamsubdirDeletePathParameters1Boxed permits CommonparamsubdirDeletePathParameters1BoxedMap { + @Nullable Object getData(); + } + + public record CommonparamsubdirDeletePathParameters1BoxedMap(PathParametersMap data) implements CommonparamsubdirDeletePathParameters1Boxed { + @Override + public @Nullable Object getData() { + return data; + } + } + + + public static class CommonparamsubdirDeletePathParameters1 extends JsonSchema implements MapSchemaValidator { + private static @Nullable CommonparamsubdirDeletePathParameters1 instance = null; + + protected CommonparamsubdirDeletePathParameters1() { + super(new JsonSchemaInfo() + .type(Set.of(Map.class)) + .properties(Map.ofEntries( + new PropertyEntry("subDir", Schema1.Schema11.class) + )) + .required(Set.of( + "subDir" + )) + .additionalProperties(AdditionalProperties.class) + ); + } + + public static CommonparamsubdirDeletePathParameters1 getInstance() { + if (instance == null) { + instance = new CommonparamsubdirDeletePathParameters1(); + } + return instance; + } + + 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 RuntimeException("Invalid non-string key value"); + } + String propertyName = (String) entryKey; + List propertyPathToItem = new ArrayList<>(pathToItem); + propertyPathToItem.add(propertyName); + Object value = entry.getValue(); + LinkedHashMap, Nothing?> schemas = pathToSchemas.get(propertyPathToItem); + if (schemas == null) { + throw new RuntimeException("Validation 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"); + } + properties.put(propertyName, (String) propertyInstance); + } + FrozenMap castProperties = new FrozenMap<>(properties); + return new PathParametersMap(castProperties); + } + + 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); + SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().build())); + ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, new PathToSchemasMap(), new LinkedHashSet<>()); + PathToSchemasMap pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet); + return getNewInstance(castArg, validationMetadata.pathToItem(), pathToSchemasMap); + } + + + @Override + public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws 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"); + } + @Override + public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { + if (arg instanceof Map) { + return getNewInstance((Map) arg, pathToItem, pathToSchemas); + } + throw new RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); + } + @Override + public CommonparamsubdirDeletePathParameters1BoxedMap validateAndBox(Map arg, SchemaConfiguration configuration) throws ValidationException { + return new CommonparamsubdirDeletePathParameters1BoxedMap(validate(arg, configuration)); + } + @Override + public CommonparamsubdirDeletePathParameters1Boxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { + 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"); + } + } + +} diff --git a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/commonparamsubdir/delete/CommonparamsubdirDeleteResponses.kt b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/commonparamsubdir/delete/CommonparamsubdirDeleteResponses.kt new file mode 100644 index 00000000000..e7eb08de6dc --- /dev/null +++ b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/commonparamsubdir/delete/CommonparamsubdirDeleteResponses.kt @@ -0,0 +1,53 @@ +package org.openapijsonschematools.client.paths.commonparamsubdir.delete; + +import org.openapijsonschematools.client.paths.commonparamsubdir.delete.responses.CommonparamsubdirDeleteCode200Response; +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; +import org.checkerframework.checker.nullness.qual.Nullable; + +import java.net.http.HttpResponse; +import java.util.Map; +import java.util.AbstractMap; + +public class CommonparamsubdirDeleteResponses { + public sealed interface EndpointResponse permits EndpointCommonparamsubdirDeleteCode200Response {} + + public record EndpointCommonparamsubdirDeleteCode200Response( + HttpResponse response, + Nothing? body, + Nothing? headers + ) implements EndpointResponse, ApiResponse{ + } + + public sealed interface StatusCodeResponseDeserializer permits StatusCommonparamsubdirDeleteCode200ResponseDeserializer {} + + public static final class StatusCommonparamsubdirDeleteCode200ResponseDeserializer extends CommonparamsubdirDeleteCode200Response.CommonparamsubdirDeleteCode200Response1 implements StatusCodeResponseDeserializer { + } + + public static final class CommonparamsubdirDeleteResponses1 implements ResponsesDeserializer { + private final Map statusCodeToResponseDeserializer; + public CommonparamsubdirDeleteResponses1() { + this.statusCodeToResponseDeserializer = Map.ofEntries( + new AbstractMap.SimpleEntry<>("200", new StatusCommonparamsubdirDeleteCode200ResponseDeserializer()) + ); + } + + 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) { + throw new ApiException( + "Invalid response statusCode="+statusCode+" has no response defined in the openapi document", + response + ); + } + StatusCommonparamsubdirDeleteCode200ResponseDeserializer castDeserializer = (StatusCommonparamsubdirDeleteCode200ResponseDeserializer) statusCodeDeserializer; + var deserializedResponse = castDeserializer.deserialize(response, configuration); + return new EndpointCommonparamsubdirDeleteCode200Response(response, deserializedResponse.body(), deserializedResponse.headers()); + } + } +} diff --git a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/commonparamsubdir/delete/Parameters.kt b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/commonparamsubdir/delete/Parameters.kt new file mode 100644 index 00000000000..361ce042d3a --- /dev/null +++ b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/commonparamsubdir/delete/Parameters.kt @@ -0,0 +1,32 @@ +package org.openapijsonschematools.client.paths.commonparamsubdir.delete; + +import org.openapijsonschematools.client.paths.commonparamsubdir.delete.parameters.Parameter0; +import org.openapijsonschematools.client.paths.commonparamsubdir.delete.parameters.Parameter1; +import org.openapijsonschematools.client.parameter.PathSerializer; +import org.openapijsonschematools.client.parameter.HeadersSerializer; + +import java.util.Map; +import java.util.AbstractMap; + +public class Parameters { + + public static class PathParametersSerializer extends PathSerializer { + public PathParametersSerializer() { + super( + Map.ofEntries( + new AbstractMap.SimpleEntry<>("subDir", new Parameter1.Parameter11()) + ) + ); + } + } + + public static class HeaderParametersSerializer extends HeadersSerializer { + public HeaderParametersSerializer() { + super( + Map.ofEntries( + new AbstractMap.SimpleEntry<>("someHeader", new Parameter0.Parameter01()) + ) + ); + } + } +} diff --git a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/commonparamsubdir/delete/parameters/Parameter0.kt b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/commonparamsubdir/delete/parameters/Parameter0.kt new file mode 100644 index 00000000000..1385ce8e488 --- /dev/null +++ b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/commonparamsubdir/delete/parameters/Parameter0.kt @@ -0,0 +1,23 @@ +package org.openapijsonschematools.client.paths.commonparamsubdir.delete.parameters; + +import org.openapijsonschematools.client.parameter.ParameterStyle; +import org.openapijsonschematools.client.parameter.ParameterInType; +import org.openapijsonschematools.client.parameter.SchemaParameter; +import org.openapijsonschematools.client.paths.commonparamsubdir.delete.parameters.parameter0.Schema0; + +public class Parameter0 { + + public static class Parameter01 extends SchemaParameter { + public Parameter01() { + super( + "someHeader", + ParameterInType.HEADER, + false, + ParameterStyle.SIMPLE, + false, + false, + Schema0.Schema01.getInstance() + ); + } + } +} diff --git a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/commonparamsubdir/delete/parameters/Parameter1.kt b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/commonparamsubdir/delete/parameters/Parameter1.kt new file mode 100644 index 00000000000..13efa3b6c1d --- /dev/null +++ b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/commonparamsubdir/delete/parameters/Parameter1.kt @@ -0,0 +1,23 @@ +package org.openapijsonschematools.client.paths.commonparamsubdir.delete.parameters; + +import org.openapijsonschematools.client.parameter.ParameterStyle; +import org.openapijsonschematools.client.parameter.ParameterInType; +import org.openapijsonschematools.client.parameter.SchemaParameter; +import org.openapijsonschematools.client.paths.commonparamsubdir.delete.parameters.parameter1.Schema1; + +public class Parameter1 { + + public static class Parameter11 extends SchemaParameter { + public Parameter11() { + super( + "subDir", + ParameterInType.PATH, + true, + ParameterStyle.SIMPLE, + false, + false, + Schema1.Schema11.getInstance() + ); + } + } +} diff --git a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/commonparamsubdir/delete/parameters/parameter0/Schema0.kt b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/commonparamsubdir/delete/parameters/parameter0/Schema0.kt new file mode 100644 index 00000000000..a3f940b6e0e --- /dev/null +++ b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/commonparamsubdir/delete/parameters/parameter0/Schema0.kt @@ -0,0 +1,19 @@ +package org.openapijsonschematools.client.paths.commonparamsubdir.delete.parameters.parameter0; +import org.checkerframework.checker.nullness.qual.Nullable; +import org.openapijsonschematools.client.schemas.StringJsonSchema; + +public class Schema0 extends StringJsonSchema { + // nest classes so all schemas and input/output classes can be public + + + public static class Schema01 extends StringJsonSchema.StringJsonSchema1 { + private static @Nullable Schema01 instance = null; + public static Schema01 getInstance() { + if (instance == null) { + instance = new Schema01(); + } + return instance; + } + } + +} diff --git a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/commonparamsubdir/delete/parameters/parameter1/Schema1.kt b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/commonparamsubdir/delete/parameters/parameter1/Schema1.kt new file mode 100644 index 00000000000..5e27e6693ae --- /dev/null +++ b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/commonparamsubdir/delete/parameters/parameter1/Schema1.kt @@ -0,0 +1,114 @@ +package org.openapijsonschematools.client.paths.commonparamsubdir.delete.parameters.parameter1; +import java.util.HashSet; +import java.util.LinkedHashSet; +import java.util.List; +import java.util.Objects; +import java.util.Set; +import org.checkerframework.checker.nullness.qual.Nullable; +import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags; +import org.openapijsonschematools.client.configurations.SchemaConfiguration; +import org.openapijsonschematools.client.exceptions.ValidationException; +import org.openapijsonschematools.client.schemas.SetMaker; +import org.openapijsonschematools.client.schemas.validation.JsonSchema; +import org.openapijsonschematools.client.schemas.validation.JsonSchemaInfo; +import org.openapijsonschematools.client.schemas.validation.PathToSchemasMap; +import org.openapijsonschematools.client.schemas.validation.StringEnumValidator; +import org.openapijsonschematools.client.schemas.validation.StringSchemaValidator; +import org.openapijsonschematools.client.schemas.validation.StringValueMethod; +import org.openapijsonschematools.client.schemas.validation.ValidationMetadata; + +public class Schema1 { + // nest classes so all schemas and input/output classes can be public + + public enum StringSchemaEnums1 implements StringValueMethod { + C("c"), + D("d"); + private final String value; + + StringSchemaEnums1(String value) { + this.value = value; + } + public String value() { + return this.value; + } + } + + + public sealed interface Schema11Boxed permits Schema11BoxedString { + @Nullable Object getData(); + } + + public record Schema11BoxedString(String data) implements Schema11Boxed { + @Override + public @Nullable Object getData() { + return data; + } + } + + + + public static class Schema11 extends JsonSchema implements StringSchemaValidator, StringEnumValidator { + private static @Nullable Schema11 instance = null; + + protected Schema11() { + super(new JsonSchemaInfo() + .type(Set.of( + String.class + )) + .enumValues(SetMaker.makeSet( + "c", + "d" + )) + ); + } + + public static Schema11 getInstance() { + if (instance == null) { + instance = new Schema11(); + } + return instance; + } + + @Override + public String validate(String arg, SchemaConfiguration configuration) throws ValidationException { + Set> pathSet = new HashSet<>(); + List pathToItem = List.of("args[0"); + String castArg = castToAllowedTypes(arg, pathToItem, pathSet); + SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().build())); + ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, new PathToSchemasMap(), new LinkedHashSet<>()); + getPathToSchemas(this, castArg, validationMetadata, pathSet); + return castArg; + } + + @Override + 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 { + 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"); + } + @Override + public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { + 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"); + } + @Override + 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 { + 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"); + } + } +} diff --git a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/commonparamsubdir/delete/responses/CommonparamsubdirDeleteCode200Response.kt b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/commonparamsubdir/delete/responses/CommonparamsubdirDeleteCode200Response.kt new file mode 100644 index 00000000000..ed6bcceb216 --- /dev/null +++ b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/commonparamsubdir/delete/responses/CommonparamsubdirDeleteCode200Response.kt @@ -0,0 +1,7 @@ +package org.openapijsonschematools.client.paths.commonparamsubdir.delete.responses; + +import org.openapijsonschematools.client.components.responses.SuccessDescriptionOnly; + +public class CommonparamsubdirDeleteCode200Response extends SuccessDescriptionOnly { + public static class CommonparamsubdirDeleteCode200Response1 extends SuccessDescriptionOnly1 {} +} diff --git a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/commonparamsubdir/get/CommonparamsubdirGetPathParameters.kt b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/commonparamsubdir/get/CommonparamsubdirGetPathParameters.kt new file mode 100644 index 00000000000..caace3d1041 --- /dev/null +++ b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/commonparamsubdir/get/CommonparamsubdirGetPathParameters.kt @@ -0,0 +1,211 @@ +package org.openapijsonschematools.client.paths.commonparamsubdir.get; +import java.util.ArrayList; +import java.util.HashSet; +import java.util.LinkedHashMap; +import java.util.LinkedHashSet; +import java.util.List; +import java.util.Map; +import java.util.Objects; +import java.util.Set; +import org.checkerframework.checker.nullness.qual.Nullable; +import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags; +import org.openapijsonschematools.client.configurations.SchemaConfiguration; +import org.openapijsonschematools.client.exceptions.UnsetPropertyException; +import org.openapijsonschematools.client.exceptions.ValidationException; +import org.openapijsonschematools.client.paths.commonparamsubdir.parameters.routeparameter0.RouteParamSchema0; +import org.openapijsonschematools.client.schemas.AnyTypeJsonSchema; +import org.openapijsonschematools.client.schemas.GenericBuilder; +import org.openapijsonschematools.client.schemas.NotAnyTypeJsonSchema; +import org.openapijsonschematools.client.schemas.validation.FrozenMap; +import org.openapijsonschematools.client.schemas.validation.JsonSchema; +import org.openapijsonschematools.client.schemas.validation.JsonSchemaInfo; +import org.openapijsonschematools.client.schemas.validation.MapSchemaValidator; +import org.openapijsonschematools.client.schemas.validation.MapUtils; +import org.openapijsonschematools.client.schemas.validation.PathToSchemasMap; +import org.openapijsonschematools.client.schemas.validation.PropertyEntry; +import org.openapijsonschematools.client.schemas.validation.ValidationMetadata; + +public class CommonparamsubdirGetPathParameters { + // nest classes so all schemas and input/output classes can be public + + + public static class AdditionalProperties extends NotAnyTypeJsonSchema.NotAnyTypeJsonSchema1 { + // NotAnyTypeSchema + private static @Nullable AdditionalProperties instance = null; + public static AdditionalProperties getInstance() { + if (instance == null) { + instance = new AdditionalProperties(); + } + return instance; + } + } + + + public static class PathParametersMap extends FrozenMap { + protected PathParametersMap(FrozenMap m) { + super(m); + } + public static final Set requiredKeys = Set.of( + "subDir" + ); + public static final Set optionalKeys = Set.of(); + public static PathParametersMap of(Map arg, SchemaConfiguration configuration) throws ValidationException { + return CommonparamsubdirGetPathParameters1.getInstance().validate(arg, configuration); + } + + public String subDir() { + try { + return getOrThrow("version"); + } catch (UnsetPropertyException e) { + throw new RuntimeException(e); + } + } + } + + public interface SetterForSubDir { + Map getInstance(); + T getBuilderAfterSubDir(Map instance); + + default T subDir(String value) { + var instance = getInstance(); + instance.put("subDir", value); + return getBuilderAfterSubDir(instance); + } + + default T subDir(RouteParamSchema0.StringRouteParamSchemaEnums0 value) { + var instance = getInstance(); + instance.put("subDir", value.value()); + return getBuilderAfterSubDir(instance); + } + } + + public static class PathParametersMap0Builder implements GenericBuilder> { + private final Map instance; + private static final Set knownKeys = Set.of( + "subDir" + ); + public Set getKnownKeys() { + return knownKeys; + } + public PathParametersMap0Builder(Map instance) { + this.instance = instance; + } + public Map build() { + return instance; + } + } + + public static class PathParametersMapBuilder implements SetterForSubDir { + private final Map instance; + public PathParametersMapBuilder() { + this.instance = new LinkedHashMap<>(); + } + public Map getInstance() { + return instance; + } + public PathParametersMap0Builder getBuilderAfterSubDir(Map instance) { + return new PathParametersMap0Builder(instance); + } + } + + + public sealed interface CommonparamsubdirGetPathParameters1Boxed permits CommonparamsubdirGetPathParameters1BoxedMap { + @Nullable Object getData(); + } + + public record CommonparamsubdirGetPathParameters1BoxedMap(PathParametersMap data) implements CommonparamsubdirGetPathParameters1Boxed { + @Override + public @Nullable Object getData() { + return data; + } + } + + + public static class CommonparamsubdirGetPathParameters1 extends JsonSchema implements MapSchemaValidator { + private static @Nullable CommonparamsubdirGetPathParameters1 instance = null; + + protected CommonparamsubdirGetPathParameters1() { + super(new JsonSchemaInfo() + .type(Set.of(Map.class)) + .properties(Map.ofEntries( + new PropertyEntry("subDir", RouteParamSchema0.RouteParamSchema01.class) + )) + .required(Set.of( + "subDir" + )) + .additionalProperties(AdditionalProperties.class) + ); + } + + public static CommonparamsubdirGetPathParameters1 getInstance() { + if (instance == null) { + instance = new CommonparamsubdirGetPathParameters1(); + } + return instance; + } + + 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 RuntimeException("Invalid non-string key value"); + } + String propertyName = (String) entryKey; + List propertyPathToItem = new ArrayList<>(pathToItem); + propertyPathToItem.add(propertyName); + Object value = entry.getValue(); + LinkedHashMap, Nothing?> schemas = pathToSchemas.get(propertyPathToItem); + if (schemas == null) { + throw new RuntimeException("Validation 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"); + } + properties.put(propertyName, (String) propertyInstance); + } + FrozenMap castProperties = new FrozenMap<>(properties); + return new PathParametersMap(castProperties); + } + + 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); + SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().build())); + ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, new PathToSchemasMap(), new LinkedHashSet<>()); + PathToSchemasMap pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet); + return getNewInstance(castArg, validationMetadata.pathToItem(), pathToSchemasMap); + } + + + @Override + public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws 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"); + } + @Override + public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { + if (arg instanceof Map) { + return getNewInstance((Map) arg, pathToItem, pathToSchemas); + } + throw new RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); + } + @Override + public CommonparamsubdirGetPathParameters1BoxedMap validateAndBox(Map arg, SchemaConfiguration configuration) throws ValidationException { + return new CommonparamsubdirGetPathParameters1BoxedMap(validate(arg, configuration)); + } + @Override + public CommonparamsubdirGetPathParameters1Boxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { + 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"); + } + } + +} diff --git a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/commonparamsubdir/get/CommonparamsubdirGetQueryParameters.kt b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/commonparamsubdir/get/CommonparamsubdirGetQueryParameters.kt new file mode 100644 index 00000000000..194dbc8ba22 --- /dev/null +++ b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/commonparamsubdir/get/CommonparamsubdirGetQueryParameters.kt @@ -0,0 +1,191 @@ +package org.openapijsonschematools.client.paths.commonparamsubdir.get; +import java.util.ArrayList; +import java.util.HashSet; +import java.util.LinkedHashMap; +import java.util.LinkedHashSet; +import java.util.List; +import java.util.Map; +import java.util.Objects; +import java.util.Set; +import org.checkerframework.checker.nullness.qual.Nullable; +import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags; +import org.openapijsonschematools.client.configurations.SchemaConfiguration; +import org.openapijsonschematools.client.exceptions.UnsetPropertyException; +import org.openapijsonschematools.client.exceptions.ValidationException; +import org.openapijsonschematools.client.paths.commonparamsubdir.get.parameters.parameter0.Schema0; +import org.openapijsonschematools.client.schemas.AnyTypeJsonSchema; +import org.openapijsonschematools.client.schemas.GenericBuilder; +import org.openapijsonschematools.client.schemas.NotAnyTypeJsonSchema; +import org.openapijsonschematools.client.schemas.validation.FrozenMap; +import org.openapijsonschematools.client.schemas.validation.JsonSchema; +import org.openapijsonschematools.client.schemas.validation.JsonSchemaInfo; +import org.openapijsonschematools.client.schemas.validation.MapSchemaValidator; +import org.openapijsonschematools.client.schemas.validation.MapUtils; +import org.openapijsonschematools.client.schemas.validation.PathToSchemasMap; +import org.openapijsonschematools.client.schemas.validation.PropertyEntry; +import org.openapijsonschematools.client.schemas.validation.ValidationMetadata; + +public class CommonparamsubdirGetQueryParameters { + // nest classes so all schemas and input/output classes can be public + + + public static class AdditionalProperties extends NotAnyTypeJsonSchema.NotAnyTypeJsonSchema1 { + // NotAnyTypeSchema + private static @Nullable AdditionalProperties instance = null; + public static AdditionalProperties getInstance() { + if (instance == null) { + instance = new AdditionalProperties(); + } + return instance; + } + } + + + public static class QueryParametersMap extends FrozenMap { + protected QueryParametersMap(FrozenMap m) { + super(m); + } + public static final Set requiredKeys = Set.of(); + public static final Set optionalKeys = Set.of( + "searchStr" + ); + public static QueryParametersMap of(Map arg, SchemaConfiguration configuration) throws ValidationException { + return CommonparamsubdirGetQueryParameters1.getInstance().validate(arg, configuration); + } + + public String searchStr() throws UnsetPropertyException { + return getOrThrow("searchStr"); + } + } + + public interface SetterForSearchStr { + Map getInstance(); + T getBuilderAfterSearchStr(Map instance); + + default T searchStr(String value) { + var instance = getInstance(); + instance.put("searchStr", value); + return getBuilderAfterSearchStr(instance); + } + } + + public static class QueryParametersMapBuilder implements GenericBuilder>, SetterForSearchStr { + private final Map instance; + private static final Set knownKeys = Set.of( + "searchStr" + ); + public Set getKnownKeys() { + return knownKeys; + } + public QueryParametersMapBuilder() { + this.instance = new LinkedHashMap<>(); + } + public Map build() { + return instance; + } + public Map getInstance() { + return instance; + } + public QueryParametersMapBuilder getBuilderAfterSearchStr(Map instance) { + return this; + } + } + + + public sealed interface CommonparamsubdirGetQueryParameters1Boxed permits CommonparamsubdirGetQueryParameters1BoxedMap { + @Nullable Object getData(); + } + + public record CommonparamsubdirGetQueryParameters1BoxedMap(QueryParametersMap data) implements CommonparamsubdirGetQueryParameters1Boxed { + @Override + public @Nullable Object getData() { + return data; + } + } + + + public static class CommonparamsubdirGetQueryParameters1 extends JsonSchema implements MapSchemaValidator { + private static @Nullable CommonparamsubdirGetQueryParameters1 instance = null; + + protected CommonparamsubdirGetQueryParameters1() { + super(new JsonSchemaInfo() + .type(Set.of(Map.class)) + .properties(Map.ofEntries( + new PropertyEntry("searchStr", Schema0.Schema01.class) + )) + .additionalProperties(AdditionalProperties.class) + ); + } + + public static CommonparamsubdirGetQueryParameters1 getInstance() { + if (instance == null) { + instance = new CommonparamsubdirGetQueryParameters1(); + } + return instance; + } + + 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 RuntimeException("Invalid non-string key value"); + } + String propertyName = (String) entryKey; + List propertyPathToItem = new ArrayList<>(pathToItem); + propertyPathToItem.add(propertyName); + Object value = entry.getValue(); + LinkedHashMap, Nothing?> schemas = pathToSchemas.get(propertyPathToItem); + if (schemas == null) { + throw new RuntimeException("Validation 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"); + } + properties.put(propertyName, (String) propertyInstance); + } + FrozenMap castProperties = new FrozenMap<>(properties); + return new QueryParametersMap(castProperties); + } + + 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); + SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().build())); + ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, new PathToSchemasMap(), new LinkedHashSet<>()); + PathToSchemasMap pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet); + return getNewInstance(castArg, validationMetadata.pathToItem(), pathToSchemasMap); + } + + + @Override + public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws 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"); + } + @Override + public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { + if (arg instanceof Map) { + return getNewInstance((Map) arg, pathToItem, pathToSchemas); + } + throw new RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); + } + @Override + public CommonparamsubdirGetQueryParameters1BoxedMap validateAndBox(Map arg, SchemaConfiguration configuration) throws ValidationException { + return new CommonparamsubdirGetQueryParameters1BoxedMap(validate(arg, configuration)); + } + @Override + public CommonparamsubdirGetQueryParameters1Boxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { + 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"); + } + } + +} diff --git a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/commonparamsubdir/get/CommonparamsubdirGetResponses.kt b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/commonparamsubdir/get/CommonparamsubdirGetResponses.kt new file mode 100644 index 00000000000..32e81e43751 --- /dev/null +++ b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/commonparamsubdir/get/CommonparamsubdirGetResponses.kt @@ -0,0 +1,53 @@ +package org.openapijsonschematools.client.paths.commonparamsubdir.get; + +import org.openapijsonschematools.client.paths.commonparamsubdir.get.responses.CommonparamsubdirGetCode200Response; +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; +import org.checkerframework.checker.nullness.qual.Nullable; + +import java.net.http.HttpResponse; +import java.util.Map; +import java.util.AbstractMap; + +public class CommonparamsubdirGetResponses { + public sealed interface EndpointResponse permits EndpointCommonparamsubdirGetCode200Response {} + + public record EndpointCommonparamsubdirGetCode200Response( + HttpResponse response, + Nothing? body, + Nothing? headers + ) implements EndpointResponse, ApiResponse{ + } + + public sealed interface StatusCodeResponseDeserializer permits StatusCommonparamsubdirGetCode200ResponseDeserializer {} + + public static final class StatusCommonparamsubdirGetCode200ResponseDeserializer extends CommonparamsubdirGetCode200Response.CommonparamsubdirGetCode200Response1 implements StatusCodeResponseDeserializer { + } + + public static final class CommonparamsubdirGetResponses1 implements ResponsesDeserializer { + private final Map statusCodeToResponseDeserializer; + public CommonparamsubdirGetResponses1() { + this.statusCodeToResponseDeserializer = Map.ofEntries( + new AbstractMap.SimpleEntry<>("200", new StatusCommonparamsubdirGetCode200ResponseDeserializer()) + ); + } + + 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) { + throw new ApiException( + "Invalid response statusCode="+statusCode+" has no response defined in the openapi document", + response + ); + } + StatusCommonparamsubdirGetCode200ResponseDeserializer castDeserializer = (StatusCommonparamsubdirGetCode200ResponseDeserializer) statusCodeDeserializer; + var deserializedResponse = castDeserializer.deserialize(response, configuration); + return new EndpointCommonparamsubdirGetCode200Response(response, deserializedResponse.body(), deserializedResponse.headers()); + } + } +} diff --git a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/commonparamsubdir/get/Parameters.kt b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/commonparamsubdir/get/Parameters.kt new file mode 100644 index 00000000000..a06b3e8445a --- /dev/null +++ b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/commonparamsubdir/get/Parameters.kt @@ -0,0 +1,32 @@ +package org.openapijsonschematools.client.paths.commonparamsubdir.get; + +import org.openapijsonschematools.client.paths.commonparamsubdir.parameters.RouteParameter0; +import org.openapijsonschematools.client.paths.commonparamsubdir.get.parameters.Parameter0; +import org.openapijsonschematools.client.parameter.PathSerializer; +import org.openapijsonschematools.client.parameter.QuerySerializer; + +import java.util.Map; +import java.util.AbstractMap; + +public class Parameters { + + public static class PathParametersSerializer extends PathSerializer { + public PathParametersSerializer() { + super( + Map.ofEntries( + new AbstractMap.SimpleEntry<>("subDir", new RouteParameter0.RouteParameter01()) + ) + ); + } + } + + public static class QueryParametersSerializer extends QuerySerializer { + public QueryParametersSerializer() { + super( + Map.ofEntries( + new AbstractMap.SimpleEntry<>("searchStr", new Parameter0.Parameter01()) + ) + ); + } + } +} diff --git a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/commonparamsubdir/get/parameters/Parameter0.kt b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/commonparamsubdir/get/parameters/Parameter0.kt new file mode 100644 index 00000000000..0559a9deb6e --- /dev/null +++ b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/commonparamsubdir/get/parameters/Parameter0.kt @@ -0,0 +1,23 @@ +package org.openapijsonschematools.client.paths.commonparamsubdir.get.parameters; + +import org.openapijsonschematools.client.parameter.ParameterStyle; +import org.openapijsonschematools.client.parameter.ParameterInType; +import org.openapijsonschematools.client.parameter.SchemaParameter; +import org.openapijsonschematools.client.paths.commonparamsubdir.get.parameters.parameter0.Schema0; + +public class Parameter0 { + + public static class Parameter01 extends SchemaParameter { + public Parameter01() { + super( + "searchStr", + ParameterInType.QUERY, + false, + ParameterStyle.FORM, + true, + false, + Schema0.Schema01.getInstance() + ); + } + } +} diff --git a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/commonparamsubdir/get/parameters/parameter0/Schema0.kt b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/commonparamsubdir/get/parameters/parameter0/Schema0.kt new file mode 100644 index 00000000000..cd9df3f6b63 --- /dev/null +++ b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/commonparamsubdir/get/parameters/parameter0/Schema0.kt @@ -0,0 +1,19 @@ +package org.openapijsonschematools.client.paths.commonparamsubdir.get.parameters.parameter0; +import org.checkerframework.checker.nullness.qual.Nullable; +import org.openapijsonschematools.client.schemas.StringJsonSchema; + +public class Schema0 extends StringJsonSchema { + // nest classes so all schemas and input/output classes can be public + + + public static class Schema01 extends StringJsonSchema.StringJsonSchema1 { + private static @Nullable Schema01 instance = null; + public static Schema01 getInstance() { + if (instance == null) { + instance = new Schema01(); + } + return instance; + } + } + +} diff --git a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/commonparamsubdir/get/responses/CommonparamsubdirGetCode200Response.kt b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/commonparamsubdir/get/responses/CommonparamsubdirGetCode200Response.kt new file mode 100644 index 00000000000..87e8201489f --- /dev/null +++ b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/commonparamsubdir/get/responses/CommonparamsubdirGetCode200Response.kt @@ -0,0 +1,7 @@ +package org.openapijsonschematools.client.paths.commonparamsubdir.get.responses; + +import org.openapijsonschematools.client.components.responses.SuccessDescriptionOnly; + +public class CommonparamsubdirGetCode200Response extends SuccessDescriptionOnly { + public static class CommonparamsubdirGetCode200Response1 extends SuccessDescriptionOnly1 {} +} diff --git a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/commonparamsubdir/parameters/RouteParameter0.kt b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/commonparamsubdir/parameters/RouteParameter0.kt new file mode 100644 index 00000000000..ad645a82164 --- /dev/null +++ b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/commonparamsubdir/parameters/RouteParameter0.kt @@ -0,0 +1,23 @@ +package org.openapijsonschematools.client.paths.commonparamsubdir.parameters; + +import org.openapijsonschematools.client.parameter.ParameterStyle; +import org.openapijsonschematools.client.parameter.ParameterInType; +import org.openapijsonschematools.client.parameter.SchemaParameter; +import org.openapijsonschematools.client.paths.commonparamsubdir.parameters.routeparameter0.RouteParamSchema0; + +public class RouteParameter0 { + + public static class RouteParameter01 extends SchemaParameter { + public RouteParameter01() { + super( + "subDir", + ParameterInType.PATH, + true, + ParameterStyle.SIMPLE, + false, + false, + RouteParamSchema0.RouteParamSchema01.getInstance() + ); + } + } +} diff --git a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/commonparamsubdir/parameters/routeparameter0/RouteParamSchema0.kt b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/commonparamsubdir/parameters/routeparameter0/RouteParamSchema0.kt new file mode 100644 index 00000000000..bd8854610b9 --- /dev/null +++ b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/commonparamsubdir/parameters/routeparameter0/RouteParamSchema0.kt @@ -0,0 +1,114 @@ +package org.openapijsonschematools.client.paths.commonparamsubdir.parameters.routeparameter0; +import java.util.HashSet; +import java.util.LinkedHashSet; +import java.util.List; +import java.util.Objects; +import java.util.Set; +import org.checkerframework.checker.nullness.qual.Nullable; +import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags; +import org.openapijsonschematools.client.configurations.SchemaConfiguration; +import org.openapijsonschematools.client.exceptions.ValidationException; +import org.openapijsonschematools.client.schemas.SetMaker; +import org.openapijsonschematools.client.schemas.validation.JsonSchema; +import org.openapijsonschematools.client.schemas.validation.JsonSchemaInfo; +import org.openapijsonschematools.client.schemas.validation.PathToSchemasMap; +import org.openapijsonschematools.client.schemas.validation.StringEnumValidator; +import org.openapijsonschematools.client.schemas.validation.StringSchemaValidator; +import org.openapijsonschematools.client.schemas.validation.StringValueMethod; +import org.openapijsonschematools.client.schemas.validation.ValidationMetadata; + +public class RouteParamSchema0 { + // nest classes so all schemas and input/output classes can be public + + public enum StringRouteParamSchemaEnums0 implements StringValueMethod { + A("a"), + B("b"); + private final String value; + + StringRouteParamSchemaEnums0(String value) { + this.value = value; + } + public String value() { + return this.value; + } + } + + + public sealed interface RouteParamSchema01Boxed permits RouteParamSchema01BoxedString { + @Nullable Object getData(); + } + + public record RouteParamSchema01BoxedString(String data) implements RouteParamSchema01Boxed { + @Override + public @Nullable Object getData() { + return data; + } + } + + + + public static class RouteParamSchema01 extends JsonSchema implements StringSchemaValidator, StringEnumValidator { + private static @Nullable RouteParamSchema01 instance = null; + + protected RouteParamSchema01() { + super(new JsonSchemaInfo() + .type(Set.of( + String.class + )) + .enumValues(SetMaker.makeSet( + "a", + "b" + )) + ); + } + + public static RouteParamSchema01 getInstance() { + if (instance == null) { + instance = new RouteParamSchema01(); + } + return instance; + } + + @Override + public String validate(String arg, SchemaConfiguration configuration) throws ValidationException { + Set> pathSet = new HashSet<>(); + List pathToItem = List.of("args[0"); + String castArg = castToAllowedTypes(arg, pathToItem, pathSet); + SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().build())); + ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, new PathToSchemasMap(), new LinkedHashSet<>()); + getPathToSchemas(this, castArg, validationMetadata, pathSet); + return castArg; + } + + @Override + 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 { + 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"); + } + @Override + public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { + 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"); + } + @Override + 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 { + 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"); + } + } +} diff --git a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/commonparamsubdir/post/CommonparamsubdirPostHeaderParameters.kt b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/commonparamsubdir/post/CommonparamsubdirPostHeaderParameters.kt new file mode 100644 index 00000000000..548f0e42828 --- /dev/null +++ b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/commonparamsubdir/post/CommonparamsubdirPostHeaderParameters.kt @@ -0,0 +1,191 @@ +package org.openapijsonschematools.client.paths.commonparamsubdir.post; +import java.util.ArrayList; +import java.util.HashSet; +import java.util.LinkedHashMap; +import java.util.LinkedHashSet; +import java.util.List; +import java.util.Map; +import java.util.Objects; +import java.util.Set; +import org.checkerframework.checker.nullness.qual.Nullable; +import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags; +import org.openapijsonschematools.client.configurations.SchemaConfiguration; +import org.openapijsonschematools.client.exceptions.UnsetPropertyException; +import org.openapijsonschematools.client.exceptions.ValidationException; +import org.openapijsonschematools.client.paths.commonparamsubdir.post.parameters.parameter0.Schema0; +import org.openapijsonschematools.client.schemas.AnyTypeJsonSchema; +import org.openapijsonschematools.client.schemas.GenericBuilder; +import org.openapijsonschematools.client.schemas.NotAnyTypeJsonSchema; +import org.openapijsonschematools.client.schemas.validation.FrozenMap; +import org.openapijsonschematools.client.schemas.validation.JsonSchema; +import org.openapijsonschematools.client.schemas.validation.JsonSchemaInfo; +import org.openapijsonschematools.client.schemas.validation.MapSchemaValidator; +import org.openapijsonschematools.client.schemas.validation.MapUtils; +import org.openapijsonschematools.client.schemas.validation.PathToSchemasMap; +import org.openapijsonschematools.client.schemas.validation.PropertyEntry; +import org.openapijsonschematools.client.schemas.validation.ValidationMetadata; + +public class CommonparamsubdirPostHeaderParameters { + // nest classes so all schemas and input/output classes can be public + + + public static class AdditionalProperties extends NotAnyTypeJsonSchema.NotAnyTypeJsonSchema1 { + // NotAnyTypeSchema + private static @Nullable AdditionalProperties instance = null; + public static AdditionalProperties getInstance() { + if (instance == null) { + instance = new AdditionalProperties(); + } + return instance; + } + } + + + public static class HeaderParametersMap extends FrozenMap { + protected HeaderParametersMap(FrozenMap m) { + super(m); + } + public static final Set requiredKeys = Set.of(); + public static final Set optionalKeys = Set.of( + "someHeader" + ); + public static HeaderParametersMap of(Map arg, SchemaConfiguration configuration) throws ValidationException { + return CommonparamsubdirPostHeaderParameters1.getInstance().validate(arg, configuration); + } + + public String someHeader() throws UnsetPropertyException { + return getOrThrow("someHeader"); + } + } + + public interface SetterForSomeHeader { + Map getInstance(); + T getBuilderAfterSomeHeader(Map instance); + + default T someHeader(String value) { + var instance = getInstance(); + instance.put("someHeader", value); + return getBuilderAfterSomeHeader(instance); + } + } + + public static class HeaderParametersMapBuilder implements GenericBuilder>, SetterForSomeHeader { + private final Map instance; + private static final Set knownKeys = Set.of( + "someHeader" + ); + public Set getKnownKeys() { + return knownKeys; + } + public HeaderParametersMapBuilder() { + this.instance = new LinkedHashMap<>(); + } + public Map build() { + return instance; + } + public Map getInstance() { + return instance; + } + public HeaderParametersMapBuilder getBuilderAfterSomeHeader(Map instance) { + return this; + } + } + + + public sealed interface CommonparamsubdirPostHeaderParameters1Boxed permits CommonparamsubdirPostHeaderParameters1BoxedMap { + @Nullable Object getData(); + } + + public record CommonparamsubdirPostHeaderParameters1BoxedMap(HeaderParametersMap data) implements CommonparamsubdirPostHeaderParameters1Boxed { + @Override + public @Nullable Object getData() { + return data; + } + } + + + public static class CommonparamsubdirPostHeaderParameters1 extends JsonSchema implements MapSchemaValidator { + private static @Nullable CommonparamsubdirPostHeaderParameters1 instance = null; + + protected CommonparamsubdirPostHeaderParameters1() { + super(new JsonSchemaInfo() + .type(Set.of(Map.class)) + .properties(Map.ofEntries( + new PropertyEntry("someHeader", Schema0.Schema01.class) + )) + .additionalProperties(AdditionalProperties.class) + ); + } + + public static CommonparamsubdirPostHeaderParameters1 getInstance() { + if (instance == null) { + instance = new CommonparamsubdirPostHeaderParameters1(); + } + return instance; + } + + 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 RuntimeException("Invalid non-string key value"); + } + String propertyName = (String) entryKey; + List propertyPathToItem = new ArrayList<>(pathToItem); + propertyPathToItem.add(propertyName); + Object value = entry.getValue(); + LinkedHashMap, Nothing?> schemas = pathToSchemas.get(propertyPathToItem); + if (schemas == null) { + throw new RuntimeException("Validation 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"); + } + properties.put(propertyName, (String) propertyInstance); + } + FrozenMap castProperties = new FrozenMap<>(properties); + return new HeaderParametersMap(castProperties); + } + + 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); + SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().build())); + ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, new PathToSchemasMap(), new LinkedHashSet<>()); + PathToSchemasMap pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet); + return getNewInstance(castArg, validationMetadata.pathToItem(), pathToSchemasMap); + } + + + @Override + public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws 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"); + } + @Override + public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { + if (arg instanceof Map) { + return getNewInstance((Map) arg, pathToItem, pathToSchemas); + } + throw new RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); + } + @Override + public CommonparamsubdirPostHeaderParameters1BoxedMap validateAndBox(Map arg, SchemaConfiguration configuration) throws ValidationException { + return new CommonparamsubdirPostHeaderParameters1BoxedMap(validate(arg, configuration)); + } + @Override + public CommonparamsubdirPostHeaderParameters1Boxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { + 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"); + } + } + +} diff --git a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/commonparamsubdir/post/CommonparamsubdirPostPathParameters.kt b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/commonparamsubdir/post/CommonparamsubdirPostPathParameters.kt new file mode 100644 index 00000000000..ad75166f4bb --- /dev/null +++ b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/commonparamsubdir/post/CommonparamsubdirPostPathParameters.kt @@ -0,0 +1,211 @@ +package org.openapijsonschematools.client.paths.commonparamsubdir.post; +import java.util.ArrayList; +import java.util.HashSet; +import java.util.LinkedHashMap; +import java.util.LinkedHashSet; +import java.util.List; +import java.util.Map; +import java.util.Objects; +import java.util.Set; +import org.checkerframework.checker.nullness.qual.Nullable; +import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags; +import org.openapijsonschematools.client.configurations.SchemaConfiguration; +import org.openapijsonschematools.client.exceptions.UnsetPropertyException; +import org.openapijsonschematools.client.exceptions.ValidationException; +import org.openapijsonschematools.client.paths.commonparamsubdir.parameters.routeparameter0.RouteParamSchema0; +import org.openapijsonschematools.client.schemas.AnyTypeJsonSchema; +import org.openapijsonschematools.client.schemas.GenericBuilder; +import org.openapijsonschematools.client.schemas.NotAnyTypeJsonSchema; +import org.openapijsonschematools.client.schemas.validation.FrozenMap; +import org.openapijsonschematools.client.schemas.validation.JsonSchema; +import org.openapijsonschematools.client.schemas.validation.JsonSchemaInfo; +import org.openapijsonschematools.client.schemas.validation.MapSchemaValidator; +import org.openapijsonschematools.client.schemas.validation.MapUtils; +import org.openapijsonschematools.client.schemas.validation.PathToSchemasMap; +import org.openapijsonschematools.client.schemas.validation.PropertyEntry; +import org.openapijsonschematools.client.schemas.validation.ValidationMetadata; + +public class CommonparamsubdirPostPathParameters { + // nest classes so all schemas and input/output classes can be public + + + public static class AdditionalProperties extends NotAnyTypeJsonSchema.NotAnyTypeJsonSchema1 { + // NotAnyTypeSchema + private static @Nullable AdditionalProperties instance = null; + public static AdditionalProperties getInstance() { + if (instance == null) { + instance = new AdditionalProperties(); + } + return instance; + } + } + + + public static class PathParametersMap extends FrozenMap { + protected PathParametersMap(FrozenMap m) { + super(m); + } + public static final Set requiredKeys = Set.of( + "subDir" + ); + public static final Set optionalKeys = Set.of(); + public static PathParametersMap of(Map arg, SchemaConfiguration configuration) throws ValidationException { + return CommonparamsubdirPostPathParameters1.getInstance().validate(arg, configuration); + } + + public String subDir() { + try { + return getOrThrow("version"); + } catch (UnsetPropertyException e) { + throw new RuntimeException(e); + } + } + } + + public interface SetterForSubDir { + Map getInstance(); + T getBuilderAfterSubDir(Map instance); + + default T subDir(String value) { + var instance = getInstance(); + instance.put("subDir", value); + return getBuilderAfterSubDir(instance); + } + + default T subDir(RouteParamSchema0.StringRouteParamSchemaEnums0 value) { + var instance = getInstance(); + instance.put("subDir", value.value()); + return getBuilderAfterSubDir(instance); + } + } + + public static class PathParametersMap0Builder implements GenericBuilder> { + private final Map instance; + private static final Set knownKeys = Set.of( + "subDir" + ); + public Set getKnownKeys() { + return knownKeys; + } + public PathParametersMap0Builder(Map instance) { + this.instance = instance; + } + public Map build() { + return instance; + } + } + + public static class PathParametersMapBuilder implements SetterForSubDir { + private final Map instance; + public PathParametersMapBuilder() { + this.instance = new LinkedHashMap<>(); + } + public Map getInstance() { + return instance; + } + public PathParametersMap0Builder getBuilderAfterSubDir(Map instance) { + return new PathParametersMap0Builder(instance); + } + } + + + public sealed interface CommonparamsubdirPostPathParameters1Boxed permits CommonparamsubdirPostPathParameters1BoxedMap { + @Nullable Object getData(); + } + + public record CommonparamsubdirPostPathParameters1BoxedMap(PathParametersMap data) implements CommonparamsubdirPostPathParameters1Boxed { + @Override + public @Nullable Object getData() { + return data; + } + } + + + public static class CommonparamsubdirPostPathParameters1 extends JsonSchema implements MapSchemaValidator { + private static @Nullable CommonparamsubdirPostPathParameters1 instance = null; + + protected CommonparamsubdirPostPathParameters1() { + super(new JsonSchemaInfo() + .type(Set.of(Map.class)) + .properties(Map.ofEntries( + new PropertyEntry("subDir", RouteParamSchema0.RouteParamSchema01.class) + )) + .required(Set.of( + "subDir" + )) + .additionalProperties(AdditionalProperties.class) + ); + } + + public static CommonparamsubdirPostPathParameters1 getInstance() { + if (instance == null) { + instance = new CommonparamsubdirPostPathParameters1(); + } + return instance; + } + + 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 RuntimeException("Invalid non-string key value"); + } + String propertyName = (String) entryKey; + List propertyPathToItem = new ArrayList<>(pathToItem); + propertyPathToItem.add(propertyName); + Object value = entry.getValue(); + LinkedHashMap, Nothing?> schemas = pathToSchemas.get(propertyPathToItem); + if (schemas == null) { + throw new RuntimeException("Validation 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"); + } + properties.put(propertyName, (String) propertyInstance); + } + FrozenMap castProperties = new FrozenMap<>(properties); + return new PathParametersMap(castProperties); + } + + 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); + SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().build())); + ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, new PathToSchemasMap(), new LinkedHashSet<>()); + PathToSchemasMap pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet); + return getNewInstance(castArg, validationMetadata.pathToItem(), pathToSchemasMap); + } + + + @Override + public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws 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"); + } + @Override + public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { + if (arg instanceof Map) { + return getNewInstance((Map) arg, pathToItem, pathToSchemas); + } + throw new RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); + } + @Override + public CommonparamsubdirPostPathParameters1BoxedMap validateAndBox(Map arg, SchemaConfiguration configuration) throws ValidationException { + return new CommonparamsubdirPostPathParameters1BoxedMap(validate(arg, configuration)); + } + @Override + public CommonparamsubdirPostPathParameters1Boxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { + 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"); + } + } + +} diff --git a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/commonparamsubdir/post/CommonparamsubdirPostResponses.kt b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/commonparamsubdir/post/CommonparamsubdirPostResponses.kt new file mode 100644 index 00000000000..428cbc9949b --- /dev/null +++ b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/commonparamsubdir/post/CommonparamsubdirPostResponses.kt @@ -0,0 +1,53 @@ +package org.openapijsonschematools.client.paths.commonparamsubdir.post; + +import org.openapijsonschematools.client.paths.commonparamsubdir.post.responses.CommonparamsubdirPostCode200Response; +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; +import org.checkerframework.checker.nullness.qual.Nullable; + +import java.net.http.HttpResponse; +import java.util.Map; +import java.util.AbstractMap; + +public class CommonparamsubdirPostResponses { + public sealed interface EndpointResponse permits EndpointCommonparamsubdirPostCode200Response {} + + public record EndpointCommonparamsubdirPostCode200Response( + HttpResponse response, + Nothing? body, + Nothing? headers + ) implements EndpointResponse, ApiResponse{ + } + + public sealed interface StatusCodeResponseDeserializer permits StatusCommonparamsubdirPostCode200ResponseDeserializer {} + + public static final class StatusCommonparamsubdirPostCode200ResponseDeserializer extends CommonparamsubdirPostCode200Response.CommonparamsubdirPostCode200Response1 implements StatusCodeResponseDeserializer { + } + + public static final class CommonparamsubdirPostResponses1 implements ResponsesDeserializer { + private final Map statusCodeToResponseDeserializer; + public CommonparamsubdirPostResponses1() { + this.statusCodeToResponseDeserializer = Map.ofEntries( + new AbstractMap.SimpleEntry<>("200", new StatusCommonparamsubdirPostCode200ResponseDeserializer()) + ); + } + + 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) { + throw new ApiException( + "Invalid response statusCode="+statusCode+" has no response defined in the openapi document", + response + ); + } + StatusCommonparamsubdirPostCode200ResponseDeserializer castDeserializer = (StatusCommonparamsubdirPostCode200ResponseDeserializer) statusCodeDeserializer; + var deserializedResponse = castDeserializer.deserialize(response, configuration); + return new EndpointCommonparamsubdirPostCode200Response(response, deserializedResponse.body(), deserializedResponse.headers()); + } + } +} diff --git a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/commonparamsubdir/post/Parameters.kt b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/commonparamsubdir/post/Parameters.kt new file mode 100644 index 00000000000..22e2acd3b26 --- /dev/null +++ b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/commonparamsubdir/post/Parameters.kt @@ -0,0 +1,32 @@ +package org.openapijsonschematools.client.paths.commonparamsubdir.post; + +import org.openapijsonschematools.client.paths.commonparamsubdir.parameters.RouteParameter0; +import org.openapijsonschematools.client.paths.commonparamsubdir.post.parameters.Parameter0; +import org.openapijsonschematools.client.parameter.PathSerializer; +import org.openapijsonschematools.client.parameter.HeadersSerializer; + +import java.util.Map; +import java.util.AbstractMap; + +public class Parameters { + + public static class PathParametersSerializer extends PathSerializer { + public PathParametersSerializer() { + super( + Map.ofEntries( + new AbstractMap.SimpleEntry<>("subDir", new RouteParameter0.RouteParameter01()) + ) + ); + } + } + + public static class HeaderParametersSerializer extends HeadersSerializer { + public HeaderParametersSerializer() { + super( + Map.ofEntries( + new AbstractMap.SimpleEntry<>("someHeader", new Parameter0.Parameter01()) + ) + ); + } + } +} diff --git a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/commonparamsubdir/post/parameters/Parameter0.kt b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/commonparamsubdir/post/parameters/Parameter0.kt new file mode 100644 index 00000000000..48a0d5b37bb --- /dev/null +++ b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/commonparamsubdir/post/parameters/Parameter0.kt @@ -0,0 +1,23 @@ +package org.openapijsonschematools.client.paths.commonparamsubdir.post.parameters; + +import org.openapijsonschematools.client.parameter.ParameterStyle; +import org.openapijsonschematools.client.parameter.ParameterInType; +import org.openapijsonschematools.client.parameter.SchemaParameter; +import org.openapijsonschematools.client.paths.commonparamsubdir.post.parameters.parameter0.Schema0; + +public class Parameter0 { + + public static class Parameter01 extends SchemaParameter { + public Parameter01() { + super( + "someHeader", + ParameterInType.HEADER, + false, + ParameterStyle.SIMPLE, + false, + false, + Schema0.Schema01.getInstance() + ); + } + } +} diff --git a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/commonparamsubdir/post/parameters/parameter0/Schema0.kt b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/commonparamsubdir/post/parameters/parameter0/Schema0.kt new file mode 100644 index 00000000000..ff8948ab37f --- /dev/null +++ b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/commonparamsubdir/post/parameters/parameter0/Schema0.kt @@ -0,0 +1,19 @@ +package org.openapijsonschematools.client.paths.commonparamsubdir.post.parameters.parameter0; +import org.checkerframework.checker.nullness.qual.Nullable; +import org.openapijsonschematools.client.schemas.StringJsonSchema; + +public class Schema0 extends StringJsonSchema { + // nest classes so all schemas and input/output classes can be public + + + public static class Schema01 extends StringJsonSchema.StringJsonSchema1 { + private static @Nullable Schema01 instance = null; + public static Schema01 getInstance() { + if (instance == null) { + instance = new Schema01(); + } + return instance; + } + } + +} diff --git a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/commonparamsubdir/post/responses/CommonparamsubdirPostCode200Response.kt b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/commonparamsubdir/post/responses/CommonparamsubdirPostCode200Response.kt new file mode 100644 index 00000000000..85eac21263a --- /dev/null +++ b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/commonparamsubdir/post/responses/CommonparamsubdirPostCode200Response.kt @@ -0,0 +1,7 @@ +package org.openapijsonschematools.client.paths.commonparamsubdir.post.responses; + +import org.openapijsonschematools.client.components.responses.SuccessDescriptionOnly; + +public class CommonparamsubdirPostCode200Response extends SuccessDescriptionOnly { + public static class CommonparamsubdirPostCode200Response1 extends SuccessDescriptionOnly1 {} +} diff --git a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/fake/FakeDelete.kt b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/fake/FakeDelete.kt new file mode 100644 index 00000000000..1e9699662da --- /dev/null +++ b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/fake/FakeDelete.kt @@ -0,0 +1,270 @@ +package org.openapijsonschematools.client.paths.fake; + +import org.checkerframework.checker.nullness.qual.Nullable; +import org.openapijsonschematools.client.RootServerInfo; +import org.openapijsonschematools.client.paths.fake.delete.FakeDeleteSecurityInfo; +import org.openapijsonschematools.client.paths.fake.delete.FakeDeleteHeaderParameters; +import org.openapijsonschematools.client.paths.fake.delete.FakeDeleteQueryParameters; +import org.openapijsonschematools.client.paths.fake.delete.Parameters; +import org.openapijsonschematools.client.paths.fake.delete.FakeDeleteResponses; +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.paths.Fake; +import org.openapijsonschematools.client.securityrequirementobjects.SecurityRequirementObject; +import org.openapijsonschematools.client.securityrequirementobjects.AuthApplier; + +import java.io.IOException; +import java.net.http.HttpClient; +import java.net.http.HttpRequest; +import java.time.Duration; +import java.util.List; +import java.util.Map; + +public class FakeDelete { + private static class DeleteProvider extends AuthApplier { + private static final String method = "delete"; + + public static FakeDeleteResponses.EndpointResponse delete( + DeleteRequest request, + ApiConfiguration apiConfiguration, + SchemaConfiguration schemaConfiguration, + HttpClient client + ) throws IOException, InterruptedException, ValidationException, NotImplementedException, ApiException { + Map> headers = apiConfiguration.getDefaultHeaders(); + HttpRequest.BodyPublisher bodyPublisher = HttpRequest.BodyPublishers.noBody(); + + var headersSerializer = new Parameters.HeaderParametersSerializer(); + Map> serializedHeaders = headersSerializer.serialize(request.headerParameters); + headers.putAll(serializedHeaders); + + var querySerializer = new Parameters.QueryParametersSerializer(); + @Nullable Map queryMap = querySerializer.getQueryMap(request.queryParameters); + String host = apiConfiguration.getServer(request.serverIndex).url(); + SecurityRequirementObject securityRequirementObject = apiConfiguration.getSecurityRequirementObject(request.securityIndex); + updateParamsForAuth( + securityRequirementObject, + headers, + Fake.path, + method, + bodyPublisher, + queryMap, + apiConfiguration + ); + + String url = host + Fake.path; + if (queryMap != null) { + url = url + querySerializer.serialize(queryMap); + } + var httpRequest = RestClient.getRequest( + url, + method, + bodyPublisher, + headers, + request.timeout + ); + var response = RestClient.getResponse(httpRequest, client); + var responsesDeserializer = new FakeDeleteResponses.FakeDeleteResponses1(); + return responsesDeserializer.deserialize(response, schemaConfiguration); + } + } + + public interface DeleteOperation { + ApiConfiguration getApiConfiguration(); + SchemaConfiguration getSchemaConfiguration(); + HttpClient getClient(); + default FakeDeleteResponses.EndpointResponse delete(DeleteRequest request) throws IOException, InterruptedException, ValidationException, NotImplementedException, ApiException { + return DeleteProvider.delete(request, getApiConfiguration(), getSchemaConfiguration(), getClient()); + } + } + + public interface GroupParametersOperation { + ApiConfiguration getApiConfiguration(); + SchemaConfiguration getSchemaConfiguration(); + HttpClient getClient(); + default FakeDeleteResponses.EndpointResponse groupParameters(DeleteRequest request) throws IOException, InterruptedException, ValidationException, NotImplementedException, ApiException { + return DeleteProvider.delete(request, getApiConfiguration(), getSchemaConfiguration(), getClient()); + } + } + + public static class Delete extends ApiClient implements DeleteOperation { + public Delete(ApiConfiguration apiConfiguration, SchemaConfiguration schemaConfiguration) { + super(apiConfiguration, schemaConfiguration); + } + } + + public static class DeleteRequest { + public FakeDeleteHeaderParameters.HeaderParametersMap headerParameters; + public FakeDeleteQueryParameters.QueryParametersMap queryParameters; + public RootServerInfo.@Nullable ServerIndex serverIndex; + public FakeDeleteSecurityInfo.@Nullable SecurityIndex securityIndex; + public @Nullable Duration timeout; + + public DeleteRequest( + FakeDeleteHeaderParameters.HeaderParametersMap headerParameters, + FakeDeleteQueryParameters.QueryParametersMap queryParameters, + RootServerInfo.@Nullable ServerIndex serverIndex, + FakeDeleteSecurityInfo.@Nullable SecurityIndex securityIndex, + @Nullable Duration timeout + ) { + this.headerParameters = headerParameters; + this.queryParameters = queryParameters; + this.serverIndex = serverIndex; + this.securityIndex = securityIndex; + this.timeout = timeout; + } + } + + public static class DeleteNullableRequest { + public FakeDeleteHeaderParameters.@Nullable HeaderParametersMap headerParameters; + public FakeDeleteQueryParameters.@Nullable QueryParametersMap queryParameters; + public RootServerInfo.@Nullable ServerIndex serverIndex; + public FakeDeleteSecurityInfo.@Nullable SecurityIndex securityIndex; + public @Nullable Duration timeout; + } + + public interface SetterForServerIndex { + DeleteNullableRequest getInstance(); + T getBuilderAfterServerIndex(DeleteNullableRequest instance); + default T serverIndex(RootServerInfo.ServerIndex serverIndex) { + var instance = getInstance(); + instance.serverIndex = serverIndex; + return getBuilderAfterServerIndex(instance); + } + } + + public interface SetterForSecurityIndex { + DeleteNullableRequest getInstance(); + T getBuilderAfterSecurityIndex(DeleteNullableRequest instance); + default T securityIndex(FakeDeleteSecurityInfo.SecurityIndex securityIndex) { + var instance = getInstance(); + instance.securityIndex = securityIndex; + return getBuilderAfterSecurityIndex(instance); + } + } + + public interface SetterForTimeout { + DeleteNullableRequest getInstance(); + T getBuilderAfterTimeout(DeleteNullableRequest instance); + default T timeout(Duration timeout) { + var instance = getInstance(); + instance.timeout = timeout; + return getBuilderAfterTimeout(instance); + } + } + + public interface SetterForHeaderParameters { + DeleteNullableRequest getInstance(); + T getBuilderAfterHeaderParameters(DeleteNullableRequest instance); + default T headerParameters(FakeDeleteHeaderParameters.HeaderParametersMap headerParameters) { + var instance = getInstance(); + instance.headerParameters = headerParameters; + return getBuilderAfterHeaderParameters(instance); + } + } + + public interface SetterForQueryParameters { + DeleteNullableRequest getInstance(); + T getBuilderAfterQueryParameters(DeleteNullableRequest instance); + default T queryParameters(FakeDeleteQueryParameters.QueryParametersMap queryParameters) { + var instance = getInstance(); + instance.queryParameters = queryParameters; + return getBuilderAfterQueryParameters(instance); + } + } + + public static class Delete00RequestBuilder implements SetterForServerIndex, SetterForSecurityIndex, SetterForTimeout { + private final DeleteNullableRequest instance; + + public Delete00RequestBuilder(DeleteNullableRequest instance) { + this.instance = instance; + } + + public DeleteRequest build() { + var headerParameters = instance.headerParameters; + if (headerParameters == null) { + throw new RuntimeException("invalid null value for required parameter"); + } + var queryParameters = instance.queryParameters; + if (queryParameters == null) { + throw new RuntimeException("invalid null value for required parameter"); + } + return new DeleteRequest( + headerParameters, + queryParameters, + instance.serverIndex, + instance.securityIndex, + instance.timeout + ); + } + + public DeleteNullableRequest getInstance() { + return instance; + } + + public Delete00RequestBuilder getBuilderAfterServerIndex(DeleteNullableRequest instance) { + return this; + } + + public Delete00RequestBuilder getBuilderAfterSecurityIndex(DeleteNullableRequest instance) { + return this; + } + + public Delete00RequestBuilder getBuilderAfterTimeout(DeleteNullableRequest instance) { + return this; + } + } + public static class Delete01RequestBuilder implements SetterForQueryParameters { + private final DeleteNullableRequest instance; + + public Delete01RequestBuilder(DeleteNullableRequest instance) { + this.instance = instance; + } + + public DeleteNullableRequest getInstance() { + return instance; + } + + public Delete00RequestBuilder getBuilderAfterQueryParameters(DeleteNullableRequest instance) { + return new Delete00RequestBuilder(instance); + } + } + public static class Delete10RequestBuilder implements SetterForHeaderParameters { + private final DeleteNullableRequest instance; + + public Delete10RequestBuilder(DeleteNullableRequest instance) { + this.instance = instance; + } + + public DeleteNullableRequest getInstance() { + return instance; + } + + public Delete00RequestBuilder getBuilderAfterHeaderParameters(DeleteNullableRequest instance) { + return new Delete00RequestBuilder(instance); + } + } + public static class DeleteRequestBuilder implements SetterForHeaderParameters, SetterForQueryParameters { + private final DeleteNullableRequest instance; + + public DeleteRequestBuilder() { + this.instance = new DeleteNullableRequest(); + } + + public DeleteNullableRequest getInstance() { + return instance; + } + + public Delete01RequestBuilder getBuilderAfterHeaderParameters(DeleteNullableRequest instance) { + return new Delete01RequestBuilder(instance); + } + + public Delete10RequestBuilder getBuilderAfterQueryParameters(DeleteNullableRequest instance) { + return new Delete10RequestBuilder(instance); + } + } +} diff --git a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/fake/FakeGet.kt b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/fake/FakeGet.kt new file mode 100644 index 00000000000..9239b256da7 --- /dev/null +++ b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/fake/FakeGet.kt @@ -0,0 +1,198 @@ +package org.openapijsonschematools.client.paths.fake; + +import org.checkerframework.checker.nullness.qual.Nullable; +import org.openapijsonschematools.client.paths.fake.get.FakeGetRequestBody; +import org.openapijsonschematools.client.paths.fake.get.FakeGetHeaderParameters; +import org.openapijsonschematools.client.paths.fake.get.FakeGetQueryParameters; +import org.openapijsonschematools.client.RootServerInfo; +import org.openapijsonschematools.client.paths.fake.get.Parameters; +import org.openapijsonschematools.client.paths.fake.get.FakeGetResponses; +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.requestbody.SerializedRequestBody; +import org.openapijsonschematools.client.paths.Fake; + +import java.io.IOException; +import java.util.ArrayList; +import java.net.http.HttpClient; +import java.net.http.HttpRequest; +import java.time.Duration; +import java.util.List; +import java.util.Map; + +public class FakeGet { + private static class GetProvider { + private static final String method = "get"; + + public static FakeGetResponses.EndpointResponse get( + GetRequest request, + ApiConfiguration apiConfiguration, + SchemaConfiguration schemaConfiguration, + HttpClient client + ) throws IOException, InterruptedException, ValidationException, NotImplementedException, ApiException { + Map> headers = apiConfiguration.getDefaultHeaders(); + + @Nullable SerializedRequestBody serializedRequestBody; + HttpRequest.BodyPublisher bodyPublisher = HttpRequest.BodyPublishers.noBody(); + if (request.requestBody != null) { + serializedRequestBody = new FakeGetRequestBody.FakeGetRequestBody1().serialize( + request.requestBody + ); + var contentTypeHeaderValues = headers.getOrDefault("Content-Type", new ArrayList<>()); + contentTypeHeaderValues.add(serializedRequestBody.contentType); + bodyPublisher = serializedRequestBody.bodyPublisher; + } + + if (request.headerParameters != null) { + var headersSerializer = new Parameters.HeaderParametersSerializer(); + Map> serializedHeaders = headersSerializer.serialize(request.headerParameters); + headers.putAll(serializedHeaders); + } + + var querySerializer = new Parameters.QueryParametersSerializer(); + @Nullable Map queryMap = null; + if (request.queryParameters != null) { + queryMap = querySerializer.getQueryMap(request.queryParameters); + } + String host = apiConfiguration.getServer(request.serverIndex).url(); + + String url = host + Fake.path; + if (queryMap != null) { + url = url + querySerializer.serialize(queryMap); + } + var httpRequest = RestClient.getRequest( + url, + method, + bodyPublisher, + headers, + request.timeout + ); + var response = RestClient.getResponse(httpRequest, client); + var responsesDeserializer = new FakeGetResponses.FakeGetResponses1(); + return responsesDeserializer.deserialize(response, schemaConfiguration); + } + } + + public interface GetOperation { + ApiConfiguration getApiConfiguration(); + SchemaConfiguration getSchemaConfiguration(); + HttpClient getClient(); + default FakeGetResponses.EndpointResponse get(GetRequest request) throws IOException, InterruptedException, ValidationException, NotImplementedException, ApiException { + return GetProvider.get(request, getApiConfiguration(), getSchemaConfiguration(), getClient()); + } + } + + public interface EnumParametersOperation { + ApiConfiguration getApiConfiguration(); + SchemaConfiguration getSchemaConfiguration(); + HttpClient getClient(); + default FakeGetResponses.EndpointResponse enumParameters(GetRequest request) throws IOException, InterruptedException, ValidationException, NotImplementedException, ApiException { + return GetProvider.get(request, getApiConfiguration(), getSchemaConfiguration(), getClient()); + } + } + + public static class Get extends ApiClient implements GetOperation { + public Get(ApiConfiguration apiConfiguration, SchemaConfiguration schemaConfiguration) { + super(apiConfiguration, schemaConfiguration); + } + } + + public static class GetRequest { + public FakeGetRequestBody.@Nullable SealedRequestBody requestBody; + public FakeGetHeaderParameters.@Nullable HeaderParametersMap headerParameters; + public FakeGetQueryParameters.@Nullable QueryParametersMap queryParameters; + public RootServerInfo.@Nullable ServerIndex serverIndex; + public @Nullable Duration timeout; + } + + public interface SetterForRequestBody { + GetRequest getInstance(); + T getBuilderAfterRequestBody(GetRequest instance); + default T requestBody(FakeGetRequestBody.SealedRequestBody requestBody) { + var instance = getInstance(); + instance.requestBody = requestBody; + return getBuilderAfterRequestBody(instance); + } + } + + public interface SetterForHeaderParameters { + GetRequest getInstance(); + T getBuilderAfterHeaderParameters(GetRequest instance); + default T headerParameters(FakeGetHeaderParameters.HeaderParametersMap headerParameters) { + var instance = getInstance(); + instance.headerParameters = headerParameters; + return getBuilderAfterHeaderParameters(instance); + } + } + + public interface SetterForQueryParameters { + GetRequest getInstance(); + T getBuilderAfterQueryParameters(GetRequest instance); + default T queryParameters(FakeGetQueryParameters.QueryParametersMap queryParameters) { + var instance = getInstance(); + instance.queryParameters = queryParameters; + return getBuilderAfterQueryParameters(instance); + } + } + + public interface SetterForServerIndex { + GetRequest getInstance(); + T getBuilderAfterServerIndex(GetRequest instance); + default T serverIndex(RootServerInfo.ServerIndex serverIndex) { + var instance = getInstance(); + instance.serverIndex = serverIndex; + return getBuilderAfterServerIndex(instance); + } + } + + public interface SetterForTimeout { + GetRequest getInstance(); + T getBuilderAfterTimeout(GetRequest instance); + default T timeout(Duration timeout) { + var instance = getInstance(); + instance.timeout = timeout; + return getBuilderAfterTimeout(instance); + } + } + + public static class GetRequestBuilder implements SetterForRequestBody, SetterForHeaderParameters, SetterForQueryParameters, SetterForServerIndex, SetterForTimeout { + private final GetRequest instance; + + public GetRequestBuilder() { + this.instance = new GetRequest(); + } + + public GetRequest build() { + return instance; + } + + public GetRequest getInstance() { + return instance; + } + + public GetRequestBuilder getBuilderAfterRequestBody(GetRequest instance) { + return this; + } + + public GetRequestBuilder getBuilderAfterHeaderParameters(GetRequest instance) { + return this; + } + + public GetRequestBuilder getBuilderAfterQueryParameters(GetRequest instance) { + return this; + } + + public GetRequestBuilder getBuilderAfterServerIndex(GetRequest instance) { + return this; + } + + public GetRequestBuilder getBuilderAfterTimeout(GetRequest instance) { + return this; + } + } +} diff --git a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/fake/FakePatch.kt b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/fake/FakePatch.kt new file mode 100644 index 00000000000..e723af46b95 --- /dev/null +++ b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/fake/FakePatch.kt @@ -0,0 +1,183 @@ +package org.openapijsonschematools.client.paths.fake; + +import org.checkerframework.checker.nullness.qual.Nullable; +import org.openapijsonschematools.client.RootServerInfo; +import org.openapijsonschematools.client.paths.fake.patch.FakePatchRequestBody; +import org.openapijsonschematools.client.paths.fake.patch.FakePatchResponses; +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.requestbody.SerializedRequestBody; +import org.openapijsonschematools.client.paths.Fake; + +import java.io.IOException; +import java.util.ArrayList; +import java.net.http.HttpClient; +import java.net.http.HttpRequest; +import java.time.Duration; +import java.util.List; +import java.util.Map; + +public class FakePatch { + private static class PatchProvider { + private static final String method = "patch"; + + public static FakePatchResponses.EndpointResponse patch( + PatchRequest request, + ApiConfiguration apiConfiguration, + SchemaConfiguration schemaConfiguration, + HttpClient client + ) throws IOException, InterruptedException, ValidationException, NotImplementedException, ApiException { + Map> headers = apiConfiguration.getDefaultHeaders(); + + SerializedRequestBody serializedRequestBody = new FakePatchRequestBody.FakePatchRequestBody1().serialize( + request.requestBody + ); + var contentTypeHeaderValues = headers.getOrDefault("Content-Type", new ArrayList<>()); + contentTypeHeaderValues.add(serializedRequestBody.contentType); + HttpRequest.BodyPublisher bodyPublisher = serializedRequestBody.bodyPublisher; + // TODO set this to a map if there is a query security scheme + @Nullable Map queryMap = null; + String host = apiConfiguration.getServer(request.serverIndex).url(); + + String url = host + Fake.path; + var httpRequest = RestClient.getRequest( + url, + method, + bodyPublisher, + headers, + request.timeout + ); + var response = RestClient.getResponse(httpRequest, client); + var responsesDeserializer = new FakePatchResponses.FakePatchResponses1(); + return responsesDeserializer.deserialize(response, schemaConfiguration); + } + } + + public interface PatchOperation { + ApiConfiguration getApiConfiguration(); + SchemaConfiguration getSchemaConfiguration(); + HttpClient getClient(); + default FakePatchResponses.EndpointResponse patch(PatchRequest request) throws IOException, InterruptedException, ValidationException, NotImplementedException, ApiException { + return PatchProvider.patch(request, getApiConfiguration(), getSchemaConfiguration(), getClient()); + } + } + + public interface ClientModelOperation { + ApiConfiguration getApiConfiguration(); + SchemaConfiguration getSchemaConfiguration(); + HttpClient getClient(); + default FakePatchResponses.EndpointResponse clientModel(PatchRequest request) throws IOException, InterruptedException, ValidationException, NotImplementedException, ApiException { + return PatchProvider.patch(request, getApiConfiguration(), getSchemaConfiguration(), getClient()); + } + } + + public static class Patch extends ApiClient implements PatchOperation { + public Patch(ApiConfiguration apiConfiguration, SchemaConfiguration schemaConfiguration) { + super(apiConfiguration, schemaConfiguration); + } + } + + public static class PatchRequest { + public FakePatchRequestBody.SealedRequestBody requestBody; + public RootServerInfo.@Nullable ServerIndex serverIndex; + public @Nullable Duration timeout; + + public PatchRequest( + FakePatchRequestBody.SealedRequestBody requestBody, + RootServerInfo.@Nullable ServerIndex serverIndex, + @Nullable Duration timeout + ) { + this.requestBody = requestBody; + this.serverIndex = serverIndex; + this.timeout = timeout; + } + } + + public static class PatchNullableRequest { + public FakePatchRequestBody.@Nullable SealedRequestBody requestBody; + public RootServerInfo.@Nullable ServerIndex serverIndex; + public @Nullable Duration timeout; + } + + public interface SetterForServerIndex { + PatchNullableRequest getInstance(); + T getBuilderAfterServerIndex(PatchNullableRequest instance); + default T serverIndex(RootServerInfo.ServerIndex serverIndex) { + var instance = getInstance(); + instance.serverIndex = serverIndex; + return getBuilderAfterServerIndex(instance); + } + } + + public interface SetterForTimeout { + PatchNullableRequest getInstance(); + T getBuilderAfterTimeout(PatchNullableRequest instance); + default T timeout(Duration timeout) { + var instance = getInstance(); + instance.timeout = timeout; + return getBuilderAfterTimeout(instance); + } + } + + public interface SetterForRequestBody { + PatchNullableRequest getInstance(); + T getBuilderAfterRequestBody(PatchNullableRequest instance); + default T requestBody(FakePatchRequestBody.SealedRequestBody requestBody) { + var instance = getInstance(); + instance.requestBody = requestBody; + return getBuilderAfterRequestBody(instance); + } + } + + public static class Patch0RequestBuilder implements SetterForServerIndex, SetterForTimeout { + private final PatchNullableRequest instance; + + public Patch0RequestBuilder(PatchNullableRequest instance) { + this.instance = instance; + } + + public PatchRequest build() { + var requestBody = instance.requestBody; + if (requestBody == null) { + throw new RuntimeException("invalid null value for required parameter"); + } + return new PatchRequest( + requestBody, + instance.serverIndex, + instance.timeout + ); + } + + public PatchNullableRequest getInstance() { + return instance; + } + + public Patch0RequestBuilder getBuilderAfterServerIndex(PatchNullableRequest instance) { + return this; + } + + public Patch0RequestBuilder getBuilderAfterTimeout(PatchNullableRequest instance) { + return this; + } + } + public static class PatchRequestBuilder implements SetterForRequestBody { + private final PatchNullableRequest instance; + + public PatchRequestBuilder() { + this.instance = new PatchNullableRequest(); + } + + public PatchNullableRequest getInstance() { + return instance; + } + + public Patch0RequestBuilder getBuilderAfterRequestBody(PatchNullableRequest instance) { + return new Patch0RequestBuilder(instance); + } + } +} diff --git a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/fake/FakePost.kt b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/fake/FakePost.kt new file mode 100644 index 00000000000..7772656bdfe --- /dev/null +++ b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/fake/FakePost.kt @@ -0,0 +1,180 @@ +package org.openapijsonschematools.client.paths.fake; + +import org.checkerframework.checker.nullness.qual.Nullable; +import org.openapijsonschematools.client.paths.fake.post.FakePostRequestBody; +import org.openapijsonschematools.client.RootServerInfo; +import org.openapijsonschematools.client.paths.fake.post.FakePostSecurityInfo; +import org.openapijsonschematools.client.paths.fake.post.FakePostResponses; +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.requestbody.SerializedRequestBody; +import org.openapijsonschematools.client.paths.Fake; +import org.openapijsonschematools.client.securityrequirementobjects.SecurityRequirementObject; +import org.openapijsonschematools.client.securityrequirementobjects.AuthApplier; + +import java.io.IOException; +import java.util.ArrayList; +import java.net.http.HttpClient; +import java.net.http.HttpRequest; +import java.time.Duration; +import java.util.List; +import java.util.Map; + +public class FakePost { + private static class PostProvider extends AuthApplier { + private static final String method = "post"; + + public static FakePostResponses.EndpointResponse post( + PostRequest request, + ApiConfiguration apiConfiguration, + SchemaConfiguration schemaConfiguration, + HttpClient client + ) throws IOException, InterruptedException, ValidationException, NotImplementedException, ApiException { + Map> headers = apiConfiguration.getDefaultHeaders(); + + @Nullable SerializedRequestBody serializedRequestBody; + HttpRequest.BodyPublisher bodyPublisher = HttpRequest.BodyPublishers.noBody(); + if (request.requestBody != null) { + serializedRequestBody = new FakePostRequestBody.FakePostRequestBody1().serialize( + request.requestBody + ); + var contentTypeHeaderValues = headers.getOrDefault("Content-Type", new ArrayList<>()); + contentTypeHeaderValues.add(serializedRequestBody.contentType); + bodyPublisher = serializedRequestBody.bodyPublisher; + } + // TODO set this to a map if there is a query security scheme + @Nullable Map queryMap = null; + String host = apiConfiguration.getServer(request.serverIndex).url(); + SecurityRequirementObject securityRequirementObject = apiConfiguration.getSecurityRequirementObject(request.securityIndex); + updateParamsForAuth( + securityRequirementObject, + headers, + Fake.path, + method, + bodyPublisher, + queryMap, + apiConfiguration + ); + + String url = host + Fake.path; + var httpRequest = RestClient.getRequest( + url, + method, + bodyPublisher, + headers, + request.timeout + ); + var response = RestClient.getResponse(httpRequest, client); + var responsesDeserializer = new FakePostResponses.FakePostResponses1(); + return responsesDeserializer.deserialize(response, schemaConfiguration); + } + } + + public interface PostOperation { + ApiConfiguration getApiConfiguration(); + SchemaConfiguration getSchemaConfiguration(); + HttpClient getClient(); + default FakePostResponses.EndpointResponse post(PostRequest request) throws IOException, InterruptedException, ValidationException, NotImplementedException, ApiException { + return PostProvider.post(request, getApiConfiguration(), getSchemaConfiguration(), getClient()); + } + } + + public interface EndpointParametersOperation { + ApiConfiguration getApiConfiguration(); + SchemaConfiguration getSchemaConfiguration(); + HttpClient getClient(); + default FakePostResponses.EndpointResponse endpointParameters(PostRequest request) throws IOException, InterruptedException, ValidationException, NotImplementedException, ApiException { + return PostProvider.post(request, getApiConfiguration(), getSchemaConfiguration(), getClient()); + } + } + + public static class Post extends ApiClient implements PostOperation { + public Post(ApiConfiguration apiConfiguration, SchemaConfiguration schemaConfiguration) { + super(apiConfiguration, schemaConfiguration); + } + } + + public static class PostRequest { + public FakePostRequestBody.@Nullable SealedRequestBody requestBody; + public RootServerInfo.@Nullable ServerIndex serverIndex; + public FakePostSecurityInfo.@Nullable SecurityIndex securityIndex; + public @Nullable Duration timeout; + } + + public interface SetterForRequestBody { + PostRequest getInstance(); + T getBuilderAfterRequestBody(PostRequest instance); + default T requestBody(FakePostRequestBody.SealedRequestBody requestBody) { + var instance = getInstance(); + instance.requestBody = requestBody; + return getBuilderAfterRequestBody(instance); + } + } + + public interface SetterForServerIndex { + PostRequest getInstance(); + T getBuilderAfterServerIndex(PostRequest instance); + default T serverIndex(RootServerInfo.ServerIndex serverIndex) { + var instance = getInstance(); + instance.serverIndex = serverIndex; + return getBuilderAfterServerIndex(instance); + } + } + + public interface SetterForSecurityIndex { + PostRequest getInstance(); + T getBuilderAfterSecurityIndex(PostRequest instance); + default T securityIndex(FakePostSecurityInfo.SecurityIndex securityIndex) { + var instance = getInstance(); + instance.securityIndex = securityIndex; + return getBuilderAfterSecurityIndex(instance); + } + } + + public interface SetterForTimeout { + PostRequest getInstance(); + T getBuilderAfterTimeout(PostRequest instance); + default T timeout(Duration timeout) { + var instance = getInstance(); + instance.timeout = timeout; + return getBuilderAfterTimeout(instance); + } + } + + public static class PostRequestBuilder implements SetterForRequestBody, SetterForServerIndex, SetterForSecurityIndex, SetterForTimeout { + private final PostRequest instance; + + public PostRequestBuilder() { + this.instance = new PostRequest(); + } + + public PostRequest build() { + return instance; + } + + public PostRequest getInstance() { + return instance; + } + + public PostRequestBuilder getBuilderAfterRequestBody(PostRequest instance) { + return this; + } + + public PostRequestBuilder getBuilderAfterServerIndex(PostRequest instance) { + return this; + } + + public PostRequestBuilder getBuilderAfterSecurityIndex(PostRequest instance) { + return this; + } + + public PostRequestBuilder getBuilderAfterTimeout(PostRequest instance) { + return this; + } + } +} diff --git a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/fake/delete/FakeDeleteHeaderParameters.kt b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/fake/delete/FakeDeleteHeaderParameters.kt new file mode 100644 index 00000000000..c63bc8e9304 --- /dev/null +++ b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/fake/delete/FakeDeleteHeaderParameters.kt @@ -0,0 +1,246 @@ +package org.openapijsonschematools.client.paths.fake.delete; +import java.util.ArrayList; +import java.util.HashSet; +import java.util.LinkedHashMap; +import java.util.LinkedHashSet; +import java.util.List; +import java.util.Map; +import java.util.Objects; +import java.util.Set; +import org.checkerframework.checker.nullness.qual.Nullable; +import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags; +import org.openapijsonschematools.client.configurations.SchemaConfiguration; +import org.openapijsonschematools.client.exceptions.UnsetPropertyException; +import org.openapijsonschematools.client.exceptions.ValidationException; +import org.openapijsonschematools.client.paths.fake.delete.parameters.parameter1.Schema1; +import org.openapijsonschematools.client.paths.fake.delete.parameters.parameter4.Schema4; +import org.openapijsonschematools.client.schemas.AnyTypeJsonSchema; +import org.openapijsonschematools.client.schemas.GenericBuilder; +import org.openapijsonschematools.client.schemas.NotAnyTypeJsonSchema; +import org.openapijsonschematools.client.schemas.validation.FrozenMap; +import org.openapijsonschematools.client.schemas.validation.JsonSchema; +import org.openapijsonschematools.client.schemas.validation.JsonSchemaInfo; +import org.openapijsonschematools.client.schemas.validation.MapSchemaValidator; +import org.openapijsonschematools.client.schemas.validation.MapUtils; +import org.openapijsonschematools.client.schemas.validation.PathToSchemasMap; +import org.openapijsonschematools.client.schemas.validation.PropertyEntry; +import org.openapijsonschematools.client.schemas.validation.ValidationMetadata; + +public class FakeDeleteHeaderParameters { + // nest classes so all schemas and input/output classes can be public + + + public static class AdditionalProperties extends NotAnyTypeJsonSchema.NotAnyTypeJsonSchema1 { + // NotAnyTypeSchema + private static @Nullable AdditionalProperties instance = null; + public static AdditionalProperties getInstance() { + if (instance == null) { + instance = new AdditionalProperties(); + } + return instance; + } + } + + + public static class HeaderParametersMap extends FrozenMap<@Nullable Object> { + protected HeaderParametersMap(FrozenMap<@Nullable Object> m) { + super(m); + } + public static final Set requiredKeys = Set.of( + "required_boolean_group" + ); + public static final Set optionalKeys = Set.of( + "boolean_group" + ); + public static HeaderParametersMap of(Map arg, SchemaConfiguration configuration) throws ValidationException { + return FakeDeleteHeaderParameters1.getInstance().validate(arg, configuration); + } + + 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"); + } + return (String) value; + } + + public String boolean_group() throws UnsetPropertyException { + String key = "boolean_group"; + throwIfKeyNotPresent(key); + @Nullable Object value = get(key); + if (!(value instanceof String)) { + throw new RuntimeException("Invalid value stored for boolean_group"); + } + return (String) value; + } + } + + public interface SetterForRequiredBooleanGroup { + Map getInstance(); + T getBuilderAfterRequiredBooleanGroup(Map instance); + + default T required_boolean_group(String value) { + var instance = getInstance(); + instance.put("required_boolean_group", value); + return getBuilderAfterRequiredBooleanGroup(instance); + } + + default T required_boolean_group(Schema1.StringSchemaEnums1 value) { + var instance = getInstance(); + instance.put("required_boolean_group", value.value()); + return getBuilderAfterRequiredBooleanGroup(instance); + } + } + + public interface SetterForBooleanGroup { + Map getInstance(); + T getBuilderAfterBooleanGroup(Map instance); + + default T boolean_group(String value) { + var instance = getInstance(); + instance.put("boolean_group", value); + return getBuilderAfterBooleanGroup(instance); + } + + default T boolean_group(Schema4.StringSchemaEnums4 value) { + var instance = getInstance(); + instance.put("boolean_group", value.value()); + return getBuilderAfterBooleanGroup(instance); + } + } + + public static class HeaderParametersMap0Builder implements GenericBuilder>, SetterForBooleanGroup { + private final Map instance; + private static final Set knownKeys = Set.of( + "required_boolean_group", + "boolean_group" + ); + public Set getKnownKeys() { + return knownKeys; + } + public HeaderParametersMap0Builder(Map instance) { + this.instance = instance; + } + public Map build() { + return instance; + } + public Map getInstance() { + return instance; + } + public HeaderParametersMap0Builder getBuilderAfterBooleanGroup(Map instance) { + return this; + } + } + + public static class HeaderParametersMapBuilder implements SetterForRequiredBooleanGroup { + private final Map instance; + public HeaderParametersMapBuilder() { + this.instance = new LinkedHashMap<>(); + } + public Map getInstance() { + return instance; + } + public HeaderParametersMap0Builder getBuilderAfterRequiredBooleanGroup(Map instance) { + return new HeaderParametersMap0Builder(instance); + } + } + + + public sealed interface FakeDeleteHeaderParameters1Boxed permits FakeDeleteHeaderParameters1BoxedMap { + @Nullable Object getData(); + } + + public record FakeDeleteHeaderParameters1BoxedMap(HeaderParametersMap data) implements FakeDeleteHeaderParameters1Boxed { + @Override + public @Nullable Object getData() { + return data; + } + } + + + public static class FakeDeleteHeaderParameters1 extends JsonSchema implements MapSchemaValidator { + private static @Nullable FakeDeleteHeaderParameters1 instance = null; + + protected FakeDeleteHeaderParameters1() { + super(new JsonSchemaInfo() + .type(Set.of(Map.class)) + .properties(Map.ofEntries( + new PropertyEntry("required_boolean_group", Schema1.Schema11.class), + new PropertyEntry("boolean_group", Schema4.Schema41.class) + )) + .required(Set.of( + "required_boolean_group" + )) + .additionalProperties(AdditionalProperties.class) + ); + } + + public static FakeDeleteHeaderParameters1 getInstance() { + if (instance == null) { + instance = new FakeDeleteHeaderParameters1(); + } + return instance; + } + + 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 RuntimeException("Invalid non-string key value"); + } + String propertyName = (String) entryKey; + List propertyPathToItem = new ArrayList<>(pathToItem); + propertyPathToItem.add(propertyName); + Object value = entry.getValue(); + LinkedHashMap, Nothing?> schemas = pathToSchemas.get(propertyPathToItem); + if (schemas == null) { + throw new RuntimeException("Validation result is invalid, schemas must exist for a pathToItem"); + } + JsonSchema propertySchema = schemas.entrySet().iterator().next().getKey(); + @Nullable Object propertyInstance = propertySchema.getNewInstance(value, propertyPathToItem, pathToSchemas); + properties.put(propertyName, propertyInstance); + } + FrozenMap<@Nullable Object> castProperties = new FrozenMap<>(properties); + return new HeaderParametersMap(castProperties); + } + + 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); + SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().build())); + ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, new PathToSchemasMap(), new LinkedHashSet<>()); + PathToSchemasMap pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet); + return getNewInstance(castArg, validationMetadata.pathToItem(), pathToSchemasMap); + } + + + @Override + public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws 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"); + } + @Override + public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { + if (arg instanceof Map) { + return getNewInstance((Map) arg, pathToItem, pathToSchemas); + } + throw new RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); + } + @Override + public FakeDeleteHeaderParameters1BoxedMap validateAndBox(Map arg, SchemaConfiguration configuration) throws ValidationException { + return new FakeDeleteHeaderParameters1BoxedMap(validate(arg, configuration)); + } + @Override + public FakeDeleteHeaderParameters1Boxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { + 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"); + } + } + +} diff --git a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/fake/delete/FakeDeleteQueryParameters.kt b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/fake/delete/FakeDeleteQueryParameters.kt new file mode 100644 index 00000000000..f8e90e07df8 --- /dev/null +++ b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/fake/delete/FakeDeleteQueryParameters.kt @@ -0,0 +1,351 @@ +package org.openapijsonschematools.client.paths.fake.delete; +import java.util.ArrayList; +import java.util.HashSet; +import java.util.LinkedHashMap; +import java.util.LinkedHashSet; +import java.util.List; +import java.util.Map; +import java.util.Objects; +import java.util.Set; +import org.checkerframework.checker.nullness.qual.Nullable; +import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags; +import org.openapijsonschematools.client.configurations.SchemaConfiguration; +import org.openapijsonschematools.client.exceptions.UnsetPropertyException; +import org.openapijsonschematools.client.exceptions.ValidationException; +import org.openapijsonschematools.client.paths.fake.delete.parameters.parameter0.Schema0; +import org.openapijsonschematools.client.paths.fake.delete.parameters.parameter2.Schema2; +import org.openapijsonschematools.client.paths.fake.delete.parameters.parameter3.Schema3; +import org.openapijsonschematools.client.paths.fake.delete.parameters.parameter5.Schema5; +import org.openapijsonschematools.client.schemas.AnyTypeJsonSchema; +import org.openapijsonschematools.client.schemas.GenericBuilder; +import org.openapijsonschematools.client.schemas.NotAnyTypeJsonSchema; +import org.openapijsonschematools.client.schemas.validation.FrozenMap; +import org.openapijsonschematools.client.schemas.validation.JsonSchema; +import org.openapijsonschematools.client.schemas.validation.JsonSchemaInfo; +import org.openapijsonschematools.client.schemas.validation.MapSchemaValidator; +import org.openapijsonschematools.client.schemas.validation.MapUtils; +import org.openapijsonschematools.client.schemas.validation.PathToSchemasMap; +import org.openapijsonschematools.client.schemas.validation.PropertyEntry; +import org.openapijsonschematools.client.schemas.validation.ValidationMetadata; + +public class FakeDeleteQueryParameters { + // nest classes so all schemas and input/output classes can be public + + + public static class AdditionalProperties extends NotAnyTypeJsonSchema.NotAnyTypeJsonSchema1 { + // NotAnyTypeSchema + private static @Nullable AdditionalProperties instance = null; + public static AdditionalProperties getInstance() { + if (instance == null) { + instance = new AdditionalProperties(); + } + return instance; + } + } + + + public static class QueryParametersMap extends FrozenMap<@Nullable Object> { + protected QueryParametersMap(FrozenMap<@Nullable Object> m) { + super(m); + } + public static final Set requiredKeys = Set.of( + "required_int64_group", + "required_string_group" + ); + public static final Set optionalKeys = Set.of( + "int64_group", + "string_group" + ); + public static QueryParametersMap of(Map arg, SchemaConfiguration configuration) throws ValidationException { + return FakeDeleteQueryParameters1.getInstance().validate(arg, configuration); + } + + 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"); + } + return (Number) value; + } + + 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"); + } + return (String) value; + } + + public Number int64_group() throws UnsetPropertyException { + String key = "int64_group"; + throwIfKeyNotPresent(key); + @Nullable Object value = get(key); + if (!(value instanceof Number)) { + throw new RuntimeException("Invalid value stored for int64_group"); + } + return (Number) value; + } + + public String string_group() throws UnsetPropertyException { + String key = "string_group"; + throwIfKeyNotPresent(key); + @Nullable Object value = get(key); + if (!(value instanceof String)) { + throw new RuntimeException("Invalid value stored for string_group"); + } + return (String) value; + } + } + + public interface SetterForRequiredInt64Group { + Map getInstance(); + T getBuilderAfterRequiredInt64Group(Map instance); + + default T required_int64_group(int value) { + var instance = getInstance(); + instance.put("required_int64_group", value); + return getBuilderAfterRequiredInt64Group(instance); + } + + default T required_int64_group(float value) { + var instance = getInstance(); + instance.put("required_int64_group", value); + return getBuilderAfterRequiredInt64Group(instance); + } + + default T required_int64_group(long value) { + var instance = getInstance(); + instance.put("required_int64_group", value); + return getBuilderAfterRequiredInt64Group(instance); + } + + default T required_int64_group(double value) { + var instance = getInstance(); + instance.put("required_int64_group", value); + return getBuilderAfterRequiredInt64Group(instance); + } + } + + public interface SetterForRequiredStringGroup { + Map getInstance(); + T getBuilderAfterRequiredStringGroup(Map instance); + + default T required_string_group(String value) { + var instance = getInstance(); + instance.put("required_string_group", value); + return getBuilderAfterRequiredStringGroup(instance); + } + } + + public interface SetterForInt64Group { + Map getInstance(); + T getBuilderAfterInt64Group(Map instance); + + default T int64_group(int value) { + var instance = getInstance(); + instance.put("int64_group", value); + return getBuilderAfterInt64Group(instance); + } + + default T int64_group(float value) { + var instance = getInstance(); + instance.put("int64_group", value); + return getBuilderAfterInt64Group(instance); + } + + default T int64_group(long value) { + var instance = getInstance(); + instance.put("int64_group", value); + return getBuilderAfterInt64Group(instance); + } + + default T int64_group(double value) { + var instance = getInstance(); + instance.put("int64_group", value); + return getBuilderAfterInt64Group(instance); + } + } + + public interface SetterForStringGroup { + Map getInstance(); + T getBuilderAfterStringGroup(Map instance); + + default T string_group(String value) { + var instance = getInstance(); + instance.put("string_group", value); + return getBuilderAfterStringGroup(instance); + } + } + + public static class QueryParametersMap00Builder implements GenericBuilder>, SetterForInt64Group, SetterForStringGroup { + private final Map instance; + private static final Set knownKeys = Set.of( + "required_int64_group", + "required_string_group", + "int64_group", + "string_group" + ); + public Set getKnownKeys() { + return knownKeys; + } + public QueryParametersMap00Builder(Map instance) { + this.instance = instance; + } + public Map build() { + return instance; + } + public Map getInstance() { + return instance; + } + public QueryParametersMap00Builder getBuilderAfterInt64Group(Map instance) { + return this; + } + public QueryParametersMap00Builder getBuilderAfterStringGroup(Map instance) { + return this; + } + } + + public static class QueryParametersMap01Builder implements SetterForRequiredStringGroup { + private final Map instance; + public QueryParametersMap01Builder(Map instance) { + this.instance = instance; + } + public Map getInstance() { + return instance; + } + public QueryParametersMap00Builder getBuilderAfterRequiredStringGroup(Map instance) { + return new QueryParametersMap00Builder(instance); + } + } + + public static class QueryParametersMap10Builder implements SetterForRequiredInt64Group { + private final Map instance; + public QueryParametersMap10Builder(Map instance) { + this.instance = instance; + } + public Map getInstance() { + return instance; + } + public QueryParametersMap00Builder getBuilderAfterRequiredInt64Group(Map instance) { + return new QueryParametersMap00Builder(instance); + } + } + + public static class QueryParametersMapBuilder implements SetterForRequiredInt64Group, SetterForRequiredStringGroup { + private final Map instance; + public QueryParametersMapBuilder() { + this.instance = new LinkedHashMap<>(); + } + public Map getInstance() { + return instance; + } + public QueryParametersMap01Builder getBuilderAfterRequiredInt64Group(Map instance) { + return new QueryParametersMap01Builder(instance); + } + public QueryParametersMap10Builder getBuilderAfterRequiredStringGroup(Map instance) { + return new QueryParametersMap10Builder(instance); + } + } + + + public sealed interface FakeDeleteQueryParameters1Boxed permits FakeDeleteQueryParameters1BoxedMap { + @Nullable Object getData(); + } + + public record FakeDeleteQueryParameters1BoxedMap(QueryParametersMap data) implements FakeDeleteQueryParameters1Boxed { + @Override + public @Nullable Object getData() { + return data; + } + } + + + public static class FakeDeleteQueryParameters1 extends JsonSchema implements MapSchemaValidator { + private static @Nullable FakeDeleteQueryParameters1 instance = null; + + protected FakeDeleteQueryParameters1() { + super(new JsonSchemaInfo() + .type(Set.of(Map.class)) + .properties(Map.ofEntries( + new PropertyEntry("required_string_group", Schema0.Schema01.class), + new PropertyEntry("int64_group", Schema5.Schema51.class), + new PropertyEntry("string_group", Schema3.Schema31.class), + new PropertyEntry("required_int64_group", Schema2.Schema21.class) + )) + .required(Set.of( + "required_int64_group", + "required_string_group" + )) + .additionalProperties(AdditionalProperties.class) + ); + } + + public static FakeDeleteQueryParameters1 getInstance() { + if (instance == null) { + instance = new FakeDeleteQueryParameters1(); + } + return instance; + } + + 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 RuntimeException("Invalid non-string key value"); + } + String propertyName = (String) entryKey; + List propertyPathToItem = new ArrayList<>(pathToItem); + propertyPathToItem.add(propertyName); + Object value = entry.getValue(); + LinkedHashMap, Nothing?> schemas = pathToSchemas.get(propertyPathToItem); + if (schemas == null) { + throw new RuntimeException("Validation result is invalid, schemas must exist for a pathToItem"); + } + JsonSchema propertySchema = schemas.entrySet().iterator().next().getKey(); + @Nullable Object propertyInstance = propertySchema.getNewInstance(value, propertyPathToItem, pathToSchemas); + properties.put(propertyName, propertyInstance); + } + FrozenMap<@Nullable Object> castProperties = new FrozenMap<>(properties); + return new QueryParametersMap(castProperties); + } + + 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); + SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().build())); + ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, new PathToSchemasMap(), new LinkedHashSet<>()); + PathToSchemasMap pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet); + return getNewInstance(castArg, validationMetadata.pathToItem(), pathToSchemasMap); + } + + + @Override + public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws 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"); + } + @Override + public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { + if (arg instanceof Map) { + return getNewInstance((Map) arg, pathToItem, pathToSchemas); + } + throw new RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); + } + @Override + public FakeDeleteQueryParameters1BoxedMap validateAndBox(Map arg, SchemaConfiguration configuration) throws ValidationException { + return new FakeDeleteQueryParameters1BoxedMap(validate(arg, configuration)); + } + @Override + public FakeDeleteQueryParameters1Boxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { + 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"); + } + } + +} diff --git a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/fake/delete/FakeDeleteResponses.kt b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/fake/delete/FakeDeleteResponses.kt new file mode 100644 index 00000000000..24b7f3ebd46 --- /dev/null +++ b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/fake/delete/FakeDeleteResponses.kt @@ -0,0 +1,53 @@ +package org.openapijsonschematools.client.paths.fake.delete; + +import org.openapijsonschematools.client.paths.fake.delete.responses.FakeDeleteCode200Response; +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; +import org.checkerframework.checker.nullness.qual.Nullable; + +import java.net.http.HttpResponse; +import java.util.Map; +import java.util.AbstractMap; + +public class FakeDeleteResponses { + public sealed interface EndpointResponse permits EndpointFakeDeleteCode200Response {} + + public record EndpointFakeDeleteCode200Response( + HttpResponse response, + Nothing? body, + Nothing? headers + ) implements EndpointResponse, ApiResponse{ + } + + public sealed interface StatusCodeResponseDeserializer permits StatusFakeDeleteCode200ResponseDeserializer {} + + public static final class StatusFakeDeleteCode200ResponseDeserializer extends FakeDeleteCode200Response.FakeDeleteCode200Response1 implements StatusCodeResponseDeserializer { + } + + public static final class FakeDeleteResponses1 implements ResponsesDeserializer { + private final Map statusCodeToResponseDeserializer; + public FakeDeleteResponses1() { + this.statusCodeToResponseDeserializer = Map.ofEntries( + new AbstractMap.SimpleEntry<>("200", new StatusFakeDeleteCode200ResponseDeserializer()) + ); + } + + 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) { + throw new ApiException( + "Invalid response statusCode="+statusCode+" has no response defined in the openapi document", + response + ); + } + StatusFakeDeleteCode200ResponseDeserializer castDeserializer = (StatusFakeDeleteCode200ResponseDeserializer) statusCodeDeserializer; + var deserializedResponse = castDeserializer.deserialize(response, configuration); + return new EndpointFakeDeleteCode200Response(response, deserializedResponse.body(), deserializedResponse.headers()); + } + } +} diff --git a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/fake/delete/FakeDeleteSecurityInfo.kt b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/fake/delete/FakeDeleteSecurityInfo.kt new file mode 100644 index 00000000000..1d8502b4091 --- /dev/null +++ b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/fake/delete/FakeDeleteSecurityInfo.kt @@ -0,0 +1,24 @@ +package org.openapijsonschematools.client.paths.fake.delete; + +import org.openapijsonschematools.client.paths.fake.delete.security.FakeDeleteSecurityRequirementObject0; +import org.openapijsonschematools.client.securityrequirementobjects.SecurityRequirementObject; +import org.openapijsonschematools.client.securityrequirementobjects.SecurityRequirementObjectProvider; + +public class FakeDeleteSecurityInfo { + public static class FakeDeleteSecurityInfo1 implements SecurityRequirementObjectProvider { + public final FakeDeleteSecurityRequirementObject0 security0; + + public FakeDeleteSecurityInfo1() { + security0 = new FakeDeleteSecurityRequirementObject0(); + } + + @Override + public SecurityRequirementObject getSecurityRequirementObject(SecurityIndex securityIndex) { + return security0; + } + } + + public enum SecurityIndex { + SECURITY_0 + } +} \ No newline at end of file diff --git a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/fake/delete/Parameters.kt b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/fake/delete/Parameters.kt new file mode 100644 index 00000000000..ba70280cca5 --- /dev/null +++ b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/fake/delete/Parameters.kt @@ -0,0 +1,40 @@ +package org.openapijsonschematools.client.paths.fake.delete; + +import org.openapijsonschematools.client.paths.fake.delete.parameters.Parameter0; +import org.openapijsonschematools.client.paths.fake.delete.parameters.Parameter1; +import org.openapijsonschematools.client.paths.fake.delete.parameters.Parameter2; +import org.openapijsonschematools.client.paths.fake.delete.parameters.Parameter3; +import org.openapijsonschematools.client.paths.fake.delete.parameters.Parameter4; +import org.openapijsonschematools.client.paths.fake.delete.parameters.Parameter5; +import org.openapijsonschematools.client.parameter.HeadersSerializer; +import org.openapijsonschematools.client.parameter.QuerySerializer; + +import java.util.Map; +import java.util.AbstractMap; + +public class Parameters { + + public static class QueryParametersSerializer extends QuerySerializer { + public QueryParametersSerializer() { + super( + Map.ofEntries( + new AbstractMap.SimpleEntry<>("required_string_group", new Parameter0.Parameter01()), + new AbstractMap.SimpleEntry<>("required_int64_group", new Parameter2.Parameter21()), + new AbstractMap.SimpleEntry<>("string_group", new Parameter3.Parameter31()), + new AbstractMap.SimpleEntry<>("int64_group", new Parameter5.Parameter51()) + ) + ); + } + } + + public static class HeaderParametersSerializer extends HeadersSerializer { + public HeaderParametersSerializer() { + super( + Map.ofEntries( + new AbstractMap.SimpleEntry<>("required_boolean_group", new Parameter1.Parameter11()), + new AbstractMap.SimpleEntry<>("boolean_group", new Parameter4.Parameter41()) + ) + ); + } + } +} diff --git a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/fake/delete/parameters/Parameter0.kt b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/fake/delete/parameters/Parameter0.kt new file mode 100644 index 00000000000..5872e87f523 --- /dev/null +++ b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/fake/delete/parameters/Parameter0.kt @@ -0,0 +1,23 @@ +package org.openapijsonschematools.client.paths.fake.delete.parameters; + +import org.openapijsonschematools.client.parameter.ParameterStyle; +import org.openapijsonschematools.client.parameter.ParameterInType; +import org.openapijsonschematools.client.parameter.SchemaParameter; +import org.openapijsonschematools.client.paths.fake.delete.parameters.parameter0.Schema0; + +public class Parameter0 { + + public static class Parameter01 extends SchemaParameter { + public Parameter01() { + super( + "required_string_group", + ParameterInType.QUERY, + true, + ParameterStyle.FORM, + true, + false, + Schema0.Schema01.getInstance() + ); + } + } +} diff --git a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/fake/delete/parameters/Parameter1.kt b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/fake/delete/parameters/Parameter1.kt new file mode 100644 index 00000000000..d74937b4fc9 --- /dev/null +++ b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/fake/delete/parameters/Parameter1.kt @@ -0,0 +1,23 @@ +package org.openapijsonschematools.client.paths.fake.delete.parameters; + +import org.openapijsonschematools.client.parameter.ParameterStyle; +import org.openapijsonschematools.client.parameter.ParameterInType; +import org.openapijsonschematools.client.parameter.SchemaParameter; +import org.openapijsonschematools.client.paths.fake.delete.parameters.parameter1.Schema1; + +public class Parameter1 { + + public static class Parameter11 extends SchemaParameter { + public Parameter11() { + super( + "required_boolean_group", + ParameterInType.HEADER, + true, + ParameterStyle.SIMPLE, + false, + false, + Schema1.Schema11.getInstance() + ); + } + } +} diff --git a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/fake/delete/parameters/Parameter2.kt b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/fake/delete/parameters/Parameter2.kt new file mode 100644 index 00000000000..9453ce7bcb3 --- /dev/null +++ b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/fake/delete/parameters/Parameter2.kt @@ -0,0 +1,23 @@ +package org.openapijsonschematools.client.paths.fake.delete.parameters; + +import org.openapijsonschematools.client.parameter.ParameterStyle; +import org.openapijsonschematools.client.parameter.ParameterInType; +import org.openapijsonschematools.client.parameter.SchemaParameter; +import org.openapijsonschematools.client.paths.fake.delete.parameters.parameter2.Schema2; + +public class Parameter2 { + + public static class Parameter21 extends SchemaParameter { + public Parameter21() { + super( + "required_int64_group", + ParameterInType.QUERY, + true, + ParameterStyle.FORM, + true, + false, + Schema2.Schema21.getInstance() + ); + } + } +} diff --git a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/fake/delete/parameters/Parameter3.kt b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/fake/delete/parameters/Parameter3.kt new file mode 100644 index 00000000000..c2121467a18 --- /dev/null +++ b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/fake/delete/parameters/Parameter3.kt @@ -0,0 +1,23 @@ +package org.openapijsonschematools.client.paths.fake.delete.parameters; + +import org.openapijsonschematools.client.parameter.ParameterStyle; +import org.openapijsonschematools.client.parameter.ParameterInType; +import org.openapijsonschematools.client.parameter.SchemaParameter; +import org.openapijsonschematools.client.paths.fake.delete.parameters.parameter3.Schema3; + +public class Parameter3 { + + public static class Parameter31 extends SchemaParameter { + public Parameter31() { + super( + "string_group", + ParameterInType.QUERY, + false, + ParameterStyle.FORM, + true, + false, + Schema3.Schema31.getInstance() + ); + } + } +} diff --git a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/fake/delete/parameters/Parameter4.kt b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/fake/delete/parameters/Parameter4.kt new file mode 100644 index 00000000000..c755206ddac --- /dev/null +++ b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/fake/delete/parameters/Parameter4.kt @@ -0,0 +1,23 @@ +package org.openapijsonschematools.client.paths.fake.delete.parameters; + +import org.openapijsonschematools.client.parameter.ParameterStyle; +import org.openapijsonschematools.client.parameter.ParameterInType; +import org.openapijsonschematools.client.parameter.SchemaParameter; +import org.openapijsonschematools.client.paths.fake.delete.parameters.parameter4.Schema4; + +public class Parameter4 { + + public static class Parameter41 extends SchemaParameter { + public Parameter41() { + super( + "boolean_group", + ParameterInType.HEADER, + false, + ParameterStyle.SIMPLE, + false, + false, + Schema4.Schema41.getInstance() + ); + } + } +} diff --git a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/fake/delete/parameters/Parameter5.kt b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/fake/delete/parameters/Parameter5.kt new file mode 100644 index 00000000000..91ea65b5be7 --- /dev/null +++ b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/fake/delete/parameters/Parameter5.kt @@ -0,0 +1,23 @@ +package org.openapijsonschematools.client.paths.fake.delete.parameters; + +import org.openapijsonschematools.client.parameter.ParameterStyle; +import org.openapijsonschematools.client.parameter.ParameterInType; +import org.openapijsonschematools.client.parameter.SchemaParameter; +import org.openapijsonschematools.client.paths.fake.delete.parameters.parameter5.Schema5; + +public class Parameter5 { + + public static class Parameter51 extends SchemaParameter { + public Parameter51() { + super( + "int64_group", + ParameterInType.QUERY, + false, + ParameterStyle.FORM, + true, + false, + Schema5.Schema51.getInstance() + ); + } + } +} diff --git a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/fake/delete/parameters/parameter0/Schema0.kt b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/fake/delete/parameters/parameter0/Schema0.kt new file mode 100644 index 00000000000..85b207cd05f --- /dev/null +++ b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/fake/delete/parameters/parameter0/Schema0.kt @@ -0,0 +1,19 @@ +package org.openapijsonschematools.client.paths.fake.delete.parameters.parameter0; +import org.checkerframework.checker.nullness.qual.Nullable; +import org.openapijsonschematools.client.schemas.StringJsonSchema; + +public class Schema0 extends StringJsonSchema { + // nest classes so all schemas and input/output classes can be public + + + public static class Schema01 extends StringJsonSchema.StringJsonSchema1 { + private static @Nullable Schema01 instance = null; + public static Schema01 getInstance() { + if (instance == null) { + instance = new Schema01(); + } + return instance; + } + } + +} diff --git a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/fake/delete/parameters/parameter1/Schema1.kt b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/fake/delete/parameters/parameter1/Schema1.kt new file mode 100644 index 00000000000..ec9ab334ddc --- /dev/null +++ b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/fake/delete/parameters/parameter1/Schema1.kt @@ -0,0 +1,114 @@ +package org.openapijsonschematools.client.paths.fake.delete.parameters.parameter1; +import java.util.HashSet; +import java.util.LinkedHashSet; +import java.util.List; +import java.util.Objects; +import java.util.Set; +import org.checkerframework.checker.nullness.qual.Nullable; +import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags; +import org.openapijsonschematools.client.configurations.SchemaConfiguration; +import org.openapijsonschematools.client.exceptions.ValidationException; +import org.openapijsonschematools.client.schemas.SetMaker; +import org.openapijsonschematools.client.schemas.validation.JsonSchema; +import org.openapijsonschematools.client.schemas.validation.JsonSchemaInfo; +import org.openapijsonschematools.client.schemas.validation.PathToSchemasMap; +import org.openapijsonschematools.client.schemas.validation.StringEnumValidator; +import org.openapijsonschematools.client.schemas.validation.StringSchemaValidator; +import org.openapijsonschematools.client.schemas.validation.StringValueMethod; +import org.openapijsonschematools.client.schemas.validation.ValidationMetadata; + +public class Schema1 { + // nest classes so all schemas and input/output classes can be public + + public enum StringSchemaEnums1 implements StringValueMethod { + TRUE("true"), + FALSE("false"); + private final String value; + + StringSchemaEnums1(String value) { + this.value = value; + } + public String value() { + return this.value; + } + } + + + public sealed interface Schema11Boxed permits Schema11BoxedString { + @Nullable Object getData(); + } + + public record Schema11BoxedString(String data) implements Schema11Boxed { + @Override + public @Nullable Object getData() { + return data; + } + } + + + + public static class Schema11 extends JsonSchema implements StringSchemaValidator, StringEnumValidator { + private static @Nullable Schema11 instance = null; + + protected Schema11() { + super(new JsonSchemaInfo() + .type(Set.of( + String.class + )) + .enumValues(SetMaker.makeSet( + "true", + "false" + )) + ); + } + + public static Schema11 getInstance() { + if (instance == null) { + instance = new Schema11(); + } + return instance; + } + + @Override + public String validate(String arg, SchemaConfiguration configuration) throws ValidationException { + Set> pathSet = new HashSet<>(); + List pathToItem = List.of("args[0"); + String castArg = castToAllowedTypes(arg, pathToItem, pathSet); + SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().build())); + ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, new PathToSchemasMap(), new LinkedHashSet<>()); + getPathToSchemas(this, castArg, validationMetadata, pathSet); + return castArg; + } + + @Override + 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 { + 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"); + } + @Override + public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { + 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"); + } + @Override + 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 { + 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"); + } + } +} diff --git a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/fake/delete/parameters/parameter2/Schema2.kt b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/fake/delete/parameters/parameter2/Schema2.kt new file mode 100644 index 00000000000..93cb91de837 --- /dev/null +++ b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/fake/delete/parameters/parameter2/Schema2.kt @@ -0,0 +1,19 @@ +package org.openapijsonschematools.client.paths.fake.delete.parameters.parameter2; +import org.checkerframework.checker.nullness.qual.Nullable; +import org.openapijsonschematools.client.schemas.Int64JsonSchema; + +public class Schema2 extends Int64JsonSchema { + // nest classes so all schemas and input/output classes can be public + + + public static class Schema21 extends Int64JsonSchema.Int64JsonSchema1 { + private static @Nullable Schema21 instance = null; + public static Schema21 getInstance() { + if (instance == null) { + instance = new Schema21(); + } + return instance; + } + } + +} diff --git a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/fake/delete/parameters/parameter3/Schema3.kt b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/fake/delete/parameters/parameter3/Schema3.kt new file mode 100644 index 00000000000..4ec69a80fc9 --- /dev/null +++ b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/fake/delete/parameters/parameter3/Schema3.kt @@ -0,0 +1,19 @@ +package org.openapijsonschematools.client.paths.fake.delete.parameters.parameter3; +import org.checkerframework.checker.nullness.qual.Nullable; +import org.openapijsonschematools.client.schemas.StringJsonSchema; + +public class Schema3 extends StringJsonSchema { + // nest classes so all schemas and input/output classes can be public + + + public static class Schema31 extends StringJsonSchema.StringJsonSchema1 { + private static @Nullable Schema31 instance = null; + public static Schema31 getInstance() { + if (instance == null) { + instance = new Schema31(); + } + return instance; + } + } + +} diff --git a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/fake/delete/parameters/parameter4/Schema4.kt b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/fake/delete/parameters/parameter4/Schema4.kt new file mode 100644 index 00000000000..023f18175d6 --- /dev/null +++ b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/fake/delete/parameters/parameter4/Schema4.kt @@ -0,0 +1,114 @@ +package org.openapijsonschematools.client.paths.fake.delete.parameters.parameter4; +import java.util.HashSet; +import java.util.LinkedHashSet; +import java.util.List; +import java.util.Objects; +import java.util.Set; +import org.checkerframework.checker.nullness.qual.Nullable; +import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags; +import org.openapijsonschematools.client.configurations.SchemaConfiguration; +import org.openapijsonschematools.client.exceptions.ValidationException; +import org.openapijsonschematools.client.schemas.SetMaker; +import org.openapijsonschematools.client.schemas.validation.JsonSchema; +import org.openapijsonschematools.client.schemas.validation.JsonSchemaInfo; +import org.openapijsonschematools.client.schemas.validation.PathToSchemasMap; +import org.openapijsonschematools.client.schemas.validation.StringEnumValidator; +import org.openapijsonschematools.client.schemas.validation.StringSchemaValidator; +import org.openapijsonschematools.client.schemas.validation.StringValueMethod; +import org.openapijsonschematools.client.schemas.validation.ValidationMetadata; + +public class Schema4 { + // nest classes so all schemas and input/output classes can be public + + public enum StringSchemaEnums4 implements StringValueMethod { + TRUE("true"), + FALSE("false"); + private final String value; + + StringSchemaEnums4(String value) { + this.value = value; + } + public String value() { + return this.value; + } + } + + + public sealed interface Schema41Boxed permits Schema41BoxedString { + @Nullable Object getData(); + } + + public record Schema41BoxedString(String data) implements Schema41Boxed { + @Override + public @Nullable Object getData() { + return data; + } + } + + + + public static class Schema41 extends JsonSchema implements StringSchemaValidator, StringEnumValidator { + private static @Nullable Schema41 instance = null; + + protected Schema41() { + super(new JsonSchemaInfo() + .type(Set.of( + String.class + )) + .enumValues(SetMaker.makeSet( + "true", + "false" + )) + ); + } + + public static Schema41 getInstance() { + if (instance == null) { + instance = new Schema41(); + } + return instance; + } + + @Override + public String validate(String arg, SchemaConfiguration configuration) throws ValidationException { + Set> pathSet = new HashSet<>(); + List pathToItem = List.of("args[0"); + String castArg = castToAllowedTypes(arg, pathToItem, pathSet); + SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().build())); + ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, new PathToSchemasMap(), new LinkedHashSet<>()); + getPathToSchemas(this, castArg, validationMetadata, pathSet); + return castArg; + } + + @Override + 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 { + 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"); + } + @Override + public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { + 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"); + } + @Override + 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 { + 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"); + } + } +} diff --git a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/fake/delete/parameters/parameter5/Schema5.kt b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/fake/delete/parameters/parameter5/Schema5.kt new file mode 100644 index 00000000000..a15a29b9222 --- /dev/null +++ b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/fake/delete/parameters/parameter5/Schema5.kt @@ -0,0 +1,19 @@ +package org.openapijsonschematools.client.paths.fake.delete.parameters.parameter5; +import org.checkerframework.checker.nullness.qual.Nullable; +import org.openapijsonschematools.client.schemas.Int64JsonSchema; + +public class Schema5 extends Int64JsonSchema { + // nest classes so all schemas and input/output classes can be public + + + public static class Schema51 extends Int64JsonSchema.Int64JsonSchema1 { + private static @Nullable Schema51 instance = null; + public static Schema51 getInstance() { + if (instance == null) { + instance = new Schema51(); + } + return instance; + } + } + +} diff --git a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/fake/delete/responses/FakeDeleteCode200Response.kt b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/fake/delete/responses/FakeDeleteCode200Response.kt new file mode 100644 index 00000000000..a9caf9729de --- /dev/null +++ b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/fake/delete/responses/FakeDeleteCode200Response.kt @@ -0,0 +1,7 @@ +package org.openapijsonschematools.client.paths.fake.delete.responses; + +import org.openapijsonschematools.client.components.responses.SuccessDescriptionOnly; + +public class FakeDeleteCode200Response extends SuccessDescriptionOnly { + public static class FakeDeleteCode200Response1 extends SuccessDescriptionOnly1 {} +} diff --git a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/fake/delete/security/FakeDeleteSecurityRequirementObject0.kt b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/fake/delete/security/FakeDeleteSecurityRequirementObject0.kt new file mode 100644 index 00000000000..a615af7f968 --- /dev/null +++ b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/fake/delete/security/FakeDeleteSecurityRequirementObject0.kt @@ -0,0 +1,24 @@ +package org.openapijsonschematools.client.paths.fake.delete.security; + +import org.checkerframework.checker.nullness.qual.Nullable; +import org.openapijsonschematools.client.securityrequirementobjects.SecurityRequirementObject; +import org.openapijsonschematools.client.securityschemes.SecurityScheme; +import org.openapijsonschematools.client.components.securityschemes.BearerTest; + +import java.util.List; +import java.util.Map; +import java.util.AbstractMap; + +public class FakeDeleteSecurityRequirementObject0 extends SecurityRequirementObject { + + public FakeDeleteSecurityRequirementObject0() { + super( + Map.ofEntries( + new AbstractMap.SimpleEntry, List>( + BearerTest.class, + List.of() + ) + ) + ); + } +} diff --git a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/fake/get/FakeGetHeaderParameters.kt b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/fake/get/FakeGetHeaderParameters.kt new file mode 100644 index 00000000000..03b879576ac --- /dev/null +++ b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/fake/get/FakeGetHeaderParameters.kt @@ -0,0 +1,228 @@ +package org.openapijsonschematools.client.paths.fake.get; +import java.util.ArrayList; +import java.util.HashSet; +import java.util.LinkedHashMap; +import java.util.LinkedHashSet; +import java.util.List; +import java.util.Map; +import java.util.Objects; +import java.util.Set; +import org.checkerframework.checker.nullness.qual.Nullable; +import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags; +import org.openapijsonschematools.client.configurations.SchemaConfiguration; +import org.openapijsonschematools.client.exceptions.UnsetPropertyException; +import org.openapijsonschematools.client.exceptions.ValidationException; +import org.openapijsonschematools.client.paths.fake.get.parameters.parameter0.Schema0; +import org.openapijsonschematools.client.paths.fake.get.parameters.parameter1.Schema1; +import org.openapijsonschematools.client.schemas.AnyTypeJsonSchema; +import org.openapijsonschematools.client.schemas.GenericBuilder; +import org.openapijsonschematools.client.schemas.NotAnyTypeJsonSchema; +import org.openapijsonschematools.client.schemas.validation.FrozenMap; +import org.openapijsonschematools.client.schemas.validation.JsonSchema; +import org.openapijsonschematools.client.schemas.validation.JsonSchemaInfo; +import org.openapijsonschematools.client.schemas.validation.MapSchemaValidator; +import org.openapijsonschematools.client.schemas.validation.MapUtils; +import org.openapijsonschematools.client.schemas.validation.PathToSchemasMap; +import org.openapijsonschematools.client.schemas.validation.PropertyEntry; +import org.openapijsonschematools.client.schemas.validation.ValidationMetadata; + +public class FakeGetHeaderParameters { + // nest classes so all schemas and input/output classes can be public + + + public static class AdditionalProperties extends NotAnyTypeJsonSchema.NotAnyTypeJsonSchema1 { + // NotAnyTypeSchema + private static @Nullable AdditionalProperties instance = null; + public static AdditionalProperties getInstance() { + if (instance == null) { + instance = new AdditionalProperties(); + } + return instance; + } + } + + + public static class HeaderParametersMap extends FrozenMap<@Nullable Object> { + protected HeaderParametersMap(FrozenMap<@Nullable Object> m) { + super(m); + } + public static final Set requiredKeys = Set.of(); + public static final Set optionalKeys = Set.of( + "enum_header_string", + "enum_header_string_array" + ); + public static HeaderParametersMap of(Map arg, SchemaConfiguration configuration) throws ValidationException { + return FakeGetHeaderParameters1.getInstance().validate(arg, configuration); + } + + public String enum_header_string() throws UnsetPropertyException { + String key = "enum_header_string"; + throwIfKeyNotPresent(key); + @Nullable Object value = get(key); + if (!(value instanceof String)) { + throw new RuntimeException("Invalid value stored for enum_header_string"); + } + return (String) value; + } + + public Schema0.SchemaList0 enum_header_string_array() throws UnsetPropertyException { + String key = "enum_header_string_array"; + throwIfKeyNotPresent(key); + @Nullable Object value = get(key); + if (!(value instanceof Schema0.SchemaList0)) { + throw new RuntimeException("Invalid value stored for enum_header_string_array"); + } + return (Schema0.SchemaList0) value; + } + } + + public interface SetterForEnumHeaderString { + Map getInstance(); + T getBuilderAfterEnumHeaderString(Map instance); + + default T enum_header_string(String value) { + var instance = getInstance(); + instance.put("enum_header_string", value); + return getBuilderAfterEnumHeaderString(instance); + } + + default T enum_header_string(Schema1.StringSchemaEnums1 value) { + var instance = getInstance(); + instance.put("enum_header_string", value.value()); + return getBuilderAfterEnumHeaderString(instance); + } + } + + public interface SetterForEnumHeaderStringArray { + Map getInstance(); + T getBuilderAfterEnumHeaderStringArray(Map instance); + + default T enum_header_string_array(List value) { + var instance = getInstance(); + instance.put("enum_header_string_array", value); + return getBuilderAfterEnumHeaderStringArray(instance); + } + } + + public static class HeaderParametersMapBuilder implements GenericBuilder>, SetterForEnumHeaderString, SetterForEnumHeaderStringArray { + private final Map instance; + private static final Set knownKeys = Set.of( + "enum_header_string", + "enum_header_string_array" + ); + public Set getKnownKeys() { + return knownKeys; + } + public HeaderParametersMapBuilder() { + this.instance = new LinkedHashMap<>(); + } + public Map build() { + return instance; + } + public Map getInstance() { + return instance; + } + public HeaderParametersMapBuilder getBuilderAfterEnumHeaderString(Map instance) { + return this; + } + public HeaderParametersMapBuilder getBuilderAfterEnumHeaderStringArray(Map instance) { + return this; + } + } + + + public sealed interface FakeGetHeaderParameters1Boxed permits FakeGetHeaderParameters1BoxedMap { + @Nullable Object getData(); + } + + public record FakeGetHeaderParameters1BoxedMap(HeaderParametersMap data) implements FakeGetHeaderParameters1Boxed { + @Override + public @Nullable Object getData() { + return data; + } + } + + + public static class FakeGetHeaderParameters1 extends JsonSchema implements MapSchemaValidator { + private static @Nullable FakeGetHeaderParameters1 instance = null; + + protected FakeGetHeaderParameters1() { + super(new JsonSchemaInfo() + .type(Set.of(Map.class)) + .properties(Map.ofEntries( + new PropertyEntry("enum_header_string", Schema1.Schema11.class), + new PropertyEntry("enum_header_string_array", Schema0.Schema01.class) + )) + .additionalProperties(AdditionalProperties.class) + ); + } + + public static FakeGetHeaderParameters1 getInstance() { + if (instance == null) { + instance = new FakeGetHeaderParameters1(); + } + return instance; + } + + 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 RuntimeException("Invalid non-string key value"); + } + String propertyName = (String) entryKey; + List propertyPathToItem = new ArrayList<>(pathToItem); + propertyPathToItem.add(propertyName); + Object value = entry.getValue(); + LinkedHashMap, Nothing?> schemas = pathToSchemas.get(propertyPathToItem); + if (schemas == null) { + throw new RuntimeException("Validation result is invalid, schemas must exist for a pathToItem"); + } + JsonSchema propertySchema = schemas.entrySet().iterator().next().getKey(); + @Nullable Object propertyInstance = propertySchema.getNewInstance(value, propertyPathToItem, pathToSchemas); + properties.put(propertyName, propertyInstance); + } + FrozenMap<@Nullable Object> castProperties = new FrozenMap<>(properties); + return new HeaderParametersMap(castProperties); + } + + 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); + SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().build())); + ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, new PathToSchemasMap(), new LinkedHashSet<>()); + PathToSchemasMap pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet); + return getNewInstance(castArg, validationMetadata.pathToItem(), pathToSchemasMap); + } + + + @Override + public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws 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"); + } + @Override + public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { + if (arg instanceof Map) { + return getNewInstance((Map) arg, pathToItem, pathToSchemas); + } + throw new RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); + } + @Override + public FakeGetHeaderParameters1BoxedMap validateAndBox(Map arg, SchemaConfiguration configuration) throws ValidationException { + return new FakeGetHeaderParameters1BoxedMap(validate(arg, configuration)); + } + @Override + public FakeGetHeaderParameters1Boxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { + 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"); + } + } + +} diff --git a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/fake/get/FakeGetQueryParameters.kt b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/fake/get/FakeGetQueryParameters.kt new file mode 100644 index 00000000000..9a2cb296ff6 --- /dev/null +++ b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/fake/get/FakeGetQueryParameters.kt @@ -0,0 +1,344 @@ +package org.openapijsonschematools.client.paths.fake.get; +import java.util.ArrayList; +import java.util.HashSet; +import java.util.LinkedHashMap; +import java.util.LinkedHashSet; +import java.util.List; +import java.util.Map; +import java.util.Objects; +import java.util.Set; +import org.checkerframework.checker.nullness.qual.Nullable; +import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags; +import org.openapijsonschematools.client.configurations.SchemaConfiguration; +import org.openapijsonschematools.client.exceptions.UnsetPropertyException; +import org.openapijsonschematools.client.exceptions.ValidationException; +import org.openapijsonschematools.client.paths.fake.get.parameters.parameter2.Schema2; +import org.openapijsonschematools.client.paths.fake.get.parameters.parameter3.Schema3; +import org.openapijsonschematools.client.paths.fake.get.parameters.parameter4.Schema4; +import org.openapijsonschematools.client.paths.fake.get.parameters.parameter5.Schema5; +import org.openapijsonschematools.client.schemas.AnyTypeJsonSchema; +import org.openapijsonschematools.client.schemas.GenericBuilder; +import org.openapijsonschematools.client.schemas.NotAnyTypeJsonSchema; +import org.openapijsonschematools.client.schemas.validation.FrozenMap; +import org.openapijsonschematools.client.schemas.validation.JsonSchema; +import org.openapijsonschematools.client.schemas.validation.JsonSchemaInfo; +import org.openapijsonschematools.client.schemas.validation.MapSchemaValidator; +import org.openapijsonschematools.client.schemas.validation.MapUtils; +import org.openapijsonschematools.client.schemas.validation.PathToSchemasMap; +import org.openapijsonschematools.client.schemas.validation.PropertyEntry; +import org.openapijsonschematools.client.schemas.validation.ValidationMetadata; + +public class FakeGetQueryParameters { + // nest classes so all schemas and input/output classes can be public + + + public static class AdditionalProperties extends NotAnyTypeJsonSchema.NotAnyTypeJsonSchema1 { + // NotAnyTypeSchema + private static @Nullable AdditionalProperties instance = null; + public static AdditionalProperties getInstance() { + if (instance == null) { + instance = new AdditionalProperties(); + } + return instance; + } + } + + + public static class QueryParametersMap extends FrozenMap<@Nullable Object> { + protected QueryParametersMap(FrozenMap<@Nullable Object> m) { + super(m); + } + public static final Set requiredKeys = Set.of(); + public static final Set optionalKeys = Set.of( + "enum_query_double", + "enum_query_string", + "enum_query_integer", + "enum_query_string_array" + ); + public static QueryParametersMap of(Map arg, SchemaConfiguration configuration) throws ValidationException { + return FakeGetQueryParameters1.getInstance().validate(arg, configuration); + } + + public Number enum_query_double() throws UnsetPropertyException { + String key = "enum_query_double"; + throwIfKeyNotPresent(key); + @Nullable Object value = get(key); + if (!(value instanceof Number)) { + throw new RuntimeException("Invalid value stored for enum_query_double"); + } + return (Number) value; + } + + public String enum_query_string() throws UnsetPropertyException { + String key = "enum_query_string"; + throwIfKeyNotPresent(key); + @Nullable Object value = get(key); + if (!(value instanceof String)) { + throw new RuntimeException("Invalid value stored for enum_query_string"); + } + return (String) value; + } + + public Number enum_query_integer() throws UnsetPropertyException { + String key = "enum_query_integer"; + throwIfKeyNotPresent(key); + @Nullable Object value = get(key); + if (!(value instanceof Number)) { + throw new RuntimeException("Invalid value stored for enum_query_integer"); + } + return (Number) value; + } + + public Schema2.SchemaList2 enum_query_string_array() throws UnsetPropertyException { + String key = "enum_query_string_array"; + throwIfKeyNotPresent(key); + @Nullable Object value = get(key); + if (!(value instanceof Schema2.SchemaList2)) { + throw new RuntimeException("Invalid value stored for enum_query_string_array"); + } + return (Schema2.SchemaList2) value; + } + } + + public interface SetterForEnumQueryDouble { + Map getInstance(); + T getBuilderAfterEnumQueryDouble(Map instance); + + default T enum_query_double(int value) { + var instance = getInstance(); + instance.put("enum_query_double", value); + return getBuilderAfterEnumQueryDouble(instance); + } + + default T enum_query_double(float value) { + var instance = getInstance(); + instance.put("enum_query_double", value); + return getBuilderAfterEnumQueryDouble(instance); + } + + default T enum_query_double(long value) { + var instance = getInstance(); + instance.put("enum_query_double", value); + return getBuilderAfterEnumQueryDouble(instance); + } + + default T enum_query_double(double value) { + var instance = getInstance(); + instance.put("enum_query_double", value); + return getBuilderAfterEnumQueryDouble(instance); + } + + default T enum_query_double(Schema5.DoubleSchemaEnums5 value) { + var instance = getInstance(); + instance.put("enum_query_double", value.value()); + return getBuilderAfterEnumQueryDouble(instance); + } + + default T enum_query_double(Schema5.FloatSchemaEnums5 value) { + var instance = getInstance(); + instance.put("enum_query_double", value.value()); + return getBuilderAfterEnumQueryDouble(instance); + } + } + + public interface SetterForEnumQueryString { + Map getInstance(); + T getBuilderAfterEnumQueryString(Map instance); + + default T enum_query_string(String value) { + var instance = getInstance(); + instance.put("enum_query_string", value); + return getBuilderAfterEnumQueryString(instance); + } + + default T enum_query_string(Schema3.StringSchemaEnums3 value) { + var instance = getInstance(); + instance.put("enum_query_string", value.value()); + return getBuilderAfterEnumQueryString(instance); + } + } + + public interface SetterForEnumQueryInteger { + Map getInstance(); + T getBuilderAfterEnumQueryInteger(Map instance); + + default T enum_query_integer(int value) { + var instance = getInstance(); + instance.put("enum_query_integer", value); + return getBuilderAfterEnumQueryInteger(instance); + } + + default T enum_query_integer(float value) { + var instance = getInstance(); + instance.put("enum_query_integer", value); + return getBuilderAfterEnumQueryInteger(instance); + } + + default T enum_query_integer(Schema4.IntegerSchemaEnums4 value) { + var instance = getInstance(); + instance.put("enum_query_integer", value.value()); + return getBuilderAfterEnumQueryInteger(instance); + } + + default T enum_query_integer(Schema4.LongSchemaEnums4 value) { + var instance = getInstance(); + instance.put("enum_query_integer", value.value()); + return getBuilderAfterEnumQueryInteger(instance); + } + + default T enum_query_integer(Schema4.FloatSchemaEnums4 value) { + var instance = getInstance(); + instance.put("enum_query_integer", value.value()); + return getBuilderAfterEnumQueryInteger(instance); + } + + default T enum_query_integer(Schema4.DoubleSchemaEnums4 value) { + var instance = getInstance(); + instance.put("enum_query_integer", value.value()); + return getBuilderAfterEnumQueryInteger(instance); + } + } + + public interface SetterForEnumQueryStringArray { + Map getInstance(); + T getBuilderAfterEnumQueryStringArray(Map instance); + + default T enum_query_string_array(List value) { + var instance = getInstance(); + instance.put("enum_query_string_array", value); + return getBuilderAfterEnumQueryStringArray(instance); + } + } + + public static class QueryParametersMapBuilder implements GenericBuilder>, SetterForEnumQueryDouble, SetterForEnumQueryString, SetterForEnumQueryInteger, SetterForEnumQueryStringArray { + private final Map instance; + private static final Set knownKeys = Set.of( + "enum_query_double", + "enum_query_string", + "enum_query_integer", + "enum_query_string_array" + ); + public Set getKnownKeys() { + return knownKeys; + } + public QueryParametersMapBuilder() { + this.instance = new LinkedHashMap<>(); + } + public Map build() { + return instance; + } + public Map getInstance() { + return instance; + } + public QueryParametersMapBuilder getBuilderAfterEnumQueryDouble(Map instance) { + return this; + } + public QueryParametersMapBuilder getBuilderAfterEnumQueryString(Map instance) { + return this; + } + public QueryParametersMapBuilder getBuilderAfterEnumQueryInteger(Map instance) { + return this; + } + public QueryParametersMapBuilder getBuilderAfterEnumQueryStringArray(Map instance) { + return this; + } + } + + + public sealed interface FakeGetQueryParameters1Boxed permits FakeGetQueryParameters1BoxedMap { + @Nullable Object getData(); + } + + public record FakeGetQueryParameters1BoxedMap(QueryParametersMap data) implements FakeGetQueryParameters1Boxed { + @Override + public @Nullable Object getData() { + return data; + } + } + + + public static class FakeGetQueryParameters1 extends JsonSchema implements MapSchemaValidator { + private static @Nullable FakeGetQueryParameters1 instance = null; + + protected FakeGetQueryParameters1() { + super(new JsonSchemaInfo() + .type(Set.of(Map.class)) + .properties(Map.ofEntries( + new PropertyEntry("enum_query_double", Schema5.Schema51.class), + new PropertyEntry("enum_query_string", Schema3.Schema31.class), + new PropertyEntry("enum_query_integer", Schema4.Schema41.class), + new PropertyEntry("enum_query_string_array", Schema2.Schema21.class) + )) + .additionalProperties(AdditionalProperties.class) + ); + } + + public static FakeGetQueryParameters1 getInstance() { + if (instance == null) { + instance = new FakeGetQueryParameters1(); + } + return instance; + } + + 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 RuntimeException("Invalid non-string key value"); + } + String propertyName = (String) entryKey; + List propertyPathToItem = new ArrayList<>(pathToItem); + propertyPathToItem.add(propertyName); + Object value = entry.getValue(); + LinkedHashMap, Nothing?> schemas = pathToSchemas.get(propertyPathToItem); + if (schemas == null) { + throw new RuntimeException("Validation result is invalid, schemas must exist for a pathToItem"); + } + JsonSchema propertySchema = schemas.entrySet().iterator().next().getKey(); + @Nullable Object propertyInstance = propertySchema.getNewInstance(value, propertyPathToItem, pathToSchemas); + properties.put(propertyName, propertyInstance); + } + FrozenMap<@Nullable Object> castProperties = new FrozenMap<>(properties); + return new QueryParametersMap(castProperties); + } + + 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); + SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().build())); + ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, new PathToSchemasMap(), new LinkedHashSet<>()); + PathToSchemasMap pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet); + return getNewInstance(castArg, validationMetadata.pathToItem(), pathToSchemasMap); + } + + + @Override + public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws 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"); + } + @Override + public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { + if (arg instanceof Map) { + return getNewInstance((Map) arg, pathToItem, pathToSchemas); + } + throw new RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); + } + @Override + public FakeGetQueryParameters1BoxedMap validateAndBox(Map arg, SchemaConfiguration configuration) throws ValidationException { + return new FakeGetQueryParameters1BoxedMap(validate(arg, configuration)); + } + @Override + public FakeGetQueryParameters1Boxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { + 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"); + } + } + +} diff --git a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/fake/get/FakeGetRequestBody.kt b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/fake/get/FakeGetRequestBody.kt new file mode 100644 index 00000000000..8bc6fc506a3 --- /dev/null +++ b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/fake/get/FakeGetRequestBody.kt @@ -0,0 +1,49 @@ +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; +import org.openapijsonschematools.client.mediatype.MediaType; +import org.openapijsonschematools.client.paths.fake.get.requestbody.content.applicationxwwwformurlencoded.ApplicationxwwwformurlencodedSchema; + +import java.util.AbstractMap; +import java.util.Map; + +public class FakeGetRequestBody { + public sealed interface SealedMediaType permits ApplicationxwwwformurlencodedMediaType {} + + public record ApplicationxwwwformurlencodedMediaType(ApplicationxwwwformurlencodedSchema.ApplicationxwwwformurlencodedSchema1 schema) implements SealedMediaType, MediaType { + public ApplicationxwwwformurlencodedMediaType() { + this(ApplicationxwwwformurlencodedSchema.ApplicationxwwwformurlencodedSchema1.getInstance()); + } + @Override + public Nothing? encoding() { + return null; + } + } + + public static class FakeGetRequestBody1 extends RequestBodySerializer { + public FakeGetRequestBody1() { + super( + Map.ofEntries( + new AbstractMap.SimpleEntry<>("application/x-www-form-urlencoded", new ApplicationxwwwformurlencodedMediaType()) + ), + false + ); + } + + public SerializedRequestBody serialize(SealedRequestBody requestBody) throws NotImplementedException { + ApplicationxwwwformurlencodedRequestBody requestBody0 = (ApplicationxwwwformurlencodedRequestBody) requestBody; + return serialize(requestBody0.contentType(), requestBody0.body().getData()); + } + } + + public sealed interface SealedRequestBody permits ApplicationxwwwformurlencodedRequestBody {} + public record ApplicationxwwwformurlencodedRequestBody(ApplicationxwwwformurlencodedSchema.ApplicationxwwwformurlencodedSchema1Boxed body) implements SealedRequestBody, GenericRequestBody { + @Override + public String contentType() { + return "application/x-www-form-urlencoded"; + } + } +} diff --git a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/fake/get/FakeGetResponses.kt b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/fake/get/FakeGetResponses.kt new file mode 100644 index 00000000000..d275daaec8a --- /dev/null +++ b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/fake/get/FakeGetResponses.kt @@ -0,0 +1,66 @@ +package org.openapijsonschematools.client.paths.fake.get; + +import org.openapijsonschematools.client.paths.fake.get.responses.FakeGetCode200Response; +import org.openapijsonschematools.client.paths.fake.get.responses.FakeGetCode404Response; +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; +import org.checkerframework.checker.nullness.qual.Nullable; + +import java.net.http.HttpResponse; +import java.util.Map; +import java.util.AbstractMap; + +public class FakeGetResponses { + public sealed interface EndpointResponse permits EndpointFakeGetCode200Response {} + + public record EndpointFakeGetCode200Response( + HttpResponse response, + Nothing? body, + Nothing? headers + ) implements EndpointResponse, ApiResponse{ + } + + public sealed interface StatusCodeResponseDeserializer permits StatusFakeGetCode200ResponseDeserializer, StatusFakeGetCode404ResponseDeserializer {} + + public static final class StatusFakeGetCode200ResponseDeserializer extends FakeGetCode200Response.FakeGetCode200Response1 implements StatusCodeResponseDeserializer { + } + public static final class StatusFakeGetCode404ResponseDeserializer extends FakeGetCode404Response.FakeGetCode404Response1 implements StatusCodeResponseDeserializer { + } + + public static final class FakeGetResponses1 implements ResponsesDeserializer { + private final Map statusCodeToResponseDeserializer; + public FakeGetResponses1() { + this.statusCodeToResponseDeserializer = Map.ofEntries( + new AbstractMap.SimpleEntry<>("200", new StatusFakeGetCode200ResponseDeserializer()), + new AbstractMap.SimpleEntry<>("404", new StatusFakeGetCode404ResponseDeserializer()) + ); + } + + 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) { + throw new ApiException( + "Invalid response statusCode="+statusCode+" has no response defined in the openapi document", + response + ); + } + if (statusCodeDeserializer instanceof StatusFakeGetCode200ResponseDeserializer castDeserializer) { + var deserializedResponse = castDeserializer.deserialize(response, configuration); + return new EndpointFakeGetCode200Response(response, deserializedResponse.body(), deserializedResponse.headers()); + } else { + StatusFakeGetCode404ResponseDeserializer castDeserializer = (StatusFakeGetCode404ResponseDeserializer) statusCodeDeserializer; + var deserializedResponse = castDeserializer.deserialize(response, configuration); + throw new FakeGetCode404Response.ResponseApiException( + "Received error statusCode response from server", + response, + deserializedResponse + ); + } + } + } +} diff --git a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/fake/get/Parameters.kt b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/fake/get/Parameters.kt new file mode 100644 index 00000000000..c5b3e142015 --- /dev/null +++ b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/fake/get/Parameters.kt @@ -0,0 +1,40 @@ +package org.openapijsonschematools.client.paths.fake.get; + +import org.openapijsonschematools.client.paths.fake.get.parameters.Parameter0; +import org.openapijsonschematools.client.paths.fake.get.parameters.Parameter1; +import org.openapijsonschematools.client.paths.fake.get.parameters.Parameter2; +import org.openapijsonschematools.client.paths.fake.get.parameters.Parameter3; +import org.openapijsonschematools.client.paths.fake.get.parameters.Parameter4; +import org.openapijsonschematools.client.paths.fake.get.parameters.Parameter5; +import org.openapijsonschematools.client.parameter.HeadersSerializer; +import org.openapijsonschematools.client.parameter.QuerySerializer; + +import java.util.Map; +import java.util.AbstractMap; + +public class Parameters { + + public static class QueryParametersSerializer extends QuerySerializer { + public QueryParametersSerializer() { + super( + Map.ofEntries( + new AbstractMap.SimpleEntry<>("enum_query_string_array", new Parameter2.Parameter21()), + new AbstractMap.SimpleEntry<>("enum_query_string", new Parameter3.Parameter31()), + new AbstractMap.SimpleEntry<>("enum_query_integer", new Parameter4.Parameter41()), + new AbstractMap.SimpleEntry<>("enum_query_double", new Parameter5.Parameter51()) + ) + ); + } + } + + public static class HeaderParametersSerializer extends HeadersSerializer { + public HeaderParametersSerializer() { + super( + Map.ofEntries( + new AbstractMap.SimpleEntry<>("enum_header_string_array", new Parameter0.Parameter01()), + new AbstractMap.SimpleEntry<>("enum_header_string", new Parameter1.Parameter11()) + ) + ); + } + } +} diff --git a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/fake/get/parameters/Parameter0.kt b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/fake/get/parameters/Parameter0.kt new file mode 100644 index 00000000000..3a8537f7fd1 --- /dev/null +++ b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/fake/get/parameters/Parameter0.kt @@ -0,0 +1,23 @@ +package org.openapijsonschematools.client.paths.fake.get.parameters; + +import org.openapijsonschematools.client.parameter.ParameterStyle; +import org.openapijsonschematools.client.parameter.ParameterInType; +import org.openapijsonschematools.client.parameter.SchemaParameter; +import org.openapijsonschematools.client.paths.fake.get.parameters.parameter0.Schema0; + +public class Parameter0 { + + public static class Parameter01 extends SchemaParameter { + public Parameter01() { + super( + "enum_header_string_array", + ParameterInType.HEADER, + false, + ParameterStyle.SIMPLE, + false, + false, + Schema0.Schema01.getInstance() + ); + } + } +} diff --git a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/fake/get/parameters/Parameter1.kt b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/fake/get/parameters/Parameter1.kt new file mode 100644 index 00000000000..49e947d6399 --- /dev/null +++ b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/fake/get/parameters/Parameter1.kt @@ -0,0 +1,23 @@ +package org.openapijsonschematools.client.paths.fake.get.parameters; + +import org.openapijsonschematools.client.parameter.ParameterStyle; +import org.openapijsonschematools.client.parameter.ParameterInType; +import org.openapijsonschematools.client.parameter.SchemaParameter; +import org.openapijsonschematools.client.paths.fake.get.parameters.parameter1.Schema1; + +public class Parameter1 { + + public static class Parameter11 extends SchemaParameter { + public Parameter11() { + super( + "enum_header_string", + ParameterInType.HEADER, + false, + ParameterStyle.SIMPLE, + false, + false, + Schema1.Schema11.getInstance() + ); + } + } +} diff --git a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/fake/get/parameters/Parameter2.kt b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/fake/get/parameters/Parameter2.kt new file mode 100644 index 00000000000..71e3f589257 --- /dev/null +++ b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/fake/get/parameters/Parameter2.kt @@ -0,0 +1,23 @@ +package org.openapijsonschematools.client.paths.fake.get.parameters; + +import org.openapijsonschematools.client.parameter.ParameterStyle; +import org.openapijsonschematools.client.parameter.ParameterInType; +import org.openapijsonschematools.client.parameter.SchemaParameter; +import org.openapijsonschematools.client.paths.fake.get.parameters.parameter2.Schema2; + +public class Parameter2 { + + public static class Parameter21 extends SchemaParameter { + public Parameter21() { + super( + "enum_query_string_array", + ParameterInType.QUERY, + false, + ParameterStyle.FORM, + true, + false, + Schema2.Schema21.getInstance() + ); + } + } +} diff --git a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/fake/get/parameters/Parameter3.kt b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/fake/get/parameters/Parameter3.kt new file mode 100644 index 00000000000..9903092e80d --- /dev/null +++ b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/fake/get/parameters/Parameter3.kt @@ -0,0 +1,23 @@ +package org.openapijsonschematools.client.paths.fake.get.parameters; + +import org.openapijsonschematools.client.parameter.ParameterStyle; +import org.openapijsonschematools.client.parameter.ParameterInType; +import org.openapijsonschematools.client.parameter.SchemaParameter; +import org.openapijsonschematools.client.paths.fake.get.parameters.parameter3.Schema3; + +public class Parameter3 { + + public static class Parameter31 extends SchemaParameter { + public Parameter31() { + super( + "enum_query_string", + ParameterInType.QUERY, + false, + ParameterStyle.FORM, + true, + false, + Schema3.Schema31.getInstance() + ); + } + } +} diff --git a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/fake/get/parameters/Parameter4.kt b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/fake/get/parameters/Parameter4.kt new file mode 100644 index 00000000000..21bf1787d8a --- /dev/null +++ b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/fake/get/parameters/Parameter4.kt @@ -0,0 +1,23 @@ +package org.openapijsonschematools.client.paths.fake.get.parameters; + +import org.openapijsonschematools.client.parameter.ParameterStyle; +import org.openapijsonschematools.client.parameter.ParameterInType; +import org.openapijsonschematools.client.parameter.SchemaParameter; +import org.openapijsonschematools.client.paths.fake.get.parameters.parameter4.Schema4; + +public class Parameter4 { + + public static class Parameter41 extends SchemaParameter { + public Parameter41() { + super( + "enum_query_integer", + ParameterInType.QUERY, + false, + ParameterStyle.FORM, + true, + false, + Schema4.Schema41.getInstance() + ); + } + } +} diff --git a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/fake/get/parameters/Parameter5.kt b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/fake/get/parameters/Parameter5.kt new file mode 100644 index 00000000000..7fb91fb88f0 --- /dev/null +++ b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/fake/get/parameters/Parameter5.kt @@ -0,0 +1,23 @@ +package org.openapijsonschematools.client.paths.fake.get.parameters; + +import org.openapijsonschematools.client.parameter.ParameterStyle; +import org.openapijsonschematools.client.parameter.ParameterInType; +import org.openapijsonschematools.client.parameter.SchemaParameter; +import org.openapijsonschematools.client.paths.fake.get.parameters.parameter5.Schema5; + +public class Parameter5 { + + public static class Parameter51 extends SchemaParameter { + public Parameter51() { + super( + "enum_query_double", + ParameterInType.QUERY, + false, + ParameterStyle.FORM, + true, + false, + Schema5.Schema51.getInstance() + ); + } + } +} diff --git a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/fake/get/parameters/parameter0/Schema0.kt b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/fake/get/parameters/parameter0/Schema0.kt new file mode 100644 index 00000000000..0fcf8beed4c --- /dev/null +++ b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/fake/get/parameters/parameter0/Schema0.kt @@ -0,0 +1,253 @@ +package org.openapijsonschematools.client.paths.fake.get.parameters.parameter0; +import java.util.ArrayList; +import java.util.HashSet; +import java.util.LinkedHashMap; +import java.util.LinkedHashSet; +import java.util.List; +import java.util.Objects; +import java.util.Set; +import org.checkerframework.checker.nullness.qual.Nullable; +import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags; +import org.openapijsonschematools.client.configurations.SchemaConfiguration; +import org.openapijsonschematools.client.exceptions.ValidationException; +import org.openapijsonschematools.client.schemas.SetMaker; +import org.openapijsonschematools.client.schemas.validation.DefaultValueMethod; +import org.openapijsonschematools.client.schemas.validation.FrozenList; +import org.openapijsonschematools.client.schemas.validation.JsonSchema; +import org.openapijsonschematools.client.schemas.validation.JsonSchemaInfo; +import org.openapijsonschematools.client.schemas.validation.ListSchemaValidator; +import org.openapijsonschematools.client.schemas.validation.PathToSchemasMap; +import org.openapijsonschematools.client.schemas.validation.StringEnumValidator; +import org.openapijsonschematools.client.schemas.validation.StringSchemaValidator; +import org.openapijsonschematools.client.schemas.validation.StringValueMethod; +import org.openapijsonschematools.client.schemas.validation.ValidationMetadata; + +public class Schema0 { + // nest classes so all schemas and input/output classes can be public + + public enum StringItemsEnums0 implements StringValueMethod { + GREATER_THAN_SIGN(">"), + DOLLAR_SIGN("$"); + private final String value; + + StringItemsEnums0(String value) { + this.value = value; + } + public String value() { + return this.value; + } + } + + + public sealed interface Items0Boxed permits Items0BoxedString { + @Nullable Object getData(); + } + + public record Items0BoxedString(String data) implements Items0Boxed { + @Override + public @Nullable Object getData() { + return data; + } + } + + + + public static class Items0 extends JsonSchema implements StringSchemaValidator, StringEnumValidator, DefaultValueMethod { + private static @Nullable Items0 instance = null; + + protected Items0() { + super(new JsonSchemaInfo() + .type(Set.of( + String.class + )) + .enumValues(SetMaker.makeSet( + ">", + "$" + )) + .defaultValue("$") + ); + } + + public static Items0 getInstance() { + if (instance == null) { + instance = new Items0(); + } + return instance; + } + + @Override + public String validate(String arg, SchemaConfiguration configuration) throws ValidationException { + Set> pathSet = new HashSet<>(); + List pathToItem = List.of("args[0"); + String castArg = castToAllowedTypes(arg, pathToItem, pathSet); + SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().build())); + ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, new PathToSchemasMap(), new LinkedHashSet<>()); + getPathToSchemas(this, castArg, validationMetadata, pathSet); + return castArg; + } + + @Override + 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 { + 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"); + } + @Override + public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { + 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"); + } + public String defaultValue() throws ValidationException { + if (defaultValue instanceof String) { + return (String) defaultValue; + } + throw new ValidationException("Invalid type stored in defaultValue"); + } + @Override + 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 { + 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"); + } + } + + public static class SchemaList0 extends FrozenList { + protected SchemaList0(FrozenList m) { + super(m); + } + public static SchemaList0 of(List arg, SchemaConfiguration configuration) throws ValidationException { + return Schema01.getInstance().validate(arg, configuration); + } + } + + public static class SchemaListBuilder0 { + // class to build List + private final List list; + + public SchemaListBuilder0() { + list = new ArrayList<>(); + } + + public SchemaListBuilder0(List list) { + this.list = list; + } + + public SchemaListBuilder0 add(String item) { + list.add(item); + return this; + } + + public SchemaListBuilder0 add(StringItemsEnums0 item) { + list.add(item.value()); + return this; + } + + public List build() { + return list; + } + } + + + public sealed interface Schema01Boxed permits Schema01BoxedList { + @Nullable Object getData(); + } + + public record Schema01BoxedList(SchemaList0 data) implements Schema01Boxed { + @Override + public @Nullable Object getData() { + return data; + } + } + + + + public static class Schema01 extends JsonSchema implements ListSchemaValidator { + private static @Nullable Schema01 instance = null; + + protected Schema01() { + super(new JsonSchemaInfo() + .type(Set.of(List.class)) + .items(Items0.class) + ); + } + + public static Schema01 getInstance() { + if (instance == null) { + instance = new Schema01(); + } + return instance; + } + + @Override + public SchemaList0 getNewInstance(List arg, List pathToItem, PathToSchemasMap pathToSchemas) { + List items = new ArrayList<>(); + int i = 0; + for (Object item: arg) { + List itemPathToItem = new ArrayList<>(pathToItem); + itemPathToItem.add(i); + LinkedHashMap, Nothing?> schemas = pathToSchemas.get(itemPathToItem); + if (schemas == null) { + throw new RuntimeException("Validation 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"); + } + items.add((String) itemInstance); + i += 1; + } + FrozenList newInstanceItems = new FrozenList<>(items); + return new SchemaList0(newInstanceItems); + } + + 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); + SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().build())); + ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, new PathToSchemasMap(), new LinkedHashSet<>()); + PathToSchemasMap pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet); + return getNewInstance(castArg, validationMetadata.pathToItem(), pathToSchemasMap); + } + + @Override + public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws 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"); + } + @Override + public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { + 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"); + } + @Override + 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 { + 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"); + } + } +} diff --git a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/fake/get/parameters/parameter1/Schema1.kt b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/fake/get/parameters/parameter1/Schema1.kt new file mode 100644 index 00000000000..c11fb1b0bf8 --- /dev/null +++ b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/fake/get/parameters/parameter1/Schema1.kt @@ -0,0 +1,124 @@ +package org.openapijsonschematools.client.paths.fake.get.parameters.parameter1; +import java.util.HashSet; +import java.util.LinkedHashSet; +import java.util.List; +import java.util.Objects; +import java.util.Set; +import org.checkerframework.checker.nullness.qual.Nullable; +import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags; +import org.openapijsonschematools.client.configurations.SchemaConfiguration; +import org.openapijsonschematools.client.exceptions.ValidationException; +import org.openapijsonschematools.client.schemas.SetMaker; +import org.openapijsonschematools.client.schemas.validation.DefaultValueMethod; +import org.openapijsonschematools.client.schemas.validation.JsonSchema; +import org.openapijsonschematools.client.schemas.validation.JsonSchemaInfo; +import org.openapijsonschematools.client.schemas.validation.PathToSchemasMap; +import org.openapijsonschematools.client.schemas.validation.StringEnumValidator; +import org.openapijsonschematools.client.schemas.validation.StringSchemaValidator; +import org.openapijsonschematools.client.schemas.validation.StringValueMethod; +import org.openapijsonschematools.client.schemas.validation.ValidationMetadata; + +public class Schema1 { + // nest classes so all schemas and input/output classes can be public + + public enum StringSchemaEnums1 implements StringValueMethod { + LOW_LINE_ABC("_abc"), + HYPHEN_MINUS_EFG("-efg"), + LEFT_PARENTHESIS_XYZ_RIGHT_PARENTHESIS("(xyz)"); + private final String value; + + StringSchemaEnums1(String value) { + this.value = value; + } + public String value() { + return this.value; + } + } + + + public sealed interface Schema11Boxed permits Schema11BoxedString { + @Nullable Object getData(); + } + + public record Schema11BoxedString(String data) implements Schema11Boxed { + @Override + public @Nullable Object getData() { + return data; + } + } + + + + public static class Schema11 extends JsonSchema implements StringSchemaValidator, StringEnumValidator, DefaultValueMethod { + private static @Nullable Schema11 instance = null; + + protected Schema11() { + super(new JsonSchemaInfo() + .type(Set.of( + String.class + )) + .enumValues(SetMaker.makeSet( + "_abc", + "-efg", + "(xyz)" + )) + .defaultValue("-efg") + ); + } + + public static Schema11 getInstance() { + if (instance == null) { + instance = new Schema11(); + } + return instance; + } + + @Override + public String validate(String arg, SchemaConfiguration configuration) throws ValidationException { + Set> pathSet = new HashSet<>(); + List pathToItem = List.of("args[0"); + String castArg = castToAllowedTypes(arg, pathToItem, pathSet); + SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().build())); + ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, new PathToSchemasMap(), new LinkedHashSet<>()); + getPathToSchemas(this, castArg, validationMetadata, pathSet); + return castArg; + } + + @Override + 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 { + 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"); + } + @Override + public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { + 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"); + } + public String defaultValue() throws ValidationException { + if (defaultValue instanceof String) { + return (String) defaultValue; + } + throw new ValidationException("Invalid type stored in defaultValue"); + } + @Override + 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 { + 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"); + } + } +} diff --git a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/fake/get/parameters/parameter2/Schema2.kt b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/fake/get/parameters/parameter2/Schema2.kt new file mode 100644 index 00000000000..5677396d474 --- /dev/null +++ b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/fake/get/parameters/parameter2/Schema2.kt @@ -0,0 +1,253 @@ +package org.openapijsonschematools.client.paths.fake.get.parameters.parameter2; +import java.util.ArrayList; +import java.util.HashSet; +import java.util.LinkedHashMap; +import java.util.LinkedHashSet; +import java.util.List; +import java.util.Objects; +import java.util.Set; +import org.checkerframework.checker.nullness.qual.Nullable; +import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags; +import org.openapijsonschematools.client.configurations.SchemaConfiguration; +import org.openapijsonschematools.client.exceptions.ValidationException; +import org.openapijsonschematools.client.schemas.SetMaker; +import org.openapijsonschematools.client.schemas.validation.DefaultValueMethod; +import org.openapijsonschematools.client.schemas.validation.FrozenList; +import org.openapijsonschematools.client.schemas.validation.JsonSchema; +import org.openapijsonschematools.client.schemas.validation.JsonSchemaInfo; +import org.openapijsonschematools.client.schemas.validation.ListSchemaValidator; +import org.openapijsonschematools.client.schemas.validation.PathToSchemasMap; +import org.openapijsonschematools.client.schemas.validation.StringEnumValidator; +import org.openapijsonschematools.client.schemas.validation.StringSchemaValidator; +import org.openapijsonschematools.client.schemas.validation.StringValueMethod; +import org.openapijsonschematools.client.schemas.validation.ValidationMetadata; + +public class Schema2 { + // nest classes so all schemas and input/output classes can be public + + public enum StringItemsEnums2 implements StringValueMethod { + GREATER_THAN_SIGN(">"), + DOLLAR_SIGN("$"); + private final String value; + + StringItemsEnums2(String value) { + this.value = value; + } + public String value() { + return this.value; + } + } + + + public sealed interface Items2Boxed permits Items2BoxedString { + @Nullable Object getData(); + } + + public record Items2BoxedString(String data) implements Items2Boxed { + @Override + public @Nullable Object getData() { + return data; + } + } + + + + public static class Items2 extends JsonSchema implements StringSchemaValidator, StringEnumValidator, DefaultValueMethod { + private static @Nullable Items2 instance = null; + + protected Items2() { + super(new JsonSchemaInfo() + .type(Set.of( + String.class + )) + .enumValues(SetMaker.makeSet( + ">", + "$" + )) + .defaultValue("$") + ); + } + + public static Items2 getInstance() { + if (instance == null) { + instance = new Items2(); + } + return instance; + } + + @Override + public String validate(String arg, SchemaConfiguration configuration) throws ValidationException { + Set> pathSet = new HashSet<>(); + List pathToItem = List.of("args[0"); + String castArg = castToAllowedTypes(arg, pathToItem, pathSet); + SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().build())); + ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, new PathToSchemasMap(), new LinkedHashSet<>()); + getPathToSchemas(this, castArg, validationMetadata, pathSet); + return castArg; + } + + @Override + 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 { + 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"); + } + @Override + public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { + 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"); + } + public String defaultValue() throws ValidationException { + if (defaultValue instanceof String) { + return (String) defaultValue; + } + throw new ValidationException("Invalid type stored in defaultValue"); + } + @Override + 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 { + 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"); + } + } + + public static class SchemaList2 extends FrozenList { + protected SchemaList2(FrozenList m) { + super(m); + } + public static SchemaList2 of(List arg, SchemaConfiguration configuration) throws ValidationException { + return Schema21.getInstance().validate(arg, configuration); + } + } + + public static class SchemaListBuilder2 { + // class to build List + private final List list; + + public SchemaListBuilder2() { + list = new ArrayList<>(); + } + + public SchemaListBuilder2(List list) { + this.list = list; + } + + public SchemaListBuilder2 add(String item) { + list.add(item); + return this; + } + + public SchemaListBuilder2 add(StringItemsEnums2 item) { + list.add(item.value()); + return this; + } + + public List build() { + return list; + } + } + + + public sealed interface Schema21Boxed permits Schema21BoxedList { + @Nullable Object getData(); + } + + public record Schema21BoxedList(SchemaList2 data) implements Schema21Boxed { + @Override + public @Nullable Object getData() { + return data; + } + } + + + + public static class Schema21 extends JsonSchema implements ListSchemaValidator { + private static @Nullable Schema21 instance = null; + + protected Schema21() { + super(new JsonSchemaInfo() + .type(Set.of(List.class)) + .items(Items2.class) + ); + } + + public static Schema21 getInstance() { + if (instance == null) { + instance = new Schema21(); + } + return instance; + } + + @Override + public SchemaList2 getNewInstance(List arg, List pathToItem, PathToSchemasMap pathToSchemas) { + List items = new ArrayList<>(); + int i = 0; + for (Object item: arg) { + List itemPathToItem = new ArrayList<>(pathToItem); + itemPathToItem.add(i); + LinkedHashMap, Nothing?> schemas = pathToSchemas.get(itemPathToItem); + if (schemas == null) { + throw new RuntimeException("Validation 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"); + } + items.add((String) itemInstance); + i += 1; + } + FrozenList newInstanceItems = new FrozenList<>(items); + return new SchemaList2(newInstanceItems); + } + + 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); + SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().build())); + ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, new PathToSchemasMap(), new LinkedHashSet<>()); + PathToSchemasMap pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet); + return getNewInstance(castArg, validationMetadata.pathToItem(), pathToSchemasMap); + } + + @Override + public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws 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"); + } + @Override + public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { + 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"); + } + @Override + 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 { + 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"); + } + } +} diff --git a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/fake/get/parameters/parameter3/Schema3.kt b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/fake/get/parameters/parameter3/Schema3.kt new file mode 100644 index 00000000000..10b29f05566 --- /dev/null +++ b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/fake/get/parameters/parameter3/Schema3.kt @@ -0,0 +1,124 @@ +package org.openapijsonschematools.client.paths.fake.get.parameters.parameter3; +import java.util.HashSet; +import java.util.LinkedHashSet; +import java.util.List; +import java.util.Objects; +import java.util.Set; +import org.checkerframework.checker.nullness.qual.Nullable; +import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags; +import org.openapijsonschematools.client.configurations.SchemaConfiguration; +import org.openapijsonschematools.client.exceptions.ValidationException; +import org.openapijsonschematools.client.schemas.SetMaker; +import org.openapijsonschematools.client.schemas.validation.DefaultValueMethod; +import org.openapijsonschematools.client.schemas.validation.JsonSchema; +import org.openapijsonschematools.client.schemas.validation.JsonSchemaInfo; +import org.openapijsonschematools.client.schemas.validation.PathToSchemasMap; +import org.openapijsonschematools.client.schemas.validation.StringEnumValidator; +import org.openapijsonschematools.client.schemas.validation.StringSchemaValidator; +import org.openapijsonschematools.client.schemas.validation.StringValueMethod; +import org.openapijsonschematools.client.schemas.validation.ValidationMetadata; + +public class Schema3 { + // nest classes so all schemas and input/output classes can be public + + public enum StringSchemaEnums3 implements StringValueMethod { + LOW_LINE_ABC("_abc"), + HYPHEN_MINUS_EFG("-efg"), + LEFT_PARENTHESIS_XYZ_RIGHT_PARENTHESIS("(xyz)"); + private final String value; + + StringSchemaEnums3(String value) { + this.value = value; + } + public String value() { + return this.value; + } + } + + + public sealed interface Schema31Boxed permits Schema31BoxedString { + @Nullable Object getData(); + } + + public record Schema31BoxedString(String data) implements Schema31Boxed { + @Override + public @Nullable Object getData() { + return data; + } + } + + + + public static class Schema31 extends JsonSchema implements StringSchemaValidator, StringEnumValidator, DefaultValueMethod { + private static @Nullable Schema31 instance = null; + + protected Schema31() { + super(new JsonSchemaInfo() + .type(Set.of( + String.class + )) + .enumValues(SetMaker.makeSet( + "_abc", + "-efg", + "(xyz)" + )) + .defaultValue("-efg") + ); + } + + public static Schema31 getInstance() { + if (instance == null) { + instance = new Schema31(); + } + return instance; + } + + @Override + public String validate(String arg, SchemaConfiguration configuration) throws ValidationException { + Set> pathSet = new HashSet<>(); + List pathToItem = List.of("args[0"); + String castArg = castToAllowedTypes(arg, pathToItem, pathSet); + SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().build())); + ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, new PathToSchemasMap(), new LinkedHashSet<>()); + getPathToSchemas(this, castArg, validationMetadata, pathSet); + return castArg; + } + + @Override + 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 { + 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"); + } + @Override + public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { + 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"); + } + public String defaultValue() throws ValidationException { + if (defaultValue instanceof String) { + return (String) defaultValue; + } + throw new ValidationException("Invalid type stored in defaultValue"); + } + @Override + 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 { + 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"); + } + } +} diff --git a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/fake/get/parameters/parameter4/Schema4.kt b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/fake/get/parameters/parameter4/Schema4.kt new file mode 100644 index 00000000000..31ffdbc7fef --- /dev/null +++ b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/fake/get/parameters/parameter4/Schema4.kt @@ -0,0 +1,187 @@ +package org.openapijsonschematools.client.paths.fake.get.parameters.parameter4; +import java.math.BigDecimal; +import java.util.HashSet; +import java.util.LinkedHashSet; +import java.util.List; +import java.util.Objects; +import java.util.Set; +import org.checkerframework.checker.nullness.qual.Nullable; +import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags; +import org.openapijsonschematools.client.configurations.SchemaConfiguration; +import org.openapijsonschematools.client.exceptions.ValidationException; +import org.openapijsonschematools.client.schemas.SetMaker; +import org.openapijsonschematools.client.schemas.validation.DoubleEnumValidator; +import org.openapijsonschematools.client.schemas.validation.DoubleValueMethod; +import org.openapijsonschematools.client.schemas.validation.FloatEnumValidator; +import org.openapijsonschematools.client.schemas.validation.FloatValueMethod; +import org.openapijsonschematools.client.schemas.validation.IntegerEnumValidator; +import org.openapijsonschematools.client.schemas.validation.IntegerValueMethod; +import org.openapijsonschematools.client.schemas.validation.JsonSchema; +import org.openapijsonschematools.client.schemas.validation.JsonSchemaInfo; +import org.openapijsonschematools.client.schemas.validation.LongEnumValidator; +import org.openapijsonschematools.client.schemas.validation.LongValueMethod; +import org.openapijsonschematools.client.schemas.validation.NumberSchemaValidator; +import org.openapijsonschematools.client.schemas.validation.PathToSchemasMap; +import org.openapijsonschematools.client.schemas.validation.ValidationMetadata; + +public class Schema4 { + // nest classes so all schemas and input/output classes can be public + + public enum IntegerSchemaEnums4 implements IntegerValueMethod { + POSITIVE_1(1), + NEGATIVE_2(-2); + private final int value; + + IntegerSchemaEnums4(int value) { + this.value = value; + } + public int value() { + return this.value; + } + } + + public enum LongSchemaEnums4 implements LongValueMethod { + POSITIVE_1(1L), + NEGATIVE_2(-2L); + private final long value; + + LongSchemaEnums4(long value) { + this.value = value; + } + public long value() { + return this.value; + } + } + + public enum FloatSchemaEnums4 implements FloatValueMethod { + POSITIVE_1(1.0f), + NEGATIVE_2(-2.0f); + private final float value; + + FloatSchemaEnums4(float value) { + this.value = value; + } + public float value() { + return this.value; + } + } + + public enum DoubleSchemaEnums4 implements DoubleValueMethod { + POSITIVE_1(1.0d), + NEGATIVE_2(-2.0d); + private final double value; + + DoubleSchemaEnums4(double value) { + this.value = value; + } + public double value() { + return this.value; + } + } + + + public sealed interface Schema41Boxed permits Schema41BoxedNumber { + @Nullable Object getData(); + } + + public record Schema41BoxedNumber(Number data) implements Schema41Boxed { + @Override + public @Nullable Object getData() { + return data; + } + } + + + + public static class Schema41 extends JsonSchema implements IntegerEnumValidator, LongEnumValidator, FloatEnumValidator, DoubleEnumValidator, NumberSchemaValidator { + private static @Nullable Schema41 instance = null; + + protected Schema41() { + super(new JsonSchemaInfo() + .type(Set.of( + Integer.class, + Long.class, + Float.class, + Double.class + )) + .format("int32") + .enumValues(SetMaker.makeSet( + new BigDecimal("1"), + new BigDecimal("-2") + )) + ); + } + + public static Schema41 getInstance() { + if (instance == null) { + instance = new Schema41(); + } + return instance; + } + + @Override + public Number validate(Number arg, SchemaConfiguration configuration) throws ValidationException { + Set> pathSet = new HashSet<>(); + List pathToItem = List.of("args[0"); + Number castArg = castToAllowedTypes(arg, pathToItem, pathSet); + SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().build())); + ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, new PathToSchemasMap(), new LinkedHashSet<>()); + getPathToSchemas(this, castArg, validationMetadata, pathSet); + return castArg; + } + + public int validate(int arg, SchemaConfiguration configuration) throws ValidationException { + return (int) validate((Number) arg, configuration); + } + + public float validate(float arg, SchemaConfiguration configuration) throws ValidationException { + return (float) validate((Number) arg, configuration); + } + + @Override + 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 ValidationException { + return (long) validate((Number) arg.value(), configuration); + } + + @Override + 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 ValidationException { + return (double) validate((Number) arg.value(), configuration); + } + + @Override + public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws 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"); + } + @Override + public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { + 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"); + } + @Override + 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 { + 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"); + } + } +} diff --git a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/fake/get/parameters/parameter5/Schema5.kt b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/fake/get/parameters/parameter5/Schema5.kt new file mode 100644 index 00000000000..061a755133a --- /dev/null +++ b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/fake/get/parameters/parameter5/Schema5.kt @@ -0,0 +1,142 @@ +package org.openapijsonschematools.client.paths.fake.get.parameters.parameter5; +import java.math.BigDecimal; +import java.util.HashSet; +import java.util.LinkedHashSet; +import java.util.List; +import java.util.Objects; +import java.util.Set; +import org.checkerframework.checker.nullness.qual.Nullable; +import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags; +import org.openapijsonschematools.client.configurations.SchemaConfiguration; +import org.openapijsonschematools.client.exceptions.ValidationException; +import org.openapijsonschematools.client.schemas.SetMaker; +import org.openapijsonschematools.client.schemas.validation.DoubleEnumValidator; +import org.openapijsonschematools.client.schemas.validation.DoubleValueMethod; +import org.openapijsonschematools.client.schemas.validation.FloatEnumValidator; +import org.openapijsonschematools.client.schemas.validation.FloatValueMethod; +import org.openapijsonschematools.client.schemas.validation.JsonSchema; +import org.openapijsonschematools.client.schemas.validation.JsonSchemaInfo; +import org.openapijsonschematools.client.schemas.validation.NumberSchemaValidator; +import org.openapijsonschematools.client.schemas.validation.PathToSchemasMap; +import org.openapijsonschematools.client.schemas.validation.ValidationMetadata; + +public class Schema5 { + // nest classes so all schemas and input/output classes can be public + + public enum DoubleSchemaEnums5 implements DoubleValueMethod { + POSITIVE_1_PT_1(1.1d), + NEGATIVE_1_PT_2(-1.2d); + private final double value; + + DoubleSchemaEnums5(double value) { + this.value = value; + } + public double value() { + return this.value; + } + } + + public enum FloatSchemaEnums5 implements FloatValueMethod { + POSITIVE_1_PT_1(1.1f), + NEGATIVE_1_PT_2(-1.2f); + private final float value; + + FloatSchemaEnums5(float value) { + this.value = value; + } + public float value() { + return this.value; + } + } + + + public sealed interface Schema51Boxed permits Schema51BoxedNumber { + @Nullable Object getData(); + } + + public record Schema51BoxedNumber(Number data) implements Schema51Boxed { + @Override + public @Nullable Object getData() { + return data; + } + } + + + + public static class Schema51 extends JsonSchema implements FloatEnumValidator, DoubleEnumValidator, NumberSchemaValidator { + private static @Nullable Schema51 instance = null; + + protected Schema51() { + super(new JsonSchemaInfo() + .type(Set.of( + Integer.class, + Long.class, + Float.class, + Double.class + )) + .format("double") + .enumValues(SetMaker.makeSet( + new BigDecimal("1.1"), + new BigDecimal("-1.2") + )) + ); + } + + public static Schema51 getInstance() { + if (instance == null) { + instance = new Schema51(); + } + return instance; + } + + @Override + public Number validate(Number arg, SchemaConfiguration configuration) throws ValidationException { + Set> pathSet = new HashSet<>(); + List pathToItem = List.of("args[0"); + Number castArg = castToAllowedTypes(arg, pathToItem, pathSet); + SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().build())); + ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, new PathToSchemasMap(), new LinkedHashSet<>()); + PathToSchemasMap pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet); + return castArg; + } + public double validate(double arg, SchemaConfiguration configuration) throws ValidationException { + return (double) validate((Number) arg, configuration); + } + + @Override + 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 ValidationException { + return (double) validate((Number) arg.value(), configuration); + } + + @Override + public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws 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"); + } + @Override + public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { + 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"); + } + @Override + 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 { + 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"); + } + } +} diff --git a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/fake/get/requestbody/content/applicationxwwwformurlencoded/ApplicationxwwwformurlencodedSchema.kt b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/fake/get/requestbody/content/applicationxwwwformurlencoded/ApplicationxwwwformurlencodedSchema.kt new file mode 100644 index 00000000000..74125c1f747 --- /dev/null +++ b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/fake/get/requestbody/content/applicationxwwwformurlencoded/ApplicationxwwwformurlencodedSchema.kt @@ -0,0 +1,553 @@ +package org.openapijsonschematools.client.paths.fake.get.requestbody.content.applicationxwwwformurlencoded; +import java.util.ArrayList; +import java.util.HashSet; +import java.util.LinkedHashMap; +import java.util.LinkedHashSet; +import java.util.List; +import java.util.Map; +import java.util.Objects; +import java.util.Set; +import org.checkerframework.checker.nullness.qual.Nullable; +import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags; +import org.openapijsonschematools.client.configurations.SchemaConfiguration; +import org.openapijsonschematools.client.exceptions.InvalidAdditionalPropertyException; +import org.openapijsonschematools.client.exceptions.UnsetPropertyException; +import org.openapijsonschematools.client.exceptions.ValidationException; +import org.openapijsonschematools.client.schemas.GenericBuilder; +import org.openapijsonschematools.client.schemas.SetMaker; +import org.openapijsonschematools.client.schemas.UnsetAddPropsSetter; +import org.openapijsonschematools.client.schemas.validation.DefaultValueMethod; +import org.openapijsonschematools.client.schemas.validation.FrozenList; +import org.openapijsonschematools.client.schemas.validation.FrozenMap; +import org.openapijsonschematools.client.schemas.validation.JsonSchema; +import org.openapijsonschematools.client.schemas.validation.JsonSchemaInfo; +import org.openapijsonschematools.client.schemas.validation.ListSchemaValidator; +import org.openapijsonschematools.client.schemas.validation.MapSchemaValidator; +import org.openapijsonschematools.client.schemas.validation.PathToSchemasMap; +import org.openapijsonschematools.client.schemas.validation.PropertyEntry; +import org.openapijsonschematools.client.schemas.validation.StringEnumValidator; +import org.openapijsonschematools.client.schemas.validation.StringSchemaValidator; +import org.openapijsonschematools.client.schemas.validation.StringValueMethod; +import org.openapijsonschematools.client.schemas.validation.ValidationMetadata; + +public class ApplicationxwwwformurlencodedSchema { + // nest classes so all schemas and input/output classes can be public + + public enum StringApplicationxwwwformurlencodedItemsEnums implements StringValueMethod { + GREATER_THAN_SIGN(">"), + DOLLAR_SIGN("$"); + private final String value; + + StringApplicationxwwwformurlencodedItemsEnums(String value) { + this.value = value; + } + public String value() { + return this.value; + } + } + + + public sealed interface ApplicationxwwwformurlencodedItemsBoxed permits ApplicationxwwwformurlencodedItemsBoxedString { + @Nullable Object getData(); + } + + public record ApplicationxwwwformurlencodedItemsBoxedString(String data) implements ApplicationxwwwformurlencodedItemsBoxed { + @Override + public @Nullable Object getData() { + return data; + } + } + + + + public static class ApplicationxwwwformurlencodedItems extends JsonSchema implements StringSchemaValidator, StringEnumValidator, DefaultValueMethod { + private static @Nullable ApplicationxwwwformurlencodedItems instance = null; + + protected ApplicationxwwwformurlencodedItems() { + super(new JsonSchemaInfo() + .type(Set.of( + String.class + )) + .enumValues(SetMaker.makeSet( + ">", + "$" + )) + .defaultValue("$") + ); + } + + public static ApplicationxwwwformurlencodedItems getInstance() { + if (instance == null) { + instance = new ApplicationxwwwformurlencodedItems(); + } + return instance; + } + + @Override + public String validate(String arg, SchemaConfiguration configuration) throws ValidationException { + Set> pathSet = new HashSet<>(); + List pathToItem = List.of("args[0"); + String castArg = castToAllowedTypes(arg, pathToItem, pathSet); + SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().build())); + ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, new PathToSchemasMap(), new LinkedHashSet<>()); + getPathToSchemas(this, castArg, validationMetadata, pathSet); + return castArg; + } + + @Override + 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 { + 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"); + } + @Override + public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { + 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"); + } + public String defaultValue() throws ValidationException { + if (defaultValue instanceof String) { + return (String) defaultValue; + } + throw new ValidationException("Invalid type stored in defaultValue"); + } + @Override + 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 { + 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"); + } + } + + public static class ApplicationxwwwformurlencodedEnumFormStringArrayList extends FrozenList { + protected ApplicationxwwwformurlencodedEnumFormStringArrayList(FrozenList m) { + super(m); + } + public static ApplicationxwwwformurlencodedEnumFormStringArrayList of(List arg, SchemaConfiguration configuration) throws ValidationException { + return ApplicationxwwwformurlencodedEnumFormStringArray.getInstance().validate(arg, configuration); + } + } + + public static class ApplicationxwwwformurlencodedEnumFormStringArrayListBuilder { + // class to build List + private final List list; + + public ApplicationxwwwformurlencodedEnumFormStringArrayListBuilder() { + list = new ArrayList<>(); + } + + public ApplicationxwwwformurlencodedEnumFormStringArrayListBuilder(List list) { + this.list = list; + } + + public ApplicationxwwwformurlencodedEnumFormStringArrayListBuilder add(String item) { + list.add(item); + return this; + } + + public ApplicationxwwwformurlencodedEnumFormStringArrayListBuilder add(StringApplicationxwwwformurlencodedItemsEnums item) { + list.add(item.value()); + return this; + } + + public List build() { + return list; + } + } + + + public sealed interface ApplicationxwwwformurlencodedEnumFormStringArrayBoxed permits ApplicationxwwwformurlencodedEnumFormStringArrayBoxedList { + @Nullable Object getData(); + } + + public record ApplicationxwwwformurlencodedEnumFormStringArrayBoxedList(ApplicationxwwwformurlencodedEnumFormStringArrayList data) implements ApplicationxwwwformurlencodedEnumFormStringArrayBoxed { + @Override + public @Nullable Object getData() { + return data; + } + } + + + + public static class ApplicationxwwwformurlencodedEnumFormStringArray extends JsonSchema implements ListSchemaValidator { + private static @Nullable ApplicationxwwwformurlencodedEnumFormStringArray instance = null; + + protected ApplicationxwwwformurlencodedEnumFormStringArray() { + super(new JsonSchemaInfo() + .type(Set.of(List.class)) + .items(ApplicationxwwwformurlencodedItems.class) + ); + } + + public static ApplicationxwwwformurlencodedEnumFormStringArray getInstance() { + if (instance == null) { + instance = new ApplicationxwwwformurlencodedEnumFormStringArray(); + } + return instance; + } + + @Override + public ApplicationxwwwformurlencodedEnumFormStringArrayList getNewInstance(List arg, List pathToItem, PathToSchemasMap pathToSchemas) { + List items = new ArrayList<>(); + int i = 0; + for (Object item: arg) { + List itemPathToItem = new ArrayList<>(pathToItem); + itemPathToItem.add(i); + LinkedHashMap, Nothing?> schemas = pathToSchemas.get(itemPathToItem); + if (schemas == null) { + throw new RuntimeException("Validation 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"); + } + items.add((String) itemInstance); + i += 1; + } + FrozenList newInstanceItems = new FrozenList<>(items); + return new ApplicationxwwwformurlencodedEnumFormStringArrayList(newInstanceItems); + } + + 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); + SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().build())); + ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, new PathToSchemasMap(), new LinkedHashSet<>()); + PathToSchemasMap pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet); + return getNewInstance(castArg, validationMetadata.pathToItem(), pathToSchemasMap); + } + + @Override + public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws 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"); + } + @Override + public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { + 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"); + } + @Override + 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 { + 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"); + } + } + public enum StringApplicationxwwwformurlencodedEnumFormStringEnums implements StringValueMethod { + LOW_LINE_ABC("_abc"), + HYPHEN_MINUS_EFG("-efg"), + LEFT_PARENTHESIS_XYZ_RIGHT_PARENTHESIS("(xyz)"); + private final String value; + + StringApplicationxwwwformurlencodedEnumFormStringEnums(String value) { + this.value = value; + } + public String value() { + return this.value; + } + } + + + public sealed interface ApplicationxwwwformurlencodedEnumFormStringBoxed permits ApplicationxwwwformurlencodedEnumFormStringBoxedString { + @Nullable Object getData(); + } + + public record ApplicationxwwwformurlencodedEnumFormStringBoxedString(String data) implements ApplicationxwwwformurlencodedEnumFormStringBoxed { + @Override + public @Nullable Object getData() { + return data; + } + } + + + + public static class ApplicationxwwwformurlencodedEnumFormString extends JsonSchema implements StringSchemaValidator, StringEnumValidator, DefaultValueMethod { + private static @Nullable ApplicationxwwwformurlencodedEnumFormString instance = null; + + protected ApplicationxwwwformurlencodedEnumFormString() { + super(new JsonSchemaInfo() + .type(Set.of( + String.class + )) + .enumValues(SetMaker.makeSet( + "_abc", + "-efg", + "(xyz)" + )) + .defaultValue("-efg") + ); + } + + public static ApplicationxwwwformurlencodedEnumFormString getInstance() { + if (instance == null) { + instance = new ApplicationxwwwformurlencodedEnumFormString(); + } + return instance; + } + + @Override + public String validate(String arg, SchemaConfiguration configuration) throws ValidationException { + Set> pathSet = new HashSet<>(); + List pathToItem = List.of("args[0"); + String castArg = castToAllowedTypes(arg, pathToItem, pathSet); + SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().build())); + ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, new PathToSchemasMap(), new LinkedHashSet<>()); + getPathToSchemas(this, castArg, validationMetadata, pathSet); + return castArg; + } + + @Override + 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 { + 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"); + } + @Override + public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { + 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"); + } + public String defaultValue() throws ValidationException { + if (defaultValue instanceof String) { + return (String) defaultValue; + } + throw new ValidationException("Invalid type stored in defaultValue"); + } + @Override + 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 { + 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"); + } + } + + public static class ApplicationxwwwformurlencodedSchemaMap extends FrozenMap<@Nullable Object> { + protected ApplicationxwwwformurlencodedSchemaMap(FrozenMap<@Nullable Object> m) { + super(m); + } + public static final Set requiredKeys = Set.of(); + public static final Set optionalKeys = Set.of( + "enum_form_string_array", + "enum_form_string" + ); + public static ApplicationxwwwformurlencodedSchemaMap of(Map arg, SchemaConfiguration configuration) throws ValidationException { + return ApplicationxwwwformurlencodedSchema1.getInstance().validate(arg, configuration); + } + + public ApplicationxwwwformurlencodedEnumFormStringArrayList enum_form_string_array() throws UnsetPropertyException { + String key = "enum_form_string_array"; + throwIfKeyNotPresent(key); + @Nullable Object value = get(key); + if (!(value instanceof ApplicationxwwwformurlencodedEnumFormStringArrayList)) { + throw new RuntimeException("Invalid value stored for enum_form_string_array"); + } + return (ApplicationxwwwformurlencodedEnumFormStringArrayList) value; + } + + public String enum_form_string() throws UnsetPropertyException { + String key = "enum_form_string"; + throwIfKeyNotPresent(key); + @Nullable Object value = get(key); + if (!(value instanceof String)) { + throw new RuntimeException("Invalid value stored for enum_form_string"); + } + return (String) value; + } + + public @Nullable Object getAdditionalProperty(String name) throws UnsetPropertyException, InvalidAdditionalPropertyException { + throwIfKeyKnown(name, requiredKeys, optionalKeys); + throwIfKeyNotPresent(name); + return get(name); + } + } + + public interface SetterForApplicationxwwwformurlencodedEnumFormStringArray { + Map getInstance(); + T getBuilderAfterApplicationxwwwformurlencodedEnumFormStringArray(Map instance); + + default T enum_form_string_array(List value) { + var instance = getInstance(); + instance.put("enum_form_string_array", value); + return getBuilderAfterApplicationxwwwformurlencodedEnumFormStringArray(instance); + } + } + + public interface SetterForApplicationxwwwformurlencodedEnumFormString { + Map getInstance(); + T getBuilderAfterApplicationxwwwformurlencodedEnumFormString(Map instance); + + default T enum_form_string(String value) { + var instance = getInstance(); + instance.put("enum_form_string", value); + return getBuilderAfterApplicationxwwwformurlencodedEnumFormString(instance); + } + + default T enum_form_string(StringApplicationxwwwformurlencodedEnumFormStringEnums value) { + var instance = getInstance(); + instance.put("enum_form_string", value.value()); + return getBuilderAfterApplicationxwwwformurlencodedEnumFormString(instance); + } + } + + public static class ApplicationxwwwformurlencodedSchemaMapBuilder extends UnsetAddPropsSetter implements GenericBuilder>, SetterForApplicationxwwwformurlencodedEnumFormStringArray, SetterForApplicationxwwwformurlencodedEnumFormString { + private final Map instance; + private static final Set knownKeys = Set.of( + "enum_form_string_array", + "enum_form_string" + ); + public Set getKnownKeys() { + return knownKeys; + } + public ApplicationxwwwformurlencodedSchemaMapBuilder() { + this.instance = new LinkedHashMap<>(); + } + public Map build() { + return instance; + } + public Map getInstance() { + return instance; + } + public ApplicationxwwwformurlencodedSchemaMapBuilder getBuilderAfterApplicationxwwwformurlencodedEnumFormStringArray(Map instance) { + return this; + } + public ApplicationxwwwformurlencodedSchemaMapBuilder getBuilderAfterApplicationxwwwformurlencodedEnumFormString(Map instance) { + return this; + } + public ApplicationxwwwformurlencodedSchemaMapBuilder getBuilderAfterAdditionalProperty(Map instance) { + return this; + } + } + + + public sealed interface ApplicationxwwwformurlencodedSchema1Boxed permits ApplicationxwwwformurlencodedSchema1BoxedMap { + @Nullable Object getData(); + } + + public record ApplicationxwwwformurlencodedSchema1BoxedMap(ApplicationxwwwformurlencodedSchemaMap data) implements ApplicationxwwwformurlencodedSchema1Boxed { + @Override + public @Nullable Object getData() { + return data; + } + } + + + public static class ApplicationxwwwformurlencodedSchema1 extends JsonSchema implements MapSchemaValidator { + private static @Nullable ApplicationxwwwformurlencodedSchema1 instance = null; + + protected ApplicationxwwwformurlencodedSchema1() { + super(new JsonSchemaInfo() + .type(Set.of(Map.class)) + .properties(Map.ofEntries( + new PropertyEntry("enum_form_string_array", ApplicationxwwwformurlencodedEnumFormStringArray.class), + new PropertyEntry("enum_form_string", ApplicationxwwwformurlencodedEnumFormString.class) + )) + ); + } + + public static ApplicationxwwwformurlencodedSchema1 getInstance() { + if (instance == null) { + instance = new ApplicationxwwwformurlencodedSchema1(); + } + return instance; + } + + 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 RuntimeException("Invalid non-string key value"); + } + String propertyName = (String) entryKey; + List propertyPathToItem = new ArrayList<>(pathToItem); + propertyPathToItem.add(propertyName); + Object value = entry.getValue(); + LinkedHashMap, Nothing?> schemas = pathToSchemas.get(propertyPathToItem); + if (schemas == null) { + throw new RuntimeException("Validation result is invalid, schemas must exist for a pathToItem"); + } + JsonSchema propertySchema = schemas.entrySet().iterator().next().getKey(); + @Nullable Object propertyInstance = propertySchema.getNewInstance(value, propertyPathToItem, pathToSchemas); + properties.put(propertyName, propertyInstance); + } + FrozenMap<@Nullable Object> castProperties = new FrozenMap<>(properties); + return new ApplicationxwwwformurlencodedSchemaMap(castProperties); + } + + 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); + SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().build())); + ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, new PathToSchemasMap(), new LinkedHashSet<>()); + PathToSchemasMap pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet); + return getNewInstance(castArg, validationMetadata.pathToItem(), pathToSchemasMap); + } + + + @Override + public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws 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"); + } + @Override + public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { + if (arg instanceof Map) { + return getNewInstance((Map) arg, pathToItem, pathToSchemas); + } + 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 { + return new ApplicationxwwwformurlencodedSchema1BoxedMap(validate(arg, configuration)); + } + @Override + public ApplicationxwwwformurlencodedSchema1Boxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { + 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"); + } + } + +} diff --git a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/fake/get/responses/FakeGetCode200Response.kt b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/fake/get/responses/FakeGetCode200Response.kt new file mode 100644 index 00000000000..5787a626bfc --- /dev/null +++ b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/fake/get/responses/FakeGetCode200Response.kt @@ -0,0 +1,7 @@ +package org.openapijsonschematools.client.paths.fake.get.responses; + +import org.openapijsonschematools.client.components.responses.SuccessDescriptionOnly; + +public class FakeGetCode200Response extends SuccessDescriptionOnly { + public static class FakeGetCode200Response1 extends SuccessDescriptionOnly1 {} +} diff --git a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/fake/get/responses/FakeGetCode404Response.kt b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/fake/get/responses/FakeGetCode404Response.kt new file mode 100644 index 00000000000..40d6b5a0263 --- /dev/null +++ b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/fake/get/responses/FakeGetCode404Response.kt @@ -0,0 +1,63 @@ +package org.openapijsonschematools.client.paths.fake.get.responses; + +import org.openapijsonschematools.client.configurations.SchemaConfiguration; +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; + +import java.util.AbstractMap; +import java.util.Map; +import java.net.http.HttpResponse; +import java.net.http.HttpHeaders; + +public class FakeGetCode404Response { + public sealed interface SealedMediaType permits ApplicationjsonMediaType {} + + public record ApplicationjsonMediaType(ApplicationjsonSchema.ApplicationjsonSchema1 schema) implements SealedMediaType, MediaType { + public ApplicationjsonMediaType() { + this(ApplicationjsonSchema.ApplicationjsonSchema1.getInstance()); + } + @Override + public Nothing? encoding() { + return null; + } + } + public sealed interface SealedResponseBody permits ApplicationjsonResponseBody {} + public record ApplicationjsonResponseBody(ApplicationjsonSchema.MapJsonSchema1Boxed body) implements SealedResponseBody { } + + public static class FakeGetCode404Response1 extends ResponseDeserializer { + public FakeGetCode404Response1() { + super( + Map.ofEntries( + new AbstractMap.SimpleEntry<>("application/json", new ApplicationjsonMediaType()) + ) + ); + } + + @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); + } + + @Override + protected Nothing? getHeaders(HttpHeaders headers, SchemaConfiguration configuration) { + return null; + } + } + + @SuppressWarnings("serial") + public static class ResponseApiException extends ApiException { + public DeserializedHttpResponse deserializedResponse; + + public ResponseApiException(String s, HttpResponse response, DeserializedHttpResponse deserializedResponse) { + super(s, response); + this.deserializedResponse = deserializedResponse; + } + } +} diff --git a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/fake/get/responses/code404response/content/applicationjson/ApplicationjsonSchema.kt b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/fake/get/responses/code404response/content/applicationjson/ApplicationjsonSchema.kt new file mode 100644 index 00000000000..b9a4b76bd20 --- /dev/null +++ b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/fake/get/responses/code404response/content/applicationjson/ApplicationjsonSchema.kt @@ -0,0 +1,20 @@ +package org.openapijsonschematools.client.paths.fake.get.responses.code404response.content.applicationjson; +import org.checkerframework.checker.nullness.qual.Nullable; +import org.openapijsonschematools.client.schemas.MapJsonSchema; +import org.openapijsonschematools.client.schemas.validation.FrozenMap; + +public class ApplicationjsonSchema extends MapJsonSchema { + // nest classes so all schemas and input/output classes can be public + + + public static class ApplicationjsonSchema1 extends MapJsonSchema.MapJsonSchema1 { + private static @Nullable ApplicationjsonSchema1 instance = null; + public static ApplicationjsonSchema1 getInstance() { + if (instance == null) { + instance = new ApplicationjsonSchema1(); + } + return instance; + } + } + +} diff --git a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/fake/patch/FakePatchRequestBody.kt b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/fake/patch/FakePatchRequestBody.kt new file mode 100644 index 00000000000..a31bc3e33c1 --- /dev/null +++ b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/fake/patch/FakePatchRequestBody.kt @@ -0,0 +1,7 @@ +package org.openapijsonschematools.client.paths.fake.patch; + +import org.openapijsonschematools.client.components.requestbodies.Client; + +public class FakePatchRequestBody extends Client { + public static class FakePatchRequestBody1 extends Client1 {} +} diff --git a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/fake/patch/FakePatchResponses.kt b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/fake/patch/FakePatchResponses.kt new file mode 100644 index 00000000000..8c4a049a4f2 --- /dev/null +++ b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/fake/patch/FakePatchResponses.kt @@ -0,0 +1,53 @@ +package org.openapijsonschematools.client.paths.fake.patch; + +import org.openapijsonschematools.client.paths.fake.patch.responses.FakePatchCode200Response; +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; +import org.checkerframework.checker.nullness.qual.Nullable; + +import java.net.http.HttpResponse; +import java.util.Map; +import java.util.AbstractMap; + +public class FakePatchResponses { + public sealed interface EndpointResponse permits EndpointFakePatchCode200Response {} + + public record EndpointFakePatchCode200Response( + HttpResponse response, + FakePatchCode200Response.SealedResponseBody body, + Nothing? headers + ) implements EndpointResponse, ApiResponse{ + } + + public sealed interface StatusCodeResponseDeserializer permits StatusFakePatchCode200ResponseDeserializer {} + + public static final class StatusFakePatchCode200ResponseDeserializer extends FakePatchCode200Response.FakePatchCode200Response1 implements StatusCodeResponseDeserializer { + } + + public static final class FakePatchResponses1 implements ResponsesDeserializer { + private final Map statusCodeToResponseDeserializer; + public FakePatchResponses1() { + this.statusCodeToResponseDeserializer = Map.ofEntries( + new AbstractMap.SimpleEntry<>("200", new StatusFakePatchCode200ResponseDeserializer()) + ); + } + + 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) { + throw new ApiException( + "Invalid response statusCode="+statusCode+" has no response defined in the openapi document", + response + ); + } + StatusFakePatchCode200ResponseDeserializer castDeserializer = (StatusFakePatchCode200ResponseDeserializer) statusCodeDeserializer; + var deserializedResponse = castDeserializer.deserialize(response, configuration); + return new EndpointFakePatchCode200Response(response, deserializedResponse.body(), deserializedResponse.headers()); + } + } +} diff --git a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/fake/patch/responses/FakePatchCode200Response.kt b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/fake/patch/responses/FakePatchCode200Response.kt new file mode 100644 index 00000000000..baa1eed3da9 --- /dev/null +++ b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/fake/patch/responses/FakePatchCode200Response.kt @@ -0,0 +1,63 @@ +package org.openapijsonschematools.client.paths.fake.patch.responses; + +import org.openapijsonschematools.client.configurations.SchemaConfiguration; +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; + +import java.util.AbstractMap; +import java.util.Map; +import java.net.http.HttpResponse; +import java.net.http.HttpHeaders; + +public class FakePatchCode200Response { + public sealed interface SealedMediaType permits ApplicationjsonMediaType {} + + public record ApplicationjsonMediaType(ApplicationjsonSchema.ApplicationjsonSchema1 schema) implements SealedMediaType, MediaType { + public ApplicationjsonMediaType() { + this(ApplicationjsonSchema.ApplicationjsonSchema1.getInstance()); + } + @Override + public Nothing? encoding() { + return null; + } + } + public sealed interface SealedResponseBody permits ApplicationjsonResponseBody {} + public record ApplicationjsonResponseBody(ApplicationjsonSchema.Client1Boxed body) implements SealedResponseBody { } + + public static class FakePatchCode200Response1 extends ResponseDeserializer { + public FakePatchCode200Response1() { + super( + Map.ofEntries( + new AbstractMap.SimpleEntry<>("application/json", new ApplicationjsonMediaType()) + ) + ); + } + + @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); + } + + @Override + protected Nothing? getHeaders(HttpHeaders headers, SchemaConfiguration configuration) { + return null; + } + } + + @SuppressWarnings("serial") + public static class ResponseApiException extends ApiException { + public DeserializedHttpResponse deserializedResponse; + + public ResponseApiException(String s, HttpResponse response, DeserializedHttpResponse deserializedResponse) { + super(s, response); + this.deserializedResponse = deserializedResponse; + } + } +} diff --git a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/fake/patch/responses/code200response/content/applicationjson/ApplicationjsonSchema.kt b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/fake/patch/responses/code200response/content/applicationjson/ApplicationjsonSchema.kt new file mode 100644 index 00000000000..f61bbf1fe44 --- /dev/null +++ b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/fake/patch/responses/code200response/content/applicationjson/ApplicationjsonSchema.kt @@ -0,0 +1,19 @@ +package org.openapijsonschematools.client.paths.fake.patch.responses.code200response.content.applicationjson; + +import org.checkerframework.checker.nullness.qual.Nullable; +import org.openapijsonschematools.client.components.schemas.Client; + +public class ApplicationjsonSchema extends Client { + // $refed class + + + public static class ApplicationjsonSchema1 extends Client1 { + private static @Nullable ApplicationjsonSchema1 instance = null; + public static ApplicationjsonSchema1 getInstance() { + if (instance == null) { + instance = new ApplicationjsonSchema1(); + } + return instance; + } + } +} diff --git a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/fake/post/FakePostRequestBody.kt b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/fake/post/FakePostRequestBody.kt new file mode 100644 index 00000000000..904242daaff --- /dev/null +++ b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/fake/post/FakePostRequestBody.kt @@ -0,0 +1,49 @@ +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; +import org.openapijsonschematools.client.mediatype.MediaType; +import org.openapijsonschematools.client.paths.fake.post.requestbody.content.applicationxwwwformurlencoded.ApplicationxwwwformurlencodedSchema; + +import java.util.AbstractMap; +import java.util.Map; + +public class FakePostRequestBody { + public sealed interface SealedMediaType permits ApplicationxwwwformurlencodedMediaType {} + + public record ApplicationxwwwformurlencodedMediaType(ApplicationxwwwformurlencodedSchema.ApplicationxwwwformurlencodedSchema1 schema) implements SealedMediaType, MediaType { + public ApplicationxwwwformurlencodedMediaType() { + this(ApplicationxwwwformurlencodedSchema.ApplicationxwwwformurlencodedSchema1.getInstance()); + } + @Override + public Nothing? encoding() { + return null; + } + } + + public static class FakePostRequestBody1 extends RequestBodySerializer { + public FakePostRequestBody1() { + super( + Map.ofEntries( + new AbstractMap.SimpleEntry<>("application/x-www-form-urlencoded", new ApplicationxwwwformurlencodedMediaType()) + ), + false + ); + } + + public SerializedRequestBody serialize(SealedRequestBody requestBody) throws NotImplementedException { + ApplicationxwwwformurlencodedRequestBody requestBody0 = (ApplicationxwwwformurlencodedRequestBody) requestBody; + return serialize(requestBody0.contentType(), requestBody0.body().getData()); + } + } + + public sealed interface SealedRequestBody permits ApplicationxwwwformurlencodedRequestBody {} + public record ApplicationxwwwformurlencodedRequestBody(ApplicationxwwwformurlencodedSchema.ApplicationxwwwformurlencodedSchema1Boxed body) implements SealedRequestBody, GenericRequestBody { + @Override + public String contentType() { + return "application/x-www-form-urlencoded"; + } + } +} diff --git a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/fake/post/FakePostResponses.kt b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/fake/post/FakePostResponses.kt new file mode 100644 index 00000000000..62981b6b97f --- /dev/null +++ b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/fake/post/FakePostResponses.kt @@ -0,0 +1,66 @@ +package org.openapijsonschematools.client.paths.fake.post; + +import org.openapijsonschematools.client.paths.fake.post.responses.FakePostCode200Response; +import org.openapijsonschematools.client.paths.fake.post.responses.FakePostCode404Response; +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; +import org.checkerframework.checker.nullness.qual.Nullable; + +import java.net.http.HttpResponse; +import java.util.Map; +import java.util.AbstractMap; + +public class FakePostResponses { + public sealed interface EndpointResponse permits EndpointFakePostCode200Response {} + + public record EndpointFakePostCode200Response( + HttpResponse response, + Nothing? body, + Nothing? headers + ) implements EndpointResponse, ApiResponse{ + } + + public sealed interface StatusCodeResponseDeserializer permits StatusFakePostCode200ResponseDeserializer, StatusFakePostCode404ResponseDeserializer {} + + public static final class StatusFakePostCode200ResponseDeserializer extends FakePostCode200Response.FakePostCode200Response1 implements StatusCodeResponseDeserializer { + } + public static final class StatusFakePostCode404ResponseDeserializer extends FakePostCode404Response.FakePostCode404Response1 implements StatusCodeResponseDeserializer { + } + + public static final class FakePostResponses1 implements ResponsesDeserializer { + private final Map statusCodeToResponseDeserializer; + public FakePostResponses1() { + this.statusCodeToResponseDeserializer = Map.ofEntries( + new AbstractMap.SimpleEntry<>("200", new StatusFakePostCode200ResponseDeserializer()), + new AbstractMap.SimpleEntry<>("404", new StatusFakePostCode404ResponseDeserializer()) + ); + } + + 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) { + throw new ApiException( + "Invalid response statusCode="+statusCode+" has no response defined in the openapi document", + response + ); + } + if (statusCodeDeserializer instanceof StatusFakePostCode200ResponseDeserializer castDeserializer) { + var deserializedResponse = castDeserializer.deserialize(response, configuration); + return new EndpointFakePostCode200Response(response, deserializedResponse.body(), deserializedResponse.headers()); + } else { + StatusFakePostCode404ResponseDeserializer castDeserializer = (StatusFakePostCode404ResponseDeserializer) statusCodeDeserializer; + var deserializedResponse = castDeserializer.deserialize(response, configuration); + throw new FakePostCode404Response.ResponseApiException( + "Received error statusCode response from server", + response, + deserializedResponse + ); + } + } + } +} diff --git a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/fake/post/FakePostSecurityInfo.kt b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/fake/post/FakePostSecurityInfo.kt new file mode 100644 index 00000000000..013b581a6d4 --- /dev/null +++ b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/fake/post/FakePostSecurityInfo.kt @@ -0,0 +1,24 @@ +package org.openapijsonschematools.client.paths.fake.post; + +import org.openapijsonschematools.client.paths.fake.post.security.FakePostSecurityRequirementObject0; +import org.openapijsonschematools.client.securityrequirementobjects.SecurityRequirementObject; +import org.openapijsonschematools.client.securityrequirementobjects.SecurityRequirementObjectProvider; + +public class FakePostSecurityInfo { + public static class FakePostSecurityInfo1 implements SecurityRequirementObjectProvider { + public final FakePostSecurityRequirementObject0 security0; + + public FakePostSecurityInfo1() { + security0 = new FakePostSecurityRequirementObject0(); + } + + @Override + public SecurityRequirementObject getSecurityRequirementObject(SecurityIndex securityIndex) { + return security0; + } + } + + public enum SecurityIndex { + SECURITY_0 + } +} \ No newline at end of file diff --git a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/fake/post/requestbody/content/applicationxwwwformurlencoded/ApplicationxwwwformurlencodedSchema.kt b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/fake/post/requestbody/content/applicationxwwwformurlencoded/ApplicationxwwwformurlencodedSchema.kt new file mode 100644 index 00000000000..4c57be2635e --- /dev/null +++ b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/fake/post/requestbody/content/applicationxwwwformurlencoded/ApplicationxwwwformurlencodedSchema.kt @@ -0,0 +1,1591 @@ +package org.openapijsonschematools.client.paths.fake.post.requestbody.content.applicationxwwwformurlencoded; +import java.time.ZonedDateTime; +import java.util.ArrayList; +import java.util.HashSet; +import java.util.LinkedHashMap; +import java.util.LinkedHashSet; +import java.util.List; +import java.util.Map; +import java.util.Objects; +import java.util.Set; +import java.util.regex.Pattern; +import org.checkerframework.checker.nullness.qual.Nullable; +import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags; +import org.openapijsonschematools.client.configurations.SchemaConfiguration; +import org.openapijsonschematools.client.exceptions.InvalidAdditionalPropertyException; +import org.openapijsonschematools.client.exceptions.UnsetPropertyException; +import org.openapijsonschematools.client.exceptions.ValidationException; +import org.openapijsonschematools.client.schemas.DateJsonSchema; +import org.openapijsonschematools.client.schemas.GenericBuilder; +import org.openapijsonschematools.client.schemas.Int64JsonSchema; +import org.openapijsonschematools.client.schemas.StringJsonSchema; +import org.openapijsonschematools.client.schemas.UnsetAddPropsSetter; +import org.openapijsonschematools.client.schemas.validation.DefaultValueMethod; +import org.openapijsonschematools.client.schemas.validation.FrozenMap; +import org.openapijsonschematools.client.schemas.validation.JsonSchema; +import org.openapijsonschematools.client.schemas.validation.JsonSchemaInfo; +import org.openapijsonschematools.client.schemas.validation.MapSchemaValidator; +import org.openapijsonschematools.client.schemas.validation.NumberSchemaValidator; +import org.openapijsonschematools.client.schemas.validation.PathToSchemasMap; +import org.openapijsonschematools.client.schemas.validation.PropertyEntry; +import org.openapijsonschematools.client.schemas.validation.StringSchemaValidator; +import org.openapijsonschematools.client.schemas.validation.ValidationMetadata; + +public class ApplicationxwwwformurlencodedSchema { + // nest classes so all schemas and input/output classes can be public + + + public sealed interface ApplicationxwwwformurlencodedIntegerBoxed permits ApplicationxwwwformurlencodedIntegerBoxedNumber { + @Nullable Object getData(); + } + + public record ApplicationxwwwformurlencodedIntegerBoxedNumber(Number data) implements ApplicationxwwwformurlencodedIntegerBoxed { + @Override + public @Nullable Object getData() { + return data; + } + } + + + + public static class ApplicationxwwwformurlencodedInteger extends JsonSchema implements NumberSchemaValidator { + private static @Nullable ApplicationxwwwformurlencodedInteger instance = null; + + protected ApplicationxwwwformurlencodedInteger() { + super(new JsonSchemaInfo() + .type(Set.of( + Integer.class, + Long.class, + Float.class, + Double.class + )) + .format("int") + .maximum(100) + .minimum(10) + ); + } + + public static ApplicationxwwwformurlencodedInteger getInstance() { + if (instance == null) { + instance = new ApplicationxwwwformurlencodedInteger(); + } + return instance; + } + + @Override + public Number validate(Number arg, SchemaConfiguration configuration) throws ValidationException { + Set> pathSet = new HashSet<>(); + List pathToItem = List.of("args[0"); + Number castArg = castToAllowedTypes(arg, pathToItem, pathSet); + SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().build())); + ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, new PathToSchemasMap(), new LinkedHashSet<>()); + getPathToSchemas(this, castArg, validationMetadata, pathSet); + return castArg; + } + + public int validate(int arg, SchemaConfiguration configuration) throws ValidationException { + return (int) validate((Number) arg, configuration); + } + + public float validate(float arg, SchemaConfiguration configuration) throws ValidationException { + return (float) validate((Number) arg, configuration); + } + + public long validate(long arg, SchemaConfiguration configuration) throws ValidationException { + return (long) validate((Number) arg, configuration); + } + + 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 { + 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"); + } + @Override + public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { + 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"); + } + @Override + 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 { + 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"); + } + } + + public sealed interface ApplicationxwwwformurlencodedInt32Boxed permits ApplicationxwwwformurlencodedInt32BoxedNumber { + @Nullable Object getData(); + } + + public record ApplicationxwwwformurlencodedInt32BoxedNumber(Number data) implements ApplicationxwwwformurlencodedInt32Boxed { + @Override + public @Nullable Object getData() { + return data; + } + } + + + + public static class ApplicationxwwwformurlencodedInt32 extends JsonSchema implements NumberSchemaValidator { + private static @Nullable ApplicationxwwwformurlencodedInt32 instance = null; + + protected ApplicationxwwwformurlencodedInt32() { + super(new JsonSchemaInfo() + .type(Set.of( + Integer.class, + Long.class, + Float.class, + Double.class + )) + .format("int32") + .maximum(200) + .minimum(20) + ); + } + + public static ApplicationxwwwformurlencodedInt32 getInstance() { + if (instance == null) { + instance = new ApplicationxwwwformurlencodedInt32(); + } + return instance; + } + + @Override + public Number validate(Number arg, SchemaConfiguration configuration) throws ValidationException { + Set> pathSet = new HashSet<>(); + List pathToItem = List.of("args[0"); + Number castArg = castToAllowedTypes(arg, pathToItem, pathSet); + SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().build())); + ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, new PathToSchemasMap(), new LinkedHashSet<>()); + getPathToSchemas(this, castArg, validationMetadata, pathSet); + return castArg; + } + + public int validate(int arg, SchemaConfiguration configuration) throws ValidationException { + return (int) validate((Number) arg, configuration); + } + + 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 { + 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"); + } + @Override + public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { + 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"); + } + @Override + 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 { + 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"); + } + } + + public static class ApplicationxwwwformurlencodedInt64 extends Int64JsonSchema.Int64JsonSchema1 { + private static @Nullable ApplicationxwwwformurlencodedInt64 instance = null; + public static ApplicationxwwwformurlencodedInt64 getInstance() { + if (instance == null) { + instance = new ApplicationxwwwformurlencodedInt64(); + } + return instance; + } + } + + + public sealed interface ApplicationxwwwformurlencodedNumberBoxed permits ApplicationxwwwformurlencodedNumberBoxedNumber { + @Nullable Object getData(); + } + + public record ApplicationxwwwformurlencodedNumberBoxedNumber(Number data) implements ApplicationxwwwformurlencodedNumberBoxed { + @Override + public @Nullable Object getData() { + return data; + } + } + + + + public static class ApplicationxwwwformurlencodedNumber extends JsonSchema implements NumberSchemaValidator { + private static @Nullable ApplicationxwwwformurlencodedNumber instance = null; + + protected ApplicationxwwwformurlencodedNumber() { + super(new JsonSchemaInfo() + .type(Set.of( + Integer.class, + Long.class, + Float.class, + Double.class + )) + .maximum(543.2) + .minimum(32.1) + ); + } + + public static ApplicationxwwwformurlencodedNumber getInstance() { + if (instance == null) { + instance = new ApplicationxwwwformurlencodedNumber(); + } + return instance; + } + + @Override + public Number validate(Number arg, SchemaConfiguration configuration) throws ValidationException { + Set> pathSet = new HashSet<>(); + List pathToItem = List.of("args[0"); + Number castArg = castToAllowedTypes(arg, pathToItem, pathSet); + SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().build())); + ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, new PathToSchemasMap(), new LinkedHashSet<>()); + PathToSchemasMap pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet); + return castArg; + } + + public int validate(int arg, SchemaConfiguration configuration) throws ValidationException { + return (int) validate((Number) arg, configuration); + } + + public long validate(long arg, SchemaConfiguration configuration) throws ValidationException { + return (long) validate((Number) arg, configuration); + } + + public float validate(float arg, SchemaConfiguration configuration) throws ValidationException { + return (float) validate((Number) arg, configuration); + } + + 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 { + 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"); + } + @Override + public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { + 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"); + } + @Override + 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 { + 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"); + } + } + + public sealed interface ApplicationxwwwformurlencodedFloatBoxed permits ApplicationxwwwformurlencodedFloatBoxedNumber { + @Nullable Object getData(); + } + + public record ApplicationxwwwformurlencodedFloatBoxedNumber(Number data) implements ApplicationxwwwformurlencodedFloatBoxed { + @Override + public @Nullable Object getData() { + return data; + } + } + + + + public static class ApplicationxwwwformurlencodedFloat extends JsonSchema implements NumberSchemaValidator { + private static @Nullable ApplicationxwwwformurlencodedFloat instance = null; + + protected ApplicationxwwwformurlencodedFloat() { + super(new JsonSchemaInfo() + .type(Set.of( + Integer.class, + Long.class, + Float.class, + Double.class + )) + .format("float") + .maximum(987.6) + ); + } + + public static ApplicationxwwwformurlencodedFloat getInstance() { + if (instance == null) { + instance = new ApplicationxwwwformurlencodedFloat(); + } + return instance; + } + + @Override + public Number validate(Number arg, SchemaConfiguration configuration) throws ValidationException { + Set> pathSet = new HashSet<>(); + List pathToItem = List.of("args[0"); + Number castArg = castToAllowedTypes(arg, pathToItem, pathSet); + SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().build())); + ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, new PathToSchemasMap(), new LinkedHashSet<>()); + PathToSchemasMap pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet); + return castArg; + } + 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 { + 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"); + } + @Override + public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { + 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"); + } + @Override + 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 { + 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"); + } + } + + public sealed interface ApplicationxwwwformurlencodedDoubleBoxed permits ApplicationxwwwformurlencodedDoubleBoxedNumber { + @Nullable Object getData(); + } + + public record ApplicationxwwwformurlencodedDoubleBoxedNumber(Number data) implements ApplicationxwwwformurlencodedDoubleBoxed { + @Override + public @Nullable Object getData() { + return data; + } + } + + + + public static class ApplicationxwwwformurlencodedDouble extends JsonSchema implements NumberSchemaValidator { + private static @Nullable ApplicationxwwwformurlencodedDouble instance = null; + + protected ApplicationxwwwformurlencodedDouble() { + super(new JsonSchemaInfo() + .type(Set.of( + Integer.class, + Long.class, + Float.class, + Double.class + )) + .format("double") + .maximum(123.4) + .minimum(67.8) + ); + } + + public static ApplicationxwwwformurlencodedDouble getInstance() { + if (instance == null) { + instance = new ApplicationxwwwformurlencodedDouble(); + } + return instance; + } + + @Override + public Number validate(Number arg, SchemaConfiguration configuration) throws ValidationException { + Set> pathSet = new HashSet<>(); + List pathToItem = List.of("args[0"); + Number castArg = castToAllowedTypes(arg, pathToItem, pathSet); + SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().build())); + ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, new PathToSchemasMap(), new LinkedHashSet<>()); + PathToSchemasMap pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet); + return castArg; + } + 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 { + 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"); + } + @Override + public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { + 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"); + } + @Override + 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 { + 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"); + } + } + + public sealed interface ApplicationxwwwformurlencodedStringBoxed permits ApplicationxwwwformurlencodedStringBoxedString { + @Nullable Object getData(); + } + + public record ApplicationxwwwformurlencodedStringBoxedString(String data) implements ApplicationxwwwformurlencodedStringBoxed { + @Override + public @Nullable Object getData() { + return data; + } + } + + + + public static class ApplicationxwwwformurlencodedString extends JsonSchema implements StringSchemaValidator { + private static @Nullable ApplicationxwwwformurlencodedString instance = null; + + protected ApplicationxwwwformurlencodedString() { + super(new JsonSchemaInfo() + .type(Set.of( + String.class + )) + .pattern(Pattern.compile( + "[a-z]", + Pattern.CASE_INSENSITIVE + )) + ); + } + + public static ApplicationxwwwformurlencodedString getInstance() { + if (instance == null) { + instance = new ApplicationxwwwformurlencodedString(); + } + return instance; + } + + @Override + public String validate(String arg, SchemaConfiguration configuration) throws ValidationException { + Set> pathSet = new HashSet<>(); + List pathToItem = List.of("args[0"); + String castArg = castToAllowedTypes(arg, pathToItem, pathSet); + SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().build())); + ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, new PathToSchemasMap(), new LinkedHashSet<>()); + getPathToSchemas(this, castArg, validationMetadata, pathSet); + return castArg; + } + + @Override + public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws 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"); + } + @Override + public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { + 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"); + } + @Override + 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 { + 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"); + } + } + + public sealed interface ApplicationxwwwformurlencodedPatternWithoutDelimiterBoxed permits ApplicationxwwwformurlencodedPatternWithoutDelimiterBoxedString { + @Nullable Object getData(); + } + + public record ApplicationxwwwformurlencodedPatternWithoutDelimiterBoxedString(String data) implements ApplicationxwwwformurlencodedPatternWithoutDelimiterBoxed { + @Override + public @Nullable Object getData() { + return data; + } + } + + + + public static class ApplicationxwwwformurlencodedPatternWithoutDelimiter extends JsonSchema implements StringSchemaValidator { + private static @Nullable ApplicationxwwwformurlencodedPatternWithoutDelimiter instance = null; + + protected ApplicationxwwwformurlencodedPatternWithoutDelimiter() { + super(new JsonSchemaInfo() + .type(Set.of( + String.class + )) + .pattern(Pattern.compile( + "^[A-Z].*" + )) + ); + } + + public static ApplicationxwwwformurlencodedPatternWithoutDelimiter getInstance() { + if (instance == null) { + instance = new ApplicationxwwwformurlencodedPatternWithoutDelimiter(); + } + return instance; + } + + @Override + public String validate(String arg, SchemaConfiguration configuration) throws ValidationException { + Set> pathSet = new HashSet<>(); + List pathToItem = List.of("args[0"); + String castArg = castToAllowedTypes(arg, pathToItem, pathSet); + SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().build())); + ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, new PathToSchemasMap(), new LinkedHashSet<>()); + getPathToSchemas(this, castArg, validationMetadata, pathSet); + return castArg; + } + + @Override + public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws 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"); + } + @Override + public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { + 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"); + } + @Override + 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 { + 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"); + } + } + + public static class ApplicationxwwwformurlencodedByte extends StringJsonSchema.StringJsonSchema1 { + private static @Nullable ApplicationxwwwformurlencodedByte instance = null; + public static ApplicationxwwwformurlencodedByte getInstance() { + if (instance == null) { + instance = new ApplicationxwwwformurlencodedByte(); + } + return instance; + } + } + + + public static class ApplicationxwwwformurlencodedBinary extends StringJsonSchema.StringJsonSchema1 { + // BinarySchema + private static @Nullable ApplicationxwwwformurlencodedBinary instance = null; + public static ApplicationxwwwformurlencodedBinary getInstance() { + if (instance == null) { + instance = new ApplicationxwwwformurlencodedBinary(); + } + return instance; + } + } + + + public static class ApplicationxwwwformurlencodedDate extends DateJsonSchema.DateJsonSchema1 { + private static @Nullable ApplicationxwwwformurlencodedDate instance = null; + public static ApplicationxwwwformurlencodedDate getInstance() { + if (instance == null) { + instance = new ApplicationxwwwformurlencodedDate(); + } + return instance; + } + } + + + public sealed interface ApplicationxwwwformurlencodedDateTimeBoxed permits ApplicationxwwwformurlencodedDateTimeBoxedString { + @Nullable Object getData(); + } + + public record ApplicationxwwwformurlencodedDateTimeBoxedString(String data) implements ApplicationxwwwformurlencodedDateTimeBoxed { + @Override + public @Nullable Object getData() { + return data; + } + } + + + + public static class ApplicationxwwwformurlencodedDateTime extends JsonSchema implements StringSchemaValidator, DefaultValueMethod { + private static @Nullable ApplicationxwwwformurlencodedDateTime instance = null; + + protected ApplicationxwwwformurlencodedDateTime() { + super(new JsonSchemaInfo() + .type(Set.of( + String.class + )) + .format("date-time") + .defaultValue("2010-02-01T10:20:10.111110+01:00") + ); + } + + public static ApplicationxwwwformurlencodedDateTime getInstance() { + if (instance == null) { + instance = new ApplicationxwwwformurlencodedDateTime(); + } + return instance; + } + + @Override + public String validate(String arg, SchemaConfiguration configuration) throws ValidationException { + Set> pathSet = new HashSet<>(); + List pathToItem = List.of("args[0"); + String castArg = castToAllowedTypes(arg, pathToItem, pathSet); + SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().build())); + ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, new PathToSchemasMap(), new LinkedHashSet<>()); + getPathToSchemas(this, castArg, validationMetadata, pathSet); + return castArg; + } + + @Override + public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws 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"); + } + @Override + public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { + 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"); + } + public String defaultValue() throws ValidationException { + if (defaultValue instanceof String) { + return (String) defaultValue; + } + throw new ValidationException("Invalid type stored in defaultValue"); + } + @Override + 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 { + 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"); + } + } + + public sealed interface ApplicationxwwwformurlencodedPasswordBoxed permits ApplicationxwwwformurlencodedPasswordBoxedString { + @Nullable Object getData(); + } + + public record ApplicationxwwwformurlencodedPasswordBoxedString(String data) implements ApplicationxwwwformurlencodedPasswordBoxed { + @Override + public @Nullable Object getData() { + return data; + } + } + + + + public static class ApplicationxwwwformurlencodedPassword extends JsonSchema implements StringSchemaValidator { + private static @Nullable ApplicationxwwwformurlencodedPassword instance = null; + + protected ApplicationxwwwformurlencodedPassword() { + super(new JsonSchemaInfo() + .type(Set.of( + String.class + )) + .format("password") + .maxLength(64) + .minLength(10) + ); + } + + public static ApplicationxwwwformurlencodedPassword getInstance() { + if (instance == null) { + instance = new ApplicationxwwwformurlencodedPassword(); + } + return instance; + } + + @Override + public String validate(String arg, SchemaConfiguration configuration) throws ValidationException { + Set> pathSet = new HashSet<>(); + List pathToItem = List.of("args[0"); + String castArg = castToAllowedTypes(arg, pathToItem, pathSet); + SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().build())); + ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, new PathToSchemasMap(), new LinkedHashSet<>()); + getPathToSchemas(this, castArg, validationMetadata, pathSet); + return castArg; + } + + @Override + public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws 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"); + } + @Override + public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { + 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"); + } + @Override + 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 { + 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"); + } + } + + public static class ApplicationxwwwformurlencodedCallback extends StringJsonSchema.StringJsonSchema1 { + private static @Nullable ApplicationxwwwformurlencodedCallback instance = null; + public static ApplicationxwwwformurlencodedCallback getInstance() { + if (instance == null) { + instance = new ApplicationxwwwformurlencodedCallback(); + } + return instance; + } + } + + + public static class ApplicationxwwwformurlencodedSchemaMap extends FrozenMap<@Nullable Object> { + protected ApplicationxwwwformurlencodedSchemaMap(FrozenMap<@Nullable Object> m) { + super(m); + } + public static final Set requiredKeys = Set.of( + "byte", + "double", + "number", + "pattern_without_delimiter" + ); + public static final Set optionalKeys = Set.of( + "integer", + "int32", + "int64", + "float", + "string", + "binary", + "date", + "dateTime", + "password", + "callback" + ); + public static ApplicationxwwwformurlencodedSchemaMap of(Map arg, SchemaConfiguration configuration) throws ValidationException { + return ApplicationxwwwformurlencodedSchema1.getInstance().validate(arg, configuration); + } + + public String pattern_without_delimiter() { + @Nullable Object value = get("pattern_without_delimiter"); + if (!(value instanceof String)) { + throw new RuntimeException("Invalid value stored for pattern_without_delimiter"); + } + return (String) value; + } + + public Number int32() throws UnsetPropertyException { + String key = "int32"; + throwIfKeyNotPresent(key); + @Nullable Object value = get(key); + if (!(value instanceof Number)) { + throw new RuntimeException("Invalid value stored for int32"); + } + return (Number) value; + } + + public Number int64() throws UnsetPropertyException { + String key = "int64"; + throwIfKeyNotPresent(key); + @Nullable Object value = get(key); + if (!(value instanceof Number)) { + throw new RuntimeException("Invalid value stored for int64"); + } + return (Number) value; + } + + public String binary() throws UnsetPropertyException { + String key = "binary"; + throwIfKeyNotPresent(key); + @Nullable Object value = get(key); + if (!(value instanceof String)) { + throw new RuntimeException("Invalid value stored for binary"); + } + return (String) value; + } + + public String date() throws UnsetPropertyException { + String key = "date"; + throwIfKeyNotPresent(key); + @Nullable Object value = get(key); + if (!(value instanceof String)) { + throw new RuntimeException("Invalid value stored for date"); + } + return (String) value; + } + + public String dateTime() throws UnsetPropertyException { + String key = "dateTime"; + throwIfKeyNotPresent(key); + @Nullable Object value = get(key); + if (!(value instanceof String)) { + throw new RuntimeException("Invalid value stored for dateTime"); + } + return (String) value; + } + + public String password() throws UnsetPropertyException { + String key = "password"; + throwIfKeyNotPresent(key); + @Nullable Object value = get(key); + if (!(value instanceof String)) { + throw new RuntimeException("Invalid value stored for password"); + } + return (String) value; + } + + public String callback() throws UnsetPropertyException { + String key = "callback"; + throwIfKeyNotPresent(key); + @Nullable Object value = get(key); + if (!(value instanceof String)) { + throw new RuntimeException("Invalid value stored for callback"); + } + return (String) value; + } + + public @Nullable Object getAdditionalProperty(String name) throws UnsetPropertyException, InvalidAdditionalPropertyException { + throwIfKeyKnown(name, requiredKeys, optionalKeys); + throwIfKeyNotPresent(name); + return get(name); + } + } + + public interface SetterForApplicationxwwwformurlencodedByte { + Map getInstance(); + T getBuilderAfterApplicationxwwwformurlencodedByte(Map instance); + + default T setByte(String value) { + var instance = getInstance(); + instance.put("byte", value); + return getBuilderAfterApplicationxwwwformurlencodedByte(instance); + } + } + + public interface SetterForApplicationxwwwformurlencodedDouble { + Map getInstance(); + T getBuilderAfterApplicationxwwwformurlencodedDouble(Map instance); + + default T setDouble(int value) { + var instance = getInstance(); + instance.put("double", value); + return getBuilderAfterApplicationxwwwformurlencodedDouble(instance); + } + + default T setDouble(float value) { + var instance = getInstance(); + instance.put("double", value); + return getBuilderAfterApplicationxwwwformurlencodedDouble(instance); + } + + default T setDouble(long value) { + var instance = getInstance(); + instance.put("double", value); + return getBuilderAfterApplicationxwwwformurlencodedDouble(instance); + } + + default T setDouble(double value) { + var instance = getInstance(); + instance.put("double", value); + return getBuilderAfterApplicationxwwwformurlencodedDouble(instance); + } + } + + public interface SetterForApplicationxwwwformurlencodedNumber { + Map getInstance(); + T getBuilderAfterApplicationxwwwformurlencodedNumber(Map instance); + + default T setNumber(int value) { + var instance = getInstance(); + instance.put("number", value); + return getBuilderAfterApplicationxwwwformurlencodedNumber(instance); + } + + default T setNumber(float value) { + var instance = getInstance(); + instance.put("number", value); + return getBuilderAfterApplicationxwwwformurlencodedNumber(instance); + } + + default T setNumber(long value) { + var instance = getInstance(); + instance.put("number", value); + return getBuilderAfterApplicationxwwwformurlencodedNumber(instance); + } + + default T setNumber(double value) { + var instance = getInstance(); + instance.put("number", value); + return getBuilderAfterApplicationxwwwformurlencodedNumber(instance); + } + } + + public interface SetterForApplicationxwwwformurlencodedPatternWithoutDelimiter { + Map getInstance(); + T getBuilderAfterApplicationxwwwformurlencodedPatternWithoutDelimiter(Map instance); + + default T pattern_without_delimiter(String value) { + var instance = getInstance(); + instance.put("pattern_without_delimiter", value); + return getBuilderAfterApplicationxwwwformurlencodedPatternWithoutDelimiter(instance); + } + } + + public interface SetterForApplicationxwwwformurlencodedInteger { + Map getInstance(); + T getBuilderAfterApplicationxwwwformurlencodedInteger(Map instance); + + default T setInteger(int value) { + var instance = getInstance(); + instance.put("integer", value); + return getBuilderAfterApplicationxwwwformurlencodedInteger(instance); + } + + default T setInteger(float value) { + var instance = getInstance(); + instance.put("integer", value); + return getBuilderAfterApplicationxwwwformurlencodedInteger(instance); + } + + default T setInteger(long value) { + var instance = getInstance(); + instance.put("integer", value); + return getBuilderAfterApplicationxwwwformurlencodedInteger(instance); + } + + default T setInteger(double value) { + var instance = getInstance(); + instance.put("integer", value); + return getBuilderAfterApplicationxwwwformurlencodedInteger(instance); + } + } + + public interface SetterForApplicationxwwwformurlencodedInt32 { + Map getInstance(); + T getBuilderAfterApplicationxwwwformurlencodedInt32(Map instance); + + default T int32(int value) { + var instance = getInstance(); + instance.put("int32", value); + return getBuilderAfterApplicationxwwwformurlencodedInt32(instance); + } + + default T int32(float value) { + var instance = getInstance(); + instance.put("int32", value); + return getBuilderAfterApplicationxwwwformurlencodedInt32(instance); + } + } + + public interface SetterForApplicationxwwwformurlencodedInt64 { + Map getInstance(); + T getBuilderAfterApplicationxwwwformurlencodedInt64(Map instance); + + default T int64(int value) { + var instance = getInstance(); + instance.put("int64", value); + return getBuilderAfterApplicationxwwwformurlencodedInt64(instance); + } + + default T int64(float value) { + var instance = getInstance(); + instance.put("int64", value); + return getBuilderAfterApplicationxwwwformurlencodedInt64(instance); + } + + default T int64(long value) { + var instance = getInstance(); + instance.put("int64", value); + return getBuilderAfterApplicationxwwwformurlencodedInt64(instance); + } + + default T int64(double value) { + var instance = getInstance(); + instance.put("int64", value); + return getBuilderAfterApplicationxwwwformurlencodedInt64(instance); + } + } + + public interface SetterForApplicationxwwwformurlencodedFloat { + Map getInstance(); + T getBuilderAfterApplicationxwwwformurlencodedFloat(Map instance); + + default T setFloat(int value) { + var instance = getInstance(); + instance.put("float", value); + return getBuilderAfterApplicationxwwwformurlencodedFloat(instance); + } + + default T setFloat(float value) { + var instance = getInstance(); + instance.put("float", value); + return getBuilderAfterApplicationxwwwformurlencodedFloat(instance); + } + + default T setFloat(long value) { + var instance = getInstance(); + instance.put("float", value); + return getBuilderAfterApplicationxwwwformurlencodedFloat(instance); + } + + default T setFloat(double value) { + var instance = getInstance(); + instance.put("float", value); + return getBuilderAfterApplicationxwwwformurlencodedFloat(instance); + } + } + + public interface SetterForApplicationxwwwformurlencodedString { + Map getInstance(); + T getBuilderAfterApplicationxwwwformurlencodedString(Map instance); + + default T setString(String value) { + var instance = getInstance(); + instance.put("string", value); + return getBuilderAfterApplicationxwwwformurlencodedString(instance); + } + } + + public interface SetterForApplicationxwwwformurlencodedBinary { + Map getInstance(); + T getBuilderAfterApplicationxwwwformurlencodedBinary(Map instance); + + default T binary(String value) { + var instance = getInstance(); + instance.put("binary", value); + return getBuilderAfterApplicationxwwwformurlencodedBinary(instance); + } + } + + public interface SetterForApplicationxwwwformurlencodedDate { + Map getInstance(); + T getBuilderAfterApplicationxwwwformurlencodedDate(Map instance); + + default T date(String value) { + var instance = getInstance(); + instance.put("date", value); + return getBuilderAfterApplicationxwwwformurlencodedDate(instance); + } + } + + public interface SetterForApplicationxwwwformurlencodedDateTime { + Map getInstance(); + T getBuilderAfterApplicationxwwwformurlencodedDateTime(Map instance); + + default T dateTime(String value) { + var instance = getInstance(); + instance.put("dateTime", value); + return getBuilderAfterApplicationxwwwformurlencodedDateTime(instance); + } + } + + public interface SetterForApplicationxwwwformurlencodedPassword { + Map getInstance(); + T getBuilderAfterApplicationxwwwformurlencodedPassword(Map instance); + + default T password(String value) { + var instance = getInstance(); + instance.put("password", value); + return getBuilderAfterApplicationxwwwformurlencodedPassword(instance); + } + } + + public interface SetterForApplicationxwwwformurlencodedCallback { + Map getInstance(); + T getBuilderAfterApplicationxwwwformurlencodedCallback(Map instance); + + default T callback(String value) { + var instance = getInstance(); + instance.put("callback", value); + return getBuilderAfterApplicationxwwwformurlencodedCallback(instance); + } + } + + public static class ApplicationxwwwformurlencodedSchemaMap0000Builder extends UnsetAddPropsSetter implements GenericBuilder>, SetterForApplicationxwwwformurlencodedInteger, SetterForApplicationxwwwformurlencodedInt32, SetterForApplicationxwwwformurlencodedInt64, SetterForApplicationxwwwformurlencodedFloat, SetterForApplicationxwwwformurlencodedString, SetterForApplicationxwwwformurlencodedBinary, SetterForApplicationxwwwformurlencodedDate, SetterForApplicationxwwwformurlencodedDateTime, SetterForApplicationxwwwformurlencodedPassword, SetterForApplicationxwwwformurlencodedCallback { + private final Map instance; + private static final Set knownKeys = Set.of( + "byte", + "double", + "number", + "pattern_without_delimiter", + "integer", + "int32", + "int64", + "float", + "string", + "binary", + "date", + "dateTime", + "password", + "callback" + ); + public Set getKnownKeys() { + return knownKeys; + } + public ApplicationxwwwformurlencodedSchemaMap0000Builder(Map instance) { + this.instance = instance; + } + public Map build() { + return instance; + } + public Map getInstance() { + return instance; + } + public ApplicationxwwwformurlencodedSchemaMap0000Builder getBuilderAfterApplicationxwwwformurlencodedInteger(Map instance) { + return this; + } + public ApplicationxwwwformurlencodedSchemaMap0000Builder getBuilderAfterApplicationxwwwformurlencodedInt32(Map instance) { + return this; + } + public ApplicationxwwwformurlencodedSchemaMap0000Builder getBuilderAfterApplicationxwwwformurlencodedInt64(Map instance) { + return this; + } + public ApplicationxwwwformurlencodedSchemaMap0000Builder getBuilderAfterApplicationxwwwformurlencodedFloat(Map instance) { + return this; + } + public ApplicationxwwwformurlencodedSchemaMap0000Builder getBuilderAfterApplicationxwwwformurlencodedString(Map instance) { + return this; + } + public ApplicationxwwwformurlencodedSchemaMap0000Builder getBuilderAfterApplicationxwwwformurlencodedBinary(Map instance) { + return this; + } + public ApplicationxwwwformurlencodedSchemaMap0000Builder getBuilderAfterApplicationxwwwformurlencodedDate(Map instance) { + return this; + } + public ApplicationxwwwformurlencodedSchemaMap0000Builder getBuilderAfterApplicationxwwwformurlencodedDateTime(Map instance) { + return this; + } + public ApplicationxwwwformurlencodedSchemaMap0000Builder getBuilderAfterApplicationxwwwformurlencodedPassword(Map instance) { + return this; + } + public ApplicationxwwwformurlencodedSchemaMap0000Builder getBuilderAfterApplicationxwwwformurlencodedCallback(Map instance) { + return this; + } + public ApplicationxwwwformurlencodedSchemaMap0000Builder getBuilderAfterAdditionalProperty(Map instance) { + return this; + } + } + + public static class ApplicationxwwwformurlencodedSchemaMap0001Builder implements SetterForApplicationxwwwformurlencodedPatternWithoutDelimiter { + private final Map instance; + public ApplicationxwwwformurlencodedSchemaMap0001Builder(Map instance) { + this.instance = instance; + } + public Map getInstance() { + return instance; + } + public ApplicationxwwwformurlencodedSchemaMap0000Builder getBuilderAfterApplicationxwwwformurlencodedPatternWithoutDelimiter(Map instance) { + return new ApplicationxwwwformurlencodedSchemaMap0000Builder(instance); + } + } + + public static class ApplicationxwwwformurlencodedSchemaMap0010Builder implements SetterForApplicationxwwwformurlencodedNumber { + private final Map instance; + public ApplicationxwwwformurlencodedSchemaMap0010Builder(Map instance) { + this.instance = instance; + } + public Map getInstance() { + return instance; + } + public ApplicationxwwwformurlencodedSchemaMap0000Builder getBuilderAfterApplicationxwwwformurlencodedNumber(Map instance) { + return new ApplicationxwwwformurlencodedSchemaMap0000Builder(instance); + } + } + + public static class ApplicationxwwwformurlencodedSchemaMap0011Builder implements SetterForApplicationxwwwformurlencodedNumber, SetterForApplicationxwwwformurlencodedPatternWithoutDelimiter { + private final Map instance; + public ApplicationxwwwformurlencodedSchemaMap0011Builder(Map instance) { + this.instance = instance; + } + public Map getInstance() { + return instance; + } + public ApplicationxwwwformurlencodedSchemaMap0001Builder getBuilderAfterApplicationxwwwformurlencodedNumber(Map instance) { + return new ApplicationxwwwformurlencodedSchemaMap0001Builder(instance); + } + public ApplicationxwwwformurlencodedSchemaMap0010Builder getBuilderAfterApplicationxwwwformurlencodedPatternWithoutDelimiter(Map instance) { + return new ApplicationxwwwformurlencodedSchemaMap0010Builder(instance); + } + } + + public static class ApplicationxwwwformurlencodedSchemaMap0100Builder implements SetterForApplicationxwwwformurlencodedDouble { + private final Map instance; + public ApplicationxwwwformurlencodedSchemaMap0100Builder(Map instance) { + this.instance = instance; + } + public Map getInstance() { + return instance; + } + public ApplicationxwwwformurlencodedSchemaMap0000Builder getBuilderAfterApplicationxwwwformurlencodedDouble(Map instance) { + return new ApplicationxwwwformurlencodedSchemaMap0000Builder(instance); + } + } + + public static class ApplicationxwwwformurlencodedSchemaMap0101Builder implements SetterForApplicationxwwwformurlencodedDouble, SetterForApplicationxwwwformurlencodedPatternWithoutDelimiter { + private final Map instance; + public ApplicationxwwwformurlencodedSchemaMap0101Builder(Map instance) { + this.instance = instance; + } + public Map getInstance() { + return instance; + } + public ApplicationxwwwformurlencodedSchemaMap0001Builder getBuilderAfterApplicationxwwwformurlencodedDouble(Map instance) { + return new ApplicationxwwwformurlencodedSchemaMap0001Builder(instance); + } + public ApplicationxwwwformurlencodedSchemaMap0100Builder getBuilderAfterApplicationxwwwformurlencodedPatternWithoutDelimiter(Map instance) { + return new ApplicationxwwwformurlencodedSchemaMap0100Builder(instance); + } + } + + public static class ApplicationxwwwformurlencodedSchemaMap0110Builder implements SetterForApplicationxwwwformurlencodedDouble, SetterForApplicationxwwwformurlencodedNumber { + private final Map instance; + public ApplicationxwwwformurlencodedSchemaMap0110Builder(Map instance) { + this.instance = instance; + } + public Map getInstance() { + return instance; + } + public ApplicationxwwwformurlencodedSchemaMap0010Builder getBuilderAfterApplicationxwwwformurlencodedDouble(Map instance) { + return new ApplicationxwwwformurlencodedSchemaMap0010Builder(instance); + } + public ApplicationxwwwformurlencodedSchemaMap0100Builder getBuilderAfterApplicationxwwwformurlencodedNumber(Map instance) { + return new ApplicationxwwwformurlencodedSchemaMap0100Builder(instance); + } + } + + public static class ApplicationxwwwformurlencodedSchemaMap0111Builder implements SetterForApplicationxwwwformurlencodedDouble, SetterForApplicationxwwwformurlencodedNumber, SetterForApplicationxwwwformurlencodedPatternWithoutDelimiter { + private final Map instance; + public ApplicationxwwwformurlencodedSchemaMap0111Builder(Map instance) { + this.instance = instance; + } + public Map getInstance() { + return instance; + } + public ApplicationxwwwformurlencodedSchemaMap0011Builder getBuilderAfterApplicationxwwwformurlencodedDouble(Map instance) { + return new ApplicationxwwwformurlencodedSchemaMap0011Builder(instance); + } + public ApplicationxwwwformurlencodedSchemaMap0101Builder getBuilderAfterApplicationxwwwformurlencodedNumber(Map instance) { + return new ApplicationxwwwformurlencodedSchemaMap0101Builder(instance); + } + public ApplicationxwwwformurlencodedSchemaMap0110Builder getBuilderAfterApplicationxwwwformurlencodedPatternWithoutDelimiter(Map instance) { + return new ApplicationxwwwformurlencodedSchemaMap0110Builder(instance); + } + } + + public static class ApplicationxwwwformurlencodedSchemaMap1000Builder implements SetterForApplicationxwwwformurlencodedByte { + private final Map instance; + public ApplicationxwwwformurlencodedSchemaMap1000Builder(Map instance) { + this.instance = instance; + } + public Map getInstance() { + return instance; + } + public ApplicationxwwwformurlencodedSchemaMap0000Builder getBuilderAfterApplicationxwwwformurlencodedByte(Map instance) { + return new ApplicationxwwwformurlencodedSchemaMap0000Builder(instance); + } + } + + public static class ApplicationxwwwformurlencodedSchemaMap1001Builder implements SetterForApplicationxwwwformurlencodedByte, SetterForApplicationxwwwformurlencodedPatternWithoutDelimiter { + private final Map instance; + public ApplicationxwwwformurlencodedSchemaMap1001Builder(Map instance) { + this.instance = instance; + } + public Map getInstance() { + return instance; + } + public ApplicationxwwwformurlencodedSchemaMap0001Builder getBuilderAfterApplicationxwwwformurlencodedByte(Map instance) { + return new ApplicationxwwwformurlencodedSchemaMap0001Builder(instance); + } + public ApplicationxwwwformurlencodedSchemaMap1000Builder getBuilderAfterApplicationxwwwformurlencodedPatternWithoutDelimiter(Map instance) { + return new ApplicationxwwwformurlencodedSchemaMap1000Builder(instance); + } + } + + public static class ApplicationxwwwformurlencodedSchemaMap1010Builder implements SetterForApplicationxwwwformurlencodedByte, SetterForApplicationxwwwformurlencodedNumber { + private final Map instance; + public ApplicationxwwwformurlencodedSchemaMap1010Builder(Map instance) { + this.instance = instance; + } + public Map getInstance() { + return instance; + } + public ApplicationxwwwformurlencodedSchemaMap0010Builder getBuilderAfterApplicationxwwwformurlencodedByte(Map instance) { + return new ApplicationxwwwformurlencodedSchemaMap0010Builder(instance); + } + public ApplicationxwwwformurlencodedSchemaMap1000Builder getBuilderAfterApplicationxwwwformurlencodedNumber(Map instance) { + return new ApplicationxwwwformurlencodedSchemaMap1000Builder(instance); + } + } + + public static class ApplicationxwwwformurlencodedSchemaMap1011Builder implements SetterForApplicationxwwwformurlencodedByte, SetterForApplicationxwwwformurlencodedNumber, SetterForApplicationxwwwformurlencodedPatternWithoutDelimiter { + private final Map instance; + public ApplicationxwwwformurlencodedSchemaMap1011Builder(Map instance) { + this.instance = instance; + } + public Map getInstance() { + return instance; + } + public ApplicationxwwwformurlencodedSchemaMap0011Builder getBuilderAfterApplicationxwwwformurlencodedByte(Map instance) { + return new ApplicationxwwwformurlencodedSchemaMap0011Builder(instance); + } + public ApplicationxwwwformurlencodedSchemaMap1001Builder getBuilderAfterApplicationxwwwformurlencodedNumber(Map instance) { + return new ApplicationxwwwformurlencodedSchemaMap1001Builder(instance); + } + public ApplicationxwwwformurlencodedSchemaMap1010Builder getBuilderAfterApplicationxwwwformurlencodedPatternWithoutDelimiter(Map instance) { + return new ApplicationxwwwformurlencodedSchemaMap1010Builder(instance); + } + } + + public static class ApplicationxwwwformurlencodedSchemaMap1100Builder implements SetterForApplicationxwwwformurlencodedByte, SetterForApplicationxwwwformurlencodedDouble { + private final Map instance; + public ApplicationxwwwformurlencodedSchemaMap1100Builder(Map instance) { + this.instance = instance; + } + public Map getInstance() { + return instance; + } + public ApplicationxwwwformurlencodedSchemaMap0100Builder getBuilderAfterApplicationxwwwformurlencodedByte(Map instance) { + return new ApplicationxwwwformurlencodedSchemaMap0100Builder(instance); + } + public ApplicationxwwwformurlencodedSchemaMap1000Builder getBuilderAfterApplicationxwwwformurlencodedDouble(Map instance) { + return new ApplicationxwwwformurlencodedSchemaMap1000Builder(instance); + } + } + + public static class ApplicationxwwwformurlencodedSchemaMap1101Builder implements SetterForApplicationxwwwformurlencodedByte, SetterForApplicationxwwwformurlencodedDouble, SetterForApplicationxwwwformurlencodedPatternWithoutDelimiter { + private final Map instance; + public ApplicationxwwwformurlencodedSchemaMap1101Builder(Map instance) { + this.instance = instance; + } + public Map getInstance() { + return instance; + } + public ApplicationxwwwformurlencodedSchemaMap0101Builder getBuilderAfterApplicationxwwwformurlencodedByte(Map instance) { + return new ApplicationxwwwformurlencodedSchemaMap0101Builder(instance); + } + public ApplicationxwwwformurlencodedSchemaMap1001Builder getBuilderAfterApplicationxwwwformurlencodedDouble(Map instance) { + return new ApplicationxwwwformurlencodedSchemaMap1001Builder(instance); + } + public ApplicationxwwwformurlencodedSchemaMap1100Builder getBuilderAfterApplicationxwwwformurlencodedPatternWithoutDelimiter(Map instance) { + return new ApplicationxwwwformurlencodedSchemaMap1100Builder(instance); + } + } + + public static class ApplicationxwwwformurlencodedSchemaMap1110Builder implements SetterForApplicationxwwwformurlencodedByte, SetterForApplicationxwwwformurlencodedDouble, SetterForApplicationxwwwformurlencodedNumber { + private final Map instance; + public ApplicationxwwwformurlencodedSchemaMap1110Builder(Map instance) { + this.instance = instance; + } + public Map getInstance() { + return instance; + } + public ApplicationxwwwformurlencodedSchemaMap0110Builder getBuilderAfterApplicationxwwwformurlencodedByte(Map instance) { + return new ApplicationxwwwformurlencodedSchemaMap0110Builder(instance); + } + public ApplicationxwwwformurlencodedSchemaMap1010Builder getBuilderAfterApplicationxwwwformurlencodedDouble(Map instance) { + return new ApplicationxwwwformurlencodedSchemaMap1010Builder(instance); + } + public ApplicationxwwwformurlencodedSchemaMap1100Builder getBuilderAfterApplicationxwwwformurlencodedNumber(Map instance) { + return new ApplicationxwwwformurlencodedSchemaMap1100Builder(instance); + } + } + + public static class ApplicationxwwwformurlencodedSchemaMapBuilder implements SetterForApplicationxwwwformurlencodedByte, SetterForApplicationxwwwformurlencodedDouble, SetterForApplicationxwwwformurlencodedNumber, SetterForApplicationxwwwformurlencodedPatternWithoutDelimiter { + private final Map instance; + public ApplicationxwwwformurlencodedSchemaMapBuilder() { + this.instance = new LinkedHashMap<>(); + } + public Map getInstance() { + return instance; + } + public ApplicationxwwwformurlencodedSchemaMap0111Builder getBuilderAfterApplicationxwwwformurlencodedByte(Map instance) { + return new ApplicationxwwwformurlencodedSchemaMap0111Builder(instance); + } + public ApplicationxwwwformurlencodedSchemaMap1011Builder getBuilderAfterApplicationxwwwformurlencodedDouble(Map instance) { + return new ApplicationxwwwformurlencodedSchemaMap1011Builder(instance); + } + public ApplicationxwwwformurlencodedSchemaMap1101Builder getBuilderAfterApplicationxwwwformurlencodedNumber(Map instance) { + return new ApplicationxwwwformurlencodedSchemaMap1101Builder(instance); + } + public ApplicationxwwwformurlencodedSchemaMap1110Builder getBuilderAfterApplicationxwwwformurlencodedPatternWithoutDelimiter(Map instance) { + return new ApplicationxwwwformurlencodedSchemaMap1110Builder(instance); + } + } + + + public sealed interface ApplicationxwwwformurlencodedSchema1Boxed permits ApplicationxwwwformurlencodedSchema1BoxedMap { + @Nullable Object getData(); + } + + public record ApplicationxwwwformurlencodedSchema1BoxedMap(ApplicationxwwwformurlencodedSchemaMap data) implements ApplicationxwwwformurlencodedSchema1Boxed { + @Override + public @Nullable Object getData() { + return data; + } + } + + + public static class ApplicationxwwwformurlencodedSchema1 extends JsonSchema implements MapSchemaValidator { + private static @Nullable ApplicationxwwwformurlencodedSchema1 instance = null; + + protected ApplicationxwwwformurlencodedSchema1() { + super(new JsonSchemaInfo() + .type(Set.of(Map.class)) + .properties(Map.ofEntries( + new PropertyEntry("integer", ApplicationxwwwformurlencodedInteger.class), + new PropertyEntry("int32", ApplicationxwwwformurlencodedInt32.class), + new PropertyEntry("int64", ApplicationxwwwformurlencodedInt64.class), + new PropertyEntry("number", ApplicationxwwwformurlencodedNumber.class), + new PropertyEntry("float", ApplicationxwwwformurlencodedFloat.class), + new PropertyEntry("double", ApplicationxwwwformurlencodedDouble.class), + new PropertyEntry("string", ApplicationxwwwformurlencodedString.class), + new PropertyEntry("pattern_without_delimiter", ApplicationxwwwformurlencodedPatternWithoutDelimiter.class), + new PropertyEntry("byte", ApplicationxwwwformurlencodedByte.class), + new PropertyEntry("binary", ApplicationxwwwformurlencodedBinary.class), + new PropertyEntry("date", ApplicationxwwwformurlencodedDate.class), + new PropertyEntry("dateTime", ApplicationxwwwformurlencodedDateTime.class), + new PropertyEntry("password", ApplicationxwwwformurlencodedPassword.class), + new PropertyEntry("callback", ApplicationxwwwformurlencodedCallback.class) + )) + .required(Set.of( + "byte", + "double", + "number", + "pattern_without_delimiter" + )) + ); + } + + public static ApplicationxwwwformurlencodedSchema1 getInstance() { + if (instance == null) { + instance = new ApplicationxwwwformurlencodedSchema1(); + } + return instance; + } + + 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 RuntimeException("Invalid non-string key value"); + } + String propertyName = (String) entryKey; + List propertyPathToItem = new ArrayList<>(pathToItem); + propertyPathToItem.add(propertyName); + Object value = entry.getValue(); + LinkedHashMap, Nothing?> schemas = pathToSchemas.get(propertyPathToItem); + if (schemas == null) { + throw new RuntimeException("Validation result is invalid, schemas must exist for a pathToItem"); + } + JsonSchema propertySchema = schemas.entrySet().iterator().next().getKey(); + @Nullable Object propertyInstance = propertySchema.getNewInstance(value, propertyPathToItem, pathToSchemas); + properties.put(propertyName, propertyInstance); + } + FrozenMap<@Nullable Object> castProperties = new FrozenMap<>(properties); + return new ApplicationxwwwformurlencodedSchemaMap(castProperties); + } + + 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); + SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().build())); + ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, new PathToSchemasMap(), new LinkedHashSet<>()); + PathToSchemasMap pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet); + return getNewInstance(castArg, validationMetadata.pathToItem(), pathToSchemasMap); + } + + + @Override + public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws 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"); + } + @Override + public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { + if (arg instanceof Map) { + return getNewInstance((Map) arg, pathToItem, pathToSchemas); + } + 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 { + return new ApplicationxwwwformurlencodedSchema1BoxedMap(validate(arg, configuration)); + } + @Override + public ApplicationxwwwformurlencodedSchema1Boxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { + 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"); + } + } + +} diff --git a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/fake/post/responses/FakePostCode200Response.kt b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/fake/post/responses/FakePostCode200Response.kt new file mode 100644 index 00000000000..1806211707c --- /dev/null +++ b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/fake/post/responses/FakePostCode200Response.kt @@ -0,0 +1,7 @@ +package org.openapijsonschematools.client.paths.fake.post.responses; + +import org.openapijsonschematools.client.components.responses.SuccessDescriptionOnly; + +public class FakePostCode200Response extends SuccessDescriptionOnly { + public static class FakePostCode200Response1 extends SuccessDescriptionOnly1 {} +} diff --git a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/fake/post/responses/FakePostCode404Response.kt b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/fake/post/responses/FakePostCode404Response.kt new file mode 100644 index 00000000000..77b0cb64b02 --- /dev/null +++ b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/fake/post/responses/FakePostCode404Response.kt @@ -0,0 +1,45 @@ +package org.openapijsonschematools.client.paths.fake.post.responses; + +import org.openapijsonschematools.client.configurations.SchemaConfiguration; +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; +import java.net.http.HttpResponse; +import java.net.http.HttpHeaders; + +public class FakePostCode404Response { + + public static class FakePostCode404Response1 extends ResponseDeserializer { + public FakePostCode404Response1() { + super( + MapUtils.makeMap( + ) + ); + } + + @Override + protected Nothing? getBody(String contentType, Nothing? mediaType, byte[] body, SchemaConfiguration configuration) { + return null; + } + + @Override + protected Nothing? getHeaders(HttpHeaders headers, SchemaConfiguration configuration) { + return null; + } + } + + @SuppressWarnings("serial") + public static class ResponseApiException extends ApiException { + public DeserializedHttpResponse deserializedResponse; + + public ResponseApiException(String s, HttpResponse response, DeserializedHttpResponse deserializedResponse) { + super(s, response); + this.deserializedResponse = deserializedResponse; + } + } +} diff --git a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/fake/post/security/FakePostSecurityRequirementObject0.kt b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/fake/post/security/FakePostSecurityRequirementObject0.kt new file mode 100644 index 00000000000..b1305742ad4 --- /dev/null +++ b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/fake/post/security/FakePostSecurityRequirementObject0.kt @@ -0,0 +1,24 @@ +package org.openapijsonschematools.client.paths.fake.post.security; + +import org.checkerframework.checker.nullness.qual.Nullable; +import org.openapijsonschematools.client.securityrequirementobjects.SecurityRequirementObject; +import org.openapijsonschematools.client.securityschemes.SecurityScheme; +import org.openapijsonschematools.client.components.securityschemes.HttpBasicTest; + +import java.util.List; +import java.util.Map; +import java.util.AbstractMap; + +public class FakePostSecurityRequirementObject0 extends SecurityRequirementObject { + + public FakePostSecurityRequirementObject0() { + super( + Map.ofEntries( + new AbstractMap.SimpleEntry, List>( + HttpBasicTest.class, + List.of() + ) + ) + ); + } +} diff --git a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/fakeadditionalpropertieswitharrayofenums/FakeadditionalpropertieswitharrayofenumsGet.kt b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/fakeadditionalpropertieswitharrayofenums/FakeadditionalpropertieswitharrayofenumsGet.kt new file mode 100644 index 00000000000..7cf5a80ec37 --- /dev/null +++ b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/fakeadditionalpropertieswitharrayofenums/FakeadditionalpropertieswitharrayofenumsGet.kt @@ -0,0 +1,152 @@ +package org.openapijsonschematools.client.paths.fakeadditionalpropertieswitharrayofenums; + +import org.checkerframework.checker.nullness.qual.Nullable; +import org.openapijsonschematools.client.paths.fakeadditionalpropertieswitharrayofenums.get.FakeadditionalpropertieswitharrayofenumsGetRequestBody; +import org.openapijsonschematools.client.RootServerInfo; +import org.openapijsonschematools.client.paths.fakeadditionalpropertieswitharrayofenums.get.FakeadditionalpropertieswitharrayofenumsGetResponses; +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.requestbody.SerializedRequestBody; +import org.openapijsonschematools.client.paths.Fakeadditionalpropertieswitharrayofenums; + +import java.io.IOException; +import java.util.ArrayList; +import java.net.http.HttpClient; +import java.net.http.HttpRequest; +import java.time.Duration; +import java.util.List; +import java.util.Map; + +public class FakeadditionalpropertieswitharrayofenumsGet { + private static class GetProvider { + private static final String method = "get"; + + public static FakeadditionalpropertieswitharrayofenumsGetResponses.EndpointResponse get( + GetRequest request, + ApiConfiguration apiConfiguration, + SchemaConfiguration schemaConfiguration, + HttpClient client + ) throws IOException, InterruptedException, ValidationException, NotImplementedException, ApiException { + Map> headers = apiConfiguration.getDefaultHeaders(); + + @Nullable SerializedRequestBody serializedRequestBody; + HttpRequest.BodyPublisher bodyPublisher = HttpRequest.BodyPublishers.noBody(); + if (request.requestBody != null) { + serializedRequestBody = new FakeadditionalpropertieswitharrayofenumsGetRequestBody.FakeadditionalpropertieswitharrayofenumsGetRequestBody1().serialize( + request.requestBody + ); + var contentTypeHeaderValues = headers.getOrDefault("Content-Type", new ArrayList<>()); + contentTypeHeaderValues.add(serializedRequestBody.contentType); + bodyPublisher = serializedRequestBody.bodyPublisher; + } + // TODO set this to a map if there is a query security scheme + @Nullable Map queryMap = null; + String host = apiConfiguration.getServer(request.serverIndex).url(); + + String url = host + Fakeadditionalpropertieswitharrayofenums.path; + var httpRequest = RestClient.getRequest( + url, + method, + bodyPublisher, + headers, + request.timeout + ); + var response = RestClient.getResponse(httpRequest, client); + var responsesDeserializer = new FakeadditionalpropertieswitharrayofenumsGetResponses.FakeadditionalpropertieswitharrayofenumsGetResponses1(); + return responsesDeserializer.deserialize(response, schemaConfiguration); + } + } + + public interface GetOperation { + ApiConfiguration getApiConfiguration(); + SchemaConfiguration getSchemaConfiguration(); + HttpClient getClient(); + default FakeadditionalpropertieswitharrayofenumsGetResponses.EndpointResponse get(GetRequest request) throws IOException, InterruptedException, ValidationException, NotImplementedException, ApiException { + return GetProvider.get(request, getApiConfiguration(), getSchemaConfiguration(), getClient()); + } + } + + public interface AdditionalPropertiesWithArrayOfEnumsOperation { + ApiConfiguration getApiConfiguration(); + SchemaConfiguration getSchemaConfiguration(); + HttpClient getClient(); + default FakeadditionalpropertieswitharrayofenumsGetResponses.EndpointResponse additionalPropertiesWithArrayOfEnums(GetRequest request) throws IOException, InterruptedException, ValidationException, NotImplementedException, ApiException { + return GetProvider.get(request, getApiConfiguration(), getSchemaConfiguration(), getClient()); + } + } + + public static class Get extends ApiClient implements GetOperation { + public Get(ApiConfiguration apiConfiguration, SchemaConfiguration schemaConfiguration) { + super(apiConfiguration, schemaConfiguration); + } + } + + public static class GetRequest { + public FakeadditionalpropertieswitharrayofenumsGetRequestBody.@Nullable SealedRequestBody requestBody; + public RootServerInfo.@Nullable ServerIndex serverIndex; + public @Nullable Duration timeout; + } + + public interface SetterForRequestBody { + GetRequest getInstance(); + T getBuilderAfterRequestBody(GetRequest instance); + default T requestBody(FakeadditionalpropertieswitharrayofenumsGetRequestBody.SealedRequestBody requestBody) { + var instance = getInstance(); + instance.requestBody = requestBody; + return getBuilderAfterRequestBody(instance); + } + } + + public interface SetterForServerIndex { + GetRequest getInstance(); + T getBuilderAfterServerIndex(GetRequest instance); + default T serverIndex(RootServerInfo.ServerIndex serverIndex) { + var instance = getInstance(); + instance.serverIndex = serverIndex; + return getBuilderAfterServerIndex(instance); + } + } + + public interface SetterForTimeout { + GetRequest getInstance(); + T getBuilderAfterTimeout(GetRequest instance); + default T timeout(Duration timeout) { + var instance = getInstance(); + instance.timeout = timeout; + return getBuilderAfterTimeout(instance); + } + } + + public static class GetRequestBuilder implements SetterForRequestBody, SetterForServerIndex, SetterForTimeout { + private final GetRequest instance; + + public GetRequestBuilder() { + this.instance = new GetRequest(); + } + + public GetRequest build() { + return instance; + } + + public GetRequest getInstance() { + return instance; + } + + public GetRequestBuilder getBuilderAfterRequestBody(GetRequest instance) { + return this; + } + + public GetRequestBuilder getBuilderAfterServerIndex(GetRequest instance) { + return this; + } + + public GetRequestBuilder getBuilderAfterTimeout(GetRequest instance) { + return this; + } + } +} diff --git a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/fakeadditionalpropertieswitharrayofenums/get/FakeadditionalpropertieswitharrayofenumsGetRequestBody.kt b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/fakeadditionalpropertieswitharrayofenums/get/FakeadditionalpropertieswitharrayofenumsGetRequestBody.kt new file mode 100644 index 00000000000..b14c6782c60 --- /dev/null +++ b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/fakeadditionalpropertieswitharrayofenums/get/FakeadditionalpropertieswitharrayofenumsGetRequestBody.kt @@ -0,0 +1,49 @@ +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; +import org.openapijsonschematools.client.mediatype.MediaType; +import org.openapijsonschematools.client.paths.fakeadditionalpropertieswitharrayofenums.get.requestbody.content.applicationjson.ApplicationjsonSchema; + +import java.util.AbstractMap; +import java.util.Map; + +public class FakeadditionalpropertieswitharrayofenumsGetRequestBody { + public sealed interface SealedMediaType permits ApplicationjsonMediaType {} + + public record ApplicationjsonMediaType(ApplicationjsonSchema.ApplicationjsonSchema1 schema) implements SealedMediaType, MediaType { + public ApplicationjsonMediaType() { + this(ApplicationjsonSchema.ApplicationjsonSchema1.getInstance()); + } + @Override + public Nothing? encoding() { + return null; + } + } + + public static class FakeadditionalpropertieswitharrayofenumsGetRequestBody1 extends RequestBodySerializer { + public FakeadditionalpropertieswitharrayofenumsGetRequestBody1() { + super( + Map.ofEntries( + new AbstractMap.SimpleEntry<>("application/json", new ApplicationjsonMediaType()) + ), + false + ); + } + + public SerializedRequestBody serialize(SealedRequestBody requestBody) throws NotImplementedException { + ApplicationjsonRequestBody requestBody0 = (ApplicationjsonRequestBody) requestBody; + return serialize(requestBody0.contentType(), requestBody0.body().getData()); + } + } + + public sealed interface SealedRequestBody permits ApplicationjsonRequestBody {} + public record ApplicationjsonRequestBody(ApplicationjsonSchema.AdditionalPropertiesWithArrayOfEnums1Boxed body) implements SealedRequestBody, GenericRequestBody { + @Override + public String contentType() { + return "application/json"; + } + } +} diff --git a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/fakeadditionalpropertieswitharrayofenums/get/FakeadditionalpropertieswitharrayofenumsGetResponses.kt b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/fakeadditionalpropertieswitharrayofenums/get/FakeadditionalpropertieswitharrayofenumsGetResponses.kt new file mode 100644 index 00000000000..a8c311e2da9 --- /dev/null +++ b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/fakeadditionalpropertieswitharrayofenums/get/FakeadditionalpropertieswitharrayofenumsGetResponses.kt @@ -0,0 +1,53 @@ +package org.openapijsonschematools.client.paths.fakeadditionalpropertieswitharrayofenums.get; + +import org.openapijsonschematools.client.paths.fakeadditionalpropertieswitharrayofenums.get.responses.FakeadditionalpropertieswitharrayofenumsGetCode200Response; +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; +import org.checkerframework.checker.nullness.qual.Nullable; + +import java.net.http.HttpResponse; +import java.util.Map; +import java.util.AbstractMap; + +public class FakeadditionalpropertieswitharrayofenumsGetResponses { + public sealed interface EndpointResponse permits EndpointFakeadditionalpropertieswitharrayofenumsGetCode200Response {} + + public record EndpointFakeadditionalpropertieswitharrayofenumsGetCode200Response( + HttpResponse response, + FakeadditionalpropertieswitharrayofenumsGetCode200Response.SealedResponseBody body, + Nothing? headers + ) implements EndpointResponse, ApiResponse{ + } + + public sealed interface StatusCodeResponseDeserializer permits StatusFakeadditionalpropertieswitharrayofenumsGetCode200ResponseDeserializer {} + + public static final class StatusFakeadditionalpropertieswitharrayofenumsGetCode200ResponseDeserializer extends FakeadditionalpropertieswitharrayofenumsGetCode200Response.FakeadditionalpropertieswitharrayofenumsGetCode200Response1 implements StatusCodeResponseDeserializer { + } + + public static final class FakeadditionalpropertieswitharrayofenumsGetResponses1 implements ResponsesDeserializer { + private final Map statusCodeToResponseDeserializer; + public FakeadditionalpropertieswitharrayofenumsGetResponses1() { + this.statusCodeToResponseDeserializer = Map.ofEntries( + new AbstractMap.SimpleEntry<>("200", new StatusFakeadditionalpropertieswitharrayofenumsGetCode200ResponseDeserializer()) + ); + } + + 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) { + throw new ApiException( + "Invalid response statusCode="+statusCode+" has no response defined in the openapi document", + response + ); + } + StatusFakeadditionalpropertieswitharrayofenumsGetCode200ResponseDeserializer castDeserializer = (StatusFakeadditionalpropertieswitharrayofenumsGetCode200ResponseDeserializer) statusCodeDeserializer; + var deserializedResponse = castDeserializer.deserialize(response, configuration); + return new EndpointFakeadditionalpropertieswitharrayofenumsGetCode200Response(response, deserializedResponse.body(), deserializedResponse.headers()); + } + } +} diff --git a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/fakeadditionalpropertieswitharrayofenums/get/requestbody/content/applicationjson/ApplicationjsonSchema.kt b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/fakeadditionalpropertieswitharrayofenums/get/requestbody/content/applicationjson/ApplicationjsonSchema.kt new file mode 100644 index 00000000000..23661b2fb49 --- /dev/null +++ b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/fakeadditionalpropertieswitharrayofenums/get/requestbody/content/applicationjson/ApplicationjsonSchema.kt @@ -0,0 +1,19 @@ +package org.openapijsonschematools.client.paths.fakeadditionalpropertieswitharrayofenums.get.requestbody.content.applicationjson; + +import org.checkerframework.checker.nullness.qual.Nullable; +import org.openapijsonschematools.client.components.schemas.AdditionalPropertiesWithArrayOfEnums; + +public class ApplicationjsonSchema extends AdditionalPropertiesWithArrayOfEnums { + // $refed class + + + public static class ApplicationjsonSchema1 extends AdditionalPropertiesWithArrayOfEnums1 { + private static @Nullable ApplicationjsonSchema1 instance = null; + public static ApplicationjsonSchema1 getInstance() { + if (instance == null) { + instance = new ApplicationjsonSchema1(); + } + return instance; + } + } +} diff --git a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/fakeadditionalpropertieswitharrayofenums/get/responses/FakeadditionalpropertieswitharrayofenumsGetCode200Response.kt b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/fakeadditionalpropertieswitharrayofenums/get/responses/FakeadditionalpropertieswitharrayofenumsGetCode200Response.kt new file mode 100644 index 00000000000..8a290d06008 --- /dev/null +++ b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/fakeadditionalpropertieswitharrayofenums/get/responses/FakeadditionalpropertieswitharrayofenumsGetCode200Response.kt @@ -0,0 +1,63 @@ +package org.openapijsonschematools.client.paths.fakeadditionalpropertieswitharrayofenums.get.responses; + +import org.openapijsonschematools.client.configurations.SchemaConfiguration; +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; + +import java.util.AbstractMap; +import java.util.Map; +import java.net.http.HttpResponse; +import java.net.http.HttpHeaders; + +public class FakeadditionalpropertieswitharrayofenumsGetCode200Response { + public sealed interface SealedMediaType permits ApplicationjsonMediaType {} + + public record ApplicationjsonMediaType(ApplicationjsonSchema.ApplicationjsonSchema1 schema) implements SealedMediaType, MediaType { + public ApplicationjsonMediaType() { + this(ApplicationjsonSchema.ApplicationjsonSchema1.getInstance()); + } + @Override + public Nothing? encoding() { + return null; + } + } + public sealed interface SealedResponseBody permits ApplicationjsonResponseBody {} + public record ApplicationjsonResponseBody(ApplicationjsonSchema.AdditionalPropertiesWithArrayOfEnums1Boxed body) implements SealedResponseBody { } + + public static class FakeadditionalpropertieswitharrayofenumsGetCode200Response1 extends ResponseDeserializer { + public FakeadditionalpropertieswitharrayofenumsGetCode200Response1() { + super( + Map.ofEntries( + new AbstractMap.SimpleEntry<>("application/json", new ApplicationjsonMediaType()) + ) + ); + } + + @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); + } + + @Override + protected Nothing? getHeaders(HttpHeaders headers, SchemaConfiguration configuration) { + return null; + } + } + + @SuppressWarnings("serial") + public static class ResponseApiException extends ApiException { + public DeserializedHttpResponse deserializedResponse; + + public ResponseApiException(String s, HttpResponse response, DeserializedHttpResponse deserializedResponse) { + super(s, response); + this.deserializedResponse = deserializedResponse; + } + } +} diff --git a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/fakeadditionalpropertieswitharrayofenums/get/responses/code200response/content/applicationjson/ApplicationjsonSchema.kt b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/fakeadditionalpropertieswitharrayofenums/get/responses/code200response/content/applicationjson/ApplicationjsonSchema.kt new file mode 100644 index 00000000000..365fe1691e1 --- /dev/null +++ b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/fakeadditionalpropertieswitharrayofenums/get/responses/code200response/content/applicationjson/ApplicationjsonSchema.kt @@ -0,0 +1,19 @@ +package org.openapijsonschematools.client.paths.fakeadditionalpropertieswitharrayofenums.get.responses.code200response.content.applicationjson; + +import org.checkerframework.checker.nullness.qual.Nullable; +import org.openapijsonschematools.client.components.schemas.AdditionalPropertiesWithArrayOfEnums; + +public class ApplicationjsonSchema extends AdditionalPropertiesWithArrayOfEnums { + // $refed class + + + public static class ApplicationjsonSchema1 extends AdditionalPropertiesWithArrayOfEnums1 { + private static @Nullable ApplicationjsonSchema1 instance = null; + public static ApplicationjsonSchema1 getInstance() { + if (instance == null) { + instance = new ApplicationjsonSchema1(); + } + return instance; + } + } +} diff --git a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/fakebodywithfileschema/FakebodywithfileschemaPut.kt b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/fakebodywithfileschema/FakebodywithfileschemaPut.kt new file mode 100644 index 00000000000..7c9a7ce3ef7 --- /dev/null +++ b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/fakebodywithfileschema/FakebodywithfileschemaPut.kt @@ -0,0 +1,183 @@ +package org.openapijsonschematools.client.paths.fakebodywithfileschema; + +import org.checkerframework.checker.nullness.qual.Nullable; +import org.openapijsonschematools.client.RootServerInfo; +import org.openapijsonschematools.client.paths.fakebodywithfileschema.put.FakebodywithfileschemaPutRequestBody; +import org.openapijsonschematools.client.paths.fakebodywithfileschema.put.FakebodywithfileschemaPutResponses; +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.requestbody.SerializedRequestBody; +import org.openapijsonschematools.client.paths.Fakebodywithfileschema; + +import java.io.IOException; +import java.util.ArrayList; +import java.net.http.HttpClient; +import java.net.http.HttpRequest; +import java.time.Duration; +import java.util.List; +import java.util.Map; + +public class FakebodywithfileschemaPut { + private static class PutProvider { + private static final String method = "put"; + + public static FakebodywithfileschemaPutResponses.EndpointResponse put( + PutRequest request, + ApiConfiguration apiConfiguration, + SchemaConfiguration schemaConfiguration, + HttpClient client + ) throws IOException, InterruptedException, ValidationException, NotImplementedException, ApiException { + Map> headers = apiConfiguration.getDefaultHeaders(); + + SerializedRequestBody serializedRequestBody = new FakebodywithfileschemaPutRequestBody.FakebodywithfileschemaPutRequestBody1().serialize( + request.requestBody + ); + var contentTypeHeaderValues = headers.getOrDefault("Content-Type", new ArrayList<>()); + contentTypeHeaderValues.add(serializedRequestBody.contentType); + HttpRequest.BodyPublisher bodyPublisher = serializedRequestBody.bodyPublisher; + // TODO set this to a map if there is a query security scheme + @Nullable Map queryMap = null; + String host = apiConfiguration.getServer(request.serverIndex).url(); + + String url = host + Fakebodywithfileschema.path; + var httpRequest = RestClient.getRequest( + url, + method, + bodyPublisher, + headers, + request.timeout + ); + var response = RestClient.getResponse(httpRequest, client); + var responsesDeserializer = new FakebodywithfileschemaPutResponses.FakebodywithfileschemaPutResponses1(); + return responsesDeserializer.deserialize(response, schemaConfiguration); + } + } + + public interface PutOperation { + ApiConfiguration getApiConfiguration(); + SchemaConfiguration getSchemaConfiguration(); + HttpClient getClient(); + default FakebodywithfileschemaPutResponses.EndpointResponse put(PutRequest request) throws IOException, InterruptedException, ValidationException, NotImplementedException, ApiException { + return PutProvider.put(request, getApiConfiguration(), getSchemaConfiguration(), getClient()); + } + } + + public interface BodyWithFileSchemaOperation { + ApiConfiguration getApiConfiguration(); + SchemaConfiguration getSchemaConfiguration(); + HttpClient getClient(); + default FakebodywithfileschemaPutResponses.EndpointResponse bodyWithFileSchema(PutRequest request) throws IOException, InterruptedException, ValidationException, NotImplementedException, ApiException { + return PutProvider.put(request, getApiConfiguration(), getSchemaConfiguration(), getClient()); + } + } + + public static class Put extends ApiClient implements PutOperation { + public Put(ApiConfiguration apiConfiguration, SchemaConfiguration schemaConfiguration) { + super(apiConfiguration, schemaConfiguration); + } + } + + public static class PutRequest { + public FakebodywithfileschemaPutRequestBody.SealedRequestBody requestBody; + public RootServerInfo.@Nullable ServerIndex serverIndex; + public @Nullable Duration timeout; + + public PutRequest( + FakebodywithfileschemaPutRequestBody.SealedRequestBody requestBody, + RootServerInfo.@Nullable ServerIndex serverIndex, + @Nullable Duration timeout + ) { + this.requestBody = requestBody; + this.serverIndex = serverIndex; + this.timeout = timeout; + } + } + + public static class PutNullableRequest { + public FakebodywithfileschemaPutRequestBody.@Nullable SealedRequestBody requestBody; + public RootServerInfo.@Nullable ServerIndex serverIndex; + public @Nullable Duration timeout; + } + + public interface SetterForServerIndex { + PutNullableRequest getInstance(); + T getBuilderAfterServerIndex(PutNullableRequest instance); + default T serverIndex(RootServerInfo.ServerIndex serverIndex) { + var instance = getInstance(); + instance.serverIndex = serverIndex; + return getBuilderAfterServerIndex(instance); + } + } + + public interface SetterForTimeout { + PutNullableRequest getInstance(); + T getBuilderAfterTimeout(PutNullableRequest instance); + default T timeout(Duration timeout) { + var instance = getInstance(); + instance.timeout = timeout; + return getBuilderAfterTimeout(instance); + } + } + + public interface SetterForRequestBody { + PutNullableRequest getInstance(); + T getBuilderAfterRequestBody(PutNullableRequest instance); + default T requestBody(FakebodywithfileschemaPutRequestBody.SealedRequestBody requestBody) { + var instance = getInstance(); + instance.requestBody = requestBody; + return getBuilderAfterRequestBody(instance); + } + } + + public static class Put0RequestBuilder implements SetterForServerIndex, SetterForTimeout { + private final PutNullableRequest instance; + + public Put0RequestBuilder(PutNullableRequest instance) { + this.instance = instance; + } + + public PutRequest build() { + var requestBody = instance.requestBody; + if (requestBody == null) { + throw new RuntimeException("invalid null value for required parameter"); + } + return new PutRequest( + requestBody, + instance.serverIndex, + instance.timeout + ); + } + + public PutNullableRequest getInstance() { + return instance; + } + + public Put0RequestBuilder getBuilderAfterServerIndex(PutNullableRequest instance) { + return this; + } + + public Put0RequestBuilder getBuilderAfterTimeout(PutNullableRequest instance) { + return this; + } + } + public static class PutRequestBuilder implements SetterForRequestBody { + private final PutNullableRequest instance; + + public PutRequestBuilder() { + this.instance = new PutNullableRequest(); + } + + public PutNullableRequest getInstance() { + return instance; + } + + public Put0RequestBuilder getBuilderAfterRequestBody(PutNullableRequest instance) { + return new Put0RequestBuilder(instance); + } + } +} diff --git a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/fakebodywithfileschema/put/FakebodywithfileschemaPutRequestBody.kt b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/fakebodywithfileschema/put/FakebodywithfileschemaPutRequestBody.kt new file mode 100644 index 00000000000..f4b0941c508 --- /dev/null +++ b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/fakebodywithfileschema/put/FakebodywithfileschemaPutRequestBody.kt @@ -0,0 +1,49 @@ +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; +import org.openapijsonschematools.client.mediatype.MediaType; +import org.openapijsonschematools.client.paths.fakebodywithfileschema.put.requestbody.content.applicationjson.ApplicationjsonSchema; + +import java.util.AbstractMap; +import java.util.Map; + +public class FakebodywithfileschemaPutRequestBody { + public sealed interface SealedMediaType permits ApplicationjsonMediaType {} + + public record ApplicationjsonMediaType(ApplicationjsonSchema.ApplicationjsonSchema1 schema) implements SealedMediaType, MediaType { + public ApplicationjsonMediaType() { + this(ApplicationjsonSchema.ApplicationjsonSchema1.getInstance()); + } + @Override + public Nothing? encoding() { + return null; + } + } + + public static class FakebodywithfileschemaPutRequestBody1 extends RequestBodySerializer { + public FakebodywithfileschemaPutRequestBody1() { + super( + Map.ofEntries( + new AbstractMap.SimpleEntry<>("application/json", new ApplicationjsonMediaType()) + ), + true + ); + } + + public SerializedRequestBody serialize(SealedRequestBody requestBody) throws NotImplementedException { + ApplicationjsonRequestBody requestBody0 = (ApplicationjsonRequestBody) requestBody; + return serialize(requestBody0.contentType(), requestBody0.body().getData()); + } + } + + public sealed interface SealedRequestBody permits ApplicationjsonRequestBody {} + public record ApplicationjsonRequestBody(ApplicationjsonSchema.FileSchemaTestClass1Boxed body) implements SealedRequestBody, GenericRequestBody { + @Override + public String contentType() { + return "application/json"; + } + } +} diff --git a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/fakebodywithfileschema/put/FakebodywithfileschemaPutResponses.kt b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/fakebodywithfileschema/put/FakebodywithfileschemaPutResponses.kt new file mode 100644 index 00000000000..c015dad663e --- /dev/null +++ b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/fakebodywithfileschema/put/FakebodywithfileschemaPutResponses.kt @@ -0,0 +1,53 @@ +package org.openapijsonschematools.client.paths.fakebodywithfileschema.put; + +import org.openapijsonschematools.client.paths.fakebodywithfileschema.put.responses.FakebodywithfileschemaPutCode200Response; +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; +import org.checkerframework.checker.nullness.qual.Nullable; + +import java.net.http.HttpResponse; +import java.util.Map; +import java.util.AbstractMap; + +public class FakebodywithfileschemaPutResponses { + public sealed interface EndpointResponse permits EndpointFakebodywithfileschemaPutCode200Response {} + + public record EndpointFakebodywithfileschemaPutCode200Response( + HttpResponse response, + Nothing? body, + Nothing? headers + ) implements EndpointResponse, ApiResponse{ + } + + public sealed interface StatusCodeResponseDeserializer permits StatusFakebodywithfileschemaPutCode200ResponseDeserializer {} + + public static final class StatusFakebodywithfileschemaPutCode200ResponseDeserializer extends FakebodywithfileschemaPutCode200Response.FakebodywithfileschemaPutCode200Response1 implements StatusCodeResponseDeserializer { + } + + public static final class FakebodywithfileschemaPutResponses1 implements ResponsesDeserializer { + private final Map statusCodeToResponseDeserializer; + public FakebodywithfileschemaPutResponses1() { + this.statusCodeToResponseDeserializer = Map.ofEntries( + new AbstractMap.SimpleEntry<>("200", new StatusFakebodywithfileschemaPutCode200ResponseDeserializer()) + ); + } + + 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) { + throw new ApiException( + "Invalid response statusCode="+statusCode+" has no response defined in the openapi document", + response + ); + } + StatusFakebodywithfileschemaPutCode200ResponseDeserializer castDeserializer = (StatusFakebodywithfileschemaPutCode200ResponseDeserializer) statusCodeDeserializer; + var deserializedResponse = castDeserializer.deserialize(response, configuration); + return new EndpointFakebodywithfileschemaPutCode200Response(response, deserializedResponse.body(), deserializedResponse.headers()); + } + } +} diff --git a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/fakebodywithfileschema/put/requestbody/content/applicationjson/ApplicationjsonSchema.kt b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/fakebodywithfileschema/put/requestbody/content/applicationjson/ApplicationjsonSchema.kt new file mode 100644 index 00000000000..0bf7ab945f1 --- /dev/null +++ b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/fakebodywithfileschema/put/requestbody/content/applicationjson/ApplicationjsonSchema.kt @@ -0,0 +1,19 @@ +package org.openapijsonschematools.client.paths.fakebodywithfileschema.put.requestbody.content.applicationjson; + +import org.checkerframework.checker.nullness.qual.Nullable; +import org.openapijsonschematools.client.components.schemas.FileSchemaTestClass; + +public class ApplicationjsonSchema extends FileSchemaTestClass { + // $refed class + + + public static class ApplicationjsonSchema1 extends FileSchemaTestClass1 { + private static @Nullable ApplicationjsonSchema1 instance = null; + public static ApplicationjsonSchema1 getInstance() { + if (instance == null) { + instance = new ApplicationjsonSchema1(); + } + return instance; + } + } +} diff --git a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/fakebodywithfileschema/put/responses/FakebodywithfileschemaPutCode200Response.kt b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/fakebodywithfileschema/put/responses/FakebodywithfileschemaPutCode200Response.kt new file mode 100644 index 00000000000..83a4cc26665 --- /dev/null +++ b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/fakebodywithfileschema/put/responses/FakebodywithfileschemaPutCode200Response.kt @@ -0,0 +1,7 @@ +package org.openapijsonschematools.client.paths.fakebodywithfileschema.put.responses; + +import org.openapijsonschematools.client.components.responses.SuccessDescriptionOnly; + +public class FakebodywithfileschemaPutCode200Response extends SuccessDescriptionOnly { + public static class FakebodywithfileschemaPutCode200Response1 extends SuccessDescriptionOnly1 {} +} diff --git a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/fakebodywithqueryparams/FakebodywithqueryparamsPut.kt b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/fakebodywithqueryparams/FakebodywithqueryparamsPut.kt new file mode 100644 index 00000000000..1fd7a628436 --- /dev/null +++ b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/fakebodywithqueryparams/FakebodywithqueryparamsPut.kt @@ -0,0 +1,242 @@ +package org.openapijsonschematools.client.paths.fakebodywithqueryparams; + +import org.checkerframework.checker.nullness.qual.Nullable; +import org.openapijsonschematools.client.RootServerInfo; +import org.openapijsonschematools.client.paths.fakebodywithqueryparams.put.FakebodywithqueryparamsPutRequestBody; +import org.openapijsonschematools.client.paths.fakebodywithqueryparams.put.FakebodywithqueryparamsPutQueryParameters; +import org.openapijsonschematools.client.paths.fakebodywithqueryparams.put.Parameters; +import org.openapijsonschematools.client.paths.fakebodywithqueryparams.put.FakebodywithqueryparamsPutResponses; +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.requestbody.SerializedRequestBody; +import org.openapijsonschematools.client.paths.Fakebodywithqueryparams; + +import java.io.IOException; +import java.util.ArrayList; +import java.net.http.HttpClient; +import java.net.http.HttpRequest; +import java.time.Duration; +import java.util.List; +import java.util.Map; + +public class FakebodywithqueryparamsPut { + private static class PutProvider { + private static final String method = "put"; + + public static FakebodywithqueryparamsPutResponses.EndpointResponse put( + PutRequest request, + ApiConfiguration apiConfiguration, + SchemaConfiguration schemaConfiguration, + HttpClient client + ) throws IOException, InterruptedException, ValidationException, NotImplementedException, ApiException { + Map> headers = apiConfiguration.getDefaultHeaders(); + + SerializedRequestBody serializedRequestBody = new FakebodywithqueryparamsPutRequestBody.FakebodywithqueryparamsPutRequestBody1().serialize( + request.requestBody + ); + var contentTypeHeaderValues = headers.getOrDefault("Content-Type", new ArrayList<>()); + contentTypeHeaderValues.add(serializedRequestBody.contentType); + HttpRequest.BodyPublisher bodyPublisher = serializedRequestBody.bodyPublisher; + + var querySerializer = new Parameters.QueryParametersSerializer(); + @Nullable Map queryMap = querySerializer.getQueryMap(request.queryParameters); + String host = apiConfiguration.getServer(request.serverIndex).url(); + + String url = host + Fakebodywithqueryparams.path; + if (queryMap != null) { + url = url + querySerializer.serialize(queryMap); + } + var httpRequest = RestClient.getRequest( + url, + method, + bodyPublisher, + headers, + request.timeout + ); + var response = RestClient.getResponse(httpRequest, client); + var responsesDeserializer = new FakebodywithqueryparamsPutResponses.FakebodywithqueryparamsPutResponses1(); + return responsesDeserializer.deserialize(response, schemaConfiguration); + } + } + + public interface PutOperation { + ApiConfiguration getApiConfiguration(); + SchemaConfiguration getSchemaConfiguration(); + HttpClient getClient(); + default FakebodywithqueryparamsPutResponses.EndpointResponse put(PutRequest request) throws IOException, InterruptedException, ValidationException, NotImplementedException, ApiException { + return PutProvider.put(request, getApiConfiguration(), getSchemaConfiguration(), getClient()); + } + } + + public interface BodyWithQueryParamsOperation { + ApiConfiguration getApiConfiguration(); + SchemaConfiguration getSchemaConfiguration(); + HttpClient getClient(); + default FakebodywithqueryparamsPutResponses.EndpointResponse bodyWithQueryParams(PutRequest request) throws IOException, InterruptedException, ValidationException, NotImplementedException, ApiException { + return PutProvider.put(request, getApiConfiguration(), getSchemaConfiguration(), getClient()); + } + } + + public static class Put extends ApiClient implements PutOperation { + public Put(ApiConfiguration apiConfiguration, SchemaConfiguration schemaConfiguration) { + super(apiConfiguration, schemaConfiguration); + } + } + + public static class PutRequest { + public FakebodywithqueryparamsPutRequestBody.SealedRequestBody requestBody; + public FakebodywithqueryparamsPutQueryParameters.QueryParametersMap queryParameters; + public RootServerInfo.@Nullable ServerIndex serverIndex; + public @Nullable Duration timeout; + + public PutRequest( + FakebodywithqueryparamsPutRequestBody.SealedRequestBody requestBody, + FakebodywithqueryparamsPutQueryParameters.QueryParametersMap queryParameters, + RootServerInfo.@Nullable ServerIndex serverIndex, + @Nullable Duration timeout + ) { + this.requestBody = requestBody; + this.queryParameters = queryParameters; + this.serverIndex = serverIndex; + this.timeout = timeout; + } + } + + public static class PutNullableRequest { + public FakebodywithqueryparamsPutRequestBody.@Nullable SealedRequestBody requestBody; + public FakebodywithqueryparamsPutQueryParameters.@Nullable QueryParametersMap queryParameters; + public RootServerInfo.@Nullable ServerIndex serverIndex; + public @Nullable Duration timeout; + } + + public interface SetterForServerIndex { + PutNullableRequest getInstance(); + T getBuilderAfterServerIndex(PutNullableRequest instance); + default T serverIndex(RootServerInfo.ServerIndex serverIndex) { + var instance = getInstance(); + instance.serverIndex = serverIndex; + return getBuilderAfterServerIndex(instance); + } + } + + public interface SetterForTimeout { + PutNullableRequest getInstance(); + T getBuilderAfterTimeout(PutNullableRequest instance); + default T timeout(Duration timeout) { + var instance = getInstance(); + instance.timeout = timeout; + return getBuilderAfterTimeout(instance); + } + } + + public interface SetterForRequestBody { + PutNullableRequest getInstance(); + T getBuilderAfterRequestBody(PutNullableRequest instance); + default T requestBody(FakebodywithqueryparamsPutRequestBody.SealedRequestBody requestBody) { + var instance = getInstance(); + instance.requestBody = requestBody; + return getBuilderAfterRequestBody(instance); + } + } + + public interface SetterForQueryParameters { + PutNullableRequest getInstance(); + T getBuilderAfterQueryParameters(PutNullableRequest instance); + default T queryParameters(FakebodywithqueryparamsPutQueryParameters.QueryParametersMap queryParameters) { + var instance = getInstance(); + instance.queryParameters = queryParameters; + return getBuilderAfterQueryParameters(instance); + } + } + + public static class Put00RequestBuilder implements SetterForServerIndex, SetterForTimeout { + private final PutNullableRequest instance; + + public Put00RequestBuilder(PutNullableRequest instance) { + this.instance = instance; + } + + public PutRequest build() { + var requestBody = instance.requestBody; + if (requestBody == null) { + throw new RuntimeException("invalid null value for required parameter"); + } + var queryParameters = instance.queryParameters; + if (queryParameters == null) { + throw new RuntimeException("invalid null value for required parameter"); + } + return new PutRequest( + requestBody, + queryParameters, + instance.serverIndex, + instance.timeout + ); + } + + public PutNullableRequest getInstance() { + return instance; + } + + public Put00RequestBuilder getBuilderAfterServerIndex(PutNullableRequest instance) { + return this; + } + + public Put00RequestBuilder getBuilderAfterTimeout(PutNullableRequest instance) { + return this; + } + } + public static class Put01RequestBuilder implements SetterForQueryParameters { + private final PutNullableRequest instance; + + public Put01RequestBuilder(PutNullableRequest instance) { + this.instance = instance; + } + + public PutNullableRequest getInstance() { + return instance; + } + + public Put00RequestBuilder getBuilderAfterQueryParameters(PutNullableRequest instance) { + return new Put00RequestBuilder(instance); + } + } + public static class Put10RequestBuilder implements SetterForRequestBody { + private final PutNullableRequest instance; + + public Put10RequestBuilder(PutNullableRequest instance) { + this.instance = instance; + } + + public PutNullableRequest getInstance() { + return instance; + } + + public Put00RequestBuilder getBuilderAfterRequestBody(PutNullableRequest instance) { + return new Put00RequestBuilder(instance); + } + } + public static class PutRequestBuilder implements SetterForRequestBody, SetterForQueryParameters { + private final PutNullableRequest instance; + + public PutRequestBuilder() { + this.instance = new PutNullableRequest(); + } + + public PutNullableRequest getInstance() { + return instance; + } + + public Put01RequestBuilder getBuilderAfterRequestBody(PutNullableRequest instance) { + return new Put01RequestBuilder(instance); + } + + public Put10RequestBuilder getBuilderAfterQueryParameters(PutNullableRequest instance) { + return new Put10RequestBuilder(instance); + } + } +} diff --git a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/fakebodywithqueryparams/put/FakebodywithqueryparamsPutQueryParameters.kt b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/fakebodywithqueryparams/put/FakebodywithqueryparamsPutQueryParameters.kt new file mode 100644 index 00000000000..03a6f9411f5 --- /dev/null +++ b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/fakebodywithqueryparams/put/FakebodywithqueryparamsPutQueryParameters.kt @@ -0,0 +1,205 @@ +package org.openapijsonschematools.client.paths.fakebodywithqueryparams.put; +import java.util.ArrayList; +import java.util.HashSet; +import java.util.LinkedHashMap; +import java.util.LinkedHashSet; +import java.util.List; +import java.util.Map; +import java.util.Objects; +import java.util.Set; +import org.checkerframework.checker.nullness.qual.Nullable; +import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags; +import org.openapijsonschematools.client.configurations.SchemaConfiguration; +import org.openapijsonschematools.client.exceptions.UnsetPropertyException; +import org.openapijsonschematools.client.exceptions.ValidationException; +import org.openapijsonschematools.client.paths.fakebodywithqueryparams.put.parameters.parameter0.Schema0; +import org.openapijsonschematools.client.schemas.AnyTypeJsonSchema; +import org.openapijsonschematools.client.schemas.GenericBuilder; +import org.openapijsonschematools.client.schemas.NotAnyTypeJsonSchema; +import org.openapijsonschematools.client.schemas.validation.FrozenMap; +import org.openapijsonschematools.client.schemas.validation.JsonSchema; +import org.openapijsonschematools.client.schemas.validation.JsonSchemaInfo; +import org.openapijsonschematools.client.schemas.validation.MapSchemaValidator; +import org.openapijsonschematools.client.schemas.validation.MapUtils; +import org.openapijsonschematools.client.schemas.validation.PathToSchemasMap; +import org.openapijsonschematools.client.schemas.validation.PropertyEntry; +import org.openapijsonschematools.client.schemas.validation.ValidationMetadata; + +public class FakebodywithqueryparamsPutQueryParameters { + // nest classes so all schemas and input/output classes can be public + + + public static class AdditionalProperties extends NotAnyTypeJsonSchema.NotAnyTypeJsonSchema1 { + // NotAnyTypeSchema + private static @Nullable AdditionalProperties instance = null; + public static AdditionalProperties getInstance() { + if (instance == null) { + instance = new AdditionalProperties(); + } + return instance; + } + } + + + public static class QueryParametersMap extends FrozenMap { + protected QueryParametersMap(FrozenMap m) { + super(m); + } + public static final Set requiredKeys = Set.of( + "query" + ); + public static final Set optionalKeys = Set.of(); + public static QueryParametersMap of(Map arg, SchemaConfiguration configuration) throws ValidationException { + return FakebodywithqueryparamsPutQueryParameters1.getInstance().validate(arg, configuration); + } + + public String query() { + try { + return getOrThrow("version"); + } catch (UnsetPropertyException e) { + throw new RuntimeException(e); + } + } + } + + public interface SetterForQuery { + Map getInstance(); + T getBuilderAfterQuery(Map instance); + + default T query(String value) { + var instance = getInstance(); + instance.put("query", value); + return getBuilderAfterQuery(instance); + } + } + + public static class QueryParametersMap0Builder implements GenericBuilder> { + private final Map instance; + private static final Set knownKeys = Set.of( + "query" + ); + public Set getKnownKeys() { + return knownKeys; + } + public QueryParametersMap0Builder(Map instance) { + this.instance = instance; + } + public Map build() { + return instance; + } + } + + public static class QueryParametersMapBuilder implements SetterForQuery { + private final Map instance; + public QueryParametersMapBuilder() { + this.instance = new LinkedHashMap<>(); + } + public Map getInstance() { + return instance; + } + public QueryParametersMap0Builder getBuilderAfterQuery(Map instance) { + return new QueryParametersMap0Builder(instance); + } + } + + + public sealed interface FakebodywithqueryparamsPutQueryParameters1Boxed permits FakebodywithqueryparamsPutQueryParameters1BoxedMap { + @Nullable Object getData(); + } + + public record FakebodywithqueryparamsPutQueryParameters1BoxedMap(QueryParametersMap data) implements FakebodywithqueryparamsPutQueryParameters1Boxed { + @Override + public @Nullable Object getData() { + return data; + } + } + + + public static class FakebodywithqueryparamsPutQueryParameters1 extends JsonSchema implements MapSchemaValidator { + private static @Nullable FakebodywithqueryparamsPutQueryParameters1 instance = null; + + protected FakebodywithqueryparamsPutQueryParameters1() { + super(new JsonSchemaInfo() + .type(Set.of(Map.class)) + .properties(Map.ofEntries( + new PropertyEntry("query", Schema0.Schema01.class) + )) + .required(Set.of( + "query" + )) + .additionalProperties(AdditionalProperties.class) + ); + } + + public static FakebodywithqueryparamsPutQueryParameters1 getInstance() { + if (instance == null) { + instance = new FakebodywithqueryparamsPutQueryParameters1(); + } + return instance; + } + + 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 RuntimeException("Invalid non-string key value"); + } + String propertyName = (String) entryKey; + List propertyPathToItem = new ArrayList<>(pathToItem); + propertyPathToItem.add(propertyName); + Object value = entry.getValue(); + LinkedHashMap, Nothing?> schemas = pathToSchemas.get(propertyPathToItem); + if (schemas == null) { + throw new RuntimeException("Validation 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"); + } + properties.put(propertyName, (String) propertyInstance); + } + FrozenMap castProperties = new FrozenMap<>(properties); + return new QueryParametersMap(castProperties); + } + + 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); + SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().build())); + ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, new PathToSchemasMap(), new LinkedHashSet<>()); + PathToSchemasMap pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet); + return getNewInstance(castArg, validationMetadata.pathToItem(), pathToSchemasMap); + } + + + @Override + public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws 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"); + } + @Override + public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { + if (arg instanceof Map) { + return getNewInstance((Map) arg, pathToItem, pathToSchemas); + } + throw new RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); + } + @Override + public FakebodywithqueryparamsPutQueryParameters1BoxedMap validateAndBox(Map arg, SchemaConfiguration configuration) throws ValidationException { + return new FakebodywithqueryparamsPutQueryParameters1BoxedMap(validate(arg, configuration)); + } + @Override + public FakebodywithqueryparamsPutQueryParameters1Boxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { + 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"); + } + } + +} diff --git a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/fakebodywithqueryparams/put/FakebodywithqueryparamsPutRequestBody.kt b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/fakebodywithqueryparams/put/FakebodywithqueryparamsPutRequestBody.kt new file mode 100644 index 00000000000..441c4f06469 --- /dev/null +++ b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/fakebodywithqueryparams/put/FakebodywithqueryparamsPutRequestBody.kt @@ -0,0 +1,49 @@ +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; +import org.openapijsonschematools.client.mediatype.MediaType; +import org.openapijsonschematools.client.paths.fakebodywithqueryparams.put.requestbody.content.applicationjson.ApplicationjsonSchema; + +import java.util.AbstractMap; +import java.util.Map; + +public class FakebodywithqueryparamsPutRequestBody { + public sealed interface SealedMediaType permits ApplicationjsonMediaType {} + + public record ApplicationjsonMediaType(ApplicationjsonSchema.ApplicationjsonSchema1 schema) implements SealedMediaType, MediaType { + public ApplicationjsonMediaType() { + this(ApplicationjsonSchema.ApplicationjsonSchema1.getInstance()); + } + @Override + public Nothing? encoding() { + return null; + } + } + + public static class FakebodywithqueryparamsPutRequestBody1 extends RequestBodySerializer { + public FakebodywithqueryparamsPutRequestBody1() { + super( + Map.ofEntries( + new AbstractMap.SimpleEntry<>("application/json", new ApplicationjsonMediaType()) + ), + true + ); + } + + public SerializedRequestBody serialize(SealedRequestBody requestBody) throws NotImplementedException { + ApplicationjsonRequestBody requestBody0 = (ApplicationjsonRequestBody) requestBody; + return serialize(requestBody0.contentType(), requestBody0.body().getData()); + } + } + + public sealed interface SealedRequestBody permits ApplicationjsonRequestBody {} + public record ApplicationjsonRequestBody(ApplicationjsonSchema.User1Boxed body) implements SealedRequestBody, GenericRequestBody { + @Override + public String contentType() { + return "application/json"; + } + } +} diff --git a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/fakebodywithqueryparams/put/FakebodywithqueryparamsPutResponses.kt b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/fakebodywithqueryparams/put/FakebodywithqueryparamsPutResponses.kt new file mode 100644 index 00000000000..795ee1ec004 --- /dev/null +++ b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/fakebodywithqueryparams/put/FakebodywithqueryparamsPutResponses.kt @@ -0,0 +1,53 @@ +package org.openapijsonschematools.client.paths.fakebodywithqueryparams.put; + +import org.openapijsonschematools.client.paths.fakebodywithqueryparams.put.responses.FakebodywithqueryparamsPutCode200Response; +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; +import org.checkerframework.checker.nullness.qual.Nullable; + +import java.net.http.HttpResponse; +import java.util.Map; +import java.util.AbstractMap; + +public class FakebodywithqueryparamsPutResponses { + public sealed interface EndpointResponse permits EndpointFakebodywithqueryparamsPutCode200Response {} + + public record EndpointFakebodywithqueryparamsPutCode200Response( + HttpResponse response, + Nothing? body, + Nothing? headers + ) implements EndpointResponse, ApiResponse{ + } + + public sealed interface StatusCodeResponseDeserializer permits StatusFakebodywithqueryparamsPutCode200ResponseDeserializer {} + + public static final class StatusFakebodywithqueryparamsPutCode200ResponseDeserializer extends FakebodywithqueryparamsPutCode200Response.FakebodywithqueryparamsPutCode200Response1 implements StatusCodeResponseDeserializer { + } + + public static final class FakebodywithqueryparamsPutResponses1 implements ResponsesDeserializer { + private final Map statusCodeToResponseDeserializer; + public FakebodywithqueryparamsPutResponses1() { + this.statusCodeToResponseDeserializer = Map.ofEntries( + new AbstractMap.SimpleEntry<>("200", new StatusFakebodywithqueryparamsPutCode200ResponseDeserializer()) + ); + } + + 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) { + throw new ApiException( + "Invalid response statusCode="+statusCode+" has no response defined in the openapi document", + response + ); + } + StatusFakebodywithqueryparamsPutCode200ResponseDeserializer castDeserializer = (StatusFakebodywithqueryparamsPutCode200ResponseDeserializer) statusCodeDeserializer; + var deserializedResponse = castDeserializer.deserialize(response, configuration); + return new EndpointFakebodywithqueryparamsPutCode200Response(response, deserializedResponse.body(), deserializedResponse.headers()); + } + } +} diff --git a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/fakebodywithqueryparams/put/Parameters.kt b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/fakebodywithqueryparams/put/Parameters.kt new file mode 100644 index 00000000000..d796a88eb1d --- /dev/null +++ b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/fakebodywithqueryparams/put/Parameters.kt @@ -0,0 +1,20 @@ +package org.openapijsonschematools.client.paths.fakebodywithqueryparams.put; + +import org.openapijsonschematools.client.paths.fakebodywithqueryparams.put.parameters.Parameter0; +import org.openapijsonschematools.client.parameter.QuerySerializer; + +import java.util.Map; +import java.util.AbstractMap; + +public class Parameters { + + public static class QueryParametersSerializer extends QuerySerializer { + public QueryParametersSerializer() { + super( + Map.ofEntries( + new AbstractMap.SimpleEntry<>("query", new Parameter0.Parameter01()) + ) + ); + } + } +} diff --git a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/fakebodywithqueryparams/put/parameters/Parameter0.kt b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/fakebodywithqueryparams/put/parameters/Parameter0.kt new file mode 100644 index 00000000000..b89f34112a4 --- /dev/null +++ b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/fakebodywithqueryparams/put/parameters/Parameter0.kt @@ -0,0 +1,23 @@ +package org.openapijsonschematools.client.paths.fakebodywithqueryparams.put.parameters; + +import org.openapijsonschematools.client.parameter.ParameterStyle; +import org.openapijsonschematools.client.parameter.ParameterInType; +import org.openapijsonschematools.client.parameter.SchemaParameter; +import org.openapijsonschematools.client.paths.fakebodywithqueryparams.put.parameters.parameter0.Schema0; + +public class Parameter0 { + + public static class Parameter01 extends SchemaParameter { + public Parameter01() { + super( + "query", + ParameterInType.QUERY, + true, + ParameterStyle.FORM, + true, + false, + Schema0.Schema01.getInstance() + ); + } + } +} diff --git a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/fakebodywithqueryparams/put/parameters/parameter0/Schema0.kt b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/fakebodywithqueryparams/put/parameters/parameter0/Schema0.kt new file mode 100644 index 00000000000..57b1bddf802 --- /dev/null +++ b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/fakebodywithqueryparams/put/parameters/parameter0/Schema0.kt @@ -0,0 +1,19 @@ +package org.openapijsonschematools.client.paths.fakebodywithqueryparams.put.parameters.parameter0; +import org.checkerframework.checker.nullness.qual.Nullable; +import org.openapijsonschematools.client.schemas.StringJsonSchema; + +public class Schema0 extends StringJsonSchema { + // nest classes so all schemas and input/output classes can be public + + + public static class Schema01 extends StringJsonSchema.StringJsonSchema1 { + private static @Nullable Schema01 instance = null; + public static Schema01 getInstance() { + if (instance == null) { + instance = new Schema01(); + } + return instance; + } + } + +} diff --git a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/fakebodywithqueryparams/put/requestbody/content/applicationjson/ApplicationjsonSchema.kt b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/fakebodywithqueryparams/put/requestbody/content/applicationjson/ApplicationjsonSchema.kt new file mode 100644 index 00000000000..c3506f9a79a --- /dev/null +++ b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/fakebodywithqueryparams/put/requestbody/content/applicationjson/ApplicationjsonSchema.kt @@ -0,0 +1,19 @@ +package org.openapijsonschematools.client.paths.fakebodywithqueryparams.put.requestbody.content.applicationjson; + +import org.checkerframework.checker.nullness.qual.Nullable; +import org.openapijsonschematools.client.components.schemas.User; + +public class ApplicationjsonSchema extends User { + // $refed class + + + public static class ApplicationjsonSchema1 extends User1 { + private static @Nullable ApplicationjsonSchema1 instance = null; + public static ApplicationjsonSchema1 getInstance() { + if (instance == null) { + instance = new ApplicationjsonSchema1(); + } + return instance; + } + } +} diff --git a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/fakebodywithqueryparams/put/responses/FakebodywithqueryparamsPutCode200Response.kt b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/fakebodywithqueryparams/put/responses/FakebodywithqueryparamsPutCode200Response.kt new file mode 100644 index 00000000000..b193efb7bee --- /dev/null +++ b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/fakebodywithqueryparams/put/responses/FakebodywithqueryparamsPutCode200Response.kt @@ -0,0 +1,7 @@ +package org.openapijsonschematools.client.paths.fakebodywithqueryparams.put.responses; + +import org.openapijsonschematools.client.components.responses.SuccessDescriptionOnly; + +public class FakebodywithqueryparamsPutCode200Response extends SuccessDescriptionOnly { + public static class FakebodywithqueryparamsPutCode200Response1 extends SuccessDescriptionOnly1 {} +} diff --git a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/fakecasesensitiveparams/FakecasesensitiveparamsPut.kt b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/fakecasesensitiveparams/FakecasesensitiveparamsPut.kt new file mode 100644 index 00000000000..35d386df605 --- /dev/null +++ b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/fakecasesensitiveparams/FakecasesensitiveparamsPut.kt @@ -0,0 +1,180 @@ +package org.openapijsonschematools.client.paths.fakecasesensitiveparams; + +import org.checkerframework.checker.nullness.qual.Nullable; +import org.openapijsonschematools.client.RootServerInfo; +import org.openapijsonschematools.client.paths.fakecasesensitiveparams.put.FakecasesensitiveparamsPutQueryParameters; +import org.openapijsonschematools.client.paths.fakecasesensitiveparams.put.Parameters; +import org.openapijsonschematools.client.paths.fakecasesensitiveparams.put.FakecasesensitiveparamsPutResponses; +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.paths.Fakecasesensitiveparams; + +import java.io.IOException; +import java.net.http.HttpClient; +import java.net.http.HttpRequest; +import java.time.Duration; +import java.util.List; +import java.util.Map; + +public class FakecasesensitiveparamsPut { + private static class PutProvider { + private static final String method = "put"; + + public static FakecasesensitiveparamsPutResponses.EndpointResponse put( + PutRequest request, + ApiConfiguration apiConfiguration, + SchemaConfiguration schemaConfiguration, + HttpClient client + ) throws IOException, InterruptedException, ValidationException, NotImplementedException, ApiException { + Map> headers = apiConfiguration.getDefaultHeaders(); + HttpRequest.BodyPublisher bodyPublisher = HttpRequest.BodyPublishers.noBody(); + + var querySerializer = new Parameters.QueryParametersSerializer(); + @Nullable Map queryMap = querySerializer.getQueryMap(request.queryParameters); + String host = apiConfiguration.getServer(request.serverIndex).url(); + + String url = host + Fakecasesensitiveparams.path; + if (queryMap != null) { + url = url + querySerializer.serialize(queryMap); + } + var httpRequest = RestClient.getRequest( + url, + method, + bodyPublisher, + headers, + request.timeout + ); + var response = RestClient.getResponse(httpRequest, client); + var responsesDeserializer = new FakecasesensitiveparamsPutResponses.FakecasesensitiveparamsPutResponses1(); + return responsesDeserializer.deserialize(response, schemaConfiguration); + } + } + + public interface PutOperation { + ApiConfiguration getApiConfiguration(); + SchemaConfiguration getSchemaConfiguration(); + HttpClient getClient(); + default FakecasesensitiveparamsPutResponses.EndpointResponse put(PutRequest request) throws IOException, InterruptedException, ValidationException, NotImplementedException, ApiException { + return PutProvider.put(request, getApiConfiguration(), getSchemaConfiguration(), getClient()); + } + } + + public interface CaseSensitiveParamsOperation { + ApiConfiguration getApiConfiguration(); + SchemaConfiguration getSchemaConfiguration(); + HttpClient getClient(); + default FakecasesensitiveparamsPutResponses.EndpointResponse caseSensitiveParams(PutRequest request) throws IOException, InterruptedException, ValidationException, NotImplementedException, ApiException { + return PutProvider.put(request, getApiConfiguration(), getSchemaConfiguration(), getClient()); + } + } + + public static class Put extends ApiClient implements PutOperation { + public Put(ApiConfiguration apiConfiguration, SchemaConfiguration schemaConfiguration) { + super(apiConfiguration, schemaConfiguration); + } + } + + public static class PutRequest { + public FakecasesensitiveparamsPutQueryParameters.QueryParametersMap queryParameters; + public RootServerInfo.@Nullable ServerIndex serverIndex; + public @Nullable Duration timeout; + + public PutRequest( + FakecasesensitiveparamsPutQueryParameters.QueryParametersMap queryParameters, + RootServerInfo.@Nullable ServerIndex serverIndex, + @Nullable Duration timeout + ) { + this.queryParameters = queryParameters; + this.serverIndex = serverIndex; + this.timeout = timeout; + } + } + + public static class PutNullableRequest { + public FakecasesensitiveparamsPutQueryParameters.@Nullable QueryParametersMap queryParameters; + public RootServerInfo.@Nullable ServerIndex serverIndex; + public @Nullable Duration timeout; + } + + public interface SetterForServerIndex { + PutNullableRequest getInstance(); + T getBuilderAfterServerIndex(PutNullableRequest instance); + default T serverIndex(RootServerInfo.ServerIndex serverIndex) { + var instance = getInstance(); + instance.serverIndex = serverIndex; + return getBuilderAfterServerIndex(instance); + } + } + + public interface SetterForTimeout { + PutNullableRequest getInstance(); + T getBuilderAfterTimeout(PutNullableRequest instance); + default T timeout(Duration timeout) { + var instance = getInstance(); + instance.timeout = timeout; + return getBuilderAfterTimeout(instance); + } + } + + public interface SetterForQueryParameters { + PutNullableRequest getInstance(); + T getBuilderAfterQueryParameters(PutNullableRequest instance); + default T queryParameters(FakecasesensitiveparamsPutQueryParameters.QueryParametersMap queryParameters) { + var instance = getInstance(); + instance.queryParameters = queryParameters; + return getBuilderAfterQueryParameters(instance); + } + } + + public static class Put0RequestBuilder implements SetterForServerIndex, SetterForTimeout { + private final PutNullableRequest instance; + + public Put0RequestBuilder(PutNullableRequest instance) { + this.instance = instance; + } + + public PutRequest build() { + var queryParameters = instance.queryParameters; + if (queryParameters == null) { + throw new RuntimeException("invalid null value for required parameter"); + } + return new PutRequest( + queryParameters, + instance.serverIndex, + instance.timeout + ); + } + + public PutNullableRequest getInstance() { + return instance; + } + + public Put0RequestBuilder getBuilderAfterServerIndex(PutNullableRequest instance) { + return this; + } + + public Put0RequestBuilder getBuilderAfterTimeout(PutNullableRequest instance) { + return this; + } + } + public static class PutRequestBuilder implements SetterForQueryParameters { + private final PutNullableRequest instance; + + public PutRequestBuilder() { + this.instance = new PutNullableRequest(); + } + + public PutNullableRequest getInstance() { + return instance; + } + + public Put0RequestBuilder getBuilderAfterQueryParameters(PutNullableRequest instance) { + return new Put0RequestBuilder(instance); + } + } +} diff --git a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/fakecasesensitiveparams/put/FakecasesensitiveparamsPutQueryParameters.kt b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/fakecasesensitiveparams/put/FakecasesensitiveparamsPutQueryParameters.kt new file mode 100644 index 00000000000..3618c76bc36 --- /dev/null +++ b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/fakecasesensitiveparams/put/FakecasesensitiveparamsPutQueryParameters.kt @@ -0,0 +1,343 @@ +package org.openapijsonschematools.client.paths.fakecasesensitiveparams.put; +import java.util.ArrayList; +import java.util.HashSet; +import java.util.LinkedHashMap; +import java.util.LinkedHashSet; +import java.util.List; +import java.util.Map; +import java.util.Objects; +import java.util.Set; +import org.checkerframework.checker.nullness.qual.Nullable; +import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags; +import org.openapijsonschematools.client.configurations.SchemaConfiguration; +import org.openapijsonschematools.client.exceptions.UnsetPropertyException; +import org.openapijsonschematools.client.exceptions.ValidationException; +import org.openapijsonschematools.client.paths.fakecasesensitiveparams.put.parameters.parameter0.Schema0; +import org.openapijsonschematools.client.paths.fakecasesensitiveparams.put.parameters.parameter1.Schema1; +import org.openapijsonschematools.client.paths.fakecasesensitiveparams.put.parameters.parameter2.Schema2; +import org.openapijsonschematools.client.schemas.AnyTypeJsonSchema; +import org.openapijsonschematools.client.schemas.GenericBuilder; +import org.openapijsonschematools.client.schemas.NotAnyTypeJsonSchema; +import org.openapijsonschematools.client.schemas.validation.FrozenMap; +import org.openapijsonschematools.client.schemas.validation.JsonSchema; +import org.openapijsonschematools.client.schemas.validation.JsonSchemaInfo; +import org.openapijsonschematools.client.schemas.validation.MapSchemaValidator; +import org.openapijsonschematools.client.schemas.validation.MapUtils; +import org.openapijsonschematools.client.schemas.validation.PathToSchemasMap; +import org.openapijsonschematools.client.schemas.validation.PropertyEntry; +import org.openapijsonschematools.client.schemas.validation.ValidationMetadata; + +public class FakecasesensitiveparamsPutQueryParameters { + // nest classes so all schemas and input/output classes can be public + + + public static class AdditionalProperties extends NotAnyTypeJsonSchema.NotAnyTypeJsonSchema1 { + // NotAnyTypeSchema + private static @Nullable AdditionalProperties instance = null; + public static AdditionalProperties getInstance() { + if (instance == null) { + instance = new AdditionalProperties(); + } + return instance; + } + } + + + public static class QueryParametersMap extends FrozenMap<@Nullable Object> { + protected QueryParametersMap(FrozenMap<@Nullable Object> m) { + super(m); + } + public static final Set requiredKeys = Set.of( + "SomeVar", + "someVar", + "some_var" + ); + public static final Set optionalKeys = Set.of(); + public static QueryParametersMap of(Map arg, SchemaConfiguration configuration) throws ValidationException { + return FakecasesensitiveparamsPutQueryParameters1.getInstance().validate(arg, configuration); + } + + public String SomeVar() { + @Nullable Object value = get("SomeVar"); + if (!(value instanceof String)) { + throw new RuntimeException("Invalid value stored for SomeVar"); + } + return (String) value; + } + + public String someVar() { + @Nullable Object value = get("someVar"); + if (!(value instanceof String)) { + throw new RuntimeException("Invalid value stored for someVar"); + } + return (String) value; + } + + public String some_var() { + @Nullable Object value = get("some_var"); + if (!(value instanceof String)) { + throw new RuntimeException("Invalid value stored for some_var"); + } + return (String) value; + } + } + + public interface SetterForSomeVar2 { + Map getInstance(); + T getBuilderAfterSomeVar2(Map instance); + + default T SomeVar(String value) { + var instance = getInstance(); + instance.put("SomeVar", value); + return getBuilderAfterSomeVar2(instance); + } + } + + public interface SetterForSomeVar { + Map getInstance(); + T getBuilderAfterSomeVar(Map instance); + + default T someVar(String value) { + var instance = getInstance(); + instance.put("someVar", value); + return getBuilderAfterSomeVar(instance); + } + } + + public interface SetterForSomeVar1 { + Map getInstance(); + T getBuilderAfterSomeVar1(Map instance); + + default T some_var(String value) { + var instance = getInstance(); + instance.put("some_var", value); + return getBuilderAfterSomeVar1(instance); + } + } + + public static class QueryParametersMap000Builder implements GenericBuilder> { + private final Map instance; + private static final Set knownKeys = Set.of( + "SomeVar", + "someVar", + "some_var" + ); + public Set getKnownKeys() { + return knownKeys; + } + public QueryParametersMap000Builder(Map instance) { + this.instance = instance; + } + public Map build() { + return instance; + } + } + + public static class QueryParametersMap001Builder implements SetterForSomeVar1 { + private final Map instance; + public QueryParametersMap001Builder(Map instance) { + this.instance = instance; + } + public Map getInstance() { + return instance; + } + public QueryParametersMap000Builder getBuilderAfterSomeVar1(Map instance) { + return new QueryParametersMap000Builder(instance); + } + } + + public static class QueryParametersMap010Builder implements SetterForSomeVar { + private final Map instance; + public QueryParametersMap010Builder(Map instance) { + this.instance = instance; + } + public Map getInstance() { + return instance; + } + public QueryParametersMap000Builder getBuilderAfterSomeVar(Map instance) { + return new QueryParametersMap000Builder(instance); + } + } + + public static class QueryParametersMap011Builder implements SetterForSomeVar, SetterForSomeVar1 { + private final Map instance; + public QueryParametersMap011Builder(Map instance) { + this.instance = instance; + } + public Map getInstance() { + return instance; + } + public QueryParametersMap001Builder getBuilderAfterSomeVar(Map instance) { + return new QueryParametersMap001Builder(instance); + } + public QueryParametersMap010Builder getBuilderAfterSomeVar1(Map instance) { + return new QueryParametersMap010Builder(instance); + } + } + + public static class QueryParametersMap100Builder implements SetterForSomeVar2 { + private final Map instance; + public QueryParametersMap100Builder(Map instance) { + this.instance = instance; + } + public Map getInstance() { + return instance; + } + public QueryParametersMap000Builder getBuilderAfterSomeVar2(Map instance) { + return new QueryParametersMap000Builder(instance); + } + } + + public static class QueryParametersMap101Builder implements SetterForSomeVar2, SetterForSomeVar1 { + private final Map instance; + public QueryParametersMap101Builder(Map instance) { + this.instance = instance; + } + public Map getInstance() { + return instance; + } + public QueryParametersMap001Builder getBuilderAfterSomeVar2(Map instance) { + return new QueryParametersMap001Builder(instance); + } + public QueryParametersMap100Builder getBuilderAfterSomeVar1(Map instance) { + return new QueryParametersMap100Builder(instance); + } + } + + public static class QueryParametersMap110Builder implements SetterForSomeVar2, SetterForSomeVar { + private final Map instance; + public QueryParametersMap110Builder(Map instance) { + this.instance = instance; + } + public Map getInstance() { + return instance; + } + public QueryParametersMap010Builder getBuilderAfterSomeVar2(Map instance) { + return new QueryParametersMap010Builder(instance); + } + public QueryParametersMap100Builder getBuilderAfterSomeVar(Map instance) { + return new QueryParametersMap100Builder(instance); + } + } + + public static class QueryParametersMapBuilder implements SetterForSomeVar2, SetterForSomeVar, SetterForSomeVar1 { + private final Map instance; + public QueryParametersMapBuilder() { + this.instance = new LinkedHashMap<>(); + } + public Map getInstance() { + return instance; + } + public QueryParametersMap011Builder getBuilderAfterSomeVar2(Map instance) { + return new QueryParametersMap011Builder(instance); + } + public QueryParametersMap101Builder getBuilderAfterSomeVar(Map instance) { + return new QueryParametersMap101Builder(instance); + } + public QueryParametersMap110Builder getBuilderAfterSomeVar1(Map instance) { + return new QueryParametersMap110Builder(instance); + } + } + + + public sealed interface FakecasesensitiveparamsPutQueryParameters1Boxed permits FakecasesensitiveparamsPutQueryParameters1BoxedMap { + @Nullable Object getData(); + } + + public record FakecasesensitiveparamsPutQueryParameters1BoxedMap(QueryParametersMap data) implements FakecasesensitiveparamsPutQueryParameters1Boxed { + @Override + public @Nullable Object getData() { + return data; + } + } + + + public static class FakecasesensitiveparamsPutQueryParameters1 extends JsonSchema implements MapSchemaValidator { + private static @Nullable FakecasesensitiveparamsPutQueryParameters1 instance = null; + + protected FakecasesensitiveparamsPutQueryParameters1() { + super(new JsonSchemaInfo() + .type(Set.of(Map.class)) + .properties(Map.ofEntries( + new PropertyEntry("someVar", Schema0.Schema01.class), + new PropertyEntry("some_var", Schema2.Schema21.class), + new PropertyEntry("SomeVar", Schema1.Schema11.class) + )) + .required(Set.of( + "SomeVar", + "someVar", + "some_var" + )) + .additionalProperties(AdditionalProperties.class) + ); + } + + public static FakecasesensitiveparamsPutQueryParameters1 getInstance() { + if (instance == null) { + instance = new FakecasesensitiveparamsPutQueryParameters1(); + } + return instance; + } + + 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 RuntimeException("Invalid non-string key value"); + } + String propertyName = (String) entryKey; + List propertyPathToItem = new ArrayList<>(pathToItem); + propertyPathToItem.add(propertyName); + Object value = entry.getValue(); + LinkedHashMap, Nothing?> schemas = pathToSchemas.get(propertyPathToItem); + if (schemas == null) { + throw new RuntimeException("Validation result is invalid, schemas must exist for a pathToItem"); + } + JsonSchema propertySchema = schemas.entrySet().iterator().next().getKey(); + @Nullable Object propertyInstance = propertySchema.getNewInstance(value, propertyPathToItem, pathToSchemas); + properties.put(propertyName, propertyInstance); + } + FrozenMap<@Nullable Object> castProperties = new FrozenMap<>(properties); + return new QueryParametersMap(castProperties); + } + + 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); + SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().build())); + ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, new PathToSchemasMap(), new LinkedHashSet<>()); + PathToSchemasMap pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet); + return getNewInstance(castArg, validationMetadata.pathToItem(), pathToSchemasMap); + } + + + @Override + public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws 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"); + } + @Override + public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { + if (arg instanceof Map) { + return getNewInstance((Map) arg, pathToItem, pathToSchemas); + } + throw new RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); + } + @Override + public FakecasesensitiveparamsPutQueryParameters1BoxedMap validateAndBox(Map arg, SchemaConfiguration configuration) throws ValidationException { + return new FakecasesensitiveparamsPutQueryParameters1BoxedMap(validate(arg, configuration)); + } + @Override + public FakecasesensitiveparamsPutQueryParameters1Boxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { + 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"); + } + } + +} diff --git a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/fakecasesensitiveparams/put/FakecasesensitiveparamsPutResponses.kt b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/fakecasesensitiveparams/put/FakecasesensitiveparamsPutResponses.kt new file mode 100644 index 00000000000..daed34aa092 --- /dev/null +++ b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/fakecasesensitiveparams/put/FakecasesensitiveparamsPutResponses.kt @@ -0,0 +1,53 @@ +package org.openapijsonschematools.client.paths.fakecasesensitiveparams.put; + +import org.openapijsonschematools.client.paths.fakecasesensitiveparams.put.responses.FakecasesensitiveparamsPutCode200Response; +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; +import org.checkerframework.checker.nullness.qual.Nullable; + +import java.net.http.HttpResponse; +import java.util.Map; +import java.util.AbstractMap; + +public class FakecasesensitiveparamsPutResponses { + public sealed interface EndpointResponse permits EndpointFakecasesensitiveparamsPutCode200Response {} + + public record EndpointFakecasesensitiveparamsPutCode200Response( + HttpResponse response, + Nothing? body, + Nothing? headers + ) implements EndpointResponse, ApiResponse{ + } + + public sealed interface StatusCodeResponseDeserializer permits StatusFakecasesensitiveparamsPutCode200ResponseDeserializer {} + + public static final class StatusFakecasesensitiveparamsPutCode200ResponseDeserializer extends FakecasesensitiveparamsPutCode200Response.FakecasesensitiveparamsPutCode200Response1 implements StatusCodeResponseDeserializer { + } + + public static final class FakecasesensitiveparamsPutResponses1 implements ResponsesDeserializer { + private final Map statusCodeToResponseDeserializer; + public FakecasesensitiveparamsPutResponses1() { + this.statusCodeToResponseDeserializer = Map.ofEntries( + new AbstractMap.SimpleEntry<>("200", new StatusFakecasesensitiveparamsPutCode200ResponseDeserializer()) + ); + } + + 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) { + throw new ApiException( + "Invalid response statusCode="+statusCode+" has no response defined in the openapi document", + response + ); + } + StatusFakecasesensitiveparamsPutCode200ResponseDeserializer castDeserializer = (StatusFakecasesensitiveparamsPutCode200ResponseDeserializer) statusCodeDeserializer; + var deserializedResponse = castDeserializer.deserialize(response, configuration); + return new EndpointFakecasesensitiveparamsPutCode200Response(response, deserializedResponse.body(), deserializedResponse.headers()); + } + } +} diff --git a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/fakecasesensitiveparams/put/Parameters.kt b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/fakecasesensitiveparams/put/Parameters.kt new file mode 100644 index 00000000000..e153b47414a --- /dev/null +++ b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/fakecasesensitiveparams/put/Parameters.kt @@ -0,0 +1,24 @@ +package org.openapijsonschematools.client.paths.fakecasesensitiveparams.put; + +import org.openapijsonschematools.client.paths.fakecasesensitiveparams.put.parameters.Parameter0; +import org.openapijsonschematools.client.paths.fakecasesensitiveparams.put.parameters.Parameter1; +import org.openapijsonschematools.client.paths.fakecasesensitiveparams.put.parameters.Parameter2; +import org.openapijsonschematools.client.parameter.QuerySerializer; + +import java.util.Map; +import java.util.AbstractMap; + +public class Parameters { + + public static class QueryParametersSerializer extends QuerySerializer { + public QueryParametersSerializer() { + super( + Map.ofEntries( + new AbstractMap.SimpleEntry<>("someVar", new Parameter0.Parameter01()), + new AbstractMap.SimpleEntry<>("SomeVar", new Parameter1.Parameter11()), + new AbstractMap.SimpleEntry<>("some_var", new Parameter2.Parameter21()) + ) + ); + } + } +} diff --git a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/fakecasesensitiveparams/put/parameters/Parameter0.kt b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/fakecasesensitiveparams/put/parameters/Parameter0.kt new file mode 100644 index 00000000000..96db6d8662c --- /dev/null +++ b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/fakecasesensitiveparams/put/parameters/Parameter0.kt @@ -0,0 +1,23 @@ +package org.openapijsonschematools.client.paths.fakecasesensitiveparams.put.parameters; + +import org.openapijsonschematools.client.parameter.ParameterStyle; +import org.openapijsonschematools.client.parameter.ParameterInType; +import org.openapijsonschematools.client.parameter.SchemaParameter; +import org.openapijsonschematools.client.paths.fakecasesensitiveparams.put.parameters.parameter0.Schema0; + +public class Parameter0 { + + public static class Parameter01 extends SchemaParameter { + public Parameter01() { + super( + "someVar", + ParameterInType.QUERY, + true, + ParameterStyle.FORM, + true, + false, + Schema0.Schema01.getInstance() + ); + } + } +} diff --git a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/fakecasesensitiveparams/put/parameters/Parameter1.kt b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/fakecasesensitiveparams/put/parameters/Parameter1.kt new file mode 100644 index 00000000000..9923c6e1aee --- /dev/null +++ b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/fakecasesensitiveparams/put/parameters/Parameter1.kt @@ -0,0 +1,23 @@ +package org.openapijsonschematools.client.paths.fakecasesensitiveparams.put.parameters; + +import org.openapijsonschematools.client.parameter.ParameterStyle; +import org.openapijsonschematools.client.parameter.ParameterInType; +import org.openapijsonschematools.client.parameter.SchemaParameter; +import org.openapijsonschematools.client.paths.fakecasesensitiveparams.put.parameters.parameter1.Schema1; + +public class Parameter1 { + + public static class Parameter11 extends SchemaParameter { + public Parameter11() { + super( + "SomeVar", + ParameterInType.QUERY, + true, + ParameterStyle.FORM, + true, + false, + Schema1.Schema11.getInstance() + ); + } + } +} diff --git a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/fakecasesensitiveparams/put/parameters/Parameter2.kt b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/fakecasesensitiveparams/put/parameters/Parameter2.kt new file mode 100644 index 00000000000..c3b8320db0f --- /dev/null +++ b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/fakecasesensitiveparams/put/parameters/Parameter2.kt @@ -0,0 +1,23 @@ +package org.openapijsonschematools.client.paths.fakecasesensitiveparams.put.parameters; + +import org.openapijsonschematools.client.parameter.ParameterStyle; +import org.openapijsonschematools.client.parameter.ParameterInType; +import org.openapijsonschematools.client.parameter.SchemaParameter; +import org.openapijsonschematools.client.paths.fakecasesensitiveparams.put.parameters.parameter2.Schema2; + +public class Parameter2 { + + public static class Parameter21 extends SchemaParameter { + public Parameter21() { + super( + "some_var", + ParameterInType.QUERY, + true, + ParameterStyle.FORM, + true, + false, + Schema2.Schema21.getInstance() + ); + } + } +} diff --git a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/fakecasesensitiveparams/put/parameters/parameter0/Schema0.kt b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/fakecasesensitiveparams/put/parameters/parameter0/Schema0.kt new file mode 100644 index 00000000000..82b36aec229 --- /dev/null +++ b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/fakecasesensitiveparams/put/parameters/parameter0/Schema0.kt @@ -0,0 +1,19 @@ +package org.openapijsonschematools.client.paths.fakecasesensitiveparams.put.parameters.parameter0; +import org.checkerframework.checker.nullness.qual.Nullable; +import org.openapijsonschematools.client.schemas.StringJsonSchema; + +public class Schema0 extends StringJsonSchema { + // nest classes so all schemas and input/output classes can be public + + + public static class Schema01 extends StringJsonSchema.StringJsonSchema1 { + private static @Nullable Schema01 instance = null; + public static Schema01 getInstance() { + if (instance == null) { + instance = new Schema01(); + } + return instance; + } + } + +} diff --git a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/fakecasesensitiveparams/put/parameters/parameter1/Schema1.kt b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/fakecasesensitiveparams/put/parameters/parameter1/Schema1.kt new file mode 100644 index 00000000000..8fe5c279258 --- /dev/null +++ b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/fakecasesensitiveparams/put/parameters/parameter1/Schema1.kt @@ -0,0 +1,19 @@ +package org.openapijsonschematools.client.paths.fakecasesensitiveparams.put.parameters.parameter1; +import org.checkerframework.checker.nullness.qual.Nullable; +import org.openapijsonschematools.client.schemas.StringJsonSchema; + +public class Schema1 extends StringJsonSchema { + // nest classes so all schemas and input/output classes can be public + + + public static class Schema11 extends StringJsonSchema.StringJsonSchema1 { + private static @Nullable Schema11 instance = null; + public static Schema11 getInstance() { + if (instance == null) { + instance = new Schema11(); + } + return instance; + } + } + +} diff --git a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/fakecasesensitiveparams/put/parameters/parameter2/Schema2.kt b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/fakecasesensitiveparams/put/parameters/parameter2/Schema2.kt new file mode 100644 index 00000000000..ce17de1e932 --- /dev/null +++ b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/fakecasesensitiveparams/put/parameters/parameter2/Schema2.kt @@ -0,0 +1,19 @@ +package org.openapijsonschematools.client.paths.fakecasesensitiveparams.put.parameters.parameter2; +import org.checkerframework.checker.nullness.qual.Nullable; +import org.openapijsonschematools.client.schemas.StringJsonSchema; + +public class Schema2 extends StringJsonSchema { + // nest classes so all schemas and input/output classes can be public + + + public static class Schema21 extends StringJsonSchema.StringJsonSchema1 { + private static @Nullable Schema21 instance = null; + public static Schema21 getInstance() { + if (instance == null) { + instance = new Schema21(); + } + return instance; + } + } + +} diff --git a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/fakecasesensitiveparams/put/responses/FakecasesensitiveparamsPutCode200Response.kt b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/fakecasesensitiveparams/put/responses/FakecasesensitiveparamsPutCode200Response.kt new file mode 100644 index 00000000000..72eb0975e3a --- /dev/null +++ b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/fakecasesensitiveparams/put/responses/FakecasesensitiveparamsPutCode200Response.kt @@ -0,0 +1,7 @@ +package org.openapijsonschematools.client.paths.fakecasesensitiveparams.put.responses; + +import org.openapijsonschematools.client.components.responses.SuccessDescriptionOnly; + +public class FakecasesensitiveparamsPutCode200Response extends SuccessDescriptionOnly { + public static class FakecasesensitiveparamsPutCode200Response1 extends SuccessDescriptionOnly1 {} +} diff --git a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/fakeclassnametest/FakeclassnametestPatch.kt b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/fakeclassnametest/FakeclassnametestPatch.kt new file mode 100644 index 00000000000..798f569e7ab --- /dev/null +++ b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/fakeclassnametest/FakeclassnametestPatch.kt @@ -0,0 +1,215 @@ +package org.openapijsonschematools.client.paths.fakeclassnametest; + +import org.checkerframework.checker.nullness.qual.Nullable; +import org.openapijsonschematools.client.RootServerInfo; +import org.openapijsonschematools.client.paths.fakeclassnametest.patch.FakeclassnametestPatchSecurityInfo; +import org.openapijsonschematools.client.paths.fakeclassnametest.patch.FakeclassnametestPatchRequestBody; +import org.openapijsonschematools.client.paths.fakeclassnametest.patch.FakeclassnametestPatchResponses; +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.requestbody.SerializedRequestBody; +import org.openapijsonschematools.client.paths.Fakeclassnametest; +import org.openapijsonschematools.client.securityrequirementobjects.SecurityRequirementObject; +import org.openapijsonschematools.client.securityrequirementobjects.AuthApplier; + +import java.io.IOException; +import java.util.ArrayList; +import java.net.http.HttpClient; +import java.net.http.HttpRequest; +import java.time.Duration; +import java.util.List; +import java.util.Map; + +public class FakeclassnametestPatch { + private static class PatchProvider extends AuthApplier { + private static final String method = "patch"; + + public static FakeclassnametestPatchResponses.EndpointResponse patch( + PatchRequest request, + ApiConfiguration apiConfiguration, + SchemaConfiguration schemaConfiguration, + HttpClient client + ) throws IOException, InterruptedException, ValidationException, NotImplementedException, ApiException { + Map> headers = apiConfiguration.getDefaultHeaders(); + + SerializedRequestBody serializedRequestBody = new FakeclassnametestPatchRequestBody.FakeclassnametestPatchRequestBody1().serialize( + request.requestBody + ); + var contentTypeHeaderValues = headers.getOrDefault("Content-Type", new ArrayList<>()); + contentTypeHeaderValues.add(serializedRequestBody.contentType); + HttpRequest.BodyPublisher bodyPublisher = serializedRequestBody.bodyPublisher; + // TODO set this to a map if there is a query security scheme + @Nullable Map queryMap = null; + String host = apiConfiguration.getServer(request.serverIndex).url(); + SecurityRequirementObject securityRequirementObject = apiConfiguration.getSecurityRequirementObject(request.securityIndex); + updateParamsForAuth( + securityRequirementObject, + headers, + Fakeclassnametest.path, + method, + bodyPublisher, + queryMap, + apiConfiguration + ); + + String url = host + Fakeclassnametest.path; + var httpRequest = RestClient.getRequest( + url, + method, + bodyPublisher, + headers, + request.timeout + ); + var response = RestClient.getResponse(httpRequest, client); + var responsesDeserializer = new FakeclassnametestPatchResponses.FakeclassnametestPatchResponses1(); + return responsesDeserializer.deserialize(response, schemaConfiguration); + } + } + + public interface PatchOperation { + ApiConfiguration getApiConfiguration(); + SchemaConfiguration getSchemaConfiguration(); + HttpClient getClient(); + default FakeclassnametestPatchResponses.EndpointResponse patch(PatchRequest request) throws IOException, InterruptedException, ValidationException, NotImplementedException, ApiException { + return PatchProvider.patch(request, getApiConfiguration(), getSchemaConfiguration(), getClient()); + } + } + + public interface ClassnameOperation { + ApiConfiguration getApiConfiguration(); + SchemaConfiguration getSchemaConfiguration(); + HttpClient getClient(); + default FakeclassnametestPatchResponses.EndpointResponse classname(PatchRequest request) throws IOException, InterruptedException, ValidationException, NotImplementedException, ApiException { + return PatchProvider.patch(request, getApiConfiguration(), getSchemaConfiguration(), getClient()); + } + } + + public static class Patch extends ApiClient implements PatchOperation { + public Patch(ApiConfiguration apiConfiguration, SchemaConfiguration schemaConfiguration) { + super(apiConfiguration, schemaConfiguration); + } + } + + public static class PatchRequest { + public FakeclassnametestPatchRequestBody.SealedRequestBody requestBody; + public RootServerInfo.@Nullable ServerIndex serverIndex; + public FakeclassnametestPatchSecurityInfo.@Nullable SecurityIndex securityIndex; + public @Nullable Duration timeout; + + public PatchRequest( + FakeclassnametestPatchRequestBody.SealedRequestBody requestBody, + RootServerInfo.@Nullable ServerIndex serverIndex, + FakeclassnametestPatchSecurityInfo.@Nullable SecurityIndex securityIndex, + @Nullable Duration timeout + ) { + this.requestBody = requestBody; + this.serverIndex = serverIndex; + this.securityIndex = securityIndex; + this.timeout = timeout; + } + } + + public static class PatchNullableRequest { + public FakeclassnametestPatchRequestBody.@Nullable SealedRequestBody requestBody; + public RootServerInfo.@Nullable ServerIndex serverIndex; + public FakeclassnametestPatchSecurityInfo.@Nullable SecurityIndex securityIndex; + public @Nullable Duration timeout; + } + + public interface SetterForServerIndex { + PatchNullableRequest getInstance(); + T getBuilderAfterServerIndex(PatchNullableRequest instance); + default T serverIndex(RootServerInfo.ServerIndex serverIndex) { + var instance = getInstance(); + instance.serverIndex = serverIndex; + return getBuilderAfterServerIndex(instance); + } + } + + public interface SetterForSecurityIndex { + PatchNullableRequest getInstance(); + T getBuilderAfterSecurityIndex(PatchNullableRequest instance); + default T securityIndex(FakeclassnametestPatchSecurityInfo.SecurityIndex securityIndex) { + var instance = getInstance(); + instance.securityIndex = securityIndex; + return getBuilderAfterSecurityIndex(instance); + } + } + + public interface SetterForTimeout { + PatchNullableRequest getInstance(); + T getBuilderAfterTimeout(PatchNullableRequest instance); + default T timeout(Duration timeout) { + var instance = getInstance(); + instance.timeout = timeout; + return getBuilderAfterTimeout(instance); + } + } + + public interface SetterForRequestBody { + PatchNullableRequest getInstance(); + T getBuilderAfterRequestBody(PatchNullableRequest instance); + default T requestBody(FakeclassnametestPatchRequestBody.SealedRequestBody requestBody) { + var instance = getInstance(); + instance.requestBody = requestBody; + return getBuilderAfterRequestBody(instance); + } + } + + public static class Patch0RequestBuilder implements SetterForServerIndex, SetterForSecurityIndex, SetterForTimeout { + private final PatchNullableRequest instance; + + public Patch0RequestBuilder(PatchNullableRequest instance) { + this.instance = instance; + } + + public PatchRequest build() { + var requestBody = instance.requestBody; + if (requestBody == null) { + throw new RuntimeException("invalid null value for required parameter"); + } + return new PatchRequest( + requestBody, + instance.serverIndex, + instance.securityIndex, + instance.timeout + ); + } + + public PatchNullableRequest getInstance() { + return instance; + } + + public Patch0RequestBuilder getBuilderAfterServerIndex(PatchNullableRequest instance) { + return this; + } + + public Patch0RequestBuilder getBuilderAfterSecurityIndex(PatchNullableRequest instance) { + return this; + } + + public Patch0RequestBuilder getBuilderAfterTimeout(PatchNullableRequest instance) { + return this; + } + } + public static class PatchRequestBuilder implements SetterForRequestBody { + private final PatchNullableRequest instance; + + public PatchRequestBuilder() { + this.instance = new PatchNullableRequest(); + } + + public PatchNullableRequest getInstance() { + return instance; + } + + public Patch0RequestBuilder getBuilderAfterRequestBody(PatchNullableRequest instance) { + return new Patch0RequestBuilder(instance); + } + } +} diff --git a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/fakeclassnametest/patch/FakeclassnametestPatchRequestBody.kt b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/fakeclassnametest/patch/FakeclassnametestPatchRequestBody.kt new file mode 100644 index 00000000000..69e81d0f4bc --- /dev/null +++ b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/fakeclassnametest/patch/FakeclassnametestPatchRequestBody.kt @@ -0,0 +1,7 @@ +package org.openapijsonschematools.client.paths.fakeclassnametest.patch; + +import org.openapijsonschematools.client.components.requestbodies.Client; + +public class FakeclassnametestPatchRequestBody extends Client { + public static class FakeclassnametestPatchRequestBody1 extends Client1 {} +} diff --git a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/fakeclassnametest/patch/FakeclassnametestPatchResponses.kt b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/fakeclassnametest/patch/FakeclassnametestPatchResponses.kt new file mode 100644 index 00000000000..7428a4013dc --- /dev/null +++ b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/fakeclassnametest/patch/FakeclassnametestPatchResponses.kt @@ -0,0 +1,53 @@ +package org.openapijsonschematools.client.paths.fakeclassnametest.patch; + +import org.openapijsonschematools.client.paths.fakeclassnametest.patch.responses.FakeclassnametestPatchCode200Response; +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; +import org.checkerframework.checker.nullness.qual.Nullable; + +import java.net.http.HttpResponse; +import java.util.Map; +import java.util.AbstractMap; + +public class FakeclassnametestPatchResponses { + public sealed interface EndpointResponse permits EndpointFakeclassnametestPatchCode200Response {} + + public record EndpointFakeclassnametestPatchCode200Response( + HttpResponse response, + FakeclassnametestPatchCode200Response.SealedResponseBody body, + Nothing? headers + ) implements EndpointResponse, ApiResponse{ + } + + public sealed interface StatusCodeResponseDeserializer permits StatusFakeclassnametestPatchCode200ResponseDeserializer {} + + public static final class StatusFakeclassnametestPatchCode200ResponseDeserializer extends FakeclassnametestPatchCode200Response.FakeclassnametestPatchCode200Response1 implements StatusCodeResponseDeserializer { + } + + public static final class FakeclassnametestPatchResponses1 implements ResponsesDeserializer { + private final Map statusCodeToResponseDeserializer; + public FakeclassnametestPatchResponses1() { + this.statusCodeToResponseDeserializer = Map.ofEntries( + new AbstractMap.SimpleEntry<>("200", new StatusFakeclassnametestPatchCode200ResponseDeserializer()) + ); + } + + 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) { + throw new ApiException( + "Invalid response statusCode="+statusCode+" has no response defined in the openapi document", + response + ); + } + StatusFakeclassnametestPatchCode200ResponseDeserializer castDeserializer = (StatusFakeclassnametestPatchCode200ResponseDeserializer) statusCodeDeserializer; + var deserializedResponse = castDeserializer.deserialize(response, configuration); + return new EndpointFakeclassnametestPatchCode200Response(response, deserializedResponse.body(), deserializedResponse.headers()); + } + } +} diff --git a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/fakeclassnametest/patch/FakeclassnametestPatchSecurityInfo.kt b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/fakeclassnametest/patch/FakeclassnametestPatchSecurityInfo.kt new file mode 100644 index 00000000000..a4a739aad43 --- /dev/null +++ b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/fakeclassnametest/patch/FakeclassnametestPatchSecurityInfo.kt @@ -0,0 +1,24 @@ +package org.openapijsonschematools.client.paths.fakeclassnametest.patch; + +import org.openapijsonschematools.client.paths.fakeclassnametest.patch.security.FakeclassnametestPatchSecurityRequirementObject0; +import org.openapijsonschematools.client.securityrequirementobjects.SecurityRequirementObject; +import org.openapijsonschematools.client.securityrequirementobjects.SecurityRequirementObjectProvider; + +public class FakeclassnametestPatchSecurityInfo { + public static class FakeclassnametestPatchSecurityInfo1 implements SecurityRequirementObjectProvider { + public final FakeclassnametestPatchSecurityRequirementObject0 security0; + + public FakeclassnametestPatchSecurityInfo1() { + security0 = new FakeclassnametestPatchSecurityRequirementObject0(); + } + + @Override + public SecurityRequirementObject getSecurityRequirementObject(SecurityIndex securityIndex) { + return security0; + } + } + + public enum SecurityIndex { + SECURITY_0 + } +} \ No newline at end of file diff --git a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/fakeclassnametest/patch/responses/FakeclassnametestPatchCode200Response.kt b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/fakeclassnametest/patch/responses/FakeclassnametestPatchCode200Response.kt new file mode 100644 index 00000000000..9c3f649fdf4 --- /dev/null +++ b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/fakeclassnametest/patch/responses/FakeclassnametestPatchCode200Response.kt @@ -0,0 +1,63 @@ +package org.openapijsonschematools.client.paths.fakeclassnametest.patch.responses; + +import org.openapijsonschematools.client.configurations.SchemaConfiguration; +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; + +import java.util.AbstractMap; +import java.util.Map; +import java.net.http.HttpResponse; +import java.net.http.HttpHeaders; + +public class FakeclassnametestPatchCode200Response { + public sealed interface SealedMediaType permits ApplicationjsonMediaType {} + + public record ApplicationjsonMediaType(ApplicationjsonSchema.ApplicationjsonSchema1 schema) implements SealedMediaType, MediaType { + public ApplicationjsonMediaType() { + this(ApplicationjsonSchema.ApplicationjsonSchema1.getInstance()); + } + @Override + public Nothing? encoding() { + return null; + } + } + public sealed interface SealedResponseBody permits ApplicationjsonResponseBody {} + public record ApplicationjsonResponseBody(ApplicationjsonSchema.Client1Boxed body) implements SealedResponseBody { } + + public static class FakeclassnametestPatchCode200Response1 extends ResponseDeserializer { + public FakeclassnametestPatchCode200Response1() { + super( + Map.ofEntries( + new AbstractMap.SimpleEntry<>("application/json", new ApplicationjsonMediaType()) + ) + ); + } + + @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); + } + + @Override + protected Nothing? getHeaders(HttpHeaders headers, SchemaConfiguration configuration) { + return null; + } + } + + @SuppressWarnings("serial") + public static class ResponseApiException extends ApiException { + public DeserializedHttpResponse deserializedResponse; + + public ResponseApiException(String s, HttpResponse response, DeserializedHttpResponse deserializedResponse) { + super(s, response); + this.deserializedResponse = deserializedResponse; + } + } +} diff --git a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/fakeclassnametest/patch/responses/code200response/content/applicationjson/ApplicationjsonSchema.kt b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/fakeclassnametest/patch/responses/code200response/content/applicationjson/ApplicationjsonSchema.kt new file mode 100644 index 00000000000..ba79861d2e9 --- /dev/null +++ b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/fakeclassnametest/patch/responses/code200response/content/applicationjson/ApplicationjsonSchema.kt @@ -0,0 +1,19 @@ +package org.openapijsonschematools.client.paths.fakeclassnametest.patch.responses.code200response.content.applicationjson; + +import org.checkerframework.checker.nullness.qual.Nullable; +import org.openapijsonschematools.client.components.schemas.Client; + +public class ApplicationjsonSchema extends Client { + // $refed class + + + public static class ApplicationjsonSchema1 extends Client1 { + private static @Nullable ApplicationjsonSchema1 instance = null; + public static ApplicationjsonSchema1 getInstance() { + if (instance == null) { + instance = new ApplicationjsonSchema1(); + } + return instance; + } + } +} diff --git a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/fakeclassnametest/patch/security/FakeclassnametestPatchSecurityRequirementObject0.kt b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/fakeclassnametest/patch/security/FakeclassnametestPatchSecurityRequirementObject0.kt new file mode 100644 index 00000000000..6b61b1b9a00 --- /dev/null +++ b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/fakeclassnametest/patch/security/FakeclassnametestPatchSecurityRequirementObject0.kt @@ -0,0 +1,24 @@ +package org.openapijsonschematools.client.paths.fakeclassnametest.patch.security; + +import org.checkerframework.checker.nullness.qual.Nullable; +import org.openapijsonschematools.client.securityrequirementobjects.SecurityRequirementObject; +import org.openapijsonschematools.client.securityschemes.SecurityScheme; +import org.openapijsonschematools.client.components.securityschemes.ApiKeyQuery; + +import java.util.List; +import java.util.Map; +import java.util.AbstractMap; + +public class FakeclassnametestPatchSecurityRequirementObject0 extends SecurityRequirementObject { + + public FakeclassnametestPatchSecurityRequirementObject0() { + super( + Map.ofEntries( + new AbstractMap.SimpleEntry, List>( + ApiKeyQuery.class, + List.of() + ) + ) + ); + } +} diff --git a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/fakedeletecoffeeid/FakedeletecoffeeidDelete.kt b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/fakedeletecoffeeid/FakedeletecoffeeidDelete.kt new file mode 100644 index 00000000000..09b216880c7 --- /dev/null +++ b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/fakedeletecoffeeid/FakedeletecoffeeidDelete.kt @@ -0,0 +1,179 @@ +package org.openapijsonschematools.client.paths.fakedeletecoffeeid; + +import org.checkerframework.checker.nullness.qual.Nullable; +import org.openapijsonschematools.client.RootServerInfo; +import org.openapijsonschematools.client.paths.fakedeletecoffeeid.delete.FakedeletecoffeeidDeletePathParameters; +import org.openapijsonschematools.client.paths.fakedeletecoffeeid.delete.Parameters; +import org.openapijsonschematools.client.paths.fakedeletecoffeeid.delete.FakedeletecoffeeidDeleteResponses; +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.paths.Fakedeletecoffeeid; + +import java.io.IOException; +import java.net.http.HttpClient; +import java.net.http.HttpRequest; +import java.time.Duration; +import java.util.List; +import java.util.Map; + +public class FakedeletecoffeeidDelete { + private static class DeleteProvider { + private static final String method = "delete"; + + public static FakedeletecoffeeidDeleteResponses.EndpointResponse delete( + DeleteRequest request, + ApiConfiguration apiConfiguration, + SchemaConfiguration schemaConfiguration, + HttpClient client + ) throws IOException, InterruptedException, ValidationException, NotImplementedException, ApiException { + Map> headers = apiConfiguration.getDefaultHeaders(); + HttpRequest.BodyPublisher bodyPublisher = HttpRequest.BodyPublishers.noBody(); + + var pathSerializer = new Parameters.PathParametersSerializer(); + String updatedPath = pathSerializer.serialize(request.pathParameters, Fakedeletecoffeeid.path); + // TODO set this to a map if there is a query security scheme + @Nullable Map queryMap = null; + String host = apiConfiguration.getServer(request.serverIndex).url(); + + String url = host + updatedPath; + var httpRequest = RestClient.getRequest( + url, + method, + bodyPublisher, + headers, + request.timeout + ); + var response = RestClient.getResponse(httpRequest, client); + var responsesDeserializer = new FakedeletecoffeeidDeleteResponses.FakedeletecoffeeidDeleteResponses1(); + return responsesDeserializer.deserialize(response, schemaConfiguration); + } + } + + public interface DeleteOperation { + ApiConfiguration getApiConfiguration(); + SchemaConfiguration getSchemaConfiguration(); + HttpClient getClient(); + default FakedeletecoffeeidDeleteResponses.EndpointResponse delete(DeleteRequest request) throws IOException, InterruptedException, ValidationException, NotImplementedException, ApiException { + return DeleteProvider.delete(request, getApiConfiguration(), getSchemaConfiguration(), getClient()); + } + } + + public interface DeleteCoffeeOperation { + ApiConfiguration getApiConfiguration(); + SchemaConfiguration getSchemaConfiguration(); + HttpClient getClient(); + default FakedeletecoffeeidDeleteResponses.EndpointResponse deleteCoffee(DeleteRequest request) throws IOException, InterruptedException, ValidationException, NotImplementedException, ApiException { + return DeleteProvider.delete(request, getApiConfiguration(), getSchemaConfiguration(), getClient()); + } + } + + public static class Delete extends ApiClient implements DeleteOperation { + public Delete(ApiConfiguration apiConfiguration, SchemaConfiguration schemaConfiguration) { + super(apiConfiguration, schemaConfiguration); + } + } + + public static class DeleteRequest { + public FakedeletecoffeeidDeletePathParameters.PathParametersMap pathParameters; + public RootServerInfo.@Nullable ServerIndex serverIndex; + public @Nullable Duration timeout; + + public DeleteRequest( + FakedeletecoffeeidDeletePathParameters.PathParametersMap pathParameters, + RootServerInfo.@Nullable ServerIndex serverIndex, + @Nullable Duration timeout + ) { + this.pathParameters = pathParameters; + this.serverIndex = serverIndex; + this.timeout = timeout; + } + } + + public static class DeleteNullableRequest { + public FakedeletecoffeeidDeletePathParameters.@Nullable PathParametersMap pathParameters; + public RootServerInfo.@Nullable ServerIndex serverIndex; + public @Nullable Duration timeout; + } + + public interface SetterForServerIndex { + DeleteNullableRequest getInstance(); + T getBuilderAfterServerIndex(DeleteNullableRequest instance); + default T serverIndex(RootServerInfo.ServerIndex serverIndex) { + var instance = getInstance(); + instance.serverIndex = serverIndex; + return getBuilderAfterServerIndex(instance); + } + } + + public interface SetterForTimeout { + DeleteNullableRequest getInstance(); + T getBuilderAfterTimeout(DeleteNullableRequest instance); + default T timeout(Duration timeout) { + var instance = getInstance(); + instance.timeout = timeout; + return getBuilderAfterTimeout(instance); + } + } + + public interface SetterForPathParameters { + DeleteNullableRequest getInstance(); + T getBuilderAfterPathParameters(DeleteNullableRequest instance); + default T pathParameters(FakedeletecoffeeidDeletePathParameters.PathParametersMap pathParameters) { + var instance = getInstance(); + instance.pathParameters = pathParameters; + return getBuilderAfterPathParameters(instance); + } + } + + public static class Delete0RequestBuilder implements SetterForServerIndex, SetterForTimeout { + private final DeleteNullableRequest instance; + + public Delete0RequestBuilder(DeleteNullableRequest instance) { + this.instance = instance; + } + + public DeleteRequest build() { + var pathParameters = instance.pathParameters; + if (pathParameters == null) { + throw new RuntimeException("invalid null value for required parameter"); + } + return new DeleteRequest( + pathParameters, + instance.serverIndex, + instance.timeout + ); + } + + public DeleteNullableRequest getInstance() { + return instance; + } + + public Delete0RequestBuilder getBuilderAfterServerIndex(DeleteNullableRequest instance) { + return this; + } + + public Delete0RequestBuilder getBuilderAfterTimeout(DeleteNullableRequest instance) { + return this; + } + } + public static class DeleteRequestBuilder implements SetterForPathParameters { + private final DeleteNullableRequest instance; + + public DeleteRequestBuilder() { + this.instance = new DeleteNullableRequest(); + } + + public DeleteNullableRequest getInstance() { + return instance; + } + + public Delete0RequestBuilder getBuilderAfterPathParameters(DeleteNullableRequest instance) { + return new Delete0RequestBuilder(instance); + } + } +} diff --git a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/fakedeletecoffeeid/delete/FakedeletecoffeeidDeletePathParameters.kt b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/fakedeletecoffeeid/delete/FakedeletecoffeeidDeletePathParameters.kt new file mode 100644 index 00000000000..5801380e873 --- /dev/null +++ b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/fakedeletecoffeeid/delete/FakedeletecoffeeidDeletePathParameters.kt @@ -0,0 +1,205 @@ +package org.openapijsonschematools.client.paths.fakedeletecoffeeid.delete; +import java.util.ArrayList; +import java.util.HashSet; +import java.util.LinkedHashMap; +import java.util.LinkedHashSet; +import java.util.List; +import java.util.Map; +import java.util.Objects; +import java.util.Set; +import org.checkerframework.checker.nullness.qual.Nullable; +import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags; +import org.openapijsonschematools.client.configurations.SchemaConfiguration; +import org.openapijsonschematools.client.exceptions.UnsetPropertyException; +import org.openapijsonschematools.client.exceptions.ValidationException; +import org.openapijsonschematools.client.paths.fakedeletecoffeeid.delete.parameters.parameter0.Schema0; +import org.openapijsonschematools.client.schemas.AnyTypeJsonSchema; +import org.openapijsonschematools.client.schemas.GenericBuilder; +import org.openapijsonschematools.client.schemas.NotAnyTypeJsonSchema; +import org.openapijsonschematools.client.schemas.validation.FrozenMap; +import org.openapijsonschematools.client.schemas.validation.JsonSchema; +import org.openapijsonschematools.client.schemas.validation.JsonSchemaInfo; +import org.openapijsonschematools.client.schemas.validation.MapSchemaValidator; +import org.openapijsonschematools.client.schemas.validation.MapUtils; +import org.openapijsonschematools.client.schemas.validation.PathToSchemasMap; +import org.openapijsonschematools.client.schemas.validation.PropertyEntry; +import org.openapijsonschematools.client.schemas.validation.ValidationMetadata; + +public class FakedeletecoffeeidDeletePathParameters { + // nest classes so all schemas and input/output classes can be public + + + public static class AdditionalProperties extends NotAnyTypeJsonSchema.NotAnyTypeJsonSchema1 { + // NotAnyTypeSchema + private static @Nullable AdditionalProperties instance = null; + public static AdditionalProperties getInstance() { + if (instance == null) { + instance = new AdditionalProperties(); + } + return instance; + } + } + + + public static class PathParametersMap extends FrozenMap { + protected PathParametersMap(FrozenMap m) { + super(m); + } + public static final Set requiredKeys = Set.of( + "id" + ); + public static final Set optionalKeys = Set.of(); + public static PathParametersMap of(Map arg, SchemaConfiguration configuration) throws ValidationException { + return FakedeletecoffeeidDeletePathParameters1.getInstance().validate(arg, configuration); + } + + public String id() { + try { + return getOrThrow("version"); + } catch (UnsetPropertyException e) { + throw new RuntimeException(e); + } + } + } + + public interface SetterForId { + Map getInstance(); + T getBuilderAfterId(Map instance); + + default T id(String value) { + var instance = getInstance(); + instance.put("id", value); + return getBuilderAfterId(instance); + } + } + + public static class PathParametersMap0Builder implements GenericBuilder> { + private final Map instance; + private static final Set knownKeys = Set.of( + "id" + ); + public Set getKnownKeys() { + return knownKeys; + } + public PathParametersMap0Builder(Map instance) { + this.instance = instance; + } + public Map build() { + return instance; + } + } + + public static class PathParametersMapBuilder implements SetterForId { + private final Map instance; + public PathParametersMapBuilder() { + this.instance = new LinkedHashMap<>(); + } + public Map getInstance() { + return instance; + } + public PathParametersMap0Builder getBuilderAfterId(Map instance) { + return new PathParametersMap0Builder(instance); + } + } + + + public sealed interface FakedeletecoffeeidDeletePathParameters1Boxed permits FakedeletecoffeeidDeletePathParameters1BoxedMap { + @Nullable Object getData(); + } + + public record FakedeletecoffeeidDeletePathParameters1BoxedMap(PathParametersMap data) implements FakedeletecoffeeidDeletePathParameters1Boxed { + @Override + public @Nullable Object getData() { + return data; + } + } + + + public static class FakedeletecoffeeidDeletePathParameters1 extends JsonSchema implements MapSchemaValidator { + private static @Nullable FakedeletecoffeeidDeletePathParameters1 instance = null; + + protected FakedeletecoffeeidDeletePathParameters1() { + super(new JsonSchemaInfo() + .type(Set.of(Map.class)) + .properties(Map.ofEntries( + new PropertyEntry("id", Schema0.Schema01.class) + )) + .required(Set.of( + "id" + )) + .additionalProperties(AdditionalProperties.class) + ); + } + + public static FakedeletecoffeeidDeletePathParameters1 getInstance() { + if (instance == null) { + instance = new FakedeletecoffeeidDeletePathParameters1(); + } + return instance; + } + + 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 RuntimeException("Invalid non-string key value"); + } + String propertyName = (String) entryKey; + List propertyPathToItem = new ArrayList<>(pathToItem); + propertyPathToItem.add(propertyName); + Object value = entry.getValue(); + LinkedHashMap, Nothing?> schemas = pathToSchemas.get(propertyPathToItem); + if (schemas == null) { + throw new RuntimeException("Validation 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"); + } + properties.put(propertyName, (String) propertyInstance); + } + FrozenMap castProperties = new FrozenMap<>(properties); + return new PathParametersMap(castProperties); + } + + 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); + SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().build())); + ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, new PathToSchemasMap(), new LinkedHashSet<>()); + PathToSchemasMap pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet); + return getNewInstance(castArg, validationMetadata.pathToItem(), pathToSchemasMap); + } + + + @Override + public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws 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"); + } + @Override + public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { + if (arg instanceof Map) { + return getNewInstance((Map) arg, pathToItem, pathToSchemas); + } + throw new RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); + } + @Override + public FakedeletecoffeeidDeletePathParameters1BoxedMap validateAndBox(Map arg, SchemaConfiguration configuration) throws ValidationException { + return new FakedeletecoffeeidDeletePathParameters1BoxedMap(validate(arg, configuration)); + } + @Override + public FakedeletecoffeeidDeletePathParameters1Boxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { + 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"); + } + } + +} diff --git a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/fakedeletecoffeeid/delete/FakedeletecoffeeidDeleteResponses.kt b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/fakedeletecoffeeid/delete/FakedeletecoffeeidDeleteResponses.kt new file mode 100644 index 00000000000..846100a92f2 --- /dev/null +++ b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/fakedeletecoffeeid/delete/FakedeletecoffeeidDeleteResponses.kt @@ -0,0 +1,61 @@ +package org.openapijsonschematools.client.paths.fakedeletecoffeeid.delete; + +import org.openapijsonschematools.client.paths.fakedeletecoffeeid.delete.responses.FakedeletecoffeeidDeleteCode200Response; +import org.openapijsonschematools.client.paths.fakedeletecoffeeid.delete.responses.FakedeletecoffeeidDeleteCodedefaultResponse; +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; +import org.checkerframework.checker.nullness.qual.Nullable; + +import java.net.http.HttpResponse; +import java.util.Map; +import java.util.AbstractMap; + +public class FakedeletecoffeeidDeleteResponses { + public sealed interface EndpointResponse permits EndpointFakedeletecoffeeidDeleteCode200Response, EndpointFakedeletecoffeeidDeleteCodedefaultResponse {} + + public record EndpointFakedeletecoffeeidDeleteCode200Response( + HttpResponse response, + Nothing? body, + Nothing? headers + ) implements EndpointResponse, ApiResponse{ + } + + public record EndpointFakedeletecoffeeidDeleteCodedefaultResponse( + HttpResponse response, + Nothing? body, + Nothing? headers + ) implements EndpointResponse, ApiResponse{ + } + + public sealed interface StatusCodeResponseDeserializer permits StatusFakedeletecoffeeidDeleteCode200ResponseDeserializer {} + + public static final class StatusFakedeletecoffeeidDeleteCode200ResponseDeserializer extends FakedeletecoffeeidDeleteCode200Response.FakedeletecoffeeidDeleteCode200Response1 implements StatusCodeResponseDeserializer { + } + + public static final class FakedeletecoffeeidDeleteResponses1 implements ResponsesDeserializer { + private final Map statusCodeToResponseDeserializer; + private final FakedeletecoffeeidDeleteCodedefaultResponse.FakedeletecoffeeidDeleteCodedefaultResponse1 defaultResponseDeserializer; + public FakedeletecoffeeidDeleteResponses1() { + this.statusCodeToResponseDeserializer = Map.ofEntries( + new AbstractMap.SimpleEntry<>("200", new StatusFakedeletecoffeeidDeleteCode200ResponseDeserializer()) + ); + this.defaultResponseDeserializer = new FakedeletecoffeeidDeleteCodedefaultResponse.FakedeletecoffeeidDeleteCodedefaultResponse1(); + } + + 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) { + StatusFakedeletecoffeeidDeleteCode200ResponseDeserializer castDeserializer = (StatusFakedeletecoffeeidDeleteCode200ResponseDeserializer) statusCodeDeserializer; + var deserializedResponse = castDeserializer.deserialize(response, configuration); + return new EndpointFakedeletecoffeeidDeleteCode200Response(response, deserializedResponse.body(), deserializedResponse.headers()); + } + var deserializedResponse = defaultResponseDeserializer.deserialize(response, configuration); + return new EndpointFakedeletecoffeeidDeleteCodedefaultResponse(response, deserializedResponse.body(), deserializedResponse.headers()); + } + } +} diff --git a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/fakedeletecoffeeid/delete/Parameters.kt b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/fakedeletecoffeeid/delete/Parameters.kt new file mode 100644 index 00000000000..6e068eebfbc --- /dev/null +++ b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/fakedeletecoffeeid/delete/Parameters.kt @@ -0,0 +1,20 @@ +package org.openapijsonschematools.client.paths.fakedeletecoffeeid.delete; + +import org.openapijsonschematools.client.paths.fakedeletecoffeeid.delete.parameters.Parameter0; +import org.openapijsonschematools.client.parameter.PathSerializer; + +import java.util.Map; +import java.util.AbstractMap; + +public class Parameters { + + public static class PathParametersSerializer extends PathSerializer { + public PathParametersSerializer() { + super( + Map.ofEntries( + new AbstractMap.SimpleEntry<>("id", new Parameter0.Parameter01()) + ) + ); + } + } +} diff --git a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/fakedeletecoffeeid/delete/parameters/Parameter0.kt b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/fakedeletecoffeeid/delete/parameters/Parameter0.kt new file mode 100644 index 00000000000..d16f6b00036 --- /dev/null +++ b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/fakedeletecoffeeid/delete/parameters/Parameter0.kt @@ -0,0 +1,23 @@ +package org.openapijsonschematools.client.paths.fakedeletecoffeeid.delete.parameters; + +import org.openapijsonschematools.client.parameter.ParameterStyle; +import org.openapijsonschematools.client.parameter.ParameterInType; +import org.openapijsonschematools.client.parameter.SchemaParameter; +import org.openapijsonschematools.client.paths.fakedeletecoffeeid.delete.parameters.parameter0.Schema0; + +public class Parameter0 { + + public static class Parameter01 extends SchemaParameter { + public Parameter01() { + super( + "id", + ParameterInType.PATH, + true, + ParameterStyle.SIMPLE, + false, + false, + Schema0.Schema01.getInstance() + ); + } + } +} diff --git a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/fakedeletecoffeeid/delete/parameters/parameter0/Schema0.kt b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/fakedeletecoffeeid/delete/parameters/parameter0/Schema0.kt new file mode 100644 index 00000000000..587228fa824 --- /dev/null +++ b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/fakedeletecoffeeid/delete/parameters/parameter0/Schema0.kt @@ -0,0 +1,19 @@ +package org.openapijsonschematools.client.paths.fakedeletecoffeeid.delete.parameters.parameter0; +import org.checkerframework.checker.nullness.qual.Nullable; +import org.openapijsonschematools.client.schemas.StringJsonSchema; + +public class Schema0 extends StringJsonSchema { + // nest classes so all schemas and input/output classes can be public + + + public static class Schema01 extends StringJsonSchema.StringJsonSchema1 { + private static @Nullable Schema01 instance = null; + public static Schema01 getInstance() { + if (instance == null) { + instance = new Schema01(); + } + return instance; + } + } + +} diff --git a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/fakedeletecoffeeid/delete/responses/FakedeletecoffeeidDeleteCode200Response.kt b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/fakedeletecoffeeid/delete/responses/FakedeletecoffeeidDeleteCode200Response.kt new file mode 100644 index 00000000000..56f5f4b8774 --- /dev/null +++ b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/fakedeletecoffeeid/delete/responses/FakedeletecoffeeidDeleteCode200Response.kt @@ -0,0 +1,7 @@ +package org.openapijsonschematools.client.paths.fakedeletecoffeeid.delete.responses; + +import org.openapijsonschematools.client.components.responses.SuccessDescriptionOnly; + +public class FakedeletecoffeeidDeleteCode200Response extends SuccessDescriptionOnly { + public static class FakedeletecoffeeidDeleteCode200Response1 extends SuccessDescriptionOnly1 {} +} diff --git a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/fakedeletecoffeeid/delete/responses/FakedeletecoffeeidDeleteCodedefaultResponse.kt b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/fakedeletecoffeeid/delete/responses/FakedeletecoffeeidDeleteCodedefaultResponse.kt new file mode 100644 index 00000000000..8ef0d71e55e --- /dev/null +++ b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/fakedeletecoffeeid/delete/responses/FakedeletecoffeeidDeleteCodedefaultResponse.kt @@ -0,0 +1,45 @@ +package org.openapijsonschematools.client.paths.fakedeletecoffeeid.delete.responses; + +import org.openapijsonschematools.client.configurations.SchemaConfiguration; +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; +import java.net.http.HttpResponse; +import java.net.http.HttpHeaders; + +public class FakedeletecoffeeidDeleteCodedefaultResponse { + + public static class FakedeletecoffeeidDeleteCodedefaultResponse1 extends ResponseDeserializer { + public FakedeletecoffeeidDeleteCodedefaultResponse1() { + super( + MapUtils.makeMap( + ) + ); + } + + @Override + protected Nothing? getBody(String contentType, Nothing? mediaType, byte[] body, SchemaConfiguration configuration) { + return null; + } + + @Override + protected Nothing? getHeaders(HttpHeaders headers, SchemaConfiguration configuration) { + return null; + } + } + + @SuppressWarnings("serial") + public static class ResponseApiException extends ApiException { + public DeserializedHttpResponse deserializedResponse; + + public ResponseApiException(String s, HttpResponse response, DeserializedHttpResponse deserializedResponse) { + super(s, response); + this.deserializedResponse = deserializedResponse; + } + } +} diff --git a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/fakehealth/FakehealthGet.kt b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/fakehealth/FakehealthGet.kt new file mode 100644 index 00000000000..49b0d51d461 --- /dev/null +++ b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/fakehealth/FakehealthGet.kt @@ -0,0 +1,124 @@ +package org.openapijsonschematools.client.paths.fakehealth; + +import org.checkerframework.checker.nullness.qual.Nullable; +import org.openapijsonschematools.client.RootServerInfo; +import org.openapijsonschematools.client.paths.fakehealth.get.FakehealthGetResponses; +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.paths.Fakehealth; + +import java.io.IOException; +import java.net.http.HttpClient; +import java.net.http.HttpRequest; +import java.time.Duration; +import java.util.List; +import java.util.Map; + +public class FakehealthGet { + private static class GetProvider { + private static final String method = "get"; + + public static FakehealthGetResponses.EndpointResponse get( + GetRequest request, + ApiConfiguration apiConfiguration, + SchemaConfiguration schemaConfiguration, + HttpClient client + ) 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 + @Nullable Map queryMap = null; + String host = apiConfiguration.getServer(request.serverIndex).url(); + + String url = host + Fakehealth.path; + var httpRequest = RestClient.getRequest( + url, + method, + bodyPublisher, + headers, + request.timeout + ); + var response = RestClient.getResponse(httpRequest, client); + var responsesDeserializer = new FakehealthGetResponses.FakehealthGetResponses1(); + return responsesDeserializer.deserialize(response, schemaConfiguration); + } + } + + public interface GetOperation { + ApiConfiguration getApiConfiguration(); + SchemaConfiguration getSchemaConfiguration(); + HttpClient getClient(); + default FakehealthGetResponses.EndpointResponse get(GetRequest request) throws IOException, InterruptedException, ValidationException, NotImplementedException, ApiException { + return GetProvider.get(request, getApiConfiguration(), getSchemaConfiguration(), getClient()); + } + } + + public interface FakeHealthGetOperation { + ApiConfiguration getApiConfiguration(); + SchemaConfiguration getSchemaConfiguration(); + HttpClient getClient(); + default FakehealthGetResponses.EndpointResponse fakeHealthGet(GetRequest request) throws IOException, InterruptedException, ValidationException, NotImplementedException, ApiException { + return GetProvider.get(request, getApiConfiguration(), getSchemaConfiguration(), getClient()); + } + } + + public static class Get extends ApiClient implements GetOperation { + public Get(ApiConfiguration apiConfiguration, SchemaConfiguration schemaConfiguration) { + super(apiConfiguration, schemaConfiguration); + } + } + + public static class GetRequest { + public RootServerInfo.@Nullable ServerIndex serverIndex; + public @Nullable Duration timeout; + } + + public interface SetterForServerIndex { + GetRequest getInstance(); + T getBuilderAfterServerIndex(GetRequest instance); + default T serverIndex(RootServerInfo.ServerIndex serverIndex) { + var instance = getInstance(); + instance.serverIndex = serverIndex; + return getBuilderAfterServerIndex(instance); + } + } + + public interface SetterForTimeout { + GetRequest getInstance(); + T getBuilderAfterTimeout(GetRequest instance); + default T timeout(Duration timeout) { + var instance = getInstance(); + instance.timeout = timeout; + return getBuilderAfterTimeout(instance); + } + } + + public static class GetRequestBuilder implements SetterForServerIndex, SetterForTimeout { + private final GetRequest instance; + + public GetRequestBuilder() { + this.instance = new GetRequest(); + } + + public GetRequest build() { + return instance; + } + + public GetRequest getInstance() { + return instance; + } + + public GetRequestBuilder getBuilderAfterServerIndex(GetRequest instance) { + return this; + } + + public GetRequestBuilder getBuilderAfterTimeout(GetRequest instance) { + return this; + } + } +} diff --git a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/fakehealth/get/FakehealthGetResponses.kt b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/fakehealth/get/FakehealthGetResponses.kt new file mode 100644 index 00000000000..2b0fdb8c86e --- /dev/null +++ b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/fakehealth/get/FakehealthGetResponses.kt @@ -0,0 +1,53 @@ +package org.openapijsonschematools.client.paths.fakehealth.get; + +import org.openapijsonschematools.client.paths.fakehealth.get.responses.FakehealthGetCode200Response; +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; +import org.checkerframework.checker.nullness.qual.Nullable; + +import java.net.http.HttpResponse; +import java.util.Map; +import java.util.AbstractMap; + +public class FakehealthGetResponses { + public sealed interface EndpointResponse permits EndpointFakehealthGetCode200Response {} + + public record EndpointFakehealthGetCode200Response( + HttpResponse response, + FakehealthGetCode200Response.SealedResponseBody body, + Nothing? headers + ) implements EndpointResponse, ApiResponse{ + } + + public sealed interface StatusCodeResponseDeserializer permits StatusFakehealthGetCode200ResponseDeserializer {} + + public static final class StatusFakehealthGetCode200ResponseDeserializer extends FakehealthGetCode200Response.FakehealthGetCode200Response1 implements StatusCodeResponseDeserializer { + } + + public static final class FakehealthGetResponses1 implements ResponsesDeserializer { + private final Map statusCodeToResponseDeserializer; + public FakehealthGetResponses1() { + this.statusCodeToResponseDeserializer = Map.ofEntries( + new AbstractMap.SimpleEntry<>("200", new StatusFakehealthGetCode200ResponseDeserializer()) + ); + } + + 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) { + throw new ApiException( + "Invalid response statusCode="+statusCode+" has no response defined in the openapi document", + response + ); + } + StatusFakehealthGetCode200ResponseDeserializer castDeserializer = (StatusFakehealthGetCode200ResponseDeserializer) statusCodeDeserializer; + var deserializedResponse = castDeserializer.deserialize(response, configuration); + return new EndpointFakehealthGetCode200Response(response, deserializedResponse.body(), deserializedResponse.headers()); + } + } +} diff --git a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/fakehealth/get/responses/FakehealthGetCode200Response.kt b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/fakehealth/get/responses/FakehealthGetCode200Response.kt new file mode 100644 index 00000000000..e497c5f845a --- /dev/null +++ b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/fakehealth/get/responses/FakehealthGetCode200Response.kt @@ -0,0 +1,63 @@ +package org.openapijsonschematools.client.paths.fakehealth.get.responses; + +import org.openapijsonschematools.client.configurations.SchemaConfiguration; +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; + +import java.util.AbstractMap; +import java.util.Map; +import java.net.http.HttpResponse; +import java.net.http.HttpHeaders; + +public class FakehealthGetCode200Response { + public sealed interface SealedMediaType permits ApplicationjsonMediaType {} + + public record ApplicationjsonMediaType(ApplicationjsonSchema.ApplicationjsonSchema1 schema) implements SealedMediaType, MediaType { + public ApplicationjsonMediaType() { + this(ApplicationjsonSchema.ApplicationjsonSchema1.getInstance()); + } + @Override + public Nothing? encoding() { + return null; + } + } + public sealed interface SealedResponseBody permits ApplicationjsonResponseBody {} + public record ApplicationjsonResponseBody(ApplicationjsonSchema.HealthCheckResult1Boxed body) implements SealedResponseBody { } + + public static class FakehealthGetCode200Response1 extends ResponseDeserializer { + public FakehealthGetCode200Response1() { + super( + Map.ofEntries( + new AbstractMap.SimpleEntry<>("application/json", new ApplicationjsonMediaType()) + ) + ); + } + + @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); + } + + @Override + protected Nothing? getHeaders(HttpHeaders headers, SchemaConfiguration configuration) { + return null; + } + } + + @SuppressWarnings("serial") + public static class ResponseApiException extends ApiException { + public DeserializedHttpResponse deserializedResponse; + + public ResponseApiException(String s, HttpResponse response, DeserializedHttpResponse deserializedResponse) { + super(s, response); + this.deserializedResponse = deserializedResponse; + } + } +} diff --git a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/fakehealth/get/responses/code200response/content/applicationjson/ApplicationjsonSchema.kt b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/fakehealth/get/responses/code200response/content/applicationjson/ApplicationjsonSchema.kt new file mode 100644 index 00000000000..e9d84e9a57a --- /dev/null +++ b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/fakehealth/get/responses/code200response/content/applicationjson/ApplicationjsonSchema.kt @@ -0,0 +1,19 @@ +package org.openapijsonschematools.client.paths.fakehealth.get.responses.code200response.content.applicationjson; + +import org.checkerframework.checker.nullness.qual.Nullable; +import org.openapijsonschematools.client.components.schemas.HealthCheckResult; + +public class ApplicationjsonSchema extends HealthCheckResult { + // $refed class + + + public static class ApplicationjsonSchema1 extends HealthCheckResult1 { + private static @Nullable ApplicationjsonSchema1 instance = null; + public static ApplicationjsonSchema1 getInstance() { + if (instance == null) { + instance = new ApplicationjsonSchema1(); + } + return instance; + } + } +} diff --git a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/fakeinlineadditionalproperties/FakeinlineadditionalpropertiesPost.kt b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/fakeinlineadditionalproperties/FakeinlineadditionalpropertiesPost.kt new file mode 100644 index 00000000000..9eaf3f07fe2 --- /dev/null +++ b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/fakeinlineadditionalproperties/FakeinlineadditionalpropertiesPost.kt @@ -0,0 +1,183 @@ +package org.openapijsonschematools.client.paths.fakeinlineadditionalproperties; + +import org.checkerframework.checker.nullness.qual.Nullable; +import org.openapijsonschematools.client.RootServerInfo; +import org.openapijsonschematools.client.paths.fakeinlineadditionalproperties.post.FakeinlineadditionalpropertiesPostRequestBody; +import org.openapijsonschematools.client.paths.fakeinlineadditionalproperties.post.FakeinlineadditionalpropertiesPostResponses; +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.requestbody.SerializedRequestBody; +import org.openapijsonschematools.client.paths.Fakeinlineadditionalproperties; + +import java.io.IOException; +import java.util.ArrayList; +import java.net.http.HttpClient; +import java.net.http.HttpRequest; +import java.time.Duration; +import java.util.List; +import java.util.Map; + +public class FakeinlineadditionalpropertiesPost { + private static class PostProvider { + private static final String method = "post"; + + public static FakeinlineadditionalpropertiesPostResponses.EndpointResponse post( + PostRequest request, + ApiConfiguration apiConfiguration, + SchemaConfiguration schemaConfiguration, + HttpClient client + ) throws IOException, InterruptedException, ValidationException, NotImplementedException, ApiException { + Map> headers = apiConfiguration.getDefaultHeaders(); + + SerializedRequestBody serializedRequestBody = new FakeinlineadditionalpropertiesPostRequestBody.FakeinlineadditionalpropertiesPostRequestBody1().serialize( + request.requestBody + ); + var contentTypeHeaderValues = headers.getOrDefault("Content-Type", new ArrayList<>()); + contentTypeHeaderValues.add(serializedRequestBody.contentType); + HttpRequest.BodyPublisher bodyPublisher = serializedRequestBody.bodyPublisher; + // TODO set this to a map if there is a query security scheme + @Nullable Map queryMap = null; + String host = apiConfiguration.getServer(request.serverIndex).url(); + + String url = host + Fakeinlineadditionalproperties.path; + var httpRequest = RestClient.getRequest( + url, + method, + bodyPublisher, + headers, + request.timeout + ); + var response = RestClient.getResponse(httpRequest, client); + var responsesDeserializer = new FakeinlineadditionalpropertiesPostResponses.FakeinlineadditionalpropertiesPostResponses1(); + return responsesDeserializer.deserialize(response, schemaConfiguration); + } + } + + public interface PostOperation { + ApiConfiguration getApiConfiguration(); + SchemaConfiguration getSchemaConfiguration(); + HttpClient getClient(); + default FakeinlineadditionalpropertiesPostResponses.EndpointResponse post(PostRequest request) throws IOException, InterruptedException, ValidationException, NotImplementedException, ApiException { + return PostProvider.post(request, getApiConfiguration(), getSchemaConfiguration(), getClient()); + } + } + + public interface InlineAdditionalPropertiesOperation { + ApiConfiguration getApiConfiguration(); + SchemaConfiguration getSchemaConfiguration(); + HttpClient getClient(); + default FakeinlineadditionalpropertiesPostResponses.EndpointResponse inlineAdditionalProperties(PostRequest request) throws IOException, InterruptedException, ValidationException, NotImplementedException, ApiException { + return PostProvider.post(request, getApiConfiguration(), getSchemaConfiguration(), getClient()); + } + } + + public static class Post extends ApiClient implements PostOperation { + public Post(ApiConfiguration apiConfiguration, SchemaConfiguration schemaConfiguration) { + super(apiConfiguration, schemaConfiguration); + } + } + + public static class PostRequest { + public FakeinlineadditionalpropertiesPostRequestBody.SealedRequestBody requestBody; + public RootServerInfo.@Nullable ServerIndex serverIndex; + public @Nullable Duration timeout; + + public PostRequest( + FakeinlineadditionalpropertiesPostRequestBody.SealedRequestBody requestBody, + RootServerInfo.@Nullable ServerIndex serverIndex, + @Nullable Duration timeout + ) { + this.requestBody = requestBody; + this.serverIndex = serverIndex; + this.timeout = timeout; + } + } + + public static class PostNullableRequest { + public FakeinlineadditionalpropertiesPostRequestBody.@Nullable SealedRequestBody requestBody; + public RootServerInfo.@Nullable ServerIndex serverIndex; + public @Nullable Duration timeout; + } + + public interface SetterForServerIndex { + PostNullableRequest getInstance(); + T getBuilderAfterServerIndex(PostNullableRequest instance); + default T serverIndex(RootServerInfo.ServerIndex serverIndex) { + var instance = getInstance(); + instance.serverIndex = serverIndex; + return getBuilderAfterServerIndex(instance); + } + } + + public interface SetterForTimeout { + PostNullableRequest getInstance(); + T getBuilderAfterTimeout(PostNullableRequest instance); + default T timeout(Duration timeout) { + var instance = getInstance(); + instance.timeout = timeout; + return getBuilderAfterTimeout(instance); + } + } + + public interface SetterForRequestBody { + PostNullableRequest getInstance(); + T getBuilderAfterRequestBody(PostNullableRequest instance); + default T requestBody(FakeinlineadditionalpropertiesPostRequestBody.SealedRequestBody requestBody) { + var instance = getInstance(); + instance.requestBody = requestBody; + return getBuilderAfterRequestBody(instance); + } + } + + public static class Post0RequestBuilder implements SetterForServerIndex, SetterForTimeout { + private final PostNullableRequest instance; + + public Post0RequestBuilder(PostNullableRequest instance) { + this.instance = instance; + } + + public PostRequest build() { + var requestBody = instance.requestBody; + if (requestBody == null) { + throw new RuntimeException("invalid null value for required parameter"); + } + return new PostRequest( + requestBody, + instance.serverIndex, + instance.timeout + ); + } + + public PostNullableRequest getInstance() { + return instance; + } + + public Post0RequestBuilder getBuilderAfterServerIndex(PostNullableRequest instance) { + return this; + } + + public Post0RequestBuilder getBuilderAfterTimeout(PostNullableRequest instance) { + return this; + } + } + public static class PostRequestBuilder implements SetterForRequestBody { + private final PostNullableRequest instance; + + public PostRequestBuilder() { + this.instance = new PostNullableRequest(); + } + + public PostNullableRequest getInstance() { + return instance; + } + + public Post0RequestBuilder getBuilderAfterRequestBody(PostNullableRequest instance) { + return new Post0RequestBuilder(instance); + } + } +} diff --git a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/fakeinlineadditionalproperties/post/FakeinlineadditionalpropertiesPostRequestBody.kt b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/fakeinlineadditionalproperties/post/FakeinlineadditionalpropertiesPostRequestBody.kt new file mode 100644 index 00000000000..ca439f264aa --- /dev/null +++ b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/fakeinlineadditionalproperties/post/FakeinlineadditionalpropertiesPostRequestBody.kt @@ -0,0 +1,49 @@ +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; +import org.openapijsonschematools.client.mediatype.MediaType; +import org.openapijsonschematools.client.paths.fakeinlineadditionalproperties.post.requestbody.content.applicationjson.ApplicationjsonSchema; + +import java.util.AbstractMap; +import java.util.Map; + +public class FakeinlineadditionalpropertiesPostRequestBody { + public sealed interface SealedMediaType permits ApplicationjsonMediaType {} + + public record ApplicationjsonMediaType(ApplicationjsonSchema.ApplicationjsonSchema1 schema) implements SealedMediaType, MediaType { + public ApplicationjsonMediaType() { + this(ApplicationjsonSchema.ApplicationjsonSchema1.getInstance()); + } + @Override + public Nothing? encoding() { + return null; + } + } + + public static class FakeinlineadditionalpropertiesPostRequestBody1 extends RequestBodySerializer { + public FakeinlineadditionalpropertiesPostRequestBody1() { + super( + Map.ofEntries( + new AbstractMap.SimpleEntry<>("application/json", new ApplicationjsonMediaType()) + ), + true + ); + } + + public SerializedRequestBody serialize(SealedRequestBody requestBody) throws NotImplementedException { + ApplicationjsonRequestBody requestBody0 = (ApplicationjsonRequestBody) requestBody; + return serialize(requestBody0.contentType(), requestBody0.body().getData()); + } + } + + public sealed interface SealedRequestBody permits ApplicationjsonRequestBody {} + public record ApplicationjsonRequestBody(ApplicationjsonSchema.ApplicationjsonSchema1Boxed body) implements SealedRequestBody, GenericRequestBody { + @Override + public String contentType() { + return "application/json"; + } + } +} diff --git a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/fakeinlineadditionalproperties/post/FakeinlineadditionalpropertiesPostResponses.kt b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/fakeinlineadditionalproperties/post/FakeinlineadditionalpropertiesPostResponses.kt new file mode 100644 index 00000000000..47519601d10 --- /dev/null +++ b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/fakeinlineadditionalproperties/post/FakeinlineadditionalpropertiesPostResponses.kt @@ -0,0 +1,53 @@ +package org.openapijsonschematools.client.paths.fakeinlineadditionalproperties.post; + +import org.openapijsonschematools.client.paths.fakeinlineadditionalproperties.post.responses.FakeinlineadditionalpropertiesPostCode200Response; +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; +import org.checkerframework.checker.nullness.qual.Nullable; + +import java.net.http.HttpResponse; +import java.util.Map; +import java.util.AbstractMap; + +public class FakeinlineadditionalpropertiesPostResponses { + public sealed interface EndpointResponse permits EndpointFakeinlineadditionalpropertiesPostCode200Response {} + + public record EndpointFakeinlineadditionalpropertiesPostCode200Response( + HttpResponse response, + Nothing? body, + Nothing? headers + ) implements EndpointResponse, ApiResponse{ + } + + public sealed interface StatusCodeResponseDeserializer permits StatusFakeinlineadditionalpropertiesPostCode200ResponseDeserializer {} + + public static final class StatusFakeinlineadditionalpropertiesPostCode200ResponseDeserializer extends FakeinlineadditionalpropertiesPostCode200Response.FakeinlineadditionalpropertiesPostCode200Response1 implements StatusCodeResponseDeserializer { + } + + public static final class FakeinlineadditionalpropertiesPostResponses1 implements ResponsesDeserializer { + private final Map statusCodeToResponseDeserializer; + public FakeinlineadditionalpropertiesPostResponses1() { + this.statusCodeToResponseDeserializer = Map.ofEntries( + new AbstractMap.SimpleEntry<>("200", new StatusFakeinlineadditionalpropertiesPostCode200ResponseDeserializer()) + ); + } + + 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) { + throw new ApiException( + "Invalid response statusCode="+statusCode+" has no response defined in the openapi document", + response + ); + } + StatusFakeinlineadditionalpropertiesPostCode200ResponseDeserializer castDeserializer = (StatusFakeinlineadditionalpropertiesPostCode200ResponseDeserializer) statusCodeDeserializer; + var deserializedResponse = castDeserializer.deserialize(response, configuration); + return new EndpointFakeinlineadditionalpropertiesPostCode200Response(response, deserializedResponse.body(), deserializedResponse.headers()); + } + } +} diff --git a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/fakeinlineadditionalproperties/post/requestbody/content/applicationjson/ApplicationjsonSchema.kt b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/fakeinlineadditionalproperties/post/requestbody/content/applicationjson/ApplicationjsonSchema.kt new file mode 100644 index 00000000000..f4c818afa93 --- /dev/null +++ b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/fakeinlineadditionalproperties/post/requestbody/content/applicationjson/ApplicationjsonSchema.kt @@ -0,0 +1,183 @@ +package org.openapijsonschematools.client.paths.fakeinlineadditionalproperties.post.requestbody.content.applicationjson; +import java.util.ArrayList; +import java.util.HashSet; +import java.util.LinkedHashMap; +import java.util.LinkedHashSet; +import java.util.List; +import java.util.Map; +import java.util.Objects; +import java.util.Set; +import org.checkerframework.checker.nullness.qual.Nullable; +import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags; +import org.openapijsonschematools.client.configurations.SchemaConfiguration; +import org.openapijsonschematools.client.exceptions.InvalidAdditionalPropertyException; +import org.openapijsonschematools.client.exceptions.UnsetPropertyException; +import org.openapijsonschematools.client.exceptions.ValidationException; +import org.openapijsonschematools.client.schemas.GenericBuilder; +import org.openapijsonschematools.client.schemas.StringJsonSchema; +import org.openapijsonschematools.client.schemas.validation.FrozenMap; +import org.openapijsonschematools.client.schemas.validation.JsonSchema; +import org.openapijsonschematools.client.schemas.validation.JsonSchemaInfo; +import org.openapijsonschematools.client.schemas.validation.MapSchemaValidator; +import org.openapijsonschematools.client.schemas.validation.MapUtils; +import org.openapijsonschematools.client.schemas.validation.PathToSchemasMap; +import org.openapijsonschematools.client.schemas.validation.ValidationMetadata; + +public class ApplicationjsonSchema { + // nest classes so all schemas and input/output classes can be public + + + public static class ApplicationjsonAdditionalProperties extends StringJsonSchema.StringJsonSchema1 { + private static @Nullable ApplicationjsonAdditionalProperties instance = null; + public static ApplicationjsonAdditionalProperties getInstance() { + if (instance == null) { + instance = new ApplicationjsonAdditionalProperties(); + } + return instance; + } + } + + + public static class ApplicationjsonSchemaMap extends FrozenMap { + protected ApplicationjsonSchemaMap(FrozenMap m) { + super(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 { + return ApplicationjsonSchema1.getInstance().validate(arg, configuration); + } + + public String getAdditionalProperty(String name) throws UnsetPropertyException { + return getOrThrow(name); + } + } + + public interface SetterForApplicationjsonAdditionalProperties { + Set getKnownKeys(); + Map getInstance(); + T getBuilderAfterAdditionalProperty(Map instance); + + default T additionalProperty(String key, String value) throws InvalidAdditionalPropertyException { + MapUtils.throwIfKeyKnown(key, getKnownKeys(), true); + var instance = getInstance(); + instance.put(key, value); + return getBuilderAfterAdditionalProperty(instance); + } + } + + public static class ApplicationjsonSchemaMapBuilder implements GenericBuilder>, SetterForApplicationjsonAdditionalProperties { + private final Map instance; + private static final Set knownKeys = Set.of(); + public Set getKnownKeys() { + return knownKeys; + } + public ApplicationjsonSchemaMapBuilder() { + this.instance = new LinkedHashMap<>(); + } + public Map build() { + return instance; + } + public Map getInstance() { + return instance; + } + public ApplicationjsonSchemaMapBuilder getBuilderAfterAdditionalProperty(Map instance) { + return this; + } + } + + + public sealed interface ApplicationjsonSchema1Boxed permits ApplicationjsonSchema1BoxedMap { + @Nullable Object getData(); + } + + public record ApplicationjsonSchema1BoxedMap(ApplicationjsonSchemaMap data) implements ApplicationjsonSchema1Boxed { + @Override + public @Nullable Object getData() { + return data; + } + } + + + public static class ApplicationjsonSchema1 extends JsonSchema implements MapSchemaValidator { + private static @Nullable ApplicationjsonSchema1 instance = null; + + protected ApplicationjsonSchema1() { + super(new JsonSchemaInfo() + .type(Set.of(Map.class)) + .additionalProperties(ApplicationjsonAdditionalProperties.class) + ); + } + + public static ApplicationjsonSchema1 getInstance() { + if (instance == null) { + instance = new ApplicationjsonSchema1(); + } + return instance; + } + + 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 RuntimeException("Invalid non-string key value"); + } + String propertyName = (String) entryKey; + List propertyPathToItem = new ArrayList<>(pathToItem); + propertyPathToItem.add(propertyName); + Object value = entry.getValue(); + LinkedHashMap, Nothing?> schemas = pathToSchemas.get(propertyPathToItem); + if (schemas == null) { + throw new RuntimeException("Validation 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"); + } + properties.put(propertyName, (String) propertyInstance); + } + FrozenMap castProperties = new FrozenMap<>(properties); + return new ApplicationjsonSchemaMap(castProperties); + } + + 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); + SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().build())); + ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, new PathToSchemasMap(), new LinkedHashSet<>()); + PathToSchemasMap pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet); + return getNewInstance(castArg, validationMetadata.pathToItem(), pathToSchemasMap); + } + + + @Override + public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws 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"); + } + @Override + public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { + if (arg instanceof Map) { + return getNewInstance((Map) arg, pathToItem, pathToSchemas); + } + 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 { + return new ApplicationjsonSchema1BoxedMap(validate(arg, configuration)); + } + @Override + public ApplicationjsonSchema1Boxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { + 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"); + } + } + +} diff --git a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/fakeinlineadditionalproperties/post/responses/FakeinlineadditionalpropertiesPostCode200Response.kt b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/fakeinlineadditionalproperties/post/responses/FakeinlineadditionalpropertiesPostCode200Response.kt new file mode 100644 index 00000000000..f3f0c8ae16c --- /dev/null +++ b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/fakeinlineadditionalproperties/post/responses/FakeinlineadditionalpropertiesPostCode200Response.kt @@ -0,0 +1,7 @@ +package org.openapijsonschematools.client.paths.fakeinlineadditionalproperties.post.responses; + +import org.openapijsonschematools.client.components.responses.SuccessDescriptionOnly; + +public class FakeinlineadditionalpropertiesPostCode200Response extends SuccessDescriptionOnly { + public static class FakeinlineadditionalpropertiesPostCode200Response1 extends SuccessDescriptionOnly1 {} +} diff --git a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/fakeinlinecomposition/FakeinlinecompositionPost.kt b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/fakeinlinecomposition/FakeinlinecompositionPost.kt new file mode 100644 index 00000000000..0a51b2c0c01 --- /dev/null +++ b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/fakeinlinecomposition/FakeinlinecompositionPost.kt @@ -0,0 +1,176 @@ +package org.openapijsonschematools.client.paths.fakeinlinecomposition; + +import org.checkerframework.checker.nullness.qual.Nullable; +import org.openapijsonschematools.client.paths.fakeinlinecomposition.post.FakeinlinecompositionPostRequestBody; +import org.openapijsonschematools.client.paths.fakeinlinecomposition.post.FakeinlinecompositionPostQueryParameters; +import org.openapijsonschematools.client.RootServerInfo; +import org.openapijsonschematools.client.paths.fakeinlinecomposition.post.Parameters; +import org.openapijsonschematools.client.paths.fakeinlinecomposition.post.FakeinlinecompositionPostResponses; +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.requestbody.SerializedRequestBody; +import org.openapijsonschematools.client.paths.Fakeinlinecomposition; + +import java.io.IOException; +import java.util.ArrayList; +import java.net.http.HttpClient; +import java.net.http.HttpRequest; +import java.time.Duration; +import java.util.List; +import java.util.Map; + +public class FakeinlinecompositionPost { + private static class PostProvider { + private static final String method = "post"; + + public static FakeinlinecompositionPostResponses.EndpointResponse post( + PostRequest request, + ApiConfiguration apiConfiguration, + SchemaConfiguration schemaConfiguration, + HttpClient client + ) throws IOException, InterruptedException, ValidationException, NotImplementedException, ApiException { + Map> headers = apiConfiguration.getDefaultHeaders(); + + @Nullable SerializedRequestBody serializedRequestBody; + HttpRequest.BodyPublisher bodyPublisher = HttpRequest.BodyPublishers.noBody(); + if (request.requestBody != null) { + serializedRequestBody = new FakeinlinecompositionPostRequestBody.FakeinlinecompositionPostRequestBody1().serialize( + request.requestBody + ); + var contentTypeHeaderValues = headers.getOrDefault("Content-Type", new ArrayList<>()); + contentTypeHeaderValues.add(serializedRequestBody.contentType); + bodyPublisher = serializedRequestBody.bodyPublisher; + } + + var querySerializer = new Parameters.QueryParametersSerializer(); + @Nullable Map queryMap = null; + if (request.queryParameters != null) { + queryMap = querySerializer.getQueryMap(request.queryParameters); + } + String host = apiConfiguration.getServer(request.serverIndex).url(); + + String url = host + Fakeinlinecomposition.path; + if (queryMap != null) { + url = url + querySerializer.serialize(queryMap); + } + var httpRequest = RestClient.getRequest( + url, + method, + bodyPublisher, + headers, + request.timeout + ); + var response = RestClient.getResponse(httpRequest, client); + var responsesDeserializer = new FakeinlinecompositionPostResponses.FakeinlinecompositionPostResponses1(); + return responsesDeserializer.deserialize(response, schemaConfiguration); + } + } + + public interface PostOperation { + ApiConfiguration getApiConfiguration(); + SchemaConfiguration getSchemaConfiguration(); + HttpClient getClient(); + default FakeinlinecompositionPostResponses.EndpointResponse post(PostRequest request) throws IOException, InterruptedException, ValidationException, NotImplementedException, ApiException { + return PostProvider.post(request, getApiConfiguration(), getSchemaConfiguration(), getClient()); + } + } + + public interface InlineCompositionOperation { + ApiConfiguration getApiConfiguration(); + SchemaConfiguration getSchemaConfiguration(); + HttpClient getClient(); + default FakeinlinecompositionPostResponses.EndpointResponse inlineComposition(PostRequest request) throws IOException, InterruptedException, ValidationException, NotImplementedException, ApiException { + return PostProvider.post(request, getApiConfiguration(), getSchemaConfiguration(), getClient()); + } + } + + public static class Post extends ApiClient implements PostOperation { + public Post(ApiConfiguration apiConfiguration, SchemaConfiguration schemaConfiguration) { + super(apiConfiguration, schemaConfiguration); + } + } + + public static class PostRequest { + public FakeinlinecompositionPostRequestBody.@Nullable SealedRequestBody requestBody; + public FakeinlinecompositionPostQueryParameters.@Nullable QueryParametersMap queryParameters; + public RootServerInfo.@Nullable ServerIndex serverIndex; + public @Nullable Duration timeout; + } + + public interface SetterForRequestBody { + PostRequest getInstance(); + T getBuilderAfterRequestBody(PostRequest instance); + default T requestBody(FakeinlinecompositionPostRequestBody.SealedRequestBody requestBody) { + var instance = getInstance(); + instance.requestBody = requestBody; + return getBuilderAfterRequestBody(instance); + } + } + + public interface SetterForQueryParameters { + PostRequest getInstance(); + T getBuilderAfterQueryParameters(PostRequest instance); + default T queryParameters(FakeinlinecompositionPostQueryParameters.QueryParametersMap queryParameters) { + var instance = getInstance(); + instance.queryParameters = queryParameters; + return getBuilderAfterQueryParameters(instance); + } + } + + public interface SetterForServerIndex { + PostRequest getInstance(); + T getBuilderAfterServerIndex(PostRequest instance); + default T serverIndex(RootServerInfo.ServerIndex serverIndex) { + var instance = getInstance(); + instance.serverIndex = serverIndex; + return getBuilderAfterServerIndex(instance); + } + } + + public interface SetterForTimeout { + PostRequest getInstance(); + T getBuilderAfterTimeout(PostRequest instance); + default T timeout(Duration timeout) { + var instance = getInstance(); + instance.timeout = timeout; + return getBuilderAfterTimeout(instance); + } + } + + public static class PostRequestBuilder implements SetterForRequestBody, SetterForQueryParameters, SetterForServerIndex, SetterForTimeout { + private final PostRequest instance; + + public PostRequestBuilder() { + this.instance = new PostRequest(); + } + + public PostRequest build() { + return instance; + } + + public PostRequest getInstance() { + return instance; + } + + public PostRequestBuilder getBuilderAfterRequestBody(PostRequest instance) { + return this; + } + + public PostRequestBuilder getBuilderAfterQueryParameters(PostRequest instance) { + return this; + } + + public PostRequestBuilder getBuilderAfterServerIndex(PostRequest instance) { + return this; + } + + public PostRequestBuilder getBuilderAfterTimeout(PostRequest instance) { + return this; + } + } +} diff --git a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/fakeinlinecomposition/post/FakeinlinecompositionPostQueryParameters.kt b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/fakeinlinecomposition/post/FakeinlinecompositionPostQueryParameters.kt new file mode 100644 index 00000000000..bc59678ea69 --- /dev/null +++ b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/fakeinlinecomposition/post/FakeinlinecompositionPostQueryParameters.kt @@ -0,0 +1,270 @@ +package org.openapijsonschematools.client.paths.fakeinlinecomposition.post; +import java.util.ArrayList; +import java.util.HashSet; +import java.util.LinkedHashMap; +import java.util.LinkedHashSet; +import java.util.List; +import java.util.Map; +import java.util.Objects; +import java.util.Set; +import org.checkerframework.checker.nullness.qual.Nullable; +import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags; +import org.openapijsonschematools.client.configurations.SchemaConfiguration; +import org.openapijsonschematools.client.exceptions.UnsetPropertyException; +import org.openapijsonschematools.client.exceptions.ValidationException; +import org.openapijsonschematools.client.paths.fakeinlinecomposition.post.parameters.parameter0.Schema0; +import org.openapijsonschematools.client.paths.fakeinlinecomposition.post.parameters.parameter1.Schema1; +import org.openapijsonschematools.client.schemas.AnyTypeJsonSchema; +import org.openapijsonschematools.client.schemas.GenericBuilder; +import org.openapijsonschematools.client.schemas.NotAnyTypeJsonSchema; +import org.openapijsonschematools.client.schemas.validation.FrozenMap; +import org.openapijsonschematools.client.schemas.validation.JsonSchema; +import org.openapijsonschematools.client.schemas.validation.JsonSchemaInfo; +import org.openapijsonschematools.client.schemas.validation.MapSchemaValidator; +import org.openapijsonschematools.client.schemas.validation.MapUtils; +import org.openapijsonschematools.client.schemas.validation.PathToSchemasMap; +import org.openapijsonschematools.client.schemas.validation.PropertyEntry; +import org.openapijsonschematools.client.schemas.validation.ValidationMetadata; + +public class FakeinlinecompositionPostQueryParameters { + // nest classes so all schemas and input/output classes can be public + + + public static class AdditionalProperties extends NotAnyTypeJsonSchema.NotAnyTypeJsonSchema1 { + // NotAnyTypeSchema + private static @Nullable AdditionalProperties instance = null; + public static AdditionalProperties getInstance() { + if (instance == null) { + instance = new AdditionalProperties(); + } + return instance; + } + } + + + public static class QueryParametersMap extends FrozenMap<@Nullable Object> { + protected QueryParametersMap(FrozenMap<@Nullable Object> m) { + super(m); + } + public static final Set requiredKeys = Set.of(); + public static final Set optionalKeys = Set.of( + "compositionAtRoot", + "compositionInProperty" + ); + public static QueryParametersMap of(Map arg, SchemaConfiguration configuration) throws ValidationException { + return FakeinlinecompositionPostQueryParameters1.getInstance().validate(arg, configuration); + } + + public @Nullable Object compositionAtRoot() throws UnsetPropertyException { + String key = "compositionAtRoot"; + throwIfKeyNotPresent(key); + @Nullable Object value = get(key); + if (!(value instanceof Object)) { + throw new RuntimeException("Invalid value stored for compositionAtRoot"); + } + return (@Nullable Object) value; + } + + public Schema1.SchemaMap1 compositionInProperty() throws UnsetPropertyException { + String key = "compositionInProperty"; + throwIfKeyNotPresent(key); + @Nullable Object value = get(key); + if (!(value instanceof Schema1.SchemaMap1)) { + throw new RuntimeException("Invalid value stored for compositionInProperty"); + } + return (Schema1.SchemaMap1) value; + } + } + + public interface SetterForCompositionAtRoot { + Map getInstance(); + T getBuilderAfterCompositionAtRoot(Map instance); + + default T compositionAtRoot(Nothing? value) { + var instance = getInstance(); + instance.put("compositionAtRoot", null); + return getBuilderAfterCompositionAtRoot(instance); + } + + default T compositionAtRoot(boolean value) { + var instance = getInstance(); + instance.put("compositionAtRoot", value); + return getBuilderAfterCompositionAtRoot(instance); + } + + default T compositionAtRoot(String value) { + var instance = getInstance(); + instance.put("compositionAtRoot", value); + return getBuilderAfterCompositionAtRoot(instance); + } + + default T compositionAtRoot(int value) { + var instance = getInstance(); + instance.put("compositionAtRoot", value); + return getBuilderAfterCompositionAtRoot(instance); + } + + default T compositionAtRoot(float value) { + var instance = getInstance(); + instance.put("compositionAtRoot", value); + return getBuilderAfterCompositionAtRoot(instance); + } + + default T compositionAtRoot(long value) { + var instance = getInstance(); + instance.put("compositionAtRoot", value); + return getBuilderAfterCompositionAtRoot(instance); + } + + default T compositionAtRoot(double value) { + var instance = getInstance(); + instance.put("compositionAtRoot", value); + return getBuilderAfterCompositionAtRoot(instance); + } + + default T compositionAtRoot(List value) { + var instance = getInstance(); + instance.put("compositionAtRoot", value); + return getBuilderAfterCompositionAtRoot(instance); + } + + default T compositionAtRoot(Map value) { + var instance = getInstance(); + instance.put("compositionAtRoot", value); + return getBuilderAfterCompositionAtRoot(instance); + } + } + + public interface SetterForCompositionInProperty { + Map getInstance(); + T getBuilderAfterCompositionInProperty(Map instance); + + default T compositionInProperty(Map value) { + var instance = getInstance(); + instance.put("compositionInProperty", value); + return getBuilderAfterCompositionInProperty(instance); + } + } + + public static class QueryParametersMapBuilder implements GenericBuilder>, SetterForCompositionAtRoot, SetterForCompositionInProperty { + private final Map instance; + private static final Set knownKeys = Set.of( + "compositionAtRoot", + "compositionInProperty" + ); + public Set getKnownKeys() { + return knownKeys; + } + public QueryParametersMapBuilder() { + this.instance = new LinkedHashMap<>(); + } + public Map build() { + return instance; + } + public Map getInstance() { + return instance; + } + public QueryParametersMapBuilder getBuilderAfterCompositionAtRoot(Map instance) { + return this; + } + public QueryParametersMapBuilder getBuilderAfterCompositionInProperty(Map instance) { + return this; + } + } + + + public sealed interface FakeinlinecompositionPostQueryParameters1Boxed permits FakeinlinecompositionPostQueryParameters1BoxedMap { + @Nullable Object getData(); + } + + public record FakeinlinecompositionPostQueryParameters1BoxedMap(QueryParametersMap data) implements FakeinlinecompositionPostQueryParameters1Boxed { + @Override + public @Nullable Object getData() { + return data; + } + } + + + public static class FakeinlinecompositionPostQueryParameters1 extends JsonSchema implements MapSchemaValidator { + private static @Nullable FakeinlinecompositionPostQueryParameters1 instance = null; + + protected FakeinlinecompositionPostQueryParameters1() { + super(new JsonSchemaInfo() + .type(Set.of(Map.class)) + .properties(Map.ofEntries( + new PropertyEntry("compositionAtRoot", Schema0.Schema01.class), + new PropertyEntry("compositionInProperty", Schema1.Schema11.class) + )) + .additionalProperties(AdditionalProperties.class) + ); + } + + public static FakeinlinecompositionPostQueryParameters1 getInstance() { + if (instance == null) { + instance = new FakeinlinecompositionPostQueryParameters1(); + } + return instance; + } + + 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 RuntimeException("Invalid non-string key value"); + } + String propertyName = (String) entryKey; + List propertyPathToItem = new ArrayList<>(pathToItem); + propertyPathToItem.add(propertyName); + Object value = entry.getValue(); + LinkedHashMap, Nothing?> schemas = pathToSchemas.get(propertyPathToItem); + if (schemas == null) { + throw new RuntimeException("Validation result is invalid, schemas must exist for a pathToItem"); + } + JsonSchema propertySchema = schemas.entrySet().iterator().next().getKey(); + @Nullable Object propertyInstance = propertySchema.getNewInstance(value, propertyPathToItem, pathToSchemas); + properties.put(propertyName, propertyInstance); + } + FrozenMap<@Nullable Object> castProperties = new FrozenMap<>(properties); + return new QueryParametersMap(castProperties); + } + + 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); + SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().build())); + ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, new PathToSchemasMap(), new LinkedHashSet<>()); + PathToSchemasMap pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet); + return getNewInstance(castArg, validationMetadata.pathToItem(), pathToSchemasMap); + } + + + @Override + public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws 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"); + } + @Override + public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { + if (arg instanceof Map) { + return getNewInstance((Map) arg, pathToItem, pathToSchemas); + } + throw new RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); + } + @Override + public FakeinlinecompositionPostQueryParameters1BoxedMap validateAndBox(Map arg, SchemaConfiguration configuration) throws ValidationException { + return new FakeinlinecompositionPostQueryParameters1BoxedMap(validate(arg, configuration)); + } + @Override + public FakeinlinecompositionPostQueryParameters1Boxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { + 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"); + } + } + +} diff --git a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/fakeinlinecomposition/post/FakeinlinecompositionPostRequestBody.kt b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/fakeinlinecomposition/post/FakeinlinecompositionPostRequestBody.kt new file mode 100644 index 00000000000..f3aef379fd3 --- /dev/null +++ b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/fakeinlinecomposition/post/FakeinlinecompositionPostRequestBody.kt @@ -0,0 +1,71 @@ +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; +import org.openapijsonschematools.client.mediatype.MediaType; +import org.openapijsonschematools.client.paths.fakeinlinecomposition.post.requestbody.content.applicationjson.ApplicationjsonSchema; +import org.openapijsonschematools.client.paths.fakeinlinecomposition.post.requestbody.content.multipartformdata.MultipartformdataSchema; + +import java.util.AbstractMap; +import java.util.Map; + +public class FakeinlinecompositionPostRequestBody { + public sealed interface SealedMediaType permits ApplicationjsonMediaType, MultipartformdataMediaType {} + + public record ApplicationjsonMediaType(ApplicationjsonSchema.ApplicationjsonSchema1 schema) implements SealedMediaType, MediaType { + public ApplicationjsonMediaType() { + this(ApplicationjsonSchema.ApplicationjsonSchema1.getInstance()); + } + @Override + public Nothing? encoding() { + return null; + } + } + + public record MultipartformdataMediaType(MultipartformdataSchema.MultipartformdataSchema1 schema) implements SealedMediaType, MediaType { + public MultipartformdataMediaType() { + this(MultipartformdataSchema.MultipartformdataSchema1.getInstance()); + } + @Override + public Nothing? encoding() { + return null; + } + } + + public static class FakeinlinecompositionPostRequestBody1 extends RequestBodySerializer { + public FakeinlinecompositionPostRequestBody1() { + super( + Map.ofEntries( + new AbstractMap.SimpleEntry<>("application/json", new ApplicationjsonMediaType()), + new AbstractMap.SimpleEntry<>("multipart/form-data", new MultipartformdataMediaType()) + ), + false + ); + } + + public SerializedRequestBody serialize(SealedRequestBody requestBody) throws NotImplementedException { + if (requestBody instanceof ApplicationjsonRequestBody requestBody0) { + return serialize(requestBody0.contentType(), requestBody0.body().getData()); + } else { + MultipartformdataRequestBody requestBody1 = (MultipartformdataRequestBody) requestBody; + return serialize(requestBody1.contentType(), requestBody1.body().getData()); + } + } + } + + public sealed interface SealedRequestBody permits ApplicationjsonRequestBody, MultipartformdataRequestBody {} + public record ApplicationjsonRequestBody(ApplicationjsonSchema.ApplicationjsonSchema1Boxed body) implements SealedRequestBody, GenericRequestBody { + @Override + public String contentType() { + return "application/json"; + } + } + public record MultipartformdataRequestBody(MultipartformdataSchema.MultipartformdataSchema1Boxed body) implements SealedRequestBody, GenericRequestBody { + @Override + public String contentType() { + return "multipart/form-data"; + } + } +} diff --git a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/fakeinlinecomposition/post/FakeinlinecompositionPostResponses.kt b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/fakeinlinecomposition/post/FakeinlinecompositionPostResponses.kt new file mode 100644 index 00000000000..2899ee99c20 --- /dev/null +++ b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/fakeinlinecomposition/post/FakeinlinecompositionPostResponses.kt @@ -0,0 +1,53 @@ +package org.openapijsonschematools.client.paths.fakeinlinecomposition.post; + +import org.openapijsonschematools.client.paths.fakeinlinecomposition.post.responses.FakeinlinecompositionPostCode200Response; +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; +import org.checkerframework.checker.nullness.qual.Nullable; + +import java.net.http.HttpResponse; +import java.util.Map; +import java.util.AbstractMap; + +public class FakeinlinecompositionPostResponses { + public sealed interface EndpointResponse permits EndpointFakeinlinecompositionPostCode200Response {} + + public record EndpointFakeinlinecompositionPostCode200Response( + HttpResponse response, + FakeinlinecompositionPostCode200Response.SealedResponseBody body, + Nothing? headers + ) implements EndpointResponse, ApiResponse{ + } + + public sealed interface StatusCodeResponseDeserializer permits StatusFakeinlinecompositionPostCode200ResponseDeserializer {} + + public static final class StatusFakeinlinecompositionPostCode200ResponseDeserializer extends FakeinlinecompositionPostCode200Response.FakeinlinecompositionPostCode200Response1 implements StatusCodeResponseDeserializer { + } + + public static final class FakeinlinecompositionPostResponses1 implements ResponsesDeserializer { + private final Map statusCodeToResponseDeserializer; + public FakeinlinecompositionPostResponses1() { + this.statusCodeToResponseDeserializer = Map.ofEntries( + new AbstractMap.SimpleEntry<>("200", new StatusFakeinlinecompositionPostCode200ResponseDeserializer()) + ); + } + + 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) { + throw new ApiException( + "Invalid response statusCode="+statusCode+" has no response defined in the openapi document", + response + ); + } + StatusFakeinlinecompositionPostCode200ResponseDeserializer castDeserializer = (StatusFakeinlinecompositionPostCode200ResponseDeserializer) statusCodeDeserializer; + var deserializedResponse = castDeserializer.deserialize(response, configuration); + return new EndpointFakeinlinecompositionPostCode200Response(response, deserializedResponse.body(), deserializedResponse.headers()); + } + } +} diff --git a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/fakeinlinecomposition/post/Parameters.kt b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/fakeinlinecomposition/post/Parameters.kt new file mode 100644 index 00000000000..358e05fde21 --- /dev/null +++ b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/fakeinlinecomposition/post/Parameters.kt @@ -0,0 +1,22 @@ +package org.openapijsonschematools.client.paths.fakeinlinecomposition.post; + +import org.openapijsonschematools.client.paths.fakeinlinecomposition.post.parameters.Parameter0; +import org.openapijsonschematools.client.paths.fakeinlinecomposition.post.parameters.Parameter1; +import org.openapijsonschematools.client.parameter.QuerySerializer; + +import java.util.Map; +import java.util.AbstractMap; + +public class Parameters { + + public static class QueryParametersSerializer extends QuerySerializer { + public QueryParametersSerializer() { + super( + Map.ofEntries( + new AbstractMap.SimpleEntry<>("compositionAtRoot", new Parameter0.Parameter01()), + new AbstractMap.SimpleEntry<>("compositionInProperty", new Parameter1.Parameter11()) + ) + ); + } + } +} diff --git a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/fakeinlinecomposition/post/parameters/Parameter0.kt b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/fakeinlinecomposition/post/parameters/Parameter0.kt new file mode 100644 index 00000000000..020d186ab95 --- /dev/null +++ b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/fakeinlinecomposition/post/parameters/Parameter0.kt @@ -0,0 +1,23 @@ +package org.openapijsonschematools.client.paths.fakeinlinecomposition.post.parameters; + +import org.openapijsonschematools.client.parameter.ParameterStyle; +import org.openapijsonschematools.client.parameter.ParameterInType; +import org.openapijsonschematools.client.parameter.SchemaParameter; +import org.openapijsonschematools.client.paths.fakeinlinecomposition.post.parameters.parameter0.Schema0; + +public class Parameter0 { + + public static class Parameter01 extends SchemaParameter { + public Parameter01() { + super( + "compositionAtRoot", + ParameterInType.QUERY, + false, + ParameterStyle.FORM, + true, + false, + Schema0.Schema01.getInstance() + ); + } + } +} diff --git a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/fakeinlinecomposition/post/parameters/Parameter1.kt b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/fakeinlinecomposition/post/parameters/Parameter1.kt new file mode 100644 index 00000000000..94e5c75ccf6 --- /dev/null +++ b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/fakeinlinecomposition/post/parameters/Parameter1.kt @@ -0,0 +1,23 @@ +package org.openapijsonschematools.client.paths.fakeinlinecomposition.post.parameters; + +import org.openapijsonschematools.client.parameter.ParameterStyle; +import org.openapijsonschematools.client.parameter.ParameterInType; +import org.openapijsonschematools.client.parameter.SchemaParameter; +import org.openapijsonschematools.client.paths.fakeinlinecomposition.post.parameters.parameter1.Schema1; + +public class Parameter1 { + + public static class Parameter11 extends SchemaParameter { + public Parameter11() { + super( + "compositionInProperty", + ParameterInType.QUERY, + false, + ParameterStyle.FORM, + true, + false, + Schema1.Schema11.getInstance() + ); + } + } +} diff --git a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/fakeinlinecomposition/post/parameters/parameter0/Schema0.kt b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/fakeinlinecomposition/post/parameters/parameter0/Schema0.kt new file mode 100644 index 00000000000..8655febbd57 --- /dev/null +++ b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/fakeinlinecomposition/post/parameters/parameter0/Schema0.kt @@ -0,0 +1,393 @@ +package org.openapijsonschematools.client.paths.fakeinlinecomposition.post.parameters.parameter0; +import java.time.LocalDate; +import java.time.ZonedDateTime; +import java.util.ArrayList; +import java.util.HashSet; +import java.util.LinkedHashMap; +import java.util.LinkedHashSet; +import java.util.List; +import java.util.Map; +import java.util.Objects; +import java.util.Set; +import java.util.UUID; +import org.checkerframework.checker.nullness.qual.Nullable; +import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags; +import org.openapijsonschematools.client.configurations.SchemaConfiguration; +import org.openapijsonschematools.client.exceptions.InvalidAdditionalPropertyException; +import org.openapijsonschematools.client.exceptions.UnsetPropertyException; +import org.openapijsonschematools.client.exceptions.ValidationException; +import org.openapijsonschematools.client.schemas.UnsetAddPropsSetter; +import org.openapijsonschematools.client.schemas.validation.BooleanSchemaValidator; +import org.openapijsonschematools.client.schemas.validation.FrozenList; +import org.openapijsonschematools.client.schemas.validation.FrozenMap; +import org.openapijsonschematools.client.schemas.validation.JsonSchema; +import org.openapijsonschematools.client.schemas.validation.JsonSchemaInfo; +import org.openapijsonschematools.client.schemas.validation.ListSchemaValidator; +import org.openapijsonschematools.client.schemas.validation.MapSchemaValidator; +import org.openapijsonschematools.client.schemas.validation.NullSchemaValidator; +import org.openapijsonschematools.client.schemas.validation.NumberSchemaValidator; +import org.openapijsonschematools.client.schemas.validation.PathToSchemasMap; +import org.openapijsonschematools.client.schemas.validation.StringSchemaValidator; +import org.openapijsonschematools.client.schemas.validation.ValidationMetadata; + +public class Schema0 { + // nest classes so all schemas and input/output classes can be public + + + public sealed interface Schema00Boxed permits Schema00BoxedString { + @Nullable Object getData(); + } + + public record Schema00BoxedString(String data) implements Schema00Boxed { + @Override + public @Nullable Object getData() { + return data; + } + } + + + + public static class Schema00 extends JsonSchema implements StringSchemaValidator { + private static @Nullable Schema00 instance = null; + + protected Schema00() { + super(new JsonSchemaInfo() + .type(Set.of( + String.class + )) + .minLength(1) + ); + } + + public static Schema00 getInstance() { + if (instance == null) { + instance = new Schema00(); + } + return instance; + } + + @Override + public String validate(String arg, SchemaConfiguration configuration) throws ValidationException { + Set> pathSet = new HashSet<>(); + List pathToItem = List.of("args[0"); + String castArg = castToAllowedTypes(arg, pathToItem, pathSet); + SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().build())); + ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, new PathToSchemasMap(), new LinkedHashSet<>()); + getPathToSchemas(this, castArg, validationMetadata, pathSet); + return castArg; + } + + @Override + public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws 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"); + } + @Override + public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { + 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"); + } + @Override + 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 { + 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"); + } + } + + public sealed interface Schema01Boxed permits Schema01BoxedVoid, Schema01BoxedBoolean, Schema01BoxedNumber, Schema01BoxedString, Schema01BoxedList, Schema01BoxedMap { + @Nullable Object getData(); + } + + public record Schema01BoxedVoid(Nothing? data) implements Schema01Boxed { + @Override + public @Nullable Object getData() { + return data; + } + } + + public record Schema01BoxedBoolean(boolean data) implements Schema01Boxed { + @Override + public @Nullable Object getData() { + return data; + } + } + + public record Schema01BoxedNumber(Number data) implements Schema01Boxed { + @Override + public @Nullable Object getData() { + return data; + } + } + + public record Schema01BoxedString(String data) implements Schema01Boxed { + @Override + public @Nullable Object getData() { + return data; + } + } + + public record Schema01BoxedList(FrozenList<@Nullable Object> data) implements Schema01Boxed { + @Override + public @Nullable Object getData() { + return data; + } + } + + public record Schema01BoxedMap(FrozenMap<@Nullable Object> data) implements Schema01Boxed { + @Override + public @Nullable Object getData() { + return data; + } + } + + + public static class Schema01 extends JsonSchema implements NullSchemaValidator, BooleanSchemaValidator, NumberSchemaValidator, StringSchemaValidator, ListSchemaValidator, Schema01BoxedList>, MapSchemaValidator, Schema01BoxedMap> { + private static @Nullable Schema01 instance = null; + + protected Schema01() { + super(new JsonSchemaInfo() + .allOf(List.of( + Schema00.class + )) + ); + } + + public static Schema01 getInstance() { + if (instance == null) { + instance = new Schema01(); + } + return instance; + } + + @Override + public Nothing? validate(Nothing? arg, SchemaConfiguration configuration) throws ValidationException { + Set> pathSet = new HashSet<>(); + List pathToItem = List.of("args[0]"); + Nothing? castArg = castToAllowedTypes(arg, pathToItem, pathSet); + SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().build())); + PathToSchemasMap validatedPathToSchemas = new PathToSchemasMap(); + ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, new LinkedHashSet<>()); + getPathToSchemas(this, castArg, validationMetadata, pathSet); + return castArg; + } + + @Override + public boolean validate(boolean arg, SchemaConfiguration configuration) throws ValidationException { + Set> pathSet = new HashSet<>(); + List pathToItem = List.of("args[0]"); + boolean castArg = castToAllowedTypes(arg, pathToItem, pathSet); + SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().build())); + PathToSchemasMap validatedPathToSchemas = new PathToSchemasMap(); + ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, new LinkedHashSet<>()); + getPathToSchemas(this, castArg, validationMetadata, pathSet); + return castArg; + } + + @Override + public Number validate(Number arg, SchemaConfiguration configuration) throws ValidationException { + Set> pathSet = new HashSet<>(); + List pathToItem = List.of("args[0]"); + Number castArg = castToAllowedTypes(arg, pathToItem, pathSet); + SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().build())); + PathToSchemasMap validatedPathToSchemas = new PathToSchemasMap(); + ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, new LinkedHashSet<>()); + getPathToSchemas(this, castArg, validationMetadata, pathSet); + return castArg; + } + + public int validate(int arg, SchemaConfiguration configuration) throws ValidationException { + return (int) validate((Number) arg, configuration); + } + + public long validate(long arg, SchemaConfiguration configuration) throws ValidationException { + return (long) validate((Number) arg, configuration); + } + + public float validate(float arg, SchemaConfiguration configuration) throws ValidationException { + return (float) validate((Number) arg, configuration); + } + + public double validate(double arg, SchemaConfiguration configuration) throws ValidationException { + return (double) validate((Number) arg, configuration); + } + + @Override + public String validate(String arg, SchemaConfiguration configuration) throws ValidationException { + Set> pathSet = new HashSet<>(); + List pathToItem = List.of("args[0]"); + String castArg = castToAllowedTypes(arg, pathToItem, pathSet); + SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().build())); + PathToSchemasMap validatedPathToSchemas = new PathToSchemasMap(); + ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, new LinkedHashSet<>()); + getPathToSchemas(this, castArg, validationMetadata, pathSet); + return castArg; + } + + public String validate(LocalDate arg, SchemaConfiguration configuration) throws ValidationException { + return validate(arg.toString(), configuration); + } + + public String validate(ZonedDateTime arg, SchemaConfiguration configuration) throws ValidationException { + return validate(arg.toString(), configuration); + } + + public String validate(UUID arg, SchemaConfiguration configuration) throws ValidationException { + return validate(arg.toString(), configuration); + } + + @Override + public FrozenList<@Nullable Object> getNewInstance(List arg, List pathToItem, PathToSchemasMap pathToSchemas) { + List<@Nullable Object> items = new ArrayList<>(); + int i = 0; + for (Object item: arg) { + List itemPathToItem = new ArrayList<>(pathToItem); + itemPathToItem.add(i); + LinkedHashMap, Nothing?> schemas = pathToSchemas.get(itemPathToItem); + if (schemas == null) { + throw new RuntimeException("Validation result is invalid, schemas must exist for a pathToItem"); + } + JsonSchema itemSchema = schemas.entrySet().iterator().next().getKey(); + @Nullable Object itemInstance = itemSchema.getNewInstance(item, itemPathToItem, pathToSchemas); + items.add(itemInstance); + i += 1; + } + FrozenList<@Nullable Object> newInstanceItems = new FrozenList<>(items); + return newInstanceItems; + } + + 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); + SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().build())); + ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, new PathToSchemasMap(), new LinkedHashSet<>()); + PathToSchemasMap pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet); + return getNewInstance(castArg, validationMetadata.pathToItem(), pathToSchemasMap); + } + + @Override + 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 RuntimeException("Invalid non-string key value"); + } + String propertyName = (String) entryKey; + List propertyPathToItem = new ArrayList<>(pathToItem); + propertyPathToItem.add(propertyName); + Object value = entry.getValue(); + LinkedHashMap, Nothing?> schemas = pathToSchemas.get(propertyPathToItem); + if (schemas == null) { + throw new RuntimeException("Validation result is invalid, schemas must exist for a pathToItem"); + } + JsonSchema propertySchema = schemas.entrySet().iterator().next().getKey(); + @Nullable Object propertyInstance = propertySchema.getNewInstance(value, propertyPathToItem, pathToSchemas); + properties.put(propertyName, propertyInstance); + } + FrozenMap<@Nullable Object> castProperties = new FrozenMap<>(properties); + return castProperties; + } + + public FrozenMap<@Nullable Object> validate(Map arg, SchemaConfiguration configuration) throws ValidationException { + Set> pathSet = new HashSet<>(); + List pathToItem = List.of("args[0]"); + Map castArg = castToAllowedTypes(arg, pathToItem, pathSet); + SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().build())); + PathToSchemasMap validatedPathToSchemas = new PathToSchemasMap(); + ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, new LinkedHashSet<>()); + PathToSchemasMap pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet); + return getNewInstance(castArg, validationMetadata.pathToItem(), pathToSchemasMap); + } + + @Override + public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { + if (arg == null) { + return validate((Nothing?) null, configuration); + } else if (arg instanceof Boolean) { + boolean boolArg = (Boolean) arg; + return validate(boolArg, configuration); + } else if (arg instanceof Number) { + return validate((Number) arg, configuration); + } else if (arg instanceof String) { + return validate((String) arg, configuration); + } else if (arg instanceof List) { + return validate((List) arg, 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"); + } + @Override + public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { + if (arg == null) { + return getNewInstance((Nothing?) null, pathToItem, pathToSchemas); + } else if (arg instanceof Boolean) { + boolean boolArg = (Boolean) arg; + return getNewInstance(boolArg, pathToItem, pathToSchemas); + } else if (arg instanceof Number) { + return getNewInstance((Number) arg, pathToItem, pathToSchemas); + } else if (arg instanceof String) { + return getNewInstance((String) arg, pathToItem, pathToSchemas); + } else if (arg instanceof List) { + return getNewInstance((List) arg, 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"); + } + @Override + public Schema01BoxedVoid validateAndBox(Nothing? arg, SchemaConfiguration configuration) throws ValidationException { + return new Schema01BoxedVoid(validate(arg, configuration)); + } + @Override + 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 { + return new Schema01BoxedNumber(validate(arg, configuration)); + } + @Override + 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 { + return new Schema01BoxedList(validate(arg, configuration)); + } + @Override + 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 { + if (arg == null) { + Nothing? castArg = (Nothing?) arg; + return validateAndBox(castArg, configuration); + } else if (arg instanceof Boolean booleanArg) { + boolean castArg = booleanArg; + return validateAndBox(castArg, configuration); + } else if (arg instanceof String castArg) { + return validateAndBox(castArg, configuration); + } else if (arg instanceof Number castArg) { + return validateAndBox(castArg, configuration); + } else if (arg instanceof List castArg) { + 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"); + } + } +} diff --git a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/fakeinlinecomposition/post/parameters/parameter1/Schema1.kt b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/fakeinlinecomposition/post/parameters/parameter1/Schema1.kt new file mode 100644 index 00000000000..be97d1c22f3 --- /dev/null +++ b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/fakeinlinecomposition/post/parameters/parameter1/Schema1.kt @@ -0,0 +1,596 @@ +package org.openapijsonschematools.client.paths.fakeinlinecomposition.post.parameters.parameter1; +import java.time.LocalDate; +import java.time.ZonedDateTime; +import java.util.ArrayList; +import java.util.HashSet; +import java.util.LinkedHashMap; +import java.util.LinkedHashSet; +import java.util.List; +import java.util.Map; +import java.util.Objects; +import java.util.Set; +import java.util.UUID; +import org.checkerframework.checker.nullness.qual.Nullable; +import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags; +import org.openapijsonschematools.client.configurations.SchemaConfiguration; +import org.openapijsonschematools.client.exceptions.InvalidAdditionalPropertyException; +import org.openapijsonschematools.client.exceptions.UnsetPropertyException; +import org.openapijsonschematools.client.exceptions.ValidationException; +import org.openapijsonschematools.client.schemas.GenericBuilder; +import org.openapijsonschematools.client.schemas.UnsetAddPropsSetter; +import org.openapijsonschematools.client.schemas.validation.BooleanSchemaValidator; +import org.openapijsonschematools.client.schemas.validation.FrozenList; +import org.openapijsonschematools.client.schemas.validation.FrozenMap; +import org.openapijsonschematools.client.schemas.validation.JsonSchema; +import org.openapijsonschematools.client.schemas.validation.JsonSchemaInfo; +import org.openapijsonschematools.client.schemas.validation.ListSchemaValidator; +import org.openapijsonschematools.client.schemas.validation.MapSchemaValidator; +import org.openapijsonschematools.client.schemas.validation.NullSchemaValidator; +import org.openapijsonschematools.client.schemas.validation.NumberSchemaValidator; +import org.openapijsonschematools.client.schemas.validation.PathToSchemasMap; +import org.openapijsonschematools.client.schemas.validation.PropertyEntry; +import org.openapijsonschematools.client.schemas.validation.StringSchemaValidator; +import org.openapijsonschematools.client.schemas.validation.ValidationMetadata; + +public class Schema1 { + // nest classes so all schemas and input/output classes can be public + + + public sealed interface Schema01Boxed permits Schema01BoxedString { + @Nullable Object getData(); + } + + public record Schema01BoxedString(String data) implements Schema01Boxed { + @Override + public @Nullable Object getData() { + return data; + } + } + + + + public static class Schema01 extends JsonSchema implements StringSchemaValidator { + private static @Nullable Schema01 instance = null; + + protected Schema01() { + super(new JsonSchemaInfo() + .type(Set.of( + String.class + )) + .minLength(1) + ); + } + + public static Schema01 getInstance() { + if (instance == null) { + instance = new Schema01(); + } + return instance; + } + + @Override + public String validate(String arg, SchemaConfiguration configuration) throws ValidationException { + Set> pathSet = new HashSet<>(); + List pathToItem = List.of("args[0"); + String castArg = castToAllowedTypes(arg, pathToItem, pathSet); + SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().build())); + ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, new PathToSchemasMap(), new LinkedHashSet<>()); + getPathToSchemas(this, castArg, validationMetadata, pathSet); + return castArg; + } + + @Override + public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws 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"); + } + @Override + public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { + 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"); + } + @Override + 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 { + 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"); + } + } + + public sealed interface SomeProp1Boxed permits SomeProp1BoxedVoid, SomeProp1BoxedBoolean, SomeProp1BoxedNumber, SomeProp1BoxedString, SomeProp1BoxedList, SomeProp1BoxedMap { + @Nullable Object getData(); + } + + public record SomeProp1BoxedVoid(Nothing? data) implements SomeProp1Boxed { + @Override + public @Nullable Object getData() { + return data; + } + } + + public record SomeProp1BoxedBoolean(boolean data) implements SomeProp1Boxed { + @Override + public @Nullable Object getData() { + return data; + } + } + + public record SomeProp1BoxedNumber(Number data) implements SomeProp1Boxed { + @Override + public @Nullable Object getData() { + return data; + } + } + + public record SomeProp1BoxedString(String data) implements SomeProp1Boxed { + @Override + public @Nullable Object getData() { + return data; + } + } + + public record SomeProp1BoxedList(FrozenList<@Nullable Object> data) implements SomeProp1Boxed { + @Override + public @Nullable Object getData() { + return data; + } + } + + public record SomeProp1BoxedMap(FrozenMap<@Nullable Object> data) implements SomeProp1Boxed { + @Override + public @Nullable Object getData() { + return data; + } + } + + + public static class SomeProp1 extends JsonSchema implements NullSchemaValidator, BooleanSchemaValidator, NumberSchemaValidator, StringSchemaValidator, ListSchemaValidator, SomeProp1BoxedList>, MapSchemaValidator, SomeProp1BoxedMap> { + private static @Nullable SomeProp1 instance = null; + + protected SomeProp1() { + super(new JsonSchemaInfo() + .allOf(List.of( + Schema01.class + )) + ); + } + + public static SomeProp1 getInstance() { + if (instance == null) { + instance = new SomeProp1(); + } + return instance; + } + + @Override + public Nothing? validate(Nothing? arg, SchemaConfiguration configuration) throws ValidationException { + Set> pathSet = new HashSet<>(); + List pathToItem = List.of("args[0]"); + Nothing? castArg = castToAllowedTypes(arg, pathToItem, pathSet); + SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().build())); + PathToSchemasMap validatedPathToSchemas = new PathToSchemasMap(); + ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, new LinkedHashSet<>()); + getPathToSchemas(this, castArg, validationMetadata, pathSet); + return castArg; + } + + @Override + public boolean validate(boolean arg, SchemaConfiguration configuration) throws ValidationException { + Set> pathSet = new HashSet<>(); + List pathToItem = List.of("args[0]"); + boolean castArg = castToAllowedTypes(arg, pathToItem, pathSet); + SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().build())); + PathToSchemasMap validatedPathToSchemas = new PathToSchemasMap(); + ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, new LinkedHashSet<>()); + getPathToSchemas(this, castArg, validationMetadata, pathSet); + return castArg; + } + + @Override + public Number validate(Number arg, SchemaConfiguration configuration) throws ValidationException { + Set> pathSet = new HashSet<>(); + List pathToItem = List.of("args[0]"); + Number castArg = castToAllowedTypes(arg, pathToItem, pathSet); + SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().build())); + PathToSchemasMap validatedPathToSchemas = new PathToSchemasMap(); + ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, new LinkedHashSet<>()); + getPathToSchemas(this, castArg, validationMetadata, pathSet); + return castArg; + } + + public int validate(int arg, SchemaConfiguration configuration) throws ValidationException { + return (int) validate((Number) arg, configuration); + } + + public long validate(long arg, SchemaConfiguration configuration) throws ValidationException { + return (long) validate((Number) arg, configuration); + } + + public float validate(float arg, SchemaConfiguration configuration) throws ValidationException { + return (float) validate((Number) arg, configuration); + } + + public double validate(double arg, SchemaConfiguration configuration) throws ValidationException { + return (double) validate((Number) arg, configuration); + } + + @Override + public String validate(String arg, SchemaConfiguration configuration) throws ValidationException { + Set> pathSet = new HashSet<>(); + List pathToItem = List.of("args[0]"); + String castArg = castToAllowedTypes(arg, pathToItem, pathSet); + SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().build())); + PathToSchemasMap validatedPathToSchemas = new PathToSchemasMap(); + ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, new LinkedHashSet<>()); + getPathToSchemas(this, castArg, validationMetadata, pathSet); + return castArg; + } + + public String validate(LocalDate arg, SchemaConfiguration configuration) throws ValidationException { + return validate(arg.toString(), configuration); + } + + public String validate(ZonedDateTime arg, SchemaConfiguration configuration) throws ValidationException { + return validate(arg.toString(), configuration); + } + + public String validate(UUID arg, SchemaConfiguration configuration) throws ValidationException { + return validate(arg.toString(), configuration); + } + + @Override + public FrozenList<@Nullable Object> getNewInstance(List arg, List pathToItem, PathToSchemasMap pathToSchemas) { + List<@Nullable Object> items = new ArrayList<>(); + int i = 0; + for (Object item: arg) { + List itemPathToItem = new ArrayList<>(pathToItem); + itemPathToItem.add(i); + LinkedHashMap, Nothing?> schemas = pathToSchemas.get(itemPathToItem); + if (schemas == null) { + throw new RuntimeException("Validation result is invalid, schemas must exist for a pathToItem"); + } + JsonSchema itemSchema = schemas.entrySet().iterator().next().getKey(); + @Nullable Object itemInstance = itemSchema.getNewInstance(item, itemPathToItem, pathToSchemas); + items.add(itemInstance); + i += 1; + } + FrozenList<@Nullable Object> newInstanceItems = new FrozenList<>(items); + return newInstanceItems; + } + + 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); + SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().build())); + ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, new PathToSchemasMap(), new LinkedHashSet<>()); + PathToSchemasMap pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet); + return getNewInstance(castArg, validationMetadata.pathToItem(), pathToSchemasMap); + } + + @Override + 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 RuntimeException("Invalid non-string key value"); + } + String propertyName = (String) entryKey; + List propertyPathToItem = new ArrayList<>(pathToItem); + propertyPathToItem.add(propertyName); + Object value = entry.getValue(); + LinkedHashMap, Nothing?> schemas = pathToSchemas.get(propertyPathToItem); + if (schemas == null) { + throw new RuntimeException("Validation result is invalid, schemas must exist for a pathToItem"); + } + JsonSchema propertySchema = schemas.entrySet().iterator().next().getKey(); + @Nullable Object propertyInstance = propertySchema.getNewInstance(value, propertyPathToItem, pathToSchemas); + properties.put(propertyName, propertyInstance); + } + FrozenMap<@Nullable Object> castProperties = new FrozenMap<>(properties); + return castProperties; + } + + public FrozenMap<@Nullable Object> validate(Map arg, SchemaConfiguration configuration) throws ValidationException { + Set> pathSet = new HashSet<>(); + List pathToItem = List.of("args[0]"); + Map castArg = castToAllowedTypes(arg, pathToItem, pathSet); + SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().build())); + PathToSchemasMap validatedPathToSchemas = new PathToSchemasMap(); + ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, new LinkedHashSet<>()); + PathToSchemasMap pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet); + return getNewInstance(castArg, validationMetadata.pathToItem(), pathToSchemasMap); + } + + @Override + public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { + if (arg == null) { + return validate((Nothing?) null, configuration); + } else if (arg instanceof Boolean) { + boolean boolArg = (Boolean) arg; + return validate(boolArg, configuration); + } else if (arg instanceof Number) { + return validate((Number) arg, configuration); + } else if (arg instanceof String) { + return validate((String) arg, configuration); + } else if (arg instanceof List) { + return validate((List) arg, 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"); + } + @Override + public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { + if (arg == null) { + return getNewInstance((Nothing?) null, pathToItem, pathToSchemas); + } else if (arg instanceof Boolean) { + boolean boolArg = (Boolean) arg; + return getNewInstance(boolArg, pathToItem, pathToSchemas); + } else if (arg instanceof Number) { + return getNewInstance((Number) arg, pathToItem, pathToSchemas); + } else if (arg instanceof String) { + return getNewInstance((String) arg, pathToItem, pathToSchemas); + } else if (arg instanceof List) { + return getNewInstance((List) arg, 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"); + } + @Override + public SomeProp1BoxedVoid validateAndBox(Nothing? arg, SchemaConfiguration configuration) throws ValidationException { + return new SomeProp1BoxedVoid(validate(arg, configuration)); + } + @Override + 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 { + return new SomeProp1BoxedNumber(validate(arg, configuration)); + } + @Override + 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 { + return new SomeProp1BoxedList(validate(arg, configuration)); + } + @Override + 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 { + if (arg == null) { + Nothing? castArg = (Nothing?) arg; + return validateAndBox(castArg, configuration); + } else if (arg instanceof Boolean booleanArg) { + boolean castArg = booleanArg; + return validateAndBox(castArg, configuration); + } else if (arg instanceof String castArg) { + return validateAndBox(castArg, configuration); + } else if (arg instanceof Number castArg) { + return validateAndBox(castArg, configuration); + } else if (arg instanceof List castArg) { + 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"); + } + } + + public static class SchemaMap1 extends FrozenMap<@Nullable Object> { + protected SchemaMap1(FrozenMap<@Nullable Object> m) { + super(m); + } + public static final Set requiredKeys = Set.of(); + public static final Set optionalKeys = Set.of( + "someProp" + ); + public static SchemaMap1 of(Map arg, SchemaConfiguration configuration) throws ValidationException { + return Schema11.getInstance().validate(arg, configuration); + } + + public @Nullable Object someProp() throws UnsetPropertyException { + return getOrThrow("someProp"); + } + + public @Nullable Object getAdditionalProperty(String name) throws UnsetPropertyException, InvalidAdditionalPropertyException { + throwIfKeyKnown(name, requiredKeys, optionalKeys); + throwIfKeyNotPresent(name); + return get(name); + } + } + + public interface SetterForSomeProp1 { + Map getInstance(); + T getBuilderAfterSomeProp1(Map instance); + + default T someProp(Nothing? value) { + var instance = getInstance(); + instance.put("someProp", null); + return getBuilderAfterSomeProp1(instance); + } + + default T someProp(boolean value) { + var instance = getInstance(); + instance.put("someProp", value); + return getBuilderAfterSomeProp1(instance); + } + + default T someProp(String value) { + var instance = getInstance(); + instance.put("someProp", value); + return getBuilderAfterSomeProp1(instance); + } + + default T someProp(int value) { + var instance = getInstance(); + instance.put("someProp", value); + return getBuilderAfterSomeProp1(instance); + } + + default T someProp(float value) { + var instance = getInstance(); + instance.put("someProp", value); + return getBuilderAfterSomeProp1(instance); + } + + default T someProp(long value) { + var instance = getInstance(); + instance.put("someProp", value); + return getBuilderAfterSomeProp1(instance); + } + + default T someProp(double value) { + var instance = getInstance(); + instance.put("someProp", value); + return getBuilderAfterSomeProp1(instance); + } + + default T someProp(List value) { + var instance = getInstance(); + instance.put("someProp", value); + return getBuilderAfterSomeProp1(instance); + } + + default T someProp(Map value) { + var instance = getInstance(); + instance.put("someProp", value); + return getBuilderAfterSomeProp1(instance); + } + } + + public static class SchemaMapBuilder1 extends UnsetAddPropsSetter implements GenericBuilder>, SetterForSomeProp1 { + private final Map instance; + private static final Set knownKeys = Set.of( + "someProp" + ); + public Set getKnownKeys() { + return knownKeys; + } + public SchemaMapBuilder1() { + this.instance = new LinkedHashMap<>(); + } + public Map build() { + return instance; + } + public Map getInstance() { + return instance; + } + public SchemaMapBuilder1 getBuilderAfterSomeProp1(Map instance) { + return this; + } + public SchemaMapBuilder1 getBuilderAfterAdditionalProperty(Map instance) { + return this; + } + } + + + public sealed interface Schema11Boxed permits Schema11BoxedMap { + @Nullable Object getData(); + } + + public record Schema11BoxedMap(SchemaMap1 data) implements Schema11Boxed { + @Override + public @Nullable Object getData() { + return data; + } + } + + + public static class Schema11 extends JsonSchema implements MapSchemaValidator { + private static @Nullable Schema11 instance = null; + + protected Schema11() { + super(new JsonSchemaInfo() + .type(Set.of(Map.class)) + .properties(Map.ofEntries( + new PropertyEntry("someProp", SomeProp1.class) + )) + ); + } + + public static Schema11 getInstance() { + if (instance == null) { + instance = new Schema11(); + } + return instance; + } + + 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 RuntimeException("Invalid non-string key value"); + } + String propertyName = (String) entryKey; + List propertyPathToItem = new ArrayList<>(pathToItem); + propertyPathToItem.add(propertyName); + Object value = entry.getValue(); + LinkedHashMap, Nothing?> schemas = pathToSchemas.get(propertyPathToItem); + if (schemas == null) { + throw new RuntimeException("Validation result is invalid, schemas must exist for a pathToItem"); + } + JsonSchema propertySchema = schemas.entrySet().iterator().next().getKey(); + @Nullable Object propertyInstance = propertySchema.getNewInstance(value, propertyPathToItem, pathToSchemas); + properties.put(propertyName, propertyInstance); + } + FrozenMap<@Nullable Object> castProperties = new FrozenMap<>(properties); + return new SchemaMap1(castProperties); + } + + 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); + SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().build())); + ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, new PathToSchemasMap(), new LinkedHashSet<>()); + PathToSchemasMap pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet); + return getNewInstance(castArg, validationMetadata.pathToItem(), pathToSchemasMap); + } + + + @Override + public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws 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"); + } + @Override + public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { + if (arg instanceof Map) { + return getNewInstance((Map) arg, pathToItem, pathToSchemas); + } + 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 { + return new Schema11BoxedMap(validate(arg, configuration)); + } + @Override + public Schema11Boxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { + 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"); + } + } + +} diff --git a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/fakeinlinecomposition/post/requestbody/content/applicationjson/ApplicationjsonSchema.kt b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/fakeinlinecomposition/post/requestbody/content/applicationjson/ApplicationjsonSchema.kt new file mode 100644 index 00000000000..f23e78142b3 --- /dev/null +++ b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/fakeinlinecomposition/post/requestbody/content/applicationjson/ApplicationjsonSchema.kt @@ -0,0 +1,393 @@ +package org.openapijsonschematools.client.paths.fakeinlinecomposition.post.requestbody.content.applicationjson; +import java.time.LocalDate; +import java.time.ZonedDateTime; +import java.util.ArrayList; +import java.util.HashSet; +import java.util.LinkedHashMap; +import java.util.LinkedHashSet; +import java.util.List; +import java.util.Map; +import java.util.Objects; +import java.util.Set; +import java.util.UUID; +import org.checkerframework.checker.nullness.qual.Nullable; +import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags; +import org.openapijsonschematools.client.configurations.SchemaConfiguration; +import org.openapijsonschematools.client.exceptions.InvalidAdditionalPropertyException; +import org.openapijsonschematools.client.exceptions.UnsetPropertyException; +import org.openapijsonschematools.client.exceptions.ValidationException; +import org.openapijsonschematools.client.schemas.UnsetAddPropsSetter; +import org.openapijsonschematools.client.schemas.validation.BooleanSchemaValidator; +import org.openapijsonschematools.client.schemas.validation.FrozenList; +import org.openapijsonschematools.client.schemas.validation.FrozenMap; +import org.openapijsonschematools.client.schemas.validation.JsonSchema; +import org.openapijsonschematools.client.schemas.validation.JsonSchemaInfo; +import org.openapijsonschematools.client.schemas.validation.ListSchemaValidator; +import org.openapijsonschematools.client.schemas.validation.MapSchemaValidator; +import org.openapijsonschematools.client.schemas.validation.NullSchemaValidator; +import org.openapijsonschematools.client.schemas.validation.NumberSchemaValidator; +import org.openapijsonschematools.client.schemas.validation.PathToSchemasMap; +import org.openapijsonschematools.client.schemas.validation.StringSchemaValidator; +import org.openapijsonschematools.client.schemas.validation.ValidationMetadata; + +public class ApplicationjsonSchema { + // nest classes so all schemas and input/output classes can be public + + + public sealed interface Applicationjson0Boxed permits Applicationjson0BoxedString { + @Nullable Object getData(); + } + + public record Applicationjson0BoxedString(String data) implements Applicationjson0Boxed { + @Override + public @Nullable Object getData() { + return data; + } + } + + + + public static class Applicationjson0 extends JsonSchema implements StringSchemaValidator { + private static @Nullable Applicationjson0 instance = null; + + protected Applicationjson0() { + super(new JsonSchemaInfo() + .type(Set.of( + String.class + )) + .minLength(1) + ); + } + + public static Applicationjson0 getInstance() { + if (instance == null) { + instance = new Applicationjson0(); + } + return instance; + } + + @Override + public String validate(String arg, SchemaConfiguration configuration) throws ValidationException { + Set> pathSet = new HashSet<>(); + List pathToItem = List.of("args[0"); + String castArg = castToAllowedTypes(arg, pathToItem, pathSet); + SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().build())); + ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, new PathToSchemasMap(), new LinkedHashSet<>()); + getPathToSchemas(this, castArg, validationMetadata, pathSet); + return castArg; + } + + @Override + public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws 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"); + } + @Override + public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { + 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"); + } + @Override + 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 { + 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"); + } + } + + public sealed interface ApplicationjsonSchema1Boxed permits ApplicationjsonSchema1BoxedVoid, ApplicationjsonSchema1BoxedBoolean, ApplicationjsonSchema1BoxedNumber, ApplicationjsonSchema1BoxedString, ApplicationjsonSchema1BoxedList, ApplicationjsonSchema1BoxedMap { + @Nullable Object getData(); + } + + public record ApplicationjsonSchema1BoxedVoid(Nothing? data) implements ApplicationjsonSchema1Boxed { + @Override + public @Nullable Object getData() { + return data; + } + } + + public record ApplicationjsonSchema1BoxedBoolean(boolean data) implements ApplicationjsonSchema1Boxed { + @Override + public @Nullable Object getData() { + return data; + } + } + + public record ApplicationjsonSchema1BoxedNumber(Number data) implements ApplicationjsonSchema1Boxed { + @Override + public @Nullable Object getData() { + return data; + } + } + + public record ApplicationjsonSchema1BoxedString(String data) implements ApplicationjsonSchema1Boxed { + @Override + public @Nullable Object getData() { + return data; + } + } + + public record ApplicationjsonSchema1BoxedList(FrozenList<@Nullable Object> data) implements ApplicationjsonSchema1Boxed { + @Override + public @Nullable Object getData() { + return data; + } + } + + public record ApplicationjsonSchema1BoxedMap(FrozenMap<@Nullable Object> data) implements ApplicationjsonSchema1Boxed { + @Override + public @Nullable Object getData() { + return data; + } + } + + + public static class ApplicationjsonSchema1 extends JsonSchema implements NullSchemaValidator, BooleanSchemaValidator, NumberSchemaValidator, StringSchemaValidator, ListSchemaValidator, ApplicationjsonSchema1BoxedList>, MapSchemaValidator, ApplicationjsonSchema1BoxedMap> { + private static @Nullable ApplicationjsonSchema1 instance = null; + + protected ApplicationjsonSchema1() { + super(new JsonSchemaInfo() + .allOf(List.of( + Applicationjson0.class + )) + ); + } + + public static ApplicationjsonSchema1 getInstance() { + if (instance == null) { + instance = new ApplicationjsonSchema1(); + } + return instance; + } + + @Override + public Nothing? validate(Nothing? arg, SchemaConfiguration configuration) throws ValidationException { + Set> pathSet = new HashSet<>(); + List pathToItem = List.of("args[0]"); + Nothing? castArg = castToAllowedTypes(arg, pathToItem, pathSet); + SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().build())); + PathToSchemasMap validatedPathToSchemas = new PathToSchemasMap(); + ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, new LinkedHashSet<>()); + getPathToSchemas(this, castArg, validationMetadata, pathSet); + return castArg; + } + + @Override + public boolean validate(boolean arg, SchemaConfiguration configuration) throws ValidationException { + Set> pathSet = new HashSet<>(); + List pathToItem = List.of("args[0]"); + boolean castArg = castToAllowedTypes(arg, pathToItem, pathSet); + SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().build())); + PathToSchemasMap validatedPathToSchemas = new PathToSchemasMap(); + ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, new LinkedHashSet<>()); + getPathToSchemas(this, castArg, validationMetadata, pathSet); + return castArg; + } + + @Override + public Number validate(Number arg, SchemaConfiguration configuration) throws ValidationException { + Set> pathSet = new HashSet<>(); + List pathToItem = List.of("args[0]"); + Number castArg = castToAllowedTypes(arg, pathToItem, pathSet); + SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().build())); + PathToSchemasMap validatedPathToSchemas = new PathToSchemasMap(); + ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, new LinkedHashSet<>()); + getPathToSchemas(this, castArg, validationMetadata, pathSet); + return castArg; + } + + public int validate(int arg, SchemaConfiguration configuration) throws ValidationException { + return (int) validate((Number) arg, configuration); + } + + public long validate(long arg, SchemaConfiguration configuration) throws ValidationException { + return (long) validate((Number) arg, configuration); + } + + public float validate(float arg, SchemaConfiguration configuration) throws ValidationException { + return (float) validate((Number) arg, configuration); + } + + public double validate(double arg, SchemaConfiguration configuration) throws ValidationException { + return (double) validate((Number) arg, configuration); + } + + @Override + public String validate(String arg, SchemaConfiguration configuration) throws ValidationException { + Set> pathSet = new HashSet<>(); + List pathToItem = List.of("args[0]"); + String castArg = castToAllowedTypes(arg, pathToItem, pathSet); + SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().build())); + PathToSchemasMap validatedPathToSchemas = new PathToSchemasMap(); + ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, new LinkedHashSet<>()); + getPathToSchemas(this, castArg, validationMetadata, pathSet); + return castArg; + } + + public String validate(LocalDate arg, SchemaConfiguration configuration) throws ValidationException { + return validate(arg.toString(), configuration); + } + + public String validate(ZonedDateTime arg, SchemaConfiguration configuration) throws ValidationException { + return validate(arg.toString(), configuration); + } + + public String validate(UUID arg, SchemaConfiguration configuration) throws ValidationException { + return validate(arg.toString(), configuration); + } + + @Override + public FrozenList<@Nullable Object> getNewInstance(List arg, List pathToItem, PathToSchemasMap pathToSchemas) { + List<@Nullable Object> items = new ArrayList<>(); + int i = 0; + for (Object item: arg) { + List itemPathToItem = new ArrayList<>(pathToItem); + itemPathToItem.add(i); + LinkedHashMap, Nothing?> schemas = pathToSchemas.get(itemPathToItem); + if (schemas == null) { + throw new RuntimeException("Validation result is invalid, schemas must exist for a pathToItem"); + } + JsonSchema itemSchema = schemas.entrySet().iterator().next().getKey(); + @Nullable Object itemInstance = itemSchema.getNewInstance(item, itemPathToItem, pathToSchemas); + items.add(itemInstance); + i += 1; + } + FrozenList<@Nullable Object> newInstanceItems = new FrozenList<>(items); + return newInstanceItems; + } + + 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); + SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().build())); + ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, new PathToSchemasMap(), new LinkedHashSet<>()); + PathToSchemasMap pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet); + return getNewInstance(castArg, validationMetadata.pathToItem(), pathToSchemasMap); + } + + @Override + 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 RuntimeException("Invalid non-string key value"); + } + String propertyName = (String) entryKey; + List propertyPathToItem = new ArrayList<>(pathToItem); + propertyPathToItem.add(propertyName); + Object value = entry.getValue(); + LinkedHashMap, Nothing?> schemas = pathToSchemas.get(propertyPathToItem); + if (schemas == null) { + throw new RuntimeException("Validation result is invalid, schemas must exist for a pathToItem"); + } + JsonSchema propertySchema = schemas.entrySet().iterator().next().getKey(); + @Nullable Object propertyInstance = propertySchema.getNewInstance(value, propertyPathToItem, pathToSchemas); + properties.put(propertyName, propertyInstance); + } + FrozenMap<@Nullable Object> castProperties = new FrozenMap<>(properties); + return castProperties; + } + + public FrozenMap<@Nullable Object> validate(Map arg, SchemaConfiguration configuration) throws ValidationException { + Set> pathSet = new HashSet<>(); + List pathToItem = List.of("args[0]"); + Map castArg = castToAllowedTypes(arg, pathToItem, pathSet); + SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().build())); + PathToSchemasMap validatedPathToSchemas = new PathToSchemasMap(); + ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, new LinkedHashSet<>()); + PathToSchemasMap pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet); + return getNewInstance(castArg, validationMetadata.pathToItem(), pathToSchemasMap); + } + + @Override + public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { + if (arg == null) { + return validate((Nothing?) null, configuration); + } else if (arg instanceof Boolean) { + boolean boolArg = (Boolean) arg; + return validate(boolArg, configuration); + } else if (arg instanceof Number) { + return validate((Number) arg, configuration); + } else if (arg instanceof String) { + return validate((String) arg, configuration); + } else if (arg instanceof List) { + return validate((List) arg, 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"); + } + @Override + public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { + if (arg == null) { + return getNewInstance((Nothing?) null, pathToItem, pathToSchemas); + } else if (arg instanceof Boolean) { + boolean boolArg = (Boolean) arg; + return getNewInstance(boolArg, pathToItem, pathToSchemas); + } else if (arg instanceof Number) { + return getNewInstance((Number) arg, pathToItem, pathToSchemas); + } else if (arg instanceof String) { + return getNewInstance((String) arg, pathToItem, pathToSchemas); + } else if (arg instanceof List) { + return getNewInstance((List) arg, 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"); + } + @Override + public ApplicationjsonSchema1BoxedVoid validateAndBox(Nothing? arg, SchemaConfiguration configuration) throws ValidationException { + return new ApplicationjsonSchema1BoxedVoid(validate(arg, configuration)); + } + @Override + 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 { + return new ApplicationjsonSchema1BoxedNumber(validate(arg, configuration)); + } + @Override + 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 { + return new ApplicationjsonSchema1BoxedList(validate(arg, configuration)); + } + @Override + 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 { + if (arg == null) { + Nothing? castArg = (Nothing?) arg; + return validateAndBox(castArg, configuration); + } else if (arg instanceof Boolean booleanArg) { + boolean castArg = booleanArg; + return validateAndBox(castArg, configuration); + } else if (arg instanceof String castArg) { + return validateAndBox(castArg, configuration); + } else if (arg instanceof Number castArg) { + return validateAndBox(castArg, configuration); + } else if (arg instanceof List castArg) { + 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"); + } + } +} diff --git a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/fakeinlinecomposition/post/requestbody/content/multipartformdata/MultipartformdataSchema.kt b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/fakeinlinecomposition/post/requestbody/content/multipartformdata/MultipartformdataSchema.kt new file mode 100644 index 00000000000..0f7b66a3d8a --- /dev/null +++ b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/fakeinlinecomposition/post/requestbody/content/multipartformdata/MultipartformdataSchema.kt @@ -0,0 +1,596 @@ +package org.openapijsonschematools.client.paths.fakeinlinecomposition.post.requestbody.content.multipartformdata; +import java.time.LocalDate; +import java.time.ZonedDateTime; +import java.util.ArrayList; +import java.util.HashSet; +import java.util.LinkedHashMap; +import java.util.LinkedHashSet; +import java.util.List; +import java.util.Map; +import java.util.Objects; +import java.util.Set; +import java.util.UUID; +import org.checkerframework.checker.nullness.qual.Nullable; +import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags; +import org.openapijsonschematools.client.configurations.SchemaConfiguration; +import org.openapijsonschematools.client.exceptions.InvalidAdditionalPropertyException; +import org.openapijsonschematools.client.exceptions.UnsetPropertyException; +import org.openapijsonschematools.client.exceptions.ValidationException; +import org.openapijsonschematools.client.schemas.GenericBuilder; +import org.openapijsonschematools.client.schemas.UnsetAddPropsSetter; +import org.openapijsonschematools.client.schemas.validation.BooleanSchemaValidator; +import org.openapijsonschematools.client.schemas.validation.FrozenList; +import org.openapijsonschematools.client.schemas.validation.FrozenMap; +import org.openapijsonschematools.client.schemas.validation.JsonSchema; +import org.openapijsonschematools.client.schemas.validation.JsonSchemaInfo; +import org.openapijsonschematools.client.schemas.validation.ListSchemaValidator; +import org.openapijsonschematools.client.schemas.validation.MapSchemaValidator; +import org.openapijsonschematools.client.schemas.validation.NullSchemaValidator; +import org.openapijsonschematools.client.schemas.validation.NumberSchemaValidator; +import org.openapijsonschematools.client.schemas.validation.PathToSchemasMap; +import org.openapijsonschematools.client.schemas.validation.PropertyEntry; +import org.openapijsonschematools.client.schemas.validation.StringSchemaValidator; +import org.openapijsonschematools.client.schemas.validation.ValidationMetadata; + +public class MultipartformdataSchema { + // nest classes so all schemas and input/output classes can be public + + + public sealed interface Multipartformdata0Boxed permits Multipartformdata0BoxedString { + @Nullable Object getData(); + } + + public record Multipartformdata0BoxedString(String data) implements Multipartformdata0Boxed { + @Override + public @Nullable Object getData() { + return data; + } + } + + + + public static class Multipartformdata0 extends JsonSchema implements StringSchemaValidator { + private static @Nullable Multipartformdata0 instance = null; + + protected Multipartformdata0() { + super(new JsonSchemaInfo() + .type(Set.of( + String.class + )) + .minLength(1) + ); + } + + public static Multipartformdata0 getInstance() { + if (instance == null) { + instance = new Multipartformdata0(); + } + return instance; + } + + @Override + public String validate(String arg, SchemaConfiguration configuration) throws ValidationException { + Set> pathSet = new HashSet<>(); + List pathToItem = List.of("args[0"); + String castArg = castToAllowedTypes(arg, pathToItem, pathSet); + SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().build())); + ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, new PathToSchemasMap(), new LinkedHashSet<>()); + getPathToSchemas(this, castArg, validationMetadata, pathSet); + return castArg; + } + + @Override + public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws 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"); + } + @Override + public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { + 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"); + } + @Override + 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 { + 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"); + } + } + + public sealed interface MultipartformdataSomePropBoxed permits MultipartformdataSomePropBoxedVoid, MultipartformdataSomePropBoxedBoolean, MultipartformdataSomePropBoxedNumber, MultipartformdataSomePropBoxedString, MultipartformdataSomePropBoxedList, MultipartformdataSomePropBoxedMap { + @Nullable Object getData(); + } + + public record MultipartformdataSomePropBoxedVoid(Nothing? data) implements MultipartformdataSomePropBoxed { + @Override + public @Nullable Object getData() { + return data; + } + } + + public record MultipartformdataSomePropBoxedBoolean(boolean data) implements MultipartformdataSomePropBoxed { + @Override + public @Nullable Object getData() { + return data; + } + } + + public record MultipartformdataSomePropBoxedNumber(Number data) implements MultipartformdataSomePropBoxed { + @Override + public @Nullable Object getData() { + return data; + } + } + + public record MultipartformdataSomePropBoxedString(String data) implements MultipartformdataSomePropBoxed { + @Override + public @Nullable Object getData() { + return data; + } + } + + public record MultipartformdataSomePropBoxedList(FrozenList<@Nullable Object> data) implements MultipartformdataSomePropBoxed { + @Override + public @Nullable Object getData() { + return data; + } + } + + public record MultipartformdataSomePropBoxedMap(FrozenMap<@Nullable Object> data) implements MultipartformdataSomePropBoxed { + @Override + public @Nullable Object getData() { + return data; + } + } + + + public static class MultipartformdataSomeProp extends JsonSchema implements NullSchemaValidator, BooleanSchemaValidator, NumberSchemaValidator, StringSchemaValidator, ListSchemaValidator, MultipartformdataSomePropBoxedList>, MapSchemaValidator, MultipartformdataSomePropBoxedMap> { + private static @Nullable MultipartformdataSomeProp instance = null; + + protected MultipartformdataSomeProp() { + super(new JsonSchemaInfo() + .allOf(List.of( + Multipartformdata0.class + )) + ); + } + + public static MultipartformdataSomeProp getInstance() { + if (instance == null) { + instance = new MultipartformdataSomeProp(); + } + return instance; + } + + @Override + public Nothing? validate(Nothing? arg, SchemaConfiguration configuration) throws ValidationException { + Set> pathSet = new HashSet<>(); + List pathToItem = List.of("args[0]"); + Nothing? castArg = castToAllowedTypes(arg, pathToItem, pathSet); + SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().build())); + PathToSchemasMap validatedPathToSchemas = new PathToSchemasMap(); + ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, new LinkedHashSet<>()); + getPathToSchemas(this, castArg, validationMetadata, pathSet); + return castArg; + } + + @Override + public boolean validate(boolean arg, SchemaConfiguration configuration) throws ValidationException { + Set> pathSet = new HashSet<>(); + List pathToItem = List.of("args[0]"); + boolean castArg = castToAllowedTypes(arg, pathToItem, pathSet); + SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().build())); + PathToSchemasMap validatedPathToSchemas = new PathToSchemasMap(); + ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, new LinkedHashSet<>()); + getPathToSchemas(this, castArg, validationMetadata, pathSet); + return castArg; + } + + @Override + public Number validate(Number arg, SchemaConfiguration configuration) throws ValidationException { + Set> pathSet = new HashSet<>(); + List pathToItem = List.of("args[0]"); + Number castArg = castToAllowedTypes(arg, pathToItem, pathSet); + SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().build())); + PathToSchemasMap validatedPathToSchemas = new PathToSchemasMap(); + ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, new LinkedHashSet<>()); + getPathToSchemas(this, castArg, validationMetadata, pathSet); + return castArg; + } + + public int validate(int arg, SchemaConfiguration configuration) throws ValidationException { + return (int) validate((Number) arg, configuration); + } + + public long validate(long arg, SchemaConfiguration configuration) throws ValidationException { + return (long) validate((Number) arg, configuration); + } + + public float validate(float arg, SchemaConfiguration configuration) throws ValidationException { + return (float) validate((Number) arg, configuration); + } + + public double validate(double arg, SchemaConfiguration configuration) throws ValidationException { + return (double) validate((Number) arg, configuration); + } + + @Override + public String validate(String arg, SchemaConfiguration configuration) throws ValidationException { + Set> pathSet = new HashSet<>(); + List pathToItem = List.of("args[0]"); + String castArg = castToAllowedTypes(arg, pathToItem, pathSet); + SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().build())); + PathToSchemasMap validatedPathToSchemas = new PathToSchemasMap(); + ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, new LinkedHashSet<>()); + getPathToSchemas(this, castArg, validationMetadata, pathSet); + return castArg; + } + + public String validate(LocalDate arg, SchemaConfiguration configuration) throws ValidationException { + return validate(arg.toString(), configuration); + } + + public String validate(ZonedDateTime arg, SchemaConfiguration configuration) throws ValidationException { + return validate(arg.toString(), configuration); + } + + public String validate(UUID arg, SchemaConfiguration configuration) throws ValidationException { + return validate(arg.toString(), configuration); + } + + @Override + public FrozenList<@Nullable Object> getNewInstance(List arg, List pathToItem, PathToSchemasMap pathToSchemas) { + List<@Nullable Object> items = new ArrayList<>(); + int i = 0; + for (Object item: arg) { + List itemPathToItem = new ArrayList<>(pathToItem); + itemPathToItem.add(i); + LinkedHashMap, Nothing?> schemas = pathToSchemas.get(itemPathToItem); + if (schemas == null) { + throw new RuntimeException("Validation result is invalid, schemas must exist for a pathToItem"); + } + JsonSchema itemSchema = schemas.entrySet().iterator().next().getKey(); + @Nullable Object itemInstance = itemSchema.getNewInstance(item, itemPathToItem, pathToSchemas); + items.add(itemInstance); + i += 1; + } + FrozenList<@Nullable Object> newInstanceItems = new FrozenList<>(items); + return newInstanceItems; + } + + 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); + SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().build())); + ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, new PathToSchemasMap(), new LinkedHashSet<>()); + PathToSchemasMap pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet); + return getNewInstance(castArg, validationMetadata.pathToItem(), pathToSchemasMap); + } + + @Override + 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 RuntimeException("Invalid non-string key value"); + } + String propertyName = (String) entryKey; + List propertyPathToItem = new ArrayList<>(pathToItem); + propertyPathToItem.add(propertyName); + Object value = entry.getValue(); + LinkedHashMap, Nothing?> schemas = pathToSchemas.get(propertyPathToItem); + if (schemas == null) { + throw new RuntimeException("Validation result is invalid, schemas must exist for a pathToItem"); + } + JsonSchema propertySchema = schemas.entrySet().iterator().next().getKey(); + @Nullable Object propertyInstance = propertySchema.getNewInstance(value, propertyPathToItem, pathToSchemas); + properties.put(propertyName, propertyInstance); + } + FrozenMap<@Nullable Object> castProperties = new FrozenMap<>(properties); + return castProperties; + } + + public FrozenMap<@Nullable Object> validate(Map arg, SchemaConfiguration configuration) throws ValidationException { + Set> pathSet = new HashSet<>(); + List pathToItem = List.of("args[0]"); + Map castArg = castToAllowedTypes(arg, pathToItem, pathSet); + SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().build())); + PathToSchemasMap validatedPathToSchemas = new PathToSchemasMap(); + ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, new LinkedHashSet<>()); + PathToSchemasMap pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet); + return getNewInstance(castArg, validationMetadata.pathToItem(), pathToSchemasMap); + } + + @Override + public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { + if (arg == null) { + return validate((Nothing?) null, configuration); + } else if (arg instanceof Boolean) { + boolean boolArg = (Boolean) arg; + return validate(boolArg, configuration); + } else if (arg instanceof Number) { + return validate((Number) arg, configuration); + } else if (arg instanceof String) { + return validate((String) arg, configuration); + } else if (arg instanceof List) { + return validate((List) arg, 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"); + } + @Override + public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { + if (arg == null) { + return getNewInstance((Nothing?) null, pathToItem, pathToSchemas); + } else if (arg instanceof Boolean) { + boolean boolArg = (Boolean) arg; + return getNewInstance(boolArg, pathToItem, pathToSchemas); + } else if (arg instanceof Number) { + return getNewInstance((Number) arg, pathToItem, pathToSchemas); + } else if (arg instanceof String) { + return getNewInstance((String) arg, pathToItem, pathToSchemas); + } else if (arg instanceof List) { + return getNewInstance((List) arg, 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"); + } + @Override + public MultipartformdataSomePropBoxedVoid validateAndBox(Nothing? arg, SchemaConfiguration configuration) throws ValidationException { + return new MultipartformdataSomePropBoxedVoid(validate(arg, configuration)); + } + @Override + 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 { + return new MultipartformdataSomePropBoxedNumber(validate(arg, configuration)); + } + @Override + 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 { + return new MultipartformdataSomePropBoxedList(validate(arg, configuration)); + } + @Override + 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 { + if (arg == null) { + Nothing? castArg = (Nothing?) arg; + return validateAndBox(castArg, configuration); + } else if (arg instanceof Boolean booleanArg) { + boolean castArg = booleanArg; + return validateAndBox(castArg, configuration); + } else if (arg instanceof String castArg) { + return validateAndBox(castArg, configuration); + } else if (arg instanceof Number castArg) { + return validateAndBox(castArg, configuration); + } else if (arg instanceof List castArg) { + 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"); + } + } + + public static class MultipartformdataSchemaMap extends FrozenMap<@Nullable Object> { + protected MultipartformdataSchemaMap(FrozenMap<@Nullable Object> m) { + super(m); + } + public static final Set requiredKeys = Set.of(); + public static final Set optionalKeys = Set.of( + "someProp" + ); + public static MultipartformdataSchemaMap of(Map arg, SchemaConfiguration configuration) throws ValidationException { + return MultipartformdataSchema1.getInstance().validate(arg, configuration); + } + + public @Nullable Object someProp() throws UnsetPropertyException { + return getOrThrow("someProp"); + } + + public @Nullable Object getAdditionalProperty(String name) throws UnsetPropertyException, InvalidAdditionalPropertyException { + throwIfKeyKnown(name, requiredKeys, optionalKeys); + throwIfKeyNotPresent(name); + return get(name); + } + } + + public interface SetterForMultipartformdataSomeProp { + Map getInstance(); + T getBuilderAfterMultipartformdataSomeProp(Map instance); + + default T someProp(Nothing? value) { + var instance = getInstance(); + instance.put("someProp", null); + return getBuilderAfterMultipartformdataSomeProp(instance); + } + + default T someProp(boolean value) { + var instance = getInstance(); + instance.put("someProp", value); + return getBuilderAfterMultipartformdataSomeProp(instance); + } + + default T someProp(String value) { + var instance = getInstance(); + instance.put("someProp", value); + return getBuilderAfterMultipartformdataSomeProp(instance); + } + + default T someProp(int value) { + var instance = getInstance(); + instance.put("someProp", value); + return getBuilderAfterMultipartformdataSomeProp(instance); + } + + default T someProp(float value) { + var instance = getInstance(); + instance.put("someProp", value); + return getBuilderAfterMultipartformdataSomeProp(instance); + } + + default T someProp(long value) { + var instance = getInstance(); + instance.put("someProp", value); + return getBuilderAfterMultipartformdataSomeProp(instance); + } + + default T someProp(double value) { + var instance = getInstance(); + instance.put("someProp", value); + return getBuilderAfterMultipartformdataSomeProp(instance); + } + + default T someProp(List value) { + var instance = getInstance(); + instance.put("someProp", value); + return getBuilderAfterMultipartformdataSomeProp(instance); + } + + default T someProp(Map value) { + var instance = getInstance(); + instance.put("someProp", value); + return getBuilderAfterMultipartformdataSomeProp(instance); + } + } + + public static class MultipartformdataSchemaMapBuilder extends UnsetAddPropsSetter implements GenericBuilder>, SetterForMultipartformdataSomeProp { + private final Map instance; + private static final Set knownKeys = Set.of( + "someProp" + ); + public Set getKnownKeys() { + return knownKeys; + } + public MultipartformdataSchemaMapBuilder() { + this.instance = new LinkedHashMap<>(); + } + public Map build() { + return instance; + } + public Map getInstance() { + return instance; + } + public MultipartformdataSchemaMapBuilder getBuilderAfterMultipartformdataSomeProp(Map instance) { + return this; + } + public MultipartformdataSchemaMapBuilder getBuilderAfterAdditionalProperty(Map instance) { + return this; + } + } + + + public sealed interface MultipartformdataSchema1Boxed permits MultipartformdataSchema1BoxedMap { + @Nullable Object getData(); + } + + public record MultipartformdataSchema1BoxedMap(MultipartformdataSchemaMap data) implements MultipartformdataSchema1Boxed { + @Override + public @Nullable Object getData() { + return data; + } + } + + + public static class MultipartformdataSchema1 extends JsonSchema implements MapSchemaValidator { + private static @Nullable MultipartformdataSchema1 instance = null; + + protected MultipartformdataSchema1() { + super(new JsonSchemaInfo() + .type(Set.of(Map.class)) + .properties(Map.ofEntries( + new PropertyEntry("someProp", MultipartformdataSomeProp.class) + )) + ); + } + + public static MultipartformdataSchema1 getInstance() { + if (instance == null) { + instance = new MultipartformdataSchema1(); + } + return instance; + } + + 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 RuntimeException("Invalid non-string key value"); + } + String propertyName = (String) entryKey; + List propertyPathToItem = new ArrayList<>(pathToItem); + propertyPathToItem.add(propertyName); + Object value = entry.getValue(); + LinkedHashMap, Nothing?> schemas = pathToSchemas.get(propertyPathToItem); + if (schemas == null) { + throw new RuntimeException("Validation result is invalid, schemas must exist for a pathToItem"); + } + JsonSchema propertySchema = schemas.entrySet().iterator().next().getKey(); + @Nullable Object propertyInstance = propertySchema.getNewInstance(value, propertyPathToItem, pathToSchemas); + properties.put(propertyName, propertyInstance); + } + FrozenMap<@Nullable Object> castProperties = new FrozenMap<>(properties); + return new MultipartformdataSchemaMap(castProperties); + } + + 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); + SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().build())); + ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, new PathToSchemasMap(), new LinkedHashSet<>()); + PathToSchemasMap pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet); + return getNewInstance(castArg, validationMetadata.pathToItem(), pathToSchemasMap); + } + + + @Override + public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws 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"); + } + @Override + public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { + if (arg instanceof Map) { + return getNewInstance((Map) arg, pathToItem, pathToSchemas); + } + 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 { + return new MultipartformdataSchema1BoxedMap(validate(arg, configuration)); + } + @Override + public MultipartformdataSchema1Boxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { + 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"); + } + } + +} diff --git a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/fakeinlinecomposition/post/responses/FakeinlinecompositionPostCode200Response.kt b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/fakeinlinecomposition/post/responses/FakeinlinecompositionPostCode200Response.kt new file mode 100644 index 00000000000..297826c2fc6 --- /dev/null +++ b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/fakeinlinecomposition/post/responses/FakeinlinecompositionPostCode200Response.kt @@ -0,0 +1,81 @@ +package org.openapijsonschematools.client.paths.fakeinlinecomposition.post.responses; + +import org.openapijsonschematools.client.configurations.SchemaConfiguration; +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; + +import java.util.AbstractMap; +import java.util.Map; +import java.net.http.HttpResponse; +import java.net.http.HttpHeaders; + +public class FakeinlinecompositionPostCode200Response { + public sealed interface SealedMediaType permits ApplicationjsonMediaType, MultipartformdataMediaType {} + + public record ApplicationjsonMediaType(ApplicationjsonSchema.ApplicationjsonSchema1 schema) implements SealedMediaType, MediaType { + public ApplicationjsonMediaType() { + this(ApplicationjsonSchema.ApplicationjsonSchema1.getInstance()); + } + @Override + public Nothing? encoding() { + return null; + } + } + + public record MultipartformdataMediaType(MultipartformdataSchema.MultipartformdataSchema1 schema) implements SealedMediaType, MediaType { + public MultipartformdataMediaType() { + this(MultipartformdataSchema.MultipartformdataSchema1.getInstance()); + } + @Override + public Nothing? encoding() { + return null; + } + } + public sealed interface SealedResponseBody permits ApplicationjsonResponseBody, MultipartformdataResponseBody {} + public record ApplicationjsonResponseBody(ApplicationjsonSchema.ApplicationjsonSchema1Boxed body) implements SealedResponseBody { } + public record MultipartformdataResponseBody(MultipartformdataSchema.MultipartformdataSchema1Boxed body) implements SealedResponseBody { } + + public static class FakeinlinecompositionPostCode200Response1 extends ResponseDeserializer { + public FakeinlinecompositionPostCode200Response1() { + super( + Map.ofEntries( + new AbstractMap.SimpleEntry<>("application/json", new ApplicationjsonMediaType()), + new AbstractMap.SimpleEntry<>("multipart/form-data", new MultipartformdataMediaType()) + ) + ); + } + + @Override + protected SealedResponseBody getBody(String contentType, SealedMediaType mediaType, byte[] body, SchemaConfiguration configuration) throws ValidationException, NotImplementedException { + if (mediaType instanceof ApplicationjsonMediaType thisMediaType) { + var deserializedBody = deserializeBody(contentType, body, thisMediaType.schema(), configuration); + return new ApplicationjsonResponseBody(deserializedBody); + } else { + MultipartformdataMediaType thisMediaType = (MultipartformdataMediaType) mediaType; + var deserializedBody = deserializeBody(contentType, body, thisMediaType.schema(), configuration); + return new MultipartformdataResponseBody(deserializedBody); + } + } + + @Override + protected Nothing? getHeaders(HttpHeaders headers, SchemaConfiguration configuration) { + return null; + } + } + + @SuppressWarnings("serial") + public static class ResponseApiException extends ApiException { + public DeserializedHttpResponse deserializedResponse; + + public ResponseApiException(String s, HttpResponse response, DeserializedHttpResponse deserializedResponse) { + super(s, response); + this.deserializedResponse = deserializedResponse; + } + } +} diff --git a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/fakeinlinecomposition/post/responses/code200response/content/applicationjson/ApplicationjsonSchema.kt b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/fakeinlinecomposition/post/responses/code200response/content/applicationjson/ApplicationjsonSchema.kt new file mode 100644 index 00000000000..b26596933ed --- /dev/null +++ b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/fakeinlinecomposition/post/responses/code200response/content/applicationjson/ApplicationjsonSchema.kt @@ -0,0 +1,393 @@ +package org.openapijsonschematools.client.paths.fakeinlinecomposition.post.responses.code200response.content.applicationjson; +import java.time.LocalDate; +import java.time.ZonedDateTime; +import java.util.ArrayList; +import java.util.HashSet; +import java.util.LinkedHashMap; +import java.util.LinkedHashSet; +import java.util.List; +import java.util.Map; +import java.util.Objects; +import java.util.Set; +import java.util.UUID; +import org.checkerframework.checker.nullness.qual.Nullable; +import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags; +import org.openapijsonschematools.client.configurations.SchemaConfiguration; +import org.openapijsonschematools.client.exceptions.InvalidAdditionalPropertyException; +import org.openapijsonschematools.client.exceptions.UnsetPropertyException; +import org.openapijsonschematools.client.exceptions.ValidationException; +import org.openapijsonschematools.client.schemas.UnsetAddPropsSetter; +import org.openapijsonschematools.client.schemas.validation.BooleanSchemaValidator; +import org.openapijsonschematools.client.schemas.validation.FrozenList; +import org.openapijsonschematools.client.schemas.validation.FrozenMap; +import org.openapijsonschematools.client.schemas.validation.JsonSchema; +import org.openapijsonschematools.client.schemas.validation.JsonSchemaInfo; +import org.openapijsonschematools.client.schemas.validation.ListSchemaValidator; +import org.openapijsonschematools.client.schemas.validation.MapSchemaValidator; +import org.openapijsonschematools.client.schemas.validation.NullSchemaValidator; +import org.openapijsonschematools.client.schemas.validation.NumberSchemaValidator; +import org.openapijsonschematools.client.schemas.validation.PathToSchemasMap; +import org.openapijsonschematools.client.schemas.validation.StringSchemaValidator; +import org.openapijsonschematools.client.schemas.validation.ValidationMetadata; + +public class ApplicationjsonSchema { + // nest classes so all schemas and input/output classes can be public + + + public sealed interface Applicationjson0Boxed permits Applicationjson0BoxedString { + @Nullable Object getData(); + } + + public record Applicationjson0BoxedString(String data) implements Applicationjson0Boxed { + @Override + public @Nullable Object getData() { + return data; + } + } + + + + public static class Applicationjson0 extends JsonSchema implements StringSchemaValidator { + private static @Nullable Applicationjson0 instance = null; + + protected Applicationjson0() { + super(new JsonSchemaInfo() + .type(Set.of( + String.class + )) + .minLength(1) + ); + } + + public static Applicationjson0 getInstance() { + if (instance == null) { + instance = new Applicationjson0(); + } + return instance; + } + + @Override + public String validate(String arg, SchemaConfiguration configuration) throws ValidationException { + Set> pathSet = new HashSet<>(); + List pathToItem = List.of("args[0"); + String castArg = castToAllowedTypes(arg, pathToItem, pathSet); + SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().build())); + ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, new PathToSchemasMap(), new LinkedHashSet<>()); + getPathToSchemas(this, castArg, validationMetadata, pathSet); + return castArg; + } + + @Override + public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws 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"); + } + @Override + public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { + 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"); + } + @Override + 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 { + 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"); + } + } + + public sealed interface ApplicationjsonSchema1Boxed permits ApplicationjsonSchema1BoxedVoid, ApplicationjsonSchema1BoxedBoolean, ApplicationjsonSchema1BoxedNumber, ApplicationjsonSchema1BoxedString, ApplicationjsonSchema1BoxedList, ApplicationjsonSchema1BoxedMap { + @Nullable Object getData(); + } + + public record ApplicationjsonSchema1BoxedVoid(Nothing? data) implements ApplicationjsonSchema1Boxed { + @Override + public @Nullable Object getData() { + return data; + } + } + + public record ApplicationjsonSchema1BoxedBoolean(boolean data) implements ApplicationjsonSchema1Boxed { + @Override + public @Nullable Object getData() { + return data; + } + } + + public record ApplicationjsonSchema1BoxedNumber(Number data) implements ApplicationjsonSchema1Boxed { + @Override + public @Nullable Object getData() { + return data; + } + } + + public record ApplicationjsonSchema1BoxedString(String data) implements ApplicationjsonSchema1Boxed { + @Override + public @Nullable Object getData() { + return data; + } + } + + public record ApplicationjsonSchema1BoxedList(FrozenList<@Nullable Object> data) implements ApplicationjsonSchema1Boxed { + @Override + public @Nullable Object getData() { + return data; + } + } + + public record ApplicationjsonSchema1BoxedMap(FrozenMap<@Nullable Object> data) implements ApplicationjsonSchema1Boxed { + @Override + public @Nullable Object getData() { + return data; + } + } + + + public static class ApplicationjsonSchema1 extends JsonSchema implements NullSchemaValidator, BooleanSchemaValidator, NumberSchemaValidator, StringSchemaValidator, ListSchemaValidator, ApplicationjsonSchema1BoxedList>, MapSchemaValidator, ApplicationjsonSchema1BoxedMap> { + private static @Nullable ApplicationjsonSchema1 instance = null; + + protected ApplicationjsonSchema1() { + super(new JsonSchemaInfo() + .allOf(List.of( + Applicationjson0.class + )) + ); + } + + public static ApplicationjsonSchema1 getInstance() { + if (instance == null) { + instance = new ApplicationjsonSchema1(); + } + return instance; + } + + @Override + public Nothing? validate(Nothing? arg, SchemaConfiguration configuration) throws ValidationException { + Set> pathSet = new HashSet<>(); + List pathToItem = List.of("args[0]"); + Nothing? castArg = castToAllowedTypes(arg, pathToItem, pathSet); + SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().build())); + PathToSchemasMap validatedPathToSchemas = new PathToSchemasMap(); + ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, new LinkedHashSet<>()); + getPathToSchemas(this, castArg, validationMetadata, pathSet); + return castArg; + } + + @Override + public boolean validate(boolean arg, SchemaConfiguration configuration) throws ValidationException { + Set> pathSet = new HashSet<>(); + List pathToItem = List.of("args[0]"); + boolean castArg = castToAllowedTypes(arg, pathToItem, pathSet); + SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().build())); + PathToSchemasMap validatedPathToSchemas = new PathToSchemasMap(); + ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, new LinkedHashSet<>()); + getPathToSchemas(this, castArg, validationMetadata, pathSet); + return castArg; + } + + @Override + public Number validate(Number arg, SchemaConfiguration configuration) throws ValidationException { + Set> pathSet = new HashSet<>(); + List pathToItem = List.of("args[0]"); + Number castArg = castToAllowedTypes(arg, pathToItem, pathSet); + SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().build())); + PathToSchemasMap validatedPathToSchemas = new PathToSchemasMap(); + ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, new LinkedHashSet<>()); + getPathToSchemas(this, castArg, validationMetadata, pathSet); + return castArg; + } + + public int validate(int arg, SchemaConfiguration configuration) throws ValidationException { + return (int) validate((Number) arg, configuration); + } + + public long validate(long arg, SchemaConfiguration configuration) throws ValidationException { + return (long) validate((Number) arg, configuration); + } + + public float validate(float arg, SchemaConfiguration configuration) throws ValidationException { + return (float) validate((Number) arg, configuration); + } + + public double validate(double arg, SchemaConfiguration configuration) throws ValidationException { + return (double) validate((Number) arg, configuration); + } + + @Override + public String validate(String arg, SchemaConfiguration configuration) throws ValidationException { + Set> pathSet = new HashSet<>(); + List pathToItem = List.of("args[0]"); + String castArg = castToAllowedTypes(arg, pathToItem, pathSet); + SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().build())); + PathToSchemasMap validatedPathToSchemas = new PathToSchemasMap(); + ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, new LinkedHashSet<>()); + getPathToSchemas(this, castArg, validationMetadata, pathSet); + return castArg; + } + + public String validate(LocalDate arg, SchemaConfiguration configuration) throws ValidationException { + return validate(arg.toString(), configuration); + } + + public String validate(ZonedDateTime arg, SchemaConfiguration configuration) throws ValidationException { + return validate(arg.toString(), configuration); + } + + public String validate(UUID arg, SchemaConfiguration configuration) throws ValidationException { + return validate(arg.toString(), configuration); + } + + @Override + public FrozenList<@Nullable Object> getNewInstance(List arg, List pathToItem, PathToSchemasMap pathToSchemas) { + List<@Nullable Object> items = new ArrayList<>(); + int i = 0; + for (Object item: arg) { + List itemPathToItem = new ArrayList<>(pathToItem); + itemPathToItem.add(i); + LinkedHashMap, Nothing?> schemas = pathToSchemas.get(itemPathToItem); + if (schemas == null) { + throw new RuntimeException("Validation result is invalid, schemas must exist for a pathToItem"); + } + JsonSchema itemSchema = schemas.entrySet().iterator().next().getKey(); + @Nullable Object itemInstance = itemSchema.getNewInstance(item, itemPathToItem, pathToSchemas); + items.add(itemInstance); + i += 1; + } + FrozenList<@Nullable Object> newInstanceItems = new FrozenList<>(items); + return newInstanceItems; + } + + 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); + SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().build())); + ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, new PathToSchemasMap(), new LinkedHashSet<>()); + PathToSchemasMap pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet); + return getNewInstance(castArg, validationMetadata.pathToItem(), pathToSchemasMap); + } + + @Override + 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 RuntimeException("Invalid non-string key value"); + } + String propertyName = (String) entryKey; + List propertyPathToItem = new ArrayList<>(pathToItem); + propertyPathToItem.add(propertyName); + Object value = entry.getValue(); + LinkedHashMap, Nothing?> schemas = pathToSchemas.get(propertyPathToItem); + if (schemas == null) { + throw new RuntimeException("Validation result is invalid, schemas must exist for a pathToItem"); + } + JsonSchema propertySchema = schemas.entrySet().iterator().next().getKey(); + @Nullable Object propertyInstance = propertySchema.getNewInstance(value, propertyPathToItem, pathToSchemas); + properties.put(propertyName, propertyInstance); + } + FrozenMap<@Nullable Object> castProperties = new FrozenMap<>(properties); + return castProperties; + } + + public FrozenMap<@Nullable Object> validate(Map arg, SchemaConfiguration configuration) throws ValidationException { + Set> pathSet = new HashSet<>(); + List pathToItem = List.of("args[0]"); + Map castArg = castToAllowedTypes(arg, pathToItem, pathSet); + SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().build())); + PathToSchemasMap validatedPathToSchemas = new PathToSchemasMap(); + ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, new LinkedHashSet<>()); + PathToSchemasMap pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet); + return getNewInstance(castArg, validationMetadata.pathToItem(), pathToSchemasMap); + } + + @Override + public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { + if (arg == null) { + return validate((Nothing?) null, configuration); + } else if (arg instanceof Boolean) { + boolean boolArg = (Boolean) arg; + return validate(boolArg, configuration); + } else if (arg instanceof Number) { + return validate((Number) arg, configuration); + } else if (arg instanceof String) { + return validate((String) arg, configuration); + } else if (arg instanceof List) { + return validate((List) arg, 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"); + } + @Override + public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { + if (arg == null) { + return getNewInstance((Nothing?) null, pathToItem, pathToSchemas); + } else if (arg instanceof Boolean) { + boolean boolArg = (Boolean) arg; + return getNewInstance(boolArg, pathToItem, pathToSchemas); + } else if (arg instanceof Number) { + return getNewInstance((Number) arg, pathToItem, pathToSchemas); + } else if (arg instanceof String) { + return getNewInstance((String) arg, pathToItem, pathToSchemas); + } else if (arg instanceof List) { + return getNewInstance((List) arg, 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"); + } + @Override + public ApplicationjsonSchema1BoxedVoid validateAndBox(Nothing? arg, SchemaConfiguration configuration) throws ValidationException { + return new ApplicationjsonSchema1BoxedVoid(validate(arg, configuration)); + } + @Override + 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 { + return new ApplicationjsonSchema1BoxedNumber(validate(arg, configuration)); + } + @Override + 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 { + return new ApplicationjsonSchema1BoxedList(validate(arg, configuration)); + } + @Override + 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 { + if (arg == null) { + Nothing? castArg = (Nothing?) arg; + return validateAndBox(castArg, configuration); + } else if (arg instanceof Boolean booleanArg) { + boolean castArg = booleanArg; + return validateAndBox(castArg, configuration); + } else if (arg instanceof String castArg) { + return validateAndBox(castArg, configuration); + } else if (arg instanceof Number castArg) { + return validateAndBox(castArg, configuration); + } else if (arg instanceof List castArg) { + 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"); + } + } +} diff --git a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/fakeinlinecomposition/post/responses/code200response/content/multipartformdata/MultipartformdataSchema.kt b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/fakeinlinecomposition/post/responses/code200response/content/multipartformdata/MultipartformdataSchema.kt new file mode 100644 index 00000000000..fe47b48226b --- /dev/null +++ b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/fakeinlinecomposition/post/responses/code200response/content/multipartformdata/MultipartformdataSchema.kt @@ -0,0 +1,596 @@ +package org.openapijsonschematools.client.paths.fakeinlinecomposition.post.responses.code200response.content.multipartformdata; +import java.time.LocalDate; +import java.time.ZonedDateTime; +import java.util.ArrayList; +import java.util.HashSet; +import java.util.LinkedHashMap; +import java.util.LinkedHashSet; +import java.util.List; +import java.util.Map; +import java.util.Objects; +import java.util.Set; +import java.util.UUID; +import org.checkerframework.checker.nullness.qual.Nullable; +import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags; +import org.openapijsonschematools.client.configurations.SchemaConfiguration; +import org.openapijsonschematools.client.exceptions.InvalidAdditionalPropertyException; +import org.openapijsonschematools.client.exceptions.UnsetPropertyException; +import org.openapijsonschematools.client.exceptions.ValidationException; +import org.openapijsonschematools.client.schemas.GenericBuilder; +import org.openapijsonschematools.client.schemas.UnsetAddPropsSetter; +import org.openapijsonschematools.client.schemas.validation.BooleanSchemaValidator; +import org.openapijsonschematools.client.schemas.validation.FrozenList; +import org.openapijsonschematools.client.schemas.validation.FrozenMap; +import org.openapijsonschematools.client.schemas.validation.JsonSchema; +import org.openapijsonschematools.client.schemas.validation.JsonSchemaInfo; +import org.openapijsonschematools.client.schemas.validation.ListSchemaValidator; +import org.openapijsonschematools.client.schemas.validation.MapSchemaValidator; +import org.openapijsonschematools.client.schemas.validation.NullSchemaValidator; +import org.openapijsonschematools.client.schemas.validation.NumberSchemaValidator; +import org.openapijsonschematools.client.schemas.validation.PathToSchemasMap; +import org.openapijsonschematools.client.schemas.validation.PropertyEntry; +import org.openapijsonschematools.client.schemas.validation.StringSchemaValidator; +import org.openapijsonschematools.client.schemas.validation.ValidationMetadata; + +public class MultipartformdataSchema { + // nest classes so all schemas and input/output classes can be public + + + public sealed interface Multipartformdata0Boxed permits Multipartformdata0BoxedString { + @Nullable Object getData(); + } + + public record Multipartformdata0BoxedString(String data) implements Multipartformdata0Boxed { + @Override + public @Nullable Object getData() { + return data; + } + } + + + + public static class Multipartformdata0 extends JsonSchema implements StringSchemaValidator { + private static @Nullable Multipartformdata0 instance = null; + + protected Multipartformdata0() { + super(new JsonSchemaInfo() + .type(Set.of( + String.class + )) + .minLength(1) + ); + } + + public static Multipartformdata0 getInstance() { + if (instance == null) { + instance = new Multipartformdata0(); + } + return instance; + } + + @Override + public String validate(String arg, SchemaConfiguration configuration) throws ValidationException { + Set> pathSet = new HashSet<>(); + List pathToItem = List.of("args[0"); + String castArg = castToAllowedTypes(arg, pathToItem, pathSet); + SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().build())); + ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, new PathToSchemasMap(), new LinkedHashSet<>()); + getPathToSchemas(this, castArg, validationMetadata, pathSet); + return castArg; + } + + @Override + public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws 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"); + } + @Override + public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { + 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"); + } + @Override + 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 { + 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"); + } + } + + public sealed interface MultipartformdataSomePropBoxed permits MultipartformdataSomePropBoxedVoid, MultipartformdataSomePropBoxedBoolean, MultipartformdataSomePropBoxedNumber, MultipartformdataSomePropBoxedString, MultipartformdataSomePropBoxedList, MultipartformdataSomePropBoxedMap { + @Nullable Object getData(); + } + + public record MultipartformdataSomePropBoxedVoid(Nothing? data) implements MultipartformdataSomePropBoxed { + @Override + public @Nullable Object getData() { + return data; + } + } + + public record MultipartformdataSomePropBoxedBoolean(boolean data) implements MultipartformdataSomePropBoxed { + @Override + public @Nullable Object getData() { + return data; + } + } + + public record MultipartformdataSomePropBoxedNumber(Number data) implements MultipartformdataSomePropBoxed { + @Override + public @Nullable Object getData() { + return data; + } + } + + public record MultipartformdataSomePropBoxedString(String data) implements MultipartformdataSomePropBoxed { + @Override + public @Nullable Object getData() { + return data; + } + } + + public record MultipartformdataSomePropBoxedList(FrozenList<@Nullable Object> data) implements MultipartformdataSomePropBoxed { + @Override + public @Nullable Object getData() { + return data; + } + } + + public record MultipartformdataSomePropBoxedMap(FrozenMap<@Nullable Object> data) implements MultipartformdataSomePropBoxed { + @Override + public @Nullable Object getData() { + return data; + } + } + + + public static class MultipartformdataSomeProp extends JsonSchema implements NullSchemaValidator, BooleanSchemaValidator, NumberSchemaValidator, StringSchemaValidator, ListSchemaValidator, MultipartformdataSomePropBoxedList>, MapSchemaValidator, MultipartformdataSomePropBoxedMap> { + private static @Nullable MultipartformdataSomeProp instance = null; + + protected MultipartformdataSomeProp() { + super(new JsonSchemaInfo() + .allOf(List.of( + Multipartformdata0.class + )) + ); + } + + public static MultipartformdataSomeProp getInstance() { + if (instance == null) { + instance = new MultipartformdataSomeProp(); + } + return instance; + } + + @Override + public Nothing? validate(Nothing? arg, SchemaConfiguration configuration) throws ValidationException { + Set> pathSet = new HashSet<>(); + List pathToItem = List.of("args[0]"); + Nothing? castArg = castToAllowedTypes(arg, pathToItem, pathSet); + SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().build())); + PathToSchemasMap validatedPathToSchemas = new PathToSchemasMap(); + ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, new LinkedHashSet<>()); + getPathToSchemas(this, castArg, validationMetadata, pathSet); + return castArg; + } + + @Override + public boolean validate(boolean arg, SchemaConfiguration configuration) throws ValidationException { + Set> pathSet = new HashSet<>(); + List pathToItem = List.of("args[0]"); + boolean castArg = castToAllowedTypes(arg, pathToItem, pathSet); + SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().build())); + PathToSchemasMap validatedPathToSchemas = new PathToSchemasMap(); + ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, new LinkedHashSet<>()); + getPathToSchemas(this, castArg, validationMetadata, pathSet); + return castArg; + } + + @Override + public Number validate(Number arg, SchemaConfiguration configuration) throws ValidationException { + Set> pathSet = new HashSet<>(); + List pathToItem = List.of("args[0]"); + Number castArg = castToAllowedTypes(arg, pathToItem, pathSet); + SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().build())); + PathToSchemasMap validatedPathToSchemas = new PathToSchemasMap(); + ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, new LinkedHashSet<>()); + getPathToSchemas(this, castArg, validationMetadata, pathSet); + return castArg; + } + + public int validate(int arg, SchemaConfiguration configuration) throws ValidationException { + return (int) validate((Number) arg, configuration); + } + + public long validate(long arg, SchemaConfiguration configuration) throws ValidationException { + return (long) validate((Number) arg, configuration); + } + + public float validate(float arg, SchemaConfiguration configuration) throws ValidationException { + return (float) validate((Number) arg, configuration); + } + + public double validate(double arg, SchemaConfiguration configuration) throws ValidationException { + return (double) validate((Number) arg, configuration); + } + + @Override + public String validate(String arg, SchemaConfiguration configuration) throws ValidationException { + Set> pathSet = new HashSet<>(); + List pathToItem = List.of("args[0]"); + String castArg = castToAllowedTypes(arg, pathToItem, pathSet); + SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().build())); + PathToSchemasMap validatedPathToSchemas = new PathToSchemasMap(); + ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, new LinkedHashSet<>()); + getPathToSchemas(this, castArg, validationMetadata, pathSet); + return castArg; + } + + public String validate(LocalDate arg, SchemaConfiguration configuration) throws ValidationException { + return validate(arg.toString(), configuration); + } + + public String validate(ZonedDateTime arg, SchemaConfiguration configuration) throws ValidationException { + return validate(arg.toString(), configuration); + } + + public String validate(UUID arg, SchemaConfiguration configuration) throws ValidationException { + return validate(arg.toString(), configuration); + } + + @Override + public FrozenList<@Nullable Object> getNewInstance(List arg, List pathToItem, PathToSchemasMap pathToSchemas) { + List<@Nullable Object> items = new ArrayList<>(); + int i = 0; + for (Object item: arg) { + List itemPathToItem = new ArrayList<>(pathToItem); + itemPathToItem.add(i); + LinkedHashMap, Nothing?> schemas = pathToSchemas.get(itemPathToItem); + if (schemas == null) { + throw new RuntimeException("Validation result is invalid, schemas must exist for a pathToItem"); + } + JsonSchema itemSchema = schemas.entrySet().iterator().next().getKey(); + @Nullable Object itemInstance = itemSchema.getNewInstance(item, itemPathToItem, pathToSchemas); + items.add(itemInstance); + i += 1; + } + FrozenList<@Nullable Object> newInstanceItems = new FrozenList<>(items); + return newInstanceItems; + } + + 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); + SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().build())); + ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, new PathToSchemasMap(), new LinkedHashSet<>()); + PathToSchemasMap pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet); + return getNewInstance(castArg, validationMetadata.pathToItem(), pathToSchemasMap); + } + + @Override + 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 RuntimeException("Invalid non-string key value"); + } + String propertyName = (String) entryKey; + List propertyPathToItem = new ArrayList<>(pathToItem); + propertyPathToItem.add(propertyName); + Object value = entry.getValue(); + LinkedHashMap, Nothing?> schemas = pathToSchemas.get(propertyPathToItem); + if (schemas == null) { + throw new RuntimeException("Validation result is invalid, schemas must exist for a pathToItem"); + } + JsonSchema propertySchema = schemas.entrySet().iterator().next().getKey(); + @Nullable Object propertyInstance = propertySchema.getNewInstance(value, propertyPathToItem, pathToSchemas); + properties.put(propertyName, propertyInstance); + } + FrozenMap<@Nullable Object> castProperties = new FrozenMap<>(properties); + return castProperties; + } + + public FrozenMap<@Nullable Object> validate(Map arg, SchemaConfiguration configuration) throws ValidationException { + Set> pathSet = new HashSet<>(); + List pathToItem = List.of("args[0]"); + Map castArg = castToAllowedTypes(arg, pathToItem, pathSet); + SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().build())); + PathToSchemasMap validatedPathToSchemas = new PathToSchemasMap(); + ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, new LinkedHashSet<>()); + PathToSchemasMap pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet); + return getNewInstance(castArg, validationMetadata.pathToItem(), pathToSchemasMap); + } + + @Override + public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { + if (arg == null) { + return validate((Nothing?) null, configuration); + } else if (arg instanceof Boolean) { + boolean boolArg = (Boolean) arg; + return validate(boolArg, configuration); + } else if (arg instanceof Number) { + return validate((Number) arg, configuration); + } else if (arg instanceof String) { + return validate((String) arg, configuration); + } else if (arg instanceof List) { + return validate((List) arg, 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"); + } + @Override + public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { + if (arg == null) { + return getNewInstance((Nothing?) null, pathToItem, pathToSchemas); + } else if (arg instanceof Boolean) { + boolean boolArg = (Boolean) arg; + return getNewInstance(boolArg, pathToItem, pathToSchemas); + } else if (arg instanceof Number) { + return getNewInstance((Number) arg, pathToItem, pathToSchemas); + } else if (arg instanceof String) { + return getNewInstance((String) arg, pathToItem, pathToSchemas); + } else if (arg instanceof List) { + return getNewInstance((List) arg, 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"); + } + @Override + public MultipartformdataSomePropBoxedVoid validateAndBox(Nothing? arg, SchemaConfiguration configuration) throws ValidationException { + return new MultipartformdataSomePropBoxedVoid(validate(arg, configuration)); + } + @Override + 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 { + return new MultipartformdataSomePropBoxedNumber(validate(arg, configuration)); + } + @Override + 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 { + return new MultipartformdataSomePropBoxedList(validate(arg, configuration)); + } + @Override + 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 { + if (arg == null) { + Nothing? castArg = (Nothing?) arg; + return validateAndBox(castArg, configuration); + } else if (arg instanceof Boolean booleanArg) { + boolean castArg = booleanArg; + return validateAndBox(castArg, configuration); + } else if (arg instanceof String castArg) { + return validateAndBox(castArg, configuration); + } else if (arg instanceof Number castArg) { + return validateAndBox(castArg, configuration); + } else if (arg instanceof List castArg) { + 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"); + } + } + + public static class MultipartformdataSchemaMap extends FrozenMap<@Nullable Object> { + protected MultipartformdataSchemaMap(FrozenMap<@Nullable Object> m) { + super(m); + } + public static final Set requiredKeys = Set.of(); + public static final Set optionalKeys = Set.of( + "someProp" + ); + public static MultipartformdataSchemaMap of(Map arg, SchemaConfiguration configuration) throws ValidationException { + return MultipartformdataSchema1.getInstance().validate(arg, configuration); + } + + public @Nullable Object someProp() throws UnsetPropertyException { + return getOrThrow("someProp"); + } + + public @Nullable Object getAdditionalProperty(String name) throws UnsetPropertyException, InvalidAdditionalPropertyException { + throwIfKeyKnown(name, requiredKeys, optionalKeys); + throwIfKeyNotPresent(name); + return get(name); + } + } + + public interface SetterForMultipartformdataSomeProp { + Map getInstance(); + T getBuilderAfterMultipartformdataSomeProp(Map instance); + + default T someProp(Nothing? value) { + var instance = getInstance(); + instance.put("someProp", null); + return getBuilderAfterMultipartformdataSomeProp(instance); + } + + default T someProp(boolean value) { + var instance = getInstance(); + instance.put("someProp", value); + return getBuilderAfterMultipartformdataSomeProp(instance); + } + + default T someProp(String value) { + var instance = getInstance(); + instance.put("someProp", value); + return getBuilderAfterMultipartformdataSomeProp(instance); + } + + default T someProp(int value) { + var instance = getInstance(); + instance.put("someProp", value); + return getBuilderAfterMultipartformdataSomeProp(instance); + } + + default T someProp(float value) { + var instance = getInstance(); + instance.put("someProp", value); + return getBuilderAfterMultipartformdataSomeProp(instance); + } + + default T someProp(long value) { + var instance = getInstance(); + instance.put("someProp", value); + return getBuilderAfterMultipartformdataSomeProp(instance); + } + + default T someProp(double value) { + var instance = getInstance(); + instance.put("someProp", value); + return getBuilderAfterMultipartformdataSomeProp(instance); + } + + default T someProp(List value) { + var instance = getInstance(); + instance.put("someProp", value); + return getBuilderAfterMultipartformdataSomeProp(instance); + } + + default T someProp(Map value) { + var instance = getInstance(); + instance.put("someProp", value); + return getBuilderAfterMultipartformdataSomeProp(instance); + } + } + + public static class MultipartformdataSchemaMapBuilder extends UnsetAddPropsSetter implements GenericBuilder>, SetterForMultipartformdataSomeProp { + private final Map instance; + private static final Set knownKeys = Set.of( + "someProp" + ); + public Set getKnownKeys() { + return knownKeys; + } + public MultipartformdataSchemaMapBuilder() { + this.instance = new LinkedHashMap<>(); + } + public Map build() { + return instance; + } + public Map getInstance() { + return instance; + } + public MultipartformdataSchemaMapBuilder getBuilderAfterMultipartformdataSomeProp(Map instance) { + return this; + } + public MultipartformdataSchemaMapBuilder getBuilderAfterAdditionalProperty(Map instance) { + return this; + } + } + + + public sealed interface MultipartformdataSchema1Boxed permits MultipartformdataSchema1BoxedMap { + @Nullable Object getData(); + } + + public record MultipartformdataSchema1BoxedMap(MultipartformdataSchemaMap data) implements MultipartformdataSchema1Boxed { + @Override + public @Nullable Object getData() { + return data; + } + } + + + public static class MultipartformdataSchema1 extends JsonSchema implements MapSchemaValidator { + private static @Nullable MultipartformdataSchema1 instance = null; + + protected MultipartformdataSchema1() { + super(new JsonSchemaInfo() + .type(Set.of(Map.class)) + .properties(Map.ofEntries( + new PropertyEntry("someProp", MultipartformdataSomeProp.class) + )) + ); + } + + public static MultipartformdataSchema1 getInstance() { + if (instance == null) { + instance = new MultipartformdataSchema1(); + } + return instance; + } + + 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 RuntimeException("Invalid non-string key value"); + } + String propertyName = (String) entryKey; + List propertyPathToItem = new ArrayList<>(pathToItem); + propertyPathToItem.add(propertyName); + Object value = entry.getValue(); + LinkedHashMap, Nothing?> schemas = pathToSchemas.get(propertyPathToItem); + if (schemas == null) { + throw new RuntimeException("Validation result is invalid, schemas must exist for a pathToItem"); + } + JsonSchema propertySchema = schemas.entrySet().iterator().next().getKey(); + @Nullable Object propertyInstance = propertySchema.getNewInstance(value, propertyPathToItem, pathToSchemas); + properties.put(propertyName, propertyInstance); + } + FrozenMap<@Nullable Object> castProperties = new FrozenMap<>(properties); + return new MultipartformdataSchemaMap(castProperties); + } + + 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); + SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().build())); + ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, new PathToSchemasMap(), new LinkedHashSet<>()); + PathToSchemasMap pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet); + return getNewInstance(castArg, validationMetadata.pathToItem(), pathToSchemasMap); + } + + + @Override + public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws 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"); + } + @Override + public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { + if (arg instanceof Map) { + return getNewInstance((Map) arg, pathToItem, pathToSchemas); + } + 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 { + return new MultipartformdataSchema1BoxedMap(validate(arg, configuration)); + } + @Override + public MultipartformdataSchema1Boxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { + 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"); + } + } + +} diff --git a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/fakejsonformdata/FakejsonformdataGet.kt b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/fakejsonformdata/FakejsonformdataGet.kt new file mode 100644 index 00000000000..d0ab6bd7642 --- /dev/null +++ b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/fakejsonformdata/FakejsonformdataGet.kt @@ -0,0 +1,152 @@ +package org.openapijsonschematools.client.paths.fakejsonformdata; + +import org.checkerframework.checker.nullness.qual.Nullable; +import org.openapijsonschematools.client.paths.fakejsonformdata.get.FakejsonformdataGetRequestBody; +import org.openapijsonschematools.client.RootServerInfo; +import org.openapijsonschematools.client.paths.fakejsonformdata.get.FakejsonformdataGetResponses; +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.requestbody.SerializedRequestBody; +import org.openapijsonschematools.client.paths.Fakejsonformdata; + +import java.io.IOException; +import java.util.ArrayList; +import java.net.http.HttpClient; +import java.net.http.HttpRequest; +import java.time.Duration; +import java.util.List; +import java.util.Map; + +public class FakejsonformdataGet { + private static class GetProvider { + private static final String method = "get"; + + public static FakejsonformdataGetResponses.EndpointResponse get( + GetRequest request, + ApiConfiguration apiConfiguration, + SchemaConfiguration schemaConfiguration, + HttpClient client + ) throws IOException, InterruptedException, ValidationException, NotImplementedException, ApiException { + Map> headers = apiConfiguration.getDefaultHeaders(); + + @Nullable SerializedRequestBody serializedRequestBody; + HttpRequest.BodyPublisher bodyPublisher = HttpRequest.BodyPublishers.noBody(); + if (request.requestBody != null) { + serializedRequestBody = new FakejsonformdataGetRequestBody.FakejsonformdataGetRequestBody1().serialize( + request.requestBody + ); + var contentTypeHeaderValues = headers.getOrDefault("Content-Type", new ArrayList<>()); + contentTypeHeaderValues.add(serializedRequestBody.contentType); + bodyPublisher = serializedRequestBody.bodyPublisher; + } + // TODO set this to a map if there is a query security scheme + @Nullable Map queryMap = null; + String host = apiConfiguration.getServer(request.serverIndex).url(); + + String url = host + Fakejsonformdata.path; + var httpRequest = RestClient.getRequest( + url, + method, + bodyPublisher, + headers, + request.timeout + ); + var response = RestClient.getResponse(httpRequest, client); + var responsesDeserializer = new FakejsonformdataGetResponses.FakejsonformdataGetResponses1(); + return responsesDeserializer.deserialize(response, schemaConfiguration); + } + } + + public interface GetOperation { + ApiConfiguration getApiConfiguration(); + SchemaConfiguration getSchemaConfiguration(); + HttpClient getClient(); + default FakejsonformdataGetResponses.EndpointResponse get(GetRequest request) throws IOException, InterruptedException, ValidationException, NotImplementedException, ApiException { + return GetProvider.get(request, getApiConfiguration(), getSchemaConfiguration(), getClient()); + } + } + + public interface JsonFormDataOperation { + ApiConfiguration getApiConfiguration(); + SchemaConfiguration getSchemaConfiguration(); + HttpClient getClient(); + default FakejsonformdataGetResponses.EndpointResponse jsonFormData(GetRequest request) throws IOException, InterruptedException, ValidationException, NotImplementedException, ApiException { + return GetProvider.get(request, getApiConfiguration(), getSchemaConfiguration(), getClient()); + } + } + + public static class Get extends ApiClient implements GetOperation { + public Get(ApiConfiguration apiConfiguration, SchemaConfiguration schemaConfiguration) { + super(apiConfiguration, schemaConfiguration); + } + } + + public static class GetRequest { + public FakejsonformdataGetRequestBody.@Nullable SealedRequestBody requestBody; + public RootServerInfo.@Nullable ServerIndex serverIndex; + public @Nullable Duration timeout; + } + + public interface SetterForRequestBody { + GetRequest getInstance(); + T getBuilderAfterRequestBody(GetRequest instance); + default T requestBody(FakejsonformdataGetRequestBody.SealedRequestBody requestBody) { + var instance = getInstance(); + instance.requestBody = requestBody; + return getBuilderAfterRequestBody(instance); + } + } + + public interface SetterForServerIndex { + GetRequest getInstance(); + T getBuilderAfterServerIndex(GetRequest instance); + default T serverIndex(RootServerInfo.ServerIndex serverIndex) { + var instance = getInstance(); + instance.serverIndex = serverIndex; + return getBuilderAfterServerIndex(instance); + } + } + + public interface SetterForTimeout { + GetRequest getInstance(); + T getBuilderAfterTimeout(GetRequest instance); + default T timeout(Duration timeout) { + var instance = getInstance(); + instance.timeout = timeout; + return getBuilderAfterTimeout(instance); + } + } + + public static class GetRequestBuilder implements SetterForRequestBody, SetterForServerIndex, SetterForTimeout { + private final GetRequest instance; + + public GetRequestBuilder() { + this.instance = new GetRequest(); + } + + public GetRequest build() { + return instance; + } + + public GetRequest getInstance() { + return instance; + } + + public GetRequestBuilder getBuilderAfterRequestBody(GetRequest instance) { + return this; + } + + public GetRequestBuilder getBuilderAfterServerIndex(GetRequest instance) { + return this; + } + + public GetRequestBuilder getBuilderAfterTimeout(GetRequest instance) { + return this; + } + } +} diff --git a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/fakejsonformdata/get/FakejsonformdataGetRequestBody.kt b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/fakejsonformdata/get/FakejsonformdataGetRequestBody.kt new file mode 100644 index 00000000000..e96364f4f74 --- /dev/null +++ b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/fakejsonformdata/get/FakejsonformdataGetRequestBody.kt @@ -0,0 +1,49 @@ +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; +import org.openapijsonschematools.client.mediatype.MediaType; +import org.openapijsonschematools.client.paths.fakejsonformdata.get.requestbody.content.applicationxwwwformurlencoded.ApplicationxwwwformurlencodedSchema; + +import java.util.AbstractMap; +import java.util.Map; + +public class FakejsonformdataGetRequestBody { + public sealed interface SealedMediaType permits ApplicationxwwwformurlencodedMediaType {} + + public record ApplicationxwwwformurlencodedMediaType(ApplicationxwwwformurlencodedSchema.ApplicationxwwwformurlencodedSchema1 schema) implements SealedMediaType, MediaType { + public ApplicationxwwwformurlencodedMediaType() { + this(ApplicationxwwwformurlencodedSchema.ApplicationxwwwformurlencodedSchema1.getInstance()); + } + @Override + public Nothing? encoding() { + return null; + } + } + + public static class FakejsonformdataGetRequestBody1 extends RequestBodySerializer { + public FakejsonformdataGetRequestBody1() { + super( + Map.ofEntries( + new AbstractMap.SimpleEntry<>("application/x-www-form-urlencoded", new ApplicationxwwwformurlencodedMediaType()) + ), + false + ); + } + + public SerializedRequestBody serialize(SealedRequestBody requestBody) throws NotImplementedException { + ApplicationxwwwformurlencodedRequestBody requestBody0 = (ApplicationxwwwformurlencodedRequestBody) requestBody; + return serialize(requestBody0.contentType(), requestBody0.body().getData()); + } + } + + public sealed interface SealedRequestBody permits ApplicationxwwwformurlencodedRequestBody {} + public record ApplicationxwwwformurlencodedRequestBody(ApplicationxwwwformurlencodedSchema.ApplicationxwwwformurlencodedSchema1Boxed body) implements SealedRequestBody, GenericRequestBody { + @Override + public String contentType() { + return "application/x-www-form-urlencoded"; + } + } +} diff --git a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/fakejsonformdata/get/FakejsonformdataGetResponses.kt b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/fakejsonformdata/get/FakejsonformdataGetResponses.kt new file mode 100644 index 00000000000..345afc917a5 --- /dev/null +++ b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/fakejsonformdata/get/FakejsonformdataGetResponses.kt @@ -0,0 +1,53 @@ +package org.openapijsonschematools.client.paths.fakejsonformdata.get; + +import org.openapijsonschematools.client.paths.fakejsonformdata.get.responses.FakejsonformdataGetCode200Response; +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; +import org.checkerframework.checker.nullness.qual.Nullable; + +import java.net.http.HttpResponse; +import java.util.Map; +import java.util.AbstractMap; + +public class FakejsonformdataGetResponses { + public sealed interface EndpointResponse permits EndpointFakejsonformdataGetCode200Response {} + + public record EndpointFakejsonformdataGetCode200Response( + HttpResponse response, + Nothing? body, + Nothing? headers + ) implements EndpointResponse, ApiResponse{ + } + + public sealed interface StatusCodeResponseDeserializer permits StatusFakejsonformdataGetCode200ResponseDeserializer {} + + public static final class StatusFakejsonformdataGetCode200ResponseDeserializer extends FakejsonformdataGetCode200Response.FakejsonformdataGetCode200Response1 implements StatusCodeResponseDeserializer { + } + + public static final class FakejsonformdataGetResponses1 implements ResponsesDeserializer { + private final Map statusCodeToResponseDeserializer; + public FakejsonformdataGetResponses1() { + this.statusCodeToResponseDeserializer = Map.ofEntries( + new AbstractMap.SimpleEntry<>("200", new StatusFakejsonformdataGetCode200ResponseDeserializer()) + ); + } + + 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) { + throw new ApiException( + "Invalid response statusCode="+statusCode+" has no response defined in the openapi document", + response + ); + } + StatusFakejsonformdataGetCode200ResponseDeserializer castDeserializer = (StatusFakejsonformdataGetCode200ResponseDeserializer) statusCodeDeserializer; + var deserializedResponse = castDeserializer.deserialize(response, configuration); + return new EndpointFakejsonformdataGetCode200Response(response, deserializedResponse.body(), deserializedResponse.headers()); + } + } +} diff --git a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/fakejsonformdata/get/requestbody/content/applicationxwwwformurlencoded/ApplicationxwwwformurlencodedSchema.kt b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/fakejsonformdata/get/requestbody/content/applicationxwwwformurlencoded/ApplicationxwwwformurlencodedSchema.kt new file mode 100644 index 00000000000..d36bfe68e9b --- /dev/null +++ b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/fakejsonformdata/get/requestbody/content/applicationxwwwformurlencoded/ApplicationxwwwformurlencodedSchema.kt @@ -0,0 +1,274 @@ +package org.openapijsonschematools.client.paths.fakejsonformdata.get.requestbody.content.applicationxwwwformurlencoded; +import java.util.ArrayList; +import java.util.HashSet; +import java.util.LinkedHashMap; +import java.util.LinkedHashSet; +import java.util.List; +import java.util.Map; +import java.util.Objects; +import java.util.Set; +import org.checkerframework.checker.nullness.qual.Nullable; +import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags; +import org.openapijsonschematools.client.configurations.SchemaConfiguration; +import org.openapijsonschematools.client.exceptions.InvalidAdditionalPropertyException; +import org.openapijsonschematools.client.exceptions.UnsetPropertyException; +import org.openapijsonschematools.client.exceptions.ValidationException; +import org.openapijsonschematools.client.schemas.GenericBuilder; +import org.openapijsonschematools.client.schemas.StringJsonSchema; +import org.openapijsonschematools.client.schemas.UnsetAddPropsSetter; +import org.openapijsonschematools.client.schemas.validation.FrozenMap; +import org.openapijsonschematools.client.schemas.validation.JsonSchema; +import org.openapijsonschematools.client.schemas.validation.JsonSchemaInfo; +import org.openapijsonschematools.client.schemas.validation.MapSchemaValidator; +import org.openapijsonschematools.client.schemas.validation.PathToSchemasMap; +import org.openapijsonschematools.client.schemas.validation.PropertyEntry; +import org.openapijsonschematools.client.schemas.validation.ValidationMetadata; + +public class ApplicationxwwwformurlencodedSchema { + // nest classes so all schemas and input/output classes can be public + + + public static class ApplicationxwwwformurlencodedParam extends StringJsonSchema.StringJsonSchema1 { + private static @Nullable ApplicationxwwwformurlencodedParam instance = null; + public static ApplicationxwwwformurlencodedParam getInstance() { + if (instance == null) { + instance = new ApplicationxwwwformurlencodedParam(); + } + return instance; + } + } + + + public static class ApplicationxwwwformurlencodedParam2 extends StringJsonSchema.StringJsonSchema1 { + private static @Nullable ApplicationxwwwformurlencodedParam2 instance = null; + public static ApplicationxwwwformurlencodedParam2 getInstance() { + if (instance == null) { + instance = new ApplicationxwwwformurlencodedParam2(); + } + return instance; + } + } + + + public static class ApplicationxwwwformurlencodedSchemaMap extends FrozenMap<@Nullable Object> { + protected ApplicationxwwwformurlencodedSchemaMap(FrozenMap<@Nullable Object> m) { + super(m); + } + public static final Set requiredKeys = Set.of( + "param", + "param2" + ); + public static final Set optionalKeys = Set.of(); + public static ApplicationxwwwformurlencodedSchemaMap of(Map arg, SchemaConfiguration configuration) throws ValidationException { + return ApplicationxwwwformurlencodedSchema1.getInstance().validate(arg, configuration); + } + + public String param() { + @Nullable Object value = get("param"); + if (!(value instanceof String)) { + throw new RuntimeException("Invalid value stored for param"); + } + return (String) value; + } + + public String param2() { + @Nullable Object value = get("param2"); + if (!(value instanceof String)) { + throw new RuntimeException("Invalid value stored for param2"); + } + return (String) value; + } + + public @Nullable Object getAdditionalProperty(String name) throws UnsetPropertyException, InvalidAdditionalPropertyException { + throwIfKeyKnown(name, requiredKeys, optionalKeys); + throwIfKeyNotPresent(name); + return get(name); + } + } + + public interface SetterForApplicationxwwwformurlencodedParam { + Map getInstance(); + T getBuilderAfterApplicationxwwwformurlencodedParam(Map instance); + + default T param(String value) { + var instance = getInstance(); + instance.put("param", value); + return getBuilderAfterApplicationxwwwformurlencodedParam(instance); + } + } + + public interface SetterForApplicationxwwwformurlencodedParam2 { + Map getInstance(); + T getBuilderAfterApplicationxwwwformurlencodedParam2(Map instance); + + default T param2(String value) { + var instance = getInstance(); + instance.put("param2", value); + return getBuilderAfterApplicationxwwwformurlencodedParam2(instance); + } + } + + public static class ApplicationxwwwformurlencodedSchemaMap00Builder extends UnsetAddPropsSetter implements GenericBuilder> { + private final Map instance; + private static final Set knownKeys = Set.of( + "param", + "param2" + ); + public Set getKnownKeys() { + return knownKeys; + } + public ApplicationxwwwformurlencodedSchemaMap00Builder(Map instance) { + this.instance = instance; + } + public Map build() { + return instance; + } + public Map getInstance() { + return instance; + } + public ApplicationxwwwformurlencodedSchemaMap00Builder getBuilderAfterAdditionalProperty(Map instance) { + return this; + } + } + + public static class ApplicationxwwwformurlencodedSchemaMap01Builder implements SetterForApplicationxwwwformurlencodedParam2 { + private final Map instance; + public ApplicationxwwwformurlencodedSchemaMap01Builder(Map instance) { + this.instance = instance; + } + public Map getInstance() { + return instance; + } + public ApplicationxwwwformurlencodedSchemaMap00Builder getBuilderAfterApplicationxwwwformurlencodedParam2(Map instance) { + return new ApplicationxwwwformurlencodedSchemaMap00Builder(instance); + } + } + + public static class ApplicationxwwwformurlencodedSchemaMap10Builder implements SetterForApplicationxwwwformurlencodedParam { + private final Map instance; + public ApplicationxwwwformurlencodedSchemaMap10Builder(Map instance) { + this.instance = instance; + } + public Map getInstance() { + return instance; + } + public ApplicationxwwwformurlencodedSchemaMap00Builder getBuilderAfterApplicationxwwwformurlencodedParam(Map instance) { + return new ApplicationxwwwformurlencodedSchemaMap00Builder(instance); + } + } + + public static class ApplicationxwwwformurlencodedSchemaMapBuilder implements SetterForApplicationxwwwformurlencodedParam, SetterForApplicationxwwwformurlencodedParam2 { + private final Map instance; + public ApplicationxwwwformurlencodedSchemaMapBuilder() { + this.instance = new LinkedHashMap<>(); + } + public Map getInstance() { + return instance; + } + public ApplicationxwwwformurlencodedSchemaMap01Builder getBuilderAfterApplicationxwwwformurlencodedParam(Map instance) { + return new ApplicationxwwwformurlencodedSchemaMap01Builder(instance); + } + public ApplicationxwwwformurlencodedSchemaMap10Builder getBuilderAfterApplicationxwwwformurlencodedParam2(Map instance) { + return new ApplicationxwwwformurlencodedSchemaMap10Builder(instance); + } + } + + + public sealed interface ApplicationxwwwformurlencodedSchema1Boxed permits ApplicationxwwwformurlencodedSchema1BoxedMap { + @Nullable Object getData(); + } + + public record ApplicationxwwwformurlencodedSchema1BoxedMap(ApplicationxwwwformurlencodedSchemaMap data) implements ApplicationxwwwformurlencodedSchema1Boxed { + @Override + public @Nullable Object getData() { + return data; + } + } + + + public static class ApplicationxwwwformurlencodedSchema1 extends JsonSchema implements MapSchemaValidator { + private static @Nullable ApplicationxwwwformurlencodedSchema1 instance = null; + + protected ApplicationxwwwformurlencodedSchema1() { + super(new JsonSchemaInfo() + .type(Set.of(Map.class)) + .properties(Map.ofEntries( + new PropertyEntry("param", ApplicationxwwwformurlencodedParam.class), + new PropertyEntry("param2", ApplicationxwwwformurlencodedParam2.class) + )) + .required(Set.of( + "param", + "param2" + )) + ); + } + + public static ApplicationxwwwformurlencodedSchema1 getInstance() { + if (instance == null) { + instance = new ApplicationxwwwformurlencodedSchema1(); + } + return instance; + } + + 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 RuntimeException("Invalid non-string key value"); + } + String propertyName = (String) entryKey; + List propertyPathToItem = new ArrayList<>(pathToItem); + propertyPathToItem.add(propertyName); + Object value = entry.getValue(); + LinkedHashMap, Nothing?> schemas = pathToSchemas.get(propertyPathToItem); + if (schemas == null) { + throw new RuntimeException("Validation result is invalid, schemas must exist for a pathToItem"); + } + JsonSchema propertySchema = schemas.entrySet().iterator().next().getKey(); + @Nullable Object propertyInstance = propertySchema.getNewInstance(value, propertyPathToItem, pathToSchemas); + properties.put(propertyName, propertyInstance); + } + FrozenMap<@Nullable Object> castProperties = new FrozenMap<>(properties); + return new ApplicationxwwwformurlencodedSchemaMap(castProperties); + } + + 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); + SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().build())); + ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, new PathToSchemasMap(), new LinkedHashSet<>()); + PathToSchemasMap pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet); + return getNewInstance(castArg, validationMetadata.pathToItem(), pathToSchemasMap); + } + + + @Override + public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws 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"); + } + @Override + public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { + if (arg instanceof Map) { + return getNewInstance((Map) arg, pathToItem, pathToSchemas); + } + 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 { + return new ApplicationxwwwformurlencodedSchema1BoxedMap(validate(arg, configuration)); + } + @Override + public ApplicationxwwwformurlencodedSchema1Boxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { + 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"); + } + } + +} diff --git a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/fakejsonformdata/get/responses/FakejsonformdataGetCode200Response.kt b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/fakejsonformdata/get/responses/FakejsonformdataGetCode200Response.kt new file mode 100644 index 00000000000..ea7665e2152 --- /dev/null +++ b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/fakejsonformdata/get/responses/FakejsonformdataGetCode200Response.kt @@ -0,0 +1,7 @@ +package org.openapijsonschematools.client.paths.fakejsonformdata.get.responses; + +import org.openapijsonschematools.client.components.responses.SuccessDescriptionOnly; + +public class FakejsonformdataGetCode200Response extends SuccessDescriptionOnly { + public static class FakejsonformdataGetCode200Response1 extends SuccessDescriptionOnly1 {} +} diff --git a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/fakejsonpatch/FakejsonpatchPatch.kt b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/fakejsonpatch/FakejsonpatchPatch.kt new file mode 100644 index 00000000000..a13ac896280 --- /dev/null +++ b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/fakejsonpatch/FakejsonpatchPatch.kt @@ -0,0 +1,152 @@ +package org.openapijsonschematools.client.paths.fakejsonpatch; + +import org.checkerframework.checker.nullness.qual.Nullable; +import org.openapijsonschematools.client.paths.fakejsonpatch.patch.FakejsonpatchPatchRequestBody; +import org.openapijsonschematools.client.RootServerInfo; +import org.openapijsonschematools.client.paths.fakejsonpatch.patch.FakejsonpatchPatchResponses; +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.requestbody.SerializedRequestBody; +import org.openapijsonschematools.client.paths.Fakejsonpatch; + +import java.io.IOException; +import java.util.ArrayList; +import java.net.http.HttpClient; +import java.net.http.HttpRequest; +import java.time.Duration; +import java.util.List; +import java.util.Map; + +public class FakejsonpatchPatch { + private static class PatchProvider { + private static final String method = "patch"; + + public static FakejsonpatchPatchResponses.EndpointResponse patch( + PatchRequest request, + ApiConfiguration apiConfiguration, + SchemaConfiguration schemaConfiguration, + HttpClient client + ) throws IOException, InterruptedException, ValidationException, NotImplementedException, ApiException { + Map> headers = apiConfiguration.getDefaultHeaders(); + + @Nullable SerializedRequestBody serializedRequestBody; + HttpRequest.BodyPublisher bodyPublisher = HttpRequest.BodyPublishers.noBody(); + if (request.requestBody != null) { + serializedRequestBody = new FakejsonpatchPatchRequestBody.FakejsonpatchPatchRequestBody1().serialize( + request.requestBody + ); + var contentTypeHeaderValues = headers.getOrDefault("Content-Type", new ArrayList<>()); + contentTypeHeaderValues.add(serializedRequestBody.contentType); + bodyPublisher = serializedRequestBody.bodyPublisher; + } + // TODO set this to a map if there is a query security scheme + @Nullable Map queryMap = null; + String host = apiConfiguration.getServer(request.serverIndex).url(); + + String url = host + Fakejsonpatch.path; + var httpRequest = RestClient.getRequest( + url, + method, + bodyPublisher, + headers, + request.timeout + ); + var response = RestClient.getResponse(httpRequest, client); + var responsesDeserializer = new FakejsonpatchPatchResponses.FakejsonpatchPatchResponses1(); + return responsesDeserializer.deserialize(response, schemaConfiguration); + } + } + + public interface PatchOperation { + ApiConfiguration getApiConfiguration(); + SchemaConfiguration getSchemaConfiguration(); + HttpClient getClient(); + default FakejsonpatchPatchResponses.EndpointResponse patch(PatchRequest request) throws IOException, InterruptedException, ValidationException, NotImplementedException, ApiException { + return PatchProvider.patch(request, getApiConfiguration(), getSchemaConfiguration(), getClient()); + } + } + + public interface JsonPatchOperation { + ApiConfiguration getApiConfiguration(); + SchemaConfiguration getSchemaConfiguration(); + HttpClient getClient(); + default FakejsonpatchPatchResponses.EndpointResponse jsonPatch(PatchRequest request) throws IOException, InterruptedException, ValidationException, NotImplementedException, ApiException { + return PatchProvider.patch(request, getApiConfiguration(), getSchemaConfiguration(), getClient()); + } + } + + public static class Patch extends ApiClient implements PatchOperation { + public Patch(ApiConfiguration apiConfiguration, SchemaConfiguration schemaConfiguration) { + super(apiConfiguration, schemaConfiguration); + } + } + + public static class PatchRequest { + public FakejsonpatchPatchRequestBody.@Nullable SealedRequestBody requestBody; + public RootServerInfo.@Nullable ServerIndex serverIndex; + public @Nullable Duration timeout; + } + + public interface SetterForRequestBody { + PatchRequest getInstance(); + T getBuilderAfterRequestBody(PatchRequest instance); + default T requestBody(FakejsonpatchPatchRequestBody.SealedRequestBody requestBody) { + var instance = getInstance(); + instance.requestBody = requestBody; + return getBuilderAfterRequestBody(instance); + } + } + + public interface SetterForServerIndex { + PatchRequest getInstance(); + T getBuilderAfterServerIndex(PatchRequest instance); + default T serverIndex(RootServerInfo.ServerIndex serverIndex) { + var instance = getInstance(); + instance.serverIndex = serverIndex; + return getBuilderAfterServerIndex(instance); + } + } + + public interface SetterForTimeout { + PatchRequest getInstance(); + T getBuilderAfterTimeout(PatchRequest instance); + default T timeout(Duration timeout) { + var instance = getInstance(); + instance.timeout = timeout; + return getBuilderAfterTimeout(instance); + } + } + + public static class PatchRequestBuilder implements SetterForRequestBody, SetterForServerIndex, SetterForTimeout { + private final PatchRequest instance; + + public PatchRequestBuilder() { + this.instance = new PatchRequest(); + } + + public PatchRequest build() { + return instance; + } + + public PatchRequest getInstance() { + return instance; + } + + public PatchRequestBuilder getBuilderAfterRequestBody(PatchRequest instance) { + return this; + } + + public PatchRequestBuilder getBuilderAfterServerIndex(PatchRequest instance) { + return this; + } + + public PatchRequestBuilder getBuilderAfterTimeout(PatchRequest instance) { + return this; + } + } +} diff --git a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/fakejsonpatch/patch/FakejsonpatchPatchRequestBody.kt b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/fakejsonpatch/patch/FakejsonpatchPatchRequestBody.kt new file mode 100644 index 00000000000..7151e0e3bcd --- /dev/null +++ b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/fakejsonpatch/patch/FakejsonpatchPatchRequestBody.kt @@ -0,0 +1,49 @@ +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; +import org.openapijsonschematools.client.mediatype.MediaType; +import org.openapijsonschematools.client.paths.fakejsonpatch.patch.requestbody.content.applicationjsonpatchjson.ApplicationjsonpatchjsonSchema; + +import java.util.AbstractMap; +import java.util.Map; + +public class FakejsonpatchPatchRequestBody { + public sealed interface SealedMediaType permits ApplicationjsonpatchjsonMediaType {} + + public record ApplicationjsonpatchjsonMediaType(ApplicationjsonpatchjsonSchema.ApplicationjsonpatchjsonSchema1 schema) implements SealedMediaType, MediaType { + public ApplicationjsonpatchjsonMediaType() { + this(ApplicationjsonpatchjsonSchema.ApplicationjsonpatchjsonSchema1.getInstance()); + } + @Override + public Nothing? encoding() { + return null; + } + } + + public static class FakejsonpatchPatchRequestBody1 extends RequestBodySerializer { + public FakejsonpatchPatchRequestBody1() { + super( + Map.ofEntries( + new AbstractMap.SimpleEntry<>("application/json-patch+json", new ApplicationjsonpatchjsonMediaType()) + ), + false + ); + } + + public SerializedRequestBody serialize(SealedRequestBody requestBody) throws NotImplementedException { + ApplicationjsonpatchjsonRequestBody requestBody0 = (ApplicationjsonpatchjsonRequestBody) requestBody; + return serialize(requestBody0.contentType(), requestBody0.body().getData()); + } + } + + public sealed interface SealedRequestBody permits ApplicationjsonpatchjsonRequestBody {} + public record ApplicationjsonpatchjsonRequestBody(ApplicationjsonpatchjsonSchema.JSONPatchRequest1Boxed body) implements SealedRequestBody, GenericRequestBody { + @Override + public String contentType() { + return "application/json-patch+json"; + } + } +} diff --git a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/fakejsonpatch/patch/FakejsonpatchPatchResponses.kt b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/fakejsonpatch/patch/FakejsonpatchPatchResponses.kt new file mode 100644 index 00000000000..8710f344caf --- /dev/null +++ b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/fakejsonpatch/patch/FakejsonpatchPatchResponses.kt @@ -0,0 +1,53 @@ +package org.openapijsonschematools.client.paths.fakejsonpatch.patch; + +import org.openapijsonschematools.client.paths.fakejsonpatch.patch.responses.FakejsonpatchPatchCode200Response; +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; +import org.checkerframework.checker.nullness.qual.Nullable; + +import java.net.http.HttpResponse; +import java.util.Map; +import java.util.AbstractMap; + +public class FakejsonpatchPatchResponses { + public sealed interface EndpointResponse permits EndpointFakejsonpatchPatchCode200Response {} + + public record EndpointFakejsonpatchPatchCode200Response( + HttpResponse response, + Nothing? body, + Nothing? headers + ) implements EndpointResponse, ApiResponse{ + } + + public sealed interface StatusCodeResponseDeserializer permits StatusFakejsonpatchPatchCode200ResponseDeserializer {} + + public static final class StatusFakejsonpatchPatchCode200ResponseDeserializer extends FakejsonpatchPatchCode200Response.FakejsonpatchPatchCode200Response1 implements StatusCodeResponseDeserializer { + } + + public static final class FakejsonpatchPatchResponses1 implements ResponsesDeserializer { + private final Map statusCodeToResponseDeserializer; + public FakejsonpatchPatchResponses1() { + this.statusCodeToResponseDeserializer = Map.ofEntries( + new AbstractMap.SimpleEntry<>("200", new StatusFakejsonpatchPatchCode200ResponseDeserializer()) + ); + } + + 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) { + throw new ApiException( + "Invalid response statusCode="+statusCode+" has no response defined in the openapi document", + response + ); + } + StatusFakejsonpatchPatchCode200ResponseDeserializer castDeserializer = (StatusFakejsonpatchPatchCode200ResponseDeserializer) statusCodeDeserializer; + var deserializedResponse = castDeserializer.deserialize(response, configuration); + return new EndpointFakejsonpatchPatchCode200Response(response, deserializedResponse.body(), deserializedResponse.headers()); + } + } +} diff --git a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/fakejsonpatch/patch/requestbody/content/applicationjsonpatchjson/ApplicationjsonpatchjsonSchema.kt b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/fakejsonpatch/patch/requestbody/content/applicationjsonpatchjson/ApplicationjsonpatchjsonSchema.kt new file mode 100644 index 00000000000..cd05f887749 --- /dev/null +++ b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/fakejsonpatch/patch/requestbody/content/applicationjsonpatchjson/ApplicationjsonpatchjsonSchema.kt @@ -0,0 +1,19 @@ +package org.openapijsonschematools.client.paths.fakejsonpatch.patch.requestbody.content.applicationjsonpatchjson; + +import org.checkerframework.checker.nullness.qual.Nullable; +import org.openapijsonschematools.client.components.schemas.JSONPatchRequest; + +public class ApplicationjsonpatchjsonSchema extends JSONPatchRequest { + // $refed class + + + public static class ApplicationjsonpatchjsonSchema1 extends JSONPatchRequest1 { + private static @Nullable ApplicationjsonpatchjsonSchema1 instance = null; + public static ApplicationjsonpatchjsonSchema1 getInstance() { + if (instance == null) { + instance = new ApplicationjsonpatchjsonSchema1(); + } + return instance; + } + } +} diff --git a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/fakejsonpatch/patch/responses/FakejsonpatchPatchCode200Response.kt b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/fakejsonpatch/patch/responses/FakejsonpatchPatchCode200Response.kt new file mode 100644 index 00000000000..9c5391108b0 --- /dev/null +++ b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/fakejsonpatch/patch/responses/FakejsonpatchPatchCode200Response.kt @@ -0,0 +1,7 @@ +package org.openapijsonschematools.client.paths.fakejsonpatch.patch.responses; + +import org.openapijsonschematools.client.components.responses.SuccessDescriptionOnly; + +public class FakejsonpatchPatchCode200Response extends SuccessDescriptionOnly { + public static class FakejsonpatchPatchCode200Response1 extends SuccessDescriptionOnly1 {} +} diff --git a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/fakejsonwithcharset/FakejsonwithcharsetPost.kt b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/fakejsonwithcharset/FakejsonwithcharsetPost.kt new file mode 100644 index 00000000000..480a7570011 --- /dev/null +++ b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/fakejsonwithcharset/FakejsonwithcharsetPost.kt @@ -0,0 +1,152 @@ +package org.openapijsonschematools.client.paths.fakejsonwithcharset; + +import org.checkerframework.checker.nullness.qual.Nullable; +import org.openapijsonschematools.client.paths.fakejsonwithcharset.post.FakejsonwithcharsetPostRequestBody; +import org.openapijsonschematools.client.RootServerInfo; +import org.openapijsonschematools.client.paths.fakejsonwithcharset.post.FakejsonwithcharsetPostResponses; +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.requestbody.SerializedRequestBody; +import org.openapijsonschematools.client.paths.Fakejsonwithcharset; + +import java.io.IOException; +import java.util.ArrayList; +import java.net.http.HttpClient; +import java.net.http.HttpRequest; +import java.time.Duration; +import java.util.List; +import java.util.Map; + +public class FakejsonwithcharsetPost { + private static class PostProvider { + private static final String method = "post"; + + public static FakejsonwithcharsetPostResponses.EndpointResponse post( + PostRequest request, + ApiConfiguration apiConfiguration, + SchemaConfiguration schemaConfiguration, + HttpClient client + ) throws IOException, InterruptedException, ValidationException, NotImplementedException, ApiException { + Map> headers = apiConfiguration.getDefaultHeaders(); + + @Nullable SerializedRequestBody serializedRequestBody; + HttpRequest.BodyPublisher bodyPublisher = HttpRequest.BodyPublishers.noBody(); + if (request.requestBody != null) { + serializedRequestBody = new FakejsonwithcharsetPostRequestBody.FakejsonwithcharsetPostRequestBody1().serialize( + request.requestBody + ); + var contentTypeHeaderValues = headers.getOrDefault("Content-Type", new ArrayList<>()); + contentTypeHeaderValues.add(serializedRequestBody.contentType); + bodyPublisher = serializedRequestBody.bodyPublisher; + } + // TODO set this to a map if there is a query security scheme + @Nullable Map queryMap = null; + String host = apiConfiguration.getServer(request.serverIndex).url(); + + String url = host + Fakejsonwithcharset.path; + var httpRequest = RestClient.getRequest( + url, + method, + bodyPublisher, + headers, + request.timeout + ); + var response = RestClient.getResponse(httpRequest, client); + var responsesDeserializer = new FakejsonwithcharsetPostResponses.FakejsonwithcharsetPostResponses1(); + return responsesDeserializer.deserialize(response, schemaConfiguration); + } + } + + public interface PostOperation { + ApiConfiguration getApiConfiguration(); + SchemaConfiguration getSchemaConfiguration(); + HttpClient getClient(); + default FakejsonwithcharsetPostResponses.EndpointResponse post(PostRequest request) throws IOException, InterruptedException, ValidationException, NotImplementedException, ApiException { + return PostProvider.post(request, getApiConfiguration(), getSchemaConfiguration(), getClient()); + } + } + + public interface JsonWithCharsetOperation { + ApiConfiguration getApiConfiguration(); + SchemaConfiguration getSchemaConfiguration(); + HttpClient getClient(); + default FakejsonwithcharsetPostResponses.EndpointResponse jsonWithCharset(PostRequest request) throws IOException, InterruptedException, ValidationException, NotImplementedException, ApiException { + return PostProvider.post(request, getApiConfiguration(), getSchemaConfiguration(), getClient()); + } + } + + public static class Post extends ApiClient implements PostOperation { + public Post(ApiConfiguration apiConfiguration, SchemaConfiguration schemaConfiguration) { + super(apiConfiguration, schemaConfiguration); + } + } + + public static class PostRequest { + public FakejsonwithcharsetPostRequestBody.@Nullable SealedRequestBody requestBody; + public RootServerInfo.@Nullable ServerIndex serverIndex; + public @Nullable Duration timeout; + } + + public interface SetterForRequestBody { + PostRequest getInstance(); + T getBuilderAfterRequestBody(PostRequest instance); + default T requestBody(FakejsonwithcharsetPostRequestBody.SealedRequestBody requestBody) { + var instance = getInstance(); + instance.requestBody = requestBody; + return getBuilderAfterRequestBody(instance); + } + } + + public interface SetterForServerIndex { + PostRequest getInstance(); + T getBuilderAfterServerIndex(PostRequest instance); + default T serverIndex(RootServerInfo.ServerIndex serverIndex) { + var instance = getInstance(); + instance.serverIndex = serverIndex; + return getBuilderAfterServerIndex(instance); + } + } + + public interface SetterForTimeout { + PostRequest getInstance(); + T getBuilderAfterTimeout(PostRequest instance); + default T timeout(Duration timeout) { + var instance = getInstance(); + instance.timeout = timeout; + return getBuilderAfterTimeout(instance); + } + } + + public static class PostRequestBuilder implements SetterForRequestBody, SetterForServerIndex, SetterForTimeout { + private final PostRequest instance; + + public PostRequestBuilder() { + this.instance = new PostRequest(); + } + + public PostRequest build() { + return instance; + } + + public PostRequest getInstance() { + return instance; + } + + public PostRequestBuilder getBuilderAfterRequestBody(PostRequest instance) { + return this; + } + + public PostRequestBuilder getBuilderAfterServerIndex(PostRequest instance) { + return this; + } + + public PostRequestBuilder getBuilderAfterTimeout(PostRequest instance) { + return this; + } + } +} diff --git a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/fakejsonwithcharset/post/FakejsonwithcharsetPostRequestBody.kt b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/fakejsonwithcharset/post/FakejsonwithcharsetPostRequestBody.kt new file mode 100644 index 00000000000..fa673212daa --- /dev/null +++ b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/fakejsonwithcharset/post/FakejsonwithcharsetPostRequestBody.kt @@ -0,0 +1,49 @@ +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; +import org.openapijsonschematools.client.mediatype.MediaType; +import org.openapijsonschematools.client.paths.fakejsonwithcharset.post.requestbody.content.applicationjsoncharsetutf8.Applicationjsoncharsetutf8Schema; + +import java.util.AbstractMap; +import java.util.Map; + +public class FakejsonwithcharsetPostRequestBody { + public sealed interface SealedMediaType permits Applicationjsoncharsetutf8MediaType {} + + public record Applicationjsoncharsetutf8MediaType(Applicationjsoncharsetutf8Schema.Applicationjsoncharsetutf8Schema1 schema) implements SealedMediaType, MediaType { + public Applicationjsoncharsetutf8MediaType() { + this(Applicationjsoncharsetutf8Schema.Applicationjsoncharsetutf8Schema1.getInstance()); + } + @Override + public Nothing? encoding() { + return null; + } + } + + public static class FakejsonwithcharsetPostRequestBody1 extends RequestBodySerializer { + public FakejsonwithcharsetPostRequestBody1() { + super( + Map.ofEntries( + new AbstractMap.SimpleEntry<>("application/json; charset=utf-8", new Applicationjsoncharsetutf8MediaType()) + ), + false + ); + } + + public SerializedRequestBody serialize(SealedRequestBody requestBody) throws NotImplementedException { + Applicationjsoncharsetutf8RequestBody requestBody0 = (Applicationjsoncharsetutf8RequestBody) requestBody; + return serialize(requestBody0.contentType(), requestBody0.body().getData()); + } + } + + public sealed interface SealedRequestBody permits Applicationjsoncharsetutf8RequestBody {} + public record Applicationjsoncharsetutf8RequestBody(Applicationjsoncharsetutf8Schema.AnyTypeJsonSchema1Boxed body) implements SealedRequestBody, GenericRequestBody { + @Override + public String contentType() { + return "application/json; charset=utf-8"; + } + } +} diff --git a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/fakejsonwithcharset/post/FakejsonwithcharsetPostResponses.kt b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/fakejsonwithcharset/post/FakejsonwithcharsetPostResponses.kt new file mode 100644 index 00000000000..64c157fdca5 --- /dev/null +++ b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/fakejsonwithcharset/post/FakejsonwithcharsetPostResponses.kt @@ -0,0 +1,53 @@ +package org.openapijsonschematools.client.paths.fakejsonwithcharset.post; + +import org.openapijsonschematools.client.paths.fakejsonwithcharset.post.responses.FakejsonwithcharsetPostCode200Response; +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; +import org.checkerframework.checker.nullness.qual.Nullable; + +import java.net.http.HttpResponse; +import java.util.Map; +import java.util.AbstractMap; + +public class FakejsonwithcharsetPostResponses { + public sealed interface EndpointResponse permits EndpointFakejsonwithcharsetPostCode200Response {} + + public record EndpointFakejsonwithcharsetPostCode200Response( + HttpResponse response, + FakejsonwithcharsetPostCode200Response.SealedResponseBody body, + Nothing? headers + ) implements EndpointResponse, ApiResponse{ + } + + public sealed interface StatusCodeResponseDeserializer permits StatusFakejsonwithcharsetPostCode200ResponseDeserializer {} + + public static final class StatusFakejsonwithcharsetPostCode200ResponseDeserializer extends FakejsonwithcharsetPostCode200Response.FakejsonwithcharsetPostCode200Response1 implements StatusCodeResponseDeserializer { + } + + public static final class FakejsonwithcharsetPostResponses1 implements ResponsesDeserializer { + private final Map statusCodeToResponseDeserializer; + public FakejsonwithcharsetPostResponses1() { + this.statusCodeToResponseDeserializer = Map.ofEntries( + new AbstractMap.SimpleEntry<>("200", new StatusFakejsonwithcharsetPostCode200ResponseDeserializer()) + ); + } + + 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) { + throw new ApiException( + "Invalid response statusCode="+statusCode+" has no response defined in the openapi document", + response + ); + } + StatusFakejsonwithcharsetPostCode200ResponseDeserializer castDeserializer = (StatusFakejsonwithcharsetPostCode200ResponseDeserializer) statusCodeDeserializer; + var deserializedResponse = castDeserializer.deserialize(response, configuration); + return new EndpointFakejsonwithcharsetPostCode200Response(response, deserializedResponse.body(), deserializedResponse.headers()); + } + } +} diff --git a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/fakejsonwithcharset/post/requestbody/content/applicationjsoncharsetutf8/Applicationjsoncharsetutf8Schema.kt b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/fakejsonwithcharset/post/requestbody/content/applicationjsoncharsetutf8/Applicationjsoncharsetutf8Schema.kt new file mode 100644 index 00000000000..86ea755b112 --- /dev/null +++ b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/fakejsonwithcharset/post/requestbody/content/applicationjsoncharsetutf8/Applicationjsoncharsetutf8Schema.kt @@ -0,0 +1,19 @@ +package org.openapijsonschematools.client.paths.fakejsonwithcharset.post.requestbody.content.applicationjsoncharsetutf8; +import org.checkerframework.checker.nullness.qual.Nullable; +import org.openapijsonschematools.client.schemas.AnyTypeJsonSchema; + +public class Applicationjsoncharsetutf8Schema extends AnyTypeJsonSchema { + // nest classes so all schemas and input/output classes can be public + + + public static class Applicationjsoncharsetutf8Schema1 extends AnyTypeJsonSchema.AnyTypeJsonSchema1 { + private static @Nullable Applicationjsoncharsetutf8Schema1 instance = null; + public static Applicationjsoncharsetutf8Schema1 getInstance() { + if (instance == null) { + instance = new Applicationjsoncharsetutf8Schema1(); + } + return instance; + } + } + +} diff --git a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/fakejsonwithcharset/post/responses/FakejsonwithcharsetPostCode200Response.kt b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/fakejsonwithcharset/post/responses/FakejsonwithcharsetPostCode200Response.kt new file mode 100644 index 00000000000..66ecf567a5a --- /dev/null +++ b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/fakejsonwithcharset/post/responses/FakejsonwithcharsetPostCode200Response.kt @@ -0,0 +1,63 @@ +package org.openapijsonschematools.client.paths.fakejsonwithcharset.post.responses; + +import org.openapijsonschematools.client.configurations.SchemaConfiguration; +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; + +import java.util.AbstractMap; +import java.util.Map; +import java.net.http.HttpResponse; +import java.net.http.HttpHeaders; + +public class FakejsonwithcharsetPostCode200Response { + public sealed interface SealedMediaType permits Applicationjsoncharsetutf8MediaType {} + + public record Applicationjsoncharsetutf8MediaType(Applicationjsoncharsetutf8Schema.Applicationjsoncharsetutf8Schema1 schema) implements SealedMediaType, MediaType { + public Applicationjsoncharsetutf8MediaType() { + this(Applicationjsoncharsetutf8Schema.Applicationjsoncharsetutf8Schema1.getInstance()); + } + @Override + public Nothing? encoding() { + return null; + } + } + public sealed interface SealedResponseBody permits Applicationjsoncharsetutf8ResponseBody {} + public record Applicationjsoncharsetutf8ResponseBody(Applicationjsoncharsetutf8Schema.AnyTypeJsonSchema1Boxed body) implements SealedResponseBody { } + + public static class FakejsonwithcharsetPostCode200Response1 extends ResponseDeserializer { + public FakejsonwithcharsetPostCode200Response1() { + super( + Map.ofEntries( + new AbstractMap.SimpleEntry<>("application/json; charset=utf-8", new Applicationjsoncharsetutf8MediaType()) + ) + ); + } + + @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); + } + + @Override + protected Nothing? getHeaders(HttpHeaders headers, SchemaConfiguration configuration) { + return null; + } + } + + @SuppressWarnings("serial") + public static class ResponseApiException extends ApiException { + public DeserializedHttpResponse deserializedResponse; + + public ResponseApiException(String s, HttpResponse response, DeserializedHttpResponse deserializedResponse) { + super(s, response); + this.deserializedResponse = deserializedResponse; + } + } +} diff --git a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/fakejsonwithcharset/post/responses/code200response/content/applicationjsoncharsetutf8/Applicationjsoncharsetutf8Schema.kt b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/fakejsonwithcharset/post/responses/code200response/content/applicationjsoncharsetutf8/Applicationjsoncharsetutf8Schema.kt new file mode 100644 index 00000000000..8e4d5dbf902 --- /dev/null +++ b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/fakejsonwithcharset/post/responses/code200response/content/applicationjsoncharsetutf8/Applicationjsoncharsetutf8Schema.kt @@ -0,0 +1,19 @@ +package org.openapijsonschematools.client.paths.fakejsonwithcharset.post.responses.code200response.content.applicationjsoncharsetutf8; +import org.checkerframework.checker.nullness.qual.Nullable; +import org.openapijsonschematools.client.schemas.AnyTypeJsonSchema; + +public class Applicationjsoncharsetutf8Schema extends AnyTypeJsonSchema { + // nest classes so all schemas and input/output classes can be public + + + public static class Applicationjsoncharsetutf8Schema1 extends AnyTypeJsonSchema.AnyTypeJsonSchema1 { + private static @Nullable Applicationjsoncharsetutf8Schema1 instance = null; + public static Applicationjsoncharsetutf8Schema1 getInstance() { + if (instance == null) { + instance = new Applicationjsoncharsetutf8Schema1(); + } + return instance; + } + } + +} diff --git a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/fakemultiplerequestbodycontenttypes/FakemultiplerequestbodycontenttypesPost.kt b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/fakemultiplerequestbodycontenttypes/FakemultiplerequestbodycontenttypesPost.kt new file mode 100644 index 00000000000..585ea8c5680 --- /dev/null +++ b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/fakemultiplerequestbodycontenttypes/FakemultiplerequestbodycontenttypesPost.kt @@ -0,0 +1,152 @@ +package org.openapijsonschematools.client.paths.fakemultiplerequestbodycontenttypes; + +import org.checkerframework.checker.nullness.qual.Nullable; +import org.openapijsonschematools.client.paths.fakemultiplerequestbodycontenttypes.post.FakemultiplerequestbodycontenttypesPostRequestBody; +import org.openapijsonschematools.client.RootServerInfo; +import org.openapijsonschematools.client.paths.fakemultiplerequestbodycontenttypes.post.FakemultiplerequestbodycontenttypesPostResponses; +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.requestbody.SerializedRequestBody; +import org.openapijsonschematools.client.paths.Fakemultiplerequestbodycontenttypes; + +import java.io.IOException; +import java.util.ArrayList; +import java.net.http.HttpClient; +import java.net.http.HttpRequest; +import java.time.Duration; +import java.util.List; +import java.util.Map; + +public class FakemultiplerequestbodycontenttypesPost { + private static class PostProvider { + private static final String method = "post"; + + public static FakemultiplerequestbodycontenttypesPostResponses.EndpointResponse post( + PostRequest request, + ApiConfiguration apiConfiguration, + SchemaConfiguration schemaConfiguration, + HttpClient client + ) throws IOException, InterruptedException, ValidationException, NotImplementedException, ApiException { + Map> headers = apiConfiguration.getDefaultHeaders(); + + @Nullable SerializedRequestBody serializedRequestBody; + HttpRequest.BodyPublisher bodyPublisher = HttpRequest.BodyPublishers.noBody(); + if (request.requestBody != null) { + serializedRequestBody = new FakemultiplerequestbodycontenttypesPostRequestBody.FakemultiplerequestbodycontenttypesPostRequestBody1().serialize( + request.requestBody + ); + var contentTypeHeaderValues = headers.getOrDefault("Content-Type", new ArrayList<>()); + contentTypeHeaderValues.add(serializedRequestBody.contentType); + bodyPublisher = serializedRequestBody.bodyPublisher; + } + // TODO set this to a map if there is a query security scheme + @Nullable Map queryMap = null; + String host = apiConfiguration.getServer(request.serverIndex).url(); + + String url = host + Fakemultiplerequestbodycontenttypes.path; + var httpRequest = RestClient.getRequest( + url, + method, + bodyPublisher, + headers, + request.timeout + ); + var response = RestClient.getResponse(httpRequest, client); + var responsesDeserializer = new FakemultiplerequestbodycontenttypesPostResponses.FakemultiplerequestbodycontenttypesPostResponses1(); + return responsesDeserializer.deserialize(response, schemaConfiguration); + } + } + + public interface PostOperation { + ApiConfiguration getApiConfiguration(); + SchemaConfiguration getSchemaConfiguration(); + HttpClient getClient(); + default FakemultiplerequestbodycontenttypesPostResponses.EndpointResponse post(PostRequest request) throws IOException, InterruptedException, ValidationException, NotImplementedException, ApiException { + return PostProvider.post(request, getApiConfiguration(), getSchemaConfiguration(), getClient()); + } + } + + public interface MultipleRequestBodyContentTypesOperation { + ApiConfiguration getApiConfiguration(); + SchemaConfiguration getSchemaConfiguration(); + HttpClient getClient(); + default FakemultiplerequestbodycontenttypesPostResponses.EndpointResponse multipleRequestBodyContentTypes(PostRequest request) throws IOException, InterruptedException, ValidationException, NotImplementedException, ApiException { + return PostProvider.post(request, getApiConfiguration(), getSchemaConfiguration(), getClient()); + } + } + + public static class Post extends ApiClient implements PostOperation { + public Post(ApiConfiguration apiConfiguration, SchemaConfiguration schemaConfiguration) { + super(apiConfiguration, schemaConfiguration); + } + } + + public static class PostRequest { + public FakemultiplerequestbodycontenttypesPostRequestBody.@Nullable SealedRequestBody requestBody; + public RootServerInfo.@Nullable ServerIndex serverIndex; + public @Nullable Duration timeout; + } + + public interface SetterForRequestBody { + PostRequest getInstance(); + T getBuilderAfterRequestBody(PostRequest instance); + default T requestBody(FakemultiplerequestbodycontenttypesPostRequestBody.SealedRequestBody requestBody) { + var instance = getInstance(); + instance.requestBody = requestBody; + return getBuilderAfterRequestBody(instance); + } + } + + public interface SetterForServerIndex { + PostRequest getInstance(); + T getBuilderAfterServerIndex(PostRequest instance); + default T serverIndex(RootServerInfo.ServerIndex serverIndex) { + var instance = getInstance(); + instance.serverIndex = serverIndex; + return getBuilderAfterServerIndex(instance); + } + } + + public interface SetterForTimeout { + PostRequest getInstance(); + T getBuilderAfterTimeout(PostRequest instance); + default T timeout(Duration timeout) { + var instance = getInstance(); + instance.timeout = timeout; + return getBuilderAfterTimeout(instance); + } + } + + public static class PostRequestBuilder implements SetterForRequestBody, SetterForServerIndex, SetterForTimeout { + private final PostRequest instance; + + public PostRequestBuilder() { + this.instance = new PostRequest(); + } + + public PostRequest build() { + return instance; + } + + public PostRequest getInstance() { + return instance; + } + + public PostRequestBuilder getBuilderAfterRequestBody(PostRequest instance) { + return this; + } + + public PostRequestBuilder getBuilderAfterServerIndex(PostRequest instance) { + return this; + } + + public PostRequestBuilder getBuilderAfterTimeout(PostRequest instance) { + return this; + } + } +} diff --git a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/fakemultiplerequestbodycontenttypes/post/FakemultiplerequestbodycontenttypesPostRequestBody.kt b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/fakemultiplerequestbodycontenttypes/post/FakemultiplerequestbodycontenttypesPostRequestBody.kt new file mode 100644 index 00000000000..361d2de4a7d --- /dev/null +++ b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/fakemultiplerequestbodycontenttypes/post/FakemultiplerequestbodycontenttypesPostRequestBody.kt @@ -0,0 +1,71 @@ +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; +import org.openapijsonschematools.client.mediatype.MediaType; +import org.openapijsonschematools.client.paths.fakemultiplerequestbodycontenttypes.post.requestbody.content.applicationjson.ApplicationjsonSchema; +import org.openapijsonschematools.client.paths.fakemultiplerequestbodycontenttypes.post.requestbody.content.multipartformdata.MultipartformdataSchema; + +import java.util.AbstractMap; +import java.util.Map; + +public class FakemultiplerequestbodycontenttypesPostRequestBody { + public sealed interface SealedMediaType permits ApplicationjsonMediaType, MultipartformdataMediaType {} + + public record ApplicationjsonMediaType(ApplicationjsonSchema.ApplicationjsonSchema1 schema) implements SealedMediaType, MediaType { + public ApplicationjsonMediaType() { + this(ApplicationjsonSchema.ApplicationjsonSchema1.getInstance()); + } + @Override + public Nothing? encoding() { + return null; + } + } + + public record MultipartformdataMediaType(MultipartformdataSchema.MultipartformdataSchema1 schema) implements SealedMediaType, MediaType { + public MultipartformdataMediaType() { + this(MultipartformdataSchema.MultipartformdataSchema1.getInstance()); + } + @Override + public Nothing? encoding() { + return null; + } + } + + public static class FakemultiplerequestbodycontenttypesPostRequestBody1 extends RequestBodySerializer { + public FakemultiplerequestbodycontenttypesPostRequestBody1() { + super( + Map.ofEntries( + new AbstractMap.SimpleEntry<>("application/json", new ApplicationjsonMediaType()), + new AbstractMap.SimpleEntry<>("multipart/form-data", new MultipartformdataMediaType()) + ), + false + ); + } + + public SerializedRequestBody serialize(SealedRequestBody requestBody) throws NotImplementedException { + if (requestBody instanceof ApplicationjsonRequestBody requestBody0) { + return serialize(requestBody0.contentType(), requestBody0.body().getData()); + } else { + MultipartformdataRequestBody requestBody1 = (MultipartformdataRequestBody) requestBody; + return serialize(requestBody1.contentType(), requestBody1.body().getData()); + } + } + } + + public sealed interface SealedRequestBody permits ApplicationjsonRequestBody, MultipartformdataRequestBody {} + public record ApplicationjsonRequestBody(ApplicationjsonSchema.ApplicationjsonSchema1Boxed body) implements SealedRequestBody, GenericRequestBody { + @Override + public String contentType() { + return "application/json"; + } + } + public record MultipartformdataRequestBody(MultipartformdataSchema.MultipartformdataSchema1Boxed body) implements SealedRequestBody, GenericRequestBody { + @Override + public String contentType() { + return "multipart/form-data"; + } + } +} diff --git a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/fakemultiplerequestbodycontenttypes/post/FakemultiplerequestbodycontenttypesPostResponses.kt b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/fakemultiplerequestbodycontenttypes/post/FakemultiplerequestbodycontenttypesPostResponses.kt new file mode 100644 index 00000000000..9ec3bfac4a8 --- /dev/null +++ b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/fakemultiplerequestbodycontenttypes/post/FakemultiplerequestbodycontenttypesPostResponses.kt @@ -0,0 +1,53 @@ +package org.openapijsonschematools.client.paths.fakemultiplerequestbodycontenttypes.post; + +import org.openapijsonschematools.client.paths.fakemultiplerequestbodycontenttypes.post.responses.FakemultiplerequestbodycontenttypesPostCode200Response; +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; +import org.checkerframework.checker.nullness.qual.Nullable; + +import java.net.http.HttpResponse; +import java.util.Map; +import java.util.AbstractMap; + +public class FakemultiplerequestbodycontenttypesPostResponses { + public sealed interface EndpointResponse permits EndpointFakemultiplerequestbodycontenttypesPostCode200Response {} + + public record EndpointFakemultiplerequestbodycontenttypesPostCode200Response( + HttpResponse response, + FakemultiplerequestbodycontenttypesPostCode200Response.SealedResponseBody body, + Nothing? headers + ) implements EndpointResponse, ApiResponse{ + } + + public sealed interface StatusCodeResponseDeserializer permits StatusFakemultiplerequestbodycontenttypesPostCode200ResponseDeserializer {} + + public static final class StatusFakemultiplerequestbodycontenttypesPostCode200ResponseDeserializer extends FakemultiplerequestbodycontenttypesPostCode200Response.FakemultiplerequestbodycontenttypesPostCode200Response1 implements StatusCodeResponseDeserializer { + } + + public static final class FakemultiplerequestbodycontenttypesPostResponses1 implements ResponsesDeserializer { + private final Map statusCodeToResponseDeserializer; + public FakemultiplerequestbodycontenttypesPostResponses1() { + this.statusCodeToResponseDeserializer = Map.ofEntries( + new AbstractMap.SimpleEntry<>("200", new StatusFakemultiplerequestbodycontenttypesPostCode200ResponseDeserializer()) + ); + } + + 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) { + throw new ApiException( + "Invalid response statusCode="+statusCode+" has no response defined in the openapi document", + response + ); + } + StatusFakemultiplerequestbodycontenttypesPostCode200ResponseDeserializer castDeserializer = (StatusFakemultiplerequestbodycontenttypesPostCode200ResponseDeserializer) statusCodeDeserializer; + var deserializedResponse = castDeserializer.deserialize(response, configuration); + return new EndpointFakemultiplerequestbodycontenttypesPostCode200Response(response, deserializedResponse.body(), deserializedResponse.headers()); + } + } +} diff --git a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/fakemultiplerequestbodycontenttypes/post/requestbody/content/applicationjson/ApplicationjsonSchema.kt b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/fakemultiplerequestbodycontenttypes/post/requestbody/content/applicationjson/ApplicationjsonSchema.kt new file mode 100644 index 00000000000..40be39d7f2e --- /dev/null +++ b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/fakemultiplerequestbodycontenttypes/post/requestbody/content/applicationjson/ApplicationjsonSchema.kt @@ -0,0 +1,200 @@ +package org.openapijsonschematools.client.paths.fakemultiplerequestbodycontenttypes.post.requestbody.content.applicationjson; +import java.util.ArrayList; +import java.util.HashSet; +import java.util.LinkedHashMap; +import java.util.LinkedHashSet; +import java.util.List; +import java.util.Map; +import java.util.Objects; +import java.util.Set; +import org.checkerframework.checker.nullness.qual.Nullable; +import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags; +import org.openapijsonschematools.client.configurations.SchemaConfiguration; +import org.openapijsonschematools.client.exceptions.InvalidAdditionalPropertyException; +import org.openapijsonschematools.client.exceptions.UnsetPropertyException; +import org.openapijsonschematools.client.exceptions.ValidationException; +import org.openapijsonschematools.client.schemas.GenericBuilder; +import org.openapijsonschematools.client.schemas.StringJsonSchema; +import org.openapijsonschematools.client.schemas.UnsetAddPropsSetter; +import org.openapijsonschematools.client.schemas.validation.FrozenMap; +import org.openapijsonschematools.client.schemas.validation.JsonSchema; +import org.openapijsonschematools.client.schemas.validation.JsonSchemaInfo; +import org.openapijsonschematools.client.schemas.validation.MapSchemaValidator; +import org.openapijsonschematools.client.schemas.validation.PathToSchemasMap; +import org.openapijsonschematools.client.schemas.validation.PropertyEntry; +import org.openapijsonschematools.client.schemas.validation.ValidationMetadata; + +public class ApplicationjsonSchema { + // nest classes so all schemas and input/output classes can be public + + + public static class ApplicationjsonA extends StringJsonSchema.StringJsonSchema1 { + private static @Nullable ApplicationjsonA instance = null; + public static ApplicationjsonA getInstance() { + if (instance == null) { + instance = new ApplicationjsonA(); + } + return instance; + } + } + + + public static class ApplicationjsonSchemaMap extends FrozenMap<@Nullable Object> { + protected ApplicationjsonSchemaMap(FrozenMap<@Nullable Object> m) { + super(m); + } + public static final Set requiredKeys = Set.of(); + public static final Set optionalKeys = Set.of( + "a" + ); + public static ApplicationjsonSchemaMap of(Map arg, SchemaConfiguration configuration) throws ValidationException { + return ApplicationjsonSchema1.getInstance().validate(arg, configuration); + } + + public String a() throws UnsetPropertyException { + String key = "a"; + throwIfKeyNotPresent(key); + @Nullable Object value = get(key); + if (!(value instanceof String)) { + throw new RuntimeException("Invalid value stored for a"); + } + return (String) value; + } + + public @Nullable Object getAdditionalProperty(String name) throws UnsetPropertyException, InvalidAdditionalPropertyException { + throwIfKeyKnown(name, requiredKeys, optionalKeys); + throwIfKeyNotPresent(name); + return get(name); + } + } + + public interface SetterForApplicationjsonA { + Map getInstance(); + T getBuilderAfterApplicationjsonA(Map instance); + + default T a(String value) { + var instance = getInstance(); + instance.put("a", value); + return getBuilderAfterApplicationjsonA(instance); + } + } + + public static class ApplicationjsonSchemaMapBuilder extends UnsetAddPropsSetter implements GenericBuilder>, SetterForApplicationjsonA { + private final Map instance; + private static final Set knownKeys = Set.of( + "a" + ); + public Set getKnownKeys() { + return knownKeys; + } + public ApplicationjsonSchemaMapBuilder() { + this.instance = new LinkedHashMap<>(); + } + public Map build() { + return instance; + } + public Map getInstance() { + return instance; + } + public ApplicationjsonSchemaMapBuilder getBuilderAfterApplicationjsonA(Map instance) { + return this; + } + public ApplicationjsonSchemaMapBuilder getBuilderAfterAdditionalProperty(Map instance) { + return this; + } + } + + + public sealed interface ApplicationjsonSchema1Boxed permits ApplicationjsonSchema1BoxedMap { + @Nullable Object getData(); + } + + public record ApplicationjsonSchema1BoxedMap(ApplicationjsonSchemaMap data) implements ApplicationjsonSchema1Boxed { + @Override + public @Nullable Object getData() { + return data; + } + } + + + public static class ApplicationjsonSchema1 extends JsonSchema implements MapSchemaValidator { + private static @Nullable ApplicationjsonSchema1 instance = null; + + protected ApplicationjsonSchema1() { + super(new JsonSchemaInfo() + .type(Set.of(Map.class)) + .properties(Map.ofEntries( + new PropertyEntry("a", ApplicationjsonA.class) + )) + ); + } + + public static ApplicationjsonSchema1 getInstance() { + if (instance == null) { + instance = new ApplicationjsonSchema1(); + } + return instance; + } + + 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 RuntimeException("Invalid non-string key value"); + } + String propertyName = (String) entryKey; + List propertyPathToItem = new ArrayList<>(pathToItem); + propertyPathToItem.add(propertyName); + Object value = entry.getValue(); + LinkedHashMap, Nothing?> schemas = pathToSchemas.get(propertyPathToItem); + if (schemas == null) { + throw new RuntimeException("Validation result is invalid, schemas must exist for a pathToItem"); + } + JsonSchema propertySchema = schemas.entrySet().iterator().next().getKey(); + @Nullable Object propertyInstance = propertySchema.getNewInstance(value, propertyPathToItem, pathToSchemas); + properties.put(propertyName, propertyInstance); + } + FrozenMap<@Nullable Object> castProperties = new FrozenMap<>(properties); + return new ApplicationjsonSchemaMap(castProperties); + } + + 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); + SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().build())); + ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, new PathToSchemasMap(), new LinkedHashSet<>()); + PathToSchemasMap pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet); + return getNewInstance(castArg, validationMetadata.pathToItem(), pathToSchemasMap); + } + + + @Override + public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws 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"); + } + @Override + public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { + if (arg instanceof Map) { + return getNewInstance((Map) arg, pathToItem, pathToSchemas); + } + 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 { + return new ApplicationjsonSchema1BoxedMap(validate(arg, configuration)); + } + @Override + public ApplicationjsonSchema1Boxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { + 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"); + } + } + +} diff --git a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/fakemultiplerequestbodycontenttypes/post/requestbody/content/multipartformdata/MultipartformdataSchema.kt b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/fakemultiplerequestbodycontenttypes/post/requestbody/content/multipartformdata/MultipartformdataSchema.kt new file mode 100644 index 00000000000..47d56affb46 --- /dev/null +++ b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/fakemultiplerequestbodycontenttypes/post/requestbody/content/multipartformdata/MultipartformdataSchema.kt @@ -0,0 +1,200 @@ +package org.openapijsonschematools.client.paths.fakemultiplerequestbodycontenttypes.post.requestbody.content.multipartformdata; +import java.util.ArrayList; +import java.util.HashSet; +import java.util.LinkedHashMap; +import java.util.LinkedHashSet; +import java.util.List; +import java.util.Map; +import java.util.Objects; +import java.util.Set; +import org.checkerframework.checker.nullness.qual.Nullable; +import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags; +import org.openapijsonschematools.client.configurations.SchemaConfiguration; +import org.openapijsonschematools.client.exceptions.InvalidAdditionalPropertyException; +import org.openapijsonschematools.client.exceptions.UnsetPropertyException; +import org.openapijsonschematools.client.exceptions.ValidationException; +import org.openapijsonschematools.client.schemas.GenericBuilder; +import org.openapijsonschematools.client.schemas.StringJsonSchema; +import org.openapijsonschematools.client.schemas.UnsetAddPropsSetter; +import org.openapijsonschematools.client.schemas.validation.FrozenMap; +import org.openapijsonschematools.client.schemas.validation.JsonSchema; +import org.openapijsonschematools.client.schemas.validation.JsonSchemaInfo; +import org.openapijsonschematools.client.schemas.validation.MapSchemaValidator; +import org.openapijsonschematools.client.schemas.validation.PathToSchemasMap; +import org.openapijsonschematools.client.schemas.validation.PropertyEntry; +import org.openapijsonschematools.client.schemas.validation.ValidationMetadata; + +public class MultipartformdataSchema { + // nest classes so all schemas and input/output classes can be public + + + public static class MultipartformdataB extends StringJsonSchema.StringJsonSchema1 { + private static @Nullable MultipartformdataB instance = null; + public static MultipartformdataB getInstance() { + if (instance == null) { + instance = new MultipartformdataB(); + } + return instance; + } + } + + + public static class MultipartformdataSchemaMap extends FrozenMap<@Nullable Object> { + protected MultipartformdataSchemaMap(FrozenMap<@Nullable Object> m) { + super(m); + } + public static final Set requiredKeys = Set.of(); + public static final Set optionalKeys = Set.of( + "b" + ); + public static MultipartformdataSchemaMap of(Map arg, SchemaConfiguration configuration) throws ValidationException { + return MultipartformdataSchema1.getInstance().validate(arg, configuration); + } + + public String b() throws UnsetPropertyException { + String key = "b"; + throwIfKeyNotPresent(key); + @Nullable Object value = get(key); + if (!(value instanceof String)) { + throw new RuntimeException("Invalid value stored for b"); + } + return (String) value; + } + + public @Nullable Object getAdditionalProperty(String name) throws UnsetPropertyException, InvalidAdditionalPropertyException { + throwIfKeyKnown(name, requiredKeys, optionalKeys); + throwIfKeyNotPresent(name); + return get(name); + } + } + + public interface SetterForMultipartformdataB { + Map getInstance(); + T getBuilderAfterMultipartformdataB(Map instance); + + default T b(String value) { + var instance = getInstance(); + instance.put("b", value); + return getBuilderAfterMultipartformdataB(instance); + } + } + + public static class MultipartformdataSchemaMapBuilder extends UnsetAddPropsSetter implements GenericBuilder>, SetterForMultipartformdataB { + private final Map instance; + private static final Set knownKeys = Set.of( + "b" + ); + public Set getKnownKeys() { + return knownKeys; + } + public MultipartformdataSchemaMapBuilder() { + this.instance = new LinkedHashMap<>(); + } + public Map build() { + return instance; + } + public Map getInstance() { + return instance; + } + public MultipartformdataSchemaMapBuilder getBuilderAfterMultipartformdataB(Map instance) { + return this; + } + public MultipartformdataSchemaMapBuilder getBuilderAfterAdditionalProperty(Map instance) { + return this; + } + } + + + public sealed interface MultipartformdataSchema1Boxed permits MultipartformdataSchema1BoxedMap { + @Nullable Object getData(); + } + + public record MultipartformdataSchema1BoxedMap(MultipartformdataSchemaMap data) implements MultipartformdataSchema1Boxed { + @Override + public @Nullable Object getData() { + return data; + } + } + + + public static class MultipartformdataSchema1 extends JsonSchema implements MapSchemaValidator { + private static @Nullable MultipartformdataSchema1 instance = null; + + protected MultipartformdataSchema1() { + super(new JsonSchemaInfo() + .type(Set.of(Map.class)) + .properties(Map.ofEntries( + new PropertyEntry("b", MultipartformdataB.class) + )) + ); + } + + public static MultipartformdataSchema1 getInstance() { + if (instance == null) { + instance = new MultipartformdataSchema1(); + } + return instance; + } + + 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 RuntimeException("Invalid non-string key value"); + } + String propertyName = (String) entryKey; + List propertyPathToItem = new ArrayList<>(pathToItem); + propertyPathToItem.add(propertyName); + Object value = entry.getValue(); + LinkedHashMap, Nothing?> schemas = pathToSchemas.get(propertyPathToItem); + if (schemas == null) { + throw new RuntimeException("Validation result is invalid, schemas must exist for a pathToItem"); + } + JsonSchema propertySchema = schemas.entrySet().iterator().next().getKey(); + @Nullable Object propertyInstance = propertySchema.getNewInstance(value, propertyPathToItem, pathToSchemas); + properties.put(propertyName, propertyInstance); + } + FrozenMap<@Nullable Object> castProperties = new FrozenMap<>(properties); + return new MultipartformdataSchemaMap(castProperties); + } + + 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); + SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().build())); + ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, new PathToSchemasMap(), new LinkedHashSet<>()); + PathToSchemasMap pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet); + return getNewInstance(castArg, validationMetadata.pathToItem(), pathToSchemasMap); + } + + + @Override + public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws 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"); + } + @Override + public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { + if (arg instanceof Map) { + return getNewInstance((Map) arg, pathToItem, pathToSchemas); + } + 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 { + return new MultipartformdataSchema1BoxedMap(validate(arg, configuration)); + } + @Override + public MultipartformdataSchema1Boxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { + 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"); + } + } + +} diff --git a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/fakemultiplerequestbodycontenttypes/post/responses/FakemultiplerequestbodycontenttypesPostCode200Response.kt b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/fakemultiplerequestbodycontenttypes/post/responses/FakemultiplerequestbodycontenttypesPostCode200Response.kt new file mode 100644 index 00000000000..1a1eabf4bfd --- /dev/null +++ b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/fakemultiplerequestbodycontenttypes/post/responses/FakemultiplerequestbodycontenttypesPostCode200Response.kt @@ -0,0 +1,63 @@ +package org.openapijsonschematools.client.paths.fakemultiplerequestbodycontenttypes.post.responses; + +import org.openapijsonschematools.client.configurations.SchemaConfiguration; +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; + +import java.util.AbstractMap; +import java.util.Map; +import java.net.http.HttpResponse; +import java.net.http.HttpHeaders; + +public class FakemultiplerequestbodycontenttypesPostCode200Response { + public sealed interface SealedMediaType permits ApplicationjsonMediaType {} + + public record ApplicationjsonMediaType(ApplicationjsonSchema.ApplicationjsonSchema1 schema) implements SealedMediaType, MediaType { + public ApplicationjsonMediaType() { + this(ApplicationjsonSchema.ApplicationjsonSchema1.getInstance()); + } + @Override + public Nothing? encoding() { + return null; + } + } + public sealed interface SealedResponseBody permits ApplicationjsonResponseBody {} + public record ApplicationjsonResponseBody(ApplicationjsonSchema.AnyTypeJsonSchema1Boxed body) implements SealedResponseBody { } + + public static class FakemultiplerequestbodycontenttypesPostCode200Response1 extends ResponseDeserializer { + public FakemultiplerequestbodycontenttypesPostCode200Response1() { + super( + Map.ofEntries( + new AbstractMap.SimpleEntry<>("application/json", new ApplicationjsonMediaType()) + ) + ); + } + + @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); + } + + @Override + protected Nothing? getHeaders(HttpHeaders headers, SchemaConfiguration configuration) { + return null; + } + } + + @SuppressWarnings("serial") + public static class ResponseApiException extends ApiException { + public DeserializedHttpResponse deserializedResponse; + + public ResponseApiException(String s, HttpResponse response, DeserializedHttpResponse deserializedResponse) { + super(s, response); + this.deserializedResponse = deserializedResponse; + } + } +} diff --git a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/fakemultiplerequestbodycontenttypes/post/responses/code200response/content/applicationjson/ApplicationjsonSchema.kt b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/fakemultiplerequestbodycontenttypes/post/responses/code200response/content/applicationjson/ApplicationjsonSchema.kt new file mode 100644 index 00000000000..68f600e23d6 --- /dev/null +++ b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/fakemultiplerequestbodycontenttypes/post/responses/code200response/content/applicationjson/ApplicationjsonSchema.kt @@ -0,0 +1,19 @@ +package org.openapijsonschematools.client.paths.fakemultiplerequestbodycontenttypes.post.responses.code200response.content.applicationjson; +import org.checkerframework.checker.nullness.qual.Nullable; +import org.openapijsonschematools.client.schemas.AnyTypeJsonSchema; + +public class ApplicationjsonSchema extends AnyTypeJsonSchema { + // nest classes so all schemas and input/output classes can be public + + + public static class ApplicationjsonSchema1 extends AnyTypeJsonSchema.AnyTypeJsonSchema1 { + private static @Nullable ApplicationjsonSchema1 instance = null; + public static ApplicationjsonSchema1 getInstance() { + if (instance == null) { + instance = new ApplicationjsonSchema1(); + } + return instance; + } + } + +} diff --git a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/fakemultipleresponsebodies/FakemultipleresponsebodiesGet.kt b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/fakemultipleresponsebodies/FakemultipleresponsebodiesGet.kt new file mode 100644 index 00000000000..78be3b0ebe6 --- /dev/null +++ b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/fakemultipleresponsebodies/FakemultipleresponsebodiesGet.kt @@ -0,0 +1,124 @@ +package org.openapijsonschematools.client.paths.fakemultipleresponsebodies; + +import org.checkerframework.checker.nullness.qual.Nullable; +import org.openapijsonschematools.client.RootServerInfo; +import org.openapijsonschematools.client.paths.fakemultipleresponsebodies.get.FakemultipleresponsebodiesGetResponses; +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.paths.Fakemultipleresponsebodies; + +import java.io.IOException; +import java.net.http.HttpClient; +import java.net.http.HttpRequest; +import java.time.Duration; +import java.util.List; +import java.util.Map; + +public class FakemultipleresponsebodiesGet { + private static class GetProvider { + private static final String method = "get"; + + public static FakemultipleresponsebodiesGetResponses.EndpointResponse get( + GetRequest request, + ApiConfiguration apiConfiguration, + SchemaConfiguration schemaConfiguration, + HttpClient client + ) 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 + @Nullable Map queryMap = null; + String host = apiConfiguration.getServer(request.serverIndex).url(); + + String url = host + Fakemultipleresponsebodies.path; + var httpRequest = RestClient.getRequest( + url, + method, + bodyPublisher, + headers, + request.timeout + ); + var response = RestClient.getResponse(httpRequest, client); + var responsesDeserializer = new FakemultipleresponsebodiesGetResponses.FakemultipleresponsebodiesGetResponses1(); + return responsesDeserializer.deserialize(response, schemaConfiguration); + } + } + + public interface GetOperation { + ApiConfiguration getApiConfiguration(); + SchemaConfiguration getSchemaConfiguration(); + HttpClient getClient(); + default FakemultipleresponsebodiesGetResponses.EndpointResponse get(GetRequest request) throws IOException, InterruptedException, ValidationException, NotImplementedException, ApiException { + return GetProvider.get(request, getApiConfiguration(), getSchemaConfiguration(), getClient()); + } + } + + public interface MultipleResponseBodiesOperation { + ApiConfiguration getApiConfiguration(); + SchemaConfiguration getSchemaConfiguration(); + HttpClient getClient(); + default FakemultipleresponsebodiesGetResponses.EndpointResponse multipleResponseBodies(GetRequest request) throws IOException, InterruptedException, ValidationException, NotImplementedException, ApiException { + return GetProvider.get(request, getApiConfiguration(), getSchemaConfiguration(), getClient()); + } + } + + public static class Get extends ApiClient implements GetOperation { + public Get(ApiConfiguration apiConfiguration, SchemaConfiguration schemaConfiguration) { + super(apiConfiguration, schemaConfiguration); + } + } + + public static class GetRequest { + public RootServerInfo.@Nullable ServerIndex serverIndex; + public @Nullable Duration timeout; + } + + public interface SetterForServerIndex { + GetRequest getInstance(); + T getBuilderAfterServerIndex(GetRequest instance); + default T serverIndex(RootServerInfo.ServerIndex serverIndex) { + var instance = getInstance(); + instance.serverIndex = serverIndex; + return getBuilderAfterServerIndex(instance); + } + } + + public interface SetterForTimeout { + GetRequest getInstance(); + T getBuilderAfterTimeout(GetRequest instance); + default T timeout(Duration timeout) { + var instance = getInstance(); + instance.timeout = timeout; + return getBuilderAfterTimeout(instance); + } + } + + public static class GetRequestBuilder implements SetterForServerIndex, SetterForTimeout { + private final GetRequest instance; + + public GetRequestBuilder() { + this.instance = new GetRequest(); + } + + public GetRequest build() { + return instance; + } + + public GetRequest getInstance() { + return instance; + } + + public GetRequestBuilder getBuilderAfterServerIndex(GetRequest instance) { + return this; + } + + public GetRequestBuilder getBuilderAfterTimeout(GetRequest instance) { + return this; + } + } +} diff --git a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/fakemultipleresponsebodies/get/FakemultipleresponsebodiesGetResponses.kt b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/fakemultipleresponsebodies/get/FakemultipleresponsebodiesGetResponses.kt new file mode 100644 index 00000000000..b6cf2e60c46 --- /dev/null +++ b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/fakemultipleresponsebodies/get/FakemultipleresponsebodiesGetResponses.kt @@ -0,0 +1,69 @@ +package org.openapijsonschematools.client.paths.fakemultipleresponsebodies.get; + +import org.openapijsonschematools.client.paths.fakemultipleresponsebodies.get.responses.FakemultipleresponsebodiesGetCode200Response; +import org.openapijsonschematools.client.paths.fakemultipleresponsebodies.get.responses.FakemultipleresponsebodiesGetCode202Response; +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; +import org.checkerframework.checker.nullness.qual.Nullable; + +import java.net.http.HttpResponse; +import java.util.Map; +import java.util.AbstractMap; + +public class FakemultipleresponsebodiesGetResponses { + public sealed interface EndpointResponse permits EndpointFakemultipleresponsebodiesGetCode200Response, EndpointFakemultipleresponsebodiesGetCode202Response {} + + public record EndpointFakemultipleresponsebodiesGetCode200Response( + HttpResponse response, + FakemultipleresponsebodiesGetCode200Response.SealedResponseBody body, + Nothing? headers + ) implements EndpointResponse, ApiResponse{ + } + + public record EndpointFakemultipleresponsebodiesGetCode202Response( + HttpResponse response, + FakemultipleresponsebodiesGetCode202Response.SealedResponseBody body, + Nothing? headers + ) implements EndpointResponse, ApiResponse{ + } + + public sealed interface StatusCodeResponseDeserializer permits StatusFakemultipleresponsebodiesGetCode200ResponseDeserializer, StatusFakemultipleresponsebodiesGetCode202ResponseDeserializer {} + + public static final class StatusFakemultipleresponsebodiesGetCode200ResponseDeserializer extends FakemultipleresponsebodiesGetCode200Response.FakemultipleresponsebodiesGetCode200Response1 implements StatusCodeResponseDeserializer { + } + public static final class StatusFakemultipleresponsebodiesGetCode202ResponseDeserializer extends FakemultipleresponsebodiesGetCode202Response.FakemultipleresponsebodiesGetCode202Response1 implements StatusCodeResponseDeserializer { + } + + public static final class FakemultipleresponsebodiesGetResponses1 implements ResponsesDeserializer { + private final Map statusCodeToResponseDeserializer; + public FakemultipleresponsebodiesGetResponses1() { + this.statusCodeToResponseDeserializer = Map.ofEntries( + new AbstractMap.SimpleEntry<>("200", new StatusFakemultipleresponsebodiesGetCode200ResponseDeserializer()), + new AbstractMap.SimpleEntry<>("202", new StatusFakemultipleresponsebodiesGetCode202ResponseDeserializer()) + ); + } + + 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) { + throw new ApiException( + "Invalid response statusCode="+statusCode+" has no response defined in the openapi document", + response + ); + } + if (statusCodeDeserializer instanceof StatusFakemultipleresponsebodiesGetCode200ResponseDeserializer castDeserializer) { + var deserializedResponse = castDeserializer.deserialize(response, configuration); + return new EndpointFakemultipleresponsebodiesGetCode200Response(response, deserializedResponse.body(), deserializedResponse.headers()); + } else { + StatusFakemultipleresponsebodiesGetCode202ResponseDeserializer castDeserializer = (StatusFakemultipleresponsebodiesGetCode202ResponseDeserializer) statusCodeDeserializer; + var deserializedResponse = castDeserializer.deserialize(response, configuration); + return new EndpointFakemultipleresponsebodiesGetCode202Response(response, deserializedResponse.body(), deserializedResponse.headers()); + } + } + } +} diff --git a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/fakemultipleresponsebodies/get/responses/FakemultipleresponsebodiesGetCode200Response.kt b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/fakemultipleresponsebodies/get/responses/FakemultipleresponsebodiesGetCode200Response.kt new file mode 100644 index 00000000000..d519083c162 --- /dev/null +++ b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/fakemultipleresponsebodies/get/responses/FakemultipleresponsebodiesGetCode200Response.kt @@ -0,0 +1,63 @@ +package org.openapijsonschematools.client.paths.fakemultipleresponsebodies.get.responses; + +import org.openapijsonschematools.client.configurations.SchemaConfiguration; +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; + +import java.util.AbstractMap; +import java.util.Map; +import java.net.http.HttpResponse; +import java.net.http.HttpHeaders; + +public class FakemultipleresponsebodiesGetCode200Response { + public sealed interface SealedMediaType permits ApplicationjsonMediaType {} + + public record ApplicationjsonMediaType(ApplicationjsonSchema.ApplicationjsonSchema1 schema) implements SealedMediaType, MediaType { + public ApplicationjsonMediaType() { + this(ApplicationjsonSchema.ApplicationjsonSchema1.getInstance()); + } + @Override + public Nothing? encoding() { + return null; + } + } + public sealed interface SealedResponseBody permits ApplicationjsonResponseBody {} + public record ApplicationjsonResponseBody(ApplicationjsonSchema.AnyTypeJsonSchema1Boxed body) implements SealedResponseBody { } + + public static class FakemultipleresponsebodiesGetCode200Response1 extends ResponseDeserializer { + public FakemultipleresponsebodiesGetCode200Response1() { + super( + Map.ofEntries( + new AbstractMap.SimpleEntry<>("application/json", new ApplicationjsonMediaType()) + ) + ); + } + + @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); + } + + @Override + protected Nothing? getHeaders(HttpHeaders headers, SchemaConfiguration configuration) { + return null; + } + } + + @SuppressWarnings("serial") + public static class ResponseApiException extends ApiException { + public DeserializedHttpResponse deserializedResponse; + + public ResponseApiException(String s, HttpResponse response, DeserializedHttpResponse deserializedResponse) { + super(s, response); + this.deserializedResponse = deserializedResponse; + } + } +} diff --git a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/fakemultipleresponsebodies/get/responses/FakemultipleresponsebodiesGetCode202Response.kt b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/fakemultipleresponsebodies/get/responses/FakemultipleresponsebodiesGetCode202Response.kt new file mode 100644 index 00000000000..410f236f118 --- /dev/null +++ b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/fakemultipleresponsebodies/get/responses/FakemultipleresponsebodiesGetCode202Response.kt @@ -0,0 +1,63 @@ +package org.openapijsonschematools.client.paths.fakemultipleresponsebodies.get.responses; + +import org.openapijsonschematools.client.configurations.SchemaConfiguration; +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; + +import java.util.AbstractMap; +import java.util.Map; +import java.net.http.HttpResponse; +import java.net.http.HttpHeaders; + +public class FakemultipleresponsebodiesGetCode202Response { + public sealed interface SealedMediaType permits ApplicationjsonMediaType {} + + public record ApplicationjsonMediaType(ApplicationjsonSchema.ApplicationjsonSchema1 schema) implements SealedMediaType, MediaType { + public ApplicationjsonMediaType() { + this(ApplicationjsonSchema.ApplicationjsonSchema1.getInstance()); + } + @Override + public Nothing? encoding() { + return null; + } + } + public sealed interface SealedResponseBody permits ApplicationjsonResponseBody {} + public record ApplicationjsonResponseBody(ApplicationjsonSchema.AnyTypeJsonSchema1Boxed body) implements SealedResponseBody { } + + public static class FakemultipleresponsebodiesGetCode202Response1 extends ResponseDeserializer { + public FakemultipleresponsebodiesGetCode202Response1() { + super( + Map.ofEntries( + new AbstractMap.SimpleEntry<>("application/json", new ApplicationjsonMediaType()) + ) + ); + } + + @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); + } + + @Override + protected Nothing? getHeaders(HttpHeaders headers, SchemaConfiguration configuration) { + return null; + } + } + + @SuppressWarnings("serial") + public static class ResponseApiException extends ApiException { + public DeserializedHttpResponse deserializedResponse; + + public ResponseApiException(String s, HttpResponse response, DeserializedHttpResponse deserializedResponse) { + super(s, response); + this.deserializedResponse = deserializedResponse; + } + } +} diff --git a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/fakemultipleresponsebodies/get/responses/code200response/content/applicationjson/ApplicationjsonSchema.kt b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/fakemultipleresponsebodies/get/responses/code200response/content/applicationjson/ApplicationjsonSchema.kt new file mode 100644 index 00000000000..0a2a9520c57 --- /dev/null +++ b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/fakemultipleresponsebodies/get/responses/code200response/content/applicationjson/ApplicationjsonSchema.kt @@ -0,0 +1,19 @@ +package org.openapijsonschematools.client.paths.fakemultipleresponsebodies.get.responses.code200response.content.applicationjson; +import org.checkerframework.checker.nullness.qual.Nullable; +import org.openapijsonschematools.client.schemas.AnyTypeJsonSchema; + +public class ApplicationjsonSchema extends AnyTypeJsonSchema { + // nest classes so all schemas and input/output classes can be public + + + public static class ApplicationjsonSchema1 extends AnyTypeJsonSchema.AnyTypeJsonSchema1 { + private static @Nullable ApplicationjsonSchema1 instance = null; + public static ApplicationjsonSchema1 getInstance() { + if (instance == null) { + instance = new ApplicationjsonSchema1(); + } + return instance; + } + } + +} diff --git a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/fakemultipleresponsebodies/get/responses/code202response/content/applicationjson/ApplicationjsonSchema.kt b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/fakemultipleresponsebodies/get/responses/code202response/content/applicationjson/ApplicationjsonSchema.kt new file mode 100644 index 00000000000..53ce26bfe16 --- /dev/null +++ b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/fakemultipleresponsebodies/get/responses/code202response/content/applicationjson/ApplicationjsonSchema.kt @@ -0,0 +1,19 @@ +package org.openapijsonschematools.client.paths.fakemultipleresponsebodies.get.responses.code202response.content.applicationjson; +import org.checkerframework.checker.nullness.qual.Nullable; +import org.openapijsonschematools.client.schemas.AnyTypeJsonSchema; + +public class ApplicationjsonSchema extends AnyTypeJsonSchema { + // nest classes so all schemas and input/output classes can be public + + + public static class ApplicationjsonSchema1 extends AnyTypeJsonSchema.AnyTypeJsonSchema1 { + private static @Nullable ApplicationjsonSchema1 instance = null; + public static ApplicationjsonSchema1 getInstance() { + if (instance == null) { + instance = new ApplicationjsonSchema1(); + } + return instance; + } + } + +} diff --git a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/fakemultiplesecurities/FakemultiplesecuritiesGet.kt b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/fakemultiplesecurities/FakemultiplesecuritiesGet.kt new file mode 100644 index 00000000000..99652396c14 --- /dev/null +++ b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/fakemultiplesecurities/FakemultiplesecuritiesGet.kt @@ -0,0 +1,152 @@ +package org.openapijsonschematools.client.paths.fakemultiplesecurities; + +import org.checkerframework.checker.nullness.qual.Nullable; +import org.openapijsonschematools.client.RootServerInfo; +import org.openapijsonschematools.client.paths.fakemultiplesecurities.get.FakemultiplesecuritiesGetSecurityInfo; +import org.openapijsonschematools.client.paths.fakemultiplesecurities.get.FakemultiplesecuritiesGetResponses; +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.paths.Fakemultiplesecurities; +import org.openapijsonschematools.client.securityrequirementobjects.SecurityRequirementObject; +import org.openapijsonschematools.client.securityrequirementobjects.AuthApplier; + +import java.io.IOException; +import java.net.http.HttpClient; +import java.net.http.HttpRequest; +import java.time.Duration; +import java.util.List; +import java.util.Map; + +public class FakemultiplesecuritiesGet { + private static class GetProvider extends AuthApplier { + private static final String method = "get"; + + public static FakemultiplesecuritiesGetResponses.EndpointResponse get( + GetRequest request, + ApiConfiguration apiConfiguration, + SchemaConfiguration schemaConfiguration, + HttpClient client + ) 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 + @Nullable Map queryMap = null; + String host = apiConfiguration.getServer(request.serverIndex).url(); + SecurityRequirementObject securityRequirementObject = apiConfiguration.getSecurityRequirementObject(request.securityIndex); + updateParamsForAuth( + securityRequirementObject, + headers, + Fakemultiplesecurities.path, + method, + bodyPublisher, + queryMap, + apiConfiguration + ); + + String url = host + Fakemultiplesecurities.path; + var httpRequest = RestClient.getRequest( + url, + method, + bodyPublisher, + headers, + request.timeout + ); + var response = RestClient.getResponse(httpRequest, client); + var responsesDeserializer = new FakemultiplesecuritiesGetResponses.FakemultiplesecuritiesGetResponses1(); + return responsesDeserializer.deserialize(response, schemaConfiguration); + } + } + + public interface GetOperation { + ApiConfiguration getApiConfiguration(); + SchemaConfiguration getSchemaConfiguration(); + HttpClient getClient(); + default FakemultiplesecuritiesGetResponses.EndpointResponse get(GetRequest request) throws IOException, InterruptedException, ValidationException, NotImplementedException, ApiException { + return GetProvider.get(request, getApiConfiguration(), getSchemaConfiguration(), getClient()); + } + } + + public interface MultipleSecuritiesOperation { + ApiConfiguration getApiConfiguration(); + SchemaConfiguration getSchemaConfiguration(); + HttpClient getClient(); + default FakemultiplesecuritiesGetResponses.EndpointResponse multipleSecurities(GetRequest request) throws IOException, InterruptedException, ValidationException, NotImplementedException, ApiException { + return GetProvider.get(request, getApiConfiguration(), getSchemaConfiguration(), getClient()); + } + } + + public static class Get extends ApiClient implements GetOperation { + public Get(ApiConfiguration apiConfiguration, SchemaConfiguration schemaConfiguration) { + super(apiConfiguration, schemaConfiguration); + } + } + + public static class GetRequest { + public RootServerInfo.@Nullable ServerIndex serverIndex; + public FakemultiplesecuritiesGetSecurityInfo.@Nullable SecurityIndex securityIndex; + public @Nullable Duration timeout; + } + + public interface SetterForServerIndex { + GetRequest getInstance(); + T getBuilderAfterServerIndex(GetRequest instance); + default T serverIndex(RootServerInfo.ServerIndex serverIndex) { + var instance = getInstance(); + instance.serverIndex = serverIndex; + return getBuilderAfterServerIndex(instance); + } + } + + public interface SetterForSecurityIndex { + GetRequest getInstance(); + T getBuilderAfterSecurityIndex(GetRequest instance); + default T securityIndex(FakemultiplesecuritiesGetSecurityInfo.SecurityIndex securityIndex) { + var instance = getInstance(); + instance.securityIndex = securityIndex; + return getBuilderAfterSecurityIndex(instance); + } + } + + public interface SetterForTimeout { + GetRequest getInstance(); + T getBuilderAfterTimeout(GetRequest instance); + default T timeout(Duration timeout) { + var instance = getInstance(); + instance.timeout = timeout; + return getBuilderAfterTimeout(instance); + } + } + + public static class GetRequestBuilder implements SetterForServerIndex, SetterForSecurityIndex, SetterForTimeout { + private final GetRequest instance; + + public GetRequestBuilder() { + this.instance = new GetRequest(); + } + + public GetRequest build() { + return instance; + } + + public GetRequest getInstance() { + return instance; + } + + public GetRequestBuilder getBuilderAfterServerIndex(GetRequest instance) { + return this; + } + + public GetRequestBuilder getBuilderAfterSecurityIndex(GetRequest instance) { + return this; + } + + public GetRequestBuilder getBuilderAfterTimeout(GetRequest instance) { + return this; + } + } +} diff --git a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/fakemultiplesecurities/get/FakemultiplesecuritiesGetResponses.kt b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/fakemultiplesecurities/get/FakemultiplesecuritiesGetResponses.kt new file mode 100644 index 00000000000..6f1e48a4644 --- /dev/null +++ b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/fakemultiplesecurities/get/FakemultiplesecuritiesGetResponses.kt @@ -0,0 +1,53 @@ +package org.openapijsonschematools.client.paths.fakemultiplesecurities.get; + +import org.openapijsonschematools.client.paths.fakemultiplesecurities.get.responses.FakemultiplesecuritiesGetCode200Response; +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; +import org.checkerframework.checker.nullness.qual.Nullable; + +import java.net.http.HttpResponse; +import java.util.Map; +import java.util.AbstractMap; + +public class FakemultiplesecuritiesGetResponses { + public sealed interface EndpointResponse permits EndpointFakemultiplesecuritiesGetCode200Response {} + + public record EndpointFakemultiplesecuritiesGetCode200Response( + HttpResponse response, + FakemultiplesecuritiesGetCode200Response.SealedResponseBody body, + Nothing? headers + ) implements EndpointResponse, ApiResponse{ + } + + public sealed interface StatusCodeResponseDeserializer permits StatusFakemultiplesecuritiesGetCode200ResponseDeserializer {} + + public static final class StatusFakemultiplesecuritiesGetCode200ResponseDeserializer extends FakemultiplesecuritiesGetCode200Response.FakemultiplesecuritiesGetCode200Response1 implements StatusCodeResponseDeserializer { + } + + public static final class FakemultiplesecuritiesGetResponses1 implements ResponsesDeserializer { + private final Map statusCodeToResponseDeserializer; + public FakemultiplesecuritiesGetResponses1() { + this.statusCodeToResponseDeserializer = Map.ofEntries( + new AbstractMap.SimpleEntry<>("200", new StatusFakemultiplesecuritiesGetCode200ResponseDeserializer()) + ); + } + + 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) { + throw new ApiException( + "Invalid response statusCode="+statusCode+" has no response defined in the openapi document", + response + ); + } + StatusFakemultiplesecuritiesGetCode200ResponseDeserializer castDeserializer = (StatusFakemultiplesecuritiesGetCode200ResponseDeserializer) statusCodeDeserializer; + var deserializedResponse = castDeserializer.deserialize(response, configuration); + return new EndpointFakemultiplesecuritiesGetCode200Response(response, deserializedResponse.body(), deserializedResponse.headers()); + } + } +} diff --git a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/fakemultiplesecurities/get/FakemultiplesecuritiesGetSecurityInfo.kt b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/fakemultiplesecurities/get/FakemultiplesecuritiesGetSecurityInfo.kt new file mode 100644 index 00000000000..ed1fd5216aa --- /dev/null +++ b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/fakemultiplesecurities/get/FakemultiplesecuritiesGetSecurityInfo.kt @@ -0,0 +1,39 @@ +package org.openapijsonschematools.client.paths.fakemultiplesecurities.get; + +import org.openapijsonschematools.client.paths.fakemultiplesecurities.get.security.FakemultiplesecuritiesGetSecurityRequirementObject0; +import org.openapijsonschematools.client.paths.fakemultiplesecurities.get.security.FakemultiplesecuritiesGetSecurityRequirementObject1; +import org.openapijsonschematools.client.paths.fakemultiplesecurities.get.security.FakemultiplesecuritiesGetSecurityRequirementObject2; +import org.openapijsonschematools.client.securityrequirementobjects.SecurityRequirementObject; +import org.openapijsonschematools.client.securityrequirementobjects.SecurityRequirementObjectProvider; + +public class FakemultiplesecuritiesGetSecurityInfo { + public static class FakemultiplesecuritiesGetSecurityInfo1 implements SecurityRequirementObjectProvider { + public final FakemultiplesecuritiesGetSecurityRequirementObject0 security0; + public final FakemultiplesecuritiesGetSecurityRequirementObject1 security1; + public final FakemultiplesecuritiesGetSecurityRequirementObject2 security2; + + public FakemultiplesecuritiesGetSecurityInfo1() { + security0 = new FakemultiplesecuritiesGetSecurityRequirementObject0(); + security1 = new FakemultiplesecuritiesGetSecurityRequirementObject1(); + security2 = new FakemultiplesecuritiesGetSecurityRequirementObject2(); + } + + @Override + public SecurityRequirementObject getSecurityRequirementObject(SecurityIndex securityIndex) { + switch (securityIndex) { + case SECURITY_0: + return security0; + case SECURITY_1: + return security1; + default: + return security2; + } + } + } + + public enum SecurityIndex { + SECURITY_0, + SECURITY_1, + SECURITY_2 + } +} \ No newline at end of file diff --git a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/fakemultiplesecurities/get/responses/FakemultiplesecuritiesGetCode200Response.kt b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/fakemultiplesecurities/get/responses/FakemultiplesecuritiesGetCode200Response.kt new file mode 100644 index 00000000000..30816b17b52 --- /dev/null +++ b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/fakemultiplesecurities/get/responses/FakemultiplesecuritiesGetCode200Response.kt @@ -0,0 +1,63 @@ +package org.openapijsonschematools.client.paths.fakemultiplesecurities.get.responses; + +import org.openapijsonschematools.client.configurations.SchemaConfiguration; +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; + +import java.util.AbstractMap; +import java.util.Map; +import java.net.http.HttpResponse; +import java.net.http.HttpHeaders; + +public class FakemultiplesecuritiesGetCode200Response { + public sealed interface SealedMediaType permits ApplicationjsonMediaType {} + + public record ApplicationjsonMediaType(ApplicationjsonSchema.ApplicationjsonSchema1 schema) implements SealedMediaType, MediaType { + public ApplicationjsonMediaType() { + this(ApplicationjsonSchema.ApplicationjsonSchema1.getInstance()); + } + @Override + public Nothing? encoding() { + return null; + } + } + public sealed interface SealedResponseBody permits ApplicationjsonResponseBody {} + public record ApplicationjsonResponseBody(ApplicationjsonSchema.AnyTypeJsonSchema1Boxed body) implements SealedResponseBody { } + + public static class FakemultiplesecuritiesGetCode200Response1 extends ResponseDeserializer { + public FakemultiplesecuritiesGetCode200Response1() { + super( + Map.ofEntries( + new AbstractMap.SimpleEntry<>("application/json", new ApplicationjsonMediaType()) + ) + ); + } + + @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); + } + + @Override + protected Nothing? getHeaders(HttpHeaders headers, SchemaConfiguration configuration) { + return null; + } + } + + @SuppressWarnings("serial") + public static class ResponseApiException extends ApiException { + public DeserializedHttpResponse deserializedResponse; + + public ResponseApiException(String s, HttpResponse response, DeserializedHttpResponse deserializedResponse) { + super(s, response); + this.deserializedResponse = deserializedResponse; + } + } +} diff --git a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/fakemultiplesecurities/get/responses/code200response/content/applicationjson/ApplicationjsonSchema.kt b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/fakemultiplesecurities/get/responses/code200response/content/applicationjson/ApplicationjsonSchema.kt new file mode 100644 index 00000000000..19cca1a1b80 --- /dev/null +++ b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/fakemultiplesecurities/get/responses/code200response/content/applicationjson/ApplicationjsonSchema.kt @@ -0,0 +1,19 @@ +package org.openapijsonschematools.client.paths.fakemultiplesecurities.get.responses.code200response.content.applicationjson; +import org.checkerframework.checker.nullness.qual.Nullable; +import org.openapijsonschematools.client.schemas.AnyTypeJsonSchema; + +public class ApplicationjsonSchema extends AnyTypeJsonSchema { + // nest classes so all schemas and input/output classes can be public + + + public static class ApplicationjsonSchema1 extends AnyTypeJsonSchema.AnyTypeJsonSchema1 { + private static @Nullable ApplicationjsonSchema1 instance = null; + public static ApplicationjsonSchema1 getInstance() { + if (instance == null) { + instance = new ApplicationjsonSchema1(); + } + return instance; + } + } + +} diff --git a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/fakemultiplesecurities/get/security/FakemultiplesecuritiesGetSecurityRequirementObject0.kt b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/fakemultiplesecurities/get/security/FakemultiplesecuritiesGetSecurityRequirementObject0.kt new file mode 100644 index 00000000000..bc95dd4ca2b --- /dev/null +++ b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/fakemultiplesecurities/get/security/FakemultiplesecuritiesGetSecurityRequirementObject0.kt @@ -0,0 +1,5 @@ +package org.openapijsonschematools.client.paths.fakemultiplesecurities.get.security; + +import org.openapijsonschematools.client.securityrequirementobjects.EmptySecurityRequirementObject; + +public class FakemultiplesecuritiesGetSecurityRequirementObject0 extends EmptySecurityRequirementObject {} diff --git a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/fakemultiplesecurities/get/security/FakemultiplesecuritiesGetSecurityRequirementObject1.kt b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/fakemultiplesecurities/get/security/FakemultiplesecuritiesGetSecurityRequirementObject1.kt new file mode 100644 index 00000000000..4b2a7c9737a --- /dev/null +++ b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/fakemultiplesecurities/get/security/FakemultiplesecuritiesGetSecurityRequirementObject1.kt @@ -0,0 +1,29 @@ +package org.openapijsonschematools.client.paths.fakemultiplesecurities.get.security; + +import org.checkerframework.checker.nullness.qual.Nullable; +import org.openapijsonschematools.client.securityrequirementobjects.SecurityRequirementObject; +import org.openapijsonschematools.client.securityschemes.SecurityScheme; +import org.openapijsonschematools.client.components.securityschemes.ApiKey; +import org.openapijsonschematools.client.components.securityschemes.HttpBasicTest; + +import java.util.List; +import java.util.Map; +import java.util.AbstractMap; + +public class FakemultiplesecuritiesGetSecurityRequirementObject1 extends SecurityRequirementObject { + + public FakemultiplesecuritiesGetSecurityRequirementObject1() { + super( + Map.ofEntries( + new AbstractMap.SimpleEntry, List>( + HttpBasicTest.class, + List.of() + ), + new AbstractMap.SimpleEntry, List>( + ApiKey.class, + List.of() + ) + ) + ); + } +} diff --git a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/fakemultiplesecurities/get/security/FakemultiplesecuritiesGetSecurityRequirementObject2.kt b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/fakemultiplesecurities/get/security/FakemultiplesecuritiesGetSecurityRequirementObject2.kt new file mode 100644 index 00000000000..b59a0f9bb32 --- /dev/null +++ b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/fakemultiplesecurities/get/security/FakemultiplesecuritiesGetSecurityRequirementObject2.kt @@ -0,0 +1,24 @@ +package org.openapijsonschematools.client.paths.fakemultiplesecurities.get.security; + +import org.checkerframework.checker.nullness.qual.Nullable; +import org.openapijsonschematools.client.securityrequirementobjects.SecurityRequirementObject; +import org.openapijsonschematools.client.securityschemes.SecurityScheme; +import org.openapijsonschematools.client.components.securityschemes.PetstoreAuth; + +import java.util.List; +import java.util.Map; +import java.util.AbstractMap; + +public class FakemultiplesecuritiesGetSecurityRequirementObject2 extends SecurityRequirementObject { + + public FakemultiplesecuritiesGetSecurityRequirementObject2() { + super( + Map.ofEntries( + new AbstractMap.SimpleEntry, List>( + PetstoreAuth.class, + List.of("write:pets", "read:pets") + ) + ) + ); + } +} diff --git a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/fakeobjinquery/FakeobjinqueryGet.kt b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/fakeobjinquery/FakeobjinqueryGet.kt new file mode 100644 index 00000000000..b4fa0a4edbd --- /dev/null +++ b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/fakeobjinquery/FakeobjinqueryGet.kt @@ -0,0 +1,148 @@ +package org.openapijsonschematools.client.paths.fakeobjinquery; + +import org.checkerframework.checker.nullness.qual.Nullable; +import org.openapijsonschematools.client.paths.fakeobjinquery.get.FakeobjinqueryGetQueryParameters; +import org.openapijsonschematools.client.RootServerInfo; +import org.openapijsonschematools.client.paths.fakeobjinquery.get.Parameters; +import org.openapijsonschematools.client.paths.fakeobjinquery.get.FakeobjinqueryGetResponses; +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.paths.Fakeobjinquery; + +import java.io.IOException; +import java.net.http.HttpClient; +import java.net.http.HttpRequest; +import java.time.Duration; +import java.util.List; +import java.util.Map; + +public class FakeobjinqueryGet { + private static class GetProvider { + private static final String method = "get"; + + public static FakeobjinqueryGetResponses.EndpointResponse get( + GetRequest request, + ApiConfiguration apiConfiguration, + SchemaConfiguration schemaConfiguration, + HttpClient client + ) throws IOException, InterruptedException, ValidationException, NotImplementedException, ApiException { + Map> headers = apiConfiguration.getDefaultHeaders(); + HttpRequest.BodyPublisher bodyPublisher = HttpRequest.BodyPublishers.noBody(); + + var querySerializer = new Parameters.QueryParametersSerializer(); + @Nullable Map queryMap = null; + if (request.queryParameters != null) { + queryMap = querySerializer.getQueryMap(request.queryParameters); + } + String host = apiConfiguration.getServer(request.serverIndex).url(); + + String url = host + Fakeobjinquery.path; + if (queryMap != null) { + url = url + querySerializer.serialize(queryMap); + } + var httpRequest = RestClient.getRequest( + url, + method, + bodyPublisher, + headers, + request.timeout + ); + var response = RestClient.getResponse(httpRequest, client); + var responsesDeserializer = new FakeobjinqueryGetResponses.FakeobjinqueryGetResponses1(); + return responsesDeserializer.deserialize(response, schemaConfiguration); + } + } + + public interface GetOperation { + ApiConfiguration getApiConfiguration(); + SchemaConfiguration getSchemaConfiguration(); + HttpClient getClient(); + default FakeobjinqueryGetResponses.EndpointResponse get(GetRequest request) throws IOException, InterruptedException, ValidationException, NotImplementedException, ApiException { + return GetProvider.get(request, getApiConfiguration(), getSchemaConfiguration(), getClient()); + } + } + + public interface ObjectInQueryOperation { + ApiConfiguration getApiConfiguration(); + SchemaConfiguration getSchemaConfiguration(); + HttpClient getClient(); + default FakeobjinqueryGetResponses.EndpointResponse objectInQuery(GetRequest request) throws IOException, InterruptedException, ValidationException, NotImplementedException, ApiException { + return GetProvider.get(request, getApiConfiguration(), getSchemaConfiguration(), getClient()); + } + } + + public static class Get extends ApiClient implements GetOperation { + public Get(ApiConfiguration apiConfiguration, SchemaConfiguration schemaConfiguration) { + super(apiConfiguration, schemaConfiguration); + } + } + + public static class GetRequest { + public FakeobjinqueryGetQueryParameters.@Nullable QueryParametersMap queryParameters; + public RootServerInfo.@Nullable ServerIndex serverIndex; + public @Nullable Duration timeout; + } + + public interface SetterForQueryParameters { + GetRequest getInstance(); + T getBuilderAfterQueryParameters(GetRequest instance); + default T queryParameters(FakeobjinqueryGetQueryParameters.QueryParametersMap queryParameters) { + var instance = getInstance(); + instance.queryParameters = queryParameters; + return getBuilderAfterQueryParameters(instance); + } + } + + public interface SetterForServerIndex { + GetRequest getInstance(); + T getBuilderAfterServerIndex(GetRequest instance); + default T serverIndex(RootServerInfo.ServerIndex serverIndex) { + var instance = getInstance(); + instance.serverIndex = serverIndex; + return getBuilderAfterServerIndex(instance); + } + } + + public interface SetterForTimeout { + GetRequest getInstance(); + T getBuilderAfterTimeout(GetRequest instance); + default T timeout(Duration timeout) { + var instance = getInstance(); + instance.timeout = timeout; + return getBuilderAfterTimeout(instance); + } + } + + public static class GetRequestBuilder implements SetterForQueryParameters, SetterForServerIndex, SetterForTimeout { + private final GetRequest instance; + + public GetRequestBuilder() { + this.instance = new GetRequest(); + } + + public GetRequest build() { + return instance; + } + + public GetRequest getInstance() { + return instance; + } + + public GetRequestBuilder getBuilderAfterQueryParameters(GetRequest instance) { + return this; + } + + public GetRequestBuilder getBuilderAfterServerIndex(GetRequest instance) { + return this; + } + + public GetRequestBuilder getBuilderAfterTimeout(GetRequest instance) { + return this; + } + } +} diff --git a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/fakeobjinquery/get/FakeobjinqueryGetQueryParameters.kt b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/fakeobjinquery/get/FakeobjinqueryGetQueryParameters.kt new file mode 100644 index 00000000000..7a1622cc81d --- /dev/null +++ b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/fakeobjinquery/get/FakeobjinqueryGetQueryParameters.kt @@ -0,0 +1,191 @@ +package org.openapijsonschematools.client.paths.fakeobjinquery.get; +import java.util.ArrayList; +import java.util.HashSet; +import java.util.LinkedHashMap; +import java.util.LinkedHashSet; +import java.util.List; +import java.util.Map; +import java.util.Objects; +import java.util.Set; +import org.checkerframework.checker.nullness.qual.Nullable; +import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags; +import org.openapijsonschematools.client.configurations.SchemaConfiguration; +import org.openapijsonschematools.client.exceptions.UnsetPropertyException; +import org.openapijsonschematools.client.exceptions.ValidationException; +import org.openapijsonschematools.client.paths.fakeobjinquery.get.parameters.parameter0.Schema0; +import org.openapijsonschematools.client.schemas.AnyTypeJsonSchema; +import org.openapijsonschematools.client.schemas.GenericBuilder; +import org.openapijsonschematools.client.schemas.NotAnyTypeJsonSchema; +import org.openapijsonschematools.client.schemas.validation.FrozenMap; +import org.openapijsonschematools.client.schemas.validation.JsonSchema; +import org.openapijsonschematools.client.schemas.validation.JsonSchemaInfo; +import org.openapijsonschematools.client.schemas.validation.MapSchemaValidator; +import org.openapijsonschematools.client.schemas.validation.MapUtils; +import org.openapijsonschematools.client.schemas.validation.PathToSchemasMap; +import org.openapijsonschematools.client.schemas.validation.PropertyEntry; +import org.openapijsonschematools.client.schemas.validation.ValidationMetadata; + +public class FakeobjinqueryGetQueryParameters { + // nest classes so all schemas and input/output classes can be public + + + public static class AdditionalProperties extends NotAnyTypeJsonSchema.NotAnyTypeJsonSchema1 { + // NotAnyTypeSchema + private static @Nullable AdditionalProperties instance = null; + public static AdditionalProperties getInstance() { + if (instance == null) { + instance = new AdditionalProperties(); + } + return instance; + } + } + + + public static class QueryParametersMap extends FrozenMap { + protected QueryParametersMap(FrozenMap m) { + super(m); + } + public static final Set requiredKeys = Set.of(); + public static final Set optionalKeys = Set.of( + "mapBean" + ); + public static QueryParametersMap of(Map> arg, SchemaConfiguration configuration) throws ValidationException { + return FakeobjinqueryGetQueryParameters1.getInstance().validate(arg, configuration); + } + + public Schema0.SchemaMap0 mapBean() throws UnsetPropertyException { + return getOrThrow("mapBean"); + } + } + + public interface SetterForMapBean { + Map> getInstance(); + T getBuilderAfterMapBean(Map> instance); + + default T mapBean(Map value) { + var instance = getInstance(); + instance.put("mapBean", value); + return getBuilderAfterMapBean(instance); + } + } + + public static class QueryParametersMapBuilder implements GenericBuilder>>, SetterForMapBean { + private final Map> instance; + private static final Set knownKeys = Set.of( + "mapBean" + ); + public Set getKnownKeys() { + return knownKeys; + } + public QueryParametersMapBuilder() { + this.instance = new LinkedHashMap<>(); + } + public Map> build() { + return instance; + } + public Map> getInstance() { + return instance; + } + public QueryParametersMapBuilder getBuilderAfterMapBean(Map> instance) { + return this; + } + } + + + public sealed interface FakeobjinqueryGetQueryParameters1Boxed permits FakeobjinqueryGetQueryParameters1BoxedMap { + @Nullable Object getData(); + } + + public record FakeobjinqueryGetQueryParameters1BoxedMap(QueryParametersMap data) implements FakeobjinqueryGetQueryParameters1Boxed { + @Override + public @Nullable Object getData() { + return data; + } + } + + + public static class FakeobjinqueryGetQueryParameters1 extends JsonSchema implements MapSchemaValidator { + private static @Nullable FakeobjinqueryGetQueryParameters1 instance = null; + + protected FakeobjinqueryGetQueryParameters1() { + super(new JsonSchemaInfo() + .type(Set.of(Map.class)) + .properties(Map.ofEntries( + new PropertyEntry("mapBean", Schema0.Schema01.class) + )) + .additionalProperties(AdditionalProperties.class) + ); + } + + public static FakeobjinqueryGetQueryParameters1 getInstance() { + if (instance == null) { + instance = new FakeobjinqueryGetQueryParameters1(); + } + return instance; + } + + 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 RuntimeException("Invalid non-string key value"); + } + String propertyName = (String) entryKey; + List propertyPathToItem = new ArrayList<>(pathToItem); + propertyPathToItem.add(propertyName); + Object value = entry.getValue(); + LinkedHashMap, Nothing?> schemas = pathToSchemas.get(propertyPathToItem); + if (schemas == null) { + throw new RuntimeException("Validation 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"); + } + properties.put(propertyName, (Schema0.SchemaMap0) propertyInstance); + } + FrozenMap castProperties = new FrozenMap<>(properties); + return new QueryParametersMap(castProperties); + } + + 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); + SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().build())); + ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, new PathToSchemasMap(), new LinkedHashSet<>()); + PathToSchemasMap pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet); + return getNewInstance(castArg, validationMetadata.pathToItem(), pathToSchemasMap); + } + + + @Override + public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws 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"); + } + @Override + public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { + if (arg instanceof Map) { + return getNewInstance((Map) arg, pathToItem, pathToSchemas); + } + throw new RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); + } + @Override + public FakeobjinqueryGetQueryParameters1BoxedMap validateAndBox(Map arg, SchemaConfiguration configuration) throws ValidationException { + return new FakeobjinqueryGetQueryParameters1BoxedMap(validate(arg, configuration)); + } + @Override + public FakeobjinqueryGetQueryParameters1Boxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { + 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"); + } + } + +} diff --git a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/fakeobjinquery/get/FakeobjinqueryGetResponses.kt b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/fakeobjinquery/get/FakeobjinqueryGetResponses.kt new file mode 100644 index 00000000000..70aa9c5574f --- /dev/null +++ b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/fakeobjinquery/get/FakeobjinqueryGetResponses.kt @@ -0,0 +1,53 @@ +package org.openapijsonschematools.client.paths.fakeobjinquery.get; + +import org.openapijsonschematools.client.paths.fakeobjinquery.get.responses.FakeobjinqueryGetCode200Response; +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; +import org.checkerframework.checker.nullness.qual.Nullable; + +import java.net.http.HttpResponse; +import java.util.Map; +import java.util.AbstractMap; + +public class FakeobjinqueryGetResponses { + public sealed interface EndpointResponse permits EndpointFakeobjinqueryGetCode200Response {} + + public record EndpointFakeobjinqueryGetCode200Response( + HttpResponse response, + Nothing? body, + Nothing? headers + ) implements EndpointResponse, ApiResponse{ + } + + public sealed interface StatusCodeResponseDeserializer permits StatusFakeobjinqueryGetCode200ResponseDeserializer {} + + public static final class StatusFakeobjinqueryGetCode200ResponseDeserializer extends FakeobjinqueryGetCode200Response.FakeobjinqueryGetCode200Response1 implements StatusCodeResponseDeserializer { + } + + public static final class FakeobjinqueryGetResponses1 implements ResponsesDeserializer { + private final Map statusCodeToResponseDeserializer; + public FakeobjinqueryGetResponses1() { + this.statusCodeToResponseDeserializer = Map.ofEntries( + new AbstractMap.SimpleEntry<>("200", new StatusFakeobjinqueryGetCode200ResponseDeserializer()) + ); + } + + 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) { + throw new ApiException( + "Invalid response statusCode="+statusCode+" has no response defined in the openapi document", + response + ); + } + StatusFakeobjinqueryGetCode200ResponseDeserializer castDeserializer = (StatusFakeobjinqueryGetCode200ResponseDeserializer) statusCodeDeserializer; + var deserializedResponse = castDeserializer.deserialize(response, configuration); + return new EndpointFakeobjinqueryGetCode200Response(response, deserializedResponse.body(), deserializedResponse.headers()); + } + } +} diff --git a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/fakeobjinquery/get/Parameters.kt b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/fakeobjinquery/get/Parameters.kt new file mode 100644 index 00000000000..58e787df688 --- /dev/null +++ b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/fakeobjinquery/get/Parameters.kt @@ -0,0 +1,20 @@ +package org.openapijsonschematools.client.paths.fakeobjinquery.get; + +import org.openapijsonschematools.client.paths.fakeobjinquery.get.parameters.Parameter0; +import org.openapijsonschematools.client.parameter.QuerySerializer; + +import java.util.Map; +import java.util.AbstractMap; + +public class Parameters { + + public static class QueryParametersSerializer extends QuerySerializer { + public QueryParametersSerializer() { + super( + Map.ofEntries( + new AbstractMap.SimpleEntry<>("mapBean", new Parameter0.Parameter01()) + ) + ); + } + } +} diff --git a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/fakeobjinquery/get/parameters/Parameter0.kt b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/fakeobjinquery/get/parameters/Parameter0.kt new file mode 100644 index 00000000000..75d3713a0bb --- /dev/null +++ b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/fakeobjinquery/get/parameters/Parameter0.kt @@ -0,0 +1,23 @@ +package org.openapijsonschematools.client.paths.fakeobjinquery.get.parameters; + +import org.openapijsonschematools.client.parameter.ParameterStyle; +import org.openapijsonschematools.client.parameter.ParameterInType; +import org.openapijsonschematools.client.parameter.SchemaParameter; +import org.openapijsonschematools.client.paths.fakeobjinquery.get.parameters.parameter0.Schema0; + +public class Parameter0 { + + public static class Parameter01 extends SchemaParameter { + public Parameter01() { + super( + "mapBean", + ParameterInType.QUERY, + false, + ParameterStyle.DEEP_OBJECT, + true, + false, + Schema0.Schema01.getInstance() + ); + } + } +} diff --git a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/fakeobjinquery/get/parameters/parameter0/Schema0.kt b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/fakeobjinquery/get/parameters/parameter0/Schema0.kt new file mode 100644 index 00000000000..d8638a10a71 --- /dev/null +++ b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/fakeobjinquery/get/parameters/parameter0/Schema0.kt @@ -0,0 +1,200 @@ +package org.openapijsonschematools.client.paths.fakeobjinquery.get.parameters.parameter0; +import java.util.ArrayList; +import java.util.HashSet; +import java.util.LinkedHashMap; +import java.util.LinkedHashSet; +import java.util.List; +import java.util.Map; +import java.util.Objects; +import java.util.Set; +import org.checkerframework.checker.nullness.qual.Nullable; +import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags; +import org.openapijsonschematools.client.configurations.SchemaConfiguration; +import org.openapijsonschematools.client.exceptions.InvalidAdditionalPropertyException; +import org.openapijsonschematools.client.exceptions.UnsetPropertyException; +import org.openapijsonschematools.client.exceptions.ValidationException; +import org.openapijsonschematools.client.schemas.GenericBuilder; +import org.openapijsonschematools.client.schemas.StringJsonSchema; +import org.openapijsonschematools.client.schemas.UnsetAddPropsSetter; +import org.openapijsonschematools.client.schemas.validation.FrozenMap; +import org.openapijsonschematools.client.schemas.validation.JsonSchema; +import org.openapijsonschematools.client.schemas.validation.JsonSchemaInfo; +import org.openapijsonschematools.client.schemas.validation.MapSchemaValidator; +import org.openapijsonschematools.client.schemas.validation.PathToSchemasMap; +import org.openapijsonschematools.client.schemas.validation.PropertyEntry; +import org.openapijsonschematools.client.schemas.validation.ValidationMetadata; + +public class Schema0 { + // nest classes so all schemas and input/output classes can be public + + + public static class Keyword0 extends StringJsonSchema.StringJsonSchema1 { + private static @Nullable Keyword0 instance = null; + public static Keyword0 getInstance() { + if (instance == null) { + instance = new Keyword0(); + } + return instance; + } + } + + + public static class SchemaMap0 extends FrozenMap<@Nullable Object> { + protected SchemaMap0(FrozenMap<@Nullable Object> m) { + super(m); + } + public static final Set requiredKeys = Set.of(); + public static final Set optionalKeys = Set.of( + "keyword" + ); + public static SchemaMap0 of(Map arg, SchemaConfiguration configuration) throws ValidationException { + return Schema01.getInstance().validate(arg, configuration); + } + + public String keyword() throws UnsetPropertyException { + String key = "keyword"; + throwIfKeyNotPresent(key); + @Nullable Object value = get(key); + if (!(value instanceof String)) { + throw new RuntimeException("Invalid value stored for keyword"); + } + return (String) value; + } + + public @Nullable Object getAdditionalProperty(String name) throws UnsetPropertyException, InvalidAdditionalPropertyException { + throwIfKeyKnown(name, requiredKeys, optionalKeys); + throwIfKeyNotPresent(name); + return get(name); + } + } + + public interface SetterForKeyword0 { + Map getInstance(); + T getBuilderAfterKeyword0(Map instance); + + default T keyword(String value) { + var instance = getInstance(); + instance.put("keyword", value); + return getBuilderAfterKeyword0(instance); + } + } + + public static class SchemaMapBuilder0 extends UnsetAddPropsSetter implements GenericBuilder>, SetterForKeyword0 { + private final Map instance; + private static final Set knownKeys = Set.of( + "keyword" + ); + public Set getKnownKeys() { + return knownKeys; + } + public SchemaMapBuilder0() { + this.instance = new LinkedHashMap<>(); + } + public Map build() { + return instance; + } + public Map getInstance() { + return instance; + } + public SchemaMapBuilder0 getBuilderAfterKeyword0(Map instance) { + return this; + } + public SchemaMapBuilder0 getBuilderAfterAdditionalProperty(Map instance) { + return this; + } + } + + + public sealed interface Schema01Boxed permits Schema01BoxedMap { + @Nullable Object getData(); + } + + public record Schema01BoxedMap(SchemaMap0 data) implements Schema01Boxed { + @Override + public @Nullable Object getData() { + return data; + } + } + + + public static class Schema01 extends JsonSchema implements MapSchemaValidator { + private static @Nullable Schema01 instance = null; + + protected Schema01() { + super(new JsonSchemaInfo() + .type(Set.of(Map.class)) + .properties(Map.ofEntries( + new PropertyEntry("keyword", Keyword0.class) + )) + ); + } + + public static Schema01 getInstance() { + if (instance == null) { + instance = new Schema01(); + } + return instance; + } + + 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 RuntimeException("Invalid non-string key value"); + } + String propertyName = (String) entryKey; + List propertyPathToItem = new ArrayList<>(pathToItem); + propertyPathToItem.add(propertyName); + Object value = entry.getValue(); + LinkedHashMap, Nothing?> schemas = pathToSchemas.get(propertyPathToItem); + if (schemas == null) { + throw new RuntimeException("Validation result is invalid, schemas must exist for a pathToItem"); + } + JsonSchema propertySchema = schemas.entrySet().iterator().next().getKey(); + @Nullable Object propertyInstance = propertySchema.getNewInstance(value, propertyPathToItem, pathToSchemas); + properties.put(propertyName, propertyInstance); + } + FrozenMap<@Nullable Object> castProperties = new FrozenMap<>(properties); + return new SchemaMap0(castProperties); + } + + 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); + SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().build())); + ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, new PathToSchemasMap(), new LinkedHashSet<>()); + PathToSchemasMap pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet); + return getNewInstance(castArg, validationMetadata.pathToItem(), pathToSchemasMap); + } + + + @Override + public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws 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"); + } + @Override + public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { + if (arg instanceof Map) { + return getNewInstance((Map) arg, pathToItem, pathToSchemas); + } + 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 { + return new Schema01BoxedMap(validate(arg, configuration)); + } + @Override + public Schema01Boxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { + 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"); + } + } + +} diff --git a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/fakeobjinquery/get/responses/FakeobjinqueryGetCode200Response.kt b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/fakeobjinquery/get/responses/FakeobjinqueryGetCode200Response.kt new file mode 100644 index 00000000000..ea4029a4cb2 --- /dev/null +++ b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/fakeobjinquery/get/responses/FakeobjinqueryGetCode200Response.kt @@ -0,0 +1,7 @@ +package org.openapijsonschematools.client.paths.fakeobjinquery.get.responses; + +import org.openapijsonschematools.client.components.responses.SuccessDescriptionOnly; + +public class FakeobjinqueryGetCode200Response extends SuccessDescriptionOnly { + public static class FakeobjinqueryGetCode200Response1 extends SuccessDescriptionOnly1 {} +} diff --git a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/fakeparametercollisions1ababselfab/Fakeparametercollisions1ababselfabPost.kt b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/fakeparametercollisions1ababselfab/Fakeparametercollisions1ababselfabPost.kt new file mode 100644 index 00000000000..0b245fa60d0 --- /dev/null +++ b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/fakeparametercollisions1ababselfab/Fakeparametercollisions1ababselfabPost.kt @@ -0,0 +1,291 @@ +package org.openapijsonschematools.client.paths.fakeparametercollisions1ababselfab; + +import org.checkerframework.checker.nullness.qual.Nullable; +import org.openapijsonschematools.client.paths.fakeparametercollisions1ababselfab.post.Fakeparametercollisions1ababselfabPostRequestBody; +import org.openapijsonschematools.client.paths.fakeparametercollisions1ababselfab.post.Fakeparametercollisions1ababselfabPostHeaderParameters; +import org.openapijsonschematools.client.paths.fakeparametercollisions1ababselfab.post.Fakeparametercollisions1ababselfabPostQueryParameters; +import org.openapijsonschematools.client.paths.fakeparametercollisions1ababselfab.post.Fakeparametercollisions1ababselfabPostCookieParameters; +import org.openapijsonschematools.client.RootServerInfo; +import org.openapijsonschematools.client.paths.fakeparametercollisions1ababselfab.post.Fakeparametercollisions1ababselfabPostPathParameters; +import org.openapijsonschematools.client.paths.fakeparametercollisions1ababselfab.post.Parameters; +import org.openapijsonschematools.client.paths.fakeparametercollisions1ababselfab.post.Fakeparametercollisions1ababselfabPostResponses; +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.requestbody.SerializedRequestBody; +import org.openapijsonschematools.client.paths.Fakeparametercollisions1ababselfab; + +import java.io.IOException; +import java.util.ArrayList; +import java.net.http.HttpClient; +import java.net.http.HttpRequest; +import java.time.Duration; +import java.util.List; +import java.util.Map; + +public class Fakeparametercollisions1ababselfabPost { + private static class PostProvider { + private static final String method = "post"; + + public static Fakeparametercollisions1ababselfabPostResponses.EndpointResponse post( + PostRequest request, + ApiConfiguration apiConfiguration, + SchemaConfiguration schemaConfiguration, + HttpClient client + ) throws IOException, InterruptedException, ValidationException, NotImplementedException, ApiException { + Map> headers = apiConfiguration.getDefaultHeaders(); + + @Nullable SerializedRequestBody serializedRequestBody; + HttpRequest.BodyPublisher bodyPublisher = HttpRequest.BodyPublishers.noBody(); + if (request.requestBody != null) { + serializedRequestBody = new Fakeparametercollisions1ababselfabPostRequestBody.Fakeparametercollisions1ababselfabPostRequestBody1().serialize( + request.requestBody + ); + var contentTypeHeaderValues = headers.getOrDefault("Content-Type", new ArrayList<>()); + contentTypeHeaderValues.add(serializedRequestBody.contentType); + bodyPublisher = serializedRequestBody.bodyPublisher; + } + + if (request.headerParameters != null) { + var headersSerializer = new Parameters.HeaderParametersSerializer(); + Map> serializedHeaders = headersSerializer.serialize(request.headerParameters); + headers.putAll(serializedHeaders); + } + + if (request.cookieParameters != null) { + var cookieSerializer = new Parameters.CookieParametersSerializer(); + String serializedCookie = cookieSerializer.serialize(request.cookieParameters); + var cookieHeaderValues = headers.getOrDefault("Cookie", new ArrayList<>()); + cookieHeaderValues.add(serializedCookie); + } + + var pathSerializer = new Parameters.PathParametersSerializer(); + String updatedPath = pathSerializer.serialize(request.pathParameters, Fakeparametercollisions1ababselfab.path); + + var querySerializer = new Parameters.QueryParametersSerializer(); + @Nullable Map queryMap = null; + if (request.queryParameters != null) { + queryMap = querySerializer.getQueryMap(request.queryParameters); + } + String host = apiConfiguration.getServer(request.serverIndex).url(); + + String url = host + updatedPath; + if (queryMap != null) { + url = url + querySerializer.serialize(queryMap); + } + var httpRequest = RestClient.getRequest( + url, + method, + bodyPublisher, + headers, + request.timeout + ); + var response = RestClient.getResponse(httpRequest, client); + var responsesDeserializer = new Fakeparametercollisions1ababselfabPostResponses.Fakeparametercollisions1ababselfabPostResponses1(); + return responsesDeserializer.deserialize(response, schemaConfiguration); + } + } + + public interface PostOperation { + ApiConfiguration getApiConfiguration(); + SchemaConfiguration getSchemaConfiguration(); + HttpClient getClient(); + default Fakeparametercollisions1ababselfabPostResponses.EndpointResponse post(PostRequest request) throws IOException, InterruptedException, ValidationException, NotImplementedException, ApiException { + return PostProvider.post(request, getApiConfiguration(), getSchemaConfiguration(), getClient()); + } + } + + public interface ParameterCollisionsOperation { + ApiConfiguration getApiConfiguration(); + SchemaConfiguration getSchemaConfiguration(); + HttpClient getClient(); + default Fakeparametercollisions1ababselfabPostResponses.EndpointResponse parameterCollisions(PostRequest request) throws IOException, InterruptedException, ValidationException, NotImplementedException, ApiException { + return PostProvider.post(request, getApiConfiguration(), getSchemaConfiguration(), getClient()); + } + } + + public static class Post extends ApiClient implements PostOperation { + public Post(ApiConfiguration apiConfiguration, SchemaConfiguration schemaConfiguration) { + super(apiConfiguration, schemaConfiguration); + } + } + + public static class PostRequest { + public Fakeparametercollisions1ababselfabPostPathParameters.PathParametersMap pathParameters; + public Fakeparametercollisions1ababselfabPostRequestBody.@Nullable SealedRequestBody requestBody; + public Fakeparametercollisions1ababselfabPostHeaderParameters.@Nullable HeaderParametersMap headerParameters; + public Fakeparametercollisions1ababselfabPostQueryParameters.@Nullable QueryParametersMap queryParameters; + public Fakeparametercollisions1ababselfabPostCookieParameters.@Nullable CookieParametersMap cookieParameters; + public RootServerInfo.@Nullable ServerIndex serverIndex; + public @Nullable Duration timeout; + + public PostRequest( + Fakeparametercollisions1ababselfabPostPathParameters.PathParametersMap pathParameters, + Fakeparametercollisions1ababselfabPostRequestBody.@Nullable SealedRequestBody requestBody, + Fakeparametercollisions1ababselfabPostHeaderParameters.@Nullable HeaderParametersMap headerParameters, + Fakeparametercollisions1ababselfabPostQueryParameters.@Nullable QueryParametersMap queryParameters, + Fakeparametercollisions1ababselfabPostCookieParameters.@Nullable CookieParametersMap cookieParameters, + RootServerInfo.@Nullable ServerIndex serverIndex, + @Nullable Duration timeout + ) { + this.pathParameters = pathParameters; + this.requestBody = requestBody; + this.headerParameters = headerParameters; + this.queryParameters = queryParameters; + this.cookieParameters = cookieParameters; + this.serverIndex = serverIndex; + this.timeout = timeout; + } + } + + public static class PostNullableRequest { + public Fakeparametercollisions1ababselfabPostPathParameters.@Nullable PathParametersMap pathParameters; + public Fakeparametercollisions1ababselfabPostRequestBody.@Nullable SealedRequestBody requestBody; + public Fakeparametercollisions1ababselfabPostHeaderParameters.@Nullable HeaderParametersMap headerParameters; + public Fakeparametercollisions1ababselfabPostQueryParameters.@Nullable QueryParametersMap queryParameters; + public Fakeparametercollisions1ababselfabPostCookieParameters.@Nullable CookieParametersMap cookieParameters; + public RootServerInfo.@Nullable ServerIndex serverIndex; + public @Nullable Duration timeout; + } + + public interface SetterForRequestBody { + PostNullableRequest getInstance(); + T getBuilderAfterRequestBody(PostNullableRequest instance); + default T requestBody(Fakeparametercollisions1ababselfabPostRequestBody.SealedRequestBody requestBody) { + var instance = getInstance(); + instance.requestBody = requestBody; + return getBuilderAfterRequestBody(instance); + } + } + + public interface SetterForHeaderParameters { + PostNullableRequest getInstance(); + T getBuilderAfterHeaderParameters(PostNullableRequest instance); + default T headerParameters(Fakeparametercollisions1ababselfabPostHeaderParameters.HeaderParametersMap headerParameters) { + var instance = getInstance(); + instance.headerParameters = headerParameters; + return getBuilderAfterHeaderParameters(instance); + } + } + + public interface SetterForQueryParameters { + PostNullableRequest getInstance(); + T getBuilderAfterQueryParameters(PostNullableRequest instance); + default T queryParameters(Fakeparametercollisions1ababselfabPostQueryParameters.QueryParametersMap queryParameters) { + var instance = getInstance(); + instance.queryParameters = queryParameters; + return getBuilderAfterQueryParameters(instance); + } + } + + public interface SetterForCookieParameters { + PostNullableRequest getInstance(); + T getBuilderAfterCookieParameters(PostNullableRequest instance); + default T cookieParameters(Fakeparametercollisions1ababselfabPostCookieParameters.CookieParametersMap cookieParameters) { + var instance = getInstance(); + instance.cookieParameters = cookieParameters; + return getBuilderAfterCookieParameters(instance); + } + } + + public interface SetterForServerIndex { + PostNullableRequest getInstance(); + T getBuilderAfterServerIndex(PostNullableRequest instance); + default T serverIndex(RootServerInfo.ServerIndex serverIndex) { + var instance = getInstance(); + instance.serverIndex = serverIndex; + return getBuilderAfterServerIndex(instance); + } + } + + public interface SetterForTimeout { + PostNullableRequest getInstance(); + T getBuilderAfterTimeout(PostNullableRequest instance); + default T timeout(Duration timeout) { + var instance = getInstance(); + instance.timeout = timeout; + return getBuilderAfterTimeout(instance); + } + } + + public interface SetterForPathParameters { + PostNullableRequest getInstance(); + T getBuilderAfterPathParameters(PostNullableRequest instance); + default T pathParameters(Fakeparametercollisions1ababselfabPostPathParameters.PathParametersMap pathParameters) { + var instance = getInstance(); + instance.pathParameters = pathParameters; + return getBuilderAfterPathParameters(instance); + } + } + + public static class Post0RequestBuilder implements SetterForRequestBody, SetterForHeaderParameters, SetterForQueryParameters, SetterForCookieParameters, SetterForServerIndex, SetterForTimeout { + private final PostNullableRequest instance; + + public Post0RequestBuilder(PostNullableRequest instance) { + this.instance = instance; + } + + public PostRequest build() { + var pathParameters = instance.pathParameters; + if (pathParameters == null) { + throw new RuntimeException("invalid null value for required parameter"); + } + return new PostRequest( + pathParameters, + instance.requestBody, + instance.headerParameters, + instance.queryParameters, + instance.cookieParameters, + instance.serverIndex, + instance.timeout + ); + } + + public PostNullableRequest getInstance() { + return instance; + } + + public Post0RequestBuilder getBuilderAfterRequestBody(PostNullableRequest instance) { + return this; + } + + public Post0RequestBuilder getBuilderAfterHeaderParameters(PostNullableRequest instance) { + return this; + } + + public Post0RequestBuilder getBuilderAfterQueryParameters(PostNullableRequest instance) { + return this; + } + + public Post0RequestBuilder getBuilderAfterCookieParameters(PostNullableRequest instance) { + return this; + } + + public Post0RequestBuilder getBuilderAfterServerIndex(PostNullableRequest instance) { + return this; + } + + public Post0RequestBuilder getBuilderAfterTimeout(PostNullableRequest instance) { + return this; + } + } + public static class PostRequestBuilder implements SetterForPathParameters { + private final PostNullableRequest instance; + + public PostRequestBuilder() { + this.instance = new PostNullableRequest(); + } + + public PostNullableRequest getInstance() { + return instance; + } + + public Post0RequestBuilder getBuilderAfterPathParameters(PostNullableRequest instance) { + return new Post0RequestBuilder(instance); + } + } +} diff --git a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/fakeparametercollisions1ababselfab/post/Fakeparametercollisions1ababselfabPostCookieParameters.kt b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/fakeparametercollisions1ababselfab/post/Fakeparametercollisions1ababselfabPostCookieParameters.kt new file mode 100644 index 00000000000..58740e77f24 --- /dev/null +++ b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/fakeparametercollisions1ababselfab/post/Fakeparametercollisions1ababselfabPostCookieParameters.kt @@ -0,0 +1,286 @@ +package org.openapijsonschematools.client.paths.fakeparametercollisions1ababselfab.post; +import java.util.ArrayList; +import java.util.HashSet; +import java.util.LinkedHashMap; +import java.util.LinkedHashSet; +import java.util.List; +import java.util.Map; +import java.util.Objects; +import java.util.Set; +import org.checkerframework.checker.nullness.qual.Nullable; +import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags; +import org.openapijsonschematools.client.configurations.SchemaConfiguration; +import org.openapijsonschematools.client.exceptions.UnsetPropertyException; +import org.openapijsonschematools.client.exceptions.ValidationException; +import org.openapijsonschematools.client.paths.fakeparametercollisions1ababselfab.post.parameters.parameter14.Schema14; +import org.openapijsonschematools.client.paths.fakeparametercollisions1ababselfab.post.parameters.parameter15.Schema15; +import org.openapijsonschematools.client.paths.fakeparametercollisions1ababselfab.post.parameters.parameter16.Schema16; +import org.openapijsonschematools.client.paths.fakeparametercollisions1ababselfab.post.parameters.parameter17.Schema17; +import org.openapijsonschematools.client.paths.fakeparametercollisions1ababselfab.post.parameters.parameter18.Schema18; +import org.openapijsonschematools.client.schemas.AnyTypeJsonSchema; +import org.openapijsonschematools.client.schemas.GenericBuilder; +import org.openapijsonschematools.client.schemas.NotAnyTypeJsonSchema; +import org.openapijsonschematools.client.schemas.validation.FrozenMap; +import org.openapijsonschematools.client.schemas.validation.JsonSchema; +import org.openapijsonschematools.client.schemas.validation.JsonSchemaInfo; +import org.openapijsonschematools.client.schemas.validation.MapSchemaValidator; +import org.openapijsonschematools.client.schemas.validation.MapUtils; +import org.openapijsonschematools.client.schemas.validation.PathToSchemasMap; +import org.openapijsonschematools.client.schemas.validation.PropertyEntry; +import org.openapijsonschematools.client.schemas.validation.ValidationMetadata; + +public class Fakeparametercollisions1ababselfabPostCookieParameters { + // nest classes so all schemas and input/output classes can be public + + + public static class AdditionalProperties extends NotAnyTypeJsonSchema.NotAnyTypeJsonSchema1 { + // NotAnyTypeSchema + private static @Nullable AdditionalProperties instance = null; + public static AdditionalProperties getInstance() { + if (instance == null) { + instance = new AdditionalProperties(); + } + return instance; + } + } + + + public static class CookieParametersMap extends FrozenMap<@Nullable Object> { + protected CookieParametersMap(FrozenMap<@Nullable Object> m) { + super(m); + } + public static final Set requiredKeys = Set.of(); + public static final Set optionalKeys = Set.of( + "1", + "aB", + "Ab", + "A-B", + "self" + ); + public static CookieParametersMap of(Map arg, SchemaConfiguration configuration) throws ValidationException { + return Fakeparametercollisions1ababselfabPostCookieParameters1.getInstance().validate(arg, configuration); + } + + public String aB() throws UnsetPropertyException { + String key = "aB"; + throwIfKeyNotPresent(key); + @Nullable Object value = get(key); + if (!(value instanceof String)) { + throw new RuntimeException("Invalid value stored for aB"); + } + return (String) value; + } + + public String Ab() throws UnsetPropertyException { + String key = "Ab"; + throwIfKeyNotPresent(key); + @Nullable Object value = get(key); + if (!(value instanceof String)) { + throw new RuntimeException("Invalid value stored for Ab"); + } + return (String) value; + } + + public String self() throws UnsetPropertyException { + String key = "self"; + throwIfKeyNotPresent(key); + @Nullable Object value = get(key); + if (!(value instanceof String)) { + throw new RuntimeException("Invalid value stored for self"); + } + return (String) value; + } + } + + public interface SetterForSchema1 { + Map getInstance(); + T getBuilderAfterSchema1(Map instance); + + default T positive1(String value) { + var instance = getInstance(); + instance.put("1", value); + return getBuilderAfterSchema1(instance); + } + } + + public interface SetterForAB { + Map getInstance(); + T getBuilderAfterAB(Map instance); + + default T aB(String value) { + var instance = getInstance(); + instance.put("aB", value); + return getBuilderAfterAB(instance); + } + } + + public interface SetterForAb { + Map getInstance(); + T getBuilderAfterAb(Map instance); + + default T Ab(String value) { + var instance = getInstance(); + instance.put("Ab", value); + return getBuilderAfterAb(instance); + } + } + + public interface SetterForAB1 { + Map getInstance(); + T getBuilderAfterAB1(Map instance); + + default T aHyphenMinusB(String value) { + var instance = getInstance(); + instance.put("A-B", value); + return getBuilderAfterAB1(instance); + } + } + + public interface SetterForSelf { + Map getInstance(); + T getBuilderAfterSelf(Map instance); + + default T self(String value) { + var instance = getInstance(); + instance.put("self", value); + return getBuilderAfterSelf(instance); + } + } + + public static class CookieParametersMapBuilder implements GenericBuilder>, SetterForSchema1, SetterForAB, SetterForAb, SetterForAB1, SetterForSelf { + private final Map instance; + private static final Set knownKeys = Set.of( + "1", + "aB", + "Ab", + "A-B", + "self" + ); + public Set getKnownKeys() { + return knownKeys; + } + public CookieParametersMapBuilder() { + this.instance = new LinkedHashMap<>(); + } + public Map build() { + return instance; + } + public Map getInstance() { + return instance; + } + public CookieParametersMapBuilder getBuilderAfterSchema1(Map instance) { + return this; + } + public CookieParametersMapBuilder getBuilderAfterAB(Map instance) { + return this; + } + public CookieParametersMapBuilder getBuilderAfterAb(Map instance) { + return this; + } + public CookieParametersMapBuilder getBuilderAfterAB1(Map instance) { + return this; + } + public CookieParametersMapBuilder getBuilderAfterSelf(Map instance) { + return this; + } + } + + + public sealed interface Fakeparametercollisions1ababselfabPostCookieParameters1Boxed permits Fakeparametercollisions1ababselfabPostCookieParameters1BoxedMap { + @Nullable Object getData(); + } + + public record Fakeparametercollisions1ababselfabPostCookieParameters1BoxedMap(CookieParametersMap data) implements Fakeparametercollisions1ababselfabPostCookieParameters1Boxed { + @Override + public @Nullable Object getData() { + return data; + } + } + + + public static class Fakeparametercollisions1ababselfabPostCookieParameters1 extends JsonSchema implements MapSchemaValidator { + private static @Nullable Fakeparametercollisions1ababselfabPostCookieParameters1 instance = null; + + protected Fakeparametercollisions1ababselfabPostCookieParameters1() { + super(new JsonSchemaInfo() + .type(Set.of(Map.class)) + .properties(Map.ofEntries( + new PropertyEntry("1", Schema14.Schema141.class), + new PropertyEntry("aB", Schema15.Schema151.class), + new PropertyEntry("Ab", Schema16.Schema161.class), + new PropertyEntry("A-B", Schema18.Schema181.class), + new PropertyEntry("self", Schema17.Schema171.class) + )) + .additionalProperties(AdditionalProperties.class) + ); + } + + public static Fakeparametercollisions1ababselfabPostCookieParameters1 getInstance() { + if (instance == null) { + instance = new Fakeparametercollisions1ababselfabPostCookieParameters1(); + } + return instance; + } + + 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 RuntimeException("Invalid non-string key value"); + } + String propertyName = (String) entryKey; + List propertyPathToItem = new ArrayList<>(pathToItem); + propertyPathToItem.add(propertyName); + Object value = entry.getValue(); + LinkedHashMap, Nothing?> schemas = pathToSchemas.get(propertyPathToItem); + if (schemas == null) { + throw new RuntimeException("Validation result is invalid, schemas must exist for a pathToItem"); + } + JsonSchema propertySchema = schemas.entrySet().iterator().next().getKey(); + @Nullable Object propertyInstance = propertySchema.getNewInstance(value, propertyPathToItem, pathToSchemas); + properties.put(propertyName, propertyInstance); + } + FrozenMap<@Nullable Object> castProperties = new FrozenMap<>(properties); + return new CookieParametersMap(castProperties); + } + + 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); + SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().build())); + ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, new PathToSchemasMap(), new LinkedHashSet<>()); + PathToSchemasMap pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet); + return getNewInstance(castArg, validationMetadata.pathToItem(), pathToSchemasMap); + } + + + @Override + public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws 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"); + } + @Override + public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { + if (arg instanceof Map) { + return getNewInstance((Map) arg, pathToItem, pathToSchemas); + } + throw new RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); + } + @Override + public Fakeparametercollisions1ababselfabPostCookieParameters1BoxedMap validateAndBox(Map arg, SchemaConfiguration configuration) throws ValidationException { + return new Fakeparametercollisions1ababselfabPostCookieParameters1BoxedMap(validate(arg, configuration)); + } + @Override + public Fakeparametercollisions1ababselfabPostCookieParameters1Boxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { + 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"); + } + } + +} diff --git a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/fakeparametercollisions1ababselfab/post/Fakeparametercollisions1ababselfabPostHeaderParameters.kt b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/fakeparametercollisions1ababselfab/post/Fakeparametercollisions1ababselfabPostHeaderParameters.kt new file mode 100644 index 00000000000..82c97010a1a --- /dev/null +++ b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/fakeparametercollisions1ababselfab/post/Fakeparametercollisions1ababselfabPostHeaderParameters.kt @@ -0,0 +1,258 @@ +package org.openapijsonschematools.client.paths.fakeparametercollisions1ababselfab.post; +import java.util.ArrayList; +import java.util.HashSet; +import java.util.LinkedHashMap; +import java.util.LinkedHashSet; +import java.util.List; +import java.util.Map; +import java.util.Objects; +import java.util.Set; +import org.checkerframework.checker.nullness.qual.Nullable; +import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags; +import org.openapijsonschematools.client.configurations.SchemaConfiguration; +import org.openapijsonschematools.client.exceptions.UnsetPropertyException; +import org.openapijsonschematools.client.exceptions.ValidationException; +import org.openapijsonschematools.client.paths.fakeparametercollisions1ababselfab.post.parameters.parameter5.Schema5; +import org.openapijsonschematools.client.paths.fakeparametercollisions1ababselfab.post.parameters.parameter6.Schema6; +import org.openapijsonschematools.client.paths.fakeparametercollisions1ababselfab.post.parameters.parameter7.Schema7; +import org.openapijsonschematools.client.paths.fakeparametercollisions1ababselfab.post.parameters.parameter8.Schema8; +import org.openapijsonschematools.client.schemas.AnyTypeJsonSchema; +import org.openapijsonschematools.client.schemas.GenericBuilder; +import org.openapijsonschematools.client.schemas.NotAnyTypeJsonSchema; +import org.openapijsonschematools.client.schemas.validation.FrozenMap; +import org.openapijsonschematools.client.schemas.validation.JsonSchema; +import org.openapijsonschematools.client.schemas.validation.JsonSchemaInfo; +import org.openapijsonschematools.client.schemas.validation.MapSchemaValidator; +import org.openapijsonschematools.client.schemas.validation.MapUtils; +import org.openapijsonschematools.client.schemas.validation.PathToSchemasMap; +import org.openapijsonschematools.client.schemas.validation.PropertyEntry; +import org.openapijsonschematools.client.schemas.validation.ValidationMetadata; + +public class Fakeparametercollisions1ababselfabPostHeaderParameters { + // nest classes so all schemas and input/output classes can be public + + + public static class AdditionalProperties extends NotAnyTypeJsonSchema.NotAnyTypeJsonSchema1 { + // NotAnyTypeSchema + private static @Nullable AdditionalProperties instance = null; + public static AdditionalProperties getInstance() { + if (instance == null) { + instance = new AdditionalProperties(); + } + return instance; + } + } + + + public static class HeaderParametersMap extends FrozenMap<@Nullable Object> { + protected HeaderParametersMap(FrozenMap<@Nullable Object> m) { + super(m); + } + public static final Set requiredKeys = Set.of(); + public static final Set optionalKeys = Set.of( + "1", + "aB", + "A-B", + "self" + ); + public static HeaderParametersMap of(Map arg, SchemaConfiguration configuration) throws ValidationException { + return Fakeparametercollisions1ababselfabPostHeaderParameters1.getInstance().validate(arg, configuration); + } + + public String aB() throws UnsetPropertyException { + String key = "aB"; + throwIfKeyNotPresent(key); + @Nullable Object value = get(key); + if (!(value instanceof String)) { + throw new RuntimeException("Invalid value stored for aB"); + } + return (String) value; + } + + public String self() throws UnsetPropertyException { + String key = "self"; + throwIfKeyNotPresent(key); + @Nullable Object value = get(key); + if (!(value instanceof String)) { + throw new RuntimeException("Invalid value stored for self"); + } + return (String) value; + } + } + + public interface SetterForSchema1 { + Map getInstance(); + T getBuilderAfterSchema1(Map instance); + + default T positive1(String value) { + var instance = getInstance(); + instance.put("1", value); + return getBuilderAfterSchema1(instance); + } + } + + public interface SetterForAB { + Map getInstance(); + T getBuilderAfterAB(Map instance); + + default T aB(String value) { + var instance = getInstance(); + instance.put("aB", value); + return getBuilderAfterAB(instance); + } + } + + public interface SetterForAB1 { + Map getInstance(); + T getBuilderAfterAB1(Map instance); + + default T aHyphenMinusB(String value) { + var instance = getInstance(); + instance.put("A-B", value); + return getBuilderAfterAB1(instance); + } + } + + public interface SetterForSelf { + Map getInstance(); + T getBuilderAfterSelf(Map instance); + + default T self(String value) { + var instance = getInstance(); + instance.put("self", value); + return getBuilderAfterSelf(instance); + } + } + + public static class HeaderParametersMapBuilder implements GenericBuilder>, SetterForSchema1, SetterForAB, SetterForAB1, SetterForSelf { + private final Map instance; + private static final Set knownKeys = Set.of( + "1", + "aB", + "A-B", + "self" + ); + public Set getKnownKeys() { + return knownKeys; + } + public HeaderParametersMapBuilder() { + this.instance = new LinkedHashMap<>(); + } + public Map build() { + return instance; + } + public Map getInstance() { + return instance; + } + public HeaderParametersMapBuilder getBuilderAfterSchema1(Map instance) { + return this; + } + public HeaderParametersMapBuilder getBuilderAfterAB(Map instance) { + return this; + } + public HeaderParametersMapBuilder getBuilderAfterAB1(Map instance) { + return this; + } + public HeaderParametersMapBuilder getBuilderAfterSelf(Map instance) { + return this; + } + } + + + public sealed interface Fakeparametercollisions1ababselfabPostHeaderParameters1Boxed permits Fakeparametercollisions1ababselfabPostHeaderParameters1BoxedMap { + @Nullable Object getData(); + } + + public record Fakeparametercollisions1ababselfabPostHeaderParameters1BoxedMap(HeaderParametersMap data) implements Fakeparametercollisions1ababselfabPostHeaderParameters1Boxed { + @Override + public @Nullable Object getData() { + return data; + } + } + + + public static class Fakeparametercollisions1ababselfabPostHeaderParameters1 extends JsonSchema implements MapSchemaValidator { + private static @Nullable Fakeparametercollisions1ababselfabPostHeaderParameters1 instance = null; + + protected Fakeparametercollisions1ababselfabPostHeaderParameters1() { + super(new JsonSchemaInfo() + .type(Set.of(Map.class)) + .properties(Map.ofEntries( + new PropertyEntry("1", Schema5.Schema51.class), + new PropertyEntry("aB", Schema6.Schema61.class), + new PropertyEntry("A-B", Schema8.Schema81.class), + new PropertyEntry("self", Schema7.Schema71.class) + )) + .additionalProperties(AdditionalProperties.class) + ); + } + + public static Fakeparametercollisions1ababselfabPostHeaderParameters1 getInstance() { + if (instance == null) { + instance = new Fakeparametercollisions1ababselfabPostHeaderParameters1(); + } + return instance; + } + + 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 RuntimeException("Invalid non-string key value"); + } + String propertyName = (String) entryKey; + List propertyPathToItem = new ArrayList<>(pathToItem); + propertyPathToItem.add(propertyName); + Object value = entry.getValue(); + LinkedHashMap, Nothing?> schemas = pathToSchemas.get(propertyPathToItem); + if (schemas == null) { + throw new RuntimeException("Validation result is invalid, schemas must exist for a pathToItem"); + } + JsonSchema propertySchema = schemas.entrySet().iterator().next().getKey(); + @Nullable Object propertyInstance = propertySchema.getNewInstance(value, propertyPathToItem, pathToSchemas); + properties.put(propertyName, propertyInstance); + } + FrozenMap<@Nullable Object> castProperties = new FrozenMap<>(properties); + return new HeaderParametersMap(castProperties); + } + + 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); + SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().build())); + ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, new PathToSchemasMap(), new LinkedHashSet<>()); + PathToSchemasMap pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet); + return getNewInstance(castArg, validationMetadata.pathToItem(), pathToSchemasMap); + } + + + @Override + public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws 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"); + } + @Override + public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { + if (arg instanceof Map) { + return getNewInstance((Map) arg, pathToItem, pathToSchemas); + } + throw new RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); + } + @Override + public Fakeparametercollisions1ababselfabPostHeaderParameters1BoxedMap validateAndBox(Map arg, SchemaConfiguration configuration) throws ValidationException { + return new Fakeparametercollisions1ababselfabPostHeaderParameters1BoxedMap(validate(arg, configuration)); + } + @Override + public Fakeparametercollisions1ababselfabPostHeaderParameters1Boxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { + 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"); + } + } + +} diff --git a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/fakeparametercollisions1ababselfab/post/Fakeparametercollisions1ababselfabPostPathParameters.kt b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/fakeparametercollisions1ababselfab/post/Fakeparametercollisions1ababselfabPostPathParameters.kt new file mode 100644 index 00000000000..db3204d98b9 --- /dev/null +++ b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/fakeparametercollisions1ababselfab/post/Fakeparametercollisions1ababselfabPostPathParameters.kt @@ -0,0 +1,819 @@ +package org.openapijsonschematools.client.paths.fakeparametercollisions1ababselfab.post; +import java.util.ArrayList; +import java.util.HashSet; +import java.util.LinkedHashMap; +import java.util.LinkedHashSet; +import java.util.List; +import java.util.Map; +import java.util.Objects; +import java.util.Set; +import org.checkerframework.checker.nullness.qual.Nullable; +import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags; +import org.openapijsonschematools.client.configurations.SchemaConfiguration; +import org.openapijsonschematools.client.exceptions.UnsetPropertyException; +import org.openapijsonschematools.client.exceptions.ValidationException; +import org.openapijsonschematools.client.paths.fakeparametercollisions1ababselfab.post.parameters.parameter10.Schema10; +import org.openapijsonschematools.client.paths.fakeparametercollisions1ababselfab.post.parameters.parameter11.Schema11; +import org.openapijsonschematools.client.paths.fakeparametercollisions1ababselfab.post.parameters.parameter12.Schema12; +import org.openapijsonschematools.client.paths.fakeparametercollisions1ababselfab.post.parameters.parameter13.Schema13; +import org.openapijsonschematools.client.paths.fakeparametercollisions1ababselfab.post.parameters.parameter9.Schema9; +import org.openapijsonschematools.client.schemas.AnyTypeJsonSchema; +import org.openapijsonschematools.client.schemas.GenericBuilder; +import org.openapijsonschematools.client.schemas.NotAnyTypeJsonSchema; +import org.openapijsonschematools.client.schemas.validation.FrozenMap; +import org.openapijsonschematools.client.schemas.validation.JsonSchema; +import org.openapijsonschematools.client.schemas.validation.JsonSchemaInfo; +import org.openapijsonschematools.client.schemas.validation.MapSchemaValidator; +import org.openapijsonschematools.client.schemas.validation.MapUtils; +import org.openapijsonschematools.client.schemas.validation.PathToSchemasMap; +import org.openapijsonschematools.client.schemas.validation.PropertyEntry; +import org.openapijsonschematools.client.schemas.validation.ValidationMetadata; + +public class Fakeparametercollisions1ababselfabPostPathParameters { + // nest classes so all schemas and input/output classes can be public + + + public static class AdditionalProperties extends NotAnyTypeJsonSchema.NotAnyTypeJsonSchema1 { + // NotAnyTypeSchema + private static @Nullable AdditionalProperties instance = null; + public static AdditionalProperties getInstance() { + if (instance == null) { + instance = new AdditionalProperties(); + } + return instance; + } + } + + + public static class PathParametersMap extends FrozenMap<@Nullable Object> { + protected PathParametersMap(FrozenMap<@Nullable Object> m) { + super(m); + } + public static final Set requiredKeys = Set.of( + "1", + "A-B", + "Ab", + "aB", + "self" + ); + public static final Set optionalKeys = Set.of(); + public static PathParametersMap of(Map arg, SchemaConfiguration configuration) throws ValidationException { + return Fakeparametercollisions1ababselfabPostPathParameters1.getInstance().validate(arg, configuration); + } + + public String Ab() { + @Nullable Object value = get("Ab"); + if (!(value instanceof String)) { + throw new RuntimeException("Invalid value stored for Ab"); + } + return (String) value; + } + + public String aB() { + @Nullable Object value = get("aB"); + if (!(value instanceof String)) { + throw new RuntimeException("Invalid value stored for aB"); + } + return (String) value; + } + + public String self() { + @Nullable Object value = get("self"); + if (!(value instanceof String)) { + throw new RuntimeException("Invalid value stored for self"); + } + return (String) value; + } + } + + public interface SetterForSchema1 { + Map getInstance(); + T getBuilderAfterSchema1(Map instance); + + default T positive1(String value) { + var instance = getInstance(); + instance.put("1", value); + return getBuilderAfterSchema1(instance); + } + } + + public interface SetterForAB1 { + Map getInstance(); + T getBuilderAfterAB1(Map instance); + + default T aHyphenMinusB(String value) { + var instance = getInstance(); + instance.put("A-B", value); + return getBuilderAfterAB1(instance); + } + } + + public interface SetterForAb { + Map getInstance(); + T getBuilderAfterAb(Map instance); + + default T Ab(String value) { + var instance = getInstance(); + instance.put("Ab", value); + return getBuilderAfterAb(instance); + } + } + + public interface SetterForAB { + Map getInstance(); + T getBuilderAfterAB(Map instance); + + default T aB(String value) { + var instance = getInstance(); + instance.put("aB", value); + return getBuilderAfterAB(instance); + } + } + + public interface SetterForSelf { + Map getInstance(); + T getBuilderAfterSelf(Map instance); + + default T self(String value) { + var instance = getInstance(); + instance.put("self", value); + return getBuilderAfterSelf(instance); + } + } + + public static class PathParametersMap00000Builder implements GenericBuilder> { + private final Map instance; + private static final Set knownKeys = Set.of( + "1", + "A-B", + "Ab", + "aB", + "self" + ); + public Set getKnownKeys() { + return knownKeys; + } + public PathParametersMap00000Builder(Map instance) { + this.instance = instance; + } + public Map build() { + return instance; + } + } + + public static class PathParametersMap00001Builder implements SetterForSelf { + private final Map instance; + public PathParametersMap00001Builder(Map instance) { + this.instance = instance; + } + public Map getInstance() { + return instance; + } + public PathParametersMap00000Builder getBuilderAfterSelf(Map instance) { + return new PathParametersMap00000Builder(instance); + } + } + + public static class PathParametersMap00010Builder implements SetterForAB { + private final Map instance; + public PathParametersMap00010Builder(Map instance) { + this.instance = instance; + } + public Map getInstance() { + return instance; + } + public PathParametersMap00000Builder getBuilderAfterAB(Map instance) { + return new PathParametersMap00000Builder(instance); + } + } + + public static class PathParametersMap00011Builder implements SetterForAB, SetterForSelf { + private final Map instance; + public PathParametersMap00011Builder(Map instance) { + this.instance = instance; + } + public Map getInstance() { + return instance; + } + public PathParametersMap00001Builder getBuilderAfterAB(Map instance) { + return new PathParametersMap00001Builder(instance); + } + public PathParametersMap00010Builder getBuilderAfterSelf(Map instance) { + return new PathParametersMap00010Builder(instance); + } + } + + public static class PathParametersMap00100Builder implements SetterForAb { + private final Map instance; + public PathParametersMap00100Builder(Map instance) { + this.instance = instance; + } + public Map getInstance() { + return instance; + } + public PathParametersMap00000Builder getBuilderAfterAb(Map instance) { + return new PathParametersMap00000Builder(instance); + } + } + + public static class PathParametersMap00101Builder implements SetterForAb, SetterForSelf { + private final Map instance; + public PathParametersMap00101Builder(Map instance) { + this.instance = instance; + } + public Map getInstance() { + return instance; + } + public PathParametersMap00001Builder getBuilderAfterAb(Map instance) { + return new PathParametersMap00001Builder(instance); + } + public PathParametersMap00100Builder getBuilderAfterSelf(Map instance) { + return new PathParametersMap00100Builder(instance); + } + } + + public static class PathParametersMap00110Builder implements SetterForAb, SetterForAB { + private final Map instance; + public PathParametersMap00110Builder(Map instance) { + this.instance = instance; + } + public Map getInstance() { + return instance; + } + public PathParametersMap00010Builder getBuilderAfterAb(Map instance) { + return new PathParametersMap00010Builder(instance); + } + public PathParametersMap00100Builder getBuilderAfterAB(Map instance) { + return new PathParametersMap00100Builder(instance); + } + } + + public static class PathParametersMap00111Builder implements SetterForAb, SetterForAB, SetterForSelf { + private final Map instance; + public PathParametersMap00111Builder(Map instance) { + this.instance = instance; + } + public Map getInstance() { + return instance; + } + public PathParametersMap00011Builder getBuilderAfterAb(Map instance) { + return new PathParametersMap00011Builder(instance); + } + public PathParametersMap00101Builder getBuilderAfterAB(Map instance) { + return new PathParametersMap00101Builder(instance); + } + public PathParametersMap00110Builder getBuilderAfterSelf(Map instance) { + return new PathParametersMap00110Builder(instance); + } + } + + public static class PathParametersMap01000Builder implements SetterForAB1 { + private final Map instance; + public PathParametersMap01000Builder(Map instance) { + this.instance = instance; + } + public Map getInstance() { + return instance; + } + public PathParametersMap00000Builder getBuilderAfterAB1(Map instance) { + return new PathParametersMap00000Builder(instance); + } + } + + public static class PathParametersMap01001Builder implements SetterForAB1, SetterForSelf { + private final Map instance; + public PathParametersMap01001Builder(Map instance) { + this.instance = instance; + } + public Map getInstance() { + return instance; + } + public PathParametersMap00001Builder getBuilderAfterAB1(Map instance) { + return new PathParametersMap00001Builder(instance); + } + public PathParametersMap01000Builder getBuilderAfterSelf(Map instance) { + return new PathParametersMap01000Builder(instance); + } + } + + public static class PathParametersMap01010Builder implements SetterForAB1, SetterForAB { + private final Map instance; + public PathParametersMap01010Builder(Map instance) { + this.instance = instance; + } + public Map getInstance() { + return instance; + } + public PathParametersMap00010Builder getBuilderAfterAB1(Map instance) { + return new PathParametersMap00010Builder(instance); + } + public PathParametersMap01000Builder getBuilderAfterAB(Map instance) { + return new PathParametersMap01000Builder(instance); + } + } + + public static class PathParametersMap01011Builder implements SetterForAB1, SetterForAB, SetterForSelf { + private final Map instance; + public PathParametersMap01011Builder(Map instance) { + this.instance = instance; + } + public Map getInstance() { + return instance; + } + public PathParametersMap00011Builder getBuilderAfterAB1(Map instance) { + return new PathParametersMap00011Builder(instance); + } + public PathParametersMap01001Builder getBuilderAfterAB(Map instance) { + return new PathParametersMap01001Builder(instance); + } + public PathParametersMap01010Builder getBuilderAfterSelf(Map instance) { + return new PathParametersMap01010Builder(instance); + } + } + + public static class PathParametersMap01100Builder implements SetterForAB1, SetterForAb { + private final Map instance; + public PathParametersMap01100Builder(Map instance) { + this.instance = instance; + } + public Map getInstance() { + return instance; + } + public PathParametersMap00100Builder getBuilderAfterAB1(Map instance) { + return new PathParametersMap00100Builder(instance); + } + public PathParametersMap01000Builder getBuilderAfterAb(Map instance) { + return new PathParametersMap01000Builder(instance); + } + } + + public static class PathParametersMap01101Builder implements SetterForAB1, SetterForAb, SetterForSelf { + private final Map instance; + public PathParametersMap01101Builder(Map instance) { + this.instance = instance; + } + public Map getInstance() { + return instance; + } + public PathParametersMap00101Builder getBuilderAfterAB1(Map instance) { + return new PathParametersMap00101Builder(instance); + } + public PathParametersMap01001Builder getBuilderAfterAb(Map instance) { + return new PathParametersMap01001Builder(instance); + } + public PathParametersMap01100Builder getBuilderAfterSelf(Map instance) { + return new PathParametersMap01100Builder(instance); + } + } + + public static class PathParametersMap01110Builder implements SetterForAB1, SetterForAb, SetterForAB { + private final Map instance; + public PathParametersMap01110Builder(Map instance) { + this.instance = instance; + } + public Map getInstance() { + return instance; + } + public PathParametersMap00110Builder getBuilderAfterAB1(Map instance) { + return new PathParametersMap00110Builder(instance); + } + public PathParametersMap01010Builder getBuilderAfterAb(Map instance) { + return new PathParametersMap01010Builder(instance); + } + public PathParametersMap01100Builder getBuilderAfterAB(Map instance) { + return new PathParametersMap01100Builder(instance); + } + } + + public static class PathParametersMap01111Builder implements SetterForAB1, SetterForAb, SetterForAB, SetterForSelf { + private final Map instance; + public PathParametersMap01111Builder(Map instance) { + this.instance = instance; + } + public Map getInstance() { + return instance; + } + public PathParametersMap00111Builder getBuilderAfterAB1(Map instance) { + return new PathParametersMap00111Builder(instance); + } + public PathParametersMap01011Builder getBuilderAfterAb(Map instance) { + return new PathParametersMap01011Builder(instance); + } + public PathParametersMap01101Builder getBuilderAfterAB(Map instance) { + return new PathParametersMap01101Builder(instance); + } + public PathParametersMap01110Builder getBuilderAfterSelf(Map instance) { + return new PathParametersMap01110Builder(instance); + } + } + + public static class PathParametersMap10000Builder implements SetterForSchema1 { + private final Map instance; + public PathParametersMap10000Builder(Map instance) { + this.instance = instance; + } + public Map getInstance() { + return instance; + } + public PathParametersMap00000Builder getBuilderAfterSchema1(Map instance) { + return new PathParametersMap00000Builder(instance); + } + } + + public static class PathParametersMap10001Builder implements SetterForSchema1, SetterForSelf { + private final Map instance; + public PathParametersMap10001Builder(Map instance) { + this.instance = instance; + } + public Map getInstance() { + return instance; + } + public PathParametersMap00001Builder getBuilderAfterSchema1(Map instance) { + return new PathParametersMap00001Builder(instance); + } + public PathParametersMap10000Builder getBuilderAfterSelf(Map instance) { + return new PathParametersMap10000Builder(instance); + } + } + + public static class PathParametersMap10010Builder implements SetterForSchema1, SetterForAB { + private final Map instance; + public PathParametersMap10010Builder(Map instance) { + this.instance = instance; + } + public Map getInstance() { + return instance; + } + public PathParametersMap00010Builder getBuilderAfterSchema1(Map instance) { + return new PathParametersMap00010Builder(instance); + } + public PathParametersMap10000Builder getBuilderAfterAB(Map instance) { + return new PathParametersMap10000Builder(instance); + } + } + + public static class PathParametersMap10011Builder implements SetterForSchema1, SetterForAB, SetterForSelf { + private final Map instance; + public PathParametersMap10011Builder(Map instance) { + this.instance = instance; + } + public Map getInstance() { + return instance; + } + public PathParametersMap00011Builder getBuilderAfterSchema1(Map instance) { + return new PathParametersMap00011Builder(instance); + } + public PathParametersMap10001Builder getBuilderAfterAB(Map instance) { + return new PathParametersMap10001Builder(instance); + } + public PathParametersMap10010Builder getBuilderAfterSelf(Map instance) { + return new PathParametersMap10010Builder(instance); + } + } + + public static class PathParametersMap10100Builder implements SetterForSchema1, SetterForAb { + private final Map instance; + public PathParametersMap10100Builder(Map instance) { + this.instance = instance; + } + public Map getInstance() { + return instance; + } + public PathParametersMap00100Builder getBuilderAfterSchema1(Map instance) { + return new PathParametersMap00100Builder(instance); + } + public PathParametersMap10000Builder getBuilderAfterAb(Map instance) { + return new PathParametersMap10000Builder(instance); + } + } + + public static class PathParametersMap10101Builder implements SetterForSchema1, SetterForAb, SetterForSelf { + private final Map instance; + public PathParametersMap10101Builder(Map instance) { + this.instance = instance; + } + public Map getInstance() { + return instance; + } + public PathParametersMap00101Builder getBuilderAfterSchema1(Map instance) { + return new PathParametersMap00101Builder(instance); + } + public PathParametersMap10001Builder getBuilderAfterAb(Map instance) { + return new PathParametersMap10001Builder(instance); + } + public PathParametersMap10100Builder getBuilderAfterSelf(Map instance) { + return new PathParametersMap10100Builder(instance); + } + } + + public static class PathParametersMap10110Builder implements SetterForSchema1, SetterForAb, SetterForAB { + private final Map instance; + public PathParametersMap10110Builder(Map instance) { + this.instance = instance; + } + public Map getInstance() { + return instance; + } + public PathParametersMap00110Builder getBuilderAfterSchema1(Map instance) { + return new PathParametersMap00110Builder(instance); + } + public PathParametersMap10010Builder getBuilderAfterAb(Map instance) { + return new PathParametersMap10010Builder(instance); + } + public PathParametersMap10100Builder getBuilderAfterAB(Map instance) { + return new PathParametersMap10100Builder(instance); + } + } + + public static class PathParametersMap10111Builder implements SetterForSchema1, SetterForAb, SetterForAB, SetterForSelf { + private final Map instance; + public PathParametersMap10111Builder(Map instance) { + this.instance = instance; + } + public Map getInstance() { + return instance; + } + public PathParametersMap00111Builder getBuilderAfterSchema1(Map instance) { + return new PathParametersMap00111Builder(instance); + } + public PathParametersMap10011Builder getBuilderAfterAb(Map instance) { + return new PathParametersMap10011Builder(instance); + } + public PathParametersMap10101Builder getBuilderAfterAB(Map instance) { + return new PathParametersMap10101Builder(instance); + } + public PathParametersMap10110Builder getBuilderAfterSelf(Map instance) { + return new PathParametersMap10110Builder(instance); + } + } + + public static class PathParametersMap11000Builder implements SetterForSchema1, SetterForAB1 { + private final Map instance; + public PathParametersMap11000Builder(Map instance) { + this.instance = instance; + } + public Map getInstance() { + return instance; + } + public PathParametersMap01000Builder getBuilderAfterSchema1(Map instance) { + return new PathParametersMap01000Builder(instance); + } + public PathParametersMap10000Builder getBuilderAfterAB1(Map instance) { + return new PathParametersMap10000Builder(instance); + } + } + + public static class PathParametersMap11001Builder implements SetterForSchema1, SetterForAB1, SetterForSelf { + private final Map instance; + public PathParametersMap11001Builder(Map instance) { + this.instance = instance; + } + public Map getInstance() { + return instance; + } + public PathParametersMap01001Builder getBuilderAfterSchema1(Map instance) { + return new PathParametersMap01001Builder(instance); + } + public PathParametersMap10001Builder getBuilderAfterAB1(Map instance) { + return new PathParametersMap10001Builder(instance); + } + public PathParametersMap11000Builder getBuilderAfterSelf(Map instance) { + return new PathParametersMap11000Builder(instance); + } + } + + public static class PathParametersMap11010Builder implements SetterForSchema1, SetterForAB1, SetterForAB { + private final Map instance; + public PathParametersMap11010Builder(Map instance) { + this.instance = instance; + } + public Map getInstance() { + return instance; + } + public PathParametersMap01010Builder getBuilderAfterSchema1(Map instance) { + return new PathParametersMap01010Builder(instance); + } + public PathParametersMap10010Builder getBuilderAfterAB1(Map instance) { + return new PathParametersMap10010Builder(instance); + } + public PathParametersMap11000Builder getBuilderAfterAB(Map instance) { + return new PathParametersMap11000Builder(instance); + } + } + + public static class PathParametersMap11011Builder implements SetterForSchema1, SetterForAB1, SetterForAB, SetterForSelf { + private final Map instance; + public PathParametersMap11011Builder(Map instance) { + this.instance = instance; + } + public Map getInstance() { + return instance; + } + public PathParametersMap01011Builder getBuilderAfterSchema1(Map instance) { + return new PathParametersMap01011Builder(instance); + } + public PathParametersMap10011Builder getBuilderAfterAB1(Map instance) { + return new PathParametersMap10011Builder(instance); + } + public PathParametersMap11001Builder getBuilderAfterAB(Map instance) { + return new PathParametersMap11001Builder(instance); + } + public PathParametersMap11010Builder getBuilderAfterSelf(Map instance) { + return new PathParametersMap11010Builder(instance); + } + } + + public static class PathParametersMap11100Builder implements SetterForSchema1, SetterForAB1, SetterForAb { + private final Map instance; + public PathParametersMap11100Builder(Map instance) { + this.instance = instance; + } + public Map getInstance() { + return instance; + } + public PathParametersMap01100Builder getBuilderAfterSchema1(Map instance) { + return new PathParametersMap01100Builder(instance); + } + public PathParametersMap10100Builder getBuilderAfterAB1(Map instance) { + return new PathParametersMap10100Builder(instance); + } + public PathParametersMap11000Builder getBuilderAfterAb(Map instance) { + return new PathParametersMap11000Builder(instance); + } + } + + public static class PathParametersMap11101Builder implements SetterForSchema1, SetterForAB1, SetterForAb, SetterForSelf { + private final Map instance; + public PathParametersMap11101Builder(Map instance) { + this.instance = instance; + } + public Map getInstance() { + return instance; + } + public PathParametersMap01101Builder getBuilderAfterSchema1(Map instance) { + return new PathParametersMap01101Builder(instance); + } + public PathParametersMap10101Builder getBuilderAfterAB1(Map instance) { + return new PathParametersMap10101Builder(instance); + } + public PathParametersMap11001Builder getBuilderAfterAb(Map instance) { + return new PathParametersMap11001Builder(instance); + } + public PathParametersMap11100Builder getBuilderAfterSelf(Map instance) { + return new PathParametersMap11100Builder(instance); + } + } + + public static class PathParametersMap11110Builder implements SetterForSchema1, SetterForAB1, SetterForAb, SetterForAB { + private final Map instance; + public PathParametersMap11110Builder(Map instance) { + this.instance = instance; + } + public Map getInstance() { + return instance; + } + public PathParametersMap01110Builder getBuilderAfterSchema1(Map instance) { + return new PathParametersMap01110Builder(instance); + } + public PathParametersMap10110Builder getBuilderAfterAB1(Map instance) { + return new PathParametersMap10110Builder(instance); + } + public PathParametersMap11010Builder getBuilderAfterAb(Map instance) { + return new PathParametersMap11010Builder(instance); + } + public PathParametersMap11100Builder getBuilderAfterAB(Map instance) { + return new PathParametersMap11100Builder(instance); + } + } + + public static class PathParametersMapBuilder implements SetterForSchema1, SetterForAB1, SetterForAb, SetterForAB, SetterForSelf { + private final Map instance; + public PathParametersMapBuilder() { + this.instance = new LinkedHashMap<>(); + } + public Map getInstance() { + return instance; + } + public PathParametersMap01111Builder getBuilderAfterSchema1(Map instance) { + return new PathParametersMap01111Builder(instance); + } + public PathParametersMap10111Builder getBuilderAfterAB1(Map instance) { + return new PathParametersMap10111Builder(instance); + } + public PathParametersMap11011Builder getBuilderAfterAb(Map instance) { + return new PathParametersMap11011Builder(instance); + } + public PathParametersMap11101Builder getBuilderAfterAB(Map instance) { + return new PathParametersMap11101Builder(instance); + } + public PathParametersMap11110Builder getBuilderAfterSelf(Map instance) { + return new PathParametersMap11110Builder(instance); + } + } + + + public sealed interface Fakeparametercollisions1ababselfabPostPathParameters1Boxed permits Fakeparametercollisions1ababselfabPostPathParameters1BoxedMap { + @Nullable Object getData(); + } + + public record Fakeparametercollisions1ababselfabPostPathParameters1BoxedMap(PathParametersMap data) implements Fakeparametercollisions1ababselfabPostPathParameters1Boxed { + @Override + public @Nullable Object getData() { + return data; + } + } + + + public static class Fakeparametercollisions1ababselfabPostPathParameters1 extends JsonSchema implements MapSchemaValidator { + private static @Nullable Fakeparametercollisions1ababselfabPostPathParameters1 instance = null; + + protected Fakeparametercollisions1ababselfabPostPathParameters1() { + super(new JsonSchemaInfo() + .type(Set.of(Map.class)) + .properties(Map.ofEntries( + new PropertyEntry("1", Schema9.Schema91.class), + new PropertyEntry("aB", Schema10.Schema101.class), + new PropertyEntry("Ab", Schema11.Schema111.class), + new PropertyEntry("A-B", Schema13.Schema131.class), + new PropertyEntry("self", Schema12.Schema121.class) + )) + .required(Set.of( + "1", + "A-B", + "Ab", + "aB", + "self" + )) + .additionalProperties(AdditionalProperties.class) + ); + } + + public static Fakeparametercollisions1ababselfabPostPathParameters1 getInstance() { + if (instance == null) { + instance = new Fakeparametercollisions1ababselfabPostPathParameters1(); + } + return instance; + } + + 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 RuntimeException("Invalid non-string key value"); + } + String propertyName = (String) entryKey; + List propertyPathToItem = new ArrayList<>(pathToItem); + propertyPathToItem.add(propertyName); + Object value = entry.getValue(); + LinkedHashMap, Nothing?> schemas = pathToSchemas.get(propertyPathToItem); + if (schemas == null) { + throw new RuntimeException("Validation result is invalid, schemas must exist for a pathToItem"); + } + JsonSchema propertySchema = schemas.entrySet().iterator().next().getKey(); + @Nullable Object propertyInstance = propertySchema.getNewInstance(value, propertyPathToItem, pathToSchemas); + properties.put(propertyName, propertyInstance); + } + FrozenMap<@Nullable Object> castProperties = new FrozenMap<>(properties); + return new PathParametersMap(castProperties); + } + + 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); + SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().build())); + ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, new PathToSchemasMap(), new LinkedHashSet<>()); + PathToSchemasMap pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet); + return getNewInstance(castArg, validationMetadata.pathToItem(), pathToSchemasMap); + } + + + @Override + public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws 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"); + } + @Override + public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { + if (arg instanceof Map) { + return getNewInstance((Map) arg, pathToItem, pathToSchemas); + } + throw new RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); + } + @Override + public Fakeparametercollisions1ababselfabPostPathParameters1BoxedMap validateAndBox(Map arg, SchemaConfiguration configuration) throws ValidationException { + return new Fakeparametercollisions1ababselfabPostPathParameters1BoxedMap(validate(arg, configuration)); + } + @Override + public Fakeparametercollisions1ababselfabPostPathParameters1Boxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { + 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"); + } + } + +} diff --git a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/fakeparametercollisions1ababselfab/post/Fakeparametercollisions1ababselfabPostQueryParameters.kt b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/fakeparametercollisions1ababselfab/post/Fakeparametercollisions1ababselfabPostQueryParameters.kt new file mode 100644 index 00000000000..56a11aa79c6 --- /dev/null +++ b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/fakeparametercollisions1ababselfab/post/Fakeparametercollisions1ababselfabPostQueryParameters.kt @@ -0,0 +1,286 @@ +package org.openapijsonschematools.client.paths.fakeparametercollisions1ababselfab.post; +import java.util.ArrayList; +import java.util.HashSet; +import java.util.LinkedHashMap; +import java.util.LinkedHashSet; +import java.util.List; +import java.util.Map; +import java.util.Objects; +import java.util.Set; +import org.checkerframework.checker.nullness.qual.Nullable; +import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags; +import org.openapijsonschematools.client.configurations.SchemaConfiguration; +import org.openapijsonschematools.client.exceptions.UnsetPropertyException; +import org.openapijsonschematools.client.exceptions.ValidationException; +import org.openapijsonschematools.client.paths.fakeparametercollisions1ababselfab.post.parameters.parameter0.Schema0; +import org.openapijsonschematools.client.paths.fakeparametercollisions1ababselfab.post.parameters.parameter1.Schema1; +import org.openapijsonschematools.client.paths.fakeparametercollisions1ababselfab.post.parameters.parameter2.Schema2; +import org.openapijsonschematools.client.paths.fakeparametercollisions1ababselfab.post.parameters.parameter3.Schema3; +import org.openapijsonschematools.client.paths.fakeparametercollisions1ababselfab.post.parameters.parameter4.Schema4; +import org.openapijsonschematools.client.schemas.AnyTypeJsonSchema; +import org.openapijsonschematools.client.schemas.GenericBuilder; +import org.openapijsonschematools.client.schemas.NotAnyTypeJsonSchema; +import org.openapijsonschematools.client.schemas.validation.FrozenMap; +import org.openapijsonschematools.client.schemas.validation.JsonSchema; +import org.openapijsonschematools.client.schemas.validation.JsonSchemaInfo; +import org.openapijsonschematools.client.schemas.validation.MapSchemaValidator; +import org.openapijsonschematools.client.schemas.validation.MapUtils; +import org.openapijsonschematools.client.schemas.validation.PathToSchemasMap; +import org.openapijsonschematools.client.schemas.validation.PropertyEntry; +import org.openapijsonschematools.client.schemas.validation.ValidationMetadata; + +public class Fakeparametercollisions1ababselfabPostQueryParameters { + // nest classes so all schemas and input/output classes can be public + + + public static class AdditionalProperties extends NotAnyTypeJsonSchema.NotAnyTypeJsonSchema1 { + // NotAnyTypeSchema + private static @Nullable AdditionalProperties instance = null; + public static AdditionalProperties getInstance() { + if (instance == null) { + instance = new AdditionalProperties(); + } + return instance; + } + } + + + public static class QueryParametersMap extends FrozenMap<@Nullable Object> { + protected QueryParametersMap(FrozenMap<@Nullable Object> m) { + super(m); + } + public static final Set requiredKeys = Set.of(); + public static final Set optionalKeys = Set.of( + "1", + "aB", + "Ab", + "A-B", + "self" + ); + public static QueryParametersMap of(Map arg, SchemaConfiguration configuration) throws ValidationException { + return Fakeparametercollisions1ababselfabPostQueryParameters1.getInstance().validate(arg, configuration); + } + + public String aB() throws UnsetPropertyException { + String key = "aB"; + throwIfKeyNotPresent(key); + @Nullable Object value = get(key); + if (!(value instanceof String)) { + throw new RuntimeException("Invalid value stored for aB"); + } + return (String) value; + } + + public String Ab() throws UnsetPropertyException { + String key = "Ab"; + throwIfKeyNotPresent(key); + @Nullable Object value = get(key); + if (!(value instanceof String)) { + throw new RuntimeException("Invalid value stored for Ab"); + } + return (String) value; + } + + public String self() throws UnsetPropertyException { + String key = "self"; + throwIfKeyNotPresent(key); + @Nullable Object value = get(key); + if (!(value instanceof String)) { + throw new RuntimeException("Invalid value stored for self"); + } + return (String) value; + } + } + + public interface SetterForSchema1 { + Map getInstance(); + T getBuilderAfterSchema1(Map instance); + + default T positive1(String value) { + var instance = getInstance(); + instance.put("1", value); + return getBuilderAfterSchema1(instance); + } + } + + public interface SetterForAB { + Map getInstance(); + T getBuilderAfterAB(Map instance); + + default T aB(String value) { + var instance = getInstance(); + instance.put("aB", value); + return getBuilderAfterAB(instance); + } + } + + public interface SetterForAb { + Map getInstance(); + T getBuilderAfterAb(Map instance); + + default T Ab(String value) { + var instance = getInstance(); + instance.put("Ab", value); + return getBuilderAfterAb(instance); + } + } + + public interface SetterForAB1 { + Map getInstance(); + T getBuilderAfterAB1(Map instance); + + default T aHyphenMinusB(String value) { + var instance = getInstance(); + instance.put("A-B", value); + return getBuilderAfterAB1(instance); + } + } + + public interface SetterForSelf { + Map getInstance(); + T getBuilderAfterSelf(Map instance); + + default T self(String value) { + var instance = getInstance(); + instance.put("self", value); + return getBuilderAfterSelf(instance); + } + } + + public static class QueryParametersMapBuilder implements GenericBuilder>, SetterForSchema1, SetterForAB, SetterForAb, SetterForAB1, SetterForSelf { + private final Map instance; + private static final Set knownKeys = Set.of( + "1", + "aB", + "Ab", + "A-B", + "self" + ); + public Set getKnownKeys() { + return knownKeys; + } + public QueryParametersMapBuilder() { + this.instance = new LinkedHashMap<>(); + } + public Map build() { + return instance; + } + public Map getInstance() { + return instance; + } + public QueryParametersMapBuilder getBuilderAfterSchema1(Map instance) { + return this; + } + public QueryParametersMapBuilder getBuilderAfterAB(Map instance) { + return this; + } + public QueryParametersMapBuilder getBuilderAfterAb(Map instance) { + return this; + } + public QueryParametersMapBuilder getBuilderAfterAB1(Map instance) { + return this; + } + public QueryParametersMapBuilder getBuilderAfterSelf(Map instance) { + return this; + } + } + + + public sealed interface Fakeparametercollisions1ababselfabPostQueryParameters1Boxed permits Fakeparametercollisions1ababselfabPostQueryParameters1BoxedMap { + @Nullable Object getData(); + } + + public record Fakeparametercollisions1ababselfabPostQueryParameters1BoxedMap(QueryParametersMap data) implements Fakeparametercollisions1ababselfabPostQueryParameters1Boxed { + @Override + public @Nullable Object getData() { + return data; + } + } + + + public static class Fakeparametercollisions1ababselfabPostQueryParameters1 extends JsonSchema implements MapSchemaValidator { + private static @Nullable Fakeparametercollisions1ababselfabPostQueryParameters1 instance = null; + + protected Fakeparametercollisions1ababselfabPostQueryParameters1() { + super(new JsonSchemaInfo() + .type(Set.of(Map.class)) + .properties(Map.ofEntries( + new PropertyEntry("1", Schema0.Schema01.class), + new PropertyEntry("aB", Schema1.Schema11.class), + new PropertyEntry("Ab", Schema2.Schema21.class), + new PropertyEntry("A-B", Schema4.Schema41.class), + new PropertyEntry("self", Schema3.Schema31.class) + )) + .additionalProperties(AdditionalProperties.class) + ); + } + + public static Fakeparametercollisions1ababselfabPostQueryParameters1 getInstance() { + if (instance == null) { + instance = new Fakeparametercollisions1ababselfabPostQueryParameters1(); + } + return instance; + } + + 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 RuntimeException("Invalid non-string key value"); + } + String propertyName = (String) entryKey; + List propertyPathToItem = new ArrayList<>(pathToItem); + propertyPathToItem.add(propertyName); + Object value = entry.getValue(); + LinkedHashMap, Nothing?> schemas = pathToSchemas.get(propertyPathToItem); + if (schemas == null) { + throw new RuntimeException("Validation result is invalid, schemas must exist for a pathToItem"); + } + JsonSchema propertySchema = schemas.entrySet().iterator().next().getKey(); + @Nullable Object propertyInstance = propertySchema.getNewInstance(value, propertyPathToItem, pathToSchemas); + properties.put(propertyName, propertyInstance); + } + FrozenMap<@Nullable Object> castProperties = new FrozenMap<>(properties); + return new QueryParametersMap(castProperties); + } + + 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); + SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().build())); + ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, new PathToSchemasMap(), new LinkedHashSet<>()); + PathToSchemasMap pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet); + return getNewInstance(castArg, validationMetadata.pathToItem(), pathToSchemasMap); + } + + + @Override + public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws 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"); + } + @Override + public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { + if (arg instanceof Map) { + return getNewInstance((Map) arg, pathToItem, pathToSchemas); + } + throw new RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); + } + @Override + public Fakeparametercollisions1ababselfabPostQueryParameters1BoxedMap validateAndBox(Map arg, SchemaConfiguration configuration) throws ValidationException { + return new Fakeparametercollisions1ababselfabPostQueryParameters1BoxedMap(validate(arg, configuration)); + } + @Override + public Fakeparametercollisions1ababselfabPostQueryParameters1Boxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { + 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"); + } + } + +} diff --git a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/fakeparametercollisions1ababselfab/post/Fakeparametercollisions1ababselfabPostRequestBody.kt b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/fakeparametercollisions1ababselfab/post/Fakeparametercollisions1ababselfabPostRequestBody.kt new file mode 100644 index 00000000000..3e2d6ec3449 --- /dev/null +++ b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/fakeparametercollisions1ababselfab/post/Fakeparametercollisions1ababselfabPostRequestBody.kt @@ -0,0 +1,49 @@ +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; +import org.openapijsonschematools.client.mediatype.MediaType; +import org.openapijsonschematools.client.paths.fakeparametercollisions1ababselfab.post.requestbody.content.applicationjson.ApplicationjsonSchema; + +import java.util.AbstractMap; +import java.util.Map; + +public class Fakeparametercollisions1ababselfabPostRequestBody { + public sealed interface SealedMediaType permits ApplicationjsonMediaType {} + + public record ApplicationjsonMediaType(ApplicationjsonSchema.ApplicationjsonSchema1 schema) implements SealedMediaType, MediaType { + public ApplicationjsonMediaType() { + this(ApplicationjsonSchema.ApplicationjsonSchema1.getInstance()); + } + @Override + public Nothing? encoding() { + return null; + } + } + + public static class Fakeparametercollisions1ababselfabPostRequestBody1 extends RequestBodySerializer { + public Fakeparametercollisions1ababselfabPostRequestBody1() { + super( + Map.ofEntries( + new AbstractMap.SimpleEntry<>("application/json", new ApplicationjsonMediaType()) + ), + false + ); + } + + public SerializedRequestBody serialize(SealedRequestBody requestBody) throws NotImplementedException { + ApplicationjsonRequestBody requestBody0 = (ApplicationjsonRequestBody) requestBody; + return serialize(requestBody0.contentType(), requestBody0.body().getData()); + } + } + + public sealed interface SealedRequestBody permits ApplicationjsonRequestBody {} + public record ApplicationjsonRequestBody(ApplicationjsonSchema.AnyTypeJsonSchema1Boxed body) implements SealedRequestBody, GenericRequestBody { + @Override + public String contentType() { + return "application/json"; + } + } +} diff --git a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/fakeparametercollisions1ababselfab/post/Fakeparametercollisions1ababselfabPostResponses.kt b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/fakeparametercollisions1ababselfab/post/Fakeparametercollisions1ababselfabPostResponses.kt new file mode 100644 index 00000000000..9d0ddd74419 --- /dev/null +++ b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/fakeparametercollisions1ababselfab/post/Fakeparametercollisions1ababselfabPostResponses.kt @@ -0,0 +1,53 @@ +package org.openapijsonschematools.client.paths.fakeparametercollisions1ababselfab.post; + +import org.openapijsonschematools.client.paths.fakeparametercollisions1ababselfab.post.responses.Fakeparametercollisions1ababselfabPostCode200Response; +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; +import org.checkerframework.checker.nullness.qual.Nullable; + +import java.net.http.HttpResponse; +import java.util.Map; +import java.util.AbstractMap; + +public class Fakeparametercollisions1ababselfabPostResponses { + public sealed interface EndpointResponse permits EndpointFakeparametercollisions1ababselfabPostCode200Response {} + + public record EndpointFakeparametercollisions1ababselfabPostCode200Response( + HttpResponse response, + Fakeparametercollisions1ababselfabPostCode200Response.SealedResponseBody body, + Nothing? headers + ) implements EndpointResponse, ApiResponse{ + } + + public sealed interface StatusCodeResponseDeserializer permits StatusFakeparametercollisions1ababselfabPostCode200ResponseDeserializer {} + + public static final class StatusFakeparametercollisions1ababselfabPostCode200ResponseDeserializer extends Fakeparametercollisions1ababselfabPostCode200Response.Fakeparametercollisions1ababselfabPostCode200Response1 implements StatusCodeResponseDeserializer { + } + + public static final class Fakeparametercollisions1ababselfabPostResponses1 implements ResponsesDeserializer { + private final Map statusCodeToResponseDeserializer; + public Fakeparametercollisions1ababselfabPostResponses1() { + this.statusCodeToResponseDeserializer = Map.ofEntries( + new AbstractMap.SimpleEntry<>("200", new StatusFakeparametercollisions1ababselfabPostCode200ResponseDeserializer()) + ); + } + + 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) { + throw new ApiException( + "Invalid response statusCode="+statusCode+" has no response defined in the openapi document", + response + ); + } + StatusFakeparametercollisions1ababselfabPostCode200ResponseDeserializer castDeserializer = (StatusFakeparametercollisions1ababselfabPostCode200ResponseDeserializer) statusCodeDeserializer; + var deserializedResponse = castDeserializer.deserialize(response, configuration); + return new EndpointFakeparametercollisions1ababselfabPostCode200Response(response, deserializedResponse.body(), deserializedResponse.headers()); + } + } +} diff --git a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/fakeparametercollisions1ababselfab/post/Parameters.kt b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/fakeparametercollisions1ababselfab/post/Parameters.kt new file mode 100644 index 00000000000..6b1d6be5242 --- /dev/null +++ b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/fakeparametercollisions1ababselfab/post/Parameters.kt @@ -0,0 +1,86 @@ +package org.openapijsonschematools.client.paths.fakeparametercollisions1ababselfab.post; + +import org.openapijsonschematools.client.paths.fakeparametercollisions1ababselfab.post.parameters.Parameter0; +import org.openapijsonschematools.client.paths.fakeparametercollisions1ababselfab.post.parameters.Parameter1; +import org.openapijsonschematools.client.paths.fakeparametercollisions1ababselfab.post.parameters.Parameter2; +import org.openapijsonschematools.client.paths.fakeparametercollisions1ababselfab.post.parameters.Parameter3; +import org.openapijsonschematools.client.paths.fakeparametercollisions1ababselfab.post.parameters.Parameter4; +import org.openapijsonschematools.client.paths.fakeparametercollisions1ababselfab.post.parameters.Parameter5; +import org.openapijsonschematools.client.paths.fakeparametercollisions1ababselfab.post.parameters.Parameter6; +import org.openapijsonschematools.client.paths.fakeparametercollisions1ababselfab.post.parameters.Parameter7; +import org.openapijsonschematools.client.paths.fakeparametercollisions1ababselfab.post.parameters.Parameter8; +import org.openapijsonschematools.client.paths.fakeparametercollisions1ababselfab.post.parameters.Parameter9; +import org.openapijsonschematools.client.paths.fakeparametercollisions1ababselfab.post.parameters.Parameter10; +import org.openapijsonschematools.client.paths.fakeparametercollisions1ababselfab.post.parameters.Parameter11; +import org.openapijsonschematools.client.paths.fakeparametercollisions1ababselfab.post.parameters.Parameter12; +import org.openapijsonschematools.client.paths.fakeparametercollisions1ababselfab.post.parameters.Parameter13; +import org.openapijsonschematools.client.paths.fakeparametercollisions1ababselfab.post.parameters.Parameter14; +import org.openapijsonschematools.client.paths.fakeparametercollisions1ababselfab.post.parameters.Parameter15; +import org.openapijsonschematools.client.paths.fakeparametercollisions1ababselfab.post.parameters.Parameter16; +import org.openapijsonschematools.client.paths.fakeparametercollisions1ababselfab.post.parameters.Parameter17; +import org.openapijsonschematools.client.paths.fakeparametercollisions1ababselfab.post.parameters.Parameter18; +import org.openapijsonschematools.client.parameter.PathSerializer; +import org.openapijsonschematools.client.parameter.HeadersSerializer; +import org.openapijsonschematools.client.parameter.QuerySerializer; +import org.openapijsonschematools.client.parameter.CookieSerializer; + +import java.util.Map; +import java.util.AbstractMap; + +public class Parameters { + + public static class PathParametersSerializer extends PathSerializer { + public PathParametersSerializer() { + super( + Map.ofEntries( + new AbstractMap.SimpleEntry<>("1", new Parameter9.Parameter91()), + new AbstractMap.SimpleEntry<>("aB", new Parameter10.Parameter101()), + new AbstractMap.SimpleEntry<>("Ab", new Parameter11.Parameter111()), + new AbstractMap.SimpleEntry<>("self", new Parameter12.Parameter121()), + new AbstractMap.SimpleEntry<>("A-B", new Parameter13.Parameter131()) + ) + ); + } + } + + public static class QueryParametersSerializer extends QuerySerializer { + public QueryParametersSerializer() { + super( + Map.ofEntries( + new AbstractMap.SimpleEntry<>("1", new Parameter0.Parameter01()), + new AbstractMap.SimpleEntry<>("aB", new Parameter1.Parameter11()), + new AbstractMap.SimpleEntry<>("Ab", new Parameter2.Parameter21()), + new AbstractMap.SimpleEntry<>("self", new Parameter3.Parameter31()), + new AbstractMap.SimpleEntry<>("A-B", new Parameter4.Parameter41()) + ) + ); + } + } + + public static class HeaderParametersSerializer extends HeadersSerializer { + public HeaderParametersSerializer() { + super( + Map.ofEntries( + new AbstractMap.SimpleEntry<>("1", new Parameter5.Parameter51()), + new AbstractMap.SimpleEntry<>("aB", new Parameter6.Parameter61()), + new AbstractMap.SimpleEntry<>("self", new Parameter7.Parameter71()), + new AbstractMap.SimpleEntry<>("A-B", new Parameter8.Parameter81()) + ) + ); + } + } + + public static class CookieParametersSerializer extends CookieSerializer { + public CookieParametersSerializer() { + super( + Map.ofEntries( + new AbstractMap.SimpleEntry<>("1", new Parameter14.Parameter141()), + new AbstractMap.SimpleEntry<>("aB", new Parameter15.Parameter151()), + new AbstractMap.SimpleEntry<>("Ab", new Parameter16.Parameter161()), + new AbstractMap.SimpleEntry<>("self", new Parameter17.Parameter171()), + new AbstractMap.SimpleEntry<>("A-B", new Parameter18.Parameter181()) + ) + ); + } + } +} diff --git a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/fakeparametercollisions1ababselfab/post/parameters/Parameter0.kt b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/fakeparametercollisions1ababselfab/post/parameters/Parameter0.kt new file mode 100644 index 00000000000..a92fdc8a8c2 --- /dev/null +++ b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/fakeparametercollisions1ababselfab/post/parameters/Parameter0.kt @@ -0,0 +1,23 @@ +package org.openapijsonschematools.client.paths.fakeparametercollisions1ababselfab.post.parameters; + +import org.openapijsonschematools.client.parameter.ParameterStyle; +import org.openapijsonschematools.client.parameter.ParameterInType; +import org.openapijsonschematools.client.parameter.SchemaParameter; +import org.openapijsonschematools.client.paths.fakeparametercollisions1ababselfab.post.parameters.parameter0.Schema0; + +public class Parameter0 { + + public static class Parameter01 extends SchemaParameter { + public Parameter01() { + super( + "1", + ParameterInType.QUERY, + false, + ParameterStyle.FORM, + true, + false, + Schema0.Schema01.getInstance() + ); + } + } +} diff --git a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/fakeparametercollisions1ababselfab/post/parameters/Parameter1.kt b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/fakeparametercollisions1ababselfab/post/parameters/Parameter1.kt new file mode 100644 index 00000000000..f630ae29b8f --- /dev/null +++ b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/fakeparametercollisions1ababselfab/post/parameters/Parameter1.kt @@ -0,0 +1,23 @@ +package org.openapijsonschematools.client.paths.fakeparametercollisions1ababselfab.post.parameters; + +import org.openapijsonschematools.client.parameter.ParameterStyle; +import org.openapijsonschematools.client.parameter.ParameterInType; +import org.openapijsonschematools.client.parameter.SchemaParameter; +import org.openapijsonschematools.client.paths.fakeparametercollisions1ababselfab.post.parameters.parameter1.Schema1; + +public class Parameter1 { + + public static class Parameter11 extends SchemaParameter { + public Parameter11() { + super( + "aB", + ParameterInType.QUERY, + false, + ParameterStyle.FORM, + true, + false, + Schema1.Schema11.getInstance() + ); + } + } +} diff --git a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/fakeparametercollisions1ababselfab/post/parameters/Parameter10.kt b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/fakeparametercollisions1ababselfab/post/parameters/Parameter10.kt new file mode 100644 index 00000000000..0aa44d3eda8 --- /dev/null +++ b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/fakeparametercollisions1ababselfab/post/parameters/Parameter10.kt @@ -0,0 +1,23 @@ +package org.openapijsonschematools.client.paths.fakeparametercollisions1ababselfab.post.parameters; + +import org.openapijsonschematools.client.parameter.ParameterStyle; +import org.openapijsonschematools.client.parameter.ParameterInType; +import org.openapijsonschematools.client.parameter.SchemaParameter; +import org.openapijsonschematools.client.paths.fakeparametercollisions1ababselfab.post.parameters.parameter10.Schema10; + +public class Parameter10 { + + public static class Parameter101 extends SchemaParameter { + public Parameter101() { + super( + "aB", + ParameterInType.PATH, + true, + ParameterStyle.SIMPLE, + false, + false, + Schema10.Schema101.getInstance() + ); + } + } +} diff --git a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/fakeparametercollisions1ababselfab/post/parameters/Parameter11.kt b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/fakeparametercollisions1ababselfab/post/parameters/Parameter11.kt new file mode 100644 index 00000000000..a86856ac32b --- /dev/null +++ b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/fakeparametercollisions1ababselfab/post/parameters/Parameter11.kt @@ -0,0 +1,23 @@ +package org.openapijsonschematools.client.paths.fakeparametercollisions1ababselfab.post.parameters; + +import org.openapijsonschematools.client.parameter.ParameterStyle; +import org.openapijsonschematools.client.parameter.ParameterInType; +import org.openapijsonschematools.client.parameter.SchemaParameter; +import org.openapijsonschematools.client.paths.fakeparametercollisions1ababselfab.post.parameters.parameter11.Schema11; + +public class Parameter11 { + + public static class Parameter111 extends SchemaParameter { + public Parameter111() { + super( + "Ab", + ParameterInType.PATH, + true, + ParameterStyle.SIMPLE, + false, + false, + Schema11.Schema111.getInstance() + ); + } + } +} diff --git a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/fakeparametercollisions1ababselfab/post/parameters/Parameter12.kt b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/fakeparametercollisions1ababselfab/post/parameters/Parameter12.kt new file mode 100644 index 00000000000..ee76bac70af --- /dev/null +++ b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/fakeparametercollisions1ababselfab/post/parameters/Parameter12.kt @@ -0,0 +1,23 @@ +package org.openapijsonschematools.client.paths.fakeparametercollisions1ababselfab.post.parameters; + +import org.openapijsonschematools.client.parameter.ParameterStyle; +import org.openapijsonschematools.client.parameter.ParameterInType; +import org.openapijsonschematools.client.parameter.SchemaParameter; +import org.openapijsonschematools.client.paths.fakeparametercollisions1ababselfab.post.parameters.parameter12.Schema12; + +public class Parameter12 { + + public static class Parameter121 extends SchemaParameter { + public Parameter121() { + super( + "self", + ParameterInType.PATH, + true, + ParameterStyle.SIMPLE, + false, + false, + Schema12.Schema121.getInstance() + ); + } + } +} diff --git a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/fakeparametercollisions1ababselfab/post/parameters/Parameter13.kt b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/fakeparametercollisions1ababselfab/post/parameters/Parameter13.kt new file mode 100644 index 00000000000..de212f1563d --- /dev/null +++ b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/fakeparametercollisions1ababselfab/post/parameters/Parameter13.kt @@ -0,0 +1,23 @@ +package org.openapijsonschematools.client.paths.fakeparametercollisions1ababselfab.post.parameters; + +import org.openapijsonschematools.client.parameter.ParameterStyle; +import org.openapijsonschematools.client.parameter.ParameterInType; +import org.openapijsonschematools.client.parameter.SchemaParameter; +import org.openapijsonschematools.client.paths.fakeparametercollisions1ababselfab.post.parameters.parameter13.Schema13; + +public class Parameter13 { + + public static class Parameter131 extends SchemaParameter { + public Parameter131() { + super( + "A-B", + ParameterInType.PATH, + true, + ParameterStyle.SIMPLE, + false, + false, + Schema13.Schema131.getInstance() + ); + } + } +} diff --git a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/fakeparametercollisions1ababselfab/post/parameters/Parameter14.kt b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/fakeparametercollisions1ababselfab/post/parameters/Parameter14.kt new file mode 100644 index 00000000000..a29010916ac --- /dev/null +++ b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/fakeparametercollisions1ababselfab/post/parameters/Parameter14.kt @@ -0,0 +1,23 @@ +package org.openapijsonschematools.client.paths.fakeparametercollisions1ababselfab.post.parameters; + +import org.openapijsonschematools.client.parameter.ParameterStyle; +import org.openapijsonschematools.client.parameter.ParameterInType; +import org.openapijsonschematools.client.parameter.SchemaParameter; +import org.openapijsonschematools.client.paths.fakeparametercollisions1ababselfab.post.parameters.parameter14.Schema14; + +public class Parameter14 { + + public static class Parameter141 extends SchemaParameter { + public Parameter141() { + super( + "1", + ParameterInType.COOKIE, + false, + ParameterStyle.FORM, + true, + false, + Schema14.Schema141.getInstance() + ); + } + } +} diff --git a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/fakeparametercollisions1ababselfab/post/parameters/Parameter15.kt b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/fakeparametercollisions1ababselfab/post/parameters/Parameter15.kt new file mode 100644 index 00000000000..54bf5140899 --- /dev/null +++ b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/fakeparametercollisions1ababselfab/post/parameters/Parameter15.kt @@ -0,0 +1,23 @@ +package org.openapijsonschematools.client.paths.fakeparametercollisions1ababselfab.post.parameters; + +import org.openapijsonschematools.client.parameter.ParameterStyle; +import org.openapijsonschematools.client.parameter.ParameterInType; +import org.openapijsonschematools.client.parameter.SchemaParameter; +import org.openapijsonschematools.client.paths.fakeparametercollisions1ababselfab.post.parameters.parameter15.Schema15; + +public class Parameter15 { + + public static class Parameter151 extends SchemaParameter { + public Parameter151() { + super( + "aB", + ParameterInType.COOKIE, + false, + ParameterStyle.FORM, + true, + false, + Schema15.Schema151.getInstance() + ); + } + } +} diff --git a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/fakeparametercollisions1ababselfab/post/parameters/Parameter16.kt b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/fakeparametercollisions1ababselfab/post/parameters/Parameter16.kt new file mode 100644 index 00000000000..f1b8e71d686 --- /dev/null +++ b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/fakeparametercollisions1ababselfab/post/parameters/Parameter16.kt @@ -0,0 +1,23 @@ +package org.openapijsonschematools.client.paths.fakeparametercollisions1ababselfab.post.parameters; + +import org.openapijsonschematools.client.parameter.ParameterStyle; +import org.openapijsonschematools.client.parameter.ParameterInType; +import org.openapijsonschematools.client.parameter.SchemaParameter; +import org.openapijsonschematools.client.paths.fakeparametercollisions1ababselfab.post.parameters.parameter16.Schema16; + +public class Parameter16 { + + public static class Parameter161 extends SchemaParameter { + public Parameter161() { + super( + "Ab", + ParameterInType.COOKIE, + false, + ParameterStyle.FORM, + true, + false, + Schema16.Schema161.getInstance() + ); + } + } +} diff --git a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/fakeparametercollisions1ababselfab/post/parameters/Parameter17.kt b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/fakeparametercollisions1ababselfab/post/parameters/Parameter17.kt new file mode 100644 index 00000000000..b856a27eb1e --- /dev/null +++ b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/fakeparametercollisions1ababselfab/post/parameters/Parameter17.kt @@ -0,0 +1,23 @@ +package org.openapijsonschematools.client.paths.fakeparametercollisions1ababselfab.post.parameters; + +import org.openapijsonschematools.client.parameter.ParameterStyle; +import org.openapijsonschematools.client.parameter.ParameterInType; +import org.openapijsonschematools.client.parameter.SchemaParameter; +import org.openapijsonschematools.client.paths.fakeparametercollisions1ababselfab.post.parameters.parameter17.Schema17; + +public class Parameter17 { + + public static class Parameter171 extends SchemaParameter { + public Parameter171() { + super( + "self", + ParameterInType.COOKIE, + false, + ParameterStyle.FORM, + true, + false, + Schema17.Schema171.getInstance() + ); + } + } +} diff --git a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/fakeparametercollisions1ababselfab/post/parameters/Parameter18.kt b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/fakeparametercollisions1ababselfab/post/parameters/Parameter18.kt new file mode 100644 index 00000000000..b43ebbe5664 --- /dev/null +++ b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/fakeparametercollisions1ababselfab/post/parameters/Parameter18.kt @@ -0,0 +1,23 @@ +package org.openapijsonschematools.client.paths.fakeparametercollisions1ababselfab.post.parameters; + +import org.openapijsonschematools.client.parameter.ParameterStyle; +import org.openapijsonschematools.client.parameter.ParameterInType; +import org.openapijsonschematools.client.parameter.SchemaParameter; +import org.openapijsonschematools.client.paths.fakeparametercollisions1ababselfab.post.parameters.parameter18.Schema18; + +public class Parameter18 { + + public static class Parameter181 extends SchemaParameter { + public Parameter181() { + super( + "A-B", + ParameterInType.COOKIE, + false, + ParameterStyle.FORM, + true, + false, + Schema18.Schema181.getInstance() + ); + } + } +} diff --git a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/fakeparametercollisions1ababselfab/post/parameters/Parameter2.kt b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/fakeparametercollisions1ababselfab/post/parameters/Parameter2.kt new file mode 100644 index 00000000000..bb193d95ba3 --- /dev/null +++ b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/fakeparametercollisions1ababselfab/post/parameters/Parameter2.kt @@ -0,0 +1,23 @@ +package org.openapijsonschematools.client.paths.fakeparametercollisions1ababselfab.post.parameters; + +import org.openapijsonschematools.client.parameter.ParameterStyle; +import org.openapijsonschematools.client.parameter.ParameterInType; +import org.openapijsonschematools.client.parameter.SchemaParameter; +import org.openapijsonschematools.client.paths.fakeparametercollisions1ababselfab.post.parameters.parameter2.Schema2; + +public class Parameter2 { + + public static class Parameter21 extends SchemaParameter { + public Parameter21() { + super( + "Ab", + ParameterInType.QUERY, + false, + ParameterStyle.FORM, + true, + false, + Schema2.Schema21.getInstance() + ); + } + } +} diff --git a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/fakeparametercollisions1ababselfab/post/parameters/Parameter3.kt b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/fakeparametercollisions1ababselfab/post/parameters/Parameter3.kt new file mode 100644 index 00000000000..b4233c96a02 --- /dev/null +++ b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/fakeparametercollisions1ababselfab/post/parameters/Parameter3.kt @@ -0,0 +1,23 @@ +package org.openapijsonschematools.client.paths.fakeparametercollisions1ababselfab.post.parameters; + +import org.openapijsonschematools.client.parameter.ParameterStyle; +import org.openapijsonschematools.client.parameter.ParameterInType; +import org.openapijsonschematools.client.parameter.SchemaParameter; +import org.openapijsonschematools.client.paths.fakeparametercollisions1ababselfab.post.parameters.parameter3.Schema3; + +public class Parameter3 { + + public static class Parameter31 extends SchemaParameter { + public Parameter31() { + super( + "self", + ParameterInType.QUERY, + false, + ParameterStyle.FORM, + true, + false, + Schema3.Schema31.getInstance() + ); + } + } +} diff --git a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/fakeparametercollisions1ababselfab/post/parameters/Parameter4.kt b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/fakeparametercollisions1ababselfab/post/parameters/Parameter4.kt new file mode 100644 index 00000000000..459cdc6a234 --- /dev/null +++ b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/fakeparametercollisions1ababselfab/post/parameters/Parameter4.kt @@ -0,0 +1,23 @@ +package org.openapijsonschematools.client.paths.fakeparametercollisions1ababselfab.post.parameters; + +import org.openapijsonschematools.client.parameter.ParameterStyle; +import org.openapijsonschematools.client.parameter.ParameterInType; +import org.openapijsonschematools.client.parameter.SchemaParameter; +import org.openapijsonschematools.client.paths.fakeparametercollisions1ababselfab.post.parameters.parameter4.Schema4; + +public class Parameter4 { + + public static class Parameter41 extends SchemaParameter { + public Parameter41() { + super( + "A-B", + ParameterInType.QUERY, + false, + ParameterStyle.FORM, + true, + false, + Schema4.Schema41.getInstance() + ); + } + } +} diff --git a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/fakeparametercollisions1ababselfab/post/parameters/Parameter5.kt b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/fakeparametercollisions1ababselfab/post/parameters/Parameter5.kt new file mode 100644 index 00000000000..a589c0c385b --- /dev/null +++ b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/fakeparametercollisions1ababselfab/post/parameters/Parameter5.kt @@ -0,0 +1,23 @@ +package org.openapijsonschematools.client.paths.fakeparametercollisions1ababselfab.post.parameters; + +import org.openapijsonschematools.client.parameter.ParameterStyle; +import org.openapijsonschematools.client.parameter.ParameterInType; +import org.openapijsonschematools.client.parameter.SchemaParameter; +import org.openapijsonschematools.client.paths.fakeparametercollisions1ababselfab.post.parameters.parameter5.Schema5; + +public class Parameter5 { + + public static class Parameter51 extends SchemaParameter { + public Parameter51() { + super( + "1", + ParameterInType.HEADER, + false, + ParameterStyle.SIMPLE, + false, + false, + Schema5.Schema51.getInstance() + ); + } + } +} diff --git a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/fakeparametercollisions1ababselfab/post/parameters/Parameter6.kt b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/fakeparametercollisions1ababselfab/post/parameters/Parameter6.kt new file mode 100644 index 00000000000..dafa85cb493 --- /dev/null +++ b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/fakeparametercollisions1ababselfab/post/parameters/Parameter6.kt @@ -0,0 +1,23 @@ +package org.openapijsonschematools.client.paths.fakeparametercollisions1ababselfab.post.parameters; + +import org.openapijsonschematools.client.parameter.ParameterStyle; +import org.openapijsonschematools.client.parameter.ParameterInType; +import org.openapijsonschematools.client.parameter.SchemaParameter; +import org.openapijsonschematools.client.paths.fakeparametercollisions1ababselfab.post.parameters.parameter6.Schema6; + +public class Parameter6 { + + public static class Parameter61 extends SchemaParameter { + public Parameter61() { + super( + "aB", + ParameterInType.HEADER, + false, + ParameterStyle.SIMPLE, + false, + false, + Schema6.Schema61.getInstance() + ); + } + } +} diff --git a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/fakeparametercollisions1ababselfab/post/parameters/Parameter7.kt b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/fakeparametercollisions1ababselfab/post/parameters/Parameter7.kt new file mode 100644 index 00000000000..9d5589c95e6 --- /dev/null +++ b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/fakeparametercollisions1ababselfab/post/parameters/Parameter7.kt @@ -0,0 +1,23 @@ +package org.openapijsonschematools.client.paths.fakeparametercollisions1ababselfab.post.parameters; + +import org.openapijsonschematools.client.parameter.ParameterStyle; +import org.openapijsonschematools.client.parameter.ParameterInType; +import org.openapijsonschematools.client.parameter.SchemaParameter; +import org.openapijsonschematools.client.paths.fakeparametercollisions1ababselfab.post.parameters.parameter7.Schema7; + +public class Parameter7 { + + public static class Parameter71 extends SchemaParameter { + public Parameter71() { + super( + "self", + ParameterInType.HEADER, + false, + ParameterStyle.SIMPLE, + false, + false, + Schema7.Schema71.getInstance() + ); + } + } +} diff --git a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/fakeparametercollisions1ababselfab/post/parameters/Parameter8.kt b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/fakeparametercollisions1ababselfab/post/parameters/Parameter8.kt new file mode 100644 index 00000000000..259cab30459 --- /dev/null +++ b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/fakeparametercollisions1ababselfab/post/parameters/Parameter8.kt @@ -0,0 +1,23 @@ +package org.openapijsonschematools.client.paths.fakeparametercollisions1ababselfab.post.parameters; + +import org.openapijsonschematools.client.parameter.ParameterStyle; +import org.openapijsonschematools.client.parameter.ParameterInType; +import org.openapijsonschematools.client.parameter.SchemaParameter; +import org.openapijsonschematools.client.paths.fakeparametercollisions1ababselfab.post.parameters.parameter8.Schema8; + +public class Parameter8 { + + public static class Parameter81 extends SchemaParameter { + public Parameter81() { + super( + "A-B", + ParameterInType.HEADER, + false, + ParameterStyle.SIMPLE, + false, + false, + Schema8.Schema81.getInstance() + ); + } + } +} diff --git a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/fakeparametercollisions1ababselfab/post/parameters/Parameter9.kt b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/fakeparametercollisions1ababselfab/post/parameters/Parameter9.kt new file mode 100644 index 00000000000..450bbdbfc8d --- /dev/null +++ b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/fakeparametercollisions1ababselfab/post/parameters/Parameter9.kt @@ -0,0 +1,23 @@ +package org.openapijsonschematools.client.paths.fakeparametercollisions1ababselfab.post.parameters; + +import org.openapijsonschematools.client.parameter.ParameterStyle; +import org.openapijsonschematools.client.parameter.ParameterInType; +import org.openapijsonschematools.client.parameter.SchemaParameter; +import org.openapijsonschematools.client.paths.fakeparametercollisions1ababselfab.post.parameters.parameter9.Schema9; + +public class Parameter9 { + + public static class Parameter91 extends SchemaParameter { + public Parameter91() { + super( + "1", + ParameterInType.PATH, + true, + ParameterStyle.SIMPLE, + false, + false, + Schema9.Schema91.getInstance() + ); + } + } +} diff --git a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/fakeparametercollisions1ababselfab/post/parameters/parameter0/Schema0.kt b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/fakeparametercollisions1ababselfab/post/parameters/parameter0/Schema0.kt new file mode 100644 index 00000000000..0de8ca499eb --- /dev/null +++ b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/fakeparametercollisions1ababselfab/post/parameters/parameter0/Schema0.kt @@ -0,0 +1,19 @@ +package org.openapijsonschematools.client.paths.fakeparametercollisions1ababselfab.post.parameters.parameter0; +import org.checkerframework.checker.nullness.qual.Nullable; +import org.openapijsonschematools.client.schemas.StringJsonSchema; + +public class Schema0 extends StringJsonSchema { + // nest classes so all schemas and input/output classes can be public + + + public static class Schema01 extends StringJsonSchema.StringJsonSchema1 { + private static @Nullable Schema01 instance = null; + public static Schema01 getInstance() { + if (instance == null) { + instance = new Schema01(); + } + return instance; + } + } + +} diff --git a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/fakeparametercollisions1ababselfab/post/parameters/parameter1/Schema1.kt b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/fakeparametercollisions1ababselfab/post/parameters/parameter1/Schema1.kt new file mode 100644 index 00000000000..bc5b4d4e46b --- /dev/null +++ b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/fakeparametercollisions1ababselfab/post/parameters/parameter1/Schema1.kt @@ -0,0 +1,19 @@ +package org.openapijsonschematools.client.paths.fakeparametercollisions1ababselfab.post.parameters.parameter1; +import org.checkerframework.checker.nullness.qual.Nullable; +import org.openapijsonschematools.client.schemas.StringJsonSchema; + +public class Schema1 extends StringJsonSchema { + // nest classes so all schemas and input/output classes can be public + + + public static class Schema11 extends StringJsonSchema.StringJsonSchema1 { + private static @Nullable Schema11 instance = null; + public static Schema11 getInstance() { + if (instance == null) { + instance = new Schema11(); + } + return instance; + } + } + +} diff --git a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/fakeparametercollisions1ababselfab/post/parameters/parameter10/Schema10.kt b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/fakeparametercollisions1ababselfab/post/parameters/parameter10/Schema10.kt new file mode 100644 index 00000000000..dbf0ed076f7 --- /dev/null +++ b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/fakeparametercollisions1ababselfab/post/parameters/parameter10/Schema10.kt @@ -0,0 +1,19 @@ +package org.openapijsonschematools.client.paths.fakeparametercollisions1ababselfab.post.parameters.parameter10; +import org.checkerframework.checker.nullness.qual.Nullable; +import org.openapijsonschematools.client.schemas.StringJsonSchema; + +public class Schema10 extends StringJsonSchema { + // nest classes so all schemas and input/output classes can be public + + + public static class Schema101 extends StringJsonSchema.StringJsonSchema1 { + private static @Nullable Schema101 instance = null; + public static Schema101 getInstance() { + if (instance == null) { + instance = new Schema101(); + } + return instance; + } + } + +} diff --git a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/fakeparametercollisions1ababselfab/post/parameters/parameter11/Schema11.kt b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/fakeparametercollisions1ababselfab/post/parameters/parameter11/Schema11.kt new file mode 100644 index 00000000000..910dbc61dfd --- /dev/null +++ b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/fakeparametercollisions1ababselfab/post/parameters/parameter11/Schema11.kt @@ -0,0 +1,19 @@ +package org.openapijsonschematools.client.paths.fakeparametercollisions1ababselfab.post.parameters.parameter11; +import org.checkerframework.checker.nullness.qual.Nullable; +import org.openapijsonschematools.client.schemas.StringJsonSchema; + +public class Schema11 extends StringJsonSchema { + // nest classes so all schemas and input/output classes can be public + + + public static class Schema111 extends StringJsonSchema.StringJsonSchema1 { + private static @Nullable Schema111 instance = null; + public static Schema111 getInstance() { + if (instance == null) { + instance = new Schema111(); + } + return instance; + } + } + +} diff --git a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/fakeparametercollisions1ababselfab/post/parameters/parameter12/Schema12.kt b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/fakeparametercollisions1ababselfab/post/parameters/parameter12/Schema12.kt new file mode 100644 index 00000000000..fc04e87b2f8 --- /dev/null +++ b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/fakeparametercollisions1ababselfab/post/parameters/parameter12/Schema12.kt @@ -0,0 +1,19 @@ +package org.openapijsonschematools.client.paths.fakeparametercollisions1ababselfab.post.parameters.parameter12; +import org.checkerframework.checker.nullness.qual.Nullable; +import org.openapijsonschematools.client.schemas.StringJsonSchema; + +public class Schema12 extends StringJsonSchema { + // nest classes so all schemas and input/output classes can be public + + + public static class Schema121 extends StringJsonSchema.StringJsonSchema1 { + private static @Nullable Schema121 instance = null; + public static Schema121 getInstance() { + if (instance == null) { + instance = new Schema121(); + } + return instance; + } + } + +} diff --git a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/fakeparametercollisions1ababselfab/post/parameters/parameter13/Schema13.kt b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/fakeparametercollisions1ababselfab/post/parameters/parameter13/Schema13.kt new file mode 100644 index 00000000000..22022466c4c --- /dev/null +++ b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/fakeparametercollisions1ababselfab/post/parameters/parameter13/Schema13.kt @@ -0,0 +1,19 @@ +package org.openapijsonschematools.client.paths.fakeparametercollisions1ababselfab.post.parameters.parameter13; +import org.checkerframework.checker.nullness.qual.Nullable; +import org.openapijsonschematools.client.schemas.StringJsonSchema; + +public class Schema13 extends StringJsonSchema { + // nest classes so all schemas and input/output classes can be public + + + public static class Schema131 extends StringJsonSchema.StringJsonSchema1 { + private static @Nullable Schema131 instance = null; + public static Schema131 getInstance() { + if (instance == null) { + instance = new Schema131(); + } + return instance; + } + } + +} diff --git a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/fakeparametercollisions1ababselfab/post/parameters/parameter14/Schema14.kt b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/fakeparametercollisions1ababselfab/post/parameters/parameter14/Schema14.kt new file mode 100644 index 00000000000..3f5d7772daf --- /dev/null +++ b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/fakeparametercollisions1ababselfab/post/parameters/parameter14/Schema14.kt @@ -0,0 +1,19 @@ +package org.openapijsonschematools.client.paths.fakeparametercollisions1ababselfab.post.parameters.parameter14; +import org.checkerframework.checker.nullness.qual.Nullable; +import org.openapijsonschematools.client.schemas.StringJsonSchema; + +public class Schema14 extends StringJsonSchema { + // nest classes so all schemas and input/output classes can be public + + + public static class Schema141 extends StringJsonSchema.StringJsonSchema1 { + private static @Nullable Schema141 instance = null; + public static Schema141 getInstance() { + if (instance == null) { + instance = new Schema141(); + } + return instance; + } + } + +} diff --git a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/fakeparametercollisions1ababselfab/post/parameters/parameter15/Schema15.kt b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/fakeparametercollisions1ababselfab/post/parameters/parameter15/Schema15.kt new file mode 100644 index 00000000000..3242acd48bc --- /dev/null +++ b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/fakeparametercollisions1ababselfab/post/parameters/parameter15/Schema15.kt @@ -0,0 +1,19 @@ +package org.openapijsonschematools.client.paths.fakeparametercollisions1ababselfab.post.parameters.parameter15; +import org.checkerframework.checker.nullness.qual.Nullable; +import org.openapijsonschematools.client.schemas.StringJsonSchema; + +public class Schema15 extends StringJsonSchema { + // nest classes so all schemas and input/output classes can be public + + + public static class Schema151 extends StringJsonSchema.StringJsonSchema1 { + private static @Nullable Schema151 instance = null; + public static Schema151 getInstance() { + if (instance == null) { + instance = new Schema151(); + } + return instance; + } + } + +} diff --git a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/fakeparametercollisions1ababselfab/post/parameters/parameter16/Schema16.kt b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/fakeparametercollisions1ababselfab/post/parameters/parameter16/Schema16.kt new file mode 100644 index 00000000000..185b383c86b --- /dev/null +++ b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/fakeparametercollisions1ababselfab/post/parameters/parameter16/Schema16.kt @@ -0,0 +1,19 @@ +package org.openapijsonschematools.client.paths.fakeparametercollisions1ababselfab.post.parameters.parameter16; +import org.checkerframework.checker.nullness.qual.Nullable; +import org.openapijsonschematools.client.schemas.StringJsonSchema; + +public class Schema16 extends StringJsonSchema { + // nest classes so all schemas and input/output classes can be public + + + public static class Schema161 extends StringJsonSchema.StringJsonSchema1 { + private static @Nullable Schema161 instance = null; + public static Schema161 getInstance() { + if (instance == null) { + instance = new Schema161(); + } + return instance; + } + } + +} diff --git a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/fakeparametercollisions1ababselfab/post/parameters/parameter17/Schema17.kt b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/fakeparametercollisions1ababselfab/post/parameters/parameter17/Schema17.kt new file mode 100644 index 00000000000..227874f5a09 --- /dev/null +++ b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/fakeparametercollisions1ababselfab/post/parameters/parameter17/Schema17.kt @@ -0,0 +1,19 @@ +package org.openapijsonschematools.client.paths.fakeparametercollisions1ababselfab.post.parameters.parameter17; +import org.checkerframework.checker.nullness.qual.Nullable; +import org.openapijsonschematools.client.schemas.StringJsonSchema; + +public class Schema17 extends StringJsonSchema { + // nest classes so all schemas and input/output classes can be public + + + public static class Schema171 extends StringJsonSchema.StringJsonSchema1 { + private static @Nullable Schema171 instance = null; + public static Schema171 getInstance() { + if (instance == null) { + instance = new Schema171(); + } + return instance; + } + } + +} diff --git a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/fakeparametercollisions1ababselfab/post/parameters/parameter18/Schema18.kt b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/fakeparametercollisions1ababselfab/post/parameters/parameter18/Schema18.kt new file mode 100644 index 00000000000..dc0578087e4 --- /dev/null +++ b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/fakeparametercollisions1ababselfab/post/parameters/parameter18/Schema18.kt @@ -0,0 +1,19 @@ +package org.openapijsonschematools.client.paths.fakeparametercollisions1ababselfab.post.parameters.parameter18; +import org.checkerframework.checker.nullness.qual.Nullable; +import org.openapijsonschematools.client.schemas.StringJsonSchema; + +public class Schema18 extends StringJsonSchema { + // nest classes so all schemas and input/output classes can be public + + + public static class Schema181 extends StringJsonSchema.StringJsonSchema1 { + private static @Nullable Schema181 instance = null; + public static Schema181 getInstance() { + if (instance == null) { + instance = new Schema181(); + } + return instance; + } + } + +} diff --git a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/fakeparametercollisions1ababselfab/post/parameters/parameter2/Schema2.kt b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/fakeparametercollisions1ababselfab/post/parameters/parameter2/Schema2.kt new file mode 100644 index 00000000000..0b74b673d7d --- /dev/null +++ b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/fakeparametercollisions1ababselfab/post/parameters/parameter2/Schema2.kt @@ -0,0 +1,19 @@ +package org.openapijsonschematools.client.paths.fakeparametercollisions1ababselfab.post.parameters.parameter2; +import org.checkerframework.checker.nullness.qual.Nullable; +import org.openapijsonschematools.client.schemas.StringJsonSchema; + +public class Schema2 extends StringJsonSchema { + // nest classes so all schemas and input/output classes can be public + + + public static class Schema21 extends StringJsonSchema.StringJsonSchema1 { + private static @Nullable Schema21 instance = null; + public static Schema21 getInstance() { + if (instance == null) { + instance = new Schema21(); + } + return instance; + } + } + +} diff --git a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/fakeparametercollisions1ababselfab/post/parameters/parameter3/Schema3.kt b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/fakeparametercollisions1ababselfab/post/parameters/parameter3/Schema3.kt new file mode 100644 index 00000000000..1fc6abc98d8 --- /dev/null +++ b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/fakeparametercollisions1ababselfab/post/parameters/parameter3/Schema3.kt @@ -0,0 +1,19 @@ +package org.openapijsonschematools.client.paths.fakeparametercollisions1ababselfab.post.parameters.parameter3; +import org.checkerframework.checker.nullness.qual.Nullable; +import org.openapijsonschematools.client.schemas.StringJsonSchema; + +public class Schema3 extends StringJsonSchema { + // nest classes so all schemas and input/output classes can be public + + + public static class Schema31 extends StringJsonSchema.StringJsonSchema1 { + private static @Nullable Schema31 instance = null; + public static Schema31 getInstance() { + if (instance == null) { + instance = new Schema31(); + } + return instance; + } + } + +} diff --git a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/fakeparametercollisions1ababselfab/post/parameters/parameter4/Schema4.kt b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/fakeparametercollisions1ababselfab/post/parameters/parameter4/Schema4.kt new file mode 100644 index 00000000000..d853e72abf0 --- /dev/null +++ b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/fakeparametercollisions1ababselfab/post/parameters/parameter4/Schema4.kt @@ -0,0 +1,19 @@ +package org.openapijsonschematools.client.paths.fakeparametercollisions1ababselfab.post.parameters.parameter4; +import org.checkerframework.checker.nullness.qual.Nullable; +import org.openapijsonschematools.client.schemas.StringJsonSchema; + +public class Schema4 extends StringJsonSchema { + // nest classes so all schemas and input/output classes can be public + + + public static class Schema41 extends StringJsonSchema.StringJsonSchema1 { + private static @Nullable Schema41 instance = null; + public static Schema41 getInstance() { + if (instance == null) { + instance = new Schema41(); + } + return instance; + } + } + +} diff --git a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/fakeparametercollisions1ababselfab/post/parameters/parameter5/Schema5.kt b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/fakeparametercollisions1ababselfab/post/parameters/parameter5/Schema5.kt new file mode 100644 index 00000000000..46b9065a054 --- /dev/null +++ b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/fakeparametercollisions1ababselfab/post/parameters/parameter5/Schema5.kt @@ -0,0 +1,19 @@ +package org.openapijsonschematools.client.paths.fakeparametercollisions1ababselfab.post.parameters.parameter5; +import org.checkerframework.checker.nullness.qual.Nullable; +import org.openapijsonschematools.client.schemas.StringJsonSchema; + +public class Schema5 extends StringJsonSchema { + // nest classes so all schemas and input/output classes can be public + + + public static class Schema51 extends StringJsonSchema.StringJsonSchema1 { + private static @Nullable Schema51 instance = null; + public static Schema51 getInstance() { + if (instance == null) { + instance = new Schema51(); + } + return instance; + } + } + +} diff --git a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/fakeparametercollisions1ababselfab/post/parameters/parameter6/Schema6.kt b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/fakeparametercollisions1ababselfab/post/parameters/parameter6/Schema6.kt new file mode 100644 index 00000000000..8d9b2537445 --- /dev/null +++ b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/fakeparametercollisions1ababselfab/post/parameters/parameter6/Schema6.kt @@ -0,0 +1,19 @@ +package org.openapijsonschematools.client.paths.fakeparametercollisions1ababselfab.post.parameters.parameter6; +import org.checkerframework.checker.nullness.qual.Nullable; +import org.openapijsonschematools.client.schemas.StringJsonSchema; + +public class Schema6 extends StringJsonSchema { + // nest classes so all schemas and input/output classes can be public + + + public static class Schema61 extends StringJsonSchema.StringJsonSchema1 { + private static @Nullable Schema61 instance = null; + public static Schema61 getInstance() { + if (instance == null) { + instance = new Schema61(); + } + return instance; + } + } + +} diff --git a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/fakeparametercollisions1ababselfab/post/parameters/parameter7/Schema7.kt b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/fakeparametercollisions1ababselfab/post/parameters/parameter7/Schema7.kt new file mode 100644 index 00000000000..dd7706f9c60 --- /dev/null +++ b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/fakeparametercollisions1ababselfab/post/parameters/parameter7/Schema7.kt @@ -0,0 +1,19 @@ +package org.openapijsonschematools.client.paths.fakeparametercollisions1ababselfab.post.parameters.parameter7; +import org.checkerframework.checker.nullness.qual.Nullable; +import org.openapijsonschematools.client.schemas.StringJsonSchema; + +public class Schema7 extends StringJsonSchema { + // nest classes so all schemas and input/output classes can be public + + + public static class Schema71 extends StringJsonSchema.StringJsonSchema1 { + private static @Nullable Schema71 instance = null; + public static Schema71 getInstance() { + if (instance == null) { + instance = new Schema71(); + } + return instance; + } + } + +} diff --git a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/fakeparametercollisions1ababselfab/post/parameters/parameter8/Schema8.kt b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/fakeparametercollisions1ababselfab/post/parameters/parameter8/Schema8.kt new file mode 100644 index 00000000000..23df1c2744c --- /dev/null +++ b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/fakeparametercollisions1ababselfab/post/parameters/parameter8/Schema8.kt @@ -0,0 +1,19 @@ +package org.openapijsonschematools.client.paths.fakeparametercollisions1ababselfab.post.parameters.parameter8; +import org.checkerframework.checker.nullness.qual.Nullable; +import org.openapijsonschematools.client.schemas.StringJsonSchema; + +public class Schema8 extends StringJsonSchema { + // nest classes so all schemas and input/output classes can be public + + + public static class Schema81 extends StringJsonSchema.StringJsonSchema1 { + private static @Nullable Schema81 instance = null; + public static Schema81 getInstance() { + if (instance == null) { + instance = new Schema81(); + } + return instance; + } + } + +} diff --git a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/fakeparametercollisions1ababselfab/post/parameters/parameter9/Schema9.kt b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/fakeparametercollisions1ababselfab/post/parameters/parameter9/Schema9.kt new file mode 100644 index 00000000000..1b334c178e1 --- /dev/null +++ b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/fakeparametercollisions1ababselfab/post/parameters/parameter9/Schema9.kt @@ -0,0 +1,19 @@ +package org.openapijsonschematools.client.paths.fakeparametercollisions1ababselfab.post.parameters.parameter9; +import org.checkerframework.checker.nullness.qual.Nullable; +import org.openapijsonschematools.client.schemas.StringJsonSchema; + +public class Schema9 extends StringJsonSchema { + // nest classes so all schemas and input/output classes can be public + + + public static class Schema91 extends StringJsonSchema.StringJsonSchema1 { + private static @Nullable Schema91 instance = null; + public static Schema91 getInstance() { + if (instance == null) { + instance = new Schema91(); + } + return instance; + } + } + +} diff --git a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/fakeparametercollisions1ababselfab/post/requestbody/content/applicationjson/ApplicationjsonSchema.kt b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/fakeparametercollisions1ababselfab/post/requestbody/content/applicationjson/ApplicationjsonSchema.kt new file mode 100644 index 00000000000..b67706b3437 --- /dev/null +++ b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/fakeparametercollisions1ababselfab/post/requestbody/content/applicationjson/ApplicationjsonSchema.kt @@ -0,0 +1,19 @@ +package org.openapijsonschematools.client.paths.fakeparametercollisions1ababselfab.post.requestbody.content.applicationjson; +import org.checkerframework.checker.nullness.qual.Nullable; +import org.openapijsonschematools.client.schemas.AnyTypeJsonSchema; + +public class ApplicationjsonSchema extends AnyTypeJsonSchema { + // nest classes so all schemas and input/output classes can be public + + + public static class ApplicationjsonSchema1 extends AnyTypeJsonSchema.AnyTypeJsonSchema1 { + private static @Nullable ApplicationjsonSchema1 instance = null; + public static ApplicationjsonSchema1 getInstance() { + if (instance == null) { + instance = new ApplicationjsonSchema1(); + } + return instance; + } + } + +} diff --git a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/fakeparametercollisions1ababselfab/post/responses/Fakeparametercollisions1ababselfabPostCode200Response.kt b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/fakeparametercollisions1ababselfab/post/responses/Fakeparametercollisions1ababselfabPostCode200Response.kt new file mode 100644 index 00000000000..27bd226bc25 --- /dev/null +++ b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/fakeparametercollisions1ababselfab/post/responses/Fakeparametercollisions1ababselfabPostCode200Response.kt @@ -0,0 +1,63 @@ +package org.openapijsonschematools.client.paths.fakeparametercollisions1ababselfab.post.responses; + +import org.openapijsonschematools.client.configurations.SchemaConfiguration; +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; + +import java.util.AbstractMap; +import java.util.Map; +import java.net.http.HttpResponse; +import java.net.http.HttpHeaders; + +public class Fakeparametercollisions1ababselfabPostCode200Response { + public sealed interface SealedMediaType permits ApplicationjsonMediaType {} + + public record ApplicationjsonMediaType(ApplicationjsonSchema.ApplicationjsonSchema1 schema) implements SealedMediaType, MediaType { + public ApplicationjsonMediaType() { + this(ApplicationjsonSchema.ApplicationjsonSchema1.getInstance()); + } + @Override + public Nothing? encoding() { + return null; + } + } + public sealed interface SealedResponseBody permits ApplicationjsonResponseBody {} + public record ApplicationjsonResponseBody(ApplicationjsonSchema.AnyTypeJsonSchema1Boxed body) implements SealedResponseBody { } + + public static class Fakeparametercollisions1ababselfabPostCode200Response1 extends ResponseDeserializer { + public Fakeparametercollisions1ababselfabPostCode200Response1() { + super( + Map.ofEntries( + new AbstractMap.SimpleEntry<>("application/json", new ApplicationjsonMediaType()) + ) + ); + } + + @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); + } + + @Override + protected Nothing? getHeaders(HttpHeaders headers, SchemaConfiguration configuration) { + return null; + } + } + + @SuppressWarnings("serial") + public static class ResponseApiException extends ApiException { + public DeserializedHttpResponse deserializedResponse; + + public ResponseApiException(String s, HttpResponse response, DeserializedHttpResponse deserializedResponse) { + super(s, response); + this.deserializedResponse = deserializedResponse; + } + } +} diff --git a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/fakeparametercollisions1ababselfab/post/responses/code200response/content/applicationjson/ApplicationjsonSchema.kt b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/fakeparametercollisions1ababselfab/post/responses/code200response/content/applicationjson/ApplicationjsonSchema.kt new file mode 100644 index 00000000000..bb2a30a2a2e --- /dev/null +++ b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/fakeparametercollisions1ababselfab/post/responses/code200response/content/applicationjson/ApplicationjsonSchema.kt @@ -0,0 +1,19 @@ +package org.openapijsonschematools.client.paths.fakeparametercollisions1ababselfab.post.responses.code200response.content.applicationjson; +import org.checkerframework.checker.nullness.qual.Nullable; +import org.openapijsonschematools.client.schemas.AnyTypeJsonSchema; + +public class ApplicationjsonSchema extends AnyTypeJsonSchema { + // nest classes so all schemas and input/output classes can be public + + + public static class ApplicationjsonSchema1 extends AnyTypeJsonSchema.AnyTypeJsonSchema1 { + private static @Nullable ApplicationjsonSchema1 instance = null; + public static ApplicationjsonSchema1 getInstance() { + if (instance == null) { + instance = new ApplicationjsonSchema1(); + } + return instance; + } + } + +} diff --git a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/fakepemcontenttype/FakepemcontenttypeGet.kt b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/fakepemcontenttype/FakepemcontenttypeGet.kt new file mode 100644 index 00000000000..5c627fe0093 --- /dev/null +++ b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/fakepemcontenttype/FakepemcontenttypeGet.kt @@ -0,0 +1,152 @@ +package org.openapijsonschematools.client.paths.fakepemcontenttype; + +import org.checkerframework.checker.nullness.qual.Nullable; +import org.openapijsonschematools.client.paths.fakepemcontenttype.get.FakepemcontenttypeGetRequestBody; +import org.openapijsonschematools.client.RootServerInfo; +import org.openapijsonschematools.client.paths.fakepemcontenttype.get.FakepemcontenttypeGetResponses; +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.requestbody.SerializedRequestBody; +import org.openapijsonschematools.client.paths.Fakepemcontenttype; + +import java.io.IOException; +import java.util.ArrayList; +import java.net.http.HttpClient; +import java.net.http.HttpRequest; +import java.time.Duration; +import java.util.List; +import java.util.Map; + +public class FakepemcontenttypeGet { + private static class GetProvider { + private static final String method = "get"; + + public static FakepemcontenttypeGetResponses.EndpointResponse get( + GetRequest request, + ApiConfiguration apiConfiguration, + SchemaConfiguration schemaConfiguration, + HttpClient client + ) throws IOException, InterruptedException, ValidationException, NotImplementedException, ApiException { + Map> headers = apiConfiguration.getDefaultHeaders(); + + @Nullable SerializedRequestBody serializedRequestBody; + HttpRequest.BodyPublisher bodyPublisher = HttpRequest.BodyPublishers.noBody(); + if (request.requestBody != null) { + serializedRequestBody = new FakepemcontenttypeGetRequestBody.FakepemcontenttypeGetRequestBody1().serialize( + request.requestBody + ); + var contentTypeHeaderValues = headers.getOrDefault("Content-Type", new ArrayList<>()); + contentTypeHeaderValues.add(serializedRequestBody.contentType); + bodyPublisher = serializedRequestBody.bodyPublisher; + } + // TODO set this to a map if there is a query security scheme + @Nullable Map queryMap = null; + String host = apiConfiguration.getServer(request.serverIndex).url(); + + String url = host + Fakepemcontenttype.path; + var httpRequest = RestClient.getRequest( + url, + method, + bodyPublisher, + headers, + request.timeout + ); + var response = RestClient.getResponse(httpRequest, client); + var responsesDeserializer = new FakepemcontenttypeGetResponses.FakepemcontenttypeGetResponses1(); + return responsesDeserializer.deserialize(response, schemaConfiguration); + } + } + + public interface GetOperation { + ApiConfiguration getApiConfiguration(); + SchemaConfiguration getSchemaConfiguration(); + HttpClient getClient(); + default FakepemcontenttypeGetResponses.EndpointResponse get(GetRequest request) throws IOException, InterruptedException, ValidationException, NotImplementedException, ApiException { + return GetProvider.get(request, getApiConfiguration(), getSchemaConfiguration(), getClient()); + } + } + + public interface PemContentTypeOperation { + ApiConfiguration getApiConfiguration(); + SchemaConfiguration getSchemaConfiguration(); + HttpClient getClient(); + default FakepemcontenttypeGetResponses.EndpointResponse pemContentType(GetRequest request) throws IOException, InterruptedException, ValidationException, NotImplementedException, ApiException { + return GetProvider.get(request, getApiConfiguration(), getSchemaConfiguration(), getClient()); + } + } + + public static class Get extends ApiClient implements GetOperation { + public Get(ApiConfiguration apiConfiguration, SchemaConfiguration schemaConfiguration) { + super(apiConfiguration, schemaConfiguration); + } + } + + public static class GetRequest { + public FakepemcontenttypeGetRequestBody.@Nullable SealedRequestBody requestBody; + public RootServerInfo.@Nullable ServerIndex serverIndex; + public @Nullable Duration timeout; + } + + public interface SetterForRequestBody { + GetRequest getInstance(); + T getBuilderAfterRequestBody(GetRequest instance); + default T requestBody(FakepemcontenttypeGetRequestBody.SealedRequestBody requestBody) { + var instance = getInstance(); + instance.requestBody = requestBody; + return getBuilderAfterRequestBody(instance); + } + } + + public interface SetterForServerIndex { + GetRequest getInstance(); + T getBuilderAfterServerIndex(GetRequest instance); + default T serverIndex(RootServerInfo.ServerIndex serverIndex) { + var instance = getInstance(); + instance.serverIndex = serverIndex; + return getBuilderAfterServerIndex(instance); + } + } + + public interface SetterForTimeout { + GetRequest getInstance(); + T getBuilderAfterTimeout(GetRequest instance); + default T timeout(Duration timeout) { + var instance = getInstance(); + instance.timeout = timeout; + return getBuilderAfterTimeout(instance); + } + } + + public static class GetRequestBuilder implements SetterForRequestBody, SetterForServerIndex, SetterForTimeout { + private final GetRequest instance; + + public GetRequestBuilder() { + this.instance = new GetRequest(); + } + + public GetRequest build() { + return instance; + } + + public GetRequest getInstance() { + return instance; + } + + public GetRequestBuilder getBuilderAfterRequestBody(GetRequest instance) { + return this; + } + + public GetRequestBuilder getBuilderAfterServerIndex(GetRequest instance) { + return this; + } + + public GetRequestBuilder getBuilderAfterTimeout(GetRequest instance) { + return this; + } + } +} diff --git a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/fakepemcontenttype/get/FakepemcontenttypeGetRequestBody.kt b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/fakepemcontenttype/get/FakepemcontenttypeGetRequestBody.kt new file mode 100644 index 00000000000..c0d16ea083b --- /dev/null +++ b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/fakepemcontenttype/get/FakepemcontenttypeGetRequestBody.kt @@ -0,0 +1,49 @@ +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; +import org.openapijsonschematools.client.mediatype.MediaType; +import org.openapijsonschematools.client.paths.fakepemcontenttype.get.requestbody.content.applicationxpemfile.ApplicationxpemfileSchema; + +import java.util.AbstractMap; +import java.util.Map; + +public class FakepemcontenttypeGetRequestBody { + public sealed interface SealedMediaType permits ApplicationxpemfileMediaType {} + + public record ApplicationxpemfileMediaType(ApplicationxpemfileSchema.ApplicationxpemfileSchema1 schema) implements SealedMediaType, MediaType { + public ApplicationxpemfileMediaType() { + this(ApplicationxpemfileSchema.ApplicationxpemfileSchema1.getInstance()); + } + @Override + public Nothing? encoding() { + return null; + } + } + + public static class FakepemcontenttypeGetRequestBody1 extends RequestBodySerializer { + public FakepemcontenttypeGetRequestBody1() { + super( + Map.ofEntries( + new AbstractMap.SimpleEntry<>("application/x-pem-file", new ApplicationxpemfileMediaType()) + ), + false + ); + } + + public SerializedRequestBody serialize(SealedRequestBody requestBody) throws NotImplementedException { + ApplicationxpemfileRequestBody requestBody0 = (ApplicationxpemfileRequestBody) requestBody; + return serialize(requestBody0.contentType(), requestBody0.body().getData()); + } + } + + public sealed interface SealedRequestBody permits ApplicationxpemfileRequestBody {} + public record ApplicationxpemfileRequestBody(ApplicationxpemfileSchema.StringJsonSchema1Boxed body) implements SealedRequestBody, GenericRequestBody { + @Override + public String contentType() { + return "application/x-pem-file"; + } + } +} diff --git a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/fakepemcontenttype/get/FakepemcontenttypeGetResponses.kt b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/fakepemcontenttype/get/FakepemcontenttypeGetResponses.kt new file mode 100644 index 00000000000..f7d5df3c39d --- /dev/null +++ b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/fakepemcontenttype/get/FakepemcontenttypeGetResponses.kt @@ -0,0 +1,53 @@ +package org.openapijsonschematools.client.paths.fakepemcontenttype.get; + +import org.openapijsonschematools.client.paths.fakepemcontenttype.get.responses.FakepemcontenttypeGetCode200Response; +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; +import org.checkerframework.checker.nullness.qual.Nullable; + +import java.net.http.HttpResponse; +import java.util.Map; +import java.util.AbstractMap; + +public class FakepemcontenttypeGetResponses { + public sealed interface EndpointResponse permits EndpointFakepemcontenttypeGetCode200Response {} + + public record EndpointFakepemcontenttypeGetCode200Response( + HttpResponse response, + FakepemcontenttypeGetCode200Response.SealedResponseBody body, + Nothing? headers + ) implements EndpointResponse, ApiResponse{ + } + + public sealed interface StatusCodeResponseDeserializer permits StatusFakepemcontenttypeGetCode200ResponseDeserializer {} + + public static final class StatusFakepemcontenttypeGetCode200ResponseDeserializer extends FakepemcontenttypeGetCode200Response.FakepemcontenttypeGetCode200Response1 implements StatusCodeResponseDeserializer { + } + + public static final class FakepemcontenttypeGetResponses1 implements ResponsesDeserializer { + private final Map statusCodeToResponseDeserializer; + public FakepemcontenttypeGetResponses1() { + this.statusCodeToResponseDeserializer = Map.ofEntries( + new AbstractMap.SimpleEntry<>("200", new StatusFakepemcontenttypeGetCode200ResponseDeserializer()) + ); + } + + 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) { + throw new ApiException( + "Invalid response statusCode="+statusCode+" has no response defined in the openapi document", + response + ); + } + StatusFakepemcontenttypeGetCode200ResponseDeserializer castDeserializer = (StatusFakepemcontenttypeGetCode200ResponseDeserializer) statusCodeDeserializer; + var deserializedResponse = castDeserializer.deserialize(response, configuration); + return new EndpointFakepemcontenttypeGetCode200Response(response, deserializedResponse.body(), deserializedResponse.headers()); + } + } +} diff --git a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/fakepemcontenttype/get/requestbody/content/applicationxpemfile/ApplicationxpemfileSchema.kt b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/fakepemcontenttype/get/requestbody/content/applicationxpemfile/ApplicationxpemfileSchema.kt new file mode 100644 index 00000000000..125b14dd81c --- /dev/null +++ b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/fakepemcontenttype/get/requestbody/content/applicationxpemfile/ApplicationxpemfileSchema.kt @@ -0,0 +1,19 @@ +package org.openapijsonschematools.client.paths.fakepemcontenttype.get.requestbody.content.applicationxpemfile; +import org.checkerframework.checker.nullness.qual.Nullable; +import org.openapijsonschematools.client.schemas.StringJsonSchema; + +public class ApplicationxpemfileSchema extends StringJsonSchema { + // nest classes so all schemas and input/output classes can be public + + + public static class ApplicationxpemfileSchema1 extends StringJsonSchema.StringJsonSchema1 { + private static @Nullable ApplicationxpemfileSchema1 instance = null; + public static ApplicationxpemfileSchema1 getInstance() { + if (instance == null) { + instance = new ApplicationxpemfileSchema1(); + } + return instance; + } + } + +} diff --git a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/fakepemcontenttype/get/responses/FakepemcontenttypeGetCode200Response.kt b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/fakepemcontenttype/get/responses/FakepemcontenttypeGetCode200Response.kt new file mode 100644 index 00000000000..e5dd073c7fa --- /dev/null +++ b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/fakepemcontenttype/get/responses/FakepemcontenttypeGetCode200Response.kt @@ -0,0 +1,63 @@ +package org.openapijsonschematools.client.paths.fakepemcontenttype.get.responses; + +import org.openapijsonschematools.client.configurations.SchemaConfiguration; +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; + +import java.util.AbstractMap; +import java.util.Map; +import java.net.http.HttpResponse; +import java.net.http.HttpHeaders; + +public class FakepemcontenttypeGetCode200Response { + public sealed interface SealedMediaType permits ApplicationxpemfileMediaType {} + + public record ApplicationxpemfileMediaType(ApplicationxpemfileSchema.ApplicationxpemfileSchema1 schema) implements SealedMediaType, MediaType { + public ApplicationxpemfileMediaType() { + this(ApplicationxpemfileSchema.ApplicationxpemfileSchema1.getInstance()); + } + @Override + public Nothing? encoding() { + return null; + } + } + public sealed interface SealedResponseBody permits ApplicationxpemfileResponseBody {} + public record ApplicationxpemfileResponseBody(ApplicationxpemfileSchema.StringJsonSchema1Boxed body) implements SealedResponseBody { } + + public static class FakepemcontenttypeGetCode200Response1 extends ResponseDeserializer { + public FakepemcontenttypeGetCode200Response1() { + super( + Map.ofEntries( + new AbstractMap.SimpleEntry<>("application/x-pem-file", new ApplicationxpemfileMediaType()) + ) + ); + } + + @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); + } + + @Override + protected Nothing? getHeaders(HttpHeaders headers, SchemaConfiguration configuration) { + return null; + } + } + + @SuppressWarnings("serial") + public static class ResponseApiException extends ApiException { + public DeserializedHttpResponse deserializedResponse; + + public ResponseApiException(String s, HttpResponse response, DeserializedHttpResponse deserializedResponse) { + super(s, response); + this.deserializedResponse = deserializedResponse; + } + } +} diff --git a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/fakepemcontenttype/get/responses/code200response/content/applicationxpemfile/ApplicationxpemfileSchema.kt b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/fakepemcontenttype/get/responses/code200response/content/applicationxpemfile/ApplicationxpemfileSchema.kt new file mode 100644 index 00000000000..0d12b96b19a --- /dev/null +++ b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/fakepemcontenttype/get/responses/code200response/content/applicationxpemfile/ApplicationxpemfileSchema.kt @@ -0,0 +1,19 @@ +package org.openapijsonschematools.client.paths.fakepemcontenttype.get.responses.code200response.content.applicationxpemfile; +import org.checkerframework.checker.nullness.qual.Nullable; +import org.openapijsonschematools.client.schemas.StringJsonSchema; + +public class ApplicationxpemfileSchema extends StringJsonSchema { + // nest classes so all schemas and input/output classes can be public + + + public static class ApplicationxpemfileSchema1 extends StringJsonSchema.StringJsonSchema1 { + private static @Nullable ApplicationxpemfileSchema1 instance = null; + public static ApplicationxpemfileSchema1 getInstance() { + if (instance == null) { + instance = new ApplicationxpemfileSchema1(); + } + return instance; + } + } + +} diff --git a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/fakepetiduploadimagewithrequiredfile/FakepetiduploadimagewithrequiredfilePost.kt b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/fakepetiduploadimagewithrequiredfile/FakepetiduploadimagewithrequiredfilePost.kt new file mode 100644 index 00000000000..79603a6ddc6 --- /dev/null +++ b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/fakepetiduploadimagewithrequiredfile/FakepetiduploadimagewithrequiredfilePost.kt @@ -0,0 +1,243 @@ +package org.openapijsonschematools.client.paths.fakepetiduploadimagewithrequiredfile; + +import org.checkerframework.checker.nullness.qual.Nullable; +import org.openapijsonschematools.client.paths.fakepetiduploadimagewithrequiredfile.post.FakepetiduploadimagewithrequiredfilePostRequestBody; +import org.openapijsonschematools.client.RootServerInfo; +import org.openapijsonschematools.client.paths.fakepetiduploadimagewithrequiredfile.post.FakepetiduploadimagewithrequiredfilePostSecurityInfo; +import org.openapijsonschematools.client.paths.fakepetiduploadimagewithrequiredfile.post.FakepetiduploadimagewithrequiredfilePostPathParameters; +import org.openapijsonschematools.client.paths.fakepetiduploadimagewithrequiredfile.post.Parameters; +import org.openapijsonschematools.client.paths.fakepetiduploadimagewithrequiredfile.post.FakepetiduploadimagewithrequiredfilePostResponses; +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.requestbody.SerializedRequestBody; +import org.openapijsonschematools.client.paths.Fakepetiduploadimagewithrequiredfile; +import org.openapijsonschematools.client.securityrequirementobjects.SecurityRequirementObject; +import org.openapijsonschematools.client.securityrequirementobjects.AuthApplier; + +import java.io.IOException; +import java.util.ArrayList; +import java.net.http.HttpClient; +import java.net.http.HttpRequest; +import java.time.Duration; +import java.util.List; +import java.util.Map; + +public class FakepetiduploadimagewithrequiredfilePost { + private static class PostProvider extends AuthApplier { + private static final String method = "post"; + + public static FakepetiduploadimagewithrequiredfilePostResponses.EndpointResponse post( + PostRequest request, + ApiConfiguration apiConfiguration, + SchemaConfiguration schemaConfiguration, + HttpClient client + ) throws IOException, InterruptedException, ValidationException, NotImplementedException, ApiException { + Map> headers = apiConfiguration.getDefaultHeaders(); + + @Nullable SerializedRequestBody serializedRequestBody; + HttpRequest.BodyPublisher bodyPublisher = HttpRequest.BodyPublishers.noBody(); + if (request.requestBody != null) { + serializedRequestBody = new FakepetiduploadimagewithrequiredfilePostRequestBody.FakepetiduploadimagewithrequiredfilePostRequestBody1().serialize( + request.requestBody + ); + var contentTypeHeaderValues = headers.getOrDefault("Content-Type", new ArrayList<>()); + contentTypeHeaderValues.add(serializedRequestBody.contentType); + bodyPublisher = serializedRequestBody.bodyPublisher; + } + + var pathSerializer = new Parameters.PathParametersSerializer(); + String updatedPath = pathSerializer.serialize(request.pathParameters, Fakepetiduploadimagewithrequiredfile.path); + // TODO set this to a map if there is a query security scheme + @Nullable Map queryMap = null; + String host = apiConfiguration.getServer(request.serverIndex).url(); + SecurityRequirementObject securityRequirementObject = apiConfiguration.getSecurityRequirementObject(request.securityIndex); + updateParamsForAuth( + securityRequirementObject, + headers, + updatedPath, + method, + bodyPublisher, + queryMap, + apiConfiguration + ); + + String url = host + updatedPath; + var httpRequest = RestClient.getRequest( + url, + method, + bodyPublisher, + headers, + request.timeout + ); + var response = RestClient.getResponse(httpRequest, client); + var responsesDeserializer = new FakepetiduploadimagewithrequiredfilePostResponses.FakepetiduploadimagewithrequiredfilePostResponses1(); + return responsesDeserializer.deserialize(response, schemaConfiguration); + } + } + + public interface PostOperation { + ApiConfiguration getApiConfiguration(); + SchemaConfiguration getSchemaConfiguration(); + HttpClient getClient(); + default FakepetiduploadimagewithrequiredfilePostResponses.EndpointResponse post(PostRequest request) throws IOException, InterruptedException, ValidationException, NotImplementedException, ApiException { + return PostProvider.post(request, getApiConfiguration(), getSchemaConfiguration(), getClient()); + } + } + + public interface UploadFileWithRequiredFileOperation { + ApiConfiguration getApiConfiguration(); + SchemaConfiguration getSchemaConfiguration(); + HttpClient getClient(); + default FakepetiduploadimagewithrequiredfilePostResponses.EndpointResponse uploadFileWithRequiredFile(PostRequest request) throws IOException, InterruptedException, ValidationException, NotImplementedException, ApiException { + return PostProvider.post(request, getApiConfiguration(), getSchemaConfiguration(), getClient()); + } + } + + public static class Post extends ApiClient implements PostOperation { + public Post(ApiConfiguration apiConfiguration, SchemaConfiguration schemaConfiguration) { + super(apiConfiguration, schemaConfiguration); + } + } + + public static class PostRequest { + public FakepetiduploadimagewithrequiredfilePostPathParameters.PathParametersMap pathParameters; + public FakepetiduploadimagewithrequiredfilePostRequestBody.@Nullable SealedRequestBody requestBody; + public RootServerInfo.@Nullable ServerIndex serverIndex; + public FakepetiduploadimagewithrequiredfilePostSecurityInfo.@Nullable SecurityIndex securityIndex; + public @Nullable Duration timeout; + + public PostRequest( + FakepetiduploadimagewithrequiredfilePostPathParameters.PathParametersMap pathParameters, + FakepetiduploadimagewithrequiredfilePostRequestBody.@Nullable SealedRequestBody requestBody, + RootServerInfo.@Nullable ServerIndex serverIndex, + FakepetiduploadimagewithrequiredfilePostSecurityInfo.@Nullable SecurityIndex securityIndex, + @Nullable Duration timeout + ) { + this.pathParameters = pathParameters; + this.requestBody = requestBody; + this.serverIndex = serverIndex; + this.securityIndex = securityIndex; + this.timeout = timeout; + } + } + + public static class PostNullableRequest { + public FakepetiduploadimagewithrequiredfilePostPathParameters.@Nullable PathParametersMap pathParameters; + public FakepetiduploadimagewithrequiredfilePostRequestBody.@Nullable SealedRequestBody requestBody; + public RootServerInfo.@Nullable ServerIndex serverIndex; + public FakepetiduploadimagewithrequiredfilePostSecurityInfo.@Nullable SecurityIndex securityIndex; + public @Nullable Duration timeout; + } + + public interface SetterForRequestBody { + PostNullableRequest getInstance(); + T getBuilderAfterRequestBody(PostNullableRequest instance); + default T requestBody(FakepetiduploadimagewithrequiredfilePostRequestBody.SealedRequestBody requestBody) { + var instance = getInstance(); + instance.requestBody = requestBody; + return getBuilderAfterRequestBody(instance); + } + } + + public interface SetterForServerIndex { + PostNullableRequest getInstance(); + T getBuilderAfterServerIndex(PostNullableRequest instance); + default T serverIndex(RootServerInfo.ServerIndex serverIndex) { + var instance = getInstance(); + instance.serverIndex = serverIndex; + return getBuilderAfterServerIndex(instance); + } + } + + public interface SetterForSecurityIndex { + PostNullableRequest getInstance(); + T getBuilderAfterSecurityIndex(PostNullableRequest instance); + default T securityIndex(FakepetiduploadimagewithrequiredfilePostSecurityInfo.SecurityIndex securityIndex) { + var instance = getInstance(); + instance.securityIndex = securityIndex; + return getBuilderAfterSecurityIndex(instance); + } + } + + public interface SetterForTimeout { + PostNullableRequest getInstance(); + T getBuilderAfterTimeout(PostNullableRequest instance); + default T timeout(Duration timeout) { + var instance = getInstance(); + instance.timeout = timeout; + return getBuilderAfterTimeout(instance); + } + } + + public interface SetterForPathParameters { + PostNullableRequest getInstance(); + T getBuilderAfterPathParameters(PostNullableRequest instance); + default T pathParameters(FakepetiduploadimagewithrequiredfilePostPathParameters.PathParametersMap pathParameters) { + var instance = getInstance(); + instance.pathParameters = pathParameters; + return getBuilderAfterPathParameters(instance); + } + } + + public static class Post0RequestBuilder implements SetterForRequestBody, SetterForServerIndex, SetterForSecurityIndex, SetterForTimeout { + private final PostNullableRequest instance; + + public Post0RequestBuilder(PostNullableRequest instance) { + this.instance = instance; + } + + public PostRequest build() { + var pathParameters = instance.pathParameters; + if (pathParameters == null) { + throw new RuntimeException("invalid null value for required parameter"); + } + return new PostRequest( + pathParameters, + instance.requestBody, + instance.serverIndex, + instance.securityIndex, + instance.timeout + ); + } + + public PostNullableRequest getInstance() { + return instance; + } + + public Post0RequestBuilder getBuilderAfterRequestBody(PostNullableRequest instance) { + return this; + } + + public Post0RequestBuilder getBuilderAfterServerIndex(PostNullableRequest instance) { + return this; + } + + public Post0RequestBuilder getBuilderAfterSecurityIndex(PostNullableRequest instance) { + return this; + } + + public Post0RequestBuilder getBuilderAfterTimeout(PostNullableRequest instance) { + return this; + } + } + public static class PostRequestBuilder implements SetterForPathParameters { + private final PostNullableRequest instance; + + public PostRequestBuilder() { + this.instance = new PostNullableRequest(); + } + + public PostNullableRequest getInstance() { + return instance; + } + + public Post0RequestBuilder getBuilderAfterPathParameters(PostNullableRequest instance) { + return new Post0RequestBuilder(instance); + } + } +} diff --git a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/fakepetiduploadimagewithrequiredfile/post/FakepetiduploadimagewithrequiredfilePostPathParameters.kt b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/fakepetiduploadimagewithrequiredfile/post/FakepetiduploadimagewithrequiredfilePostPathParameters.kt new file mode 100644 index 00000000000..4bb71a8399d --- /dev/null +++ b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/fakepetiduploadimagewithrequiredfile/post/FakepetiduploadimagewithrequiredfilePostPathParameters.kt @@ -0,0 +1,223 @@ +package org.openapijsonschematools.client.paths.fakepetiduploadimagewithrequiredfile.post; +import java.util.ArrayList; +import java.util.HashSet; +import java.util.LinkedHashMap; +import java.util.LinkedHashSet; +import java.util.List; +import java.util.Map; +import java.util.Objects; +import java.util.Set; +import org.checkerframework.checker.nullness.qual.Nullable; +import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags; +import org.openapijsonschematools.client.configurations.SchemaConfiguration; +import org.openapijsonschematools.client.exceptions.UnsetPropertyException; +import org.openapijsonschematools.client.exceptions.ValidationException; +import org.openapijsonschematools.client.paths.fakepetiduploadimagewithrequiredfile.post.parameters.parameter0.Schema0; +import org.openapijsonschematools.client.schemas.AnyTypeJsonSchema; +import org.openapijsonschematools.client.schemas.GenericBuilder; +import org.openapijsonschematools.client.schemas.NotAnyTypeJsonSchema; +import org.openapijsonschematools.client.schemas.validation.FrozenMap; +import org.openapijsonschematools.client.schemas.validation.JsonSchema; +import org.openapijsonschematools.client.schemas.validation.JsonSchemaInfo; +import org.openapijsonschematools.client.schemas.validation.MapSchemaValidator; +import org.openapijsonschematools.client.schemas.validation.MapUtils; +import org.openapijsonschematools.client.schemas.validation.PathToSchemasMap; +import org.openapijsonschematools.client.schemas.validation.PropertyEntry; +import org.openapijsonschematools.client.schemas.validation.ValidationMetadata; + +public class FakepetiduploadimagewithrequiredfilePostPathParameters { + // nest classes so all schemas and input/output classes can be public + + + public static class AdditionalProperties extends NotAnyTypeJsonSchema.NotAnyTypeJsonSchema1 { + // NotAnyTypeSchema + private static @Nullable AdditionalProperties instance = null; + public static AdditionalProperties getInstance() { + if (instance == null) { + instance = new AdditionalProperties(); + } + return instance; + } + } + + + public static class PathParametersMap extends FrozenMap { + protected PathParametersMap(FrozenMap m) { + super(m); + } + public static final Set requiredKeys = Set.of( + "petId" + ); + public static final Set optionalKeys = Set.of(); + public static PathParametersMap of(Map arg, SchemaConfiguration configuration) throws ValidationException { + return FakepetiduploadimagewithrequiredfilePostPathParameters1.getInstance().validate(arg, configuration); + } + + public Number petId() { + try { + return getOrThrow("version"); + } catch (UnsetPropertyException e) { + throw new RuntimeException(e); + } + } + } + + public interface SetterForPetId { + Map getInstance(); + T getBuilderAfterPetId(Map instance); + + default T petId(int value) { + var instance = getInstance(); + instance.put("petId", value); + return getBuilderAfterPetId(instance); + } + + default T petId(float value) { + var instance = getInstance(); + instance.put("petId", value); + return getBuilderAfterPetId(instance); + } + + default T petId(long value) { + var instance = getInstance(); + instance.put("petId", value); + return getBuilderAfterPetId(instance); + } + + default T petId(double value) { + var instance = getInstance(); + instance.put("petId", value); + return getBuilderAfterPetId(instance); + } + } + + public static class PathParametersMap0Builder implements GenericBuilder> { + private final Map instance; + private static final Set knownKeys = Set.of( + "petId" + ); + public Set getKnownKeys() { + return knownKeys; + } + public PathParametersMap0Builder(Map instance) { + this.instance = instance; + } + public Map build() { + return instance; + } + } + + public static class PathParametersMapBuilder implements SetterForPetId { + private final Map instance; + public PathParametersMapBuilder() { + this.instance = new LinkedHashMap<>(); + } + public Map getInstance() { + return instance; + } + public PathParametersMap0Builder getBuilderAfterPetId(Map instance) { + return new PathParametersMap0Builder(instance); + } + } + + + public sealed interface FakepetiduploadimagewithrequiredfilePostPathParameters1Boxed permits FakepetiduploadimagewithrequiredfilePostPathParameters1BoxedMap { + @Nullable Object getData(); + } + + public record FakepetiduploadimagewithrequiredfilePostPathParameters1BoxedMap(PathParametersMap data) implements FakepetiduploadimagewithrequiredfilePostPathParameters1Boxed { + @Override + public @Nullable Object getData() { + return data; + } + } + + + public static class FakepetiduploadimagewithrequiredfilePostPathParameters1 extends JsonSchema implements MapSchemaValidator { + private static @Nullable FakepetiduploadimagewithrequiredfilePostPathParameters1 instance = null; + + protected FakepetiduploadimagewithrequiredfilePostPathParameters1() { + super(new JsonSchemaInfo() + .type(Set.of(Map.class)) + .properties(Map.ofEntries( + new PropertyEntry("petId", Schema0.Schema01.class) + )) + .required(Set.of( + "petId" + )) + .additionalProperties(AdditionalProperties.class) + ); + } + + public static FakepetiduploadimagewithrequiredfilePostPathParameters1 getInstance() { + if (instance == null) { + instance = new FakepetiduploadimagewithrequiredfilePostPathParameters1(); + } + return instance; + } + + 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 RuntimeException("Invalid non-string key value"); + } + String propertyName = (String) entryKey; + List propertyPathToItem = new ArrayList<>(pathToItem); + propertyPathToItem.add(propertyName); + Object value = entry.getValue(); + LinkedHashMap, Nothing?> schemas = pathToSchemas.get(propertyPathToItem); + if (schemas == null) { + throw new RuntimeException("Validation 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"); + } + properties.put(propertyName, (Number) propertyInstance); + } + FrozenMap castProperties = new FrozenMap<>(properties); + return new PathParametersMap(castProperties); + } + + 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); + SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().build())); + ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, new PathToSchemasMap(), new LinkedHashSet<>()); + PathToSchemasMap pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet); + return getNewInstance(castArg, validationMetadata.pathToItem(), pathToSchemasMap); + } + + + @Override + public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws 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"); + } + @Override + public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { + if (arg instanceof Map) { + return getNewInstance((Map) arg, pathToItem, pathToSchemas); + } + throw new RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); + } + @Override + public FakepetiduploadimagewithrequiredfilePostPathParameters1BoxedMap validateAndBox(Map arg, SchemaConfiguration configuration) throws ValidationException { + return new FakepetiduploadimagewithrequiredfilePostPathParameters1BoxedMap(validate(arg, configuration)); + } + @Override + public FakepetiduploadimagewithrequiredfilePostPathParameters1Boxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { + 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"); + } + } + +} diff --git a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/fakepetiduploadimagewithrequiredfile/post/FakepetiduploadimagewithrequiredfilePostRequestBody.kt b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/fakepetiduploadimagewithrequiredfile/post/FakepetiduploadimagewithrequiredfilePostRequestBody.kt new file mode 100644 index 00000000000..00e2cb435f1 --- /dev/null +++ b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/fakepetiduploadimagewithrequiredfile/post/FakepetiduploadimagewithrequiredfilePostRequestBody.kt @@ -0,0 +1,49 @@ +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; +import org.openapijsonschematools.client.mediatype.MediaType; +import org.openapijsonschematools.client.paths.fakepetiduploadimagewithrequiredfile.post.requestbody.content.multipartformdata.MultipartformdataSchema; + +import java.util.AbstractMap; +import java.util.Map; + +public class FakepetiduploadimagewithrequiredfilePostRequestBody { + public sealed interface SealedMediaType permits MultipartformdataMediaType {} + + public record MultipartformdataMediaType(MultipartformdataSchema.MultipartformdataSchema1 schema) implements SealedMediaType, MediaType { + public MultipartformdataMediaType() { + this(MultipartformdataSchema.MultipartformdataSchema1.getInstance()); + } + @Override + public Nothing? encoding() { + return null; + } + } + + public static class FakepetiduploadimagewithrequiredfilePostRequestBody1 extends RequestBodySerializer { + public FakepetiduploadimagewithrequiredfilePostRequestBody1() { + super( + Map.ofEntries( + new AbstractMap.SimpleEntry<>("multipart/form-data", new MultipartformdataMediaType()) + ), + false + ); + } + + public SerializedRequestBody serialize(SealedRequestBody requestBody) throws NotImplementedException { + MultipartformdataRequestBody requestBody0 = (MultipartformdataRequestBody) requestBody; + return serialize(requestBody0.contentType(), requestBody0.body().getData()); + } + } + + public sealed interface SealedRequestBody permits MultipartformdataRequestBody {} + public record MultipartformdataRequestBody(MultipartformdataSchema.MultipartformdataSchema1Boxed body) implements SealedRequestBody, GenericRequestBody { + @Override + public String contentType() { + return "multipart/form-data"; + } + } +} diff --git a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/fakepetiduploadimagewithrequiredfile/post/FakepetiduploadimagewithrequiredfilePostResponses.kt b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/fakepetiduploadimagewithrequiredfile/post/FakepetiduploadimagewithrequiredfilePostResponses.kt new file mode 100644 index 00000000000..07044539763 --- /dev/null +++ b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/fakepetiduploadimagewithrequiredfile/post/FakepetiduploadimagewithrequiredfilePostResponses.kt @@ -0,0 +1,53 @@ +package org.openapijsonschematools.client.paths.fakepetiduploadimagewithrequiredfile.post; + +import org.openapijsonschematools.client.paths.fakepetiduploadimagewithrequiredfile.post.responses.FakepetiduploadimagewithrequiredfilePostCode200Response; +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; +import org.checkerframework.checker.nullness.qual.Nullable; + +import java.net.http.HttpResponse; +import java.util.Map; +import java.util.AbstractMap; + +public class FakepetiduploadimagewithrequiredfilePostResponses { + public sealed interface EndpointResponse permits EndpointFakepetiduploadimagewithrequiredfilePostCode200Response {} + + public record EndpointFakepetiduploadimagewithrequiredfilePostCode200Response( + HttpResponse response, + FakepetiduploadimagewithrequiredfilePostCode200Response.SealedResponseBody body, + Nothing? headers + ) implements EndpointResponse, ApiResponse{ + } + + public sealed interface StatusCodeResponseDeserializer permits StatusFakepetiduploadimagewithrequiredfilePostCode200ResponseDeserializer {} + + public static final class StatusFakepetiduploadimagewithrequiredfilePostCode200ResponseDeserializer extends FakepetiduploadimagewithrequiredfilePostCode200Response.FakepetiduploadimagewithrequiredfilePostCode200Response1 implements StatusCodeResponseDeserializer { + } + + public static final class FakepetiduploadimagewithrequiredfilePostResponses1 implements ResponsesDeserializer { + private final Map statusCodeToResponseDeserializer; + public FakepetiduploadimagewithrequiredfilePostResponses1() { + this.statusCodeToResponseDeserializer = Map.ofEntries( + new AbstractMap.SimpleEntry<>("200", new StatusFakepetiduploadimagewithrequiredfilePostCode200ResponseDeserializer()) + ); + } + + 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) { + throw new ApiException( + "Invalid response statusCode="+statusCode+" has no response defined in the openapi document", + response + ); + } + StatusFakepetiduploadimagewithrequiredfilePostCode200ResponseDeserializer castDeserializer = (StatusFakepetiduploadimagewithrequiredfilePostCode200ResponseDeserializer) statusCodeDeserializer; + var deserializedResponse = castDeserializer.deserialize(response, configuration); + return new EndpointFakepetiduploadimagewithrequiredfilePostCode200Response(response, deserializedResponse.body(), deserializedResponse.headers()); + } + } +} diff --git a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/fakepetiduploadimagewithrequiredfile/post/FakepetiduploadimagewithrequiredfilePostSecurityInfo.kt b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/fakepetiduploadimagewithrequiredfile/post/FakepetiduploadimagewithrequiredfilePostSecurityInfo.kt new file mode 100644 index 00000000000..8dab76a488c --- /dev/null +++ b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/fakepetiduploadimagewithrequiredfile/post/FakepetiduploadimagewithrequiredfilePostSecurityInfo.kt @@ -0,0 +1,24 @@ +package org.openapijsonschematools.client.paths.fakepetiduploadimagewithrequiredfile.post; + +import org.openapijsonschematools.client.paths.fakepetiduploadimagewithrequiredfile.post.security.FakepetiduploadimagewithrequiredfilePostSecurityRequirementObject0; +import org.openapijsonschematools.client.securityrequirementobjects.SecurityRequirementObject; +import org.openapijsonschematools.client.securityrequirementobjects.SecurityRequirementObjectProvider; + +public class FakepetiduploadimagewithrequiredfilePostSecurityInfo { + public static class FakepetiduploadimagewithrequiredfilePostSecurityInfo1 implements SecurityRequirementObjectProvider { + public final FakepetiduploadimagewithrequiredfilePostSecurityRequirementObject0 security0; + + public FakepetiduploadimagewithrequiredfilePostSecurityInfo1() { + security0 = new FakepetiduploadimagewithrequiredfilePostSecurityRequirementObject0(); + } + + @Override + public SecurityRequirementObject getSecurityRequirementObject(SecurityIndex securityIndex) { + return security0; + } + } + + public enum SecurityIndex { + SECURITY_0 + } +} \ No newline at end of file diff --git a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/fakepetiduploadimagewithrequiredfile/post/Parameters.kt b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/fakepetiduploadimagewithrequiredfile/post/Parameters.kt new file mode 100644 index 00000000000..69a6d736bc6 --- /dev/null +++ b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/fakepetiduploadimagewithrequiredfile/post/Parameters.kt @@ -0,0 +1,20 @@ +package org.openapijsonschematools.client.paths.fakepetiduploadimagewithrequiredfile.post; + +import org.openapijsonschematools.client.paths.fakepetiduploadimagewithrequiredfile.post.parameters.Parameter0; +import org.openapijsonschematools.client.parameter.PathSerializer; + +import java.util.Map; +import java.util.AbstractMap; + +public class Parameters { + + public static class PathParametersSerializer extends PathSerializer { + public PathParametersSerializer() { + super( + Map.ofEntries( + new AbstractMap.SimpleEntry<>("petId", new Parameter0.Parameter01()) + ) + ); + } + } +} diff --git a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/fakepetiduploadimagewithrequiredfile/post/parameters/Parameter0.kt b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/fakepetiduploadimagewithrequiredfile/post/parameters/Parameter0.kt new file mode 100644 index 00000000000..58b60c686b2 --- /dev/null +++ b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/fakepetiduploadimagewithrequiredfile/post/parameters/Parameter0.kt @@ -0,0 +1,23 @@ +package org.openapijsonschematools.client.paths.fakepetiduploadimagewithrequiredfile.post.parameters; + +import org.openapijsonschematools.client.parameter.ParameterStyle; +import org.openapijsonschematools.client.parameter.ParameterInType; +import org.openapijsonschematools.client.parameter.SchemaParameter; +import org.openapijsonschematools.client.paths.fakepetiduploadimagewithrequiredfile.post.parameters.parameter0.Schema0; + +public class Parameter0 { + + public static class Parameter01 extends SchemaParameter { + public Parameter01() { + super( + "petId", + ParameterInType.PATH, + true, + ParameterStyle.SIMPLE, + false, + false, + Schema0.Schema01.getInstance() + ); + } + } +} diff --git a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/fakepetiduploadimagewithrequiredfile/post/parameters/parameter0/Schema0.kt b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/fakepetiduploadimagewithrequiredfile/post/parameters/parameter0/Schema0.kt new file mode 100644 index 00000000000..2c458c3ee9c --- /dev/null +++ b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/fakepetiduploadimagewithrequiredfile/post/parameters/parameter0/Schema0.kt @@ -0,0 +1,19 @@ +package org.openapijsonschematools.client.paths.fakepetiduploadimagewithrequiredfile.post.parameters.parameter0; +import org.checkerframework.checker.nullness.qual.Nullable; +import org.openapijsonschematools.client.schemas.Int64JsonSchema; + +public class Schema0 extends Int64JsonSchema { + // nest classes so all schemas and input/output classes can be public + + + public static class Schema01 extends Int64JsonSchema.Int64JsonSchema1 { + private static @Nullable Schema01 instance = null; + public static Schema01 getInstance() { + if (instance == null) { + instance = new Schema01(); + } + return instance; + } + } + +} diff --git a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/fakepetiduploadimagewithrequiredfile/post/requestbody/content/multipartformdata/MultipartformdataSchema.kt b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/fakepetiduploadimagewithrequiredfile/post/requestbody/content/multipartformdata/MultipartformdataSchema.kt new file mode 100644 index 00000000000..9336cb1b219 --- /dev/null +++ b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/fakepetiduploadimagewithrequiredfile/post/requestbody/content/multipartformdata/MultipartformdataSchema.kt @@ -0,0 +1,251 @@ +package org.openapijsonschematools.client.paths.fakepetiduploadimagewithrequiredfile.post.requestbody.content.multipartformdata; +import java.util.ArrayList; +import java.util.HashSet; +import java.util.LinkedHashMap; +import java.util.LinkedHashSet; +import java.util.List; +import java.util.Map; +import java.util.Objects; +import java.util.Set; +import org.checkerframework.checker.nullness.qual.Nullable; +import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags; +import org.openapijsonschematools.client.configurations.SchemaConfiguration; +import org.openapijsonschematools.client.exceptions.InvalidAdditionalPropertyException; +import org.openapijsonschematools.client.exceptions.UnsetPropertyException; +import org.openapijsonschematools.client.exceptions.ValidationException; +import org.openapijsonschematools.client.schemas.GenericBuilder; +import org.openapijsonschematools.client.schemas.StringJsonSchema; +import org.openapijsonschematools.client.schemas.UnsetAddPropsSetter; +import org.openapijsonschematools.client.schemas.validation.FrozenMap; +import org.openapijsonschematools.client.schemas.validation.JsonSchema; +import org.openapijsonschematools.client.schemas.validation.JsonSchemaInfo; +import org.openapijsonschematools.client.schemas.validation.MapSchemaValidator; +import org.openapijsonschematools.client.schemas.validation.PathToSchemasMap; +import org.openapijsonschematools.client.schemas.validation.PropertyEntry; +import org.openapijsonschematools.client.schemas.validation.ValidationMetadata; + +public class MultipartformdataSchema { + // nest classes so all schemas and input/output classes can be public + + + public static class MultipartformdataAdditionalMetadata extends StringJsonSchema.StringJsonSchema1 { + private static @Nullable MultipartformdataAdditionalMetadata instance = null; + public static MultipartformdataAdditionalMetadata getInstance() { + if (instance == null) { + instance = new MultipartformdataAdditionalMetadata(); + } + return instance; + } + } + + + public static class MultipartformdataRequiredFile extends StringJsonSchema.StringJsonSchema1 { + // BinarySchema + private static @Nullable MultipartformdataRequiredFile instance = null; + public static MultipartformdataRequiredFile getInstance() { + if (instance == null) { + instance = new MultipartformdataRequiredFile(); + } + return instance; + } + } + + + public static class MultipartformdataSchemaMap extends FrozenMap<@Nullable Object> { + protected MultipartformdataSchemaMap(FrozenMap<@Nullable Object> m) { + super(m); + } + public static final Set requiredKeys = Set.of( + "requiredFile" + ); + public static final Set optionalKeys = Set.of( + "additionalMetadata" + ); + public static MultipartformdataSchemaMap of(Map arg, SchemaConfiguration configuration) throws ValidationException { + return MultipartformdataSchema1.getInstance().validate(arg, configuration); + } + + public String requiredFile() { + @Nullable Object value = get("requiredFile"); + if (!(value instanceof String)) { + throw new RuntimeException("Invalid value stored for requiredFile"); + } + return (String) value; + } + + public String additionalMetadata() throws UnsetPropertyException { + String key = "additionalMetadata"; + throwIfKeyNotPresent(key); + @Nullable Object value = get(key); + if (!(value instanceof String)) { + throw new RuntimeException("Invalid value stored for additionalMetadata"); + } + return (String) value; + } + + public @Nullable Object getAdditionalProperty(String name) throws UnsetPropertyException, InvalidAdditionalPropertyException { + throwIfKeyKnown(name, requiredKeys, optionalKeys); + throwIfKeyNotPresent(name); + return get(name); + } + } + + public interface SetterForMultipartformdataRequiredFile { + Map getInstance(); + T getBuilderAfterMultipartformdataRequiredFile(Map instance); + + default T requiredFile(String value) { + var instance = getInstance(); + instance.put("requiredFile", value); + return getBuilderAfterMultipartformdataRequiredFile(instance); + } + } + + public interface SetterForMultipartformdataAdditionalMetadata { + Map getInstance(); + T getBuilderAfterMultipartformdataAdditionalMetadata(Map instance); + + default T additionalMetadata(String value) { + var instance = getInstance(); + instance.put("additionalMetadata", value); + return getBuilderAfterMultipartformdataAdditionalMetadata(instance); + } + } + + public static class MultipartformdataSchemaMap0Builder extends UnsetAddPropsSetter implements GenericBuilder>, SetterForMultipartformdataAdditionalMetadata { + private final Map instance; + private static final Set knownKeys = Set.of( + "requiredFile", + "additionalMetadata" + ); + public Set getKnownKeys() { + return knownKeys; + } + public MultipartformdataSchemaMap0Builder(Map instance) { + this.instance = instance; + } + public Map build() { + return instance; + } + public Map getInstance() { + return instance; + } + public MultipartformdataSchemaMap0Builder getBuilderAfterMultipartformdataAdditionalMetadata(Map instance) { + return this; + } + public MultipartformdataSchemaMap0Builder getBuilderAfterAdditionalProperty(Map instance) { + return this; + } + } + + public static class MultipartformdataSchemaMapBuilder implements SetterForMultipartformdataRequiredFile { + private final Map instance; + public MultipartformdataSchemaMapBuilder() { + this.instance = new LinkedHashMap<>(); + } + public Map getInstance() { + return instance; + } + public MultipartformdataSchemaMap0Builder getBuilderAfterMultipartformdataRequiredFile(Map instance) { + return new MultipartformdataSchemaMap0Builder(instance); + } + } + + + public sealed interface MultipartformdataSchema1Boxed permits MultipartformdataSchema1BoxedMap { + @Nullable Object getData(); + } + + public record MultipartformdataSchema1BoxedMap(MultipartformdataSchemaMap data) implements MultipartformdataSchema1Boxed { + @Override + public @Nullable Object getData() { + return data; + } + } + + + public static class MultipartformdataSchema1 extends JsonSchema implements MapSchemaValidator { + private static @Nullable MultipartformdataSchema1 instance = null; + + protected MultipartformdataSchema1() { + super(new JsonSchemaInfo() + .type(Set.of(Map.class)) + .properties(Map.ofEntries( + new PropertyEntry("additionalMetadata", MultipartformdataAdditionalMetadata.class), + new PropertyEntry("requiredFile", MultipartformdataRequiredFile.class) + )) + .required(Set.of( + "requiredFile" + )) + ); + } + + public static MultipartformdataSchema1 getInstance() { + if (instance == null) { + instance = new MultipartformdataSchema1(); + } + return instance; + } + + 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 RuntimeException("Invalid non-string key value"); + } + String propertyName = (String) entryKey; + List propertyPathToItem = new ArrayList<>(pathToItem); + propertyPathToItem.add(propertyName); + Object value = entry.getValue(); + LinkedHashMap, Nothing?> schemas = pathToSchemas.get(propertyPathToItem); + if (schemas == null) { + throw new RuntimeException("Validation result is invalid, schemas must exist for a pathToItem"); + } + JsonSchema propertySchema = schemas.entrySet().iterator().next().getKey(); + @Nullable Object propertyInstance = propertySchema.getNewInstance(value, propertyPathToItem, pathToSchemas); + properties.put(propertyName, propertyInstance); + } + FrozenMap<@Nullable Object> castProperties = new FrozenMap<>(properties); + return new MultipartformdataSchemaMap(castProperties); + } + + 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); + SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().build())); + ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, new PathToSchemasMap(), new LinkedHashSet<>()); + PathToSchemasMap pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet); + return getNewInstance(castArg, validationMetadata.pathToItem(), pathToSchemasMap); + } + + + @Override + public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws 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"); + } + @Override + public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { + if (arg instanceof Map) { + return getNewInstance((Map) arg, pathToItem, pathToSchemas); + } + 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 { + return new MultipartformdataSchema1BoxedMap(validate(arg, configuration)); + } + @Override + public MultipartformdataSchema1Boxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { + 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"); + } + } + +} diff --git a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/fakepetiduploadimagewithrequiredfile/post/responses/FakepetiduploadimagewithrequiredfilePostCode200Response.kt b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/fakepetiduploadimagewithrequiredfile/post/responses/FakepetiduploadimagewithrequiredfilePostCode200Response.kt new file mode 100644 index 00000000000..daa415e6ac3 --- /dev/null +++ b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/fakepetiduploadimagewithrequiredfile/post/responses/FakepetiduploadimagewithrequiredfilePostCode200Response.kt @@ -0,0 +1,63 @@ +package org.openapijsonschematools.client.paths.fakepetiduploadimagewithrequiredfile.post.responses; + +import org.openapijsonschematools.client.configurations.SchemaConfiguration; +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; + +import java.util.AbstractMap; +import java.util.Map; +import java.net.http.HttpResponse; +import java.net.http.HttpHeaders; + +public class FakepetiduploadimagewithrequiredfilePostCode200Response { + public sealed interface SealedMediaType permits ApplicationjsonMediaType {} + + public record ApplicationjsonMediaType(ApplicationjsonSchema.ApplicationjsonSchema1 schema) implements SealedMediaType, MediaType { + public ApplicationjsonMediaType() { + this(ApplicationjsonSchema.ApplicationjsonSchema1.getInstance()); + } + @Override + public Nothing? encoding() { + return null; + } + } + public sealed interface SealedResponseBody permits ApplicationjsonResponseBody {} + public record ApplicationjsonResponseBody(ApplicationjsonSchema.ApiResponseSchema1Boxed body) implements SealedResponseBody { } + + public static class FakepetiduploadimagewithrequiredfilePostCode200Response1 extends ResponseDeserializer { + public FakepetiduploadimagewithrequiredfilePostCode200Response1() { + super( + Map.ofEntries( + new AbstractMap.SimpleEntry<>("application/json", new ApplicationjsonMediaType()) + ) + ); + } + + @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); + } + + @Override + protected Nothing? getHeaders(HttpHeaders headers, SchemaConfiguration configuration) { + return null; + } + } + + @SuppressWarnings("serial") + public static class ResponseApiException extends ApiException { + public DeserializedHttpResponse deserializedResponse; + + public ResponseApiException(String s, HttpResponse response, DeserializedHttpResponse deserializedResponse) { + super(s, response); + this.deserializedResponse = deserializedResponse; + } + } +} diff --git a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/fakepetiduploadimagewithrequiredfile/post/responses/code200response/content/applicationjson/ApplicationjsonSchema.kt b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/fakepetiduploadimagewithrequiredfile/post/responses/code200response/content/applicationjson/ApplicationjsonSchema.kt new file mode 100644 index 00000000000..42e57377e16 --- /dev/null +++ b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/fakepetiduploadimagewithrequiredfile/post/responses/code200response/content/applicationjson/ApplicationjsonSchema.kt @@ -0,0 +1,19 @@ +package org.openapijsonschematools.client.paths.fakepetiduploadimagewithrequiredfile.post.responses.code200response.content.applicationjson; + +import org.checkerframework.checker.nullness.qual.Nullable; +import org.openapijsonschematools.client.components.schemas.ApiResponseSchema; + +public class ApplicationjsonSchema extends ApiResponseSchema { + // $refed class + + + public static class ApplicationjsonSchema1 extends ApiResponseSchema1 { + private static @Nullable ApplicationjsonSchema1 instance = null; + public static ApplicationjsonSchema1 getInstance() { + if (instance == null) { + instance = new ApplicationjsonSchema1(); + } + return instance; + } + } +} diff --git a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/fakepetiduploadimagewithrequiredfile/post/security/FakepetiduploadimagewithrequiredfilePostSecurityRequirementObject0.kt b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/fakepetiduploadimagewithrequiredfile/post/security/FakepetiduploadimagewithrequiredfilePostSecurityRequirementObject0.kt new file mode 100644 index 00000000000..d1c684c5779 --- /dev/null +++ b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/fakepetiduploadimagewithrequiredfile/post/security/FakepetiduploadimagewithrequiredfilePostSecurityRequirementObject0.kt @@ -0,0 +1,24 @@ +package org.openapijsonschematools.client.paths.fakepetiduploadimagewithrequiredfile.post.security; + +import org.checkerframework.checker.nullness.qual.Nullable; +import org.openapijsonschematools.client.securityrequirementobjects.SecurityRequirementObject; +import org.openapijsonschematools.client.securityschemes.SecurityScheme; +import org.openapijsonschematools.client.components.securityschemes.PetstoreAuth; + +import java.util.List; +import java.util.Map; +import java.util.AbstractMap; + +public class FakepetiduploadimagewithrequiredfilePostSecurityRequirementObject0 extends SecurityRequirementObject { + + public FakepetiduploadimagewithrequiredfilePostSecurityRequirementObject0() { + super( + Map.ofEntries( + new AbstractMap.SimpleEntry, List>( + PetstoreAuth.class, + List.of("write:pets", "read:pets") + ) + ) + ); + } +} diff --git a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/fakequeryparamwithjsoncontenttype/FakequeryparamwithjsoncontenttypeGet.kt b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/fakequeryparamwithjsoncontenttype/FakequeryparamwithjsoncontenttypeGet.kt new file mode 100644 index 00000000000..29c289ffc4c --- /dev/null +++ b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/fakequeryparamwithjsoncontenttype/FakequeryparamwithjsoncontenttypeGet.kt @@ -0,0 +1,180 @@ +package org.openapijsonschematools.client.paths.fakequeryparamwithjsoncontenttype; + +import org.checkerframework.checker.nullness.qual.Nullable; +import org.openapijsonschematools.client.RootServerInfo; +import org.openapijsonschematools.client.paths.fakequeryparamwithjsoncontenttype.get.FakequeryparamwithjsoncontenttypeGetQueryParameters; +import org.openapijsonschematools.client.paths.fakequeryparamwithjsoncontenttype.get.Parameters; +import org.openapijsonschematools.client.paths.fakequeryparamwithjsoncontenttype.get.FakequeryparamwithjsoncontenttypeGetResponses; +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.paths.Fakequeryparamwithjsoncontenttype; + +import java.io.IOException; +import java.net.http.HttpClient; +import java.net.http.HttpRequest; +import java.time.Duration; +import java.util.List; +import java.util.Map; + +public class FakequeryparamwithjsoncontenttypeGet { + private static class GetProvider { + private static final String method = "get"; + + public static FakequeryparamwithjsoncontenttypeGetResponses.EndpointResponse get( + GetRequest request, + ApiConfiguration apiConfiguration, + SchemaConfiguration schemaConfiguration, + HttpClient client + ) throws IOException, InterruptedException, ValidationException, NotImplementedException, ApiException { + Map> headers = apiConfiguration.getDefaultHeaders(); + HttpRequest.BodyPublisher bodyPublisher = HttpRequest.BodyPublishers.noBody(); + + var querySerializer = new Parameters.QueryParametersSerializer(); + @Nullable Map queryMap = querySerializer.getQueryMap(request.queryParameters); + String host = apiConfiguration.getServer(request.serverIndex).url(); + + String url = host + Fakequeryparamwithjsoncontenttype.path; + if (queryMap != null) { + url = url + querySerializer.serialize(queryMap); + } + var httpRequest = RestClient.getRequest( + url, + method, + bodyPublisher, + headers, + request.timeout + ); + var response = RestClient.getResponse(httpRequest, client); + var responsesDeserializer = new FakequeryparamwithjsoncontenttypeGetResponses.FakequeryparamwithjsoncontenttypeGetResponses1(); + return responsesDeserializer.deserialize(response, schemaConfiguration); + } + } + + public interface GetOperation { + ApiConfiguration getApiConfiguration(); + SchemaConfiguration getSchemaConfiguration(); + HttpClient getClient(); + default FakequeryparamwithjsoncontenttypeGetResponses.EndpointResponse get(GetRequest request) throws IOException, InterruptedException, ValidationException, NotImplementedException, ApiException { + return GetProvider.get(request, getApiConfiguration(), getSchemaConfiguration(), getClient()); + } + } + + public interface QueryParamWithJsonContentTypeOperation { + ApiConfiguration getApiConfiguration(); + SchemaConfiguration getSchemaConfiguration(); + HttpClient getClient(); + default FakequeryparamwithjsoncontenttypeGetResponses.EndpointResponse queryParamWithJsonContentType(GetRequest request) throws IOException, InterruptedException, ValidationException, NotImplementedException, ApiException { + return GetProvider.get(request, getApiConfiguration(), getSchemaConfiguration(), getClient()); + } + } + + public static class Get extends ApiClient implements GetOperation { + public Get(ApiConfiguration apiConfiguration, SchemaConfiguration schemaConfiguration) { + super(apiConfiguration, schemaConfiguration); + } + } + + public static class GetRequest { + public FakequeryparamwithjsoncontenttypeGetQueryParameters.QueryParametersMap queryParameters; + public RootServerInfo.@Nullable ServerIndex serverIndex; + public @Nullable Duration timeout; + + public GetRequest( + FakequeryparamwithjsoncontenttypeGetQueryParameters.QueryParametersMap queryParameters, + RootServerInfo.@Nullable ServerIndex serverIndex, + @Nullable Duration timeout + ) { + this.queryParameters = queryParameters; + this.serverIndex = serverIndex; + this.timeout = timeout; + } + } + + public static class GetNullableRequest { + public FakequeryparamwithjsoncontenttypeGetQueryParameters.@Nullable QueryParametersMap queryParameters; + public RootServerInfo.@Nullable ServerIndex serverIndex; + public @Nullable Duration timeout; + } + + public interface SetterForServerIndex { + GetNullableRequest getInstance(); + T getBuilderAfterServerIndex(GetNullableRequest instance); + default T serverIndex(RootServerInfo.ServerIndex serverIndex) { + var instance = getInstance(); + instance.serverIndex = serverIndex; + return getBuilderAfterServerIndex(instance); + } + } + + public interface SetterForTimeout { + GetNullableRequest getInstance(); + T getBuilderAfterTimeout(GetNullableRequest instance); + default T timeout(Duration timeout) { + var instance = getInstance(); + instance.timeout = timeout; + return getBuilderAfterTimeout(instance); + } + } + + public interface SetterForQueryParameters { + GetNullableRequest getInstance(); + T getBuilderAfterQueryParameters(GetNullableRequest instance); + default T queryParameters(FakequeryparamwithjsoncontenttypeGetQueryParameters.QueryParametersMap queryParameters) { + var instance = getInstance(); + instance.queryParameters = queryParameters; + return getBuilderAfterQueryParameters(instance); + } + } + + public static class Get0RequestBuilder implements SetterForServerIndex, SetterForTimeout { + private final GetNullableRequest instance; + + public Get0RequestBuilder(GetNullableRequest instance) { + this.instance = instance; + } + + public GetRequest build() { + var queryParameters = instance.queryParameters; + if (queryParameters == null) { + throw new RuntimeException("invalid null value for required parameter"); + } + return new GetRequest( + queryParameters, + instance.serverIndex, + instance.timeout + ); + } + + public GetNullableRequest getInstance() { + return instance; + } + + public Get0RequestBuilder getBuilderAfterServerIndex(GetNullableRequest instance) { + return this; + } + + public Get0RequestBuilder getBuilderAfterTimeout(GetNullableRequest instance) { + return this; + } + } + public static class GetRequestBuilder implements SetterForQueryParameters { + private final GetNullableRequest instance; + + public GetRequestBuilder() { + this.instance = new GetNullableRequest(); + } + + public GetNullableRequest getInstance() { + return instance; + } + + public Get0RequestBuilder getBuilderAfterQueryParameters(GetNullableRequest instance) { + return new Get0RequestBuilder(instance); + } + } +} diff --git a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/fakequeryparamwithjsoncontenttype/get/FakequeryparamwithjsoncontenttypeGetQueryParameters.kt b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/fakequeryparamwithjsoncontenttype/get/FakequeryparamwithjsoncontenttypeGetQueryParameters.kt new file mode 100644 index 00000000000..b1f809396c2 --- /dev/null +++ b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/fakequeryparamwithjsoncontenttype/get/FakequeryparamwithjsoncontenttypeGetQueryParameters.kt @@ -0,0 +1,253 @@ +package org.openapijsonschematools.client.paths.fakequeryparamwithjsoncontenttype.get; +import java.util.ArrayList; +import java.util.HashSet; +import java.util.LinkedHashMap; +import java.util.LinkedHashSet; +import java.util.List; +import java.util.Map; +import java.util.Objects; +import java.util.Set; +import org.checkerframework.checker.nullness.qual.Nullable; +import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags; +import org.openapijsonschematools.client.configurations.SchemaConfiguration; +import org.openapijsonschematools.client.exceptions.UnsetPropertyException; +import org.openapijsonschematools.client.exceptions.ValidationException; +import org.openapijsonschematools.client.paths.fakequeryparamwithjsoncontenttype.get.parameters.parameter0.content.applicationjson.Schema0; +import org.openapijsonschematools.client.schemas.AnyTypeJsonSchema; +import org.openapijsonschematools.client.schemas.GenericBuilder; +import org.openapijsonschematools.client.schemas.NotAnyTypeJsonSchema; +import org.openapijsonschematools.client.schemas.validation.FrozenMap; +import org.openapijsonschematools.client.schemas.validation.JsonSchema; +import org.openapijsonschematools.client.schemas.validation.JsonSchemaInfo; +import org.openapijsonschematools.client.schemas.validation.MapSchemaValidator; +import org.openapijsonschematools.client.schemas.validation.MapUtils; +import org.openapijsonschematools.client.schemas.validation.PathToSchemasMap; +import org.openapijsonschematools.client.schemas.validation.PropertyEntry; +import org.openapijsonschematools.client.schemas.validation.ValidationMetadata; + +public class FakequeryparamwithjsoncontenttypeGetQueryParameters { + // nest classes so all schemas and input/output classes can be public + + + public static class AdditionalProperties extends NotAnyTypeJsonSchema.NotAnyTypeJsonSchema1 { + // NotAnyTypeSchema + private static @Nullable AdditionalProperties instance = null; + public static AdditionalProperties getInstance() { + if (instance == null) { + instance = new AdditionalProperties(); + } + return instance; + } + } + + + public static class QueryParametersMap extends FrozenMap<@Nullable Object> { + protected QueryParametersMap(FrozenMap<@Nullable Object> m) { + super(m); + } + public static final Set requiredKeys = Set.of( + "someParam" + ); + public static final Set optionalKeys = Set.of(); + public static QueryParametersMap of(Map arg, SchemaConfiguration configuration) throws ValidationException { + return FakequeryparamwithjsoncontenttypeGetQueryParameters1.getInstance().validate(arg, configuration); + } + + public @Nullable Object someParam() { + try { + return getOrThrow("version"); + } catch (UnsetPropertyException e) { + throw new RuntimeException(e); + } + } + } + + public interface SetterForSomeParam { + Map getInstance(); + T getBuilderAfterSomeParam(Map instance); + + default T someParam(Nothing? value) { + var instance = getInstance(); + instance.put("someParam", null); + return getBuilderAfterSomeParam(instance); + } + + default T someParam(boolean value) { + var instance = getInstance(); + instance.put("someParam", value); + return getBuilderAfterSomeParam(instance); + } + + default T someParam(String value) { + var instance = getInstance(); + instance.put("someParam", value); + return getBuilderAfterSomeParam(instance); + } + + default T someParam(int value) { + var instance = getInstance(); + instance.put("someParam", value); + return getBuilderAfterSomeParam(instance); + } + + default T someParam(float value) { + var instance = getInstance(); + instance.put("someParam", value); + return getBuilderAfterSomeParam(instance); + } + + default T someParam(long value) { + var instance = getInstance(); + instance.put("someParam", value); + return getBuilderAfterSomeParam(instance); + } + + default T someParam(double value) { + var instance = getInstance(); + instance.put("someParam", value); + return getBuilderAfterSomeParam(instance); + } + + default T someParam(List value) { + var instance = getInstance(); + instance.put("someParam", value); + return getBuilderAfterSomeParam(instance); + } + + default T someParam(Map value) { + var instance = getInstance(); + instance.put("someParam", value); + return getBuilderAfterSomeParam(instance); + } + } + + public static class QueryParametersMap0Builder implements GenericBuilder> { + private final Map instance; + private static final Set knownKeys = Set.of( + "someParam" + ); + public Set getKnownKeys() { + return knownKeys; + } + public QueryParametersMap0Builder(Map instance) { + this.instance = instance; + } + public Map build() { + return instance; + } + } + + public static class QueryParametersMapBuilder implements SetterForSomeParam { + private final Map instance; + public QueryParametersMapBuilder() { + this.instance = new LinkedHashMap<>(); + } + public Map getInstance() { + return instance; + } + public QueryParametersMap0Builder getBuilderAfterSomeParam(Map instance) { + return new QueryParametersMap0Builder(instance); + } + } + + + public sealed interface FakequeryparamwithjsoncontenttypeGetQueryParameters1Boxed permits FakequeryparamwithjsoncontenttypeGetQueryParameters1BoxedMap { + @Nullable Object getData(); + } + + public record FakequeryparamwithjsoncontenttypeGetQueryParameters1BoxedMap(QueryParametersMap data) implements FakequeryparamwithjsoncontenttypeGetQueryParameters1Boxed { + @Override + public @Nullable Object getData() { + return data; + } + } + + + public static class FakequeryparamwithjsoncontenttypeGetQueryParameters1 extends JsonSchema implements MapSchemaValidator { + private static @Nullable FakequeryparamwithjsoncontenttypeGetQueryParameters1 instance = null; + + protected FakequeryparamwithjsoncontenttypeGetQueryParameters1() { + super(new JsonSchemaInfo() + .type(Set.of(Map.class)) + .properties(Map.ofEntries( + new PropertyEntry("someParam", Schema0.Schema01.class) + )) + .required(Set.of( + "someParam" + )) + .additionalProperties(AdditionalProperties.class) + ); + } + + public static FakequeryparamwithjsoncontenttypeGetQueryParameters1 getInstance() { + if (instance == null) { + instance = new FakequeryparamwithjsoncontenttypeGetQueryParameters1(); + } + return instance; + } + + 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 RuntimeException("Invalid non-string key value"); + } + String propertyName = (String) entryKey; + List propertyPathToItem = new ArrayList<>(pathToItem); + propertyPathToItem.add(propertyName); + Object value = entry.getValue(); + LinkedHashMap, Nothing?> schemas = pathToSchemas.get(propertyPathToItem); + if (schemas == null) { + throw new RuntimeException("Validation 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"); + } + properties.put(propertyName, (@Nullable Object) propertyInstance); + } + FrozenMap<@Nullable Object> castProperties = new FrozenMap<>(properties); + return new QueryParametersMap(castProperties); + } + + 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); + SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().build())); + ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, new PathToSchemasMap(), new LinkedHashSet<>()); + PathToSchemasMap pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet); + return getNewInstance(castArg, validationMetadata.pathToItem(), pathToSchemasMap); + } + + + @Override + public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws 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"); + } + @Override + public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { + if (arg instanceof Map) { + return getNewInstance((Map) arg, pathToItem, pathToSchemas); + } + throw new RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); + } + @Override + public FakequeryparamwithjsoncontenttypeGetQueryParameters1BoxedMap validateAndBox(Map arg, SchemaConfiguration configuration) throws ValidationException { + return new FakequeryparamwithjsoncontenttypeGetQueryParameters1BoxedMap(validate(arg, configuration)); + } + @Override + public FakequeryparamwithjsoncontenttypeGetQueryParameters1Boxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { + 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"); + } + } + +} diff --git a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/fakequeryparamwithjsoncontenttype/get/FakequeryparamwithjsoncontenttypeGetResponses.kt b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/fakequeryparamwithjsoncontenttype/get/FakequeryparamwithjsoncontenttypeGetResponses.kt new file mode 100644 index 00000000000..3f548a6f962 --- /dev/null +++ b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/fakequeryparamwithjsoncontenttype/get/FakequeryparamwithjsoncontenttypeGetResponses.kt @@ -0,0 +1,53 @@ +package org.openapijsonschematools.client.paths.fakequeryparamwithjsoncontenttype.get; + +import org.openapijsonschematools.client.paths.fakequeryparamwithjsoncontenttype.get.responses.FakequeryparamwithjsoncontenttypeGetCode200Response; +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; +import org.checkerframework.checker.nullness.qual.Nullable; + +import java.net.http.HttpResponse; +import java.util.Map; +import java.util.AbstractMap; + +public class FakequeryparamwithjsoncontenttypeGetResponses { + public sealed interface EndpointResponse permits EndpointFakequeryparamwithjsoncontenttypeGetCode200Response {} + + public record EndpointFakequeryparamwithjsoncontenttypeGetCode200Response( + HttpResponse response, + FakequeryparamwithjsoncontenttypeGetCode200Response.SealedResponseBody body, + Nothing? headers + ) implements EndpointResponse, ApiResponse{ + } + + public sealed interface StatusCodeResponseDeserializer permits StatusFakequeryparamwithjsoncontenttypeGetCode200ResponseDeserializer {} + + public static final class StatusFakequeryparamwithjsoncontenttypeGetCode200ResponseDeserializer extends FakequeryparamwithjsoncontenttypeGetCode200Response.FakequeryparamwithjsoncontenttypeGetCode200Response1 implements StatusCodeResponseDeserializer { + } + + public static final class FakequeryparamwithjsoncontenttypeGetResponses1 implements ResponsesDeserializer { + private final Map statusCodeToResponseDeserializer; + public FakequeryparamwithjsoncontenttypeGetResponses1() { + this.statusCodeToResponseDeserializer = Map.ofEntries( + new AbstractMap.SimpleEntry<>("200", new StatusFakequeryparamwithjsoncontenttypeGetCode200ResponseDeserializer()) + ); + } + + 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) { + throw new ApiException( + "Invalid response statusCode="+statusCode+" has no response defined in the openapi document", + response + ); + } + StatusFakequeryparamwithjsoncontenttypeGetCode200ResponseDeserializer castDeserializer = (StatusFakequeryparamwithjsoncontenttypeGetCode200ResponseDeserializer) statusCodeDeserializer; + var deserializedResponse = castDeserializer.deserialize(response, configuration); + return new EndpointFakequeryparamwithjsoncontenttypeGetCode200Response(response, deserializedResponse.body(), deserializedResponse.headers()); + } + } +} diff --git a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/fakequeryparamwithjsoncontenttype/get/Parameters.kt b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/fakequeryparamwithjsoncontenttype/get/Parameters.kt new file mode 100644 index 00000000000..713b9540cea --- /dev/null +++ b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/fakequeryparamwithjsoncontenttype/get/Parameters.kt @@ -0,0 +1,20 @@ +package org.openapijsonschematools.client.paths.fakequeryparamwithjsoncontenttype.get; + +import org.openapijsonschematools.client.paths.fakequeryparamwithjsoncontenttype.get.parameters.Parameter0; +import org.openapijsonschematools.client.parameter.QuerySerializer; + +import java.util.Map; +import java.util.AbstractMap; + +public class Parameters { + + public static class QueryParametersSerializer extends QuerySerializer { + public QueryParametersSerializer() { + super( + Map.ofEntries( + new AbstractMap.SimpleEntry<>("someParam", new Parameter0.Parameter01()) + ) + ); + } + } +} diff --git a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/fakequeryparamwithjsoncontenttype/get/parameters/Parameter0.kt b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/fakequeryparamwithjsoncontenttype/get/parameters/Parameter0.kt new file mode 100644 index 00000000000..9dfb791abaf --- /dev/null +++ b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/fakequeryparamwithjsoncontenttype/get/parameters/Parameter0.kt @@ -0,0 +1,35 @@ +package org.openapijsonschematools.client.paths.fakequeryparamwithjsoncontenttype.get.parameters; + +import org.openapijsonschematools.client.parameter.ParameterInType; +import org.openapijsonschematools.client.parameter.ContentParameter; +import org.openapijsonschematools.client.mediatype.MediaType; +import org.openapijsonschematools.client.paths.fakequeryparamwithjsoncontenttype.get.parameters.parameter0.content.applicationjson.Schema0; + +import java.util.AbstractMap; + +public class Parameter0 { + + public record ApplicationjsonMediaType(Schema0.Schema01 schema) implements MediaType { + public ApplicationjsonMediaType() { + this(Schema0.Schema01.getInstance()); + } + @Override + public Nothing? encoding() { + return null; + } + } + + public static class Parameter01 extends ContentParameter { + public Parameter01() { + super( + "someParam", + ParameterInType.QUERY, + true, + null, + null, + false, + new AbstractMap.SimpleEntry<>("application/json", new ApplicationjsonMediaType()) + ); + } + } +} diff --git a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/fakequeryparamwithjsoncontenttype/get/parameters/parameter0/content/applicationjson/Schema0.kt b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/fakequeryparamwithjsoncontenttype/get/parameters/parameter0/content/applicationjson/Schema0.kt new file mode 100644 index 00000000000..98f404bf94b --- /dev/null +++ b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/fakequeryparamwithjsoncontenttype/get/parameters/parameter0/content/applicationjson/Schema0.kt @@ -0,0 +1,19 @@ +package org.openapijsonschematools.client.paths.fakequeryparamwithjsoncontenttype.get.parameters.parameter0.content.applicationjson; +import org.checkerframework.checker.nullness.qual.Nullable; +import org.openapijsonschematools.client.schemas.AnyTypeJsonSchema; + +public class Schema0 extends AnyTypeJsonSchema { + // nest classes so all schemas and input/output classes can be public + + + public static class Schema01 extends AnyTypeJsonSchema.AnyTypeJsonSchema1 { + private static @Nullable Schema01 instance = null; + public static Schema01 getInstance() { + if (instance == null) { + instance = new Schema01(); + } + return instance; + } + } + +} diff --git a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/fakequeryparamwithjsoncontenttype/get/responses/FakequeryparamwithjsoncontenttypeGetCode200Response.kt b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/fakequeryparamwithjsoncontenttype/get/responses/FakequeryparamwithjsoncontenttypeGetCode200Response.kt new file mode 100644 index 00000000000..c046371efa9 --- /dev/null +++ b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/fakequeryparamwithjsoncontenttype/get/responses/FakequeryparamwithjsoncontenttypeGetCode200Response.kt @@ -0,0 +1,63 @@ +package org.openapijsonschematools.client.paths.fakequeryparamwithjsoncontenttype.get.responses; + +import org.openapijsonschematools.client.configurations.SchemaConfiguration; +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; + +import java.util.AbstractMap; +import java.util.Map; +import java.net.http.HttpResponse; +import java.net.http.HttpHeaders; + +public class FakequeryparamwithjsoncontenttypeGetCode200Response { + public sealed interface SealedMediaType permits ApplicationjsonMediaType {} + + public record ApplicationjsonMediaType(ApplicationjsonSchema.ApplicationjsonSchema1 schema) implements SealedMediaType, MediaType { + public ApplicationjsonMediaType() { + this(ApplicationjsonSchema.ApplicationjsonSchema1.getInstance()); + } + @Override + public Nothing? encoding() { + return null; + } + } + public sealed interface SealedResponseBody permits ApplicationjsonResponseBody {} + public record ApplicationjsonResponseBody(ApplicationjsonSchema.AnyTypeJsonSchema1Boxed body) implements SealedResponseBody { } + + public static class FakequeryparamwithjsoncontenttypeGetCode200Response1 extends ResponseDeserializer { + public FakequeryparamwithjsoncontenttypeGetCode200Response1() { + super( + Map.ofEntries( + new AbstractMap.SimpleEntry<>("application/json", new ApplicationjsonMediaType()) + ) + ); + } + + @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); + } + + @Override + protected Nothing? getHeaders(HttpHeaders headers, SchemaConfiguration configuration) { + return null; + } + } + + @SuppressWarnings("serial") + public static class ResponseApiException extends ApiException { + public DeserializedHttpResponse deserializedResponse; + + public ResponseApiException(String s, HttpResponse response, DeserializedHttpResponse deserializedResponse) { + super(s, response); + this.deserializedResponse = deserializedResponse; + } + } +} diff --git a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/fakequeryparamwithjsoncontenttype/get/responses/code200response/content/applicationjson/ApplicationjsonSchema.kt b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/fakequeryparamwithjsoncontenttype/get/responses/code200response/content/applicationjson/ApplicationjsonSchema.kt new file mode 100644 index 00000000000..b9b66780181 --- /dev/null +++ b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/fakequeryparamwithjsoncontenttype/get/responses/code200response/content/applicationjson/ApplicationjsonSchema.kt @@ -0,0 +1,19 @@ +package org.openapijsonschematools.client.paths.fakequeryparamwithjsoncontenttype.get.responses.code200response.content.applicationjson; +import org.checkerframework.checker.nullness.qual.Nullable; +import org.openapijsonschematools.client.schemas.AnyTypeJsonSchema; + +public class ApplicationjsonSchema extends AnyTypeJsonSchema { + // nest classes so all schemas and input/output classes can be public + + + public static class ApplicationjsonSchema1 extends AnyTypeJsonSchema.AnyTypeJsonSchema1 { + private static @Nullable ApplicationjsonSchema1 instance = null; + public static ApplicationjsonSchema1 getInstance() { + if (instance == null) { + instance = new ApplicationjsonSchema1(); + } + return instance; + } + } + +} diff --git a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/fakeredirection/FakeredirectionGet.kt b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/fakeredirection/FakeredirectionGet.kt new file mode 100644 index 00000000000..f73a54d32b6 --- /dev/null +++ b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/fakeredirection/FakeredirectionGet.kt @@ -0,0 +1,124 @@ +package org.openapijsonschematools.client.paths.fakeredirection; + +import org.checkerframework.checker.nullness.qual.Nullable; +import org.openapijsonschematools.client.RootServerInfo; +import org.openapijsonschematools.client.paths.fakeredirection.get.FakeredirectionGetResponses; +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.paths.Fakeredirection; + +import java.io.IOException; +import java.net.http.HttpClient; +import java.net.http.HttpRequest; +import java.time.Duration; +import java.util.List; +import java.util.Map; + +public class FakeredirectionGet { + private static class GetProvider { + private static final String method = "get"; + + public static FakeredirectionGetResponses.EndpointResponse get( + GetRequest request, + ApiConfiguration apiConfiguration, + SchemaConfiguration schemaConfiguration, + HttpClient client + ) 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 + @Nullable Map queryMap = null; + String host = apiConfiguration.getServer(request.serverIndex).url(); + + String url = host + Fakeredirection.path; + var httpRequest = RestClient.getRequest( + url, + method, + bodyPublisher, + headers, + request.timeout + ); + var response = RestClient.getResponse(httpRequest, client); + var responsesDeserializer = new FakeredirectionGetResponses.FakeredirectionGetResponses1(); + return responsesDeserializer.deserialize(response, schemaConfiguration); + } + } + + public interface GetOperation { + ApiConfiguration getApiConfiguration(); + SchemaConfiguration getSchemaConfiguration(); + HttpClient getClient(); + default FakeredirectionGetResponses.EndpointResponse get(GetRequest request) throws IOException, InterruptedException, ValidationException, NotImplementedException, ApiException { + return GetProvider.get(request, getApiConfiguration(), getSchemaConfiguration(), getClient()); + } + } + + public interface RedirectionOperation { + ApiConfiguration getApiConfiguration(); + SchemaConfiguration getSchemaConfiguration(); + HttpClient getClient(); + default FakeredirectionGetResponses.EndpointResponse redirection(GetRequest request) throws IOException, InterruptedException, ValidationException, NotImplementedException, ApiException { + return GetProvider.get(request, getApiConfiguration(), getSchemaConfiguration(), getClient()); + } + } + + public static class Get extends ApiClient implements GetOperation { + public Get(ApiConfiguration apiConfiguration, SchemaConfiguration schemaConfiguration) { + super(apiConfiguration, schemaConfiguration); + } + } + + public static class GetRequest { + public RootServerInfo.@Nullable ServerIndex serverIndex; + public @Nullable Duration timeout; + } + + public interface SetterForServerIndex { + GetRequest getInstance(); + T getBuilderAfterServerIndex(GetRequest instance); + default T serverIndex(RootServerInfo.ServerIndex serverIndex) { + var instance = getInstance(); + instance.serverIndex = serverIndex; + return getBuilderAfterServerIndex(instance); + } + } + + public interface SetterForTimeout { + GetRequest getInstance(); + T getBuilderAfterTimeout(GetRequest instance); + default T timeout(Duration timeout) { + var instance = getInstance(); + instance.timeout = timeout; + return getBuilderAfterTimeout(instance); + } + } + + public static class GetRequestBuilder implements SetterForServerIndex, SetterForTimeout { + private final GetRequest instance; + + public GetRequestBuilder() { + this.instance = new GetRequest(); + } + + public GetRequest build() { + return instance; + } + + public GetRequest getInstance() { + return instance; + } + + public GetRequestBuilder getBuilderAfterServerIndex(GetRequest instance) { + return this; + } + + public GetRequestBuilder getBuilderAfterTimeout(GetRequest instance) { + return this; + } + } +} diff --git a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/fakeredirection/get/FakeredirectionGetResponses.kt b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/fakeredirection/get/FakeredirectionGetResponses.kt new file mode 100644 index 00000000000..1aa823bc3d3 --- /dev/null +++ b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/fakeredirection/get/FakeredirectionGetResponses.kt @@ -0,0 +1,79 @@ +package org.openapijsonschematools.client.paths.fakeredirection.get; + +import org.openapijsonschematools.client.paths.fakeredirection.get.responses.FakeredirectionGetCode303Response; +import org.openapijsonschematools.client.paths.fakeredirection.get.responses.FakeredirectionGetCode3XXResponse; +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; +import org.checkerframework.checker.nullness.qual.Nullable; + +import java.net.http.HttpResponse; +import java.util.Map; +import java.util.AbstractMap; + +public class FakeredirectionGetResponses { + public sealed interface EndpointResponse permits EndpointFakeredirectionGetCode3XXResponse, EndpointFakeredirectionGetCode303Response {} + + public record EndpointFakeredirectionGetCode3XXResponse( + HttpResponse response, + Nothing? body, + Nothing? headers + ) implements EndpointResponse, ApiResponse{ + } + + public record EndpointFakeredirectionGetCode303Response( + HttpResponse response, + Nothing? body, + Nothing? headers + ) implements EndpointResponse, ApiResponse{ + } + + public sealed interface StatusCodeResponseDeserializer permits StatusFakeredirectionGetCode303ResponseDeserializer {} + + public static final class StatusFakeredirectionGetCode303ResponseDeserializer extends FakeredirectionGetCode303Response.FakeredirectionGetCode303Response1 implements StatusCodeResponseDeserializer { + } + public sealed interface WildcardCodeResponseDeserializer permits WildcardFakeredirectionGetCode3XXResponseDeserializer {} + + public static final class WildcardFakeredirectionGetCode3XXResponseDeserializer extends FakeredirectionGetCode3XXResponse.FakeredirectionGetCode3XXResponse1 implements WildcardCodeResponseDeserializer { + } + + public static final class FakeredirectionGetResponses1 implements ResponsesDeserializer { + private final Map statusCodeToResponseDeserializer; + private final Map wildcardCodeToResponseDeserializer; + public FakeredirectionGetResponses1() { + this.statusCodeToResponseDeserializer = Map.ofEntries( + new AbstractMap.SimpleEntry<>("303", new StatusFakeredirectionGetCode303ResponseDeserializer()) + ); + this.wildcardCodeToResponseDeserializer = Map.ofEntries( + new AbstractMap.SimpleEntry<>("3", new WildcardFakeredirectionGetCode3XXResponseDeserializer()) + ); + } + + 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) { + StatusFakeredirectionGetCode303ResponseDeserializer castDeserializer = (StatusFakeredirectionGetCode303ResponseDeserializer) statusCodeDeserializer; + var deserializedResponse = castDeserializer.deserialize(response, configuration); + return new EndpointFakeredirectionGetCode303Response(response, deserializedResponse.body(), deserializedResponse.headers()); + } + @Nullable WildcardCodeResponseDeserializer wildcardCodeDeserializer = wildcardCodeToResponseDeserializer.get(statusCode); + if (wildcardCodeDeserializer == null) { + throw new ApiException( + "Invalid response statusCode="+statusCode+" has no response defined in the openapi document", + response + ); + } + WildcardFakeredirectionGetCode3XXResponseDeserializer castDeserializer = (WildcardFakeredirectionGetCode3XXResponseDeserializer) wildcardCodeDeserializer; + var deserializedResponse = castDeserializer.deserialize(response, configuration); + throw new FakeredirectionGetCode3XXResponse.ResponseApiException( + "Received error statusCode response from server", + response, + deserializedResponse + ); + } + } +} diff --git a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/fakeredirection/get/responses/FakeredirectionGetCode303Response.kt b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/fakeredirection/get/responses/FakeredirectionGetCode303Response.kt new file mode 100644 index 00000000000..21e48b31b11 --- /dev/null +++ b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/fakeredirection/get/responses/FakeredirectionGetCode303Response.kt @@ -0,0 +1,45 @@ +package org.openapijsonschematools.client.paths.fakeredirection.get.responses; + +import org.openapijsonschematools.client.configurations.SchemaConfiguration; +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; +import java.net.http.HttpResponse; +import java.net.http.HttpHeaders; + +public class FakeredirectionGetCode303Response { + + public static class FakeredirectionGetCode303Response1 extends ResponseDeserializer { + public FakeredirectionGetCode303Response1() { + super( + MapUtils.makeMap( + ) + ); + } + + @Override + protected Nothing? getBody(String contentType, Nothing? mediaType, byte[] body, SchemaConfiguration configuration) { + return null; + } + + @Override + protected Nothing? getHeaders(HttpHeaders headers, SchemaConfiguration configuration) { + return null; + } + } + + @SuppressWarnings("serial") + public static class ResponseApiException extends ApiException { + public DeserializedHttpResponse deserializedResponse; + + public ResponseApiException(String s, HttpResponse response, DeserializedHttpResponse deserializedResponse) { + super(s, response); + this.deserializedResponse = deserializedResponse; + } + } +} diff --git a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/fakeredirection/get/responses/FakeredirectionGetCode3XXResponse.kt b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/fakeredirection/get/responses/FakeredirectionGetCode3XXResponse.kt new file mode 100644 index 00000000000..34f0978b7d8 --- /dev/null +++ b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/fakeredirection/get/responses/FakeredirectionGetCode3XXResponse.kt @@ -0,0 +1,45 @@ +package org.openapijsonschematools.client.paths.fakeredirection.get.responses; + +import org.openapijsonschematools.client.configurations.SchemaConfiguration; +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; +import java.net.http.HttpResponse; +import java.net.http.HttpHeaders; + +public class FakeredirectionGetCode3XXResponse { + + public static class FakeredirectionGetCode3XXResponse1 extends ResponseDeserializer { + public FakeredirectionGetCode3XXResponse1() { + super( + MapUtils.makeMap( + ) + ); + } + + @Override + protected Nothing? getBody(String contentType, Nothing? mediaType, byte[] body, SchemaConfiguration configuration) { + return null; + } + + @Override + protected Nothing? getHeaders(HttpHeaders headers, SchemaConfiguration configuration) { + return null; + } + } + + @SuppressWarnings("serial") + public static class ResponseApiException extends ApiException { + public DeserializedHttpResponse deserializedResponse; + + public ResponseApiException(String s, HttpResponse response, DeserializedHttpResponse deserializedResponse) { + super(s, response); + this.deserializedResponse = deserializedResponse; + } + } +} diff --git a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/fakerefobjinquery/FakerefobjinqueryGet.kt b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/fakerefobjinquery/FakerefobjinqueryGet.kt new file mode 100644 index 00000000000..56e42d4d5c2 --- /dev/null +++ b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/fakerefobjinquery/FakerefobjinqueryGet.kt @@ -0,0 +1,148 @@ +package org.openapijsonschematools.client.paths.fakerefobjinquery; + +import org.checkerframework.checker.nullness.qual.Nullable; +import org.openapijsonschematools.client.paths.fakerefobjinquery.get.FakerefobjinqueryGetQueryParameters; +import org.openapijsonschematools.client.RootServerInfo; +import org.openapijsonschematools.client.paths.fakerefobjinquery.get.Parameters; +import org.openapijsonschematools.client.paths.fakerefobjinquery.get.FakerefobjinqueryGetResponses; +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.paths.Fakerefobjinquery; + +import java.io.IOException; +import java.net.http.HttpClient; +import java.net.http.HttpRequest; +import java.time.Duration; +import java.util.List; +import java.util.Map; + +public class FakerefobjinqueryGet { + private static class GetProvider { + private static final String method = "get"; + + public static FakerefobjinqueryGetResponses.EndpointResponse get( + GetRequest request, + ApiConfiguration apiConfiguration, + SchemaConfiguration schemaConfiguration, + HttpClient client + ) throws IOException, InterruptedException, ValidationException, NotImplementedException, ApiException { + Map> headers = apiConfiguration.getDefaultHeaders(); + HttpRequest.BodyPublisher bodyPublisher = HttpRequest.BodyPublishers.noBody(); + + var querySerializer = new Parameters.QueryParametersSerializer(); + @Nullable Map queryMap = null; + if (request.queryParameters != null) { + queryMap = querySerializer.getQueryMap(request.queryParameters); + } + String host = apiConfiguration.getServer(request.serverIndex).url(); + + String url = host + Fakerefobjinquery.path; + if (queryMap != null) { + url = url + querySerializer.serialize(queryMap); + } + var httpRequest = RestClient.getRequest( + url, + method, + bodyPublisher, + headers, + request.timeout + ); + var response = RestClient.getResponse(httpRequest, client); + var responsesDeserializer = new FakerefobjinqueryGetResponses.FakerefobjinqueryGetResponses1(); + return responsesDeserializer.deserialize(response, schemaConfiguration); + } + } + + public interface GetOperation { + ApiConfiguration getApiConfiguration(); + SchemaConfiguration getSchemaConfiguration(); + HttpClient getClient(); + default FakerefobjinqueryGetResponses.EndpointResponse get(GetRequest request) throws IOException, InterruptedException, ValidationException, NotImplementedException, ApiException { + return GetProvider.get(request, getApiConfiguration(), getSchemaConfiguration(), getClient()); + } + } + + public interface RefObjectInQueryOperation { + ApiConfiguration getApiConfiguration(); + SchemaConfiguration getSchemaConfiguration(); + HttpClient getClient(); + default FakerefobjinqueryGetResponses.EndpointResponse refObjectInQuery(GetRequest request) throws IOException, InterruptedException, ValidationException, NotImplementedException, ApiException { + return GetProvider.get(request, getApiConfiguration(), getSchemaConfiguration(), getClient()); + } + } + + public static class Get extends ApiClient implements GetOperation { + public Get(ApiConfiguration apiConfiguration, SchemaConfiguration schemaConfiguration) { + super(apiConfiguration, schemaConfiguration); + } + } + + public static class GetRequest { + public FakerefobjinqueryGetQueryParameters.@Nullable QueryParametersMap queryParameters; + public RootServerInfo.@Nullable ServerIndex serverIndex; + public @Nullable Duration timeout; + } + + public interface SetterForQueryParameters { + GetRequest getInstance(); + T getBuilderAfterQueryParameters(GetRequest instance); + default T queryParameters(FakerefobjinqueryGetQueryParameters.QueryParametersMap queryParameters) { + var instance = getInstance(); + instance.queryParameters = queryParameters; + return getBuilderAfterQueryParameters(instance); + } + } + + public interface SetterForServerIndex { + GetRequest getInstance(); + T getBuilderAfterServerIndex(GetRequest instance); + default T serverIndex(RootServerInfo.ServerIndex serverIndex) { + var instance = getInstance(); + instance.serverIndex = serverIndex; + return getBuilderAfterServerIndex(instance); + } + } + + public interface SetterForTimeout { + GetRequest getInstance(); + T getBuilderAfterTimeout(GetRequest instance); + default T timeout(Duration timeout) { + var instance = getInstance(); + instance.timeout = timeout; + return getBuilderAfterTimeout(instance); + } + } + + public static class GetRequestBuilder implements SetterForQueryParameters, SetterForServerIndex, SetterForTimeout { + private final GetRequest instance; + + public GetRequestBuilder() { + this.instance = new GetRequest(); + } + + public GetRequest build() { + return instance; + } + + public GetRequest getInstance() { + return instance; + } + + public GetRequestBuilder getBuilderAfterQueryParameters(GetRequest instance) { + return this; + } + + public GetRequestBuilder getBuilderAfterServerIndex(GetRequest instance) { + return this; + } + + public GetRequestBuilder getBuilderAfterTimeout(GetRequest instance) { + return this; + } + } +} diff --git a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/fakerefobjinquery/get/FakerefobjinqueryGetQueryParameters.kt b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/fakerefobjinquery/get/FakerefobjinqueryGetQueryParameters.kt new file mode 100644 index 00000000000..d9369761fde --- /dev/null +++ b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/fakerefobjinquery/get/FakerefobjinqueryGetQueryParameters.kt @@ -0,0 +1,191 @@ +package org.openapijsonschematools.client.paths.fakerefobjinquery.get; +import java.util.ArrayList; +import java.util.HashSet; +import java.util.LinkedHashMap; +import java.util.LinkedHashSet; +import java.util.List; +import java.util.Map; +import java.util.Objects; +import java.util.Set; +import org.checkerframework.checker.nullness.qual.Nullable; +import org.openapijsonschematools.client.components.schemas.Foo; +import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags; +import org.openapijsonschematools.client.configurations.SchemaConfiguration; +import org.openapijsonschematools.client.exceptions.UnsetPropertyException; +import org.openapijsonschematools.client.exceptions.ValidationException; +import org.openapijsonschematools.client.schemas.AnyTypeJsonSchema; +import org.openapijsonschematools.client.schemas.GenericBuilder; +import org.openapijsonschematools.client.schemas.NotAnyTypeJsonSchema; +import org.openapijsonschematools.client.schemas.validation.FrozenMap; +import org.openapijsonschematools.client.schemas.validation.JsonSchema; +import org.openapijsonschematools.client.schemas.validation.JsonSchemaInfo; +import org.openapijsonschematools.client.schemas.validation.MapSchemaValidator; +import org.openapijsonschematools.client.schemas.validation.MapUtils; +import org.openapijsonschematools.client.schemas.validation.PathToSchemasMap; +import org.openapijsonschematools.client.schemas.validation.PropertyEntry; +import org.openapijsonschematools.client.schemas.validation.ValidationMetadata; + +public class FakerefobjinqueryGetQueryParameters { + // nest classes so all schemas and input/output classes can be public + + + public static class AdditionalProperties extends NotAnyTypeJsonSchema.NotAnyTypeJsonSchema1 { + // NotAnyTypeSchema + private static @Nullable AdditionalProperties instance = null; + public static AdditionalProperties getInstance() { + if (instance == null) { + instance = new AdditionalProperties(); + } + return instance; + } + } + + + public static class QueryParametersMap extends FrozenMap { + protected QueryParametersMap(FrozenMap m) { + super(m); + } + public static final Set requiredKeys = Set.of(); + public static final Set optionalKeys = Set.of( + "mapBean" + ); + public static QueryParametersMap of(Map> arg, SchemaConfiguration configuration) throws ValidationException { + return FakerefobjinqueryGetQueryParameters1.getInstance().validate(arg, configuration); + } + + public Foo.FooMap mapBean() throws UnsetPropertyException { + return getOrThrow("mapBean"); + } + } + + public interface SetterForMapBean { + Map> getInstance(); + T getBuilderAfterMapBean(Map> instance); + + default T mapBean(Map value) { + var instance = getInstance(); + instance.put("mapBean", value); + return getBuilderAfterMapBean(instance); + } + } + + public static class QueryParametersMapBuilder implements GenericBuilder>>, SetterForMapBean { + private final Map> instance; + private static final Set knownKeys = Set.of( + "mapBean" + ); + public Set getKnownKeys() { + return knownKeys; + } + public QueryParametersMapBuilder() { + this.instance = new LinkedHashMap<>(); + } + public Map> build() { + return instance; + } + public Map> getInstance() { + return instance; + } + public QueryParametersMapBuilder getBuilderAfterMapBean(Map> instance) { + return this; + } + } + + + public sealed interface FakerefobjinqueryGetQueryParameters1Boxed permits FakerefobjinqueryGetQueryParameters1BoxedMap { + @Nullable Object getData(); + } + + public record FakerefobjinqueryGetQueryParameters1BoxedMap(QueryParametersMap data) implements FakerefobjinqueryGetQueryParameters1Boxed { + @Override + public @Nullable Object getData() { + return data; + } + } + + + public static class FakerefobjinqueryGetQueryParameters1 extends JsonSchema implements MapSchemaValidator { + private static @Nullable FakerefobjinqueryGetQueryParameters1 instance = null; + + protected FakerefobjinqueryGetQueryParameters1() { + super(new JsonSchemaInfo() + .type(Set.of(Map.class)) + .properties(Map.ofEntries( + new PropertyEntry("mapBean", Foo.Foo1.class) + )) + .additionalProperties(AdditionalProperties.class) + ); + } + + public static FakerefobjinqueryGetQueryParameters1 getInstance() { + if (instance == null) { + instance = new FakerefobjinqueryGetQueryParameters1(); + } + return instance; + } + + 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 RuntimeException("Invalid non-string key value"); + } + String propertyName = (String) entryKey; + List propertyPathToItem = new ArrayList<>(pathToItem); + propertyPathToItem.add(propertyName); + Object value = entry.getValue(); + LinkedHashMap, Nothing?> schemas = pathToSchemas.get(propertyPathToItem); + if (schemas == null) { + throw new RuntimeException("Validation 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"); + } + properties.put(propertyName, (Foo.FooMap) propertyInstance); + } + FrozenMap castProperties = new FrozenMap<>(properties); + return new QueryParametersMap(castProperties); + } + + 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); + SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().build())); + ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, new PathToSchemasMap(), new LinkedHashSet<>()); + PathToSchemasMap pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet); + return getNewInstance(castArg, validationMetadata.pathToItem(), pathToSchemasMap); + } + + + @Override + public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws 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"); + } + @Override + public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { + if (arg instanceof Map) { + return getNewInstance((Map) arg, pathToItem, pathToSchemas); + } + throw new RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); + } + @Override + public FakerefobjinqueryGetQueryParameters1BoxedMap validateAndBox(Map arg, SchemaConfiguration configuration) throws ValidationException { + return new FakerefobjinqueryGetQueryParameters1BoxedMap(validate(arg, configuration)); + } + @Override + public FakerefobjinqueryGetQueryParameters1Boxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { + 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"); + } + } + +} diff --git a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/fakerefobjinquery/get/FakerefobjinqueryGetResponses.kt b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/fakerefobjinquery/get/FakerefobjinqueryGetResponses.kt new file mode 100644 index 00000000000..bb044c27053 --- /dev/null +++ b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/fakerefobjinquery/get/FakerefobjinqueryGetResponses.kt @@ -0,0 +1,53 @@ +package org.openapijsonschematools.client.paths.fakerefobjinquery.get; + +import org.openapijsonschematools.client.paths.fakerefobjinquery.get.responses.FakerefobjinqueryGetCode200Response; +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; +import org.checkerframework.checker.nullness.qual.Nullable; + +import java.net.http.HttpResponse; +import java.util.Map; +import java.util.AbstractMap; + +public class FakerefobjinqueryGetResponses { + public sealed interface EndpointResponse permits EndpointFakerefobjinqueryGetCode200Response {} + + public record EndpointFakerefobjinqueryGetCode200Response( + HttpResponse response, + Nothing? body, + Nothing? headers + ) implements EndpointResponse, ApiResponse{ + } + + public sealed interface StatusCodeResponseDeserializer permits StatusFakerefobjinqueryGetCode200ResponseDeserializer {} + + public static final class StatusFakerefobjinqueryGetCode200ResponseDeserializer extends FakerefobjinqueryGetCode200Response.FakerefobjinqueryGetCode200Response1 implements StatusCodeResponseDeserializer { + } + + public static final class FakerefobjinqueryGetResponses1 implements ResponsesDeserializer { + private final Map statusCodeToResponseDeserializer; + public FakerefobjinqueryGetResponses1() { + this.statusCodeToResponseDeserializer = Map.ofEntries( + new AbstractMap.SimpleEntry<>("200", new StatusFakerefobjinqueryGetCode200ResponseDeserializer()) + ); + } + + 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) { + throw new ApiException( + "Invalid response statusCode="+statusCode+" has no response defined in the openapi document", + response + ); + } + StatusFakerefobjinqueryGetCode200ResponseDeserializer castDeserializer = (StatusFakerefobjinqueryGetCode200ResponseDeserializer) statusCodeDeserializer; + var deserializedResponse = castDeserializer.deserialize(response, configuration); + return new EndpointFakerefobjinqueryGetCode200Response(response, deserializedResponse.body(), deserializedResponse.headers()); + } + } +} diff --git a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/fakerefobjinquery/get/Parameters.kt b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/fakerefobjinquery/get/Parameters.kt new file mode 100644 index 00000000000..c237004cd7e --- /dev/null +++ b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/fakerefobjinquery/get/Parameters.kt @@ -0,0 +1,20 @@ +package org.openapijsonschematools.client.paths.fakerefobjinquery.get; + +import org.openapijsonschematools.client.paths.fakerefobjinquery.get.parameters.Parameter0; +import org.openapijsonschematools.client.parameter.QuerySerializer; + +import java.util.Map; +import java.util.AbstractMap; + +public class Parameters { + + public static class QueryParametersSerializer extends QuerySerializer { + public QueryParametersSerializer() { + super( + Map.ofEntries( + new AbstractMap.SimpleEntry<>("mapBean", new Parameter0.Parameter01()) + ) + ); + } + } +} diff --git a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/fakerefobjinquery/get/parameters/Parameter0.kt b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/fakerefobjinquery/get/parameters/Parameter0.kt new file mode 100644 index 00000000000..f1b8a6d8720 --- /dev/null +++ b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/fakerefobjinquery/get/parameters/Parameter0.kt @@ -0,0 +1,23 @@ +package org.openapijsonschematools.client.paths.fakerefobjinquery.get.parameters; + +import org.openapijsonschematools.client.parameter.ParameterStyle; +import org.openapijsonschematools.client.parameter.ParameterInType; +import org.openapijsonschematools.client.parameter.SchemaParameter; +import org.openapijsonschematools.client.paths.fakerefobjinquery.get.parameters.parameter0.Schema0; + +public class Parameter0 { + + public static class Parameter01 extends SchemaParameter { + public Parameter01() { + super( + "mapBean", + ParameterInType.QUERY, + false, + ParameterStyle.DEEP_OBJECT, + true, + false, + Schema0.Schema01.getInstance() + ); + } + } +} diff --git a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/fakerefobjinquery/get/parameters/parameter0/Schema0.kt b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/fakerefobjinquery/get/parameters/parameter0/Schema0.kt new file mode 100644 index 00000000000..55405e37a30 --- /dev/null +++ b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/fakerefobjinquery/get/parameters/parameter0/Schema0.kt @@ -0,0 +1,19 @@ +package org.openapijsonschematools.client.paths.fakerefobjinquery.get.parameters.parameter0; + +import org.checkerframework.checker.nullness.qual.Nullable; +import org.openapijsonschematools.client.components.schemas.Foo; + +public class Schema0 extends Foo { + // $refed class + + + public static class Schema01 extends Foo1 { + private static @Nullable Schema01 instance = null; + public static Schema01 getInstance() { + if (instance == null) { + instance = new Schema01(); + } + return instance; + } + } +} diff --git a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/fakerefobjinquery/get/responses/FakerefobjinqueryGetCode200Response.kt b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/fakerefobjinquery/get/responses/FakerefobjinqueryGetCode200Response.kt new file mode 100644 index 00000000000..7ae25fb0e12 --- /dev/null +++ b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/fakerefobjinquery/get/responses/FakerefobjinqueryGetCode200Response.kt @@ -0,0 +1,7 @@ +package org.openapijsonschematools.client.paths.fakerefobjinquery.get.responses; + +import org.openapijsonschematools.client.components.responses.SuccessDescriptionOnly; + +public class FakerefobjinqueryGetCode200Response extends SuccessDescriptionOnly { + public static class FakerefobjinqueryGetCode200Response1 extends SuccessDescriptionOnly1 {} +} diff --git a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/fakerefsarraymodel/FakerefsarraymodelPost.kt b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/fakerefsarraymodel/FakerefsarraymodelPost.kt new file mode 100644 index 00000000000..07af16ea8b6 --- /dev/null +++ b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/fakerefsarraymodel/FakerefsarraymodelPost.kt @@ -0,0 +1,152 @@ +package org.openapijsonschematools.client.paths.fakerefsarraymodel; + +import org.checkerframework.checker.nullness.qual.Nullable; +import org.openapijsonschematools.client.paths.fakerefsarraymodel.post.FakerefsarraymodelPostRequestBody; +import org.openapijsonschematools.client.RootServerInfo; +import org.openapijsonschematools.client.paths.fakerefsarraymodel.post.FakerefsarraymodelPostResponses; +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.requestbody.SerializedRequestBody; +import org.openapijsonschematools.client.paths.Fakerefsarraymodel; + +import java.io.IOException; +import java.util.ArrayList; +import java.net.http.HttpClient; +import java.net.http.HttpRequest; +import java.time.Duration; +import java.util.List; +import java.util.Map; + +public class FakerefsarraymodelPost { + private static class PostProvider { + private static final String method = "post"; + + public static FakerefsarraymodelPostResponses.EndpointResponse post( + PostRequest request, + ApiConfiguration apiConfiguration, + SchemaConfiguration schemaConfiguration, + HttpClient client + ) throws IOException, InterruptedException, ValidationException, NotImplementedException, ApiException { + Map> headers = apiConfiguration.getDefaultHeaders(); + + @Nullable SerializedRequestBody serializedRequestBody; + HttpRequest.BodyPublisher bodyPublisher = HttpRequest.BodyPublishers.noBody(); + if (request.requestBody != null) { + serializedRequestBody = new FakerefsarraymodelPostRequestBody.FakerefsarraymodelPostRequestBody1().serialize( + request.requestBody + ); + var contentTypeHeaderValues = headers.getOrDefault("Content-Type", new ArrayList<>()); + contentTypeHeaderValues.add(serializedRequestBody.contentType); + bodyPublisher = serializedRequestBody.bodyPublisher; + } + // TODO set this to a map if there is a query security scheme + @Nullable Map queryMap = null; + String host = apiConfiguration.getServer(request.serverIndex).url(); + + String url = host + Fakerefsarraymodel.path; + var httpRequest = RestClient.getRequest( + url, + method, + bodyPublisher, + headers, + request.timeout + ); + var response = RestClient.getResponse(httpRequest, client); + var responsesDeserializer = new FakerefsarraymodelPostResponses.FakerefsarraymodelPostResponses1(); + return responsesDeserializer.deserialize(response, schemaConfiguration); + } + } + + public interface PostOperation { + ApiConfiguration getApiConfiguration(); + SchemaConfiguration getSchemaConfiguration(); + HttpClient getClient(); + default FakerefsarraymodelPostResponses.EndpointResponse post(PostRequest request) throws IOException, InterruptedException, ValidationException, NotImplementedException, ApiException { + return PostProvider.post(request, getApiConfiguration(), getSchemaConfiguration(), getClient()); + } + } + + public interface ArrayModelOperation { + ApiConfiguration getApiConfiguration(); + SchemaConfiguration getSchemaConfiguration(); + HttpClient getClient(); + default FakerefsarraymodelPostResponses.EndpointResponse arrayModel(PostRequest request) throws IOException, InterruptedException, ValidationException, NotImplementedException, ApiException { + return PostProvider.post(request, getApiConfiguration(), getSchemaConfiguration(), getClient()); + } + } + + public static class Post extends ApiClient implements PostOperation { + public Post(ApiConfiguration apiConfiguration, SchemaConfiguration schemaConfiguration) { + super(apiConfiguration, schemaConfiguration); + } + } + + public static class PostRequest { + public FakerefsarraymodelPostRequestBody.@Nullable SealedRequestBody requestBody; + public RootServerInfo.@Nullable ServerIndex serverIndex; + public @Nullable Duration timeout; + } + + public interface SetterForRequestBody { + PostRequest getInstance(); + T getBuilderAfterRequestBody(PostRequest instance); + default T requestBody(FakerefsarraymodelPostRequestBody.SealedRequestBody requestBody) { + var instance = getInstance(); + instance.requestBody = requestBody; + return getBuilderAfterRequestBody(instance); + } + } + + public interface SetterForServerIndex { + PostRequest getInstance(); + T getBuilderAfterServerIndex(PostRequest instance); + default T serverIndex(RootServerInfo.ServerIndex serverIndex) { + var instance = getInstance(); + instance.serverIndex = serverIndex; + return getBuilderAfterServerIndex(instance); + } + } + + public interface SetterForTimeout { + PostRequest getInstance(); + T getBuilderAfterTimeout(PostRequest instance); + default T timeout(Duration timeout) { + var instance = getInstance(); + instance.timeout = timeout; + return getBuilderAfterTimeout(instance); + } + } + + public static class PostRequestBuilder implements SetterForRequestBody, SetterForServerIndex, SetterForTimeout { + private final PostRequest instance; + + public PostRequestBuilder() { + this.instance = new PostRequest(); + } + + public PostRequest build() { + return instance; + } + + public PostRequest getInstance() { + return instance; + } + + public PostRequestBuilder getBuilderAfterRequestBody(PostRequest instance) { + return this; + } + + public PostRequestBuilder getBuilderAfterServerIndex(PostRequest instance) { + return this; + } + + public PostRequestBuilder getBuilderAfterTimeout(PostRequest instance) { + return this; + } + } +} diff --git a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/fakerefsarraymodel/post/FakerefsarraymodelPostRequestBody.kt b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/fakerefsarraymodel/post/FakerefsarraymodelPostRequestBody.kt new file mode 100644 index 00000000000..0109dd1aae7 --- /dev/null +++ b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/fakerefsarraymodel/post/FakerefsarraymodelPostRequestBody.kt @@ -0,0 +1,49 @@ +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; +import org.openapijsonschematools.client.mediatype.MediaType; +import org.openapijsonschematools.client.paths.fakerefsarraymodel.post.requestbody.content.applicationjson.ApplicationjsonSchema; + +import java.util.AbstractMap; +import java.util.Map; + +public class FakerefsarraymodelPostRequestBody { + public sealed interface SealedMediaType permits ApplicationjsonMediaType {} + + public record ApplicationjsonMediaType(ApplicationjsonSchema.ApplicationjsonSchema1 schema) implements SealedMediaType, MediaType { + public ApplicationjsonMediaType() { + this(ApplicationjsonSchema.ApplicationjsonSchema1.getInstance()); + } + @Override + public Nothing? encoding() { + return null; + } + } + + public static class FakerefsarraymodelPostRequestBody1 extends RequestBodySerializer { + public FakerefsarraymodelPostRequestBody1() { + super( + Map.ofEntries( + new AbstractMap.SimpleEntry<>("application/json", new ApplicationjsonMediaType()) + ), + false + ); + } + + public SerializedRequestBody serialize(SealedRequestBody requestBody) throws NotImplementedException { + ApplicationjsonRequestBody requestBody0 = (ApplicationjsonRequestBody) requestBody; + return serialize(requestBody0.contentType(), requestBody0.body().getData()); + } + } + + public sealed interface SealedRequestBody permits ApplicationjsonRequestBody {} + public record ApplicationjsonRequestBody(ApplicationjsonSchema.AnimalFarm1Boxed body) implements SealedRequestBody, GenericRequestBody { + @Override + public String contentType() { + return "application/json"; + } + } +} diff --git a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/fakerefsarraymodel/post/FakerefsarraymodelPostResponses.kt b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/fakerefsarraymodel/post/FakerefsarraymodelPostResponses.kt new file mode 100644 index 00000000000..c1a0d439502 --- /dev/null +++ b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/fakerefsarraymodel/post/FakerefsarraymodelPostResponses.kt @@ -0,0 +1,53 @@ +package org.openapijsonschematools.client.paths.fakerefsarraymodel.post; + +import org.openapijsonschematools.client.paths.fakerefsarraymodel.post.responses.FakerefsarraymodelPostCode200Response; +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; +import org.checkerframework.checker.nullness.qual.Nullable; + +import java.net.http.HttpResponse; +import java.util.Map; +import java.util.AbstractMap; + +public class FakerefsarraymodelPostResponses { + public sealed interface EndpointResponse permits EndpointFakerefsarraymodelPostCode200Response {} + + public record EndpointFakerefsarraymodelPostCode200Response( + HttpResponse response, + FakerefsarraymodelPostCode200Response.SealedResponseBody body, + Nothing? headers + ) implements EndpointResponse, ApiResponse{ + } + + public sealed interface StatusCodeResponseDeserializer permits StatusFakerefsarraymodelPostCode200ResponseDeserializer {} + + public static final class StatusFakerefsarraymodelPostCode200ResponseDeserializer extends FakerefsarraymodelPostCode200Response.FakerefsarraymodelPostCode200Response1 implements StatusCodeResponseDeserializer { + } + + public static final class FakerefsarraymodelPostResponses1 implements ResponsesDeserializer { + private final Map statusCodeToResponseDeserializer; + public FakerefsarraymodelPostResponses1() { + this.statusCodeToResponseDeserializer = Map.ofEntries( + new AbstractMap.SimpleEntry<>("200", new StatusFakerefsarraymodelPostCode200ResponseDeserializer()) + ); + } + + 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) { + throw new ApiException( + "Invalid response statusCode="+statusCode+" has no response defined in the openapi document", + response + ); + } + StatusFakerefsarraymodelPostCode200ResponseDeserializer castDeserializer = (StatusFakerefsarraymodelPostCode200ResponseDeserializer) statusCodeDeserializer; + var deserializedResponse = castDeserializer.deserialize(response, configuration); + return new EndpointFakerefsarraymodelPostCode200Response(response, deserializedResponse.body(), deserializedResponse.headers()); + } + } +} diff --git a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/fakerefsarraymodel/post/requestbody/content/applicationjson/ApplicationjsonSchema.kt b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/fakerefsarraymodel/post/requestbody/content/applicationjson/ApplicationjsonSchema.kt new file mode 100644 index 00000000000..702bfe3e25a --- /dev/null +++ b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/fakerefsarraymodel/post/requestbody/content/applicationjson/ApplicationjsonSchema.kt @@ -0,0 +1,19 @@ +package org.openapijsonschematools.client.paths.fakerefsarraymodel.post.requestbody.content.applicationjson; + +import org.checkerframework.checker.nullness.qual.Nullable; +import org.openapijsonschematools.client.components.schemas.AnimalFarm; + +public class ApplicationjsonSchema extends AnimalFarm { + // $refed class + + + public static class ApplicationjsonSchema1 extends AnimalFarm1 { + private static @Nullable ApplicationjsonSchema1 instance = null; + public static ApplicationjsonSchema1 getInstance() { + if (instance == null) { + instance = new ApplicationjsonSchema1(); + } + return instance; + } + } +} diff --git a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/fakerefsarraymodel/post/responses/FakerefsarraymodelPostCode200Response.kt b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/fakerefsarraymodel/post/responses/FakerefsarraymodelPostCode200Response.kt new file mode 100644 index 00000000000..081bfee2f44 --- /dev/null +++ b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/fakerefsarraymodel/post/responses/FakerefsarraymodelPostCode200Response.kt @@ -0,0 +1,63 @@ +package org.openapijsonschematools.client.paths.fakerefsarraymodel.post.responses; + +import org.openapijsonschematools.client.configurations.SchemaConfiguration; +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; + +import java.util.AbstractMap; +import java.util.Map; +import java.net.http.HttpResponse; +import java.net.http.HttpHeaders; + +public class FakerefsarraymodelPostCode200Response { + public sealed interface SealedMediaType permits ApplicationjsonMediaType {} + + public record ApplicationjsonMediaType(ApplicationjsonSchema.ApplicationjsonSchema1 schema) implements SealedMediaType, MediaType { + public ApplicationjsonMediaType() { + this(ApplicationjsonSchema.ApplicationjsonSchema1.getInstance()); + } + @Override + public Nothing? encoding() { + return null; + } + } + public sealed interface SealedResponseBody permits ApplicationjsonResponseBody {} + public record ApplicationjsonResponseBody(ApplicationjsonSchema.AnimalFarm1Boxed body) implements SealedResponseBody { } + + public static class FakerefsarraymodelPostCode200Response1 extends ResponseDeserializer { + public FakerefsarraymodelPostCode200Response1() { + super( + Map.ofEntries( + new AbstractMap.SimpleEntry<>("application/json", new ApplicationjsonMediaType()) + ) + ); + } + + @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); + } + + @Override + protected Nothing? getHeaders(HttpHeaders headers, SchemaConfiguration configuration) { + return null; + } + } + + @SuppressWarnings("serial") + public static class ResponseApiException extends ApiException { + public DeserializedHttpResponse deserializedResponse; + + public ResponseApiException(String s, HttpResponse response, DeserializedHttpResponse deserializedResponse) { + super(s, response); + this.deserializedResponse = deserializedResponse; + } + } +} diff --git a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/fakerefsarraymodel/post/responses/code200response/content/applicationjson/ApplicationjsonSchema.kt b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/fakerefsarraymodel/post/responses/code200response/content/applicationjson/ApplicationjsonSchema.kt new file mode 100644 index 00000000000..3183986a750 --- /dev/null +++ b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/fakerefsarraymodel/post/responses/code200response/content/applicationjson/ApplicationjsonSchema.kt @@ -0,0 +1,19 @@ +package org.openapijsonschematools.client.paths.fakerefsarraymodel.post.responses.code200response.content.applicationjson; + +import org.checkerframework.checker.nullness.qual.Nullable; +import org.openapijsonschematools.client.components.schemas.AnimalFarm; + +public class ApplicationjsonSchema extends AnimalFarm { + // $refed class + + + public static class ApplicationjsonSchema1 extends AnimalFarm1 { + private static @Nullable ApplicationjsonSchema1 instance = null; + public static ApplicationjsonSchema1 getInstance() { + if (instance == null) { + instance = new ApplicationjsonSchema1(); + } + return instance; + } + } +} diff --git a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/fakerefsarrayofenums/FakerefsarrayofenumsPost.kt b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/fakerefsarrayofenums/FakerefsarrayofenumsPost.kt new file mode 100644 index 00000000000..2e562146fb3 --- /dev/null +++ b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/fakerefsarrayofenums/FakerefsarrayofenumsPost.kt @@ -0,0 +1,152 @@ +package org.openapijsonschematools.client.paths.fakerefsarrayofenums; + +import org.checkerframework.checker.nullness.qual.Nullable; +import org.openapijsonschematools.client.paths.fakerefsarrayofenums.post.FakerefsarrayofenumsPostRequestBody; +import org.openapijsonschematools.client.RootServerInfo; +import org.openapijsonschematools.client.paths.fakerefsarrayofenums.post.FakerefsarrayofenumsPostResponses; +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.requestbody.SerializedRequestBody; +import org.openapijsonschematools.client.paths.Fakerefsarrayofenums; + +import java.io.IOException; +import java.util.ArrayList; +import java.net.http.HttpClient; +import java.net.http.HttpRequest; +import java.time.Duration; +import java.util.List; +import java.util.Map; + +public class FakerefsarrayofenumsPost { + private static class PostProvider { + private static final String method = "post"; + + public static FakerefsarrayofenumsPostResponses.EndpointResponse post( + PostRequest request, + ApiConfiguration apiConfiguration, + SchemaConfiguration schemaConfiguration, + HttpClient client + ) throws IOException, InterruptedException, ValidationException, NotImplementedException, ApiException { + Map> headers = apiConfiguration.getDefaultHeaders(); + + @Nullable SerializedRequestBody serializedRequestBody; + HttpRequest.BodyPublisher bodyPublisher = HttpRequest.BodyPublishers.noBody(); + if (request.requestBody != null) { + serializedRequestBody = new FakerefsarrayofenumsPostRequestBody.FakerefsarrayofenumsPostRequestBody1().serialize( + request.requestBody + ); + var contentTypeHeaderValues = headers.getOrDefault("Content-Type", new ArrayList<>()); + contentTypeHeaderValues.add(serializedRequestBody.contentType); + bodyPublisher = serializedRequestBody.bodyPublisher; + } + // TODO set this to a map if there is a query security scheme + @Nullable Map queryMap = null; + String host = apiConfiguration.getServer(request.serverIndex).url(); + + String url = host + Fakerefsarrayofenums.path; + var httpRequest = RestClient.getRequest( + url, + method, + bodyPublisher, + headers, + request.timeout + ); + var response = RestClient.getResponse(httpRequest, client); + var responsesDeserializer = new FakerefsarrayofenumsPostResponses.FakerefsarrayofenumsPostResponses1(); + return responsesDeserializer.deserialize(response, schemaConfiguration); + } + } + + public interface PostOperation { + ApiConfiguration getApiConfiguration(); + SchemaConfiguration getSchemaConfiguration(); + HttpClient getClient(); + default FakerefsarrayofenumsPostResponses.EndpointResponse post(PostRequest request) throws IOException, InterruptedException, ValidationException, NotImplementedException, ApiException { + return PostProvider.post(request, getApiConfiguration(), getSchemaConfiguration(), getClient()); + } + } + + public interface ArrayOfEnumsOperation { + ApiConfiguration getApiConfiguration(); + SchemaConfiguration getSchemaConfiguration(); + HttpClient getClient(); + default FakerefsarrayofenumsPostResponses.EndpointResponse arrayOfEnums(PostRequest request) throws IOException, InterruptedException, ValidationException, NotImplementedException, ApiException { + return PostProvider.post(request, getApiConfiguration(), getSchemaConfiguration(), getClient()); + } + } + + public static class Post extends ApiClient implements PostOperation { + public Post(ApiConfiguration apiConfiguration, SchemaConfiguration schemaConfiguration) { + super(apiConfiguration, schemaConfiguration); + } + } + + public static class PostRequest { + public FakerefsarrayofenumsPostRequestBody.@Nullable SealedRequestBody requestBody; + public RootServerInfo.@Nullable ServerIndex serverIndex; + public @Nullable Duration timeout; + } + + public interface SetterForRequestBody { + PostRequest getInstance(); + T getBuilderAfterRequestBody(PostRequest instance); + default T requestBody(FakerefsarrayofenumsPostRequestBody.SealedRequestBody requestBody) { + var instance = getInstance(); + instance.requestBody = requestBody; + return getBuilderAfterRequestBody(instance); + } + } + + public interface SetterForServerIndex { + PostRequest getInstance(); + T getBuilderAfterServerIndex(PostRequest instance); + default T serverIndex(RootServerInfo.ServerIndex serverIndex) { + var instance = getInstance(); + instance.serverIndex = serverIndex; + return getBuilderAfterServerIndex(instance); + } + } + + public interface SetterForTimeout { + PostRequest getInstance(); + T getBuilderAfterTimeout(PostRequest instance); + default T timeout(Duration timeout) { + var instance = getInstance(); + instance.timeout = timeout; + return getBuilderAfterTimeout(instance); + } + } + + public static class PostRequestBuilder implements SetterForRequestBody, SetterForServerIndex, SetterForTimeout { + private final PostRequest instance; + + public PostRequestBuilder() { + this.instance = new PostRequest(); + } + + public PostRequest build() { + return instance; + } + + public PostRequest getInstance() { + return instance; + } + + public PostRequestBuilder getBuilderAfterRequestBody(PostRequest instance) { + return this; + } + + public PostRequestBuilder getBuilderAfterServerIndex(PostRequest instance) { + return this; + } + + public PostRequestBuilder getBuilderAfterTimeout(PostRequest instance) { + return this; + } + } +} diff --git a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/fakerefsarrayofenums/post/FakerefsarrayofenumsPostRequestBody.kt b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/fakerefsarrayofenums/post/FakerefsarrayofenumsPostRequestBody.kt new file mode 100644 index 00000000000..aedcac2d3a4 --- /dev/null +++ b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/fakerefsarrayofenums/post/FakerefsarrayofenumsPostRequestBody.kt @@ -0,0 +1,49 @@ +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; +import org.openapijsonschematools.client.mediatype.MediaType; +import org.openapijsonschematools.client.paths.fakerefsarrayofenums.post.requestbody.content.applicationjson.ApplicationjsonSchema; + +import java.util.AbstractMap; +import java.util.Map; + +public class FakerefsarrayofenumsPostRequestBody { + public sealed interface SealedMediaType permits ApplicationjsonMediaType {} + + public record ApplicationjsonMediaType(ApplicationjsonSchema.ApplicationjsonSchema1 schema) implements SealedMediaType, MediaType { + public ApplicationjsonMediaType() { + this(ApplicationjsonSchema.ApplicationjsonSchema1.getInstance()); + } + @Override + public Nothing? encoding() { + return null; + } + } + + public static class FakerefsarrayofenumsPostRequestBody1 extends RequestBodySerializer { + public FakerefsarrayofenumsPostRequestBody1() { + super( + Map.ofEntries( + new AbstractMap.SimpleEntry<>("application/json", new ApplicationjsonMediaType()) + ), + false + ); + } + + public SerializedRequestBody serialize(SealedRequestBody requestBody) throws NotImplementedException { + ApplicationjsonRequestBody requestBody0 = (ApplicationjsonRequestBody) requestBody; + return serialize(requestBody0.contentType(), requestBody0.body().getData()); + } + } + + public sealed interface SealedRequestBody permits ApplicationjsonRequestBody {} + public record ApplicationjsonRequestBody(ApplicationjsonSchema.ArrayOfEnums1Boxed body) implements SealedRequestBody, GenericRequestBody { + @Override + public String contentType() { + return "application/json"; + } + } +} diff --git a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/fakerefsarrayofenums/post/FakerefsarrayofenumsPostResponses.kt b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/fakerefsarrayofenums/post/FakerefsarrayofenumsPostResponses.kt new file mode 100644 index 00000000000..6f339c6eaa5 --- /dev/null +++ b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/fakerefsarrayofenums/post/FakerefsarrayofenumsPostResponses.kt @@ -0,0 +1,53 @@ +package org.openapijsonschematools.client.paths.fakerefsarrayofenums.post; + +import org.openapijsonschematools.client.paths.fakerefsarrayofenums.post.responses.FakerefsarrayofenumsPostCode200Response; +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; +import org.checkerframework.checker.nullness.qual.Nullable; + +import java.net.http.HttpResponse; +import java.util.Map; +import java.util.AbstractMap; + +public class FakerefsarrayofenumsPostResponses { + public sealed interface EndpointResponse permits EndpointFakerefsarrayofenumsPostCode200Response {} + + public record EndpointFakerefsarrayofenumsPostCode200Response( + HttpResponse response, + FakerefsarrayofenumsPostCode200Response.SealedResponseBody body, + Nothing? headers + ) implements EndpointResponse, ApiResponse{ + } + + public sealed interface StatusCodeResponseDeserializer permits StatusFakerefsarrayofenumsPostCode200ResponseDeserializer {} + + public static final class StatusFakerefsarrayofenumsPostCode200ResponseDeserializer extends FakerefsarrayofenumsPostCode200Response.FakerefsarrayofenumsPostCode200Response1 implements StatusCodeResponseDeserializer { + } + + public static final class FakerefsarrayofenumsPostResponses1 implements ResponsesDeserializer { + private final Map statusCodeToResponseDeserializer; + public FakerefsarrayofenumsPostResponses1() { + this.statusCodeToResponseDeserializer = Map.ofEntries( + new AbstractMap.SimpleEntry<>("200", new StatusFakerefsarrayofenumsPostCode200ResponseDeserializer()) + ); + } + + 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) { + throw new ApiException( + "Invalid response statusCode="+statusCode+" has no response defined in the openapi document", + response + ); + } + StatusFakerefsarrayofenumsPostCode200ResponseDeserializer castDeserializer = (StatusFakerefsarrayofenumsPostCode200ResponseDeserializer) statusCodeDeserializer; + var deserializedResponse = castDeserializer.deserialize(response, configuration); + return new EndpointFakerefsarrayofenumsPostCode200Response(response, deserializedResponse.body(), deserializedResponse.headers()); + } + } +} diff --git a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/fakerefsarrayofenums/post/requestbody/content/applicationjson/ApplicationjsonSchema.kt b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/fakerefsarrayofenums/post/requestbody/content/applicationjson/ApplicationjsonSchema.kt new file mode 100644 index 00000000000..460518d6f87 --- /dev/null +++ b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/fakerefsarrayofenums/post/requestbody/content/applicationjson/ApplicationjsonSchema.kt @@ -0,0 +1,19 @@ +package org.openapijsonschematools.client.paths.fakerefsarrayofenums.post.requestbody.content.applicationjson; + +import org.checkerframework.checker.nullness.qual.Nullable; +import org.openapijsonschematools.client.components.schemas.ArrayOfEnums; + +public class ApplicationjsonSchema extends ArrayOfEnums { + // $refed class + + + public static class ApplicationjsonSchema1 extends ArrayOfEnums1 { + private static @Nullable ApplicationjsonSchema1 instance = null; + public static ApplicationjsonSchema1 getInstance() { + if (instance == null) { + instance = new ApplicationjsonSchema1(); + } + return instance; + } + } +} diff --git a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/fakerefsarrayofenums/post/responses/FakerefsarrayofenumsPostCode200Response.kt b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/fakerefsarrayofenums/post/responses/FakerefsarrayofenumsPostCode200Response.kt new file mode 100644 index 00000000000..2e36c4fb9da --- /dev/null +++ b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/fakerefsarrayofenums/post/responses/FakerefsarrayofenumsPostCode200Response.kt @@ -0,0 +1,63 @@ +package org.openapijsonschematools.client.paths.fakerefsarrayofenums.post.responses; + +import org.openapijsonschematools.client.configurations.SchemaConfiguration; +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; + +import java.util.AbstractMap; +import java.util.Map; +import java.net.http.HttpResponse; +import java.net.http.HttpHeaders; + +public class FakerefsarrayofenumsPostCode200Response { + public sealed interface SealedMediaType permits ApplicationjsonMediaType {} + + public record ApplicationjsonMediaType(ApplicationjsonSchema.ApplicationjsonSchema1 schema) implements SealedMediaType, MediaType { + public ApplicationjsonMediaType() { + this(ApplicationjsonSchema.ApplicationjsonSchema1.getInstance()); + } + @Override + public Nothing? encoding() { + return null; + } + } + public sealed interface SealedResponseBody permits ApplicationjsonResponseBody {} + public record ApplicationjsonResponseBody(ApplicationjsonSchema.ArrayOfEnums1Boxed body) implements SealedResponseBody { } + + public static class FakerefsarrayofenumsPostCode200Response1 extends ResponseDeserializer { + public FakerefsarrayofenumsPostCode200Response1() { + super( + Map.ofEntries( + new AbstractMap.SimpleEntry<>("application/json", new ApplicationjsonMediaType()) + ) + ); + } + + @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); + } + + @Override + protected Nothing? getHeaders(HttpHeaders headers, SchemaConfiguration configuration) { + return null; + } + } + + @SuppressWarnings("serial") + public static class ResponseApiException extends ApiException { + public DeserializedHttpResponse deserializedResponse; + + public ResponseApiException(String s, HttpResponse response, DeserializedHttpResponse deserializedResponse) { + super(s, response); + this.deserializedResponse = deserializedResponse; + } + } +} diff --git a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/fakerefsarrayofenums/post/responses/code200response/content/applicationjson/ApplicationjsonSchema.kt b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/fakerefsarrayofenums/post/responses/code200response/content/applicationjson/ApplicationjsonSchema.kt new file mode 100644 index 00000000000..aae5071d1b6 --- /dev/null +++ b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/fakerefsarrayofenums/post/responses/code200response/content/applicationjson/ApplicationjsonSchema.kt @@ -0,0 +1,19 @@ +package org.openapijsonschematools.client.paths.fakerefsarrayofenums.post.responses.code200response.content.applicationjson; + +import org.checkerframework.checker.nullness.qual.Nullable; +import org.openapijsonschematools.client.components.schemas.ArrayOfEnums; + +public class ApplicationjsonSchema extends ArrayOfEnums { + // $refed class + + + public static class ApplicationjsonSchema1 extends ArrayOfEnums1 { + private static @Nullable ApplicationjsonSchema1 instance = null; + public static ApplicationjsonSchema1 getInstance() { + if (instance == null) { + instance = new ApplicationjsonSchema1(); + } + return instance; + } + } +} diff --git a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/fakerefsboolean/FakerefsbooleanPost.kt b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/fakerefsboolean/FakerefsbooleanPost.kt new file mode 100644 index 00000000000..48e40534184 --- /dev/null +++ b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/fakerefsboolean/FakerefsbooleanPost.kt @@ -0,0 +1,152 @@ +package org.openapijsonschematools.client.paths.fakerefsboolean; + +import org.checkerframework.checker.nullness.qual.Nullable; +import org.openapijsonschematools.client.paths.fakerefsboolean.post.FakerefsbooleanPostRequestBody; +import org.openapijsonschematools.client.RootServerInfo; +import org.openapijsonschematools.client.paths.fakerefsboolean.post.FakerefsbooleanPostResponses; +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.requestbody.SerializedRequestBody; +import org.openapijsonschematools.client.paths.Fakerefsboolean; + +import java.io.IOException; +import java.util.ArrayList; +import java.net.http.HttpClient; +import java.net.http.HttpRequest; +import java.time.Duration; +import java.util.List; +import java.util.Map; + +public class FakerefsbooleanPost { + private static class PostProvider { + private static final String method = "post"; + + public static FakerefsbooleanPostResponses.EndpointResponse post( + PostRequest request, + ApiConfiguration apiConfiguration, + SchemaConfiguration schemaConfiguration, + HttpClient client + ) throws IOException, InterruptedException, ValidationException, NotImplementedException, ApiException { + Map> headers = apiConfiguration.getDefaultHeaders(); + + @Nullable SerializedRequestBody serializedRequestBody; + HttpRequest.BodyPublisher bodyPublisher = HttpRequest.BodyPublishers.noBody(); + if (request.requestBody != null) { + serializedRequestBody = new FakerefsbooleanPostRequestBody.FakerefsbooleanPostRequestBody1().serialize( + request.requestBody + ); + var contentTypeHeaderValues = headers.getOrDefault("Content-Type", new ArrayList<>()); + contentTypeHeaderValues.add(serializedRequestBody.contentType); + bodyPublisher = serializedRequestBody.bodyPublisher; + } + // TODO set this to a map if there is a query security scheme + @Nullable Map queryMap = null; + String host = apiConfiguration.getServer(request.serverIndex).url(); + + String url = host + Fakerefsboolean.path; + var httpRequest = RestClient.getRequest( + url, + method, + bodyPublisher, + headers, + request.timeout + ); + var response = RestClient.getResponse(httpRequest, client); + var responsesDeserializer = new FakerefsbooleanPostResponses.FakerefsbooleanPostResponses1(); + return responsesDeserializer.deserialize(response, schemaConfiguration); + } + } + + public interface PostOperation { + ApiConfiguration getApiConfiguration(); + SchemaConfiguration getSchemaConfiguration(); + HttpClient getClient(); + default FakerefsbooleanPostResponses.EndpointResponse post(PostRequest request) throws IOException, InterruptedException, ValidationException, NotImplementedException, ApiException { + return PostProvider.post(request, getApiConfiguration(), getSchemaConfiguration(), getClient()); + } + } + + public interface ModelBooleanOperation { + ApiConfiguration getApiConfiguration(); + SchemaConfiguration getSchemaConfiguration(); + HttpClient getClient(); + default FakerefsbooleanPostResponses.EndpointResponse modelBoolean(PostRequest request) throws IOException, InterruptedException, ValidationException, NotImplementedException, ApiException { + return PostProvider.post(request, getApiConfiguration(), getSchemaConfiguration(), getClient()); + } + } + + public static class Post extends ApiClient implements PostOperation { + public Post(ApiConfiguration apiConfiguration, SchemaConfiguration schemaConfiguration) { + super(apiConfiguration, schemaConfiguration); + } + } + + public static class PostRequest { + public FakerefsbooleanPostRequestBody.@Nullable SealedRequestBody requestBody; + public RootServerInfo.@Nullable ServerIndex serverIndex; + public @Nullable Duration timeout; + } + + public interface SetterForRequestBody { + PostRequest getInstance(); + T getBuilderAfterRequestBody(PostRequest instance); + default T requestBody(FakerefsbooleanPostRequestBody.SealedRequestBody requestBody) { + var instance = getInstance(); + instance.requestBody = requestBody; + return getBuilderAfterRequestBody(instance); + } + } + + public interface SetterForServerIndex { + PostRequest getInstance(); + T getBuilderAfterServerIndex(PostRequest instance); + default T serverIndex(RootServerInfo.ServerIndex serverIndex) { + var instance = getInstance(); + instance.serverIndex = serverIndex; + return getBuilderAfterServerIndex(instance); + } + } + + public interface SetterForTimeout { + PostRequest getInstance(); + T getBuilderAfterTimeout(PostRequest instance); + default T timeout(Duration timeout) { + var instance = getInstance(); + instance.timeout = timeout; + return getBuilderAfterTimeout(instance); + } + } + + public static class PostRequestBuilder implements SetterForRequestBody, SetterForServerIndex, SetterForTimeout { + private final PostRequest instance; + + public PostRequestBuilder() { + this.instance = new PostRequest(); + } + + public PostRequest build() { + return instance; + } + + public PostRequest getInstance() { + return instance; + } + + public PostRequestBuilder getBuilderAfterRequestBody(PostRequest instance) { + return this; + } + + public PostRequestBuilder getBuilderAfterServerIndex(PostRequest instance) { + return this; + } + + public PostRequestBuilder getBuilderAfterTimeout(PostRequest instance) { + return this; + } + } +} diff --git a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/fakerefsboolean/post/FakerefsbooleanPostRequestBody.kt b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/fakerefsboolean/post/FakerefsbooleanPostRequestBody.kt new file mode 100644 index 00000000000..f05c18199a0 --- /dev/null +++ b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/fakerefsboolean/post/FakerefsbooleanPostRequestBody.kt @@ -0,0 +1,49 @@ +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; +import org.openapijsonschematools.client.mediatype.MediaType; +import org.openapijsonschematools.client.paths.fakerefsboolean.post.requestbody.content.applicationjson.ApplicationjsonSchema; + +import java.util.AbstractMap; +import java.util.Map; + +public class FakerefsbooleanPostRequestBody { + public sealed interface SealedMediaType permits ApplicationjsonMediaType {} + + public record ApplicationjsonMediaType(ApplicationjsonSchema.ApplicationjsonSchema1 schema) implements SealedMediaType, MediaType { + public ApplicationjsonMediaType() { + this(ApplicationjsonSchema.ApplicationjsonSchema1.getInstance()); + } + @Override + public Nothing? encoding() { + return null; + } + } + + public static class FakerefsbooleanPostRequestBody1 extends RequestBodySerializer { + public FakerefsbooleanPostRequestBody1() { + super( + Map.ofEntries( + new AbstractMap.SimpleEntry<>("application/json", new ApplicationjsonMediaType()) + ), + false + ); + } + + public SerializedRequestBody serialize(SealedRequestBody requestBody) throws NotImplementedException { + ApplicationjsonRequestBody requestBody0 = (ApplicationjsonRequestBody) requestBody; + return serialize(requestBody0.contentType(), requestBody0.body().getData()); + } + } + + public sealed interface SealedRequestBody permits ApplicationjsonRequestBody {} + public record ApplicationjsonRequestBody(ApplicationjsonSchema.BooleanJsonSchema1Boxed body) implements SealedRequestBody, GenericRequestBody { + @Override + public String contentType() { + return "application/json"; + } + } +} diff --git a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/fakerefsboolean/post/FakerefsbooleanPostResponses.kt b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/fakerefsboolean/post/FakerefsbooleanPostResponses.kt new file mode 100644 index 00000000000..7107926ba5e --- /dev/null +++ b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/fakerefsboolean/post/FakerefsbooleanPostResponses.kt @@ -0,0 +1,53 @@ +package org.openapijsonschematools.client.paths.fakerefsboolean.post; + +import org.openapijsonschematools.client.paths.fakerefsboolean.post.responses.FakerefsbooleanPostCode200Response; +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; +import org.checkerframework.checker.nullness.qual.Nullable; + +import java.net.http.HttpResponse; +import java.util.Map; +import java.util.AbstractMap; + +public class FakerefsbooleanPostResponses { + public sealed interface EndpointResponse permits EndpointFakerefsbooleanPostCode200Response {} + + public record EndpointFakerefsbooleanPostCode200Response( + HttpResponse response, + FakerefsbooleanPostCode200Response.SealedResponseBody body, + Nothing? headers + ) implements EndpointResponse, ApiResponse{ + } + + public sealed interface StatusCodeResponseDeserializer permits StatusFakerefsbooleanPostCode200ResponseDeserializer {} + + public static final class StatusFakerefsbooleanPostCode200ResponseDeserializer extends FakerefsbooleanPostCode200Response.FakerefsbooleanPostCode200Response1 implements StatusCodeResponseDeserializer { + } + + public static final class FakerefsbooleanPostResponses1 implements ResponsesDeserializer { + private final Map statusCodeToResponseDeserializer; + public FakerefsbooleanPostResponses1() { + this.statusCodeToResponseDeserializer = Map.ofEntries( + new AbstractMap.SimpleEntry<>("200", new StatusFakerefsbooleanPostCode200ResponseDeserializer()) + ); + } + + 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) { + throw new ApiException( + "Invalid response statusCode="+statusCode+" has no response defined in the openapi document", + response + ); + } + StatusFakerefsbooleanPostCode200ResponseDeserializer castDeserializer = (StatusFakerefsbooleanPostCode200ResponseDeserializer) statusCodeDeserializer; + var deserializedResponse = castDeserializer.deserialize(response, configuration); + return new EndpointFakerefsbooleanPostCode200Response(response, deserializedResponse.body(), deserializedResponse.headers()); + } + } +} diff --git a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/fakerefsboolean/post/requestbody/content/applicationjson/ApplicationjsonSchema.kt b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/fakerefsboolean/post/requestbody/content/applicationjson/ApplicationjsonSchema.kt new file mode 100644 index 00000000000..6c465dba460 --- /dev/null +++ b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/fakerefsboolean/post/requestbody/content/applicationjson/ApplicationjsonSchema.kt @@ -0,0 +1,19 @@ +package org.openapijsonschematools.client.paths.fakerefsboolean.post.requestbody.content.applicationjson; + +import org.checkerframework.checker.nullness.qual.Nullable; +import org.openapijsonschematools.client.components.schemas.BooleanSchema; + +public class ApplicationjsonSchema extends BooleanSchema { + // $refed class + + + public static class ApplicationjsonSchema1 extends BooleanSchema1 { + private static @Nullable ApplicationjsonSchema1 instance = null; + public static ApplicationjsonSchema1 getInstance() { + if (instance == null) { + instance = new ApplicationjsonSchema1(); + } + return instance; + } + } +} diff --git a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/fakerefsboolean/post/responses/FakerefsbooleanPostCode200Response.kt b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/fakerefsboolean/post/responses/FakerefsbooleanPostCode200Response.kt new file mode 100644 index 00000000000..b88873f707c --- /dev/null +++ b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/fakerefsboolean/post/responses/FakerefsbooleanPostCode200Response.kt @@ -0,0 +1,63 @@ +package org.openapijsonschematools.client.paths.fakerefsboolean.post.responses; + +import org.openapijsonschematools.client.configurations.SchemaConfiguration; +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; + +import java.util.AbstractMap; +import java.util.Map; +import java.net.http.HttpResponse; +import java.net.http.HttpHeaders; + +public class FakerefsbooleanPostCode200Response { + public sealed interface SealedMediaType permits ApplicationjsonMediaType {} + + public record ApplicationjsonMediaType(ApplicationjsonSchema.ApplicationjsonSchema1 schema) implements SealedMediaType, MediaType { + public ApplicationjsonMediaType() { + this(ApplicationjsonSchema.ApplicationjsonSchema1.getInstance()); + } + @Override + public Nothing? encoding() { + return null; + } + } + public sealed interface SealedResponseBody permits ApplicationjsonResponseBody {} + public record ApplicationjsonResponseBody(ApplicationjsonSchema.BooleanJsonSchema1Boxed body) implements SealedResponseBody { } + + public static class FakerefsbooleanPostCode200Response1 extends ResponseDeserializer { + public FakerefsbooleanPostCode200Response1() { + super( + Map.ofEntries( + new AbstractMap.SimpleEntry<>("application/json", new ApplicationjsonMediaType()) + ) + ); + } + + @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); + } + + @Override + protected Nothing? getHeaders(HttpHeaders headers, SchemaConfiguration configuration) { + return null; + } + } + + @SuppressWarnings("serial") + public static class ResponseApiException extends ApiException { + public DeserializedHttpResponse deserializedResponse; + + public ResponseApiException(String s, HttpResponse response, DeserializedHttpResponse deserializedResponse) { + super(s, response); + this.deserializedResponse = deserializedResponse; + } + } +} diff --git a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/fakerefsboolean/post/responses/code200response/content/applicationjson/ApplicationjsonSchema.kt b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/fakerefsboolean/post/responses/code200response/content/applicationjson/ApplicationjsonSchema.kt new file mode 100644 index 00000000000..064050b09bf --- /dev/null +++ b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/fakerefsboolean/post/responses/code200response/content/applicationjson/ApplicationjsonSchema.kt @@ -0,0 +1,19 @@ +package org.openapijsonschematools.client.paths.fakerefsboolean.post.responses.code200response.content.applicationjson; + +import org.checkerframework.checker.nullness.qual.Nullable; +import org.openapijsonschematools.client.components.schemas.BooleanSchema; + +public class ApplicationjsonSchema extends BooleanSchema { + // $refed class + + + public static class ApplicationjsonSchema1 extends BooleanSchema1 { + private static @Nullable ApplicationjsonSchema1 instance = null; + public static ApplicationjsonSchema1 getInstance() { + if (instance == null) { + instance = new ApplicationjsonSchema1(); + } + return instance; + } + } +} diff --git a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/fakerefscomposedoneofnumberwithvalidations/FakerefscomposedoneofnumberwithvalidationsPost.kt b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/fakerefscomposedoneofnumberwithvalidations/FakerefscomposedoneofnumberwithvalidationsPost.kt new file mode 100644 index 00000000000..6b1f0e40677 --- /dev/null +++ b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/fakerefscomposedoneofnumberwithvalidations/FakerefscomposedoneofnumberwithvalidationsPost.kt @@ -0,0 +1,152 @@ +package org.openapijsonschematools.client.paths.fakerefscomposedoneofnumberwithvalidations; + +import org.checkerframework.checker.nullness.qual.Nullable; +import org.openapijsonschematools.client.paths.fakerefscomposedoneofnumberwithvalidations.post.FakerefscomposedoneofnumberwithvalidationsPostRequestBody; +import org.openapijsonschematools.client.RootServerInfo; +import org.openapijsonschematools.client.paths.fakerefscomposedoneofnumberwithvalidations.post.FakerefscomposedoneofnumberwithvalidationsPostResponses; +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.requestbody.SerializedRequestBody; +import org.openapijsonschematools.client.paths.Fakerefscomposedoneofnumberwithvalidations; + +import java.io.IOException; +import java.util.ArrayList; +import java.net.http.HttpClient; +import java.net.http.HttpRequest; +import java.time.Duration; +import java.util.List; +import java.util.Map; + +public class FakerefscomposedoneofnumberwithvalidationsPost { + private static class PostProvider { + private static final String method = "post"; + + public static FakerefscomposedoneofnumberwithvalidationsPostResponses.EndpointResponse post( + PostRequest request, + ApiConfiguration apiConfiguration, + SchemaConfiguration schemaConfiguration, + HttpClient client + ) throws IOException, InterruptedException, ValidationException, NotImplementedException, ApiException { + Map> headers = apiConfiguration.getDefaultHeaders(); + + @Nullable SerializedRequestBody serializedRequestBody; + HttpRequest.BodyPublisher bodyPublisher = HttpRequest.BodyPublishers.noBody(); + if (request.requestBody != null) { + serializedRequestBody = new FakerefscomposedoneofnumberwithvalidationsPostRequestBody.FakerefscomposedoneofnumberwithvalidationsPostRequestBody1().serialize( + request.requestBody + ); + var contentTypeHeaderValues = headers.getOrDefault("Content-Type", new ArrayList<>()); + contentTypeHeaderValues.add(serializedRequestBody.contentType); + bodyPublisher = serializedRequestBody.bodyPublisher; + } + // TODO set this to a map if there is a query security scheme + @Nullable Map queryMap = null; + String host = apiConfiguration.getServer(request.serverIndex).url(); + + String url = host + Fakerefscomposedoneofnumberwithvalidations.path; + var httpRequest = RestClient.getRequest( + url, + method, + bodyPublisher, + headers, + request.timeout + ); + var response = RestClient.getResponse(httpRequest, client); + var responsesDeserializer = new FakerefscomposedoneofnumberwithvalidationsPostResponses.FakerefscomposedoneofnumberwithvalidationsPostResponses1(); + return responsesDeserializer.deserialize(response, schemaConfiguration); + } + } + + public interface PostOperation { + ApiConfiguration getApiConfiguration(); + SchemaConfiguration getSchemaConfiguration(); + HttpClient getClient(); + default FakerefscomposedoneofnumberwithvalidationsPostResponses.EndpointResponse post(PostRequest request) throws IOException, InterruptedException, ValidationException, NotImplementedException, ApiException { + return PostProvider.post(request, getApiConfiguration(), getSchemaConfiguration(), getClient()); + } + } + + public interface ComposedOneOfDifferentTypesOperation { + ApiConfiguration getApiConfiguration(); + SchemaConfiguration getSchemaConfiguration(); + HttpClient getClient(); + default FakerefscomposedoneofnumberwithvalidationsPostResponses.EndpointResponse composedOneOfDifferentTypes(PostRequest request) throws IOException, InterruptedException, ValidationException, NotImplementedException, ApiException { + return PostProvider.post(request, getApiConfiguration(), getSchemaConfiguration(), getClient()); + } + } + + public static class Post extends ApiClient implements PostOperation { + public Post(ApiConfiguration apiConfiguration, SchemaConfiguration schemaConfiguration) { + super(apiConfiguration, schemaConfiguration); + } + } + + public static class PostRequest { + public FakerefscomposedoneofnumberwithvalidationsPostRequestBody.@Nullable SealedRequestBody requestBody; + public RootServerInfo.@Nullable ServerIndex serverIndex; + public @Nullable Duration timeout; + } + + public interface SetterForRequestBody { + PostRequest getInstance(); + T getBuilderAfterRequestBody(PostRequest instance); + default T requestBody(FakerefscomposedoneofnumberwithvalidationsPostRequestBody.SealedRequestBody requestBody) { + var instance = getInstance(); + instance.requestBody = requestBody; + return getBuilderAfterRequestBody(instance); + } + } + + public interface SetterForServerIndex { + PostRequest getInstance(); + T getBuilderAfterServerIndex(PostRequest instance); + default T serverIndex(RootServerInfo.ServerIndex serverIndex) { + var instance = getInstance(); + instance.serverIndex = serverIndex; + return getBuilderAfterServerIndex(instance); + } + } + + public interface SetterForTimeout { + PostRequest getInstance(); + T getBuilderAfterTimeout(PostRequest instance); + default T timeout(Duration timeout) { + var instance = getInstance(); + instance.timeout = timeout; + return getBuilderAfterTimeout(instance); + } + } + + public static class PostRequestBuilder implements SetterForRequestBody, SetterForServerIndex, SetterForTimeout { + private final PostRequest instance; + + public PostRequestBuilder() { + this.instance = new PostRequest(); + } + + public PostRequest build() { + return instance; + } + + public PostRequest getInstance() { + return instance; + } + + public PostRequestBuilder getBuilderAfterRequestBody(PostRequest instance) { + return this; + } + + public PostRequestBuilder getBuilderAfterServerIndex(PostRequest instance) { + return this; + } + + public PostRequestBuilder getBuilderAfterTimeout(PostRequest instance) { + return this; + } + } +} diff --git a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/fakerefscomposedoneofnumberwithvalidations/post/FakerefscomposedoneofnumberwithvalidationsPostRequestBody.kt b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/fakerefscomposedoneofnumberwithvalidations/post/FakerefscomposedoneofnumberwithvalidationsPostRequestBody.kt new file mode 100644 index 00000000000..4950e00af58 --- /dev/null +++ b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/fakerefscomposedoneofnumberwithvalidations/post/FakerefscomposedoneofnumberwithvalidationsPostRequestBody.kt @@ -0,0 +1,49 @@ +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; +import org.openapijsonschematools.client.mediatype.MediaType; +import org.openapijsonschematools.client.paths.fakerefscomposedoneofnumberwithvalidations.post.requestbody.content.applicationjson.ApplicationjsonSchema; + +import java.util.AbstractMap; +import java.util.Map; + +public class FakerefscomposedoneofnumberwithvalidationsPostRequestBody { + public sealed interface SealedMediaType permits ApplicationjsonMediaType {} + + public record ApplicationjsonMediaType(ApplicationjsonSchema.ApplicationjsonSchema1 schema) implements SealedMediaType, MediaType { + public ApplicationjsonMediaType() { + this(ApplicationjsonSchema.ApplicationjsonSchema1.getInstance()); + } + @Override + public Nothing? encoding() { + return null; + } + } + + public static class FakerefscomposedoneofnumberwithvalidationsPostRequestBody1 extends RequestBodySerializer { + public FakerefscomposedoneofnumberwithvalidationsPostRequestBody1() { + super( + Map.ofEntries( + new AbstractMap.SimpleEntry<>("application/json", new ApplicationjsonMediaType()) + ), + false + ); + } + + public SerializedRequestBody serialize(SealedRequestBody requestBody) throws NotImplementedException { + ApplicationjsonRequestBody requestBody0 = (ApplicationjsonRequestBody) requestBody; + return serialize(requestBody0.contentType(), requestBody0.body().getData()); + } + } + + public sealed interface SealedRequestBody permits ApplicationjsonRequestBody {} + public record ApplicationjsonRequestBody(ApplicationjsonSchema.ComposedOneOfDifferentTypes1Boxed body) implements SealedRequestBody, GenericRequestBody { + @Override + public String contentType() { + return "application/json"; + } + } +} diff --git a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/fakerefscomposedoneofnumberwithvalidations/post/FakerefscomposedoneofnumberwithvalidationsPostResponses.kt b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/fakerefscomposedoneofnumberwithvalidations/post/FakerefscomposedoneofnumberwithvalidationsPostResponses.kt new file mode 100644 index 00000000000..fe889d3065d --- /dev/null +++ b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/fakerefscomposedoneofnumberwithvalidations/post/FakerefscomposedoneofnumberwithvalidationsPostResponses.kt @@ -0,0 +1,53 @@ +package org.openapijsonschematools.client.paths.fakerefscomposedoneofnumberwithvalidations.post; + +import org.openapijsonschematools.client.paths.fakerefscomposedoneofnumberwithvalidations.post.responses.FakerefscomposedoneofnumberwithvalidationsPostCode200Response; +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; +import org.checkerframework.checker.nullness.qual.Nullable; + +import java.net.http.HttpResponse; +import java.util.Map; +import java.util.AbstractMap; + +public class FakerefscomposedoneofnumberwithvalidationsPostResponses { + public sealed interface EndpointResponse permits EndpointFakerefscomposedoneofnumberwithvalidationsPostCode200Response {} + + public record EndpointFakerefscomposedoneofnumberwithvalidationsPostCode200Response( + HttpResponse response, + FakerefscomposedoneofnumberwithvalidationsPostCode200Response.SealedResponseBody body, + Nothing? headers + ) implements EndpointResponse, ApiResponse{ + } + + public sealed interface StatusCodeResponseDeserializer permits StatusFakerefscomposedoneofnumberwithvalidationsPostCode200ResponseDeserializer {} + + public static final class StatusFakerefscomposedoneofnumberwithvalidationsPostCode200ResponseDeserializer extends FakerefscomposedoneofnumberwithvalidationsPostCode200Response.FakerefscomposedoneofnumberwithvalidationsPostCode200Response1 implements StatusCodeResponseDeserializer { + } + + public static final class FakerefscomposedoneofnumberwithvalidationsPostResponses1 implements ResponsesDeserializer { + private final Map statusCodeToResponseDeserializer; + public FakerefscomposedoneofnumberwithvalidationsPostResponses1() { + this.statusCodeToResponseDeserializer = Map.ofEntries( + new AbstractMap.SimpleEntry<>("200", new StatusFakerefscomposedoneofnumberwithvalidationsPostCode200ResponseDeserializer()) + ); + } + + 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) { + throw new ApiException( + "Invalid response statusCode="+statusCode+" has no response defined in the openapi document", + response + ); + } + StatusFakerefscomposedoneofnumberwithvalidationsPostCode200ResponseDeserializer castDeserializer = (StatusFakerefscomposedoneofnumberwithvalidationsPostCode200ResponseDeserializer) statusCodeDeserializer; + var deserializedResponse = castDeserializer.deserialize(response, configuration); + return new EndpointFakerefscomposedoneofnumberwithvalidationsPostCode200Response(response, deserializedResponse.body(), deserializedResponse.headers()); + } + } +} diff --git a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/fakerefscomposedoneofnumberwithvalidations/post/requestbody/content/applicationjson/ApplicationjsonSchema.kt b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/fakerefscomposedoneofnumberwithvalidations/post/requestbody/content/applicationjson/ApplicationjsonSchema.kt new file mode 100644 index 00000000000..312ee20f0d4 --- /dev/null +++ b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/fakerefscomposedoneofnumberwithvalidations/post/requestbody/content/applicationjson/ApplicationjsonSchema.kt @@ -0,0 +1,19 @@ +package org.openapijsonschematools.client.paths.fakerefscomposedoneofnumberwithvalidations.post.requestbody.content.applicationjson; + +import org.checkerframework.checker.nullness.qual.Nullable; +import org.openapijsonschematools.client.components.schemas.ComposedOneOfDifferentTypes; + +public class ApplicationjsonSchema extends ComposedOneOfDifferentTypes { + // $refed class + + + public static class ApplicationjsonSchema1 extends ComposedOneOfDifferentTypes1 { + private static @Nullable ApplicationjsonSchema1 instance = null; + public static ApplicationjsonSchema1 getInstance() { + if (instance == null) { + instance = new ApplicationjsonSchema1(); + } + return instance; + } + } +} diff --git a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/fakerefscomposedoneofnumberwithvalidations/post/responses/FakerefscomposedoneofnumberwithvalidationsPostCode200Response.kt b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/fakerefscomposedoneofnumberwithvalidations/post/responses/FakerefscomposedoneofnumberwithvalidationsPostCode200Response.kt new file mode 100644 index 00000000000..365fee0a507 --- /dev/null +++ b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/fakerefscomposedoneofnumberwithvalidations/post/responses/FakerefscomposedoneofnumberwithvalidationsPostCode200Response.kt @@ -0,0 +1,63 @@ +package org.openapijsonschematools.client.paths.fakerefscomposedoneofnumberwithvalidations.post.responses; + +import org.openapijsonschematools.client.configurations.SchemaConfiguration; +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; + +import java.util.AbstractMap; +import java.util.Map; +import java.net.http.HttpResponse; +import java.net.http.HttpHeaders; + +public class FakerefscomposedoneofnumberwithvalidationsPostCode200Response { + public sealed interface SealedMediaType permits ApplicationjsonMediaType {} + + public record ApplicationjsonMediaType(ApplicationjsonSchema.ApplicationjsonSchema1 schema) implements SealedMediaType, MediaType { + public ApplicationjsonMediaType() { + this(ApplicationjsonSchema.ApplicationjsonSchema1.getInstance()); + } + @Override + public Nothing? encoding() { + return null; + } + } + public sealed interface SealedResponseBody permits ApplicationjsonResponseBody {} + public record ApplicationjsonResponseBody(ApplicationjsonSchema.ComposedOneOfDifferentTypes1Boxed body) implements SealedResponseBody { } + + public static class FakerefscomposedoneofnumberwithvalidationsPostCode200Response1 extends ResponseDeserializer { + public FakerefscomposedoneofnumberwithvalidationsPostCode200Response1() { + super( + Map.ofEntries( + new AbstractMap.SimpleEntry<>("application/json", new ApplicationjsonMediaType()) + ) + ); + } + + @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); + } + + @Override + protected Nothing? getHeaders(HttpHeaders headers, SchemaConfiguration configuration) { + return null; + } + } + + @SuppressWarnings("serial") + public static class ResponseApiException extends ApiException { + public DeserializedHttpResponse deserializedResponse; + + public ResponseApiException(String s, HttpResponse response, DeserializedHttpResponse deserializedResponse) { + super(s, response); + this.deserializedResponse = deserializedResponse; + } + } +} diff --git a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/fakerefscomposedoneofnumberwithvalidations/post/responses/code200response/content/applicationjson/ApplicationjsonSchema.kt b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/fakerefscomposedoneofnumberwithvalidations/post/responses/code200response/content/applicationjson/ApplicationjsonSchema.kt new file mode 100644 index 00000000000..075b7ade4dd --- /dev/null +++ b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/fakerefscomposedoneofnumberwithvalidations/post/responses/code200response/content/applicationjson/ApplicationjsonSchema.kt @@ -0,0 +1,19 @@ +package org.openapijsonschematools.client.paths.fakerefscomposedoneofnumberwithvalidations.post.responses.code200response.content.applicationjson; + +import org.checkerframework.checker.nullness.qual.Nullable; +import org.openapijsonschematools.client.components.schemas.ComposedOneOfDifferentTypes; + +public class ApplicationjsonSchema extends ComposedOneOfDifferentTypes { + // $refed class + + + public static class ApplicationjsonSchema1 extends ComposedOneOfDifferentTypes1 { + private static @Nullable ApplicationjsonSchema1 instance = null; + public static ApplicationjsonSchema1 getInstance() { + if (instance == null) { + instance = new ApplicationjsonSchema1(); + } + return instance; + } + } +} diff --git a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/fakerefsenum/FakerefsenumPost.kt b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/fakerefsenum/FakerefsenumPost.kt new file mode 100644 index 00000000000..83b9713931f --- /dev/null +++ b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/fakerefsenum/FakerefsenumPost.kt @@ -0,0 +1,152 @@ +package org.openapijsonschematools.client.paths.fakerefsenum; + +import org.checkerframework.checker.nullness.qual.Nullable; +import org.openapijsonschematools.client.paths.fakerefsenum.post.FakerefsenumPostRequestBody; +import org.openapijsonschematools.client.RootServerInfo; +import org.openapijsonschematools.client.paths.fakerefsenum.post.FakerefsenumPostResponses; +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.requestbody.SerializedRequestBody; +import org.openapijsonschematools.client.paths.Fakerefsenum; + +import java.io.IOException; +import java.util.ArrayList; +import java.net.http.HttpClient; +import java.net.http.HttpRequest; +import java.time.Duration; +import java.util.List; +import java.util.Map; + +public class FakerefsenumPost { + private static class PostProvider { + private static final String method = "post"; + + public static FakerefsenumPostResponses.EndpointResponse post( + PostRequest request, + ApiConfiguration apiConfiguration, + SchemaConfiguration schemaConfiguration, + HttpClient client + ) throws IOException, InterruptedException, ValidationException, NotImplementedException, ApiException { + Map> headers = apiConfiguration.getDefaultHeaders(); + + @Nullable SerializedRequestBody serializedRequestBody; + HttpRequest.BodyPublisher bodyPublisher = HttpRequest.BodyPublishers.noBody(); + if (request.requestBody != null) { + serializedRequestBody = new FakerefsenumPostRequestBody.FakerefsenumPostRequestBody1().serialize( + request.requestBody + ); + var contentTypeHeaderValues = headers.getOrDefault("Content-Type", new ArrayList<>()); + contentTypeHeaderValues.add(serializedRequestBody.contentType); + bodyPublisher = serializedRequestBody.bodyPublisher; + } + // TODO set this to a map if there is a query security scheme + @Nullable Map queryMap = null; + String host = apiConfiguration.getServer(request.serverIndex).url(); + + String url = host + Fakerefsenum.path; + var httpRequest = RestClient.getRequest( + url, + method, + bodyPublisher, + headers, + request.timeout + ); + var response = RestClient.getResponse(httpRequest, client); + var responsesDeserializer = new FakerefsenumPostResponses.FakerefsenumPostResponses1(); + return responsesDeserializer.deserialize(response, schemaConfiguration); + } + } + + public interface PostOperation { + ApiConfiguration getApiConfiguration(); + SchemaConfiguration getSchemaConfiguration(); + HttpClient getClient(); + default FakerefsenumPostResponses.EndpointResponse post(PostRequest request) throws IOException, InterruptedException, ValidationException, NotImplementedException, ApiException { + return PostProvider.post(request, getApiConfiguration(), getSchemaConfiguration(), getClient()); + } + } + + public interface StringEnumOperation { + ApiConfiguration getApiConfiguration(); + SchemaConfiguration getSchemaConfiguration(); + HttpClient getClient(); + default FakerefsenumPostResponses.EndpointResponse stringEnum(PostRequest request) throws IOException, InterruptedException, ValidationException, NotImplementedException, ApiException { + return PostProvider.post(request, getApiConfiguration(), getSchemaConfiguration(), getClient()); + } + } + + public static class Post extends ApiClient implements PostOperation { + public Post(ApiConfiguration apiConfiguration, SchemaConfiguration schemaConfiguration) { + super(apiConfiguration, schemaConfiguration); + } + } + + public static class PostRequest { + public FakerefsenumPostRequestBody.@Nullable SealedRequestBody requestBody; + public RootServerInfo.@Nullable ServerIndex serverIndex; + public @Nullable Duration timeout; + } + + public interface SetterForRequestBody { + PostRequest getInstance(); + T getBuilderAfterRequestBody(PostRequest instance); + default T requestBody(FakerefsenumPostRequestBody.SealedRequestBody requestBody) { + var instance = getInstance(); + instance.requestBody = requestBody; + return getBuilderAfterRequestBody(instance); + } + } + + public interface SetterForServerIndex { + PostRequest getInstance(); + T getBuilderAfterServerIndex(PostRequest instance); + default T serverIndex(RootServerInfo.ServerIndex serverIndex) { + var instance = getInstance(); + instance.serverIndex = serverIndex; + return getBuilderAfterServerIndex(instance); + } + } + + public interface SetterForTimeout { + PostRequest getInstance(); + T getBuilderAfterTimeout(PostRequest instance); + default T timeout(Duration timeout) { + var instance = getInstance(); + instance.timeout = timeout; + return getBuilderAfterTimeout(instance); + } + } + + public static class PostRequestBuilder implements SetterForRequestBody, SetterForServerIndex, SetterForTimeout { + private final PostRequest instance; + + public PostRequestBuilder() { + this.instance = new PostRequest(); + } + + public PostRequest build() { + return instance; + } + + public PostRequest getInstance() { + return instance; + } + + public PostRequestBuilder getBuilderAfterRequestBody(PostRequest instance) { + return this; + } + + public PostRequestBuilder getBuilderAfterServerIndex(PostRequest instance) { + return this; + } + + public PostRequestBuilder getBuilderAfterTimeout(PostRequest instance) { + return this; + } + } +} diff --git a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/fakerefsenum/post/FakerefsenumPostRequestBody.kt b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/fakerefsenum/post/FakerefsenumPostRequestBody.kt new file mode 100644 index 00000000000..03be0960455 --- /dev/null +++ b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/fakerefsenum/post/FakerefsenumPostRequestBody.kt @@ -0,0 +1,49 @@ +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; +import org.openapijsonschematools.client.mediatype.MediaType; +import org.openapijsonschematools.client.paths.fakerefsenum.post.requestbody.content.applicationjson.ApplicationjsonSchema; + +import java.util.AbstractMap; +import java.util.Map; + +public class FakerefsenumPostRequestBody { + public sealed interface SealedMediaType permits ApplicationjsonMediaType {} + + public record ApplicationjsonMediaType(ApplicationjsonSchema.ApplicationjsonSchema1 schema) implements SealedMediaType, MediaType { + public ApplicationjsonMediaType() { + this(ApplicationjsonSchema.ApplicationjsonSchema1.getInstance()); + } + @Override + public Nothing? encoding() { + return null; + } + } + + public static class FakerefsenumPostRequestBody1 extends RequestBodySerializer { + public FakerefsenumPostRequestBody1() { + super( + Map.ofEntries( + new AbstractMap.SimpleEntry<>("application/json", new ApplicationjsonMediaType()) + ), + false + ); + } + + public SerializedRequestBody serialize(SealedRequestBody requestBody) throws NotImplementedException { + ApplicationjsonRequestBody requestBody0 = (ApplicationjsonRequestBody) requestBody; + return serialize(requestBody0.contentType(), requestBody0.body().getData()); + } + } + + public sealed interface SealedRequestBody permits ApplicationjsonRequestBody {} + public record ApplicationjsonRequestBody(ApplicationjsonSchema.StringEnum1Boxed body) implements SealedRequestBody, GenericRequestBody { + @Override + public String contentType() { + return "application/json"; + } + } +} diff --git a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/fakerefsenum/post/FakerefsenumPostResponses.kt b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/fakerefsenum/post/FakerefsenumPostResponses.kt new file mode 100644 index 00000000000..7975189f2a4 --- /dev/null +++ b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/fakerefsenum/post/FakerefsenumPostResponses.kt @@ -0,0 +1,53 @@ +package org.openapijsonschematools.client.paths.fakerefsenum.post; + +import org.openapijsonschematools.client.paths.fakerefsenum.post.responses.FakerefsenumPostCode200Response; +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; +import org.checkerframework.checker.nullness.qual.Nullable; + +import java.net.http.HttpResponse; +import java.util.Map; +import java.util.AbstractMap; + +public class FakerefsenumPostResponses { + public sealed interface EndpointResponse permits EndpointFakerefsenumPostCode200Response {} + + public record EndpointFakerefsenumPostCode200Response( + HttpResponse response, + FakerefsenumPostCode200Response.SealedResponseBody body, + Nothing? headers + ) implements EndpointResponse, ApiResponse{ + } + + public sealed interface StatusCodeResponseDeserializer permits StatusFakerefsenumPostCode200ResponseDeserializer {} + + public static final class StatusFakerefsenumPostCode200ResponseDeserializer extends FakerefsenumPostCode200Response.FakerefsenumPostCode200Response1 implements StatusCodeResponseDeserializer { + } + + public static final class FakerefsenumPostResponses1 implements ResponsesDeserializer { + private final Map statusCodeToResponseDeserializer; + public FakerefsenumPostResponses1() { + this.statusCodeToResponseDeserializer = Map.ofEntries( + new AbstractMap.SimpleEntry<>("200", new StatusFakerefsenumPostCode200ResponseDeserializer()) + ); + } + + 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) { + throw new ApiException( + "Invalid response statusCode="+statusCode+" has no response defined in the openapi document", + response + ); + } + StatusFakerefsenumPostCode200ResponseDeserializer castDeserializer = (StatusFakerefsenumPostCode200ResponseDeserializer) statusCodeDeserializer; + var deserializedResponse = castDeserializer.deserialize(response, configuration); + return new EndpointFakerefsenumPostCode200Response(response, deserializedResponse.body(), deserializedResponse.headers()); + } + } +} diff --git a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/fakerefsenum/post/requestbody/content/applicationjson/ApplicationjsonSchema.kt b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/fakerefsenum/post/requestbody/content/applicationjson/ApplicationjsonSchema.kt new file mode 100644 index 00000000000..556d7c6a72f --- /dev/null +++ b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/fakerefsenum/post/requestbody/content/applicationjson/ApplicationjsonSchema.kt @@ -0,0 +1,19 @@ +package org.openapijsonschematools.client.paths.fakerefsenum.post.requestbody.content.applicationjson; + +import org.checkerframework.checker.nullness.qual.Nullable; +import org.openapijsonschematools.client.components.schemas.StringEnum; + +public class ApplicationjsonSchema extends StringEnum { + // $refed class + + + public static class ApplicationjsonSchema1 extends StringEnum1 { + private static @Nullable ApplicationjsonSchema1 instance = null; + public static ApplicationjsonSchema1 getInstance() { + if (instance == null) { + instance = new ApplicationjsonSchema1(); + } + return instance; + } + } +} diff --git a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/fakerefsenum/post/responses/FakerefsenumPostCode200Response.kt b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/fakerefsenum/post/responses/FakerefsenumPostCode200Response.kt new file mode 100644 index 00000000000..ed3c3e7deb2 --- /dev/null +++ b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/fakerefsenum/post/responses/FakerefsenumPostCode200Response.kt @@ -0,0 +1,63 @@ +package org.openapijsonschematools.client.paths.fakerefsenum.post.responses; + +import org.openapijsonschematools.client.configurations.SchemaConfiguration; +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; + +import java.util.AbstractMap; +import java.util.Map; +import java.net.http.HttpResponse; +import java.net.http.HttpHeaders; + +public class FakerefsenumPostCode200Response { + public sealed interface SealedMediaType permits ApplicationjsonMediaType {} + + public record ApplicationjsonMediaType(ApplicationjsonSchema.ApplicationjsonSchema1 schema) implements SealedMediaType, MediaType { + public ApplicationjsonMediaType() { + this(ApplicationjsonSchema.ApplicationjsonSchema1.getInstance()); + } + @Override + public Nothing? encoding() { + return null; + } + } + public sealed interface SealedResponseBody permits ApplicationjsonResponseBody {} + public record ApplicationjsonResponseBody(ApplicationjsonSchema.StringEnum1Boxed body) implements SealedResponseBody { } + + public static class FakerefsenumPostCode200Response1 extends ResponseDeserializer { + public FakerefsenumPostCode200Response1() { + super( + Map.ofEntries( + new AbstractMap.SimpleEntry<>("application/json", new ApplicationjsonMediaType()) + ) + ); + } + + @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); + } + + @Override + protected Nothing? getHeaders(HttpHeaders headers, SchemaConfiguration configuration) { + return null; + } + } + + @SuppressWarnings("serial") + public static class ResponseApiException extends ApiException { + public DeserializedHttpResponse deserializedResponse; + + public ResponseApiException(String s, HttpResponse response, DeserializedHttpResponse deserializedResponse) { + super(s, response); + this.deserializedResponse = deserializedResponse; + } + } +} diff --git a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/fakerefsenum/post/responses/code200response/content/applicationjson/ApplicationjsonSchema.kt b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/fakerefsenum/post/responses/code200response/content/applicationjson/ApplicationjsonSchema.kt new file mode 100644 index 00000000000..f32e80d609f --- /dev/null +++ b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/fakerefsenum/post/responses/code200response/content/applicationjson/ApplicationjsonSchema.kt @@ -0,0 +1,19 @@ +package org.openapijsonschematools.client.paths.fakerefsenum.post.responses.code200response.content.applicationjson; + +import org.checkerframework.checker.nullness.qual.Nullable; +import org.openapijsonschematools.client.components.schemas.StringEnum; + +public class ApplicationjsonSchema extends StringEnum { + // $refed class + + + public static class ApplicationjsonSchema1 extends StringEnum1 { + private static @Nullable ApplicationjsonSchema1 instance = null; + public static ApplicationjsonSchema1 getInstance() { + if (instance == null) { + instance = new ApplicationjsonSchema1(); + } + return instance; + } + } +} diff --git a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/fakerefsmammal/FakerefsmammalPost.kt b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/fakerefsmammal/FakerefsmammalPost.kt new file mode 100644 index 00000000000..1107280199a --- /dev/null +++ b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/fakerefsmammal/FakerefsmammalPost.kt @@ -0,0 +1,183 @@ +package org.openapijsonschematools.client.paths.fakerefsmammal; + +import org.checkerframework.checker.nullness.qual.Nullable; +import org.openapijsonschematools.client.RootServerInfo; +import org.openapijsonschematools.client.paths.fakerefsmammal.post.FakerefsmammalPostRequestBody; +import org.openapijsonschematools.client.paths.fakerefsmammal.post.FakerefsmammalPostResponses; +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.requestbody.SerializedRequestBody; +import org.openapijsonschematools.client.paths.Fakerefsmammal; + +import java.io.IOException; +import java.util.ArrayList; +import java.net.http.HttpClient; +import java.net.http.HttpRequest; +import java.time.Duration; +import java.util.List; +import java.util.Map; + +public class FakerefsmammalPost { + private static class PostProvider { + private static final String method = "post"; + + public static FakerefsmammalPostResponses.EndpointResponse post( + PostRequest request, + ApiConfiguration apiConfiguration, + SchemaConfiguration schemaConfiguration, + HttpClient client + ) throws IOException, InterruptedException, ValidationException, NotImplementedException, ApiException { + Map> headers = apiConfiguration.getDefaultHeaders(); + + SerializedRequestBody serializedRequestBody = new FakerefsmammalPostRequestBody.FakerefsmammalPostRequestBody1().serialize( + request.requestBody + ); + var contentTypeHeaderValues = headers.getOrDefault("Content-Type", new ArrayList<>()); + contentTypeHeaderValues.add(serializedRequestBody.contentType); + HttpRequest.BodyPublisher bodyPublisher = serializedRequestBody.bodyPublisher; + // TODO set this to a map if there is a query security scheme + @Nullable Map queryMap = null; + String host = apiConfiguration.getServer(request.serverIndex).url(); + + String url = host + Fakerefsmammal.path; + var httpRequest = RestClient.getRequest( + url, + method, + bodyPublisher, + headers, + request.timeout + ); + var response = RestClient.getResponse(httpRequest, client); + var responsesDeserializer = new FakerefsmammalPostResponses.FakerefsmammalPostResponses1(); + return responsesDeserializer.deserialize(response, schemaConfiguration); + } + } + + public interface PostOperation { + ApiConfiguration getApiConfiguration(); + SchemaConfiguration getSchemaConfiguration(); + HttpClient getClient(); + default FakerefsmammalPostResponses.EndpointResponse post(PostRequest request) throws IOException, InterruptedException, ValidationException, NotImplementedException, ApiException { + return PostProvider.post(request, getApiConfiguration(), getSchemaConfiguration(), getClient()); + } + } + + public interface MammalOperation { + ApiConfiguration getApiConfiguration(); + SchemaConfiguration getSchemaConfiguration(); + HttpClient getClient(); + default FakerefsmammalPostResponses.EndpointResponse mammal(PostRequest request) throws IOException, InterruptedException, ValidationException, NotImplementedException, ApiException { + return PostProvider.post(request, getApiConfiguration(), getSchemaConfiguration(), getClient()); + } + } + + public static class Post extends ApiClient implements PostOperation { + public Post(ApiConfiguration apiConfiguration, SchemaConfiguration schemaConfiguration) { + super(apiConfiguration, schemaConfiguration); + } + } + + public static class PostRequest { + public FakerefsmammalPostRequestBody.SealedRequestBody requestBody; + public RootServerInfo.@Nullable ServerIndex serverIndex; + public @Nullable Duration timeout; + + public PostRequest( + FakerefsmammalPostRequestBody.SealedRequestBody requestBody, + RootServerInfo.@Nullable ServerIndex serverIndex, + @Nullable Duration timeout + ) { + this.requestBody = requestBody; + this.serverIndex = serverIndex; + this.timeout = timeout; + } + } + + public static class PostNullableRequest { + public FakerefsmammalPostRequestBody.@Nullable SealedRequestBody requestBody; + public RootServerInfo.@Nullable ServerIndex serverIndex; + public @Nullable Duration timeout; + } + + public interface SetterForServerIndex { + PostNullableRequest getInstance(); + T getBuilderAfterServerIndex(PostNullableRequest instance); + default T serverIndex(RootServerInfo.ServerIndex serverIndex) { + var instance = getInstance(); + instance.serverIndex = serverIndex; + return getBuilderAfterServerIndex(instance); + } + } + + public interface SetterForTimeout { + PostNullableRequest getInstance(); + T getBuilderAfterTimeout(PostNullableRequest instance); + default T timeout(Duration timeout) { + var instance = getInstance(); + instance.timeout = timeout; + return getBuilderAfterTimeout(instance); + } + } + + public interface SetterForRequestBody { + PostNullableRequest getInstance(); + T getBuilderAfterRequestBody(PostNullableRequest instance); + default T requestBody(FakerefsmammalPostRequestBody.SealedRequestBody requestBody) { + var instance = getInstance(); + instance.requestBody = requestBody; + return getBuilderAfterRequestBody(instance); + } + } + + public static class Post0RequestBuilder implements SetterForServerIndex, SetterForTimeout { + private final PostNullableRequest instance; + + public Post0RequestBuilder(PostNullableRequest instance) { + this.instance = instance; + } + + public PostRequest build() { + var requestBody = instance.requestBody; + if (requestBody == null) { + throw new RuntimeException("invalid null value for required parameter"); + } + return new PostRequest( + requestBody, + instance.serverIndex, + instance.timeout + ); + } + + public PostNullableRequest getInstance() { + return instance; + } + + public Post0RequestBuilder getBuilderAfterServerIndex(PostNullableRequest instance) { + return this; + } + + public Post0RequestBuilder getBuilderAfterTimeout(PostNullableRequest instance) { + return this; + } + } + public static class PostRequestBuilder implements SetterForRequestBody { + private final PostNullableRequest instance; + + public PostRequestBuilder() { + this.instance = new PostNullableRequest(); + } + + public PostNullableRequest getInstance() { + return instance; + } + + public Post0RequestBuilder getBuilderAfterRequestBody(PostNullableRequest instance) { + return new Post0RequestBuilder(instance); + } + } +} diff --git a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/fakerefsmammal/post/FakerefsmammalPostRequestBody.kt b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/fakerefsmammal/post/FakerefsmammalPostRequestBody.kt new file mode 100644 index 00000000000..0ab73e9ef73 --- /dev/null +++ b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/fakerefsmammal/post/FakerefsmammalPostRequestBody.kt @@ -0,0 +1,49 @@ +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; +import org.openapijsonschematools.client.mediatype.MediaType; +import org.openapijsonschematools.client.paths.fakerefsmammal.post.requestbody.content.applicationjson.ApplicationjsonSchema; + +import java.util.AbstractMap; +import java.util.Map; + +public class FakerefsmammalPostRequestBody { + public sealed interface SealedMediaType permits ApplicationjsonMediaType {} + + public record ApplicationjsonMediaType(ApplicationjsonSchema.ApplicationjsonSchema1 schema) implements SealedMediaType, MediaType { + public ApplicationjsonMediaType() { + this(ApplicationjsonSchema.ApplicationjsonSchema1.getInstance()); + } + @Override + public Nothing? encoding() { + return null; + } + } + + public static class FakerefsmammalPostRequestBody1 extends RequestBodySerializer { + public FakerefsmammalPostRequestBody1() { + super( + Map.ofEntries( + new AbstractMap.SimpleEntry<>("application/json", new ApplicationjsonMediaType()) + ), + true + ); + } + + public SerializedRequestBody serialize(SealedRequestBody requestBody) throws NotImplementedException { + ApplicationjsonRequestBody requestBody0 = (ApplicationjsonRequestBody) requestBody; + return serialize(requestBody0.contentType(), requestBody0.body().getData()); + } + } + + public sealed interface SealedRequestBody permits ApplicationjsonRequestBody {} + public record ApplicationjsonRequestBody(ApplicationjsonSchema.Mammal1Boxed body) implements SealedRequestBody, GenericRequestBody { + @Override + public String contentType() { + return "application/json"; + } + } +} diff --git a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/fakerefsmammal/post/FakerefsmammalPostResponses.kt b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/fakerefsmammal/post/FakerefsmammalPostResponses.kt new file mode 100644 index 00000000000..c563c208719 --- /dev/null +++ b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/fakerefsmammal/post/FakerefsmammalPostResponses.kt @@ -0,0 +1,53 @@ +package org.openapijsonschematools.client.paths.fakerefsmammal.post; + +import org.openapijsonschematools.client.paths.fakerefsmammal.post.responses.FakerefsmammalPostCode200Response; +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; +import org.checkerframework.checker.nullness.qual.Nullable; + +import java.net.http.HttpResponse; +import java.util.Map; +import java.util.AbstractMap; + +public class FakerefsmammalPostResponses { + public sealed interface EndpointResponse permits EndpointFakerefsmammalPostCode200Response {} + + public record EndpointFakerefsmammalPostCode200Response( + HttpResponse response, + FakerefsmammalPostCode200Response.SealedResponseBody body, + Nothing? headers + ) implements EndpointResponse, ApiResponse{ + } + + public sealed interface StatusCodeResponseDeserializer permits StatusFakerefsmammalPostCode200ResponseDeserializer {} + + public static final class StatusFakerefsmammalPostCode200ResponseDeserializer extends FakerefsmammalPostCode200Response.FakerefsmammalPostCode200Response1 implements StatusCodeResponseDeserializer { + } + + public static final class FakerefsmammalPostResponses1 implements ResponsesDeserializer { + private final Map statusCodeToResponseDeserializer; + public FakerefsmammalPostResponses1() { + this.statusCodeToResponseDeserializer = Map.ofEntries( + new AbstractMap.SimpleEntry<>("200", new StatusFakerefsmammalPostCode200ResponseDeserializer()) + ); + } + + 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) { + throw new ApiException( + "Invalid response statusCode="+statusCode+" has no response defined in the openapi document", + response + ); + } + StatusFakerefsmammalPostCode200ResponseDeserializer castDeserializer = (StatusFakerefsmammalPostCode200ResponseDeserializer) statusCodeDeserializer; + var deserializedResponse = castDeserializer.deserialize(response, configuration); + return new EndpointFakerefsmammalPostCode200Response(response, deserializedResponse.body(), deserializedResponse.headers()); + } + } +} diff --git a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/fakerefsmammal/post/requestbody/content/applicationjson/ApplicationjsonSchema.kt b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/fakerefsmammal/post/requestbody/content/applicationjson/ApplicationjsonSchema.kt new file mode 100644 index 00000000000..a85a80fb124 --- /dev/null +++ b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/fakerefsmammal/post/requestbody/content/applicationjson/ApplicationjsonSchema.kt @@ -0,0 +1,19 @@ +package org.openapijsonschematools.client.paths.fakerefsmammal.post.requestbody.content.applicationjson; + +import org.checkerframework.checker.nullness.qual.Nullable; +import org.openapijsonschematools.client.components.schemas.Mammal; + +public class ApplicationjsonSchema extends Mammal { + // $refed class + + + public static class ApplicationjsonSchema1 extends Mammal1 { + private static @Nullable ApplicationjsonSchema1 instance = null; + public static ApplicationjsonSchema1 getInstance() { + if (instance == null) { + instance = new ApplicationjsonSchema1(); + } + return instance; + } + } +} diff --git a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/fakerefsmammal/post/responses/FakerefsmammalPostCode200Response.kt b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/fakerefsmammal/post/responses/FakerefsmammalPostCode200Response.kt new file mode 100644 index 00000000000..4f41b969e6b --- /dev/null +++ b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/fakerefsmammal/post/responses/FakerefsmammalPostCode200Response.kt @@ -0,0 +1,63 @@ +package org.openapijsonschematools.client.paths.fakerefsmammal.post.responses; + +import org.openapijsonschematools.client.configurations.SchemaConfiguration; +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; + +import java.util.AbstractMap; +import java.util.Map; +import java.net.http.HttpResponse; +import java.net.http.HttpHeaders; + +public class FakerefsmammalPostCode200Response { + public sealed interface SealedMediaType permits ApplicationjsonMediaType {} + + public record ApplicationjsonMediaType(ApplicationjsonSchema.ApplicationjsonSchema1 schema) implements SealedMediaType, MediaType { + public ApplicationjsonMediaType() { + this(ApplicationjsonSchema.ApplicationjsonSchema1.getInstance()); + } + @Override + public Nothing? encoding() { + return null; + } + } + public sealed interface SealedResponseBody permits ApplicationjsonResponseBody {} + public record ApplicationjsonResponseBody(ApplicationjsonSchema.Mammal1Boxed body) implements SealedResponseBody { } + + public static class FakerefsmammalPostCode200Response1 extends ResponseDeserializer { + public FakerefsmammalPostCode200Response1() { + super( + Map.ofEntries( + new AbstractMap.SimpleEntry<>("application/json", new ApplicationjsonMediaType()) + ) + ); + } + + @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); + } + + @Override + protected Nothing? getHeaders(HttpHeaders headers, SchemaConfiguration configuration) { + return null; + } + } + + @SuppressWarnings("serial") + public static class ResponseApiException extends ApiException { + public DeserializedHttpResponse deserializedResponse; + + public ResponseApiException(String s, HttpResponse response, DeserializedHttpResponse deserializedResponse) { + super(s, response); + this.deserializedResponse = deserializedResponse; + } + } +} diff --git a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/fakerefsmammal/post/responses/code200response/content/applicationjson/ApplicationjsonSchema.kt b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/fakerefsmammal/post/responses/code200response/content/applicationjson/ApplicationjsonSchema.kt new file mode 100644 index 00000000000..89dac1bf71a --- /dev/null +++ b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/fakerefsmammal/post/responses/code200response/content/applicationjson/ApplicationjsonSchema.kt @@ -0,0 +1,19 @@ +package org.openapijsonschematools.client.paths.fakerefsmammal.post.responses.code200response.content.applicationjson; + +import org.checkerframework.checker.nullness.qual.Nullable; +import org.openapijsonschematools.client.components.schemas.Mammal; + +public class ApplicationjsonSchema extends Mammal { + // $refed class + + + public static class ApplicationjsonSchema1 extends Mammal1 { + private static @Nullable ApplicationjsonSchema1 instance = null; + public static ApplicationjsonSchema1 getInstance() { + if (instance == null) { + instance = new ApplicationjsonSchema1(); + } + return instance; + } + } +} diff --git a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/fakerefsnumber/FakerefsnumberPost.kt b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/fakerefsnumber/FakerefsnumberPost.kt new file mode 100644 index 00000000000..1d1a42bd13b --- /dev/null +++ b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/fakerefsnumber/FakerefsnumberPost.kt @@ -0,0 +1,152 @@ +package org.openapijsonschematools.client.paths.fakerefsnumber; + +import org.checkerframework.checker.nullness.qual.Nullable; +import org.openapijsonschematools.client.paths.fakerefsnumber.post.FakerefsnumberPostRequestBody; +import org.openapijsonschematools.client.RootServerInfo; +import org.openapijsonschematools.client.paths.fakerefsnumber.post.FakerefsnumberPostResponses; +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.requestbody.SerializedRequestBody; +import org.openapijsonschematools.client.paths.Fakerefsnumber; + +import java.io.IOException; +import java.util.ArrayList; +import java.net.http.HttpClient; +import java.net.http.HttpRequest; +import java.time.Duration; +import java.util.List; +import java.util.Map; + +public class FakerefsnumberPost { + private static class PostProvider { + private static final String method = "post"; + + public static FakerefsnumberPostResponses.EndpointResponse post( + PostRequest request, + ApiConfiguration apiConfiguration, + SchemaConfiguration schemaConfiguration, + HttpClient client + ) throws IOException, InterruptedException, ValidationException, NotImplementedException, ApiException { + Map> headers = apiConfiguration.getDefaultHeaders(); + + @Nullable SerializedRequestBody serializedRequestBody; + HttpRequest.BodyPublisher bodyPublisher = HttpRequest.BodyPublishers.noBody(); + if (request.requestBody != null) { + serializedRequestBody = new FakerefsnumberPostRequestBody.FakerefsnumberPostRequestBody1().serialize( + request.requestBody + ); + var contentTypeHeaderValues = headers.getOrDefault("Content-Type", new ArrayList<>()); + contentTypeHeaderValues.add(serializedRequestBody.contentType); + bodyPublisher = serializedRequestBody.bodyPublisher; + } + // TODO set this to a map if there is a query security scheme + @Nullable Map queryMap = null; + String host = apiConfiguration.getServer(request.serverIndex).url(); + + String url = host + Fakerefsnumber.path; + var httpRequest = RestClient.getRequest( + url, + method, + bodyPublisher, + headers, + request.timeout + ); + var response = RestClient.getResponse(httpRequest, client); + var responsesDeserializer = new FakerefsnumberPostResponses.FakerefsnumberPostResponses1(); + return responsesDeserializer.deserialize(response, schemaConfiguration); + } + } + + public interface PostOperation { + ApiConfiguration getApiConfiguration(); + SchemaConfiguration getSchemaConfiguration(); + HttpClient getClient(); + default FakerefsnumberPostResponses.EndpointResponse post(PostRequest request) throws IOException, InterruptedException, ValidationException, NotImplementedException, ApiException { + return PostProvider.post(request, getApiConfiguration(), getSchemaConfiguration(), getClient()); + } + } + + public interface NumberWithValidationsOperation { + ApiConfiguration getApiConfiguration(); + SchemaConfiguration getSchemaConfiguration(); + HttpClient getClient(); + default FakerefsnumberPostResponses.EndpointResponse numberWithValidations(PostRequest request) throws IOException, InterruptedException, ValidationException, NotImplementedException, ApiException { + return PostProvider.post(request, getApiConfiguration(), getSchemaConfiguration(), getClient()); + } + } + + public static class Post extends ApiClient implements PostOperation { + public Post(ApiConfiguration apiConfiguration, SchemaConfiguration schemaConfiguration) { + super(apiConfiguration, schemaConfiguration); + } + } + + public static class PostRequest { + public FakerefsnumberPostRequestBody.@Nullable SealedRequestBody requestBody; + public RootServerInfo.@Nullable ServerIndex serverIndex; + public @Nullable Duration timeout; + } + + public interface SetterForRequestBody { + PostRequest getInstance(); + T getBuilderAfterRequestBody(PostRequest instance); + default T requestBody(FakerefsnumberPostRequestBody.SealedRequestBody requestBody) { + var instance = getInstance(); + instance.requestBody = requestBody; + return getBuilderAfterRequestBody(instance); + } + } + + public interface SetterForServerIndex { + PostRequest getInstance(); + T getBuilderAfterServerIndex(PostRequest instance); + default T serverIndex(RootServerInfo.ServerIndex serverIndex) { + var instance = getInstance(); + instance.serverIndex = serverIndex; + return getBuilderAfterServerIndex(instance); + } + } + + public interface SetterForTimeout { + PostRequest getInstance(); + T getBuilderAfterTimeout(PostRequest instance); + default T timeout(Duration timeout) { + var instance = getInstance(); + instance.timeout = timeout; + return getBuilderAfterTimeout(instance); + } + } + + public static class PostRequestBuilder implements SetterForRequestBody, SetterForServerIndex, SetterForTimeout { + private final PostRequest instance; + + public PostRequestBuilder() { + this.instance = new PostRequest(); + } + + public PostRequest build() { + return instance; + } + + public PostRequest getInstance() { + return instance; + } + + public PostRequestBuilder getBuilderAfterRequestBody(PostRequest instance) { + return this; + } + + public PostRequestBuilder getBuilderAfterServerIndex(PostRequest instance) { + return this; + } + + public PostRequestBuilder getBuilderAfterTimeout(PostRequest instance) { + return this; + } + } +} diff --git a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/fakerefsnumber/post/FakerefsnumberPostRequestBody.kt b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/fakerefsnumber/post/FakerefsnumberPostRequestBody.kt new file mode 100644 index 00000000000..e3963edfc91 --- /dev/null +++ b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/fakerefsnumber/post/FakerefsnumberPostRequestBody.kt @@ -0,0 +1,49 @@ +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; +import org.openapijsonschematools.client.mediatype.MediaType; +import org.openapijsonschematools.client.paths.fakerefsnumber.post.requestbody.content.applicationjson.ApplicationjsonSchema; + +import java.util.AbstractMap; +import java.util.Map; + +public class FakerefsnumberPostRequestBody { + public sealed interface SealedMediaType permits ApplicationjsonMediaType {} + + public record ApplicationjsonMediaType(ApplicationjsonSchema.ApplicationjsonSchema1 schema) implements SealedMediaType, MediaType { + public ApplicationjsonMediaType() { + this(ApplicationjsonSchema.ApplicationjsonSchema1.getInstance()); + } + @Override + public Nothing? encoding() { + return null; + } + } + + public static class FakerefsnumberPostRequestBody1 extends RequestBodySerializer { + public FakerefsnumberPostRequestBody1() { + super( + Map.ofEntries( + new AbstractMap.SimpleEntry<>("application/json", new ApplicationjsonMediaType()) + ), + false + ); + } + + public SerializedRequestBody serialize(SealedRequestBody requestBody) throws NotImplementedException { + ApplicationjsonRequestBody requestBody0 = (ApplicationjsonRequestBody) requestBody; + return serialize(requestBody0.contentType(), requestBody0.body().getData()); + } + } + + public sealed interface SealedRequestBody permits ApplicationjsonRequestBody {} + public record ApplicationjsonRequestBody(ApplicationjsonSchema.NumberWithValidations1Boxed body) implements SealedRequestBody, GenericRequestBody { + @Override + public String contentType() { + return "application/json"; + } + } +} diff --git a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/fakerefsnumber/post/FakerefsnumberPostResponses.kt b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/fakerefsnumber/post/FakerefsnumberPostResponses.kt new file mode 100644 index 00000000000..ea9d264a5b1 --- /dev/null +++ b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/fakerefsnumber/post/FakerefsnumberPostResponses.kt @@ -0,0 +1,53 @@ +package org.openapijsonschematools.client.paths.fakerefsnumber.post; + +import org.openapijsonschematools.client.paths.fakerefsnumber.post.responses.FakerefsnumberPostCode200Response; +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; +import org.checkerframework.checker.nullness.qual.Nullable; + +import java.net.http.HttpResponse; +import java.util.Map; +import java.util.AbstractMap; + +public class FakerefsnumberPostResponses { + public sealed interface EndpointResponse permits EndpointFakerefsnumberPostCode200Response {} + + public record EndpointFakerefsnumberPostCode200Response( + HttpResponse response, + FakerefsnumberPostCode200Response.SealedResponseBody body, + Nothing? headers + ) implements EndpointResponse, ApiResponse{ + } + + public sealed interface StatusCodeResponseDeserializer permits StatusFakerefsnumberPostCode200ResponseDeserializer {} + + public static final class StatusFakerefsnumberPostCode200ResponseDeserializer extends FakerefsnumberPostCode200Response.FakerefsnumberPostCode200Response1 implements StatusCodeResponseDeserializer { + } + + public static final class FakerefsnumberPostResponses1 implements ResponsesDeserializer { + private final Map statusCodeToResponseDeserializer; + public FakerefsnumberPostResponses1() { + this.statusCodeToResponseDeserializer = Map.ofEntries( + new AbstractMap.SimpleEntry<>("200", new StatusFakerefsnumberPostCode200ResponseDeserializer()) + ); + } + + 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) { + throw new ApiException( + "Invalid response statusCode="+statusCode+" has no response defined in the openapi document", + response + ); + } + StatusFakerefsnumberPostCode200ResponseDeserializer castDeserializer = (StatusFakerefsnumberPostCode200ResponseDeserializer) statusCodeDeserializer; + var deserializedResponse = castDeserializer.deserialize(response, configuration); + return new EndpointFakerefsnumberPostCode200Response(response, deserializedResponse.body(), deserializedResponse.headers()); + } + } +} diff --git a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/fakerefsnumber/post/requestbody/content/applicationjson/ApplicationjsonSchema.kt b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/fakerefsnumber/post/requestbody/content/applicationjson/ApplicationjsonSchema.kt new file mode 100644 index 00000000000..0444065de0f --- /dev/null +++ b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/fakerefsnumber/post/requestbody/content/applicationjson/ApplicationjsonSchema.kt @@ -0,0 +1,19 @@ +package org.openapijsonschematools.client.paths.fakerefsnumber.post.requestbody.content.applicationjson; + +import org.checkerframework.checker.nullness.qual.Nullable; +import org.openapijsonschematools.client.components.schemas.NumberWithValidations; + +public class ApplicationjsonSchema extends NumberWithValidations { + // $refed class + + + public static class ApplicationjsonSchema1 extends NumberWithValidations1 { + private static @Nullable ApplicationjsonSchema1 instance = null; + public static ApplicationjsonSchema1 getInstance() { + if (instance == null) { + instance = new ApplicationjsonSchema1(); + } + return instance; + } + } +} diff --git a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/fakerefsnumber/post/responses/FakerefsnumberPostCode200Response.kt b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/fakerefsnumber/post/responses/FakerefsnumberPostCode200Response.kt new file mode 100644 index 00000000000..b5764b2cdc7 --- /dev/null +++ b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/fakerefsnumber/post/responses/FakerefsnumberPostCode200Response.kt @@ -0,0 +1,63 @@ +package org.openapijsonschematools.client.paths.fakerefsnumber.post.responses; + +import org.openapijsonschematools.client.configurations.SchemaConfiguration; +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; + +import java.util.AbstractMap; +import java.util.Map; +import java.net.http.HttpResponse; +import java.net.http.HttpHeaders; + +public class FakerefsnumberPostCode200Response { + public sealed interface SealedMediaType permits ApplicationjsonMediaType {} + + public record ApplicationjsonMediaType(ApplicationjsonSchema.ApplicationjsonSchema1 schema) implements SealedMediaType, MediaType { + public ApplicationjsonMediaType() { + this(ApplicationjsonSchema.ApplicationjsonSchema1.getInstance()); + } + @Override + public Nothing? encoding() { + return null; + } + } + public sealed interface SealedResponseBody permits ApplicationjsonResponseBody {} + public record ApplicationjsonResponseBody(ApplicationjsonSchema.NumberWithValidations1Boxed body) implements SealedResponseBody { } + + public static class FakerefsnumberPostCode200Response1 extends ResponseDeserializer { + public FakerefsnumberPostCode200Response1() { + super( + Map.ofEntries( + new AbstractMap.SimpleEntry<>("application/json", new ApplicationjsonMediaType()) + ) + ); + } + + @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); + } + + @Override + protected Nothing? getHeaders(HttpHeaders headers, SchemaConfiguration configuration) { + return null; + } + } + + @SuppressWarnings("serial") + public static class ResponseApiException extends ApiException { + public DeserializedHttpResponse deserializedResponse; + + public ResponseApiException(String s, HttpResponse response, DeserializedHttpResponse deserializedResponse) { + super(s, response); + this.deserializedResponse = deserializedResponse; + } + } +} diff --git a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/fakerefsnumber/post/responses/code200response/content/applicationjson/ApplicationjsonSchema.kt b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/fakerefsnumber/post/responses/code200response/content/applicationjson/ApplicationjsonSchema.kt new file mode 100644 index 00000000000..735f78f40f2 --- /dev/null +++ b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/fakerefsnumber/post/responses/code200response/content/applicationjson/ApplicationjsonSchema.kt @@ -0,0 +1,19 @@ +package org.openapijsonschematools.client.paths.fakerefsnumber.post.responses.code200response.content.applicationjson; + +import org.checkerframework.checker.nullness.qual.Nullable; +import org.openapijsonschematools.client.components.schemas.NumberWithValidations; + +public class ApplicationjsonSchema extends NumberWithValidations { + // $refed class + + + public static class ApplicationjsonSchema1 extends NumberWithValidations1 { + private static @Nullable ApplicationjsonSchema1 instance = null; + public static ApplicationjsonSchema1 getInstance() { + if (instance == null) { + instance = new ApplicationjsonSchema1(); + } + return instance; + } + } +} diff --git a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/fakerefsobjectmodelwithrefprops/FakerefsobjectmodelwithrefpropsPost.kt b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/fakerefsobjectmodelwithrefprops/FakerefsobjectmodelwithrefpropsPost.kt new file mode 100644 index 00000000000..a0d92eb73a6 --- /dev/null +++ b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/fakerefsobjectmodelwithrefprops/FakerefsobjectmodelwithrefpropsPost.kt @@ -0,0 +1,152 @@ +package org.openapijsonschematools.client.paths.fakerefsobjectmodelwithrefprops; + +import org.checkerframework.checker.nullness.qual.Nullable; +import org.openapijsonschematools.client.paths.fakerefsobjectmodelwithrefprops.post.FakerefsobjectmodelwithrefpropsPostRequestBody; +import org.openapijsonschematools.client.RootServerInfo; +import org.openapijsonschematools.client.paths.fakerefsobjectmodelwithrefprops.post.FakerefsobjectmodelwithrefpropsPostResponses; +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.requestbody.SerializedRequestBody; +import org.openapijsonschematools.client.paths.Fakerefsobjectmodelwithrefprops; + +import java.io.IOException; +import java.util.ArrayList; +import java.net.http.HttpClient; +import java.net.http.HttpRequest; +import java.time.Duration; +import java.util.List; +import java.util.Map; + +public class FakerefsobjectmodelwithrefpropsPost { + private static class PostProvider { + private static final String method = "post"; + + public static FakerefsobjectmodelwithrefpropsPostResponses.EndpointResponse post( + PostRequest request, + ApiConfiguration apiConfiguration, + SchemaConfiguration schemaConfiguration, + HttpClient client + ) throws IOException, InterruptedException, ValidationException, NotImplementedException, ApiException { + Map> headers = apiConfiguration.getDefaultHeaders(); + + @Nullable SerializedRequestBody serializedRequestBody; + HttpRequest.BodyPublisher bodyPublisher = HttpRequest.BodyPublishers.noBody(); + if (request.requestBody != null) { + serializedRequestBody = new FakerefsobjectmodelwithrefpropsPostRequestBody.FakerefsobjectmodelwithrefpropsPostRequestBody1().serialize( + request.requestBody + ); + var contentTypeHeaderValues = headers.getOrDefault("Content-Type", new ArrayList<>()); + contentTypeHeaderValues.add(serializedRequestBody.contentType); + bodyPublisher = serializedRequestBody.bodyPublisher; + } + // TODO set this to a map if there is a query security scheme + @Nullable Map queryMap = null; + String host = apiConfiguration.getServer(request.serverIndex).url(); + + String url = host + Fakerefsobjectmodelwithrefprops.path; + var httpRequest = RestClient.getRequest( + url, + method, + bodyPublisher, + headers, + request.timeout + ); + var response = RestClient.getResponse(httpRequest, client); + var responsesDeserializer = new FakerefsobjectmodelwithrefpropsPostResponses.FakerefsobjectmodelwithrefpropsPostResponses1(); + return responsesDeserializer.deserialize(response, schemaConfiguration); + } + } + + public interface PostOperation { + ApiConfiguration getApiConfiguration(); + SchemaConfiguration getSchemaConfiguration(); + HttpClient getClient(); + default FakerefsobjectmodelwithrefpropsPostResponses.EndpointResponse post(PostRequest request) throws IOException, InterruptedException, ValidationException, NotImplementedException, ApiException { + return PostProvider.post(request, getApiConfiguration(), getSchemaConfiguration(), getClient()); + } + } + + public interface ObjectModelWithRefPropsOperation { + ApiConfiguration getApiConfiguration(); + SchemaConfiguration getSchemaConfiguration(); + HttpClient getClient(); + default FakerefsobjectmodelwithrefpropsPostResponses.EndpointResponse objectModelWithRefProps(PostRequest request) throws IOException, InterruptedException, ValidationException, NotImplementedException, ApiException { + return PostProvider.post(request, getApiConfiguration(), getSchemaConfiguration(), getClient()); + } + } + + public static class Post extends ApiClient implements PostOperation { + public Post(ApiConfiguration apiConfiguration, SchemaConfiguration schemaConfiguration) { + super(apiConfiguration, schemaConfiguration); + } + } + + public static class PostRequest { + public FakerefsobjectmodelwithrefpropsPostRequestBody.@Nullable SealedRequestBody requestBody; + public RootServerInfo.@Nullable ServerIndex serverIndex; + public @Nullable Duration timeout; + } + + public interface SetterForRequestBody { + PostRequest getInstance(); + T getBuilderAfterRequestBody(PostRequest instance); + default T requestBody(FakerefsobjectmodelwithrefpropsPostRequestBody.SealedRequestBody requestBody) { + var instance = getInstance(); + instance.requestBody = requestBody; + return getBuilderAfterRequestBody(instance); + } + } + + public interface SetterForServerIndex { + PostRequest getInstance(); + T getBuilderAfterServerIndex(PostRequest instance); + default T serverIndex(RootServerInfo.ServerIndex serverIndex) { + var instance = getInstance(); + instance.serverIndex = serverIndex; + return getBuilderAfterServerIndex(instance); + } + } + + public interface SetterForTimeout { + PostRequest getInstance(); + T getBuilderAfterTimeout(PostRequest instance); + default T timeout(Duration timeout) { + var instance = getInstance(); + instance.timeout = timeout; + return getBuilderAfterTimeout(instance); + } + } + + public static class PostRequestBuilder implements SetterForRequestBody, SetterForServerIndex, SetterForTimeout { + private final PostRequest instance; + + public PostRequestBuilder() { + this.instance = new PostRequest(); + } + + public PostRequest build() { + return instance; + } + + public PostRequest getInstance() { + return instance; + } + + public PostRequestBuilder getBuilderAfterRequestBody(PostRequest instance) { + return this; + } + + public PostRequestBuilder getBuilderAfterServerIndex(PostRequest instance) { + return this; + } + + public PostRequestBuilder getBuilderAfterTimeout(PostRequest instance) { + return this; + } + } +} diff --git a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/fakerefsobjectmodelwithrefprops/post/FakerefsobjectmodelwithrefpropsPostRequestBody.kt b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/fakerefsobjectmodelwithrefprops/post/FakerefsobjectmodelwithrefpropsPostRequestBody.kt new file mode 100644 index 00000000000..b224ddd2c60 --- /dev/null +++ b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/fakerefsobjectmodelwithrefprops/post/FakerefsobjectmodelwithrefpropsPostRequestBody.kt @@ -0,0 +1,49 @@ +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; +import org.openapijsonschematools.client.mediatype.MediaType; +import org.openapijsonschematools.client.paths.fakerefsobjectmodelwithrefprops.post.requestbody.content.applicationjson.ApplicationjsonSchema; + +import java.util.AbstractMap; +import java.util.Map; + +public class FakerefsobjectmodelwithrefpropsPostRequestBody { + public sealed interface SealedMediaType permits ApplicationjsonMediaType {} + + public record ApplicationjsonMediaType(ApplicationjsonSchema.ApplicationjsonSchema1 schema) implements SealedMediaType, MediaType { + public ApplicationjsonMediaType() { + this(ApplicationjsonSchema.ApplicationjsonSchema1.getInstance()); + } + @Override + public Nothing? encoding() { + return null; + } + } + + public static class FakerefsobjectmodelwithrefpropsPostRequestBody1 extends RequestBodySerializer { + public FakerefsobjectmodelwithrefpropsPostRequestBody1() { + super( + Map.ofEntries( + new AbstractMap.SimpleEntry<>("application/json", new ApplicationjsonMediaType()) + ), + false + ); + } + + public SerializedRequestBody serialize(SealedRequestBody requestBody) throws NotImplementedException { + ApplicationjsonRequestBody requestBody0 = (ApplicationjsonRequestBody) requestBody; + return serialize(requestBody0.contentType(), requestBody0.body().getData()); + } + } + + public sealed interface SealedRequestBody permits ApplicationjsonRequestBody {} + public record ApplicationjsonRequestBody(ApplicationjsonSchema.ObjectModelWithRefProps1Boxed body) implements SealedRequestBody, GenericRequestBody { + @Override + public String contentType() { + return "application/json"; + } + } +} diff --git a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/fakerefsobjectmodelwithrefprops/post/FakerefsobjectmodelwithrefpropsPostResponses.kt b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/fakerefsobjectmodelwithrefprops/post/FakerefsobjectmodelwithrefpropsPostResponses.kt new file mode 100644 index 00000000000..05c3f275e1b --- /dev/null +++ b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/fakerefsobjectmodelwithrefprops/post/FakerefsobjectmodelwithrefpropsPostResponses.kt @@ -0,0 +1,53 @@ +package org.openapijsonschematools.client.paths.fakerefsobjectmodelwithrefprops.post; + +import org.openapijsonschematools.client.paths.fakerefsobjectmodelwithrefprops.post.responses.FakerefsobjectmodelwithrefpropsPostCode200Response; +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; +import org.checkerframework.checker.nullness.qual.Nullable; + +import java.net.http.HttpResponse; +import java.util.Map; +import java.util.AbstractMap; + +public class FakerefsobjectmodelwithrefpropsPostResponses { + public sealed interface EndpointResponse permits EndpointFakerefsobjectmodelwithrefpropsPostCode200Response {} + + public record EndpointFakerefsobjectmodelwithrefpropsPostCode200Response( + HttpResponse response, + FakerefsobjectmodelwithrefpropsPostCode200Response.SealedResponseBody body, + Nothing? headers + ) implements EndpointResponse, ApiResponse{ + } + + public sealed interface StatusCodeResponseDeserializer permits StatusFakerefsobjectmodelwithrefpropsPostCode200ResponseDeserializer {} + + public static final class StatusFakerefsobjectmodelwithrefpropsPostCode200ResponseDeserializer extends FakerefsobjectmodelwithrefpropsPostCode200Response.FakerefsobjectmodelwithrefpropsPostCode200Response1 implements StatusCodeResponseDeserializer { + } + + public static final class FakerefsobjectmodelwithrefpropsPostResponses1 implements ResponsesDeserializer { + private final Map statusCodeToResponseDeserializer; + public FakerefsobjectmodelwithrefpropsPostResponses1() { + this.statusCodeToResponseDeserializer = Map.ofEntries( + new AbstractMap.SimpleEntry<>("200", new StatusFakerefsobjectmodelwithrefpropsPostCode200ResponseDeserializer()) + ); + } + + 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) { + throw new ApiException( + "Invalid response statusCode="+statusCode+" has no response defined in the openapi document", + response + ); + } + StatusFakerefsobjectmodelwithrefpropsPostCode200ResponseDeserializer castDeserializer = (StatusFakerefsobjectmodelwithrefpropsPostCode200ResponseDeserializer) statusCodeDeserializer; + var deserializedResponse = castDeserializer.deserialize(response, configuration); + return new EndpointFakerefsobjectmodelwithrefpropsPostCode200Response(response, deserializedResponse.body(), deserializedResponse.headers()); + } + } +} diff --git a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/fakerefsobjectmodelwithrefprops/post/requestbody/content/applicationjson/ApplicationjsonSchema.kt b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/fakerefsobjectmodelwithrefprops/post/requestbody/content/applicationjson/ApplicationjsonSchema.kt new file mode 100644 index 00000000000..1e9e2b7db85 --- /dev/null +++ b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/fakerefsobjectmodelwithrefprops/post/requestbody/content/applicationjson/ApplicationjsonSchema.kt @@ -0,0 +1,19 @@ +package org.openapijsonschematools.client.paths.fakerefsobjectmodelwithrefprops.post.requestbody.content.applicationjson; + +import org.checkerframework.checker.nullness.qual.Nullable; +import org.openapijsonschematools.client.components.schemas.ObjectModelWithRefProps; + +public class ApplicationjsonSchema extends ObjectModelWithRefProps { + // $refed class + + + public static class ApplicationjsonSchema1 extends ObjectModelWithRefProps1 { + private static @Nullable ApplicationjsonSchema1 instance = null; + public static ApplicationjsonSchema1 getInstance() { + if (instance == null) { + instance = new ApplicationjsonSchema1(); + } + return instance; + } + } +} diff --git a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/fakerefsobjectmodelwithrefprops/post/responses/FakerefsobjectmodelwithrefpropsPostCode200Response.kt b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/fakerefsobjectmodelwithrefprops/post/responses/FakerefsobjectmodelwithrefpropsPostCode200Response.kt new file mode 100644 index 00000000000..adb7d0955c0 --- /dev/null +++ b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/fakerefsobjectmodelwithrefprops/post/responses/FakerefsobjectmodelwithrefpropsPostCode200Response.kt @@ -0,0 +1,63 @@ +package org.openapijsonschematools.client.paths.fakerefsobjectmodelwithrefprops.post.responses; + +import org.openapijsonschematools.client.configurations.SchemaConfiguration; +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; + +import java.util.AbstractMap; +import java.util.Map; +import java.net.http.HttpResponse; +import java.net.http.HttpHeaders; + +public class FakerefsobjectmodelwithrefpropsPostCode200Response { + public sealed interface SealedMediaType permits ApplicationjsonMediaType {} + + public record ApplicationjsonMediaType(ApplicationjsonSchema.ApplicationjsonSchema1 schema) implements SealedMediaType, MediaType { + public ApplicationjsonMediaType() { + this(ApplicationjsonSchema.ApplicationjsonSchema1.getInstance()); + } + @Override + public Nothing? encoding() { + return null; + } + } + public sealed interface SealedResponseBody permits ApplicationjsonResponseBody {} + public record ApplicationjsonResponseBody(ApplicationjsonSchema.ObjectModelWithRefProps1Boxed body) implements SealedResponseBody { } + + public static class FakerefsobjectmodelwithrefpropsPostCode200Response1 extends ResponseDeserializer { + public FakerefsobjectmodelwithrefpropsPostCode200Response1() { + super( + Map.ofEntries( + new AbstractMap.SimpleEntry<>("application/json", new ApplicationjsonMediaType()) + ) + ); + } + + @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); + } + + @Override + protected Nothing? getHeaders(HttpHeaders headers, SchemaConfiguration configuration) { + return null; + } + } + + @SuppressWarnings("serial") + public static class ResponseApiException extends ApiException { + public DeserializedHttpResponse deserializedResponse; + + public ResponseApiException(String s, HttpResponse response, DeserializedHttpResponse deserializedResponse) { + super(s, response); + this.deserializedResponse = deserializedResponse; + } + } +} diff --git a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/fakerefsobjectmodelwithrefprops/post/responses/code200response/content/applicationjson/ApplicationjsonSchema.kt b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/fakerefsobjectmodelwithrefprops/post/responses/code200response/content/applicationjson/ApplicationjsonSchema.kt new file mode 100644 index 00000000000..ae20e625adc --- /dev/null +++ b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/fakerefsobjectmodelwithrefprops/post/responses/code200response/content/applicationjson/ApplicationjsonSchema.kt @@ -0,0 +1,19 @@ +package org.openapijsonschematools.client.paths.fakerefsobjectmodelwithrefprops.post.responses.code200response.content.applicationjson; + +import org.checkerframework.checker.nullness.qual.Nullable; +import org.openapijsonschematools.client.components.schemas.ObjectModelWithRefProps; + +public class ApplicationjsonSchema extends ObjectModelWithRefProps { + // $refed class + + + public static class ApplicationjsonSchema1 extends ObjectModelWithRefProps1 { + private static @Nullable ApplicationjsonSchema1 instance = null; + public static ApplicationjsonSchema1 getInstance() { + if (instance == null) { + instance = new ApplicationjsonSchema1(); + } + return instance; + } + } +} diff --git a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/fakerefsstring/FakerefsstringPost.kt b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/fakerefsstring/FakerefsstringPost.kt new file mode 100644 index 00000000000..adc7818a1fa --- /dev/null +++ b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/fakerefsstring/FakerefsstringPost.kt @@ -0,0 +1,152 @@ +package org.openapijsonschematools.client.paths.fakerefsstring; + +import org.checkerframework.checker.nullness.qual.Nullable; +import org.openapijsonschematools.client.paths.fakerefsstring.post.FakerefsstringPostRequestBody; +import org.openapijsonschematools.client.RootServerInfo; +import org.openapijsonschematools.client.paths.fakerefsstring.post.FakerefsstringPostResponses; +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.requestbody.SerializedRequestBody; +import org.openapijsonschematools.client.paths.Fakerefsstring; + +import java.io.IOException; +import java.util.ArrayList; +import java.net.http.HttpClient; +import java.net.http.HttpRequest; +import java.time.Duration; +import java.util.List; +import java.util.Map; + +public class FakerefsstringPost { + private static class PostProvider { + private static final String method = "post"; + + public static FakerefsstringPostResponses.EndpointResponse post( + PostRequest request, + ApiConfiguration apiConfiguration, + SchemaConfiguration schemaConfiguration, + HttpClient client + ) throws IOException, InterruptedException, ValidationException, NotImplementedException, ApiException { + Map> headers = apiConfiguration.getDefaultHeaders(); + + @Nullable SerializedRequestBody serializedRequestBody; + HttpRequest.BodyPublisher bodyPublisher = HttpRequest.BodyPublishers.noBody(); + if (request.requestBody != null) { + serializedRequestBody = new FakerefsstringPostRequestBody.FakerefsstringPostRequestBody1().serialize( + request.requestBody + ); + var contentTypeHeaderValues = headers.getOrDefault("Content-Type", new ArrayList<>()); + contentTypeHeaderValues.add(serializedRequestBody.contentType); + bodyPublisher = serializedRequestBody.bodyPublisher; + } + // TODO set this to a map if there is a query security scheme + @Nullable Map queryMap = null; + String host = apiConfiguration.getServer(request.serverIndex).url(); + + String url = host + Fakerefsstring.path; + var httpRequest = RestClient.getRequest( + url, + method, + bodyPublisher, + headers, + request.timeout + ); + var response = RestClient.getResponse(httpRequest, client); + var responsesDeserializer = new FakerefsstringPostResponses.FakerefsstringPostResponses1(); + return responsesDeserializer.deserialize(response, schemaConfiguration); + } + } + + public interface PostOperation { + ApiConfiguration getApiConfiguration(); + SchemaConfiguration getSchemaConfiguration(); + HttpClient getClient(); + default FakerefsstringPostResponses.EndpointResponse post(PostRequest request) throws IOException, InterruptedException, ValidationException, NotImplementedException, ApiException { + return PostProvider.post(request, getApiConfiguration(), getSchemaConfiguration(), getClient()); + } + } + + public interface ModelStringOperation { + ApiConfiguration getApiConfiguration(); + SchemaConfiguration getSchemaConfiguration(); + HttpClient getClient(); + default FakerefsstringPostResponses.EndpointResponse modelString(PostRequest request) throws IOException, InterruptedException, ValidationException, NotImplementedException, ApiException { + return PostProvider.post(request, getApiConfiguration(), getSchemaConfiguration(), getClient()); + } + } + + public static class Post extends ApiClient implements PostOperation { + public Post(ApiConfiguration apiConfiguration, SchemaConfiguration schemaConfiguration) { + super(apiConfiguration, schemaConfiguration); + } + } + + public static class PostRequest { + public FakerefsstringPostRequestBody.@Nullable SealedRequestBody requestBody; + public RootServerInfo.@Nullable ServerIndex serverIndex; + public @Nullable Duration timeout; + } + + public interface SetterForRequestBody { + PostRequest getInstance(); + T getBuilderAfterRequestBody(PostRequest instance); + default T requestBody(FakerefsstringPostRequestBody.SealedRequestBody requestBody) { + var instance = getInstance(); + instance.requestBody = requestBody; + return getBuilderAfterRequestBody(instance); + } + } + + public interface SetterForServerIndex { + PostRequest getInstance(); + T getBuilderAfterServerIndex(PostRequest instance); + default T serverIndex(RootServerInfo.ServerIndex serverIndex) { + var instance = getInstance(); + instance.serverIndex = serverIndex; + return getBuilderAfterServerIndex(instance); + } + } + + public interface SetterForTimeout { + PostRequest getInstance(); + T getBuilderAfterTimeout(PostRequest instance); + default T timeout(Duration timeout) { + var instance = getInstance(); + instance.timeout = timeout; + return getBuilderAfterTimeout(instance); + } + } + + public static class PostRequestBuilder implements SetterForRequestBody, SetterForServerIndex, SetterForTimeout { + private final PostRequest instance; + + public PostRequestBuilder() { + this.instance = new PostRequest(); + } + + public PostRequest build() { + return instance; + } + + public PostRequest getInstance() { + return instance; + } + + public PostRequestBuilder getBuilderAfterRequestBody(PostRequest instance) { + return this; + } + + public PostRequestBuilder getBuilderAfterServerIndex(PostRequest instance) { + return this; + } + + public PostRequestBuilder getBuilderAfterTimeout(PostRequest instance) { + return this; + } + } +} diff --git a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/fakerefsstring/post/FakerefsstringPostRequestBody.kt b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/fakerefsstring/post/FakerefsstringPostRequestBody.kt new file mode 100644 index 00000000000..f01d4f22e20 --- /dev/null +++ b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/fakerefsstring/post/FakerefsstringPostRequestBody.kt @@ -0,0 +1,49 @@ +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; +import org.openapijsonschematools.client.mediatype.MediaType; +import org.openapijsonschematools.client.paths.fakerefsstring.post.requestbody.content.applicationjson.ApplicationjsonSchema; + +import java.util.AbstractMap; +import java.util.Map; + +public class FakerefsstringPostRequestBody { + public sealed interface SealedMediaType permits ApplicationjsonMediaType {} + + public record ApplicationjsonMediaType(ApplicationjsonSchema.ApplicationjsonSchema1 schema) implements SealedMediaType, MediaType { + public ApplicationjsonMediaType() { + this(ApplicationjsonSchema.ApplicationjsonSchema1.getInstance()); + } + @Override + public Nothing? encoding() { + return null; + } + } + + public static class FakerefsstringPostRequestBody1 extends RequestBodySerializer { + public FakerefsstringPostRequestBody1() { + super( + Map.ofEntries( + new AbstractMap.SimpleEntry<>("application/json", new ApplicationjsonMediaType()) + ), + false + ); + } + + public SerializedRequestBody serialize(SealedRequestBody requestBody) throws NotImplementedException { + ApplicationjsonRequestBody requestBody0 = (ApplicationjsonRequestBody) requestBody; + return serialize(requestBody0.contentType(), requestBody0.body().getData()); + } + } + + public sealed interface SealedRequestBody permits ApplicationjsonRequestBody {} + public record ApplicationjsonRequestBody(ApplicationjsonSchema.StringJsonSchema1Boxed body) implements SealedRequestBody, GenericRequestBody { + @Override + public String contentType() { + return "application/json"; + } + } +} diff --git a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/fakerefsstring/post/FakerefsstringPostResponses.kt b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/fakerefsstring/post/FakerefsstringPostResponses.kt new file mode 100644 index 00000000000..28a0b9c0873 --- /dev/null +++ b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/fakerefsstring/post/FakerefsstringPostResponses.kt @@ -0,0 +1,53 @@ +package org.openapijsonschematools.client.paths.fakerefsstring.post; + +import org.openapijsonschematools.client.paths.fakerefsstring.post.responses.FakerefsstringPostCode200Response; +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; +import org.checkerframework.checker.nullness.qual.Nullable; + +import java.net.http.HttpResponse; +import java.util.Map; +import java.util.AbstractMap; + +public class FakerefsstringPostResponses { + public sealed interface EndpointResponse permits EndpointFakerefsstringPostCode200Response {} + + public record EndpointFakerefsstringPostCode200Response( + HttpResponse response, + FakerefsstringPostCode200Response.SealedResponseBody body, + Nothing? headers + ) implements EndpointResponse, ApiResponse{ + } + + public sealed interface StatusCodeResponseDeserializer permits StatusFakerefsstringPostCode200ResponseDeserializer {} + + public static final class StatusFakerefsstringPostCode200ResponseDeserializer extends FakerefsstringPostCode200Response.FakerefsstringPostCode200Response1 implements StatusCodeResponseDeserializer { + } + + public static final class FakerefsstringPostResponses1 implements ResponsesDeserializer { + private final Map statusCodeToResponseDeserializer; + public FakerefsstringPostResponses1() { + this.statusCodeToResponseDeserializer = Map.ofEntries( + new AbstractMap.SimpleEntry<>("200", new StatusFakerefsstringPostCode200ResponseDeserializer()) + ); + } + + 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) { + throw new ApiException( + "Invalid response statusCode="+statusCode+" has no response defined in the openapi document", + response + ); + } + StatusFakerefsstringPostCode200ResponseDeserializer castDeserializer = (StatusFakerefsstringPostCode200ResponseDeserializer) statusCodeDeserializer; + var deserializedResponse = castDeserializer.deserialize(response, configuration); + return new EndpointFakerefsstringPostCode200Response(response, deserializedResponse.body(), deserializedResponse.headers()); + } + } +} diff --git a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/fakerefsstring/post/requestbody/content/applicationjson/ApplicationjsonSchema.kt b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/fakerefsstring/post/requestbody/content/applicationjson/ApplicationjsonSchema.kt new file mode 100644 index 00000000000..7ebeea7dcd3 --- /dev/null +++ b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/fakerefsstring/post/requestbody/content/applicationjson/ApplicationjsonSchema.kt @@ -0,0 +1,19 @@ +package org.openapijsonschematools.client.paths.fakerefsstring.post.requestbody.content.applicationjson; + +import org.checkerframework.checker.nullness.qual.Nullable; +import org.openapijsonschematools.client.components.schemas.StringSchema; + +public class ApplicationjsonSchema extends StringSchema { + // $refed class + + + public static class ApplicationjsonSchema1 extends StringSchema1 { + private static @Nullable ApplicationjsonSchema1 instance = null; + public static ApplicationjsonSchema1 getInstance() { + if (instance == null) { + instance = new ApplicationjsonSchema1(); + } + return instance; + } + } +} diff --git a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/fakerefsstring/post/responses/FakerefsstringPostCode200Response.kt b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/fakerefsstring/post/responses/FakerefsstringPostCode200Response.kt new file mode 100644 index 00000000000..ea29c0a6b22 --- /dev/null +++ b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/fakerefsstring/post/responses/FakerefsstringPostCode200Response.kt @@ -0,0 +1,63 @@ +package org.openapijsonschematools.client.paths.fakerefsstring.post.responses; + +import org.openapijsonschematools.client.configurations.SchemaConfiguration; +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; + +import java.util.AbstractMap; +import java.util.Map; +import java.net.http.HttpResponse; +import java.net.http.HttpHeaders; + +public class FakerefsstringPostCode200Response { + public sealed interface SealedMediaType permits ApplicationjsonMediaType {} + + public record ApplicationjsonMediaType(ApplicationjsonSchema.ApplicationjsonSchema1 schema) implements SealedMediaType, MediaType { + public ApplicationjsonMediaType() { + this(ApplicationjsonSchema.ApplicationjsonSchema1.getInstance()); + } + @Override + public Nothing? encoding() { + return null; + } + } + public sealed interface SealedResponseBody permits ApplicationjsonResponseBody {} + public record ApplicationjsonResponseBody(ApplicationjsonSchema.StringJsonSchema1Boxed body) implements SealedResponseBody { } + + public static class FakerefsstringPostCode200Response1 extends ResponseDeserializer { + public FakerefsstringPostCode200Response1() { + super( + Map.ofEntries( + new AbstractMap.SimpleEntry<>("application/json", new ApplicationjsonMediaType()) + ) + ); + } + + @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); + } + + @Override + protected Nothing? getHeaders(HttpHeaders headers, SchemaConfiguration configuration) { + return null; + } + } + + @SuppressWarnings("serial") + public static class ResponseApiException extends ApiException { + public DeserializedHttpResponse deserializedResponse; + + public ResponseApiException(String s, HttpResponse response, DeserializedHttpResponse deserializedResponse) { + super(s, response); + this.deserializedResponse = deserializedResponse; + } + } +} diff --git a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/fakerefsstring/post/responses/code200response/content/applicationjson/ApplicationjsonSchema.kt b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/fakerefsstring/post/responses/code200response/content/applicationjson/ApplicationjsonSchema.kt new file mode 100644 index 00000000000..9f140dc31c3 --- /dev/null +++ b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/fakerefsstring/post/responses/code200response/content/applicationjson/ApplicationjsonSchema.kt @@ -0,0 +1,19 @@ +package org.openapijsonschematools.client.paths.fakerefsstring.post.responses.code200response.content.applicationjson; + +import org.checkerframework.checker.nullness.qual.Nullable; +import org.openapijsonschematools.client.components.schemas.StringSchema; + +public class ApplicationjsonSchema extends StringSchema { + // $refed class + + + public static class ApplicationjsonSchema1 extends StringSchema1 { + private static @Nullable ApplicationjsonSchema1 instance = null; + public static ApplicationjsonSchema1 getInstance() { + if (instance == null) { + instance = new ApplicationjsonSchema1(); + } + return instance; + } + } +} diff --git a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/fakeresponsewithoutschema/FakeresponsewithoutschemaGet.kt b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/fakeresponsewithoutschema/FakeresponsewithoutschemaGet.kt new file mode 100644 index 00000000000..284c2b3309e --- /dev/null +++ b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/fakeresponsewithoutschema/FakeresponsewithoutschemaGet.kt @@ -0,0 +1,124 @@ +package org.openapijsonschematools.client.paths.fakeresponsewithoutschema; + +import org.checkerframework.checker.nullness.qual.Nullable; +import org.openapijsonschematools.client.RootServerInfo; +import org.openapijsonschematools.client.paths.fakeresponsewithoutschema.get.FakeresponsewithoutschemaGetResponses; +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.paths.Fakeresponsewithoutschema; + +import java.io.IOException; +import java.net.http.HttpClient; +import java.net.http.HttpRequest; +import java.time.Duration; +import java.util.List; +import java.util.Map; + +public class FakeresponsewithoutschemaGet { + private static class GetProvider { + private static final String method = "get"; + + public static FakeresponsewithoutschemaGetResponses.EndpointResponse get( + GetRequest request, + ApiConfiguration apiConfiguration, + SchemaConfiguration schemaConfiguration, + HttpClient client + ) 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 + @Nullable Map queryMap = null; + String host = apiConfiguration.getServer(request.serverIndex).url(); + + String url = host + Fakeresponsewithoutschema.path; + var httpRequest = RestClient.getRequest( + url, + method, + bodyPublisher, + headers, + request.timeout + ); + var response = RestClient.getResponse(httpRequest, client); + var responsesDeserializer = new FakeresponsewithoutschemaGetResponses.FakeresponsewithoutschemaGetResponses1(); + return responsesDeserializer.deserialize(response, schemaConfiguration); + } + } + + public interface GetOperation { + ApiConfiguration getApiConfiguration(); + SchemaConfiguration getSchemaConfiguration(); + HttpClient getClient(); + default FakeresponsewithoutschemaGetResponses.EndpointResponse get(GetRequest request) throws IOException, InterruptedException, ValidationException, NotImplementedException, ApiException { + return GetProvider.get(request, getApiConfiguration(), getSchemaConfiguration(), getClient()); + } + } + + public interface ResponseWithoutSchemaOperation { + ApiConfiguration getApiConfiguration(); + SchemaConfiguration getSchemaConfiguration(); + HttpClient getClient(); + default FakeresponsewithoutschemaGetResponses.EndpointResponse responseWithoutSchema(GetRequest request) throws IOException, InterruptedException, ValidationException, NotImplementedException, ApiException { + return GetProvider.get(request, getApiConfiguration(), getSchemaConfiguration(), getClient()); + } + } + + public static class Get extends ApiClient implements GetOperation { + public Get(ApiConfiguration apiConfiguration, SchemaConfiguration schemaConfiguration) { + super(apiConfiguration, schemaConfiguration); + } + } + + public static class GetRequest { + public RootServerInfo.@Nullable ServerIndex serverIndex; + public @Nullable Duration timeout; + } + + public interface SetterForServerIndex { + GetRequest getInstance(); + T getBuilderAfterServerIndex(GetRequest instance); + default T serverIndex(RootServerInfo.ServerIndex serverIndex) { + var instance = getInstance(); + instance.serverIndex = serverIndex; + return getBuilderAfterServerIndex(instance); + } + } + + public interface SetterForTimeout { + GetRequest getInstance(); + T getBuilderAfterTimeout(GetRequest instance); + default T timeout(Duration timeout) { + var instance = getInstance(); + instance.timeout = timeout; + return getBuilderAfterTimeout(instance); + } + } + + public static class GetRequestBuilder implements SetterForServerIndex, SetterForTimeout { + private final GetRequest instance; + + public GetRequestBuilder() { + this.instance = new GetRequest(); + } + + public GetRequest build() { + return instance; + } + + public GetRequest getInstance() { + return instance; + } + + public GetRequestBuilder getBuilderAfterServerIndex(GetRequest instance) { + return this; + } + + public GetRequestBuilder getBuilderAfterTimeout(GetRequest instance) { + return this; + } + } +} diff --git a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/fakeresponsewithoutschema/get/FakeresponsewithoutschemaGetResponses.kt b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/fakeresponsewithoutschema/get/FakeresponsewithoutschemaGetResponses.kt new file mode 100644 index 00000000000..ec3ff1a85b8 --- /dev/null +++ b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/fakeresponsewithoutschema/get/FakeresponsewithoutschemaGetResponses.kt @@ -0,0 +1,53 @@ +package org.openapijsonschematools.client.paths.fakeresponsewithoutschema.get; + +import org.openapijsonschematools.client.paths.fakeresponsewithoutschema.get.responses.FakeresponsewithoutschemaGetCode200Response; +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; +import org.checkerframework.checker.nullness.qual.Nullable; + +import java.net.http.HttpResponse; +import java.util.Map; +import java.util.AbstractMap; + +public class FakeresponsewithoutschemaGetResponses { + public sealed interface EndpointResponse permits EndpointFakeresponsewithoutschemaGetCode200Response {} + + public record EndpointFakeresponsewithoutschemaGetCode200Response( + HttpResponse response, + Nothing? body, + Nothing? headers + ) implements EndpointResponse, ApiResponse{ + } + + public sealed interface StatusCodeResponseDeserializer permits StatusFakeresponsewithoutschemaGetCode200ResponseDeserializer {} + + public static final class StatusFakeresponsewithoutschemaGetCode200ResponseDeserializer extends FakeresponsewithoutschemaGetCode200Response.FakeresponsewithoutschemaGetCode200Response1 implements StatusCodeResponseDeserializer { + } + + public static final class FakeresponsewithoutschemaGetResponses1 implements ResponsesDeserializer { + private final Map statusCodeToResponseDeserializer; + public FakeresponsewithoutschemaGetResponses1() { + this.statusCodeToResponseDeserializer = Map.ofEntries( + new AbstractMap.SimpleEntry<>("200", new StatusFakeresponsewithoutschemaGetCode200ResponseDeserializer()) + ); + } + + 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) { + throw new ApiException( + "Invalid response statusCode="+statusCode+" has no response defined in the openapi document", + response + ); + } + StatusFakeresponsewithoutschemaGetCode200ResponseDeserializer castDeserializer = (StatusFakeresponsewithoutschemaGetCode200ResponseDeserializer) statusCodeDeserializer; + var deserializedResponse = castDeserializer.deserialize(response, configuration); + return new EndpointFakeresponsewithoutschemaGetCode200Response(response, deserializedResponse.body(), deserializedResponse.headers()); + } + } +} diff --git a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/fakeresponsewithoutschema/get/responses/FakeresponsewithoutschemaGetCode200Response.kt b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/fakeresponsewithoutschema/get/responses/FakeresponsewithoutschemaGetCode200Response.kt new file mode 100644 index 00000000000..7e0440694cd --- /dev/null +++ b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/fakeresponsewithoutschema/get/responses/FakeresponsewithoutschemaGetCode200Response.kt @@ -0,0 +1,48 @@ +package org.openapijsonschematools.client.paths.fakeresponsewithoutschema.get.responses; + +import org.openapijsonschematools.client.configurations.SchemaConfiguration; +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; +import java.util.Map; +import java.net.http.HttpResponse; +import java.net.http.HttpHeaders; + +public class FakeresponsewithoutschemaGetCode200Response { + + public static class FakeresponsewithoutschemaGetCode200Response1 extends ResponseDeserializer { + public FakeresponsewithoutschemaGetCode200Response1() { + super( + MapUtils.makeMap( + new AbstractMap.SimpleEntry("application/json", null), + new AbstractMap.SimpleEntry("application/xml", null) + ) + ); + } + + @Override + protected Nothing? getBody(String contentType, Nothing? mediaType, byte[] body, SchemaConfiguration configuration) { + return null; + } + + @Override + protected Nothing? getHeaders(HttpHeaders headers, SchemaConfiguration configuration) { + return null; + } + } + + @SuppressWarnings("serial") + public static class ResponseApiException extends ApiException { + public DeserializedHttpResponse deserializedResponse; + + public ResponseApiException(String s, HttpResponse response, DeserializedHttpResponse deserializedResponse) { + super(s, response); + this.deserializedResponse = deserializedResponse; + } + } +} diff --git a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/faketestqueryparamters/FaketestqueryparamtersPut.kt b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/faketestqueryparamters/FaketestqueryparamtersPut.kt new file mode 100644 index 00000000000..3957ca24485 --- /dev/null +++ b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/faketestqueryparamters/FaketestqueryparamtersPut.kt @@ -0,0 +1,180 @@ +package org.openapijsonschematools.client.paths.faketestqueryparamters; + +import org.checkerframework.checker.nullness.qual.Nullable; +import org.openapijsonschematools.client.RootServerInfo; +import org.openapijsonschematools.client.paths.faketestqueryparamters.put.FaketestqueryparamtersPutQueryParameters; +import org.openapijsonschematools.client.paths.faketestqueryparamters.put.Parameters; +import org.openapijsonschematools.client.paths.faketestqueryparamters.put.FaketestqueryparamtersPutResponses; +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.paths.Faketestqueryparamters; + +import java.io.IOException; +import java.net.http.HttpClient; +import java.net.http.HttpRequest; +import java.time.Duration; +import java.util.List; +import java.util.Map; + +public class FaketestqueryparamtersPut { + private static class PutProvider { + private static final String method = "put"; + + public static FaketestqueryparamtersPutResponses.EndpointResponse put( + PutRequest request, + ApiConfiguration apiConfiguration, + SchemaConfiguration schemaConfiguration, + HttpClient client + ) throws IOException, InterruptedException, ValidationException, NotImplementedException, ApiException { + Map> headers = apiConfiguration.getDefaultHeaders(); + HttpRequest.BodyPublisher bodyPublisher = HttpRequest.BodyPublishers.noBody(); + + var querySerializer = new Parameters.QueryParametersSerializer(); + @Nullable Map queryMap = querySerializer.getQueryMap(request.queryParameters); + String host = apiConfiguration.getServer(request.serverIndex).url(); + + String url = host + Faketestqueryparamters.path; + if (queryMap != null) { + url = url + querySerializer.serialize(queryMap); + } + var httpRequest = RestClient.getRequest( + url, + method, + bodyPublisher, + headers, + request.timeout + ); + var response = RestClient.getResponse(httpRequest, client); + var responsesDeserializer = new FaketestqueryparamtersPutResponses.FaketestqueryparamtersPutResponses1(); + return responsesDeserializer.deserialize(response, schemaConfiguration); + } + } + + public interface PutOperation { + ApiConfiguration getApiConfiguration(); + SchemaConfiguration getSchemaConfiguration(); + HttpClient getClient(); + default FaketestqueryparamtersPutResponses.EndpointResponse put(PutRequest request) throws IOException, InterruptedException, ValidationException, NotImplementedException, ApiException { + return PutProvider.put(request, getApiConfiguration(), getSchemaConfiguration(), getClient()); + } + } + + public interface QueryParameterCollectionFormatOperation { + ApiConfiguration getApiConfiguration(); + SchemaConfiguration getSchemaConfiguration(); + HttpClient getClient(); + default FaketestqueryparamtersPutResponses.EndpointResponse queryParameterCollectionFormat(PutRequest request) throws IOException, InterruptedException, ValidationException, NotImplementedException, ApiException { + return PutProvider.put(request, getApiConfiguration(), getSchemaConfiguration(), getClient()); + } + } + + public static class Put extends ApiClient implements PutOperation { + public Put(ApiConfiguration apiConfiguration, SchemaConfiguration schemaConfiguration) { + super(apiConfiguration, schemaConfiguration); + } + } + + public static class PutRequest { + public FaketestqueryparamtersPutQueryParameters.QueryParametersMap queryParameters; + public RootServerInfo.@Nullable ServerIndex serverIndex; + public @Nullable Duration timeout; + + public PutRequest( + FaketestqueryparamtersPutQueryParameters.QueryParametersMap queryParameters, + RootServerInfo.@Nullable ServerIndex serverIndex, + @Nullable Duration timeout + ) { + this.queryParameters = queryParameters; + this.serverIndex = serverIndex; + this.timeout = timeout; + } + } + + public static class PutNullableRequest { + public FaketestqueryparamtersPutQueryParameters.@Nullable QueryParametersMap queryParameters; + public RootServerInfo.@Nullable ServerIndex serverIndex; + public @Nullable Duration timeout; + } + + public interface SetterForServerIndex { + PutNullableRequest getInstance(); + T getBuilderAfterServerIndex(PutNullableRequest instance); + default T serverIndex(RootServerInfo.ServerIndex serverIndex) { + var instance = getInstance(); + instance.serverIndex = serverIndex; + return getBuilderAfterServerIndex(instance); + } + } + + public interface SetterForTimeout { + PutNullableRequest getInstance(); + T getBuilderAfterTimeout(PutNullableRequest instance); + default T timeout(Duration timeout) { + var instance = getInstance(); + instance.timeout = timeout; + return getBuilderAfterTimeout(instance); + } + } + + public interface SetterForQueryParameters { + PutNullableRequest getInstance(); + T getBuilderAfterQueryParameters(PutNullableRequest instance); + default T queryParameters(FaketestqueryparamtersPutQueryParameters.QueryParametersMap queryParameters) { + var instance = getInstance(); + instance.queryParameters = queryParameters; + return getBuilderAfterQueryParameters(instance); + } + } + + public static class Put0RequestBuilder implements SetterForServerIndex, SetterForTimeout { + private final PutNullableRequest instance; + + public Put0RequestBuilder(PutNullableRequest instance) { + this.instance = instance; + } + + public PutRequest build() { + var queryParameters = instance.queryParameters; + if (queryParameters == null) { + throw new RuntimeException("invalid null value for required parameter"); + } + return new PutRequest( + queryParameters, + instance.serverIndex, + instance.timeout + ); + } + + public PutNullableRequest getInstance() { + return instance; + } + + public Put0RequestBuilder getBuilderAfterServerIndex(PutNullableRequest instance) { + return this; + } + + public Put0RequestBuilder getBuilderAfterTimeout(PutNullableRequest instance) { + return this; + } + } + public static class PutRequestBuilder implements SetterForQueryParameters { + private final PutNullableRequest instance; + + public PutRequestBuilder() { + this.instance = new PutNullableRequest(); + } + + public PutNullableRequest getInstance() { + return instance; + } + + public Put0RequestBuilder getBuilderAfterQueryParameters(PutNullableRequest instance) { + return new Put0RequestBuilder(instance); + } + } +} diff --git a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/faketestqueryparamters/put/FaketestqueryparamtersPutQueryParameters.kt b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/faketestqueryparamters/put/FaketestqueryparamtersPutQueryParameters.kt new file mode 100644 index 00000000000..2ed109f1869 --- /dev/null +++ b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/faketestqueryparamters/put/FaketestqueryparamtersPutQueryParameters.kt @@ -0,0 +1,1515 @@ +package org.openapijsonschematools.client.paths.faketestqueryparamters.put; +import java.util.ArrayList; +import java.util.HashSet; +import java.util.LinkedHashMap; +import java.util.LinkedHashSet; +import java.util.List; +import java.util.Map; +import java.util.Objects; +import java.util.Set; +import org.checkerframework.checker.nullness.qual.Nullable; +import org.openapijsonschematools.client.components.schemas.StringWithValidation; +import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags; +import org.openapijsonschematools.client.configurations.SchemaConfiguration; +import org.openapijsonschematools.client.exceptions.UnsetPropertyException; +import org.openapijsonschematools.client.exceptions.ValidationException; +import org.openapijsonschematools.client.paths.faketestqueryparamters.put.parameters.parameter0.Schema0; +import org.openapijsonschematools.client.paths.faketestqueryparamters.put.parameters.parameter1.Schema1; +import org.openapijsonschematools.client.paths.faketestqueryparamters.put.parameters.parameter2.Schema2; +import org.openapijsonschematools.client.paths.faketestqueryparamters.put.parameters.parameter3.Schema3; +import org.openapijsonschematools.client.paths.faketestqueryparamters.put.parameters.parameter4.Schema4; +import org.openapijsonschematools.client.schemas.AnyTypeJsonSchema; +import org.openapijsonschematools.client.schemas.GenericBuilder; +import org.openapijsonschematools.client.schemas.NotAnyTypeJsonSchema; +import org.openapijsonschematools.client.schemas.validation.FrozenMap; +import org.openapijsonschematools.client.schemas.validation.JsonSchema; +import org.openapijsonschematools.client.schemas.validation.JsonSchemaInfo; +import org.openapijsonschematools.client.schemas.validation.MapSchemaValidator; +import org.openapijsonschematools.client.schemas.validation.MapUtils; +import org.openapijsonschematools.client.schemas.validation.PathToSchemasMap; +import org.openapijsonschematools.client.schemas.validation.PropertyEntry; +import org.openapijsonschematools.client.schemas.validation.ValidationMetadata; + +public class FaketestqueryparamtersPutQueryParameters { + // nest classes so all schemas and input/output classes can be public + + + public static class AdditionalProperties extends NotAnyTypeJsonSchema.NotAnyTypeJsonSchema1 { + // NotAnyTypeSchema + private static @Nullable AdditionalProperties instance = null; + public static AdditionalProperties getInstance() { + if (instance == null) { + instance = new AdditionalProperties(); + } + return instance; + } + } + + + public static class QueryParametersMap extends FrozenMap<@Nullable Object> { + protected QueryParametersMap(FrozenMap<@Nullable Object> m) { + super(m); + } + public static final Set requiredKeys = Set.of( + "context", + "http", + "ioutil", + "pipe", + "refParam", + "url" + ); + public static final Set optionalKeys = Set.of(); + public static QueryParametersMap of(Map arg, SchemaConfiguration configuration) throws ValidationException { + return FaketestqueryparamtersPutQueryParameters1.getInstance().validate(arg, configuration); + } + + public Schema4.SchemaList4 context() { + @Nullable Object value = get("context"); + if (!(value instanceof Schema4.SchemaList4)) { + throw new RuntimeException("Invalid value stored for context"); + } + return (Schema4.SchemaList4) value; + } + + public Schema2.SchemaList2 http() { + @Nullable Object value = get("http"); + if (!(value instanceof Schema2.SchemaList2)) { + throw new RuntimeException("Invalid value stored for http"); + } + return (Schema2.SchemaList2) value; + } + + public Schema1.SchemaList1 ioutil() { + @Nullable Object value = get("ioutil"); + if (!(value instanceof Schema1.SchemaList1)) { + throw new RuntimeException("Invalid value stored for ioutil"); + } + return (Schema1.SchemaList1) value; + } + + public Schema0.SchemaList0 pipe() { + @Nullable Object value = get("pipe"); + if (!(value instanceof Schema0.SchemaList0)) { + throw new RuntimeException("Invalid value stored for pipe"); + } + return (Schema0.SchemaList0) value; + } + + public String refParam() { + @Nullable Object value = get("refParam"); + if (!(value instanceof String)) { + throw new RuntimeException("Invalid value stored for refParam"); + } + return (String) value; + } + + public Schema3.SchemaList3 url() { + @Nullable Object value = get("url"); + if (!(value instanceof Schema3.SchemaList3)) { + throw new RuntimeException("Invalid value stored for url"); + } + return (Schema3.SchemaList3) value; + } + } + + public interface SetterForContext { + Map getInstance(); + T getBuilderAfterContext(Map instance); + + default T context(List value) { + var instance = getInstance(); + instance.put("context", value); + return getBuilderAfterContext(instance); + } + } + + public interface SetterForHttp { + Map getInstance(); + T getBuilderAfterHttp(Map instance); + + default T http(List value) { + var instance = getInstance(); + instance.put("http", value); + return getBuilderAfterHttp(instance); + } + } + + public interface SetterForIoutil { + Map getInstance(); + T getBuilderAfterIoutil(Map instance); + + default T ioutil(List value) { + var instance = getInstance(); + instance.put("ioutil", value); + return getBuilderAfterIoutil(instance); + } + } + + public interface SetterForPipe { + Map getInstance(); + T getBuilderAfterPipe(Map instance); + + default T pipe(List value) { + var instance = getInstance(); + instance.put("pipe", value); + return getBuilderAfterPipe(instance); + } + } + + public interface SetterForRefParam { + Map getInstance(); + T getBuilderAfterRefParam(Map instance); + + default T refParam(String value) { + var instance = getInstance(); + instance.put("refParam", value); + return getBuilderAfterRefParam(instance); + } + } + + public interface SetterForUrl { + Map getInstance(); + T getBuilderAfterUrl(Map instance); + + default T url(List value) { + var instance = getInstance(); + instance.put("url", value); + return getBuilderAfterUrl(instance); + } + } + + public static class QueryParametersMap000000Builder implements GenericBuilder> { + private final Map instance; + private static final Set knownKeys = Set.of( + "context", + "http", + "ioutil", + "pipe", + "refParam", + "url" + ); + public Set getKnownKeys() { + return knownKeys; + } + public QueryParametersMap000000Builder(Map instance) { + this.instance = instance; + } + public Map build() { + return instance; + } + } + + public static class QueryParametersMap000001Builder implements SetterForUrl { + private final Map instance; + public QueryParametersMap000001Builder(Map instance) { + this.instance = instance; + } + public Map getInstance() { + return instance; + } + public QueryParametersMap000000Builder getBuilderAfterUrl(Map instance) { + return new QueryParametersMap000000Builder(instance); + } + } + + public static class QueryParametersMap000010Builder implements SetterForRefParam { + private final Map instance; + public QueryParametersMap000010Builder(Map instance) { + this.instance = instance; + } + public Map getInstance() { + return instance; + } + public QueryParametersMap000000Builder getBuilderAfterRefParam(Map instance) { + return new QueryParametersMap000000Builder(instance); + } + } + + public static class QueryParametersMap000011Builder implements SetterForRefParam, SetterForUrl { + private final Map instance; + public QueryParametersMap000011Builder(Map instance) { + this.instance = instance; + } + public Map getInstance() { + return instance; + } + public QueryParametersMap000001Builder getBuilderAfterRefParam(Map instance) { + return new QueryParametersMap000001Builder(instance); + } + public QueryParametersMap000010Builder getBuilderAfterUrl(Map instance) { + return new QueryParametersMap000010Builder(instance); + } + } + + public static class QueryParametersMap000100Builder implements SetterForPipe { + private final Map instance; + public QueryParametersMap000100Builder(Map instance) { + this.instance = instance; + } + public Map getInstance() { + return instance; + } + public QueryParametersMap000000Builder getBuilderAfterPipe(Map instance) { + return new QueryParametersMap000000Builder(instance); + } + } + + public static class QueryParametersMap000101Builder implements SetterForPipe, SetterForUrl { + private final Map instance; + public QueryParametersMap000101Builder(Map instance) { + this.instance = instance; + } + public Map getInstance() { + return instance; + } + public QueryParametersMap000001Builder getBuilderAfterPipe(Map instance) { + return new QueryParametersMap000001Builder(instance); + } + public QueryParametersMap000100Builder getBuilderAfterUrl(Map instance) { + return new QueryParametersMap000100Builder(instance); + } + } + + public static class QueryParametersMap000110Builder implements SetterForPipe, SetterForRefParam { + private final Map instance; + public QueryParametersMap000110Builder(Map instance) { + this.instance = instance; + } + public Map getInstance() { + return instance; + } + public QueryParametersMap000010Builder getBuilderAfterPipe(Map instance) { + return new QueryParametersMap000010Builder(instance); + } + public QueryParametersMap000100Builder getBuilderAfterRefParam(Map instance) { + return new QueryParametersMap000100Builder(instance); + } + } + + public static class QueryParametersMap000111Builder implements SetterForPipe, SetterForRefParam, SetterForUrl { + private final Map instance; + public QueryParametersMap000111Builder(Map instance) { + this.instance = instance; + } + public Map getInstance() { + return instance; + } + public QueryParametersMap000011Builder getBuilderAfterPipe(Map instance) { + return new QueryParametersMap000011Builder(instance); + } + public QueryParametersMap000101Builder getBuilderAfterRefParam(Map instance) { + return new QueryParametersMap000101Builder(instance); + } + public QueryParametersMap000110Builder getBuilderAfterUrl(Map instance) { + return new QueryParametersMap000110Builder(instance); + } + } + + public static class QueryParametersMap001000Builder implements SetterForIoutil { + private final Map instance; + public QueryParametersMap001000Builder(Map instance) { + this.instance = instance; + } + public Map getInstance() { + return instance; + } + public QueryParametersMap000000Builder getBuilderAfterIoutil(Map instance) { + return new QueryParametersMap000000Builder(instance); + } + } + + public static class QueryParametersMap001001Builder implements SetterForIoutil, SetterForUrl { + private final Map instance; + public QueryParametersMap001001Builder(Map instance) { + this.instance = instance; + } + public Map getInstance() { + return instance; + } + public QueryParametersMap000001Builder getBuilderAfterIoutil(Map instance) { + return new QueryParametersMap000001Builder(instance); + } + public QueryParametersMap001000Builder getBuilderAfterUrl(Map instance) { + return new QueryParametersMap001000Builder(instance); + } + } + + public static class QueryParametersMap001010Builder implements SetterForIoutil, SetterForRefParam { + private final Map instance; + public QueryParametersMap001010Builder(Map instance) { + this.instance = instance; + } + public Map getInstance() { + return instance; + } + public QueryParametersMap000010Builder getBuilderAfterIoutil(Map instance) { + return new QueryParametersMap000010Builder(instance); + } + public QueryParametersMap001000Builder getBuilderAfterRefParam(Map instance) { + return new QueryParametersMap001000Builder(instance); + } + } + + public static class QueryParametersMap001011Builder implements SetterForIoutil, SetterForRefParam, SetterForUrl { + private final Map instance; + public QueryParametersMap001011Builder(Map instance) { + this.instance = instance; + } + public Map getInstance() { + return instance; + } + public QueryParametersMap000011Builder getBuilderAfterIoutil(Map instance) { + return new QueryParametersMap000011Builder(instance); + } + public QueryParametersMap001001Builder getBuilderAfterRefParam(Map instance) { + return new QueryParametersMap001001Builder(instance); + } + public QueryParametersMap001010Builder getBuilderAfterUrl(Map instance) { + return new QueryParametersMap001010Builder(instance); + } + } + + public static class QueryParametersMap001100Builder implements SetterForIoutil, SetterForPipe { + private final Map instance; + public QueryParametersMap001100Builder(Map instance) { + this.instance = instance; + } + public Map getInstance() { + return instance; + } + public QueryParametersMap000100Builder getBuilderAfterIoutil(Map instance) { + return new QueryParametersMap000100Builder(instance); + } + public QueryParametersMap001000Builder getBuilderAfterPipe(Map instance) { + return new QueryParametersMap001000Builder(instance); + } + } + + public static class QueryParametersMap001101Builder implements SetterForIoutil, SetterForPipe, SetterForUrl { + private final Map instance; + public QueryParametersMap001101Builder(Map instance) { + this.instance = instance; + } + public Map getInstance() { + return instance; + } + public QueryParametersMap000101Builder getBuilderAfterIoutil(Map instance) { + return new QueryParametersMap000101Builder(instance); + } + public QueryParametersMap001001Builder getBuilderAfterPipe(Map instance) { + return new QueryParametersMap001001Builder(instance); + } + public QueryParametersMap001100Builder getBuilderAfterUrl(Map instance) { + return new QueryParametersMap001100Builder(instance); + } + } + + public static class QueryParametersMap001110Builder implements SetterForIoutil, SetterForPipe, SetterForRefParam { + private final Map instance; + public QueryParametersMap001110Builder(Map instance) { + this.instance = instance; + } + public Map getInstance() { + return instance; + } + public QueryParametersMap000110Builder getBuilderAfterIoutil(Map instance) { + return new QueryParametersMap000110Builder(instance); + } + public QueryParametersMap001010Builder getBuilderAfterPipe(Map instance) { + return new QueryParametersMap001010Builder(instance); + } + public QueryParametersMap001100Builder getBuilderAfterRefParam(Map instance) { + return new QueryParametersMap001100Builder(instance); + } + } + + public static class QueryParametersMap001111Builder implements SetterForIoutil, SetterForPipe, SetterForRefParam, SetterForUrl { + private final Map instance; + public QueryParametersMap001111Builder(Map instance) { + this.instance = instance; + } + public Map getInstance() { + return instance; + } + public QueryParametersMap000111Builder getBuilderAfterIoutil(Map instance) { + return new QueryParametersMap000111Builder(instance); + } + public QueryParametersMap001011Builder getBuilderAfterPipe(Map instance) { + return new QueryParametersMap001011Builder(instance); + } + public QueryParametersMap001101Builder getBuilderAfterRefParam(Map instance) { + return new QueryParametersMap001101Builder(instance); + } + public QueryParametersMap001110Builder getBuilderAfterUrl(Map instance) { + return new QueryParametersMap001110Builder(instance); + } + } + + public static class QueryParametersMap010000Builder implements SetterForHttp { + private final Map instance; + public QueryParametersMap010000Builder(Map instance) { + this.instance = instance; + } + public Map getInstance() { + return instance; + } + public QueryParametersMap000000Builder getBuilderAfterHttp(Map instance) { + return new QueryParametersMap000000Builder(instance); + } + } + + public static class QueryParametersMap010001Builder implements SetterForHttp, SetterForUrl { + private final Map instance; + public QueryParametersMap010001Builder(Map instance) { + this.instance = instance; + } + public Map getInstance() { + return instance; + } + public QueryParametersMap000001Builder getBuilderAfterHttp(Map instance) { + return new QueryParametersMap000001Builder(instance); + } + public QueryParametersMap010000Builder getBuilderAfterUrl(Map instance) { + return new QueryParametersMap010000Builder(instance); + } + } + + public static class QueryParametersMap010010Builder implements SetterForHttp, SetterForRefParam { + private final Map instance; + public QueryParametersMap010010Builder(Map instance) { + this.instance = instance; + } + public Map getInstance() { + return instance; + } + public QueryParametersMap000010Builder getBuilderAfterHttp(Map instance) { + return new QueryParametersMap000010Builder(instance); + } + public QueryParametersMap010000Builder getBuilderAfterRefParam(Map instance) { + return new QueryParametersMap010000Builder(instance); + } + } + + public static class QueryParametersMap010011Builder implements SetterForHttp, SetterForRefParam, SetterForUrl { + private final Map instance; + public QueryParametersMap010011Builder(Map instance) { + this.instance = instance; + } + public Map getInstance() { + return instance; + } + public QueryParametersMap000011Builder getBuilderAfterHttp(Map instance) { + return new QueryParametersMap000011Builder(instance); + } + public QueryParametersMap010001Builder getBuilderAfterRefParam(Map instance) { + return new QueryParametersMap010001Builder(instance); + } + public QueryParametersMap010010Builder getBuilderAfterUrl(Map instance) { + return new QueryParametersMap010010Builder(instance); + } + } + + public static class QueryParametersMap010100Builder implements SetterForHttp, SetterForPipe { + private final Map instance; + public QueryParametersMap010100Builder(Map instance) { + this.instance = instance; + } + public Map getInstance() { + return instance; + } + public QueryParametersMap000100Builder getBuilderAfterHttp(Map instance) { + return new QueryParametersMap000100Builder(instance); + } + public QueryParametersMap010000Builder getBuilderAfterPipe(Map instance) { + return new QueryParametersMap010000Builder(instance); + } + } + + public static class QueryParametersMap010101Builder implements SetterForHttp, SetterForPipe, SetterForUrl { + private final Map instance; + public QueryParametersMap010101Builder(Map instance) { + this.instance = instance; + } + public Map getInstance() { + return instance; + } + public QueryParametersMap000101Builder getBuilderAfterHttp(Map instance) { + return new QueryParametersMap000101Builder(instance); + } + public QueryParametersMap010001Builder getBuilderAfterPipe(Map instance) { + return new QueryParametersMap010001Builder(instance); + } + public QueryParametersMap010100Builder getBuilderAfterUrl(Map instance) { + return new QueryParametersMap010100Builder(instance); + } + } + + public static class QueryParametersMap010110Builder implements SetterForHttp, SetterForPipe, SetterForRefParam { + private final Map instance; + public QueryParametersMap010110Builder(Map instance) { + this.instance = instance; + } + public Map getInstance() { + return instance; + } + public QueryParametersMap000110Builder getBuilderAfterHttp(Map instance) { + return new QueryParametersMap000110Builder(instance); + } + public QueryParametersMap010010Builder getBuilderAfterPipe(Map instance) { + return new QueryParametersMap010010Builder(instance); + } + public QueryParametersMap010100Builder getBuilderAfterRefParam(Map instance) { + return new QueryParametersMap010100Builder(instance); + } + } + + public static class QueryParametersMap010111Builder implements SetterForHttp, SetterForPipe, SetterForRefParam, SetterForUrl { + private final Map instance; + public QueryParametersMap010111Builder(Map instance) { + this.instance = instance; + } + public Map getInstance() { + return instance; + } + public QueryParametersMap000111Builder getBuilderAfterHttp(Map instance) { + return new QueryParametersMap000111Builder(instance); + } + public QueryParametersMap010011Builder getBuilderAfterPipe(Map instance) { + return new QueryParametersMap010011Builder(instance); + } + public QueryParametersMap010101Builder getBuilderAfterRefParam(Map instance) { + return new QueryParametersMap010101Builder(instance); + } + public QueryParametersMap010110Builder getBuilderAfterUrl(Map instance) { + return new QueryParametersMap010110Builder(instance); + } + } + + public static class QueryParametersMap011000Builder implements SetterForHttp, SetterForIoutil { + private final Map instance; + public QueryParametersMap011000Builder(Map instance) { + this.instance = instance; + } + public Map getInstance() { + return instance; + } + public QueryParametersMap001000Builder getBuilderAfterHttp(Map instance) { + return new QueryParametersMap001000Builder(instance); + } + public QueryParametersMap010000Builder getBuilderAfterIoutil(Map instance) { + return new QueryParametersMap010000Builder(instance); + } + } + + public static class QueryParametersMap011001Builder implements SetterForHttp, SetterForIoutil, SetterForUrl { + private final Map instance; + public QueryParametersMap011001Builder(Map instance) { + this.instance = instance; + } + public Map getInstance() { + return instance; + } + public QueryParametersMap001001Builder getBuilderAfterHttp(Map instance) { + return new QueryParametersMap001001Builder(instance); + } + public QueryParametersMap010001Builder getBuilderAfterIoutil(Map instance) { + return new QueryParametersMap010001Builder(instance); + } + public QueryParametersMap011000Builder getBuilderAfterUrl(Map instance) { + return new QueryParametersMap011000Builder(instance); + } + } + + public static class QueryParametersMap011010Builder implements SetterForHttp, SetterForIoutil, SetterForRefParam { + private final Map instance; + public QueryParametersMap011010Builder(Map instance) { + this.instance = instance; + } + public Map getInstance() { + return instance; + } + public QueryParametersMap001010Builder getBuilderAfterHttp(Map instance) { + return new QueryParametersMap001010Builder(instance); + } + public QueryParametersMap010010Builder getBuilderAfterIoutil(Map instance) { + return new QueryParametersMap010010Builder(instance); + } + public QueryParametersMap011000Builder getBuilderAfterRefParam(Map instance) { + return new QueryParametersMap011000Builder(instance); + } + } + + public static class QueryParametersMap011011Builder implements SetterForHttp, SetterForIoutil, SetterForRefParam, SetterForUrl { + private final Map instance; + public QueryParametersMap011011Builder(Map instance) { + this.instance = instance; + } + public Map getInstance() { + return instance; + } + public QueryParametersMap001011Builder getBuilderAfterHttp(Map instance) { + return new QueryParametersMap001011Builder(instance); + } + public QueryParametersMap010011Builder getBuilderAfterIoutil(Map instance) { + return new QueryParametersMap010011Builder(instance); + } + public QueryParametersMap011001Builder getBuilderAfterRefParam(Map instance) { + return new QueryParametersMap011001Builder(instance); + } + public QueryParametersMap011010Builder getBuilderAfterUrl(Map instance) { + return new QueryParametersMap011010Builder(instance); + } + } + + public static class QueryParametersMap011100Builder implements SetterForHttp, SetterForIoutil, SetterForPipe { + private final Map instance; + public QueryParametersMap011100Builder(Map instance) { + this.instance = instance; + } + public Map getInstance() { + return instance; + } + public QueryParametersMap001100Builder getBuilderAfterHttp(Map instance) { + return new QueryParametersMap001100Builder(instance); + } + public QueryParametersMap010100Builder getBuilderAfterIoutil(Map instance) { + return new QueryParametersMap010100Builder(instance); + } + public QueryParametersMap011000Builder getBuilderAfterPipe(Map instance) { + return new QueryParametersMap011000Builder(instance); + } + } + + public static class QueryParametersMap011101Builder implements SetterForHttp, SetterForIoutil, SetterForPipe, SetterForUrl { + private final Map instance; + public QueryParametersMap011101Builder(Map instance) { + this.instance = instance; + } + public Map getInstance() { + return instance; + } + public QueryParametersMap001101Builder getBuilderAfterHttp(Map instance) { + return new QueryParametersMap001101Builder(instance); + } + public QueryParametersMap010101Builder getBuilderAfterIoutil(Map instance) { + return new QueryParametersMap010101Builder(instance); + } + public QueryParametersMap011001Builder getBuilderAfterPipe(Map instance) { + return new QueryParametersMap011001Builder(instance); + } + public QueryParametersMap011100Builder getBuilderAfterUrl(Map instance) { + return new QueryParametersMap011100Builder(instance); + } + } + + public static class QueryParametersMap011110Builder implements SetterForHttp, SetterForIoutil, SetterForPipe, SetterForRefParam { + private final Map instance; + public QueryParametersMap011110Builder(Map instance) { + this.instance = instance; + } + public Map getInstance() { + return instance; + } + public QueryParametersMap001110Builder getBuilderAfterHttp(Map instance) { + return new QueryParametersMap001110Builder(instance); + } + public QueryParametersMap010110Builder getBuilderAfterIoutil(Map instance) { + return new QueryParametersMap010110Builder(instance); + } + public QueryParametersMap011010Builder getBuilderAfterPipe(Map instance) { + return new QueryParametersMap011010Builder(instance); + } + public QueryParametersMap011100Builder getBuilderAfterRefParam(Map instance) { + return new QueryParametersMap011100Builder(instance); + } + } + + public static class QueryParametersMap011111Builder implements SetterForHttp, SetterForIoutil, SetterForPipe, SetterForRefParam, SetterForUrl { + private final Map instance; + public QueryParametersMap011111Builder(Map instance) { + this.instance = instance; + } + public Map getInstance() { + return instance; + } + public QueryParametersMap001111Builder getBuilderAfterHttp(Map instance) { + return new QueryParametersMap001111Builder(instance); + } + public QueryParametersMap010111Builder getBuilderAfterIoutil(Map instance) { + return new QueryParametersMap010111Builder(instance); + } + public QueryParametersMap011011Builder getBuilderAfterPipe(Map instance) { + return new QueryParametersMap011011Builder(instance); + } + public QueryParametersMap011101Builder getBuilderAfterRefParam(Map instance) { + return new QueryParametersMap011101Builder(instance); + } + public QueryParametersMap011110Builder getBuilderAfterUrl(Map instance) { + return new QueryParametersMap011110Builder(instance); + } + } + + public static class QueryParametersMap100000Builder implements SetterForContext { + private final Map instance; + public QueryParametersMap100000Builder(Map instance) { + this.instance = instance; + } + public Map getInstance() { + return instance; + } + public QueryParametersMap000000Builder getBuilderAfterContext(Map instance) { + return new QueryParametersMap000000Builder(instance); + } + } + + public static class QueryParametersMap100001Builder implements SetterForContext, SetterForUrl { + private final Map instance; + public QueryParametersMap100001Builder(Map instance) { + this.instance = instance; + } + public Map getInstance() { + return instance; + } + public QueryParametersMap000001Builder getBuilderAfterContext(Map instance) { + return new QueryParametersMap000001Builder(instance); + } + public QueryParametersMap100000Builder getBuilderAfterUrl(Map instance) { + return new QueryParametersMap100000Builder(instance); + } + } + + public static class QueryParametersMap100010Builder implements SetterForContext, SetterForRefParam { + private final Map instance; + public QueryParametersMap100010Builder(Map instance) { + this.instance = instance; + } + public Map getInstance() { + return instance; + } + public QueryParametersMap000010Builder getBuilderAfterContext(Map instance) { + return new QueryParametersMap000010Builder(instance); + } + public QueryParametersMap100000Builder getBuilderAfterRefParam(Map instance) { + return new QueryParametersMap100000Builder(instance); + } + } + + public static class QueryParametersMap100011Builder implements SetterForContext, SetterForRefParam, SetterForUrl { + private final Map instance; + public QueryParametersMap100011Builder(Map instance) { + this.instance = instance; + } + public Map getInstance() { + return instance; + } + public QueryParametersMap000011Builder getBuilderAfterContext(Map instance) { + return new QueryParametersMap000011Builder(instance); + } + public QueryParametersMap100001Builder getBuilderAfterRefParam(Map instance) { + return new QueryParametersMap100001Builder(instance); + } + public QueryParametersMap100010Builder getBuilderAfterUrl(Map instance) { + return new QueryParametersMap100010Builder(instance); + } + } + + public static class QueryParametersMap100100Builder implements SetterForContext, SetterForPipe { + private final Map instance; + public QueryParametersMap100100Builder(Map instance) { + this.instance = instance; + } + public Map getInstance() { + return instance; + } + public QueryParametersMap000100Builder getBuilderAfterContext(Map instance) { + return new QueryParametersMap000100Builder(instance); + } + public QueryParametersMap100000Builder getBuilderAfterPipe(Map instance) { + return new QueryParametersMap100000Builder(instance); + } + } + + public static class QueryParametersMap100101Builder implements SetterForContext, SetterForPipe, SetterForUrl { + private final Map instance; + public QueryParametersMap100101Builder(Map instance) { + this.instance = instance; + } + public Map getInstance() { + return instance; + } + public QueryParametersMap000101Builder getBuilderAfterContext(Map instance) { + return new QueryParametersMap000101Builder(instance); + } + public QueryParametersMap100001Builder getBuilderAfterPipe(Map instance) { + return new QueryParametersMap100001Builder(instance); + } + public QueryParametersMap100100Builder getBuilderAfterUrl(Map instance) { + return new QueryParametersMap100100Builder(instance); + } + } + + public static class QueryParametersMap100110Builder implements SetterForContext, SetterForPipe, SetterForRefParam { + private final Map instance; + public QueryParametersMap100110Builder(Map instance) { + this.instance = instance; + } + public Map getInstance() { + return instance; + } + public QueryParametersMap000110Builder getBuilderAfterContext(Map instance) { + return new QueryParametersMap000110Builder(instance); + } + public QueryParametersMap100010Builder getBuilderAfterPipe(Map instance) { + return new QueryParametersMap100010Builder(instance); + } + public QueryParametersMap100100Builder getBuilderAfterRefParam(Map instance) { + return new QueryParametersMap100100Builder(instance); + } + } + + public static class QueryParametersMap100111Builder implements SetterForContext, SetterForPipe, SetterForRefParam, SetterForUrl { + private final Map instance; + public QueryParametersMap100111Builder(Map instance) { + this.instance = instance; + } + public Map getInstance() { + return instance; + } + public QueryParametersMap000111Builder getBuilderAfterContext(Map instance) { + return new QueryParametersMap000111Builder(instance); + } + public QueryParametersMap100011Builder getBuilderAfterPipe(Map instance) { + return new QueryParametersMap100011Builder(instance); + } + public QueryParametersMap100101Builder getBuilderAfterRefParam(Map instance) { + return new QueryParametersMap100101Builder(instance); + } + public QueryParametersMap100110Builder getBuilderAfterUrl(Map instance) { + return new QueryParametersMap100110Builder(instance); + } + } + + public static class QueryParametersMap101000Builder implements SetterForContext, SetterForIoutil { + private final Map instance; + public QueryParametersMap101000Builder(Map instance) { + this.instance = instance; + } + public Map getInstance() { + return instance; + } + public QueryParametersMap001000Builder getBuilderAfterContext(Map instance) { + return new QueryParametersMap001000Builder(instance); + } + public QueryParametersMap100000Builder getBuilderAfterIoutil(Map instance) { + return new QueryParametersMap100000Builder(instance); + } + } + + public static class QueryParametersMap101001Builder implements SetterForContext, SetterForIoutil, SetterForUrl { + private final Map instance; + public QueryParametersMap101001Builder(Map instance) { + this.instance = instance; + } + public Map getInstance() { + return instance; + } + public QueryParametersMap001001Builder getBuilderAfterContext(Map instance) { + return new QueryParametersMap001001Builder(instance); + } + public QueryParametersMap100001Builder getBuilderAfterIoutil(Map instance) { + return new QueryParametersMap100001Builder(instance); + } + public QueryParametersMap101000Builder getBuilderAfterUrl(Map instance) { + return new QueryParametersMap101000Builder(instance); + } + } + + public static class QueryParametersMap101010Builder implements SetterForContext, SetterForIoutil, SetterForRefParam { + private final Map instance; + public QueryParametersMap101010Builder(Map instance) { + this.instance = instance; + } + public Map getInstance() { + return instance; + } + public QueryParametersMap001010Builder getBuilderAfterContext(Map instance) { + return new QueryParametersMap001010Builder(instance); + } + public QueryParametersMap100010Builder getBuilderAfterIoutil(Map instance) { + return new QueryParametersMap100010Builder(instance); + } + public QueryParametersMap101000Builder getBuilderAfterRefParam(Map instance) { + return new QueryParametersMap101000Builder(instance); + } + } + + public static class QueryParametersMap101011Builder implements SetterForContext, SetterForIoutil, SetterForRefParam, SetterForUrl { + private final Map instance; + public QueryParametersMap101011Builder(Map instance) { + this.instance = instance; + } + public Map getInstance() { + return instance; + } + public QueryParametersMap001011Builder getBuilderAfterContext(Map instance) { + return new QueryParametersMap001011Builder(instance); + } + public QueryParametersMap100011Builder getBuilderAfterIoutil(Map instance) { + return new QueryParametersMap100011Builder(instance); + } + public QueryParametersMap101001Builder getBuilderAfterRefParam(Map instance) { + return new QueryParametersMap101001Builder(instance); + } + public QueryParametersMap101010Builder getBuilderAfterUrl(Map instance) { + return new QueryParametersMap101010Builder(instance); + } + } + + public static class QueryParametersMap101100Builder implements SetterForContext, SetterForIoutil, SetterForPipe { + private final Map instance; + public QueryParametersMap101100Builder(Map instance) { + this.instance = instance; + } + public Map getInstance() { + return instance; + } + public QueryParametersMap001100Builder getBuilderAfterContext(Map instance) { + return new QueryParametersMap001100Builder(instance); + } + public QueryParametersMap100100Builder getBuilderAfterIoutil(Map instance) { + return new QueryParametersMap100100Builder(instance); + } + public QueryParametersMap101000Builder getBuilderAfterPipe(Map instance) { + return new QueryParametersMap101000Builder(instance); + } + } + + public static class QueryParametersMap101101Builder implements SetterForContext, SetterForIoutil, SetterForPipe, SetterForUrl { + private final Map instance; + public QueryParametersMap101101Builder(Map instance) { + this.instance = instance; + } + public Map getInstance() { + return instance; + } + public QueryParametersMap001101Builder getBuilderAfterContext(Map instance) { + return new QueryParametersMap001101Builder(instance); + } + public QueryParametersMap100101Builder getBuilderAfterIoutil(Map instance) { + return new QueryParametersMap100101Builder(instance); + } + public QueryParametersMap101001Builder getBuilderAfterPipe(Map instance) { + return new QueryParametersMap101001Builder(instance); + } + public QueryParametersMap101100Builder getBuilderAfterUrl(Map instance) { + return new QueryParametersMap101100Builder(instance); + } + } + + public static class QueryParametersMap101110Builder implements SetterForContext, SetterForIoutil, SetterForPipe, SetterForRefParam { + private final Map instance; + public QueryParametersMap101110Builder(Map instance) { + this.instance = instance; + } + public Map getInstance() { + return instance; + } + public QueryParametersMap001110Builder getBuilderAfterContext(Map instance) { + return new QueryParametersMap001110Builder(instance); + } + public QueryParametersMap100110Builder getBuilderAfterIoutil(Map instance) { + return new QueryParametersMap100110Builder(instance); + } + public QueryParametersMap101010Builder getBuilderAfterPipe(Map instance) { + return new QueryParametersMap101010Builder(instance); + } + public QueryParametersMap101100Builder getBuilderAfterRefParam(Map instance) { + return new QueryParametersMap101100Builder(instance); + } + } + + public static class QueryParametersMap101111Builder implements SetterForContext, SetterForIoutil, SetterForPipe, SetterForRefParam, SetterForUrl { + private final Map instance; + public QueryParametersMap101111Builder(Map instance) { + this.instance = instance; + } + public Map getInstance() { + return instance; + } + public QueryParametersMap001111Builder getBuilderAfterContext(Map instance) { + return new QueryParametersMap001111Builder(instance); + } + public QueryParametersMap100111Builder getBuilderAfterIoutil(Map instance) { + return new QueryParametersMap100111Builder(instance); + } + public QueryParametersMap101011Builder getBuilderAfterPipe(Map instance) { + return new QueryParametersMap101011Builder(instance); + } + public QueryParametersMap101101Builder getBuilderAfterRefParam(Map instance) { + return new QueryParametersMap101101Builder(instance); + } + public QueryParametersMap101110Builder getBuilderAfterUrl(Map instance) { + return new QueryParametersMap101110Builder(instance); + } + } + + public static class QueryParametersMap110000Builder implements SetterForContext, SetterForHttp { + private final Map instance; + public QueryParametersMap110000Builder(Map instance) { + this.instance = instance; + } + public Map getInstance() { + return instance; + } + public QueryParametersMap010000Builder getBuilderAfterContext(Map instance) { + return new QueryParametersMap010000Builder(instance); + } + public QueryParametersMap100000Builder getBuilderAfterHttp(Map instance) { + return new QueryParametersMap100000Builder(instance); + } + } + + public static class QueryParametersMap110001Builder implements SetterForContext, SetterForHttp, SetterForUrl { + private final Map instance; + public QueryParametersMap110001Builder(Map instance) { + this.instance = instance; + } + public Map getInstance() { + return instance; + } + public QueryParametersMap010001Builder getBuilderAfterContext(Map instance) { + return new QueryParametersMap010001Builder(instance); + } + public QueryParametersMap100001Builder getBuilderAfterHttp(Map instance) { + return new QueryParametersMap100001Builder(instance); + } + public QueryParametersMap110000Builder getBuilderAfterUrl(Map instance) { + return new QueryParametersMap110000Builder(instance); + } + } + + public static class QueryParametersMap110010Builder implements SetterForContext, SetterForHttp, SetterForRefParam { + private final Map instance; + public QueryParametersMap110010Builder(Map instance) { + this.instance = instance; + } + public Map getInstance() { + return instance; + } + public QueryParametersMap010010Builder getBuilderAfterContext(Map instance) { + return new QueryParametersMap010010Builder(instance); + } + public QueryParametersMap100010Builder getBuilderAfterHttp(Map instance) { + return new QueryParametersMap100010Builder(instance); + } + public QueryParametersMap110000Builder getBuilderAfterRefParam(Map instance) { + return new QueryParametersMap110000Builder(instance); + } + } + + public static class QueryParametersMap110011Builder implements SetterForContext, SetterForHttp, SetterForRefParam, SetterForUrl { + private final Map instance; + public QueryParametersMap110011Builder(Map instance) { + this.instance = instance; + } + public Map getInstance() { + return instance; + } + public QueryParametersMap010011Builder getBuilderAfterContext(Map instance) { + return new QueryParametersMap010011Builder(instance); + } + public QueryParametersMap100011Builder getBuilderAfterHttp(Map instance) { + return new QueryParametersMap100011Builder(instance); + } + public QueryParametersMap110001Builder getBuilderAfterRefParam(Map instance) { + return new QueryParametersMap110001Builder(instance); + } + public QueryParametersMap110010Builder getBuilderAfterUrl(Map instance) { + return new QueryParametersMap110010Builder(instance); + } + } + + public static class QueryParametersMap110100Builder implements SetterForContext, SetterForHttp, SetterForPipe { + private final Map instance; + public QueryParametersMap110100Builder(Map instance) { + this.instance = instance; + } + public Map getInstance() { + return instance; + } + public QueryParametersMap010100Builder getBuilderAfterContext(Map instance) { + return new QueryParametersMap010100Builder(instance); + } + public QueryParametersMap100100Builder getBuilderAfterHttp(Map instance) { + return new QueryParametersMap100100Builder(instance); + } + public QueryParametersMap110000Builder getBuilderAfterPipe(Map instance) { + return new QueryParametersMap110000Builder(instance); + } + } + + public static class QueryParametersMap110101Builder implements SetterForContext, SetterForHttp, SetterForPipe, SetterForUrl { + private final Map instance; + public QueryParametersMap110101Builder(Map instance) { + this.instance = instance; + } + public Map getInstance() { + return instance; + } + public QueryParametersMap010101Builder getBuilderAfterContext(Map instance) { + return new QueryParametersMap010101Builder(instance); + } + public QueryParametersMap100101Builder getBuilderAfterHttp(Map instance) { + return new QueryParametersMap100101Builder(instance); + } + public QueryParametersMap110001Builder getBuilderAfterPipe(Map instance) { + return new QueryParametersMap110001Builder(instance); + } + public QueryParametersMap110100Builder getBuilderAfterUrl(Map instance) { + return new QueryParametersMap110100Builder(instance); + } + } + + public static class QueryParametersMap110110Builder implements SetterForContext, SetterForHttp, SetterForPipe, SetterForRefParam { + private final Map instance; + public QueryParametersMap110110Builder(Map instance) { + this.instance = instance; + } + public Map getInstance() { + return instance; + } + public QueryParametersMap010110Builder getBuilderAfterContext(Map instance) { + return new QueryParametersMap010110Builder(instance); + } + public QueryParametersMap100110Builder getBuilderAfterHttp(Map instance) { + return new QueryParametersMap100110Builder(instance); + } + public QueryParametersMap110010Builder getBuilderAfterPipe(Map instance) { + return new QueryParametersMap110010Builder(instance); + } + public QueryParametersMap110100Builder getBuilderAfterRefParam(Map instance) { + return new QueryParametersMap110100Builder(instance); + } + } + + public static class QueryParametersMap110111Builder implements SetterForContext, SetterForHttp, SetterForPipe, SetterForRefParam, SetterForUrl { + private final Map instance; + public QueryParametersMap110111Builder(Map instance) { + this.instance = instance; + } + public Map getInstance() { + return instance; + } + public QueryParametersMap010111Builder getBuilderAfterContext(Map instance) { + return new QueryParametersMap010111Builder(instance); + } + public QueryParametersMap100111Builder getBuilderAfterHttp(Map instance) { + return new QueryParametersMap100111Builder(instance); + } + public QueryParametersMap110011Builder getBuilderAfterPipe(Map instance) { + return new QueryParametersMap110011Builder(instance); + } + public QueryParametersMap110101Builder getBuilderAfterRefParam(Map instance) { + return new QueryParametersMap110101Builder(instance); + } + public QueryParametersMap110110Builder getBuilderAfterUrl(Map instance) { + return new QueryParametersMap110110Builder(instance); + } + } + + public static class QueryParametersMap111000Builder implements SetterForContext, SetterForHttp, SetterForIoutil { + private final Map instance; + public QueryParametersMap111000Builder(Map instance) { + this.instance = instance; + } + public Map getInstance() { + return instance; + } + public QueryParametersMap011000Builder getBuilderAfterContext(Map instance) { + return new QueryParametersMap011000Builder(instance); + } + public QueryParametersMap101000Builder getBuilderAfterHttp(Map instance) { + return new QueryParametersMap101000Builder(instance); + } + public QueryParametersMap110000Builder getBuilderAfterIoutil(Map instance) { + return new QueryParametersMap110000Builder(instance); + } + } + + public static class QueryParametersMap111001Builder implements SetterForContext, SetterForHttp, SetterForIoutil, SetterForUrl { + private final Map instance; + public QueryParametersMap111001Builder(Map instance) { + this.instance = instance; + } + public Map getInstance() { + return instance; + } + public QueryParametersMap011001Builder getBuilderAfterContext(Map instance) { + return new QueryParametersMap011001Builder(instance); + } + public QueryParametersMap101001Builder getBuilderAfterHttp(Map instance) { + return new QueryParametersMap101001Builder(instance); + } + public QueryParametersMap110001Builder getBuilderAfterIoutil(Map instance) { + return new QueryParametersMap110001Builder(instance); + } + public QueryParametersMap111000Builder getBuilderAfterUrl(Map instance) { + return new QueryParametersMap111000Builder(instance); + } + } + + public static class QueryParametersMap111010Builder implements SetterForContext, SetterForHttp, SetterForIoutil, SetterForRefParam { + private final Map instance; + public QueryParametersMap111010Builder(Map instance) { + this.instance = instance; + } + public Map getInstance() { + return instance; + } + public QueryParametersMap011010Builder getBuilderAfterContext(Map instance) { + return new QueryParametersMap011010Builder(instance); + } + public QueryParametersMap101010Builder getBuilderAfterHttp(Map instance) { + return new QueryParametersMap101010Builder(instance); + } + public QueryParametersMap110010Builder getBuilderAfterIoutil(Map instance) { + return new QueryParametersMap110010Builder(instance); + } + public QueryParametersMap111000Builder getBuilderAfterRefParam(Map instance) { + return new QueryParametersMap111000Builder(instance); + } + } + + public static class QueryParametersMap111011Builder implements SetterForContext, SetterForHttp, SetterForIoutil, SetterForRefParam, SetterForUrl { + private final Map instance; + public QueryParametersMap111011Builder(Map instance) { + this.instance = instance; + } + public Map getInstance() { + return instance; + } + public QueryParametersMap011011Builder getBuilderAfterContext(Map instance) { + return new QueryParametersMap011011Builder(instance); + } + public QueryParametersMap101011Builder getBuilderAfterHttp(Map instance) { + return new QueryParametersMap101011Builder(instance); + } + public QueryParametersMap110011Builder getBuilderAfterIoutil(Map instance) { + return new QueryParametersMap110011Builder(instance); + } + public QueryParametersMap111001Builder getBuilderAfterRefParam(Map instance) { + return new QueryParametersMap111001Builder(instance); + } + public QueryParametersMap111010Builder getBuilderAfterUrl(Map instance) { + return new QueryParametersMap111010Builder(instance); + } + } + + public static class QueryParametersMap111100Builder implements SetterForContext, SetterForHttp, SetterForIoutil, SetterForPipe { + private final Map instance; + public QueryParametersMap111100Builder(Map instance) { + this.instance = instance; + } + public Map getInstance() { + return instance; + } + public QueryParametersMap011100Builder getBuilderAfterContext(Map instance) { + return new QueryParametersMap011100Builder(instance); + } + public QueryParametersMap101100Builder getBuilderAfterHttp(Map instance) { + return new QueryParametersMap101100Builder(instance); + } + public QueryParametersMap110100Builder getBuilderAfterIoutil(Map instance) { + return new QueryParametersMap110100Builder(instance); + } + public QueryParametersMap111000Builder getBuilderAfterPipe(Map instance) { + return new QueryParametersMap111000Builder(instance); + } + } + + public static class QueryParametersMap111101Builder implements SetterForContext, SetterForHttp, SetterForIoutil, SetterForPipe, SetterForUrl { + private final Map instance; + public QueryParametersMap111101Builder(Map instance) { + this.instance = instance; + } + public Map getInstance() { + return instance; + } + public QueryParametersMap011101Builder getBuilderAfterContext(Map instance) { + return new QueryParametersMap011101Builder(instance); + } + public QueryParametersMap101101Builder getBuilderAfterHttp(Map instance) { + return new QueryParametersMap101101Builder(instance); + } + public QueryParametersMap110101Builder getBuilderAfterIoutil(Map instance) { + return new QueryParametersMap110101Builder(instance); + } + public QueryParametersMap111001Builder getBuilderAfterPipe(Map instance) { + return new QueryParametersMap111001Builder(instance); + } + public QueryParametersMap111100Builder getBuilderAfterUrl(Map instance) { + return new QueryParametersMap111100Builder(instance); + } + } + + public static class QueryParametersMap111110Builder implements SetterForContext, SetterForHttp, SetterForIoutil, SetterForPipe, SetterForRefParam { + private final Map instance; + public QueryParametersMap111110Builder(Map instance) { + this.instance = instance; + } + public Map getInstance() { + return instance; + } + public QueryParametersMap011110Builder getBuilderAfterContext(Map instance) { + return new QueryParametersMap011110Builder(instance); + } + public QueryParametersMap101110Builder getBuilderAfterHttp(Map instance) { + return new QueryParametersMap101110Builder(instance); + } + public QueryParametersMap110110Builder getBuilderAfterIoutil(Map instance) { + return new QueryParametersMap110110Builder(instance); + } + public QueryParametersMap111010Builder getBuilderAfterPipe(Map instance) { + return new QueryParametersMap111010Builder(instance); + } + public QueryParametersMap111100Builder getBuilderAfterRefParam(Map instance) { + return new QueryParametersMap111100Builder(instance); + } + } + + public static class QueryParametersMapBuilder implements SetterForContext, SetterForHttp, SetterForIoutil, SetterForPipe, SetterForRefParam, SetterForUrl { + private final Map instance; + public QueryParametersMapBuilder() { + this.instance = new LinkedHashMap<>(); + } + public Map getInstance() { + return instance; + } + public QueryParametersMap011111Builder getBuilderAfterContext(Map instance) { + return new QueryParametersMap011111Builder(instance); + } + public QueryParametersMap101111Builder getBuilderAfterHttp(Map instance) { + return new QueryParametersMap101111Builder(instance); + } + public QueryParametersMap110111Builder getBuilderAfterIoutil(Map instance) { + return new QueryParametersMap110111Builder(instance); + } + public QueryParametersMap111011Builder getBuilderAfterPipe(Map instance) { + return new QueryParametersMap111011Builder(instance); + } + public QueryParametersMap111101Builder getBuilderAfterRefParam(Map instance) { + return new QueryParametersMap111101Builder(instance); + } + public QueryParametersMap111110Builder getBuilderAfterUrl(Map instance) { + return new QueryParametersMap111110Builder(instance); + } + } + + + public sealed interface FaketestqueryparamtersPutQueryParameters1Boxed permits FaketestqueryparamtersPutQueryParameters1BoxedMap { + @Nullable Object getData(); + } + + public record FaketestqueryparamtersPutQueryParameters1BoxedMap(QueryParametersMap data) implements FaketestqueryparamtersPutQueryParameters1Boxed { + @Override + public @Nullable Object getData() { + return data; + } + } + + + public static class FaketestqueryparamtersPutQueryParameters1 extends JsonSchema implements MapSchemaValidator { + private static @Nullable FaketestqueryparamtersPutQueryParameters1 instance = null; + + protected FaketestqueryparamtersPutQueryParameters1() { + super(new JsonSchemaInfo() + .type(Set.of(Map.class)) + .properties(Map.ofEntries( + new PropertyEntry("refParam", StringWithValidation.StringWithValidation1.class), + new PropertyEntry("ioutil", Schema1.Schema11.class), + new PropertyEntry("context", Schema4.Schema41.class), + new PropertyEntry("http", Schema2.Schema21.class), + new PropertyEntry("pipe", Schema0.Schema01.class), + new PropertyEntry("url", Schema3.Schema31.class) + )) + .required(Set.of( + "context", + "http", + "ioutil", + "pipe", + "refParam", + "url" + )) + .additionalProperties(AdditionalProperties.class) + ); + } + + public static FaketestqueryparamtersPutQueryParameters1 getInstance() { + if (instance == null) { + instance = new FaketestqueryparamtersPutQueryParameters1(); + } + return instance; + } + + 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 RuntimeException("Invalid non-string key value"); + } + String propertyName = (String) entryKey; + List propertyPathToItem = new ArrayList<>(pathToItem); + propertyPathToItem.add(propertyName); + Object value = entry.getValue(); + LinkedHashMap, Nothing?> schemas = pathToSchemas.get(propertyPathToItem); + if (schemas == null) { + throw new RuntimeException("Validation result is invalid, schemas must exist for a pathToItem"); + } + JsonSchema propertySchema = schemas.entrySet().iterator().next().getKey(); + @Nullable Object propertyInstance = propertySchema.getNewInstance(value, propertyPathToItem, pathToSchemas); + properties.put(propertyName, propertyInstance); + } + FrozenMap<@Nullable Object> castProperties = new FrozenMap<>(properties); + return new QueryParametersMap(castProperties); + } + + 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); + SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().build())); + ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, new PathToSchemasMap(), new LinkedHashSet<>()); + PathToSchemasMap pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet); + return getNewInstance(castArg, validationMetadata.pathToItem(), pathToSchemasMap); + } + + + @Override + public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws 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"); + } + @Override + public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { + if (arg instanceof Map) { + return getNewInstance((Map) arg, pathToItem, pathToSchemas); + } + throw new RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); + } + @Override + public FaketestqueryparamtersPutQueryParameters1BoxedMap validateAndBox(Map arg, SchemaConfiguration configuration) throws ValidationException { + return new FaketestqueryparamtersPutQueryParameters1BoxedMap(validate(arg, configuration)); + } + @Override + public FaketestqueryparamtersPutQueryParameters1Boxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { + 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"); + } + } + +} diff --git a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/faketestqueryparamters/put/FaketestqueryparamtersPutResponses.kt b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/faketestqueryparamters/put/FaketestqueryparamtersPutResponses.kt new file mode 100644 index 00000000000..9dcc42af24b --- /dev/null +++ b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/faketestqueryparamters/put/FaketestqueryparamtersPutResponses.kt @@ -0,0 +1,53 @@ +package org.openapijsonschematools.client.paths.faketestqueryparamters.put; + +import org.openapijsonschematools.client.paths.faketestqueryparamters.put.responses.FaketestqueryparamtersPutCode200Response; +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; +import org.checkerframework.checker.nullness.qual.Nullable; + +import java.net.http.HttpResponse; +import java.util.Map; +import java.util.AbstractMap; + +public class FaketestqueryparamtersPutResponses { + public sealed interface EndpointResponse permits EndpointFaketestqueryparamtersPutCode200Response {} + + public record EndpointFaketestqueryparamtersPutCode200Response( + HttpResponse response, + Nothing? body, + Nothing? headers + ) implements EndpointResponse, ApiResponse{ + } + + public sealed interface StatusCodeResponseDeserializer permits StatusFaketestqueryparamtersPutCode200ResponseDeserializer {} + + public static final class StatusFaketestqueryparamtersPutCode200ResponseDeserializer extends FaketestqueryparamtersPutCode200Response.FaketestqueryparamtersPutCode200Response1 implements StatusCodeResponseDeserializer { + } + + public static final class FaketestqueryparamtersPutResponses1 implements ResponsesDeserializer { + private final Map statusCodeToResponseDeserializer; + public FaketestqueryparamtersPutResponses1() { + this.statusCodeToResponseDeserializer = Map.ofEntries( + new AbstractMap.SimpleEntry<>("200", new StatusFaketestqueryparamtersPutCode200ResponseDeserializer()) + ); + } + + 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) { + throw new ApiException( + "Invalid response statusCode="+statusCode+" has no response defined in the openapi document", + response + ); + } + StatusFaketestqueryparamtersPutCode200ResponseDeserializer castDeserializer = (StatusFaketestqueryparamtersPutCode200ResponseDeserializer) statusCodeDeserializer; + var deserializedResponse = castDeserializer.deserialize(response, configuration); + return new EndpointFaketestqueryparamtersPutCode200Response(response, deserializedResponse.body(), deserializedResponse.headers()); + } + } +} diff --git a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/faketestqueryparamters/put/Parameters.kt b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/faketestqueryparamters/put/Parameters.kt new file mode 100644 index 00000000000..447f578a330 --- /dev/null +++ b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/faketestqueryparamters/put/Parameters.kt @@ -0,0 +1,30 @@ +package org.openapijsonschematools.client.paths.faketestqueryparamters.put; + +import org.openapijsonschematools.client.paths.faketestqueryparamters.put.parameters.Parameter0; +import org.openapijsonschematools.client.paths.faketestqueryparamters.put.parameters.Parameter1; +import org.openapijsonschematools.client.paths.faketestqueryparamters.put.parameters.Parameter2; +import org.openapijsonschematools.client.paths.faketestqueryparamters.put.parameters.Parameter3; +import org.openapijsonschematools.client.paths.faketestqueryparamters.put.parameters.Parameter4; +import org.openapijsonschematools.client.paths.faketestqueryparamters.put.parameters.Parameter5; +import org.openapijsonschematools.client.parameter.QuerySerializer; + +import java.util.Map; +import java.util.AbstractMap; + +public class Parameters { + + public static class QueryParametersSerializer extends QuerySerializer { + public QueryParametersSerializer() { + super( + Map.ofEntries( + new AbstractMap.SimpleEntry<>("pipe", new Parameter0.Parameter01()), + new AbstractMap.SimpleEntry<>("ioutil", new Parameter1.Parameter11()), + new AbstractMap.SimpleEntry<>("http", new Parameter2.Parameter21()), + new AbstractMap.SimpleEntry<>("url", new Parameter3.Parameter31()), + new AbstractMap.SimpleEntry<>("context", new Parameter4.Parameter41()), + new AbstractMap.SimpleEntry<>("refParam", new Parameter5.Parameter51()) + ) + ); + } + } +} diff --git a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/faketestqueryparamters/put/parameters/Parameter0.kt b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/faketestqueryparamters/put/parameters/Parameter0.kt new file mode 100644 index 00000000000..fb818182444 --- /dev/null +++ b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/faketestqueryparamters/put/parameters/Parameter0.kt @@ -0,0 +1,23 @@ +package org.openapijsonschematools.client.paths.faketestqueryparamters.put.parameters; + +import org.openapijsonschematools.client.parameter.ParameterStyle; +import org.openapijsonschematools.client.parameter.ParameterInType; +import org.openapijsonschematools.client.parameter.SchemaParameter; +import org.openapijsonschematools.client.paths.faketestqueryparamters.put.parameters.parameter0.Schema0; + +public class Parameter0 { + + public static class Parameter01 extends SchemaParameter { + public Parameter01() { + super( + "pipe", + ParameterInType.QUERY, + true, + ParameterStyle.FORM, + true, + false, + Schema0.Schema01.getInstance() + ); + } + } +} diff --git a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/faketestqueryparamters/put/parameters/Parameter1.kt b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/faketestqueryparamters/put/parameters/Parameter1.kt new file mode 100644 index 00000000000..c835f8982f0 --- /dev/null +++ b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/faketestqueryparamters/put/parameters/Parameter1.kt @@ -0,0 +1,23 @@ +package org.openapijsonschematools.client.paths.faketestqueryparamters.put.parameters; + +import org.openapijsonschematools.client.parameter.ParameterStyle; +import org.openapijsonschematools.client.parameter.ParameterInType; +import org.openapijsonschematools.client.parameter.SchemaParameter; +import org.openapijsonschematools.client.paths.faketestqueryparamters.put.parameters.parameter1.Schema1; + +public class Parameter1 { + + public static class Parameter11 extends SchemaParameter { + public Parameter11() { + super( + "ioutil", + ParameterInType.QUERY, + true, + ParameterStyle.FORM, + false, + false, + Schema1.Schema11.getInstance() + ); + } + } +} diff --git a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/faketestqueryparamters/put/parameters/Parameter2.kt b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/faketestqueryparamters/put/parameters/Parameter2.kt new file mode 100644 index 00000000000..a4718b73134 --- /dev/null +++ b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/faketestqueryparamters/put/parameters/Parameter2.kt @@ -0,0 +1,23 @@ +package org.openapijsonschematools.client.paths.faketestqueryparamters.put.parameters; + +import org.openapijsonschematools.client.parameter.ParameterStyle; +import org.openapijsonschematools.client.parameter.ParameterInType; +import org.openapijsonschematools.client.parameter.SchemaParameter; +import org.openapijsonschematools.client.paths.faketestqueryparamters.put.parameters.parameter2.Schema2; + +public class Parameter2 { + + public static class Parameter21 extends SchemaParameter { + public Parameter21() { + super( + "http", + ParameterInType.QUERY, + true, + ParameterStyle.SPACE_DELIMITED, + false, + false, + Schema2.Schema21.getInstance() + ); + } + } +} diff --git a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/faketestqueryparamters/put/parameters/Parameter3.kt b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/faketestqueryparamters/put/parameters/Parameter3.kt new file mode 100644 index 00000000000..243be0b3e0f --- /dev/null +++ b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/faketestqueryparamters/put/parameters/Parameter3.kt @@ -0,0 +1,23 @@ +package org.openapijsonschematools.client.paths.faketestqueryparamters.put.parameters; + +import org.openapijsonschematools.client.parameter.ParameterStyle; +import org.openapijsonschematools.client.parameter.ParameterInType; +import org.openapijsonschematools.client.parameter.SchemaParameter; +import org.openapijsonschematools.client.paths.faketestqueryparamters.put.parameters.parameter3.Schema3; + +public class Parameter3 { + + public static class Parameter31 extends SchemaParameter { + public Parameter31() { + super( + "url", + ParameterInType.QUERY, + true, + ParameterStyle.FORM, + false, + false, + Schema3.Schema31.getInstance() + ); + } + } +} diff --git a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/faketestqueryparamters/put/parameters/Parameter4.kt b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/faketestqueryparamters/put/parameters/Parameter4.kt new file mode 100644 index 00000000000..449ae175083 --- /dev/null +++ b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/faketestqueryparamters/put/parameters/Parameter4.kt @@ -0,0 +1,23 @@ +package org.openapijsonschematools.client.paths.faketestqueryparamters.put.parameters; + +import org.openapijsonschematools.client.parameter.ParameterStyle; +import org.openapijsonschematools.client.parameter.ParameterInType; +import org.openapijsonschematools.client.parameter.SchemaParameter; +import org.openapijsonschematools.client.paths.faketestqueryparamters.put.parameters.parameter4.Schema4; + +public class Parameter4 { + + public static class Parameter41 extends SchemaParameter { + public Parameter41() { + super( + "context", + ParameterInType.QUERY, + true, + ParameterStyle.FORM, + true, + false, + Schema4.Schema41.getInstance() + ); + } + } +} diff --git a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/faketestqueryparamters/put/parameters/Parameter5.kt b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/faketestqueryparamters/put/parameters/Parameter5.kt new file mode 100644 index 00000000000..1575ac4c084 --- /dev/null +++ b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/faketestqueryparamters/put/parameters/Parameter5.kt @@ -0,0 +1,23 @@ +package org.openapijsonschematools.client.paths.faketestqueryparamters.put.parameters; + +import org.openapijsonschematools.client.parameter.ParameterStyle; +import org.openapijsonschematools.client.parameter.ParameterInType; +import org.openapijsonschematools.client.parameter.SchemaParameter; +import org.openapijsonschematools.client.paths.faketestqueryparamters.put.parameters.parameter5.Schema5; + +public class Parameter5 { + + public static class Parameter51 extends SchemaParameter { + public Parameter51() { + super( + "refParam", + ParameterInType.QUERY, + true, + ParameterStyle.FORM, + true, + false, + Schema5.Schema51.getInstance() + ); + } + } +} diff --git a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/faketestqueryparamters/put/parameters/parameter0/Schema0.kt b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/faketestqueryparamters/put/parameters/parameter0/Schema0.kt new file mode 100644 index 00000000000..035a7ed35a6 --- /dev/null +++ b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/faketestqueryparamters/put/parameters/parameter0/Schema0.kt @@ -0,0 +1,157 @@ +package org.openapijsonschematools.client.paths.faketestqueryparamters.put.parameters.parameter0; +import java.util.ArrayList; +import java.util.HashSet; +import java.util.LinkedHashMap; +import java.util.LinkedHashSet; +import java.util.List; +import java.util.Objects; +import java.util.Set; +import org.checkerframework.checker.nullness.qual.Nullable; +import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags; +import org.openapijsonschematools.client.configurations.SchemaConfiguration; +import org.openapijsonschematools.client.exceptions.ValidationException; +import org.openapijsonschematools.client.schemas.StringJsonSchema; +import org.openapijsonschematools.client.schemas.validation.FrozenList; +import org.openapijsonschematools.client.schemas.validation.JsonSchema; +import org.openapijsonschematools.client.schemas.validation.JsonSchemaInfo; +import org.openapijsonschematools.client.schemas.validation.ListSchemaValidator; +import org.openapijsonschematools.client.schemas.validation.PathToSchemasMap; +import org.openapijsonschematools.client.schemas.validation.ValidationMetadata; + +public class Schema0 { + // nest classes so all schemas and input/output classes can be public + + + public static class Items0 extends StringJsonSchema.StringJsonSchema1 { + private static @Nullable Items0 instance = null; + public static Items0 getInstance() { + if (instance == null) { + instance = new Items0(); + } + return instance; + } + } + + + public static class SchemaList0 extends FrozenList { + protected SchemaList0(FrozenList m) { + super(m); + } + public static SchemaList0 of(List arg, SchemaConfiguration configuration) throws ValidationException { + return Schema01.getInstance().validate(arg, configuration); + } + } + + public static class SchemaListBuilder0 { + // class to build List + private final List list; + + public SchemaListBuilder0() { + list = new ArrayList<>(); + } + + public SchemaListBuilder0(List list) { + this.list = list; + } + + public SchemaListBuilder0 add(String item) { + list.add(item); + return this; + } + + public List build() { + return list; + } + } + + + public sealed interface Schema01Boxed permits Schema01BoxedList { + @Nullable Object getData(); + } + + public record Schema01BoxedList(SchemaList0 data) implements Schema01Boxed { + @Override + public @Nullable Object getData() { + return data; + } + } + + + + public static class Schema01 extends JsonSchema implements ListSchemaValidator { + private static @Nullable Schema01 instance = null; + + protected Schema01() { + super(new JsonSchemaInfo() + .type(Set.of(List.class)) + .items(Items0.class) + ); + } + + public static Schema01 getInstance() { + if (instance == null) { + instance = new Schema01(); + } + return instance; + } + + @Override + public SchemaList0 getNewInstance(List arg, List pathToItem, PathToSchemasMap pathToSchemas) { + List items = new ArrayList<>(); + int i = 0; + for (Object item: arg) { + List itemPathToItem = new ArrayList<>(pathToItem); + itemPathToItem.add(i); + LinkedHashMap, Nothing?> schemas = pathToSchemas.get(itemPathToItem); + if (schemas == null) { + throw new RuntimeException("Validation 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"); + } + items.add((String) itemInstance); + i += 1; + } + FrozenList newInstanceItems = new FrozenList<>(items); + return new SchemaList0(newInstanceItems); + } + + 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); + SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().build())); + ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, new PathToSchemasMap(), new LinkedHashSet<>()); + PathToSchemasMap pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet); + return getNewInstance(castArg, validationMetadata.pathToItem(), pathToSchemasMap); + } + + @Override + public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws 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"); + } + @Override + public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { + 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"); + } + @Override + 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 { + 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"); + } + } +} diff --git a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/faketestqueryparamters/put/parameters/parameter1/Schema1.kt b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/faketestqueryparamters/put/parameters/parameter1/Schema1.kt new file mode 100644 index 00000000000..0855dc90fb5 --- /dev/null +++ b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/faketestqueryparamters/put/parameters/parameter1/Schema1.kt @@ -0,0 +1,157 @@ +package org.openapijsonschematools.client.paths.faketestqueryparamters.put.parameters.parameter1; +import java.util.ArrayList; +import java.util.HashSet; +import java.util.LinkedHashMap; +import java.util.LinkedHashSet; +import java.util.List; +import java.util.Objects; +import java.util.Set; +import org.checkerframework.checker.nullness.qual.Nullable; +import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags; +import org.openapijsonschematools.client.configurations.SchemaConfiguration; +import org.openapijsonschematools.client.exceptions.ValidationException; +import org.openapijsonschematools.client.schemas.StringJsonSchema; +import org.openapijsonschematools.client.schemas.validation.FrozenList; +import org.openapijsonschematools.client.schemas.validation.JsonSchema; +import org.openapijsonschematools.client.schemas.validation.JsonSchemaInfo; +import org.openapijsonschematools.client.schemas.validation.ListSchemaValidator; +import org.openapijsonschematools.client.schemas.validation.PathToSchemasMap; +import org.openapijsonschematools.client.schemas.validation.ValidationMetadata; + +public class Schema1 { + // nest classes so all schemas and input/output classes can be public + + + public static class Items1 extends StringJsonSchema.StringJsonSchema1 { + private static @Nullable Items1 instance = null; + public static Items1 getInstance() { + if (instance == null) { + instance = new Items1(); + } + return instance; + } + } + + + public static class SchemaList1 extends FrozenList { + protected SchemaList1(FrozenList m) { + super(m); + } + public static SchemaList1 of(List arg, SchemaConfiguration configuration) throws ValidationException { + return Schema11.getInstance().validate(arg, configuration); + } + } + + public static class SchemaListBuilder1 { + // class to build List + private final List list; + + public SchemaListBuilder1() { + list = new ArrayList<>(); + } + + public SchemaListBuilder1(List list) { + this.list = list; + } + + public SchemaListBuilder1 add(String item) { + list.add(item); + return this; + } + + public List build() { + return list; + } + } + + + public sealed interface Schema11Boxed permits Schema11BoxedList { + @Nullable Object getData(); + } + + public record Schema11BoxedList(SchemaList1 data) implements Schema11Boxed { + @Override + public @Nullable Object getData() { + return data; + } + } + + + + public static class Schema11 extends JsonSchema implements ListSchemaValidator { + private static @Nullable Schema11 instance = null; + + protected Schema11() { + super(new JsonSchemaInfo() + .type(Set.of(List.class)) + .items(Items1.class) + ); + } + + public static Schema11 getInstance() { + if (instance == null) { + instance = new Schema11(); + } + return instance; + } + + @Override + public SchemaList1 getNewInstance(List arg, List pathToItem, PathToSchemasMap pathToSchemas) { + List items = new ArrayList<>(); + int i = 0; + for (Object item: arg) { + List itemPathToItem = new ArrayList<>(pathToItem); + itemPathToItem.add(i); + LinkedHashMap, Nothing?> schemas = pathToSchemas.get(itemPathToItem); + if (schemas == null) { + throw new RuntimeException("Validation 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"); + } + items.add((String) itemInstance); + i += 1; + } + FrozenList newInstanceItems = new FrozenList<>(items); + return new SchemaList1(newInstanceItems); + } + + 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); + SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().build())); + ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, new PathToSchemasMap(), new LinkedHashSet<>()); + PathToSchemasMap pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet); + return getNewInstance(castArg, validationMetadata.pathToItem(), pathToSchemasMap); + } + + @Override + public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws 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"); + } + @Override + public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { + 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"); + } + @Override + 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 { + 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"); + } + } +} diff --git a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/faketestqueryparamters/put/parameters/parameter2/Schema2.kt b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/faketestqueryparamters/put/parameters/parameter2/Schema2.kt new file mode 100644 index 00000000000..8eb3b72309e --- /dev/null +++ b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/faketestqueryparamters/put/parameters/parameter2/Schema2.kt @@ -0,0 +1,157 @@ +package org.openapijsonschematools.client.paths.faketestqueryparamters.put.parameters.parameter2; +import java.util.ArrayList; +import java.util.HashSet; +import java.util.LinkedHashMap; +import java.util.LinkedHashSet; +import java.util.List; +import java.util.Objects; +import java.util.Set; +import org.checkerframework.checker.nullness.qual.Nullable; +import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags; +import org.openapijsonschematools.client.configurations.SchemaConfiguration; +import org.openapijsonschematools.client.exceptions.ValidationException; +import org.openapijsonschematools.client.schemas.StringJsonSchema; +import org.openapijsonschematools.client.schemas.validation.FrozenList; +import org.openapijsonschematools.client.schemas.validation.JsonSchema; +import org.openapijsonschematools.client.schemas.validation.JsonSchemaInfo; +import org.openapijsonschematools.client.schemas.validation.ListSchemaValidator; +import org.openapijsonschematools.client.schemas.validation.PathToSchemasMap; +import org.openapijsonschematools.client.schemas.validation.ValidationMetadata; + +public class Schema2 { + // nest classes so all schemas and input/output classes can be public + + + public static class Items2 extends StringJsonSchema.StringJsonSchema1 { + private static @Nullable Items2 instance = null; + public static Items2 getInstance() { + if (instance == null) { + instance = new Items2(); + } + return instance; + } + } + + + public static class SchemaList2 extends FrozenList { + protected SchemaList2(FrozenList m) { + super(m); + } + public static SchemaList2 of(List arg, SchemaConfiguration configuration) throws ValidationException { + return Schema21.getInstance().validate(arg, configuration); + } + } + + public static class SchemaListBuilder2 { + // class to build List + private final List list; + + public SchemaListBuilder2() { + list = new ArrayList<>(); + } + + public SchemaListBuilder2(List list) { + this.list = list; + } + + public SchemaListBuilder2 add(String item) { + list.add(item); + return this; + } + + public List build() { + return list; + } + } + + + public sealed interface Schema21Boxed permits Schema21BoxedList { + @Nullable Object getData(); + } + + public record Schema21BoxedList(SchemaList2 data) implements Schema21Boxed { + @Override + public @Nullable Object getData() { + return data; + } + } + + + + public static class Schema21 extends JsonSchema implements ListSchemaValidator { + private static @Nullable Schema21 instance = null; + + protected Schema21() { + super(new JsonSchemaInfo() + .type(Set.of(List.class)) + .items(Items2.class) + ); + } + + public static Schema21 getInstance() { + if (instance == null) { + instance = new Schema21(); + } + return instance; + } + + @Override + public SchemaList2 getNewInstance(List arg, List pathToItem, PathToSchemasMap pathToSchemas) { + List items = new ArrayList<>(); + int i = 0; + for (Object item: arg) { + List itemPathToItem = new ArrayList<>(pathToItem); + itemPathToItem.add(i); + LinkedHashMap, Nothing?> schemas = pathToSchemas.get(itemPathToItem); + if (schemas == null) { + throw new RuntimeException("Validation 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"); + } + items.add((String) itemInstance); + i += 1; + } + FrozenList newInstanceItems = new FrozenList<>(items); + return new SchemaList2(newInstanceItems); + } + + 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); + SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().build())); + ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, new PathToSchemasMap(), new LinkedHashSet<>()); + PathToSchemasMap pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet); + return getNewInstance(castArg, validationMetadata.pathToItem(), pathToSchemasMap); + } + + @Override + public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws 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"); + } + @Override + public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { + 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"); + } + @Override + 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 { + 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"); + } + } +} diff --git a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/faketestqueryparamters/put/parameters/parameter3/Schema3.kt b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/faketestqueryparamters/put/parameters/parameter3/Schema3.kt new file mode 100644 index 00000000000..83206f47e29 --- /dev/null +++ b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/faketestqueryparamters/put/parameters/parameter3/Schema3.kt @@ -0,0 +1,157 @@ +package org.openapijsonschematools.client.paths.faketestqueryparamters.put.parameters.parameter3; +import java.util.ArrayList; +import java.util.HashSet; +import java.util.LinkedHashMap; +import java.util.LinkedHashSet; +import java.util.List; +import java.util.Objects; +import java.util.Set; +import org.checkerframework.checker.nullness.qual.Nullable; +import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags; +import org.openapijsonschematools.client.configurations.SchemaConfiguration; +import org.openapijsonschematools.client.exceptions.ValidationException; +import org.openapijsonschematools.client.schemas.StringJsonSchema; +import org.openapijsonschematools.client.schemas.validation.FrozenList; +import org.openapijsonschematools.client.schemas.validation.JsonSchema; +import org.openapijsonschematools.client.schemas.validation.JsonSchemaInfo; +import org.openapijsonschematools.client.schemas.validation.ListSchemaValidator; +import org.openapijsonschematools.client.schemas.validation.PathToSchemasMap; +import org.openapijsonschematools.client.schemas.validation.ValidationMetadata; + +public class Schema3 { + // nest classes so all schemas and input/output classes can be public + + + public static class Items3 extends StringJsonSchema.StringJsonSchema1 { + private static @Nullable Items3 instance = null; + public static Items3 getInstance() { + if (instance == null) { + instance = new Items3(); + } + return instance; + } + } + + + public static class SchemaList3 extends FrozenList { + protected SchemaList3(FrozenList m) { + super(m); + } + public static SchemaList3 of(List arg, SchemaConfiguration configuration) throws ValidationException { + return Schema31.getInstance().validate(arg, configuration); + } + } + + public static class SchemaListBuilder3 { + // class to build List + private final List list; + + public SchemaListBuilder3() { + list = new ArrayList<>(); + } + + public SchemaListBuilder3(List list) { + this.list = list; + } + + public SchemaListBuilder3 add(String item) { + list.add(item); + return this; + } + + public List build() { + return list; + } + } + + + public sealed interface Schema31Boxed permits Schema31BoxedList { + @Nullable Object getData(); + } + + public record Schema31BoxedList(SchemaList3 data) implements Schema31Boxed { + @Override + public @Nullable Object getData() { + return data; + } + } + + + + public static class Schema31 extends JsonSchema implements ListSchemaValidator { + private static @Nullable Schema31 instance = null; + + protected Schema31() { + super(new JsonSchemaInfo() + .type(Set.of(List.class)) + .items(Items3.class) + ); + } + + public static Schema31 getInstance() { + if (instance == null) { + instance = new Schema31(); + } + return instance; + } + + @Override + public SchemaList3 getNewInstance(List arg, List pathToItem, PathToSchemasMap pathToSchemas) { + List items = new ArrayList<>(); + int i = 0; + for (Object item: arg) { + List itemPathToItem = new ArrayList<>(pathToItem); + itemPathToItem.add(i); + LinkedHashMap, Nothing?> schemas = pathToSchemas.get(itemPathToItem); + if (schemas == null) { + throw new RuntimeException("Validation 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"); + } + items.add((String) itemInstance); + i += 1; + } + FrozenList newInstanceItems = new FrozenList<>(items); + return new SchemaList3(newInstanceItems); + } + + 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); + SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().build())); + ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, new PathToSchemasMap(), new LinkedHashSet<>()); + PathToSchemasMap pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet); + return getNewInstance(castArg, validationMetadata.pathToItem(), pathToSchemasMap); + } + + @Override + public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws 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"); + } + @Override + public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { + 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"); + } + @Override + 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 { + 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"); + } + } +} diff --git a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/faketestqueryparamters/put/parameters/parameter4/Schema4.kt b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/faketestqueryparamters/put/parameters/parameter4/Schema4.kt new file mode 100644 index 00000000000..24ccc3af5ab --- /dev/null +++ b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/faketestqueryparamters/put/parameters/parameter4/Schema4.kt @@ -0,0 +1,157 @@ +package org.openapijsonschematools.client.paths.faketestqueryparamters.put.parameters.parameter4; +import java.util.ArrayList; +import java.util.HashSet; +import java.util.LinkedHashMap; +import java.util.LinkedHashSet; +import java.util.List; +import java.util.Objects; +import java.util.Set; +import org.checkerframework.checker.nullness.qual.Nullable; +import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags; +import org.openapijsonschematools.client.configurations.SchemaConfiguration; +import org.openapijsonschematools.client.exceptions.ValidationException; +import org.openapijsonschematools.client.schemas.StringJsonSchema; +import org.openapijsonschematools.client.schemas.validation.FrozenList; +import org.openapijsonschematools.client.schemas.validation.JsonSchema; +import org.openapijsonschematools.client.schemas.validation.JsonSchemaInfo; +import org.openapijsonschematools.client.schemas.validation.ListSchemaValidator; +import org.openapijsonschematools.client.schemas.validation.PathToSchemasMap; +import org.openapijsonschematools.client.schemas.validation.ValidationMetadata; + +public class Schema4 { + // nest classes so all schemas and input/output classes can be public + + + public static class Items4 extends StringJsonSchema.StringJsonSchema1 { + private static @Nullable Items4 instance = null; + public static Items4 getInstance() { + if (instance == null) { + instance = new Items4(); + } + return instance; + } + } + + + public static class SchemaList4 extends FrozenList { + protected SchemaList4(FrozenList m) { + super(m); + } + public static SchemaList4 of(List arg, SchemaConfiguration configuration) throws ValidationException { + return Schema41.getInstance().validate(arg, configuration); + } + } + + public static class SchemaListBuilder4 { + // class to build List + private final List list; + + public SchemaListBuilder4() { + list = new ArrayList<>(); + } + + public SchemaListBuilder4(List list) { + this.list = list; + } + + public SchemaListBuilder4 add(String item) { + list.add(item); + return this; + } + + public List build() { + return list; + } + } + + + public sealed interface Schema41Boxed permits Schema41BoxedList { + @Nullable Object getData(); + } + + public record Schema41BoxedList(SchemaList4 data) implements Schema41Boxed { + @Override + public @Nullable Object getData() { + return data; + } + } + + + + public static class Schema41 extends JsonSchema implements ListSchemaValidator { + private static @Nullable Schema41 instance = null; + + protected Schema41() { + super(new JsonSchemaInfo() + .type(Set.of(List.class)) + .items(Items4.class) + ); + } + + public static Schema41 getInstance() { + if (instance == null) { + instance = new Schema41(); + } + return instance; + } + + @Override + public SchemaList4 getNewInstance(List arg, List pathToItem, PathToSchemasMap pathToSchemas) { + List items = new ArrayList<>(); + int i = 0; + for (Object item: arg) { + List itemPathToItem = new ArrayList<>(pathToItem); + itemPathToItem.add(i); + LinkedHashMap, Nothing?> schemas = pathToSchemas.get(itemPathToItem); + if (schemas == null) { + throw new RuntimeException("Validation 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"); + } + items.add((String) itemInstance); + i += 1; + } + FrozenList newInstanceItems = new FrozenList<>(items); + return new SchemaList4(newInstanceItems); + } + + 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); + SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().build())); + ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, new PathToSchemasMap(), new LinkedHashSet<>()); + PathToSchemasMap pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet); + return getNewInstance(castArg, validationMetadata.pathToItem(), pathToSchemasMap); + } + + @Override + public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws 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"); + } + @Override + public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { + 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"); + } + @Override + 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 { + 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"); + } + } +} diff --git a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/faketestqueryparamters/put/parameters/parameter5/Schema5.kt b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/faketestqueryparamters/put/parameters/parameter5/Schema5.kt new file mode 100644 index 00000000000..a2af162b5a6 --- /dev/null +++ b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/faketestqueryparamters/put/parameters/parameter5/Schema5.kt @@ -0,0 +1,19 @@ +package org.openapijsonschematools.client.paths.faketestqueryparamters.put.parameters.parameter5; + +import org.checkerframework.checker.nullness.qual.Nullable; +import org.openapijsonschematools.client.components.schemas.StringWithValidation; + +public class Schema5 extends StringWithValidation { + // $refed class + + + public static class Schema51 extends StringWithValidation1 { + private static @Nullable Schema51 instance = null; + public static Schema51 getInstance() { + if (instance == null) { + instance = new Schema51(); + } + return instance; + } + } +} diff --git a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/faketestqueryparamters/put/responses/FaketestqueryparamtersPutCode200Response.kt b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/faketestqueryparamters/put/responses/FaketestqueryparamtersPutCode200Response.kt new file mode 100644 index 00000000000..180a1f4d934 --- /dev/null +++ b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/faketestqueryparamters/put/responses/FaketestqueryparamtersPutCode200Response.kt @@ -0,0 +1,7 @@ +package org.openapijsonschematools.client.paths.faketestqueryparamters.put.responses; + +import org.openapijsonschematools.client.components.responses.SuccessDescriptionOnly; + +public class FaketestqueryparamtersPutCode200Response extends SuccessDescriptionOnly { + public static class FaketestqueryparamtersPutCode200Response1 extends SuccessDescriptionOnly1 {} +} diff --git a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/fakeuploaddownloadfile/FakeuploaddownloadfilePost.kt b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/fakeuploaddownloadfile/FakeuploaddownloadfilePost.kt new file mode 100644 index 00000000000..40b05b37b3a --- /dev/null +++ b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/fakeuploaddownloadfile/FakeuploaddownloadfilePost.kt @@ -0,0 +1,183 @@ +package org.openapijsonschematools.client.paths.fakeuploaddownloadfile; + +import org.checkerframework.checker.nullness.qual.Nullable; +import org.openapijsonschematools.client.RootServerInfo; +import org.openapijsonschematools.client.paths.fakeuploaddownloadfile.post.FakeuploaddownloadfilePostRequestBody; +import org.openapijsonschematools.client.paths.fakeuploaddownloadfile.post.FakeuploaddownloadfilePostResponses; +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.requestbody.SerializedRequestBody; +import org.openapijsonschematools.client.paths.Fakeuploaddownloadfile; + +import java.io.IOException; +import java.util.ArrayList; +import java.net.http.HttpClient; +import java.net.http.HttpRequest; +import java.time.Duration; +import java.util.List; +import java.util.Map; + +public class FakeuploaddownloadfilePost { + private static class PostProvider { + private static final String method = "post"; + + public static FakeuploaddownloadfilePostResponses.EndpointResponse post( + PostRequest request, + ApiConfiguration apiConfiguration, + SchemaConfiguration schemaConfiguration, + HttpClient client + ) throws IOException, InterruptedException, ValidationException, NotImplementedException, ApiException { + Map> headers = apiConfiguration.getDefaultHeaders(); + + SerializedRequestBody serializedRequestBody = new FakeuploaddownloadfilePostRequestBody.FakeuploaddownloadfilePostRequestBody1().serialize( + request.requestBody + ); + var contentTypeHeaderValues = headers.getOrDefault("Content-Type", new ArrayList<>()); + contentTypeHeaderValues.add(serializedRequestBody.contentType); + HttpRequest.BodyPublisher bodyPublisher = serializedRequestBody.bodyPublisher; + // TODO set this to a map if there is a query security scheme + @Nullable Map queryMap = null; + String host = apiConfiguration.getServer(request.serverIndex).url(); + + String url = host + Fakeuploaddownloadfile.path; + var httpRequest = RestClient.getRequest( + url, + method, + bodyPublisher, + headers, + request.timeout + ); + var response = RestClient.getResponse(httpRequest, client); + var responsesDeserializer = new FakeuploaddownloadfilePostResponses.FakeuploaddownloadfilePostResponses1(); + return responsesDeserializer.deserialize(response, schemaConfiguration); + } + } + + public interface PostOperation { + ApiConfiguration getApiConfiguration(); + SchemaConfiguration getSchemaConfiguration(); + HttpClient getClient(); + default FakeuploaddownloadfilePostResponses.EndpointResponse post(PostRequest request) throws IOException, InterruptedException, ValidationException, NotImplementedException, ApiException { + return PostProvider.post(request, getApiConfiguration(), getSchemaConfiguration(), getClient()); + } + } + + public interface UploadDownloadFileOperation { + ApiConfiguration getApiConfiguration(); + SchemaConfiguration getSchemaConfiguration(); + HttpClient getClient(); + default FakeuploaddownloadfilePostResponses.EndpointResponse uploadDownloadFile(PostRequest request) throws IOException, InterruptedException, ValidationException, NotImplementedException, ApiException { + return PostProvider.post(request, getApiConfiguration(), getSchemaConfiguration(), getClient()); + } + } + + public static class Post extends ApiClient implements PostOperation { + public Post(ApiConfiguration apiConfiguration, SchemaConfiguration schemaConfiguration) { + super(apiConfiguration, schemaConfiguration); + } + } + + public static class PostRequest { + public FakeuploaddownloadfilePostRequestBody.SealedRequestBody requestBody; + public RootServerInfo.@Nullable ServerIndex serverIndex; + public @Nullable Duration timeout; + + public PostRequest( + FakeuploaddownloadfilePostRequestBody.SealedRequestBody requestBody, + RootServerInfo.@Nullable ServerIndex serverIndex, + @Nullable Duration timeout + ) { + this.requestBody = requestBody; + this.serverIndex = serverIndex; + this.timeout = timeout; + } + } + + public static class PostNullableRequest { + public FakeuploaddownloadfilePostRequestBody.@Nullable SealedRequestBody requestBody; + public RootServerInfo.@Nullable ServerIndex serverIndex; + public @Nullable Duration timeout; + } + + public interface SetterForServerIndex { + PostNullableRequest getInstance(); + T getBuilderAfterServerIndex(PostNullableRequest instance); + default T serverIndex(RootServerInfo.ServerIndex serverIndex) { + var instance = getInstance(); + instance.serverIndex = serverIndex; + return getBuilderAfterServerIndex(instance); + } + } + + public interface SetterForTimeout { + PostNullableRequest getInstance(); + T getBuilderAfterTimeout(PostNullableRequest instance); + default T timeout(Duration timeout) { + var instance = getInstance(); + instance.timeout = timeout; + return getBuilderAfterTimeout(instance); + } + } + + public interface SetterForRequestBody { + PostNullableRequest getInstance(); + T getBuilderAfterRequestBody(PostNullableRequest instance); + default T requestBody(FakeuploaddownloadfilePostRequestBody.SealedRequestBody requestBody) { + var instance = getInstance(); + instance.requestBody = requestBody; + return getBuilderAfterRequestBody(instance); + } + } + + public static class Post0RequestBuilder implements SetterForServerIndex, SetterForTimeout { + private final PostNullableRequest instance; + + public Post0RequestBuilder(PostNullableRequest instance) { + this.instance = instance; + } + + public PostRequest build() { + var requestBody = instance.requestBody; + if (requestBody == null) { + throw new RuntimeException("invalid null value for required parameter"); + } + return new PostRequest( + requestBody, + instance.serverIndex, + instance.timeout + ); + } + + public PostNullableRequest getInstance() { + return instance; + } + + public Post0RequestBuilder getBuilderAfterServerIndex(PostNullableRequest instance) { + return this; + } + + public Post0RequestBuilder getBuilderAfterTimeout(PostNullableRequest instance) { + return this; + } + } + public static class PostRequestBuilder implements SetterForRequestBody { + private final PostNullableRequest instance; + + public PostRequestBuilder() { + this.instance = new PostNullableRequest(); + } + + public PostNullableRequest getInstance() { + return instance; + } + + public Post0RequestBuilder getBuilderAfterRequestBody(PostNullableRequest instance) { + return new Post0RequestBuilder(instance); + } + } +} diff --git a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/fakeuploaddownloadfile/post/FakeuploaddownloadfilePostRequestBody.kt b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/fakeuploaddownloadfile/post/FakeuploaddownloadfilePostRequestBody.kt new file mode 100644 index 00000000000..d54f6dffe6b --- /dev/null +++ b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/fakeuploaddownloadfile/post/FakeuploaddownloadfilePostRequestBody.kt @@ -0,0 +1,49 @@ +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; +import org.openapijsonschematools.client.mediatype.MediaType; +import org.openapijsonschematools.client.paths.fakeuploaddownloadfile.post.requestbody.content.applicationoctetstream.ApplicationoctetstreamSchema; + +import java.util.AbstractMap; +import java.util.Map; + +public class FakeuploaddownloadfilePostRequestBody { + public sealed interface SealedMediaType permits ApplicationoctetstreamMediaType {} + + public record ApplicationoctetstreamMediaType(ApplicationoctetstreamSchema.ApplicationoctetstreamSchema1 schema) implements SealedMediaType, MediaType { + public ApplicationoctetstreamMediaType() { + this(ApplicationoctetstreamSchema.ApplicationoctetstreamSchema1.getInstance()); + } + @Override + public Nothing? encoding() { + return null; + } + } + + public static class FakeuploaddownloadfilePostRequestBody1 extends RequestBodySerializer { + public FakeuploaddownloadfilePostRequestBody1() { + super( + Map.ofEntries( + new AbstractMap.SimpleEntry<>("application/octet-stream", new ApplicationoctetstreamMediaType()) + ), + true + ); + } + + public SerializedRequestBody serialize(SealedRequestBody requestBody) throws NotImplementedException { + ApplicationoctetstreamRequestBody requestBody0 = (ApplicationoctetstreamRequestBody) requestBody; + return serialize(requestBody0.contentType(), requestBody0.body().getData()); + } + } + + public sealed interface SealedRequestBody permits ApplicationoctetstreamRequestBody {} + public record ApplicationoctetstreamRequestBody(ApplicationoctetstreamSchema.StringJsonSchema1Boxed body) implements SealedRequestBody, GenericRequestBody { + @Override + public String contentType() { + return "application/octet-stream"; + } + } +} diff --git a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/fakeuploaddownloadfile/post/FakeuploaddownloadfilePostResponses.kt b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/fakeuploaddownloadfile/post/FakeuploaddownloadfilePostResponses.kt new file mode 100644 index 00000000000..1af4ec1e048 --- /dev/null +++ b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/fakeuploaddownloadfile/post/FakeuploaddownloadfilePostResponses.kt @@ -0,0 +1,53 @@ +package org.openapijsonschematools.client.paths.fakeuploaddownloadfile.post; + +import org.openapijsonschematools.client.paths.fakeuploaddownloadfile.post.responses.FakeuploaddownloadfilePostCode200Response; +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; +import org.checkerframework.checker.nullness.qual.Nullable; + +import java.net.http.HttpResponse; +import java.util.Map; +import java.util.AbstractMap; + +public class FakeuploaddownloadfilePostResponses { + public sealed interface EndpointResponse permits EndpointFakeuploaddownloadfilePostCode200Response {} + + public record EndpointFakeuploaddownloadfilePostCode200Response( + HttpResponse response, + FakeuploaddownloadfilePostCode200Response.SealedResponseBody body, + Nothing? headers + ) implements EndpointResponse, ApiResponse{ + } + + public sealed interface StatusCodeResponseDeserializer permits StatusFakeuploaddownloadfilePostCode200ResponseDeserializer {} + + public static final class StatusFakeuploaddownloadfilePostCode200ResponseDeserializer extends FakeuploaddownloadfilePostCode200Response.FakeuploaddownloadfilePostCode200Response1 implements StatusCodeResponseDeserializer { + } + + public static final class FakeuploaddownloadfilePostResponses1 implements ResponsesDeserializer { + private final Map statusCodeToResponseDeserializer; + public FakeuploaddownloadfilePostResponses1() { + this.statusCodeToResponseDeserializer = Map.ofEntries( + new AbstractMap.SimpleEntry<>("200", new StatusFakeuploaddownloadfilePostCode200ResponseDeserializer()) + ); + } + + 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) { + throw new ApiException( + "Invalid response statusCode="+statusCode+" has no response defined in the openapi document", + response + ); + } + StatusFakeuploaddownloadfilePostCode200ResponseDeserializer castDeserializer = (StatusFakeuploaddownloadfilePostCode200ResponseDeserializer) statusCodeDeserializer; + var deserializedResponse = castDeserializer.deserialize(response, configuration); + return new EndpointFakeuploaddownloadfilePostCode200Response(response, deserializedResponse.body(), deserializedResponse.headers()); + } + } +} diff --git a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/fakeuploaddownloadfile/post/requestbody/content/applicationoctetstream/ApplicationoctetstreamSchema.kt b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/fakeuploaddownloadfile/post/requestbody/content/applicationoctetstream/ApplicationoctetstreamSchema.kt new file mode 100644 index 00000000000..1dded2752b5 --- /dev/null +++ b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/fakeuploaddownloadfile/post/requestbody/content/applicationoctetstream/ApplicationoctetstreamSchema.kt @@ -0,0 +1,20 @@ +package org.openapijsonschematools.client.paths.fakeuploaddownloadfile.post.requestbody.content.applicationoctetstream; +import org.checkerframework.checker.nullness.qual.Nullable; +import org.openapijsonschematools.client.schemas.StringJsonSchema; + +public class ApplicationoctetstreamSchema extends StringJsonSchema { + // nest classes so all schemas and input/output classes can be public + + + public static class ApplicationoctetstreamSchema1 extends StringJsonSchema.StringJsonSchema1 { + // BinarySchema + private static @Nullable ApplicationoctetstreamSchema1 instance = null; + public static ApplicationoctetstreamSchema1 getInstance() { + if (instance == null) { + instance = new ApplicationoctetstreamSchema1(); + } + return instance; + } + } + +} diff --git a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/fakeuploaddownloadfile/post/responses/FakeuploaddownloadfilePostCode200Response.kt b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/fakeuploaddownloadfile/post/responses/FakeuploaddownloadfilePostCode200Response.kt new file mode 100644 index 00000000000..4f4f8e6947d --- /dev/null +++ b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/fakeuploaddownloadfile/post/responses/FakeuploaddownloadfilePostCode200Response.kt @@ -0,0 +1,63 @@ +package org.openapijsonschematools.client.paths.fakeuploaddownloadfile.post.responses; + +import org.openapijsonschematools.client.configurations.SchemaConfiguration; +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; + +import java.util.AbstractMap; +import java.util.Map; +import java.net.http.HttpResponse; +import java.net.http.HttpHeaders; + +public class FakeuploaddownloadfilePostCode200Response { + public sealed interface SealedMediaType permits ApplicationoctetstreamMediaType {} + + public record ApplicationoctetstreamMediaType(ApplicationoctetstreamSchema.ApplicationoctetstreamSchema1 schema) implements SealedMediaType, MediaType { + public ApplicationoctetstreamMediaType() { + this(ApplicationoctetstreamSchema.ApplicationoctetstreamSchema1.getInstance()); + } + @Override + public Nothing? encoding() { + return null; + } + } + public sealed interface SealedResponseBody permits ApplicationoctetstreamResponseBody {} + public record ApplicationoctetstreamResponseBody(ApplicationoctetstreamSchema.StringJsonSchema1Boxed body) implements SealedResponseBody { } + + public static class FakeuploaddownloadfilePostCode200Response1 extends ResponseDeserializer { + public FakeuploaddownloadfilePostCode200Response1() { + super( + Map.ofEntries( + new AbstractMap.SimpleEntry<>("application/octet-stream", new ApplicationoctetstreamMediaType()) + ) + ); + } + + @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); + } + + @Override + protected Nothing? getHeaders(HttpHeaders headers, SchemaConfiguration configuration) { + return null; + } + } + + @SuppressWarnings("serial") + public static class ResponseApiException extends ApiException { + public DeserializedHttpResponse deserializedResponse; + + public ResponseApiException(String s, HttpResponse response, DeserializedHttpResponse deserializedResponse) { + super(s, response); + this.deserializedResponse = deserializedResponse; + } + } +} diff --git a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/fakeuploaddownloadfile/post/responses/code200response/content/applicationoctetstream/ApplicationoctetstreamSchema.kt b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/fakeuploaddownloadfile/post/responses/code200response/content/applicationoctetstream/ApplicationoctetstreamSchema.kt new file mode 100644 index 00000000000..4560be3af67 --- /dev/null +++ b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/fakeuploaddownloadfile/post/responses/code200response/content/applicationoctetstream/ApplicationoctetstreamSchema.kt @@ -0,0 +1,20 @@ +package org.openapijsonschematools.client.paths.fakeuploaddownloadfile.post.responses.code200response.content.applicationoctetstream; +import org.checkerframework.checker.nullness.qual.Nullable; +import org.openapijsonschematools.client.schemas.StringJsonSchema; + +public class ApplicationoctetstreamSchema extends StringJsonSchema { + // nest classes so all schemas and input/output classes can be public + + + public static class ApplicationoctetstreamSchema1 extends StringJsonSchema.StringJsonSchema1 { + // BinarySchema + private static @Nullable ApplicationoctetstreamSchema1 instance = null; + public static ApplicationoctetstreamSchema1 getInstance() { + if (instance == null) { + instance = new ApplicationoctetstreamSchema1(); + } + return instance; + } + } + +} diff --git a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/fakeuploadfile/FakeuploadfilePost.kt b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/fakeuploadfile/FakeuploadfilePost.kt new file mode 100644 index 00000000000..4a90826a6bd --- /dev/null +++ b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/fakeuploadfile/FakeuploadfilePost.kt @@ -0,0 +1,152 @@ +package org.openapijsonschematools.client.paths.fakeuploadfile; + +import org.checkerframework.checker.nullness.qual.Nullable; +import org.openapijsonschematools.client.paths.fakeuploadfile.post.FakeuploadfilePostRequestBody; +import org.openapijsonschematools.client.RootServerInfo; +import org.openapijsonschematools.client.paths.fakeuploadfile.post.FakeuploadfilePostResponses; +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.requestbody.SerializedRequestBody; +import org.openapijsonschematools.client.paths.Fakeuploadfile; + +import java.io.IOException; +import java.util.ArrayList; +import java.net.http.HttpClient; +import java.net.http.HttpRequest; +import java.time.Duration; +import java.util.List; +import java.util.Map; + +public class FakeuploadfilePost { + private static class PostProvider { + private static final String method = "post"; + + public static FakeuploadfilePostResponses.EndpointResponse post( + PostRequest request, + ApiConfiguration apiConfiguration, + SchemaConfiguration schemaConfiguration, + HttpClient client + ) throws IOException, InterruptedException, ValidationException, NotImplementedException, ApiException { + Map> headers = apiConfiguration.getDefaultHeaders(); + + @Nullable SerializedRequestBody serializedRequestBody; + HttpRequest.BodyPublisher bodyPublisher = HttpRequest.BodyPublishers.noBody(); + if (request.requestBody != null) { + serializedRequestBody = new FakeuploadfilePostRequestBody.FakeuploadfilePostRequestBody1().serialize( + request.requestBody + ); + var contentTypeHeaderValues = headers.getOrDefault("Content-Type", new ArrayList<>()); + contentTypeHeaderValues.add(serializedRequestBody.contentType); + bodyPublisher = serializedRequestBody.bodyPublisher; + } + // TODO set this to a map if there is a query security scheme + @Nullable Map queryMap = null; + String host = apiConfiguration.getServer(request.serverIndex).url(); + + String url = host + Fakeuploadfile.path; + var httpRequest = RestClient.getRequest( + url, + method, + bodyPublisher, + headers, + request.timeout + ); + var response = RestClient.getResponse(httpRequest, client); + var responsesDeserializer = new FakeuploadfilePostResponses.FakeuploadfilePostResponses1(); + return responsesDeserializer.deserialize(response, schemaConfiguration); + } + } + + public interface PostOperation { + ApiConfiguration getApiConfiguration(); + SchemaConfiguration getSchemaConfiguration(); + HttpClient getClient(); + default FakeuploadfilePostResponses.EndpointResponse post(PostRequest request) throws IOException, InterruptedException, ValidationException, NotImplementedException, ApiException { + return PostProvider.post(request, getApiConfiguration(), getSchemaConfiguration(), getClient()); + } + } + + public interface UploadFileOperation { + ApiConfiguration getApiConfiguration(); + SchemaConfiguration getSchemaConfiguration(); + HttpClient getClient(); + default FakeuploadfilePostResponses.EndpointResponse uploadFile(PostRequest request) throws IOException, InterruptedException, ValidationException, NotImplementedException, ApiException { + return PostProvider.post(request, getApiConfiguration(), getSchemaConfiguration(), getClient()); + } + } + + public static class Post extends ApiClient implements PostOperation { + public Post(ApiConfiguration apiConfiguration, SchemaConfiguration schemaConfiguration) { + super(apiConfiguration, schemaConfiguration); + } + } + + public static class PostRequest { + public FakeuploadfilePostRequestBody.@Nullable SealedRequestBody requestBody; + public RootServerInfo.@Nullable ServerIndex serverIndex; + public @Nullable Duration timeout; + } + + public interface SetterForRequestBody { + PostRequest getInstance(); + T getBuilderAfterRequestBody(PostRequest instance); + default T requestBody(FakeuploadfilePostRequestBody.SealedRequestBody requestBody) { + var instance = getInstance(); + instance.requestBody = requestBody; + return getBuilderAfterRequestBody(instance); + } + } + + public interface SetterForServerIndex { + PostRequest getInstance(); + T getBuilderAfterServerIndex(PostRequest instance); + default T serverIndex(RootServerInfo.ServerIndex serverIndex) { + var instance = getInstance(); + instance.serverIndex = serverIndex; + return getBuilderAfterServerIndex(instance); + } + } + + public interface SetterForTimeout { + PostRequest getInstance(); + T getBuilderAfterTimeout(PostRequest instance); + default T timeout(Duration timeout) { + var instance = getInstance(); + instance.timeout = timeout; + return getBuilderAfterTimeout(instance); + } + } + + public static class PostRequestBuilder implements SetterForRequestBody, SetterForServerIndex, SetterForTimeout { + private final PostRequest instance; + + public PostRequestBuilder() { + this.instance = new PostRequest(); + } + + public PostRequest build() { + return instance; + } + + public PostRequest getInstance() { + return instance; + } + + public PostRequestBuilder getBuilderAfterRequestBody(PostRequest instance) { + return this; + } + + public PostRequestBuilder getBuilderAfterServerIndex(PostRequest instance) { + return this; + } + + public PostRequestBuilder getBuilderAfterTimeout(PostRequest instance) { + return this; + } + } +} diff --git a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/fakeuploadfile/post/FakeuploadfilePostRequestBody.kt b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/fakeuploadfile/post/FakeuploadfilePostRequestBody.kt new file mode 100644 index 00000000000..a975d519495 --- /dev/null +++ b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/fakeuploadfile/post/FakeuploadfilePostRequestBody.kt @@ -0,0 +1,49 @@ +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; +import org.openapijsonschematools.client.mediatype.MediaType; +import org.openapijsonschematools.client.paths.fakeuploadfile.post.requestbody.content.multipartformdata.MultipartformdataSchema; + +import java.util.AbstractMap; +import java.util.Map; + +public class FakeuploadfilePostRequestBody { + public sealed interface SealedMediaType permits MultipartformdataMediaType {} + + public record MultipartformdataMediaType(MultipartformdataSchema.MultipartformdataSchema1 schema) implements SealedMediaType, MediaType { + public MultipartformdataMediaType() { + this(MultipartformdataSchema.MultipartformdataSchema1.getInstance()); + } + @Override + public Nothing? encoding() { + return null; + } + } + + public static class FakeuploadfilePostRequestBody1 extends RequestBodySerializer { + public FakeuploadfilePostRequestBody1() { + super( + Map.ofEntries( + new AbstractMap.SimpleEntry<>("multipart/form-data", new MultipartformdataMediaType()) + ), + false + ); + } + + public SerializedRequestBody serialize(SealedRequestBody requestBody) throws NotImplementedException { + MultipartformdataRequestBody requestBody0 = (MultipartformdataRequestBody) requestBody; + return serialize(requestBody0.contentType(), requestBody0.body().getData()); + } + } + + public sealed interface SealedRequestBody permits MultipartformdataRequestBody {} + public record MultipartformdataRequestBody(MultipartformdataSchema.MultipartformdataSchema1Boxed body) implements SealedRequestBody, GenericRequestBody { + @Override + public String contentType() { + return "multipart/form-data"; + } + } +} diff --git a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/fakeuploadfile/post/FakeuploadfilePostResponses.kt b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/fakeuploadfile/post/FakeuploadfilePostResponses.kt new file mode 100644 index 00000000000..b40e2b5ea2c --- /dev/null +++ b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/fakeuploadfile/post/FakeuploadfilePostResponses.kt @@ -0,0 +1,53 @@ +package org.openapijsonschematools.client.paths.fakeuploadfile.post; + +import org.openapijsonschematools.client.paths.fakeuploadfile.post.responses.FakeuploadfilePostCode200Response; +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; +import org.checkerframework.checker.nullness.qual.Nullable; + +import java.net.http.HttpResponse; +import java.util.Map; +import java.util.AbstractMap; + +public class FakeuploadfilePostResponses { + public sealed interface EndpointResponse permits EndpointFakeuploadfilePostCode200Response {} + + public record EndpointFakeuploadfilePostCode200Response( + HttpResponse response, + FakeuploadfilePostCode200Response.SealedResponseBody body, + Nothing? headers + ) implements EndpointResponse, ApiResponse{ + } + + public sealed interface StatusCodeResponseDeserializer permits StatusFakeuploadfilePostCode200ResponseDeserializer {} + + public static final class StatusFakeuploadfilePostCode200ResponseDeserializer extends FakeuploadfilePostCode200Response.FakeuploadfilePostCode200Response1 implements StatusCodeResponseDeserializer { + } + + public static final class FakeuploadfilePostResponses1 implements ResponsesDeserializer { + private final Map statusCodeToResponseDeserializer; + public FakeuploadfilePostResponses1() { + this.statusCodeToResponseDeserializer = Map.ofEntries( + new AbstractMap.SimpleEntry<>("200", new StatusFakeuploadfilePostCode200ResponseDeserializer()) + ); + } + + 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) { + throw new ApiException( + "Invalid response statusCode="+statusCode+" has no response defined in the openapi document", + response + ); + } + StatusFakeuploadfilePostCode200ResponseDeserializer castDeserializer = (StatusFakeuploadfilePostCode200ResponseDeserializer) statusCodeDeserializer; + var deserializedResponse = castDeserializer.deserialize(response, configuration); + return new EndpointFakeuploadfilePostCode200Response(response, deserializedResponse.body(), deserializedResponse.headers()); + } + } +} diff --git a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/fakeuploadfile/post/requestbody/content/multipartformdata/MultipartformdataSchema.kt b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/fakeuploadfile/post/requestbody/content/multipartformdata/MultipartformdataSchema.kt new file mode 100644 index 00000000000..d5b2b0606da --- /dev/null +++ b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/fakeuploadfile/post/requestbody/content/multipartformdata/MultipartformdataSchema.kt @@ -0,0 +1,251 @@ +package org.openapijsonschematools.client.paths.fakeuploadfile.post.requestbody.content.multipartformdata; +import java.util.ArrayList; +import java.util.HashSet; +import java.util.LinkedHashMap; +import java.util.LinkedHashSet; +import java.util.List; +import java.util.Map; +import java.util.Objects; +import java.util.Set; +import org.checkerframework.checker.nullness.qual.Nullable; +import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags; +import org.openapijsonschematools.client.configurations.SchemaConfiguration; +import org.openapijsonschematools.client.exceptions.InvalidAdditionalPropertyException; +import org.openapijsonschematools.client.exceptions.UnsetPropertyException; +import org.openapijsonschematools.client.exceptions.ValidationException; +import org.openapijsonschematools.client.schemas.GenericBuilder; +import org.openapijsonschematools.client.schemas.StringJsonSchema; +import org.openapijsonschematools.client.schemas.UnsetAddPropsSetter; +import org.openapijsonschematools.client.schemas.validation.FrozenMap; +import org.openapijsonschematools.client.schemas.validation.JsonSchema; +import org.openapijsonschematools.client.schemas.validation.JsonSchemaInfo; +import org.openapijsonschematools.client.schemas.validation.MapSchemaValidator; +import org.openapijsonschematools.client.schemas.validation.PathToSchemasMap; +import org.openapijsonschematools.client.schemas.validation.PropertyEntry; +import org.openapijsonschematools.client.schemas.validation.ValidationMetadata; + +public class MultipartformdataSchema { + // nest classes so all schemas and input/output classes can be public + + + public static class MultipartformdataAdditionalMetadata extends StringJsonSchema.StringJsonSchema1 { + private static @Nullable MultipartformdataAdditionalMetadata instance = null; + public static MultipartformdataAdditionalMetadata getInstance() { + if (instance == null) { + instance = new MultipartformdataAdditionalMetadata(); + } + return instance; + } + } + + + public static class MultipartformdataFile extends StringJsonSchema.StringJsonSchema1 { + // BinarySchema + private static @Nullable MultipartformdataFile instance = null; + public static MultipartformdataFile getInstance() { + if (instance == null) { + instance = new MultipartformdataFile(); + } + return instance; + } + } + + + public static class MultipartformdataSchemaMap extends FrozenMap<@Nullable Object> { + protected MultipartformdataSchemaMap(FrozenMap<@Nullable Object> m) { + super(m); + } + public static final Set requiredKeys = Set.of( + "file" + ); + public static final Set optionalKeys = Set.of( + "additionalMetadata" + ); + public static MultipartformdataSchemaMap of(Map arg, SchemaConfiguration configuration) throws ValidationException { + return MultipartformdataSchema1.getInstance().validate(arg, configuration); + } + + public String file() { + @Nullable Object value = get("file"); + if (!(value instanceof String)) { + throw new RuntimeException("Invalid value stored for file"); + } + return (String) value; + } + + public String additionalMetadata() throws UnsetPropertyException { + String key = "additionalMetadata"; + throwIfKeyNotPresent(key); + @Nullable Object value = get(key); + if (!(value instanceof String)) { + throw new RuntimeException("Invalid value stored for additionalMetadata"); + } + return (String) value; + } + + public @Nullable Object getAdditionalProperty(String name) throws UnsetPropertyException, InvalidAdditionalPropertyException { + throwIfKeyKnown(name, requiredKeys, optionalKeys); + throwIfKeyNotPresent(name); + return get(name); + } + } + + public interface SetterForMultipartformdataFile { + Map getInstance(); + T getBuilderAfterMultipartformdataFile(Map instance); + + default T file(String value) { + var instance = getInstance(); + instance.put("file", value); + return getBuilderAfterMultipartformdataFile(instance); + } + } + + public interface SetterForMultipartformdataAdditionalMetadata { + Map getInstance(); + T getBuilderAfterMultipartformdataAdditionalMetadata(Map instance); + + default T additionalMetadata(String value) { + var instance = getInstance(); + instance.put("additionalMetadata", value); + return getBuilderAfterMultipartformdataAdditionalMetadata(instance); + } + } + + public static class MultipartformdataSchemaMap0Builder extends UnsetAddPropsSetter implements GenericBuilder>, SetterForMultipartformdataAdditionalMetadata { + private final Map instance; + private static final Set knownKeys = Set.of( + "file", + "additionalMetadata" + ); + public Set getKnownKeys() { + return knownKeys; + } + public MultipartformdataSchemaMap0Builder(Map instance) { + this.instance = instance; + } + public Map build() { + return instance; + } + public Map getInstance() { + return instance; + } + public MultipartformdataSchemaMap0Builder getBuilderAfterMultipartformdataAdditionalMetadata(Map instance) { + return this; + } + public MultipartformdataSchemaMap0Builder getBuilderAfterAdditionalProperty(Map instance) { + return this; + } + } + + public static class MultipartformdataSchemaMapBuilder implements SetterForMultipartformdataFile { + private final Map instance; + public MultipartformdataSchemaMapBuilder() { + this.instance = new LinkedHashMap<>(); + } + public Map getInstance() { + return instance; + } + public MultipartformdataSchemaMap0Builder getBuilderAfterMultipartformdataFile(Map instance) { + return new MultipartformdataSchemaMap0Builder(instance); + } + } + + + public sealed interface MultipartformdataSchema1Boxed permits MultipartformdataSchema1BoxedMap { + @Nullable Object getData(); + } + + public record MultipartformdataSchema1BoxedMap(MultipartformdataSchemaMap data) implements MultipartformdataSchema1Boxed { + @Override + public @Nullable Object getData() { + return data; + } + } + + + public static class MultipartformdataSchema1 extends JsonSchema implements MapSchemaValidator { + private static @Nullable MultipartformdataSchema1 instance = null; + + protected MultipartformdataSchema1() { + super(new JsonSchemaInfo() + .type(Set.of(Map.class)) + .properties(Map.ofEntries( + new PropertyEntry("additionalMetadata", MultipartformdataAdditionalMetadata.class), + new PropertyEntry("file", MultipartformdataFile.class) + )) + .required(Set.of( + "file" + )) + ); + } + + public static MultipartformdataSchema1 getInstance() { + if (instance == null) { + instance = new MultipartformdataSchema1(); + } + return instance; + } + + 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 RuntimeException("Invalid non-string key value"); + } + String propertyName = (String) entryKey; + List propertyPathToItem = new ArrayList<>(pathToItem); + propertyPathToItem.add(propertyName); + Object value = entry.getValue(); + LinkedHashMap, Nothing?> schemas = pathToSchemas.get(propertyPathToItem); + if (schemas == null) { + throw new RuntimeException("Validation result is invalid, schemas must exist for a pathToItem"); + } + JsonSchema propertySchema = schemas.entrySet().iterator().next().getKey(); + @Nullable Object propertyInstance = propertySchema.getNewInstance(value, propertyPathToItem, pathToSchemas); + properties.put(propertyName, propertyInstance); + } + FrozenMap<@Nullable Object> castProperties = new FrozenMap<>(properties); + return new MultipartformdataSchemaMap(castProperties); + } + + 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); + SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().build())); + ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, new PathToSchemasMap(), new LinkedHashSet<>()); + PathToSchemasMap pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet); + return getNewInstance(castArg, validationMetadata.pathToItem(), pathToSchemasMap); + } + + + @Override + public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws 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"); + } + @Override + public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { + if (arg instanceof Map) { + return getNewInstance((Map) arg, pathToItem, pathToSchemas); + } + 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 { + return new MultipartformdataSchema1BoxedMap(validate(arg, configuration)); + } + @Override + public MultipartformdataSchema1Boxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { + 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"); + } + } + +} diff --git a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/fakeuploadfile/post/responses/FakeuploadfilePostCode200Response.kt b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/fakeuploadfile/post/responses/FakeuploadfilePostCode200Response.kt new file mode 100644 index 00000000000..0be951312e2 --- /dev/null +++ b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/fakeuploadfile/post/responses/FakeuploadfilePostCode200Response.kt @@ -0,0 +1,63 @@ +package org.openapijsonschematools.client.paths.fakeuploadfile.post.responses; + +import org.openapijsonschematools.client.configurations.SchemaConfiguration; +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; + +import java.util.AbstractMap; +import java.util.Map; +import java.net.http.HttpResponse; +import java.net.http.HttpHeaders; + +public class FakeuploadfilePostCode200Response { + public sealed interface SealedMediaType permits ApplicationjsonMediaType {} + + public record ApplicationjsonMediaType(ApplicationjsonSchema.ApplicationjsonSchema1 schema) implements SealedMediaType, MediaType { + public ApplicationjsonMediaType() { + this(ApplicationjsonSchema.ApplicationjsonSchema1.getInstance()); + } + @Override + public Nothing? encoding() { + return null; + } + } + public sealed interface SealedResponseBody permits ApplicationjsonResponseBody {} + public record ApplicationjsonResponseBody(ApplicationjsonSchema.ApiResponseSchema1Boxed body) implements SealedResponseBody { } + + public static class FakeuploadfilePostCode200Response1 extends ResponseDeserializer { + public FakeuploadfilePostCode200Response1() { + super( + Map.ofEntries( + new AbstractMap.SimpleEntry<>("application/json", new ApplicationjsonMediaType()) + ) + ); + } + + @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); + } + + @Override + protected Nothing? getHeaders(HttpHeaders headers, SchemaConfiguration configuration) { + return null; + } + } + + @SuppressWarnings("serial") + public static class ResponseApiException extends ApiException { + public DeserializedHttpResponse deserializedResponse; + + public ResponseApiException(String s, HttpResponse response, DeserializedHttpResponse deserializedResponse) { + super(s, response); + this.deserializedResponse = deserializedResponse; + } + } +} diff --git a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/fakeuploadfile/post/responses/code200response/content/applicationjson/ApplicationjsonSchema.kt b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/fakeuploadfile/post/responses/code200response/content/applicationjson/ApplicationjsonSchema.kt new file mode 100644 index 00000000000..efbbe4fc405 --- /dev/null +++ b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/fakeuploadfile/post/responses/code200response/content/applicationjson/ApplicationjsonSchema.kt @@ -0,0 +1,19 @@ +package org.openapijsonschematools.client.paths.fakeuploadfile.post.responses.code200response.content.applicationjson; + +import org.checkerframework.checker.nullness.qual.Nullable; +import org.openapijsonschematools.client.components.schemas.ApiResponseSchema; + +public class ApplicationjsonSchema extends ApiResponseSchema { + // $refed class + + + public static class ApplicationjsonSchema1 extends ApiResponseSchema1 { + private static @Nullable ApplicationjsonSchema1 instance = null; + public static ApplicationjsonSchema1 getInstance() { + if (instance == null) { + instance = new ApplicationjsonSchema1(); + } + return instance; + } + } +} diff --git a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/fakeuploadfiles/FakeuploadfilesPost.kt b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/fakeuploadfiles/FakeuploadfilesPost.kt new file mode 100644 index 00000000000..e35ade51c50 --- /dev/null +++ b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/fakeuploadfiles/FakeuploadfilesPost.kt @@ -0,0 +1,152 @@ +package org.openapijsonschematools.client.paths.fakeuploadfiles; + +import org.checkerframework.checker.nullness.qual.Nullable; +import org.openapijsonschematools.client.paths.fakeuploadfiles.post.FakeuploadfilesPostRequestBody; +import org.openapijsonschematools.client.RootServerInfo; +import org.openapijsonschematools.client.paths.fakeuploadfiles.post.FakeuploadfilesPostResponses; +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.requestbody.SerializedRequestBody; +import org.openapijsonschematools.client.paths.Fakeuploadfiles; + +import java.io.IOException; +import java.util.ArrayList; +import java.net.http.HttpClient; +import java.net.http.HttpRequest; +import java.time.Duration; +import java.util.List; +import java.util.Map; + +public class FakeuploadfilesPost { + private static class PostProvider { + private static final String method = "post"; + + public static FakeuploadfilesPostResponses.EndpointResponse post( + PostRequest request, + ApiConfiguration apiConfiguration, + SchemaConfiguration schemaConfiguration, + HttpClient client + ) throws IOException, InterruptedException, ValidationException, NotImplementedException, ApiException { + Map> headers = apiConfiguration.getDefaultHeaders(); + + @Nullable SerializedRequestBody serializedRequestBody; + HttpRequest.BodyPublisher bodyPublisher = HttpRequest.BodyPublishers.noBody(); + if (request.requestBody != null) { + serializedRequestBody = new FakeuploadfilesPostRequestBody.FakeuploadfilesPostRequestBody1().serialize( + request.requestBody + ); + var contentTypeHeaderValues = headers.getOrDefault("Content-Type", new ArrayList<>()); + contentTypeHeaderValues.add(serializedRequestBody.contentType); + bodyPublisher = serializedRequestBody.bodyPublisher; + } + // TODO set this to a map if there is a query security scheme + @Nullable Map queryMap = null; + String host = apiConfiguration.getServer(request.serverIndex).url(); + + String url = host + Fakeuploadfiles.path; + var httpRequest = RestClient.getRequest( + url, + method, + bodyPublisher, + headers, + request.timeout + ); + var response = RestClient.getResponse(httpRequest, client); + var responsesDeserializer = new FakeuploadfilesPostResponses.FakeuploadfilesPostResponses1(); + return responsesDeserializer.deserialize(response, schemaConfiguration); + } + } + + public interface PostOperation { + ApiConfiguration getApiConfiguration(); + SchemaConfiguration getSchemaConfiguration(); + HttpClient getClient(); + default FakeuploadfilesPostResponses.EndpointResponse post(PostRequest request) throws IOException, InterruptedException, ValidationException, NotImplementedException, ApiException { + return PostProvider.post(request, getApiConfiguration(), getSchemaConfiguration(), getClient()); + } + } + + public interface UploadFilesOperation { + ApiConfiguration getApiConfiguration(); + SchemaConfiguration getSchemaConfiguration(); + HttpClient getClient(); + default FakeuploadfilesPostResponses.EndpointResponse uploadFiles(PostRequest request) throws IOException, InterruptedException, ValidationException, NotImplementedException, ApiException { + return PostProvider.post(request, getApiConfiguration(), getSchemaConfiguration(), getClient()); + } + } + + public static class Post extends ApiClient implements PostOperation { + public Post(ApiConfiguration apiConfiguration, SchemaConfiguration schemaConfiguration) { + super(apiConfiguration, schemaConfiguration); + } + } + + public static class PostRequest { + public FakeuploadfilesPostRequestBody.@Nullable SealedRequestBody requestBody; + public RootServerInfo.@Nullable ServerIndex serverIndex; + public @Nullable Duration timeout; + } + + public interface SetterForRequestBody { + PostRequest getInstance(); + T getBuilderAfterRequestBody(PostRequest instance); + default T requestBody(FakeuploadfilesPostRequestBody.SealedRequestBody requestBody) { + var instance = getInstance(); + instance.requestBody = requestBody; + return getBuilderAfterRequestBody(instance); + } + } + + public interface SetterForServerIndex { + PostRequest getInstance(); + T getBuilderAfterServerIndex(PostRequest instance); + default T serverIndex(RootServerInfo.ServerIndex serverIndex) { + var instance = getInstance(); + instance.serverIndex = serverIndex; + return getBuilderAfterServerIndex(instance); + } + } + + public interface SetterForTimeout { + PostRequest getInstance(); + T getBuilderAfterTimeout(PostRequest instance); + default T timeout(Duration timeout) { + var instance = getInstance(); + instance.timeout = timeout; + return getBuilderAfterTimeout(instance); + } + } + + public static class PostRequestBuilder implements SetterForRequestBody, SetterForServerIndex, SetterForTimeout { + private final PostRequest instance; + + public PostRequestBuilder() { + this.instance = new PostRequest(); + } + + public PostRequest build() { + return instance; + } + + public PostRequest getInstance() { + return instance; + } + + public PostRequestBuilder getBuilderAfterRequestBody(PostRequest instance) { + return this; + } + + public PostRequestBuilder getBuilderAfterServerIndex(PostRequest instance) { + return this; + } + + public PostRequestBuilder getBuilderAfterTimeout(PostRequest instance) { + return this; + } + } +} diff --git a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/fakeuploadfiles/post/FakeuploadfilesPostRequestBody.kt b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/fakeuploadfiles/post/FakeuploadfilesPostRequestBody.kt new file mode 100644 index 00000000000..0a1d1e5c658 --- /dev/null +++ b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/fakeuploadfiles/post/FakeuploadfilesPostRequestBody.kt @@ -0,0 +1,49 @@ +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; +import org.openapijsonschematools.client.mediatype.MediaType; +import org.openapijsonschematools.client.paths.fakeuploadfiles.post.requestbody.content.multipartformdata.MultipartformdataSchema; + +import java.util.AbstractMap; +import java.util.Map; + +public class FakeuploadfilesPostRequestBody { + public sealed interface SealedMediaType permits MultipartformdataMediaType {} + + public record MultipartformdataMediaType(MultipartformdataSchema.MultipartformdataSchema1 schema) implements SealedMediaType, MediaType { + public MultipartformdataMediaType() { + this(MultipartformdataSchema.MultipartformdataSchema1.getInstance()); + } + @Override + public Nothing? encoding() { + return null; + } + } + + public static class FakeuploadfilesPostRequestBody1 extends RequestBodySerializer { + public FakeuploadfilesPostRequestBody1() { + super( + Map.ofEntries( + new AbstractMap.SimpleEntry<>("multipart/form-data", new MultipartformdataMediaType()) + ), + false + ); + } + + public SerializedRequestBody serialize(SealedRequestBody requestBody) throws NotImplementedException { + MultipartformdataRequestBody requestBody0 = (MultipartformdataRequestBody) requestBody; + return serialize(requestBody0.contentType(), requestBody0.body().getData()); + } + } + + public sealed interface SealedRequestBody permits MultipartformdataRequestBody {} + public record MultipartformdataRequestBody(MultipartformdataSchema.MultipartformdataSchema1Boxed body) implements SealedRequestBody, GenericRequestBody { + @Override + public String contentType() { + return "multipart/form-data"; + } + } +} diff --git a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/fakeuploadfiles/post/FakeuploadfilesPostResponses.kt b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/fakeuploadfiles/post/FakeuploadfilesPostResponses.kt new file mode 100644 index 00000000000..ffff5ed7b3e --- /dev/null +++ b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/fakeuploadfiles/post/FakeuploadfilesPostResponses.kt @@ -0,0 +1,53 @@ +package org.openapijsonschematools.client.paths.fakeuploadfiles.post; + +import org.openapijsonschematools.client.paths.fakeuploadfiles.post.responses.FakeuploadfilesPostCode200Response; +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; +import org.checkerframework.checker.nullness.qual.Nullable; + +import java.net.http.HttpResponse; +import java.util.Map; +import java.util.AbstractMap; + +public class FakeuploadfilesPostResponses { + public sealed interface EndpointResponse permits EndpointFakeuploadfilesPostCode200Response {} + + public record EndpointFakeuploadfilesPostCode200Response( + HttpResponse response, + FakeuploadfilesPostCode200Response.SealedResponseBody body, + Nothing? headers + ) implements EndpointResponse, ApiResponse{ + } + + public sealed interface StatusCodeResponseDeserializer permits StatusFakeuploadfilesPostCode200ResponseDeserializer {} + + public static final class StatusFakeuploadfilesPostCode200ResponseDeserializer extends FakeuploadfilesPostCode200Response.FakeuploadfilesPostCode200Response1 implements StatusCodeResponseDeserializer { + } + + public static final class FakeuploadfilesPostResponses1 implements ResponsesDeserializer { + private final Map statusCodeToResponseDeserializer; + public FakeuploadfilesPostResponses1() { + this.statusCodeToResponseDeserializer = Map.ofEntries( + new AbstractMap.SimpleEntry<>("200", new StatusFakeuploadfilesPostCode200ResponseDeserializer()) + ); + } + + 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) { + throw new ApiException( + "Invalid response statusCode="+statusCode+" has no response defined in the openapi document", + response + ); + } + StatusFakeuploadfilesPostCode200ResponseDeserializer castDeserializer = (StatusFakeuploadfilesPostCode200ResponseDeserializer) statusCodeDeserializer; + var deserializedResponse = castDeserializer.deserialize(response, configuration); + return new EndpointFakeuploadfilesPostCode200Response(response, deserializedResponse.body(), deserializedResponse.headers()); + } + } +} diff --git a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/fakeuploadfiles/post/requestbody/content/multipartformdata/MultipartformdataSchema.kt b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/fakeuploadfiles/post/requestbody/content/multipartformdata/MultipartformdataSchema.kt new file mode 100644 index 00000000000..1121d2a2a11 --- /dev/null +++ b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/fakeuploadfiles/post/requestbody/content/multipartformdata/MultipartformdataSchema.kt @@ -0,0 +1,325 @@ +package org.openapijsonschematools.client.paths.fakeuploadfiles.post.requestbody.content.multipartformdata; +import java.util.ArrayList; +import java.util.HashSet; +import java.util.LinkedHashMap; +import java.util.LinkedHashSet; +import java.util.List; +import java.util.Map; +import java.util.Objects; +import java.util.Set; +import org.checkerframework.checker.nullness.qual.Nullable; +import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags; +import org.openapijsonschematools.client.configurations.SchemaConfiguration; +import org.openapijsonschematools.client.exceptions.InvalidAdditionalPropertyException; +import org.openapijsonschematools.client.exceptions.UnsetPropertyException; +import org.openapijsonschematools.client.exceptions.ValidationException; +import org.openapijsonschematools.client.schemas.GenericBuilder; +import org.openapijsonschematools.client.schemas.StringJsonSchema; +import org.openapijsonschematools.client.schemas.UnsetAddPropsSetter; +import org.openapijsonschematools.client.schemas.validation.FrozenList; +import org.openapijsonschematools.client.schemas.validation.FrozenMap; +import org.openapijsonschematools.client.schemas.validation.JsonSchema; +import org.openapijsonschematools.client.schemas.validation.JsonSchemaInfo; +import org.openapijsonschematools.client.schemas.validation.ListSchemaValidator; +import org.openapijsonschematools.client.schemas.validation.MapSchemaValidator; +import org.openapijsonschematools.client.schemas.validation.PathToSchemasMap; +import org.openapijsonschematools.client.schemas.validation.PropertyEntry; +import org.openapijsonschematools.client.schemas.validation.ValidationMetadata; + +public class MultipartformdataSchema { + // nest classes so all schemas and input/output classes can be public + + + public static class MultipartformdataItems extends StringJsonSchema.StringJsonSchema1 { + // BinarySchema + private static @Nullable MultipartformdataItems instance = null; + public static MultipartformdataItems getInstance() { + if (instance == null) { + instance = new MultipartformdataItems(); + } + return instance; + } + } + + + public static class MultipartformdataFilesList extends FrozenList { + protected MultipartformdataFilesList(FrozenList m) { + super(m); + } + public static MultipartformdataFilesList of(List arg, SchemaConfiguration configuration) throws ValidationException { + return MultipartformdataFiles.getInstance().validate(arg, configuration); + } + } + + public static class MultipartformdataFilesListBuilder { + // class to build List + private final List list; + + public MultipartformdataFilesListBuilder() { + list = new ArrayList<>(); + } + + public MultipartformdataFilesListBuilder(List list) { + this.list = list; + } + + public MultipartformdataFilesListBuilder add(String item) { + list.add(item); + return this; + } + + public List build() { + return list; + } + } + + + public sealed interface MultipartformdataFilesBoxed permits MultipartformdataFilesBoxedList { + @Nullable Object getData(); + } + + public record MultipartformdataFilesBoxedList(MultipartformdataFilesList data) implements MultipartformdataFilesBoxed { + @Override + public @Nullable Object getData() { + return data; + } + } + + + + public static class MultipartformdataFiles extends JsonSchema implements ListSchemaValidator { + private static @Nullable MultipartformdataFiles instance = null; + + protected MultipartformdataFiles() { + super(new JsonSchemaInfo() + .type(Set.of(List.class)) + .items(MultipartformdataItems.class) + ); + } + + public static MultipartformdataFiles getInstance() { + if (instance == null) { + instance = new MultipartformdataFiles(); + } + return instance; + } + + @Override + public MultipartformdataFilesList getNewInstance(List arg, List pathToItem, PathToSchemasMap pathToSchemas) { + List items = new ArrayList<>(); + int i = 0; + for (Object item: arg) { + List itemPathToItem = new ArrayList<>(pathToItem); + itemPathToItem.add(i); + LinkedHashMap, Nothing?> schemas = pathToSchemas.get(itemPathToItem); + if (schemas == null) { + throw new RuntimeException("Validation 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"); + } + items.add((String) itemInstance); + i += 1; + } + FrozenList newInstanceItems = new FrozenList<>(items); + return new MultipartformdataFilesList(newInstanceItems); + } + + 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); + SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().build())); + ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, new PathToSchemasMap(), new LinkedHashSet<>()); + PathToSchemasMap pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet); + return getNewInstance(castArg, validationMetadata.pathToItem(), pathToSchemasMap); + } + + @Override + public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws 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"); + } + @Override + public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { + 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"); + } + @Override + 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 { + 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"); + } + } + + public static class MultipartformdataSchemaMap extends FrozenMap<@Nullable Object> { + protected MultipartformdataSchemaMap(FrozenMap<@Nullable Object> m) { + super(m); + } + public static final Set requiredKeys = Set.of(); + public static final Set optionalKeys = Set.of( + "files" + ); + public static MultipartformdataSchemaMap of(Map arg, SchemaConfiguration configuration) throws ValidationException { + return MultipartformdataSchema1.getInstance().validate(arg, configuration); + } + + public MultipartformdataFilesList files() throws UnsetPropertyException { + String key = "files"; + throwIfKeyNotPresent(key); + @Nullable Object value = get(key); + if (!(value instanceof MultipartformdataFilesList)) { + throw new RuntimeException("Invalid value stored for files"); + } + return (MultipartformdataFilesList) value; + } + + public @Nullable Object getAdditionalProperty(String name) throws UnsetPropertyException, InvalidAdditionalPropertyException { + throwIfKeyKnown(name, requiredKeys, optionalKeys); + throwIfKeyNotPresent(name); + return get(name); + } + } + + public interface SetterForMultipartformdataFiles { + Map getInstance(); + T getBuilderAfterMultipartformdataFiles(Map instance); + + default T files(List value) { + var instance = getInstance(); + instance.put("files", value); + return getBuilderAfterMultipartformdataFiles(instance); + } + } + + public static class MultipartformdataSchemaMapBuilder extends UnsetAddPropsSetter implements GenericBuilder>, SetterForMultipartformdataFiles { + private final Map instance; + private static final Set knownKeys = Set.of( + "files" + ); + public Set getKnownKeys() { + return knownKeys; + } + public MultipartformdataSchemaMapBuilder() { + this.instance = new LinkedHashMap<>(); + } + public Map build() { + return instance; + } + public Map getInstance() { + return instance; + } + public MultipartformdataSchemaMapBuilder getBuilderAfterMultipartformdataFiles(Map instance) { + return this; + } + public MultipartformdataSchemaMapBuilder getBuilderAfterAdditionalProperty(Map instance) { + return this; + } + } + + + public sealed interface MultipartformdataSchema1Boxed permits MultipartformdataSchema1BoxedMap { + @Nullable Object getData(); + } + + public record MultipartformdataSchema1BoxedMap(MultipartformdataSchemaMap data) implements MultipartformdataSchema1Boxed { + @Override + public @Nullable Object getData() { + return data; + } + } + + + public static class MultipartformdataSchema1 extends JsonSchema implements MapSchemaValidator { + private static @Nullable MultipartformdataSchema1 instance = null; + + protected MultipartformdataSchema1() { + super(new JsonSchemaInfo() + .type(Set.of(Map.class)) + .properties(Map.ofEntries( + new PropertyEntry("files", MultipartformdataFiles.class) + )) + ); + } + + public static MultipartformdataSchema1 getInstance() { + if (instance == null) { + instance = new MultipartformdataSchema1(); + } + return instance; + } + + 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 RuntimeException("Invalid non-string key value"); + } + String propertyName = (String) entryKey; + List propertyPathToItem = new ArrayList<>(pathToItem); + propertyPathToItem.add(propertyName); + Object value = entry.getValue(); + LinkedHashMap, Nothing?> schemas = pathToSchemas.get(propertyPathToItem); + if (schemas == null) { + throw new RuntimeException("Validation result is invalid, schemas must exist for a pathToItem"); + } + JsonSchema propertySchema = schemas.entrySet().iterator().next().getKey(); + @Nullable Object propertyInstance = propertySchema.getNewInstance(value, propertyPathToItem, pathToSchemas); + properties.put(propertyName, propertyInstance); + } + FrozenMap<@Nullable Object> castProperties = new FrozenMap<>(properties); + return new MultipartformdataSchemaMap(castProperties); + } + + 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); + SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().build())); + ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, new PathToSchemasMap(), new LinkedHashSet<>()); + PathToSchemasMap pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet); + return getNewInstance(castArg, validationMetadata.pathToItem(), pathToSchemasMap); + } + + + @Override + public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws 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"); + } + @Override + public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { + if (arg instanceof Map) { + return getNewInstance((Map) arg, pathToItem, pathToSchemas); + } + 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 { + return new MultipartformdataSchema1BoxedMap(validate(arg, configuration)); + } + @Override + public MultipartformdataSchema1Boxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { + 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"); + } + } + +} diff --git a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/fakeuploadfiles/post/responses/FakeuploadfilesPostCode200Response.kt b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/fakeuploadfiles/post/responses/FakeuploadfilesPostCode200Response.kt new file mode 100644 index 00000000000..82642288d7c --- /dev/null +++ b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/fakeuploadfiles/post/responses/FakeuploadfilesPostCode200Response.kt @@ -0,0 +1,63 @@ +package org.openapijsonschematools.client.paths.fakeuploadfiles.post.responses; + +import org.openapijsonschematools.client.configurations.SchemaConfiguration; +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; + +import java.util.AbstractMap; +import java.util.Map; +import java.net.http.HttpResponse; +import java.net.http.HttpHeaders; + +public class FakeuploadfilesPostCode200Response { + public sealed interface SealedMediaType permits ApplicationjsonMediaType {} + + public record ApplicationjsonMediaType(ApplicationjsonSchema.ApplicationjsonSchema1 schema) implements SealedMediaType, MediaType { + public ApplicationjsonMediaType() { + this(ApplicationjsonSchema.ApplicationjsonSchema1.getInstance()); + } + @Override + public Nothing? encoding() { + return null; + } + } + public sealed interface SealedResponseBody permits ApplicationjsonResponseBody {} + public record ApplicationjsonResponseBody(ApplicationjsonSchema.ApiResponseSchema1Boxed body) implements SealedResponseBody { } + + public static class FakeuploadfilesPostCode200Response1 extends ResponseDeserializer { + public FakeuploadfilesPostCode200Response1() { + super( + Map.ofEntries( + new AbstractMap.SimpleEntry<>("application/json", new ApplicationjsonMediaType()) + ) + ); + } + + @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); + } + + @Override + protected Nothing? getHeaders(HttpHeaders headers, SchemaConfiguration configuration) { + return null; + } + } + + @SuppressWarnings("serial") + public static class ResponseApiException extends ApiException { + public DeserializedHttpResponse deserializedResponse; + + public ResponseApiException(String s, HttpResponse response, DeserializedHttpResponse deserializedResponse) { + super(s, response); + this.deserializedResponse = deserializedResponse; + } + } +} diff --git a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/fakeuploadfiles/post/responses/code200response/content/applicationjson/ApplicationjsonSchema.kt b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/fakeuploadfiles/post/responses/code200response/content/applicationjson/ApplicationjsonSchema.kt new file mode 100644 index 00000000000..df28450acdb --- /dev/null +++ b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/fakeuploadfiles/post/responses/code200response/content/applicationjson/ApplicationjsonSchema.kt @@ -0,0 +1,19 @@ +package org.openapijsonschematools.client.paths.fakeuploadfiles.post.responses.code200response.content.applicationjson; + +import org.checkerframework.checker.nullness.qual.Nullable; +import org.openapijsonschematools.client.components.schemas.ApiResponseSchema; + +public class ApplicationjsonSchema extends ApiResponseSchema { + // $refed class + + + public static class ApplicationjsonSchema1 extends ApiResponseSchema1 { + private static @Nullable ApplicationjsonSchema1 instance = null; + public static ApplicationjsonSchema1 getInstance() { + if (instance == null) { + instance = new ApplicationjsonSchema1(); + } + return instance; + } + } +} diff --git a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/fakewildcardresponses/FakewildcardresponsesGet.kt b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/fakewildcardresponses/FakewildcardresponsesGet.kt new file mode 100644 index 00000000000..1f7aab70481 --- /dev/null +++ b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/fakewildcardresponses/FakewildcardresponsesGet.kt @@ -0,0 +1,124 @@ +package org.openapijsonschematools.client.paths.fakewildcardresponses; + +import org.checkerframework.checker.nullness.qual.Nullable; +import org.openapijsonschematools.client.RootServerInfo; +import org.openapijsonschematools.client.paths.fakewildcardresponses.get.FakewildcardresponsesGetResponses; +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.paths.Fakewildcardresponses; + +import java.io.IOException; +import java.net.http.HttpClient; +import java.net.http.HttpRequest; +import java.time.Duration; +import java.util.List; +import java.util.Map; + +public class FakewildcardresponsesGet { + private static class GetProvider { + private static final String method = "get"; + + public static FakewildcardresponsesGetResponses.EndpointResponse get( + GetRequest request, + ApiConfiguration apiConfiguration, + SchemaConfiguration schemaConfiguration, + HttpClient client + ) 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 + @Nullable Map queryMap = null; + String host = apiConfiguration.getServer(request.serverIndex).url(); + + String url = host + Fakewildcardresponses.path; + var httpRequest = RestClient.getRequest( + url, + method, + bodyPublisher, + headers, + request.timeout + ); + var response = RestClient.getResponse(httpRequest, client); + var responsesDeserializer = new FakewildcardresponsesGetResponses.FakewildcardresponsesGetResponses1(); + return responsesDeserializer.deserialize(response, schemaConfiguration); + } + } + + public interface GetOperation { + ApiConfiguration getApiConfiguration(); + SchemaConfiguration getSchemaConfiguration(); + HttpClient getClient(); + default FakewildcardresponsesGetResponses.EndpointResponse get(GetRequest request) throws IOException, InterruptedException, ValidationException, NotImplementedException, ApiException { + return GetProvider.get(request, getApiConfiguration(), getSchemaConfiguration(), getClient()); + } + } + + public interface WildCardResponsesOperation { + ApiConfiguration getApiConfiguration(); + SchemaConfiguration getSchemaConfiguration(); + HttpClient getClient(); + default FakewildcardresponsesGetResponses.EndpointResponse wildCardResponses(GetRequest request) throws IOException, InterruptedException, ValidationException, NotImplementedException, ApiException { + return GetProvider.get(request, getApiConfiguration(), getSchemaConfiguration(), getClient()); + } + } + + public static class Get extends ApiClient implements GetOperation { + public Get(ApiConfiguration apiConfiguration, SchemaConfiguration schemaConfiguration) { + super(apiConfiguration, schemaConfiguration); + } + } + + public static class GetRequest { + public RootServerInfo.@Nullable ServerIndex serverIndex; + public @Nullable Duration timeout; + } + + public interface SetterForServerIndex { + GetRequest getInstance(); + T getBuilderAfterServerIndex(GetRequest instance); + default T serverIndex(RootServerInfo.ServerIndex serverIndex) { + var instance = getInstance(); + instance.serverIndex = serverIndex; + return getBuilderAfterServerIndex(instance); + } + } + + public interface SetterForTimeout { + GetRequest getInstance(); + T getBuilderAfterTimeout(GetRequest instance); + default T timeout(Duration timeout) { + var instance = getInstance(); + instance.timeout = timeout; + return getBuilderAfterTimeout(instance); + } + } + + public static class GetRequestBuilder implements SetterForServerIndex, SetterForTimeout { + private final GetRequest instance; + + public GetRequestBuilder() { + this.instance = new GetRequest(); + } + + public GetRequest build() { + return instance; + } + + public GetRequest getInstance() { + return instance; + } + + public GetRequestBuilder getBuilderAfterServerIndex(GetRequest instance) { + return this; + } + + public GetRequestBuilder getBuilderAfterTimeout(GetRequest instance) { + return this; + } + } +} diff --git a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/fakewildcardresponses/get/FakewildcardresponsesGetResponses.kt b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/fakewildcardresponses/get/FakewildcardresponsesGetResponses.kt new file mode 100644 index 00000000000..ba1f9d5ac09 --- /dev/null +++ b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/fakewildcardresponses/get/FakewildcardresponsesGetResponses.kt @@ -0,0 +1,139 @@ +package org.openapijsonschematools.client.paths.fakewildcardresponses.get; + +import org.openapijsonschematools.client.paths.fakewildcardresponses.get.responses.FakewildcardresponsesGetCode1XXResponse; +import org.openapijsonschematools.client.paths.fakewildcardresponses.get.responses.FakewildcardresponsesGetCode200Response; +import org.openapijsonschematools.client.paths.fakewildcardresponses.get.responses.FakewildcardresponsesGetCode2XXResponse; +import org.openapijsonschematools.client.paths.fakewildcardresponses.get.responses.FakewildcardresponsesGetCode3XXResponse; +import org.openapijsonschematools.client.paths.fakewildcardresponses.get.responses.FakewildcardresponsesGetCode4XXResponse; +import org.openapijsonschematools.client.paths.fakewildcardresponses.get.responses.FakewildcardresponsesGetCode5XXResponse; +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; +import org.checkerframework.checker.nullness.qual.Nullable; + +import java.net.http.HttpResponse; +import java.util.Map; +import java.util.AbstractMap; + +public class FakewildcardresponsesGetResponses { + public sealed interface EndpointResponse permits EndpointFakewildcardresponsesGetCode1XXResponse, EndpointFakewildcardresponsesGetCode2XXResponse, EndpointFakewildcardresponsesGetCode200Response, EndpointFakewildcardresponsesGetCode3XXResponse {} + + public record EndpointFakewildcardresponsesGetCode1XXResponse( + HttpResponse response, + FakewildcardresponsesGetCode1XXResponse.SealedResponseBody body, + Nothing? headers + ) implements EndpointResponse, ApiResponse{ + } + + public record EndpointFakewildcardresponsesGetCode2XXResponse( + HttpResponse response, + FakewildcardresponsesGetCode2XXResponse.SealedResponseBody body, + Nothing? headers + ) implements EndpointResponse, ApiResponse{ + } + + public record EndpointFakewildcardresponsesGetCode200Response( + HttpResponse response, + FakewildcardresponsesGetCode200Response.SealedResponseBody body, + Nothing? headers + ) implements EndpointResponse, ApiResponse{ + } + + public record EndpointFakewildcardresponsesGetCode3XXResponse( + HttpResponse response, + FakewildcardresponsesGetCode3XXResponse.SealedResponseBody body, + Nothing? headers + ) implements EndpointResponse, ApiResponse{ + } + + public sealed interface StatusCodeResponseDeserializer permits StatusFakewildcardresponsesGetCode200ResponseDeserializer {} + + public static final class StatusFakewildcardresponsesGetCode200ResponseDeserializer extends FakewildcardresponsesGetCode200Response.FakewildcardresponsesGetCode200Response1 implements StatusCodeResponseDeserializer { + } + public sealed interface WildcardCodeResponseDeserializer permits WildcardFakewildcardresponsesGetCode1XXResponseDeserializer, WildcardFakewildcardresponsesGetCode2XXResponseDeserializer, WildcardFakewildcardresponsesGetCode3XXResponseDeserializer, WildcardFakewildcardresponsesGetCode4XXResponseDeserializer, WildcardFakewildcardresponsesGetCode5XXResponseDeserializer {} + + public static final class WildcardFakewildcardresponsesGetCode1XXResponseDeserializer extends FakewildcardresponsesGetCode1XXResponse.FakewildcardresponsesGetCode1XXResponse1 implements WildcardCodeResponseDeserializer { + } + public static final class WildcardFakewildcardresponsesGetCode2XXResponseDeserializer extends FakewildcardresponsesGetCode2XXResponse.FakewildcardresponsesGetCode2XXResponse1 implements WildcardCodeResponseDeserializer { + } + public static final class WildcardFakewildcardresponsesGetCode3XXResponseDeserializer extends FakewildcardresponsesGetCode3XXResponse.FakewildcardresponsesGetCode3XXResponse1 implements WildcardCodeResponseDeserializer { + } + public static final class WildcardFakewildcardresponsesGetCode4XXResponseDeserializer extends FakewildcardresponsesGetCode4XXResponse.FakewildcardresponsesGetCode4XXResponse1 implements WildcardCodeResponseDeserializer { + } + public static final class WildcardFakewildcardresponsesGetCode5XXResponseDeserializer extends FakewildcardresponsesGetCode5XXResponse.FakewildcardresponsesGetCode5XXResponse1 implements WildcardCodeResponseDeserializer { + } + + public static final class FakewildcardresponsesGetResponses1 implements ResponsesDeserializer { + private final Map statusCodeToResponseDeserializer; + private final Map wildcardCodeToResponseDeserializer; + public FakewildcardresponsesGetResponses1() { + this.statusCodeToResponseDeserializer = Map.ofEntries( + new AbstractMap.SimpleEntry<>("200", new StatusFakewildcardresponsesGetCode200ResponseDeserializer()) + ); + this.wildcardCodeToResponseDeserializer = Map.ofEntries( + new AbstractMap.SimpleEntry<>("1", new WildcardFakewildcardresponsesGetCode1XXResponseDeserializer()), + new AbstractMap.SimpleEntry<>("2", new WildcardFakewildcardresponsesGetCode2XXResponseDeserializer()), + new AbstractMap.SimpleEntry<>("3", new WildcardFakewildcardresponsesGetCode3XXResponseDeserializer()), + new AbstractMap.SimpleEntry<>("4", new WildcardFakewildcardresponsesGetCode4XXResponseDeserializer()), + new AbstractMap.SimpleEntry<>("5", new WildcardFakewildcardresponsesGetCode5XXResponseDeserializer()) + ); + } + + 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) { + StatusFakewildcardresponsesGetCode200ResponseDeserializer castDeserializer = (StatusFakewildcardresponsesGetCode200ResponseDeserializer) statusCodeDeserializer; + var deserializedResponse = castDeserializer.deserialize(response, configuration); + return new EndpointFakewildcardresponsesGetCode200Response(response, deserializedResponse.body(), deserializedResponse.headers()); + } + @Nullable WildcardCodeResponseDeserializer wildcardCodeDeserializer = wildcardCodeToResponseDeserializer.get(statusCode); + if (wildcardCodeDeserializer == null) { + throw new ApiException( + "Invalid response statusCode="+statusCode+" has no response defined in the openapi document", + response + ); + } + if (wildcardCodeDeserializer instanceof WildcardFakewildcardresponsesGetCode1XXResponseDeserializer castDeserializer) { + var deserializedResponse = castDeserializer.deserialize(response, configuration); + throw new FakewildcardresponsesGetCode1XXResponse.ResponseApiException( + "Received error statusCode response from server", + response, + deserializedResponse + ); + } else if (wildcardCodeDeserializer instanceof WildcardFakewildcardresponsesGetCode2XXResponseDeserializer castDeserializer) { + var deserializedResponse = castDeserializer.deserialize(response, configuration); + throw new FakewildcardresponsesGetCode2XXResponse.ResponseApiException( + "Received error statusCode response from server", + response, + deserializedResponse + ); + } else if (wildcardCodeDeserializer instanceof WildcardFakewildcardresponsesGetCode3XXResponseDeserializer castDeserializer) { + var deserializedResponse = castDeserializer.deserialize(response, configuration); + throw new FakewildcardresponsesGetCode3XXResponse.ResponseApiException( + "Received error statusCode response from server", + response, + deserializedResponse + ); + } else if (wildcardCodeDeserializer instanceof WildcardFakewildcardresponsesGetCode4XXResponseDeserializer castDeserializer) { + var deserializedResponse = castDeserializer.deserialize(response, configuration); + throw new FakewildcardresponsesGetCode4XXResponse.ResponseApiException( + "Received error statusCode response from server", + response, + deserializedResponse + ); + } else { + WildcardFakewildcardresponsesGetCode5XXResponseDeserializer castDeserializer = (WildcardFakewildcardresponsesGetCode5XXResponseDeserializer) wildcardCodeDeserializer; + var deserializedResponse = castDeserializer.deserialize(response, configuration); + throw new FakewildcardresponsesGetCode5XXResponse.ResponseApiException( + "Received error statusCode response from server", + response, + deserializedResponse + ); + } + } + } +} diff --git a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/fakewildcardresponses/get/responses/FakewildcardresponsesGetCode1XXResponse.kt b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/fakewildcardresponses/get/responses/FakewildcardresponsesGetCode1XXResponse.kt new file mode 100644 index 00000000000..10f6929b9f5 --- /dev/null +++ b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/fakewildcardresponses/get/responses/FakewildcardresponsesGetCode1XXResponse.kt @@ -0,0 +1,63 @@ +package org.openapijsonschematools.client.paths.fakewildcardresponses.get.responses; + +import org.openapijsonschematools.client.configurations.SchemaConfiguration; +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; + +import java.util.AbstractMap; +import java.util.Map; +import java.net.http.HttpResponse; +import java.net.http.HttpHeaders; + +public class FakewildcardresponsesGetCode1XXResponse { + public sealed interface SealedMediaType permits ApplicationjsonMediaType {} + + public record ApplicationjsonMediaType(ApplicationjsonSchema.ApplicationjsonSchema1 schema) implements SealedMediaType, MediaType { + public ApplicationjsonMediaType() { + this(ApplicationjsonSchema.ApplicationjsonSchema1.getInstance()); + } + @Override + public Nothing? encoding() { + return null; + } + } + public sealed interface SealedResponseBody permits ApplicationjsonResponseBody {} + public record ApplicationjsonResponseBody(ApplicationjsonSchema.AnyTypeJsonSchema1Boxed body) implements SealedResponseBody { } + + public static class FakewildcardresponsesGetCode1XXResponse1 extends ResponseDeserializer { + public FakewildcardresponsesGetCode1XXResponse1() { + super( + Map.ofEntries( + new AbstractMap.SimpleEntry<>("application/json", new ApplicationjsonMediaType()) + ) + ); + } + + @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); + } + + @Override + protected Nothing? getHeaders(HttpHeaders headers, SchemaConfiguration configuration) { + return null; + } + } + + @SuppressWarnings("serial") + public static class ResponseApiException extends ApiException { + public DeserializedHttpResponse deserializedResponse; + + public ResponseApiException(String s, HttpResponse response, DeserializedHttpResponse deserializedResponse) { + super(s, response); + this.deserializedResponse = deserializedResponse; + } + } +} diff --git a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/fakewildcardresponses/get/responses/FakewildcardresponsesGetCode200Response.kt b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/fakewildcardresponses/get/responses/FakewildcardresponsesGetCode200Response.kt new file mode 100644 index 00000000000..160aa2aea1d --- /dev/null +++ b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/fakewildcardresponses/get/responses/FakewildcardresponsesGetCode200Response.kt @@ -0,0 +1,63 @@ +package org.openapijsonschematools.client.paths.fakewildcardresponses.get.responses; + +import org.openapijsonschematools.client.configurations.SchemaConfiguration; +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; + +import java.util.AbstractMap; +import java.util.Map; +import java.net.http.HttpResponse; +import java.net.http.HttpHeaders; + +public class FakewildcardresponsesGetCode200Response { + public sealed interface SealedMediaType permits ApplicationjsonMediaType {} + + public record ApplicationjsonMediaType(ApplicationjsonSchema.ApplicationjsonSchema1 schema) implements SealedMediaType, MediaType { + public ApplicationjsonMediaType() { + this(ApplicationjsonSchema.ApplicationjsonSchema1.getInstance()); + } + @Override + public Nothing? encoding() { + return null; + } + } + public sealed interface SealedResponseBody permits ApplicationjsonResponseBody {} + public record ApplicationjsonResponseBody(ApplicationjsonSchema.AnyTypeJsonSchema1Boxed body) implements SealedResponseBody { } + + public static class FakewildcardresponsesGetCode200Response1 extends ResponseDeserializer { + public FakewildcardresponsesGetCode200Response1() { + super( + Map.ofEntries( + new AbstractMap.SimpleEntry<>("application/json", new ApplicationjsonMediaType()) + ) + ); + } + + @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); + } + + @Override + protected Nothing? getHeaders(HttpHeaders headers, SchemaConfiguration configuration) { + return null; + } + } + + @SuppressWarnings("serial") + public static class ResponseApiException extends ApiException { + public DeserializedHttpResponse deserializedResponse; + + public ResponseApiException(String s, HttpResponse response, DeserializedHttpResponse deserializedResponse) { + super(s, response); + this.deserializedResponse = deserializedResponse; + } + } +} diff --git a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/fakewildcardresponses/get/responses/FakewildcardresponsesGetCode2XXResponse.kt b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/fakewildcardresponses/get/responses/FakewildcardresponsesGetCode2XXResponse.kt new file mode 100644 index 00000000000..8e47472d7b3 --- /dev/null +++ b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/fakewildcardresponses/get/responses/FakewildcardresponsesGetCode2XXResponse.kt @@ -0,0 +1,63 @@ +package org.openapijsonschematools.client.paths.fakewildcardresponses.get.responses; + +import org.openapijsonschematools.client.configurations.SchemaConfiguration; +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; + +import java.util.AbstractMap; +import java.util.Map; +import java.net.http.HttpResponse; +import java.net.http.HttpHeaders; + +public class FakewildcardresponsesGetCode2XXResponse { + public sealed interface SealedMediaType permits ApplicationjsonMediaType {} + + public record ApplicationjsonMediaType(ApplicationjsonSchema.ApplicationjsonSchema1 schema) implements SealedMediaType, MediaType { + public ApplicationjsonMediaType() { + this(ApplicationjsonSchema.ApplicationjsonSchema1.getInstance()); + } + @Override + public Nothing? encoding() { + return null; + } + } + public sealed interface SealedResponseBody permits ApplicationjsonResponseBody {} + public record ApplicationjsonResponseBody(ApplicationjsonSchema.AnyTypeJsonSchema1Boxed body) implements SealedResponseBody { } + + public static class FakewildcardresponsesGetCode2XXResponse1 extends ResponseDeserializer { + public FakewildcardresponsesGetCode2XXResponse1() { + super( + Map.ofEntries( + new AbstractMap.SimpleEntry<>("application/json", new ApplicationjsonMediaType()) + ) + ); + } + + @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); + } + + @Override + protected Nothing? getHeaders(HttpHeaders headers, SchemaConfiguration configuration) { + return null; + } + } + + @SuppressWarnings("serial") + public static class ResponseApiException extends ApiException { + public DeserializedHttpResponse deserializedResponse; + + public ResponseApiException(String s, HttpResponse response, DeserializedHttpResponse deserializedResponse) { + super(s, response); + this.deserializedResponse = deserializedResponse; + } + } +} diff --git a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/fakewildcardresponses/get/responses/FakewildcardresponsesGetCode3XXResponse.kt b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/fakewildcardresponses/get/responses/FakewildcardresponsesGetCode3XXResponse.kt new file mode 100644 index 00000000000..5264b1dfbd4 --- /dev/null +++ b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/fakewildcardresponses/get/responses/FakewildcardresponsesGetCode3XXResponse.kt @@ -0,0 +1,63 @@ +package org.openapijsonschematools.client.paths.fakewildcardresponses.get.responses; + +import org.openapijsonschematools.client.configurations.SchemaConfiguration; +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; + +import java.util.AbstractMap; +import java.util.Map; +import java.net.http.HttpResponse; +import java.net.http.HttpHeaders; + +public class FakewildcardresponsesGetCode3XXResponse { + public sealed interface SealedMediaType permits ApplicationjsonMediaType {} + + public record ApplicationjsonMediaType(ApplicationjsonSchema.ApplicationjsonSchema1 schema) implements SealedMediaType, MediaType { + public ApplicationjsonMediaType() { + this(ApplicationjsonSchema.ApplicationjsonSchema1.getInstance()); + } + @Override + public Nothing? encoding() { + return null; + } + } + public sealed interface SealedResponseBody permits ApplicationjsonResponseBody {} + public record ApplicationjsonResponseBody(ApplicationjsonSchema.AnyTypeJsonSchema1Boxed body) implements SealedResponseBody { } + + public static class FakewildcardresponsesGetCode3XXResponse1 extends ResponseDeserializer { + public FakewildcardresponsesGetCode3XXResponse1() { + super( + Map.ofEntries( + new AbstractMap.SimpleEntry<>("application/json", new ApplicationjsonMediaType()) + ) + ); + } + + @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); + } + + @Override + protected Nothing? getHeaders(HttpHeaders headers, SchemaConfiguration configuration) { + return null; + } + } + + @SuppressWarnings("serial") + public static class ResponseApiException extends ApiException { + public DeserializedHttpResponse deserializedResponse; + + public ResponseApiException(String s, HttpResponse response, DeserializedHttpResponse deserializedResponse) { + super(s, response); + this.deserializedResponse = deserializedResponse; + } + } +} diff --git a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/fakewildcardresponses/get/responses/FakewildcardresponsesGetCode4XXResponse.kt b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/fakewildcardresponses/get/responses/FakewildcardresponsesGetCode4XXResponse.kt new file mode 100644 index 00000000000..c0f80c6ebfa --- /dev/null +++ b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/fakewildcardresponses/get/responses/FakewildcardresponsesGetCode4XXResponse.kt @@ -0,0 +1,63 @@ +package org.openapijsonschematools.client.paths.fakewildcardresponses.get.responses; + +import org.openapijsonschematools.client.configurations.SchemaConfiguration; +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; + +import java.util.AbstractMap; +import java.util.Map; +import java.net.http.HttpResponse; +import java.net.http.HttpHeaders; + +public class FakewildcardresponsesGetCode4XXResponse { + public sealed interface SealedMediaType permits ApplicationjsonMediaType {} + + public record ApplicationjsonMediaType(ApplicationjsonSchema.ApplicationjsonSchema1 schema) implements SealedMediaType, MediaType { + public ApplicationjsonMediaType() { + this(ApplicationjsonSchema.ApplicationjsonSchema1.getInstance()); + } + @Override + public Nothing? encoding() { + return null; + } + } + public sealed interface SealedResponseBody permits ApplicationjsonResponseBody {} + public record ApplicationjsonResponseBody(ApplicationjsonSchema.AnyTypeJsonSchema1Boxed body) implements SealedResponseBody { } + + public static class FakewildcardresponsesGetCode4XXResponse1 extends ResponseDeserializer { + public FakewildcardresponsesGetCode4XXResponse1() { + super( + Map.ofEntries( + new AbstractMap.SimpleEntry<>("application/json", new ApplicationjsonMediaType()) + ) + ); + } + + @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); + } + + @Override + protected Nothing? getHeaders(HttpHeaders headers, SchemaConfiguration configuration) { + return null; + } + } + + @SuppressWarnings("serial") + public static class ResponseApiException extends ApiException { + public DeserializedHttpResponse deserializedResponse; + + public ResponseApiException(String s, HttpResponse response, DeserializedHttpResponse deserializedResponse) { + super(s, response); + this.deserializedResponse = deserializedResponse; + } + } +} diff --git a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/fakewildcardresponses/get/responses/FakewildcardresponsesGetCode5XXResponse.kt b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/fakewildcardresponses/get/responses/FakewildcardresponsesGetCode5XXResponse.kt new file mode 100644 index 00000000000..483615c2822 --- /dev/null +++ b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/fakewildcardresponses/get/responses/FakewildcardresponsesGetCode5XXResponse.kt @@ -0,0 +1,63 @@ +package org.openapijsonschematools.client.paths.fakewildcardresponses.get.responses; + +import org.openapijsonschematools.client.configurations.SchemaConfiguration; +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; + +import java.util.AbstractMap; +import java.util.Map; +import java.net.http.HttpResponse; +import java.net.http.HttpHeaders; + +public class FakewildcardresponsesGetCode5XXResponse { + public sealed interface SealedMediaType permits ApplicationjsonMediaType {} + + public record ApplicationjsonMediaType(ApplicationjsonSchema.ApplicationjsonSchema1 schema) implements SealedMediaType, MediaType { + public ApplicationjsonMediaType() { + this(ApplicationjsonSchema.ApplicationjsonSchema1.getInstance()); + } + @Override + public Nothing? encoding() { + return null; + } + } + public sealed interface SealedResponseBody permits ApplicationjsonResponseBody {} + public record ApplicationjsonResponseBody(ApplicationjsonSchema.AnyTypeJsonSchema1Boxed body) implements SealedResponseBody { } + + public static class FakewildcardresponsesGetCode5XXResponse1 extends ResponseDeserializer { + public FakewildcardresponsesGetCode5XXResponse1() { + super( + Map.ofEntries( + new AbstractMap.SimpleEntry<>("application/json", new ApplicationjsonMediaType()) + ) + ); + } + + @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); + } + + @Override + protected Nothing? getHeaders(HttpHeaders headers, SchemaConfiguration configuration) { + return null; + } + } + + @SuppressWarnings("serial") + public static class ResponseApiException extends ApiException { + public DeserializedHttpResponse deserializedResponse; + + public ResponseApiException(String s, HttpResponse response, DeserializedHttpResponse deserializedResponse) { + super(s, response); + this.deserializedResponse = deserializedResponse; + } + } +} diff --git a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/fakewildcardresponses/get/responses/code1xxresponse/content/applicationjson/ApplicationjsonSchema.kt b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/fakewildcardresponses/get/responses/code1xxresponse/content/applicationjson/ApplicationjsonSchema.kt new file mode 100644 index 00000000000..bc6d5118003 --- /dev/null +++ b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/fakewildcardresponses/get/responses/code1xxresponse/content/applicationjson/ApplicationjsonSchema.kt @@ -0,0 +1,19 @@ +package org.openapijsonschematools.client.paths.fakewildcardresponses.get.responses.code1xxresponse.content.applicationjson; +import org.checkerframework.checker.nullness.qual.Nullable; +import org.openapijsonschematools.client.schemas.AnyTypeJsonSchema; + +public class ApplicationjsonSchema extends AnyTypeJsonSchema { + // nest classes so all schemas and input/output classes can be public + + + public static class ApplicationjsonSchema1 extends AnyTypeJsonSchema.AnyTypeJsonSchema1 { + private static @Nullable ApplicationjsonSchema1 instance = null; + public static ApplicationjsonSchema1 getInstance() { + if (instance == null) { + instance = new ApplicationjsonSchema1(); + } + return instance; + } + } + +} diff --git a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/fakewildcardresponses/get/responses/code200response/content/applicationjson/ApplicationjsonSchema.kt b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/fakewildcardresponses/get/responses/code200response/content/applicationjson/ApplicationjsonSchema.kt new file mode 100644 index 00000000000..7e12b7b922a --- /dev/null +++ b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/fakewildcardresponses/get/responses/code200response/content/applicationjson/ApplicationjsonSchema.kt @@ -0,0 +1,19 @@ +package org.openapijsonschematools.client.paths.fakewildcardresponses.get.responses.code200response.content.applicationjson; +import org.checkerframework.checker.nullness.qual.Nullable; +import org.openapijsonschematools.client.schemas.AnyTypeJsonSchema; + +public class ApplicationjsonSchema extends AnyTypeJsonSchema { + // nest classes so all schemas and input/output classes can be public + + + public static class ApplicationjsonSchema1 extends AnyTypeJsonSchema.AnyTypeJsonSchema1 { + private static @Nullable ApplicationjsonSchema1 instance = null; + public static ApplicationjsonSchema1 getInstance() { + if (instance == null) { + instance = new ApplicationjsonSchema1(); + } + return instance; + } + } + +} diff --git a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/fakewildcardresponses/get/responses/code2xxresponse/content/applicationjson/ApplicationjsonSchema.kt b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/fakewildcardresponses/get/responses/code2xxresponse/content/applicationjson/ApplicationjsonSchema.kt new file mode 100644 index 00000000000..a5d19b2fa85 --- /dev/null +++ b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/fakewildcardresponses/get/responses/code2xxresponse/content/applicationjson/ApplicationjsonSchema.kt @@ -0,0 +1,19 @@ +package org.openapijsonschematools.client.paths.fakewildcardresponses.get.responses.code2xxresponse.content.applicationjson; +import org.checkerframework.checker.nullness.qual.Nullable; +import org.openapijsonschematools.client.schemas.AnyTypeJsonSchema; + +public class ApplicationjsonSchema extends AnyTypeJsonSchema { + // nest classes so all schemas and input/output classes can be public + + + public static class ApplicationjsonSchema1 extends AnyTypeJsonSchema.AnyTypeJsonSchema1 { + private static @Nullable ApplicationjsonSchema1 instance = null; + public static ApplicationjsonSchema1 getInstance() { + if (instance == null) { + instance = new ApplicationjsonSchema1(); + } + return instance; + } + } + +} diff --git a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/fakewildcardresponses/get/responses/code3xxresponse/content/applicationjson/ApplicationjsonSchema.kt b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/fakewildcardresponses/get/responses/code3xxresponse/content/applicationjson/ApplicationjsonSchema.kt new file mode 100644 index 00000000000..3b4a18033e7 --- /dev/null +++ b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/fakewildcardresponses/get/responses/code3xxresponse/content/applicationjson/ApplicationjsonSchema.kt @@ -0,0 +1,19 @@ +package org.openapijsonschematools.client.paths.fakewildcardresponses.get.responses.code3xxresponse.content.applicationjson; +import org.checkerframework.checker.nullness.qual.Nullable; +import org.openapijsonschematools.client.schemas.AnyTypeJsonSchema; + +public class ApplicationjsonSchema extends AnyTypeJsonSchema { + // nest classes so all schemas and input/output classes can be public + + + public static class ApplicationjsonSchema1 extends AnyTypeJsonSchema.AnyTypeJsonSchema1 { + private static @Nullable ApplicationjsonSchema1 instance = null; + public static ApplicationjsonSchema1 getInstance() { + if (instance == null) { + instance = new ApplicationjsonSchema1(); + } + return instance; + } + } + +} diff --git a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/fakewildcardresponses/get/responses/code4xxresponse/content/applicationjson/ApplicationjsonSchema.kt b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/fakewildcardresponses/get/responses/code4xxresponse/content/applicationjson/ApplicationjsonSchema.kt new file mode 100644 index 00000000000..346bbf338f9 --- /dev/null +++ b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/fakewildcardresponses/get/responses/code4xxresponse/content/applicationjson/ApplicationjsonSchema.kt @@ -0,0 +1,19 @@ +package org.openapijsonschematools.client.paths.fakewildcardresponses.get.responses.code4xxresponse.content.applicationjson; +import org.checkerframework.checker.nullness.qual.Nullable; +import org.openapijsonschematools.client.schemas.AnyTypeJsonSchema; + +public class ApplicationjsonSchema extends AnyTypeJsonSchema { + // nest classes so all schemas and input/output classes can be public + + + public static class ApplicationjsonSchema1 extends AnyTypeJsonSchema.AnyTypeJsonSchema1 { + private static @Nullable ApplicationjsonSchema1 instance = null; + public static ApplicationjsonSchema1 getInstance() { + if (instance == null) { + instance = new ApplicationjsonSchema1(); + } + return instance; + } + } + +} diff --git a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/fakewildcardresponses/get/responses/code5xxresponse/content/applicationjson/ApplicationjsonSchema.kt b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/fakewildcardresponses/get/responses/code5xxresponse/content/applicationjson/ApplicationjsonSchema.kt new file mode 100644 index 00000000000..6b9394e4858 --- /dev/null +++ b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/fakewildcardresponses/get/responses/code5xxresponse/content/applicationjson/ApplicationjsonSchema.kt @@ -0,0 +1,19 @@ +package org.openapijsonschematools.client.paths.fakewildcardresponses.get.responses.code5xxresponse.content.applicationjson; +import org.checkerframework.checker.nullness.qual.Nullable; +import org.openapijsonschematools.client.schemas.AnyTypeJsonSchema; + +public class ApplicationjsonSchema extends AnyTypeJsonSchema { + // nest classes so all schemas and input/output classes can be public + + + public static class ApplicationjsonSchema1 extends AnyTypeJsonSchema.AnyTypeJsonSchema1 { + private static @Nullable ApplicationjsonSchema1 instance = null; + public static ApplicationjsonSchema1 getInstance() { + if (instance == null) { + instance = new ApplicationjsonSchema1(); + } + return instance; + } + } + +} diff --git a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/foo/FooGet.kt b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/foo/FooGet.kt new file mode 100644 index 00000000000..e5828e4cfe5 --- /dev/null +++ b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/foo/FooGet.kt @@ -0,0 +1,124 @@ +package org.openapijsonschematools.client.paths.foo; + +import org.checkerframework.checker.nullness.qual.Nullable; +import org.openapijsonschematools.client.paths.foo.get.FooGetServerInfo; +import org.openapijsonschematools.client.paths.foo.get.FooGetResponses; +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.paths.Foo; + +import java.io.IOException; +import java.net.http.HttpClient; +import java.net.http.HttpRequest; +import java.time.Duration; +import java.util.List; +import java.util.Map; + +public class FooGet { + private static class GetProvider { + private static final String method = "get"; + + public static FooGetResponses.EndpointResponse get( + GetRequest request, + ApiConfiguration apiConfiguration, + SchemaConfiguration schemaConfiguration, + HttpClient client + ) 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 + @Nullable Map queryMap = null; + String host = apiConfiguration.getServer(request.serverIndex).url(); + + String url = host + Foo.path; + var httpRequest = RestClient.getRequest( + url, + method, + bodyPublisher, + headers, + request.timeout + ); + var response = RestClient.getResponse(httpRequest, client); + var responsesDeserializer = new FooGetResponses.FooGetResponses1(); + return responsesDeserializer.deserialize(response, schemaConfiguration); + } + } + + public interface GetOperation { + ApiConfiguration getApiConfiguration(); + SchemaConfiguration getSchemaConfiguration(); + HttpClient getClient(); + default FooGetResponses.EndpointResponse get(GetRequest request) throws IOException, InterruptedException, ValidationException, NotImplementedException, ApiException { + return GetProvider.get(request, getApiConfiguration(), getSchemaConfiguration(), getClient()); + } + } + + public interface FooGetOperation { + ApiConfiguration getApiConfiguration(); + SchemaConfiguration getSchemaConfiguration(); + HttpClient getClient(); + default FooGetResponses.EndpointResponse fooGet(GetRequest request) throws IOException, InterruptedException, ValidationException, NotImplementedException, ApiException { + return GetProvider.get(request, getApiConfiguration(), getSchemaConfiguration(), getClient()); + } + } + + public static class Get extends ApiClient implements GetOperation { + public Get(ApiConfiguration apiConfiguration, SchemaConfiguration schemaConfiguration) { + super(apiConfiguration, schemaConfiguration); + } + } + + public static class GetRequest { + public FooGetServerInfo.@Nullable ServerIndex serverIndex; + public @Nullable Duration timeout; + } + + public interface SetterForServerIndex { + GetRequest getInstance(); + T getBuilderAfterServerIndex(GetRequest instance); + default T serverIndex(FooGetServerInfo.ServerIndex serverIndex) { + var instance = getInstance(); + instance.serverIndex = serverIndex; + return getBuilderAfterServerIndex(instance); + } + } + + public interface SetterForTimeout { + GetRequest getInstance(); + T getBuilderAfterTimeout(GetRequest instance); + default T timeout(Duration timeout) { + var instance = getInstance(); + instance.timeout = timeout; + return getBuilderAfterTimeout(instance); + } + } + + public static class GetRequestBuilder implements SetterForServerIndex, SetterForTimeout { + private final GetRequest instance; + + public GetRequestBuilder() { + this.instance = new GetRequest(); + } + + public GetRequest build() { + return instance; + } + + public GetRequest getInstance() { + return instance; + } + + public GetRequestBuilder getBuilderAfterServerIndex(GetRequest instance) { + return this; + } + + public GetRequestBuilder getBuilderAfterTimeout(GetRequest instance) { + return this; + } + } +} diff --git a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/foo/get/FooGetResponses.kt b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/foo/get/FooGetResponses.kt new file mode 100644 index 00000000000..a1de2d65b66 --- /dev/null +++ b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/foo/get/FooGetResponses.kt @@ -0,0 +1,37 @@ +package org.openapijsonschematools.client.paths.foo.get; + +import org.openapijsonschematools.client.paths.foo.get.responses.FooGetCodedefaultResponse; +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; +import org.checkerframework.checker.nullness.qual.Nullable; + +import java.net.http.HttpResponse; +import java.util.Map; +import java.util.AbstractMap; + +public class FooGetResponses { + public sealed interface EndpointResponse permits EndpointFooGetCodedefaultResponse {} + + public record EndpointFooGetCodedefaultResponse( + HttpResponse response, + FooGetCodedefaultResponse.SealedResponseBody body, + Nothing? headers + ) implements EndpointResponse, ApiResponse{ + } + + public static final class FooGetResponses1 implements ResponsesDeserializer { + private final FooGetCodedefaultResponse.FooGetCodedefaultResponse1 defaultResponseDeserializer; + public FooGetResponses1() { + this.defaultResponseDeserializer = new FooGetCodedefaultResponse.FooGetCodedefaultResponse1(); + } + + public EndpointResponse deserialize(HttpResponse response, SchemaConfiguration configuration) throws ValidationException, NotImplementedException, ApiException { + var deserializedResponse = defaultResponseDeserializer.deserialize(response, configuration); + return new EndpointFooGetCodedefaultResponse(response, deserializedResponse.body(), deserializedResponse.headers()); + } + } +} diff --git a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/foo/get/FooGetServerInfo.kt b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/foo/get/FooGetServerInfo.kt new file mode 100644 index 00000000000..ca1bc261831 --- /dev/null +++ b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/foo/get/FooGetServerInfo.kt @@ -0,0 +1,63 @@ +package org.openapijsonschematools.client.paths.foo.get; + +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.Objects; + +public class FooGetServerInfo { + public static class FooGetServerInfo1 implements ServerProvider { + private final FooGetServer0 server0; + private final FooGetServer1 server1; + + FooGetServerInfo1( + @Nullable FooGetServer0 server0, + @Nullable FooGetServer1 server1 + ) { + this.server0 = Objects.requireNonNullElseGet(server0, FooGetServer0::new); + this.server1 = Objects.requireNonNullElseGet(server1, FooGetServer1::new); + } + + @Override + public Server getServer(ServerIndex serverIndex) { + switch (serverIndex) { + case SERVER_0: + return server0; + default: + return server1; + } + } + } + + public static class FooGetServerInfoBuilder { + private @Nullable FooGetServer0 server0; + private @Nullable FooGetServer1 server1; + + public FooGetServerInfoBuilder() {} + + public FooGetServerInfoBuilder fooGetServer0(FooGetServer0 server0) { + this.server0 = server0; + return this; + } + + public FooGetServerInfoBuilder fooGetServer1(FooGetServer1 server1) { + this.server1 = server1; + return this; + } + + public FooGetServerInfo1 build() { + return new FooGetServerInfo1( + server0, + server1 + ); + } + } + + public enum ServerIndex { + SERVER_0, + SERVER_1 + } +} \ No newline at end of file diff --git a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/foo/get/responses/FooGetCodedefaultResponse.kt b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/foo/get/responses/FooGetCodedefaultResponse.kt new file mode 100644 index 00000000000..8ee177ea363 --- /dev/null +++ b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/foo/get/responses/FooGetCodedefaultResponse.kt @@ -0,0 +1,63 @@ +package org.openapijsonschematools.client.paths.foo.get.responses; + +import org.openapijsonschematools.client.configurations.SchemaConfiguration; +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; + +import java.util.AbstractMap; +import java.util.Map; +import java.net.http.HttpResponse; +import java.net.http.HttpHeaders; + +public class FooGetCodedefaultResponse { + public sealed interface SealedMediaType permits ApplicationjsonMediaType {} + + public record ApplicationjsonMediaType(ApplicationjsonSchema.ApplicationjsonSchema1 schema) implements SealedMediaType, MediaType { + public ApplicationjsonMediaType() { + this(ApplicationjsonSchema.ApplicationjsonSchema1.getInstance()); + } + @Override + public Nothing? encoding() { + return null; + } + } + public sealed interface SealedResponseBody permits ApplicationjsonResponseBody {} + public record ApplicationjsonResponseBody(ApplicationjsonSchema.ApplicationjsonSchema1Boxed body) implements SealedResponseBody { } + + public static class FooGetCodedefaultResponse1 extends ResponseDeserializer { + public FooGetCodedefaultResponse1() { + super( + Map.ofEntries( + new AbstractMap.SimpleEntry<>("application/json", new ApplicationjsonMediaType()) + ) + ); + } + + @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); + } + + @Override + protected Nothing? getHeaders(HttpHeaders headers, SchemaConfiguration configuration) { + return null; + } + } + + @SuppressWarnings("serial") + public static class ResponseApiException extends ApiException { + public DeserializedHttpResponse deserializedResponse; + + public ResponseApiException(String s, HttpResponse response, DeserializedHttpResponse deserializedResponse) { + super(s, response); + this.deserializedResponse = deserializedResponse; + } + } +} diff --git a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/foo/get/responses/codedefaultresponse/content/applicationjson/ApplicationjsonSchema.kt b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/foo/get/responses/codedefaultresponse/content/applicationjson/ApplicationjsonSchema.kt new file mode 100644 index 00000000000..9867420cf75 --- /dev/null +++ b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/foo/get/responses/codedefaultresponse/content/applicationjson/ApplicationjsonSchema.kt @@ -0,0 +1,179 @@ +package org.openapijsonschematools.client.paths.foo.get.responses.codedefaultresponse.content.applicationjson; +import java.util.ArrayList; +import java.util.HashSet; +import java.util.LinkedHashMap; +import java.util.LinkedHashSet; +import java.util.List; +import java.util.Map; +import java.util.Objects; +import java.util.Set; +import org.checkerframework.checker.nullness.qual.Nullable; +import org.openapijsonschematools.client.components.schemas.Foo; +import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags; +import org.openapijsonschematools.client.configurations.SchemaConfiguration; +import org.openapijsonschematools.client.exceptions.InvalidAdditionalPropertyException; +import org.openapijsonschematools.client.exceptions.UnsetPropertyException; +import org.openapijsonschematools.client.exceptions.ValidationException; +import org.openapijsonschematools.client.schemas.GenericBuilder; +import org.openapijsonschematools.client.schemas.UnsetAddPropsSetter; +import org.openapijsonschematools.client.schemas.validation.FrozenMap; +import org.openapijsonschematools.client.schemas.validation.JsonSchema; +import org.openapijsonschematools.client.schemas.validation.JsonSchemaInfo; +import org.openapijsonschematools.client.schemas.validation.MapSchemaValidator; +import org.openapijsonschematools.client.schemas.validation.PathToSchemasMap; +import org.openapijsonschematools.client.schemas.validation.PropertyEntry; +import org.openapijsonschematools.client.schemas.validation.ValidationMetadata; + +public class ApplicationjsonSchema { + // nest classes so all schemas and input/output classes can be public + + + public static class ApplicationjsonSchemaMap extends FrozenMap<@Nullable Object> { + protected ApplicationjsonSchemaMap(FrozenMap<@Nullable Object> m) { + super(m); + } + public static final Set requiredKeys = Set.of(); + public static final Set optionalKeys = Set.of( + "string" + ); + public static ApplicationjsonSchemaMap of(Map arg, SchemaConfiguration configuration) throws ValidationException { + return ApplicationjsonSchema1.getInstance().validate(arg, configuration); + } + + public @Nullable Object getAdditionalProperty(String name) throws UnsetPropertyException, InvalidAdditionalPropertyException { + throwIfKeyKnown(name, requiredKeys, optionalKeys); + throwIfKeyNotPresent(name); + return get(name); + } + } + + public interface SetterForApplicationjsonString { + Map getInstance(); + T getBuilderAfterApplicationjsonString(Map instance); + + default T setString(Map value) { + var instance = getInstance(); + instance.put("string", value); + return getBuilderAfterApplicationjsonString(instance); + } + } + + public static class ApplicationjsonSchemaMapBuilder extends UnsetAddPropsSetter implements GenericBuilder>, SetterForApplicationjsonString { + private final Map instance; + private static final Set knownKeys = Set.of( + "string" + ); + public Set getKnownKeys() { + return knownKeys; + } + public ApplicationjsonSchemaMapBuilder() { + this.instance = new LinkedHashMap<>(); + } + public Map build() { + return instance; + } + public Map getInstance() { + return instance; + } + public ApplicationjsonSchemaMapBuilder getBuilderAfterApplicationjsonString(Map instance) { + return this; + } + public ApplicationjsonSchemaMapBuilder getBuilderAfterAdditionalProperty(Map instance) { + return this; + } + } + + + public sealed interface ApplicationjsonSchema1Boxed permits ApplicationjsonSchema1BoxedMap { + @Nullable Object getData(); + } + + public record ApplicationjsonSchema1BoxedMap(ApplicationjsonSchemaMap data) implements ApplicationjsonSchema1Boxed { + @Override + public @Nullable Object getData() { + return data; + } + } + + + public static class ApplicationjsonSchema1 extends JsonSchema implements MapSchemaValidator { + private static @Nullable ApplicationjsonSchema1 instance = null; + + protected ApplicationjsonSchema1() { + super(new JsonSchemaInfo() + .type(Set.of(Map.class)) + .properties(Map.ofEntries( + new PropertyEntry("string", Foo.Foo1.class) + )) + ); + } + + public static ApplicationjsonSchema1 getInstance() { + if (instance == null) { + instance = new ApplicationjsonSchema1(); + } + return instance; + } + + 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 RuntimeException("Invalid non-string key value"); + } + String propertyName = (String) entryKey; + List propertyPathToItem = new ArrayList<>(pathToItem); + propertyPathToItem.add(propertyName); + Object value = entry.getValue(); + LinkedHashMap, Nothing?> schemas = pathToSchemas.get(propertyPathToItem); + if (schemas == null) { + throw new RuntimeException("Validation result is invalid, schemas must exist for a pathToItem"); + } + JsonSchema propertySchema = schemas.entrySet().iterator().next().getKey(); + @Nullable Object propertyInstance = propertySchema.getNewInstance(value, propertyPathToItem, pathToSchemas); + properties.put(propertyName, propertyInstance); + } + FrozenMap<@Nullable Object> castProperties = new FrozenMap<>(properties); + return new ApplicationjsonSchemaMap(castProperties); + } + + 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); + SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().build())); + ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, new PathToSchemasMap(), new LinkedHashSet<>()); + PathToSchemasMap pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet); + return getNewInstance(castArg, validationMetadata.pathToItem(), pathToSchemasMap); + } + + + @Override + public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws 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"); + } + @Override + public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { + if (arg instanceof Map) { + return getNewInstance((Map) arg, pathToItem, pathToSchemas); + } + 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 { + return new ApplicationjsonSchema1BoxedMap(validate(arg, configuration)); + } + @Override + public ApplicationjsonSchema1Boxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { + 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"); + } + } + +} diff --git a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/foo/get/servers/FooGetServer0.kt b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/foo/get/servers/FooGetServer0.kt new file mode 100644 index 00000000000..1ea6b69b607 --- /dev/null +++ b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/foo/get/servers/FooGetServer0.kt @@ -0,0 +1,9 @@ +package org.openapijsonschematools.client.paths.foo.get.servers; + +import org.openapijsonschematools.client.servers.ServerWithoutVariables; + +public class FooGetServer0 extends ServerWithoutVariables { + public FooGetServer0() { + super("https://path-server-test.petstore.local/v2"); + } +} diff --git a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/foo/get/servers/FooGetServer1.kt b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/foo/get/servers/FooGetServer1.kt new file mode 100644 index 00000000000..06657dc917f --- /dev/null +++ b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/foo/get/servers/FooGetServer1.kt @@ -0,0 +1,35 @@ +package org.openapijsonschematools.client.paths.foo.get.servers; + +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.FooGetServer1Variables; + +import java.util.AbstractMap; + +public class FooGetServer1 extends ServerWithVariables { + private static FooGetServer1Variables.VariablesMap getVariables() { + try { + return FooGetServer1Variables.FooGetServer1Variables1.getInstance().validate( + MapUtils.makeMap( + new AbstractMap.SimpleEntry<>("version", FooGetServer1Variables.Version.getInstance().defaultValue()) + ), + new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().build()) + ); + } catch (ValidationException e) { + throw new RuntimeException(e); + } + } + + public FooGetServer1() { + super( + "https://petstore.swagger.io/{version}", + getVariables() + ); + } + public FooGetServer1(FooGetServer1Variables.VariablesMap variables) { + super("https://petstore.swagger.io/{version}", variables); + } +} diff --git a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/foo/get/servers/server1/FooGetServer1Variables.kt b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/foo/get/servers/server1/FooGetServer1Variables.kt new file mode 100644 index 00000000000..25a4f1a4dd2 --- /dev/null +++ b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/foo/get/servers/server1/FooGetServer1Variables.kt @@ -0,0 +1,313 @@ +package org.openapijsonschematools.client.paths.foo.get.servers.server1; +import java.util.ArrayList; +import java.util.HashSet; +import java.util.LinkedHashMap; +import java.util.LinkedHashSet; +import java.util.List; +import java.util.Map; +import java.util.Objects; +import java.util.Set; +import org.checkerframework.checker.nullness.qual.Nullable; +import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags; +import org.openapijsonschematools.client.configurations.SchemaConfiguration; +import org.openapijsonschematools.client.exceptions.UnsetPropertyException; +import org.openapijsonschematools.client.exceptions.ValidationException; +import org.openapijsonschematools.client.schemas.AnyTypeJsonSchema; +import org.openapijsonschematools.client.schemas.GenericBuilder; +import org.openapijsonschematools.client.schemas.NotAnyTypeJsonSchema; +import org.openapijsonschematools.client.schemas.SetMaker; +import org.openapijsonschematools.client.schemas.validation.DefaultValueMethod; +import org.openapijsonschematools.client.schemas.validation.FrozenMap; +import org.openapijsonschematools.client.schemas.validation.JsonSchema; +import org.openapijsonschematools.client.schemas.validation.JsonSchemaInfo; +import org.openapijsonschematools.client.schemas.validation.MapSchemaValidator; +import org.openapijsonschematools.client.schemas.validation.MapUtils; +import org.openapijsonschematools.client.schemas.validation.PathToSchemasMap; +import org.openapijsonschematools.client.schemas.validation.PropertyEntry; +import org.openapijsonschematools.client.schemas.validation.StringEnumValidator; +import org.openapijsonschematools.client.schemas.validation.StringSchemaValidator; +import org.openapijsonschematools.client.schemas.validation.StringValueMethod; +import org.openapijsonschematools.client.schemas.validation.ValidationMetadata; + +public class FooGetServer1Variables { + // nest classes so all schemas and input/output classes can be public + + + public static class AdditionalProperties extends NotAnyTypeJsonSchema.NotAnyTypeJsonSchema1 { + // NotAnyTypeSchema + private static @Nullable AdditionalProperties instance = null; + public static AdditionalProperties getInstance() { + if (instance == null) { + instance = new AdditionalProperties(); + } + return instance; + } + } + + public enum StringVersionEnums implements StringValueMethod { + V1("v1"), + V2("v2"); + private final String value; + + StringVersionEnums(String value) { + this.value = value; + } + public String value() { + return this.value; + } + } + + + public sealed interface VersionBoxed permits VersionBoxedString { + @Nullable Object getData(); + } + + public record VersionBoxedString(String data) implements VersionBoxed { + @Override + public @Nullable Object getData() { + return data; + } + } + + + + public static class Version extends JsonSchema implements StringSchemaValidator, StringEnumValidator, DefaultValueMethod { + private static @Nullable Version instance = null; + + protected Version() { + super(new JsonSchemaInfo() + .type(Set.of( + String.class + )) + .enumValues(SetMaker.makeSet( + "v1", + "v2" + )) + .defaultValue("v1") + ); + } + + public static Version getInstance() { + if (instance == null) { + instance = new Version(); + } + return instance; + } + + @Override + public String validate(String arg, SchemaConfiguration configuration) throws ValidationException { + Set> pathSet = new HashSet<>(); + List pathToItem = List.of("args[0"); + String castArg = castToAllowedTypes(arg, pathToItem, pathSet); + SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().build())); + ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, new PathToSchemasMap(), new LinkedHashSet<>()); + getPathToSchemas(this, castArg, validationMetadata, pathSet); + return castArg; + } + + @Override + 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 { + 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"); + } + @Override + public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { + 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"); + } + public String defaultValue() throws ValidationException { + if (defaultValue instanceof String) { + return (String) defaultValue; + } + throw new ValidationException("Invalid type stored in defaultValue"); + } + @Override + 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 { + 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"); + } + } + + public static class VariablesMap extends FrozenMap { + protected VariablesMap(FrozenMap m) { + super(m); + } + public static final Set requiredKeys = Set.of( + "version" + ); + public static final Set optionalKeys = Set.of(); + public static VariablesMap of(Map arg, SchemaConfiguration configuration) throws ValidationException { + return FooGetServer1Variables1.getInstance().validate(arg, configuration); + } + + public String version() { + try { + return getOrThrow("version"); + } catch (UnsetPropertyException e) { + throw new RuntimeException(e); + } + } + } + + public interface SetterForVersion { + Map getInstance(); + T getBuilderAfterVersion(Map instance); + + default T version(String value) { + var instance = getInstance(); + instance.put("version", value); + return getBuilderAfterVersion(instance); + } + + default T version(StringVersionEnums value) { + var instance = getInstance(); + instance.put("version", value.value()); + return getBuilderAfterVersion(instance); + } + } + + public static class VariablesMap0Builder implements GenericBuilder> { + private final Map instance; + private static final Set knownKeys = Set.of( + "version" + ); + public Set getKnownKeys() { + return knownKeys; + } + public VariablesMap0Builder(Map instance) { + this.instance = instance; + } + public Map build() { + return instance; + } + } + + public static class VariablesMapBuilder implements SetterForVersion { + private final Map instance; + public VariablesMapBuilder() { + this.instance = new LinkedHashMap<>(); + } + public Map getInstance() { + return instance; + } + public VariablesMap0Builder getBuilderAfterVersion(Map instance) { + return new VariablesMap0Builder(instance); + } + } + + + public sealed interface FooGetServer1Variables1Boxed permits FooGetServer1Variables1BoxedMap { + @Nullable Object getData(); + } + + public record FooGetServer1Variables1BoxedMap(VariablesMap data) implements FooGetServer1Variables1Boxed { + @Override + public @Nullable Object getData() { + return data; + } + } + + + public static class FooGetServer1Variables1 extends JsonSchema implements MapSchemaValidator { + private static @Nullable FooGetServer1Variables1 instance = null; + + protected FooGetServer1Variables1() { + super(new JsonSchemaInfo() + .type(Set.of(Map.class)) + .properties(Map.ofEntries( + new PropertyEntry("version", Version.class) + )) + .required(Set.of( + "version" + )) + .additionalProperties(AdditionalProperties.class) + ); + } + + public static FooGetServer1Variables1 getInstance() { + if (instance == null) { + instance = new FooGetServer1Variables1(); + } + return instance; + } + + 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 RuntimeException("Invalid non-string key value"); + } + String propertyName = (String) entryKey; + List propertyPathToItem = new ArrayList<>(pathToItem); + propertyPathToItem.add(propertyName); + Object value = entry.getValue(); + LinkedHashMap, Nothing?> schemas = pathToSchemas.get(propertyPathToItem); + if (schemas == null) { + throw new RuntimeException("Validation 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"); + } + properties.put(propertyName, (String) propertyInstance); + } + FrozenMap castProperties = new FrozenMap<>(properties); + return new VariablesMap(castProperties); + } + + 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); + SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().build())); + ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, new PathToSchemasMap(), new LinkedHashSet<>()); + PathToSchemasMap pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet); + return getNewInstance(castArg, validationMetadata.pathToItem(), pathToSchemasMap); + } + + + @Override + public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws 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"); + } + @Override + public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { + if (arg instanceof Map) { + return getNewInstance((Map) arg, pathToItem, pathToSchemas); + } + throw new RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); + } + @Override + public FooGetServer1Variables1BoxedMap validateAndBox(Map arg, SchemaConfiguration configuration) throws ValidationException { + return new FooGetServer1Variables1BoxedMap(validate(arg, configuration)); + } + @Override + public FooGetServer1Variables1Boxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { + 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"); + } + } + +} diff --git a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/pet/PetPost.kt b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/pet/PetPost.kt new file mode 100644 index 00000000000..1f9d0dc8431 --- /dev/null +++ b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/pet/PetPost.kt @@ -0,0 +1,215 @@ +package org.openapijsonschematools.client.paths.pet; + +import org.checkerframework.checker.nullness.qual.Nullable; +import org.openapijsonschematools.client.RootServerInfo; +import org.openapijsonschematools.client.paths.pet.post.PetPostSecurityInfo; +import org.openapijsonschematools.client.paths.pet.post.PetPostRequestBody; +import org.openapijsonschematools.client.paths.pet.post.PetPostResponses; +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.requestbody.SerializedRequestBody; +import org.openapijsonschematools.client.paths.Pet; +import org.openapijsonschematools.client.securityrequirementobjects.SecurityRequirementObject; +import org.openapijsonschematools.client.securityrequirementobjects.AuthApplier; + +import java.io.IOException; +import java.util.ArrayList; +import java.net.http.HttpClient; +import java.net.http.HttpRequest; +import java.time.Duration; +import java.util.List; +import java.util.Map; + +public class PetPost { + private static class PostProvider extends AuthApplier { + private static final String method = "post"; + + public static PetPostResponses.EndpointResponse post( + PostRequest request, + ApiConfiguration apiConfiguration, + SchemaConfiguration schemaConfiguration, + HttpClient client + ) throws IOException, InterruptedException, ValidationException, NotImplementedException, ApiException { + Map> headers = apiConfiguration.getDefaultHeaders(); + + SerializedRequestBody serializedRequestBody = new PetPostRequestBody.PetPostRequestBody1().serialize( + request.requestBody + ); + var contentTypeHeaderValues = headers.getOrDefault("Content-Type", new ArrayList<>()); + contentTypeHeaderValues.add(serializedRequestBody.contentType); + HttpRequest.BodyPublisher bodyPublisher = serializedRequestBody.bodyPublisher; + // TODO set this to a map if there is a query security scheme + @Nullable Map queryMap = null; + String host = apiConfiguration.getServer(request.serverIndex).url(); + SecurityRequirementObject securityRequirementObject = apiConfiguration.getSecurityRequirementObject(request.securityIndex); + updateParamsForAuth( + securityRequirementObject, + headers, + Pet.path, + method, + bodyPublisher, + queryMap, + apiConfiguration + ); + + String url = host + Pet.path; + var httpRequest = RestClient.getRequest( + url, + method, + bodyPublisher, + headers, + request.timeout + ); + var response = RestClient.getResponse(httpRequest, client); + var responsesDeserializer = new PetPostResponses.PetPostResponses1(); + return responsesDeserializer.deserialize(response, schemaConfiguration); + } + } + + public interface PostOperation { + ApiConfiguration getApiConfiguration(); + SchemaConfiguration getSchemaConfiguration(); + HttpClient getClient(); + default PetPostResponses.EndpointResponse post(PostRequest request) throws IOException, InterruptedException, ValidationException, NotImplementedException, ApiException { + return PostProvider.post(request, getApiConfiguration(), getSchemaConfiguration(), getClient()); + } + } + + public interface AddPetOperation { + ApiConfiguration getApiConfiguration(); + SchemaConfiguration getSchemaConfiguration(); + HttpClient getClient(); + default PetPostResponses.EndpointResponse addPet(PostRequest request) throws IOException, InterruptedException, ValidationException, NotImplementedException, ApiException { + return PostProvider.post(request, getApiConfiguration(), getSchemaConfiguration(), getClient()); + } + } + + public static class Post extends ApiClient implements PostOperation { + public Post(ApiConfiguration apiConfiguration, SchemaConfiguration schemaConfiguration) { + super(apiConfiguration, schemaConfiguration); + } + } + + public static class PostRequest { + public PetPostRequestBody.SealedRequestBody requestBody; + public RootServerInfo.@Nullable ServerIndex serverIndex; + public PetPostSecurityInfo.@Nullable SecurityIndex securityIndex; + public @Nullable Duration timeout; + + public PostRequest( + PetPostRequestBody.SealedRequestBody requestBody, + RootServerInfo.@Nullable ServerIndex serverIndex, + PetPostSecurityInfo.@Nullable SecurityIndex securityIndex, + @Nullable Duration timeout + ) { + this.requestBody = requestBody; + this.serverIndex = serverIndex; + this.securityIndex = securityIndex; + this.timeout = timeout; + } + } + + public static class PostNullableRequest { + public PetPostRequestBody.@Nullable SealedRequestBody requestBody; + public RootServerInfo.@Nullable ServerIndex serverIndex; + public PetPostSecurityInfo.@Nullable SecurityIndex securityIndex; + public @Nullable Duration timeout; + } + + public interface SetterForServerIndex { + PostNullableRequest getInstance(); + T getBuilderAfterServerIndex(PostNullableRequest instance); + default T serverIndex(RootServerInfo.ServerIndex serverIndex) { + var instance = getInstance(); + instance.serverIndex = serverIndex; + return getBuilderAfterServerIndex(instance); + } + } + + public interface SetterForSecurityIndex { + PostNullableRequest getInstance(); + T getBuilderAfterSecurityIndex(PostNullableRequest instance); + default T securityIndex(PetPostSecurityInfo.SecurityIndex securityIndex) { + var instance = getInstance(); + instance.securityIndex = securityIndex; + return getBuilderAfterSecurityIndex(instance); + } + } + + public interface SetterForTimeout { + PostNullableRequest getInstance(); + T getBuilderAfterTimeout(PostNullableRequest instance); + default T timeout(Duration timeout) { + var instance = getInstance(); + instance.timeout = timeout; + return getBuilderAfterTimeout(instance); + } + } + + public interface SetterForRequestBody { + PostNullableRequest getInstance(); + T getBuilderAfterRequestBody(PostNullableRequest instance); + default T requestBody(PetPostRequestBody.SealedRequestBody requestBody) { + var instance = getInstance(); + instance.requestBody = requestBody; + return getBuilderAfterRequestBody(instance); + } + } + + public static class Post0RequestBuilder implements SetterForServerIndex, SetterForSecurityIndex, SetterForTimeout { + private final PostNullableRequest instance; + + public Post0RequestBuilder(PostNullableRequest instance) { + this.instance = instance; + } + + public PostRequest build() { + var requestBody = instance.requestBody; + if (requestBody == null) { + throw new RuntimeException("invalid null value for required parameter"); + } + return new PostRequest( + requestBody, + instance.serverIndex, + instance.securityIndex, + instance.timeout + ); + } + + public PostNullableRequest getInstance() { + return instance; + } + + public Post0RequestBuilder getBuilderAfterServerIndex(PostNullableRequest instance) { + return this; + } + + public Post0RequestBuilder getBuilderAfterSecurityIndex(PostNullableRequest instance) { + return this; + } + + public Post0RequestBuilder getBuilderAfterTimeout(PostNullableRequest instance) { + return this; + } + } + public static class PostRequestBuilder implements SetterForRequestBody { + private final PostNullableRequest instance; + + public PostRequestBuilder() { + this.instance = new PostNullableRequest(); + } + + public PostNullableRequest getInstance() { + return instance; + } + + public Post0RequestBuilder getBuilderAfterRequestBody(PostNullableRequest instance) { + return new Post0RequestBuilder(instance); + } + } +} diff --git a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/pet/PetPut.kt b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/pet/PetPut.kt new file mode 100644 index 00000000000..dcf715f2067 --- /dev/null +++ b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/pet/PetPut.kt @@ -0,0 +1,214 @@ +package org.openapijsonschematools.client.paths.pet; + +import org.checkerframework.checker.nullness.qual.Nullable; +import org.openapijsonschematools.client.RootServerInfo; +import org.openapijsonschematools.client.paths.pet.put.PetPutSecurityInfo; +import org.openapijsonschematools.client.paths.pet.put.PetPutRequestBody; +import org.openapijsonschematools.client.paths.pet.put.PetPutResponses; +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.requestbody.SerializedRequestBody; +import org.openapijsonschematools.client.paths.Pet; +import org.openapijsonschematools.client.securityrequirementobjects.SecurityRequirementObject; +import org.openapijsonschematools.client.securityrequirementobjects.AuthApplier; + +import java.io.IOException; +import java.util.ArrayList; +import java.net.http.HttpClient; +import java.net.http.HttpRequest; +import java.time.Duration; +import java.util.List; +import java.util.Map; + +public class PetPut { + private static class PutProvider extends AuthApplier { + private static final String method = "put"; + + public static Nothing? put( + PutRequest request, + ApiConfiguration apiConfiguration, + SchemaConfiguration schemaConfiguration, + HttpClient client + ) throws IOException, InterruptedException, ValidationException, NotImplementedException, ApiException { + Map> headers = apiConfiguration.getDefaultHeaders(); + + SerializedRequestBody serializedRequestBody = new PetPutRequestBody.PetPutRequestBody1().serialize( + request.requestBody + ); + var contentTypeHeaderValues = headers.getOrDefault("Content-Type", new ArrayList<>()); + contentTypeHeaderValues.add(serializedRequestBody.contentType); + HttpRequest.BodyPublisher bodyPublisher = serializedRequestBody.bodyPublisher; + // TODO set this to a map if there is a query security scheme + @Nullable Map queryMap = null; + String host = apiConfiguration.getServer(request.serverIndex).url(); + SecurityRequirementObject securityRequirementObject = apiConfiguration.getSecurityRequirementObject(request.securityIndex); + updateParamsForAuth( + securityRequirementObject, + headers, + Pet.path, + method, + bodyPublisher, + queryMap, + apiConfiguration + ); + + String url = host + Pet.path; + var httpRequest = RestClient.getRequest( + url, + method, + bodyPublisher, + headers, + request.timeout + ); + var response = RestClient.getResponse(httpRequest, client); + return (Nothing?) null; + } + } + + public interface PutOperation { + ApiConfiguration getApiConfiguration(); + SchemaConfiguration getSchemaConfiguration(); + HttpClient getClient(); + default Nothing? put(PutRequest request) throws IOException, InterruptedException, ValidationException, NotImplementedException, ApiException { + return PutProvider.put(request, getApiConfiguration(), getSchemaConfiguration(), getClient()); + } + } + + public interface UpdatePetOperation { + ApiConfiguration getApiConfiguration(); + SchemaConfiguration getSchemaConfiguration(); + HttpClient getClient(); + default Nothing? updatePet(PutRequest request) throws IOException, InterruptedException, ValidationException, NotImplementedException, ApiException { + return PutProvider.put(request, getApiConfiguration(), getSchemaConfiguration(), getClient()); + } + } + + public static class Put extends ApiClient implements PutOperation { + public Put(ApiConfiguration apiConfiguration, SchemaConfiguration schemaConfiguration) { + super(apiConfiguration, schemaConfiguration); + } + } + + public static class PutRequest { + public PetPutRequestBody.SealedRequestBody requestBody; + public RootServerInfo.@Nullable ServerIndex serverIndex; + public PetPutSecurityInfo.@Nullable SecurityIndex securityIndex; + public @Nullable Duration timeout; + + public PutRequest( + PetPutRequestBody.SealedRequestBody requestBody, + RootServerInfo.@Nullable ServerIndex serverIndex, + PetPutSecurityInfo.@Nullable SecurityIndex securityIndex, + @Nullable Duration timeout + ) { + this.requestBody = requestBody; + this.serverIndex = serverIndex; + this.securityIndex = securityIndex; + this.timeout = timeout; + } + } + + public static class PutNullableRequest { + public PetPutRequestBody.@Nullable SealedRequestBody requestBody; + public RootServerInfo.@Nullable ServerIndex serverIndex; + public PetPutSecurityInfo.@Nullable SecurityIndex securityIndex; + public @Nullable Duration timeout; + } + + public interface SetterForServerIndex { + PutNullableRequest getInstance(); + T getBuilderAfterServerIndex(PutNullableRequest instance); + default T serverIndex(RootServerInfo.ServerIndex serverIndex) { + var instance = getInstance(); + instance.serverIndex = serverIndex; + return getBuilderAfterServerIndex(instance); + } + } + + public interface SetterForSecurityIndex { + PutNullableRequest getInstance(); + T getBuilderAfterSecurityIndex(PutNullableRequest instance); + default T securityIndex(PetPutSecurityInfo.SecurityIndex securityIndex) { + var instance = getInstance(); + instance.securityIndex = securityIndex; + return getBuilderAfterSecurityIndex(instance); + } + } + + public interface SetterForTimeout { + PutNullableRequest getInstance(); + T getBuilderAfterTimeout(PutNullableRequest instance); + default T timeout(Duration timeout) { + var instance = getInstance(); + instance.timeout = timeout; + return getBuilderAfterTimeout(instance); + } + } + + public interface SetterForRequestBody { + PutNullableRequest getInstance(); + T getBuilderAfterRequestBody(PutNullableRequest instance); + default T requestBody(PetPutRequestBody.SealedRequestBody requestBody) { + var instance = getInstance(); + instance.requestBody = requestBody; + return getBuilderAfterRequestBody(instance); + } + } + + public static class Put0RequestBuilder implements SetterForServerIndex, SetterForSecurityIndex, SetterForTimeout { + private final PutNullableRequest instance; + + public Put0RequestBuilder(PutNullableRequest instance) { + this.instance = instance; + } + + public PutRequest build() { + var requestBody = instance.requestBody; + if (requestBody == null) { + throw new RuntimeException("invalid null value for required parameter"); + } + return new PutRequest( + requestBody, + instance.serverIndex, + instance.securityIndex, + instance.timeout + ); + } + + public PutNullableRequest getInstance() { + return instance; + } + + public Put0RequestBuilder getBuilderAfterServerIndex(PutNullableRequest instance) { + return this; + } + + public Put0RequestBuilder getBuilderAfterSecurityIndex(PutNullableRequest instance) { + return this; + } + + public Put0RequestBuilder getBuilderAfterTimeout(PutNullableRequest instance) { + return this; + } + } + public static class PutRequestBuilder implements SetterForRequestBody { + private final PutNullableRequest instance; + + public PutRequestBuilder() { + this.instance = new PutNullableRequest(); + } + + public PutNullableRequest getInstance() { + return instance; + } + + public Put0RequestBuilder getBuilderAfterRequestBody(PutNullableRequest instance) { + return new Put0RequestBuilder(instance); + } + } +} diff --git a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/pet/post/PetPostRequestBody.kt b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/pet/post/PetPostRequestBody.kt new file mode 100644 index 00000000000..f2304ccf791 --- /dev/null +++ b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/pet/post/PetPostRequestBody.kt @@ -0,0 +1,7 @@ +package org.openapijsonschematools.client.paths.pet.post; + +import org.openapijsonschematools.client.components.requestbodies.Pet; + +public class PetPostRequestBody extends Pet { + public static class PetPostRequestBody1 extends Pet1 {} +} diff --git a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/pet/post/PetPostResponses.kt b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/pet/post/PetPostResponses.kt new file mode 100644 index 00000000000..c7a1bc85d00 --- /dev/null +++ b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/pet/post/PetPostResponses.kt @@ -0,0 +1,66 @@ +package org.openapijsonschematools.client.paths.pet.post; + +import org.openapijsonschematools.client.paths.pet.post.responses.PetPostCode200Response; +import org.openapijsonschematools.client.paths.pet.post.responses.PetPostCode405Response; +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; +import org.checkerframework.checker.nullness.qual.Nullable; + +import java.net.http.HttpResponse; +import java.util.Map; +import java.util.AbstractMap; + +public class PetPostResponses { + public sealed interface EndpointResponse permits EndpointPetPostCode200Response {} + + public record EndpointPetPostCode200Response( + HttpResponse response, + Nothing? body, + Nothing? headers + ) implements EndpointResponse, ApiResponse{ + } + + public sealed interface StatusCodeResponseDeserializer permits StatusPetPostCode200ResponseDeserializer, StatusPetPostCode405ResponseDeserializer {} + + public static final class StatusPetPostCode200ResponseDeserializer extends PetPostCode200Response.PetPostCode200Response1 implements StatusCodeResponseDeserializer { + } + public static final class StatusPetPostCode405ResponseDeserializer extends PetPostCode405Response.PetPostCode405Response1 implements StatusCodeResponseDeserializer { + } + + public static final class PetPostResponses1 implements ResponsesDeserializer { + private final Map statusCodeToResponseDeserializer; + public PetPostResponses1() { + this.statusCodeToResponseDeserializer = Map.ofEntries( + new AbstractMap.SimpleEntry<>("200", new StatusPetPostCode200ResponseDeserializer()), + new AbstractMap.SimpleEntry<>("405", new StatusPetPostCode405ResponseDeserializer()) + ); + } + + 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) { + throw new ApiException( + "Invalid response statusCode="+statusCode+" has no response defined in the openapi document", + response + ); + } + if (statusCodeDeserializer instanceof StatusPetPostCode200ResponseDeserializer castDeserializer) { + var deserializedResponse = castDeserializer.deserialize(response, configuration); + return new EndpointPetPostCode200Response(response, deserializedResponse.body(), deserializedResponse.headers()); + } else { + StatusPetPostCode405ResponseDeserializer castDeserializer = (StatusPetPostCode405ResponseDeserializer) statusCodeDeserializer; + var deserializedResponse = castDeserializer.deserialize(response, configuration); + throw new PetPostCode405Response.ResponseApiException( + "Received error statusCode response from server", + response, + deserializedResponse + ); + } + } + } +} diff --git a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/pet/post/PetPostSecurityInfo.kt b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/pet/post/PetPostSecurityInfo.kt new file mode 100644 index 00000000000..91df6b3f3e8 --- /dev/null +++ b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/pet/post/PetPostSecurityInfo.kt @@ -0,0 +1,39 @@ +package org.openapijsonschematools.client.paths.pet.post; + +import org.openapijsonschematools.client.paths.pet.post.security.PetPostSecurityRequirementObject0; +import org.openapijsonschematools.client.paths.pet.post.security.PetPostSecurityRequirementObject1; +import org.openapijsonschematools.client.paths.pet.post.security.PetPostSecurityRequirementObject2; +import org.openapijsonschematools.client.securityrequirementobjects.SecurityRequirementObject; +import org.openapijsonschematools.client.securityrequirementobjects.SecurityRequirementObjectProvider; + +public class PetPostSecurityInfo { + public static class PetPostSecurityInfo1 implements SecurityRequirementObjectProvider { + public final PetPostSecurityRequirementObject0 security0; + public final PetPostSecurityRequirementObject1 security1; + public final PetPostSecurityRequirementObject2 security2; + + public PetPostSecurityInfo1() { + security0 = new PetPostSecurityRequirementObject0(); + security1 = new PetPostSecurityRequirementObject1(); + security2 = new PetPostSecurityRequirementObject2(); + } + + @Override + public SecurityRequirementObject getSecurityRequirementObject(SecurityIndex securityIndex) { + switch (securityIndex) { + case SECURITY_0: + return security0; + case SECURITY_1: + return security1; + default: + return security2; + } + } + } + + public enum SecurityIndex { + SECURITY_0, + SECURITY_1, + SECURITY_2 + } +} \ No newline at end of file diff --git a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/pet/post/responses/PetPostCode200Response.kt b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/pet/post/responses/PetPostCode200Response.kt new file mode 100644 index 00000000000..d32f61af7bc --- /dev/null +++ b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/pet/post/responses/PetPostCode200Response.kt @@ -0,0 +1,7 @@ +package org.openapijsonschematools.client.paths.pet.post.responses; + +import org.openapijsonschematools.client.components.responses.SuccessDescriptionOnly; + +public class PetPostCode200Response extends SuccessDescriptionOnly { + public static class PetPostCode200Response1 extends SuccessDescriptionOnly1 {} +} diff --git a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/pet/post/responses/PetPostCode405Response.kt b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/pet/post/responses/PetPostCode405Response.kt new file mode 100644 index 00000000000..67823c333ef --- /dev/null +++ b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/pet/post/responses/PetPostCode405Response.kt @@ -0,0 +1,45 @@ +package org.openapijsonschematools.client.paths.pet.post.responses; + +import org.openapijsonschematools.client.configurations.SchemaConfiguration; +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; +import java.net.http.HttpResponse; +import java.net.http.HttpHeaders; + +public class PetPostCode405Response { + + public static class PetPostCode405Response1 extends ResponseDeserializer { + public PetPostCode405Response1() { + super( + MapUtils.makeMap( + ) + ); + } + + @Override + protected Nothing? getBody(String contentType, Nothing? mediaType, byte[] body, SchemaConfiguration configuration) { + return null; + } + + @Override + protected Nothing? getHeaders(HttpHeaders headers, SchemaConfiguration configuration) { + return null; + } + } + + @SuppressWarnings("serial") + public static class ResponseApiException extends ApiException { + public DeserializedHttpResponse deserializedResponse; + + public ResponseApiException(String s, HttpResponse response, DeserializedHttpResponse deserializedResponse) { + super(s, response); + this.deserializedResponse = deserializedResponse; + } + } +} diff --git a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/pet/post/security/PetPostSecurityRequirementObject0.kt b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/pet/post/security/PetPostSecurityRequirementObject0.kt new file mode 100644 index 00000000000..b1e63c8cdde --- /dev/null +++ b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/pet/post/security/PetPostSecurityRequirementObject0.kt @@ -0,0 +1,24 @@ +package org.openapijsonschematools.client.paths.pet.post.security; + +import org.checkerframework.checker.nullness.qual.Nullable; +import org.openapijsonschematools.client.securityrequirementobjects.SecurityRequirementObject; +import org.openapijsonschematools.client.securityschemes.SecurityScheme; +import org.openapijsonschematools.client.components.securityschemes.ApiKey; + +import java.util.List; +import java.util.Map; +import java.util.AbstractMap; + +public class PetPostSecurityRequirementObject0 extends SecurityRequirementObject { + + public PetPostSecurityRequirementObject0() { + super( + Map.ofEntries( + new AbstractMap.SimpleEntry, List>( + ApiKey.class, + List.of() + ) + ) + ); + } +} diff --git a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/pet/post/security/PetPostSecurityRequirementObject1.kt b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/pet/post/security/PetPostSecurityRequirementObject1.kt new file mode 100644 index 00000000000..3d9d95fe223 --- /dev/null +++ b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/pet/post/security/PetPostSecurityRequirementObject1.kt @@ -0,0 +1,24 @@ +package org.openapijsonschematools.client.paths.pet.post.security; + +import org.checkerframework.checker.nullness.qual.Nullable; +import org.openapijsonschematools.client.securityrequirementobjects.SecurityRequirementObject; +import org.openapijsonschematools.client.securityschemes.SecurityScheme; +import org.openapijsonschematools.client.components.securityschemes.HttpSignatureTest; + +import java.util.List; +import java.util.Map; +import java.util.AbstractMap; + +public class PetPostSecurityRequirementObject1 extends SecurityRequirementObject { + + public PetPostSecurityRequirementObject1() { + super( + Map.ofEntries( + new AbstractMap.SimpleEntry, List>( + HttpSignatureTest.class, + List.of() + ) + ) + ); + } +} diff --git a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/pet/post/security/PetPostSecurityRequirementObject2.kt b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/pet/post/security/PetPostSecurityRequirementObject2.kt new file mode 100644 index 00000000000..81ac4bb60b1 --- /dev/null +++ b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/pet/post/security/PetPostSecurityRequirementObject2.kt @@ -0,0 +1,24 @@ +package org.openapijsonschematools.client.paths.pet.post.security; + +import org.checkerframework.checker.nullness.qual.Nullable; +import org.openapijsonschematools.client.securityrequirementobjects.SecurityRequirementObject; +import org.openapijsonschematools.client.securityschemes.SecurityScheme; +import org.openapijsonschematools.client.components.securityschemes.PetstoreAuth; + +import java.util.List; +import java.util.Map; +import java.util.AbstractMap; + +public class PetPostSecurityRequirementObject2 extends SecurityRequirementObject { + + public PetPostSecurityRequirementObject2() { + super( + Map.ofEntries( + new AbstractMap.SimpleEntry, List>( + PetstoreAuth.class, + List.of("write:pets", "read:pets") + ) + ) + ); + } +} diff --git a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/pet/put/PetPutRequestBody.kt b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/pet/put/PetPutRequestBody.kt new file mode 100644 index 00000000000..4faecd10dc9 --- /dev/null +++ b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/pet/put/PetPutRequestBody.kt @@ -0,0 +1,7 @@ +package org.openapijsonschematools.client.paths.pet.put; + +import org.openapijsonschematools.client.components.requestbodies.Pet; + +public class PetPutRequestBody extends Pet { + public static class PetPutRequestBody1 extends Pet1 {} +} diff --git a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/pet/put/PetPutResponses.kt b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/pet/put/PetPutResponses.kt new file mode 100644 index 00000000000..32e8a7c200c --- /dev/null +++ b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/pet/put/PetPutResponses.kt @@ -0,0 +1,72 @@ +package org.openapijsonschematools.client.paths.pet.put; + +import org.openapijsonschematools.client.paths.pet.put.responses.PetPutCode400Response; +import org.openapijsonschematools.client.paths.pet.put.responses.PetPutCode404Response; +import org.openapijsonschematools.client.paths.pet.put.responses.PetPutCode405Response; +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; + +import java.net.http.HttpResponse; +import java.util.Map; +import java.util.AbstractMap; + +public class PetPutResponses { + + public sealed interface StatusCodeResponseDeserializer permits StatusPetPutCode400ResponseDeserializer, StatusPetPutCode404ResponseDeserializer, StatusPetPutCode405ResponseDeserializer {} + + public static final class StatusPetPutCode400ResponseDeserializer extends PetPutCode400Response.PetPutCode400Response1 implements StatusCodeResponseDeserializer { + } + public static final class StatusPetPutCode404ResponseDeserializer extends PetPutCode404Response.PetPutCode404Response1 implements StatusCodeResponseDeserializer { + } + public static final class StatusPetPutCode405ResponseDeserializer extends PetPutCode405Response.PetPutCode405Response1 implements StatusCodeResponseDeserializer { + } + + public static final class PetPutResponses1 implements ResponsesDeserializer { + private final Map statusCodeToResponseDeserializer; + public PetPutResponses1() { + this.statusCodeToResponseDeserializer = Map.ofEntries( + new AbstractMap.SimpleEntry<>("400", new StatusPetPutCode400ResponseDeserializer()), + new AbstractMap.SimpleEntry<>("404", new StatusPetPutCode404ResponseDeserializer()), + new AbstractMap.SimpleEntry<>("405", new StatusPetPutCode405ResponseDeserializer()) + ); + } + + public Nothing? deserialize(HttpResponse response, SchemaConfiguration configuration) throws ValidationException, NotImplementedException, ApiException { + String statusCode = String.valueOf(response.statusCode()); + @Nullable StatusCodeResponseDeserializer statusCodeDeserializer = statusCodeToResponseDeserializer.get(statusCode); + if (statusCodeDeserializer == null) { + throw new ApiException( + "Invalid response statusCode="+statusCode+" has no response defined in the openapi document", + response + ); + } + if (statusCodeDeserializer instanceof StatusPetPutCode400ResponseDeserializer castDeserializer) { + var deserializedResponse = castDeserializer.deserialize(response, configuration); + throw new PetPutCode400Response.ResponseApiException( + "Received error statusCode response from server", + response, + deserializedResponse + ); + } else if (statusCodeDeserializer instanceof StatusPetPutCode404ResponseDeserializer castDeserializer) { + var deserializedResponse = castDeserializer.deserialize(response, configuration); + throw new PetPutCode404Response.ResponseApiException( + "Received error statusCode response from server", + response, + deserializedResponse + ); + } else { + StatusPetPutCode405ResponseDeserializer castDeserializer = (StatusPetPutCode405ResponseDeserializer) statusCodeDeserializer; + var deserializedResponse = castDeserializer.deserialize(response, configuration); + throw new PetPutCode405Response.ResponseApiException( + "Received error statusCode response from server", + response, + deserializedResponse + ); + } + } + } +} diff --git a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/pet/put/PetPutSecurityInfo.kt b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/pet/put/PetPutSecurityInfo.kt new file mode 100644 index 00000000000..35d27e66846 --- /dev/null +++ b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/pet/put/PetPutSecurityInfo.kt @@ -0,0 +1,33 @@ +package org.openapijsonschematools.client.paths.pet.put; + +import org.openapijsonschematools.client.paths.pet.put.security.PetPutSecurityRequirementObject0; +import org.openapijsonschematools.client.paths.pet.put.security.PetPutSecurityRequirementObject1; +import org.openapijsonschematools.client.securityrequirementobjects.SecurityRequirementObject; +import org.openapijsonschematools.client.securityrequirementobjects.SecurityRequirementObjectProvider; + +public class PetPutSecurityInfo { + public static class PetPutSecurityInfo1 implements SecurityRequirementObjectProvider { + public final PetPutSecurityRequirementObject0 security0; + public final PetPutSecurityRequirementObject1 security1; + + public PetPutSecurityInfo1() { + security0 = new PetPutSecurityRequirementObject0(); + security1 = new PetPutSecurityRequirementObject1(); + } + + @Override + public SecurityRequirementObject getSecurityRequirementObject(SecurityIndex securityIndex) { + switch (securityIndex) { + case SECURITY_0: + return security0; + default: + return security1; + } + } + } + + public enum SecurityIndex { + SECURITY_0, + SECURITY_1 + } +} \ No newline at end of file diff --git a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/pet/put/responses/PetPutCode400Response.kt b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/pet/put/responses/PetPutCode400Response.kt new file mode 100644 index 00000000000..0d555ebc3c6 --- /dev/null +++ b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/pet/put/responses/PetPutCode400Response.kt @@ -0,0 +1,45 @@ +package org.openapijsonschematools.client.paths.pet.put.responses; + +import org.openapijsonschematools.client.configurations.SchemaConfiguration; +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; +import java.net.http.HttpResponse; +import java.net.http.HttpHeaders; + +public class PetPutCode400Response { + + public static class PetPutCode400Response1 extends ResponseDeserializer { + public PetPutCode400Response1() { + super( + MapUtils.makeMap( + ) + ); + } + + @Override + protected Nothing? getBody(String contentType, Nothing? mediaType, byte[] body, SchemaConfiguration configuration) { + return null; + } + + @Override + protected Nothing? getHeaders(HttpHeaders headers, SchemaConfiguration configuration) { + return null; + } + } + + @SuppressWarnings("serial") + public static class ResponseApiException extends ApiException { + public DeserializedHttpResponse deserializedResponse; + + public ResponseApiException(String s, HttpResponse response, DeserializedHttpResponse deserializedResponse) { + super(s, response); + this.deserializedResponse = deserializedResponse; + } + } +} diff --git a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/pet/put/responses/PetPutCode404Response.kt b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/pet/put/responses/PetPutCode404Response.kt new file mode 100644 index 00000000000..b55109a4bb1 --- /dev/null +++ b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/pet/put/responses/PetPutCode404Response.kt @@ -0,0 +1,45 @@ +package org.openapijsonschematools.client.paths.pet.put.responses; + +import org.openapijsonschematools.client.configurations.SchemaConfiguration; +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; +import java.net.http.HttpResponse; +import java.net.http.HttpHeaders; + +public class PetPutCode404Response { + + public static class PetPutCode404Response1 extends ResponseDeserializer { + public PetPutCode404Response1() { + super( + MapUtils.makeMap( + ) + ); + } + + @Override + protected Nothing? getBody(String contentType, Nothing? mediaType, byte[] body, SchemaConfiguration configuration) { + return null; + } + + @Override + protected Nothing? getHeaders(HttpHeaders headers, SchemaConfiguration configuration) { + return null; + } + } + + @SuppressWarnings("serial") + public static class ResponseApiException extends ApiException { + public DeserializedHttpResponse deserializedResponse; + + public ResponseApiException(String s, HttpResponse response, DeserializedHttpResponse deserializedResponse) { + super(s, response); + this.deserializedResponse = deserializedResponse; + } + } +} diff --git a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/pet/put/responses/PetPutCode405Response.kt b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/pet/put/responses/PetPutCode405Response.kt new file mode 100644 index 00000000000..09f2946c097 --- /dev/null +++ b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/pet/put/responses/PetPutCode405Response.kt @@ -0,0 +1,45 @@ +package org.openapijsonschematools.client.paths.pet.put.responses; + +import org.openapijsonschematools.client.configurations.SchemaConfiguration; +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; +import java.net.http.HttpResponse; +import java.net.http.HttpHeaders; + +public class PetPutCode405Response { + + public static class PetPutCode405Response1 extends ResponseDeserializer { + public PetPutCode405Response1() { + super( + MapUtils.makeMap( + ) + ); + } + + @Override + protected Nothing? getBody(String contentType, Nothing? mediaType, byte[] body, SchemaConfiguration configuration) { + return null; + } + + @Override + protected Nothing? getHeaders(HttpHeaders headers, SchemaConfiguration configuration) { + return null; + } + } + + @SuppressWarnings("serial") + public static class ResponseApiException extends ApiException { + public DeserializedHttpResponse deserializedResponse; + + public ResponseApiException(String s, HttpResponse response, DeserializedHttpResponse deserializedResponse) { + super(s, response); + this.deserializedResponse = deserializedResponse; + } + } +} diff --git a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/pet/put/security/PetPutSecurityRequirementObject0.kt b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/pet/put/security/PetPutSecurityRequirementObject0.kt new file mode 100644 index 00000000000..e1e15505dca --- /dev/null +++ b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/pet/put/security/PetPutSecurityRequirementObject0.kt @@ -0,0 +1,24 @@ +package org.openapijsonschematools.client.paths.pet.put.security; + +import org.checkerframework.checker.nullness.qual.Nullable; +import org.openapijsonschematools.client.securityrequirementobjects.SecurityRequirementObject; +import org.openapijsonschematools.client.securityschemes.SecurityScheme; +import org.openapijsonschematools.client.components.securityschemes.HttpSignatureTest; + +import java.util.List; +import java.util.Map; +import java.util.AbstractMap; + +public class PetPutSecurityRequirementObject0 extends SecurityRequirementObject { + + public PetPutSecurityRequirementObject0() { + super( + Map.ofEntries( + new AbstractMap.SimpleEntry, List>( + HttpSignatureTest.class, + List.of() + ) + ) + ); + } +} diff --git a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/pet/put/security/PetPutSecurityRequirementObject1.kt b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/pet/put/security/PetPutSecurityRequirementObject1.kt new file mode 100644 index 00000000000..e2264fa535c --- /dev/null +++ b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/pet/put/security/PetPutSecurityRequirementObject1.kt @@ -0,0 +1,24 @@ +package org.openapijsonschematools.client.paths.pet.put.security; + +import org.checkerframework.checker.nullness.qual.Nullable; +import org.openapijsonschematools.client.securityrequirementobjects.SecurityRequirementObject; +import org.openapijsonschematools.client.securityschemes.SecurityScheme; +import org.openapijsonschematools.client.components.securityschemes.PetstoreAuth; + +import java.util.List; +import java.util.Map; +import java.util.AbstractMap; + +public class PetPutSecurityRequirementObject1 extends SecurityRequirementObject { + + public PetPutSecurityRequirementObject1() { + super( + Map.ofEntries( + new AbstractMap.SimpleEntry, List>( + PetstoreAuth.class, + List.of("write:pets", "read:pets") + ) + ) + ); + } +} diff --git a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/petfindbystatus/PetfindbystatusGet.kt b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/petfindbystatus/PetfindbystatusGet.kt new file mode 100644 index 00000000000..d4b8b02fa41 --- /dev/null +++ b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/petfindbystatus/PetfindbystatusGet.kt @@ -0,0 +1,212 @@ +package org.openapijsonschematools.client.paths.petfindbystatus; + +import org.checkerframework.checker.nullness.qual.Nullable; +import org.openapijsonschematools.client.paths.petfindbystatus.PetfindbystatusServerInfo; +import org.openapijsonschematools.client.paths.petfindbystatus.get.PetfindbystatusGetSecurityInfo; +import org.openapijsonschematools.client.paths.petfindbystatus.get.PetfindbystatusGetQueryParameters; +import org.openapijsonschematools.client.paths.petfindbystatus.get.Parameters; +import org.openapijsonschematools.client.paths.petfindbystatus.get.PetfindbystatusGetResponses; +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.paths.Petfindbystatus; +import org.openapijsonschematools.client.securityrequirementobjects.SecurityRequirementObject; +import org.openapijsonschematools.client.securityrequirementobjects.AuthApplier; + +import java.io.IOException; +import java.net.http.HttpClient; +import java.net.http.HttpRequest; +import java.time.Duration; +import java.util.List; +import java.util.Map; + +public class PetfindbystatusGet { + private static class GetProvider extends AuthApplier { + private static final String method = "get"; + + public static PetfindbystatusGetResponses.EndpointResponse get( + GetRequest request, + ApiConfiguration apiConfiguration, + SchemaConfiguration schemaConfiguration, + HttpClient client + ) throws IOException, InterruptedException, ValidationException, NotImplementedException, ApiException { + Map> headers = apiConfiguration.getDefaultHeaders(); + HttpRequest.BodyPublisher bodyPublisher = HttpRequest.BodyPublishers.noBody(); + + var querySerializer = new Parameters.QueryParametersSerializer(); + @Nullable Map queryMap = querySerializer.getQueryMap(request.queryParameters); + String host = apiConfiguration.getServer(request.serverIndex).url(); + SecurityRequirementObject securityRequirementObject = apiConfiguration.getSecurityRequirementObject(request.securityIndex); + updateParamsForAuth( + securityRequirementObject, + headers, + Petfindbystatus.path, + method, + bodyPublisher, + queryMap, + apiConfiguration + ); + + String url = host + Petfindbystatus.path; + if (queryMap != null) { + url = url + querySerializer.serialize(queryMap); + } + var httpRequest = RestClient.getRequest( + url, + method, + bodyPublisher, + headers, + request.timeout + ); + var response = RestClient.getResponse(httpRequest, client); + var responsesDeserializer = new PetfindbystatusGetResponses.PetfindbystatusGetResponses1(); + return responsesDeserializer.deserialize(response, schemaConfiguration); + } + } + + public interface GetOperation { + ApiConfiguration getApiConfiguration(); + SchemaConfiguration getSchemaConfiguration(); + HttpClient getClient(); + default PetfindbystatusGetResponses.EndpointResponse get(GetRequest request) throws IOException, InterruptedException, ValidationException, NotImplementedException, ApiException { + return GetProvider.get(request, getApiConfiguration(), getSchemaConfiguration(), getClient()); + } + } + + public interface FindPetsByStatusOperation { + ApiConfiguration getApiConfiguration(); + SchemaConfiguration getSchemaConfiguration(); + HttpClient getClient(); + default PetfindbystatusGetResponses.EndpointResponse findPetsByStatus(GetRequest request) throws IOException, InterruptedException, ValidationException, NotImplementedException, ApiException { + return GetProvider.get(request, getApiConfiguration(), getSchemaConfiguration(), getClient()); + } + } + + public static class Get extends ApiClient implements GetOperation { + public Get(ApiConfiguration apiConfiguration, SchemaConfiguration schemaConfiguration) { + super(apiConfiguration, schemaConfiguration); + } + } + + public static class GetRequest { + public PetfindbystatusGetQueryParameters.QueryParametersMap queryParameters; + public PetfindbystatusServerInfo.@Nullable ServerIndex serverIndex; + public PetfindbystatusGetSecurityInfo.@Nullable SecurityIndex securityIndex; + public @Nullable Duration timeout; + + public GetRequest( + PetfindbystatusGetQueryParameters.QueryParametersMap queryParameters, + PetfindbystatusServerInfo.@Nullable ServerIndex serverIndex, + PetfindbystatusGetSecurityInfo.@Nullable SecurityIndex securityIndex, + @Nullable Duration timeout + ) { + this.queryParameters = queryParameters; + this.serverIndex = serverIndex; + this.securityIndex = securityIndex; + this.timeout = timeout; + } + } + + public static class GetNullableRequest { + public PetfindbystatusGetQueryParameters.@Nullable QueryParametersMap queryParameters; + public PetfindbystatusServerInfo.@Nullable ServerIndex serverIndex; + public PetfindbystatusGetSecurityInfo.@Nullable SecurityIndex securityIndex; + public @Nullable Duration timeout; + } + + public interface SetterForServerIndex { + GetNullableRequest getInstance(); + T getBuilderAfterServerIndex(GetNullableRequest instance); + default T serverIndex(PetfindbystatusServerInfo.ServerIndex serverIndex) { + var instance = getInstance(); + instance.serverIndex = serverIndex; + return getBuilderAfterServerIndex(instance); + } + } + + public interface SetterForSecurityIndex { + GetNullableRequest getInstance(); + T getBuilderAfterSecurityIndex(GetNullableRequest instance); + default T securityIndex(PetfindbystatusGetSecurityInfo.SecurityIndex securityIndex) { + var instance = getInstance(); + instance.securityIndex = securityIndex; + return getBuilderAfterSecurityIndex(instance); + } + } + + public interface SetterForTimeout { + GetNullableRequest getInstance(); + T getBuilderAfterTimeout(GetNullableRequest instance); + default T timeout(Duration timeout) { + var instance = getInstance(); + instance.timeout = timeout; + return getBuilderAfterTimeout(instance); + } + } + + public interface SetterForQueryParameters { + GetNullableRequest getInstance(); + T getBuilderAfterQueryParameters(GetNullableRequest instance); + default T queryParameters(PetfindbystatusGetQueryParameters.QueryParametersMap queryParameters) { + var instance = getInstance(); + instance.queryParameters = queryParameters; + return getBuilderAfterQueryParameters(instance); + } + } + + public static class Get0RequestBuilder implements SetterForServerIndex, SetterForSecurityIndex, SetterForTimeout { + private final GetNullableRequest instance; + + public Get0RequestBuilder(GetNullableRequest instance) { + this.instance = instance; + } + + public GetRequest build() { + var queryParameters = instance.queryParameters; + if (queryParameters == null) { + throw new RuntimeException("invalid null value for required parameter"); + } + return new GetRequest( + queryParameters, + instance.serverIndex, + instance.securityIndex, + instance.timeout + ); + } + + public GetNullableRequest getInstance() { + return instance; + } + + public Get0RequestBuilder getBuilderAfterServerIndex(GetNullableRequest instance) { + return this; + } + + public Get0RequestBuilder getBuilderAfterSecurityIndex(GetNullableRequest instance) { + return this; + } + + public Get0RequestBuilder getBuilderAfterTimeout(GetNullableRequest instance) { + return this; + } + } + public static class GetRequestBuilder implements SetterForQueryParameters { + private final GetNullableRequest instance; + + public GetRequestBuilder() { + this.instance = new GetNullableRequest(); + } + + public GetNullableRequest getInstance() { + return instance; + } + + public Get0RequestBuilder getBuilderAfterQueryParameters(GetNullableRequest instance) { + return new Get0RequestBuilder(instance); + } + } +} diff --git a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/petfindbystatus/PetfindbystatusServerInfo.kt b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/petfindbystatus/PetfindbystatusServerInfo.kt new file mode 100644 index 00000000000..e0ed6efd6f2 --- /dev/null +++ b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/petfindbystatus/PetfindbystatusServerInfo.kt @@ -0,0 +1,63 @@ +package org.openapijsonschematools.client.paths.petfindbystatus; + +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.Objects; + +public class PetfindbystatusServerInfo { + public static class PetfindbystatusServerInfo1 implements ServerProvider { + private final PetfindbystatusServer0 server0; + private final PetfindbystatusServer1 server1; + + PetfindbystatusServerInfo1( + @Nullable PetfindbystatusServer0 server0, + @Nullable PetfindbystatusServer1 server1 + ) { + this.server0 = Objects.requireNonNullElseGet(server0, PetfindbystatusServer0::new); + this.server1 = Objects.requireNonNullElseGet(server1, PetfindbystatusServer1::new); + } + + @Override + public Server getServer(ServerIndex serverIndex) { + switch (serverIndex) { + case SERVER_0: + return server0; + default: + return server1; + } + } + } + + public static class PetfindbystatusServerInfoBuilder { + private @Nullable PetfindbystatusServer0 server0; + private @Nullable PetfindbystatusServer1 server1; + + public PetfindbystatusServerInfoBuilder() {} + + public PetfindbystatusServerInfoBuilder petfindbystatusServer0(PetfindbystatusServer0 server0) { + this.server0 = server0; + return this; + } + + public PetfindbystatusServerInfoBuilder petfindbystatusServer1(PetfindbystatusServer1 server1) { + this.server1 = server1; + return this; + } + + public PetfindbystatusServerInfo1 build() { + return new PetfindbystatusServerInfo1( + server0, + server1 + ); + } + } + + public enum ServerIndex { + SERVER_0, + SERVER_1 + } +} \ No newline at end of file diff --git a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/petfindbystatus/get/Parameters.kt b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/petfindbystatus/get/Parameters.kt new file mode 100644 index 00000000000..e1ac9de45c5 --- /dev/null +++ b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/petfindbystatus/get/Parameters.kt @@ -0,0 +1,20 @@ +package org.openapijsonschematools.client.paths.petfindbystatus.get; + +import org.openapijsonschematools.client.paths.petfindbystatus.get.parameters.Parameter0; +import org.openapijsonschematools.client.parameter.QuerySerializer; + +import java.util.Map; +import java.util.AbstractMap; + +public class Parameters { + + public static class QueryParametersSerializer extends QuerySerializer { + public QueryParametersSerializer() { + super( + Map.ofEntries( + new AbstractMap.SimpleEntry<>("status", new Parameter0.Parameter01()) + ) + ); + } + } +} diff --git a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/petfindbystatus/get/PetfindbystatusGetQueryParameters.kt b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/petfindbystatus/get/PetfindbystatusGetQueryParameters.kt new file mode 100644 index 00000000000..b62d34090e5 --- /dev/null +++ b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/petfindbystatus/get/PetfindbystatusGetQueryParameters.kt @@ -0,0 +1,206 @@ +package org.openapijsonschematools.client.paths.petfindbystatus.get; +import java.util.ArrayList; +import java.util.HashSet; +import java.util.LinkedHashMap; +import java.util.LinkedHashSet; +import java.util.List; +import java.util.Map; +import java.util.Objects; +import java.util.Set; +import org.checkerframework.checker.nullness.qual.Nullable; +import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags; +import org.openapijsonschematools.client.configurations.SchemaConfiguration; +import org.openapijsonschematools.client.exceptions.UnsetPropertyException; +import org.openapijsonschematools.client.exceptions.ValidationException; +import org.openapijsonschematools.client.paths.petfindbystatus.get.parameters.parameter0.Schema0; +import org.openapijsonschematools.client.schemas.AnyTypeJsonSchema; +import org.openapijsonschematools.client.schemas.GenericBuilder; +import org.openapijsonschematools.client.schemas.NotAnyTypeJsonSchema; +import org.openapijsonschematools.client.schemas.validation.FrozenList; +import org.openapijsonschematools.client.schemas.validation.FrozenMap; +import org.openapijsonschematools.client.schemas.validation.JsonSchema; +import org.openapijsonschematools.client.schemas.validation.JsonSchemaInfo; +import org.openapijsonschematools.client.schemas.validation.MapSchemaValidator; +import org.openapijsonschematools.client.schemas.validation.MapUtils; +import org.openapijsonschematools.client.schemas.validation.PathToSchemasMap; +import org.openapijsonschematools.client.schemas.validation.PropertyEntry; +import org.openapijsonschematools.client.schemas.validation.ValidationMetadata; + +public class PetfindbystatusGetQueryParameters { + // nest classes so all schemas and input/output classes can be public + + + public static class AdditionalProperties extends NotAnyTypeJsonSchema.NotAnyTypeJsonSchema1 { + // NotAnyTypeSchema + private static @Nullable AdditionalProperties instance = null; + public static AdditionalProperties getInstance() { + if (instance == null) { + instance = new AdditionalProperties(); + } + return instance; + } + } + + + public static class QueryParametersMap extends FrozenMap { + protected QueryParametersMap(FrozenMap m) { + super(m); + } + public static final Set requiredKeys = Set.of( + "status" + ); + public static final Set optionalKeys = Set.of(); + public static QueryParametersMap of(Map> arg, SchemaConfiguration configuration) throws ValidationException { + return PetfindbystatusGetQueryParameters1.getInstance().validate(arg, configuration); + } + + public Schema0.SchemaList0 status() { + try { + return getOrThrow("version"); + } catch (UnsetPropertyException e) { + throw new RuntimeException(e); + } + } + } + + public interface SetterForStatus { + Map> getInstance(); + T getBuilderAfterStatus(Map> instance); + + default T status(List value) { + var instance = getInstance(); + instance.put("status", value); + return getBuilderAfterStatus(instance); + } + } + + public static class QueryParametersMap0Builder implements GenericBuilder>> { + private final Map> instance; + private static final Set knownKeys = Set.of( + "status" + ); + public Set getKnownKeys() { + return knownKeys; + } + public QueryParametersMap0Builder(Map> instance) { + this.instance = instance; + } + public Map> build() { + return instance; + } + } + + public static class QueryParametersMapBuilder implements SetterForStatus { + private final Map> instance; + public QueryParametersMapBuilder() { + this.instance = new LinkedHashMap<>(); + } + public Map> getInstance() { + return instance; + } + public QueryParametersMap0Builder getBuilderAfterStatus(Map> instance) { + return new QueryParametersMap0Builder(instance); + } + } + + + public sealed interface PetfindbystatusGetQueryParameters1Boxed permits PetfindbystatusGetQueryParameters1BoxedMap { + @Nullable Object getData(); + } + + public record PetfindbystatusGetQueryParameters1BoxedMap(QueryParametersMap data) implements PetfindbystatusGetQueryParameters1Boxed { + @Override + public @Nullable Object getData() { + return data; + } + } + + + public static class PetfindbystatusGetQueryParameters1 extends JsonSchema implements MapSchemaValidator { + private static @Nullable PetfindbystatusGetQueryParameters1 instance = null; + + protected PetfindbystatusGetQueryParameters1() { + super(new JsonSchemaInfo() + .type(Set.of(Map.class)) + .properties(Map.ofEntries( + new PropertyEntry("status", Schema0.Schema01.class) + )) + .required(Set.of( + "status" + )) + .additionalProperties(AdditionalProperties.class) + ); + } + + public static PetfindbystatusGetQueryParameters1 getInstance() { + if (instance == null) { + instance = new PetfindbystatusGetQueryParameters1(); + } + return instance; + } + + 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 RuntimeException("Invalid non-string key value"); + } + String propertyName = (String) entryKey; + List propertyPathToItem = new ArrayList<>(pathToItem); + propertyPathToItem.add(propertyName); + Object value = entry.getValue(); + LinkedHashMap, Nothing?> schemas = pathToSchemas.get(propertyPathToItem); + if (schemas == null) { + throw new RuntimeException("Validation 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"); + } + properties.put(propertyName, (Schema0.SchemaList0) propertyInstance); + } + FrozenMap castProperties = new FrozenMap<>(properties); + return new QueryParametersMap(castProperties); + } + + 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); + SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().build())); + ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, new PathToSchemasMap(), new LinkedHashSet<>()); + PathToSchemasMap pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet); + return getNewInstance(castArg, validationMetadata.pathToItem(), pathToSchemasMap); + } + + + @Override + public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws 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"); + } + @Override + public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { + if (arg instanceof Map) { + return getNewInstance((Map) arg, pathToItem, pathToSchemas); + } + throw new RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); + } + @Override + public PetfindbystatusGetQueryParameters1BoxedMap validateAndBox(Map arg, SchemaConfiguration configuration) throws ValidationException { + return new PetfindbystatusGetQueryParameters1BoxedMap(validate(arg, configuration)); + } + @Override + public PetfindbystatusGetQueryParameters1Boxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { + 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"); + } + } + +} diff --git a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/petfindbystatus/get/PetfindbystatusGetResponses.kt b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/petfindbystatus/get/PetfindbystatusGetResponses.kt new file mode 100644 index 00000000000..18b7e3343a7 --- /dev/null +++ b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/petfindbystatus/get/PetfindbystatusGetResponses.kt @@ -0,0 +1,66 @@ +package org.openapijsonschematools.client.paths.petfindbystatus.get; + +import org.openapijsonschematools.client.paths.petfindbystatus.get.responses.PetfindbystatusGetCode200Response; +import org.openapijsonschematools.client.paths.petfindbystatus.get.responses.PetfindbystatusGetCode400Response; +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; +import org.checkerframework.checker.nullness.qual.Nullable; + +import java.net.http.HttpResponse; +import java.util.Map; +import java.util.AbstractMap; + +public class PetfindbystatusGetResponses { + public sealed interface EndpointResponse permits EndpointPetfindbystatusGetCode200Response {} + + public record EndpointPetfindbystatusGetCode200Response( + HttpResponse response, + PetfindbystatusGetCode200Response.SealedResponseBody body, + Nothing? headers + ) implements EndpointResponse, ApiResponse{ + } + + public sealed interface StatusCodeResponseDeserializer permits StatusPetfindbystatusGetCode200ResponseDeserializer, StatusPetfindbystatusGetCode400ResponseDeserializer {} + + public static final class StatusPetfindbystatusGetCode200ResponseDeserializer extends PetfindbystatusGetCode200Response.PetfindbystatusGetCode200Response1 implements StatusCodeResponseDeserializer { + } + public static final class StatusPetfindbystatusGetCode400ResponseDeserializer extends PetfindbystatusGetCode400Response.PetfindbystatusGetCode400Response1 implements StatusCodeResponseDeserializer { + } + + public static final class PetfindbystatusGetResponses1 implements ResponsesDeserializer { + private final Map statusCodeToResponseDeserializer; + public PetfindbystatusGetResponses1() { + this.statusCodeToResponseDeserializer = Map.ofEntries( + new AbstractMap.SimpleEntry<>("200", new StatusPetfindbystatusGetCode200ResponseDeserializer()), + new AbstractMap.SimpleEntry<>("400", new StatusPetfindbystatusGetCode400ResponseDeserializer()) + ); + } + + 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) { + throw new ApiException( + "Invalid response statusCode="+statusCode+" has no response defined in the openapi document", + response + ); + } + if (statusCodeDeserializer instanceof StatusPetfindbystatusGetCode200ResponseDeserializer castDeserializer) { + var deserializedResponse = castDeserializer.deserialize(response, configuration); + return new EndpointPetfindbystatusGetCode200Response(response, deserializedResponse.body(), deserializedResponse.headers()); + } else { + StatusPetfindbystatusGetCode400ResponseDeserializer castDeserializer = (StatusPetfindbystatusGetCode400ResponseDeserializer) statusCodeDeserializer; + var deserializedResponse = castDeserializer.deserialize(response, configuration); + throw new PetfindbystatusGetCode400Response.ResponseApiException( + "Received error statusCode response from server", + response, + deserializedResponse + ); + } + } + } +} diff --git a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/petfindbystatus/get/PetfindbystatusGetSecurityInfo.kt b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/petfindbystatus/get/PetfindbystatusGetSecurityInfo.kt new file mode 100644 index 00000000000..7e2dd18d844 --- /dev/null +++ b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/petfindbystatus/get/PetfindbystatusGetSecurityInfo.kt @@ -0,0 +1,39 @@ +package org.openapijsonschematools.client.paths.petfindbystatus.get; + +import org.openapijsonschematools.client.paths.petfindbystatus.get.security.PetfindbystatusGetSecurityRequirementObject0; +import org.openapijsonschematools.client.paths.petfindbystatus.get.security.PetfindbystatusGetSecurityRequirementObject1; +import org.openapijsonschematools.client.paths.petfindbystatus.get.security.PetfindbystatusGetSecurityRequirementObject2; +import org.openapijsonschematools.client.securityrequirementobjects.SecurityRequirementObject; +import org.openapijsonschematools.client.securityrequirementobjects.SecurityRequirementObjectProvider; + +public class PetfindbystatusGetSecurityInfo { + public static class PetfindbystatusGetSecurityInfo1 implements SecurityRequirementObjectProvider { + public final PetfindbystatusGetSecurityRequirementObject0 security0; + public final PetfindbystatusGetSecurityRequirementObject1 security1; + public final PetfindbystatusGetSecurityRequirementObject2 security2; + + public PetfindbystatusGetSecurityInfo1() { + security0 = new PetfindbystatusGetSecurityRequirementObject0(); + security1 = new PetfindbystatusGetSecurityRequirementObject1(); + security2 = new PetfindbystatusGetSecurityRequirementObject2(); + } + + @Override + public SecurityRequirementObject getSecurityRequirementObject(SecurityIndex securityIndex) { + switch (securityIndex) { + case SECURITY_0: + return security0; + case SECURITY_1: + return security1; + default: + return security2; + } + } + } + + public enum SecurityIndex { + SECURITY_0, + SECURITY_1, + SECURITY_2 + } +} \ No newline at end of file diff --git a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/petfindbystatus/get/parameters/Parameter0.kt b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/petfindbystatus/get/parameters/Parameter0.kt new file mode 100644 index 00000000000..b77d3c07561 --- /dev/null +++ b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/petfindbystatus/get/parameters/Parameter0.kt @@ -0,0 +1,23 @@ +package org.openapijsonschematools.client.paths.petfindbystatus.get.parameters; + +import org.openapijsonschematools.client.parameter.ParameterStyle; +import org.openapijsonschematools.client.parameter.ParameterInType; +import org.openapijsonschematools.client.parameter.SchemaParameter; +import org.openapijsonschematools.client.paths.petfindbystatus.get.parameters.parameter0.Schema0; + +public class Parameter0 { + + public static class Parameter01 extends SchemaParameter { + public Parameter01() { + super( + "status", + ParameterInType.QUERY, + true, + ParameterStyle.FORM, + false, + false, + Schema0.Schema01.getInstance() + ); + } + } +} diff --git a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/petfindbystatus/get/parameters/parameter0/Schema0.kt b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/petfindbystatus/get/parameters/parameter0/Schema0.kt new file mode 100644 index 00000000000..fb0b03d7068 --- /dev/null +++ b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/petfindbystatus/get/parameters/parameter0/Schema0.kt @@ -0,0 +1,255 @@ +package org.openapijsonschematools.client.paths.petfindbystatus.get.parameters.parameter0; +import java.util.ArrayList; +import java.util.HashSet; +import java.util.LinkedHashMap; +import java.util.LinkedHashSet; +import java.util.List; +import java.util.Objects; +import java.util.Set; +import org.checkerframework.checker.nullness.qual.Nullable; +import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags; +import org.openapijsonschematools.client.configurations.SchemaConfiguration; +import org.openapijsonschematools.client.exceptions.ValidationException; +import org.openapijsonschematools.client.schemas.SetMaker; +import org.openapijsonschematools.client.schemas.validation.DefaultValueMethod; +import org.openapijsonschematools.client.schemas.validation.FrozenList; +import org.openapijsonschematools.client.schemas.validation.JsonSchema; +import org.openapijsonschematools.client.schemas.validation.JsonSchemaInfo; +import org.openapijsonschematools.client.schemas.validation.ListSchemaValidator; +import org.openapijsonschematools.client.schemas.validation.PathToSchemasMap; +import org.openapijsonschematools.client.schemas.validation.StringEnumValidator; +import org.openapijsonschematools.client.schemas.validation.StringSchemaValidator; +import org.openapijsonschematools.client.schemas.validation.StringValueMethod; +import org.openapijsonschematools.client.schemas.validation.ValidationMetadata; + +public class Schema0 { + // nest classes so all schemas and input/output classes can be public + + public enum StringItemsEnums0 implements StringValueMethod { + AVAILABLE("available"), + PENDING("pending"), + SOLD("sold"); + private final String value; + + StringItemsEnums0(String value) { + this.value = value; + } + public String value() { + return this.value; + } + } + + + public sealed interface Items0Boxed permits Items0BoxedString { + @Nullable Object getData(); + } + + public record Items0BoxedString(String data) implements Items0Boxed { + @Override + public @Nullable Object getData() { + return data; + } + } + + + + public static class Items0 extends JsonSchema implements StringSchemaValidator, StringEnumValidator, DefaultValueMethod { + private static @Nullable Items0 instance = null; + + protected Items0() { + super(new JsonSchemaInfo() + .type(Set.of( + String.class + )) + .enumValues(SetMaker.makeSet( + "available", + "pending", + "sold" + )) + .defaultValue("available") + ); + } + + public static Items0 getInstance() { + if (instance == null) { + instance = new Items0(); + } + return instance; + } + + @Override + public String validate(String arg, SchemaConfiguration configuration) throws ValidationException { + Set> pathSet = new HashSet<>(); + List pathToItem = List.of("args[0"); + String castArg = castToAllowedTypes(arg, pathToItem, pathSet); + SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().build())); + ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, new PathToSchemasMap(), new LinkedHashSet<>()); + getPathToSchemas(this, castArg, validationMetadata, pathSet); + return castArg; + } + + @Override + 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 { + 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"); + } + @Override + public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { + 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"); + } + public String defaultValue() throws ValidationException { + if (defaultValue instanceof String) { + return (String) defaultValue; + } + throw new ValidationException("Invalid type stored in defaultValue"); + } + @Override + 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 { + 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"); + } + } + + public static class SchemaList0 extends FrozenList { + protected SchemaList0(FrozenList m) { + super(m); + } + public static SchemaList0 of(List arg, SchemaConfiguration configuration) throws ValidationException { + return Schema01.getInstance().validate(arg, configuration); + } + } + + public static class SchemaListBuilder0 { + // class to build List + private final List list; + + public SchemaListBuilder0() { + list = new ArrayList<>(); + } + + public SchemaListBuilder0(List list) { + this.list = list; + } + + public SchemaListBuilder0 add(String item) { + list.add(item); + return this; + } + + public SchemaListBuilder0 add(StringItemsEnums0 item) { + list.add(item.value()); + return this; + } + + public List build() { + return list; + } + } + + + public sealed interface Schema01Boxed permits Schema01BoxedList { + @Nullable Object getData(); + } + + public record Schema01BoxedList(SchemaList0 data) implements Schema01Boxed { + @Override + public @Nullable Object getData() { + return data; + } + } + + + + public static class Schema01 extends JsonSchema implements ListSchemaValidator { + private static @Nullable Schema01 instance = null; + + protected Schema01() { + super(new JsonSchemaInfo() + .type(Set.of(List.class)) + .items(Items0.class) + ); + } + + public static Schema01 getInstance() { + if (instance == null) { + instance = new Schema01(); + } + return instance; + } + + @Override + public SchemaList0 getNewInstance(List arg, List pathToItem, PathToSchemasMap pathToSchemas) { + List items = new ArrayList<>(); + int i = 0; + for (Object item: arg) { + List itemPathToItem = new ArrayList<>(pathToItem); + itemPathToItem.add(i); + LinkedHashMap, Nothing?> schemas = pathToSchemas.get(itemPathToItem); + if (schemas == null) { + throw new RuntimeException("Validation 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"); + } + items.add((String) itemInstance); + i += 1; + } + FrozenList newInstanceItems = new FrozenList<>(items); + return new SchemaList0(newInstanceItems); + } + + 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); + SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().build())); + ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, new PathToSchemasMap(), new LinkedHashSet<>()); + PathToSchemasMap pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet); + return getNewInstance(castArg, validationMetadata.pathToItem(), pathToSchemasMap); + } + + @Override + public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws 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"); + } + @Override + public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { + 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"); + } + @Override + 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 { + 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"); + } + } +} diff --git a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/petfindbystatus/get/responses/PetfindbystatusGetCode200Response.kt b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/petfindbystatus/get/responses/PetfindbystatusGetCode200Response.kt new file mode 100644 index 00000000000..824d60a6907 --- /dev/null +++ b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/petfindbystatus/get/responses/PetfindbystatusGetCode200Response.kt @@ -0,0 +1,7 @@ +package org.openapijsonschematools.client.paths.petfindbystatus.get.responses; + +import org.openapijsonschematools.client.components.responses.SuccessfulXmlAndJsonArrayOfPet; + +public class PetfindbystatusGetCode200Response extends SuccessfulXmlAndJsonArrayOfPet { + public static class PetfindbystatusGetCode200Response1 extends SuccessfulXmlAndJsonArrayOfPet1 {} +} diff --git a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/petfindbystatus/get/responses/PetfindbystatusGetCode400Response.kt b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/petfindbystatus/get/responses/PetfindbystatusGetCode400Response.kt new file mode 100644 index 00000000000..b4e876d37af --- /dev/null +++ b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/petfindbystatus/get/responses/PetfindbystatusGetCode400Response.kt @@ -0,0 +1,45 @@ +package org.openapijsonschematools.client.paths.petfindbystatus.get.responses; + +import org.openapijsonschematools.client.configurations.SchemaConfiguration; +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; +import java.net.http.HttpResponse; +import java.net.http.HttpHeaders; + +public class PetfindbystatusGetCode400Response { + + public static class PetfindbystatusGetCode400Response1 extends ResponseDeserializer { + public PetfindbystatusGetCode400Response1() { + super( + MapUtils.makeMap( + ) + ); + } + + @Override + protected Nothing? getBody(String contentType, Nothing? mediaType, byte[] body, SchemaConfiguration configuration) { + return null; + } + + @Override + protected Nothing? getHeaders(HttpHeaders headers, SchemaConfiguration configuration) { + return null; + } + } + + @SuppressWarnings("serial") + public static class ResponseApiException extends ApiException { + public DeserializedHttpResponse deserializedResponse; + + public ResponseApiException(String s, HttpResponse response, DeserializedHttpResponse deserializedResponse) { + super(s, response); + this.deserializedResponse = deserializedResponse; + } + } +} diff --git a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/petfindbystatus/get/security/PetfindbystatusGetSecurityRequirementObject0.kt b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/petfindbystatus/get/security/PetfindbystatusGetSecurityRequirementObject0.kt new file mode 100644 index 00000000000..0f8bcbc46b0 --- /dev/null +++ b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/petfindbystatus/get/security/PetfindbystatusGetSecurityRequirementObject0.kt @@ -0,0 +1,24 @@ +package org.openapijsonschematools.client.paths.petfindbystatus.get.security; + +import org.checkerframework.checker.nullness.qual.Nullable; +import org.openapijsonschematools.client.securityrequirementobjects.SecurityRequirementObject; +import org.openapijsonschematools.client.securityschemes.SecurityScheme; +import org.openapijsonschematools.client.components.securityschemes.ApiKey; + +import java.util.List; +import java.util.Map; +import java.util.AbstractMap; + +public class PetfindbystatusGetSecurityRequirementObject0 extends SecurityRequirementObject { + + public PetfindbystatusGetSecurityRequirementObject0() { + super( + Map.ofEntries( + new AbstractMap.SimpleEntry, List>( + ApiKey.class, + List.of() + ) + ) + ); + } +} diff --git a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/petfindbystatus/get/security/PetfindbystatusGetSecurityRequirementObject1.kt b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/petfindbystatus/get/security/PetfindbystatusGetSecurityRequirementObject1.kt new file mode 100644 index 00000000000..d96864b78a1 --- /dev/null +++ b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/petfindbystatus/get/security/PetfindbystatusGetSecurityRequirementObject1.kt @@ -0,0 +1,24 @@ +package org.openapijsonschematools.client.paths.petfindbystatus.get.security; + +import org.checkerframework.checker.nullness.qual.Nullable; +import org.openapijsonschematools.client.securityrequirementobjects.SecurityRequirementObject; +import org.openapijsonschematools.client.securityschemes.SecurityScheme; +import org.openapijsonschematools.client.components.securityschemes.HttpSignatureTest; + +import java.util.List; +import java.util.Map; +import java.util.AbstractMap; + +public class PetfindbystatusGetSecurityRequirementObject1 extends SecurityRequirementObject { + + public PetfindbystatusGetSecurityRequirementObject1() { + super( + Map.ofEntries( + new AbstractMap.SimpleEntry, List>( + HttpSignatureTest.class, + List.of() + ) + ) + ); + } +} diff --git a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/petfindbystatus/get/security/PetfindbystatusGetSecurityRequirementObject2.kt b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/petfindbystatus/get/security/PetfindbystatusGetSecurityRequirementObject2.kt new file mode 100644 index 00000000000..d5da83b6640 --- /dev/null +++ b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/petfindbystatus/get/security/PetfindbystatusGetSecurityRequirementObject2.kt @@ -0,0 +1,24 @@ +package org.openapijsonschematools.client.paths.petfindbystatus.get.security; + +import org.checkerframework.checker.nullness.qual.Nullable; +import org.openapijsonschematools.client.securityrequirementobjects.SecurityRequirementObject; +import org.openapijsonschematools.client.securityschemes.SecurityScheme; +import org.openapijsonschematools.client.components.securityschemes.PetstoreAuth; + +import java.util.List; +import java.util.Map; +import java.util.AbstractMap; + +public class PetfindbystatusGetSecurityRequirementObject2 extends SecurityRequirementObject { + + public PetfindbystatusGetSecurityRequirementObject2() { + super( + Map.ofEntries( + new AbstractMap.SimpleEntry, List>( + PetstoreAuth.class, + List.of("write:pets", "read:pets") + ) + ) + ); + } +} diff --git a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/petfindbystatus/servers/PetfindbystatusServer0.kt b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/petfindbystatus/servers/PetfindbystatusServer0.kt new file mode 100644 index 00000000000..d548b1da5db --- /dev/null +++ b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/petfindbystatus/servers/PetfindbystatusServer0.kt @@ -0,0 +1,9 @@ +package org.openapijsonschematools.client.paths.petfindbystatus.servers; + +import org.openapijsonschematools.client.servers.ServerWithoutVariables; + +public class PetfindbystatusServer0 extends ServerWithoutVariables { + public PetfindbystatusServer0() { + super("https://path-server-test.petstore.local/v2"); + } +} diff --git a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/petfindbystatus/servers/PetfindbystatusServer1.kt b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/petfindbystatus/servers/PetfindbystatusServer1.kt new file mode 100644 index 00000000000..5d73d07d98b --- /dev/null +++ b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/petfindbystatus/servers/PetfindbystatusServer1.kt @@ -0,0 +1,35 @@ +package org.openapijsonschematools.client.paths.petfindbystatus.servers; + +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.PetfindbystatusServer1Variables; + +import java.util.AbstractMap; + +public class PetfindbystatusServer1 extends ServerWithVariables { + private static PetfindbystatusServer1Variables.VariablesMap getVariables() { + try { + return PetfindbystatusServer1Variables.PetfindbystatusServer1Variables1.getInstance().validate( + MapUtils.makeMap( + new AbstractMap.SimpleEntry<>("version", PetfindbystatusServer1Variables.Version.getInstance().defaultValue()) + ), + new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().build()) + ); + } catch (ValidationException e) { + throw new RuntimeException(e); + } + } + + public PetfindbystatusServer1() { + super( + "https://petstore.swagger.io/{version}", + getVariables() + ); + } + public PetfindbystatusServer1(PetfindbystatusServer1Variables.VariablesMap variables) { + super("https://petstore.swagger.io/{version}", variables); + } +} diff --git a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/petfindbystatus/servers/server1/PetfindbystatusServer1Variables.kt b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/petfindbystatus/servers/server1/PetfindbystatusServer1Variables.kt new file mode 100644 index 00000000000..b2bfb8eb040 --- /dev/null +++ b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/petfindbystatus/servers/server1/PetfindbystatusServer1Variables.kt @@ -0,0 +1,313 @@ +package org.openapijsonschematools.client.paths.petfindbystatus.servers.server1; +import java.util.ArrayList; +import java.util.HashSet; +import java.util.LinkedHashMap; +import java.util.LinkedHashSet; +import java.util.List; +import java.util.Map; +import java.util.Objects; +import java.util.Set; +import org.checkerframework.checker.nullness.qual.Nullable; +import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags; +import org.openapijsonschematools.client.configurations.SchemaConfiguration; +import org.openapijsonschematools.client.exceptions.UnsetPropertyException; +import org.openapijsonschematools.client.exceptions.ValidationException; +import org.openapijsonschematools.client.schemas.AnyTypeJsonSchema; +import org.openapijsonschematools.client.schemas.GenericBuilder; +import org.openapijsonschematools.client.schemas.NotAnyTypeJsonSchema; +import org.openapijsonschematools.client.schemas.SetMaker; +import org.openapijsonschematools.client.schemas.validation.DefaultValueMethod; +import org.openapijsonschematools.client.schemas.validation.FrozenMap; +import org.openapijsonschematools.client.schemas.validation.JsonSchema; +import org.openapijsonschematools.client.schemas.validation.JsonSchemaInfo; +import org.openapijsonschematools.client.schemas.validation.MapSchemaValidator; +import org.openapijsonschematools.client.schemas.validation.MapUtils; +import org.openapijsonschematools.client.schemas.validation.PathToSchemasMap; +import org.openapijsonschematools.client.schemas.validation.PropertyEntry; +import org.openapijsonschematools.client.schemas.validation.StringEnumValidator; +import org.openapijsonschematools.client.schemas.validation.StringSchemaValidator; +import org.openapijsonschematools.client.schemas.validation.StringValueMethod; +import org.openapijsonschematools.client.schemas.validation.ValidationMetadata; + +public class PetfindbystatusServer1Variables { + // nest classes so all schemas and input/output classes can be public + + + public static class AdditionalProperties extends NotAnyTypeJsonSchema.NotAnyTypeJsonSchema1 { + // NotAnyTypeSchema + private static @Nullable AdditionalProperties instance = null; + public static AdditionalProperties getInstance() { + if (instance == null) { + instance = new AdditionalProperties(); + } + return instance; + } + } + + public enum StringVersionEnums implements StringValueMethod { + V1("v1"), + V2("v2"); + private final String value; + + StringVersionEnums(String value) { + this.value = value; + } + public String value() { + return this.value; + } + } + + + public sealed interface VersionBoxed permits VersionBoxedString { + @Nullable Object getData(); + } + + public record VersionBoxedString(String data) implements VersionBoxed { + @Override + public @Nullable Object getData() { + return data; + } + } + + + + public static class Version extends JsonSchema implements StringSchemaValidator, StringEnumValidator, DefaultValueMethod { + private static @Nullable Version instance = null; + + protected Version() { + super(new JsonSchemaInfo() + .type(Set.of( + String.class + )) + .enumValues(SetMaker.makeSet( + "v1", + "v2" + )) + .defaultValue("v1") + ); + } + + public static Version getInstance() { + if (instance == null) { + instance = new Version(); + } + return instance; + } + + @Override + public String validate(String arg, SchemaConfiguration configuration) throws ValidationException { + Set> pathSet = new HashSet<>(); + List pathToItem = List.of("args[0"); + String castArg = castToAllowedTypes(arg, pathToItem, pathSet); + SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().build())); + ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, new PathToSchemasMap(), new LinkedHashSet<>()); + getPathToSchemas(this, castArg, validationMetadata, pathSet); + return castArg; + } + + @Override + 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 { + 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"); + } + @Override + public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { + 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"); + } + public String defaultValue() throws ValidationException { + if (defaultValue instanceof String) { + return (String) defaultValue; + } + throw new ValidationException("Invalid type stored in defaultValue"); + } + @Override + 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 { + 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"); + } + } + + public static class VariablesMap extends FrozenMap { + protected VariablesMap(FrozenMap m) { + super(m); + } + public static final Set requiredKeys = Set.of( + "version" + ); + public static final Set optionalKeys = Set.of(); + public static VariablesMap of(Map arg, SchemaConfiguration configuration) throws ValidationException { + return PetfindbystatusServer1Variables1.getInstance().validate(arg, configuration); + } + + public String version() { + try { + return getOrThrow("version"); + } catch (UnsetPropertyException e) { + throw new RuntimeException(e); + } + } + } + + public interface SetterForVersion { + Map getInstance(); + T getBuilderAfterVersion(Map instance); + + default T version(String value) { + var instance = getInstance(); + instance.put("version", value); + return getBuilderAfterVersion(instance); + } + + default T version(StringVersionEnums value) { + var instance = getInstance(); + instance.put("version", value.value()); + return getBuilderAfterVersion(instance); + } + } + + public static class VariablesMap0Builder implements GenericBuilder> { + private final Map instance; + private static final Set knownKeys = Set.of( + "version" + ); + public Set getKnownKeys() { + return knownKeys; + } + public VariablesMap0Builder(Map instance) { + this.instance = instance; + } + public Map build() { + return instance; + } + } + + public static class VariablesMapBuilder implements SetterForVersion { + private final Map instance; + public VariablesMapBuilder() { + this.instance = new LinkedHashMap<>(); + } + public Map getInstance() { + return instance; + } + public VariablesMap0Builder getBuilderAfterVersion(Map instance) { + return new VariablesMap0Builder(instance); + } + } + + + public sealed interface PetfindbystatusServer1Variables1Boxed permits PetfindbystatusServer1Variables1BoxedMap { + @Nullable Object getData(); + } + + public record PetfindbystatusServer1Variables1BoxedMap(VariablesMap data) implements PetfindbystatusServer1Variables1Boxed { + @Override + public @Nullable Object getData() { + return data; + } + } + + + public static class PetfindbystatusServer1Variables1 extends JsonSchema implements MapSchemaValidator { + private static @Nullable PetfindbystatusServer1Variables1 instance = null; + + protected PetfindbystatusServer1Variables1() { + super(new JsonSchemaInfo() + .type(Set.of(Map.class)) + .properties(Map.ofEntries( + new PropertyEntry("version", Version.class) + )) + .required(Set.of( + "version" + )) + .additionalProperties(AdditionalProperties.class) + ); + } + + public static PetfindbystatusServer1Variables1 getInstance() { + if (instance == null) { + instance = new PetfindbystatusServer1Variables1(); + } + return instance; + } + + 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 RuntimeException("Invalid non-string key value"); + } + String propertyName = (String) entryKey; + List propertyPathToItem = new ArrayList<>(pathToItem); + propertyPathToItem.add(propertyName); + Object value = entry.getValue(); + LinkedHashMap, Nothing?> schemas = pathToSchemas.get(propertyPathToItem); + if (schemas == null) { + throw new RuntimeException("Validation 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"); + } + properties.put(propertyName, (String) propertyInstance); + } + FrozenMap castProperties = new FrozenMap<>(properties); + return new VariablesMap(castProperties); + } + + 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); + SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().build())); + ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, new PathToSchemasMap(), new LinkedHashSet<>()); + PathToSchemasMap pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet); + return getNewInstance(castArg, validationMetadata.pathToItem(), pathToSchemasMap); + } + + + @Override + public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws 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"); + } + @Override + public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { + if (arg instanceof Map) { + return getNewInstance((Map) arg, pathToItem, pathToSchemas); + } + throw new RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); + } + @Override + public PetfindbystatusServer1Variables1BoxedMap validateAndBox(Map arg, SchemaConfiguration configuration) throws ValidationException { + return new PetfindbystatusServer1Variables1BoxedMap(validate(arg, configuration)); + } + @Override + public PetfindbystatusServer1Variables1Boxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { + 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"); + } + } + +} diff --git a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/petfindbytags/PetfindbytagsGet.kt b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/petfindbytags/PetfindbytagsGet.kt new file mode 100644 index 00000000000..d747aca39f8 --- /dev/null +++ b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/petfindbytags/PetfindbytagsGet.kt @@ -0,0 +1,212 @@ +package org.openapijsonschematools.client.paths.petfindbytags; + +import org.checkerframework.checker.nullness.qual.Nullable; +import org.openapijsonschematools.client.RootServerInfo; +import org.openapijsonschematools.client.paths.petfindbytags.get.PetfindbytagsGetSecurityInfo; +import org.openapijsonschematools.client.paths.petfindbytags.get.PetfindbytagsGetQueryParameters; +import org.openapijsonschematools.client.paths.petfindbytags.get.Parameters; +import org.openapijsonschematools.client.paths.petfindbytags.get.PetfindbytagsGetResponses; +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.paths.Petfindbytags; +import org.openapijsonschematools.client.securityrequirementobjects.SecurityRequirementObject; +import org.openapijsonschematools.client.securityrequirementobjects.AuthApplier; + +import java.io.IOException; +import java.net.http.HttpClient; +import java.net.http.HttpRequest; +import java.time.Duration; +import java.util.List; +import java.util.Map; + +public class PetfindbytagsGet { + private static class GetProvider extends AuthApplier { + private static final String method = "get"; + + public static PetfindbytagsGetResponses.EndpointResponse get( + GetRequest request, + ApiConfiguration apiConfiguration, + SchemaConfiguration schemaConfiguration, + HttpClient client + ) throws IOException, InterruptedException, ValidationException, NotImplementedException, ApiException { + Map> headers = apiConfiguration.getDefaultHeaders(); + HttpRequest.BodyPublisher bodyPublisher = HttpRequest.BodyPublishers.noBody(); + + var querySerializer = new Parameters.QueryParametersSerializer(); + @Nullable Map queryMap = querySerializer.getQueryMap(request.queryParameters); + String host = apiConfiguration.getServer(request.serverIndex).url(); + SecurityRequirementObject securityRequirementObject = apiConfiguration.getSecurityRequirementObject(request.securityIndex); + updateParamsForAuth( + securityRequirementObject, + headers, + Petfindbytags.path, + method, + bodyPublisher, + queryMap, + apiConfiguration + ); + + String url = host + Petfindbytags.path; + if (queryMap != null) { + url = url + querySerializer.serialize(queryMap); + } + var httpRequest = RestClient.getRequest( + url, + method, + bodyPublisher, + headers, + request.timeout + ); + var response = RestClient.getResponse(httpRequest, client); + var responsesDeserializer = new PetfindbytagsGetResponses.PetfindbytagsGetResponses1(); + return responsesDeserializer.deserialize(response, schemaConfiguration); + } + } + + public interface GetOperation { + ApiConfiguration getApiConfiguration(); + SchemaConfiguration getSchemaConfiguration(); + HttpClient getClient(); + default PetfindbytagsGetResponses.EndpointResponse get(GetRequest request) throws IOException, InterruptedException, ValidationException, NotImplementedException, ApiException { + return GetProvider.get(request, getApiConfiguration(), getSchemaConfiguration(), getClient()); + } + } + + public interface FindPetsByTagsOperation { + ApiConfiguration getApiConfiguration(); + SchemaConfiguration getSchemaConfiguration(); + HttpClient getClient(); + default PetfindbytagsGetResponses.EndpointResponse findPetsByTags(GetRequest request) throws IOException, InterruptedException, ValidationException, NotImplementedException, ApiException { + return GetProvider.get(request, getApiConfiguration(), getSchemaConfiguration(), getClient()); + } + } + + public static class Get extends ApiClient implements GetOperation { + public Get(ApiConfiguration apiConfiguration, SchemaConfiguration schemaConfiguration) { + super(apiConfiguration, schemaConfiguration); + } + } + + public static class GetRequest { + public PetfindbytagsGetQueryParameters.QueryParametersMap queryParameters; + public RootServerInfo.@Nullable ServerIndex serverIndex; + public PetfindbytagsGetSecurityInfo.@Nullable SecurityIndex securityIndex; + public @Nullable Duration timeout; + + public GetRequest( + PetfindbytagsGetQueryParameters.QueryParametersMap queryParameters, + RootServerInfo.@Nullable ServerIndex serverIndex, + PetfindbytagsGetSecurityInfo.@Nullable SecurityIndex securityIndex, + @Nullable Duration timeout + ) { + this.queryParameters = queryParameters; + this.serverIndex = serverIndex; + this.securityIndex = securityIndex; + this.timeout = timeout; + } + } + + public static class GetNullableRequest { + public PetfindbytagsGetQueryParameters.@Nullable QueryParametersMap queryParameters; + public RootServerInfo.@Nullable ServerIndex serverIndex; + public PetfindbytagsGetSecurityInfo.@Nullable SecurityIndex securityIndex; + public @Nullable Duration timeout; + } + + public interface SetterForServerIndex { + GetNullableRequest getInstance(); + T getBuilderAfterServerIndex(GetNullableRequest instance); + default T serverIndex(RootServerInfo.ServerIndex serverIndex) { + var instance = getInstance(); + instance.serverIndex = serverIndex; + return getBuilderAfterServerIndex(instance); + } + } + + public interface SetterForSecurityIndex { + GetNullableRequest getInstance(); + T getBuilderAfterSecurityIndex(GetNullableRequest instance); + default T securityIndex(PetfindbytagsGetSecurityInfo.SecurityIndex securityIndex) { + var instance = getInstance(); + instance.securityIndex = securityIndex; + return getBuilderAfterSecurityIndex(instance); + } + } + + public interface SetterForTimeout { + GetNullableRequest getInstance(); + T getBuilderAfterTimeout(GetNullableRequest instance); + default T timeout(Duration timeout) { + var instance = getInstance(); + instance.timeout = timeout; + return getBuilderAfterTimeout(instance); + } + } + + public interface SetterForQueryParameters { + GetNullableRequest getInstance(); + T getBuilderAfterQueryParameters(GetNullableRequest instance); + default T queryParameters(PetfindbytagsGetQueryParameters.QueryParametersMap queryParameters) { + var instance = getInstance(); + instance.queryParameters = queryParameters; + return getBuilderAfterQueryParameters(instance); + } + } + + public static class Get0RequestBuilder implements SetterForServerIndex, SetterForSecurityIndex, SetterForTimeout { + private final GetNullableRequest instance; + + public Get0RequestBuilder(GetNullableRequest instance) { + this.instance = instance; + } + + public GetRequest build() { + var queryParameters = instance.queryParameters; + if (queryParameters == null) { + throw new RuntimeException("invalid null value for required parameter"); + } + return new GetRequest( + queryParameters, + instance.serverIndex, + instance.securityIndex, + instance.timeout + ); + } + + public GetNullableRequest getInstance() { + return instance; + } + + public Get0RequestBuilder getBuilderAfterServerIndex(GetNullableRequest instance) { + return this; + } + + public Get0RequestBuilder getBuilderAfterSecurityIndex(GetNullableRequest instance) { + return this; + } + + public Get0RequestBuilder getBuilderAfterTimeout(GetNullableRequest instance) { + return this; + } + } + public static class GetRequestBuilder implements SetterForQueryParameters { + private final GetNullableRequest instance; + + public GetRequestBuilder() { + this.instance = new GetNullableRequest(); + } + + public GetNullableRequest getInstance() { + return instance; + } + + public Get0RequestBuilder getBuilderAfterQueryParameters(GetNullableRequest instance) { + return new Get0RequestBuilder(instance); + } + } +} diff --git a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/petfindbytags/get/Parameters.kt b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/petfindbytags/get/Parameters.kt new file mode 100644 index 00000000000..5974cc73733 --- /dev/null +++ b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/petfindbytags/get/Parameters.kt @@ -0,0 +1,20 @@ +package org.openapijsonschematools.client.paths.petfindbytags.get; + +import org.openapijsonschematools.client.paths.petfindbytags.get.parameters.Parameter0; +import org.openapijsonschematools.client.parameter.QuerySerializer; + +import java.util.Map; +import java.util.AbstractMap; + +public class Parameters { + + public static class QueryParametersSerializer extends QuerySerializer { + public QueryParametersSerializer() { + super( + Map.ofEntries( + new AbstractMap.SimpleEntry<>("tags", new Parameter0.Parameter01()) + ) + ); + } + } +} diff --git a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/petfindbytags/get/PetfindbytagsGetQueryParameters.kt b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/petfindbytags/get/PetfindbytagsGetQueryParameters.kt new file mode 100644 index 00000000000..fde4fec0230 --- /dev/null +++ b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/petfindbytags/get/PetfindbytagsGetQueryParameters.kt @@ -0,0 +1,206 @@ +package org.openapijsonschematools.client.paths.petfindbytags.get; +import java.util.ArrayList; +import java.util.HashSet; +import java.util.LinkedHashMap; +import java.util.LinkedHashSet; +import java.util.List; +import java.util.Map; +import java.util.Objects; +import java.util.Set; +import org.checkerframework.checker.nullness.qual.Nullable; +import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags; +import org.openapijsonschematools.client.configurations.SchemaConfiguration; +import org.openapijsonschematools.client.exceptions.UnsetPropertyException; +import org.openapijsonschematools.client.exceptions.ValidationException; +import org.openapijsonschematools.client.paths.petfindbytags.get.parameters.parameter0.Schema0; +import org.openapijsonschematools.client.schemas.AnyTypeJsonSchema; +import org.openapijsonschematools.client.schemas.GenericBuilder; +import org.openapijsonschematools.client.schemas.NotAnyTypeJsonSchema; +import org.openapijsonschematools.client.schemas.validation.FrozenList; +import org.openapijsonschematools.client.schemas.validation.FrozenMap; +import org.openapijsonschematools.client.schemas.validation.JsonSchema; +import org.openapijsonschematools.client.schemas.validation.JsonSchemaInfo; +import org.openapijsonschematools.client.schemas.validation.MapSchemaValidator; +import org.openapijsonschematools.client.schemas.validation.MapUtils; +import org.openapijsonschematools.client.schemas.validation.PathToSchemasMap; +import org.openapijsonschematools.client.schemas.validation.PropertyEntry; +import org.openapijsonschematools.client.schemas.validation.ValidationMetadata; + +public class PetfindbytagsGetQueryParameters { + // nest classes so all schemas and input/output classes can be public + + + public static class AdditionalProperties extends NotAnyTypeJsonSchema.NotAnyTypeJsonSchema1 { + // NotAnyTypeSchema + private static @Nullable AdditionalProperties instance = null; + public static AdditionalProperties getInstance() { + if (instance == null) { + instance = new AdditionalProperties(); + } + return instance; + } + } + + + public static class QueryParametersMap extends FrozenMap { + protected QueryParametersMap(FrozenMap m) { + super(m); + } + public static final Set requiredKeys = Set.of( + "tags" + ); + public static final Set optionalKeys = Set.of(); + public static QueryParametersMap of(Map> arg, SchemaConfiguration configuration) throws ValidationException { + return PetfindbytagsGetQueryParameters1.getInstance().validate(arg, configuration); + } + + public Schema0.SchemaList0 tags() { + try { + return getOrThrow("version"); + } catch (UnsetPropertyException e) { + throw new RuntimeException(e); + } + } + } + + public interface SetterForTags { + Map> getInstance(); + T getBuilderAfterTags(Map> instance); + + default T tags(List value) { + var instance = getInstance(); + instance.put("tags", value); + return getBuilderAfterTags(instance); + } + } + + public static class QueryParametersMap0Builder implements GenericBuilder>> { + private final Map> instance; + private static final Set knownKeys = Set.of( + "tags" + ); + public Set getKnownKeys() { + return knownKeys; + } + public QueryParametersMap0Builder(Map> instance) { + this.instance = instance; + } + public Map> build() { + return instance; + } + } + + public static class QueryParametersMapBuilder implements SetterForTags { + private final Map> instance; + public QueryParametersMapBuilder() { + this.instance = new LinkedHashMap<>(); + } + public Map> getInstance() { + return instance; + } + public QueryParametersMap0Builder getBuilderAfterTags(Map> instance) { + return new QueryParametersMap0Builder(instance); + } + } + + + public sealed interface PetfindbytagsGetQueryParameters1Boxed permits PetfindbytagsGetQueryParameters1BoxedMap { + @Nullable Object getData(); + } + + public record PetfindbytagsGetQueryParameters1BoxedMap(QueryParametersMap data) implements PetfindbytagsGetQueryParameters1Boxed { + @Override + public @Nullable Object getData() { + return data; + } + } + + + public static class PetfindbytagsGetQueryParameters1 extends JsonSchema implements MapSchemaValidator { + private static @Nullable PetfindbytagsGetQueryParameters1 instance = null; + + protected PetfindbytagsGetQueryParameters1() { + super(new JsonSchemaInfo() + .type(Set.of(Map.class)) + .properties(Map.ofEntries( + new PropertyEntry("tags", Schema0.Schema01.class) + )) + .required(Set.of( + "tags" + )) + .additionalProperties(AdditionalProperties.class) + ); + } + + public static PetfindbytagsGetQueryParameters1 getInstance() { + if (instance == null) { + instance = new PetfindbytagsGetQueryParameters1(); + } + return instance; + } + + 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 RuntimeException("Invalid non-string key value"); + } + String propertyName = (String) entryKey; + List propertyPathToItem = new ArrayList<>(pathToItem); + propertyPathToItem.add(propertyName); + Object value = entry.getValue(); + LinkedHashMap, Nothing?> schemas = pathToSchemas.get(propertyPathToItem); + if (schemas == null) { + throw new RuntimeException("Validation 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"); + } + properties.put(propertyName, (Schema0.SchemaList0) propertyInstance); + } + FrozenMap castProperties = new FrozenMap<>(properties); + return new QueryParametersMap(castProperties); + } + + 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); + SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().build())); + ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, new PathToSchemasMap(), new LinkedHashSet<>()); + PathToSchemasMap pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet); + return getNewInstance(castArg, validationMetadata.pathToItem(), pathToSchemasMap); + } + + + @Override + public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws 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"); + } + @Override + public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { + if (arg instanceof Map) { + return getNewInstance((Map) arg, pathToItem, pathToSchemas); + } + throw new RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); + } + @Override + public PetfindbytagsGetQueryParameters1BoxedMap validateAndBox(Map arg, SchemaConfiguration configuration) throws ValidationException { + return new PetfindbytagsGetQueryParameters1BoxedMap(validate(arg, configuration)); + } + @Override + public PetfindbytagsGetQueryParameters1Boxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { + 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"); + } + } + +} diff --git a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/petfindbytags/get/PetfindbytagsGetResponses.kt b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/petfindbytags/get/PetfindbytagsGetResponses.kt new file mode 100644 index 00000000000..2070049e403 --- /dev/null +++ b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/petfindbytags/get/PetfindbytagsGetResponses.kt @@ -0,0 +1,66 @@ +package org.openapijsonschematools.client.paths.petfindbytags.get; + +import org.openapijsonschematools.client.paths.petfindbytags.get.responses.PetfindbytagsGetCode200Response; +import org.openapijsonschematools.client.paths.petfindbytags.get.responses.PetfindbytagsGetCode400Response; +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; +import org.checkerframework.checker.nullness.qual.Nullable; + +import java.net.http.HttpResponse; +import java.util.Map; +import java.util.AbstractMap; + +public class PetfindbytagsGetResponses { + public sealed interface EndpointResponse permits EndpointPetfindbytagsGetCode200Response {} + + public record EndpointPetfindbytagsGetCode200Response( + HttpResponse response, + PetfindbytagsGetCode200Response.SealedResponseBody body, + Nothing? headers + ) implements EndpointResponse, ApiResponse{ + } + + public sealed interface StatusCodeResponseDeserializer permits StatusPetfindbytagsGetCode200ResponseDeserializer, StatusPetfindbytagsGetCode400ResponseDeserializer {} + + public static final class StatusPetfindbytagsGetCode200ResponseDeserializer extends PetfindbytagsGetCode200Response.PetfindbytagsGetCode200Response1 implements StatusCodeResponseDeserializer { + } + public static final class StatusPetfindbytagsGetCode400ResponseDeserializer extends PetfindbytagsGetCode400Response.PetfindbytagsGetCode400Response1 implements StatusCodeResponseDeserializer { + } + + public static final class PetfindbytagsGetResponses1 implements ResponsesDeserializer { + private final Map statusCodeToResponseDeserializer; + public PetfindbytagsGetResponses1() { + this.statusCodeToResponseDeserializer = Map.ofEntries( + new AbstractMap.SimpleEntry<>("200", new StatusPetfindbytagsGetCode200ResponseDeserializer()), + new AbstractMap.SimpleEntry<>("400", new StatusPetfindbytagsGetCode400ResponseDeserializer()) + ); + } + + 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) { + throw new ApiException( + "Invalid response statusCode="+statusCode+" has no response defined in the openapi document", + response + ); + } + if (statusCodeDeserializer instanceof StatusPetfindbytagsGetCode200ResponseDeserializer castDeserializer) { + var deserializedResponse = castDeserializer.deserialize(response, configuration); + return new EndpointPetfindbytagsGetCode200Response(response, deserializedResponse.body(), deserializedResponse.headers()); + } else { + StatusPetfindbytagsGetCode400ResponseDeserializer castDeserializer = (StatusPetfindbytagsGetCode400ResponseDeserializer) statusCodeDeserializer; + var deserializedResponse = castDeserializer.deserialize(response, configuration); + throw new PetfindbytagsGetCode400Response.ResponseApiException( + "Received error statusCode response from server", + response, + deserializedResponse + ); + } + } + } +} diff --git a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/petfindbytags/get/PetfindbytagsGetSecurityInfo.kt b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/petfindbytags/get/PetfindbytagsGetSecurityInfo.kt new file mode 100644 index 00000000000..4c4856f98eb --- /dev/null +++ b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/petfindbytags/get/PetfindbytagsGetSecurityInfo.kt @@ -0,0 +1,33 @@ +package org.openapijsonschematools.client.paths.petfindbytags.get; + +import org.openapijsonschematools.client.paths.petfindbytags.get.security.PetfindbytagsGetSecurityRequirementObject0; +import org.openapijsonschematools.client.paths.petfindbytags.get.security.PetfindbytagsGetSecurityRequirementObject1; +import org.openapijsonschematools.client.securityrequirementobjects.SecurityRequirementObject; +import org.openapijsonschematools.client.securityrequirementobjects.SecurityRequirementObjectProvider; + +public class PetfindbytagsGetSecurityInfo { + public static class PetfindbytagsGetSecurityInfo1 implements SecurityRequirementObjectProvider { + public final PetfindbytagsGetSecurityRequirementObject0 security0; + public final PetfindbytagsGetSecurityRequirementObject1 security1; + + public PetfindbytagsGetSecurityInfo1() { + security0 = new PetfindbytagsGetSecurityRequirementObject0(); + security1 = new PetfindbytagsGetSecurityRequirementObject1(); + } + + @Override + public SecurityRequirementObject getSecurityRequirementObject(SecurityIndex securityIndex) { + switch (securityIndex) { + case SECURITY_0: + return security0; + default: + return security1; + } + } + } + + public enum SecurityIndex { + SECURITY_0, + SECURITY_1 + } +} \ No newline at end of file diff --git a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/petfindbytags/get/parameters/Parameter0.kt b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/petfindbytags/get/parameters/Parameter0.kt new file mode 100644 index 00000000000..43633e1742d --- /dev/null +++ b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/petfindbytags/get/parameters/Parameter0.kt @@ -0,0 +1,23 @@ +package org.openapijsonschematools.client.paths.petfindbytags.get.parameters; + +import org.openapijsonschematools.client.parameter.ParameterStyle; +import org.openapijsonschematools.client.parameter.ParameterInType; +import org.openapijsonschematools.client.parameter.SchemaParameter; +import org.openapijsonschematools.client.paths.petfindbytags.get.parameters.parameter0.Schema0; + +public class Parameter0 { + + public static class Parameter01 extends SchemaParameter { + public Parameter01() { + super( + "tags", + ParameterInType.QUERY, + true, + ParameterStyle.FORM, + false, + false, + Schema0.Schema01.getInstance() + ); + } + } +} diff --git a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/petfindbytags/get/parameters/parameter0/Schema0.kt b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/petfindbytags/get/parameters/parameter0/Schema0.kt new file mode 100644 index 00000000000..51bfffac734 --- /dev/null +++ b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/petfindbytags/get/parameters/parameter0/Schema0.kt @@ -0,0 +1,157 @@ +package org.openapijsonschematools.client.paths.petfindbytags.get.parameters.parameter0; +import java.util.ArrayList; +import java.util.HashSet; +import java.util.LinkedHashMap; +import java.util.LinkedHashSet; +import java.util.List; +import java.util.Objects; +import java.util.Set; +import org.checkerframework.checker.nullness.qual.Nullable; +import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags; +import org.openapijsonschematools.client.configurations.SchemaConfiguration; +import org.openapijsonschematools.client.exceptions.ValidationException; +import org.openapijsonschematools.client.schemas.StringJsonSchema; +import org.openapijsonschematools.client.schemas.validation.FrozenList; +import org.openapijsonschematools.client.schemas.validation.JsonSchema; +import org.openapijsonschematools.client.schemas.validation.JsonSchemaInfo; +import org.openapijsonschematools.client.schemas.validation.ListSchemaValidator; +import org.openapijsonschematools.client.schemas.validation.PathToSchemasMap; +import org.openapijsonschematools.client.schemas.validation.ValidationMetadata; + +public class Schema0 { + // nest classes so all schemas and input/output classes can be public + + + public static class Items0 extends StringJsonSchema.StringJsonSchema1 { + private static @Nullable Items0 instance = null; + public static Items0 getInstance() { + if (instance == null) { + instance = new Items0(); + } + return instance; + } + } + + + public static class SchemaList0 extends FrozenList { + protected SchemaList0(FrozenList m) { + super(m); + } + public static SchemaList0 of(List arg, SchemaConfiguration configuration) throws ValidationException { + return Schema01.getInstance().validate(arg, configuration); + } + } + + public static class SchemaListBuilder0 { + // class to build List + private final List list; + + public SchemaListBuilder0() { + list = new ArrayList<>(); + } + + public SchemaListBuilder0(List list) { + this.list = list; + } + + public SchemaListBuilder0 add(String item) { + list.add(item); + return this; + } + + public List build() { + return list; + } + } + + + public sealed interface Schema01Boxed permits Schema01BoxedList { + @Nullable Object getData(); + } + + public record Schema01BoxedList(SchemaList0 data) implements Schema01Boxed { + @Override + public @Nullable Object getData() { + return data; + } + } + + + + public static class Schema01 extends JsonSchema implements ListSchemaValidator { + private static @Nullable Schema01 instance = null; + + protected Schema01() { + super(new JsonSchemaInfo() + .type(Set.of(List.class)) + .items(Items0.class) + ); + } + + public static Schema01 getInstance() { + if (instance == null) { + instance = new Schema01(); + } + return instance; + } + + @Override + public SchemaList0 getNewInstance(List arg, List pathToItem, PathToSchemasMap pathToSchemas) { + List items = new ArrayList<>(); + int i = 0; + for (Object item: arg) { + List itemPathToItem = new ArrayList<>(pathToItem); + itemPathToItem.add(i); + LinkedHashMap, Nothing?> schemas = pathToSchemas.get(itemPathToItem); + if (schemas == null) { + throw new RuntimeException("Validation 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"); + } + items.add((String) itemInstance); + i += 1; + } + FrozenList newInstanceItems = new FrozenList<>(items); + return new SchemaList0(newInstanceItems); + } + + 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); + SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().build())); + ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, new PathToSchemasMap(), new LinkedHashSet<>()); + PathToSchemasMap pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet); + return getNewInstance(castArg, validationMetadata.pathToItem(), pathToSchemasMap); + } + + @Override + public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws 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"); + } + @Override + public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { + 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"); + } + @Override + 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 { + 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"); + } + } +} diff --git a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/petfindbytags/get/responses/PetfindbytagsGetCode200Response.kt b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/petfindbytags/get/responses/PetfindbytagsGetCode200Response.kt new file mode 100644 index 00000000000..bd576d29b7e --- /dev/null +++ b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/petfindbytags/get/responses/PetfindbytagsGetCode200Response.kt @@ -0,0 +1,7 @@ +package org.openapijsonschematools.client.paths.petfindbytags.get.responses; + +import org.openapijsonschematools.client.components.responses.RefSuccessfulXmlAndJsonArrayOfPet; + +public class PetfindbytagsGetCode200Response extends RefSuccessfulXmlAndJsonArrayOfPet { + public static class PetfindbytagsGetCode200Response1 extends RefSuccessfulXmlAndJsonArrayOfPet1 {} +} diff --git a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/petfindbytags/get/responses/PetfindbytagsGetCode400Response.kt b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/petfindbytags/get/responses/PetfindbytagsGetCode400Response.kt new file mode 100644 index 00000000000..e54e8b95c8a --- /dev/null +++ b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/petfindbytags/get/responses/PetfindbytagsGetCode400Response.kt @@ -0,0 +1,45 @@ +package org.openapijsonschematools.client.paths.petfindbytags.get.responses; + +import org.openapijsonschematools.client.configurations.SchemaConfiguration; +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; +import java.net.http.HttpResponse; +import java.net.http.HttpHeaders; + +public class PetfindbytagsGetCode400Response { + + public static class PetfindbytagsGetCode400Response1 extends ResponseDeserializer { + public PetfindbytagsGetCode400Response1() { + super( + MapUtils.makeMap( + ) + ); + } + + @Override + protected Nothing? getBody(String contentType, Nothing? mediaType, byte[] body, SchemaConfiguration configuration) { + return null; + } + + @Override + protected Nothing? getHeaders(HttpHeaders headers, SchemaConfiguration configuration) { + return null; + } + } + + @SuppressWarnings("serial") + public static class ResponseApiException extends ApiException { + public DeserializedHttpResponse deserializedResponse; + + public ResponseApiException(String s, HttpResponse response, DeserializedHttpResponse deserializedResponse) { + super(s, response); + this.deserializedResponse = deserializedResponse; + } + } +} diff --git a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/petfindbytags/get/security/PetfindbytagsGetSecurityRequirementObject0.kt b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/petfindbytags/get/security/PetfindbytagsGetSecurityRequirementObject0.kt new file mode 100644 index 00000000000..5ce1d1f7054 --- /dev/null +++ b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/petfindbytags/get/security/PetfindbytagsGetSecurityRequirementObject0.kt @@ -0,0 +1,24 @@ +package org.openapijsonschematools.client.paths.petfindbytags.get.security; + +import org.checkerframework.checker.nullness.qual.Nullable; +import org.openapijsonschematools.client.securityrequirementobjects.SecurityRequirementObject; +import org.openapijsonschematools.client.securityschemes.SecurityScheme; +import org.openapijsonschematools.client.components.securityschemes.HttpSignatureTest; + +import java.util.List; +import java.util.Map; +import java.util.AbstractMap; + +public class PetfindbytagsGetSecurityRequirementObject0 extends SecurityRequirementObject { + + public PetfindbytagsGetSecurityRequirementObject0() { + super( + Map.ofEntries( + new AbstractMap.SimpleEntry, List>( + HttpSignatureTest.class, + List.of() + ) + ) + ); + } +} diff --git a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/petfindbytags/get/security/PetfindbytagsGetSecurityRequirementObject1.kt b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/petfindbytags/get/security/PetfindbytagsGetSecurityRequirementObject1.kt new file mode 100644 index 00000000000..2f7ef1e7674 --- /dev/null +++ b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/petfindbytags/get/security/PetfindbytagsGetSecurityRequirementObject1.kt @@ -0,0 +1,24 @@ +package org.openapijsonschematools.client.paths.petfindbytags.get.security; + +import org.checkerframework.checker.nullness.qual.Nullable; +import org.openapijsonschematools.client.securityrequirementobjects.SecurityRequirementObject; +import org.openapijsonschematools.client.securityschemes.SecurityScheme; +import org.openapijsonschematools.client.components.securityschemes.PetstoreAuth; + +import java.util.List; +import java.util.Map; +import java.util.AbstractMap; + +public class PetfindbytagsGetSecurityRequirementObject1 extends SecurityRequirementObject { + + public PetfindbytagsGetSecurityRequirementObject1() { + super( + Map.ofEntries( + new AbstractMap.SimpleEntry, List>( + PetstoreAuth.class, + List.of("write:pets", "read:pets") + ) + ) + ); + } +} diff --git a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/petpetid/PetpetidDelete.kt b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/petpetid/PetpetidDelete.kt new file mode 100644 index 00000000000..1a7e142619e --- /dev/null +++ b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/petpetid/PetpetidDelete.kt @@ -0,0 +1,236 @@ +package org.openapijsonschematools.client.paths.petpetid; + +import org.checkerframework.checker.nullness.qual.Nullable; +import org.openapijsonschematools.client.paths.petpetid.delete.PetpetidDeleteHeaderParameters; +import org.openapijsonschematools.client.RootServerInfo; +import org.openapijsonschematools.client.paths.petpetid.delete.PetpetidDeleteSecurityInfo; +import org.openapijsonschematools.client.paths.petpetid.delete.PetpetidDeletePathParameters; +import org.openapijsonschematools.client.paths.petpetid.delete.Parameters; +import org.openapijsonschematools.client.paths.petpetid.delete.PetpetidDeleteResponses; +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.paths.Petpetid; +import org.openapijsonschematools.client.securityrequirementobjects.SecurityRequirementObject; +import org.openapijsonschematools.client.securityrequirementobjects.AuthApplier; + +import java.io.IOException; +import java.net.http.HttpClient; +import java.net.http.HttpRequest; +import java.time.Duration; +import java.util.List; +import java.util.Map; + +public class PetpetidDelete { + private static class DeleteProvider extends AuthApplier { + private static final String method = "delete"; + + public static Nothing? delete( + DeleteRequest request, + ApiConfiguration apiConfiguration, + SchemaConfiguration schemaConfiguration, + HttpClient client + ) throws IOException, InterruptedException, ValidationException, NotImplementedException, ApiException { + Map> headers = apiConfiguration.getDefaultHeaders(); + HttpRequest.BodyPublisher bodyPublisher = HttpRequest.BodyPublishers.noBody(); + + if (request.headerParameters != null) { + var headersSerializer = new Parameters.HeaderParametersSerializer(); + Map> serializedHeaders = headersSerializer.serialize(request.headerParameters); + headers.putAll(serializedHeaders); + } + + var pathSerializer = new Parameters.PathParametersSerializer(); + String updatedPath = pathSerializer.serialize(request.pathParameters, Petpetid.path); + // TODO set this to a map if there is a query security scheme + @Nullable Map queryMap = null; + String host = apiConfiguration.getServer(request.serverIndex).url(); + SecurityRequirementObject securityRequirementObject = apiConfiguration.getSecurityRequirementObject(request.securityIndex); + updateParamsForAuth( + securityRequirementObject, + headers, + updatedPath, + method, + bodyPublisher, + queryMap, + apiConfiguration + ); + + String url = host + updatedPath; + var httpRequest = RestClient.getRequest( + url, + method, + bodyPublisher, + headers, + request.timeout + ); + var response = RestClient.getResponse(httpRequest, client); + return (Nothing?) null; + } + } + + public interface DeleteOperation { + ApiConfiguration getApiConfiguration(); + SchemaConfiguration getSchemaConfiguration(); + HttpClient getClient(); + default Nothing? delete(DeleteRequest request) throws IOException, InterruptedException, ValidationException, NotImplementedException, ApiException { + return DeleteProvider.delete(request, getApiConfiguration(), getSchemaConfiguration(), getClient()); + } + } + + public interface DeletePetOperation { + ApiConfiguration getApiConfiguration(); + SchemaConfiguration getSchemaConfiguration(); + HttpClient getClient(); + default Nothing? deletePet(DeleteRequest request) throws IOException, InterruptedException, ValidationException, NotImplementedException, ApiException { + return DeleteProvider.delete(request, getApiConfiguration(), getSchemaConfiguration(), getClient()); + } + } + + public static class Delete extends ApiClient implements DeleteOperation { + public Delete(ApiConfiguration apiConfiguration, SchemaConfiguration schemaConfiguration) { + super(apiConfiguration, schemaConfiguration); + } + } + + public static class DeleteRequest { + public PetpetidDeletePathParameters.PathParametersMap pathParameters; + public PetpetidDeleteHeaderParameters.@Nullable HeaderParametersMap headerParameters; + public RootServerInfo.@Nullable ServerIndex serverIndex; + public PetpetidDeleteSecurityInfo.@Nullable SecurityIndex securityIndex; + public @Nullable Duration timeout; + + public DeleteRequest( + PetpetidDeletePathParameters.PathParametersMap pathParameters, + PetpetidDeleteHeaderParameters.@Nullable HeaderParametersMap headerParameters, + RootServerInfo.@Nullable ServerIndex serverIndex, + PetpetidDeleteSecurityInfo.@Nullable SecurityIndex securityIndex, + @Nullable Duration timeout + ) { + this.pathParameters = pathParameters; + this.headerParameters = headerParameters; + this.serverIndex = serverIndex; + this.securityIndex = securityIndex; + this.timeout = timeout; + } + } + + public static class DeleteNullableRequest { + public PetpetidDeletePathParameters.@Nullable PathParametersMap pathParameters; + public PetpetidDeleteHeaderParameters.@Nullable HeaderParametersMap headerParameters; + public RootServerInfo.@Nullable ServerIndex serverIndex; + public PetpetidDeleteSecurityInfo.@Nullable SecurityIndex securityIndex; + public @Nullable Duration timeout; + } + + public interface SetterForHeaderParameters { + DeleteNullableRequest getInstance(); + T getBuilderAfterHeaderParameters(DeleteNullableRequest instance); + default T headerParameters(PetpetidDeleteHeaderParameters.HeaderParametersMap headerParameters) { + var instance = getInstance(); + instance.headerParameters = headerParameters; + return getBuilderAfterHeaderParameters(instance); + } + } + + public interface SetterForServerIndex { + DeleteNullableRequest getInstance(); + T getBuilderAfterServerIndex(DeleteNullableRequest instance); + default T serverIndex(RootServerInfo.ServerIndex serverIndex) { + var instance = getInstance(); + instance.serverIndex = serverIndex; + return getBuilderAfterServerIndex(instance); + } + } + + public interface SetterForSecurityIndex { + DeleteNullableRequest getInstance(); + T getBuilderAfterSecurityIndex(DeleteNullableRequest instance); + default T securityIndex(PetpetidDeleteSecurityInfo.SecurityIndex securityIndex) { + var instance = getInstance(); + instance.securityIndex = securityIndex; + return getBuilderAfterSecurityIndex(instance); + } + } + + public interface SetterForTimeout { + DeleteNullableRequest getInstance(); + T getBuilderAfterTimeout(DeleteNullableRequest instance); + default T timeout(Duration timeout) { + var instance = getInstance(); + instance.timeout = timeout; + return getBuilderAfterTimeout(instance); + } + } + + public interface SetterForPathParameters { + DeleteNullableRequest getInstance(); + T getBuilderAfterPathParameters(DeleteNullableRequest instance); + default T pathParameters(PetpetidDeletePathParameters.PathParametersMap pathParameters) { + var instance = getInstance(); + instance.pathParameters = pathParameters; + return getBuilderAfterPathParameters(instance); + } + } + + public static class Delete0RequestBuilder implements SetterForHeaderParameters, SetterForServerIndex, SetterForSecurityIndex, SetterForTimeout { + private final DeleteNullableRequest instance; + + public Delete0RequestBuilder(DeleteNullableRequest instance) { + this.instance = instance; + } + + public DeleteRequest build() { + var pathParameters = instance.pathParameters; + if (pathParameters == null) { + throw new RuntimeException("invalid null value for required parameter"); + } + return new DeleteRequest( + pathParameters, + instance.headerParameters, + instance.serverIndex, + instance.securityIndex, + instance.timeout + ); + } + + public DeleteNullableRequest getInstance() { + return instance; + } + + public Delete0RequestBuilder getBuilderAfterHeaderParameters(DeleteNullableRequest instance) { + return this; + } + + public Delete0RequestBuilder getBuilderAfterServerIndex(DeleteNullableRequest instance) { + return this; + } + + public Delete0RequestBuilder getBuilderAfterSecurityIndex(DeleteNullableRequest instance) { + return this; + } + + public Delete0RequestBuilder getBuilderAfterTimeout(DeleteNullableRequest instance) { + return this; + } + } + public static class DeleteRequestBuilder implements SetterForPathParameters { + private final DeleteNullableRequest instance; + + public DeleteRequestBuilder() { + this.instance = new DeleteNullableRequest(); + } + + public DeleteNullableRequest getInstance() { + return instance; + } + + public Delete0RequestBuilder getBuilderAfterPathParameters(DeleteNullableRequest instance) { + return new Delete0RequestBuilder(instance); + } + } +} diff --git a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/petpetid/PetpetidGet.kt b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/petpetid/PetpetidGet.kt new file mode 100644 index 00000000000..b7cdbb9ddc1 --- /dev/null +++ b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/petpetid/PetpetidGet.kt @@ -0,0 +1,211 @@ +package org.openapijsonschematools.client.paths.petpetid; + +import org.checkerframework.checker.nullness.qual.Nullable; +import org.openapijsonschematools.client.RootServerInfo; +import org.openapijsonschematools.client.paths.petpetid.get.PetpetidGetSecurityInfo; +import org.openapijsonschematools.client.paths.petpetid.get.PetpetidGetPathParameters; +import org.openapijsonschematools.client.paths.petpetid.get.Parameters; +import org.openapijsonschematools.client.paths.petpetid.get.PetpetidGetResponses; +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.paths.Petpetid; +import org.openapijsonschematools.client.securityrequirementobjects.SecurityRequirementObject; +import org.openapijsonschematools.client.securityrequirementobjects.AuthApplier; + +import java.io.IOException; +import java.net.http.HttpClient; +import java.net.http.HttpRequest; +import java.time.Duration; +import java.util.List; +import java.util.Map; + +public class PetpetidGet { + private static class GetProvider extends AuthApplier { + private static final String method = "get"; + + public static PetpetidGetResponses.EndpointResponse get( + GetRequest request, + ApiConfiguration apiConfiguration, + SchemaConfiguration schemaConfiguration, + HttpClient client + ) throws IOException, InterruptedException, ValidationException, NotImplementedException, ApiException { + Map> headers = apiConfiguration.getDefaultHeaders(); + HttpRequest.BodyPublisher bodyPublisher = HttpRequest.BodyPublishers.noBody(); + + var pathSerializer = new Parameters.PathParametersSerializer(); + String updatedPath = pathSerializer.serialize(request.pathParameters, Petpetid.path); + // TODO set this to a map if there is a query security scheme + @Nullable Map queryMap = null; + String host = apiConfiguration.getServer(request.serverIndex).url(); + SecurityRequirementObject securityRequirementObject = apiConfiguration.getSecurityRequirementObject(request.securityIndex); + updateParamsForAuth( + securityRequirementObject, + headers, + updatedPath, + method, + bodyPublisher, + queryMap, + apiConfiguration + ); + + String url = host + updatedPath; + var httpRequest = RestClient.getRequest( + url, + method, + bodyPublisher, + headers, + request.timeout + ); + var response = RestClient.getResponse(httpRequest, client); + var responsesDeserializer = new PetpetidGetResponses.PetpetidGetResponses1(); + return responsesDeserializer.deserialize(response, schemaConfiguration); + } + } + + public interface GetOperation { + ApiConfiguration getApiConfiguration(); + SchemaConfiguration getSchemaConfiguration(); + HttpClient getClient(); + default PetpetidGetResponses.EndpointResponse get(GetRequest request) throws IOException, InterruptedException, ValidationException, NotImplementedException, ApiException { + return GetProvider.get(request, getApiConfiguration(), getSchemaConfiguration(), getClient()); + } + } + + public interface GetPetByIdOperation { + ApiConfiguration getApiConfiguration(); + SchemaConfiguration getSchemaConfiguration(); + HttpClient getClient(); + default PetpetidGetResponses.EndpointResponse getPetById(GetRequest request) throws IOException, InterruptedException, ValidationException, NotImplementedException, ApiException { + return GetProvider.get(request, getApiConfiguration(), getSchemaConfiguration(), getClient()); + } + } + + public static class Get extends ApiClient implements GetOperation { + public Get(ApiConfiguration apiConfiguration, SchemaConfiguration schemaConfiguration) { + super(apiConfiguration, schemaConfiguration); + } + } + + public static class GetRequest { + public PetpetidGetPathParameters.PathParametersMap pathParameters; + public RootServerInfo.@Nullable ServerIndex serverIndex; + public PetpetidGetSecurityInfo.@Nullable SecurityIndex securityIndex; + public @Nullable Duration timeout; + + public GetRequest( + PetpetidGetPathParameters.PathParametersMap pathParameters, + RootServerInfo.@Nullable ServerIndex serverIndex, + PetpetidGetSecurityInfo.@Nullable SecurityIndex securityIndex, + @Nullable Duration timeout + ) { + this.pathParameters = pathParameters; + this.serverIndex = serverIndex; + this.securityIndex = securityIndex; + this.timeout = timeout; + } + } + + public static class GetNullableRequest { + public PetpetidGetPathParameters.@Nullable PathParametersMap pathParameters; + public RootServerInfo.@Nullable ServerIndex serverIndex; + public PetpetidGetSecurityInfo.@Nullable SecurityIndex securityIndex; + public @Nullable Duration timeout; + } + + public interface SetterForServerIndex { + GetNullableRequest getInstance(); + T getBuilderAfterServerIndex(GetNullableRequest instance); + default T serverIndex(RootServerInfo.ServerIndex serverIndex) { + var instance = getInstance(); + instance.serverIndex = serverIndex; + return getBuilderAfterServerIndex(instance); + } + } + + public interface SetterForSecurityIndex { + GetNullableRequest getInstance(); + T getBuilderAfterSecurityIndex(GetNullableRequest instance); + default T securityIndex(PetpetidGetSecurityInfo.SecurityIndex securityIndex) { + var instance = getInstance(); + instance.securityIndex = securityIndex; + return getBuilderAfterSecurityIndex(instance); + } + } + + public interface SetterForTimeout { + GetNullableRequest getInstance(); + T getBuilderAfterTimeout(GetNullableRequest instance); + default T timeout(Duration timeout) { + var instance = getInstance(); + instance.timeout = timeout; + return getBuilderAfterTimeout(instance); + } + } + + public interface SetterForPathParameters { + GetNullableRequest getInstance(); + T getBuilderAfterPathParameters(GetNullableRequest instance); + default T pathParameters(PetpetidGetPathParameters.PathParametersMap pathParameters) { + var instance = getInstance(); + instance.pathParameters = pathParameters; + return getBuilderAfterPathParameters(instance); + } + } + + public static class Get0RequestBuilder implements SetterForServerIndex, SetterForSecurityIndex, SetterForTimeout { + private final GetNullableRequest instance; + + public Get0RequestBuilder(GetNullableRequest instance) { + this.instance = instance; + } + + public GetRequest build() { + var pathParameters = instance.pathParameters; + if (pathParameters == null) { + throw new RuntimeException("invalid null value for required parameter"); + } + return new GetRequest( + pathParameters, + instance.serverIndex, + instance.securityIndex, + instance.timeout + ); + } + + public GetNullableRequest getInstance() { + return instance; + } + + public Get0RequestBuilder getBuilderAfterServerIndex(GetNullableRequest instance) { + return this; + } + + public Get0RequestBuilder getBuilderAfterSecurityIndex(GetNullableRequest instance) { + return this; + } + + public Get0RequestBuilder getBuilderAfterTimeout(GetNullableRequest instance) { + return this; + } + } + public static class GetRequestBuilder implements SetterForPathParameters { + private final GetNullableRequest instance; + + public GetRequestBuilder() { + this.instance = new GetNullableRequest(); + } + + public GetNullableRequest getInstance() { + return instance; + } + + public Get0RequestBuilder getBuilderAfterPathParameters(GetNullableRequest instance) { + return new Get0RequestBuilder(instance); + } + } +} diff --git a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/petpetid/PetpetidPost.kt b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/petpetid/PetpetidPost.kt new file mode 100644 index 00000000000..536613af171 --- /dev/null +++ b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/petpetid/PetpetidPost.kt @@ -0,0 +1,242 @@ +package org.openapijsonschematools.client.paths.petpetid; + +import org.checkerframework.checker.nullness.qual.Nullable; +import org.openapijsonschematools.client.paths.petpetid.post.PetpetidPostRequestBody; +import org.openapijsonschematools.client.RootServerInfo; +import org.openapijsonschematools.client.paths.petpetid.post.PetpetidPostSecurityInfo; +import org.openapijsonschematools.client.paths.petpetid.post.PetpetidPostPathParameters; +import org.openapijsonschematools.client.paths.petpetid.post.Parameters; +import org.openapijsonschematools.client.paths.petpetid.post.PetpetidPostResponses; +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.requestbody.SerializedRequestBody; +import org.openapijsonschematools.client.paths.Petpetid; +import org.openapijsonschematools.client.securityrequirementobjects.SecurityRequirementObject; +import org.openapijsonschematools.client.securityrequirementobjects.AuthApplier; + +import java.io.IOException; +import java.util.ArrayList; +import java.net.http.HttpClient; +import java.net.http.HttpRequest; +import java.time.Duration; +import java.util.List; +import java.util.Map; + +public class PetpetidPost { + private static class PostProvider extends AuthApplier { + private static final String method = "post"; + + public static Nothing? post( + PostRequest request, + ApiConfiguration apiConfiguration, + SchemaConfiguration schemaConfiguration, + HttpClient client + ) throws IOException, InterruptedException, ValidationException, NotImplementedException, ApiException { + Map> headers = apiConfiguration.getDefaultHeaders(); + + @Nullable SerializedRequestBody serializedRequestBody; + HttpRequest.BodyPublisher bodyPublisher = HttpRequest.BodyPublishers.noBody(); + if (request.requestBody != null) { + serializedRequestBody = new PetpetidPostRequestBody.PetpetidPostRequestBody1().serialize( + request.requestBody + ); + var contentTypeHeaderValues = headers.getOrDefault("Content-Type", new ArrayList<>()); + contentTypeHeaderValues.add(serializedRequestBody.contentType); + bodyPublisher = serializedRequestBody.bodyPublisher; + } + + var pathSerializer = new Parameters.PathParametersSerializer(); + String updatedPath = pathSerializer.serialize(request.pathParameters, Petpetid.path); + // TODO set this to a map if there is a query security scheme + @Nullable Map queryMap = null; + String host = apiConfiguration.getServer(request.serverIndex).url(); + SecurityRequirementObject securityRequirementObject = apiConfiguration.getSecurityRequirementObject(request.securityIndex); + updateParamsForAuth( + securityRequirementObject, + headers, + updatedPath, + method, + bodyPublisher, + queryMap, + apiConfiguration + ); + + String url = host + updatedPath; + var httpRequest = RestClient.getRequest( + url, + method, + bodyPublisher, + headers, + request.timeout + ); + var response = RestClient.getResponse(httpRequest, client); + return (Nothing?) null; + } + } + + public interface PostOperation { + ApiConfiguration getApiConfiguration(); + SchemaConfiguration getSchemaConfiguration(); + HttpClient getClient(); + default Nothing? post(PostRequest request) throws IOException, InterruptedException, ValidationException, NotImplementedException, ApiException { + return PostProvider.post(request, getApiConfiguration(), getSchemaConfiguration(), getClient()); + } + } + + public interface UpdatePetWithFormOperation { + ApiConfiguration getApiConfiguration(); + SchemaConfiguration getSchemaConfiguration(); + HttpClient getClient(); + default Nothing? updatePetWithForm(PostRequest request) throws IOException, InterruptedException, ValidationException, NotImplementedException, ApiException { + return PostProvider.post(request, getApiConfiguration(), getSchemaConfiguration(), getClient()); + } + } + + public static class Post extends ApiClient implements PostOperation { + public Post(ApiConfiguration apiConfiguration, SchemaConfiguration schemaConfiguration) { + super(apiConfiguration, schemaConfiguration); + } + } + + public static class PostRequest { + public PetpetidPostPathParameters.PathParametersMap pathParameters; + public PetpetidPostRequestBody.@Nullable SealedRequestBody requestBody; + public RootServerInfo.@Nullable ServerIndex serverIndex; + public PetpetidPostSecurityInfo.@Nullable SecurityIndex securityIndex; + public @Nullable Duration timeout; + + public PostRequest( + PetpetidPostPathParameters.PathParametersMap pathParameters, + PetpetidPostRequestBody.@Nullable SealedRequestBody requestBody, + RootServerInfo.@Nullable ServerIndex serverIndex, + PetpetidPostSecurityInfo.@Nullable SecurityIndex securityIndex, + @Nullable Duration timeout + ) { + this.pathParameters = pathParameters; + this.requestBody = requestBody; + this.serverIndex = serverIndex; + this.securityIndex = securityIndex; + this.timeout = timeout; + } + } + + public static class PostNullableRequest { + public PetpetidPostPathParameters.@Nullable PathParametersMap pathParameters; + public PetpetidPostRequestBody.@Nullable SealedRequestBody requestBody; + public RootServerInfo.@Nullable ServerIndex serverIndex; + public PetpetidPostSecurityInfo.@Nullable SecurityIndex securityIndex; + public @Nullable Duration timeout; + } + + public interface SetterForRequestBody { + PostNullableRequest getInstance(); + T getBuilderAfterRequestBody(PostNullableRequest instance); + default T requestBody(PetpetidPostRequestBody.SealedRequestBody requestBody) { + var instance = getInstance(); + instance.requestBody = requestBody; + return getBuilderAfterRequestBody(instance); + } + } + + public interface SetterForServerIndex { + PostNullableRequest getInstance(); + T getBuilderAfterServerIndex(PostNullableRequest instance); + default T serverIndex(RootServerInfo.ServerIndex serverIndex) { + var instance = getInstance(); + instance.serverIndex = serverIndex; + return getBuilderAfterServerIndex(instance); + } + } + + public interface SetterForSecurityIndex { + PostNullableRequest getInstance(); + T getBuilderAfterSecurityIndex(PostNullableRequest instance); + default T securityIndex(PetpetidPostSecurityInfo.SecurityIndex securityIndex) { + var instance = getInstance(); + instance.securityIndex = securityIndex; + return getBuilderAfterSecurityIndex(instance); + } + } + + public interface SetterForTimeout { + PostNullableRequest getInstance(); + T getBuilderAfterTimeout(PostNullableRequest instance); + default T timeout(Duration timeout) { + var instance = getInstance(); + instance.timeout = timeout; + return getBuilderAfterTimeout(instance); + } + } + + public interface SetterForPathParameters { + PostNullableRequest getInstance(); + T getBuilderAfterPathParameters(PostNullableRequest instance); + default T pathParameters(PetpetidPostPathParameters.PathParametersMap pathParameters) { + var instance = getInstance(); + instance.pathParameters = pathParameters; + return getBuilderAfterPathParameters(instance); + } + } + + public static class Post0RequestBuilder implements SetterForRequestBody, SetterForServerIndex, SetterForSecurityIndex, SetterForTimeout { + private final PostNullableRequest instance; + + public Post0RequestBuilder(PostNullableRequest instance) { + this.instance = instance; + } + + public PostRequest build() { + var pathParameters = instance.pathParameters; + if (pathParameters == null) { + throw new RuntimeException("invalid null value for required parameter"); + } + return new PostRequest( + pathParameters, + instance.requestBody, + instance.serverIndex, + instance.securityIndex, + instance.timeout + ); + } + + public PostNullableRequest getInstance() { + return instance; + } + + public Post0RequestBuilder getBuilderAfterRequestBody(PostNullableRequest instance) { + return this; + } + + public Post0RequestBuilder getBuilderAfterServerIndex(PostNullableRequest instance) { + return this; + } + + public Post0RequestBuilder getBuilderAfterSecurityIndex(PostNullableRequest instance) { + return this; + } + + public Post0RequestBuilder getBuilderAfterTimeout(PostNullableRequest instance) { + return this; + } + } + public static class PostRequestBuilder implements SetterForPathParameters { + private final PostNullableRequest instance; + + public PostRequestBuilder() { + this.instance = new PostNullableRequest(); + } + + public PostNullableRequest getInstance() { + return instance; + } + + public Post0RequestBuilder getBuilderAfterPathParameters(PostNullableRequest instance) { + return new Post0RequestBuilder(instance); + } + } +} diff --git a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/petpetid/delete/Parameters.kt b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/petpetid/delete/Parameters.kt new file mode 100644 index 00000000000..d8775b677aa --- /dev/null +++ b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/petpetid/delete/Parameters.kt @@ -0,0 +1,32 @@ +package org.openapijsonschematools.client.paths.petpetid.delete; + +import org.openapijsonschematools.client.paths.petpetid.delete.parameters.Parameter0; +import org.openapijsonschematools.client.paths.petpetid.delete.parameters.Parameter1; +import org.openapijsonschematools.client.parameter.PathSerializer; +import org.openapijsonschematools.client.parameter.HeadersSerializer; + +import java.util.Map; +import java.util.AbstractMap; + +public class Parameters { + + public static class PathParametersSerializer extends PathSerializer { + public PathParametersSerializer() { + super( + Map.ofEntries( + new AbstractMap.SimpleEntry<>("petId", new Parameter1.Parameter11()) + ) + ); + } + } + + public static class HeaderParametersSerializer extends HeadersSerializer { + public HeaderParametersSerializer() { + super( + Map.ofEntries( + new AbstractMap.SimpleEntry<>("api_key", new Parameter0.Parameter01()) + ) + ); + } + } +} diff --git a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/petpetid/delete/PetpetidDeleteHeaderParameters.kt b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/petpetid/delete/PetpetidDeleteHeaderParameters.kt new file mode 100644 index 00000000000..42d57bc3772 --- /dev/null +++ b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/petpetid/delete/PetpetidDeleteHeaderParameters.kt @@ -0,0 +1,191 @@ +package org.openapijsonschematools.client.paths.petpetid.delete; +import java.util.ArrayList; +import java.util.HashSet; +import java.util.LinkedHashMap; +import java.util.LinkedHashSet; +import java.util.List; +import java.util.Map; +import java.util.Objects; +import java.util.Set; +import org.checkerframework.checker.nullness.qual.Nullable; +import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags; +import org.openapijsonschematools.client.configurations.SchemaConfiguration; +import org.openapijsonschematools.client.exceptions.UnsetPropertyException; +import org.openapijsonschematools.client.exceptions.ValidationException; +import org.openapijsonschematools.client.paths.petpetid.delete.parameters.parameter0.Schema0; +import org.openapijsonschematools.client.schemas.AnyTypeJsonSchema; +import org.openapijsonschematools.client.schemas.GenericBuilder; +import org.openapijsonschematools.client.schemas.NotAnyTypeJsonSchema; +import org.openapijsonschematools.client.schemas.validation.FrozenMap; +import org.openapijsonschematools.client.schemas.validation.JsonSchema; +import org.openapijsonschematools.client.schemas.validation.JsonSchemaInfo; +import org.openapijsonschematools.client.schemas.validation.MapSchemaValidator; +import org.openapijsonschematools.client.schemas.validation.MapUtils; +import org.openapijsonschematools.client.schemas.validation.PathToSchemasMap; +import org.openapijsonschematools.client.schemas.validation.PropertyEntry; +import org.openapijsonschematools.client.schemas.validation.ValidationMetadata; + +public class PetpetidDeleteHeaderParameters { + // nest classes so all schemas and input/output classes can be public + + + public static class AdditionalProperties extends NotAnyTypeJsonSchema.NotAnyTypeJsonSchema1 { + // NotAnyTypeSchema + private static @Nullable AdditionalProperties instance = null; + public static AdditionalProperties getInstance() { + if (instance == null) { + instance = new AdditionalProperties(); + } + return instance; + } + } + + + public static class HeaderParametersMap extends FrozenMap { + protected HeaderParametersMap(FrozenMap m) { + super(m); + } + public static final Set requiredKeys = Set.of(); + public static final Set optionalKeys = Set.of( + "api_key" + ); + public static HeaderParametersMap of(Map arg, SchemaConfiguration configuration) throws ValidationException { + return PetpetidDeleteHeaderParameters1.getInstance().validate(arg, configuration); + } + + public String api_key() throws UnsetPropertyException { + return getOrThrow("api_key"); + } + } + + public interface SetterForApiKey { + Map getInstance(); + T getBuilderAfterApiKey(Map instance); + + default T api_key(String value) { + var instance = getInstance(); + instance.put("api_key", value); + return getBuilderAfterApiKey(instance); + } + } + + public static class HeaderParametersMapBuilder implements GenericBuilder>, SetterForApiKey { + private final Map instance; + private static final Set knownKeys = Set.of( + "api_key" + ); + public Set getKnownKeys() { + return knownKeys; + } + public HeaderParametersMapBuilder() { + this.instance = new LinkedHashMap<>(); + } + public Map build() { + return instance; + } + public Map getInstance() { + return instance; + } + public HeaderParametersMapBuilder getBuilderAfterApiKey(Map instance) { + return this; + } + } + + + public sealed interface PetpetidDeleteHeaderParameters1Boxed permits PetpetidDeleteHeaderParameters1BoxedMap { + @Nullable Object getData(); + } + + public record PetpetidDeleteHeaderParameters1BoxedMap(HeaderParametersMap data) implements PetpetidDeleteHeaderParameters1Boxed { + @Override + public @Nullable Object getData() { + return data; + } + } + + + public static class PetpetidDeleteHeaderParameters1 extends JsonSchema implements MapSchemaValidator { + private static @Nullable PetpetidDeleteHeaderParameters1 instance = null; + + protected PetpetidDeleteHeaderParameters1() { + super(new JsonSchemaInfo() + .type(Set.of(Map.class)) + .properties(Map.ofEntries( + new PropertyEntry("api_key", Schema0.Schema01.class) + )) + .additionalProperties(AdditionalProperties.class) + ); + } + + public static PetpetidDeleteHeaderParameters1 getInstance() { + if (instance == null) { + instance = new PetpetidDeleteHeaderParameters1(); + } + return instance; + } + + 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 RuntimeException("Invalid non-string key value"); + } + String propertyName = (String) entryKey; + List propertyPathToItem = new ArrayList<>(pathToItem); + propertyPathToItem.add(propertyName); + Object value = entry.getValue(); + LinkedHashMap, Nothing?> schemas = pathToSchemas.get(propertyPathToItem); + if (schemas == null) { + throw new RuntimeException("Validation 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"); + } + properties.put(propertyName, (String) propertyInstance); + } + FrozenMap castProperties = new FrozenMap<>(properties); + return new HeaderParametersMap(castProperties); + } + + 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); + SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().build())); + ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, new PathToSchemasMap(), new LinkedHashSet<>()); + PathToSchemasMap pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet); + return getNewInstance(castArg, validationMetadata.pathToItem(), pathToSchemasMap); + } + + + @Override + public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws 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"); + } + @Override + public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { + if (arg instanceof Map) { + return getNewInstance((Map) arg, pathToItem, pathToSchemas); + } + throw new RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); + } + @Override + public PetpetidDeleteHeaderParameters1BoxedMap validateAndBox(Map arg, SchemaConfiguration configuration) throws ValidationException { + return new PetpetidDeleteHeaderParameters1BoxedMap(validate(arg, configuration)); + } + @Override + public PetpetidDeleteHeaderParameters1Boxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { + 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"); + } + } + +} diff --git a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/petpetid/delete/PetpetidDeletePathParameters.kt b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/petpetid/delete/PetpetidDeletePathParameters.kt new file mode 100644 index 00000000000..1438d8e8d8a --- /dev/null +++ b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/petpetid/delete/PetpetidDeletePathParameters.kt @@ -0,0 +1,223 @@ +package org.openapijsonschematools.client.paths.petpetid.delete; +import java.util.ArrayList; +import java.util.HashSet; +import java.util.LinkedHashMap; +import java.util.LinkedHashSet; +import java.util.List; +import java.util.Map; +import java.util.Objects; +import java.util.Set; +import org.checkerframework.checker.nullness.qual.Nullable; +import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags; +import org.openapijsonschematools.client.configurations.SchemaConfiguration; +import org.openapijsonschematools.client.exceptions.UnsetPropertyException; +import org.openapijsonschematools.client.exceptions.ValidationException; +import org.openapijsonschematools.client.paths.petpetid.delete.parameters.parameter1.Schema1; +import org.openapijsonschematools.client.schemas.AnyTypeJsonSchema; +import org.openapijsonschematools.client.schemas.GenericBuilder; +import org.openapijsonschematools.client.schemas.NotAnyTypeJsonSchema; +import org.openapijsonschematools.client.schemas.validation.FrozenMap; +import org.openapijsonschematools.client.schemas.validation.JsonSchema; +import org.openapijsonschematools.client.schemas.validation.JsonSchemaInfo; +import org.openapijsonschematools.client.schemas.validation.MapSchemaValidator; +import org.openapijsonschematools.client.schemas.validation.MapUtils; +import org.openapijsonschematools.client.schemas.validation.PathToSchemasMap; +import org.openapijsonschematools.client.schemas.validation.PropertyEntry; +import org.openapijsonschematools.client.schemas.validation.ValidationMetadata; + +public class PetpetidDeletePathParameters { + // nest classes so all schemas and input/output classes can be public + + + public static class AdditionalProperties extends NotAnyTypeJsonSchema.NotAnyTypeJsonSchema1 { + // NotAnyTypeSchema + private static @Nullable AdditionalProperties instance = null; + public static AdditionalProperties getInstance() { + if (instance == null) { + instance = new AdditionalProperties(); + } + return instance; + } + } + + + public static class PathParametersMap extends FrozenMap { + protected PathParametersMap(FrozenMap m) { + super(m); + } + public static final Set requiredKeys = Set.of( + "petId" + ); + public static final Set optionalKeys = Set.of(); + public static PathParametersMap of(Map arg, SchemaConfiguration configuration) throws ValidationException { + return PetpetidDeletePathParameters1.getInstance().validate(arg, configuration); + } + + public Number petId() { + try { + return getOrThrow("version"); + } catch (UnsetPropertyException e) { + throw new RuntimeException(e); + } + } + } + + public interface SetterForPetId { + Map getInstance(); + T getBuilderAfterPetId(Map instance); + + default T petId(int value) { + var instance = getInstance(); + instance.put("petId", value); + return getBuilderAfterPetId(instance); + } + + default T petId(float value) { + var instance = getInstance(); + instance.put("petId", value); + return getBuilderAfterPetId(instance); + } + + default T petId(long value) { + var instance = getInstance(); + instance.put("petId", value); + return getBuilderAfterPetId(instance); + } + + default T petId(double value) { + var instance = getInstance(); + instance.put("petId", value); + return getBuilderAfterPetId(instance); + } + } + + public static class PathParametersMap0Builder implements GenericBuilder> { + private final Map instance; + private static final Set knownKeys = Set.of( + "petId" + ); + public Set getKnownKeys() { + return knownKeys; + } + public PathParametersMap0Builder(Map instance) { + this.instance = instance; + } + public Map build() { + return instance; + } + } + + public static class PathParametersMapBuilder implements SetterForPetId { + private final Map instance; + public PathParametersMapBuilder() { + this.instance = new LinkedHashMap<>(); + } + public Map getInstance() { + return instance; + } + public PathParametersMap0Builder getBuilderAfterPetId(Map instance) { + return new PathParametersMap0Builder(instance); + } + } + + + public sealed interface PetpetidDeletePathParameters1Boxed permits PetpetidDeletePathParameters1BoxedMap { + @Nullable Object getData(); + } + + public record PetpetidDeletePathParameters1BoxedMap(PathParametersMap data) implements PetpetidDeletePathParameters1Boxed { + @Override + public @Nullable Object getData() { + return data; + } + } + + + public static class PetpetidDeletePathParameters1 extends JsonSchema implements MapSchemaValidator { + private static @Nullable PetpetidDeletePathParameters1 instance = null; + + protected PetpetidDeletePathParameters1() { + super(new JsonSchemaInfo() + .type(Set.of(Map.class)) + .properties(Map.ofEntries( + new PropertyEntry("petId", Schema1.Schema11.class) + )) + .required(Set.of( + "petId" + )) + .additionalProperties(AdditionalProperties.class) + ); + } + + public static PetpetidDeletePathParameters1 getInstance() { + if (instance == null) { + instance = new PetpetidDeletePathParameters1(); + } + return instance; + } + + 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 RuntimeException("Invalid non-string key value"); + } + String propertyName = (String) entryKey; + List propertyPathToItem = new ArrayList<>(pathToItem); + propertyPathToItem.add(propertyName); + Object value = entry.getValue(); + LinkedHashMap, Nothing?> schemas = pathToSchemas.get(propertyPathToItem); + if (schemas == null) { + throw new RuntimeException("Validation 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"); + } + properties.put(propertyName, (Number) propertyInstance); + } + FrozenMap castProperties = new FrozenMap<>(properties); + return new PathParametersMap(castProperties); + } + + 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); + SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().build())); + ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, new PathToSchemasMap(), new LinkedHashSet<>()); + PathToSchemasMap pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet); + return getNewInstance(castArg, validationMetadata.pathToItem(), pathToSchemasMap); + } + + + @Override + public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws 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"); + } + @Override + public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { + if (arg instanceof Map) { + return getNewInstance((Map) arg, pathToItem, pathToSchemas); + } + throw new RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); + } + @Override + public PetpetidDeletePathParameters1BoxedMap validateAndBox(Map arg, SchemaConfiguration configuration) throws ValidationException { + return new PetpetidDeletePathParameters1BoxedMap(validate(arg, configuration)); + } + @Override + public PetpetidDeletePathParameters1Boxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { + 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"); + } + } + +} diff --git a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/petpetid/delete/PetpetidDeleteResponses.kt b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/petpetid/delete/PetpetidDeleteResponses.kt new file mode 100644 index 00000000000..d88b2e51e90 --- /dev/null +++ b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/petpetid/delete/PetpetidDeleteResponses.kt @@ -0,0 +1,48 @@ +package org.openapijsonschematools.client.paths.petpetid.delete; + +import org.openapijsonschematools.client.paths.petpetid.delete.responses.PetpetidDeleteCode400Response; +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; + +import java.net.http.HttpResponse; +import java.util.Map; +import java.util.AbstractMap; + +public class PetpetidDeleteResponses { + + public sealed interface StatusCodeResponseDeserializer permits StatusPetpetidDeleteCode400ResponseDeserializer {} + + public static final class StatusPetpetidDeleteCode400ResponseDeserializer extends PetpetidDeleteCode400Response.PetpetidDeleteCode400Response1 implements StatusCodeResponseDeserializer { + } + + public static final class PetpetidDeleteResponses1 implements ResponsesDeserializer { + private final Map statusCodeToResponseDeserializer; + public PetpetidDeleteResponses1() { + this.statusCodeToResponseDeserializer = Map.ofEntries( + new AbstractMap.SimpleEntry<>("400", new StatusPetpetidDeleteCode400ResponseDeserializer()) + ); + } + + public Nothing? deserialize(HttpResponse response, SchemaConfiguration configuration) throws ValidationException, NotImplementedException, ApiException { + String statusCode = String.valueOf(response.statusCode()); + @Nullable StatusCodeResponseDeserializer statusCodeDeserializer = statusCodeToResponseDeserializer.get(statusCode); + if (statusCodeDeserializer == null) { + throw new ApiException( + "Invalid response statusCode="+statusCode+" has no response defined in the openapi document", + response + ); + } + StatusPetpetidDeleteCode400ResponseDeserializer castDeserializer = (StatusPetpetidDeleteCode400ResponseDeserializer) statusCodeDeserializer; + var deserializedResponse = castDeserializer.deserialize(response, configuration); + throw new PetpetidDeleteCode400Response.ResponseApiException( + "Received error statusCode response from server", + response, + deserializedResponse + ); + } + } +} diff --git a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/petpetid/delete/PetpetidDeleteSecurityInfo.kt b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/petpetid/delete/PetpetidDeleteSecurityInfo.kt new file mode 100644 index 00000000000..941f3f23abf --- /dev/null +++ b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/petpetid/delete/PetpetidDeleteSecurityInfo.kt @@ -0,0 +1,33 @@ +package org.openapijsonschematools.client.paths.petpetid.delete; + +import org.openapijsonschematools.client.paths.petpetid.delete.security.PetpetidDeleteSecurityRequirementObject0; +import org.openapijsonschematools.client.paths.petpetid.delete.security.PetpetidDeleteSecurityRequirementObject1; +import org.openapijsonschematools.client.securityrequirementobjects.SecurityRequirementObject; +import org.openapijsonschematools.client.securityrequirementobjects.SecurityRequirementObjectProvider; + +public class PetpetidDeleteSecurityInfo { + public static class PetpetidDeleteSecurityInfo1 implements SecurityRequirementObjectProvider { + public final PetpetidDeleteSecurityRequirementObject0 security0; + public final PetpetidDeleteSecurityRequirementObject1 security1; + + public PetpetidDeleteSecurityInfo1() { + security0 = new PetpetidDeleteSecurityRequirementObject0(); + security1 = new PetpetidDeleteSecurityRequirementObject1(); + } + + @Override + public SecurityRequirementObject getSecurityRequirementObject(SecurityIndex securityIndex) { + switch (securityIndex) { + case SECURITY_0: + return security0; + default: + return security1; + } + } + } + + public enum SecurityIndex { + SECURITY_0, + SECURITY_1 + } +} \ No newline at end of file diff --git a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/petpetid/delete/parameters/Parameter0.kt b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/petpetid/delete/parameters/Parameter0.kt new file mode 100644 index 00000000000..48e40ea5596 --- /dev/null +++ b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/petpetid/delete/parameters/Parameter0.kt @@ -0,0 +1,23 @@ +package org.openapijsonschematools.client.paths.petpetid.delete.parameters; + +import org.openapijsonschematools.client.parameter.ParameterStyle; +import org.openapijsonschematools.client.parameter.ParameterInType; +import org.openapijsonschematools.client.parameter.SchemaParameter; +import org.openapijsonschematools.client.paths.petpetid.delete.parameters.parameter0.Schema0; + +public class Parameter0 { + + public static class Parameter01 extends SchemaParameter { + public Parameter01() { + super( + "api_key", + ParameterInType.HEADER, + false, + ParameterStyle.SIMPLE, + false, + false, + Schema0.Schema01.getInstance() + ); + } + } +} diff --git a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/petpetid/delete/parameters/Parameter1.kt b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/petpetid/delete/parameters/Parameter1.kt new file mode 100644 index 00000000000..c40da80fec8 --- /dev/null +++ b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/petpetid/delete/parameters/Parameter1.kt @@ -0,0 +1,23 @@ +package org.openapijsonschematools.client.paths.petpetid.delete.parameters; + +import org.openapijsonschematools.client.parameter.ParameterStyle; +import org.openapijsonschematools.client.parameter.ParameterInType; +import org.openapijsonschematools.client.parameter.SchemaParameter; +import org.openapijsonschematools.client.paths.petpetid.delete.parameters.parameter1.Schema1; + +public class Parameter1 { + + public static class Parameter11 extends SchemaParameter { + public Parameter11() { + super( + "petId", + ParameterInType.PATH, + true, + ParameterStyle.SIMPLE, + false, + false, + Schema1.Schema11.getInstance() + ); + } + } +} diff --git a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/petpetid/delete/parameters/parameter0/Schema0.kt b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/petpetid/delete/parameters/parameter0/Schema0.kt new file mode 100644 index 00000000000..c4b34bf4f68 --- /dev/null +++ b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/petpetid/delete/parameters/parameter0/Schema0.kt @@ -0,0 +1,19 @@ +package org.openapijsonschematools.client.paths.petpetid.delete.parameters.parameter0; +import org.checkerframework.checker.nullness.qual.Nullable; +import org.openapijsonschematools.client.schemas.StringJsonSchema; + +public class Schema0 extends StringJsonSchema { + // nest classes so all schemas and input/output classes can be public + + + public static class Schema01 extends StringJsonSchema.StringJsonSchema1 { + private static @Nullable Schema01 instance = null; + public static Schema01 getInstance() { + if (instance == null) { + instance = new Schema01(); + } + return instance; + } + } + +} diff --git a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/petpetid/delete/parameters/parameter1/Schema1.kt b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/petpetid/delete/parameters/parameter1/Schema1.kt new file mode 100644 index 00000000000..3ec2f12b279 --- /dev/null +++ b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/petpetid/delete/parameters/parameter1/Schema1.kt @@ -0,0 +1,19 @@ +package org.openapijsonschematools.client.paths.petpetid.delete.parameters.parameter1; +import org.checkerframework.checker.nullness.qual.Nullable; +import org.openapijsonschematools.client.schemas.Int64JsonSchema; + +public class Schema1 extends Int64JsonSchema { + // nest classes so all schemas and input/output classes can be public + + + public static class Schema11 extends Int64JsonSchema.Int64JsonSchema1 { + private static @Nullable Schema11 instance = null; + public static Schema11 getInstance() { + if (instance == null) { + instance = new Schema11(); + } + return instance; + } + } + +} diff --git a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/petpetid/delete/responses/PetpetidDeleteCode400Response.kt b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/petpetid/delete/responses/PetpetidDeleteCode400Response.kt new file mode 100644 index 00000000000..1a540e2cfc5 --- /dev/null +++ b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/petpetid/delete/responses/PetpetidDeleteCode400Response.kt @@ -0,0 +1,45 @@ +package org.openapijsonschematools.client.paths.petpetid.delete.responses; + +import org.openapijsonschematools.client.configurations.SchemaConfiguration; +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; +import java.net.http.HttpResponse; +import java.net.http.HttpHeaders; + +public class PetpetidDeleteCode400Response { + + public static class PetpetidDeleteCode400Response1 extends ResponseDeserializer { + public PetpetidDeleteCode400Response1() { + super( + MapUtils.makeMap( + ) + ); + } + + @Override + protected Nothing? getBody(String contentType, Nothing? mediaType, byte[] body, SchemaConfiguration configuration) { + return null; + } + + @Override + protected Nothing? getHeaders(HttpHeaders headers, SchemaConfiguration configuration) { + return null; + } + } + + @SuppressWarnings("serial") + public static class ResponseApiException extends ApiException { + public DeserializedHttpResponse deserializedResponse; + + public ResponseApiException(String s, HttpResponse response, DeserializedHttpResponse deserializedResponse) { + super(s, response); + this.deserializedResponse = deserializedResponse; + } + } +} diff --git a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/petpetid/delete/security/PetpetidDeleteSecurityRequirementObject0.kt b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/petpetid/delete/security/PetpetidDeleteSecurityRequirementObject0.kt new file mode 100644 index 00000000000..320b2cffa63 --- /dev/null +++ b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/petpetid/delete/security/PetpetidDeleteSecurityRequirementObject0.kt @@ -0,0 +1,24 @@ +package org.openapijsonschematools.client.paths.petpetid.delete.security; + +import org.checkerframework.checker.nullness.qual.Nullable; +import org.openapijsonschematools.client.securityrequirementobjects.SecurityRequirementObject; +import org.openapijsonschematools.client.securityschemes.SecurityScheme; +import org.openapijsonschematools.client.components.securityschemes.ApiKey; + +import java.util.List; +import java.util.Map; +import java.util.AbstractMap; + +public class PetpetidDeleteSecurityRequirementObject0 extends SecurityRequirementObject { + + public PetpetidDeleteSecurityRequirementObject0() { + super( + Map.ofEntries( + new AbstractMap.SimpleEntry, List>( + ApiKey.class, + List.of() + ) + ) + ); + } +} diff --git a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/petpetid/delete/security/PetpetidDeleteSecurityRequirementObject1.kt b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/petpetid/delete/security/PetpetidDeleteSecurityRequirementObject1.kt new file mode 100644 index 00000000000..f7e6f70df99 --- /dev/null +++ b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/petpetid/delete/security/PetpetidDeleteSecurityRequirementObject1.kt @@ -0,0 +1,24 @@ +package org.openapijsonschematools.client.paths.petpetid.delete.security; + +import org.checkerframework.checker.nullness.qual.Nullable; +import org.openapijsonschematools.client.securityrequirementobjects.SecurityRequirementObject; +import org.openapijsonschematools.client.securityschemes.SecurityScheme; +import org.openapijsonschematools.client.components.securityschemes.PetstoreAuth; + +import java.util.List; +import java.util.Map; +import java.util.AbstractMap; + +public class PetpetidDeleteSecurityRequirementObject1 extends SecurityRequirementObject { + + public PetpetidDeleteSecurityRequirementObject1() { + super( + Map.ofEntries( + new AbstractMap.SimpleEntry, List>( + PetstoreAuth.class, + List.of("write:pets", "read:pets") + ) + ) + ); + } +} diff --git a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/petpetid/get/Parameters.kt b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/petpetid/get/Parameters.kt new file mode 100644 index 00000000000..f5e28725665 --- /dev/null +++ b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/petpetid/get/Parameters.kt @@ -0,0 +1,20 @@ +package org.openapijsonschematools.client.paths.petpetid.get; + +import org.openapijsonschematools.client.paths.petpetid.get.parameters.Parameter0; +import org.openapijsonschematools.client.parameter.PathSerializer; + +import java.util.Map; +import java.util.AbstractMap; + +public class Parameters { + + public static class PathParametersSerializer extends PathSerializer { + public PathParametersSerializer() { + super( + Map.ofEntries( + new AbstractMap.SimpleEntry<>("petId", new Parameter0.Parameter01()) + ) + ); + } + } +} diff --git a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/petpetid/get/PetpetidGetPathParameters.kt b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/petpetid/get/PetpetidGetPathParameters.kt new file mode 100644 index 00000000000..12b3b104c7d --- /dev/null +++ b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/petpetid/get/PetpetidGetPathParameters.kt @@ -0,0 +1,223 @@ +package org.openapijsonschematools.client.paths.petpetid.get; +import java.util.ArrayList; +import java.util.HashSet; +import java.util.LinkedHashMap; +import java.util.LinkedHashSet; +import java.util.List; +import java.util.Map; +import java.util.Objects; +import java.util.Set; +import org.checkerframework.checker.nullness.qual.Nullable; +import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags; +import org.openapijsonschematools.client.configurations.SchemaConfiguration; +import org.openapijsonschematools.client.exceptions.UnsetPropertyException; +import org.openapijsonschematools.client.exceptions.ValidationException; +import org.openapijsonschematools.client.paths.petpetid.get.parameters.parameter0.Schema0; +import org.openapijsonschematools.client.schemas.AnyTypeJsonSchema; +import org.openapijsonschematools.client.schemas.GenericBuilder; +import org.openapijsonschematools.client.schemas.NotAnyTypeJsonSchema; +import org.openapijsonschematools.client.schemas.validation.FrozenMap; +import org.openapijsonschematools.client.schemas.validation.JsonSchema; +import org.openapijsonschematools.client.schemas.validation.JsonSchemaInfo; +import org.openapijsonschematools.client.schemas.validation.MapSchemaValidator; +import org.openapijsonschematools.client.schemas.validation.MapUtils; +import org.openapijsonschematools.client.schemas.validation.PathToSchemasMap; +import org.openapijsonschematools.client.schemas.validation.PropertyEntry; +import org.openapijsonschematools.client.schemas.validation.ValidationMetadata; + +public class PetpetidGetPathParameters { + // nest classes so all schemas and input/output classes can be public + + + public static class AdditionalProperties extends NotAnyTypeJsonSchema.NotAnyTypeJsonSchema1 { + // NotAnyTypeSchema + private static @Nullable AdditionalProperties instance = null; + public static AdditionalProperties getInstance() { + if (instance == null) { + instance = new AdditionalProperties(); + } + return instance; + } + } + + + public static class PathParametersMap extends FrozenMap { + protected PathParametersMap(FrozenMap m) { + super(m); + } + public static final Set requiredKeys = Set.of( + "petId" + ); + public static final Set optionalKeys = Set.of(); + public static PathParametersMap of(Map arg, SchemaConfiguration configuration) throws ValidationException { + return PetpetidGetPathParameters1.getInstance().validate(arg, configuration); + } + + public Number petId() { + try { + return getOrThrow("version"); + } catch (UnsetPropertyException e) { + throw new RuntimeException(e); + } + } + } + + public interface SetterForPetId { + Map getInstance(); + T getBuilderAfterPetId(Map instance); + + default T petId(int value) { + var instance = getInstance(); + instance.put("petId", value); + return getBuilderAfterPetId(instance); + } + + default T petId(float value) { + var instance = getInstance(); + instance.put("petId", value); + return getBuilderAfterPetId(instance); + } + + default T petId(long value) { + var instance = getInstance(); + instance.put("petId", value); + return getBuilderAfterPetId(instance); + } + + default T petId(double value) { + var instance = getInstance(); + instance.put("petId", value); + return getBuilderAfterPetId(instance); + } + } + + public static class PathParametersMap0Builder implements GenericBuilder> { + private final Map instance; + private static final Set knownKeys = Set.of( + "petId" + ); + public Set getKnownKeys() { + return knownKeys; + } + public PathParametersMap0Builder(Map instance) { + this.instance = instance; + } + public Map build() { + return instance; + } + } + + public static class PathParametersMapBuilder implements SetterForPetId { + private final Map instance; + public PathParametersMapBuilder() { + this.instance = new LinkedHashMap<>(); + } + public Map getInstance() { + return instance; + } + public PathParametersMap0Builder getBuilderAfterPetId(Map instance) { + return new PathParametersMap0Builder(instance); + } + } + + + public sealed interface PetpetidGetPathParameters1Boxed permits PetpetidGetPathParameters1BoxedMap { + @Nullable Object getData(); + } + + public record PetpetidGetPathParameters1BoxedMap(PathParametersMap data) implements PetpetidGetPathParameters1Boxed { + @Override + public @Nullable Object getData() { + return data; + } + } + + + public static class PetpetidGetPathParameters1 extends JsonSchema implements MapSchemaValidator { + private static @Nullable PetpetidGetPathParameters1 instance = null; + + protected PetpetidGetPathParameters1() { + super(new JsonSchemaInfo() + .type(Set.of(Map.class)) + .properties(Map.ofEntries( + new PropertyEntry("petId", Schema0.Schema01.class) + )) + .required(Set.of( + "petId" + )) + .additionalProperties(AdditionalProperties.class) + ); + } + + public static PetpetidGetPathParameters1 getInstance() { + if (instance == null) { + instance = new PetpetidGetPathParameters1(); + } + return instance; + } + + 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 RuntimeException("Invalid non-string key value"); + } + String propertyName = (String) entryKey; + List propertyPathToItem = new ArrayList<>(pathToItem); + propertyPathToItem.add(propertyName); + Object value = entry.getValue(); + LinkedHashMap, Nothing?> schemas = pathToSchemas.get(propertyPathToItem); + if (schemas == null) { + throw new RuntimeException("Validation 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"); + } + properties.put(propertyName, (Number) propertyInstance); + } + FrozenMap castProperties = new FrozenMap<>(properties); + return new PathParametersMap(castProperties); + } + + 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); + SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().build())); + ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, new PathToSchemasMap(), new LinkedHashSet<>()); + PathToSchemasMap pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet); + return getNewInstance(castArg, validationMetadata.pathToItem(), pathToSchemasMap); + } + + + @Override + public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws 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"); + } + @Override + public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { + if (arg instanceof Map) { + return getNewInstance((Map) arg, pathToItem, pathToSchemas); + } + throw new RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); + } + @Override + public PetpetidGetPathParameters1BoxedMap validateAndBox(Map arg, SchemaConfiguration configuration) throws ValidationException { + return new PetpetidGetPathParameters1BoxedMap(validate(arg, configuration)); + } + @Override + public PetpetidGetPathParameters1Boxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { + 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"); + } + } + +} diff --git a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/petpetid/get/PetpetidGetResponses.kt b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/petpetid/get/PetpetidGetResponses.kt new file mode 100644 index 00000000000..42b83c92cc2 --- /dev/null +++ b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/petpetid/get/PetpetidGetResponses.kt @@ -0,0 +1,77 @@ +package org.openapijsonschematools.client.paths.petpetid.get; + +import org.openapijsonschematools.client.paths.petpetid.get.responses.PetpetidGetCode200Response; +import org.openapijsonschematools.client.paths.petpetid.get.responses.PetpetidGetCode400Response; +import org.openapijsonschematools.client.paths.petpetid.get.responses.PetpetidGetCode404Response; +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; +import org.checkerframework.checker.nullness.qual.Nullable; + +import java.net.http.HttpResponse; +import java.util.Map; +import java.util.AbstractMap; + +public class PetpetidGetResponses { + public sealed interface EndpointResponse permits EndpointPetpetidGetCode200Response {} + + public record EndpointPetpetidGetCode200Response( + HttpResponse response, + PetpetidGetCode200Response.SealedResponseBody body, + Nothing? headers + ) implements EndpointResponse, ApiResponse{ + } + + public sealed interface StatusCodeResponseDeserializer permits StatusPetpetidGetCode200ResponseDeserializer, StatusPetpetidGetCode400ResponseDeserializer, StatusPetpetidGetCode404ResponseDeserializer {} + + public static final class StatusPetpetidGetCode200ResponseDeserializer extends PetpetidGetCode200Response.PetpetidGetCode200Response1 implements StatusCodeResponseDeserializer { + } + public static final class StatusPetpetidGetCode400ResponseDeserializer extends PetpetidGetCode400Response.PetpetidGetCode400Response1 implements StatusCodeResponseDeserializer { + } + public static final class StatusPetpetidGetCode404ResponseDeserializer extends PetpetidGetCode404Response.PetpetidGetCode404Response1 implements StatusCodeResponseDeserializer { + } + + public static final class PetpetidGetResponses1 implements ResponsesDeserializer { + private final Map statusCodeToResponseDeserializer; + public PetpetidGetResponses1() { + this.statusCodeToResponseDeserializer = Map.ofEntries( + new AbstractMap.SimpleEntry<>("200", new StatusPetpetidGetCode200ResponseDeserializer()), + new AbstractMap.SimpleEntry<>("400", new StatusPetpetidGetCode400ResponseDeserializer()), + new AbstractMap.SimpleEntry<>("404", new StatusPetpetidGetCode404ResponseDeserializer()) + ); + } + + 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) { + throw new ApiException( + "Invalid response statusCode="+statusCode+" has no response defined in the openapi document", + response + ); + } + if (statusCodeDeserializer instanceof StatusPetpetidGetCode200ResponseDeserializer castDeserializer) { + var deserializedResponse = castDeserializer.deserialize(response, configuration); + return new EndpointPetpetidGetCode200Response(response, deserializedResponse.body(), deserializedResponse.headers()); + } else if (statusCodeDeserializer instanceof StatusPetpetidGetCode400ResponseDeserializer castDeserializer) { + var deserializedResponse = castDeserializer.deserialize(response, configuration); + throw new PetpetidGetCode400Response.ResponseApiException( + "Received error statusCode response from server", + response, + deserializedResponse + ); + } else { + StatusPetpetidGetCode404ResponseDeserializer castDeserializer = (StatusPetpetidGetCode404ResponseDeserializer) statusCodeDeserializer; + var deserializedResponse = castDeserializer.deserialize(response, configuration); + throw new PetpetidGetCode404Response.ResponseApiException( + "Received error statusCode response from server", + response, + deserializedResponse + ); + } + } + } +} diff --git a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/petpetid/get/PetpetidGetSecurityInfo.kt b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/petpetid/get/PetpetidGetSecurityInfo.kt new file mode 100644 index 00000000000..4d21d88f82e --- /dev/null +++ b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/petpetid/get/PetpetidGetSecurityInfo.kt @@ -0,0 +1,24 @@ +package org.openapijsonschematools.client.paths.petpetid.get; + +import org.openapijsonschematools.client.paths.petpetid.get.security.PetpetidGetSecurityRequirementObject0; +import org.openapijsonschematools.client.securityrequirementobjects.SecurityRequirementObject; +import org.openapijsonschematools.client.securityrequirementobjects.SecurityRequirementObjectProvider; + +public class PetpetidGetSecurityInfo { + public static class PetpetidGetSecurityInfo1 implements SecurityRequirementObjectProvider { + public final PetpetidGetSecurityRequirementObject0 security0; + + public PetpetidGetSecurityInfo1() { + security0 = new PetpetidGetSecurityRequirementObject0(); + } + + @Override + public SecurityRequirementObject getSecurityRequirementObject(SecurityIndex securityIndex) { + return security0; + } + } + + public enum SecurityIndex { + SECURITY_0 + } +} \ No newline at end of file diff --git a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/petpetid/get/parameters/Parameter0.kt b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/petpetid/get/parameters/Parameter0.kt new file mode 100644 index 00000000000..7b03160b9a4 --- /dev/null +++ b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/petpetid/get/parameters/Parameter0.kt @@ -0,0 +1,23 @@ +package org.openapijsonschematools.client.paths.petpetid.get.parameters; + +import org.openapijsonschematools.client.parameter.ParameterStyle; +import org.openapijsonschematools.client.parameter.ParameterInType; +import org.openapijsonschematools.client.parameter.SchemaParameter; +import org.openapijsonschematools.client.paths.petpetid.get.parameters.parameter0.Schema0; + +public class Parameter0 { + + public static class Parameter01 extends SchemaParameter { + public Parameter01() { + super( + "petId", + ParameterInType.PATH, + true, + ParameterStyle.SIMPLE, + false, + false, + Schema0.Schema01.getInstance() + ); + } + } +} diff --git a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/petpetid/get/parameters/parameter0/Schema0.kt b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/petpetid/get/parameters/parameter0/Schema0.kt new file mode 100644 index 00000000000..2131549a0b8 --- /dev/null +++ b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/petpetid/get/parameters/parameter0/Schema0.kt @@ -0,0 +1,19 @@ +package org.openapijsonschematools.client.paths.petpetid.get.parameters.parameter0; +import org.checkerframework.checker.nullness.qual.Nullable; +import org.openapijsonschematools.client.schemas.Int64JsonSchema; + +public class Schema0 extends Int64JsonSchema { + // nest classes so all schemas and input/output classes can be public + + + public static class Schema01 extends Int64JsonSchema.Int64JsonSchema1 { + private static @Nullable Schema01 instance = null; + public static Schema01 getInstance() { + if (instance == null) { + instance = new Schema01(); + } + return instance; + } + } + +} diff --git a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/petpetid/get/responses/PetpetidGetCode200Response.kt b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/petpetid/get/responses/PetpetidGetCode200Response.kt new file mode 100644 index 00000000000..7daf7176e0e --- /dev/null +++ b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/petpetid/get/responses/PetpetidGetCode200Response.kt @@ -0,0 +1,81 @@ +package org.openapijsonschematools.client.paths.petpetid.get.responses; + +import org.openapijsonschematools.client.configurations.SchemaConfiguration; +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; + +import java.util.AbstractMap; +import java.util.Map; +import java.net.http.HttpResponse; +import java.net.http.HttpHeaders; + +public class PetpetidGetCode200Response { + public sealed interface SealedMediaType permits ApplicationxmlMediaType, ApplicationjsonMediaType {} + + public record ApplicationxmlMediaType(ApplicationxmlSchema.ApplicationxmlSchema1 schema) implements SealedMediaType, MediaType { + public ApplicationxmlMediaType() { + this(ApplicationxmlSchema.ApplicationxmlSchema1.getInstance()); + } + @Override + public Nothing? encoding() { + return null; + } + } + + public record ApplicationjsonMediaType(ApplicationjsonSchema.ApplicationjsonSchema1 schema) implements SealedMediaType, MediaType { + public ApplicationjsonMediaType() { + this(ApplicationjsonSchema.ApplicationjsonSchema1.getInstance()); + } + @Override + public Nothing? encoding() { + return null; + } + } + public sealed interface SealedResponseBody permits ApplicationxmlResponseBody, ApplicationjsonResponseBody {} + public record ApplicationxmlResponseBody(ApplicationxmlSchema.Pet1Boxed body) implements SealedResponseBody { } + public record ApplicationjsonResponseBody(ApplicationjsonSchema.Pet1Boxed body) implements SealedResponseBody { } + + public static class PetpetidGetCode200Response1 extends ResponseDeserializer { + public PetpetidGetCode200Response1() { + super( + Map.ofEntries( + new AbstractMap.SimpleEntry<>("application/xml", new ApplicationxmlMediaType()), + new AbstractMap.SimpleEntry<>("application/json", new ApplicationjsonMediaType()) + ) + ); + } + + @Override + 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 { + ApplicationjsonMediaType thisMediaType = (ApplicationjsonMediaType) mediaType; + var deserializedBody = deserializeBody(contentType, body, thisMediaType.schema(), configuration); + return new ApplicationjsonResponseBody(deserializedBody); + } + } + + @Override + protected Nothing? getHeaders(HttpHeaders headers, SchemaConfiguration configuration) { + return null; + } + } + + @SuppressWarnings("serial") + public static class ResponseApiException extends ApiException { + public DeserializedHttpResponse deserializedResponse; + + public ResponseApiException(String s, HttpResponse response, DeserializedHttpResponse deserializedResponse) { + super(s, response); + this.deserializedResponse = deserializedResponse; + } + } +} diff --git a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/petpetid/get/responses/PetpetidGetCode400Response.kt b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/petpetid/get/responses/PetpetidGetCode400Response.kt new file mode 100644 index 00000000000..d52d1f64675 --- /dev/null +++ b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/petpetid/get/responses/PetpetidGetCode400Response.kt @@ -0,0 +1,45 @@ +package org.openapijsonschematools.client.paths.petpetid.get.responses; + +import org.openapijsonschematools.client.configurations.SchemaConfiguration; +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; +import java.net.http.HttpResponse; +import java.net.http.HttpHeaders; + +public class PetpetidGetCode400Response { + + public static class PetpetidGetCode400Response1 extends ResponseDeserializer { + public PetpetidGetCode400Response1() { + super( + MapUtils.makeMap( + ) + ); + } + + @Override + protected Nothing? getBody(String contentType, Nothing? mediaType, byte[] body, SchemaConfiguration configuration) { + return null; + } + + @Override + protected Nothing? getHeaders(HttpHeaders headers, SchemaConfiguration configuration) { + return null; + } + } + + @SuppressWarnings("serial") + public static class ResponseApiException extends ApiException { + public DeserializedHttpResponse deserializedResponse; + + public ResponseApiException(String s, HttpResponse response, DeserializedHttpResponse deserializedResponse) { + super(s, response); + this.deserializedResponse = deserializedResponse; + } + } +} diff --git a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/petpetid/get/responses/PetpetidGetCode404Response.kt b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/petpetid/get/responses/PetpetidGetCode404Response.kt new file mode 100644 index 00000000000..f8e3854f670 --- /dev/null +++ b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/petpetid/get/responses/PetpetidGetCode404Response.kt @@ -0,0 +1,45 @@ +package org.openapijsonschematools.client.paths.petpetid.get.responses; + +import org.openapijsonschematools.client.configurations.SchemaConfiguration; +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; +import java.net.http.HttpResponse; +import java.net.http.HttpHeaders; + +public class PetpetidGetCode404Response { + + public static class PetpetidGetCode404Response1 extends ResponseDeserializer { + public PetpetidGetCode404Response1() { + super( + MapUtils.makeMap( + ) + ); + } + + @Override + protected Nothing? getBody(String contentType, Nothing? mediaType, byte[] body, SchemaConfiguration configuration) { + return null; + } + + @Override + protected Nothing? getHeaders(HttpHeaders headers, SchemaConfiguration configuration) { + return null; + } + } + + @SuppressWarnings("serial") + public static class ResponseApiException extends ApiException { + public DeserializedHttpResponse deserializedResponse; + + public ResponseApiException(String s, HttpResponse response, DeserializedHttpResponse deserializedResponse) { + super(s, response); + this.deserializedResponse = deserializedResponse; + } + } +} diff --git a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/petpetid/get/responses/code200response/content/applicationjson/ApplicationjsonSchema.kt b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/petpetid/get/responses/code200response/content/applicationjson/ApplicationjsonSchema.kt new file mode 100644 index 00000000000..1409b9ae6dd --- /dev/null +++ b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/petpetid/get/responses/code200response/content/applicationjson/ApplicationjsonSchema.kt @@ -0,0 +1,20 @@ +package org.openapijsonschematools.client.paths.petpetid.get.responses.code200response.content.applicationjson; + +import org.checkerframework.checker.nullness.qual.Nullable; +import org.openapijsonschematools.client.components.schemas.Pet; +import org.openapijsonschematools.client.components.schemas.RefPet; + +public class ApplicationjsonSchema extends RefPet { + // $refed class + + + public static class ApplicationjsonSchema1 extends Pet1 { + private static @Nullable ApplicationjsonSchema1 instance = null; + public static ApplicationjsonSchema1 getInstance() { + if (instance == null) { + instance = new ApplicationjsonSchema1(); + } + return instance; + } + } +} diff --git a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/petpetid/get/responses/code200response/content/applicationxml/ApplicationxmlSchema.kt b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/petpetid/get/responses/code200response/content/applicationxml/ApplicationxmlSchema.kt new file mode 100644 index 00000000000..2c49b59c0e5 --- /dev/null +++ b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/petpetid/get/responses/code200response/content/applicationxml/ApplicationxmlSchema.kt @@ -0,0 +1,19 @@ +package org.openapijsonschematools.client.paths.petpetid.get.responses.code200response.content.applicationxml; + +import org.checkerframework.checker.nullness.qual.Nullable; +import org.openapijsonschematools.client.components.schemas.Pet; + +public class ApplicationxmlSchema extends Pet { + // $refed class + + + public static class ApplicationxmlSchema1 extends Pet1 { + private static @Nullable ApplicationxmlSchema1 instance = null; + public static ApplicationxmlSchema1 getInstance() { + if (instance == null) { + instance = new ApplicationxmlSchema1(); + } + return instance; + } + } +} diff --git a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/petpetid/get/security/PetpetidGetSecurityRequirementObject0.kt b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/petpetid/get/security/PetpetidGetSecurityRequirementObject0.kt new file mode 100644 index 00000000000..00903fe643c --- /dev/null +++ b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/petpetid/get/security/PetpetidGetSecurityRequirementObject0.kt @@ -0,0 +1,24 @@ +package org.openapijsonschematools.client.paths.petpetid.get.security; + +import org.checkerframework.checker.nullness.qual.Nullable; +import org.openapijsonschematools.client.securityrequirementobjects.SecurityRequirementObject; +import org.openapijsonschematools.client.securityschemes.SecurityScheme; +import org.openapijsonschematools.client.components.securityschemes.ApiKey; + +import java.util.List; +import java.util.Map; +import java.util.AbstractMap; + +public class PetpetidGetSecurityRequirementObject0 extends SecurityRequirementObject { + + public PetpetidGetSecurityRequirementObject0() { + super( + Map.ofEntries( + new AbstractMap.SimpleEntry, List>( + ApiKey.class, + List.of() + ) + ) + ); + } +} diff --git a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/petpetid/post/Parameters.kt b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/petpetid/post/Parameters.kt new file mode 100644 index 00000000000..04772587103 --- /dev/null +++ b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/petpetid/post/Parameters.kt @@ -0,0 +1,20 @@ +package org.openapijsonschematools.client.paths.petpetid.post; + +import org.openapijsonschematools.client.paths.petpetid.post.parameters.Parameter0; +import org.openapijsonschematools.client.parameter.PathSerializer; + +import java.util.Map; +import java.util.AbstractMap; + +public class Parameters { + + public static class PathParametersSerializer extends PathSerializer { + public PathParametersSerializer() { + super( + Map.ofEntries( + new AbstractMap.SimpleEntry<>("petId", new Parameter0.Parameter01()) + ) + ); + } + } +} diff --git a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/petpetid/post/PetpetidPostPathParameters.kt b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/petpetid/post/PetpetidPostPathParameters.kt new file mode 100644 index 00000000000..370d00c3e4f --- /dev/null +++ b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/petpetid/post/PetpetidPostPathParameters.kt @@ -0,0 +1,223 @@ +package org.openapijsonschematools.client.paths.petpetid.post; +import java.util.ArrayList; +import java.util.HashSet; +import java.util.LinkedHashMap; +import java.util.LinkedHashSet; +import java.util.List; +import java.util.Map; +import java.util.Objects; +import java.util.Set; +import org.checkerframework.checker.nullness.qual.Nullable; +import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags; +import org.openapijsonschematools.client.configurations.SchemaConfiguration; +import org.openapijsonschematools.client.exceptions.UnsetPropertyException; +import org.openapijsonschematools.client.exceptions.ValidationException; +import org.openapijsonschematools.client.paths.petpetid.post.parameters.parameter0.Schema0; +import org.openapijsonschematools.client.schemas.AnyTypeJsonSchema; +import org.openapijsonschematools.client.schemas.GenericBuilder; +import org.openapijsonschematools.client.schemas.NotAnyTypeJsonSchema; +import org.openapijsonschematools.client.schemas.validation.FrozenMap; +import org.openapijsonschematools.client.schemas.validation.JsonSchema; +import org.openapijsonschematools.client.schemas.validation.JsonSchemaInfo; +import org.openapijsonschematools.client.schemas.validation.MapSchemaValidator; +import org.openapijsonschematools.client.schemas.validation.MapUtils; +import org.openapijsonschematools.client.schemas.validation.PathToSchemasMap; +import org.openapijsonschematools.client.schemas.validation.PropertyEntry; +import org.openapijsonschematools.client.schemas.validation.ValidationMetadata; + +public class PetpetidPostPathParameters { + // nest classes so all schemas and input/output classes can be public + + + public static class AdditionalProperties extends NotAnyTypeJsonSchema.NotAnyTypeJsonSchema1 { + // NotAnyTypeSchema + private static @Nullable AdditionalProperties instance = null; + public static AdditionalProperties getInstance() { + if (instance == null) { + instance = new AdditionalProperties(); + } + return instance; + } + } + + + public static class PathParametersMap extends FrozenMap { + protected PathParametersMap(FrozenMap m) { + super(m); + } + public static final Set requiredKeys = Set.of( + "petId" + ); + public static final Set optionalKeys = Set.of(); + public static PathParametersMap of(Map arg, SchemaConfiguration configuration) throws ValidationException { + return PetpetidPostPathParameters1.getInstance().validate(arg, configuration); + } + + public Number petId() { + try { + return getOrThrow("version"); + } catch (UnsetPropertyException e) { + throw new RuntimeException(e); + } + } + } + + public interface SetterForPetId { + Map getInstance(); + T getBuilderAfterPetId(Map instance); + + default T petId(int value) { + var instance = getInstance(); + instance.put("petId", value); + return getBuilderAfterPetId(instance); + } + + default T petId(float value) { + var instance = getInstance(); + instance.put("petId", value); + return getBuilderAfterPetId(instance); + } + + default T petId(long value) { + var instance = getInstance(); + instance.put("petId", value); + return getBuilderAfterPetId(instance); + } + + default T petId(double value) { + var instance = getInstance(); + instance.put("petId", value); + return getBuilderAfterPetId(instance); + } + } + + public static class PathParametersMap0Builder implements GenericBuilder> { + private final Map instance; + private static final Set knownKeys = Set.of( + "petId" + ); + public Set getKnownKeys() { + return knownKeys; + } + public PathParametersMap0Builder(Map instance) { + this.instance = instance; + } + public Map build() { + return instance; + } + } + + public static class PathParametersMapBuilder implements SetterForPetId { + private final Map instance; + public PathParametersMapBuilder() { + this.instance = new LinkedHashMap<>(); + } + public Map getInstance() { + return instance; + } + public PathParametersMap0Builder getBuilderAfterPetId(Map instance) { + return new PathParametersMap0Builder(instance); + } + } + + + public sealed interface PetpetidPostPathParameters1Boxed permits PetpetidPostPathParameters1BoxedMap { + @Nullable Object getData(); + } + + public record PetpetidPostPathParameters1BoxedMap(PathParametersMap data) implements PetpetidPostPathParameters1Boxed { + @Override + public @Nullable Object getData() { + return data; + } + } + + + public static class PetpetidPostPathParameters1 extends JsonSchema implements MapSchemaValidator { + private static @Nullable PetpetidPostPathParameters1 instance = null; + + protected PetpetidPostPathParameters1() { + super(new JsonSchemaInfo() + .type(Set.of(Map.class)) + .properties(Map.ofEntries( + new PropertyEntry("petId", Schema0.Schema01.class) + )) + .required(Set.of( + "petId" + )) + .additionalProperties(AdditionalProperties.class) + ); + } + + public static PetpetidPostPathParameters1 getInstance() { + if (instance == null) { + instance = new PetpetidPostPathParameters1(); + } + return instance; + } + + 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 RuntimeException("Invalid non-string key value"); + } + String propertyName = (String) entryKey; + List propertyPathToItem = new ArrayList<>(pathToItem); + propertyPathToItem.add(propertyName); + Object value = entry.getValue(); + LinkedHashMap, Nothing?> schemas = pathToSchemas.get(propertyPathToItem); + if (schemas == null) { + throw new RuntimeException("Validation 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"); + } + properties.put(propertyName, (Number) propertyInstance); + } + FrozenMap castProperties = new FrozenMap<>(properties); + return new PathParametersMap(castProperties); + } + + 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); + SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().build())); + ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, new PathToSchemasMap(), new LinkedHashSet<>()); + PathToSchemasMap pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet); + return getNewInstance(castArg, validationMetadata.pathToItem(), pathToSchemasMap); + } + + + @Override + public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws 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"); + } + @Override + public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { + if (arg instanceof Map) { + return getNewInstance((Map) arg, pathToItem, pathToSchemas); + } + throw new RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); + } + @Override + public PetpetidPostPathParameters1BoxedMap validateAndBox(Map arg, SchemaConfiguration configuration) throws ValidationException { + return new PetpetidPostPathParameters1BoxedMap(validate(arg, configuration)); + } + @Override + public PetpetidPostPathParameters1Boxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { + 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"); + } + } + +} diff --git a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/petpetid/post/PetpetidPostRequestBody.kt b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/petpetid/post/PetpetidPostRequestBody.kt new file mode 100644 index 00000000000..640478d98a0 --- /dev/null +++ b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/petpetid/post/PetpetidPostRequestBody.kt @@ -0,0 +1,49 @@ +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; +import org.openapijsonschematools.client.mediatype.MediaType; +import org.openapijsonschematools.client.paths.petpetid.post.requestbody.content.applicationxwwwformurlencoded.ApplicationxwwwformurlencodedSchema; + +import java.util.AbstractMap; +import java.util.Map; + +public class PetpetidPostRequestBody { + public sealed interface SealedMediaType permits ApplicationxwwwformurlencodedMediaType {} + + public record ApplicationxwwwformurlencodedMediaType(ApplicationxwwwformurlencodedSchema.ApplicationxwwwformurlencodedSchema1 schema) implements SealedMediaType, MediaType { + public ApplicationxwwwformurlencodedMediaType() { + this(ApplicationxwwwformurlencodedSchema.ApplicationxwwwformurlencodedSchema1.getInstance()); + } + @Override + public Nothing? encoding() { + return null; + } + } + + public static class PetpetidPostRequestBody1 extends RequestBodySerializer { + public PetpetidPostRequestBody1() { + super( + Map.ofEntries( + new AbstractMap.SimpleEntry<>("application/x-www-form-urlencoded", new ApplicationxwwwformurlencodedMediaType()) + ), + false + ); + } + + public SerializedRequestBody serialize(SealedRequestBody requestBody) throws NotImplementedException { + ApplicationxwwwformurlencodedRequestBody requestBody0 = (ApplicationxwwwformurlencodedRequestBody) requestBody; + return serialize(requestBody0.contentType(), requestBody0.body().getData()); + } + } + + public sealed interface SealedRequestBody permits ApplicationxwwwformurlencodedRequestBody {} + public record ApplicationxwwwformurlencodedRequestBody(ApplicationxwwwformurlencodedSchema.ApplicationxwwwformurlencodedSchema1Boxed body) implements SealedRequestBody, GenericRequestBody { + @Override + public String contentType() { + return "application/x-www-form-urlencoded"; + } + } +} diff --git a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/petpetid/post/PetpetidPostResponses.kt b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/petpetid/post/PetpetidPostResponses.kt new file mode 100644 index 00000000000..d1b3baa65f1 --- /dev/null +++ b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/petpetid/post/PetpetidPostResponses.kt @@ -0,0 +1,48 @@ +package org.openapijsonschematools.client.paths.petpetid.post; + +import org.openapijsonschematools.client.paths.petpetid.post.responses.PetpetidPostCode405Response; +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; + +import java.net.http.HttpResponse; +import java.util.Map; +import java.util.AbstractMap; + +public class PetpetidPostResponses { + + public sealed interface StatusCodeResponseDeserializer permits StatusPetpetidPostCode405ResponseDeserializer {} + + public static final class StatusPetpetidPostCode405ResponseDeserializer extends PetpetidPostCode405Response.PetpetidPostCode405Response1 implements StatusCodeResponseDeserializer { + } + + public static final class PetpetidPostResponses1 implements ResponsesDeserializer { + private final Map statusCodeToResponseDeserializer; + public PetpetidPostResponses1() { + this.statusCodeToResponseDeserializer = Map.ofEntries( + new AbstractMap.SimpleEntry<>("405", new StatusPetpetidPostCode405ResponseDeserializer()) + ); + } + + public Nothing? deserialize(HttpResponse response, SchemaConfiguration configuration) throws ValidationException, NotImplementedException, ApiException { + String statusCode = String.valueOf(response.statusCode()); + @Nullable StatusCodeResponseDeserializer statusCodeDeserializer = statusCodeToResponseDeserializer.get(statusCode); + if (statusCodeDeserializer == null) { + throw new ApiException( + "Invalid response statusCode="+statusCode+" has no response defined in the openapi document", + response + ); + } + StatusPetpetidPostCode405ResponseDeserializer castDeserializer = (StatusPetpetidPostCode405ResponseDeserializer) statusCodeDeserializer; + var deserializedResponse = castDeserializer.deserialize(response, configuration); + throw new PetpetidPostCode405Response.ResponseApiException( + "Received error statusCode response from server", + response, + deserializedResponse + ); + } + } +} diff --git a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/petpetid/post/PetpetidPostSecurityInfo.kt b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/petpetid/post/PetpetidPostSecurityInfo.kt new file mode 100644 index 00000000000..3763c38088a --- /dev/null +++ b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/petpetid/post/PetpetidPostSecurityInfo.kt @@ -0,0 +1,33 @@ +package org.openapijsonschematools.client.paths.petpetid.post; + +import org.openapijsonschematools.client.paths.petpetid.post.security.PetpetidPostSecurityRequirementObject0; +import org.openapijsonschematools.client.paths.petpetid.post.security.PetpetidPostSecurityRequirementObject1; +import org.openapijsonschematools.client.securityrequirementobjects.SecurityRequirementObject; +import org.openapijsonschematools.client.securityrequirementobjects.SecurityRequirementObjectProvider; + +public class PetpetidPostSecurityInfo { + public static class PetpetidPostSecurityInfo1 implements SecurityRequirementObjectProvider { + public final PetpetidPostSecurityRequirementObject0 security0; + public final PetpetidPostSecurityRequirementObject1 security1; + + public PetpetidPostSecurityInfo1() { + security0 = new PetpetidPostSecurityRequirementObject0(); + security1 = new PetpetidPostSecurityRequirementObject1(); + } + + @Override + public SecurityRequirementObject getSecurityRequirementObject(SecurityIndex securityIndex) { + switch (securityIndex) { + case SECURITY_0: + return security0; + default: + return security1; + } + } + } + + public enum SecurityIndex { + SECURITY_0, + SECURITY_1 + } +} \ No newline at end of file diff --git a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/petpetid/post/parameters/Parameter0.kt b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/petpetid/post/parameters/Parameter0.kt new file mode 100644 index 00000000000..13a19320b60 --- /dev/null +++ b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/petpetid/post/parameters/Parameter0.kt @@ -0,0 +1,23 @@ +package org.openapijsonschematools.client.paths.petpetid.post.parameters; + +import org.openapijsonschematools.client.parameter.ParameterStyle; +import org.openapijsonschematools.client.parameter.ParameterInType; +import org.openapijsonschematools.client.parameter.SchemaParameter; +import org.openapijsonschematools.client.paths.petpetid.post.parameters.parameter0.Schema0; + +public class Parameter0 { + + public static class Parameter01 extends SchemaParameter { + public Parameter01() { + super( + "petId", + ParameterInType.PATH, + true, + ParameterStyle.SIMPLE, + false, + false, + Schema0.Schema01.getInstance() + ); + } + } +} diff --git a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/petpetid/post/parameters/parameter0/Schema0.kt b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/petpetid/post/parameters/parameter0/Schema0.kt new file mode 100644 index 00000000000..2bcfb59b424 --- /dev/null +++ b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/petpetid/post/parameters/parameter0/Schema0.kt @@ -0,0 +1,19 @@ +package org.openapijsonschematools.client.paths.petpetid.post.parameters.parameter0; +import org.checkerframework.checker.nullness.qual.Nullable; +import org.openapijsonschematools.client.schemas.Int64JsonSchema; + +public class Schema0 extends Int64JsonSchema { + // nest classes so all schemas and input/output classes can be public + + + public static class Schema01 extends Int64JsonSchema.Int64JsonSchema1 { + private static @Nullable Schema01 instance = null; + public static Schema01 getInstance() { + if (instance == null) { + instance = new Schema01(); + } + return instance; + } + } + +} diff --git a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/petpetid/post/requestbody/content/applicationxwwwformurlencoded/ApplicationxwwwformurlencodedSchema.kt b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/petpetid/post/requestbody/content/applicationxwwwformurlencoded/ApplicationxwwwformurlencodedSchema.kt new file mode 100644 index 00000000000..66d56b3ba33 --- /dev/null +++ b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/petpetid/post/requestbody/content/applicationxwwwformurlencoded/ApplicationxwwwformurlencodedSchema.kt @@ -0,0 +1,238 @@ +package org.openapijsonschematools.client.paths.petpetid.post.requestbody.content.applicationxwwwformurlencoded; +import java.util.ArrayList; +import java.util.HashSet; +import java.util.LinkedHashMap; +import java.util.LinkedHashSet; +import java.util.List; +import java.util.Map; +import java.util.Objects; +import java.util.Set; +import org.checkerframework.checker.nullness.qual.Nullable; +import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags; +import org.openapijsonschematools.client.configurations.SchemaConfiguration; +import org.openapijsonschematools.client.exceptions.InvalidAdditionalPropertyException; +import org.openapijsonschematools.client.exceptions.UnsetPropertyException; +import org.openapijsonschematools.client.exceptions.ValidationException; +import org.openapijsonschematools.client.schemas.GenericBuilder; +import org.openapijsonschematools.client.schemas.StringJsonSchema; +import org.openapijsonschematools.client.schemas.UnsetAddPropsSetter; +import org.openapijsonschematools.client.schemas.validation.FrozenMap; +import org.openapijsonschematools.client.schemas.validation.JsonSchema; +import org.openapijsonschematools.client.schemas.validation.JsonSchemaInfo; +import org.openapijsonschematools.client.schemas.validation.MapSchemaValidator; +import org.openapijsonschematools.client.schemas.validation.PathToSchemasMap; +import org.openapijsonschematools.client.schemas.validation.PropertyEntry; +import org.openapijsonschematools.client.schemas.validation.ValidationMetadata; + +public class ApplicationxwwwformurlencodedSchema { + // nest classes so all schemas and input/output classes can be public + + + public static class ApplicationxwwwformurlencodedName extends StringJsonSchema.StringJsonSchema1 { + private static @Nullable ApplicationxwwwformurlencodedName instance = null; + public static ApplicationxwwwformurlencodedName getInstance() { + if (instance == null) { + instance = new ApplicationxwwwformurlencodedName(); + } + return instance; + } + } + + + public static class ApplicationxwwwformurlencodedStatus extends StringJsonSchema.StringJsonSchema1 { + private static @Nullable ApplicationxwwwformurlencodedStatus instance = null; + public static ApplicationxwwwformurlencodedStatus getInstance() { + if (instance == null) { + instance = new ApplicationxwwwformurlencodedStatus(); + } + return instance; + } + } + + + public static class ApplicationxwwwformurlencodedSchemaMap extends FrozenMap<@Nullable Object> { + protected ApplicationxwwwformurlencodedSchemaMap(FrozenMap<@Nullable Object> m) { + super(m); + } + public static final Set requiredKeys = Set.of(); + public static final Set optionalKeys = Set.of( + "name", + "status" + ); + public static ApplicationxwwwformurlencodedSchemaMap of(Map arg, SchemaConfiguration configuration) throws ValidationException { + return ApplicationxwwwformurlencodedSchema1.getInstance().validate(arg, configuration); + } + + public String name() throws UnsetPropertyException { + String key = "name"; + throwIfKeyNotPresent(key); + @Nullable Object value = get(key); + if (!(value instanceof String)) { + throw new RuntimeException("Invalid value stored for name"); + } + return (String) value; + } + + public String status() throws UnsetPropertyException { + String key = "status"; + throwIfKeyNotPresent(key); + @Nullable Object value = get(key); + if (!(value instanceof String)) { + throw new RuntimeException("Invalid value stored for status"); + } + return (String) value; + } + + public @Nullable Object getAdditionalProperty(String name) throws UnsetPropertyException, InvalidAdditionalPropertyException { + throwIfKeyKnown(name, requiredKeys, optionalKeys); + throwIfKeyNotPresent(name); + return get(name); + } + } + + public interface SetterForApplicationxwwwformurlencodedName { + Map getInstance(); + T getBuilderAfterApplicationxwwwformurlencodedName(Map instance); + + default T name(String value) { + var instance = getInstance(); + instance.put("name", value); + return getBuilderAfterApplicationxwwwformurlencodedName(instance); + } + } + + public interface SetterForApplicationxwwwformurlencodedStatus { + Map getInstance(); + T getBuilderAfterApplicationxwwwformurlencodedStatus(Map instance); + + default T status(String value) { + var instance = getInstance(); + instance.put("status", value); + return getBuilderAfterApplicationxwwwformurlencodedStatus(instance); + } + } + + public static class ApplicationxwwwformurlencodedSchemaMapBuilder extends UnsetAddPropsSetter implements GenericBuilder>, SetterForApplicationxwwwformurlencodedName, SetterForApplicationxwwwformurlencodedStatus { + private final Map instance; + private static final Set knownKeys = Set.of( + "name", + "status" + ); + public Set getKnownKeys() { + return knownKeys; + } + public ApplicationxwwwformurlencodedSchemaMapBuilder() { + this.instance = new LinkedHashMap<>(); + } + public Map build() { + return instance; + } + public Map getInstance() { + return instance; + } + public ApplicationxwwwformurlencodedSchemaMapBuilder getBuilderAfterApplicationxwwwformurlencodedName(Map instance) { + return this; + } + public ApplicationxwwwformurlencodedSchemaMapBuilder getBuilderAfterApplicationxwwwformurlencodedStatus(Map instance) { + return this; + } + public ApplicationxwwwformurlencodedSchemaMapBuilder getBuilderAfterAdditionalProperty(Map instance) { + return this; + } + } + + + public sealed interface ApplicationxwwwformurlencodedSchema1Boxed permits ApplicationxwwwformurlencodedSchema1BoxedMap { + @Nullable Object getData(); + } + + public record ApplicationxwwwformurlencodedSchema1BoxedMap(ApplicationxwwwformurlencodedSchemaMap data) implements ApplicationxwwwformurlencodedSchema1Boxed { + @Override + public @Nullable Object getData() { + return data; + } + } + + + public static class ApplicationxwwwformurlencodedSchema1 extends JsonSchema implements MapSchemaValidator { + private static @Nullable ApplicationxwwwformurlencodedSchema1 instance = null; + + protected ApplicationxwwwformurlencodedSchema1() { + super(new JsonSchemaInfo() + .type(Set.of(Map.class)) + .properties(Map.ofEntries( + new PropertyEntry("name", ApplicationxwwwformurlencodedName.class), + new PropertyEntry("status", ApplicationxwwwformurlencodedStatus.class) + )) + ); + } + + public static ApplicationxwwwformurlencodedSchema1 getInstance() { + if (instance == null) { + instance = new ApplicationxwwwformurlencodedSchema1(); + } + return instance; + } + + 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 RuntimeException("Invalid non-string key value"); + } + String propertyName = (String) entryKey; + List propertyPathToItem = new ArrayList<>(pathToItem); + propertyPathToItem.add(propertyName); + Object value = entry.getValue(); + LinkedHashMap, Nothing?> schemas = pathToSchemas.get(propertyPathToItem); + if (schemas == null) { + throw new RuntimeException("Validation result is invalid, schemas must exist for a pathToItem"); + } + JsonSchema propertySchema = schemas.entrySet().iterator().next().getKey(); + @Nullable Object propertyInstance = propertySchema.getNewInstance(value, propertyPathToItem, pathToSchemas); + properties.put(propertyName, propertyInstance); + } + FrozenMap<@Nullable Object> castProperties = new FrozenMap<>(properties); + return new ApplicationxwwwformurlencodedSchemaMap(castProperties); + } + + 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); + SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().build())); + ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, new PathToSchemasMap(), new LinkedHashSet<>()); + PathToSchemasMap pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet); + return getNewInstance(castArg, validationMetadata.pathToItem(), pathToSchemasMap); + } + + + @Override + public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws 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"); + } + @Override + public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { + if (arg instanceof Map) { + return getNewInstance((Map) arg, pathToItem, pathToSchemas); + } + 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 { + return new ApplicationxwwwformurlencodedSchema1BoxedMap(validate(arg, configuration)); + } + @Override + public ApplicationxwwwformurlencodedSchema1Boxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { + 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"); + } + } + +} diff --git a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/petpetid/post/responses/PetpetidPostCode405Response.kt b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/petpetid/post/responses/PetpetidPostCode405Response.kt new file mode 100644 index 00000000000..18f5a708fac --- /dev/null +++ b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/petpetid/post/responses/PetpetidPostCode405Response.kt @@ -0,0 +1,45 @@ +package org.openapijsonschematools.client.paths.petpetid.post.responses; + +import org.openapijsonschematools.client.configurations.SchemaConfiguration; +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; +import java.net.http.HttpResponse; +import java.net.http.HttpHeaders; + +public class PetpetidPostCode405Response { + + public static class PetpetidPostCode405Response1 extends ResponseDeserializer { + public PetpetidPostCode405Response1() { + super( + MapUtils.makeMap( + ) + ); + } + + @Override + protected Nothing? getBody(String contentType, Nothing? mediaType, byte[] body, SchemaConfiguration configuration) { + return null; + } + + @Override + protected Nothing? getHeaders(HttpHeaders headers, SchemaConfiguration configuration) { + return null; + } + } + + @SuppressWarnings("serial") + public static class ResponseApiException extends ApiException { + public DeserializedHttpResponse deserializedResponse; + + public ResponseApiException(String s, HttpResponse response, DeserializedHttpResponse deserializedResponse) { + super(s, response); + this.deserializedResponse = deserializedResponse; + } + } +} diff --git a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/petpetid/post/security/PetpetidPostSecurityRequirementObject0.kt b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/petpetid/post/security/PetpetidPostSecurityRequirementObject0.kt new file mode 100644 index 00000000000..5362c41579c --- /dev/null +++ b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/petpetid/post/security/PetpetidPostSecurityRequirementObject0.kt @@ -0,0 +1,24 @@ +package org.openapijsonschematools.client.paths.petpetid.post.security; + +import org.checkerframework.checker.nullness.qual.Nullable; +import org.openapijsonschematools.client.securityrequirementobjects.SecurityRequirementObject; +import org.openapijsonschematools.client.securityschemes.SecurityScheme; +import org.openapijsonschematools.client.components.securityschemes.ApiKey; + +import java.util.List; +import java.util.Map; +import java.util.AbstractMap; + +public class PetpetidPostSecurityRequirementObject0 extends SecurityRequirementObject { + + public PetpetidPostSecurityRequirementObject0() { + super( + Map.ofEntries( + new AbstractMap.SimpleEntry, List>( + ApiKey.class, + List.of() + ) + ) + ); + } +} diff --git a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/petpetid/post/security/PetpetidPostSecurityRequirementObject1.kt b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/petpetid/post/security/PetpetidPostSecurityRequirementObject1.kt new file mode 100644 index 00000000000..377bdaffd38 --- /dev/null +++ b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/petpetid/post/security/PetpetidPostSecurityRequirementObject1.kt @@ -0,0 +1,24 @@ +package org.openapijsonschematools.client.paths.petpetid.post.security; + +import org.checkerframework.checker.nullness.qual.Nullable; +import org.openapijsonschematools.client.securityrequirementobjects.SecurityRequirementObject; +import org.openapijsonschematools.client.securityschemes.SecurityScheme; +import org.openapijsonschematools.client.components.securityschemes.PetstoreAuth; + +import java.util.List; +import java.util.Map; +import java.util.AbstractMap; + +public class PetpetidPostSecurityRequirementObject1 extends SecurityRequirementObject { + + public PetpetidPostSecurityRequirementObject1() { + super( + Map.ofEntries( + new AbstractMap.SimpleEntry, List>( + PetstoreAuth.class, + List.of("write:pets", "read:pets") + ) + ) + ); + } +} diff --git a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/petpetiduploadimage/PetpetiduploadimagePost.kt b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/petpetiduploadimage/PetpetiduploadimagePost.kt new file mode 100644 index 00000000000..82c0dce116b --- /dev/null +++ b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/petpetiduploadimage/PetpetiduploadimagePost.kt @@ -0,0 +1,243 @@ +package org.openapijsonschematools.client.paths.petpetiduploadimage; + +import org.checkerframework.checker.nullness.qual.Nullable; +import org.openapijsonschematools.client.paths.petpetiduploadimage.post.PetpetiduploadimagePostRequestBody; +import org.openapijsonschematools.client.RootServerInfo; +import org.openapijsonschematools.client.paths.petpetiduploadimage.post.PetpetiduploadimagePostSecurityInfo; +import org.openapijsonschematools.client.paths.petpetiduploadimage.post.PetpetiduploadimagePostPathParameters; +import org.openapijsonschematools.client.paths.petpetiduploadimage.post.Parameters; +import org.openapijsonschematools.client.paths.petpetiduploadimage.post.PetpetiduploadimagePostResponses; +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.requestbody.SerializedRequestBody; +import org.openapijsonschematools.client.paths.Petpetiduploadimage; +import org.openapijsonschematools.client.securityrequirementobjects.SecurityRequirementObject; +import org.openapijsonschematools.client.securityrequirementobjects.AuthApplier; + +import java.io.IOException; +import java.util.ArrayList; +import java.net.http.HttpClient; +import java.net.http.HttpRequest; +import java.time.Duration; +import java.util.List; +import java.util.Map; + +public class PetpetiduploadimagePost { + private static class PostProvider extends AuthApplier { + private static final String method = "post"; + + public static PetpetiduploadimagePostResponses.EndpointResponse post( + PostRequest request, + ApiConfiguration apiConfiguration, + SchemaConfiguration schemaConfiguration, + HttpClient client + ) throws IOException, InterruptedException, ValidationException, NotImplementedException, ApiException { + Map> headers = apiConfiguration.getDefaultHeaders(); + + @Nullable SerializedRequestBody serializedRequestBody; + HttpRequest.BodyPublisher bodyPublisher = HttpRequest.BodyPublishers.noBody(); + if (request.requestBody != null) { + serializedRequestBody = new PetpetiduploadimagePostRequestBody.PetpetiduploadimagePostRequestBody1().serialize( + request.requestBody + ); + var contentTypeHeaderValues = headers.getOrDefault("Content-Type", new ArrayList<>()); + contentTypeHeaderValues.add(serializedRequestBody.contentType); + bodyPublisher = serializedRequestBody.bodyPublisher; + } + + var pathSerializer = new Parameters.PathParametersSerializer(); + String updatedPath = pathSerializer.serialize(request.pathParameters, Petpetiduploadimage.path); + // TODO set this to a map if there is a query security scheme + @Nullable Map queryMap = null; + String host = apiConfiguration.getServer(request.serverIndex).url(); + SecurityRequirementObject securityRequirementObject = apiConfiguration.getSecurityRequirementObject(request.securityIndex); + updateParamsForAuth( + securityRequirementObject, + headers, + updatedPath, + method, + bodyPublisher, + queryMap, + apiConfiguration + ); + + String url = host + updatedPath; + var httpRequest = RestClient.getRequest( + url, + method, + bodyPublisher, + headers, + request.timeout + ); + var response = RestClient.getResponse(httpRequest, client); + var responsesDeserializer = new PetpetiduploadimagePostResponses.PetpetiduploadimagePostResponses1(); + return responsesDeserializer.deserialize(response, schemaConfiguration); + } + } + + public interface PostOperation { + ApiConfiguration getApiConfiguration(); + SchemaConfiguration getSchemaConfiguration(); + HttpClient getClient(); + default PetpetiduploadimagePostResponses.EndpointResponse post(PostRequest request) throws IOException, InterruptedException, ValidationException, NotImplementedException, ApiException { + return PostProvider.post(request, getApiConfiguration(), getSchemaConfiguration(), getClient()); + } + } + + public interface UploadImageOperation { + ApiConfiguration getApiConfiguration(); + SchemaConfiguration getSchemaConfiguration(); + HttpClient getClient(); + default PetpetiduploadimagePostResponses.EndpointResponse uploadImage(PostRequest request) throws IOException, InterruptedException, ValidationException, NotImplementedException, ApiException { + return PostProvider.post(request, getApiConfiguration(), getSchemaConfiguration(), getClient()); + } + } + + public static class Post extends ApiClient implements PostOperation { + public Post(ApiConfiguration apiConfiguration, SchemaConfiguration schemaConfiguration) { + super(apiConfiguration, schemaConfiguration); + } + } + + public static class PostRequest { + public PetpetiduploadimagePostPathParameters.PathParametersMap pathParameters; + public PetpetiduploadimagePostRequestBody.@Nullable SealedRequestBody requestBody; + public RootServerInfo.@Nullable ServerIndex serverIndex; + public PetpetiduploadimagePostSecurityInfo.@Nullable SecurityIndex securityIndex; + public @Nullable Duration timeout; + + public PostRequest( + PetpetiduploadimagePostPathParameters.PathParametersMap pathParameters, + PetpetiduploadimagePostRequestBody.@Nullable SealedRequestBody requestBody, + RootServerInfo.@Nullable ServerIndex serverIndex, + PetpetiduploadimagePostSecurityInfo.@Nullable SecurityIndex securityIndex, + @Nullable Duration timeout + ) { + this.pathParameters = pathParameters; + this.requestBody = requestBody; + this.serverIndex = serverIndex; + this.securityIndex = securityIndex; + this.timeout = timeout; + } + } + + public static class PostNullableRequest { + public PetpetiduploadimagePostPathParameters.@Nullable PathParametersMap pathParameters; + public PetpetiduploadimagePostRequestBody.@Nullable SealedRequestBody requestBody; + public RootServerInfo.@Nullable ServerIndex serverIndex; + public PetpetiduploadimagePostSecurityInfo.@Nullable SecurityIndex securityIndex; + public @Nullable Duration timeout; + } + + public interface SetterForRequestBody { + PostNullableRequest getInstance(); + T getBuilderAfterRequestBody(PostNullableRequest instance); + default T requestBody(PetpetiduploadimagePostRequestBody.SealedRequestBody requestBody) { + var instance = getInstance(); + instance.requestBody = requestBody; + return getBuilderAfterRequestBody(instance); + } + } + + public interface SetterForServerIndex { + PostNullableRequest getInstance(); + T getBuilderAfterServerIndex(PostNullableRequest instance); + default T serverIndex(RootServerInfo.ServerIndex serverIndex) { + var instance = getInstance(); + instance.serverIndex = serverIndex; + return getBuilderAfterServerIndex(instance); + } + } + + public interface SetterForSecurityIndex { + PostNullableRequest getInstance(); + T getBuilderAfterSecurityIndex(PostNullableRequest instance); + default T securityIndex(PetpetiduploadimagePostSecurityInfo.SecurityIndex securityIndex) { + var instance = getInstance(); + instance.securityIndex = securityIndex; + return getBuilderAfterSecurityIndex(instance); + } + } + + public interface SetterForTimeout { + PostNullableRequest getInstance(); + T getBuilderAfterTimeout(PostNullableRequest instance); + default T timeout(Duration timeout) { + var instance = getInstance(); + instance.timeout = timeout; + return getBuilderAfterTimeout(instance); + } + } + + public interface SetterForPathParameters { + PostNullableRequest getInstance(); + T getBuilderAfterPathParameters(PostNullableRequest instance); + default T pathParameters(PetpetiduploadimagePostPathParameters.PathParametersMap pathParameters) { + var instance = getInstance(); + instance.pathParameters = pathParameters; + return getBuilderAfterPathParameters(instance); + } + } + + public static class Post0RequestBuilder implements SetterForRequestBody, SetterForServerIndex, SetterForSecurityIndex, SetterForTimeout { + private final PostNullableRequest instance; + + public Post0RequestBuilder(PostNullableRequest instance) { + this.instance = instance; + } + + public PostRequest build() { + var pathParameters = instance.pathParameters; + if (pathParameters == null) { + throw new RuntimeException("invalid null value for required parameter"); + } + return new PostRequest( + pathParameters, + instance.requestBody, + instance.serverIndex, + instance.securityIndex, + instance.timeout + ); + } + + public PostNullableRequest getInstance() { + return instance; + } + + public Post0RequestBuilder getBuilderAfterRequestBody(PostNullableRequest instance) { + return this; + } + + public Post0RequestBuilder getBuilderAfterServerIndex(PostNullableRequest instance) { + return this; + } + + public Post0RequestBuilder getBuilderAfterSecurityIndex(PostNullableRequest instance) { + return this; + } + + public Post0RequestBuilder getBuilderAfterTimeout(PostNullableRequest instance) { + return this; + } + } + public static class PostRequestBuilder implements SetterForPathParameters { + private final PostNullableRequest instance; + + public PostRequestBuilder() { + this.instance = new PostNullableRequest(); + } + + public PostNullableRequest getInstance() { + return instance; + } + + public Post0RequestBuilder getBuilderAfterPathParameters(PostNullableRequest instance) { + return new Post0RequestBuilder(instance); + } + } +} diff --git a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/petpetiduploadimage/post/Parameters.kt b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/petpetiduploadimage/post/Parameters.kt new file mode 100644 index 00000000000..739ed320360 --- /dev/null +++ b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/petpetiduploadimage/post/Parameters.kt @@ -0,0 +1,20 @@ +package org.openapijsonschematools.client.paths.petpetiduploadimage.post; + +import org.openapijsonschematools.client.paths.petpetiduploadimage.post.parameters.Parameter0; +import org.openapijsonschematools.client.parameter.PathSerializer; + +import java.util.Map; +import java.util.AbstractMap; + +public class Parameters { + + public static class PathParametersSerializer extends PathSerializer { + public PathParametersSerializer() { + super( + Map.ofEntries( + new AbstractMap.SimpleEntry<>("petId", new Parameter0.Parameter01()) + ) + ); + } + } +} diff --git a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/petpetiduploadimage/post/PetpetiduploadimagePostPathParameters.kt b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/petpetiduploadimage/post/PetpetiduploadimagePostPathParameters.kt new file mode 100644 index 00000000000..466490e8f6e --- /dev/null +++ b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/petpetiduploadimage/post/PetpetiduploadimagePostPathParameters.kt @@ -0,0 +1,223 @@ +package org.openapijsonschematools.client.paths.petpetiduploadimage.post; +import java.util.ArrayList; +import java.util.HashSet; +import java.util.LinkedHashMap; +import java.util.LinkedHashSet; +import java.util.List; +import java.util.Map; +import java.util.Objects; +import java.util.Set; +import org.checkerframework.checker.nullness.qual.Nullable; +import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags; +import org.openapijsonschematools.client.configurations.SchemaConfiguration; +import org.openapijsonschematools.client.exceptions.UnsetPropertyException; +import org.openapijsonschematools.client.exceptions.ValidationException; +import org.openapijsonschematools.client.paths.petpetiduploadimage.post.parameters.parameter0.Schema0; +import org.openapijsonschematools.client.schemas.AnyTypeJsonSchema; +import org.openapijsonschematools.client.schemas.GenericBuilder; +import org.openapijsonschematools.client.schemas.NotAnyTypeJsonSchema; +import org.openapijsonschematools.client.schemas.validation.FrozenMap; +import org.openapijsonschematools.client.schemas.validation.JsonSchema; +import org.openapijsonschematools.client.schemas.validation.JsonSchemaInfo; +import org.openapijsonschematools.client.schemas.validation.MapSchemaValidator; +import org.openapijsonschematools.client.schemas.validation.MapUtils; +import org.openapijsonschematools.client.schemas.validation.PathToSchemasMap; +import org.openapijsonschematools.client.schemas.validation.PropertyEntry; +import org.openapijsonschematools.client.schemas.validation.ValidationMetadata; + +public class PetpetiduploadimagePostPathParameters { + // nest classes so all schemas and input/output classes can be public + + + public static class AdditionalProperties extends NotAnyTypeJsonSchema.NotAnyTypeJsonSchema1 { + // NotAnyTypeSchema + private static @Nullable AdditionalProperties instance = null; + public static AdditionalProperties getInstance() { + if (instance == null) { + instance = new AdditionalProperties(); + } + return instance; + } + } + + + public static class PathParametersMap extends FrozenMap { + protected PathParametersMap(FrozenMap m) { + super(m); + } + public static final Set requiredKeys = Set.of( + "petId" + ); + public static final Set optionalKeys = Set.of(); + public static PathParametersMap of(Map arg, SchemaConfiguration configuration) throws ValidationException { + return PetpetiduploadimagePostPathParameters1.getInstance().validate(arg, configuration); + } + + public Number petId() { + try { + return getOrThrow("version"); + } catch (UnsetPropertyException e) { + throw new RuntimeException(e); + } + } + } + + public interface SetterForPetId { + Map getInstance(); + T getBuilderAfterPetId(Map instance); + + default T petId(int value) { + var instance = getInstance(); + instance.put("petId", value); + return getBuilderAfterPetId(instance); + } + + default T petId(float value) { + var instance = getInstance(); + instance.put("petId", value); + return getBuilderAfterPetId(instance); + } + + default T petId(long value) { + var instance = getInstance(); + instance.put("petId", value); + return getBuilderAfterPetId(instance); + } + + default T petId(double value) { + var instance = getInstance(); + instance.put("petId", value); + return getBuilderAfterPetId(instance); + } + } + + public static class PathParametersMap0Builder implements GenericBuilder> { + private final Map instance; + private static final Set knownKeys = Set.of( + "petId" + ); + public Set getKnownKeys() { + return knownKeys; + } + public PathParametersMap0Builder(Map instance) { + this.instance = instance; + } + public Map build() { + return instance; + } + } + + public static class PathParametersMapBuilder implements SetterForPetId { + private final Map instance; + public PathParametersMapBuilder() { + this.instance = new LinkedHashMap<>(); + } + public Map getInstance() { + return instance; + } + public PathParametersMap0Builder getBuilderAfterPetId(Map instance) { + return new PathParametersMap0Builder(instance); + } + } + + + public sealed interface PetpetiduploadimagePostPathParameters1Boxed permits PetpetiduploadimagePostPathParameters1BoxedMap { + @Nullable Object getData(); + } + + public record PetpetiduploadimagePostPathParameters1BoxedMap(PathParametersMap data) implements PetpetiduploadimagePostPathParameters1Boxed { + @Override + public @Nullable Object getData() { + return data; + } + } + + + public static class PetpetiduploadimagePostPathParameters1 extends JsonSchema implements MapSchemaValidator { + private static @Nullable PetpetiduploadimagePostPathParameters1 instance = null; + + protected PetpetiduploadimagePostPathParameters1() { + super(new JsonSchemaInfo() + .type(Set.of(Map.class)) + .properties(Map.ofEntries( + new PropertyEntry("petId", Schema0.Schema01.class) + )) + .required(Set.of( + "petId" + )) + .additionalProperties(AdditionalProperties.class) + ); + } + + public static PetpetiduploadimagePostPathParameters1 getInstance() { + if (instance == null) { + instance = new PetpetiduploadimagePostPathParameters1(); + } + return instance; + } + + 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 RuntimeException("Invalid non-string key value"); + } + String propertyName = (String) entryKey; + List propertyPathToItem = new ArrayList<>(pathToItem); + propertyPathToItem.add(propertyName); + Object value = entry.getValue(); + LinkedHashMap, Nothing?> schemas = pathToSchemas.get(propertyPathToItem); + if (schemas == null) { + throw new RuntimeException("Validation 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"); + } + properties.put(propertyName, (Number) propertyInstance); + } + FrozenMap castProperties = new FrozenMap<>(properties); + return new PathParametersMap(castProperties); + } + + 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); + SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().build())); + ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, new PathToSchemasMap(), new LinkedHashSet<>()); + PathToSchemasMap pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet); + return getNewInstance(castArg, validationMetadata.pathToItem(), pathToSchemasMap); + } + + + @Override + public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws 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"); + } + @Override + public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { + if (arg instanceof Map) { + return getNewInstance((Map) arg, pathToItem, pathToSchemas); + } + throw new RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); + } + @Override + public PetpetiduploadimagePostPathParameters1BoxedMap validateAndBox(Map arg, SchemaConfiguration configuration) throws ValidationException { + return new PetpetiduploadimagePostPathParameters1BoxedMap(validate(arg, configuration)); + } + @Override + public PetpetiduploadimagePostPathParameters1Boxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { + 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"); + } + } + +} diff --git a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/petpetiduploadimage/post/PetpetiduploadimagePostRequestBody.kt b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/petpetiduploadimage/post/PetpetiduploadimagePostRequestBody.kt new file mode 100644 index 00000000000..c116b828c24 --- /dev/null +++ b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/petpetiduploadimage/post/PetpetiduploadimagePostRequestBody.kt @@ -0,0 +1,49 @@ +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; +import org.openapijsonschematools.client.mediatype.MediaType; +import org.openapijsonschematools.client.paths.petpetiduploadimage.post.requestbody.content.multipartformdata.MultipartformdataSchema; + +import java.util.AbstractMap; +import java.util.Map; + +public class PetpetiduploadimagePostRequestBody { + public sealed interface SealedMediaType permits MultipartformdataMediaType {} + + public record MultipartformdataMediaType(MultipartformdataSchema.MultipartformdataSchema1 schema) implements SealedMediaType, MediaType { + public MultipartformdataMediaType() { + this(MultipartformdataSchema.MultipartformdataSchema1.getInstance()); + } + @Override + public Nothing? encoding() { + return null; + } + } + + public static class PetpetiduploadimagePostRequestBody1 extends RequestBodySerializer { + public PetpetiduploadimagePostRequestBody1() { + super( + Map.ofEntries( + new AbstractMap.SimpleEntry<>("multipart/form-data", new MultipartformdataMediaType()) + ), + false + ); + } + + public SerializedRequestBody serialize(SealedRequestBody requestBody) throws NotImplementedException { + MultipartformdataRequestBody requestBody0 = (MultipartformdataRequestBody) requestBody; + return serialize(requestBody0.contentType(), requestBody0.body().getData()); + } + } + + public sealed interface SealedRequestBody permits MultipartformdataRequestBody {} + public record MultipartformdataRequestBody(MultipartformdataSchema.MultipartformdataSchema1Boxed body) implements SealedRequestBody, GenericRequestBody { + @Override + public String contentType() { + return "multipart/form-data"; + } + } +} diff --git a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/petpetiduploadimage/post/PetpetiduploadimagePostResponses.kt b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/petpetiduploadimage/post/PetpetiduploadimagePostResponses.kt new file mode 100644 index 00000000000..ef9ecbb0b8a --- /dev/null +++ b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/petpetiduploadimage/post/PetpetiduploadimagePostResponses.kt @@ -0,0 +1,54 @@ +package org.openapijsonschematools.client.paths.petpetiduploadimage.post; + +import org.openapijsonschematools.client.paths.petpetiduploadimage.post.responses.PetpetiduploadimagePostCode200Response; +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; +import org.checkerframework.checker.nullness.qual.Nullable; + +import java.net.http.HttpResponse; +import java.util.Map; +import java.util.AbstractMap; + +public class PetpetiduploadimagePostResponses { + public sealed interface EndpointResponse permits EndpointPetpetiduploadimagePostCode200Response {} + + public record EndpointPetpetiduploadimagePostCode200Response( + HttpResponse response, + PetpetiduploadimagePostCode200Response.SealedResponseBody body, + SuccessWithJsonApiResponseHeadersSchema.SuccessWithJsonApiResponseHeadersSchemaMap headers + ) implements EndpointResponse, ApiResponse{ + } + + public sealed interface StatusCodeResponseDeserializer permits StatusPetpetiduploadimagePostCode200ResponseDeserializer {} + + public static final class StatusPetpetiduploadimagePostCode200ResponseDeserializer extends PetpetiduploadimagePostCode200Response.PetpetiduploadimagePostCode200Response1 implements StatusCodeResponseDeserializer { + } + + public static final class PetpetiduploadimagePostResponses1 implements ResponsesDeserializer { + private final Map statusCodeToResponseDeserializer; + public PetpetiduploadimagePostResponses1() { + this.statusCodeToResponseDeserializer = Map.ofEntries( + new AbstractMap.SimpleEntry<>("200", new StatusPetpetiduploadimagePostCode200ResponseDeserializer()) + ); + } + + 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) { + throw new ApiException( + "Invalid response statusCode="+statusCode+" has no response defined in the openapi document", + response + ); + } + StatusPetpetiduploadimagePostCode200ResponseDeserializer castDeserializer = (StatusPetpetiduploadimagePostCode200ResponseDeserializer) statusCodeDeserializer; + var deserializedResponse = castDeserializer.deserialize(response, configuration); + return new EndpointPetpetiduploadimagePostCode200Response(response, deserializedResponse.body(), deserializedResponse.headers()); + } + } +} diff --git a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/petpetiduploadimage/post/PetpetiduploadimagePostSecurityInfo.kt b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/petpetiduploadimage/post/PetpetiduploadimagePostSecurityInfo.kt new file mode 100644 index 00000000000..0418c7b90c0 --- /dev/null +++ b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/petpetiduploadimage/post/PetpetiduploadimagePostSecurityInfo.kt @@ -0,0 +1,24 @@ +package org.openapijsonschematools.client.paths.petpetiduploadimage.post; + +import org.openapijsonschematools.client.paths.petpetiduploadimage.post.security.PetpetiduploadimagePostSecurityRequirementObject0; +import org.openapijsonschematools.client.securityrequirementobjects.SecurityRequirementObject; +import org.openapijsonschematools.client.securityrequirementobjects.SecurityRequirementObjectProvider; + +public class PetpetiduploadimagePostSecurityInfo { + public static class PetpetiduploadimagePostSecurityInfo1 implements SecurityRequirementObjectProvider { + public final PetpetiduploadimagePostSecurityRequirementObject0 security0; + + public PetpetiduploadimagePostSecurityInfo1() { + security0 = new PetpetiduploadimagePostSecurityRequirementObject0(); + } + + @Override + public SecurityRequirementObject getSecurityRequirementObject(SecurityIndex securityIndex) { + return security0; + } + } + + public enum SecurityIndex { + SECURITY_0 + } +} \ No newline at end of file diff --git a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/petpetiduploadimage/post/parameters/Parameter0.kt b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/petpetiduploadimage/post/parameters/Parameter0.kt new file mode 100644 index 00000000000..e6002b4ec9d --- /dev/null +++ b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/petpetiduploadimage/post/parameters/Parameter0.kt @@ -0,0 +1,23 @@ +package org.openapijsonschematools.client.paths.petpetiduploadimage.post.parameters; + +import org.openapijsonschematools.client.parameter.ParameterStyle; +import org.openapijsonschematools.client.parameter.ParameterInType; +import org.openapijsonschematools.client.parameter.SchemaParameter; +import org.openapijsonschematools.client.paths.petpetiduploadimage.post.parameters.parameter0.Schema0; + +public class Parameter0 { + + public static class Parameter01 extends SchemaParameter { + public Parameter01() { + super( + "petId", + ParameterInType.PATH, + true, + ParameterStyle.SIMPLE, + false, + false, + Schema0.Schema01.getInstance() + ); + } + } +} diff --git a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/petpetiduploadimage/post/parameters/parameter0/Schema0.kt b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/petpetiduploadimage/post/parameters/parameter0/Schema0.kt new file mode 100644 index 00000000000..e314fe44ae4 --- /dev/null +++ b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/petpetiduploadimage/post/parameters/parameter0/Schema0.kt @@ -0,0 +1,19 @@ +package org.openapijsonschematools.client.paths.petpetiduploadimage.post.parameters.parameter0; +import org.checkerframework.checker.nullness.qual.Nullable; +import org.openapijsonschematools.client.schemas.Int64JsonSchema; + +public class Schema0 extends Int64JsonSchema { + // nest classes so all schemas and input/output classes can be public + + + public static class Schema01 extends Int64JsonSchema.Int64JsonSchema1 { + private static @Nullable Schema01 instance = null; + public static Schema01 getInstance() { + if (instance == null) { + instance = new Schema01(); + } + return instance; + } + } + +} diff --git a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/petpetiduploadimage/post/requestbody/content/multipartformdata/MultipartformdataSchema.kt b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/petpetiduploadimage/post/requestbody/content/multipartformdata/MultipartformdataSchema.kt new file mode 100644 index 00000000000..f4aef640a30 --- /dev/null +++ b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/petpetiduploadimage/post/requestbody/content/multipartformdata/MultipartformdataSchema.kt @@ -0,0 +1,239 @@ +package org.openapijsonschematools.client.paths.petpetiduploadimage.post.requestbody.content.multipartformdata; +import java.util.ArrayList; +import java.util.HashSet; +import java.util.LinkedHashMap; +import java.util.LinkedHashSet; +import java.util.List; +import java.util.Map; +import java.util.Objects; +import java.util.Set; +import org.checkerframework.checker.nullness.qual.Nullable; +import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags; +import org.openapijsonschematools.client.configurations.SchemaConfiguration; +import org.openapijsonschematools.client.exceptions.InvalidAdditionalPropertyException; +import org.openapijsonschematools.client.exceptions.UnsetPropertyException; +import org.openapijsonschematools.client.exceptions.ValidationException; +import org.openapijsonschematools.client.schemas.GenericBuilder; +import org.openapijsonschematools.client.schemas.StringJsonSchema; +import org.openapijsonschematools.client.schemas.UnsetAddPropsSetter; +import org.openapijsonschematools.client.schemas.validation.FrozenMap; +import org.openapijsonschematools.client.schemas.validation.JsonSchema; +import org.openapijsonschematools.client.schemas.validation.JsonSchemaInfo; +import org.openapijsonschematools.client.schemas.validation.MapSchemaValidator; +import org.openapijsonschematools.client.schemas.validation.PathToSchemasMap; +import org.openapijsonschematools.client.schemas.validation.PropertyEntry; +import org.openapijsonschematools.client.schemas.validation.ValidationMetadata; + +public class MultipartformdataSchema { + // nest classes so all schemas and input/output classes can be public + + + public static class MultipartformdataAdditionalMetadata extends StringJsonSchema.StringJsonSchema1 { + private static @Nullable MultipartformdataAdditionalMetadata instance = null; + public static MultipartformdataAdditionalMetadata getInstance() { + if (instance == null) { + instance = new MultipartformdataAdditionalMetadata(); + } + return instance; + } + } + + + public static class MultipartformdataFile extends StringJsonSchema.StringJsonSchema1 { + // BinarySchema + private static @Nullable MultipartformdataFile instance = null; + public static MultipartformdataFile getInstance() { + if (instance == null) { + instance = new MultipartformdataFile(); + } + return instance; + } + } + + + public static class MultipartformdataSchemaMap extends FrozenMap<@Nullable Object> { + protected MultipartformdataSchemaMap(FrozenMap<@Nullable Object> m) { + super(m); + } + public static final Set requiredKeys = Set.of(); + public static final Set optionalKeys = Set.of( + "additionalMetadata", + "file" + ); + public static MultipartformdataSchemaMap of(Map arg, SchemaConfiguration configuration) throws ValidationException { + return MultipartformdataSchema1.getInstance().validate(arg, configuration); + } + + public String additionalMetadata() throws UnsetPropertyException { + String key = "additionalMetadata"; + throwIfKeyNotPresent(key); + @Nullable Object value = get(key); + if (!(value instanceof String)) { + throw new RuntimeException("Invalid value stored for additionalMetadata"); + } + return (String) value; + } + + public String file() throws UnsetPropertyException { + String key = "file"; + throwIfKeyNotPresent(key); + @Nullable Object value = get(key); + if (!(value instanceof String)) { + throw new RuntimeException("Invalid value stored for file"); + } + return (String) value; + } + + public @Nullable Object getAdditionalProperty(String name) throws UnsetPropertyException, InvalidAdditionalPropertyException { + throwIfKeyKnown(name, requiredKeys, optionalKeys); + throwIfKeyNotPresent(name); + return get(name); + } + } + + public interface SetterForMultipartformdataAdditionalMetadata { + Map getInstance(); + T getBuilderAfterMultipartformdataAdditionalMetadata(Map instance); + + default T additionalMetadata(String value) { + var instance = getInstance(); + instance.put("additionalMetadata", value); + return getBuilderAfterMultipartformdataAdditionalMetadata(instance); + } + } + + public interface SetterForMultipartformdataFile { + Map getInstance(); + T getBuilderAfterMultipartformdataFile(Map instance); + + default T file(String value) { + var instance = getInstance(); + instance.put("file", value); + return getBuilderAfterMultipartformdataFile(instance); + } + } + + public static class MultipartformdataSchemaMapBuilder extends UnsetAddPropsSetter implements GenericBuilder>, SetterForMultipartformdataAdditionalMetadata, SetterForMultipartformdataFile { + private final Map instance; + private static final Set knownKeys = Set.of( + "additionalMetadata", + "file" + ); + public Set getKnownKeys() { + return knownKeys; + } + public MultipartformdataSchemaMapBuilder() { + this.instance = new LinkedHashMap<>(); + } + public Map build() { + return instance; + } + public Map getInstance() { + return instance; + } + public MultipartformdataSchemaMapBuilder getBuilderAfterMultipartformdataAdditionalMetadata(Map instance) { + return this; + } + public MultipartformdataSchemaMapBuilder getBuilderAfterMultipartformdataFile(Map instance) { + return this; + } + public MultipartformdataSchemaMapBuilder getBuilderAfterAdditionalProperty(Map instance) { + return this; + } + } + + + public sealed interface MultipartformdataSchema1Boxed permits MultipartformdataSchema1BoxedMap { + @Nullable Object getData(); + } + + public record MultipartformdataSchema1BoxedMap(MultipartformdataSchemaMap data) implements MultipartformdataSchema1Boxed { + @Override + public @Nullable Object getData() { + return data; + } + } + + + public static class MultipartformdataSchema1 extends JsonSchema implements MapSchemaValidator { + private static @Nullable MultipartformdataSchema1 instance = null; + + protected MultipartformdataSchema1() { + super(new JsonSchemaInfo() + .type(Set.of(Map.class)) + .properties(Map.ofEntries( + new PropertyEntry("additionalMetadata", MultipartformdataAdditionalMetadata.class), + new PropertyEntry("file", MultipartformdataFile.class) + )) + ); + } + + public static MultipartformdataSchema1 getInstance() { + if (instance == null) { + instance = new MultipartformdataSchema1(); + } + return instance; + } + + 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 RuntimeException("Invalid non-string key value"); + } + String propertyName = (String) entryKey; + List propertyPathToItem = new ArrayList<>(pathToItem); + propertyPathToItem.add(propertyName); + Object value = entry.getValue(); + LinkedHashMap, Nothing?> schemas = pathToSchemas.get(propertyPathToItem); + if (schemas == null) { + throw new RuntimeException("Validation result is invalid, schemas must exist for a pathToItem"); + } + JsonSchema propertySchema = schemas.entrySet().iterator().next().getKey(); + @Nullable Object propertyInstance = propertySchema.getNewInstance(value, propertyPathToItem, pathToSchemas); + properties.put(propertyName, propertyInstance); + } + FrozenMap<@Nullable Object> castProperties = new FrozenMap<>(properties); + return new MultipartformdataSchemaMap(castProperties); + } + + 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); + SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().build())); + ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, new PathToSchemasMap(), new LinkedHashSet<>()); + PathToSchemasMap pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet); + return getNewInstance(castArg, validationMetadata.pathToItem(), pathToSchemasMap); + } + + + @Override + public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws 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"); + } + @Override + public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { + if (arg instanceof Map) { + return getNewInstance((Map) arg, pathToItem, pathToSchemas); + } + 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 { + return new MultipartformdataSchema1BoxedMap(validate(arg, configuration)); + } + @Override + public MultipartformdataSchema1Boxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { + 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"); + } + } + +} diff --git a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/petpetiduploadimage/post/responses/PetpetiduploadimagePostCode200Response.kt b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/petpetiduploadimage/post/responses/PetpetiduploadimagePostCode200Response.kt new file mode 100644 index 00000000000..c597f9f42d7 --- /dev/null +++ b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/petpetiduploadimage/post/responses/PetpetiduploadimagePostCode200Response.kt @@ -0,0 +1,7 @@ +package org.openapijsonschematools.client.paths.petpetiduploadimage.post.responses; + +import org.openapijsonschematools.client.components.responses.SuccessWithJsonApiResponse; + +public class PetpetiduploadimagePostCode200Response extends SuccessWithJsonApiResponse { + public static class PetpetiduploadimagePostCode200Response1 extends SuccessWithJsonApiResponse1 {} +} diff --git a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/petpetiduploadimage/post/security/PetpetiduploadimagePostSecurityRequirementObject0.kt b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/petpetiduploadimage/post/security/PetpetiduploadimagePostSecurityRequirementObject0.kt new file mode 100644 index 00000000000..2a6e237ed37 --- /dev/null +++ b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/petpetiduploadimage/post/security/PetpetiduploadimagePostSecurityRequirementObject0.kt @@ -0,0 +1,24 @@ +package org.openapijsonschematools.client.paths.petpetiduploadimage.post.security; + +import org.checkerframework.checker.nullness.qual.Nullable; +import org.openapijsonschematools.client.securityrequirementobjects.SecurityRequirementObject; +import org.openapijsonschematools.client.securityschemes.SecurityScheme; +import org.openapijsonschematools.client.components.securityschemes.PetstoreAuth; + +import java.util.List; +import java.util.Map; +import java.util.AbstractMap; + +public class PetpetiduploadimagePostSecurityRequirementObject0 extends SecurityRequirementObject { + + public PetpetiduploadimagePostSecurityRequirementObject0() { + super( + Map.ofEntries( + new AbstractMap.SimpleEntry, List>( + PetstoreAuth.class, + List.of("write:pets", "read:pets") + ) + ) + ); + } +} diff --git a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/solidus/SolidusGet.kt b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/solidus/SolidusGet.kt new file mode 100644 index 00000000000..6d03a9384b5 --- /dev/null +++ b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/solidus/SolidusGet.kt @@ -0,0 +1,124 @@ +package org.openapijsonschematools.client.paths.solidus; + +import org.checkerframework.checker.nullness.qual.Nullable; +import org.openapijsonschematools.client.RootServerInfo; +import org.openapijsonschematools.client.paths.solidus.get.SolidusGetResponses; +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.paths.Solidus; + +import java.io.IOException; +import java.net.http.HttpClient; +import java.net.http.HttpRequest; +import java.time.Duration; +import java.util.List; +import java.util.Map; + +public class SolidusGet { + private static class GetProvider { + private static final String method = "get"; + + public static SolidusGetResponses.EndpointResponse get( + GetRequest request, + ApiConfiguration apiConfiguration, + SchemaConfiguration schemaConfiguration, + HttpClient client + ) 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 + @Nullable Map queryMap = null; + String host = apiConfiguration.getServer(request.serverIndex).url(); + + String url = host + Solidus.path; + var httpRequest = RestClient.getRequest( + url, + method, + bodyPublisher, + headers, + request.timeout + ); + var response = RestClient.getResponse(httpRequest, client); + var responsesDeserializer = new SolidusGetResponses.SolidusGetResponses1(); + return responsesDeserializer.deserialize(response, schemaConfiguration); + } + } + + public interface GetOperation { + ApiConfiguration getApiConfiguration(); + SchemaConfiguration getSchemaConfiguration(); + HttpClient getClient(); + default SolidusGetResponses.EndpointResponse get(GetRequest request) throws IOException, InterruptedException, ValidationException, NotImplementedException, ApiException { + return GetProvider.get(request, getApiConfiguration(), getSchemaConfiguration(), getClient()); + } + } + + public interface SlashRouteOperation { + ApiConfiguration getApiConfiguration(); + SchemaConfiguration getSchemaConfiguration(); + HttpClient getClient(); + default SolidusGetResponses.EndpointResponse slashRoute(GetRequest request) throws IOException, InterruptedException, ValidationException, NotImplementedException, ApiException { + return GetProvider.get(request, getApiConfiguration(), getSchemaConfiguration(), getClient()); + } + } + + public static class Get extends ApiClient implements GetOperation { + public Get(ApiConfiguration apiConfiguration, SchemaConfiguration schemaConfiguration) { + super(apiConfiguration, schemaConfiguration); + } + } + + public static class GetRequest { + public RootServerInfo.@Nullable ServerIndex serverIndex; + public @Nullable Duration timeout; + } + + public interface SetterForServerIndex { + GetRequest getInstance(); + T getBuilderAfterServerIndex(GetRequest instance); + default T serverIndex(RootServerInfo.ServerIndex serverIndex) { + var instance = getInstance(); + instance.serverIndex = serverIndex; + return getBuilderAfterServerIndex(instance); + } + } + + public interface SetterForTimeout { + GetRequest getInstance(); + T getBuilderAfterTimeout(GetRequest instance); + default T timeout(Duration timeout) { + var instance = getInstance(); + instance.timeout = timeout; + return getBuilderAfterTimeout(instance); + } + } + + public static class GetRequestBuilder implements SetterForServerIndex, SetterForTimeout { + private final GetRequest instance; + + public GetRequestBuilder() { + this.instance = new GetRequest(); + } + + public GetRequest build() { + return instance; + } + + public GetRequest getInstance() { + return instance; + } + + public GetRequestBuilder getBuilderAfterServerIndex(GetRequest instance) { + return this; + } + + public GetRequestBuilder getBuilderAfterTimeout(GetRequest instance) { + return this; + } + } +} diff --git a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/solidus/get/SolidusGetResponses.kt b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/solidus/get/SolidusGetResponses.kt new file mode 100644 index 00000000000..1e7023c2427 --- /dev/null +++ b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/solidus/get/SolidusGetResponses.kt @@ -0,0 +1,53 @@ +package org.openapijsonschematools.client.paths.solidus.get; + +import org.openapijsonschematools.client.paths.solidus.get.responses.SolidusGetCode200Response; +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; +import org.checkerframework.checker.nullness.qual.Nullable; + +import java.net.http.HttpResponse; +import java.util.Map; +import java.util.AbstractMap; + +public class SolidusGetResponses { + public sealed interface EndpointResponse permits EndpointSolidusGetCode200Response {} + + public record EndpointSolidusGetCode200Response( + HttpResponse response, + Nothing? body, + Nothing? headers + ) implements EndpointResponse, ApiResponse{ + } + + public sealed interface StatusCodeResponseDeserializer permits StatusSolidusGetCode200ResponseDeserializer {} + + public static final class StatusSolidusGetCode200ResponseDeserializer extends SolidusGetCode200Response.SolidusGetCode200Response1 implements StatusCodeResponseDeserializer { + } + + public static final class SolidusGetResponses1 implements ResponsesDeserializer { + private final Map statusCodeToResponseDeserializer; + public SolidusGetResponses1() { + this.statusCodeToResponseDeserializer = Map.ofEntries( + new AbstractMap.SimpleEntry<>("200", new StatusSolidusGetCode200ResponseDeserializer()) + ); + } + + 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) { + throw new ApiException( + "Invalid response statusCode="+statusCode+" has no response defined in the openapi document", + response + ); + } + StatusSolidusGetCode200ResponseDeserializer castDeserializer = (StatusSolidusGetCode200ResponseDeserializer) statusCodeDeserializer; + var deserializedResponse = castDeserializer.deserialize(response, configuration); + return new EndpointSolidusGetCode200Response(response, deserializedResponse.body(), deserializedResponse.headers()); + } + } +} diff --git a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/solidus/get/responses/SolidusGetCode200Response.kt b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/solidus/get/responses/SolidusGetCode200Response.kt new file mode 100644 index 00000000000..9560cc160dd --- /dev/null +++ b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/solidus/get/responses/SolidusGetCode200Response.kt @@ -0,0 +1,7 @@ +package org.openapijsonschematools.client.paths.solidus.get.responses; + +import org.openapijsonschematools.client.components.responses.SuccessDescriptionOnly; + +public class SolidusGetCode200Response extends SuccessDescriptionOnly { + public static class SolidusGetCode200Response1 extends SuccessDescriptionOnly1 {} +} diff --git a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/storeinventory/StoreinventoryGet.kt b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/storeinventory/StoreinventoryGet.kt new file mode 100644 index 00000000000..13cf7cda7a6 --- /dev/null +++ b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/storeinventory/StoreinventoryGet.kt @@ -0,0 +1,152 @@ +package org.openapijsonschematools.client.paths.storeinventory; + +import org.checkerframework.checker.nullness.qual.Nullable; +import org.openapijsonschematools.client.RootServerInfo; +import org.openapijsonschematools.client.paths.storeinventory.get.StoreinventoryGetSecurityInfo; +import org.openapijsonschematools.client.paths.storeinventory.get.StoreinventoryGetResponses; +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.paths.Storeinventory; +import org.openapijsonschematools.client.securityrequirementobjects.SecurityRequirementObject; +import org.openapijsonschematools.client.securityrequirementobjects.AuthApplier; + +import java.io.IOException; +import java.net.http.HttpClient; +import java.net.http.HttpRequest; +import java.time.Duration; +import java.util.List; +import java.util.Map; + +public class StoreinventoryGet { + private static class GetProvider extends AuthApplier { + private static final String method = "get"; + + public static StoreinventoryGetResponses.EndpointResponse get( + GetRequest request, + ApiConfiguration apiConfiguration, + SchemaConfiguration schemaConfiguration, + HttpClient client + ) 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 + @Nullable Map queryMap = null; + String host = apiConfiguration.getServer(request.serverIndex).url(); + SecurityRequirementObject securityRequirementObject = apiConfiguration.getSecurityRequirementObject(request.securityIndex); + updateParamsForAuth( + securityRequirementObject, + headers, + Storeinventory.path, + method, + bodyPublisher, + queryMap, + apiConfiguration + ); + + String url = host + Storeinventory.path; + var httpRequest = RestClient.getRequest( + url, + method, + bodyPublisher, + headers, + request.timeout + ); + var response = RestClient.getResponse(httpRequest, client); + var responsesDeserializer = new StoreinventoryGetResponses.StoreinventoryGetResponses1(); + return responsesDeserializer.deserialize(response, schemaConfiguration); + } + } + + public interface GetOperation { + ApiConfiguration getApiConfiguration(); + SchemaConfiguration getSchemaConfiguration(); + HttpClient getClient(); + default StoreinventoryGetResponses.EndpointResponse get(GetRequest request) throws IOException, InterruptedException, ValidationException, NotImplementedException, ApiException { + return GetProvider.get(request, getApiConfiguration(), getSchemaConfiguration(), getClient()); + } + } + + public interface GetInventoryOperation { + ApiConfiguration getApiConfiguration(); + SchemaConfiguration getSchemaConfiguration(); + HttpClient getClient(); + default StoreinventoryGetResponses.EndpointResponse getInventory(GetRequest request) throws IOException, InterruptedException, ValidationException, NotImplementedException, ApiException { + return GetProvider.get(request, getApiConfiguration(), getSchemaConfiguration(), getClient()); + } + } + + public static class Get extends ApiClient implements GetOperation { + public Get(ApiConfiguration apiConfiguration, SchemaConfiguration schemaConfiguration) { + super(apiConfiguration, schemaConfiguration); + } + } + + public static class GetRequest { + public RootServerInfo.@Nullable ServerIndex serverIndex; + public StoreinventoryGetSecurityInfo.@Nullable SecurityIndex securityIndex; + public @Nullable Duration timeout; + } + + public interface SetterForServerIndex { + GetRequest getInstance(); + T getBuilderAfterServerIndex(GetRequest instance); + default T serverIndex(RootServerInfo.ServerIndex serverIndex) { + var instance = getInstance(); + instance.serverIndex = serverIndex; + return getBuilderAfterServerIndex(instance); + } + } + + public interface SetterForSecurityIndex { + GetRequest getInstance(); + T getBuilderAfterSecurityIndex(GetRequest instance); + default T securityIndex(StoreinventoryGetSecurityInfo.SecurityIndex securityIndex) { + var instance = getInstance(); + instance.securityIndex = securityIndex; + return getBuilderAfterSecurityIndex(instance); + } + } + + public interface SetterForTimeout { + GetRequest getInstance(); + T getBuilderAfterTimeout(GetRequest instance); + default T timeout(Duration timeout) { + var instance = getInstance(); + instance.timeout = timeout; + return getBuilderAfterTimeout(instance); + } + } + + public static class GetRequestBuilder implements SetterForServerIndex, SetterForSecurityIndex, SetterForTimeout { + private final GetRequest instance; + + public GetRequestBuilder() { + this.instance = new GetRequest(); + } + + public GetRequest build() { + return instance; + } + + public GetRequest getInstance() { + return instance; + } + + public GetRequestBuilder getBuilderAfterServerIndex(GetRequest instance) { + return this; + } + + public GetRequestBuilder getBuilderAfterSecurityIndex(GetRequest instance) { + return this; + } + + public GetRequestBuilder getBuilderAfterTimeout(GetRequest instance) { + return this; + } + } +} diff --git a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/storeinventory/get/StoreinventoryGetResponses.kt b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/storeinventory/get/StoreinventoryGetResponses.kt new file mode 100644 index 00000000000..389cb0617a3 --- /dev/null +++ b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/storeinventory/get/StoreinventoryGetResponses.kt @@ -0,0 +1,54 @@ +package org.openapijsonschematools.client.paths.storeinventory.get; + +import org.openapijsonschematools.client.paths.storeinventory.get.responses.StoreinventoryGetCode200Response; +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; +import org.checkerframework.checker.nullness.qual.Nullable; + +import java.net.http.HttpResponse; +import java.util.Map; +import java.util.AbstractMap; + +public class StoreinventoryGetResponses { + public sealed interface EndpointResponse permits EndpointStoreinventoryGetCode200Response {} + + public record EndpointStoreinventoryGetCode200Response( + HttpResponse response, + StoreinventoryGetCode200Response.SealedResponseBody body, + SuccessInlineContentAndHeaderHeadersSchema.SuccessInlineContentAndHeaderHeadersSchemaMap headers + ) implements EndpointResponse, ApiResponse{ + } + + public sealed interface StatusCodeResponseDeserializer permits StatusStoreinventoryGetCode200ResponseDeserializer {} + + public static final class StatusStoreinventoryGetCode200ResponseDeserializer extends StoreinventoryGetCode200Response.StoreinventoryGetCode200Response1 implements StatusCodeResponseDeserializer { + } + + public static final class StoreinventoryGetResponses1 implements ResponsesDeserializer { + private final Map statusCodeToResponseDeserializer; + public StoreinventoryGetResponses1() { + this.statusCodeToResponseDeserializer = Map.ofEntries( + new AbstractMap.SimpleEntry<>("200", new StatusStoreinventoryGetCode200ResponseDeserializer()) + ); + } + + 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) { + throw new ApiException( + "Invalid response statusCode="+statusCode+" has no response defined in the openapi document", + response + ); + } + StatusStoreinventoryGetCode200ResponseDeserializer castDeserializer = (StatusStoreinventoryGetCode200ResponseDeserializer) statusCodeDeserializer; + var deserializedResponse = castDeserializer.deserialize(response, configuration); + return new EndpointStoreinventoryGetCode200Response(response, deserializedResponse.body(), deserializedResponse.headers()); + } + } +} diff --git a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/storeinventory/get/StoreinventoryGetSecurityInfo.kt b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/storeinventory/get/StoreinventoryGetSecurityInfo.kt new file mode 100644 index 00000000000..5c661cfd67c --- /dev/null +++ b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/storeinventory/get/StoreinventoryGetSecurityInfo.kt @@ -0,0 +1,24 @@ +package org.openapijsonschematools.client.paths.storeinventory.get; + +import org.openapijsonschematools.client.paths.storeinventory.get.security.StoreinventoryGetSecurityRequirementObject0; +import org.openapijsonschematools.client.securityrequirementobjects.SecurityRequirementObject; +import org.openapijsonschematools.client.securityrequirementobjects.SecurityRequirementObjectProvider; + +public class StoreinventoryGetSecurityInfo { + public static class StoreinventoryGetSecurityInfo1 implements SecurityRequirementObjectProvider { + public final StoreinventoryGetSecurityRequirementObject0 security0; + + public StoreinventoryGetSecurityInfo1() { + security0 = new StoreinventoryGetSecurityRequirementObject0(); + } + + @Override + public SecurityRequirementObject getSecurityRequirementObject(SecurityIndex securityIndex) { + return security0; + } + } + + public enum SecurityIndex { + SECURITY_0 + } +} \ No newline at end of file diff --git a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/storeinventory/get/responses/StoreinventoryGetCode200Response.kt b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/storeinventory/get/responses/StoreinventoryGetCode200Response.kt new file mode 100644 index 00000000000..16275bedfdf --- /dev/null +++ b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/storeinventory/get/responses/StoreinventoryGetCode200Response.kt @@ -0,0 +1,7 @@ +package org.openapijsonschematools.client.paths.storeinventory.get.responses; + +import org.openapijsonschematools.client.components.responses.SuccessInlineContentAndHeader; + +public class StoreinventoryGetCode200Response extends SuccessInlineContentAndHeader { + public static class StoreinventoryGetCode200Response1 extends SuccessInlineContentAndHeader1 {} +} diff --git a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/storeinventory/get/security/StoreinventoryGetSecurityRequirementObject0.kt b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/storeinventory/get/security/StoreinventoryGetSecurityRequirementObject0.kt new file mode 100644 index 00000000000..12e9ef453a2 --- /dev/null +++ b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/storeinventory/get/security/StoreinventoryGetSecurityRequirementObject0.kt @@ -0,0 +1,24 @@ +package org.openapijsonschematools.client.paths.storeinventory.get.security; + +import org.checkerframework.checker.nullness.qual.Nullable; +import org.openapijsonschematools.client.securityrequirementobjects.SecurityRequirementObject; +import org.openapijsonschematools.client.securityschemes.SecurityScheme; +import org.openapijsonschematools.client.components.securityschemes.ApiKey; + +import java.util.List; +import java.util.Map; +import java.util.AbstractMap; + +public class StoreinventoryGetSecurityRequirementObject0 extends SecurityRequirementObject { + + public StoreinventoryGetSecurityRequirementObject0() { + super( + Map.ofEntries( + new AbstractMap.SimpleEntry, List>( + ApiKey.class, + List.of() + ) + ) + ); + } +} diff --git a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/storeorder/StoreorderPost.kt b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/storeorder/StoreorderPost.kt new file mode 100644 index 00000000000..7a9de50a73b --- /dev/null +++ b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/storeorder/StoreorderPost.kt @@ -0,0 +1,183 @@ +package org.openapijsonschematools.client.paths.storeorder; + +import org.checkerframework.checker.nullness.qual.Nullable; +import org.openapijsonschematools.client.RootServerInfo; +import org.openapijsonschematools.client.paths.storeorder.post.StoreorderPostRequestBody; +import org.openapijsonschematools.client.paths.storeorder.post.StoreorderPostResponses; +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.requestbody.SerializedRequestBody; +import org.openapijsonschematools.client.paths.Storeorder; + +import java.io.IOException; +import java.util.ArrayList; +import java.net.http.HttpClient; +import java.net.http.HttpRequest; +import java.time.Duration; +import java.util.List; +import java.util.Map; + +public class StoreorderPost { + private static class PostProvider { + private static final String method = "post"; + + public static StoreorderPostResponses.EndpointResponse post( + PostRequest request, + ApiConfiguration apiConfiguration, + SchemaConfiguration schemaConfiguration, + HttpClient client + ) throws IOException, InterruptedException, ValidationException, NotImplementedException, ApiException { + Map> headers = apiConfiguration.getDefaultHeaders(); + + SerializedRequestBody serializedRequestBody = new StoreorderPostRequestBody.StoreorderPostRequestBody1().serialize( + request.requestBody + ); + var contentTypeHeaderValues = headers.getOrDefault("Content-Type", new ArrayList<>()); + contentTypeHeaderValues.add(serializedRequestBody.contentType); + HttpRequest.BodyPublisher bodyPublisher = serializedRequestBody.bodyPublisher; + // TODO set this to a map if there is a query security scheme + @Nullable Map queryMap = null; + String host = apiConfiguration.getServer(request.serverIndex).url(); + + String url = host + Storeorder.path; + var httpRequest = RestClient.getRequest( + url, + method, + bodyPublisher, + headers, + request.timeout + ); + var response = RestClient.getResponse(httpRequest, client); + var responsesDeserializer = new StoreorderPostResponses.StoreorderPostResponses1(); + return responsesDeserializer.deserialize(response, schemaConfiguration); + } + } + + public interface PostOperation { + ApiConfiguration getApiConfiguration(); + SchemaConfiguration getSchemaConfiguration(); + HttpClient getClient(); + default StoreorderPostResponses.EndpointResponse post(PostRequest request) throws IOException, InterruptedException, ValidationException, NotImplementedException, ApiException { + return PostProvider.post(request, getApiConfiguration(), getSchemaConfiguration(), getClient()); + } + } + + public interface PlaceOrderOperation { + ApiConfiguration getApiConfiguration(); + SchemaConfiguration getSchemaConfiguration(); + HttpClient getClient(); + default StoreorderPostResponses.EndpointResponse placeOrder(PostRequest request) throws IOException, InterruptedException, ValidationException, NotImplementedException, ApiException { + return PostProvider.post(request, getApiConfiguration(), getSchemaConfiguration(), getClient()); + } + } + + public static class Post extends ApiClient implements PostOperation { + public Post(ApiConfiguration apiConfiguration, SchemaConfiguration schemaConfiguration) { + super(apiConfiguration, schemaConfiguration); + } + } + + public static class PostRequest { + public StoreorderPostRequestBody.SealedRequestBody requestBody; + public RootServerInfo.@Nullable ServerIndex serverIndex; + public @Nullable Duration timeout; + + public PostRequest( + StoreorderPostRequestBody.SealedRequestBody requestBody, + RootServerInfo.@Nullable ServerIndex serverIndex, + @Nullable Duration timeout + ) { + this.requestBody = requestBody; + this.serverIndex = serverIndex; + this.timeout = timeout; + } + } + + public static class PostNullableRequest { + public StoreorderPostRequestBody.@Nullable SealedRequestBody requestBody; + public RootServerInfo.@Nullable ServerIndex serverIndex; + public @Nullable Duration timeout; + } + + public interface SetterForServerIndex { + PostNullableRequest getInstance(); + T getBuilderAfterServerIndex(PostNullableRequest instance); + default T serverIndex(RootServerInfo.ServerIndex serverIndex) { + var instance = getInstance(); + instance.serverIndex = serverIndex; + return getBuilderAfterServerIndex(instance); + } + } + + public interface SetterForTimeout { + PostNullableRequest getInstance(); + T getBuilderAfterTimeout(PostNullableRequest instance); + default T timeout(Duration timeout) { + var instance = getInstance(); + instance.timeout = timeout; + return getBuilderAfterTimeout(instance); + } + } + + public interface SetterForRequestBody { + PostNullableRequest getInstance(); + T getBuilderAfterRequestBody(PostNullableRequest instance); + default T requestBody(StoreorderPostRequestBody.SealedRequestBody requestBody) { + var instance = getInstance(); + instance.requestBody = requestBody; + return getBuilderAfterRequestBody(instance); + } + } + + public static class Post0RequestBuilder implements SetterForServerIndex, SetterForTimeout { + private final PostNullableRequest instance; + + public Post0RequestBuilder(PostNullableRequest instance) { + this.instance = instance; + } + + public PostRequest build() { + var requestBody = instance.requestBody; + if (requestBody == null) { + throw new RuntimeException("invalid null value for required parameter"); + } + return new PostRequest( + requestBody, + instance.serverIndex, + instance.timeout + ); + } + + public PostNullableRequest getInstance() { + return instance; + } + + public Post0RequestBuilder getBuilderAfterServerIndex(PostNullableRequest instance) { + return this; + } + + public Post0RequestBuilder getBuilderAfterTimeout(PostNullableRequest instance) { + return this; + } + } + public static class PostRequestBuilder implements SetterForRequestBody { + private final PostNullableRequest instance; + + public PostRequestBuilder() { + this.instance = new PostNullableRequest(); + } + + public PostNullableRequest getInstance() { + return instance; + } + + public Post0RequestBuilder getBuilderAfterRequestBody(PostNullableRequest instance) { + return new Post0RequestBuilder(instance); + } + } +} diff --git a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/storeorder/post/StoreorderPostRequestBody.kt b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/storeorder/post/StoreorderPostRequestBody.kt new file mode 100644 index 00000000000..a3d93353f38 --- /dev/null +++ b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/storeorder/post/StoreorderPostRequestBody.kt @@ -0,0 +1,49 @@ +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; +import org.openapijsonschematools.client.mediatype.MediaType; +import org.openapijsonschematools.client.paths.storeorder.post.requestbody.content.applicationjson.ApplicationjsonSchema; + +import java.util.AbstractMap; +import java.util.Map; + +public class StoreorderPostRequestBody { + public sealed interface SealedMediaType permits ApplicationjsonMediaType {} + + public record ApplicationjsonMediaType(ApplicationjsonSchema.ApplicationjsonSchema1 schema) implements SealedMediaType, MediaType { + public ApplicationjsonMediaType() { + this(ApplicationjsonSchema.ApplicationjsonSchema1.getInstance()); + } + @Override + public Nothing? encoding() { + return null; + } + } + + public static class StoreorderPostRequestBody1 extends RequestBodySerializer { + public StoreorderPostRequestBody1() { + super( + Map.ofEntries( + new AbstractMap.SimpleEntry<>("application/json", new ApplicationjsonMediaType()) + ), + true + ); + } + + public SerializedRequestBody serialize(SealedRequestBody requestBody) throws NotImplementedException { + ApplicationjsonRequestBody requestBody0 = (ApplicationjsonRequestBody) requestBody; + return serialize(requestBody0.contentType(), requestBody0.body().getData()); + } + } + + public sealed interface SealedRequestBody permits ApplicationjsonRequestBody {} + public record ApplicationjsonRequestBody(ApplicationjsonSchema.Order1Boxed body) implements SealedRequestBody, GenericRequestBody { + @Override + public String contentType() { + return "application/json"; + } + } +} diff --git a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/storeorder/post/StoreorderPostResponses.kt b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/storeorder/post/StoreorderPostResponses.kt new file mode 100644 index 00000000000..da6cecf09e8 --- /dev/null +++ b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/storeorder/post/StoreorderPostResponses.kt @@ -0,0 +1,66 @@ +package org.openapijsonschematools.client.paths.storeorder.post; + +import org.openapijsonschematools.client.paths.storeorder.post.responses.StoreorderPostCode200Response; +import org.openapijsonschematools.client.paths.storeorder.post.responses.StoreorderPostCode400Response; +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; +import org.checkerframework.checker.nullness.qual.Nullable; + +import java.net.http.HttpResponse; +import java.util.Map; +import java.util.AbstractMap; + +public class StoreorderPostResponses { + public sealed interface EndpointResponse permits EndpointStoreorderPostCode200Response {} + + public record EndpointStoreorderPostCode200Response( + HttpResponse response, + StoreorderPostCode200Response.SealedResponseBody body, + Nothing? headers + ) implements EndpointResponse, ApiResponse{ + } + + public sealed interface StatusCodeResponseDeserializer permits StatusStoreorderPostCode200ResponseDeserializer, StatusStoreorderPostCode400ResponseDeserializer {} + + public static final class StatusStoreorderPostCode200ResponseDeserializer extends StoreorderPostCode200Response.StoreorderPostCode200Response1 implements StatusCodeResponseDeserializer { + } + public static final class StatusStoreorderPostCode400ResponseDeserializer extends StoreorderPostCode400Response.StoreorderPostCode400Response1 implements StatusCodeResponseDeserializer { + } + + public static final class StoreorderPostResponses1 implements ResponsesDeserializer { + private final Map statusCodeToResponseDeserializer; + public StoreorderPostResponses1() { + this.statusCodeToResponseDeserializer = Map.ofEntries( + new AbstractMap.SimpleEntry<>("200", new StatusStoreorderPostCode200ResponseDeserializer()), + new AbstractMap.SimpleEntry<>("400", new StatusStoreorderPostCode400ResponseDeserializer()) + ); + } + + 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) { + throw new ApiException( + "Invalid response statusCode="+statusCode+" has no response defined in the openapi document", + response + ); + } + if (statusCodeDeserializer instanceof StatusStoreorderPostCode200ResponseDeserializer castDeserializer) { + var deserializedResponse = castDeserializer.deserialize(response, configuration); + return new EndpointStoreorderPostCode200Response(response, deserializedResponse.body(), deserializedResponse.headers()); + } else { + StatusStoreorderPostCode400ResponseDeserializer castDeserializer = (StatusStoreorderPostCode400ResponseDeserializer) statusCodeDeserializer; + var deserializedResponse = castDeserializer.deserialize(response, configuration); + throw new StoreorderPostCode400Response.ResponseApiException( + "Received error statusCode response from server", + response, + deserializedResponse + ); + } + } + } +} diff --git a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/storeorder/post/requestbody/content/applicationjson/ApplicationjsonSchema.kt b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/storeorder/post/requestbody/content/applicationjson/ApplicationjsonSchema.kt new file mode 100644 index 00000000000..acc568b81b4 --- /dev/null +++ b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/storeorder/post/requestbody/content/applicationjson/ApplicationjsonSchema.kt @@ -0,0 +1,19 @@ +package org.openapijsonschematools.client.paths.storeorder.post.requestbody.content.applicationjson; + +import org.checkerframework.checker.nullness.qual.Nullable; +import org.openapijsonschematools.client.components.schemas.Order; + +public class ApplicationjsonSchema extends Order { + // $refed class + + + public static class ApplicationjsonSchema1 extends Order1 { + private static @Nullable ApplicationjsonSchema1 instance = null; + public static ApplicationjsonSchema1 getInstance() { + if (instance == null) { + instance = new ApplicationjsonSchema1(); + } + return instance; + } + } +} diff --git a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/storeorder/post/responses/StoreorderPostCode200Response.kt b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/storeorder/post/responses/StoreorderPostCode200Response.kt new file mode 100644 index 00000000000..7fd2a8dac2e --- /dev/null +++ b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/storeorder/post/responses/StoreorderPostCode200Response.kt @@ -0,0 +1,81 @@ +package org.openapijsonschematools.client.paths.storeorder.post.responses; + +import org.openapijsonschematools.client.configurations.SchemaConfiguration; +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; + +import java.util.AbstractMap; +import java.util.Map; +import java.net.http.HttpResponse; +import java.net.http.HttpHeaders; + +public class StoreorderPostCode200Response { + public sealed interface SealedMediaType permits ApplicationxmlMediaType, ApplicationjsonMediaType {} + + public record ApplicationxmlMediaType(ApplicationxmlSchema.ApplicationxmlSchema1 schema) implements SealedMediaType, MediaType { + public ApplicationxmlMediaType() { + this(ApplicationxmlSchema.ApplicationxmlSchema1.getInstance()); + } + @Override + public Nothing? encoding() { + return null; + } + } + + public record ApplicationjsonMediaType(ApplicationjsonSchema.ApplicationjsonSchema1 schema) implements SealedMediaType, MediaType { + public ApplicationjsonMediaType() { + this(ApplicationjsonSchema.ApplicationjsonSchema1.getInstance()); + } + @Override + public Nothing? encoding() { + return null; + } + } + public sealed interface SealedResponseBody permits ApplicationxmlResponseBody, ApplicationjsonResponseBody {} + public record ApplicationxmlResponseBody(ApplicationxmlSchema.Order1Boxed body) implements SealedResponseBody { } + public record ApplicationjsonResponseBody(ApplicationjsonSchema.Order1Boxed body) implements SealedResponseBody { } + + public static class StoreorderPostCode200Response1 extends ResponseDeserializer { + public StoreorderPostCode200Response1() { + super( + Map.ofEntries( + new AbstractMap.SimpleEntry<>("application/xml", new ApplicationxmlMediaType()), + new AbstractMap.SimpleEntry<>("application/json", new ApplicationjsonMediaType()) + ) + ); + } + + @Override + 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 { + ApplicationjsonMediaType thisMediaType = (ApplicationjsonMediaType) mediaType; + var deserializedBody = deserializeBody(contentType, body, thisMediaType.schema(), configuration); + return new ApplicationjsonResponseBody(deserializedBody); + } + } + + @Override + protected Nothing? getHeaders(HttpHeaders headers, SchemaConfiguration configuration) { + return null; + } + } + + @SuppressWarnings("serial") + public static class ResponseApiException extends ApiException { + public DeserializedHttpResponse deserializedResponse; + + public ResponseApiException(String s, HttpResponse response, DeserializedHttpResponse deserializedResponse) { + super(s, response); + this.deserializedResponse = deserializedResponse; + } + } +} diff --git a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/storeorder/post/responses/StoreorderPostCode400Response.kt b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/storeorder/post/responses/StoreorderPostCode400Response.kt new file mode 100644 index 00000000000..38442a7d50e --- /dev/null +++ b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/storeorder/post/responses/StoreorderPostCode400Response.kt @@ -0,0 +1,45 @@ +package org.openapijsonschematools.client.paths.storeorder.post.responses; + +import org.openapijsonschematools.client.configurations.SchemaConfiguration; +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; +import java.net.http.HttpResponse; +import java.net.http.HttpHeaders; + +public class StoreorderPostCode400Response { + + public static class StoreorderPostCode400Response1 extends ResponseDeserializer { + public StoreorderPostCode400Response1() { + super( + MapUtils.makeMap( + ) + ); + } + + @Override + protected Nothing? getBody(String contentType, Nothing? mediaType, byte[] body, SchemaConfiguration configuration) { + return null; + } + + @Override + protected Nothing? getHeaders(HttpHeaders headers, SchemaConfiguration configuration) { + return null; + } + } + + @SuppressWarnings("serial") + public static class ResponseApiException extends ApiException { + public DeserializedHttpResponse deserializedResponse; + + public ResponseApiException(String s, HttpResponse response, DeserializedHttpResponse deserializedResponse) { + super(s, response); + this.deserializedResponse = deserializedResponse; + } + } +} diff --git a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/storeorder/post/responses/code200response/content/applicationjson/ApplicationjsonSchema.kt b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/storeorder/post/responses/code200response/content/applicationjson/ApplicationjsonSchema.kt new file mode 100644 index 00000000000..c7b1d3035af --- /dev/null +++ b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/storeorder/post/responses/code200response/content/applicationjson/ApplicationjsonSchema.kt @@ -0,0 +1,19 @@ +package org.openapijsonschematools.client.paths.storeorder.post.responses.code200response.content.applicationjson; + +import org.checkerframework.checker.nullness.qual.Nullable; +import org.openapijsonschematools.client.components.schemas.Order; + +public class ApplicationjsonSchema extends Order { + // $refed class + + + public static class ApplicationjsonSchema1 extends Order1 { + private static @Nullable ApplicationjsonSchema1 instance = null; + public static ApplicationjsonSchema1 getInstance() { + if (instance == null) { + instance = new ApplicationjsonSchema1(); + } + return instance; + } + } +} diff --git a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/storeorder/post/responses/code200response/content/applicationxml/ApplicationxmlSchema.kt b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/storeorder/post/responses/code200response/content/applicationxml/ApplicationxmlSchema.kt new file mode 100644 index 00000000000..d0a1692555b --- /dev/null +++ b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/storeorder/post/responses/code200response/content/applicationxml/ApplicationxmlSchema.kt @@ -0,0 +1,19 @@ +package org.openapijsonschematools.client.paths.storeorder.post.responses.code200response.content.applicationxml; + +import org.checkerframework.checker.nullness.qual.Nullable; +import org.openapijsonschematools.client.components.schemas.Order; + +public class ApplicationxmlSchema extends Order { + // $refed class + + + public static class ApplicationxmlSchema1 extends Order1 { + private static @Nullable ApplicationxmlSchema1 instance = null; + public static ApplicationxmlSchema1 getInstance() { + if (instance == null) { + instance = new ApplicationxmlSchema1(); + } + return instance; + } + } +} diff --git a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/storeorderorderid/StoreorderorderidDelete.kt b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/storeorderorderid/StoreorderorderidDelete.kt new file mode 100644 index 00000000000..a75520d87a8 --- /dev/null +++ b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/storeorderorderid/StoreorderorderidDelete.kt @@ -0,0 +1,178 @@ +package org.openapijsonschematools.client.paths.storeorderorderid; + +import org.checkerframework.checker.nullness.qual.Nullable; +import org.openapijsonschematools.client.RootServerInfo; +import org.openapijsonschematools.client.paths.storeorderorderid.delete.StoreorderorderidDeletePathParameters; +import org.openapijsonschematools.client.paths.storeorderorderid.delete.Parameters; +import org.openapijsonschematools.client.paths.storeorderorderid.delete.StoreorderorderidDeleteResponses; +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.paths.Storeorderorderid; + +import java.io.IOException; +import java.net.http.HttpClient; +import java.net.http.HttpRequest; +import java.time.Duration; +import java.util.List; +import java.util.Map; + +public class StoreorderorderidDelete { + private static class DeleteProvider { + private static final String method = "delete"; + + public static Nothing? delete( + DeleteRequest request, + ApiConfiguration apiConfiguration, + SchemaConfiguration schemaConfiguration, + HttpClient client + ) throws IOException, InterruptedException, ValidationException, NotImplementedException, ApiException { + Map> headers = apiConfiguration.getDefaultHeaders(); + HttpRequest.BodyPublisher bodyPublisher = HttpRequest.BodyPublishers.noBody(); + + var pathSerializer = new Parameters.PathParametersSerializer(); + String updatedPath = pathSerializer.serialize(request.pathParameters, Storeorderorderid.path); + // TODO set this to a map if there is a query security scheme + @Nullable Map queryMap = null; + String host = apiConfiguration.getServer(request.serverIndex).url(); + + String url = host + updatedPath; + var httpRequest = RestClient.getRequest( + url, + method, + bodyPublisher, + headers, + request.timeout + ); + var response = RestClient.getResponse(httpRequest, client); + return (Nothing?) null; + } + } + + public interface DeleteOperation { + ApiConfiguration getApiConfiguration(); + SchemaConfiguration getSchemaConfiguration(); + HttpClient getClient(); + default Nothing? delete(DeleteRequest request) throws IOException, InterruptedException, ValidationException, NotImplementedException, ApiException { + return DeleteProvider.delete(request, getApiConfiguration(), getSchemaConfiguration(), getClient()); + } + } + + public interface DeleteOrderOperation { + ApiConfiguration getApiConfiguration(); + SchemaConfiguration getSchemaConfiguration(); + HttpClient getClient(); + default Nothing? deleteOrder(DeleteRequest request) throws IOException, InterruptedException, ValidationException, NotImplementedException, ApiException { + return DeleteProvider.delete(request, getApiConfiguration(), getSchemaConfiguration(), getClient()); + } + } + + public static class Delete extends ApiClient implements DeleteOperation { + public Delete(ApiConfiguration apiConfiguration, SchemaConfiguration schemaConfiguration) { + super(apiConfiguration, schemaConfiguration); + } + } + + public static class DeleteRequest { + public StoreorderorderidDeletePathParameters.PathParametersMap pathParameters; + public RootServerInfo.@Nullable ServerIndex serverIndex; + public @Nullable Duration timeout; + + public DeleteRequest( + StoreorderorderidDeletePathParameters.PathParametersMap pathParameters, + RootServerInfo.@Nullable ServerIndex serverIndex, + @Nullable Duration timeout + ) { + this.pathParameters = pathParameters; + this.serverIndex = serverIndex; + this.timeout = timeout; + } + } + + public static class DeleteNullableRequest { + public StoreorderorderidDeletePathParameters.@Nullable PathParametersMap pathParameters; + public RootServerInfo.@Nullable ServerIndex serverIndex; + public @Nullable Duration timeout; + } + + public interface SetterForServerIndex { + DeleteNullableRequest getInstance(); + T getBuilderAfterServerIndex(DeleteNullableRequest instance); + default T serverIndex(RootServerInfo.ServerIndex serverIndex) { + var instance = getInstance(); + instance.serverIndex = serverIndex; + return getBuilderAfterServerIndex(instance); + } + } + + public interface SetterForTimeout { + DeleteNullableRequest getInstance(); + T getBuilderAfterTimeout(DeleteNullableRequest instance); + default T timeout(Duration timeout) { + var instance = getInstance(); + instance.timeout = timeout; + return getBuilderAfterTimeout(instance); + } + } + + public interface SetterForPathParameters { + DeleteNullableRequest getInstance(); + T getBuilderAfterPathParameters(DeleteNullableRequest instance); + default T pathParameters(StoreorderorderidDeletePathParameters.PathParametersMap pathParameters) { + var instance = getInstance(); + instance.pathParameters = pathParameters; + return getBuilderAfterPathParameters(instance); + } + } + + public static class Delete0RequestBuilder implements SetterForServerIndex, SetterForTimeout { + private final DeleteNullableRequest instance; + + public Delete0RequestBuilder(DeleteNullableRequest instance) { + this.instance = instance; + } + + public DeleteRequest build() { + var pathParameters = instance.pathParameters; + if (pathParameters == null) { + throw new RuntimeException("invalid null value for required parameter"); + } + return new DeleteRequest( + pathParameters, + instance.serverIndex, + instance.timeout + ); + } + + public DeleteNullableRequest getInstance() { + return instance; + } + + public Delete0RequestBuilder getBuilderAfterServerIndex(DeleteNullableRequest instance) { + return this; + } + + public Delete0RequestBuilder getBuilderAfterTimeout(DeleteNullableRequest instance) { + return this; + } + } + public static class DeleteRequestBuilder implements SetterForPathParameters { + private final DeleteNullableRequest instance; + + public DeleteRequestBuilder() { + this.instance = new DeleteNullableRequest(); + } + + public DeleteNullableRequest getInstance() { + return instance; + } + + public Delete0RequestBuilder getBuilderAfterPathParameters(DeleteNullableRequest instance) { + return new Delete0RequestBuilder(instance); + } + } +} diff --git a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/storeorderorderid/StoreorderorderidGet.kt b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/storeorderorderid/StoreorderorderidGet.kt new file mode 100644 index 00000000000..e7b57253441 --- /dev/null +++ b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/storeorderorderid/StoreorderorderidGet.kt @@ -0,0 +1,179 @@ +package org.openapijsonschematools.client.paths.storeorderorderid; + +import org.checkerframework.checker.nullness.qual.Nullable; +import org.openapijsonschematools.client.RootServerInfo; +import org.openapijsonschematools.client.paths.storeorderorderid.get.StoreorderorderidGetPathParameters; +import org.openapijsonschematools.client.paths.storeorderorderid.get.Parameters; +import org.openapijsonschematools.client.paths.storeorderorderid.get.StoreorderorderidGetResponses; +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.paths.Storeorderorderid; + +import java.io.IOException; +import java.net.http.HttpClient; +import java.net.http.HttpRequest; +import java.time.Duration; +import java.util.List; +import java.util.Map; + +public class StoreorderorderidGet { + private static class GetProvider { + private static final String method = "get"; + + public static StoreorderorderidGetResponses.EndpointResponse get( + GetRequest request, + ApiConfiguration apiConfiguration, + SchemaConfiguration schemaConfiguration, + HttpClient client + ) throws IOException, InterruptedException, ValidationException, NotImplementedException, ApiException { + Map> headers = apiConfiguration.getDefaultHeaders(); + HttpRequest.BodyPublisher bodyPublisher = HttpRequest.BodyPublishers.noBody(); + + var pathSerializer = new Parameters.PathParametersSerializer(); + String updatedPath = pathSerializer.serialize(request.pathParameters, Storeorderorderid.path); + // TODO set this to a map if there is a query security scheme + @Nullable Map queryMap = null; + String host = apiConfiguration.getServer(request.serverIndex).url(); + + String url = host + updatedPath; + var httpRequest = RestClient.getRequest( + url, + method, + bodyPublisher, + headers, + request.timeout + ); + var response = RestClient.getResponse(httpRequest, client); + var responsesDeserializer = new StoreorderorderidGetResponses.StoreorderorderidGetResponses1(); + return responsesDeserializer.deserialize(response, schemaConfiguration); + } + } + + public interface GetOperation { + ApiConfiguration getApiConfiguration(); + SchemaConfiguration getSchemaConfiguration(); + HttpClient getClient(); + default StoreorderorderidGetResponses.EndpointResponse get(GetRequest request) throws IOException, InterruptedException, ValidationException, NotImplementedException, ApiException { + return GetProvider.get(request, getApiConfiguration(), getSchemaConfiguration(), getClient()); + } + } + + public interface GetOrderByIdOperation { + ApiConfiguration getApiConfiguration(); + SchemaConfiguration getSchemaConfiguration(); + HttpClient getClient(); + default StoreorderorderidGetResponses.EndpointResponse getOrderById(GetRequest request) throws IOException, InterruptedException, ValidationException, NotImplementedException, ApiException { + return GetProvider.get(request, getApiConfiguration(), getSchemaConfiguration(), getClient()); + } + } + + public static class Get extends ApiClient implements GetOperation { + public Get(ApiConfiguration apiConfiguration, SchemaConfiguration schemaConfiguration) { + super(apiConfiguration, schemaConfiguration); + } + } + + public static class GetRequest { + public StoreorderorderidGetPathParameters.PathParametersMap pathParameters; + public RootServerInfo.@Nullable ServerIndex serverIndex; + public @Nullable Duration timeout; + + public GetRequest( + StoreorderorderidGetPathParameters.PathParametersMap pathParameters, + RootServerInfo.@Nullable ServerIndex serverIndex, + @Nullable Duration timeout + ) { + this.pathParameters = pathParameters; + this.serverIndex = serverIndex; + this.timeout = timeout; + } + } + + public static class GetNullableRequest { + public StoreorderorderidGetPathParameters.@Nullable PathParametersMap pathParameters; + public RootServerInfo.@Nullable ServerIndex serverIndex; + public @Nullable Duration timeout; + } + + public interface SetterForServerIndex { + GetNullableRequest getInstance(); + T getBuilderAfterServerIndex(GetNullableRequest instance); + default T serverIndex(RootServerInfo.ServerIndex serverIndex) { + var instance = getInstance(); + instance.serverIndex = serverIndex; + return getBuilderAfterServerIndex(instance); + } + } + + public interface SetterForTimeout { + GetNullableRequest getInstance(); + T getBuilderAfterTimeout(GetNullableRequest instance); + default T timeout(Duration timeout) { + var instance = getInstance(); + instance.timeout = timeout; + return getBuilderAfterTimeout(instance); + } + } + + public interface SetterForPathParameters { + GetNullableRequest getInstance(); + T getBuilderAfterPathParameters(GetNullableRequest instance); + default T pathParameters(StoreorderorderidGetPathParameters.PathParametersMap pathParameters) { + var instance = getInstance(); + instance.pathParameters = pathParameters; + return getBuilderAfterPathParameters(instance); + } + } + + public static class Get0RequestBuilder implements SetterForServerIndex, SetterForTimeout { + private final GetNullableRequest instance; + + public Get0RequestBuilder(GetNullableRequest instance) { + this.instance = instance; + } + + public GetRequest build() { + var pathParameters = instance.pathParameters; + if (pathParameters == null) { + throw new RuntimeException("invalid null value for required parameter"); + } + return new GetRequest( + pathParameters, + instance.serverIndex, + instance.timeout + ); + } + + public GetNullableRequest getInstance() { + return instance; + } + + public Get0RequestBuilder getBuilderAfterServerIndex(GetNullableRequest instance) { + return this; + } + + public Get0RequestBuilder getBuilderAfterTimeout(GetNullableRequest instance) { + return this; + } + } + public static class GetRequestBuilder implements SetterForPathParameters { + private final GetNullableRequest instance; + + public GetRequestBuilder() { + this.instance = new GetNullableRequest(); + } + + public GetNullableRequest getInstance() { + return instance; + } + + public Get0RequestBuilder getBuilderAfterPathParameters(GetNullableRequest instance) { + return new Get0RequestBuilder(instance); + } + } +} diff --git a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/storeorderorderid/delete/Parameters.kt b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/storeorderorderid/delete/Parameters.kt new file mode 100644 index 00000000000..be0db492e8e --- /dev/null +++ b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/storeorderorderid/delete/Parameters.kt @@ -0,0 +1,20 @@ +package org.openapijsonschematools.client.paths.storeorderorderid.delete; + +import org.openapijsonschematools.client.paths.storeorderorderid.delete.parameters.Parameter0; +import org.openapijsonschematools.client.parameter.PathSerializer; + +import java.util.Map; +import java.util.AbstractMap; + +public class Parameters { + + public static class PathParametersSerializer extends PathSerializer { + public PathParametersSerializer() { + super( + Map.ofEntries( + new AbstractMap.SimpleEntry<>("order_id", new Parameter0.Parameter01()) + ) + ); + } + } +} diff --git a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/storeorderorderid/delete/StoreorderorderidDeletePathParameters.kt b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/storeorderorderid/delete/StoreorderorderidDeletePathParameters.kt new file mode 100644 index 00000000000..44b4f774faa --- /dev/null +++ b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/storeorderorderid/delete/StoreorderorderidDeletePathParameters.kt @@ -0,0 +1,205 @@ +package org.openapijsonschematools.client.paths.storeorderorderid.delete; +import java.util.ArrayList; +import java.util.HashSet; +import java.util.LinkedHashMap; +import java.util.LinkedHashSet; +import java.util.List; +import java.util.Map; +import java.util.Objects; +import java.util.Set; +import org.checkerframework.checker.nullness.qual.Nullable; +import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags; +import org.openapijsonschematools.client.configurations.SchemaConfiguration; +import org.openapijsonschematools.client.exceptions.UnsetPropertyException; +import org.openapijsonschematools.client.exceptions.ValidationException; +import org.openapijsonschematools.client.paths.storeorderorderid.delete.parameters.parameter0.Schema0; +import org.openapijsonschematools.client.schemas.AnyTypeJsonSchema; +import org.openapijsonschematools.client.schemas.GenericBuilder; +import org.openapijsonschematools.client.schemas.NotAnyTypeJsonSchema; +import org.openapijsonschematools.client.schemas.validation.FrozenMap; +import org.openapijsonschematools.client.schemas.validation.JsonSchema; +import org.openapijsonschematools.client.schemas.validation.JsonSchemaInfo; +import org.openapijsonschematools.client.schemas.validation.MapSchemaValidator; +import org.openapijsonschematools.client.schemas.validation.MapUtils; +import org.openapijsonschematools.client.schemas.validation.PathToSchemasMap; +import org.openapijsonschematools.client.schemas.validation.PropertyEntry; +import org.openapijsonschematools.client.schemas.validation.ValidationMetadata; + +public class StoreorderorderidDeletePathParameters { + // nest classes so all schemas and input/output classes can be public + + + public static class AdditionalProperties extends NotAnyTypeJsonSchema.NotAnyTypeJsonSchema1 { + // NotAnyTypeSchema + private static @Nullable AdditionalProperties instance = null; + public static AdditionalProperties getInstance() { + if (instance == null) { + instance = new AdditionalProperties(); + } + return instance; + } + } + + + public static class PathParametersMap extends FrozenMap { + protected PathParametersMap(FrozenMap m) { + super(m); + } + public static final Set requiredKeys = Set.of( + "order_id" + ); + public static final Set optionalKeys = Set.of(); + public static PathParametersMap of(Map arg, SchemaConfiguration configuration) throws ValidationException { + return StoreorderorderidDeletePathParameters1.getInstance().validate(arg, configuration); + } + + public String order_id() { + try { + return getOrThrow("version"); + } catch (UnsetPropertyException e) { + throw new RuntimeException(e); + } + } + } + + public interface SetterForOrderId { + Map getInstance(); + T getBuilderAfterOrderId(Map instance); + + default T order_id(String value) { + var instance = getInstance(); + instance.put("order_id", value); + return getBuilderAfterOrderId(instance); + } + } + + public static class PathParametersMap0Builder implements GenericBuilder> { + private final Map instance; + private static final Set knownKeys = Set.of( + "order_id" + ); + public Set getKnownKeys() { + return knownKeys; + } + public PathParametersMap0Builder(Map instance) { + this.instance = instance; + } + public Map build() { + return instance; + } + } + + public static class PathParametersMapBuilder implements SetterForOrderId { + private final Map instance; + public PathParametersMapBuilder() { + this.instance = new LinkedHashMap<>(); + } + public Map getInstance() { + return instance; + } + public PathParametersMap0Builder getBuilderAfterOrderId(Map instance) { + return new PathParametersMap0Builder(instance); + } + } + + + public sealed interface StoreorderorderidDeletePathParameters1Boxed permits StoreorderorderidDeletePathParameters1BoxedMap { + @Nullable Object getData(); + } + + public record StoreorderorderidDeletePathParameters1BoxedMap(PathParametersMap data) implements StoreorderorderidDeletePathParameters1Boxed { + @Override + public @Nullable Object getData() { + return data; + } + } + + + public static class StoreorderorderidDeletePathParameters1 extends JsonSchema implements MapSchemaValidator { + private static @Nullable StoreorderorderidDeletePathParameters1 instance = null; + + protected StoreorderorderidDeletePathParameters1() { + super(new JsonSchemaInfo() + .type(Set.of(Map.class)) + .properties(Map.ofEntries( + new PropertyEntry("order_id", Schema0.Schema01.class) + )) + .required(Set.of( + "order_id" + )) + .additionalProperties(AdditionalProperties.class) + ); + } + + public static StoreorderorderidDeletePathParameters1 getInstance() { + if (instance == null) { + instance = new StoreorderorderidDeletePathParameters1(); + } + return instance; + } + + 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 RuntimeException("Invalid non-string key value"); + } + String propertyName = (String) entryKey; + List propertyPathToItem = new ArrayList<>(pathToItem); + propertyPathToItem.add(propertyName); + Object value = entry.getValue(); + LinkedHashMap, Nothing?> schemas = pathToSchemas.get(propertyPathToItem); + if (schemas == null) { + throw new RuntimeException("Validation 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"); + } + properties.put(propertyName, (String) propertyInstance); + } + FrozenMap castProperties = new FrozenMap<>(properties); + return new PathParametersMap(castProperties); + } + + 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); + SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().build())); + ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, new PathToSchemasMap(), new LinkedHashSet<>()); + PathToSchemasMap pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet); + return getNewInstance(castArg, validationMetadata.pathToItem(), pathToSchemasMap); + } + + + @Override + public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws 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"); + } + @Override + public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { + if (arg instanceof Map) { + return getNewInstance((Map) arg, pathToItem, pathToSchemas); + } + throw new RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); + } + @Override + public StoreorderorderidDeletePathParameters1BoxedMap validateAndBox(Map arg, SchemaConfiguration configuration) throws ValidationException { + return new StoreorderorderidDeletePathParameters1BoxedMap(validate(arg, configuration)); + } + @Override + public StoreorderorderidDeletePathParameters1Boxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { + 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"); + } + } + +} diff --git a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/storeorderorderid/delete/StoreorderorderidDeleteResponses.kt b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/storeorderorderid/delete/StoreorderorderidDeleteResponses.kt new file mode 100644 index 00000000000..f3f6061c926 --- /dev/null +++ b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/storeorderorderid/delete/StoreorderorderidDeleteResponses.kt @@ -0,0 +1,61 @@ +package org.openapijsonschematools.client.paths.storeorderorderid.delete; + +import org.openapijsonschematools.client.paths.storeorderorderid.delete.responses.StoreorderorderidDeleteCode400Response; +import org.openapijsonschematools.client.paths.storeorderorderid.delete.responses.StoreorderorderidDeleteCode404Response; +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; + +import java.net.http.HttpResponse; +import java.util.Map; +import java.util.AbstractMap; + +public class StoreorderorderidDeleteResponses { + + public sealed interface StatusCodeResponseDeserializer permits StatusStoreorderorderidDeleteCode400ResponseDeserializer, StatusStoreorderorderidDeleteCode404ResponseDeserializer {} + + public static final class StatusStoreorderorderidDeleteCode400ResponseDeserializer extends StoreorderorderidDeleteCode400Response.StoreorderorderidDeleteCode400Response1 implements StatusCodeResponseDeserializer { + } + public static final class StatusStoreorderorderidDeleteCode404ResponseDeserializer extends StoreorderorderidDeleteCode404Response.StoreorderorderidDeleteCode404Response1 implements StatusCodeResponseDeserializer { + } + + public static final class StoreorderorderidDeleteResponses1 implements ResponsesDeserializer { + private final Map statusCodeToResponseDeserializer; + public StoreorderorderidDeleteResponses1() { + this.statusCodeToResponseDeserializer = Map.ofEntries( + new AbstractMap.SimpleEntry<>("400", new StatusStoreorderorderidDeleteCode400ResponseDeserializer()), + new AbstractMap.SimpleEntry<>("404", new StatusStoreorderorderidDeleteCode404ResponseDeserializer()) + ); + } + + public Nothing? deserialize(HttpResponse response, SchemaConfiguration configuration) throws ValidationException, NotImplementedException, ApiException { + String statusCode = String.valueOf(response.statusCode()); + @Nullable StatusCodeResponseDeserializer statusCodeDeserializer = statusCodeToResponseDeserializer.get(statusCode); + if (statusCodeDeserializer == null) { + throw new ApiException( + "Invalid response statusCode="+statusCode+" has no response defined in the openapi document", + response + ); + } + if (statusCodeDeserializer instanceof StatusStoreorderorderidDeleteCode400ResponseDeserializer castDeserializer) { + var deserializedResponse = castDeserializer.deserialize(response, configuration); + throw new StoreorderorderidDeleteCode400Response.ResponseApiException( + "Received error statusCode response from server", + response, + deserializedResponse + ); + } else { + StatusStoreorderorderidDeleteCode404ResponseDeserializer castDeserializer = (StatusStoreorderorderidDeleteCode404ResponseDeserializer) statusCodeDeserializer; + var deserializedResponse = castDeserializer.deserialize(response, configuration); + throw new StoreorderorderidDeleteCode404Response.ResponseApiException( + "Received error statusCode response from server", + response, + deserializedResponse + ); + } + } + } +} diff --git a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/storeorderorderid/delete/parameters/Parameter0.kt b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/storeorderorderid/delete/parameters/Parameter0.kt new file mode 100644 index 00000000000..3f27fb09e43 --- /dev/null +++ b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/storeorderorderid/delete/parameters/Parameter0.kt @@ -0,0 +1,23 @@ +package org.openapijsonschematools.client.paths.storeorderorderid.delete.parameters; + +import org.openapijsonschematools.client.parameter.ParameterStyle; +import org.openapijsonschematools.client.parameter.ParameterInType; +import org.openapijsonschematools.client.parameter.SchemaParameter; +import org.openapijsonschematools.client.paths.storeorderorderid.delete.parameters.parameter0.Schema0; + +public class Parameter0 { + + public static class Parameter01 extends SchemaParameter { + public Parameter01() { + super( + "order_id", + ParameterInType.PATH, + true, + ParameterStyle.SIMPLE, + false, + false, + Schema0.Schema01.getInstance() + ); + } + } +} diff --git a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/storeorderorderid/delete/parameters/parameter0/Schema0.kt b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/storeorderorderid/delete/parameters/parameter0/Schema0.kt new file mode 100644 index 00000000000..f1ef8de93ef --- /dev/null +++ b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/storeorderorderid/delete/parameters/parameter0/Schema0.kt @@ -0,0 +1,19 @@ +package org.openapijsonschematools.client.paths.storeorderorderid.delete.parameters.parameter0; +import org.checkerframework.checker.nullness.qual.Nullable; +import org.openapijsonschematools.client.schemas.StringJsonSchema; + +public class Schema0 extends StringJsonSchema { + // nest classes so all schemas and input/output classes can be public + + + public static class Schema01 extends StringJsonSchema.StringJsonSchema1 { + private static @Nullable Schema01 instance = null; + public static Schema01 getInstance() { + if (instance == null) { + instance = new Schema01(); + } + return instance; + } + } + +} diff --git a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/storeorderorderid/delete/responses/StoreorderorderidDeleteCode400Response.kt b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/storeorderorderid/delete/responses/StoreorderorderidDeleteCode400Response.kt new file mode 100644 index 00000000000..cd598b23d0e --- /dev/null +++ b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/storeorderorderid/delete/responses/StoreorderorderidDeleteCode400Response.kt @@ -0,0 +1,45 @@ +package org.openapijsonschematools.client.paths.storeorderorderid.delete.responses; + +import org.openapijsonschematools.client.configurations.SchemaConfiguration; +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; +import java.net.http.HttpResponse; +import java.net.http.HttpHeaders; + +public class StoreorderorderidDeleteCode400Response { + + public static class StoreorderorderidDeleteCode400Response1 extends ResponseDeserializer { + public StoreorderorderidDeleteCode400Response1() { + super( + MapUtils.makeMap( + ) + ); + } + + @Override + protected Nothing? getBody(String contentType, Nothing? mediaType, byte[] body, SchemaConfiguration configuration) { + return null; + } + + @Override + protected Nothing? getHeaders(HttpHeaders headers, SchemaConfiguration configuration) { + return null; + } + } + + @SuppressWarnings("serial") + public static class ResponseApiException extends ApiException { + public DeserializedHttpResponse deserializedResponse; + + public ResponseApiException(String s, HttpResponse response, DeserializedHttpResponse deserializedResponse) { + super(s, response); + this.deserializedResponse = deserializedResponse; + } + } +} diff --git a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/storeorderorderid/delete/responses/StoreorderorderidDeleteCode404Response.kt b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/storeorderorderid/delete/responses/StoreorderorderidDeleteCode404Response.kt new file mode 100644 index 00000000000..53fe42a5f0b --- /dev/null +++ b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/storeorderorderid/delete/responses/StoreorderorderidDeleteCode404Response.kt @@ -0,0 +1,45 @@ +package org.openapijsonschematools.client.paths.storeorderorderid.delete.responses; + +import org.openapijsonschematools.client.configurations.SchemaConfiguration; +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; +import java.net.http.HttpResponse; +import java.net.http.HttpHeaders; + +public class StoreorderorderidDeleteCode404Response { + + public static class StoreorderorderidDeleteCode404Response1 extends ResponseDeserializer { + public StoreorderorderidDeleteCode404Response1() { + super( + MapUtils.makeMap( + ) + ); + } + + @Override + protected Nothing? getBody(String contentType, Nothing? mediaType, byte[] body, SchemaConfiguration configuration) { + return null; + } + + @Override + protected Nothing? getHeaders(HttpHeaders headers, SchemaConfiguration configuration) { + return null; + } + } + + @SuppressWarnings("serial") + public static class ResponseApiException extends ApiException { + public DeserializedHttpResponse deserializedResponse; + + public ResponseApiException(String s, HttpResponse response, DeserializedHttpResponse deserializedResponse) { + super(s, response); + this.deserializedResponse = deserializedResponse; + } + } +} diff --git a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/storeorderorderid/get/Parameters.kt b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/storeorderorderid/get/Parameters.kt new file mode 100644 index 00000000000..5e6d9bb0b5d --- /dev/null +++ b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/storeorderorderid/get/Parameters.kt @@ -0,0 +1,20 @@ +package org.openapijsonschematools.client.paths.storeorderorderid.get; + +import org.openapijsonschematools.client.paths.storeorderorderid.get.parameters.Parameter0; +import org.openapijsonschematools.client.parameter.PathSerializer; + +import java.util.Map; +import java.util.AbstractMap; + +public class Parameters { + + public static class PathParametersSerializer extends PathSerializer { + public PathParametersSerializer() { + super( + Map.ofEntries( + new AbstractMap.SimpleEntry<>("order_id", new Parameter0.Parameter01()) + ) + ); + } + } +} diff --git a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/storeorderorderid/get/StoreorderorderidGetPathParameters.kt b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/storeorderorderid/get/StoreorderorderidGetPathParameters.kt new file mode 100644 index 00000000000..473df313a16 --- /dev/null +++ b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/storeorderorderid/get/StoreorderorderidGetPathParameters.kt @@ -0,0 +1,223 @@ +package org.openapijsonschematools.client.paths.storeorderorderid.get; +import java.util.ArrayList; +import java.util.HashSet; +import java.util.LinkedHashMap; +import java.util.LinkedHashSet; +import java.util.List; +import java.util.Map; +import java.util.Objects; +import java.util.Set; +import org.checkerframework.checker.nullness.qual.Nullable; +import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags; +import org.openapijsonschematools.client.configurations.SchemaConfiguration; +import org.openapijsonschematools.client.exceptions.UnsetPropertyException; +import org.openapijsonschematools.client.exceptions.ValidationException; +import org.openapijsonschematools.client.paths.storeorderorderid.get.parameters.parameter0.Schema0; +import org.openapijsonschematools.client.schemas.AnyTypeJsonSchema; +import org.openapijsonschematools.client.schemas.GenericBuilder; +import org.openapijsonschematools.client.schemas.NotAnyTypeJsonSchema; +import org.openapijsonschematools.client.schemas.validation.FrozenMap; +import org.openapijsonschematools.client.schemas.validation.JsonSchema; +import org.openapijsonschematools.client.schemas.validation.JsonSchemaInfo; +import org.openapijsonschematools.client.schemas.validation.MapSchemaValidator; +import org.openapijsonschematools.client.schemas.validation.MapUtils; +import org.openapijsonschematools.client.schemas.validation.PathToSchemasMap; +import org.openapijsonschematools.client.schemas.validation.PropertyEntry; +import org.openapijsonschematools.client.schemas.validation.ValidationMetadata; + +public class StoreorderorderidGetPathParameters { + // nest classes so all schemas and input/output classes can be public + + + public static class AdditionalProperties extends NotAnyTypeJsonSchema.NotAnyTypeJsonSchema1 { + // NotAnyTypeSchema + private static @Nullable AdditionalProperties instance = null; + public static AdditionalProperties getInstance() { + if (instance == null) { + instance = new AdditionalProperties(); + } + return instance; + } + } + + + public static class PathParametersMap extends FrozenMap { + protected PathParametersMap(FrozenMap m) { + super(m); + } + public static final Set requiredKeys = Set.of( + "order_id" + ); + public static final Set optionalKeys = Set.of(); + public static PathParametersMap of(Map arg, SchemaConfiguration configuration) throws ValidationException { + return StoreorderorderidGetPathParameters1.getInstance().validate(arg, configuration); + } + + public Number order_id() { + try { + return getOrThrow("version"); + } catch (UnsetPropertyException e) { + throw new RuntimeException(e); + } + } + } + + public interface SetterForOrderId { + Map getInstance(); + T getBuilderAfterOrderId(Map instance); + + default T order_id(int value) { + var instance = getInstance(); + instance.put("order_id", value); + return getBuilderAfterOrderId(instance); + } + + default T order_id(float value) { + var instance = getInstance(); + instance.put("order_id", value); + return getBuilderAfterOrderId(instance); + } + + default T order_id(long value) { + var instance = getInstance(); + instance.put("order_id", value); + return getBuilderAfterOrderId(instance); + } + + default T order_id(double value) { + var instance = getInstance(); + instance.put("order_id", value); + return getBuilderAfterOrderId(instance); + } + } + + public static class PathParametersMap0Builder implements GenericBuilder> { + private final Map instance; + private static final Set knownKeys = Set.of( + "order_id" + ); + public Set getKnownKeys() { + return knownKeys; + } + public PathParametersMap0Builder(Map instance) { + this.instance = instance; + } + public Map build() { + return instance; + } + } + + public static class PathParametersMapBuilder implements SetterForOrderId { + private final Map instance; + public PathParametersMapBuilder() { + this.instance = new LinkedHashMap<>(); + } + public Map getInstance() { + return instance; + } + public PathParametersMap0Builder getBuilderAfterOrderId(Map instance) { + return new PathParametersMap0Builder(instance); + } + } + + + public sealed interface StoreorderorderidGetPathParameters1Boxed permits StoreorderorderidGetPathParameters1BoxedMap { + @Nullable Object getData(); + } + + public record StoreorderorderidGetPathParameters1BoxedMap(PathParametersMap data) implements StoreorderorderidGetPathParameters1Boxed { + @Override + public @Nullable Object getData() { + return data; + } + } + + + public static class StoreorderorderidGetPathParameters1 extends JsonSchema implements MapSchemaValidator { + private static @Nullable StoreorderorderidGetPathParameters1 instance = null; + + protected StoreorderorderidGetPathParameters1() { + super(new JsonSchemaInfo() + .type(Set.of(Map.class)) + .properties(Map.ofEntries( + new PropertyEntry("order_id", Schema0.Schema01.class) + )) + .required(Set.of( + "order_id" + )) + .additionalProperties(AdditionalProperties.class) + ); + } + + public static StoreorderorderidGetPathParameters1 getInstance() { + if (instance == null) { + instance = new StoreorderorderidGetPathParameters1(); + } + return instance; + } + + 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 RuntimeException("Invalid non-string key value"); + } + String propertyName = (String) entryKey; + List propertyPathToItem = new ArrayList<>(pathToItem); + propertyPathToItem.add(propertyName); + Object value = entry.getValue(); + LinkedHashMap, Nothing?> schemas = pathToSchemas.get(propertyPathToItem); + if (schemas == null) { + throw new RuntimeException("Validation 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"); + } + properties.put(propertyName, (Number) propertyInstance); + } + FrozenMap castProperties = new FrozenMap<>(properties); + return new PathParametersMap(castProperties); + } + + 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); + SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().build())); + ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, new PathToSchemasMap(), new LinkedHashSet<>()); + PathToSchemasMap pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet); + return getNewInstance(castArg, validationMetadata.pathToItem(), pathToSchemasMap); + } + + + @Override + public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws 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"); + } + @Override + public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { + if (arg instanceof Map) { + return getNewInstance((Map) arg, pathToItem, pathToSchemas); + } + throw new RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); + } + @Override + public StoreorderorderidGetPathParameters1BoxedMap validateAndBox(Map arg, SchemaConfiguration configuration) throws ValidationException { + return new StoreorderorderidGetPathParameters1BoxedMap(validate(arg, configuration)); + } + @Override + public StoreorderorderidGetPathParameters1Boxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { + 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"); + } + } + +} diff --git a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/storeorderorderid/get/StoreorderorderidGetResponses.kt b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/storeorderorderid/get/StoreorderorderidGetResponses.kt new file mode 100644 index 00000000000..773ffcb50ab --- /dev/null +++ b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/storeorderorderid/get/StoreorderorderidGetResponses.kt @@ -0,0 +1,77 @@ +package org.openapijsonschematools.client.paths.storeorderorderid.get; + +import org.openapijsonschematools.client.paths.storeorderorderid.get.responses.StoreorderorderidGetCode200Response; +import org.openapijsonschematools.client.paths.storeorderorderid.get.responses.StoreorderorderidGetCode400Response; +import org.openapijsonschematools.client.paths.storeorderorderid.get.responses.StoreorderorderidGetCode404Response; +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; +import org.checkerframework.checker.nullness.qual.Nullable; + +import java.net.http.HttpResponse; +import java.util.Map; +import java.util.AbstractMap; + +public class StoreorderorderidGetResponses { + public sealed interface EndpointResponse permits EndpointStoreorderorderidGetCode200Response {} + + public record EndpointStoreorderorderidGetCode200Response( + HttpResponse response, + StoreorderorderidGetCode200Response.SealedResponseBody body, + Nothing? headers + ) implements EndpointResponse, ApiResponse{ + } + + public sealed interface StatusCodeResponseDeserializer permits StatusStoreorderorderidGetCode200ResponseDeserializer, StatusStoreorderorderidGetCode400ResponseDeserializer, StatusStoreorderorderidGetCode404ResponseDeserializer {} + + public static final class StatusStoreorderorderidGetCode200ResponseDeserializer extends StoreorderorderidGetCode200Response.StoreorderorderidGetCode200Response1 implements StatusCodeResponseDeserializer { + } + public static final class StatusStoreorderorderidGetCode400ResponseDeserializer extends StoreorderorderidGetCode400Response.StoreorderorderidGetCode400Response1 implements StatusCodeResponseDeserializer { + } + public static final class StatusStoreorderorderidGetCode404ResponseDeserializer extends StoreorderorderidGetCode404Response.StoreorderorderidGetCode404Response1 implements StatusCodeResponseDeserializer { + } + + public static final class StoreorderorderidGetResponses1 implements ResponsesDeserializer { + private final Map statusCodeToResponseDeserializer; + public StoreorderorderidGetResponses1() { + this.statusCodeToResponseDeserializer = Map.ofEntries( + new AbstractMap.SimpleEntry<>("200", new StatusStoreorderorderidGetCode200ResponseDeserializer()), + new AbstractMap.SimpleEntry<>("400", new StatusStoreorderorderidGetCode400ResponseDeserializer()), + new AbstractMap.SimpleEntry<>("404", new StatusStoreorderorderidGetCode404ResponseDeserializer()) + ); + } + + 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) { + throw new ApiException( + "Invalid response statusCode="+statusCode+" has no response defined in the openapi document", + response + ); + } + if (statusCodeDeserializer instanceof StatusStoreorderorderidGetCode200ResponseDeserializer castDeserializer) { + var deserializedResponse = castDeserializer.deserialize(response, configuration); + return new EndpointStoreorderorderidGetCode200Response(response, deserializedResponse.body(), deserializedResponse.headers()); + } else if (statusCodeDeserializer instanceof StatusStoreorderorderidGetCode400ResponseDeserializer castDeserializer) { + var deserializedResponse = castDeserializer.deserialize(response, configuration); + throw new StoreorderorderidGetCode400Response.ResponseApiException( + "Received error statusCode response from server", + response, + deserializedResponse + ); + } else { + StatusStoreorderorderidGetCode404ResponseDeserializer castDeserializer = (StatusStoreorderorderidGetCode404ResponseDeserializer) statusCodeDeserializer; + var deserializedResponse = castDeserializer.deserialize(response, configuration); + throw new StoreorderorderidGetCode404Response.ResponseApiException( + "Received error statusCode response from server", + response, + deserializedResponse + ); + } + } + } +} diff --git a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/storeorderorderid/get/parameters/Parameter0.kt b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/storeorderorderid/get/parameters/Parameter0.kt new file mode 100644 index 00000000000..e1ad2e999a1 --- /dev/null +++ b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/storeorderorderid/get/parameters/Parameter0.kt @@ -0,0 +1,23 @@ +package org.openapijsonschematools.client.paths.storeorderorderid.get.parameters; + +import org.openapijsonschematools.client.parameter.ParameterStyle; +import org.openapijsonschematools.client.parameter.ParameterInType; +import org.openapijsonschematools.client.parameter.SchemaParameter; +import org.openapijsonschematools.client.paths.storeorderorderid.get.parameters.parameter0.Schema0; + +public class Parameter0 { + + public static class Parameter01 extends SchemaParameter { + public Parameter01() { + super( + "order_id", + ParameterInType.PATH, + true, + ParameterStyle.SIMPLE, + false, + false, + Schema0.Schema01.getInstance() + ); + } + } +} diff --git a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/storeorderorderid/get/parameters/parameter0/Schema0.kt b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/storeorderorderid/get/parameters/parameter0/Schema0.kt new file mode 100644 index 00000000000..b81d0724b97 --- /dev/null +++ b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/storeorderorderid/get/parameters/parameter0/Schema0.kt @@ -0,0 +1,111 @@ +package org.openapijsonschematools.client.paths.storeorderorderid.get.parameters.parameter0; +import java.util.HashSet; +import java.util.LinkedHashSet; +import java.util.List; +import java.util.Objects; +import java.util.Set; +import org.checkerframework.checker.nullness.qual.Nullable; +import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags; +import org.openapijsonschematools.client.configurations.SchemaConfiguration; +import org.openapijsonschematools.client.exceptions.ValidationException; +import org.openapijsonschematools.client.schemas.validation.JsonSchema; +import org.openapijsonschematools.client.schemas.validation.JsonSchemaInfo; +import org.openapijsonschematools.client.schemas.validation.NumberSchemaValidator; +import org.openapijsonschematools.client.schemas.validation.PathToSchemasMap; +import org.openapijsonschematools.client.schemas.validation.ValidationMetadata; + +public class Schema0 { + // nest classes so all schemas and input/output classes can be public + + + public sealed interface Schema01Boxed permits Schema01BoxedNumber { + @Nullable Object getData(); + } + + public record Schema01BoxedNumber(Number data) implements Schema01Boxed { + @Override + public @Nullable Object getData() { + return data; + } + } + + + + public static class Schema01 extends JsonSchema implements NumberSchemaValidator { + private static @Nullable Schema01 instance = null; + + protected Schema01() { + super(new JsonSchemaInfo() + .type(Set.of( + Integer.class, + Long.class, + Float.class, + Double.class + )) + .format("int64") + .maximum(5) + .minimum(1) + ); + } + + public static Schema01 getInstance() { + if (instance == null) { + instance = new Schema01(); + } + return instance; + } + + @Override + public Number validate(Number arg, SchemaConfiguration configuration) throws ValidationException { + Set> pathSet = new HashSet<>(); + List pathToItem = List.of("args[0"); + Number castArg = castToAllowedTypes(arg, pathToItem, pathSet); + SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().build())); + ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, new PathToSchemasMap(), new LinkedHashSet<>()); + getPathToSchemas(this, castArg, validationMetadata, pathSet); + return castArg; + } + + public int validate(int arg, SchemaConfiguration configuration) throws ValidationException { + return (int) validate((Number) arg, configuration); + } + + public float validate(float arg, SchemaConfiguration configuration) throws ValidationException { + return (float) validate((Number) arg, configuration); + } + + public long validate(long arg, SchemaConfiguration configuration) throws ValidationException { + return (long) validate((Number) arg, configuration); + } + + 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 { + 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"); + } + @Override + public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { + 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"); + } + @Override + 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 { + 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"); + } + } +} diff --git a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/storeorderorderid/get/responses/StoreorderorderidGetCode200Response.kt b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/storeorderorderid/get/responses/StoreorderorderidGetCode200Response.kt new file mode 100644 index 00000000000..f8e7d5476c3 --- /dev/null +++ b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/storeorderorderid/get/responses/StoreorderorderidGetCode200Response.kt @@ -0,0 +1,81 @@ +package org.openapijsonschematools.client.paths.storeorderorderid.get.responses; + +import org.openapijsonschematools.client.configurations.SchemaConfiguration; +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; + +import java.util.AbstractMap; +import java.util.Map; +import java.net.http.HttpResponse; +import java.net.http.HttpHeaders; + +public class StoreorderorderidGetCode200Response { + public sealed interface SealedMediaType permits ApplicationxmlMediaType, ApplicationjsonMediaType {} + + public record ApplicationxmlMediaType(ApplicationxmlSchema.ApplicationxmlSchema1 schema) implements SealedMediaType, MediaType { + public ApplicationxmlMediaType() { + this(ApplicationxmlSchema.ApplicationxmlSchema1.getInstance()); + } + @Override + public Nothing? encoding() { + return null; + } + } + + public record ApplicationjsonMediaType(ApplicationjsonSchema.ApplicationjsonSchema1 schema) implements SealedMediaType, MediaType { + public ApplicationjsonMediaType() { + this(ApplicationjsonSchema.ApplicationjsonSchema1.getInstance()); + } + @Override + public Nothing? encoding() { + return null; + } + } + public sealed interface SealedResponseBody permits ApplicationxmlResponseBody, ApplicationjsonResponseBody {} + public record ApplicationxmlResponseBody(ApplicationxmlSchema.Order1Boxed body) implements SealedResponseBody { } + public record ApplicationjsonResponseBody(ApplicationjsonSchema.Order1Boxed body) implements SealedResponseBody { } + + public static class StoreorderorderidGetCode200Response1 extends ResponseDeserializer { + public StoreorderorderidGetCode200Response1() { + super( + Map.ofEntries( + new AbstractMap.SimpleEntry<>("application/xml", new ApplicationxmlMediaType()), + new AbstractMap.SimpleEntry<>("application/json", new ApplicationjsonMediaType()) + ) + ); + } + + @Override + 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 { + ApplicationjsonMediaType thisMediaType = (ApplicationjsonMediaType) mediaType; + var deserializedBody = deserializeBody(contentType, body, thisMediaType.schema(), configuration); + return new ApplicationjsonResponseBody(deserializedBody); + } + } + + @Override + protected Nothing? getHeaders(HttpHeaders headers, SchemaConfiguration configuration) { + return null; + } + } + + @SuppressWarnings("serial") + public static class ResponseApiException extends ApiException { + public DeserializedHttpResponse deserializedResponse; + + public ResponseApiException(String s, HttpResponse response, DeserializedHttpResponse deserializedResponse) { + super(s, response); + this.deserializedResponse = deserializedResponse; + } + } +} diff --git a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/storeorderorderid/get/responses/StoreorderorderidGetCode400Response.kt b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/storeorderorderid/get/responses/StoreorderorderidGetCode400Response.kt new file mode 100644 index 00000000000..9872ebd4dc1 --- /dev/null +++ b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/storeorderorderid/get/responses/StoreorderorderidGetCode400Response.kt @@ -0,0 +1,45 @@ +package org.openapijsonschematools.client.paths.storeorderorderid.get.responses; + +import org.openapijsonschematools.client.configurations.SchemaConfiguration; +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; +import java.net.http.HttpResponse; +import java.net.http.HttpHeaders; + +public class StoreorderorderidGetCode400Response { + + public static class StoreorderorderidGetCode400Response1 extends ResponseDeserializer { + public StoreorderorderidGetCode400Response1() { + super( + MapUtils.makeMap( + ) + ); + } + + @Override + protected Nothing? getBody(String contentType, Nothing? mediaType, byte[] body, SchemaConfiguration configuration) { + return null; + } + + @Override + protected Nothing? getHeaders(HttpHeaders headers, SchemaConfiguration configuration) { + return null; + } + } + + @SuppressWarnings("serial") + public static class ResponseApiException extends ApiException { + public DeserializedHttpResponse deserializedResponse; + + public ResponseApiException(String s, HttpResponse response, DeserializedHttpResponse deserializedResponse) { + super(s, response); + this.deserializedResponse = deserializedResponse; + } + } +} diff --git a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/storeorderorderid/get/responses/StoreorderorderidGetCode404Response.kt b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/storeorderorderid/get/responses/StoreorderorderidGetCode404Response.kt new file mode 100644 index 00000000000..75d169d6caf --- /dev/null +++ b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/storeorderorderid/get/responses/StoreorderorderidGetCode404Response.kt @@ -0,0 +1,45 @@ +package org.openapijsonschematools.client.paths.storeorderorderid.get.responses; + +import org.openapijsonschematools.client.configurations.SchemaConfiguration; +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; +import java.net.http.HttpResponse; +import java.net.http.HttpHeaders; + +public class StoreorderorderidGetCode404Response { + + public static class StoreorderorderidGetCode404Response1 extends ResponseDeserializer { + public StoreorderorderidGetCode404Response1() { + super( + MapUtils.makeMap( + ) + ); + } + + @Override + protected Nothing? getBody(String contentType, Nothing? mediaType, byte[] body, SchemaConfiguration configuration) { + return null; + } + + @Override + protected Nothing? getHeaders(HttpHeaders headers, SchemaConfiguration configuration) { + return null; + } + } + + @SuppressWarnings("serial") + public static class ResponseApiException extends ApiException { + public DeserializedHttpResponse deserializedResponse; + + public ResponseApiException(String s, HttpResponse response, DeserializedHttpResponse deserializedResponse) { + super(s, response); + this.deserializedResponse = deserializedResponse; + } + } +} diff --git a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/storeorderorderid/get/responses/code200response/content/applicationjson/ApplicationjsonSchema.kt b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/storeorderorderid/get/responses/code200response/content/applicationjson/ApplicationjsonSchema.kt new file mode 100644 index 00000000000..b1b2c0183b4 --- /dev/null +++ b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/storeorderorderid/get/responses/code200response/content/applicationjson/ApplicationjsonSchema.kt @@ -0,0 +1,19 @@ +package org.openapijsonschematools.client.paths.storeorderorderid.get.responses.code200response.content.applicationjson; + +import org.checkerframework.checker.nullness.qual.Nullable; +import org.openapijsonschematools.client.components.schemas.Order; + +public class ApplicationjsonSchema extends Order { + // $refed class + + + public static class ApplicationjsonSchema1 extends Order1 { + private static @Nullable ApplicationjsonSchema1 instance = null; + public static ApplicationjsonSchema1 getInstance() { + if (instance == null) { + instance = new ApplicationjsonSchema1(); + } + return instance; + } + } +} diff --git a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/storeorderorderid/get/responses/code200response/content/applicationxml/ApplicationxmlSchema.kt b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/storeorderorderid/get/responses/code200response/content/applicationxml/ApplicationxmlSchema.kt new file mode 100644 index 00000000000..91ca54812cd --- /dev/null +++ b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/storeorderorderid/get/responses/code200response/content/applicationxml/ApplicationxmlSchema.kt @@ -0,0 +1,19 @@ +package org.openapijsonschematools.client.paths.storeorderorderid.get.responses.code200response.content.applicationxml; + +import org.checkerframework.checker.nullness.qual.Nullable; +import org.openapijsonschematools.client.components.schemas.Order; + +public class ApplicationxmlSchema extends Order { + // $refed class + + + public static class ApplicationxmlSchema1 extends Order1 { + private static @Nullable ApplicationxmlSchema1 instance = null; + public static ApplicationxmlSchema1 getInstance() { + if (instance == null) { + instance = new ApplicationxmlSchema1(); + } + return instance; + } + } +} diff --git a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/user/UserPost.kt b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/user/UserPost.kt new file mode 100644 index 00000000000..9881c39c507 --- /dev/null +++ b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/user/UserPost.kt @@ -0,0 +1,183 @@ +package org.openapijsonschematools.client.paths.user; + +import org.checkerframework.checker.nullness.qual.Nullable; +import org.openapijsonschematools.client.RootServerInfo; +import org.openapijsonschematools.client.paths.user.post.UserPostRequestBody; +import org.openapijsonschematools.client.paths.user.post.UserPostResponses; +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.requestbody.SerializedRequestBody; +import org.openapijsonschematools.client.paths.User; + +import java.io.IOException; +import java.util.ArrayList; +import java.net.http.HttpClient; +import java.net.http.HttpRequest; +import java.time.Duration; +import java.util.List; +import java.util.Map; + +public class UserPost { + private static class PostProvider { + private static final String method = "post"; + + public static UserPostResponses.EndpointResponse post( + PostRequest request, + ApiConfiguration apiConfiguration, + SchemaConfiguration schemaConfiguration, + HttpClient client + ) throws IOException, InterruptedException, ValidationException, NotImplementedException, ApiException { + Map> headers = apiConfiguration.getDefaultHeaders(); + + SerializedRequestBody serializedRequestBody = new UserPostRequestBody.UserPostRequestBody1().serialize( + request.requestBody + ); + var contentTypeHeaderValues = headers.getOrDefault("Content-Type", new ArrayList<>()); + contentTypeHeaderValues.add(serializedRequestBody.contentType); + HttpRequest.BodyPublisher bodyPublisher = serializedRequestBody.bodyPublisher; + // TODO set this to a map if there is a query security scheme + @Nullable Map queryMap = null; + String host = apiConfiguration.getServer(request.serverIndex).url(); + + String url = host + User.path; + var httpRequest = RestClient.getRequest( + url, + method, + bodyPublisher, + headers, + request.timeout + ); + var response = RestClient.getResponse(httpRequest, client); + var responsesDeserializer = new UserPostResponses.UserPostResponses1(); + return responsesDeserializer.deserialize(response, schemaConfiguration); + } + } + + public interface PostOperation { + ApiConfiguration getApiConfiguration(); + SchemaConfiguration getSchemaConfiguration(); + HttpClient getClient(); + default UserPostResponses.EndpointResponse post(PostRequest request) throws IOException, InterruptedException, ValidationException, NotImplementedException, ApiException { + return PostProvider.post(request, getApiConfiguration(), getSchemaConfiguration(), getClient()); + } + } + + public interface CreateUserOperation { + ApiConfiguration getApiConfiguration(); + SchemaConfiguration getSchemaConfiguration(); + HttpClient getClient(); + default UserPostResponses.EndpointResponse createUser(PostRequest request) throws IOException, InterruptedException, ValidationException, NotImplementedException, ApiException { + return PostProvider.post(request, getApiConfiguration(), getSchemaConfiguration(), getClient()); + } + } + + public static class Post extends ApiClient implements PostOperation { + public Post(ApiConfiguration apiConfiguration, SchemaConfiguration schemaConfiguration) { + super(apiConfiguration, schemaConfiguration); + } + } + + public static class PostRequest { + public UserPostRequestBody.SealedRequestBody requestBody; + public RootServerInfo.@Nullable ServerIndex serverIndex; + public @Nullable Duration timeout; + + public PostRequest( + UserPostRequestBody.SealedRequestBody requestBody, + RootServerInfo.@Nullable ServerIndex serverIndex, + @Nullable Duration timeout + ) { + this.requestBody = requestBody; + this.serverIndex = serverIndex; + this.timeout = timeout; + } + } + + public static class PostNullableRequest { + public UserPostRequestBody.@Nullable SealedRequestBody requestBody; + public RootServerInfo.@Nullable ServerIndex serverIndex; + public @Nullable Duration timeout; + } + + public interface SetterForServerIndex { + PostNullableRequest getInstance(); + T getBuilderAfterServerIndex(PostNullableRequest instance); + default T serverIndex(RootServerInfo.ServerIndex serverIndex) { + var instance = getInstance(); + instance.serverIndex = serverIndex; + return getBuilderAfterServerIndex(instance); + } + } + + public interface SetterForTimeout { + PostNullableRequest getInstance(); + T getBuilderAfterTimeout(PostNullableRequest instance); + default T timeout(Duration timeout) { + var instance = getInstance(); + instance.timeout = timeout; + return getBuilderAfterTimeout(instance); + } + } + + public interface SetterForRequestBody { + PostNullableRequest getInstance(); + T getBuilderAfterRequestBody(PostNullableRequest instance); + default T requestBody(UserPostRequestBody.SealedRequestBody requestBody) { + var instance = getInstance(); + instance.requestBody = requestBody; + return getBuilderAfterRequestBody(instance); + } + } + + public static class Post0RequestBuilder implements SetterForServerIndex, SetterForTimeout { + private final PostNullableRequest instance; + + public Post0RequestBuilder(PostNullableRequest instance) { + this.instance = instance; + } + + public PostRequest build() { + var requestBody = instance.requestBody; + if (requestBody == null) { + throw new RuntimeException("invalid null value for required parameter"); + } + return new PostRequest( + requestBody, + instance.serverIndex, + instance.timeout + ); + } + + public PostNullableRequest getInstance() { + return instance; + } + + public Post0RequestBuilder getBuilderAfterServerIndex(PostNullableRequest instance) { + return this; + } + + public Post0RequestBuilder getBuilderAfterTimeout(PostNullableRequest instance) { + return this; + } + } + public static class PostRequestBuilder implements SetterForRequestBody { + private final PostNullableRequest instance; + + public PostRequestBuilder() { + this.instance = new PostNullableRequest(); + } + + public PostNullableRequest getInstance() { + return instance; + } + + public Post0RequestBuilder getBuilderAfterRequestBody(PostNullableRequest instance) { + return new Post0RequestBuilder(instance); + } + } +} diff --git a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/user/post/UserPostRequestBody.kt b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/user/post/UserPostRequestBody.kt new file mode 100644 index 00000000000..37eeb3e4d44 --- /dev/null +++ b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/user/post/UserPostRequestBody.kt @@ -0,0 +1,49 @@ +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; +import org.openapijsonschematools.client.mediatype.MediaType; +import org.openapijsonschematools.client.paths.user.post.requestbody.content.applicationjson.ApplicationjsonSchema; + +import java.util.AbstractMap; +import java.util.Map; + +public class UserPostRequestBody { + public sealed interface SealedMediaType permits ApplicationjsonMediaType {} + + public record ApplicationjsonMediaType(ApplicationjsonSchema.ApplicationjsonSchema1 schema) implements SealedMediaType, MediaType { + public ApplicationjsonMediaType() { + this(ApplicationjsonSchema.ApplicationjsonSchema1.getInstance()); + } + @Override + public Nothing? encoding() { + return null; + } + } + + public static class UserPostRequestBody1 extends RequestBodySerializer { + public UserPostRequestBody1() { + super( + Map.ofEntries( + new AbstractMap.SimpleEntry<>("application/json", new ApplicationjsonMediaType()) + ), + true + ); + } + + public SerializedRequestBody serialize(SealedRequestBody requestBody) throws NotImplementedException { + ApplicationjsonRequestBody requestBody0 = (ApplicationjsonRequestBody) requestBody; + return serialize(requestBody0.contentType(), requestBody0.body().getData()); + } + } + + public sealed interface SealedRequestBody permits ApplicationjsonRequestBody {} + public record ApplicationjsonRequestBody(ApplicationjsonSchema.User1Boxed body) implements SealedRequestBody, GenericRequestBody { + @Override + public String contentType() { + return "application/json"; + } + } +} diff --git a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/user/post/UserPostResponses.kt b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/user/post/UserPostResponses.kt new file mode 100644 index 00000000000..696e30302ee --- /dev/null +++ b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/user/post/UserPostResponses.kt @@ -0,0 +1,37 @@ +package org.openapijsonschematools.client.paths.user.post; + +import org.openapijsonschematools.client.paths.user.post.responses.UserPostCodedefaultResponse; +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; +import org.checkerframework.checker.nullness.qual.Nullable; + +import java.net.http.HttpResponse; +import java.util.Map; +import java.util.AbstractMap; + +public class UserPostResponses { + public sealed interface EndpointResponse permits EndpointUserPostCodedefaultResponse {} + + public record EndpointUserPostCodedefaultResponse( + HttpResponse response, + Nothing? body, + Nothing? headers + ) implements EndpointResponse, ApiResponse{ + } + + public static final class UserPostResponses1 implements ResponsesDeserializer { + private final UserPostCodedefaultResponse.UserPostCodedefaultResponse1 defaultResponseDeserializer; + public UserPostResponses1() { + this.defaultResponseDeserializer = new UserPostCodedefaultResponse.UserPostCodedefaultResponse1(); + } + + public EndpointResponse deserialize(HttpResponse response, SchemaConfiguration configuration) throws ValidationException, NotImplementedException, ApiException { + var deserializedResponse = defaultResponseDeserializer.deserialize(response, configuration); + return new EndpointUserPostCodedefaultResponse(response, deserializedResponse.body(), deserializedResponse.headers()); + } + } +} diff --git a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/user/post/requestbody/content/applicationjson/ApplicationjsonSchema.kt b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/user/post/requestbody/content/applicationjson/ApplicationjsonSchema.kt new file mode 100644 index 00000000000..b23c171aa6e --- /dev/null +++ b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/user/post/requestbody/content/applicationjson/ApplicationjsonSchema.kt @@ -0,0 +1,19 @@ +package org.openapijsonschematools.client.paths.user.post.requestbody.content.applicationjson; + +import org.checkerframework.checker.nullness.qual.Nullable; +import org.openapijsonschematools.client.components.schemas.User; + +public class ApplicationjsonSchema extends User { + // $refed class + + + public static class ApplicationjsonSchema1 extends User1 { + private static @Nullable ApplicationjsonSchema1 instance = null; + public static ApplicationjsonSchema1 getInstance() { + if (instance == null) { + instance = new ApplicationjsonSchema1(); + } + return instance; + } + } +} diff --git a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/user/post/responses/UserPostCodedefaultResponse.kt b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/user/post/responses/UserPostCodedefaultResponse.kt new file mode 100644 index 00000000000..d33f504ecbc --- /dev/null +++ b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/user/post/responses/UserPostCodedefaultResponse.kt @@ -0,0 +1,45 @@ +package org.openapijsonschematools.client.paths.user.post.responses; + +import org.openapijsonschematools.client.configurations.SchemaConfiguration; +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; +import java.net.http.HttpResponse; +import java.net.http.HttpHeaders; + +public class UserPostCodedefaultResponse { + + public static class UserPostCodedefaultResponse1 extends ResponseDeserializer { + public UserPostCodedefaultResponse1() { + super( + MapUtils.makeMap( + ) + ); + } + + @Override + protected Nothing? getBody(String contentType, Nothing? mediaType, byte[] body, SchemaConfiguration configuration) { + return null; + } + + @Override + protected Nothing? getHeaders(HttpHeaders headers, SchemaConfiguration configuration) { + return null; + } + } + + @SuppressWarnings("serial") + public static class ResponseApiException extends ApiException { + public DeserializedHttpResponse deserializedResponse; + + public ResponseApiException(String s, HttpResponse response, DeserializedHttpResponse deserializedResponse) { + super(s, response); + this.deserializedResponse = deserializedResponse; + } + } +} diff --git a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/usercreatewitharray/UsercreatewitharrayPost.kt b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/usercreatewitharray/UsercreatewitharrayPost.kt new file mode 100644 index 00000000000..e3c07ef1234 --- /dev/null +++ b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/usercreatewitharray/UsercreatewitharrayPost.kt @@ -0,0 +1,183 @@ +package org.openapijsonschematools.client.paths.usercreatewitharray; + +import org.checkerframework.checker.nullness.qual.Nullable; +import org.openapijsonschematools.client.RootServerInfo; +import org.openapijsonschematools.client.paths.usercreatewitharray.post.UsercreatewitharrayPostRequestBody; +import org.openapijsonschematools.client.paths.usercreatewitharray.post.UsercreatewitharrayPostResponses; +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.requestbody.SerializedRequestBody; +import org.openapijsonschematools.client.paths.Usercreatewitharray; + +import java.io.IOException; +import java.util.ArrayList; +import java.net.http.HttpClient; +import java.net.http.HttpRequest; +import java.time.Duration; +import java.util.List; +import java.util.Map; + +public class UsercreatewitharrayPost { + private static class PostProvider { + private static final String method = "post"; + + public static UsercreatewitharrayPostResponses.EndpointResponse post( + PostRequest request, + ApiConfiguration apiConfiguration, + SchemaConfiguration schemaConfiguration, + HttpClient client + ) throws IOException, InterruptedException, ValidationException, NotImplementedException, ApiException { + Map> headers = apiConfiguration.getDefaultHeaders(); + + SerializedRequestBody serializedRequestBody = new UsercreatewitharrayPostRequestBody.UsercreatewitharrayPostRequestBody1().serialize( + request.requestBody + ); + var contentTypeHeaderValues = headers.getOrDefault("Content-Type", new ArrayList<>()); + contentTypeHeaderValues.add(serializedRequestBody.contentType); + HttpRequest.BodyPublisher bodyPublisher = serializedRequestBody.bodyPublisher; + // TODO set this to a map if there is a query security scheme + @Nullable Map queryMap = null; + String host = apiConfiguration.getServer(request.serverIndex).url(); + + String url = host + Usercreatewitharray.path; + var httpRequest = RestClient.getRequest( + url, + method, + bodyPublisher, + headers, + request.timeout + ); + var response = RestClient.getResponse(httpRequest, client); + var responsesDeserializer = new UsercreatewitharrayPostResponses.UsercreatewitharrayPostResponses1(); + return responsesDeserializer.deserialize(response, schemaConfiguration); + } + } + + public interface PostOperation { + ApiConfiguration getApiConfiguration(); + SchemaConfiguration getSchemaConfiguration(); + HttpClient getClient(); + default UsercreatewitharrayPostResponses.EndpointResponse post(PostRequest request) throws IOException, InterruptedException, ValidationException, NotImplementedException, ApiException { + return PostProvider.post(request, getApiConfiguration(), getSchemaConfiguration(), getClient()); + } + } + + public interface CreateUsersWithArrayInputOperation { + ApiConfiguration getApiConfiguration(); + SchemaConfiguration getSchemaConfiguration(); + HttpClient getClient(); + default UsercreatewitharrayPostResponses.EndpointResponse createUsersWithArrayInput(PostRequest request) throws IOException, InterruptedException, ValidationException, NotImplementedException, ApiException { + return PostProvider.post(request, getApiConfiguration(), getSchemaConfiguration(), getClient()); + } + } + + public static class Post extends ApiClient implements PostOperation { + public Post(ApiConfiguration apiConfiguration, SchemaConfiguration schemaConfiguration) { + super(apiConfiguration, schemaConfiguration); + } + } + + public static class PostRequest { + public UsercreatewitharrayPostRequestBody.SealedRequestBody requestBody; + public RootServerInfo.@Nullable ServerIndex serverIndex; + public @Nullable Duration timeout; + + public PostRequest( + UsercreatewitharrayPostRequestBody.SealedRequestBody requestBody, + RootServerInfo.@Nullable ServerIndex serverIndex, + @Nullable Duration timeout + ) { + this.requestBody = requestBody; + this.serverIndex = serverIndex; + this.timeout = timeout; + } + } + + public static class PostNullableRequest { + public UsercreatewitharrayPostRequestBody.@Nullable SealedRequestBody requestBody; + public RootServerInfo.@Nullable ServerIndex serverIndex; + public @Nullable Duration timeout; + } + + public interface SetterForServerIndex { + PostNullableRequest getInstance(); + T getBuilderAfterServerIndex(PostNullableRequest instance); + default T serverIndex(RootServerInfo.ServerIndex serverIndex) { + var instance = getInstance(); + instance.serverIndex = serverIndex; + return getBuilderAfterServerIndex(instance); + } + } + + public interface SetterForTimeout { + PostNullableRequest getInstance(); + T getBuilderAfterTimeout(PostNullableRequest instance); + default T timeout(Duration timeout) { + var instance = getInstance(); + instance.timeout = timeout; + return getBuilderAfterTimeout(instance); + } + } + + public interface SetterForRequestBody { + PostNullableRequest getInstance(); + T getBuilderAfterRequestBody(PostNullableRequest instance); + default T requestBody(UsercreatewitharrayPostRequestBody.SealedRequestBody requestBody) { + var instance = getInstance(); + instance.requestBody = requestBody; + return getBuilderAfterRequestBody(instance); + } + } + + public static class Post0RequestBuilder implements SetterForServerIndex, SetterForTimeout { + private final PostNullableRequest instance; + + public Post0RequestBuilder(PostNullableRequest instance) { + this.instance = instance; + } + + public PostRequest build() { + var requestBody = instance.requestBody; + if (requestBody == null) { + throw new RuntimeException("invalid null value for required parameter"); + } + return new PostRequest( + requestBody, + instance.serverIndex, + instance.timeout + ); + } + + public PostNullableRequest getInstance() { + return instance; + } + + public Post0RequestBuilder getBuilderAfterServerIndex(PostNullableRequest instance) { + return this; + } + + public Post0RequestBuilder getBuilderAfterTimeout(PostNullableRequest instance) { + return this; + } + } + public static class PostRequestBuilder implements SetterForRequestBody { + private final PostNullableRequest instance; + + public PostRequestBuilder() { + this.instance = new PostNullableRequest(); + } + + public PostNullableRequest getInstance() { + return instance; + } + + public Post0RequestBuilder getBuilderAfterRequestBody(PostNullableRequest instance) { + return new Post0RequestBuilder(instance); + } + } +} diff --git a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/usercreatewitharray/post/UsercreatewitharrayPostRequestBody.kt b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/usercreatewitharray/post/UsercreatewitharrayPostRequestBody.kt new file mode 100644 index 00000000000..50224dc5a1c --- /dev/null +++ b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/usercreatewitharray/post/UsercreatewitharrayPostRequestBody.kt @@ -0,0 +1,7 @@ +package org.openapijsonschematools.client.paths.usercreatewitharray.post; + +import org.openapijsonschematools.client.components.requestbodies.UserArray; + +public class UsercreatewitharrayPostRequestBody extends UserArray { + public static class UsercreatewitharrayPostRequestBody1 extends UserArray1 {} +} diff --git a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/usercreatewitharray/post/UsercreatewitharrayPostResponses.kt b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/usercreatewitharray/post/UsercreatewitharrayPostResponses.kt new file mode 100644 index 00000000000..dac09d18a04 --- /dev/null +++ b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/usercreatewitharray/post/UsercreatewitharrayPostResponses.kt @@ -0,0 +1,37 @@ +package org.openapijsonschematools.client.paths.usercreatewitharray.post; + +import org.openapijsonschematools.client.paths.usercreatewitharray.post.responses.UsercreatewitharrayPostCodedefaultResponse; +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; +import org.checkerframework.checker.nullness.qual.Nullable; + +import java.net.http.HttpResponse; +import java.util.Map; +import java.util.AbstractMap; + +public class UsercreatewitharrayPostResponses { + public sealed interface EndpointResponse permits EndpointUsercreatewitharrayPostCodedefaultResponse {} + + public record EndpointUsercreatewitharrayPostCodedefaultResponse( + HttpResponse response, + Nothing? body, + Nothing? headers + ) implements EndpointResponse, ApiResponse{ + } + + public static final class UsercreatewitharrayPostResponses1 implements ResponsesDeserializer { + private final UsercreatewitharrayPostCodedefaultResponse.UsercreatewitharrayPostCodedefaultResponse1 defaultResponseDeserializer; + public UsercreatewitharrayPostResponses1() { + this.defaultResponseDeserializer = new UsercreatewitharrayPostCodedefaultResponse.UsercreatewitharrayPostCodedefaultResponse1(); + } + + public EndpointResponse deserialize(HttpResponse response, SchemaConfiguration configuration) throws ValidationException, NotImplementedException, ApiException { + var deserializedResponse = defaultResponseDeserializer.deserialize(response, configuration); + return new EndpointUsercreatewitharrayPostCodedefaultResponse(response, deserializedResponse.body(), deserializedResponse.headers()); + } + } +} diff --git a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/usercreatewitharray/post/responses/UsercreatewitharrayPostCodedefaultResponse.kt b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/usercreatewitharray/post/responses/UsercreatewitharrayPostCodedefaultResponse.kt new file mode 100644 index 00000000000..fe3e9c56390 --- /dev/null +++ b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/usercreatewitharray/post/responses/UsercreatewitharrayPostCodedefaultResponse.kt @@ -0,0 +1,45 @@ +package org.openapijsonschematools.client.paths.usercreatewitharray.post.responses; + +import org.openapijsonschematools.client.configurations.SchemaConfiguration; +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; +import java.net.http.HttpResponse; +import java.net.http.HttpHeaders; + +public class UsercreatewitharrayPostCodedefaultResponse { + + public static class UsercreatewitharrayPostCodedefaultResponse1 extends ResponseDeserializer { + public UsercreatewitharrayPostCodedefaultResponse1() { + super( + MapUtils.makeMap( + ) + ); + } + + @Override + protected Nothing? getBody(String contentType, Nothing? mediaType, byte[] body, SchemaConfiguration configuration) { + return null; + } + + @Override + protected Nothing? getHeaders(HttpHeaders headers, SchemaConfiguration configuration) { + return null; + } + } + + @SuppressWarnings("serial") + public static class ResponseApiException extends ApiException { + public DeserializedHttpResponse deserializedResponse; + + public ResponseApiException(String s, HttpResponse response, DeserializedHttpResponse deserializedResponse) { + super(s, response); + this.deserializedResponse = deserializedResponse; + } + } +} diff --git a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/usercreatewithlist/UsercreatewithlistPost.kt b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/usercreatewithlist/UsercreatewithlistPost.kt new file mode 100644 index 00000000000..0d346b0d866 --- /dev/null +++ b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/usercreatewithlist/UsercreatewithlistPost.kt @@ -0,0 +1,183 @@ +package org.openapijsonschematools.client.paths.usercreatewithlist; + +import org.checkerframework.checker.nullness.qual.Nullable; +import org.openapijsonschematools.client.RootServerInfo; +import org.openapijsonschematools.client.paths.usercreatewithlist.post.UsercreatewithlistPostRequestBody; +import org.openapijsonschematools.client.paths.usercreatewithlist.post.UsercreatewithlistPostResponses; +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.requestbody.SerializedRequestBody; +import org.openapijsonschematools.client.paths.Usercreatewithlist; + +import java.io.IOException; +import java.util.ArrayList; +import java.net.http.HttpClient; +import java.net.http.HttpRequest; +import java.time.Duration; +import java.util.List; +import java.util.Map; + +public class UsercreatewithlistPost { + private static class PostProvider { + private static final String method = "post"; + + public static UsercreatewithlistPostResponses.EndpointResponse post( + PostRequest request, + ApiConfiguration apiConfiguration, + SchemaConfiguration schemaConfiguration, + HttpClient client + ) throws IOException, InterruptedException, ValidationException, NotImplementedException, ApiException { + Map> headers = apiConfiguration.getDefaultHeaders(); + + SerializedRequestBody serializedRequestBody = new UsercreatewithlistPostRequestBody.UsercreatewithlistPostRequestBody1().serialize( + request.requestBody + ); + var contentTypeHeaderValues = headers.getOrDefault("Content-Type", new ArrayList<>()); + contentTypeHeaderValues.add(serializedRequestBody.contentType); + HttpRequest.BodyPublisher bodyPublisher = serializedRequestBody.bodyPublisher; + // TODO set this to a map if there is a query security scheme + @Nullable Map queryMap = null; + String host = apiConfiguration.getServer(request.serverIndex).url(); + + String url = host + Usercreatewithlist.path; + var httpRequest = RestClient.getRequest( + url, + method, + bodyPublisher, + headers, + request.timeout + ); + var response = RestClient.getResponse(httpRequest, client); + var responsesDeserializer = new UsercreatewithlistPostResponses.UsercreatewithlistPostResponses1(); + return responsesDeserializer.deserialize(response, schemaConfiguration); + } + } + + public interface PostOperation { + ApiConfiguration getApiConfiguration(); + SchemaConfiguration getSchemaConfiguration(); + HttpClient getClient(); + default UsercreatewithlistPostResponses.EndpointResponse post(PostRequest request) throws IOException, InterruptedException, ValidationException, NotImplementedException, ApiException { + return PostProvider.post(request, getApiConfiguration(), getSchemaConfiguration(), getClient()); + } + } + + public interface CreateUsersWithListInputOperation { + ApiConfiguration getApiConfiguration(); + SchemaConfiguration getSchemaConfiguration(); + HttpClient getClient(); + default UsercreatewithlistPostResponses.EndpointResponse createUsersWithListInput(PostRequest request) throws IOException, InterruptedException, ValidationException, NotImplementedException, ApiException { + return PostProvider.post(request, getApiConfiguration(), getSchemaConfiguration(), getClient()); + } + } + + public static class Post extends ApiClient implements PostOperation { + public Post(ApiConfiguration apiConfiguration, SchemaConfiguration schemaConfiguration) { + super(apiConfiguration, schemaConfiguration); + } + } + + public static class PostRequest { + public UsercreatewithlistPostRequestBody.SealedRequestBody requestBody; + public RootServerInfo.@Nullable ServerIndex serverIndex; + public @Nullable Duration timeout; + + public PostRequest( + UsercreatewithlistPostRequestBody.SealedRequestBody requestBody, + RootServerInfo.@Nullable ServerIndex serverIndex, + @Nullable Duration timeout + ) { + this.requestBody = requestBody; + this.serverIndex = serverIndex; + this.timeout = timeout; + } + } + + public static class PostNullableRequest { + public UsercreatewithlistPostRequestBody.@Nullable SealedRequestBody requestBody; + public RootServerInfo.@Nullable ServerIndex serverIndex; + public @Nullable Duration timeout; + } + + public interface SetterForServerIndex { + PostNullableRequest getInstance(); + T getBuilderAfterServerIndex(PostNullableRequest instance); + default T serverIndex(RootServerInfo.ServerIndex serverIndex) { + var instance = getInstance(); + instance.serverIndex = serverIndex; + return getBuilderAfterServerIndex(instance); + } + } + + public interface SetterForTimeout { + PostNullableRequest getInstance(); + T getBuilderAfterTimeout(PostNullableRequest instance); + default T timeout(Duration timeout) { + var instance = getInstance(); + instance.timeout = timeout; + return getBuilderAfterTimeout(instance); + } + } + + public interface SetterForRequestBody { + PostNullableRequest getInstance(); + T getBuilderAfterRequestBody(PostNullableRequest instance); + default T requestBody(UsercreatewithlistPostRequestBody.SealedRequestBody requestBody) { + var instance = getInstance(); + instance.requestBody = requestBody; + return getBuilderAfterRequestBody(instance); + } + } + + public static class Post0RequestBuilder implements SetterForServerIndex, SetterForTimeout { + private final PostNullableRequest instance; + + public Post0RequestBuilder(PostNullableRequest instance) { + this.instance = instance; + } + + public PostRequest build() { + var requestBody = instance.requestBody; + if (requestBody == null) { + throw new RuntimeException("invalid null value for required parameter"); + } + return new PostRequest( + requestBody, + instance.serverIndex, + instance.timeout + ); + } + + public PostNullableRequest getInstance() { + return instance; + } + + public Post0RequestBuilder getBuilderAfterServerIndex(PostNullableRequest instance) { + return this; + } + + public Post0RequestBuilder getBuilderAfterTimeout(PostNullableRequest instance) { + return this; + } + } + public static class PostRequestBuilder implements SetterForRequestBody { + private final PostNullableRequest instance; + + public PostRequestBuilder() { + this.instance = new PostNullableRequest(); + } + + public PostNullableRequest getInstance() { + return instance; + } + + public Post0RequestBuilder getBuilderAfterRequestBody(PostNullableRequest instance) { + return new Post0RequestBuilder(instance); + } + } +} diff --git a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/usercreatewithlist/post/UsercreatewithlistPostRequestBody.kt b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/usercreatewithlist/post/UsercreatewithlistPostRequestBody.kt new file mode 100644 index 00000000000..1d84fbcdb44 --- /dev/null +++ b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/usercreatewithlist/post/UsercreatewithlistPostRequestBody.kt @@ -0,0 +1,7 @@ +package org.openapijsonschematools.client.paths.usercreatewithlist.post; + +import org.openapijsonschematools.client.components.requestbodies.RefUserArray; + +public class UsercreatewithlistPostRequestBody extends RefUserArray { + public static class UsercreatewithlistPostRequestBody1 extends RefUserArray1 {} +} diff --git a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/usercreatewithlist/post/UsercreatewithlistPostResponses.kt b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/usercreatewithlist/post/UsercreatewithlistPostResponses.kt new file mode 100644 index 00000000000..f1d18a083ec --- /dev/null +++ b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/usercreatewithlist/post/UsercreatewithlistPostResponses.kt @@ -0,0 +1,37 @@ +package org.openapijsonschematools.client.paths.usercreatewithlist.post; + +import org.openapijsonschematools.client.paths.usercreatewithlist.post.responses.UsercreatewithlistPostCodedefaultResponse; +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; +import org.checkerframework.checker.nullness.qual.Nullable; + +import java.net.http.HttpResponse; +import java.util.Map; +import java.util.AbstractMap; + +public class UsercreatewithlistPostResponses { + public sealed interface EndpointResponse permits EndpointUsercreatewithlistPostCodedefaultResponse {} + + public record EndpointUsercreatewithlistPostCodedefaultResponse( + HttpResponse response, + Nothing? body, + Nothing? headers + ) implements EndpointResponse, ApiResponse{ + } + + public static final class UsercreatewithlistPostResponses1 implements ResponsesDeserializer { + private final UsercreatewithlistPostCodedefaultResponse.UsercreatewithlistPostCodedefaultResponse1 defaultResponseDeserializer; + public UsercreatewithlistPostResponses1() { + this.defaultResponseDeserializer = new UsercreatewithlistPostCodedefaultResponse.UsercreatewithlistPostCodedefaultResponse1(); + } + + public EndpointResponse deserialize(HttpResponse response, SchemaConfiguration configuration) throws ValidationException, NotImplementedException, ApiException { + var deserializedResponse = defaultResponseDeserializer.deserialize(response, configuration); + return new EndpointUsercreatewithlistPostCodedefaultResponse(response, deserializedResponse.body(), deserializedResponse.headers()); + } + } +} diff --git a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/usercreatewithlist/post/responses/UsercreatewithlistPostCodedefaultResponse.kt b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/usercreatewithlist/post/responses/UsercreatewithlistPostCodedefaultResponse.kt new file mode 100644 index 00000000000..c9a33a2d2a8 --- /dev/null +++ b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/usercreatewithlist/post/responses/UsercreatewithlistPostCodedefaultResponse.kt @@ -0,0 +1,45 @@ +package org.openapijsonschematools.client.paths.usercreatewithlist.post.responses; + +import org.openapijsonschematools.client.configurations.SchemaConfiguration; +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; +import java.net.http.HttpResponse; +import java.net.http.HttpHeaders; + +public class UsercreatewithlistPostCodedefaultResponse { + + public static class UsercreatewithlistPostCodedefaultResponse1 extends ResponseDeserializer { + public UsercreatewithlistPostCodedefaultResponse1() { + super( + MapUtils.makeMap( + ) + ); + } + + @Override + protected Nothing? getBody(String contentType, Nothing? mediaType, byte[] body, SchemaConfiguration configuration) { + return null; + } + + @Override + protected Nothing? getHeaders(HttpHeaders headers, SchemaConfiguration configuration) { + return null; + } + } + + @SuppressWarnings("serial") + public static class ResponseApiException extends ApiException { + public DeserializedHttpResponse deserializedResponse; + + public ResponseApiException(String s, HttpResponse response, DeserializedHttpResponse deserializedResponse) { + super(s, response); + this.deserializedResponse = deserializedResponse; + } + } +} diff --git a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/userlogin/UserloginGet.kt b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/userlogin/UserloginGet.kt new file mode 100644 index 00000000000..5a65e591c6d --- /dev/null +++ b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/userlogin/UserloginGet.kt @@ -0,0 +1,180 @@ +package org.openapijsonschematools.client.paths.userlogin; + +import org.checkerframework.checker.nullness.qual.Nullable; +import org.openapijsonschematools.client.RootServerInfo; +import org.openapijsonschematools.client.paths.userlogin.get.UserloginGetQueryParameters; +import org.openapijsonschematools.client.paths.userlogin.get.Parameters; +import org.openapijsonschematools.client.paths.userlogin.get.UserloginGetResponses; +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.paths.Userlogin; + +import java.io.IOException; +import java.net.http.HttpClient; +import java.net.http.HttpRequest; +import java.time.Duration; +import java.util.List; +import java.util.Map; + +public class UserloginGet { + private static class GetProvider { + private static final String method = "get"; + + public static UserloginGetResponses.EndpointResponse get( + GetRequest request, + ApiConfiguration apiConfiguration, + SchemaConfiguration schemaConfiguration, + HttpClient client + ) throws IOException, InterruptedException, ValidationException, NotImplementedException, ApiException { + Map> headers = apiConfiguration.getDefaultHeaders(); + HttpRequest.BodyPublisher bodyPublisher = HttpRequest.BodyPublishers.noBody(); + + var querySerializer = new Parameters.QueryParametersSerializer(); + @Nullable Map queryMap = querySerializer.getQueryMap(request.queryParameters); + String host = apiConfiguration.getServer(request.serverIndex).url(); + + String url = host + Userlogin.path; + if (queryMap != null) { + url = url + querySerializer.serialize(queryMap); + } + var httpRequest = RestClient.getRequest( + url, + method, + bodyPublisher, + headers, + request.timeout + ); + var response = RestClient.getResponse(httpRequest, client); + var responsesDeserializer = new UserloginGetResponses.UserloginGetResponses1(); + return responsesDeserializer.deserialize(response, schemaConfiguration); + } + } + + public interface GetOperation { + ApiConfiguration getApiConfiguration(); + SchemaConfiguration getSchemaConfiguration(); + HttpClient getClient(); + default UserloginGetResponses.EndpointResponse get(GetRequest request) throws IOException, InterruptedException, ValidationException, NotImplementedException, ApiException { + return GetProvider.get(request, getApiConfiguration(), getSchemaConfiguration(), getClient()); + } + } + + public interface LoginUserOperation { + ApiConfiguration getApiConfiguration(); + SchemaConfiguration getSchemaConfiguration(); + HttpClient getClient(); + default UserloginGetResponses.EndpointResponse loginUser(GetRequest request) throws IOException, InterruptedException, ValidationException, NotImplementedException, ApiException { + return GetProvider.get(request, getApiConfiguration(), getSchemaConfiguration(), getClient()); + } + } + + public static class Get extends ApiClient implements GetOperation { + public Get(ApiConfiguration apiConfiguration, SchemaConfiguration schemaConfiguration) { + super(apiConfiguration, schemaConfiguration); + } + } + + public static class GetRequest { + public UserloginGetQueryParameters.QueryParametersMap queryParameters; + public RootServerInfo.@Nullable ServerIndex serverIndex; + public @Nullable Duration timeout; + + public GetRequest( + UserloginGetQueryParameters.QueryParametersMap queryParameters, + RootServerInfo.@Nullable ServerIndex serverIndex, + @Nullable Duration timeout + ) { + this.queryParameters = queryParameters; + this.serverIndex = serverIndex; + this.timeout = timeout; + } + } + + public static class GetNullableRequest { + public UserloginGetQueryParameters.@Nullable QueryParametersMap queryParameters; + public RootServerInfo.@Nullable ServerIndex serverIndex; + public @Nullable Duration timeout; + } + + public interface SetterForServerIndex { + GetNullableRequest getInstance(); + T getBuilderAfterServerIndex(GetNullableRequest instance); + default T serverIndex(RootServerInfo.ServerIndex serverIndex) { + var instance = getInstance(); + instance.serverIndex = serverIndex; + return getBuilderAfterServerIndex(instance); + } + } + + public interface SetterForTimeout { + GetNullableRequest getInstance(); + T getBuilderAfterTimeout(GetNullableRequest instance); + default T timeout(Duration timeout) { + var instance = getInstance(); + instance.timeout = timeout; + return getBuilderAfterTimeout(instance); + } + } + + public interface SetterForQueryParameters { + GetNullableRequest getInstance(); + T getBuilderAfterQueryParameters(GetNullableRequest instance); + default T queryParameters(UserloginGetQueryParameters.QueryParametersMap queryParameters) { + var instance = getInstance(); + instance.queryParameters = queryParameters; + return getBuilderAfterQueryParameters(instance); + } + } + + public static class Get0RequestBuilder implements SetterForServerIndex, SetterForTimeout { + private final GetNullableRequest instance; + + public Get0RequestBuilder(GetNullableRequest instance) { + this.instance = instance; + } + + public GetRequest build() { + var queryParameters = instance.queryParameters; + if (queryParameters == null) { + throw new RuntimeException("invalid null value for required parameter"); + } + return new GetRequest( + queryParameters, + instance.serverIndex, + instance.timeout + ); + } + + public GetNullableRequest getInstance() { + return instance; + } + + public Get0RequestBuilder getBuilderAfterServerIndex(GetNullableRequest instance) { + return this; + } + + public Get0RequestBuilder getBuilderAfterTimeout(GetNullableRequest instance) { + return this; + } + } + public static class GetRequestBuilder implements SetterForQueryParameters { + private final GetNullableRequest instance; + + public GetRequestBuilder() { + this.instance = new GetNullableRequest(); + } + + public GetNullableRequest getInstance() { + return instance; + } + + public Get0RequestBuilder getBuilderAfterQueryParameters(GetNullableRequest instance) { + return new Get0RequestBuilder(instance); + } + } +} diff --git a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/userlogin/get/Parameters.kt b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/userlogin/get/Parameters.kt new file mode 100644 index 00000000000..0e29f41858d --- /dev/null +++ b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/userlogin/get/Parameters.kt @@ -0,0 +1,22 @@ +package org.openapijsonschematools.client.paths.userlogin.get; + +import org.openapijsonschematools.client.paths.userlogin.get.parameters.Parameter0; +import org.openapijsonschematools.client.paths.userlogin.get.parameters.Parameter1; +import org.openapijsonschematools.client.parameter.QuerySerializer; + +import java.util.Map; +import java.util.AbstractMap; + +public class Parameters { + + public static class QueryParametersSerializer extends QuerySerializer { + public QueryParametersSerializer() { + super( + Map.ofEntries( + new AbstractMap.SimpleEntry<>("username", new Parameter0.Parameter01()), + new AbstractMap.SimpleEntry<>("password", new Parameter1.Parameter11()) + ) + ); + } + } +} diff --git a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/userlogin/get/UserloginGetQueryParameters.kt b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/userlogin/get/UserloginGetQueryParameters.kt new file mode 100644 index 00000000000..dba33bd9efc --- /dev/null +++ b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/userlogin/get/UserloginGetQueryParameters.kt @@ -0,0 +1,255 @@ +package org.openapijsonschematools.client.paths.userlogin.get; +import java.util.ArrayList; +import java.util.HashSet; +import java.util.LinkedHashMap; +import java.util.LinkedHashSet; +import java.util.List; +import java.util.Map; +import java.util.Objects; +import java.util.Set; +import org.checkerframework.checker.nullness.qual.Nullable; +import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags; +import org.openapijsonschematools.client.configurations.SchemaConfiguration; +import org.openapijsonschematools.client.exceptions.UnsetPropertyException; +import org.openapijsonschematools.client.exceptions.ValidationException; +import org.openapijsonschematools.client.paths.userlogin.get.parameters.parameter0.Schema0; +import org.openapijsonschematools.client.paths.userlogin.get.parameters.parameter1.Schema1; +import org.openapijsonschematools.client.schemas.AnyTypeJsonSchema; +import org.openapijsonschematools.client.schemas.GenericBuilder; +import org.openapijsonschematools.client.schemas.NotAnyTypeJsonSchema; +import org.openapijsonschematools.client.schemas.validation.FrozenMap; +import org.openapijsonschematools.client.schemas.validation.JsonSchema; +import org.openapijsonschematools.client.schemas.validation.JsonSchemaInfo; +import org.openapijsonschematools.client.schemas.validation.MapSchemaValidator; +import org.openapijsonschematools.client.schemas.validation.MapUtils; +import org.openapijsonschematools.client.schemas.validation.PathToSchemasMap; +import org.openapijsonschematools.client.schemas.validation.PropertyEntry; +import org.openapijsonschematools.client.schemas.validation.ValidationMetadata; + +public class UserloginGetQueryParameters { + // nest classes so all schemas and input/output classes can be public + + + public static class AdditionalProperties extends NotAnyTypeJsonSchema.NotAnyTypeJsonSchema1 { + // NotAnyTypeSchema + private static @Nullable AdditionalProperties instance = null; + public static AdditionalProperties getInstance() { + if (instance == null) { + instance = new AdditionalProperties(); + } + return instance; + } + } + + + public static class QueryParametersMap extends FrozenMap<@Nullable Object> { + protected QueryParametersMap(FrozenMap<@Nullable Object> m) { + super(m); + } + public static final Set requiredKeys = Set.of( + "password", + "username" + ); + public static final Set optionalKeys = Set.of(); + public static QueryParametersMap of(Map arg, SchemaConfiguration configuration) throws ValidationException { + return UserloginGetQueryParameters1.getInstance().validate(arg, configuration); + } + + public String password() { + @Nullable Object value = get("password"); + if (!(value instanceof String)) { + throw new RuntimeException("Invalid value stored for password"); + } + return (String) value; + } + + public String username() { + @Nullable Object value = get("username"); + if (!(value instanceof String)) { + throw new RuntimeException("Invalid value stored for username"); + } + return (String) value; + } + } + + public interface SetterForPassword { + Map getInstance(); + T getBuilderAfterPassword(Map instance); + + default T password(String value) { + var instance = getInstance(); + instance.put("password", value); + return getBuilderAfterPassword(instance); + } + } + + public interface SetterForUsername { + Map getInstance(); + T getBuilderAfterUsername(Map instance); + + default T username(String value) { + var instance = getInstance(); + instance.put("username", value); + return getBuilderAfterUsername(instance); + } + } + + public static class QueryParametersMap00Builder implements GenericBuilder> { + private final Map instance; + private static final Set knownKeys = Set.of( + "password", + "username" + ); + public Set getKnownKeys() { + return knownKeys; + } + public QueryParametersMap00Builder(Map instance) { + this.instance = instance; + } + public Map build() { + return instance; + } + } + + public static class QueryParametersMap01Builder implements SetterForUsername { + private final Map instance; + public QueryParametersMap01Builder(Map instance) { + this.instance = instance; + } + public Map getInstance() { + return instance; + } + public QueryParametersMap00Builder getBuilderAfterUsername(Map instance) { + return new QueryParametersMap00Builder(instance); + } + } + + public static class QueryParametersMap10Builder implements SetterForPassword { + private final Map instance; + public QueryParametersMap10Builder(Map instance) { + this.instance = instance; + } + public Map getInstance() { + return instance; + } + public QueryParametersMap00Builder getBuilderAfterPassword(Map instance) { + return new QueryParametersMap00Builder(instance); + } + } + + public static class QueryParametersMapBuilder implements SetterForPassword, SetterForUsername { + private final Map instance; + public QueryParametersMapBuilder() { + this.instance = new LinkedHashMap<>(); + } + public Map getInstance() { + return instance; + } + public QueryParametersMap01Builder getBuilderAfterPassword(Map instance) { + return new QueryParametersMap01Builder(instance); + } + public QueryParametersMap10Builder getBuilderAfterUsername(Map instance) { + return new QueryParametersMap10Builder(instance); + } + } + + + public sealed interface UserloginGetQueryParameters1Boxed permits UserloginGetQueryParameters1BoxedMap { + @Nullable Object getData(); + } + + public record UserloginGetQueryParameters1BoxedMap(QueryParametersMap data) implements UserloginGetQueryParameters1Boxed { + @Override + public @Nullable Object getData() { + return data; + } + } + + + public static class UserloginGetQueryParameters1 extends JsonSchema implements MapSchemaValidator { + private static @Nullable UserloginGetQueryParameters1 instance = null; + + protected UserloginGetQueryParameters1() { + super(new JsonSchemaInfo() + .type(Set.of(Map.class)) + .properties(Map.ofEntries( + new PropertyEntry("password", Schema1.Schema11.class), + new PropertyEntry("username", Schema0.Schema01.class) + )) + .required(Set.of( + "password", + "username" + )) + .additionalProperties(AdditionalProperties.class) + ); + } + + public static UserloginGetQueryParameters1 getInstance() { + if (instance == null) { + instance = new UserloginGetQueryParameters1(); + } + return instance; + } + + 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 RuntimeException("Invalid non-string key value"); + } + String propertyName = (String) entryKey; + List propertyPathToItem = new ArrayList<>(pathToItem); + propertyPathToItem.add(propertyName); + Object value = entry.getValue(); + LinkedHashMap, Nothing?> schemas = pathToSchemas.get(propertyPathToItem); + if (schemas == null) { + throw new RuntimeException("Validation result is invalid, schemas must exist for a pathToItem"); + } + JsonSchema propertySchema = schemas.entrySet().iterator().next().getKey(); + @Nullable Object propertyInstance = propertySchema.getNewInstance(value, propertyPathToItem, pathToSchemas); + properties.put(propertyName, propertyInstance); + } + FrozenMap<@Nullable Object> castProperties = new FrozenMap<>(properties); + return new QueryParametersMap(castProperties); + } + + 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); + SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().build())); + ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, new PathToSchemasMap(), new LinkedHashSet<>()); + PathToSchemasMap pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet); + return getNewInstance(castArg, validationMetadata.pathToItem(), pathToSchemasMap); + } + + + @Override + public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws 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"); + } + @Override + public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { + if (arg instanceof Map) { + return getNewInstance((Map) arg, pathToItem, pathToSchemas); + } + throw new RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); + } + @Override + public UserloginGetQueryParameters1BoxedMap validateAndBox(Map arg, SchemaConfiguration configuration) throws ValidationException { + return new UserloginGetQueryParameters1BoxedMap(validate(arg, configuration)); + } + @Override + public UserloginGetQueryParameters1Boxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { + 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"); + } + } + +} diff --git a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/userlogin/get/UserloginGetResponses.kt b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/userlogin/get/UserloginGetResponses.kt new file mode 100644 index 00000000000..8e5613c7641 --- /dev/null +++ b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/userlogin/get/UserloginGetResponses.kt @@ -0,0 +1,67 @@ +package org.openapijsonschematools.client.paths.userlogin.get; + +import org.openapijsonschematools.client.paths.userlogin.get.responses.UserloginGetCode200Response; +import org.openapijsonschematools.client.paths.userlogin.get.responses.code200response.UserloginGetCode200ResponseHeadersSchema; +import org.openapijsonschematools.client.paths.userlogin.get.responses.UserloginGetCode400Response; +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; +import org.checkerframework.checker.nullness.qual.Nullable; + +import java.net.http.HttpResponse; +import java.util.Map; +import java.util.AbstractMap; + +public class UserloginGetResponses { + public sealed interface EndpointResponse permits EndpointUserloginGetCode200Response {} + + public record EndpointUserloginGetCode200Response( + HttpResponse response, + UserloginGetCode200Response.SealedResponseBody body, + UserloginGetCode200ResponseHeadersSchema.UserloginGetCode200ResponseHeadersSchemaMap headers + ) implements EndpointResponse, ApiResponse{ + } + + public sealed interface StatusCodeResponseDeserializer permits StatusUserloginGetCode200ResponseDeserializer, StatusUserloginGetCode400ResponseDeserializer {} + + public static final class StatusUserloginGetCode200ResponseDeserializer extends UserloginGetCode200Response.UserloginGetCode200Response1 implements StatusCodeResponseDeserializer { + } + public static final class StatusUserloginGetCode400ResponseDeserializer extends UserloginGetCode400Response.UserloginGetCode400Response1 implements StatusCodeResponseDeserializer { + } + + public static final class UserloginGetResponses1 implements ResponsesDeserializer { + private final Map statusCodeToResponseDeserializer; + public UserloginGetResponses1() { + this.statusCodeToResponseDeserializer = Map.ofEntries( + new AbstractMap.SimpleEntry<>("200", new StatusUserloginGetCode200ResponseDeserializer()), + new AbstractMap.SimpleEntry<>("400", new StatusUserloginGetCode400ResponseDeserializer()) + ); + } + + 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) { + throw new ApiException( + "Invalid response statusCode="+statusCode+" has no response defined in the openapi document", + response + ); + } + if (statusCodeDeserializer instanceof StatusUserloginGetCode200ResponseDeserializer castDeserializer) { + var deserializedResponse = castDeserializer.deserialize(response, configuration); + return new EndpointUserloginGetCode200Response(response, deserializedResponse.body(), deserializedResponse.headers()); + } else { + StatusUserloginGetCode400ResponseDeserializer castDeserializer = (StatusUserloginGetCode400ResponseDeserializer) statusCodeDeserializer; + var deserializedResponse = castDeserializer.deserialize(response, configuration); + throw new UserloginGetCode400Response.ResponseApiException( + "Received error statusCode response from server", + response, + deserializedResponse + ); + } + } + } +} diff --git a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/userlogin/get/parameters/Parameter0.kt b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/userlogin/get/parameters/Parameter0.kt new file mode 100644 index 00000000000..db4b2c26b2e --- /dev/null +++ b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/userlogin/get/parameters/Parameter0.kt @@ -0,0 +1,23 @@ +package org.openapijsonschematools.client.paths.userlogin.get.parameters; + +import org.openapijsonschematools.client.parameter.ParameterStyle; +import org.openapijsonschematools.client.parameter.ParameterInType; +import org.openapijsonschematools.client.parameter.SchemaParameter; +import org.openapijsonschematools.client.paths.userlogin.get.parameters.parameter0.Schema0; + +public class Parameter0 { + + public static class Parameter01 extends SchemaParameter { + public Parameter01() { + super( + "username", + ParameterInType.QUERY, + true, + ParameterStyle.FORM, + true, + false, + Schema0.Schema01.getInstance() + ); + } + } +} diff --git a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/userlogin/get/parameters/Parameter1.kt b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/userlogin/get/parameters/Parameter1.kt new file mode 100644 index 00000000000..958cf010fab --- /dev/null +++ b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/userlogin/get/parameters/Parameter1.kt @@ -0,0 +1,23 @@ +package org.openapijsonschematools.client.paths.userlogin.get.parameters; + +import org.openapijsonschematools.client.parameter.ParameterStyle; +import org.openapijsonschematools.client.parameter.ParameterInType; +import org.openapijsonschematools.client.parameter.SchemaParameter; +import org.openapijsonschematools.client.paths.userlogin.get.parameters.parameter1.Schema1; + +public class Parameter1 { + + public static class Parameter11 extends SchemaParameter { + public Parameter11() { + super( + "password", + ParameterInType.QUERY, + true, + ParameterStyle.FORM, + true, + false, + Schema1.Schema11.getInstance() + ); + } + } +} diff --git a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/userlogin/get/parameters/parameter0/Schema0.kt b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/userlogin/get/parameters/parameter0/Schema0.kt new file mode 100644 index 00000000000..8450f67fc2b --- /dev/null +++ b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/userlogin/get/parameters/parameter0/Schema0.kt @@ -0,0 +1,19 @@ +package org.openapijsonschematools.client.paths.userlogin.get.parameters.parameter0; +import org.checkerframework.checker.nullness.qual.Nullable; +import org.openapijsonschematools.client.schemas.StringJsonSchema; + +public class Schema0 extends StringJsonSchema { + // nest classes so all schemas and input/output classes can be public + + + public static class Schema01 extends StringJsonSchema.StringJsonSchema1 { + private static @Nullable Schema01 instance = null; + public static Schema01 getInstance() { + if (instance == null) { + instance = new Schema01(); + } + return instance; + } + } + +} diff --git a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/userlogin/get/parameters/parameter1/Schema1.kt b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/userlogin/get/parameters/parameter1/Schema1.kt new file mode 100644 index 00000000000..9eed3552b1f --- /dev/null +++ b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/userlogin/get/parameters/parameter1/Schema1.kt @@ -0,0 +1,19 @@ +package org.openapijsonschematools.client.paths.userlogin.get.parameters.parameter1; +import org.checkerframework.checker.nullness.qual.Nullable; +import org.openapijsonschematools.client.schemas.StringJsonSchema; + +public class Schema1 extends StringJsonSchema { + // nest classes so all schemas and input/output classes can be public + + + public static class Schema11 extends StringJsonSchema.StringJsonSchema1 { + private static @Nullable Schema11 instance = null; + public static Schema11 getInstance() { + if (instance == null) { + instance = new Schema11(); + } + return instance; + } + } + +} diff --git a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/userlogin/get/responses/UserloginGetCode200Response.kt b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/userlogin/get/responses/UserloginGetCode200Response.kt new file mode 100644 index 00000000000..e03383d6139 --- /dev/null +++ b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/userlogin/get/responses/UserloginGetCode200Response.kt @@ -0,0 +1,83 @@ +package org.openapijsonschematools.client.paths.userlogin.get.responses; + +import org.openapijsonschematools.client.configurations.SchemaConfiguration; +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; +import org.openapijsonschematools.client.paths.userlogin.get.responses.code200response.UserloginGetCode200ResponseHeadersSchema; +import org.openapijsonschematools.client.paths.userlogin.get.responses.code200response.Headers; + +import java.util.AbstractMap; +import java.util.Map; +import java.net.http.HttpResponse; +import java.net.http.HttpHeaders; + +public class UserloginGetCode200Response { + public sealed interface SealedMediaType permits ApplicationxmlMediaType, ApplicationjsonMediaType {} + + public record ApplicationxmlMediaType(ApplicationxmlSchema.ApplicationxmlSchema1 schema) implements SealedMediaType, MediaType { + public ApplicationxmlMediaType() { + this(ApplicationxmlSchema.ApplicationxmlSchema1.getInstance()); + } + @Override + public Nothing? encoding() { + return null; + } + } + + public record ApplicationjsonMediaType(ApplicationjsonSchema.ApplicationjsonSchema1 schema) implements SealedMediaType, MediaType { + public ApplicationjsonMediaType() { + this(ApplicationjsonSchema.ApplicationjsonSchema1.getInstance()); + } + @Override + public Nothing? encoding() { + return null; + } + } + public sealed interface SealedResponseBody permits ApplicationxmlResponseBody, ApplicationjsonResponseBody {} + public record ApplicationxmlResponseBody(ApplicationxmlSchema.StringJsonSchema1Boxed body) implements SealedResponseBody { } + public record ApplicationjsonResponseBody(ApplicationjsonSchema.StringJsonSchema1Boxed body) implements SealedResponseBody { } + + public static class UserloginGetCode200Response1 extends ResponseDeserializer { + public UserloginGetCode200Response1() { + super( + Map.ofEntries( + new AbstractMap.SimpleEntry<>("application/xml", new ApplicationxmlMediaType()), + new AbstractMap.SimpleEntry<>("application/json", new ApplicationjsonMediaType()) + ) + ); + } + + @Override + 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 { + ApplicationjsonMediaType thisMediaType = (ApplicationjsonMediaType) mediaType; + var deserializedBody = deserializeBody(contentType, body, thisMediaType.schema(), configuration); + return new ApplicationjsonResponseBody(deserializedBody); + } + } + + @Override + protected UserloginGetCode200ResponseHeadersSchema.UserloginGetCode200ResponseHeadersSchemaMap getHeaders(HttpHeaders headers, SchemaConfiguration configuration) throws ValidationException, NotImplementedException { + return new Headers().deserialize(headers, configuration); + } + } + + @SuppressWarnings("serial") + public static class ResponseApiException extends ApiException { + public DeserializedHttpResponse deserializedResponse; + + public ResponseApiException(String s, HttpResponse response, DeserializedHttpResponse deserializedResponse) { + super(s, response); + this.deserializedResponse = deserializedResponse; + } + } +} diff --git a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/userlogin/get/responses/UserloginGetCode400Response.kt b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/userlogin/get/responses/UserloginGetCode400Response.kt new file mode 100644 index 00000000000..22bfaaa2ddd --- /dev/null +++ b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/userlogin/get/responses/UserloginGetCode400Response.kt @@ -0,0 +1,45 @@ +package org.openapijsonschematools.client.paths.userlogin.get.responses; + +import org.openapijsonschematools.client.configurations.SchemaConfiguration; +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; +import java.net.http.HttpResponse; +import java.net.http.HttpHeaders; + +public class UserloginGetCode400Response { + + public static class UserloginGetCode400Response1 extends ResponseDeserializer { + public UserloginGetCode400Response1() { + super( + MapUtils.makeMap( + ) + ); + } + + @Override + protected Nothing? getBody(String contentType, Nothing? mediaType, byte[] body, SchemaConfiguration configuration) { + return null; + } + + @Override + protected Nothing? getHeaders(HttpHeaders headers, SchemaConfiguration configuration) { + return null; + } + } + + @SuppressWarnings("serial") + public static class ResponseApiException extends ApiException { + public DeserializedHttpResponse deserializedResponse; + + public ResponseApiException(String s, HttpResponse response, DeserializedHttpResponse deserializedResponse) { + super(s, response); + this.deserializedResponse = deserializedResponse; + } + } +} diff --git a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/userlogin/get/responses/code200response/Headers.kt b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/userlogin/get/responses/code200response/Headers.kt new file mode 100644 index 00000000000..5c6b5922c54 --- /dev/null +++ b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/userlogin/get/responses/code200response/Headers.kt @@ -0,0 +1,26 @@ +package org.openapijsonschematools.client.paths.userlogin.get.responses.code200response; + +import org.openapijsonschematools.client.response.HeadersDeserializer; +import org.openapijsonschematools.client.paths.userlogin.get.responses.code200response.headers.XRateLimit; +import org.openapijsonschematools.client.paths.userlogin.get.responses.code200response.headers.Int32; +import org.openapijsonschematools.client.paths.userlogin.get.responses.code200response.headers.XExpiresAfter; +import org.openapijsonschematools.client.paths.userlogin.get.responses.code200response.headers.Refcontentschemaheader; +import org.openapijsonschematools.client.paths.userlogin.get.responses.code200response.headers.NumberHeader; + +import java.util.Map; +import java.util.AbstractMap; + +public class Headers extends HeadersDeserializer { + public Headers() { + super( + Map.ofEntries( + new AbstractMap.SimpleEntry<>("X-Rate-Limit", new XRateLimit.XRateLimit1()), + new AbstractMap.SimpleEntry<>("int32", new Int32.Int321()), + new AbstractMap.SimpleEntry<>("X-Expires-After", new XExpiresAfter.XExpiresAfter1()), + new AbstractMap.SimpleEntry<>("ref-content-schema-header", new Refcontentschemaheader.Refcontentschemaheader1()), + new AbstractMap.SimpleEntry<>("numberHeader", new NumberHeader.NumberHeader1()) + ), + UserloginGetCode200ResponseHeadersSchema.UserloginGetCode200ResponseHeadersSchema1.getInstance() + ); + } +} \ No newline at end of file diff --git a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/userlogin/get/responses/code200response/UserloginGetCode200ResponseHeadersSchema.kt b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/userlogin/get/responses/code200response/UserloginGetCode200ResponseHeadersSchema.kt new file mode 100644 index 00000000000..6a846409e2d --- /dev/null +++ b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/userlogin/get/responses/code200response/UserloginGetCode200ResponseHeadersSchema.kt @@ -0,0 +1,389 @@ +package org.openapijsonschematools.client.paths.userlogin.get.responses.code200response; +import java.util.ArrayList; +import java.util.HashSet; +import java.util.LinkedHashMap; +import java.util.LinkedHashSet; +import java.util.List; +import java.util.Map; +import java.util.Objects; +import java.util.Set; +import org.checkerframework.checker.nullness.qual.Nullable; +import org.openapijsonschematools.client.components.headers.int32jsoncontenttypeheader.content.applicationjson.Int32JsonContentTypeHeaderSchema; +import org.openapijsonschematools.client.components.headers.numberheader.NumberHeaderSchema; +import org.openapijsonschematools.client.components.schemas.StringWithValidation; +import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags; +import org.openapijsonschematools.client.configurations.SchemaConfiguration; +import org.openapijsonschematools.client.exceptions.UnsetPropertyException; +import org.openapijsonschematools.client.exceptions.ValidationException; +import org.openapijsonschematools.client.paths.userlogin.get.responses.code200response.headers.xexpiresafter.XExpiresAfterSchema; +import org.openapijsonschematools.client.paths.userlogin.get.responses.code200response.headers.xratelimit.content.applicationjson.XRateLimitSchema; +import org.openapijsonschematools.client.schemas.AnyTypeJsonSchema; +import org.openapijsonschematools.client.schemas.GenericBuilder; +import org.openapijsonschematools.client.schemas.NotAnyTypeJsonSchema; +import org.openapijsonschematools.client.schemas.validation.FrozenMap; +import org.openapijsonschematools.client.schemas.validation.JsonSchema; +import org.openapijsonschematools.client.schemas.validation.JsonSchemaInfo; +import org.openapijsonschematools.client.schemas.validation.MapSchemaValidator; +import org.openapijsonschematools.client.schemas.validation.MapUtils; +import org.openapijsonschematools.client.schemas.validation.PathToSchemasMap; +import org.openapijsonschematools.client.schemas.validation.PropertyEntry; +import org.openapijsonschematools.client.schemas.validation.ValidationMetadata; + +public class UserloginGetCode200ResponseHeadersSchema { + // nest classes so all schemas and input/output classes can be public + + + public static class UserloginGetCode200ResponseAdditionalProperties extends NotAnyTypeJsonSchema.NotAnyTypeJsonSchema1 { + // NotAnyTypeSchema + private static @Nullable UserloginGetCode200ResponseAdditionalProperties instance = null; + public static UserloginGetCode200ResponseAdditionalProperties getInstance() { + if (instance == null) { + instance = new UserloginGetCode200ResponseAdditionalProperties(); + } + return instance; + } + } + + + public static class UserloginGetCode200ResponseHeadersSchemaMap extends FrozenMap<@Nullable Object> { + protected UserloginGetCode200ResponseHeadersSchemaMap(FrozenMap<@Nullable Object> m) { + super(m); + } + public static final Set requiredKeys = Set.of( + "X-Rate-Limit", + "int32", + "ref-content-schema-header" + ); + public static final Set optionalKeys = Set.of( + "X-Expires-After", + "numberHeader" + ); + public static UserloginGetCode200ResponseHeadersSchemaMap of(Map arg, SchemaConfiguration configuration) throws ValidationException { + return UserloginGetCode200ResponseHeadersSchema1.getInstance().validate(arg, configuration); + } + + public Number int32() { + @Nullable Object value = get("int32"); + if (!(value instanceof Number)) { + throw new RuntimeException("Invalid value stored for int32"); + } + return (Number) value; + } + + public String numberHeader() throws UnsetPropertyException { + String key = "numberHeader"; + throwIfKeyNotPresent(key); + @Nullable Object value = get(key); + if (!(value instanceof String)) { + throw new RuntimeException("Invalid value stored for numberHeader"); + } + return (String) value; + } + } + + public interface SetterForUserloginGetCode200ResponseXRateLimit { + Map getInstance(); + T getBuilderAfterUserloginGetCode200ResponseXRateLimit(Map instance); + + default T xHyphenMinusRateHyphenMinusLimit(int value) { + var instance = getInstance(); + instance.put("X-Rate-Limit", value); + return getBuilderAfterUserloginGetCode200ResponseXRateLimit(instance); + } + + default T xHyphenMinusRateHyphenMinusLimit(float value) { + var instance = getInstance(); + instance.put("X-Rate-Limit", value); + return getBuilderAfterUserloginGetCode200ResponseXRateLimit(instance); + } + } + + public interface SetterForUserloginGetCode200ResponseInt32 { + Map getInstance(); + T getBuilderAfterUserloginGetCode200ResponseInt32(Map instance); + + default T int32(int value) { + var instance = getInstance(); + instance.put("int32", value); + return getBuilderAfterUserloginGetCode200ResponseInt32(instance); + } + + default T int32(float value) { + var instance = getInstance(); + instance.put("int32", value); + return getBuilderAfterUserloginGetCode200ResponseInt32(instance); + } + } + + public interface SetterForUserloginGetCode200ResponseRefcontentschemaheader { + Map getInstance(); + T getBuilderAfterUserloginGetCode200ResponseRefcontentschemaheader(Map instance); + + default T refHyphenMinusContentHyphenMinusSchemaHyphenMinusHeader(String value) { + var instance = getInstance(); + instance.put("ref-content-schema-header", value); + return getBuilderAfterUserloginGetCode200ResponseRefcontentschemaheader(instance); + } + } + + public interface SetterForUserloginGetCode200ResponseXExpiresAfter { + Map getInstance(); + T getBuilderAfterUserloginGetCode200ResponseXExpiresAfter(Map instance); + + default T xHyphenMinusExpiresHyphenMinusAfter(String value) { + var instance = getInstance(); + instance.put("X-Expires-After", value); + return getBuilderAfterUserloginGetCode200ResponseXExpiresAfter(instance); + } + } + + public interface SetterForUserloginGetCode200ResponseNumberHeader { + Map getInstance(); + T getBuilderAfterUserloginGetCode200ResponseNumberHeader(Map instance); + + default T numberHeader(String value) { + var instance = getInstance(); + instance.put("numberHeader", value); + return getBuilderAfterUserloginGetCode200ResponseNumberHeader(instance); + } + } + + public static class UserloginGetCode200ResponseHeadersSchemaMap000Builder implements GenericBuilder>, SetterForUserloginGetCode200ResponseXExpiresAfter, SetterForUserloginGetCode200ResponseNumberHeader { + private final Map instance; + private static final Set knownKeys = Set.of( + "X-Rate-Limit", + "int32", + "ref-content-schema-header", + "X-Expires-After", + "numberHeader" + ); + public Set getKnownKeys() { + return knownKeys; + } + public UserloginGetCode200ResponseHeadersSchemaMap000Builder(Map instance) { + this.instance = instance; + } + public Map build() { + return instance; + } + public Map getInstance() { + return instance; + } + public UserloginGetCode200ResponseHeadersSchemaMap000Builder getBuilderAfterUserloginGetCode200ResponseXExpiresAfter(Map instance) { + return this; + } + public UserloginGetCode200ResponseHeadersSchemaMap000Builder getBuilderAfterUserloginGetCode200ResponseNumberHeader(Map instance) { + return this; + } + } + + public static class UserloginGetCode200ResponseHeadersSchemaMap001Builder implements SetterForUserloginGetCode200ResponseRefcontentschemaheader { + private final Map instance; + public UserloginGetCode200ResponseHeadersSchemaMap001Builder(Map instance) { + this.instance = instance; + } + public Map getInstance() { + return instance; + } + public UserloginGetCode200ResponseHeadersSchemaMap000Builder getBuilderAfterUserloginGetCode200ResponseRefcontentschemaheader(Map instance) { + return new UserloginGetCode200ResponseHeadersSchemaMap000Builder(instance); + } + } + + public static class UserloginGetCode200ResponseHeadersSchemaMap010Builder implements SetterForUserloginGetCode200ResponseInt32 { + private final Map instance; + public UserloginGetCode200ResponseHeadersSchemaMap010Builder(Map instance) { + this.instance = instance; + } + public Map getInstance() { + return instance; + } + public UserloginGetCode200ResponseHeadersSchemaMap000Builder getBuilderAfterUserloginGetCode200ResponseInt32(Map instance) { + return new UserloginGetCode200ResponseHeadersSchemaMap000Builder(instance); + } + } + + public static class UserloginGetCode200ResponseHeadersSchemaMap011Builder implements SetterForUserloginGetCode200ResponseInt32, SetterForUserloginGetCode200ResponseRefcontentschemaheader { + private final Map instance; + public UserloginGetCode200ResponseHeadersSchemaMap011Builder(Map instance) { + this.instance = instance; + } + public Map getInstance() { + return instance; + } + public UserloginGetCode200ResponseHeadersSchemaMap001Builder getBuilderAfterUserloginGetCode200ResponseInt32(Map instance) { + return new UserloginGetCode200ResponseHeadersSchemaMap001Builder(instance); + } + public UserloginGetCode200ResponseHeadersSchemaMap010Builder getBuilderAfterUserloginGetCode200ResponseRefcontentschemaheader(Map instance) { + return new UserloginGetCode200ResponseHeadersSchemaMap010Builder(instance); + } + } + + public static class UserloginGetCode200ResponseHeadersSchemaMap100Builder implements SetterForUserloginGetCode200ResponseXRateLimit { + private final Map instance; + public UserloginGetCode200ResponseHeadersSchemaMap100Builder(Map instance) { + this.instance = instance; + } + public Map getInstance() { + return instance; + } + public UserloginGetCode200ResponseHeadersSchemaMap000Builder getBuilderAfterUserloginGetCode200ResponseXRateLimit(Map instance) { + return new UserloginGetCode200ResponseHeadersSchemaMap000Builder(instance); + } + } + + public static class UserloginGetCode200ResponseHeadersSchemaMap101Builder implements SetterForUserloginGetCode200ResponseXRateLimit, SetterForUserloginGetCode200ResponseRefcontentschemaheader { + private final Map instance; + public UserloginGetCode200ResponseHeadersSchemaMap101Builder(Map instance) { + this.instance = instance; + } + public Map getInstance() { + return instance; + } + public UserloginGetCode200ResponseHeadersSchemaMap001Builder getBuilderAfterUserloginGetCode200ResponseXRateLimit(Map instance) { + return new UserloginGetCode200ResponseHeadersSchemaMap001Builder(instance); + } + public UserloginGetCode200ResponseHeadersSchemaMap100Builder getBuilderAfterUserloginGetCode200ResponseRefcontentschemaheader(Map instance) { + return new UserloginGetCode200ResponseHeadersSchemaMap100Builder(instance); + } + } + + public static class UserloginGetCode200ResponseHeadersSchemaMap110Builder implements SetterForUserloginGetCode200ResponseXRateLimit, SetterForUserloginGetCode200ResponseInt32 { + private final Map instance; + public UserloginGetCode200ResponseHeadersSchemaMap110Builder(Map instance) { + this.instance = instance; + } + public Map getInstance() { + return instance; + } + public UserloginGetCode200ResponseHeadersSchemaMap010Builder getBuilderAfterUserloginGetCode200ResponseXRateLimit(Map instance) { + return new UserloginGetCode200ResponseHeadersSchemaMap010Builder(instance); + } + public UserloginGetCode200ResponseHeadersSchemaMap100Builder getBuilderAfterUserloginGetCode200ResponseInt32(Map instance) { + return new UserloginGetCode200ResponseHeadersSchemaMap100Builder(instance); + } + } + + public static class UserloginGetCode200ResponseHeadersSchemaMapBuilder implements SetterForUserloginGetCode200ResponseXRateLimit, SetterForUserloginGetCode200ResponseInt32, SetterForUserloginGetCode200ResponseRefcontentschemaheader { + private final Map instance; + public UserloginGetCode200ResponseHeadersSchemaMapBuilder() { + this.instance = new LinkedHashMap<>(); + } + public Map getInstance() { + return instance; + } + public UserloginGetCode200ResponseHeadersSchemaMap011Builder getBuilderAfterUserloginGetCode200ResponseXRateLimit(Map instance) { + return new UserloginGetCode200ResponseHeadersSchemaMap011Builder(instance); + } + public UserloginGetCode200ResponseHeadersSchemaMap101Builder getBuilderAfterUserloginGetCode200ResponseInt32(Map instance) { + return new UserloginGetCode200ResponseHeadersSchemaMap101Builder(instance); + } + public UserloginGetCode200ResponseHeadersSchemaMap110Builder getBuilderAfterUserloginGetCode200ResponseRefcontentschemaheader(Map instance) { + return new UserloginGetCode200ResponseHeadersSchemaMap110Builder(instance); + } + } + + + public sealed interface UserloginGetCode200ResponseHeadersSchema1Boxed permits UserloginGetCode200ResponseHeadersSchema1BoxedMap { + @Nullable Object getData(); + } + + public record UserloginGetCode200ResponseHeadersSchema1BoxedMap(UserloginGetCode200ResponseHeadersSchemaMap data) implements UserloginGetCode200ResponseHeadersSchema1Boxed { + @Override + public @Nullable Object getData() { + return data; + } + } + + + public static class UserloginGetCode200ResponseHeadersSchema1 extends JsonSchema implements MapSchemaValidator { + private static @Nullable UserloginGetCode200ResponseHeadersSchema1 instance = null; + + protected UserloginGetCode200ResponseHeadersSchema1() { + super(new JsonSchemaInfo() + .type(Set.of(Map.class)) + .properties(Map.ofEntries( + new PropertyEntry("X-Rate-Limit", XRateLimitSchema.XRateLimitSchema1.class), + new PropertyEntry("int32", Int32JsonContentTypeHeaderSchema.Int32JsonContentTypeHeaderSchema1.class), + new PropertyEntry("X-Expires-After", XExpiresAfterSchema.XExpiresAfterSchema1.class), + new PropertyEntry("ref-content-schema-header", StringWithValidation.StringWithValidation1.class), + new PropertyEntry("numberHeader", NumberHeaderSchema.NumberHeaderSchema1.class) + )) + .required(Set.of( + "X-Rate-Limit", + "int32", + "ref-content-schema-header" + )) + .additionalProperties(UserloginGetCode200ResponseAdditionalProperties.class) + ); + } + + public static UserloginGetCode200ResponseHeadersSchema1 getInstance() { + if (instance == null) { + instance = new UserloginGetCode200ResponseHeadersSchema1(); + } + return instance; + } + + public UserloginGetCode200ResponseHeadersSchemaMap 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 RuntimeException("Invalid non-string key value"); + } + String propertyName = (String) entryKey; + List propertyPathToItem = new ArrayList<>(pathToItem); + propertyPathToItem.add(propertyName); + Object value = entry.getValue(); + LinkedHashMap, Nothing?> schemas = pathToSchemas.get(propertyPathToItem); + if (schemas == null) { + throw new RuntimeException("Validation result is invalid, schemas must exist for a pathToItem"); + } + JsonSchema propertySchema = schemas.entrySet().iterator().next().getKey(); + @Nullable Object propertyInstance = propertySchema.getNewInstance(value, propertyPathToItem, pathToSchemas); + properties.put(propertyName, propertyInstance); + } + FrozenMap<@Nullable Object> castProperties = new FrozenMap<>(properties); + return new UserloginGetCode200ResponseHeadersSchemaMap(castProperties); + } + + public UserloginGetCode200ResponseHeadersSchemaMap validate(Map arg, SchemaConfiguration configuration) throws ValidationException { + Set> pathSet = new HashSet<>(); + List pathToItem = List.of("args[0"); + Map castArg = castToAllowedTypes(arg, pathToItem, pathSet); + SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().build())); + ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, new PathToSchemasMap(), new LinkedHashSet<>()); + PathToSchemasMap pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet); + return getNewInstance(castArg, validationMetadata.pathToItem(), pathToSchemasMap); + } + + + @Override + public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws 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"); + } + @Override + public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { + if (arg instanceof Map) { + return getNewInstance((Map) arg, pathToItem, pathToSchemas); + } + throw new RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); + } + @Override + public UserloginGetCode200ResponseHeadersSchema1BoxedMap validateAndBox(Map arg, SchemaConfiguration configuration) throws ValidationException { + return new UserloginGetCode200ResponseHeadersSchema1BoxedMap(validate(arg, configuration)); + } + @Override + public UserloginGetCode200ResponseHeadersSchema1Boxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { + 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"); + } + } + +} diff --git a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/userlogin/get/responses/code200response/content/applicationjson/ApplicationjsonSchema.kt b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/userlogin/get/responses/code200response/content/applicationjson/ApplicationjsonSchema.kt new file mode 100644 index 00000000000..93f4ea3148c --- /dev/null +++ b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/userlogin/get/responses/code200response/content/applicationjson/ApplicationjsonSchema.kt @@ -0,0 +1,19 @@ +package org.openapijsonschematools.client.paths.userlogin.get.responses.code200response.content.applicationjson; +import org.checkerframework.checker.nullness.qual.Nullable; +import org.openapijsonschematools.client.schemas.StringJsonSchema; + +public class ApplicationjsonSchema extends StringJsonSchema { + // nest classes so all schemas and input/output classes can be public + + + public static class ApplicationjsonSchema1 extends StringJsonSchema.StringJsonSchema1 { + private static @Nullable ApplicationjsonSchema1 instance = null; + public static ApplicationjsonSchema1 getInstance() { + if (instance == null) { + instance = new ApplicationjsonSchema1(); + } + return instance; + } + } + +} diff --git a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/userlogin/get/responses/code200response/content/applicationxml/ApplicationxmlSchema.kt b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/userlogin/get/responses/code200response/content/applicationxml/ApplicationxmlSchema.kt new file mode 100644 index 00000000000..557f1fbe8d1 --- /dev/null +++ b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/userlogin/get/responses/code200response/content/applicationxml/ApplicationxmlSchema.kt @@ -0,0 +1,19 @@ +package org.openapijsonschematools.client.paths.userlogin.get.responses.code200response.content.applicationxml; +import org.checkerframework.checker.nullness.qual.Nullable; +import org.openapijsonschematools.client.schemas.StringJsonSchema; + +public class ApplicationxmlSchema extends StringJsonSchema { + // nest classes so all schemas and input/output classes can be public + + + public static class ApplicationxmlSchema1 extends StringJsonSchema.StringJsonSchema1 { + private static @Nullable ApplicationxmlSchema1 instance = null; + public static ApplicationxmlSchema1 getInstance() { + if (instance == null) { + instance = new ApplicationxmlSchema1(); + } + return instance; + } + } + +} diff --git a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/userlogin/get/responses/code200response/headers/Int32.kt b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/userlogin/get/responses/code200response/headers/Int32.kt new file mode 100644 index 00000000000..e58a6bc7a89 --- /dev/null +++ b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/userlogin/get/responses/code200response/headers/Int32.kt @@ -0,0 +1,7 @@ +package org.openapijsonschematools.client.paths.userlogin.get.responses.code200response.headers; + +import org.openapijsonschematools.client.components.headers.Int32JsonContentTypeHeader; + +public class Int32 extends Int32JsonContentTypeHeader { + public static class Int321 extends Int32JsonContentTypeHeader1 {} +} diff --git a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/userlogin/get/responses/code200response/headers/NumberHeader.kt b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/userlogin/get/responses/code200response/headers/NumberHeader.kt new file mode 100644 index 00000000000..32207ae7232 --- /dev/null +++ b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/userlogin/get/responses/code200response/headers/NumberHeader.kt @@ -0,0 +1,3 @@ +package org.openapijsonschematools.client.paths.userlogin.get.responses.code200response.headers; + +public class NumberHeader extends org.openapijsonschematools.client.components.headers.NumberHeader {} diff --git a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/userlogin/get/responses/code200response/headers/Refcontentschemaheader.kt b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/userlogin/get/responses/code200response/headers/Refcontentschemaheader.kt new file mode 100644 index 00000000000..2e61fb18770 --- /dev/null +++ b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/userlogin/get/responses/code200response/headers/Refcontentschemaheader.kt @@ -0,0 +1,7 @@ +package org.openapijsonschematools.client.paths.userlogin.get.responses.code200response.headers; + +import org.openapijsonschematools.client.components.headers.RefContentSchemaHeader; + +public class Refcontentschemaheader extends RefContentSchemaHeader { + public static class Refcontentschemaheader1 extends RefContentSchemaHeader1 {} +} diff --git a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/userlogin/get/responses/code200response/headers/XExpiresAfter.kt b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/userlogin/get/responses/code200response/headers/XExpiresAfter.kt new file mode 100644 index 00000000000..16c17845941 --- /dev/null +++ b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/userlogin/get/responses/code200response/headers/XExpiresAfter.kt @@ -0,0 +1,18 @@ +package org.openapijsonschematools.client.paths.userlogin.get.responses.code200response.headers; + +import org.openapijsonschematools.client.header.SchemaHeader; +import org.openapijsonschematools.client.paths.userlogin.get.responses.code200response.headers.xexpiresafter.XExpiresAfterSchema; + +public class XExpiresAfter { + + public static class XExpiresAfter1 extends SchemaHeader { + public XExpiresAfter1() { + super( + false, + null, + false, + XExpiresAfterSchema.XExpiresAfterSchema1.getInstance() + ); + } + } +} diff --git a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/userlogin/get/responses/code200response/headers/XRateLimit.kt b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/userlogin/get/responses/code200response/headers/XRateLimit.kt new file mode 100644 index 00000000000..d239bf7a481 --- /dev/null +++ b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/userlogin/get/responses/code200response/headers/XRateLimit.kt @@ -0,0 +1,31 @@ +package org.openapijsonschematools.client.paths.userlogin.get.responses.code200response.headers; + +import org.openapijsonschematools.client.header.ContentHeader; +import org.openapijsonschematools.client.mediatype.MediaType; +import org.openapijsonschematools.client.paths.userlogin.get.responses.code200response.headers.xratelimit.content.applicationjson.XRateLimitSchema; + +import java.util.AbstractMap; + +public class XRateLimit { + + public record ApplicationjsonMediaType(XRateLimitSchema.XRateLimitSchema1 schema) implements MediaType { + public ApplicationjsonMediaType() { + this(XRateLimitSchema.XRateLimitSchema1.getInstance()); + } + @Override + public Nothing? encoding() { + return null; + } + } + + public static class XRateLimit1 extends ContentHeader { + public XRateLimit1() { + super( + true, + null, + false, + new AbstractMap.SimpleEntry<>("application/json", new ApplicationjsonMediaType()) + ); + } + } +} diff --git a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/userlogin/get/responses/code200response/headers/xexpiresafter/XExpiresAfterSchema.kt b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/userlogin/get/responses/code200response/headers/xexpiresafter/XExpiresAfterSchema.kt new file mode 100644 index 00000000000..13ec38f4440 --- /dev/null +++ b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/userlogin/get/responses/code200response/headers/xexpiresafter/XExpiresAfterSchema.kt @@ -0,0 +1,19 @@ +package org.openapijsonschematools.client.paths.userlogin.get.responses.code200response.headers.xexpiresafter; +import org.checkerframework.checker.nullness.qual.Nullable; +import org.openapijsonschematools.client.schemas.DateTimeJsonSchema; + +public class XExpiresAfterSchema extends DateTimeJsonSchema { + // nest classes so all schemas and input/output classes can be public + + + public static class XExpiresAfterSchema1 extends DateTimeJsonSchema.DateTimeJsonSchema1 { + private static @Nullable XExpiresAfterSchema1 instance = null; + public static XExpiresAfterSchema1 getInstance() { + if (instance == null) { + instance = new XExpiresAfterSchema1(); + } + return instance; + } + } + +} diff --git a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/userlogin/get/responses/code200response/headers/xratelimit/content/applicationjson/XRateLimitSchema.kt b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/userlogin/get/responses/code200response/headers/xratelimit/content/applicationjson/XRateLimitSchema.kt new file mode 100644 index 00000000000..9ce160e834c --- /dev/null +++ b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/userlogin/get/responses/code200response/headers/xratelimit/content/applicationjson/XRateLimitSchema.kt @@ -0,0 +1,19 @@ +package org.openapijsonschematools.client.paths.userlogin.get.responses.code200response.headers.xratelimit.content.applicationjson; +import org.checkerframework.checker.nullness.qual.Nullable; +import org.openapijsonschematools.client.schemas.Int32JsonSchema; + +public class XRateLimitSchema extends Int32JsonSchema { + // nest classes so all schemas and input/output classes can be public + + + public static class XRateLimitSchema1 extends Int32JsonSchema.Int32JsonSchema1 { + private static @Nullable XRateLimitSchema1 instance = null; + public static XRateLimitSchema1 getInstance() { + if (instance == null) { + instance = new XRateLimitSchema1(); + } + return instance; + } + } + +} diff --git a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/userlogout/UserlogoutGet.kt b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/userlogout/UserlogoutGet.kt new file mode 100644 index 00000000000..b55850dcc33 --- /dev/null +++ b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/userlogout/UserlogoutGet.kt @@ -0,0 +1,124 @@ +package org.openapijsonschematools.client.paths.userlogout; + +import org.checkerframework.checker.nullness.qual.Nullable; +import org.openapijsonschematools.client.RootServerInfo; +import org.openapijsonschematools.client.paths.userlogout.get.UserlogoutGetResponses; +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.paths.Userlogout; + +import java.io.IOException; +import java.net.http.HttpClient; +import java.net.http.HttpRequest; +import java.time.Duration; +import java.util.List; +import java.util.Map; + +public class UserlogoutGet { + private static class GetProvider { + private static final String method = "get"; + + public static UserlogoutGetResponses.EndpointResponse get( + GetRequest request, + ApiConfiguration apiConfiguration, + SchemaConfiguration schemaConfiguration, + HttpClient client + ) 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 + @Nullable Map queryMap = null; + String host = apiConfiguration.getServer(request.serverIndex).url(); + + String url = host + Userlogout.path; + var httpRequest = RestClient.getRequest( + url, + method, + bodyPublisher, + headers, + request.timeout + ); + var response = RestClient.getResponse(httpRequest, client); + var responsesDeserializer = new UserlogoutGetResponses.UserlogoutGetResponses1(); + return responsesDeserializer.deserialize(response, schemaConfiguration); + } + } + + public interface GetOperation { + ApiConfiguration getApiConfiguration(); + SchemaConfiguration getSchemaConfiguration(); + HttpClient getClient(); + default UserlogoutGetResponses.EndpointResponse get(GetRequest request) throws IOException, InterruptedException, ValidationException, NotImplementedException, ApiException { + return GetProvider.get(request, getApiConfiguration(), getSchemaConfiguration(), getClient()); + } + } + + public interface LogoutUserOperation { + ApiConfiguration getApiConfiguration(); + SchemaConfiguration getSchemaConfiguration(); + HttpClient getClient(); + default UserlogoutGetResponses.EndpointResponse logoutUser(GetRequest request) throws IOException, InterruptedException, ValidationException, NotImplementedException, ApiException { + return GetProvider.get(request, getApiConfiguration(), getSchemaConfiguration(), getClient()); + } + } + + public static class Get extends ApiClient implements GetOperation { + public Get(ApiConfiguration apiConfiguration, SchemaConfiguration schemaConfiguration) { + super(apiConfiguration, schemaConfiguration); + } + } + + public static class GetRequest { + public RootServerInfo.@Nullable ServerIndex serverIndex; + public @Nullable Duration timeout; + } + + public interface SetterForServerIndex { + GetRequest getInstance(); + T getBuilderAfterServerIndex(GetRequest instance); + default T serverIndex(RootServerInfo.ServerIndex serverIndex) { + var instance = getInstance(); + instance.serverIndex = serverIndex; + return getBuilderAfterServerIndex(instance); + } + } + + public interface SetterForTimeout { + GetRequest getInstance(); + T getBuilderAfterTimeout(GetRequest instance); + default T timeout(Duration timeout) { + var instance = getInstance(); + instance.timeout = timeout; + return getBuilderAfterTimeout(instance); + } + } + + public static class GetRequestBuilder implements SetterForServerIndex, SetterForTimeout { + private final GetRequest instance; + + public GetRequestBuilder() { + this.instance = new GetRequest(); + } + + public GetRequest build() { + return instance; + } + + public GetRequest getInstance() { + return instance; + } + + public GetRequestBuilder getBuilderAfterServerIndex(GetRequest instance) { + return this; + } + + public GetRequestBuilder getBuilderAfterTimeout(GetRequest instance) { + return this; + } + } +} diff --git a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/userlogout/get/UserlogoutGetResponses.kt b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/userlogout/get/UserlogoutGetResponses.kt new file mode 100644 index 00000000000..7f25fa19019 --- /dev/null +++ b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/userlogout/get/UserlogoutGetResponses.kt @@ -0,0 +1,37 @@ +package org.openapijsonschematools.client.paths.userlogout.get; + +import org.openapijsonschematools.client.paths.userlogout.get.responses.UserlogoutGetCodedefaultResponse; +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; +import org.checkerframework.checker.nullness.qual.Nullable; + +import java.net.http.HttpResponse; +import java.util.Map; +import java.util.AbstractMap; + +public class UserlogoutGetResponses { + public sealed interface EndpointResponse permits EndpointUserlogoutGetCodedefaultResponse {} + + public record EndpointUserlogoutGetCodedefaultResponse( + HttpResponse response, + Nothing? body, + Nothing? headers + ) implements EndpointResponse, ApiResponse{ + } + + public static final class UserlogoutGetResponses1 implements ResponsesDeserializer { + private final UserlogoutGetCodedefaultResponse.UserlogoutGetCodedefaultResponse1 defaultResponseDeserializer; + public UserlogoutGetResponses1() { + this.defaultResponseDeserializer = new UserlogoutGetCodedefaultResponse.UserlogoutGetCodedefaultResponse1(); + } + + public EndpointResponse deserialize(HttpResponse response, SchemaConfiguration configuration) throws ValidationException, NotImplementedException, ApiException { + var deserializedResponse = defaultResponseDeserializer.deserialize(response, configuration); + return new EndpointUserlogoutGetCodedefaultResponse(response, deserializedResponse.body(), deserializedResponse.headers()); + } + } +} diff --git a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/userlogout/get/responses/UserlogoutGetCodedefaultResponse.kt b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/userlogout/get/responses/UserlogoutGetCodedefaultResponse.kt new file mode 100644 index 00000000000..18fa2331b9a --- /dev/null +++ b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/userlogout/get/responses/UserlogoutGetCodedefaultResponse.kt @@ -0,0 +1,7 @@ +package org.openapijsonschematools.client.paths.userlogout.get.responses; + +import org.openapijsonschematools.client.components.responses.RefSuccessDescriptionOnly; + +public class UserlogoutGetCodedefaultResponse extends RefSuccessDescriptionOnly { + public static class UserlogoutGetCodedefaultResponse1 extends RefSuccessDescriptionOnly1 {} +} diff --git a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/userusername/UserusernameDelete.kt b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/userusername/UserusernameDelete.kt new file mode 100644 index 00000000000..62d4bc7efe2 --- /dev/null +++ b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/userusername/UserusernameDelete.kt @@ -0,0 +1,179 @@ +package org.openapijsonschematools.client.paths.userusername; + +import org.checkerframework.checker.nullness.qual.Nullable; +import org.openapijsonschematools.client.RootServerInfo; +import org.openapijsonschematools.client.paths.userusername.delete.UserusernameDeletePathParameters; +import org.openapijsonschematools.client.paths.userusername.delete.Parameters; +import org.openapijsonschematools.client.paths.userusername.delete.UserusernameDeleteResponses; +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.paths.Userusername; + +import java.io.IOException; +import java.net.http.HttpClient; +import java.net.http.HttpRequest; +import java.time.Duration; +import java.util.List; +import java.util.Map; + +public class UserusernameDelete { + private static class DeleteProvider { + private static final String method = "delete"; + + public static UserusernameDeleteResponses.EndpointResponse delete( + DeleteRequest request, + ApiConfiguration apiConfiguration, + SchemaConfiguration schemaConfiguration, + HttpClient client + ) throws IOException, InterruptedException, ValidationException, NotImplementedException, ApiException { + Map> headers = apiConfiguration.getDefaultHeaders(); + HttpRequest.BodyPublisher bodyPublisher = HttpRequest.BodyPublishers.noBody(); + + var pathSerializer = new Parameters.PathParametersSerializer(); + String updatedPath = pathSerializer.serialize(request.pathParameters, Userusername.path); + // TODO set this to a map if there is a query security scheme + @Nullable Map queryMap = null; + String host = apiConfiguration.getServer(request.serverIndex).url(); + + String url = host + updatedPath; + var httpRequest = RestClient.getRequest( + url, + method, + bodyPublisher, + headers, + request.timeout + ); + var response = RestClient.getResponse(httpRequest, client); + var responsesDeserializer = new UserusernameDeleteResponses.UserusernameDeleteResponses1(); + return responsesDeserializer.deserialize(response, schemaConfiguration); + } + } + + public interface DeleteOperation { + ApiConfiguration getApiConfiguration(); + SchemaConfiguration getSchemaConfiguration(); + HttpClient getClient(); + default UserusernameDeleteResponses.EndpointResponse delete(DeleteRequest request) throws IOException, InterruptedException, ValidationException, NotImplementedException, ApiException { + return DeleteProvider.delete(request, getApiConfiguration(), getSchemaConfiguration(), getClient()); + } + } + + public interface DeleteUserOperation { + ApiConfiguration getApiConfiguration(); + SchemaConfiguration getSchemaConfiguration(); + HttpClient getClient(); + default UserusernameDeleteResponses.EndpointResponse deleteUser(DeleteRequest request) throws IOException, InterruptedException, ValidationException, NotImplementedException, ApiException { + return DeleteProvider.delete(request, getApiConfiguration(), getSchemaConfiguration(), getClient()); + } + } + + public static class Delete extends ApiClient implements DeleteOperation { + public Delete(ApiConfiguration apiConfiguration, SchemaConfiguration schemaConfiguration) { + super(apiConfiguration, schemaConfiguration); + } + } + + public static class DeleteRequest { + public UserusernameDeletePathParameters.PathParametersMap pathParameters; + public RootServerInfo.@Nullable ServerIndex serverIndex; + public @Nullable Duration timeout; + + public DeleteRequest( + UserusernameDeletePathParameters.PathParametersMap pathParameters, + RootServerInfo.@Nullable ServerIndex serverIndex, + @Nullable Duration timeout + ) { + this.pathParameters = pathParameters; + this.serverIndex = serverIndex; + this.timeout = timeout; + } + } + + public static class DeleteNullableRequest { + public UserusernameDeletePathParameters.@Nullable PathParametersMap pathParameters; + public RootServerInfo.@Nullable ServerIndex serverIndex; + public @Nullable Duration timeout; + } + + public interface SetterForServerIndex { + DeleteNullableRequest getInstance(); + T getBuilderAfterServerIndex(DeleteNullableRequest instance); + default T serverIndex(RootServerInfo.ServerIndex serverIndex) { + var instance = getInstance(); + instance.serverIndex = serverIndex; + return getBuilderAfterServerIndex(instance); + } + } + + public interface SetterForTimeout { + DeleteNullableRequest getInstance(); + T getBuilderAfterTimeout(DeleteNullableRequest instance); + default T timeout(Duration timeout) { + var instance = getInstance(); + instance.timeout = timeout; + return getBuilderAfterTimeout(instance); + } + } + + public interface SetterForPathParameters { + DeleteNullableRequest getInstance(); + T getBuilderAfterPathParameters(DeleteNullableRequest instance); + default T pathParameters(UserusernameDeletePathParameters.PathParametersMap pathParameters) { + var instance = getInstance(); + instance.pathParameters = pathParameters; + return getBuilderAfterPathParameters(instance); + } + } + + public static class Delete0RequestBuilder implements SetterForServerIndex, SetterForTimeout { + private final DeleteNullableRequest instance; + + public Delete0RequestBuilder(DeleteNullableRequest instance) { + this.instance = instance; + } + + public DeleteRequest build() { + var pathParameters = instance.pathParameters; + if (pathParameters == null) { + throw new RuntimeException("invalid null value for required parameter"); + } + return new DeleteRequest( + pathParameters, + instance.serverIndex, + instance.timeout + ); + } + + public DeleteNullableRequest getInstance() { + return instance; + } + + public Delete0RequestBuilder getBuilderAfterServerIndex(DeleteNullableRequest instance) { + return this; + } + + public Delete0RequestBuilder getBuilderAfterTimeout(DeleteNullableRequest instance) { + return this; + } + } + public static class DeleteRequestBuilder implements SetterForPathParameters { + private final DeleteNullableRequest instance; + + public DeleteRequestBuilder() { + this.instance = new DeleteNullableRequest(); + } + + public DeleteNullableRequest getInstance() { + return instance; + } + + public Delete0RequestBuilder getBuilderAfterPathParameters(DeleteNullableRequest instance) { + return new Delete0RequestBuilder(instance); + } + } +} diff --git a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/userusername/UserusernameGet.kt b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/userusername/UserusernameGet.kt new file mode 100644 index 00000000000..9f49051e830 --- /dev/null +++ b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/userusername/UserusernameGet.kt @@ -0,0 +1,179 @@ +package org.openapijsonschematools.client.paths.userusername; + +import org.checkerframework.checker.nullness.qual.Nullable; +import org.openapijsonschematools.client.RootServerInfo; +import org.openapijsonschematools.client.paths.userusername.get.UserusernameGetPathParameters; +import org.openapijsonschematools.client.paths.userusername.get.Parameters; +import org.openapijsonschematools.client.paths.userusername.get.UserusernameGetResponses; +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.paths.Userusername; + +import java.io.IOException; +import java.net.http.HttpClient; +import java.net.http.HttpRequest; +import java.time.Duration; +import java.util.List; +import java.util.Map; + +public class UserusernameGet { + private static class GetProvider { + private static final String method = "get"; + + public static UserusernameGetResponses.EndpointResponse get( + GetRequest request, + ApiConfiguration apiConfiguration, + SchemaConfiguration schemaConfiguration, + HttpClient client + ) throws IOException, InterruptedException, ValidationException, NotImplementedException, ApiException { + Map> headers = apiConfiguration.getDefaultHeaders(); + HttpRequest.BodyPublisher bodyPublisher = HttpRequest.BodyPublishers.noBody(); + + var pathSerializer = new Parameters.PathParametersSerializer(); + String updatedPath = pathSerializer.serialize(request.pathParameters, Userusername.path); + // TODO set this to a map if there is a query security scheme + @Nullable Map queryMap = null; + String host = apiConfiguration.getServer(request.serverIndex).url(); + + String url = host + updatedPath; + var httpRequest = RestClient.getRequest( + url, + method, + bodyPublisher, + headers, + request.timeout + ); + var response = RestClient.getResponse(httpRequest, client); + var responsesDeserializer = new UserusernameGetResponses.UserusernameGetResponses1(); + return responsesDeserializer.deserialize(response, schemaConfiguration); + } + } + + public interface GetOperation { + ApiConfiguration getApiConfiguration(); + SchemaConfiguration getSchemaConfiguration(); + HttpClient getClient(); + default UserusernameGetResponses.EndpointResponse get(GetRequest request) throws IOException, InterruptedException, ValidationException, NotImplementedException, ApiException { + return GetProvider.get(request, getApiConfiguration(), getSchemaConfiguration(), getClient()); + } + } + + public interface GetUserByNameOperation { + ApiConfiguration getApiConfiguration(); + SchemaConfiguration getSchemaConfiguration(); + HttpClient getClient(); + default UserusernameGetResponses.EndpointResponse getUserByName(GetRequest request) throws IOException, InterruptedException, ValidationException, NotImplementedException, ApiException { + return GetProvider.get(request, getApiConfiguration(), getSchemaConfiguration(), getClient()); + } + } + + public static class Get extends ApiClient implements GetOperation { + public Get(ApiConfiguration apiConfiguration, SchemaConfiguration schemaConfiguration) { + super(apiConfiguration, schemaConfiguration); + } + } + + public static class GetRequest { + public UserusernameGetPathParameters.PathParametersMap pathParameters; + public RootServerInfo.@Nullable ServerIndex serverIndex; + public @Nullable Duration timeout; + + public GetRequest( + UserusernameGetPathParameters.PathParametersMap pathParameters, + RootServerInfo.@Nullable ServerIndex serverIndex, + @Nullable Duration timeout + ) { + this.pathParameters = pathParameters; + this.serverIndex = serverIndex; + this.timeout = timeout; + } + } + + public static class GetNullableRequest { + public UserusernameGetPathParameters.@Nullable PathParametersMap pathParameters; + public RootServerInfo.@Nullable ServerIndex serverIndex; + public @Nullable Duration timeout; + } + + public interface SetterForServerIndex { + GetNullableRequest getInstance(); + T getBuilderAfterServerIndex(GetNullableRequest instance); + default T serverIndex(RootServerInfo.ServerIndex serverIndex) { + var instance = getInstance(); + instance.serverIndex = serverIndex; + return getBuilderAfterServerIndex(instance); + } + } + + public interface SetterForTimeout { + GetNullableRequest getInstance(); + T getBuilderAfterTimeout(GetNullableRequest instance); + default T timeout(Duration timeout) { + var instance = getInstance(); + instance.timeout = timeout; + return getBuilderAfterTimeout(instance); + } + } + + public interface SetterForPathParameters { + GetNullableRequest getInstance(); + T getBuilderAfterPathParameters(GetNullableRequest instance); + default T pathParameters(UserusernameGetPathParameters.PathParametersMap pathParameters) { + var instance = getInstance(); + instance.pathParameters = pathParameters; + return getBuilderAfterPathParameters(instance); + } + } + + public static class Get0RequestBuilder implements SetterForServerIndex, SetterForTimeout { + private final GetNullableRequest instance; + + public Get0RequestBuilder(GetNullableRequest instance) { + this.instance = instance; + } + + public GetRequest build() { + var pathParameters = instance.pathParameters; + if (pathParameters == null) { + throw new RuntimeException("invalid null value for required parameter"); + } + return new GetRequest( + pathParameters, + instance.serverIndex, + instance.timeout + ); + } + + public GetNullableRequest getInstance() { + return instance; + } + + public Get0RequestBuilder getBuilderAfterServerIndex(GetNullableRequest instance) { + return this; + } + + public Get0RequestBuilder getBuilderAfterTimeout(GetNullableRequest instance) { + return this; + } + } + public static class GetRequestBuilder implements SetterForPathParameters { + private final GetNullableRequest instance; + + public GetRequestBuilder() { + this.instance = new GetNullableRequest(); + } + + public GetNullableRequest getInstance() { + return instance; + } + + public Get0RequestBuilder getBuilderAfterPathParameters(GetNullableRequest instance) { + return new Get0RequestBuilder(instance); + } + } +} diff --git a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/userusername/UserusernamePut.kt b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/userusername/UserusernamePut.kt new file mode 100644 index 00000000000..0aba85a3cba --- /dev/null +++ b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/userusername/UserusernamePut.kt @@ -0,0 +1,240 @@ +package org.openapijsonschematools.client.paths.userusername; + +import org.checkerframework.checker.nullness.qual.Nullable; +import org.openapijsonschematools.client.RootServerInfo; +import org.openapijsonschematools.client.paths.userusername.put.UserusernamePutRequestBody; +import org.openapijsonschematools.client.paths.userusername.put.UserusernamePutPathParameters; +import org.openapijsonschematools.client.paths.userusername.put.Parameters; +import org.openapijsonschematools.client.paths.userusername.put.UserusernamePutResponses; +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.requestbody.SerializedRequestBody; +import org.openapijsonschematools.client.paths.Userusername; + +import java.io.IOException; +import java.util.ArrayList; +import java.net.http.HttpClient; +import java.net.http.HttpRequest; +import java.time.Duration; +import java.util.List; +import java.util.Map; + +public class UserusernamePut { + private static class PutProvider { + private static final String method = "put"; + + public static Nothing? put( + PutRequest request, + ApiConfiguration apiConfiguration, + SchemaConfiguration schemaConfiguration, + HttpClient client + ) throws IOException, InterruptedException, ValidationException, NotImplementedException, ApiException { + Map> headers = apiConfiguration.getDefaultHeaders(); + + SerializedRequestBody serializedRequestBody = new UserusernamePutRequestBody.UserusernamePutRequestBody1().serialize( + request.requestBody + ); + var contentTypeHeaderValues = headers.getOrDefault("Content-Type", new ArrayList<>()); + contentTypeHeaderValues.add(serializedRequestBody.contentType); + HttpRequest.BodyPublisher bodyPublisher = serializedRequestBody.bodyPublisher; + + var pathSerializer = new Parameters.PathParametersSerializer(); + String updatedPath = pathSerializer.serialize(request.pathParameters, Userusername.path); + // TODO set this to a map if there is a query security scheme + @Nullable Map queryMap = null; + String host = apiConfiguration.getServer(request.serverIndex).url(); + + String url = host + updatedPath; + var httpRequest = RestClient.getRequest( + url, + method, + bodyPublisher, + headers, + request.timeout + ); + var response = RestClient.getResponse(httpRequest, client); + return (Nothing?) null; + } + } + + public interface PutOperation { + ApiConfiguration getApiConfiguration(); + SchemaConfiguration getSchemaConfiguration(); + HttpClient getClient(); + default Nothing? put(PutRequest request) throws IOException, InterruptedException, ValidationException, NotImplementedException, ApiException { + return PutProvider.put(request, getApiConfiguration(), getSchemaConfiguration(), getClient()); + } + } + + public interface UpdateUserOperation { + ApiConfiguration getApiConfiguration(); + SchemaConfiguration getSchemaConfiguration(); + HttpClient getClient(); + default Nothing? updateUser(PutRequest request) throws IOException, InterruptedException, ValidationException, NotImplementedException, ApiException { + return PutProvider.put(request, getApiConfiguration(), getSchemaConfiguration(), getClient()); + } + } + + public static class Put extends ApiClient implements PutOperation { + public Put(ApiConfiguration apiConfiguration, SchemaConfiguration schemaConfiguration) { + super(apiConfiguration, schemaConfiguration); + } + } + + public static class PutRequest { + public UserusernamePutRequestBody.SealedRequestBody requestBody; + public UserusernamePutPathParameters.PathParametersMap pathParameters; + public RootServerInfo.@Nullable ServerIndex serverIndex; + public @Nullable Duration timeout; + + public PutRequest( + UserusernamePutRequestBody.SealedRequestBody requestBody, + UserusernamePutPathParameters.PathParametersMap pathParameters, + RootServerInfo.@Nullable ServerIndex serverIndex, + @Nullable Duration timeout + ) { + this.requestBody = requestBody; + this.pathParameters = pathParameters; + this.serverIndex = serverIndex; + this.timeout = timeout; + } + } + + public static class PutNullableRequest { + public UserusernamePutRequestBody.@Nullable SealedRequestBody requestBody; + public UserusernamePutPathParameters.@Nullable PathParametersMap pathParameters; + public RootServerInfo.@Nullable ServerIndex serverIndex; + public @Nullable Duration timeout; + } + + public interface SetterForServerIndex { + PutNullableRequest getInstance(); + T getBuilderAfterServerIndex(PutNullableRequest instance); + default T serverIndex(RootServerInfo.ServerIndex serverIndex) { + var instance = getInstance(); + instance.serverIndex = serverIndex; + return getBuilderAfterServerIndex(instance); + } + } + + public interface SetterForTimeout { + PutNullableRequest getInstance(); + T getBuilderAfterTimeout(PutNullableRequest instance); + default T timeout(Duration timeout) { + var instance = getInstance(); + instance.timeout = timeout; + return getBuilderAfterTimeout(instance); + } + } + + public interface SetterForRequestBody { + PutNullableRequest getInstance(); + T getBuilderAfterRequestBody(PutNullableRequest instance); + default T requestBody(UserusernamePutRequestBody.SealedRequestBody requestBody) { + var instance = getInstance(); + instance.requestBody = requestBody; + return getBuilderAfterRequestBody(instance); + } + } + + public interface SetterForPathParameters { + PutNullableRequest getInstance(); + T getBuilderAfterPathParameters(PutNullableRequest instance); + default T pathParameters(UserusernamePutPathParameters.PathParametersMap pathParameters) { + var instance = getInstance(); + instance.pathParameters = pathParameters; + return getBuilderAfterPathParameters(instance); + } + } + + public static class Put00RequestBuilder implements SetterForServerIndex, SetterForTimeout { + private final PutNullableRequest instance; + + public Put00RequestBuilder(PutNullableRequest instance) { + this.instance = instance; + } + + public PutRequest build() { + var requestBody = instance.requestBody; + if (requestBody == null) { + throw new RuntimeException("invalid null value for required parameter"); + } + var pathParameters = instance.pathParameters; + if (pathParameters == null) { + throw new RuntimeException("invalid null value for required parameter"); + } + return new PutRequest( + requestBody, + pathParameters, + instance.serverIndex, + instance.timeout + ); + } + + public PutNullableRequest getInstance() { + return instance; + } + + public Put00RequestBuilder getBuilderAfterServerIndex(PutNullableRequest instance) { + return this; + } + + public Put00RequestBuilder getBuilderAfterTimeout(PutNullableRequest instance) { + return this; + } + } + public static class Put01RequestBuilder implements SetterForPathParameters { + private final PutNullableRequest instance; + + public Put01RequestBuilder(PutNullableRequest instance) { + this.instance = instance; + } + + public PutNullableRequest getInstance() { + return instance; + } + + public Put00RequestBuilder getBuilderAfterPathParameters(PutNullableRequest instance) { + return new Put00RequestBuilder(instance); + } + } + public static class Put10RequestBuilder implements SetterForRequestBody { + private final PutNullableRequest instance; + + public Put10RequestBuilder(PutNullableRequest instance) { + this.instance = instance; + } + + public PutNullableRequest getInstance() { + return instance; + } + + public Put00RequestBuilder getBuilderAfterRequestBody(PutNullableRequest instance) { + return new Put00RequestBuilder(instance); + } + } + public static class PutRequestBuilder implements SetterForRequestBody, SetterForPathParameters { + private final PutNullableRequest instance; + + public PutRequestBuilder() { + this.instance = new PutNullableRequest(); + } + + public PutNullableRequest getInstance() { + return instance; + } + + public Put01RequestBuilder getBuilderAfterRequestBody(PutNullableRequest instance) { + return new Put01RequestBuilder(instance); + } + + public Put10RequestBuilder getBuilderAfterPathParameters(PutNullableRequest instance) { + return new Put10RequestBuilder(instance); + } + } +} diff --git a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/userusername/delete/Parameters.kt b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/userusername/delete/Parameters.kt new file mode 100644 index 00000000000..ea0e063d89c --- /dev/null +++ b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/userusername/delete/Parameters.kt @@ -0,0 +1,20 @@ +package org.openapijsonschematools.client.paths.userusername.delete; + +import org.openapijsonschematools.client.paths.userusername.delete.parameters.Parameter0; +import org.openapijsonschematools.client.parameter.PathSerializer; + +import java.util.Map; +import java.util.AbstractMap; + +public class Parameters { + + public static class PathParametersSerializer extends PathSerializer { + public PathParametersSerializer() { + super( + Map.ofEntries( + new AbstractMap.SimpleEntry<>("username", new Parameter0.Parameter01()) + ) + ); + } + } +} diff --git a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/userusername/delete/UserusernameDeletePathParameters.kt b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/userusername/delete/UserusernameDeletePathParameters.kt new file mode 100644 index 00000000000..28dd5ffb5b8 --- /dev/null +++ b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/userusername/delete/UserusernameDeletePathParameters.kt @@ -0,0 +1,205 @@ +package org.openapijsonschematools.client.paths.userusername.delete; +import java.util.ArrayList; +import java.util.HashSet; +import java.util.LinkedHashMap; +import java.util.LinkedHashSet; +import java.util.List; +import java.util.Map; +import java.util.Objects; +import java.util.Set; +import org.checkerframework.checker.nullness.qual.Nullable; +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.UnsetPropertyException; +import org.openapijsonschematools.client.exceptions.ValidationException; +import org.openapijsonschematools.client.schemas.AnyTypeJsonSchema; +import org.openapijsonschematools.client.schemas.GenericBuilder; +import org.openapijsonschematools.client.schemas.NotAnyTypeJsonSchema; +import org.openapijsonschematools.client.schemas.validation.FrozenMap; +import org.openapijsonschematools.client.schemas.validation.JsonSchema; +import org.openapijsonschematools.client.schemas.validation.JsonSchemaInfo; +import org.openapijsonschematools.client.schemas.validation.MapSchemaValidator; +import org.openapijsonschematools.client.schemas.validation.MapUtils; +import org.openapijsonschematools.client.schemas.validation.PathToSchemasMap; +import org.openapijsonschematools.client.schemas.validation.PropertyEntry; +import org.openapijsonschematools.client.schemas.validation.ValidationMetadata; + +public class UserusernameDeletePathParameters { + // nest classes so all schemas and input/output classes can be public + + + public static class AdditionalProperties extends NotAnyTypeJsonSchema.NotAnyTypeJsonSchema1 { + // NotAnyTypeSchema + private static @Nullable AdditionalProperties instance = null; + public static AdditionalProperties getInstance() { + if (instance == null) { + instance = new AdditionalProperties(); + } + return instance; + } + } + + + public static class PathParametersMap extends FrozenMap { + protected PathParametersMap(FrozenMap m) { + super(m); + } + public static final Set requiredKeys = Set.of( + "username" + ); + public static final Set optionalKeys = Set.of(); + public static PathParametersMap of(Map arg, SchemaConfiguration configuration) throws ValidationException { + return UserusernameDeletePathParameters1.getInstance().validate(arg, configuration); + } + + public String username() { + try { + return getOrThrow("version"); + } catch (UnsetPropertyException e) { + throw new RuntimeException(e); + } + } + } + + public interface SetterForUsername { + Map getInstance(); + T getBuilderAfterUsername(Map instance); + + default T username(String value) { + var instance = getInstance(); + instance.put("username", value); + return getBuilderAfterUsername(instance); + } + } + + public static class PathParametersMap0Builder implements GenericBuilder> { + private final Map instance; + private static final Set knownKeys = Set.of( + "username" + ); + public Set getKnownKeys() { + return knownKeys; + } + public PathParametersMap0Builder(Map instance) { + this.instance = instance; + } + public Map build() { + return instance; + } + } + + public static class PathParametersMapBuilder implements SetterForUsername { + private final Map instance; + public PathParametersMapBuilder() { + this.instance = new LinkedHashMap<>(); + } + public Map getInstance() { + return instance; + } + public PathParametersMap0Builder getBuilderAfterUsername(Map instance) { + return new PathParametersMap0Builder(instance); + } + } + + + public sealed interface UserusernameDeletePathParameters1Boxed permits UserusernameDeletePathParameters1BoxedMap { + @Nullable Object getData(); + } + + public record UserusernameDeletePathParameters1BoxedMap(PathParametersMap data) implements UserusernameDeletePathParameters1Boxed { + @Override + public @Nullable Object getData() { + return data; + } + } + + + public static class UserusernameDeletePathParameters1 extends JsonSchema implements MapSchemaValidator { + private static @Nullable UserusernameDeletePathParameters1 instance = null; + + protected UserusernameDeletePathParameters1() { + super(new JsonSchemaInfo() + .type(Set.of(Map.class)) + .properties(Map.ofEntries( + new PropertyEntry("username", Schema.Schema1.class) + )) + .required(Set.of( + "username" + )) + .additionalProperties(AdditionalProperties.class) + ); + } + + public static UserusernameDeletePathParameters1 getInstance() { + if (instance == null) { + instance = new UserusernameDeletePathParameters1(); + } + return instance; + } + + 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 RuntimeException("Invalid non-string key value"); + } + String propertyName = (String) entryKey; + List propertyPathToItem = new ArrayList<>(pathToItem); + propertyPathToItem.add(propertyName); + Object value = entry.getValue(); + LinkedHashMap, Nothing?> schemas = pathToSchemas.get(propertyPathToItem); + if (schemas == null) { + throw new RuntimeException("Validation 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"); + } + properties.put(propertyName, (String) propertyInstance); + } + FrozenMap castProperties = new FrozenMap<>(properties); + return new PathParametersMap(castProperties); + } + + 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); + SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().build())); + ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, new PathToSchemasMap(), new LinkedHashSet<>()); + PathToSchemasMap pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet); + return getNewInstance(castArg, validationMetadata.pathToItem(), pathToSchemasMap); + } + + + @Override + public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws 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"); + } + @Override + public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { + if (arg instanceof Map) { + return getNewInstance((Map) arg, pathToItem, pathToSchemas); + } + throw new RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); + } + @Override + public UserusernameDeletePathParameters1BoxedMap validateAndBox(Map arg, SchemaConfiguration configuration) throws ValidationException { + return new UserusernameDeletePathParameters1BoxedMap(validate(arg, configuration)); + } + @Override + public UserusernameDeletePathParameters1Boxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { + 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"); + } + } + +} diff --git a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/userusername/delete/UserusernameDeleteResponses.kt b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/userusername/delete/UserusernameDeleteResponses.kt new file mode 100644 index 00000000000..8be04cfbc4b --- /dev/null +++ b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/userusername/delete/UserusernameDeleteResponses.kt @@ -0,0 +1,66 @@ +package org.openapijsonschematools.client.paths.userusername.delete; + +import org.openapijsonschematools.client.paths.userusername.delete.responses.UserusernameDeleteCode200Response; +import org.openapijsonschematools.client.paths.userusername.delete.responses.UserusernameDeleteCode404Response; +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; +import org.checkerframework.checker.nullness.qual.Nullable; + +import java.net.http.HttpResponse; +import java.util.Map; +import java.util.AbstractMap; + +public class UserusernameDeleteResponses { + public sealed interface EndpointResponse permits EndpointUserusernameDeleteCode200Response {} + + public record EndpointUserusernameDeleteCode200Response( + HttpResponse response, + Nothing? body, + Nothing? headers + ) implements EndpointResponse, ApiResponse{ + } + + public sealed interface StatusCodeResponseDeserializer permits StatusUserusernameDeleteCode200ResponseDeserializer, StatusUserusernameDeleteCode404ResponseDeserializer {} + + public static final class StatusUserusernameDeleteCode200ResponseDeserializer extends UserusernameDeleteCode200Response.UserusernameDeleteCode200Response1 implements StatusCodeResponseDeserializer { + } + public static final class StatusUserusernameDeleteCode404ResponseDeserializer extends UserusernameDeleteCode404Response.UserusernameDeleteCode404Response1 implements StatusCodeResponseDeserializer { + } + + public static final class UserusernameDeleteResponses1 implements ResponsesDeserializer { + private final Map statusCodeToResponseDeserializer; + public UserusernameDeleteResponses1() { + this.statusCodeToResponseDeserializer = Map.ofEntries( + new AbstractMap.SimpleEntry<>("200", new StatusUserusernameDeleteCode200ResponseDeserializer()), + new AbstractMap.SimpleEntry<>("404", new StatusUserusernameDeleteCode404ResponseDeserializer()) + ); + } + + 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) { + throw new ApiException( + "Invalid response statusCode="+statusCode+" has no response defined in the openapi document", + response + ); + } + if (statusCodeDeserializer instanceof StatusUserusernameDeleteCode200ResponseDeserializer castDeserializer) { + var deserializedResponse = castDeserializer.deserialize(response, configuration); + return new EndpointUserusernameDeleteCode200Response(response, deserializedResponse.body(), deserializedResponse.headers()); + } else { + StatusUserusernameDeleteCode404ResponseDeserializer castDeserializer = (StatusUserusernameDeleteCode404ResponseDeserializer) statusCodeDeserializer; + var deserializedResponse = castDeserializer.deserialize(response, configuration); + throw new UserusernameDeleteCode404Response.ResponseApiException( + "Received error statusCode response from server", + response, + deserializedResponse + ); + } + } + } +} diff --git a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/userusername/delete/parameters/Parameter0.kt b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/userusername/delete/parameters/Parameter0.kt new file mode 100644 index 00000000000..e95aee523c4 --- /dev/null +++ b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/userusername/delete/parameters/Parameter0.kt @@ -0,0 +1,7 @@ +package org.openapijsonschematools.client.paths.userusername.delete.parameters; + +import org.openapijsonschematools.client.components.parameters.RefPathUserName; + +public class Parameter0 extends RefPathUserName { + public static class Parameter01 extends RefPathUserName1 {} +} diff --git a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/userusername/delete/responses/UserusernameDeleteCode200Response.kt b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/userusername/delete/responses/UserusernameDeleteCode200Response.kt new file mode 100644 index 00000000000..680a51cb08b --- /dev/null +++ b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/userusername/delete/responses/UserusernameDeleteCode200Response.kt @@ -0,0 +1,7 @@ +package org.openapijsonschematools.client.paths.userusername.delete.responses; + +import org.openapijsonschematools.client.components.responses.SuccessDescriptionOnly; + +public class UserusernameDeleteCode200Response extends SuccessDescriptionOnly { + public static class UserusernameDeleteCode200Response1 extends SuccessDescriptionOnly1 {} +} diff --git a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/userusername/delete/responses/UserusernameDeleteCode404Response.kt b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/userusername/delete/responses/UserusernameDeleteCode404Response.kt new file mode 100644 index 00000000000..c7299032219 --- /dev/null +++ b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/userusername/delete/responses/UserusernameDeleteCode404Response.kt @@ -0,0 +1,45 @@ +package org.openapijsonschematools.client.paths.userusername.delete.responses; + +import org.openapijsonschematools.client.configurations.SchemaConfiguration; +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; +import java.net.http.HttpResponse; +import java.net.http.HttpHeaders; + +public class UserusernameDeleteCode404Response { + + public static class UserusernameDeleteCode404Response1 extends ResponseDeserializer { + public UserusernameDeleteCode404Response1() { + super( + MapUtils.makeMap( + ) + ); + } + + @Override + protected Nothing? getBody(String contentType, Nothing? mediaType, byte[] body, SchemaConfiguration configuration) { + return null; + } + + @Override + protected Nothing? getHeaders(HttpHeaders headers, SchemaConfiguration configuration) { + return null; + } + } + + @SuppressWarnings("serial") + public static class ResponseApiException extends ApiException { + public DeserializedHttpResponse deserializedResponse; + + public ResponseApiException(String s, HttpResponse response, DeserializedHttpResponse deserializedResponse) { + super(s, response); + this.deserializedResponse = deserializedResponse; + } + } +} diff --git a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/userusername/get/Parameters.kt b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/userusername/get/Parameters.kt new file mode 100644 index 00000000000..65c65d5d3b9 --- /dev/null +++ b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/userusername/get/Parameters.kt @@ -0,0 +1,20 @@ +package org.openapijsonschematools.client.paths.userusername.get; + +import org.openapijsonschematools.client.paths.userusername.get.parameters.Parameter0; +import org.openapijsonschematools.client.parameter.PathSerializer; + +import java.util.Map; +import java.util.AbstractMap; + +public class Parameters { + + public static class PathParametersSerializer extends PathSerializer { + public PathParametersSerializer() { + super( + Map.ofEntries( + new AbstractMap.SimpleEntry<>("username", new Parameter0.Parameter01()) + ) + ); + } + } +} diff --git a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/userusername/get/UserusernameGetPathParameters.kt b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/userusername/get/UserusernameGetPathParameters.kt new file mode 100644 index 00000000000..97e3023c38e --- /dev/null +++ b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/userusername/get/UserusernameGetPathParameters.kt @@ -0,0 +1,205 @@ +package org.openapijsonschematools.client.paths.userusername.get; +import java.util.ArrayList; +import java.util.HashSet; +import java.util.LinkedHashMap; +import java.util.LinkedHashSet; +import java.util.List; +import java.util.Map; +import java.util.Objects; +import java.util.Set; +import org.checkerframework.checker.nullness.qual.Nullable; +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.UnsetPropertyException; +import org.openapijsonschematools.client.exceptions.ValidationException; +import org.openapijsonschematools.client.schemas.AnyTypeJsonSchema; +import org.openapijsonschematools.client.schemas.GenericBuilder; +import org.openapijsonschematools.client.schemas.NotAnyTypeJsonSchema; +import org.openapijsonschematools.client.schemas.validation.FrozenMap; +import org.openapijsonschematools.client.schemas.validation.JsonSchema; +import org.openapijsonschematools.client.schemas.validation.JsonSchemaInfo; +import org.openapijsonschematools.client.schemas.validation.MapSchemaValidator; +import org.openapijsonschematools.client.schemas.validation.MapUtils; +import org.openapijsonschematools.client.schemas.validation.PathToSchemasMap; +import org.openapijsonschematools.client.schemas.validation.PropertyEntry; +import org.openapijsonschematools.client.schemas.validation.ValidationMetadata; + +public class UserusernameGetPathParameters { + // nest classes so all schemas and input/output classes can be public + + + public static class AdditionalProperties extends NotAnyTypeJsonSchema.NotAnyTypeJsonSchema1 { + // NotAnyTypeSchema + private static @Nullable AdditionalProperties instance = null; + public static AdditionalProperties getInstance() { + if (instance == null) { + instance = new AdditionalProperties(); + } + return instance; + } + } + + + public static class PathParametersMap extends FrozenMap { + protected PathParametersMap(FrozenMap m) { + super(m); + } + public static final Set requiredKeys = Set.of( + "username" + ); + public static final Set optionalKeys = Set.of(); + public static PathParametersMap of(Map arg, SchemaConfiguration configuration) throws ValidationException { + return UserusernameGetPathParameters1.getInstance().validate(arg, configuration); + } + + public String username() { + try { + return getOrThrow("version"); + } catch (UnsetPropertyException e) { + throw new RuntimeException(e); + } + } + } + + public interface SetterForUsername { + Map getInstance(); + T getBuilderAfterUsername(Map instance); + + default T username(String value) { + var instance = getInstance(); + instance.put("username", value); + return getBuilderAfterUsername(instance); + } + } + + public static class PathParametersMap0Builder implements GenericBuilder> { + private final Map instance; + private static final Set knownKeys = Set.of( + "username" + ); + public Set getKnownKeys() { + return knownKeys; + } + public PathParametersMap0Builder(Map instance) { + this.instance = instance; + } + public Map build() { + return instance; + } + } + + public static class PathParametersMapBuilder implements SetterForUsername { + private final Map instance; + public PathParametersMapBuilder() { + this.instance = new LinkedHashMap<>(); + } + public Map getInstance() { + return instance; + } + public PathParametersMap0Builder getBuilderAfterUsername(Map instance) { + return new PathParametersMap0Builder(instance); + } + } + + + public sealed interface UserusernameGetPathParameters1Boxed permits UserusernameGetPathParameters1BoxedMap { + @Nullable Object getData(); + } + + public record UserusernameGetPathParameters1BoxedMap(PathParametersMap data) implements UserusernameGetPathParameters1Boxed { + @Override + public @Nullable Object getData() { + return data; + } + } + + + public static class UserusernameGetPathParameters1 extends JsonSchema implements MapSchemaValidator { + private static @Nullable UserusernameGetPathParameters1 instance = null; + + protected UserusernameGetPathParameters1() { + super(new JsonSchemaInfo() + .type(Set.of(Map.class)) + .properties(Map.ofEntries( + new PropertyEntry("username", Schema.Schema1.class) + )) + .required(Set.of( + "username" + )) + .additionalProperties(AdditionalProperties.class) + ); + } + + public static UserusernameGetPathParameters1 getInstance() { + if (instance == null) { + instance = new UserusernameGetPathParameters1(); + } + return instance; + } + + 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 RuntimeException("Invalid non-string key value"); + } + String propertyName = (String) entryKey; + List propertyPathToItem = new ArrayList<>(pathToItem); + propertyPathToItem.add(propertyName); + Object value = entry.getValue(); + LinkedHashMap, Nothing?> schemas = pathToSchemas.get(propertyPathToItem); + if (schemas == null) { + throw new RuntimeException("Validation 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"); + } + properties.put(propertyName, (String) propertyInstance); + } + FrozenMap castProperties = new FrozenMap<>(properties); + return new PathParametersMap(castProperties); + } + + 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); + SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().build())); + ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, new PathToSchemasMap(), new LinkedHashSet<>()); + PathToSchemasMap pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet); + return getNewInstance(castArg, validationMetadata.pathToItem(), pathToSchemasMap); + } + + + @Override + public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws 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"); + } + @Override + public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { + if (arg instanceof Map) { + return getNewInstance((Map) arg, pathToItem, pathToSchemas); + } + throw new RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); + } + @Override + public UserusernameGetPathParameters1BoxedMap validateAndBox(Map arg, SchemaConfiguration configuration) throws ValidationException { + return new UserusernameGetPathParameters1BoxedMap(validate(arg, configuration)); + } + @Override + public UserusernameGetPathParameters1Boxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { + 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"); + } + } + +} diff --git a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/userusername/get/UserusernameGetResponses.kt b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/userusername/get/UserusernameGetResponses.kt new file mode 100644 index 00000000000..44f74afa40e --- /dev/null +++ b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/userusername/get/UserusernameGetResponses.kt @@ -0,0 +1,77 @@ +package org.openapijsonschematools.client.paths.userusername.get; + +import org.openapijsonschematools.client.paths.userusername.get.responses.UserusernameGetCode200Response; +import org.openapijsonschematools.client.paths.userusername.get.responses.UserusernameGetCode400Response; +import org.openapijsonschematools.client.paths.userusername.get.responses.UserusernameGetCode404Response; +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; +import org.checkerframework.checker.nullness.qual.Nullable; + +import java.net.http.HttpResponse; +import java.util.Map; +import java.util.AbstractMap; + +public class UserusernameGetResponses { + public sealed interface EndpointResponse permits EndpointUserusernameGetCode200Response {} + + public record EndpointUserusernameGetCode200Response( + HttpResponse response, + UserusernameGetCode200Response.SealedResponseBody body, + Nothing? headers + ) implements EndpointResponse, ApiResponse{ + } + + public sealed interface StatusCodeResponseDeserializer permits StatusUserusernameGetCode200ResponseDeserializer, StatusUserusernameGetCode400ResponseDeserializer, StatusUserusernameGetCode404ResponseDeserializer {} + + public static final class StatusUserusernameGetCode200ResponseDeserializer extends UserusernameGetCode200Response.UserusernameGetCode200Response1 implements StatusCodeResponseDeserializer { + } + public static final class StatusUserusernameGetCode400ResponseDeserializer extends UserusernameGetCode400Response.UserusernameGetCode400Response1 implements StatusCodeResponseDeserializer { + } + public static final class StatusUserusernameGetCode404ResponseDeserializer extends UserusernameGetCode404Response.UserusernameGetCode404Response1 implements StatusCodeResponseDeserializer { + } + + public static final class UserusernameGetResponses1 implements ResponsesDeserializer { + private final Map statusCodeToResponseDeserializer; + public UserusernameGetResponses1() { + this.statusCodeToResponseDeserializer = Map.ofEntries( + new AbstractMap.SimpleEntry<>("200", new StatusUserusernameGetCode200ResponseDeserializer()), + new AbstractMap.SimpleEntry<>("400", new StatusUserusernameGetCode400ResponseDeserializer()), + new AbstractMap.SimpleEntry<>("404", new StatusUserusernameGetCode404ResponseDeserializer()) + ); + } + + 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) { + throw new ApiException( + "Invalid response statusCode="+statusCode+" has no response defined in the openapi document", + response + ); + } + if (statusCodeDeserializer instanceof StatusUserusernameGetCode200ResponseDeserializer castDeserializer) { + var deserializedResponse = castDeserializer.deserialize(response, configuration); + return new EndpointUserusernameGetCode200Response(response, deserializedResponse.body(), deserializedResponse.headers()); + } else if (statusCodeDeserializer instanceof StatusUserusernameGetCode400ResponseDeserializer castDeserializer) { + var deserializedResponse = castDeserializer.deserialize(response, configuration); + throw new UserusernameGetCode400Response.ResponseApiException( + "Received error statusCode response from server", + response, + deserializedResponse + ); + } else { + StatusUserusernameGetCode404ResponseDeserializer castDeserializer = (StatusUserusernameGetCode404ResponseDeserializer) statusCodeDeserializer; + var deserializedResponse = castDeserializer.deserialize(response, configuration); + throw new UserusernameGetCode404Response.ResponseApiException( + "Received error statusCode response from server", + response, + deserializedResponse + ); + } + } + } +} diff --git a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/userusername/get/parameters/Parameter0.kt b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/userusername/get/parameters/Parameter0.kt new file mode 100644 index 00000000000..d100ccf2d2b --- /dev/null +++ b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/userusername/get/parameters/Parameter0.kt @@ -0,0 +1,7 @@ +package org.openapijsonschematools.client.paths.userusername.get.parameters; + +import org.openapijsonschematools.client.components.parameters.PathUserName; + +public class Parameter0 extends PathUserName { + public static class Parameter01 extends PathUserName1 {} +} diff --git a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/userusername/get/responses/UserusernameGetCode200Response.kt b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/userusername/get/responses/UserusernameGetCode200Response.kt new file mode 100644 index 00000000000..4adda3162b4 --- /dev/null +++ b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/userusername/get/responses/UserusernameGetCode200Response.kt @@ -0,0 +1,81 @@ +package org.openapijsonschematools.client.paths.userusername.get.responses; + +import org.openapijsonschematools.client.configurations.SchemaConfiguration; +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; + +import java.util.AbstractMap; +import java.util.Map; +import java.net.http.HttpResponse; +import java.net.http.HttpHeaders; + +public class UserusernameGetCode200Response { + public sealed interface SealedMediaType permits ApplicationxmlMediaType, ApplicationjsonMediaType {} + + public record ApplicationxmlMediaType(ApplicationxmlSchema.ApplicationxmlSchema1 schema) implements SealedMediaType, MediaType { + public ApplicationxmlMediaType() { + this(ApplicationxmlSchema.ApplicationxmlSchema1.getInstance()); + } + @Override + public Nothing? encoding() { + return null; + } + } + + public record ApplicationjsonMediaType(ApplicationjsonSchema.ApplicationjsonSchema1 schema) implements SealedMediaType, MediaType { + public ApplicationjsonMediaType() { + this(ApplicationjsonSchema.ApplicationjsonSchema1.getInstance()); + } + @Override + public Nothing? encoding() { + return null; + } + } + public sealed interface SealedResponseBody permits ApplicationxmlResponseBody, ApplicationjsonResponseBody {} + public record ApplicationxmlResponseBody(ApplicationxmlSchema.User1Boxed body) implements SealedResponseBody { } + public record ApplicationjsonResponseBody(ApplicationjsonSchema.User1Boxed body) implements SealedResponseBody { } + + public static class UserusernameGetCode200Response1 extends ResponseDeserializer { + public UserusernameGetCode200Response1() { + super( + Map.ofEntries( + new AbstractMap.SimpleEntry<>("application/xml", new ApplicationxmlMediaType()), + new AbstractMap.SimpleEntry<>("application/json", new ApplicationjsonMediaType()) + ) + ); + } + + @Override + 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 { + ApplicationjsonMediaType thisMediaType = (ApplicationjsonMediaType) mediaType; + var deserializedBody = deserializeBody(contentType, body, thisMediaType.schema(), configuration); + return new ApplicationjsonResponseBody(deserializedBody); + } + } + + @Override + protected Nothing? getHeaders(HttpHeaders headers, SchemaConfiguration configuration) { + return null; + } + } + + @SuppressWarnings("serial") + public static class ResponseApiException extends ApiException { + public DeserializedHttpResponse deserializedResponse; + + public ResponseApiException(String s, HttpResponse response, DeserializedHttpResponse deserializedResponse) { + super(s, response); + this.deserializedResponse = deserializedResponse; + } + } +} diff --git a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/userusername/get/responses/UserusernameGetCode400Response.kt b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/userusername/get/responses/UserusernameGetCode400Response.kt new file mode 100644 index 00000000000..2b55ddee017 --- /dev/null +++ b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/userusername/get/responses/UserusernameGetCode400Response.kt @@ -0,0 +1,45 @@ +package org.openapijsonschematools.client.paths.userusername.get.responses; + +import org.openapijsonschematools.client.configurations.SchemaConfiguration; +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; +import java.net.http.HttpResponse; +import java.net.http.HttpHeaders; + +public class UserusernameGetCode400Response { + + public static class UserusernameGetCode400Response1 extends ResponseDeserializer { + public UserusernameGetCode400Response1() { + super( + MapUtils.makeMap( + ) + ); + } + + @Override + protected Nothing? getBody(String contentType, Nothing? mediaType, byte[] body, SchemaConfiguration configuration) { + return null; + } + + @Override + protected Nothing? getHeaders(HttpHeaders headers, SchemaConfiguration configuration) { + return null; + } + } + + @SuppressWarnings("serial") + public static class ResponseApiException extends ApiException { + public DeserializedHttpResponse deserializedResponse; + + public ResponseApiException(String s, HttpResponse response, DeserializedHttpResponse deserializedResponse) { + super(s, response); + this.deserializedResponse = deserializedResponse; + } + } +} diff --git a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/userusername/get/responses/UserusernameGetCode404Response.kt b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/userusername/get/responses/UserusernameGetCode404Response.kt new file mode 100644 index 00000000000..2724e62eeb0 --- /dev/null +++ b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/userusername/get/responses/UserusernameGetCode404Response.kt @@ -0,0 +1,45 @@ +package org.openapijsonschematools.client.paths.userusername.get.responses; + +import org.openapijsonschematools.client.configurations.SchemaConfiguration; +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; +import java.net.http.HttpResponse; +import java.net.http.HttpHeaders; + +public class UserusernameGetCode404Response { + + public static class UserusernameGetCode404Response1 extends ResponseDeserializer { + public UserusernameGetCode404Response1() { + super( + MapUtils.makeMap( + ) + ); + } + + @Override + protected Nothing? getBody(String contentType, Nothing? mediaType, byte[] body, SchemaConfiguration configuration) { + return null; + } + + @Override + protected Nothing? getHeaders(HttpHeaders headers, SchemaConfiguration configuration) { + return null; + } + } + + @SuppressWarnings("serial") + public static class ResponseApiException extends ApiException { + public DeserializedHttpResponse deserializedResponse; + + public ResponseApiException(String s, HttpResponse response, DeserializedHttpResponse deserializedResponse) { + super(s, response); + this.deserializedResponse = deserializedResponse; + } + } +} diff --git a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/userusername/get/responses/code200response/content/applicationjson/ApplicationjsonSchema.kt b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/userusername/get/responses/code200response/content/applicationjson/ApplicationjsonSchema.kt new file mode 100644 index 00000000000..910120ee863 --- /dev/null +++ b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/userusername/get/responses/code200response/content/applicationjson/ApplicationjsonSchema.kt @@ -0,0 +1,19 @@ +package org.openapijsonschematools.client.paths.userusername.get.responses.code200response.content.applicationjson; + +import org.checkerframework.checker.nullness.qual.Nullable; +import org.openapijsonschematools.client.components.schemas.User; + +public class ApplicationjsonSchema extends User { + // $refed class + + + public static class ApplicationjsonSchema1 extends User1 { + private static @Nullable ApplicationjsonSchema1 instance = null; + public static ApplicationjsonSchema1 getInstance() { + if (instance == null) { + instance = new ApplicationjsonSchema1(); + } + return instance; + } + } +} diff --git a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/userusername/get/responses/code200response/content/applicationxml/ApplicationxmlSchema.kt b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/userusername/get/responses/code200response/content/applicationxml/ApplicationxmlSchema.kt new file mode 100644 index 00000000000..0d8e9cf0d9a --- /dev/null +++ b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/userusername/get/responses/code200response/content/applicationxml/ApplicationxmlSchema.kt @@ -0,0 +1,19 @@ +package org.openapijsonschematools.client.paths.userusername.get.responses.code200response.content.applicationxml; + +import org.checkerframework.checker.nullness.qual.Nullable; +import org.openapijsonschematools.client.components.schemas.User; + +public class ApplicationxmlSchema extends User { + // $refed class + + + public static class ApplicationxmlSchema1 extends User1 { + private static @Nullable ApplicationxmlSchema1 instance = null; + public static ApplicationxmlSchema1 getInstance() { + if (instance == null) { + instance = new ApplicationxmlSchema1(); + } + return instance; + } + } +} diff --git a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/userusername/put/Parameters.kt b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/userusername/put/Parameters.kt new file mode 100644 index 00000000000..bd698da0d9d --- /dev/null +++ b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/userusername/put/Parameters.kt @@ -0,0 +1,20 @@ +package org.openapijsonschematools.client.paths.userusername.put; + +import org.openapijsonschematools.client.paths.userusername.put.parameters.Parameter0; +import org.openapijsonschematools.client.parameter.PathSerializer; + +import java.util.Map; +import java.util.AbstractMap; + +public class Parameters { + + public static class PathParametersSerializer extends PathSerializer { + public PathParametersSerializer() { + super( + Map.ofEntries( + new AbstractMap.SimpleEntry<>("username", new Parameter0.Parameter01()) + ) + ); + } + } +} diff --git a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/userusername/put/UserusernamePutPathParameters.kt b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/userusername/put/UserusernamePutPathParameters.kt new file mode 100644 index 00000000000..3c5d2314b2f --- /dev/null +++ b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/userusername/put/UserusernamePutPathParameters.kt @@ -0,0 +1,205 @@ +package org.openapijsonschematools.client.paths.userusername.put; +import java.util.ArrayList; +import java.util.HashSet; +import java.util.LinkedHashMap; +import java.util.LinkedHashSet; +import java.util.List; +import java.util.Map; +import java.util.Objects; +import java.util.Set; +import org.checkerframework.checker.nullness.qual.Nullable; +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.UnsetPropertyException; +import org.openapijsonschematools.client.exceptions.ValidationException; +import org.openapijsonschematools.client.schemas.AnyTypeJsonSchema; +import org.openapijsonschematools.client.schemas.GenericBuilder; +import org.openapijsonschematools.client.schemas.NotAnyTypeJsonSchema; +import org.openapijsonschematools.client.schemas.validation.FrozenMap; +import org.openapijsonschematools.client.schemas.validation.JsonSchema; +import org.openapijsonschematools.client.schemas.validation.JsonSchemaInfo; +import org.openapijsonschematools.client.schemas.validation.MapSchemaValidator; +import org.openapijsonschematools.client.schemas.validation.MapUtils; +import org.openapijsonschematools.client.schemas.validation.PathToSchemasMap; +import org.openapijsonschematools.client.schemas.validation.PropertyEntry; +import org.openapijsonschematools.client.schemas.validation.ValidationMetadata; + +public class UserusernamePutPathParameters { + // nest classes so all schemas and input/output classes can be public + + + public static class AdditionalProperties extends NotAnyTypeJsonSchema.NotAnyTypeJsonSchema1 { + // NotAnyTypeSchema + private static @Nullable AdditionalProperties instance = null; + public static AdditionalProperties getInstance() { + if (instance == null) { + instance = new AdditionalProperties(); + } + return instance; + } + } + + + public static class PathParametersMap extends FrozenMap { + protected PathParametersMap(FrozenMap m) { + super(m); + } + public static final Set requiredKeys = Set.of( + "username" + ); + public static final Set optionalKeys = Set.of(); + public static PathParametersMap of(Map arg, SchemaConfiguration configuration) throws ValidationException { + return UserusernamePutPathParameters1.getInstance().validate(arg, configuration); + } + + public String username() { + try { + return getOrThrow("version"); + } catch (UnsetPropertyException e) { + throw new RuntimeException(e); + } + } + } + + public interface SetterForUsername { + Map getInstance(); + T getBuilderAfterUsername(Map instance); + + default T username(String value) { + var instance = getInstance(); + instance.put("username", value); + return getBuilderAfterUsername(instance); + } + } + + public static class PathParametersMap0Builder implements GenericBuilder> { + private final Map instance; + private static final Set knownKeys = Set.of( + "username" + ); + public Set getKnownKeys() { + return knownKeys; + } + public PathParametersMap0Builder(Map instance) { + this.instance = instance; + } + public Map build() { + return instance; + } + } + + public static class PathParametersMapBuilder implements SetterForUsername { + private final Map instance; + public PathParametersMapBuilder() { + this.instance = new LinkedHashMap<>(); + } + public Map getInstance() { + return instance; + } + public PathParametersMap0Builder getBuilderAfterUsername(Map instance) { + return new PathParametersMap0Builder(instance); + } + } + + + public sealed interface UserusernamePutPathParameters1Boxed permits UserusernamePutPathParameters1BoxedMap { + @Nullable Object getData(); + } + + public record UserusernamePutPathParameters1BoxedMap(PathParametersMap data) implements UserusernamePutPathParameters1Boxed { + @Override + public @Nullable Object getData() { + return data; + } + } + + + public static class UserusernamePutPathParameters1 extends JsonSchema implements MapSchemaValidator { + private static @Nullable UserusernamePutPathParameters1 instance = null; + + protected UserusernamePutPathParameters1() { + super(new JsonSchemaInfo() + .type(Set.of(Map.class)) + .properties(Map.ofEntries( + new PropertyEntry("username", Schema.Schema1.class) + )) + .required(Set.of( + "username" + )) + .additionalProperties(AdditionalProperties.class) + ); + } + + public static UserusernamePutPathParameters1 getInstance() { + if (instance == null) { + instance = new UserusernamePutPathParameters1(); + } + return instance; + } + + 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 RuntimeException("Invalid non-string key value"); + } + String propertyName = (String) entryKey; + List propertyPathToItem = new ArrayList<>(pathToItem); + propertyPathToItem.add(propertyName); + Object value = entry.getValue(); + LinkedHashMap, Nothing?> schemas = pathToSchemas.get(propertyPathToItem); + if (schemas == null) { + throw new RuntimeException("Validation 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"); + } + properties.put(propertyName, (String) propertyInstance); + } + FrozenMap castProperties = new FrozenMap<>(properties); + return new PathParametersMap(castProperties); + } + + 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); + SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().build())); + ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, new PathToSchemasMap(), new LinkedHashSet<>()); + PathToSchemasMap pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet); + return getNewInstance(castArg, validationMetadata.pathToItem(), pathToSchemasMap); + } + + + @Override + public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws 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"); + } + @Override + public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { + if (arg instanceof Map) { + return getNewInstance((Map) arg, pathToItem, pathToSchemas); + } + throw new RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); + } + @Override + public UserusernamePutPathParameters1BoxedMap validateAndBox(Map arg, SchemaConfiguration configuration) throws ValidationException { + return new UserusernamePutPathParameters1BoxedMap(validate(arg, configuration)); + } + @Override + public UserusernamePutPathParameters1Boxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { + 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"); + } + } + +} diff --git a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/userusername/put/UserusernamePutRequestBody.kt b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/userusername/put/UserusernamePutRequestBody.kt new file mode 100644 index 00000000000..0826c38059e --- /dev/null +++ b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/userusername/put/UserusernamePutRequestBody.kt @@ -0,0 +1,49 @@ +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; +import org.openapijsonschematools.client.mediatype.MediaType; +import org.openapijsonschematools.client.paths.userusername.put.requestbody.content.applicationjson.ApplicationjsonSchema; + +import java.util.AbstractMap; +import java.util.Map; + +public class UserusernamePutRequestBody { + public sealed interface SealedMediaType permits ApplicationjsonMediaType {} + + public record ApplicationjsonMediaType(ApplicationjsonSchema.ApplicationjsonSchema1 schema) implements SealedMediaType, MediaType { + public ApplicationjsonMediaType() { + this(ApplicationjsonSchema.ApplicationjsonSchema1.getInstance()); + } + @Override + public Nothing? encoding() { + return null; + } + } + + public static class UserusernamePutRequestBody1 extends RequestBodySerializer { + public UserusernamePutRequestBody1() { + super( + Map.ofEntries( + new AbstractMap.SimpleEntry<>("application/json", new ApplicationjsonMediaType()) + ), + true + ); + } + + public SerializedRequestBody serialize(SealedRequestBody requestBody) throws NotImplementedException { + ApplicationjsonRequestBody requestBody0 = (ApplicationjsonRequestBody) requestBody; + return serialize(requestBody0.contentType(), requestBody0.body().getData()); + } + } + + public sealed interface SealedRequestBody permits ApplicationjsonRequestBody {} + public record ApplicationjsonRequestBody(ApplicationjsonSchema.User1Boxed body) implements SealedRequestBody, GenericRequestBody { + @Override + public String contentType() { + return "application/json"; + } + } +} diff --git a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/userusername/put/UserusernamePutResponses.kt b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/userusername/put/UserusernamePutResponses.kt new file mode 100644 index 00000000000..3c59a9a43da --- /dev/null +++ b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/userusername/put/UserusernamePutResponses.kt @@ -0,0 +1,61 @@ +package org.openapijsonschematools.client.paths.userusername.put; + +import org.openapijsonschematools.client.paths.userusername.put.responses.UserusernamePutCode400Response; +import org.openapijsonschematools.client.paths.userusername.put.responses.UserusernamePutCode404Response; +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; + +import java.net.http.HttpResponse; +import java.util.Map; +import java.util.AbstractMap; + +public class UserusernamePutResponses { + + public sealed interface StatusCodeResponseDeserializer permits StatusUserusernamePutCode400ResponseDeserializer, StatusUserusernamePutCode404ResponseDeserializer {} + + public static final class StatusUserusernamePutCode400ResponseDeserializer extends UserusernamePutCode400Response.UserusernamePutCode400Response1 implements StatusCodeResponseDeserializer { + } + public static final class StatusUserusernamePutCode404ResponseDeserializer extends UserusernamePutCode404Response.UserusernamePutCode404Response1 implements StatusCodeResponseDeserializer { + } + + public static final class UserusernamePutResponses1 implements ResponsesDeserializer { + private final Map statusCodeToResponseDeserializer; + public UserusernamePutResponses1() { + this.statusCodeToResponseDeserializer = Map.ofEntries( + new AbstractMap.SimpleEntry<>("400", new StatusUserusernamePutCode400ResponseDeserializer()), + new AbstractMap.SimpleEntry<>("404", new StatusUserusernamePutCode404ResponseDeserializer()) + ); + } + + public Nothing? deserialize(HttpResponse response, SchemaConfiguration configuration) throws ValidationException, NotImplementedException, ApiException { + String statusCode = String.valueOf(response.statusCode()); + @Nullable StatusCodeResponseDeserializer statusCodeDeserializer = statusCodeToResponseDeserializer.get(statusCode); + if (statusCodeDeserializer == null) { + throw new ApiException( + "Invalid response statusCode="+statusCode+" has no response defined in the openapi document", + response + ); + } + if (statusCodeDeserializer instanceof StatusUserusernamePutCode400ResponseDeserializer castDeserializer) { + var deserializedResponse = castDeserializer.deserialize(response, configuration); + throw new UserusernamePutCode400Response.ResponseApiException( + "Received error statusCode response from server", + response, + deserializedResponse + ); + } else { + StatusUserusernamePutCode404ResponseDeserializer castDeserializer = (StatusUserusernamePutCode404ResponseDeserializer) statusCodeDeserializer; + var deserializedResponse = castDeserializer.deserialize(response, configuration); + throw new UserusernamePutCode404Response.ResponseApiException( + "Received error statusCode response from server", + response, + deserializedResponse + ); + } + } + } +} diff --git a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/userusername/put/parameters/Parameter0.kt b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/userusername/put/parameters/Parameter0.kt new file mode 100644 index 00000000000..cf1add59f0d --- /dev/null +++ b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/userusername/put/parameters/Parameter0.kt @@ -0,0 +1,7 @@ +package org.openapijsonschematools.client.paths.userusername.put.parameters; + +import org.openapijsonschematools.client.components.parameters.PathUserName; + +public class Parameter0 extends PathUserName { + public static class Parameter01 extends PathUserName1 {} +} diff --git a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/userusername/put/requestbody/content/applicationjson/ApplicationjsonSchema.kt b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/userusername/put/requestbody/content/applicationjson/ApplicationjsonSchema.kt new file mode 100644 index 00000000000..80f49dd652b --- /dev/null +++ b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/userusername/put/requestbody/content/applicationjson/ApplicationjsonSchema.kt @@ -0,0 +1,19 @@ +package org.openapijsonschematools.client.paths.userusername.put.requestbody.content.applicationjson; + +import org.checkerframework.checker.nullness.qual.Nullable; +import org.openapijsonschematools.client.components.schemas.User; + +public class ApplicationjsonSchema extends User { + // $refed class + + + public static class ApplicationjsonSchema1 extends User1 { + private static @Nullable ApplicationjsonSchema1 instance = null; + public static ApplicationjsonSchema1 getInstance() { + if (instance == null) { + instance = new ApplicationjsonSchema1(); + } + return instance; + } + } +} diff --git a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/userusername/put/responses/UserusernamePutCode400Response.kt b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/userusername/put/responses/UserusernamePutCode400Response.kt new file mode 100644 index 00000000000..665bac92d82 --- /dev/null +++ b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/userusername/put/responses/UserusernamePutCode400Response.kt @@ -0,0 +1,45 @@ +package org.openapijsonschematools.client.paths.userusername.put.responses; + +import org.openapijsonschematools.client.configurations.SchemaConfiguration; +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; +import java.net.http.HttpResponse; +import java.net.http.HttpHeaders; + +public class UserusernamePutCode400Response { + + public static class UserusernamePutCode400Response1 extends ResponseDeserializer { + public UserusernamePutCode400Response1() { + super( + MapUtils.makeMap( + ) + ); + } + + @Override + protected Nothing? getBody(String contentType, Nothing? mediaType, byte[] body, SchemaConfiguration configuration) { + return null; + } + + @Override + protected Nothing? getHeaders(HttpHeaders headers, SchemaConfiguration configuration) { + return null; + } + } + + @SuppressWarnings("serial") + public static class ResponseApiException extends ApiException { + public DeserializedHttpResponse deserializedResponse; + + public ResponseApiException(String s, HttpResponse response, DeserializedHttpResponse deserializedResponse) { + super(s, response); + this.deserializedResponse = deserializedResponse; + } + } +} diff --git a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/userusername/put/responses/UserusernamePutCode404Response.kt b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/userusername/put/responses/UserusernamePutCode404Response.kt new file mode 100644 index 00000000000..8e20ce56777 --- /dev/null +++ b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/userusername/put/responses/UserusernamePutCode404Response.kt @@ -0,0 +1,45 @@ +package org.openapijsonschematools.client.paths.userusername.put.responses; + +import org.openapijsonschematools.client.configurations.SchemaConfiguration; +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; +import java.net.http.HttpResponse; +import java.net.http.HttpHeaders; + +public class UserusernamePutCode404Response { + + public static class UserusernamePutCode404Response1 extends ResponseDeserializer { + public UserusernamePutCode404Response1() { + super( + MapUtils.makeMap( + ) + ); + } + + @Override + protected Nothing? getBody(String contentType, Nothing? mediaType, byte[] body, SchemaConfiguration configuration) { + return null; + } + + @Override + protected Nothing? getHeaders(HttpHeaders headers, SchemaConfiguration configuration) { + return null; + } + } + + @SuppressWarnings("serial") + public static class ResponseApiException extends ApiException { + public DeserializedHttpResponse deserializedResponse; + + public ResponseApiException(String s, HttpResponse response, DeserializedHttpResponse deserializedResponse) { + super(s, response); + this.deserializedResponse = deserializedResponse; + } + } +} diff --git a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/requestbody/GenericRequestBody.kt b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/requestbody/GenericRequestBody.kt new file mode 100644 index 00000000000..69f2f72cb73 --- /dev/null +++ b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/requestbody/GenericRequestBody.kt @@ -0,0 +1,6 @@ +package org.openapijsonschematools.client.requestbody; + +public interface GenericRequestBody { + String contentType(); + SealedSchemaOutputClass body(); +} \ No newline at end of file diff --git a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/requestbody/RequestBodySerializer.kt b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/requestbody/RequestBodySerializer.kt new file mode 100644 index 00000000000..6be6cbffd80 --- /dev/null +++ b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/requestbody/RequestBodySerializer.kt @@ -0,0 +1,47 @@ +package org.openapijsonschematools.client.requestbody; + +import java.net.http.HttpRequest; +import org.checkerframework.checker.nullness.qual.Nullable; +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; + +public abstract class RequestBodySerializer { + /* + * Describes a single request body + * content: contentType to MediaType schema info + */ + public final Map content; + public final boolean required; + + public RequestBodySerializer(Map content, boolean required) { + this.content = content; + this.required = required; + } + + private SerializedRequestBody serializeJson(String contentType, @Nullable Object body) { + String jsonText = ContentTypeSerializer.toJson(body); + return new SerializedRequestBody(contentType, HttpRequest.BodyPublishers.ofString(jsonText)); + } + + private SerializedRequestBody serializeTextPlain(String contentType, @Nullable Object body) { + if (body instanceof String stringBody) { + return new SerializedRequestBody(contentType, HttpRequest.BodyPublishers.ofString(stringBody)); + } + throw new RuntimeException("Invalid non-string data type of "+JsonSchema.getClass(body)+" for text/plain body serialization"); + } + + protected SerializedRequestBody serialize(String contentType, @Nullable Object body) throws NotImplementedException { + if (ContentTypeDetector.contentTypeIsJson(contentType)) { + return serializeJson(contentType, body); + } else if (ContentTypeDetector.contentTypeIsTextPlain(contentType)) { + return serializeTextPlain(contentType, body); + } + throw new NotImplementedException("Serialization has not yet been implemented for contentType="+contentType+". If you need it please file a PR"); + } + + public abstract SerializedRequestBody serialize(T requestBody) throws NotImplementedException; +} \ No newline at end of file diff --git a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/requestbody/SerializedRequestBody.kt b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/requestbody/SerializedRequestBody.kt new file mode 100644 index 00000000000..62185c6f7aa --- /dev/null +++ b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/requestbody/SerializedRequestBody.kt @@ -0,0 +1,13 @@ +package org.openapijsonschematools.client.requestbody; + +import java.net.http.HttpRequest; + +public class SerializedRequestBody { + public final String contentType; + public final HttpRequest.BodyPublisher bodyPublisher; + + protected SerializedRequestBody(String contentType, HttpRequest.BodyPublisher bodyPublisher) { + this.contentType = contentType; + this.bodyPublisher = bodyPublisher; + } +} \ No newline at end of file diff --git a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/response/ApiResponse.kt b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/response/ApiResponse.kt new file mode 100644 index 00000000000..dab55e0f2da --- /dev/null +++ b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/response/ApiResponse.kt @@ -0,0 +1,9 @@ +package org.openapijsonschematools.client.response; + +import java.net.http.HttpResponse; + +public interface ApiResponse { + HttpResponse response(); + SealedBodyOutputClass body(); + HeaderOutputClass headers(); +} \ No newline at end of file diff --git a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/response/DeserializedHttpResponse.kt b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/response/DeserializedHttpResponse.kt new file mode 100644 index 00000000000..d9c62c28c70 --- /dev/null +++ b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/response/DeserializedHttpResponse.kt @@ -0,0 +1,6 @@ +package org.openapijsonschematools.client.response; + +import java.net.http.HttpResponse; + +public record DeserializedHttpResponse(SealedBodyOutputClass body, HeaderOutputClass headers) { +} \ No newline at end of file diff --git a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/response/HeadersDeserializer.kt b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/response/HeadersDeserializer.kt new file mode 100644 index 00000000000..9ec3e3c44a6 --- /dev/null +++ b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/response/HeadersDeserializer.kt @@ -0,0 +1,37 @@ +package org.openapijsonschematools.client.response; + +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; + +import java.net.http.HttpHeaders; +import java.util.HashMap; +import java.util.List; +import java.util.Map; + +public abstract class HeadersDeserializer { + private final Map headers; + final private MapSchemaValidator headersSchema; + public HeadersDeserializer(Map headers, MapSchemaValidator headersSchema) { + this.headers = headers; + this.headersSchema = headersSchema; + } + + public OutType deserialize(HttpHeaders responseHeaders, SchemaConfiguration configuration) throws ValidationException, NotImplementedException { + Map headersToValidate = new HashMap<>(); + for (Map.Entry> entry: responseHeaders.map().entrySet()) { + String headerName = entry.getKey(); + Header headerDeserializer = headers.get(headerName); + if (headerDeserializer == null) { + // todo put this data in headersToValidate, if only one item in list load it in, otherwise join them with commas + continue; + } + @Nullable Object headerValue = headerDeserializer.deserialize(entry.getValue(), false, configuration); + headersToValidate.put(headerName, headerValue); + } + return headersSchema.validate(headersToValidate, configuration); + } +} diff --git a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/response/ResponseDeserializer.kt b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/response/ResponseDeserializer.kt new file mode 100644 index 00000000000..640f2a96415 --- /dev/null +++ b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/response/ResponseDeserializer.kt @@ -0,0 +1,74 @@ +package org.openapijsonschematools.client.response; + +import java.net.http.HttpHeaders; +import java.net.http.HttpResponse; +import java.nio.charset.StandardCharsets; +import java.util.Map; +import java.util.Optional; + +import org.checkerframework.checker.nullness.qual.Nullable; + +import 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; + + public ResponseDeserializer(Map content) { + this.content = content; + this.headers = null; + } + + protected abstract SealedBodyClass getBody(String contentType, SealedMediaTypeClass mediaType, byte[] body, SchemaConfiguration configuration) throws ValidationException, NotImplementedException; + protected abstract HeaderClass getHeaders(HttpHeaders headers, SchemaConfiguration configuration) throws ValidationException, NotImplementedException; + + protected @Nullable Object deserializeJson(byte[] body) { + String bodyStr = new String(body, StandardCharsets.UTF_8); + return ContentTypeDeserializer.fromJson(bodyStr); + } + + protected String deserializeTextPlain(byte[] body) { + return new String(body, StandardCharsets.UTF_8); + } + + protected T deserializeBody(String contentType, byte[] body, JsonSchema schema, SchemaConfiguration configuration) throws ValidationException, NotImplementedException { + if (ContentTypeDetector.contentTypeIsJson(contentType)) { + @Nullable Object bodyData = deserializeJson(body); + return schema.validateAndBox(bodyData, configuration); + } else if (ContentTypeDetector.contentTypeIsTextPlain(contentType)) { + String bodyData = deserializeTextPlain(body); + return schema.validateAndBox(bodyData, configuration); + } + throw new NotImplementedException("Deserialization for contentType="+contentType+" has not yet been implemented."); + } + + public DeserializedHttpResponse deserialize(HttpResponse response, SchemaConfiguration configuration) throws ValidationException, NotImplementedException, ApiException { + Optional contentTypeInfo = response.headers().firstValue("Content-Type"); + if (contentTypeInfo.isEmpty()) { + throw new ApiException( + "Invalid response returned, Content-Type header is missing and it must be included", + response + ); + } + String contentType = contentTypeInfo.get(); + @Nullable SealedMediaTypeClass mediaType = content.get(contentType); + if (mediaType == null) { + throw new ApiException( + "Invalid contentType returned. contentType="+contentType+" was returned "+ + "when only "+content.keySet()+" are defined for statusCode="+response.statusCode(), + response + ); + } + byte[] bodyBytes = response.body(); + SealedBodyClass body = getBody(contentType, mediaType, bodyBytes, configuration); + HeaderClass headers = getHeaders(response.headers(), configuration); + return new DeserializedHttpResponse<>(body, headers); + } +} \ No newline at end of file diff --git a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/response/ResponsesDeserializer.kt b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/response/ResponsesDeserializer.kt new file mode 100644 index 00000000000..f72be2313af --- /dev/null +++ b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/response/ResponsesDeserializer.kt @@ -0,0 +1,11 @@ +package org.openapijsonschematools.client.response; + +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; +} \ No newline at end of file diff --git a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/restclient/RestClient.kt b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/restclient/RestClient.kt new file mode 100644 index 00000000000..3cfc70284ca --- /dev/null +++ b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/restclient/RestClient.kt @@ -0,0 +1,67 @@ +package org.openapijsonschematools.client.restclient; + +import org.checkerframework.checker.nullness.qual.Nullable; +import java.io.IOException; +import java.net.URI; +import java.net.http.HttpClient; +import java.net.http.HttpRequest; +import java.net.http.HttpResponse; +import java.time.Duration; +import java.util.List; +import java.util.Map; + +public class RestClient { + public static HttpRequest getRequest( + String serviceUrl, + String method, + HttpRequest.BodyPublisher bodyPublisher, + Map> headers, + @Nullable Duration timeout + ) { + HttpRequest.Builder request = HttpRequest.newBuilder(URI.create(serviceUrl)); + switch (method) { + case "get": + request.GET(); + break; + case "put": + request.method("PUT", bodyPublisher); + break; + case "patch": + request.method("PATCH", bodyPublisher); + break; + case "post": + request.method("POST", bodyPublisher); + break; + case "delete": + request.DELETE(); + break; + case "trace": + request.method("TRACE", bodyPublisher); + break; + case "options": + request.method("OPTIONS", bodyPublisher); + break; + case "head": + request.method("HEAD", bodyPublisher); + break; + case "connect": + request.method("CONNECT", bodyPublisher); + break; + default: + throw new RuntimeException("Invalid http method"); + } + for (Map.Entry> entry: headers.entrySet()) { + String headerName = entry.getKey(); + String headerValue = String.join(", ", entry.getValue()); + request.header(headerName, headerValue); + } + if (timeout != null) { + request.timeout(timeout); + } + return request.build(); + } + + public static HttpResponse getResponse(HttpRequest request, HttpClient client) throws IOException, InterruptedException { + return client.send(request, HttpResponse.BodyHandlers.ofByteArray()); + } +} diff --git a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/schemas/AnyTypeJsonSchema.kt b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/schemas/AnyTypeJsonSchema.kt new file mode 100644 index 00000000000..1f1c918ca27 --- /dev/null +++ b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/schemas/AnyTypeJsonSchema.kt @@ -0,0 +1,315 @@ +package org.openapijsonschematools.client.schemas; + +import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags; +import org.openapijsonschematools.client.configurations.SchemaConfiguration; +import org.openapijsonschematools.client.exceptions.ValidationException; +import org.openapijsonschematools.client.schemas.validation.FrozenList; +import org.openapijsonschematools.client.schemas.validation.FrozenMap; +import org.openapijsonschematools.client.schemas.validation.JsonSchema; +import org.openapijsonschematools.client.schemas.validation.JsonSchemaInfo; +import org.openapijsonschematools.client.schemas.validation.PathToSchemasMap; +import org.openapijsonschematools.client.schemas.validation.NullSchemaValidator; +import org.openapijsonschematools.client.schemas.validation.BooleanSchemaValidator; +import org.openapijsonschematools.client.schemas.validation.NumberSchemaValidator; +import org.openapijsonschematools.client.schemas.validation.StringSchemaValidator; +import org.openapijsonschematools.client.schemas.validation.ListSchemaValidator; +import org.openapijsonschematools.client.schemas.validation.MapSchemaValidator; +import org.openapijsonschematools.client.schemas.validation.ValidationMetadata; +import org.checkerframework.checker.nullness.qual.Nullable; + +import java.time.LocalDate; +import java.time.ZonedDateTime; +import java.util.LinkedHashMap; +import java.util.List; +import java.util.HashSet; +import java.util.ArrayList; +import java.util.LinkedHashSet; +import java.util.Set; +import java.util.Map; +import java.util.Objects; +import java.util.UUID; + +public class AnyTypeJsonSchema { + public sealed interface AnyTypeJsonSchema1Boxed permits AnyTypeJsonSchema1BoxedVoid, AnyTypeJsonSchema1BoxedBoolean, AnyTypeJsonSchema1BoxedNumber, AnyTypeJsonSchema1BoxedString, AnyTypeJsonSchema1BoxedList, AnyTypeJsonSchema1BoxedMap { + @Nullable Object getData(); + } + public record AnyTypeJsonSchema1BoxedVoid(Nothing? data) implements AnyTypeJsonSchema1Boxed { + @Override + public @Nullable Object getData() { + return data; + } + } + public record AnyTypeJsonSchema1BoxedBoolean(boolean data) implements AnyTypeJsonSchema1Boxed { + @Override + public @Nullable Object getData() { + return data; + } + } + public record AnyTypeJsonSchema1BoxedNumber(Number data) implements AnyTypeJsonSchema1Boxed { + @Override + public @Nullable Object getData() { + return data; + } + } + public record AnyTypeJsonSchema1BoxedString(String data) implements AnyTypeJsonSchema1Boxed { + @Override + public @Nullable Object getData() { + return data; + } + } + public record AnyTypeJsonSchema1BoxedList(FrozenList<@Nullable Object> data) implements AnyTypeJsonSchema1Boxed { + @Override + public @Nullable Object getData() { + return data; + } + } + public record AnyTypeJsonSchema1BoxedMap(FrozenMap<@Nullable Object> data) implements AnyTypeJsonSchema1Boxed { + @Override + public @Nullable Object getData() { + return data; + } + } + + public static class AnyTypeJsonSchema1 extends JsonSchema implements NullSchemaValidator, BooleanSchemaValidator, NumberSchemaValidator, StringSchemaValidator, ListSchemaValidator, AnyTypeJsonSchema1BoxedList>, MapSchemaValidator, AnyTypeJsonSchema1BoxedMap> { + private static @Nullable AnyTypeJsonSchema1 instance = null; + + protected AnyTypeJsonSchema1() { + super(new JsonSchemaInfo()); + } + + public static AnyTypeJsonSchema1 getInstance() { + if (instance == null) { + instance = new AnyTypeJsonSchema1(); + } + return instance; + } + + @Override + public Nothing? validate(Nothing? arg, SchemaConfiguration configuration) throws ValidationException { + Set> pathSet = new HashSet<>(); + List pathToItem = List.of("args[0]"); + Nothing? castArg = castToAllowedTypes(arg, pathToItem, pathSet); + SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().build())); + PathToSchemasMap validatedPathToSchemas = new PathToSchemasMap(); + ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, new LinkedHashSet<>()); + PathToSchemasMap pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet); + return getNewInstance(castArg, validationMetadata.pathToItem(), pathToSchemasMap); + } + + @Override + public boolean validate(boolean arg, SchemaConfiguration configuration) throws ValidationException { + Set> pathSet = new HashSet<>(); + List pathToItem = List.of("args[0]"); + boolean castArg = castToAllowedTypes(arg, pathToItem, pathSet); + SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().build())); + PathToSchemasMap validatedPathToSchemas = new PathToSchemasMap(); + ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, new LinkedHashSet<>()); + PathToSchemasMap pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet); + return getNewInstance(castArg, validationMetadata.pathToItem(), pathToSchemasMap); + } + + @Override + public Number validate(Number arg, SchemaConfiguration configuration) throws ValidationException { + Set> pathSet = new HashSet<>(); + List pathToItem = List.of("args[0]"); + Number castArg = castToAllowedTypes(arg, pathToItem, pathSet); + SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().build())); + PathToSchemasMap validatedPathToSchemas = new PathToSchemasMap(); + ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, new LinkedHashSet<>()); + PathToSchemasMap pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet); + return getNewInstance(castArg, validationMetadata.pathToItem(), pathToSchemasMap); + } + + public int validate(int arg, SchemaConfiguration configuration) throws ValidationException { + return (int) validate((Number) arg, configuration); + } + + public long validate(long arg, SchemaConfiguration configuration) throws ValidationException { + return (long) validate((Number) arg, configuration); + } + + public float validate(float arg, SchemaConfiguration configuration) throws ValidationException { + return (float) validate((Number) arg, configuration); + } + + public double validate(double arg, SchemaConfiguration configuration) throws ValidationException { + return (double) validate((Number) arg, configuration); + } + + @Override + public String validate(String arg, SchemaConfiguration configuration) throws ValidationException { + Set> pathSet = new HashSet<>(); + List pathToItem = List.of("args[0]"); + String castArg = castToAllowedTypes(arg, pathToItem, pathSet); + SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().build())); + PathToSchemasMap validatedPathToSchemas = new PathToSchemasMap(); + ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, new LinkedHashSet<>()); + PathToSchemasMap pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet); + return getNewInstance(castArg, validationMetadata.pathToItem(), pathToSchemasMap); + } + + public String validate(LocalDate arg, SchemaConfiguration configuration) throws ValidationException { + return validate(arg.toString(), configuration); + } + + public String validate(ZonedDateTime arg, SchemaConfiguration configuration) throws ValidationException { + return validate(arg.toString(), configuration); + } + + public String validate(UUID arg, SchemaConfiguration configuration) throws ValidationException { + return validate(arg.toString(), configuration); + } + + @Override + public FrozenList<@Nullable Object> getNewInstance(List arg, List pathToItem, PathToSchemasMap pathToSchemas) { + List<@Nullable Object> items = new ArrayList<>(); + int i = 0; + for (Object item: arg) { + List itemPathToItem = new ArrayList<>(pathToItem); + itemPathToItem.add(i); + LinkedHashMap, Nothing?> schemas = pathToSchemas.get(itemPathToItem); + if (schemas == null) { + 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); + items.add(castItem); + i += 1; + } + return new FrozenList<>(items); + } + + 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); + SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().build())); + PathToSchemasMap validatedPathToSchemas = new PathToSchemasMap(); + ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, new LinkedHashSet<>()); + PathToSchemasMap pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet); + return getNewInstance(castArg, validationMetadata.pathToItem(), pathToSchemasMap); + } + + @Override + 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 RuntimeException("Invalid non-string key value"); + } + String propertyName = (String) entryKey; + List propertyPathToItem = new ArrayList<>(pathToItem); + propertyPathToItem.add(propertyName); + Object value = entry.getValue(); + LinkedHashMap, Nothing?> schemas = pathToSchemas.get(propertyPathToItem); + if (schemas == null) { + 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); + properties.put(propertyName, castValue); + } + return new FrozenMap<>(properties); + } + + public FrozenMap<@Nullable Object> validate(Map arg, SchemaConfiguration configuration) throws ValidationException { + Set> pathSet = new HashSet<>(); + List pathToItem = List.of("args[0]"); + Map castArg = castToAllowedTypes(arg, pathToItem, pathSet); + SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().build())); + PathToSchemasMap validatedPathToSchemas = new PathToSchemasMap(); + ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, new LinkedHashSet<>()); + PathToSchemasMap pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet); + return getNewInstance(castArg, validationMetadata.pathToItem(), pathToSchemasMap); + } + + @Override + public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { + if (arg == null) { + return getNewInstance((Nothing?) null, pathToItem, pathToSchemas); + } else if (arg instanceof Boolean) { + boolean boolArg = (Boolean) arg; + return getNewInstance(boolArg, pathToItem, pathToSchemas); + } else if (arg instanceof Number) { + return getNewInstance((Number) arg, pathToItem, pathToSchemas); + } else if (arg instanceof String) { + return getNewInstance((String) arg, pathToItem, pathToSchemas); + } else if (arg instanceof List) { + return getNewInstance((List) arg, 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"); + } + + @Override + public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { + if (arg == null) { + return validate((Nothing?) null, configuration); + } else if (arg instanceof Boolean) { + boolean boolArg = (Boolean) arg; + return validate(boolArg, configuration); + } else if (arg instanceof Number) { + return validate((Number) arg, configuration); + } else if (arg instanceof String) { + return validate((String) arg, configuration); + } else if (arg instanceof List) { + return validate((List) arg, 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"); + } + + @Override + public AnyTypeJsonSchema1BoxedVoid validateAndBox(Nothing? arg, SchemaConfiguration configuration) throws ValidationException { + return new AnyTypeJsonSchema1BoxedVoid(validate(arg, configuration)); + } + + @Override + 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 { + return new AnyTypeJsonSchema1BoxedNumber(validate(arg, configuration)); + } + + @Override + 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 { + return new AnyTypeJsonSchema1BoxedList(validate(arg, configuration)); + } + + @Override + 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 { + if (arg == null) { + Nothing? castArg = (Nothing?) arg; + return validateAndBox(castArg, configuration); + } else if (arg instanceof Boolean booleanArg) { + boolean castArg = booleanArg; + return validateAndBox(castArg, configuration); + } else if (arg instanceof String castArg) { + return validateAndBox(castArg, configuration); + } else if (arg instanceof Number castArg) { + return validateAndBox(castArg, configuration); + } else if (arg instanceof List castArg) { + 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"); + } + } +} \ No newline at end of file diff --git a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/schemas/BooleanJsonSchema.kt b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/schemas/BooleanJsonSchema.kt new file mode 100644 index 00000000000..86598ab393d --- /dev/null +++ b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/schemas/BooleanJsonSchema.kt @@ -0,0 +1,88 @@ +package org.openapijsonschematools.client.schemas; + +import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags; +import org.openapijsonschematools.client.configurations.SchemaConfiguration; +import org.openapijsonschematools.client.exceptions.ValidationException; +import org.openapijsonschematools.client.schemas.validation.JsonSchema; +import org.openapijsonschematools.client.schemas.validation.JsonSchemaInfo; +import org.openapijsonschematools.client.schemas.validation.PathToSchemasMap; +import org.openapijsonschematools.client.schemas.validation.BooleanSchemaValidator; +import org.openapijsonschematools.client.schemas.validation.ValidationMetadata; +import org.checkerframework.checker.nullness.qual.Nullable; + +import java.util.HashSet; +import java.util.LinkedHashSet; +import java.util.List; +import java.util.Objects; +import java.util.Set; + +public class BooleanJsonSchema { + public sealed interface BooleanJsonSchema1Boxed permits BooleanJsonSchema1BoxedBoolean { + @Nullable Object getData(); + } + public record BooleanJsonSchema1BoxedBoolean(boolean data) implements BooleanJsonSchema1Boxed { + @Override + public @Nullable Object getData() { + return data; + } + } + public static class BooleanJsonSchema1 extends JsonSchema implements BooleanSchemaValidator { + private static @Nullable BooleanJsonSchema1 instance = null; + + protected BooleanJsonSchema1() { + super(new JsonSchemaInfo() + .type(Set.of(Boolean.class)) + ); + } + + public static BooleanJsonSchema1 getInstance() { + if (instance == null) { + instance = new BooleanJsonSchema1(); + } + return instance; + } + + @Override + public boolean validate(boolean arg, SchemaConfiguration configuration) throws ValidationException { + Set> pathSet = new HashSet<>(); + List pathToItem = List.of("args[0"); + boolean castArg = castToAllowedTypes(arg, pathToItem, pathSet); + SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().build())); + ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, new PathToSchemasMap(), new LinkedHashSet<>()); + PathToSchemasMap pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet); + return getNewInstance(castArg, validationMetadata.pathToItem(), pathToSchemasMap); + } + + @Override + 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 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 { + 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"); + } + + @Override + 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 { + 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"); + } + } +} \ No newline at end of file diff --git a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/schemas/DateJsonSchema.kt b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/schemas/DateJsonSchema.kt new file mode 100644 index 00000000000..9e795318d67 --- /dev/null +++ b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/schemas/DateJsonSchema.kt @@ -0,0 +1,94 @@ +package org.openapijsonschematools.client.schemas; + +import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags; +import org.openapijsonschematools.client.configurations.SchemaConfiguration; +import org.openapijsonschematools.client.exceptions.ValidationException; +import org.openapijsonschematools.client.schemas.validation.JsonSchema; +import org.openapijsonschematools.client.schemas.validation.JsonSchemaInfo; +import org.openapijsonschematools.client.schemas.validation.PathToSchemasMap; +import org.openapijsonschematools.client.schemas.validation.StringSchemaValidator; +import org.openapijsonschematools.client.schemas.validation.ValidationMetadata; +import org.checkerframework.checker.nullness.qual.Nullable; + +import java.time.LocalDate; +import java.util.HashSet; +import java.util.LinkedHashSet; +import java.util.List; +import java.util.Objects; +import java.util.Set; + +public class DateJsonSchema { + public sealed interface DateJsonSchema1Boxed permits DateJsonSchema1BoxedString { + @Nullable Object getData(); + } + public record DateJsonSchema1BoxedString(String data) implements DateJsonSchema1Boxed { + @Override + public @Nullable Object getData() { + return data; + } + } + + public static class DateJsonSchema1 extends JsonSchema implements StringSchemaValidator { + private static @Nullable DateJsonSchema1 instance = null; + + protected DateJsonSchema1() { + super(new JsonSchemaInfo() + .type(Set.of(String.class)) + .format("date") + ); + } + + public static DateJsonSchema1 getInstance() { + if (instance == null) { + instance = new DateJsonSchema1(); + } + return instance; + } + + @Override + public String validate(String arg, SchemaConfiguration configuration) throws ValidationException { + Set> pathSet = new HashSet<>(); + List pathToItem = List.of("args[0"); + String castArg = castToAllowedTypes(arg, pathToItem, pathSet); + SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().build())); + ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, new PathToSchemasMap(), new LinkedHashSet<>()); + PathToSchemasMap pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet); + return getNewInstance(castArg, validationMetadata.pathToItem(), pathToSchemasMap); + } + + public String validate(LocalDate arg, SchemaConfiguration configuration) throws ValidationException { + return validate(arg.toString(), configuration); + } + + @Override + public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { + 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"); + } + + @Override + 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 ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + } + + @Override + 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 { + 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"); + } + } +} \ No newline at end of file diff --git a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/schemas/DateTimeJsonSchema.kt b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/schemas/DateTimeJsonSchema.kt new file mode 100644 index 00000000000..3304924e331 --- /dev/null +++ b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/schemas/DateTimeJsonSchema.kt @@ -0,0 +1,94 @@ +package org.openapijsonschematools.client.schemas; + +import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags; +import org.openapijsonschematools.client.configurations.SchemaConfiguration; +import org.openapijsonschematools.client.exceptions.ValidationException; +import org.openapijsonschematools.client.schemas.validation.JsonSchema; +import org.openapijsonschematools.client.schemas.validation.JsonSchemaInfo; +import org.openapijsonschematools.client.schemas.validation.PathToSchemasMap; +import org.openapijsonschematools.client.schemas.validation.StringSchemaValidator; +import org.openapijsonschematools.client.schemas.validation.ValidationMetadata; +import org.checkerframework.checker.nullness.qual.Nullable; + +import java.time.ZonedDateTime; +import java.util.HashSet; +import java.util.LinkedHashSet; +import java.util.List; +import java.util.Objects; +import java.util.Set; + +public class DateTimeJsonSchema { + public sealed interface DateTimeJsonSchema1Boxed permits DateTimeJsonSchema1BoxedString { + @Nullable Object getData(); + } + public record DateTimeJsonSchema1BoxedString(String data) implements DateTimeJsonSchema1Boxed { + @Override + public @Nullable Object getData() { + return data; + } + } + + public static class DateTimeJsonSchema1 extends JsonSchema implements StringSchemaValidator { + private static @Nullable DateTimeJsonSchema1 instance = null; + + protected DateTimeJsonSchema1() { + super(new JsonSchemaInfo() + .type(Set.of(String.class)) + .format("date-time") + ); + } + + public static DateTimeJsonSchema1 getInstance() { + if (instance == null) { + instance = new DateTimeJsonSchema1(); + } + return instance; + } + + @Override + public String validate(String arg, SchemaConfiguration configuration) throws ValidationException { + Set> pathSet = new HashSet<>(); + List pathToItem = List.of("args[0"); + String castArg = castToAllowedTypes(arg, pathToItem, pathSet); + SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().build())); + ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, new PathToSchemasMap(), new LinkedHashSet<>()); + PathToSchemasMap pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet); + return getNewInstance(castArg, validationMetadata.pathToItem(), pathToSchemasMap); + } + + public String validate(ZonedDateTime arg, SchemaConfiguration configuration) throws ValidationException { + return validate(arg.toString(), configuration); + } + + @Override + public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { + 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"); + } + + @Override + 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 ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + } + + @Override + 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 { + 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"); + } + } +} \ No newline at end of file diff --git a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/schemas/DecimalJsonSchema.kt b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/schemas/DecimalJsonSchema.kt new file mode 100644 index 00000000000..f9e3f6a6f3b --- /dev/null +++ b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/schemas/DecimalJsonSchema.kt @@ -0,0 +1,87 @@ +package org.openapijsonschematools.client.schemas; + +import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags; +import org.openapijsonschematools.client.configurations.SchemaConfiguration; +import org.openapijsonschematools.client.exceptions.ValidationException; +import org.openapijsonschematools.client.schemas.validation.JsonSchema; +import org.openapijsonschematools.client.schemas.validation.JsonSchemaInfo; +import org.openapijsonschematools.client.schemas.validation.PathToSchemasMap; +import org.openapijsonschematools.client.schemas.validation.StringSchemaValidator; +import org.openapijsonschematools.client.schemas.validation.ValidationMetadata; +import org.checkerframework.checker.nullness.qual.Nullable; + +import java.util.HashSet; +import java.util.LinkedHashSet; +import java.util.List; +import java.util.Objects; +import java.util.Set; + +public class DecimalJsonSchema { + public sealed interface DecimalJsonSchema1Boxed permits DecimalJsonSchema1BoxedString { + @Nullable Object getData(); + } + public record DecimalJsonSchema1BoxedString(String data) implements DecimalJsonSchema1Boxed { + @Override + public @Nullable Object getData() { + return data; + } + } + + public static class DecimalJsonSchema1 extends JsonSchema implements StringSchemaValidator { + private static @Nullable DecimalJsonSchema1 instance = null; + + protected DecimalJsonSchema1() { + super(new JsonSchemaInfo() + .type(Set.of(String.class)) + .format("number") + ); + } + + public static DecimalJsonSchema1 getInstance() { + if (instance == null) { + instance = new DecimalJsonSchema1(); + } + return instance; + } + + @Override + public String validate(String arg, SchemaConfiguration configuration) throws ValidationException { + Set> pathSet = new HashSet<>(); + List pathToItem = List.of("args[0"); + String castArg = castToAllowedTypes(arg, pathToItem, pathSet); + SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().build())); + ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, new PathToSchemasMap(), new LinkedHashSet<>()); + PathToSchemasMap pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet); + return getNewInstance(castArg, validationMetadata.pathToItem(), pathToSchemasMap); + } + + @Override + public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { + 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"); + } + + @Override + public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws 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"); + } + + @Override + 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 { + 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"); + } + } +} \ No newline at end of file diff --git a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/schemas/DoubleJsonSchema.kt b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/schemas/DoubleJsonSchema.kt new file mode 100644 index 00000000000..c45d985d95d --- /dev/null +++ b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/schemas/DoubleJsonSchema.kt @@ -0,0 +1,91 @@ +package org.openapijsonschematools.client.schemas; + +import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags; +import org.openapijsonschematools.client.configurations.SchemaConfiguration; +import org.openapijsonschematools.client.exceptions.ValidationException; +import org.openapijsonschematools.client.schemas.validation.JsonSchema; +import org.openapijsonschematools.client.schemas.validation.JsonSchemaInfo; +import org.openapijsonschematools.client.schemas.validation.PathToSchemasMap; +import org.openapijsonschematools.client.schemas.validation.NumberSchemaValidator; +import org.openapijsonschematools.client.schemas.validation.ValidationMetadata; +import org.checkerframework.checker.nullness.qual.Nullable; + +import java.util.HashSet; +import java.util.LinkedHashSet; +import java.util.List; +import java.util.Objects; +import java.util.Set; + +public class DoubleJsonSchema { + public sealed interface DoubleJsonSchema1Boxed permits DoubleJsonSchema1BoxedNumber { + @Nullable Object getData(); + } + public record DoubleJsonSchema1BoxedNumber(Number data) implements DoubleJsonSchema1Boxed { + @Override + public @Nullable Object getData() { + return data; + } + } + + public static class DoubleJsonSchema1 extends JsonSchema implements NumberSchemaValidator { + private static @Nullable DoubleJsonSchema1 instance = null; + + protected DoubleJsonSchema1() { + super(new JsonSchemaInfo() + .type(Set.of(Double.class)) + .format("double") + ); + } + + public static DoubleJsonSchema1 getInstance() { + if (instance == null) { + instance = new DoubleJsonSchema1(); + } + return instance; + } + + @Override + public Number validate(Number arg, SchemaConfiguration configuration) throws ValidationException { + Set> pathSet = new HashSet<>(); + List pathToItem = List.of("args[0"); + Number castArg = castToAllowedTypes(arg, pathToItem, pathSet); + SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().build())); + ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, new PathToSchemasMap(), new LinkedHashSet<>()); + PathToSchemasMap pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet); + return getNewInstance(castArg, validationMetadata.pathToItem(), pathToSchemasMap); + } + + public double validate(double arg, SchemaConfiguration configuration) throws ValidationException { + return (double) validate((Number) arg, configuration); + } + + @Override + public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { + 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"); + } + + @Override + public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws 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"); + } + + @Override + 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 { + 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"); + } + } +} \ No newline at end of file diff --git a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/schemas/FloatJsonSchema.kt b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/schemas/FloatJsonSchema.kt new file mode 100644 index 00000000000..06a918eecb0 --- /dev/null +++ b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/schemas/FloatJsonSchema.kt @@ -0,0 +1,91 @@ +package org.openapijsonschematools.client.schemas; + +import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags; +import org.openapijsonschematools.client.configurations.SchemaConfiguration; +import org.openapijsonschematools.client.exceptions.ValidationException; +import org.openapijsonschematools.client.schemas.validation.JsonSchema; +import org.openapijsonschematools.client.schemas.validation.JsonSchemaInfo; +import org.openapijsonschematools.client.schemas.validation.PathToSchemasMap; +import org.openapijsonschematools.client.schemas.validation.NumberSchemaValidator; +import org.openapijsonschematools.client.schemas.validation.ValidationMetadata; +import org.checkerframework.checker.nullness.qual.Nullable; + +import java.util.HashSet; +import java.util.LinkedHashSet; +import java.util.List; +import java.util.Objects; +import java.util.Set; + +public class FloatJsonSchema { + public sealed interface FloatJsonSchema1Boxed permits FloatJsonSchema1BoxedNumber { + @Nullable Object getData(); + } + public record FloatJsonSchema1BoxedNumber(Number data) implements FloatJsonSchema1Boxed { + @Override + public @Nullable Object getData() { + return data; + } + } + + public static class FloatJsonSchema1 extends JsonSchema implements NumberSchemaValidator { + private static @Nullable FloatJsonSchema1 instance = null; + + protected FloatJsonSchema1() { + super(new JsonSchemaInfo() + .type(Set.of(Float.class)) + .format("float") + ); + } + + public static FloatJsonSchema1 getInstance() { + if (instance == null) { + instance = new FloatJsonSchema1(); + } + return instance; + } + + @Override + public Number validate(Number arg, SchemaConfiguration configuration) throws ValidationException { + Set> pathSet = new HashSet<>(); + List pathToItem = List.of("args[0"); + Number castArg = castToAllowedTypes(arg, pathToItem, pathSet); + SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().build())); + ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, new PathToSchemasMap(), new LinkedHashSet<>()); + PathToSchemasMap pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet); + return getNewInstance(castArg, validationMetadata.pathToItem(), pathToSchemasMap); + } + + public float validate(float arg, SchemaConfiguration configuration) throws ValidationException { + return (float) validate((Number) arg, configuration); + } + + @Override + public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { + 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"); + } + + @Override + public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws 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"); + } + + @Override + 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 { + 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"); + } + } +} diff --git a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/schemas/GenericBuilder.kt b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/schemas/GenericBuilder.kt new file mode 100644 index 00000000000..b33d2e56600 --- /dev/null +++ b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/schemas/GenericBuilder.kt @@ -0,0 +1,9 @@ +package org.openapijsonschematools.client.schemas; + +/** + * Builders must implement this class + * @param the type that the builder returns + */ +public interface GenericBuilder { + T build(); +} diff --git a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/schemas/Int32JsonSchema.kt b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/schemas/Int32JsonSchema.kt new file mode 100644 index 00000000000..b31b7688b58 --- /dev/null +++ b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/schemas/Int32JsonSchema.kt @@ -0,0 +1,98 @@ +package org.openapijsonschematools.client.schemas; + +import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags; +import org.openapijsonschematools.client.exceptions.ValidationException; +import org.openapijsonschematools.client.schemas.validation.JsonSchema; +import org.openapijsonschematools.client.schemas.validation.JsonSchemaInfo; +import org.openapijsonschematools.client.configurations.SchemaConfiguration; +import org.openapijsonschematools.client.schemas.validation.PathToSchemasMap; +import org.openapijsonschematools.client.schemas.validation.NumberSchemaValidator; +import org.openapijsonschematools.client.schemas.validation.ValidationMetadata; +import org.checkerframework.checker.nullness.qual.Nullable; + +import java.util.HashSet; +import java.util.LinkedHashSet; +import java.util.List; +import java.util.Objects; +import java.util.Set; + +public class Int32JsonSchema { + public sealed interface Int32JsonSchema1Boxed permits Int32JsonSchema1BoxedNumber { + @Nullable Object getData(); + } + public record Int32JsonSchema1BoxedNumber(Number data) implements Int32JsonSchema1Boxed { + @Override + public @Nullable Object getData() { + return data; + } + } + + public static class Int32JsonSchema1 extends JsonSchema implements NumberSchemaValidator { + private static @Nullable Int32JsonSchema1 instance = null; + + protected Int32JsonSchema1() { + super(new JsonSchemaInfo() + .type(Set.of( + Integer.class, + Float.class + )) + .format("int32") + ); + } + + public static Int32JsonSchema1 getInstance() { + if (instance == null) { + instance = new Int32JsonSchema1(); + } + return instance; + } + + @Override + public Number validate(Number arg, SchemaConfiguration configuration) throws ValidationException { + Set> pathSet = new HashSet<>(); + List pathToItem = List.of("args[0"); + Number castArg = castToAllowedTypes(arg, pathToItem, pathSet); + SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().build())); + ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, new PathToSchemasMap(), new LinkedHashSet<>()); + PathToSchemasMap pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet); + return getNewInstance(castArg, validationMetadata.pathToItem(), pathToSchemasMap); + } + + public int validate(int arg, SchemaConfiguration configuration) throws ValidationException { + return (int) validate((Number) arg, configuration); + } + + public float validate(float arg, SchemaConfiguration configuration) throws ValidationException { + return (float) validate((Number) arg, configuration); + } + + @Override + public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { + 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"); + } + + @Override + public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws 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"); + } + + @Override + 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 { + 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"); + } + } +} \ No newline at end of file diff --git a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/schemas/Int64JsonSchema.kt b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/schemas/Int64JsonSchema.kt new file mode 100644 index 00000000000..4ea9603434e --- /dev/null +++ b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/schemas/Int64JsonSchema.kt @@ -0,0 +1,108 @@ +package org.openapijsonschematools.client.schemas; + +import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags; +import org.openapijsonschematools.client.exceptions.ValidationException; +import org.openapijsonschematools.client.schemas.validation.JsonSchema; +import org.openapijsonschematools.client.schemas.validation.JsonSchemaInfo; +import org.openapijsonschematools.client.configurations.SchemaConfiguration; +import org.openapijsonschematools.client.schemas.validation.PathToSchemasMap; +import org.openapijsonschematools.client.schemas.validation.NumberSchemaValidator; +import org.openapijsonschematools.client.schemas.validation.ValidationMetadata; +import org.checkerframework.checker.nullness.qual.Nullable; + +import java.util.HashSet; +import java.util.LinkedHashSet; +import java.util.List; +import java.util.Objects; +import java.util.Set; + +public class Int64JsonSchema { + public sealed interface Int64JsonSchema1Boxed permits Int64JsonSchema1BoxedNumber { + @Nullable Object getData(); + } + public record Int64JsonSchema1BoxedNumber(Number data) implements Int64JsonSchema1Boxed { + @Override + public @Nullable Object getData() { + return data; + } + } + + public static class Int64JsonSchema1 extends JsonSchema implements NumberSchemaValidator { + private static @Nullable Int64JsonSchema1 instance = null; + + protected Int64JsonSchema1() { + super(new JsonSchemaInfo() + .type(Set.of( + Integer.class, + Long.class, + Float.class, + Double.class + )) + .format("int64") + ); + } + + public static Int64JsonSchema1 getInstance() { + if (instance == null) { + instance = new Int64JsonSchema1(); + } + return instance; + } + + @Override + public Number validate(Number arg, SchemaConfiguration configuration) throws ValidationException { + Set> pathSet = new HashSet<>(); + List pathToItem = List.of("args[0"); + Number castArg = castToAllowedTypes(arg, pathToItem, pathSet); + SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().build())); + ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, new PathToSchemasMap(), new LinkedHashSet<>()); + PathToSchemasMap pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet); + return getNewInstance(castArg, validationMetadata.pathToItem(), pathToSchemasMap); + } + + public int validate(int arg, SchemaConfiguration configuration) throws ValidationException { + return (int) validate((Number) arg, configuration); + } + + public long validate(long arg, SchemaConfiguration configuration) throws ValidationException { + return (long) validate((Number) arg, configuration); + } + + public float validate(float arg, SchemaConfiguration configuration) throws ValidationException { + return (float) validate((Number) arg, configuration); + } + + public double validate(double arg, SchemaConfiguration configuration) throws ValidationException { + return (double) validate((Number) arg, configuration); + } + + @Override + public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { + 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"); + } + + @Override + public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws 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"); + } + + @Override + 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 { + 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"); + } + } +} \ No newline at end of file diff --git a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/schemas/IntJsonSchema.kt b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/schemas/IntJsonSchema.kt new file mode 100644 index 00000000000..a89a70c02c5 --- /dev/null +++ b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/schemas/IntJsonSchema.kt @@ -0,0 +1,108 @@ +package org.openapijsonschematools.client.schemas; + +import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags; +import org.openapijsonschematools.client.exceptions.ValidationException; +import org.openapijsonschematools.client.schemas.validation.JsonSchema; +import org.openapijsonschematools.client.schemas.validation.JsonSchemaInfo; +import org.openapijsonschematools.client.configurations.SchemaConfiguration; +import org.openapijsonschematools.client.schemas.validation.PathToSchemasMap; +import org.openapijsonschematools.client.schemas.validation.NumberSchemaValidator; +import org.openapijsonschematools.client.schemas.validation.ValidationMetadata; +import org.checkerframework.checker.nullness.qual.Nullable; + +import java.util.HashSet; +import java.util.LinkedHashSet; +import java.util.List; +import java.util.Objects; +import java.util.Set; + +public class IntJsonSchema { + public sealed interface IntJsonSchema1Boxed permits IntJsonSchema1BoxedNumber { + @Nullable Object getData(); + } + public record IntJsonSchema1BoxedNumber(Number data) implements IntJsonSchema1Boxed { + @Override + public @Nullable Object getData() { + return data; + } + } + + public static class IntJsonSchema1 extends JsonSchema implements NumberSchemaValidator { + private static @Nullable IntJsonSchema1 instance = null; + + protected IntJsonSchema1() { + super(new JsonSchemaInfo() + .type(Set.of( + Integer.class, + Long.class, + Float.class, + Double.class + )) + .format("int") + ); + } + + public static IntJsonSchema1 getInstance() { + if (instance == null) { + instance = new IntJsonSchema1(); + } + return instance; + } + + @Override + public Number validate(Number arg, SchemaConfiguration configuration) throws ValidationException { + Set> pathSet = new HashSet<>(); + List pathToItem = List.of("args[0"); + Number castArg = castToAllowedTypes(arg, pathToItem, pathSet); + SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().build())); + ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, new PathToSchemasMap(), new LinkedHashSet<>()); + PathToSchemasMap pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet); + return getNewInstance(castArg, validationMetadata.pathToItem(), pathToSchemasMap); + } + + public int validate(int arg, SchemaConfiguration configuration) throws ValidationException { + return (int) validate((Number) arg, configuration); + } + + public long validate(long arg, SchemaConfiguration configuration) throws ValidationException { + return (long) validate((Number) arg, configuration); + } + + public float validate(float arg, SchemaConfiguration configuration) throws ValidationException { + return (float) validate((Number) arg, configuration); + } + + public double validate(double arg, SchemaConfiguration configuration) throws ValidationException { + return (double) validate((Number) arg, configuration); + } + + @Override + public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { + 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"); + } + + @Override + public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws 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"); + } + + @Override + 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 { + 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"); + } + } +} \ No newline at end of file diff --git a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/schemas/ListJsonSchema.kt b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/schemas/ListJsonSchema.kt new file mode 100644 index 00000000000..801b1d1bc48 --- /dev/null +++ b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/schemas/ListJsonSchema.kt @@ -0,0 +1,108 @@ +package org.openapijsonschematools.client.schemas; + +import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags; +import org.openapijsonschematools.client.exceptions.ValidationException; +import org.openapijsonschematools.client.schemas.validation.FrozenList; +import org.openapijsonschematools.client.schemas.validation.JsonSchema; +import org.openapijsonschematools.client.schemas.validation.JsonSchemaInfo; +import org.openapijsonschematools.client.configurations.SchemaConfiguration; +import org.openapijsonschematools.client.schemas.validation.PathToSchemasMap; +import org.openapijsonschematools.client.schemas.validation.ListSchemaValidator; +import org.openapijsonschematools.client.schemas.validation.ValidationMetadata; +import org.checkerframework.checker.nullness.qual.Nullable; + +import java.util.ArrayList; +import java.util.HashSet; +import java.util.LinkedHashMap; +import java.util.LinkedHashSet; +import java.util.List; +import java.util.Objects; +import java.util.Set; + +public class ListJsonSchema { + public sealed interface ListJsonSchema1Boxed permits ListJsonSchema1BoxedList { + @Nullable Object getData(); + } + public record ListJsonSchema1BoxedList(FrozenList<@Nullable Object> data) implements ListJsonSchema1Boxed { + @Override + public @Nullable Object getData() { + return data; + } + } + + public static class ListJsonSchema1 extends JsonSchema implements ListSchemaValidator, ListJsonSchema1BoxedList> { + private static @Nullable ListJsonSchema1 instance = null; + + protected ListJsonSchema1() { + super(new JsonSchemaInfo() + .type(Set.of(List.class)) + ); + } + + public static ListJsonSchema1 getInstance() { + if (instance == null) { + instance = new ListJsonSchema1(); + } + return instance; + } + + @Override + public FrozenList<@Nullable Object> getNewInstance(List arg, List pathToItem, PathToSchemasMap pathToSchemas) { + List<@Nullable Object> items = new ArrayList<>(); + int i = 0; + for (Object item: arg) { + List itemPathToItem = new ArrayList<>(pathToItem); + itemPathToItem.add(i); + LinkedHashMap, Nothing?> schemas = pathToSchemas.get(itemPathToItem); + if (schemas == null) { + 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); + items.add(castItem); + i += 1; + } + return new FrozenList<>(items); + } + + 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); + SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().build())); + PathToSchemasMap validatedPathToSchemas = new PathToSchemasMap(); + ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, new LinkedHashSet<>()); + PathToSchemasMap pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet); + return getNewInstance(castArg, validationMetadata.pathToItem(), pathToSchemasMap); + } + + @Override + public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { + 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"); + } + + @Override + public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws 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"); + } + + @Override + 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 { + 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"); + } + } +} diff --git a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/schemas/MapJsonSchema.kt b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/schemas/MapJsonSchema.kt new file mode 100644 index 00000000000..2e9b35a11dd --- /dev/null +++ b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/schemas/MapJsonSchema.kt @@ -0,0 +1,112 @@ +package org.openapijsonschematools.client.schemas; + +import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags; +import org.openapijsonschematools.client.exceptions.ValidationException; +import org.openapijsonschematools.client.schemas.validation.FrozenMap; +import org.openapijsonschematools.client.schemas.validation.JsonSchema; +import org.openapijsonschematools.client.schemas.validation.JsonSchemaInfo; +import org.openapijsonschematools.client.configurations.SchemaConfiguration; +import org.openapijsonschematools.client.schemas.validation.PathToSchemasMap; +import org.openapijsonschematools.client.schemas.validation.MapSchemaValidator; +import org.openapijsonschematools.client.schemas.validation.ValidationMetadata; +import org.checkerframework.checker.nullness.qual.Nullable; + +import java.util.ArrayList; +import java.util.HashSet; +import java.util.LinkedHashMap; +import java.util.LinkedHashSet; +import java.util.List; +import java.util.Map; +import java.util.Objects; +import java.util.Set; + +public class MapJsonSchema { + public sealed interface MapJsonSchema1Boxed permits MapJsonSchema1BoxedMap { + @Nullable Object getData(); + } + public record MapJsonSchema1BoxedMap(FrozenMap<@Nullable Object> data) implements MapJsonSchema1Boxed { + @Override + public @Nullable Object getData() { + return data; + } + } + + public static class MapJsonSchema1 extends JsonSchema implements MapSchemaValidator, MapJsonSchema1BoxedMap> { + private static @Nullable MapJsonSchema1 instance = null; + + protected MapJsonSchema1() { + super(new JsonSchemaInfo() + .type(Set.of(Map.class)) + ); + } + + public static MapJsonSchema1 getInstance() { + if (instance == null) { + instance = new MapJsonSchema1(); + } + return instance; + } + + @Override + 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 RuntimeException("Invalid non-string key value"); + } + String propertyName = (String) entryKey; + List propertyPathToItem = new ArrayList<>(pathToItem); + propertyPathToItem.add(propertyName); + Object value = entry.getValue(); + LinkedHashMap, Nothing?> schemas = pathToSchemas.get(propertyPathToItem); + if (schemas == null) { + 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); + properties.put(propertyName, castValue); + } + return new FrozenMap<>(properties); + } + + public FrozenMap<@Nullable Object> validate(Map arg, SchemaConfiguration configuration) throws ValidationException { + Set> pathSet = new HashSet<>(); + List pathToItem = List.of("args[0"); + Map castArg = castToAllowedTypes(arg, pathToItem, pathSet); + SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().build())); + ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, new PathToSchemasMap(), new LinkedHashSet<>()); + PathToSchemasMap pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet); + return getNewInstance(castArg, validationMetadata.pathToItem(), pathToSchemasMap); + } + + @Override + public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { + 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"); + } + + @Override + public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws 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"); + } + + @Override + 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 { + 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"); + } + } +} diff --git a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/schemas/NotAnyTypeJsonSchema.kt b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/schemas/NotAnyTypeJsonSchema.kt new file mode 100644 index 00000000000..79aa987aae8 --- /dev/null +++ b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/schemas/NotAnyTypeJsonSchema.kt @@ -0,0 +1,317 @@ +package org.openapijsonschematools.client.schemas; + +import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags; +import org.openapijsonschematools.client.configurations.SchemaConfiguration; +import org.openapijsonschematools.client.exceptions.ValidationException; +import org.openapijsonschematools.client.schemas.validation.FrozenList; +import org.openapijsonschematools.client.schemas.validation.FrozenMap; +import org.openapijsonschematools.client.schemas.validation.JsonSchema; +import org.openapijsonschematools.client.schemas.validation.JsonSchemaInfo; +import org.openapijsonschematools.client.schemas.validation.PathToSchemasMap; +import org.openapijsonschematools.client.schemas.validation.NullSchemaValidator; +import org.openapijsonschematools.client.schemas.validation.BooleanSchemaValidator; +import org.openapijsonschematools.client.schemas.validation.NumberSchemaValidator; +import org.openapijsonschematools.client.schemas.validation.StringSchemaValidator; +import org.openapijsonschematools.client.schemas.validation.ListSchemaValidator; +import org.openapijsonschematools.client.schemas.validation.MapSchemaValidator; +import org.openapijsonschematools.client.schemas.validation.ValidationMetadata; +import org.checkerframework.checker.nullness.qual.Nullable; + +import java.time.LocalDate; +import java.time.ZonedDateTime; +import java.util.LinkedHashMap; +import java.util.List; +import java.util.HashSet; +import java.util.ArrayList; +import java.util.LinkedHashSet; +import java.util.Set; +import java.util.Map; +import java.util.Objects; +import java.util.UUID; + +public class NotAnyTypeJsonSchema { + public sealed interface NotAnyTypeJsonSchema1Boxed permits NotAnyTypeJsonSchema1BoxedVoid, NotAnyTypeJsonSchema1BoxedBoolean, NotAnyTypeJsonSchema1BoxedNumber, NotAnyTypeJsonSchema1BoxedString, NotAnyTypeJsonSchema1BoxedList, NotAnyTypeJsonSchema1BoxedMap { + @Nullable Object getData(); + } + public record NotAnyTypeJsonSchema1BoxedVoid(Nothing? data) implements NotAnyTypeJsonSchema1Boxed { + @Override + public @Nullable Object getData() { + return data; + } + } + public record NotAnyTypeJsonSchema1BoxedBoolean(boolean data) implements NotAnyTypeJsonSchema1Boxed { + @Override + public @Nullable Object getData() { + return data; + } + } + public record NotAnyTypeJsonSchema1BoxedNumber(Number data) implements NotAnyTypeJsonSchema1Boxed { + @Override + public @Nullable Object getData() { + return data; + } + } + public record NotAnyTypeJsonSchema1BoxedString(String data) implements NotAnyTypeJsonSchema1Boxed { + @Override + public @Nullable Object getData() { + return data; + } + } + public record NotAnyTypeJsonSchema1BoxedList(FrozenList<@Nullable Object> data) implements NotAnyTypeJsonSchema1Boxed { + @Override + public @Nullable Object getData() { + return data; + } + } + public record NotAnyTypeJsonSchema1BoxedMap(FrozenMap<@Nullable Object> data) implements NotAnyTypeJsonSchema1Boxed { + @Override + public @Nullable Object getData() { + return data; + } + } + + public static class NotAnyTypeJsonSchema1 extends JsonSchema implements NullSchemaValidator, BooleanSchemaValidator, NumberSchemaValidator, StringSchemaValidator, ListSchemaValidator, NotAnyTypeJsonSchema1BoxedList>, MapSchemaValidator, NotAnyTypeJsonSchema1BoxedMap> { + private static @Nullable NotAnyTypeJsonSchema1 instance = null; + + protected NotAnyTypeJsonSchema1() { + super(new JsonSchemaInfo() + .not(AnyTypeJsonSchema.AnyTypeJsonSchema1.class) + ); + } + + public static NotAnyTypeJsonSchema1 getInstance() { + if (instance == null) { + instance = new NotAnyTypeJsonSchema1(); + } + return instance; + } + + @Override + public Nothing? validate(Nothing? arg, SchemaConfiguration configuration) throws ValidationException { + Set> pathSet = new HashSet<>(); + List pathToItem = List.of("args[0]"); + Nothing? castArg = castToAllowedTypes(arg, pathToItem, pathSet); + SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().build())); + PathToSchemasMap validatedPathToSchemas = new PathToSchemasMap(); + ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, new LinkedHashSet<>()); + PathToSchemasMap pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet); + return getNewInstance(castArg, validationMetadata.pathToItem(), pathToSchemasMap); + } + + @Override + public boolean validate(boolean arg, SchemaConfiguration configuration) throws ValidationException { + Set> pathSet = new HashSet<>(); + List pathToItem = List.of("args[0]"); + boolean castArg = castToAllowedTypes(arg, pathToItem, pathSet); + SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().build())); + PathToSchemasMap validatedPathToSchemas = new PathToSchemasMap(); + ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, new LinkedHashSet<>()); + PathToSchemasMap pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet); + return getNewInstance(castArg, validationMetadata.pathToItem(), pathToSchemasMap); + } + + @Override + public Number validate(Number arg, SchemaConfiguration configuration) throws ValidationException { + Set> pathSet = new HashSet<>(); + List pathToItem = List.of("args[0]"); + Number castArg = castToAllowedTypes(arg, pathToItem, pathSet); + SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().build())); + PathToSchemasMap validatedPathToSchemas = new PathToSchemasMap(); + ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, new LinkedHashSet<>()); + PathToSchemasMap pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet); + return getNewInstance(castArg, validationMetadata.pathToItem(), pathToSchemasMap); + } + + public int validate(int arg, SchemaConfiguration configuration) throws ValidationException { + return (int) validate((Number) arg, configuration); + } + + public long validate(long arg, SchemaConfiguration configuration) throws ValidationException { + return (long) validate((Number) arg, configuration); + } + + public float validate(float arg, SchemaConfiguration configuration) throws ValidationException { + return (float) validate((Number) arg, configuration); + } + + public double validate(double arg, SchemaConfiguration configuration) throws ValidationException { + return (double) validate((Number) arg, configuration); + } + + @Override + public String validate(String arg, SchemaConfiguration configuration) throws ValidationException { + Set> pathSet = new HashSet<>(); + List pathToItem = List.of("args[0]"); + String castArg = castToAllowedTypes(arg, pathToItem, pathSet); + SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().build())); + PathToSchemasMap validatedPathToSchemas = new PathToSchemasMap(); + ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, new LinkedHashSet<>()); + PathToSchemasMap pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet); + return getNewInstance(castArg, validationMetadata.pathToItem(), pathToSchemasMap); + } + + public String validate(LocalDate arg, SchemaConfiguration configuration) throws ValidationException { + return validate(arg.toString(), configuration); + } + + public String validate(ZonedDateTime arg, SchemaConfiguration configuration) throws ValidationException { + return validate(arg.toString(), configuration); + } + + public String validate(UUID arg, SchemaConfiguration configuration) throws ValidationException { + return validate(arg.toString(), configuration); + } + + @Override + public FrozenList<@Nullable Object> getNewInstance(List arg, List pathToItem, PathToSchemasMap pathToSchemas) { + List<@Nullable Object> items = new ArrayList<>(); + int i = 0; + for (Object item: arg) { + List itemPathToItem = new ArrayList<>(pathToItem); + itemPathToItem.add(i); + LinkedHashMap, Nothing?> schemas = pathToSchemas.get(itemPathToItem); + if (schemas == null) { + 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); + items.add(castItem); + i += 1; + } + return new FrozenList<>(items); + } + + 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); + SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().build())); + PathToSchemasMap validatedPathToSchemas = new PathToSchemasMap(); + ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, new LinkedHashSet<>()); + PathToSchemasMap pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet); + return getNewInstance(castArg, validationMetadata.pathToItem(), pathToSchemasMap); + } + + @Override + 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 RuntimeException("Invalid non-string key value"); + } + String propertyName = (String) entryKey; + List propertyPathToItem = new ArrayList<>(pathToItem); + propertyPathToItem.add(propertyName); + Object value = entry.getValue(); + LinkedHashMap, Nothing?> schemas = pathToSchemas.get(propertyPathToItem); + if (schemas == null) { + 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); + properties.put(propertyName, castValue); + } + return new FrozenMap<>(properties); + } + + public FrozenMap<@Nullable Object> validate(Map arg, SchemaConfiguration configuration) throws ValidationException { + Set> pathSet = new HashSet<>(); + List pathToItem = List.of("args[0]"); + Map castArg = castToAllowedTypes(arg, pathToItem, pathSet); + SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().build())); + PathToSchemasMap validatedPathToSchemas = new PathToSchemasMap(); + ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, new LinkedHashSet<>()); + PathToSchemasMap pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet); + return getNewInstance(castArg, validationMetadata.pathToItem(), pathToSchemasMap); + } + + @Override + public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { + if (arg == null) { + return getNewInstance((Nothing?) null, pathToItem, pathToSchemas); + } else if (arg instanceof Boolean) { + boolean boolArg = (Boolean) arg; + return getNewInstance(boolArg, pathToItem, pathToSchemas); + } else if (arg instanceof Number) { + return getNewInstance((Number) arg, pathToItem, pathToSchemas); + } else if (arg instanceof String) { + return getNewInstance((String) arg, pathToItem, pathToSchemas); + } else if (arg instanceof List) { + return getNewInstance((List) arg, 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"); + } + + @Override + public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { + if (arg == null) { + return validate((Nothing?) null, configuration); + } else if (arg instanceof Boolean) { + boolean boolArg = (Boolean) arg; + return validate(boolArg, configuration); + } else if (arg instanceof Number) { + return validate((Number) arg, configuration); + } else if (arg instanceof String) { + return validate((String) arg, configuration); + } else if (arg instanceof List) { + return validate((List) arg, 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"); + } + + @Override + public NotAnyTypeJsonSchema1BoxedVoid validateAndBox(Nothing? arg, SchemaConfiguration configuration) throws ValidationException { + return new NotAnyTypeJsonSchema1BoxedVoid(validate(arg, configuration)); + } + + @Override + 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 { + return new NotAnyTypeJsonSchema1BoxedNumber(validate(arg, configuration)); + } + + @Override + 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 { + return new NotAnyTypeJsonSchema1BoxedList(validate(arg, configuration)); + } + + @Override + 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 { + if (arg == null) { + Nothing? castArg = (Nothing?) arg; + return validateAndBox(castArg, configuration); + } else if (arg instanceof Boolean booleanArg) { + boolean castArg = booleanArg; + return validateAndBox(castArg, configuration); + } else if (arg instanceof String castArg) { + return validateAndBox(castArg, configuration); + } else if (arg instanceof Number castArg) { + return validateAndBox(castArg, configuration); + } else if (arg instanceof List castArg) { + 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"); + } + } +} \ No newline at end of file diff --git a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/schemas/NullJsonSchema.kt b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/schemas/NullJsonSchema.kt new file mode 100644 index 00000000000..4cc01b26bad --- /dev/null +++ b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/schemas/NullJsonSchema.kt @@ -0,0 +1,87 @@ +package org.openapijsonschematools.client.schemas; + +import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags; +import org.openapijsonschematools.client.configurations.SchemaConfiguration; +import org.openapijsonschematools.client.exceptions.ValidationException; +import org.openapijsonschematools.client.schemas.validation.JsonSchema; +import org.openapijsonschematools.client.schemas.validation.JsonSchemaInfo; +import org.openapijsonschematools.client.schemas.validation.PathToSchemasMap; +import org.openapijsonschematools.client.schemas.validation.NullSchemaValidator; +import org.openapijsonschematools.client.schemas.validation.ValidationMetadata; +import org.checkerframework.checker.nullness.qual.Nullable; + +import java.util.HashSet; +import java.util.LinkedHashSet; +import java.util.List; +import java.util.Objects; +import java.util.Set; + +public class NullJsonSchema { + public sealed interface NullJsonSchema1Boxed permits NullJsonSchema1BoxedVoid { + @Nullable Object getData(); + } + public record NullJsonSchema1BoxedVoid(Nothing? data) implements NullJsonSchema1Boxed { + @Override + public @Nullable Object getData() { + return data; + } + } + + public static class NullJsonSchema1 extends JsonSchema implements NullSchemaValidator { + private static @Nullable NullJsonSchema1 instance = null; + + protected NullJsonSchema1() { + super(new JsonSchemaInfo() + .type(Set.of(Nothing?.class)) + ); + } + + public static NullJsonSchema1 getInstance() { + if (instance == null) { + instance = new NullJsonSchema1(); + } + return instance; + } + + @Override + public Nothing? validate(Nothing? arg, SchemaConfiguration configuration) throws ValidationException { + Set> pathSet = new HashSet<>(); + List pathToItem = List.of("args[0"); + Nothing? castArg = castToAllowedTypes(arg, pathToItem, pathSet); + SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().build())); + ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, new PathToSchemasMap(), new LinkedHashSet<>()); + PathToSchemasMap pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet); + return getNewInstance(castArg, validationMetadata.pathToItem(), pathToSchemasMap); + } + + @Override + public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { + if (arg == null) { + return getNewInstance((Nothing?) null, pathToItem, pathToSchemas); + } + 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 { + if (arg == null) { + return validate((Nothing?) null, configuration); + } + throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + } + + @Override + public NullJsonSchema1BoxedVoid validateAndBox(Nothing? arg, SchemaConfiguration configuration) throws ValidationException { + return new NullJsonSchema1BoxedVoid(validate(arg, configuration)); + } + + @Override + public NullJsonSchema1Boxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { + if (arg == null) { + Nothing? castArg = (Nothing?) arg; + return validateAndBox(castArg, configuration); + } + throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + } + } +} diff --git a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/schemas/NumberJsonSchema.kt b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/schemas/NumberJsonSchema.kt new file mode 100644 index 00000000000..260d4e15a44 --- /dev/null +++ b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/schemas/NumberJsonSchema.kt @@ -0,0 +1,107 @@ +package org.openapijsonschematools.client.schemas; + +import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags; +import org.openapijsonschematools.client.exceptions.ValidationException; +import org.openapijsonschematools.client.schemas.validation.JsonSchema; +import org.openapijsonschematools.client.schemas.validation.JsonSchemaInfo; +import org.openapijsonschematools.client.configurations.SchemaConfiguration; +import org.openapijsonschematools.client.schemas.validation.PathToSchemasMap; +import org.openapijsonschematools.client.schemas.validation.NumberSchemaValidator; +import org.openapijsonschematools.client.schemas.validation.ValidationMetadata; +import org.checkerframework.checker.nullness.qual.Nullable; + +import java.util.HashSet; +import java.util.LinkedHashSet; +import java.util.List; +import java.util.Objects; +import java.util.Set; + +public class NumberJsonSchema { + public sealed interface NumberJsonSchema1Boxed permits NumberJsonSchema1BoxedNumber { + @Nullable Object getData(); + } + public record NumberJsonSchema1BoxedNumber(Number data) implements NumberJsonSchema1Boxed { + @Override + public @Nullable Object getData() { + return data; + } + } + + public static class NumberJsonSchema1 extends JsonSchema implements NumberSchemaValidator { + private static @Nullable NumberJsonSchema1 instance = null; + + protected NumberJsonSchema1() { + super(new JsonSchemaInfo() + .type(Set.of( + Integer.class, + Long.class, + Float.class, + Double.class + )) + ); + } + + public static NumberJsonSchema1 getInstance() { + if (instance == null) { + instance = new NumberJsonSchema1(); + } + return instance; + } + + @Override + public Number validate(Number arg, SchemaConfiguration configuration) throws ValidationException { + Set> pathSet = new HashSet<>(); + List pathToItem = List.of("args[0"); + Number castArg = castToAllowedTypes(arg, pathToItem, pathSet); + SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().build())); + ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, new PathToSchemasMap(), new LinkedHashSet<>()); + PathToSchemasMap pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet); + return getNewInstance(castArg, validationMetadata.pathToItem(), pathToSchemasMap); + } + + public int validate(int arg, SchemaConfiguration configuration) throws ValidationException { + return (int) validate((Number) arg, configuration); + } + + public long validate(long arg, SchemaConfiguration configuration) throws ValidationException { + return (long) validate((Number) arg, configuration); + } + + public float validate(float arg, SchemaConfiguration configuration) throws ValidationException { + return (float) validate((Number) arg, configuration); + } + + public double validate(double arg, SchemaConfiguration configuration) throws ValidationException { + return (double) validate((Number) arg, configuration); + } + + @Override + public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { + 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"); + } + + @Override + public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws 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"); + } + + @Override + 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 { + 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"); + } + } +} \ No newline at end of file diff --git a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/schemas/SetMaker.kt b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/schemas/SetMaker.kt new file mode 100644 index 00000000000..02fb8ffb3be --- /dev/null +++ b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/schemas/SetMaker.kt @@ -0,0 +1,20 @@ +package org.openapijsonschematools.client.schemas; + +import java.util.HashSet; +import java.util.Set; + +/** + * A builder for maps that allows in null values + * Schema tests + doc code samples need it + */ +public class SetMaker { + @SafeVarargs + @SuppressWarnings("varargs") + public static Set makeSet(E... items) { + Set set = new HashSet<>(); + for (E item : items) { + set.add(item); + } + return set; + } +} \ No newline at end of file diff --git a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/schemas/StringJsonSchema.kt b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/schemas/StringJsonSchema.kt new file mode 100644 index 00000000000..92570628dd0 --- /dev/null +++ b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/schemas/StringJsonSchema.kt @@ -0,0 +1,106 @@ +package org.openapijsonschematools.client.schemas; + +import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags; +import org.openapijsonschematools.client.configurations.SchemaConfiguration; +import org.openapijsonschematools.client.exceptions.ValidationException; +import org.openapijsonschematools.client.schemas.validation.JsonSchema; +import org.openapijsonschematools.client.schemas.validation.JsonSchemaInfo; +import org.openapijsonschematools.client.schemas.validation.PathToSchemasMap; +import org.openapijsonschematools.client.schemas.validation.StringSchemaValidator; +import org.openapijsonschematools.client.schemas.validation.ValidationMetadata; +import org.checkerframework.checker.nullness.qual.Nullable; + +import java.time.LocalDate; +import java.time.ZonedDateTime; +import java.util.HashSet; +import java.util.LinkedHashSet; +import java.util.List; +import java.util.Objects; +import java.util.Set; +import java.util.UUID; + +public class StringJsonSchema { + public sealed interface StringJsonSchema1Boxed permits StringJsonSchema1BoxedString { + @Nullable Object getData(); + } + public record StringJsonSchema1BoxedString(String data) implements StringJsonSchema1Boxed { + @Override + public @Nullable Object getData() { + return data; + } + } + public static class StringJsonSchema1 extends JsonSchema implements StringSchemaValidator { + private static @Nullable StringJsonSchema1 instance = null; + + protected StringJsonSchema1() { + super(new JsonSchemaInfo() + .type(Set.of(String.class)) + ); + } + + public static StringJsonSchema1 getInstance() { + if (instance == null) { + instance = new StringJsonSchema1(); + } + return instance; + } + + @Override + public String validate(String arg, SchemaConfiguration configuration) throws ValidationException { + Set> pathSet = new HashSet<>(); + List pathToItem = List.of("args[0"); + String castArg = castToAllowedTypes(arg, pathToItem, pathSet); + SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().build())); + ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, new PathToSchemasMap(), new LinkedHashSet<>()); + PathToSchemasMap pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet); + return getNewInstance(castArg, validationMetadata.pathToItem(), pathToSchemasMap); + } + + public String validate(LocalDate arg, SchemaConfiguration configuration) throws ValidationException { + return validate(arg.toString(), configuration); + } + + public String validate(ZonedDateTime arg, SchemaConfiguration configuration) throws ValidationException { + return validate(arg.toString(), configuration); + } + + public String validate(UUID arg, SchemaConfiguration configuration) throws ValidationException { + return validate(arg.toString(), configuration); + } + + @Override + public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { + 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"); + } + + @Override + 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) { + return validate((LocalDate) arg, configuration); + } else if (arg instanceof ZonedDateTime) { + return validate((ZonedDateTime) 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"); + } + + @Override + 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 { + 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"); + } + } +} diff --git a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/schemas/UnsetAddPropsSetter.kt b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/schemas/UnsetAddPropsSetter.kt new file mode 100644 index 00000000000..246e346cdac --- /dev/null +++ b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/schemas/UnsetAddPropsSetter.kt @@ -0,0 +1,77 @@ +package org.openapijsonschematools.client.schemas; + +import org.checkerframework.checker.nullness.qual.Nullable; +import org.openapijsonschematools.client.exceptions.InvalidAdditionalPropertyException; +import org.openapijsonschematools.client.schemas.validation.MapUtils; + +import java.util.List; +import java.util.Map; +import java.util.Set; + +public abstract class UnsetAddPropsSetter { + public abstract Map getInstance(); + public abstract Set getKnownKeys(); + public abstract T getBuilderAfterAdditionalProperty(Map instance); + public T additionalProperty(String key, Nothing? value) throws InvalidAdditionalPropertyException { + MapUtils.throwIfKeyKnown(key, getKnownKeys(), true); + var instance = getInstance(); + instance.put(key, value); + return getBuilderAfterAdditionalProperty(instance); + } + + public T additionalProperty(String key, boolean value) throws InvalidAdditionalPropertyException { + MapUtils.throwIfKeyKnown(key, getKnownKeys(), true); + var instance = getInstance(); + instance.put(key, value); + return getBuilderAfterAdditionalProperty(instance); + } + + public T additionalProperty(String key, String value) throws InvalidAdditionalPropertyException { + MapUtils.throwIfKeyKnown(key, getKnownKeys(), true); + var instance = getInstance(); + instance.put(key, value); + return getBuilderAfterAdditionalProperty(instance); + } + + public T additionalProperty(String key, int value) throws InvalidAdditionalPropertyException { + MapUtils.throwIfKeyKnown(key, getKnownKeys(), true); + var instance = getInstance(); + instance.put(key, value); + return getBuilderAfterAdditionalProperty(instance); + } + + public T additionalProperty(String key, float value) throws InvalidAdditionalPropertyException { + MapUtils.throwIfKeyKnown(key, getKnownKeys(), true); + var instance = getInstance(); + instance.put(key, value); + return getBuilderAfterAdditionalProperty(instance); + } + + public T additionalProperty(String key, long value) throws InvalidAdditionalPropertyException { + MapUtils.throwIfKeyKnown(key, getKnownKeys(), true); + var instance = getInstance(); + instance.put(key, value); + return getBuilderAfterAdditionalProperty(instance); + } + + public T additionalProperty(String key, double value) throws InvalidAdditionalPropertyException { + MapUtils.throwIfKeyKnown(key, getKnownKeys(), true); + var instance = getInstance(); + instance.put(key, value); + return getBuilderAfterAdditionalProperty(instance); + } + + public T additionalProperty(String key, List value) throws InvalidAdditionalPropertyException { + MapUtils.throwIfKeyKnown(key, getKnownKeys(), true); + var instance = getInstance(); + instance.put(key, value); + return getBuilderAfterAdditionalProperty(instance); + } + + public T additionalProperty(String key, Map value) throws InvalidAdditionalPropertyException { + MapUtils.throwIfKeyKnown(key, getKnownKeys(), true); + var instance = getInstance(); + instance.put(key, value); + return getBuilderAfterAdditionalProperty(instance); + } +} diff --git a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/schemas/UuidJsonSchema.kt b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/schemas/UuidJsonSchema.kt new file mode 100644 index 00000000000..c9ccef0420e --- /dev/null +++ b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/schemas/UuidJsonSchema.kt @@ -0,0 +1,94 @@ +package org.openapijsonschematools.client.schemas; + +import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags; +import org.openapijsonschematools.client.exceptions.ValidationException; +import org.openapijsonschematools.client.schemas.validation.JsonSchema; +import org.openapijsonschematools.client.schemas.validation.JsonSchemaInfo; +import org.openapijsonschematools.client.configurations.SchemaConfiguration; +import org.openapijsonschematools.client.schemas.validation.PathToSchemasMap; +import org.openapijsonschematools.client.schemas.validation.StringSchemaValidator; +import org.openapijsonschematools.client.schemas.validation.ValidationMetadata; +import org.checkerframework.checker.nullness.qual.Nullable; + +import java.util.HashSet; +import java.util.LinkedHashSet; +import java.util.List; +import java.util.Objects; +import java.util.Set; +import java.util.UUID; + +public class UuidJsonSchema { + public sealed interface UuidJsonSchema1Boxed permits UuidJsonSchema1BoxedString { + @Nullable Object getData(); + } + public record UuidJsonSchema1BoxedString(String data) implements UuidJsonSchema1Boxed { + @Override + public @Nullable Object getData() { + return data; + } + } + + public static class UuidJsonSchema1 extends JsonSchema implements StringSchemaValidator { + private static @Nullable UuidJsonSchema1 instance = null; + + protected UuidJsonSchema1() { + super(new JsonSchemaInfo() + .type(Set.of(String.class)) + .format("uuid") + ); + } + + public static UuidJsonSchema1 getInstance() { + if (instance == null) { + instance = new UuidJsonSchema1(); + } + return instance; + } + + @Override + public String validate(String arg, SchemaConfiguration configuration) throws ValidationException { + Set> pathSet = new HashSet<>(); + List pathToItem = List.of("args[0"); + String castArg = castToAllowedTypes(arg, pathToItem, pathSet); + SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().build())); + ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, new PathToSchemasMap(), new LinkedHashSet<>()); + PathToSchemasMap pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet); + return getNewInstance(castArg, validationMetadata.pathToItem(), pathToSchemasMap); + } + + public String validate(UUID arg, SchemaConfiguration configuration) throws ValidationException { + return validate(arg.toString(), configuration); + } + + @Override + public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { + 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"); + } + + @Override + 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 ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + } + + @Override + 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 { + 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"); + } + } +} \ No newline at end of file diff --git a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/schemas/validation/AdditionalPropertiesValidator.kt b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/schemas/validation/AdditionalPropertiesValidator.kt new file mode 100644 index 00000000000..b7afc854c15 --- /dev/null +++ b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/schemas/validation/AdditionalPropertiesValidator.kt @@ -0,0 +1,58 @@ +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; +import java.util.List; +import java.util.Map; +import java.util.Set; + +public class AdditionalPropertiesValidator implements KeywordValidator { + @Override + public @Nullable PathToSchemasMap validate( + ValidationData data + ) throws ValidationException { + if (!(data.arg() instanceof Map mapArg)) { + return null; + } + var additionalProperties = data.schema().additionalProperties; + if (additionalProperties == null) { + return null; + } + Set presentAdditionalProperties = new LinkedHashSet<>(); + for (Object key: mapArg.keySet()) { + if (key instanceof String) { + presentAdditionalProperties.add((String) key); + } + } + var properties = data.schema().properties; + if (properties != null) { + presentAdditionalProperties.removeAll(properties.keySet()); + } + PathToSchemasMap pathToSchemas = new PathToSchemasMap(); + for(String addPropName: presentAdditionalProperties) { + @Nullable Object propValue = mapArg.get(addPropName); + List propPathToItem = new ArrayList<>(data.validationMetadata().pathToItem()); + propPathToItem.add(addPropName); + if (data.patternPropertiesPathToSchemas() != null && data.patternPropertiesPathToSchemas().containsKey(propPathToItem)) { + continue; + } + ValidationMetadata propValidationMetadata = new ValidationMetadata( + propPathToItem, + data.validationMetadata().configuration(), + data.validationMetadata().validatedPathToSchemas(), + data.validationMetadata().seenClasses() + ); + JsonSchema addPropsSchema = JsonSchemaFactory.getInstance(additionalProperties); + if (propValidationMetadata.validationRanEarlier(addPropsSchema)) { + // todo add_deeper_validated_schemas + continue; + } + PathToSchemasMap otherPathToSchemas = JsonSchema.validate(addPropsSchema, propValue, propValidationMetadata); + pathToSchemas.update(otherPathToSchemas); + } + return pathToSchemas; + } +} diff --git a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/schemas/validation/AllOfValidator.kt b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/schemas/validation/AllOfValidator.kt new file mode 100644 index 00000000000..4b969c68a20 --- /dev/null +++ b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/schemas/validation/AllOfValidator.kt @@ -0,0 +1,23 @@ +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; + } + PathToSchemasMap pathToSchemas = new PathToSchemasMap(); + for(Class> allOfClass: allOf) { + JsonSchema allOfSchema = JsonSchemaFactory.getInstance(allOfClass); + PathToSchemasMap otherPathToSchemas = JsonSchema.validate(allOfSchema, data.arg(), data.validationMetadata()); + pathToSchemas.update(otherPathToSchemas); + } + return pathToSchemas; + } +} diff --git a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/schemas/validation/AnyOfValidator.kt b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/schemas/validation/AnyOfValidator.kt new file mode 100644 index 00000000000..19d4e0337c9 --- /dev/null +++ b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/schemas/validation/AnyOfValidator.kt @@ -0,0 +1,45 @@ +package org.openapijsonschematools.client.schemas.validation; + +import org.openapijsonschematools.client.exceptions.ValidationException; +import org.checkerframework.checker.nullness.qual.Nullable; + +import java.util.ArrayList; +import java.util.List; + +public class AnyOfValidator implements KeywordValidator { + @Override + public @Nullable PathToSchemasMap validate( + ValidationData data + ) throws ValidationException { + var anyOf = data.schema().anyOf; + if (anyOf == null) { + return null; + } + PathToSchemasMap pathToSchemas = new PathToSchemasMap(); + List>> validatedAnyOfClasses = new ArrayList<>(); + for(Class> anyOfClass: anyOf) { + if (anyOfClass == data.schema().getClass()) { + /* + optimistically assume that schema will pass validation + do not invoke _validate on it because that is recursive + */ + validatedAnyOfClasses.add(anyOfClass); + continue; + } + try { + JsonSchema anyOfSchema = JsonSchemaFactory.getInstance(anyOfClass); + PathToSchemasMap otherPathToSchemas = JsonSchema.validate(anyOfSchema, data.arg(), data.validationMetadata()); + validatedAnyOfClasses.add(anyOfClass); + pathToSchemas.update(otherPathToSchemas); + } catch (ValidationException e) { + // silence exceptions because the code needs to accumulate anyof_classes + } + } + if (validatedAnyOfClasses.isEmpty()) { + throw new ValidationException("Invalid inputs given to generate an instance of "+data.schema().getClass()+". None "+ + "of the anyOf schemas matched the input data." + ); + } + return pathToSchemas; + } +} diff --git a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/schemas/validation/BigDecimalValidator.kt b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/schemas/validation/BigDecimalValidator.kt new file mode 100644 index 00000000000..639d32e889e --- /dev/null +++ b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/schemas/validation/BigDecimalValidator.kt @@ -0,0 +1,21 @@ +package org.openapijsonschematools.client.schemas.validation; + +import org.openapijsonschematools.client.exceptions.ValidationException; + +import java.math.BigDecimal; + +public abstract class BigDecimalValidator { + protected BigDecimal getBigDecimal(Number arg) throws ValidationException { + if (arg instanceof Integer) { + return new BigDecimal((Integer) arg); + } else if (arg instanceof Long) { + return new BigDecimal((Long) arg); + } else if (arg instanceof Float) { + return new BigDecimal(Float.toString((Float) arg)); + } else if (arg instanceof Double) { + return new BigDecimal(Double.toString((Double) arg)); + } else { + throw new ValidationException("Invalid type input for arg"); + } + } +} diff --git a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/schemas/validation/BooleanEnumValidator.kt b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/schemas/validation/BooleanEnumValidator.kt new file mode 100644 index 00000000000..7e80fd207c2 --- /dev/null +++ b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/schemas/validation/BooleanEnumValidator.kt @@ -0,0 +1,8 @@ +package org.openapijsonschematools.client.schemas.validation; + +import org.openapijsonschematools.client.configurations.SchemaConfiguration; +import org.openapijsonschematools.client.exceptions.ValidationException; + +public interface BooleanEnumValidator { + boolean validate(EnumType arg, SchemaConfiguration configuration) throws ValidationException; +} \ No newline at end of file diff --git a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/schemas/validation/BooleanSchemaValidator.kt b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/schemas/validation/BooleanSchemaValidator.kt new file mode 100644 index 00000000000..96c69f5a7a2 --- /dev/null +++ b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/schemas/validation/BooleanSchemaValidator.kt @@ -0,0 +1,9 @@ +package org.openapijsonschematools.client.schemas.validation; + +import org.openapijsonschematools.client.configurations.SchemaConfiguration; +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; +} \ No newline at end of file diff --git a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/schemas/validation/BooleanValueMethod.kt b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/schemas/validation/BooleanValueMethod.kt new file mode 100644 index 00000000000..709b30f7227 --- /dev/null +++ b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/schemas/validation/BooleanValueMethod.kt @@ -0,0 +1,5 @@ +package org.openapijsonschematools.client.schemas.validation; + +public interface BooleanValueMethod { + boolean value(); +} \ No newline at end of file diff --git a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/schemas/validation/ConstValidator.kt b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/schemas/validation/ConstValidator.kt new file mode 100644 index 00000000000..93872adcc2f --- /dev/null +++ b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/schemas/validation/ConstValidator.kt @@ -0,0 +1,33 @@ +package org.openapijsonschematools.client.schemas.validation; + +import org.openapijsonschematools.client.exceptions.ValidationException; +import org.checkerframework.checker.nullness.qual.Nullable; + +import java.math.BigDecimal; +import java.util.Objects; + +public class ConstValidator extends BigDecimalValidator implements KeywordValidator { + @Override + public @Nullable PathToSchemasMap validate( + ValidationData data + ) throws ValidationException { + if (!data.schema().constValueSet) { + return null; + } + var constValue = data.schema().constValue; + if (data.arg() instanceof Number numberArg) { + BigDecimal castArg = getBigDecimal(numberArg); + if (Objects.equals(castArg, constValue)) { + return null; + } + if (constValue instanceof BigDecimal && ((BigDecimal) constValue).compareTo(castArg) == 0) { + return null; + } + } else { + if (Objects.equals(data.arg(), constValue)) { + return null; + } + } + throw new ValidationException("Invalid value "+data.arg()+" was not equal to const "+constValue); + } +} \ No newline at end of file diff --git a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/schemas/validation/ContainsValidator.kt b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/schemas/validation/ContainsValidator.kt new file mode 100644 index 00000000000..41565577d58 --- /dev/null +++ b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/schemas/validation/ContainsValidator.kt @@ -0,0 +1,30 @@ +package org.openapijsonschematools.client.schemas.validation; + +import org.checkerframework.checker.nullness.qual.Nullable; +import org.openapijsonschematools.client.exceptions.ValidationException; + +import java.util.List; + +public class ContainsValidator implements KeywordValidator { + @Override + public @Nullable PathToSchemasMap validate( + ValidationData data + ) throws ValidationException { + if (!(data.arg() instanceof List)) { + return null; + } + var containsPathToSchemas = data.containsPathToSchemas(); + if (containsPathToSchemas == null || containsPathToSchemas.isEmpty()) { + throw new ValidationException( + "Validation failed for contains keyword in class="+data.schema().getClass() + + " at pathToItem="+data.validationMetadata().pathToItem()+". No " + + "items validated to the contains schema." + ); + } + PathToSchemasMap pathToSchemas = new PathToSchemasMap(); + for (PathToSchemasMap otherPathToSchema: containsPathToSchemas) { + pathToSchemas.update(otherPathToSchema); + } + return pathToSchemas; + } +} \ No newline at end of file diff --git a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/schemas/validation/CustomIsoparser.kt b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/schemas/validation/CustomIsoparser.kt new file mode 100644 index 00000000000..c4344d77bfe --- /dev/null +++ b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/schemas/validation/CustomIsoparser.kt @@ -0,0 +1,16 @@ +package org.openapijsonschematools.client.schemas.validation; + +import java.time.ZonedDateTime; +import java.time.LocalDate; + +public final class CustomIsoparser { + + public ZonedDateTime parseIsodatetime(String dateTime) { + return ZonedDateTime.parse(dateTime); + } + + public LocalDate parseIsodate(String date) { + return LocalDate.parse(date); + } + +} \ No newline at end of file diff --git a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/schemas/validation/DefaultValueMethod.kt b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/schemas/validation/DefaultValueMethod.kt new file mode 100644 index 00000000000..1f1d1ba5e68 --- /dev/null +++ b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/schemas/validation/DefaultValueMethod.kt @@ -0,0 +1,7 @@ +package org.openapijsonschematools.client.schemas.validation; + +import org.openapijsonschematools.client.exceptions.ValidationException; + +public interface DefaultValueMethod { + T defaultValue() throws ValidationException; +} \ No newline at end of file diff --git a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/schemas/validation/DependentRequiredValidator.kt b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/schemas/validation/DependentRequiredValidator.kt new file mode 100644 index 00000000000..2640e2f6d8d --- /dev/null +++ b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/schemas/validation/DependentRequiredValidator.kt @@ -0,0 +1,42 @@ +package org.openapijsonschematools.client.schemas.validation; + +import org.checkerframework.checker.nullness.qual.Nullable; +import org.openapijsonschematools.client.exceptions.ValidationException; + +import java.util.HashSet; +import java.util.Map; +import java.util.Set; + +public class DependentRequiredValidator implements KeywordValidator { + @Override + public @Nullable PathToSchemasMap validate( + ValidationData data + ) throws ValidationException { + if (!(data.arg() instanceof Map mapArg)) { + return null; + } + var dependentRequired = data.schema().dependentRequired; + if (dependentRequired == null) { + return null; + } + for (Map.Entry> entry: dependentRequired.entrySet()) { + if (!mapArg.containsKey(entry.getKey())) { + continue; + } + Set missingKeys = new HashSet<>(entry.getValue()); + for (Object objKey: mapArg.keySet()) { + if (objKey instanceof String key) { + missingKeys.remove(key); + } + } + if (missingKeys.isEmpty()) { + continue; + } + throw new ValidationException( + "Validation failed for dependentRequired because these_keys="+missingKeys+" are "+ + "missing at pathToItem="+data.validationMetadata().pathToItem()+" in class "+data.schema().getClass() + ); + } + return null; + } +} diff --git a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/schemas/validation/DependentSchemasValidator.kt b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/schemas/validation/DependentSchemasValidator.kt new file mode 100644 index 00000000000..f51b5eaf339 --- /dev/null +++ b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/schemas/validation/DependentSchemasValidator.kt @@ -0,0 +1,41 @@ +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; +import java.util.Set; + +public class DependentSchemasValidator implements KeywordValidator { + @Override + public @Nullable PathToSchemasMap validate( + ValidationData data + ) throws ValidationException { + if (!(data.arg() instanceof Map mapArg)) { + return null; + } + var dependentSchemas = data.schema().dependentSchemas; + if (dependentSchemas == null) { + return null; + } + PathToSchemasMap pathToSchemas = new PathToSchemasMap(); + Set presentProperties = new LinkedHashSet<>(); + for (Object key: mapArg.keySet()) { + if (key instanceof String) { + presentProperties.add((String) key); + } + } + for(Map.Entry>> entry: dependentSchemas.entrySet()) { + String propName = entry.getKey(); + if (!presentProperties.contains(propName)) { + continue; + } + Class> dependentSchemaClass = entry.getValue(); + JsonSchema dependentSchema = JsonSchemaFactory.getInstance(dependentSchemaClass); + PathToSchemasMap otherPathToSchemas = JsonSchema.validate(dependentSchema, mapArg, data.validationMetadata()); + pathToSchemas.update(otherPathToSchemas); + } + return pathToSchemas; + } +} diff --git a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/schemas/validation/DoubleEnumValidator.kt b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/schemas/validation/DoubleEnumValidator.kt new file mode 100644 index 00000000000..f2b8b1e7d74 --- /dev/null +++ b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/schemas/validation/DoubleEnumValidator.kt @@ -0,0 +1,8 @@ +package org.openapijsonschematools.client.schemas.validation; + +import org.openapijsonschematools.client.configurations.SchemaConfiguration; +import org.openapijsonschematools.client.exceptions.ValidationException; + +public interface DoubleEnumValidator { + double validate(EnumType arg, SchemaConfiguration configuration) throws ValidationException; +} \ No newline at end of file diff --git a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/schemas/validation/DoubleValueMethod.kt b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/schemas/validation/DoubleValueMethod.kt new file mode 100644 index 00000000000..41c9e8e577a --- /dev/null +++ b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/schemas/validation/DoubleValueMethod.kt @@ -0,0 +1,5 @@ +package org.openapijsonschematools.client.schemas.validation; + +public interface DoubleValueMethod { + double value(); +} \ No newline at end of file diff --git a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/schemas/validation/ElseValidator.kt b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/schemas/validation/ElseValidator.kt new file mode 100644 index 00000000000..18573a77ef7 --- /dev/null +++ b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/schemas/validation/ElseValidator.kt @@ -0,0 +1,31 @@ +package org.openapijsonschematools.client.schemas.validation; + +import org.checkerframework.checker.nullness.qual.Nullable; +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; + } + var ifPathToSchemas = data.ifPathToSchemas(); + if (ifPathToSchemas == null) { + // if unset + return null; + } + if (!ifPathToSchemas.isEmpty()) { + // if validation is true + return null; + } + JsonSchema elseSchemaInstance = JsonSchemaFactory.getInstance(elseSchema); + PathToSchemasMap pathToSchemas = new PathToSchemasMap(); + var elsePathToSchemas = JsonSchema.validate(elseSchemaInstance, data.arg(), data.validationMetadata()); + // todo capture validation error and describe it as an else error? + pathToSchemas.update(elsePathToSchemas); + return pathToSchemas; + } +} diff --git a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/schemas/validation/EnumValidator.kt b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/schemas/validation/EnumValidator.kt new file mode 100644 index 00000000000..66563d80960 --- /dev/null +++ b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/schemas/validation/EnumValidator.kt @@ -0,0 +1,43 @@ +package org.openapijsonschematools.client.schemas.validation; + +import org.openapijsonschematools.client.exceptions.ValidationException; +import org.checkerframework.checker.nullness.qual.Nullable; + +import java.math.BigDecimal; +import java.util.Set; + +public class EnumValidator extends BigDecimalValidator implements KeywordValidator { + @SuppressWarnings("nullness") + private static boolean enumContainsArg(Set<@Nullable Object> enumValues, @Nullable Object arg){ + return enumValues.contains(arg); + } + + @Override + public @Nullable PathToSchemasMap validate( + ValidationData data + ) throws ValidationException { + var enumValues = data.schema().enumValues; + if (enumValues == null) { + return null; + } + if (enumValues.isEmpty()) { + throw new ValidationException("No value can match enum because enum is empty"); + } + if (data.arg() instanceof Number numberArg) { + BigDecimal castArg = getBigDecimal(numberArg); + if (enumContainsArg(enumValues, castArg)) { + return null; + } + for (Object enumValue: enumValues) { + if (enumValue instanceof BigDecimal && ((BigDecimal) enumValue).compareTo(castArg) == 0) { + return null; + } + } + } else { + if (enumContainsArg(enumValues, data.arg())) { + return null; + } + } + throw new ValidationException("Invalid value "+data.arg()+" was not one of the allowed enum "+enumValues); + } +} diff --git a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/schemas/validation/ExclusiveMaximumValidator.kt b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/schemas/validation/ExclusiveMaximumValidator.kt new file mode 100644 index 00000000000..e05df98079f --- /dev/null +++ b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/schemas/validation/ExclusiveMaximumValidator.kt @@ -0,0 +1,45 @@ +package org.openapijsonschematools.client.schemas.validation; + +import org.openapijsonschematools.client.exceptions.ValidationException; +import org.checkerframework.checker.nullness.qual.Nullable; + +public class ExclusiveMaximumValidator implements KeywordValidator { + @Override + public @Nullable PathToSchemasMap validate( + ValidationData data + ) throws ValidationException { + var exclusiveMaximum = data.schema().exclusiveMaximum; + if (exclusiveMaximum == null) { + return null; + } + if (!(data.arg() instanceof Number)) { + return null; + } + String msg = "Value " + data.arg() + " is invalid because it is >= the exclusiveMaximum of " + exclusiveMaximum; + if (data.arg() instanceof Integer intArg) { + if (intArg.compareTo(exclusiveMaximum.intValue()) > -1) { + throw new ValidationException(msg); + } + return null; + } + if (data.arg() instanceof Long longArg) { + if (longArg.compareTo(exclusiveMaximum.longValue()) > -1) { + throw new ValidationException(msg); + } + return null; + } + if (data.arg() instanceof Float floatArg) { + if (floatArg.compareTo(exclusiveMaximum.floatValue()) > -1) { + throw new ValidationException(msg); + } + return null; + } + if (data.arg() instanceof Double doubleArg) { + if (doubleArg.compareTo(exclusiveMaximum.doubleValue()) > -1) { + throw new ValidationException(msg); + } + return null; + } + return null; + } +} diff --git a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/schemas/validation/ExclusiveMinimumValidator.kt b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/schemas/validation/ExclusiveMinimumValidator.kt new file mode 100644 index 00000000000..0e06f391f62 --- /dev/null +++ b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/schemas/validation/ExclusiveMinimumValidator.kt @@ -0,0 +1,45 @@ +package org.openapijsonschematools.client.schemas.validation; + +import org.openapijsonschematools.client.exceptions.ValidationException; +import org.checkerframework.checker.nullness.qual.Nullable; + +public class ExclusiveMinimumValidator implements KeywordValidator { + @Override + public @Nullable PathToSchemasMap validate( + ValidationData data + ) throws ValidationException { + var exclusiveMinimum = data.schema().exclusiveMinimum; + if (exclusiveMinimum == null) { + return null; + } + if (!(data.arg() instanceof Number)) { + return null; + } + String msg = "Value " + data.arg() + " is invalid because it is <= the exclusiveMinimum of " + exclusiveMinimum; + if (data.arg() instanceof Integer intArg) { + if (intArg.compareTo(exclusiveMinimum.intValue()) < 1) { + throw new ValidationException(msg); + } + return null; + } + if (data.arg() instanceof Long longArg) { + if (longArg.compareTo(exclusiveMinimum.longValue()) < 1) { + throw new ValidationException(msg); + } + return null; + } + if (data.arg() instanceof Float floatArg) { + if (floatArg.compareTo(exclusiveMinimum.floatValue()) < 1) { + throw new ValidationException(msg); + } + return null; + } + if (data.arg() instanceof Double doubleArg) { + if (doubleArg.compareTo(exclusiveMinimum.doubleValue()) < 1) { + throw new ValidationException(msg); + } + return null; + } + return null; + } +} diff --git a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/schemas/validation/FloatEnumValidator.kt b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/schemas/validation/FloatEnumValidator.kt new file mode 100644 index 00000000000..17317003a34 --- /dev/null +++ b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/schemas/validation/FloatEnumValidator.kt @@ -0,0 +1,8 @@ +package org.openapijsonschematools.client.schemas.validation; + +import org.openapijsonschematools.client.configurations.SchemaConfiguration; +import org.openapijsonschematools.client.exceptions.ValidationException; + +public interface FloatEnumValidator { + float validate(EnumType arg, SchemaConfiguration configuration) throws ValidationException; +} \ No newline at end of file diff --git a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/schemas/validation/FloatValueMethod.kt b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/schemas/validation/FloatValueMethod.kt new file mode 100644 index 00000000000..da72f3eac58 --- /dev/null +++ b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/schemas/validation/FloatValueMethod.kt @@ -0,0 +1,5 @@ +package org.openapijsonschematools.client.schemas.validation; + +public interface FloatValueMethod { + float value(); +} \ No newline at end of file diff --git a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/schemas/validation/FormatValidator.kt b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/schemas/validation/FormatValidator.kt new file mode 100644 index 00000000000..35c089a03c7 --- /dev/null +++ b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/schemas/validation/FormatValidator.kt @@ -0,0 +1,158 @@ +package org.openapijsonschematools.client.schemas.validation; + +import org.openapijsonschematools.client.exceptions.ValidationException; +import org.checkerframework.checker.nullness.qual.Nullable; + +import java.math.BigDecimal; +import java.math.BigInteger; +import java.time.format.DateTimeParseException; +import java.util.UUID; + +public class FormatValidator implements KeywordValidator { + private final static BigInteger int32InclusiveMinimum = BigInteger.valueOf(-2147483648L); + private final static BigInteger int32InclusiveMaximum = BigInteger.valueOf(2147483647L); + private final static BigInteger int64InclusiveMinimum = BigInteger.valueOf(-9223372036854775808L); + private final static BigInteger int64InclusiveMaximum = BigInteger.valueOf(9223372036854775807L); + private final static BigDecimal floatInclusiveMinimum = BigDecimal.valueOf(-3.4028234663852886e+38); + private final static BigDecimal floatInclusiveMaximum = BigDecimal.valueOf(3.4028234663852886e+38); + 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 { + if (format.startsWith("int")) { + // there is a json schema test where 1.0 validates as an integer + BigInteger intArg; + if (arg instanceof Float || arg instanceof Double) { + double doubleArg; + if (arg instanceof Float) { + doubleArg = arg.doubleValue(); + } else { + doubleArg = (Double) arg; + } + if (Math.floor(doubleArg) != doubleArg) { + throw new ValidationException( + "Invalid non-integer value " + arg + " for format " + format + " at " + validationMetadata.pathToItem() + ); + } + if (arg instanceof Float) { + Integer smallInt = Math.round((Float) arg); + intArg = BigInteger.valueOf(smallInt.longValue()); + } else { + intArg = BigInteger.valueOf(Math.round((Double) arg)); + } + } else if (arg instanceof Integer) { + intArg = BigInteger.valueOf(arg.longValue()); + } else if (arg instanceof Long) { + intArg = BigInteger.valueOf((Long) arg); + } else { + intArg = (BigInteger) arg; + } + if (format.equals("int32")) { + if (intArg.compareTo(int32InclusiveMinimum) < 0 || intArg.compareTo(int32InclusiveMaximum) > 0) { + throw new ValidationException( + "Invalid value " + arg + " for format int32 at " + validationMetadata.pathToItem() + ); + } + } else if (format.equals("int64")) { + if (intArg.compareTo(int64InclusiveMinimum) < 0 || intArg.compareTo(int64InclusiveMaximum) > 0) { + throw new ValidationException( + "Invalid value " + arg + " for format int64 at " + validationMetadata.pathToItem() + ); + } + } + } else if (format.equals("float") || format.equals("double")) { + BigDecimal decimalArg; + if (arg instanceof Float) { + decimalArg = BigDecimal.valueOf(arg.doubleValue()); + } else if (arg instanceof Double) { + decimalArg = BigDecimal.valueOf((Double) arg); + } else { + decimalArg = (BigDecimal) arg; + } + if (format.equals("float")) { + if (decimalArg.compareTo(floatInclusiveMinimum) < 0 || decimalArg.compareTo(floatInclusiveMaximum) > 0 ){ + throw new ValidationException( + "Invalid value "+arg+" for format float at "+validationMetadata.pathToItem() + ); + } + } else { + if (decimalArg.compareTo(doubleInclusiveMinimum) < 0 || decimalArg.compareTo(doubleInclusiveMaximum) > 0 ){ + throw new ValidationException( + "Invalid value "+arg+" for format double at "+validationMetadata.pathToItem() + ); + } + } + } + } + + private static void validateStringFormat(String arg, ValidationMetadata validationMetadata, String format) throws ValidationException { + switch (format) { + case "uuid" -> { + try { + UUID.fromString(arg); + } catch (IllegalArgumentException e) { + throw new ValidationException( + "Value cannot be converted to a UUID. Invalid value " + + arg + " for format uuid at " + validationMetadata.pathToItem() + ); + } + } + case "number" -> { + try { + new BigDecimal(arg); + } catch (NumberFormatException e) { + throw new ValidationException( + "Value cannot be converted to a decimal. Invalid value " + + arg + " for format number at " + validationMetadata.pathToItem() + ); + } + } + case "date" -> { + try { + new CustomIsoparser().parseIsodate(arg); + } catch (DateTimeParseException e) { + throw new ValidationException( + "Value does not conform to the required ISO-8601 date format. " + + "Invalid value " + arg + " for format date at " + validationMetadata.pathToItem() + ); + } + } + case "date-time" -> { + try { + new CustomIsoparser().parseIsodatetime(arg); + } catch (DateTimeParseException e) { + throw new ValidationException( + "Value does not conform to the required ISO-8601 datetime format. " + + "Invalid value " + arg + " for format datetime at " + validationMetadata.pathToItem() + ); + } + } + } + } + + @Override + public @Nullable PathToSchemasMap validate( + ValidationData data + ) throws ValidationException { + var format = data.schema().format; + if (format == null) { + return null; + } + if (data.arg() instanceof Number numberArg) { + validateNumericFormat( + numberArg, + data.validationMetadata(), + format + ); + return null; + } else if (data.arg() instanceof String stringArg) { + validateStringFormat( + stringArg, + data.validationMetadata(), + format + ); + return null; + } + return null; + } +} diff --git a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/schemas/validation/FrozenList.kt b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/schemas/validation/FrozenList.kt new file mode 100644 index 00000000000..ab3ff21cbe1 --- /dev/null +++ b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/schemas/validation/FrozenList.kt @@ -0,0 +1,30 @@ +package org.openapijsonschematools.client.schemas.validation; + +import java.util.AbstractList; +import java.util.ArrayList; +import java.util.Collection; +import java.util.List; + +public class FrozenList extends AbstractList { + /* + A frozen List + Once schema validation has been run, indexed access returns values of the correct type + If values were mutable, the types in those methods would not agree with returned values + */ + private final List list; + public FrozenList(Collection m) { + super(); + list = new ArrayList<>(m); + } + + @Override + public E get(int index) { + return list.get(index); + } + + @Override + public int size() { + return list.size(); + } +} + diff --git a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/schemas/validation/FrozenMap.kt b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/schemas/validation/FrozenMap.kt new file mode 100644 index 00000000000..f3b178dd724 --- /dev/null +++ b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/schemas/validation/FrozenMap.kt @@ -0,0 +1,54 @@ +package org.openapijsonschematools.client.schemas.validation; + +import org.checkerframework.checker.nullness.qual.KeyFor; +import org.openapijsonschematools.client.exceptions.UnsetPropertyException; +import org.openapijsonschematools.client.exceptions.InvalidAdditionalPropertyException; + +import java.util.AbstractMap; +import java.util.HashMap; +import java.util.HashSet; +import java.util.Map; +import java.util.Set; +import java.util.stream.Collectors; + +public class FrozenMap extends AbstractMap { + /* + A frozen Map + Once schema validation has been run, written accessor methods return values of the correct type + If values were mutable, the types in those methods would not agree with returned values + */ + private final Map map; + public FrozenMap(Map m) { + + super(); + map = new HashMap<>(m); + } + + protected V getOrThrow(String key) throws UnsetPropertyException { + if (containsKey(key)) { + return get(key); + } + throw new UnsetPropertyException(key+" is unset"); + } + + protected void throwIfKeyNotPresent(String key) throws UnsetPropertyException { + if (!containsKey(key)) { + throw new UnsetPropertyException(key+" is unset"); + } + } + + protected void throwIfKeyKnown(String key, Set requiredKeys, Set optionalKeys) throws InvalidAdditionalPropertyException { + Set knownKeys = new HashSet<>(); + knownKeys.addAll(requiredKeys); + knownKeys.addAll(optionalKeys); + MapUtils.throwIfKeyKnown(key, knownKeys, false); + } + + @Override + public Set> entrySet() { + return map.entrySet().stream() + .map(x -> new AbstractMap.SimpleEntry<>(x.getKey(), x.getValue())) + .collect(Collectors.toSet()); + } +} + diff --git a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/schemas/validation/IfValidator.kt b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/schemas/validation/IfValidator.kt new file mode 100644 index 00000000000..2a05893a22a --- /dev/null +++ b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/schemas/validation/IfValidator.kt @@ -0,0 +1,28 @@ +package org.openapijsonschematools.client.schemas.validation; + +import org.openapijsonschematools.client.exceptions.ValidationException; +import org.checkerframework.checker.nullness.qual.Nullable; + +public class IfValidator implements KeywordValidator { + @Override + public @Nullable PathToSchemasMap validate( + ValidationData data + ) throws ValidationException { + var ifSchema = data.schema().ifSchema; + if (ifSchema == null) { + return null; + } + if (data.ifPathToSchemas() == null) { + throw new ValidationException("Invalid type for ifPathToSchemas"); + } + /* + if is false use case + ifPathToSchemas == {} + no need to add any data to pathToSchemas + + if true, then true -> true for whole schema + so validate_then will add ifPathToSchemas data to pathToSchemas + */ + return null; + } +} diff --git a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/schemas/validation/IntegerEnumValidator.kt b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/schemas/validation/IntegerEnumValidator.kt new file mode 100644 index 00000000000..cb20c832f9b --- /dev/null +++ b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/schemas/validation/IntegerEnumValidator.kt @@ -0,0 +1,8 @@ +package org.openapijsonschematools.client.schemas.validation; + +import org.openapijsonschematools.client.configurations.SchemaConfiguration; +import org.openapijsonschematools.client.exceptions.ValidationException; + +public interface IntegerEnumValidator { + int validate(EnumType arg, SchemaConfiguration configuration) throws ValidationException; +} \ No newline at end of file diff --git a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/schemas/validation/IntegerValueMethod.kt b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/schemas/validation/IntegerValueMethod.kt new file mode 100644 index 00000000000..dbfe29ce3f1 --- /dev/null +++ b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/schemas/validation/IntegerValueMethod.kt @@ -0,0 +1,5 @@ +package org.openapijsonschematools.client.schemas.validation; + +public interface IntegerValueMethod { + int value(); +} \ No newline at end of file diff --git a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/schemas/validation/ItemsValidator.kt b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/schemas/validation/ItemsValidator.kt new file mode 100644 index 00000000000..68d62107337 --- /dev/null +++ b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/schemas/validation/ItemsValidator.kt @@ -0,0 +1,45 @@ +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; + +public class ItemsValidator implements KeywordValidator { + @Override + public @Nullable PathToSchemasMap validate( + ValidationData data + ) throws ValidationException { + var items = data.schema().items; + if (items == null) { + return null; + } + if (!(data.arg() instanceof List listArg)) { + return null; + } + if (listArg.isEmpty()) { + return null; + } + PathToSchemasMap pathToSchemas = new PathToSchemasMap(); + int minIndex = data.schema().prefixItems != null ? data.schema().prefixItems.size() : 0; + JsonSchema itemsSchema = JsonSchemaFactory.getInstance(items); + for(int i = minIndex; i < listArg.size(); i++) { + List itemPathToItem = new ArrayList<>(data.validationMetadata().pathToItem()); + itemPathToItem.add(i); + ValidationMetadata itemValidationMetadata = new ValidationMetadata( + itemPathToItem, + data.validationMetadata().configuration(), + data.validationMetadata().validatedPathToSchemas(), + data.validationMetadata().seenClasses() + ); + if (itemValidationMetadata.validationRanEarlier(itemsSchema)) { + // todo add_deeper_validated_schemas + continue; + } + PathToSchemasMap otherPathToSchemas = JsonSchema.validate(itemsSchema, listArg.get(i), itemValidationMetadata); + pathToSchemas.update(otherPathToSchemas); + } + return pathToSchemas; + } +} diff --git a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/schemas/validation/JsonSchema.kt b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/schemas/validation/JsonSchema.kt new file mode 100644 index 00000000000..cd916ff197f --- /dev/null +++ b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/schemas/validation/JsonSchema.kt @@ -0,0 +1,499 @@ +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 java.math.BigDecimal; +import java.time.LocalDate; +import java.time.ZonedDateTime; +import java.util.ArrayList; +import java.util.LinkedHashMap; +import java.util.LinkedHashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; +import java.util.UUID; +import java.util.regex.Pattern; + +public abstract class JsonSchema { + public final @Nullable Set> type; + public final @Nullable String format; + public final @Nullable Class> items; + public final @Nullable Map>> properties; + public final @Nullable Set required; + public final @Nullable Number exclusiveMaximum; + public final @Nullable Number exclusiveMinimum; + public final @Nullable Integer maxItems; + public final @Nullable Integer minItems; + public final @Nullable Integer maxLength; + public final @Nullable Integer minLength; + public final @Nullable Integer maxProperties; + public final @Nullable Integer minProperties; + public final @Nullable Number maximum; + public final @Nullable Number minimum; + public final @Nullable BigDecimal multipleOf; + public final @Nullable Class> additionalProperties; + public final @Nullable List>> allOf; + public final @Nullable List>> anyOf; + public final @Nullable List>> oneOf; + public final @Nullable Class> not; + public final @Nullable Boolean uniqueItems; + public final @Nullable Set<@Nullable Object> enumValues; + public final @Nullable Pattern pattern; + public final @Nullable Object defaultValue; + public final boolean defaultValueSet; + public final @Nullable Object constValue; + public final boolean constValueSet; + public final @Nullable Class> contains; + public final @Nullable Integer maxContains; + public final @Nullable Integer minContains; + public final @Nullable Class> propertyNames; + public final @Nullable Map> dependentRequired; + public final @Nullable Map>> dependentSchemas; + public final @Nullable Map>> patternProperties; + public final @Nullable List>> prefixItems; + public final @Nullable Class> ifSchema; + public final @Nullable Class> then; + public final @Nullable Class> elseSchema; + public final @Nullable Class> unevaluatedItems; + public final @Nullable Class> unevaluatedProperties; + private final LinkedHashMap keywordToValidator; + + protected JsonSchema(JsonSchemaInfo jsonSchemaInfo) { + LinkedHashMap keywordToValidator = new LinkedHashMap<>(); + this.type = jsonSchemaInfo.type; + if (this.type != null) { + keywordToValidator.put("type", new TypeValidator()); + } + this.format = jsonSchemaInfo.format; + if (this.format != null) { + keywordToValidator.put("format", new FormatValidator()); + } + this.items = jsonSchemaInfo.items; + if (this.items != null) { + keywordToValidator.put("items", new ItemsValidator()); + } + this.properties = jsonSchemaInfo.properties; + if (this.properties != null) { + keywordToValidator.put("properties", new PropertiesValidator()); + } + this.required = jsonSchemaInfo.required; + if (this.required != null) { + keywordToValidator.put("required", new RequiredValidator()); + } + this.exclusiveMaximum = jsonSchemaInfo.exclusiveMaximum; + if (this.exclusiveMaximum != null) { + keywordToValidator.put("exclusiveMaximum", new ExclusiveMaximumValidator()); + } + this.exclusiveMinimum = jsonSchemaInfo.exclusiveMinimum; + if (this.exclusiveMinimum != null) { + keywordToValidator.put("exclusiveMinimum", new ExclusiveMinimumValidator()); + } + this.maxItems = jsonSchemaInfo.maxItems; + if (this.maxItems != null) { + keywordToValidator.put("maxItems", new MaxItemsValidator()); + } + this.minItems = jsonSchemaInfo.minItems; + if (this.minItems != null) { + keywordToValidator.put("minItems", new MinItemsValidator()); + } + this.maxLength = jsonSchemaInfo.maxLength; + if (this.maxLength != null) { + keywordToValidator.put("maxLength", new MaxLengthValidator()); + } + this.minLength = jsonSchemaInfo.minLength; + if (this.minLength != null) { + keywordToValidator.put("minLength", new MinLengthValidator()); + } + this.maxProperties = jsonSchemaInfo.maxProperties; + if (this.maxProperties != null) { + keywordToValidator.put("maxProperties", new MaxPropertiesValidator()); + } + this.minProperties = jsonSchemaInfo.minProperties; + if (this.minProperties != null) { + keywordToValidator.put("minProperties", new MinPropertiesValidator()); + } + this.maximum = jsonSchemaInfo.maximum; + if (this.maximum != null) { + keywordToValidator.put("maximum", new MaximumValidator()); + } + this.minimum = jsonSchemaInfo.minimum; + if (this.minimum != null) { + keywordToValidator.put("minimum", new MinimumValidator()); + } + this.multipleOf = jsonSchemaInfo.multipleOf; + if (this.multipleOf != null) { + keywordToValidator.put("multipleOf", new MultipleOfValidator()); + } + this.additionalProperties = jsonSchemaInfo.additionalProperties; + if (this.additionalProperties != null) { + keywordToValidator.put("additionalProperties", new AdditionalPropertiesValidator()); + } + this.allOf = jsonSchemaInfo.allOf; + if (this.allOf != null) { + keywordToValidator.put("allOf", new AllOfValidator()); + } + this.anyOf = jsonSchemaInfo.anyOf; + if (this.anyOf != null) { + keywordToValidator.put("anyOf", new AnyOfValidator()); + } + this.oneOf = jsonSchemaInfo.oneOf; + if (this.oneOf != null) { + keywordToValidator.put("oneOf", new OneOfValidator()); + } + this.not = jsonSchemaInfo.not; + if (this.not != null) { + keywordToValidator.put("not", new NotValidator()); + } + this.uniqueItems = jsonSchemaInfo.uniqueItems; + if (this.uniqueItems != null) { + keywordToValidator.put("uniqueItems", new UniqueItemsValidator()); + } + this.enumValues = jsonSchemaInfo.enumValues; + if (this.enumValues != null) { + keywordToValidator.put("enum", new EnumValidator()); + } + this.pattern = jsonSchemaInfo.pattern; + if (this.pattern != null) { + keywordToValidator.put("pattern", new PatternValidator()); + } + this.defaultValue = jsonSchemaInfo.defaultValue; + this.defaultValueSet = jsonSchemaInfo.defaultValueSet; + this.constValue = jsonSchemaInfo.constValue; + this.constValueSet = jsonSchemaInfo.constValueSet; + if (this.constValueSet) { + keywordToValidator.put("const", new ConstValidator()); + } + this.contains = jsonSchemaInfo.contains; + if (this.contains != null) { + keywordToValidator.put("contains", new ContainsValidator()); + } + this.maxContains = jsonSchemaInfo.maxContains; + if (this.maxContains != null) { + keywordToValidator.put("maxContains", new MaxContainsValidator()); + } + this.minContains = jsonSchemaInfo.minContains; + if (this.minContains != null) { + keywordToValidator.put("minContains", new MinContainsValidator()); + } + this.propertyNames = jsonSchemaInfo.propertyNames; + if (this.propertyNames != null) { + keywordToValidator.put("propertyNames", new PropertyNamesValidator()); + } + this.dependentRequired = jsonSchemaInfo.dependentRequired; + if (this.dependentRequired != null) { + keywordToValidator.put("dependentRequired", new DependentRequiredValidator()); + } + this.dependentSchemas = jsonSchemaInfo.dependentSchemas; + if (this.dependentSchemas != null) { + keywordToValidator.put("dependentSchemas", new DependentSchemasValidator()); + } + this.patternProperties = jsonSchemaInfo.patternProperties; + if (this.patternProperties != null) { + keywordToValidator.put("patternProperties", new PatternPropertiesValidator()); + } + this.prefixItems = jsonSchemaInfo.prefixItems; + if (this.prefixItems != null) { + keywordToValidator.put("prefixItems", new PrefixItemsValidator()); + } + this.ifSchema = jsonSchemaInfo.ifSchema; + if (this.ifSchema != null) { + keywordToValidator.put("if", new IfValidator()); + } + this.then = jsonSchemaInfo.then; + if (this.then != null) { + keywordToValidator.put("then", new ThenValidator()); + } + this.elseSchema = jsonSchemaInfo.elseSchema; + if (this.elseSchema != null) { + keywordToValidator.put("else", new ElseValidator()); + } + this.unevaluatedItems = jsonSchemaInfo.unevaluatedItems; + if (this.unevaluatedItems != null) { + keywordToValidator.put("unevaluatedItems", new UnevaluatedItemsValidator()); + } + this.unevaluatedProperties = jsonSchemaInfo.unevaluatedProperties; + if (this.unevaluatedProperties != null) { + keywordToValidator.put("unevaluatedProperties", new UnevaluatedPropertiesValidator()); + } + 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; + + private List getContainsPathToSchemas( + @Nullable Object arg, + ValidationMetadata validationMetadata + ) { + if (!(arg instanceof List listArg) || contains == null) { + return new ArrayList<>(); + } + JsonSchema containsSchema = JsonSchemaFactory.getInstance(contains); + @Nullable List containsPathToSchemas = new ArrayList<>(); + for(int i = 0; i < listArg.size(); i++) { + PathToSchemasMap thesePathToSchemas = new PathToSchemasMap(); + List itemPathToItem = new ArrayList<>(validationMetadata.pathToItem()); + itemPathToItem.add(i); + ValidationMetadata itemValidationMetadata = new ValidationMetadata( + itemPathToItem, + validationMetadata.configuration(), + validationMetadata.validatedPathToSchemas(), + validationMetadata.seenClasses() + ); + if (itemValidationMetadata.validationRanEarlier(containsSchema)) { + // todo add_deeper_validated_schemas + containsPathToSchemas.add(thesePathToSchemas); + continue; + } + + try { + PathToSchemasMap otherPathToSchemas = JsonSchema.validate( + containsSchema, listArg.get(i), itemValidationMetadata); + containsPathToSchemas.add(otherPathToSchemas); + } catch (ValidationException ignored) {} + } + return containsPathToSchemas; + } + + private PathToSchemasMap getPatternPropertiesPathToSchemas( + @Nullable Object arg, + ValidationMetadata validationMetadata + ) throws ValidationException { + if (!(arg instanceof Map mapArg) || patternProperties == null) { + return new PathToSchemasMap(); + } + PathToSchemasMap pathToSchemas = new PathToSchemasMap(); + 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"); + } + List propPathToItem = new ArrayList<>(validationMetadata.pathToItem()); + propPathToItem.add(key); + ValidationMetadata propValidationMetadata = new ValidationMetadata( + propPathToItem, + validationMetadata.configuration(), + validationMetadata.validatedPathToSchemas(), + validationMetadata.seenClasses() + ); + for (Map.Entry>> patternPropEntry: patternProperties.entrySet()) { + if (!patternPropEntry.getKey().matcher(key).find()) { + continue; + } + + Class> patternPropClass = patternPropEntry.getValue(); + JsonSchema patternPropSchema = JsonSchemaFactory.getInstance(patternPropClass); + PathToSchemasMap otherPathToSchemas = JsonSchema.validate(patternPropSchema, entry.getValue(), propValidationMetadata); + pathToSchemas.update(otherPathToSchemas); + } + } + return pathToSchemas; + } + + private PathToSchemasMap getIfPathToSchemas( + @Nullable Object arg, + ValidationMetadata validationMetadata + ) { + if (ifSchema == null) { + return new PathToSchemasMap(); + } + JsonSchema ifSchemaInstance = JsonSchemaFactory.getInstance(ifSchema); + PathToSchemasMap pathToSchemas = new PathToSchemasMap(); + try { + var otherPathToSchemas = JsonSchema.validate(ifSchemaInstance, arg, validationMetadata); + pathToSchemas.update(otherPathToSchemas); + } catch (ValidationException ignored) {} + return pathToSchemas; + } + + public static PathToSchemasMap validate( + JsonSchema jsonSchema, + @Nullable Object arg, + ValidationMetadata validationMetadata + ) throws ValidationException { + LinkedHashSet disabledKeywords = validationMetadata.configuration().disabledKeywordFlags().getKeywords(); + PathToSchemasMap pathToSchemas = new PathToSchemasMap(); + LinkedHashMap thisKeywordToValidator = jsonSchema.keywordToValidator; + @Nullable List containsPathToSchemas = null; + if (thisKeywordToValidator.containsKey("contains")) { + containsPathToSchemas = jsonSchema.getContainsPathToSchemas(arg, validationMetadata); + } + @Nullable PathToSchemasMap patternPropertiesPathToSchemas = null; + if (thisKeywordToValidator.containsKey("patternProperties")) { + patternPropertiesPathToSchemas = jsonSchema.getPatternPropertiesPathToSchemas(arg, validationMetadata); + } + @Nullable PathToSchemasMap ifPathToSchemas = null; + if (thisKeywordToValidator.containsKey("if")) { + ifPathToSchemas = jsonSchema.getIfPathToSchemas(arg, validationMetadata); + } + @Nullable PathToSchemasMap knownPathToSchemas = null; + for (Map.Entry entry: thisKeywordToValidator.entrySet()) { + String jsonKeyword = entry.getKey(); + if (disabledKeywords.contains(jsonKeyword)) { + boolean typeIntegerUseCase = jsonKeyword.equals("format") && "int".equals(jsonSchema.format); + if (!typeIntegerUseCase) { + continue; + } + } + if ("unevaluatedItems".equals(jsonKeyword) || "unevaluatedProperties".equals(jsonKeyword)) { + knownPathToSchemas = pathToSchemas; + } + KeywordValidator validator = entry.getValue(); + ValidationData data = new ValidationData( + jsonSchema, + arg, + validationMetadata, + containsPathToSchemas, + patternPropertiesPathToSchemas, + ifPathToSchemas, + knownPathToSchemas + ); + @Nullable PathToSchemasMap otherPathToSchemas = validator.validate(data); + if (otherPathToSchemas == null) { + continue; + } + pathToSchemas.update(otherPathToSchemas); + } + List pathToItem = validationMetadata.pathToItem(); + if (!pathToSchemas.containsKey(pathToItem)) { + pathToSchemas.put(validationMetadata.pathToItem(), new LinkedHashMap<>()); + } + @Nullable LinkedHashMap, Nothing?> schemas = pathToSchemas.get(pathToItem); + if (schemas != null) { + schemas.put(jsonSchema, null); + } + return pathToSchemas; + } + + protected String castToAllowedTypes(String arg, List pathToItem, Set> pathSet) { + pathSet.add(pathToItem); + return arg; + } + + protected Boolean castToAllowedTypes(Boolean arg, List pathToItem, Set> pathSet) { + pathSet.add(pathToItem); + return arg; + } + + protected Number castToAllowedTypes(Number arg, List pathToItem, Set> pathSet) { + pathSet.add(pathToItem); + return arg; + } + + protected Nothing? castToAllowedTypes(Nothing? arg, List pathToItem, Set> pathSet) { + pathSet.add(pathToItem); + return arg; + } + + protected List castToAllowedTypes(List arg, List pathToItem, Set> pathSet) throws ValidationException { + pathSet.add(pathToItem); + List<@Nullable Object> argFixed = new ArrayList<>(); + int i =0; + for (Object item: arg) { + List newPathToItem = new ArrayList<>(pathToItem); + newPathToItem.add(i); + Object fixedVal = castToAllowedObjectTypes(item, newPathToItem, pathSet); + argFixed.add(fixedVal); + i += 1; + } + return argFixed; + } + + 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 ValidationException("Invalid non-string key value"); + } + Object val = entry.getValue(); + List newPathToItem = new ArrayList<>(pathToItem); + newPathToItem.add(key); + Object fixedVal = castToAllowedObjectTypes(val, newPathToItem, pathSet); + argFixed.put(key, fixedVal); + } + return argFixed; + } + + private @Nullable Object castToAllowedObjectTypes(@Nullable Object arg, List pathToItem, Set> pathSet) throws ValidationException { + if (arg == null) { + return castToAllowedTypes((Nothing?) null, pathToItem, pathSet); + } else if (arg instanceof String) { + return castToAllowedTypes((String) arg, pathToItem, pathSet); + } else if (arg instanceof Map) { + pathSet.add(pathToItem); + return castToAllowedTypes((Map) arg, pathToItem, pathSet); + } else if (arg instanceof Boolean) { + return castToAllowedTypes((Boolean) arg, pathToItem, pathSet); + } else if (arg instanceof Integer) { + return castToAllowedTypes((Number) arg, pathToItem, pathSet); + } else if (arg instanceof Long) { + return castToAllowedTypes((Number) arg, pathToItem, pathSet); + } else if (arg instanceof Float) { + return castToAllowedTypes((Number) arg, pathToItem, pathSet); + } else if (arg instanceof Double) { + return castToAllowedTypes((Number) arg, pathToItem, pathSet); + } else if (arg instanceof List) { + return castToAllowedTypes((List) arg, pathToItem, pathSet); + } else if (arg instanceof ZonedDateTime) { + return castToAllowedTypes(arg.toString(), pathToItem, pathSet); + } else if (arg instanceof LocalDate) { + return castToAllowedTypes(arg.toString(), pathToItem, pathSet); + } else if (arg instanceof UUID) { + return castToAllowedTypes(arg.toString(), pathToItem, pathSet); + } else { + Class argClass = arg.getClass(); + throw new ValidationException("Invalid type passed in for input="+arg+" type="+argClass); + } + } + + public Nothing? getNewInstance(Nothing? arg, List pathToItem, PathToSchemasMap pathToSchemas) { + return arg; + } + + public boolean getNewInstance(boolean arg, List pathToItem, PathToSchemasMap pathToSchemas) { + return arg; + } + + public Number getNewInstance(Number arg, List pathToItem, PathToSchemasMap pathToSchemas) { + return arg; + } + + public String getNewInstance(String arg, List pathToItem, PathToSchemasMap pathToSchemas) { + return arg; + } + + 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); + pathToSchemasMap.update(otherPathToSchemas); + for (var schemas: pathToSchemasMap.values()) { + JsonSchema firstSchema = schemas.entrySet().iterator().next().getKey(); + schemas.clear(); + schemas.put(firstSchema, null); + } + pathSet.removeAll(pathToSchemasMap.keySet()); + if (!pathSet.isEmpty()) { + LinkedHashMap, Nothing?> unsetAnyTypeSchema = new LinkedHashMap<>(); + unsetAnyTypeSchema.put(UnsetAnyTypeJsonSchema.UnsetAnyTypeJsonSchema1.getInstance(), null); + for (List pathToItem: pathSet) { + pathToSchemasMap.put(pathToItem, unsetAnyTypeSchema); + } + } + return pathToSchemasMap; + } + + public static String getClass(@Nullable Object arg) { + if (arg == null) { + return Nothing?.class.getSimpleName(); + } else { + return arg.getClass().getSimpleName(); + } + } + // todo add bytes and FileIO +} \ No newline at end of file diff --git a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/schemas/validation/JsonSchemaFactory.kt b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/schemas/validation/JsonSchemaFactory.kt new file mode 100644 index 00000000000..24729ac172d --- /dev/null +++ b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/schemas/validation/JsonSchemaFactory.kt @@ -0,0 +1,32 @@ +package org.openapijsonschematools.client.schemas.validation; + +import org.checkerframework.checker.nullness.qual.NonNull; +import org.checkerframework.checker.nullness.qual.Nullable; + +import java.lang.reflect.InvocationTargetException; +import java.lang.reflect.Method; +import java.util.HashMap; +import java.util.Map; + + +public class JsonSchemaFactory { + static Map>, JsonSchema> classToInstance = new HashMap<>(); + + public static > V getInstance(Class schemaCls) { + @Nullable JsonSchema cacheInst = classToInstance.get(schemaCls); + if (cacheInst != null) { + assert schemaCls.isInstance(cacheInst); + return schemaCls.cast(cacheInst); + } + try { + Method method = schemaCls.getMethod("getInstance"); + @SuppressWarnings("nullness") @NonNull Object obj = method.invoke(null); + assert schemaCls.isInstance(obj); + V inst = schemaCls.cast(obj); + classToInstance.put(schemaCls, inst); + return inst; + } catch (NoSuchMethodException | IllegalAccessException | InvocationTargetException e) { + throw new RuntimeException(e); + } + } +} \ No newline at end of file diff --git a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/schemas/validation/JsonSchemaInfo.kt b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/schemas/validation/JsonSchemaInfo.kt new file mode 100644 index 00000000000..0a95fbbae6a --- /dev/null +++ b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/schemas/validation/JsonSchemaInfo.kt @@ -0,0 +1,210 @@ +package org.openapijsonschematools.client.schemas.validation; +import org.checkerframework.checker.nullness.qual.Nullable; + +import java.math.BigDecimal; +import java.util.List; +import java.util.Map; +import java.util.Set; +import java.util.regex.Pattern; + +public class JsonSchemaInfo { + public @Nullable Set> type = null; + public JsonSchemaInfo type(Set> type) { + this.type = type; + return this; + } + public @Nullable String format = null; + public JsonSchemaInfo format(String format) { + this.format = format; + return this; + } + public @Nullable Class> items = null; + public JsonSchemaInfo items(Class> items) { + this.items = items; + return this; + } + public @Nullable Map>> properties = null; + public JsonSchemaInfo properties(Map>> properties) { + this.properties = properties; + return this; + } + public @Nullable Set required = null; + public JsonSchemaInfo required(Set required) { + this.required = required; + return this; + } + public @Nullable Number exclusiveMaximum = null; + public JsonSchemaInfo exclusiveMaximum(Number exclusiveMaximum) { + this.exclusiveMaximum = exclusiveMaximum; + return this; + } + public @Nullable Number exclusiveMinimum = null; + public JsonSchemaInfo exclusiveMinimum(Number exclusiveMinimum) { + this.exclusiveMinimum = exclusiveMinimum; + return this; + } + public @Nullable Integer maxItems = null; + public JsonSchemaInfo maxItems(Integer maxItems) { + this.maxItems = maxItems; + return this; + } + public @Nullable Integer minItems = null; + public JsonSchemaInfo minItems(Integer minItems) { + this.minItems = minItems; + return this; + } + public @Nullable Integer maxLength = null; + public JsonSchemaInfo maxLength(Integer maxLength) { + this.maxLength = maxLength; + return this; + } + public @Nullable Integer minLength = null; + public JsonSchemaInfo minLength(Integer minLength) { + this.minLength = minLength; + return this; + } + public @Nullable Integer maxProperties = null; + public JsonSchemaInfo maxProperties(Integer maxProperties) { + this.maxProperties = maxProperties; + return this; + } + public @Nullable Integer minProperties = null; + public JsonSchemaInfo minProperties(Integer minProperties) { + this.minProperties = minProperties; + return this; + } + public @Nullable Number maximum = null; + public JsonSchemaInfo maximum(Number maximum) { + this.maximum = maximum; + return this; + } + public @Nullable Number minimum = null; + public JsonSchemaInfo minimum(Number minimum) { + this.minimum = minimum; + return this; + } + public @Nullable BigDecimal multipleOf = null; + public JsonSchemaInfo multipleOf(BigDecimal multipleOf) { + this.multipleOf = multipleOf; + return this; + } + public @Nullable Class> additionalProperties; + public JsonSchemaInfo additionalProperties(Class> additionalProperties) { + this.additionalProperties = additionalProperties; + return this; + } + public @Nullable List>> allOf = null; + public JsonSchemaInfo allOf(List>> allOf) { + this.allOf = allOf; + return this; + } + public @Nullable List>> anyOf = null; + public JsonSchemaInfo anyOf(List>> anyOf) { + this.anyOf = anyOf; + return this; + } + public @Nullable List>> oneOf = null; + public JsonSchemaInfo oneOf(List>> oneOf) { + this.oneOf = oneOf; + return this; + } + public @Nullable Class> not = null; + public JsonSchemaInfo not(Class> not) { + this.not = not; + return this; + } + public @Nullable Boolean uniqueItems = null; + public JsonSchemaInfo uniqueItems(Boolean uniqueItems) { + this.uniqueItems = uniqueItems; + return this; + } + public @Nullable Set<@Nullable Object> enumValues = null; + public JsonSchemaInfo enumValues(Set<@Nullable Object> enumValues) { + this.enumValues = enumValues; + return this; + } + public @Nullable Pattern pattern = null; + public JsonSchemaInfo pattern(Pattern pattern) { + this.pattern = pattern; + return this; + } + public @Nullable Object defaultValue = null; + public boolean defaultValueSet = false; + public JsonSchemaInfo defaultValue(@Nullable Object defaultValue) { + this.defaultValue = defaultValue; + this.defaultValueSet = true; + return this; + } + public @Nullable Object constValue = null; + public boolean constValueSet = false; + public JsonSchemaInfo constValue(@Nullable Object constValue) { + this.constValue = constValue; + this.constValueSet = true; + return this; + } + public @Nullable Class> contains = null; + public JsonSchemaInfo contains(Class> contains) { + this.contains = contains; + return this; + } + public @Nullable Integer maxContains = null; + public JsonSchemaInfo maxContains(Integer maxContains) { + this.maxContains = maxContains; + return this; + } + public @Nullable Integer minContains = null; + public JsonSchemaInfo minContains(Integer minContains) { + this.minContains = minContains; + return this; + } + public @Nullable Class> propertyNames = null; + public JsonSchemaInfo propertyNames(Class> propertyNames) { + this.propertyNames = propertyNames; + return this; + } + public @Nullable Map> dependentRequired = null; + public JsonSchemaInfo dependentRequired(Map> dependentRequired) { + this.dependentRequired = dependentRequired; + return this; + } + public @Nullable Map>> dependentSchemas = null; + public JsonSchemaInfo dependentSchemas(Map>> dependentSchemas) { + this.dependentSchemas = dependentSchemas; + return this; + } + public @Nullable Map>> patternProperties = null; + public JsonSchemaInfo patternProperties(Map>> patternProperties) { + this.patternProperties = patternProperties; + return this; + } + public @Nullable List>> prefixItems = null; + public JsonSchemaInfo prefixItems(List>> prefixItems) { + this.prefixItems = prefixItems; + return this; + } + public @Nullable Class> ifSchema = null; + public JsonSchemaInfo ifSchema(Class> ifSchema) { + this.ifSchema = ifSchema; + return this; + } + public @Nullable Class> then = null; + public JsonSchemaInfo then(Class> then) { + this.then = then; + return this; + } + public @Nullable Class> elseSchema = null; + public JsonSchemaInfo elseSchema(Class> elseSchema) { + this.elseSchema = elseSchema; + return this; + } + public @Nullable Class> unevaluatedItems = null; + public JsonSchemaInfo unevaluatedItems(Class> unevaluatedItems) { + this.unevaluatedItems = unevaluatedItems; + return this; + } + public @Nullable Class> unevaluatedProperties = null; + public JsonSchemaInfo unevaluatedProperties(Class> unevaluatedProperties) { + this.unevaluatedProperties = unevaluatedProperties; + return this; + } +} \ No newline at end of file diff --git a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/schemas/validation/KeywordEntry.kt b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/schemas/validation/KeywordEntry.kt new file mode 100644 index 00000000000..c00f0c4804e --- /dev/null +++ b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/schemas/validation/KeywordEntry.kt @@ -0,0 +1,10 @@ +package org.openapijsonschematools.client.schemas.validation; + +import java.util.AbstractMap; + +@SuppressWarnings("serial") +public class KeywordEntry extends AbstractMap.SimpleEntry { + public KeywordEntry(String key, KeywordValidator value) { + super(key, value); + } +} diff --git a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/schemas/validation/KeywordValidator.kt b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/schemas/validation/KeywordValidator.kt new file mode 100644 index 00000000000..8a2bd782505 --- /dev/null +++ b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/schemas/validation/KeywordValidator.kt @@ -0,0 +1,11 @@ +package org.openapijsonschematools.client.schemas.validation; + +import org.openapijsonschematools.client.exceptions.ValidationException; +import org.checkerframework.checker.nullness.qual.Nullable; + +@FunctionalInterface +public interface KeywordValidator { + @Nullable PathToSchemasMap validate( + ValidationData data + ) throws ValidationException; +} \ No newline at end of file diff --git a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/schemas/validation/LengthValidator.kt b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/schemas/validation/LengthValidator.kt new file mode 100644 index 00000000000..f99e359cab4 --- /dev/null +++ b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/schemas/validation/LengthValidator.kt @@ -0,0 +1,16 @@ +package org.openapijsonschematools.client.schemas.validation; + +import java.text.BreakIterator; + +public abstract class LengthValidator { + protected int getLength(String text) { + int graphemeCount = 0; + BreakIterator graphemeCounter = BreakIterator + .getCharacterInstance(); + graphemeCounter.setText(text); + while (graphemeCounter.next() != BreakIterator.DONE) { + graphemeCount++; + } + return graphemeCount; + } +} diff --git a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/schemas/validation/ListSchemaValidator.kt b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/schemas/validation/ListSchemaValidator.kt new file mode 100644 index 00000000000..a7752b37595 --- /dev/null +++ b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/schemas/validation/ListSchemaValidator.kt @@ -0,0 +1,12 @@ +package org.openapijsonschematools.client.schemas.validation; + +import org.openapijsonschematools.client.configurations.SchemaConfiguration; +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; +} \ No newline at end of file diff --git a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/schemas/validation/LongEnumValidator.kt b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/schemas/validation/LongEnumValidator.kt new file mode 100644 index 00000000000..6b6bcd88c47 --- /dev/null +++ b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/schemas/validation/LongEnumValidator.kt @@ -0,0 +1,8 @@ +package org.openapijsonschematools.client.schemas.validation; + +import org.openapijsonschematools.client.configurations.SchemaConfiguration; +import org.openapijsonschematools.client.exceptions.ValidationException; + +public interface LongEnumValidator { + long validate(EnumType arg, SchemaConfiguration configuration) throws ValidationException; +} \ No newline at end of file diff --git a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/schemas/validation/LongValueMethod.kt b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/schemas/validation/LongValueMethod.kt new file mode 100644 index 00000000000..866d0d3ed01 --- /dev/null +++ b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/schemas/validation/LongValueMethod.kt @@ -0,0 +1,5 @@ +package org.openapijsonschematools.client.schemas.validation; + +public interface LongValueMethod { + long value(); +} \ No newline at end of file diff --git a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/schemas/validation/MapSchemaValidator.kt b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/schemas/validation/MapSchemaValidator.kt new file mode 100644 index 00000000000..9bd7d432165 --- /dev/null +++ b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/schemas/validation/MapSchemaValidator.kt @@ -0,0 +1,13 @@ +package org.openapijsonschematools.client.schemas.validation; + +import org.openapijsonschematools.client.configurations.SchemaConfiguration; +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; +} \ No newline at end of file diff --git a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/schemas/validation/MapUtils.kt b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/schemas/validation/MapUtils.kt new file mode 100644 index 00000000000..122b3507936 --- /dev/null +++ b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/schemas/validation/MapUtils.kt @@ -0,0 +1,37 @@ +package org.openapijsonschematools.client.schemas.validation; + +import org.openapijsonschematools.client.exceptions.InvalidAdditionalPropertyException; + +import java.util.HashMap; +import java.util.Map; +import java.util.Set; + +public class MapUtils { + /** + * A builder for maps that allows in null values + * Schema tests + doc code samples need it + * @param entries items to add + * @return the output map + * @param key type + * @param value type + */ + @SafeVarargs + @SuppressWarnings("varargs") + public static Map makeMap(Map.Entry... entries) { + Map map = new HashMap<>(); + for (Map.Entry entry : entries) { + map.put(entry.getKey(), entry.getValue()); + } + return map; + } + + public static void throwIfKeyKnown(String key, Set knownKeys, boolean setting) throws InvalidAdditionalPropertyException { + if (knownKeys.contains(key)) { + String verb = "getting"; + if (setting) { + verb = "setting"; + } + throw new InvalidAdditionalPropertyException ("The known key " + key + " may not be passed in when "+verb+" an additional property"); + } + } +} \ No newline at end of file diff --git a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/schemas/validation/MaxContainsValidator.kt b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/schemas/validation/MaxContainsValidator.kt new file mode 100644 index 00000000000..315771b9e0c --- /dev/null +++ b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/schemas/validation/MaxContainsValidator.kt @@ -0,0 +1,32 @@ +package org.openapijsonschematools.client.schemas.validation; + +import org.checkerframework.checker.nullness.qual.Nullable; +import org.openapijsonschematools.client.exceptions.ValidationException; + +import java.util.List; + +public class MaxContainsValidator implements KeywordValidator { + @Override + public @Nullable PathToSchemasMap validate( + ValidationData data + ) throws ValidationException { + var maxContains = data.schema().maxContains; + if (maxContains == null) { + return null; + } + if (!(data.arg() instanceof List)) { + return null; + } + var containsPathToSchemas = data.containsPathToSchemas(); + if (containsPathToSchemas == null) { + return null; + } + if (containsPathToSchemas.size() > maxContains) { + throw new ValidationException( + "Validation failed for maxContains keyword in class="+data.schema().getClass()+ + " at pathToItem="+data.validationMetadata().pathToItem()+". Too many items validated to the contains schema." + ); + } + return null; + } +} \ No newline at end of file diff --git a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/schemas/validation/MaxItemsValidator.kt b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/schemas/validation/MaxItemsValidator.kt new file mode 100644 index 00000000000..2749843cbf2 --- /dev/null +++ b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/schemas/validation/MaxItemsValidator.kt @@ -0,0 +1,25 @@ +package org.openapijsonschematools.client.schemas.validation; + +import org.openapijsonschematools.client.exceptions.ValidationException; +import org.checkerframework.checker.nullness.qual.Nullable; + +import java.util.List; + +public class MaxItemsValidator implements KeywordValidator { + @Override + public @Nullable PathToSchemasMap validate( + ValidationData data + ) throws ValidationException { + var maxItems = data.schema().maxItems; + if (maxItems == null) { + return null; + } + if (!(data.arg() instanceof List listArg)) { + return null; + } + if (listArg.size() > maxItems) { + throw new ValidationException("Value " + listArg + " is invalid because has > the maxItems of " + maxItems); + } + return null; + } +} diff --git a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/schemas/validation/MaxLengthValidator.kt b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/schemas/validation/MaxLengthValidator.kt new file mode 100644 index 00000000000..f2a77fa91f6 --- /dev/null +++ b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/schemas/validation/MaxLengthValidator.kt @@ -0,0 +1,24 @@ +package org.openapijsonschematools.client.schemas.validation; + +import org.openapijsonschematools.client.exceptions.ValidationException; +import org.checkerframework.checker.nullness.qual.Nullable; + +public class MaxLengthValidator extends LengthValidator implements KeywordValidator { + @Override + public @Nullable PathToSchemasMap validate( + ValidationData data + ) throws ValidationException { + var maxLength = data.schema().maxLength; + if (maxLength == null) { + return null; + } + if (!(data.arg() instanceof String stringArg)) { + return null; + } + int length = getLength(stringArg); + if (length > maxLength) { + throw new ValidationException("Value " + stringArg + " is invalid because has > the maxLength of " + maxLength); + } + return null; + } +} diff --git a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/schemas/validation/MaxPropertiesValidator.kt b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/schemas/validation/MaxPropertiesValidator.kt new file mode 100644 index 00000000000..57a53e71be5 --- /dev/null +++ b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/schemas/validation/MaxPropertiesValidator.kt @@ -0,0 +1,25 @@ +package org.openapijsonschematools.client.schemas.validation; + +import org.openapijsonschematools.client.exceptions.ValidationException; +import org.checkerframework.checker.nullness.qual.Nullable; + +import java.util.Map; + +public class MaxPropertiesValidator implements KeywordValidator { + @Override + public @Nullable PathToSchemasMap validate( + ValidationData data + ) throws ValidationException { + var maxProperties = data.schema().maxProperties; + if (maxProperties == null) { + return null; + } + if (!(data.arg() instanceof Map mapArg)) { + return null; + } + if (mapArg.size() > maxProperties) { + throw new ValidationException("Value " + mapArg + " is invalid because has > the maxProperties of " + maxProperties); + } + return null; + } +} diff --git a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/schemas/validation/MaximumValidator.kt b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/schemas/validation/MaximumValidator.kt new file mode 100644 index 00000000000..df1c7f5c338 --- /dev/null +++ b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/schemas/validation/MaximumValidator.kt @@ -0,0 +1,45 @@ +package org.openapijsonschematools.client.schemas.validation; + +import org.openapijsonschematools.client.exceptions.ValidationException; +import org.checkerframework.checker.nullness.qual.Nullable; + +public class MaximumValidator implements KeywordValidator { + @Override + public @Nullable PathToSchemasMap validate( + ValidationData data + ) throws ValidationException { + var maximum = data.schema().maximum; + if (maximum == null) { + return null; + } + if (!(data.arg() instanceof Number)) { + return null; + } + String msg = "Value " + data.arg() + " is invalid because it is > the maximum of " + maximum; + if (data.arg() instanceof Integer intArg) { + if (intArg.compareTo(maximum.intValue()) > 0) { + throw new ValidationException(msg); + } + return null; + } + if (data.arg() instanceof Long longArg) { + if (longArg.compareTo(maximum.longValue()) > 0) { + throw new ValidationException(msg); + } + return null; + } + if (data.arg() instanceof Float floatArg) { + if (floatArg.compareTo(maximum.floatValue()) > 0) { + throw new ValidationException(msg); + } + return null; + } + if (data.arg() instanceof Double doubleArg) { + if (doubleArg.compareTo(maximum.doubleValue()) > 0) { + throw new ValidationException(msg); + } + return null; + } + return null; + } +} \ No newline at end of file diff --git a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/schemas/validation/MinContainsValidator.kt b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/schemas/validation/MinContainsValidator.kt new file mode 100644 index 00000000000..6ea4404dc1f --- /dev/null +++ b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/schemas/validation/MinContainsValidator.kt @@ -0,0 +1,31 @@ +package org.openapijsonschematools.client.schemas.validation; + +import org.checkerframework.checker.nullness.qual.Nullable; +import org.openapijsonschematools.client.exceptions.ValidationException; + +import java.util.List; + +public class MinContainsValidator implements KeywordValidator { + @Override + public @Nullable PathToSchemasMap validate( + ValidationData data + ) throws ValidationException { + var minContains = data.schema().minContains; + if (minContains == null) { + return null; + } + if (!(data.arg() instanceof List)) { + return null; + } + if (data.containsPathToSchemas() == null) { + return null; + } + if (data.containsPathToSchemas().size() < minContains) { + throw new ValidationException( + "Validation failed for minContains keyword in class="+data.schema().getClass()+ + " at pathToItem="+data.validationMetadata().pathToItem()+". Too few items validated to the contains schema." + ); + } + return null; + } +} \ No newline at end of file diff --git a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/schemas/validation/MinItemsValidator.kt b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/schemas/validation/MinItemsValidator.kt new file mode 100644 index 00000000000..25bae60bda7 --- /dev/null +++ b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/schemas/validation/MinItemsValidator.kt @@ -0,0 +1,25 @@ +package org.openapijsonschematools.client.schemas.validation; + +import org.openapijsonschematools.client.exceptions.ValidationException; +import org.checkerframework.checker.nullness.qual.Nullable; + +import java.util.List; + +public class MinItemsValidator implements KeywordValidator { + @Override + public @Nullable PathToSchemasMap validate( + ValidationData data + ) throws ValidationException { + var minItems = data.schema().minItems; + if (minItems == null) { + return null; + } + if (!(data.arg() instanceof List listArg)) { + return null; + } + if (listArg.size() < minItems) { + throw new ValidationException("Value " + listArg + " is invalid because has < the minItems of " + minItems); + } + return null; + } +} diff --git a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/schemas/validation/MinLengthValidator.kt b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/schemas/validation/MinLengthValidator.kt new file mode 100644 index 00000000000..f4639e8a207 --- /dev/null +++ b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/schemas/validation/MinLengthValidator.kt @@ -0,0 +1,24 @@ +package org.openapijsonschematools.client.schemas.validation; + +import org.openapijsonschematools.client.exceptions.ValidationException; +import org.checkerframework.checker.nullness.qual.Nullable; + +public class MinLengthValidator extends LengthValidator implements KeywordValidator { + @Override + public @Nullable PathToSchemasMap validate( + ValidationData data + ) throws ValidationException { + var minLength = data.schema().minLength; + if (minLength == null) { + return null; + } + if (!(data.arg() instanceof String stringArg)) { + return null; + } + int length = getLength(stringArg); + if (length < minLength) { + throw new ValidationException("Value " + stringArg + " is invalid because has < the minLength of " + minLength); + } + return null; + } +} \ No newline at end of file diff --git a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/schemas/validation/MinPropertiesValidator.kt b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/schemas/validation/MinPropertiesValidator.kt new file mode 100644 index 00000000000..011ac76dd31 --- /dev/null +++ b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/schemas/validation/MinPropertiesValidator.kt @@ -0,0 +1,25 @@ +package org.openapijsonschematools.client.schemas.validation; + +import org.openapijsonschematools.client.exceptions.ValidationException; +import org.checkerframework.checker.nullness.qual.Nullable; + +import java.util.Map; + +public class MinPropertiesValidator implements KeywordValidator { + @Override + public @Nullable PathToSchemasMap validate( + ValidationData data + ) throws ValidationException { + var minProperties = data.schema().minProperties; + if (minProperties == null) { + return null; + } + if (!(data.arg() instanceof Map mapArg)) { + return null; + } + if (mapArg.size() < minProperties) { + throw new ValidationException("Value " + mapArg + " is invalid because has < the minProperties of " + minProperties); + } + return null; + } +} diff --git a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/schemas/validation/MinimumValidator.kt b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/schemas/validation/MinimumValidator.kt new file mode 100644 index 00000000000..76065fe50b5 --- /dev/null +++ b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/schemas/validation/MinimumValidator.kt @@ -0,0 +1,45 @@ +package org.openapijsonschematools.client.schemas.validation; + +import org.openapijsonschematools.client.exceptions.ValidationException; +import org.checkerframework.checker.nullness.qual.Nullable; + +public class MinimumValidator implements KeywordValidator { + @Override + public @Nullable PathToSchemasMap validate( + ValidationData data + ) throws ValidationException { + var minimum = data.schema().minimum; + if (minimum == null) { + return null; + } + if (!(data.arg() instanceof Number)) { + return null; + } + String msg = "Value " + data.arg() + " is invalid because it is < the minimum of " + minimum; + if (data.arg() instanceof Integer intArg) { + if (intArg.compareTo(minimum.intValue()) < 0) { + throw new ValidationException(msg); + } + return null; + } + if (data.arg() instanceof Long longArg) { + if (longArg.compareTo(minimum.longValue()) < 0) { + throw new ValidationException(msg); + } + return null; + } + if (data.arg() instanceof Float floatArg) { + if (floatArg.compareTo(minimum.floatValue()) < 0) { + throw new ValidationException(msg); + } + return null; + } + if (data.arg() instanceof Double doubleArg) { + if (doubleArg.compareTo(minimum.doubleValue()) < 0) { + throw new ValidationException(msg); + } + return null; + } + return null; + } +} diff --git a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/schemas/validation/MultipleOfValidator.kt b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/schemas/validation/MultipleOfValidator.kt new file mode 100644 index 00000000000..d8273d04d9c --- /dev/null +++ b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/schemas/validation/MultipleOfValidator.kt @@ -0,0 +1,27 @@ +package org.openapijsonschematools.client.schemas.validation; + +import org.openapijsonschematools.client.exceptions.ValidationException; +import org.checkerframework.checker.nullness.qual.Nullable; + +import java.math.BigDecimal; + +public class MultipleOfValidator extends BigDecimalValidator implements KeywordValidator { + @Override + public @Nullable PathToSchemasMap validate( + ValidationData data + ) throws ValidationException { + var multipleOf = data.schema().multipleOf; + if (multipleOf == null) { + return null; + } + if (!(data.arg() instanceof Number numberArg)) { + return null; + } + BigDecimal castArg = getBigDecimal(numberArg); + String msg = "Value " + numberArg + " is invalid because it is not a multiple of " + multipleOf; + if (castArg.remainder(multipleOf).compareTo(BigDecimal.ZERO) != 0) { + throw new ValidationException(msg); + } + return null; + } +} \ No newline at end of file diff --git a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/schemas/validation/NotValidator.kt b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/schemas/validation/NotValidator.kt new file mode 100644 index 00000000000..3e6b8e91e7c --- /dev/null +++ b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/schemas/validation/NotValidator.kt @@ -0,0 +1,30 @@ +package org.openapijsonschematools.client.schemas.validation; + +import org.openapijsonschematools.client.exceptions.ValidationException; +import org.checkerframework.checker.nullness.qual.Nullable; + +public class NotValidator implements KeywordValidator { + @Override + public @Nullable PathToSchemasMap validate( + ValidationData data + ) throws ValidationException { + var not = data.schema().not; + if (not == null) { + return null; + } + PathToSchemasMap pathToSchemas; + try { + JsonSchema notSchema = JsonSchemaFactory.getInstance(not); + pathToSchemas = JsonSchema.validate(notSchema, data.arg(), data.validationMetadata()); + } catch (ValidationException e) { + return null; + } + if (!pathToSchemas.isEmpty()) { + throw new ValidationException( + "Invalid value "+data.arg()+" was passed in to "+data.schema().getClass()+". "+ + "Value is invalid because it is disallowed by not "+not + ); + } + return null; + } +} diff --git a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/schemas/validation/NullEnumValidator.kt b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/schemas/validation/NullEnumValidator.kt new file mode 100644 index 00000000000..56cfc56c127 --- /dev/null +++ b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/schemas/validation/NullEnumValidator.kt @@ -0,0 +1,8 @@ +package org.openapijsonschematools.client.schemas.validation; + +import org.openapijsonschematools.client.configurations.SchemaConfiguration; +import org.openapijsonschematools.client.exceptions.ValidationException; + +public interface NullEnumValidator { + Nothing? validate(EnumType arg, SchemaConfiguration configuration) throws ValidationException; +} \ No newline at end of file diff --git a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/schemas/validation/NullSchemaValidator.kt b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/schemas/validation/NullSchemaValidator.kt new file mode 100644 index 00000000000..b06d8285e01 --- /dev/null +++ b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/schemas/validation/NullSchemaValidator.kt @@ -0,0 +1,9 @@ +package org.openapijsonschematools.client.schemas.validation; + +import org.openapijsonschematools.client.configurations.SchemaConfiguration; +import org.openapijsonschematools.client.exceptions.ValidationException; + +public interface NullSchemaValidator { + Nothing? validate(Nothing? arg, SchemaConfiguration configuration) throws ValidationException; + T validateAndBox(Nothing? arg, SchemaConfiguration configuration) throws ValidationException; +} \ No newline at end of file diff --git a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/schemas/validation/NullValueMethod.kt b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/schemas/validation/NullValueMethod.kt new file mode 100644 index 00000000000..dc704b437e9 --- /dev/null +++ b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/schemas/validation/NullValueMethod.kt @@ -0,0 +1,5 @@ +package org.openapijsonschematools.client.schemas.validation; + +public interface NullValueMethod { + Nothing? value(); +} \ No newline at end of file diff --git a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/schemas/validation/NumberSchemaValidator.kt b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/schemas/validation/NumberSchemaValidator.kt new file mode 100644 index 00000000000..dd3c349ad69 --- /dev/null +++ b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/schemas/validation/NumberSchemaValidator.kt @@ -0,0 +1,9 @@ +package org.openapijsonschematools.client.schemas.validation; + +import org.openapijsonschematools.client.configurations.SchemaConfiguration; +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; +} \ No newline at end of file diff --git a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/schemas/validation/OneOfValidator.kt b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/schemas/validation/OneOfValidator.kt new file mode 100644 index 00000000000..7dd5f4128ac --- /dev/null +++ b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/schemas/validation/OneOfValidator.kt @@ -0,0 +1,50 @@ +package org.openapijsonschematools.client.schemas.validation; + +import org.openapijsonschematools.client.exceptions.ValidationException; +import org.checkerframework.checker.nullness.qual.Nullable; + +import java.util.ArrayList; +import java.util.List; + +public class OneOfValidator implements KeywordValidator { + @Override + public @Nullable PathToSchemasMap validate( + ValidationData data + ) throws ValidationException { + var oneOf = data.schema().oneOf; + if (oneOf == null) { + return null; + } + PathToSchemasMap pathToSchemas = new PathToSchemasMap(); + List>> validatedOneOfClasses = new ArrayList<>(); + for(Class> oneOfClass: oneOf) { + if (oneOfClass == data.schema().getClass()) { + /* + optimistically assume that schema will pass validation + do not invoke validate on it because that is recursive + */ + validatedOneOfClasses.add(oneOfClass); + continue; + } + try { + JsonSchema oneOfSchema = JsonSchemaFactory.getInstance(oneOfClass); + PathToSchemasMap otherPathToSchemas = JsonSchema.validate(oneOfSchema, data.arg(), data.validationMetadata()); + validatedOneOfClasses.add(oneOfClass); + pathToSchemas.update(otherPathToSchemas); + } catch (ValidationException e) { + // silence exceptions because the code needs to accumulate validatedOneOfClasses + } + } + if (validatedOneOfClasses.isEmpty()) { + throw new ValidationException("Invalid inputs given to generate an instance of "+data.schema().getClass()+". None "+ + "of the oneOf schemas matched the input data." + ); + } + if (validatedOneOfClasses.size() > 1) { + throw new ValidationException("Invalid inputs given to generate an instance of "+data.schema().getClass()+". Multiple "+ + "oneOf schemas validated the data, but a max of one is allowed." + ); + } + return pathToSchemas; + } +} diff --git a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/schemas/validation/PathToSchemasMap.kt b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/schemas/validation/PathToSchemasMap.kt new file mode 100644 index 00000000000..6e12d851bff --- /dev/null +++ b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/schemas/validation/PathToSchemasMap.kt @@ -0,0 +1,21 @@ +package org.openapijsonschematools.client.schemas.validation; + +import java.util.LinkedHashMap; +import java.util.List; +import java.util.Map; + +@SuppressWarnings("serial") +public class PathToSchemasMap extends LinkedHashMap, LinkedHashMap, Nothing?>> { + + public void update(PathToSchemasMap other) { + for (Map.Entry, LinkedHashMap, Nothing?>> entry: other.entrySet()) { + List pathToItem = entry.getKey(); + LinkedHashMap, Nothing?> otherSchemas = entry.getValue(); + if (containsKey(pathToItem)) { + get(pathToItem).putAll(otherSchemas); + } else { + put(pathToItem, otherSchemas); + } + } + } +} \ No newline at end of file diff --git a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/schemas/validation/PatternPropertiesValidator.kt b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/schemas/validation/PatternPropertiesValidator.kt new file mode 100644 index 00000000000..9e951e23ed2 --- /dev/null +++ b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/schemas/validation/PatternPropertiesValidator.kt @@ -0,0 +1,21 @@ +package org.openapijsonschematools.client.schemas.validation; + +import org.checkerframework.checker.nullness.qual.Nullable; + +import java.util.Map; + +public class PatternPropertiesValidator implements KeywordValidator { + @Override + public @Nullable PathToSchemasMap validate( + ValidationData data + ) { + var patternProperties = data.schema().patternProperties; + if (patternProperties == null) { + return null; + } + if (!(data.arg() instanceof Map)) { + return null; + } + return data.patternPropertiesPathToSchemas(); + } +} diff --git a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/schemas/validation/PatternValidator.kt b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/schemas/validation/PatternValidator.kt new file mode 100644 index 00000000000..d7eebd78098 --- /dev/null +++ b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/schemas/validation/PatternValidator.kt @@ -0,0 +1,23 @@ +package org.openapijsonschematools.client.schemas.validation; + +import org.openapijsonschematools.client.exceptions.ValidationException; +import org.checkerframework.checker.nullness.qual.Nullable; + +public class PatternValidator implements KeywordValidator { + @Override + public @Nullable PathToSchemasMap validate( + ValidationData data + ) throws ValidationException { + var pattern = data.schema().pattern; + if (pattern == null) { + return null; + } + if (!(data.arg() instanceof String stringArg)) { + return null; + } + if (!pattern.matcher(stringArg).find()) { + throw new ValidationException("Invalid value "+stringArg+" did not find a match for pattern "+pattern); + } + return null; + } +} \ No newline at end of file diff --git a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/schemas/validation/PrefixItemsValidator.kt b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/schemas/validation/PrefixItemsValidator.kt new file mode 100644 index 00000000000..510f3a8760e --- /dev/null +++ b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/schemas/validation/PrefixItemsValidator.kt @@ -0,0 +1,41 @@ +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; + +public class PrefixItemsValidator implements KeywordValidator { + @Override + public @Nullable PathToSchemasMap validate( + ValidationData data + ) throws ValidationException { + var prefixItems = data.schema().prefixItems; + if (prefixItems == null) { + return null; + } + if (!(data.arg() instanceof List listArg)) { + return null; + } + if (listArg.isEmpty()) { + return null; + } + PathToSchemasMap pathToSchemas = new PathToSchemasMap(); + int maxIndex = Math.min(listArg.size(), prefixItems.size()); + for (int i=0; i < maxIndex; i++) { + List itemPathToItem = new ArrayList<>(data.validationMetadata().pathToItem()); + itemPathToItem.add(i); + ValidationMetadata itemValidationMetadata = new ValidationMetadata( + itemPathToItem, + data.validationMetadata().configuration(), + data.validationMetadata().validatedPathToSchemas(), + data.validationMetadata().seenClasses() + ); + JsonSchema itemsSchema = JsonSchemaFactory.getInstance(prefixItems.get(i)); + PathToSchemasMap otherPathToSchemas = JsonSchema.validate(itemsSchema, listArg.get(i), itemValidationMetadata); + pathToSchemas.update(otherPathToSchemas); + } + return pathToSchemas; + } +} diff --git a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/schemas/validation/PropertiesValidator.kt b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/schemas/validation/PropertiesValidator.kt new file mode 100644 index 00000000000..8803b661fd6 --- /dev/null +++ b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/schemas/validation/PropertiesValidator.kt @@ -0,0 +1,56 @@ +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; +import java.util.List; +import java.util.Map; +import java.util.Set; + +public class PropertiesValidator implements KeywordValidator { + @Override + public @Nullable PathToSchemasMap validate( + ValidationData data + ) throws ValidationException { + var properties = data.schema().properties; + if (properties == null) { + return null; + } + if (!(data.arg() instanceof Map mapArg)) { + return null; + } + PathToSchemasMap pathToSchemas = new PathToSchemasMap(); + Set presentProperties = new LinkedHashSet<>(); + for (Object key: mapArg.keySet()) { + if (key instanceof String) { + presentProperties.add((String) key); + } + } + for(Map.Entry>> entry: properties.entrySet()) { + String propName = entry.getKey(); + if (!presentProperties.contains(propName)) { + continue; + } + @Nullable Object propValue = mapArg.get(propName); + List propPathToItem = new ArrayList<>(data.validationMetadata().pathToItem()); + propPathToItem.add(propName); + ValidationMetadata propValidationMetadata = new ValidationMetadata( + propPathToItem, + data.validationMetadata().configuration(), + data.validationMetadata().validatedPathToSchemas(), + data.validationMetadata().seenClasses() + ); + Class> propClass = entry.getValue(); + JsonSchema propSchema = JsonSchemaFactory.getInstance(propClass); + if (propValidationMetadata.validationRanEarlier(propSchema)) { + // todo add_deeper_validated_schemas + continue; + } + PathToSchemasMap otherPathToSchemas = JsonSchema.validate(propSchema, propValue, propValidationMetadata); + pathToSchemas.update(otherPathToSchemas); + } + return pathToSchemas; + } +} diff --git a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/schemas/validation/PropertyEntry.kt b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/schemas/validation/PropertyEntry.kt new file mode 100644 index 00000000000..8261eda6d49 --- /dev/null +++ b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/schemas/validation/PropertyEntry.kt @@ -0,0 +1,10 @@ +package org.openapijsonschematools.client.schemas.validation; + +import java.util.AbstractMap; + +@SuppressWarnings("serial") +public class PropertyEntry extends AbstractMap.SimpleEntry>> { + public PropertyEntry(String key, Class> value) { + super(key, value); + } +} \ No newline at end of file diff --git a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/schemas/validation/PropertyNamesValidator.kt b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/schemas/validation/PropertyNamesValidator.kt new file mode 100644 index 00000000000..0169ff5bdba --- /dev/null +++ b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/schemas/validation/PropertyNamesValidator.kt @@ -0,0 +1,38 @@ +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; +import java.util.Map; + +public class PropertyNamesValidator implements KeywordValidator { + @Override + public @Nullable PathToSchemasMap validate( + ValidationData data + ) throws ValidationException { + var propertyNames = data.schema().propertyNames; + if (propertyNames == null) { + return null; + } + if (!(data.arg() instanceof Map mapArg)) { + return null; + } + JsonSchema propertyNamesSchema = JsonSchemaFactory.getInstance(propertyNames); + for (Object objKey: mapArg.keySet()) { + if (objKey instanceof String key) { + List propPathToItem = new ArrayList<>(data.validationMetadata().pathToItem()); + propPathToItem.add(key); + ValidationMetadata keyValidationMetadata = new ValidationMetadata( + propPathToItem, + data.validationMetadata().configuration(), + data.validationMetadata().validatedPathToSchemas(), + data.validationMetadata().seenClasses() + ); + JsonSchema.validate(propertyNamesSchema, key, keyValidationMetadata); + } + } + return null; + } +} diff --git a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/schemas/validation/RequiredValidator.kt b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/schemas/validation/RequiredValidator.kt new file mode 100644 index 00000000000..2519cbcfd3b --- /dev/null +++ b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/schemas/validation/RequiredValidator.kt @@ -0,0 +1,41 @@ +package org.openapijsonschematools.client.schemas.validation; + +import org.checkerframework.checker.nullness.qual.Nullable; +import org.openapijsonschematools.client.exceptions.ValidationException; + +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; + +public class RequiredValidator implements KeywordValidator { + @Override + public @Nullable PathToSchemasMap validate( + ValidationData data + ) throws ValidationException { + var required = data.schema().required; + if (required == null) { + return null; + } + if (!(data.arg() instanceof Map mapArg)) { + return null; + } + Set missingRequiredProperties = new HashSet<>(required); + for (Object key: mapArg.keySet()) { + if (key instanceof String) { + missingRequiredProperties.remove(key); + } + } + if (!missingRequiredProperties.isEmpty()) { + List missingReqProps = missingRequiredProperties.stream().sorted().toList(); + String pluralChar = ""; + if (missingRequiredProperties.size() > 1) { + pluralChar = "s"; + } + throw new ValidationException( + data.schema().getClass()+" is missing "+missingRequiredProperties.size()+" required argument"+pluralChar+": "+missingReqProps + ); + } + return null; + } +} diff --git a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/schemas/validation/StringEnumValidator.kt b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/schemas/validation/StringEnumValidator.kt new file mode 100644 index 00000000000..baf86081fd7 --- /dev/null +++ b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/schemas/validation/StringEnumValidator.kt @@ -0,0 +1,8 @@ +package org.openapijsonschematools.client.schemas.validation; + +import org.openapijsonschematools.client.configurations.SchemaConfiguration; +import org.openapijsonschematools.client.exceptions.ValidationException; + +public interface StringEnumValidator { + String validate(EnumType arg, SchemaConfiguration configuration) throws ValidationException; +} \ No newline at end of file diff --git a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/schemas/validation/StringSchemaValidator.kt b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/schemas/validation/StringSchemaValidator.kt new file mode 100644 index 00000000000..e6729893fca --- /dev/null +++ b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/schemas/validation/StringSchemaValidator.kt @@ -0,0 +1,9 @@ +package org.openapijsonschematools.client.schemas.validation; + +import org.openapijsonschematools.client.configurations.SchemaConfiguration; +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; +} \ No newline at end of file diff --git a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/schemas/validation/StringValueMethod.kt b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/schemas/validation/StringValueMethod.kt new file mode 100644 index 00000000000..c038476947f --- /dev/null +++ b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/schemas/validation/StringValueMethod.kt @@ -0,0 +1,5 @@ +package org.openapijsonschematools.client.schemas.validation; + +public interface StringValueMethod { + String value(); +} \ No newline at end of file diff --git a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/schemas/validation/ThenValidator.kt b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/schemas/validation/ThenValidator.kt new file mode 100644 index 00000000000..75c083e2edc --- /dev/null +++ b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/schemas/validation/ThenValidator.kt @@ -0,0 +1,32 @@ +package org.openapijsonschematools.client.schemas.validation; + +import org.checkerframework.checker.nullness.qual.Nullable; +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; + } + var ifPathToSchemas = data.ifPathToSchemas(); + if (ifPathToSchemas == null) { + // if unset + return null; + } + if (ifPathToSchemas.isEmpty()) { + // if validation is false + return null; + } + JsonSchema thenSchema = JsonSchemaFactory.getInstance(then); + PathToSchemasMap pathToSchemas = new PathToSchemasMap(); + var thenPathToSchemas = JsonSchema.validate(thenSchema, data.arg(), data.validationMetadata()); + // todo capture validation error and describe it as an then error? + pathToSchemas.update(ifPathToSchemas); + pathToSchemas.update(thenPathToSchemas); + return pathToSchemas; + } +} diff --git a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/schemas/validation/TypeValidator.kt b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/schemas/validation/TypeValidator.kt new file mode 100644 index 00000000000..2bc9cd05e10 --- /dev/null +++ b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/schemas/validation/TypeValidator.kt @@ -0,0 +1,34 @@ +package org.openapijsonschematools.client.schemas.validation; + +import org.checkerframework.checker.nullness.qual.Nullable; +import org.openapijsonschematools.client.exceptions.ValidationException; + +import java.util.List; +import java.util.Map; + +public class TypeValidator implements KeywordValidator { + @Override + public @Nullable PathToSchemasMap validate( + ValidationData data + ) throws ValidationException { + var type = data.schema().type; + if (type == null) { + return null; + } + Class argClass; + var arg = data.arg(); + if (arg == null) { + argClass = Nothing?.class; + } else if (arg instanceof List) { + argClass = List.class; + } else if (arg instanceof Map) { + argClass = Map.class; + } else { + argClass = arg.getClass(); + } + if (!type.contains(argClass)) { + throw new ValidationException("invalid type"); + } + return null; + } +} diff --git a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/schemas/validation/UnevaluatedItemsValidator.kt b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/schemas/validation/UnevaluatedItemsValidator.kt new file mode 100644 index 00000000000..407904da444 --- /dev/null +++ b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/schemas/validation/UnevaluatedItemsValidator.kt @@ -0,0 +1,52 @@ +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; + +public class UnevaluatedItemsValidator implements KeywordValidator { + @Override + public @Nullable PathToSchemasMap validate( + ValidationData data + ) throws ValidationException { + var unevaluatedItems = data.schema().unevaluatedItems; + if (unevaluatedItems == null) { + return null; + } + var knownPathToSchemas = data.knownPathToSchemas(); + if (knownPathToSchemas == null) { + return null; + } + if (!(data.arg() instanceof List listArg)) { + return null; + } + if (listArg.isEmpty()) { + return null; + } + PathToSchemasMap pathToSchemas = new PathToSchemasMap(); + int minIndex = data.schema().prefixItems != null ? data.schema().prefixItems.size() : 0; + JsonSchema unevaluatedItemsSchema = JsonSchemaFactory.getInstance(unevaluatedItems); + for(int i = minIndex; i < listArg.size(); i++) { + List itemPathToItem = new ArrayList<>(data.validationMetadata().pathToItem()); + itemPathToItem.add(i); + if (knownPathToSchemas.containsKey(itemPathToItem)) { + continue; + } + ValidationMetadata itemValidationMetadata = new ValidationMetadata( + itemPathToItem, + data.validationMetadata().configuration(), + data.validationMetadata().validatedPathToSchemas(), + data.validationMetadata().seenClasses() + ); + if (itemValidationMetadata.validationRanEarlier(unevaluatedItemsSchema)) { + // todo add_deeper_validated_schemas + continue; + } + PathToSchemasMap otherPathToSchemas = JsonSchema.validate(unevaluatedItemsSchema, listArg.get(i), itemValidationMetadata); + pathToSchemas.update(otherPathToSchemas); + } + return pathToSchemas; + } +} diff --git a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/schemas/validation/UnevaluatedPropertiesValidator.kt b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/schemas/validation/UnevaluatedPropertiesValidator.kt new file mode 100644 index 00000000000..8fd34950404 --- /dev/null +++ b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/schemas/validation/UnevaluatedPropertiesValidator.kt @@ -0,0 +1,49 @@ +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; +import java.util.Map; + +public class UnevaluatedPropertiesValidator implements KeywordValidator { + @Override + public @Nullable PathToSchemasMap validate( + ValidationData data + ) throws ValidationException { + var unevaluatedProperties = data.schema().unevaluatedProperties; + if (unevaluatedProperties == null) { + return null; + } + var knownPathToSchemas = data.knownPathToSchemas(); + if (knownPathToSchemas == null) { + return null; + } + if (!(data.arg() instanceof Map mapArg)) { + return null; + } + PathToSchemasMap pathToSchemas = new PathToSchemasMap(); + 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"); + } + List propPathToItem = new ArrayList<>(data.validationMetadata().pathToItem()); + propPathToItem.add(propName); + if (knownPathToSchemas.containsKey(propPathToItem)) { + continue; + } + @Nullable Object propValue = mapArg.get(propName); + ValidationMetadata propValidationMetadata = new ValidationMetadata( + propPathToItem, + data.validationMetadata().configuration(), + data.validationMetadata().validatedPathToSchemas(), + data.validationMetadata().seenClasses() + ); + PathToSchemasMap otherPathToSchemas = JsonSchema.validate(unevaluatedPropertiesSchema, propValue, propValidationMetadata); + pathToSchemas.update(otherPathToSchemas); + } + return pathToSchemas; + } +} \ No newline at end of file diff --git a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/schemas/validation/UniqueItemsValidator.kt b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/schemas/validation/UniqueItemsValidator.kt new file mode 100644 index 00000000000..6b40ba79fff --- /dev/null +++ b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/schemas/validation/UniqueItemsValidator.kt @@ -0,0 +1,35 @@ +package org.openapijsonschematools.client.schemas.validation; + +import org.checkerframework.checker.nullness.qual.Nullable; +import org.openapijsonschematools.client.exceptions.ValidationException; + +import java.util.HashSet; +import java.util.List; +import java.util.Set; + +public class UniqueItemsValidator implements KeywordValidator { + @Override + public @Nullable PathToSchemasMap validate( + ValidationData data + ) throws ValidationException { + var uniqueItems = data.schema().uniqueItems; + if (uniqueItems == null) { + return null; + } + if (!(data.arg() instanceof List listArg)) { + return null; + } + if (!uniqueItems) { + return null; + } + Set<@Nullable Object> seenItems = new HashSet<>(); + for (@Nullable Object item: listArg) { + int startingSeenItemsSize = seenItems.size(); + seenItems.add(item); + if (seenItems.size() == startingSeenItemsSize) { + throw new ValidationException("Invalid list value, list contains duplicate items when uniqueItems is true"); + } + } + return null; + } +} diff --git a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/schemas/validation/UnsetAnyTypeJsonSchema.kt b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/schemas/validation/UnsetAnyTypeJsonSchema.kt new file mode 100644 index 00000000000..4e1b3500a04 --- /dev/null +++ b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/schemas/validation/UnsetAnyTypeJsonSchema.kt @@ -0,0 +1,302 @@ +package org.openapijsonschematools.client.schemas.validation; + +import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags; +import org.openapijsonschematools.client.configurations.SchemaConfiguration; +import org.openapijsonschematools.client.exceptions.ValidationException; +import org.checkerframework.checker.nullness.qual.Nullable; + +import java.time.LocalDate; +import java.time.ZonedDateTime; +import java.util.LinkedHashMap; +import java.util.List; +import java.util.HashSet; +import java.util.ArrayList; +import java.util.LinkedHashSet; +import java.util.Set; +import java.util.Map; +import java.util.Objects; +import java.util.UUID; + +public class UnsetAnyTypeJsonSchema { + public sealed interface UnsetAnyTypeJsonSchema1Boxed permits UnsetAnyTypeJsonSchema1BoxedVoid, UnsetAnyTypeJsonSchema1BoxedBoolean, UnsetAnyTypeJsonSchema1BoxedNumber, UnsetAnyTypeJsonSchema1BoxedString, UnsetAnyTypeJsonSchema1BoxedList, UnsetAnyTypeJsonSchema1BoxedMap { + @Nullable Object getData(); + } + public record UnsetAnyTypeJsonSchema1BoxedVoid(Nothing? data) implements UnsetAnyTypeJsonSchema1Boxed { + @Override + public @Nullable Object getData() { + return data; + } + } + public record UnsetAnyTypeJsonSchema1BoxedBoolean(boolean data) implements UnsetAnyTypeJsonSchema1Boxed { + @Override + public @Nullable Object getData() { + return data; + } + } + public record UnsetAnyTypeJsonSchema1BoxedNumber(Number data) implements UnsetAnyTypeJsonSchema1Boxed { + @Override + public @Nullable Object getData() { + return data; + } + } + public record UnsetAnyTypeJsonSchema1BoxedString(String data) implements UnsetAnyTypeJsonSchema1Boxed { + @Override + public @Nullable Object getData() { + return data; + } + } + public record UnsetAnyTypeJsonSchema1BoxedList(FrozenList<@Nullable Object> data) implements UnsetAnyTypeJsonSchema1Boxed { + @Override + public @Nullable Object getData() { + return data; + } + } + public record UnsetAnyTypeJsonSchema1BoxedMap(FrozenMap<@Nullable Object> data) implements UnsetAnyTypeJsonSchema1Boxed { + @Override + public @Nullable Object getData() { + return data; + } + } + public static class UnsetAnyTypeJsonSchema1 extends JsonSchema implements NullSchemaValidator, BooleanSchemaValidator, NumberSchemaValidator, StringSchemaValidator, ListSchemaValidator, UnsetAnyTypeJsonSchema1BoxedList>, MapSchemaValidator, UnsetAnyTypeJsonSchema1BoxedMap> { + private static @Nullable UnsetAnyTypeJsonSchema1 instance = null; + + protected UnsetAnyTypeJsonSchema1() { + super(new JsonSchemaInfo()); + } + + public static UnsetAnyTypeJsonSchema1 getInstance() { + if (instance == null) { + instance = new UnsetAnyTypeJsonSchema1(); + } + return instance; + } + + @Override + public Nothing? validate(Nothing? arg, SchemaConfiguration configuration) throws ValidationException { + Set> pathSet = new HashSet<>(); + List pathToItem = List.of("args[0]"); + Nothing? castArg = castToAllowedTypes(arg, pathToItem, pathSet); + SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().build())); + PathToSchemasMap validatedPathToSchemas = new PathToSchemasMap(); + ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, new LinkedHashSet<>()); + PathToSchemasMap pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet); + return getNewInstance(castArg, validationMetadata.pathToItem(), pathToSchemasMap); + } + + @Override + public boolean validate(boolean arg, SchemaConfiguration configuration) throws ValidationException { + Set> pathSet = new HashSet<>(); + List pathToItem = List.of("args[0]"); + boolean castArg = castToAllowedTypes(arg, pathToItem, pathSet); + SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().build())); + PathToSchemasMap validatedPathToSchemas = new PathToSchemasMap(); + ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, new LinkedHashSet<>()); + PathToSchemasMap pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet); + return getNewInstance(castArg, validationMetadata.pathToItem(), pathToSchemasMap); + } + + @Override + public Number validate(Number arg, SchemaConfiguration configuration) throws ValidationException { + Set> pathSet = new HashSet<>(); + List pathToItem = List.of("args[0]"); + Number castArg = castToAllowedTypes(arg, pathToItem, pathSet); + SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().build())); + PathToSchemasMap validatedPathToSchemas = new PathToSchemasMap(); + ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, new LinkedHashSet<>()); + PathToSchemasMap pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet); + return getNewInstance(castArg, validationMetadata.pathToItem(), pathToSchemasMap); + } + + public int validate(int arg, SchemaConfiguration configuration) throws ValidationException { + return (int) validate((Number) arg, configuration); + } + + public long validate(long arg, SchemaConfiguration configuration) throws ValidationException { + return (long) validate((Number) arg, configuration); + } + + public float validate(float arg, SchemaConfiguration configuration) throws ValidationException { + return (float) validate((Number) arg, configuration); + } + + public double validate(double arg, SchemaConfiguration configuration) throws ValidationException { + return (double) validate((Number) arg, configuration); + } + + @Override + public String validate(String arg, SchemaConfiguration configuration) throws ValidationException { + Set> pathSet = new HashSet<>(); + List pathToItem = List.of("args[0]"); + String castArg = castToAllowedTypes(arg, pathToItem, pathSet); + SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().build())); + PathToSchemasMap validatedPathToSchemas = new PathToSchemasMap(); + ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, new LinkedHashSet<>()); + PathToSchemasMap pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet); + return getNewInstance(castArg, validationMetadata.pathToItem(), pathToSchemasMap); + } + + public String validate(LocalDate arg, SchemaConfiguration configuration) throws ValidationException { + return validate(arg.toString(), configuration); + } + + public String validate(ZonedDateTime arg, SchemaConfiguration configuration) throws ValidationException { + return validate(arg.toString(), configuration); + } + + public String validate(UUID arg, SchemaConfiguration configuration) throws ValidationException { + return validate(arg.toString(), configuration); + } + + @Override + public FrozenList<@Nullable Object> getNewInstance(List arg, List pathToItem, PathToSchemasMap pathToSchemas) { + List<@Nullable Object> items = new ArrayList<>(); + int i = 0; + for (Object item: arg) { + List itemPathToItem = new ArrayList<>(pathToItem); + itemPathToItem.add(i); + LinkedHashMap, Nothing?> schemas = pathToSchemas.get(itemPathToItem); + if (schemas == null) { + 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); + items.add(castItem); + i += 1; + } + return new FrozenList<>(items); + } + + 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); + SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().build())); + PathToSchemasMap validatedPathToSchemas = new PathToSchemasMap(); + ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, new LinkedHashSet<>()); + PathToSchemasMap pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet); + return getNewInstance(castArg, validationMetadata.pathToItem(), pathToSchemasMap); + } + + @Override + 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 RuntimeException("Invalid non-string key value"); + } + String propertyName = (String) entryKey; + List propertyPathToItem = new ArrayList<>(pathToItem); + propertyPathToItem.add(propertyName); + Object value = entry.getValue(); + LinkedHashMap, Nothing?> schemas = pathToSchemas.get(propertyPathToItem); + if (schemas == null) { + 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); + properties.put(propertyName, castValue); + } + return new FrozenMap<>(properties); + } + + public FrozenMap<@Nullable Object> validate(Map arg, SchemaConfiguration configuration) throws ValidationException { + Set> pathSet = new HashSet<>(); + List pathToItem = List.of("args[0]"); + Map castArg = castToAllowedTypes(arg, pathToItem, pathSet); + SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().build())); + PathToSchemasMap validatedPathToSchemas = new PathToSchemasMap(); + ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, new LinkedHashSet<>()); + PathToSchemasMap pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet); + return getNewInstance(castArg, validationMetadata.pathToItem(), pathToSchemasMap); + } + + @Override + public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { + if (arg == null) { + return getNewInstance((Nothing?) null, pathToItem, pathToSchemas); + } else if (arg instanceof Boolean) { + boolean boolArg = (Boolean) arg; + return getNewInstance(boolArg, pathToItem, pathToSchemas); + } else if (arg instanceof Number) { + return getNewInstance((Number) arg, pathToItem, pathToSchemas); + } else if (arg instanceof String) { + return getNewInstance((String) arg, pathToItem, pathToSchemas); + } else if (arg instanceof List) { + return getNewInstance((List) arg, 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"); + } + + @Override + public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { + if (arg == null) { + return validate((Nothing?) null, configuration); + } else if (arg instanceof Boolean) { + boolean boolArg = (Boolean) arg; + return validate(boolArg, configuration); + } else if (arg instanceof Number) { + return validate((Number) arg, configuration); + } else if (arg instanceof String) { + return validate((String) arg, configuration); + } else if (arg instanceof List) { + return validate((List) arg, 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"); + } + + @Override + public UnsetAnyTypeJsonSchema1BoxedVoid validateAndBox(Nothing? arg, SchemaConfiguration configuration) throws ValidationException { + return new UnsetAnyTypeJsonSchema1BoxedVoid(validate(arg, configuration)); + } + + @Override + 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 { + return new UnsetAnyTypeJsonSchema1BoxedNumber(validate(arg, configuration)); + } + + @Override + 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 { + return new UnsetAnyTypeJsonSchema1BoxedList(validate(arg, configuration)); + } + + @Override + 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 { + if (arg == null) { + Nothing? castArg = (Nothing?) arg; + return validateAndBox(castArg, configuration); + } else if (arg instanceof Boolean booleanArg) { + boolean castArg = booleanArg; + return validateAndBox(castArg, configuration); + } else if (arg instanceof String castArg) { + return validateAndBox(castArg, configuration); + } else if (arg instanceof Number castArg) { + return validateAndBox(castArg, configuration); + } else if (arg instanceof List castArg) { + 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"); + } + } +} \ No newline at end of file diff --git a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/schemas/validation/ValidationData.kt b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/schemas/validation/ValidationData.kt new file mode 100644 index 00000000000..1563757d83a --- /dev/null +++ b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/schemas/validation/ValidationData.kt @@ -0,0 +1,23 @@ +package org.openapijsonschematools.client.schemas.validation; + +import org.checkerframework.checker.nullness.qual.Nullable; + +import java.util.List; + +public record ValidationData( + JsonSchema schema, + @Nullable Object arg, + ValidationMetadata validationMetadata, + @Nullable List containsPathToSchemas, + @Nullable PathToSchemasMap patternPropertiesPathToSchemas, + @Nullable PathToSchemasMap ifPathToSchemas, + @Nullable PathToSchemasMap knownPathToSchemas +) { + public ValidationData( + JsonSchema schema, + @Nullable Object arg, + ValidationMetadata validationMetadata + ) { + this(schema, arg, validationMetadata, null, null, null, null); + } +} \ No newline at end of file diff --git a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/schemas/validation/ValidationMetadata.kt b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/schemas/validation/ValidationMetadata.kt new file mode 100644 index 00000000000..9f5f81d00d3 --- /dev/null +++ b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/schemas/validation/ValidationMetadata.kt @@ -0,0 +1,26 @@ +package org.openapijsonschematools.client.schemas.validation; + +import org.checkerframework.checker.nullness.qual.Nullable; +import org.openapijsonschematools.client.configurations.SchemaConfiguration; +import java.util.List; +import java.util.Map; +import java.util.Set; + +public record ValidationMetadata( + List pathToItem, + SchemaConfiguration configuration, + PathToSchemasMap validatedPathToSchemas, + Set> seenClasses +) { + + public boolean validationRanEarlier(JsonSchema schema) { + @Nullable Map, Nothing?> validatedSchemas = validatedPathToSchemas.get(pathToItem); + if (validatedSchemas != null && validatedSchemas.containsKey(schema)) { + return true; + } + if (seenClasses.contains(schema)) { + return true; + } + return false; + } +} \ No newline at end of file diff --git a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/securityrequirementobjects/AuthApplier.kt b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/securityrequirementobjects/AuthApplier.kt new file mode 100644 index 00000000000..b54493b928e --- /dev/null +++ b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/securityrequirementobjects/AuthApplier.kt @@ -0,0 +1,40 @@ +package org.openapijsonschematools.client.securityrequirementobjects; + +import org.checkerframework.checker.nullness.qual.Nullable; +import org.openapijsonschematools.client.securityschemes.SecurityScheme; +import org.openapijsonschematools.client.configurations.ApiConfiguration; + +import java.net.http.HttpRequest; +import java.util.List; +import java.util.Map; + +public class AuthApplier { + protected static void updateParamsForAuth( + @Nullable SecurityRequirementObject securityRequirementObject, + Map> headers, + String resourcePath, + String method, + HttpRequest.BodyPublisher bodyPublisher, + @Nullable Map queryMap, + ApiConfiguration apiConfiguration + ) { + if (securityRequirementObject == null) { + return; + } + // TODO change securityRequirementObject to be a map of enum to scopes + // TODO store the SecurityScheme instances in a map in apiConfiguration + for (Map.Entry, List> entry: securityRequirementObject.securitySchemeToScopes.entrySet()) { + Class securitySchemeClass = entry.getKey(); + SecurityScheme securityScheme = apiConfiguration.getSecurityScheme(securitySchemeClass); + List scopeNames = entry.getValue(); + securityScheme.applyAuth( + headers, + resourcePath, + method, + bodyPublisher, + queryMap, + scopeNames + ); + } + } +} diff --git a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/securityrequirementobjects/EmptySecurityRequirementObject.kt b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/securityrequirementobjects/EmptySecurityRequirementObject.kt new file mode 100644 index 00000000000..c51a0ae3b49 --- /dev/null +++ b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/securityrequirementobjects/EmptySecurityRequirementObject.kt @@ -0,0 +1,10 @@ +package org.openapijsonschematools.client.securityrequirementobjects; + +import java.util.Map; + +public class EmptySecurityRequirementObject extends SecurityRequirementObject { + + public EmptySecurityRequirementObject() { + super(Map.of()); + } +} diff --git a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/securityrequirementobjects/SecurityRequirementObject.kt b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/securityrequirementobjects/SecurityRequirementObject.kt new file mode 100644 index 00000000000..bc0ffde6eed --- /dev/null +++ b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/securityrequirementobjects/SecurityRequirementObject.kt @@ -0,0 +1,14 @@ +package org.openapijsonschematools.client.securityrequirementobjects; + +import org.openapijsonschematools.client.securityschemes.SecurityScheme; + +import java.util.List; +import java.util.Map; + +public class SecurityRequirementObject { + public final Map, List> securitySchemeToScopes; + + public SecurityRequirementObject(Map, List> securitySchemeToScopes) { + this.securitySchemeToScopes = securitySchemeToScopes; + } +} diff --git a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/securityrequirementobjects/SecurityRequirementObjectProvider.kt b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/securityrequirementobjects/SecurityRequirementObjectProvider.kt new file mode 100644 index 00000000000..9cf6147b8f1 --- /dev/null +++ b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/securityrequirementobjects/SecurityRequirementObjectProvider.kt @@ -0,0 +1,6 @@ +package org.openapijsonschematools.client.securityrequirementobjects; + +public interface SecurityRequirementObjectProvider { + SecurityRequirementObject getSecurityRequirementObject(T securityIndex); +} + diff --git a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/securityschemes/ApiKeyCookieSecurityScheme.kt b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/securityschemes/ApiKeyCookieSecurityScheme.kt new file mode 100644 index 00000000000..fc81f2416a3 --- /dev/null +++ b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/securityschemes/ApiKeyCookieSecurityScheme.kt @@ -0,0 +1,35 @@ +package org.openapijsonschematools.client.securityschemes; + +import org.checkerframework.checker.nullness.qual.Nullable; + +import java.net.http.HttpRequest; +import java.util.ArrayList; +import java.util.List; +import java.util.Map; + +public class ApiKeyCookieSecurityScheme implements SecurityScheme { + private final String apiKey; + private final String name; + + protected ApiKeyCookieSecurityScheme(String apiKey, String name) { + this.apiKey = apiKey; + this.name = name; + } + + @Override + public void applyAuth( + Map> headers, + String resourcePath, String method, + HttpRequest.BodyPublisher bodyPublisher, + @Nullable Map queryMap, + List scopeNames + ) { + List cookieHeaderValues = headers.getOrDefault("Cookie", new ArrayList<>()); + String cookieValue = name + "=" + apiKey; + if (cookieHeaderValues.isEmpty()) { + cookieHeaderValues.add(cookieValue); + } else { + cookieHeaderValues.set(0, cookieHeaderValues.get(0)+ "; " + cookieValue); + } + } +} \ No newline at end of file diff --git a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/securityschemes/ApiKeyHeaderSecurityScheme.kt b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/securityschemes/ApiKeyHeaderSecurityScheme.kt new file mode 100644 index 00000000000..05f56190117 --- /dev/null +++ b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/securityschemes/ApiKeyHeaderSecurityScheme.kt @@ -0,0 +1,31 @@ +package org.openapijsonschematools.client.securityschemes; + +import org.checkerframework.checker.nullness.qual.Nullable; + +import java.net.http.HttpRequest; +import java.util.ArrayList; +import java.util.List; +import java.util.Map; + +public class ApiKeyHeaderSecurityScheme implements SecurityScheme { + private final String apiKey; + private final String name; + + protected ApiKeyHeaderSecurityScheme(String apiKey, String name) { + this.apiKey = apiKey; + this.name = name; + } + + @Override + public void applyAuth( + Map> headers, + String resourcePath, + String method, + HttpRequest.BodyPublisher bodyPublisher, + @Nullable Map queryMap, + List scopeNames + ) { + List headerValue = headers.getOrDefault(name, new ArrayList<>()); + headerValue.add(apiKey); + } +} \ No newline at end of file diff --git a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/securityschemes/ApiKeyQuerySecurityScheme.kt b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/securityschemes/ApiKeyQuerySecurityScheme.kt new file mode 100644 index 00000000000..dd1114e9b4a --- /dev/null +++ b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/securityschemes/ApiKeyQuerySecurityScheme.kt @@ -0,0 +1,33 @@ +package org.openapijsonschematools.client.securityschemes; + +import org.checkerframework.checker.nullness.qual.Nullable; + +import java.net.http.HttpRequest; +import java.util.ArrayList; +import java.util.List; +import java.util.Map; + +public class ApiKeyQuerySecurityScheme implements SecurityScheme { + private final String apiKey; + private final String name; + + protected ApiKeyQuerySecurityScheme(String apiKey, String name) { + this.apiKey = apiKey; + this.name = name; + } + + @Override + public void applyAuth( + Map> headers, + String resourcePath, + String method, + HttpRequest.BodyPublisher bodyPublisher, + @Nullable Map queryMap, + List scopeNames + ) { + if (queryMap == null) { + throw new RuntimeException("Invalid null value for queryMap"); + } + queryMap.put(name, apiKey); + } +} \ No newline at end of file diff --git a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/securityschemes/HttpBasicSecurityScheme.kt b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/securityschemes/HttpBasicSecurityScheme.kt new file mode 100644 index 00000000000..20b2d828145 --- /dev/null +++ b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/securityschemes/HttpBasicSecurityScheme.kt @@ -0,0 +1,39 @@ +package org.openapijsonschematools.client.securityschemes; + +import org.checkerframework.checker.nullness.qual.Nullable; + +import java.net.http.HttpRequest; +import java.nio.charset.StandardCharsets; +import java.util.ArrayList; +import java.util.Base64; +import java.util.List; +import java.util.Map; + +public class HttpBasicSecurityScheme implements SecurityScheme { + private final String userId; + private final String password; + /* + scheme = BASIC, type = HTTP + https://www.rfc-editor.org/rfc/rfc7617.html + */ + + public HttpBasicSecurityScheme(String userId, String password) { + this.userId = userId; + this.password = password; + } + + @Override + public void applyAuth( + Map> headers, + String resourcePath, + String method, + HttpRequest.BodyPublisher bodyPublisher, + @Nullable Map queryMap, + List scopeNames + ) { + String userPass = userId + ":" + password; + String b64UserPass = Base64.getEncoder().encodeToString(userPass.getBytes(StandardCharsets.UTF_8)); + List headerValue = headers.getOrDefault("Authorization", new ArrayList<>()); + headerValue.add("Basic " + b64UserPass); + } +} \ No newline at end of file diff --git a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/securityschemes/HttpBearerSecurityScheme.kt b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/securityschemes/HttpBearerSecurityScheme.kt new file mode 100644 index 00000000000..ecc9c23b586 --- /dev/null +++ b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/securityschemes/HttpBearerSecurityScheme.kt @@ -0,0 +1,41 @@ +package org.openapijsonschematools.client.securityschemes; + +import org.checkerframework.checker.nullness.qual.Nullable; + +import java.net.http.HttpRequest; +import java.util.ArrayList; +import java.util.Base64; +import java.util.List; +import java.util.Map; + +public class HttpBearerSecurityScheme implements SecurityScheme { + private final String accessToken; + private final @Nullable String bearerFormat; + /* + scheme = BEARER, type = HTTP + https://www.rfc-editor.org/rfc/rfc7617.html + */ + + protected HttpBearerSecurityScheme(String accessToken, @Nullable String bearerFormat) { + this.accessToken = accessToken; + this.bearerFormat = bearerFormat; + } + + protected HttpBearerSecurityScheme(String accessToken) { + this.accessToken = accessToken; + this.bearerFormat = null; + } + + @Override + public void applyAuth( + Map> headers, + String resourcePath, + String method, + HttpRequest.BodyPublisher bodyPublisher, + @Nullable Map queryMap, + List scopeNames + ) { + List headerValue = headers.getOrDefault("Authorization", new ArrayList<>()); + headerValue.add("Bearer " + accessToken); + } +} \ No newline at end of file diff --git a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/securityschemes/HttpDigestSecurityScheme.kt b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/securityschemes/HttpDigestSecurityScheme.kt new file mode 100644 index 00000000000..6d5f67859c1 --- /dev/null +++ b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/securityschemes/HttpDigestSecurityScheme.kt @@ -0,0 +1,21 @@ +package org.openapijsonschematools.client.securityschemes; + +import org.checkerframework.checker.nullness.qual.Nullable; + +import java.net.http.HttpRequest; +import java.util.List; +import java.util.Map; + +public class HttpDigestSecurityScheme implements SecurityScheme { + @Override + public void applyAuth( + Map> headers, + String resourcePath, + String method, + HttpRequest.BodyPublisher bodyPublisher, + @Nullable Map queryMap, + List scopeNames + ) { + throw new UnsupportedOperationException("If you need this, submit a PR adding this feature"); + } +} \ No newline at end of file diff --git a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/securityschemes/HttpSignatureSecurityScheme.kt b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/securityschemes/HttpSignatureSecurityScheme.kt new file mode 100644 index 00000000000..b59ca2475c4 --- /dev/null +++ b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/securityschemes/HttpSignatureSecurityScheme.kt @@ -0,0 +1,21 @@ +package org.openapijsonschematools.client.securityschemes; + +import org.checkerframework.checker.nullness.qual.Nullable; + +import java.net.http.HttpRequest; +import java.util.List; +import java.util.Map; + +public class HttpSignatureSecurityScheme implements SecurityScheme { + @Override + public void applyAuth( + Map> headers, + String resourcePath, + String method, + HttpRequest.BodyPublisher bodyPublisher, + @Nullable Map queryMap, + List scopeNames + ) { + throw new UnsupportedOperationException("If you need this, submit a PR adding this feature"); + } +} \ No newline at end of file diff --git a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/securityschemes/MutualTlsSecurityScheme.kt b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/securityschemes/MutualTlsSecurityScheme.kt new file mode 100644 index 00000000000..ce5fc9cd1b5 --- /dev/null +++ b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/securityschemes/MutualTlsSecurityScheme.kt @@ -0,0 +1,20 @@ +package org.openapijsonschematools.client.securityschemes; + +import org.checkerframework.checker.nullness.qual.Nullable; + +import java.net.http.HttpRequest; +import java.util.List; +import java.util.Map; + +public class MutualTlsSecurityScheme implements SecurityScheme { + @Override + public void applyAuth( + Map> headers, + String resourcePath, String method, + HttpRequest.BodyPublisher bodyPublisher, + @Nullable Map queryMap, + List scopeNames + ) { + throw new UnsupportedOperationException("If you need this, submit a PR adding this feature"); + } +} \ No newline at end of file diff --git a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/securityschemes/OAuth2SecurityScheme.kt b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/securityschemes/OAuth2SecurityScheme.kt new file mode 100644 index 00000000000..82b1d63f7f7 --- /dev/null +++ b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/securityschemes/OAuth2SecurityScheme.kt @@ -0,0 +1,21 @@ +package org.openapijsonschematools.client.securityschemes; + +import org.checkerframework.checker.nullness.qual.Nullable; + +import java.net.http.HttpRequest; +import java.util.List; +import java.util.Map; + +public class OAuth2SecurityScheme implements SecurityScheme { + @Override + public void applyAuth( + Map> headers, + String resourcePath, + String method, + HttpRequest.BodyPublisher bodyPublisher, + @Nullable Map queryMap, + List scopeNames + ) { + throw new UnsupportedOperationException("If you need this, submit a PR adding this feature"); + } +} \ No newline at end of file diff --git a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/securityschemes/OpenIdConnectSecurityScheme.kt b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/securityschemes/OpenIdConnectSecurityScheme.kt new file mode 100644 index 00000000000..a87d3e4eed6 --- /dev/null +++ b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/securityschemes/OpenIdConnectSecurityScheme.kt @@ -0,0 +1,21 @@ +package org.openapijsonschematools.client.securityschemes; + +import org.checkerframework.checker.nullness.qual.Nullable; + +import java.net.http.HttpRequest; +import java.util.List; +import java.util.Map; + +public class OpenIdConnectSecurityScheme implements SecurityScheme { + @Override + public void applyAuth( + Map> headers, + String resourcePath, + String method, + HttpRequest.BodyPublisher bodyPublisher, + @Nullable Map queryMap, + List scopeNames + ) { + throw new UnsupportedOperationException("If you need this, submit a PR adding this feature"); + } +} \ No newline at end of file diff --git a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/securityschemes/SecurityScheme.kt b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/securityschemes/SecurityScheme.kt new file mode 100644 index 00000000000..67c7f90736d --- /dev/null +++ b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/securityschemes/SecurityScheme.kt @@ -0,0 +1,19 @@ +package org.openapijsonschematools.client.securityschemes; + +import org.checkerframework.checker.nullness.qual.Nullable; + +import java.net.http.HttpRequest; +import java.util.List; +import java.util.Map; + +public interface SecurityScheme { + void applyAuth( + Map> headers, + String resourcePath, + String method, + HttpRequest.BodyPublisher bodyPublisher, + @Nullable Map queryMap, + List scopeNames + ); +} + diff --git a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/servers/RootServer0.kt b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/servers/RootServer0.kt new file mode 100644 index 00000000000..1dddf7bf2fe --- /dev/null +++ b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/servers/RootServer0.kt @@ -0,0 +1,38 @@ +package org.openapijsonschematools.client.servers; + +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.rootserver0.RootServer0Variables; + +import java.util.AbstractMap; + +public class RootServer0 extends ServerWithVariables { + /* + petstore server + */ + private static RootServer0Variables.VariablesMap getVariables() { + try { + return RootServer0Variables.RootServer0Variables1.getInstance().validate( + MapUtils.makeMap( + new AbstractMap.SimpleEntry<>("port", RootServer0Variables.Port.getInstance().defaultValue()), + new AbstractMap.SimpleEntry<>("server", RootServer0Variables.Server.getInstance().defaultValue()) + ), + new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().build()) + ); + } catch (ValidationException e) { + throw new RuntimeException(e); + } + } + + public RootServer0() { + super( + "http://{server}.swagger.io:{port}/v2", + getVariables() + ); + } + public RootServer0(RootServer0Variables.VariablesMap variables) { + super("http://{server}.swagger.io:{port}/v2", variables); + } +} diff --git a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/servers/RootServer1.kt b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/servers/RootServer1.kt new file mode 100644 index 00000000000..2ff8761b163 --- /dev/null +++ b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/servers/RootServer1.kt @@ -0,0 +1,37 @@ +package org.openapijsonschematools.client.servers; + +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.rootserver1.RootServer1Variables; + +import java.util.AbstractMap; + +public class RootServer1 extends ServerWithVariables { + /* + The local server + */ + private static RootServer1Variables.VariablesMap getVariables() { + try { + return RootServer1Variables.RootServer1Variables1.getInstance().validate( + MapUtils.makeMap( + new AbstractMap.SimpleEntry<>("version", RootServer1Variables.Version.getInstance().defaultValue()) + ), + new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().build()) + ); + } catch (ValidationException e) { + throw new RuntimeException(e); + } + } + + public RootServer1() { + super( + "https://localhost:8080/{version}", + getVariables() + ); + } + public RootServer1(RootServer1Variables.VariablesMap variables) { + super("https://localhost:8080/{version}", variables); + } +} diff --git a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/servers/RootServer2.kt b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/servers/RootServer2.kt new file mode 100644 index 00000000000..5292f414c65 --- /dev/null +++ b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/servers/RootServer2.kt @@ -0,0 +1,9 @@ +package org.openapijsonschematools.client.servers; + +import org.openapijsonschematools.client.servers.ServerWithoutVariables; + +public class RootServer2 extends ServerWithoutVariables { + public RootServer2() { + super("https://localhost:8080"); + } +} diff --git a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/servers/Server.kt b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/servers/Server.kt new file mode 100644 index 00000000000..f5159644ccc --- /dev/null +++ b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/servers/Server.kt @@ -0,0 +1,6 @@ +package org.openapijsonschematools.client.servers; + +public interface Server { + String url(); +} + diff --git a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/servers/ServerProvider.kt b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/servers/ServerProvider.kt new file mode 100644 index 00000000000..f736485870c --- /dev/null +++ b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/servers/ServerProvider.kt @@ -0,0 +1,6 @@ +package org.openapijsonschematools.client.servers; + +public interface ServerProvider { + Server getServer(T serverIndex); +} + diff --git a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/servers/ServerWithVariables.kt b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/servers/ServerWithVariables.kt new file mode 100644 index 00000000000..68748bcfcae --- /dev/null +++ b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/servers/ServerWithVariables.kt @@ -0,0 +1,21 @@ +package org.openapijsonschematools.client.servers; + +import java.util.Map; + +public abstract class ServerWithVariables> implements Server { + public final String url; + public final T variables; + + protected ServerWithVariables(String url, T variables) { + this.variables = variables; + for (Map.Entry entry: variables.entrySet()) { + url = url.replace("{" + entry.getKey() + "}", entry.getValue()); + } + this.url = url; + } + + public String url(){ + return url; + } +} + diff --git a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/servers/ServerWithoutVariables.kt b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/servers/ServerWithoutVariables.kt new file mode 100644 index 00000000000..c41ac2e77e5 --- /dev/null +++ b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/servers/ServerWithoutVariables.kt @@ -0,0 +1,14 @@ +package org.openapijsonschematools.client.servers; + +public abstract class ServerWithoutVariables implements Server { + public final String url; + + protected ServerWithoutVariables(String url) { + this.url = url; + } + + public String url(){ + return url; + } +} + diff --git a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/servers/rootserver0/RootServer0Variables.kt b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/servers/rootserver0/RootServer0Variables.kt new file mode 100644 index 00000000000..0fbad424ec1 --- /dev/null +++ b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/servers/rootserver0/RootServer0Variables.kt @@ -0,0 +1,471 @@ +package org.openapijsonschematools.client.servers.rootserver0; +import java.util.ArrayList; +import java.util.HashSet; +import java.util.LinkedHashMap; +import java.util.LinkedHashSet; +import java.util.List; +import java.util.Map; +import java.util.Objects; +import java.util.Set; +import org.checkerframework.checker.nullness.qual.Nullable; +import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags; +import org.openapijsonschematools.client.configurations.SchemaConfiguration; +import org.openapijsonschematools.client.exceptions.UnsetPropertyException; +import org.openapijsonschematools.client.exceptions.ValidationException; +import org.openapijsonschematools.client.schemas.AnyTypeJsonSchema; +import org.openapijsonschematools.client.schemas.GenericBuilder; +import org.openapijsonschematools.client.schemas.NotAnyTypeJsonSchema; +import org.openapijsonschematools.client.schemas.SetMaker; +import org.openapijsonschematools.client.schemas.validation.DefaultValueMethod; +import org.openapijsonschematools.client.schemas.validation.FrozenMap; +import org.openapijsonschematools.client.schemas.validation.JsonSchema; +import org.openapijsonschematools.client.schemas.validation.JsonSchemaInfo; +import org.openapijsonschematools.client.schemas.validation.MapSchemaValidator; +import org.openapijsonschematools.client.schemas.validation.MapUtils; +import org.openapijsonschematools.client.schemas.validation.PathToSchemasMap; +import org.openapijsonschematools.client.schemas.validation.PropertyEntry; +import org.openapijsonschematools.client.schemas.validation.StringEnumValidator; +import org.openapijsonschematools.client.schemas.validation.StringSchemaValidator; +import org.openapijsonschematools.client.schemas.validation.StringValueMethod; +import org.openapijsonschematools.client.schemas.validation.ValidationMetadata; + +public class RootServer0Variables { + // nest classes so all schemas and input/output classes can be public + + + public static class AdditionalProperties extends NotAnyTypeJsonSchema.NotAnyTypeJsonSchema1 { + // NotAnyTypeSchema + private static @Nullable AdditionalProperties instance = null; + public static AdditionalProperties getInstance() { + if (instance == null) { + instance = new AdditionalProperties(); + } + return instance; + } + } + + public enum StringServerEnums implements StringValueMethod { + PETSTORE("petstore"), + QA_HYPHEN_MINUS_PETSTORE("qa-petstore"), + DEV_HYPHEN_MINUS_PETSTORE("dev-petstore"); + private final String value; + + StringServerEnums(String value) { + this.value = value; + } + public String value() { + return this.value; + } + } + + + public sealed interface ServerBoxed permits ServerBoxedString { + @Nullable Object getData(); + } + + public record ServerBoxedString(String data) implements ServerBoxed { + @Override + public @Nullable Object getData() { + return data; + } + } + + + + public static class Server extends JsonSchema implements StringSchemaValidator, StringEnumValidator, DefaultValueMethod { + private static @Nullable Server instance = null; + + protected Server() { + super(new JsonSchemaInfo() + .type(Set.of( + String.class + )) + .enumValues(SetMaker.makeSet( + "petstore", + "qa-petstore", + "dev-petstore" + )) + .defaultValue("petstore") + ); + } + + public static Server getInstance() { + if (instance == null) { + instance = new Server(); + } + return instance; + } + + @Override + public String validate(String arg, SchemaConfiguration configuration) throws ValidationException { + Set> pathSet = new HashSet<>(); + List pathToItem = List.of("args[0"); + String castArg = castToAllowedTypes(arg, pathToItem, pathSet); + SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().build())); + ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, new PathToSchemasMap(), new LinkedHashSet<>()); + getPathToSchemas(this, castArg, validationMetadata, pathSet); + return castArg; + } + + @Override + 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 { + 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"); + } + @Override + public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { + 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"); + } + public String defaultValue() throws ValidationException { + if (defaultValue instanceof String) { + return (String) defaultValue; + } + throw new ValidationException("Invalid type stored in defaultValue"); + } + @Override + 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 { + 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"); + } + } + public enum StringPortEnums implements StringValueMethod { + POSITIVE_80("80"), + POSITIVE_8080("8080"); + private final String value; + + StringPortEnums(String value) { + this.value = value; + } + public String value() { + return this.value; + } + } + + + public sealed interface PortBoxed permits PortBoxedString { + @Nullable Object getData(); + } + + public record PortBoxedString(String data) implements PortBoxed { + @Override + public @Nullable Object getData() { + return data; + } + } + + + + public static class Port extends JsonSchema implements StringSchemaValidator, StringEnumValidator, DefaultValueMethod { + private static @Nullable Port instance = null; + + protected Port() { + super(new JsonSchemaInfo() + .type(Set.of( + String.class + )) + .enumValues(SetMaker.makeSet( + "80", + "8080" + )) + .defaultValue("80") + ); + } + + public static Port getInstance() { + if (instance == null) { + instance = new Port(); + } + return instance; + } + + @Override + public String validate(String arg, SchemaConfiguration configuration) throws ValidationException { + Set> pathSet = new HashSet<>(); + List pathToItem = List.of("args[0"); + String castArg = castToAllowedTypes(arg, pathToItem, pathSet); + SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().build())); + ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, new PathToSchemasMap(), new LinkedHashSet<>()); + getPathToSchemas(this, castArg, validationMetadata, pathSet); + return castArg; + } + + @Override + 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 { + 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"); + } + @Override + public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { + 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"); + } + public String defaultValue() throws ValidationException { + if (defaultValue instanceof String) { + return (String) defaultValue; + } + throw new ValidationException("Invalid type stored in defaultValue"); + } + @Override + 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 { + 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"); + } + } + + public static class VariablesMap extends FrozenMap { + protected VariablesMap(FrozenMap m) { + super(m); + } + public static final Set requiredKeys = Set.of( + "port", + "server" + ); + public static final Set optionalKeys = Set.of(); + public static VariablesMap of(Map arg, SchemaConfiguration configuration) throws ValidationException { + return RootServer0Variables1.getInstance().validate(arg, configuration); + } + + public String port() { + String value = get("port"); + if (!(value instanceof String)) { + throw new RuntimeException("Invalid value stored for port"); + } + return (String) value; + } + + public String server() { + String value = get("server"); + if (!(value instanceof String)) { + throw new RuntimeException("Invalid value stored for server"); + } + return (String) value; + } + } + + public interface SetterForPort { + Map getInstance(); + T getBuilderAfterPort(Map instance); + + default T port(String value) { + var instance = getInstance(); + instance.put("port", value); + return getBuilderAfterPort(instance); + } + + default T port(StringPortEnums value) { + var instance = getInstance(); + instance.put("port", value.value()); + return getBuilderAfterPort(instance); + } + } + + public interface SetterForServer { + Map getInstance(); + T getBuilderAfterServer(Map instance); + + default T server(String value) { + var instance = getInstance(); + instance.put("server", value); + return getBuilderAfterServer(instance); + } + + default T server(StringServerEnums value) { + var instance = getInstance(); + instance.put("server", value.value()); + return getBuilderAfterServer(instance); + } + } + + public static class VariablesMap00Builder implements GenericBuilder> { + private final Map instance; + private static final Set knownKeys = Set.of( + "port", + "server" + ); + public Set getKnownKeys() { + return knownKeys; + } + public VariablesMap00Builder(Map instance) { + this.instance = instance; + } + public Map build() { + return instance; + } + } + + public static class VariablesMap01Builder implements SetterForServer { + private final Map instance; + public VariablesMap01Builder(Map instance) { + this.instance = instance; + } + public Map getInstance() { + return instance; + } + public VariablesMap00Builder getBuilderAfterServer(Map instance) { + return new VariablesMap00Builder(instance); + } + } + + public static class VariablesMap10Builder implements SetterForPort { + private final Map instance; + public VariablesMap10Builder(Map instance) { + this.instance = instance; + } + public Map getInstance() { + return instance; + } + public VariablesMap00Builder getBuilderAfterPort(Map instance) { + return new VariablesMap00Builder(instance); + } + } + + public static class VariablesMapBuilder implements SetterForPort, SetterForServer { + private final Map instance; + public VariablesMapBuilder() { + this.instance = new LinkedHashMap<>(); + } + public Map getInstance() { + return instance; + } + public VariablesMap01Builder getBuilderAfterPort(Map instance) { + return new VariablesMap01Builder(instance); + } + public VariablesMap10Builder getBuilderAfterServer(Map instance) { + return new VariablesMap10Builder(instance); + } + } + + + public sealed interface RootServer0Variables1Boxed permits RootServer0Variables1BoxedMap { + @Nullable Object getData(); + } + + public record RootServer0Variables1BoxedMap(VariablesMap data) implements RootServer0Variables1Boxed { + @Override + public @Nullable Object getData() { + return data; + } + } + + + public static class RootServer0Variables1 extends JsonSchema implements MapSchemaValidator { + private static @Nullable RootServer0Variables1 instance = null; + + protected RootServer0Variables1() { + super(new JsonSchemaInfo() + .type(Set.of(Map.class)) + .properties(Map.ofEntries( + new PropertyEntry("server", Server.class), + new PropertyEntry("port", Port.class) + )) + .required(Set.of( + "port", + "server" + )) + .additionalProperties(AdditionalProperties.class) + ); + } + + public static RootServer0Variables1 getInstance() { + if (instance == null) { + instance = new RootServer0Variables1(); + } + return instance; + } + + 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 RuntimeException("Invalid non-string key value"); + } + String propertyName = (String) entryKey; + List propertyPathToItem = new ArrayList<>(pathToItem); + propertyPathToItem.add(propertyName); + Object value = entry.getValue(); + LinkedHashMap, Nothing?> schemas = pathToSchemas.get(propertyPathToItem); + if (schemas == null) { + throw new RuntimeException("Validation 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"); + } + properties.put(propertyName, (String) propertyInstance); + } + FrozenMap castProperties = new FrozenMap<>(properties); + return new VariablesMap(castProperties); + } + + 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); + SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().build())); + ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, new PathToSchemasMap(), new LinkedHashSet<>()); + PathToSchemasMap pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet); + return getNewInstance(castArg, validationMetadata.pathToItem(), pathToSchemasMap); + } + + + @Override + public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws 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"); + } + @Override + public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { + if (arg instanceof Map) { + return getNewInstance((Map) arg, pathToItem, pathToSchemas); + } + throw new RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); + } + @Override + public RootServer0Variables1BoxedMap validateAndBox(Map arg, SchemaConfiguration configuration) throws ValidationException { + return new RootServer0Variables1BoxedMap(validate(arg, configuration)); + } + @Override + public RootServer0Variables1Boxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { + 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"); + } + } + +} diff --git a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/servers/rootserver1/RootServer1Variables.kt b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/servers/rootserver1/RootServer1Variables.kt new file mode 100644 index 00000000000..ff6b7de86dc --- /dev/null +++ b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/servers/rootserver1/RootServer1Variables.kt @@ -0,0 +1,313 @@ +package org.openapijsonschematools.client.servers.rootserver1; +import java.util.ArrayList; +import java.util.HashSet; +import java.util.LinkedHashMap; +import java.util.LinkedHashSet; +import java.util.List; +import java.util.Map; +import java.util.Objects; +import java.util.Set; +import org.checkerframework.checker.nullness.qual.Nullable; +import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags; +import org.openapijsonschematools.client.configurations.SchemaConfiguration; +import org.openapijsonschematools.client.exceptions.UnsetPropertyException; +import org.openapijsonschematools.client.exceptions.ValidationException; +import org.openapijsonschematools.client.schemas.AnyTypeJsonSchema; +import org.openapijsonschematools.client.schemas.GenericBuilder; +import org.openapijsonschematools.client.schemas.NotAnyTypeJsonSchema; +import org.openapijsonschematools.client.schemas.SetMaker; +import org.openapijsonschematools.client.schemas.validation.DefaultValueMethod; +import org.openapijsonschematools.client.schemas.validation.FrozenMap; +import org.openapijsonschematools.client.schemas.validation.JsonSchema; +import org.openapijsonschematools.client.schemas.validation.JsonSchemaInfo; +import org.openapijsonschematools.client.schemas.validation.MapSchemaValidator; +import org.openapijsonschematools.client.schemas.validation.MapUtils; +import org.openapijsonschematools.client.schemas.validation.PathToSchemasMap; +import org.openapijsonschematools.client.schemas.validation.PropertyEntry; +import org.openapijsonschematools.client.schemas.validation.StringEnumValidator; +import org.openapijsonschematools.client.schemas.validation.StringSchemaValidator; +import org.openapijsonschematools.client.schemas.validation.StringValueMethod; +import org.openapijsonschematools.client.schemas.validation.ValidationMetadata; + +public class RootServer1Variables { + // nest classes so all schemas and input/output classes can be public + + + public static class AdditionalProperties extends NotAnyTypeJsonSchema.NotAnyTypeJsonSchema1 { + // NotAnyTypeSchema + private static @Nullable AdditionalProperties instance = null; + public static AdditionalProperties getInstance() { + if (instance == null) { + instance = new AdditionalProperties(); + } + return instance; + } + } + + public enum StringVersionEnums implements StringValueMethod { + V1("v1"), + V2("v2"); + private final String value; + + StringVersionEnums(String value) { + this.value = value; + } + public String value() { + return this.value; + } + } + + + public sealed interface VersionBoxed permits VersionBoxedString { + @Nullable Object getData(); + } + + public record VersionBoxedString(String data) implements VersionBoxed { + @Override + public @Nullable Object getData() { + return data; + } + } + + + + public static class Version extends JsonSchema implements StringSchemaValidator, StringEnumValidator, DefaultValueMethod { + private static @Nullable Version instance = null; + + protected Version() { + super(new JsonSchemaInfo() + .type(Set.of( + String.class + )) + .enumValues(SetMaker.makeSet( + "v1", + "v2" + )) + .defaultValue("v2") + ); + } + + public static Version getInstance() { + if (instance == null) { + instance = new Version(); + } + return instance; + } + + @Override + public String validate(String arg, SchemaConfiguration configuration) throws ValidationException { + Set> pathSet = new HashSet<>(); + List pathToItem = List.of("args[0"); + String castArg = castToAllowedTypes(arg, pathToItem, pathSet); + SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().build())); + ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, new PathToSchemasMap(), new LinkedHashSet<>()); + getPathToSchemas(this, castArg, validationMetadata, pathSet); + return castArg; + } + + @Override + 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 { + 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"); + } + @Override + public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { + 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"); + } + public String defaultValue() throws ValidationException { + if (defaultValue instanceof String) { + return (String) defaultValue; + } + throw new ValidationException("Invalid type stored in defaultValue"); + } + @Override + 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 { + 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"); + } + } + + public static class VariablesMap extends FrozenMap { + protected VariablesMap(FrozenMap m) { + super(m); + } + public static final Set requiredKeys = Set.of( + "version" + ); + public static final Set optionalKeys = Set.of(); + public static VariablesMap of(Map arg, SchemaConfiguration configuration) throws ValidationException { + return RootServer1Variables1.getInstance().validate(arg, configuration); + } + + public String version() { + try { + return getOrThrow("version"); + } catch (UnsetPropertyException e) { + throw new RuntimeException(e); + } + } + } + + public interface SetterForVersion { + Map getInstance(); + T getBuilderAfterVersion(Map instance); + + default T version(String value) { + var instance = getInstance(); + instance.put("version", value); + return getBuilderAfterVersion(instance); + } + + default T version(StringVersionEnums value) { + var instance = getInstance(); + instance.put("version", value.value()); + return getBuilderAfterVersion(instance); + } + } + + public static class VariablesMap0Builder implements GenericBuilder> { + private final Map instance; + private static final Set knownKeys = Set.of( + "version" + ); + public Set getKnownKeys() { + return knownKeys; + } + public VariablesMap0Builder(Map instance) { + this.instance = instance; + } + public Map build() { + return instance; + } + } + + public static class VariablesMapBuilder implements SetterForVersion { + private final Map instance; + public VariablesMapBuilder() { + this.instance = new LinkedHashMap<>(); + } + public Map getInstance() { + return instance; + } + public VariablesMap0Builder getBuilderAfterVersion(Map instance) { + return new VariablesMap0Builder(instance); + } + } + + + public sealed interface RootServer1Variables1Boxed permits RootServer1Variables1BoxedMap { + @Nullable Object getData(); + } + + public record RootServer1Variables1BoxedMap(VariablesMap data) implements RootServer1Variables1Boxed { + @Override + public @Nullable Object getData() { + return data; + } + } + + + public static class RootServer1Variables1 extends JsonSchema implements MapSchemaValidator { + private static @Nullable RootServer1Variables1 instance = null; + + protected RootServer1Variables1() { + super(new JsonSchemaInfo() + .type(Set.of(Map.class)) + .properties(Map.ofEntries( + new PropertyEntry("version", Version.class) + )) + .required(Set.of( + "version" + )) + .additionalProperties(AdditionalProperties.class) + ); + } + + public static RootServer1Variables1 getInstance() { + if (instance == null) { + instance = new RootServer1Variables1(); + } + return instance; + } + + 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 RuntimeException("Invalid non-string key value"); + } + String propertyName = (String) entryKey; + List propertyPathToItem = new ArrayList<>(pathToItem); + propertyPathToItem.add(propertyName); + Object value = entry.getValue(); + LinkedHashMap, Nothing?> schemas = pathToSchemas.get(propertyPathToItem); + if (schemas == null) { + throw new RuntimeException("Validation 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"); + } + properties.put(propertyName, (String) propertyInstance); + } + FrozenMap castProperties = new FrozenMap<>(properties); + return new VariablesMap(castProperties); + } + + 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); + SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().build())); + ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, new PathToSchemasMap(), new LinkedHashSet<>()); + PathToSchemasMap pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet); + return getNewInstance(castArg, validationMetadata.pathToItem(), pathToSchemasMap); + } + + + @Override + public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws 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"); + } + @Override + public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { + if (arg instanceof Map) { + return getNewInstance((Map) arg, pathToItem, pathToSchemas); + } + throw new RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); + } + @Override + public RootServer1Variables1BoxedMap validateAndBox(Map arg, SchemaConfiguration configuration) throws ValidationException { + return new RootServer1Variables1BoxedMap(validate(arg, configuration)); + } + @Override + public RootServer1Variables1Boxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { + 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"); + } + } + +} diff --git a/samples/client/petstore/kotlin/src/test/kotlin/org/openapijsonschematools/client/components/schemas/AbstractStepMessageTest.kt b/samples/client/petstore/kotlin/src/test/kotlin/org/openapijsonschematools/client/components/schemas/AbstractStepMessageTest.kt new file mode 100644 index 00000000000..82590f8a704 --- /dev/null +++ b/samples/client/petstore/kotlin/src/test/kotlin/org/openapijsonschematools/client/components/schemas/AbstractStepMessageTest.kt @@ -0,0 +1,18 @@ +package org.openapijsonschematools.client.components.schemas; + +import org.junit.Assert; +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.MapUtils; +import org.checkerframework.checker.nullness.qual.Nullable; + +import java.util.Arrays; +import java.util.List; +import java.util.Map; +import java.util.AbstractMap; + +public class AbstractStepMessageTest { + static final SchemaConfiguration configuration = new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().format().build()); +} diff --git a/samples/client/petstore/kotlin/src/test/kotlin/org/openapijsonschematools/client/components/schemas/AdditionalPropertiesClassTest.kt b/samples/client/petstore/kotlin/src/test/kotlin/org/openapijsonschematools/client/components/schemas/AdditionalPropertiesClassTest.kt new file mode 100644 index 00000000000..ef80b00c044 --- /dev/null +++ b/samples/client/petstore/kotlin/src/test/kotlin/org/openapijsonschematools/client/components/schemas/AdditionalPropertiesClassTest.kt @@ -0,0 +1,18 @@ +package org.openapijsonschematools.client.components.schemas; + +import org.junit.Assert; +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.MapUtils; +import org.checkerframework.checker.nullness.qual.Nullable; + +import java.util.Arrays; +import java.util.List; +import java.util.Map; +import java.util.AbstractMap; + +public class AdditionalPropertiesClassTest { + static final SchemaConfiguration configuration = new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().format().build()); +} diff --git a/samples/client/petstore/kotlin/src/test/kotlin/org/openapijsonschematools/client/components/schemas/AdditionalPropertiesSchemaTest.kt b/samples/client/petstore/kotlin/src/test/kotlin/org/openapijsonschematools/client/components/schemas/AdditionalPropertiesSchemaTest.kt new file mode 100644 index 00000000000..de7861d3cb2 --- /dev/null +++ b/samples/client/petstore/kotlin/src/test/kotlin/org/openapijsonschematools/client/components/schemas/AdditionalPropertiesSchemaTest.kt @@ -0,0 +1,18 @@ +package org.openapijsonschematools.client.components.schemas; + +import org.junit.Assert; +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.MapUtils; +import org.checkerframework.checker.nullness.qual.Nullable; + +import java.util.Arrays; +import java.util.List; +import java.util.Map; +import java.util.AbstractMap; + +public class AdditionalPropertiesSchemaTest { + static final SchemaConfiguration configuration = new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().format().build()); +} diff --git a/samples/client/petstore/kotlin/src/test/kotlin/org/openapijsonschematools/client/components/schemas/AdditionalPropertiesWithArrayOfEnumsTest.kt b/samples/client/petstore/kotlin/src/test/kotlin/org/openapijsonschematools/client/components/schemas/AdditionalPropertiesWithArrayOfEnumsTest.kt new file mode 100644 index 00000000000..f44a71eaea1 --- /dev/null +++ b/samples/client/petstore/kotlin/src/test/kotlin/org/openapijsonschematools/client/components/schemas/AdditionalPropertiesWithArrayOfEnumsTest.kt @@ -0,0 +1,18 @@ +package org.openapijsonschematools.client.components.schemas; + +import org.junit.Assert; +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.MapUtils; +import org.checkerframework.checker.nullness.qual.Nullable; + +import java.util.Arrays; +import java.util.List; +import java.util.Map; +import java.util.AbstractMap; + +public class AdditionalPropertiesWithArrayOfEnumsTest { + static final SchemaConfiguration configuration = new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().format().build()); +} diff --git a/samples/client/petstore/kotlin/src/test/kotlin/org/openapijsonschematools/client/components/schemas/AddressTest.kt b/samples/client/petstore/kotlin/src/test/kotlin/org/openapijsonschematools/client/components/schemas/AddressTest.kt new file mode 100644 index 00000000000..eeb0dfc4626 --- /dev/null +++ b/samples/client/petstore/kotlin/src/test/kotlin/org/openapijsonschematools/client/components/schemas/AddressTest.kt @@ -0,0 +1,18 @@ +package org.openapijsonschematools.client.components.schemas; + +import org.junit.Assert; +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.MapUtils; +import org.checkerframework.checker.nullness.qual.Nullable; + +import java.util.Arrays; +import java.util.List; +import java.util.Map; +import java.util.AbstractMap; + +public class AddressTest { + static final SchemaConfiguration configuration = new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().format().build()); +} diff --git a/samples/client/petstore/kotlin/src/test/kotlin/org/openapijsonschematools/client/components/schemas/AnimalFarmTest.kt b/samples/client/petstore/kotlin/src/test/kotlin/org/openapijsonschematools/client/components/schemas/AnimalFarmTest.kt new file mode 100644 index 00000000000..28531089830 --- /dev/null +++ b/samples/client/petstore/kotlin/src/test/kotlin/org/openapijsonschematools/client/components/schemas/AnimalFarmTest.kt @@ -0,0 +1,18 @@ +package org.openapijsonschematools.client.components.schemas; + +import org.junit.Assert; +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.MapUtils; +import org.checkerframework.checker.nullness.qual.Nullable; + +import java.util.Arrays; +import java.util.List; +import java.util.Map; +import java.util.AbstractMap; + +public class AnimalFarmTest { + static final SchemaConfiguration configuration = new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().format().build()); +} diff --git a/samples/client/petstore/kotlin/src/test/kotlin/org/openapijsonschematools/client/components/schemas/AnimalTest.kt b/samples/client/petstore/kotlin/src/test/kotlin/org/openapijsonschematools/client/components/schemas/AnimalTest.kt new file mode 100644 index 00000000000..f38c301e7f5 --- /dev/null +++ b/samples/client/petstore/kotlin/src/test/kotlin/org/openapijsonschematools/client/components/schemas/AnimalTest.kt @@ -0,0 +1,18 @@ +package org.openapijsonschematools.client.components.schemas; + +import org.junit.Assert; +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.MapUtils; +import org.checkerframework.checker.nullness.qual.Nullable; + +import java.util.Arrays; +import java.util.List; +import java.util.Map; +import java.util.AbstractMap; + +public class AnimalTest { + static final SchemaConfiguration configuration = new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().format().build()); +} diff --git a/samples/client/petstore/kotlin/src/test/kotlin/org/openapijsonschematools/client/components/schemas/AnyTypeAndFormatTest.kt b/samples/client/petstore/kotlin/src/test/kotlin/org/openapijsonschematools/client/components/schemas/AnyTypeAndFormatTest.kt new file mode 100644 index 00000000000..d76fcfbd442 --- /dev/null +++ b/samples/client/petstore/kotlin/src/test/kotlin/org/openapijsonschematools/client/components/schemas/AnyTypeAndFormatTest.kt @@ -0,0 +1,18 @@ +package org.openapijsonschematools.client.components.schemas; + +import org.junit.Assert; +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.MapUtils; +import org.checkerframework.checker.nullness.qual.Nullable; + +import java.util.Arrays; +import java.util.List; +import java.util.Map; +import java.util.AbstractMap; + +public class AnyTypeAndFormatTest { + static final SchemaConfiguration configuration = new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().format().build()); +} diff --git a/samples/client/petstore/kotlin/src/test/kotlin/org/openapijsonschematools/client/components/schemas/AnyTypeNotStringTest.kt b/samples/client/petstore/kotlin/src/test/kotlin/org/openapijsonschematools/client/components/schemas/AnyTypeNotStringTest.kt new file mode 100644 index 00000000000..5af249aa1c1 --- /dev/null +++ b/samples/client/petstore/kotlin/src/test/kotlin/org/openapijsonschematools/client/components/schemas/AnyTypeNotStringTest.kt @@ -0,0 +1,18 @@ +package org.openapijsonschematools.client.components.schemas; + +import org.junit.Assert; +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.MapUtils; +import org.checkerframework.checker.nullness.qual.Nullable; + +import java.util.Arrays; +import java.util.List; +import java.util.Map; +import java.util.AbstractMap; + +public class AnyTypeNotStringTest { + static final SchemaConfiguration configuration = new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().format().build()); +} diff --git a/samples/client/petstore/kotlin/src/test/kotlin/org/openapijsonschematools/client/components/schemas/ApiResponseSchemaTest.kt b/samples/client/petstore/kotlin/src/test/kotlin/org/openapijsonschematools/client/components/schemas/ApiResponseSchemaTest.kt new file mode 100644 index 00000000000..70e59c3040f --- /dev/null +++ b/samples/client/petstore/kotlin/src/test/kotlin/org/openapijsonschematools/client/components/schemas/ApiResponseSchemaTest.kt @@ -0,0 +1,18 @@ +package org.openapijsonschematools.client.components.schemas; + +import org.junit.Assert; +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.MapUtils; +import org.checkerframework.checker.nullness.qual.Nullable; + +import java.util.Arrays; +import java.util.List; +import java.util.Map; +import java.util.AbstractMap; + +public class ApiResponseSchemaTest { + static final SchemaConfiguration configuration = new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().format().build()); +} diff --git a/samples/client/petstore/kotlin/src/test/kotlin/org/openapijsonschematools/client/components/schemas/AppleReqTest.kt b/samples/client/petstore/kotlin/src/test/kotlin/org/openapijsonschematools/client/components/schemas/AppleReqTest.kt new file mode 100644 index 00000000000..d7c45b1af68 --- /dev/null +++ b/samples/client/petstore/kotlin/src/test/kotlin/org/openapijsonschematools/client/components/schemas/AppleReqTest.kt @@ -0,0 +1,18 @@ +package org.openapijsonschematools.client.components.schemas; + +import org.junit.Assert; +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.MapUtils; +import org.checkerframework.checker.nullness.qual.Nullable; + +import java.util.Arrays; +import java.util.List; +import java.util.Map; +import java.util.AbstractMap; + +public class AppleReqTest { + static final SchemaConfiguration configuration = new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().format().build()); +} diff --git a/samples/client/petstore/kotlin/src/test/kotlin/org/openapijsonschematools/client/components/schemas/AppleTest.kt b/samples/client/petstore/kotlin/src/test/kotlin/org/openapijsonschematools/client/components/schemas/AppleTest.kt new file mode 100644 index 00000000000..491ab8ffb6d --- /dev/null +++ b/samples/client/petstore/kotlin/src/test/kotlin/org/openapijsonschematools/client/components/schemas/AppleTest.kt @@ -0,0 +1,18 @@ +package org.openapijsonschematools.client.components.schemas; + +import org.junit.Assert; +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.MapUtils; +import org.checkerframework.checker.nullness.qual.Nullable; + +import java.util.Arrays; +import java.util.List; +import java.util.Map; +import java.util.AbstractMap; + +public class AppleTest { + static final SchemaConfiguration configuration = new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().format().build()); +} diff --git a/samples/client/petstore/kotlin/src/test/kotlin/org/openapijsonschematools/client/components/schemas/ArrayHoldingAnyTypeTest.kt b/samples/client/petstore/kotlin/src/test/kotlin/org/openapijsonschematools/client/components/schemas/ArrayHoldingAnyTypeTest.kt new file mode 100644 index 00000000000..cae93de592c --- /dev/null +++ b/samples/client/petstore/kotlin/src/test/kotlin/org/openapijsonschematools/client/components/schemas/ArrayHoldingAnyTypeTest.kt @@ -0,0 +1,18 @@ +package org.openapijsonschematools.client.components.schemas; + +import org.junit.Assert; +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.MapUtils; +import org.checkerframework.checker.nullness.qual.Nullable; + +import java.util.Arrays; +import java.util.List; +import java.util.Map; +import java.util.AbstractMap; + +public class ArrayHoldingAnyTypeTest { + static final SchemaConfiguration configuration = new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().format().build()); +} diff --git a/samples/client/petstore/kotlin/src/test/kotlin/org/openapijsonschematools/client/components/schemas/ArrayOfArrayOfNumberOnlyTest.kt b/samples/client/petstore/kotlin/src/test/kotlin/org/openapijsonschematools/client/components/schemas/ArrayOfArrayOfNumberOnlyTest.kt new file mode 100644 index 00000000000..f826dc7742b --- /dev/null +++ b/samples/client/petstore/kotlin/src/test/kotlin/org/openapijsonschematools/client/components/schemas/ArrayOfArrayOfNumberOnlyTest.kt @@ -0,0 +1,18 @@ +package org.openapijsonschematools.client.components.schemas; + +import org.junit.Assert; +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.MapUtils; +import org.checkerframework.checker.nullness.qual.Nullable; + +import java.util.Arrays; +import java.util.List; +import java.util.Map; +import java.util.AbstractMap; + +public class ArrayOfArrayOfNumberOnlyTest { + static final SchemaConfiguration configuration = new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().format().build()); +} diff --git a/samples/client/petstore/kotlin/src/test/kotlin/org/openapijsonschematools/client/components/schemas/ArrayOfEnumsTest.kt b/samples/client/petstore/kotlin/src/test/kotlin/org/openapijsonschematools/client/components/schemas/ArrayOfEnumsTest.kt new file mode 100644 index 00000000000..6e9a30567d4 --- /dev/null +++ b/samples/client/petstore/kotlin/src/test/kotlin/org/openapijsonschematools/client/components/schemas/ArrayOfEnumsTest.kt @@ -0,0 +1,18 @@ +package org.openapijsonschematools.client.components.schemas; + +import org.junit.Assert; +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.MapUtils; +import org.checkerframework.checker.nullness.qual.Nullable; + +import java.util.Arrays; +import java.util.List; +import java.util.Map; +import java.util.AbstractMap; + +public class ArrayOfEnumsTest { + static final SchemaConfiguration configuration = new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().format().build()); +} diff --git a/samples/client/petstore/kotlin/src/test/kotlin/org/openapijsonschematools/client/components/schemas/ArrayOfNumberOnlyTest.kt b/samples/client/petstore/kotlin/src/test/kotlin/org/openapijsonschematools/client/components/schemas/ArrayOfNumberOnlyTest.kt new file mode 100644 index 00000000000..46360228172 --- /dev/null +++ b/samples/client/petstore/kotlin/src/test/kotlin/org/openapijsonschematools/client/components/schemas/ArrayOfNumberOnlyTest.kt @@ -0,0 +1,18 @@ +package org.openapijsonschematools.client.components.schemas; + +import org.junit.Assert; +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.MapUtils; +import org.checkerframework.checker.nullness.qual.Nullable; + +import java.util.Arrays; +import java.util.List; +import java.util.Map; +import java.util.AbstractMap; + +public class ArrayOfNumberOnlyTest { + static final SchemaConfiguration configuration = new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().format().build()); +} diff --git a/samples/client/petstore/kotlin/src/test/kotlin/org/openapijsonschematools/client/components/schemas/ArrayTestTest.kt b/samples/client/petstore/kotlin/src/test/kotlin/org/openapijsonschematools/client/components/schemas/ArrayTestTest.kt new file mode 100644 index 00000000000..d4f5c35dbad --- /dev/null +++ b/samples/client/petstore/kotlin/src/test/kotlin/org/openapijsonschematools/client/components/schemas/ArrayTestTest.kt @@ -0,0 +1,18 @@ +package org.openapijsonschematools.client.components.schemas; + +import org.junit.Assert; +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.MapUtils; +import org.checkerframework.checker.nullness.qual.Nullable; + +import java.util.Arrays; +import java.util.List; +import java.util.Map; +import java.util.AbstractMap; + +public class ArrayTestTest { + static final SchemaConfiguration configuration = new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().format().build()); +} diff --git a/samples/client/petstore/kotlin/src/test/kotlin/org/openapijsonschematools/client/components/schemas/ArrayWithValidationsInItemsTest.kt b/samples/client/petstore/kotlin/src/test/kotlin/org/openapijsonschematools/client/components/schemas/ArrayWithValidationsInItemsTest.kt new file mode 100644 index 00000000000..8ac9ee9ecc6 --- /dev/null +++ b/samples/client/petstore/kotlin/src/test/kotlin/org/openapijsonschematools/client/components/schemas/ArrayWithValidationsInItemsTest.kt @@ -0,0 +1,18 @@ +package org.openapijsonschematools.client.components.schemas; + +import org.junit.Assert; +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.MapUtils; +import org.checkerframework.checker.nullness.qual.Nullable; + +import java.util.Arrays; +import java.util.List; +import java.util.Map; +import java.util.AbstractMap; + +public class ArrayWithValidationsInItemsTest { + static final SchemaConfiguration configuration = new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().format().build()); +} diff --git a/samples/client/petstore/kotlin/src/test/kotlin/org/openapijsonschematools/client/components/schemas/BananaReqTest.kt b/samples/client/petstore/kotlin/src/test/kotlin/org/openapijsonschematools/client/components/schemas/BananaReqTest.kt new file mode 100644 index 00000000000..4031dcb9c5c --- /dev/null +++ b/samples/client/petstore/kotlin/src/test/kotlin/org/openapijsonschematools/client/components/schemas/BananaReqTest.kt @@ -0,0 +1,18 @@ +package org.openapijsonschematools.client.components.schemas; + +import org.junit.Assert; +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.MapUtils; +import org.checkerframework.checker.nullness.qual.Nullable; + +import java.util.Arrays; +import java.util.List; +import java.util.Map; +import java.util.AbstractMap; + +public class BananaReqTest { + static final SchemaConfiguration configuration = new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().format().build()); +} diff --git a/samples/client/petstore/kotlin/src/test/kotlin/org/openapijsonschematools/client/components/schemas/BananaTest.kt b/samples/client/petstore/kotlin/src/test/kotlin/org/openapijsonschematools/client/components/schemas/BananaTest.kt new file mode 100644 index 00000000000..aa0ff28a5fb --- /dev/null +++ b/samples/client/petstore/kotlin/src/test/kotlin/org/openapijsonschematools/client/components/schemas/BananaTest.kt @@ -0,0 +1,18 @@ +package org.openapijsonschematools.client.components.schemas; + +import org.junit.Assert; +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.MapUtils; +import org.checkerframework.checker.nullness.qual.Nullable; + +import java.util.Arrays; +import java.util.List; +import java.util.Map; +import java.util.AbstractMap; + +public class BananaTest { + static final SchemaConfiguration configuration = new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().format().build()); +} diff --git a/samples/client/petstore/kotlin/src/test/kotlin/org/openapijsonschematools/client/components/schemas/BarTest.kt b/samples/client/petstore/kotlin/src/test/kotlin/org/openapijsonschematools/client/components/schemas/BarTest.kt new file mode 100644 index 00000000000..0952ffc44fc --- /dev/null +++ b/samples/client/petstore/kotlin/src/test/kotlin/org/openapijsonschematools/client/components/schemas/BarTest.kt @@ -0,0 +1,18 @@ +package org.openapijsonschematools.client.components.schemas; + +import org.junit.Assert; +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.MapUtils; +import org.checkerframework.checker.nullness.qual.Nullable; + +import java.util.Arrays; +import java.util.List; +import java.util.Map; +import java.util.AbstractMap; + +public class BarTest { + static final SchemaConfiguration configuration = new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().format().build()); +} diff --git a/samples/client/petstore/kotlin/src/test/kotlin/org/openapijsonschematools/client/components/schemas/BasquePigTest.kt b/samples/client/petstore/kotlin/src/test/kotlin/org/openapijsonschematools/client/components/schemas/BasquePigTest.kt new file mode 100644 index 00000000000..c35138daf52 --- /dev/null +++ b/samples/client/petstore/kotlin/src/test/kotlin/org/openapijsonschematools/client/components/schemas/BasquePigTest.kt @@ -0,0 +1,18 @@ +package org.openapijsonschematools.client.components.schemas; + +import org.junit.Assert; +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.MapUtils; +import org.checkerframework.checker.nullness.qual.Nullable; + +import java.util.Arrays; +import java.util.List; +import java.util.Map; +import java.util.AbstractMap; + +public class BasquePigTest { + static final SchemaConfiguration configuration = new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().format().build()); +} diff --git a/samples/client/petstore/kotlin/src/test/kotlin/org/openapijsonschematools/client/components/schemas/BooleanEnumTest.kt b/samples/client/petstore/kotlin/src/test/kotlin/org/openapijsonschematools/client/components/schemas/BooleanEnumTest.kt new file mode 100644 index 00000000000..09beec02136 --- /dev/null +++ b/samples/client/petstore/kotlin/src/test/kotlin/org/openapijsonschematools/client/components/schemas/BooleanEnumTest.kt @@ -0,0 +1,18 @@ +package org.openapijsonschematools.client.components.schemas; + +import org.junit.Assert; +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.MapUtils; +import org.checkerframework.checker.nullness.qual.Nullable; + +import java.util.Arrays; +import java.util.List; +import java.util.Map; +import java.util.AbstractMap; + +public class BooleanEnumTest { + static final SchemaConfiguration configuration = new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().format().build()); +} diff --git a/samples/client/petstore/kotlin/src/test/kotlin/org/openapijsonschematools/client/components/schemas/BooleanSchemaTest.kt b/samples/client/petstore/kotlin/src/test/kotlin/org/openapijsonschematools/client/components/schemas/BooleanSchemaTest.kt new file mode 100644 index 00000000000..ba183196bcd --- /dev/null +++ b/samples/client/petstore/kotlin/src/test/kotlin/org/openapijsonschematools/client/components/schemas/BooleanSchemaTest.kt @@ -0,0 +1,18 @@ +package org.openapijsonschematools.client.components.schemas; + +import org.junit.Assert; +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.MapUtils; +import org.checkerframework.checker.nullness.qual.Nullable; + +import java.util.Arrays; +import java.util.List; +import java.util.Map; +import java.util.AbstractMap; + +public class BooleanSchemaTest { + static final SchemaConfiguration configuration = new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().format().build()); +} diff --git a/samples/client/petstore/kotlin/src/test/kotlin/org/openapijsonschematools/client/components/schemas/CapitalizationTest.kt b/samples/client/petstore/kotlin/src/test/kotlin/org/openapijsonschematools/client/components/schemas/CapitalizationTest.kt new file mode 100644 index 00000000000..37056fa373e --- /dev/null +++ b/samples/client/petstore/kotlin/src/test/kotlin/org/openapijsonschematools/client/components/schemas/CapitalizationTest.kt @@ -0,0 +1,18 @@ +package org.openapijsonschematools.client.components.schemas; + +import org.junit.Assert; +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.MapUtils; +import org.checkerframework.checker.nullness.qual.Nullable; + +import java.util.Arrays; +import java.util.List; +import java.util.Map; +import java.util.AbstractMap; + +public class CapitalizationTest { + static final SchemaConfiguration configuration = new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().format().build()); +} diff --git a/samples/client/petstore/kotlin/src/test/kotlin/org/openapijsonschematools/client/components/schemas/CatTest.kt b/samples/client/petstore/kotlin/src/test/kotlin/org/openapijsonschematools/client/components/schemas/CatTest.kt new file mode 100644 index 00000000000..1dca84b8c97 --- /dev/null +++ b/samples/client/petstore/kotlin/src/test/kotlin/org/openapijsonschematools/client/components/schemas/CatTest.kt @@ -0,0 +1,18 @@ +package org.openapijsonschematools.client.components.schemas; + +import org.junit.Assert; +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.MapUtils; +import org.checkerframework.checker.nullness.qual.Nullable; + +import java.util.Arrays; +import java.util.List; +import java.util.Map; +import java.util.AbstractMap; + +public class CatTest { + static final SchemaConfiguration configuration = new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().format().build()); +} diff --git a/samples/client/petstore/kotlin/src/test/kotlin/org/openapijsonschematools/client/components/schemas/CategoryTest.kt b/samples/client/petstore/kotlin/src/test/kotlin/org/openapijsonschematools/client/components/schemas/CategoryTest.kt new file mode 100644 index 00000000000..884a6476615 --- /dev/null +++ b/samples/client/petstore/kotlin/src/test/kotlin/org/openapijsonschematools/client/components/schemas/CategoryTest.kt @@ -0,0 +1,18 @@ +package org.openapijsonschematools.client.components.schemas; + +import org.junit.Assert; +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.MapUtils; +import org.checkerframework.checker.nullness.qual.Nullable; + +import java.util.Arrays; +import java.util.List; +import java.util.Map; +import java.util.AbstractMap; + +public class CategoryTest { + static final SchemaConfiguration configuration = new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().format().build()); +} diff --git a/samples/client/petstore/kotlin/src/test/kotlin/org/openapijsonschematools/client/components/schemas/ChildCatTest.kt b/samples/client/petstore/kotlin/src/test/kotlin/org/openapijsonschematools/client/components/schemas/ChildCatTest.kt new file mode 100644 index 00000000000..79248832dc9 --- /dev/null +++ b/samples/client/petstore/kotlin/src/test/kotlin/org/openapijsonschematools/client/components/schemas/ChildCatTest.kt @@ -0,0 +1,18 @@ +package org.openapijsonschematools.client.components.schemas; + +import org.junit.Assert; +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.MapUtils; +import org.checkerframework.checker.nullness.qual.Nullable; + +import java.util.Arrays; +import java.util.List; +import java.util.Map; +import java.util.AbstractMap; + +public class ChildCatTest { + static final SchemaConfiguration configuration = new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().format().build()); +} diff --git a/samples/client/petstore/kotlin/src/test/kotlin/org/openapijsonschematools/client/components/schemas/ClassModelTest.kt b/samples/client/petstore/kotlin/src/test/kotlin/org/openapijsonschematools/client/components/schemas/ClassModelTest.kt new file mode 100644 index 00000000000..be07f306c54 --- /dev/null +++ b/samples/client/petstore/kotlin/src/test/kotlin/org/openapijsonschematools/client/components/schemas/ClassModelTest.kt @@ -0,0 +1,18 @@ +package org.openapijsonschematools.client.components.schemas; + +import org.junit.Assert; +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.MapUtils; +import org.checkerframework.checker.nullness.qual.Nullable; + +import java.util.Arrays; +import java.util.List; +import java.util.Map; +import java.util.AbstractMap; + +public class ClassModelTest { + static final SchemaConfiguration configuration = new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().format().build()); +} diff --git a/samples/client/petstore/kotlin/src/test/kotlin/org/openapijsonschematools/client/components/schemas/ClientTest.kt b/samples/client/petstore/kotlin/src/test/kotlin/org/openapijsonschematools/client/components/schemas/ClientTest.kt new file mode 100644 index 00000000000..8f798029f4f --- /dev/null +++ b/samples/client/petstore/kotlin/src/test/kotlin/org/openapijsonschematools/client/components/schemas/ClientTest.kt @@ -0,0 +1,18 @@ +package org.openapijsonschematools.client.components.schemas; + +import org.junit.Assert; +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.MapUtils; +import org.checkerframework.checker.nullness.qual.Nullable; + +import java.util.Arrays; +import java.util.List; +import java.util.Map; +import java.util.AbstractMap; + +public class ClientTest { + static final SchemaConfiguration configuration = new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().format().build()); +} diff --git a/samples/client/petstore/kotlin/src/test/kotlin/org/openapijsonschematools/client/components/schemas/ComplexQuadrilateralTest.kt b/samples/client/petstore/kotlin/src/test/kotlin/org/openapijsonschematools/client/components/schemas/ComplexQuadrilateralTest.kt new file mode 100644 index 00000000000..a511c075f80 --- /dev/null +++ b/samples/client/petstore/kotlin/src/test/kotlin/org/openapijsonschematools/client/components/schemas/ComplexQuadrilateralTest.kt @@ -0,0 +1,18 @@ +package org.openapijsonschematools.client.components.schemas; + +import org.junit.Assert; +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.MapUtils; +import org.checkerframework.checker.nullness.qual.Nullable; + +import java.util.Arrays; +import java.util.List; +import java.util.Map; +import java.util.AbstractMap; + +public class ComplexQuadrilateralTest { + static final SchemaConfiguration configuration = new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().format().build()); +} diff --git a/samples/client/petstore/kotlin/src/test/kotlin/org/openapijsonschematools/client/components/schemas/ComposedAnyOfDifferentTypesNoValidationsTest.kt b/samples/client/petstore/kotlin/src/test/kotlin/org/openapijsonschematools/client/components/schemas/ComposedAnyOfDifferentTypesNoValidationsTest.kt new file mode 100644 index 00000000000..867b1ef54a2 --- /dev/null +++ b/samples/client/petstore/kotlin/src/test/kotlin/org/openapijsonschematools/client/components/schemas/ComposedAnyOfDifferentTypesNoValidationsTest.kt @@ -0,0 +1,18 @@ +package org.openapijsonschematools.client.components.schemas; + +import org.junit.Assert; +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.MapUtils; +import org.checkerframework.checker.nullness.qual.Nullable; + +import java.util.Arrays; +import java.util.List; +import java.util.Map; +import java.util.AbstractMap; + +public class ComposedAnyOfDifferentTypesNoValidationsTest { + static final SchemaConfiguration configuration = new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().format().build()); +} diff --git a/samples/client/petstore/kotlin/src/test/kotlin/org/openapijsonschematools/client/components/schemas/ComposedArrayTest.kt b/samples/client/petstore/kotlin/src/test/kotlin/org/openapijsonschematools/client/components/schemas/ComposedArrayTest.kt new file mode 100644 index 00000000000..88b3b85df5c --- /dev/null +++ b/samples/client/petstore/kotlin/src/test/kotlin/org/openapijsonschematools/client/components/schemas/ComposedArrayTest.kt @@ -0,0 +1,18 @@ +package org.openapijsonschematools.client.components.schemas; + +import org.junit.Assert; +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.MapUtils; +import org.checkerframework.checker.nullness.qual.Nullable; + +import java.util.Arrays; +import java.util.List; +import java.util.Map; +import java.util.AbstractMap; + +public class ComposedArrayTest { + static final SchemaConfiguration configuration = new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().format().build()); +} diff --git a/samples/client/petstore/kotlin/src/test/kotlin/org/openapijsonschematools/client/components/schemas/ComposedBoolTest.kt b/samples/client/petstore/kotlin/src/test/kotlin/org/openapijsonschematools/client/components/schemas/ComposedBoolTest.kt new file mode 100644 index 00000000000..a76023fc9b2 --- /dev/null +++ b/samples/client/petstore/kotlin/src/test/kotlin/org/openapijsonschematools/client/components/schemas/ComposedBoolTest.kt @@ -0,0 +1,18 @@ +package org.openapijsonschematools.client.components.schemas; + +import org.junit.Assert; +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.MapUtils; +import org.checkerframework.checker.nullness.qual.Nullable; + +import java.util.Arrays; +import java.util.List; +import java.util.Map; +import java.util.AbstractMap; + +public class ComposedBoolTest { + static final SchemaConfiguration configuration = new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().format().build()); +} diff --git a/samples/client/petstore/kotlin/src/test/kotlin/org/openapijsonschematools/client/components/schemas/ComposedNoneTest.kt b/samples/client/petstore/kotlin/src/test/kotlin/org/openapijsonschematools/client/components/schemas/ComposedNoneTest.kt new file mode 100644 index 00000000000..0ccbf3b44f9 --- /dev/null +++ b/samples/client/petstore/kotlin/src/test/kotlin/org/openapijsonschematools/client/components/schemas/ComposedNoneTest.kt @@ -0,0 +1,18 @@ +package org.openapijsonschematools.client.components.schemas; + +import org.junit.Assert; +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.MapUtils; +import org.checkerframework.checker.nullness.qual.Nullable; + +import java.util.Arrays; +import java.util.List; +import java.util.Map; +import java.util.AbstractMap; + +public class ComposedNoneTest { + static final SchemaConfiguration configuration = new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().format().build()); +} diff --git a/samples/client/petstore/kotlin/src/test/kotlin/org/openapijsonschematools/client/components/schemas/ComposedNumberTest.kt b/samples/client/petstore/kotlin/src/test/kotlin/org/openapijsonschematools/client/components/schemas/ComposedNumberTest.kt new file mode 100644 index 00000000000..a410679ea58 --- /dev/null +++ b/samples/client/petstore/kotlin/src/test/kotlin/org/openapijsonschematools/client/components/schemas/ComposedNumberTest.kt @@ -0,0 +1,18 @@ +package org.openapijsonschematools.client.components.schemas; + +import org.junit.Assert; +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.MapUtils; +import org.checkerframework.checker.nullness.qual.Nullable; + +import java.util.Arrays; +import java.util.List; +import java.util.Map; +import java.util.AbstractMap; + +public class ComposedNumberTest { + static final SchemaConfiguration configuration = new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().format().build()); +} diff --git a/samples/client/petstore/kotlin/src/test/kotlin/org/openapijsonschematools/client/components/schemas/ComposedObjectTest.kt b/samples/client/petstore/kotlin/src/test/kotlin/org/openapijsonschematools/client/components/schemas/ComposedObjectTest.kt new file mode 100644 index 00000000000..0aacfd84f50 --- /dev/null +++ b/samples/client/petstore/kotlin/src/test/kotlin/org/openapijsonschematools/client/components/schemas/ComposedObjectTest.kt @@ -0,0 +1,18 @@ +package org.openapijsonschematools.client.components.schemas; + +import org.junit.Assert; +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.MapUtils; +import org.checkerframework.checker.nullness.qual.Nullable; + +import java.util.Arrays; +import java.util.List; +import java.util.Map; +import java.util.AbstractMap; + +public class ComposedObjectTest { + static final SchemaConfiguration configuration = new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().format().build()); +} diff --git a/samples/client/petstore/kotlin/src/test/kotlin/org/openapijsonschematools/client/components/schemas/ComposedOneOfDifferentTypesTest.kt b/samples/client/petstore/kotlin/src/test/kotlin/org/openapijsonschematools/client/components/schemas/ComposedOneOfDifferentTypesTest.kt new file mode 100644 index 00000000000..8c630e0b5cd --- /dev/null +++ b/samples/client/petstore/kotlin/src/test/kotlin/org/openapijsonschematools/client/components/schemas/ComposedOneOfDifferentTypesTest.kt @@ -0,0 +1,18 @@ +package org.openapijsonschematools.client.components.schemas; + +import org.junit.Assert; +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.MapUtils; +import org.checkerframework.checker.nullness.qual.Nullable; + +import java.util.Arrays; +import java.util.List; +import java.util.Map; +import java.util.AbstractMap; + +public class ComposedOneOfDifferentTypesTest { + static final SchemaConfiguration configuration = new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().format().build()); +} diff --git a/samples/client/petstore/kotlin/src/test/kotlin/org/openapijsonschematools/client/components/schemas/ComposedStringTest.kt b/samples/client/petstore/kotlin/src/test/kotlin/org/openapijsonschematools/client/components/schemas/ComposedStringTest.kt new file mode 100644 index 00000000000..b9be19bd3cf --- /dev/null +++ b/samples/client/petstore/kotlin/src/test/kotlin/org/openapijsonschematools/client/components/schemas/ComposedStringTest.kt @@ -0,0 +1,18 @@ +package org.openapijsonschematools.client.components.schemas; + +import org.junit.Assert; +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.MapUtils; +import org.checkerframework.checker.nullness.qual.Nullable; + +import java.util.Arrays; +import java.util.List; +import java.util.Map; +import java.util.AbstractMap; + +public class ComposedStringTest { + static final SchemaConfiguration configuration = new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().format().build()); +} diff --git a/samples/client/petstore/kotlin/src/test/kotlin/org/openapijsonschematools/client/components/schemas/CurrencyTest.kt b/samples/client/petstore/kotlin/src/test/kotlin/org/openapijsonschematools/client/components/schemas/CurrencyTest.kt new file mode 100644 index 00000000000..a262a65cde1 --- /dev/null +++ b/samples/client/petstore/kotlin/src/test/kotlin/org/openapijsonschematools/client/components/schemas/CurrencyTest.kt @@ -0,0 +1,18 @@ +package org.openapijsonschematools.client.components.schemas; + +import org.junit.Assert; +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.MapUtils; +import org.checkerframework.checker.nullness.qual.Nullable; + +import java.util.Arrays; +import java.util.List; +import java.util.Map; +import java.util.AbstractMap; + +public class CurrencyTest { + static final SchemaConfiguration configuration = new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().format().build()); +} diff --git a/samples/client/petstore/kotlin/src/test/kotlin/org/openapijsonschematools/client/components/schemas/DanishPigTest.kt b/samples/client/petstore/kotlin/src/test/kotlin/org/openapijsonschematools/client/components/schemas/DanishPigTest.kt new file mode 100644 index 00000000000..327ffa70e1e --- /dev/null +++ b/samples/client/petstore/kotlin/src/test/kotlin/org/openapijsonschematools/client/components/schemas/DanishPigTest.kt @@ -0,0 +1,18 @@ +package org.openapijsonschematools.client.components.schemas; + +import org.junit.Assert; +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.MapUtils; +import org.checkerframework.checker.nullness.qual.Nullable; + +import java.util.Arrays; +import java.util.List; +import java.util.Map; +import java.util.AbstractMap; + +public class DanishPigTest { + static final SchemaConfiguration configuration = new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().format().build()); +} diff --git a/samples/client/petstore/kotlin/src/test/kotlin/org/openapijsonschematools/client/components/schemas/DateTimeTestTest.kt b/samples/client/petstore/kotlin/src/test/kotlin/org/openapijsonschematools/client/components/schemas/DateTimeTestTest.kt new file mode 100644 index 00000000000..383bdc5fee1 --- /dev/null +++ b/samples/client/petstore/kotlin/src/test/kotlin/org/openapijsonschematools/client/components/schemas/DateTimeTestTest.kt @@ -0,0 +1,18 @@ +package org.openapijsonschematools.client.components.schemas; + +import org.junit.Assert; +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.MapUtils; +import org.checkerframework.checker.nullness.qual.Nullable; + +import java.util.Arrays; +import java.util.List; +import java.util.Map; +import java.util.AbstractMap; + +public class DateTimeTestTest { + static final SchemaConfiguration configuration = new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().format().build()); +} diff --git a/samples/client/petstore/kotlin/src/test/kotlin/org/openapijsonschematools/client/components/schemas/DateTimeWithValidationsTest.kt b/samples/client/petstore/kotlin/src/test/kotlin/org/openapijsonschematools/client/components/schemas/DateTimeWithValidationsTest.kt new file mode 100644 index 00000000000..c7f15d7866b --- /dev/null +++ b/samples/client/petstore/kotlin/src/test/kotlin/org/openapijsonschematools/client/components/schemas/DateTimeWithValidationsTest.kt @@ -0,0 +1,18 @@ +package org.openapijsonschematools.client.components.schemas; + +import org.junit.Assert; +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.MapUtils; +import org.checkerframework.checker.nullness.qual.Nullable; + +import java.util.Arrays; +import java.util.List; +import java.util.Map; +import java.util.AbstractMap; + +public class DateTimeWithValidationsTest { + static final SchemaConfiguration configuration = new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().format().build()); +} diff --git a/samples/client/petstore/kotlin/src/test/kotlin/org/openapijsonschematools/client/components/schemas/DateWithValidationsTest.kt b/samples/client/petstore/kotlin/src/test/kotlin/org/openapijsonschematools/client/components/schemas/DateWithValidationsTest.kt new file mode 100644 index 00000000000..cec992f3cd6 --- /dev/null +++ b/samples/client/petstore/kotlin/src/test/kotlin/org/openapijsonschematools/client/components/schemas/DateWithValidationsTest.kt @@ -0,0 +1,18 @@ +package org.openapijsonschematools.client.components.schemas; + +import org.junit.Assert; +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.MapUtils; +import org.checkerframework.checker.nullness.qual.Nullable; + +import java.util.Arrays; +import java.util.List; +import java.util.Map; +import java.util.AbstractMap; + +public class DateWithValidationsTest { + static final SchemaConfiguration configuration = new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().format().build()); +} diff --git a/samples/client/petstore/kotlin/src/test/kotlin/org/openapijsonschematools/client/components/schemas/DecimalPayloadTest.kt b/samples/client/petstore/kotlin/src/test/kotlin/org/openapijsonschematools/client/components/schemas/DecimalPayloadTest.kt new file mode 100644 index 00000000000..450ac6beb0e --- /dev/null +++ b/samples/client/petstore/kotlin/src/test/kotlin/org/openapijsonschematools/client/components/schemas/DecimalPayloadTest.kt @@ -0,0 +1,18 @@ +package org.openapijsonschematools.client.components.schemas; + +import org.junit.Assert; +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.MapUtils; +import org.checkerframework.checker.nullness.qual.Nullable; + +import java.util.Arrays; +import java.util.List; +import java.util.Map; +import java.util.AbstractMap; + +public class DecimalPayloadTest { + static final SchemaConfiguration configuration = new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().format().build()); +} diff --git a/samples/client/petstore/kotlin/src/test/kotlin/org/openapijsonschematools/client/components/schemas/DogTest.kt b/samples/client/petstore/kotlin/src/test/kotlin/org/openapijsonschematools/client/components/schemas/DogTest.kt new file mode 100644 index 00000000000..1698e6b82ad --- /dev/null +++ b/samples/client/petstore/kotlin/src/test/kotlin/org/openapijsonschematools/client/components/schemas/DogTest.kt @@ -0,0 +1,18 @@ +package org.openapijsonschematools.client.components.schemas; + +import org.junit.Assert; +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.MapUtils; +import org.checkerframework.checker.nullness.qual.Nullable; + +import java.util.Arrays; +import java.util.List; +import java.util.Map; +import java.util.AbstractMap; + +public class DogTest { + static final SchemaConfiguration configuration = new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().format().build()); +} diff --git a/samples/client/petstore/kotlin/src/test/kotlin/org/openapijsonschematools/client/components/schemas/DrawingTest.kt b/samples/client/petstore/kotlin/src/test/kotlin/org/openapijsonschematools/client/components/schemas/DrawingTest.kt new file mode 100644 index 00000000000..9589e7e326f --- /dev/null +++ b/samples/client/petstore/kotlin/src/test/kotlin/org/openapijsonschematools/client/components/schemas/DrawingTest.kt @@ -0,0 +1,18 @@ +package org.openapijsonschematools.client.components.schemas; + +import org.junit.Assert; +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.MapUtils; +import org.checkerframework.checker.nullness.qual.Nullable; + +import java.util.Arrays; +import java.util.List; +import java.util.Map; +import java.util.AbstractMap; + +public class DrawingTest { + static final SchemaConfiguration configuration = new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().format().build()); +} diff --git a/samples/client/petstore/kotlin/src/test/kotlin/org/openapijsonschematools/client/components/schemas/EnumArraysTest.kt b/samples/client/petstore/kotlin/src/test/kotlin/org/openapijsonschematools/client/components/schemas/EnumArraysTest.kt new file mode 100644 index 00000000000..9bfba584c0c --- /dev/null +++ b/samples/client/petstore/kotlin/src/test/kotlin/org/openapijsonschematools/client/components/schemas/EnumArraysTest.kt @@ -0,0 +1,18 @@ +package org.openapijsonschematools.client.components.schemas; + +import org.junit.Assert; +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.MapUtils; +import org.checkerframework.checker.nullness.qual.Nullable; + +import java.util.Arrays; +import java.util.List; +import java.util.Map; +import java.util.AbstractMap; + +public class EnumArraysTest { + static final SchemaConfiguration configuration = new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().format().build()); +} diff --git a/samples/client/petstore/kotlin/src/test/kotlin/org/openapijsonschematools/client/components/schemas/EnumClassTest.kt b/samples/client/petstore/kotlin/src/test/kotlin/org/openapijsonschematools/client/components/schemas/EnumClassTest.kt new file mode 100644 index 00000000000..2202d623476 --- /dev/null +++ b/samples/client/petstore/kotlin/src/test/kotlin/org/openapijsonschematools/client/components/schemas/EnumClassTest.kt @@ -0,0 +1,18 @@ +package org.openapijsonschematools.client.components.schemas; + +import org.junit.Assert; +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.MapUtils; +import org.checkerframework.checker.nullness.qual.Nullable; + +import java.util.Arrays; +import java.util.List; +import java.util.Map; +import java.util.AbstractMap; + +public class EnumClassTest { + static final SchemaConfiguration configuration = new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().format().build()); +} diff --git a/samples/client/petstore/kotlin/src/test/kotlin/org/openapijsonschematools/client/components/schemas/EnumTestTest.kt b/samples/client/petstore/kotlin/src/test/kotlin/org/openapijsonschematools/client/components/schemas/EnumTestTest.kt new file mode 100644 index 00000000000..9676b34d4ce --- /dev/null +++ b/samples/client/petstore/kotlin/src/test/kotlin/org/openapijsonschematools/client/components/schemas/EnumTestTest.kt @@ -0,0 +1,18 @@ +package org.openapijsonschematools.client.components.schemas; + +import org.junit.Assert; +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.MapUtils; +import org.checkerframework.checker.nullness.qual.Nullable; + +import java.util.Arrays; +import java.util.List; +import java.util.Map; +import java.util.AbstractMap; + +public class EnumTestTest { + static final SchemaConfiguration configuration = new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().format().build()); +} diff --git a/samples/client/petstore/kotlin/src/test/kotlin/org/openapijsonschematools/client/components/schemas/EquilateralTriangleTest.kt b/samples/client/petstore/kotlin/src/test/kotlin/org/openapijsonschematools/client/components/schemas/EquilateralTriangleTest.kt new file mode 100644 index 00000000000..6d75d2d7e3b --- /dev/null +++ b/samples/client/petstore/kotlin/src/test/kotlin/org/openapijsonschematools/client/components/schemas/EquilateralTriangleTest.kt @@ -0,0 +1,18 @@ +package org.openapijsonschematools.client.components.schemas; + +import org.junit.Assert; +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.MapUtils; +import org.checkerframework.checker.nullness.qual.Nullable; + +import java.util.Arrays; +import java.util.List; +import java.util.Map; +import java.util.AbstractMap; + +public class EquilateralTriangleTest { + static final SchemaConfiguration configuration = new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().format().build()); +} diff --git a/samples/client/petstore/kotlin/src/test/kotlin/org/openapijsonschematools/client/components/schemas/FileSchemaTestClassTest.kt b/samples/client/petstore/kotlin/src/test/kotlin/org/openapijsonschematools/client/components/schemas/FileSchemaTestClassTest.kt new file mode 100644 index 00000000000..1d5bc8b29f5 --- /dev/null +++ b/samples/client/petstore/kotlin/src/test/kotlin/org/openapijsonschematools/client/components/schemas/FileSchemaTestClassTest.kt @@ -0,0 +1,18 @@ +package org.openapijsonschematools.client.components.schemas; + +import org.junit.Assert; +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.MapUtils; +import org.checkerframework.checker.nullness.qual.Nullable; + +import java.util.Arrays; +import java.util.List; +import java.util.Map; +import java.util.AbstractMap; + +public class FileSchemaTestClassTest { + static final SchemaConfiguration configuration = new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().format().build()); +} diff --git a/samples/client/petstore/kotlin/src/test/kotlin/org/openapijsonschematools/client/components/schemas/FileTest.kt b/samples/client/petstore/kotlin/src/test/kotlin/org/openapijsonschematools/client/components/schemas/FileTest.kt new file mode 100644 index 00000000000..54ce06dc444 --- /dev/null +++ b/samples/client/petstore/kotlin/src/test/kotlin/org/openapijsonschematools/client/components/schemas/FileTest.kt @@ -0,0 +1,18 @@ +package org.openapijsonschematools.client.components.schemas; + +import org.junit.Assert; +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.MapUtils; +import org.checkerframework.checker.nullness.qual.Nullable; + +import java.util.Arrays; +import java.util.List; +import java.util.Map; +import java.util.AbstractMap; + +public class FileTest { + static final SchemaConfiguration configuration = new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().format().build()); +} diff --git a/samples/client/petstore/kotlin/src/test/kotlin/org/openapijsonschematools/client/components/schemas/FooTest.kt b/samples/client/petstore/kotlin/src/test/kotlin/org/openapijsonschematools/client/components/schemas/FooTest.kt new file mode 100644 index 00000000000..2feb1595fc9 --- /dev/null +++ b/samples/client/petstore/kotlin/src/test/kotlin/org/openapijsonschematools/client/components/schemas/FooTest.kt @@ -0,0 +1,18 @@ +package org.openapijsonschematools.client.components.schemas; + +import org.junit.Assert; +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.MapUtils; +import org.checkerframework.checker.nullness.qual.Nullable; + +import java.util.Arrays; +import java.util.List; +import java.util.Map; +import java.util.AbstractMap; + +public class FooTest { + static final SchemaConfiguration configuration = new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().format().build()); +} diff --git a/samples/client/petstore/kotlin/src/test/kotlin/org/openapijsonschematools/client/components/schemas/FormatTestTest.kt b/samples/client/petstore/kotlin/src/test/kotlin/org/openapijsonschematools/client/components/schemas/FormatTestTest.kt new file mode 100644 index 00000000000..7d017bb8eef --- /dev/null +++ b/samples/client/petstore/kotlin/src/test/kotlin/org/openapijsonschematools/client/components/schemas/FormatTestTest.kt @@ -0,0 +1,18 @@ +package org.openapijsonschematools.client.components.schemas; + +import org.junit.Assert; +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.MapUtils; +import org.checkerframework.checker.nullness.qual.Nullable; + +import java.util.Arrays; +import java.util.List; +import java.util.Map; +import java.util.AbstractMap; + +public class FormatTestTest { + static final SchemaConfiguration configuration = new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().format().build()); +} diff --git a/samples/client/petstore/kotlin/src/test/kotlin/org/openapijsonschematools/client/components/schemas/FromSchemaTest.kt b/samples/client/petstore/kotlin/src/test/kotlin/org/openapijsonschematools/client/components/schemas/FromSchemaTest.kt new file mode 100644 index 00000000000..378ffb904f6 --- /dev/null +++ b/samples/client/petstore/kotlin/src/test/kotlin/org/openapijsonschematools/client/components/schemas/FromSchemaTest.kt @@ -0,0 +1,18 @@ +package org.openapijsonschematools.client.components.schemas; + +import org.junit.Assert; +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.MapUtils; +import org.checkerframework.checker.nullness.qual.Nullable; + +import java.util.Arrays; +import java.util.List; +import java.util.Map; +import java.util.AbstractMap; + +public class FromSchemaTest { + static final SchemaConfiguration configuration = new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().format().build()); +} diff --git a/samples/client/petstore/kotlin/src/test/kotlin/org/openapijsonschematools/client/components/schemas/FruitReqTest.kt b/samples/client/petstore/kotlin/src/test/kotlin/org/openapijsonschematools/client/components/schemas/FruitReqTest.kt new file mode 100644 index 00000000000..f299cf8cbbb --- /dev/null +++ b/samples/client/petstore/kotlin/src/test/kotlin/org/openapijsonschematools/client/components/schemas/FruitReqTest.kt @@ -0,0 +1,18 @@ +package org.openapijsonschematools.client.components.schemas; + +import org.junit.Assert; +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.MapUtils; +import org.checkerframework.checker.nullness.qual.Nullable; + +import java.util.Arrays; +import java.util.List; +import java.util.Map; +import java.util.AbstractMap; + +public class FruitReqTest { + static final SchemaConfiguration configuration = new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().format().build()); +} diff --git a/samples/client/petstore/kotlin/src/test/kotlin/org/openapijsonschematools/client/components/schemas/FruitTest.kt b/samples/client/petstore/kotlin/src/test/kotlin/org/openapijsonschematools/client/components/schemas/FruitTest.kt new file mode 100644 index 00000000000..9d6594733dd --- /dev/null +++ b/samples/client/petstore/kotlin/src/test/kotlin/org/openapijsonschematools/client/components/schemas/FruitTest.kt @@ -0,0 +1,18 @@ +package org.openapijsonschematools.client.components.schemas; + +import org.junit.Assert; +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.MapUtils; +import org.checkerframework.checker.nullness.qual.Nullable; + +import java.util.Arrays; +import java.util.List; +import java.util.Map; +import java.util.AbstractMap; + +public class FruitTest { + static final SchemaConfiguration configuration = new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().format().build()); +} diff --git a/samples/client/petstore/kotlin/src/test/kotlin/org/openapijsonschematools/client/components/schemas/GmFruitTest.kt b/samples/client/petstore/kotlin/src/test/kotlin/org/openapijsonschematools/client/components/schemas/GmFruitTest.kt new file mode 100644 index 00000000000..bf570ab57e6 --- /dev/null +++ b/samples/client/petstore/kotlin/src/test/kotlin/org/openapijsonschematools/client/components/schemas/GmFruitTest.kt @@ -0,0 +1,18 @@ +package org.openapijsonschematools.client.components.schemas; + +import org.junit.Assert; +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.MapUtils; +import org.checkerframework.checker.nullness.qual.Nullable; + +import java.util.Arrays; +import java.util.List; +import java.util.Map; +import java.util.AbstractMap; + +public class GmFruitTest { + static final SchemaConfiguration configuration = new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().format().build()); +} diff --git a/samples/client/petstore/kotlin/src/test/kotlin/org/openapijsonschematools/client/components/schemas/GrandparentAnimalTest.kt b/samples/client/petstore/kotlin/src/test/kotlin/org/openapijsonschematools/client/components/schemas/GrandparentAnimalTest.kt new file mode 100644 index 00000000000..930d4fe4049 --- /dev/null +++ b/samples/client/petstore/kotlin/src/test/kotlin/org/openapijsonschematools/client/components/schemas/GrandparentAnimalTest.kt @@ -0,0 +1,18 @@ +package org.openapijsonschematools.client.components.schemas; + +import org.junit.Assert; +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.MapUtils; +import org.checkerframework.checker.nullness.qual.Nullable; + +import java.util.Arrays; +import java.util.List; +import java.util.Map; +import java.util.AbstractMap; + +public class GrandparentAnimalTest { + static final SchemaConfiguration configuration = new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().format().build()); +} diff --git a/samples/client/petstore/kotlin/src/test/kotlin/org/openapijsonschematools/client/components/schemas/HasOnlyReadOnlyTest.kt b/samples/client/petstore/kotlin/src/test/kotlin/org/openapijsonschematools/client/components/schemas/HasOnlyReadOnlyTest.kt new file mode 100644 index 00000000000..3a286d0ff01 --- /dev/null +++ b/samples/client/petstore/kotlin/src/test/kotlin/org/openapijsonschematools/client/components/schemas/HasOnlyReadOnlyTest.kt @@ -0,0 +1,18 @@ +package org.openapijsonschematools.client.components.schemas; + +import org.junit.Assert; +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.MapUtils; +import org.checkerframework.checker.nullness.qual.Nullable; + +import java.util.Arrays; +import java.util.List; +import java.util.Map; +import java.util.AbstractMap; + +public class HasOnlyReadOnlyTest { + static final SchemaConfiguration configuration = new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().format().build()); +} diff --git a/samples/client/petstore/kotlin/src/test/kotlin/org/openapijsonschematools/client/components/schemas/HealthCheckResultTest.kt b/samples/client/petstore/kotlin/src/test/kotlin/org/openapijsonschematools/client/components/schemas/HealthCheckResultTest.kt new file mode 100644 index 00000000000..279d614f9fe --- /dev/null +++ b/samples/client/petstore/kotlin/src/test/kotlin/org/openapijsonschematools/client/components/schemas/HealthCheckResultTest.kt @@ -0,0 +1,18 @@ +package org.openapijsonschematools.client.components.schemas; + +import org.junit.Assert; +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.MapUtils; +import org.checkerframework.checker.nullness.qual.Nullable; + +import java.util.Arrays; +import java.util.List; +import java.util.Map; +import java.util.AbstractMap; + +public class HealthCheckResultTest { + static final SchemaConfiguration configuration = new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().format().build()); +} diff --git a/samples/client/petstore/kotlin/src/test/kotlin/org/openapijsonschematools/client/components/schemas/IntegerEnumBigTest.kt b/samples/client/petstore/kotlin/src/test/kotlin/org/openapijsonschematools/client/components/schemas/IntegerEnumBigTest.kt new file mode 100644 index 00000000000..77ed6c4d822 --- /dev/null +++ b/samples/client/petstore/kotlin/src/test/kotlin/org/openapijsonschematools/client/components/schemas/IntegerEnumBigTest.kt @@ -0,0 +1,18 @@ +package org.openapijsonschematools.client.components.schemas; + +import org.junit.Assert; +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.MapUtils; +import org.checkerframework.checker.nullness.qual.Nullable; + +import java.util.Arrays; +import java.util.List; +import java.util.Map; +import java.util.AbstractMap; + +public class IntegerEnumBigTest { + static final SchemaConfiguration configuration = new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().format().build()); +} diff --git a/samples/client/petstore/kotlin/src/test/kotlin/org/openapijsonschematools/client/components/schemas/IntegerEnumOneValueTest.kt b/samples/client/petstore/kotlin/src/test/kotlin/org/openapijsonschematools/client/components/schemas/IntegerEnumOneValueTest.kt new file mode 100644 index 00000000000..8a005624d3f --- /dev/null +++ b/samples/client/petstore/kotlin/src/test/kotlin/org/openapijsonschematools/client/components/schemas/IntegerEnumOneValueTest.kt @@ -0,0 +1,18 @@ +package org.openapijsonschematools.client.components.schemas; + +import org.junit.Assert; +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.MapUtils; +import org.checkerframework.checker.nullness.qual.Nullable; + +import java.util.Arrays; +import java.util.List; +import java.util.Map; +import java.util.AbstractMap; + +public class IntegerEnumOneValueTest { + static final SchemaConfiguration configuration = new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().format().build()); +} diff --git a/samples/client/petstore/kotlin/src/test/kotlin/org/openapijsonschematools/client/components/schemas/IntegerEnumTest.kt b/samples/client/petstore/kotlin/src/test/kotlin/org/openapijsonschematools/client/components/schemas/IntegerEnumTest.kt new file mode 100644 index 00000000000..898b123a094 --- /dev/null +++ b/samples/client/petstore/kotlin/src/test/kotlin/org/openapijsonschematools/client/components/schemas/IntegerEnumTest.kt @@ -0,0 +1,18 @@ +package org.openapijsonschematools.client.components.schemas; + +import org.junit.Assert; +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.MapUtils; +import org.checkerframework.checker.nullness.qual.Nullable; + +import java.util.Arrays; +import java.util.List; +import java.util.Map; +import java.util.AbstractMap; + +public class IntegerEnumTest { + static final SchemaConfiguration configuration = new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().format().build()); +} diff --git a/samples/client/petstore/kotlin/src/test/kotlin/org/openapijsonschematools/client/components/schemas/IntegerEnumWithDefaultValueTest.kt b/samples/client/petstore/kotlin/src/test/kotlin/org/openapijsonschematools/client/components/schemas/IntegerEnumWithDefaultValueTest.kt new file mode 100644 index 00000000000..df79ff7d437 --- /dev/null +++ b/samples/client/petstore/kotlin/src/test/kotlin/org/openapijsonschematools/client/components/schemas/IntegerEnumWithDefaultValueTest.kt @@ -0,0 +1,18 @@ +package org.openapijsonschematools.client.components.schemas; + +import org.junit.Assert; +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.MapUtils; +import org.checkerframework.checker.nullness.qual.Nullable; + +import java.util.Arrays; +import java.util.List; +import java.util.Map; +import java.util.AbstractMap; + +public class IntegerEnumWithDefaultValueTest { + static final SchemaConfiguration configuration = new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().format().build()); +} diff --git a/samples/client/petstore/kotlin/src/test/kotlin/org/openapijsonschematools/client/components/schemas/IntegerMax10Test.kt b/samples/client/petstore/kotlin/src/test/kotlin/org/openapijsonschematools/client/components/schemas/IntegerMax10Test.kt new file mode 100644 index 00000000000..4e809cd1c84 --- /dev/null +++ b/samples/client/petstore/kotlin/src/test/kotlin/org/openapijsonschematools/client/components/schemas/IntegerMax10Test.kt @@ -0,0 +1,18 @@ +package org.openapijsonschematools.client.components.schemas; + +import org.junit.Assert; +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.MapUtils; +import org.checkerframework.checker.nullness.qual.Nullable; + +import java.util.Arrays; +import java.util.List; +import java.util.Map; +import java.util.AbstractMap; + +public class IntegerMax10Test { + static final SchemaConfiguration configuration = new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().format().build()); +} diff --git a/samples/client/petstore/kotlin/src/test/kotlin/org/openapijsonschematools/client/components/schemas/IntegerMin15Test.kt b/samples/client/petstore/kotlin/src/test/kotlin/org/openapijsonschematools/client/components/schemas/IntegerMin15Test.kt new file mode 100644 index 00000000000..ead4611e53b --- /dev/null +++ b/samples/client/petstore/kotlin/src/test/kotlin/org/openapijsonschematools/client/components/schemas/IntegerMin15Test.kt @@ -0,0 +1,18 @@ +package org.openapijsonschematools.client.components.schemas; + +import org.junit.Assert; +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.MapUtils; +import org.checkerframework.checker.nullness.qual.Nullable; + +import java.util.Arrays; +import java.util.List; +import java.util.Map; +import java.util.AbstractMap; + +public class IntegerMin15Test { + static final SchemaConfiguration configuration = new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().format().build()); +} diff --git a/samples/client/petstore/kotlin/src/test/kotlin/org/openapijsonschematools/client/components/schemas/IsoscelesTriangleTest.kt b/samples/client/petstore/kotlin/src/test/kotlin/org/openapijsonschematools/client/components/schemas/IsoscelesTriangleTest.kt new file mode 100644 index 00000000000..7c0bd3d8ca2 --- /dev/null +++ b/samples/client/petstore/kotlin/src/test/kotlin/org/openapijsonschematools/client/components/schemas/IsoscelesTriangleTest.kt @@ -0,0 +1,18 @@ +package org.openapijsonschematools.client.components.schemas; + +import org.junit.Assert; +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.MapUtils; +import org.checkerframework.checker.nullness.qual.Nullable; + +import java.util.Arrays; +import java.util.List; +import java.util.Map; +import java.util.AbstractMap; + +public class IsoscelesTriangleTest { + static final SchemaConfiguration configuration = new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().format().build()); +} diff --git a/samples/client/petstore/kotlin/src/test/kotlin/org/openapijsonschematools/client/components/schemas/ItemsSchemaTest.kt b/samples/client/petstore/kotlin/src/test/kotlin/org/openapijsonschematools/client/components/schemas/ItemsSchemaTest.kt new file mode 100644 index 00000000000..e75838f4e6a --- /dev/null +++ b/samples/client/petstore/kotlin/src/test/kotlin/org/openapijsonschematools/client/components/schemas/ItemsSchemaTest.kt @@ -0,0 +1,18 @@ +package org.openapijsonschematools.client.components.schemas; + +import org.junit.Assert; +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.MapUtils; +import org.checkerframework.checker.nullness.qual.Nullable; + +import java.util.Arrays; +import java.util.List; +import java.util.Map; +import java.util.AbstractMap; + +public class ItemsSchemaTest { + static final SchemaConfiguration configuration = new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().format().build()); +} diff --git a/samples/client/petstore/kotlin/src/test/kotlin/org/openapijsonschematools/client/components/schemas/ItemsTest.kt b/samples/client/petstore/kotlin/src/test/kotlin/org/openapijsonschematools/client/components/schemas/ItemsTest.kt new file mode 100644 index 00000000000..d6d26bc51b1 --- /dev/null +++ b/samples/client/petstore/kotlin/src/test/kotlin/org/openapijsonschematools/client/components/schemas/ItemsTest.kt @@ -0,0 +1,18 @@ +package org.openapijsonschematools.client.components.schemas; + +import org.junit.Assert; +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.MapUtils; +import org.checkerframework.checker.nullness.qual.Nullable; + +import java.util.Arrays; +import java.util.List; +import java.util.Map; +import java.util.AbstractMap; + +public class ItemsTest { + static final SchemaConfiguration configuration = new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().format().build()); +} diff --git a/samples/client/petstore/kotlin/src/test/kotlin/org/openapijsonschematools/client/components/schemas/JSONPatchRequestAddReplaceTestTest.kt b/samples/client/petstore/kotlin/src/test/kotlin/org/openapijsonschematools/client/components/schemas/JSONPatchRequestAddReplaceTestTest.kt new file mode 100644 index 00000000000..7ac8dc5d85e --- /dev/null +++ b/samples/client/petstore/kotlin/src/test/kotlin/org/openapijsonschematools/client/components/schemas/JSONPatchRequestAddReplaceTestTest.kt @@ -0,0 +1,18 @@ +package org.openapijsonschematools.client.components.schemas; + +import org.junit.Assert; +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.MapUtils; +import org.checkerframework.checker.nullness.qual.Nullable; + +import java.util.Arrays; +import java.util.List; +import java.util.Map; +import java.util.AbstractMap; + +public class JSONPatchRequestAddReplaceTestTest { + static final SchemaConfiguration configuration = new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().format().build()); +} diff --git a/samples/client/petstore/kotlin/src/test/kotlin/org/openapijsonschematools/client/components/schemas/JSONPatchRequestMoveCopyTest.kt b/samples/client/petstore/kotlin/src/test/kotlin/org/openapijsonschematools/client/components/schemas/JSONPatchRequestMoveCopyTest.kt new file mode 100644 index 00000000000..8f01a7c1b97 --- /dev/null +++ b/samples/client/petstore/kotlin/src/test/kotlin/org/openapijsonschematools/client/components/schemas/JSONPatchRequestMoveCopyTest.kt @@ -0,0 +1,18 @@ +package org.openapijsonschematools.client.components.schemas; + +import org.junit.Assert; +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.MapUtils; +import org.checkerframework.checker.nullness.qual.Nullable; + +import java.util.Arrays; +import java.util.List; +import java.util.Map; +import java.util.AbstractMap; + +public class JSONPatchRequestMoveCopyTest { + static final SchemaConfiguration configuration = new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().format().build()); +} diff --git a/samples/client/petstore/kotlin/src/test/kotlin/org/openapijsonschematools/client/components/schemas/JSONPatchRequestRemoveTest.kt b/samples/client/petstore/kotlin/src/test/kotlin/org/openapijsonschematools/client/components/schemas/JSONPatchRequestRemoveTest.kt new file mode 100644 index 00000000000..d896defd64a --- /dev/null +++ b/samples/client/petstore/kotlin/src/test/kotlin/org/openapijsonschematools/client/components/schemas/JSONPatchRequestRemoveTest.kt @@ -0,0 +1,18 @@ +package org.openapijsonschematools.client.components.schemas; + +import org.junit.Assert; +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.MapUtils; +import org.checkerframework.checker.nullness.qual.Nullable; + +import java.util.Arrays; +import java.util.List; +import java.util.Map; +import java.util.AbstractMap; + +public class JSONPatchRequestRemoveTest { + static final SchemaConfiguration configuration = new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().format().build()); +} diff --git a/samples/client/petstore/kotlin/src/test/kotlin/org/openapijsonschematools/client/components/schemas/JSONPatchRequestTest.kt b/samples/client/petstore/kotlin/src/test/kotlin/org/openapijsonschematools/client/components/schemas/JSONPatchRequestTest.kt new file mode 100644 index 00000000000..64f57bc881e --- /dev/null +++ b/samples/client/petstore/kotlin/src/test/kotlin/org/openapijsonschematools/client/components/schemas/JSONPatchRequestTest.kt @@ -0,0 +1,18 @@ +package org.openapijsonschematools.client.components.schemas; + +import org.junit.Assert; +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.MapUtils; +import org.checkerframework.checker.nullness.qual.Nullable; + +import java.util.Arrays; +import java.util.List; +import java.util.Map; +import java.util.AbstractMap; + +public class JSONPatchRequestTest { + static final SchemaConfiguration configuration = new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().format().build()); +} diff --git a/samples/client/petstore/kotlin/src/test/kotlin/org/openapijsonschematools/client/components/schemas/MammalTest.kt b/samples/client/petstore/kotlin/src/test/kotlin/org/openapijsonschematools/client/components/schemas/MammalTest.kt new file mode 100644 index 00000000000..54525d02af1 --- /dev/null +++ b/samples/client/petstore/kotlin/src/test/kotlin/org/openapijsonschematools/client/components/schemas/MammalTest.kt @@ -0,0 +1,18 @@ +package org.openapijsonschematools.client.components.schemas; + +import org.junit.Assert; +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.MapUtils; +import org.checkerframework.checker.nullness.qual.Nullable; + +import java.util.Arrays; +import java.util.List; +import java.util.Map; +import java.util.AbstractMap; + +public class MammalTest { + static final SchemaConfiguration configuration = new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().format().build()); +} diff --git a/samples/client/petstore/kotlin/src/test/kotlin/org/openapijsonschematools/client/components/schemas/MapTestTest.kt b/samples/client/petstore/kotlin/src/test/kotlin/org/openapijsonschematools/client/components/schemas/MapTestTest.kt new file mode 100644 index 00000000000..3b8e6f70bfa --- /dev/null +++ b/samples/client/petstore/kotlin/src/test/kotlin/org/openapijsonschematools/client/components/schemas/MapTestTest.kt @@ -0,0 +1,18 @@ +package org.openapijsonschematools.client.components.schemas; + +import org.junit.Assert; +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.MapUtils; +import org.checkerframework.checker.nullness.qual.Nullable; + +import java.util.Arrays; +import java.util.List; +import java.util.Map; +import java.util.AbstractMap; + +public class MapTestTest { + static final SchemaConfiguration configuration = new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().format().build()); +} diff --git a/samples/client/petstore/kotlin/src/test/kotlin/org/openapijsonschematools/client/components/schemas/MixedPropertiesAndAdditionalPropertiesClassTest.kt b/samples/client/petstore/kotlin/src/test/kotlin/org/openapijsonschematools/client/components/schemas/MixedPropertiesAndAdditionalPropertiesClassTest.kt new file mode 100644 index 00000000000..64fd5bbbbc4 --- /dev/null +++ b/samples/client/petstore/kotlin/src/test/kotlin/org/openapijsonschematools/client/components/schemas/MixedPropertiesAndAdditionalPropertiesClassTest.kt @@ -0,0 +1,18 @@ +package org.openapijsonschematools.client.components.schemas; + +import org.junit.Assert; +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.MapUtils; +import org.checkerframework.checker.nullness.qual.Nullable; + +import java.util.Arrays; +import java.util.List; +import java.util.Map; +import java.util.AbstractMap; + +public class MixedPropertiesAndAdditionalPropertiesClassTest { + static final SchemaConfiguration configuration = new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().format().build()); +} diff --git a/samples/client/petstore/kotlin/src/test/kotlin/org/openapijsonschematools/client/components/schemas/MoneyTest.kt b/samples/client/petstore/kotlin/src/test/kotlin/org/openapijsonschematools/client/components/schemas/MoneyTest.kt new file mode 100644 index 00000000000..74495479867 --- /dev/null +++ b/samples/client/petstore/kotlin/src/test/kotlin/org/openapijsonschematools/client/components/schemas/MoneyTest.kt @@ -0,0 +1,18 @@ +package org.openapijsonschematools.client.components.schemas; + +import org.junit.Assert; +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.MapUtils; +import org.checkerframework.checker.nullness.qual.Nullable; + +import java.util.Arrays; +import java.util.List; +import java.util.Map; +import java.util.AbstractMap; + +public class MoneyTest { + static final SchemaConfiguration configuration = new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().format().build()); +} diff --git a/samples/client/petstore/kotlin/src/test/kotlin/org/openapijsonschematools/client/components/schemas/MultiPropertiesSchemaTest.kt b/samples/client/petstore/kotlin/src/test/kotlin/org/openapijsonschematools/client/components/schemas/MultiPropertiesSchemaTest.kt new file mode 100644 index 00000000000..d838324a427 --- /dev/null +++ b/samples/client/petstore/kotlin/src/test/kotlin/org/openapijsonschematools/client/components/schemas/MultiPropertiesSchemaTest.kt @@ -0,0 +1,18 @@ +package org.openapijsonschematools.client.components.schemas; + +import org.junit.Assert; +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.MapUtils; +import org.checkerframework.checker.nullness.qual.Nullable; + +import java.util.Arrays; +import java.util.List; +import java.util.Map; +import java.util.AbstractMap; + +public class MultiPropertiesSchemaTest { + static final SchemaConfiguration configuration = new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().format().build()); +} diff --git a/samples/client/petstore/kotlin/src/test/kotlin/org/openapijsonschematools/client/components/schemas/MyObjectDtoTest.kt b/samples/client/petstore/kotlin/src/test/kotlin/org/openapijsonschematools/client/components/schemas/MyObjectDtoTest.kt new file mode 100644 index 00000000000..87f7d053a13 --- /dev/null +++ b/samples/client/petstore/kotlin/src/test/kotlin/org/openapijsonschematools/client/components/schemas/MyObjectDtoTest.kt @@ -0,0 +1,18 @@ +package org.openapijsonschematools.client.components.schemas; + +import org.junit.Assert; +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.MapUtils; +import org.checkerframework.checker.nullness.qual.Nullable; + +import java.util.Arrays; +import java.util.List; +import java.util.Map; +import java.util.AbstractMap; + +public class MyObjectDtoTest { + static final SchemaConfiguration configuration = new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().format().build()); +} diff --git a/samples/client/petstore/kotlin/src/test/kotlin/org/openapijsonschematools/client/components/schemas/NameTest.kt b/samples/client/petstore/kotlin/src/test/kotlin/org/openapijsonschematools/client/components/schemas/NameTest.kt new file mode 100644 index 00000000000..76a95741398 --- /dev/null +++ b/samples/client/petstore/kotlin/src/test/kotlin/org/openapijsonschematools/client/components/schemas/NameTest.kt @@ -0,0 +1,18 @@ +package org.openapijsonschematools.client.components.schemas; + +import org.junit.Assert; +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.MapUtils; +import org.checkerframework.checker.nullness.qual.Nullable; + +import java.util.Arrays; +import java.util.List; +import java.util.Map; +import java.util.AbstractMap; + +public class NameTest { + static final SchemaConfiguration configuration = new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().format().build()); +} diff --git a/samples/client/petstore/kotlin/src/test/kotlin/org/openapijsonschematools/client/components/schemas/NoAdditionalPropertiesTest.kt b/samples/client/petstore/kotlin/src/test/kotlin/org/openapijsonschematools/client/components/schemas/NoAdditionalPropertiesTest.kt new file mode 100644 index 00000000000..d79e22490ff --- /dev/null +++ b/samples/client/petstore/kotlin/src/test/kotlin/org/openapijsonschematools/client/components/schemas/NoAdditionalPropertiesTest.kt @@ -0,0 +1,18 @@ +package org.openapijsonschematools.client.components.schemas; + +import org.junit.Assert; +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.MapUtils; +import org.checkerframework.checker.nullness.qual.Nullable; + +import java.util.Arrays; +import java.util.List; +import java.util.Map; +import java.util.AbstractMap; + +public class NoAdditionalPropertiesTest { + static final SchemaConfiguration configuration = new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().format().build()); +} diff --git a/samples/client/petstore/kotlin/src/test/kotlin/org/openapijsonschematools/client/components/schemas/NullableClassTest.kt b/samples/client/petstore/kotlin/src/test/kotlin/org/openapijsonschematools/client/components/schemas/NullableClassTest.kt new file mode 100644 index 00000000000..0c581203075 --- /dev/null +++ b/samples/client/petstore/kotlin/src/test/kotlin/org/openapijsonschematools/client/components/schemas/NullableClassTest.kt @@ -0,0 +1,18 @@ +package org.openapijsonschematools.client.components.schemas; + +import org.junit.Assert; +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.MapUtils; +import org.checkerframework.checker.nullness.qual.Nullable; + +import java.util.Arrays; +import java.util.List; +import java.util.Map; +import java.util.AbstractMap; + +public class NullableClassTest { + static final SchemaConfiguration configuration = new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().format().build()); +} diff --git a/samples/client/petstore/kotlin/src/test/kotlin/org/openapijsonschematools/client/components/schemas/NullableShapeTest.kt b/samples/client/petstore/kotlin/src/test/kotlin/org/openapijsonschematools/client/components/schemas/NullableShapeTest.kt new file mode 100644 index 00000000000..ad28aa7079a --- /dev/null +++ b/samples/client/petstore/kotlin/src/test/kotlin/org/openapijsonschematools/client/components/schemas/NullableShapeTest.kt @@ -0,0 +1,18 @@ +package org.openapijsonschematools.client.components.schemas; + +import org.junit.Assert; +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.MapUtils; +import org.checkerframework.checker.nullness.qual.Nullable; + +import java.util.Arrays; +import java.util.List; +import java.util.Map; +import java.util.AbstractMap; + +public class NullableShapeTest { + static final SchemaConfiguration configuration = new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().format().build()); +} diff --git a/samples/client/petstore/kotlin/src/test/kotlin/org/openapijsonschematools/client/components/schemas/NullableStringTest.kt b/samples/client/petstore/kotlin/src/test/kotlin/org/openapijsonschematools/client/components/schemas/NullableStringTest.kt new file mode 100644 index 00000000000..5b1d78012e4 --- /dev/null +++ b/samples/client/petstore/kotlin/src/test/kotlin/org/openapijsonschematools/client/components/schemas/NullableStringTest.kt @@ -0,0 +1,18 @@ +package org.openapijsonschematools.client.components.schemas; + +import org.junit.Assert; +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.MapUtils; +import org.checkerframework.checker.nullness.qual.Nullable; + +import java.util.Arrays; +import java.util.List; +import java.util.Map; +import java.util.AbstractMap; + +public class NullableStringTest { + static final SchemaConfiguration configuration = new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().format().build()); +} diff --git a/samples/client/petstore/kotlin/src/test/kotlin/org/openapijsonschematools/client/components/schemas/NumberOnlyTest.kt b/samples/client/petstore/kotlin/src/test/kotlin/org/openapijsonschematools/client/components/schemas/NumberOnlyTest.kt new file mode 100644 index 00000000000..0ac1388ab72 --- /dev/null +++ b/samples/client/petstore/kotlin/src/test/kotlin/org/openapijsonschematools/client/components/schemas/NumberOnlyTest.kt @@ -0,0 +1,18 @@ +package org.openapijsonschematools.client.components.schemas; + +import org.junit.Assert; +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.MapUtils; +import org.checkerframework.checker.nullness.qual.Nullable; + +import java.util.Arrays; +import java.util.List; +import java.util.Map; +import java.util.AbstractMap; + +public class NumberOnlyTest { + static final SchemaConfiguration configuration = new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().format().build()); +} diff --git a/samples/client/petstore/kotlin/src/test/kotlin/org/openapijsonschematools/client/components/schemas/NumberSchemaTest.kt b/samples/client/petstore/kotlin/src/test/kotlin/org/openapijsonschematools/client/components/schemas/NumberSchemaTest.kt new file mode 100644 index 00000000000..ddf1eb7a687 --- /dev/null +++ b/samples/client/petstore/kotlin/src/test/kotlin/org/openapijsonschematools/client/components/schemas/NumberSchemaTest.kt @@ -0,0 +1,18 @@ +package org.openapijsonschematools.client.components.schemas; + +import org.junit.Assert; +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.MapUtils; +import org.checkerframework.checker.nullness.qual.Nullable; + +import java.util.Arrays; +import java.util.List; +import java.util.Map; +import java.util.AbstractMap; + +public class NumberSchemaTest { + static final SchemaConfiguration configuration = new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().format().build()); +} diff --git a/samples/client/petstore/kotlin/src/test/kotlin/org/openapijsonschematools/client/components/schemas/NumberWithExclusiveMinMaxTest.kt b/samples/client/petstore/kotlin/src/test/kotlin/org/openapijsonschematools/client/components/schemas/NumberWithExclusiveMinMaxTest.kt new file mode 100644 index 00000000000..7ea2fffdb56 --- /dev/null +++ b/samples/client/petstore/kotlin/src/test/kotlin/org/openapijsonschematools/client/components/schemas/NumberWithExclusiveMinMaxTest.kt @@ -0,0 +1,18 @@ +package org.openapijsonschematools.client.components.schemas; + +import org.junit.Assert; +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.MapUtils; +import org.checkerframework.checker.nullness.qual.Nullable; + +import java.util.Arrays; +import java.util.List; +import java.util.Map; +import java.util.AbstractMap; + +public class NumberWithExclusiveMinMaxTest { + static final SchemaConfiguration configuration = new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().format().build()); +} diff --git a/samples/client/petstore/kotlin/src/test/kotlin/org/openapijsonschematools/client/components/schemas/NumberWithValidationsTest.kt b/samples/client/petstore/kotlin/src/test/kotlin/org/openapijsonschematools/client/components/schemas/NumberWithValidationsTest.kt new file mode 100644 index 00000000000..b0e61f9802c --- /dev/null +++ b/samples/client/petstore/kotlin/src/test/kotlin/org/openapijsonschematools/client/components/schemas/NumberWithValidationsTest.kt @@ -0,0 +1,18 @@ +package org.openapijsonschematools.client.components.schemas; + +import org.junit.Assert; +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.MapUtils; +import org.checkerframework.checker.nullness.qual.Nullable; + +import java.util.Arrays; +import java.util.List; +import java.util.Map; +import java.util.AbstractMap; + +public class NumberWithValidationsTest { + static final SchemaConfiguration configuration = new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().format().build()); +} diff --git a/samples/client/petstore/kotlin/src/test/kotlin/org/openapijsonschematools/client/components/schemas/ObjWithRequiredPropsBaseTest.kt b/samples/client/petstore/kotlin/src/test/kotlin/org/openapijsonschematools/client/components/schemas/ObjWithRequiredPropsBaseTest.kt new file mode 100644 index 00000000000..3b15661c054 --- /dev/null +++ b/samples/client/petstore/kotlin/src/test/kotlin/org/openapijsonschematools/client/components/schemas/ObjWithRequiredPropsBaseTest.kt @@ -0,0 +1,18 @@ +package org.openapijsonschematools.client.components.schemas; + +import org.junit.Assert; +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.MapUtils; +import org.checkerframework.checker.nullness.qual.Nullable; + +import java.util.Arrays; +import java.util.List; +import java.util.Map; +import java.util.AbstractMap; + +public class ObjWithRequiredPropsBaseTest { + static final SchemaConfiguration configuration = new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().format().build()); +} diff --git a/samples/client/petstore/kotlin/src/test/kotlin/org/openapijsonschematools/client/components/schemas/ObjWithRequiredPropsTest.kt b/samples/client/petstore/kotlin/src/test/kotlin/org/openapijsonschematools/client/components/schemas/ObjWithRequiredPropsTest.kt new file mode 100644 index 00000000000..105eb63fe1e --- /dev/null +++ b/samples/client/petstore/kotlin/src/test/kotlin/org/openapijsonschematools/client/components/schemas/ObjWithRequiredPropsTest.kt @@ -0,0 +1,18 @@ +package org.openapijsonschematools.client.components.schemas; + +import org.junit.Assert; +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.MapUtils; +import org.checkerframework.checker.nullness.qual.Nullable; + +import java.util.Arrays; +import java.util.List; +import java.util.Map; +import java.util.AbstractMap; + +public class ObjWithRequiredPropsTest { + static final SchemaConfiguration configuration = new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().format().build()); +} diff --git a/samples/client/petstore/kotlin/src/test/kotlin/org/openapijsonschematools/client/components/schemas/ObjectInterfaceTest.kt b/samples/client/petstore/kotlin/src/test/kotlin/org/openapijsonschematools/client/components/schemas/ObjectInterfaceTest.kt new file mode 100644 index 00000000000..10a0a08b90d --- /dev/null +++ b/samples/client/petstore/kotlin/src/test/kotlin/org/openapijsonschematools/client/components/schemas/ObjectInterfaceTest.kt @@ -0,0 +1,18 @@ +package org.openapijsonschematools.client.components.schemas; + +import org.junit.Assert; +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.MapUtils; +import org.checkerframework.checker.nullness.qual.Nullable; + +import java.util.Arrays; +import java.util.List; +import java.util.Map; +import java.util.AbstractMap; + +public class ObjectInterfaceTest { + static final SchemaConfiguration configuration = new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().format().build()); +} diff --git a/samples/client/petstore/kotlin/src/test/kotlin/org/openapijsonschematools/client/components/schemas/ObjectModelWithArgAndArgsPropertiesTest.kt b/samples/client/petstore/kotlin/src/test/kotlin/org/openapijsonschematools/client/components/schemas/ObjectModelWithArgAndArgsPropertiesTest.kt new file mode 100644 index 00000000000..1d20ae276a9 --- /dev/null +++ b/samples/client/petstore/kotlin/src/test/kotlin/org/openapijsonschematools/client/components/schemas/ObjectModelWithArgAndArgsPropertiesTest.kt @@ -0,0 +1,18 @@ +package org.openapijsonschematools.client.components.schemas; + +import org.junit.Assert; +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.MapUtils; +import org.checkerframework.checker.nullness.qual.Nullable; + +import java.util.Arrays; +import java.util.List; +import java.util.Map; +import java.util.AbstractMap; + +public class ObjectModelWithArgAndArgsPropertiesTest { + static final SchemaConfiguration configuration = new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().format().build()); +} diff --git a/samples/client/petstore/kotlin/src/test/kotlin/org/openapijsonschematools/client/components/schemas/ObjectModelWithRefPropsTest.kt b/samples/client/petstore/kotlin/src/test/kotlin/org/openapijsonschematools/client/components/schemas/ObjectModelWithRefPropsTest.kt new file mode 100644 index 00000000000..b6423a6441e --- /dev/null +++ b/samples/client/petstore/kotlin/src/test/kotlin/org/openapijsonschematools/client/components/schemas/ObjectModelWithRefPropsTest.kt @@ -0,0 +1,18 @@ +package org.openapijsonschematools.client.components.schemas; + +import org.junit.Assert; +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.MapUtils; +import org.checkerframework.checker.nullness.qual.Nullable; + +import java.util.Arrays; +import java.util.List; +import java.util.Map; +import java.util.AbstractMap; + +public class ObjectModelWithRefPropsTest { + static final SchemaConfiguration configuration = new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().format().build()); +} diff --git a/samples/client/petstore/kotlin/src/test/kotlin/org/openapijsonschematools/client/components/schemas/ObjectWithAllOfWithReqTestPropFromUnsetAddPropTest.kt b/samples/client/petstore/kotlin/src/test/kotlin/org/openapijsonschematools/client/components/schemas/ObjectWithAllOfWithReqTestPropFromUnsetAddPropTest.kt new file mode 100644 index 00000000000..846af3fd6b0 --- /dev/null +++ b/samples/client/petstore/kotlin/src/test/kotlin/org/openapijsonschematools/client/components/schemas/ObjectWithAllOfWithReqTestPropFromUnsetAddPropTest.kt @@ -0,0 +1,18 @@ +package org.openapijsonschematools.client.components.schemas; + +import org.junit.Assert; +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.MapUtils; +import org.checkerframework.checker.nullness.qual.Nullable; + +import java.util.Arrays; +import java.util.List; +import java.util.Map; +import java.util.AbstractMap; + +public class ObjectWithAllOfWithReqTestPropFromUnsetAddPropTest { + static final SchemaConfiguration configuration = new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().format().build()); +} diff --git a/samples/client/petstore/kotlin/src/test/kotlin/org/openapijsonschematools/client/components/schemas/ObjectWithCollidingPropertiesTest.kt b/samples/client/petstore/kotlin/src/test/kotlin/org/openapijsonschematools/client/components/schemas/ObjectWithCollidingPropertiesTest.kt new file mode 100644 index 00000000000..2ae79b4633e --- /dev/null +++ b/samples/client/petstore/kotlin/src/test/kotlin/org/openapijsonschematools/client/components/schemas/ObjectWithCollidingPropertiesTest.kt @@ -0,0 +1,18 @@ +package org.openapijsonschematools.client.components.schemas; + +import org.junit.Assert; +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.MapUtils; +import org.checkerframework.checker.nullness.qual.Nullable; + +import java.util.Arrays; +import java.util.List; +import java.util.Map; +import java.util.AbstractMap; + +public class ObjectWithCollidingPropertiesTest { + static final SchemaConfiguration configuration = new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().format().build()); +} diff --git a/samples/client/petstore/kotlin/src/test/kotlin/org/openapijsonschematools/client/components/schemas/ObjectWithDecimalPropertiesTest.kt b/samples/client/petstore/kotlin/src/test/kotlin/org/openapijsonschematools/client/components/schemas/ObjectWithDecimalPropertiesTest.kt new file mode 100644 index 00000000000..f024635f998 --- /dev/null +++ b/samples/client/petstore/kotlin/src/test/kotlin/org/openapijsonschematools/client/components/schemas/ObjectWithDecimalPropertiesTest.kt @@ -0,0 +1,18 @@ +package org.openapijsonschematools.client.components.schemas; + +import org.junit.Assert; +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.MapUtils; +import org.checkerframework.checker.nullness.qual.Nullable; + +import java.util.Arrays; +import java.util.List; +import java.util.Map; +import java.util.AbstractMap; + +public class ObjectWithDecimalPropertiesTest { + static final SchemaConfiguration configuration = new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().format().build()); +} diff --git a/samples/client/petstore/kotlin/src/test/kotlin/org/openapijsonschematools/client/components/schemas/ObjectWithDifficultlyNamedPropsTest.kt b/samples/client/petstore/kotlin/src/test/kotlin/org/openapijsonschematools/client/components/schemas/ObjectWithDifficultlyNamedPropsTest.kt new file mode 100644 index 00000000000..3411862b9f3 --- /dev/null +++ b/samples/client/petstore/kotlin/src/test/kotlin/org/openapijsonschematools/client/components/schemas/ObjectWithDifficultlyNamedPropsTest.kt @@ -0,0 +1,18 @@ +package org.openapijsonschematools.client.components.schemas; + +import org.junit.Assert; +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.MapUtils; +import org.checkerframework.checker.nullness.qual.Nullable; + +import java.util.Arrays; +import java.util.List; +import java.util.Map; +import java.util.AbstractMap; + +public class ObjectWithDifficultlyNamedPropsTest { + static final SchemaConfiguration configuration = new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().format().build()); +} diff --git a/samples/client/petstore/kotlin/src/test/kotlin/org/openapijsonschematools/client/components/schemas/ObjectWithInlineCompositionPropertyTest.kt b/samples/client/petstore/kotlin/src/test/kotlin/org/openapijsonschematools/client/components/schemas/ObjectWithInlineCompositionPropertyTest.kt new file mode 100644 index 00000000000..9218c238074 --- /dev/null +++ b/samples/client/petstore/kotlin/src/test/kotlin/org/openapijsonschematools/client/components/schemas/ObjectWithInlineCompositionPropertyTest.kt @@ -0,0 +1,18 @@ +package org.openapijsonschematools.client.components.schemas; + +import org.junit.Assert; +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.MapUtils; +import org.checkerframework.checker.nullness.qual.Nullable; + +import java.util.Arrays; +import java.util.List; +import java.util.Map; +import java.util.AbstractMap; + +public class ObjectWithInlineCompositionPropertyTest { + static final SchemaConfiguration configuration = new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().format().build()); +} diff --git a/samples/client/petstore/kotlin/src/test/kotlin/org/openapijsonschematools/client/components/schemas/ObjectWithInvalidNamedRefedPropertiesTest.kt b/samples/client/petstore/kotlin/src/test/kotlin/org/openapijsonschematools/client/components/schemas/ObjectWithInvalidNamedRefedPropertiesTest.kt new file mode 100644 index 00000000000..57023085317 --- /dev/null +++ b/samples/client/petstore/kotlin/src/test/kotlin/org/openapijsonschematools/client/components/schemas/ObjectWithInvalidNamedRefedPropertiesTest.kt @@ -0,0 +1,18 @@ +package org.openapijsonschematools.client.components.schemas; + +import org.junit.Assert; +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.MapUtils; +import org.checkerframework.checker.nullness.qual.Nullable; + +import java.util.Arrays; +import java.util.List; +import java.util.Map; +import java.util.AbstractMap; + +public class ObjectWithInvalidNamedRefedPropertiesTest { + static final SchemaConfiguration configuration = new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().format().build()); +} diff --git a/samples/client/petstore/kotlin/src/test/kotlin/org/openapijsonschematools/client/components/schemas/ObjectWithNonIntersectingValuesTest.kt b/samples/client/petstore/kotlin/src/test/kotlin/org/openapijsonschematools/client/components/schemas/ObjectWithNonIntersectingValuesTest.kt new file mode 100644 index 00000000000..0ec9e09a45a --- /dev/null +++ b/samples/client/petstore/kotlin/src/test/kotlin/org/openapijsonschematools/client/components/schemas/ObjectWithNonIntersectingValuesTest.kt @@ -0,0 +1,18 @@ +package org.openapijsonschematools.client.components.schemas; + +import org.junit.Assert; +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.MapUtils; +import org.checkerframework.checker.nullness.qual.Nullable; + +import java.util.Arrays; +import java.util.List; +import java.util.Map; +import java.util.AbstractMap; + +public class ObjectWithNonIntersectingValuesTest { + static final SchemaConfiguration configuration = new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().format().build()); +} diff --git a/samples/client/petstore/kotlin/src/test/kotlin/org/openapijsonschematools/client/components/schemas/ObjectWithOnlyOptionalPropsTest.kt b/samples/client/petstore/kotlin/src/test/kotlin/org/openapijsonschematools/client/components/schemas/ObjectWithOnlyOptionalPropsTest.kt new file mode 100644 index 00000000000..16859d34c5d --- /dev/null +++ b/samples/client/petstore/kotlin/src/test/kotlin/org/openapijsonschematools/client/components/schemas/ObjectWithOnlyOptionalPropsTest.kt @@ -0,0 +1,18 @@ +package org.openapijsonschematools.client.components.schemas; + +import org.junit.Assert; +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.MapUtils; +import org.checkerframework.checker.nullness.qual.Nullable; + +import java.util.Arrays; +import java.util.List; +import java.util.Map; +import java.util.AbstractMap; + +public class ObjectWithOnlyOptionalPropsTest { + static final SchemaConfiguration configuration = new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().format().build()); +} diff --git a/samples/client/petstore/kotlin/src/test/kotlin/org/openapijsonschematools/client/components/schemas/ObjectWithOptionalTestPropTest.kt b/samples/client/petstore/kotlin/src/test/kotlin/org/openapijsonschematools/client/components/schemas/ObjectWithOptionalTestPropTest.kt new file mode 100644 index 00000000000..fbfbd396a61 --- /dev/null +++ b/samples/client/petstore/kotlin/src/test/kotlin/org/openapijsonschematools/client/components/schemas/ObjectWithOptionalTestPropTest.kt @@ -0,0 +1,18 @@ +package org.openapijsonschematools.client.components.schemas; + +import org.junit.Assert; +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.MapUtils; +import org.checkerframework.checker.nullness.qual.Nullable; + +import java.util.Arrays; +import java.util.List; +import java.util.Map; +import java.util.AbstractMap; + +public class ObjectWithOptionalTestPropTest { + static final SchemaConfiguration configuration = new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().format().build()); +} diff --git a/samples/client/petstore/kotlin/src/test/kotlin/org/openapijsonschematools/client/components/schemas/ObjectWithValidationsTest.kt b/samples/client/petstore/kotlin/src/test/kotlin/org/openapijsonschematools/client/components/schemas/ObjectWithValidationsTest.kt new file mode 100644 index 00000000000..9d02a043155 --- /dev/null +++ b/samples/client/petstore/kotlin/src/test/kotlin/org/openapijsonschematools/client/components/schemas/ObjectWithValidationsTest.kt @@ -0,0 +1,18 @@ +package org.openapijsonschematools.client.components.schemas; + +import org.junit.Assert; +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.MapUtils; +import org.checkerframework.checker.nullness.qual.Nullable; + +import java.util.Arrays; +import java.util.List; +import java.util.Map; +import java.util.AbstractMap; + +public class ObjectWithValidationsTest { + static final SchemaConfiguration configuration = new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().format().build()); +} diff --git a/samples/client/petstore/kotlin/src/test/kotlin/org/openapijsonschematools/client/components/schemas/OrderTest.kt b/samples/client/petstore/kotlin/src/test/kotlin/org/openapijsonschematools/client/components/schemas/OrderTest.kt new file mode 100644 index 00000000000..6f89d9bbcbe --- /dev/null +++ b/samples/client/petstore/kotlin/src/test/kotlin/org/openapijsonschematools/client/components/schemas/OrderTest.kt @@ -0,0 +1,18 @@ +package org.openapijsonschematools.client.components.schemas; + +import org.junit.Assert; +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.MapUtils; +import org.checkerframework.checker.nullness.qual.Nullable; + +import java.util.Arrays; +import java.util.List; +import java.util.Map; +import java.util.AbstractMap; + +public class OrderTest { + static final SchemaConfiguration configuration = new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().format().build()); +} diff --git a/samples/client/petstore/kotlin/src/test/kotlin/org/openapijsonschematools/client/components/schemas/PaginatedResultMyObjectDtoTest.kt b/samples/client/petstore/kotlin/src/test/kotlin/org/openapijsonschematools/client/components/schemas/PaginatedResultMyObjectDtoTest.kt new file mode 100644 index 00000000000..d786673816b --- /dev/null +++ b/samples/client/petstore/kotlin/src/test/kotlin/org/openapijsonschematools/client/components/schemas/PaginatedResultMyObjectDtoTest.kt @@ -0,0 +1,18 @@ +package org.openapijsonschematools.client.components.schemas; + +import org.junit.Assert; +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.MapUtils; +import org.checkerframework.checker.nullness.qual.Nullable; + +import java.util.Arrays; +import java.util.List; +import java.util.Map; +import java.util.AbstractMap; + +public class PaginatedResultMyObjectDtoTest { + static final SchemaConfiguration configuration = new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().format().build()); +} diff --git a/samples/client/petstore/kotlin/src/test/kotlin/org/openapijsonschematools/client/components/schemas/ParentPetTest.kt b/samples/client/petstore/kotlin/src/test/kotlin/org/openapijsonschematools/client/components/schemas/ParentPetTest.kt new file mode 100644 index 00000000000..8850228ea48 --- /dev/null +++ b/samples/client/petstore/kotlin/src/test/kotlin/org/openapijsonschematools/client/components/schemas/ParentPetTest.kt @@ -0,0 +1,18 @@ +package org.openapijsonschematools.client.components.schemas; + +import org.junit.Assert; +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.MapUtils; +import org.checkerframework.checker.nullness.qual.Nullable; + +import java.util.Arrays; +import java.util.List; +import java.util.Map; +import java.util.AbstractMap; + +public class ParentPetTest { + static final SchemaConfiguration configuration = new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().format().build()); +} diff --git a/samples/client/petstore/kotlin/src/test/kotlin/org/openapijsonschematools/client/components/schemas/PetTest.kt b/samples/client/petstore/kotlin/src/test/kotlin/org/openapijsonschematools/client/components/schemas/PetTest.kt new file mode 100644 index 00000000000..c9188d89ccb --- /dev/null +++ b/samples/client/petstore/kotlin/src/test/kotlin/org/openapijsonschematools/client/components/schemas/PetTest.kt @@ -0,0 +1,18 @@ +package org.openapijsonschematools.client.components.schemas; + +import org.junit.Assert; +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.MapUtils; +import org.checkerframework.checker.nullness.qual.Nullable; + +import java.util.Arrays; +import java.util.List; +import java.util.Map; +import java.util.AbstractMap; + +public class PetTest { + static final SchemaConfiguration configuration = new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().format().build()); +} diff --git a/samples/client/petstore/kotlin/src/test/kotlin/org/openapijsonschematools/client/components/schemas/PigTest.kt b/samples/client/petstore/kotlin/src/test/kotlin/org/openapijsonschematools/client/components/schemas/PigTest.kt new file mode 100644 index 00000000000..15fa50b9931 --- /dev/null +++ b/samples/client/petstore/kotlin/src/test/kotlin/org/openapijsonschematools/client/components/schemas/PigTest.kt @@ -0,0 +1,18 @@ +package org.openapijsonschematools.client.components.schemas; + +import org.junit.Assert; +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.MapUtils; +import org.checkerframework.checker.nullness.qual.Nullable; + +import java.util.Arrays; +import java.util.List; +import java.util.Map; +import java.util.AbstractMap; + +public class PigTest { + static final SchemaConfiguration configuration = new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().format().build()); +} diff --git a/samples/client/petstore/kotlin/src/test/kotlin/org/openapijsonschematools/client/components/schemas/PlayerTest.kt b/samples/client/petstore/kotlin/src/test/kotlin/org/openapijsonschematools/client/components/schemas/PlayerTest.kt new file mode 100644 index 00000000000..f3a60c5761d --- /dev/null +++ b/samples/client/petstore/kotlin/src/test/kotlin/org/openapijsonschematools/client/components/schemas/PlayerTest.kt @@ -0,0 +1,18 @@ +package org.openapijsonschematools.client.components.schemas; + +import org.junit.Assert; +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.MapUtils; +import org.checkerframework.checker.nullness.qual.Nullable; + +import java.util.Arrays; +import java.util.List; +import java.util.Map; +import java.util.AbstractMap; + +public class PlayerTest { + static final SchemaConfiguration configuration = new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().format().build()); +} diff --git a/samples/client/petstore/kotlin/src/test/kotlin/org/openapijsonschematools/client/components/schemas/PublicKeyTest.kt b/samples/client/petstore/kotlin/src/test/kotlin/org/openapijsonschematools/client/components/schemas/PublicKeyTest.kt new file mode 100644 index 00000000000..01422255c9e --- /dev/null +++ b/samples/client/petstore/kotlin/src/test/kotlin/org/openapijsonschematools/client/components/schemas/PublicKeyTest.kt @@ -0,0 +1,18 @@ +package org.openapijsonschematools.client.components.schemas; + +import org.junit.Assert; +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.MapUtils; +import org.checkerframework.checker.nullness.qual.Nullable; + +import java.util.Arrays; +import java.util.List; +import java.util.Map; +import java.util.AbstractMap; + +public class PublicKeyTest { + static final SchemaConfiguration configuration = new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().format().build()); +} diff --git a/samples/client/petstore/kotlin/src/test/kotlin/org/openapijsonschematools/client/components/schemas/QuadrilateralInterfaceTest.kt b/samples/client/petstore/kotlin/src/test/kotlin/org/openapijsonschematools/client/components/schemas/QuadrilateralInterfaceTest.kt new file mode 100644 index 00000000000..457533d9723 --- /dev/null +++ b/samples/client/petstore/kotlin/src/test/kotlin/org/openapijsonschematools/client/components/schemas/QuadrilateralInterfaceTest.kt @@ -0,0 +1,18 @@ +package org.openapijsonschematools.client.components.schemas; + +import org.junit.Assert; +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.MapUtils; +import org.checkerframework.checker.nullness.qual.Nullable; + +import java.util.Arrays; +import java.util.List; +import java.util.Map; +import java.util.AbstractMap; + +public class QuadrilateralInterfaceTest { + static final SchemaConfiguration configuration = new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().format().build()); +} diff --git a/samples/client/petstore/kotlin/src/test/kotlin/org/openapijsonschematools/client/components/schemas/QuadrilateralTest.kt b/samples/client/petstore/kotlin/src/test/kotlin/org/openapijsonschematools/client/components/schemas/QuadrilateralTest.kt new file mode 100644 index 00000000000..930bf3ff189 --- /dev/null +++ b/samples/client/petstore/kotlin/src/test/kotlin/org/openapijsonschematools/client/components/schemas/QuadrilateralTest.kt @@ -0,0 +1,18 @@ +package org.openapijsonschematools.client.components.schemas; + +import org.junit.Assert; +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.MapUtils; +import org.checkerframework.checker.nullness.qual.Nullable; + +import java.util.Arrays; +import java.util.List; +import java.util.Map; +import java.util.AbstractMap; + +public class QuadrilateralTest { + static final SchemaConfiguration configuration = new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().format().build()); +} diff --git a/samples/client/petstore/kotlin/src/test/kotlin/org/openapijsonschematools/client/components/schemas/ReadOnlyFirstTest.kt b/samples/client/petstore/kotlin/src/test/kotlin/org/openapijsonschematools/client/components/schemas/ReadOnlyFirstTest.kt new file mode 100644 index 00000000000..51415cd0e25 --- /dev/null +++ b/samples/client/petstore/kotlin/src/test/kotlin/org/openapijsonschematools/client/components/schemas/ReadOnlyFirstTest.kt @@ -0,0 +1,18 @@ +package org.openapijsonschematools.client.components.schemas; + +import org.junit.Assert; +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.MapUtils; +import org.checkerframework.checker.nullness.qual.Nullable; + +import java.util.Arrays; +import java.util.List; +import java.util.Map; +import java.util.AbstractMap; + +public class ReadOnlyFirstTest { + static final SchemaConfiguration configuration = new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().format().build()); +} diff --git a/samples/client/petstore/kotlin/src/test/kotlin/org/openapijsonschematools/client/components/schemas/RefPetTest.kt b/samples/client/petstore/kotlin/src/test/kotlin/org/openapijsonschematools/client/components/schemas/RefPetTest.kt new file mode 100644 index 00000000000..e745fbfe372 --- /dev/null +++ b/samples/client/petstore/kotlin/src/test/kotlin/org/openapijsonschematools/client/components/schemas/RefPetTest.kt @@ -0,0 +1,18 @@ +package org.openapijsonschematools.client.components.schemas; + +import org.junit.Assert; +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.MapUtils; +import org.checkerframework.checker.nullness.qual.Nullable; + +import java.util.Arrays; +import java.util.List; +import java.util.Map; +import java.util.AbstractMap; + +public class RefPetTest { + static final SchemaConfiguration configuration = new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().format().build()); +} diff --git a/samples/client/petstore/kotlin/src/test/kotlin/org/openapijsonschematools/client/components/schemas/ReqPropsFromExplicitAddPropsTest.kt b/samples/client/petstore/kotlin/src/test/kotlin/org/openapijsonschematools/client/components/schemas/ReqPropsFromExplicitAddPropsTest.kt new file mode 100644 index 00000000000..29805a43b33 --- /dev/null +++ b/samples/client/petstore/kotlin/src/test/kotlin/org/openapijsonschematools/client/components/schemas/ReqPropsFromExplicitAddPropsTest.kt @@ -0,0 +1,18 @@ +package org.openapijsonschematools.client.components.schemas; + +import org.junit.Assert; +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.MapUtils; +import org.checkerframework.checker.nullness.qual.Nullable; + +import java.util.Arrays; +import java.util.List; +import java.util.Map; +import java.util.AbstractMap; + +public class ReqPropsFromExplicitAddPropsTest { + static final SchemaConfiguration configuration = new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().format().build()); +} diff --git a/samples/client/petstore/kotlin/src/test/kotlin/org/openapijsonschematools/client/components/schemas/ReqPropsFromTrueAddPropsTest.kt b/samples/client/petstore/kotlin/src/test/kotlin/org/openapijsonschematools/client/components/schemas/ReqPropsFromTrueAddPropsTest.kt new file mode 100644 index 00000000000..abcf4962d81 --- /dev/null +++ b/samples/client/petstore/kotlin/src/test/kotlin/org/openapijsonschematools/client/components/schemas/ReqPropsFromTrueAddPropsTest.kt @@ -0,0 +1,18 @@ +package org.openapijsonschematools.client.components.schemas; + +import org.junit.Assert; +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.MapUtils; +import org.checkerframework.checker.nullness.qual.Nullable; + +import java.util.Arrays; +import java.util.List; +import java.util.Map; +import java.util.AbstractMap; + +public class ReqPropsFromTrueAddPropsTest { + static final SchemaConfiguration configuration = new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().format().build()); +} diff --git a/samples/client/petstore/kotlin/src/test/kotlin/org/openapijsonschematools/client/components/schemas/ReqPropsFromUnsetAddPropsTest.kt b/samples/client/petstore/kotlin/src/test/kotlin/org/openapijsonschematools/client/components/schemas/ReqPropsFromUnsetAddPropsTest.kt new file mode 100644 index 00000000000..a777a2ee5ca --- /dev/null +++ b/samples/client/petstore/kotlin/src/test/kotlin/org/openapijsonschematools/client/components/schemas/ReqPropsFromUnsetAddPropsTest.kt @@ -0,0 +1,18 @@ +package org.openapijsonschematools.client.components.schemas; + +import org.junit.Assert; +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.MapUtils; +import org.checkerframework.checker.nullness.qual.Nullable; + +import java.util.Arrays; +import java.util.List; +import java.util.Map; +import java.util.AbstractMap; + +public class ReqPropsFromUnsetAddPropsTest { + static final SchemaConfiguration configuration = new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().format().build()); +} diff --git a/samples/client/petstore/kotlin/src/test/kotlin/org/openapijsonschematools/client/components/schemas/ReturnSchemaTest.kt b/samples/client/petstore/kotlin/src/test/kotlin/org/openapijsonschematools/client/components/schemas/ReturnSchemaTest.kt new file mode 100644 index 00000000000..12a41f23c6d --- /dev/null +++ b/samples/client/petstore/kotlin/src/test/kotlin/org/openapijsonschematools/client/components/schemas/ReturnSchemaTest.kt @@ -0,0 +1,18 @@ +package org.openapijsonschematools.client.components.schemas; + +import org.junit.Assert; +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.MapUtils; +import org.checkerframework.checker.nullness.qual.Nullable; + +import java.util.Arrays; +import java.util.List; +import java.util.Map; +import java.util.AbstractMap; + +public class ReturnSchemaTest { + static final SchemaConfiguration configuration = new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().format().build()); +} diff --git a/samples/client/petstore/kotlin/src/test/kotlin/org/openapijsonschematools/client/components/schemas/ScaleneTriangleTest.kt b/samples/client/petstore/kotlin/src/test/kotlin/org/openapijsonschematools/client/components/schemas/ScaleneTriangleTest.kt new file mode 100644 index 00000000000..d60ac9bd407 --- /dev/null +++ b/samples/client/petstore/kotlin/src/test/kotlin/org/openapijsonschematools/client/components/schemas/ScaleneTriangleTest.kt @@ -0,0 +1,18 @@ +package org.openapijsonschematools.client.components.schemas; + +import org.junit.Assert; +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.MapUtils; +import org.checkerframework.checker.nullness.qual.Nullable; + +import java.util.Arrays; +import java.util.List; +import java.util.Map; +import java.util.AbstractMap; + +public class ScaleneTriangleTest { + static final SchemaConfiguration configuration = new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().format().build()); +} diff --git a/samples/client/petstore/kotlin/src/test/kotlin/org/openapijsonschematools/client/components/schemas/Schema200ResponseTest.kt b/samples/client/petstore/kotlin/src/test/kotlin/org/openapijsonschematools/client/components/schemas/Schema200ResponseTest.kt new file mode 100644 index 00000000000..4833132cc77 --- /dev/null +++ b/samples/client/petstore/kotlin/src/test/kotlin/org/openapijsonschematools/client/components/schemas/Schema200ResponseTest.kt @@ -0,0 +1,18 @@ +package org.openapijsonschematools.client.components.schemas; + +import org.junit.Assert; +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.MapUtils; +import org.checkerframework.checker.nullness.qual.Nullable; + +import java.util.Arrays; +import java.util.List; +import java.util.Map; +import java.util.AbstractMap; + +public class Schema200ResponseTest { + static final SchemaConfiguration configuration = new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().format().build()); +} diff --git a/samples/client/petstore/kotlin/src/test/kotlin/org/openapijsonschematools/client/components/schemas/SelfReferencingArrayModelTest.kt b/samples/client/petstore/kotlin/src/test/kotlin/org/openapijsonschematools/client/components/schemas/SelfReferencingArrayModelTest.kt new file mode 100644 index 00000000000..8aa9425537e --- /dev/null +++ b/samples/client/petstore/kotlin/src/test/kotlin/org/openapijsonschematools/client/components/schemas/SelfReferencingArrayModelTest.kt @@ -0,0 +1,18 @@ +package org.openapijsonschematools.client.components.schemas; + +import org.junit.Assert; +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.MapUtils; +import org.checkerframework.checker.nullness.qual.Nullable; + +import java.util.Arrays; +import java.util.List; +import java.util.Map; +import java.util.AbstractMap; + +public class SelfReferencingArrayModelTest { + static final SchemaConfiguration configuration = new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().format().build()); +} diff --git a/samples/client/petstore/kotlin/src/test/kotlin/org/openapijsonschematools/client/components/schemas/SelfReferencingObjectModelTest.kt b/samples/client/petstore/kotlin/src/test/kotlin/org/openapijsonschematools/client/components/schemas/SelfReferencingObjectModelTest.kt new file mode 100644 index 00000000000..9c615b0f705 --- /dev/null +++ b/samples/client/petstore/kotlin/src/test/kotlin/org/openapijsonschematools/client/components/schemas/SelfReferencingObjectModelTest.kt @@ -0,0 +1,18 @@ +package org.openapijsonschematools.client.components.schemas; + +import org.junit.Assert; +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.MapUtils; +import org.checkerframework.checker.nullness.qual.Nullable; + +import java.util.Arrays; +import java.util.List; +import java.util.Map; +import java.util.AbstractMap; + +public class SelfReferencingObjectModelTest { + static final SchemaConfiguration configuration = new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().format().build()); +} diff --git a/samples/client/petstore/kotlin/src/test/kotlin/org/openapijsonschematools/client/components/schemas/ShapeOrNullTest.kt b/samples/client/petstore/kotlin/src/test/kotlin/org/openapijsonschematools/client/components/schemas/ShapeOrNullTest.kt new file mode 100644 index 00000000000..1dd467f87d4 --- /dev/null +++ b/samples/client/petstore/kotlin/src/test/kotlin/org/openapijsonschematools/client/components/schemas/ShapeOrNullTest.kt @@ -0,0 +1,18 @@ +package org.openapijsonschematools.client.components.schemas; + +import org.junit.Assert; +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.MapUtils; +import org.checkerframework.checker.nullness.qual.Nullable; + +import java.util.Arrays; +import java.util.List; +import java.util.Map; +import java.util.AbstractMap; + +public class ShapeOrNullTest { + static final SchemaConfiguration configuration = new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().format().build()); +} diff --git a/samples/client/petstore/kotlin/src/test/kotlin/org/openapijsonschematools/client/components/schemas/ShapeTest.kt b/samples/client/petstore/kotlin/src/test/kotlin/org/openapijsonschematools/client/components/schemas/ShapeTest.kt new file mode 100644 index 00000000000..820879988cf --- /dev/null +++ b/samples/client/petstore/kotlin/src/test/kotlin/org/openapijsonschematools/client/components/schemas/ShapeTest.kt @@ -0,0 +1,18 @@ +package org.openapijsonschematools.client.components.schemas; + +import org.junit.Assert; +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.MapUtils; +import org.checkerframework.checker.nullness.qual.Nullable; + +import java.util.Arrays; +import java.util.List; +import java.util.Map; +import java.util.AbstractMap; + +public class ShapeTest { + static final SchemaConfiguration configuration = new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().format().build()); +} diff --git a/samples/client/petstore/kotlin/src/test/kotlin/org/openapijsonschematools/client/components/schemas/SimpleQuadrilateralTest.kt b/samples/client/petstore/kotlin/src/test/kotlin/org/openapijsonschematools/client/components/schemas/SimpleQuadrilateralTest.kt new file mode 100644 index 00000000000..4d2222c704a --- /dev/null +++ b/samples/client/petstore/kotlin/src/test/kotlin/org/openapijsonschematools/client/components/schemas/SimpleQuadrilateralTest.kt @@ -0,0 +1,18 @@ +package org.openapijsonschematools.client.components.schemas; + +import org.junit.Assert; +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.MapUtils; +import org.checkerframework.checker.nullness.qual.Nullable; + +import java.util.Arrays; +import java.util.List; +import java.util.Map; +import java.util.AbstractMap; + +public class SimpleQuadrilateralTest { + static final SchemaConfiguration configuration = new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().format().build()); +} diff --git a/samples/client/petstore/kotlin/src/test/kotlin/org/openapijsonschematools/client/components/schemas/SomeObjectTest.kt b/samples/client/petstore/kotlin/src/test/kotlin/org/openapijsonschematools/client/components/schemas/SomeObjectTest.kt new file mode 100644 index 00000000000..a57621c0667 --- /dev/null +++ b/samples/client/petstore/kotlin/src/test/kotlin/org/openapijsonschematools/client/components/schemas/SomeObjectTest.kt @@ -0,0 +1,18 @@ +package org.openapijsonschematools.client.components.schemas; + +import org.junit.Assert; +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.MapUtils; +import org.checkerframework.checker.nullness.qual.Nullable; + +import java.util.Arrays; +import java.util.List; +import java.util.Map; +import java.util.AbstractMap; + +public class SomeObjectTest { + static final SchemaConfiguration configuration = new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().format().build()); +} diff --git a/samples/client/petstore/kotlin/src/test/kotlin/org/openapijsonschematools/client/components/schemas/SpecialModelnameTest.kt b/samples/client/petstore/kotlin/src/test/kotlin/org/openapijsonschematools/client/components/schemas/SpecialModelnameTest.kt new file mode 100644 index 00000000000..7434c9f5316 --- /dev/null +++ b/samples/client/petstore/kotlin/src/test/kotlin/org/openapijsonschematools/client/components/schemas/SpecialModelnameTest.kt @@ -0,0 +1,18 @@ +package org.openapijsonschematools.client.components.schemas; + +import org.junit.Assert; +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.MapUtils; +import org.checkerframework.checker.nullness.qual.Nullable; + +import java.util.Arrays; +import java.util.List; +import java.util.Map; +import java.util.AbstractMap; + +public class SpecialModelnameTest { + static final SchemaConfiguration configuration = new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().format().build()); +} diff --git a/samples/client/petstore/kotlin/src/test/kotlin/org/openapijsonschematools/client/components/schemas/StringBooleanMapTest.kt b/samples/client/petstore/kotlin/src/test/kotlin/org/openapijsonschematools/client/components/schemas/StringBooleanMapTest.kt new file mode 100644 index 00000000000..c75df4cbc46 --- /dev/null +++ b/samples/client/petstore/kotlin/src/test/kotlin/org/openapijsonschematools/client/components/schemas/StringBooleanMapTest.kt @@ -0,0 +1,18 @@ +package org.openapijsonschematools.client.components.schemas; + +import org.junit.Assert; +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.MapUtils; +import org.checkerframework.checker.nullness.qual.Nullable; + +import java.util.Arrays; +import java.util.List; +import java.util.Map; +import java.util.AbstractMap; + +public class StringBooleanMapTest { + static final SchemaConfiguration configuration = new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().format().build()); +} diff --git a/samples/client/petstore/kotlin/src/test/kotlin/org/openapijsonschematools/client/components/schemas/StringEnumTest.kt b/samples/client/petstore/kotlin/src/test/kotlin/org/openapijsonschematools/client/components/schemas/StringEnumTest.kt new file mode 100644 index 00000000000..c569016b2fb --- /dev/null +++ b/samples/client/petstore/kotlin/src/test/kotlin/org/openapijsonschematools/client/components/schemas/StringEnumTest.kt @@ -0,0 +1,18 @@ +package org.openapijsonschematools.client.components.schemas; + +import org.junit.Assert; +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.MapUtils; +import org.checkerframework.checker.nullness.qual.Nullable; + +import java.util.Arrays; +import java.util.List; +import java.util.Map; +import java.util.AbstractMap; + +public class StringEnumTest { + static final SchemaConfiguration configuration = new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().format().build()); +} diff --git a/samples/client/petstore/kotlin/src/test/kotlin/org/openapijsonschematools/client/components/schemas/StringEnumWithDefaultValueTest.kt b/samples/client/petstore/kotlin/src/test/kotlin/org/openapijsonschematools/client/components/schemas/StringEnumWithDefaultValueTest.kt new file mode 100644 index 00000000000..27b9cfa0b45 --- /dev/null +++ b/samples/client/petstore/kotlin/src/test/kotlin/org/openapijsonschematools/client/components/schemas/StringEnumWithDefaultValueTest.kt @@ -0,0 +1,18 @@ +package org.openapijsonschematools.client.components.schemas; + +import org.junit.Assert; +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.MapUtils; +import org.checkerframework.checker.nullness.qual.Nullable; + +import java.util.Arrays; +import java.util.List; +import java.util.Map; +import java.util.AbstractMap; + +public class StringEnumWithDefaultValueTest { + static final SchemaConfiguration configuration = new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().format().build()); +} diff --git a/samples/client/petstore/kotlin/src/test/kotlin/org/openapijsonschematools/client/components/schemas/StringSchemaTest.kt b/samples/client/petstore/kotlin/src/test/kotlin/org/openapijsonschematools/client/components/schemas/StringSchemaTest.kt new file mode 100644 index 00000000000..b8ec5d22b05 --- /dev/null +++ b/samples/client/petstore/kotlin/src/test/kotlin/org/openapijsonschematools/client/components/schemas/StringSchemaTest.kt @@ -0,0 +1,18 @@ +package org.openapijsonschematools.client.components.schemas; + +import org.junit.Assert; +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.MapUtils; +import org.checkerframework.checker.nullness.qual.Nullable; + +import java.util.Arrays; +import java.util.List; +import java.util.Map; +import java.util.AbstractMap; + +public class StringSchemaTest { + static final SchemaConfiguration configuration = new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().format().build()); +} diff --git a/samples/client/petstore/kotlin/src/test/kotlin/org/openapijsonschematools/client/components/schemas/StringWithValidationTest.kt b/samples/client/petstore/kotlin/src/test/kotlin/org/openapijsonschematools/client/components/schemas/StringWithValidationTest.kt new file mode 100644 index 00000000000..a870e7edd7d --- /dev/null +++ b/samples/client/petstore/kotlin/src/test/kotlin/org/openapijsonschematools/client/components/schemas/StringWithValidationTest.kt @@ -0,0 +1,18 @@ +package org.openapijsonschematools.client.components.schemas; + +import org.junit.Assert; +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.MapUtils; +import org.checkerframework.checker.nullness.qual.Nullable; + +import java.util.Arrays; +import java.util.List; +import java.util.Map; +import java.util.AbstractMap; + +public class StringWithValidationTest { + static final SchemaConfiguration configuration = new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().format().build()); +} diff --git a/samples/client/petstore/kotlin/src/test/kotlin/org/openapijsonschematools/client/components/schemas/TagTest.kt b/samples/client/petstore/kotlin/src/test/kotlin/org/openapijsonschematools/client/components/schemas/TagTest.kt new file mode 100644 index 00000000000..c2159d54437 --- /dev/null +++ b/samples/client/petstore/kotlin/src/test/kotlin/org/openapijsonschematools/client/components/schemas/TagTest.kt @@ -0,0 +1,18 @@ +package org.openapijsonschematools.client.components.schemas; + +import org.junit.Assert; +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.MapUtils; +import org.checkerframework.checker.nullness.qual.Nullable; + +import java.util.Arrays; +import java.util.List; +import java.util.Map; +import java.util.AbstractMap; + +public class TagTest { + static final SchemaConfiguration configuration = new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().format().build()); +} diff --git a/samples/client/petstore/kotlin/src/test/kotlin/org/openapijsonschematools/client/components/schemas/TriangleInterfaceTest.kt b/samples/client/petstore/kotlin/src/test/kotlin/org/openapijsonschematools/client/components/schemas/TriangleInterfaceTest.kt new file mode 100644 index 00000000000..a0bfa6346c2 --- /dev/null +++ b/samples/client/petstore/kotlin/src/test/kotlin/org/openapijsonschematools/client/components/schemas/TriangleInterfaceTest.kt @@ -0,0 +1,18 @@ +package org.openapijsonschematools.client.components.schemas; + +import org.junit.Assert; +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.MapUtils; +import org.checkerframework.checker.nullness.qual.Nullable; + +import java.util.Arrays; +import java.util.List; +import java.util.Map; +import java.util.AbstractMap; + +public class TriangleInterfaceTest { + static final SchemaConfiguration configuration = new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().format().build()); +} diff --git a/samples/client/petstore/kotlin/src/test/kotlin/org/openapijsonschematools/client/components/schemas/TriangleTest.kt b/samples/client/petstore/kotlin/src/test/kotlin/org/openapijsonschematools/client/components/schemas/TriangleTest.kt new file mode 100644 index 00000000000..827ce35050f --- /dev/null +++ b/samples/client/petstore/kotlin/src/test/kotlin/org/openapijsonschematools/client/components/schemas/TriangleTest.kt @@ -0,0 +1,18 @@ +package org.openapijsonschematools.client.components.schemas; + +import org.junit.Assert; +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.MapUtils; +import org.checkerframework.checker.nullness.qual.Nullable; + +import java.util.Arrays; +import java.util.List; +import java.util.Map; +import java.util.AbstractMap; + +public class TriangleTest { + static final SchemaConfiguration configuration = new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().format().build()); +} diff --git a/samples/client/petstore/kotlin/src/test/kotlin/org/openapijsonschematools/client/components/schemas/UUIDStringTest.kt b/samples/client/petstore/kotlin/src/test/kotlin/org/openapijsonschematools/client/components/schemas/UUIDStringTest.kt new file mode 100644 index 00000000000..c86ba04ef40 --- /dev/null +++ b/samples/client/petstore/kotlin/src/test/kotlin/org/openapijsonschematools/client/components/schemas/UUIDStringTest.kt @@ -0,0 +1,18 @@ +package org.openapijsonschematools.client.components.schemas; + +import org.junit.Assert; +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.MapUtils; +import org.checkerframework.checker.nullness.qual.Nullable; + +import java.util.Arrays; +import java.util.List; +import java.util.Map; +import java.util.AbstractMap; + +public class UUIDStringTest { + static final SchemaConfiguration configuration = new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().format().build()); +} diff --git a/samples/client/petstore/kotlin/src/test/kotlin/org/openapijsonschematools/client/components/schemas/UserTest.kt b/samples/client/petstore/kotlin/src/test/kotlin/org/openapijsonschematools/client/components/schemas/UserTest.kt new file mode 100644 index 00000000000..940968976d5 --- /dev/null +++ b/samples/client/petstore/kotlin/src/test/kotlin/org/openapijsonschematools/client/components/schemas/UserTest.kt @@ -0,0 +1,18 @@ +package org.openapijsonschematools.client.components.schemas; + +import org.junit.Assert; +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.MapUtils; +import org.checkerframework.checker.nullness.qual.Nullable; + +import java.util.Arrays; +import java.util.List; +import java.util.Map; +import java.util.AbstractMap; + +public class UserTest { + static final SchemaConfiguration configuration = new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().format().build()); +} diff --git a/samples/client/petstore/kotlin/src/test/kotlin/org/openapijsonschematools/client/components/schemas/WhaleTest.kt b/samples/client/petstore/kotlin/src/test/kotlin/org/openapijsonschematools/client/components/schemas/WhaleTest.kt new file mode 100644 index 00000000000..234c293f88d --- /dev/null +++ b/samples/client/petstore/kotlin/src/test/kotlin/org/openapijsonschematools/client/components/schemas/WhaleTest.kt @@ -0,0 +1,18 @@ +package org.openapijsonschematools.client.components.schemas; + +import org.junit.Assert; +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.MapUtils; +import org.checkerframework.checker.nullness.qual.Nullable; + +import java.util.Arrays; +import java.util.List; +import java.util.Map; +import java.util.AbstractMap; + +public class WhaleTest { + static final SchemaConfiguration configuration = new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().format().build()); +} diff --git a/samples/client/petstore/kotlin/src/test/kotlin/org/openapijsonschematools/client/components/schemas/ZebraTest.kt b/samples/client/petstore/kotlin/src/test/kotlin/org/openapijsonschematools/client/components/schemas/ZebraTest.kt new file mode 100644 index 00000000000..e88737726e2 --- /dev/null +++ b/samples/client/petstore/kotlin/src/test/kotlin/org/openapijsonschematools/client/components/schemas/ZebraTest.kt @@ -0,0 +1,18 @@ +package org.openapijsonschematools.client.components.schemas; + +import org.junit.Assert; +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.MapUtils; +import org.checkerframework.checker.nullness.qual.Nullable; + +import java.util.Arrays; +import java.util.List; +import java.util.Map; +import java.util.AbstractMap; + +public class ZebraTest { + static final SchemaConfiguration configuration = new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().format().build()); +} diff --git a/samples/client/petstore/kotlin/src/test/kotlin/org/openapijsonschematools/client/configurations/JsonSchemaKeywordFlagsTest.kt b/samples/client/petstore/kotlin/src/test/kotlin/org/openapijsonschematools/client/configurations/JsonSchemaKeywordFlagsTest.kt new file mode 100644 index 00000000000..a4d3da31623 --- /dev/null +++ b/samples/client/petstore/kotlin/src/test/kotlin/org/openapijsonschematools/client/configurations/JsonSchemaKeywordFlagsTest.kt @@ -0,0 +1,143 @@ +package org.openapijsonschematools.client.configurations; + +import org.junit.Assert; +import org.junit.Test; +import java.util.LinkedHashSet; + +public final class JsonSchemaKeywordFlagsTest { + + @Test + public void testGetEnabledKeywords() { + final JsonSchemaKeywordFlags jsonSchemaKeywordFlags = new JsonSchemaKeywordFlags( + true, + true, + true, + true, + true, + true, + true, + true, + true, + true, + true, + true, + true, + true, + true, + true, + true, + true, + true, + true, + true, + true, + true, + true, + true, + true, + true, + true, + true, + true, + true, + true, + true, + true, + true, + true, + true, + true, + true + ); + LinkedHashSet enabledKeywords = jsonSchemaKeywordFlags.getKeywords(); + LinkedHashSet expectedEnabledKeywords = new LinkedHashSet<>(); + expectedEnabledKeywords.add("additionalProperties"); + expectedEnabledKeywords.add("allOf"); + expectedEnabledKeywords.add("anyOf"); + expectedEnabledKeywords.add("const"); + expectedEnabledKeywords.add("contains"); + expectedEnabledKeywords.add("dependentRequired"); + expectedEnabledKeywords.add("dependentSchemas"); + expectedEnabledKeywords.add("discriminator"); + expectedEnabledKeywords.add("else_"); + expectedEnabledKeywords.add("enum_"); + expectedEnabledKeywords.add("exclusiveMaximum"); + expectedEnabledKeywords.add("exclusiveMinimum"); + expectedEnabledKeywords.add("format"); + expectedEnabledKeywords.add("if_"); + expectedEnabledKeywords.add("maximum"); + expectedEnabledKeywords.add("minimum"); + expectedEnabledKeywords.add("items"); + expectedEnabledKeywords.add("maxContains"); + expectedEnabledKeywords.add("maxItems"); + expectedEnabledKeywords.add("maxLength"); + expectedEnabledKeywords.add("maxProperties"); + expectedEnabledKeywords.add("minContains"); + expectedEnabledKeywords.add("minItems"); + expectedEnabledKeywords.add("minLength"); + expectedEnabledKeywords.add("minProperties"); + expectedEnabledKeywords.add("multipleOf"); + expectedEnabledKeywords.add("not"); + expectedEnabledKeywords.add("oneOf"); + expectedEnabledKeywords.add("pattern"); + expectedEnabledKeywords.add("patternProperties"); + expectedEnabledKeywords.add("prefixItems"); + expectedEnabledKeywords.add("properties"); + expectedEnabledKeywords.add("propertyNames"); + expectedEnabledKeywords.add("required"); + expectedEnabledKeywords.add("then"); + expectedEnabledKeywords.add("type"); + expectedEnabledKeywords.add("uniqueItems"); + expectedEnabledKeywords.add("unevaluatedItems"); + expectedEnabledKeywords.add("unevaluatedProperties"); + Assert.assertEquals(enabledKeywords, expectedEnabledKeywords); + } + + @Test + public void testGetNoEnabledKeywords() { + final JsonSchemaKeywordFlags jsonSchemaKeywordFlags = new JsonSchemaKeywordFlags( + false, + false, + false, + false, + false, + false, + false, + false, + false, + false, + false, + false, + false, + false, + false, + false, + false, + false, + false, + false, + false, + false, + false, + false, + false, + false, + false, + false, + false, + false, + false, + false, + false, + false, + false, + false, + false, + false, + false + ); + LinkedHashSet enabledKeywords = jsonSchemaKeywordFlags.getKeywords(); + LinkedHashSet expectedEnabledKeywords = new LinkedHashSet<>(); + Assert.assertEquals(enabledKeywords, expectedEnabledKeywords); + } +} diff --git a/samples/client/petstore/kotlin/src/test/kotlin/org/openapijsonschematools/client/header/ContentHeaderTest.kt b/samples/client/petstore/kotlin/src/test/kotlin/org/openapijsonschematools/client/header/ContentHeaderTest.kt new file mode 100644 index 00000000000..abba1db4b46 --- /dev/null +++ b/samples/client/petstore/kotlin/src/test/kotlin/org/openapijsonschematools/client/header/ContentHeaderTest.kt @@ -0,0 +1,120 @@ +package org.openapijsonschematools.client.header; + +import org.checkerframework.checker.nullness.qual.Nullable; +import org.junit.Assert; +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; +import java.util.function.BiPredicate; + +public class ContentHeaderTest { + public record ParamTestCase(@Nullable Object payload, Map> expectedSerialization, @Nullable Boolean explode) { + public ParamTestCase(@Nullable Object payload, Map> expectedSerialization) { + this(payload, expectedSerialization, null); + } + } + + @Test + public void testSerialization() throws ValidationException, NotImplementedException { + var mapPayload = new LinkedHashMap(); + mapPayload.put("R", 100); + mapPayload.put("G", 200); + mapPayload.put("B", 150); + List testCases = List.of( + new ParamTestCase( + null, + Map.of("color", List.of("null")) + ), + new ParamTestCase( + true, + Map.of("color", List.of("true")) + ), + new ParamTestCase( + false, + Map.of("color", List.of("false")) + ), + new ParamTestCase( + 1, + Map.of("color", List.of("1")) + ), + new ParamTestCase( + 3.14, + Map.of("color",List.of("3.14")) + ), + new ParamTestCase( + "blue", + Map.of("color", List.of("\"blue\"")) + ), + new ParamTestCase( + "hello world", + Map.of("color", List.of("\"hello world\"")) + ), + new ParamTestCase( + "", + Map.of("color", List.of("\"\"")) + ), + new ParamTestCase( + List.of(), + Map.of("color", List.of("[]")) + ), + new ParamTestCase( + List.of("blue", "black", "brown"), + Map.of("color", List.of("[\"blue\",\"black\",\"brown\"]")) + ), + new ParamTestCase( + List.of("blue", "black", "brown"), + Map.of("color", List.of("[\"blue\",\"black\",\"brown\"]")), + true + ), + new ParamTestCase( + Map.of(), + Map.of("color", List.of("{}")) + ), + new ParamTestCase( + mapPayload, + Map.of("color", List.of("{\"R\":100,\"G\":200,\"B\":150}")) + ), + new ParamTestCase( + mapPayload, + Map.of("color", List.of("{\"R\":100,\"G\":200,\"B\":150}")), + true + ) + ); + SchemaConfiguration configuration = new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().build()); + BiPredicate headerFilter = (key, val) -> true; + class ApplicationJsonMediaType implements MediaType { + @Override + public AnyTypeJsonSchema.AnyTypeJsonSchema1 schema() { + return AnyTypeJsonSchema.AnyTypeJsonSchema1.getInstance(); + } + + @Override + public Nothing? encoding() { + return null; + } + } + AbstractMap.SimpleEntry> content = new AbstractMap.SimpleEntry<>( + "application/json", new ApplicationJsonMediaType() + ); + for (ParamTestCase testCase: testCases) { + var header = new ContentHeader( + true, + false, + testCase.explode, + content + ); + var serialization = header.serialize(testCase.payload, "color", false, configuration); + Assert.assertEquals(HttpHeaders.of(testCase.expectedSerialization, headerFilter), serialization); + } + } +} diff --git a/samples/client/petstore/kotlin/src/test/kotlin/org/openapijsonschematools/client/header/SchemaHeaderTest.kt b/samples/client/petstore/kotlin/src/test/kotlin/org/openapijsonschematools/client/header/SchemaHeaderTest.kt new file mode 100644 index 00000000000..954d0e33a6b --- /dev/null +++ b/samples/client/petstore/kotlin/src/test/kotlin/org/openapijsonschematools/client/header/SchemaHeaderTest.kt @@ -0,0 +1,177 @@ +package org.openapijsonschematools.client.header; + +import org.checkerframework.checker.nullness.qual.Nullable; +import org.junit.Assert; +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.schemas.AnyTypeJsonSchema; +import org.openapijsonschematools.client.schemas.ListJsonSchema; +import org.openapijsonschematools.client.schemas.NullJsonSchema; +import org.openapijsonschematools.client.schemas.NumberJsonSchema; +import org.openapijsonschematools.client.schemas.StringJsonSchema; +import org.openapijsonschematools.client.schemas.validation.JsonSchema; + +import java.net.http.HttpHeaders; +import java.util.LinkedHashMap; +import java.util.List; +import java.util.Map; +import java.util.Set; +import java.util.function.BiPredicate; + +public class SchemaHeaderTest { + public record ParamTestCase(@Nullable Object payload, Map> expectedSerialization, @Nullable Boolean explode) { + public ParamTestCase(@Nullable Object payload, Map> expectedSerialization) { + this(payload, expectedSerialization, null); + } + } + + @Test + public void testSerialization() throws ValidationException, NotImplementedException { + var mapPayload = new LinkedHashMap(); + mapPayload.put("R", 100); + mapPayload.put("G", 200); + mapPayload.put("B", 150); + List testCases = List.of( + new ParamTestCase( + null, + Map.of("color", List.of("")) + ), + new ParamTestCase( + 1, + Map.of("color", List.of("1")) + ), + new ParamTestCase( + 3.14, + Map.of("color",List.of("3.14")) + ), + new ParamTestCase( + "blue", + Map.of("color", List.of("blue")) + ), + new ParamTestCase( + "hello world", + Map.of("color", List.of("hello world")) + ), + new ParamTestCase( + "", + Map.of("color", List.of("")) + ), + new ParamTestCase( + List.of(), + Map.of("color", List.of("")) + ), + new ParamTestCase( + List.of("blue", "black", "brown"), + Map.of("color", List.of("blue,black,brown")) + ), + new ParamTestCase( + List.of("blue", "black", "brown"), + Map.of("color", List.of("blue,black,brown")), + true + ), + new ParamTestCase( + Map.of(), + Map.of("color", List.of("")) + ), + new ParamTestCase( + mapPayload, + Map.of("color", List.of("R,100,G,200,B,150")) + ), + new ParamTestCase( + mapPayload, + Map.of("color", List.of("R=100,G=200,B=150")), + true + ) + ); + SchemaConfiguration configuration = new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().build()); + BiPredicate headerFilter = (key, val) -> true; + for (ParamTestCase testCase: testCases) { + var header = new SchemaHeader( + true, + false, + testCase.explode, + AnyTypeJsonSchema.AnyTypeJsonSchema1.getInstance() + ); + var serialization = header.serialize(testCase.payload, "color", false, configuration); + Assert.assertEquals(HttpHeaders.of(testCase.expectedSerialization, headerFilter), serialization); + } + SchemaHeader boolHeader = new SchemaHeader( + true, + false, + false, + AnyTypeJsonSchema.AnyTypeJsonSchema1.getInstance() + ); + for (boolean value: Set.of(true, false)) { + Assert.assertThrows( + NotImplementedException.class, + () -> boolHeader.serialize(value, "color", false, configuration) + ); + } + } + + private static SchemaHeader getHeader(JsonSchema schema) { + return new SchemaHeader( + true, + false, + false, + schema + ); + } + + @SuppressWarnings("nullness") + private void assertNull(@Nullable Object object) { + Assert.assertNull(object); + } + + @Test + public void testDeserialization() throws ValidationException, NotImplementedException { + SchemaConfiguration configuration = new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().build()); + + SchemaHeader header = getHeader(NullJsonSchema.NullJsonSchema1.getInstance()); + @Nullable Object deserialized = header.deserialize(List.of(""), false, configuration); + assertNull(deserialized); + + header = getHeader(NumberJsonSchema.NumberJsonSchema1.getInstance()); + var deserializedOne = header.deserialize(List.of("1"), false, configuration); + if (deserializedOne == null) { + throw new RuntimeException("invalid value"); + } + @Nullable Object expected = 1L; + Assert.assertEquals(expected, deserializedOne); + + header = getHeader(NumberJsonSchema.NumberJsonSchema1.getInstance()); + var deserialized314 = header.deserialize(List.of("3.14"), false, configuration); + if (deserialized314 == null) { + throw new RuntimeException("invalid value"); + } + expected = 3.14d; + Assert.assertEquals(expected, deserialized314); + + header = getHeader(StringJsonSchema.StringJsonSchema1.getInstance()); + var deserializedBlue = header.deserialize(List.of("blue"), false, configuration); + if (deserializedBlue == null) { + throw new RuntimeException("invalid value"); + } + expected = "blue"; + Assert.assertEquals(expected, deserializedBlue); + + header = getHeader(StringJsonSchema.StringJsonSchema1.getInstance()); + var deserializedHelloWorld = header.deserialize(List.of("hello world"), false, configuration); + if (deserializedHelloWorld == null) { + throw new RuntimeException("invalid value"); + } + expected = "hello world"; + Assert.assertEquals(expected, deserializedHelloWorld); + + header = getHeader(ListJsonSchema.ListJsonSchema1.getInstance()); + var deserializedList = header.deserialize(List.of("blue", "black", "brown"), false, configuration); + if (deserializedList == null) { + throw new RuntimeException("invalid value"); + } + expected = List.of("blue", "black", "brown"); + Assert.assertEquals(expected, deserializedList); + } +} diff --git a/samples/client/petstore/kotlin/src/test/kotlin/org/openapijsonschematools/client/parameter/CookieSerializerTest.kt b/samples/client/petstore/kotlin/src/test/kotlin/org/openapijsonschematools/client/parameter/CookieSerializerTest.kt new file mode 100644 index 00000000000..a46f7fbb5f7 --- /dev/null +++ b/samples/client/petstore/kotlin/src/test/kotlin/org/openapijsonschematools/client/parameter/CookieSerializerTest.kt @@ -0,0 +1,45 @@ +package org.openapijsonschematools.client.parameter; + +import org.junit.Assert; +import org.junit.Test; +import org.openapijsonschematools.client.exceptions.NotImplementedException; +import org.openapijsonschematools.client.schemas.AnyTypeJsonSchema; + +import java.util.AbstractMap; +import java.util.Map; + +public class CookieSerializerTest { + public static class Parameter1 extends SchemaParameter { + public Parameter1() { + super("param1", ParameterInType.COOKIE, true, null, null, null, AnyTypeJsonSchema.AnyTypeJsonSchema1.getInstance()); + } + } + + public static class Parameter2 extends SchemaParameter { + public Parameter2() { + super("param2", ParameterInType.COOKIE, true, null, null, null, AnyTypeJsonSchema.AnyTypeJsonSchema1.getInstance()); + } + } + + public static class CookieParametersSerializer extends CookieSerializer { + protected CookieParametersSerializer() { + super( + Map.ofEntries( + new AbstractMap.SimpleEntry<>("param1", new Parameter1()), + new AbstractMap.SimpleEntry<>("param2", new Parameter2()) + ) + ); + } + } + + @Test + public void testSerialization() throws NotImplementedException { + Map inData = Map.ofEntries( + new AbstractMap.SimpleEntry<>("param1", "a"), + new AbstractMap.SimpleEntry<>("param2", 3.14d) + ); + String cookie = new CookieParametersSerializer().serialize(inData); + String expectedCookie = "param1=a; param2=3.14"; + Assert.assertEquals(expectedCookie, cookie); + } +} \ No newline at end of file diff --git a/samples/client/petstore/kotlin/src/test/kotlin/org/openapijsonschematools/client/parameter/HeadersSerializerTest.kt b/samples/client/petstore/kotlin/src/test/kotlin/org/openapijsonschematools/client/parameter/HeadersSerializerTest.kt new file mode 100644 index 00000000000..2a9acf14219 --- /dev/null +++ b/samples/client/petstore/kotlin/src/test/kotlin/org/openapijsonschematools/client/parameter/HeadersSerializerTest.kt @@ -0,0 +1,49 @@ +package org.openapijsonschematools.client.parameter; + +import org.junit.Assert; +import org.junit.Test; +import org.openapijsonschematools.client.exceptions.NotImplementedException; +import org.openapijsonschematools.client.schemas.AnyTypeJsonSchema; + +import java.util.AbstractMap; +import java.util.Map; +import java.util.List; + +public class HeadersSerializerTest { + public static class Param1HeaderParameter extends SchemaParameter { + public Param1HeaderParameter() { + super("param1", ParameterInType.HEADER, true, null, null, null, AnyTypeJsonSchema.AnyTypeJsonSchema1.getInstance()); + } + } + + public static class Param2HeaderParameter extends SchemaParameter { + public Param2HeaderParameter() { + super("param2", ParameterInType.HEADER, true, null, null, null, AnyTypeJsonSchema.AnyTypeJsonSchema1.getInstance()); + } + } + + public static class HeaderParametersSerializer extends HeadersSerializer { + protected HeaderParametersSerializer() { + super( + Map.ofEntries( + new AbstractMap.SimpleEntry<>("param1", new Param1HeaderParameter()), + new AbstractMap.SimpleEntry<>("param2", new Param2HeaderParameter()) + ) + ); + } + } + + @Test + public void testSerialization() throws NotImplementedException { + Map inData = Map.ofEntries( + new AbstractMap.SimpleEntry<>("param1", "a"), + new AbstractMap.SimpleEntry<>("param2", 3.14d) + ); + Map> expectedHeaders = Map.ofEntries( + new AbstractMap.SimpleEntry<>("param1", List.of("a")), + new AbstractMap.SimpleEntry<>("param2", List.of("3.14")) + ); + Map> headers = new HeaderParametersSerializer().serialize(inData); + Assert.assertEquals(expectedHeaders, headers); + } +} \ No newline at end of file diff --git a/samples/client/petstore/kotlin/src/test/kotlin/org/openapijsonschematools/client/parameter/PathSerializerTest.kt b/samples/client/petstore/kotlin/src/test/kotlin/org/openapijsonschematools/client/parameter/PathSerializerTest.kt new file mode 100644 index 00000000000..3ff2ac5ed88 --- /dev/null +++ b/samples/client/petstore/kotlin/src/test/kotlin/org/openapijsonschematools/client/parameter/PathSerializerTest.kt @@ -0,0 +1,46 @@ +package org.openapijsonschematools.client.parameter; + +import org.junit.Assert; +import org.junit.Test; +import org.openapijsonschematools.client.exceptions.NotImplementedException; +import org.openapijsonschematools.client.schemas.AnyTypeJsonSchema; + +import java.util.AbstractMap; +import java.util.Map; + +public class PathSerializerTest { + public static class Parameter1 extends SchemaParameter { + public Parameter1() { + super("param1", ParameterInType.PATH, true, null, null, null, AnyTypeJsonSchema.AnyTypeJsonSchema1.getInstance()); + } + } + + public static class Parameter2 extends SchemaParameter { + public Parameter2() { + super("param2", ParameterInType.PATH, true, null, null, null, AnyTypeJsonSchema.AnyTypeJsonSchema1.getInstance()); + } + } + + public static class PathParametersSerializer extends PathSerializer { + protected PathParametersSerializer() { + super( + Map.ofEntries( + new AbstractMap.SimpleEntry<>("param1", new Parameter1()), + new AbstractMap.SimpleEntry<>("param2", new Parameter2()) + ) + ); + } + } + + @Test + public void testSerialization() throws NotImplementedException { + Map inData = Map.ofEntries( + new AbstractMap.SimpleEntry<>("param1", "a"), + new AbstractMap.SimpleEntry<>("param2", 3.14d) + ); + String pathWithPlaceholders = "/{param1}/{param2}"; + String path = new PathParametersSerializer().serialize(inData, pathWithPlaceholders); + String expectedPath = "/a/3.14"; + Assert.assertEquals(expectedPath, path); + } +} \ No newline at end of file diff --git a/samples/client/petstore/kotlin/src/test/kotlin/org/openapijsonschematools/client/parameter/QuerySerializerTest.kt b/samples/client/petstore/kotlin/src/test/kotlin/org/openapijsonschematools/client/parameter/QuerySerializerTest.kt new file mode 100644 index 00000000000..7cb559fef3c --- /dev/null +++ b/samples/client/petstore/kotlin/src/test/kotlin/org/openapijsonschematools/client/parameter/QuerySerializerTest.kt @@ -0,0 +1,52 @@ +package org.openapijsonschematools.client.parameter; + +import org.junit.Assert; +import org.junit.Test; +import org.openapijsonschematools.client.exceptions.NotImplementedException; +import org.openapijsonschematools.client.schemas.AnyTypeJsonSchema; + +import java.util.AbstractMap; +import java.util.Map; + +public class QuerySerializerTest { + public static class Param1QueryParameter extends SchemaParameter { + public Param1QueryParameter() { + super("param1", ParameterInType.QUERY, true, null, null, null, AnyTypeJsonSchema.AnyTypeJsonSchema1.getInstance()); + } + } + + public static class Param2QueryParameter extends SchemaParameter { + public Param2QueryParameter() { + super("param2", ParameterInType.QUERY, true, null, null, null, AnyTypeJsonSchema.AnyTypeJsonSchema1.getInstance()); + } + } + + public static class QueryParametersSerializer extends QuerySerializer { + protected QueryParametersSerializer() { + super( + Map.ofEntries( + new AbstractMap.SimpleEntry<>("param1", new Param1QueryParameter()), + new AbstractMap.SimpleEntry<>("param2", new Param2QueryParameter()) + ) + ); + } + } + + @Test + public void testSerialization() throws NotImplementedException { + Map inData = Map.ofEntries( + new AbstractMap.SimpleEntry<>("param1", "a"), + new AbstractMap.SimpleEntry<>("param2", 3.14d) + ); + var serializer = new QueryParametersSerializer(); + var queryMap = serializer.getQueryMap(inData); + Map expectedQueryMap = Map.ofEntries( + new AbstractMap.SimpleEntry<>("param1", "param1=a"), + new AbstractMap.SimpleEntry<>("param2", "param2=3.14") + ); + Assert.assertEquals(expectedQueryMap, queryMap); + String query = serializer.serialize(queryMap); + String expectedQuery = "?param1=a¶m2=3.14"; + Assert.assertEquals(expectedQuery, query); + } +} \ No newline at end of file diff --git a/samples/client/petstore/kotlin/src/test/kotlin/org/openapijsonschematools/client/parameter/SchemaNonQueryParameterTest.kt b/samples/client/petstore/kotlin/src/test/kotlin/org/openapijsonschematools/client/parameter/SchemaNonQueryParameterTest.kt new file mode 100644 index 00000000000..4d799c14c72 --- /dev/null +++ b/samples/client/petstore/kotlin/src/test/kotlin/org/openapijsonschematools/client/parameter/SchemaNonQueryParameterTest.kt @@ -0,0 +1,397 @@ +package org.openapijsonschematools.client.parameter; + +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.schemas.AnyTypeJsonSchema; + +import java.util.LinkedHashMap; +import java.util.List; +import java.util.Map; +import java.util.AbstractMap; +import java.util.Set; + +public class SchemaNonQueryParameterTest { + public record ParamTestCase(@Nullable Object payload, AbstractMap.SimpleEntry expectedSerialization, @Nullable Boolean explode) { + public ParamTestCase(@Nullable Object payload, AbstractMap.SimpleEntry expectedSerialization) { + this(payload, expectedSerialization, null); + } + } + + public static class HeaderParameter extends SchemaParameter { + public HeaderParameter(@Nullable Boolean explode) { + super("color", ParameterInType.HEADER, true, null, explode, null, AnyTypeJsonSchema.AnyTypeJsonSchema1.getInstance()); + } + } + + @Test + public void testHeaderSerialization() throws NotImplementedException { + var mapPayload = new LinkedHashMap(); + mapPayload.put("R", 100); + mapPayload.put("G", 200); + mapPayload.put("B", 150); + List testCases = List.of( + new ParamTestCase( + null, + new AbstractMap.SimpleEntry<>("color", "") + ), + new ParamTestCase( + 1, + new AbstractMap.SimpleEntry<>("color", "1") + ), + new ParamTestCase( + 3.14, + new AbstractMap.SimpleEntry<>("color","3.14") + ), + new ParamTestCase( + "blue", + new AbstractMap.SimpleEntry<>("color", "blue") + ), + new ParamTestCase( + "hello world", + new AbstractMap.SimpleEntry<>("color", "hello world") + ), + new ParamTestCase( + "", + new AbstractMap.SimpleEntry<>("color", "") + ), + new ParamTestCase( + List.of(), + new AbstractMap.SimpleEntry<>("color", "") + ), + new ParamTestCase( + List.of("blue", "black", "brown"), + new AbstractMap.SimpleEntry<>("color", "blue,black,brown") + ), + new ParamTestCase( + List.of("blue", "black", "brown"), + new AbstractMap.SimpleEntry<>("color", "blue,black,brown"), + true + ), + new ParamTestCase( + Map.of(), + new AbstractMap.SimpleEntry<>("color", "") + ), + new ParamTestCase( + mapPayload, + new AbstractMap.SimpleEntry<>("color", "R,100,G,200,B,150") + ), + new ParamTestCase( + mapPayload, + new AbstractMap.SimpleEntry<>("color", "R=100,G=200,B=150"), + true + ) + ); + for (ParamTestCase testCase: testCases) { + var header = new HeaderParameter(testCase.explode); + var serialization = header.serialize(testCase.payload); + Assert.assertEquals(testCase.expectedSerialization, serialization); + } + var boolHeader = new HeaderParameter(false); + for (boolean value: Set.of(true, false)) { + Assert.assertThrows( + NotImplementedException.class, + () -> boolHeader.serialize(value) + ); + } + } + + public static class PathParameter extends SchemaParameter { + public PathParameter(@Nullable Boolean explode) { + super("color", ParameterInType.PATH, true, null, explode, null, AnyTypeJsonSchema.AnyTypeJsonSchema1.getInstance()); + } + } + + @Test + public void testPathSerialization() throws NotImplementedException { + var mapPayload = new LinkedHashMap(); + mapPayload.put("R", 100); + mapPayload.put("G", 200); + mapPayload.put("B", 150); + List testCases = List.of( + new ParamTestCase( + null, + new AbstractMap.SimpleEntry<>("color", "") + ), + new ParamTestCase( + 1, + new AbstractMap.SimpleEntry<>("color", "1") + ), + new ParamTestCase( + 3.14, + new AbstractMap.SimpleEntry<>("color","3.14") + ), + new ParamTestCase( + "blue", + new AbstractMap.SimpleEntry<>("color", "blue") + ), + new ParamTestCase( + "hello world", + new AbstractMap.SimpleEntry<>("color", "hello%20world") + ), + new ParamTestCase( + "", + new AbstractMap.SimpleEntry<>("color", "") + ), + new ParamTestCase( + List.of(), + new AbstractMap.SimpleEntry<>("color", "") + ), + new ParamTestCase( + List.of("blue", "black", "brown"), + new AbstractMap.SimpleEntry<>("color", "blue,black,brown") + ), + new ParamTestCase( + List.of("blue", "black", "brown"), + new AbstractMap.SimpleEntry<>("color", "blue,black,brown"), + true + ), + new ParamTestCase( + Map.of(), + new AbstractMap.SimpleEntry<>("color", "") + ), + new ParamTestCase( + mapPayload, + new AbstractMap.SimpleEntry<>("color", "R,100,G,200,B,150") + ), + new ParamTestCase( + mapPayload, + new AbstractMap.SimpleEntry<>("color", "R=100,G=200,B=150"), + true + ) + ); + for (ParamTestCase testCase: testCases) { + var pathParameter = new PathParameter(testCase.explode); + var serialization = pathParameter.serialize(testCase.payload); + Assert.assertEquals(testCase.expectedSerialization, serialization); + } + var pathParameter = new PathParameter(false); + for (boolean value: Set.of(true, false)) { + Assert.assertThrows( + NotImplementedException.class, + () -> pathParameter.serialize(value) + ); + } + } + + public static class CookieParameter extends SchemaParameter { + public CookieParameter(@Nullable Boolean explode) { + super("color", ParameterInType.COOKIE, true, null, explode, null, AnyTypeJsonSchema.AnyTypeJsonSchema1.getInstance()); + } + } + + @Test + public void testCookieSerialization() throws NotImplementedException { + var mapPayload = new LinkedHashMap(); + mapPayload.put("R", 100); + mapPayload.put("G", 200); + mapPayload.put("B", 150); + List testCases = List.of( + new ParamTestCase( + null, + new AbstractMap.SimpleEntry<>("color", "") + ), + new ParamTestCase( + 1, + new AbstractMap.SimpleEntry<>("color", "color=1") + ), + new ParamTestCase( + 3.14, + new AbstractMap.SimpleEntry<>("color","color=3.14") + ), + new ParamTestCase( + "blue", + new AbstractMap.SimpleEntry<>("color", "color=blue") + ), + new ParamTestCase( + "hello world", + new AbstractMap.SimpleEntry<>("color", "color=hello world") + ), + new ParamTestCase( + "", + new AbstractMap.SimpleEntry<>("color", "color=") + ), + new ParamTestCase( + List.of(), + new AbstractMap.SimpleEntry<>("color", "") + ), + new ParamTestCase( + List.of("blue", "black", "brown"), + new AbstractMap.SimpleEntry<>("color", "color=blue&color=black&color=brown") + ), + new ParamTestCase( + List.of("blue", "black", "brown"), + new AbstractMap.SimpleEntry<>("color", "color=blue&color=black&color=brown"), + true + ), + new ParamTestCase( + Map.of(), + new AbstractMap.SimpleEntry<>("color", "") + ), + new ParamTestCase( + mapPayload, + new AbstractMap.SimpleEntry<>("color", "R=100&G=200&B=150") + ), + new ParamTestCase( + mapPayload, + new AbstractMap.SimpleEntry<>("color", "R=100&G=200&B=150"), + true + ) + ); + for (ParamTestCase testCase: testCases) { + var cookieParameter = new CookieParameter(testCase.explode); + var serialization = cookieParameter.serialize(testCase.payload); + Assert.assertEquals(testCase.expectedSerialization, serialization); + } + var cookieParameter = new CookieParameter(false); + for (boolean value: Set.of(true, false)) { + Assert.assertThrows( + NotImplementedException.class, + () -> cookieParameter.serialize(value) + ); + } + } + + public static class PathMatrixParameter extends SchemaParameter { + public PathMatrixParameter(@Nullable Boolean explode) { + super("color", ParameterInType.PATH, true, ParameterStyle.MATRIX, explode, null, AnyTypeJsonSchema.AnyTypeJsonSchema1.getInstance()); + } + } + + @Test + public void testPathMatrixSerialization() throws NotImplementedException { + var mapPayload = new LinkedHashMap(); + mapPayload.put("R", 100); + mapPayload.put("G", 200); + mapPayload.put("B", 150); + List testCases = List.of( + new ParamTestCase( + null, + new AbstractMap.SimpleEntry<>("color", "") + ), + new ParamTestCase( + 1, + new AbstractMap.SimpleEntry<>("color", ";color=1") + ), + new ParamTestCase( + 3.14, + new AbstractMap.SimpleEntry<>("color",";color=3.14") + ), + new ParamTestCase( + "blue", + new AbstractMap.SimpleEntry<>("color", ";color=blue") + ), + new ParamTestCase( + "hello world", + new AbstractMap.SimpleEntry<>("color", ";color=hello%20world") + ), + new ParamTestCase( + "", + new AbstractMap.SimpleEntry<>("color", ";color") + ), + new ParamTestCase( + List.of(), + new AbstractMap.SimpleEntry<>("color", "") + ), + new ParamTestCase( + List.of("blue", "black", "brown"), + new AbstractMap.SimpleEntry<>("color", ";color=blue,black,brown") + ), + new ParamTestCase( + List.of("blue", "black", "brown"), + new AbstractMap.SimpleEntry<>("color", ";color=blue;color=black;color=brown"), + true + ), + new ParamTestCase( + Map.of(), + new AbstractMap.SimpleEntry<>("color", "") + ), + new ParamTestCase( + mapPayload, + new AbstractMap.SimpleEntry<>("color", ";color=R,100,G,200,B,150") + ), + new ParamTestCase( + mapPayload, + new AbstractMap.SimpleEntry<>("color", ";R=100;G=200;B=150"), + true + ) + ); + for (ParamTestCase testCase: testCases) { + var pathParameter = new PathMatrixParameter(testCase.explode); + var serialization = pathParameter.serialize(testCase.payload); + Assert.assertEquals(testCase.expectedSerialization, serialization); + } + } + + public static class PathLabelParameter extends SchemaParameter { + public PathLabelParameter(@Nullable Boolean explode) { + super("color", ParameterInType.PATH, true, ParameterStyle.LABEL, explode, null, AnyTypeJsonSchema.AnyTypeJsonSchema1.getInstance()); + } + } + + @Test + public void testPathLabelSerialization() throws NotImplementedException { + var mapPayload = new LinkedHashMap(); + mapPayload.put("R", 100); + mapPayload.put("G", 200); + mapPayload.put("B", 150); + List testCases = List.of( + new ParamTestCase( + null, + new AbstractMap.SimpleEntry<>("color", "") + ), + new ParamTestCase( + 1, + new AbstractMap.SimpleEntry<>("color", ".1") + ), + new ParamTestCase( + 3.14, + new AbstractMap.SimpleEntry<>("color",".3.14") + ), + new ParamTestCase( + "blue", + new AbstractMap.SimpleEntry<>("color", ".blue") + ), + new ParamTestCase( + "hello world", + new AbstractMap.SimpleEntry<>("color", ".hello%20world") + ), + new ParamTestCase( + "", + new AbstractMap.SimpleEntry<>("color", ".") + ), + new ParamTestCase( + List.of(), + new AbstractMap.SimpleEntry<>("color", "") + ), + new ParamTestCase( + List.of("blue", "black", "brown"), + new AbstractMap.SimpleEntry<>("color", ".blue.black.brown") + ), + new ParamTestCase( + List.of("blue", "black", "brown"), + new AbstractMap.SimpleEntry<>("color", ".blue.black.brown"), + true + ), + new ParamTestCase( + Map.of(), + new AbstractMap.SimpleEntry<>("color", "") + ), + new ParamTestCase( + mapPayload, + new AbstractMap.SimpleEntry<>("color", ".R.100.G.200.B.150") + ), + new ParamTestCase( + mapPayload, + new AbstractMap.SimpleEntry<>("color", ".R=100.G=200.B=150"), + true + ) + ); + for (ParamTestCase testCase: testCases) { + var pathParameter = new PathLabelParameter(testCase.explode); + var serialization = pathParameter.serialize(testCase.payload); + Assert.assertEquals(testCase.expectedSerialization, serialization); + } + } +} \ No newline at end of file diff --git a/samples/client/petstore/kotlin/src/test/kotlin/org/openapijsonschematools/client/parameter/SchemaQueryParameterTest.kt b/samples/client/petstore/kotlin/src/test/kotlin/org/openapijsonschematools/client/parameter/SchemaQueryParameterTest.kt new file mode 100644 index 00000000000..413b092634f --- /dev/null +++ b/samples/client/petstore/kotlin/src/test/kotlin/org/openapijsonschematools/client/parameter/SchemaQueryParameterTest.kt @@ -0,0 +1,193 @@ +package org.openapijsonschematools.client.parameter; + +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.schemas.AnyTypeJsonSchema; + +import java.util.LinkedHashMap; +import java.util.List; +import java.util.AbstractMap; +import java.util.Map; +import java.util.Set; + +public class SchemaQueryParameterTest { + public record ParamTestCase(@Nullable Object payload, AbstractMap.SimpleEntry expectedSerialization, @Nullable Boolean explode) { + public ParamTestCase(@Nullable Object payload, AbstractMap.SimpleEntry expectedSerialization) { + this(payload, expectedSerialization, null); + } + } + + public static class QueryParameterNoStyle extends SchemaParameter { + public QueryParameterNoStyle(@Nullable Boolean explode) { + super("color", ParameterInType.QUERY, true, null, explode, null, AnyTypeJsonSchema.AnyTypeJsonSchema1.getInstance()); + } + } + + @Test + public void testQueryParameterNoStyleSerialization() throws NotImplementedException { + var mapPayload = new LinkedHashMap(); + mapPayload.put("R", 100); + mapPayload.put("G", 200); + mapPayload.put("B", 150); + List testCases = List.of( + new ParamTestCase( + null, + new AbstractMap.SimpleEntry<>("color", "") + ), + new ParamTestCase( + 1, + new AbstractMap.SimpleEntry<>("color", "color=1") + ), + new ParamTestCase( + 3.14, + new AbstractMap.SimpleEntry<>("color","color=3.14") + ), + new ParamTestCase( + "blue", + new AbstractMap.SimpleEntry<>("color", "color=blue") + ), + new ParamTestCase( + "hello world", + new AbstractMap.SimpleEntry<>("color", "color=hello%20world") + ), + new ParamTestCase( + "", + new AbstractMap.SimpleEntry<>("color", "color=") + ), + new ParamTestCase( + List.of(), + new AbstractMap.SimpleEntry<>("color", "") + ), + new ParamTestCase( + List.of("blue", "black", "brown"), + new AbstractMap.SimpleEntry<>("color", "color=blue&color=black&color=brown") + ), + new ParamTestCase( + List.of("blue", "black", "brown"), + new AbstractMap.SimpleEntry<>("color", "color=blue&color=black&color=brown"), + true + ), + new ParamTestCase( + Map.of(), + new AbstractMap.SimpleEntry<>("color", "") + ), + new ParamTestCase( + mapPayload, + new AbstractMap.SimpleEntry<>("color", "R=100&G=200&B=150") + ), + new ParamTestCase( + mapPayload, + new AbstractMap.SimpleEntry<>("color", "R=100&G=200&B=150"), + true + ) + ); + for (ParamTestCase testCase: testCases) { + var parameter = new QueryParameterNoStyle(testCase.explode); + var serialization = parameter.serialize(testCase.payload); + Assert.assertEquals(testCase.expectedSerialization, serialization); + } + var parameter = new QueryParameterNoStyle(false); + for (boolean value: Set.of(true, false)) { + Assert.assertThrows( + NotImplementedException.class, + () -> parameter.serialize(value) + ); + } + } + + public static class QueryParameterSpaceDelimited extends SchemaParameter { + public QueryParameterSpaceDelimited(@Nullable Boolean explode) { + super("color", ParameterInType.QUERY, true, ParameterStyle.SPACE_DELIMITED, explode, null, AnyTypeJsonSchema.AnyTypeJsonSchema1.getInstance()); + } + } + + @Test + public void testQueryParameterSpaceDelimitedSerialization() throws NotImplementedException { + var mapPayload = new LinkedHashMap(); + mapPayload.put("R", 100); + mapPayload.put("G", 200); + mapPayload.put("B", 150); + List testCases = List.of( + new ParamTestCase( + List.of(), + new AbstractMap.SimpleEntry<>("color", "") + ), + new ParamTestCase( + List.of("blue", "black", "brown"), + new AbstractMap.SimpleEntry<>("color", "blue%20black%20brown") + ), + new ParamTestCase( + List.of("blue", "black", "brown"), + new AbstractMap.SimpleEntry<>("color", "blue%20black%20brown"), + true + ), + new ParamTestCase( + Map.of(), + new AbstractMap.SimpleEntry<>("color", "") + ), + new ParamTestCase( + mapPayload, + new AbstractMap.SimpleEntry<>("color", "R%20100%20G%20200%20B%20150") + ), + new ParamTestCase( + mapPayload, + new AbstractMap.SimpleEntry<>("color", "R=100%20G=200%20B=150"), + true + ) + ); + for (ParamTestCase testCase: testCases) { + var parameter = new QueryParameterSpaceDelimited(testCase.explode); + var serialization = parameter.serialize(testCase.payload); + Assert.assertEquals(testCase.expectedSerialization, serialization); + } + } + + public static class QueryParameterPipeDelimited extends SchemaParameter { + public QueryParameterPipeDelimited(@Nullable Boolean explode) { + super("color", ParameterInType.QUERY, true, ParameterStyle.PIPE_DELIMITED, explode, null, AnyTypeJsonSchema.AnyTypeJsonSchema1.getInstance()); + } + } + + @Test + public void testQueryParameterPipeDelimitedSerialization() throws NotImplementedException { + var mapPayload = new LinkedHashMap(); + mapPayload.put("R", 100); + mapPayload.put("G", 200); + mapPayload.put("B", 150); + List testCases = List.of( + new ParamTestCase( + List.of(), + new AbstractMap.SimpleEntry<>("color", "") + ), + new ParamTestCase( + List.of("blue", "black", "brown"), + new AbstractMap.SimpleEntry<>("color", "blue|black|brown") + ), + new ParamTestCase( + List.of("blue", "black", "brown"), + new AbstractMap.SimpleEntry<>("color", "blue|black|brown"), + true + ), + new ParamTestCase( + Map.of(), + new AbstractMap.SimpleEntry<>("color", "") + ), + new ParamTestCase( + mapPayload, + new AbstractMap.SimpleEntry<>("color", "R|100|G|200|B|150") + ), + new ParamTestCase( + mapPayload, + new AbstractMap.SimpleEntry<>("color", "R=100|G=200|B=150"), + true + ) + ); + for (ParamTestCase testCase: testCases) { + var parameter = new QueryParameterPipeDelimited(testCase.explode); + var serialization = parameter.serialize(testCase.payload); + Assert.assertEquals(testCase.expectedSerialization, serialization); + } + } +} diff --git a/samples/client/petstore/kotlin/src/test/kotlin/org/openapijsonschematools/client/requestbody/RequestBodySerializerTest.kt b/samples/client/petstore/kotlin/src/test/kotlin/org/openapijsonschematools/client/requestbody/RequestBodySerializerTest.kt new file mode 100644 index 00000000000..9594b4876f4 --- /dev/null +++ b/samples/client/petstore/kotlin/src/test/kotlin/org/openapijsonschematools/client/requestbody/RequestBodySerializerTest.kt @@ -0,0 +1,181 @@ +package org.openapijsonschematools.client.requestbody; + +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; + +import org.checkerframework.checker.nullness.qual.Nullable; +import org.junit.Assert; +import org.junit.Test; + +import java.net.http.HttpResponse; +import java.nio.ByteBuffer; +import java.nio.charset.StandardCharsets; +import java.util.AbstractMap; +import java.util.List; +import java.util.Map; +import java.util.concurrent.Flow; + +public final class RequestBodySerializerTest { + public sealed interface SealedMediaType permits ApplicationjsonMediaType, TextplainMediaType {} + public record ApplicationjsonMediaType(AnyTypeJsonSchema.AnyTypeJsonSchema1 schema) implements SealedMediaType {} + public record TextplainMediaType(StringJsonSchema.StringJsonSchema1 schema) implements SealedMediaType {} + + public sealed interface SealedRequestBody permits ApplicationjsonRequestBody, TextplainRequestBody {} + public record ApplicationjsonRequestBody(AnyTypeJsonSchema.AnyTypeJsonSchema1Boxed body) implements SealedRequestBody, GenericRequestBody<@Nullable Object> { + @Override + public String contentType() { + return "application/json"; + } + } + public record TextplainRequestBody(StringJsonSchema.StringJsonSchema1Boxed body) implements SealedRequestBody, GenericRequestBody<@Nullable Object> { + @Override + public String contentType() { + return "text/plain"; + } + } + + public static class MyRequestBodySerializer extends RequestBodySerializer { + public MyRequestBodySerializer() { + super( + Map.ofEntries( + new AbstractMap.SimpleEntry<>("application/json", new ApplicationjsonMediaType(AnyTypeJsonSchema.AnyTypeJsonSchema1.getInstance())), + new AbstractMap.SimpleEntry<>("text/plain", new TextplainMediaType(StringJsonSchema.StringJsonSchema1.getInstance())) + ), + true); + } + + public SerializedRequestBody serialize(SealedRequestBody requestBody) throws NotImplementedException { + if (requestBody instanceof ApplicationjsonRequestBody requestBody0) { + return serialize(requestBody0.contentType(), requestBody0.body().getData()); + } else { + TextplainRequestBody requestBody1 = (TextplainRequestBody) requestBody; + return serialize(requestBody1.contentType(), requestBody1.body().getData()); + } + } + } + + @Test + public void testContentTypeIsJson() { + Assert.assertTrue(ContentTypeDetector.contentTypeIsJson("application/json")); + Assert.assertTrue(ContentTypeDetector.contentTypeIsJson("application/json; charset=UTF-8")); + Assert.assertTrue(ContentTypeDetector.contentTypeIsJson("application/json-patch+json")); + Assert.assertTrue(ContentTypeDetector.contentTypeIsJson("application/geo+json")); + + Assert.assertFalse(ContentTypeDetector.contentTypeIsJson("application/octet-stream")); + Assert.assertFalse(ContentTypeDetector.contentTypeIsJson("text/plain")); + } + + static final class StringSubscriber implements Flow.Subscriber { + final HttpResponse.BodySubscriber wrapped; + StringSubscriber(HttpResponse.BodySubscriber wrapped) { + this.wrapped = wrapped; + } + @Override + public void onSubscribe(Flow.Subscription subscription) { + wrapped.onSubscribe(subscription); + } + @Override + public void onNext(ByteBuffer item) { wrapped.onNext(List.of(item)); } + @Override + public void onError(Throwable throwable) { wrapped.onError(throwable); } + @Override + public void onComplete() { wrapped.onComplete(); } + } + + private String getJsonBody(SerializedRequestBody requestBody) { + var bodySubscriber = HttpResponse.BodySubscribers.ofString(StandardCharsets.UTF_8); + var flowSubscriber = new StringSubscriber(bodySubscriber); + requestBody.bodyPublisher.subscribe(flowSubscriber); + return bodySubscriber.getBody().toCompletableFuture().join(); + } + + @Test + public void testSerializeApplicationJson() throws ValidationException, NotImplementedException { + SchemaConfiguration configuration = new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().build()); + var serializer = new MyRequestBodySerializer(); + String jsonBody; + SerializedRequestBody requestBody = serializer.serialize( + new ApplicationjsonRequestBody( + AnyTypeJsonSchema.AnyTypeJsonSchema1.getInstance().validateAndBox(1, configuration) + ) + ); + Assert.assertEquals("application/json", requestBody.contentType); + jsonBody = getJsonBody(requestBody); + Assert.assertEquals(jsonBody, "1"); + + requestBody = serializer.serialize( + new ApplicationjsonRequestBody( + AnyTypeJsonSchema.AnyTypeJsonSchema1.getInstance().validateAndBox(3.14, configuration) + ) + ); + jsonBody = getJsonBody(requestBody); + Assert.assertEquals(jsonBody, "3.14"); + + requestBody = serializer.serialize( + new ApplicationjsonRequestBody( + AnyTypeJsonSchema.AnyTypeJsonSchema1.getInstance().validateAndBox((Nothing?) null, configuration) + ) + ); + jsonBody = getJsonBody(requestBody); + Assert.assertEquals(jsonBody, "null"); + + requestBody = serializer.serialize( + new ApplicationjsonRequestBody( + AnyTypeJsonSchema.AnyTypeJsonSchema1.getInstance().validateAndBox(true, configuration) + ) + ); + jsonBody = getJsonBody(requestBody); + Assert.assertEquals(jsonBody, "true"); + + requestBody = serializer.serialize( + new ApplicationjsonRequestBody( + AnyTypeJsonSchema.AnyTypeJsonSchema1.getInstance().validateAndBox(false, configuration) + ) + ); + jsonBody = getJsonBody(requestBody); + Assert.assertEquals(jsonBody, "false"); + + requestBody = serializer.serialize( + new ApplicationjsonRequestBody( + AnyTypeJsonSchema.AnyTypeJsonSchema1.getInstance().validateAndBox(List.of(), configuration) + ) + ); + jsonBody = getJsonBody(requestBody); + Assert.assertEquals(jsonBody, "[]"); + + requestBody = serializer.serialize( + new ApplicationjsonRequestBody( + AnyTypeJsonSchema.AnyTypeJsonSchema1.getInstance().validateAndBox(Map.of(), configuration) + ) + ); + jsonBody = getJsonBody(requestBody); + Assert.assertEquals(jsonBody, "{}"); + + requestBody = serializer.serialize( + new ApplicationjsonRequestBody( + AnyTypeJsonSchema.AnyTypeJsonSchema1.getInstance().validateAndBox(Map.of("k1", "v1", "k2", "v2"), configuration) + ) + ); + jsonBody = getJsonBody(requestBody); + Assert.assertEquals(jsonBody, "{\"k2\":\"v2\",\"k1\":\"v1\"}"); + } + + @Test + public void testSerializeTextPlain() throws ValidationException, NotImplementedException { + SchemaConfiguration configuration = new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().build()); + var serializer = new MyRequestBodySerializer(); + SerializedRequestBody requestBody = serializer.serialize( + new TextplainRequestBody( + StringJsonSchema.StringJsonSchema1.getInstance().validateAndBox("a", configuration) + ) + ); + Assert.assertEquals("text/plain", requestBody.contentType); + String textBody = getJsonBody(requestBody); + Assert.assertEquals(textBody, "a"); + } +} \ No newline at end of file diff --git a/samples/client/petstore/kotlin/src/test/kotlin/org/openapijsonschematools/client/response/ResponseDeserializerTest.kt b/samples/client/petstore/kotlin/src/test/kotlin/org/openapijsonschematools/client/response/ResponseDeserializerTest.kt new file mode 100644 index 00000000000..50c9678a4a1 --- /dev/null +++ b/samples/client/petstore/kotlin/src/test/kotlin/org/openapijsonschematools/client/response/ResponseDeserializerTest.kt @@ -0,0 +1,248 @@ +package org.openapijsonschematools.client.response; + +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.ToNumberPolicy; +import org.checkerframework.checker.nullness.qual.Nullable; +import org.junit.Assert; +import org.junit.Test; +import 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; + +import javax.net.ssl.SSLSession; +import java.net.URI; +import java.net.http.HttpClient; +import java.net.http.HttpHeaders; +import java.net.http.HttpRequest; +import java.net.http.HttpResponse; +import java.nio.charset.StandardCharsets; +import java.util.List; +import java.util.Map; +import java.util.Optional; +import java.util.function.BiPredicate; + +public class ResponseDeserializerTest { + private static final Gson gson = new GsonBuilder() + .setObjectToNumberStrategy(ToNumberPolicy.LONG_OR_DOUBLE) + .setNumberToNumberStrategy(ToNumberPolicy.LONG_OR_DOUBLE) + .create(); + public sealed interface SealedResponseBody permits ApplicationjsonBody, TextplainBody { } + + public record ApplicationjsonBody(AnyTypeJsonSchema.AnyTypeJsonSchema1Boxed body) implements SealedResponseBody { } + + public record TextplainBody(StringJsonSchema.StringJsonSchema1Boxed body) implements SealedResponseBody {} + + public sealed interface SealedMediaType permits ApplicationjsonMediatype, TextplainMediatype { } + + public record ApplicationjsonMediatype(AnyTypeJsonSchema.AnyTypeJsonSchema1 schema) implements SealedMediaType, MediaType { + public ApplicationjsonMediatype() { + this(AnyTypeJsonSchema.AnyTypeJsonSchema1.getInstance()); + } + @Override + public Nothing? encoding() { + return null; + } + } + + public record TextplainMediatype(StringJsonSchema.StringJsonSchema1 schema) implements SealedMediaType, MediaType { + public TextplainMediatype() { + this(StringJsonSchema.StringJsonSchema1.getInstance()); + } + @Override + public Nothing? encoding() { + return null; + } + } + + public static class MyResponseDeserializer extends ResponseDeserializer { + + public MyResponseDeserializer() { + super(Map.of("application/json", new ApplicationjsonMediatype(), "text/plain", new TextplainMediatype())); + } + + @Override + protected SealedResponseBody getBody(String contentType, SealedMediaType mediaType, byte[] body, SchemaConfiguration configuration) throws ValidationException, NotImplementedException { + if (mediaType instanceof ApplicationjsonMediatype thisMediaType) { + var deserializedBody = deserializeBody(contentType, body, thisMediaType.schema(), configuration); + return new ApplicationjsonBody(deserializedBody); + } else { + TextplainMediatype thisMediaType = (TextplainMediatype) mediaType; + var deserializedBody = deserializeBody(contentType, body, thisMediaType.schema(), configuration); + return new TextplainBody(deserializedBody); + } + } + + @Override + protected Nothing? getHeaders(HttpHeaders headers, SchemaConfiguration configuration) { + return null; + } + } + + public static class BytesHttpResponse implements HttpResponse { + private final byte[] body; + private final HttpHeaders headers; + private final HttpRequest request; + private final URI uri; + private final HttpClient.Version version; + public BytesHttpResponse(byte[] body, String contentType) { + this.body = body; + BiPredicate headerFilter = (key, val) -> true; + headers = HttpHeaders.of(Map.of("Content-Type", List.of(contentType)), headerFilter); + uri = URI.create("https://abc.com/"); + request = HttpRequest.newBuilder().uri(uri).build(); + version = HttpClient.Version.HTTP_2; + } + + @Override + public int statusCode() { + return 202; + } + + @Override + public HttpRequest request() { + return request; + } + + @Override + public Optional> previousResponse() { + return Optional.empty(); + } + + @Override + public HttpHeaders headers() { + return headers; + } + + @Override + public byte[] body() { + return body; + } + + @Override + public Optional sslSession() { + return Optional.empty(); + } + + @Override + public URI uri() { + return uri; + } + + @Override + public HttpClient.Version version() { + return version; + } + } + + @SuppressWarnings("nullness") + private String toJson(@Nullable Object body) { + return gson.toJson(body); + } + + @SuppressWarnings("nullness") + private void assertNull(@Nullable Object object) { + Assert.assertNull(object); + } + + @Test + public void testDeserializeApplicationJsonNull() throws ValidationException, ApiException, NotImplementedException { + var deserializer = new MyResponseDeserializer(); + byte[] bodyBytes = toJson(null).getBytes(StandardCharsets.UTF_8); + BytesHttpResponse response = new BytesHttpResponse(bodyBytes, "application/json"); + SchemaConfiguration configuration = new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().build()); + DeserializedHttpResponse apiResponse = deserializer.deserialize(response, configuration); + if (!(apiResponse.body() instanceof ApplicationjsonBody jsonBody)) { + throw new RuntimeException("body must be type ApplicationjsonBody"); + } + if (!(jsonBody.body() instanceof AnyTypeJsonSchema.AnyTypeJsonSchema1BoxedVoid boxedVoid)) { + throw new RuntimeException("body must be type AnyTypeJsonSchema1BoxedVoid"); + } + assertNull(boxedVoid.data()); + } + + @Test + public void testDeserializeApplicationJsonTrue() throws ValidationException, ApiException, NotImplementedException { + var deserializer = new MyResponseDeserializer(); + byte[] bodyBytes = toJson(true).getBytes(StandardCharsets.UTF_8); + BytesHttpResponse response = new BytesHttpResponse(bodyBytes, "application/json"); + SchemaConfiguration configuration = new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().build()); + DeserializedHttpResponse apiResponse = deserializer.deserialize(response, configuration); + if (!(apiResponse.body() instanceof ApplicationjsonBody jsonBody)) { + throw new RuntimeException("body must be type ApplicationjsonBody"); + } + if (!(jsonBody.body() instanceof AnyTypeJsonSchema.AnyTypeJsonSchema1BoxedBoolean boxedBoolean)) { + throw new RuntimeException("body must be type AnyTypeJsonSchema1BoxedBoolean"); + } + Assert.assertTrue(boxedBoolean.data()); + } + + @Test + public void testDeserializeApplicationJsonFalse() throws ValidationException, ApiException, NotImplementedException { + var deserializer = new MyResponseDeserializer(); + byte[] bodyBytes = toJson(false).getBytes(StandardCharsets.UTF_8); + BytesHttpResponse response = new BytesHttpResponse(bodyBytes, "application/json"); + SchemaConfiguration configuration = new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().build()); + DeserializedHttpResponse apiResponse = deserializer.deserialize(response, configuration); + if (!(apiResponse.body() instanceof ApplicationjsonBody jsonBody)) { + throw new RuntimeException("body must be type ApplicationjsonBody"); + } + if (!(jsonBody.body() instanceof AnyTypeJsonSchema.AnyTypeJsonSchema1BoxedBoolean boxedBoolean)) { + throw new RuntimeException("body must be type AnyTypeJsonSchema1BoxedBoolean"); + } + Assert.assertFalse(boxedBoolean.data()); + } + + @Test + public void testDeserializeApplicationJsonInt() throws ValidationException, ApiException, NotImplementedException { + var deserializer = new MyResponseDeserializer(); + byte[] bodyBytes = toJson(1).getBytes(StandardCharsets.UTF_8); + BytesHttpResponse response = new BytesHttpResponse(bodyBytes, "application/json"); + SchemaConfiguration configuration = new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().build()); + DeserializedHttpResponse apiResponse = deserializer.deserialize(response, configuration); + if (!(apiResponse.body() instanceof ApplicationjsonBody jsonBody)) { + throw new RuntimeException("body must be type ApplicationjsonBody"); + } + if (!(jsonBody.body() instanceof AnyTypeJsonSchema.AnyTypeJsonSchema1BoxedNumber boxedNumber)) { + throw new RuntimeException("body must be type AnyTypeJsonSchema1BoxedNumber"); + } + Assert.assertEquals(boxedNumber.data(), 1L); + } + + @Test + public void testDeserializeApplicationJsonFloat() throws ValidationException, ApiException, NotImplementedException { + var deserializer = new MyResponseDeserializer(); + byte[] bodyBytes = toJson(3.14).getBytes(StandardCharsets.UTF_8); + BytesHttpResponse response = new BytesHttpResponse(bodyBytes, "application/json"); + SchemaConfiguration configuration = new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().build()); + DeserializedHttpResponse apiResponse = deserializer.deserialize(response, configuration); + if (!(apiResponse.body() instanceof ApplicationjsonBody jsonBody)) { + throw new RuntimeException("body must be type ApplicationjsonBody"); + } + if (!(jsonBody.body() instanceof AnyTypeJsonSchema.AnyTypeJsonSchema1BoxedNumber boxedNumber)) { + throw new RuntimeException("body must be type AnyTypeJsonSchema1BoxedNumber"); + } + Assert.assertEquals(boxedNumber.data(), 3.14); + } + + @Test + public void testDeserializeApplicationJsonString() throws ValidationException, ApiException, NotImplementedException { + var deserializer = new MyResponseDeserializer(); + byte[] bodyBytes = toJson("a").getBytes(StandardCharsets.UTF_8); + BytesHttpResponse response = new BytesHttpResponse(bodyBytes, "application/json"); + SchemaConfiguration configuration = new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().build()); + DeserializedHttpResponse apiResponse = deserializer.deserialize(response, configuration); + if (!(apiResponse.body() instanceof ApplicationjsonBody jsonBody)) { + throw new RuntimeException("body must be type ApplicationjsonBody"); + } + if (!(jsonBody.body() instanceof AnyTypeJsonSchema.AnyTypeJsonSchema1BoxedString boxedString)) { + throw new RuntimeException("body must be type AnyTypeJsonSchema1BoxedString"); + } + Assert.assertEquals(boxedString.data(), "a"); + } +} \ No newline at end of file diff --git a/samples/client/petstore/kotlin/src/test/kotlin/org/openapijsonschematools/client/schemas/AnyTypeSchemaTest.kt b/samples/client/petstore/kotlin/src/test/kotlin/org/openapijsonschematools/client/schemas/AnyTypeSchemaTest.kt new file mode 100644 index 00000000000..709c50913f1 --- /dev/null +++ b/samples/client/petstore/kotlin/src/test/kotlin/org/openapijsonschematools/client/schemas/AnyTypeSchemaTest.kt @@ -0,0 +1,106 @@ +package org.openapijsonschematools.client.schemas; + +import org.checkerframework.checker.nullness.qual.Nullable; +import org.junit.Assert; +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; + +import java.time.LocalDate; +import java.time.ZoneId; +import java.time.ZonedDateTime; +import java.util.ArrayList; +import java.util.LinkedHashMap; + + +public class AnyTypeSchemaTest { + static final AnyTypeJsonSchema.AnyTypeJsonSchema1 schema = AnyTypeJsonSchema.AnyTypeJsonSchema1.getInstance(); + static final SchemaConfiguration configuration = new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().build()); + + @SuppressWarnings("nullness") + private Nothing? assertNull(@Nullable Object object) { + Assert.assertNull(object); + return null; + } + + @Test + public void testValidateNull() throws ValidationException { + Nothing? validatedValue = schema.validate((Nothing?) null, configuration); + assertNull(validatedValue); + } + + @Test + public void testValidateBoolean() throws ValidationException { + boolean trueValue = schema.validate(true, configuration); + Assert.assertTrue(trueValue); + + boolean falseValue = schema.validate(false, configuration); + Assert.assertFalse(falseValue); + } + + @Test + public void testValidateInteger() throws ValidationException { + int validatedValue = schema.validate(1, configuration); + Assert.assertEquals(validatedValue, 1); + } + + @Test + public void testValidateLong() throws ValidationException { + long validatedValue = schema.validate(1L, configuration); + Assert.assertEquals(validatedValue, 1L); + } + + @Test + 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 { + double validatedValue = schema.validate(70.6458763d, configuration); + Assert.assertEquals(Double.compare(validatedValue, 70.6458763d), 0); + } + + @Test + public void testValidateString() throws ValidationException { + String validatedValue = schema.validate("a", configuration); + Assert.assertEquals(validatedValue, "a"); + } + + @Test + 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 { + String validatedValue = schema.validate(LocalDate.of(2017, 7, 21), configuration); + Assert.assertEquals(validatedValue, "2017-07-21"); + } + + @Test + public void testValidateMap() throws ValidationException { + LinkedHashMap inMap = new LinkedHashMap<>(); + inMap.put("today", LocalDate.of(2017, 7, 21)); + FrozenMap validatedValue = schema.validate(inMap, configuration); + LinkedHashMap outMap = new LinkedHashMap<>(); + outMap.put("today", "2017-07-21"); + Assert.assertEquals(validatedValue, outMap); + } + + @Test + public void testValidateList() throws ValidationException { + ArrayList inList = new ArrayList<>(); + inList.add(LocalDate.of(2017, 7, 21)); + FrozenList validatedValue = schema.validate(inList, configuration); + ArrayList outList = new ArrayList<>(); + outList.add( "2017-07-21"); + Assert.assertEquals(validatedValue, outList); + } +} + diff --git a/samples/client/petstore/kotlin/src/test/kotlin/org/openapijsonschematools/client/schemas/ArrayTypeSchemaTest.kt b/samples/client/petstore/kotlin/src/test/kotlin/org/openapijsonschematools/client/schemas/ArrayTypeSchemaTest.kt new file mode 100644 index 00000000000..aea7234faae --- /dev/null +++ b/samples/client/petstore/kotlin/src/test/kotlin/org/openapijsonschematools/client/schemas/ArrayTypeSchemaTest.kt @@ -0,0 +1,252 @@ +package org.openapijsonschematools.client.schemas; + +import org.checkerframework.checker.nullness.qual.Nullable; +import org.junit.Assert; +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.JsonSchemaInfo; +import org.openapijsonschematools.client.schemas.validation.FrozenList; +import org.openapijsonschematools.client.schemas.validation.PathToSchemasMap; +import org.openapijsonschematools.client.schemas.validation.ListSchemaValidator; +import org.openapijsonschematools.client.schemas.validation.ValidationMetadata; + +import java.util.ArrayList; +import java.util.HashSet; +import java.util.LinkedHashMap; +import java.util.LinkedHashSet; +import java.util.List; +import java.util.Objects; +import java.util.Set; + +public class ArrayTypeSchemaTest { + static final SchemaConfiguration configuration = new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().build()); + static final ValidationMetadata validationMetadata = new ValidationMetadata( + List.of("args[0"), + configuration, + new PathToSchemasMap(), + new LinkedHashSet<>() + ); + + public sealed interface ArrayWithItemsSchemaBoxed permits ArrayWithItemsSchemaBoxedList { + } + public record ArrayWithItemsSchemaBoxedList(FrozenList data) implements ArrayWithItemsSchemaBoxed { + } + + public static class ArrayWithItemsSchema extends JsonSchema implements ListSchemaValidator, ArrayWithItemsSchemaBoxedList> { + public ArrayWithItemsSchema() { + super(new JsonSchemaInfo() + .type(Set.of(List.class)) + .items(StringJsonSchema.StringJsonSchema1.class) + ); + } + + @Override + public FrozenList getNewInstance(List arg, List pathToItem, PathToSchemasMap pathToSchemas) { + List items = new ArrayList<>(); + int i = 0; + for (Object item: arg) { + List itemPathToItem = new ArrayList<>(pathToItem); + itemPathToItem.add(i); + LinkedHashMap, Nothing?> schemas = pathToSchemas.get(itemPathToItem); + if (schemas == null) { + 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 RuntimeException("Instantiated type of item is invalid"); + } + items.add((String) castItem); + i += 1; + } + return new FrozenList<>(items); + } + + 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); + SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().build())); + ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, new PathToSchemasMap(), new LinkedHashSet<>()); + PathToSchemasMap pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet); + return getNewInstance(castArg, validationMetadata.pathToItem(), pathToSchemasMap); + } + + @Override + public ArrayWithItemsSchemaBoxedList validateAndBox(List arg, SchemaConfiguration configuration) throws ValidationException { + return new ArrayWithItemsSchemaBoxedList(validate(arg, configuration)); + } + + @Override + public Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { + 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"); + } + + @Override + public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws 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"); + } + + @Override + public ArrayWithItemsSchemaBoxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws 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"); + } + } + + public static class ArrayWithOutputClsSchemaList extends FrozenList { + protected ArrayWithOutputClsSchemaList(FrozenList m) { + super(m); + } + + public static ArrayWithOutputClsSchemaList of(List arg, SchemaConfiguration configuration) throws ValidationException { + return new ArrayWithOutputClsSchema().validate(arg, configuration); + } + } + + public sealed interface ArrayWithOutputClsSchemaBoxed permits ArrayWithOutputClsSchemaBoxedList { + } + public record ArrayWithOutputClsSchemaBoxedList(ArrayWithOutputClsSchemaList data) implements ArrayWithOutputClsSchemaBoxed { + } + public static class ArrayWithOutputClsSchema extends JsonSchema implements ListSchemaValidator { + public ArrayWithOutputClsSchema() { + super(new JsonSchemaInfo() + .type(Set.of(List.class)) + .items(StringJsonSchema.StringJsonSchema1.class) + ); + + } + + @Override + public ArrayWithOutputClsSchemaList getNewInstance(List arg, List pathToItem, PathToSchemasMap pathToSchemas) { + List items = new ArrayList<>(); + int i = 0; + for (Object item: arg) { + List itemPathToItem = new ArrayList<>(pathToItem); + itemPathToItem.add(i); + LinkedHashMap, Nothing?> schemas = pathToSchemas.get(itemPathToItem); + if (schemas == null) { + 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 RuntimeException("Instantiated type of item is invalid"); + } + items.add((String) castItem); + i += 1; + } + FrozenList newInstanceItems = new FrozenList<>(items); + return new ArrayWithOutputClsSchemaList(newInstanceItems); + } + + 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); + SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().build())); + ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, new PathToSchemasMap(), new LinkedHashSet<>()); + PathToSchemasMap pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet); + return getNewInstance(castArg, validationMetadata.pathToItem(), pathToSchemasMap); + } + + @Override + public ArrayWithOutputClsSchemaBoxedList validateAndBox(List arg, SchemaConfiguration configuration) throws ValidationException { + return new ArrayWithOutputClsSchemaBoxedList(validate(arg, configuration)); + } + + @Override + public Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { + 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"); + } + + @Override + public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws 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"); + } + + @Override + public ArrayWithOutputClsSchemaBoxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws 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"); + } + } + + @Test + public void testExceptionThrownForInvalidType() { + Assert.assertThrows(ValidationException.class, () -> JsonSchema.validate( + new ArrayWithItemsSchema(), + null, + validationMetadata + )); + } + + @Test + public void testValidateArrayWithItemsSchema() throws ValidationException { + // list with only item works + List inList = new ArrayList<>(); + inList.add("abc"); + FrozenList validatedValue = new ArrayWithItemsSchema().validate(inList, configuration); + List outList = new ArrayList<>(); + outList.add("abc"); + Assert.assertEquals(validatedValue, outList); + + // list with no items works + inList = new ArrayList<>(); + validatedValue = new ArrayWithItemsSchema().validate(inList, configuration); + outList = new ArrayList<>(); + Assert.assertEquals(validatedValue, outList); + + // invalid item type fails + List intList = List.of(1); + Assert.assertThrows(ValidationException.class, () -> JsonSchema.validate( + new ArrayWithItemsSchema(), + intList, + validationMetadata + )); + } + + @Test + public void testValidateArrayWithOutputClsSchema() throws ValidationException { + // list with only item works + List inList = new ArrayList<>(); + inList.add("abc"); + ArrayWithOutputClsSchemaList validatedValue = new ArrayWithOutputClsSchema().validate(inList, configuration); + List outList = new ArrayList<>(); + outList.add("abc"); + Assert.assertEquals(validatedValue, outList); + + // list with no items works + inList = new ArrayList<>(); + validatedValue = new ArrayWithOutputClsSchema().validate(inList, configuration); + outList = new ArrayList<>(); + Assert.assertEquals(validatedValue, outList); + + // invalid item type fails + List intList = List.of(1); + Assert.assertThrows(ValidationException.class, () -> JsonSchema.validate( + new ArrayWithOutputClsSchema(), + intList, + validationMetadata + )); + } +} \ No newline at end of file diff --git a/samples/client/petstore/kotlin/src/test/kotlin/org/openapijsonschematools/client/schemas/BooleanSchemaTest.kt b/samples/client/petstore/kotlin/src/test/kotlin/org/openapijsonschematools/client/schemas/BooleanSchemaTest.kt new file mode 100644 index 00000000000..d2990773fa7 --- /dev/null +++ b/samples/client/petstore/kotlin/src/test/kotlin/org/openapijsonschematools/client/schemas/BooleanSchemaTest.kt @@ -0,0 +1,45 @@ +package org.openapijsonschematools.client.schemas; + +import org.junit.Assert; +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.PathToSchemasMap; +import org.openapijsonschematools.client.schemas.validation.ValidationMetadata; + +import java.util.LinkedHashSet; +import java.util.List; + +public class BooleanSchemaTest { + static final SchemaConfiguration configuration = new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().build()); + static final BooleanJsonSchema.BooleanJsonSchema1 booleanJsonSchema = BooleanJsonSchema.BooleanJsonSchema1.getInstance(); + static final ValidationMetadata validationMetadata = new ValidationMetadata( + List.of("args[0"), + configuration, + new PathToSchemasMap(), + new LinkedHashSet<>() + ); + + @Test + public void testValidateTrue() throws ValidationException { + boolean validatedValue = booleanJsonSchema.validate(true, configuration); + Assert.assertTrue(validatedValue); + } + + @Test + public void testValidateFalse() throws ValidationException { + boolean validatedValue = booleanJsonSchema.validate(false, configuration); + Assert.assertFalse(validatedValue); + } + + @Test + public void testExceptionThrownForInvalidType() { + Assert.assertThrows(ValidationException.class, () -> JsonSchema.validate( + booleanJsonSchema, + null, + validationMetadata + )); + } +} diff --git a/samples/client/petstore/kotlin/src/test/kotlin/org/openapijsonschematools/client/schemas/ListBuilderTest.kt b/samples/client/petstore/kotlin/src/test/kotlin/org/openapijsonschematools/client/schemas/ListBuilderTest.kt new file mode 100644 index 00000000000..77fd8882ee5 --- /dev/null +++ b/samples/client/petstore/kotlin/src/test/kotlin/org/openapijsonschematools/client/schemas/ListBuilderTest.kt @@ -0,0 +1,61 @@ +package org.openapijsonschematools.client.schemas; + +import org.checkerframework.checker.nullness.qual.Nullable; +import org.junit.Assert; +import org.junit.Test; + +import java.util.ArrayList; +import java.util.List; + +public class ListBuilderTest { + public static class NullableListWithNullableItemsListBuilder { + // class to build List<@Nullable List> + private final List<@Nullable List> list; + + public NullableListWithNullableItemsListBuilder() { + list = new ArrayList<>(); + } + + public NullableListWithNullableItemsListBuilder(List<@Nullable List> list) { + this.list = list; + } + + public NullableListWithNullableItemsListBuilder add(Nothing? item) { + list.add(null); + return this; + } + + public NullableListWithNullableItemsListBuilder add(List item) { + list.add(item); + return this; + } + + public List<@Nullable List> build() { + return list; + } + } + + @Test + public void testSucceedsWithNullInput() { + List<@Nullable List> inList = new ArrayList<>(); + inList.add(null); + var builder = new NullableListWithNullableItemsListBuilder(inList); + Assert.assertEquals(inList, builder.build()); + + builder = new NullableListWithNullableItemsListBuilder(); + builder.add((Nothing?) null); + Assert.assertEquals(inList, builder.build()); + } + + @Test + public void testSucceedsWithNonNullInput() { + List<@Nullable List> inList = new ArrayList<>(); + inList.add(List.of(1)); + var builder = new NullableListWithNullableItemsListBuilder(inList); + Assert.assertEquals(inList, builder.build()); + + builder = new NullableListWithNullableItemsListBuilder(); + builder.add(List.of(1)); + Assert.assertEquals(inList, builder.build()); + } +} \ No newline at end of file diff --git a/samples/client/petstore/kotlin/src/test/kotlin/org/openapijsonschematools/client/schemas/ListSchemaTest.kt b/samples/client/petstore/kotlin/src/test/kotlin/org/openapijsonschematools/client/schemas/ListSchemaTest.kt new file mode 100644 index 00000000000..15967a549cc --- /dev/null +++ b/samples/client/petstore/kotlin/src/test/kotlin/org/openapijsonschematools/client/schemas/ListSchemaTest.kt @@ -0,0 +1,46 @@ +package org.openapijsonschematools.client.schemas; + +import org.checkerframework.checker.nullness.qual.Nullable; +import org.junit.Assert; +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.schemas.validation.PathToSchemasMap; +import org.openapijsonschematools.client.schemas.validation.ValidationMetadata; + +import java.util.ArrayList; +import java.util.LinkedHashSet; +import java.util.List; + +public class ListSchemaTest { + static final SchemaConfiguration configuration = new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().build()); + static final ListJsonSchema.ListJsonSchema1 listJsonSchema = ListJsonSchema.ListJsonSchema1.getInstance(); + static final ValidationMetadata validationMetadata = new ValidationMetadata( + List.of("args[0"), + configuration, + new PathToSchemasMap(), + new LinkedHashSet<>() + ); + + @Test + public void testExceptionThrownForInvalidType() { + Assert.assertThrows(ValidationException.class, () -> JsonSchema.validate( + listJsonSchema, + null, + validationMetadata + )); + } + + @Test + public void testValidateList() throws ValidationException { + List inList = new ArrayList<>(); + inList.add("today"); + FrozenList<@Nullable Object> validatedValue = listJsonSchema.validate(inList, configuration); + ArrayList outList = new ArrayList<>(); + outList.add("today"); + Assert.assertEquals(validatedValue, outList); + } +} diff --git a/samples/client/petstore/kotlin/src/test/kotlin/org/openapijsonschematools/client/schemas/MapSchemaTest.kt b/samples/client/petstore/kotlin/src/test/kotlin/org/openapijsonschematools/client/schemas/MapSchemaTest.kt new file mode 100644 index 00000000000..68c00adfc8e --- /dev/null +++ b/samples/client/petstore/kotlin/src/test/kotlin/org/openapijsonschematools/client/schemas/MapSchemaTest.kt @@ -0,0 +1,48 @@ +package org.openapijsonschematools.client.schemas; + +import org.checkerframework.checker.nullness.qual.Nullable; +import org.junit.Assert; +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.schemas.validation.PathToSchemasMap; +import org.openapijsonschematools.client.schemas.validation.ValidationMetadata; + +import java.time.LocalDate; +import java.util.LinkedHashMap; +import java.util.LinkedHashSet; +import java.util.List; +import java.util.Map; + +public class MapSchemaTest { + static final SchemaConfiguration configuration = new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().build()); + static final MapJsonSchema.MapJsonSchema1 mapJsonSchema = MapJsonSchema.MapJsonSchema1.getInstance(); + static final ValidationMetadata validationMetadata = new ValidationMetadata( + List.of("args[0"), + configuration, + new PathToSchemasMap(), + new LinkedHashSet<>() + ); + + @Test + public void testExceptionThrownForInvalidType() { + Assert.assertThrows(ValidationException.class, () -> JsonSchema.validate( + mapJsonSchema, + null, + validationMetadata + )); + } + + @Test + 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); + LinkedHashMap outMap = new LinkedHashMap<>(); + outMap.put("today", "2017-07-21"); + Assert.assertEquals(validatedValue, outMap); + } +} diff --git a/samples/client/petstore/kotlin/src/test/kotlin/org/openapijsonschematools/client/schemas/NullSchemaTest.kt b/samples/client/petstore/kotlin/src/test/kotlin/org/openapijsonschematools/client/schemas/NullSchemaTest.kt new file mode 100644 index 00000000000..d3a6d83ffc4 --- /dev/null +++ b/samples/client/petstore/kotlin/src/test/kotlin/org/openapijsonschematools/client/schemas/NullSchemaTest.kt @@ -0,0 +1,41 @@ +package org.openapijsonschematools.client.schemas; + +import org.junit.Assert; +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.PathToSchemasMap; +import org.openapijsonschematools.client.schemas.validation.ValidationMetadata; + +import java.util.LinkedHashSet; +import java.util.List; + +public class NullSchemaTest { + static final SchemaConfiguration configuration = new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().build()); + static final NullJsonSchema.NullJsonSchema1 nullJsonSchema = NullJsonSchema.NullJsonSchema1.getInstance(); + static final ValidationMetadata validationMetadata = new ValidationMetadata( + List.of("args[0"), + configuration, + new PathToSchemasMap(), + new LinkedHashSet<>() + ); + + + @Test + @SuppressWarnings("nullness") + public void testValidateNull() throws ValidationException { + Nothing? validatedValue = nullJsonSchema.validate(null, configuration); + Assert.assertNull(validatedValue); + } + + @Test + public void testExceptionThrownForInvalidType() { + Assert.assertThrows(ValidationException.class, () -> JsonSchema.validate( + nullJsonSchema, + Boolean.TRUE, + validationMetadata + )); + } +} diff --git a/samples/client/petstore/kotlin/src/test/kotlin/org/openapijsonschematools/client/schemas/NumberSchemaTest.kt b/samples/client/petstore/kotlin/src/test/kotlin/org/openapijsonschematools/client/schemas/NumberSchemaTest.kt new file mode 100644 index 00000000000..46e3454809f --- /dev/null +++ b/samples/client/petstore/kotlin/src/test/kotlin/org/openapijsonschematools/client/schemas/NumberSchemaTest.kt @@ -0,0 +1,57 @@ +package org.openapijsonschematools.client.schemas; + +import org.junit.Assert; +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.PathToSchemasMap; +import org.openapijsonschematools.client.schemas.validation.ValidationMetadata; + +import java.util.LinkedHashSet; +import java.util.List; + +public class NumberSchemaTest { + static final SchemaConfiguration configuration = new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().build()); + static final NumberJsonSchema.NumberJsonSchema1 numberJsonSchema = NumberJsonSchema.NumberJsonSchema1.getInstance(); + static final ValidationMetadata validationMetadata = new ValidationMetadata( + List.of("args[0"), + configuration, + new PathToSchemasMap(), + new LinkedHashSet<>() + ); + + @Test + public void testValidateInteger() throws ValidationException { + int validatedValue = numberJsonSchema.validate(1, configuration); + Assert.assertEquals(validatedValue, 1); + } + + @Test + public void testValidateLong() throws ValidationException { + long validatedValue = numberJsonSchema.validate(1L, configuration); + Assert.assertEquals(validatedValue, 1L); + } + + @Test + 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 { + double validatedValue = numberJsonSchema.validate(3.14d, configuration); + Assert.assertEquals(Double.compare(validatedValue, 3.14d), 0); + } + + @Test + public void testExceptionThrownForInvalidType() { + Assert.assertThrows(ValidationException.class, () -> JsonSchema.validate( + numberJsonSchema, + null, + validationMetadata + )); + } +} diff --git a/samples/client/petstore/kotlin/src/test/kotlin/org/openapijsonschematools/client/schemas/ObjectTypeSchemaTest.kt b/samples/client/petstore/kotlin/src/test/kotlin/org/openapijsonschematools/client/schemas/ObjectTypeSchemaTest.kt new file mode 100644 index 00000000000..91f322dfc93 --- /dev/null +++ b/samples/client/petstore/kotlin/src/test/kotlin/org/openapijsonschematools/client/schemas/ObjectTypeSchemaTest.kt @@ -0,0 +1,538 @@ +package org.openapijsonschematools.client.schemas; + +import org.checkerframework.checker.nullness.qual.Nullable; +import org.junit.Assert; +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.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.schemas.validation.ValidationMetadata; + +import java.util.ArrayList; +import java.util.HashSet; +import java.util.LinkedHashMap; +import java.util.LinkedHashSet; +import java.util.List; +import java.util.Map; +import java.util.Objects; +import java.util.Set; + +public class ObjectTypeSchemaTest { + static final SchemaConfiguration configuration = new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().build()); + static final ValidationMetadata validationMetadata = new ValidationMetadata( + List.of("args[0"), + configuration, + new PathToSchemasMap(), + new LinkedHashSet<>() + ); + + public sealed interface ObjectWithPropsSchemaBoxed permits ObjectWithPropsSchemaBoxedMap { + } + public record ObjectWithPropsSchemaBoxedMap(FrozenMap<@Nullable Object> data) implements ObjectWithPropsSchemaBoxed { + } + public static class ObjectWithPropsSchema extends JsonSchema implements MapSchemaValidator, ObjectWithPropsSchemaBoxedMap> { + private static @Nullable ObjectWithPropsSchema instance = null; + private ObjectWithPropsSchema() { + super(new JsonSchemaInfo() + .type(Set.of(Map.class)) + .properties(Map.ofEntries( + new PropertyEntry("someString", StringJsonSchema.StringJsonSchema1.class) + )) + ); + + } + + public static ObjectWithPropsSchema getInstance() { + if (instance == null) { + instance = new ObjectWithPropsSchema(); + } + return instance; + } + + @Override + 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 RuntimeException("Invalid non-string key value"); + } + String propertyName = (String) entryKey; + List propertyPathToItem = new ArrayList<>(pathToItem); + propertyPathToItem.add(propertyName); + Object value = entry.getValue(); + LinkedHashMap, Nothing?> schemas = pathToSchemas.get(propertyPathToItem); + if (schemas == null) { + 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); + properties.put(propertyName, castValue); + } + return new FrozenMap<>(properties); + } + + public FrozenMap<@Nullable Object> validate(Map arg, SchemaConfiguration configuration) throws ValidationException { + Set> pathSet = new HashSet<>(); + List pathToItem = List.of("args[0"); + Map castArg = castToAllowedTypes(arg, pathToItem, pathSet); + SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().build())); + ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, new PathToSchemasMap(), new LinkedHashSet<>()); + PathToSchemasMap pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet); + return getNewInstance(castArg, validationMetadata.pathToItem(), pathToSchemasMap); + } + + @Override + public ObjectWithPropsSchemaBoxedMap validateAndBox(Map arg, SchemaConfiguration configuration) throws ValidationException { + return new ObjectWithPropsSchemaBoxedMap(validate(arg, configuration)); + } + + @Override + public Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { + if (arg instanceof Map) { + return getNewInstance((Map) arg, pathToItem, pathToSchemas); + } + 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 { + 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"); + } + + @Override + public ObjectWithPropsSchemaBoxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws 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"); + } + } + + public sealed interface ObjectWithAddpropsSchemaBoxed permits ObjectWithAddpropsSchemaBoxedMap { + } + public record ObjectWithAddpropsSchemaBoxedMap(FrozenMap data) implements ObjectWithAddpropsSchemaBoxed { + } + + public static class ObjectWithAddpropsSchema extends JsonSchema implements MapSchemaValidator, ObjectWithAddpropsSchemaBoxedMap> { + private static @Nullable ObjectWithAddpropsSchema instance = null; + private ObjectWithAddpropsSchema() { + super(new JsonSchemaInfo() + .type(Set.of(Map.class)) + .additionalProperties(StringJsonSchema.StringJsonSchema1.class) + ); + } + + public static ObjectWithAddpropsSchema getInstance() { + if (instance == null) { + instance = new ObjectWithAddpropsSchema(); + } + return instance; + } + + @Override + public FrozenMap 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 RuntimeException("Invalid non-string key value"); + } + String propertyName = (String) entryKey; + List propertyPathToItem = new ArrayList<>(pathToItem); + propertyPathToItem.add(propertyName); + Object value = entry.getValue(); + LinkedHashMap, Nothing?> schemas = pathToSchemas.get(propertyPathToItem); + if (schemas == null) { + 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 RuntimeException("Invalid type for property value"); + } + properties.put(propertyName, (String) castValue); + } + return new FrozenMap<>(properties); + } + + 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); + SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().build())); + ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, new PathToSchemasMap(), new LinkedHashSet<>()); + PathToSchemasMap pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet); + return getNewInstance(castArg, validationMetadata.pathToItem(), pathToSchemasMap); + } + + @Override + 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 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"); + } + + @Override + public ObjectWithAddpropsSchemaBoxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws 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"); + } + + @Override + public Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { + if (arg instanceof Map) { + return getNewInstance((Map) arg, pathToItem, pathToSchemas); + } + throw new RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); + } + } + + public sealed interface ObjectWithPropsAndAddpropsSchemaBoxed permits ObjectWithPropsAndAddpropsSchemaBoxedMap { + } + public record ObjectWithPropsAndAddpropsSchemaBoxedMap(FrozenMap<@Nullable Object> data) implements ObjectWithPropsAndAddpropsSchemaBoxed { + } + public static class ObjectWithPropsAndAddpropsSchema extends JsonSchema implements MapSchemaValidator, ObjectWithPropsAndAddpropsSchemaBoxedMap> { + private static @Nullable ObjectWithPropsAndAddpropsSchema instance = null; + private ObjectWithPropsAndAddpropsSchema() { + super(new JsonSchemaInfo() + .type(Set.of(Map.class)) + .properties(Map.ofEntries( + new PropertyEntry("someString", StringJsonSchema.StringJsonSchema1.class) + )) + .additionalProperties(BooleanJsonSchema.BooleanJsonSchema1.class) + ); + } + + public static ObjectWithPropsAndAddpropsSchema getInstance() { + if (instance == null) { + instance = new ObjectWithPropsAndAddpropsSchema(); + } + return instance; + } + + @Override + 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 RuntimeException("Invalid non-string key value"); + } + String propertyName = (String) entryKey; + List propertyPathToItem = new ArrayList<>(pathToItem); + propertyPathToItem.add(propertyName); + Object value = entry.getValue(); + LinkedHashMap, Nothing?> schemas = pathToSchemas.get(propertyPathToItem); + if (schemas == null) { + 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); + properties.put(propertyName, castValue); + } + return new FrozenMap<>(properties); + } + + public FrozenMap<@Nullable Object> validate(Map arg, SchemaConfiguration configuration) throws ValidationException { + Set> pathSet = new HashSet<>(); + List pathToItem = List.of("args[0"); + Map castArg = castToAllowedTypes(arg, pathToItem, pathSet); + SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().build())); + ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, new PathToSchemasMap(), new LinkedHashSet<>()); + PathToSchemasMap pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet); + return getNewInstance(castArg, validationMetadata.pathToItem(), pathToSchemasMap); + } + + @Override + 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 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"); + } + + @Override + public ObjectWithPropsAndAddpropsSchemaBoxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws 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"); + } + + @Override + public Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { + if (arg instanceof Map) { + return getNewInstance((Map) arg, pathToItem, pathToSchemas); + } + throw new RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); + } + } + + public static class ObjectWithOutputTypeSchemaMap extends FrozenMap<@Nullable Object> { + protected ObjectWithOutputTypeSchemaMap(FrozenMap<@Nullable Object> m) { + super(m); + } + + public static ObjectWithOutputTypeSchemaMap of(Map arg, SchemaConfiguration configuration) throws ValidationException { + return ObjectWithOutputTypeSchema.getInstance().validate(arg, configuration); + } + } + + public sealed interface ObjectWithOutputTypeSchemaBoxed permits ObjectWithOutputTypeSchemaBoxedMap { + } + public record ObjectWithOutputTypeSchemaBoxedMap(ObjectWithOutputTypeSchemaMap data) implements ObjectWithOutputTypeSchemaBoxed { + } + public static class ObjectWithOutputTypeSchema extends JsonSchema implements MapSchemaValidator { + private static @Nullable ObjectWithOutputTypeSchema instance = null; + public ObjectWithOutputTypeSchema() { + super(new JsonSchemaInfo() + .type(Set.of(Map.class)) + .properties(Map.ofEntries( + new PropertyEntry("someString", StringJsonSchema.StringJsonSchema1.class) + )) + ); + } + + public static ObjectWithOutputTypeSchema getInstance() { + if (instance == null) { + instance = new ObjectWithOutputTypeSchema(); + } + return instance; + } + + @Override + public ObjectWithOutputTypeSchemaMap 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 RuntimeException("Invalid non-string key value"); + } + String propertyName = (String) entryKey; + List propertyPathToItem = new ArrayList<>(pathToItem); + propertyPathToItem.add(propertyName); + Object value = entry.getValue(); + LinkedHashMap, Nothing?> schemas = pathToSchemas.get(propertyPathToItem); + if (schemas == null) { + 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); + properties.put(propertyName, castValue); + } + return new ObjectWithOutputTypeSchemaMap(new FrozenMap<>(properties)); + } + + 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); + SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().build())); + ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, new PathToSchemasMap(), new LinkedHashSet<>()); + PathToSchemasMap pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet); + return getNewInstance(castArg, validationMetadata.pathToItem(), pathToSchemasMap); + } + + @Override + 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 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"); + } + + @Override + public ObjectWithOutputTypeSchemaBoxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws 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"); + } + + @Override + public Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { + 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"); + } + } + + @Test + public void testExceptionThrownForInvalidType() { + ObjectWithPropsSchema schema = ObjectWithPropsSchema.getInstance(); + Assert.assertThrows(ValidationException.class, () -> JsonSchema.validate( + schema, + null, + validationMetadata + )); + } + + @Test + public void testValidateObjectWithPropsSchema() throws ValidationException { + ObjectWithPropsSchema schema = ObjectWithPropsSchema.getInstance(); + + // map with only property works + Map inMap = new LinkedHashMap<>(); + inMap.put("someString", "abc"); + FrozenMap<@Nullable Object> validatedValue = schema.validate(inMap, configuration); + LinkedHashMap outMap = new LinkedHashMap<>(); + outMap.put("someString", "abc"); + Assert.assertEquals(validatedValue, outMap); + + // map with additional unvalidated property works + inMap = new LinkedHashMap<>(); + inMap.put("someString", "abc"); + inMap.put("someOtherString", "def"); + validatedValue = schema.validate(inMap, configuration); + outMap = new LinkedHashMap<>(); + outMap.put("someString", "abc"); + outMap.put("someOtherString", "def"); + Assert.assertEquals(validatedValue, outMap); + + // invalid prop type fails + inMap = new LinkedHashMap<>(); + inMap.put("someString", 1); + Map finalInMap = inMap; + Assert.assertThrows(ValidationException.class, () -> schema.validate( + finalInMap, configuration + )); + } + + @Test + public void testValidateObjectWithAddpropsSchema() throws ValidationException { + ObjectWithAddpropsSchema schema = ObjectWithAddpropsSchema.getInstance(); + + // map with only property works + Map inMap = new LinkedHashMap<>(); + inMap.put("someString", "abc"); + FrozenMap validatedValue = schema.validate(inMap, configuration); + LinkedHashMap outMap = new LinkedHashMap<>(); + outMap.put("someString", "abc"); + Assert.assertEquals(validatedValue, outMap); + + // map with additional properties works + inMap = new LinkedHashMap<>(); + inMap.put("someString", "abc"); + inMap.put("someOtherString", "def"); + validatedValue = schema.validate(inMap, configuration); + outMap = new LinkedHashMap<>(); + outMap.put("someString", "abc"); + outMap.put("someOtherString", "def"); + Assert.assertEquals(validatedValue, outMap); + + // invalid addProp type fails + Map invalidInput = Map.of("someString", 1); + Assert.assertThrows(ValidationException.class, () -> JsonSchema.validate( + schema, + invalidInput, + validationMetadata + )); + } + + @Test + public void testValidateObjectWithPropsAndAddpropsSchema() throws ValidationException { + ObjectWithPropsAndAddpropsSchema schema = ObjectWithPropsAndAddpropsSchema.getInstance(); + + // map with only property works + Map inMap = new LinkedHashMap<>(); + inMap.put("someString", "abc"); + FrozenMap<@Nullable Object> validatedValue = schema.validate(inMap, configuration); + LinkedHashMap outMap = new LinkedHashMap<>(); + outMap.put("someString", "abc"); + Assert.assertEquals(validatedValue, outMap); + + // map with additional properties works + inMap = new LinkedHashMap<>(); + inMap.put("someString", "abc"); + inMap.put("someAddProp", true); + validatedValue = schema.validate(inMap, configuration); + outMap = new LinkedHashMap<>(); + outMap.put("someString", "abc"); + outMap.put("someAddProp", true); + Assert.assertEquals(validatedValue, outMap); + + // invalid prop type fails + inMap = new LinkedHashMap<>(); + inMap.put("someString", 1); + Map invalidPropMap = inMap; + Assert.assertThrows(ValidationException.class, () -> schema.validate( + invalidPropMap, configuration + )); + + // invalid addProp type fails + inMap = new LinkedHashMap<>(); + inMap.put("someAddProp", 1); + Map invalidAddpropMap = inMap; + Assert.assertThrows(ValidationException.class, () -> schema.validate( + invalidAddpropMap, configuration + )); + } + + @Test + public void testValidateObjectWithOutputTypeSchema() throws ValidationException { + ObjectWithOutputTypeSchema schema = ObjectWithOutputTypeSchema.getInstance(); + + // map with only property works + Map inMap = new LinkedHashMap<>(); + inMap.put("someString", "abc"); + ObjectWithOutputTypeSchemaMap validatedValue = schema.validate(inMap, configuration); + LinkedHashMap outMap = new LinkedHashMap<>(); + outMap.put("someString", "abc"); + Assert.assertEquals(validatedValue, outMap); + + // map with additional unvalidated property works + inMap = new LinkedHashMap<>(); + inMap.put("someString", "abc"); + inMap.put("someOtherString", "def"); + validatedValue = schema.validate(inMap, configuration); + outMap = new LinkedHashMap<>(); + outMap.put("someString", "abc"); + outMap.put("someOtherString", "def"); + Assert.assertEquals(validatedValue, outMap); + + // invalid prop type fails + inMap = new LinkedHashMap<>(); + inMap.put("someString", 1); + Map finalInMap = inMap; + Assert.assertThrows(ValidationException.class, () -> schema.validate( + finalInMap, configuration + )); + + // using output class directly works + inMap = new LinkedHashMap<>(); + inMap.put("someString", "abc"); + validatedValue = ObjectWithOutputTypeSchemaMap.of(inMap, configuration); + outMap = new LinkedHashMap<>(); + outMap.put("someString", "abc"); + Assert.assertEquals(validatedValue, outMap); + } +} diff --git a/samples/client/petstore/kotlin/src/test/kotlin/org/openapijsonschematools/client/schemas/RefBooleanSchemaTest.kt b/samples/client/petstore/kotlin/src/test/kotlin/org/openapijsonschematools/client/schemas/RefBooleanSchemaTest.kt new file mode 100644 index 00000000000..23b73510e3f --- /dev/null +++ b/samples/client/petstore/kotlin/src/test/kotlin/org/openapijsonschematools/client/schemas/RefBooleanSchemaTest.kt @@ -0,0 +1,49 @@ +package org.openapijsonschematools.client.schemas; + +import org.junit.Assert; +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.PathToSchemasMap; +import org.openapijsonschematools.client.schemas.validation.ValidationMetadata; + +import java.util.LinkedHashSet; +import java.util.List; + +public class RefBooleanSchemaTest { + public static class RefBooleanSchema { + public static class RefBooleanSchema1 extends BooleanJsonSchema.BooleanJsonSchema1 {} + } + + static final SchemaConfiguration configuration = new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().build()); + static final BooleanJsonSchema.BooleanJsonSchema1 refBooleanJsonSchema = RefBooleanSchema.RefBooleanSchema1.getInstance(); + static final ValidationMetadata validationMetadata = new ValidationMetadata( + List.of("args[0"), + configuration, + new PathToSchemasMap(), + new LinkedHashSet<>() + ); + + @Test + public void testValidateTrue() throws ValidationException { + Boolean validatedValue = refBooleanJsonSchema.validate(true, configuration); + Assert.assertEquals(validatedValue, Boolean.TRUE); + } + + @Test + public void testValidateFalse() throws ValidationException { + Boolean validatedValue = refBooleanJsonSchema.validate(false, configuration); + Assert.assertEquals(validatedValue, Boolean.FALSE); + } + + @Test + public void testExceptionThrownForInvalidType() { + Assert.assertThrows(ValidationException.class, () -> JsonSchema.validate( + refBooleanJsonSchema, + null, + validationMetadata + )); + } +} \ No newline at end of file diff --git a/samples/client/petstore/kotlin/src/test/kotlin/org/openapijsonschematools/client/schemas/validation/AdditionalPropertiesValidatorTest.kt b/samples/client/petstore/kotlin/src/test/kotlin/org/openapijsonschematools/client/schemas/validation/AdditionalPropertiesValidatorTest.kt new file mode 100644 index 00000000000..e59f7dc095e --- /dev/null +++ b/samples/client/petstore/kotlin/src/test/kotlin/org/openapijsonschematools/client/schemas/validation/AdditionalPropertiesValidatorTest.kt @@ -0,0 +1,149 @@ +package org.openapijsonschematools.client.schemas.validation; + +import org.checkerframework.checker.nullness.qual.Nullable; +import org.junit.Assert; +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.MapJsonSchema; +import org.openapijsonschematools.client.schemas.StringJsonSchema; +import org.openapijsonschematools.client.exceptions.ValidationException; + +import java.util.ArrayList; +import java.util.LinkedHashMap; +import java.util.LinkedHashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; + +public class AdditionalPropertiesValidatorTest { + public sealed interface ObjectWithPropsSchemaBoxed permits ObjectWithPropsSchemaBoxedMap {} + public record ObjectWithPropsSchemaBoxedMap() implements ObjectWithPropsSchemaBoxed {} + + public static class ObjectWithPropsSchema extends JsonSchema { + private static @Nullable ObjectWithPropsSchema instance = null; + private ObjectWithPropsSchema() { + super(new JsonSchemaInfo() + .type(Set.of(FrozenMap.class)) + .properties(Map.ofEntries( + new PropertyEntry("someString", StringJsonSchema.StringJsonSchema1.class) + )) + .additionalProperties(StringJsonSchema.StringJsonSchema1.class) + ); + + } + + public static ObjectWithPropsSchema getInstance() { + if (instance == null) { + instance = new ObjectWithPropsSchema(); + } + return instance; + } + + @Override + public Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { + if (arg instanceof Map) { + return arg; + } + 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 { + if (arg instanceof Map) { + return arg; + } + 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 ValidationException { + return new ObjectWithPropsSchemaBoxedMap(); + } + } + + @SuppressWarnings("nullness") + private Nothing? assertNull(@Nullable Object object) { + Assert.assertNull(object); + return null; + } + + @Test + public void testCorrectPropertySucceeds() throws ValidationException { + List pathToItem = List.of("args[0]"); + ValidationMetadata validationMetadata = new ValidationMetadata( + pathToItem, + new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().build()), + new PathToSchemasMap(), + new LinkedHashSet<>() + ); + LinkedHashMap mutableMap = new LinkedHashMap<>(); + mutableMap.put("someString", "abc"); + mutableMap.put("someAddProp", "def"); + FrozenMap arg = new FrozenMap<>(mutableMap); + final AdditionalPropertiesValidator validator = new AdditionalPropertiesValidator(); + PathToSchemasMap pathToSchemas = validator.validate( + new ValidationData( + ObjectWithPropsSchema.getInstance(), + arg, + validationMetadata + ) + ); + if (pathToSchemas == null) { + throw new RuntimeException("Invalid null value for pathToSchemas for this test case"); + } + List expectedPathToItem = new ArrayList<>(); + expectedPathToItem.add("args[0]"); + expectedPathToItem.add("someAddProp"); + LinkedHashMap, Nothing?> expectedClasses = new LinkedHashMap<>(); + StringJsonSchema.StringJsonSchema1 schema = JsonSchemaFactory.getInstance(StringJsonSchema.StringJsonSchema1.class); + expectedClasses.put(schema, null); + PathToSchemasMap expectedPathToSchemas = new PathToSchemasMap(); + expectedPathToSchemas.put(expectedPathToItem, expectedClasses); + Assert.assertEquals(pathToSchemas, expectedPathToSchemas); + } + + @Test + public void testNotApplicableTypeReturnsNull() throws ValidationException { + List pathToItem = List.of("args[0]"); + ValidationMetadata validationMetadata = new ValidationMetadata( + pathToItem, + new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().build()), + new PathToSchemasMap(), + new LinkedHashSet<>() + ); + final AdditionalPropertiesValidator validator = new AdditionalPropertiesValidator(); + PathToSchemasMap pathToSchemas = validator.validate( + new ValidationData( + MapJsonSchema.MapJsonSchema1.getInstance(), + 1, + validationMetadata + ) + ); + assertNull(pathToSchemas); + } + + @Test + public void testIncorrectPropertyValueFails() { + List pathToItem = List.of("args[0]"); + ValidationMetadata validationMetadata = new ValidationMetadata( + pathToItem, + new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().build()), + new PathToSchemasMap(), + new LinkedHashSet<>() + ); + LinkedHashMap mutableMap = new LinkedHashMap<>(); + mutableMap.put("someString", "abc"); + mutableMap.put("someAddProp", 1); + FrozenMap arg = new FrozenMap<>(mutableMap); + final AdditionalPropertiesValidator validator = new AdditionalPropertiesValidator(); + Assert.assertThrows(ValidationException.class, () -> validator.validate( + new ValidationData( + ObjectWithPropsSchema.getInstance(), + arg, + validationMetadata + ) + )); + } +} \ No newline at end of file diff --git a/samples/client/petstore/kotlin/src/test/kotlin/org/openapijsonschematools/client/schemas/validation/CustomIsoparserTest.kt b/samples/client/petstore/kotlin/src/test/kotlin/org/openapijsonschematools/client/schemas/validation/CustomIsoparserTest.kt new file mode 100644 index 00000000000..686612d46c4 --- /dev/null +++ b/samples/client/petstore/kotlin/src/test/kotlin/org/openapijsonschematools/client/schemas/validation/CustomIsoparserTest.kt @@ -0,0 +1,28 @@ +package org.openapijsonschematools.client.schemas.validation; + +import java.time.LocalDate; +import java.time.ZonedDateTime; +import java.time.ZoneId; +import org.junit.Assert; +import org.junit.Test; + +public final class CustomIsoparserTest { + + @Test + public void testParseIsodatetime() { + final CustomIsoparser parser = new CustomIsoparser(); + ZonedDateTime dateTime = parser.parseIsodatetime("2017-07-21T17:32:28Z"); + ZoneId zone = ZoneId.of("Z"); + ZonedDateTime expectedDateTime = ZonedDateTime.of(2017, 7, 21, 17, 32, 28, 0, zone); + Assert.assertEquals(dateTime, expectedDateTime); + } + + @Test + public void testParseIsodate() { + final CustomIsoparser parser = new CustomIsoparser(); + LocalDate date = parser.parseIsodate("2017-07-21"); + LocalDate expectedDate = LocalDate.of(2017, 7, 21); + Assert.assertEquals(date, expectedDate); + } + +} \ No newline at end of file diff --git a/samples/client/petstore/kotlin/src/test/kotlin/org/openapijsonschematools/client/schemas/validation/FormatValidatorTest.kt b/samples/client/petstore/kotlin/src/test/kotlin/org/openapijsonschematools/client/schemas/validation/FormatValidatorTest.kt new file mode 100644 index 00000000000..ca2ec5a1299 --- /dev/null +++ b/samples/client/petstore/kotlin/src/test/kotlin/org/openapijsonschematools/client/schemas/validation/FormatValidatorTest.kt @@ -0,0 +1,363 @@ +package org.openapijsonschematools.client.schemas.validation; + +import org.checkerframework.checker.nullness.qual.Nullable; +import org.junit.Assert; +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.IntJsonSchema; +import org.openapijsonschematools.client.schemas.Int32JsonSchema; +import org.openapijsonschematools.client.schemas.Int64JsonSchema; +import org.openapijsonschematools.client.schemas.FloatJsonSchema; +import org.openapijsonschematools.client.schemas.DoubleJsonSchema; +import org.openapijsonschematools.client.schemas.DecimalJsonSchema; +import org.openapijsonschematools.client.schemas.DateJsonSchema; +import org.openapijsonschematools.client.schemas.DateTimeJsonSchema; + +import java.math.BigDecimal; +import java.math.BigInteger; +import java.util.ArrayList; +import java.util.LinkedHashSet; + +public class FormatValidatorTest { + static final ValidationMetadata validationMetadata = new ValidationMetadata( + new ArrayList<>(), + new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().build()), + new PathToSchemasMap(), + new LinkedHashSet<>() + ); + + @SuppressWarnings("nullness") + private void assertNull(@Nullable Object object) { + Assert.assertNull(object); + } + + @Test + public void testIntFormatSucceedsWithFloat() throws ValidationException { + final FormatValidator validator = new FormatValidator(); + PathToSchemasMap pathToSchemasMap = validator.validate( + new ValidationData( + IntJsonSchema.IntJsonSchema1.getInstance(), + 1.0f, + validationMetadata + ) + ); + assertNull(pathToSchemasMap); + } + + @Test + public void testIntFormatFailsWithFloat() { + final FormatValidator validator = new FormatValidator(); + Assert.assertThrows(ValidationException.class, () -> validator.validate( + new ValidationData( + IntJsonSchema.IntJsonSchema1.getInstance(), + 3.14f, + validationMetadata + ) + )); + } + + @Test + public void testIntFormatSucceedsWithInt() throws ValidationException { + final FormatValidator validator = new FormatValidator(); + PathToSchemasMap pathToSchemasMap = validator.validate( + new ValidationData( + IntJsonSchema.IntJsonSchema1.getInstance(), + 1, + validationMetadata + ) + ); + assertNull(pathToSchemasMap); + } + + @Test + public void testInt32UnderMinFails() { + final FormatValidator validator = new FormatValidator(); + Assert.assertThrows(ValidationException.class, () -> validator.validate( + new ValidationData( + Int32JsonSchema.Int32JsonSchema1.getInstance(), + -2147483649L, + validationMetadata + ) + )); + } + + @Test + public void testInt32InclusiveMinSucceeds() throws ValidationException { + final FormatValidator validator = new FormatValidator(); + PathToSchemasMap pathToSchemasMap = validator.validate( + new ValidationData( + Int32JsonSchema.Int32JsonSchema1.getInstance(), + -2147483648, + validationMetadata + ) + ); + assertNull(pathToSchemasMap); + } + + @Test + public void testInt32InclusiveMaxSucceeds() throws ValidationException { + final FormatValidator validator = new FormatValidator(); + PathToSchemasMap pathToSchemasMap = validator.validate( + new ValidationData( + Int32JsonSchema.Int32JsonSchema1.getInstance(), + 2147483647, + validationMetadata + ) + ); + assertNull(pathToSchemasMap); + } + + @Test + public void testInt32OverMaxFails() { + final FormatValidator validator = new FormatValidator(); + Assert.assertThrows(ValidationException.class, () -> validator.validate( + new ValidationData( + Int32JsonSchema.Int32JsonSchema1.getInstance(), + 2147483648L, + validationMetadata + ) + )); + } + + @Test + public void testInt64UnderMinFails() { + final FormatValidator validator = new FormatValidator(); + + Assert.assertThrows(ValidationException.class, () -> validator.validate( + new ValidationData( + Int64JsonSchema.Int64JsonSchema1.getInstance(), + new BigInteger("-9223372036854775809"), + validationMetadata + ) + )); + } + + @Test + public void testInt64InclusiveMinSucceeds() throws ValidationException { + final FormatValidator validator = new FormatValidator(); + PathToSchemasMap pathToSchemasMap = validator.validate( + new ValidationData( + Int64JsonSchema.Int64JsonSchema1.getInstance(), + -9223372036854775808L, + validationMetadata + ) + ); + assertNull(pathToSchemasMap); + } + + @Test + public void testInt64InclusiveMaxSucceeds() throws ValidationException { + final FormatValidator validator = new FormatValidator(); + PathToSchemasMap pathToSchemasMap = validator.validate( + new ValidationData( + Int64JsonSchema.Int64JsonSchema1.getInstance(), + 9223372036854775807L, + validationMetadata + ) + ); + assertNull(pathToSchemasMap); + } + + @Test + public void testInt64OverMaxFails() { + final FormatValidator validator = new FormatValidator(); + + Assert.assertThrows(ValidationException.class, () -> validator.validate( + new ValidationData( + Int64JsonSchema.Int64JsonSchema1.getInstance(), + new BigInteger("9223372036854775808"), + validationMetadata + ) + )); + } + + @Test + public void testFloatUnderMinFails() { + final FormatValidator validator = new FormatValidator(); + Assert.assertThrows(ValidationException.class, () -> validator.validate( + new ValidationData( + FloatJsonSchema.FloatJsonSchema1.getInstance(), + -3.402823466385289e+38d, + validationMetadata + ) + )); + } + + @Test + public void testFloatInclusiveMinSucceeds() throws ValidationException { + final FormatValidator validator = new FormatValidator(); + PathToSchemasMap pathToSchemasMap = validator.validate( + new ValidationData( + FloatJsonSchema.FloatJsonSchema1.getInstance(), + -3.4028234663852886e+38f, + validationMetadata + ) + ); + assertNull(pathToSchemasMap); + } + + @Test + public void testFloatInclusiveMaxSucceeds() throws ValidationException { + final FormatValidator validator = new FormatValidator(); + PathToSchemasMap pathToSchemasMap = validator.validate( + new ValidationData( + FloatJsonSchema.FloatJsonSchema1.getInstance(), + 3.4028234663852886e+38f, + validationMetadata + ) + ); + assertNull(pathToSchemasMap); + } + + @Test + public void testFloatOverMaxFails() { + final FormatValidator validator = new FormatValidator(); + Assert.assertThrows(ValidationException.class, () -> validator.validate( + new ValidationData( + FloatJsonSchema.FloatJsonSchema1.getInstance(), + 3.402823466385289e+38d, + validationMetadata + ) + )); + } + + @Test + public void testDoubleUnderMinFails() { + final FormatValidator validator = new FormatValidator(); + Assert.assertThrows(ValidationException.class, () -> validator.validate( + new ValidationData( + DoubleJsonSchema.DoubleJsonSchema1.getInstance(), + new BigDecimal("-1.7976931348623157082e+308"), + validationMetadata + ) + )); + } + + @Test + public void testDoubleInclusiveMinSucceeds() throws ValidationException { + final FormatValidator validator = new FormatValidator(); + PathToSchemasMap pathToSchemasMap = validator.validate( + new ValidationData( + DoubleJsonSchema.DoubleJsonSchema1.getInstance(), + -1.7976931348623157E+308d, + validationMetadata + ) + ); + assertNull(pathToSchemasMap); + } + + @Test + public void testDoubleInclusiveMaxSucceeds() throws ValidationException { + final FormatValidator validator = new FormatValidator(); + PathToSchemasMap pathToSchemasMap = validator.validate( + new ValidationData( + DoubleJsonSchema.DoubleJsonSchema1.getInstance(), + 1.7976931348623157E+308d, + validationMetadata + ) + ); + assertNull(pathToSchemasMap); + } + + @Test + public void testDoubleOverMaxFails() { + final FormatValidator validator = new FormatValidator(); + Assert.assertThrows(ValidationException.class, () -> validator.validate( + new ValidationData( + DoubleJsonSchema.DoubleJsonSchema1.getInstance(), + new BigDecimal("1.7976931348623157082e+308"), + validationMetadata + ) + )); + } + + @Test + public void testInvalidNumberStringFails() { + final FormatValidator validator = new FormatValidator(); + Assert.assertThrows(ValidationException.class, () -> validator.validate( + new ValidationData( + DecimalJsonSchema.DecimalJsonSchema1.getInstance(), + "abc", + validationMetadata + ) + )); + } + + @Test + public void testValidFloatNumberStringSucceeds() throws ValidationException { + final FormatValidator validator = new FormatValidator(); + PathToSchemasMap pathToSchemasMap = validator.validate( + new ValidationData( + DecimalJsonSchema.DecimalJsonSchema1.getInstance(), + "3.14", + validationMetadata + ) + ); + assertNull(pathToSchemasMap); + } + + @Test + public void testValidIntNumberStringSucceeds() throws ValidationException { + final FormatValidator validator = new FormatValidator(); + PathToSchemasMap pathToSchemasMap = validator.validate( + new ValidationData( + DecimalJsonSchema.DecimalJsonSchema1.getInstance(), + "1", + validationMetadata + ) + ); + assertNull(pathToSchemasMap); + } + + @Test + public void testInvalidDateStringFails() { + final FormatValidator validator = new FormatValidator(); + Assert.assertThrows(ValidationException.class, () -> validator.validate( + new ValidationData( + DateJsonSchema.DateJsonSchema1.getInstance(), + "abc", + validationMetadata + ) + )); + } + + @Test + public void testValidDateStringSucceeds() throws ValidationException { + final FormatValidator validator = new FormatValidator(); + PathToSchemasMap pathToSchemasMap = validator.validate( + new ValidationData( + DateJsonSchema.DateJsonSchema1.getInstance(), + "2017-01-20", + validationMetadata + ) + ); + assertNull(pathToSchemasMap); + } + + @Test + public void testInvalidDateTimeStringFails() { + final FormatValidator validator = new FormatValidator(); + Assert.assertThrows(ValidationException.class, () -> validator.validate( + new ValidationData( + DateTimeJsonSchema.DateTimeJsonSchema1.getInstance(), + "abc", + validationMetadata + ) + )); + } + + @Test + public void testValidDateTimeStringSucceeds() throws ValidationException { + final FormatValidator validator = new FormatValidator(); + PathToSchemasMap pathToSchemasMap = validator.validate( + new ValidationData( + DateTimeJsonSchema.DateTimeJsonSchema1.getInstance(), + "2017-07-21T17:32:28Z", + validationMetadata + ) + ); + assertNull(pathToSchemasMap); + } +} \ No newline at end of file diff --git a/samples/client/petstore/kotlin/src/test/kotlin/org/openapijsonschematools/client/schemas/validation/ItemsValidatorTest.kt b/samples/client/petstore/kotlin/src/test/kotlin/org/openapijsonschematools/client/schemas/validation/ItemsValidatorTest.kt new file mode 100644 index 00000000000..061825c2a21 --- /dev/null +++ b/samples/client/petstore/kotlin/src/test/kotlin/org/openapijsonschematools/client/schemas/validation/ItemsValidatorTest.kt @@ -0,0 +1,131 @@ +package org.openapijsonschematools.client.schemas.validation; + +import org.checkerframework.checker.nullness.qual.Nullable; +import org.junit.Assert; +import org.junit.Test; +import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags; +import org.openapijsonschematools.client.configurations.SchemaConfiguration; +import org.openapijsonschematools.client.schemas.StringJsonSchema; +import org.openapijsonschematools.client.exceptions.ValidationException; + +import java.util.ArrayList; +import java.util.LinkedHashMap; +import java.util.LinkedHashSet; +import java.util.List; +import java.util.Set; + +public class ItemsValidatorTest { + @SuppressWarnings("nullness") + private void assertNull(@Nullable Object object) { + Assert.assertNull(object); + } + + public sealed interface ArrayWithItemsSchemaBoxed permits ArrayWithItemsSchemaBoxedList {} + public record ArrayWithItemsSchemaBoxedList() implements ArrayWithItemsSchemaBoxed {} + + public static class ArrayWithItemsSchema extends JsonSchema { + public ArrayWithItemsSchema() { + super(new JsonSchemaInfo() + .type(Set.of(List.class)) + .items(StringJsonSchema.StringJsonSchema1.class) + ); + } + + @Override + public Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { + 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"); + } + + @Override + public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws 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"); + } + + @Override + public ArrayWithItemsSchemaBoxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { + return new ArrayWithItemsSchemaBoxedList(); + } + } + + @Test + public void testCorrectItemsSucceeds() throws ValidationException { + List pathToItem = List.of("args[0]"); + ValidationMetadata validationMetadata = new ValidationMetadata( + pathToItem, + new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().build()), + new PathToSchemasMap(), + new LinkedHashSet<>() + ); + List mutableList = new ArrayList<>(); + mutableList.add("a"); + FrozenList arg = new FrozenList<>(mutableList); + final ItemsValidator validator = new ItemsValidator(); + PathToSchemasMap pathToSchemas = validator.validate( + new ValidationData( + new ArrayWithItemsSchema(), + arg, + validationMetadata + ) + ); + if (pathToSchemas == null) { + throw new RuntimeException("Invalid null value in pathToSchemas for this test case"); + } + List expectedPathToItem = new ArrayList<>(); + expectedPathToItem.add("args[0]"); + expectedPathToItem.add(0); + LinkedHashMap, Nothing?> expectedClasses = new LinkedHashMap<>(); + StringJsonSchema.StringJsonSchema1 schema = JsonSchemaFactory.getInstance(StringJsonSchema.StringJsonSchema1.class); + expectedClasses.put(schema, null); + PathToSchemasMap expectedPathToSchemas = new PathToSchemasMap(); + expectedPathToSchemas.put(expectedPathToItem, expectedClasses); + Assert.assertEquals(pathToSchemas, expectedPathToSchemas); + } + + @Test + public void testNotApplicableTypeReturnsNull() throws ValidationException { + List pathToItem = List.of("args[0]"); + ValidationMetadata validationMetadata = new ValidationMetadata( + pathToItem, + new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().build()), + new PathToSchemasMap(), + new LinkedHashSet<>() + ); + final ItemsValidator validator = new ItemsValidator(); + PathToSchemasMap pathToSchemas = validator.validate( + new ValidationData( + new ArrayWithItemsSchema(), + 1, + validationMetadata + ) + ); + assertNull(pathToSchemas); + } + + @Test + public void testIncorrectItemFails() { + List pathToItem = List.of("args[0]"); + ValidationMetadata validationMetadata = new ValidationMetadata( + pathToItem, + new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().build()), + new PathToSchemasMap(), + new LinkedHashSet<>() + ); + List mutableList = new ArrayList<>(); + mutableList.add(1); + FrozenList arg = new FrozenList<>(mutableList); + final ItemsValidator validator = new ItemsValidator(); + Assert.assertThrows(ValidationException.class, () -> validator.validate( + new ValidationData( + new ArrayWithItemsSchema(), + arg, + validationMetadata + ) + )); + } +} \ No newline at end of file diff --git a/samples/client/petstore/kotlin/src/test/kotlin/org/openapijsonschematools/client/schemas/validation/JsonSchemaTest.kt b/samples/client/petstore/kotlin/src/test/kotlin/org/openapijsonschematools/client/schemas/validation/JsonSchemaTest.kt new file mode 100644 index 00000000000..a6d145b87b9 --- /dev/null +++ b/samples/client/petstore/kotlin/src/test/kotlin/org/openapijsonschematools/client/schemas/validation/JsonSchemaTest.kt @@ -0,0 +1,80 @@ +package org.openapijsonschematools.client.schemas.validation; + +import org.checkerframework.checker.nullness.qual.Nullable; +import org.junit.Assert; +import org.junit.Test; +import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags; +import org.openapijsonschematools.client.configurations.SchemaConfiguration; +import org.openapijsonschematools.client.exceptions.ValidationException; + +import java.util.LinkedHashMap; +import java.util.LinkedHashSet; +import java.util.List; +import java.util.Set; + +sealed interface SomeSchemaBoxed permits SomeSchemaBoxedString {} +record SomeSchemaBoxedString() implements SomeSchemaBoxed {} + +public class JsonSchemaTest { + sealed interface SomeSchemaBoxed permits SomeSchemaBoxedString {} + record SomeSchemaBoxedString() implements SomeSchemaBoxed {} + + static class SomeSchema extends JsonSchema { + private static @Nullable SomeSchema instance = null; + protected SomeSchema() { + super(new JsonSchemaInfo() + .type(Set.of(String.class)) + ); + } + + public static SomeSchema getInstance() { + if (instance == null) { + instance = new SomeSchema(); + } + return instance; + } + + @Override + public Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { + if (arg instanceof String) { + return arg; + } + 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 { + if (arg instanceof String) { + return arg; + } + 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 ValidationException { + return new SomeSchemaBoxedString(); + } + } + + @Test + public void testValidateSucceeds() throws ValidationException { + List pathToItem = List.of("args[0]"); + ValidationMetadata validationMetadata = new ValidationMetadata( + pathToItem, + new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().build()), + new PathToSchemasMap(), + new LinkedHashSet<>() + ); + SomeSchema schema = JsonSchemaFactory.getInstance(SomeSchema.class); + PathToSchemasMap pathToSchemas = JsonSchema.validate( + schema, + "hi", + validationMetadata + ); + PathToSchemasMap expectedPathToSchemas = new PathToSchemasMap(); + LinkedHashMap, Nothing?> validatedClasses = new LinkedHashMap<>(); + validatedClasses.put(schema, null); + expectedPathToSchemas.put(pathToItem, validatedClasses); + Assert.assertEquals(pathToSchemas, expectedPathToSchemas); + } +} \ No newline at end of file diff --git a/samples/client/petstore/kotlin/src/test/kotlin/org/openapijsonschematools/client/schemas/validation/PropertiesValidatorTest.kt b/samples/client/petstore/kotlin/src/test/kotlin/org/openapijsonschematools/client/schemas/validation/PropertiesValidatorTest.kt new file mode 100644 index 00000000000..6e2108e64fa --- /dev/null +++ b/samples/client/petstore/kotlin/src/test/kotlin/org/openapijsonschematools/client/schemas/validation/PropertiesValidatorTest.kt @@ -0,0 +1,134 @@ +package org.openapijsonschematools.client.schemas.validation; + +import org.checkerframework.checker.nullness.qual.Nullable; +import org.junit.Assert; +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.StringJsonSchema; + +import java.util.ArrayList; +import java.util.LinkedHashMap; +import java.util.LinkedHashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; + +public class PropertiesValidatorTest { + public sealed interface ObjectWithPropsSchemaBoxed permits ObjectWithPropsSchemaBoxedMap {} + public record ObjectWithPropsSchemaBoxedMap() implements ObjectWithPropsSchemaBoxed {} + + public static class ObjectWithPropsSchema extends JsonSchema { + private ObjectWithPropsSchema() { + super(new JsonSchemaInfo() + .type(Set.of(Map.class)) + .properties(Map.ofEntries( + new PropertyEntry("someString", StringJsonSchema.StringJsonSchema1.class) + )) + ); + + } + + @Override + public Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { + 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"); + } + + @Override + public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws 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"); + } + + @Override + public ObjectWithPropsSchemaBoxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { + return new ObjectWithPropsSchemaBoxedMap(); + } + } + + @SuppressWarnings("nullness") + private void assertNull(@Nullable Object object) { + Assert.assertNull(object); + } + + @Test + public void testCorrectPropertySucceeds() throws ValidationException { + final PropertiesValidator validator = new PropertiesValidator(); + List pathToItem = List.of("args[0]"); + ValidationMetadata validationMetadata = new ValidationMetadata( + pathToItem, + new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().build()), + new PathToSchemasMap(), + new LinkedHashSet<>() + ); + LinkedHashMap mutableMap = new LinkedHashMap<>(); + mutableMap.put("someString", "abc"); + FrozenMap arg = new FrozenMap<>(mutableMap); + PathToSchemasMap pathToSchemas = validator.validate( + new ValidationData( + new ObjectWithPropsSchema(), + arg, + validationMetadata + ) + ); + if (pathToSchemas == null) { + throw new RuntimeException("Invalid null value for pathToSchemas for this test case"); + } + List expectedPathToItem = new ArrayList<>(); + expectedPathToItem.add("args[0]"); + expectedPathToItem.add("someString"); + LinkedHashMap, Nothing?> expectedClasses = new LinkedHashMap<>(); + expectedClasses.put(JsonSchemaFactory.getInstance(StringJsonSchema.StringJsonSchema1.class), null); + PathToSchemasMap expectedPathToSchemas = new PathToSchemasMap(); + expectedPathToSchemas.put(expectedPathToItem, expectedClasses); + Assert.assertEquals(pathToSchemas, expectedPathToSchemas); + } + + @Test + public void testNotApplicableTypeReturnsNull() throws ValidationException { + final PropertiesValidator validator = new PropertiesValidator(); + List pathToItem = List.of("args[0]"); + ValidationMetadata validationMetadata = new ValidationMetadata( + pathToItem, + new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().build()), + new PathToSchemasMap(), + new LinkedHashSet<>() + ); + PathToSchemasMap pathToSchemas = validator.validate( + new ValidationData( + new ObjectWithPropsSchema(), + 1, + validationMetadata + ) + ); + assertNull(pathToSchemas); + } + + @Test + public void testIncorrectPropertyValueFails() { + final PropertiesValidator validator = new PropertiesValidator(); + List pathToItem = List.of("args[0]"); + ValidationMetadata validationMetadata = new ValidationMetadata( + pathToItem, + new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().build()), + new PathToSchemasMap(), + new LinkedHashSet<>() + ); + LinkedHashMap mutableMap = new LinkedHashMap<>(); + mutableMap.put("someString", 1); + FrozenMap arg = new FrozenMap<>(mutableMap); + Assert.assertThrows(ValidationException.class, () -> validator.validate( + new ValidationData( + new ObjectWithPropsSchema(), + arg, + validationMetadata + ) + )); + } +} \ No newline at end of file diff --git a/samples/client/petstore/kotlin/src/test/kotlin/org/openapijsonschematools/client/schemas/validation/RequiredValidatorTest.kt b/samples/client/petstore/kotlin/src/test/kotlin/org/openapijsonschematools/client/schemas/validation/RequiredValidatorTest.kt new file mode 100644 index 00000000000..72d044cf4cf --- /dev/null +++ b/samples/client/petstore/kotlin/src/test/kotlin/org/openapijsonschematools/client/schemas/validation/RequiredValidatorTest.kt @@ -0,0 +1,120 @@ +package org.openapijsonschematools.client.schemas.validation; + +import org.checkerframework.checker.nullness.qual.Nullable; +import org.junit.Assert; +import org.junit.Test; +import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags; +import org.openapijsonschematools.client.configurations.SchemaConfiguration; +import org.openapijsonschematools.client.exceptions.ValidationException; + +import java.util.LinkedHashMap; +import java.util.LinkedHashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; + +public class RequiredValidatorTest { + public sealed interface ObjectWithRequiredSchemaBoxed permits ObjectWithRequiredSchemaBoxedMap {} + public record ObjectWithRequiredSchemaBoxedMap() implements ObjectWithRequiredSchemaBoxed {} + + public static class ObjectWithRequiredSchema extends JsonSchema { + private ObjectWithRequiredSchema() { + super(new JsonSchemaInfo() + .type(Set.of(Map.class)) + .required(Set.of("someString")) + ); + + } + + @Override + public Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { + 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"); + } + + @Override + public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws 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"); + } + + @Override + public ObjectWithRequiredSchemaBoxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { + return new ObjectWithRequiredSchemaBoxedMap(); + } + } + + @SuppressWarnings("nullness") + private void assertNull(@Nullable Object object) { + Assert.assertNull(object); + } + + @Test + public void testCorrectPropertySucceeds() throws ValidationException { + List pathToItem = List.of("args[0]"); + ValidationMetadata validationMetadata = new ValidationMetadata( + pathToItem, + new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().build()), + new PathToSchemasMap(), + new LinkedHashSet<>() + ); + LinkedHashMap mutableMap = new LinkedHashMap<>(); + mutableMap.put("someString", "abc"); + FrozenMap arg = new FrozenMap<>(mutableMap); + final RequiredValidator validator = new RequiredValidator(); + PathToSchemasMap pathToSchemas = validator.validate( + new ValidationData( + new ObjectWithRequiredSchema(), + arg, + validationMetadata + ) + ); + assertNull(pathToSchemas); + } + + @Test + public void testNotApplicableTypeReturnsNull() throws ValidationException { + List pathToItem = List.of("args[0]"); + ValidationMetadata validationMetadata = new ValidationMetadata( + pathToItem, + new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().build()), + new PathToSchemasMap(), + new LinkedHashSet<>() + ); + final RequiredValidator validator = new RequiredValidator(); + PathToSchemasMap pathToSchemas = validator.validate( + new ValidationData( + new ObjectWithRequiredSchema(), + 1, + validationMetadata + ) + ); + assertNull(pathToSchemas); + } + + @Test + public void testIncorrectPropertyFails() { + List pathToItem = List.of("args[0]"); + ValidationMetadata validationMetadata = new ValidationMetadata( + pathToItem, + new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().build()), + new PathToSchemasMap(), + new LinkedHashSet<>() + ); + LinkedHashMap mutableMap = new LinkedHashMap<>(); + mutableMap.put("aDifferentProp", 1); + FrozenMap arg = new FrozenMap<>(mutableMap); + final RequiredValidator validator = new RequiredValidator(); + Assert.assertThrows(ValidationException.class, () -> validator.validate( + new ValidationData( + new ObjectWithRequiredSchema(), + arg, + validationMetadata + ) + )); + } +} \ No newline at end of file diff --git a/samples/client/petstore/kotlin/src/test/kotlin/org/openapijsonschematools/client/schemas/validation/TypeValidatorTest.kt b/samples/client/petstore/kotlin/src/test/kotlin/org/openapijsonschematools/client/schemas/validation/TypeValidatorTest.kt new file mode 100644 index 00000000000..01378dd4d41 --- /dev/null +++ b/samples/client/petstore/kotlin/src/test/kotlin/org/openapijsonschematools/client/schemas/validation/TypeValidatorTest.kt @@ -0,0 +1,56 @@ +package org.openapijsonschematools.client.schemas.validation; + +import org.checkerframework.checker.nullness.qual.Nullable; +import org.junit.Assert; +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.StringJsonSchema; + +import java.util.ArrayList; +import java.util.LinkedHashSet; + +public class TypeValidatorTest { + @SuppressWarnings("nullness") + private void assertNull(@Nullable Object object) { + Assert.assertNull(object); + } + + @Test + public void testValidateSucceeds() throws ValidationException { + final TypeValidator validator = new TypeValidator(); + ValidationMetadata validationMetadata = new ValidationMetadata( + new ArrayList<>(), + new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().build()), + new PathToSchemasMap(), + new LinkedHashSet<>() + ); + @Nullable PathToSchemasMap pathToSchemasMap = validator.validate( + new ValidationData( + StringJsonSchema.StringJsonSchema1.getInstance(), + "hi", + validationMetadata + ) + ); + assertNull(pathToSchemasMap); + } + + @Test + public void testValidateFailsIntIsNotString() { + final TypeValidator validator = new TypeValidator(); + ValidationMetadata validationMetadata = new ValidationMetadata( + new ArrayList<>(), + new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().build()), + new PathToSchemasMap(), + new LinkedHashSet<>() + ); + Assert.assertThrows(ValidationException.class, () -> validator.validate( + new ValidationData( + StringJsonSchema.StringJsonSchema1.getInstance(), + 1, + validationMetadata + ) + )); + } +} \ No newline at end of file diff --git a/src/main/java/org/openapijsonschematools/codegen/generators/KotlinClientGenerator.java b/src/main/java/org/openapijsonschematools/codegen/generators/KotlinClientGenerator.java new file mode 100644 index 00000000000..743074d64e4 --- /dev/null +++ b/src/main/java/org/openapijsonschematools/codegen/generators/KotlinClientGenerator.java @@ -0,0 +1,3531 @@ +/* + * Copyright 2018 OpenAPI-Generator Contributors (https://openapi-generator.tech) + * Copyright 2018 SmartBear Software + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package org.openapijsonschematools.codegen.generators; + +import com.google.common.base.Strings; +import com.google.common.collect.Sets; +import io.swagger.v3.oas.models.Components; +import io.swagger.v3.oas.models.OpenAPI; +import io.swagger.v3.oas.models.examples.Example; +import io.swagger.v3.oas.models.media.Schema; +import io.swagger.v3.oas.models.media.StringSchema; +import io.swagger.v3.oas.models.parameters.Parameter; +import io.swagger.v3.oas.models.servers.Server; +import org.apache.commons.io.FilenameUtils; +import org.apache.commons.lang3.StringUtils; +import org.openapijsonschematools.codegen.common.CodegenConstants; +import org.openapijsonschematools.codegen.common.ModelUtils; +import org.openapijsonschematools.codegen.config.GeneratorSettings; +import org.openapijsonschematools.codegen.config.WorkflowSettings; +import org.openapijsonschematools.codegen.generators.generatormetadata.FeatureSet; +import org.openapijsonschematools.codegen.generators.generatormetadata.GeneratorLanguage; +import org.openapijsonschematools.codegen.generators.generatormetadata.GeneratorMetadata; +import org.openapijsonschematools.codegen.generators.generatormetadata.GeneratorType; +import org.openapijsonschematools.codegen.generators.generatormetadata.Stability; +import org.openapijsonschematools.codegen.generators.generatormetadata.features.ComponentsFeature; +import org.openapijsonschematools.codegen.generators.generatormetadata.features.DataTypeFeature; +import org.openapijsonschematools.codegen.generators.generatormetadata.features.DocumentationFeature; +import org.openapijsonschematools.codegen.generators.generatormetadata.features.GlobalFeature; +import org.openapijsonschematools.codegen.generators.generatormetadata.features.OperationFeature; +import org.openapijsonschematools.codegen.generators.generatormetadata.features.SchemaFeature; +import org.openapijsonschematools.codegen.generators.generatormetadata.features.SecurityFeature; +import org.openapijsonschematools.codegen.generators.generatormetadata.features.WireFormatFeature; +import org.openapijsonschematools.codegen.generators.models.CliOption; +import org.openapijsonschematools.codegen.generators.models.GeneratedFileType; +import org.openapijsonschematools.codegen.generators.openapimodels.CodegenHeader; +import org.openapijsonschematools.codegen.generators.openapimodels.CodegenKey; +import org.openapijsonschematools.codegen.generators.openapimodels.CodegenKeyType; +import org.openapijsonschematools.codegen.generators.openapimodels.CodegenList; +import org.openapijsonschematools.codegen.generators.openapimodels.CodegenParameter; +import org.openapijsonschematools.codegen.generators.openapimodels.CodegenParametersInfo; +import org.openapijsonschematools.codegen.generators.openapimodels.CodegenRefInfo; +import org.openapijsonschematools.codegen.generators.openapimodels.CodegenRequestBody; +import org.openapijsonschematools.codegen.generators.openapimodels.CodegenResponse; +import org.openapijsonschematools.codegen.generators.openapimodels.CodegenSchema; +import org.openapijsonschematools.codegen.generators.openapimodels.CodegenSecurityRequirementObject; +import org.openapijsonschematools.codegen.generators.openapimodels.CodegenSecurityScheme; +import org.openapijsonschematools.codegen.generators.openapimodels.CodegenServer; +import org.openapijsonschematools.codegen.generators.openapimodels.EnumInfo; +import org.openapijsonschematools.codegen.generators.openapimodels.EnumValue; +import org.openapijsonschematools.codegen.generators.openapimodels.MapBuilder; +import org.openapijsonschematools.codegen.generators.openapimodels.OperationInput; +import org.openapijsonschematools.codegen.generators.openapimodels.OperationInputProvider; +import org.openapijsonschematools.codegen.templating.HandlebarsEngineAdapter; +import org.openapijsonschematools.codegen.templating.SupportingFile; +import org.openapijsonschematools.codegen.templating.TemplatingEngineAdapter; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; + +import javax.validation.constraints.NotNull; +import java.io.File; +import java.io.IOException; +import java.math.BigDecimal; +import java.util.AbstractMap; +import java.util.ArrayList; +import java.util.Arrays; +import java.util.Collections; +import java.util.HashMap; +import java.util.HashSet; +import java.util.LinkedHashMap; +import java.util.LinkedHashSet; +import java.util.List; +import java.util.Locale; +import java.util.Map; +import java.util.Objects; +import java.util.Set; +import java.util.Stack; +import java.util.TreeMap; +import java.util.function.Function; +import java.util.regex.Matcher; +import java.util.regex.Pattern; +import java.util.stream.Collectors; +import java.util.stream.Stream; + +import static org.openapijsonschematools.codegen.common.StringUtils.camelize; +import static org.openapijsonschematools.codegen.common.StringUtils.escape; + +public class KotlinClientGenerator extends DefaultGenerator implements Generator { + public KotlinClientGenerator(GeneratorSettings generatorSettings, WorkflowSettings workflowSettings) { + super( + generatorSettings, + workflowSettings, + "kotlin", + "org.openapijsonschematools.client", + "openapi-kotlin-client", + "generated-code" + File.separator + "kotlin" + ); + supportingFiles.add(new SupportingFile("build.gradle.hbs", "", "build.gradle.kts").doNotOverwrite()); + supportingFiles.add(new SupportingFile("settings.gradle.hbs", "", "settings.gradle.kts").doNotOverwrite()); + if (this.outputTestFolder.isEmpty()) { + setOutputTestFolder(this.generatorSettings.outputFolder); + } + // Common files + supportingFiles.add(new SupportingFile("README.hbs", "", "README.md").doNotOverwrite()); + supportingFiles.add(new SupportingFile("gitignore.hbs", "", ".gitignore")); + + headersSchemaFragment = "HeadersSchema"; + supportsInheritance = true; + + + cliOptions.add(new CliOption(CodegenConstants.INVOKER_PACKAGE, CodegenConstants.INVOKER_PACKAGE_DESC).defaultValue(this.getInvokerPackage())); + cliOptions.add(new CliOption(CodegenConstants.GROUP_ID, CodegenConstants.GROUP_ID_DESC).defaultValue(this.getGroupId())); + cliOptions.add(new CliOption(CodegenConstants.ARTIFACT_VERSION, CodegenConstants.ARTIFACT_VERSION_DESC).defaultValue(ARTIFACT_VERSION_DEFAULT_VALUE)); + cliOptions.add(new CliOption(CodegenConstants.ARTIFACT_URL, CodegenConstants.ARTIFACT_URL_DESC).defaultValue(this.getArtifactUrl())); + cliOptions.add(new CliOption(CodegenConstants.ARTIFACT_DESCRIPTION, CodegenConstants.ARTIFACT_DESCRIPTION_DESC).defaultValue(this.getArtifactDescription())); + cliOptions.add(new CliOption(CodegenConstants.SCM_CONNECTION, CodegenConstants.SCM_CONNECTION_DESC).defaultValue(this.getScmConnection())); + cliOptions.add(new CliOption(CodegenConstants.SCM_DEVELOPER_CONNECTION, CodegenConstants.SCM_DEVELOPER_CONNECTION_DESC).defaultValue(this.getScmDeveloperConnection())); + cliOptions.add(new CliOption(CodegenConstants.SCM_URL, CodegenConstants.SCM_URL_DESC).defaultValue(this.getScmUrl())); + cliOptions.add(new CliOption(CodegenConstants.DEVELOPER_NAME, CodegenConstants.DEVELOPER_NAME_DESC).defaultValue(this.getDeveloperName())); + cliOptions.add(new CliOption(CodegenConstants.DEVELOPER_EMAIL, CodegenConstants.DEVELOPER_EMAIL_DESC).defaultValue(this.getDeveloperEmail())); + cliOptions.add(new CliOption(CodegenConstants.DEVELOPER_ORGANIZATION, CodegenConstants.DEVELOPER_ORGANIZATION_DESC).defaultValue(this.getDeveloperOrganization())); + cliOptions.add(new CliOption(CodegenConstants.DEVELOPER_ORGANIZATION_URL, CodegenConstants.DEVELOPER_ORGANIZATION_URL_DESC).defaultValue(this.getDeveloperOrganizationUrl())); + cliOptions.add(new CliOption(CodegenConstants.LICENSE_NAME, CodegenConstants.LICENSE_NAME_DESC).defaultValue(this.getLicenseName())); + cliOptions.add(new CliOption(CodegenConstants.LICENSE_URL, CodegenConstants.LICENSE_URL_DESC).defaultValue(this.getLicenseUrl())); + cliOptions.add(new CliOption(CodegenConstants.SOURCE_FOLDER, CodegenConstants.SOURCE_FOLDER_DESC).defaultValue(this.getSourceFolder())); + cliOptions.add(CliOption.newString(CodegenConstants.PARENT_GROUP_ID, CodegenConstants.PARENT_GROUP_ID_DESC)); + cliOptions.add(CliOption.newString(CodegenConstants.PARENT_ARTIFACT_ID, CodegenConstants.PARENT_ARTIFACT_ID_DESC)); + cliOptions.add(CliOption.newString(CodegenConstants.PARENT_VERSION, CodegenConstants.PARENT_VERSION_DESC)); + CliOption snapShotVersion = CliOption.newString(CodegenConstants.SNAPSHOT_VERSION, CodegenConstants.SNAPSHOT_VERSION_DESC); + Map snapShotVersionOptions = new HashMap<>(); + snapShotVersionOptions.put("true", "Use a SnapShot Version"); + snapShotVersionOptions.put("false", "Use a Release Version"); + snapShotVersion.setEnum(snapShotVersionOptions); + cliOptions.add(snapShotVersion); + cliOptions.add(CliOption.newString(TEST_OUTPUT, "Set output folder for models and APIs tests").defaultValue(DEFAULT_TEST_FOLDER)); + + requestBodiesIdentifier = "requestbodies"; + securitySchemesIdentifier = "securityschemes"; + requestBodyIdentifier = "requestbody"; + addSchemaImportsFromV3SpecLocations = true; + deepestRefSchemaImportNeeded = true; + objectIOClassNamePiece = "Map"; + arrayIOClassNamePiece = "List"; + arrayObjectInputClassNameSuffix = "Builder"; + + invokerPackage = "org.openapijsonschematools.client"; + modelPackage = "components.schemas"; + + // cliOptions default redefinition need to be updated + updateOption(CodegenConstants.INVOKER_PACKAGE, this.getInvokerPackage()); + + jsonPathTestTemplateFiles.put( + CodegenConstants.JSON_PATH_LOCATION_TYPE.SCHEMA, + new HashMap<>() {{ + put("src/test/kotlin/packagename/components/schemas/Schema_test.hbs", ".kt"); + }} + ); + } + + private final Logger LOGGER = LoggerFactory.getLogger(KotlinClientGenerator.class); + + protected String authFolder; + protected HashMap schemaJsonPathToModelName = new HashMap<>(); + + private static final String ARTIFACT_VERSION_DEFAULT_VALUE = "1.0.0"; + + public static final String TEST_OUTPUT = "testOutput"; + public static final String DEFAULT_TEST_FOLDER = "${project.build.directory}/generated-test-sources/openapi"; + + protected String invokerPackage = "org.openapijsonschematools"; + protected String groupId = "org.openapijsonschematools"; + protected String artifactVersion = null; + protected String artifactUrl = "https://github.com/openapi-json-schema-tools/openapi-json-schema-generator"; + protected String artifactDescription = "OpenAPI Kotlin"; + protected String developerName = "OpenAPI-Generator Contributors"; + protected String developerEmail = "team@openapijsonschematools.org"; + protected String developerOrganization = "OpenAPITools.org"; + protected String developerOrganizationUrl = "http://openapijsonschematools.org"; + protected String scmConnection = "scm:git:git@github.com:openapi-json-schema-tools/openapi-json-schema-generator.git"; + protected String scmDeveloperConnection = "scm:git:git@github.com:openapi-json-schema-tools/openapi-json-schema-generator.git"; + protected String scmUrl = "https://github.com/openapi-json-schema-tools/openapi-json-schema-generator"; + protected String licenseName = "Unlicense"; + protected String licenseUrl = "http://unlicense.org"; + protected String projectFolder = "src/main"; + // this must not be OS-specific + protected String sourceFolder = projectFolder + "/kotlin"; + protected String apiDocPath = "docs/"; + protected String modelDocPath = "docs/"; + protected String parentGroupId = ""; + protected String parentArtifactId = ""; + protected String parentVersion = ""; + protected String outputTestFolder = ""; + private final Map schemaKeyToModelNameCache = new HashMap<>(); + + private static final FeatureSet featureSet = FeatureSet.newBuilder() + .includeDataTypeFeatures( + DataTypeFeature.Int32, + DataTypeFeature.Int64, + DataTypeFeature.Integer, + DataTypeFeature.Float, + DataTypeFeature.Double, + DataTypeFeature.Number, + DataTypeFeature.String, + DataTypeFeature.Boolean, + DataTypeFeature.Date, + DataTypeFeature.DateTime, + DataTypeFeature.Uuid, + DataTypeFeature.Array, + DataTypeFeature.Object, + DataTypeFeature.Null, + DataTypeFeature.AnyType, + DataTypeFeature.Enum + ) + .includeDocumentationFeatures( + DocumentationFeature.Readme, + DocumentationFeature.Servers, + DocumentationFeature.Security, + DocumentationFeature.ComponentSchemas, + DocumentationFeature.ComponentSecuritySchemes, + DocumentationFeature.ComponentRequestBodies, + DocumentationFeature.ComponentResponses, + DocumentationFeature.ComponentHeaders, + DocumentationFeature.ComponentParameters, + DocumentationFeature.Api + ) + .includeGlobalFeatures( + GlobalFeature.Components, + GlobalFeature.Servers, + GlobalFeature.Security, + GlobalFeature.Paths, + GlobalFeature.Info + ) + .includeComponentsFeatures( + ComponentsFeature.schemas, + ComponentsFeature.securitySchemes, + ComponentsFeature.requestBodies, + ComponentsFeature.responses, + ComponentsFeature.headers, + ComponentsFeature.parameters + ) + .includeSecurityFeatures( + SecurityFeature.ApiKey, + SecurityFeature.HTTP_Basic, + SecurityFeature.HTTP_Bearer + ) + .includeOperationFeatures( + OperationFeature.Security, + OperationFeature.Servers, + OperationFeature.Responses_Default, + OperationFeature.Responses_HttpStatusCode, + OperationFeature.Responses_RangedResponseCodes, + OperationFeature.Responses_RedirectionResponse + ) + .includeSchemaFeatures( + SchemaFeature.AdditionalProperties, + SchemaFeature.AllOf, + SchemaFeature.AnyOf, + SchemaFeature.Const, + SchemaFeature.Contains, + SchemaFeature.Default, + SchemaFeature.DependentRequired, + SchemaFeature.DependentSchemas, + // SchemaFeature.Discriminator, + SchemaFeature.Else, + SchemaFeature.Enum, + SchemaFeature.ExclusiveMaximum, + SchemaFeature.ExclusiveMinimum, + SchemaFeature.Format, + SchemaFeature.If, + SchemaFeature.Items, + SchemaFeature.MaxContains, + SchemaFeature.MaxItems, + SchemaFeature.MaxLength, + SchemaFeature.MaxProperties, + SchemaFeature.Maximum, + SchemaFeature.MinContains, + SchemaFeature.MinItems, + SchemaFeature.MinLength, + SchemaFeature.MinProperties, + SchemaFeature.Minimum, + SchemaFeature.MultipleOf, + SchemaFeature.Not, + SchemaFeature.Nullable, + SchemaFeature.OneOf, + SchemaFeature.Pattern, + SchemaFeature.PatternProperties, + SchemaFeature.PrefixItems, + SchemaFeature.Properties, + SchemaFeature.PropertyNames, + SchemaFeature.Ref, + SchemaFeature.Required, + SchemaFeature.Then, + SchemaFeature.Type, + SchemaFeature.UnevaluatedItems, + SchemaFeature.UnevaluatedProperties, + SchemaFeature.UniqueItems + ) + .includeWireFormatFeatures( + WireFormatFeature.JSON + ) + .build(); + public static final GeneratorMetadata generatorMetadata = GeneratorMetadata.newBuilder() + .name("kotlin") + .language(GeneratorLanguage.KOTLIN) + .languageVersion("17") + .type(GeneratorType.CLIENT) + .stability(Stability.STABLE) + .featureSet(featureSet) + .generationMessage(String.format(Locale.ROOT, "OpenAPI JSON Schema Generator: %s (%s)", "kotlin", GeneratorType.CLIENT)) + .helpMsg(String.join( + "
", + "Generates a Kotlin client library", + "", + "Features in this generator:", + "- v3.0.0 - [v3.1.0](#schema-feature) OpenAPI Specification support", + "- Very thorough documentation generated in the style of javadocs", + "- Input types constrained for a Schema in SomeSchema.validate", + " - validate method can accept arbitrary List/Map/null/int/long/double/float/String json data", + "- Immutable List output classes generated and returned by validate for List<?> input", + "- Immutable Map output classes generated and returned by validate for Map<?, ?> input", + "- Strictly typed list input can be instantiated in client code using generated ListBuilders", + "- Strictly typed map input can be instantiated in client code using generated MapBuilders", + " - Sequential map builders are generated ensuring that required properties are set before build is invoked. Looks like:", + " - `new MapBuilder().requiredA(\"a\").requiredB(\"b\").build()`", + " - `new MapBuilder().requiredA(\"a\").requiredB(\"b\").optionalProp(\"c\").additionalProperty(\"someAddProp\", \"d\").build()`", + "- Run time type checking and validation when", + " - validating schema payloads", + " - instantiating List output class (validation run)", + " - instantiating Map output class (validation run)", + " - Note: if needed, validation of json schema keywords can be deactivated via a SchemaConfiguration class", + "- Enums classes are generated and may be input into Schema.validate or the List/MapBuilder add/setter methods", + "- Invalid (in Kotlin) property names supported like `class`, `1var`, `hi-there` etc in", + " - component schema names", + " - schema property names (a fallback setter is written in the MapBuilder)", + "- Generated interfaces are largely consistent with the python code", + "- Openapi spec inline schemas supported at any depth in any location", + "- Format support for: int32, int64, float, double, date, datetime, uuid", + "- Payload values are not coerced when validated, so a date/date-time value can pass other validations that describe the payload only as type string", + "- enum types are generated for enums of type string/integer/number/boolean/null", + "- String transmission of numbers supported with type: string, format: number" + )) + .postGenerationMsg(defaultPostGenerationMsg) + .reservedWords( + getLowerCaseWords( + Arrays.asList( + // used as internal variables, can collide with parameter names + "localVarPath", "localVarQueryParams", "localVarCollectionQueryParams", + "localVarHeaderParams", "localVarCookieParams", "localVarFormParams", "localVarPostBody", + "localVarAccepts", "localVarAccept", "localVarContentTypes", + "localVarContentType", "localVarAuthNames", "localReturnType", + "ApiClient", "ApiException", "ApiResponse", "Configuration", "StringUtil", + + // language reserved words + "abstract", "continue", "for", "new", "switch", "assert", + "default", "if", "package", "synchronized", "boolean", "do", "goto", "private", + "this", "break", "double", "implements", "protected", "throw", "byte", "else", + "import", "public", "throws", "case", "enum", "instanceof", "return", "transient", + "catch", "extends", "int", "short", "try", "char", "final", "interface", "static", + "void", "class", "finally", "long", "strictfp", "volatile", "const", "float", + "native", "super", "while", "null", + // additional types + "localdate", "zoneddatetime", "list", "map", "linkedhashset", "void", "string", "uuid", "number", "integer", "toString" + ) + ) + ) + .instantiationTypes( + Map.ofEntries( + new AbstractMap.SimpleEntry<>("object", "FrozenMap"), + new AbstractMap.SimpleEntry<>("array", "FrozenList"), + new AbstractMap.SimpleEntry<>("string", "String"), + new AbstractMap.SimpleEntry<>("number", "Number (int, long, float, double)"), + new AbstractMap.SimpleEntry<>("integer", "Number (int, long, float with integer values, double with integer values)"), + new AbstractMap.SimpleEntry<>("boolean", "boolean"), + new AbstractMap.SimpleEntry<>("null", "Void (null)") + ) + ) + .languageSpecificPrimitives( + Sets.newHashSet( + "String", + "boolean", + "Boolean", + "Double", + "Integer", + "Long", + "Float", + "Object", + "byte[]" + ) + ) + .build(); + + @Override + public GeneratorMetadata getGeneratorMetadata() { + return generatorMetadata; + } + + @Override + public String toModuleFilename(String name, String jsonPath) { + String usedName = sanitizeName(name, "[^a-zA-Z0-9]+"); + // todo check if empty and if so them use enum name + // todo fix this, this does not handle names starting with numbers + usedName = usedName.toLowerCase(Locale.ROOT); + if (usedName.isEmpty()) { + usedName = toEnumVarName(name, null).toLowerCase(Locale.ROOT); + } + return usedName; + } + + protected void updateServersFilepath(String[] pathPieces) { + String[] copiedPathPieces = pathPieces.clone(); + copiedPathPieces[0] = "#"; + String jsonPath = String.join("/", copiedPathPieces); + if (pathPieces.length == 2) { + // #/servers + pathPieces[1] = "RootServerInfo"; + } else if (pathPieces.length == 3) { + // #/servers/0 + pathPieces[2] = getFilename(CodegenKeyType.SERVER, pathPieces[2], jsonPath); + } else { + // #/servers/0/variables + pathPieces[2] = getFilename(CodegenKeyType.SERVER, pathPieces[2], jsonPath).toLowerCase(Locale.ROOT); + pathPieces[3] = getFilename(CodegenKeyType.SCHEMA, pathPieces[pathPieces.length-1], jsonPath); + } + } + + public String packagePath() { + return "src" + File.separatorChar + "main" + File.separatorChar + "kotlin" + File.separatorChar + generatorSettings.packageName.replace('.', File.separatorChar); + } + + protected String testPackagePath() { + return "src" + File.separatorChar + "test" + File.separatorChar + "kotlin" + File.separatorChar + generatorSettings.packageName.replace('.', File.separatorChar); + } + + @Override + public void processOpts() { + if (StringUtils.isEmpty(System.getenv("KOTLIN_POST_PROCESS_FILE"))) { + LOGGER.info("Environment variable KOTLIN_POST_PROCESS_FILE not defined so the Kotlin code may not be properly formatted. To define it, try 'export KOTLIN_POST_PROCESS_FILE=\"/usr/local/bin/clang-format -i\"' (Linux/Mac)"); + LOGGER.info("NOTE: To enable file post-processing, 'enablePostProcessFile' must be set to `true` (--enable-post-process-file for CLI)."); + } + + if (additionalProperties.containsKey(CodegenConstants.INVOKER_PACKAGE)) { + this.setInvokerPackage((String) additionalProperties.get(CodegenConstants.INVOKER_PACKAGE)); + } else if (additionalProperties.containsKey(CodegenConstants.API_PACKAGE)) { + // guess from api package + String derivedInvokerPackage = deriveInvokerPackageName((String) additionalProperties.get(CodegenConstants.API_PACKAGE)); + this.additionalProperties.put(CodegenConstants.INVOKER_PACKAGE, derivedInvokerPackage); + this.setInvokerPackage((String) additionalProperties.get(CodegenConstants.INVOKER_PACKAGE)); + LOGGER.info("Invoker Package Name, originally not set, is now derived from api package name: {}", derivedInvokerPackage); + } else { + //not set, use default to be passed to template + additionalProperties.put(CodegenConstants.INVOKER_PACKAGE, invokerPackage); + } + + if (!additionalProperties.containsKey(CodegenConstants.API_PACKAGE)) { + additionalProperties.put(CodegenConstants.API_PACKAGE, generatorSettings().apiPackage); + } + + if (additionalProperties.containsKey(CodegenConstants.GROUP_ID)) { + this.setGroupId((String) additionalProperties.get(CodegenConstants.GROUP_ID)); + } else { + //not set, use to be passed to template + additionalProperties.put(CodegenConstants.GROUP_ID, groupId); + } + + if (additionalProperties.containsKey(CodegenConstants.ARTIFACT_URL)) { + this.setArtifactUrl((String) additionalProperties.get(CodegenConstants.ARTIFACT_URL)); + } else { + additionalProperties.put(CodegenConstants.ARTIFACT_URL, artifactUrl); + } + + if (additionalProperties.containsKey(CodegenConstants.ARTIFACT_DESCRIPTION)) { + this.setArtifactDescription((String) additionalProperties.get(CodegenConstants.ARTIFACT_DESCRIPTION)); + } else { + additionalProperties.put(CodegenConstants.ARTIFACT_DESCRIPTION, artifactDescription); + } + + if (additionalProperties.containsKey(CodegenConstants.SCM_CONNECTION)) { + this.setScmConnection((String) additionalProperties.get(CodegenConstants.SCM_CONNECTION)); + } else { + additionalProperties.put(CodegenConstants.SCM_CONNECTION, scmConnection); + } + + if (additionalProperties.containsKey(CodegenConstants.SCM_DEVELOPER_CONNECTION)) { + this.setScmDeveloperConnection((String) additionalProperties.get(CodegenConstants.SCM_DEVELOPER_CONNECTION)); + } else { + additionalProperties.put(CodegenConstants.SCM_DEVELOPER_CONNECTION, scmDeveloperConnection); + } + + if (additionalProperties.containsKey(CodegenConstants.SCM_URL)) { + this.setScmUrl((String) additionalProperties.get(CodegenConstants.SCM_URL)); + } else { + additionalProperties.put(CodegenConstants.SCM_URL, scmUrl); + } + + if (additionalProperties.containsKey(CodegenConstants.DEVELOPER_NAME)) { + this.setDeveloperName((String) additionalProperties.get(CodegenConstants.DEVELOPER_NAME)); + } else { + additionalProperties.put(CodegenConstants.DEVELOPER_NAME, developerName); + } + + if (additionalProperties.containsKey(CodegenConstants.DEVELOPER_EMAIL)) { + this.setDeveloperEmail((String) additionalProperties.get(CodegenConstants.DEVELOPER_EMAIL)); + } else { + additionalProperties.put(CodegenConstants.DEVELOPER_EMAIL, developerEmail); + } + + if (additionalProperties.containsKey(CodegenConstants.DEVELOPER_ORGANIZATION)) { + this.setDeveloperOrganization((String) additionalProperties.get(CodegenConstants.DEVELOPER_ORGANIZATION)); + } else { + additionalProperties.put(CodegenConstants.DEVELOPER_ORGANIZATION, developerOrganization); + } + + if (additionalProperties.containsKey(CodegenConstants.DEVELOPER_ORGANIZATION_URL)) { + this.setDeveloperOrganizationUrl((String) additionalProperties.get(CodegenConstants.DEVELOPER_ORGANIZATION_URL)); + } else { + additionalProperties.put(CodegenConstants.DEVELOPER_ORGANIZATION_URL, developerOrganizationUrl); + } + + if (additionalProperties.containsKey(CodegenConstants.LICENSE_NAME)) { + this.setLicenseName((String) additionalProperties.get(CodegenConstants.LICENSE_NAME)); + } else { + additionalProperties.put(CodegenConstants.LICENSE_NAME, licenseName); + } + + if (additionalProperties.containsKey(CodegenConstants.LICENSE_URL)) { + this.setLicenseUrl((String) additionalProperties.get(CodegenConstants.LICENSE_URL)); + } else { + additionalProperties.put(CodegenConstants.LICENSE_URL, licenseUrl); + } + + if (additionalProperties.containsKey(CodegenConstants.SOURCE_FOLDER)) { + this.setSourceFolder((String) additionalProperties.get(CodegenConstants.SOURCE_FOLDER)); + } + additionalProperties.put(CodegenConstants.SOURCE_FOLDER, sourceFolder); + + if (additionalProperties.containsKey(CodegenConstants.PARENT_GROUP_ID)) { + this.setParentGroupId((String) additionalProperties.get(CodegenConstants.PARENT_GROUP_ID)); + } + + if (additionalProperties.containsKey(CodegenConstants.PARENT_ARTIFACT_ID)) { + this.setParentArtifactId((String) additionalProperties.get(CodegenConstants.PARENT_ARTIFACT_ID)); + } + + if (additionalProperties.containsKey(CodegenConstants.PARENT_VERSION)) { + this.setParentVersion((String) additionalProperties.get(CodegenConstants.PARENT_VERSION)); + } + + if (!StringUtils.isEmpty(parentGroupId) && !StringUtils.isEmpty(parentArtifactId) && !StringUtils.isEmpty(parentVersion)) { + additionalProperties.put("parentOverridden", true); + } + + // make api and model doc path available in mustache template + additionalProperties.put("apiDocPath", apiDocPath); + additionalProperties.put("modelDocPath", modelDocPath); + + this.sanitizeConfig(); + + if (additionalProperties.containsKey(TEST_OUTPUT)) { + setOutputTestFolder(additionalProperties.get(TEST_OUTPUT).toString()); + } + + additionalProperties.put(CodegenConstants.PACKAGE_NAME, generatorSettings.packageName); + List schemaSupportingFiles = new ArrayList<>(); + schemaSupportingFiles.add("AnyTypeJsonSchema"); + schemaSupportingFiles.add("BooleanJsonSchema"); + schemaSupportingFiles.add("DateJsonSchema"); + schemaSupportingFiles.add("DateTimeJsonSchema"); + schemaSupportingFiles.add("DecimalJsonSchema"); + schemaSupportingFiles.add("DoubleJsonSchema"); + schemaSupportingFiles.add("FloatJsonSchema"); + schemaSupportingFiles.add("GenericBuilder"); + schemaSupportingFiles.add("Int32JsonSchema"); + schemaSupportingFiles.add("Int64JsonSchema"); + schemaSupportingFiles.add("IntJsonSchema"); + schemaSupportingFiles.add("ListJsonSchema"); + schemaSupportingFiles.add("MapJsonSchema"); + schemaSupportingFiles.add("NotAnyTypeJsonSchema"); + schemaSupportingFiles.add("NullJsonSchema"); + schemaSupportingFiles.add("NumberJsonSchema"); + schemaSupportingFiles.add("SetMaker"); + schemaSupportingFiles.add("StringJsonSchema"); + schemaSupportingFiles.add("UnsetAddPropsSetter"); + schemaSupportingFiles.add("UuidJsonSchema"); + for (String schemaSupportingFile: schemaSupportingFiles) { + supportingFiles.add(new SupportingFile( + "src/main/kotlin/packagename/schemas/"+schemaSupportingFile+".hbs", + packagePath() + File.separatorChar + "schemas", + schemaSupportingFile + ".kt")); + } + // tests + List schemaTestSupportingFiles = new ArrayList<>(); + schemaTestSupportingFiles.add("AnyTypeSchemaTest"); + schemaTestSupportingFiles.add("ArrayTypeSchemaTest"); + schemaTestSupportingFiles.add("BooleanSchemaTest"); + schemaTestSupportingFiles.add("ListBuilderTest"); + schemaTestSupportingFiles.add("ListSchemaTest"); + schemaTestSupportingFiles.add("MapSchemaTest"); + schemaTestSupportingFiles.add("NullSchemaTest"); + schemaTestSupportingFiles.add("NumberSchemaTest"); + schemaTestSupportingFiles.add("ObjectTypeSchemaTest"); + schemaTestSupportingFiles.add("RefBooleanSchemaTest"); + for (String schemaTestSupportingFile: schemaTestSupportingFiles) { + supportingFiles.add(new SupportingFile( + "src/test/kotlin/packagename/schemas/"+schemaTestSupportingFile+".hbs", + testPackagePath() + File.separatorChar + "schemas", + schemaTestSupportingFile + ".kt")); + } + + // validation + List keywordValidatorFiles = new ArrayList<>(); + keywordValidatorFiles.add("AdditionalPropertiesValidator"); + keywordValidatorFiles.add("AllOfValidator"); + keywordValidatorFiles.add("AnyOfValidator"); + keywordValidatorFiles.add("BooleanEnumValidator"); + keywordValidatorFiles.add("BooleanSchemaValidator"); + keywordValidatorFiles.add("BooleanValueMethod"); + keywordValidatorFiles.add("ConstValidator"); + keywordValidatorFiles.add("ContainsValidator"); + keywordValidatorFiles.add("BigDecimalValidator"); + keywordValidatorFiles.add("CustomIsoparser"); + keywordValidatorFiles.add("DefaultValueMethod"); + keywordValidatorFiles.add("DependentRequiredValidator"); + keywordValidatorFiles.add("DependentSchemasValidator"); + keywordValidatorFiles.add("DoubleEnumValidator"); + keywordValidatorFiles.add("DoubleValueMethod"); + keywordValidatorFiles.add("ElseValidator"); + keywordValidatorFiles.add("EnumValidator"); + keywordValidatorFiles.add("ExclusiveMaximumValidator"); + keywordValidatorFiles.add("ExclusiveMinimumValidator"); + keywordValidatorFiles.add("FloatEnumValidator"); + keywordValidatorFiles.add("FloatValueMethod"); + keywordValidatorFiles.add("FormatValidator"); + keywordValidatorFiles.add("FrozenList"); + keywordValidatorFiles.add("FrozenMap"); + keywordValidatorFiles.add("IfValidator"); + keywordValidatorFiles.add("IntegerEnumValidator"); + keywordValidatorFiles.add("IntegerValueMethod"); + keywordValidatorFiles.add("ItemsValidator"); + keywordValidatorFiles.add("JsonSchema"); + keywordValidatorFiles.add("JsonSchemaFactory"); + keywordValidatorFiles.add("JsonSchemaInfo"); + keywordValidatorFiles.add("KeywordEntry"); + keywordValidatorFiles.add("KeywordValidator"); + keywordValidatorFiles.add("LengthValidator"); + keywordValidatorFiles.add("ListSchemaValidator"); + keywordValidatorFiles.add("LongEnumValidator"); + keywordValidatorFiles.add("LongValueMethod"); + keywordValidatorFiles.add("MapSchemaValidator"); + keywordValidatorFiles.add("MapUtils"); + keywordValidatorFiles.add("MaxContainsValidator"); + keywordValidatorFiles.add("MaximumValidator"); + keywordValidatorFiles.add("MaxItemsValidator"); + keywordValidatorFiles.add("MaxLengthValidator"); + keywordValidatorFiles.add("MaxPropertiesValidator"); + keywordValidatorFiles.add("MinContainsValidator"); + keywordValidatorFiles.add("MinimumValidator"); + keywordValidatorFiles.add("MinItemsValidator"); + keywordValidatorFiles.add("MinLengthValidator"); + keywordValidatorFiles.add("MinPropertiesValidator"); + keywordValidatorFiles.add("MultipleOfValidator"); + keywordValidatorFiles.add("NotValidator"); + keywordValidatorFiles.add("NullEnumValidator"); + keywordValidatorFiles.add("NullSchemaValidator"); + keywordValidatorFiles.add("NullValueMethod"); + keywordValidatorFiles.add("NumberSchemaValidator"); + keywordValidatorFiles.add("OneOfValidator"); + keywordValidatorFiles.add("PathToSchemasMap"); + keywordValidatorFiles.add("PatternPropertiesValidator"); + keywordValidatorFiles.add("PatternValidator"); + keywordValidatorFiles.add("PrefixItemsValidator"); + keywordValidatorFiles.add("PropertiesValidator"); + keywordValidatorFiles.add("PropertyEntry"); + keywordValidatorFiles.add("PropertyNamesValidator"); + keywordValidatorFiles.add("RequiredValidator"); + keywordValidatorFiles.add("StringEnumValidator"); + keywordValidatorFiles.add("StringSchemaValidator"); + keywordValidatorFiles.add("StringValueMethod"); + keywordValidatorFiles.add("ThenValidator"); + keywordValidatorFiles.add("TypeValidator"); + keywordValidatorFiles.add("UnevaluatedItemsValidator"); + keywordValidatorFiles.add("UnevaluatedPropertiesValidator"); + keywordValidatorFiles.add("UniqueItemsValidator"); + keywordValidatorFiles.add("UnsetAnyTypeJsonSchema"); + keywordValidatorFiles.add("ValidationData"); + keywordValidatorFiles.add("ValidationMetadata"); + for (String keywordValidatorFile: keywordValidatorFiles) { + supportingFiles.add(new SupportingFile( + "src/main/kotlin/packagename/schemas/validation/"+keywordValidatorFile+".hbs", + packagePath() + File.separatorChar + "schemas" + File.separatorChar + "validation", + keywordValidatorFile + ".kt")); + } + // tests + List keywordValidatorTestFiles = new ArrayList<>(); + keywordValidatorTestFiles.add("AdditionalPropertiesValidatorTest"); + keywordValidatorTestFiles.add("CustomIsoparserTest"); + keywordValidatorTestFiles.add("FormatValidatorTest"); + keywordValidatorTestFiles.add("ItemsValidatorTest"); + keywordValidatorTestFiles.add("PropertiesValidatorTest"); + keywordValidatorTestFiles.add("RequiredValidatorTest"); + keywordValidatorTestFiles.add("TypeValidatorTest"); + keywordValidatorTestFiles.add("JsonSchemaTest"); + for (String keywordValidatorTestFile: keywordValidatorTestFiles) { + supportingFiles.add(new SupportingFile( + "src/test/kotlin/packagename/schemas/validation/"+keywordValidatorTestFile+".hbs", + testPackagePath() + File.separatorChar + "schemas" + File.separatorChar + "validation", + keywordValidatorTestFile + ".kt")); + } + + // exceptions + List exceptionClasses = new ArrayList<>(); + exceptionClasses.add("ApiException"); + exceptionClasses.add("BaseException"); + exceptionClasses.add("InvalidAdditionalPropertyException"); + exceptionClasses.add("NotImplementedException"); + exceptionClasses.add("UnsetPropertyException"); + exceptionClasses.add("ValidationException"); + for (String exceptionClass: exceptionClasses) { + supportingFiles.add(new SupportingFile( + "src/main/kotlin/packagename/exceptions/"+exceptionClass+".hbs", + packagePath() + File.separatorChar + "exceptions", + exceptionClass + ".kt")); + } + + + // configuration + supportingFiles.add(new SupportingFile( + "src/main/kotlin/packagename/configurations/JsonSchemaKeywordFlags.hbs", + packagePath() + File.separatorChar + "configurations", + "JsonSchemaKeywordFlags.kt")); + supportingFiles.add(new SupportingFile( + "src/test/kotlin/packagename/configurations/JsonSchemaKeywordFlagsTest.hbs", + testPackagePath() + File.separatorChar + "configurations", + "JsonSchemaKeywordFlagsTest.kt")); + supportingFiles.add(new SupportingFile( + "src/main/kotlin/packagename/configurations/SchemaConfiguration.hbs", + packagePath() + File.separatorChar + "configurations", + "SchemaConfiguration.kt")); + supportingFiles.add(new SupportingFile( + "src/main/kotlin/packagename/configurations/ApiConfiguration.hbs", + packagePath() + File.separatorChar + "configurations", + "ApiConfiguration.kt")); + // requestbody + supportingFiles.add(new SupportingFile( + "src/main/kotlin/packagename/requestbody/GenericRequestBody.hbs", + packagePath() + File.separatorChar + "requestbody", + "GenericRequestBody.kt")); + supportingFiles.add(new SupportingFile( + "src/main/kotlin/packagename/requestbody/RequestBodySerializer.hbs", + packagePath() + File.separatorChar + "requestbody", + "RequestBodySerializer.kt")); + supportingFiles.add(new SupportingFile( + "src/main/kotlin/packagename/requestbody/SerializedRequestBody.hbs", + packagePath() + File.separatorChar + "requestbody", + "SerializedRequestBody.kt")); + supportingFiles.add(new SupportingFile( + "src/test/kotlin/packagename/requestbody/RequestBodySerializerTest.hbs", + testPackagePath() + File.separatorChar + "requestbody", + "RequestBodySerializerTest.kt")); + // mediatype + supportingFiles.add(new SupportingFile( + "src/main/kotlin/packagename/mediatype/MediaType.hbs", + packagePath() + File.separatorChar + "mediatype", + "MediaType.kt")); + supportingFiles.add(new SupportingFile( + "src/main/kotlin/packagename/mediatype/Encoding.hbs", + packagePath() + File.separatorChar + "mediatype", + "Encoding.kt")); + // contenttype + supportingFiles.add(new SupportingFile( + "src/main/kotlin/packagename/contenttype/ContentTypeDetector.hbs", + packagePath() + File.separatorChar + "contenttype", + "ContentTypeDetector.kt")); + supportingFiles.add(new SupportingFile( + "src/main/kotlin/packagename/contenttype/ContentTypeSerializer.hbs", + packagePath() + File.separatorChar + "contenttype", + "ContentTypeSerializer.kt")); + supportingFiles.add(new SupportingFile( + "src/main/kotlin/packagename/contenttype/ContentTypeDeserializer.hbs", + packagePath() + File.separatorChar + "contenttype", + "ContentTypeDeserializer.kt")); + // header + supportingFiles.add(new SupportingFile( + "src/main/kotlin/packagename/header/Header.hbs", + packagePath() + File.separatorChar + "header", + "Header.kt")); + supportingFiles.add(new SupportingFile( + "src/main/kotlin/packagename/header/HeaderBase.hbs", + packagePath() + File.separatorChar + "header", + "HeaderBase.kt")); + supportingFiles.add(new SupportingFile( + "src/main/kotlin/packagename/header/SchemaHeader.hbs", + packagePath() + File.separatorChar + "header", + "SchemaHeader.kt")); + supportingFiles.add(new SupportingFile( + "src/main/kotlin/packagename/header/ContentHeader.hbs", + packagePath() + File.separatorChar + "header", + "ContentHeader.kt")); + supportingFiles.add(new SupportingFile( + "src/main/kotlin/packagename/header/StyleSerializer.hbs", + packagePath() + File.separatorChar + "header", + "StyleSerializer.kt")); + supportingFiles.add(new SupportingFile( + "src/main/kotlin/packagename/header/Rfc6570Serializer.hbs", + packagePath() + File.separatorChar + "header", + "Rfc6570Serializer.kt")); + supportingFiles.add(new SupportingFile( + "src/main/kotlin/packagename/header/PrefixSeparatorIterator.hbs", + packagePath() + File.separatorChar + "header", + "PrefixSeparatorIterator.kt")); + supportingFiles.add(new SupportingFile( + "src/test/kotlin/packagename/header/SchemaHeaderTest.hbs", + testPackagePath() + File.separatorChar + "header", + "SchemaHeaderTest.kt")); + supportingFiles.add(new SupportingFile( + "src/test/kotlin/packagename/header/ContentHeaderTest.hbs", + testPackagePath() + File.separatorChar + "header", + "ContentHeaderTest.kt")); + + // parameter + supportingFiles.add(new SupportingFile( + "src/main/kotlin/packagename/parameter/ContentParameter.hbs", + packagePath() + File.separatorChar + "parameter", + "ContentParameter.kt")); + supportingFiles.add(new SupportingFile( + "src/main/kotlin/packagename/parameter/CookieSerializer.hbs", + packagePath() + File.separatorChar + "parameter", + "CookieSerializer.kt")); + supportingFiles.add(new SupportingFile( + "src/main/kotlin/packagename/parameter/HeadersSerializer.hbs", + packagePath() + File.separatorChar + "parameter", + "HeadersSerializer.kt")); + supportingFiles.add(new SupportingFile( + "src/main/kotlin/packagename/parameter/Parameter.hbs", + packagePath() + File.separatorChar + "parameter", + "Parameter.kt")); + supportingFiles.add(new SupportingFile( + "src/main/kotlin/packagename/parameter/ParameterBase.hbs", + packagePath() + File.separatorChar + "parameter", + "ParameterBase.kt")); + supportingFiles.add(new SupportingFile( + "src/main/kotlin/packagename/parameter/ParameterInType.hbs", + packagePath() + File.separatorChar + "parameter", + "ParameterInType.kt")); + supportingFiles.add(new SupportingFile( + "src/main/kotlin/packagename/parameter/ParameterStyle.hbs", + packagePath() + File.separatorChar + "parameter", + "ParameterStyle.kt")); + supportingFiles.add(new SupportingFile( + "src/main/kotlin/packagename/parameter/PathSerializer.hbs", + packagePath() + File.separatorChar + "parameter", + "PathSerializer.kt")); + supportingFiles.add(new SupportingFile( + "src/main/kotlin/packagename/parameter/QuerySerializer.hbs", + packagePath() + File.separatorChar + "parameter", + "QuerySerializer.kt")); + supportingFiles.add(new SupportingFile( + "src/main/kotlin/packagename/parameter/SchemaParameter.hbs", + packagePath() + File.separatorChar + "parameter", + "SchemaParameter.kt")); + supportingFiles.add(new SupportingFile( + "src/test/kotlin/packagename/parameter/CookieSerializerTest.hbs", + testPackagePath() + File.separatorChar + "parameter", + "CookieSerializerTest.kt")); + supportingFiles.add(new SupportingFile( + "src/test/kotlin/packagename/parameter/HeadersSerializerTest.hbs", + testPackagePath() + File.separatorChar + "parameter", + "HeadersSerializerTest.kt")); + supportingFiles.add(new SupportingFile( + "src/test/kotlin/packagename/parameter/PathSerializerTest.hbs", + testPackagePath() + File.separatorChar + "parameter", + "PathSerializerTest.kt")); + supportingFiles.add(new SupportingFile( + "src/test/kotlin/packagename/parameter/QuerySerializerTest.hbs", + testPackagePath() + File.separatorChar + "parameter", + "QuerySerializerTest.kt")); + supportingFiles.add(new SupportingFile( + "src/test/kotlin/packagename/parameter/SchemaNonQueryParameterTest.hbs", + testPackagePath() + File.separatorChar + "parameter", + "SchemaNonQueryParameterTest.kt")); + supportingFiles.add(new SupportingFile( + "src/test/kotlin/packagename/parameter/SchemaQueryParameterTest.hbs", + testPackagePath() + File.separatorChar + "parameter", + "SchemaQueryParameterTest.kt")); + // apiclient + supportingFiles.add(new SupportingFile( + "src/main/kotlin/packagename/apiclient/ApiClient.hbs", + packagePath() + File.separatorChar + "apiclient", + "ApiClient.kt")); + // restclient + supportingFiles.add(new SupportingFile( + "src/main/kotlin/packagename/restclient/RestClient.hbs", + packagePath() + File.separatorChar + "restclient", + "RestClient.kt")); + + // response + supportingFiles.add(new SupportingFile( + "src/main/kotlin/packagename/response/ApiResponse.hbs", + packagePath() + File.separatorChar + "response", + "ApiResponse.kt")); + supportingFiles.add(new SupportingFile( + "src/main/kotlin/packagename/response/DeserializedHttpResponse.hbs", + packagePath() + File.separatorChar + "response", + "DeserializedHttpResponse.kt")); + supportingFiles.add(new SupportingFile( + "src/main/kotlin/packagename/response/HeadersDeserializer.hbs", + packagePath() + File.separatorChar + "response", + "HeadersDeserializer.kt")); + supportingFiles.add(new SupportingFile( + "src/main/kotlin/packagename/response/ResponseDeserializer.hbs", + packagePath() + File.separatorChar + "response", + "ResponseDeserializer.kt")); + supportingFiles.add(new SupportingFile( + "src/main/kotlin/packagename/response/ResponsesDeserializer.hbs", + packagePath() + File.separatorChar + "response", + "ResponsesDeserializer.kt")); + supportingFiles.add(new SupportingFile( + "src/test/kotlin/packagename/response/ResponseDeserializerTest.hbs", + testPackagePath() + File.separatorChar + "response", + "ResponseDeserializerTest.kt")); + + // jsonPaths + // requestbodies + jsonPathTemplateFiles.put( + CodegenConstants.JSON_PATH_LOCATION_TYPE.REQUEST_BODY, + new HashMap<>() {{ + put("src/main/kotlin/packagename/components/requestbodies/RequestBody.hbs", ".kt"); + }} + ); + jsonPathDocTemplateFiles.put( + CodegenConstants.JSON_PATH_LOCATION_TYPE.REQUEST_BODY, + new HashMap<>() {{ + put("src/main/kotlin/packagename/components/requestbodies/RequestBodyDoc.hbs", ".md"); + }} + ); + // header + jsonPathTemplateFiles.put( + CodegenConstants.JSON_PATH_LOCATION_TYPE.HEADER, + new HashMap<>() {{ + put("src/main/kotlin/packagename/components/headers/Header.hbs", ".kt"); + }} + ); + jsonPathDocTemplateFiles.put( + CodegenConstants.JSON_PATH_LOCATION_TYPE.HEADER, + new HashMap<>() {{ + put("src/main/kotlin/packagename/components/headers/HeaderDoc.hbs", ".md"); + }} + ); + // parameter + jsonPathTemplateFiles.put( + CodegenConstants.JSON_PATH_LOCATION_TYPE.PARAMETER, + new HashMap<>() {{ + put("src/main/kotlin/packagename/components/parameter/Parameter.hbs", ".kt"); + }} + ); + jsonPathTemplateFiles.put( + CodegenConstants.JSON_PATH_LOCATION_TYPE.PARAMETERS, + new HashMap<>() {{ + put("src/main/kotlin/packagename/paths/path/verb/Parameters.hbs", ".kt"); + }} + ); + jsonPathDocTemplateFiles.put( + CodegenConstants.JSON_PATH_LOCATION_TYPE.PARAMETER, + new HashMap<>() {{ + put("src/main/kotlin/packagename/components/parameter/ParameterDoc.hbs", ".md"); + }} + ); + // responses + jsonPathTemplateFiles.put( + CodegenConstants.JSON_PATH_LOCATION_TYPE.RESPONSE, + new HashMap<>() {{ + put("src/main/kotlin/packagename/components/responses/Response.hbs", ".kt"); + }} + ); + jsonPathTemplateFiles.put( + CodegenConstants.JSON_PATH_LOCATION_TYPE.RESPONSES, + new HashMap<>() {{ + put("src/main/kotlin/packagename/paths/path/verb/Responses.hbs", ".kt"); + }} + ); + jsonPathDocTemplateFiles.put( + CodegenConstants.JSON_PATH_LOCATION_TYPE.RESPONSES, + new HashMap<>() {{ + put("src/main/kotlin/packagename/paths/path/verb/ResponsesDoc.hbs", ".md"); + }} + ); + jsonPathDocTemplateFiles.put( + CodegenConstants.JSON_PATH_LOCATION_TYPE.RESPONSE, + new HashMap<>() {{ + put("src/main/kotlin/packagename/components/responses/ResponseDoc.hbs", ".md"); + }} + ); + jsonPathTemplateFiles.put( + CodegenConstants.JSON_PATH_LOCATION_TYPE.HEADERS, + new HashMap<>() {{ + put("src/main/kotlin/packagename/components/responses/HeadersDeserializer.hbs", ".kt"); + }} + ); + // operation + jsonPathTemplateFiles.put( + CodegenConstants.JSON_PATH_LOCATION_TYPE.OPERATION, + new HashMap<>() {{ + put("src/main/kotlin/packagename/paths/path/verb/Operation.hbs", ".kt"); + }} + ); + jsonPathDocTemplateFiles.put( + CodegenConstants.JSON_PATH_LOCATION_TYPE.OPERATION, + new HashMap<>() {{ + put("src/main/kotlin/packagename/paths/path/verb/OperationDoc.hbs", ".md"); + }} + ); + // path + jsonPathTemplateFiles.put( + CodegenConstants.JSON_PATH_LOCATION_TYPE.PATH, + new HashMap<>() {{ + put("src/main/kotlin/packagename/paths/path/PathItem.hbs", ".kt"); + }} + ); + // apis + jsonPathTemplateFiles.put( + CodegenConstants.JSON_PATH_LOCATION_TYPE.API_PATH, + new HashMap<>() {{ + put("src/main/kotlin/packagename/apis/paths/Api.hbs", ".kt"); + }} + ); + jsonPathDocTemplateFiles.put( + CodegenConstants.JSON_PATH_LOCATION_TYPE.API_PATH, + new HashMap<>() {{ + put("src/main/kotlin/packagename/apis/paths/ApiDoc.hbs", ".md"); + }} + ); + jsonPathTemplateFiles.put( + CodegenConstants.JSON_PATH_LOCATION_TYPE.API_TAG, + new HashMap<>() {{ + put("src/main/kotlin/packagename/apis/tags/Api.hbs", ".kt"); + }} + ); + jsonPathDocTemplateFiles.put( + CodegenConstants.JSON_PATH_LOCATION_TYPE.API_TAG, + new HashMap<>() {{ + put("src/main/kotlin/packagename/apis/tags/ApiDoc.hbs", ".md"); + }} + ); + + // schema + HashMap schemaTemplates = new HashMap<>(); + schemaTemplates.put("src/main/kotlin/packagename/components/schemas/Schema.hbs", ".kt"); + jsonPathTemplateFiles.put( + CodegenConstants.JSON_PATH_LOCATION_TYPE.SCHEMA, + schemaTemplates + ); + jsonPathDocTemplateFiles.put( + CodegenConstants.JSON_PATH_LOCATION_TYPE.SCHEMA, + new HashMap<>() {{ + put("src/main/kotlin/packagename/components/schemas/Schema_doc.hbs", ".md"); + }} + ); + + super.processOpts(); + + authFolder = (sourceFolder + '/' + invokerPackage + ".auth").replace(".", "/"); + } + + @Override + public void postProcessModelProperty(CodegenSchema model, CodegenSchema property) { + super.postProcessModelProperty(model, property); + } + + @Override + public Map postProcessSupportingFileData(Map data) { + generateYAMLSpecFile(data); + return super.postProcessSupportingFileData(data); + } + + @Override + public String toApiVarName(String name) { + String apiVarName = super.toApiVarName(name); + if (getGeneratorMetadata().getReservedWords().contains(apiVarName)) { + apiVarName = escapeReservedWord(apiVarName); + } + return apiVarName; + } + + @Override + public String defaultTemplatingEngine() { + return "handlebars"; + } + + @Override + public TemplatingEngineAdapter getTemplatingEngine() { + TemplatingEngineAdapter te = super.getTemplatingEngine(); + HandlebarsEngineAdapter hea = (HandlebarsEngineAdapter) te; + hea.infiniteLoops(true); + hea.setPrettyPrint(true); + return hea; + } + + @Override + public String toModelFilename(String name, String jsonPath) { + return toModelName(name, jsonPath); + } + + @Override + @SuppressWarnings("static-method") + public String sanitizeName(String name, String filterOutRegex) { + return name.replaceAll(filterOutRegex, ""); + } + + protected boolean isValid(String name) { + boolean isValid = super.isValid(name); + if (!isValid) { + return false; + } + return name.matches("^[a-zA-Z]\\w*$"); + } + + protected String getCamelCaseName(String key) { + String usedName = toEnumVarName(key, new StringSchema()); + if (!isValid(usedName)) { + usedName = "set_" + usedName; + } + usedName = camelize(usedName.toLowerCase(Locale.ROOT), true); + return usedName; + } + + @Override + public String escapeUnsafeCharacters(String value) { + // handles escape characters and the like + String stringValue = value; + String backslash = "\\"; + if (stringValue.contains(backslash)) { + stringValue = stringValue.replace(backslash, "\\\\"); + } + String nullChar = "\0"; + if (stringValue.contains(nullChar)) { + stringValue = stringValue.replace(nullChar, "\\0"); + } + String doubleQuoteChar = "\""; + if (stringValue.contains(doubleQuoteChar)) { + stringValue = stringValue.replace(doubleQuoteChar, "\\\""); + } + String lineSep = System.lineSeparator(); + if (stringValue.contains(lineSep)) { + stringValue = stringValue.replace(lineSep, "\\n"); + } + String carriageReturn = "\r"; + if (stringValue.contains(carriageReturn)) { + stringValue = stringValue.replace(carriageReturn, "\\r"); + } + String tab = "\t"; + if (stringValue.contains(tab)) { + stringValue = stringValue.replace(tab, "\\t"); + } + String formFeed = "\f"; + if (stringValue.contains(formFeed)) { + stringValue = stringValue.replace(formFeed, "\\f"); + } + return stringValue; + } + + private String getSchemaPascalCaseName(String name, @NotNull String sourceJsonPath, boolean useCache) { + String usedKey = escapeUnsafeCharacters(name); + usedKey = sanitizeName(usedKey, "[^a-zA-Z0-9_]+"); + /* + schemas named Schema can collide in: + response headers + operation: + HeaderParameters + PathParameters + QueryParameters + CookieParameter + To prevent that, those schemas are renamed + - component responses contain headers + - those headers are collected into a json object schema + - header schemas could also be refed + - so all header schemas must be named by their header name to prevent collisions + */ + String[] pathPieces = sourceJsonPath.split("/"); + + + String lastFragment = pathPieces[pathPieces.length-1]; + boolean operationParametersSchema = (sourceJsonPath.startsWith("#/paths/") && xParameters.contains(lastFragment) && xParameters.contains(name)); + boolean serverVariables = (lastFragment.equals("variables") && Set.of(4,6,7).contains(pathPieces.length) && name.equals("variables")); + if (sourceJsonPath.endsWith("/schema")) { + if (sourceJsonPath.startsWith("#/paths") && sourceJsonPath.contains("/parameters/")) { + if (pathPieces[3].equals("parameters")) { + // #/paths/path/parameters/0/Schema -> PathParamSchema0 + usedKey = "RouteParam" + camelize(usedKey) + pathPieces[4]; // RouteParamSchema0 + } else { + // #/paths/path/get/parameters/0/Schema -> Schema0 + usedKey = camelize(usedKey) + pathPieces[5]; // Schema0 + } + } else if ( + (sourceJsonPath.startsWith("#/paths") && sourceJsonPath.contains("/headers/")) || + sourceJsonPath.startsWith("#/components/headers/") || + (sourceJsonPath.startsWith("#/components/responses/") && sourceJsonPath.contains("/headers/")) + ) { + if (pathPieces[2].equals("headers")) { + // #/components/headers/someHeader/schema -> SomeHeaderSchema + String headerFragment = pathPieces[3]; + usedKey = camelize(headerFragment)+ camelize(usedKey); + } else if (sourceJsonPath.startsWith("#/components/responses/") && sourceJsonPath.contains("/headers/")) { + // #/components/responses/SomeResponse/headers/someHeader/schema + String headerFragment = pathPieces[5]; + usedKey = camelize(headerFragment) + camelize(usedKey); + } else { + // #/paths/path/verb/responses/SomeResponse/headers/someHeader/schema + String headerFragment = pathPieces[7]; + usedKey = camelize(headerFragment)+ camelize(usedKey); + } + } else if (pathPieces[pathPieces.length-3].equals("content")) { + // #/requestBodies/SomeRequestBody/content/application-json/schema + String contentTypeFragment = pathPieces[pathPieces.length-2]; + String prefix = ModelUtils.decodeSlashes(contentTypeFragment); + prefix = sanitizeName(prefix, "[^a-zA-Z0-9]+"); + prefix = camelize(prefix); + usedKey = prefix + camelize(usedKey); + } + } else if (sourceJsonPath.endsWith(headersSchemaFragment) && pathPieces[pathPieces.length-3].equals("responses")) { + // #/components/responses/SomeResponse/HeadersSchema + // #/paths/path/verb/responses/200/HeadersSchema + String responseJsonPath = String.join("/", Arrays.copyOfRange(pathPieces, 0, pathPieces.length-1)); + String responseFragment = pathPieces[pathPieces.length-2]; + String pascalCaseResponse = getPascalCase(CodegenKeyType.RESPONSE, responseFragment, responseJsonPath); + usedKey = pascalCaseResponse + camelize(usedKey); + } else if (operationParametersSchema) { + String prefix = getPathClassNamePrefix(sourceJsonPath); + usedKey = prefix + lastFragment; + } else if (serverVariables) { + if (pathPieces.length == 4) { + // #/servers/0/variables -> 4 + usedKey = "RootServer" + pathPieces[2] + "Variables"; + } else if (pathPieces.length == 6) { + // #/paths/somePath/servers/0/variables -> 6 + CodegenKey pathKey = getKey(ModelUtils.decodeSlashes(pathPieces[2]), "paths", sourceJsonPath); + usedKey = pathKey.pascalCase + "Server" + pathPieces[4] + "Variables"; + } else { + // #/paths/somePath/get/servers/0/variables -> 7 + String prefix = getPathClassNamePrefix(sourceJsonPath); + usedKey = prefix + "Server" + pathPieces[5] + "Variables"; + } + } + HashMap keyToQty = sourceJsonPathToKeyToQty.getOrDefault(sourceJsonPath, new HashMap<>()); + if (useCache) { + if (!sourceJsonPathToKeyToQty.containsKey(sourceJsonPath)) { + sourceJsonPathToKeyToQty.put(sourceJsonPath, keyToQty); + } + } + // starts with number + if (usedKey.matches("^\\d.*")) { + LOGGER.warn("{} (component name starts with number) cannot be used as name. Renamed to Schema{}", usedKey, usedKey); + usedKey = "Schema" + usedKey; // 200 -> Schema200 + } + + usedKey = camelize(usedKey); + + // handle case where usedKey is empty + if (usedKey.isEmpty()) { + // happens with a name like "/" + usedKey = camelize(toEnumVarName(name, null).toLowerCase(Locale.ROOT)); + } + + if (isReservedWord(usedKey)) { + usedKey = usedKey + "Schema"; // e.g. return => ReturnSchema + LOGGER.warn("{} (reserved word) cannot be used as name. Renamed to {}", name, usedKey); + } + + if (useCache) { + Integer qty = keyToQty.getOrDefault(usedKey, 0); + qty += 1; + keyToQty.put(usedKey, qty); + String suffix = ""; + if (qty > 1) { + int schemaNumber = qty-1; + suffix = Integer.toString(schemaNumber); + } + if (qty == 1 && sourceJsonPath.endsWith("/" + name)) { + schemaJsonPathToModelName.put(sourceJsonPath, usedKey); + } + usedKey = usedKey + suffix; + return usedKey; + } + return usedKey; + } + + protected CodegenKey getContainerJsonPathPiece(String expectedComponentType, String currentJsonPath, String sourceJsonPath) { + return getJsonPathPiece(expectedComponentType, currentJsonPath, sourceJsonPath); + } + + private static boolean isInteger(String str) { + if (str == null) { + return false; + } + int length = str.length(); + if (length == 0) { + return false; + } + int i = 0; + if (str.charAt(0) == '-') { + if (length == 1) { + return false; + } + i = 1; + } + for (; i < length; i++) { + char c = str.charAt(i); + if (c < '0' || c > '9') { + return false; + } + } + return true; + } + + private String toSchemaRefClass(String ref, String sourceJsonPath) { + int schemaSuffix = 1; + String[] refPieces = ref.split("/"); + if (ref.equals(sourceJsonPath)) { + // self reference, no import needed + if (ref.startsWith("#/components/schemas/") && refPieces.length == 4) { + return getFilename(CodegenKeyType.SCHEMA, refPieces[refPieces.length-1], ref)+schemaSuffix; + } + Set httpMethods = new HashSet<>(Arrays.asList("post", "put", "patch", "get", "delete", "trace", "options")); + boolean requestBodyCase = ( + refPieces.length == 8 && + refPieces[1].equals("paths") && + httpMethods.contains(refPieces[3]) && + refPieces[4].equals("requestBody") && + refPieces[5].equals("content") && + refPieces[7].equals("schema") + ); + if (requestBodyCase) { + String contentType = ModelUtils.decodeSlashes(refPieces[6]); + // the code knows that content-type are never valid python names + return toVarName(contentType); + } + return null; + } + if (sourceJsonPath != null && ref.startsWith(sourceJsonPath + "/")) { + // internal in-schema reference, no import needed + // TODO handle this in the future + if (getFilePath(GeneratedFileType.CODE, sourceJsonPath).equals(getFilePath(GeneratedFileType.CODE, ref))) { + // TODO ensure that getFilepath returns the same file for somePath/get/QueryParameters + // TODO ensure that getFilepath returns the same file for schemas/SomeSchema... + return null; + } + } + return getFilename(CodegenKeyType.SCHEMA, refPieces[refPieces.length-1], ref)+schemaSuffix; + } + + private String toRequestBodyRefClass(String ref) { + String[] refPieces = ref.split("/"); + if (ref.startsWith("#/components/requestBodies/") && refPieces.length == 4) { + return toModelName(refPieces[3], ref); + } + return null; + } + + private String toResponseRefClass(String ref) { + String[] refPieces = ref.split("/"); + if (ref.startsWith("#/components/responses/") && refPieces.length == 4) { + return toModelName(refPieces[3], ref); + } + return null; + } + + private String toHeaderRefClass(String ref) { + String[] refPieces = ref.split("/"); + if (ref.startsWith("#/components/headers/") && refPieces.length == 4) { + return toModelName(refPieces[3], ref); + } + return null; + } + + private String toParameterRefClass(String ref) { + String[] refPieces = ref.split("/"); + if (ref.startsWith("#/components/parameters/") && refPieces.length == 4) { + return toModelName(refPieces[3], ref); + } + return null; + } + + private String toSecuritySchemesRefClass(String ref) { + String[] refPieces = ref.split("/"); + if (ref.startsWith("#/components/securitySchemes/") && refPieces.length == 4) { + return toModelName(refPieces[3], ref); + } + return null; + } + + @Override + public String toRefClass(String ref, String sourceJsonPath, String expectedComponentType) { + if (ref == null) { + return null; + } + switch (expectedComponentType) { + case "schemas": + return toSchemaRefClass(ref, sourceJsonPath); + case "requestBodies": + return toRequestBodyRefClass(ref); + case "responses": + return toResponseRefClass(ref); + case "headers": + return toHeaderRefClass(ref); + case "parameters": + return toParameterRefClass(ref); + case "securitySchemes": + return toSecuritySchemesRefClass(ref); + } + return null; + } + + @Override + public String getRefModuleLocation(String ref) { + String filePath = getFilePath(GeneratedFileType.CODE, ref); + String prefix = generatorSettings.outputFolder + File.separatorChar + "src" + File.separatorChar + "main" + File.separatorChar + "kotlin" + File.separatorChar; + // modules are always in a package one above them, so strip off the last jsonPath fragment + String localFilepath = filePath.substring(prefix.length(), filePath.lastIndexOf(File.separatorChar)); + return localFilepath.replaceAll(String.valueOf(File.separatorChar), "."); + } + + @Override + protected boolean needToImport(String type) { + return true; + } + + private Set getDeeperImports(String sourceJsonPath, CodegenSchema schema) { + /* + When a map or list schema contains custom items or properties/additionalProperties + Those output types describe List or Map input types, which may be refs + All of those refs are referenced and Kotlin types are needed because they are defined in inputs + */ + Set imports = new HashSet<>(); + if (schema.jsonPath != null && schema.jsonPath.equals(sourceJsonPath)) { + return imports; + } + if (schema.refInfo != null && schema.refInfo.refModule != null) { + CodegenSchema ref = schema.refInfo.ref; + if (deepestRefSchemaImportNeeded) { + CodegenRefInfo deepestRefInfo = schema.refInfo; + while (deepestRefInfo.ref.refInfo != null) { + deepestRefInfo = deepestRefInfo.ref.refInfo; + } + imports.addAll(getDeeperImports(sourceJsonPath, deepestRefInfo.ref)); + } else { + imports.addAll(getDeeperImports(sourceJsonPath, ref)); + } + // todo remove this when 3.1.0 ref + types is supported + return imports; + } + if (schema.types != null) { + if (schema.types.contains("array")) { + imports.add("import java.util.List;"); + imports.add("import "+ generatorSettings.packageName + ".schemas.validation.FrozenList;"); + if (schema.items != null) { + imports.addAll(getDeeperImports(sourceJsonPath, schema.items)); + } + } + if (schema.types.contains("object")) { + imports.add("import java.util.Map;"); + imports.add("import "+ generatorSettings.packageName + ".schemas.validation.FrozenMap;"); + if (schema.mapValueSchema != null) { + imports.addAll(getDeeperImports(sourceJsonPath, schema.mapValueSchema)); + } + } + } else { + imports.add("import java.util.List;"); + imports.add("import java.util.Map;"); + } + return imports; + } + + @Override + public Set getImports(String sourceJsonPath, CodegenSchema schema, FeatureSet featureSet) { + Set imports = new HashSet<>(); + // Note: discriminator imports do not need to be added for Kotlin + // because they are in the package namespace in components.schemas + if (schema.allOf != null || schema.anyOf != null || schema.oneOf != null || schema.not != null) { + List allOfs = Collections.emptyList(); + List oneOfs = Collections.emptyList(); + List anyOfs = Collections.emptyList(); + List notSchemas = Collections.emptyList(); + if (schema.allOf != null && featureSet.getSchemaSupportFeatures().contains(SchemaFeature.AllOf)) { + allOfs = schema.allOf; + } + if (schema.oneOf != null && featureSet.getSchemaSupportFeatures().contains(SchemaFeature.OneOf)) { + oneOfs = schema.oneOf; + } + if (schema.anyOf != null && featureSet.getSchemaSupportFeatures().contains(SchemaFeature.AnyOf)) { + anyOfs = schema.anyOf; + } + if (schema.not != null && featureSet.getSchemaSupportFeatures().contains(SchemaFeature.Not)) { + notSchemas = Collections.singletonList(schema.not); + } + Stream allSchemas = Stream.of( + allOfs.stream(), anyOfs.stream(), oneOfs.stream(), notSchemas.stream()).flatMap(i -> i); + for (CodegenSchema cs: allSchemas.collect(Collectors.toList())) { + imports.addAll(getImports(sourceJsonPath, cs, featureSet)); + } + } + // items can exist for AnyType and type array + if (schema.items != null && schema.types != null && schema.types.contains("array")) { + imports.addAll(getImports(sourceJsonPath, schema.items, featureSet)); + } + // additionalProperties can exist for AnyType and type object + if (schema.additionalProperties != null) { + imports.addAll(getImports(sourceJsonPath, schema.additionalProperties, featureSet)); + } + // vars can exist for AnyType and type object + if (schema.properties != null && !schema.properties.isEmpty()) { + for (CodegenSchema cs: schema.properties.values()) { + imports.addAll(getImports(sourceJsonPath, cs, featureSet)); + } + } + if (schema.patternProperties != null && !schema.patternProperties.isEmpty()) { + for (CodegenSchema cs: schema.patternProperties.values()) { + imports.addAll(getImports(sourceJsonPath, cs, featureSet)); + } + } + if (schema.dependentSchemas != null && !schema.dependentSchemas.isEmpty()) { + for (CodegenSchema cs: schema.dependentSchemas.values()) { + imports.addAll(getImports(sourceJsonPath, cs, featureSet)); + } + } + if (schema.unevaluatedItems != null) { + imports.addAll(getImports(sourceJsonPath, schema.unevaluatedItems, featureSet)); + } + if (schema.if_ != null) { + imports.addAll(getImports(sourceJsonPath, schema.if_, featureSet)); + } + if (schema.then != null) { + imports.addAll(getImports(sourceJsonPath, schema.then, featureSet)); + } + if (schema.else_ != null) { + imports.addAll(getImports(sourceJsonPath, schema.else_, featureSet)); + } + if (schema.contains != null) { + imports.addAll(getImports(sourceJsonPath, schema.contains, featureSet)); + } + if (schema.unevaluatedProperties != null) { + imports.addAll(getImports(sourceJsonPath, schema.unevaluatedProperties, featureSet)); + } + if (schema.propertyNames != null) { + imports.addAll(getImports(sourceJsonPath, schema.propertyNames, featureSet)); + } + if (schema.prefixItems != null && !schema.prefixItems.isEmpty()) { + for (CodegenSchema cs: schema.prefixItems) { + imports.addAll(getImports(sourceJsonPath, cs, featureSet)); + } + } + // referenced or inline schemas + if (!sourceJsonPath.startsWith("#/components/schemas/") && schema.refInfo != null && schema.refInfo.refModule != null && featureSet.getSchemaSupportFeatures().contains(SchemaFeature.Ref)) { + imports.add(getImport(schema.refInfo)); + CodegenSchema ref = schema.refInfo.ref; + if (ref.refInfo != null && schema.refInfo.refModule != null && deepestRefSchemaImportNeeded) { + CodegenRefInfo deepestRefInfo = schema.refInfo; + while (deepestRefInfo.ref.refInfo != null) { + deepestRefInfo = deepestRefInfo.ref.refInfo; + } + imports.add(getImport(deepestRefInfo)); + } + } + if (schema.refInfo != null) { + // todo remove this when ref is supported with adjacent properties + imports.add("import org.checkerframework.checker.nullness.qual.Nullable;"); + return imports; + } + if (schema.types != null) { + if (schema.types.size() == 1) { + if (schema.types.contains("boolean")) { + if (schema.isSimpleBoolean()) { + imports.add("import "+ generatorSettings.packageName + ".schemas.BooleanJsonSchema;"); + imports.add("import org.checkerframework.checker.nullness.qual.Nullable;"); + } else { + addCustomSchemaImports(imports, schema); + imports.add("import java.util.Set;"); + addBooleanSchemaImports(imports, schema); + } + } else if (schema.types.contains("null")) { + if (schema.isSimpleNull()) { + imports.add("import "+generatorSettings.packageName + ".schemas.NullJsonSchema;"); + imports.add("import org.checkerframework.checker.nullness.qual.Nullable;"); + } else { + addCustomSchemaImports(imports, schema); + imports.add("import java.util.Set;"); + addNullSchemaImports(imports, schema); + } + } else if (schema.types.contains("integer")) { + if (schema.isSimpleInteger()) { + imports.add("import org.checkerframework.checker.nullness.qual.Nullable;"); + if (schema.format == null || schema.format.equals("int")) { + imports.add("import "+generatorSettings.packageName + ".schemas.IntJsonSchema;"); + } else if (schema.format.equals("int32")) { + imports.add("import "+generatorSettings.packageName + ".schemas.Int32JsonSchema;"); + } else if (schema.format.equals("int64")) { + imports.add("import "+generatorSettings.packageName + ".schemas.Int64JsonSchema;"); + } + } else { + addCustomSchemaImports(imports, schema); + imports.add("import java.util.Set;"); + addNumberSchemaImports(imports, schema); + } + } else if (schema.types.contains("number")) { + if (schema.isSimpleNumber()) { + imports.add("import org.checkerframework.checker.nullness.qual.Nullable;"); + if (schema.format == null) { + imports.add("import "+generatorSettings.packageName + ".schemas.NumberJsonSchema;"); + } else if (schema.format.equals("int32")) { + imports.add("import "+generatorSettings.packageName + ".schemas.Int32JsonSchema;"); + } else if (schema.format.equals("int64")) { + imports.add("import "+generatorSettings.packageName + ".schemas.Int64JsonSchema;"); + } else if (schema.format.equals("float")) { + imports.add("import "+generatorSettings.packageName + ".schemas.FloatJsonSchema;"); + } else if (schema.format.equals("double")) { + imports.add("import "+generatorSettings.packageName + ".schemas.DoubleJsonSchema;"); + } + } else { + addCustomSchemaImports(imports, schema); + imports.add("import java.util.Set;"); + addNumberSchemaImports(imports, schema); + } + } else if (schema.types.contains("string")) { + if (schema.isSimpleString()) { + imports.add("import org.checkerframework.checker.nullness.qual.Nullable;"); + if (schema.format == null) { + imports.add("import "+generatorSettings.packageName + ".schemas.StringJsonSchema;"); + } else if (schema.format.equals("date")) { + imports.add("import "+generatorSettings.packageName + ".schemas.DateJsonSchema;"); + } else if (schema.format.equals("date-time")) { + imports.add("import "+generatorSettings.packageName + ".schemas.DateTimeJsonSchema;"); + } else if (schema.format.equals("number")) { + imports.add("import "+generatorSettings.packageName + ".schemas.DecimalJsonSchema;"); + } else if (schema.format.equals("uuid")) { + imports.add("import "+generatorSettings.packageName + ".schemas.UuidJsonSchema;"); + } else if (schema.format.equals("byte")) { + // todo implement this + imports.add("import "+generatorSettings.packageName + ".schemas.StringJsonSchema;"); + } else if (schema.format.equals("binary")) { + // todo implement this + imports.add("import "+generatorSettings.packageName + ".schemas.StringJsonSchema;"); + } + } else { + addCustomSchemaImports(imports, schema); + imports.add("import java.util.Set;"); + addStringSchemaImports(imports, schema); + } + } else if (schema.types.contains("object")) { + if (schema.isSimpleObject()) { + imports.add("import org.checkerframework.checker.nullness.qual.Nullable;"); + imports.add("import "+generatorSettings.packageName + ".schemas.MapJsonSchema;"); + // add this in case the 1 higher schema is an array of FrozenMap + imports.add("import "+generatorSettings.packageName + ".schemas.validation.FrozenMap;"); + } else { + addCustomSchemaImports(imports, schema); + imports.add("import java.util.Set;"); + addMapSchemaImports(imports, schema); + if (schema.mapValueSchema != null) { + imports.addAll(getDeeperImports(sourceJsonPath, schema.mapValueSchema)); + } + } + } else if (schema.types.contains("array")) { + if (schema.isSimpleArray()) { + imports.add("import org.checkerframework.checker.nullness.qual.Nullable;"); + imports.add("import "+generatorSettings.packageName + ".schemas.ListJsonSchema;"); + // add this in case the 1 higher schema is a map of FrozenList + imports.add("import "+generatorSettings.packageName + ".schemas.validation.FrozenList;"); + } else { + addCustomSchemaImports(imports, schema); + imports.add("import java.util.Set;"); + addListSchemaImports(imports, schema); + if (schema.items != null) { + imports.addAll(getDeeperImports(sourceJsonPath, schema.items)); + } + } + } + } else if (schema.types.size() > 1) { + addCustomSchemaImports(imports, schema); + imports.add("import java.util.Set;"); + if (schema.types.contains("string")) { + addStringSchemaImports(imports, schema); + } + if (schema.types.contains("array")) { + addListSchemaImports(imports, schema); + } + if (schema.types.contains("object")) { + addMapSchemaImports(imports, schema); + } + if (schema.types.contains("number") || schema.types.contains("integer")) { + addNumberSchemaImports(imports, schema); + } + if (schema.types.contains("boolean")) { + addBooleanSchemaImports(imports, schema); + } + if (schema.types.contains("null")) { + addNullSchemaImports(imports, schema); + } + if (schema.mapValueSchema != null) { + imports.addAll(getDeeperImports(sourceJsonPath, schema.mapValueSchema)); + } + if (schema.items != null) { + imports.addAll(getDeeperImports(sourceJsonPath, schema.items)); + } + } + } else { + // no types + if (schema.isBooleanSchemaTrue) { + imports.add("import org.checkerframework.checker.nullness.qual.Nullable;"); + imports.add("import "+generatorSettings.packageName + ".schemas.AnyTypeJsonSchema;"); + } else if (schema.isBooleanSchemaFalse) { + imports.add("import org.checkerframework.checker.nullness.qual.Nullable;"); + imports.add("import "+generatorSettings.packageName + ".schemas.NotAnyTypeJsonSchema;"); + } else if (schema.isSimpleAnyType()) { + imports.add("import org.checkerframework.checker.nullness.qual.Nullable;"); + imports.add("import "+generatorSettings.packageName + ".schemas.AnyTypeJsonSchema;"); + // in case higher schema is ListBuilder add List + Map + } else { + addCustomSchemaImports(imports, schema); + imports.add("import java.time.LocalDate;"); + imports.add("import java.time.ZonedDateTime;"); + imports.add("import java.util.UUID;"); + imports.add("import "+generatorSettings.packageName + ".schemas.validation.FrozenList;"); + imports.add("import java.util.List;"); + imports.add("import "+generatorSettings.packageName + ".schemas.validation.FrozenMap;"); + imports.add("import java.util.Map;"); + imports.add("import "+generatorSettings.packageName + ".schemas.validation.NullSchemaValidator;"); + imports.add("import "+generatorSettings.packageName + ".schemas.validation.BooleanSchemaValidator;"); + imports.add("import "+generatorSettings.packageName + ".schemas.validation.NumberSchemaValidator;"); + imports.add("import "+generatorSettings.packageName + ".schemas.validation.StringSchemaValidator;"); + imports.add("import "+generatorSettings.packageName + ".schemas.validation.ListSchemaValidator;"); + imports.add("import "+generatorSettings.packageName + ".schemas.validation.MapSchemaValidator;"); + imports.add("import java.util.LinkedHashMap;"); + imports.add("import java.util.ArrayList;"); // for validate + addPropertiesImports(schema, imports); + addRequiredValidator(schema, imports); + addAllOfValidator(schema, imports); + addAnyOfValidator(schema, imports); + addOneOfValidator(schema, imports); + addEnumValidator(schema, imports); + addConstImports(schema, imports); + addPatternValidator(schema, imports); + addMultipleOfValidator(schema, imports); + addAdditionalPropertiesImports(schema, imports); + addDefaultValueImport(schema, imports); + addDependentRequiredImports(schema, imports); + addDependentSchemasImports(schema, imports); + addPatternPropertiesImports(schema, imports); + if (schema.mapValueSchema != null) { + imports.addAll(getDeeperImports(sourceJsonPath, schema.mapValueSchema)); + } + if (schema.items != null) { + imports.addAll(getDeeperImports(sourceJsonPath, schema.items)); + } + if (schema.additionalProperties == null || !schema.additionalProperties.isBooleanSchemaFalse) { + imports.add("import "+generatorSettings.packageName + ".exceptions.UnsetPropertyException;"); + imports.add("import "+generatorSettings.packageName + ".exceptions.InvalidAdditionalPropertyException;"); + } + } + } + return imports; + } + + private void addPatternValidator(CodegenSchema schema, Set imports) { + if (schema.patternInfo != null) { + imports.add("import java.util.regex.Pattern;"); + } + } + + private void addDefaultValueImport(CodegenSchema schema, Set imports) { + if (schema.defaultValue != null) { + imports.add("import "+generatorSettings.packageName + ".schemas.validation.DefaultValueMethod;"); + } + } + + + private void addEnumValidator(CodegenSchema schema, Set imports) { + if (schema.enumInfo != null) { + imports.add("import "+generatorSettings.packageName + ".schemas.SetMaker;"); + if (schema.enumInfo.typeToValues.containsKey("null")) { + imports.add("import "+generatorSettings.packageName + ".schemas.validation.NullEnumValidator;"); + imports.add("import "+generatorSettings.packageName + ".schemas.validation.NullValueMethod;"); + } + if (schema.enumInfo.typeToValues.containsKey("boolean")) { + imports.add("import "+generatorSettings.packageName + ".schemas.validation.BooleanEnumValidator;"); + imports.add("import "+generatorSettings.packageName + ".schemas.validation.BooleanValueMethod;"); + } + if (schema.enumInfo.typeToValues.containsKey("string")) { + imports.add("import "+generatorSettings.packageName + ".schemas.validation.StringEnumValidator;"); + imports.add("import "+generatorSettings.packageName + ".schemas.validation.StringValueMethod;"); + } + if (schema.enumInfo.typeToValues.containsKey("Integer")) { + imports.add("import java.math.BigDecimal;"); + imports.add("import "+generatorSettings.packageName + ".schemas.validation.IntegerEnumValidator;"); + imports.add("import "+generatorSettings.packageName + ".schemas.validation.IntegerValueMethod;"); + } + if (schema.enumInfo.typeToValues.containsKey("Long")) { + imports.add("import java.math.BigDecimal;"); + imports.add("import "+generatorSettings.packageName + ".schemas.validation.LongEnumValidator;"); + imports.add("import "+generatorSettings.packageName + ".schemas.validation.LongValueMethod;"); + } + if (schema.enumInfo.typeToValues.containsKey("Float")) { + imports.add("import java.math.BigDecimal;"); + imports.add("import "+generatorSettings.packageName + ".schemas.validation.FloatEnumValidator;"); + imports.add("import "+generatorSettings.packageName + ".schemas.validation.FloatValueMethod;"); + } + if (schema.enumInfo.typeToValues.containsKey("Double")) { + imports.add("import java.math.BigDecimal;"); + imports.add("import "+generatorSettings.packageName + ".schemas.validation.DoubleEnumValidator;"); + imports.add("import "+generatorSettings.packageName + ".schemas.validation.DoubleValueMethod;"); + } + } + } + + private void addConstImports(CodegenSchema schema, Set imports) { + if (schema.constInfo != null) { + if (schema.constInfo.typeToValues.containsKey("null")) { + imports.add("import "+generatorSettings.packageName + ".schemas.validation.NullEnumValidator;"); + imports.add("import "+generatorSettings.packageName + ".schemas.validation.NullValueMethod;"); + } + if (schema.constInfo.typeToValues.containsKey("boolean")) { + imports.add("import "+generatorSettings.packageName + ".schemas.validation.BooleanEnumValidator;"); + imports.add("import "+generatorSettings.packageName + ".schemas.validation.BooleanValueMethod;"); + } + if (schema.constInfo.typeToValues.containsKey("string")) { + imports.add("import "+generatorSettings.packageName + ".schemas.validation.StringEnumValidator;"); + imports.add("import "+generatorSettings.packageName + ".schemas.validation.StringValueMethod;"); + } + if (schema.constInfo.typeToValues.containsKey("Integer")) { + imports.add("import java.math.BigDecimal;"); + imports.add("import "+generatorSettings.packageName + ".schemas.validation.IntegerEnumValidator;"); + imports.add("import "+generatorSettings.packageName + ".schemas.validation.IntegerValueMethod;"); + } + if (schema.constInfo.typeToValues.containsKey("Long")) { + imports.add("import java.math.BigDecimal;"); + imports.add("import "+generatorSettings.packageName + ".schemas.validation.LongEnumValidator;"); + imports.add("import "+generatorSettings.packageName + ".schemas.validation.LongValueMethod;"); + } + if (schema.constInfo.typeToValues.containsKey("Float")) { + imports.add("import java.math.BigDecimal;"); + imports.add("import "+generatorSettings.packageName + ".schemas.validation.FloatEnumValidator;"); + imports.add("import "+generatorSettings.packageName + ".schemas.validation.FloatValueMethod;"); + } + if (schema.constInfo.typeToValues.containsKey("Double")) { + imports.add("import java.math.BigDecimal;"); + imports.add("import "+generatorSettings.packageName + ".schemas.validation.DoubleEnumValidator;"); + imports.add("import "+generatorSettings.packageName + ".schemas.validation.DoubleValueMethod;"); + } + } + } + + private void addPropertiesImports(CodegenSchema schema, Set imports) { + if (schema.properties != null) { + imports.add("import " + generatorSettings.packageName + ".schemas.validation.PropertyEntry;"); + imports.add("import java.util.Map;"); + imports.add("import java.util.Set;"); + imports.add("import " + generatorSettings.packageName + ".exceptions.UnsetPropertyException;"); + imports.add("import " + generatorSettings.packageName + ".schemas.GenericBuilder;"); + } + } + + private void addPatternPropertiesImports(CodegenSchema schema, Set imports) { + if (schema.patternProperties != null) { + imports.add("import java.util.AbstractMap;"); + imports.add("import java.util.Map;"); + imports.add("import java.util.regex.Pattern;"); + } + } + + private void addDependentSchemasImports(CodegenSchema schema, Set imports) { + if (schema.dependentSchemas != null) { + imports.add("import " + generatorSettings.packageName + ".schemas.validation.PropertyEntry;"); + imports.add("import java.util.Map;"); + } + } + + private void addDependentRequiredImports(CodegenSchema schema, Set imports) { + if (schema.dependentRequired != null) { + imports.add("import "+generatorSettings.packageName + ".schemas.validation.MapUtils;"); + imports.add("import java.util.AbstractMap;"); + imports.add("import "+generatorSettings.packageName + ".schemas.SetMaker;"); + } + } + + private void addAllOfValidator(CodegenSchema schema, Set imports) { + if (schema.allOf != null) { + imports.add("import java.util.List;"); + } + } + + private void addAnyOfValidator(CodegenSchema schema, Set imports) { + if (schema.anyOf != null) { + imports.add("import java.util.List;"); + } + } + + private void addOneOfValidator(CodegenSchema schema, Set imports) { + if (schema.oneOf != null) { + imports.add("import java.util.List;"); + } + } + + private void addAdditionalPropertiesImports(CodegenSchema schema, Set imports) { + if (schema.additionalProperties == null || !schema.additionalProperties.isBooleanSchemaFalse) { + imports.add("import "+generatorSettings.packageName + ".exceptions.UnsetPropertyException;"); + imports.add("import "+generatorSettings.packageName + ".exceptions.InvalidAdditionalPropertyException;"); + } + if (schema.additionalProperties != null) { + imports.add("import "+generatorSettings.packageName + ".schemas.GenericBuilder;"); + imports.add("import "+generatorSettings.packageName + ".schemas.validation.MapUtils;"); + } else { + imports.add("import "+generatorSettings.packageName + ".schemas.UnsetAddPropsSetter;"); + } + } + + + private void addRequiredValidator(CodegenSchema schema, Set imports) { + if (schema.requiredProperties != null) { + imports.add("import java.util.Set;"); + imports.add("import "+generatorSettings.packageName + ".schemas.GenericBuilder;"); + } + } + + private void addMultipleOfValidator(CodegenSchema schema, Set imports) { + if (schema.multipleOf != null) { + imports.add("import java.math.BigDecimal;"); + } + } + + private void addCustomSchemaImports(Set imports, CodegenSchema schema) { + imports.add("import " + generatorSettings.packageName + ".schemas.validation.JsonSchema;"); + imports.add("import " + generatorSettings.packageName + ".schemas.validation.JsonSchemaInfo;"); + imports.add("import "+generatorSettings.packageName + ".configurations.SchemaConfiguration;"); + imports.add("import "+generatorSettings.packageName + ".exceptions.ValidationException;"); + imports.add("import java.util.Set;"); // for validate + imports.add("import java.util.HashSet;"); // for validate + imports.add("import java.util.Objects;"); // for validate + imports.add("import java.util.LinkedHashSet;"); // for validate + imports.add("import java.util.List;"); // for castToAllowedTypes + imports.add("import "+generatorSettings.packageName + ".schemas.validation.PathToSchemasMap;"); // for getNewInstance + imports.add("import "+generatorSettings.packageName + ".schemas.validation.ValidationMetadata;"); // for getNewInstance + imports.add("import "+generatorSettings.packageName + ".configurations.JsonSchemaKeywordFlags;"); // for getNewInstance + imports.add("import org.checkerframework.checker.nullness.qual.Nullable;"); + } + + private void addBooleanSchemaImports(Set imports, CodegenSchema schema) { + imports.add("import " + generatorSettings.packageName + ".schemas.validation.BooleanSchemaValidator;"); + addAllOfValidator(schema, imports); + addAnyOfValidator(schema, imports); + addOneOfValidator(schema, imports); + addEnumValidator(schema, imports); + addDefaultValueImport(schema, imports); + addConstImports(schema, imports); + } + + private void addNullSchemaImports(Set imports, CodegenSchema schema) { + imports.add("import " + generatorSettings.packageName + ".schemas.validation.NullSchemaValidator;"); + addAllOfValidator(schema, imports); + addAnyOfValidator(schema, imports); + addOneOfValidator(schema, imports); + addEnumValidator(schema, imports); + addDefaultValueImport(schema, imports); + addConstImports(schema, imports); + } + + private void addMapSchemaImports(Set imports, CodegenSchema schema) { + imports.add("import " + generatorSettings.packageName + ".schemas.validation.MapSchemaValidator;"); + imports.add("import "+generatorSettings.packageName + ".schemas.validation.FrozenMap;"); + imports.add("import java.util.Map;"); + imports.add("import java.util.ArrayList;"); // for castToAllowedTypes + imports.add("import java.util.LinkedHashMap;"); + addRequiredValidator(schema, imports); + addPropertiesImports(schema, imports); + addAllOfValidator(schema, imports); + addAnyOfValidator(schema, imports); + addOneOfValidator(schema, imports); + addAdditionalPropertiesImports(schema, imports); + addDependentRequiredImports(schema, imports); + addDependentSchemasImports(schema, imports); + addPatternPropertiesImports(schema, imports); + } + + private void addListSchemaImports(Set imports, CodegenSchema schema) { + imports.add("import " + generatorSettings.packageName + ".schemas.validation.ListSchemaValidator;"); + imports.add("import "+generatorSettings.packageName + ".schemas.validation.FrozenList;"); + imports.add("import java.util.List;"); + imports.add("import java.util.ArrayList;"); // for castToAllowedTypes + imports.add("import java.util.LinkedHashMap;"); + addAllOfValidator(schema, imports); + addAnyOfValidator(schema, imports); + addOneOfValidator(schema, imports); + } + + private void addNumberSchemaImports(Set imports, CodegenSchema schema) { + imports.add("import " + generatorSettings.packageName + ".schemas.validation.NumberSchemaValidator;"); + addAllOfValidator(schema, imports); + addAnyOfValidator(schema, imports); + addOneOfValidator(schema, imports); + addEnumValidator(schema, imports); + addMultipleOfValidator(schema, imports); + addDefaultValueImport(schema, imports); + addConstImports(schema, imports); + } + + private void addStringSchemaImports(Set imports, CodegenSchema schema) { + if (schema.format != null) { + switch (schema.format) { + case "date": + imports.add("import java.time.LocalDate;"); + break; + case "date-time": + imports.add("import java.time.ZonedDateTime;"); + break; + case "uuid": + imports.add("import java.util.UUID;"); + break; + } + } + imports.add("import " + generatorSettings.packageName + ".schemas.validation.StringSchemaValidator;"); + addAllOfValidator(schema, imports); + addAnyOfValidator(schema, imports); + addOneOfValidator(schema, imports); + addEnumValidator(schema, imports); + addPatternValidator(schema, imports); + addDefaultValueImport(schema, imports); + addConstImports(schema, imports); + } + + + @Override + public String getImport(CodegenRefInfo refInfo) { + String prefix = "import " + generatorSettings.packageName + ".components."; + if (refInfo.ref instanceof CodegenSchema) { + if (refInfo.refModuleAlias == null) { + return "import " + refInfo.refModuleLocation + "." + refInfo.refModule + ";"; + } else { + return "import " + refInfo.refModuleLocation + " import " + refInfo.refModule + " as " + refInfo.refModuleAlias + ";"; + } + } else if (refInfo.ref instanceof CodegenRequestBody) { + return prefix + "requestbodies." + refInfo.refModule + ";"; + } else if (refInfo.ref instanceof CodegenHeader) { + return prefix + "headers." + refInfo.refModule + ";"; + } else if (refInfo.ref instanceof CodegenResponse) { + return prefix + "responses." + refInfo.refModule + ";"; + } else if (refInfo.ref instanceof CodegenParameter) { + return prefix + "parameters." + refInfo.refModule + ";"; + } else if (refInfo.ref instanceof CodegenSecurityScheme) { + return prefix + "securityschemes." + refInfo.refModule + ";"; + } + return null; + } + + protected String getModuleLocation(String ref) { + String filePath = getFilePath(GeneratedFileType.CODE, ref); + String prefix = generatorSettings.outputFolder + File.separatorChar + "src" + File.separatorChar + "main" + File.separatorChar + "kotlin" + File.separatorChar; + String localFilepath = filePath.substring(prefix.length()); + return localFilepath.replaceAll(String.valueOf(File.separatorChar), "."); + } + + @Override + public String getFilePath(GeneratedFileType type, String jsonPath) { + if (type != GeneratedFileType.TEST) { + return super.getFilePath(type, jsonPath); + } + String[] pathPieces = jsonPath.split("/"); + pathPieces[0] = generatorSettings.outputFolder + File.separatorChar + testPackagePath(); + if (jsonPath.startsWith("#/components")) { + // #/components/schemas/someSchema + updateComponentsFilepath(pathPieces); + if (pathPieces.length == 4) { + int lastIndex = pathPieces.length - 1; + pathPieces[lastIndex] = pathPieces[lastIndex] + "Test"; + } + } + List finalPathPieces = Arrays.stream(pathPieces) + .filter(Objects::nonNull) + .collect(Collectors.toList()); + return String.join(File.separator, finalPathPieces); + } + + /** + * Return the sanitized variable name for enum + * + * @param value enum variable name + * @param prop property + * @return the sanitized variable name for enum + */ + @Override + public String toEnumVarName(String value, Schema prop) { + // our enum var names are keys in a python dict, so change spaces to underscores + if (value.isEmpty()) { + return "EMPTY"; + } + if (value.equals("null")) { + return "NONE"; + } + + // value is int or float + String intPattern = "^[-+]?\\d+$"; + String floatPattern = "^[-+]?\\d+\\.\\d+$"; + Boolean intMatch = Pattern.matches(intPattern, value); + Boolean floatMatch = Pattern.matches(floatPattern, value); + if (intMatch || floatMatch) { + String plusSign = "^\\+.+"; + String negSign = "^-.+"; + String enumVarName; + if (Pattern.matches(plusSign, value)) { + enumVarName = value.replace("+", "POSITIVE_"); + } else if (Pattern.matches(negSign, value)) { + enumVarName = value.replace("-", "NEGATIVE_"); + } else { + enumVarName = "POSITIVE_" + value; + } + if (floatMatch) { + enumVarName = enumVarName.replace(".", "_PT_"); + } + return enumVarName; + } + + // every character in value is not allowed + String valueWithAllowedCharsOnly = value.replaceAll("^\\W+", ""); + if (valueWithAllowedCharsOnly.isEmpty()) { + StringBuilder usedValueBuilder = new StringBuilder(); + for (int i = 0; i < value.length(); i++){ + char c = value.charAt(i); + String charName = Character.getName(Character.hashCode(c)); + if (usedValueBuilder.length() > 0) { + usedValueBuilder.append("_"); + } + usedValueBuilder.append(charNameToVarName(charName)); + } + return usedValueBuilder.toString(); + } + + String usedValue = value; + // Replace " " with _ + usedValue = usedValue.replaceAll("[ ]+", "_"); + + // replace all invalid characters with their character name descriptions + // replace all invalid characters with their character name descriptions + Stack> matchStartToGroup = new Stack<>(); + Pattern nonLetterCharPattern = Pattern.compile("^[^a-zA-Z]"); + Matcher matcher = nonLetterCharPattern.matcher(usedValue); + while (matcher.find()) { + matchStartToGroup.add(new AbstractMap.SimpleEntry<>(matcher.start(), matcher.group())); + } + Pattern nonWordPattern = Pattern.compile("\\W+"); + matcher = nonWordPattern.matcher(usedValue); + while (matcher.find()) { + if (matcher.start() == 0) { + // skip adding first because it was already added + continue; + } + matchStartToGroup.add(new AbstractMap.SimpleEntry<>(matcher.start(), matcher.group())); + } + char underscore = '_'; + while (!matchStartToGroup.isEmpty()) { + AbstractMap.SimpleEntry entry = matchStartToGroup.pop(); + Integer startIndex = entry.getKey(); + String match = entry.getValue(); + String prefix = ""; + String suffix = ""; + if (startIndex > 0 && usedValue.charAt(startIndex-1) != underscore) { + prefix = "_"; + } + int indexAfter = startIndex + match.length(); + if (startIndex + match.length() < usedValue.length() && usedValue.charAt(indexAfter) != underscore) { + suffix = "_"; + } + StringBuilder convertedMatch = new StringBuilder(); + for (int i = 0; i < match.length(); i++) { + String charName = charNameToVarName(Character.getName(Character.hashCode(match.charAt(i)))); + // todo remove the parens portion of charName here + convertedMatch.append(charName); + if (i != match.length() - 1) { + convertedMatch.append("_"); + } + } + String replacement = prefix + convertedMatch + suffix; + usedValue = usedValue.substring(0, startIndex) + replacement + usedValue.substring(indexAfter); + } + + // add camel case underscore + String regex = "([a-z])([A-Z]+)"; + String regexReplacement = "$1_$2"; + usedValue = usedValue.replaceAll(regex, regexReplacement); + + // uppercase + usedValue = usedValue.toUpperCase(Locale.ROOT); + + if (usedValue.length() > 1) { + // remove trailing _ + usedValue = usedValue.replaceAll("_$", ""); + } + return usedValue; + } + + @Override + public Function> getSchemasFn() { + return codegenSchema -> { + ArrayList schemasBeforeImports = new ArrayList<>(); + ArrayList schemasAfterImports = new ArrayList<>(); + codegenSchema.getAllSchemas(schemasBeforeImports, schemasAfterImports, 0, true); + schemasBeforeImports.addAll(schemasAfterImports); + return schemasBeforeImports; + }; + } + + private void addToTypeToValue(LinkedHashMap> typeToValues, EnumValue enumValue, String type, String name) { + if (!typeToValues.containsKey(type)) { + typeToValues.put(type, new LinkedHashMap<>()); + } + typeToValues.get(type).put(enumValue, name); + } + + protected EnumInfo getEnumInfo(ArrayList values, Schema schema, String currentJsonPath, String sourceJsonPath, LinkedHashSet types, String classSuffix) { + LinkedHashMap enumValueToName = new LinkedHashMap<>(); + LinkedHashMap> typeToValues = new LinkedHashMap<>(); + LinkedHashMap enumNameToValue = new LinkedHashMap<>(); + int truncateIdx = 0; + + if (generatorSettings.removeEnumValuePrefix) { + String commonPrefix = findCommonPrefixOfVars(values); + truncateIdx = commonPrefix.length(); + } + + List xEnumVariableNames = null; + List xEnumDescriptions = null; + // noinspection SpellCheckingInspection + String xEnumVariablenamesKey = "x-enum-varnames"; + String xEnumDescriptionsKey = "x-enum-descriptions"; + if (schema.getExtensions() != null) { + if (schema.getExtensions().containsKey(xEnumVariablenamesKey)) { + xEnumVariableNames = new ArrayList<>(); + Object result = schema.getExtensions().get(xEnumVariablenamesKey); + if (result instanceof List) { + for (Object item: (List) result) { + if (item instanceof String) { + xEnumVariableNames.add((String) item); + } + } + } + } + if (schema.getExtensions().containsKey(xEnumDescriptionsKey)) { + xEnumDescriptions = new ArrayList<>(); + Object result = schema.getExtensions().get(xEnumDescriptionsKey); + if (result instanceof List) { + for (Object item: (List) result) { + if (item instanceof String) { + xEnumDescriptions.add((String) item); + } + } + } + } + } + + int i = 0; + for (Object value : values) { + String description = null; + if (xEnumDescriptions != null && xEnumDescriptions.size() > i) { + description = xEnumDescriptions.get(i); + } + + String enumName; + if (xEnumVariableNames != null && xEnumVariableNames.size() > i) { + enumName = xEnumVariableNames.get(i); + } else { + if (truncateIdx == 0) { + enumName = String.valueOf(value); + } else { + enumName = value.toString().substring(truncateIdx); + if (enumName.isEmpty()) { + enumName = value.toString(); + } + } + } + + String usedName = toEnumVarName(enumName, schema); + EnumValue enumValue = getEnumValue(value, description); + boolean typeIsInteger = enumValue.type.equals("integer"); + boolean intIsNumberUseCase = (typeIsInteger && types!=null && types.contains("number")); + if (types!=null && !types.contains(enumValue.type) && !intIsNumberUseCase) { + throw new RuntimeException("Enum value's type is not allowed by schema types for value="+enumValue.value+" types="+types + " jsonPath="+currentJsonPath); + } + enumValueToName.put(enumValue, usedName); + if (!enumNameToValue.containsKey(usedName)) { + enumNameToValue.put(usedName, enumValue); + } else { + LOGGER.error( + "Enum error: two generated enum variable names collide. The values {} and {} generate variable name {} . Please file an issue at https://github.com/openapi-json-schema-tools/openapi-json-schema-generator/issues", + enumNameToValue.get(usedName).value, + enumValue.value, + usedName); + } + // typeToValues code + if ("null".equals(enumValue.type) || "boolean".equals(enumValue.type) || "string".equals(enumValue.type)) { + addToTypeToValue(typeToValues, enumValue, enumValue.type, usedName); + } else if (value instanceof Integer) { + addToTypeToValue(typeToValues, enumValue, "Integer", usedName); + EnumValue longEnumValue = getEnumValue(Long.parseLong(value.toString()), description); + addToTypeToValue(typeToValues, longEnumValue, "Long", usedName); + EnumValue floatEnumValue = getEnumValue(Float.valueOf(value +".0"), description); + addToTypeToValue(typeToValues, floatEnumValue, "Float", usedName); + EnumValue doubleEnumValue = getEnumValue(Double.valueOf(value +".0"), description); + addToTypeToValue(typeToValues, doubleEnumValue, "Double", usedName); + } else if (value instanceof Long) { + addLongEnum(typeToValues, enumValue, (Long) value, usedName); + } else if (value instanceof Float) { + addToTypeToValue(typeToValues, enumValue, "Float", usedName); + EnumValue doubleEnumValue = getEnumValue(Double.valueOf(value.toString()), description); + addToTypeToValue(typeToValues, doubleEnumValue, "Double", usedName); + } else if (value instanceof Double) { + addDoubleEnum(typeToValues, enumValue, (Double) value, usedName); + } else if (value instanceof BigDecimal) { + BigDecimal casValue = (BigDecimal) value; + boolean isInteger = casValue.signum() == 0 || casValue.scale() <= 0 || casValue.stripTrailingZeros().scale() <= 0; + if (isInteger) { + addLongEnum(typeToValues, enumValue, casValue.longValue(), usedName); + } else { + addDoubleEnum(typeToValues, enumValue, casValue.doubleValue(), usedName); + } + } + i += 1; + } + CodegenKey jsonPathPiece = null; + if (currentJsonPath != null) { + String currentName = currentJsonPath.substring(currentJsonPath.lastIndexOf("/") + 1); + jsonPathPiece = getKey(currentName + classSuffix, "schemaProperty", sourceJsonPath); + } + + return new EnumInfo(enumValueToName, typeToValues, jsonPathPiece); + } + + private void addLongEnum(LinkedHashMap> typeToValues, EnumValue enumValue, Long value, String usedName) { + addToTypeToValue(typeToValues, enumValue, "Long", usedName); + EnumValue doubleEnumValue = getEnumValue(Double.valueOf(value.toString()+".0"), enumValue.description); + addToTypeToValue(typeToValues, doubleEnumValue, "Double", usedName); + if (value >= -2147483648L && value <= 2147483647L) { + EnumValue integerEnumValue = getEnumValue(Integer.valueOf(value.toString()), enumValue.description); + addToTypeToValue(typeToValues, integerEnumValue, "Integer", usedName); + EnumValue floatEnumValue = getEnumValue(Float.valueOf(value +".0"), enumValue.description); + addToTypeToValue(typeToValues, floatEnumValue, "Float", usedName); + } + } + + private void addDoubleEnum(LinkedHashMap> typeToValues, EnumValue enumValue, Double value, String usedName) { + addToTypeToValue(typeToValues, enumValue, "Double", usedName); + if (value >= -3.4028234663852886e+38d && value <= 3.4028234663852886e+38d) { + EnumValue floatEnumValue = getEnumValue(Float.valueOf(value.toString()), enumValue.description); + addToTypeToValue(typeToValues, floatEnumValue, "Float", usedName); + } + } + + protected List> getOperationBuilders(String jsonPath, CodegenRequestBody requestBody, CodegenParametersInfo parametersInfo, CodegenList servers, CodegenList security) { + if (requestBody == null && parametersInfo == null && servers == null && security == null) { + return null; + } + int qtyBuilders = 1; // last one with optional params + int reqPropsSize = 0; + boolean requestBodyExists = requestBody != null; + boolean parametersExist = parametersInfo != null; + List requiredProperties = new ArrayList<>(); + List optionalProperties = new ArrayList<>(); + if (requestBodyExists) { + if (Boolean.TRUE.equals(requestBody.getSelfOrDeepestRef().required)) { + reqPropsSize += 1; + requiredProperties.add(requestBody); + } else { + optionalProperties.add(requestBody); + } + } + if (parametersExist) { + if (parametersInfo.headerParametersSchema != null) { + if (parametersInfo.headerParametersSchema.requiredProperties != null) { + reqPropsSize += 1; + requiredProperties.add(parametersInfo.headerParametersSchema); + } else { + optionalProperties.add(parametersInfo.headerParametersSchema); + } + } + if (parametersInfo.pathParametersSchema != null) { + if (parametersInfo.pathParametersSchema.requiredProperties != null) { + reqPropsSize += 1; + requiredProperties.add(parametersInfo.pathParametersSchema); + } else { + optionalProperties.add(parametersInfo.pathParametersSchema); + } + } + if (parametersInfo.queryParametersSchema != null) { + if (parametersInfo.queryParametersSchema.requiredProperties != null) { + reqPropsSize += 1; + requiredProperties.add(parametersInfo.queryParametersSchema); + } else { + optionalProperties.add(parametersInfo.queryParametersSchema); + } + } + if (parametersInfo.cookieParametersSchema != null) { + if (parametersInfo.cookieParametersSchema.requiredProperties != null) { + reqPropsSize += 1; + requiredProperties.add(parametersInfo.cookieParametersSchema); + } else { + optionalProperties.add(parametersInfo.cookieParametersSchema); + } + } + } + if (servers != null) { + optionalProperties.add(servers); + } + if (security != null) { + optionalProperties.add(security); + } + OperationInput timeout = new OperationInput( + getKey("Duration", "misc"), + "timeout", + null + ); + optionalProperties.add(timeout); + + Map> bitStrToBuilder = new HashMap<>(); + MapBuilder lastBuilder = null; + // builders are built last to first, last builder has build method + String[] pathPieces = jsonPath.split("/"); + CodegenKey operationKey = getKey(pathPieces[pathPieces.length-1], "misc", jsonPath); + String builderName = operationKey.pascalCase; + List> builders = new ArrayList<>(); + if (requiredProperties.size() > 0) { + qtyBuilders = (int) Math.pow(2, requiredProperties.size()); + } + for (int i=0; i < qtyBuilders; i++) { + String bitStr = ""; + if (reqPropsSize != 0) { + bitStr = String.format("%"+reqPropsSize+"s", Integer.toBinaryString(i)).replace(' ', '0'); + } + CodegenKey builderClassName; + if (i == qtyBuilders - 1) { + // first invoked builder has the simplest name with no bitStr + builderClassName = getKey(builderName + "RequestBuilder", "misc", jsonPath); + } else { + builderClassName = getKey(builderName + bitStr + "RequestBuilder", "misc", jsonPath); + } + MapBuilder builder; + if (i == 0) { + builder = new MapBuilder<>(builderClassName, new LinkedHashMap<>()); + lastBuilder = builder; + } else { + LinkedHashMap> keyToBuilder = new LinkedHashMap<>(); + for (int c=0; c < reqPropsSize; c++) { + if (bitStr.charAt(c) == '1') { + StringBuilder nextBuilderBitStr = new StringBuilder(bitStr); + nextBuilderBitStr.setCharAt(c, '0'); + CodegenKey key = getKey(requiredProperties.get(c).operationInputVariableName(), "misc"); + if (key == null) { + throw new RuntimeException("key must exist at c="+c); + } + MapBuilder nextBuilder = bitStrToBuilder.get(nextBuilderBitStr.toString()); + if (nextBuilder == null) { + throw new RuntimeException("Next builder must exist for bitStr="+ nextBuilderBitStr); + } + var pair = new MapBuilder.BuilderPropertyPair<>(nextBuilder, requiredProperties.get(c)); + keyToBuilder.put(key, pair); + } + } + builder = new MapBuilder<>(builderClassName, keyToBuilder); + } + bitStrToBuilder.put(bitStr, builder); + builders.add(builder); + } + // todo add builder that allows + if (!optionalProperties.isEmpty()) { + for (OperationInputProvider property: optionalProperties) { + var pair = new MapBuilder.BuilderPropertyPair<>(lastBuilder, property); + CodegenKey key = getKey(property.operationInputVariableName(), "misc"); + lastBuilder.keyToBuilder.put(key, pair); + } + } + return builders; + } + + private String getPathClassNamePrefix(String jsonPath) { + // #/paths/somePath/get -> SomepathGet + String[] pathPieces = jsonPath.split("/"); + String pathJsonPath = "#/paths/"+pathPieces[2]; + String pathClassName = getFilename(CodegenKeyType.PATH, ModelUtils.decodeSlashes(pathPieces[2]), pathJsonPath); + return pathClassName + StringUtils.capitalize(pathPieces[3]); + } + + @Override + public String getPascalCase(CodegenKeyType type, String lastJsonPathFragment, String jsonPath) { + switch (type) { + case SCHEMA: + return getSchemaPascalCaseName(lastJsonPathFragment, jsonPath, true); + case PATH: + return camelize(getFilename(CodegenKeyType.PATH, lastJsonPathFragment, jsonPath)); + case REQUEST_BODY: + if (jsonPath.startsWith("#/paths")) { + String prefix = getPathClassNamePrefix(jsonPath); + return prefix + "RequestBody"; + } + return toModelName(lastJsonPathFragment, jsonPath); + case MISC: + case HEADER: + case CONTENT_TYPE: + case SECURITY_SCHEME: + return toModelName(lastJsonPathFragment, jsonPath); + case OPERATION: + return getFilename(CodegenKeyType.OPERATION, lastJsonPathFragment, jsonPath); + case PARAMETER: + return getFilename(CodegenKeyType.PARAMETER, lastJsonPathFragment, jsonPath); + case RESPONSE: + if (jsonPath.startsWith("#/components/responses/")) { + return toModelName(lastJsonPathFragment, null); + } else { + String prefix = getPathClassNamePrefix(jsonPath); + if (jsonPath.endsWith("/responses")) { + // #/paths/somePath/get/responses + return prefix + "Responses"; + } + // #/paths/somePath/get/responses/200 + return prefix + "Code" + lastJsonPathFragment + "Response"; + } + case SERVER: + String[] pathPieces = jsonPath.split("/"); + if (jsonPath.startsWith("#/servers")) { + if (pathPieces.length == 2) { + // #/servers + return "RootServerInfo"; + } + // #/servers/0 + return "RootServer"+pathPieces[2]; + } else if (jsonPath.startsWith("#/paths") && pathPieces.length >= 4 && pathPieces[3].equals("servers")) { + CodegenKey pathKey = getKey(ModelUtils.decodeSlashes(pathPieces[2]), "paths", jsonPath); + if (pathPieces.length == 4) { + // #/paths/somePath/servers + return pathKey.pascalCase + "ServerInfo"; + } + // #/paths/somePath/servers/0 + return pathKey.pascalCase + "Server"+ pathPieces[4]; + } + // jsonPath.startsWith("#/paths") && pathPieces.length >= 5 && pathPieces[4].equals("servers") + String prefix = getPathClassNamePrefix(jsonPath); + if (pathPieces.length == 5) { + // #/paths/somePath/get/servers + return prefix + "ServerInfo"; + } + // #/paths/somePath/get/servers/0 + return prefix + "Server" + pathPieces[5]; + case SECURITY: + return getFilename(CodegenKeyType.SECURITY, lastJsonPathFragment, jsonPath); + default: + return null; + } + } + + @Override + public String getFilename(CodegenKeyType type, String lastJsonPathFragment, String jsonPath) { + String[] pathPieces = jsonPath.split("/"); + switch(type) { + case SCHEMA: + String modelName = schemaJsonPathToModelName.get(jsonPath); + if (modelName != null) { + return modelName; + } + return getSchemaPascalCaseName(pathPieces[pathPieces.length-1], jsonPath, false); + case SERVER: + return getPascalCase(CodegenKeyType.SERVER, lastJsonPathFragment, jsonPath); + case SECURITY_SCHEME: + return toModelName(lastJsonPathFragment, jsonPath); + case OPERATION: + String pathJsonPath = "#/paths/"+pathPieces[2]; + String pthClassName = getFilename(CodegenKeyType.PATH, ModelUtils.decodeSlashes(pathPieces[2]), pathJsonPath); + String operationFileName = pthClassName + StringUtils.capitalize(lastJsonPathFragment); + return operationFileName; + case PARAMETER: + if (jsonPath.startsWith("#/components/parameters/")) { + if (pathPieces.length == 4) { + // #/components/parameters/SomeParameter + return toModelName(lastJsonPathFragment, null); + } + return toModuleFilename(lastJsonPathFragment, jsonPath); + } + if (operationVerbs.contains(pathPieces[3])) { + if (pathPieces.length == 5) { + // #/paths/somePath/verb/parameters + return "Parameters"; + } + if (pathPieces[pathPieces.length-2].equals("parameters") && isInteger(lastJsonPathFragment) && pathPieces.length == 6) { + // #/paths/somePath/verb/parameters/0 + return "Parameter" + lastJsonPathFragment; + } + return "parameter" + lastJsonPathFragment; + } + if (pathPieces[pathPieces.length-2].equals("parameters") && isInteger(lastJsonPathFragment) && pathPieces.length == 5) { + // #/paths/somePath/parameters/0 + return "RouteParameter" + lastJsonPathFragment; + } + return "routeparameter" + lastJsonPathFragment; + case PATH: + boolean pathClassCase = (pathPieces.length == 3 || (pathPieces.length == 4 && pathPieces[1].equals("apis"))); + if (pathClassCase) { + // #/paths/somePath -> Somepath + // #/apis/paths/somePath -> Somepath + String moduleFilename = toModuleFilename(lastJsonPathFragment, jsonPath); + return camelize(moduleFilename, false); + } + // #/paths/somePath/blah -> somepath + return toModuleFilename(lastJsonPathFragment, jsonPath); + case HEADER: + if (jsonPath.startsWith("#/components/headers/")) { + if (pathPieces.length == 4) { + // #/components/headers/SomeHeader + return toModelName(lastJsonPathFragment, null); + } + // deeper paths + return toModuleFilename(lastJsonPathFragment, jsonPath); + } else if (jsonPath.startsWith("#/components/responses/")) { + if (pathPieces.length == 5) { + // #/components/responses/SomeResponse/headers + return "Headers"; + } else if (pathPieces.length == 6) { + // #/components/responses/SomeResponse/headers/SomeHeader + return toModelName(lastJsonPathFragment, null); + } + // deeper paths + return toModuleFilename(lastJsonPathFragment, jsonPath); + } + if (pathPieces.length == 7) { + // #/paths/somePath/verb/responses/200/headers + return "Headers"; + } else if (pathPieces.length == 8) { + // #/paths/somePath/verb/responses/200/headers/SomeHeader + return toModelName(lastJsonPathFragment, null); + } + // deeper paths + return toModuleFilename(lastJsonPathFragment, jsonPath); + case REQUEST_BODY: + if (pathPieces[2].equals("requestbodies") || pathPieces[2].equals("requestBodies")) { + if (pathPieces.length == 4) { + // #/components/requestBodies/Pet + return toModelName(lastJsonPathFragment, null); + } + return toModuleFilename(lastJsonPathFragment, null); + } + if (pathPieces.length == 5) { + // #/paths/somePath/verb/requestBody + String pathClassName = getPathClassNamePrefix(jsonPath); + return pathClassName + "RequestBody"; + } + return toModuleFilename(lastJsonPathFragment, null); + case CONTENT_TYPE: + return toModuleFilename(lastJsonPathFragment, null); + case SECURITY: + if (pathPieces.length == 2) { + // #/security + return "SecurityInfo"; + } else if (pathPieces.length == 3) { + // #/security/0 + return "SecurityRequirementObject"+pathPieces[pathPieces.length-1]; + } else if (pathPieces.length == 5) { + // #/paths/somePath/verb/security + String prefix = getPathClassNamePrefix(jsonPath); + return prefix + "SecurityInfo"; + } + // pathPieces.length == 6 + // #/paths/somePath/verb/security/0 + String prefix = getPathClassNamePrefix(jsonPath); + return prefix + "SecurityRequirementObject"+pathPieces[pathPieces.length-1]; + case RESPONSE: + if (jsonPath.startsWith("#/components/responses/")) { + if (pathPieces.length == 4) { + // #/components/responses/SomeResponse + return toModelName(lastJsonPathFragment, null); + } + return toModuleFilename(lastJsonPathFragment, jsonPath); + } + String clsNamePrefix = getPathClassNamePrefix(jsonPath); + switch (pathPieces.length) { + case 5: + // #/paths/somePath/verb/responses + return clsNamePrefix + "Responses"; + case 6: + // #/paths/somePath/verb/responses/200 + return clsNamePrefix + "Code"+ lastJsonPathFragment + "Response"; + default: + return toModuleFilename("code"+lastJsonPathFragment+"response", null); + } + default: + return null; + } + } + + protected List> getMapBuilders(CodegenSchema schema, String currentJsonPath, String sourceJsonPath) { + List> builders = new ArrayList<>(); + if (sourceJsonPath == null) { + return builders; + } + String schemaName = currentJsonPath.substring(currentJsonPath.lastIndexOf("/") + 1); + schemaName = ModelUtils.decodeSlashes(schemaName); + int qtyBuilders = 1; + int reqPropsSize = 0; + if (schema.requiredProperties != null) { + qtyBuilders = (int) Math.pow(2, schema.requiredProperties.size()); + reqPropsSize = schema.requiredProperties.size(); + } + Map> bitStrToBuilder = new HashMap<>(); + List reqPropKeys = new ArrayList<>(); + if (schema.requiredProperties != null) { + reqPropKeys.addAll(schema.requiredProperties.keySet()); + } + MapBuilder lastBuilder = null; + // builders are built last to first, last builder has build method + for (int i=0; i < qtyBuilders; i++) { + String bitStr = ""; + if (reqPropsSize != 0) { + bitStr = String.format("%"+reqPropsSize+"s", Integer.toBinaryString(i)).replace(' ', '0'); + } + CodegenKey builderClassName; + if (i == qtyBuilders - 1) { + // first invoked builder has the simplest name with no bitStr + if (schema.mapInputJsonPathPiece != null) { + builderClassName = schema.mapInputJsonPathPiece; + } else { + builderClassName = getKey( + schemaName + objectIOClassNamePiece + "Builder", + "schemas", + sourceJsonPath + ); + } + } else { + builderClassName = getKey( + schemaName + objectIOClassNamePiece + bitStr + "Builder", + "schemas", + sourceJsonPath + ); + } + MapBuilder builder; + if (i == 0) { + builder = new MapBuilder<>(builderClassName, new LinkedHashMap<>()); + lastBuilder = builder; + } else { + LinkedHashMap> keyToBuilder = new LinkedHashMap<>(); + for (int c=0; c < reqPropsSize; c++) { + if (bitStr.charAt(c) == '1') { + StringBuilder nextBuilderBitStr = new StringBuilder(bitStr); + nextBuilderBitStr.setCharAt(c, '0'); + CodegenKey key = reqPropKeys.get(c); + if (key == null) { + throw new RuntimeException("key must exist at c="+c); + } + MapBuilder nextBuilder = bitStrToBuilder.get(nextBuilderBitStr.toString()); + if (nextBuilder == null) { + throw new RuntimeException("Next builder must exist for bitStr="+ nextBuilderBitStr); + } + var pair = new MapBuilder.BuilderPropertyPair<>(nextBuilder, schema.requiredProperties.get(key)); + keyToBuilder.put(key, pair); + } + } + builder = new MapBuilder<>(builderClassName, keyToBuilder); + } + bitStrToBuilder.put(bitStr, builder); + builders.add(builder); + } + if (lastBuilder != null && schema.optionalProperties != null) { + for (Map.Entry entry: schema.optionalProperties.entrySet()) { + var pair = new MapBuilder.BuilderPropertyPair<>(lastBuilder, entry.getValue()); + lastBuilder.keyToBuilder.put(entry.getKey(), pair); + } + } + return builders; + } + + @Override + public TreeMap postProcessAllModels(TreeMap objs) { + objs = super.postProcessAllModels(objs); + objs = super.updateAllModels(objs); + + return objs; + } + + private void sanitizeConfig() { + // Sanitize any config options here. We also have to update the additionalProperties because + // the whole additionalProperties object is injected into the main object passed to the mustache layer + + this.setModelPackage(sanitizePackageName(modelPackage)); + + this.setInvokerPackage(sanitizePackageName(invokerPackage)); + if (additionalProperties.containsKey(CodegenConstants.INVOKER_PACKAGE)) { + this.additionalProperties.put(CodegenConstants.INVOKER_PACKAGE, invokerPackage); + } + } + + @Override + public String escapeReservedWord(String name) { + return "_" + name; + } + + @Override + public String toVarName(String name) { + // sanitize name + name = sanitizeName(name, "\\W-[\\$]"); // FIXME: a parameter should not be assigned. Also declare the methods parameters as 'final'. + + if (name.toLowerCase(Locale.ROOT).matches("^_*class$")) { + return "propertyClass"; + } + + if ("_".equals(name)) { + name = "_u"; + } + + // numbers are not allowed at the beginning + if (name.matches("^\\d.*")) { + name = "_" + name; + } + + // if it's all upper case, do nothing + if (name.matches("^[A-Z0-9_]*$")) { + return name; + } + + if (startsWithTwoUppercaseLetters(name)) { + name = name.substring(0, 2).toLowerCase(Locale.ROOT) + name.substring(2); + } + + // If name contains special chars -> replace them. + if ((((CharSequence) name).chars().anyMatch(character -> specialCharReplacements.containsKey(String.valueOf((char) character))))) { + List allowedCharacters = new ArrayList<>(); + allowedCharacters.add("_"); + allowedCharacters.add("$"); + name = escape(name, specialCharReplacements, allowedCharacters, "_"); + } + + // camelize (lower first character) the variable name + // pet_id => petId + name = camelize(name, true); + + // for reserved word or word starting with number, append _ + if (isReservedWord(name) || name.matches("^\\d.*")) { + name = escapeReservedWord(name); + } + + return name; + } + + private boolean startsWithTwoUppercaseLetters(String name) { + boolean startsWithTwoUppercaseLetters = false; + if (name.length() > 1) { + startsWithTwoUppercaseLetters = name.substring(0, 2).equals(name.substring(0, 2).toUpperCase(Locale.ROOT)); + } + return startsWithTwoUppercaseLetters; + } + + @Override + public String toModelName(final String name, String jsonPath) { + // We need to check if schema-mapping has a different model for this class, so we use it + // instead of the auto-generated one. + + // memoization + if (schemaKeyToModelNameCache.containsKey(name)) { + return schemaKeyToModelNameCache.get(name); + } + + String nameWithPrefixSuffix = sanitizeName(name); + + if (!StringUtils.isEmpty(modelNamePrefix)) { + // add '_' so that model name can be camelized correctly + nameWithPrefixSuffix = modelNamePrefix + "_" + nameWithPrefixSuffix; + } + + if (!StringUtils.isEmpty(modelNameSuffix)) { + // add '_' so that model name can be camelized correctly + nameWithPrefixSuffix = nameWithPrefixSuffix + "_" + modelNameSuffix; + } + + // camelize the model name + // phone_number => PhoneNumber + final String camelizedName = camelize(nameWithPrefixSuffix); + + // model name cannot use reserved keyword, e.g. return + if (isReservedWord(camelizedName)) { + final String modelName = "Model" + camelizedName; + schemaKeyToModelNameCache.put(name, modelName); + LOGGER.warn("{} (reserved word) cannot be used as model name. Renamed to {}", camelizedName, modelName); + return modelName; + } + + // model name starts with number + if (camelizedName.matches("^\\d.*")) { + final String modelName = "Model" + camelizedName; // e.g. 200Response => Model200Response (after camelize) + schemaKeyToModelNameCache.put(name, modelName); + LOGGER.warn("{} (model name starts with number) cannot be used as model name. Renamed to {}", name, + modelName); + return modelName; + } + + schemaKeyToModelNameCache.put(name, camelizedName); + + return camelizedName; + } + + /** + * Return the example value of the parameter. Overrides the + * getParameterExampleValue(Parameter) method in + * DefaultGenerator to always call setParameterExampleValue(CodegenParameter) + * in this class, which adds single quotes around strings from the + * x-example property. + * + * @param parameter Parameter + */ + @Override + public String getParameterExampleValue(Parameter parameter) { + String example = null; + if (parameter.getExample() != null) { + example = parameter.getExample().toString(); + } else if (parameter.getExamples() != null && !parameter.getExamples().isEmpty()) { + Example examplesExample = parameter.getExamples().values().iterator().next(); + if (examplesExample.getValue() != null) { + example = examplesExample.getValue().toString(); + } + } + + Schema schema = parameter.getSchema(); + + if (schema == null && parameter.getContent() != null) { + String contentType = (String) parameter.getContent().keySet().toArray()[0]; + schema = parameter.getContent().get(contentType).getSchema(); + } + + if (schema == null) { + return null; + } + + if (schema.getExample() != null) { + example = schema.getExample().toString(); + } else if (schema.getExamples() != null && !schema.getExamples().isEmpty()) { + example = schema.getExamples().get(0).toString(); + } + + boolean hasAllowableValues = schema.getEnum() != null && !schema.getEnum().isEmpty(); + if (hasAllowableValues) { + //support examples for inline enums + final List values = (List) schema.getEnum(); + example = String.valueOf(values.get(0)); + } else if (schema.getDefault() != null) { + example = schema.getDefault().toString(); + } else if (schema.getExample() != null) { + example = schema.getExample().toString(); + } else if (schema.getExamples() != null && !schema.getExamples().isEmpty()) { + example = schema.getExamples().get(0).toString(); + } + + Set types = schema.getTypes(); + if (types == null) { + types = new HashSet<>(); + if (schema.getType() != null) { + types.add(schema.getType()); + } + } + if (types.contains("string")) { + String format = schema.getFormat(); + if (format != null) { + switch (format) { + case "uuid": + if (example == null) { + example = "UUID.randomUUID()"; + } else { + example = "UUID.fromString(\"" + example + "\")"; + } + break; + case "binary": + if (example == null) { + example = "/path/to/file"; + } + example = "new File(\"" + escapeText(example) + "\")"; + break; + case "date": + example = "new Date()"; + break; + case "date-time": + if (example == null) { + example = "LocalDate.now()"; + } else { + example = "LocalDate.parse(\"" + example + "\")"; + } + break; + case "number": + if (example == null) { + example = "new BigDecimal(78)"; + } else { + example = "new BigDecimal(\"" + example + "\")"; + } + break; + } + } else { + if (example == null) { + example = parameter.getName() + "_example"; + } + example = "\"" + escapeText(example) + "\""; + } + } else if (types.contains("integer")) { + if (example == null) { + example = "56"; + } + if (schema.getFormat().equals("int64")) { + example = StringUtils.appendIfMissingIgnoreCase(example, "L"); + } + } else if (types.contains("number")) { + if (example == null) { + example = "3.4"; + } + if (schema.getFormat().equals("float")) { + example = StringUtils.appendIfMissingIgnoreCase(example, "F"); + } else if (schema.getFormat().equals("double")) { + example = StringUtils.appendIfMissingIgnoreCase(example, "D"); + } + } else if (types.contains("boolean")) { + if (example == null) { + example = "true"; + } + } else if (types.contains("array")) { + if (example == null) { + example = "Arrays.asList()"; + } + } else if (types.contains("object")) { + if (example == null) { + example = "new HashMap()"; + } + } else if (types.contains("null")) { + if (example == null) { + example = "null"; + } + } else if (hasAllowableValues) { + //parameter is enum defined as a schema component + example = ".fromValue(\"" + example + "\")"; + } + + if (example == null) { + example = "null"; + } + + return example; + } + + @Override + public String toExampleValue(Schema p) { + if (p.getExample() != null) { + return escapeText(p.getExample().toString()); + } else { + return null; + } + } + + @Override + public void setOpenAPI(OpenAPI openAPI) { + super.setOpenAPI(openAPI); + Components components = openAPI.getComponents(); + if (components != null && components.getSecuritySchemes() != null) { + supportingFiles.add(new SupportingFile( + "src/main/kotlin/packagename/securityrequirementobjects/SecurityRequirementObject.hbs", + packagePath() + File.separatorChar + "securityrequirementobjects", + "SecurityRequirementObject.kt")); + supportingFiles.add(new SupportingFile( + "src/main/kotlin/packagename/securityrequirementobjects/AuthApplier.hbs", + packagePath() + File.separatorChar + "securityrequirementobjects", + "AuthApplier.kt")); + supportingFiles.add(new SupportingFile( + "src/main/kotlin/packagename/securityrequirementobjects/EmptySecurityRequirementObject.hbs", + packagePath() + File.separatorChar + "securityrequirementobjects", + "EmptySecurityRequirementObject.kt")); + supportingFiles.add(new SupportingFile( + "src/main/kotlin/packagename/securityrequirementobjects/SecurityRequirementObjectProvider.hbs", + packagePath() + File.separatorChar + "securityrequirementobjects", + "SecurityRequirementObjectProvider.kt")); + supportingFiles.add(new SupportingFile( + "src/main/kotlin/packagename/securityschemes/SecurityScheme.hbs", + packagePath() + File.separatorChar + "securityschemes", + "SecurityScheme.kt")); + supportingFiles.add(new SupportingFile( + "src/main/kotlin/packagename/securityschemes/ApiKeyCookieSecurityScheme.hbs", + packagePath() + File.separatorChar + "securityschemes", + "ApiKeyCookieSecurityScheme.kt")); + supportingFiles.add(new SupportingFile( + "src/main/kotlin/packagename/securityschemes/ApiKeyHeaderSecurityScheme.hbs", + packagePath() + File.separatorChar + "securityschemes", + "ApiKeyHeaderSecurityScheme.kt")); + supportingFiles.add(new SupportingFile( + "src/main/kotlin/packagename/securityschemes/ApiKeyQuerySecurityScheme.hbs", + packagePath() + File.separatorChar + "securityschemes", + "ApiKeyQuerySecurityScheme.kt")); + supportingFiles.add(new SupportingFile( + "src/main/kotlin/packagename/securityschemes/HttpBasicSecurityScheme.hbs", + packagePath() + File.separatorChar + "securityschemes", + "HttpBasicSecurityScheme.kt")); + supportingFiles.add(new SupportingFile( + "src/main/kotlin/packagename/securityschemes/HttpBearerSecurityScheme.hbs", + packagePath() + File.separatorChar + "securityschemes", + "HttpBearerSecurityScheme.kt")); + supportingFiles.add(new SupportingFile( + "src/main/kotlin/packagename/securityschemes/HttpSignatureSecurityScheme.hbs", + packagePath() + File.separatorChar + "securityschemes", + "HttpSignatureSecurityScheme.kt")); + supportingFiles.add(new SupportingFile( + "src/main/kotlin/packagename/securityschemes/HttpDigestSecurityScheme.hbs", + packagePath() + File.separatorChar + "securityschemes", + "HttpDigestSecurityScheme.kt")); + supportingFiles.add(new SupportingFile( + "src/main/kotlin/packagename/securityschemes/MutualTlsSecurityScheme.hbs", + packagePath() + File.separatorChar + "securityschemes", + "MutualTlsSecurityScheme.kt")); + supportingFiles.add(new SupportingFile( + "src/main/kotlin/packagename/securityschemes/OAuth2SecurityScheme.hbs", + packagePath() + File.separatorChar + "securityschemes", + "OAuth2SecurityScheme.kt")); + supportingFiles.add(new SupportingFile( + "src/main/kotlin/packagename/securityschemes/OpenIdConnectSecurityScheme.hbs", + packagePath() + File.separatorChar + "securityschemes", + "OpenIdConnectSecurityScheme.kt")); + + jsonPathTemplateFiles.put( + CodegenConstants.JSON_PATH_LOCATION_TYPE.SECURITY, + new HashMap<>() {{ + put("src/main/kotlin/packagename/securityrequirementobjects/SecurityRequirementObjectN.hbs", ".kt"); + }} + ); + jsonPathDocTemplateFiles.put( + CodegenConstants.JSON_PATH_LOCATION_TYPE.SECURITY, + new HashMap<>() {{ + put("src/main/kotlin/packagename/securityrequirementobjects/SecurityRequirementObjectNDoc.hbs", ".md"); + }} + ); + jsonPathTemplateFiles.put( + CodegenConstants.JSON_PATH_LOCATION_TYPE.SECURITIES, + new HashMap<>() {{ + put("src/main/kotlin/packagename/securityrequirementobjects/SecurityInfo.hbs", ".kt"); + }} + ); + jsonPathDocTemplateFiles.put( + CodegenConstants.JSON_PATH_LOCATION_TYPE.SECURITIES, + new HashMap<>() {{ + put("src/main/kotlin/packagename/securityrequirementobjects/SecurityInfoDoc.hbs", ".md"); + }} + ); + jsonPathTemplateFiles.put( + CodegenConstants.JSON_PATH_LOCATION_TYPE.SECURITY_SCHEME, + new HashMap<>() {{ + put("src/main/kotlin/packagename/components/securityschemes/SecurityScheme.hbs", ".kt"); + }} + ); + jsonPathDocTemplateFiles.put( + CodegenConstants.JSON_PATH_LOCATION_TYPE.SECURITY_SCHEME, + new HashMap<>() {{ + put("src/main/kotlin/packagename/components/securityschemes/SecurityScheme_doc.hbs", ".md"); + }} + ); + } + List servers = openAPI.getServers(); + if (servers != null && !servers.isEmpty()) { + supportingFiles.add(new SupportingFile( + "src/main/kotlin/packagename/servers/Server.hbs", + packagePath() + File.separatorChar + "servers", + "Server.kt")); + supportingFiles.add(new SupportingFile( + "src/main/kotlin/packagename/servers/ServerProvider.hbs", + packagePath() + File.separatorChar + "servers", + "ServerProvider.kt")); + + supportingFiles.add(new SupportingFile( + "src/main/kotlin/packagename/servers/ServerWithoutVariables.hbs", + packagePath() + File.separatorChar + "servers", + "ServerWithoutVariables.kt")); + + supportingFiles.add(new SupportingFile( + "src/main/kotlin/packagename/servers/ServerWithVariables.hbs", + packagePath() + File.separatorChar + "servers", + "ServerWithVariables.kt")); + jsonPathTemplateFiles.put( + CodegenConstants.JSON_PATH_LOCATION_TYPE.SERVER, + new HashMap<>() {{ + put("src/main/kotlin/packagename/servers/ServerN.hbs", ".kt"); + }} + ); + jsonPathTemplateFiles.put( + CodegenConstants.JSON_PATH_LOCATION_TYPE.SERVERS, + new HashMap<>() {{ + put("src/main/kotlin/packagename/servers/ServerInfo.hbs", ".kt"); + }} + ); + jsonPathDocTemplateFiles.put( + CodegenConstants.JSON_PATH_LOCATION_TYPE.SERVERS, + new HashMap<>() {{ + put("src/main/kotlin/packagename/servers/ServerInfoDoc.hbs", ".md"); + }} + ); + jsonPathDocTemplateFiles.put( + CodegenConstants.JSON_PATH_LOCATION_TYPE.SERVER, + new HashMap<>() {{ + put("src/main/kotlin/packagename/servers/ServerDoc.hbs", ".md"); + }} + ); + } + } + + @Override + public void preprocessOpenAPI(OpenAPI openAPI) { + super.preprocessOpenAPI(openAPI); + if (openAPI == null) { + return; + } + + // TODO: Setting additionalProperties is not the responsibility of this method. These side-effects should be moved elsewhere to prevent unexpected behaviors. + if (artifactVersion == null) { + // If no artifactVersion is provided in additional properties, version from API specification is used. + // If none of them is provided then fallbacks to default version + if (additionalProperties.containsKey(CodegenConstants.ARTIFACT_VERSION) && additionalProperties.get(CodegenConstants.ARTIFACT_VERSION) != null) { + this.setArtifactVersion((String) additionalProperties.get(CodegenConstants.ARTIFACT_VERSION)); + } else if (openAPI.getInfo() != null && openAPI.getInfo().getVersion() != null) { + this.setArtifactVersion(openAPI.getInfo().getVersion()); + } else { + this.setArtifactVersion(ARTIFACT_VERSION_DEFAULT_VALUE); + } + } + // must be sequential after initial setting above + if (additionalProperties.containsKey(CodegenConstants.SNAPSHOT_VERSION)) { + final Object booleanValue = additionalProperties.get(CodegenConstants.SNAPSHOT_VERSION); + boolean result1 = Boolean.FALSE; + if (booleanValue instanceof Boolean) { + result1 = (Boolean) booleanValue; + } else if (booleanValue instanceof String) { + result1 = Boolean.parseBoolean((String) booleanValue); + } else { + LOGGER.warn("The value (generator's option) must be either boolean or string. Default to `false`."); + } + boolean result = result1; + additionalProperties.put(CodegenConstants.SNAPSHOT_VERSION, result); + if (result) { + this.setArtifactVersion(this.buildSnapshotVersion(this.getArtifactVersion())); + } + } + additionalProperties.put(CodegenConstants.ARTIFACT_VERSION, artifactVersion); + } + + private static String sanitizePackageName(String packageName) { + packageName = packageName.trim(); // FIXME: a parameter should not be assigned. Also declare the methods parameters as 'final'. + packageName = packageName.replaceAll("[^a-zA-Z0-9_\\.]", "_"); + if (Strings.isNullOrEmpty(packageName)) { + return "invalidPackageName"; + } + return packageName; + } + + public String getInvokerPackage() { + return invokerPackage; + } + + public void setInvokerPackage(String invokerPackage) { + this.invokerPackage = invokerPackage; + } + + public String getGroupId() { + return groupId; + } + + public void setGroupId(String groupId) { + this.groupId = groupId; + } + + public String getArtifactVersion() { + return artifactVersion; + } + + public void setArtifactVersion(String artifactVersion) { + this.artifactVersion = artifactVersion; + } + + public String getArtifactUrl() { + return artifactUrl; + } + + public void setArtifactUrl(String artifactUrl) { + this.artifactUrl = artifactUrl; + } + + public String getArtifactDescription() { + return artifactDescription; + } + + public void setArtifactDescription(String artifactDescription) { + this.artifactDescription = artifactDescription; + } + + public String getScmConnection() { + return scmConnection; + } + + public void setScmConnection(String scmConnection) { + this.scmConnection = scmConnection; + } + + public String getScmDeveloperConnection() { + return scmDeveloperConnection; + } + + public void setScmDeveloperConnection(String scmDeveloperConnection) { + this.scmDeveloperConnection = scmDeveloperConnection; + } + + public String getScmUrl() { + return scmUrl; + } + + public void setScmUrl(String scmUrl) { + this.scmUrl = scmUrl; + } + + public String getDeveloperName() { + return developerName; + } + + public void setDeveloperName(String developerName) { + this.developerName = developerName; + } + + public String getDeveloperEmail() { + return developerEmail; + } + + public void setDeveloperEmail(String developerEmail) { + this.developerEmail = developerEmail; + } + + public String getDeveloperOrganization() { + return developerOrganization; + } + + public void setDeveloperOrganization(String developerOrganization) { + this.developerOrganization = developerOrganization; + } + + public String getDeveloperOrganizationUrl() { + return developerOrganizationUrl; + } + + public void setDeveloperOrganizationUrl(String developerOrganizationUrl) { + this.developerOrganizationUrl = developerOrganizationUrl; + } + + public String getLicenseName() { + return licenseName; + } + + public void setLicenseName(String licenseName) { + this.licenseName = licenseName; + } + + public String getLicenseUrl() { + return licenseUrl; + } + + public void setLicenseUrl(String licenseUrl) { + this.licenseUrl = licenseUrl; + } + + public String getSourceFolder() { + return sourceFolder; + } + + public void setSourceFolder(String sourceFolder) { + this.sourceFolder = sourceFolder; + } + + public void setOutputTestFolder(String outputTestFolder) { + this.outputTestFolder = outputTestFolder; + } + + @Override + public String escapeQuotationMark(String input) { + // remove " to avoid code injection + return input.replace("\"", ""); + } + + /* + * Derive invoker package name based on the input + * e.g. foo.bar.model => foo.bar + * + * @param input API package/model name + * @return Derived invoker package name based on API package/model name + */ + private String deriveInvokerPackageName(String input) { + String[] parts = input.split(Pattern.quote(".")); // Split on period. + + StringBuilder sb = new StringBuilder(); + String delim = ""; + for (String p : Arrays.copyOf(parts, parts.length - 1)) { + sb.append(delim).append(p); + delim = "."; + } + return sb.toString(); + } + + /** + * Builds a SNAPSHOT version from a given version. + * + * @param version the version + * @return SNAPSHOT version + */ + private String buildSnapshotVersion(String version) { + if (version.endsWith("-SNAPSHOT")) { + return version; + } + return version + "-SNAPSHOT"; + } + + @Override + public void postProcessFile(File file, String fileType) { + if (file == null) { + return; + } + + String kotlinPostProcessFile = System.getenv("KOTLIN_POST_PROCESS_FILE"); + if (StringUtils.isEmpty(kotlinPostProcessFile)) { + return; // skip if KOTLIN_POST_PROCESS_FILE env variable is not defined + } + + // only process files with kotlin extension + if ("kt".equals(FilenameUtils.getExtension(file.toString()))) { + String command = kotlinPostProcessFile + " " + file; + try { + Process p = Runtime.getRuntime().exec(command); + p.waitFor(); + int exitValue = p.exitValue(); + if (exitValue != 0) { + LOGGER.error("Error running the command ({}). Exit value: {}", command, exitValue); + } else { + LOGGER.info("Successfully executed: {}", command); + } + } catch (InterruptedException | IOException e) { + LOGGER.error("Error running the command ({}). Exception: {}", command, e.getMessage()); + // Restore interrupted state + Thread.currentThread().interrupt(); + } + } + } + + public void setParentGroupId(final String parentGroupId) { + this.parentGroupId = parentGroupId; + } + + public void setParentArtifactId(final String parentArtifactId) { + this.parentArtifactId = parentArtifactId; + } + + public void setParentVersion(final String parentVersion) { + this.parentVersion = parentVersion; + } + + @Override + public boolean generateSeparateServerSchemas() { + return true; + } + + /** + * Convert OAS Property object to Codegen Property object + * We have a custom version of this method to always set allowableValues.enumVars on all enum variables + * Together with unaliasSchema this sets primitive types with validations as models + * This method is used by fromResponse + * + * @param p OAS property schema + * @return Codegen Property object + */ + @Override + public CodegenSchema fromSchema(Schema p, String sourceJsonPath, String currentJsonPath) { + // fix needed for values with /n /t etc. in them + CodegenSchema cp = super.fromSchema(p, sourceJsonPath, currentJsonPath); + if (cp.types != null && cp.types.contains("integer") && cp.format == null) { + // this generator treats integers as type number + // so integer validation info must be set using formatting + cp.format = "int"; + } + return cp; + } + + @Override + public boolean shouldGenerateFile(String jsonPath, boolean isDoc) { + // exclude certain collection jsonPaths + if (jsonPath.equals("#/components/responses")) { + return false; + } else if (jsonPath.equals("#/components/headers")) { + return false; + } else if (jsonPath.equals("#/components/parameters")) { + return false; + } + String[] pathPieces = jsonPath.split("/"); + if (pathPieces.length == 4 && jsonPath.endsWith("/parameters")) { + // #/paths/path/parameters + return false; + } + return true; + } + + @Override + public String toApiFilename(String name) { + return toApiName(name); + } + + @Override + public String toApiName(String name) { + if (name.isEmpty()) { + return "DefaultApi"; + } + String usedName = sanitizeName(name, "[^a-zA-Z0-9]+"); + // todo check if empty and if so them use enum name + // todo fix this, this does not handle names starting with numbers + if (usedName.isEmpty()) { + usedName = toEnumVarName(name, null).toLowerCase(Locale.ROOT); + } + usedName = camelize(usedName, false); + return usedName; + } + + protected String responsePathFromDocRoot(String sourceJsonPath) { + return getPathFromDocRoot(sourceJsonPath); + } +} diff --git a/src/main/java/org/openapijsonschematools/codegen/generators/generatorloader/GeneratorLoader.java b/src/main/java/org/openapijsonschematools/codegen/generators/generatorloader/GeneratorLoader.java index c671cde084b..0bc6f625288 100644 --- a/src/main/java/org/openapijsonschematools/codegen/generators/generatorloader/GeneratorLoader.java +++ b/src/main/java/org/openapijsonschematools/codegen/generators/generatorloader/GeneratorLoader.java @@ -21,6 +21,7 @@ import org.openapijsonschematools.codegen.config.WorkflowSettings; import org.openapijsonschematools.codegen.generators.Generator; import org.openapijsonschematools.codegen.generators.JavaClientGenerator; +import org.openapijsonschematools.codegen.generators.KotlinClientGenerator; import org.openapijsonschematools.codegen.generators.PythonClientGenerator; import java.lang.reflect.Constructor; @@ -36,7 +37,8 @@ public class GeneratorLoader { private static final Map> generatorNameToGenerator = Map.ofEntries( new AbstractMap.SimpleEntry<>(JavaClientGenerator.generatorMetadata.getName(), JavaClientGenerator.class), - new AbstractMap.SimpleEntry<>(PythonClientGenerator.generatorMetadata.getName(), PythonClientGenerator.class) + new AbstractMap.SimpleEntry<>(PythonClientGenerator.generatorMetadata.getName(), PythonClientGenerator.class), + new AbstractMap.SimpleEntry<>(KotlinClientGenerator.generatorMetadata.getName(), KotlinClientGenerator.class) ); public static Generator getGenerator(String name, GeneratorSettings generatorSettings, WorkflowSettings workflowSettings) { diff --git a/src/main/resources/kotlin/README.hbs b/src/main/resources/kotlin/README.hbs new file mode 100644 index 00000000000..a3b9e61dd2b --- /dev/null +++ b/src/main/resources/kotlin/README.hbs @@ -0,0 +1,245 @@ +# {{artifactId}} +{{#if appDescription}} +{{appDescription.original}} +{{/if}} + +This Kotlin package is automatically generated by the [OpenAPI JSON Schema Generator](https://github.com/openapi-json-schema-tools/openapi-json-schema-generator) project: + +- OpenAPI document version: {{appVersion}} +- Kotlin Package version: {{artifactVersion}} +- OpenAPI JSON Schema Generator, Generator: {{generatorClass}} +{{#if infoUrl}} + +For more information, please visit [{{{infoUrl}}}]({{{infoUrl}}}) +{{/if}} + +## Requirements + +1. Kotlin {{generatorLanguageVersion}} +2. Gradle + +## Installation + +To install the API client library to your local Maven repository, simply execute: + +```shell +gradle wrapper +gradlew clean build +``` + +### Gradle users + +Add this dependency to your project's build file: + +``` +repositories { + mavenCentral() // Needed if the '{{{artifactId}}}' jar has been published to maven centra + mavenLocal() // Needed if the '{{{artifactId}}}' jar has been published to the local maven repo +} + +dependencies { + implementation "{{{groupId}}}:{{{artifactId}}}:{{{artifactVersion}}}" +} +``` + +## Usage Notes +### Validation, Immutability, and Data Type +This Kotlin code validates data to schema classes and return back an immutable instance containing the data. This ensure that +- valid data cannot be mutated and become invalid to a set of schemas + - the one exception is that files are not immutable, so schema instances storing/sending/receiving files are not immutable + +Here is the mapping from json schema types to Kotlin types: + +| Json Schema Type | Kotlin Base Class | +| ---------------- | --------------- | +| object | FrozenMap (Map) | +| array | FrozenList (List) | +| string | String | +| number | Number (int, long, float, double) | +| integer | int, long, float, double (with values equal to integers) | +| boolean | boolean | +| null | Nothing? (null) | +| AnyType (unset) | Object? | + +### Storage of Json Schema Definition in Kotlin JsonSchema Classes +In openapi v3.0.3 there are ~ 28 json schema keywords. Almost all of them can apply if +type is unset. I have chosen to separate the storage of +- json schema definition info +- output classes for validated Map (json schema type object) payloads +- output classes for validated List (json schema type array) payloads + +
+ Reason + +This json schema data is stored in each class that is written for a schema, in a component or +other openapi document location. This class is only responsible for storing schema info. +Output classes like those that store map payloads are written separately and are +returned by the JsonSchema.validate method when that method is passed in Map input. +This prevents payload property access methods from +colliding with json schema definition. +
+ +### Json Schema Type Object +Most component schemas (models) are probably of type object. Which is a map data structure. +Json schema allows string keys in this map, which means schema properties can have key names that are +invalid Kotlin variable names. Names like: +- "hi-there" +- "1variable" +- "@now" +- " " +- "from" + +To allow these use cases to work, FrozenMap (which extends AbstractMap) is used as the base class of type object schemas. +This means that one can use normal Map methods on instances of these classes. + +
+ Other Details + +- getters are written for validly named required and optional properties +- null is only allowed in as a value if type: "null" was included or nullable: true was set + - because null is an allowed property value, it is not used to represent an unset property state +- if an optional property is requested and it does not exist in the Map, an UnsetPropertyException is thrown +
+ +### Json Schema Type + Format, Validated Data Storage +N schemas can be validated on the same payload. +To allow multiple schemas to validate, the data must be stored using one base class whether or not +a json schema format constraint exists in the schema. + +In json schema, type: number with no format validates both integers and floats, +so int and float values are stored for type number. + +
+ String + Date Example + +For example the string payload '2023-12-20' is validates to both of these schemas: +1. string only +``` +- type: string +``` +2. string and date format +``` +- type: string + format: date +``` +Because of use cases like this, a LocalDate is allowed as an input to this schema, but the data +is stored as a string. +
+ +## Getting Started + +Please follow the [installation procedure](#installation) and then use the JsonSchema classes in +{{packageName}}.components.schemas to validate input payloads and instances of validated Map and List +output classes. Json schemas allow multiple types for one schema, so a schema's validate method can have +allowed input and output types. +{{#each paths}} + {{#if @first}} + {{#each operations}} + {{#if @first}} + {{#each tags}} + {{#if @first}} + +## Code Sample +{{> src/main/kotlin/packagename/paths/path/verb/_OperationDocCodeSample this=../this apiSubpackage="apis.tags" apiContainerClass=className apiFullyQualifiedClass=className }} + {{/if}} + {{/each}} + {{/if}} + {{/each}} + {{/if}} +{{/each}} +{{#if servers}} + +## Servers +| server_index | Class | Description | +| ------------ | ----- | ----------- | + {{#each servers}} +| {{@key}} | [{{jsonPathPiece.pascalCase}}](docs/servers/{{jsonPathPiece.pascalCase}}.md) |{{#if description}} {{description.originalWithBr}}{{/if}} | + {{/each}} +{{/if}} +{{#if securitySchemes}} + +## Component SecuritySchemes +| Class | Description | +| ----- | ----------- | + {{#each securitySchemes}} + {{#with this}} +| [{{jsonPathPiece.pascalCase}}](docs/components/securityschemes/{{jsonPathPiece.snakeCase}}.md) |{{#if description}} {{description.originalWithBr}}{{/if}} | + {{/with}} + {{/each}} +{{/if}} +{{#if paths}} + +## Endpoints +All URIs are relative to the selected server +- The server is selected by passing in serverInfo + serverIndexInfo into configurations.ApiConfiguration +- The security info is selected by passing in securityInfo + securityIndexInfo into configurations.ApiConfiguration +- serverIndex + securityIndex can also be passed in to endpoint calls, see endpoint documentation + +| HTTP request | Methods | Description | +| ------------ | ------- | ----------- | + {{#each paths}} + {{#each operations}} +| {{../@key.original}} **{{@key.original}}** | {{#each tags}}[{{className}}.{{../operationId.camelCase}}](docs/apis/tags/{{className}}.md#{{../operationId.kebabCase}}) {{/each}} [{{../jsonPathPiece.pascalCase}}.{{method.camelCase}}](docs/apis/paths/{{../jsonPathPiece.pascalCase}}.md#{{method.kebabCase}}) [{{jsonPathPiece.pascalCase}}.{{method.pascalCase}}.{{method.camelCase}}](docs/{{pathFromDocRoot}}.md#{{method.kebabCase}}) |{{#if summary}} {{summary.originalWithBr}}{{/if}} | + {{/each}} + {{/each}} +{{/if}} +{{#if schemas}} + +## Component Schemas +| Class | Description | +| ----- | ----------- | + {{#each schemas}} + {{#with this}} +| [{{containerJsonPathPiece.pascalCase}}.{{jsonPathPiece.pascalCase}}](docs/components/schemas/{{containerJsonPathPiece.pascalCase}}.md#{{jsonPathPiece.kebabCase}}) |{{#if description}} {{description.originalWithBr}}{{/if}} | + {{/with}} + {{/each}} +{{/if}} +{{#if requestBodies}} + +## Component RequestBodies +| Class | Description | +| ----- | ----------- | + {{#each requestBodies}} + {{#with this}} +| [{{jsonPathPiece.pascalCase}}.{{jsonPathPiece.pascalCase}}1](docs/components/requestbodies/{{jsonPathPiece.pascalCase}}.md#{{jsonPathPiece.kebabCase}}1) |{{#if description}} {{description.originalWithBr}}{{/if}} | + {{/with}} + {{/each}} +{{/if}} +{{#if responses}} + +## Component Responses +| Class | Description | +| ----- | ----------- | + {{#each responses}} + {{#with this}} +| [{{jsonPathPiece.pascalCase}}.{{jsonPathPiece.pascalCase}}1](docs/components/responses/{{jsonPathPiece.pascalCase}}.md#{{jsonPathPiece.kebabCase}}1) |{{#if description}} {{description.originalWithBr}}{{/if}}| + {{/with}} + {{/each}} +{{/if}} +{{#if headers}} + +## Component Headers +| Class | Description | +| ----- | ----------- | + {{#each headers}} + {{#with this}} +| [{{jsonPathPiece.pascalCase}}.{{jsonPathPiece.pascalCase}}1](docs/components/headers/{{jsonPathPiece.pascalCase}}.md#{{jsonPathPiece.kebabCase}}1) |{{#if description}} {{description.originalWithBr}}{{/if}} | + {{/with}} + {{/each}} +{{/if}} +{{#if parameters}} + +## Component Parameters +| Class | Description | +| ----- | ----------- | + {{#each parameters}} + {{#with this}} +| [{{jsonPathPiece.pascalCase}}.{{jsonPathPiece.pascalCase}}1](docs/components/parameters/{{jsonPathPiece.pascalCase}}.md#{{jsonPathPiece.kebabCase}}1) |{{#if description}} {{description.originalWithBr}}{{/if}} | + {{/with}} + {{/each}} +{{/if}} +{{#if infoEmail}} + +## Author +{{infoEmail}} +{{/if}} diff --git a/src/main/resources/kotlin/_helper_footer_links.hbs b/src/main/resources/kotlin/_helper_footer_links.hbs new file mode 100644 index 00000000000..034a0373b9f --- /dev/null +++ b/src/main/resources/kotlin/_helper_footer_links.hbs @@ -0,0 +1 @@ +{{#if serversLink}}[[Back to Servers]]({{readmePath}}README.md#Servers) {{/if}}{{#if securitySchemesLink}}[[Back to Component Security Schemes]]({{readmePath}}README.md#Component-SecuritySchemes) {{/if}}{{#if endpointsLink}}[[Back to Endpoints]]({{readmePath}}README.md#Endpoints) {{/if}}{{#if schemasLink}}[[Back to Component Schemas]]({{readmePath}}README.md#Component-Schemas) {{/if}}{{#if responsesLink}}[[Back to Component Responses]]({{readmePath}}README.md#Component-Responses) {{/if}}{{#if requestBodiesLink}}[[Back to Component RequestBodies]]({{readmePath}}README.md#Component-RequestBodies) {{/if}}{{#if headersLink}}[[Back to Component Headers]]({{readmePath}}README.md#Component-Headers) {{/if}}{{#if parametersLink}}[[Back to Component Parameters]]({{readmePath}}README.md#Component-Parameters) {{/if}}[[Back to README]]({{readmePath}}README.md) \ No newline at end of file diff --git a/src/main/resources/kotlin/_helper_header.hbs b/src/main/resources/kotlin/_helper_header.hbs new file mode 100644 index 00000000000..ae847f70eeb --- /dev/null +++ b/src/main/resources/kotlin/_helper_header.hbs @@ -0,0 +1,15 @@ +/* +{{#if appName}} + {{{appName}}} +{{/if}} +{{#if appDescription}} + {{{appDescription.original}}} +{{/if}} +{{#if version}} + The version of the OpenAPI document: {{{version}}} +{{/if}} +{{#if infoEmail}} + Contact: {{{infoEmail}}} +{{/if}} + Generated by: https://github.com/openapi-json-schema-tools/openapi-json-schema-generator +*/ diff --git a/src/main/resources/kotlin/_helper_imports.hbs b/src/main/resources/kotlin/_helper_imports.hbs new file mode 100644 index 00000000000..617b31f6acc --- /dev/null +++ b/src/main/resources/kotlin/_helper_imports.hbs @@ -0,0 +1,3 @@ +{{#each imports}} +{{{.}}} +{{/each}} \ No newline at end of file diff --git a/src/main/resources/kotlin/build.gradle.hbs b/src/main/resources/kotlin/build.gradle.hbs new file mode 100644 index 00000000000..2b484053fcf --- /dev/null +++ b/src/main/resources/kotlin/build.gradle.hbs @@ -0,0 +1,64 @@ +import org.checkerframework.gradle.plugin.CheckerFrameworkExtension + +plugins { + `java-library` + `maven-publish` + id("org.checkerframework") version "0.6.33" +} + +repositories { + mavenLocal() + maven { + url = uri("https://repo.maven.apache.org/maven2/") + } +} + +dependencies { + implementation("org.checkerframework:checker-qual:3.42.0") + implementation("com.google.code.gson:gson:2.10.1") + testImplementation("junit:junit:4.13.2") + checkerFramework("org.checkerframework:checker:3.42.0") +} + +configure { + checkers = listOf( + "org.checkerframework.checker.nullness.NullnessChecker" + ) +} + +group = "{{groupId}}" +version = "{{artifactVersion}}" +description = "{{artifactDescription}}" + +val testsJar by tasks.registering(Jar::class) { + archiveClassifier = "tests" + from(sourceSets["test"].output) +} + +java { + toolchain { + languageVersion.set(JavaLanguageVersion.of(17)) + } + withSourcesJar() + withJavadocJar() +} + +publishing { + publications.create("maven") { + from(components["java"]) + artifact(testsJar) + } +} + +tasks.wrapper { + gradleVersion = "8.7" +} + +tasks.withType() { + options.encoding = "UTF-8" +} + +tasks.withType() { + enabled = false + options.encoding = "UTF-8" +} diff --git a/src/main/resources/kotlin/gitignore.hbs b/src/main/resources/kotlin/gitignore.hbs new file mode 100644 index 00000000000..3a4ec036d04 --- /dev/null +++ b/src/main/resources/kotlin/gitignore.hbs @@ -0,0 +1,9 @@ +build/ +.gradle/ +.idea/ +target/ + +# gradle wrapper +gradlew +gradlew.bat +gradle/ \ No newline at end of file diff --git a/src/main/resources/kotlin/settings.gradle.hbs b/src/main/resources/kotlin/settings.gradle.hbs new file mode 100644 index 00000000000..0a661d416eb --- /dev/null +++ b/src/main/resources/kotlin/settings.gradle.hbs @@ -0,0 +1,2 @@ +rootProject.name = "{{artifactId}}" + diff --git a/src/main/resources/kotlin/src/main/kotlin/packagename/apiclient/ApiClient.hbs b/src/main/resources/kotlin/src/main/kotlin/packagename/apiclient/ApiClient.hbs new file mode 100644 index 00000000000..6c88bcf8745 --- /dev/null +++ b/src/main/resources/kotlin/src/main/kotlin/packagename/apiclient/ApiClient.hbs @@ -0,0 +1,39 @@ +package {{packageName}}.apiclient; + +import org.checkerframework.checker.nullness.qual.Nullable; +import {{packageName}}.configurations.ApiConfiguration; +import {{packageName}}.configurations.SchemaConfiguration; + +import java.net.http.HttpClient; +import java.time.Duration; + +public class ApiClient { + protected final ApiConfiguration apiConfiguration; + protected final SchemaConfiguration schemaConfiguration; + protected final HttpClient client; + + public ApiClient(ApiConfiguration apiConfiguration, SchemaConfiguration schemaConfiguration) { + this.apiConfiguration = apiConfiguration; + this.schemaConfiguration = schemaConfiguration; + @Nullable Duration timeout = apiConfiguration.getTimeout(); + if (timeout != null) { + this.client = HttpClient.newBuilder() + .connectTimeout(timeout) + .build(); + } else { + this.client = HttpClient.newHttpClient(); + } + } + + public ApiConfiguration getApiConfiguration() { + return apiConfiguration; + } + + public SchemaConfiguration getSchemaConfiguration() { + return schemaConfiguration; + } + + public HttpClient getClient() { + return client; + } +} diff --git a/src/main/resources/kotlin/src/main/kotlin/packagename/apis/apis_path_to_api.hbs b/src/main/resources/kotlin/src/main/kotlin/packagename/apis/apis_path_to_api.hbs new file mode 100644 index 00000000000..51d32123e3a --- /dev/null +++ b/src/main/resources/kotlin/src/main/kotlin/packagename/apis/apis_path_to_api.hbs @@ -0,0 +1,23 @@ +import typing +import typing_extensions + +{{#each paths}} +from {{packageName}}.apis.paths.{{@key.snakeCase}} import {{@key.pascalCase}} +{{/each}} + +PathToApi = typing.TypedDict( + 'PathToApi', + { +{{#each paths}} + "{{{@key.original}}}": typing.Type[{{@key.pascalCase}}], +{{/each}} + } +) + +path_to_api = PathToApi( + { +{{#each paths}} + "{{{@key.original}}}": {{@key.pascalCase}}, +{{/each}} + } +) diff --git a/src/main/resources/kotlin/src/main/kotlin/packagename/apis/paths/Api.hbs b/src/main/resources/kotlin/src/main/kotlin/packagename/apis/paths/Api.hbs new file mode 100644 index 00000000000..810d50ea53f --- /dev/null +++ b/src/main/resources/kotlin/src/main/kotlin/packagename/apis/paths/Api.hbs @@ -0,0 +1,18 @@ +package {{packageName}}.apis.paths; + +import {{packageName}}.apiclient.ApiClient; +import {{packageName}}.configurations.ApiConfiguration; +import {{packageName}}.configurations.SchemaConfiguration; +{{#each pathItem.operations}} +import {{packageName}}.{{subpackage}}.{{jsonPathPiece.pascalCase}}; +{{/each}} + +public class {{pathItem.jsonPathPiece.pascalCase}} extends ApiClient implements +{{#each pathItem.operations}} + {{jsonPathPiece.pascalCase}}.{{method.pascalCase}}Operation{{#unless @last}},{{/unless}} +{{/each}} +{ + public {{pathItem.jsonPathPiece.pascalCase}}(ApiConfiguration apiConfiguration, SchemaConfiguration schemaConfiguration) { + super(apiConfiguration, schemaConfiguration); + } +} \ No newline at end of file diff --git a/src/main/resources/kotlin/src/main/kotlin/packagename/apis/paths/ApiDoc.hbs b/src/main/resources/kotlin/src/main/kotlin/packagename/apis/paths/ApiDoc.hbs new file mode 100644 index 00000000000..e9d41a37e0e --- /dev/null +++ b/src/main/resources/kotlin/src/main/kotlin/packagename/apis/paths/ApiDoc.hbs @@ -0,0 +1,49 @@ +# {{pathItem.jsonPathPiece.pascalCase}} + +public class {{pathItem.jsonPathPiece.pascalCase}} extends extends ApiClient implements +{{#each pathItem.operations}} +[{{jsonPathPiece.pascalCase}}.{{method.pascalCase}}Operation]({{docRoot}}{{pathFromDocRoot}}.md#{{method.kebabCase}}operation){{#unless @last}},{{/unless}} +{{/each}} + +{{#with pathItem}} +an api client class which contains all the routes for path="{{jsonPathPiece.original}}" + {{#if description}} +{{description.originalWithBr}} + {{/if}} +{{/with}} + +{{headerSize}}# Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +{{#each pathItem.operations}} +| {{#if nonErrorResponses }}{{#with responses}}[{{jsonPathPiece.pascalCase}}.EndpointResponse]({{docRoot}}{{pathFromDocRoot}}.md#endpointresponse){{/with}}{{else}}Nothing?{{/if}} | [{{method.camelCase}}](#{{method.kebabCase}})([{{jsonPathPiece.pascalCase}}.{{method.pascalCase}}Request]({{docRoot}}{{pathFromDocRoot}}.md#{{method.kebabCase}}request) request){{#if description}}
{{description.originalWithBr}}{{/if}} | +{{/each}} + +{{headerSize}}# Method Detail +{{#each pathItem.operations}} + +{{headerSize}}## {{method.camelCase}} +public {{#if nonErrorResponses }}{{#with responses}}[{{jsonPathPiece.pascalCase}}.EndpointResponse]({{docRoot}}{{pathFromDocRoot}}.md#endpointresponse){{/with}}{{else}}Nothing?{{/if}} {{method.camelCase}}([{{jsonPathPiece.pascalCase}}.{{method.pascalCase}}Request]({{docRoot}}{{pathFromDocRoot}}.md#{{method.kebabCase}}request) request) +{{#if description}} + +{{description.originalWithBr}} +{{/if}} + +**Parameters:**
+request - the input request + +**Returns:**
+{{#if nonErrorResponses }}the deserialized response{{else}}nothing (Nothing?){{/if}} + +**Throws:**
+IOException, InterruptedException - an exception happened when making the request
+ValidationException - the returned response body or header values do not conform the the schema validation requirements
+NotImplementedException - the request body serialization or deserialization has not yet been implemented
+ or the header content type deserialization has not yet been implemented for this contentType
+ApiException - server returned a response/contentType not defined in the openapi document
+ +{{headerSize}}### Code Sample +{{> src/main/kotlin/packagename/paths/path/verb/_OperationDocCodeSample apiSubpackage="apis.paths" apiContainerClass=pathItem.jsonPathPiece.pascalCase apiFullyQualifiedClass=pathItem.jsonPathPiece.pascalCase }} +{{/each}} + +[[Back to top]](#top) {{> _helper_footer_links readmePath="../../../" endpointLink=true}} diff --git a/src/main/resources/kotlin/src/main/kotlin/packagename/apis/tags/Api.hbs b/src/main/resources/kotlin/src/main/kotlin/packagename/apis/tags/Api.hbs new file mode 100644 index 00000000000..e267977a943 --- /dev/null +++ b/src/main/resources/kotlin/src/main/kotlin/packagename/apis/tags/Api.hbs @@ -0,0 +1,18 @@ +package {{packageName}}.apis.tags; + +import {{packageName}}.apiclient.ApiClient; +import {{packageName}}.configurations.ApiConfiguration; +import {{packageName}}.configurations.SchemaConfiguration; +{{#each operations}} +import {{packageName}}.{{subpackage}}.{{jsonPathPiece.pascalCase}}; +{{/each}} + +public class {{tag.className}} extends ApiClient implements +{{#each operations}} + {{jsonPathPiece.pascalCase}}.{{operationId.pascalCase}}Operation{{#unless @last}},{{/unless}} +{{/each}} +{ + public {{tag.className}}(ApiConfiguration apiConfiguration, SchemaConfiguration schemaConfiguration) { + super(apiConfiguration, schemaConfiguration); + } +} \ No newline at end of file diff --git a/src/main/resources/kotlin/src/main/kotlin/packagename/apis/tags/ApiDoc.hbs b/src/main/resources/kotlin/src/main/kotlin/packagename/apis/tags/ApiDoc.hbs new file mode 100644 index 00000000000..3ed34ee7ed8 --- /dev/null +++ b/src/main/resources/kotlin/src/main/kotlin/packagename/apis/tags/ApiDoc.hbs @@ -0,0 +1,49 @@ +# {{tag.className}} + +public class {{tag.className}} extends extends ApiClient implements +{{#each operations}} +[{{jsonPathPiece.pascalCase}}.{{operationId.pascalCase}}Operation]({{docRoot}}{{pathFromDocRoot}}.md#{{operationId.kebabCase}}operation){{#unless @last}},{{/unless}} +{{/each}} + +{{#with tag}} +an api client class which contains all the routes for tag="{{name}}" + {{#if description}} +{{description.originalWithBr}} + {{/if}} +{{/with}} + +{{headerSize}}# Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +{{#each operations}} +| {{#if nonErrorResponses }}{{#with responses}}[{{jsonPathPiece.pascalCase}}.EndpointResponse]({{docRoot}}{{pathFromDocRoot}}.md#endpointresponse){{/with}}{{else}}Nothing?{{/if}} | [{{operationId.camelCase}}](#{{operationId.kebabCase}})([{{jsonPathPiece.pascalCase}}.{{method.pascalCase}}Request]({{docRoot}}{{pathFromDocRoot}}.md#{{method.kebabCase}}request) request){{#if description}}
{{description.originalWithBr}}{{/if}} | +{{/each}} + +{{headerSize}}# Method Detail +{{#each operations}} + +{{headerSize}}## {{operationId.camelCase}} +public {{#if nonErrorResponses }}{{#with responses}}[{{jsonPathPiece.pascalCase}}.EndpointResponse]({{docRoot}}{{pathFromDocRoot}}.md#endpointresponse){{/with}}{{else}}Nothing?{{/if}} {{operationId.camelCase}}([{{jsonPathPiece.pascalCase}}.{{method.pascalCase}}Request]({{docRoot}}{{pathFromDocRoot}}.md#{{method.kebabCase}}request) request) +{{#if description}} + +{{description.originalWithBr}} +{{/if}} + +**Parameters:**
+request - the input request + +**Returns:**
+{{#if nonErrorResponses }}the deserialized response{{else}}nothing (Nothing?){{/if}} + +**Throws:**
+IOException, InterruptedException - an exception happened when making the request
+ValidationException - the returned response body or header values do not conform the the schema validation requirements
+NotImplementedException - the request body serialization or deserialization has not yet been implemented
+ or the header content type deserialization has not yet been implemented for this contentType
+ApiException - server returned a response/contentType not defined in the openapi document
+ +{{headerSize}}### Code Sample +{{> src/main/kotlin/packagename/paths/path/verb/_OperationDocCodeSample apiSubpackage="apis.tags" apiContainerClass=tag.className apiFullyQualifiedClass=tag.className }} +{{/each}} + +[[Back to top]](#top) {{> _helper_footer_links readmePath="../../../" endpointLink=true}} diff --git a/src/main/resources/kotlin/src/main/kotlin/packagename/components/_helper_anchor_id.hbs b/src/main/resources/kotlin/src/main/kotlin/packagename/components/_helper_anchor_id.hbs new file mode 100644 index 00000000000..7046166f3a3 --- /dev/null +++ b/src/main/resources/kotlin/src/main/kotlin/packagename/components/_helper_anchor_id.hbs @@ -0,0 +1 @@ +{{#each identifierPieces}}{{#if this.kebabCase}}{{this.kebabCase}}{{else}}{{this}}{{/if}}{{#unless @last}}-{{/unless}}{{/each}} \ No newline at end of file diff --git a/src/main/resources/kotlin/src/main/kotlin/packagename/components/_helper_header_from_identifier_pieces.hbs b/src/main/resources/kotlin/src/main/kotlin/packagename/components/_helper_header_from_identifier_pieces.hbs new file mode 100644 index 00000000000..26dc623c609 --- /dev/null +++ b/src/main/resources/kotlin/src/main/kotlin/packagename/components/_helper_header_from_identifier_pieces.hbs @@ -0,0 +1 @@ +{{headerSize}} {{#each identifierPieces}}{{#if this.pascalCase}}{{this.pascalCase}}{{else}}{{this}}{{/if}}{{#unless @last}} {{/unless}}{{/each}} diff --git a/src/main/resources/kotlin/src/main/kotlin/packagename/components/headers/Header.hbs b/src/main/resources/kotlin/src/main/kotlin/packagename/components/headers/Header.hbs new file mode 100644 index 00000000000..1c5801e2e0b --- /dev/null +++ b/src/main/resources/kotlin/src/main/kotlin/packagename/components/headers/Header.hbs @@ -0,0 +1,72 @@ +{{#with header}} +package {{packageName}}.{{subpackage}}; + +{{#if refInfo}} + {{#neq subpackage refInfo.ref.subpackage}} + {{! must be in different packages }} + {{#neq jsonPathPiece.pascalCase refInfo.ref.jsonPathPiece.pascalCase}} + {{! class names must differ }} +import {{packageName}}.{{refInfo.ref.subpackage}}.{{refInfo.refModule}}; + {{/neq}} + {{/neq}} +{{#neq jsonPathPiece.pascalCase refInfo.ref.jsonPathPiece.pascalCase}} + +public class {{jsonPathPiece.pascalCase}} extends {{refInfo.refModule}} { + public static class {{jsonPathPiece.pascalCase}}1 extends {{refInfo.refModule}}1 {} +} +{{else}} +public class {{jsonPathPiece.pascalCase}} extends {{packageName}}.{{refInfo.ref.subpackage}}.{{refInfo.refModule}} {} +{{/neq}} +{{else}} + {{#if schema}} +import {{packageName}}.header.SchemaHeader; + {{#with schema}} +import {{{packageName}}}.{{subpackage}}.{{containerJsonPathPiece.pascalCase}}; + {{/with}} + {{/if}} + {{#if content}} +import {{packageName}}.header.ContentHeader; +import {{packageName}}.mediatype.MediaType; + {{#each content}} + {{#with schema}} +import {{{packageName}}}.{{subpackage}}.{{containerJsonPathPiece.pascalCase}}; + {{/with}} + {{/each}} + +import java.util.AbstractMap; + {{/if}} + +public class {{jsonPathPiece.pascalCase}} { + {{#each content}} + + public record {{@key.pascalCase}}MediaType({{#with this}}{{#with schema}}{{containerJsonPathPiece.pascalCase}}.{{jsonPathPiece.pascalCase}} schema{{/with}}{{/with}}) implements MediaType<{{#with this}}{{#with schema}}{{containerJsonPathPiece.pascalCase}}.{{jsonPathPiece.pascalCase}}{{/with}}{{/with}}, Nothing?> { + public {{@key.pascalCase}}MediaType() { + this({{#with this}}{{#with schema}}{{containerJsonPathPiece.pascalCase}}.{{jsonPathPiece.pascalCase}}.getInstance(){{/with}}{{/with}}); + } + @Override + public Nothing? encoding() { + return null; + } + } + {{/each}} + + public static class {{jsonPathPiece.pascalCase}}1 extends {{#if schema}}SchemaHeader{{else}}ContentHeader{{/if}} { + public {{jsonPathPiece.pascalCase}}1() { + super( + {{#eq required null}}false{{else}}{{required}}{{/eq}}, + null, + {{#eq explode null}}null{{else}}{{explode}}{{/eq}}, + {{#if schema}} + {{#with schema}}{{containerJsonPathPiece.pascalCase}}.{{jsonPathPiece.pascalCase}}.getInstance(){{/with}} + ); + {{else}} + {{#each content}} + new AbstractMap.SimpleEntry<>("{{{@key.original}}}", new {{@key.pascalCase}}MediaType()) + {{/each}} + ); + {{/if}} + } + } +} +{{/if}} +{{/with}} \ No newline at end of file diff --git a/src/main/resources/kotlin/src/main/kotlin/packagename/components/headers/HeaderDoc.hbs b/src/main/resources/kotlin/src/main/kotlin/packagename/components/headers/HeaderDoc.hbs new file mode 100644 index 00000000000..f208ba5acfd --- /dev/null +++ b/src/main/resources/kotlin/src/main/kotlin/packagename/components/headers/HeaderDoc.hbs @@ -0,0 +1,97 @@ +{{#with header}} +{{#eq identifierPieces.size 0}} +{{> src/main/kotlin/packagename/components/_helper_header_from_identifier_pieces identifierPieces=(append identifierPieces jsonPathPiece) }} +{{else}} +{{> src/main/kotlin/packagename/components/_helper_header_from_identifier_pieces }} +{{/eq}} +{{#if componentModule}} +{{jsonPathPiece.pascalCase}}.java +{{/if}} + +{{#if refInfo}} +public class {{jsonPathPiece.pascalCase}} extends [{{refInfo.refClass}}](../../components/headers/{{refInfo.refClass}}.md) + +A class (extended from the $ref class) that contains necessary nested header classes +- a class that extends SchemaHeader/ContentHeader and is used to deserialize header content + +{{headerSize}}# Nested Class Summary +| Modifier and Type | Class and Description | +| ----------------- | --------------------- | +| static class | [{{jsonPathPiece.pascalCase}}.{{jsonPathPiece.pascalCase}}1](#{{> src/main/kotlin/packagename/components/_helper_anchor_id identifierPieces=(append identifierPieces (join jsonPathPiece.kebabCase "1" "")) }})
class that deserializes header value | + +{{> src/main/kotlin/packagename/components/_helper_header_from_identifier_pieces headerSize=(join headerSize "#" "") identifierPieces=(append identifierPieces (join jsonPathPiece.pascalCase "1" "")) }} +public static class {{jsonPathPiece.pascalCase}}1 extends [{{refInfo.refClass}}](../../components/headers/{{refInfo.refClass}}.md#{{refInfo.ref.jsonPathPiece.kebabCase}}1)
+ +a class that deserializes header, extended from the $ref class + +{{else}} +public class {{jsonPathPiece.pascalCase}} + +A class that contains necessary nested header classes +{{#if content}} +- a class that implements MediaType to store content schema info +{{/if}} +- a class that extends SchemaHeader/ContentHeader and is used to deserialize the header value + +{{headerSize}}# Nested Class Summary +| Modifier and Type | Class and Description | +| ----------------- | --------------------- | +{{#each content}} +| record | [{{jsonPathPiece.pascalCase}}.{{@key.pascalCase}}MediaType](#{{@key.kebabCase}}mediatype)
record storing schema + encoding for a specific contentType | +{{/each}} +| static class | [{{jsonPathPiece.pascalCase}}.{{jsonPathPiece.pascalCase}}1](#{{> src/main/kotlin/packagename/components/_helper_anchor_id identifierPieces=(append identifierPieces (join jsonPathPiece.kebabCase "1" "")) }})
class that deserializes a header | + +{{#each content}} + +{{> src/main/kotlin/packagename/components/_helper_header_from_identifier_pieces headerSize=(join headerSize "#" "") identifierPieces=(append identifierPieces (join @key.pascalCase "MediaType" "")) }} +public record {{@key.pascalCase}}MediaType
+implements [MediaType<{{#with this}}{{#with schema}}[{{containerJsonPathPiece.pascalCase}}.{{jsonPathPiece.pascalCase}}]({{docRoot}}{{pathFromDocRoot}}.md#{{jsonPathPiece.kebabCase}}){{/with}}{{/with}}, Nothing?> + +class storing schema info for a specific contentType + +{{headerSize}}## Constructor Summary +| Constructor and Description | +| --------------------------- | +| {{@key.pascalCase}}MediaType()
Creates an instance | + +{{headerSize}}## Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| {{#with this}}{{#with schema}}[{{containerJsonPathPiece.pascalCase}}.{{jsonPathPiece.pascalCase}}]({{docRoot}}{{pathFromDocRoot}}.md#{{jsonPathPiece.kebabCase}}){{/with}}{{/with}} | schema()
the schema for this MediaType | +| Nothing? | encoding()
the encoding info | +{{/each}} + +{{> src/main/kotlin/packagename/components/_helper_header_from_identifier_pieces headerSize=(join headerSize "#" "") identifierPieces=(append identifierPieces (join jsonPathPiece.pascalCase "1" "")) }} +public static class {{jsonPathPiece.pascalCase}}1 implements Header
+ +a class that deserializes a header value + +{{headerSize}}## Constructor Summary +| Constructor and Description | +| --------------------------- | +| {{jsonPathPiece.pascalCase}}1()
Creates an instance | + +{{headerSize}}## Field Summary +| Modifier and Type | Field and Description | +| ----------------- | --------------------- | +| boolean | required = {{#eq required null}}false{{else}}{{required}}{{/eq}}
whether the header is required | +| @Nullable ParameterStyle | ParameterStyle.SIMPLE | +| @Nullable Boolean explode | {{explode}} | +| @Nullable Boolean allowReserved | null | + {{#each content}} +| AbstractMap.SimpleEntry | content = new AbstractMap.SimpleEntry<>("{{{@key.original}}}", new [{{@key.pascalCase}}MediaType](#{{@key.kebabCase}}mediatype)())
the contentType to schema info | + {{else}} +| JsonSchema | schema = {{#with schema}}[{{containerJsonPathPiece.pascalCase}}.{{jsonPathPiece.pascalCase}}]({{docRoot}}{{pathFromDocRoot}}.md#{{jsonPathPiece.kebabCase}})().getInstance(){{/with}} + {{/each}} + +{{headerSize}}## Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| HttpHeaders | serialize(@Nullable Object inData, String name, boolean validate, SchemaConfiguration configuration) | +| @Nullable Object | deserialize(List<String> inData, boolean validate, SchemaConfiguration configuration)
deserializes the header value | +{{/if}} +{{#if componentModule}} + +[[Back to top]](#top) {{> _helper_footer_links readmePath="../../../" headersLink=true}} +{{/if}} +{{/with}} \ No newline at end of file diff --git a/src/main/resources/kotlin/src/main/kotlin/packagename/components/parameter/Parameter.hbs b/src/main/resources/kotlin/src/main/kotlin/packagename/components/parameter/Parameter.hbs new file mode 100644 index 00000000000..0366d444265 --- /dev/null +++ b/src/main/resources/kotlin/src/main/kotlin/packagename/components/parameter/Parameter.hbs @@ -0,0 +1,78 @@ +{{#with parameter}} +package {{packageName}}.{{subpackage}}; + +{{#if refInfo}} + {{#neq subpackage refInfo.ref.subpackage}} + {{! must be in different packages }} + {{#neq jsonPathPiece.pascalCase refInfo.ref.jsonPathPiece.pascalCase}} + {{! class names must differ }} +import {{packageName}}.{{refInfo.ref.subpackage}}.{{refInfo.refModule}}; + {{/neq}} + {{/neq}} +{{#neq jsonPathPiece.pascalCase refInfo.ref.jsonPathPiece.pascalCase}} + +public class {{jsonPathPiece.pascalCase}} extends {{refInfo.refModule}} { + public static class {{jsonPathPiece.pascalCase}}1 extends {{refInfo.refModule}}1 {} +} +{{else}} +public class {{jsonPathPiece.pascalCase}} extends {{packageName}}.{{refInfo.ref.subpackage}}.{{refInfo.refModule}} {} +{{/neq}} +{{else}} + {{#neq style null}} +import {{packageName}}.parameter.ParameterStyle; + {{/neq}} +import {{packageName}}.parameter.ParameterInType; + {{#if schema}} +import {{packageName}}.parameter.SchemaParameter; + {{#with schema}} +import {{{packageName}}}.{{subpackage}}.{{containerJsonPathPiece.pascalCase}}; + {{/with}} + {{/if}} + {{#if content}} +import {{packageName}}.parameter.ContentParameter; +import {{packageName}}.mediatype.MediaType; + {{#each content}} + {{#with schema}} +import {{{packageName}}}.{{subpackage}}.{{containerJsonPathPiece.pascalCase}}; + {{/with}} + {{/each}} + +import java.util.AbstractMap; + {{/if}} + +public class {{jsonPathPiece.pascalCase}} { + {{#each content}} + + public record {{@key.pascalCase}}MediaType({{#with this}}{{#with schema}}{{containerJsonPathPiece.pascalCase}}.{{jsonPathPiece.pascalCase}} schema{{/with}}{{/with}}) implements MediaType<{{#with this}}{{#with schema}}{{containerJsonPathPiece.pascalCase}}.{{jsonPathPiece.pascalCase}}{{/with}}{{/with}}, Nothing?> { + public {{@key.pascalCase}}MediaType() { + this({{#with this}}{{#with schema}}{{containerJsonPathPiece.pascalCase}}.{{jsonPathPiece.pascalCase}}.getInstance(){{/with}}{{/with}}); + } + @Override + public Nothing? encoding() { + return null; + } + } + {{/each}} + + public static class {{jsonPathPiece.pascalCase}}1 extends {{#if schema}}Schema{{else}}Content{{/if}}Parameter { + public {{jsonPathPiece.pascalCase}}1() { + super( + "{{{name}}}", + ParameterInType.{{#eq in "query"}}QUERY{{else}}{{#eq in "path"}}PATH{{else}}{{#eq in "header"}}HEADER{{else}}{{#eq in "cookie"}}COOKIE{{/eq}}{{/eq}}{{/eq}}{{/eq}}, + {{#eq required null}}false{{else}}{{required}}{{/eq}}, + {{#eq style null}}null{{else}}ParameterStyle.{{#eq style "matrix"}}MATRIX{{else}}{{#eq style "label"}}LABEL{{else}}{{#eq style "form"}}FORM{{else}}{{#eq style "simple"}}SIMPLE{{else}}{{#eq style "spaceDelimited"}}SPACE_DELIMITED{{else}}{{#eq style "pipeDelimited"}}PIPE_DELIMITED{{else}}{{#eq style "deepObject"}}DEEP_OBJECT{{/eq}}{{/eq}}{{/eq}}{{/eq}}{{/eq}}{{/eq}}{{/eq}}{{/eq}}, + {{#eq explode null}}null{{else}}{{explode}}{{/eq}}, + {{#eq allowReserved null}}false{{else}}{{allowReserved}}{{/eq}}, + {{#if schema}} + {{#with schema}}{{containerJsonPathPiece.pascalCase}}.{{jsonPathPiece.pascalCase}}.getInstance(){{/with}} + {{else}} + {{#each content}} + new AbstractMap.SimpleEntry<>("{{{@key.original}}}", new {{@key.pascalCase}}MediaType()) + {{/each}} + {{/if}} + ); + } + } +} +{{/if}} +{{/with}} \ No newline at end of file diff --git a/src/main/resources/kotlin/src/main/kotlin/packagename/components/parameter/ParameterDoc.hbs b/src/main/resources/kotlin/src/main/kotlin/packagename/components/parameter/ParameterDoc.hbs new file mode 100644 index 00000000000..be7c48964ad --- /dev/null +++ b/src/main/resources/kotlin/src/main/kotlin/packagename/components/parameter/ParameterDoc.hbs @@ -0,0 +1,98 @@ +{{#with parameter}} +{{#eq identifierPieces.size 0}} +{{> src/main/kotlin/packagename/components/_helper_header_from_identifier_pieces identifierPieces=(append identifierPieces jsonPathPiece) }} +{{else}} +{{> src/main/kotlin/packagename/components/_helper_header_from_identifier_pieces }} +{{/eq}} +{{#if componentModule}} +{{jsonPathPiece.pascalCase}}.java +{{/if}} + +{{#if refInfo}} +public class {{jsonPathPiece.pascalCase}} extends [{{refInfo.refClass}}](../../components/parameters/{{refInfo.refClass}}.md) + +A class (extended from the $ref class) that contains necessary nested parameter classes +- a class that extends SchemaHeader/ContentHeader and is used to deserialize parameter content + +{{headerSize}}# Nested Class Summary +| Modifier and Type | Class and Description | +| ----------------- | --------------------- | +| static class | [{{jsonPathPiece.pascalCase}}.{{jsonPathPiece.pascalCase}}1](#{{> src/main/kotlin/packagename/components/_helper_anchor_id identifierPieces=(append identifierPieces (join jsonPathPiece.kebabCase "1" "")) }})
class that deserializes parameter value | + +{{> src/main/kotlin/packagename/components/_helper_header_from_identifier_pieces headerSize=(join headerSize "#" "") identifierPieces=(append identifierPieces (join jsonPathPiece.pascalCase "1" "")) }} +public static class {{jsonPathPiece.pascalCase}}1 extends [{{refInfo.refClass}}](../../components/parameters/{{refInfo.refClass}}.md#{{refInfo.ref.jsonPathPiece.kebabCase}}1)
+ +a class that deserializes parameter, extended from the $ref class + +{{else}} +public class {{jsonPathPiece.pascalCase}} + +A class that contains necessary nested parameter classes +{{#if content}} +- a class that implements MediaType to store content schema info +{{/if}} +- a class that extends SchemaHeader/ContentHeader and is used to deserialize the parameter value + +{{headerSize}}# Nested Class Summary +| Modifier and Type | Class and Description | +| ----------------- | --------------------- | +{{#each content}} +| record | [{{jsonPathPiece.pascalCase}}.{{@key.pascalCase}}MediaType](#{{@key.kebabCase}}mediatype)
record storing schema + encoding for a specific contentType | +{{/each}} +| static class | [{{jsonPathPiece.pascalCase}}.{{jsonPathPiece.pascalCase}}1](#{{> src/main/kotlin/packagename/components/_helper_anchor_id identifierPieces=(append identifierPieces (join jsonPathPiece.kebabCase "1" "")) }})
class that deserializes a parameter | + +{{#each content}} + +{{> src/main/kotlin/packagename/components/_helper_header_from_identifier_pieces headerSize=(join headerSize "#" "") identifierPieces=(append identifierPieces (join @key.pascalCase "MediaType" "")) }} +public record {{@key.pascalCase}}MediaType
+implements [MediaType<{{#with this}}{{#with schema}}[{{containerJsonPathPiece.pascalCase}}.{{jsonPathPiece.pascalCase}}]({{docRoot}}{{pathFromDocRoot}}.md#{{jsonPathPiece.kebabCase}}){{/with}}{{/with}}, Nothing?> + +class storing schema info for a specific contentType + +{{headerSize}}## Constructor Summary +| Constructor and Description | +| --------------------------- | +| {{@key.pascalCase}}MediaType()
Creates an instance | + +{{headerSize}}## Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| {{#with this}}{{#with schema}}[{{containerJsonPathPiece.pascalCase}}.{{jsonPathPiece.pascalCase}}]({{docRoot}}{{pathFromDocRoot}}.md#{{jsonPathPiece.kebabCase}}){{/with}}{{/with}} | schema()
the schema for this MediaType | +| Nothing? | encoding()
the encoding info | +{{/each}} + +{{> src/main/kotlin/packagename/components/_helper_header_from_identifier_pieces headerSize=(join headerSize "#" "") identifierPieces=(append identifierPieces (join jsonPathPiece.pascalCase "1" "")) }} +public static class {{jsonPathPiece.pascalCase}}1 extends {{#if schema}}Schema{{else}}Content{{/if}}Parameter
+ +a class that deserializes a parameter value + +{{headerSize}}## Constructor Summary +| Constructor and Description | +| --------------------------- | +| {{jsonPathPiece.pascalCase}}1()
Creates an instance | + +{{headerSize}}## Field Summary +| Modifier and Type | Field and Description | +| ----------------- | --------------------- | +| String | name = "{{{name}}}"
the parameter name | +| ParameterInType | inType = ParameterInType.{{#eq in "query"}}QUERY{{else}}{{#eq in "path"}}PATH{{else}}{{#eq in "header"}}HEADER{{else}}{{#eq in "cookie"}}COOKIE{{/eq}}{{/eq}}{{/eq}}{{/eq}}
the parameter in value | +| boolean | required = {{#eq required null}}false{{else}}{{required}}{{/eq}}
whether the parameter is required | +| @Nullable Boolean explode | {{#eq explode null}}null{{else}}{{explode}}{{/eq}} | +| @Nullable ParameterStyle | {{#eq style null}}null{{else}}ParameterStyle.{{#eq style "matrix"}}MATRIX{{else}}{{#eq style "label"}}LABEL{{else}}{{#eq style "form"}}FORM{{else}}{{#eq style "simple"}}SIMPLE{{else}}{{#eq style "spaceDelimited"}}SPACE_DELIMITED{{else}}{{#eq style "pipeDelimited"}}PIPE_DELIMITED{{else}}{{#eq style "deepObject"}}DEEP_OBJECT{{/eq}}{{/eq}}{{/eq}}{{/eq}}{{/eq}}{{/eq}}{{/eq}}{{/eq}} | +| @Nullable Boolean allowReserved | {{#eq allowReserved null}}false{{else}}{{allowReserved}}{{/eq}} | + {{#each content}} +| AbstractMap.SimpleEntry | content = new AbstractMap.SimpleEntry<>("{{{@key.original}}}", new [{{@key.pascalCase}}MediaType](#{{@key.kebabCase}}mediatype)())
the contentType to schema info | + {{else}} +| JsonSchema | schema = {{#with schema}}[{{containerJsonPathPiece.pascalCase}}.{{jsonPathPiece.pascalCase}}]({{docRoot}}{{pathFromDocRoot}}.md#{{jsonPathPiece.kebabCase}})().getInstance(){{/with}} + {{/each}} + +{{headerSize}}## Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| Map | serialize(@Nullable Object inData, boolean validate, SchemaConfiguration configuration{{#eq in "query"}}, PrefixSeparatorIterator iterator{{/eq}})
deserializes the parameter value | +{{/if}} +{{#if componentModule}} + +[[Back to top]](#top) {{> _helper_footer_links readmePath="../../../" parametersLink=true}} +{{/if}} +{{/with}} \ No newline at end of file diff --git a/src/main/resources/kotlin/src/main/kotlin/packagename/components/requestbodies/RequestBody.hbs b/src/main/resources/kotlin/src/main/kotlin/packagename/components/requestbodies/RequestBody.hbs new file mode 100644 index 00000000000..cdb2b64f656 --- /dev/null +++ b/src/main/resources/kotlin/src/main/kotlin/packagename/components/requestbodies/RequestBody.hbs @@ -0,0 +1,92 @@ +{{#with requestBody}} +package {{packageName}}.{{subpackage}}; + +{{#if refInfo}} + {{#neq subpackage refInfo.ref.subpackage}} +import {{packageName}}.{{refInfo.ref.subpackage}}.{{refInfo.refModule}}; + {{/neq}} + +public class {{jsonPathPiece.pascalCase}} extends {{refInfo.refModule}} { + public static class {{jsonPathPiece.pascalCase}}1 extends {{refInfo.refModule}}1 {} +} +{{else}} +import {{packageName}}.exceptions.NotImplementedException; +import {{packageName}}.requestbody.RequestBodySerializer; +import {{packageName}}.requestbody.GenericRequestBody; +import {{packageName}}.requestbody.SerializedRequestBody; +import {{packageName}}.mediatype.MediaType; + {{#each content}} + {{#with schema}} +import {{{packageName}}}.{{subpackage}}.{{containerJsonPathPiece.pascalCase}}; + {{/with}} + {{/each}} + +import java.util.AbstractMap; +import java.util.Map; + +public class {{jsonPathPiece.pascalCase}} { + {{#if content}} + public sealed interface SealedMediaType permits {{#each content}}{{@key.pascalCase}}MediaType{{#unless @last}}, {{/unless}}{{/each}} {} + {{/if}} + {{#each content}} + + public record {{@key.pascalCase}}MediaType({{#with this}}{{#with schema}}{{containerJsonPathPiece.pascalCase}}.{{jsonPathPiece.pascalCase}} schema{{/with}}{{/with}}) implements SealedMediaType, MediaType<{{#with this}}{{#with schema}}{{containerJsonPathPiece.pascalCase}}.{{jsonPathPiece.pascalCase}}{{/with}}{{/with}}, Nothing?> { + public {{@key.pascalCase}}MediaType() { + this({{#with this}}{{#with schema}}{{containerJsonPathPiece.pascalCase}}.{{jsonPathPiece.pascalCase}}.getInstance(){{/with}}{{/with}}); + } + @Override + public Nothing? encoding() { + return null; + } + } + {{/each}} + + public static class {{jsonPathPiece.pascalCase}}1 extends RequestBodySerializer { + public {{jsonPathPiece.pascalCase}}1() { + super( + Map.ofEntries( + {{#each content}} + new AbstractMap.SimpleEntry<>("{{{@key.original}}}", new {{@key.pascalCase}}MediaType()){{#unless @last}},{{/unless}} + {{/each}} + ), + {{#if required}}true{{else}}false{{/if}} + ); + } + + public SerializedRequestBody serialize(SealedRequestBody requestBody) throws NotImplementedException { + {{#eq content.size 1}} + {{#each content}} + {{@key.pascalCase}}RequestBody requestBody{{@index}} = ({{@key.pascalCase}}RequestBody) requestBody; + return serialize(requestBody{{@index}}.contentType(), requestBody{{@index}}.body().getData()); + {{/each}} + {{else}} + {{#each content}} + {{#if @first}} + if (requestBody instanceof {{@key.pascalCase}}RequestBody requestBody{{@index}}) { + {{else}} + {{#if @last}} + } else { + {{@key.pascalCase}}RequestBody requestBody{{@index}} = ({{@key.pascalCase}}RequestBody) requestBody; + {{else}} + } else if (requestBody instanceof {{@key.pascalCase}}RequestBody requestBody{{@index}}) { + {{/if}} + {{/if}} + return serialize(requestBody{{@index}}.contentType(), requestBody{{@index}}.body().getData()); + {{/each}} + } + {{/eq}} + } + } + + public sealed interface SealedRequestBody permits {{#each content}}{{@key.pascalCase}}RequestBody{{#unless @last}}, {{/unless}}{{/each}} {} + {{#each content}} + public record {{@key.pascalCase}}RequestBody({{#with this}}{{#with schema}}{{containerJsonPathPiece.pascalCase}}.{{#with getSelfOrDeepestRef}}{{> src/main/kotlin/packagename/components/schemas/_sealedClassName }}{{/with}}{{/with}}{{/with}} body) implements SealedRequestBody, GenericRequestBody<{{#with this}}{{#with schema}}{{containerJsonPathPiece.pascalCase}}.{{#with getSelfOrDeepestRef}}{{> src/main/kotlin/packagename/components/schemas/_sealedClassName }}{{/with}}{{/with}}{{/with}}> { + @Override + public String contentType() { + return "{{{@key.original}}}"; + } + } + {{/each}} +} +{{/if}} +{{/with}} \ No newline at end of file diff --git a/src/main/resources/kotlin/src/main/kotlin/packagename/components/requestbodies/RequestBodyDoc.hbs b/src/main/resources/kotlin/src/main/kotlin/packagename/components/requestbodies/RequestBodyDoc.hbs new file mode 100644 index 00000000000..75482f556d4 --- /dev/null +++ b/src/main/resources/kotlin/src/main/kotlin/packagename/components/requestbodies/RequestBodyDoc.hbs @@ -0,0 +1,133 @@ +{{#with requestBody}} +{{#eq identifierPieces.size 0}} +{{> src/main/kotlin/packagename/components/_helper_header_from_identifier_pieces identifierPieces=(append identifierPieces jsonPathPiece) }} +{{else}} +{{> src/main/kotlin/packagename/components/_helper_header_from_identifier_pieces }} +{{/eq}} +{{#if componentModule}} +{{jsonPathPiece.pascalCase}}.java +{{/if}} + +{{#if refInfo}} +public class {{jsonPathPiece.pascalCase}} extends [{{refInfo.refClass}}]({{docRoot}}{{refInfo.ref.pathFromDocRoot}}.md) + +A class (extended from the $ref class) that contains necessary nested request body classes +- a class that extends RequestBodySerializer and is used to serialize input SealedRequestBody instances + +{{headerSize}}# Nested Class Summary +| Modifier and Type | Class and Description | +| ----------------- | --------------------- | +| static class | [{{jsonPathPiece.pascalCase}}.{{jsonPathPiece.pascalCase}}1](#{{> src/main/kotlin/packagename/components/_helper_anchor_id identifierPieces=(append identifierPieces (join jsonPathPiece.kebabCase "1" "")) }})
class that serializes request bodies | + +{{> src/main/kotlin/packagename/components/_helper_header_from_identifier_pieces headerSize=(join headerSize "#" "") identifierPieces=(append identifierPieces (join jsonPathPiece.pascalCase "1" "")) }} +public static class {{jsonPathPiece.pascalCase}}1 extends [{{refInfo.refClass}}1]({{docRoot}}{{refInfo.ref.pathFromDocRoot}}.md#{{refInfo.ref.jsonPathPiece.kebabCase}}1)
+ +a class that serializes SealedRequestBody request bodies, extended from the $ref class + +{{else}} +public class {{jsonPathPiece.pascalCase}} + +A class that contains necessary nested request body classes +- SealedMediaType, a sealed interface which contains all the schema/encoding info for each contentType +- records which implement SealedMediaType, the concrete media types +- a class that extends RequestBodySerializer and is used to serialize input SealedRequestBody instances +- SealedRequestBody, a sealed interface which contains all the contentType/schema input types +- records which implement SealedRequestBody, the concrete request body types + +{{headerSize}}# Nested Class Summary +| Modifier and Type | Class and Description | +| ----------------- | --------------------- | +| sealed interface | [{{jsonPathPiece.pascalCase}}.SealedMediaType](#{{> src/main/kotlin/packagename/components/_helper_anchor_id identifierPieces=(append identifierPieces "sealedmediatype") }})
media type sealed interface | +{{#each content}} +| record | [{{jsonPathPiece.pascalCase}}.{{@key.pascalCase}}MediaType](#{{@key.kebabCase}}mediatype)
record storing schema + encoding for a specific contentType | +{{/each}} +| static class | [{{jsonPathPiece.pascalCase}}.{{jsonPathPiece.pascalCase}}1](#{{> src/main/kotlin/packagename/components/_helper_anchor_id identifierPieces=(append identifierPieces (join jsonPathPiece.kebabCase "1" "")) }})
class that serializes request bodies | +| sealed interface | [{{jsonPathPiece.pascalCase}}.SealedRequestBody](#{{> src/main/kotlin/packagename/components/_helper_anchor_id identifierPieces=(append identifierPieces "sealedrequestbody") }})
request body sealed interface | +{{#each content}} +| record | [{{jsonPathPiece.pascalCase}}.{{@key.pascalCase}}RequestBody](#{{@key.kebabCase}}requestbody)
implements sealed interface to store request body input | +{{/each}} + +{{> src/main/kotlin/packagename/components/_helper_header_from_identifier_pieces headerSize=(join headerSize "#" "") identifierPieces=(append identifierPieces "SealedMediaType") }} +public sealed interface SealedMediaType
+permits
+{{#each content}} +[{{@key.pascalCase}}MediaType](#{{@key.kebabCase}}mediatype){{#unless @last}},{{/unless}} +{{/each}} + +sealed interface that stores schema and encoding info + +{{#each content}} + +{{> src/main/kotlin/packagename/components/_helper_header_from_identifier_pieces headerSize=(join headerSize "#" "") identifierPieces=(append identifierPieces (join @key.pascalCase "MediaType" "")) }} +public record {{@key.pascalCase}}MediaType
+implements [SealedMediaType](#sealedmediatype), MediaType<{{#with this}}{{#with schema}}[{{containerJsonPathPiece.pascalCase}}.{{jsonPathPiece.pascalCase}}]({{docRoot}}{{pathFromDocRoot}}.md#{{jsonPathPiece.kebabCase}}){{/with}}{{/with}}, Nothing?> + +class storing schema info for a specific contentType + +{{headerSize}}## Constructor Summary +| Constructor and Description | +| --------------------------- | +| {{@key.pascalCase}}MediaType()
Creates an instance | + +{{headerSize}}## Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| {{#with this}}{{#with schema}}[{{containerJsonPathPiece.pascalCase}}.{{jsonPathPiece.pascalCase}}]({{docRoot}}{{pathFromDocRoot}}.md#{{jsonPathPiece.kebabCase}}){{/with}}{{/with}} | schema()
the schema for this MediaType | +| Nothing? | encoding()
the encoding info | +{{/each}} + +{{> src/main/kotlin/packagename/components/_helper_header_from_identifier_pieces headerSize=(join headerSize "#" "") identifierPieces=(append identifierPieces (join jsonPathPiece.pascalCase "1" "")) }} +public static class {{jsonPathPiece.pascalCase}}1
+ +a class that serializes SealedRequestBody request bodies + +{{headerSize}}## Constructor Summary +| Constructor and Description | +| --------------------------- | +| {{jsonPathPiece.pascalCase}}1()
Creates an instance | + +{{headerSize}}## Field Summary +| Modifier and Type | Field and Description | +| ----------------- | --------------------- | +| boolean | required = {{#if required}}true{{else}}false{{/if}}
whether the request body is required | +| Map | content = Map.ofEntries(
{{#each content}}    new AbstractMap.SimpleEntry<>("{{{@key.original}}}", new [{{@key.pascalCase}}MediaType](#{{@key.kebabCase}}mediatype)()){{#unless @last}},{{/unless}}
{{/each}})
the contentType to schema info | + +{{headerSize}}## Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| SerializedRequestBody | serialize([SealedRequestBody](#sealedrequestbody) requestBody)
called by endpoint when creating request body bytes | + +{{> src/main/kotlin/packagename/components/_helper_header_from_identifier_pieces headerSize=(join headerSize "#" "") identifierPieces=(append identifierPieces "SealedRequestBody") }} +public sealed interface SealedRequestBody
+permits
+{{#each content}} +[{{@key.pascalCase}}RequestBody](#{{@key.kebabCase}}requestbody){{#unless @last}},{{/unless}} +{{/each}} + +sealed interface that stores request contentType + validated schema data + +{{#each content}} +{{> src/main/kotlin/packagename/components/_helper_header_from_identifier_pieces headerSize=(join headerSize "#" "") identifierPieces=(append identifierPieces (join @key.pascalCase "RequestBody" "")) }} +public record {{@key.pascalCase}}RequestBody
+implements [SealedRequestBody](#sealedrequestbody),
+GenericRequestBody<{{#with this}}{{#with schema}}{{containerJsonPathPiece.pascalCase}}.{{#with getSelfOrDeepestRef}}{{> src/main/kotlin/packagename/components/schemas/_sealedClassName forDocs=true }}{{/with}}{{/with}}{{/with}}>
+ +A record class to store request body input for contentType="{{{@key.original}}}" + +{{headerSize}}## Constructor Summary +| Constructor and Description | +| --------------------------- | +| {{@key.pascalCase}}RequestBody({{#with this}}{{#with schema}}{{containerJsonPathPiece.pascalCase}}.{{#with getSelfOrDeepestRef}}{{> src/main/kotlin/packagename/components/schemas/_sealedClassName forDocs=true }}{{/with}}{{/with}}{{/with}} body)
Creates an instance | + +{{headerSize}}## Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| String | contentType()
always returns "{{{@key.original}}}" | +| {{#with this}}{{#with schema}}{{containerJsonPathPiece.pascalCase}}.{{#with getSelfOrDeepestRef}}{{> src/main/kotlin/packagename/components/schemas/_sealedClassName forDocs=true }}{{/with}}{{/with}}{{/with}} | body()
returns the body passed in in the constructor | +{{/each}} +{{/if}} +{{#if componentModule}} + +[[Back to top]](#top) {{> _helper_footer_links readmePath="../../../" requestBodiesLink=true}} +{{/if}} +{{/with}} \ No newline at end of file diff --git a/src/main/resources/kotlin/src/main/kotlin/packagename/components/responses/HeadersDeserializer.hbs b/src/main/resources/kotlin/src/main/kotlin/packagename/components/responses/HeadersDeserializer.hbs new file mode 100644 index 00000000000..00589fe3bee --- /dev/null +++ b/src/main/resources/kotlin/src/main/kotlin/packagename/components/responses/HeadersDeserializer.hbs @@ -0,0 +1,24 @@ +package {{packageName}}.{{headers.subpackage}}; + +import {{packageName}}.response.HeadersDeserializer; +{{#each headers}} +import {{packageName}}.{{subpackage}}.{{jsonPathPiece.pascalCase}}; +{{/each}} + +import java.util.Map; +import java.util.AbstractMap; + +public class {{headers.jsonPathPiece.pascalCase}} extends HeadersDeserializer<{{#with headersObjectSchema}}{{containerJsonPathPiece.pascalCase}}.{{mapOutputJsonPathPiece.pascalCase}}{{/with}}> { + public {{headers.jsonPathPiece.pascalCase}}() { + super( + Map.ofEntries( +{{#each headers}} + new AbstractMap.SimpleEntry<>("{{{@key}}}", new {{jsonPathPiece.pascalCase}}.{{jsonPathPiece.pascalCase}}1()){{#unless @last}},{{/unless}} +{{/each}} + ), +{{#with headersObjectSchema}} + {{containerJsonPathPiece.pascalCase}}.{{jsonPathPiece.pascalCase}}.getInstance() +{{/with}} + ); + } +} \ No newline at end of file diff --git a/src/main/resources/kotlin/src/main/kotlin/packagename/components/responses/Response.hbs b/src/main/resources/kotlin/src/main/kotlin/packagename/components/responses/Response.hbs new file mode 100644 index 00000000000..737633add09 --- /dev/null +++ b/src/main/resources/kotlin/src/main/kotlin/packagename/components/responses/Response.hbs @@ -0,0 +1,150 @@ +{{#with response}} +package {{packageName}}.{{subpackage}}; + +{{#if refInfo}} + {{#neq subpackage refInfo.ref.subpackage}} +import {{packageName}}.{{refInfo.ref.subpackage}}.{{refInfo.refModule}}; + {{/neq}} + +public class {{jsonPathPiece.pascalCase}} extends {{refInfo.refModule}} { + public static class {{jsonPathPiece.pascalCase}}1 extends {{refInfo.refModule}}1 {} +} +{{else}} +import {{packageName}}.configurations.SchemaConfiguration; +import {{packageName}}.response.ResponseDeserializer; +import {{packageName}}.response.DeserializedHttpResponse; +import {{packageName}}.exceptions.ApiException; +import {{packageName}}.exceptions.ValidationException; +import {{packageName}}.exceptions.NotImplementedException; + {{#if hasContentSchema}} +import {{packageName}}.mediatype.MediaType; + {{else}} +import {{packageName}}.schemas.validation.MapUtils; + {{/if}} + {{#each content}} + {{#with schema}} +import {{{packageName}}}.{{subpackage}}.{{containerJsonPathPiece.pascalCase}}; + {{/with}} + {{/each}} + {{#with headersObjectSchema}} +import {{{packageName}}}.{{subpackage}}.{{containerJsonPathPiece.pascalCase}}; + {{/with}} + {{#if headers}} +import {{{packageName}}}.{{headers.subpackage}}.{{headers.jsonPathPiece.pascalCase}}; + {{/if}} + + {{#if content}} +import java.util.AbstractMap; + {{/if}} +import java.util.Map; +import java.net.http.HttpResponse; +import java.net.http.HttpHeaders; + +public class {{jsonPathPiece.pascalCase}} { + {{#if hasContentSchema}} + public sealed interface SealedMediaType permits {{#each content}}{{@key.pascalCase}}MediaType{{#unless @last}}, {{/unless}}{{/each}} {} + {{#each content}} + + public record {{@key.pascalCase}}MediaType({{#with this}}{{#with schema}}{{containerJsonPathPiece.pascalCase}}.{{jsonPathPiece.pascalCase}} schema{{/with}}{{/with}}) implements SealedMediaType, MediaType<{{#with this}}{{#with schema}}{{containerJsonPathPiece.pascalCase}}.{{jsonPathPiece.pascalCase}}, Nothing?{{/with}}{{/with}}> { + public {{@key.pascalCase}}MediaType() { + this({{#with this}}{{#with schema}}{{containerJsonPathPiece.pascalCase}}.{{jsonPathPiece.pascalCase}}.getInstance(){{/with}}{{/with}}); + } + @Override + public Nothing? encoding() { + return null; + } + } + {{/each}} + public sealed interface SealedResponseBody permits {{#each content}}{{@key.pascalCase}}ResponseBody{{#unless @last}}, {{/unless}}{{/each}} {} + {{#each content}} + public record {{@key.pascalCase}}ResponseBody({{#with this}}{{#with schema}}{{containerJsonPathPiece.pascalCase}}.{{#with getSelfOrDeepestRef}}{{> src/main/kotlin/packagename/components/schemas/_sealedClassName }}{{/with}}{{/with}}{{/with}} body) implements SealedResponseBody { } + {{/each}} + {{/if}} + + public static class {{jsonPathPiece.pascalCase}}1 extends ResponseDeserializer<{{#if hasContentSchema}}SealedResponseBody{{else}}Nothing?{{/if}}, {{#with headersObjectSchema}}{{containerJsonPathPiece.pascalCase}}.{{mapOutputJsonPathPiece.pascalCase}}{{else}}Nothing?{{/with}}, {{#if hasContentSchema}}SealedMediaType{{else}}Nothing?{{/if}}> { + public {{jsonPathPiece.pascalCase}}1() { + super( + {{#if hasContentSchema}} + Map.ofEntries( + {{#each content}} + new AbstractMap.SimpleEntry<>("{{{@key.original}}}", new {{@key.pascalCase}}MediaType()){{#unless @last}},{{/unless}} + {{/each}} + ) + {{else}} + MapUtils.makeMap( + {{#each content}} + new AbstractMap.SimpleEntry("{{{@key.original}}}", null){{#unless @last}},{{/unless}} + {{/each}} + ) + {{/if}} + ); + } + + {{#if hasContentSchema}} + @Override + protected SealedResponseBody getBody(String contentType, SealedMediaType mediaType, byte[] body, SchemaConfiguration configuration) throws ValidationException, NotImplementedException { + {{#eq content.size 1}} + {{#each content}} + {{@key.pascalCase}}MediaType thisMediaType = ({{@key.pascalCase}}MediaType) mediaType; + var deserializedBody = deserializeBody(contentType, body, thisMediaType.schema(), configuration); + return new {{@key.pascalCase}}ResponseBody(deserializedBody); + {{/each}} + {{else}} + {{#each content}} + {{#if @first}} + if (mediaType instanceof {{@key.pascalCase}}MediaType thisMediaType) { + {{else}} + {{#if @last}} + } else { + {{@key.pascalCase}}MediaType thisMediaType = ({{@key.pascalCase}}MediaType) mediaType; + {{else}} + } else if (mediaType instanceof {{@key.pascalCase}}MediaType thisMediaType) { + {{/if}} + {{/if}} + var deserializedBody = deserializeBody(contentType, body, thisMediaType.schema(), configuration); + return new {{@key.pascalCase}}ResponseBody(deserializedBody); + {{/each}} + } + {{/eq}} + } + {{else}} + @Override + protected Nothing? getBody(String contentType, Nothing? mediaType, byte[] body, SchemaConfiguration configuration) { + return null; + } + {{/if}} + + @Override + protected {{#with headersObjectSchema}}{{containerJsonPathPiece.pascalCase}}.{{mapOutputJsonPathPiece.pascalCase}}{{else}}Nothing?{{/with}} getHeaders(HttpHeaders headers, SchemaConfiguration configuration){{#if headers}} throws ValidationException, NotImplementedException{{/if}} { + {{#if headers}} + return new {{headers.jsonPathPiece.pascalCase}}().deserialize(headers, configuration); + {{else}} + return null; + {{/if}} + } + } + + {{#if hasContentSchema}} + @SuppressWarnings("serial") + public static class ResponseApiException extends ApiException { + public DeserializedHttpResponse deserializedResponse; + + public ResponseApiException(String s, HttpResponse response, DeserializedHttpResponse deserializedResponse) { + super(s, response); + this.deserializedResponse = deserializedResponse; + } + } + {{else}} + @SuppressWarnings("serial") + public static class ResponseApiException extends ApiException { + public DeserializedHttpResponse deserializedResponse; + + public ResponseApiException(String s, HttpResponse response, DeserializedHttpResponse deserializedResponse) { + super(s, response); + this.deserializedResponse = deserializedResponse; + } + } + {{/if}} +} +{{/if}} +{{/with}} \ No newline at end of file diff --git a/src/main/resources/kotlin/src/main/kotlin/packagename/components/responses/ResponseDoc.hbs b/src/main/resources/kotlin/src/main/kotlin/packagename/components/responses/ResponseDoc.hbs new file mode 100644 index 00000000000..ca1c83a31d8 --- /dev/null +++ b/src/main/resources/kotlin/src/main/kotlin/packagename/components/responses/ResponseDoc.hbs @@ -0,0 +1,140 @@ +{{#with response}} +{{#eq identifierPieces.size 0}} +{{> src/main/kotlin/packagename/components/_helper_header_from_identifier_pieces identifierPieces=(append identifierPieces jsonPathPiece) }} +{{else}} +{{> src/main/kotlin/packagename/components/_helper_header_from_identifier_pieces }} +{{/eq}} +{{#if componentModule}} +{{jsonPathPiece.pascalCase}}.java +{{/if}} + +{{#if refInfo}} +public class {{jsonPathPiece.pascalCase}} extends [{{refInfo.refClass}}](../../components/responses/{{refInfo.refClass}}.md) + +A class (extended from the $ref class) that contains necessary nested response classes +- a class that extends ResponseDeserializer and is used to deserialize responses + +{{headerSize}}# Nested Class Summary +| Modifier and Type | Class and Description | +| ----------------- | --------------------- | +| static class | [{{jsonPathPiece.pascalCase}}.{{jsonPathPiece.pascalCase}}1](#{{> src/main/kotlin/packagename/components/_helper_anchor_id identifierPieces=(append identifierPieces (join jsonPathPiece.kebabCase "1" "")) }})
class that deserializes responses | + +{{> src/main/kotlin/packagename/components/_helper_header_from_identifier_pieces headerSize=(join headerSize "#" "") identifierPieces=(append identifierPieces (join jsonPathPiece.pascalCase "1" "")) }} +public static class {{jsonPathPiece.pascalCase}}1 extends [{{refInfo.refClass}}1](../../components/responses/{{refInfo.refClass}}.md#{{refInfo.ref.jsonPathPiece.kebabCase}}1)
+ +a class that deserializes responses, extended from the $ref class + +{{else}} +public class {{jsonPathPiece.pascalCase}} + +A class that contains necessary nested response classes +{{#if hasContentSchema}} +- SealedMediaType, a sealed interface which contains all the schema/encoding info for each contentType +- records which implement SealedMediaType, the concrete media types +- SealedResponseBody, a sealed interface which contains all the contentType/schema types +- records which implement SealedResponseBody, the concrete response body types +{{/if}} +- a class that extends ResponseDeserializer and is used to deserialize responses + +{{headerSize}}# Nested Class Summary +| Modifier and Type | Class and Description | +| ----------------- | --------------------- | +{{#if hasContentSchema}} +| sealed interface | [{{jsonPathPiece.pascalCase}}.SealedMediaType](#{{> src/main/kotlin/packagename/components/_helper_anchor_id identifierPieces=(append identifierPieces "sealedmediatype") }})
media type sealed interface | + {{#each content}} +| record | [{{jsonPathPiece.pascalCase}}.{{@key.pascalCase}}MediaType](#{{@key.kebabCase}}mediatype)
record storing schema + encoding for a specific contentType | + {{/each}} +| sealed interface | [{{jsonPathPiece.pascalCase}}.SealedResponseBody](#{{> src/main/kotlin/packagename/components/_helper_anchor_id identifierPieces=(append identifierPieces "sealedresponsebody") }})
response body sealed interface | + {{#each content}} +| record | [{{jsonPathPiece.pascalCase}}.{{@key.pascalCase}}ResponseBody](#{{@key.kebabCase}}responsebody)
implements sealed interface to store response body | + {{/each}} +{{/if}} +| static class | [{{jsonPathPiece.pascalCase}}.{{jsonPathPiece.pascalCase}}1](#{{> src/main/kotlin/packagename/components/_helper_anchor_id identifierPieces=(append identifierPieces (join jsonPathPiece.kebabCase "1" "")) }})
class that deserializes responses | +{{#if hasContentSchema}} + +{{> src/main/kotlin/packagename/components/_helper_header_from_identifier_pieces headerSize=(join headerSize "#" "") identifierPieces=(append identifierPieces "SealedMediaType") }} +public sealed interface SealedMediaType
+permits
+ {{#each content}} +[{{@key.pascalCase}}MediaType](#{{@key.kebabCase}}mediatype){{#unless @last}},{{/unless}} + {{/each}} + +sealed interface that stores schema and encoding info + {{#each content}} + +{{> src/main/kotlin/packagename/components/_helper_header_from_identifier_pieces headerSize=(join headerSize "#" "") identifierPieces=(append identifierPieces (join @key.pascalCase "MediaType" "")) }} +public record {{@key.pascalCase}}MediaType
+implements [SealedMediaType](#sealedmediatype), MediaType<{{#with this}}{{#with schema}}[{{containerJsonPathPiece.pascalCase}}.{{jsonPathPiece.pascalCase}}]({{docRoot}}{{pathFromDocRoot}}.md#{{jsonPathPiece.kebabCase}}){{/with}}{{/with}}, Nothing?> + +class storing schema info for a specific contentType + +{{headerSize}}## Constructor Summary +| Constructor and Description | +| --------------------------- | +| {{@key.pascalCase}}MediaType()
Creates an instance | + +{{headerSize}}## Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| {{#with this}}{{#with schema}}[{{containerJsonPathPiece.pascalCase}}.{{jsonPathPiece.pascalCase}}]({{docRoot}}{{pathFromDocRoot}}.md#{{jsonPathPiece.kebabCase}}){{/with}}{{/with}} | schema()
the schema for this MediaType | +| Nothing? | encoding()
the encoding info | + {{/each}} + +{{> src/main/kotlin/packagename/components/_helper_header_from_identifier_pieces headerSize=(join headerSize "#" "") identifierPieces=(append identifierPieces "SealedResponseBody") }} +public sealed interface SealedResponseBody
+permits
+ {{#each content}} +[{{@key.pascalCase}}ResponseBody](#{{@key.kebabCase}}responsebody){{#unless @last}},{{/unless}} + {{/each}} + +sealed interface that stores response body + + {{#each content}} +{{> src/main/kotlin/packagename/components/_helper_header_from_identifier_pieces headerSize=(join headerSize "#" "") identifierPieces=(append identifierPieces (join @key.pascalCase "ResponseBody" "")) }} +public record {{@key.pascalCase}}ResponseBody
+implements [SealedResponseBody](#sealedresponsebody) + +A record class to store response body for contentType="{{{@key.original}}}" + +{{headerSize}}## Constructor Summary +| Constructor and Description | +| --------------------------- | +| {{@key.pascalCase}}ResponseBody({{#with this}}{{#with schema}}{{containerJsonPathPiece.pascalCase}}.{{#with getSelfOrDeepestRef}}{{> src/main/kotlin/packagename/components/schemas/_sealedClassName forDocs=true }}{{/with}}{{/with}}{{/with}} body)
Creates an instance | + +{{headerSize}}## Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| {{#with this}}{{#with schema}}{{containerJsonPathPiece.pascalCase}}.{{#with getSelfOrDeepestRef}}{{> src/main/kotlin/packagename/components/schemas/_sealedClassName forDocs=true }}{{/with}}{{/with}}{{/with}} | body()
returns the body passed in in the constructor | + {{/each}} +{{/if}} + +{{> src/main/kotlin/packagename/components/_helper_header_from_identifier_pieces headerSize=(join headerSize "#" "") identifierPieces=(append identifierPieces (join jsonPathPiece.pascalCase "1" "")) }} +public static class {{jsonPathPiece.pascalCase}}1
+extends ResponseDeserializer<{{#if hasContentSchema}}[SealedResponseBody](#sealedresponsebody){{else}}Nothing?{{/if}}, {{#with headersObjectSchema}}[{{containerJsonPathPiece.pascalCase}}.{{mapOutputJsonPathPiece.pascalCase}}]({{docRoot}}{{pathFromDocRoot}}.md#{{mapOutputJsonPathPiece.kebabCase}}){{else}}Nothing?{{/with}}, {{#if hasContentSchema}}[SealedMediaType](#sealedmediatype){{else}}Nothing?{{/if}}> + +a class that deserializes responses + +{{headerSize}}## Constructor Summary +| Constructor and Description | +| --------------------------- | +| {{jsonPathPiece.pascalCase}}1()
Creates an instance | + +{{headerSize}}## Field Summary +| Modifier and Type | Field and Description | +| ----------------- | --------------------- | + {{#if hasContentSchema}} +| Map | content = Map.ofEntries(
{{#each content}}    new AbstractMap.SimpleEntry<>("{{{@key.original}}}", new [{{@key.pascalCase}}MediaType](#{{@key.kebabCase}}mediatype)()){{#unless @last}},{{/unless}}
{{/each}})
the contentType to schema info | + {{else}} +| Map | content = MapUtils.makeMap(
{{#each content}}    new AbstractMap.SimpleEntry<>("{{{@key.original}}}", null){{#unless @last}},{{/unless}}
{{/each}})
the contentType to schema info | + {{/if}} + +{{headerSize}}## Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| ApiResponse<{{#if hasContentSchema}}[SealedResponseBody](#sealedresponsebody){{else}}Nothing?{{/if}}, {{#with headersObjectSchema}}[{{containerJsonPathPiece.pascalCase}}.{{mapOutputJsonPathPiece.pascalCase}}]({{docRoot}}{{pathFromDocRoot}}.md#{{mapOutputJsonPathPiece.kebabCase}}){{else}}Nothing?{{/with}}> | deserialize(HttpResponse response, SchemaConfiguration configuration)
called by endpoint when deserialize responses | +{{/if}} +{{#if componentModule}} + +[[Back to top]](#top) {{> _helper_footer_links readmePath="../../../" responsesLink=true}} +{{/if}} +{{/with}} \ No newline at end of file diff --git a/src/main/resources/kotlin/src/main/kotlin/packagename/components/schemas/Schema.hbs b/src/main/resources/kotlin/src/main/kotlin/packagename/components/schemas/Schema.hbs new file mode 100644 index 00000000000..3c75927f42d --- /dev/null +++ b/src/main/resources/kotlin/src/main/kotlin/packagename/components/schemas/Schema.hbs @@ -0,0 +1,20 @@ +{{#with schema}} +package {{packageName}}.{{subpackage}}; + {{#if refInfo}} + +{{> _helper_imports }} + +public class {{containerJsonPathPiece.pascalCase}} extends {{refInfo.refModule}} { + // $refed class + {{> src/main/kotlin/packagename/components/schemas/SchemaClass/SchemaClass identifierPieces=(append identifierPieces jsonPathPiece) simpleRef=true }} +} + {{else}} +{{> _helper_imports }} + +public class {{> src/main/kotlin/packagename/components/schemas/_containerClassName }} { + // nest classes so all schemas and input/output classes can be public + {{> src/main/kotlin/packagename/components/schemas/Schema_getSchemas }} + +} + {{/if}} +{{/with}} \ No newline at end of file diff --git a/src/main/resources/kotlin/src/main/kotlin/packagename/components/schemas/SchemaClass/SchemaClass.hbs b/src/main/resources/kotlin/src/main/kotlin/packagename/components/schemas/SchemaClass/SchemaClass.hbs new file mode 100644 index 00000000000..4afb95faa63 --- /dev/null +++ b/src/main/resources/kotlin/src/main/kotlin/packagename/components/schemas/SchemaClass/SchemaClass.hbs @@ -0,0 +1,66 @@ +{{#or isBooleanSchemaFalse isBooleanSchemaTrue}} +{{> src/main/kotlin/packagename/components/schemas/SchemaClass/_Schema_varEqualsClass }} +{{else}} + {{#eq types null }} + {{#if isSimpleAnyType }} +{{> src/main/kotlin/packagename/components/schemas/SchemaClass/_Schema_varEqualsClass }} + {{else}} +{{> src/main/kotlin/packagename/components/schemas/SchemaClass/_Schema_anytypeOrMultitype }} + {{/if}} + {{else}} + {{! types exist }} + {{#eq types.size 1}} + {{! one type }} + {{#each types}} + {{#eq this "object"}} + {{#if isSimpleObject }} +{{> src/main/kotlin/packagename/components/schemas/SchemaClass/_Schema_varEqualsClass }} + {{else}} +{{> src/main/kotlin/packagename/components/schemas/SchemaClass/_Schema_map }} + {{/if}} + {{else}} + {{#eq this "array"}} + {{#if isSimpleArray }} +{{> src/main/kotlin/packagename/components/schemas/SchemaClass/_Schema_varEqualsClass }} + {{else}} +{{> src/main/kotlin/packagename/components/schemas/SchemaClass/_Schema_list }} + {{/if}} + {{else}} + {{#eq this "boolean"}} + {{#if isSimpleBoolean }} +{{> src/main/kotlin/packagename/components/schemas/SchemaClass/_Schema_varEqualsClass }} + {{else}} +{{> src/main/kotlin/packagename/components/schemas/SchemaClass/_Schema_boolean }} + {{/if}} + {{else}} + {{#or (eq this "number") (eq this "integer") }} + {{#or isSimpleInteger isSimpleNumber }} +{{> src/main/kotlin/packagename/components/schemas/SchemaClass/_Schema_varEqualsClass }} + {{else}} +{{> src/main/kotlin/packagename/components/schemas/SchemaClass/_Schema_number }} + {{/or}} + {{else}} + {{#eq this "string"}} + {{#if isSimpleString}} +{{> src/main/kotlin/packagename/components/schemas/SchemaClass/_Schema_varEqualsClass }} + {{else}} +{{> src/main/kotlin/packagename/components/schemas/SchemaClass/_Schema_string }} + {{/if}} + {{else}} + {{#if isSimpleNull }} +{{> src/main/kotlin/packagename/components/schemas/SchemaClass/_Schema_varEqualsClass }} + {{else}} +{{> src/main/kotlin/packagename/components/schemas/SchemaClass/_Schema_null }} + {{/if}} + {{/eq}} + {{/or}} + {{/eq}} + {{/eq}} + {{/eq}} + {{/each}} + {{else}} + {{! multiple types }} +{{> src/main/kotlin/packagename/components/schemas/SchemaClass/_Schema_anytypeOrMultitype }} + {{/eq}} + {{/eq}} +{{/or}} \ No newline at end of file diff --git a/src/main/resources/kotlin/src/main/kotlin/packagename/components/schemas/SchemaClass/_Schema_anytypeOrMultitype.hbs b/src/main/resources/kotlin/src/main/kotlin/packagename/components/schemas/SchemaClass/_Schema_anytypeOrMultitype.hbs new file mode 100644 index 00000000000..64aeee9b78b --- /dev/null +++ b/src/main/resources/kotlin/src/main/kotlin/packagename/components/schemas/SchemaClass/_Schema_anytypeOrMultitype.hbs @@ -0,0 +1,159 @@ + + +{{> src/main/kotlin/packagename/components/schemas/SchemaClass/_boxedClasses }} + + +{{#if types}} +public static class {{jsonPathPiece.pascalCase}} extends JsonSchema<{{jsonPathPiece.pascalCase}}Boxed> implements {{#with enumInfo}}{{#if typeToValues.null}}NullEnumValidator, {{/if}}{{#if typeToValues.boolean}}BooleanEnumValidator, {{/if}}{{#if typeToValues.string}}StringEnumValidator, {{/if}}{{#if typeToValues.Integer}}IntegerEnumValidator, {{/if}}{{#if typeToValues.Long}}LongEnumValidator, {{/if}}{{#if typeToValues.Float}}FloatEnumValidator, {{/if}}{{#if typeToValues.Double}}DoubleEnumValidator, {{/if}}{{/with}}{{#each types}}{{#eq this "null"}}NullSchemaValidator<{{jsonPathPiece.pascalCase}}BoxedVoid>{{else}}{{#eq this "boolean"}}BooleanSchemaValidator<{{jsonPathPiece.pascalCase}}BoxedBoolean>{{else}}{{#or (eq this "number") (eq this "integer")}}NumberSchemaValidator<{{jsonPathPiece.pascalCase}}BoxedNumber>{{else}}{{#eq this "string"}}StringSchemaValidator<{{jsonPathPiece.pascalCase}}BoxedString>{{else}}{{#eq this "array"}}ListSchemaValidator<{{#if arrayOutputJsonPathPiece}}{{arrayOutputJsonPathPiece.pascalCase}}{{else}}FrozenList<@Nullable Object>{{/if}}, {{jsonPathPiece.pascalCase}}BoxedList>{{else}}{{#eq this "object"}}MapSchemaValidator<{{#if mapOutputJsonPathPiece}}{{mapOutputJsonPathPiece.pascalCase}}{{else}}FrozenMap<{{#with mapValueSchema}}{{> src/main/kotlin/packagename/components/schemas/types/schema_output_type sourceJsonPath=../jsonPath forceNull=true }}{{else}}@Nullable Object{{/with}}>{{/if}}, {{jsonPathPiece.pascalCase}}BoxedMap>{{/eq}}{{/eq}}{{/eq}}{{/or}}{{/eq}}{{/eq}}{{#unless @last}}, {{/unless}}{{/each}} { +{{else}} +public static class {{jsonPathPiece.pascalCase}} extends JsonSchema<{{jsonPathPiece.pascalCase}}Boxed> implements {{#with enumInfo}}{{#if typeToValues.null}}NullEnumValidator, {{/if}}{{#if typeToValues.boolean}}BooleanEnumValidator, {{/if}}{{#if typeToValues.string}}StringEnumValidator, {{/if}}{{#if typeToValues.Integer}}IntegerEnumValidator, {{/if}}{{#if typeToValues.Long}}LongEnumValidator, {{/if}}{{#if typeToValues.Float}}FloatEnumValidator, {{/if}}{{#if typeToValues.Double}}DoubleEnumValidator, {{/if}}{{/with}}NullSchemaValidator<{{jsonPathPiece.pascalCase}}BoxedVoid>, BooleanSchemaValidator<{{jsonPathPiece.pascalCase}}BoxedBoolean>, NumberSchemaValidator<{{jsonPathPiece.pascalCase}}BoxedNumber>, StringSchemaValidator<{{jsonPathPiece.pascalCase}}BoxedString>, ListSchemaValidator<{{#if arrayOutputJsonPathPiece}}{{arrayOutputJsonPathPiece.pascalCase}}{{else}}FrozenList<@Nullable Object>{{/if}}, {{jsonPathPiece.pascalCase}}BoxedList>, MapSchemaValidator<{{#if mapOutputJsonPathPiece}}{{mapOutputJsonPathPiece.pascalCase}}{{else}}FrozenMap<{{#with mapValueSchema}}{{> src/main/kotlin/packagename/components/schemas/types/schema_output_type sourceJsonPath=../jsonPath forceNull=true }}{{else}}@Nullable Object{{/with}}>{{/if}}, {{jsonPathPiece.pascalCase}}BoxedMap> { +{{/if}} +{{#if componentModule}} + /* + NOTE: This class is auto generated by OpenAPI JSON Schema Generator. + Ref: https://github.com/openapi-json-schema-tools/openapi-json-schema-generator + + Do not edit the class manually. + {{#if description}} + + {{{description.original}}} + {{/if}} + */ +{{/if}} + private static @Nullable {{jsonPathPiece.pascalCase}} instance = null; + + protected {{../jsonPathPiece.pascalCase}}() { + super(new JsonSchemaInfo() + {{#if types}} + {{> src/main/kotlin/packagename/components/schemas/SchemaClass/_types }} + {{/if}} + {{#if format}} + {{> src/main/kotlin/packagename/components/schemas/SchemaClass/_format }} + {{/if}} + {{#if items}} + {{> src/main/kotlin/packagename/components/schemas/SchemaClass/_items }} + {{/if}} + {{#if properties}} + {{> src/main/kotlin/packagename/components/schemas/SchemaClass/_properties }} + {{/if}} + {{#if requiredProperties}} + {{> src/main/kotlin/packagename/components/schemas/SchemaClass/_required }} + {{/if}} + {{#neq exclusiveMaximum null}} + {{> src/main/kotlin/packagename/components/schemas/SchemaClass/_exclusiveMaximum }} + {{/neq}} + {{#neq exclusiveMinimum null}} + {{> src/main/kotlin/packagename/components/schemas/SchemaClass/_exclusiveMinimum }} + {{/neq}} + {{#neq maximum null}} + {{> src/main/kotlin/packagename/components/schemas/SchemaClass/_maximum }} + {{/neq}} + {{#neq minimum null}} + {{> src/main/kotlin/packagename/components/schemas/SchemaClass/_minimum }} + {{/neq}} + {{#neq multipleOf null}} + {{> src/main/kotlin/packagename/components/schemas/SchemaClass/_multipleOf }} + {{/neq}} + {{#neq maxItems null}} + {{> src/main/kotlin/packagename/components/schemas/SchemaClass/_maxItems }} + {{/neq}} + {{#neq minItems null}} + {{> src/main/kotlin/packagename/components/schemas/SchemaClass/_minItems }} + {{/neq}} + {{#neq maxLength null }} + {{> src/main/kotlin/packagename/components/schemas/SchemaClass/_maxLength }} + {{/neq}} + {{#neq minLength null }} + {{> src/main/kotlin/packagename/components/schemas/SchemaClass/_minLength }} + {{/neq}} + {{#neq maxProperties null}} + {{> src/main/kotlin/packagename/components/schemas/SchemaClass/_maxProperties }} + {{/neq}} + {{#neq minProperties null}} + {{> src/main/kotlin/packagename/components/schemas/SchemaClass/_minProperties }} + {{/neq}} + {{#if additionalProperties}} + {{> src/main/kotlin/packagename/components/schemas/SchemaClass/_additionalProperties }} + {{/if}} + {{#if allOf}} + {{> src/main/kotlin/packagename/components/schemas/SchemaClass/_allOf }} + {{/if}} + {{#if anyOf}} + {{> src/main/kotlin/packagename/components/schemas/SchemaClass/_anyOf }} + {{/if}} + {{#if oneOf}} + {{> src/main/kotlin/packagename/components/schemas/SchemaClass/_oneOf }} + {{/if}} + {{#if not}} + {{> src/main/kotlin/packagename/components/schemas/SchemaClass/_not }} + {{/if}} + {{#neq uniqueItems null}} + {{> src/main/kotlin/packagename/components/schemas/SchemaClass/_uniqueItems }} + {{/neq}} + {{#if enumInfo}} + {{> src/main/kotlin/packagename/components/schemas/SchemaClass/_enum }} + {{/if}} + {{#if patternInfo}} + {{> src/main/kotlin/packagename/components/schemas/SchemaClass/_pattern }} + {{/if}} + {{#if defaultValue}} + {{> src/main/kotlin/packagename/components/schemas/SchemaClass/_default }} + {{/if}} + {{#if constInfo}} + {{> src/main/kotlin/packagename/components/schemas/SchemaClass/_const }} + {{/if}} + {{#if contains}} + {{> src/main/kotlin/packagename/components/schemas/SchemaClass/_contains }} + {{/if}} + {{#neq maxContains null}} + {{> src/main/kotlin/packagename/components/schemas/SchemaClass/_maxContains }} + {{/neq}} + {{#neq minContains null}} + {{> src/main/kotlin/packagename/components/schemas/SchemaClass/_minContains }} + {{/neq}} + {{#if propertyNames}} + {{> src/main/kotlin/packagename/components/schemas/SchemaClass/_propertyNames }} + {{/if}} + {{#if dependentRequired}} + {{> src/main/kotlin/packagename/components/schemas/SchemaClass/_dependentRequired }} + {{/if}} + {{#if dependentSchemas}} + {{> src/main/kotlin/packagename/components/schemas/SchemaClass/_dependentSchemas }} + {{/if}} + {{#if patternProperties}} + {{> src/main/kotlin/packagename/components/schemas/SchemaClass/_patternProperties }} + {{/if}} + {{#if prefixItems}} + {{> src/main/kotlin/packagename/components/schemas/SchemaClass/_prefixItems }} + {{/if}} + {{#if if_}} + {{> src/main/kotlin/packagename/components/schemas/SchemaClass/_if }} + {{/if}} + {{#if then}} + {{> src/main/kotlin/packagename/components/schemas/SchemaClass/_then }} + {{/if}} + {{#if else_}} + {{> src/main/kotlin/packagename/components/schemas/SchemaClass/_else }} + {{/if}} + {{#if unevaluatedItems}} + {{> src/main/kotlin/packagename/components/schemas/SchemaClass/_unevaluatedItems }} + {{/if}} + {{#if unevaluatedProperties}} + {{> src/main/kotlin/packagename/components/schemas/SchemaClass/_unevaluatedProperties }} + {{/if}} + ); + } + + public static {{jsonPathPiece.pascalCase}} getInstance() { + if (instance == null) { + instance = new {{jsonPathPiece.pascalCase}}(); + } + return instance; + } +{{#if hasDiscriminatorWithNonEmptyMapping}} + {{!> components/schemas/schema_cls/_discriminator }} +{{/if}} + {{> src/main/kotlin/packagename/components/schemas/SchemaClass/_validate_implementor }} + {{> src/main/kotlin/packagename/components/schemas/SchemaClass/_getNewInstanceObject_implementor }} + {{> src/main/kotlin/packagename/components/schemas/SchemaClass/_validateAndBox }} +} \ No newline at end of file diff --git a/src/main/resources/kotlin/src/main/kotlin/packagename/components/schemas/SchemaClass/_Schema_boolean.hbs b/src/main/resources/kotlin/src/main/kotlin/packagename/components/schemas/SchemaClass/_Schema_boolean.hbs new file mode 100644 index 00000000000..614f45b2f7e --- /dev/null +++ b/src/main/resources/kotlin/src/main/kotlin/packagename/components/schemas/SchemaClass/_Schema_boolean.hbs @@ -0,0 +1,68 @@ + + +{{> src/main/kotlin/packagename/components/schemas/SchemaClass/_boxedClasses }} + + +public static class {{jsonPathPiece.pascalCase}} extends JsonSchema<{{jsonPathPiece.pascalCase}}Boxed> implements BooleanSchemaValidator<{{jsonPathPiece.pascalCase}}BoxedBoolean>{{#and enumInfo enumInfo.typeToValues.boolean}}, BooleanEnumValidator{{/and}} { +{{#if componentModule}} + /* + NOTE: This class is auto generated by OpenAPI JSON Schema Generator. + Ref: https://github.com/openapi-json-schema-tools/openapi-json-schema-generator + + Do not edit the class manually. + {{#if description}} + + {{{description.original}}} + {{/if}} + */ +{{/if}} + private static @Nullable {{jsonPathPiece.pascalCase}} instance = null; + + protected {{../jsonPathPiece.pascalCase}}() { + super(new JsonSchemaInfo() + {{#if types}} + {{> src/main/kotlin/packagename/components/schemas/SchemaClass/_types }} + {{/if}} + {{#if allOf}} + {{> src/main/kotlin/packagename/components/schemas/SchemaClass/_allOf }} + {{/if}} + {{#if anyOf}} + {{> src/main/kotlin/packagename/components/schemas/SchemaClass/_anyOf }} + {{/if}} + {{#if oneOf}} + {{> src/main/kotlin/packagename/components/schemas/SchemaClass/_oneOf }} + {{/if}} + {{#if not}} + {{> src/main/kotlin/packagename/components/schemas/SchemaClass/_not }} + {{/if}} + {{#if enumInfo}} + {{> src/main/kotlin/packagename/components/schemas/SchemaClass/_enum }} + {{/if}} + {{#if defaultValue}} + {{> src/main/kotlin/packagename/components/schemas/SchemaClass/_default }} + {{/if}} + {{#if constInfo}} + {{> src/main/kotlin/packagename/components/schemas/SchemaClass/_const }} + {{/if}} + {{#if if_}} + {{> src/main/kotlin/packagename/components/schemas/SchemaClass/_if }} + {{/if}} + {{#if then}} + {{> src/main/kotlin/packagename/components/schemas/SchemaClass/_then }} + {{/if}} + {{#if else_}} + {{> src/main/kotlin/packagename/components/schemas/SchemaClass/_else }} + {{/if}} + ); + } + + public static {{jsonPathPiece.pascalCase}} getInstance() { + if (instance == null) { + instance = new {{jsonPathPiece.pascalCase}}(); + } + return instance; + } + {{> src/main/kotlin/packagename/components/schemas/SchemaClass/_validate_implementor }} + {{> src/main/kotlin/packagename/components/schemas/SchemaClass/_getNewInstanceObject_implementor }} + {{> src/main/kotlin/packagename/components/schemas/SchemaClass/_validateAndBox }} +} \ No newline at end of file diff --git a/src/main/resources/kotlin/src/main/kotlin/packagename/components/schemas/SchemaClass/_Schema_list.hbs b/src/main/resources/kotlin/src/main/kotlin/packagename/components/schemas/SchemaClass/_Schema_list.hbs new file mode 100644 index 00000000000..55235487f27 --- /dev/null +++ b/src/main/resources/kotlin/src/main/kotlin/packagename/components/schemas/SchemaClass/_Schema_list.hbs @@ -0,0 +1,86 @@ + + +{{> src/main/kotlin/packagename/components/schemas/SchemaClass/_boxedClasses }} + + +public static class {{jsonPathPiece.pascalCase}} extends JsonSchema<{{jsonPathPiece.pascalCase}}Boxed> implements ListSchemaValidator<{{#if arrayOutputJsonPathPiece}}{{arrayOutputJsonPathPiece.pascalCase}}{{else}}FrozenList<@Nullable Object>{{/if}}, {{jsonPathPiece.pascalCase}}BoxedList> { +{{#if componentModule}} + /* + NOTE: This class is auto generated by OpenAPI JSON Schema Generator. + Ref: https://github.com/openapi-json-schema-tools/openapi-json-schema-generator + + Do not edit the class manually. + {{#if description}} + + {{{description.original}}} + {{/if}} + */ +{{/if}} + private static @Nullable {{jsonPathPiece.pascalCase}} instance = null; + + protected {{../jsonPathPiece.pascalCase}}() { + super(new JsonSchemaInfo() + {{#if types}} + {{> src/main/kotlin/packagename/components/schemas/SchemaClass/_types }} + {{/if}} + {{#if items}} + {{> src/main/kotlin/packagename/components/schemas/SchemaClass/_items }} + {{/if}} + {{#neq maxItems null}} + {{> src/main/kotlin/packagename/components/schemas/SchemaClass/_maxItems }} + {{/neq}} + {{#neq minItems null}} + {{> src/main/kotlin/packagename/components/schemas/SchemaClass/_minItems }} + {{/neq}} + {{#if allOf}} + {{> src/main/kotlin/packagename/components/schemas/SchemaClass/_allOf }} + {{/if}} + {{#if anyOf}} + {{> src/main/kotlin/packagename/components/schemas/SchemaClass/_anyOf }} + {{/if}} + {{#if oneOf}} + {{> src/main/kotlin/packagename/components/schemas/SchemaClass/_oneOf }} + {{/if}} + {{#if not}} + {{> src/main/kotlin/packagename/components/schemas/SchemaClass/_not }} + {{/if}} + {{#neq uniqueItems null}} + {{> src/main/kotlin/packagename/components/schemas/SchemaClass/_uniqueItems }} + {{/neq}} + {{#if contains}} + {{> src/main/kotlin/packagename/components/schemas/SchemaClass/_contains }} + {{/if}} + {{#neq maxContains null}} + {{> src/main/kotlin/packagename/components/schemas/SchemaClass/_maxContains }} + {{/neq}} + {{#neq minContains null}} + {{> src/main/kotlin/packagename/components/schemas/SchemaClass/_minContains }} + {{/neq}} + {{#if prefixItems}} + {{> src/main/kotlin/packagename/components/schemas/SchemaClass/_prefixItems }} + {{/if}} + {{#if if_}} + {{> src/main/kotlin/packagename/components/schemas/SchemaClass/_if }} + {{/if}} + {{#if then}} + {{> src/main/kotlin/packagename/components/schemas/SchemaClass/_then }} + {{/if}} + {{#if else_}} + {{> src/main/kotlin/packagename/components/schemas/SchemaClass/_else }} + {{/if}} + {{#if unevaluatedItems}} + {{> src/main/kotlin/packagename/components/schemas/SchemaClass/_unevaluatedItems }} + {{/if}} + ); + } + + public static {{jsonPathPiece.pascalCase}} getInstance() { + if (instance == null) { + instance = new {{jsonPathPiece.pascalCase}}(); + } + return instance; + } + {{> src/main/kotlin/packagename/components/schemas/SchemaClass/_validate_implementor }} + {{> src/main/kotlin/packagename/components/schemas/SchemaClass/_getNewInstanceObject_implementor }} + {{> src/main/kotlin/packagename/components/schemas/SchemaClass/_validateAndBox }} +} \ No newline at end of file diff --git a/src/main/resources/kotlin/src/main/kotlin/packagename/components/schemas/SchemaClass/_Schema_map.hbs b/src/main/resources/kotlin/src/main/kotlin/packagename/components/schemas/SchemaClass/_Schema_map.hbs new file mode 100644 index 00000000000..e309397f8fd --- /dev/null +++ b/src/main/resources/kotlin/src/main/kotlin/packagename/components/schemas/SchemaClass/_Schema_map.hbs @@ -0,0 +1,92 @@ + + +{{> src/main/kotlin/packagename/components/schemas/SchemaClass/_boxedClasses }} + + +public static class {{jsonPathPiece.pascalCase}} extends JsonSchema<{{jsonPathPiece.pascalCase}}Boxed> implements MapSchemaValidator<{{#if mapOutputJsonPathPiece}}{{mapOutputJsonPathPiece.pascalCase}}{{else}}FrozenMap<{{#with mapValueSchema}}{{> src/main/kotlin/packagename/components/schemas/types/schema_output_type sourceJsonPath=../jsonPath forceNull=true }}{{else}}@Nullable Object{{/with}}>{{/if}}, {{jsonPathPiece.pascalCase}}BoxedMap> { +{{#if componentModule}} + /* + NOTE: This class is auto generated by OpenAPI JSON Schema Generator. + Ref: https://github.com/openapi-json-schema-tools/openapi-json-schema-generator + + Do not edit the class manually. + {{#if description}} + + {{{description.original}}} + {{/if}} + */ +{{/if}} + private static @Nullable {{jsonPathPiece.pascalCase}} instance = null; + + protected {{../jsonPathPiece.pascalCase}}() { + super(new JsonSchemaInfo() + {{#if types}} + {{> src/main/kotlin/packagename/components/schemas/SchemaClass/_types }} + {{/if}} + {{#if properties}} + {{> src/main/kotlin/packagename/components/schemas/SchemaClass/_properties }} + {{/if}} + {{#if requiredProperties}} + {{> src/main/kotlin/packagename/components/schemas/SchemaClass/_required }} + {{/if}} + {{#neq maxProperties null}} + {{> src/main/kotlin/packagename/components/schemas/SchemaClass/_maxProperties }} + {{/neq}} + {{#neq minProperties null}} + {{> src/main/kotlin/packagename/components/schemas/SchemaClass/_minProperties }} + {{/neq}} + {{#if additionalProperties}} + {{> src/main/kotlin/packagename/components/schemas/SchemaClass/_additionalProperties }} + {{/if}} + {{#if allOf}} + {{> src/main/kotlin/packagename/components/schemas/SchemaClass/_allOf }} + {{/if}} + {{#if anyOf}} + {{> src/main/kotlin/packagename/components/schemas/SchemaClass/_anyOf }} + {{/if}} + {{#if oneOf}} + {{> src/main/kotlin/packagename/components/schemas/SchemaClass/_oneOf }} + {{/if}} + {{#if not}} + {{> src/main/kotlin/packagename/components/schemas/SchemaClass/_not }} + {{/if}} + {{#if propertyNames}} + {{> src/main/kotlin/packagename/components/schemas/SchemaClass/_propertyNames }} + {{/if}} + {{#if dependentRequired}} + {{> src/main/kotlin/packagename/components/schemas/SchemaClass/_dependentRequired }} + {{/if}} + {{#if dependentSchemas}} + {{> src/main/kotlin/packagename/components/schemas/SchemaClass/_dependentSchemas }} + {{/if}} + {{#if patternProperties}} + {{> src/main/kotlin/packagename/components/schemas/SchemaClass/_patternProperties }} + {{/if}} + {{#if if_}} + {{> src/main/kotlin/packagename/components/schemas/SchemaClass/_if }} + {{/if}} + {{#if then}} + {{> src/main/kotlin/packagename/components/schemas/SchemaClass/_then }} + {{/if}} + {{#if else_}} + {{> src/main/kotlin/packagename/components/schemas/SchemaClass/_else }} + {{/if}} + {{#if unevaluatedProperties}} + {{> src/main/kotlin/packagename/components/schemas/SchemaClass/_unevaluatedProperties }} + {{/if}} + ); + } + + public static {{jsonPathPiece.pascalCase}} getInstance() { + if (instance == null) { + instance = new {{jsonPathPiece.pascalCase}}(); + } + return instance; + } + {{#if hasDiscriminatorWithNonEmptyMapping}} + {{!> components/schemas/schema_cls/_discriminator }} + {{/if}} + {{> src/main/kotlin/packagename/components/schemas/SchemaClass/_validate_implementor }} + {{> src/main/kotlin/packagename/components/schemas/SchemaClass/_getNewInstanceObject_implementor }} + {{> src/main/kotlin/packagename/components/schemas/SchemaClass/_validateAndBox }} +} diff --git a/src/main/resources/kotlin/src/main/kotlin/packagename/components/schemas/SchemaClass/_Schema_null.hbs b/src/main/resources/kotlin/src/main/kotlin/packagename/components/schemas/SchemaClass/_Schema_null.hbs new file mode 100644 index 00000000000..891a45de9e7 --- /dev/null +++ b/src/main/resources/kotlin/src/main/kotlin/packagename/components/schemas/SchemaClass/_Schema_null.hbs @@ -0,0 +1,68 @@ + + +{{> src/main/kotlin/packagename/components/schemas/SchemaClass/_boxedClasses }} + + +public static class {{jsonPathPiece.pascalCase}} extends JsonSchema<{{jsonPathPiece.pascalCase}}Boxed> implements NullSchemaValidator<{{jsonPathPiece.pascalCase}}BoxedVoid>{{#and enumInfo enumInfo.typeToValues.null}}, NullEnumValidator{{/and}} { +{{#if componentModule}} + /* + NOTE: This class is auto generated by OpenAPI JSON Schema Generator. + Ref: https://github.com/openapi-json-schema-tools/openapi-json-schema-generator + + Do not edit the class manually. + {{#if description}} + + {{{description.original}}} + {{/if}} + */ +{{/if}} + private static @Nullable {{jsonPathPiece.pascalCase}} instance = null; + + protected {{../jsonPathPiece.pascalCase}}() { + super(new JsonSchemaInfo() + {{#if types}} + {{> src/main/kotlin/packagename/components/schemas/SchemaClass/_types }} + {{/if}} + {{#if allOf}} + {{> src/main/kotlin/packagename/components/schemas/SchemaClass/_allOf }} + {{/if}} + {{#if anyOf}} + {{> src/main/kotlin/packagename/components/schemas/SchemaClass/_anyOf }} + {{/if}} + {{#if oneOf}} + {{> src/main/kotlin/packagename/components/schemas/SchemaClass/_oneOf }} + {{/if}} + {{#if not}} + {{> src/main/kotlin/packagename/components/schemas/SchemaClass/_not }} + {{/if}} + {{#if enumInfo}} + {{> src/main/kotlin/packagename/components/schemas/SchemaClass/_enum }} + {{/if}} + {{#if defaultValue}} + {{> src/main/kotlin/packagename/components/schemas/SchemaClass/_default }} + {{/if}} + {{#if constInfo}} + {{> src/main/kotlin/packagename/components/schemas/SchemaClass/_const }} + {{/if}} + {{#if if_}} + {{> src/main/kotlin/packagename/components/schemas/SchemaClass/_if }} + {{/if}} + {{#if then}} + {{> src/main/kotlin/packagename/components/schemas/SchemaClass/_then }} + {{/if}} + {{#if else_}} + {{> src/main/kotlin/packagename/components/schemas/SchemaClass/_else }} + {{/if}} + ); + } + + public static {{jsonPathPiece.pascalCase}} getInstance() { + if (instance == null) { + instance = new {{jsonPathPiece.pascalCase}}(); + } + return instance; + } + {{> src/main/kotlin/packagename/components/schemas/SchemaClass/_validate_implementor }} + {{> src/main/kotlin/packagename/components/schemas/SchemaClass/_getNewInstanceObject_implementor }} + {{> src/main/kotlin/packagename/components/schemas/SchemaClass/_validateAndBox }} +} \ No newline at end of file diff --git a/src/main/resources/kotlin/src/main/kotlin/packagename/components/schemas/SchemaClass/_Schema_number.hbs b/src/main/resources/kotlin/src/main/kotlin/packagename/components/schemas/SchemaClass/_Schema_number.hbs new file mode 100644 index 00000000000..ab27cdb3512 --- /dev/null +++ b/src/main/resources/kotlin/src/main/kotlin/packagename/components/schemas/SchemaClass/_Schema_number.hbs @@ -0,0 +1,86 @@ + + +{{> src/main/kotlin/packagename/components/schemas/SchemaClass/_boxedClasses }} + + +public static class {{jsonPathPiece.pascalCase}} extends JsonSchema<{{jsonPathPiece.pascalCase}}Boxed> implements {{#with enumInfo}}{{#if typeToValues.Integer}}IntegerEnumValidator, {{/if}}{{#if typeToValues.Long}}LongEnumValidator, {{/if}}{{#if typeToValues.Float}}FloatEnumValidator, {{/if}}{{#if typeToValues.Double}}DoubleEnumValidator, {{/if}}{{/with}}NumberSchemaValidator<{{jsonPathPiece.pascalCase}}BoxedNumber> { +{{#if componentModule}} + /* + NOTE: This class is auto generated by OpenAPI JSON Schema Generator. + Ref: https://github.com/openapi-json-schema-tools/openapi-json-schema-generator + + Do not edit the class manually. + {{#if description}} + + {{{description.original}}} + {{/if}} + */ +{{/if}} + private static @Nullable {{jsonPathPiece.pascalCase}} instance = null; + + protected {{../jsonPathPiece.pascalCase}}() { + super(new JsonSchemaInfo() + {{#if types}} + {{> src/main/kotlin/packagename/components/schemas/SchemaClass/_types }} + {{/if}} + {{#if format}} + {{> src/main/kotlin/packagename/components/schemas/SchemaClass/_format }} + {{/if}} + {{#neq exclusiveMaximum null}} + {{> src/main/kotlin/packagename/components/schemas/SchemaClass/_exclusiveMaximum }} + {{/neq}} + {{#neq exclusiveMinimum null}} + {{> src/main/kotlin/packagename/components/schemas/SchemaClass/_exclusiveMinimum }} + {{/neq}} + {{#neq maximum null}} + {{> src/main/kotlin/packagename/components/schemas/SchemaClass/_maximum }} + {{/neq}} + {{#neq minimum null}} + {{> src/main/kotlin/packagename/components/schemas/SchemaClass/_minimum }} + {{/neq}} + {{#neq multipleOf null}} + {{> src/main/kotlin/packagename/components/schemas/SchemaClass/_multipleOf }} + {{/neq}} + {{#if allOf}} + {{> src/main/kotlin/packagename/components/schemas/SchemaClass/_allOf }} + {{/if}} + {{#if anyOf}} + {{> src/main/kotlin/packagename/components/schemas/SchemaClass/_anyOf }} + {{/if}} + {{#if oneOf}} + {{> src/main/kotlin/packagename/components/schemas/SchemaClass/_oneOf }} + {{/if}} + {{#if not}} + {{> src/main/kotlin/packagename/components/schemas/SchemaClass/_not }} + {{/if}} + {{#if enumInfo}} + {{> src/main/kotlin/packagename/components/schemas/SchemaClass/_enum }} + {{/if}} + {{#if defaultValue}} + {{> src/main/kotlin/packagename/components/schemas/SchemaClass/_default }} + {{/if}} + {{#if constInfo}} + {{> src/main/kotlin/packagename/components/schemas/SchemaClass/_const }} + {{/if}} + {{#if if_}} + {{> src/main/kotlin/packagename/components/schemas/SchemaClass/_if }} + {{/if}} + {{#if then}} + {{> src/main/kotlin/packagename/components/schemas/SchemaClass/_then }} + {{/if}} + {{#if else_}} + {{> src/main/kotlin/packagename/components/schemas/SchemaClass/_else }} + {{/if}} + ); + } + + public static {{jsonPathPiece.pascalCase}} getInstance() { + if (instance == null) { + instance = new {{jsonPathPiece.pascalCase}}(); + } + return instance; + } + {{> src/main/kotlin/packagename/components/schemas/SchemaClass/_validate_implementor }} + {{> src/main/kotlin/packagename/components/schemas/SchemaClass/_getNewInstanceObject_implementor }} + {{> src/main/kotlin/packagename/components/schemas/SchemaClass/_validateAndBox }} +} \ No newline at end of file diff --git a/src/main/resources/kotlin/src/main/kotlin/packagename/components/schemas/SchemaClass/_Schema_string.hbs b/src/main/resources/kotlin/src/main/kotlin/packagename/components/schemas/SchemaClass/_Schema_string.hbs new file mode 100644 index 00000000000..1294000cd0d --- /dev/null +++ b/src/main/resources/kotlin/src/main/kotlin/packagename/components/schemas/SchemaClass/_Schema_string.hbs @@ -0,0 +1,88 @@ + + +{{> src/main/kotlin/packagename/components/schemas/SchemaClass/_boxedClasses }} + + +public static class {{jsonPathPiece.pascalCase}} extends JsonSchema<{{jsonPathPiece.pascalCase}}Boxed> implements StringSchemaValidator<{{jsonPathPiece.pascalCase}}BoxedString>{{#and enumInfo enumInfo.typeToValues.string}}, StringEnumValidator{{/and}}{{#if defaultValue}}, DefaultValueMethod{{/if}} { +{{#if componentModule}} + /* + NOTE: This class is auto generated by OpenAPI JSON Schema Generator. + Ref: https://github.com/openapi-json-schema-tools/openapi-json-schema-generator + + Do not edit the class manually. + {{#if description}} + + {{{description.original}}} + {{/if}} + */ +{{/if}} + private static @Nullable {{jsonPathPiece.pascalCase}} instance = null; + + protected {{../jsonPathPiece.pascalCase}}() { + super(new JsonSchemaInfo() + {{#if types}} + {{> src/main/kotlin/packagename/components/schemas/SchemaClass/_types }} + {{/if}} + {{#if format}} + {{> src/main/kotlin/packagename/components/schemas/SchemaClass/_format }} + {{/if}} + {{#neq maxLength null }} + {{> src/main/kotlin/packagename/components/schemas/SchemaClass/_maxLength }} + {{/neq}} + {{#neq minLength null }} + {{> src/main/kotlin/packagename/components/schemas/SchemaClass/_minLength }} + {{/neq}} + {{#if allOf}} + {{> src/main/kotlin/packagename/components/schemas/SchemaClass/_allOf }} + {{/if}} + {{#if anyOf}} + {{> src/main/kotlin/packagename/components/schemas/SchemaClass/_anyOf }} + {{/if}} + {{#if oneOf}} + {{> src/main/kotlin/packagename/components/schemas/SchemaClass/_oneOf }} + {{/if}} + {{#if not}} + {{> src/main/kotlin/packagename/components/schemas/SchemaClass/_not }} + {{/if}} + {{#if enumInfo}} + {{> src/main/kotlin/packagename/components/schemas/SchemaClass/_enum }} + {{/if}} + {{#if patternInfo}} + {{> src/main/kotlin/packagename/components/schemas/SchemaClass/_pattern }} + {{/if}} + {{#if defaultValue}} + {{> src/main/kotlin/packagename/components/schemas/SchemaClass/_default }} + {{/if}} + {{#if constInfo}} + {{> src/main/kotlin/packagename/components/schemas/SchemaClass/_const }} + {{/if}} + {{#if if_}} + {{> src/main/kotlin/packagename/components/schemas/SchemaClass/_if }} + {{/if}} + {{#if then}} + {{> src/main/kotlin/packagename/components/schemas/SchemaClass/_then }} + {{/if}} + {{#if else_}} + {{> src/main/kotlin/packagename/components/schemas/SchemaClass/_else }} + {{/if}} + ); + } + + public static {{jsonPathPiece.pascalCase}} getInstance() { + if (instance == null) { + instance = new {{jsonPathPiece.pascalCase}}(); + } + return instance; + } + {{> src/main/kotlin/packagename/components/schemas/SchemaClass/_validate_implementor }} + {{> src/main/kotlin/packagename/components/schemas/SchemaClass/_getNewInstanceObject_implementor }} +{{#if defaultValue}} + public String defaultValue() throws ValidationException { + if (defaultValue instanceof String) { + return (String) defaultValue; + } + throw new ValidationException("Invalid type stored in defaultValue"); + } +{{/if}} + {{> src/main/kotlin/packagename/components/schemas/SchemaClass/_validateAndBox }} +} \ No newline at end of file diff --git a/src/main/resources/kotlin/src/main/kotlin/packagename/components/schemas/SchemaClass/_Schema_varEqualsClass.hbs b/src/main/resources/kotlin/src/main/kotlin/packagename/components/schemas/SchemaClass/_Schema_varEqualsClass.hbs new file mode 100644 index 00000000000..a3c7ff770a2 --- /dev/null +++ b/src/main/resources/kotlin/src/main/kotlin/packagename/components/schemas/SchemaClass/_Schema_varEqualsClass.hbs @@ -0,0 +1,108 @@ + + +{{#or isBooleanSchemaTrue isBooleanSchemaFalse}} + {{#if isBooleanSchemaTrue}} +public static class {{../jsonPathPiece.pascalCase}} extends AnyTypeJsonSchema.AnyTypeJsonSchema1 { + {{else}} +public static class {{jsonPathPiece.pascalCase}} extends NotAnyTypeJsonSchema.NotAnyTypeJsonSchema1 { + // NotAnyTypeSchema + {{/if}} +{{else}} + {{#if refInfo.refClass}} + {{#if simpleRef}} + {{#if refInfo.refModule}} + {{#with getDeepestRef}} +public static class {{../jsonPathPiece.pascalCase}} extends {{jsonPathPiece.pascalCase}} { + {{/with}} + {{else}} + {{#with refInfo.ref}} +public class {{../jsonPathPiece.pascalCase}} extends {{jsonPathPiece.pascalCase}} {} + {{/with}} + {{/if}} + {{else}} +// when is this case used? + {{/if}} + {{else}} + {{#eq types null}} +public static class {{../jsonPathPiece.pascalCase}} extends AnyTypeJsonSchema.AnyTypeJsonSchema1 { + {{else}} + {{#each types}} + {{#eq this "null"}} +public static class {{../jsonPathPiece.pascalCase}} extends NullJsonSchema.NullJsonSchema1 { + {{/eq}} + {{#eq this "object"}} +public static class {{../jsonPathPiece.pascalCase}} extends MapJsonSchema.MapJsonSchema1 { + {{/eq}} + {{#eq this "array"}} +public static class {{../jsonPathPiece.pascalCase}} extends ListJsonSchema.ListJsonSchema1 { + {{/eq}} + {{#eq this "boolean"}} +public static class {{../jsonPathPiece.pascalCase}} extends BooleanJsonSchema.BooleanJsonSchema1 { + {{/eq}} + {{#eq this "string"}} + {{#eq ../format "date"}} +public static class {{../jsonPathPiece.pascalCase}} extends DateJsonSchema.DateJsonSchema1 { + {{/eq}} + {{#eq ../format "date-time"}} +public static class {{../jsonPathPiece.pascalCase}} extends DateTimeJsonSchema.DateTimeJsonSchema1 { + {{/eq}} + {{#eq ../format "uuid"}} +public static class {{../jsonPathPiece.pascalCase}} extends UuidJsonSchema.UuidJsonSchema1 { + {{/eq}} + {{#eq ../format "number"}} +public static class {{../jsonPathPiece.pascalCase}} extends DecimalJsonSchema.DecimalJsonSchema1 { + {{/eq}} + {{#eq ../format "binary"}} +public static class {{jsonPathPiece.pascalCase}} extends StringJsonSchema.StringJsonSchema1 { + // BinarySchema + {{/eq}} + {{#neq ../format "date"}} + {{#neq ../format "date-time"}} + {{#neq ../format "uuid"}} + {{#neq ../format "number"}} + {{#neq ../format "binary"}} +public static class {{../jsonPathPiece.pascalCase}} extends StringJsonSchema.StringJsonSchema1 { + {{/neq}} + {{/neq}} + {{/neq}} + {{/neq}} + {{/neq}} + {{/eq}} + {{#eq this "integer"}} + {{#eq ../format "int32"}} +public static class {{../jsonPathPiece.pascalCase}} extends Int32JsonSchema.Int32JsonSchema1 { + {{/eq}} + {{#eq ../format "int64"}} +public static class {{../jsonPathPiece.pascalCase}} extends Int64JsonSchema.Int64JsonSchema1 { + {{/eq}} + {{#neq ../format "int32"}} + {{#neq ../format "int64"}} +public static class {{../jsonPathPiece.pascalCase}} extends IntJsonSchema.IntJsonSchema1 { + {{/neq}} + {{/neq}} + {{/eq}} + {{#eq this "number"}} + {{#eq ../format null}} +public static class {{../jsonPathPiece.pascalCase}} extends NumberJsonSchema.NumberJsonSchema1 { + {{else}} + {{#eq ../format "float"}} +public static class {{../jsonPathPiece.pascalCase}} extends FloatJsonSchema.FloatJsonSchema1 { + {{else}} + {{#eq ../format "double"}} +public static class {{../jsonPathPiece.pascalCase}} extends DoubleJsonSchema.DoubleJsonSchema1 { + {{/eq}} + {{/eq}} + {{/eq}} + {{/eq}} + {{/each}} + {{/eq}} + {{/if}} +{{/or}} + private static @Nullable {{jsonPathPiece.pascalCase}} instance = null; + public static {{jsonPathPiece.pascalCase}} getInstance() { + if (instance == null) { + instance = new {{jsonPathPiece.pascalCase}}(); + } + return instance; + } +} diff --git a/src/main/resources/kotlin/src/main/kotlin/packagename/components/schemas/SchemaClass/_additionalProperties.hbs b/src/main/resources/kotlin/src/main/kotlin/packagename/components/schemas/SchemaClass/_additionalProperties.hbs new file mode 100644 index 00000000000..01b618e5650 --- /dev/null +++ b/src/main/resources/kotlin/src/main/kotlin/packagename/components/schemas/SchemaClass/_additionalProperties.hbs @@ -0,0 +1,17 @@ +{{#if forDocs}} + {{#with additionalProperties}} + {{#if refInfo.refClass}} + {{#if refInfo.refModule}} +additionalProperties = [{{refInfo.refModule}}.{{refInfo.refClass}}.class]({{docRoot}}{{refInfo.ref.pathFromDocRoot}}.md#{{refInfo.ref.jsonPathPiece.kebabCase}}) + {{~else}} +additionalProperties = [{{refInfo.refClass}}.class](#{{refInfo.ref.jsonPathPiece.kebabCase}}) + {{~/if}} + {{else}} +additionalProperties = [{{jsonPathPiece.pascalCase}}.class](#{{jsonPathPiece.kebabCase}}) + {{~/if}} + {{~/with}} +{{else}} + {{#with additionalProperties}} +.additionalProperties({{#if refInfo.refClass}}{{#if refInfo.refModule}}{{refInfo.refModule}}.{{/if}}{{refInfo.refClass}}{{else}}{{jsonPathPiece.pascalCase}}{{/if}}.class) + {{/with}} +{{/if}} \ No newline at end of file diff --git a/src/main/resources/kotlin/src/main/kotlin/packagename/components/schemas/SchemaClass/_allOf.hbs b/src/main/resources/kotlin/src/main/kotlin/packagename/components/schemas/SchemaClass/_allOf.hbs new file mode 100644 index 00000000000..cba0b06fac6 --- /dev/null +++ b/src/main/resources/kotlin/src/main/kotlin/packagename/components/schemas/SchemaClass/_allOf.hbs @@ -0,0 +1,29 @@ +{{#if forDocs}} +allOf = List.of(
+ {{~#each allOf}} + {{#if refInfo.refClass}} + {{#if refInfo.refModule}} +    [{{refInfo.refModule}}.{{refInfo.refClass}}.class]({{docRoot}}{{refInfo.ref.pathFromDocRoot}}.md#{{refInfo.ref.jsonPathPiece.kebabCase}}){{#unless @last}},{{/unless}}
+ {{~else}} +    [{{refInfo.refClass}}.class](#{{refInfo.ref.jsonPathPiece.kebabCase}}){{#unless @last}},{{/unless}}
+ {{~/if}} + {{else}} +    [{{jsonPathPiece.pascalCase}}.class](#{{jsonPathPiece.kebabCase}}){{#unless @last}},{{/unless}}
+ {{~/if}} + {{/each}} +;)
+{{~else}} +.allOf(List.of( + {{#each allOf}} + {{#if refInfo.refClass}} + {{#if refInfo.refModule}} + {{refInfo.refModule}}.{{refInfo.refClass}}.class{{#unless @last}},{{/unless}} + {{else}} + {{refInfo.refClass}}.class{{#unless @last}},{{/unless}} + {{/if}} + {{else}} + {{jsonPathPiece.pascalCase}}.class{{#unless @last}},{{/unless}} + {{/if}} + {{/each}} +)) +{{/if}} \ No newline at end of file diff --git a/src/main/resources/kotlin/src/main/kotlin/packagename/components/schemas/SchemaClass/_anyOf.hbs b/src/main/resources/kotlin/src/main/kotlin/packagename/components/schemas/SchemaClass/_anyOf.hbs new file mode 100644 index 00000000000..ecfdebd360e --- /dev/null +++ b/src/main/resources/kotlin/src/main/kotlin/packagename/components/schemas/SchemaClass/_anyOf.hbs @@ -0,0 +1,29 @@ +{{#if forDocs}} +anyOf = List.of(
+ {{~#each anyOf}} + {{#if refInfo.refClass}} + {{#if refInfo.refModule}} +    [{{refInfo.refModule}}.{{refInfo.refClass}}.class]({{docRoot}}{{refInfo.ref.pathFromDocRoot}}.md#{{refInfo.ref.jsonPathPiece.kebabCase}}){{#unless @last}},{{/unless}}
+ {{~else}} +    [{{refInfo.refClass}}.class](#{{refInfo.ref.jsonPathPiece.kebabCase}}){{#unless @last}},{{/unless}}
+ {{~/if}} + {{else}} +    [{{jsonPathPiece.pascalCase}}.class](#{{jsonPathPiece.kebabCase}}){{#unless @last}},{{/unless}}
+ {{~/if}} + {{/each}} +)
+{{~else}} +.anyOf(List.of( + {{#each anyOf}} + {{#if refInfo.refClass}} + {{#if refInfo.refModule}} + {{refInfo.refModule}}.{{refInfo.refClass}}.class{{#unless @last}},{{/unless}} + {{else}} + {{refInfo.refClass}}.class{{#unless @last}},{{/unless}} + {{/if}} + {{else}} + {{jsonPathPiece.pascalCase}}.class{{#unless @last}},{{/unless}} + {{/if}} + {{/each}} +)) +{{/if}} \ No newline at end of file diff --git a/src/main/resources/kotlin/src/main/kotlin/packagename/components/schemas/SchemaClass/_boxedBoolean.hbs b/src/main/resources/kotlin/src/main/kotlin/packagename/components/schemas/SchemaClass/_boxedBoolean.hbs new file mode 100644 index 00000000000..6086ccbf430 --- /dev/null +++ b/src/main/resources/kotlin/src/main/kotlin/packagename/components/schemas/SchemaClass/_boxedBoolean.hbs @@ -0,0 +1,27 @@ +{{#if forDocs}} +{{> src/main/kotlin/packagename/components/_helper_header_from_identifier_pieces headerSize=(join headerSize "#" "") identifierPieces=(append identifierPieces (join jsonPathPiece.pascalCase "BoxedBoolean" "")) }} +public record {{jsonPathPiece.pascalCase}}BoxedBoolean
+implements [{{jsonPathPiece.pascalCase}}Boxed](#{{> src/main/kotlin/packagename/components/_helper_anchor_id identifierPieces=(append identifierPieces (join jsonPathPiece.kebabCase "boxed" "")) }}) + +record that stores validated boolean payloads, sealed permits implementation + +{{headerSize}}## Constructor Summary +| Constructor and Description | +| --------------------------- | +| {{jsonPathPiece.pascalCase}}BoxedBoolean(boolean data)
Creates an instance, private visibility | + +{{headerSize}}## Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| boolean | data()
validated payload | +| @Nullable Object | getData()
validated payload | + +{{else}} +public record {{jsonPathPiece.pascalCase}}BoxedBoolean(boolean data) implements {{jsonPathPiece.pascalCase}}Boxed { + @Override + public @Nullable Object getData() { + return data; + } +} + +{{/if}} \ No newline at end of file diff --git a/src/main/resources/kotlin/src/main/kotlin/packagename/components/schemas/SchemaClass/_boxedClass.hbs b/src/main/resources/kotlin/src/main/kotlin/packagename/components/schemas/SchemaClass/_boxedClass.hbs new file mode 100644 index 00000000000..9eef60920a3 --- /dev/null +++ b/src/main/resources/kotlin/src/main/kotlin/packagename/components/schemas/SchemaClass/_boxedClass.hbs @@ -0,0 +1,39 @@ +{{#if forDocs}} +{{> src/main/kotlin/packagename/components/_helper_header_from_identifier_pieces headerSize=(join headerSize "#" "") identifierPieces=(append identifierPieces (join jsonPathPiece.pascalCase "Boxed" "")) }} +public sealed interface {{jsonPathPiece.pascalCase}}Boxed
+permits
+{{#each types}} + {{#eq this "null"}} +[{{jsonPathPiece.pascalCase}}BoxedVoid](#{{> src/main/kotlin/packagename/components/_helper_anchor_id identifierPieces=(append identifierPieces (join jsonPathPiece.kebabCase "boxedvoid" ""))}}){{#unless @last}},{{/unless}} + {{/eq}} + {{#eq this "boolean"}} +[{{jsonPathPiece.pascalCase}}BoxedBoolean](#{{> src/main/kotlin/packagename/components/_helper_anchor_id identifierPieces=(append identifierPieces (join jsonPathPiece.kebabCase "boxedboolean" ""))}}){{#unless @last}},{{/unless}} + {{/eq}} + {{#or (eq this "number") (eq this "integer")}} +[{{jsonPathPiece.pascalCase}}BoxedNumber](#{{> src/main/kotlin/packagename/components/_helper_anchor_id identifierPieces=(append identifierPieces (join jsonPathPiece.kebabCase "boxednumber" ""))}}){{#unless @last}},{{/unless}} + {{/or}} + {{#and (eq this "string") (neq ../format "binary") }} +[{{jsonPathPiece.pascalCase}}BoxedString](#{{> src/main/kotlin/packagename/components/_helper_anchor_id identifierPieces=(append identifierPieces (join jsonPathPiece.kebabCase "boxedstring" ""))}}){{#unless @last}},{{/unless}} + {{/and}} + {{#eq this "array"}} +[{{jsonPathPiece.pascalCase}}BoxedList](#{{> src/main/kotlin/packagename/components/_helper_anchor_id identifierPieces=(append identifierPieces (join jsonPathPiece.kebabCase "boxedlist" ""))}}){{#unless @last}},{{/unless}} + {{/eq}}{{#eq this "object"}} +[{{jsonPathPiece.pascalCase}}BoxedMap](#{{> src/main/kotlin/packagename/components/_helper_anchor_id identifierPieces=(append identifierPieces (join jsonPathPiece.kebabCase "boxedmap" ""))}}){{#unless @last}},{{/unless}} + {{/eq}} +{{else}} +[{{jsonPathPiece.pascalCase}}BoxedVoid](#{{> src/main/kotlin/packagename/components/_helper_anchor_id identifierPieces=(append identifierPieces (join jsonPathPiece.kebabCase "boxedvoid" ""))}}), +[{{jsonPathPiece.pascalCase}}BoxedBoolean](#{{> src/main/kotlin/packagename/components/_helper_anchor_id identifierPieces=(append identifierPieces (join jsonPathPiece.kebabCase "boxedboolean" ""))}}), +[{{jsonPathPiece.pascalCase}}BoxedNumber](#{{> src/main/kotlin/packagename/components/_helper_anchor_id identifierPieces=(append identifierPieces (join jsonPathPiece.kebabCase "boxednumber" ""))}}), +[{{jsonPathPiece.pascalCase}}BoxedString](#{{> src/main/kotlin/packagename/components/_helper_anchor_id identifierPieces=(append identifierPieces (join jsonPathPiece.kebabCase "boxedstring" ""))}}), +[{{jsonPathPiece.pascalCase}}BoxedList](#{{> src/main/kotlin/packagename/components/_helper_anchor_id identifierPieces=(append identifierPieces (join jsonPathPiece.kebabCase "boxedlist" ""))}}), +[{{jsonPathPiece.pascalCase}}BoxedMap](#{{> src/main/kotlin/packagename/components/_helper_anchor_id identifierPieces=(append identifierPieces (join jsonPathPiece.kebabCase "boxedmap" ""))}}) +{{/each}} + +sealed interface that stores validated payloads using boxed classes + +{{else}} +public sealed interface {{jsonPathPiece.pascalCase}}Boxed permits {{#each types}}{{jsonPathPiece.pascalCase}}Boxed{{#eq this "null"}}Nothing?{{/eq}}{{#eq this "boolean"}}Boolean{{/eq}}{{#or (eq this "number") (eq this "integer")}}Number{{/or}}{{#and (eq this "string") (neq ../format "binary") }}String{{/and}}{{#eq this "array"}}List{{/eq}}{{#eq this "object"}}Map{{/eq}}{{#unless @last}}, {{/unless}}{{else}}{{jsonPathPiece.pascalCase}}BoxedVoid, {{jsonPathPiece.pascalCase}}BoxedBoolean, {{jsonPathPiece.pascalCase}}BoxedNumber, {{jsonPathPiece.pascalCase}}BoxedString, {{jsonPathPiece.pascalCase}}BoxedList, {{jsonPathPiece.pascalCase}}BoxedMap{{/each}} { + @Nullable Object getData(); +} + +{{/if}} \ No newline at end of file diff --git a/src/main/resources/kotlin/src/main/kotlin/packagename/components/schemas/SchemaClass/_boxedClasses.hbs b/src/main/resources/kotlin/src/main/kotlin/packagename/components/schemas/SchemaClass/_boxedClasses.hbs new file mode 100644 index 00000000000..c911bda4b81 --- /dev/null +++ b/src/main/resources/kotlin/src/main/kotlin/packagename/components/schemas/SchemaClass/_boxedClasses.hbs @@ -0,0 +1,31 @@ +{{#if types}} +{{> src/main/kotlin/packagename/components/schemas/SchemaClass/_boxedClass }} + {{#each types}} + {{#eq this "null"}} +{{> src/main/kotlin/packagename/components/schemas/SchemaClass/_boxedVoid }} + {{/eq}} + {{#eq this "boolean"}} +{{> src/main/kotlin/packagename/components/schemas/SchemaClass/_boxedBoolean }} + {{/eq}} + {{#and (eq this "string") (neq ../format "binary") }} +{{> src/main/kotlin/packagename/components/schemas/SchemaClass/_boxedString }} + {{/and}} + {{#or (eq this "number") (eq this "integer")}} +{{> src/main/kotlin/packagename/components/schemas/SchemaClass/_boxedNumber }} + {{/or}} + {{#eq this "array"}} +{{> src/main/kotlin/packagename/components/schemas/SchemaClass/_boxedList }} + {{/eq}} + {{#eq this "object"}} +{{> src/main/kotlin/packagename/components/schemas/SchemaClass/_boxedMap }} + {{/eq}} + {{/each}} +{{else}} +{{> src/main/kotlin/packagename/components/schemas/SchemaClass/_boxedClass }} +{{> src/main/kotlin/packagename/components/schemas/SchemaClass/_boxedVoid }} +{{> src/main/kotlin/packagename/components/schemas/SchemaClass/_boxedBoolean }} +{{> src/main/kotlin/packagename/components/schemas/SchemaClass/_boxedNumber }} +{{> src/main/kotlin/packagename/components/schemas/SchemaClass/_boxedString }} +{{> src/main/kotlin/packagename/components/schemas/SchemaClass/_boxedList }} +{{> src/main/kotlin/packagename/components/schemas/SchemaClass/_boxedMap }} +{{/if}} \ No newline at end of file diff --git a/src/main/resources/kotlin/src/main/kotlin/packagename/components/schemas/SchemaClass/_boxedList.hbs b/src/main/resources/kotlin/src/main/kotlin/packagename/components/schemas/SchemaClass/_boxedList.hbs new file mode 100644 index 00000000000..5f9df442323 --- /dev/null +++ b/src/main/resources/kotlin/src/main/kotlin/packagename/components/schemas/SchemaClass/_boxedList.hbs @@ -0,0 +1,27 @@ +{{#if forDocs}} +{{> src/main/kotlin/packagename/components/_helper_header_from_identifier_pieces headerSize=(join headerSize "#" "") identifierPieces=(append identifierPieces (join jsonPathPiece.pascalCase "BoxedList" "")) }} +public record {{jsonPathPiece.pascalCase}}BoxedList
+implements [{{jsonPathPiece.pascalCase}}Boxed](#{{> src/main/kotlin/packagename/components/_helper_anchor_id identifierPieces=(append identifierPieces (join jsonPathPiece.kebabCase "boxed" "")) }}) + +record that stores validated List payloads, sealed permits implementation + +{{headerSize}}## Constructor Summary +| Constructor and Description | +| --------------------------- | +| {{jsonPathPiece.pascalCase}}BoxedList({{#if arrayOutputJsonPathPiece}}[{{arrayOutputJsonPathPiece.pascalCase}}](#{{> src/main/kotlin/packagename/components/_helper_anchor_id identifierPieces=(append identifierPieces arrayOutputJsonPathPiece) }}){{else}}FrozenList<@Nullable Object>{{/if}} data)
Creates an instance, private visibility | + +{{headerSize}}## Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| {{#if arrayOutputJsonPathPiece}}[{{arrayOutputJsonPathPiece.pascalCase}}](#{{> src/main/kotlin/packagename/components/_helper_anchor_id identifierPieces=(append identifierPieces arrayOutputJsonPathPiece) }}){{else}}FrozenList<@Nullable Object>{{/if}} | data()
validated payload | +| @Nullable Object | getData()
validated payload | + +{{else}} +public record {{jsonPathPiece.pascalCase}}BoxedList({{#if arrayOutputJsonPathPiece}}{{arrayOutputJsonPathPiece.pascalCase}}{{else}}FrozenList<@Nullable Object>{{/if}} data) implements {{jsonPathPiece.pascalCase}}Boxed { + @Override + public @Nullable Object getData() { + return data; + } +} + +{{/if}} \ No newline at end of file diff --git a/src/main/resources/kotlin/src/main/kotlin/packagename/components/schemas/SchemaClass/_boxedMap.hbs b/src/main/resources/kotlin/src/main/kotlin/packagename/components/schemas/SchemaClass/_boxedMap.hbs new file mode 100644 index 00000000000..3b8837b2656 --- /dev/null +++ b/src/main/resources/kotlin/src/main/kotlin/packagename/components/schemas/SchemaClass/_boxedMap.hbs @@ -0,0 +1,26 @@ +{{#if forDocs}} +{{> src/main/kotlin/packagename/components/_helper_header_from_identifier_pieces headerSize=(join headerSize "#" "") identifierPieces=(append identifierPieces (join jsonPathPiece.pascalCase "BoxedMap" "")) }} +public record {{jsonPathPiece.pascalCase}}BoxedMap
+implements [{{jsonPathPiece.pascalCase}}Boxed](#{{> src/main/kotlin/packagename/components/_helper_anchor_id identifierPieces=(append identifierPieces (join jsonPathPiece.kebabCase "boxed" "")) }}) + +record that stores validated Map payloads, sealed permits implementation + +{{headerSize}}## Constructor Summary +| Constructor and Description | +| --------------------------- | +| {{jsonPathPiece.pascalCase}}BoxedMap({{#if mapOutputJsonPathPiece}}[{{mapOutputJsonPathPiece.pascalCase}}](#{{> src/main/kotlin/packagename/components/_helper_anchor_id identifierPieces=(append identifierPieces mapOutputJsonPathPiece) }}){{else}}FrozenMap<@Nullable Object>{{/if}} data)
Creates an instance, private visibility | + +{{headerSize}}## Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| {{#if mapOutputJsonPathPiece}}[{{mapOutputJsonPathPiece.pascalCase}}](#{{> src/main/kotlin/packagename/components/_helper_anchor_id identifierPieces=(append identifierPieces mapOutputJsonPathPiece) }}){{else}}FrozenMap<@Nullable Object>{{/if}} | data()
validated payload | +| @Nullable Object | getData()
validated payload | + +{{else}} +public record {{jsonPathPiece.pascalCase}}BoxedMap({{#if mapOutputJsonPathPiece}}{{mapOutputJsonPathPiece.pascalCase}}{{else}}FrozenMap<@Nullable Object>{{/if}} data) implements {{jsonPathPiece.pascalCase}}Boxed { + @Override + public @Nullable Object getData() { + return data; + } +} +{{/if}} diff --git a/src/main/resources/kotlin/src/main/kotlin/packagename/components/schemas/SchemaClass/_boxedNumber.hbs b/src/main/resources/kotlin/src/main/kotlin/packagename/components/schemas/SchemaClass/_boxedNumber.hbs new file mode 100644 index 00000000000..0eda90cd528 --- /dev/null +++ b/src/main/resources/kotlin/src/main/kotlin/packagename/components/schemas/SchemaClass/_boxedNumber.hbs @@ -0,0 +1,27 @@ +{{#if forDocs}} +{{> src/main/kotlin/packagename/components/_helper_header_from_identifier_pieces headerSize=(join headerSize "#" "") identifierPieces=(append identifierPieces (join jsonPathPiece.pascalCase "BoxedNumber" "")) }} +public record {{jsonPathPiece.pascalCase}}BoxedNumber
+implements [{{jsonPathPiece.pascalCase}}Boxed](#{{> src/main/kotlin/packagename/components/_helper_anchor_id identifierPieces=(append identifierPieces (join jsonPathPiece.kebabCase "boxed" "")) }}) + +record that stores validated Number payloads, sealed permits implementation + +{{headerSize}}## Constructor Summary +| Constructor and Description | +| --------------------------- | +| {{jsonPathPiece.pascalCase}}BoxedNumber(Number data)
Creates an instance, private visibility | + +{{headerSize}}## Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| Number | data()
validated payload | +| @Nullable Object | getData()
validated payload | + +{{else}} +public record {{jsonPathPiece.pascalCase}}BoxedNumber(Number data) implements {{jsonPathPiece.pascalCase}}Boxed { + @Override + public @Nullable Object getData() { + return data; + } +} + +{{/if}} \ No newline at end of file diff --git a/src/main/resources/kotlin/src/main/kotlin/packagename/components/schemas/SchemaClass/_boxedString.hbs b/src/main/resources/kotlin/src/main/kotlin/packagename/components/schemas/SchemaClass/_boxedString.hbs new file mode 100644 index 00000000000..4b2b9c0615c --- /dev/null +++ b/src/main/resources/kotlin/src/main/kotlin/packagename/components/schemas/SchemaClass/_boxedString.hbs @@ -0,0 +1,27 @@ +{{#if forDocs}} +{{> src/main/kotlin/packagename/components/_helper_header_from_identifier_pieces headerSize=(join headerSize "#" "") identifierPieces=(append identifierPieces (join jsonPathPiece.pascalCase "BoxedString" "")) }} +public record {{jsonPathPiece.pascalCase}}BoxedString
+implements [{{jsonPathPiece.pascalCase}}Boxed](#{{> src/main/kotlin/packagename/components/_helper_anchor_id identifierPieces=(append identifierPieces (join jsonPathPiece.kebabCase "boxed" "")) }}) + +record that stores validated String payloads, sealed permits implementation + +{{headerSize}}## Constructor Summary +| Constructor and Description | +| --------------------------- | +| {{jsonPathPiece.pascalCase}}BoxedString(String data)
Creates an instance, private visibility | + +{{headerSize}}## Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| String | data()
validated payload | +| @Nullable Object | getData()
validated payload | + +{{else}} +public record {{jsonPathPiece.pascalCase}}BoxedString(String data) implements {{jsonPathPiece.pascalCase}}Boxed { + @Override + public @Nullable Object getData() { + return data; + } +} + +{{/if}} \ No newline at end of file diff --git a/src/main/resources/kotlin/src/main/kotlin/packagename/components/schemas/SchemaClass/_boxedVoid.hbs b/src/main/resources/kotlin/src/main/kotlin/packagename/components/schemas/SchemaClass/_boxedVoid.hbs new file mode 100644 index 00000000000..ab3557beb48 --- /dev/null +++ b/src/main/resources/kotlin/src/main/kotlin/packagename/components/schemas/SchemaClass/_boxedVoid.hbs @@ -0,0 +1,27 @@ +{{#if forDocs}} +{{> src/main/kotlin/packagename/components/_helper_header_from_identifier_pieces headerSize=(join headerSize "#" "") identifierPieces=(append identifierPieces (join jsonPathPiece.pascalCase "BoxedVoid" "")) }} +public record {{jsonPathPiece.pascalCase}}BoxedVoid
+implements [{{jsonPathPiece.pascalCase}}Boxed](#{{> src/main/kotlin/packagename/components/_helper_anchor_id identifierPieces=(append identifierPieces (join jsonPathPiece.kebabCase "boxed" "")) }}) + +record that stores validated null payloads, sealed permits implementation + +{{headerSize}}## Constructor Summary +| Constructor and Description | +| --------------------------- | +| {{jsonPathPiece.pascalCase}}BoxedVoid(Nothing? data)
Creates an instance, private visibility | + +{{headerSize}}## Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| Nothing? | data()
validated payload | +| @Nullable Object | getData()
validated payload | + +{{else}} +public record {{jsonPathPiece.pascalCase}}BoxedVoid(Nothing? data) implements {{jsonPathPiece.pascalCase}}Boxed { + @Override + public @Nullable Object getData() { + return data; + } +} + +{{/if}} \ No newline at end of file diff --git a/src/main/resources/kotlin/src/main/kotlin/packagename/components/schemas/SchemaClass/_const.hbs b/src/main/resources/kotlin/src/main/kotlin/packagename/components/schemas/SchemaClass/_const.hbs new file mode 100644 index 00000000000..1f463e8d943 --- /dev/null +++ b/src/main/resources/kotlin/src/main/kotlin/packagename/components/schemas/SchemaClass/_const.hbs @@ -0,0 +1,5 @@ +{{#if forDocs}} +constValue = {{#each constInfo.valueToName}}{{#with @key}}{{#eq type "string"}}"{{{value}}}"{{else}}{{#eq type "null"}}null{{else}}{{value}}{{/eq}}{{/eq}}{{/with}}{{/each}} +{{~else}} +.constValue({{#each constInfo.valueToName}}{{#with @key}}{{#eq type "string"}}"{{{value}}}"{{else}}{{#eq type "null"}}null{{else}}{{#eq type "boolean"}}{{value}}{{else}}new BigDecimal("{{value.toString}}"){{/eq}}{{/eq}}{{/eq}}{{/with}}{{/each}}) +{{/if}} \ No newline at end of file diff --git a/src/main/resources/kotlin/src/main/kotlin/packagename/components/schemas/SchemaClass/_contains.hbs b/src/main/resources/kotlin/src/main/kotlin/packagename/components/schemas/SchemaClass/_contains.hbs new file mode 100644 index 00000000000..d67e673a3b8 --- /dev/null +++ b/src/main/resources/kotlin/src/main/kotlin/packagename/components/schemas/SchemaClass/_contains.hbs @@ -0,0 +1,17 @@ +{{#if forDocs}} + {{#with contains}} + {{#if refInfo.refClass}} + {{#if refInfo.refModule}} +contains = [{{refInfo.refModule}}.{{refInfo.refClass}}.class]({{docRoot}}{{refInfo.ref.pathFromDocRoot}}.md#{{refInfo.ref.jsonPathPiece.kebabCase}}) + {{~else}} +contains = [{{refInfo.refClass}}.class](#{{refInfo.ref.jsonPathPiece.kebabCase}}) + {{~/if}} + {{else}} +contains = [{{jsonPathPiece.pascalCase}}.class](#{{jsonPathPiece.kebabCase}}) + {{~/if}} + {{/with}} +{{else}} + {{#with contains}} +.contains({{#if refInfo.refClass}}{{#if refInfo.refModule}}{{refInfo.refModule}}.{{/if}}{{refInfo.refClass}}{{else}}{{jsonPathPiece.pascalCase}}{{/if}}.class) + {{/with}} +{{/if}} \ No newline at end of file diff --git a/src/main/resources/kotlin/src/main/kotlin/packagename/components/schemas/SchemaClass/_default.hbs b/src/main/resources/kotlin/src/main/kotlin/packagename/components/schemas/SchemaClass/_default.hbs new file mode 100644 index 00000000000..e082984cb09 --- /dev/null +++ b/src/main/resources/kotlin/src/main/kotlin/packagename/components/schemas/SchemaClass/_default.hbs @@ -0,0 +1,43 @@ +{{#with defaultValue}} + {{#if forDocs}} + {{#eq type "string"}} +defaultValue = "{{{value}}}" + {{~else}} + {{#or (eq type "number") (eq type "integer")}} +defaultValue = {{{value}}} + {{~else}} + {{#eq type "boolean"}} + {{#if value}} +defaultValue = true + {{~else}} +defaultValue = false + {{~/if}} + {{else}} + {{#eq type "null"}} +defaultValue = null + {{~/eq}} + {{/eq}} + {{/or}} + {{/eq}} + {{else}} + {{#eq type "string"}} +.defaultValue("{{{value}}}") + {{else}} + {{#or (eq type "number") (eq type "integer")}} +.defaultValue({{{value}}}) + {{else}} + {{#eq type "boolean"}} + {{#if value}} +.defaultValue(true) + {{else}} +.defaultValue(false) + {{/if}} + {{else}} + {{#eq type "null"}} +.defaultValue(null) + {{/eq}} + {{/eq}} + {{/or}} + {{/eq}} + {{/if}} +{{/with}} \ No newline at end of file diff --git a/src/main/resources/kotlin/src/main/kotlin/packagename/components/schemas/SchemaClass/_dependentRequired.hbs b/src/main/resources/kotlin/src/main/kotlin/packagename/components/schemas/SchemaClass/_dependentRequired.hbs new file mode 100644 index 00000000000..b134b9fb065 --- /dev/null +++ b/src/main/resources/kotlin/src/main/kotlin/packagename/components/schemas/SchemaClass/_dependentRequired.hbs @@ -0,0 +1,27 @@ +{{#if forDocs}} +dependentRequired = MapUtils.makeMap(
+ {{#each dependentRequired}} +    new AbstractMap.SimpleEntry<>(
+        "{{{@key}}}",
+        SetMaker.makeSet( + {{#each this}} +            "{{{this}}}"{{#unless @last}},{{/unless}}
+ {{/each}} +        ) +    ){{#unless @last}},{{/unless}}
+ {{/each}} +) +{{else}} +.dependentRequired(MapUtils.makeMap( + {{#each dependentRequired}} + new AbstractMap.SimpleEntry<>( + "{{{@key}}}", + SetMaker.makeSet( + {{#each this}} + "{{{this}}}"{{#unless @last}},{{/unless}} + {{/each}} + ) + ){{#unless @last}},{{/unless}} + {{/each}} +)) +{{/if}} \ No newline at end of file diff --git a/src/main/resources/kotlin/src/main/kotlin/packagename/components/schemas/SchemaClass/_dependentSchemas.hbs b/src/main/resources/kotlin/src/main/kotlin/packagename/components/schemas/SchemaClass/_dependentSchemas.hbs new file mode 100644 index 00000000000..0ed7ecdef8a --- /dev/null +++ b/src/main/resources/kotlin/src/main/kotlin/packagename/components/schemas/SchemaClass/_dependentSchemas.hbs @@ -0,0 +1,29 @@ +{{#if forDocs}} +dependentSchemas = Map.ofEntries(
+ {{~#each dependentSchemas}} + {{#if refInfo.refClass}} + {{#if refInfo.refModule}} +    new PropertyEntry("{{{@key.original}}}", [{{refInfo.refModule}}.{{refInfo.refClass}}.class]({{docRoot}}{{refInfo.ref.pathFromDocRoot}}.md#{{refInfo.ref.jsonPathPiece.kebabCase}})){{#unless @last}},{{/unless}}
+ {{~else}} +    new PropertyEntry("{{{@key.original}}}", [{{refInfo.refClass}}.class](#{{refInfo.ref.jsonPathPiece.kebabCase}}))){{#unless @last}},{{/unless}}
+ {{~/if}} + {{else}} +    new PropertyEntry("{{{@key.original}}}", [{{jsonPathPiece.pascalCase}}.class](#{{jsonPathPiece.kebabCase}}))){{#unless @last}},{{/unless}}
+ {{~/if}} + {{/each}} +)
+{{~else}} +.dependentSchemas(Map.ofEntries( + {{#each dependentSchemas}} + {{#if refInfo.refClass}} + {{#if refInfo.refModule}} + new PropertyEntry("{{{@key.original}}}", {{refInfo.refModule}}.{{refInfo.refClass}}.class){{#unless @last}},{{/unless}} + {{else}} + new PropertyEntry("{{{@key.original}}}", {{refInfo.refClass}}.class){{#unless @last}},{{/unless}} + {{/if}} + {{else}} + new PropertyEntry("{{{@key.original}}}", {{jsonPathPiece.pascalCase}}.class){{#unless @last}},{{/unless}} + {{/if}} + {{/each}} +)) +{{/if}} \ No newline at end of file diff --git a/src/main/resources/kotlin/src/main/kotlin/packagename/components/schemas/SchemaClass/_else.hbs b/src/main/resources/kotlin/src/main/kotlin/packagename/components/schemas/SchemaClass/_else.hbs new file mode 100644 index 00000000000..1175b6ce258 --- /dev/null +++ b/src/main/resources/kotlin/src/main/kotlin/packagename/components/schemas/SchemaClass/_else.hbs @@ -0,0 +1,17 @@ +{{#if forDocs}} + {{#with else_}} + {{#if refInfo.refClass}} + {{#if refInfo.refModule}} +elseSchema = [{{refInfo.refModule}}.{{refInfo.refClass}}.class]({{docRoot}}{{refInfo.ref.pathFromDocRoot}}.md#{{refInfo.ref.jsonPathPiece.kebabCase}}) + {{~else}} +elseSchema = [{{refInfo.refClass}}.class](#{{refInfo.ref.jsonPathPiece.kebabCase}}) + {{~/if}} + {{else}} +elseSchema = [{{jsonPathPiece.pascalCase}}.class](#{{jsonPathPiece.kebabCase}}) + {{~/if}} + {{~/with}} +{{else}} + {{#with else_}} +.elseSchema({{#if refInfo.refClass}}{{#if refInfo.refModule}}{{refInfo.refModule}}.{{/if}}{{refInfo.refClass}}{{else}}{{jsonPathPiece.pascalCase}}{{/if}}.class) + {{/with}} +{{/if}} \ No newline at end of file diff --git a/src/main/resources/kotlin/src/main/kotlin/packagename/components/schemas/SchemaClass/_enum.hbs b/src/main/resources/kotlin/src/main/kotlin/packagename/components/schemas/SchemaClass/_enum.hbs new file mode 100644 index 00000000000..7526c7e4751 --- /dev/null +++ b/src/main/resources/kotlin/src/main/kotlin/packagename/components/schemas/SchemaClass/_enum.hbs @@ -0,0 +1,37 @@ +{{#if forDocs}} +enumValues = SetMaker.makeSet(
+ {{~#each enumInfo.valueToName}} + {{#with @key}} + {{#eq type "string"}} +    "{{{value}}}"{{#unless @last}},{{/unless}}
+ {{~else}} + {{#eq type "null"}} +    null{{#unless @last}},{{/unless}}
+ {{~else}} +    {{value}}{{#unless @last}},{{/unless}}
+ {{~/eq}} + {{~/eq}} + {{/with}} + {{/each}} +)
+{{~else}} +.enumValues(SetMaker.makeSet( + {{#each enumInfo.valueToName}} + {{#with @key}} + {{#eq type "string"}} + "{{{value}}}"{{#unless @last}},{{/unless}} + {{else}} + {{#eq type "null"}} + null{{#unless @last}},{{/unless}} + {{else}} + {{#eq type "boolean"}} + {{value}}{{#unless @last}},{{/unless}} + {{else}} + new BigDecimal("{{value.toString}}"){{#unless @last}},{{/unless}} + {{/eq}} + {{/eq}} + {{/eq}} + {{/with}} + {{/each}} +)) +{{/if}} \ No newline at end of file diff --git a/src/main/resources/kotlin/src/main/kotlin/packagename/components/schemas/SchemaClass/_exclusiveMaximum.hbs b/src/main/resources/kotlin/src/main/kotlin/packagename/components/schemas/SchemaClass/_exclusiveMaximum.hbs new file mode 100644 index 00000000000..6f0dd4709f3 --- /dev/null +++ b/src/main/resources/kotlin/src/main/kotlin/packagename/components/schemas/SchemaClass/_exclusiveMaximum.hbs @@ -0,0 +1,5 @@ +{{#if forDocs}} +exclusiveMaximum = {{exclusiveMaximum}} +{{~else}} +.exclusiveMaximum({{exclusiveMaximum}}) +{{/if}} \ No newline at end of file diff --git a/src/main/resources/kotlin/src/main/kotlin/packagename/components/schemas/SchemaClass/_exclusiveMinimum.hbs b/src/main/resources/kotlin/src/main/kotlin/packagename/components/schemas/SchemaClass/_exclusiveMinimum.hbs new file mode 100644 index 00000000000..292c7e6b6d5 --- /dev/null +++ b/src/main/resources/kotlin/src/main/kotlin/packagename/components/schemas/SchemaClass/_exclusiveMinimum.hbs @@ -0,0 +1,5 @@ +{{#if forDocs}} +exclusiveMinimum = {{exclusiveMinimum}} +{{~else}} +.exclusiveMinimum({{exclusiveMinimum}}) +{{/if}} \ No newline at end of file diff --git a/src/main/resources/kotlin/src/main/kotlin/packagename/components/schemas/SchemaClass/_format.hbs b/src/main/resources/kotlin/src/main/kotlin/packagename/components/schemas/SchemaClass/_format.hbs new file mode 100644 index 00000000000..e3d691b79c4 --- /dev/null +++ b/src/main/resources/kotlin/src/main/kotlin/packagename/components/schemas/SchemaClass/_format.hbs @@ -0,0 +1,5 @@ +{{#if forDocs}} +type = "{{format}}"; +{{~else}} +.format("{{format}}") +{{/if}} \ No newline at end of file diff --git a/src/main/resources/kotlin/src/main/kotlin/packagename/components/schemas/SchemaClass/_getNewInstanceObject_implementor.hbs b/src/main/resources/kotlin/src/main/kotlin/packagename/components/schemas/SchemaClass/_getNewInstanceObject_implementor.hbs new file mode 100644 index 00000000000..d0f82d22adc --- /dev/null +++ b/src/main/resources/kotlin/src/main/kotlin/packagename/components/schemas/SchemaClass/_getNewInstanceObject_implementor.hbs @@ -0,0 +1,51 @@ + +@Override +public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { +{{#if types}} + {{#each types}} + {{#if @first}} + if (arg {{#eq this "null"}}== null{{/eq}}{{#eq this "boolean"}}instanceof Boolean{{/eq}}{{#or (eq this "integer") (eq this "number")}}instanceof Number{{/or}}{{#eq this "string" }}instanceof String{{/eq}}{{#eq this "array"}}instanceof List{{/eq}}{{#eq this "object"}}instanceof Map{{/eq}}) { + {{else}} + } else if (arg {{#eq this "null"}}== null{{/eq}}{{#eq this "boolean"}}instanceof Boolean{{/eq}}{{#or (eq this "integer") (eq this "number")}}instanceof Number{{/or}}{{#eq this "string" }}instanceof String{{/eq}}{{#eq this "array"}}instanceof List{{/eq}}{{#eq this "object"}}instanceof Map{{/eq}}) { + {{/if}} + {{#eq this "null"}} + return getNewInstance((Nothing?) null, pathToItem, pathToSchemas); + {{/eq}} + {{#eq this "boolean"}} + boolean boolArg = (Boolean) arg; + return getNewInstance(boolArg, pathToItem, pathToSchemas); + {{/eq}} + {{#or (eq this "integer") (eq this "number")}} + return getNewInstance((Number) arg, pathToItem, pathToSchemas); + {{/or}} + {{#eq this "string" }} + return getNewInstance((String) arg, pathToItem, pathToSchemas); + {{/eq}} + {{#eq this "array"}} + return getNewInstance((List) arg, pathToItem, pathToSchemas); + {{/eq}} + {{#eq this "object"}} + return getNewInstance((Map) arg, pathToItem, pathToSchemas); + {{/eq}} + {{#if @last}} + } + {{/if}} + {{/each}} +{{else}} + if (arg == null) { + return getNewInstance((Nothing?) null, pathToItem, pathToSchemas); + } else if (arg instanceof Boolean) { + boolean boolArg = (Boolean) arg; + return getNewInstance(boolArg, pathToItem, pathToSchemas); + } else if (arg instanceof Number) { + return getNewInstance((Number) arg, pathToItem, pathToSchemas); + } else if (arg instanceof String) { + return getNewInstance((String) arg, pathToItem, pathToSchemas); + } else if (arg instanceof List) { + return getNewInstance((List) arg, pathToItem, pathToSchemas); + } else if (arg instanceof Map) { + return getNewInstance((Map) arg, pathToItem, pathToSchemas); + } +{{/if}} + throw new RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); +} diff --git a/src/main/resources/kotlin/src/main/kotlin/packagename/components/schemas/SchemaClass/_if.hbs b/src/main/resources/kotlin/src/main/kotlin/packagename/components/schemas/SchemaClass/_if.hbs new file mode 100644 index 00000000000..249c6e24556 --- /dev/null +++ b/src/main/resources/kotlin/src/main/kotlin/packagename/components/schemas/SchemaClass/_if.hbs @@ -0,0 +1,17 @@ +{{#if forDocs}} + {{#with if_}} + {{#if refInfo.refClass}} + {{#if refInfo.refModule}} +if = [{{refInfo.refModule}}.{{refInfo.refClass}}.class]({{docRoot}}{{refInfo.ref.pathFromDocRoot}}.md#{{refInfo.ref.jsonPathPiece.kebabCase}}) + {{~else}} +if = [{{refInfo.refClass}}.class](#{{refInfo.ref.jsonPathPiece.kebabCase}}) + {{~/if}} + {{else}} +if = [{{jsonPathPiece.pascalCase}}.class](#{{jsonPathPiece.kebabCase}}) + {{~/if}} + {{~/with}} +{{else}} + {{#with if_}} +.ifSchema({{#if refInfo.refClass}}{{#if refInfo.refModule}}{{refInfo.refModule}}.{{/if}}{{refInfo.refClass}}{{else}}{{jsonPathPiece.pascalCase}}{{/if}}.class) + {{/with}} +{{/if}} \ No newline at end of file diff --git a/src/main/resources/kotlin/src/main/kotlin/packagename/components/schemas/SchemaClass/_items.hbs b/src/main/resources/kotlin/src/main/kotlin/packagename/components/schemas/SchemaClass/_items.hbs new file mode 100644 index 00000000000..57590c062f2 --- /dev/null +++ b/src/main/resources/kotlin/src/main/kotlin/packagename/components/schemas/SchemaClass/_items.hbs @@ -0,0 +1,17 @@ +{{#if forDocs}} + {{#with items}} + {{#if refInfo.refClass}} + {{#if refInfo.refModule}} +items = [{{refInfo.refModule}}.{{refInfo.refClass}}.class]({{docRoot}}{{refInfo.ref.pathFromDocRoot}}.md#{{refInfo.ref.jsonPathPiece.kebabCase}}) + {{~else}} +items = [{{refInfo.refClass}}.class](#{{refInfo.ref.jsonPathPiece.kebabCase}}) + {{~/if}} + {{else}} +items = [{{jsonPathPiece.pascalCase}}.class](#{{jsonPathPiece.kebabCase}}) + {{~/if}} + {{/with}} +{{else}} + {{#with items}} +.items({{#if refInfo.refClass}}{{#if refInfo.refModule}}{{refInfo.refModule}}.{{/if}}{{refInfo.refClass}}{{else}}{{jsonPathPiece.pascalCase}}{{/if}}.class) + {{/with}} +{{/if}} \ No newline at end of file diff --git a/src/main/resources/kotlin/src/main/kotlin/packagename/components/schemas/SchemaClass/_maxContains.hbs b/src/main/resources/kotlin/src/main/kotlin/packagename/components/schemas/SchemaClass/_maxContains.hbs new file mode 100644 index 00000000000..75f36089843 --- /dev/null +++ b/src/main/resources/kotlin/src/main/kotlin/packagename/components/schemas/SchemaClass/_maxContains.hbs @@ -0,0 +1,5 @@ +{{#if forDocs}} +maxContains = {{maxContains}} +{{~else}} +.maxContains({{maxContains}}) +{{/if}} \ No newline at end of file diff --git a/src/main/resources/kotlin/src/main/kotlin/packagename/components/schemas/SchemaClass/_maxItems.hbs b/src/main/resources/kotlin/src/main/kotlin/packagename/components/schemas/SchemaClass/_maxItems.hbs new file mode 100644 index 00000000000..5bb99dea663 --- /dev/null +++ b/src/main/resources/kotlin/src/main/kotlin/packagename/components/schemas/SchemaClass/_maxItems.hbs @@ -0,0 +1,5 @@ +{{#if forDocs}} +maxItems = {{maxItems}} +{{~else}} +.maxItems({{maxItems}}) +{{/if}} \ No newline at end of file diff --git a/src/main/resources/kotlin/src/main/kotlin/packagename/components/schemas/SchemaClass/_maxLength.hbs b/src/main/resources/kotlin/src/main/kotlin/packagename/components/schemas/SchemaClass/_maxLength.hbs new file mode 100644 index 00000000000..0fc9d3f739d --- /dev/null +++ b/src/main/resources/kotlin/src/main/kotlin/packagename/components/schemas/SchemaClass/_maxLength.hbs @@ -0,0 +1,5 @@ +{{#if forDocs}} +maxLength = {{maxLength}} +{{~else}} +.maxLength({{maxLength}}) +{{/if}} \ No newline at end of file diff --git a/src/main/resources/kotlin/src/main/kotlin/packagename/components/schemas/SchemaClass/_maxProperties.hbs b/src/main/resources/kotlin/src/main/kotlin/packagename/components/schemas/SchemaClass/_maxProperties.hbs new file mode 100644 index 00000000000..5d0e5b39183 --- /dev/null +++ b/src/main/resources/kotlin/src/main/kotlin/packagename/components/schemas/SchemaClass/_maxProperties.hbs @@ -0,0 +1,5 @@ +{{#if forDocs}} +maxProperties = {{maxProperties}} +{{~else}} +.maxProperties({{maxProperties}}) +{{/if}} \ No newline at end of file diff --git a/src/main/resources/kotlin/src/main/kotlin/packagename/components/schemas/SchemaClass/_maximum.hbs b/src/main/resources/kotlin/src/main/kotlin/packagename/components/schemas/SchemaClass/_maximum.hbs new file mode 100644 index 00000000000..aa9f7148253 --- /dev/null +++ b/src/main/resources/kotlin/src/main/kotlin/packagename/components/schemas/SchemaClass/_maximum.hbs @@ -0,0 +1,5 @@ +{{#if forDocs}} +maximum = {{maximum}} +{{~else}} +.maximum({{maximum}}) +{{/if}} \ No newline at end of file diff --git a/src/main/resources/kotlin/src/main/kotlin/packagename/components/schemas/SchemaClass/_minContains.hbs b/src/main/resources/kotlin/src/main/kotlin/packagename/components/schemas/SchemaClass/_minContains.hbs new file mode 100644 index 00000000000..213ca5c7cc6 --- /dev/null +++ b/src/main/resources/kotlin/src/main/kotlin/packagename/components/schemas/SchemaClass/_minContains.hbs @@ -0,0 +1,5 @@ +{{#if forDocs}} +minContains = {{minContains}} +{{~else}} +.minContains({{minContains}}) +{{/if}} \ No newline at end of file diff --git a/src/main/resources/kotlin/src/main/kotlin/packagename/components/schemas/SchemaClass/_minItems.hbs b/src/main/resources/kotlin/src/main/kotlin/packagename/components/schemas/SchemaClass/_minItems.hbs new file mode 100644 index 00000000000..70c3ebc4179 --- /dev/null +++ b/src/main/resources/kotlin/src/main/kotlin/packagename/components/schemas/SchemaClass/_minItems.hbs @@ -0,0 +1,5 @@ +{{#if forDocs}} +minItems = {{minItems}} +{{~else}} +.minItems({{minItems}}) +{{/if}} \ No newline at end of file diff --git a/src/main/resources/kotlin/src/main/kotlin/packagename/components/schemas/SchemaClass/_minLength.hbs b/src/main/resources/kotlin/src/main/kotlin/packagename/components/schemas/SchemaClass/_minLength.hbs new file mode 100644 index 00000000000..1aa17753cfc --- /dev/null +++ b/src/main/resources/kotlin/src/main/kotlin/packagename/components/schemas/SchemaClass/_minLength.hbs @@ -0,0 +1,5 @@ +{{#if forDocs}} +minLength = {{minLength}} +{{~else}} +.minLength({{minLength}}) +{{/if}} \ No newline at end of file diff --git a/src/main/resources/kotlin/src/main/kotlin/packagename/components/schemas/SchemaClass/_minProperties.hbs b/src/main/resources/kotlin/src/main/kotlin/packagename/components/schemas/SchemaClass/_minProperties.hbs new file mode 100644 index 00000000000..50ec3408ac5 --- /dev/null +++ b/src/main/resources/kotlin/src/main/kotlin/packagename/components/schemas/SchemaClass/_minProperties.hbs @@ -0,0 +1,5 @@ +{{#if forDocs}} +minProperties = {{minProperties}} +{{~else}} +.minProperties({{minProperties}}) +{{/if}} \ No newline at end of file diff --git a/src/main/resources/kotlin/src/main/kotlin/packagename/components/schemas/SchemaClass/_minimum.hbs b/src/main/resources/kotlin/src/main/kotlin/packagename/components/schemas/SchemaClass/_minimum.hbs new file mode 100644 index 00000000000..d1c1871dc81 --- /dev/null +++ b/src/main/resources/kotlin/src/main/kotlin/packagename/components/schemas/SchemaClass/_minimum.hbs @@ -0,0 +1,5 @@ +{{#if forDocs}} +minimum = {{minimum}} +{{~else}} +.minimum({{minimum}}) +{{/if}} \ No newline at end of file diff --git a/src/main/resources/kotlin/src/main/kotlin/packagename/components/schemas/SchemaClass/_multipleOf.hbs b/src/main/resources/kotlin/src/main/kotlin/packagename/components/schemas/SchemaClass/_multipleOf.hbs new file mode 100644 index 00000000000..2ea22fbac37 --- /dev/null +++ b/src/main/resources/kotlin/src/main/kotlin/packagename/components/schemas/SchemaClass/_multipleOf.hbs @@ -0,0 +1,5 @@ +{{#if forDocs}} +multipleOf = new BigDecimal("{{multipleOf.toString}}") +{{~else}} +.multipleOf(new BigDecimal("{{multipleOf.toString}}")) +{{/if}} \ No newline at end of file diff --git a/src/main/resources/kotlin/src/main/kotlin/packagename/components/schemas/SchemaClass/_not.hbs b/src/main/resources/kotlin/src/main/kotlin/packagename/components/schemas/SchemaClass/_not.hbs new file mode 100644 index 00000000000..6dc339bb2ad --- /dev/null +++ b/src/main/resources/kotlin/src/main/kotlin/packagename/components/schemas/SchemaClass/_not.hbs @@ -0,0 +1,17 @@ +{{#if forDocs}} + {{#with not}} + {{#if refInfo.refClass}} + {{#if refInfo.refModule}} +not = [{{refInfo.refModule}}.{{refInfo.refClass}}.class]({{docRoot}}{{refInfo.ref.pathFromDocRoot}}.md#{{refInfo.ref.jsonPathPiece.kebabCase}}) + {{~else}} +not = [{{refInfo.refClass}}.class](#{{refInfo.ref.jsonPathPiece.kebabCase}}) + {{~/if}} + {{else}} +not = [{{jsonPathPiece.pascalCase}}.class](#{{jsonPathPiece.kebabCase}}) + {{~/if}} + {{~/with}} +{{else}} + {{#with not}} +.not({{#if refInfo.refClass}}{{#if refInfo.refModule}}{{refInfo.refModule}}.{{/if}}{{refInfo.refClass}}{{else}}{{jsonPathPiece.pascalCase}}{{/if}}.class) + {{/with}} +{{/if}} \ No newline at end of file diff --git a/src/main/resources/kotlin/src/main/kotlin/packagename/components/schemas/SchemaClass/_oneOf.hbs b/src/main/resources/kotlin/src/main/kotlin/packagename/components/schemas/SchemaClass/_oneOf.hbs new file mode 100644 index 00000000000..218daeaab0d --- /dev/null +++ b/src/main/resources/kotlin/src/main/kotlin/packagename/components/schemas/SchemaClass/_oneOf.hbs @@ -0,0 +1,29 @@ +{{#if forDocs}} +oneOf = List.of(
+ {{~#each oneOf}} + {{#if refInfo.refClass}} + {{#if refInfo.refModule}} +    [{{refInfo.refModule}}.{{refInfo.refClass}}.class]({{docRoot}}{{refInfo.ref.pathFromDocRoot}}.md#{{refInfo.ref.jsonPathPiece.kebabCase}}){{#unless @last}},{{/unless}}
+ {{~else}} +    [{{refInfo.refClass}}.class](#{{refInfo.ref.jsonPathPiece.kebabCase}}){{#unless @last}},{{/unless}}
+ {{~/if}} + {{else}} +    [{{jsonPathPiece.pascalCase}}.class](#{{jsonPathPiece.kebabCase}}){{#unless @last}},{{/unless}}
+ {{~/if}} + {{/each}} +))
+{{~else}} +.oneOf(List.of( + {{#each oneOf}} + {{#if refInfo.refClass}} + {{#if refInfo.refModule}} + {{refInfo.refModule}}.{{refInfo.refClass}}.class{{#unless @last}},{{/unless}} + {{else}} + {{refInfo.refClass}}.class{{#unless @last}},{{/unless}} + {{/if}} + {{else}} + {{jsonPathPiece.pascalCase}}.class{{#unless @last}},{{/unless}} + {{/if}} + {{/each}} +)) +{{/if}} \ No newline at end of file diff --git a/src/main/resources/kotlin/src/main/kotlin/packagename/components/schemas/SchemaClass/_pattern.hbs b/src/main/resources/kotlin/src/main/kotlin/packagename/components/schemas/SchemaClass/_pattern.hbs new file mode 100644 index 00000000000..616832ef70b --- /dev/null +++ b/src/main/resources/kotlin/src/main/kotlin/packagename/components/schemas/SchemaClass/_pattern.hbs @@ -0,0 +1,57 @@ +{{#if forDocs}} +pattern = Pattern.compile(
+ {{~#with patternInfo}} +    "{{{pattern.codeEscaped}}}"{{#if flags}},{{/if}}
+ {{~#if flags}} + {{#eq flags.size 1}} +    {{#each flags}}Pattern.{{#eq this "i"}}CASE_INSENSITIVE{{/eq}}{{#eq this "m"}}MULTILINE{{/eq}}{{#eq this "s"}}DOTALL{{/eq}}{{#eq this "u"}}UNICODE_CHARACTER_CLASS{{/eq}}{{/each}}
+ {{~else}} +    (
+ {{~#each flags}} + {{#eq this "i"}} +        Pattern.CASE_INSENSITIVE{{#unless @last}} |{{/unless}}
+ {{~/eq}} + {{#eq this "m"}} +        Pattern.MULTILINE{{#unless @last}} |{{/unless}}
+ {{~/eq}} + {{#eq this "s"}} +        Pattern.DOTALL{{#unless @last}} |{{/unless}}
+ {{~/eq}} + {{#eq this "u"}} +        Pattern.UNICODE_CHARACTER_CLASS{{#unless @last}} |{{/unless}}
+ {{~/eq}} + {{/each}} +    
+ {{~/eq}} + {{/if}} + {{/with}} +){{#unless @last}},{{/unless}}
+{{~else}} +.pattern(Pattern.compile( + {{#with patternInfo}} + "{{{pattern.codeEscaped}}}"{{#if flags}},{{/if}} + {{#if flags}} + {{#eq flags.size 1}} + {{#each flags}}Pattern.{{#eq this "i"}}CASE_INSENSITIVE{{/eq}}{{#eq this "m"}}MULTILINE{{/eq}}{{#eq this "s"}}DOTALL{{/eq}}{{#eq this "u"}}UNICODE_CHARACTER_CLASS{{/eq}}{{/each}} + {{else}} + ( + {{#each flags}} + {{#eq this "i"}} + Pattern.CASE_INSENSITIVE{{#unless @last}} |{{/unless}} + {{/eq}} + {{#eq this "m"}} + Pattern.MULTILINE{{#unless @last}} |{{/unless}} + {{/eq}} + {{#eq this "s"}} + Pattern.DOTALL{{#unless @last}} |{{/unless}} + {{/eq}} + {{#eq this "u"}} + Pattern.UNICODE_CHARACTER_CLASS{{#unless @last}} |{{/unless}} + {{/eq}} + {{/each}} + ) + {{/eq}} + {{/if}} + {{/with}} +)) +{{/if}} \ No newline at end of file diff --git a/src/main/resources/kotlin/src/main/kotlin/packagename/components/schemas/SchemaClass/_patternProperties.hbs b/src/main/resources/kotlin/src/main/kotlin/packagename/components/schemas/SchemaClass/_patternProperties.hbs new file mode 100644 index 00000000000..0d32c7ebe91 --- /dev/null +++ b/src/main/resources/kotlin/src/main/kotlin/packagename/components/schemas/SchemaClass/_patternProperties.hbs @@ -0,0 +1,29 @@ +{{#if forDocs}} +patternProperties = Map.ofEntries(
+ {{~#each patternProperties}} + {{#if refInfo.refClass}} + {{#if refInfo.refModule}} +    new AbstractMap.SimpleEntry<>(Pattern.compile("{{{@key.pattern.codeEscaped}}}"), [{{refInfo.refModule}}.{{refInfo.refClass}}.class]({{docRoot}}{{refInfo.ref.pathFromDocRoot}}.md#{{refInfo.ref.jsonPathPiece.kebabCase}})){{#unless @last}},{{/unless}}
+ {{~else}} +    new AbstractMap.SimpleEntry<>(Pattern.compile("{{{@key.pattern.codeEscaped}}}"), [{{refInfo.refClass}}.class](#{{refInfo.ref.jsonPathPiece.kebabCase}}))){{#unless @last}},{{/unless}}
+ {{~/if}} + {{else}} +    new AbstractMap.SimpleEntry<>(Pattern.compile("{{{@key.pattern.codeEscaped}}}"), [{{jsonPathPiece.pascalCase}}.class](#{{jsonPathPiece.kebabCase}}))){{#unless @last}},{{/unless}}
+ {{~/if}} + {{/each}} +)
+{{~else}} +.patternProperties(Map.ofEntries( + {{#each patternProperties}} + {{#if refInfo.refClass}} + {{#if refInfo.refModule}} + new AbstractMap.SimpleEntry<>(Pattern.compile("{{{@key.pattern.codeEscaped}}}"), {{refInfo.refModule}}.{{refInfo.refClass}}.class){{#unless @last}},{{/unless}} + {{else}} + new AbstractMap.SimpleEntry<>(Pattern.compile("{{{@key.pattern.codeEscaped}}}"), {{refInfo.refClass}}.class){{#unless @last}},{{/unless}} + {{/if}} + {{else}} + new AbstractMap.SimpleEntry<>(Pattern.compile("{{{@key.pattern.codeEscaped}}}"), {{jsonPathPiece.pascalCase}}.class){{#unless @last}},{{/unless}} + {{/if}} + {{/each}} +)) +{{/if}} \ No newline at end of file diff --git a/src/main/resources/kotlin/src/main/kotlin/packagename/components/schemas/SchemaClass/_prefixItems.hbs b/src/main/resources/kotlin/src/main/kotlin/packagename/components/schemas/SchemaClass/_prefixItems.hbs new file mode 100644 index 00000000000..a4eb8178e12 --- /dev/null +++ b/src/main/resources/kotlin/src/main/kotlin/packagename/components/schemas/SchemaClass/_prefixItems.hbs @@ -0,0 +1,29 @@ +{{#if forDocs}} +prefixItems = List.of(
+ {{~#each prefixItems}} + {{#if refInfo.refClass}} + {{#if refInfo.refModule}} +    [{{refInfo.refModule}}.{{refInfo.refClass}}.class]({{docRoot}}{{refInfo.ref.pathFromDocRoot}}.md#{{refInfo.ref.jsonPathPiece.kebabCase}}){{#unless @last}},{{/unless}}
+ {{~else}} +    [{{refInfo.refClass}}.class](#{{refInfo.ref.jsonPathPiece.kebabCase}}){{#unless @last}},{{/unless}}
+ {{~/if}} + {{else}} +    [{{jsonPathPiece.pascalCase}}.class](#{{jsonPathPiece.kebabCase}}){{#unless @last}},{{/unless}}
+ {{~/if}} + {{/each}} +)
+{{~else}} +.prefixItems(List.of( + {{#each prefixItems}} + {{#if refInfo.refClass}} + {{#if refInfo.refModule}} + {{refInfo.refModule}}.{{refInfo.refClass}}.class{{#unless @last}},{{/unless}} + {{else}} + {{refInfo.refClass}}.class{{#unless @last}},{{/unless}} + {{/if}} + {{else}} + {{jsonPathPiece.pascalCase}}.class{{#unless @last}},{{/unless}} + {{/if}} + {{/each}} +)) +{{/if}} \ No newline at end of file diff --git a/src/main/resources/kotlin/src/main/kotlin/packagename/components/schemas/SchemaClass/_properties.hbs b/src/main/resources/kotlin/src/main/kotlin/packagename/components/schemas/SchemaClass/_properties.hbs new file mode 100644 index 00000000000..0f6763a4a21 --- /dev/null +++ b/src/main/resources/kotlin/src/main/kotlin/packagename/components/schemas/SchemaClass/_properties.hbs @@ -0,0 +1,29 @@ +{{#if forDocs}} +properties = Map.ofEntries(
+ {{~#each properties}} + {{#if refInfo.refClass}} + {{#if refInfo.refModule}} +    new PropertyEntry("{{{@key.original}}}", [{{refInfo.refModule}}.{{refInfo.refClass}}.class]({{docRoot}}{{refInfo.ref.pathFromDocRoot}}.md#{{refInfo.ref.jsonPathPiece.kebabCase}})){{#unless @last}},{{/unless}}
+ {{~else}} +    new PropertyEntry("{{{@key.original}}}", [{{refInfo.refClass}}.class](#{{refInfo.ref.jsonPathPiece.kebabCase}}))){{#unless @last}},{{/unless}}
+ {{~/if}} + {{else}} +    new PropertyEntry("{{{@key.original}}}", [{{jsonPathPiece.pascalCase}}.class](#{{jsonPathPiece.kebabCase}}))){{#unless @last}},{{/unless}}
+ {{~/if}} + {{/each}} +)
+{{~else}} +.properties(Map.ofEntries( + {{#each properties}} + {{#if refInfo.refClass}} + {{#if refInfo.refModule}} + new PropertyEntry("{{{@key.original}}}", {{refInfo.refModule}}.{{refInfo.refClass}}.class){{#unless @last}},{{/unless}} + {{else}} + new PropertyEntry("{{{@key.original}}}", {{refInfo.refClass}}.class){{#unless @last}},{{/unless}} + {{/if}} + {{else}} + new PropertyEntry("{{{@key.original}}}", {{jsonPathPiece.pascalCase}}.class){{#unless @last}},{{/unless}} + {{/if}} + {{/each}} +)) +{{/if}} \ No newline at end of file diff --git a/src/main/resources/kotlin/src/main/kotlin/packagename/components/schemas/SchemaClass/_propertyNames.hbs b/src/main/resources/kotlin/src/main/kotlin/packagename/components/schemas/SchemaClass/_propertyNames.hbs new file mode 100644 index 00000000000..a403510199b --- /dev/null +++ b/src/main/resources/kotlin/src/main/kotlin/packagename/components/schemas/SchemaClass/_propertyNames.hbs @@ -0,0 +1,17 @@ +{{#if forDocs}} + {{#with propertyNames}} + {{#if refInfo.refClass}} + {{#if refInfo.refModule}} +propertyNames = [{{refInfo.refModule}}.{{refInfo.refClass}}.class]({{docRoot}}{{refInfo.ref.pathFromDocRoot}}.md#{{refInfo.ref.jsonPathPiece.kebabCase}}) + {{~else}} +propertyNames = [{{refInfo.refClass}}.class](#{{refInfo.ref.jsonPathPiece.kebabCase}}) + {{~/if}} + {{else}} +propertyNames = [{{jsonPathPiece.pascalCase}}.class](#{{jsonPathPiece.kebabCase}}) + {{~/if}} + {{/with}} +{{else}} + {{#with propertyNames}} +.propertyNames({{#if refInfo.refClass}}{{#if refInfo.refModule}}{{refInfo.refModule}}.{{/if}}{{refInfo.refClass}}{{else}}{{jsonPathPiece.pascalCase}}{{/if}}.class) + {{/with}} +{{/if}} \ No newline at end of file diff --git a/src/main/resources/kotlin/src/main/kotlin/packagename/components/schemas/SchemaClass/_required.hbs b/src/main/resources/kotlin/src/main/kotlin/packagename/components/schemas/SchemaClass/_required.hbs new file mode 100644 index 00000000000..01e48c566fa --- /dev/null +++ b/src/main/resources/kotlin/src/main/kotlin/packagename/components/schemas/SchemaClass/_required.hbs @@ -0,0 +1,13 @@ +{{#if forDocs}} +required = Set.of(
+ {{~#each requiredProperties}} +    "{{{@key.original}}}"{{#unless @last}},{{/unless}}
+ {{~/each}} +)
+{{~else}} +.required(Set.of( + {{#each requiredProperties}} + "{{{@key.original}}}"{{#unless @last}},{{/unless}} + {{/each}} +)) +{{/if}} \ No newline at end of file diff --git a/src/main/resources/kotlin/src/main/kotlin/packagename/components/schemas/SchemaClass/_then.hbs b/src/main/resources/kotlin/src/main/kotlin/packagename/components/schemas/SchemaClass/_then.hbs new file mode 100644 index 00000000000..524f4c9e8b2 --- /dev/null +++ b/src/main/resources/kotlin/src/main/kotlin/packagename/components/schemas/SchemaClass/_then.hbs @@ -0,0 +1,17 @@ +{{#if forDocs}} + {{#with then}} + {{#if refInfo.refClass}} + {{#if refInfo.refModule}} +then = [{{refInfo.refModule}}.{{refInfo.refClass}}.class]({{docRoot}}{{refInfo.ref.pathFromDocRoot}}.md#{{refInfo.ref.jsonPathPiece.kebabCase}}) + {{~else}} +then = [{{refInfo.refClass}}.class](#{{refInfo.ref.jsonPathPiece.kebabCase}}) + {{~/if}} + {{else}} +then = [{{jsonPathPiece.pascalCase}}.class](#{{jsonPathPiece.kebabCase}}) + {{~/if}} + {{~/with}} +{{else}} + {{#with then}} +.then({{#if refInfo.refClass}}{{#if refInfo.refModule}}{{refInfo.refModule}}.{{/if}}{{refInfo.refClass}}{{else}}{{jsonPathPiece.pascalCase}}{{/if}}.class) + {{/with}} +{{/if}} \ No newline at end of file diff --git a/src/main/resources/kotlin/src/main/kotlin/packagename/components/schemas/SchemaClass/_types.hbs b/src/main/resources/kotlin/src/main/kotlin/packagename/components/schemas/SchemaClass/_types.hbs new file mode 100644 index 00000000000..cbc06df66c2 --- /dev/null +++ b/src/main/resources/kotlin/src/main/kotlin/packagename/components/schemas/SchemaClass/_types.hbs @@ -0,0 +1,79 @@ +{{#if types}} + {{#and (eq types.size 1) (or (contains types "null") (contains types "object") (contains types "array") (contains types "boolean"))}} + {{#if forDocs}} +type = Set.of({{#contains types "null"}}Nothing?.class{{/contains}}{{#contains types "object"}}Map.class{{/contains}}{{#contains types "array"}}List.class{{/contains}}{{#contains types "boolean"}}Boolean.class{{/contains}}) + {{~else}} +.type(Set.of({{#contains types "null"}}Nothing?.class{{/contains}}{{#contains types "object"}}Map.class{{/contains}}{{#contains types "array"}}List.class{{/contains}}{{#contains types "boolean"}}Boolean.class{{/contains}})) + {{/if}} + {{else}} + {{#if forDocs}} +type = Set.of(
+ {{~#each types}} + {{#eq this "null"}} +    Nothing?.class{{#unless @last}},{{/unless}}
+ {{~/eq}} + {{#eq this "object"}} +    Map.class{{#unless @last}},{{/unless}}
+ {{~/eq}} + {{#eq this "array"}} +    List.class{{#unless @last}},{{/unless}}
+ {{~/eq}} + {{#eq this "string" }} + {{#eq ../format "binary"}} + // FileIO, + // bytes, + {{else}} +    String.class{{#unless @last}},{{/unless}}
+ {{~/eq}} + {{/eq}} + {{#eq this "integer"}} +    Integer.class,
    Long.class,
    Float.class,
    Double.class{{#unless @last}},{{/unless}}
+ {{~/eq}} + {{#eq this "number"}} +    Integer.class,
    Long.class,
    Float.class,
    Double.class{{#unless @last}},{{/unless}}
+ {{~/eq}} + {{#eq this "boolean"}} +    Boolean.class{{#unless @last}},{{/unless}}
+ {{~/eq}} + {{/each}} +)
+ {{~else}} +.type(Set.of( + {{#each types}} + {{#eq this "null"}} + Nothing?.class{{#unless @last}},{{/unless}} + {{/eq}} + {{#eq this "object"}} + Map.class{{#unless @last}},{{/unless}} + {{/eq}} + {{#eq this "array"}} + List.class{{#unless @last}},{{/unless}} + {{/eq}} + {{#eq this "string" }} + {{#eq ../format "binary"}} + // FileIO, + // bytes, + {{else}} + String.class{{#unless @last}},{{/unless}} + {{/eq}} + {{/eq}} + {{#eq this "integer"}} + Integer.class, + Long.class, + Float.class, + Double.class{{#unless @last}},{{/unless}} + {{/eq}} + {{#eq this "number"}} + Integer.class, + Long.class, + Float.class, + Double.class{{#unless @last}},{{/unless}} + {{/eq}} + {{#eq this "boolean"}} + Boolean.class{{#unless @last}},{{/unless}} + {{/eq}} + {{/each}} +)) + {{/if}} + {{/and}} +{{/if}} \ No newline at end of file diff --git a/src/main/resources/kotlin/src/main/kotlin/packagename/components/schemas/SchemaClass/_unevaluatedItems.hbs b/src/main/resources/kotlin/src/main/kotlin/packagename/components/schemas/SchemaClass/_unevaluatedItems.hbs new file mode 100644 index 00000000000..77b04ff5678 --- /dev/null +++ b/src/main/resources/kotlin/src/main/kotlin/packagename/components/schemas/SchemaClass/_unevaluatedItems.hbs @@ -0,0 +1,17 @@ +{{#if forDocs}} + {{#with unevaluatedItems}} + {{#if refInfo.refClass}} + {{#if refInfo.refModule}} +unevaluatedItems = [{{refInfo.refModule}}.{{refInfo.refClass}}.class]({{docRoot}}{{refInfo.ref.pathFromDocRoot}}.md#{{refInfo.ref.jsonPathPiece.kebabCase}}) + {{~else}} +unevaluatedItems = [{{refInfo.refClass}}.class](#{{refInfo.ref.jsonPathPiece.kebabCase}}) + {{~/if}} + {{else}} +unevaluatedItems = [{{jsonPathPiece.pascalCase}}.class](#{{jsonPathPiece.kebabCase}}) + {{~/if}} + {{/with}} +{{else}} + {{#with unevaluatedItems}} +.unevaluatedItems({{#if refInfo.refClass}}{{#if refInfo.refModule}}{{refInfo.refModule}}.{{/if}}{{refInfo.refClass}}{{else}}{{jsonPathPiece.pascalCase}}{{/if}}.class) + {{/with}} +{{/if}} \ No newline at end of file diff --git a/src/main/resources/kotlin/src/main/kotlin/packagename/components/schemas/SchemaClass/_unevaluatedProperties.hbs b/src/main/resources/kotlin/src/main/kotlin/packagename/components/schemas/SchemaClass/_unevaluatedProperties.hbs new file mode 100644 index 00000000000..83f5d06aad0 --- /dev/null +++ b/src/main/resources/kotlin/src/main/kotlin/packagename/components/schemas/SchemaClass/_unevaluatedProperties.hbs @@ -0,0 +1,17 @@ +{{#if forDocs}} + {{#with unevaluatedProperties}} + {{#if refInfo.refClass}} + {{#if refInfo.refModule}} +unevaluatedProperties = [{{refInfo.refModule}}.{{refInfo.refClass}}.class]({{docRoot}}{{refInfo.ref.pathFromDocRoot}}.md#{{refInfo.ref.jsonPathPiece.kebabCase}}) + {{~else}} +unevaluatedProperties = [{{refInfo.refClass}}.class](#{{refInfo.ref.jsonPathPiece.kebabCase}}) + {{~/if}} + {{else}} +unevaluatedProperties = [{{jsonPathPiece.pascalCase}}.class](#{{jsonPathPiece.kebabCase}}) + {{~/if}} + {{/with}} +{{else}} + {{#with unevaluatedProperties}} +.unevaluatedProperties({{#if refInfo.refClass}}{{#if refInfo.refModule}}{{refInfo.refModule}}.{{/if}}{{refInfo.refClass}}{{else}}{{jsonPathPiece.pascalCase}}{{/if}}.class) + {{/with}} +{{/if}} \ No newline at end of file diff --git a/src/main/resources/kotlin/src/main/kotlin/packagename/components/schemas/SchemaClass/_uniqueItems.hbs b/src/main/resources/kotlin/src/main/kotlin/packagename/components/schemas/SchemaClass/_uniqueItems.hbs new file mode 100644 index 00000000000..2d0946f2ede --- /dev/null +++ b/src/main/resources/kotlin/src/main/kotlin/packagename/components/schemas/SchemaClass/_uniqueItems.hbs @@ -0,0 +1,5 @@ +{{#if forDocs}} +uniqueItems = {{uniqueItems}} +{{~else}} +.uniqueItems({{uniqueItems}}) +{{/if}} \ No newline at end of file diff --git a/src/main/resources/kotlin/src/main/kotlin/packagename/components/schemas/SchemaClass/_validateAndBox.hbs b/src/main/resources/kotlin/src/main/kotlin/packagename/components/schemas/SchemaClass/_validateAndBox.hbs new file mode 100644 index 00000000000..ce35e03a5f1 --- /dev/null +++ b/src/main/resources/kotlin/src/main/kotlin/packagename/components/schemas/SchemaClass/_validateAndBox.hbs @@ -0,0 +1,99 @@ +{{#if types}} + {{#each types}} + {{#eq this "null"}} +{{> src/main/kotlin/packagename/components/schemas/SchemaClass/_validateAndBoxVoid }} + {{/eq}} + {{#eq this "boolean"}} +{{> src/main/kotlin/packagename/components/schemas/SchemaClass/_validateAndBoxBoolean }} + {{/eq}} + {{#and (eq this "string") (neq ../format "binary") }} +{{> src/main/kotlin/packagename/components/schemas/SchemaClass/_validateAndBoxString }} + {{/and}} + {{#or (eq this "number") (eq this "integer")}} +{{> src/main/kotlin/packagename/components/schemas/SchemaClass/_validateAndBoxNumber }} + {{/or}} + {{#eq this "array"}} +{{> src/main/kotlin/packagename/components/schemas/SchemaClass/_validateAndBoxList }} + {{/eq}} + {{#eq this "object"}} +{{> src/main/kotlin/packagename/components/schemas/SchemaClass/_validateAndBoxMap }} + {{/eq}} + {{/each}} +@Override +public {{jsonPathPiece.pascalCase}}Boxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { + {{#each types}} + {{#if @first}} + {{#eq this "null"}} + if (arg == null) { + Nothing? castArg = (Nothing?) arg; + {{/eq}} + {{#eq this "boolean"}} + if (arg instanceof Boolean booleanArg) { + boolean castArg = booleanArg; + {{/eq}} + {{#and (eq this "string") (neq ../format "binary") }} + if (arg instanceof String castArg) { + {{/and}} + {{#or (eq this "number") (eq this "integer")}} + if (arg instanceof Number castArg) { + {{/or}} + {{#eq this "array"}} + if (arg instanceof List castArg) { + {{/eq}} + {{#eq this "object"}} + if (arg instanceof Map castArg) { + {{/eq}} + {{else}} + {{#eq this "null"}} + } else if (arg == null) { + Nothing? castArg = (Nothing?) arg; + {{/eq}} + {{#eq this "boolean"}} + } else if (arg instanceof Boolean booleanArg) { + boolean castArg = booleanArg; + {{/eq}} + {{#and (eq this "string") (neq ../format "binary") }} + } else if (arg instanceof String castArg) { + {{/and}} + {{#or (eq this "number") (eq this "integer")}} + } else if (arg instanceof Number castArg) { + {{/or}} + {{#eq this "array"}} + } else if (arg instanceof List castArg) { + {{/eq}} + {{#eq this "object"}} + } else if (arg instanceof Map castArg) { + {{/eq}} + {{/if}} + return validateAndBox(castArg, configuration); + {{/each}} + } + throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); +} +{{else}} +{{> src/main/kotlin/packagename/components/schemas/SchemaClass/_validateAndBoxVoid }} +{{> src/main/kotlin/packagename/components/schemas/SchemaClass/_validateAndBoxBoolean }} +{{> src/main/kotlin/packagename/components/schemas/SchemaClass/_validateAndBoxNumber }} +{{> src/main/kotlin/packagename/components/schemas/SchemaClass/_validateAndBoxString }} +{{> src/main/kotlin/packagename/components/schemas/SchemaClass/_validateAndBoxList }} +{{> src/main/kotlin/packagename/components/schemas/SchemaClass/_validateAndBoxMap }} +@Override +public {{jsonPathPiece.pascalCase}}Boxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { + if (arg == null) { + Nothing? castArg = (Nothing?) arg; + return validateAndBox(castArg, configuration); + } else if (arg instanceof Boolean booleanArg) { + boolean castArg = booleanArg; + return validateAndBox(castArg, configuration); + } else if (arg instanceof String castArg) { + return validateAndBox(castArg, configuration); + } else if (arg instanceof Number castArg) { + return validateAndBox(castArg, configuration); + } else if (arg instanceof List castArg) { + 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"); +} +{{/if}} \ No newline at end of file diff --git a/src/main/resources/kotlin/src/main/kotlin/packagename/components/schemas/SchemaClass/_validateAndBoxBoolean.hbs b/src/main/resources/kotlin/src/main/kotlin/packagename/components/schemas/SchemaClass/_validateAndBoxBoolean.hbs new file mode 100644 index 00000000000..de40afe4e66 --- /dev/null +++ b/src/main/resources/kotlin/src/main/kotlin/packagename/components/schemas/SchemaClass/_validateAndBoxBoolean.hbs @@ -0,0 +1,4 @@ +@Override +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/kotlin/src/main/kotlin/packagename/components/schemas/SchemaClass/_validateAndBoxList.hbs b/src/main/resources/kotlin/src/main/kotlin/packagename/components/schemas/SchemaClass/_validateAndBoxList.hbs new file mode 100644 index 00000000000..cda68ddbb60 --- /dev/null +++ b/src/main/resources/kotlin/src/main/kotlin/packagename/components/schemas/SchemaClass/_validateAndBoxList.hbs @@ -0,0 +1,4 @@ +@Override +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/kotlin/src/main/kotlin/packagename/components/schemas/SchemaClass/_validateAndBoxMap.hbs b/src/main/resources/kotlin/src/main/kotlin/packagename/components/schemas/SchemaClass/_validateAndBoxMap.hbs new file mode 100644 index 00000000000..c84fc8d79cc --- /dev/null +++ b/src/main/resources/kotlin/src/main/kotlin/packagename/components/schemas/SchemaClass/_validateAndBoxMap.hbs @@ -0,0 +1,4 @@ +@Override +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/kotlin/src/main/kotlin/packagename/components/schemas/SchemaClass/_validateAndBoxNumber.hbs b/src/main/resources/kotlin/src/main/kotlin/packagename/components/schemas/SchemaClass/_validateAndBoxNumber.hbs new file mode 100644 index 00000000000..dae6e8f3f4a --- /dev/null +++ b/src/main/resources/kotlin/src/main/kotlin/packagename/components/schemas/SchemaClass/_validateAndBoxNumber.hbs @@ -0,0 +1,4 @@ +@Override +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/kotlin/src/main/kotlin/packagename/components/schemas/SchemaClass/_validateAndBoxString.hbs b/src/main/resources/kotlin/src/main/kotlin/packagename/components/schemas/SchemaClass/_validateAndBoxString.hbs new file mode 100644 index 00000000000..d64c59a5e94 --- /dev/null +++ b/src/main/resources/kotlin/src/main/kotlin/packagename/components/schemas/SchemaClass/_validateAndBoxString.hbs @@ -0,0 +1,4 @@ +@Override +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/kotlin/src/main/kotlin/packagename/components/schemas/SchemaClass/_validateAndBoxVoid.hbs b/src/main/resources/kotlin/src/main/kotlin/packagename/components/schemas/SchemaClass/_validateAndBoxVoid.hbs new file mode 100644 index 00000000000..441b5c1caf9 --- /dev/null +++ b/src/main/resources/kotlin/src/main/kotlin/packagename/components/schemas/SchemaClass/_validateAndBoxVoid.hbs @@ -0,0 +1,4 @@ +@Override +public {{jsonPathPiece.pascalCase}}BoxedVoid validateAndBox(Nothing? arg, SchemaConfiguration configuration) throws ValidationException { + return new {{jsonPathPiece.pascalCase}}BoxedVoid(validate(arg, configuration)); +} diff --git a/src/main/resources/kotlin/src/main/kotlin/packagename/components/schemas/SchemaClass/_validate_implementor.hbs b/src/main/resources/kotlin/src/main/kotlin/packagename/components/schemas/SchemaClass/_validate_implementor.hbs new file mode 100644 index 00000000000..ddc49735032 --- /dev/null +++ b/src/main/resources/kotlin/src/main/kotlin/packagename/components/schemas/SchemaClass/_validate_implementor.hbs @@ -0,0 +1,520 @@ +{{#if types}} + {{#each types}} + {{#eq this "null"}} + +@Override +public Nothing? validate(Nothing? arg, SchemaConfiguration configuration) throws ValidationException { + Set> pathSet = new HashSet<>(); + List pathToItem = List.of("args[0"); + Nothing? castArg = castToAllowedTypes(arg, pathToItem, pathSet); + SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().build())); + ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, new PathToSchemasMap(), new LinkedHashSet<>()); + getPathToSchemas(this, castArg, validationMetadata, pathSet); + return castArg; +} + {{/eq}} + {{#eq this "object"}} + +public {{#if ../mapOutputJsonPathPiece}}{{../mapOutputJsonPathPiece.pascalCase}}{{else}}FrozenMap<@Nullable Object>{{/if}} getNewInstance(Map arg, List pathToItem, PathToSchemasMap pathToSchemas) { + LinkedHashMap src/main/kotlin/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 RuntimeException("Invalid non-string key value"); + } + String propertyName = (String) entryKey; + List propertyPathToItem = new ArrayList<>(pathToItem); + propertyPathToItem.add(propertyName); + Object value = entry.getValue(); + LinkedHashMap, Nothing?> schemas = pathToSchemas.get(propertyPathToItem); + if (schemas == null) { + throw new RuntimeException("Validation 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 ../mapValueSchema}} + {{#if ../mapValueSchema.isNullableObject }} + properties.put(propertyName, propertyInstance); + {{else}} + if (!({{#contains ../mapValueSchema.types "null" }}propertyInstance == null || {{/contains}}propertyInstance instanceof {{#with ../mapValueSchema}}{{> src/main/kotlin/packagename/components/schemas/types/schema_output_type sourceJsonPath=../jsonPath forceNull=true noAnnotations=true }}{{else}}Object{{/with}})) { + throw new RuntimeException("Invalid instantiated value"); + } + properties.put(propertyName, ({{#with ../mapValueSchema}}{{> src/main/kotlin/packagename/components/schemas/types/schema_output_type sourceJsonPath=../jsonPath forceNull=true }}{{else}}@Nullable Object{{/with}}) propertyInstance); + {{/if}} + {{else}} + properties.put(propertyName, propertyInstance); + {{/if}} + } + FrozenMap<{{#with ../mapValueSchema}}{{> src/main/kotlin/packagename/components/schemas/types/schema_output_type sourceJsonPath=../jsonPath forceNull=true }}{{else}}@Nullable Object{{/with}}> castProperties = new FrozenMap<>(properties); + {{#if ../mapOutputJsonPathPiece}} + return new {{mapOutputJsonPathPiece.pascalCase}}(castProperties); + {{else}} + return castProperties; + {{/if}} +} + +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); + SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().build())); + ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, new PathToSchemasMap(), new LinkedHashSet<>()); + PathToSchemasMap pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet); + return getNewInstance(castArg, validationMetadata.pathToItem(), pathToSchemasMap); +} + + {{/eq}} + {{#eq this "array"}} + +@Override +public {{#if ../arrayOutputJsonPathPiece}}{{../arrayOutputJsonPathPiece.pascalCase}}{{else}}FrozenList<{{#with ../listItemSchema}}{{> src/main/kotlin/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/kotlin/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) { + List itemPathToItem = new ArrayList<>(pathToItem); + itemPathToItem.add(i); + LinkedHashMap, Nothing?> schemas = pathToSchemas.get(itemPathToItem); + if (schemas == null) { + throw new RuntimeException("Validation 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 ../listItemSchema}} + {{#if ../listItemSchema.isNullableObject }} + items.add(itemInstance); + {{else}} + if (!({{#contains ../listItemSchema.types "null" }}itemInstance == null || {{/contains}}itemInstance instanceof {{#with ../listItemSchema}}{{> src/main/kotlin/packagename/components/schemas/types/schema_output_type sourceJsonPath=../jsonPath forceNull=true noAnnotations=true }}{{else}}Object{{/with}})) { + throw new RuntimeException("Invalid instantiated value"); + } + items.add(({{#with ../listItemSchema}}{{> src/main/kotlin/packagename/components/schemas/types/schema_output_type sourceJsonPath=../jsonPath forceNull=true }}{{else}}@Nullable Object{{/with}}) itemInstance); + {{/if}} + {{else}} + items.add(itemInstance); + {{/if}} + i += 1; + } + FrozenList<{{#with listItemSchema}}{{> src/main/kotlin/packagename/components/schemas/types/schema_output_type sourceJsonPath=../jsonPath forceNull=true }}{{else}}@Nullable Object{{/with}}> newInstanceItems = new FrozenList<>(items); + {{#if ../arrayOutputJsonPathPiece}} + return new {{../arrayOutputJsonPathPiece.pascalCase}}(newInstanceItems); + {{else}} + return newInstanceItems; + {{/if}} +} + +public {{#if ../arrayOutputJsonPathPiece}}{{../arrayOutputJsonPathPiece.pascalCase}}{{else}}FrozenList<{{#with ../listItemSchema}}{{> src/main/kotlin/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); + SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().build())); + ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, new PathToSchemasMap(), new LinkedHashSet<>()); + PathToSchemasMap pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet); + return getNewInstance(castArg, validationMetadata.pathToItem(), pathToSchemasMap); +} + {{/eq}} + {{#eq this "string" }} + {{#eq ../format "binary"}} +// FileIO, +// bytes, + {{else}} + +@Override +public String validate(String arg, SchemaConfiguration configuration) throws ValidationException { + Set> pathSet = new HashSet<>(); + List pathToItem = List.of("args[0"); + String castArg = castToAllowedTypes(arg, pathToItem, pathSet); + SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().build())); + ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, new PathToSchemasMap(), new LinkedHashSet<>()); + getPathToSchemas(this, castArg, validationMetadata, pathSet); + return castArg; +} + {{/eq}} + {{/eq}} + {{#eq this "integer"}} + +@Override +public Number validate(Number arg, SchemaConfiguration configuration) throws ValidationException { + Set> pathSet = new HashSet<>(); + List pathToItem = List.of("args[0"); + Number castArg = castToAllowedTypes(arg, pathToItem, pathSet); + SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().build())); + ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, new PathToSchemasMap(), new LinkedHashSet<>()); + getPathToSchemas(this, castArg, validationMetadata, pathSet); + return castArg; +} + +public int validate(int arg, SchemaConfiguration configuration) throws ValidationException { + return (int) validate((Number) arg, configuration); +} + +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 { + return (long) validate((Number) arg, configuration); +} + +public double validate(double arg, SchemaConfiguration configuration) throws ValidationException { + return (double) validate((Number) arg, configuration); +} + {{/neq}} + {{/eq}} + {{#eq this "number"}} + +@Override +public Number validate(Number arg, SchemaConfiguration configuration) throws ValidationException { + Set> pathSet = new HashSet<>(); + List pathToItem = List.of("args[0"); + Number castArg = castToAllowedTypes(arg, pathToItem, pathSet); + SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().build())); + ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, new PathToSchemasMap(), new LinkedHashSet<>()); + PathToSchemasMap pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet); + return castArg; +} + {{#eq ../format null}} + +public int validate(int arg, SchemaConfiguration configuration) throws ValidationException { + return (int) validate((Number) arg, configuration); +} + +public long validate(long arg, SchemaConfiguration configuration) throws ValidationException { + return (long) validate((Number) arg, configuration); +} + +public float validate(float arg, SchemaConfiguration configuration) throws ValidationException { + return (float) validate((Number) arg, configuration); +} + +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 { + return (int) validate((Number) arg, configuration); +} + +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 { + return (int) validate((Number) arg, configuration); +} + +public float validate(float arg, SchemaConfiguration configuration) throws ValidationException { + return (float) validate((Number) arg, configuration); +} + +public long validate(long arg, SchemaConfiguration configuration) throws ValidationException { + return (long) validate((Number) arg, configuration); +} + +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 { + return (float) validate((Number) arg, configuration); +} + {{else}} + {{#eq ../format "double"}} +public double validate(double arg, SchemaConfiguration configuration) throws ValidationException { + return (double) validate((Number) arg, configuration); +} + {{/eq}} + {{/eq}} + {{/eq}} + {{/eq}} + {{/eq}} + {{/eq}} + {{#eq this "boolean"}} + +@Override +public boolean validate(boolean arg, SchemaConfiguration configuration) throws ValidationException { + Set> pathSet = new HashSet<>(); + List pathToItem = List.of("args[0"); + boolean castArg = castToAllowedTypes(arg, pathToItem, pathSet); + SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().build())); + ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, new PathToSchemasMap(), new LinkedHashSet<>()); + getPathToSchemas(this, castArg, validationMetadata, pathSet); + return castArg; +} + {{/eq}} + {{/each}} +{{else}} + +@Override +public Nothing? validate(Nothing? arg, SchemaConfiguration configuration) throws ValidationException { + Set> pathSet = new HashSet<>(); + List pathToItem = List.of("args[0]"); + Nothing? castArg = castToAllowedTypes(arg, pathToItem, pathSet); + SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().build())); + PathToSchemasMap validatedPathToSchemas = new PathToSchemasMap(); + ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, new LinkedHashSet<>()); + getPathToSchemas(this, castArg, validationMetadata, pathSet); + return castArg; +} + +@Override +public boolean validate(boolean arg, SchemaConfiguration configuration) throws ValidationException { + Set> pathSet = new HashSet<>(); + List pathToItem = List.of("args[0]"); + boolean castArg = castToAllowedTypes(arg, pathToItem, pathSet); + SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().build())); + PathToSchemasMap validatedPathToSchemas = new PathToSchemasMap(); + ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, new LinkedHashSet<>()); + getPathToSchemas(this, castArg, validationMetadata, pathSet); + return castArg; +} + +@Override +public Number validate(Number arg, SchemaConfiguration configuration) throws ValidationException { + Set> pathSet = new HashSet<>(); + List pathToItem = List.of("args[0]"); + Number castArg = castToAllowedTypes(arg, pathToItem, pathSet); + SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().build())); + PathToSchemasMap validatedPathToSchemas = new PathToSchemasMap(); + ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, new LinkedHashSet<>()); + getPathToSchemas(this, castArg, validationMetadata, pathSet); + return castArg; +} + +public int validate(int arg, SchemaConfiguration configuration) throws ValidationException { + return (int) validate((Number) arg, configuration); +} + +public long validate(long arg, SchemaConfiguration configuration) throws ValidationException { + return (long) validate((Number) arg, configuration); +} + +public float validate(float arg, SchemaConfiguration configuration) throws ValidationException { + return (float) validate((Number) arg, configuration); +} + +public double validate(double arg, SchemaConfiguration configuration) throws ValidationException { + return (double) validate((Number) arg, configuration); +} + +@Override +public String validate(String arg, SchemaConfiguration configuration) throws ValidationException { + Set> pathSet = new HashSet<>(); + List pathToItem = List.of("args[0]"); + String castArg = castToAllowedTypes(arg, pathToItem, pathSet); + SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().build())); + PathToSchemasMap validatedPathToSchemas = new PathToSchemasMap(); + ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, new LinkedHashSet<>()); + getPathToSchemas(this, castArg, validationMetadata, pathSet); + return castArg; +} + +public String validate(LocalDate arg, SchemaConfiguration configuration) throws ValidationException { + return validate(arg.toString(), configuration); +} + +public String validate(ZonedDateTime arg, SchemaConfiguration configuration) throws ValidationException { + return validate(arg.toString(), configuration); +} + +public String validate(UUID arg, SchemaConfiguration configuration) throws ValidationException { + return validate(arg.toString(), configuration); +} + +@Override +public {{#if arrayOutputJsonPathPiece}}{{arrayOutputJsonPathPiece.pascalCase}}{{else}}FrozenList<{{#with listItemSchema}}{{> src/main/kotlin/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/kotlin/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) { + List itemPathToItem = new ArrayList<>(pathToItem); + itemPathToItem.add(i); + LinkedHashMap, Nothing?> schemas = pathToSchemas.get(itemPathToItem); + if (schemas == null) { + throw new RuntimeException("Validation 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 listItemSchema}} + {{#if listItemSchema.isNullableObject }} + items.add(itemInstance); + {{else}} + if (!({{#contains listItemSchema.types "null" }}itemInstance == null || {{/contains}}itemInstance instanceof {{#with listItemSchema}}{{> src/main/kotlin/packagename/components/schemas/types/schema_output_type sourceJsonPath=../jsonPath forceNull=true noAnnotations=true }}{{else}}Object{{/with}})) { + throw new RuntimeException("Invalid instantiated value"); + } + items.add(({{#with listItemSchema}}{{> src/main/kotlin/packagename/components/schemas/types/schema_output_type sourceJsonPath=../jsonPath forceNull=true }}{{else}}@Nullable Object{{/with}}) itemInstance); + {{/if}} + {{else}} + items.add(itemInstance); + {{/if}} + i += 1; + } + FrozenList<{{#with listItemSchema}}{{> src/main/kotlin/packagename/components/schemas/types/schema_output_type sourceJsonPath=../jsonPath forceNull=true }}{{else}}@Nullable Object{{/with}}> newInstanceItems = new FrozenList<>(items); + {{#if arrayOutputJsonPathPiece}} + return new {{arrayOutputJsonPathPiece.pascalCase}}(newInstanceItems); + {{else}} + return newInstanceItems; + {{/if}} +} + +public {{#if arrayOutputJsonPathPiece}}{{arrayOutputJsonPathPiece.pascalCase}}{{else}}FrozenList<{{#with ../listItemSchema}}{{> src/main/kotlin/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); + SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().build())); + ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, new PathToSchemasMap(), new LinkedHashSet<>()); + PathToSchemasMap pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet); + return getNewInstance(castArg, validationMetadata.pathToItem(), pathToSchemasMap); +} + +@Override +public {{#if mapOutputJsonPathPiece}}{{mapOutputJsonPathPiece.pascalCase}}{{else}}FrozenMap<{{#with mapValueSchema}}{{> src/main/kotlin/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/kotlin/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 RuntimeException("Invalid non-string key value"); + } + String propertyName = (String) entryKey; + List propertyPathToItem = new ArrayList<>(pathToItem); + propertyPathToItem.add(propertyName); + Object value = entry.getValue(); + LinkedHashMap, Nothing?> schemas = pathToSchemas.get(propertyPathToItem); + if (schemas == null) { + throw new RuntimeException("Validation 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 mapValueSchema}} + {{#if mapValueSchema.isNullableObject }} + properties.put(propertyName, propertyInstance); + {{else}} + if (!({{#contains mapValueSchema.types "null" }}propertyInstance == null || {{/contains}}propertyInstance instanceof {{#with mapValueSchema}}{{> src/main/kotlin/packagename/components/schemas/types/schema_output_type sourceJsonPath=../jsonPath forceNull=true noAnnotations=true }}{{else}}Object{{/with}})) { + throw new RuntimeException("Invalid instantiated value"); + } + properties.put(propertyName, ({{#with mapValueSchema}}{{> src/main/kotlin/packagename/components/schemas/types/schema_output_type sourceJsonPath=../jsonPath forceNull=true }}{{else}}@Nullable Object{{/with}}) propertyInstance); + {{/if}} + {{else}} + properties.put(propertyName, propertyInstance); + {{/if}} + } + FrozenMap<{{#with mapValueSchema}}{{> src/main/kotlin/packagename/components/schemas/types/schema_output_type sourceJsonPath=../jsonPath forceNull=true }}{{else}}@Nullable Object{{/with}}> castProperties = new FrozenMap<>(properties); + {{#if ../mapOutputJsonPathPiece}} + return new {{mapOutputJsonPathPiece.pascalCase}}(castProperties); + {{else}} + return castProperties; + {{/if}} +} + +public {{#if mapOutputJsonPathPiece}}{{mapOutputJsonPathPiece.pascalCase}}{{else}}FrozenMap<{{#with mapValueSchema}}{{> src/main/kotlin/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); + SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().build())); + PathToSchemasMap validatedPathToSchemas = new PathToSchemasMap(); + ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, new LinkedHashSet<>()); + PathToSchemasMap pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet); + return getNewInstance(castArg, validationMetadata.pathToItem(), pathToSchemasMap); +} +{{/if}} + {{#and enumInfo enumInfo.typeToValues.null}} + +@Override +public Nothing? 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 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 { + return validate(arg.value(), configuration); +} + {{/and}} + {{#and enumInfo enumInfo.typeToValues.Integer}} + +@Override +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 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 { + 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 { + return (double) validate((Number) arg.value(), configuration); +} + {{/and}} + +@Override +public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { +{{#if types}} + {{#each types}} + {{#if @first}} + if (arg {{#eq this "null"}}== null{{/eq}}{{#eq this "boolean"}}instanceof Boolean{{/eq}}{{#or (eq this "integer") (eq this "number")}}instanceof Number{{/or}}{{#eq this "string" }}instanceof String{{/eq}}{{#eq this "array"}}instanceof List{{/eq}}{{#eq this "object"}}instanceof Map{{/eq}}) { + {{else}} + } else if (arg {{#eq this "null"}}== null{{/eq}}{{#eq this "boolean"}}instanceof Boolean{{/eq}}{{#or (eq this "integer") (eq this "number")}}instanceof Number{{/or}}{{#eq this "string" }}instanceof String{{/eq}}{{#eq this "array"}}instanceof List{{/eq}}{{#eq this "object"}}instanceof Map{{/eq}}) { + {{/if}} + {{#eq this "null"}} + return validate((Nothing?) null, configuration); + {{/eq}} + {{#eq this "boolean"}} + boolean boolArg = (Boolean) arg; + return validate(boolArg, configuration); + {{/eq}} + {{#or (eq this "integer") (eq this "number")}} + return validate((Number) arg, configuration); + {{/or}} + {{#eq this "string" }} + return validate((String) arg, configuration); + {{/eq}} + {{#eq this "array"}} + return validate((List) arg, configuration); + {{/eq}} + {{#eq this "object"}} + return validate((Map) arg, configuration); + {{/eq}} + {{#if @last}} + } + {{/if}} + {{/each}} +{{else}} + if (arg == null) { + return validate((Nothing?) null, configuration); + } else if (arg instanceof Boolean) { + boolean boolArg = (Boolean) arg; + return validate(boolArg, configuration); + } else if (arg instanceof Number) { + return validate((Number) arg, configuration); + } else if (arg instanceof String) { + return validate((String) arg, configuration); + } else if (arg instanceof List) { + return validate((List) arg, configuration); + } else if (arg instanceof Map) { + return validate((Map) arg, configuration); + } +{{/if}} + 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/kotlin/src/main/kotlin/packagename/components/schemas/Schema_doc.hbs b/src/main/resources/kotlin/src/main/kotlin/packagename/components/schemas/Schema_doc.hbs new file mode 100644 index 00000000000..ca13d32329c --- /dev/null +++ b/src/main/resources/kotlin/src/main/kotlin/packagename/components/schemas/Schema_doc.hbs @@ -0,0 +1,330 @@ +{{#with schema}} +{{#eq identifierPieces.size 0}} +{{> src/main/kotlin/packagename/components/_helper_header_from_identifier_pieces identifierPieces=(append identifierPieces containerJsonPathPiece) }} +{{else}} +{{> src/main/kotlin/packagename/components/_helper_header_from_identifier_pieces }} +{{/eq}} +{{#if componentModule}} +{{moduleLocation}}.java +{{/if}} +public class {{containerJsonPathPiece.pascalCase}}
+{{#if refInfo}} +extends [{{refInfo.refClass}}]({{docRoot}}{{#with refInfo.ref}}{{pathFromDocRoot}}.md#{{containerJsonPathPiece.kebabCase}}{{/with}}) +{{/if}} + +A class that contains necessary nested +- schema classes (which validate payloads), extends JsonSchema +- sealed interfaces which store validated payloads, Kotlin version of a sum type +- boxed classes which store validated payloads, sealed permits class implementations +{{#if containsArrayOutputClass}} +- classes to store validated list payloads, extends FrozenList +- classes to build inputs for list payloads +{{/if}} +{{#if containsObjectOutputClass}} +- classes to store validated map payloads, extends FrozenMap +- classes to build inputs for map payloads +{{/if}} +{{#if containsEnums}} +- enum classes +{{/if}} + +{{headerSize}}# Nested Class Summary +| Modifier and Type | Class and Description | +| ----------------- | ---------------------- | +{{#each (reverse getSchemas)}} + {{#eq instanceType "schema"}} + {{#eq refInfo null }} +| sealed interface | [{{../containerJsonPathPiece.pascalCase}}.{{jsonPathPiece.pascalCase}}Boxed](#{{> src/main/kotlin/packagename/components/_helper_anchor_id identifierPieces=(append identifierPieces (join jsonPathPiece.kebabCase "boxed" "")) }})
sealed interface for validated payloads | + {{#each types}} + {{#eq this "null"}} +| record | [{{../../containerJsonPathPiece.pascalCase}}.{{jsonPathPiece.pascalCase}}BoxedVoid](#{{> src/main/kotlin/packagename/components/_helper_anchor_id identifierPieces=(append identifierPieces (join jsonPathPiece.kebabCase "boxedvoid" ""))}})
boxed class to store validated null payloads | + {{/eq}} + {{#eq this "boolean"}} +| record | [{{../../containerJsonPathPiece.pascalCase}}.{{jsonPathPiece.pascalCase}}BoxedBoolean](#{{> src/main/kotlin/packagename/components/_helper_anchor_id identifierPieces=(append identifierPieces (join jsonPathPiece.kebabCase "boxedboolean" ""))}})
boxed class to store validated boolean payloads | + {{/eq}} + {{#or (eq this "number") (eq this "integer")}} +| record | [{{../../containerJsonPathPiece.pascalCase}}.{{jsonPathPiece.pascalCase}}BoxedNumber](#{{> src/main/kotlin/packagename/components/_helper_anchor_id identifierPieces=(append identifierPieces (join jsonPathPiece.kebabCase "boxednumber" ""))}})
boxed class to store validated Number payloads | + {{/or}} + {{#and (eq this "string") (neq ../format "binary") }} +| record | [{{../../containerJsonPathPiece.pascalCase}}.{{jsonPathPiece.pascalCase}}BoxedString](#{{> src/main/kotlin/packagename/components/_helper_anchor_id identifierPieces=(append identifierPieces (join jsonPathPiece.kebabCase "boxedstring" ""))}})
boxed class to store validated String payloads | + {{/and}} + {{#eq this "array"}} +| record | [{{../../containerJsonPathPiece.pascalCase}}.{{jsonPathPiece.pascalCase}}BoxedList](#{{> src/main/kotlin/packagename/components/_helper_anchor_id identifierPieces=(append identifierPieces (join jsonPathPiece.kebabCase "boxedlist" ""))}})
boxed class to store validated List payloads | + {{/eq}}{{#eq this "object"}} +| record | [{{../../containerJsonPathPiece.pascalCase}}.{{jsonPathPiece.pascalCase}}BoxedMap](#{{> src/main/kotlin/packagename/components/_helper_anchor_id identifierPieces=(append identifierPieces (join jsonPathPiece.kebabCase "boxedmap" ""))}})
boxed class to store validated Map payloads | + {{/eq}} + {{else}} +| record | [{{../containerJsonPathPiece.pascalCase}}.{{jsonPathPiece.pascalCase}}BoxedVoid](#{{> src/main/kotlin/packagename/components/_helper_anchor_id identifierPieces=(append identifierPieces (join jsonPathPiece.kebabCase "boxedvoid" ""))}})
boxed class to store validated null payloads | +| record | [{{../containerJsonPathPiece.pascalCase}}.{{jsonPathPiece.pascalCase}}BoxedBoolean](#{{> src/main/kotlin/packagename/components/_helper_anchor_id identifierPieces=(append identifierPieces (join jsonPathPiece.kebabCase "boxedboolean" ""))}})
boxed class to store validated boolean payloads | +| record | [{{../containerJsonPathPiece.pascalCase}}.{{jsonPathPiece.pascalCase}}BoxedNumber](#{{> src/main/kotlin/packagename/components/_helper_anchor_id identifierPieces=(append identifierPieces (join jsonPathPiece.kebabCase "boxednumber" ""))}})
boxed class to store validated Number payloads | +| record | [{{../containerJsonPathPiece.pascalCase}}.{{jsonPathPiece.pascalCase}}BoxedString](#{{> src/main/kotlin/packagename/components/_helper_anchor_id identifierPieces=(append identifierPieces (join jsonPathPiece.kebabCase "boxedstring" ""))}})
boxed class to store validated String payloads | +| record | [{{../containerJsonPathPiece.pascalCase}}.{{jsonPathPiece.pascalCase}}BoxedList](#{{> src/main/kotlin/packagename/components/_helper_anchor_id identifierPieces=(append identifierPieces (join jsonPathPiece.kebabCase "boxedlist" ""))}})
boxed class to store validated List payloads | +| record | [{{../containerJsonPathPiece.pascalCase}}.{{jsonPathPiece.pascalCase}}BoxedMap](#{{> src/main/kotlin/packagename/components/_helper_anchor_id identifierPieces=(append identifierPieces (join jsonPathPiece.kebabCase "boxedmap" ""))}})
boxed class to store validated Map payloads | + {{/each}} + {{/eq}} +| static class | [{{../containerJsonPathPiece.pascalCase}}.{{jsonPathPiece.pascalCase}}](#{{> src/main/kotlin/packagename/components/_helper_anchor_id identifierPieces=(append identifierPieces jsonPathPiece) }})
schema class | + {{else}} + {{#eq instanceType "propertiesOutputType"}} +| static class | [{{../containerJsonPathPiece.pascalCase}}.{{mapOutputJsonPathPiece.pascalCase}}](#{{> src/main/kotlin/packagename/components/_helper_anchor_id identifierPieces=(append identifierPieces mapOutputJsonPathPiece) }})
output class for Map payloads | + {{else}} + {{#eq instanceType "arrayOutputType"}} +| static class | [{{../containerJsonPathPiece.pascalCase}}.{{arrayOutputJsonPathPiece.pascalCase}}](#{{> src/main/kotlin/packagename/components/_helper_anchor_id identifierPieces=(append identifierPieces arrayOutputJsonPathPiece) }})
output class for List payloads | + {{else}} + {{#eq instanceType "arrayInputType"}} +| static class | [{{../containerJsonPathPiece.pascalCase}}.{{arrayInputJsonPathPiece.pascalCase}}](#{{> src/main/kotlin/packagename/components/_helper_anchor_id identifierPieces=(append identifierPieces arrayInputJsonPathPiece) }})
builder for List payloads | + {{else}} + {{#or (eq instanceType "propertiesInputType") (eq instanceType "requiredPropertiesInputType") (eq instanceType "optionalPropertiesInputType") }} +| static class | [{{../containerJsonPathPiece.pascalCase}}.{{mapInputJsonPathPiece.pascalCase}}](#{{> src/main/kotlin/packagename/components/_helper_anchor_id identifierPieces=(append identifierPieces mapInputJsonPathPiece) }})
builder for Map payloads | + {{else}} + {{#eq instanceType "enumClass"}} + {{#with enumInfo}} + {{#each typeToValues}} + {{#eq @key "null"}} +| enum | [{{../../../containerJsonPathPiece.pascalCase}}.Null{{../jsonPathPiece.pascalCase}}](#null{{../jsonPathPiece.kebabCase}})
null enum | + {{else}} + {{#eq @key "boolean"}} +| enum | [{{../../../containerJsonPathPiece.pascalCase}}.Boolean{{../jsonPathPiece.pascalCase}}](#boolean{{../jsonPathPiece.kebabCase}})
boolean enum | + {{else}} + {{#eq @key "string"}} +| enum | [{{../../../containerJsonPathPiece.pascalCase}}.String{{../jsonPathPiece.pascalCase}}](#string{{../jsonPathPiece.kebabCase}})
String enum | + {{else}} + {{#eq @key "Integer"}} +| enum | [{{../../../containerJsonPathPiece.pascalCase}}.Integer{{../jsonPathPiece.pascalCase}}](#integer{{../jsonPathPiece.kebabCase}})
Integer enum | + {{else}} + {{#eq @key "Long"}} +| enum | [{{../../../containerJsonPathPiece.pascalCase}}.Long{{../jsonPathPiece.pascalCase}}](#long{{../jsonPathPiece.kebabCase}})
Long enum | + {{else}} + {{#eq @key "Float"}} +| enum | [{{../../../containerJsonPathPiece.pascalCase}}.Float{{../jsonPathPiece.pascalCase}}](#float{{../jsonPathPiece.kebabCase}})
Float enum | + {{else}} + {{#eq @key "Double"}} +| enum | [{{../../../containerJsonPathPiece.pascalCase}}.Double{{../jsonPathPiece.pascalCase}}](#double{{../jsonPathPiece.kebabCase}})
Double enum | + {{/eq}} + {{/eq}} + {{/eq}} + {{/eq}} + {{/eq}} + {{/eq}} + {{/eq}} + {{/each}} + {{/with}} + {{/eq}} + {{/or}} + {{/eq}} + {{/eq}} + {{/eq}} + {{/eq}} +{{/each}} +{{#each (reverse getSchemas)}} + {{#eq instanceType "schema"}} + + {{#eq refInfo null}} +{{> src/main/kotlin/packagename/components/schemas/SchemaClass/_boxedClasses forDocs=true }} + {{/eq}} +{{> src/main/kotlin/packagename/components/_helper_header_from_identifier_pieces headerSize=(join headerSize "#" "") identifierPieces=(append identifierPieces jsonPathPiece) }} +public static class {{jsonPathPiece.pascalCase}}
+{{> src/main/kotlin/packagename/components/schemas/docschema_extends }} + +A schema class that validates payloads + {{#if description}} + +{{headerSize}}# Description +{{description.originalWithBr}} + {{/if}} + {{#if isCustomSchema}} + {{#if typeToExample}} + +{{headerSize}}## Code Sample +``` +import {{{packageName}}}.configurations.JsonSchemaKeywordFlags; +import {{{packageName}}}.configurations.SchemaConfiguration; +import {{{packageName}}}.exceptions.ValidationException; +import {{{packageName}}}.schemas.validation.MapUtils; +import {{{packageName}}}.schemas.validation.FrozenList; +import {{{packageName}}}.schemas.validation.FrozenMap; +import {{{packageName}}}.{{../subpackage}}.{{../containerJsonPathPiece.pascalCase}}; + +import java.util.Arrays; +import java.util.List; +import java.util.AbstractMap; + +static final SchemaConfiguration configuration = new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().build()); +{{> src/main/kotlin/packagename/components/schemas/validateSchemaCodeSample payloadVarName="validatedPayload" configVarName="configuration" }} +``` + {{/if}} + +{{headerSize}}## Field Summary +| Modifier and Type | Field and Description | +| ----------------- | ---------------------- | +{{> src/main/kotlin/packagename/components/schemas/docschema_fields forDocs=true }} + +{{headerSize}}## Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +{{> src/main/kotlin/packagename/components/schemas/docschema_io_types }} + {{else}} +{{> src/main/kotlin/packagename/components/schemas/_docschema_methodsInherited }} + {{/if}} + {{else}} + {{#eq instanceType "propertiesOutputType"}} + +{{> src/main/kotlin/packagename/components/_helper_header_from_identifier_pieces headerSize=(join headerSize "#" "") identifierPieces=(append identifierPieces mapOutputJsonPathPiece) }} +public static class {{mapOutputJsonPathPiece.pascalCase}}
+extends FrozenMap src/main/kotlin/packagename/components/schemas/types/schema_output_type forceNull=true }}{{else}}Object{{/with}}> + +A class to store validated Map payloads + +{{headerSize}}## Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| static [{{mapOutputJsonPathPiece.pascalCase}}](#{{> src/main/kotlin/packagename/components/_helper_anchor_id identifierPieces=(append identifierPieces mapOutputJsonPathPiece) }}) | of([Map src/main/kotlin/packagename/components/schemas/types/schema_input_type sourceJsonPath=../jsonPath forceNull=true }}{{else}}Object{{/with}}>](#{{> src/main/kotlin/packagename/components/_helper_anchor_id identifierPieces=(append identifierPieces mapInputJsonPathPiece) }}) arg, SchemaConfiguration configuration) | + {{#each requiredProperties}} + {{#if @key.isValid}} +| {{> src/main/kotlin/packagename/components/schemas/types/schema_output_type sourceJsonPath=../jsonPath useLink=true }} | {{@key.original}}()
{{> src/main/kotlin/packagename/components/schemas/helpers/notes_msg defaultUser="server" }} | + {{/if}} + {{/each}} + {{#each optionalProperties}} + {{#if @key.isValid}} +| {{> src/main/kotlin/packagename/components/schemas/types/schema_output_type sourceJsonPath=../jsonPath useLink=true }} | {{@key.original}}()
[optional]{{> src/main/kotlin/packagename/components/schemas/helpers/notes_msg defaultUser="server" }} | + {{/if}} + {{/each}} + {{#or (and requiredProperties requiredProperties.hasInvalidKey) (and optionalProperties optionalProperties.hasInvalidKey) }} +| {{#with mapValueSchema}}{{> src/main/kotlin/packagename/components/schemas/types/schema_output_type sourceJsonPath=../jsonPath useLink=true }}{{else}}Object{{/with}} | get(String key)
This schema has invalid Kotlin names so this method must be used when you access {{#each requiredProperties}}{{#unless @key.isValid}}instance["{{@key.original}}"], {{/unless}}{{/each}}{{#each optionalProperties}}{{#unless @key.isValid}}instance["{{@key.original}}"], {{/unless}}{{/each}} | + {{/or}} + {{#with additionalProperties}} + {{#unless isBooleanSchemaFalse}} + {{#if isBooleanSchemaTrue}} +| @Nullable Object | getAdditionalProperty(String name)
provides type safety for additional properties | + {{else}} +| {{> src/main/kotlin/packagename/components/schemas/types/schema_output_type sourceJsonPath=../jsonPath useLink=true }} | getAdditionalProperty(String name)
provides type safety for additional properties | + {{/if}} + {{/unless}} + {{else}} +| @Nullable Object | getAdditionalProperty(String name)
provides type safety for additional properties | + {{/with}} + {{else}} + {{#eq instanceType "arrayOutputType"}} + +{{> src/main/kotlin/packagename/components/_helper_header_from_identifier_pieces headerSize=(join headerSize "#" "") identifierPieces=(append identifierPieces arrayOutputJsonPathPiece) }} +public class {{arrayOutputJsonPathPiece.pascalCase}}
+extends `FrozenList<{{#with listItemSchema}}{{> src/main/kotlin/packagename/components/schemas/types/schema_output_type forceNull=true }}{{else}}Object{{/with}}>` + +A class to store validated List payloads + +{{headerSize}}## Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| static [{{arrayOutputJsonPathPiece.pascalCase}}](#{{> src/main/kotlin/packagename/components/_helper_anchor_id identifierPieces=(append identifierPieces arrayOutputJsonPathPiece) }}) | of([List<{{#with listItemSchema}}{{> src/main/kotlin/packagename/components/schemas/types/schema_input_type sourceJsonPath=../jsonPath forceNull=true }}{{/with}}>](#{{> src/main/kotlin/packagename/components/_helper_anchor_id identifierPieces=(append identifierPieces arrayInputJsonPathPiece) }}) arg, SchemaConfiguration configuration) | + {{else}} + {{#eq instanceType "arrayInputType"}} +{{> src/main/kotlin/packagename/components/schemas/docschema_arrayInput }} + {{else}} + {{#or (eq instanceType "propertiesInputType") (eq instanceType "requiredPropertiesInputType") (eq instanceType "optionalPropertiesInputType") }} +{{> src/main/kotlin/packagename/components/schemas/docschema_objectInput }} + {{else}} + {{#eq instanceType "enumClass"}} + {{#with enumInfo}} + {{#each typeToValues}} + + {{#eq @key "null"}} +{{> src/main/kotlin/packagename/components/_helper_header_from_identifier_pieces headerSize=(join headerSize "#" "") identifierPieces=(append identifierPieces (join "Null" ../jsonPathPiece.pascalCase "") ) }} +public enum Null{{../jsonPathPiece.pascalCase}}
+extends `Enum` + +A class that stores null enum values + {{else}} + {{#eq @key "boolean"}} +{{> src/main/kotlin/packagename/components/_helper_header_from_identifier_pieces headerSize=(join headerSize "#" "") identifierPieces=(append identifierPieces (join "Boolean" ../jsonPathPiece.pascalCase "") ) }} +public enum Boolean{{../jsonPathPiece.pascalCase}}
+extends `Enum` + +A class that stores boolean enum values + {{else}} + {{#eq @key "string"}} +{{> src/main/kotlin/packagename/components/_helper_header_from_identifier_pieces headerSize=(join headerSize "#" "") identifierPieces=(append identifierPieces (join "String" ../jsonPathPiece.pascalCase "") ) }} +public enum String{{../jsonPathPiece.pascalCase}}
+extends `Enum` + +A class that stores String enum values + {{else}} + {{#eq @key "Integer"}} +{{> src/main/kotlin/packagename/components/_helper_header_from_identifier_pieces headerSize=(join headerSize "#" "") identifierPieces=(append identifierPieces (join "Integer" ../jsonPathPiece.pascalCase "") ) }} +public enum Integer{{../jsonPathPiece.pascalCase}}
+extends `Enum` + +A class that stores Integer enum values + {{else}} + {{#eq @key "Long"}} +{{> src/main/kotlin/packagename/components/_helper_header_from_identifier_pieces headerSize=(join headerSize "#" "") identifierPieces=(append identifierPieces (join "Long" ../jsonPathPiece.pascalCase "") ) }} +public enum Long{{../jsonPathPiece.pascalCase}}
+extends `Enum` + +A class that stores Long enum values + {{else}} + {{#eq @key "Float"}} +{{> src/main/kotlin/packagename/components/_helper_header_from_identifier_pieces headerSize=(join headerSize "#" "") identifierPieces=(append identifierPieces (join "Float" ../jsonPathPiece.pascalCase "") ) }} +public enum Float{{../jsonPathPiece.pascalCase}}
+extends `Enum` + +A class that stores Float enum values + {{else}} + {{#eq @key "Double"}} +{{> src/main/kotlin/packagename/components/_helper_header_from_identifier_pieces headerSize=(join headerSize "#" "") identifierPieces=(append identifierPieces (join "Double" ../jsonPathPiece.pascalCase "") ) }} +public enum Double{{../jsonPathPiece.pascalCase}}
+extends `Enum` + +A class that stores Double enum values + {{/eq}} + {{/eq}} + {{/eq}} + {{/eq}} + {{/eq}} + {{/eq}} + {{/eq}} + +{{headerSize}}## Enum Constant Summary +| Enum Constant | Description | +| ------------- | ----------- | + {{#each this}} + {{#eq ../@key "null"}} +| {{this}} | value = null | + {{else}} + {{#eq ../@key "boolean"}} +| {{this}} | value = {{@key.value}} | + {{else}} + {{#eq ../@key "string"}} +| {{this}} | value = "{{{@key.value}}}" | + {{else}} + {{#eq ../@key "Integer"}} +| {{this}} | value = {{@key.value}} | + {{else}} + {{#eq ../@key "Long"}} +| {{this}} | value = {{@key.value}}L | + {{else}} + {{#eq ../@key "Float"}} +| {{this}} | value = {{@key.value}}f | + {{else}} + {{#eq ../@key "Double"}} +| {{this}} | value = {{@key.value}}d | + {{/eq}} + {{/eq}} + {{/eq}} + {{/eq}} + {{/eq}} + {{/eq}} + {{/eq}} + {{/each}} + {{/each}} + {{/with}} + {{/eq}} + {{/or}} + {{/eq}} + {{/eq}} + {{/eq}} + {{/eq}} +{{/each}} +{{#if componentModule}} + +[[Back to top]](#top) {{> _helper_footer_links readmePath="../../../" schemasLink=true}} +{{/if}} +{{/with}} \ No newline at end of file diff --git a/src/main/resources/kotlin/src/main/kotlin/packagename/components/schemas/Schema_getSchemas.hbs b/src/main/resources/kotlin/src/main/kotlin/packagename/components/schemas/Schema_getSchemas.hbs new file mode 100644 index 00000000000..2ff018c4ae3 --- /dev/null +++ b/src/main/resources/kotlin/src/main/kotlin/packagename/components/schemas/Schema_getSchemas.hbs @@ -0,0 +1,53 @@ +{{#each getSchemas}} + {{! generate all schemas in post order traversal }} + {{#eq instanceType "schema" }} +{{> src/main/kotlin/packagename/components/schemas/SchemaClass/SchemaClass identifierPieces=(append identifierPieces jsonPathPiece) }} + {{else}} + {{#eq instanceType "allOfType" }} +{{!> components/schemas/_allof_type }} + {{else}} + {{#eq instanceType "anyOfType" }} +{{!> components/schemas/_anyof_type }} + {{else}} + {{#eq instanceType "enumClass" }} +{{> src/main/kotlin/packagename/components/schemas/_enumTypes }} + {{else}} + {{#eq instanceType "oneOfType" }} +{{!> components/schemas/_oneof_type }} + {{else}} + {{#eq instanceType "propertiesType" }} +{{!> components/schemas/_properties_type }} + {{else}} + {{#eq instanceType "requiredPropertiesInputType" }} + {{! only required }} +{{> src/main/kotlin/packagename/components/schemas/_objectInputType }} + {{else}} + {{! only optional }} + {{#eq instanceType "optionalPropertiesInputType" }} +{{> src/main/kotlin/packagename/components/schemas/_objectInputType }} + {{else}} + {{! both required + optional }} + {{#eq instanceType "propertiesInputType" }} +{{> src/main/kotlin/packagename/components/schemas/_objectInputType }} + {{else}} + {{#eq instanceType "propertiesOutputType" }} +{{> src/main/kotlin/packagename/components/schemas/_objectOutputType }} + {{else}} + {{#eq instanceType "arrayOutputType" }} +{{> src/main/kotlin/packagename/components/schemas/_arrayOutputType }} + {{else}} + {{#eq instanceType "arrayInputType" }} +{{> src/main/kotlin/packagename/components/schemas/_arrayInputType }} + {{/eq}} + {{/eq}} + {{/eq}} + {{/eq}} + {{/eq}} + {{/eq}} + {{/eq}} + {{/eq}} + {{/eq}} + {{/eq}} + {{/eq}} + {{/eq}} +{{/each}} \ No newline at end of file diff --git a/src/main/resources/kotlin/src/main/kotlin/packagename/components/schemas/_arrayInputAddItem.hbs b/src/main/resources/kotlin/src/main/kotlin/packagename/components/schemas/_arrayInputAddItem.hbs new file mode 100644 index 00000000000..79f0faab9b7 --- /dev/null +++ b/src/main/resources/kotlin/src/main/kotlin/packagename/components/schemas/_arrayInputAddItem.hbs @@ -0,0 +1,269 @@ +{{#each types}} + {{#eq this "null"}} + {{#if forDocs }} +| {{builderClass}} | add(Nothing? item) | + {{else}} + +public {{builderClass}} add(Nothing? item) { + list.add(null); + return this; +} + {{/if}} + {{else}} + {{#eq this "boolean"}} + {{#if forDocs }} +| {{builderClass}} | add(boolean item) | + {{else}} + +public {{builderClass}} add(boolean item) { + list.add(item); + return this; +} + {{/if}} + {{else}} + {{#eq this "string"}} + {{#if forDocs }} +| {{builderClass}} | add(String item) | + {{else}} + +public {{builderClass}} add(String item) { + list.add(item); + return this; +} + {{/if}} + {{else}} + {{#or (eq this "integer") (eq this "number") }} + {{#if forDocs }} +| {{builderClass}} | add(int item) | +| {{builderClass}} | add(float item) | + {{#neq ../format "int32"}} +| {{builderClass}} | add(long item) | +| {{builderClass}} | add(double item) | + {{/neq}} + {{else}} + +public {{builderClass}} add(int item) { + list.add(item); + return this; +} + +public {{builderClass}} add(float item) { + list.add(item); + return this; +} + {{#neq ../format "int32"}} + +public {{builderClass}} add(long item) { + list.add(item); + return this; +} + +public {{builderClass}} add(double item) { + list.add(item); + return this; +} + {{/neq}} + {{/if}} + {{else}} + {{#eq this "array"}} + {{#if forDocs }} +| {{builderClass}} | add(List<{{#with listItemSchema}}{{> src/main/kotlin/packagename/components/schemas/types/schema_input_type sourceJsonPath=../jsonPath forceNull=true noExtends=true }}{{else}}@Nullable Object{{/with}}> item) | + {{else}} + +public {{builderClass}} add(List<{{#with listItemSchema}}{{> src/main/kotlin/packagename/components/schemas/types/schema_input_type sourceJsonPath=../jsonPath forceNull=true noExtends=true }}{{else}}@Nullable Object{{/with}}> item) { + list.add(item); + return this; +} + {{/if}} + {{else}} + {{#eq this "object"}} + {{#if forDocs }} +| {{builderClass}} | add(Map src/main/kotlin/packagename/components/schemas/types/schema_input_type sourceJsonPath=../jsonPath forceNull=true noExtends=true }}{{else}}@Nullable Object{{/with}}> item) | + {{else}} + +public {{builderClass}} add(Map src/main/kotlin/packagename/components/schemas/types/schema_input_type sourceJsonPath=../jsonPath forceNull=true noExtends=true }}{{else}}@Nullable Object{{/with}}> item) { + list.add(item); + return this; +} + {{/if}} + {{/eq}} + {{/eq}} + {{/or}} + {{/eq}} + {{/eq}} + {{/eq}} +{{else}} + {{! no type defined }} + {{#if forDocs }} +| {{builderClass}} | add(Nothing? item) | +| {{builderClass}} | add(boolean item) | +| {{builderClass}} | add(String item) | +| {{builderClass}} | add(int item) | +| {{builderClass}} | add(float item) | +| {{builderClass}} | add(long item) | +| {{builderClass}} | add(double item) | +| {{builderClass}} | add(List item) | +| {{builderClass}} | add(Map item) | + {{else}} + +public {{builderClass}} add(Nothing? item) { + list.add(null); + return this; +} + +public {{builderClass}} add(boolean item) { + list.add(item); + return this; +} + +public {{builderClass}} add(String item) { + list.add(item); + return this; +} + +public {{builderClass}} add(int item) { + list.add(item); + return this; +} + +public {{builderClass}} add(float item) { + list.add(item); + return this; +} + +public {{builderClass}} add(long item) { + list.add(item); + return this; +} + +public {{builderClass}} add(double item) { + list.add(item); + return this; +} + +public {{builderClass}} add(List item) { + list.add(item); + return this; +} + +public {{builderClass}} add(Map item) { + list.add(item); + return this; +} + {{/if}} +{{/each}} +{{#with enumInfo}} + {{#each typeToValues }} + {{#eq @key "null"}} + {{#if forDocs }} + {{#if useContainer }} +| {{builderClass}} | add([{{../../containerJsonPathPiece.pascalCase}}.Null{{../jsonPathPiece.pascalCase}}]({{docRoot}}{{pathFromDocRoot}}.md#null{{../jsonPathPiece.kebabCase}}) item) | + {{else}} +| {{builderClass}} | add([Null{{../jsonPathPiece.pascalCase}}](#null{{../jsonPathPiece.kebabCase}}) item) | + {{/if}} + {{else}} + +public {{builderClass}} add({{#if useContainer}}{{../../containerJsonPathPiece.pascalCase}}.{{/if}}Null{{../jsonPathPiece.pascalCase}} item) { + list.add(null); + return this; +} + {{/if}} + {{else}} + {{#eq @key "boolean"}} + {{#if forDocs }} + {{#if useContainer }} +| {{builderClass}} | add([{{../../containerJsonPathPiece.pascalCase}}.Boolean{{../jsonPathPiece.pascalCase}}]({{docRoot}}{{pathFromDocRoot}}.md#boolean{{../jsonPathPiece.kebabCase}}) item) | + {{else}} +| {{builderClass}} | add([Boolean{{../jsonPathPiece.pascalCase}}](#boolean{{../jsonPathPiece.kebabCase}}) item) | + {{/if}} + {{else}} + +public {{builderClass}} add({{#if useContainer}}{{../../containerJsonPathPiece.pascalCase}}.{{/if}}Boolean{{../jsonPathPiece.pascalCase}} item) { + list.add(item.value()); + return this; +} + {{/if}} + {{else}} + {{#eq @key "string"}} + {{#if forDocs }} + {{#if useContainer }} +| {{builderClass}} | add([{{../../containerJsonPathPiece.pascalCase}}.String{{../jsonPathPiece.pascalCase}}]({{docRoot}}{{pathFromDocRoot}}.md#string{{../jsonPathPiece.kebabCase}}) item) | + {{else}} +| {{builderClass}} | add([String{{../jsonPathPiece.pascalCase}}](#string{{../jsonPathPiece.kebabCase}}) item) | + {{/if}} + {{else}} + +public {{builderClass}} add({{#if useContainer}}{{../../containerJsonPathPiece.pascalCase}}.{{/if}}String{{../jsonPathPiece.pascalCase}} item) { + list.add(item.value()); + return this; +} + {{/if}} + {{else}} + {{#eq @key "Integer"}} + {{#if forDocs }} + {{#if useContainer }} +| {{builderClass}} | add([{{../../containerJsonPathPiece.pascalCase}}.Integer{{../jsonPathPiece.pascalCase}}]({{docRoot}}{{pathFromDocRoot}}.md#integer{{../jsonPathPiece.kebabCase}}) item) | + {{else}} +| {{builderClass}} | add([Integer{{../jsonPathPiece.pascalCase}}](#integer{{../jsonPathPiece.kebabCase}}) item) | + {{/if}} + {{else}} + +public {{builderClass}} add({{#if useContainer}}{{../../containerJsonPathPiece.pascalCase}}.{{/if}}Integer{{../jsonPathPiece.pascalCase}} item) { + list.add(item.value()); + return this; +} + {{/if}} + {{else}} + {{#eq @key "Long"}} + {{#if forDocs }} + {{#if useContainer }} +| {{builderClass}} | add([{{../../containerJsonPathPiece.pascalCase}}.Long{{../jsonPathPiece.pascalCase}}]({{docRoot}}{{pathFromDocRoot}}.md#long{{../jsonPathPiece.kebabCase}}) item) | + {{else}} +| {{builderClass}} | add([Long{{../jsonPathPiece.pascalCase}}](#long{{../jsonPathPiece.kebabCase}}) item) | + {{/if}} + {{else}} + +public {{builderClass}} add({{#if useContainer}}{{../../containerJsonPathPiece.pascalCase}}.{{/if}}Long{{../jsonPathPiece.pascalCase}} item) { + list.add(item.value()); + return this; +} + {{/if}} + {{else}} + {{#eq @key "Float"}} + {{#if forDocs }} + {{#if useContainer }} +| {{builderClass}} | add([{{../../containerJsonPathPiece.pascalCase}}.Float{{../jsonPathPiece.pascalCase}}]({{docRoot}}{{pathFromDocRoot}}.md#float{{../jsonPathPiece.kebabCase}}) item) | + {{else}} +| {{builderClass}} | add([Float{{../jsonPathPiece.pascalCase}}](#float{{../jsonPathPiece.kebabCase}}) item) | + {{/if}} + {{else}} + +public {{builderClass}} add({{#if useContainer}}{{../../containerJsonPathPiece.pascalCase}}.{{/if}}Float{{../jsonPathPiece.pascalCase}} item) { + list.add(item.value()); + return this; +} + {{/if}} + {{else}} + {{#eq @key "Double"}} + {{#if forDocs }} + {{#if useContainer }} +| {{builderClass}} | add([{{../../containerJsonPathPiece.pascalCase}}.Double{{../jsonPathPiece.pascalCase}}]({{docRoot}}{{pathFromDocRoot}}.md#double{{../jsonPathPiece.kebabCase}}) item) | + {{else}} +| {{builderClass}} | add([Double{{../jsonPathPiece.pascalCase}}](#double{{../jsonPathPiece.kebabCase}}) item) | + {{/if}} + {{else}} + +public {{builderClass}} add({{#if useContainer}}{{../../containerJsonPathPiece.pascalCase}}.{{/if}}Double{{../jsonPathPiece.pascalCase}} item) { + list.add(item.value()); + return this; +} + {{/if}} + {{/eq}} + {{/eq}} + {{/eq}} + {{/eq}} + {{/eq}} + {{/eq}} + {{/eq}} + {{/each}} +{{/with}} diff --git a/src/main/resources/kotlin/src/main/kotlin/packagename/components/schemas/_arrayInputType.hbs b/src/main/resources/kotlin/src/main/kotlin/packagename/components/schemas/_arrayInputType.hbs new file mode 100644 index 00000000000..31e65f584bf --- /dev/null +++ b/src/main/resources/kotlin/src/main/kotlin/packagename/components/schemas/_arrayInputType.hbs @@ -0,0 +1,39 @@ +{{#if listItemSchema}} + +public static class {{arrayInputJsonPathPiece.pascalCase}} { + // class to build List<{{#with listItemSchema}}{{> src/main/kotlin/packagename/components/schemas/types/schema_input_type sourceJsonPath=../jsonPath forceNull=true noExtends=true }}{{/with}}> + private final List<{{#with listItemSchema}}{{> src/main/kotlin/packagename/components/schemas/types/schema_input_type sourceJsonPath=../jsonPath forceNull=true noExtends=true }}{{/with}}> list; + + public {{arrayInputJsonPathPiece.pascalCase}}() { + list = new ArrayList<>(); + } + + public {{arrayInputJsonPathPiece.pascalCase}}(List<{{#with listItemSchema}}{{> src/main/kotlin/packagename/components/schemas/types/schema_input_type sourceJsonPath=../jsonPath forceNull=true noExtends=true }}{{/with}}> list) { + this.list = list; + } + {{#with listItemSchema}} + {{#if refInfo }} + {{#if refInfo.refModule}} + {{#with getDeepestRef }} + {{> src/main/kotlin/packagename/components/schemas/_arrayInputAddItem builderClass=../../arrayInputJsonPathPiece.pascalCase useContainer=true }} + {{/with}} + {{else}} + {{! self reference} }} + + public {{../arrayInputJsonPathPiece.pascalCase}} add(List item) { + list.add(item); + return this; + } + {{/if}} + {{else}} + {{> src/main/kotlin/packagename/components/schemas/_arrayInputAddItem builderClass=../arrayInputJsonPathPiece.pascalCase }} + {{/if}} + {{else}} + {{! todo handle this, 3.1.0 document use-case }} + {{/with}} + + public List<{{#with listItemSchema}}{{> src/main/kotlin/packagename/components/schemas/types/schema_input_type sourceJsonPath=../jsonPath forceNull=true noExtends=true }}{{/with}}> build() { + return list; + } +} +{{/if}} diff --git a/src/main/resources/kotlin/src/main/kotlin/packagename/components/schemas/_arrayOutputType.hbs b/src/main/resources/kotlin/src/main/kotlin/packagename/components/schemas/_arrayOutputType.hbs new file mode 100644 index 00000000000..a86bf806e3d --- /dev/null +++ b/src/main/resources/kotlin/src/main/kotlin/packagename/components/schemas/_arrayOutputType.hbs @@ -0,0 +1,10 @@ + + +public static class {{arrayOutputJsonPathPiece.pascalCase}} extends FrozenList<{{#with listItemSchema}}{{> src/main/kotlin/packagename/components/schemas/types/schema_output_type fullRefModule="" forceNull=true }}{{/with}}> { + protected {{arrayOutputJsonPathPiece.pascalCase}}(FrozenList<{{#with listItemSchema}}{{> src/main/kotlin/packagename/components/schemas/types/schema_output_type fullRefModule="" forceNull=true }}{{/with}}> m) { + super(m); + } + public static {{arrayOutputJsonPathPiece.pascalCase}} of(List<{{#with listItemSchema}}{{> src/main/kotlin/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/kotlin/src/main/kotlin/packagename/components/schemas/_containerClassName.hbs b/src/main/resources/kotlin/src/main/kotlin/packagename/components/schemas/_containerClassName.hbs new file mode 100644 index 00000000000..1006563f098 --- /dev/null +++ b/src/main/resources/kotlin/src/main/kotlin/packagename/components/schemas/_containerClassName.hbs @@ -0,0 +1,98 @@ +{{#or isBooleanSchemaFalse isBooleanSchemaTrue}} + {{#if isBooleanSchemaTrue}} +{{containerJsonPathPiece.pascalCase}} extends AnyTypeJsonSchema + {{~else}} +{{containerJsonPathPiece.pascalCase}} extends NotAnyTypeJsonSchema + {{~/if}} +{{else}} + {{#eq types null }} + {{#if isSimpleAnyType }} +{{containerJsonPathPiece.pascalCase}} extends AnyTypeJsonSchema + {{~else}} +{{containerJsonPathPiece.pascalCase}} + {{~/if}} + {{else}} + {{! types exist }} + {{#eq types.size 1}} + {{! one type }} + {{#each types}} + {{#eq this "object"}} + {{#if isSimpleObject }} +{{containerJsonPathPiece.pascalCase}} extends MapJsonSchema + {{~else}} +{{containerJsonPathPiece.pascalCase}} + {{~/if}} + {{else}} + {{#eq this "array"}} + {{#if isSimpleArray }} +{{containerJsonPathPiece.pascalCase}} extends ListJsonSchema + {{~else}} +{{containerJsonPathPiece.pascalCase}} + {{~/if}} + {{else}} + {{#eq this "boolean"}} + {{#if isSimpleBoolean }} +{{containerJsonPathPiece.pascalCase}} extends BooleanJsonSchema + {{~else}} +{{containerJsonPathPiece.pascalCase}} + {{~/if}} + {{else}} + {{#or (eq this "number") (eq this "integer") }} + {{#or isSimpleInteger isSimpleNumber }} + {{#if isSimpleInteger}} + {{#eq ../format "int32"}} +{{containerJsonPathPiece.pascalCase}} extends Int32JsonSchema + {{~else}} + {{#eq ../format "int64"}} +{{containerJsonPathPiece.pascalCase}} extends Int64JsonSchema + {{~else}} +{{containerJsonPathPiece.pascalCase}} extends IntJsonSchema + {{~/eq}} + {{/eq}} + {{~else}} +{{containerJsonPathPiece.pascalCase}} extends NumberJsonSchema + {{~/if}} + {{else}} +{{containerJsonPathPiece.pascalCase}} + {{~/or}} + {{else}} + {{#eq this "string"}} + {{#if isSimpleString}} + {{#eq ../format "date"}} +{{containerJsonPathPiece.pascalCase}} extends DateJsonSchema + {{~else}} + {{#eq ../format "date-time"}} +{{containerJsonPathPiece.pascalCase}} extends DateTimeJsonSchema + {{~else}} + {{#eq ../format "number"}} +{{containerJsonPathPiece.pascalCase}} extends DecimalJsonSchema + {{~else}} + {{#eq ../format "uuid"}} +{{containerJsonPathPiece.pascalCase}} extends UuidJsonSchema + {{~else}} +{{containerJsonPathPiece.pascalCase}} extends StringJsonSchema + {{~/eq}} + {{/eq}} + {{/eq}} + {{/eq}} + {{else}} +{{containerJsonPathPiece.pascalCase}} + {{~/if}} + {{else}} + {{#if isSimpleNull }} +{{containerJsonPathPiece.pascalCase}} extends NullJsonSchema + {{~else}} +{{containerJsonPathPiece.pascalCase}} + {{~/if}} + {{/eq}} + {{/or}} + {{/eq}} + {{/eq}} + {{/eq}} + {{/each}} + {{else}} + {{! multiple types }} +{{containerJsonPathPiece.pascalCase}} + {{~/eq}} + {{/eq}} +{{/or}} \ No newline at end of file diff --git a/src/main/resources/kotlin/src/main/kotlin/packagename/components/schemas/_docschema_methodsInherited.hbs b/src/main/resources/kotlin/src/main/kotlin/packagename/components/schemas/_docschema_methodsInherited.hbs new file mode 100644 index 00000000000..33afe89e125 --- /dev/null +++ b/src/main/resources/kotlin/src/main/kotlin/packagename/components/schemas/_docschema_methodsInherited.hbs @@ -0,0 +1,104 @@ +{{#or isBooleanSchemaFalse isBooleanSchemaTrue}} + {{#if isBooleanSchemaTrue}} +{{> src/main/kotlin/packagename/components/schemas/_docschema_methodsInheritedFn className="AnyTypeJsonSchema.AnyTypeJsonSchema1" }} + {{else}} +{{> src/main/kotlin/packagename/components/schemas/_docschema_methodsInheritedFn className="NotAnyTypeJsonSchema.NotAnyTypeJsonSchema1" }} + {{/if}} +{{else}} + {{#eq types null }} + {{#and isSimpleAnyType (eq refInfo null) }} +{{> src/main/kotlin/packagename/components/schemas/_docschema_methodsInheritedFn className="AnyTypeJsonSchema.AnyTypeJsonSchema1" }} + {{/and}} + {{else}} + {{! types exist }} + {{#eq types.size 1}} + {{! one type }} + {{#each types}} + {{#eq this "object"}} + {{#and isSimpleObject (eq ../refInfo null) }} +{{> src/main/kotlin/packagename/components/schemas/_docschema_methodsInheritedFn className="MapJsonSchema.MapJsonSchema1" }} + {{/and}} + {{else}} + {{#eq this "array"}} + {{#and isSimpleArray (eq ../refInfo null) }} +{{> src/main/kotlin/packagename/components/schemas/_docschema_methodsInheritedFn className="ListJsonSchema.ListJsonSchema1" }} + {{/and}} + {{else}} + {{#eq this "boolean"}} + {{#and isSimpleBoolean (eq ../refInfo null) }} +{{> src/main/kotlin/packagename/components/schemas/_docschema_methodsInheritedFn className="BooleanJsonSchema.BooleanJsonSchema1" }} + {{/and}} + {{else}} + {{#eq this "integer" }} + {{#and isSimpleInteger (eq ../refInfo null) }} + {{#eq ../format null }} +{{> src/main/kotlin/packagename/components/schemas/_docschema_methodsInheritedFn className="IntJsonSchema.IntJsonSchema1" }} + {{/eq}} + {{#eq ../format "int" }} +{{> src/main/kotlin/packagename/components/schemas/_docschema_methodsInheritedFn className="IntJsonSchema.IntJsonSchema1" }} + {{/eq}} + {{#eq ../format "int32"}} +{{> src/main/kotlin/packagename/components/schemas/_docschema_methodsInheritedFn className="Int32JsonSchema.Int32JsonSchema1" }} + {{/eq}} + {{#eq ../format "int64"}} +{{> src/main/kotlin/packagename/components/schemas/_docschema_methodsInheritedFn className="Int64JsonSchema.Int64JsonSchema1" }} + {{/eq}} + {{/and}} + {{else}} + {{#eq this "number" }} + {{#and isSimpleNumber (eq ../refInfo null) }} + {{#eq ../format null}} +{{> src/main/kotlin/packagename/components/schemas/_docschema_methodsInheritedFn className="NumberJsonSchema.NumberJsonSchema1" }} + {{else}} + {{#eq ../format "float"}} +{{> src/main/kotlin/packagename/components/schemas/_docschema_methodsInheritedFn className="FloatJsonSchema.FloatJsonSchema1" }} + {{else}} + {{#eq ../format "double"}} +{{> src/main/kotlin/packagename/components/schemas/_docschema_methodsInheritedFn className="DoubleJsonSchema.DoubleJsonSchema1" }} + {{else}} + {{#eq ../format "int32"}} +{{> src/main/kotlin/packagename/components/schemas/_docschema_methodsInheritedFn className="Int32JsonSchema.Int32JsonSchema1" }} + {{else}} + {{#eq ../format "int64"}} +{{> src/main/kotlin/packagename/components/schemas/_docschema_methodsInheritedFn className="Int64JsonSchema.Int64JsonSchema1" }} + {{/eq}} + {{/eq}} + {{/eq}} + {{/eq}} + {{/eq}} + {{/and}} + {{else}} + {{#eq this "string"}} + {{#and isSimpleString (eq ../refInfo null) }} + {{#eq ../format null}} +{{> src/main/kotlin/packagename/components/schemas/_docschema_methodsInheritedFn className="StringJsonSchema.StringJsonSchema1" }} + {{/eq}} + {{#eq ../format "date"}} +{{> src/main/kotlin/packagename/components/schemas/_docschema_methodsInheritedFn className="DateJsonSchema.DateJsonSchema1" }} + {{/eq}} + {{#eq ../format "date-time"}} +{{> src/main/kotlin/packagename/components/schemas/_docschema_methodsInheritedFn className="DateTimeJsonSchema.DateTimeJsonSchema1" }} + {{/eq}} + {{#eq ../format "uuid"}} +{{> src/main/kotlin/packagename/components/schemas/_docschema_methodsInheritedFn className="UuidJsonSchema.UuidJsonSchema1" }} + {{/eq}} + {{#eq ../format "number"}} +{{> src/main/kotlin/packagename/components/schemas/_docschema_methodsInheritedFn className="DecimalJsonSchema.DecimalJsonSchema1" }} + {{/eq}} + {{/and}} + {{else}} + {{#and isSimpleNull (eq ../refInfo null) }} +{{> src/main/kotlin/packagename/components/schemas/_docschema_methodsInheritedFn className="NullJsonSchema.NullJsonSchema1" }} + {{/and}} + {{/eq}} + {{/eq}} + {{/eq}} + {{/eq}} + {{/eq}} + {{/eq}} + {{/each}} + {{else}} + {{! multiple types }} + {{/eq}} + {{/eq}} +{{/or}} \ No newline at end of file diff --git a/src/main/resources/kotlin/src/main/kotlin/packagename/components/schemas/_docschema_methodsInheritedFn b/src/main/resources/kotlin/src/main/kotlin/packagename/components/schemas/_docschema_methodsInheritedFn new file mode 100644 index 00000000000..5c630efde51 --- /dev/null +++ b/src/main/resources/kotlin/src/main/kotlin/packagename/components/schemas/_docschema_methodsInheritedFn @@ -0,0 +1,5 @@ + +| Methods Inherited from class {{packageName}}.schemas.{{className}} | +| ------------------------------------------------------------------ | +| validate | +| validateAndBox | diff --git a/src/main/resources/kotlin/src/main/kotlin/packagename/components/schemas/_enumTypes.hbs b/src/main/resources/kotlin/src/main/kotlin/packagename/components/schemas/_enumTypes.hbs new file mode 100644 index 00000000000..6132f888b79 --- /dev/null +++ b/src/main/resources/kotlin/src/main/kotlin/packagename/components/schemas/_enumTypes.hbs @@ -0,0 +1,138 @@ +{{#with enumInfo}} + {{#each typeToValues}} + + {{#eq @key "null"}} +public enum Null{{../jsonPathPiece.pascalCase}} implements NullValueMethod { + {{else}} + {{#eq @key "boolean"}} +public enum Boolean{{../jsonPathPiece.pascalCase}} implements BooleanValueMethod { + {{else}} + {{#eq @key "string"}} +public enum String{{../jsonPathPiece.pascalCase}} implements StringValueMethod { + {{else}} + {{#eq @key "Integer"}} +public enum Integer{{../jsonPathPiece.pascalCase}} implements IntegerValueMethod { + {{else}} + {{#eq @key "Long"}} +public enum Long{{../jsonPathPiece.pascalCase}} implements LongValueMethod { + {{else}} + {{#eq @key "Float"}} +public enum Float{{../jsonPathPiece.pascalCase}} implements FloatValueMethod { + {{else}} + {{#eq @key "Double"}} +public enum Double{{../jsonPathPiece.pascalCase}} implements DoubleValueMethod { + {{/eq}} + {{/eq}} + {{/eq}} + {{/eq}} + {{/eq}} + {{/eq}} + {{/eq}} + {{#each this}} + {{#eq ../@key "null"}} + {{this}}(null){{#unless @last}},{{else}};{{/unless}} + {{else}} + {{#eq ../@key "boolean"}} + {{this}}({{@key.value}}){{#unless @last}},{{else}};{{/unless}} + {{else}} + {{#eq ../@key "string"}} + {{this}}("{{{@key.value}}}"){{#unless @last}},{{else}};{{/unless}} + {{else}} + {{#eq ../@key "Integer"}} + {{this}}({{@key.value}}){{#unless @last}},{{else}};{{/unless}} + {{else}} + {{#eq ../@key "Long"}} + {{this}}({{@key.value}}L){{#unless @last}},{{else}};{{/unless}} + {{else}} + {{#eq ../@key "Float"}} + {{this}}({{@key.value}}f){{#unless @last}},{{else}};{{/unless}} + {{else}} + {{#eq ../@key "Double"}} + {{this}}({{@key.value}}d){{#unless @last}},{{else}};{{/unless}} + {{/eq}} + {{/eq}} + {{/eq}} + {{/eq}} + {{/eq}} + {{/eq}} + {{/eq}} + {{/each}} + {{#eq @key "null"}} + private final Nothing? value; + + Null{{../jsonPathPiece.pascalCase}}(Nothing? value) { + this.value = value; + } + public Nothing? value() { + return this.value; + } + {{else}} + {{#eq @key "boolean"}} + private final boolean value; + + Boolean{{../jsonPathPiece.pascalCase}}(boolean value) { + this.value = value; + } + public boolean value() { + return this.value; + } + {{else}} + {{#eq @key "string"}} + private final String value; + + String{{../jsonPathPiece.pascalCase}}(String value) { + this.value = value; + } + public String value() { + return this.value; + } + {{else}} + {{#eq @key "Integer"}} + private final int value; + + Integer{{../jsonPathPiece.pascalCase}}(int value) { + this.value = value; + } + public int value() { + return this.value; + } + {{else}} + {{#eq @key "Long"}} + private final long value; + + Long{{../jsonPathPiece.pascalCase}}(long value) { + this.value = value; + } + public long value() { + return this.value; + } + {{else}} + {{#eq @key "Float"}} + private final float value; + + Float{{../jsonPathPiece.pascalCase}}(float value) { + this.value = value; + } + public float value() { + return this.value; + } + {{else}} + {{#eq @key "Double"}} + private final double value; + + Double{{../jsonPathPiece.pascalCase}}(double value) { + this.value = value; + } + public double value() { + return this.value; + } + {{/eq}} + {{/eq}} + {{/eq}} + {{/eq}} + {{/eq}} + {{/eq}} + {{/eq}} +} + {{/each}} +{{/with}} \ No newline at end of file diff --git a/src/main/resources/kotlin/src/main/kotlin/packagename/components/schemas/_objectInputAddPropSetter.hbs b/src/main/resources/kotlin/src/main/kotlin/packagename/components/schemas/_objectInputAddPropSetter.hbs new file mode 100644 index 00000000000..33f0a4316a9 --- /dev/null +++ b/src/main/resources/kotlin/src/main/kotlin/packagename/components/schemas/_objectInputAddPropSetter.hbs @@ -0,0 +1,324 @@ +{{#if refInfo }} + {{#if refInfo.refModule}} + {{#with getDeepestRef }} +{{> src/main/kotlin/packagename/components/schemas/_objectInputAddPropSetter useContainer=true }} + {{/with}} + {{else}} + {{! self reference} }} + {{#with refInfo.ref }} +{{> src/main/kotlin/packagename/components/schemas/_objectInputAddPropSetter }} + {{/with}} + {{/if}} +{{else}} + {{#each types}} + {{#eq this "null"}} + {{#if forDocs }} +| [{{builderClass.pascalCase}}](#{{builderClass.kebabCase}}) | {{methodName}}(String key, Nothing? value) | + {{else}} + +default T {{methodName}}(String key, Nothing? value) throws InvalidAdditionalPropertyException { + MapUtils.throwIfKeyKnown(key, getKnownKeys(), true); + var instance = getInstance(); + instance.put(key, null); + return {{getBuilderMethod}}(instance); +} + {{/if}} + {{else}} + {{#eq this "boolean"}} + {{#if forDocs }} +| [{{builderClass.pascalCase}}](#{{builderClass.kebabCase}}) | {{methodName}}(String key, boolean value) | + {{else}} + +default T {{methodName}}(String key, boolean value) throws InvalidAdditionalPropertyException { + MapUtils.throwIfKeyKnown(key, getKnownKeys(), true); + var instance = getInstance(); + instance.put(key, value); + return {{getBuilderMethod}}(instance); +} + {{/if}} + {{else}} + {{#eq this "string"}} + {{#if forDocs }} +| [{{builderClass.pascalCase}}](#{{builderClass.kebabCase}}) | {{methodName}}(String key, String value) | + {{else}} + +default T {{methodName}}(String key, String value) throws InvalidAdditionalPropertyException { + MapUtils.throwIfKeyKnown(key, getKnownKeys(), true); + var instance = getInstance(); + instance.put(key, value); + return {{getBuilderMethod}}(instance); +} + {{/if}} + {{else}} + {{#or (eq this "integer") (eq this "number") }} + {{#if forDocs }} +| [{{builderClass.pascalCase}}](#{{builderClass.kebabCase}}) | {{methodName}}(String key, int value) | +| [{{builderClass.pascalCase}}](#{{builderClass.kebabCase}}) | {{methodName}}(String key, float value) | + {{#neq ../format "int32"}} +| [{{builderClass.pascalCase}}](#{{builderClass.kebabCase}}) | {{methodName}}(String key, long value) | +| [{{builderClass.pascalCase}}](#{{builderClass.kebabCase}}) | {{methodName}}(String key, double value) | + {{/neq}} + {{else}} + +default T {{methodName}}(String key, int value) throws InvalidAdditionalPropertyException { + MapUtils.throwIfKeyKnown(key, getKnownKeys(), true); + var instance = getInstance(); + instance.put(key, value); + return {{getBuilderMethod}}(instance); +} + +default T {{methodName}}(String key, float value) throws InvalidAdditionalPropertyException { + MapUtils.throwIfKeyKnown(key, getKnownKeys(), true); + var instance = getInstance(); + instance.put(key, value); + return {{getBuilderMethod}}(instance); +} + {{#neq ../format "int32"}} + +default T {{methodName}}(String key, long value) throws InvalidAdditionalPropertyException { + MapUtils.throwIfKeyKnown(key, getKnownKeys(), true); + var instance = getInstance(); + instance.put(key, value); + return {{getBuilderMethod}}(instance); +} + +default T {{methodName}}(String key, double value) throws InvalidAdditionalPropertyException { + MapUtils.throwIfKeyKnown(key, getKnownKeys(), true); + var instance = getInstance(); + instance.put(key, value); + return {{getBuilderMethod}}(instance); +} + {{/neq}} + {{/if}} + {{else}} + {{#eq this "array"}} + {{#if forDocs }} +| [{{builderClass.pascalCase}}](#{{builderClass.kebabCase}}) | {{methodName}}(String key, List<{{#with items}}{{> src/main/kotlin/packagename/components/schemas/types/schema_input_type sourceJsonPath=../jsonPath forceNull=true noExtends=true }}{{else}}@Nullable Object{{/with}}> value) | + {{else}} + +default T {{methodName}}(String key, List<{{#with items}}{{> src/main/kotlin/packagename/components/schemas/types/schema_input_type sourceJsonPath=../jsonPath forceNull=true noExtends=true }}{{else}}@Nullable Object{{/with}}> value) throws InvalidAdditionalPropertyException { + MapUtils.throwIfKeyKnown(key, getKnownKeys(), true); + var instance = getInstance(); + instance.put(key, value); + return {{getBuilderMethod}}(instance); +} + {{/if}} + {{else}} + {{#eq this "object"}} + {{#if forDocs }} +| [{{builderClass.pascalCase}}](#{{builderClass.kebabCase}}) | {{methodName}}(String key, Map src/main/kotlin/packagename/components/schemas/types/schema_input_type sourceJsonPath=../jsonPath forceNull=true noExtends=true }}{{else}}@Nullable Object{{/with}}> value) | + {{else}} + +default T {{methodName}}(String key, Map src/main/kotlin/packagename/components/schemas/types/schema_input_type sourceJsonPath=../jsonPath forceNull=true noExtends=true }}{{else}}@Nullable Object{{/with}}> value) throws InvalidAdditionalPropertyException { + MapUtils.throwIfKeyKnown(key, getKnownKeys(), true); + var instance = getInstance(); + instance.put(key, value); + return {{getBuilderMethod}}(instance); +} + {{/if}} + {{/eq}} + {{/eq}} + {{/or}} + {{/eq}} + {{/eq}} + {{/eq}} + {{else}} + {{! no type defined }} + {{#if forDocs }} +{{> src/main/kotlin/packagename/components/schemas/_objectInputAddPropUnsetSetterDocs }} + {{else}} + +default T {{methodName}}(String key, Nothing? value) throws InvalidAdditionalPropertyException { + MapUtils.throwIfKeyKnown(key, getKnownKeys(), true); + var instance = getInstance(); + instance.put(key, null); + return {{getBuilderMethod}}(instance); +} + +default T {{methodName}}(String key, boolean value) throws InvalidAdditionalPropertyException { + MapUtils.throwIfKeyKnown(key, getKnownKeys(), true); + var instance = getInstance(); + instance.put(key, value); + return {{getBuilderMethod}}(instance); +} + +default T {{methodName}}(String key, String value) throws InvalidAdditionalPropertyException { + MapUtils.throwIfKeyKnown(key, getKnownKeys(), true); + var instance = getInstance(); + instance.put(key, value); + return {{getBuilderMethod}}(instance); +} + +default T {{methodName}}(String key, int value) throws InvalidAdditionalPropertyException { + MapUtils.throwIfKeyKnown(key, getKnownKeys(), true); + var instance = getInstance(); + instance.put(key, value); + return {{getBuilderMethod}}(instance); +} + +default T {{methodName}}(String key, float value) throws InvalidAdditionalPropertyException { + MapUtils.throwIfKeyKnown(key, getKnownKeys(), true); + var instance = getInstance(); + instance.put(key, value); + return {{getBuilderMethod}}(instance); +} + +default T {{methodName}}(String key, long value) throws InvalidAdditionalPropertyException { + MapUtils.throwIfKeyKnown(key, getKnownKeys(), true); + var instance = getInstance(); + instance.put(key, value); + return {{getBuilderMethod}}(instance); +} + +default T {{methodName}}(String key, double value) throws InvalidAdditionalPropertyException { + MapUtils.throwIfKeyKnown(key, getKnownKeys(), true); + var instance = getInstance(); + instance.put(key, value); + return {{getBuilderMethod}}(instance); +} + +default T {{methodName}}(String key, List value) throws InvalidAdditionalPropertyException { + MapUtils.throwIfKeyKnown(key, getKnownKeys(), true); + var instance = getInstance(); + instance.put(key, value); + return {{getBuilderMethod}}(instance); +} + +default T {{methodName}}(String key, Map value) throws InvalidAdditionalPropertyException { + MapUtils.throwIfKeyKnown(key, getKnownKeys(), true); + var instance = getInstance(); + instance.put(key, value); + return {{getBuilderMethod}}(instance); +} + {{/if}} + {{/each}} + {{#with enumInfo}} + {{#each typeToValues }} + {{#eq @key "null"}} + {{#if forDocs }} + {{#if useContainer }} +| [{{builderClass.pascalCase}}](#{{builderClass.kebabCase}}) | {{methodName}}(String key, [{{../../containerJsonPathPiece.pascalCase}}.Null{{../jsonPathPiece.pascalCase}}]({{docRoot}}{{pathFromDocRoot}}.md#null{{../jsonPathPiece.kebabCase}}) value) | + {{else}} +| [{{builderClass.pascalCase}}](#{{builderClass.kebabCase}}) | {{methodName}}(String key, [Null{{../jsonPathPiece.pascalCase}}](#null{{../jsonPathPiece.kebabCase}}) value) | + {{/if}} + {{else}} + +default T {{methodName}}(String key, {{#if useContainer}}{{../../containerJsonPathPiece.pascalCase}}.{{/if}}Null{{../jsonPathPiece.pascalCase}} value) throws InvalidAdditionalPropertyException { + MapUtils.throwIfKeyKnown(key, getKnownKeys(), true); + var instance = getInstance(); + instance.put(key, null); + return {{getBuilderMethod}}(instance); +} + {{/if}} + {{else}} + {{#eq @key "boolean"}} + {{#if forDocs }} + {{#if useContainer }} +| [{{builderClass.pascalCase}}](#{{builderClass.kebabCase}}) | {{methodName}}(String key, [{{../../containerJsonPathPiece.pascalCase}}.Boolean{{../jsonPathPiece.pascalCase}}]({{docRoot}}{{pathFromDocRoot}}.md#boolean{{../jsonPathPiece.kebabCase}}) value) | + {{else}} +| [{{builderClass.pascalCase}}](#{{builderClass.kebabCase}}) | {{methodName}}(String key, [Boolean{{../jsonPathPiece.pascalCase}}](#boolean{{../jsonPathPiece.kebabCase}}) value) | + {{/if}} + {{else}} + +default T {{methodName}}(String key, {{#if useContainer}}{{../../containerJsonPathPiece.pascalCase}}.{{/if}}Boolean{{../jsonPathPiece.pascalCase}} value) throws InvalidAdditionalPropertyException { + MapUtils.throwIfKeyKnown(key, getKnownKeys(), true); + var instance = getInstance(); + instance.put(key, value.value()); + return {{getBuilderMethod}}(instance); +} + {{/if}} + {{else}} + {{#eq @key "string"}} + {{#if forDocs }} + {{#if useContainer }} +| [{{builderClass.pascalCase}}](#{{builderClass.kebabCase}}) | {{methodName}}(String key, [{{../../containerJsonPathPiece.pascalCase}}.String{{../jsonPathPiece.pascalCase}}]({{docRoot}}{{pathFromDocRoot}}.md#string{{../jsonPathPiece.kebabCase}}) value) | + {{else}} +| [{{builderClass.pascalCase}}](#{{builderClass.kebabCase}}) | {{methodName}}(String key, [String{{../jsonPathPiece.pascalCase}}](#string{{../jsonPathPiece.kebabCase}}) value) | + {{/if}} + {{else}} + +default T {{methodName}}(String key, {{#if useContainer}}{{../../containerJsonPathPiece.pascalCase}}.{{/if}}String{{../jsonPathPiece.pascalCase}} value) throws InvalidAdditionalPropertyException { + MapUtils.throwIfKeyKnown(key, getKnownKeys(), true); + var instance = getInstance(); + instance.put(key, value.value()); + return {{getBuilderMethod}}(instance); +} + {{/if}} + {{else}} + {{#eq @key "Integer"}} + {{#if forDocs }} + {{#if useContainer }} +| [{{builderClass.pascalCase}}](#{{builderClass.kebabCase}}) | {{methodName}}(String key, [{{../../containerJsonPathPiece.pascalCase}}.Integer{{../jsonPathPiece.pascalCase}}]({{docRoot}}{{pathFromDocRoot}}.md#integer{{../jsonPathPiece.kebabCase}}) value) | + {{else}} +| [{{builderClass.pascalCase}}](#{{builderClass.kebabCase}}) | {{methodName}}(String key, [Integer{{../jsonPathPiece.pascalCase}}](#integer{{../jsonPathPiece.kebabCase}}) value) | + {{/if}} + {{else}} + +default T {{methodName}}(String key, {{#if useContainer}}{{../../containerJsonPathPiece.pascalCase}}.{{/if}}Integer{{../jsonPathPiece.pascalCase}} value) throws InvalidAdditionalPropertyException { + MapUtils.throwIfKeyKnown(key, getKnownKeys(), true); + var instance = getInstance(); + instance.put(key, value.value()); + return {{getBuilderMethod}}(instance); +} + {{/if}} + {{else}} + {{#eq @key "Long"}} + {{#if forDocs }} + {{#if useContainer }} +| [{{builderClass.pascalCase}}](#{{builderClass.kebabCase}}) | {{methodName}}(String key, [{{../../containerJsonPathPiece.pascalCase}}.Long{{../jsonPathPiece.pascalCase}}]({{docRoot}}{{pathFromDocRoot}}.md#long{{../jsonPathPiece.kebabCase}}) value) | + {{else}} +| [{{builderClass.pascalCase}}](#{{builderClass.kebabCase}}) | {{methodName}}(String key, [Long{{../jsonPathPiece.pascalCase}}](#long{{../jsonPathPiece.kebabCase}}) value) | + {{/if}} + {{else}} + +default T {{methodName}}(String key, {{#if useContainer}}{{../../containerJsonPathPiece.pascalCase}}.{{/if}}Long{{../jsonPathPiece.pascalCase}} value) throws InvalidAdditionalPropertyException { + MapUtils.throwIfKeyKnown(key, getKnownKeys(), true); + var instance = getInstance(); + instance.put(key, value.value()); + return {{getBuilderMethod}}(instance); +} + {{/if}} + {{else}} + {{#eq @key "Float"}} + {{#if forDocs }} + {{#if useContainer }} +| [{{builderClass.pascalCase}}](#{{builderClass.kebabCase}}) | {{methodName}}(String key, [{{../../containerJsonPathPiece.pascalCase}}.Float{{../jsonPathPiece.pascalCase}}]({{docRoot}}{{pathFromDocRoot}}.md#float{{../jsonPathPiece.kebabCase}}) value) | + {{else}} +| [{{builderClass.pascalCase}}](#{{builderClass.kebabCase}}) | {{methodName}}(String key, [Float{{../jsonPathPiece.pascalCase}}](#float{{../jsonPathPiece.kebabCase}}) value) | + {{/if}} + {{else}} + +default T {{methodName}}(String key, {{#if useContainer}}{{../../containerJsonPathPiece.pascalCase}}.{{/if}}Float{{../jsonPathPiece.pascalCase}} value) throws InvalidAdditionalPropertyException { + MapUtils.throwIfKeyKnown(key, getKnownKeys(), true); + var instance = getInstance(); + instance.put(key, value.value()); + return {{getBuilderMethod}}(instance); +} + {{/if}} + {{else}} + {{#eq @key "Double"}} + {{#if forDocs }} + {{#if useContainer }} +| [{{builderClass.pascalCase}}](#{{builderClass.kebabCase}}) | {{methodName}}(String key, [{{../../containerJsonPathPiece.pascalCase}}.Double{{../jsonPathPiece.pascalCase}}]({{docRoot}}{{pathFromDocRoot}}.md#double{{../jsonPathPiece.kebabCase}}) value) | + {{else}} +| [{{builderClass.pascalCase}}](#{{builderClass.kebabCase}}) | {{methodName}}(String key, [Double{{../jsonPathPiece.pascalCase}}](#double{{../jsonPathPiece.kebabCase}}) value) | + {{/if}} + {{else}} + +default T {{methodName}}(String key, {{#if useContainer}}{{../../containerJsonPathPiece.pascalCase}}.{{/if}}Double{{../jsonPathPiece.pascalCase}} value) throws InvalidAdditionalPropertyException { + MapUtils.throwIfKeyKnown(key, getKnownKeys(), true); + var instance = getInstance(); + instance.put(key, value.value()); + return {{getBuilderMethod}}(instance); +} + {{/if}} + {{/eq}} + {{/eq}} + {{/eq}} + {{/eq}} + {{/eq}} + {{/eq}} + {{/eq}} + {{/each}} + {{/with}} +{{/if}} \ No newline at end of file diff --git a/src/main/resources/kotlin/src/main/kotlin/packagename/components/schemas/_objectInputAddPropUnsetSetterDocs.hbs b/src/main/resources/kotlin/src/main/kotlin/packagename/components/schemas/_objectInputAddPropUnsetSetterDocs.hbs new file mode 100644 index 00000000000..b46a8d52f51 --- /dev/null +++ b/src/main/resources/kotlin/src/main/kotlin/packagename/components/schemas/_objectInputAddPropUnsetSetterDocs.hbs @@ -0,0 +1,9 @@ +| [{{builderClass.pascalCase}}](#{{builderClass.kebabCase}}) | {{methodName}}(String key, Nothing? value) | +| [{{builderClass.pascalCase}}](#{{builderClass.kebabCase}}) | {{methodName}}(String key, boolean value) | +| [{{builderClass.pascalCase}}](#{{builderClass.kebabCase}}) | {{methodName}}(String key, String value) | +| [{{builderClass.pascalCase}}](#{{builderClass.kebabCase}}) | {{methodName}}(String key, int value) | +| [{{builderClass.pascalCase}}](#{{builderClass.kebabCase}}) | {{methodName}}(String key, float value) | +| [{{builderClass.pascalCase}}](#{{builderClass.kebabCase}}) | {{methodName}}(String key, long value) | +| [{{builderClass.pascalCase}}](#{{builderClass.kebabCase}}) | {{methodName}}(String key, double value) | +| [{{builderClass.pascalCase}}](#{{builderClass.kebabCase}}) | {{methodName}}(String key, List value) | +| [{{builderClass.pascalCase}}](#{{builderClass.kebabCase}}) | {{methodName}}(String key, Map value) | diff --git a/src/main/resources/kotlin/src/main/kotlin/packagename/components/schemas/_objectInputSetter.hbs b/src/main/resources/kotlin/src/main/kotlin/packagename/components/schemas/_objectInputSetter.hbs new file mode 100644 index 00000000000..0f5c229429a --- /dev/null +++ b/src/main/resources/kotlin/src/main/kotlin/packagename/components/schemas/_objectInputSetter.hbs @@ -0,0 +1,307 @@ +{{#if refInfo }} + {{#if refInfo.refModule}} + {{#with getDeepestRef }} +{{> src/main/kotlin/packagename/components/schemas/_objectInputSetter useContainer=true }} + {{/with}} + {{else}} + {{! self reference} }} + {{#with refInfo.ref }} +{{> src/main/kotlin/packagename/components/schemas/_objectInputSetter }} + {{/with}} + {{/if}} +{{else}} + {{#each types}} + {{#eq this "null"}} + {{#if forDocs }} +| [{{builderClass.pascalCase}}](#{{builderClass.kebabCase}}) | {{methodName}}(Nothing? value) | + {{else}} + +default T {{methodName}}(Nothing? value) { + var instance = getInstance(); + instance.put("{{{key}}}", null); + return {{getBuilderMethod}}(instance); +} + {{/if}} + {{else}} + {{#eq this "boolean"}} + {{#if forDocs }} +| [{{builderClass.pascalCase}}](#{{builderClass.kebabCase}}) | {{methodName}}(boolean value) | + {{else}} + +default T {{methodName}}(boolean value) { + var instance = getInstance(); + instance.put("{{{key}}}", value); + return {{getBuilderMethod}}(instance); +} + {{/if}} + {{else}} + {{#eq this "string"}} + {{#if forDocs }} +| [{{builderClass.pascalCase}}](#{{builderClass.kebabCase}}) | {{methodName}}(String value) | + {{else}} + +default T {{methodName}}(String value) { + var instance = getInstance(); + instance.put("{{{key}}}", value); + return {{getBuilderMethod}}(instance); +} + {{/if}} + {{else}} + {{#or (eq this "integer") (eq this "number") }} + {{#if forDocs }} +| [{{builderClass.pascalCase}}](#{{builderClass.kebabCase}}) | {{methodName}}(int value) | +| [{{builderClass.pascalCase}}](#{{builderClass.kebabCase}}) | {{methodName}}(float value) | + {{#neq ../format "int32"}} +| [{{builderClass.pascalCase}}](#{{builderClass.kebabCase}}) | {{methodName}}(long value) | +| [{{builderClass.pascalCase}}](#{{builderClass.kebabCase}}) | {{methodName}}(double value) | + {{/neq}} + {{else}} + +default T {{methodName}}(int value) { + var instance = getInstance(); + instance.put("{{{key}}}", value); + return {{getBuilderMethod}}(instance); +} + +default T {{methodName}}(float value) { + var instance = getInstance(); + instance.put("{{{key}}}", value); + return {{getBuilderMethod}}(instance); +} + {{#neq ../format "int32"}} + +default T {{methodName}}(long value) { + var instance = getInstance(); + instance.put("{{{key}}}", value); + return {{getBuilderMethod}}(instance); +} + +default T {{methodName}}(double value) { + var instance = getInstance(); + instance.put("{{{key}}}", value); + return {{getBuilderMethod}}(instance); +} + {{/neq}} + {{/if}} + {{else}} + {{#eq this "array"}} + {{#if forDocs }} +| [{{builderClass.pascalCase}}](#{{builderClass.kebabCase}}) | {{methodName}}(List<{{#with items}}{{> src/main/kotlin/packagename/components/schemas/types/schema_input_type sourceJsonPath=../jsonPath forceNull=true noExtends=true }}{{else}}@Nullable Object{{/with}}> value) | + {{else}} + +default T {{methodName}}(List<{{#with items}}{{> src/main/kotlin/packagename/components/schemas/types/schema_input_type sourceJsonPath=../jsonPath forceNull=true noExtends=true }}{{else}}@Nullable Object{{/with}}> value) { + var instance = getInstance(); + instance.put("{{{key}}}", value); + return {{getBuilderMethod}}(instance); +} + {{/if}} + {{else}} + {{#eq this "object"}} + {{#if forDocs }} +| [{{builderClass.pascalCase}}](#{{builderClass.kebabCase}}) | {{methodName}}(Map src/main/kotlin/packagename/components/schemas/types/schema_input_type sourceJsonPath=../jsonPath forceNull=true noExtends=true }}{{else}}@Nullable Object{{/with}}> value) | + {{else}} + +default T {{methodName}}(Map src/main/kotlin/packagename/components/schemas/types/schema_input_type sourceJsonPath=../jsonPath forceNull=true noExtends=true }}{{else}}@Nullable Object{{/with}}> value) { + var instance = getInstance(); + instance.put("{{{key}}}", value); + return {{getBuilderMethod}}(instance); +} + {{/if}} + {{/eq}} + {{/eq}} + {{/or}} + {{/eq}} + {{/eq}} + {{/eq}} + {{else}} + {{! no type defined }} + {{#if forDocs }} +| [{{builderClass.pascalCase}}](#{{builderClass.kebabCase}}) | {{methodName}}(Nothing? value) | +| [{{builderClass.pascalCase}}](#{{builderClass.kebabCase}}) | {{methodName}}(boolean value) | +| [{{builderClass.pascalCase}}](#{{builderClass.kebabCase}}) | {{methodName}}(String value) | +| [{{builderClass.pascalCase}}](#{{builderClass.kebabCase}}) | {{methodName}}(int value) | +| [{{builderClass.pascalCase}}](#{{builderClass.kebabCase}}) | {{methodName}}(float value) | +| [{{builderClass.pascalCase}}](#{{builderClass.kebabCase}}) | {{methodName}}(long value) | +| [{{builderClass.pascalCase}}](#{{builderClass.kebabCase}}) | {{methodName}}(double value) | +| [{{builderClass.pascalCase}}](#{{builderClass.kebabCase}}) | {{methodName}}(List value) | +| [{{builderClass.pascalCase}}](#{{builderClass.kebabCase}}) | {{methodName}}(Map value) | + {{else}} + +default T {{methodName}}(Nothing? value) { + var instance = getInstance(); + instance.put("{{{key}}}", null); + return {{getBuilderMethod}}(instance); +} + +default T {{methodName}}(boolean value) { + var instance = getInstance(); + instance.put("{{{key}}}", value); + return {{getBuilderMethod}}(instance); +} + +default T {{methodName}}(String value) { + var instance = getInstance(); + instance.put("{{{key}}}", value); + return {{getBuilderMethod}}(instance); +} + +default T {{methodName}}(int value) { + var instance = getInstance(); + instance.put("{{{key}}}", value); + return {{getBuilderMethod}}(instance); +} + +default T {{methodName}}(float value) { + var instance = getInstance(); + instance.put("{{{key}}}", value); + return {{getBuilderMethod}}(instance); +} + +default T {{methodName}}(long value) { + var instance = getInstance(); + instance.put("{{{key}}}", value); + return {{getBuilderMethod}}(instance); +} + +default T {{methodName}}(double value) { + var instance = getInstance(); + instance.put("{{{key}}}", value); + return {{getBuilderMethod}}(instance); +} + +default T {{methodName}}(List value) { + var instance = getInstance(); + instance.put("{{{key}}}", value); + return {{getBuilderMethod}}(instance); +} + +default T {{methodName}}(Map value) { + var instance = getInstance(); + instance.put("{{{key}}}", value); + return {{getBuilderMethod}}(instance); +} + {{/if}} + {{/each}} + {{#with enumInfo}} + {{#each typeToValues }} + {{#eq @key "null"}} + {{#if forDocs }} + {{#if useContainer }} +| [{{builderClass.pascalCase}}](#{{builderClass.kebabCase}}) | {{methodName}}([{{../../containerJsonPathPiece.pascalCase}}.Null{{../jsonPathPiece.pascalCase}}]({{docRoot}}{{pathFromDocRoot}}.md#null{{../jsonPathPiece.kebabCase}}) value) | + {{else}} +| [{{builderClass.pascalCase}}](#{{builderClass.kebabCase}}) | {{methodName}}([Null{{../jsonPathPiece.pascalCase}}](#null{{../jsonPathPiece.kebabCase}}) value) | + {{/if}} + {{else}} + +default T {{methodName}}({{#if useContainer}}{{../../containerJsonPathPiece.pascalCase}}.{{/if}}Null{{../jsonPathPiece.pascalCase}} value) { + var instance = getInstance(); + instance.put("{{{key}}}", null); + return {{getBuilderMethod}}(instance); +} + {{/if}} + {{else}} + {{#eq @key "boolean"}} + {{#if forDocs }} + {{#if useContainer }} +| [{{builderClass.pascalCase}}](#{{builderClass.kebabCase}}) | {{methodName}}([{{../../containerJsonPathPiece.pascalCase}}.Boolean{{../jsonPathPiece.pascalCase}}]({{docRoot}}{{pathFromDocRoot}}.md#boolean{{../jsonPathPiece.kebabCase}}) value) | + {{else}} +| [{{builderClass.pascalCase}}](#{{builderClass.kebabCase}}) | {{methodName}}([Boolean{{../jsonPathPiece.pascalCase}}](#boolean{{../jsonPathPiece.kebabCase}}) value) | + {{/if}} + {{else}} + +default T {{methodName}}({{#if useContainer}}{{../../containerJsonPathPiece.pascalCase}}.{{/if}}Boolean{{../jsonPathPiece.pascalCase}} value) { + var instance = getInstance(); + instance.put("{{{key}}}", value.value()); + return {{getBuilderMethod}}(instance); +} + {{/if}} + {{else}} + {{#eq @key "string"}} + {{#if forDocs }} + {{#if useContainer }} +| [{{builderClass.pascalCase}}](#{{builderClass.kebabCase}}) | {{methodName}}([{{../../containerJsonPathPiece.pascalCase}}.String{{../jsonPathPiece.pascalCase}}]({{docRoot}}{{pathFromDocRoot}}.md#string{{../jsonPathPiece.kebabCase}}) value) | + {{else}} +| [{{builderClass.pascalCase}}](#{{builderClass.kebabCase}}) | {{methodName}}([String{{../jsonPathPiece.pascalCase}}](#string{{../jsonPathPiece.kebabCase}}) value) | + {{/if}} + {{else}} + +default T {{methodName}}({{#if useContainer}}{{../../containerJsonPathPiece.pascalCase}}.{{/if}}String{{../jsonPathPiece.pascalCase}} value) { + var instance = getInstance(); + instance.put("{{{key}}}", value.value()); + return {{getBuilderMethod}}(instance); +} + {{/if}} + {{else}} + {{#eq @key "Integer"}} + {{#if forDocs }} + {{#if useContainer }} +| [{{builderClass.pascalCase}}](#{{builderClass.kebabCase}}) | {{methodName}}([{{../../containerJsonPathPiece.pascalCase}}.Integer{{../jsonPathPiece.pascalCase}}]({{docRoot}}{{pathFromDocRoot}}.md#integer{{../jsonPathPiece.kebabCase}}) value) | + {{else}} +| [{{builderClass.pascalCase}}](#{{builderClass.kebabCase}}) | {{methodName}}([Integer{{../jsonPathPiece.pascalCase}}](#integer{{../jsonPathPiece.kebabCase}}) value) | + {{/if}} + {{else}} + +default T {{methodName}}({{#if useContainer}}{{../../containerJsonPathPiece.pascalCase}}.{{/if}}Integer{{../jsonPathPiece.pascalCase}} value) { + var instance = getInstance(); + instance.put("{{{key}}}", value.value()); + return {{getBuilderMethod}}(instance); +} + {{/if}} + {{else}} + {{#eq @key "Long"}} + {{#if forDocs }} + {{#if useContainer }} +| [{{builderClass.pascalCase}}](#{{builderClass.kebabCase}}) | {{methodName}}([{{../../containerJsonPathPiece.pascalCase}}.Long{{../jsonPathPiece.pascalCase}}]({{docRoot}}{{pathFromDocRoot}}.md#long{{../jsonPathPiece.kebabCase}}) value) | + {{else}} +| [{{builderClass.pascalCase}}](#{{builderClass.kebabCase}}) | {{methodName}}([Long{{../jsonPathPiece.pascalCase}}](#long{{../jsonPathPiece.kebabCase}}) value) | + {{/if}} + {{else}} + +default T {{methodName}}({{#if useContainer}}{{../../containerJsonPathPiece.pascalCase}}.{{/if}}Long{{../jsonPathPiece.pascalCase}} value) { + var instance = getInstance(); + instance.put("{{{key}}}", value.value()); + return {{getBuilderMethod}}(instance); +} + {{/if}} + {{else}} + {{#eq @key "Float"}} + {{#if forDocs }} + {{#if useContainer }} +| [{{builderClass.pascalCase}}](#{{builderClass.kebabCase}}) | {{methodName}}([{{../../containerJsonPathPiece.pascalCase}}.Float{{../jsonPathPiece.pascalCase}}]({{docRoot}}{{pathFromDocRoot}}.md#float{{../jsonPathPiece.kebabCase}}) value) | + {{else}} +| [{{builderClass.pascalCase}}](#{{builderClass.kebabCase}}) | {{methodName}}([Float{{../jsonPathPiece.pascalCase}}](#float{{../jsonPathPiece.kebabCase}}) value) | + {{/if}} + {{else}} + +default T {{methodName}}({{#if useContainer}}{{../../containerJsonPathPiece.pascalCase}}.{{/if}}Float{{../jsonPathPiece.pascalCase}} value) { + var instance = getInstance(); + instance.put("{{{key}}}", value.value()); + return {{getBuilderMethod}}(instance); +} + {{/if}} + {{else}} + {{#eq @key "Double"}} + {{#if forDocs }} + {{#if useContainer }} +| [{{builderClass.pascalCase}}](#{{builderClass.kebabCase}}) | {{methodName}}([{{../../containerJsonPathPiece.pascalCase}}.Double{{../jsonPathPiece.pascalCase}}]({{docRoot}}{{pathFromDocRoot}}.md#double{{../jsonPathPiece.kebabCase}}) value) | + {{else}} +| [{{builderClass.pascalCase}}](#{{builderClass.kebabCase}}) | {{methodName}}([Double{{../jsonPathPiece.pascalCase}}](#double{{../jsonPathPiece.kebabCase}}) value) | + {{/if}} + {{else}} + +default T {{methodName}}({{#if useContainer}}{{../../containerJsonPathPiece.pascalCase}}.{{/if}}Double{{../jsonPathPiece.pascalCase}} value) { + var instance = getInstance(); + instance.put("{{{key}}}", value.value()); + return {{getBuilderMethod}}(instance); +} + {{/if}} + {{/eq}} + {{/eq}} + {{/eq}} + {{/eq}} + {{/eq}} + {{/eq}} + {{/eq}} + {{/each}} + {{/with}} +{{/if}} \ No newline at end of file diff --git a/src/main/resources/kotlin/src/main/kotlin/packagename/components/schemas/_objectInputType.hbs b/src/main/resources/kotlin/src/main/kotlin/packagename/components/schemas/_objectInputType.hbs new file mode 100644 index 00000000000..2153d9f6596 --- /dev/null +++ b/src/main/resources/kotlin/src/main/kotlin/packagename/components/schemas/_objectInputType.hbs @@ -0,0 +1,108 @@ +{{#each requiredProperties}} + +public interface SetterFor{{@key.pascalCase}} { + Map src/main/kotlin/packagename/components/schemas/types/schema_input_type sourceJsonPath=../../jsonPath forceNull=true noExtends=true }}{{else}}@Nullable Object{{/with}}> getInstance(); + T getBuilderAfter{{@key.pascalCase}}(Map src/main/kotlin/packagename/components/schemas/types/schema_input_type sourceJsonPath=../../jsonPath forceNull=true noExtends=true }}{{else}}@Nullable Object{{/with}}> instance); + {{#if @key.isValid}} + {{> src/main/kotlin/packagename/components/schemas/_objectInputSetter methodName=@key.original getBuilderMethod=(join "getBuilderAfter" @key.pascalCase "") key=@key.original }} + {{else}} + {{> src/main/kotlin/packagename/components/schemas/_objectInputSetter methodName=@key.camelCase getBuilderMethod=(join "getBuilderAfter" @key.pascalCase "") key=@key.original }} + {{/if}} +} +{{/each}} +{{#each optionalProperties}} + +public interface SetterFor{{@key.pascalCase}} { + Map src/main/kotlin/packagename/components/schemas/types/schema_input_type sourceJsonPath=../../jsonPath forceNull=true noExtends=true }}{{else}}@Nullable Object{{/with}}> getInstance(); + T getBuilderAfter{{@key.pascalCase}}(Map src/main/kotlin/packagename/components/schemas/types/schema_input_type sourceJsonPath=../../jsonPath forceNull=true noExtends=true }}{{else}}@Nullable Object{{/with}}> instance); + {{#if @key.isValid}} + {{> src/main/kotlin/packagename/components/schemas/_objectInputSetter methodName=@key.original getBuilderMethod=(join "getBuilderAfter" @key.pascalCase "") key=@key.original }} + {{else}} + {{> src/main/kotlin/packagename/components/schemas/_objectInputSetter methodName=@key.camelCase getBuilderMethod=(join "getBuilderAfter" @key.pascalCase "") key=@key.original }} + {{/if}} +} +{{/each}} +{{#with additionalProperties }} + {{#eq isBooleanSchemaFalse false}} + +public interface SetterFor{{jsonPathPiece.pascalCase}} { + Set getKnownKeys(); + Map src/main/kotlin/packagename/components/schemas/types/schema_input_type sourceJsonPath=../../jsonPath forceNull=true noExtends=true }}{{else}}@Nullable Object{{/with}}> getInstance(); + T getBuilderAfterAdditionalProperty(Map src/main/kotlin/packagename/components/schemas/types/schema_input_type sourceJsonPath=../../jsonPath forceNull=true noExtends=true }}{{else}}@Nullable Object{{/with}}> instance); + {{> src/main/kotlin/packagename/components/schemas/_objectInputAddPropSetter methodName="additionalProperty" getBuilderMethod="getBuilderAfterAdditionalProperty" }} +} + {{/eq}} +{{/with}} +{{#each mapBuilders}} + +public static class {{className.pascalCase}}{{#and @first (eq ../additionalProperties null) }} extends UnsetAddPropsSetter<{{className.pascalCase}}>{{/and}} implements {{#if @first}}GenericBuilder src/main/kotlin/packagename/components/schemas/types/schema_input_type sourceJsonPath=../../jsonPath forceNull=true noExtends=true }}{{else}}@Nullable Object{{/with}}>>{{#if ../optionalProperties}}, {{/if}}{{/if}}{{#each keyToBuilder}}SetterFor{{@key.pascalCase}}<{{builder.className.pascalCase}}>{{#unless @last}}, {{/unless}}{{/each}}{{#and @first ../additionalProperties (eq ../additionalProperties.isBooleanSchemaFalse false) }}, SetterFor{{../additionalProperties.jsonPathPiece.pascalCase}}<{{className.pascalCase}}>{{/and}} { + private final Map src/main/kotlin/packagename/components/schemas/types/schema_input_type sourceJsonPath=../../jsonPath forceNull=true noExtends=true }}{{else}}@Nullable Object{{/with}}> instance; + {{#if @first}} + {{#and (eq ../requiredProperties null) (eq ../optionalProperties null) }} + private static final Set knownKeys = Set.of(); + {{else}} + {{#eq ../optionalProperties null }} + private static final Set knownKeys = Set.of( + {{#each ../requiredProperties}} + "{{{@key.original}}}"{{#unless @last}},{{/unless}} + {{/each}} + ); + {{else}} + {{#eq ../requiredProperties null }} + private static final Set knownKeys = Set.of( + {{#each ../optionalProperties}} + "{{{@key.original}}}"{{#unless @last}},{{/unless}} + {{/each}} + ); + {{else}} + private static final Set knownKeys = Set.of( + {{#each ../requiredProperties}} + "{{{@key.original}}}", + {{/each}} + {{#each ../optionalProperties}} + "{{{@key.original}}}"{{#unless @last}},{{/unless}} + {{/each}} + ); + {{/eq}} + {{/eq}} + {{/and}} + public Set getKnownKeys() { + return knownKeys; + } + {{/if}} + {{#if @last }} + public {{className.pascalCase}}() { + this.instance = new LinkedHashMap<>(); + } + {{else}} + public {{className.pascalCase}}(Map src/main/kotlin/packagename/components/schemas/types/schema_input_type sourceJsonPath=../../jsonPath forceNull=true noExtends=true }}{{else}}@Nullable Object{{/with}}> instance) { + this.instance = instance; + } + {{/if}} + {{#if @first}} + public Map src/main/kotlin/packagename/components/schemas/types/schema_input_type sourceJsonPath=../../jsonPath forceNull=true noExtends=true }}{{else}}@Nullable Object{{/with}}> build() { + return instance; + } + {{/if}} + {{#or (eq keyToBuilder.isEmpty false) (and @first ../additionalProperties (eq ../additionalProperties.isBooleanSchemaFalse false)) (and @first (eq ../additionalProperties null)) }} + public Map src/main/kotlin/packagename/components/schemas/types/schema_input_type sourceJsonPath=../../jsonPath forceNull=true noExtends=true }}{{else}}@Nullable Object{{/with}}> getInstance() { + return instance; + } + {{/or}} + {{#each keyToBuilder}} + public {{builder.className.pascalCase}} getBuilderAfter{{@key.pascalCase}}(Map src/main/kotlin/packagename/components/schemas/types/schema_input_type sourceJsonPath=../../jsonPath forceNull=true noExtends=true }}{{else}}@Nullable Object{{/with}}> instance) { + {{#eq builder ../this}} + {{! property in final builder }} + return this; + {{else}} + return new {{builder.className.pascalCase}}(instance); + {{/eq}} + } + {{/each}} + {{#and @first (or (and ../additionalProperties (eq ../additionalProperties.isBooleanSchemaFalse false)) (eq ../additionalProperties null)) }} + public {{className.pascalCase}} getBuilderAfterAdditionalProperty(Map src/main/kotlin/packagename/components/schemas/types/schema_input_type sourceJsonPath=../../jsonPath forceNull=true noExtends=true }}{{else}}@Nullable Object{{/with}}> instance) { + return this; + } + {{/and}} +} +{{/each}} \ No newline at end of file diff --git a/src/main/resources/kotlin/src/main/kotlin/packagename/components/schemas/_objectOutputGetProperty.hbs b/src/main/resources/kotlin/src/main/kotlin/packagename/components/schemas/_objectOutputGetProperty.hbs new file mode 100644 index 00000000000..458364ccdb3 --- /dev/null +++ b/src/main/resources/kotlin/src/main/kotlin/packagename/components/schemas/_objectOutputGetProperty.hbs @@ -0,0 +1,31 @@ +{{#if required}} + {{#and ../../mapValueSchema (eq typeSchema ../../mapValueSchema.typeSchema) }} + {{#contains ../../mapValueSchema "null"}} +return get("{{{@key.original}}}"); + {{else}} +try { + return getOrThrow("version"); +} catch (UnsetPropertyException e) { + throw new RuntimeException(e); +} + {{/contains}} + {{else}} +{{#with ../../mapValueSchema}}{{> src/main/kotlin/packagename/components/schemas/types/schema_output_type fullRefModule="" }}{{/with}} value = get("{{{@key.original}}}"); +if (!({{#contains types "null" }}value == null || {{/contains}}value instanceof {{> src/main/kotlin/packagename/components/schemas/types/schema_output_type fullRefModule="" forceNull=true noAnnotations=true }})) { + throw new RuntimeException("Invalid value stored for {{{@key.original}}}"); +} +return ({{> src/main/kotlin/packagename/components/schemas/types/schema_output_type fullRefModule="" }}) value; + {{/and}} +{{else}} + {{#and ../../mapValueSchema (eq typeSchema ../../mapValueSchema.typeSchema) }} +return getOrThrow("{{{@key.original}}}"); + {{else}} +String key = "{{{@key.original}}}"; +throwIfKeyNotPresent(key); +{{#with ../../mapValueSchema}}{{> src/main/kotlin/packagename/components/schemas/types/schema_output_type fullRefModule="" }}{{/with}} value = get(key); +if (!({{#contains types "null" }}value == null || {{/contains}}value instanceof {{> src/main/kotlin/packagename/components/schemas/types/schema_output_type fullRefModule="" forceNull=true noAnnotations=true }})) { + throw new RuntimeException("Invalid value stored for {{{@key.original}}}"); +} +return ({{> src/main/kotlin/packagename/components/schemas/types/schema_output_type fullRefModule="" }}) value; + {{/and}} +{{/if}} diff --git a/src/main/resources/kotlin/src/main/kotlin/packagename/components/schemas/_objectOutputProperties.hbs b/src/main/resources/kotlin/src/main/kotlin/packagename/components/schemas/_objectOutputProperties.hbs new file mode 100644 index 00000000000..8a6300a407e --- /dev/null +++ b/src/main/resources/kotlin/src/main/kotlin/packagename/components/schemas/_objectOutputProperties.hbs @@ -0,0 +1,78 @@ +{{#if requiredProperties}} + {{#each requiredProperties}} + {{#if @key.isValid}} + {{#with this}} + {{#if refInfo.refClass}} + +public {{> src/main/kotlin/packagename/components/schemas/types/schema_output_type fullRefModule="" }} {{{@key.original}}}() { + {{> src/main/kotlin/packagename/components/schemas/_objectOutputGetProperty required=true }} +} + {{else}} + {{#if jsonPathPiece}} + +public {{> src/main/kotlin/packagename/components/schemas/types/schema_output_type fullRefModule=null }} {{{@key.original}}}() { + {{> src/main/kotlin/packagename/components/schemas/_objectOutputGetProperty required=true }} +} + {{else}} + {{! for when additionalProperties is unset, use OUTPUT_BASE_TYPES }} + +public @Nullable Object {{@key.original}}() { + {{> src/main/kotlin/packagename/components/schemas/_objectOutputGetProperty required=true }} +} + {{/if}} + {{/if}} + {{/with}} + {{/if}} + {{/each}} +{{/if}} +{{#if optionalProperties}} + {{#each optionalProperties}} + {{#if @key.isValid}} + {{#with this}} + +public {{> src/main/kotlin/packagename/components/schemas/types/schema_output_type }} {{{@key.original}}}() throws UnsetPropertyException { + {{> src/main/kotlin/packagename/components/schemas/_objectOutputGetProperty required=false }} +} + {{/with}} + {{/if}} + {{/each}} +{{/if}} +{{#eq additionalProperties null }} + +public @Nullable Object getAdditionalProperty(String name) throws UnsetPropertyException, InvalidAdditionalPropertyException { + {{#or optionalProperties requiredProperties}} + throwIfKeyKnown(name, requiredKeys, optionalKeys); + {{/or}} + throwIfKeyNotPresent(name); + return get(name); +} +{{else}} + {{#with additionalProperties}} + {{#unless isBooleanSchemaFalse}} + +public {{> src/main/kotlin/packagename/components/schemas/types/schema_output_type }} getAdditionalProperty(String name) throws UnsetPropertyException{{#or ../optionalProperties ../requiredProperties}}, InvalidAdditionalPropertyException{{/or}} { + {{#or ../optionalProperties ../requiredProperties}} + throwIfKeyKnown(name, requiredKeys, optionalKeys); + {{/or}} + {{#and ../../mapValueSchema (eq typeSchema ../../mapValueSchema.typeSchema) }} + {{#and (neq types null) (eq types.size 1) (contains types "boolean") }} + throwIfKeyNotPresent(name); + Boolean value = get(name); + if (value == null) { + throw new RuntimeException("Value may not be null"); + } + return (boolean) value; + {{else}} + return getOrThrow(name); + {{/and}} + {{else}} + var value = getOrThrow(name); + if (!({{#contains types "null" }}value == null || {{/contains}}value instanceof {{> src/main/kotlin/packagename/components/schemas/types/schema_output_type fullRefModule="" forceNull=true noAnnotations=true }})) { + throw new RuntimeException("Invalid value stored for " + name); + } + return ({{> src/main/kotlin/packagename/components/schemas/types/schema_output_type fullRefModule="" }}) value; + {{/and}} +} + {{/unless}} + {{/with}} +{{/eq}} \ No newline at end of file diff --git a/src/main/resources/kotlin/src/main/kotlin/packagename/components/schemas/_objectOutputType.hbs b/src/main/resources/kotlin/src/main/kotlin/packagename/components/schemas/_objectOutputType.hbs new file mode 100644 index 00000000000..ea9ed11fd31 --- /dev/null +++ b/src/main/resources/kotlin/src/main/kotlin/packagename/components/schemas/_objectOutputType.hbs @@ -0,0 +1,51 @@ + + +{{#if mapValueSchema}} +public static class {{mapOutputJsonPathPiece.pascalCase}} extends FrozenMap<{{#with mapValueSchema}}{{> src/main/kotlin/packagename/components/schemas/types/schema_output_type forceNull=true }}{{/with}}> { + protected {{mapOutputJsonPathPiece.pascalCase}}(FrozenMap<{{#with mapValueSchema}}{{> src/main/kotlin/packagename/components/schemas/types/schema_output_type forceNull=true }}{{/with}}> m) { + super(m); + } +{{else}} +public static class {{mapOutputJsonPathPiece.pascalCase}} extends FrozenMap<@Nullable Object> { + protected {{mapOutputJsonPathPiece.pascalCase}}(FrozenMap<@Nullable Object> m) { + super(m); + } +{{/if}} + {{#if requiredProperties}} + public static final Set requiredKeys = Set.of( + {{#each requiredProperties}} + "{{{@key.original}}}"{{#unless @last}},{{/unless}} + {{/each}} + ); + {{else}} + public static final Set requiredKeys = Set.of(); + {{/if}} + {{#if optionalProperties}} + public static final Set optionalKeys = Set.of( + {{#each optionalProperties}} + "{{{@key.original}}}"{{#unless @last}},{{/unless}} + {{/each}} + ); + {{else}} + public static final Set optionalKeys = Set.of(); + {{/if}} + {{#eq optionalProperties null}} + {{#eq requiredProperties null}} + {{#if additionalProperties}} + {{#if additionalProperties.isBooleanSchemaFalse}} + // map with no key value pairs + {{/if}} + {{/if}} + {{/eq}} + {{/eq}} + {{#if mapValueSchema}} + public static {{mapOutputJsonPathPiece.pascalCase}} of(Map src/main/kotlin/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 { + return {{jsonPathPiece.pascalCase}}.getInstance().validate(arg, configuration); + } + {{/if}} + {{> src/main/kotlin/packagename/components/schemas/_objectOutputProperties }} +} diff --git a/src/main/resources/kotlin/src/main/kotlin/packagename/components/schemas/_sealedClassName.hbs b/src/main/resources/kotlin/src/main/kotlin/packagename/components/schemas/_sealedClassName.hbs new file mode 100644 index 00000000000..54f69f6b66f --- /dev/null +++ b/src/main/resources/kotlin/src/main/kotlin/packagename/components/schemas/_sealedClassName.hbs @@ -0,0 +1,43 @@ +{{#if isCustomSchema}} + {{#if forDocs}} +[{{jsonPathPiece.pascalCase}}Boxed]({{docRoot}}{{pathFromDocRoot}}.md#{{jsonPathPiece.kebabCase}}boxed) + {{~else}} +{{jsonPathPiece.pascalCase}}Boxed + {{~/if}} +{{~else}} + {{#or isBooleanSchemaTrue isSimpleAnyType}} +AnyTypeJsonSchema1Boxed + {{~else}} + {{#if isBooleanSchemaFalse}} +NotAnyTypeJsonSchema1Boxed + {{~else}} + {{#if isSimpleObject}} +MapJsonSchema1Boxed + {{~else}} + {{#if isSimpleArray}} +ListJsonSchema1Boxed + {{~else}} + {{#if isSimpleBoolean}} +BooleanJsonSchema1Boxed + {{~else}} + {{#if isSimpleInteger}} +IntJsonSchema1Boxed + {{~else}} + {{#if isSimpleNumber}} +NumberJsonSchema1Boxed + {{~else}} + {{#if isSimpleString}} +StringJsonSchema1Boxed + {{~else}} + {{#if isSimpleNull}} +NullJsonSchema1Boxed + {{~/if}} + {{/if}} + {{/if}} + {{/if}} + {{/if}} + {{/if}} + {{/if}} + {{/if}} + {{/or}} +{{/if}} \ No newline at end of file diff --git a/src/main/resources/kotlin/src/main/kotlin/packagename/components/schemas/docschema_arrayInput.hbs b/src/main/resources/kotlin/src/main/kotlin/packagename/components/schemas/docschema_arrayInput.hbs new file mode 100644 index 00000000000..a310abe7f42 --- /dev/null +++ b/src/main/resources/kotlin/src/main/kotlin/packagename/components/schemas/docschema_arrayInput.hbs @@ -0,0 +1,33 @@ + +{{> src/main/kotlin/packagename/components/_helper_header_from_identifier_pieces headerSize=(join headerSize "#" "") identifierPieces=(append identifierPieces arrayInputJsonPathPiece) }} +public class {{arrayInputJsonPathPiece.pascalCase}}
+builder for `List<{{#with listItemSchema}}{{> src/main/kotlin/packagename/components/schemas/types/schema_input_type sourceJsonPath=../jsonPath forceNull=true noExtends=true }}{{else}}@Nullable Object{{/with}}>` + +A class that builds the List input type + +{{headerSize}}## Constructor Summary +| Constructor and Description | +| --------------------------- | +| {{arrayInputJsonPathPiece.pascalCase}}()
Creates an empty list | +| {{arrayInputJsonPathPiece.pascalCase}}(List<{{#with listItemSchema}}{{> src/main/kotlin/packagename/components/schemas/types/schema_input_type sourceJsonPath=../jsonPath forceNull=true noExtends=true }}{{else}}@Nullable Object{{/with}}> items)
Stores the items in a list | + +{{headerSize}}## Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +{{#with listItemSchema}} + {{#if refInfo }} + {{#if refInfo.refModule}} + {{#with getDeepestRef }} +{{> src/main/kotlin/packagename/components/schemas/_arrayInputAddItem builderClass=../../arrayInputJsonPathPiece.pascalCase forDocs=true useContainer=true }} + {{/with}} + {{else}} + {{! self reference} }} +| {{../arrayInputJsonPathPiece.pascalCase}} | add(List item) | + {{/if}} + {{else}} +{{> src/main/kotlin/packagename/components/schemas/_arrayInputAddItem builderClass=../arrayInputJsonPathPiece.pascalCase forDocs=true }} + {{/if}} +{{else}} +{{! todo handle this, 3.1.0 document use-case }} +{{/with}} +| List<{{#with listItemSchema}}{{> src/main/kotlin/packagename/components/schemas/types/schema_input_type sourceJsonPath=../jsonPath forceNull=true noExtends=true }}{{else}}@Nullable Object{{/with}}> | build()
Returns list input that should be used with Schema.validate | diff --git a/src/main/resources/kotlin/src/main/kotlin/packagename/components/schemas/docschema_extends.hbs b/src/main/resources/kotlin/src/main/kotlin/packagename/components/schemas/docschema_extends.hbs new file mode 100644 index 00000000000..5684b18ff43 --- /dev/null +++ b/src/main/resources/kotlin/src/main/kotlin/packagename/components/schemas/docschema_extends.hbs @@ -0,0 +1,66 @@ +{{#or isBooleanSchemaFalse isBooleanSchemaTrue}} +{{> src/main/kotlin/packagename/components/schemas/docschema_extends_varEqualsClass }} +{{else}} + {{#eq types null }} + {{#if isSimpleAnyType }} +{{> src/main/kotlin/packagename/components/schemas/docschema_extends_varEqualsClass }} + {{else}} +extends JsonSchema + {{/if}} + {{else}} + {{! types exist }} + {{#eq types.size 1}} + {{! one type }} + {{#each types}} + {{#eq this "object"}} + {{#if isSimpleObject }} +{{> src/main/kotlin/packagename/components/schemas/docschema_extends_varEqualsClass }} + {{else}} +extends JsonSchema + {{/if}} + {{else}} + {{#eq this "array"}} + {{#if isSimpleArray }} +{{> src/main/kotlin/packagename/components/schemas/docschema_extends_varEqualsClass }} + {{else}} +extends JsonSchema + {{/if}} + {{else}} + {{#eq this "boolean"}} + {{#if isSimpleBoolean }} +{{> src/main/kotlin/packagename/components/schemas/docschema_extends_varEqualsClass }} + {{else}} +extends JsonSchema + {{/if}} + {{else}} + {{#or (eq this "number") (eq this "integer") }} + {{#or isSimpleInteger isSimpleNumber }} +{{> src/main/kotlin/packagename/components/schemas/docschema_extends_varEqualsClass }} + {{else}} +extends JsonSchema + {{/or}} + {{else}} + {{#eq this "string"}} + {{#if isSimpleString}} +{{> src/main/kotlin/packagename/components/schemas/docschema_extends_varEqualsClass }} + {{else}} +extends JsonSchema + {{/if}} + {{else}} + {{#if isSimpleNull }} +{{> src/main/kotlin/packagename/components/schemas/docschema_extends_varEqualsClass }} + {{else}} +extends JsonSchema + {{/if}} + {{/eq}} + {{/or}} + {{/eq}} + {{/eq}} + {{/eq}} + {{/each}} + {{else}} + {{! multiple types }} +extends JsonSchema + {{/eq}} + {{/eq}} +{{/or}} \ No newline at end of file diff --git a/src/main/resources/kotlin/src/main/kotlin/packagename/components/schemas/docschema_extends_varEqualsClass.hbs b/src/main/resources/kotlin/src/main/kotlin/packagename/components/schemas/docschema_extends_varEqualsClass.hbs new file mode 100644 index 00000000000..1828408b693 --- /dev/null +++ b/src/main/resources/kotlin/src/main/kotlin/packagename/components/schemas/docschema_extends_varEqualsClass.hbs @@ -0,0 +1,88 @@ +{{#or isBooleanSchemaTrue isBooleanSchemaFalse}} + {{#if isBooleanSchemaTrue}} +extends AnyTypeJsonSchema.AnyTypeJsonSchema1 + {{else}} +extends NotAnyTypeJsonSchema.NotAnyTypeJsonSchema1 + {{/if}} +{{else}} + {{#if refInfo.refClass}} + {{#if refInfo.refModule}} +extends [{{refInfo.refModule}}.{{refInfo.refClass}}]({{docRoot}}{{#with refInfo.ref}}{{pathFromDocRoot}}.md#{{jsonPathPiece.kebabCase}}{{/with}}) + {{else}} +extends [{{refInfo.refClass}}](#{{refInfo.ref.jsonPathPiece.kebabCase}}) + {{/if}} + {{else}} + {{#eq types null}} +extends AnyTypeJsonSchema.AnyTypeJsonSchema1 + {{else}} + {{#each types}} + {{#eq this "null"}} +extends NullJsonSchema.NullJsonSchema1 + {{/eq}} + {{#eq this "object"}} +extends MapJsonSchema.MapJsonSchema1 + {{/eq}} + {{#eq this "array"}} +extends ListJsonSchema.ListJsonSchema1 + {{/eq}} + {{#eq this "boolean"}} +extends BooleanJsonSchema.BooleanJsonSchema1 + {{/eq}} + {{#eq this "string"}} + {{#eq ../format "date"}} +extends DateJsonSchema.DateJsonSchema1 + {{/eq}} + {{#eq ../format "date-time"}} +extends DateTimeJsonSchema.DateTimeJsonSchema1 + {{/eq}} + {{#eq ../format "uuid"}} +extends UuidJsonSchema.UuidJsonSchema1 + {{/eq}} + {{#eq ../format "number"}} +extends DecimalJsonSchema.DecimalJsonSchema1 + {{/eq}} + {{#eq ../format "binary"}} +extends JsonSchema + {{/eq}} + {{#neq ../format "date"}} + {{#neq ../format "date-time"}} + {{#neq ../format "uuid"}} + {{#neq ../format "number"}} + {{#neq ../format "binary"}} +extends StringJsonSchema.StringJsonSchema1 + {{/neq}} + {{/neq}} + {{/neq}} + {{/neq}} + {{/neq}} + {{/eq}} + {{#eq this "integer"}} + {{#eq ../format "int32"}} +extends Int32JsonSchema.Int32JsonSchema1 + {{/eq}} + {{#eq ../format "int64"}} +extends Int64JsonSchema.Int64JsonSchema1 + {{/eq}} + {{#neq ../format "int32"}} + {{#neq ../format "int64"}} +extends IntJsonSchema.IntJsonSchema1 + {{/neq}} + {{/neq}} + {{/eq}} + {{#eq this "number"}} + {{#eq ../format null}} +extends NumberJsonSchema.NumberJsonSchema1 + {{else}} + {{#eq ../format "float"}} +extends FloatJsonSchema.FloatJsonSchema1 + {{else}} + {{#eq ../format "double"}} +extends DoubleJsonSchema.DoubleJsonSchema1 + {{/eq}} + {{/eq}} + {{/eq}} + {{/eq}} + {{/each}} + {{/eq}} + {{/if}} +{{/or}} \ No newline at end of file diff --git a/src/main/resources/kotlin/src/main/kotlin/packagename/components/schemas/docschema_fields.hbs b/src/main/resources/kotlin/src/main/kotlin/packagename/components/schemas/docschema_fields.hbs new file mode 100644 index 00000000000..d89246c839a --- /dev/null +++ b/src/main/resources/kotlin/src/main/kotlin/packagename/components/schemas/docschema_fields.hbs @@ -0,0 +1,58 @@ +{{#or isBooleanSchemaFalse isBooleanSchemaTrue}} +{{else}} + {{#eq types null }} + {{#if isSimpleAnyType }} + {{else}} +{{> src/main/kotlin/packagename/components/schemas/docschema_fields_field }} + {{/if}} + {{else}} + {{! types exist }} + {{#eq types.size 1}} + {{! one type }} + {{#each types}} + {{#eq this "object"}} + {{#if isSimpleObject }} + {{else}} +{{> src/main/kotlin/packagename/components/schemas/docschema_fields_field }} + {{/if}} + {{else}} + {{#eq this "array"}} + {{#if isSimpleArray }} + {{else}} +{{> src/main/kotlin/packagename/components/schemas/docschema_fields_field }} + {{/if}} + {{else}} + {{#eq this "boolean"}} + {{#if isSimpleBoolean }} + {{else}} +{{> src/main/kotlin/packagename/components/schemas/docschema_fields_field }} + {{/if}} + {{else}} + {{#or (eq this "number") (eq this "integer") }} + {{#or isSimpleInteger isSimpleNumber }} + {{else}} +{{> src/main/kotlin/packagename/components/schemas/docschema_fields_field }} + {{/or}} + {{else}} + {{#eq this "string"}} + {{#if isSimpleString}} + {{else}} +{{> src/main/kotlin/packagename/components/schemas/docschema_fields_field }} + {{/if}} + {{else}} + {{#if isSimpleNull }} + {{else}} +{{> src/main/kotlin/packagename/components/schemas/docschema_fields_field }} + {{/if}} + {{/eq}} + {{/or}} + {{/eq}} + {{/eq}} + {{/eq}} + {{/each}} + {{else}} + {{! multiple types }} +{{> src/main/kotlin/packagename/components/schemas/docschema_fields_field }} + {{/eq}} + {{/eq}} +{{/or}} \ No newline at end of file diff --git a/src/main/resources/kotlin/src/main/kotlin/packagename/components/schemas/docschema_fields_field.hbs b/src/main/resources/kotlin/src/main/kotlin/packagename/components/schemas/docschema_fields_field.hbs new file mode 100644 index 00000000000..ad5b377f84a --- /dev/null +++ b/src/main/resources/kotlin/src/main/kotlin/packagename/components/schemas/docschema_fields_field.hbs @@ -0,0 +1,117 @@ +{{#if types}} +| Set> | {{> src/main/kotlin/packagename/components/schemas/SchemaClass/_types }} | +{{/if}} +{{#if format}} +| String | {{> src/main/kotlin/packagename/components/schemas/SchemaClass/_format }} | +{{/if}} +{{#if items}} +| Class | {{> src/main/kotlin/packagename/components/schemas/SchemaClass/_items }} | +{{/if}} +{{#if properties}} +| Map> | {{> src/main/kotlin/packagename/components/schemas/SchemaClass/_properties }} | +{{/if}} +{{#if requiredProperties}} +| Set | {{> src/main/kotlin/packagename/components/schemas/SchemaClass/_required }} | +{{/if}} +{{#neq exclusiveMaximum null}} +| Number | {{> src/main/kotlin/packagename/components/schemas/SchemaClass/_exclusiveMaximum }} | +{{/neq}} +{{#neq exclusiveMinimum null}} +| Number | {{> src/main/kotlin/packagename/components/schemas/SchemaClass/_exclusiveMinimum }} | +{{/neq}} +{{#neq maximum null}} +| Number | {{> src/main/kotlin/packagename/components/schemas/SchemaClass/_maximum }} | +{{/neq}} +{{#neq minimum null}} +| Number | {{> src/main/kotlin/packagename/components/schemas/SchemaClass/_minimum }} | +{{/neq}} +{{#neq multipleOf null}} +| BigDecimal | {{> src/main/kotlin/packagename/components/schemas/SchemaClass/_multipleOf }} | +{{/neq}} +{{#neq maxItems null}} +| Integer | {{> src/main/kotlin/packagename/components/schemas/SchemaClass/_maxItems }} | +{{/neq}} +{{#neq minItems null}} +| Integer | {{> src/main/kotlin/packagename/components/schemas/SchemaClass/_minItems }} | +{{/neq}} +{{#neq maxLength null }} +| Integer | {{> src/main/kotlin/packagename/components/schemas/SchemaClass/_maxLength }} | +{{/neq}} +{{#neq minLength null }} +| Integer | {{> src/main/kotlin/packagename/components/schemas/SchemaClass/_minLength }} | +{{/neq}} +{{#neq maxProperties null}} +| Integer | {{> src/main/kotlin/packagename/components/schemas/SchemaClass/_maxProperties }} | +{{/neq}} +{{#neq minProperties null}} +| Integer | {{> src/main/kotlin/packagename/components/schemas/SchemaClass/_minProperties }} | +{{/neq}} +{{#if additionalProperties}} +| Class | {{> src/main/kotlin/packagename/components/schemas/SchemaClass/_additionalProperties }} | +{{/if}} +{{#if allOf}} +| List> | {{> src/main/kotlin/packagename/components/schemas/SchemaClass/_allOf }} | +{{/if}} +{{#if anyOf}} +| List> | {{> src/main/kotlin/packagename/components/schemas/SchemaClass/_anyOf }} | +{{/if}} +{{#if oneOf}} +| List> | {{> src/main/kotlin/packagename/components/schemas/SchemaClass/_oneOf }} | +{{/if}} +{{#if not}} +| Class | {{> src/main/kotlin/packagename/components/schemas/SchemaClass/_not }} | +{{/if}} +{{#neq uniqueItems null}} +| Boolean | {{> src/main/kotlin/packagename/components/schemas/SchemaClass/_uniqueItems }} | +{{/neq}} +{{#if enumInfo}} +| Set | {{> src/main/kotlin/packagename/components/schemas/SchemaClass/_enum }} | +{{/if}} +{{#if patternInfo}} +| Pattern | {{> src/main/kotlin/packagename/components/schemas/SchemaClass/_pattern }} | +{{/if}} +{{#if defaultValue}} +| @Nullable Object | {{> src/main/kotlin/packagename/components/schemas/SchemaClass/_default }} | +{{/if}} +{{#if contains}} +| Class | {{> src/main/kotlin/packagename/components/schemas/SchemaClass/_contains }} | +{{/if}} +{{#neq maxContains null}} +| Integer | {{> src/main/kotlin/packagename/components/schemas/SchemaClass/_maxContains }} | +{{/neq}} +{{#neq minContains null}} +| Integer | {{> src/main/kotlin/packagename/components/schemas/SchemaClass/_minContains }} | +{{/neq}} +{{#if propertyNames}} +| Class | {{> src/main/kotlin/packagename/components/schemas/SchemaClass/_propertyNames }} | +{{/if}} +{{#if dependentRequired}} +| Map> | {{> src/main/kotlin/packagename/components/schemas/SchemaClass/_dependentRequired }} | +{{/if}} +{{#if dependentSchemas}} +| Map> | {{> src/main/kotlin/packagename/components/schemas/SchemaClass/_dependentSchemas }} | +{{/if}} +{{#if patternProperties}} +| Map> | {{> src/main/kotlin/packagename/components/schemas/SchemaClass/_patternProperties }} | +{{/if}} +{{#if prefixItems}} +| List> | {{> src/main/kotlin/packagename/components/schemas/SchemaClass/_prefixItems }} | +{{/if}} +{{#if if_}} +| Class | {{> src/main/kotlin/packagename/components/schemas/SchemaClass/_if }} | +{{/if}} +{{#if then}} +| Class | {{> src/main/kotlin/packagename/components/schemas/SchemaClass/_then }} | +{{/if}} +{{#if else_}} +| Class | {{> src/main/kotlin/packagename/components/schemas/SchemaClass/_else }} | +{{/if}} +{{#if constInfo}} +| @Nullable Object | {{> src/main/kotlin/packagename/components/schemas/SchemaClass/_const }} | +{{/if}} +{{#if unevaluatedItems}} +| Class | {{> src/main/kotlin/packagename/components/schemas/SchemaClass/_unevaluatedItems }} | +{{/if}} +{{#if unevaluatedProperties}} +| Class | {{> src/main/kotlin/packagename/components/schemas/SchemaClass/_unevaluatedProperties }} | +{{/if}} diff --git a/src/main/resources/kotlin/src/main/kotlin/packagename/components/schemas/docschema_io_types.hbs b/src/main/resources/kotlin/src/main/kotlin/packagename/components/schemas/docschema_io_types.hbs new file mode 100644 index 00000000000..cbbe076b7f4 --- /dev/null +++ b/src/main/resources/kotlin/src/main/kotlin/packagename/components/schemas/docschema_io_types.hbs @@ -0,0 +1,122 @@ +{{#eq types null}} +| String | validate(String arg, SchemaConfiguration configuration) | + {{#and enumInfo enumInfo.typeToValues.string}} +| String | validate([String{{enumInfo.jsonPathPiece.pascalCase}}](#string{{enumInfo.jsonPathPiece.kebabCase}}) arg, SchemaConfiguration configuration) | + {{/and}} +| Nothing? | validate(Nothing? arg, SchemaConfiguration configuration) | + {{#and enumInfo enumInfo.typeToValues.null}} +| Nothing? | validate([Null{{enumInfo.jsonPathPiece.pascalCase}}](#null{{enumInfo.jsonPathPiece.kebabCase}}) arg, SchemaConfiguration configuration) | + {{/and}} +| int | validate(int arg, SchemaConfiguration configuration) | +| long | validate(long arg, SchemaConfiguration configuration) | +| float | validate(float arg, SchemaConfiguration configuration) | +| double | validate(double arg, SchemaConfiguration configuration) | +| Number | validate(Number arg, SchemaConfiguration configuration) | +| boolean | validate(boolean arg, SchemaConfiguration configuration) | + {{#and enumInfo enumInfo.typeToValues.boolean}} +| boolean | validate([Boolean{{enumInfo.jsonPathPiece.pascalCase}}](#boolean{{enumInfo.jsonPathPiece.kebabCase}}) arg, SchemaConfiguration configuration) | + {{/and}} + {{#if mapOutputJsonPathPiece }} +| [{{mapOutputJsonPathPiece.pascalCase}}](#{{> src/main/kotlin/packagename/components/_helper_anchor_id identifierPieces=(append identifierPieces mapOutputJsonPathPiece) }}) | validate([Map<?, ?>](#{{> src/main/kotlin/packagename/components/_helper_anchor_id identifierPieces=(append identifierPieces mapInputJsonPathPiece) }}) arg, SchemaConfiguration configuration) | + {{else}} +| FrozenMap<@Nullable Object> | validate(Map<?, ?> arg, SchemaConfiguration configuration) | + {{/if}} + {{#if arrayOutputJsonPathPiece}} +| [{{arrayOutputJsonPathPiece.pascalCase}}](#{{> src/main/kotlin/packagename/components/_helper_anchor_id identifierPieces=(append identifierPieces arrayOutputJsonPathPiece) }}) | validate([List](#{{> src/main/kotlin/packagename/components/_helper_anchor_id identifierPieces=(append identifierPieces arrayInputJsonPathPiece) }}) arg, SchemaConfiguration configuration) | + {{else}} +| FrozenList<@Nullable Object> | validate(List arg, SchemaConfiguration configuration) | + {{/if}} +| [{{jsonPathPiece.pascalCase}}BoxedString](#{{> src/main/kotlin/packagename/components/_helper_anchor_id identifierPieces=(append identifierPieces (join jsonPathPiece.kebabCase "boxedstring" ""))}}) | validateAndBox(String arg, SchemaConfiguration configuration) | +| [{{jsonPathPiece.pascalCase}}BoxedVoid](#{{> src/main/kotlin/packagename/components/_helper_anchor_id identifierPieces=(append identifierPieces (join jsonPathPiece.kebabCase "boxedvoid" ""))}}) | validateAndBox(Nothing? arg, SchemaConfiguration configuration) | +| [{{jsonPathPiece.pascalCase}}BoxedNumber](#{{> src/main/kotlin/packagename/components/_helper_anchor_id identifierPieces=(append identifierPieces (join jsonPathPiece.kebabCase "boxednumber" ""))}}) | validateAndBox(Number arg, SchemaConfiguration configuration) | +| [{{jsonPathPiece.pascalCase}}BoxedBoolean](#{{> src/main/kotlin/packagename/components/_helper_anchor_id identifierPieces=(append identifierPieces (join jsonPathPiece.kebabCase "boxedboolean" ""))}}) | validateAndBox(boolean arg, SchemaConfiguration configuration) | +| [{{jsonPathPiece.pascalCase}}BoxedMap](#{{> src/main/kotlin/packagename/components/_helper_anchor_id identifierPieces=(append identifierPieces (join jsonPathPiece.kebabCase "boxedmap" ""))}}) | validateAndBox({{#if mapInputJsonPathPiece}}[Map<?, ?>](#{{> src/main/kotlin/packagename/components/_helper_anchor_id identifierPieces=(append identifierPieces mapInputJsonPathPiece) }}){{else}}Map<?, ?>{{/if}} arg, SchemaConfiguration configuration) | +| [{{jsonPathPiece.pascalCase}}BoxedList](#{{> src/main/kotlin/packagename/components/_helper_anchor_id identifierPieces=(append identifierPieces (join jsonPathPiece.kebabCase "boxedlist" ""))}}) | validateAndBox({{#if arrayInputJsonPathPiece}}[List](#{{> src/main/kotlin/packagename/components/_helper_anchor_id identifierPieces=(append identifierPieces arrayInputJsonPathPiece) }}){{else}}List{{/if}} arg, SchemaConfiguration configuration) | +{{else}} + {{#each types}} + {{#eq this "boolean"}} +| boolean | validate(boolean arg, SchemaConfiguration configuration) | + {{#and ../enumInfo enumInfo.typeToValues.boolean}} +| boolean | validate([Boolean{{../enumInfo.jsonPathPiece.pascalCase}}](#boolean{{../enumInfo.jsonPathPiece.kebabCase}}) arg, SchemaConfiguration configuration) | + {{/and}} +| [{{jsonPathPiece.pascalCase}}BoxedBoolean](#{{> src/main/kotlin/packagename/components/_helper_anchor_id identifierPieces=(append identifierPieces (join jsonPathPiece.kebabCase "boxedboolean" ""))}}) | validateAndBox(boolean arg, SchemaConfiguration configuration) | + {{else}} + {{#eq this "null"}} +| Nothing? | validate(Nothing? arg, SchemaConfiguration configuration) | + {{#and ../enumInfo ../enumInfo.typeToValues.null}} +| Nothing? | validate([Null{{../enumInfo.jsonPathPiece.pascalCase}}](#null{{../enumInfo.jsonPathPiece.kebabCase}}) arg, SchemaConfiguration configuration) | + {{/and}} +| [{{jsonPathPiece.pascalCase}}BoxedVoid](#{{> src/main/kotlin/packagename/components/_helper_anchor_id identifierPieces=(append identifierPieces (join jsonPathPiece.kebabCase "boxedvoid" ""))}}) | validateAndBox(Nothing? arg, SchemaConfiguration configuration) | + {{else}} + {{#eq this "string"}} + {{#eq format "binary"}} +{{! todo binary types}} +| BinaryString | validate(BinaryString arg, SchemaConfiguration configuration) | + {{else}} +| String | validate(String arg, SchemaConfiguration configuration) | + {{#and ../enumInfo ../enumInfo.typeToValues.string}} +| String | validate([String{{../enumInfo.jsonPathPiece.pascalCase}}](#string{{../enumInfo.jsonPathPiece.kebabCase}}) arg, SchemaConfiguration configuration) | + {{/and}} +| [{{jsonPathPiece.pascalCase}}BoxedString](#{{> src/main/kotlin/packagename/components/_helper_anchor_id identifierPieces=(append identifierPieces (join jsonPathPiece.kebabCase "boxedstring" ""))}}) | validateAndBox(String arg, SchemaConfiguration configuration) | + {{/eq}} + {{else}} + {{#eq this "number"}} + {{#eq ../format null}} +| Number | validate(Number arg, SchemaConfiguration configuration) | + {{else}} + {{#eq ../format "float"}} +| float | validate(float arg, SchemaConfiguration configuration) | + {{else}} + {{#eq ../format "double"}} +| double | validate(double arg, SchemaConfiguration configuration) | + {{else}} + {{#eq ../format "int32"}} +| int | validate(int arg, SchemaConfiguration configuration) | + {{else}} + {{#eq ../format "int64"}} +| long | validate(long arg, SchemaConfiguration configuration) | + {{/eq}} + {{/eq}} + {{/eq}} + {{/eq}} + {{/eq}} +| [{{jsonPathPiece.pascalCase}}BoxedNumber](#{{> src/main/kotlin/packagename/components/_helper_anchor_id identifierPieces=(append identifierPieces (join jsonPathPiece.kebabCase "boxednumber" ""))}}) | validateAndBox(Number arg, SchemaConfiguration configuration) | + {{else}} + {{#eq this "integer"}} + {{#eq ../format null}} +| long | validate(long arg, SchemaConfiguration configuration) | + {{else}} + {{#eq ../format "int32"}} +| int | validate(int arg, SchemaConfiguration configuration) | + {{else}} +| long | validate(long arg, SchemaConfiguration configuration) | + {{/eq}} + {{/eq}} +| [{{jsonPathPiece.pascalCase}}BoxedNumber](#{{> src/main/kotlin/packagename/components/_helper_anchor_id identifierPieces=(append identifierPieces (join jsonPathPiece.kebabCase "boxednumber" ""))}}) | validateAndBox(Number arg, SchemaConfiguration configuration) | + {{else}} + {{#eq this "array"}} + {{#if ../arrayOutputJsonPathPiece}} +| [{{../arrayOutputJsonPathPiece.pascalCase}}](#{{> src/main/kotlin/packagename/components/_helper_anchor_id identifierPieces=(append identifierPieces ../arrayOutputJsonPathPiece) }}) | validate([List](#{{> src/main/kotlin/packagename/components/_helper_anchor_id identifierPieces=(append identifierPieces arrayInputJsonPathPiece) }}) arg, SchemaConfiguration configuration) | + {{else}} +| FrozenList<@Nullable Object> | validate(List arg, SchemaConfiguration configuration) | + {{/if}} +| [{{jsonPathPiece.pascalCase}}BoxedList](#{{> src/main/kotlin/packagename/components/_helper_anchor_id identifierPieces=(append identifierPieces (join jsonPathPiece.kebabCase "boxedlist" ""))}}) | validateAndBox({{#if arrayInputJsonPathPiece}}[List](#{{> src/main/kotlin/packagename/components/_helper_anchor_id identifierPieces=(append identifierPieces arrayInputJsonPathPiece) }}){{else}}List{{/if}} arg, SchemaConfiguration configuration) | + {{else}} + {{#eq this "object"}} + {{#if ../mapOutputJsonPathPiece}} +| [{{../mapOutputJsonPathPiece.pascalCase}}](#{{> src/main/kotlin/packagename/components/_helper_anchor_id identifierPieces=(append identifierPieces ../mapOutputJsonPathPiece) }}) | validate([Map<?, ?>](#{{> src/main/kotlin/packagename/components/_helper_anchor_id identifierPieces=(append identifierPieces ../mapInputJsonPathPiece) }}) arg, SchemaConfiguration configuration) | + {{else}} +| FrozenMap | validate(Map<?, ?> arg, SchemaConfiguration configuration) | + {{/if}} +| [{{jsonPathPiece.pascalCase}}BoxedMap](#{{> src/main/kotlin/packagename/components/_helper_anchor_id identifierPieces=(append identifierPieces (join jsonPathPiece.kebabCase "boxedmap" ""))}}) | validateAndBox({{#if mapInputJsonPathPiece}}[Map<?, ?>](#{{> src/main/kotlin/packagename/components/_helper_anchor_id identifierPieces=(append identifierPieces mapInputJsonPathPiece) }}){{else}}Map<?, ?>{{/if}} arg, SchemaConfiguration configuration) | + {{/eq}} + {{/eq}} + {{/eq}} + {{/eq}} + {{/eq}} + {{/eq}} + {{/eq}} + {{/each}} +{{/eq}} +| [{{jsonPathPiece.pascalCase}}Boxed](#{{> src/main/kotlin/packagename/components/_helper_anchor_id identifierPieces=(append identifierPieces (join jsonPathPiece.kebabCase "boxed" ""))}}) | validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) | +| @Nullable Object | validate(@Nullable Object arg, SchemaConfiguration configuration) | diff --git a/src/main/resources/kotlin/src/main/kotlin/packagename/components/schemas/docschema_objectInput.hbs b/src/main/resources/kotlin/src/main/kotlin/packagename/components/schemas/docschema_objectInput.hbs new file mode 100644 index 00000000000..08accbc7e53 --- /dev/null +++ b/src/main/resources/kotlin/src/main/kotlin/packagename/components/schemas/docschema_objectInput.hbs @@ -0,0 +1,48 @@ +{{#each mapBuilders}} + +{{> src/main/kotlin/packagename/components/_helper_header_from_identifier_pieces headerSize=(join headerSize "#" "") identifierPieces=(append identifierPieces className) }} +public class {{className.pascalCase}}
+ {{#if ../mapValueSchema}} +builder for `Map src/main/kotlin/packagename/components/schemas/types/schema_input_type sourceJsonPath=../jsonPath forceNull=true noExtends=true }}{{/with}}>` + {{else}} +builder for `Map` + {{/if}} + +A class that builds the Map input type + +{{headerSize}}## Constructor Summary +| Constructor and Description | +| --------------------------- | + {{#if @last }} +| {{className.pascalCase}}()
Creates a builder that contains an empty map | + {{else}} +| {{className.pascalCase}}(Map src/main/kotlin/packagename/components/schemas/types/schema_input_type sourceJsonPath=../../jsonPath forceNull=true noExtends=true }}{{else}}@Nullable Object{{/with}}> instance)
Creates a builder that contains the passed instance | + {{/if}} + +{{headerSize}}## Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | + {{#if @first}} +| Map src/main/kotlin/packagename/components/schemas/types/schema_input_type sourceJsonPath=../../jsonPath forceNull=true noExtends=true }}{{else}}@Nullable Object{{/with}}> | build()
Returns map input that should be used with Schema.validate | + {{/if}} + {{#each keyToBuilder}} + {{#with property }} + {{#if ../@key.isValid}} +{{> src/main/kotlin/packagename/components/schemas/_objectInputSetter forDocs=true builderClass=../builder.className methodName=../@key.original }} + {{else}} +{{> src/main/kotlin/packagename/components/schemas/_objectInputSetter forDocs=true builderClass=../builder.className methodName=../@key.camelCase }} + {{/if}} + {{/with}} + {{/each}} + {{#if @first}} + {{#eq ../additionalProperties null }} +{{> src/main/kotlin/packagename/components/schemas/_objectInputAddPropUnsetSetterDocs builderClass=className methodName="additionalProperty" }} + {{else}} + {{#eq ../additionalProperties.isBooleanSchemaFalse false }} + {{#with ../additionalProperties }} +{{> src/main/kotlin/packagename/components/schemas/_objectInputAddPropSetter forDocs=true builderClass=../className methodName="additionalProperty" }} + {{/with}} + {{/eq}} + {{/eq}} + {{/if}} +{{/each}} \ No newline at end of file diff --git a/src/main/resources/kotlin/src/main/kotlin/packagename/components/schemas/helpers/notes_msg.hbs b/src/main/resources/kotlin/src/main/kotlin/packagename/components/schemas/helpers/notes_msg.hbs new file mode 100644 index 00000000000..950442c4104 --- /dev/null +++ b/src/main/resources/kotlin/src/main/kotlin/packagename/components/schemas/helpers/notes_msg.hbs @@ -0,0 +1 @@ +{{#unless refInfo.refClass}}{{#if enumInfo}} must be one of [{{#each enumInfo.valueToName}}{{#unless @first}}, {{/unless}}{{#eq @key.type "null"}}None{{/eq}}{{#eq @key.type "boolean"}}{{#if @key.value}}True{{else}}False{{/if}}{{/eq}}{{#eq @key.type "string"}}"{{{@key.value}}}"{{/eq}}{{#eq @key.type "number"}}{{{@key.value}}}{{/eq}}{{#eq @key.type "integer"}}{{{@key.value}}}{{/eq}}{{/each}}]{{/if}}{{#if defaultValue}}{{#unless requiredProperties}} if omitted the {{defaultUser}} will use the default value of {{{defaultValue.value}}}{{/unless}}{{/if}}{{#eq format "uuid"}} value must be a uuid{{/eq}}{{#eq format "date"}} value must conform to RFC-3339 full-date YYYY-MM-DD{{/eq}}{{#eq format "date-time"}} value must conform to RFC-3339 date-time{{/eq}}{{#eq format "number"}} value must be int or float numeric{{/eq}}{{#eq format "int32"}} value must be a 32 bit integer{{/eq}}{{#eq format "int64"}} value must be a 64 bit integer{{/eq}}{{#eq format "double"}} value must be a 64 bit float{{/eq}}{{#eq format "float"}} value must be a 32 bit float{{/eq}}{{/unless}} \ No newline at end of file diff --git a/src/main/resources/kotlin/src/main/kotlin/packagename/components/schemas/helpers/payload_renderer.hbs b/src/main/resources/kotlin/src/main/kotlin/packagename/components/schemas/helpers/payload_renderer.hbs new file mode 100644 index 00000000000..db40dce3cd8 --- /dev/null +++ b/src/main/resources/kotlin/src/main/kotlin/packagename/components/schemas/helpers/payload_renderer.hbs @@ -0,0 +1,96 @@ +{{#eq type "object"}} + {{#if constructor}} + {{#each value}} + {{#or (eq type "array") (eq type "object")}} + {{#or (and optionalProperties (contains optionalProperties @key)) (and requiredProperties (contains requiredProperties @key)) }} +.{{#if @key.isValid}}{{{@key.original}}}{{else}}{{{@key.camelCase}}}{{/if}}( + {{> src/main/kotlin/packagename/components/schemas/helpers/payload_renderer endChar="" noVoid=true constructor=false }} +) + {{else}} +.additionalProperty( + "{{{@key.original}}}", + {{> src/main/kotlin/packagename/components/schemas/helpers/payload_renderer endChar="" noVoid=true constructor=false }} +) + {{/or}} + {{else}} + {{#or (and optionalProperties (contains optionalProperties @key)) (and requiredProperties (contains requiredProperties @key)) }} +.{{#if @key.isValid}}{{{@key.original}}}{{else}}{{{@key.camelCase}}}{{/if}}({{> src/main/kotlin/packagename/components/schemas/helpers/payload_renderer endChar=")" noVoid=true constructor=false }} + {{else}} +.additionalProperty("{{{@key.original}}}", {{> src/main/kotlin/packagename/components/schemas/helpers/payload_renderer endChar=")" noVoid=true constructor=false }} + {{/or}} + {{/or}} + {{/each}} + {{else}} +MapUtils.makeMap( + {{#each value}} + new AbstractMap.SimpleEntry src/main/kotlin/packagename/components/schemas/types/schema_input_type forceNull=true noExtends=true }}{{/with}}>( + {{#if @key.original }} + "{{{@key.original}}}", + {{else}} + "{{{@key}}}", + {{/if}} + {{#with this}} + {{> src/main/kotlin/packagename/components/schemas/helpers/payload_renderer endChar="" noVoid=true }} + {{/with}} + ){{#unless @last}},{{/unless}} + {{/each}} +){{endChar}} + {{/if}} +{{/eq}} +{{#eq type"array"}} + {{#if constructor}} + {{#each value}} + {{#or (eq type "array") (eq type "object")}} +.add( + {{> src/main/kotlin/packagename/components/schemas/helpers/payload_renderer endChar="" constructor=false }} +) + {{else}} +.add({{> src/main/kotlin/packagename/components/schemas/helpers/payload_renderer endChar=")" constructor=false }} + {{/or}} + {{/each}} + {{else}} +Arrays.asList( + {{#eq value.size 1}} + {{#each value}} + {{! list with single null needs to describe the item as (Nothing?) }} + {{> src/main/kotlin/packagename/components/schemas/helpers/payload_renderer endChar="" }} + {{/each}} + {{else}} + {{#each value}} + {{#unless @last}} + {{> src/main/kotlin/packagename/components/schemas/helpers/payload_renderer endChar="," noVoid=true }} + {{else}} + {{> src/main/kotlin/packagename/components/schemas/helpers/payload_renderer endChar="" noVoid=true }} + {{/unless}} + {{/each}} + {{/eq}} +){{endChar}} + {{/if}} +{{/eq}} +{{#eq type "number"}} + {{#eq javaType "Long"}} +{{value}}L{{endChar}} + {{else}} + {{#eq javaType "Float"}} +{{value}}f{{endChar}} + {{else}} + {{#eq javaType "Double"}} +{{value}}d{{endChar}} + {{else}} +{{value}}{{endChar}}{{! Integer }} + {{/eq}} + {{/eq}} + {{/eq}} +{{/eq}} +{{#eq type "integer"}} +{{value}}{{#eq javaType "Long"}}L{{/eq}}{{endChar}} +{{/eq}} +{{#eq type "boolean"}} +{{value}}{{endChar}} +{{/eq}} +{{#eq type "null"}} +{{#unless noVoid}}(Nothing?) {{/unless}}null{{endChar}} +{{/eq}} +{{#eq type "string"}} +"{{{value}}}"{{endChar}} +{{/eq}} \ No newline at end of file diff --git a/src/main/resources/kotlin/src/main/kotlin/packagename/components/schemas/types/_schema_input_type_base.hbs b/src/main/resources/kotlin/src/main/kotlin/packagename/components/schemas/types/_schema_input_type_base.hbs new file mode 100644 index 00000000000..6be5a6b2c1a --- /dev/null +++ b/src/main/resources/kotlin/src/main/kotlin/packagename/components/schemas/types/_schema_input_type_base.hbs @@ -0,0 +1,126 @@ +{{#if types}} + {{#eq types.size 1}} + {{#each types}} + {{#eq this "boolean"}} + {{#if forceNull}} +Boolean + {{~else}} +boolean + {{~/if}} + {{else}} + {{#eq this "null"}} +Nothing? + {{~else}} + {{#eq this "string"}} + {{#eq format "binary"}} +{{! todo binary types}} +String + {{~else}} +String + {{~/eq}} + {{else}} + {{#eq this "number"}} +Number + {{~else}} + {{#eq this "integer"}} +Number + {{~else}} + {{#eq this "array"}} + {{#eq ../jsonPath sourceJsonPath}} +List + {{~else}} + {{#with items}} +List<{{> src/main/kotlin/packagename/components/schemas/types/schema_input_type }}> + {{~else}} +List<{{#unless noExtends}}? extends {{/unless}}@Nullable Object> + {{~/with}} + {{/eq}} + {{else}} + {{#eq this "object"}} + {{#eq ../jsonPath sourceJsonPath}} +Map + {{~else}} + {{#with mapValueSchema}} +Map src/main/kotlin/packagename/components/schemas/types/schema_input_type }}> + {{~else}} +Map + {{~/with}} + {{/eq}} + {{/eq}} + {{/eq}} + {{/eq}} + {{/eq}} + {{/eq}} + {{/eq}} + {{/eq}} + {{/each}} + {{else}} + {{#eq types.size 2}} + {{#contains types "null"}} + {{! nullable types }} + {{#each types}} + {{#eq this "boolean"}} +{{#unless noExtends}}? extends {{/unless}}@Nullable Boolean + {{~else}} + {{#eq this "string"}} + {{#eq format "binary"}} +{{! todo binary types}} +{{#unless noExtends}}? extends {{/unless}}@Nullable String + {{~else}} +{{#unless noExtends}}? extends {{/unless}}@Nullable String + {{~/eq}} + {{else}} + {{#eq this "number"}} +{{#unless noExtends}}? extends {{/unless}}@Nullable Number + {{~else}} + {{#eq this "integer"}} +{{#unless noExtends}}? extends {{/unless}}@Nullable Number + {{~else}} + {{#eq this "array"}} + {{#eq ../jsonPath sourceJsonPath}} +{{#unless noExtends}}? extends {{/unless}}@Nullable List + {{~else}} + {{#with items}} +{{#unless noExtends}}? extends {{/unless}}@Nullable List<{{> src/main/kotlin/packagename/components/schemas/types/schema_input_type }}> + {{~else}} +{{#unless noExtends}}? extends {{/unless}}@Nullable List<@Nullable Object> + {{~/with}} + {{/eq}} + {{else}} + {{#eq this "object"}} + {{#eq ../jsonPath sourceJsonPath}} +{{#unless noExtends}}? extends {{/unless}}@Nullable Map + {{~else}} + {{#with mapValueSchema}} +{{#unless noExtends}}? extends {{/unless}}@Nullable Map src/main/kotlin/packagename/components/schemas/types/schema_input_type }}> + {{~else}} +{{#unless noExtends}}? extends {{/unless}}@Nullable Map + {{~/with}} + {{/eq}} + {{/eq}} + {{/eq}} + {{/eq}} + {{/eq}} + {{/eq}} + {{/eq}} + {{/each}} + {{else}} + {{! none of the types are null }} + {{#and (contains types "integer") (contains types "number") }} +Number + {{~else}} +Object + {{~/and}} + {{/contains}} + {{else}} + {{! 3 or more types }} + {{#contains types "null"}} +{{#unless noExtends}}? extends {{/unless}}@Nullable Object + {{~else}} +Object + {{~/contains}} + {{/eq}} + {{/eq}} +{{else}} +{{#unless noExtends}}? extends {{/unless}}@Nullable Object +{{~/if}} \ No newline at end of file diff --git a/src/main/resources/kotlin/src/main/kotlin/packagename/components/schemas/types/_schema_output_type_base.hbs b/src/main/resources/kotlin/src/main/kotlin/packagename/components/schemas/types/_schema_output_type_base.hbs new file mode 100644 index 00000000000..2c2b687fda0 --- /dev/null +++ b/src/main/resources/kotlin/src/main/kotlin/packagename/components/schemas/types/_schema_output_type_base.hbs @@ -0,0 +1,158 @@ +{{#if types}} + {{#eq types.size 1}} + {{#each types}} + {{#eq this "boolean"}} + {{#if forceNull}} +Boolean + {{~else}} +boolean + {{~/if}} + {{else}} + {{#eq this "null"}} +Nothing? + {{~else}} + {{#eq this "string"}} + {{#eq format "binary"}} +{{! todo binary types}} +String + {{~else}} +String + {{~/eq}} + {{else}} + {{#eq this "number"}} +Number + {{~else}} + {{#eq this "integer"}} +Number + {{~else}} + {{#eq this "array"}} + {{#if arrayOutputJsonPathPiece}} + {{#if useLink}} + {{#if fullRefModule}} +[{{fullRefModule}}.{{arrayOutputJsonPathPiece.pascalCase}}]({{docRoot}}{{pathFromDocRoot}}.md#{{arrayOutputJsonPathPiece.kebabCase}}) + {{~else}} +[{{arrayOutputJsonPathPiece.pascalCase}}](#{{arrayOutputJsonPathPiece.kebabCase}}) + {{~/if}} + {{else}} + {{#if fullRefModule}} +{{fullRefModule}}.{{arrayOutputJsonPathPiece.pascalCase}} + {{~else}} +{{arrayOutputJsonPathPiece.pascalCase}} + {{~/if}} + {{/if}} + {{else}} +FrozenList + {{~/if}} + {{else}} + {{#eq this "object"}} + {{#if mapOutputJsonPathPiece}} + {{#if useLink}} + {{#if fullRefModule}} +[{{fullRefModule}}.{{mapOutputJsonPathPiece.pascalCase}}]({{docRoot}}{{pathFromDocRoot}}.md#{{mapOutputJsonPathPiece.kebabCase}}) + {{~else}} +[{{mapOutputJsonPathPiece.pascalCase}}](#{{mapOutputJsonPathPiece.kebabCase}}) + {{~/if}} + {{else}} + {{#if fullRefModule}} +{{fullRefModule}}.{{mapOutputJsonPathPiece.pascalCase}} + {{~else}} +{{mapOutputJsonPathPiece.pascalCase}} + {{~/if}} + {{/if}} + {{~else}} +FrozenMap + {{~/if}} + {{/eq}} + {{/eq}} + {{/eq}} + {{/eq}} + {{/eq}} + {{/eq}} + {{/eq}} + {{/each}} + {{else}} + {{#eq types.size 2}} + {{#contains types "null"}} + {{! nullable types }} + {{#each types}} + {{#eq this "boolean"}} +{{#unless noAnnotations}}@Nullable {{/unless}}Boolean + {{~else}} + {{#eq this "string"}} + {{#eq format "binary"}} +{{! todo binary types}} +{{#unless noAnnotations}}@Nullable {{/unless}}String + {{~else}} +{{#unless noAnnotations}}@Nullable {{/unless}}String + {{~/eq}} + {{else}} + {{#eq this "number"}} +{{#unless noAnnotations}}@Nullable {{/unless}}Number + {{~else}} + {{#eq this "integer"}} +{{#unless noAnnotations}}@Nullable {{/unless}}Number + {{~else}} + {{#eq this "array"}} + {{#if arrayOutputJsonPathPiece}} + {{#if useLink}} + {{#if fullRefModule}} +[{{fullRefModule}}.{{arrayOutputJsonPathPiece.pascalCase}}]({{docRoot}}{{pathFromDocRoot}}.md#{{arrayOutputJsonPathPiece.kebabCase}}) + {{~else}} +[{{arrayOutputJsonPathPiece.pascalCase}}](#{{arrayOutputJsonPathPiece.kebabCase}}) + {{~/if}} + {{else}} + {{#if fullRefModule}} +{{#unless noAnnotations}}@Nullable {{/unless}}{{fullRefModule}}.{{arrayOutputJsonPathPiece.pascalCase}} + {{~else}} +{{#unless noAnnotations}}@Nullable {{/unless}}{{arrayOutputJsonPathPiece.pascalCase}} + {{~/if}} + {{/if}} + {{else}} +{{#unless noAnnotations}}@Nullable {{/unless}}FrozenList + {{~/if}} + {{else}} + {{#eq this "object"}} + {{#if mapOutputJsonPathPiece}} + {{#if useLink}} + {{#if fullRefModule}} +[{{fullRefModule}}.{{mapOutputJsonPathPiece.pascalCase}}]({{docRoot}}{{pathFromDocRoot}}.md#{{mapOutputJsonPathPiece.kebabCase}}) + {{~else}} +[{{mapOutputJsonPathPiece.pascalCase}}](#{{mapOutputJsonPathPiece.kebabCase}}) + {{~/if}} + {{else}} + {{#if fullRefModule}} +{{#unless noAnnotations}}@Nullable {{/unless}}{{fullRefModule}}.{{mapOutputJsonPathPiece.pascalCase}} + {{~else}} +{{#unless noAnnotations}}@Nullable {{/unless}}{{mapOutputJsonPathPiece.pascalCase}} + {{~/if}} + {{/if}} + {{~else}} +{{#unless noAnnotations}}@Nullable {{/unless}}FrozenMap + {{~/if}} + {{/eq}} + {{/eq}} + {{/eq}} + {{/eq}} + {{/eq}} + {{/eq}} + {{/each}} + {{else}} + {{! none of the types are null }} + {{#and (contains types "integer") (contains types "number") }} +Number + {{~else}} +Object + {{~/and}} + {{/contains}} + {{else}} + {{! 3 or more types }} + {{#contains types "null"}} +{{#unless noAnnotations}}@Nullable {{/unless}}Object + {{~else}} +Object + {{~/contains}} + {{/eq}} + {{/eq}} +{{else}} +{{#unless noAnnotations}}@Nullable {{/unless}}Object +{{~/if}} diff --git a/src/main/resources/kotlin/src/main/kotlin/packagename/components/schemas/types/schema_input_type.hbs b/src/main/resources/kotlin/src/main/kotlin/packagename/components/schemas/types/schema_input_type.hbs new file mode 100644 index 00000000000..51d9057c81f --- /dev/null +++ b/src/main/resources/kotlin/src/main/kotlin/packagename/components/schemas/types/schema_input_type.hbs @@ -0,0 +1,13 @@ +{{#if refInfo}} + {{#if refInfo.refModule}} + {{#with getDeepestRef}} +{{> src/main/kotlin/packagename/components/schemas/types/_schema_input_type_base }} + {{/with}} + {{else}} + {{#with refInfo.ref}} +{{> src/main/kotlin/packagename/components/schemas/types/_schema_input_type_base }} + {{/with}} + {{/if}} +{{else}} +{{> src/main/kotlin/packagename/components/schemas/types/_schema_input_type_base }} +{{/if}} \ No newline at end of file diff --git a/src/main/resources/kotlin/src/main/kotlin/packagename/components/schemas/types/schema_output_type.hbs b/src/main/resources/kotlin/src/main/kotlin/packagename/components/schemas/types/schema_output_type.hbs new file mode 100644 index 00000000000..f26ad98b913 --- /dev/null +++ b/src/main/resources/kotlin/src/main/kotlin/packagename/components/schemas/types/schema_output_type.hbs @@ -0,0 +1,13 @@ +{{#if refInfo}} + {{#if refInfo.refModule}} + {{#with getDeepestRef}} +{{> src/main/kotlin/packagename/components/schemas/types/_schema_output_type_base fullRefModule=containerJsonPathPiece.pascalCase }} + {{/with}} + {{else}} + {{#with refInfo.ref}} +{{> src/main/kotlin/packagename/components/schemas/types/_schema_output_type_base }} + {{/with}} + {{/if}} +{{else}} +{{> src/main/kotlin/packagename/components/schemas/types/_schema_output_type_base }} +{{/if}} \ No newline at end of file diff --git a/src/main/resources/kotlin/src/main/kotlin/packagename/components/schemas/validateAndBoxSchemaCodeSample.hbs b/src/main/resources/kotlin/src/main/kotlin/packagename/components/schemas/validateAndBoxSchemaCodeSample.hbs new file mode 100644 index 00000000000..82a83e75a4c --- /dev/null +++ b/src/main/resources/kotlin/src/main/kotlin/packagename/components/schemas/validateAndBoxSchemaCodeSample.hbs @@ -0,0 +1,73 @@ + {{#each typeToExample}} + +{{#eq @key "null"}} +{{../jsonPathPiece.pascalCase}}BoxedVoid {{../payloadVarName}} = {{../containerJsonPathPiece.pascalCase}}.{{../jsonPathPiece.pascalCase}}.validateAndBox( +{{else}} + {{#eq @key "object"}} + {{#if ../mapOutputJsonPathPiece}} +{{../jsonPathPiece.pascalCase}}BoxedMap {{../payloadVarName}} = + {{../containerJsonPathPiece.pascalCase}}.{{../jsonPathPiece.pascalCase}}.validateAndBox( + {{else}} +{{../jsonPathPiece.pascalCase}}BoxedMap {{../payloadVarName}} = {{../containerJsonPathPiece.pascalCase}}.{{../jsonPathPiece.pascalCase}}.validateAndBox( + {{/if}} + {{else}} + {{#eq @key "array"}} + {{#if ../arrayOutputJsonPathPiece}} +{{../jsonPathPiece.pascalCase}}BoxedList {{../payloadVarName}} = + {{../containerJsonPathPiece.pascalCase}}.{{../jsonPathPiece.pascalCase}}.validateAndBox( + {{else}} +{{../jsonPathPiece.pascalCase}}BoxedList {{../payloadVarName}} = {{../containerJsonPathPiece.pascalCase}}.{{../jsonPathPiece.pascalCase}}.validateAndBox( + {{/if}} + {{else}} + {{#eq @key "string" }} +{{../jsonPathPiece.pascalCase}}BoxedString {{../payloadVarName}} = {{../containerJsonPathPiece.pascalCase}}.{{../jsonPathPiece.pascalCase}}.validateAndBox( + {{else}} + {{#eq @key "integer"}} + {{#or (eq ../format null) (eq ../format "int64") }} +{{../jsonPathPiece.pascalCase}}BoxedNumber {{../payloadVarName}} = {{../containerJsonPathPiece.pascalCase}}.{{../jsonPathPiece.pascalCase}}.validateAndBox( + {{else}} +{{../jsonPathPiece.pascalCase}}BoxedNumber {{../payloadVarName}} = {{../containerJsonPathPiece.pascalCase}}.{{../jsonPathPiece.pascalCase}}.validateAndBox( + {{/or}} + {{else}} + {{#eq @key "number"}} + {{#eq ../format "int64"}} +{{../jsonPathPiece.pascalCase}}BoxedNumber {{../payloadVarName}} = {{../containerJsonPathPiece.pascalCase}}.{{../jsonPathPiece.pascalCase}}.validateAndBox( + {{else}} + {{#eq ../format "float"}} +{{../jsonPathPiece.pascalCase}}BoxedNumber {{../payloadVarName}} = {{../containerJsonPathPiece.pascalCase}}.{{../jsonPathPiece.pascalCase}}.validateAndBox( + {{else}} + {{#eq ../format "double"}} +{{../jsonPathPiece.pascalCase}}BoxedNumber {{../payloadVarName}} = {{../containerJsonPathPiece.pascalCase}}.{{../jsonPathPiece.pascalCase}}.validateAndBox( + {{else}} +{{../jsonPathPiece.pascalCase}}BoxedNumber {{../payloadVarName}} = {{../containerJsonPathPiece.pascalCase}}.{{../jsonPathPiece.pascalCase}}.validateAndBox( + {{/eq}} + {{/eq}} + {{/eq}} + {{else}} + {{#eq @key "boolean"}} +{{../jsonPathPiece.pascalCase}}BoxedBoolean {{../payloadVarName}} = {{../containerJsonPathPiece.pascalCase}}.{{../jsonPathPiece.pascalCase}}.validateAndBox( + {{/eq}} + {{/eq}} + {{/eq}} + {{/eq}} + {{/eq}} + {{/eq}} +{{/eq}} + {{#with this}} + {{#and (eq type "array") ../arrayInputJsonPathPiece.pascalCase }} + new {{../containerJsonPathPiece.pascalCase}}.{{../arrayInputJsonPathPiece.pascalCase}}() + {{> src/main/kotlin/packagename/components/schemas/helpers/payload_renderer endChar="" constructor=true }} + .build(), + {{else}} + {{#and (eq type "object") ../mapInputJsonPathPiece.pascalCase }} + new {{../containerJsonPathPiece.pascalCase}}.{{../mapInputJsonPathPiece.pascalCase}}() + {{> src/main/kotlin/packagename/components/schemas/helpers/payload_renderer endChar="" constructor=true optionalProperties=../optionalProperties requiredProperties=../requiredProperties }} + .build(), + {{else}} + {{> src/main/kotlin/packagename/components/schemas/helpers/payload_renderer endChar="," }} + {{/and}} + {{/and}} + {{/with}} + {{../configVarName}} +); + {{/each}} \ No newline at end of file diff --git a/src/main/resources/kotlin/src/main/kotlin/packagename/components/schemas/validateSchemaCodeSample.hbs b/src/main/resources/kotlin/src/main/kotlin/packagename/components/schemas/validateSchemaCodeSample.hbs new file mode 100644 index 00000000000..c5a320a9bb7 --- /dev/null +++ b/src/main/resources/kotlin/src/main/kotlin/packagename/components/schemas/validateSchemaCodeSample.hbs @@ -0,0 +1,86 @@ + {{#each typeToExample}} + +{{#eq @key "null"}} +// null validation +Nothing? {{../payloadVarName}} = {{../../../containerJsonPathPiece.pascalCase}}.{{../jsonPathPiece.pascalCase}}.validate( +{{else}} + {{#eq @key "object"}} + {{#if ../mapOutputJsonPathPiece}} +// Map validation +{{../../../containerJsonPathPiece.pascalCase}}.{{../mapOutputJsonPathPiece.pascalCase}} {{../payloadVarName}} = + {{../../../containerJsonPathPiece.pascalCase}}.{{../jsonPathPiece.pascalCase}}.validate( + {{else}} +// Map validation +FrozenMap {{../payloadVarName}} = {{../../../containerJsonPathPiece.pascalCase}}.{{../jsonPathPiece.pascalCase}}.validate( + {{/if}} + {{else}} + {{#eq @key "array"}} + {{#if ../arrayOutputJsonPathPiece}} +// List validation +{{../../../containerJsonPathPiece.pascalCase}}.{{../arrayOutputJsonPathPiece.pascalCase}} {{../payloadVarName}} = + {{../../../containerJsonPathPiece.pascalCase}}.{{../jsonPathPiece.pascalCase}}.validate( + {{else}} +// List validation +FrozenList {{../payloadVarName}} = {{../../../containerJsonPathPiece.pascalCase}}.{{../jsonPathPiece.pascalCase}}.validate( + {{/if}} + {{else}} + {{#eq @key "string" }} +// String validation +String {{../payloadVarName}} = {{../../../containerJsonPathPiece.pascalCase}}.{{../jsonPathPiece.pascalCase}}.validate( + {{else}} + {{#eq @key "integer"}} + {{#or (eq ../format null) (eq ../format "int64") }} +// long validation +long {{../payloadVarName}} = {{../../../containerJsonPathPiece.pascalCase}}.{{../jsonPathPiece.pascalCase}}.validate( + {{else}} +// int validation +int {{../payloadVarName}} = {{../../../containerJsonPathPiece.pascalCase}}.{{../jsonPathPiece.pascalCase}}.validate( + {{/or}} + {{else}} + {{#eq @key "number"}} + {{#eq ../format "int64"}} +// long validation +long {{../payloadVarName}} = {{../../../containerJsonPathPiece.pascalCase}}.{{../jsonPathPiece.pascalCase}}.validate( + {{else}} + {{#eq ../format "float"}} +// float validation +float {{../payloadVarName}} = {{../../../containerJsonPathPiece.pascalCase}}.{{../jsonPathPiece.pascalCase}}.validate( + {{else}} + {{#eq ../format "double"}} +// double validation +double {{../payloadVarName}} = {{../../../containerJsonPathPiece.pascalCase}}.{{../jsonPathPiece.pascalCase}}.validate( + {{else}} +// int validation +int {{../payloadVarName}} = {{../../../containerJsonPathPiece.pascalCase}}.{{../jsonPathPiece.pascalCase}}.validate( + {{/eq}} + {{/eq}} + {{/eq}} + {{else}} + {{#eq @key "boolean"}} +// boolean validation +boolean {{../payloadVarName}} = {{../../../containerJsonPathPiece.pascalCase}}.{{../jsonPathPiece.pascalCase}}.validate( + {{/eq}} + {{/eq}} + {{/eq}} + {{/eq}} + {{/eq}} + {{/eq}} +{{/eq}} + {{#with this}} + {{#and (eq type "array") ../arrayInputJsonPathPiece.pascalCase }} + new {{../../../containerJsonPathPiece.pascalCase}}.{{../arrayInputJsonPathPiece.pascalCase}}() + {{> src/main/kotlin/packagename/components/schemas/helpers/payload_renderer endChar="" constructor=true }} + .build(), + {{else}} + {{#and (eq type "object") ../mapInputJsonPathPiece.pascalCase }} + new {{../../../containerJsonPathPiece.pascalCase}}.{{../mapInputJsonPathPiece.pascalCase}}() + {{> src/main/kotlin/packagename/components/schemas/helpers/payload_renderer endChar="" constructor=true optionalProperties=../optionalProperties requiredProperties=../requiredProperties }} + .build(), + {{else}} + {{> src/main/kotlin/packagename/components/schemas/helpers/payload_renderer endChar="," }} + {{/and}} + {{/and}} + {{/with}} + {{../configVarName}} +); + {{/each}} \ No newline at end of file diff --git a/src/main/resources/kotlin/src/main/kotlin/packagename/components/securityschemes/SecurityScheme.hbs b/src/main/resources/kotlin/src/main/kotlin/packagename/components/securityschemes/SecurityScheme.hbs new file mode 100644 index 00000000000..2e1175d980c --- /dev/null +++ b/src/main/resources/kotlin/src/main/kotlin/packagename/components/securityschemes/SecurityScheme.hbs @@ -0,0 +1,138 @@ +package {{packageName}}.components.securityschemes; + +{{#with securityScheme}} + {{#if refInfo}} + {{! todo handle this}} +// todo handle refed security schemes + + {{else}} + {{#eq type "apiKey"}} + {{#eq in "cookie"}} +import {{packageName}}.securityschemes.ApiKeyCookieSecurityScheme; + {{else}} + {{#eq in "header"}} +import {{packageName}}.securityschemes.ApiKeyHeaderSecurityScheme; + {{else}} + {{#eq in "query"}} +import {{packageName}}.securityschemes.ApiKeyQuerySecurityScheme; + {{/eq}} + {{/eq}} + {{/eq}} + {{else}} + {{#eq type "http"}} + {{#eq scheme "basic"}} +import {{packageName}}.securityschemes.HttpBasicSecurityScheme; + {{else}} + {{#eq scheme "bearer"}} +import {{packageName}}.securityschemes.HttpBearerSecurityScheme; + {{else}} + {{#eq scheme "signature"}} +import {{packageName}}.securityschemes.HttpSignatureSecurityScheme; + {{/eq}} + {{/eq}} + {{/eq}} + {{else}} + {{#eq type "mutualTLS"}} +import {{packageName}}.securityschemes.MutualTlsSecurityScheme; + {{else}} + {{#eq type "oauth2"}} +import {{packageName}}.securityschemes.OAuth2SecurityScheme; + {{else}} + {{#eq type "openIdConnect"}} +import {{packageName}}.securityschemes.OpenIdConnectSecurityScheme; + {{/eq}} + {{/eq}} + {{/eq}} + {{/eq}} + {{/eq}} + + {{#eq type "apiKey"}} + {{#eq in "cookie"}} +public class {{jsonPathPiece.pascalCase}} extends ApiKeyCookieSecurityScheme { + {{else}} + {{#eq in "header"}} +public class {{jsonPathPiece.pascalCase}} extends ApiKeyHeaderSecurityScheme { + {{else}} + {{#eq in "query"}} +public class {{jsonPathPiece.pascalCase}} extends ApiKeyQuerySecurityScheme { + {{/eq}} + {{/eq}} + {{/eq}} + {{#if description}} + /* + {{description.original}} + */ + {{/if}} + {{#eq in "cookie"}} + public {{jsonPathPiece.pascalCase}}(String apiKey) { + super(apiKey, "{{{name}}}"); + } + {{else}} + {{#eq in "header"}} + public {{jsonPathPiece.pascalCase}}(String apiKey) { + super(apiKey, "{{{name}}}"); + } + {{else}} + {{#eq in "query"}} + public {{jsonPathPiece.pascalCase}}(String apiKey) { + super(apiKey, "{{{name}}}"); + } + {{/eq}} + {{/eq}} + {{/eq}} +} + {{else}} + {{#eq type "http"}} +public class {{jsonPathPiece.pascalCase}} extends Http{{#eq scheme "basic"}}Basic{{/eq}}{{#eq scheme "bearer"}}Bearer{{/eq}}{{#eq scheme "signature"}}Signature{{/eq}}{{#eq scheme "digest"}}Digest{{/eq}}SecurityScheme { + {{#if description}} + /* + {{description.original}} + */ + {{/if}} + {{#eq scheme "basic"}} + public {{jsonPathPiece.pascalCase}}(String userId, String password) { + super(userId, password); + } + {{else}} + {{#eq scheme "bearer"}} + public {{jsonPathPiece.pascalCase}}(String accessToken) { + super(accessToken, "{{{bearerFormat}}}"); + } + {{/eq}} + {{/eq}} +} + {{else}} + {{#eq type "mutualTLS"}} +public class {{jsonPathPiece.pascalCase}} extends MutualTlsSecurityScheme { + {{#if description}} + /* + {{description.original}} + */ + {{/if}} +} + {{else}} + {{#eq type "oauth2"}} +public class {{jsonPathPiece.pascalCase}} extends OAuth2SecurityScheme { + {{#if description}} + /* + {{description.original}} + */ + {{/if}} + // todo add flows info +} + {{else}} + {{#eq type "openIdConnect"}} +public class {{jsonPathPiece.pascalCase}} extends OpenIdConnectSecurityScheme { + {{#if description}} + /* + {{description.original}} + */ + {{/if}} +} + {{/eq}} + {{/eq}} + {{/eq}} + {{/eq}} + {{/eq}} + {{/if}} +{{/with}} diff --git a/src/main/resources/kotlin/src/main/kotlin/packagename/components/securityschemes/SecurityScheme_doc.hbs b/src/main/resources/kotlin/src/main/kotlin/packagename/components/securityschemes/SecurityScheme_doc.hbs new file mode 100644 index 00000000000..cdd2f4444e0 --- /dev/null +++ b/src/main/resources/kotlin/src/main/kotlin/packagename/components/securityschemes/SecurityScheme_doc.hbs @@ -0,0 +1,122 @@ +{{#with securityScheme}} + {{#if componentModule}} +{{packageName}}.components.securityschemes.{{jsonPathPiece.snakeCase}} + {{/if}} + {{#eq identifierPieces.size 0}} +{{> src/main/kotlin/packagename/components/_helper_header_from_identifier_pieces identifierPieces=(append identifierPieces "SecurityScheme" jsonPathPiece) }} + {{/eq}} + {{#if refInfo}} +| Ref Class | Description | +| --------- | ----------- | +| [{{refInfo.refClass}}](../../components/security_schemes/{{refInfo.refModule}}.{{refInfo.refClass}}.md#) |{{#with getDeepestRef}}{{#if description}} {{description.originalWithBr}}{{/if}}{{/with}} + {{else}} + +public class {{jsonPathPiece.pascalCase}} + {{#eq type "apiKey"}} + {{#eq in "cookie"}} +extends ApiKeyCookieSecurityScheme + {{else}} + {{#eq in "header"}} +extends ApiKeyHeaderSecurityScheme + {{else}} + {{#eq in "query"}} +extends ApiKeyQuerySecurityScheme + {{/eq}} + {{/eq}} + {{/eq}} + +{{> src/main/kotlin/packagename/components/securityschemes/_doc_descMethods }} + +{{headerSize}}## Constructor Summary +| Constructor and Description | +| --------------------------- | + {{#eq in "query"}} +| {{jsonPathPiece.pascalCase}}(String apiKey)
for query apiKey auth | + {{else}} + {{#eq in "header"}} +| {{jsonPathPiece.pascalCase}}(String apiKey)
for header apiKey auth | + {{else}} + {{#eq in "cookie"}} +| {{jsonPathPiece.pascalCase}}(String apiKey)
for cookie apiKey auth | + {{/eq}} + {{/eq}} + {{/eq}} + {{else}} + {{#eq type "http"}} + {{#eq scheme "basic"}} +extends HttpBasicSecurityScheme + {{else}} + {{#eq scheme "bearer"}} +extends HttpBearerSecurityScheme + {{else}} + {{#eq scheme "digest"}} +extends HttpDigestSecurityScheme + {{else}} + {{#eq scheme "signature"}} +extends HttpSignatureSecurityScheme + {{/eq}} + {{/eq}} + {{/eq}} + {{/eq}} + +{{> src/main/kotlin/packagename/components/securityschemes/_doc_descMethods }} + +{{headerSize}}## Constructor Summary +| Constructor and Description | +| --------------------------- | + {{#eq scheme "basic"}} +| {{jsonPathPiece.pascalCase}}(String userId, String password) | + {{else}} + {{#eq scheme "bearer"}} +| {{jsonPathPiece.pascalCase}}(String accessToken) | + {{else}} + {{#eq scheme "digest"}} +| todo | + {{else}} + {{#eq scheme "signature"}} +| todo | + {{/eq}} + {{/eq}} + {{/eq}} + {{/eq}} + {{else}} + {{#eq type "mutualTLS"}} +extends MutualTlsSecurityScheme + +{{> src/main/kotlin/packagename/components/securityschemes/_doc_descMethods }} + +{{headerSize}}## Constructor Summary +| Constructor and Description | +| --------------------------- | +| todo | + {{else}} + {{#eq type "oauth2"}} +extends Oauth2SecurityScheme + +{{> src/main/kotlin/packagename/components/securityschemes/_doc_descMethods }} + +{{headerSize}}## Constructor Summary +| Constructor and Description | +| --------------------------- | +| todo | + {{else}} + {{#eq type "openIdConnect"}} +extends OpenIdConnectSecurityScheme + +{{> src/main/kotlin/packagename/components/securityschemes/_doc_descMethods }} + +{{headerSize}}## Constructor Summary +| Constructor and Description | +| --------------------------- | +| todo | + {{/eq}} + {{/eq}} + {{/eq}} + {{/eq}} + {{/eq}} + {{#if componentModule}} + +[[Back to top]](#top) {{> _helper_footer_links readmePath="../../../" securitySchemesLink=true}} + {{/if}} + {{/if}} +{{/with}} \ No newline at end of file diff --git a/src/main/resources/kotlin/src/main/kotlin/packagename/components/securityschemes/_doc_descMethods.hbs b/src/main/resources/kotlin/src/main/kotlin/packagename/components/securityschemes/_doc_descMethods.hbs new file mode 100644 index 00000000000..1c8e6fdae62 --- /dev/null +++ b/src/main/resources/kotlin/src/main/kotlin/packagename/components/securityschemes/_doc_descMethods.hbs @@ -0,0 +1,11 @@ +A class that is used to apply auth to a request +{{#if description}} + +{{headerSize}}## Description +{{description.originalWithBr}} +{{/if}} + +{{headerSize}}## Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| void | applyAuth(Map> headers, String resourcePath, String method, HttpRequest.BodyPublisher bodyPublisher, @Nullable String queryParamsSuffix, List scopeNames) | diff --git a/src/main/resources/kotlin/src/main/kotlin/packagename/configurations/ApiConfiguration.hbs b/src/main/resources/kotlin/src/main/kotlin/packagename/configurations/ApiConfiguration.hbs new file mode 100644 index 00000000000..251dfb5e375 --- /dev/null +++ b/src/main/resources/kotlin/src/main/kotlin/packagename/configurations/ApiConfiguration.hbs @@ -0,0 +1,243 @@ +package {{{packageName}}}.configurations; + +{{#gt allSecurity.size 0}} +import {{{packageName}}}.securityrequirementobjects.SecurityRequirementObject; +{{/gt}} +import {{{packageName}}}.servers.Server; +{{#each allServers}} + {{#if subpackage}} +import {{{packageName}}}.{{subpackage}}.{{jsonPathPiece.pascalCase}}; + {{else}} +import {{packageName}}.{{jsonPathPiece.pascalCase}}; + {{/if}} +{{/each}} +{{#each allSecurity}} + {{#if subpackage}} +import {{{packageName}}}.{{subpackage}}.{{jsonPathPiece.pascalCase}}; + {{else}} +import {{packageName}}.{{jsonPathPiece.pascalCase}}; + {{/if}} +{{/each}} +{{#if securitySchemes}} +import {{packageName}}.securityschemes.SecurityScheme; +{{/if}} +import org.checkerframework.checker.nullness.qual.Nullable; + +import java.time.Duration; +import java.util.List; +import java.util.Map; +import java.util.Objects; +import java.util.HashMap; + +public class ApiConfiguration { + private final ServerInfo serverInfo; + private final ServerIndexInfo serverIndexInfo; + {{#gt allSecurity.size 0}} + private final SecurityInfo securityInfo; + private final SecurityIndexInfo securityIndexInfo; + {{/gt}} + private final @Nullable Duration timeout; + {{#if securitySchemes}} + private final Map, SecurityScheme> securitySchemeInfo; + {{/if}} + private final Map> defaultHeaders; + + public ApiConfiguration() { + serverInfo = new ServerInfoBuilder().build(); + serverIndexInfo = new ServerIndexInfoBuilder().build(); + {{#gt allSecurity.size 0}} + securityInfo = new SecurityInfo(); + securityIndexInfo = new SecurityIndexInfoBuilder().build(); + {{/gt}} + {{#if securitySchemes}} + securitySchemeInfo = new HashMap<>(); + {{/if}} + timeout = null; + defaultHeaders = new HashMap<>(); + } + + public ApiConfiguration(ServerInfo serverInfo, ServerIndexInfo serverIndexInfo{{#if securitySchemes}}, List securitySchemes{{/if}}{{#gt allSecurity.size 0}}, SecurityIndexInfo securityIndexInfo{{/gt}}, Duration timeout, Map> defaultHeaders) { + this.serverInfo = serverInfo; + this.serverIndexInfo = serverIndexInfo; + {{#gt allSecurity.size 0}} + this.securityInfo = new SecurityInfo(); + this.securityIndexInfo = securityIndexInfo; + {{/gt}} + {{#if securitySchemes}} + securitySchemeInfo = new HashMap<>(); + for (SecurityScheme securityScheme: securitySchemes) { + securitySchemeInfo.put(securityScheme.getClass(), securityScheme); + } + {{/if}} + this.timeout = timeout; + this.defaultHeaders = defaultHeaders; + } + + public static class ServerInfo { + {{#each allServers}} + final {{jsonPathPiece.pascalCase}}.{{jsonPathPiece.pascalCase}}1 {{jsonPathPiece.camelCase}}; + {{/each}} + + ServerInfo( + {{#each allServers}} + {{jsonPathPiece.pascalCase}}. @Nullable {{jsonPathPiece.pascalCase}}1 {{jsonPathPiece.camelCase}}{{#unless @last}},{{/unless}} + {{/each}} + ) { + {{#each allServers}} + this.{{jsonPathPiece.camelCase}} = Objects.requireNonNullElse({{jsonPathPiece.camelCase}}, new {{jsonPathPiece.pascalCase}}.{{jsonPathPiece.pascalCase}}Builder().build()); + {{/each}} + } + } + + public static class ServerInfoBuilder { + {{#each allServers}} + private {{jsonPathPiece.pascalCase}}. @Nullable {{jsonPathPiece.pascalCase}}1 {{jsonPathPiece.camelCase}}; + {{/each}} + public ServerInfoBuilder() {} + {{#each allServers}} + + public ServerInfoBuilder {{jsonPathPiece.camelCase}}({{jsonPathPiece.pascalCase}}.{{jsonPathPiece.pascalCase}}1 {{jsonPathPiece.camelCase}}) { + this.{{jsonPathPiece.camelCase}} = {{jsonPathPiece.camelCase}}; + return this; + } + {{/each}} + + public ServerInfo build() { + return new ServerInfo( + {{#each allServers}} + {{jsonPathPiece.camelCase}}{{#unless @last}},{{/unless}} + {{/each}} + ); + } + } + + public static class ServerIndexInfo { + {{#each allServers}} + final {{jsonPathPiece.pascalCase}}.ServerIndex {{jsonPathPiece.camelCase}}ServerIndex; + {{/each}} + + ServerIndexInfo( + {{#each allServers}} + {{jsonPathPiece.pascalCase}}. @Nullable ServerIndex {{jsonPathPiece.camelCase}}ServerIndex{{#unless @last}},{{/unless}} + {{/each}} + ) { + {{#each allServers}} + this.{{jsonPathPiece.camelCase}}ServerIndex = Objects.requireNonNullElse({{jsonPathPiece.camelCase}}ServerIndex, {{jsonPathPiece.pascalCase}}.ServerIndex.SERVER_0); + {{/each}} + } + } + + public static class ServerIndexInfoBuilder { + {{#each allServers}} + private {{jsonPathPiece.pascalCase}}. @Nullable ServerIndex {{jsonPathPiece.camelCase}}ServerIndex; + {{/each}} + public ServerIndexInfoBuilder() {} + {{#each allServers}} + + public ServerIndexInfoBuilder {{jsonPathPiece.camelCase}}ServerIndex({{jsonPathPiece.pascalCase}}.ServerIndex serverIndex) { + this.{{jsonPathPiece.camelCase}}ServerIndex = serverIndex; + return this; + } + {{/each}} + + public ServerIndexInfo build() { + return new ServerIndexInfo( + {{#each allServers}} + {{jsonPathPiece.camelCase}}ServerIndex{{#unless @last}},{{/unless}} + {{/each}} + ); + } + } + {{#each allServers}} + + public Server getServer({{jsonPathPiece.pascalCase}}. @Nullable ServerIndex serverIndex) { + var serverProvider = serverInfo.{{jsonPathPiece.camelCase}}; + if (serverIndex == null) { + {{jsonPathPiece.pascalCase}}.ServerIndex configServerIndex = serverIndexInfo.{{jsonPathPiece.camelCase}}ServerIndex; + return serverProvider.getServer(configServerIndex); + } + return serverProvider.getServer(serverIndex); + } + {{/each}} + {{#gt allSecurity.size 0}} + + public static class SecurityInfo { + {{#each allSecurity}} + protected final {{jsonPathPiece.pascalCase}}.{{jsonPathPiece.pascalCase}}1 {{jsonPathPiece.camelCase}}; + {{/each}} + + public SecurityInfo() { + {{#each allSecurity}} + this.{{jsonPathPiece.camelCase}} = new {{jsonPathPiece.pascalCase}}.{{jsonPathPiece.pascalCase}}1(); + {{/each}} + } + } + + public static class SecurityIndexInfo { + {{#each allSecurity}} + final {{jsonPathPiece.pascalCase}}.SecurityIndex {{jsonPathPiece.camelCase}}SecurityIndex; + {{/each}} + + SecurityIndexInfo( + {{#each allSecurity}} + {{jsonPathPiece.pascalCase}}. @Nullable SecurityIndex {{jsonPathPiece.camelCase}}SecurityIndex{{#unless @last}},{{/unless}} + {{/each}} + ) { + {{#each allSecurity}} + this.{{jsonPathPiece.camelCase}}SecurityIndex = Objects.requireNonNullElse({{jsonPathPiece.camelCase}}SecurityIndex, {{jsonPathPiece.pascalCase}}.SecurityIndex.SECURITY_0); + {{/each}} + } + } + + public static class SecurityIndexInfoBuilder { + {{#each allSecurity}} + private {{jsonPathPiece.pascalCase}}. @Nullable SecurityIndex {{jsonPathPiece.camelCase}}SecurityIndex; + {{/each}} + public SecurityIndexInfoBuilder() {} + {{#each allSecurity}} + + public SecurityIndexInfoBuilder {{jsonPathPiece.camelCase}}SecurityIndex({{jsonPathPiece.pascalCase}}.SecurityIndex securityIndex) { + this.{{jsonPathPiece.camelCase}}SecurityIndex = securityIndex; + return this; + } + {{/each}} + + public SecurityIndexInfo build() { + return new SecurityIndexInfo( + {{#each allSecurity}} + {{jsonPathPiece.camelCase}}SecurityIndex{{#unless @last}},{{/unless}} + {{/each}} + ); + } + } + + {{#each allSecurity}} + public SecurityRequirementObject getSecurityRequirementObject({{jsonPathPiece.pascalCase}}. @Nullable SecurityIndex securityIndex) { + var securityInfoInstance = securityInfo.{{jsonPathPiece.camelCase}}; + if (securityIndex == null) { + {{jsonPathPiece.pascalCase}}.SecurityIndex configSecurityIndex = securityIndexInfo.{{jsonPathPiece.camelCase}}SecurityIndex; + return securityInfoInstance.getSecurityRequirementObject(configSecurityIndex); + } + return securityInfoInstance.getSecurityRequirementObject(securityIndex); + } + {{/each}} + {{/gt}} + {{#if securitySchemes}} + + public SecurityScheme getSecurityScheme(Class securitySchemeClass) { + @Nullable SecurityScheme securityScheme = securitySchemeInfo.get(securitySchemeClass); + if (securityScheme == null) { + throw new RuntimeException("SecurityScheme of class " + securitySchemeClass + "cannot be returned because it is unset. Pass in an instance of it in securitySchemes when instantiating ApiConfiguration."); + } + return securityScheme; + } + {{/if}} + + public Map> getDefaultHeaders() { + return defaultHeaders; + } + + public @Nullable Duration getTimeout() { + return timeout; + } +} \ No newline at end of file diff --git a/src/main/resources/kotlin/src/main/kotlin/packagename/configurations/JsonSchemaKeywordFlags.hbs b/src/main/resources/kotlin/src/main/kotlin/packagename/configurations/JsonSchemaKeywordFlags.hbs new file mode 100644 index 00000000000..8301c727ef8 --- /dev/null +++ b/src/main/resources/kotlin/src/main/kotlin/packagename/configurations/JsonSchemaKeywordFlags.hbs @@ -0,0 +1,334 @@ +package {{{packageName}}}.configurations; + +import java.util.LinkedHashSet; + +public record JsonSchemaKeywordFlags( + boolean additionalProperties, + boolean allOf, + boolean anyOf, + boolean const_, + boolean contains, + boolean dependentRequired, + boolean dependentSchemas, + boolean discriminator, + boolean else_, + boolean enum_, + boolean exclusiveMaximum, + boolean exclusiveMinimum, + boolean format, + boolean if_, + boolean maximum, + boolean minimum, + boolean items, + boolean maxContains, + boolean maxItems, + boolean maxLength, + boolean maxProperties, + boolean minContains, + boolean minItems, + boolean minLength, + boolean minProperties, + boolean multipleOf, + boolean not, + boolean oneOf, + boolean pattern, + boolean patternProperties, + boolean prefixItems, + boolean properties, + boolean propertyNames, + boolean required, + boolean then, + boolean type, + boolean uniqueItems, + boolean unevaluatedItems, + boolean unevaluatedProperties + ) { + + public LinkedHashSet getKeywords() { + LinkedHashSet enabledKeywords = new LinkedHashSet<>(); + if (additionalProperties) { enabledKeywords.add("additionalProperties"); } + if (allOf) { enabledKeywords.add("allOf"); } + if (anyOf) { enabledKeywords.add("anyOf"); } + if (const_) { enabledKeywords.add("const"); } + if (contains) { enabledKeywords.add("contains"); } + if (dependentRequired) { enabledKeywords.add("dependentRequired"); } + if (dependentSchemas) { enabledKeywords.add("dependentSchemas"); } + if (discriminator) { enabledKeywords.add("discriminator"); } + if (else_) { enabledKeywords.add("else_"); } + if (enum_) { enabledKeywords.add("enum_"); } + if (exclusiveMaximum) { enabledKeywords.add("exclusiveMaximum"); } + if (exclusiveMinimum) { enabledKeywords.add("exclusiveMinimum"); } + if (format) { enabledKeywords.add("format"); } + if (if_) { enabledKeywords.add("if_"); } + if (maximum) { enabledKeywords.add("maximum"); } + if (minimum) { enabledKeywords.add("minimum"); } + if (items) { enabledKeywords.add("items"); } + if (maxContains) { enabledKeywords.add("maxContains"); } + if (maxItems) { enabledKeywords.add("maxItems"); } + if (maxLength) { enabledKeywords.add("maxLength"); } + if (maxProperties) { enabledKeywords.add("maxProperties"); } + if (minContains) { enabledKeywords.add("minContains"); } + if (minItems) { enabledKeywords.add("minItems"); } + if (minLength) { enabledKeywords.add("minLength"); } + if (minProperties) { enabledKeywords.add("minProperties"); } + if (multipleOf) { enabledKeywords.add("multipleOf"); } + if (not) { enabledKeywords.add("not"); } + if (oneOf) { enabledKeywords.add("oneOf"); } + if (pattern) { enabledKeywords.add("pattern"); } + if (patternProperties) { enabledKeywords.add("patternProperties"); } + if (prefixItems) { enabledKeywords.add("prefixItems"); } + if (properties) { enabledKeywords.add("properties"); } + if (propertyNames) { enabledKeywords.add("propertyNames"); } + if (required) { enabledKeywords.add("required"); } + if (then) { enabledKeywords.add("then"); } + if (type) { enabledKeywords.add("type"); } + if (uniqueItems) { enabledKeywords.add("uniqueItems"); } + if (unevaluatedItems) { enabledKeywords.add("unevaluatedItems"); } + if (unevaluatedProperties) { enabledKeywords.add("unevaluatedProperties"); } + return enabledKeywords; + } + + public static class Builder { + private boolean additionalProperties; + private boolean allOf; + private boolean anyOf; + private boolean const_; + private boolean contains; + private boolean dependentRequired; + private boolean dependentSchemas; + private boolean discriminator; + private boolean else_; + private boolean enum_; + private boolean exclusiveMaximum; + private boolean exclusiveMinimum; + private boolean format; + private boolean if_; + private boolean maximum; + private boolean minimum; + private boolean items; + private boolean maxContains; + private boolean maxItems; + private boolean maxLength; + private boolean maxProperties; + private boolean minContains; + private boolean minItems; + private boolean minLength; + private boolean minProperties; + private boolean multipleOf; + private boolean not; + private boolean oneOf; + private boolean pattern; + private boolean patternProperties; + private boolean prefixItems; + private boolean properties; + private boolean propertyNames; + private boolean required; + private boolean then; + private boolean type; + private boolean uniqueItems; + private boolean unevaluatedItems; + private boolean unevaluatedProperties; + + public Builder() {} + + public Builder additionalProperties() { + additionalProperties = true; + return this; + } + public Builder allOf() { + allOf = true; + return this; + } + public Builder anyOf() { + anyOf = true; + return this; + } + public Builder const_() { + const_ = true; + return this; + } + public Builder contains() { + contains = true; + return this; + } + public Builder dependentRequired() { + dependentRequired = true; + return this; + } + public Builder dependentSchemas() { + dependentSchemas = true; + return this; + } + public Builder discriminator() { + discriminator = true; + return this; + } + public Builder else_() { + else_ = true; + return this; + } + public Builder enum_() { + enum_ = true; + return this; + } + public Builder exclusiveMaximum() { + exclusiveMaximum = true; + return this; + } + public Builder exclusiveMinimum() { + exclusiveMinimum = true; + return this; + } + public Builder format() { + format = true; + return this; + } + public Builder if_() { + if_ = true; + return this; + } + public Builder maximum() { + maximum = true; + return this; + } + public Builder minimum() { + minimum = true; + return this; + } + public Builder items() { + items = true; + return this; + } + public Builder maxContains() { + maxContains = true; + return this; + } + public Builder maxItems() { + maxItems = true; + return this; + } + public Builder maxLength() { + maxLength = true; + return this; + } + public Builder maxProperties() { + maxProperties = true; + return this; + } + public Builder minContains() { + minContains = true; + return this; + } + public Builder minItems() { + minItems = true; + return this; + } + public Builder minLength() { + minLength = true; + return this; + } + public Builder minProperties() { + minProperties = true; + return this; + } + public Builder multipleOf() { + multipleOf = true; + return this; + } + public Builder not() { + not = true; + return this; + } + public Builder oneOf() { + oneOf = true; + return this; + } + public Builder pattern() { + pattern = true; + return this; + } + public Builder patternProperties() { + patternProperties = true; + return this; + } + public Builder prefixItems() { + prefixItems = true; + return this; + } + public Builder properties() { + properties = true; + return this; + } + public Builder propertyNames() { + propertyNames = true; + return this; + } + public Builder required() { + required = true; + return this; + } + public Builder then() { + then = true; + return this; + } + public Builder type() { + type = true; + return this; + } + public Builder uniqueItems() { + uniqueItems = true; + return this; + } + public Builder unevaluatedItems() { + unevaluatedItems = true; + return this; + } + public Builder unevaluatedProperties() { + unevaluatedProperties = true; + return this; + } + public JsonSchemaKeywordFlags build() { + return new JsonSchemaKeywordFlags( + additionalProperties, + allOf, + anyOf, + const_, + contains, + dependentRequired, + dependentSchemas, + discriminator, + else_, + enum_, + exclusiveMaximum, + exclusiveMinimum, + format, + if_, + maximum, + minimum, + items, + maxContains, + maxItems, + maxLength, + maxProperties, + minContains, + minItems, + minLength, + minProperties, + multipleOf, + not, + oneOf, + pattern, + patternProperties, + prefixItems, + properties, + propertyNames, + required, + then, + type, + uniqueItems, + unevaluatedItems, + unevaluatedProperties + ); + } + } +} \ No newline at end of file diff --git a/src/main/resources/kotlin/src/main/kotlin/packagename/configurations/SchemaConfiguration.hbs b/src/main/resources/kotlin/src/main/kotlin/packagename/configurations/SchemaConfiguration.hbs new file mode 100644 index 00000000000..c63928c0d7f --- /dev/null +++ b/src/main/resources/kotlin/src/main/kotlin/packagename/configurations/SchemaConfiguration.hbs @@ -0,0 +1,4 @@ +package {{{packageName}}}.configurations; + +public record SchemaConfiguration(JsonSchemaKeywordFlags disabledKeywordFlags) { +} \ No newline at end of file diff --git a/src/main/resources/kotlin/src/main/kotlin/packagename/contenttype/ContentTypeDeserializer.hbs b/src/main/resources/kotlin/src/main/kotlin/packagename/contenttype/ContentTypeDeserializer.hbs new file mode 100644 index 00000000000..e5b81809466 --- /dev/null +++ b/src/main/resources/kotlin/src/main/kotlin/packagename/contenttype/ContentTypeDeserializer.hbs @@ -0,0 +1,18 @@ +package {{{packageName}}}.contenttype; + +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.ToNumberPolicy; +import org.checkerframework.checker.nullness.qual.Nullable; + +public class ContentTypeDeserializer { + private static final Gson gson = new GsonBuilder() + .setObjectToNumberStrategy(ToNumberPolicy.LONG_OR_DOUBLE) + .setNumberToNumberStrategy(ToNumberPolicy.LONG_OR_DOUBLE) + .create(); + + @SuppressWarnings("nullness") + public static @Nullable Object fromJson(String json) { + return gson.fromJson(json, Object.class); + } +} diff --git a/src/main/resources/kotlin/src/main/kotlin/packagename/contenttype/ContentTypeDetector.hbs b/src/main/resources/kotlin/src/main/kotlin/packagename/contenttype/ContentTypeDetector.hbs new file mode 100644 index 00000000000..a3ff25132bd --- /dev/null +++ b/src/main/resources/kotlin/src/main/kotlin/packagename/contenttype/ContentTypeDetector.hbs @@ -0,0 +1,18 @@ +package {{{packageName}}}.contenttype; + +import java.util.regex.Pattern; + +public class ContentTypeDetector { + private static final Pattern jsonContentTypePattern = Pattern.compile( + "application/[^+]*[+]?(json);?.*" + ); + private static final String textPlainContentType = "text/plain"; + + public static boolean contentTypeIsJson(String contentType) { + return jsonContentTypePattern.matcher(contentType).find(); + } + + public static boolean contentTypeIsTextPlain(String contentType) { + return textPlainContentType.equals(contentType); + } +} \ No newline at end of file diff --git a/src/main/resources/kotlin/src/main/kotlin/packagename/contenttype/ContentTypeSerializer.hbs b/src/main/resources/kotlin/src/main/kotlin/packagename/contenttype/ContentTypeSerializer.hbs new file mode 100644 index 00000000000..0302192e32e --- /dev/null +++ b/src/main/resources/kotlin/src/main/kotlin/packagename/contenttype/ContentTypeSerializer.hbs @@ -0,0 +1,18 @@ +package {{{packageName}}}.contenttype; + +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.ToNumberPolicy; +import org.checkerframework.checker.nullness.qual.Nullable; + +public class ContentTypeSerializer { + private static final Gson gson = new GsonBuilder() + .setObjectToNumberStrategy(ToNumberPolicy.LONG_OR_DOUBLE) + .setNumberToNumberStrategy(ToNumberPolicy.LONG_OR_DOUBLE) + .create(); + + @SuppressWarnings("nullness") + public static String toJson(@Nullable Object body) { + return gson.toJson(body); + } +} diff --git a/src/main/resources/kotlin/src/main/kotlin/packagename/exceptions/ApiException.hbs b/src/main/resources/kotlin/src/main/kotlin/packagename/exceptions/ApiException.hbs new file mode 100644 index 00000000000..76c683b4c5a --- /dev/null +++ b/src/main/resources/kotlin/src/main/kotlin/packagename/exceptions/ApiException.hbs @@ -0,0 +1,13 @@ +package {{{packageName}}}.exceptions; + +import java.net.http.HttpResponse; + +@SuppressWarnings("serial") +public class ApiException extends BaseException { + public HttpResponse response; + + public ApiException(String s, HttpResponse response) { + super(s); + this.response = response; + } +} \ No newline at end of file diff --git a/src/main/resources/kotlin/src/main/kotlin/packagename/exceptions/BaseException.hbs b/src/main/resources/kotlin/src/main/kotlin/packagename/exceptions/BaseException.hbs new file mode 100644 index 00000000000..d678e2fcaff --- /dev/null +++ b/src/main/resources/kotlin/src/main/kotlin/packagename/exceptions/BaseException.hbs @@ -0,0 +1,8 @@ +package {{{packageName}}}.exceptions; + +@SuppressWarnings("serial") +public class BaseException extends Exception { + public BaseException(String s) { + super(s); + } +} \ No newline at end of file diff --git a/src/main/resources/kotlin/src/main/kotlin/packagename/exceptions/InvalidAdditionalPropertyException.hbs b/src/main/resources/kotlin/src/main/kotlin/packagename/exceptions/InvalidAdditionalPropertyException.hbs new file mode 100644 index 00000000000..6567ff7ad8f --- /dev/null +++ b/src/main/resources/kotlin/src/main/kotlin/packagename/exceptions/InvalidAdditionalPropertyException.hbs @@ -0,0 +1,8 @@ +package {{{packageName}}}.exceptions; + +@SuppressWarnings("serial") +public class InvalidAdditionalPropertyException extends BaseException { + public InvalidAdditionalPropertyException(String s) { + super(s); + } +} \ No newline at end of file diff --git a/src/main/resources/kotlin/src/main/kotlin/packagename/exceptions/NotImplementedException.hbs b/src/main/resources/kotlin/src/main/kotlin/packagename/exceptions/NotImplementedException.hbs new file mode 100644 index 00000000000..00cdf1273d6 --- /dev/null +++ b/src/main/resources/kotlin/src/main/kotlin/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/kotlin/src/main/kotlin/packagename/exceptions/UnsetPropertyException.hbs b/src/main/resources/kotlin/src/main/kotlin/packagename/exceptions/UnsetPropertyException.hbs new file mode 100644 index 00000000000..16504af69fd --- /dev/null +++ b/src/main/resources/kotlin/src/main/kotlin/packagename/exceptions/UnsetPropertyException.hbs @@ -0,0 +1,8 @@ +package {{{packageName}}}.exceptions; + +@SuppressWarnings("serial") +public class UnsetPropertyException extends BaseException { + public UnsetPropertyException(String s) { + super(s); + } +} \ No newline at end of file diff --git a/src/main/resources/kotlin/src/main/kotlin/packagename/exceptions/ValidationException.hbs b/src/main/resources/kotlin/src/main/kotlin/packagename/exceptions/ValidationException.hbs new file mode 100644 index 00000000000..c0be4e3d42c --- /dev/null +++ b/src/main/resources/kotlin/src/main/kotlin/packagename/exceptions/ValidationException.hbs @@ -0,0 +1,8 @@ +package {{{packageName}}}.exceptions; + +@SuppressWarnings("serial") +public class ValidationException extends BaseException { + public ValidationException(String s) { + super(s); + } +} \ No newline at end of file diff --git a/src/main/resources/kotlin/src/main/kotlin/packagename/header/ContentHeader.hbs b/src/main/resources/kotlin/src/main/kotlin/packagename/header/ContentHeader.hbs new file mode 100644 index 00000000000..83631bb6e09 --- /dev/null +++ b/src/main/resources/kotlin/src/main/kotlin/packagename/header/ContentHeader.hbs @@ -0,0 +1,59 @@ +package {{{packageName}}}.header; + +import org.checkerframework.checker.nullness.qual.Nullable; +import {{{packageName}}}.configurations.SchemaConfiguration; +import {{{packageName}}}.contenttype.ContentTypeDetector; +import {{{packageName}}}.contenttype.ContentTypeSerializer; +import {{{packageName}}}.contenttype.ContentTypeDeserializer; +import {{{packageName}}}.exceptions.NotImplementedException; +import {{{packageName}}}.exceptions.ValidationException; +import {{{packageName}}}.mediatype.MediaType; +import {{{packageName}}}.parameter.ParameterStyle; + +import java.net.http.HttpHeaders; +import java.util.List; +import java.util.Map; +import java.util.AbstractMap; +import java.util.function.BiPredicate; + +public class ContentHeader extends HeaderBase implements Header { + public final AbstractMap.SimpleEntry> content; + + public ContentHeader(boolean required, @Nullable Boolean allowReserved, @Nullable Boolean explode, AbstractMap.SimpleEntry> content) { + super(required, ParameterStyle.SIMPLE, explode, allowReserved); + this.content = content; + } + + private static HttpHeaders toHeaders(String name, String value) { + Map> map = Map.of(name, List.of(value)); + BiPredicate headerFilter = (key, val) -> true; + return HttpHeaders.of(map, headerFilter); + } + + @Override + public HttpHeaders serialize(@Nullable Object inData, String name, boolean validate, SchemaConfiguration configuration) throws NotImplementedException, ValidationException { + var castInData = validate ? content.getValue().schema().validate(inData, configuration) : inData ; + String contentType = content.getKey(); + if (ContentTypeDetector.contentTypeIsJson(contentType)) { + var value = ContentTypeSerializer.toJson(castInData); + return toHeaders(name, value); + } else { + throw new NotImplementedException("Serialization of "+contentType+" has not yet been implemented"); + } + } + + @Override + public @Nullable Object deserialize(List inData, boolean validate, SchemaConfiguration configuration) throws NotImplementedException, ValidationException { + String inDataJoined = String.join(",", inData); // unsure if this is needed + @Nullable Object deserializedJson = ContentTypeDeserializer.fromJson(inDataJoined); + if (validate) { + String contentType = content.getKey(); + if (ContentTypeDetector.contentTypeIsJson(contentType)) { + return content.getValue().schema().validate(deserializedJson, configuration); + } else { + throw new NotImplementedException("Header deserialization of "+contentType+" has not yet been implemented"); + } + } + return deserializedJson; + } +} \ No newline at end of file diff --git a/src/main/resources/kotlin/src/main/kotlin/packagename/header/Header.hbs b/src/main/resources/kotlin/src/main/kotlin/packagename/header/Header.hbs new file mode 100644 index 00000000000..f9bbeae3a7a --- /dev/null +++ b/src/main/resources/kotlin/src/main/kotlin/packagename/header/Header.hbs @@ -0,0 +1,14 @@ +package {{{packageName}}}.header; + +import org.checkerframework.checker.nullness.qual.Nullable; +import {{{packageName}}}.configurations.SchemaConfiguration; +import {{{packageName}}}.exceptions.NotImplementedException; +import {{{packageName}}}.exceptions.ValidationException; + +import java.net.http.HttpHeaders; +import java.util.List; + +public interface Header { + HttpHeaders serialize(@Nullable Object inData, String name, boolean validate, SchemaConfiguration configuration) throws NotImplementedException, ValidationException; + @Nullable Object deserialize(List inData, boolean validate, SchemaConfiguration configuration) throws NotImplementedException, ValidationException; +} \ No newline at end of file diff --git a/src/main/resources/kotlin/src/main/kotlin/packagename/header/HeaderBase.hbs b/src/main/resources/kotlin/src/main/kotlin/packagename/header/HeaderBase.hbs new file mode 100644 index 00000000000..5cceec00321 --- /dev/null +++ b/src/main/resources/kotlin/src/main/kotlin/packagename/header/HeaderBase.hbs @@ -0,0 +1,18 @@ +package {{{packageName}}}.header; + +import org.checkerframework.checker.nullness.qual.Nullable; +import {{{packageName}}}.parameter.ParameterStyle; + +public class HeaderBase { + public final boolean required; + public final @Nullable ParameterStyle style; + public final @Nullable Boolean explode; + public final @Nullable Boolean allowReserved; + + public HeaderBase(boolean required, @Nullable ParameterStyle style, @Nullable Boolean explode, @Nullable Boolean allowReserved) { + this.required = required; + this.style = style; + this.explode = explode; + this.allowReserved = allowReserved; + } +} \ No newline at end of file diff --git a/src/main/resources/kotlin/src/main/kotlin/packagename/header/PrefixSeparatorIterator.hbs b/src/main/resources/kotlin/src/main/kotlin/packagename/header/PrefixSeparatorIterator.hbs new file mode 100644 index 00000000000..a1c542e9408 --- /dev/null +++ b/src/main/resources/kotlin/src/main/kotlin/packagename/header/PrefixSeparatorIterator.hbs @@ -0,0 +1,27 @@ +package {{{packageName}}}.header; + +import java.util.Set; + +public class PrefixSeparatorIterator { + // A class to store prefixes and separators for rfc6570 expansions + public final String prefix; + public final String separator; + private boolean first; + public final String itemSeparator; + private static final Set reusedSeparators = Set.of(".", "|", "%20"); + + public PrefixSeparatorIterator(String prefix, String separator) { + this.prefix = prefix; + this.separator = separator; + itemSeparator = reusedSeparators.contains(separator) ? separator : ","; + first = true; + } + + public String next() { + if (first) { + first = false; + return prefix; + } + return separator; + } +} diff --git a/src/main/resources/kotlin/src/main/kotlin/packagename/header/Rfc6570Serializer.hbs b/src/main/resources/kotlin/src/main/kotlin/packagename/header/Rfc6570Serializer.hbs new file mode 100644 index 00000000000..d17e18e5c43 --- /dev/null +++ b/src/main/resources/kotlin/src/main/kotlin/packagename/header/Rfc6570Serializer.hbs @@ -0,0 +1,197 @@ +package {{{packageName}}}.header; + +import org.checkerframework.checker.nullness.qual.Nullable; +import {{{packageName}}}.exceptions.NotImplementedException; + +import java.io.UnsupportedEncodingException; +import java.net.URLEncoder; +import java.util.ArrayList; +import java.util.LinkedHashMap; +import java.util.List; +import java.util.Map; +import java.util.Set; +import java.util.stream.Collectors; + +public class Rfc6570Serializer { + private static final String ENCODING = "UTF-8"; + private static final Set namedParameterSeparators = Set.of("&", ";"); + + private static String percentEncode(String s) throws NotImplementedException { + if (s == null) { + return ""; + } + try { + return URLEncoder.encode(s, ENCODING) + // OAuth encodes some characters differently: + .replace("+", "%20").replace("*", "%2A") + .replace("%7E", "~"); + // This could be done faster with more hand-crafted code. + } catch (UnsupportedEncodingException wow) { + @Nullable String msg = wow.getMessage(); + if (msg == null) { + throw new NotImplementedException("UnsupportedEncodingException thrown"); + } + throw new NotImplementedException(msg); + } + } + + private static @Nullable String rfc6570ItemValue(@Nullable Object item, boolean percentEncode) throws NotImplementedException { + /* + Get representation if str/float/int/None/items in list/ values in dict + None is returned if an item is undefined, use cases are value= + - None + - [] + - {} + - [None, None None] + - {'a': None, 'b': None} + */ + if (item instanceof String stringItem) { + if (percentEncode) { + return percentEncode(stringItem); + } + return stringItem; + } else if (item instanceof Number numberItem) { + return numberItem.toString(); + } else if (item == null) { + // ignored by the expansion process https://datatracker.ietf.org/doc/html/rfc6570#section-3.2.1 + return null; + } else if (item instanceof List && ((List) item).isEmpty()) { + // ignored by the expansion process https://datatracker.ietf.org/doc/html/rfc6570#section-3.2.1 + return null; + } else if (item instanceof Map && ((Map) item).isEmpty()) { + // ignored by the expansion process https://datatracker.ietf.org/doc/html/rfc6570#section-3.2.1 + return null; + } + throw new NotImplementedException("Unable to generate a rfc6570 item representation of "+item); + } + + private static String rfc6570StrNumberExpansion( + @Nullable Object inData, + boolean percentEncode, + PrefixSeparatorIterator prefixSeparatorIterator, + String varNamePiece, + boolean namedParameterExpansion + ) throws NotImplementedException { + var itemValue = rfc6570ItemValue(inData, percentEncode); + if (itemValue == null || (itemValue.isEmpty() && prefixSeparatorIterator.separator.equals(";"))) { + return prefixSeparatorIterator.next() + varNamePiece; + } + var valuePairEquals = namedParameterExpansion ? "=" : ""; + return prefixSeparatorIterator.next() + varNamePiece + valuePairEquals + itemValue; + } + + private static String rfc6570ListExpansion( + List inData, + boolean explode, + boolean percentEncode, + PrefixSeparatorIterator prefixSeparatorIterator, + String varNamePiece, + boolean namedParameterExpansion + ) throws NotImplementedException { + List itemValues = new ArrayList<>(); + for (Object v: inData) { + @Nullable String value = rfc6570ItemValue(v, percentEncode); + if (value == null) { + continue; + } + itemValues.add(value); + } + if (itemValues.isEmpty()) { + // ignored by the expansion process https://datatracker.ietf.org/doc/html/rfc6570#section-3.2.1 + return ""; + } + var valuePairEquals = namedParameterExpansion ? "=" : ""; + if (!explode) { + return ( + prefixSeparatorIterator.next() + + varNamePiece + + valuePairEquals + + String.join(prefixSeparatorIterator.itemSeparator, itemValues) + ); + } + // exploded + return prefixSeparatorIterator.next() + itemValues.stream().map(v -> varNamePiece + valuePairEquals + v).collect(Collectors.joining(prefixSeparatorIterator.next())); + } + + private static String rfc6570MapExpansion( + Map inData, + boolean explode, + boolean percentEncode, + PrefixSeparatorIterator prefixSeparatorIterator, + String varNamePiece, + boolean namedParameterExpansion + ) throws NotImplementedException { + Map inDataMap = new LinkedHashMap<>(); + for (Map.Entry entry: inData.entrySet()) { + @Nullable String value = rfc6570ItemValue(entry.getValue(), percentEncode); + if (value == null) { + continue; + } + @Nullable Object key = entry.getKey(); + if (!(key instanceof String strKey)) { + continue; + } + inDataMap.put(strKey, value); + } + if (inDataMap.isEmpty()) { + // ignored by the expansion process https://datatracker.ietf.org/doc/html/rfc6570#section-3.2.1 + return ""; + } + var valuePairEquals = namedParameterExpansion ? "=" : ""; + if (!explode) { + return prefixSeparatorIterator.next() + + varNamePiece + + valuePairEquals + + inDataMap.entrySet().stream().map(e -> e.getKey()+prefixSeparatorIterator.itemSeparator+e.getValue()).collect(Collectors.joining(prefixSeparatorIterator.itemSeparator)); + } + // exploded + return prefixSeparatorIterator.next() + inDataMap.entrySet().stream().map(e -> e.getKey() + "=" + e.getValue()).collect(Collectors.joining(prefixSeparatorIterator.next())); + } + + protected static String rfc6570Expansion( + String variableName, + @Nullable Object inData, + boolean explode, + boolean percentEncode, + PrefixSeparatorIterator prefixSeparatorIterator + ) throws NotImplementedException { + /* + Separator is for separate variables like dict with explode true, + not for array item separation + */ + var namedParameterExpansion = namedParameterSeparators.contains(prefixSeparatorIterator.separator); + var varNamePiece = namedParameterExpansion ? variableName : ""; + if (inData instanceof Number || inData instanceof String) { + return rfc6570StrNumberExpansion( + inData, + percentEncode, + prefixSeparatorIterator, + varNamePiece, + namedParameterExpansion + ); + } else if (inData == null) { + // ignored by the expansion process https://datatracker.ietf.org/doc/html/rfc6570#section-3.2.1 + return ""; + } else if (inData instanceof List listData) { + return rfc6570ListExpansion( + listData, + explode, + percentEncode, + prefixSeparatorIterator, + varNamePiece, + namedParameterExpansion + ); + } else if (inData instanceof Map mapData) { + return rfc6570MapExpansion( + mapData, + explode, + percentEncode, + prefixSeparatorIterator, + varNamePiece, + namedParameterExpansion + ); + } + // bool, bytes, etc + throw new NotImplementedException("Unable to generate a rfc6570 representation of "+inData); + } +} \ No newline at end of file diff --git a/src/main/resources/kotlin/src/main/kotlin/packagename/header/SchemaHeader.hbs b/src/main/resources/kotlin/src/main/kotlin/packagename/header/SchemaHeader.hbs new file mode 100644 index 00000000000..1544ff1d21c --- /dev/null +++ b/src/main/resources/kotlin/src/main/kotlin/packagename/header/SchemaHeader.hbs @@ -0,0 +1,97 @@ +package {{{packageName}}}.header; + +import org.checkerframework.checker.nullness.qual.Nullable; +import {{{packageName}}}.configurations.SchemaConfiguration; +import {{{packageName}}}.contenttype.ContentTypeDeserializer; +import {{{packageName}}}.exceptions.NotImplementedException; +import {{{packageName}}}.exceptions.ValidationException; +import {{{packageName}}}.parameter.ParameterStyle; +import {{{packageName}}}.schemas.validation.JsonSchema; +import {{{packageName}}}.schemas.validation.JsonSchemaFactory; +import {{{packageName}}}.schemas.validation.UnsetAnyTypeJsonSchema; + +import java.net.http.HttpHeaders; +import java.util.ArrayList; +import java.util.List; +import java.util.Map; +import java.util.Set; +import java.util.function.BiPredicate; + +public class SchemaHeader extends HeaderBase implements Header { + public final JsonSchema schema; + + public SchemaHeader(boolean required, @Nullable Boolean allowReserved, @Nullable Boolean explode, JsonSchema schema) { + super(required, ParameterStyle.SIMPLE, explode, allowReserved); + this.schema = schema; + } + + private static HttpHeaders toHeaders(String name, String value) { + Map> map = Map.of(name, List.of(value)); + BiPredicate headerFilter = (key, val) -> true; + return HttpHeaders.of(map, headerFilter); + } + + @Override + public HttpHeaders serialize(@Nullable Object inData, String name, boolean validate, SchemaConfiguration configuration) throws NotImplementedException, ValidationException { + var castInData = validate ? schema.validate(inData, configuration) : inData; + boolean usedExplode = explode != null && explode; + var value = StyleSerializer.serializeSimple(castInData, name, usedExplode, false); + return toHeaders(name, value); + } + + private static final Set> VOID_TYPES = Set.of(Nothing?.class); + private static final Set> BOOLEAN_TYPES = Set.of(Boolean.class); + private static final Set> NUMERIC_TYPES = Set.of( + Integer.class, + Long.class, + Float.class, + Double.class + ); + private static final Set> STRING_TYPES = Set.of(String.class); + private static final Set> LIST_TYPES = Set.of(List.class); + private static final Set> MAP_TYPES = Set.of(Map.class); + + private List<@Nullable Object> getList(JsonSchema schema, List inData) throws NotImplementedException { + Class> itemsSchemaCls = schema.items == null ? UnsetAnyTypeJsonSchema.UnsetAnyTypeJsonSchema1.class : schema.items; + JsonSchema itemSchema = JsonSchemaFactory.getInstance(itemsSchemaCls); + List<@Nullable Object> castList = new ArrayList<>(); + for (String inDataItem: inData) { + @Nullable Object castInDataItem = getCastInData(itemSchema, List.of(inDataItem)); + castList.add(castInDataItem); + } + return castList; + } + + private @Nullable Object getCastInData(JsonSchema schema, List inData) throws NotImplementedException { + if (schema.type == null) { + if (inData.size() == 1) { + return inData.get(0); + } + return getList(schema, inData); + } else if (schema.type.size() == 1) { + if (schema.type.equals(BOOLEAN_TYPES)) { + throw new NotImplementedException("Boolean serialization is not defined in Rfc6570, there is no agreed upon way to sent a boolean, send a string enum instead"); + } else if (schema.type.equals(VOID_TYPES) && inData.size() == 1 && inData.get(0).isEmpty()) { + return null; + } else if (schema.type.equals(STRING_TYPES) && inData.size() == 1) { + return inData.get(0); + } else if (schema.type.equals(LIST_TYPES)) { + return getList(schema, inData); + } else if (schema.type.equals(MAP_TYPES)) { + throw new NotImplementedException("Header map deserialization has not yet been implemented"); + } + } else if (schema.type.size() == 4 && schema.type.equals(NUMERIC_TYPES) && inData.size() == 1) { + return ContentTypeDeserializer.fromJson(inData.get(0)); + } + throw new NotImplementedException("Header deserialization for schemas with multiple types has not yet been implemented"); + } + + @Override + public @Nullable Object deserialize(List inData, boolean validate, SchemaConfiguration configuration) throws NotImplementedException, ValidationException { + @Nullable Object castInData = getCastInData(schema, inData); + if (validate) { + return schema.validate(castInData, configuration); + } + return castInData; + } +} \ No newline at end of file diff --git a/src/main/resources/kotlin/src/main/kotlin/packagename/header/StyleSerializer.hbs b/src/main/resources/kotlin/src/main/kotlin/packagename/header/StyleSerializer.hbs new file mode 100644 index 00000000000..9efe3ff849e --- /dev/null +++ b/src/main/resources/kotlin/src/main/kotlin/packagename/header/StyleSerializer.hbs @@ -0,0 +1,99 @@ +package {{{packageName}}}.header; + +import org.checkerframework.checker.nullness.qual.Nullable; +import {{{packageName}}}.exceptions.NotImplementedException; + +public class StyleSerializer extends Rfc6570Serializer { + public static String serializeSimple( + @Nullable Object inData, + String name, + boolean explode, + boolean percentEncode + ) throws NotImplementedException { + var prefixSeparatorIterator = new PrefixSeparatorIterator("", ","); + return rfc6570Expansion( + name, + inData, + explode, + percentEncode, + prefixSeparatorIterator + ); + } + + public static String serializeForm( + @Nullable Object inData, + String name, + boolean explode, + boolean percentEncode + ) throws NotImplementedException { + // todo check that the prefix and suffix matches this one + PrefixSeparatorIterator iterator = new PrefixSeparatorIterator("", "&"); + return rfc6570Expansion( + name, + inData, + explode, + percentEncode, + iterator + ); + } + + public static String serializeMatrix( + @Nullable Object inData, + String name, + boolean explode + ) throws NotImplementedException { + PrefixSeparatorIterator usedIterator = new PrefixSeparatorIterator(";", ";"); + return rfc6570Expansion( + name, + inData, + explode, + true, + usedIterator + ); + } + + public static String serializeLabel( + @Nullable Object inData, + String name, + boolean explode + ) throws NotImplementedException { + PrefixSeparatorIterator usedIterator = new PrefixSeparatorIterator(".", "."); + return rfc6570Expansion( + name, + inData, + explode, + true, + usedIterator + ); + } + + public static String serializeSpaceDelimited( + @Nullable Object inData, + String name, + boolean explode + ) throws NotImplementedException { + PrefixSeparatorIterator usedIterator = new PrefixSeparatorIterator("", "%20"); + return rfc6570Expansion( + name, + inData, + explode, + true, + usedIterator + ); + } + + public static String serializePipeDelimited( + @Nullable Object inData, + String name, + boolean explode + ) throws NotImplementedException { + PrefixSeparatorIterator usedIterator = new PrefixSeparatorIterator("", "|"); + return rfc6570Expansion( + name, + inData, + explode, + true, + usedIterator + ); + } +} \ No newline at end of file diff --git a/src/main/resources/kotlin/src/main/kotlin/packagename/mediatype/Encoding.hbs b/src/main/resources/kotlin/src/main/kotlin/packagename/mediatype/Encoding.hbs new file mode 100644 index 00000000000..5d6d9d6ec49 --- /dev/null +++ b/src/main/resources/kotlin/src/main/kotlin/packagename/mediatype/Encoding.hbs @@ -0,0 +1,30 @@ +package {{{packageName}}}.mediatype; + +import org.checkerframework.checker.nullness.qual.Nullable; +import {{{packageName}}}.parameter.ParameterStyle; +import {{{packageName}}}.header.Header; + +import java.util.Map; + +public class Encoding { + public final String contentType; + public final @Nullable Map headers; + public final @Nullable ParameterStyle style; + public final boolean explode; + public final boolean allowReserved; + + public Encoding(String contentType) { + this.contentType = contentType; + headers = null; + style = null; + explode = false; + allowReserved = false; + } + public Encoding(String contentType, @Nullable Map headers) { + this.contentType = contentType; + this.headers = headers; + style = null; + explode = false; + allowReserved = false; + } +} \ No newline at end of file diff --git a/src/main/resources/kotlin/src/main/kotlin/packagename/mediatype/MediaType.hbs b/src/main/resources/kotlin/src/main/kotlin/packagename/mediatype/MediaType.hbs new file mode 100644 index 00000000000..d4afc4449dd --- /dev/null +++ b/src/main/resources/kotlin/src/main/kotlin/packagename/mediatype/MediaType.hbs @@ -0,0 +1,16 @@ +package {{{packageName}}}.mediatype; + +import {{{packageName}}}.schemas.validation.JsonSchema; + +public interface MediaType, U> { + /* + * Used to store request and response body schema information + * encoding: + * A map between a property name and its encoding information. + * The key, being the property name, MUST exist in the schema as a property. + * The encoding object SHALL only apply to requestBody objects when the media type is + * multipart or application/x-www-form-urlencoded. + */ + T schema(); + U encoding(); +} \ No newline at end of file diff --git a/src/main/resources/kotlin/src/main/kotlin/packagename/parameter/ContentParameter.hbs b/src/main/resources/kotlin/src/main/kotlin/packagename/parameter/ContentParameter.hbs new file mode 100644 index 00000000000..ba1ab60208d --- /dev/null +++ b/src/main/resources/kotlin/src/main/kotlin/packagename/parameter/ContentParameter.hbs @@ -0,0 +1,30 @@ +package {{{packageName}}}.parameter; + +import org.checkerframework.checker.nullness.qual.Nullable; +import {{{packageName}}}.contenttype.ContentTypeDetector; +import {{{packageName}}}.contenttype.ContentTypeSerializer; +import {{{packageName}}}.exceptions.NotImplementedException; +import {{{packageName}}}.mediatype.MediaType; + +import java.util.Map; +import java.util.AbstractMap; + +public class ContentParameter extends ParameterBase implements Parameter { + public final AbstractMap.SimpleEntry> content; + + public ContentParameter(String name, ParameterInType inType, boolean required, @Nullable ParameterStyle style, @Nullable Boolean explode, @Nullable Boolean allowReserved, AbstractMap.SimpleEntry> content) { + super(name, inType, required, style, explode, allowReserved); + this.content = content; + } + + @Override + public AbstractMap.SimpleEntry serialize(@Nullable Object inData) throws NotImplementedException { + String contentType = content.getKey(); + if (ContentTypeDetector.contentTypeIsJson(contentType)) { + var value = ContentTypeSerializer.toJson(inData); + return new AbstractMap.SimpleEntry<>(name, value); + } else { + throw new NotImplementedException("Serialization of "+contentType+" has not yet been implemented"); + } + } +} \ No newline at end of file diff --git a/src/main/resources/kotlin/src/main/kotlin/packagename/parameter/CookieSerializer.hbs b/src/main/resources/kotlin/src/main/kotlin/packagename/parameter/CookieSerializer.hbs new file mode 100644 index 00000000000..5905efe7ed3 --- /dev/null +++ b/src/main/resources/kotlin/src/main/kotlin/packagename/parameter/CookieSerializer.hbs @@ -0,0 +1,36 @@ +package {{{packageName}}}.parameter; + +import org.checkerframework.checker.nullness.qual.Nullable; +import {{{packageName}}}.exceptions.NotImplementedException; + +import java.util.AbstractMap; +import java.util.Map; +import java.util.TreeMap; + +public abstract class CookieSerializer { + private final Map parameters; + + protected CookieSerializer(Map parameters) { + this.parameters = parameters; + } + + public String serialize(Map inData) throws NotImplementedException { + String result = ""; + Map sortedData = new TreeMap<>(inData); + for (Map.Entry entry: sortedData.entrySet()) { + String mapKey = entry.getKey(); + @Nullable Parameter parameter = parameters.get(mapKey); + if (parameter == null) { + throw new RuntimeException("Invalid state, a parameter must exist for every key"); + } + @Nullable Object value = entry.getValue(); + AbstractMap.SimpleEntry serialized = parameter.serialize(value); + if (result.isEmpty()) { + result = serialized.getValue(); + } else { + result = result + "; " + serialized.getValue(); + } + } + return result; + } +} diff --git a/src/main/resources/kotlin/src/main/kotlin/packagename/parameter/HeadersSerializer.hbs b/src/main/resources/kotlin/src/main/kotlin/packagename/parameter/HeadersSerializer.hbs new file mode 100644 index 00000000000..d2f10e695ef --- /dev/null +++ b/src/main/resources/kotlin/src/main/kotlin/packagename/parameter/HeadersSerializer.hbs @@ -0,0 +1,32 @@ +package {{{packageName}}}.parameter; + +import org.checkerframework.checker.nullness.qual.Nullable; +import {{{packageName}}}.exceptions.NotImplementedException; + +import java.util.AbstractMap; +import java.util.LinkedHashMap; +import java.util.Map; +import java.util.List; + +public abstract class HeadersSerializer { + private final Map parameters; + + protected HeadersSerializer(Map parameters) { + this.parameters = parameters; + } + + public Map> serialize(Map inData) throws NotImplementedException { + Map> results = new LinkedHashMap<>(); + for (Map.Entry entry: inData.entrySet()) { + String mapKey = entry.getKey(); + @Nullable Parameter parameter = parameters.get(mapKey); + if (parameter == null) { + throw new RuntimeException("Invalid state, a parameter must exist for every key"); + } + @Nullable Object value = entry.getValue(); + AbstractMap.SimpleEntry serialized = parameter.serialize(value); + results.put(serialized.getKey(), List.of(serialized.getValue())); + } + return results; + } +} diff --git a/src/main/resources/kotlin/src/main/kotlin/packagename/parameter/Parameter.hbs b/src/main/resources/kotlin/src/main/kotlin/packagename/parameter/Parameter.hbs new file mode 100644 index 00000000000..3d2e8abeb95 --- /dev/null +++ b/src/main/resources/kotlin/src/main/kotlin/packagename/parameter/Parameter.hbs @@ -0,0 +1,10 @@ +package {{{packageName}}}.parameter; + +import org.checkerframework.checker.nullness.qual.Nullable; +import {{{packageName}}}.exceptions.NotImplementedException; + +import java.util.AbstractMap; + +public interface Parameter { + AbstractMap.SimpleEntry serialize(@Nullable Object inData) throws NotImplementedException; +} \ No newline at end of file diff --git a/src/main/resources/kotlin/src/main/kotlin/packagename/parameter/ParameterBase.hbs b/src/main/resources/kotlin/src/main/kotlin/packagename/parameter/ParameterBase.hbs new file mode 100644 index 00000000000..65f1feafa18 --- /dev/null +++ b/src/main/resources/kotlin/src/main/kotlin/packagename/parameter/ParameterBase.hbs @@ -0,0 +1,15 @@ +package {{{packageName}}}.parameter; + +import org.checkerframework.checker.nullness.qual.Nullable; +import {{{packageName}}}.header.HeaderBase; + +public class ParameterBase extends HeaderBase { + public final String name; + public final ParameterInType inType; + + public ParameterBase(String name, ParameterInType inType, boolean required, @Nullable ParameterStyle style, @Nullable Boolean explode, @Nullable Boolean allowReserved) { + super(required, style, explode, allowReserved); + this.name = name; + this.inType = inType; + } +} \ No newline at end of file diff --git a/src/main/resources/kotlin/src/main/kotlin/packagename/parameter/ParameterInType.hbs b/src/main/resources/kotlin/src/main/kotlin/packagename/parameter/ParameterInType.hbs new file mode 100644 index 00000000000..3b4e45cbfb7 --- /dev/null +++ b/src/main/resources/kotlin/src/main/kotlin/packagename/parameter/ParameterInType.hbs @@ -0,0 +1,8 @@ +package {{{packageName}}}.parameter; + +public enum ParameterInType { + QUERY, + HEADER, + PATH, + COOKIE +} \ No newline at end of file diff --git a/src/main/resources/kotlin/src/main/kotlin/packagename/parameter/ParameterStyle.hbs b/src/main/resources/kotlin/src/main/kotlin/packagename/parameter/ParameterStyle.hbs new file mode 100644 index 00000000000..76671286ced --- /dev/null +++ b/src/main/resources/kotlin/src/main/kotlin/packagename/parameter/ParameterStyle.hbs @@ -0,0 +1,11 @@ +package {{{packageName}}}.parameter; + +public enum ParameterStyle { + MATRIX, + LABEL, + FORM, + SIMPLE, + SPACE_DELIMITED, + PIPE_DELIMITED, + DEEP_OBJECT +} \ No newline at end of file diff --git a/src/main/resources/kotlin/src/main/kotlin/packagename/parameter/PathSerializer.hbs b/src/main/resources/kotlin/src/main/kotlin/packagename/parameter/PathSerializer.hbs new file mode 100644 index 00000000000..82a778a630f --- /dev/null +++ b/src/main/resources/kotlin/src/main/kotlin/packagename/parameter/PathSerializer.hbs @@ -0,0 +1,30 @@ +package {{{packageName}}}.parameter; + +import org.checkerframework.checker.nullness.qual.Nullable; +import {{{packageName}}}.exceptions.NotImplementedException; + +import java.util.AbstractMap; +import java.util.Map; + +public abstract class PathSerializer { + private final Map parameters; + + protected PathSerializer(Map parameters) { + this.parameters = parameters; + } + + public String serialize(Map inData, String pathWithPlaceholders) throws NotImplementedException { + String result = pathWithPlaceholders; + for (Map.Entry entry: inData.entrySet()) { + String mapKey = entry.getKey(); + @Nullable Parameter parameter = parameters.get(mapKey); + if (parameter == null) { + throw new RuntimeException("Invalid state, a parameter must exist for every key"); + } + @Nullable Object value = entry.getValue(); + AbstractMap.SimpleEntry serialized = parameter.serialize(value); + result = result.replace("{" + mapKey + "}", serialized.getValue()); + } + return result; + } +} diff --git a/src/main/resources/kotlin/src/main/kotlin/packagename/parameter/QuerySerializer.hbs b/src/main/resources/kotlin/src/main/kotlin/packagename/parameter/QuerySerializer.hbs new file mode 100644 index 00000000000..da5fecd666f --- /dev/null +++ b/src/main/resources/kotlin/src/main/kotlin/packagename/parameter/QuerySerializer.hbs @@ -0,0 +1,48 @@ +package {{{packageName}}}.parameter; + +import org.checkerframework.checker.nullness.qual.Nullable; +import {{{packageName}}}.exceptions.NotImplementedException; + +import java.util.AbstractMap; +import java.util.HashMap; +import java.util.Map; +import java.util.TreeMap; + +public abstract class QuerySerializer { + private final Map parameters; + + protected QuerySerializer(Map parameters) { + this.parameters = parameters; + } + + public Map getQueryMap(Map inData) throws NotImplementedException { + Map results = new HashMap<>(); + for (Map.Entry entry: inData.entrySet()) { + String mapKey = entry.getKey(); + @Nullable Parameter parameter = parameters.get(mapKey); + if (parameter == null) { + throw new RuntimeException("Invalid state, a parameter must exist for every key"); + } + @Nullable Object value = entry.getValue(); + AbstractMap.SimpleEntry serialized = parameter.serialize(value); + results.put(serialized.getKey(), serialized.getValue()); + } + return new TreeMap<>(results); + } + + public String serialize(Map queryMap) { + if (queryMap.isEmpty()) { + return ""; + } + String result = "?"; + for (String serializedValue: queryMap.values()) { + if (result.length() == 1) { + result = result + serializedValue; + } else { + result = result + "&" + serializedValue; + } + } + // TODO what if the style is not FORM? + return result; + } +} diff --git a/src/main/resources/kotlin/src/main/kotlin/packagename/parameter/SchemaParameter.hbs b/src/main/resources/kotlin/src/main/kotlin/packagename/parameter/SchemaParameter.hbs new file mode 100644 index 00000000000..23327283938 --- /dev/null +++ b/src/main/resources/kotlin/src/main/kotlin/packagename/parameter/SchemaParameter.hbs @@ -0,0 +1,60 @@ +package {{{packageName}}}.parameter; + +import org.checkerframework.checker.nullness.qual.Nullable; +import {{{packageName}}}.header.StyleSerializer; +import {{{packageName}}}.exceptions.NotImplementedException; +import {{{packageName}}}.schemas.validation.JsonSchema; + +import java.util.AbstractMap; + +public class SchemaParameter extends ParameterBase implements Parameter { + public final JsonSchema schema; + + public SchemaParameter(String name, ParameterInType inType, boolean required, @Nullable ParameterStyle style, @Nullable Boolean explode, @Nullable Boolean allowReserved, JsonSchema schema) { + super(name, inType, required, style, explode, allowReserved); + this.schema = schema; + } + + private ParameterStyle getStyle() { + if (style != null) { + return style; + } + if (inType == ParameterInType.QUERY || inType == ParameterInType.COOKIE) { + return ParameterStyle.FORM; + } + // ParameterInType.HEADER || ParameterInType.PATH + return ParameterStyle.SIMPLE; + } + + @Override + public AbstractMap.SimpleEntry serialize(@Nullable Object inData) throws NotImplementedException { + ParameterStyle usedStyle = getStyle(); + boolean percentEncode = inType == ParameterInType.QUERY || inType == ParameterInType.PATH; + String value; + boolean usedExplode = explode == null ? usedStyle == ParameterStyle.FORM : explode; + if (usedStyle == ParameterStyle.SIMPLE) { + // header OR path + value = StyleSerializer.serializeSimple(inData, name, usedExplode, percentEncode); + } else if (usedStyle == ParameterStyle.FORM) { + // query OR cookie + value = StyleSerializer.serializeForm(inData, name, usedExplode, percentEncode); + } else if (usedStyle == ParameterStyle.LABEL) { + // path + value = StyleSerializer.serializeLabel(inData, name, usedExplode); + } else if (usedStyle == ParameterStyle.MATRIX) { + // path + value = StyleSerializer.serializeMatrix(inData, name, usedExplode); + } else if (usedStyle == ParameterStyle.SPACE_DELIMITED) { + // query + value = StyleSerializer.serializeSpaceDelimited(inData, name, usedExplode); + } else if (usedStyle == ParameterStyle.PIPE_DELIMITED) { + // query + value = StyleSerializer.serializePipeDelimited(inData, name, usedExplode); + } else { + // usedStyle == ParameterStyle.DEEP_OBJECT + // query + throw new NotImplementedException("Style deep object serialization has not yet been implemented."); + } + return new AbstractMap.SimpleEntry<>(name, value); + } +} \ No newline at end of file diff --git a/src/main/resources/kotlin/src/main/kotlin/packagename/paths/path/PathItem.hbs b/src/main/resources/kotlin/src/main/kotlin/packagename/paths/path/PathItem.hbs new file mode 100644 index 00000000000..cc2ccab03b3 --- /dev/null +++ b/src/main/resources/kotlin/src/main/kotlin/packagename/paths/path/PathItem.hbs @@ -0,0 +1,7 @@ +{{#with pathItem}} +package {{packageName}}.{{subpackage}}; + +public class {{jsonPathPiece.pascalCase}} { + public static final String path = "{{{jsonPathPiece.original}}}"; +} +{{/with}} \ No newline at end of file diff --git a/src/main/resources/kotlin/src/main/kotlin/packagename/paths/path/verb/Operation.hbs b/src/main/resources/kotlin/src/main/kotlin/packagename/paths/path/verb/Operation.hbs new file mode 100644 index 00000000000..07e3ec110aa --- /dev/null +++ b/src/main/resources/kotlin/src/main/kotlin/packagename/paths/path/verb/Operation.hbs @@ -0,0 +1,391 @@ +{{#with operation}} +package {{packageName}}.{{subpackage}}; + +import org.checkerframework.checker.nullness.qual.Nullable; + {{#each builders}} + {{#or @first @last}} + {{#each keyToBuilder}} + {{#with property}} + {{#if containerJsonPathPiece}} +import {{packageName}}.{{subpackage}}.{{containerJsonPathPiece.pascalCase}}; + {{else}} + {{#if this.jsonPathPiece}} + {{#if subpackage}} +import {{packageName}}.{{subpackage}}.{{jsonPathPiece.pascalCase}}; + {{else}} +import {{packageName}}.{{jsonPathPiece.pascalCase}}; + {{/if}} + {{/if}} + {{/if}} + {{/with}} + {{/each}} + {{/or}} + {{/each}} + {{#with parametersInfo}} +import {{packageName}}.{{subpackage}}.{{jsonPathPiece.pascalCase}}; + {{/with}} + {{#with responses}} +import {{packageName}}.{{subpackage}}.{{jsonPathPiece.pascalCase}}; + {{/with}} +import {{packageName}}.apiclient.ApiClient; +import {{packageName}}.configurations.ApiConfiguration; +import {{packageName}}.configurations.SchemaConfiguration; +import {{packageName}}.exceptions.ValidationException; +import {{packageName}}.exceptions.NotImplementedException; +import {{packageName}}.exceptions.ApiException; +import {{packageName}}.restclient.RestClient; + {{#if requestBody}} +import {{packageName}}.requestbody.SerializedRequestBody; + {{/if}} + {{#with ../pathItem}} +import {{packageName}}.{{subpackage}}.{{jsonPathPiece.pascalCase}}; + {{/with}} + {{#each builders}} + {{#if @first}} + {{#each keyToBuilder}} + {{#eq @key.camelCase "securityIndex"}} +import {{packageName}}.securityrequirementobjects.SecurityRequirementObject; +import {{packageName}}.securityrequirementobjects.AuthApplier; + {{/eq}} + {{/each}} + {{/if}} + {{/each}} + +import java.io.IOException; + {{#if requestBody}} +import java.util.ArrayList; + {{/if}} +import java.net.http.HttpClient; +import java.net.http.HttpRequest; +import java.time.Duration; +import java.util.List; +import java.util.Map; + +public class {{jsonPathPiece.pascalCase}} { + private static class {{method.pascalCase}}Provider{{#each builders}}{{#if @first}}{{#each keyToBuilder}}{{#eq @key.camelCase "securityIndex"}} extends AuthApplier{{/eq}}{{/each}}{{/if}}{{/each}} { + private static final String method = "{{jsonPathPiece.original}}"; + + public static {{#if nonErrorResponses }}{{#with responses}}{{jsonPathPiece.pascalCase}}.EndpointResponse{{/with}}{{else}}Nothing?{{/if}} {{method.camelCase}}( + {{method.pascalCase}}Request request, + ApiConfiguration apiConfiguration, + SchemaConfiguration schemaConfiguration, + HttpClient client + ) throws IOException, InterruptedException, ValidationException, NotImplementedException, ApiException { + Map> headers = apiConfiguration.getDefaultHeaders(); + {{#with requestBody}} + + {{#if getSelfOrDeepestRef.required }} + SerializedRequestBody serializedRequestBody = new {{jsonPathPiece.pascalCase}}.{{jsonPathPiece.pascalCase}}1().serialize( + request.requestBody + ); + var contentTypeHeaderValues = headers.getOrDefault("Content-Type", new ArrayList<>()); + contentTypeHeaderValues.add(serializedRequestBody.contentType); + HttpRequest.BodyPublisher bodyPublisher = serializedRequestBody.bodyPublisher; + {{else}} + @Nullable SerializedRequestBody serializedRequestBody; + HttpRequest.BodyPublisher bodyPublisher = HttpRequest.BodyPublishers.noBody(); + if (request.requestBody != null) { + serializedRequestBody = new {{jsonPathPiece.pascalCase}}.{{jsonPathPiece.pascalCase}}1().serialize( + request.requestBody + ); + var contentTypeHeaderValues = headers.getOrDefault("Content-Type", new ArrayList<>()); + contentTypeHeaderValues.add(serializedRequestBody.contentType); + bodyPublisher = serializedRequestBody.bodyPublisher; + } + {{/if}} + {{else}} + HttpRequest.BodyPublisher bodyPublisher = HttpRequest.BodyPublishers.noBody(); + {{/with}} + {{#with parametersInfo}} + {{#if headerParametersSchema}} + + {{#if headerParametersSchema.requiredProperties}} + var headersSerializer = new {{jsonPathPiece.pascalCase}}.HeaderParametersSerializer(); + Map> serializedHeaders = headersSerializer.serialize(request.headerParameters); + headers.putAll(serializedHeaders); + {{else}} + if (request.headerParameters != null) { + var headersSerializer = new {{jsonPathPiece.pascalCase}}.HeaderParametersSerializer(); + Map> serializedHeaders = headersSerializer.serialize(request.headerParameters); + headers.putAll(serializedHeaders); + } + {{/if}} + {{/if}} + {{#if cookieParametersSchema}} + + {{#if cookieParametersSchema.requiredProperties}} + var cookieSerializer = new {{jsonPathPiece.pascalCase}}.CookieParametersSerializer(); + String serializedCookie = cookieSerializer.serialize(request.cookieParameters); + var cookieHeaderValues = headers.getOrDefault("Cookie", new ArrayList<>()); + cookieHeaderValues.add(serializedCookie); + {{else}} + if (request.cookieParameters != null) { + var cookieSerializer = new {{jsonPathPiece.pascalCase}}.CookieParametersSerializer(); + String serializedCookie = cookieSerializer.serialize(request.cookieParameters); + var cookieHeaderValues = headers.getOrDefault("Cookie", new ArrayList<>()); + cookieHeaderValues.add(serializedCookie); + } + {{/if}} + {{/if}} + {{#if pathParametersSchema}} + + {{! path parameters are always required }} + var pathSerializer = new {{jsonPathPiece.pascalCase}}.PathParametersSerializer(); + String updatedPath = pathSerializer.serialize(request.pathParameters, {{#with ../pathItem}}{{jsonPathPiece.pascalCase}}.{{/with}}path); + {{/if}} + {{#if queryParametersSchema}} + + {{#if queryParametersSchema.requiredProperties}} + var querySerializer = new {{jsonPathPiece.pascalCase}}.QueryParametersSerializer(); + @Nullable Map queryMap = querySerializer.getQueryMap(request.queryParameters); + {{else}} + var querySerializer = new {{jsonPathPiece.pascalCase}}.QueryParametersSerializer(); + @Nullable Map queryMap = null; + if (request.queryParameters != null) { + queryMap = querySerializer.getQueryMap(request.queryParameters); + } + {{/if}} + {{else}} + // TODO set this to a map if there is a query security scheme + @Nullable Map queryMap = null; + {{/if}} + {{else}} + // TODO set this to a map if there is a query security scheme + @Nullable Map queryMap = null; + {{/with}} + String host = apiConfiguration.getServer(request.serverIndex).url(); + {{#each builders}} + {{#if @first}} + {{#each keyToBuilder}} + {{#eq @key.camelCase "securityIndex"}} + SecurityRequirementObject securityRequirementObject = apiConfiguration.getSecurityRequirementObject(request.securityIndex); + updateParamsForAuth( + securityRequirementObject, + headers, + {{#and parametersInfo parametersInfo.pathParametersSchema}}updatedPath{{else}}{{#with ../pathItem}}{{jsonPathPiece.pascalCase}}.{{/with}}path{{/and}}, + method, + bodyPublisher, + queryMap, + apiConfiguration + ); + {{/eq}} + {{/each}} + {{/if}} + {{/each}} + + String url = host + {{#and parametersInfo parametersInfo.pathParametersSchema}}updatedPath{{else}}{{#with ../pathItem}}{{jsonPathPiece.pascalCase}}.{{/with}}path{{/and}}; + {{#if queryParametersSchema }} + if (queryMap != null) { + url = url + querySerializer.serialize(queryMap); + } + {{/if}} + var httpRequest = RestClient.getRequest( + url, + method, + bodyPublisher, + headers, + request.timeout + ); + var response = RestClient.getResponse(httpRequest, client); + {{#if nonErrorResponses }} + var responsesDeserializer = new {{#with responses}}{{jsonPathPiece.pascalCase}}.{{jsonPathPiece.pascalCase}}1{{/with}}(); + return responsesDeserializer.deserialize(response, schemaConfiguration); + {{else}} + return (Nothing?) null; + {{/if}} + } + } + + public interface {{method.pascalCase}}Operation { + ApiConfiguration getApiConfiguration(); + SchemaConfiguration getSchemaConfiguration(); + HttpClient getClient(); + default {{#if nonErrorResponses }}{{#with responses}}{{jsonPathPiece.pascalCase}}.EndpointResponse{{/with}}{{else}}Nothing?{{/if}} {{jsonPathPiece.camelCase}}({{method.pascalCase}}Request request) throws IOException, InterruptedException, ValidationException, NotImplementedException, ApiException { + return {{method.pascalCase}}Provider.{{method.camelCase}}(request, getApiConfiguration(), getSchemaConfiguration(), getClient()); + } + } + {{#neq method.pascalCase operationId.pascalCase}} + + public interface {{operationId.pascalCase}}Operation { + ApiConfiguration getApiConfiguration(); + SchemaConfiguration getSchemaConfiguration(); + HttpClient getClient(); + default {{#if nonErrorResponses }}{{#with responses}}{{jsonPathPiece.pascalCase}}.EndpointResponse{{/with}}{{else}}Nothing?{{/if}} {{operationId.camelCase}}({{method.pascalCase}}Request request) throws IOException, InterruptedException, ValidationException, NotImplementedException, ApiException { + return {{method.pascalCase}}Provider.{{jsonPathPiece.camelCase}}(request, getApiConfiguration(), getSchemaConfiguration(), getClient()); + } + } + {{/neq}} + + public static class {{method.pascalCase}} extends ApiClient implements {{method.pascalCase}}Operation { + public {{method.pascalCase}}(ApiConfiguration apiConfiguration, SchemaConfiguration schemaConfiguration) { + super(apiConfiguration, schemaConfiguration); + } + } + {{#eq builders.size 1}} + + public static class {{method.pascalCase}}Request { + {{#each builders}} + {{#each keyToBuilder}} + {{#with property}} + {{#if containerJsonPathPiece}} + public {{containerJsonPathPiece.pascalCase}}.@Nullable {{operationInputClassName.pascalCase}} {{@key.camelCase}}; + {{else}} + {{#if this.jsonPathPiece}} + public {{jsonPathPiece.pascalCase}}.@Nullable {{operationInputClassName.pascalCase}} {{@key.camelCase}}; + {{else}} + public @Nullable {{operationInputClassName.pascalCase}} {{@key.camelCase}}; + {{/if}} + {{/if}} + {{/with}} + {{/each}} + {{/each}} + } + {{else}} + + public static class {{method.pascalCase}}Request { + {{#each (reverse builders)}} + {{#or @first @last}} + {{#each keyToBuilder}} + {{#with property}} + {{#if containerJsonPathPiece}} + public {{containerJsonPathPiece.pascalCase}}.{{#if ../../@last}}@Nullable {{/if}}{{operationInputClassName.pascalCase}} {{@key.camelCase}}; + {{else}} + {{#if this.jsonPathPiece}} + public {{jsonPathPiece.pascalCase}}.{{#if ../../@last}}@Nullable {{/if}}{{operationInputClassName.pascalCase}} {{@key.camelCase}}; + {{else}} + public {{#if ../../@last}}@Nullable {{/if}}{{operationInputClassName.pascalCase}} {{@key.camelCase}}; + {{/if}} + {{/if}} + {{/with}} + {{/each}} + {{/or}} + {{/each}} + + public {{method.pascalCase}}Request( + {{#each (reverse builders)}} + {{#or @first @last}} + {{#each keyToBuilder}} + {{#with property}} + {{#if containerJsonPathPiece}} + {{containerJsonPathPiece.pascalCase}}.{{#if ../../@last}}@Nullable {{/if}}{{operationInputClassName.pascalCase}} {{@key.camelCase}}{{#and ../../@last ../@last}}{{else}},{{/and}} + {{else}} + {{#if this.jsonPathPiece}} + {{jsonPathPiece.pascalCase}}.{{#if ../../@last}}@Nullable {{/if}}{{operationInputClassName.pascalCase}} {{@key.camelCase}}{{#and ../../@last ../@last}}{{else}},{{/and}} + {{else}} + {{#if ../../@last}}@Nullable {{/if}}{{operationInputClassName.pascalCase}} {{@key.camelCase}}{{#and ../../@last ../@last}}{{else}},{{/and}} + {{/if}} + {{/if}} + {{/with}} + {{/each}} + {{/or}} + {{/each}} + ) { + {{#each (reverse builders)}} + {{#or @first @last}} + {{#each keyToBuilder}} + this.{{@key.camelCase}} = {{@key.camelCase}}; + {{/each}} + {{/or}} + {{/each}} + } + } + + public static class {{method.pascalCase}}NullableRequest { + {{#each (reverse builders)}} + {{#or @first @last}} + {{#each keyToBuilder}} + {{#with property}} + {{#if containerJsonPathPiece}} + public {{containerJsonPathPiece.pascalCase}}.@Nullable {{operationInputClassName.pascalCase}} {{@key.camelCase}}; + {{else}} + {{#if this.jsonPathPiece}} + public {{jsonPathPiece.pascalCase}}.@Nullable {{operationInputClassName.pascalCase}} {{@key.camelCase}}; + {{else}} + public @Nullable {{operationInputClassName.pascalCase}} {{@key.camelCase}}; + {{/if}} + {{/if}} + {{/with}} + {{/each}} + {{/or}} + {{/each}} + } + {{/eq}} + {{#each builders}} + {{#or @first @last}} + {{#each keyToBuilder}} + + public interface SetterFor{{@key.pascalCase}} { + {{../../method.pascalCase}}{{#gt ../../builders.size 1}}Nullable{{/gt}}Request getInstance(); + T getBuilderAfter{{@key.pascalCase}}({{../../method.pascalCase}}{{#gt ../../builders.size 1}}Nullable{{/gt}}Request instance); + default T {{@key.camelCase}}({{#with property}}{{#if containerJsonPathPiece}}{{containerJsonPathPiece.pascalCase}}.{{else}}{{#if this.jsonPathPiece}}{{jsonPathPiece.pascalCase}}.{{/if}}{{/if}}{{operationInputClassName.pascalCase}}{{/with}} {{@key.camelCase}}) { + var instance = getInstance(); + instance.{{@key.camelCase}} = {{@key.camelCase}}; + return getBuilderAfter{{@key.pascalCase}}(instance); + } + } + {{/each}} + {{/or}} + {{/each}} + + {{#each builders}} + public static class {{className.pascalCase}}{{#if keyToBuilder}} implements {{/if}}{{#each keyToBuilder}}SetterFor{{@key.pascalCase}}<{{builder.className.pascalCase}}>{{#unless @last}}, {{/unless}}{{/each}} { + private final {{../method.pascalCase}}{{#gt ../builders.size 1}}Nullable{{/gt}}Request instance; + + {{#if @last }} + public {{className.pascalCase}}() { + this.instance = new {{../method.pascalCase}}{{#gt ../builders.size 1}}Nullable{{/gt}}Request(); + } + {{else}} + public {{className.pascalCase}}({{../method.pascalCase}}{{#gt ../builders.size 1}}Nullable{{/gt}}Request instance) { + this.instance = instance; + } + {{/if}} + {{#if @first}} + + public {{../method.pascalCase}}Request build() { + {{#gt ../builders.size 1}} + {{#each builders}} + {{#if @last}} + {{#each keyToBuilder}} + var {{@key.camelCase}} = instance.{{@key.camelCase}}; + if ({{@key.camelCase}} == null) { + throw new RuntimeException("invalid null value for required parameter"); + } + {{/each}} + {{/if}} + {{/each}} + return new {{../method.pascalCase}}Request( + {{#each (reverse builders)}} + {{#or @first @last}} + {{#each keyToBuilder}} + {{#if ../@last}}instance.{{/if}}{{@key.camelCase}}{{#and ../@last @last}}{{else}},{{/and}} + {{/each}} + {{/or}} + {{/each}} + ); + {{else}} + return instance; + {{/gt}} + } + {{/if}} + {{#if keyToBuilder}} + + public {{../method.pascalCase}}{{#gt ../builders.size 1}}Nullable{{/gt}}Request getInstance() { + return instance; + } + {{/if}} + {{#each keyToBuilder}} + + public {{builder.className.pascalCase}} getBuilderAfter{{@key.pascalCase}}({{../method.pascalCase}}{{#gt ../builders.size 1}}Nullable{{/gt}}Request instance) { + {{#eq builder ../this}} + {{! property in final builder }} + return this; + {{else}} + return new {{builder.className.pascalCase}}(instance); + {{/eq}} + } + {{/each}} + } + {{/each}} +} +{{/with}} diff --git a/src/main/resources/kotlin/src/main/kotlin/packagename/paths/path/verb/OperationDoc.hbs b/src/main/resources/kotlin/src/main/kotlin/packagename/paths/path/verb/OperationDoc.hbs new file mode 100644 index 00000000000..7eabec0b446 --- /dev/null +++ b/src/main/resources/kotlin/src/main/kotlin/packagename/paths/path/verb/OperationDoc.hbs @@ -0,0 +1,118 @@ +{{#with operation}} +{{headerSize}} {{jsonPathPiece.pascalCase}} + +public class {{jsonPathPiece.pascalCase}} + +A class that contains necessary endpoint classes +- a class that calls the endpoint method using the http verb +- a class that calls the endpoint method using the operationId name +- class(es) to store the request inputs +- builder(s) to set the request input data + +{{headerSize}}# Nested Class Summary +| Modifier and Type | Class and Description | +| ----------------- | --------------------- | +| static class | [{{method.pascalCase}}](#{{method.kebabCase}})
The class that has a {{method.camelCase}} method to call the endpoint | +{{#neq method.pascalCase operationId.pascalCase}} +| interface | [{{operationId.pascalCase}}Operation](#{{operationId.kebabCase}}operation)
The interface that has a {{operationId.camelCase}} method to call the endpoint | +{{/neq}} + {{#eq builders.size 1}} +| static class | [{{method.pascalCase}}Request](#{{method.kebabCase}}request)
The request inputs class | + {{else}} +| static class | [{{method.pascalCase}}Request](#{{method.kebabCase}}request)
The final request inputs class | +| static class | [{{method.pascalCase}}NullableRequest](#{{method.kebabCase}}nullablerequest)
The initial request inputs class | + {{/eq}} + {{#each builders}} +| static class | [{{className.pascalCase}}](#{{className.kebabCase}})
A builder for the request input class | + {{/each}} + +{{headerSize}}# {{method.pascalCase}} +public static class {{method.pascalCase}} extends ApiClient.ApiClient1 implements {{method.pascalCase}}Operation
+ +a class that allows one to call the endpoint using a method named {{method.camelCase}} + +{{headerSize}}## Code Sample +{{> src/main/kotlin/packagename/paths/path/verb/_OperationDocCodeSample apiSubpackage=subpackage apiContainerClass=jsonPathPiece.pascalCase apiFullyQualifiedClass=(join jsonPathPiece.pascalCase method.pascalCase ".") }} + +{{headerSize}}## Constructor Summary +| Constructor and Description | +| --------------------------- | +| {{method.pascalCase}}(ApiConfiguration apiConfiguration, SchemaConfiguration schemaConfiguration)
Creates an instance | + +{{headerSize}}## Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| {{#if nonErrorResponses }}{{#with responses}}[{{jsonPathPiece.pascalCase}}.EndpointResponse]({{docRoot}}{{pathFromDocRoot}}.md#endpointresponse){{/with}}{{else}}Nothing?{{/if}} | {{method.camelCase}}([{{method.pascalCase}}Request](#{{method.kebabCase}}request) request) | +{{#neq method.pascalCase operationId.pascalCase}} + +{{headerSize}}# {{operationId.pascalCase}}Operation +public interface {{operationId.pascalCase}}Operation
+ +an interface that allows one to call the endpoint using a method named {{operationId.camelCase}} by the operationId + +{{headerSize}}## Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| {{#if nonErrorResponses }}{{#with responses}}[{{jsonPathPiece.pascalCase}}.EndpointResponse]({{docRoot}}{{pathFromDocRoot}}.md#endpointresponse){{/with}}{{else}}Nothing?{{/if}} | {{operationId.camelCase}}([{{method.pascalCase}}Request](#{{method.kebabCase}}request) request) | +{{/neq}} + + {{#eq builders.size 1}} +{{> src/main/kotlin/packagename/paths/path/verb/_FinalRequestClassDoc }} + {{else}} +{{> src/main/kotlin/packagename/paths/path/verb/_FinalRequestClassDoc }} + +{{headerSize}}# {{method.pascalCase}}NullableRequest +public static class {{method.pascalCase}}NullableRequest
+ +a class that stores the initial request inputs + +{{headerSize}}## Field Summary +| Modifier and Type | Field and Description | +| ----------------- | --------------------- | + {{#each (reverse builders)}} + {{#or @first @last}} + {{#each keyToBuilder}} + {{#with property}} + {{#if containerJsonPathPiece}} +| [{{containerJsonPathPiece.pascalCase}}.@Nullable {{operationInputClassName.pascalCase}}]({{docRoot}}{{pathFromDocRoot}}.md#{{operationInputClassName.kebabCase}}) | {{@key.camelCase}} | + {{else}} + {{#if this.jsonPathPiece}} +| [{{jsonPathPiece.pascalCase}}.@Nullable {{operationInputClassName.pascalCase}}]({{docRoot}}{{pathFromDocRoot}}.md#{{operationInputClassName.kebabCase}}) | {{@key.camelCase}} | + {{else}} +| @Nullable {{operationInputClassName.pascalCase}} | {{@key.camelCase}} | + {{/if}} + {{/if}} + {{/with}} + {{/each}} + {{/or}} + {{/each}} + {{/eq}} + {{#each builders}} + +{{headerSize}}# {{className.pascalCase}} +public static class {{className.pascalCase}}
+ +a builder for request inputs + +{{headerSize}}## Constructor Summary +| Constructor and Description | +| --------------------------- | + {{#if @last }} +| {{className.pascalCase}}()
Creates a builder that contains null for all parameters | + {{else}} +| {{className.pascalCase}}({{className.pascalCase}} instance)
Creates a builder that contains the passed instance | + {{/if}} + +{{headerSize}}## Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | + {{#if @first}} +| [{{method.pascalCase}}Request](#{{method.kebabCase}}request) | build()
Returns the request input used to call an endpoint method | + {{/if}} + {{#each keyToBuilder}} +| [{{builder.className.pascalCase}}](#{{builder.className.kebabCase}}) | {{@key.camelCase}}({{#with property}}{{#if containerJsonPathPiece}}[{{containerJsonPathPiece.pascalCase}}{{else}}{{#if this.jsonPathPiece}}[{{jsonPathPiece.pascalCase}}.{{/if}}{{/if}}{{operationInputClassName.pascalCase}}{{#or containerJsonPathPiece this.jsonPathPiece}}]({{docRoot}}{{pathFromDocRoot}}.md#{{operationInputClassName.kebabCase}}){{/or}}{{/with}} {{@key.camelCase}})
sets the {{#if ../@first}}optional {{/if}}property{{#or (eq @key.camelCase "securityIndex") (eq @key.camelCase "serverIndex") (eq @key.camelCase "timeout")}}. Note: this will override the value in apiConfiguration{{/or}} | + {{/each}} + {{/each}} + +[[Back to top]](#top) {{> _helper_footer_links readmePath="../../../" endpointLink=true}} +{{/with}} \ No newline at end of file diff --git a/src/main/resources/kotlin/src/main/kotlin/packagename/paths/path/verb/Parameters.hbs b/src/main/resources/kotlin/src/main/kotlin/packagename/paths/path/verb/Parameters.hbs new file mode 100644 index 00000000000..d5b8af5e853 --- /dev/null +++ b/src/main/resources/kotlin/src/main/kotlin/packagename/paths/path/verb/Parameters.hbs @@ -0,0 +1,88 @@ +{{#with parametersInfo}} +package {{packageName}}.{{subpackage}}; + + {{#with pathItemParameters}} + {{#each allParameters}} +import {{packageName}}.{{subpackage}}.{{jsonPathPiece.pascalCase}}; + {{/each}} + {{/with}} + {{#with parameters}} + {{#each allParameters}} +import {{packageName}}.{{subpackage}}.{{jsonPathPiece.pascalCase}}; + {{/each}} + {{/with}} + {{#if pathParametersSchema}} +import {{packageName}}.parameter.PathSerializer; + {{/if}} + {{#if headerParametersSchema}} +import {{packageName}}.parameter.HeadersSerializer; + {{/if}} + {{#if queryParametersSchema}} +import {{packageName}}.parameter.QuerySerializer; + {{/if}} + {{#if cookieParametersSchema}} +import {{packageName}}.parameter.CookieSerializer; + {{/if}} + +import java.util.Map; +import java.util.AbstractMap; + +public class {{jsonPathPiece.pascalCase}} { + {{#if pathParametersSchema}} + + public static class PathParametersSerializer extends PathSerializer { + public PathParametersSerializer() { + super( + Map.ofEntries( + {{#each pathParameters}} + new AbstractMap.SimpleEntry<>("{{#with getSelfOrDeepestRef}}{{{name}}}{{/with}}", new {{jsonPathPiece.pascalCase}}.{{jsonPathPiece.pascalCase}}1()){{#unless @last}},{{/unless}} + {{/each}} + ) + ); + } + } + {{/if}} + {{#if queryParametersSchema}} + + public static class QueryParametersSerializer extends QuerySerializer { + public QueryParametersSerializer() { + super( + Map.ofEntries( + {{#each queryParameters}} + new AbstractMap.SimpleEntry<>("{{#with getSelfOrDeepestRef}}{{{name}}}{{/with}}", new {{jsonPathPiece.pascalCase}}.{{jsonPathPiece.pascalCase}}1()){{#unless @last}},{{/unless}} + {{/each}} + ) + ); + } + } + {{/if}} + {{#if headerParametersSchema}} + + public static class HeaderParametersSerializer extends HeadersSerializer { + public HeaderParametersSerializer() { + super( + Map.ofEntries( + {{#each headerParameters}} + new AbstractMap.SimpleEntry<>("{{#with getSelfOrDeepestRef}}{{{name}}}{{/with}}", new {{jsonPathPiece.pascalCase}}.{{jsonPathPiece.pascalCase}}1()){{#unless @last}},{{/unless}} + {{/each}} + ) + ); + } + } + {{/if}} + {{#if cookieParametersSchema}} + + public static class CookieParametersSerializer extends CookieSerializer { + public CookieParametersSerializer() { + super( + Map.ofEntries( + {{#each cookieParameters}} + new AbstractMap.SimpleEntry<>("{{#with getSelfOrDeepestRef}}{{{name}}}{{/with}}", new {{jsonPathPiece.pascalCase}}.{{jsonPathPiece.pascalCase}}1()){{#unless @last}},{{/unless}} + {{/each}} + ) + ); + } + } + {{/if}} +} +{{/with}} \ No newline at end of file diff --git a/src/main/resources/kotlin/src/main/kotlin/packagename/paths/path/verb/Responses.hbs b/src/main/resources/kotlin/src/main/kotlin/packagename/paths/path/verb/Responses.hbs new file mode 100644 index 00000000000..2aff218307e --- /dev/null +++ b/src/main/resources/kotlin/src/main/kotlin/packagename/paths/path/verb/Responses.hbs @@ -0,0 +1,156 @@ +package {{packageName}}.{{responses.subpackage}}; + +{{#each responses}} +import {{{packageName}}}.{{subpackage}}.{{jsonPathPiece.pascalCase}}; + {{#with getSelfOrDeepestRef}} + {{#with headersObjectSchema}} +import {{{packageName}}}.{{subpackage}}.{{containerJsonPathPiece.pascalCase}}; + {{/with}} + {{/with}} +{{/each}} +import {{{packageName}}}.exceptions.ApiException; +import {{{packageName}}}.exceptions.NotImplementedException; +import {{{packageName}}}.exceptions.ValidationException; +{{#if nonErrorResponses }} +import {{{packageName}}}.response.ApiResponse; +{{/if}} +import {{{packageName}}}.response.ResponsesDeserializer; +import {{{packageName}}}.configurations.SchemaConfiguration; +import org.checkerframework.checker.nullness.qual.Nullable; + +import java.net.http.HttpResponse; +import java.util.Map; +import java.util.AbstractMap; + +public class {{responses.jsonPathPiece.pascalCase}} { + {{#if nonErrorResponses}} + public sealed interface EndpointResponse permits {{#each nonErrorResponses}}Endpoint{{jsonPathPiece.pascalCase}}{{#unless @last}}, {{/unless}}{{/each}} {} + {{#each nonErrorResponses}} + + public record Endpoint{{jsonPathPiece.pascalCase}}( + HttpResponse response, + {{#if hasContentSchema}}{{jsonPathPiece.pascalCase}}.SealedResponseBody{{else}}Nothing?{{/if}} body, + {{#with getSelfOrDeepestRef}}{{#with headersObjectSchema}}{{containerJsonPathPiece.pascalCase}}.{{mapOutputJsonPathPiece.pascalCase}}{{else}}Nothing?{{/with}}{{/with}} headers + ) implements EndpointResponse, ApiResponse<{{#if hasContentSchema}}{{jsonPathPiece.pascalCase}}.SealedResponseBody{{else}}Nothing?{{/if}}, {{#with getSelfOrDeepestRef}}{{#with headersObjectSchema}}{{containerJsonPathPiece.pascalCase}}.{{mapOutputJsonPathPiece.pascalCase}}{{else}}Nothing?{{/with}}{{/with}}>{ + } + {{/each}} + {{/if}} + {{#if statusCodeResponses}} + + public sealed interface StatusCodeResponseDeserializer permits {{#each statusCodeResponses}}Status{{jsonPathPiece.pascalCase}}Deserializer{{#unless @last}}, {{/unless}}{{/each}} {} + + {{#each statusCodeResponses}} + public static final class Status{{jsonPathPiece.pascalCase}}Deserializer extends {{jsonPathPiece.pascalCase}}.{{jsonPathPiece.pascalCase}}1 implements StatusCodeResponseDeserializer { + } + {{/each}} + {{/if}} + {{#if wildcardCodeResponses}} + public sealed interface WildcardCodeResponseDeserializer permits {{#each wildcardCodeResponses}}Wildcard{{jsonPathPiece.pascalCase}}Deserializer{{#unless @last}}, {{/unless}}{{/each}} {} + + {{#each wildcardCodeResponses}} + public static final class Wildcard{{jsonPathPiece.pascalCase}}Deserializer extends {{jsonPathPiece.pascalCase}}.{{jsonPathPiece.pascalCase}}1 implements WildcardCodeResponseDeserializer { + } + {{/each}} + {{/if}} + + public static final class {{responses.jsonPathPiece.pascalCase}}1 implements ResponsesDeserializer<{{#if nonErrorResponses }}EndpointResponse{{else}}Nothing?{{/if}}> { + {{#if statusCodeResponses}} + private final Map statusCodeToResponseDeserializer; + {{/if}} + {{#if wildcardCodeResponses}} + private final Map wildcardCodeToResponseDeserializer; + {{/if}} + {{#with defaultResponse}} + private final {{jsonPathPiece.pascalCase}}.{{jsonPathPiece.pascalCase}}1 defaultResponseDeserializer; + {{/with}} + public {{responses.jsonPathPiece.pascalCase}}1() { + {{#if statusCodeResponses }} + this.statusCodeToResponseDeserializer = Map.ofEntries( + {{#each statusCodeResponses }} + new AbstractMap.SimpleEntry<>("{{@key}}", new Status{{jsonPathPiece.pascalCase}}Deserializer()){{#unless @last}},{{/unless}} + {{/each}} + ); + {{/if}} + {{#if wildcardCodeResponses }} + this.wildcardCodeToResponseDeserializer = Map.ofEntries( + {{#each wildcardCodeResponses }} + new AbstractMap.SimpleEntry<>("{{@key}}", new Wildcard{{jsonPathPiece.snakeCase}}Deserializer()){{#unless @last}},{{/unless}} + {{/each}} + ); + {{/if}} + {{#with defaultResponse}} + this.defaultResponseDeserializer = new {{jsonPathPiece.pascalCase}}.{{jsonPathPiece.pascalCase}}1(); + {{/with}} + } + + public {{#if nonErrorResponses }}EndpointResponse{{else}}Nothing?{{/if}} deserialize(HttpResponse response, SchemaConfiguration configuration) throws ValidationException, NotImplementedException, ApiException { +{{#eq defaultResponse null }} + String statusCode = String.valueOf(response.statusCode()); + {{#and statusCodeResponses wildcardCodeResponses }} + @Nullable StatusCodeResponseDeserializer statusCodeDeserializer = statusCodeToResponseDeserializer.get(statusCode); + if (statusCodeDeserializer != null) { + {{> src/main/kotlin/packagename/paths/path/verb/_statusCodeDeserialization }} + } + @Nullable WildcardCodeResponseDeserializer wildcardCodeDeserializer = wildcardCodeToResponseDeserializer.get(statusCode); + if (wildcardCodeDeserializer == null) { + throw new ApiException( + "Invalid response statusCode="+statusCode+" has no response defined in the openapi document", + response + ); + } + {{> src/main/kotlin/packagename/paths/path/verb/_wildcardCodeDeserialization }} + {{else}} + {{#or statusCodeResponses wildcardCodeResponses }} + {{#if statusCodeResponses }} + @Nullable StatusCodeResponseDeserializer statusCodeDeserializer = statusCodeToResponseDeserializer.get(statusCode); + if (statusCodeDeserializer == null) { + throw new ApiException( + "Invalid response statusCode="+statusCode+" has no response defined in the openapi document", + response + ); + } + {{> src/main/kotlin/packagename/paths/path/verb/_statusCodeDeserialization }} + {{else}} + @Nullable WildcardCodeResponseDeserializer wildcardCodeDeserializer = wildcardCodeToResponseDeserializer.get(statusCode); + if (wildcardCodeDeserializer == null) { + throw new ApiException( + "Invalid response statusCode="+statusCode+" has no response defined in the openapi document", + response + ); + } + {{> src/main/kotlin/packagename/paths/path/verb/_wildcardCodeDeserialization }} + {{/if}} + {{/or}} + {{/and}} +{{else}} + {{#and statusCodeResponses wildcardCodeResponses }} + String statusCode = String.valueOf(response.statusCode()); + {{else}} + {{#or statusCodeResponses wildcardCodeResponses }} + String statusCode = String.valueOf(response.statusCode()); + {{#if statusCodeResponses}} + @Nullable StatusCodeResponseDeserializer statusCodeDeserializer = statusCodeToResponseDeserializer.get(statusCode); + if (statusCodeDeserializer != null) { + {{> src/main/kotlin/packagename/paths/path/verb/_statusCodeDeserialization }} + } + {{else}} + @Nullable WildcardCodeResponseDeserializer wildcardCodeDeserializer = wildcardCodeToResponseDeserializer.get(statusCode); + if (wildcardCodeDeserializer != null) { + {{> src/main/kotlin/packagename/paths/path/verb/_wildcardCodeDeserialization }} + } + {{/if}} + var deserializedResponse = defaultResponseDeserializer.deserialize(response, configuration); + {{#with defaultResponse}} + return new Endpoint{{jsonPathPiece.pascalCase}}(response, deserializedResponse.body(), deserializedResponse.headers()); + {{/with}} + {{else}} + var deserializedResponse = defaultResponseDeserializer.deserialize(response, configuration); + {{#with defaultResponse}} + return new Endpoint{{jsonPathPiece.pascalCase}}(response, deserializedResponse.body(), deserializedResponse.headers()); + {{/with}} + {{/or}} + {{/and}} +{{/eq}} + } + } +} diff --git a/src/main/resources/kotlin/src/main/kotlin/packagename/paths/path/verb/ResponsesDoc.hbs b/src/main/resources/kotlin/src/main/kotlin/packagename/paths/path/verb/ResponsesDoc.hbs new file mode 100644 index 00000000000..2216d232aa7 --- /dev/null +++ b/src/main/resources/kotlin/src/main/kotlin/packagename/paths/path/verb/ResponsesDoc.hbs @@ -0,0 +1,41 @@ +{{headerSize}} {{responses.jsonPathPiece.pascalCase}} + +public class {{responses.jsonPathPiece.pascalCase}} + +A class that contains necessary responses classes + {{#if nonErrorResponses}} +- a sealed interface, EndpointResponse, that stores endpoint responses +- records for each endpoint response + {{/if}} + +{{headerSize}}# Nested Class Summary +| Modifier and Type | Class and Description | +| ----------------- | --------------------- | +{{#if nonErrorResponses}} +| sealed interface | [EndpointResponse](#endpointresponse)
stores the endpoint responses | + {{#each nonErrorResponses}} +| record | [Endpoint{{jsonPathPiece.pascalCase}}](#endpoint{{jsonPathPiece.kebabCase}})
the response for {{jsonPathPiece.original}} | + {{/each}} +{{/if}} +{{#if nonErrorResponses}} + +{{headerSize}}# EndpointResponse +public sealed interface EndpointResponse permits
+ {{#each nonErrorResponses}} +[Endpoint{{jsonPathPiece.pascalCase}}](#endpoint{{jsonPathPiece.kebabCase}}){{#unless @last}},{{/unless}} + {{/each}} + +a sealed interface that stores endpoint responses +{{/if}} +{{#each nonErrorResponses}} + +{{headerSize}}# Endpoint{{jsonPathPiece.pascalCase}} +public record Endpoint{{jsonPathPiece.pascalCase}}( + HttpResponse response, + {{#if hasContentSchema}}[{{jsonPathPiece.pascalCase}}.SealedResponseBody]({{docRoot}}{{pathFromDocRoot}}.md#sealedresponsebody){{else}}Nothing?{{/if}} body, + {{#with getSelfOrDeepestRef}}{{#with headersObjectSchema}}[{{containerJsonPathPiece.pascalCase}}.{{mapOutputJsonPathPiece.pascalCase}}]({{docRoot}}{{pathFromDocRoot}}.md#{{mapOutputJsonPathPiece.kebabCase}}){{else}}Nothing?{{/with}}{{/with}} headers +) implements EndpointResponse, ApiResponse<{{#if hasContentSchema}}{{jsonPathPiece.pascalCase}}.SealedResponseBody{{else}}Nothing?{{/if}}, {{#with getSelfOrDeepestRef}}{{#with headersObjectSchema}}{{containerJsonPathPiece.pascalCase}}.{{mapOutputJsonPathPiece.pascalCase}}{{else}}Nothing?{{/with}}{{/with}}>
+ +a class that stores an endpoint response +{{/each}} + diff --git a/src/main/resources/kotlin/src/main/kotlin/packagename/paths/path/verb/_FinalRequestClassDoc.hbs b/src/main/resources/kotlin/src/main/kotlin/packagename/paths/path/verb/_FinalRequestClassDoc.hbs new file mode 100644 index 00000000000..e53398ccf3e --- /dev/null +++ b/src/main/resources/kotlin/src/main/kotlin/packagename/paths/path/verb/_FinalRequestClassDoc.hbs @@ -0,0 +1,25 @@ +{{headerSize}}# {{method.pascalCase}}Request +public static class {{method.pascalCase}}Request
+ +a class that stores the final request inputs + +{{headerSize}}## Field Summary +| Modifier and Type | Field and Description | +| ----------------- | --------------------- | +{{#each (reverse builders)}} + {{#or @first @last}} + {{#each keyToBuilder}} + {{#with property}} + {{#if containerJsonPathPiece}} +| [{{containerJsonPathPiece.pascalCase}}.{{#if ../../@last}}@Nullable {{/if}}{{operationInputClassName.pascalCase}}]({{docRoot}}{{pathFromDocRoot}}.md#{{operationInputClassName.kebabCase}}) | {{@key.camelCase}}{{#if ../../@last}}
optional{{/if}} | + {{else}} + {{#if this.jsonPathPiece}} +| [{{jsonPathPiece.pascalCase}}.{{#if ../../@last}}@Nullable {{/if}}{{operationInputClassName.pascalCase}}]({{docRoot}}{{pathFromDocRoot}}.md#{{operationInputClassName.kebabCase}}) | {{@key.camelCase}}{{#if ../../@last}}
optional{{/if}}{{#or (eq @key.camelCase "securityIndex") (eq @key.camelCase "serverIndex")}}. Note: this will override the value in apiConfiguration{{/or}} | + {{else}} +| {{#if ../../@last}}@Nullable {{/if}}{{operationInputClassName.pascalCase}} | {{@key.camelCase}}{{#if ../../@last}}
optional{{/if}}{{#eq @key.camelCase "timeout"}}. Note: this will override the value in apiConfiguration{{/eq}} | + {{/if}} + {{/if}} + {{/with}} + {{/each}} + {{/or}} +{{/each}} diff --git a/src/main/resources/kotlin/src/main/kotlin/packagename/paths/path/verb/_OperationDocCodeSample.hbs b/src/main/resources/kotlin/src/main/kotlin/packagename/paths/path/verb/_OperationDocCodeSample.hbs new file mode 100644 index 00000000000..99f842d6307 --- /dev/null +++ b/src/main/resources/kotlin/src/main/kotlin/packagename/paths/path/verb/_OperationDocCodeSample.hbs @@ -0,0 +1,270 @@ +``` +import {{packageName}}.configurations.ApiConfiguration; +import {{packageName}}.configurations.SchemaConfiguration; +import {{packageName}}.configurations.JsonSchemaKeywordFlags; +import {{packageName}}.exceptions.ValidationException; +import {{packageName}}.exceptions.NotImplementedException; +import {{packageName}}.exceptions.ApiException; +import {{{packageName}}}.schemas.validation.MapUtils; +import {{{packageName}}}.schemas.validation.FrozenList; +import {{{packageName}}}.schemas.validation.FrozenMap; + {{#each builders}} + {{#or @first @last}} + {{#each keyToBuilder}} + {{#with property}} + {{#if containerJsonPathPiece}} +import {{packageName}}.{{subpackage}}.{{containerJsonPathPiece.pascalCase}}; + {{else}} + {{#if this.jsonPathPiece}} + {{#if subpackage}} +import {{packageName}}.{{subpackage}}.{{jsonPathPiece.pascalCase}}; + {{else}} +import {{packageName}}.{{jsonPathPiece.pascalCase}}; + {{/if}} + {{/if}} + {{/if}} + {{#if ../../@last}} + {{#eq @key.camelCase "requestBody"}} + {{#with getSelfOrDeepestRef}} + {{#each content}} + {{#if @first}} + {{#with schema}} + {{#with getSelfOrDeepestRef}} +import {{packageName}}.{{subpackage}}.{{containerJsonPathPiece.pascalCase}}; + {{/with}} + {{/with}} + {{/if}} + {{/each}} + {{/with}} + {{/eq}} + {{/if}} + {{/with}} + {{/each}} + {{/or}} + {{/each}} + {{#each builders}} + {{#if @first}} + {{#each keyToBuilder}} + {{#eq @key.camelCase "serverIndex"}} + {{#with property}} + {{! CodegenList of CodegenServer }} + {{#each this}} +import {{packageName}}.{{subpackage}}.{{jsonPathPiece.pascalCase}}; + {{/each}} + {{/with}} + {{/eq}} + {{#eq @key.camelCase "securityIndex"}} +import {{packageName}}.securityschemes.SecurityScheme; + {{#with property}} + {{! CodegenList of SecurityRequirementObject }} + {{#each this}} + {{#each map}} + {{#with refInfo.ref}} + {{! SecurityScheme }} +import {{packageName}}.components.securityschemes.{{jsonPathPiece.pascalCase}}; + {{/with}} + {{/each}} + {{/each}} + {{/with}} + {{/eq}} + {{/each}} + {{/if}} + {{/each}} + {{#each responses}} +import {{{packageName}}}.{{subpackage}}.{{jsonPathPiece.pascalCase}}; + {{#with getSelfOrDeepestRef}} + {{#with headersObjectSchema}} +import {{{packageName}}}.{{subpackage}}.{{containerJsonPathPiece.pascalCase}}; + {{/with}} + {{/with}} + {{/each}} + {{#with servers}} +import {{packageName}}.{{#if subpackage}}{{subpackage}}{{else}}servers{{/if}}.{{jsonPathPiece.pascalCase}}; + {{/with}} +import {{packageName}}.{{apiSubpackage}}.{{apiContainerClass}}; + {{#with responses}} +import {{packageName}}.{{subpackage}}.{{jsonPathPiece.pascalCase}}; + {{/with}} + +import java.io.IOException; +import java.util.Arrays; +import java.util.List; +import java.util.Map; +import java.util.AbstractMap; + +// if you want to use a server that is not SERVER_0 pass it in here and change the ServerIndex input below +ApiConfiguration.ServerInfo serverInfo = new ApiConfiguration.ServerInfoBuilder() + .{{servers.jsonPathPiece.camelCase}}( + new {{servers.jsonPathPiece.pascalCase}}.{{servers.jsonPathPiece.pascalCase}}Builder() + {{#each servers}} + {{#if @first}} + .{{jsonPathPiece.camelCase}}(new {{jsonPathPiece.pascalCase}}()) + .build() + {{/if}} + {{/each}} + ) + .build(); +ApiConfiguration.ServerIndexInfo serverIndexInfo = new ApiConfiguration.ServerIndexInfoBuilder() + {{#each builders}} + {{#if @first}} + {{#each keyToBuilder}} + {{#eq @key.camelCase "serverIndex"}} + {{#with property}} + {{! CodegenList of CodegenServer }} + .{{jsonPathPiece.camelCase}}ServerIndex({{jsonPathPiece.pascalCase}}.ServerIndex.SERVER_0) + {{/with}} + {{/eq}} + {{/each}} + .build(); + {{/if}} + {{/each}} + {{#each builders}} + {{#if @first}} + {{#each keyToBuilder}} + {{#eq @key.camelCase "securityIndex"}} + {{#with property}} +List securitySchemes = new ArrayList(); + {{! CodegenList of SecurityRequirementObject }} + {{#each this}} + {{#each map}} + {{#with refInfo.ref}} +{{> src/main/kotlin/packagename/paths/path/verb/_OperationDocSSCodeSample }} + {{/with}} + {{/each}} + {{/each}} + {{/with}} + {{/eq}} + {{/each}} + {{/if}} + {{/each}} + {{#each security}} + {{#if @first}} +ApiConfiguration.SecurityIndexInfo securityIndexInfo = new ApiConfiguration.SecurityIndexInfoBuilder() + .{{jsonPathPiece.camelCase}}SecurityIndex({{jsonPathPiece.pascalCase}}.SecurityIndex.SECURITY_0) + .build(); + {{/if}} + {{/each}} +Duration timeout = Duration.ofSeconds(1L); +Map> defaultHeaders = Map.of("User-Agent", List.of("{{#if httpUserAgent}}{{{httpUserAgent}}}{{else}}OpenAPI-JSON-Schema-Generator/{{{artifactVersion}}}/java{{/if}}")); +ApiConfiguration apiConfiguration = new ApiConfiguration( + serverInfo + serverIndexInfo, + {{#each builders}} + {{#if @first}} + {{#each keyToBuilder}} + {{#eq @key.camelCase "securityIndex"}} + securitySchemes, + securityIndexInfo, + {{/eq}} + {{/each}} + {{/if}} + {{/each}} + timeout, + defaultHeaders +); +SchemaConfiguration schemaConfiguration = new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().build()); +{{apiFullyQualifiedClass}} apiClient = new {{apiFullyQualifiedClass}}(apiConfiguration, schemaConfiguration); + + {{#gt builders.size 1}} + {{#each builders}} + {{#if @last}} + {{#each keyToBuilder}} + {{#with property}} + {{#if containerJsonPathPiece}} + {{#each (reverse getSchemas)}} + {{#eq instanceType "schema"}} +{{> src/main/kotlin/packagename/components/schemas/validateSchemaCodeSample payloadVarName=../@key.camelCase configVarName="schemaConfiguration" }} + {{/eq}} + {{/each}} + {{else}} + {{! CodegenRequestBody }} + {{#with getSelfOrDeepestRef}} + {{#each content}} + {{#if @first}} + {{#with schema}} + {{#with getSelfOrDeepestRef}} +{{> src/main/kotlin/packagename/components/schemas/validateAndBoxSchemaCodeSample payloadVarName="requestBodyPayload" configVarName="schemaConfiguration" }} + {{/with}} + {{/with}} +{{../../jsonPathPiece.pascalCase}}.{{../operationInputClassName.pascalCase}} {{../@key.camelCase}} = new {{../../jsonPathPiece.pascalCase}}.{{@key.pascalCase}}RequestBody(requestBodyPayload); + {{/if}} + {{/each}} + {{/with}} + {{/if}} + {{/with}} + {{/each}} + {{/if}} + {{/each}} + {{/gt}} + + {{#eq builders.size 1}} + {{! only option props}} + {{#each builders}} +var request = new {{../jsonPathPiece.pascalCase}}.{{className.pascalCase}}().build(); + {{/each}} + {{else}} + {{#each builders}} + {{#if @last}} +var request = new {{../jsonPathPiece.pascalCase}}.{{className.pascalCase}}() + {{#each keyToBuilder}} + .{{@key.camelCase}}({{@key.camelCase}}) + {{#if @last}} + .build(); + {{/if}} + {{/each}} + {{/if}} + {{/each}} + {{/eq}} + +{{#if nonErrorResponses }}{{responses.jsonPathPiece.pascalCase}}.EndpointResponse{{else}}Nothing?{{/if}} response; +try { + response = apiClient.{{jsonPathPiece.camelCase}}(request); +{{#or errorStatusCodes errorWildcardStatusCodes}} +} catch ({{> src/main/kotlin/packagename/paths/path/verb/_OperationDocExcCodeSample }} e) { + // server returned an error response defined in the openapi document + throw e; +{{/or}} +} catch (ApiException e) { + // server returned a response/contentType not defined in the openapi document + throw e; +} catch (ValidationException e) { + // the returned response body or header values do not conform the the schema validation requirements + throw e; +} catch (IOException | InterruptedException e) { + // an exception happened when making the request + throw e; +} catch (NotImplementedException e) { + // the request body serialization or deserialization has not yet been implemented + // or the header content type deserialization has not yet been implemented for this contentType + throw e; +} +{{#if nonErrorResponses}} + {{#eq nonErrorResponses.size 1}} + {{#each nonErrorResponses}} +{{responses.jsonPathPiece.pascalCase}}.Endpoint{{jsonPathPiece.pascalCase}} castResponse = ({{responses.jsonPathPiece.pascalCase}}.Endpoint{{jsonPathPiece.pascalCase}}) response; + {{#if hasContentSchema}} +{{> src/main/kotlin/packagename/paths/path/verb/_OperationDocResBodyCodeSample }} + {{/if}} + {{/each}} + {{else}} + {{#each nonErrorResponses}} + {{#if @first}} +if (response instanceof {{responses.jsonPathPiece.pascalCase}}.Endpoint{{jsonPathPiece.pascalCase}} castResponse) { + {{else}} + {{#if @last}} +} else { + {{responses.jsonPathPiece.pascalCase}}.Endpoint{{jsonPathPiece.pascalCase}} castResponse = ({{responses.jsonPathPiece.pascalCase}}.Endpoint{{jsonPathPiece.pascalCase}}) response; + {{else}} +} else if (response instanceof {{responses.jsonPathPiece.pascalCase}}.Endpoint{{jsonPathPiece.pascalCase}} castResponse) { + {{/if}} + {{/if}} + {{#if hasContentSchema}} + {{> src/main/kotlin/packagename/paths/path/verb/_OperationDocResBodyCodeSample }} + {{/if}} + {{#if @last}} +} + {{/if}} + {{/each}} + {{/eq}} +{{/if}} +``` \ No newline at end of file diff --git a/src/main/resources/kotlin/src/main/kotlin/packagename/paths/path/verb/_OperationDocExcCodeSample.hbs b/src/main/resources/kotlin/src/main/kotlin/packagename/paths/path/verb/_OperationDocExcCodeSample.hbs new file mode 100644 index 00000000000..27e3a690131 --- /dev/null +++ b/src/main/resources/kotlin/src/main/kotlin/packagename/paths/path/verb/_OperationDocExcCodeSample.hbs @@ -0,0 +1,11 @@ +{{#and errorStatusCodes errorWildcardStatusCodes}} +{{#each errorStatusCodes}}{{#with (mapLookup ../statusCodeResponses .)}}{{jsonPathPiece.pascalCase}}{{/with}}.ResponseApiException | {{/each}}{{#each errorWildcardStatusCodes}}{{#with (mapLookup ../wildcardCodeResponses .)}}{{jsonPathPiece.pascalCase}}{{/with}}.ResponseApiException{{#unless @last}} | {{/unless}}{{/each}} +{{~else}} + {{#or errorStatusCodes errorWildcardStatusCodes}} + {{#if errorStatusCodes}} +{{#each errorStatusCodes}}{{#unless @first}} | {{/unless}}{{#with (mapLookup ../statusCodeResponses .)}}{{jsonPathPiece.pascalCase}}{{/with}}.ResponseApiException{{/each}} + {{~else}} +{{#each errorWildcardStatusCodes}}{{#unless @first}} | {{/unless}}{{#with (mapLookup ../wildcardCodeResponses .)}}{{jsonPathPiece.pascalCase}}{{/with}}.ResponseApiException{{/each}} + {{~/if}} + {{/or}} +{{/and}} diff --git a/src/main/resources/kotlin/src/main/kotlin/packagename/paths/path/verb/_OperationDocResBodyCodeSample.hbs b/src/main/resources/kotlin/src/main/kotlin/packagename/paths/path/verb/_OperationDocResBodyCodeSample.hbs new file mode 100644 index 00000000000..89c6499989c --- /dev/null +++ b/src/main/resources/kotlin/src/main/kotlin/packagename/paths/path/verb/_OperationDocResBodyCodeSample.hbs @@ -0,0 +1,21 @@ +{{#eq content.size 1}} + {{#each content}} +{{../jsonPathPiece.pascalCase}}.{{@key.pascalCase}}ResponseBody deserializedBody = ({{../jsonPathPiece.pascalCase}}.{{@key.pascalCase}}ResponseBody) castResponse.body; +// handle deserialized body here + {{/each}} +{{else}} + {{#each content}} + {{#if @first}} +if (castResponse.body instanceof {{../jsonPathPiece.pascalCase}}.{{@key.pascalCase}}ResponseBody deserializedBody) { + {{else}} + {{#if @last}} +} else { + {{../jsonPathPiece.pascalCase}}.{{@key.pascalCase}}ResponseBody deserializedBody = ({{../jsonPathPiece.pascalCase}}.{{@key.pascalCase}}ResponseBody) castResponse.body; + {{else}} +} else if (castResponse.body instanceof {{../jsonPathPiece.pascalCase}}.{{@key.pascalCase}}ResponseBody deserializedBody) { + {{/if}} + {{/if}} + // handle deserialized body here + {{/each}} +} +{{/eq}} diff --git a/src/main/resources/kotlin/src/main/kotlin/packagename/paths/path/verb/_OperationDocSSCodeSample.hbs b/src/main/resources/kotlin/src/main/kotlin/packagename/paths/path/verb/_OperationDocSSCodeSample.hbs new file mode 100644 index 00000000000..6bcbc6b1994 --- /dev/null +++ b/src/main/resources/kotlin/src/main/kotlin/packagename/paths/path/verb/_OperationDocSSCodeSample.hbs @@ -0,0 +1,20 @@ +{{! only make code samples for one that are known}} +{{#eq type "apiKey"}} +securitySchemes.add( + new {{jsonPathPiece.pascalCase}}("someApiKey"); +); +{{else}} + {{#eq type "http"}} + {{#eq scheme "basic"}} +securitySchemes.add( + new {{jsonPathPiece.pascalCase}}("someUserId", "somePassword"); +); + {{else}} + {{#eq scheme "bearer"}} +securitySchemes.add( + new {{jsonPathPiece.pascalCase}}("someAccessToken"); +); + {{/eq}} + {{/eq}} + {{/eq}} +{{/eq}} diff --git a/src/main/resources/kotlin/src/main/kotlin/packagename/paths/path/verb/_returnOrThrow.hbs b/src/main/resources/kotlin/src/main/kotlin/packagename/paths/path/verb/_returnOrThrow.hbs new file mode 100644 index 00000000000..a78943857fe --- /dev/null +++ b/src/main/resources/kotlin/src/main/kotlin/packagename/paths/path/verb/_returnOrThrow.hbs @@ -0,0 +1,17 @@ +{{#if nonErrorStatusCodes}} + {{#contains nonErrorStatusCodes @key }} +return new Endpoint{{jsonPathPiece.pascalCase}}(response, deserializedResponse.body(), deserializedResponse.headers()); + {{else}} +throw new {{jsonPathPiece.pascalCase}}.ResponseApiException( + "Received error statusCode response from server", + response, + deserializedResponse +); + {{/contains}} +{{else}} +throw new {{jsonPathPiece.pascalCase}}.ResponseApiException( + "Received error statusCode response from server", + response, + deserializedResponse +); +{{/if}} \ No newline at end of file diff --git a/src/main/resources/kotlin/src/main/kotlin/packagename/paths/path/verb/_statusCodeDeserialization.hbs b/src/main/resources/kotlin/src/main/kotlin/packagename/paths/path/verb/_statusCodeDeserialization.hbs new file mode 100644 index 00000000000..54f57cf0139 --- /dev/null +++ b/src/main/resources/kotlin/src/main/kotlin/packagename/paths/path/verb/_statusCodeDeserialization.hbs @@ -0,0 +1,23 @@ +{{#eq statusCodeResponses.size 1}} + {{#each statusCodeResponses}} +Status{{jsonPathPiece.pascalCase}}Deserializer castDeserializer = (Status{{jsonPathPiece.pascalCase}}Deserializer) statusCodeDeserializer; +var deserializedResponse = castDeserializer.deserialize(response, configuration); +{{> src/main/kotlin/packagename/paths/path/verb/_returnOrThrow }} + {{/each}} +{{else}} + {{#each statusCodeResponses}} + {{#if @first}} +if (statusCodeDeserializer instanceof Status{{jsonPathPiece.pascalCase}}Deserializer castDeserializer) { + {{else}} + {{#if @last}} +} else { + Status{{jsonPathPiece.pascalCase}}Deserializer castDeserializer = (Status{{jsonPathPiece.pascalCase}}Deserializer) statusCodeDeserializer; + {{else}} +} else if (statusCodeDeserializer instanceof Status{{jsonPathPiece.pascalCase}}Deserializer castDeserializer) { + {{/if}} + {{/if}} + var deserializedResponse = castDeserializer.deserialize(response, configuration); + {{> src/main/kotlin/packagename/paths/path/verb/_returnOrThrow }} + {{/each}} +} +{{/eq}} \ No newline at end of file diff --git a/src/main/resources/kotlin/src/main/kotlin/packagename/paths/path/verb/_wildcardCodeDeserialization.hbs b/src/main/resources/kotlin/src/main/kotlin/packagename/paths/path/verb/_wildcardCodeDeserialization.hbs new file mode 100644 index 00000000000..e64169ff8b9 --- /dev/null +++ b/src/main/resources/kotlin/src/main/kotlin/packagename/paths/path/verb/_wildcardCodeDeserialization.hbs @@ -0,0 +1,23 @@ +{{#eq wildcardCodeResponses.size 1}} + {{#each wildcardCodeResponses}} +Wildcard{{jsonPathPiece.pascalCase}}Deserializer castDeserializer = (Wildcard{{jsonPathPiece.pascalCase}}Deserializer) wildcardCodeDeserializer; +var deserializedResponse = castDeserializer.deserialize(response, configuration); +{{> src/main/kotlin/packagename/paths/path/verb/_returnOrThrow }} + {{/each}} +{{else}} + {{#each wildcardCodeResponses}} + {{#if @first}} +if (wildcardCodeDeserializer instanceof Wildcard{{jsonPathPiece.pascalCase}}Deserializer castDeserializer) { + {{else}} + {{#if @last}} +} else { + Wildcard{{jsonPathPiece.pascalCase}}Deserializer castDeserializer = (Wildcard{{jsonPathPiece.pascalCase}}Deserializer) wildcardCodeDeserializer; + {{else}} +} else if (wildcardCodeDeserializer instanceof Wildcard{{jsonPathPiece.pascalCase}}Deserializer castDeserializer) { + {{/if}} + {{/if}} + var deserializedResponse = castDeserializer.deserialize(response, configuration); + {{> src/main/kotlin/packagename/paths/path/verb/_returnOrThrow }} + {{/each}} +} +{{/eq}} \ No newline at end of file diff --git a/src/main/resources/kotlin/src/main/kotlin/packagename/requestbody/GenericRequestBody.hbs b/src/main/resources/kotlin/src/main/kotlin/packagename/requestbody/GenericRequestBody.hbs new file mode 100644 index 00000000000..a411f45b743 --- /dev/null +++ b/src/main/resources/kotlin/src/main/kotlin/packagename/requestbody/GenericRequestBody.hbs @@ -0,0 +1,6 @@ +package {{{packageName}}}.requestbody; + +public interface GenericRequestBody { + String contentType(); + SealedSchemaOutputClass body(); +} \ No newline at end of file diff --git a/src/main/resources/kotlin/src/main/kotlin/packagename/requestbody/RequestBodySerializer.hbs b/src/main/resources/kotlin/src/main/kotlin/packagename/requestbody/RequestBodySerializer.hbs new file mode 100644 index 00000000000..3c1ed740dd6 --- /dev/null +++ b/src/main/resources/kotlin/src/main/kotlin/packagename/requestbody/RequestBodySerializer.hbs @@ -0,0 +1,47 @@ +package {{{packageName}}}.requestbody; + +import java.net.http.HttpRequest; +import org.checkerframework.checker.nullness.qual.Nullable; +import {{{packageName}}}.schemas.validation.JsonSchema; +import {{{packageName}}}.contenttype.ContentTypeDetector; +import {{{packageName}}}.contenttype.ContentTypeSerializer; +import {{{packageName}}}.exceptions.NotImplementedException; + +import java.util.Map; + +public abstract class RequestBodySerializer { + /* + * Describes a single request body + * content: contentType to MediaType schema info + */ + public final Map content; + public final boolean required; + + public RequestBodySerializer(Map content, boolean required) { + this.content = content; + this.required = required; + } + + private SerializedRequestBody serializeJson(String contentType, @Nullable Object body) { + String jsonText = ContentTypeSerializer.toJson(body); + return new SerializedRequestBody(contentType, HttpRequest.BodyPublishers.ofString(jsonText)); + } + + private SerializedRequestBody serializeTextPlain(String contentType, @Nullable Object body) { + if (body instanceof String stringBody) { + return new SerializedRequestBody(contentType, HttpRequest.BodyPublishers.ofString(stringBody)); + } + throw new RuntimeException("Invalid non-string data type of "+JsonSchema.getClass(body)+" for text/plain body serialization"); + } + + protected SerializedRequestBody serialize(String contentType, @Nullable Object body) throws NotImplementedException { + if (ContentTypeDetector.contentTypeIsJson(contentType)) { + return serializeJson(contentType, body); + } else if (ContentTypeDetector.contentTypeIsTextPlain(contentType)) { + return serializeTextPlain(contentType, body); + } + throw new NotImplementedException("Serialization has not yet been implemented for contentType="+contentType+". If you need it please file a PR"); + } + + public abstract SerializedRequestBody serialize(T requestBody) throws NotImplementedException; +} \ No newline at end of file diff --git a/src/main/resources/kotlin/src/main/kotlin/packagename/requestbody/SerializedRequestBody.hbs b/src/main/resources/kotlin/src/main/kotlin/packagename/requestbody/SerializedRequestBody.hbs new file mode 100644 index 00000000000..457f20ea459 --- /dev/null +++ b/src/main/resources/kotlin/src/main/kotlin/packagename/requestbody/SerializedRequestBody.hbs @@ -0,0 +1,13 @@ +package {{{packageName}}}.requestbody; + +import java.net.http.HttpRequest; + +public class SerializedRequestBody { + public final String contentType; + public final HttpRequest.BodyPublisher bodyPublisher; + + protected SerializedRequestBody(String contentType, HttpRequest.BodyPublisher bodyPublisher) { + this.contentType = contentType; + this.bodyPublisher = bodyPublisher; + } +} \ No newline at end of file diff --git a/src/main/resources/kotlin/src/main/kotlin/packagename/response/ApiResponse.hbs b/src/main/resources/kotlin/src/main/kotlin/packagename/response/ApiResponse.hbs new file mode 100644 index 00000000000..00caf937855 --- /dev/null +++ b/src/main/resources/kotlin/src/main/kotlin/packagename/response/ApiResponse.hbs @@ -0,0 +1,9 @@ +package {{{packageName}}}.response; + +import java.net.http.HttpResponse; + +public interface ApiResponse { + HttpResponse response(); + SealedBodyOutputClass body(); + HeaderOutputClass headers(); +} \ No newline at end of file diff --git a/src/main/resources/kotlin/src/main/kotlin/packagename/response/DeserializedHttpResponse.hbs b/src/main/resources/kotlin/src/main/kotlin/packagename/response/DeserializedHttpResponse.hbs new file mode 100644 index 00000000000..6c7d2077a45 --- /dev/null +++ b/src/main/resources/kotlin/src/main/kotlin/packagename/response/DeserializedHttpResponse.hbs @@ -0,0 +1,6 @@ +package {{{packageName}}}.response; + +import java.net.http.HttpResponse; + +public record DeserializedHttpResponse(SealedBodyOutputClass body, HeaderOutputClass headers) { +} \ No newline at end of file diff --git a/src/main/resources/kotlin/src/main/kotlin/packagename/response/HeadersDeserializer.hbs b/src/main/resources/kotlin/src/main/kotlin/packagename/response/HeadersDeserializer.hbs new file mode 100644 index 00000000000..d57437b0187 --- /dev/null +++ b/src/main/resources/kotlin/src/main/kotlin/packagename/response/HeadersDeserializer.hbs @@ -0,0 +1,37 @@ +package {{{packageName}}}.response; + +import org.checkerframework.checker.nullness.qual.Nullable; +import {{{packageName}}}.configurations.SchemaConfiguration; +import {{{packageName}}}.exceptions.ValidationException; +import {{{packageName}}}.exceptions.NotImplementedException; +import {{{packageName}}}.header.Header; +import {{{packageName}}}.schemas.validation.MapSchemaValidator; + +import java.net.http.HttpHeaders; +import java.util.HashMap; +import java.util.List; +import java.util.Map; + +public abstract class HeadersDeserializer { + private final Map headers; + final private MapSchemaValidator headersSchema; + public HeadersDeserializer(Map headers, MapSchemaValidator headersSchema) { + this.headers = headers; + this.headersSchema = headersSchema; + } + + public OutType deserialize(HttpHeaders responseHeaders, SchemaConfiguration configuration) throws ValidationException, NotImplementedException { + Map headersToValidate = new HashMap<>(); + for (Map.Entry> entry: responseHeaders.map().entrySet()) { + String headerName = entry.getKey(); + Header headerDeserializer = headers.get(headerName); + if (headerDeserializer == null) { + // todo put this data in headersToValidate, if only one item in list load it in, otherwise join them with commas + continue; + } + @Nullable Object headerValue = headerDeserializer.deserialize(entry.getValue(), false, configuration); + headersToValidate.put(headerName, headerValue); + } + return headersSchema.validate(headersToValidate, configuration); + } +} diff --git a/src/main/resources/kotlin/src/main/kotlin/packagename/response/ResponseDeserializer.hbs b/src/main/resources/kotlin/src/main/kotlin/packagename/response/ResponseDeserializer.hbs new file mode 100644 index 00000000000..05d319d1558 --- /dev/null +++ b/src/main/resources/kotlin/src/main/kotlin/packagename/response/ResponseDeserializer.hbs @@ -0,0 +1,74 @@ +package {{{packageName}}}.response; + +import java.net.http.HttpHeaders; +import java.net.http.HttpResponse; +import java.nio.charset.StandardCharsets; +import java.util.Map; +import java.util.Optional; + +import org.checkerframework.checker.nullness.qual.Nullable; + +import {{{packageName}}}.configurations.SchemaConfiguration; +import {{{packageName}}}.schemas.validation.JsonSchema; +import {{{packageName}}}.contenttype.ContentTypeDetector; +import {{{packageName}}}.contenttype.ContentTypeDeserializer; +import {{{packageName}}}.exceptions.NotImplementedException; +import {{{packageName}}}.exceptions.ValidationException; +import {{{packageName}}}.exceptions.ApiException; +import {{{packageName}}}.header.Header; + +public abstract class ResponseDeserializer { + public final Map content; + public final @Nullable Map headers; + + public ResponseDeserializer(Map content) { + this.content = content; + this.headers = null; + } + + protected abstract SealedBodyClass getBody(String contentType, SealedMediaTypeClass mediaType, byte[] body, SchemaConfiguration configuration) throws ValidationException, NotImplementedException; + protected abstract HeaderClass getHeaders(HttpHeaders headers, SchemaConfiguration configuration) throws ValidationException, NotImplementedException; + + protected @Nullable Object deserializeJson(byte[] body) { + String bodyStr = new String(body, StandardCharsets.UTF_8); + return ContentTypeDeserializer.fromJson(bodyStr); + } + + protected String deserializeTextPlain(byte[] body) { + return new String(body, StandardCharsets.UTF_8); + } + + protected T deserializeBody(String contentType, byte[] body, JsonSchema schema, SchemaConfiguration configuration) throws ValidationException, NotImplementedException { + if (ContentTypeDetector.contentTypeIsJson(contentType)) { + @Nullable Object bodyData = deserializeJson(body); + return schema.validateAndBox(bodyData, configuration); + } else if (ContentTypeDetector.contentTypeIsTextPlain(contentType)) { + String bodyData = deserializeTextPlain(body); + return schema.validateAndBox(bodyData, configuration); + } + throw new NotImplementedException("Deserialization for contentType="+contentType+" has not yet been implemented."); + } + + public DeserializedHttpResponse deserialize(HttpResponse response, SchemaConfiguration configuration) throws ValidationException, NotImplementedException, ApiException { + Optional contentTypeInfo = response.headers().firstValue("Content-Type"); + if (contentTypeInfo.isEmpty()) { + throw new ApiException( + "Invalid response returned, Content-Type header is missing and it must be included", + response + ); + } + String contentType = contentTypeInfo.get(); + @Nullable SealedMediaTypeClass mediaType = content.get(contentType); + if (mediaType == null) { + throw new ApiException( + "Invalid contentType returned. contentType="+contentType+" was returned "+ + "when only "+content.keySet()+" are defined for statusCode="+response.statusCode(), + response + ); + } + byte[] bodyBytes = response.body(); + SealedBodyClass body = getBody(contentType, mediaType, bodyBytes, configuration); + HeaderClass headers = getHeaders(response.headers(), configuration); + return new DeserializedHttpResponse<>(body, headers); + } +} \ No newline at end of file diff --git a/src/main/resources/kotlin/src/main/kotlin/packagename/response/ResponsesDeserializer.hbs b/src/main/resources/kotlin/src/main/kotlin/packagename/response/ResponsesDeserializer.hbs new file mode 100644 index 00000000000..618cf4bdd9a --- /dev/null +++ b/src/main/resources/kotlin/src/main/kotlin/packagename/response/ResponsesDeserializer.hbs @@ -0,0 +1,11 @@ +package {{{packageName}}}.response; + +import {{{packageName}}}.configurations.SchemaConfiguration; +import java.net.http.HttpResponse; +import {{{packageName}}}.exceptions.NotImplementedException; +import {{{packageName}}}.exceptions.ValidationException; +import {{{packageName}}}.exceptions.ApiException; + +public interface ResponsesDeserializer { + SealedResponseClass deserialize(HttpResponse response, SchemaConfiguration configuration) throws ValidationException, NotImplementedException, ApiException; +} \ No newline at end of file diff --git a/src/main/resources/kotlin/src/main/kotlin/packagename/restclient/RestClient.hbs b/src/main/resources/kotlin/src/main/kotlin/packagename/restclient/RestClient.hbs new file mode 100644 index 00000000000..810e700f2e4 --- /dev/null +++ b/src/main/resources/kotlin/src/main/kotlin/packagename/restclient/RestClient.hbs @@ -0,0 +1,67 @@ +package {{packageName}}.restclient; + +import org.checkerframework.checker.nullness.qual.Nullable; +import java.io.IOException; +import java.net.URI; +import java.net.http.HttpClient; +import java.net.http.HttpRequest; +import java.net.http.HttpResponse; +import java.time.Duration; +import java.util.List; +import java.util.Map; + +public class RestClient { + public static HttpRequest getRequest( + String serviceUrl, + String method, + HttpRequest.BodyPublisher bodyPublisher, + Map> headers, + @Nullable Duration timeout + ) { + HttpRequest.Builder request = HttpRequest.newBuilder(URI.create(serviceUrl)); + switch (method) { + case "get": + request.GET(); + break; + case "put": + request.method("PUT", bodyPublisher); + break; + case "patch": + request.method("PATCH", bodyPublisher); + break; + case "post": + request.method("POST", bodyPublisher); + break; + case "delete": + request.DELETE(); + break; + case "trace": + request.method("TRACE", bodyPublisher); + break; + case "options": + request.method("OPTIONS", bodyPublisher); + break; + case "head": + request.method("HEAD", bodyPublisher); + break; + case "connect": + request.method("CONNECT", bodyPublisher); + break; + default: + throw new RuntimeException("Invalid http method"); + } + for (Map.Entry> entry: headers.entrySet()) { + String headerName = entry.getKey(); + String headerValue = String.join(", ", entry.getValue()); + request.header(headerName, headerValue); + } + if (timeout != null) { + request.timeout(timeout); + } + return request.build(); + } + + public static HttpResponse getResponse(HttpRequest request, HttpClient client) throws IOException, InterruptedException { + return client.send(request, HttpResponse.BodyHandlers.ofByteArray()); + } +} diff --git a/src/main/resources/kotlin/src/main/kotlin/packagename/schemas/AnyTypeJsonSchema.hbs b/src/main/resources/kotlin/src/main/kotlin/packagename/schemas/AnyTypeJsonSchema.hbs new file mode 100644 index 00000000000..74c850ef7af --- /dev/null +++ b/src/main/resources/kotlin/src/main/kotlin/packagename/schemas/AnyTypeJsonSchema.hbs @@ -0,0 +1,315 @@ +package {{{packageName}}}.schemas; + +import {{{packageName}}}.configurations.JsonSchemaKeywordFlags; +import {{{packageName}}}.configurations.SchemaConfiguration; +import {{{packageName}}}.exceptions.ValidationException; +import {{{packageName}}}.schemas.validation.FrozenList; +import {{{packageName}}}.schemas.validation.FrozenMap; +import {{{packageName}}}.schemas.validation.JsonSchema; +import {{{packageName}}}.schemas.validation.JsonSchemaInfo; +import {{{packageName}}}.schemas.validation.PathToSchemasMap; +import {{{packageName}}}.schemas.validation.NullSchemaValidator; +import {{{packageName}}}.schemas.validation.BooleanSchemaValidator; +import {{{packageName}}}.schemas.validation.NumberSchemaValidator; +import {{{packageName}}}.schemas.validation.StringSchemaValidator; +import {{{packageName}}}.schemas.validation.ListSchemaValidator; +import {{{packageName}}}.schemas.validation.MapSchemaValidator; +import {{{packageName}}}.schemas.validation.ValidationMetadata; +import org.checkerframework.checker.nullness.qual.Nullable; + +import java.time.LocalDate; +import java.time.ZonedDateTime; +import java.util.LinkedHashMap; +import java.util.List; +import java.util.HashSet; +import java.util.ArrayList; +import java.util.LinkedHashSet; +import java.util.Set; +import java.util.Map; +import java.util.Objects; +import java.util.UUID; + +public class AnyTypeJsonSchema { + public sealed interface AnyTypeJsonSchema1Boxed permits AnyTypeJsonSchema1BoxedVoid, AnyTypeJsonSchema1BoxedBoolean, AnyTypeJsonSchema1BoxedNumber, AnyTypeJsonSchema1BoxedString, AnyTypeJsonSchema1BoxedList, AnyTypeJsonSchema1BoxedMap { + @Nullable Object getData(); + } + public record AnyTypeJsonSchema1BoxedVoid(Nothing? data) implements AnyTypeJsonSchema1Boxed { + @Override + public @Nullable Object getData() { + return data; + } + } + public record AnyTypeJsonSchema1BoxedBoolean(boolean data) implements AnyTypeJsonSchema1Boxed { + @Override + public @Nullable Object getData() { + return data; + } + } + public record AnyTypeJsonSchema1BoxedNumber(Number data) implements AnyTypeJsonSchema1Boxed { + @Override + public @Nullable Object getData() { + return data; + } + } + public record AnyTypeJsonSchema1BoxedString(String data) implements AnyTypeJsonSchema1Boxed { + @Override + public @Nullable Object getData() { + return data; + } + } + public record AnyTypeJsonSchema1BoxedList(FrozenList<@Nullable Object> data) implements AnyTypeJsonSchema1Boxed { + @Override + public @Nullable Object getData() { + return data; + } + } + public record AnyTypeJsonSchema1BoxedMap(FrozenMap<@Nullable Object> data) implements AnyTypeJsonSchema1Boxed { + @Override + public @Nullable Object getData() { + return data; + } + } + + public static class AnyTypeJsonSchema1 extends JsonSchema implements NullSchemaValidator, BooleanSchemaValidator, NumberSchemaValidator, StringSchemaValidator, ListSchemaValidator, AnyTypeJsonSchema1BoxedList>, MapSchemaValidator, AnyTypeJsonSchema1BoxedMap> { + private static @Nullable AnyTypeJsonSchema1 instance = null; + + protected AnyTypeJsonSchema1() { + super(new JsonSchemaInfo()); + } + + public static AnyTypeJsonSchema1 getInstance() { + if (instance == null) { + instance = new AnyTypeJsonSchema1(); + } + return instance; + } + + @Override + public Nothing? validate(Nothing? arg, SchemaConfiguration configuration) throws ValidationException { + Set> pathSet = new HashSet<>(); + List pathToItem = List.of("args[0]"); + Nothing? castArg = castToAllowedTypes(arg, pathToItem, pathSet); + SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().build())); + PathToSchemasMap validatedPathToSchemas = new PathToSchemasMap(); + ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, new LinkedHashSet<>()); + PathToSchemasMap pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet); + return getNewInstance(castArg, validationMetadata.pathToItem(), pathToSchemasMap); + } + + @Override + public boolean validate(boolean arg, SchemaConfiguration configuration) throws ValidationException { + Set> pathSet = new HashSet<>(); + List pathToItem = List.of("args[0]"); + boolean castArg = castToAllowedTypes(arg, pathToItem, pathSet); + SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().build())); + PathToSchemasMap validatedPathToSchemas = new PathToSchemasMap(); + ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, new LinkedHashSet<>()); + PathToSchemasMap pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet); + return getNewInstance(castArg, validationMetadata.pathToItem(), pathToSchemasMap); + } + + @Override + public Number validate(Number arg, SchemaConfiguration configuration) throws ValidationException { + Set> pathSet = new HashSet<>(); + List pathToItem = List.of("args[0]"); + Number castArg = castToAllowedTypes(arg, pathToItem, pathSet); + SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().build())); + PathToSchemasMap validatedPathToSchemas = new PathToSchemasMap(); + ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, new LinkedHashSet<>()); + PathToSchemasMap pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet); + return getNewInstance(castArg, validationMetadata.pathToItem(), pathToSchemasMap); + } + + public int validate(int arg, SchemaConfiguration configuration) throws ValidationException { + return (int) validate((Number) arg, configuration); + } + + public long validate(long arg, SchemaConfiguration configuration) throws ValidationException { + return (long) validate((Number) arg, configuration); + } + + public float validate(float arg, SchemaConfiguration configuration) throws ValidationException { + return (float) validate((Number) arg, configuration); + } + + public double validate(double arg, SchemaConfiguration configuration) throws ValidationException { + return (double) validate((Number) arg, configuration); + } + + @Override + public String validate(String arg, SchemaConfiguration configuration) throws ValidationException { + Set> pathSet = new HashSet<>(); + List pathToItem = List.of("args[0]"); + String castArg = castToAllowedTypes(arg, pathToItem, pathSet); + SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().build())); + PathToSchemasMap validatedPathToSchemas = new PathToSchemasMap(); + ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, new LinkedHashSet<>()); + PathToSchemasMap pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet); + return getNewInstance(castArg, validationMetadata.pathToItem(), pathToSchemasMap); + } + + public String validate(LocalDate arg, SchemaConfiguration configuration) throws ValidationException { + return validate(arg.toString(), configuration); + } + + public String validate(ZonedDateTime arg, SchemaConfiguration configuration) throws ValidationException { + return validate(arg.toString(), configuration); + } + + public String validate(UUID arg, SchemaConfiguration configuration) throws ValidationException { + return validate(arg.toString(), configuration); + } + + @Override + public FrozenList<@Nullable Object> getNewInstance(List arg, List pathToItem, PathToSchemasMap pathToSchemas) { + List<@Nullable Object> items = new ArrayList<>(); + int i = 0; + for (Object item: arg) { + List itemPathToItem = new ArrayList<>(pathToItem); + itemPathToItem.add(i); + LinkedHashMap, Nothing?> schemas = pathToSchemas.get(itemPathToItem); + if (schemas == null) { + 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); + items.add(castItem); + i += 1; + } + return new FrozenList<>(items); + } + + 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); + SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().build())); + PathToSchemasMap validatedPathToSchemas = new PathToSchemasMap(); + ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, new LinkedHashSet<>()); + PathToSchemasMap pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet); + return getNewInstance(castArg, validationMetadata.pathToItem(), pathToSchemasMap); + } + + @Override + 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 RuntimeException("Invalid non-string key value"); + } + String propertyName = (String) entryKey; + List propertyPathToItem = new ArrayList<>(pathToItem); + propertyPathToItem.add(propertyName); + Object value = entry.getValue(); + LinkedHashMap, Nothing?> schemas = pathToSchemas.get(propertyPathToItem); + if (schemas == null) { + 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); + properties.put(propertyName, castValue); + } + return new FrozenMap<>(properties); + } + + public FrozenMap<@Nullable Object> validate(Map arg, SchemaConfiguration configuration) throws ValidationException { + Set> pathSet = new HashSet<>(); + List pathToItem = List.of("args[0]"); + Map castArg = castToAllowedTypes(arg, pathToItem, pathSet); + SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().build())); + PathToSchemasMap validatedPathToSchemas = new PathToSchemasMap(); + ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, new LinkedHashSet<>()); + PathToSchemasMap pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet); + return getNewInstance(castArg, validationMetadata.pathToItem(), pathToSchemasMap); + } + + @Override + public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { + if (arg == null) { + return getNewInstance((Nothing?) null, pathToItem, pathToSchemas); + } else if (arg instanceof Boolean) { + boolean boolArg = (Boolean) arg; + return getNewInstance(boolArg, pathToItem, pathToSchemas); + } else if (arg instanceof Number) { + return getNewInstance((Number) arg, pathToItem, pathToSchemas); + } else if (arg instanceof String) { + return getNewInstance((String) arg, pathToItem, pathToSchemas); + } else if (arg instanceof List) { + return getNewInstance((List) arg, 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"); + } + + @Override + public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { + if (arg == null) { + return validate((Nothing?) null, configuration); + } else if (arg instanceof Boolean) { + boolean boolArg = (Boolean) arg; + return validate(boolArg, configuration); + } else if (arg instanceof Number) { + return validate((Number) arg, configuration); + } else if (arg instanceof String) { + return validate((String) arg, configuration); + } else if (arg instanceof List) { + return validate((List) arg, 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"); + } + + @Override + public AnyTypeJsonSchema1BoxedVoid validateAndBox(Nothing? arg, SchemaConfiguration configuration) throws ValidationException { + return new AnyTypeJsonSchema1BoxedVoid(validate(arg, configuration)); + } + + @Override + 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 { + return new AnyTypeJsonSchema1BoxedNumber(validate(arg, configuration)); + } + + @Override + 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 { + return new AnyTypeJsonSchema1BoxedList(validate(arg, configuration)); + } + + @Override + 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 { + if (arg == null) { + Nothing? castArg = (Nothing?) arg; + return validateAndBox(castArg, configuration); + } else if (arg instanceof Boolean booleanArg) { + boolean castArg = booleanArg; + return validateAndBox(castArg, configuration); + } else if (arg instanceof String castArg) { + return validateAndBox(castArg, configuration); + } else if (arg instanceof Number castArg) { + return validateAndBox(castArg, configuration); + } else if (arg instanceof List castArg) { + 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"); + } + } +} \ No newline at end of file diff --git a/src/main/resources/kotlin/src/main/kotlin/packagename/schemas/BooleanJsonSchema.hbs b/src/main/resources/kotlin/src/main/kotlin/packagename/schemas/BooleanJsonSchema.hbs new file mode 100644 index 00000000000..03aa21b39c6 --- /dev/null +++ b/src/main/resources/kotlin/src/main/kotlin/packagename/schemas/BooleanJsonSchema.hbs @@ -0,0 +1,88 @@ +package {{{packageName}}}.schemas; + +import {{{packageName}}}.configurations.JsonSchemaKeywordFlags; +import {{{packageName}}}.configurations.SchemaConfiguration; +import {{{packageName}}}.exceptions.ValidationException; +import {{{packageName}}}.schemas.validation.JsonSchema; +import {{{packageName}}}.schemas.validation.JsonSchemaInfo; +import {{{packageName}}}.schemas.validation.PathToSchemasMap; +import {{{packageName}}}.schemas.validation.BooleanSchemaValidator; +import {{{packageName}}}.schemas.validation.ValidationMetadata; +import org.checkerframework.checker.nullness.qual.Nullable; + +import java.util.HashSet; +import java.util.LinkedHashSet; +import java.util.List; +import java.util.Objects; +import java.util.Set; + +public class BooleanJsonSchema { + public sealed interface BooleanJsonSchema1Boxed permits BooleanJsonSchema1BoxedBoolean { + @Nullable Object getData(); + } + public record BooleanJsonSchema1BoxedBoolean(boolean data) implements BooleanJsonSchema1Boxed { + @Override + public @Nullable Object getData() { + return data; + } + } + public static class BooleanJsonSchema1 extends JsonSchema implements BooleanSchemaValidator { + private static @Nullable BooleanJsonSchema1 instance = null; + + protected BooleanJsonSchema1() { + super(new JsonSchemaInfo() + .type(Set.of(Boolean.class)) + ); + } + + public static BooleanJsonSchema1 getInstance() { + if (instance == null) { + instance = new BooleanJsonSchema1(); + } + return instance; + } + + @Override + public boolean validate(boolean arg, SchemaConfiguration configuration) throws ValidationException { + Set> pathSet = new HashSet<>(); + List pathToItem = List.of("args[0"); + boolean castArg = castToAllowedTypes(arg, pathToItem, pathSet); + SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().build())); + ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, new PathToSchemasMap(), new LinkedHashSet<>()); + PathToSchemasMap pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet); + return getNewInstance(castArg, validationMetadata.pathToItem(), pathToSchemasMap); + } + + @Override + 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 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 { + 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"); + } + + @Override + 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 { + 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"); + } + } +} \ No newline at end of file diff --git a/src/main/resources/kotlin/src/main/kotlin/packagename/schemas/DateJsonSchema.hbs b/src/main/resources/kotlin/src/main/kotlin/packagename/schemas/DateJsonSchema.hbs new file mode 100644 index 00000000000..da5e22633bf --- /dev/null +++ b/src/main/resources/kotlin/src/main/kotlin/packagename/schemas/DateJsonSchema.hbs @@ -0,0 +1,94 @@ +package {{{packageName}}}.schemas; + +import {{{packageName}}}.configurations.JsonSchemaKeywordFlags; +import {{{packageName}}}.configurations.SchemaConfiguration; +import {{{packageName}}}.exceptions.ValidationException; +import {{{packageName}}}.schemas.validation.JsonSchema; +import {{{packageName}}}.schemas.validation.JsonSchemaInfo; +import {{{packageName}}}.schemas.validation.PathToSchemasMap; +import {{{packageName}}}.schemas.validation.StringSchemaValidator; +import {{{packageName}}}.schemas.validation.ValidationMetadata; +import org.checkerframework.checker.nullness.qual.Nullable; + +import java.time.LocalDate; +import java.util.HashSet; +import java.util.LinkedHashSet; +import java.util.List; +import java.util.Objects; +import java.util.Set; + +public class DateJsonSchema { + public sealed interface DateJsonSchema1Boxed permits DateJsonSchema1BoxedString { + @Nullable Object getData(); + } + public record DateJsonSchema1BoxedString(String data) implements DateJsonSchema1Boxed { + @Override + public @Nullable Object getData() { + return data; + } + } + + public static class DateJsonSchema1 extends JsonSchema implements StringSchemaValidator { + private static @Nullable DateJsonSchema1 instance = null; + + protected DateJsonSchema1() { + super(new JsonSchemaInfo() + .type(Set.of(String.class)) + .format("date") + ); + } + + public static DateJsonSchema1 getInstance() { + if (instance == null) { + instance = new DateJsonSchema1(); + } + return instance; + } + + @Override + public String validate(String arg, SchemaConfiguration configuration) throws ValidationException { + Set> pathSet = new HashSet<>(); + List pathToItem = List.of("args[0"); + String castArg = castToAllowedTypes(arg, pathToItem, pathSet); + SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().build())); + ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, new PathToSchemasMap(), new LinkedHashSet<>()); + PathToSchemasMap pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet); + return getNewInstance(castArg, validationMetadata.pathToItem(), pathToSchemasMap); + } + + public String validate(LocalDate arg, SchemaConfiguration configuration) throws ValidationException { + return validate(arg.toString(), configuration); + } + + @Override + public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { + 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"); + } + + @Override + 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 ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + } + + @Override + 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 { + 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"); + } + } +} \ No newline at end of file diff --git a/src/main/resources/kotlin/src/main/kotlin/packagename/schemas/DateTimeJsonSchema.hbs b/src/main/resources/kotlin/src/main/kotlin/packagename/schemas/DateTimeJsonSchema.hbs new file mode 100644 index 00000000000..71684407104 --- /dev/null +++ b/src/main/resources/kotlin/src/main/kotlin/packagename/schemas/DateTimeJsonSchema.hbs @@ -0,0 +1,94 @@ +package {{{packageName}}}.schemas; + +import {{{packageName}}}.configurations.JsonSchemaKeywordFlags; +import {{{packageName}}}.configurations.SchemaConfiguration; +import {{{packageName}}}.exceptions.ValidationException; +import {{{packageName}}}.schemas.validation.JsonSchema; +import {{{packageName}}}.schemas.validation.JsonSchemaInfo; +import {{{packageName}}}.schemas.validation.PathToSchemasMap; +import {{{packageName}}}.schemas.validation.StringSchemaValidator; +import {{{packageName}}}.schemas.validation.ValidationMetadata; +import org.checkerframework.checker.nullness.qual.Nullable; + +import java.time.ZonedDateTime; +import java.util.HashSet; +import java.util.LinkedHashSet; +import java.util.List; +import java.util.Objects; +import java.util.Set; + +public class DateTimeJsonSchema { + public sealed interface DateTimeJsonSchema1Boxed permits DateTimeJsonSchema1BoxedString { + @Nullable Object getData(); + } + public record DateTimeJsonSchema1BoxedString(String data) implements DateTimeJsonSchema1Boxed { + @Override + public @Nullable Object getData() { + return data; + } + } + + public static class DateTimeJsonSchema1 extends JsonSchema implements StringSchemaValidator { + private static @Nullable DateTimeJsonSchema1 instance = null; + + protected DateTimeJsonSchema1() { + super(new JsonSchemaInfo() + .type(Set.of(String.class)) + .format("date-time") + ); + } + + public static DateTimeJsonSchema1 getInstance() { + if (instance == null) { + instance = new DateTimeJsonSchema1(); + } + return instance; + } + + @Override + public String validate(String arg, SchemaConfiguration configuration) throws ValidationException { + Set> pathSet = new HashSet<>(); + List pathToItem = List.of("args[0"); + String castArg = castToAllowedTypes(arg, pathToItem, pathSet); + SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().build())); + ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, new PathToSchemasMap(), new LinkedHashSet<>()); + PathToSchemasMap pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet); + return getNewInstance(castArg, validationMetadata.pathToItem(), pathToSchemasMap); + } + + public String validate(ZonedDateTime arg, SchemaConfiguration configuration) throws ValidationException { + return validate(arg.toString(), configuration); + } + + @Override + public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { + 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"); + } + + @Override + 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 ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + } + + @Override + 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 { + 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"); + } + } +} \ No newline at end of file diff --git a/src/main/resources/kotlin/src/main/kotlin/packagename/schemas/DecimalJsonSchema.hbs b/src/main/resources/kotlin/src/main/kotlin/packagename/schemas/DecimalJsonSchema.hbs new file mode 100644 index 00000000000..c6628ee64c5 --- /dev/null +++ b/src/main/resources/kotlin/src/main/kotlin/packagename/schemas/DecimalJsonSchema.hbs @@ -0,0 +1,87 @@ +package {{{packageName}}}.schemas; + +import {{{packageName}}}.configurations.JsonSchemaKeywordFlags; +import {{{packageName}}}.configurations.SchemaConfiguration; +import {{{packageName}}}.exceptions.ValidationException; +import {{{packageName}}}.schemas.validation.JsonSchema; +import {{{packageName}}}.schemas.validation.JsonSchemaInfo; +import {{{packageName}}}.schemas.validation.PathToSchemasMap; +import {{{packageName}}}.schemas.validation.StringSchemaValidator; +import {{{packageName}}}.schemas.validation.ValidationMetadata; +import org.checkerframework.checker.nullness.qual.Nullable; + +import java.util.HashSet; +import java.util.LinkedHashSet; +import java.util.List; +import java.util.Objects; +import java.util.Set; + +public class DecimalJsonSchema { + public sealed interface DecimalJsonSchema1Boxed permits DecimalJsonSchema1BoxedString { + @Nullable Object getData(); + } + public record DecimalJsonSchema1BoxedString(String data) implements DecimalJsonSchema1Boxed { + @Override + public @Nullable Object getData() { + return data; + } + } + + public static class DecimalJsonSchema1 extends JsonSchema implements StringSchemaValidator { + private static @Nullable DecimalJsonSchema1 instance = null; + + protected DecimalJsonSchema1() { + super(new JsonSchemaInfo() + .type(Set.of(String.class)) + .format("number") + ); + } + + public static DecimalJsonSchema1 getInstance() { + if (instance == null) { + instance = new DecimalJsonSchema1(); + } + return instance; + } + + @Override + public String validate(String arg, SchemaConfiguration configuration) throws ValidationException { + Set> pathSet = new HashSet<>(); + List pathToItem = List.of("args[0"); + String castArg = castToAllowedTypes(arg, pathToItem, pathSet); + SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().build())); + ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, new PathToSchemasMap(), new LinkedHashSet<>()); + PathToSchemasMap pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet); + return getNewInstance(castArg, validationMetadata.pathToItem(), pathToSchemasMap); + } + + @Override + public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { + 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"); + } + + @Override + public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws 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"); + } + + @Override + 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 { + 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"); + } + } +} \ No newline at end of file diff --git a/src/main/resources/kotlin/src/main/kotlin/packagename/schemas/DoubleJsonSchema.hbs b/src/main/resources/kotlin/src/main/kotlin/packagename/schemas/DoubleJsonSchema.hbs new file mode 100644 index 00000000000..bc9a5f71a19 --- /dev/null +++ b/src/main/resources/kotlin/src/main/kotlin/packagename/schemas/DoubleJsonSchema.hbs @@ -0,0 +1,100 @@ +package {{{packageName}}}.schemas; + +import {{{packageName}}}.configurations.JsonSchemaKeywordFlags; +import {{{packageName}}}.configurations.SchemaConfiguration; +import {{{packageName}}}.exceptions.ValidationException; +import {{{packageName}}}.schemas.validation.JsonSchema; +import {{{packageName}}}.schemas.validation.JsonSchemaInfo; +import {{{packageName}}}.schemas.validation.PathToSchemasMap; +import {{{packageName}}}.schemas.validation.NumberSchemaValidator; +import {{{packageName}}}.schemas.validation.ValidationMetadata; +import org.checkerframework.checker.nullness.qual.Nullable; + +import java.util.HashSet; +import java.util.LinkedHashSet; +import java.util.List; +import java.util.Objects; +import java.util.Set; + +public class DoubleJsonSchema { + public sealed interface DoubleJsonSchema1Boxed permits DoubleJsonSchema1BoxedNumber { + @Nullable Object getData(); + } + public record DoubleJsonSchema1BoxedNumber(Number data) implements DoubleJsonSchema1Boxed { + @Override + public @Nullable Object getData() { + return data; + } + } + + public static class DoubleJsonSchema1 extends JsonSchema implements NumberSchemaValidator { + private static @Nullable DoubleJsonSchema1 instance = null; + + protected DoubleJsonSchema1() { + super(new JsonSchemaInfo() + {{#if generatorSettings.intsAllowedForFloatDoubleFormats}} + .type(Set.of( + Integer.class, + Long.class, + Float.class, + Double.class + )) + {{else}} + .type(Set.of(Double.class)) + {{/if}} + .format("double") + ); + } + + public static DoubleJsonSchema1 getInstance() { + if (instance == null) { + instance = new DoubleJsonSchema1(); + } + return instance; + } + + @Override + public Number validate(Number arg, SchemaConfiguration configuration) throws ValidationException { + Set> pathSet = new HashSet<>(); + List pathToItem = List.of("args[0"); + Number castArg = castToAllowedTypes(arg, pathToItem, pathSet); + SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().build())); + ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, new PathToSchemasMap(), new LinkedHashSet<>()); + PathToSchemasMap pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet); + return getNewInstance(castArg, validationMetadata.pathToItem(), pathToSchemasMap); + } + + public double validate(double arg, SchemaConfiguration configuration) throws ValidationException { + return (double) validate((Number) arg, configuration); + } + + @Override + public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { + 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"); + } + + @Override + public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws 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"); + } + + @Override + 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 { + 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"); + } + } +} \ No newline at end of file diff --git a/src/main/resources/kotlin/src/main/kotlin/packagename/schemas/FloatJsonSchema.hbs b/src/main/resources/kotlin/src/main/kotlin/packagename/schemas/FloatJsonSchema.hbs new file mode 100644 index 00000000000..40c08d7866d --- /dev/null +++ b/src/main/resources/kotlin/src/main/kotlin/packagename/schemas/FloatJsonSchema.hbs @@ -0,0 +1,98 @@ +package {{{packageName}}}.schemas; + +import {{{packageName}}}.configurations.JsonSchemaKeywordFlags; +import {{{packageName}}}.configurations.SchemaConfiguration; +import {{{packageName}}}.exceptions.ValidationException; +import {{{packageName}}}.schemas.validation.JsonSchema; +import {{{packageName}}}.schemas.validation.JsonSchemaInfo; +import {{{packageName}}}.schemas.validation.PathToSchemasMap; +import {{{packageName}}}.schemas.validation.NumberSchemaValidator; +import {{{packageName}}}.schemas.validation.ValidationMetadata; +import org.checkerframework.checker.nullness.qual.Nullable; + +import java.util.HashSet; +import java.util.LinkedHashSet; +import java.util.List; +import java.util.Objects; +import java.util.Set; + +public class FloatJsonSchema { + public sealed interface FloatJsonSchema1Boxed permits FloatJsonSchema1BoxedNumber { + @Nullable Object getData(); + } + public record FloatJsonSchema1BoxedNumber(Number data) implements FloatJsonSchema1Boxed { + @Override + public @Nullable Object getData() { + return data; + } + } + + public static class FloatJsonSchema1 extends JsonSchema implements NumberSchemaValidator { + private static @Nullable FloatJsonSchema1 instance = null; + + protected FloatJsonSchema1() { + super(new JsonSchemaInfo() + {{#if generatorSettings.intsAllowedForFloatDoubleFormats}} + .type(Set.of( + Integer.class, + Float.class + )) + {{else}} + .type(Set.of(Float.class)) + {{/if}} + .format("float") + ); + } + + public static FloatJsonSchema1 getInstance() { + if (instance == null) { + instance = new FloatJsonSchema1(); + } + return instance; + } + + @Override + public Number validate(Number arg, SchemaConfiguration configuration) throws ValidationException { + Set> pathSet = new HashSet<>(); + List pathToItem = List.of("args[0"); + Number castArg = castToAllowedTypes(arg, pathToItem, pathSet); + SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().build())); + ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, new PathToSchemasMap(), new LinkedHashSet<>()); + PathToSchemasMap pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet); + return getNewInstance(castArg, validationMetadata.pathToItem(), pathToSchemasMap); + } + + public float validate(float arg, SchemaConfiguration configuration) throws ValidationException { + return (float) validate((Number) arg, configuration); + } + + @Override + public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { + 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"); + } + + @Override + public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws 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"); + } + + @Override + 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 { + 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"); + } + } +} diff --git a/src/main/resources/kotlin/src/main/kotlin/packagename/schemas/GenericBuilder.hbs b/src/main/resources/kotlin/src/main/kotlin/packagename/schemas/GenericBuilder.hbs new file mode 100644 index 00000000000..c456cd38958 --- /dev/null +++ b/src/main/resources/kotlin/src/main/kotlin/packagename/schemas/GenericBuilder.hbs @@ -0,0 +1,9 @@ +package {{{packageName}}}.schemas; + +/** + * Builders must implement this class + * @param the type that the builder returns + */ +public interface GenericBuilder { + T build(); +} diff --git a/src/main/resources/kotlin/src/main/kotlin/packagename/schemas/Int32JsonSchema.hbs b/src/main/resources/kotlin/src/main/kotlin/packagename/schemas/Int32JsonSchema.hbs new file mode 100644 index 00000000000..8e5990d2b9a --- /dev/null +++ b/src/main/resources/kotlin/src/main/kotlin/packagename/schemas/Int32JsonSchema.hbs @@ -0,0 +1,98 @@ +package {{{packageName}}}.schemas; + +import {{{packageName}}}.configurations.JsonSchemaKeywordFlags; +import {{{packageName}}}.exceptions.ValidationException; +import {{{packageName}}}.schemas.validation.JsonSchema; +import {{{packageName}}}.schemas.validation.JsonSchemaInfo; +import {{{packageName}}}.configurations.SchemaConfiguration; +import {{{packageName}}}.schemas.validation.PathToSchemasMap; +import {{{packageName}}}.schemas.validation.NumberSchemaValidator; +import {{{packageName}}}.schemas.validation.ValidationMetadata; +import org.checkerframework.checker.nullness.qual.Nullable; + +import java.util.HashSet; +import java.util.LinkedHashSet; +import java.util.List; +import java.util.Objects; +import java.util.Set; + +public class Int32JsonSchema { + public sealed interface Int32JsonSchema1Boxed permits Int32JsonSchema1BoxedNumber { + @Nullable Object getData(); + } + public record Int32JsonSchema1BoxedNumber(Number data) implements Int32JsonSchema1Boxed { + @Override + public @Nullable Object getData() { + return data; + } + } + + public static class Int32JsonSchema1 extends JsonSchema implements NumberSchemaValidator { + private static @Nullable Int32JsonSchema1 instance = null; + + protected Int32JsonSchema1() { + super(new JsonSchemaInfo() + .type(Set.of( + Integer.class, + Float.class + )) + .format("int32") + ); + } + + public static Int32JsonSchema1 getInstance() { + if (instance == null) { + instance = new Int32JsonSchema1(); + } + return instance; + } + + @Override + public Number validate(Number arg, SchemaConfiguration configuration) throws ValidationException { + Set> pathSet = new HashSet<>(); + List pathToItem = List.of("args[0"); + Number castArg = castToAllowedTypes(arg, pathToItem, pathSet); + SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().build())); + ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, new PathToSchemasMap(), new LinkedHashSet<>()); + PathToSchemasMap pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet); + return getNewInstance(castArg, validationMetadata.pathToItem(), pathToSchemasMap); + } + + public int validate(int arg, SchemaConfiguration configuration) throws ValidationException { + return (int) validate((Number) arg, configuration); + } + + public float validate(float arg, SchemaConfiguration configuration) throws ValidationException { + return (float) validate((Number) arg, configuration); + } + + @Override + public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { + 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"); + } + + @Override + public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws 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"); + } + + @Override + 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 { + 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"); + } + } +} \ No newline at end of file diff --git a/src/main/resources/kotlin/src/main/kotlin/packagename/schemas/Int64JsonSchema.hbs b/src/main/resources/kotlin/src/main/kotlin/packagename/schemas/Int64JsonSchema.hbs new file mode 100644 index 00000000000..4ef6aa5f5a7 --- /dev/null +++ b/src/main/resources/kotlin/src/main/kotlin/packagename/schemas/Int64JsonSchema.hbs @@ -0,0 +1,108 @@ +package {{{packageName}}}.schemas; + +import {{{packageName}}}.configurations.JsonSchemaKeywordFlags; +import {{{packageName}}}.exceptions.ValidationException; +import {{{packageName}}}.schemas.validation.JsonSchema; +import {{{packageName}}}.schemas.validation.JsonSchemaInfo; +import {{{packageName}}}.configurations.SchemaConfiguration; +import {{{packageName}}}.schemas.validation.PathToSchemasMap; +import {{{packageName}}}.schemas.validation.NumberSchemaValidator; +import {{{packageName}}}.schemas.validation.ValidationMetadata; +import org.checkerframework.checker.nullness.qual.Nullable; + +import java.util.HashSet; +import java.util.LinkedHashSet; +import java.util.List; +import java.util.Objects; +import java.util.Set; + +public class Int64JsonSchema { + public sealed interface Int64JsonSchema1Boxed permits Int64JsonSchema1BoxedNumber { + @Nullable Object getData(); + } + public record Int64JsonSchema1BoxedNumber(Number data) implements Int64JsonSchema1Boxed { + @Override + public @Nullable Object getData() { + return data; + } + } + + public static class Int64JsonSchema1 extends JsonSchema implements NumberSchemaValidator { + private static @Nullable Int64JsonSchema1 instance = null; + + protected Int64JsonSchema1() { + super(new JsonSchemaInfo() + .type(Set.of( + Integer.class, + Long.class, + Float.class, + Double.class + )) + .format("int64") + ); + } + + public static Int64JsonSchema1 getInstance() { + if (instance == null) { + instance = new Int64JsonSchema1(); + } + return instance; + } + + @Override + public Number validate(Number arg, SchemaConfiguration configuration) throws ValidationException { + Set> pathSet = new HashSet<>(); + List pathToItem = List.of("args[0"); + Number castArg = castToAllowedTypes(arg, pathToItem, pathSet); + SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().build())); + ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, new PathToSchemasMap(), new LinkedHashSet<>()); + PathToSchemasMap pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet); + return getNewInstance(castArg, validationMetadata.pathToItem(), pathToSchemasMap); + } + + public int validate(int arg, SchemaConfiguration configuration) throws ValidationException { + return (int) validate((Number) arg, configuration); + } + + public long validate(long arg, SchemaConfiguration configuration) throws ValidationException { + return (long) validate((Number) arg, configuration); + } + + public float validate(float arg, SchemaConfiguration configuration) throws ValidationException { + return (float) validate((Number) arg, configuration); + } + + public double validate(double arg, SchemaConfiguration configuration) throws ValidationException { + return (double) validate((Number) arg, configuration); + } + + @Override + public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { + 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"); + } + + @Override + public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws 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"); + } + + @Override + 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 { + 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"); + } + } +} \ No newline at end of file diff --git a/src/main/resources/kotlin/src/main/kotlin/packagename/schemas/IntJsonSchema.hbs b/src/main/resources/kotlin/src/main/kotlin/packagename/schemas/IntJsonSchema.hbs new file mode 100644 index 00000000000..d4d8980f787 --- /dev/null +++ b/src/main/resources/kotlin/src/main/kotlin/packagename/schemas/IntJsonSchema.hbs @@ -0,0 +1,108 @@ +package {{{packageName}}}.schemas; + +import {{{packageName}}}.configurations.JsonSchemaKeywordFlags; +import {{{packageName}}}.exceptions.ValidationException; +import {{{packageName}}}.schemas.validation.JsonSchema; +import {{{packageName}}}.schemas.validation.JsonSchemaInfo; +import {{{packageName}}}.configurations.SchemaConfiguration; +import {{{packageName}}}.schemas.validation.PathToSchemasMap; +import {{{packageName}}}.schemas.validation.NumberSchemaValidator; +import {{{packageName}}}.schemas.validation.ValidationMetadata; +import org.checkerframework.checker.nullness.qual.Nullable; + +import java.util.HashSet; +import java.util.LinkedHashSet; +import java.util.List; +import java.util.Objects; +import java.util.Set; + +public class IntJsonSchema { + public sealed interface IntJsonSchema1Boxed permits IntJsonSchema1BoxedNumber { + @Nullable Object getData(); + } + public record IntJsonSchema1BoxedNumber(Number data) implements IntJsonSchema1Boxed { + @Override + public @Nullable Object getData() { + return data; + } + } + + public static class IntJsonSchema1 extends JsonSchema implements NumberSchemaValidator { + private static @Nullable IntJsonSchema1 instance = null; + + protected IntJsonSchema1() { + super(new JsonSchemaInfo() + .type(Set.of( + Integer.class, + Long.class, + Float.class, + Double.class + )) + .format("int") + ); + } + + public static IntJsonSchema1 getInstance() { + if (instance == null) { + instance = new IntJsonSchema1(); + } + return instance; + } + + @Override + public Number validate(Number arg, SchemaConfiguration configuration) throws ValidationException { + Set> pathSet = new HashSet<>(); + List pathToItem = List.of("args[0"); + Number castArg = castToAllowedTypes(arg, pathToItem, pathSet); + SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().build())); + ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, new PathToSchemasMap(), new LinkedHashSet<>()); + PathToSchemasMap pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet); + return getNewInstance(castArg, validationMetadata.pathToItem(), pathToSchemasMap); + } + + public int validate(int arg, SchemaConfiguration configuration) throws ValidationException { + return (int) validate((Number) arg, configuration); + } + + public long validate(long arg, SchemaConfiguration configuration) throws ValidationException { + return (long) validate((Number) arg, configuration); + } + + public float validate(float arg, SchemaConfiguration configuration) throws ValidationException { + return (float) validate((Number) arg, configuration); + } + + public double validate(double arg, SchemaConfiguration configuration) throws ValidationException { + return (double) validate((Number) arg, configuration); + } + + @Override + public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { + 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"); + } + + @Override + public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws 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"); + } + + @Override + 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 { + 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"); + } + } +} \ No newline at end of file diff --git a/src/main/resources/kotlin/src/main/kotlin/packagename/schemas/ListJsonSchema.hbs b/src/main/resources/kotlin/src/main/kotlin/packagename/schemas/ListJsonSchema.hbs new file mode 100644 index 00000000000..57abd9e0e89 --- /dev/null +++ b/src/main/resources/kotlin/src/main/kotlin/packagename/schemas/ListJsonSchema.hbs @@ -0,0 +1,108 @@ +package {{{packageName}}}.schemas; + +import {{{packageName}}}.configurations.JsonSchemaKeywordFlags; +import {{{packageName}}}.exceptions.ValidationException; +import {{{packageName}}}.schemas.validation.FrozenList; +import {{{packageName}}}.schemas.validation.JsonSchema; +import {{{packageName}}}.schemas.validation.JsonSchemaInfo; +import {{{packageName}}}.configurations.SchemaConfiguration; +import {{{packageName}}}.schemas.validation.PathToSchemasMap; +import {{{packageName}}}.schemas.validation.ListSchemaValidator; +import {{{packageName}}}.schemas.validation.ValidationMetadata; +import org.checkerframework.checker.nullness.qual.Nullable; + +import java.util.ArrayList; +import java.util.HashSet; +import java.util.LinkedHashMap; +import java.util.LinkedHashSet; +import java.util.List; +import java.util.Objects; +import java.util.Set; + +public class ListJsonSchema { + public sealed interface ListJsonSchema1Boxed permits ListJsonSchema1BoxedList { + @Nullable Object getData(); + } + public record ListJsonSchema1BoxedList(FrozenList<@Nullable Object> data) implements ListJsonSchema1Boxed { + @Override + public @Nullable Object getData() { + return data; + } + } + + public static class ListJsonSchema1 extends JsonSchema implements ListSchemaValidator, ListJsonSchema1BoxedList> { + private static @Nullable ListJsonSchema1 instance = null; + + protected ListJsonSchema1() { + super(new JsonSchemaInfo() + .type(Set.of(List.class)) + ); + } + + public static ListJsonSchema1 getInstance() { + if (instance == null) { + instance = new ListJsonSchema1(); + } + return instance; + } + + @Override + public FrozenList<@Nullable Object> getNewInstance(List arg, List pathToItem, PathToSchemasMap pathToSchemas) { + List<@Nullable Object> items = new ArrayList<>(); + int i = 0; + for (Object item: arg) { + List itemPathToItem = new ArrayList<>(pathToItem); + itemPathToItem.add(i); + LinkedHashMap, Nothing?> schemas = pathToSchemas.get(itemPathToItem); + if (schemas == null) { + 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); + items.add(castItem); + i += 1; + } + return new FrozenList<>(items); + } + + 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); + SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().build())); + PathToSchemasMap validatedPathToSchemas = new PathToSchemasMap(); + ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, new LinkedHashSet<>()); + PathToSchemasMap pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet); + return getNewInstance(castArg, validationMetadata.pathToItem(), pathToSchemasMap); + } + + @Override + public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { + 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"); + } + + @Override + public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws 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"); + } + + @Override + 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 { + 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"); + } + } +} diff --git a/src/main/resources/kotlin/src/main/kotlin/packagename/schemas/MapJsonSchema.hbs b/src/main/resources/kotlin/src/main/kotlin/packagename/schemas/MapJsonSchema.hbs new file mode 100644 index 00000000000..0a86355e4ac --- /dev/null +++ b/src/main/resources/kotlin/src/main/kotlin/packagename/schemas/MapJsonSchema.hbs @@ -0,0 +1,112 @@ +package {{{packageName}}}.schemas; + +import {{{packageName}}}.configurations.JsonSchemaKeywordFlags; +import {{{packageName}}}.exceptions.ValidationException; +import {{{packageName}}}.schemas.validation.FrozenMap; +import {{{packageName}}}.schemas.validation.JsonSchema; +import {{{packageName}}}.schemas.validation.JsonSchemaInfo; +import {{{packageName}}}.configurations.SchemaConfiguration; +import {{{packageName}}}.schemas.validation.PathToSchemasMap; +import {{{packageName}}}.schemas.validation.MapSchemaValidator; +import {{{packageName}}}.schemas.validation.ValidationMetadata; +import org.checkerframework.checker.nullness.qual.Nullable; + +import java.util.ArrayList; +import java.util.HashSet; +import java.util.LinkedHashMap; +import java.util.LinkedHashSet; +import java.util.List; +import java.util.Map; +import java.util.Objects; +import java.util.Set; + +public class MapJsonSchema { + public sealed interface MapJsonSchema1Boxed permits MapJsonSchema1BoxedMap { + @Nullable Object getData(); + } + public record MapJsonSchema1BoxedMap(FrozenMap<@Nullable Object> data) implements MapJsonSchema1Boxed { + @Override + public @Nullable Object getData() { + return data; + } + } + + public static class MapJsonSchema1 extends JsonSchema implements MapSchemaValidator, MapJsonSchema1BoxedMap> { + private static @Nullable MapJsonSchema1 instance = null; + + protected MapJsonSchema1() { + super(new JsonSchemaInfo() + .type(Set.of(Map.class)) + ); + } + + public static MapJsonSchema1 getInstance() { + if (instance == null) { + instance = new MapJsonSchema1(); + } + return instance; + } + + @Override + 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 RuntimeException("Invalid non-string key value"); + } + String propertyName = (String) entryKey; + List propertyPathToItem = new ArrayList<>(pathToItem); + propertyPathToItem.add(propertyName); + Object value = entry.getValue(); + LinkedHashMap, Nothing?> schemas = pathToSchemas.get(propertyPathToItem); + if (schemas == null) { + 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); + properties.put(propertyName, castValue); + } + return new FrozenMap<>(properties); + } + + public FrozenMap<@Nullable Object> validate(Map arg, SchemaConfiguration configuration) throws ValidationException { + Set> pathSet = new HashSet<>(); + List pathToItem = List.of("args[0"); + Map castArg = castToAllowedTypes(arg, pathToItem, pathSet); + SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().build())); + ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, new PathToSchemasMap(), new LinkedHashSet<>()); + PathToSchemasMap pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet); + return getNewInstance(castArg, validationMetadata.pathToItem(), pathToSchemasMap); + } + + @Override + public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { + 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"); + } + + @Override + public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws 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"); + } + + @Override + 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 { + 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"); + } + } +} diff --git a/src/main/resources/kotlin/src/main/kotlin/packagename/schemas/NotAnyTypeJsonSchema.hbs b/src/main/resources/kotlin/src/main/kotlin/packagename/schemas/NotAnyTypeJsonSchema.hbs new file mode 100644 index 00000000000..07f10999fef --- /dev/null +++ b/src/main/resources/kotlin/src/main/kotlin/packagename/schemas/NotAnyTypeJsonSchema.hbs @@ -0,0 +1,317 @@ +package {{{packageName}}}.schemas; + +import {{{packageName}}}.configurations.JsonSchemaKeywordFlags; +import {{{packageName}}}.configurations.SchemaConfiguration; +import {{{packageName}}}.exceptions.ValidationException; +import {{{packageName}}}.schemas.validation.FrozenList; +import {{{packageName}}}.schemas.validation.FrozenMap; +import {{{packageName}}}.schemas.validation.JsonSchema; +import {{{packageName}}}.schemas.validation.JsonSchemaInfo; +import {{{packageName}}}.schemas.validation.PathToSchemasMap; +import {{{packageName}}}.schemas.validation.NullSchemaValidator; +import {{{packageName}}}.schemas.validation.BooleanSchemaValidator; +import {{{packageName}}}.schemas.validation.NumberSchemaValidator; +import {{{packageName}}}.schemas.validation.StringSchemaValidator; +import {{{packageName}}}.schemas.validation.ListSchemaValidator; +import {{{packageName}}}.schemas.validation.MapSchemaValidator; +import {{{packageName}}}.schemas.validation.ValidationMetadata; +import org.checkerframework.checker.nullness.qual.Nullable; + +import java.time.LocalDate; +import java.time.ZonedDateTime; +import java.util.LinkedHashMap; +import java.util.List; +import java.util.HashSet; +import java.util.ArrayList; +import java.util.LinkedHashSet; +import java.util.Set; +import java.util.Map; +import java.util.Objects; +import java.util.UUID; + +public class NotAnyTypeJsonSchema { + public sealed interface NotAnyTypeJsonSchema1Boxed permits NotAnyTypeJsonSchema1BoxedVoid, NotAnyTypeJsonSchema1BoxedBoolean, NotAnyTypeJsonSchema1BoxedNumber, NotAnyTypeJsonSchema1BoxedString, NotAnyTypeJsonSchema1BoxedList, NotAnyTypeJsonSchema1BoxedMap { + @Nullable Object getData(); + } + public record NotAnyTypeJsonSchema1BoxedVoid(Nothing? data) implements NotAnyTypeJsonSchema1Boxed { + @Override + public @Nullable Object getData() { + return data; + } + } + public record NotAnyTypeJsonSchema1BoxedBoolean(boolean data) implements NotAnyTypeJsonSchema1Boxed { + @Override + public @Nullable Object getData() { + return data; + } + } + public record NotAnyTypeJsonSchema1BoxedNumber(Number data) implements NotAnyTypeJsonSchema1Boxed { + @Override + public @Nullable Object getData() { + return data; + } + } + public record NotAnyTypeJsonSchema1BoxedString(String data) implements NotAnyTypeJsonSchema1Boxed { + @Override + public @Nullable Object getData() { + return data; + } + } + public record NotAnyTypeJsonSchema1BoxedList(FrozenList<@Nullable Object> data) implements NotAnyTypeJsonSchema1Boxed { + @Override + public @Nullable Object getData() { + return data; + } + } + public record NotAnyTypeJsonSchema1BoxedMap(FrozenMap<@Nullable Object> data) implements NotAnyTypeJsonSchema1Boxed { + @Override + public @Nullable Object getData() { + return data; + } + } + + public static class NotAnyTypeJsonSchema1 extends JsonSchema implements NullSchemaValidator, BooleanSchemaValidator, NumberSchemaValidator, StringSchemaValidator, ListSchemaValidator, NotAnyTypeJsonSchema1BoxedList>, MapSchemaValidator, NotAnyTypeJsonSchema1BoxedMap> { + private static @Nullable NotAnyTypeJsonSchema1 instance = null; + + protected NotAnyTypeJsonSchema1() { + super(new JsonSchemaInfo() + .not(AnyTypeJsonSchema.AnyTypeJsonSchema1.class) + ); + } + + public static NotAnyTypeJsonSchema1 getInstance() { + if (instance == null) { + instance = new NotAnyTypeJsonSchema1(); + } + return instance; + } + + @Override + public Nothing? validate(Nothing? arg, SchemaConfiguration configuration) throws ValidationException { + Set> pathSet = new HashSet<>(); + List pathToItem = List.of("args[0]"); + Nothing? castArg = castToAllowedTypes(arg, pathToItem, pathSet); + SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().build())); + PathToSchemasMap validatedPathToSchemas = new PathToSchemasMap(); + ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, new LinkedHashSet<>()); + PathToSchemasMap pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet); + return getNewInstance(castArg, validationMetadata.pathToItem(), pathToSchemasMap); + } + + @Override + public boolean validate(boolean arg, SchemaConfiguration configuration) throws ValidationException { + Set> pathSet = new HashSet<>(); + List pathToItem = List.of("args[0]"); + boolean castArg = castToAllowedTypes(arg, pathToItem, pathSet); + SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().build())); + PathToSchemasMap validatedPathToSchemas = new PathToSchemasMap(); + ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, new LinkedHashSet<>()); + PathToSchemasMap pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet); + return getNewInstance(castArg, validationMetadata.pathToItem(), pathToSchemasMap); + } + + @Override + public Number validate(Number arg, SchemaConfiguration configuration) throws ValidationException { + Set> pathSet = new HashSet<>(); + List pathToItem = List.of("args[0]"); + Number castArg = castToAllowedTypes(arg, pathToItem, pathSet); + SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().build())); + PathToSchemasMap validatedPathToSchemas = new PathToSchemasMap(); + ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, new LinkedHashSet<>()); + PathToSchemasMap pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet); + return getNewInstance(castArg, validationMetadata.pathToItem(), pathToSchemasMap); + } + + public int validate(int arg, SchemaConfiguration configuration) throws ValidationException { + return (int) validate((Number) arg, configuration); + } + + public long validate(long arg, SchemaConfiguration configuration) throws ValidationException { + return (long) validate((Number) arg, configuration); + } + + public float validate(float arg, SchemaConfiguration configuration) throws ValidationException { + return (float) validate((Number) arg, configuration); + } + + public double validate(double arg, SchemaConfiguration configuration) throws ValidationException { + return (double) validate((Number) arg, configuration); + } + + @Override + public String validate(String arg, SchemaConfiguration configuration) throws ValidationException { + Set> pathSet = new HashSet<>(); + List pathToItem = List.of("args[0]"); + String castArg = castToAllowedTypes(arg, pathToItem, pathSet); + SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().build())); + PathToSchemasMap validatedPathToSchemas = new PathToSchemasMap(); + ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, new LinkedHashSet<>()); + PathToSchemasMap pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet); + return getNewInstance(castArg, validationMetadata.pathToItem(), pathToSchemasMap); + } + + public String validate(LocalDate arg, SchemaConfiguration configuration) throws ValidationException { + return validate(arg.toString(), configuration); + } + + public String validate(ZonedDateTime arg, SchemaConfiguration configuration) throws ValidationException { + return validate(arg.toString(), configuration); + } + + public String validate(UUID arg, SchemaConfiguration configuration) throws ValidationException { + return validate(arg.toString(), configuration); + } + + @Override + public FrozenList<@Nullable Object> getNewInstance(List arg, List pathToItem, PathToSchemasMap pathToSchemas) { + List<@Nullable Object> items = new ArrayList<>(); + int i = 0; + for (Object item: arg) { + List itemPathToItem = new ArrayList<>(pathToItem); + itemPathToItem.add(i); + LinkedHashMap, Nothing?> schemas = pathToSchemas.get(itemPathToItem); + if (schemas == null) { + 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); + items.add(castItem); + i += 1; + } + return new FrozenList<>(items); + } + + 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); + SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().build())); + PathToSchemasMap validatedPathToSchemas = new PathToSchemasMap(); + ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, new LinkedHashSet<>()); + PathToSchemasMap pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet); + return getNewInstance(castArg, validationMetadata.pathToItem(), pathToSchemasMap); + } + + @Override + 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 RuntimeException("Invalid non-string key value"); + } + String propertyName = (String) entryKey; + List propertyPathToItem = new ArrayList<>(pathToItem); + propertyPathToItem.add(propertyName); + Object value = entry.getValue(); + LinkedHashMap, Nothing?> schemas = pathToSchemas.get(propertyPathToItem); + if (schemas == null) { + 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); + properties.put(propertyName, castValue); + } + return new FrozenMap<>(properties); + } + + public FrozenMap<@Nullable Object> validate(Map arg, SchemaConfiguration configuration) throws ValidationException { + Set> pathSet = new HashSet<>(); + List pathToItem = List.of("args[0]"); + Map castArg = castToAllowedTypes(arg, pathToItem, pathSet); + SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().build())); + PathToSchemasMap validatedPathToSchemas = new PathToSchemasMap(); + ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, new LinkedHashSet<>()); + PathToSchemasMap pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet); + return getNewInstance(castArg, validationMetadata.pathToItem(), pathToSchemasMap); + } + + @Override + public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { + if (arg == null) { + return getNewInstance((Nothing?) null, pathToItem, pathToSchemas); + } else if (arg instanceof Boolean) { + boolean boolArg = (Boolean) arg; + return getNewInstance(boolArg, pathToItem, pathToSchemas); + } else if (arg instanceof Number) { + return getNewInstance((Number) arg, pathToItem, pathToSchemas); + } else if (arg instanceof String) { + return getNewInstance((String) arg, pathToItem, pathToSchemas); + } else if (arg instanceof List) { + return getNewInstance((List) arg, 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"); + } + + @Override + public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { + if (arg == null) { + return validate((Nothing?) null, configuration); + } else if (arg instanceof Boolean) { + boolean boolArg = (Boolean) arg; + return validate(boolArg, configuration); + } else if (arg instanceof Number) { + return validate((Number) arg, configuration); + } else if (arg instanceof String) { + return validate((String) arg, configuration); + } else if (arg instanceof List) { + return validate((List) arg, 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"); + } + + @Override + public NotAnyTypeJsonSchema1BoxedVoid validateAndBox(Nothing? arg, SchemaConfiguration configuration) throws ValidationException { + return new NotAnyTypeJsonSchema1BoxedVoid(validate(arg, configuration)); + } + + @Override + 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 { + return new NotAnyTypeJsonSchema1BoxedNumber(validate(arg, configuration)); + } + + @Override + 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 { + return new NotAnyTypeJsonSchema1BoxedList(validate(arg, configuration)); + } + + @Override + 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 { + if (arg == null) { + Nothing? castArg = (Nothing?) arg; + return validateAndBox(castArg, configuration); + } else if (arg instanceof Boolean booleanArg) { + boolean castArg = booleanArg; + return validateAndBox(castArg, configuration); + } else if (arg instanceof String castArg) { + return validateAndBox(castArg, configuration); + } else if (arg instanceof Number castArg) { + return validateAndBox(castArg, configuration); + } else if (arg instanceof List castArg) { + 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"); + } + } +} \ No newline at end of file diff --git a/src/main/resources/kotlin/src/main/kotlin/packagename/schemas/NullJsonSchema.hbs b/src/main/resources/kotlin/src/main/kotlin/packagename/schemas/NullJsonSchema.hbs new file mode 100644 index 00000000000..8cc09c8e104 --- /dev/null +++ b/src/main/resources/kotlin/src/main/kotlin/packagename/schemas/NullJsonSchema.hbs @@ -0,0 +1,87 @@ +package {{{packageName}}}.schemas; + +import {{{packageName}}}.configurations.JsonSchemaKeywordFlags; +import {{{packageName}}}.configurations.SchemaConfiguration; +import {{{packageName}}}.exceptions.ValidationException; +import {{{packageName}}}.schemas.validation.JsonSchema; +import {{{packageName}}}.schemas.validation.JsonSchemaInfo; +import {{{packageName}}}.schemas.validation.PathToSchemasMap; +import {{{packageName}}}.schemas.validation.NullSchemaValidator; +import {{{packageName}}}.schemas.validation.ValidationMetadata; +import org.checkerframework.checker.nullness.qual.Nullable; + +import java.util.HashSet; +import java.util.LinkedHashSet; +import java.util.List; +import java.util.Objects; +import java.util.Set; + +public class NullJsonSchema { + public sealed interface NullJsonSchema1Boxed permits NullJsonSchema1BoxedVoid { + @Nullable Object getData(); + } + public record NullJsonSchema1BoxedVoid(Nothing? data) implements NullJsonSchema1Boxed { + @Override + public @Nullable Object getData() { + return data; + } + } + + public static class NullJsonSchema1 extends JsonSchema implements NullSchemaValidator { + private static @Nullable NullJsonSchema1 instance = null; + + protected NullJsonSchema1() { + super(new JsonSchemaInfo() + .type(Set.of(Nothing?.class)) + ); + } + + public static NullJsonSchema1 getInstance() { + if (instance == null) { + instance = new NullJsonSchema1(); + } + return instance; + } + + @Override + public Nothing? validate(Nothing? arg, SchemaConfiguration configuration) throws ValidationException { + Set> pathSet = new HashSet<>(); + List pathToItem = List.of("args[0"); + Nothing? castArg = castToAllowedTypes(arg, pathToItem, pathSet); + SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().build())); + ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, new PathToSchemasMap(), new LinkedHashSet<>()); + PathToSchemasMap pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet); + return getNewInstance(castArg, validationMetadata.pathToItem(), pathToSchemasMap); + } + + @Override + public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { + if (arg == null) { + return getNewInstance((Nothing?) null, pathToItem, pathToSchemas); + } + 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 { + if (arg == null) { + return validate((Nothing?) null, configuration); + } + throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + } + + @Override + public NullJsonSchema1BoxedVoid validateAndBox(Nothing? arg, SchemaConfiguration configuration) throws ValidationException { + return new NullJsonSchema1BoxedVoid(validate(arg, configuration)); + } + + @Override + public NullJsonSchema1Boxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { + if (arg == null) { + Nothing? castArg = (Nothing?) arg; + return validateAndBox(castArg, configuration); + } + throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + } + } +} diff --git a/src/main/resources/kotlin/src/main/kotlin/packagename/schemas/NumberJsonSchema.hbs b/src/main/resources/kotlin/src/main/kotlin/packagename/schemas/NumberJsonSchema.hbs new file mode 100644 index 00000000000..736994d2f51 --- /dev/null +++ b/src/main/resources/kotlin/src/main/kotlin/packagename/schemas/NumberJsonSchema.hbs @@ -0,0 +1,107 @@ +package {{{packageName}}}.schemas; + +import {{{packageName}}}.configurations.JsonSchemaKeywordFlags; +import {{{packageName}}}.exceptions.ValidationException; +import {{{packageName}}}.schemas.validation.JsonSchema; +import {{{packageName}}}.schemas.validation.JsonSchemaInfo; +import {{{packageName}}}.configurations.SchemaConfiguration; +import {{{packageName}}}.schemas.validation.PathToSchemasMap; +import {{{packageName}}}.schemas.validation.NumberSchemaValidator; +import {{{packageName}}}.schemas.validation.ValidationMetadata; +import org.checkerframework.checker.nullness.qual.Nullable; + +import java.util.HashSet; +import java.util.LinkedHashSet; +import java.util.List; +import java.util.Objects; +import java.util.Set; + +public class NumberJsonSchema { + public sealed interface NumberJsonSchema1Boxed permits NumberJsonSchema1BoxedNumber { + @Nullable Object getData(); + } + public record NumberJsonSchema1BoxedNumber(Number data) implements NumberJsonSchema1Boxed { + @Override + public @Nullable Object getData() { + return data; + } + } + + public static class NumberJsonSchema1 extends JsonSchema implements NumberSchemaValidator { + private static @Nullable NumberJsonSchema1 instance = null; + + protected NumberJsonSchema1() { + super(new JsonSchemaInfo() + .type(Set.of( + Integer.class, + Long.class, + Float.class, + Double.class + )) + ); + } + + public static NumberJsonSchema1 getInstance() { + if (instance == null) { + instance = new NumberJsonSchema1(); + } + return instance; + } + + @Override + public Number validate(Number arg, SchemaConfiguration configuration) throws ValidationException { + Set> pathSet = new HashSet<>(); + List pathToItem = List.of("args[0"); + Number castArg = castToAllowedTypes(arg, pathToItem, pathSet); + SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().build())); + ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, new PathToSchemasMap(), new LinkedHashSet<>()); + PathToSchemasMap pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet); + return getNewInstance(castArg, validationMetadata.pathToItem(), pathToSchemasMap); + } + + public int validate(int arg, SchemaConfiguration configuration) throws ValidationException { + return (int) validate((Number) arg, configuration); + } + + public long validate(long arg, SchemaConfiguration configuration) throws ValidationException { + return (long) validate((Number) arg, configuration); + } + + public float validate(float arg, SchemaConfiguration configuration) throws ValidationException { + return (float) validate((Number) arg, configuration); + } + + public double validate(double arg, SchemaConfiguration configuration) throws ValidationException { + return (double) validate((Number) arg, configuration); + } + + @Override + public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { + 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"); + } + + @Override + public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws 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"); + } + + @Override + 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 { + 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"); + } + } +} \ No newline at end of file diff --git a/src/main/resources/kotlin/src/main/kotlin/packagename/schemas/SetMaker.hbs b/src/main/resources/kotlin/src/main/kotlin/packagename/schemas/SetMaker.hbs new file mode 100644 index 00000000000..e87b98cfb1a --- /dev/null +++ b/src/main/resources/kotlin/src/main/kotlin/packagename/schemas/SetMaker.hbs @@ -0,0 +1,20 @@ +package {{{packageName}}}.schemas; + +import java.util.HashSet; +import java.util.Set; + +/** + * A builder for maps that allows in null values + * Schema tests + doc code samples need it + */ +public class SetMaker { + @SafeVarargs + @SuppressWarnings("varargs") + public static Set makeSet(E... items) { + Set set = new HashSet<>(); + for (E item : items) { + set.add(item); + } + return set; + } +} \ No newline at end of file diff --git a/src/main/resources/kotlin/src/main/kotlin/packagename/schemas/StringJsonSchema.hbs b/src/main/resources/kotlin/src/main/kotlin/packagename/schemas/StringJsonSchema.hbs new file mode 100644 index 00000000000..56912a48a39 --- /dev/null +++ b/src/main/resources/kotlin/src/main/kotlin/packagename/schemas/StringJsonSchema.hbs @@ -0,0 +1,106 @@ +package {{{packageName}}}.schemas; + +import {{{packageName}}}.configurations.JsonSchemaKeywordFlags; +import {{{packageName}}}.configurations.SchemaConfiguration; +import {{{packageName}}}.exceptions.ValidationException; +import {{{packageName}}}.schemas.validation.JsonSchema; +import {{{packageName}}}.schemas.validation.JsonSchemaInfo; +import {{{packageName}}}.schemas.validation.PathToSchemasMap; +import {{{packageName}}}.schemas.validation.StringSchemaValidator; +import {{{packageName}}}.schemas.validation.ValidationMetadata; +import org.checkerframework.checker.nullness.qual.Nullable; + +import java.time.LocalDate; +import java.time.ZonedDateTime; +import java.util.HashSet; +import java.util.LinkedHashSet; +import java.util.List; +import java.util.Objects; +import java.util.Set; +import java.util.UUID; + +public class StringJsonSchema { + public sealed interface StringJsonSchema1Boxed permits StringJsonSchema1BoxedString { + @Nullable Object getData(); + } + public record StringJsonSchema1BoxedString(String data) implements StringJsonSchema1Boxed { + @Override + public @Nullable Object getData() { + return data; + } + } + public static class StringJsonSchema1 extends JsonSchema implements StringSchemaValidator { + private static @Nullable StringJsonSchema1 instance = null; + + protected StringJsonSchema1() { + super(new JsonSchemaInfo() + .type(Set.of(String.class)) + ); + } + + public static StringJsonSchema1 getInstance() { + if (instance == null) { + instance = new StringJsonSchema1(); + } + return instance; + } + + @Override + public String validate(String arg, SchemaConfiguration configuration) throws ValidationException { + Set> pathSet = new HashSet<>(); + List pathToItem = List.of("args[0"); + String castArg = castToAllowedTypes(arg, pathToItem, pathSet); + SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().build())); + ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, new PathToSchemasMap(), new LinkedHashSet<>()); + PathToSchemasMap pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet); + return getNewInstance(castArg, validationMetadata.pathToItem(), pathToSchemasMap); + } + + public String validate(LocalDate arg, SchemaConfiguration configuration) throws ValidationException { + return validate(arg.toString(), configuration); + } + + public String validate(ZonedDateTime arg, SchemaConfiguration configuration) throws ValidationException { + return validate(arg.toString(), configuration); + } + + public String validate(UUID arg, SchemaConfiguration configuration) throws ValidationException { + return validate(arg.toString(), configuration); + } + + @Override + public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { + 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"); + } + + @Override + 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) { + return validate((LocalDate) arg, configuration); + } else if (arg instanceof ZonedDateTime) { + return validate((ZonedDateTime) 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"); + } + + @Override + 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 { + 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"); + } + } +} diff --git a/src/main/resources/kotlin/src/main/kotlin/packagename/schemas/UnsetAddPropsSetter.hbs b/src/main/resources/kotlin/src/main/kotlin/packagename/schemas/UnsetAddPropsSetter.hbs new file mode 100644 index 00000000000..1f6766a6196 --- /dev/null +++ b/src/main/resources/kotlin/src/main/kotlin/packagename/schemas/UnsetAddPropsSetter.hbs @@ -0,0 +1,77 @@ +package {{{packageName}}}.schemas; + +import org.checkerframework.checker.nullness.qual.Nullable; +import {{{packageName}}}.exceptions.InvalidAdditionalPropertyException; +import {{{packageName}}}.schemas.validation.MapUtils; + +import java.util.List; +import java.util.Map; +import java.util.Set; + +public abstract class UnsetAddPropsSetter { + public abstract Map getInstance(); + public abstract Set getKnownKeys(); + public abstract T getBuilderAfterAdditionalProperty(Map instance); + public T additionalProperty(String key, Nothing? value) throws InvalidAdditionalPropertyException { + MapUtils.throwIfKeyKnown(key, getKnownKeys(), true); + var instance = getInstance(); + instance.put(key, value); + return getBuilderAfterAdditionalProperty(instance); + } + + public T additionalProperty(String key, boolean value) throws InvalidAdditionalPropertyException { + MapUtils.throwIfKeyKnown(key, getKnownKeys(), true); + var instance = getInstance(); + instance.put(key, value); + return getBuilderAfterAdditionalProperty(instance); + } + + public T additionalProperty(String key, String value) throws InvalidAdditionalPropertyException { + MapUtils.throwIfKeyKnown(key, getKnownKeys(), true); + var instance = getInstance(); + instance.put(key, value); + return getBuilderAfterAdditionalProperty(instance); + } + + public T additionalProperty(String key, int value) throws InvalidAdditionalPropertyException { + MapUtils.throwIfKeyKnown(key, getKnownKeys(), true); + var instance = getInstance(); + instance.put(key, value); + return getBuilderAfterAdditionalProperty(instance); + } + + public T additionalProperty(String key, float value) throws InvalidAdditionalPropertyException { + MapUtils.throwIfKeyKnown(key, getKnownKeys(), true); + var instance = getInstance(); + instance.put(key, value); + return getBuilderAfterAdditionalProperty(instance); + } + + public T additionalProperty(String key, long value) throws InvalidAdditionalPropertyException { + MapUtils.throwIfKeyKnown(key, getKnownKeys(), true); + var instance = getInstance(); + instance.put(key, value); + return getBuilderAfterAdditionalProperty(instance); + } + + public T additionalProperty(String key, double value) throws InvalidAdditionalPropertyException { + MapUtils.throwIfKeyKnown(key, getKnownKeys(), true); + var instance = getInstance(); + instance.put(key, value); + return getBuilderAfterAdditionalProperty(instance); + } + + public T additionalProperty(String key, List value) throws InvalidAdditionalPropertyException { + MapUtils.throwIfKeyKnown(key, getKnownKeys(), true); + var instance = getInstance(); + instance.put(key, value); + return getBuilderAfterAdditionalProperty(instance); + } + + public T additionalProperty(String key, Map value) throws InvalidAdditionalPropertyException { + MapUtils.throwIfKeyKnown(key, getKnownKeys(), true); + var instance = getInstance(); + instance.put(key, value); + return getBuilderAfterAdditionalProperty(instance); + } +} diff --git a/src/main/resources/kotlin/src/main/kotlin/packagename/schemas/UuidJsonSchema.hbs b/src/main/resources/kotlin/src/main/kotlin/packagename/schemas/UuidJsonSchema.hbs new file mode 100644 index 00000000000..5a6f515c37f --- /dev/null +++ b/src/main/resources/kotlin/src/main/kotlin/packagename/schemas/UuidJsonSchema.hbs @@ -0,0 +1,94 @@ +package {{{packageName}}}.schemas; + +import {{{packageName}}}.configurations.JsonSchemaKeywordFlags; +import {{{packageName}}}.exceptions.ValidationException; +import {{{packageName}}}.schemas.validation.JsonSchema; +import {{{packageName}}}.schemas.validation.JsonSchemaInfo; +import {{{packageName}}}.configurations.SchemaConfiguration; +import {{{packageName}}}.schemas.validation.PathToSchemasMap; +import {{{packageName}}}.schemas.validation.StringSchemaValidator; +import {{{packageName}}}.schemas.validation.ValidationMetadata; +import org.checkerframework.checker.nullness.qual.Nullable; + +import java.util.HashSet; +import java.util.LinkedHashSet; +import java.util.List; +import java.util.Objects; +import java.util.Set; +import java.util.UUID; + +public class UuidJsonSchema { + public sealed interface UuidJsonSchema1Boxed permits UuidJsonSchema1BoxedString { + @Nullable Object getData(); + } + public record UuidJsonSchema1BoxedString(String data) implements UuidJsonSchema1Boxed { + @Override + public @Nullable Object getData() { + return data; + } + } + + public static class UuidJsonSchema1 extends JsonSchema implements StringSchemaValidator { + private static @Nullable UuidJsonSchema1 instance = null; + + protected UuidJsonSchema1() { + super(new JsonSchemaInfo() + .type(Set.of(String.class)) + .format("uuid") + ); + } + + public static UuidJsonSchema1 getInstance() { + if (instance == null) { + instance = new UuidJsonSchema1(); + } + return instance; + } + + @Override + public String validate(String arg, SchemaConfiguration configuration) throws ValidationException { + Set> pathSet = new HashSet<>(); + List pathToItem = List.of("args[0"); + String castArg = castToAllowedTypes(arg, pathToItem, pathSet); + SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().build())); + ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, new PathToSchemasMap(), new LinkedHashSet<>()); + PathToSchemasMap pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet); + return getNewInstance(castArg, validationMetadata.pathToItem(), pathToSchemasMap); + } + + public String validate(UUID arg, SchemaConfiguration configuration) throws ValidationException { + return validate(arg.toString(), configuration); + } + + @Override + public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { + 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"); + } + + @Override + 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 ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + } + + @Override + 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 { + 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"); + } + } +} \ No newline at end of file diff --git a/src/main/resources/kotlin/src/main/kotlin/packagename/schemas/validation/AdditionalPropertiesValidator.hbs b/src/main/resources/kotlin/src/main/kotlin/packagename/schemas/validation/AdditionalPropertiesValidator.hbs new file mode 100644 index 00000000000..7a7b89638e8 --- /dev/null +++ b/src/main/resources/kotlin/src/main/kotlin/packagename/schemas/validation/AdditionalPropertiesValidator.hbs @@ -0,0 +1,58 @@ +package {{{packageName}}}.schemas.validation; + +import org.checkerframework.checker.nullness.qual.Nullable; +import {{{packageName}}}.exceptions.ValidationException; + +import java.util.ArrayList; +import java.util.LinkedHashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; + +public class AdditionalPropertiesValidator implements KeywordValidator { + @Override + public @Nullable PathToSchemasMap validate( + ValidationData data + ) throws ValidationException { + if (!(data.arg() instanceof Map mapArg)) { + return null; + } + var additionalProperties = data.schema().additionalProperties; + if (additionalProperties == null) { + return null; + } + Set presentAdditionalProperties = new LinkedHashSet<>(); + for (Object key: mapArg.keySet()) { + if (key instanceof String) { + presentAdditionalProperties.add((String) key); + } + } + var properties = data.schema().properties; + if (properties != null) { + presentAdditionalProperties.removeAll(properties.keySet()); + } + PathToSchemasMap pathToSchemas = new PathToSchemasMap(); + for(String addPropName: presentAdditionalProperties) { + @Nullable Object propValue = mapArg.get(addPropName); + List propPathToItem = new ArrayList<>(data.validationMetadata().pathToItem()); + propPathToItem.add(addPropName); + if (data.patternPropertiesPathToSchemas() != null && data.patternPropertiesPathToSchemas().containsKey(propPathToItem)) { + continue; + } + ValidationMetadata propValidationMetadata = new ValidationMetadata( + propPathToItem, + data.validationMetadata().configuration(), + data.validationMetadata().validatedPathToSchemas(), + data.validationMetadata().seenClasses() + ); + JsonSchema addPropsSchema = JsonSchemaFactory.getInstance(additionalProperties); + if (propValidationMetadata.validationRanEarlier(addPropsSchema)) { + // todo add_deeper_validated_schemas + continue; + } + PathToSchemasMap otherPathToSchemas = JsonSchema.validate(addPropsSchema, propValue, propValidationMetadata); + pathToSchemas.update(otherPathToSchemas); + } + return pathToSchemas; + } +} diff --git a/src/main/resources/kotlin/src/main/kotlin/packagename/schemas/validation/AllOfValidator.hbs b/src/main/resources/kotlin/src/main/kotlin/packagename/schemas/validation/AllOfValidator.hbs new file mode 100644 index 00000000000..e4d3b3e0d78 --- /dev/null +++ b/src/main/resources/kotlin/src/main/kotlin/packagename/schemas/validation/AllOfValidator.hbs @@ -0,0 +1,23 @@ +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; + } + PathToSchemasMap pathToSchemas = new PathToSchemasMap(); + for(Class> allOfClass: allOf) { + JsonSchema allOfSchema = JsonSchemaFactory.getInstance(allOfClass); + PathToSchemasMap otherPathToSchemas = JsonSchema.validate(allOfSchema, data.arg(), data.validationMetadata()); + pathToSchemas.update(otherPathToSchemas); + } + return pathToSchemas; + } +} diff --git a/src/main/resources/kotlin/src/main/kotlin/packagename/schemas/validation/AnyOfValidator.hbs b/src/main/resources/kotlin/src/main/kotlin/packagename/schemas/validation/AnyOfValidator.hbs new file mode 100644 index 00000000000..16514902bde --- /dev/null +++ b/src/main/resources/kotlin/src/main/kotlin/packagename/schemas/validation/AnyOfValidator.hbs @@ -0,0 +1,45 @@ +package {{{packageName}}}.schemas.validation; + +import {{{packageName}}}.exceptions.ValidationException; +import org.checkerframework.checker.nullness.qual.Nullable; + +import java.util.ArrayList; +import java.util.List; + +public class AnyOfValidator implements KeywordValidator { + @Override + public @Nullable PathToSchemasMap validate( + ValidationData data + ) throws ValidationException { + var anyOf = data.schema().anyOf; + if (anyOf == null) { + return null; + } + PathToSchemasMap pathToSchemas = new PathToSchemasMap(); + List>> validatedAnyOfClasses = new ArrayList<>(); + for(Class> anyOfClass: anyOf) { + if (anyOfClass == data.schema().getClass()) { + /* + optimistically assume that schema will pass validation + do not invoke _validate on it because that is recursive + */ + validatedAnyOfClasses.add(anyOfClass); + continue; + } + try { + JsonSchema anyOfSchema = JsonSchemaFactory.getInstance(anyOfClass); + PathToSchemasMap otherPathToSchemas = JsonSchema.validate(anyOfSchema, data.arg(), data.validationMetadata()); + validatedAnyOfClasses.add(anyOfClass); + pathToSchemas.update(otherPathToSchemas); + } catch (ValidationException e) { + // silence exceptions because the code needs to accumulate anyof_classes + } + } + if (validatedAnyOfClasses.isEmpty()) { + throw new ValidationException("Invalid inputs given to generate an instance of "+data.schema().getClass()+". None "+ + "of the anyOf schemas matched the input data." + ); + } + return pathToSchemas; + } +} diff --git a/src/main/resources/kotlin/src/main/kotlin/packagename/schemas/validation/BigDecimalValidator.hbs b/src/main/resources/kotlin/src/main/kotlin/packagename/schemas/validation/BigDecimalValidator.hbs new file mode 100644 index 00000000000..47a5be850ee --- /dev/null +++ b/src/main/resources/kotlin/src/main/kotlin/packagename/schemas/validation/BigDecimalValidator.hbs @@ -0,0 +1,21 @@ +package {{{packageName}}}.schemas.validation; + +import {{{packageName}}}.exceptions.ValidationException; + +import java.math.BigDecimal; + +public abstract class BigDecimalValidator { + protected BigDecimal getBigDecimal(Number arg) throws ValidationException { + if (arg instanceof Integer) { + return new BigDecimal((Integer) arg); + } else if (arg instanceof Long) { + return new BigDecimal((Long) arg); + } else if (arg instanceof Float) { + return new BigDecimal(Float.toString((Float) arg)); + } else if (arg instanceof Double) { + return new BigDecimal(Double.toString((Double) arg)); + } else { + throw new ValidationException("Invalid type input for arg"); + } + } +} diff --git a/src/main/resources/kotlin/src/main/kotlin/packagename/schemas/validation/BooleanEnumValidator.hbs b/src/main/resources/kotlin/src/main/kotlin/packagename/schemas/validation/BooleanEnumValidator.hbs new file mode 100644 index 00000000000..f9ecf469846 --- /dev/null +++ b/src/main/resources/kotlin/src/main/kotlin/packagename/schemas/validation/BooleanEnumValidator.hbs @@ -0,0 +1,8 @@ +package {{{packageName}}}.schemas.validation; + +import {{{packageName}}}.configurations.SchemaConfiguration; +import {{{packageName}}}.exceptions.ValidationException; + +public interface BooleanEnumValidator { + boolean validate(EnumType arg, SchemaConfiguration configuration) throws ValidationException; +} \ No newline at end of file diff --git a/src/main/resources/kotlin/src/main/kotlin/packagename/schemas/validation/BooleanSchemaValidator.hbs b/src/main/resources/kotlin/src/main/kotlin/packagename/schemas/validation/BooleanSchemaValidator.hbs new file mode 100644 index 00000000000..8ac8de93950 --- /dev/null +++ b/src/main/resources/kotlin/src/main/kotlin/packagename/schemas/validation/BooleanSchemaValidator.hbs @@ -0,0 +1,9 @@ +package {{{packageName}}}.schemas.validation; + +import {{{packageName}}}.configurations.SchemaConfiguration; +import {{{packageName}}}.exceptions.ValidationException; + +public interface BooleanSchemaValidator { + 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/kotlin/src/main/kotlin/packagename/schemas/validation/BooleanValueMethod.hbs b/src/main/resources/kotlin/src/main/kotlin/packagename/schemas/validation/BooleanValueMethod.hbs new file mode 100644 index 00000000000..6fc89580057 --- /dev/null +++ b/src/main/resources/kotlin/src/main/kotlin/packagename/schemas/validation/BooleanValueMethod.hbs @@ -0,0 +1,5 @@ +package {{{packageName}}}.schemas.validation; + +public interface BooleanValueMethod { + boolean value(); +} \ No newline at end of file diff --git a/src/main/resources/kotlin/src/main/kotlin/packagename/schemas/validation/ConstValidator.hbs b/src/main/resources/kotlin/src/main/kotlin/packagename/schemas/validation/ConstValidator.hbs new file mode 100644 index 00000000000..c45ceaf07b2 --- /dev/null +++ b/src/main/resources/kotlin/src/main/kotlin/packagename/schemas/validation/ConstValidator.hbs @@ -0,0 +1,33 @@ +package {{{packageName}}}.schemas.validation; + +import {{{packageName}}}.exceptions.ValidationException; +import org.checkerframework.checker.nullness.qual.Nullable; + +import java.math.BigDecimal; +import java.util.Objects; + +public class ConstValidator extends BigDecimalValidator implements KeywordValidator { + @Override + public @Nullable PathToSchemasMap validate( + ValidationData data + ) throws ValidationException { + if (!data.schema().constValueSet) { + return null; + } + var constValue = data.schema().constValue; + if (data.arg() instanceof Number numberArg) { + BigDecimal castArg = getBigDecimal(numberArg); + if (Objects.equals(castArg, constValue)) { + return null; + } + if (constValue instanceof BigDecimal && ((BigDecimal) constValue).compareTo(castArg) == 0) { + return null; + } + } else { + if (Objects.equals(data.arg(), constValue)) { + return null; + } + } + throw new ValidationException("Invalid value "+data.arg()+" was not equal to const "+constValue); + } +} \ No newline at end of file diff --git a/src/main/resources/kotlin/src/main/kotlin/packagename/schemas/validation/ContainsValidator.hbs b/src/main/resources/kotlin/src/main/kotlin/packagename/schemas/validation/ContainsValidator.hbs new file mode 100644 index 00000000000..8bd70adb570 --- /dev/null +++ b/src/main/resources/kotlin/src/main/kotlin/packagename/schemas/validation/ContainsValidator.hbs @@ -0,0 +1,30 @@ +package {{{packageName}}}.schemas.validation; + +import org.checkerframework.checker.nullness.qual.Nullable; +import {{{packageName}}}.exceptions.ValidationException; + +import java.util.List; + +public class ContainsValidator implements KeywordValidator { + @Override + public @Nullable PathToSchemasMap validate( + ValidationData data + ) throws ValidationException { + if (!(data.arg() instanceof List)) { + return null; + } + var containsPathToSchemas = data.containsPathToSchemas(); + if (containsPathToSchemas == null || containsPathToSchemas.isEmpty()) { + throw new ValidationException( + "Validation failed for contains keyword in class="+data.schema().getClass() + + " at pathToItem="+data.validationMetadata().pathToItem()+". No " + + "items validated to the contains schema." + ); + } + PathToSchemasMap pathToSchemas = new PathToSchemasMap(); + for (PathToSchemasMap otherPathToSchema: containsPathToSchemas) { + pathToSchemas.update(otherPathToSchema); + } + return pathToSchemas; + } +} \ No newline at end of file diff --git a/src/main/resources/kotlin/src/main/kotlin/packagename/schemas/validation/CustomIsoparser.hbs b/src/main/resources/kotlin/src/main/kotlin/packagename/schemas/validation/CustomIsoparser.hbs new file mode 100644 index 00000000000..ab111822f9f --- /dev/null +++ b/src/main/resources/kotlin/src/main/kotlin/packagename/schemas/validation/CustomIsoparser.hbs @@ -0,0 +1,16 @@ +package {{{packageName}}}.schemas.validation; + +import java.time.ZonedDateTime; +import java.time.LocalDate; + +public final class CustomIsoparser { + + public ZonedDateTime parseIsodatetime(String dateTime) { + return ZonedDateTime.parse(dateTime); + } + + public LocalDate parseIsodate(String date) { + return LocalDate.parse(date); + } + +} \ No newline at end of file diff --git a/src/main/resources/kotlin/src/main/kotlin/packagename/schemas/validation/DefaultValueMethod.hbs b/src/main/resources/kotlin/src/main/kotlin/packagename/schemas/validation/DefaultValueMethod.hbs new file mode 100644 index 00000000000..a362656402f --- /dev/null +++ b/src/main/resources/kotlin/src/main/kotlin/packagename/schemas/validation/DefaultValueMethod.hbs @@ -0,0 +1,7 @@ +package {{{packageName}}}.schemas.validation; + +import {{{packageName}}}.exceptions.ValidationException; + +public interface DefaultValueMethod { + T defaultValue() throws ValidationException; +} \ No newline at end of file diff --git a/src/main/resources/kotlin/src/main/kotlin/packagename/schemas/validation/DependentRequiredValidator.hbs b/src/main/resources/kotlin/src/main/kotlin/packagename/schemas/validation/DependentRequiredValidator.hbs new file mode 100644 index 00000000000..83b1f7cf1bc --- /dev/null +++ b/src/main/resources/kotlin/src/main/kotlin/packagename/schemas/validation/DependentRequiredValidator.hbs @@ -0,0 +1,42 @@ +package {{{packageName}}}.schemas.validation; + +import org.checkerframework.checker.nullness.qual.Nullable; +import {{{packageName}}}.exceptions.ValidationException; + +import java.util.HashSet; +import java.util.Map; +import java.util.Set; + +public class DependentRequiredValidator implements KeywordValidator { + @Override + public @Nullable PathToSchemasMap validate( + ValidationData data + ) throws ValidationException { + if (!(data.arg() instanceof Map mapArg)) { + return null; + } + var dependentRequired = data.schema().dependentRequired; + if (dependentRequired == null) { + return null; + } + for (Map.Entry> entry: dependentRequired.entrySet()) { + if (!mapArg.containsKey(entry.getKey())) { + continue; + } + Set missingKeys = new HashSet<>(entry.getValue()); + for (Object objKey: mapArg.keySet()) { + if (objKey instanceof String key) { + missingKeys.remove(key); + } + } + if (missingKeys.isEmpty()) { + continue; + } + throw new ValidationException( + "Validation failed for dependentRequired because these_keys="+missingKeys+" are "+ + "missing at pathToItem="+data.validationMetadata().pathToItem()+" in class "+data.schema().getClass() + ); + } + return null; + } +} diff --git a/src/main/resources/kotlin/src/main/kotlin/packagename/schemas/validation/DependentSchemasValidator.hbs b/src/main/resources/kotlin/src/main/kotlin/packagename/schemas/validation/DependentSchemasValidator.hbs new file mode 100644 index 00000000000..6c05666c132 --- /dev/null +++ b/src/main/resources/kotlin/src/main/kotlin/packagename/schemas/validation/DependentSchemasValidator.hbs @@ -0,0 +1,41 @@ +package {{{packageName}}}.schemas.validation; + +import org.checkerframework.checker.nullness.qual.Nullable; +import {{{packageName}}}.exceptions.ValidationException; + +import java.util.LinkedHashSet; +import java.util.Map; +import java.util.Set; + +public class DependentSchemasValidator implements KeywordValidator { + @Override + public @Nullable PathToSchemasMap validate( + ValidationData data + ) throws ValidationException { + if (!(data.arg() instanceof Map mapArg)) { + return null; + } + var dependentSchemas = data.schema().dependentSchemas; + if (dependentSchemas == null) { + return null; + } + PathToSchemasMap pathToSchemas = new PathToSchemasMap(); + Set presentProperties = new LinkedHashSet<>(); + for (Object key: mapArg.keySet()) { + if (key instanceof String) { + presentProperties.add((String) key); + } + } + for(Map.Entry>> entry: dependentSchemas.entrySet()) { + String propName = entry.getKey(); + if (!presentProperties.contains(propName)) { + continue; + } + Class> dependentSchemaClass = entry.getValue(); + JsonSchema dependentSchema = JsonSchemaFactory.getInstance(dependentSchemaClass); + PathToSchemasMap otherPathToSchemas = JsonSchema.validate(dependentSchema, mapArg, data.validationMetadata()); + pathToSchemas.update(otherPathToSchemas); + } + return pathToSchemas; + } +} diff --git a/src/main/resources/kotlin/src/main/kotlin/packagename/schemas/validation/DoubleEnumValidator.hbs b/src/main/resources/kotlin/src/main/kotlin/packagename/schemas/validation/DoubleEnumValidator.hbs new file mode 100644 index 00000000000..9de5c58a990 --- /dev/null +++ b/src/main/resources/kotlin/src/main/kotlin/packagename/schemas/validation/DoubleEnumValidator.hbs @@ -0,0 +1,8 @@ +package {{{packageName}}}.schemas.validation; + +import {{{packageName}}}.configurations.SchemaConfiguration; +import {{{packageName}}}.exceptions.ValidationException; + +public interface DoubleEnumValidator { + double validate(EnumType arg, SchemaConfiguration configuration) throws ValidationException; +} \ No newline at end of file diff --git a/src/main/resources/kotlin/src/main/kotlin/packagename/schemas/validation/DoubleValueMethod.hbs b/src/main/resources/kotlin/src/main/kotlin/packagename/schemas/validation/DoubleValueMethod.hbs new file mode 100644 index 00000000000..96e5aeb4f56 --- /dev/null +++ b/src/main/resources/kotlin/src/main/kotlin/packagename/schemas/validation/DoubleValueMethod.hbs @@ -0,0 +1,5 @@ +package {{{packageName}}}.schemas.validation; + +public interface DoubleValueMethod { + double value(); +} \ No newline at end of file diff --git a/src/main/resources/kotlin/src/main/kotlin/packagename/schemas/validation/ElseValidator.hbs b/src/main/resources/kotlin/src/main/kotlin/packagename/schemas/validation/ElseValidator.hbs new file mode 100644 index 00000000000..f4963b7f04f --- /dev/null +++ b/src/main/resources/kotlin/src/main/kotlin/packagename/schemas/validation/ElseValidator.hbs @@ -0,0 +1,31 @@ +package {{{packageName}}}.schemas.validation; + +import org.checkerframework.checker.nullness.qual.Nullable; +import {{{packageName}}}.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; + } + var ifPathToSchemas = data.ifPathToSchemas(); + if (ifPathToSchemas == null) { + // if unset + return null; + } + if (!ifPathToSchemas.isEmpty()) { + // if validation is true + return null; + } + JsonSchema elseSchemaInstance = JsonSchemaFactory.getInstance(elseSchema); + PathToSchemasMap pathToSchemas = new PathToSchemasMap(); + var elsePathToSchemas = JsonSchema.validate(elseSchemaInstance, data.arg(), data.validationMetadata()); + // todo capture validation error and describe it as an else error? + pathToSchemas.update(elsePathToSchemas); + return pathToSchemas; + } +} diff --git a/src/main/resources/kotlin/src/main/kotlin/packagename/schemas/validation/EnumValidator.hbs b/src/main/resources/kotlin/src/main/kotlin/packagename/schemas/validation/EnumValidator.hbs new file mode 100644 index 00000000000..3d95fc99cfa --- /dev/null +++ b/src/main/resources/kotlin/src/main/kotlin/packagename/schemas/validation/EnumValidator.hbs @@ -0,0 +1,43 @@ +package {{{packageName}}}.schemas.validation; + +import {{{packageName}}}.exceptions.ValidationException; +import org.checkerframework.checker.nullness.qual.Nullable; + +import java.math.BigDecimal; +import java.util.Set; + +public class EnumValidator extends BigDecimalValidator implements KeywordValidator { + @SuppressWarnings("nullness") + private static boolean enumContainsArg(Set<@Nullable Object> enumValues, @Nullable Object arg){ + return enumValues.contains(arg); + } + + @Override + public @Nullable PathToSchemasMap validate( + ValidationData data + ) throws ValidationException { + var enumValues = data.schema().enumValues; + if (enumValues == null) { + return null; + } + if (enumValues.isEmpty()) { + throw new ValidationException("No value can match enum because enum is empty"); + } + if (data.arg() instanceof Number numberArg) { + BigDecimal castArg = getBigDecimal(numberArg); + if (enumContainsArg(enumValues, castArg)) { + return null; + } + for (Object enumValue: enumValues) { + if (enumValue instanceof BigDecimal && ((BigDecimal) enumValue).compareTo(castArg) == 0) { + return null; + } + } + } else { + if (enumContainsArg(enumValues, data.arg())) { + return null; + } + } + throw new ValidationException("Invalid value "+data.arg()+" was not one of the allowed enum "+enumValues); + } +} diff --git a/src/main/resources/kotlin/src/main/kotlin/packagename/schemas/validation/ExclusiveMaximumValidator.hbs b/src/main/resources/kotlin/src/main/kotlin/packagename/schemas/validation/ExclusiveMaximumValidator.hbs new file mode 100644 index 00000000000..33299752bf0 --- /dev/null +++ b/src/main/resources/kotlin/src/main/kotlin/packagename/schemas/validation/ExclusiveMaximumValidator.hbs @@ -0,0 +1,45 @@ +package {{{packageName}}}.schemas.validation; + +import {{{packageName}}}.exceptions.ValidationException; +import org.checkerframework.checker.nullness.qual.Nullable; + +public class ExclusiveMaximumValidator implements KeywordValidator { + @Override + public @Nullable PathToSchemasMap validate( + ValidationData data + ) throws ValidationException { + var exclusiveMaximum = data.schema().exclusiveMaximum; + if (exclusiveMaximum == null) { + return null; + } + if (!(data.arg() instanceof Number)) { + return null; + } + String msg = "Value " + data.arg() + " is invalid because it is >= the exclusiveMaximum of " + exclusiveMaximum; + if (data.arg() instanceof Integer intArg) { + if (intArg.compareTo(exclusiveMaximum.intValue()) > -1) { + throw new ValidationException(msg); + } + return null; + } + if (data.arg() instanceof Long longArg) { + if (longArg.compareTo(exclusiveMaximum.longValue()) > -1) { + throw new ValidationException(msg); + } + return null; + } + if (data.arg() instanceof Float floatArg) { + if (floatArg.compareTo(exclusiveMaximum.floatValue()) > -1) { + throw new ValidationException(msg); + } + return null; + } + if (data.arg() instanceof Double doubleArg) { + if (doubleArg.compareTo(exclusiveMaximum.doubleValue()) > -1) { + throw new ValidationException(msg); + } + return null; + } + return null; + } +} diff --git a/src/main/resources/kotlin/src/main/kotlin/packagename/schemas/validation/ExclusiveMinimumValidator.hbs b/src/main/resources/kotlin/src/main/kotlin/packagename/schemas/validation/ExclusiveMinimumValidator.hbs new file mode 100644 index 00000000000..3ba4f4e778c --- /dev/null +++ b/src/main/resources/kotlin/src/main/kotlin/packagename/schemas/validation/ExclusiveMinimumValidator.hbs @@ -0,0 +1,45 @@ +package {{{packageName}}}.schemas.validation; + +import {{{packageName}}}.exceptions.ValidationException; +import org.checkerframework.checker.nullness.qual.Nullable; + +public class ExclusiveMinimumValidator implements KeywordValidator { + @Override + public @Nullable PathToSchemasMap validate( + ValidationData data + ) throws ValidationException { + var exclusiveMinimum = data.schema().exclusiveMinimum; + if (exclusiveMinimum == null) { + return null; + } + if (!(data.arg() instanceof Number)) { + return null; + } + String msg = "Value " + data.arg() + " is invalid because it is <= the exclusiveMinimum of " + exclusiveMinimum; + if (data.arg() instanceof Integer intArg) { + if (intArg.compareTo(exclusiveMinimum.intValue()) < 1) { + throw new ValidationException(msg); + } + return null; + } + if (data.arg() instanceof Long longArg) { + if (longArg.compareTo(exclusiveMinimum.longValue()) < 1) { + throw new ValidationException(msg); + } + return null; + } + if (data.arg() instanceof Float floatArg) { + if (floatArg.compareTo(exclusiveMinimum.floatValue()) < 1) { + throw new ValidationException(msg); + } + return null; + } + if (data.arg() instanceof Double doubleArg) { + if (doubleArg.compareTo(exclusiveMinimum.doubleValue()) < 1) { + throw new ValidationException(msg); + } + return null; + } + return null; + } +} diff --git a/src/main/resources/kotlin/src/main/kotlin/packagename/schemas/validation/FloatEnumValidator.hbs b/src/main/resources/kotlin/src/main/kotlin/packagename/schemas/validation/FloatEnumValidator.hbs new file mode 100644 index 00000000000..7d9d5a7fcce --- /dev/null +++ b/src/main/resources/kotlin/src/main/kotlin/packagename/schemas/validation/FloatEnumValidator.hbs @@ -0,0 +1,8 @@ +package {{{packageName}}}.schemas.validation; + +import {{{packageName}}}.configurations.SchemaConfiguration; +import {{{packageName}}}.exceptions.ValidationException; + +public interface FloatEnumValidator { + float validate(EnumType arg, SchemaConfiguration configuration) throws ValidationException; +} \ No newline at end of file diff --git a/src/main/resources/kotlin/src/main/kotlin/packagename/schemas/validation/FloatValueMethod.hbs b/src/main/resources/kotlin/src/main/kotlin/packagename/schemas/validation/FloatValueMethod.hbs new file mode 100644 index 00000000000..49ef3b3c1bd --- /dev/null +++ b/src/main/resources/kotlin/src/main/kotlin/packagename/schemas/validation/FloatValueMethod.hbs @@ -0,0 +1,5 @@ +package {{{packageName}}}.schemas.validation; + +public interface FloatValueMethod { + float value(); +} \ No newline at end of file diff --git a/src/main/resources/kotlin/src/main/kotlin/packagename/schemas/validation/FormatValidator.hbs b/src/main/resources/kotlin/src/main/kotlin/packagename/schemas/validation/FormatValidator.hbs new file mode 100644 index 00000000000..282a9516a6a --- /dev/null +++ b/src/main/resources/kotlin/src/main/kotlin/packagename/schemas/validation/FormatValidator.hbs @@ -0,0 +1,158 @@ +package {{{packageName}}}.schemas.validation; + +import {{{packageName}}}.exceptions.ValidationException; +import org.checkerframework.checker.nullness.qual.Nullable; + +import java.math.BigDecimal; +import java.math.BigInteger; +import java.time.format.DateTimeParseException; +import java.util.UUID; + +public class FormatValidator implements KeywordValidator { + private final static BigInteger int32InclusiveMinimum = BigInteger.valueOf(-2147483648L); + private final static BigInteger int32InclusiveMaximum = BigInteger.valueOf(2147483647L); + private final static BigInteger int64InclusiveMinimum = BigInteger.valueOf(-9223372036854775808L); + private final static BigInteger int64InclusiveMaximum = BigInteger.valueOf(9223372036854775807L); + private final static BigDecimal floatInclusiveMinimum = BigDecimal.valueOf(-3.4028234663852886e+38); + private final static BigDecimal floatInclusiveMaximum = BigDecimal.valueOf(3.4028234663852886e+38); + 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 { + if (format.startsWith("int")) { + // there is a json schema test where 1.0 validates as an integer + BigInteger intArg; + if (arg instanceof Float || arg instanceof Double) { + double doubleArg; + if (arg instanceof Float) { + doubleArg = arg.doubleValue(); + } else { + doubleArg = (Double) arg; + } + if (Math.floor(doubleArg) != doubleArg) { + throw new ValidationException( + "Invalid non-integer value " + arg + " for format " + format + " at " + validationMetadata.pathToItem() + ); + } + if (arg instanceof Float) { + Integer smallInt = Math.round((Float) arg); + intArg = BigInteger.valueOf(smallInt.longValue()); + } else { + intArg = BigInteger.valueOf(Math.round((Double) arg)); + } + } else if (arg instanceof Integer) { + intArg = BigInteger.valueOf(arg.longValue()); + } else if (arg instanceof Long) { + intArg = BigInteger.valueOf((Long) arg); + } else { + intArg = (BigInteger) arg; + } + if (format.equals("int32")) { + if (intArg.compareTo(int32InclusiveMinimum) < 0 || intArg.compareTo(int32InclusiveMaximum) > 0) { + throw new ValidationException( + "Invalid value " + arg + " for format int32 at " + validationMetadata.pathToItem() + ); + } + } else if (format.equals("int64")) { + if (intArg.compareTo(int64InclusiveMinimum) < 0 || intArg.compareTo(int64InclusiveMaximum) > 0) { + throw new ValidationException( + "Invalid value " + arg + " for format int64 at " + validationMetadata.pathToItem() + ); + } + } + } else if (format.equals("float") || format.equals("double")) { + BigDecimal decimalArg; + if (arg instanceof Float) { + decimalArg = BigDecimal.valueOf(arg.doubleValue()); + } else if (arg instanceof Double) { + decimalArg = BigDecimal.valueOf((Double) arg); + } else { + decimalArg = (BigDecimal) arg; + } + if (format.equals("float")) { + if (decimalArg.compareTo(floatInclusiveMinimum) < 0 || decimalArg.compareTo(floatInclusiveMaximum) > 0 ){ + throw new ValidationException( + "Invalid value "+arg+" for format float at "+validationMetadata.pathToItem() + ); + } + } else { + if (decimalArg.compareTo(doubleInclusiveMinimum) < 0 || decimalArg.compareTo(doubleInclusiveMaximum) > 0 ){ + throw new ValidationException( + "Invalid value "+arg+" for format double at "+validationMetadata.pathToItem() + ); + } + } + } + } + + private static void validateStringFormat(String arg, ValidationMetadata validationMetadata, String format) throws ValidationException { + switch (format) { + case "uuid" -> { + try { + UUID.fromString(arg); + } catch (IllegalArgumentException e) { + throw new ValidationException( + "Value cannot be converted to a UUID. Invalid value " + + arg + " for format uuid at " + validationMetadata.pathToItem() + ); + } + } + case "number" -> { + try { + new BigDecimal(arg); + } catch (NumberFormatException e) { + throw new ValidationException( + "Value cannot be converted to a decimal. Invalid value " + + arg + " for format number at " + validationMetadata.pathToItem() + ); + } + } + case "date" -> { + try { + new CustomIsoparser().parseIsodate(arg); + } catch (DateTimeParseException e) { + throw new ValidationException( + "Value does not conform to the required ISO-8601 date format. " + + "Invalid value " + arg + " for format date at " + validationMetadata.pathToItem() + ); + } + } + case "date-time" -> { + try { + new CustomIsoparser().parseIsodatetime(arg); + } catch (DateTimeParseException e) { + throw new ValidationException( + "Value does not conform to the required ISO-8601 datetime format. " + + "Invalid value " + arg + " for format datetime at " + validationMetadata.pathToItem() + ); + } + } + } + } + + @Override + public @Nullable PathToSchemasMap validate( + ValidationData data + ) throws ValidationException { + var format = data.schema().format; + if (format == null) { + return null; + } + if (data.arg() instanceof Number numberArg) { + validateNumericFormat( + numberArg, + data.validationMetadata(), + format + ); + return null; + } else if (data.arg() instanceof String stringArg) { + validateStringFormat( + stringArg, + data.validationMetadata(), + format + ); + return null; + } + return null; + } +} diff --git a/src/main/resources/kotlin/src/main/kotlin/packagename/schemas/validation/FrozenList.hbs b/src/main/resources/kotlin/src/main/kotlin/packagename/schemas/validation/FrozenList.hbs new file mode 100644 index 00000000000..6711610f68a --- /dev/null +++ b/src/main/resources/kotlin/src/main/kotlin/packagename/schemas/validation/FrozenList.hbs @@ -0,0 +1,30 @@ +package {{{packageName}}}.schemas.validation; + +import java.util.AbstractList; +import java.util.ArrayList; +import java.util.Collection; +import java.util.List; + +public class FrozenList extends AbstractList { + /* + A frozen List + Once schema validation has been run, indexed access returns values of the correct type + If values were mutable, the types in those methods would not agree with returned values + */ + private final List list; + public FrozenList(Collection m) { + super(); + list = new ArrayList<>(m); + } + + @Override + public E get(int index) { + return list.get(index); + } + + @Override + public int size() { + return list.size(); + } +} + diff --git a/src/main/resources/kotlin/src/main/kotlin/packagename/schemas/validation/FrozenMap.hbs b/src/main/resources/kotlin/src/main/kotlin/packagename/schemas/validation/FrozenMap.hbs new file mode 100644 index 00000000000..827f423c112 --- /dev/null +++ b/src/main/resources/kotlin/src/main/kotlin/packagename/schemas/validation/FrozenMap.hbs @@ -0,0 +1,54 @@ +package {{{packageName}}}.schemas.validation; + +import org.checkerframework.checker.nullness.qual.KeyFor; +import {{{packageName}}}.exceptions.UnsetPropertyException; +import {{{packageName}}}.exceptions.InvalidAdditionalPropertyException; + +import java.util.AbstractMap; +import java.util.HashMap; +import java.util.HashSet; +import java.util.Map; +import java.util.Set; +import java.util.stream.Collectors; + +public class FrozenMap extends AbstractMap { + /* + A frozen Map + Once schema validation has been run, written accessor methods return values of the correct type + If values were mutable, the types in those methods would not agree with returned values + */ + private final Map map; + public FrozenMap(Map m) { + + super(); + map = new HashMap<>(m); + } + + protected V getOrThrow(String key) throws UnsetPropertyException { + if (containsKey(key)) { + return get(key); + } + throw new UnsetPropertyException(key+" is unset"); + } + + protected void throwIfKeyNotPresent(String key) throws UnsetPropertyException { + if (!containsKey(key)) { + throw new UnsetPropertyException(key+" is unset"); + } + } + + protected void throwIfKeyKnown(String key, Set requiredKeys, Set optionalKeys) throws InvalidAdditionalPropertyException { + Set knownKeys = new HashSet<>(); + knownKeys.addAll(requiredKeys); + knownKeys.addAll(optionalKeys); + MapUtils.throwIfKeyKnown(key, knownKeys, false); + } + + @Override + public Set> entrySet() { + return map.entrySet().stream() + .map(x -> new AbstractMap.SimpleEntry<>(x.getKey(), x.getValue())) + .collect(Collectors.toSet()); + } +} + diff --git a/src/main/resources/kotlin/src/main/kotlin/packagename/schemas/validation/IfValidator.hbs b/src/main/resources/kotlin/src/main/kotlin/packagename/schemas/validation/IfValidator.hbs new file mode 100644 index 00000000000..c9f1f79597c --- /dev/null +++ b/src/main/resources/kotlin/src/main/kotlin/packagename/schemas/validation/IfValidator.hbs @@ -0,0 +1,28 @@ +package {{{packageName}}}.schemas.validation; + +import {{{packageName}}}.exceptions.ValidationException; +import org.checkerframework.checker.nullness.qual.Nullable; + +public class IfValidator implements KeywordValidator { + @Override + public @Nullable PathToSchemasMap validate( + ValidationData data + ) throws ValidationException { + var ifSchema = data.schema().ifSchema; + if (ifSchema == null) { + return null; + } + if (data.ifPathToSchemas() == null) { + throw new ValidationException("Invalid type for ifPathToSchemas"); + } + /* + if is false use case + ifPathToSchemas == {} + no need to add any data to pathToSchemas + + if true, then true -> true for whole schema + so validate_then will add ifPathToSchemas data to pathToSchemas + */ + return null; + } +} diff --git a/src/main/resources/kotlin/src/main/kotlin/packagename/schemas/validation/IntegerEnumValidator.hbs b/src/main/resources/kotlin/src/main/kotlin/packagename/schemas/validation/IntegerEnumValidator.hbs new file mode 100644 index 00000000000..352afd6be56 --- /dev/null +++ b/src/main/resources/kotlin/src/main/kotlin/packagename/schemas/validation/IntegerEnumValidator.hbs @@ -0,0 +1,8 @@ +package {{{packageName}}}.schemas.validation; + +import {{{packageName}}}.configurations.SchemaConfiguration; +import {{{packageName}}}.exceptions.ValidationException; + +public interface IntegerEnumValidator { + int validate(EnumType arg, SchemaConfiguration configuration) throws ValidationException; +} \ No newline at end of file diff --git a/src/main/resources/kotlin/src/main/kotlin/packagename/schemas/validation/IntegerValueMethod.hbs b/src/main/resources/kotlin/src/main/kotlin/packagename/schemas/validation/IntegerValueMethod.hbs new file mode 100644 index 00000000000..5c5a734783f --- /dev/null +++ b/src/main/resources/kotlin/src/main/kotlin/packagename/schemas/validation/IntegerValueMethod.hbs @@ -0,0 +1,5 @@ +package {{{packageName}}}.schemas.validation; + +public interface IntegerValueMethod { + int value(); +} \ No newline at end of file diff --git a/src/main/resources/kotlin/src/main/kotlin/packagename/schemas/validation/ItemsValidator.hbs b/src/main/resources/kotlin/src/main/kotlin/packagename/schemas/validation/ItemsValidator.hbs new file mode 100644 index 00000000000..314bb5ee2dc --- /dev/null +++ b/src/main/resources/kotlin/src/main/kotlin/packagename/schemas/validation/ItemsValidator.hbs @@ -0,0 +1,45 @@ +package {{{packageName}}}.schemas.validation; + +import org.checkerframework.checker.nullness.qual.Nullable; +import {{{packageName}}}.exceptions.ValidationException; + +import java.util.ArrayList; +import java.util.List; + +public class ItemsValidator implements KeywordValidator { + @Override + public @Nullable PathToSchemasMap validate( + ValidationData data + ) throws ValidationException { + var items = data.schema().items; + if (items == null) { + return null; + } + if (!(data.arg() instanceof List listArg)) { + return null; + } + if (listArg.isEmpty()) { + return null; + } + PathToSchemasMap pathToSchemas = new PathToSchemasMap(); + int minIndex = data.schema().prefixItems != null ? data.schema().prefixItems.size() : 0; + JsonSchema itemsSchema = JsonSchemaFactory.getInstance(items); + for(int i = minIndex; i < listArg.size(); i++) { + List itemPathToItem = new ArrayList<>(data.validationMetadata().pathToItem()); + itemPathToItem.add(i); + ValidationMetadata itemValidationMetadata = new ValidationMetadata( + itemPathToItem, + data.validationMetadata().configuration(), + data.validationMetadata().validatedPathToSchemas(), + data.validationMetadata().seenClasses() + ); + if (itemValidationMetadata.validationRanEarlier(itemsSchema)) { + // todo add_deeper_validated_schemas + continue; + } + PathToSchemasMap otherPathToSchemas = JsonSchema.validate(itemsSchema, listArg.get(i), itemValidationMetadata); + pathToSchemas.update(otherPathToSchemas); + } + return pathToSchemas; + } +} diff --git a/src/main/resources/kotlin/src/main/kotlin/packagename/schemas/validation/JsonSchema.hbs b/src/main/resources/kotlin/src/main/kotlin/packagename/schemas/validation/JsonSchema.hbs new file mode 100644 index 00000000000..3ffb61a8eb7 --- /dev/null +++ b/src/main/resources/kotlin/src/main/kotlin/packagename/schemas/validation/JsonSchema.hbs @@ -0,0 +1,499 @@ +package {{{packageName}}}.schemas.validation; + +import org.checkerframework.checker.nullness.qual.Nullable; +import {{{packageName}}}.configurations.SchemaConfiguration; +import {{{packageName}}}.exceptions.ValidationException; + +import java.math.BigDecimal; +import java.time.LocalDate; +import java.time.ZonedDateTime; +import java.util.ArrayList; +import java.util.LinkedHashMap; +import java.util.LinkedHashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; +import java.util.UUID; +import java.util.regex.Pattern; + +public abstract class JsonSchema { + public final @Nullable Set> type; + public final @Nullable String format; + public final @Nullable Class> items; + public final @Nullable Map>> properties; + public final @Nullable Set required; + public final @Nullable Number exclusiveMaximum; + public final @Nullable Number exclusiveMinimum; + public final @Nullable Integer maxItems; + public final @Nullable Integer minItems; + public final @Nullable Integer maxLength; + public final @Nullable Integer minLength; + public final @Nullable Integer maxProperties; + public final @Nullable Integer minProperties; + public final @Nullable Number maximum; + public final @Nullable Number minimum; + public final @Nullable BigDecimal multipleOf; + public final @Nullable Class> additionalProperties; + public final @Nullable List>> allOf; + public final @Nullable List>> anyOf; + public final @Nullable List>> oneOf; + public final @Nullable Class> not; + public final @Nullable Boolean uniqueItems; + public final @Nullable Set<@Nullable Object> enumValues; + public final @Nullable Pattern pattern; + public final @Nullable Object defaultValue; + public final boolean defaultValueSet; + public final @Nullable Object constValue; + public final boolean constValueSet; + public final @Nullable Class> contains; + public final @Nullable Integer maxContains; + public final @Nullable Integer minContains; + public final @Nullable Class> propertyNames; + public final @Nullable Map> dependentRequired; + public final @Nullable Map>> dependentSchemas; + public final @Nullable Map>> patternProperties; + public final @Nullable List>> prefixItems; + public final @Nullable Class> ifSchema; + public final @Nullable Class> then; + public final @Nullable Class> elseSchema; + public final @Nullable Class> unevaluatedItems; + public final @Nullable Class> unevaluatedProperties; + private final LinkedHashMap keywordToValidator; + + protected JsonSchema(JsonSchemaInfo jsonSchemaInfo) { + LinkedHashMap keywordToValidator = new LinkedHashMap<>(); + this.type = jsonSchemaInfo.type; + if (this.type != null) { + keywordToValidator.put("type", new TypeValidator()); + } + this.format = jsonSchemaInfo.format; + if (this.format != null) { + keywordToValidator.put("format", new FormatValidator()); + } + this.items = jsonSchemaInfo.items; + if (this.items != null) { + keywordToValidator.put("items", new ItemsValidator()); + } + this.properties = jsonSchemaInfo.properties; + if (this.properties != null) { + keywordToValidator.put("properties", new PropertiesValidator()); + } + this.required = jsonSchemaInfo.required; + if (this.required != null) { + keywordToValidator.put("required", new RequiredValidator()); + } + this.exclusiveMaximum = jsonSchemaInfo.exclusiveMaximum; + if (this.exclusiveMaximum != null) { + keywordToValidator.put("exclusiveMaximum", new ExclusiveMaximumValidator()); + } + this.exclusiveMinimum = jsonSchemaInfo.exclusiveMinimum; + if (this.exclusiveMinimum != null) { + keywordToValidator.put("exclusiveMinimum", new ExclusiveMinimumValidator()); + } + this.maxItems = jsonSchemaInfo.maxItems; + if (this.maxItems != null) { + keywordToValidator.put("maxItems", new MaxItemsValidator()); + } + this.minItems = jsonSchemaInfo.minItems; + if (this.minItems != null) { + keywordToValidator.put("minItems", new MinItemsValidator()); + } + this.maxLength = jsonSchemaInfo.maxLength; + if (this.maxLength != null) { + keywordToValidator.put("maxLength", new MaxLengthValidator()); + } + this.minLength = jsonSchemaInfo.minLength; + if (this.minLength != null) { + keywordToValidator.put("minLength", new MinLengthValidator()); + } + this.maxProperties = jsonSchemaInfo.maxProperties; + if (this.maxProperties != null) { + keywordToValidator.put("maxProperties", new MaxPropertiesValidator()); + } + this.minProperties = jsonSchemaInfo.minProperties; + if (this.minProperties != null) { + keywordToValidator.put("minProperties", new MinPropertiesValidator()); + } + this.maximum = jsonSchemaInfo.maximum; + if (this.maximum != null) { + keywordToValidator.put("maximum", new MaximumValidator()); + } + this.minimum = jsonSchemaInfo.minimum; + if (this.minimum != null) { + keywordToValidator.put("minimum", new MinimumValidator()); + } + this.multipleOf = jsonSchemaInfo.multipleOf; + if (this.multipleOf != null) { + keywordToValidator.put("multipleOf", new MultipleOfValidator()); + } + this.additionalProperties = jsonSchemaInfo.additionalProperties; + if (this.additionalProperties != null) { + keywordToValidator.put("additionalProperties", new AdditionalPropertiesValidator()); + } + this.allOf = jsonSchemaInfo.allOf; + if (this.allOf != null) { + keywordToValidator.put("allOf", new AllOfValidator()); + } + this.anyOf = jsonSchemaInfo.anyOf; + if (this.anyOf != null) { + keywordToValidator.put("anyOf", new AnyOfValidator()); + } + this.oneOf = jsonSchemaInfo.oneOf; + if (this.oneOf != null) { + keywordToValidator.put("oneOf", new OneOfValidator()); + } + this.not = jsonSchemaInfo.not; + if (this.not != null) { + keywordToValidator.put("not", new NotValidator()); + } + this.uniqueItems = jsonSchemaInfo.uniqueItems; + if (this.uniqueItems != null) { + keywordToValidator.put("uniqueItems", new UniqueItemsValidator()); + } + this.enumValues = jsonSchemaInfo.enumValues; + if (this.enumValues != null) { + keywordToValidator.put("enum", new EnumValidator()); + } + this.pattern = jsonSchemaInfo.pattern; + if (this.pattern != null) { + keywordToValidator.put("pattern", new PatternValidator()); + } + this.defaultValue = jsonSchemaInfo.defaultValue; + this.defaultValueSet = jsonSchemaInfo.defaultValueSet; + this.constValue = jsonSchemaInfo.constValue; + this.constValueSet = jsonSchemaInfo.constValueSet; + if (this.constValueSet) { + keywordToValidator.put("const", new ConstValidator()); + } + this.contains = jsonSchemaInfo.contains; + if (this.contains != null) { + keywordToValidator.put("contains", new ContainsValidator()); + } + this.maxContains = jsonSchemaInfo.maxContains; + if (this.maxContains != null) { + keywordToValidator.put("maxContains", new MaxContainsValidator()); + } + this.minContains = jsonSchemaInfo.minContains; + if (this.minContains != null) { + keywordToValidator.put("minContains", new MinContainsValidator()); + } + this.propertyNames = jsonSchemaInfo.propertyNames; + if (this.propertyNames != null) { + keywordToValidator.put("propertyNames", new PropertyNamesValidator()); + } + this.dependentRequired = jsonSchemaInfo.dependentRequired; + if (this.dependentRequired != null) { + keywordToValidator.put("dependentRequired", new DependentRequiredValidator()); + } + this.dependentSchemas = jsonSchemaInfo.dependentSchemas; + if (this.dependentSchemas != null) { + keywordToValidator.put("dependentSchemas", new DependentSchemasValidator()); + } + this.patternProperties = jsonSchemaInfo.patternProperties; + if (this.patternProperties != null) { + keywordToValidator.put("patternProperties", new PatternPropertiesValidator()); + } + this.prefixItems = jsonSchemaInfo.prefixItems; + if (this.prefixItems != null) { + keywordToValidator.put("prefixItems", new PrefixItemsValidator()); + } + this.ifSchema = jsonSchemaInfo.ifSchema; + if (this.ifSchema != null) { + keywordToValidator.put("if", new IfValidator()); + } + this.then = jsonSchemaInfo.then; + if (this.then != null) { + keywordToValidator.put("then", new ThenValidator()); + } + this.elseSchema = jsonSchemaInfo.elseSchema; + if (this.elseSchema != null) { + keywordToValidator.put("else", new ElseValidator()); + } + this.unevaluatedItems = jsonSchemaInfo.unevaluatedItems; + if (this.unevaluatedItems != null) { + keywordToValidator.put("unevaluatedItems", new UnevaluatedItemsValidator()); + } + this.unevaluatedProperties = jsonSchemaInfo.unevaluatedProperties; + if (this.unevaluatedProperties != null) { + keywordToValidator.put("unevaluatedProperties", new UnevaluatedPropertiesValidator()); + } + 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; + + private List getContainsPathToSchemas( + @Nullable Object arg, + ValidationMetadata validationMetadata + ) { + if (!(arg instanceof List listArg) || contains == null) { + return new ArrayList<>(); + } + JsonSchema containsSchema = JsonSchemaFactory.getInstance(contains); + @Nullable List containsPathToSchemas = new ArrayList<>(); + for(int i = 0; i < listArg.size(); i++) { + PathToSchemasMap thesePathToSchemas = new PathToSchemasMap(); + List itemPathToItem = new ArrayList<>(validationMetadata.pathToItem()); + itemPathToItem.add(i); + ValidationMetadata itemValidationMetadata = new ValidationMetadata( + itemPathToItem, + validationMetadata.configuration(), + validationMetadata.validatedPathToSchemas(), + validationMetadata.seenClasses() + ); + if (itemValidationMetadata.validationRanEarlier(containsSchema)) { + // todo add_deeper_validated_schemas + containsPathToSchemas.add(thesePathToSchemas); + continue; + } + + try { + PathToSchemasMap otherPathToSchemas = JsonSchema.validate( + containsSchema, listArg.get(i), itemValidationMetadata); + containsPathToSchemas.add(otherPathToSchemas); + } catch (ValidationException ignored) {} + } + return containsPathToSchemas; + } + + private PathToSchemasMap getPatternPropertiesPathToSchemas( + @Nullable Object arg, + ValidationMetadata validationMetadata + ) throws ValidationException { + if (!(arg instanceof Map mapArg) || patternProperties == null) { + return new PathToSchemasMap(); + } + PathToSchemasMap pathToSchemas = new PathToSchemasMap(); + 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"); + } + List propPathToItem = new ArrayList<>(validationMetadata.pathToItem()); + propPathToItem.add(key); + ValidationMetadata propValidationMetadata = new ValidationMetadata( + propPathToItem, + validationMetadata.configuration(), + validationMetadata.validatedPathToSchemas(), + validationMetadata.seenClasses() + ); + for (Map.Entry>> patternPropEntry: patternProperties.entrySet()) { + if (!patternPropEntry.getKey().matcher(key).find()) { + continue; + } + + Class> patternPropClass = patternPropEntry.getValue(); + JsonSchema patternPropSchema = JsonSchemaFactory.getInstance(patternPropClass); + PathToSchemasMap otherPathToSchemas = JsonSchema.validate(patternPropSchema, entry.getValue(), propValidationMetadata); + pathToSchemas.update(otherPathToSchemas); + } + } + return pathToSchemas; + } + + private PathToSchemasMap getIfPathToSchemas( + @Nullable Object arg, + ValidationMetadata validationMetadata + ) { + if (ifSchema == null) { + return new PathToSchemasMap(); + } + JsonSchema ifSchemaInstance = JsonSchemaFactory.getInstance(ifSchema); + PathToSchemasMap pathToSchemas = new PathToSchemasMap(); + try { + var otherPathToSchemas = JsonSchema.validate(ifSchemaInstance, arg, validationMetadata); + pathToSchemas.update(otherPathToSchemas); + } catch (ValidationException ignored) {} + return pathToSchemas; + } + + public static PathToSchemasMap validate( + JsonSchema jsonSchema, + @Nullable Object arg, + ValidationMetadata validationMetadata + ) throws ValidationException { + LinkedHashSet disabledKeywords = validationMetadata.configuration().disabledKeywordFlags().getKeywords(); + PathToSchemasMap pathToSchemas = new PathToSchemasMap(); + LinkedHashMap thisKeywordToValidator = jsonSchema.keywordToValidator; + @Nullable List containsPathToSchemas = null; + if (thisKeywordToValidator.containsKey("contains")) { + containsPathToSchemas = jsonSchema.getContainsPathToSchemas(arg, validationMetadata); + } + @Nullable PathToSchemasMap patternPropertiesPathToSchemas = null; + if (thisKeywordToValidator.containsKey("patternProperties")) { + patternPropertiesPathToSchemas = jsonSchema.getPatternPropertiesPathToSchemas(arg, validationMetadata); + } + @Nullable PathToSchemasMap ifPathToSchemas = null; + if (thisKeywordToValidator.containsKey("if")) { + ifPathToSchemas = jsonSchema.getIfPathToSchemas(arg, validationMetadata); + } + @Nullable PathToSchemasMap knownPathToSchemas = null; + for (Map.Entry entry: thisKeywordToValidator.entrySet()) { + String jsonKeyword = entry.getKey(); + if (disabledKeywords.contains(jsonKeyword)) { + boolean typeIntegerUseCase = jsonKeyword.equals("format") && "int".equals(jsonSchema.format); + if (!typeIntegerUseCase) { + continue; + } + } + if ("unevaluatedItems".equals(jsonKeyword) || "unevaluatedProperties".equals(jsonKeyword)) { + knownPathToSchemas = pathToSchemas; + } + KeywordValidator validator = entry.getValue(); + ValidationData data = new ValidationData( + jsonSchema, + arg, + validationMetadata, + containsPathToSchemas, + patternPropertiesPathToSchemas, + ifPathToSchemas, + knownPathToSchemas + ); + @Nullable PathToSchemasMap otherPathToSchemas = validator.validate(data); + if (otherPathToSchemas == null) { + continue; + } + pathToSchemas.update(otherPathToSchemas); + } + List pathToItem = validationMetadata.pathToItem(); + if (!pathToSchemas.containsKey(pathToItem)) { + pathToSchemas.put(validationMetadata.pathToItem(), new LinkedHashMap<>()); + } + @Nullable LinkedHashMap, Nothing?> schemas = pathToSchemas.get(pathToItem); + if (schemas != null) { + schemas.put(jsonSchema, null); + } + return pathToSchemas; + } + + protected String castToAllowedTypes(String arg, List pathToItem, Set> pathSet) { + pathSet.add(pathToItem); + return arg; + } + + protected Boolean castToAllowedTypes(Boolean arg, List pathToItem, Set> pathSet) { + pathSet.add(pathToItem); + return arg; + } + + protected Number castToAllowedTypes(Number arg, List pathToItem, Set> pathSet) { + pathSet.add(pathToItem); + return arg; + } + + protected Nothing? castToAllowedTypes(Nothing? arg, List pathToItem, Set> pathSet) { + pathSet.add(pathToItem); + return arg; + } + + protected List castToAllowedTypes(List arg, List pathToItem, Set> pathSet) throws ValidationException { + pathSet.add(pathToItem); + List<@Nullable Object> argFixed = new ArrayList<>(); + int i =0; + for (Object item: arg) { + List newPathToItem = new ArrayList<>(pathToItem); + newPathToItem.add(i); + Object fixedVal = castToAllowedObjectTypes(item, newPathToItem, pathSet); + argFixed.add(fixedVal); + i += 1; + } + return argFixed; + } + + 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 ValidationException("Invalid non-string key value"); + } + Object val = entry.getValue(); + List newPathToItem = new ArrayList<>(pathToItem); + newPathToItem.add(key); + Object fixedVal = castToAllowedObjectTypes(val, newPathToItem, pathSet); + argFixed.put(key, fixedVal); + } + return argFixed; + } + + private @Nullable Object castToAllowedObjectTypes(@Nullable Object arg, List pathToItem, Set> pathSet) throws ValidationException { + if (arg == null) { + return castToAllowedTypes((Nothing?) null, pathToItem, pathSet); + } else if (arg instanceof String) { + return castToAllowedTypes((String) arg, pathToItem, pathSet); + } else if (arg instanceof Map) { + pathSet.add(pathToItem); + return castToAllowedTypes((Map) arg, pathToItem, pathSet); + } else if (arg instanceof Boolean) { + return castToAllowedTypes((Boolean) arg, pathToItem, pathSet); + } else if (arg instanceof Integer) { + return castToAllowedTypes((Number) arg, pathToItem, pathSet); + } else if (arg instanceof Long) { + return castToAllowedTypes((Number) arg, pathToItem, pathSet); + } else if (arg instanceof Float) { + return castToAllowedTypes((Number) arg, pathToItem, pathSet); + } else if (arg instanceof Double) { + return castToAllowedTypes((Number) arg, pathToItem, pathSet); + } else if (arg instanceof List) { + return castToAllowedTypes((List) arg, pathToItem, pathSet); + } else if (arg instanceof ZonedDateTime) { + return castToAllowedTypes(arg.toString(), pathToItem, pathSet); + } else if (arg instanceof LocalDate) { + return castToAllowedTypes(arg.toString(), pathToItem, pathSet); + } else if (arg instanceof UUID) { + return castToAllowedTypes(arg.toString(), pathToItem, pathSet); + } else { + Class argClass = arg.getClass(); + throw new ValidationException("Invalid type passed in for input="+arg+" type="+argClass); + } + } + + public Nothing? getNewInstance(Nothing? arg, List pathToItem, PathToSchemasMap pathToSchemas) { + return arg; + } + + public boolean getNewInstance(boolean arg, List pathToItem, PathToSchemasMap pathToSchemas) { + return arg; + } + + public Number getNewInstance(Number arg, List pathToItem, PathToSchemasMap pathToSchemas) { + return arg; + } + + public String getNewInstance(String arg, List pathToItem, PathToSchemasMap pathToSchemas) { + return arg; + } + + 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); + pathToSchemasMap.update(otherPathToSchemas); + for (var schemas: pathToSchemasMap.values()) { + JsonSchema firstSchema = schemas.entrySet().iterator().next().getKey(); + schemas.clear(); + schemas.put(firstSchema, null); + } + pathSet.removeAll(pathToSchemasMap.keySet()); + if (!pathSet.isEmpty()) { + LinkedHashMap, Nothing?> unsetAnyTypeSchema = new LinkedHashMap<>(); + unsetAnyTypeSchema.put(UnsetAnyTypeJsonSchema.UnsetAnyTypeJsonSchema1.getInstance(), null); + for (List pathToItem: pathSet) { + pathToSchemasMap.put(pathToItem, unsetAnyTypeSchema); + } + } + return pathToSchemasMap; + } + + public static String getClass(@Nullable Object arg) { + if (arg == null) { + return Nothing?.class.getSimpleName(); + } else { + return arg.getClass().getSimpleName(); + } + } + // todo add bytes and FileIO +} \ No newline at end of file diff --git a/src/main/resources/kotlin/src/main/kotlin/packagename/schemas/validation/JsonSchemaFactory.hbs b/src/main/resources/kotlin/src/main/kotlin/packagename/schemas/validation/JsonSchemaFactory.hbs new file mode 100644 index 00000000000..ee529fb4fa1 --- /dev/null +++ b/src/main/resources/kotlin/src/main/kotlin/packagename/schemas/validation/JsonSchemaFactory.hbs @@ -0,0 +1,32 @@ +package {{{packageName}}}.schemas.validation; + +import org.checkerframework.checker.nullness.qual.NonNull; +import org.checkerframework.checker.nullness.qual.Nullable; + +import java.lang.reflect.InvocationTargetException; +import java.lang.reflect.Method; +import java.util.HashMap; +import java.util.Map; + + +public class JsonSchemaFactory { + static Map>, JsonSchema> classToInstance = new HashMap<>(); + + public static > V getInstance(Class schemaCls) { + @Nullable JsonSchema cacheInst = classToInstance.get(schemaCls); + if (cacheInst != null) { + assert schemaCls.isInstance(cacheInst); + return schemaCls.cast(cacheInst); + } + try { + Method method = schemaCls.getMethod("getInstance"); + @SuppressWarnings("nullness") @NonNull Object obj = method.invoke(null); + assert schemaCls.isInstance(obj); + V inst = schemaCls.cast(obj); + classToInstance.put(schemaCls, inst); + return inst; + } catch (NoSuchMethodException | IllegalAccessException | InvocationTargetException e) { + throw new RuntimeException(e); + } + } +} \ No newline at end of file diff --git a/src/main/resources/kotlin/src/main/kotlin/packagename/schemas/validation/JsonSchemaInfo.hbs b/src/main/resources/kotlin/src/main/kotlin/packagename/schemas/validation/JsonSchemaInfo.hbs new file mode 100644 index 00000000000..0d7527947c8 --- /dev/null +++ b/src/main/resources/kotlin/src/main/kotlin/packagename/schemas/validation/JsonSchemaInfo.hbs @@ -0,0 +1,210 @@ +package {{{packageName}}}.schemas.validation; +import org.checkerframework.checker.nullness.qual.Nullable; + +import java.math.BigDecimal; +import java.util.List; +import java.util.Map; +import java.util.Set; +import java.util.regex.Pattern; + +public class JsonSchemaInfo { + public @Nullable Set> type = null; + public JsonSchemaInfo type(Set> type) { + this.type = type; + return this; + } + public @Nullable String format = null; + public JsonSchemaInfo format(String format) { + this.format = format; + return this; + } + public @Nullable Class> items = null; + public JsonSchemaInfo items(Class> items) { + this.items = items; + return this; + } + public @Nullable Map>> properties = null; + public JsonSchemaInfo properties(Map>> properties) { + this.properties = properties; + return this; + } + public @Nullable Set required = null; + public JsonSchemaInfo required(Set required) { + this.required = required; + return this; + } + public @Nullable Number exclusiveMaximum = null; + public JsonSchemaInfo exclusiveMaximum(Number exclusiveMaximum) { + this.exclusiveMaximum = exclusiveMaximum; + return this; + } + public @Nullable Number exclusiveMinimum = null; + public JsonSchemaInfo exclusiveMinimum(Number exclusiveMinimum) { + this.exclusiveMinimum = exclusiveMinimum; + return this; + } + public @Nullable Integer maxItems = null; + public JsonSchemaInfo maxItems(Integer maxItems) { + this.maxItems = maxItems; + return this; + } + public @Nullable Integer minItems = null; + public JsonSchemaInfo minItems(Integer minItems) { + this.minItems = minItems; + return this; + } + public @Nullable Integer maxLength = null; + public JsonSchemaInfo maxLength(Integer maxLength) { + this.maxLength = maxLength; + return this; + } + public @Nullable Integer minLength = null; + public JsonSchemaInfo minLength(Integer minLength) { + this.minLength = minLength; + return this; + } + public @Nullable Integer maxProperties = null; + public JsonSchemaInfo maxProperties(Integer maxProperties) { + this.maxProperties = maxProperties; + return this; + } + public @Nullable Integer minProperties = null; + public JsonSchemaInfo minProperties(Integer minProperties) { + this.minProperties = minProperties; + return this; + } + public @Nullable Number maximum = null; + public JsonSchemaInfo maximum(Number maximum) { + this.maximum = maximum; + return this; + } + public @Nullable Number minimum = null; + public JsonSchemaInfo minimum(Number minimum) { + this.minimum = minimum; + return this; + } + public @Nullable BigDecimal multipleOf = null; + public JsonSchemaInfo multipleOf(BigDecimal multipleOf) { + this.multipleOf = multipleOf; + return this; + } + public @Nullable Class> additionalProperties; + public JsonSchemaInfo additionalProperties(Class> additionalProperties) { + this.additionalProperties = additionalProperties; + return this; + } + public @Nullable List>> allOf = null; + public JsonSchemaInfo allOf(List>> allOf) { + this.allOf = allOf; + return this; + } + public @Nullable List>> anyOf = null; + public JsonSchemaInfo anyOf(List>> anyOf) { + this.anyOf = anyOf; + return this; + } + public @Nullable List>> oneOf = null; + public JsonSchemaInfo oneOf(List>> oneOf) { + this.oneOf = oneOf; + return this; + } + public @Nullable Class> not = null; + public JsonSchemaInfo not(Class> not) { + this.not = not; + return this; + } + public @Nullable Boolean uniqueItems = null; + public JsonSchemaInfo uniqueItems(Boolean uniqueItems) { + this.uniqueItems = uniqueItems; + return this; + } + public @Nullable Set<@Nullable Object> enumValues = null; + public JsonSchemaInfo enumValues(Set<@Nullable Object> enumValues) { + this.enumValues = enumValues; + return this; + } + public @Nullable Pattern pattern = null; + public JsonSchemaInfo pattern(Pattern pattern) { + this.pattern = pattern; + return this; + } + public @Nullable Object defaultValue = null; + public boolean defaultValueSet = false; + public JsonSchemaInfo defaultValue(@Nullable Object defaultValue) { + this.defaultValue = defaultValue; + this.defaultValueSet = true; + return this; + } + public @Nullable Object constValue = null; + public boolean constValueSet = false; + public JsonSchemaInfo constValue(@Nullable Object constValue) { + this.constValue = constValue; + this.constValueSet = true; + return this; + } + public @Nullable Class> contains = null; + public JsonSchemaInfo contains(Class> contains) { + this.contains = contains; + return this; + } + public @Nullable Integer maxContains = null; + public JsonSchemaInfo maxContains(Integer maxContains) { + this.maxContains = maxContains; + return this; + } + public @Nullable Integer minContains = null; + public JsonSchemaInfo minContains(Integer minContains) { + this.minContains = minContains; + return this; + } + public @Nullable Class> propertyNames = null; + public JsonSchemaInfo propertyNames(Class> propertyNames) { + this.propertyNames = propertyNames; + return this; + } + public @Nullable Map> dependentRequired = null; + public JsonSchemaInfo dependentRequired(Map> dependentRequired) { + this.dependentRequired = dependentRequired; + return this; + } + public @Nullable Map>> dependentSchemas = null; + public JsonSchemaInfo dependentSchemas(Map>> dependentSchemas) { + this.dependentSchemas = dependentSchemas; + return this; + } + public @Nullable Map>> patternProperties = null; + public JsonSchemaInfo patternProperties(Map>> patternProperties) { + this.patternProperties = patternProperties; + return this; + } + public @Nullable List>> prefixItems = null; + public JsonSchemaInfo prefixItems(List>> prefixItems) { + this.prefixItems = prefixItems; + return this; + } + public @Nullable Class> ifSchema = null; + public JsonSchemaInfo ifSchema(Class> ifSchema) { + this.ifSchema = ifSchema; + return this; + } + public @Nullable Class> then = null; + public JsonSchemaInfo then(Class> then) { + this.then = then; + return this; + } + public @Nullable Class> elseSchema = null; + public JsonSchemaInfo elseSchema(Class> elseSchema) { + this.elseSchema = elseSchema; + return this; + } + public @Nullable Class> unevaluatedItems = null; + public JsonSchemaInfo unevaluatedItems(Class> unevaluatedItems) { + this.unevaluatedItems = unevaluatedItems; + return this; + } + public @Nullable Class> unevaluatedProperties = null; + public JsonSchemaInfo unevaluatedProperties(Class> unevaluatedProperties) { + this.unevaluatedProperties = unevaluatedProperties; + return this; + } +} \ No newline at end of file diff --git a/src/main/resources/kotlin/src/main/kotlin/packagename/schemas/validation/KeywordEntry.hbs b/src/main/resources/kotlin/src/main/kotlin/packagename/schemas/validation/KeywordEntry.hbs new file mode 100644 index 00000000000..7f5a8c70c02 --- /dev/null +++ b/src/main/resources/kotlin/src/main/kotlin/packagename/schemas/validation/KeywordEntry.hbs @@ -0,0 +1,10 @@ +package {{{packageName}}}.schemas.validation; + +import java.util.AbstractMap; + +@SuppressWarnings("serial") +public class KeywordEntry extends AbstractMap.SimpleEntry { + public KeywordEntry(String key, KeywordValidator value) { + super(key, value); + } +} diff --git a/src/main/resources/kotlin/src/main/kotlin/packagename/schemas/validation/KeywordValidator.hbs b/src/main/resources/kotlin/src/main/kotlin/packagename/schemas/validation/KeywordValidator.hbs new file mode 100644 index 00000000000..b95cc5d5fc2 --- /dev/null +++ b/src/main/resources/kotlin/src/main/kotlin/packagename/schemas/validation/KeywordValidator.hbs @@ -0,0 +1,11 @@ +package {{{packageName}}}.schemas.validation; + +import {{{packageName}}}.exceptions.ValidationException; +import org.checkerframework.checker.nullness.qual.Nullable; + +@FunctionalInterface +public interface KeywordValidator { + @Nullable PathToSchemasMap validate( + ValidationData data + ) throws ValidationException; +} \ No newline at end of file diff --git a/src/main/resources/kotlin/src/main/kotlin/packagename/schemas/validation/LengthValidator.hbs b/src/main/resources/kotlin/src/main/kotlin/packagename/schemas/validation/LengthValidator.hbs new file mode 100644 index 00000000000..08bb770ae29 --- /dev/null +++ b/src/main/resources/kotlin/src/main/kotlin/packagename/schemas/validation/LengthValidator.hbs @@ -0,0 +1,16 @@ +package {{{packageName}}}.schemas.validation; + +import java.text.BreakIterator; + +public abstract class LengthValidator { + protected int getLength(String text) { + int graphemeCount = 0; + BreakIterator graphemeCounter = BreakIterator + .getCharacterInstance(); + graphemeCounter.setText(text); + while (graphemeCounter.next() != BreakIterator.DONE) { + graphemeCount++; + } + return graphemeCount; + } +} diff --git a/src/main/resources/kotlin/src/main/kotlin/packagename/schemas/validation/ListMaker.hbs b/src/main/resources/kotlin/src/main/kotlin/packagename/schemas/validation/ListMaker.hbs new file mode 100644 index 00000000000..bda699db04e --- /dev/null +++ b/src/main/resources/kotlin/src/main/kotlin/packagename/schemas/validation/ListMaker.hbs @@ -0,0 +1,20 @@ +package {{{packageName}}}.schemas.validation; + +import java.util.ArrayList; +import java.util.Arrays; +import java.util.List; + +public class ListMaker { + /** + * A builder for lists that allows in null values + * Schema tests + doc code samples need it + * @param entries items to add + * @return the output map + * @param value type + */ + @SafeVarargs + @SuppressWarnings("varargs") + public static List makeList(E... entries) { + return new ArrayList<>(Arrays.stream(entries).toList()); + } +} \ No newline at end of file diff --git a/src/main/resources/kotlin/src/main/kotlin/packagename/schemas/validation/ListSchemaValidator.hbs b/src/main/resources/kotlin/src/main/kotlin/packagename/schemas/validation/ListSchemaValidator.hbs new file mode 100644 index 00000000000..90408f24eee --- /dev/null +++ b/src/main/resources/kotlin/src/main/kotlin/packagename/schemas/validation/ListSchemaValidator.hbs @@ -0,0 +1,12 @@ +package {{{packageName}}}.schemas.validation; + +import {{{packageName}}}.configurations.SchemaConfiguration; +import {{{packageName}}}.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; +} \ No newline at end of file diff --git a/src/main/resources/kotlin/src/main/kotlin/packagename/schemas/validation/LongEnumValidator.hbs b/src/main/resources/kotlin/src/main/kotlin/packagename/schemas/validation/LongEnumValidator.hbs new file mode 100644 index 00000000000..f5045ca0e94 --- /dev/null +++ b/src/main/resources/kotlin/src/main/kotlin/packagename/schemas/validation/LongEnumValidator.hbs @@ -0,0 +1,8 @@ +package {{{packageName}}}.schemas.validation; + +import {{{packageName}}}.configurations.SchemaConfiguration; +import {{{packageName}}}.exceptions.ValidationException; + +public interface LongEnumValidator { + long validate(EnumType arg, SchemaConfiguration configuration) throws ValidationException; +} \ No newline at end of file diff --git a/src/main/resources/kotlin/src/main/kotlin/packagename/schemas/validation/LongValueMethod.hbs b/src/main/resources/kotlin/src/main/kotlin/packagename/schemas/validation/LongValueMethod.hbs new file mode 100644 index 00000000000..c558ddb4ec8 --- /dev/null +++ b/src/main/resources/kotlin/src/main/kotlin/packagename/schemas/validation/LongValueMethod.hbs @@ -0,0 +1,5 @@ +package {{{packageName}}}.schemas.validation; + +public interface LongValueMethod { + long value(); +} \ No newline at end of file diff --git a/src/main/resources/kotlin/src/main/kotlin/packagename/schemas/validation/MapSchemaValidator.hbs b/src/main/resources/kotlin/src/main/kotlin/packagename/schemas/validation/MapSchemaValidator.hbs new file mode 100644 index 00000000000..3926cf38ca8 --- /dev/null +++ b/src/main/resources/kotlin/src/main/kotlin/packagename/schemas/validation/MapSchemaValidator.hbs @@ -0,0 +1,13 @@ +package {{{packageName}}}.schemas.validation; + +import {{{packageName}}}.configurations.SchemaConfiguration; +import {{{packageName}}}.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; +} \ No newline at end of file diff --git a/src/main/resources/kotlin/src/main/kotlin/packagename/schemas/validation/MapUtils.hbs b/src/main/resources/kotlin/src/main/kotlin/packagename/schemas/validation/MapUtils.hbs new file mode 100644 index 00000000000..17ef79f4e6d --- /dev/null +++ b/src/main/resources/kotlin/src/main/kotlin/packagename/schemas/validation/MapUtils.hbs @@ -0,0 +1,37 @@ +package {{{packageName}}}.schemas.validation; + +import {{{packageName}}}.exceptions.InvalidAdditionalPropertyException; + +import java.util.HashMap; +import java.util.Map; +import java.util.Set; + +public class MapUtils { + /** + * A builder for maps that allows in null values + * Schema tests + doc code samples need it + * @param entries items to add + * @return the output map + * @param key type + * @param value type + */ + @SafeVarargs + @SuppressWarnings("varargs") + public static Map makeMap(Map.Entry... entries) { + Map map = new HashMap<>(); + for (Map.Entry entry : entries) { + map.put(entry.getKey(), entry.getValue()); + } + return map; + } + + public static void throwIfKeyKnown(String key, Set knownKeys, boolean setting) throws InvalidAdditionalPropertyException { + if (knownKeys.contains(key)) { + String verb = "getting"; + if (setting) { + verb = "setting"; + } + throw new InvalidAdditionalPropertyException ("The known key " + key + " may not be passed in when "+verb+" an additional property"); + } + } +} \ No newline at end of file diff --git a/src/main/resources/kotlin/src/main/kotlin/packagename/schemas/validation/MaxContainsValidator.hbs b/src/main/resources/kotlin/src/main/kotlin/packagename/schemas/validation/MaxContainsValidator.hbs new file mode 100644 index 00000000000..9cd76afd2ef --- /dev/null +++ b/src/main/resources/kotlin/src/main/kotlin/packagename/schemas/validation/MaxContainsValidator.hbs @@ -0,0 +1,32 @@ +package {{{packageName}}}.schemas.validation; + +import org.checkerframework.checker.nullness.qual.Nullable; +import {{{packageName}}}.exceptions.ValidationException; + +import java.util.List; + +public class MaxContainsValidator implements KeywordValidator { + @Override + public @Nullable PathToSchemasMap validate( + ValidationData data + ) throws ValidationException { + var maxContains = data.schema().maxContains; + if (maxContains == null) { + return null; + } + if (!(data.arg() instanceof List)) { + return null; + } + var containsPathToSchemas = data.containsPathToSchemas(); + if (containsPathToSchemas == null) { + return null; + } + if (containsPathToSchemas.size() > maxContains) { + throw new ValidationException( + "Validation failed for maxContains keyword in class="+data.schema().getClass()+ + " at pathToItem="+data.validationMetadata().pathToItem()+". Too many items validated to the contains schema." + ); + } + return null; + } +} \ No newline at end of file diff --git a/src/main/resources/kotlin/src/main/kotlin/packagename/schemas/validation/MaxItemsValidator.hbs b/src/main/resources/kotlin/src/main/kotlin/packagename/schemas/validation/MaxItemsValidator.hbs new file mode 100644 index 00000000000..500b858fc52 --- /dev/null +++ b/src/main/resources/kotlin/src/main/kotlin/packagename/schemas/validation/MaxItemsValidator.hbs @@ -0,0 +1,25 @@ +package {{{packageName}}}.schemas.validation; + +import {{{packageName}}}.exceptions.ValidationException; +import org.checkerframework.checker.nullness.qual.Nullable; + +import java.util.List; + +public class MaxItemsValidator implements KeywordValidator { + @Override + public @Nullable PathToSchemasMap validate( + ValidationData data + ) throws ValidationException { + var maxItems = data.schema().maxItems; + if (maxItems == null) { + return null; + } + if (!(data.arg() instanceof List listArg)) { + return null; + } + if (listArg.size() > maxItems) { + throw new ValidationException("Value " + listArg + " is invalid because has > the maxItems of " + maxItems); + } + return null; + } +} diff --git a/src/main/resources/kotlin/src/main/kotlin/packagename/schemas/validation/MaxLengthValidator.hbs b/src/main/resources/kotlin/src/main/kotlin/packagename/schemas/validation/MaxLengthValidator.hbs new file mode 100644 index 00000000000..cfa5bfd0f5a --- /dev/null +++ b/src/main/resources/kotlin/src/main/kotlin/packagename/schemas/validation/MaxLengthValidator.hbs @@ -0,0 +1,24 @@ +package {{{packageName}}}.schemas.validation; + +import {{{packageName}}}.exceptions.ValidationException; +import org.checkerframework.checker.nullness.qual.Nullable; + +public class MaxLengthValidator extends LengthValidator implements KeywordValidator { + @Override + public @Nullable PathToSchemasMap validate( + ValidationData data + ) throws ValidationException { + var maxLength = data.schema().maxLength; + if (maxLength == null) { + return null; + } + if (!(data.arg() instanceof String stringArg)) { + return null; + } + int length = getLength(stringArg); + if (length > maxLength) { + throw new ValidationException("Value " + stringArg + " is invalid because has > the maxLength of " + maxLength); + } + return null; + } +} diff --git a/src/main/resources/kotlin/src/main/kotlin/packagename/schemas/validation/MaxPropertiesValidator.hbs b/src/main/resources/kotlin/src/main/kotlin/packagename/schemas/validation/MaxPropertiesValidator.hbs new file mode 100644 index 00000000000..d29dea4a9a1 --- /dev/null +++ b/src/main/resources/kotlin/src/main/kotlin/packagename/schemas/validation/MaxPropertiesValidator.hbs @@ -0,0 +1,25 @@ +package {{{packageName}}}.schemas.validation; + +import {{{packageName}}}.exceptions.ValidationException; +import org.checkerframework.checker.nullness.qual.Nullable; + +import java.util.Map; + +public class MaxPropertiesValidator implements KeywordValidator { + @Override + public @Nullable PathToSchemasMap validate( + ValidationData data + ) throws ValidationException { + var maxProperties = data.schema().maxProperties; + if (maxProperties == null) { + return null; + } + if (!(data.arg() instanceof Map mapArg)) { + return null; + } + if (mapArg.size() > maxProperties) { + throw new ValidationException("Value " + mapArg + " is invalid because has > the maxProperties of " + maxProperties); + } + return null; + } +} diff --git a/src/main/resources/kotlin/src/main/kotlin/packagename/schemas/validation/MaximumValidator.hbs b/src/main/resources/kotlin/src/main/kotlin/packagename/schemas/validation/MaximumValidator.hbs new file mode 100644 index 00000000000..e366516dfc0 --- /dev/null +++ b/src/main/resources/kotlin/src/main/kotlin/packagename/schemas/validation/MaximumValidator.hbs @@ -0,0 +1,45 @@ +package {{{packageName}}}.schemas.validation; + +import {{{packageName}}}.exceptions.ValidationException; +import org.checkerframework.checker.nullness.qual.Nullable; + +public class MaximumValidator implements KeywordValidator { + @Override + public @Nullable PathToSchemasMap validate( + ValidationData data + ) throws ValidationException { + var maximum = data.schema().maximum; + if (maximum == null) { + return null; + } + if (!(data.arg() instanceof Number)) { + return null; + } + String msg = "Value " + data.arg() + " is invalid because it is > the maximum of " + maximum; + if (data.arg() instanceof Integer intArg) { + if (intArg.compareTo(maximum.intValue()) > 0) { + throw new ValidationException(msg); + } + return null; + } + if (data.arg() instanceof Long longArg) { + if (longArg.compareTo(maximum.longValue()) > 0) { + throw new ValidationException(msg); + } + return null; + } + if (data.arg() instanceof Float floatArg) { + if (floatArg.compareTo(maximum.floatValue()) > 0) { + throw new ValidationException(msg); + } + return null; + } + if (data.arg() instanceof Double doubleArg) { + if (doubleArg.compareTo(maximum.doubleValue()) > 0) { + throw new ValidationException(msg); + } + return null; + } + return null; + } +} \ No newline at end of file diff --git a/src/main/resources/kotlin/src/main/kotlin/packagename/schemas/validation/MinContainsValidator.hbs b/src/main/resources/kotlin/src/main/kotlin/packagename/schemas/validation/MinContainsValidator.hbs new file mode 100644 index 00000000000..4628c705229 --- /dev/null +++ b/src/main/resources/kotlin/src/main/kotlin/packagename/schemas/validation/MinContainsValidator.hbs @@ -0,0 +1,31 @@ +package {{{packageName}}}.schemas.validation; + +import org.checkerframework.checker.nullness.qual.Nullable; +import {{{packageName}}}.exceptions.ValidationException; + +import java.util.List; + +public class MinContainsValidator implements KeywordValidator { + @Override + public @Nullable PathToSchemasMap validate( + ValidationData data + ) throws ValidationException { + var minContains = data.schema().minContains; + if (minContains == null) { + return null; + } + if (!(data.arg() instanceof List)) { + return null; + } + if (data.containsPathToSchemas() == null) { + return null; + } + if (data.containsPathToSchemas().size() < minContains) { + throw new ValidationException( + "Validation failed for minContains keyword in class="+data.schema().getClass()+ + " at pathToItem="+data.validationMetadata().pathToItem()+". Too few items validated to the contains schema." + ); + } + return null; + } +} \ No newline at end of file diff --git a/src/main/resources/kotlin/src/main/kotlin/packagename/schemas/validation/MinItemsValidator.hbs b/src/main/resources/kotlin/src/main/kotlin/packagename/schemas/validation/MinItemsValidator.hbs new file mode 100644 index 00000000000..ede47652f99 --- /dev/null +++ b/src/main/resources/kotlin/src/main/kotlin/packagename/schemas/validation/MinItemsValidator.hbs @@ -0,0 +1,25 @@ +package {{{packageName}}}.schemas.validation; + +import {{{packageName}}}.exceptions.ValidationException; +import org.checkerframework.checker.nullness.qual.Nullable; + +import java.util.List; + +public class MinItemsValidator implements KeywordValidator { + @Override + public @Nullable PathToSchemasMap validate( + ValidationData data + ) throws ValidationException { + var minItems = data.schema().minItems; + if (minItems == null) { + return null; + } + if (!(data.arg() instanceof List listArg)) { + return null; + } + if (listArg.size() < minItems) { + throw new ValidationException("Value " + listArg + " is invalid because has < the minItems of " + minItems); + } + return null; + } +} diff --git a/src/main/resources/kotlin/src/main/kotlin/packagename/schemas/validation/MinLengthValidator.hbs b/src/main/resources/kotlin/src/main/kotlin/packagename/schemas/validation/MinLengthValidator.hbs new file mode 100644 index 00000000000..38782795048 --- /dev/null +++ b/src/main/resources/kotlin/src/main/kotlin/packagename/schemas/validation/MinLengthValidator.hbs @@ -0,0 +1,24 @@ +package {{{packageName}}}.schemas.validation; + +import {{{packageName}}}.exceptions.ValidationException; +import org.checkerframework.checker.nullness.qual.Nullable; + +public class MinLengthValidator extends LengthValidator implements KeywordValidator { + @Override + public @Nullable PathToSchemasMap validate( + ValidationData data + ) throws ValidationException { + var minLength = data.schema().minLength; + if (minLength == null) { + return null; + } + if (!(data.arg() instanceof String stringArg)) { + return null; + } + int length = getLength(stringArg); + if (length < minLength) { + throw new ValidationException("Value " + stringArg + " is invalid because has < the minLength of " + minLength); + } + return null; + } +} \ No newline at end of file diff --git a/src/main/resources/kotlin/src/main/kotlin/packagename/schemas/validation/MinPropertiesValidator.hbs b/src/main/resources/kotlin/src/main/kotlin/packagename/schemas/validation/MinPropertiesValidator.hbs new file mode 100644 index 00000000000..d383472a7a6 --- /dev/null +++ b/src/main/resources/kotlin/src/main/kotlin/packagename/schemas/validation/MinPropertiesValidator.hbs @@ -0,0 +1,25 @@ +package {{{packageName}}}.schemas.validation; + +import {{{packageName}}}.exceptions.ValidationException; +import org.checkerframework.checker.nullness.qual.Nullable; + +import java.util.Map; + +public class MinPropertiesValidator implements KeywordValidator { + @Override + public @Nullable PathToSchemasMap validate( + ValidationData data + ) throws ValidationException { + var minProperties = data.schema().minProperties; + if (minProperties == null) { + return null; + } + if (!(data.arg() instanceof Map mapArg)) { + return null; + } + if (mapArg.size() < minProperties) { + throw new ValidationException("Value " + mapArg + " is invalid because has < the minProperties of " + minProperties); + } + return null; + } +} diff --git a/src/main/resources/kotlin/src/main/kotlin/packagename/schemas/validation/MinimumValidator.hbs b/src/main/resources/kotlin/src/main/kotlin/packagename/schemas/validation/MinimumValidator.hbs new file mode 100644 index 00000000000..eba8b4387fa --- /dev/null +++ b/src/main/resources/kotlin/src/main/kotlin/packagename/schemas/validation/MinimumValidator.hbs @@ -0,0 +1,45 @@ +package {{{packageName}}}.schemas.validation; + +import {{{packageName}}}.exceptions.ValidationException; +import org.checkerframework.checker.nullness.qual.Nullable; + +public class MinimumValidator implements KeywordValidator { + @Override + public @Nullable PathToSchemasMap validate( + ValidationData data + ) throws ValidationException { + var minimum = data.schema().minimum; + if (minimum == null) { + return null; + } + if (!(data.arg() instanceof Number)) { + return null; + } + String msg = "Value " + data.arg() + " is invalid because it is < the minimum of " + minimum; + if (data.arg() instanceof Integer intArg) { + if (intArg.compareTo(minimum.intValue()) < 0) { + throw new ValidationException(msg); + } + return null; + } + if (data.arg() instanceof Long longArg) { + if (longArg.compareTo(minimum.longValue()) < 0) { + throw new ValidationException(msg); + } + return null; + } + if (data.arg() instanceof Float floatArg) { + if (floatArg.compareTo(minimum.floatValue()) < 0) { + throw new ValidationException(msg); + } + return null; + } + if (data.arg() instanceof Double doubleArg) { + if (doubleArg.compareTo(minimum.doubleValue()) < 0) { + throw new ValidationException(msg); + } + return null; + } + return null; + } +} diff --git a/src/main/resources/kotlin/src/main/kotlin/packagename/schemas/validation/MultipleOfValidator.hbs b/src/main/resources/kotlin/src/main/kotlin/packagename/schemas/validation/MultipleOfValidator.hbs new file mode 100644 index 00000000000..2b97d0ae2ed --- /dev/null +++ b/src/main/resources/kotlin/src/main/kotlin/packagename/schemas/validation/MultipleOfValidator.hbs @@ -0,0 +1,27 @@ +package {{{packageName}}}.schemas.validation; + +import {{{packageName}}}.exceptions.ValidationException; +import org.checkerframework.checker.nullness.qual.Nullable; + +import java.math.BigDecimal; + +public class MultipleOfValidator extends BigDecimalValidator implements KeywordValidator { + @Override + public @Nullable PathToSchemasMap validate( + ValidationData data + ) throws ValidationException { + var multipleOf = data.schema().multipleOf; + if (multipleOf == null) { + return null; + } + if (!(data.arg() instanceof Number numberArg)) { + return null; + } + BigDecimal castArg = getBigDecimal(numberArg); + String msg = "Value " + numberArg + " is invalid because it is not a multiple of " + multipleOf; + if (castArg.remainder(multipleOf).compareTo(BigDecimal.ZERO) != 0) { + throw new ValidationException(msg); + } + return null; + } +} \ No newline at end of file diff --git a/src/main/resources/kotlin/src/main/kotlin/packagename/schemas/validation/NotValidator.hbs b/src/main/resources/kotlin/src/main/kotlin/packagename/schemas/validation/NotValidator.hbs new file mode 100644 index 00000000000..388fa8cee0d --- /dev/null +++ b/src/main/resources/kotlin/src/main/kotlin/packagename/schemas/validation/NotValidator.hbs @@ -0,0 +1,30 @@ +package {{{packageName}}}.schemas.validation; + +import {{{packageName}}}.exceptions.ValidationException; +import org.checkerframework.checker.nullness.qual.Nullable; + +public class NotValidator implements KeywordValidator { + @Override + public @Nullable PathToSchemasMap validate( + ValidationData data + ) throws ValidationException { + var not = data.schema().not; + if (not == null) { + return null; + } + PathToSchemasMap pathToSchemas; + try { + JsonSchema notSchema = JsonSchemaFactory.getInstance(not); + pathToSchemas = JsonSchema.validate(notSchema, data.arg(), data.validationMetadata()); + } catch (ValidationException e) { + return null; + } + if (!pathToSchemas.isEmpty()) { + throw new ValidationException( + "Invalid value "+data.arg()+" was passed in to "+data.schema().getClass()+". "+ + "Value is invalid because it is disallowed by not "+not + ); + } + return null; + } +} diff --git a/src/main/resources/kotlin/src/main/kotlin/packagename/schemas/validation/NullEnumValidator.hbs b/src/main/resources/kotlin/src/main/kotlin/packagename/schemas/validation/NullEnumValidator.hbs new file mode 100644 index 00000000000..a51cac77805 --- /dev/null +++ b/src/main/resources/kotlin/src/main/kotlin/packagename/schemas/validation/NullEnumValidator.hbs @@ -0,0 +1,8 @@ +package {{{packageName}}}.schemas.validation; + +import {{{packageName}}}.configurations.SchemaConfiguration; +import {{{packageName}}}.exceptions.ValidationException; + +public interface NullEnumValidator { + Nothing? validate(EnumType arg, SchemaConfiguration configuration) throws ValidationException; +} \ No newline at end of file diff --git a/src/main/resources/kotlin/src/main/kotlin/packagename/schemas/validation/NullSchemaValidator.hbs b/src/main/resources/kotlin/src/main/kotlin/packagename/schemas/validation/NullSchemaValidator.hbs new file mode 100644 index 00000000000..daaed85e35c --- /dev/null +++ b/src/main/resources/kotlin/src/main/kotlin/packagename/schemas/validation/NullSchemaValidator.hbs @@ -0,0 +1,9 @@ +package {{{packageName}}}.schemas.validation; + +import {{{packageName}}}.configurations.SchemaConfiguration; +import {{{packageName}}}.exceptions.ValidationException; + +public interface NullSchemaValidator { + Nothing? validate(Nothing? arg, SchemaConfiguration configuration) throws ValidationException; + T validateAndBox(Nothing? arg, SchemaConfiguration configuration) throws ValidationException; +} \ No newline at end of file diff --git a/src/main/resources/kotlin/src/main/kotlin/packagename/schemas/validation/NullValueMethod.hbs b/src/main/resources/kotlin/src/main/kotlin/packagename/schemas/validation/NullValueMethod.hbs new file mode 100644 index 00000000000..e7336f0f0ad --- /dev/null +++ b/src/main/resources/kotlin/src/main/kotlin/packagename/schemas/validation/NullValueMethod.hbs @@ -0,0 +1,5 @@ +package {{{packageName}}}.schemas.validation; + +public interface NullValueMethod { + Nothing? value(); +} \ No newline at end of file diff --git a/src/main/resources/kotlin/src/main/kotlin/packagename/schemas/validation/NumberSchemaValidator.hbs b/src/main/resources/kotlin/src/main/kotlin/packagename/schemas/validation/NumberSchemaValidator.hbs new file mode 100644 index 00000000000..63f4ac97158 --- /dev/null +++ b/src/main/resources/kotlin/src/main/kotlin/packagename/schemas/validation/NumberSchemaValidator.hbs @@ -0,0 +1,9 @@ +package {{{packageName}}}.schemas.validation; + +import {{{packageName}}}.configurations.SchemaConfiguration; +import {{{packageName}}}.exceptions.ValidationException; + +public interface NumberSchemaValidator { + 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/kotlin/src/main/kotlin/packagename/schemas/validation/OneOfValidator.hbs b/src/main/resources/kotlin/src/main/kotlin/packagename/schemas/validation/OneOfValidator.hbs new file mode 100644 index 00000000000..d4fc3652aef --- /dev/null +++ b/src/main/resources/kotlin/src/main/kotlin/packagename/schemas/validation/OneOfValidator.hbs @@ -0,0 +1,50 @@ +package {{{packageName}}}.schemas.validation; + +import {{{packageName}}}.exceptions.ValidationException; +import org.checkerframework.checker.nullness.qual.Nullable; + +import java.util.ArrayList; +import java.util.List; + +public class OneOfValidator implements KeywordValidator { + @Override + public @Nullable PathToSchemasMap validate( + ValidationData data + ) throws ValidationException { + var oneOf = data.schema().oneOf; + if (oneOf == null) { + return null; + } + PathToSchemasMap pathToSchemas = new PathToSchemasMap(); + List>> validatedOneOfClasses = new ArrayList<>(); + for(Class> oneOfClass: oneOf) { + if (oneOfClass == data.schema().getClass()) { + /* + optimistically assume that schema will pass validation + do not invoke validate on it because that is recursive + */ + validatedOneOfClasses.add(oneOfClass); + continue; + } + try { + JsonSchema oneOfSchema = JsonSchemaFactory.getInstance(oneOfClass); + PathToSchemasMap otherPathToSchemas = JsonSchema.validate(oneOfSchema, data.arg(), data.validationMetadata()); + validatedOneOfClasses.add(oneOfClass); + pathToSchemas.update(otherPathToSchemas); + } catch (ValidationException e) { + // silence exceptions because the code needs to accumulate validatedOneOfClasses + } + } + if (validatedOneOfClasses.isEmpty()) { + throw new ValidationException("Invalid inputs given to generate an instance of "+data.schema().getClass()+". None "+ + "of the oneOf schemas matched the input data." + ); + } + if (validatedOneOfClasses.size() > 1) { + throw new ValidationException("Invalid inputs given to generate an instance of "+data.schema().getClass()+". Multiple "+ + "oneOf schemas validated the data, but a max of one is allowed." + ); + } + return pathToSchemas; + } +} diff --git a/src/main/resources/kotlin/src/main/kotlin/packagename/schemas/validation/PathToSchemasMap.hbs b/src/main/resources/kotlin/src/main/kotlin/packagename/schemas/validation/PathToSchemasMap.hbs new file mode 100644 index 00000000000..5c3e08edc57 --- /dev/null +++ b/src/main/resources/kotlin/src/main/kotlin/packagename/schemas/validation/PathToSchemasMap.hbs @@ -0,0 +1,21 @@ +package {{{packageName}}}.schemas.validation; + +import java.util.LinkedHashMap; +import java.util.List; +import java.util.Map; + +@SuppressWarnings("serial") +public class PathToSchemasMap extends LinkedHashMap, LinkedHashMap, Nothing?>> { + + public void update(PathToSchemasMap other) { + for (Map.Entry, LinkedHashMap, Nothing?>> entry: other.entrySet()) { + List pathToItem = entry.getKey(); + LinkedHashMap, Nothing?> otherSchemas = entry.getValue(); + if (containsKey(pathToItem)) { + get(pathToItem).putAll(otherSchemas); + } else { + put(pathToItem, otherSchemas); + } + } + } +} \ No newline at end of file diff --git a/src/main/resources/kotlin/src/main/kotlin/packagename/schemas/validation/PatternPropertiesValidator.hbs b/src/main/resources/kotlin/src/main/kotlin/packagename/schemas/validation/PatternPropertiesValidator.hbs new file mode 100644 index 00000000000..a3d8ffa424c --- /dev/null +++ b/src/main/resources/kotlin/src/main/kotlin/packagename/schemas/validation/PatternPropertiesValidator.hbs @@ -0,0 +1,21 @@ +package {{{packageName}}}.schemas.validation; + +import org.checkerframework.checker.nullness.qual.Nullable; + +import java.util.Map; + +public class PatternPropertiesValidator implements KeywordValidator { + @Override + public @Nullable PathToSchemasMap validate( + ValidationData data + ) { + var patternProperties = data.schema().patternProperties; + if (patternProperties == null) { + return null; + } + if (!(data.arg() instanceof Map)) { + return null; + } + return data.patternPropertiesPathToSchemas(); + } +} diff --git a/src/main/resources/kotlin/src/main/kotlin/packagename/schemas/validation/PatternValidator.hbs b/src/main/resources/kotlin/src/main/kotlin/packagename/schemas/validation/PatternValidator.hbs new file mode 100644 index 00000000000..08f40c93530 --- /dev/null +++ b/src/main/resources/kotlin/src/main/kotlin/packagename/schemas/validation/PatternValidator.hbs @@ -0,0 +1,23 @@ +package {{{packageName}}}.schemas.validation; + +import {{{packageName}}}.exceptions.ValidationException; +import org.checkerframework.checker.nullness.qual.Nullable; + +public class PatternValidator implements KeywordValidator { + @Override + public @Nullable PathToSchemasMap validate( + ValidationData data + ) throws ValidationException { + var pattern = data.schema().pattern; + if (pattern == null) { + return null; + } + if (!(data.arg() instanceof String stringArg)) { + return null; + } + if (!pattern.matcher(stringArg).find()) { + throw new ValidationException("Invalid value "+stringArg+" did not find a match for pattern "+pattern); + } + return null; + } +} \ No newline at end of file diff --git a/src/main/resources/kotlin/src/main/kotlin/packagename/schemas/validation/PrefixItemsValidator.hbs b/src/main/resources/kotlin/src/main/kotlin/packagename/schemas/validation/PrefixItemsValidator.hbs new file mode 100644 index 00000000000..8a778500981 --- /dev/null +++ b/src/main/resources/kotlin/src/main/kotlin/packagename/schemas/validation/PrefixItemsValidator.hbs @@ -0,0 +1,41 @@ +package {{{packageName}}}.schemas.validation; + +import org.checkerframework.checker.nullness.qual.Nullable; +import {{{packageName}}}.exceptions.ValidationException; + +import java.util.ArrayList; +import java.util.List; + +public class PrefixItemsValidator implements KeywordValidator { + @Override + public @Nullable PathToSchemasMap validate( + ValidationData data + ) throws ValidationException { + var prefixItems = data.schema().prefixItems; + if (prefixItems == null) { + return null; + } + if (!(data.arg() instanceof List listArg)) { + return null; + } + if (listArg.isEmpty()) { + return null; + } + PathToSchemasMap pathToSchemas = new PathToSchemasMap(); + int maxIndex = Math.min(listArg.size(), prefixItems.size()); + for (int i=0; i < maxIndex; i++) { + List itemPathToItem = new ArrayList<>(data.validationMetadata().pathToItem()); + itemPathToItem.add(i); + ValidationMetadata itemValidationMetadata = new ValidationMetadata( + itemPathToItem, + data.validationMetadata().configuration(), + data.validationMetadata().validatedPathToSchemas(), + data.validationMetadata().seenClasses() + ); + JsonSchema itemsSchema = JsonSchemaFactory.getInstance(prefixItems.get(i)); + PathToSchemasMap otherPathToSchemas = JsonSchema.validate(itemsSchema, listArg.get(i), itemValidationMetadata); + pathToSchemas.update(otherPathToSchemas); + } + return pathToSchemas; + } +} diff --git a/src/main/resources/kotlin/src/main/kotlin/packagename/schemas/validation/PropertiesValidator.hbs b/src/main/resources/kotlin/src/main/kotlin/packagename/schemas/validation/PropertiesValidator.hbs new file mode 100644 index 00000000000..f339a2b52e5 --- /dev/null +++ b/src/main/resources/kotlin/src/main/kotlin/packagename/schemas/validation/PropertiesValidator.hbs @@ -0,0 +1,56 @@ +package {{{packageName}}}.schemas.validation; + +import org.checkerframework.checker.nullness.qual.Nullable; +import {{{packageName}}}.exceptions.ValidationException; + +import java.util.ArrayList; +import java.util.LinkedHashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; + +public class PropertiesValidator implements KeywordValidator { + @Override + public @Nullable PathToSchemasMap validate( + ValidationData data + ) throws ValidationException { + var properties = data.schema().properties; + if (properties == null) { + return null; + } + if (!(data.arg() instanceof Map mapArg)) { + return null; + } + PathToSchemasMap pathToSchemas = new PathToSchemasMap(); + Set presentProperties = new LinkedHashSet<>(); + for (Object key: mapArg.keySet()) { + if (key instanceof String) { + presentProperties.add((String) key); + } + } + for(Map.Entry>> entry: properties.entrySet()) { + String propName = entry.getKey(); + if (!presentProperties.contains(propName)) { + continue; + } + @Nullable Object propValue = mapArg.get(propName); + List propPathToItem = new ArrayList<>(data.validationMetadata().pathToItem()); + propPathToItem.add(propName); + ValidationMetadata propValidationMetadata = new ValidationMetadata( + propPathToItem, + data.validationMetadata().configuration(), + data.validationMetadata().validatedPathToSchemas(), + data.validationMetadata().seenClasses() + ); + Class> propClass = entry.getValue(); + JsonSchema propSchema = JsonSchemaFactory.getInstance(propClass); + if (propValidationMetadata.validationRanEarlier(propSchema)) { + // todo add_deeper_validated_schemas + continue; + } + PathToSchemasMap otherPathToSchemas = JsonSchema.validate(propSchema, propValue, propValidationMetadata); + pathToSchemas.update(otherPathToSchemas); + } + return pathToSchemas; + } +} diff --git a/src/main/resources/kotlin/src/main/kotlin/packagename/schemas/validation/PropertyEntry.hbs b/src/main/resources/kotlin/src/main/kotlin/packagename/schemas/validation/PropertyEntry.hbs new file mode 100644 index 00000000000..e931cdbb0a4 --- /dev/null +++ b/src/main/resources/kotlin/src/main/kotlin/packagename/schemas/validation/PropertyEntry.hbs @@ -0,0 +1,10 @@ +package {{{packageName}}}.schemas.validation; + +import java.util.AbstractMap; + +@SuppressWarnings("serial") +public class PropertyEntry extends AbstractMap.SimpleEntry>> { + public PropertyEntry(String key, Class> value) { + super(key, value); + } +} \ No newline at end of file diff --git a/src/main/resources/kotlin/src/main/kotlin/packagename/schemas/validation/PropertyNamesValidator.hbs b/src/main/resources/kotlin/src/main/kotlin/packagename/schemas/validation/PropertyNamesValidator.hbs new file mode 100644 index 00000000000..90b1599ee61 --- /dev/null +++ b/src/main/resources/kotlin/src/main/kotlin/packagename/schemas/validation/PropertyNamesValidator.hbs @@ -0,0 +1,38 @@ +package {{{packageName}}}.schemas.validation; + +import org.checkerframework.checker.nullness.qual.Nullable; +import {{{packageName}}}.exceptions.ValidationException; + +import java.util.ArrayList; +import java.util.List; +import java.util.Map; + +public class PropertyNamesValidator implements KeywordValidator { + @Override + public @Nullable PathToSchemasMap validate( + ValidationData data + ) throws ValidationException { + var propertyNames = data.schema().propertyNames; + if (propertyNames == null) { + return null; + } + if (!(data.arg() instanceof Map mapArg)) { + return null; + } + JsonSchema propertyNamesSchema = JsonSchemaFactory.getInstance(propertyNames); + for (Object objKey: mapArg.keySet()) { + if (objKey instanceof String key) { + List propPathToItem = new ArrayList<>(data.validationMetadata().pathToItem()); + propPathToItem.add(key); + ValidationMetadata keyValidationMetadata = new ValidationMetadata( + propPathToItem, + data.validationMetadata().configuration(), + data.validationMetadata().validatedPathToSchemas(), + data.validationMetadata().seenClasses() + ); + JsonSchema.validate(propertyNamesSchema, key, keyValidationMetadata); + } + } + return null; + } +} diff --git a/src/main/resources/kotlin/src/main/kotlin/packagename/schemas/validation/RequiredValidator.hbs b/src/main/resources/kotlin/src/main/kotlin/packagename/schemas/validation/RequiredValidator.hbs new file mode 100644 index 00000000000..e21584c2c19 --- /dev/null +++ b/src/main/resources/kotlin/src/main/kotlin/packagename/schemas/validation/RequiredValidator.hbs @@ -0,0 +1,41 @@ +package {{{packageName}}}.schemas.validation; + +import org.checkerframework.checker.nullness.qual.Nullable; +import {{{packageName}}}.exceptions.ValidationException; + +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; + +public class RequiredValidator implements KeywordValidator { + @Override + public @Nullable PathToSchemasMap validate( + ValidationData data + ) throws ValidationException { + var required = data.schema().required; + if (required == null) { + return null; + } + if (!(data.arg() instanceof Map mapArg)) { + return null; + } + Set missingRequiredProperties = new HashSet<>(required); + for (Object key: mapArg.keySet()) { + if (key instanceof String) { + missingRequiredProperties.remove(key); + } + } + if (!missingRequiredProperties.isEmpty()) { + List missingReqProps = missingRequiredProperties.stream().sorted().toList(); + String pluralChar = ""; + if (missingRequiredProperties.size() > 1) { + pluralChar = "s"; + } + throw new ValidationException( + data.schema().getClass()+" is missing "+missingRequiredProperties.size()+" required argument"+pluralChar+": "+missingReqProps + ); + } + return null; + } +} diff --git a/src/main/resources/kotlin/src/main/kotlin/packagename/schemas/validation/StringEnumValidator.hbs b/src/main/resources/kotlin/src/main/kotlin/packagename/schemas/validation/StringEnumValidator.hbs new file mode 100644 index 00000000000..4731c6f1d9c --- /dev/null +++ b/src/main/resources/kotlin/src/main/kotlin/packagename/schemas/validation/StringEnumValidator.hbs @@ -0,0 +1,8 @@ +package {{{packageName}}}.schemas.validation; + +import {{{packageName}}}.configurations.SchemaConfiguration; +import {{{packageName}}}.exceptions.ValidationException; + +public interface StringEnumValidator { + String validate(EnumType arg, SchemaConfiguration configuration) throws ValidationException; +} \ No newline at end of file diff --git a/src/main/resources/kotlin/src/main/kotlin/packagename/schemas/validation/StringSchemaValidator.hbs b/src/main/resources/kotlin/src/main/kotlin/packagename/schemas/validation/StringSchemaValidator.hbs new file mode 100644 index 00000000000..30724ee6f48 --- /dev/null +++ b/src/main/resources/kotlin/src/main/kotlin/packagename/schemas/validation/StringSchemaValidator.hbs @@ -0,0 +1,9 @@ +package {{{packageName}}}.schemas.validation; + +import {{{packageName}}}.configurations.SchemaConfiguration; +import {{{packageName}}}.exceptions.ValidationException; + +public interface StringSchemaValidator { + 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/kotlin/src/main/kotlin/packagename/schemas/validation/StringValueMethod.hbs b/src/main/resources/kotlin/src/main/kotlin/packagename/schemas/validation/StringValueMethod.hbs new file mode 100644 index 00000000000..1378cd0ecaf --- /dev/null +++ b/src/main/resources/kotlin/src/main/kotlin/packagename/schemas/validation/StringValueMethod.hbs @@ -0,0 +1,5 @@ +package {{{packageName}}}.schemas.validation; + +public interface StringValueMethod { + String value(); +} \ No newline at end of file diff --git a/src/main/resources/kotlin/src/main/kotlin/packagename/schemas/validation/ThenValidator.hbs b/src/main/resources/kotlin/src/main/kotlin/packagename/schemas/validation/ThenValidator.hbs new file mode 100644 index 00000000000..4b759d4a34b --- /dev/null +++ b/src/main/resources/kotlin/src/main/kotlin/packagename/schemas/validation/ThenValidator.hbs @@ -0,0 +1,32 @@ +package {{{packageName}}}.schemas.validation; + +import org.checkerframework.checker.nullness.qual.Nullable; +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; + } + var ifPathToSchemas = data.ifPathToSchemas(); + if (ifPathToSchemas == null) { + // if unset + return null; + } + if (ifPathToSchemas.isEmpty()) { + // if validation is false + return null; + } + JsonSchema thenSchema = JsonSchemaFactory.getInstance(then); + PathToSchemasMap pathToSchemas = new PathToSchemasMap(); + var thenPathToSchemas = JsonSchema.validate(thenSchema, data.arg(), data.validationMetadata()); + // todo capture validation error and describe it as an then error? + pathToSchemas.update(ifPathToSchemas); + pathToSchemas.update(thenPathToSchemas); + return pathToSchemas; + } +} diff --git a/src/main/resources/kotlin/src/main/kotlin/packagename/schemas/validation/TypeValidator.hbs b/src/main/resources/kotlin/src/main/kotlin/packagename/schemas/validation/TypeValidator.hbs new file mode 100644 index 00000000000..7f4c27fa89f --- /dev/null +++ b/src/main/resources/kotlin/src/main/kotlin/packagename/schemas/validation/TypeValidator.hbs @@ -0,0 +1,34 @@ +package {{{packageName}}}.schemas.validation; + +import org.checkerframework.checker.nullness.qual.Nullable; +import {{{packageName}}}.exceptions.ValidationException; + +import java.util.List; +import java.util.Map; + +public class TypeValidator implements KeywordValidator { + @Override + public @Nullable PathToSchemasMap validate( + ValidationData data + ) throws ValidationException { + var type = data.schema().type; + if (type == null) { + return null; + } + Class argClass; + var arg = data.arg(); + if (arg == null) { + argClass = Nothing?.class; + } else if (arg instanceof List) { + argClass = List.class; + } else if (arg instanceof Map) { + argClass = Map.class; + } else { + argClass = arg.getClass(); + } + if (!type.contains(argClass)) { + throw new ValidationException("invalid type"); + } + return null; + } +} diff --git a/src/main/resources/kotlin/src/main/kotlin/packagename/schemas/validation/UnevaluatedItemsValidator.hbs b/src/main/resources/kotlin/src/main/kotlin/packagename/schemas/validation/UnevaluatedItemsValidator.hbs new file mode 100644 index 00000000000..f22ca53b47e --- /dev/null +++ b/src/main/resources/kotlin/src/main/kotlin/packagename/schemas/validation/UnevaluatedItemsValidator.hbs @@ -0,0 +1,52 @@ +package {{{packageName}}}.schemas.validation; + +import org.checkerframework.checker.nullness.qual.Nullable; +import {{{packageName}}}.exceptions.ValidationException; + +import java.util.ArrayList; +import java.util.List; + +public class UnevaluatedItemsValidator implements KeywordValidator { + @Override + public @Nullable PathToSchemasMap validate( + ValidationData data + ) throws ValidationException { + var unevaluatedItems = data.schema().unevaluatedItems; + if (unevaluatedItems == null) { + return null; + } + var knownPathToSchemas = data.knownPathToSchemas(); + if (knownPathToSchemas == null) { + return null; + } + if (!(data.arg() instanceof List listArg)) { + return null; + } + if (listArg.isEmpty()) { + return null; + } + PathToSchemasMap pathToSchemas = new PathToSchemasMap(); + int minIndex = data.schema().prefixItems != null ? data.schema().prefixItems.size() : 0; + JsonSchema unevaluatedItemsSchema = JsonSchemaFactory.getInstance(unevaluatedItems); + for(int i = minIndex; i < listArg.size(); i++) { + List itemPathToItem = new ArrayList<>(data.validationMetadata().pathToItem()); + itemPathToItem.add(i); + if (knownPathToSchemas.containsKey(itemPathToItem)) { + continue; + } + ValidationMetadata itemValidationMetadata = new ValidationMetadata( + itemPathToItem, + data.validationMetadata().configuration(), + data.validationMetadata().validatedPathToSchemas(), + data.validationMetadata().seenClasses() + ); + if (itemValidationMetadata.validationRanEarlier(unevaluatedItemsSchema)) { + // todo add_deeper_validated_schemas + continue; + } + PathToSchemasMap otherPathToSchemas = JsonSchema.validate(unevaluatedItemsSchema, listArg.get(i), itemValidationMetadata); + pathToSchemas.update(otherPathToSchemas); + } + return pathToSchemas; + } +} diff --git a/src/main/resources/kotlin/src/main/kotlin/packagename/schemas/validation/UnevaluatedPropertiesValidator.hbs b/src/main/resources/kotlin/src/main/kotlin/packagename/schemas/validation/UnevaluatedPropertiesValidator.hbs new file mode 100644 index 00000000000..9539d7d73b0 --- /dev/null +++ b/src/main/resources/kotlin/src/main/kotlin/packagename/schemas/validation/UnevaluatedPropertiesValidator.hbs @@ -0,0 +1,49 @@ +package {{{packageName}}}.schemas.validation; + +import org.checkerframework.checker.nullness.qual.Nullable; +import {{{packageName}}}.exceptions.ValidationException; + +import java.util.ArrayList; +import java.util.List; +import java.util.Map; + +public class UnevaluatedPropertiesValidator implements KeywordValidator { + @Override + public @Nullable PathToSchemasMap validate( + ValidationData data + ) throws ValidationException { + var unevaluatedProperties = data.schema().unevaluatedProperties; + if (unevaluatedProperties == null) { + return null; + } + var knownPathToSchemas = data.knownPathToSchemas(); + if (knownPathToSchemas == null) { + return null; + } + if (!(data.arg() instanceof Map mapArg)) { + return null; + } + PathToSchemasMap pathToSchemas = new PathToSchemasMap(); + 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"); + } + List propPathToItem = new ArrayList<>(data.validationMetadata().pathToItem()); + propPathToItem.add(propName); + if (knownPathToSchemas.containsKey(propPathToItem)) { + continue; + } + @Nullable Object propValue = mapArg.get(propName); + ValidationMetadata propValidationMetadata = new ValidationMetadata( + propPathToItem, + data.validationMetadata().configuration(), + data.validationMetadata().validatedPathToSchemas(), + data.validationMetadata().seenClasses() + ); + PathToSchemasMap otherPathToSchemas = JsonSchema.validate(unevaluatedPropertiesSchema, propValue, propValidationMetadata); + pathToSchemas.update(otherPathToSchemas); + } + return pathToSchemas; + } +} \ No newline at end of file diff --git a/src/main/resources/kotlin/src/main/kotlin/packagename/schemas/validation/UniqueItemsValidator.hbs b/src/main/resources/kotlin/src/main/kotlin/packagename/schemas/validation/UniqueItemsValidator.hbs new file mode 100644 index 00000000000..aba5b63684c --- /dev/null +++ b/src/main/resources/kotlin/src/main/kotlin/packagename/schemas/validation/UniqueItemsValidator.hbs @@ -0,0 +1,35 @@ +package {{{packageName}}}.schemas.validation; + +import org.checkerframework.checker.nullness.qual.Nullable; +import {{{packageName}}}.exceptions.ValidationException; + +import java.util.HashSet; +import java.util.List; +import java.util.Set; + +public class UniqueItemsValidator implements KeywordValidator { + @Override + public @Nullable PathToSchemasMap validate( + ValidationData data + ) throws ValidationException { + var uniqueItems = data.schema().uniqueItems; + if (uniqueItems == null) { + return null; + } + if (!(data.arg() instanceof List listArg)) { + return null; + } + if (!uniqueItems) { + return null; + } + Set<@Nullable Object> seenItems = new HashSet<>(); + for (@Nullable Object item: listArg) { + int startingSeenItemsSize = seenItems.size(); + seenItems.add(item); + if (seenItems.size() == startingSeenItemsSize) { + throw new ValidationException("Invalid list value, list contains duplicate items when uniqueItems is true"); + } + } + return null; + } +} diff --git a/src/main/resources/kotlin/src/main/kotlin/packagename/schemas/validation/UnsetAnyTypeJsonSchema.hbs b/src/main/resources/kotlin/src/main/kotlin/packagename/schemas/validation/UnsetAnyTypeJsonSchema.hbs new file mode 100644 index 00000000000..8ef8ec61b31 --- /dev/null +++ b/src/main/resources/kotlin/src/main/kotlin/packagename/schemas/validation/UnsetAnyTypeJsonSchema.hbs @@ -0,0 +1,302 @@ +package {{{packageName}}}.schemas.validation; + +import {{{packageName}}}.configurations.JsonSchemaKeywordFlags; +import {{{packageName}}}.configurations.SchemaConfiguration; +import {{{packageName}}}.exceptions.ValidationException; +import org.checkerframework.checker.nullness.qual.Nullable; + +import java.time.LocalDate; +import java.time.ZonedDateTime; +import java.util.LinkedHashMap; +import java.util.List; +import java.util.HashSet; +import java.util.ArrayList; +import java.util.LinkedHashSet; +import java.util.Set; +import java.util.Map; +import java.util.Objects; +import java.util.UUID; + +public class UnsetAnyTypeJsonSchema { + public sealed interface UnsetAnyTypeJsonSchema1Boxed permits UnsetAnyTypeJsonSchema1BoxedVoid, UnsetAnyTypeJsonSchema1BoxedBoolean, UnsetAnyTypeJsonSchema1BoxedNumber, UnsetAnyTypeJsonSchema1BoxedString, UnsetAnyTypeJsonSchema1BoxedList, UnsetAnyTypeJsonSchema1BoxedMap { + @Nullable Object getData(); + } + public record UnsetAnyTypeJsonSchema1BoxedVoid(Nothing? data) implements UnsetAnyTypeJsonSchema1Boxed { + @Override + public @Nullable Object getData() { + return data; + } + } + public record UnsetAnyTypeJsonSchema1BoxedBoolean(boolean data) implements UnsetAnyTypeJsonSchema1Boxed { + @Override + public @Nullable Object getData() { + return data; + } + } + public record UnsetAnyTypeJsonSchema1BoxedNumber(Number data) implements UnsetAnyTypeJsonSchema1Boxed { + @Override + public @Nullable Object getData() { + return data; + } + } + public record UnsetAnyTypeJsonSchema1BoxedString(String data) implements UnsetAnyTypeJsonSchema1Boxed { + @Override + public @Nullable Object getData() { + return data; + } + } + public record UnsetAnyTypeJsonSchema1BoxedList(FrozenList<@Nullable Object> data) implements UnsetAnyTypeJsonSchema1Boxed { + @Override + public @Nullable Object getData() { + return data; + } + } + public record UnsetAnyTypeJsonSchema1BoxedMap(FrozenMap<@Nullable Object> data) implements UnsetAnyTypeJsonSchema1Boxed { + @Override + public @Nullable Object getData() { + return data; + } + } + public static class UnsetAnyTypeJsonSchema1 extends JsonSchema implements NullSchemaValidator, BooleanSchemaValidator, NumberSchemaValidator, StringSchemaValidator, ListSchemaValidator, UnsetAnyTypeJsonSchema1BoxedList>, MapSchemaValidator, UnsetAnyTypeJsonSchema1BoxedMap> { + private static @Nullable UnsetAnyTypeJsonSchema1 instance = null; + + protected UnsetAnyTypeJsonSchema1() { + super(new JsonSchemaInfo()); + } + + public static UnsetAnyTypeJsonSchema1 getInstance() { + if (instance == null) { + instance = new UnsetAnyTypeJsonSchema1(); + } + return instance; + } + + @Override + public Nothing? validate(Nothing? arg, SchemaConfiguration configuration) throws ValidationException { + Set> pathSet = new HashSet<>(); + List pathToItem = List.of("args[0]"); + Nothing? castArg = castToAllowedTypes(arg, pathToItem, pathSet); + SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().build())); + PathToSchemasMap validatedPathToSchemas = new PathToSchemasMap(); + ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, new LinkedHashSet<>()); + PathToSchemasMap pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet); + return getNewInstance(castArg, validationMetadata.pathToItem(), pathToSchemasMap); + } + + @Override + public boolean validate(boolean arg, SchemaConfiguration configuration) throws ValidationException { + Set> pathSet = new HashSet<>(); + List pathToItem = List.of("args[0]"); + boolean castArg = castToAllowedTypes(arg, pathToItem, pathSet); + SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().build())); + PathToSchemasMap validatedPathToSchemas = new PathToSchemasMap(); + ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, new LinkedHashSet<>()); + PathToSchemasMap pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet); + return getNewInstance(castArg, validationMetadata.pathToItem(), pathToSchemasMap); + } + + @Override + public Number validate(Number arg, SchemaConfiguration configuration) throws ValidationException { + Set> pathSet = new HashSet<>(); + List pathToItem = List.of("args[0]"); + Number castArg = castToAllowedTypes(arg, pathToItem, pathSet); + SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().build())); + PathToSchemasMap validatedPathToSchemas = new PathToSchemasMap(); + ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, new LinkedHashSet<>()); + PathToSchemasMap pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet); + return getNewInstance(castArg, validationMetadata.pathToItem(), pathToSchemasMap); + } + + public int validate(int arg, SchemaConfiguration configuration) throws ValidationException { + return (int) validate((Number) arg, configuration); + } + + public long validate(long arg, SchemaConfiguration configuration) throws ValidationException { + return (long) validate((Number) arg, configuration); + } + + public float validate(float arg, SchemaConfiguration configuration) throws ValidationException { + return (float) validate((Number) arg, configuration); + } + + public double validate(double arg, SchemaConfiguration configuration) throws ValidationException { + return (double) validate((Number) arg, configuration); + } + + @Override + public String validate(String arg, SchemaConfiguration configuration) throws ValidationException { + Set> pathSet = new HashSet<>(); + List pathToItem = List.of("args[0]"); + String castArg = castToAllowedTypes(arg, pathToItem, pathSet); + SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().build())); + PathToSchemasMap validatedPathToSchemas = new PathToSchemasMap(); + ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, new LinkedHashSet<>()); + PathToSchemasMap pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet); + return getNewInstance(castArg, validationMetadata.pathToItem(), pathToSchemasMap); + } + + public String validate(LocalDate arg, SchemaConfiguration configuration) throws ValidationException { + return validate(arg.toString(), configuration); + } + + public String validate(ZonedDateTime arg, SchemaConfiguration configuration) throws ValidationException { + return validate(arg.toString(), configuration); + } + + public String validate(UUID arg, SchemaConfiguration configuration) throws ValidationException { + return validate(arg.toString(), configuration); + } + + @Override + public FrozenList<@Nullable Object> getNewInstance(List arg, List pathToItem, PathToSchemasMap pathToSchemas) { + List<@Nullable Object> items = new ArrayList<>(); + int i = 0; + for (Object item: arg) { + List itemPathToItem = new ArrayList<>(pathToItem); + itemPathToItem.add(i); + LinkedHashMap, Nothing?> schemas = pathToSchemas.get(itemPathToItem); + if (schemas == null) { + 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); + items.add(castItem); + i += 1; + } + return new FrozenList<>(items); + } + + 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); + SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().build())); + PathToSchemasMap validatedPathToSchemas = new PathToSchemasMap(); + ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, new LinkedHashSet<>()); + PathToSchemasMap pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet); + return getNewInstance(castArg, validationMetadata.pathToItem(), pathToSchemasMap); + } + + @Override + 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 RuntimeException("Invalid non-string key value"); + } + String propertyName = (String) entryKey; + List propertyPathToItem = new ArrayList<>(pathToItem); + propertyPathToItem.add(propertyName); + Object value = entry.getValue(); + LinkedHashMap, Nothing?> schemas = pathToSchemas.get(propertyPathToItem); + if (schemas == null) { + 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); + properties.put(propertyName, castValue); + } + return new FrozenMap<>(properties); + } + + public FrozenMap<@Nullable Object> validate(Map arg, SchemaConfiguration configuration) throws ValidationException { + Set> pathSet = new HashSet<>(); + List pathToItem = List.of("args[0]"); + Map castArg = castToAllowedTypes(arg, pathToItem, pathSet); + SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().build())); + PathToSchemasMap validatedPathToSchemas = new PathToSchemasMap(); + ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, new LinkedHashSet<>()); + PathToSchemasMap pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet); + return getNewInstance(castArg, validationMetadata.pathToItem(), pathToSchemasMap); + } + + @Override + public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { + if (arg == null) { + return getNewInstance((Nothing?) null, pathToItem, pathToSchemas); + } else if (arg instanceof Boolean) { + boolean boolArg = (Boolean) arg; + return getNewInstance(boolArg, pathToItem, pathToSchemas); + } else if (arg instanceof Number) { + return getNewInstance((Number) arg, pathToItem, pathToSchemas); + } else if (arg instanceof String) { + return getNewInstance((String) arg, pathToItem, pathToSchemas); + } else if (arg instanceof List) { + return getNewInstance((List) arg, 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"); + } + + @Override + public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { + if (arg == null) { + return validate((Nothing?) null, configuration); + } else if (arg instanceof Boolean) { + boolean boolArg = (Boolean) arg; + return validate(boolArg, configuration); + } else if (arg instanceof Number) { + return validate((Number) arg, configuration); + } else if (arg instanceof String) { + return validate((String) arg, configuration); + } else if (arg instanceof List) { + return validate((List) arg, 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"); + } + + @Override + public UnsetAnyTypeJsonSchema1BoxedVoid validateAndBox(Nothing? arg, SchemaConfiguration configuration) throws ValidationException { + return new UnsetAnyTypeJsonSchema1BoxedVoid(validate(arg, configuration)); + } + + @Override + 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 { + return new UnsetAnyTypeJsonSchema1BoxedNumber(validate(arg, configuration)); + } + + @Override + 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 { + return new UnsetAnyTypeJsonSchema1BoxedList(validate(arg, configuration)); + } + + @Override + 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 { + if (arg == null) { + Nothing? castArg = (Nothing?) arg; + return validateAndBox(castArg, configuration); + } else if (arg instanceof Boolean booleanArg) { + boolean castArg = booleanArg; + return validateAndBox(castArg, configuration); + } else if (arg instanceof String castArg) { + return validateAndBox(castArg, configuration); + } else if (arg instanceof Number castArg) { + return validateAndBox(castArg, configuration); + } else if (arg instanceof List castArg) { + 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"); + } + } +} \ No newline at end of file diff --git a/src/main/resources/kotlin/src/main/kotlin/packagename/schemas/validation/ValidationData.hbs b/src/main/resources/kotlin/src/main/kotlin/packagename/schemas/validation/ValidationData.hbs new file mode 100644 index 00000000000..b269cda57ef --- /dev/null +++ b/src/main/resources/kotlin/src/main/kotlin/packagename/schemas/validation/ValidationData.hbs @@ -0,0 +1,23 @@ +package {{{packageName}}}.schemas.validation; + +import org.checkerframework.checker.nullness.qual.Nullable; + +import java.util.List; + +public record ValidationData( + JsonSchema schema, + @Nullable Object arg, + ValidationMetadata validationMetadata, + @Nullable List containsPathToSchemas, + @Nullable PathToSchemasMap patternPropertiesPathToSchemas, + @Nullable PathToSchemasMap ifPathToSchemas, + @Nullable PathToSchemasMap knownPathToSchemas +) { + public ValidationData( + JsonSchema schema, + @Nullable Object arg, + ValidationMetadata validationMetadata + ) { + this(schema, arg, validationMetadata, null, null, null, null); + } +} \ No newline at end of file diff --git a/src/main/resources/kotlin/src/main/kotlin/packagename/schemas/validation/ValidationMetadata.hbs b/src/main/resources/kotlin/src/main/kotlin/packagename/schemas/validation/ValidationMetadata.hbs new file mode 100644 index 00000000000..e16e9fb3095 --- /dev/null +++ b/src/main/resources/kotlin/src/main/kotlin/packagename/schemas/validation/ValidationMetadata.hbs @@ -0,0 +1,26 @@ +package {{{packageName}}}.schemas.validation; + +import org.checkerframework.checker.nullness.qual.Nullable; +import {{{packageName}}}.configurations.SchemaConfiguration; +import java.util.List; +import java.util.Map; +import java.util.Set; + +public record ValidationMetadata( + List pathToItem, + SchemaConfiguration configuration, + PathToSchemasMap validatedPathToSchemas, + Set> seenClasses +) { + + public boolean validationRanEarlier(JsonSchema schema) { + @Nullable Map, Nothing?> validatedSchemas = validatedPathToSchemas.get(pathToItem); + if (validatedSchemas != null && validatedSchemas.containsKey(schema)) { + return true; + } + if (seenClasses.contains(schema)) { + return true; + } + return false; + } +} \ No newline at end of file diff --git a/src/main/resources/kotlin/src/main/kotlin/packagename/securityrequirementobjects/AuthApplier.hbs b/src/main/resources/kotlin/src/main/kotlin/packagename/securityrequirementobjects/AuthApplier.hbs new file mode 100644 index 00000000000..30d74eff680 --- /dev/null +++ b/src/main/resources/kotlin/src/main/kotlin/packagename/securityrequirementobjects/AuthApplier.hbs @@ -0,0 +1,40 @@ +package {{{packageName}}}.securityrequirementobjects; + +import org.checkerframework.checker.nullness.qual.Nullable; +import {{{packageName}}}.securityschemes.SecurityScheme; +import {{{packageName}}}.configurations.ApiConfiguration; + +import java.net.http.HttpRequest; +import java.util.List; +import java.util.Map; + +public class AuthApplier { + protected static void updateParamsForAuth( + @Nullable SecurityRequirementObject securityRequirementObject, + Map> headers, + String resourcePath, + String method, + HttpRequest.BodyPublisher bodyPublisher, + @Nullable Map queryMap, + ApiConfiguration apiConfiguration + ) { + if (securityRequirementObject == null) { + return; + } + // TODO change securityRequirementObject to be a map of enum to scopes + // TODO store the SecurityScheme instances in a map in apiConfiguration + for (Map.Entry, List> entry: securityRequirementObject.securitySchemeToScopes.entrySet()) { + Class securitySchemeClass = entry.getKey(); + SecurityScheme securityScheme = apiConfiguration.getSecurityScheme(securitySchemeClass); + List scopeNames = entry.getValue(); + securityScheme.applyAuth( + headers, + resourcePath, + method, + bodyPublisher, + queryMap, + scopeNames + ); + } + } +} diff --git a/src/main/resources/kotlin/src/main/kotlin/packagename/securityrequirementobjects/EmptySecurityRequirementObject.hbs b/src/main/resources/kotlin/src/main/kotlin/packagename/securityrequirementobjects/EmptySecurityRequirementObject.hbs new file mode 100644 index 00000000000..e94e7b2b3f4 --- /dev/null +++ b/src/main/resources/kotlin/src/main/kotlin/packagename/securityrequirementobjects/EmptySecurityRequirementObject.hbs @@ -0,0 +1,10 @@ +package {{{packageName}}}.securityrequirementobjects; + +import java.util.Map; + +public class EmptySecurityRequirementObject extends SecurityRequirementObject { + + public EmptySecurityRequirementObject() { + super(Map.of()); + } +} diff --git a/src/main/resources/kotlin/src/main/kotlin/packagename/securityrequirementobjects/SecurityInfo.hbs b/src/main/resources/kotlin/src/main/kotlin/packagename/securityrequirementobjects/SecurityInfo.hbs new file mode 100644 index 00000000000..899e05dee32 --- /dev/null +++ b/src/main/resources/kotlin/src/main/kotlin/packagename/securityrequirementobjects/SecurityInfo.hbs @@ -0,0 +1,50 @@ +{{#if security.subpackage}} +package {{{packageName}}}.{{security.subpackage}}; +{{else}} +package {{{packageName}}}; +{{/if}} + +{{#each security}} +import {{{packageName}}}.{{subpackage}}.{{jsonPathPiece.pascalCase}}; +{{/each}} +import {{{packageName}}}.securityrequirementobjects.SecurityRequirementObject; +import {{{packageName}}}.securityrequirementobjects.SecurityRequirementObjectProvider; + +public class {{security.jsonPathPiece.pascalCase}} { + public static class {{security.jsonPathPiece.pascalCase}}1 implements SecurityRequirementObjectProvider { +{{#each security}} + public final {{jsonPathPiece.pascalCase}} security{{@index}}; +{{/each}} + + public {{security.jsonPathPiece.pascalCase}}1() { +{{#each security}} + security{{@index}} = new {{jsonPathPiece.pascalCase}}(); +{{/each}} + } + + @Override + public SecurityRequirementObject getSecurityRequirementObject(SecurityIndex securityIndex) { + {{#eq security.size 1}} + return security0; + {{else}} + switch (securityIndex) { + {{#each security}} + {{#if @last}} + default: + return security{{@index}}; + {{else}} + case SECURITY_{{@index}}: + return security{{@index}}; + {{/if}} + {{/each}} + } + {{/eq}} + } + } + + public enum SecurityIndex { + {{#each security}} + SECURITY_{{@index}}{{#unless @last}},{{/unless}} + {{/each}} + } +} \ No newline at end of file diff --git a/src/main/resources/kotlin/src/main/kotlin/packagename/securityrequirementobjects/SecurityInfoDoc.hbs b/src/main/resources/kotlin/src/main/kotlin/packagename/securityrequirementobjects/SecurityInfoDoc.hbs new file mode 100644 index 00000000000..550d8f53493 --- /dev/null +++ b/src/main/resources/kotlin/src/main/kotlin/packagename/securityrequirementobjects/SecurityInfoDoc.hbs @@ -0,0 +1,44 @@ +{{headerSize}} {{security.jsonPathPiece.pascalCase}} +{{security.jsonPathPiece.pascalCase}}.java + +public class {{security.jsonPathPiece.pascalCase}} + +A class that provides a security requirement object, and any needed security info classes +- a class that is a SecurityRequirementObjectProvider +- an enum class that describes security index values + +{{headerSize}}# Nested Class Summary +| Modifier and Type | Class and Description | +| ----------------- | --------------------- | +| static class | [{{security.jsonPathPiece.pascalCase}}.{{security.jsonPathPiece.pascalCase}}1](#{{security.jsonPathPiece.kebabCase}}1)
SecurityRequirementObjectProvider +| enum | [{{security.jsonPathPiece.pascalCase}}.SecurityIndex](#securityindex)
class that stores a security index | + +{{headerSize}}# {{security.jsonPathPiece.pascalCase}}1 +implements SecurityRequirementObjectProvider<[SecurityIndex](#securityindex)> + +{{headerSize}}## Constructor Summary +| Constructor and Description | +| --------------------------- | +| {{security.jsonPathPiece.pascalCase}}1()
Creates an instance | + +{{headerSize}}## Field Summary +| Modifier and Type | Field and Description | +| ----------------- | --------------------- | +{{#each security}} +| [{{jsonPathPiece.pascalCase}}]({{docRoot}}{{pathFromDocRoot}}.md) | security{{@index}} | +{{/each}} + +{{headerSize}}## Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| SecurityRequirementObject | getSecurityRequirementObject(@Nullable [SecurityIndex](#securityindex) securityIndex)
If null is input, then the instance's securityIndex will be used | + +{{headerSize}}# SecurityIndex +enum SecurityIndex
+ +{{headerSize}}## Enum Constant Summary +| Enum Constant And Description | +| ----------------------------- | +{{#each security}} +| SECURITY_{{@index}}
security {{@index}} | +{{/each}} \ No newline at end of file diff --git a/src/main/resources/kotlin/src/main/kotlin/packagename/securityrequirementobjects/SecurityRequirementObject.hbs b/src/main/resources/kotlin/src/main/kotlin/packagename/securityrequirementobjects/SecurityRequirementObject.hbs new file mode 100644 index 00000000000..30eaf6f265d --- /dev/null +++ b/src/main/resources/kotlin/src/main/kotlin/packagename/securityrequirementobjects/SecurityRequirementObject.hbs @@ -0,0 +1,14 @@ +package {{{packageName}}}.securityrequirementobjects; + +import {{{packageName}}}.securityschemes.SecurityScheme; + +import java.util.List; +import java.util.Map; + +public class SecurityRequirementObject { + public final Map, List> securitySchemeToScopes; + + public SecurityRequirementObject(Map, List> securitySchemeToScopes) { + this.securitySchemeToScopes = securitySchemeToScopes; + } +} diff --git a/src/main/resources/kotlin/src/main/kotlin/packagename/securityrequirementobjects/SecurityRequirementObjectN.hbs b/src/main/resources/kotlin/src/main/kotlin/packagename/securityrequirementobjects/SecurityRequirementObjectN.hbs new file mode 100644 index 00000000000..87cab40e36b --- /dev/null +++ b/src/main/resources/kotlin/src/main/kotlin/packagename/securityrequirementobjects/SecurityRequirementObjectN.hbs @@ -0,0 +1,34 @@ +package {{{packageName}}}.{{securityRequirementObject.subpackage}}; + +{{#if securityRequirementObject.isEmpty }} +import {{{packageName}}}.securityrequirementobjects.EmptySecurityRequirementObject; + +public class {{securityRequirementObject.jsonPathPiece.pascalCase}} extends EmptySecurityRequirementObject {} +{{else}} +import org.checkerframework.checker.nullness.qual.Nullable; +import {{{packageName}}}.securityrequirementobjects.SecurityRequirementObject; +import {{{packageName}}}.securityschemes.SecurityScheme; + {{#with securityRequirementObject}} +{{> _helper_imports }} + {{/with}} + +import java.util.List; +import java.util.Map; +import java.util.AbstractMap; + +public class {{securityRequirementObject.jsonPathPiece.pascalCase}} extends SecurityRequirementObject { + + public {{securityRequirementObject.jsonPathPiece.pascalCase}}() { + super( + Map.ofEntries( + {{#each securityRequirementObject}} + new AbstractMap.SimpleEntry, List>( + {{refInfo.refClass}}.class, + List.of({{#each scopeNames}}"{{.}}"{{#unless @last}}, {{/unless}}{{/each}}) + ){{#unless @last}},{{/unless}} + {{/each}} + ) + ); + } +} +{{/if}} \ No newline at end of file diff --git a/src/main/resources/kotlin/src/main/kotlin/packagename/securityrequirementobjects/SecurityRequirementObjectNDoc.hbs b/src/main/resources/kotlin/src/main/kotlin/packagename/securityrequirementobjects/SecurityRequirementObjectNDoc.hbs new file mode 100644 index 00000000000..d87ec25d5dd --- /dev/null +++ b/src/main/resources/kotlin/src/main/kotlin/packagename/securityrequirementobjects/SecurityRequirementObjectNDoc.hbs @@ -0,0 +1,19 @@ +{{headerSize}} {{securityRequirementObject.jsonPathPiece.pascalCase}} +{{securityRequirementObject.jsonPathPiece.pascalCase}}.java + +public class {{securityRequirementObject.jsonPathPiece.pascalCase}} +{{#if securityRequirementObject.isEmpty }} +extends EmptySecurityRequirementObject +{{else}} +extends SecurityRequirementObject +{{/if}} + +{{headerSize}}## Constructor Summary +| Constructor and Description | +| --------------------------- | +| {{securityRequirementObject.jsonPathPiece.pascalCase}}()
Creates an instance | + +{{headerSize}}## Field Summary +| Modifier and Type | Field and Description | +| ----------------- | --------------------- | +| Map, List> | securitySchemeToScopes = Map.ofEntries({{#each securityRequirementObject}}
    new AbstractMap.SimpleEntry, List>(
        [{{refInfo.refClass}}.class]({{docRoot}}{{refInfo.ref.pathFromDocRoot}}.md),
        List.of({{#each scopeNames}}"{{.}}"{{#unless @last}}, {{/unless}}{{/each}})
    ){{#unless @last}},{{/unless}}{{/each}}) | diff --git a/src/main/resources/kotlin/src/main/kotlin/packagename/securityrequirementobjects/SecurityRequirementObjectProvider.hbs b/src/main/resources/kotlin/src/main/kotlin/packagename/securityrequirementobjects/SecurityRequirementObjectProvider.hbs new file mode 100644 index 00000000000..57c32dfbf6a --- /dev/null +++ b/src/main/resources/kotlin/src/main/kotlin/packagename/securityrequirementobjects/SecurityRequirementObjectProvider.hbs @@ -0,0 +1,6 @@ +package {{{packageName}}}.securityrequirementobjects; + +public interface SecurityRequirementObjectProvider { + SecurityRequirementObject getSecurityRequirementObject(T securityIndex); +} + diff --git a/src/main/resources/kotlin/src/main/kotlin/packagename/securityrequirementobjects/_SecurityRequirementObjectSetter.hbs b/src/main/resources/kotlin/src/main/kotlin/packagename/securityrequirementobjects/_SecurityRequirementObjectSetter.hbs new file mode 100644 index 00000000000..6c9385388df --- /dev/null +++ b/src/main/resources/kotlin/src/main/kotlin/packagename/securityrequirementobjects/_SecurityRequirementObjectSetter.hbs @@ -0,0 +1,5 @@ +default T {{methodName}}({{jsonPathPiece.pascalCase}} security{{@index}}) { + var instance = getInstance(); + instance.put(SecurityIndex.SECURITY_{{@index}}, security{{@index}}); + return {{getBuilderMethod}}(instance); +} diff --git a/src/main/resources/kotlin/src/main/kotlin/packagename/securityschemes/ApiKeyCookieSecurityScheme.hbs b/src/main/resources/kotlin/src/main/kotlin/packagename/securityschemes/ApiKeyCookieSecurityScheme.hbs new file mode 100644 index 00000000000..f4e62169e7d --- /dev/null +++ b/src/main/resources/kotlin/src/main/kotlin/packagename/securityschemes/ApiKeyCookieSecurityScheme.hbs @@ -0,0 +1,35 @@ +package {{{packageName}}}.securityschemes; + +import org.checkerframework.checker.nullness.qual.Nullable; + +import java.net.http.HttpRequest; +import java.util.ArrayList; +import java.util.List; +import java.util.Map; + +public class ApiKeyCookieSecurityScheme implements SecurityScheme { + private final String apiKey; + private final String name; + + protected ApiKeyCookieSecurityScheme(String apiKey, String name) { + this.apiKey = apiKey; + this.name = name; + } + + @Override + public void applyAuth( + Map> headers, + String resourcePath, String method, + HttpRequest.BodyPublisher bodyPublisher, + @Nullable Map queryMap, + List scopeNames + ) { + List cookieHeaderValues = headers.getOrDefault("Cookie", new ArrayList<>()); + String cookieValue = name + "=" + apiKey; + if (cookieHeaderValues.isEmpty()) { + cookieHeaderValues.add(cookieValue); + } else { + cookieHeaderValues.set(0, cookieHeaderValues.get(0)+ "; " + cookieValue); + } + } +} \ No newline at end of file diff --git a/src/main/resources/kotlin/src/main/kotlin/packagename/securityschemes/ApiKeyHeaderSecurityScheme.hbs b/src/main/resources/kotlin/src/main/kotlin/packagename/securityschemes/ApiKeyHeaderSecurityScheme.hbs new file mode 100644 index 00000000000..1f89a830e84 --- /dev/null +++ b/src/main/resources/kotlin/src/main/kotlin/packagename/securityschemes/ApiKeyHeaderSecurityScheme.hbs @@ -0,0 +1,31 @@ +package {{{packageName}}}.securityschemes; + +import org.checkerframework.checker.nullness.qual.Nullable; + +import java.net.http.HttpRequest; +import java.util.ArrayList; +import java.util.List; +import java.util.Map; + +public class ApiKeyHeaderSecurityScheme implements SecurityScheme { + private final String apiKey; + private final String name; + + protected ApiKeyHeaderSecurityScheme(String apiKey, String name) { + this.apiKey = apiKey; + this.name = name; + } + + @Override + public void applyAuth( + Map> headers, + String resourcePath, + String method, + HttpRequest.BodyPublisher bodyPublisher, + @Nullable Map queryMap, + List scopeNames + ) { + List headerValue = headers.getOrDefault(name, new ArrayList<>()); + headerValue.add(apiKey); + } +} \ No newline at end of file diff --git a/src/main/resources/kotlin/src/main/kotlin/packagename/securityschemes/ApiKeyQuerySecurityScheme.hbs b/src/main/resources/kotlin/src/main/kotlin/packagename/securityschemes/ApiKeyQuerySecurityScheme.hbs new file mode 100644 index 00000000000..5974935be7d --- /dev/null +++ b/src/main/resources/kotlin/src/main/kotlin/packagename/securityschemes/ApiKeyQuerySecurityScheme.hbs @@ -0,0 +1,33 @@ +package {{{packageName}}}.securityschemes; + +import org.checkerframework.checker.nullness.qual.Nullable; + +import java.net.http.HttpRequest; +import java.util.ArrayList; +import java.util.List; +import java.util.Map; + +public class ApiKeyQuerySecurityScheme implements SecurityScheme { + private final String apiKey; + private final String name; + + protected ApiKeyQuerySecurityScheme(String apiKey, String name) { + this.apiKey = apiKey; + this.name = name; + } + + @Override + public void applyAuth( + Map> headers, + String resourcePath, + String method, + HttpRequest.BodyPublisher bodyPublisher, + @Nullable Map queryMap, + List scopeNames + ) { + if (queryMap == null) { + throw new RuntimeException("Invalid null value for queryMap"); + } + queryMap.put(name, apiKey); + } +} \ No newline at end of file diff --git a/src/main/resources/kotlin/src/main/kotlin/packagename/securityschemes/HttpBasicSecurityScheme.hbs b/src/main/resources/kotlin/src/main/kotlin/packagename/securityschemes/HttpBasicSecurityScheme.hbs new file mode 100644 index 00000000000..02230c35f8e --- /dev/null +++ b/src/main/resources/kotlin/src/main/kotlin/packagename/securityschemes/HttpBasicSecurityScheme.hbs @@ -0,0 +1,39 @@ +package {{{packageName}}}.securityschemes; + +import org.checkerframework.checker.nullness.qual.Nullable; + +import java.net.http.HttpRequest; +import java.nio.charset.StandardCharsets; +import java.util.ArrayList; +import java.util.Base64; +import java.util.List; +import java.util.Map; + +public class HttpBasicSecurityScheme implements SecurityScheme { + private final String userId; + private final String password; + /* + scheme = BASIC, type = HTTP + https://www.rfc-editor.org/rfc/rfc7617.html + */ + + public HttpBasicSecurityScheme(String userId, String password) { + this.userId = userId; + this.password = password; + } + + @Override + public void applyAuth( + Map> headers, + String resourcePath, + String method, + HttpRequest.BodyPublisher bodyPublisher, + @Nullable Map queryMap, + List scopeNames + ) { + String userPass = userId + ":" + password; + String b64UserPass = Base64.getEncoder().encodeToString(userPass.getBytes(StandardCharsets.UTF_8)); + List headerValue = headers.getOrDefault("Authorization", new ArrayList<>()); + headerValue.add("Basic " + b64UserPass); + } +} \ No newline at end of file diff --git a/src/main/resources/kotlin/src/main/kotlin/packagename/securityschemes/HttpBearerSecurityScheme.hbs b/src/main/resources/kotlin/src/main/kotlin/packagename/securityschemes/HttpBearerSecurityScheme.hbs new file mode 100644 index 00000000000..ccf3c63732f --- /dev/null +++ b/src/main/resources/kotlin/src/main/kotlin/packagename/securityschemes/HttpBearerSecurityScheme.hbs @@ -0,0 +1,41 @@ +package {{{packageName}}}.securityschemes; + +import org.checkerframework.checker.nullness.qual.Nullable; + +import java.net.http.HttpRequest; +import java.util.ArrayList; +import java.util.Base64; +import java.util.List; +import java.util.Map; + +public class HttpBearerSecurityScheme implements SecurityScheme { + private final String accessToken; + private final @Nullable String bearerFormat; + /* + scheme = BEARER, type = HTTP + https://www.rfc-editor.org/rfc/rfc7617.html + */ + + protected HttpBearerSecurityScheme(String accessToken, @Nullable String bearerFormat) { + this.accessToken = accessToken; + this.bearerFormat = bearerFormat; + } + + protected HttpBearerSecurityScheme(String accessToken) { + this.accessToken = accessToken; + this.bearerFormat = null; + } + + @Override + public void applyAuth( + Map> headers, + String resourcePath, + String method, + HttpRequest.BodyPublisher bodyPublisher, + @Nullable Map queryMap, + List scopeNames + ) { + List headerValue = headers.getOrDefault("Authorization", new ArrayList<>()); + headerValue.add("Bearer " + accessToken); + } +} \ No newline at end of file diff --git a/src/main/resources/kotlin/src/main/kotlin/packagename/securityschemes/HttpDigestSecurityScheme.hbs b/src/main/resources/kotlin/src/main/kotlin/packagename/securityschemes/HttpDigestSecurityScheme.hbs new file mode 100644 index 00000000000..9b12d7b199c --- /dev/null +++ b/src/main/resources/kotlin/src/main/kotlin/packagename/securityschemes/HttpDigestSecurityScheme.hbs @@ -0,0 +1,21 @@ +package {{{packageName}}}.securityschemes; + +import org.checkerframework.checker.nullness.qual.Nullable; + +import java.net.http.HttpRequest; +import java.util.List; +import java.util.Map; + +public class HttpDigestSecurityScheme implements SecurityScheme { + @Override + public void applyAuth( + Map> headers, + String resourcePath, + String method, + HttpRequest.BodyPublisher bodyPublisher, + @Nullable Map queryMap, + List scopeNames + ) { + throw new UnsupportedOperationException("If you need this, submit a PR adding this feature"); + } +} \ No newline at end of file diff --git a/src/main/resources/kotlin/src/main/kotlin/packagename/securityschemes/HttpSignatureSecurityScheme.hbs b/src/main/resources/kotlin/src/main/kotlin/packagename/securityschemes/HttpSignatureSecurityScheme.hbs new file mode 100644 index 00000000000..b9529f505fe --- /dev/null +++ b/src/main/resources/kotlin/src/main/kotlin/packagename/securityschemes/HttpSignatureSecurityScheme.hbs @@ -0,0 +1,21 @@ +package {{{packageName}}}.securityschemes; + +import org.checkerframework.checker.nullness.qual.Nullable; + +import java.net.http.HttpRequest; +import java.util.List; +import java.util.Map; + +public class HttpSignatureSecurityScheme implements SecurityScheme { + @Override + public void applyAuth( + Map> headers, + String resourcePath, + String method, + HttpRequest.BodyPublisher bodyPublisher, + @Nullable Map queryMap, + List scopeNames + ) { + throw new UnsupportedOperationException("If you need this, submit a PR adding this feature"); + } +} \ No newline at end of file diff --git a/src/main/resources/kotlin/src/main/kotlin/packagename/securityschemes/MutualTlsSecurityScheme.hbs b/src/main/resources/kotlin/src/main/kotlin/packagename/securityschemes/MutualTlsSecurityScheme.hbs new file mode 100644 index 00000000000..4afad17948e --- /dev/null +++ b/src/main/resources/kotlin/src/main/kotlin/packagename/securityschemes/MutualTlsSecurityScheme.hbs @@ -0,0 +1,20 @@ +package {{{packageName}}}.securityschemes; + +import org.checkerframework.checker.nullness.qual.Nullable; + +import java.net.http.HttpRequest; +import java.util.List; +import java.util.Map; + +public class MutualTlsSecurityScheme implements SecurityScheme { + @Override + public void applyAuth( + Map> headers, + String resourcePath, String method, + HttpRequest.BodyPublisher bodyPublisher, + @Nullable Map queryMap, + List scopeNames + ) { + throw new UnsupportedOperationException("If you need this, submit a PR adding this feature"); + } +} \ No newline at end of file diff --git a/src/main/resources/kotlin/src/main/kotlin/packagename/securityschemes/OAuth2SecurityScheme.hbs b/src/main/resources/kotlin/src/main/kotlin/packagename/securityschemes/OAuth2SecurityScheme.hbs new file mode 100644 index 00000000000..8d42bb1a30c --- /dev/null +++ b/src/main/resources/kotlin/src/main/kotlin/packagename/securityschemes/OAuth2SecurityScheme.hbs @@ -0,0 +1,21 @@ +package {{{packageName}}}.securityschemes; + +import org.checkerframework.checker.nullness.qual.Nullable; + +import java.net.http.HttpRequest; +import java.util.List; +import java.util.Map; + +public class OAuth2SecurityScheme implements SecurityScheme { + @Override + public void applyAuth( + Map> headers, + String resourcePath, + String method, + HttpRequest.BodyPublisher bodyPublisher, + @Nullable Map queryMap, + List scopeNames + ) { + throw new UnsupportedOperationException("If you need this, submit a PR adding this feature"); + } +} \ No newline at end of file diff --git a/src/main/resources/kotlin/src/main/kotlin/packagename/securityschemes/OpenIdConnectSecurityScheme.hbs b/src/main/resources/kotlin/src/main/kotlin/packagename/securityschemes/OpenIdConnectSecurityScheme.hbs new file mode 100644 index 00000000000..a973fb94d46 --- /dev/null +++ b/src/main/resources/kotlin/src/main/kotlin/packagename/securityschemes/OpenIdConnectSecurityScheme.hbs @@ -0,0 +1,21 @@ +package {{{packageName}}}.securityschemes; + +import org.checkerframework.checker.nullness.qual.Nullable; + +import java.net.http.HttpRequest; +import java.util.List; +import java.util.Map; + +public class OpenIdConnectSecurityScheme implements SecurityScheme { + @Override + public void applyAuth( + Map> headers, + String resourcePath, + String method, + HttpRequest.BodyPublisher bodyPublisher, + @Nullable Map queryMap, + List scopeNames + ) { + throw new UnsupportedOperationException("If you need this, submit a PR adding this feature"); + } +} \ No newline at end of file diff --git a/src/main/resources/kotlin/src/main/kotlin/packagename/securityschemes/SecurityScheme.hbs b/src/main/resources/kotlin/src/main/kotlin/packagename/securityschemes/SecurityScheme.hbs new file mode 100644 index 00000000000..f058bf0f226 --- /dev/null +++ b/src/main/resources/kotlin/src/main/kotlin/packagename/securityschemes/SecurityScheme.hbs @@ -0,0 +1,19 @@ +package {{{packageName}}}.securityschemes; + +import org.checkerframework.checker.nullness.qual.Nullable; + +import java.net.http.HttpRequest; +import java.util.List; +import java.util.Map; + +public interface SecurityScheme { + void applyAuth( + Map> headers, + String resourcePath, + String method, + HttpRequest.BodyPublisher bodyPublisher, + @Nullable Map queryMap, + List scopeNames + ); +} + diff --git a/src/main/resources/kotlin/src/main/kotlin/packagename/servers/Server.hbs b/src/main/resources/kotlin/src/main/kotlin/packagename/servers/Server.hbs new file mode 100644 index 00000000000..8d8405a8cd9 --- /dev/null +++ b/src/main/resources/kotlin/src/main/kotlin/packagename/servers/Server.hbs @@ -0,0 +1,6 @@ +package {{{packageName}}}.servers; + +public interface Server { + String url(); +} + diff --git a/src/main/resources/kotlin/src/main/kotlin/packagename/servers/ServerDoc.hbs b/src/main/resources/kotlin/src/main/kotlin/packagename/servers/ServerDoc.hbs new file mode 100644 index 00000000000..36c9194f8c0 --- /dev/null +++ b/src/main/resources/kotlin/src/main/kotlin/packagename/servers/ServerDoc.hbs @@ -0,0 +1,45 @@ +{{#with server}} + {{#if rootServer}} +{{packageName}}.servers.{{jsonPathPiece.snakeCase}} + {{/if}} + {{#eq identifierPieces.size 0}} +{{> src/main/kotlin/packagename/components/_helper_header_from_identifier_pieces identifierPieces=(append identifierPieces "Server" jsonPathPiece) }} + {{else}} +{{headerSize}} {{jsonPathPiece.pascalCase}} + {{/eq}} +public class {{jsonPathPiece.pascalCase}} + +A class that stores a server url + {{#if description}} + +{{headerSize}}# Description +{{description.originalWithBr}} + {{/if}} + {{#if refInfo}} + +| Ref Class | Description | +| --------- | ----------- | +| [{{refInfo.refClass}}](../../servers/{{refInfo.refModule}}.{{refInfo.refClass}}.md#) |{{#with getDeepestRef}}{{#if description}} {{description.originalWithBr}}{{/if}}{{/with}} | + {{else}} + +{{headerSize}}## Constructor Summary +| Constructor and Description | +| --------------------------- | +| {{jsonPathPiece.pascalCase}}()
Creates a server{{#if variables}} using default values for variables{{/if}} | +{{#if variables}} +| {{jsonPathPiece.pascalCase}}({{#with variables}}[{{containerJsonPathPiece.pascalCase}}.{{mapOutputJsonPathPiece.pascalCase}}]({{docRoot}}{{pathFromDocRoot}}.md#{{mapOutputJsonPathPiece.kebabCase}}) variables{{/with}})
Creates a server using input values for variables | +{{/if}} + +{{headerSize}}## Field Summary +| Modifier and Type | Field and Description | +| ----------------- | --------------------- | +| String | url = "{{{url}}}" | +{{#with variables}} +| [{{containerJsonPathPiece.pascalCase}}.{{mapOutputJsonPathPiece.pascalCase}}]({{docRoot}}{{pathFromDocRoot}}.md#{{mapOutputJsonPathPiece.kebabCase}}) | variables | +{{/with}} + {{/if}} + {{#if rootServer}} + +[[Back to top]](#top) {{> _helper_footer_links readmePath="../../" serversLink=true}} + {{/if}} +{{/with}} \ No newline at end of file diff --git a/src/main/resources/kotlin/src/main/kotlin/packagename/servers/ServerInfo.hbs b/src/main/resources/kotlin/src/main/kotlin/packagename/servers/ServerInfo.hbs new file mode 100644 index 00000000000..5c5999cc15d --- /dev/null +++ b/src/main/resources/kotlin/src/main/kotlin/packagename/servers/ServerInfo.hbs @@ -0,0 +1,80 @@ +{{#if servers.subpackage}} +package {{{packageName}}}.{{servers.subpackage}}; +{{else}} +package {{{packageName}}}; +{{/if}} + +{{#each servers}} +import {{{packageName}}}.{{subpackage}}.{{jsonPathPiece.pascalCase}}; +{{/each}} +import {{{packageName}}}.servers.Server; +import {{{packageName}}}.servers.ServerProvider; +import org.checkerframework.checker.nullness.qual.Nullable; + +import java.util.Objects; + +public class {{servers.jsonPathPiece.pascalCase}} { + public static class {{servers.jsonPathPiece.pascalCase}}1 implements ServerProvider { + {{#each servers}} + private final {{jsonPathPiece.pascalCase}} server{{@index}}; + {{/each}} + + {{servers.jsonPathPiece.pascalCase}}1( + {{#each servers}} + @Nullable {{jsonPathPiece.pascalCase}} server{{@index}}{{#unless @last}},{{/unless}} + {{/each}} + ) { + {{#each servers}} + this.server{{@index}} = Objects.requireNonNullElseGet(server{{@index}}, {{jsonPathPiece.pascalCase}}::new); + {{/each}} + } + + @Override + 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}} + } + {{/eq}} + } + } + + public static class {{servers.jsonPathPiece.pascalCase}}Builder { + {{#each servers}} + private @Nullable {{jsonPathPiece.pascalCase}} server{{@index}}; + {{/each}} + + public {{servers.jsonPathPiece.pascalCase}}Builder() {} + {{#each servers}} + + public {{../servers.jsonPathPiece.pascalCase}}Builder {{jsonPathPiece.camelCase}}({{jsonPathPiece.pascalCase}} server{{@index}}) { + this.server{{@index}} = server{{@index}}; + return this; + } + {{/each}} + + public {{servers.jsonPathPiece.pascalCase}}1 build() { + return new {{servers.jsonPathPiece.pascalCase}}1( + {{#each servers}} + server{{@index}}{{#unless @last}},{{/unless}} + {{/each}} + ); + } + } + + public enum ServerIndex { + {{#each servers}} + SERVER_{{@index}}{{#unless @last}},{{/unless}} + {{/each}} + } +} \ No newline at end of file diff --git a/src/main/resources/kotlin/src/main/kotlin/packagename/servers/ServerInfoDoc.hbs b/src/main/resources/kotlin/src/main/kotlin/packagename/servers/ServerInfoDoc.hbs new file mode 100644 index 00000000000..b792f715dfb --- /dev/null +++ b/src/main/resources/kotlin/src/main/kotlin/packagename/servers/ServerInfoDoc.hbs @@ -0,0 +1,65 @@ +{{headerSize}} {{servers.jsonPathPiece.pascalCase}} +{{servers.jsonPathPiece.pascalCase}}.java + +public class {{servers.jsonPathPiece.pascalCase}} + +A class that provides a server, and any needed server info classes +- a class that is a ServerProvider +- a builder for the ServerProvider +- an enum class that stores server index values + +{{headerSize}}# Nested Class Summary +| Modifier and Type | Class and Description | +| ----------------- | --------------------- | +| static class | [{{servers.jsonPathPiece.pascalCase}}.{{servers.jsonPathPiece.pascalCase}}1](#{{servers.jsonPathPiece.kebabCase}}1)
class that stores a server index | +| static class | [{{servers.jsonPathPiece.pascalCase}}.{{servers.jsonPathPiece.pascalCase}}Builder](#{{servers.jsonPathPiece.kebabCase}}builder)
class that stores a server index | +| enum | [{{servers.jsonPathPiece.pascalCase}}.ServerIndex](#serverindex)
class that stores a server index | + +{{headerSize}}# {{servers.jsonPathPiece.pascalCase}}1 +implements ServerProvider<[ServerIndex](#serverindex)>
+ +A class that stores servers and allows one to be returned with a ServerIndex instance + +{{headerSize}}## Constructor Summary +| Constructor and Description | +| --------------------------- | +| {{servers.jsonPathPiece.pascalCase}}1({{#each servers}}@Nullable [{{jsonPathPiece.pascalCase}}]({{docRoot}}{{pathFromDocRoot}}.md) server{{@index}}{{#unless @last}},{{/unless}}{{/each}})
Creates an instance using passed in servers | + +{{headerSize}}## Field Summary +| Modifier and Type | Field and Description | +| ----------------- | --------------------- | +{{#each servers}} +| [{{jsonPathPiece.pascalCase}}]({{docRoot}}{{pathFromDocRoot}}.md) | server{{@index}} | +{{/each}} + +{{headerSize}}## Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| Server | getServer([ServerIndex](#serverindex) serverIndex) | + +{{headerSize}}# {{servers.jsonPathPiece.pascalCase}}Builder + +a builder for [{{servers.jsonPathPiece.pascalCase}}1](#{{servers.jsonPathPiece.kebabCase}}1) + +{{headerSize}}## Constructor Summary +| Constructor and Description | +| --------------------------- | +| {{servers.jsonPathPiece.pascalCase}}Builder()
Creates an instance | + +{{headerSize}}## Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +{{#each servers}} +| [{{servers.jsonPathPiece.pascalCase}}Builder](#{{servers.jsonPathPiece.kebabCase}}builder) | {{jsonPathPiece.camelCase}}([{{jsonPathPiece.pascalCase}}]({{docRoot}}{{pathFromDocRoot}}.md) server{{@index}})
sets the server | +{{/each}} +| [{{servers.jsonPathPiece.pascalCase}}1](#{{servers.jsonPathPiece.kebabCase}}1) | build() | + +{{headerSize}}# ServerIndex +enum ServerIndex
+ +{{headerSize}}## Enum Constant Summary +| Enum Constant And Description | +| ----------------------------- | +{{#each servers}} +| SERVER_{{@index}}
server {{@index}} | +{{/each}} \ No newline at end of file diff --git a/src/main/resources/kotlin/src/main/kotlin/packagename/servers/ServerN.hbs b/src/main/resources/kotlin/src/main/kotlin/packagename/servers/ServerN.hbs new file mode 100644 index 00000000000..0a691bd2d1b --- /dev/null +++ b/src/main/resources/kotlin/src/main/kotlin/packagename/servers/ServerN.hbs @@ -0,0 +1,63 @@ +{{#with server}} +package {{{packageName}}}.{{subpackage}}; + + {{#with variables}} +import {{{packageName}}}.configurations.JsonSchemaKeywordFlags; +import {{{packageName}}}.configurations.SchemaConfiguration; +import {{{packageName}}}.exceptions.ValidationException; + {{#neq ../subpackage "servers"}} +import {{{packageName}}}.servers.ServerWithVariables; + {{/neq}} +import {{{packageName}}}.schemas.validation.MapUtils; +import {{{packageName}}}.{{subpackage}}.{{containerJsonPathPiece.pascalCase}}; + +import java.util.AbstractMap; + +public class {{../jsonPathPiece.pascalCase}} extends ServerWithVariables<{{containerJsonPathPiece.pascalCase}}.{{mapOutputJsonPathPiece.pascalCase}}> { + {{#if ../description}} + /* + {{../description.original}} + */ + {{/if}} + private static {{containerJsonPathPiece.pascalCase}}.{{mapOutputJsonPathPiece.pascalCase}} getVariables() { + try { + return {{containerJsonPathPiece.pascalCase}}.{{jsonPathPiece.pascalCase}}.getInstance().validate( + MapUtils.makeMap( + {{#each requiredProperties}} + new AbstractMap.SimpleEntry<>("{{{@key.original}}}", {{../containerJsonPathPiece.pascalCase}}.{{jsonPathPiece.pascalCase}}.getInstance().defaultValue()){{#unless @last}},{{/unless}} + {{/each}} + ), + new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().build()) + ); + } catch (ValidationException e) { + throw new RuntimeException(e); + } + } + + public {{../jsonPathPiece.pascalCase}}() { + super( + "{{../url}}", + getVariables() + ); + } + public {{../jsonPathPiece.pascalCase}}({{containerJsonPathPiece.pascalCase}}.{{mapOutputJsonPathPiece.pascalCase}} variables) { + super("{{../url}}", variables); + } +} + {{else}} + {{#neq ../subpackage "servers"}} +import {{{packageName}}}.servers.ServerWithoutVariables; + {{/neq}} + +public class {{jsonPathPiece.pascalCase}} extends ServerWithoutVariables { + {{#if ../description}} + /* + {{../description.original}} + */ + {{/if}} + public {{jsonPathPiece.pascalCase}}() { + super("{{url}}"); + } +} + {{/with}} +{{/with}} \ No newline at end of file diff --git a/src/main/resources/kotlin/src/main/kotlin/packagename/servers/ServerProvider.hbs b/src/main/resources/kotlin/src/main/kotlin/packagename/servers/ServerProvider.hbs new file mode 100644 index 00000000000..68a0a9c4af5 --- /dev/null +++ b/src/main/resources/kotlin/src/main/kotlin/packagename/servers/ServerProvider.hbs @@ -0,0 +1,6 @@ +package {{{packageName}}}.servers; + +public interface ServerProvider { + Server getServer(T serverIndex); +} + diff --git a/src/main/resources/kotlin/src/main/kotlin/packagename/servers/ServerWithVariables.hbs b/src/main/resources/kotlin/src/main/kotlin/packagename/servers/ServerWithVariables.hbs new file mode 100644 index 00000000000..973e0d6649a --- /dev/null +++ b/src/main/resources/kotlin/src/main/kotlin/packagename/servers/ServerWithVariables.hbs @@ -0,0 +1,21 @@ +package {{{packageName}}}.servers; + +import java.util.Map; + +public abstract class ServerWithVariables> implements Server { + public final String url; + public final T variables; + + protected ServerWithVariables(String url, T variables) { + this.variables = variables; + for (Map.Entry entry: variables.entrySet()) { + url = url.replace("{" + entry.getKey() + "}", entry.getValue()); + } + this.url = url; + } + + public String url(){ + return url; + } +} + diff --git a/src/main/resources/kotlin/src/main/kotlin/packagename/servers/ServerWithoutVariables.hbs b/src/main/resources/kotlin/src/main/kotlin/packagename/servers/ServerWithoutVariables.hbs new file mode 100644 index 00000000000..8adff0b1825 --- /dev/null +++ b/src/main/resources/kotlin/src/main/kotlin/packagename/servers/ServerWithoutVariables.hbs @@ -0,0 +1,14 @@ +package {{{packageName}}}.servers; + +public abstract class ServerWithoutVariables implements Server { + public final String url; + + protected ServerWithoutVariables(String url) { + this.url = url; + } + + public String url(){ + return url; + } +} + diff --git a/src/main/resources/kotlin/src/test/kotlin/packagename/components/schemas/Schema_test.hbs b/src/main/resources/kotlin/src/test/kotlin/packagename/components/schemas/Schema_test.hbs new file mode 100644 index 00000000000..967d98d41b1 --- /dev/null +++ b/src/main/resources/kotlin/src/test/kotlin/packagename/components/schemas/Schema_test.hbs @@ -0,0 +1,56 @@ +package {{{packageName}}}.components.schemas; + +import org.junit.Assert; +import org.junit.Test; +import {{{packageName}}}.configurations.JsonSchemaKeywordFlags; +import {{{packageName}}}.configurations.SchemaConfiguration; +import {{{packageName}}}.exceptions.ValidationException; +import {{{packageName}}}.schemas.validation.MapUtils; +import org.checkerframework.checker.nullness.qual.Nullable; + +import java.util.Arrays; +import java.util.List; +import java.util.Map; +import java.util.AbstractMap; + +{{#with schema}} +public class {{containerJsonPathPiece.pascalCase}}Test { + static final SchemaConfiguration configuration = new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().format().build()); +{{#each testCases}} + {{#with this }} + + @Test + public void test{{@key}}{{#if valid}}Passes() throws ValidationException{{else}}Fails(){{/if}} { + // {{description.codeEscaped}} + final var schema = {{containerJsonPathPiece.pascalCase}}.{{jsonPathPiece.pascalCase}}.getInstance(); + {{#if valid}} + schema.validate( + {{#with data}} + {{#and (eq type "array") ../arrayInputJsonPathPiece }} + new {{../containerJsonPathPiece.pascalCase}}.{{../arrayInputJsonPathPiece.pascalCase}}() + {{> src/main/kotlin/packagename/components/schemas/helpers/payload_renderer constructor=true endChar="" }} + .build(), + {{else}} + {{> src/main/kotlin/packagename/components/schemas/helpers/payload_renderer endChar="," }} + {{/and}} + {{/with}} + configuration + ); + {{else}} + try { + schema.validate( + {{#with data}} + {{> src/main/kotlin/packagename/components/schemas/helpers/payload_renderer endChar="," }} + {{/with}} + configuration + ); + throw new RuntimeException("A different exception must be thrown"); + } catch (ValidationException ignored) { + ; + } + {{/if}} + } + {{/with}} +{{/each}} +{{/with}} +} diff --git a/src/main/resources/kotlin/src/test/kotlin/packagename/configurations/JsonSchemaKeywordFlagsTest.hbs b/src/main/resources/kotlin/src/test/kotlin/packagename/configurations/JsonSchemaKeywordFlagsTest.hbs new file mode 100644 index 00000000000..273bcca5ce8 --- /dev/null +++ b/src/main/resources/kotlin/src/test/kotlin/packagename/configurations/JsonSchemaKeywordFlagsTest.hbs @@ -0,0 +1,143 @@ +package {{{packageName}}}.configurations; + +import org.junit.Assert; +import org.junit.Test; +import java.util.LinkedHashSet; + +public final class JsonSchemaKeywordFlagsTest { + + @Test + public void testGetEnabledKeywords() { + final JsonSchemaKeywordFlags jsonSchemaKeywordFlags = new JsonSchemaKeywordFlags( + true, + true, + true, + true, + true, + true, + true, + true, + true, + true, + true, + true, + true, + true, + true, + true, + true, + true, + true, + true, + true, + true, + true, + true, + true, + true, + true, + true, + true, + true, + true, + true, + true, + true, + true, + true, + true, + true, + true + ); + LinkedHashSet enabledKeywords = jsonSchemaKeywordFlags.getKeywords(); + LinkedHashSet expectedEnabledKeywords = new LinkedHashSet<>(); + expectedEnabledKeywords.add("additionalProperties"); + expectedEnabledKeywords.add("allOf"); + expectedEnabledKeywords.add("anyOf"); + expectedEnabledKeywords.add("const"); + expectedEnabledKeywords.add("contains"); + expectedEnabledKeywords.add("dependentRequired"); + expectedEnabledKeywords.add("dependentSchemas"); + expectedEnabledKeywords.add("discriminator"); + expectedEnabledKeywords.add("else_"); + expectedEnabledKeywords.add("enum_"); + expectedEnabledKeywords.add("exclusiveMaximum"); + expectedEnabledKeywords.add("exclusiveMinimum"); + expectedEnabledKeywords.add("format"); + expectedEnabledKeywords.add("if_"); + expectedEnabledKeywords.add("maximum"); + expectedEnabledKeywords.add("minimum"); + expectedEnabledKeywords.add("items"); + expectedEnabledKeywords.add("maxContains"); + expectedEnabledKeywords.add("maxItems"); + expectedEnabledKeywords.add("maxLength"); + expectedEnabledKeywords.add("maxProperties"); + expectedEnabledKeywords.add("minContains"); + expectedEnabledKeywords.add("minItems"); + expectedEnabledKeywords.add("minLength"); + expectedEnabledKeywords.add("minProperties"); + expectedEnabledKeywords.add("multipleOf"); + expectedEnabledKeywords.add("not"); + expectedEnabledKeywords.add("oneOf"); + expectedEnabledKeywords.add("pattern"); + expectedEnabledKeywords.add("patternProperties"); + expectedEnabledKeywords.add("prefixItems"); + expectedEnabledKeywords.add("properties"); + expectedEnabledKeywords.add("propertyNames"); + expectedEnabledKeywords.add("required"); + expectedEnabledKeywords.add("then"); + expectedEnabledKeywords.add("type"); + expectedEnabledKeywords.add("uniqueItems"); + expectedEnabledKeywords.add("unevaluatedItems"); + expectedEnabledKeywords.add("unevaluatedProperties"); + Assert.assertEquals(enabledKeywords, expectedEnabledKeywords); + } + + @Test + public void testGetNoEnabledKeywords() { + final JsonSchemaKeywordFlags jsonSchemaKeywordFlags = new JsonSchemaKeywordFlags( + false, + false, + false, + false, + false, + false, + false, + false, + false, + false, + false, + false, + false, + false, + false, + false, + false, + false, + false, + false, + false, + false, + false, + false, + false, + false, + false, + false, + false, + false, + false, + false, + false, + false, + false, + false, + false, + false, + false + ); + LinkedHashSet enabledKeywords = jsonSchemaKeywordFlags.getKeywords(); + LinkedHashSet expectedEnabledKeywords = new LinkedHashSet<>(); + Assert.assertEquals(enabledKeywords, expectedEnabledKeywords); + } +} diff --git a/src/main/resources/kotlin/src/test/kotlin/packagename/header/ContentHeaderTest.hbs b/src/main/resources/kotlin/src/test/kotlin/packagename/header/ContentHeaderTest.hbs new file mode 100644 index 00000000000..c6e8a86263a --- /dev/null +++ b/src/main/resources/kotlin/src/test/kotlin/packagename/header/ContentHeaderTest.hbs @@ -0,0 +1,120 @@ +package {{{packageName}}}.header; + +import org.checkerframework.checker.nullness.qual.Nullable; +import org.junit.Assert; +import org.junit.Test; +import {{{packageName}}}.configurations.JsonSchemaKeywordFlags; +import {{{packageName}}}.configurations.SchemaConfiguration; +import {{{packageName}}}.exceptions.ValidationException; +import {{{packageName}}}.exceptions.NotImplementedException; +import {{{packageName}}}.mediatype.MediaType; +import {{{packageName}}}.schemas.AnyTypeJsonSchema; + +import java.net.http.HttpHeaders; +import java.util.AbstractMap; +import java.util.LinkedHashMap; +import java.util.List; +import java.util.Map; +import java.util.function.BiPredicate; + +public class ContentHeaderTest { + public record ParamTestCase(@Nullable Object payload, Map> expectedSerialization, @Nullable Boolean explode) { + public ParamTestCase(@Nullable Object payload, Map> expectedSerialization) { + this(payload, expectedSerialization, null); + } + } + + @Test + public void testSerialization() throws ValidationException, NotImplementedException { + var mapPayload = new LinkedHashMap(); + mapPayload.put("R", 100); + mapPayload.put("G", 200); + mapPayload.put("B", 150); + List testCases = List.of( + new ParamTestCase( + null, + Map.of("color", List.of("null")) + ), + new ParamTestCase( + true, + Map.of("color", List.of("true")) + ), + new ParamTestCase( + false, + Map.of("color", List.of("false")) + ), + new ParamTestCase( + 1, + Map.of("color", List.of("1")) + ), + new ParamTestCase( + 3.14, + Map.of("color",List.of("3.14")) + ), + new ParamTestCase( + "blue", + Map.of("color", List.of("\"blue\"")) + ), + new ParamTestCase( + "hello world", + Map.of("color", List.of("\"hello world\"")) + ), + new ParamTestCase( + "", + Map.of("color", List.of("\"\"")) + ), + new ParamTestCase( + List.of(), + Map.of("color", List.of("[]")) + ), + new ParamTestCase( + List.of("blue", "black", "brown"), + Map.of("color", List.of("[\"blue\",\"black\",\"brown\"]")) + ), + new ParamTestCase( + List.of("blue", "black", "brown"), + Map.of("color", List.of("[\"blue\",\"black\",\"brown\"]")), + true + ), + new ParamTestCase( + Map.of(), + Map.of("color", List.of("{}")) + ), + new ParamTestCase( + mapPayload, + Map.of("color", List.of("{\"R\":100,\"G\":200,\"B\":150}")) + ), + new ParamTestCase( + mapPayload, + Map.of("color", List.of("{\"R\":100,\"G\":200,\"B\":150}")), + true + ) + ); + SchemaConfiguration configuration = new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().build()); + BiPredicate headerFilter = (key, val) -> true; + class ApplicationJsonMediaType implements MediaType { + @Override + public AnyTypeJsonSchema.AnyTypeJsonSchema1 schema() { + return AnyTypeJsonSchema.AnyTypeJsonSchema1.getInstance(); + } + + @Override + public Nothing? encoding() { + return null; + } + } + AbstractMap.SimpleEntry> content = new AbstractMap.SimpleEntry<>( + "application/json", new ApplicationJsonMediaType() + ); + for (ParamTestCase testCase: testCases) { + var header = new ContentHeader( + true, + false, + testCase.explode, + content + ); + var serialization = header.serialize(testCase.payload, "color", false, configuration); + Assert.assertEquals(HttpHeaders.of(testCase.expectedSerialization, headerFilter), serialization); + } + } +} diff --git a/src/main/resources/kotlin/src/test/kotlin/packagename/header/SchemaHeaderTest.hbs b/src/main/resources/kotlin/src/test/kotlin/packagename/header/SchemaHeaderTest.hbs new file mode 100644 index 00000000000..c0404ccc143 --- /dev/null +++ b/src/main/resources/kotlin/src/test/kotlin/packagename/header/SchemaHeaderTest.hbs @@ -0,0 +1,177 @@ +package {{{packageName}}}.header; + +import org.checkerframework.checker.nullness.qual.Nullable; +import org.junit.Assert; +import org.junit.Test; +import {{{packageName}}}.configurations.JsonSchemaKeywordFlags; +import {{{packageName}}}.configurations.SchemaConfiguration; +import {{{packageName}}}.exceptions.ValidationException; +import {{{packageName}}}.exceptions.NotImplementedException; +import {{{packageName}}}.schemas.AnyTypeJsonSchema; +import {{{packageName}}}.schemas.ListJsonSchema; +import {{{packageName}}}.schemas.NullJsonSchema; +import {{{packageName}}}.schemas.NumberJsonSchema; +import {{{packageName}}}.schemas.StringJsonSchema; +import {{{packageName}}}.schemas.validation.JsonSchema; + +import java.net.http.HttpHeaders; +import java.util.LinkedHashMap; +import java.util.List; +import java.util.Map; +import java.util.Set; +import java.util.function.BiPredicate; + +public class SchemaHeaderTest { + public record ParamTestCase(@Nullable Object payload, Map> expectedSerialization, @Nullable Boolean explode) { + public ParamTestCase(@Nullable Object payload, Map> expectedSerialization) { + this(payload, expectedSerialization, null); + } + } + + @Test + public void testSerialization() throws ValidationException, NotImplementedException { + var mapPayload = new LinkedHashMap(); + mapPayload.put("R", 100); + mapPayload.put("G", 200); + mapPayload.put("B", 150); + List testCases = List.of( + new ParamTestCase( + null, + Map.of("color", List.of("")) + ), + new ParamTestCase( + 1, + Map.of("color", List.of("1")) + ), + new ParamTestCase( + 3.14, + Map.of("color",List.of("3.14")) + ), + new ParamTestCase( + "blue", + Map.of("color", List.of("blue")) + ), + new ParamTestCase( + "hello world", + Map.of("color", List.of("hello world")) + ), + new ParamTestCase( + "", + Map.of("color", List.of("")) + ), + new ParamTestCase( + List.of(), + Map.of("color", List.of("")) + ), + new ParamTestCase( + List.of("blue", "black", "brown"), + Map.of("color", List.of("blue,black,brown")) + ), + new ParamTestCase( + List.of("blue", "black", "brown"), + Map.of("color", List.of("blue,black,brown")), + true + ), + new ParamTestCase( + Map.of(), + Map.of("color", List.of("")) + ), + new ParamTestCase( + mapPayload, + Map.of("color", List.of("R,100,G,200,B,150")) + ), + new ParamTestCase( + mapPayload, + Map.of("color", List.of("R=100,G=200,B=150")), + true + ) + ); + SchemaConfiguration configuration = new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().build()); + BiPredicate headerFilter = (key, val) -> true; + for (ParamTestCase testCase: testCases) { + var header = new SchemaHeader( + true, + false, + testCase.explode, + AnyTypeJsonSchema.AnyTypeJsonSchema1.getInstance() + ); + var serialization = header.serialize(testCase.payload, "color", false, configuration); + Assert.assertEquals(HttpHeaders.of(testCase.expectedSerialization, headerFilter), serialization); + } + SchemaHeader boolHeader = new SchemaHeader( + true, + false, + false, + AnyTypeJsonSchema.AnyTypeJsonSchema1.getInstance() + ); + for (boolean value: Set.of(true, false)) { + Assert.assertThrows( + NotImplementedException.class, + () -> boolHeader.serialize(value, "color", false, configuration) + ); + } + } + + private static SchemaHeader getHeader(JsonSchema schema) { + return new SchemaHeader( + true, + false, + false, + schema + ); + } + + @SuppressWarnings("nullness") + private void assertNull(@Nullable Object object) { + Assert.assertNull(object); + } + + @Test + public void testDeserialization() throws ValidationException, NotImplementedException { + SchemaConfiguration configuration = new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().build()); + + SchemaHeader header = getHeader(NullJsonSchema.NullJsonSchema1.getInstance()); + @Nullable Object deserialized = header.deserialize(List.of(""), false, configuration); + assertNull(deserialized); + + header = getHeader(NumberJsonSchema.NumberJsonSchema1.getInstance()); + var deserializedOne = header.deserialize(List.of("1"), false, configuration); + if (deserializedOne == null) { + throw new RuntimeException("invalid value"); + } + @Nullable Object expected = 1L; + Assert.assertEquals(expected, deserializedOne); + + header = getHeader(NumberJsonSchema.NumberJsonSchema1.getInstance()); + var deserialized314 = header.deserialize(List.of("3.14"), false, configuration); + if (deserialized314 == null) { + throw new RuntimeException("invalid value"); + } + expected = 3.14d; + Assert.assertEquals(expected, deserialized314); + + header = getHeader(StringJsonSchema.StringJsonSchema1.getInstance()); + var deserializedBlue = header.deserialize(List.of("blue"), false, configuration); + if (deserializedBlue == null) { + throw new RuntimeException("invalid value"); + } + expected = "blue"; + Assert.assertEquals(expected, deserializedBlue); + + header = getHeader(StringJsonSchema.StringJsonSchema1.getInstance()); + var deserializedHelloWorld = header.deserialize(List.of("hello world"), false, configuration); + if (deserializedHelloWorld == null) { + throw new RuntimeException("invalid value"); + } + expected = "hello world"; + Assert.assertEquals(expected, deserializedHelloWorld); + + header = getHeader(ListJsonSchema.ListJsonSchema1.getInstance()); + var deserializedList = header.deserialize(List.of("blue", "black", "brown"), false, configuration); + if (deserializedList == null) { + throw new RuntimeException("invalid value"); + } + expected = List.of("blue", "black", "brown"); + Assert.assertEquals(expected, deserializedList); + } +} diff --git a/src/main/resources/kotlin/src/test/kotlin/packagename/parameter/CookieSerializerTest.hbs b/src/main/resources/kotlin/src/test/kotlin/packagename/parameter/CookieSerializerTest.hbs new file mode 100644 index 00000000000..fae1fcca373 --- /dev/null +++ b/src/main/resources/kotlin/src/test/kotlin/packagename/parameter/CookieSerializerTest.hbs @@ -0,0 +1,45 @@ +package {{{packageName}}}.parameter; + +import org.junit.Assert; +import org.junit.Test; +import {{{packageName}}}.exceptions.NotImplementedException; +import {{{packageName}}}.schemas.AnyTypeJsonSchema; + +import java.util.AbstractMap; +import java.util.Map; + +public class CookieSerializerTest { + public static class Parameter1 extends SchemaParameter { + public Parameter1() { + super("param1", ParameterInType.COOKIE, true, null, null, null, AnyTypeJsonSchema.AnyTypeJsonSchema1.getInstance()); + } + } + + public static class Parameter2 extends SchemaParameter { + public Parameter2() { + super("param2", ParameterInType.COOKIE, true, null, null, null, AnyTypeJsonSchema.AnyTypeJsonSchema1.getInstance()); + } + } + + public static class CookieParametersSerializer extends CookieSerializer { + protected CookieParametersSerializer() { + super( + Map.ofEntries( + new AbstractMap.SimpleEntry<>("param1", new Parameter1()), + new AbstractMap.SimpleEntry<>("param2", new Parameter2()) + ) + ); + } + } + + @Test + public void testSerialization() throws NotImplementedException { + Map inData = Map.ofEntries( + new AbstractMap.SimpleEntry<>("param1", "a"), + new AbstractMap.SimpleEntry<>("param2", 3.14d) + ); + String cookie = new CookieParametersSerializer().serialize(inData); + String expectedCookie = "param1=a; param2=3.14"; + Assert.assertEquals(expectedCookie, cookie); + } +} \ No newline at end of file diff --git a/src/main/resources/kotlin/src/test/kotlin/packagename/parameter/HeadersSerializerTest.hbs b/src/main/resources/kotlin/src/test/kotlin/packagename/parameter/HeadersSerializerTest.hbs new file mode 100644 index 00000000000..6d3f5c2594c --- /dev/null +++ b/src/main/resources/kotlin/src/test/kotlin/packagename/parameter/HeadersSerializerTest.hbs @@ -0,0 +1,49 @@ +package {{{packageName}}}.parameter; + +import org.junit.Assert; +import org.junit.Test; +import {{{packageName}}}.exceptions.NotImplementedException; +import {{{packageName}}}.schemas.AnyTypeJsonSchema; + +import java.util.AbstractMap; +import java.util.Map; +import java.util.List; + +public class HeadersSerializerTest { + public static class Param1HeaderParameter extends SchemaParameter { + public Param1HeaderParameter() { + super("param1", ParameterInType.HEADER, true, null, null, null, AnyTypeJsonSchema.AnyTypeJsonSchema1.getInstance()); + } + } + + public static class Param2HeaderParameter extends SchemaParameter { + public Param2HeaderParameter() { + super("param2", ParameterInType.HEADER, true, null, null, null, AnyTypeJsonSchema.AnyTypeJsonSchema1.getInstance()); + } + } + + public static class HeaderParametersSerializer extends HeadersSerializer { + protected HeaderParametersSerializer() { + super( + Map.ofEntries( + new AbstractMap.SimpleEntry<>("param1", new Param1HeaderParameter()), + new AbstractMap.SimpleEntry<>("param2", new Param2HeaderParameter()) + ) + ); + } + } + + @Test + public void testSerialization() throws NotImplementedException { + Map inData = Map.ofEntries( + new AbstractMap.SimpleEntry<>("param1", "a"), + new AbstractMap.SimpleEntry<>("param2", 3.14d) + ); + Map> expectedHeaders = Map.ofEntries( + new AbstractMap.SimpleEntry<>("param1", List.of("a")), + new AbstractMap.SimpleEntry<>("param2", List.of("3.14")) + ); + Map> headers = new HeaderParametersSerializer().serialize(inData); + Assert.assertEquals(expectedHeaders, headers); + } +} \ No newline at end of file diff --git a/src/main/resources/kotlin/src/test/kotlin/packagename/parameter/PathSerializerTest.hbs b/src/main/resources/kotlin/src/test/kotlin/packagename/parameter/PathSerializerTest.hbs new file mode 100644 index 00000000000..4d69c221e56 --- /dev/null +++ b/src/main/resources/kotlin/src/test/kotlin/packagename/parameter/PathSerializerTest.hbs @@ -0,0 +1,46 @@ +package {{{packageName}}}.parameter; + +import org.junit.Assert; +import org.junit.Test; +import {{{packageName}}}.exceptions.NotImplementedException; +import {{{packageName}}}.schemas.AnyTypeJsonSchema; + +import java.util.AbstractMap; +import java.util.Map; + +public class PathSerializerTest { + public static class Parameter1 extends SchemaParameter { + public Parameter1() { + super("param1", ParameterInType.PATH, true, null, null, null, AnyTypeJsonSchema.AnyTypeJsonSchema1.getInstance()); + } + } + + public static class Parameter2 extends SchemaParameter { + public Parameter2() { + super("param2", ParameterInType.PATH, true, null, null, null, AnyTypeJsonSchema.AnyTypeJsonSchema1.getInstance()); + } + } + + public static class PathParametersSerializer extends PathSerializer { + protected PathParametersSerializer() { + super( + Map.ofEntries( + new AbstractMap.SimpleEntry<>("param1", new Parameter1()), + new AbstractMap.SimpleEntry<>("param2", new Parameter2()) + ) + ); + } + } + + @Test + public void testSerialization() throws NotImplementedException { + Map inData = Map.ofEntries( + new AbstractMap.SimpleEntry<>("param1", "a"), + new AbstractMap.SimpleEntry<>("param2", 3.14d) + ); + String pathWithPlaceholders = "/{param1}/{param2}"; + String path = new PathParametersSerializer().serialize(inData, pathWithPlaceholders); + String expectedPath = "/a/3.14"; + Assert.assertEquals(expectedPath, path); + } +} \ No newline at end of file diff --git a/src/main/resources/kotlin/src/test/kotlin/packagename/parameter/QuerySerializerTest.hbs b/src/main/resources/kotlin/src/test/kotlin/packagename/parameter/QuerySerializerTest.hbs new file mode 100644 index 00000000000..5b7109bd38f --- /dev/null +++ b/src/main/resources/kotlin/src/test/kotlin/packagename/parameter/QuerySerializerTest.hbs @@ -0,0 +1,52 @@ +package {{{packageName}}}.parameter; + +import org.junit.Assert; +import org.junit.Test; +import {{{packageName}}}.exceptions.NotImplementedException; +import {{{packageName}}}.schemas.AnyTypeJsonSchema; + +import java.util.AbstractMap; +import java.util.Map; + +public class QuerySerializerTest { + public static class Param1QueryParameter extends SchemaParameter { + public Param1QueryParameter() { + super("param1", ParameterInType.QUERY, true, null, null, null, AnyTypeJsonSchema.AnyTypeJsonSchema1.getInstance()); + } + } + + public static class Param2QueryParameter extends SchemaParameter { + public Param2QueryParameter() { + super("param2", ParameterInType.QUERY, true, null, null, null, AnyTypeJsonSchema.AnyTypeJsonSchema1.getInstance()); + } + } + + public static class QueryParametersSerializer extends QuerySerializer { + protected QueryParametersSerializer() { + super( + Map.ofEntries( + new AbstractMap.SimpleEntry<>("param1", new Param1QueryParameter()), + new AbstractMap.SimpleEntry<>("param2", new Param2QueryParameter()) + ) + ); + } + } + + @Test + public void testSerialization() throws NotImplementedException { + Map inData = Map.ofEntries( + new AbstractMap.SimpleEntry<>("param1", "a"), + new AbstractMap.SimpleEntry<>("param2", 3.14d) + ); + var serializer = new QueryParametersSerializer(); + var queryMap = serializer.getQueryMap(inData); + Map expectedQueryMap = Map.ofEntries( + new AbstractMap.SimpleEntry<>("param1", "param1=a"), + new AbstractMap.SimpleEntry<>("param2", "param2=3.14") + ); + Assert.assertEquals(expectedQueryMap, queryMap); + String query = serializer.serialize(queryMap); + String expectedQuery = "?param1=a¶m2=3.14"; + Assert.assertEquals(expectedQuery, query); + } +} \ No newline at end of file diff --git a/src/main/resources/kotlin/src/test/kotlin/packagename/parameter/SchemaNonQueryParameterTest.hbs b/src/main/resources/kotlin/src/test/kotlin/packagename/parameter/SchemaNonQueryParameterTest.hbs new file mode 100644 index 00000000000..f0b9a7c1aa6 --- /dev/null +++ b/src/main/resources/kotlin/src/test/kotlin/packagename/parameter/SchemaNonQueryParameterTest.hbs @@ -0,0 +1,397 @@ +package {{{packageName}}}.parameter; + +import org.checkerframework.checker.nullness.qual.Nullable; +import org.junit.Assert; +import org.junit.Test; +import {{{packageName}}}.exceptions.NotImplementedException; +import {{{packageName}}}.schemas.AnyTypeJsonSchema; + +import java.util.LinkedHashMap; +import java.util.List; +import java.util.Map; +import java.util.AbstractMap; +import java.util.Set; + +public class SchemaNonQueryParameterTest { + public record ParamTestCase(@Nullable Object payload, AbstractMap.SimpleEntry expectedSerialization, @Nullable Boolean explode) { + public ParamTestCase(@Nullable Object payload, AbstractMap.SimpleEntry expectedSerialization) { + this(payload, expectedSerialization, null); + } + } + + public static class HeaderParameter extends SchemaParameter { + public HeaderParameter(@Nullable Boolean explode) { + super("color", ParameterInType.HEADER, true, null, explode, null, AnyTypeJsonSchema.AnyTypeJsonSchema1.getInstance()); + } + } + + @Test + public void testHeaderSerialization() throws NotImplementedException { + var mapPayload = new LinkedHashMap(); + mapPayload.put("R", 100); + mapPayload.put("G", 200); + mapPayload.put("B", 150); + List testCases = List.of( + new ParamTestCase( + null, + new AbstractMap.SimpleEntry<>("color", "") + ), + new ParamTestCase( + 1, + new AbstractMap.SimpleEntry<>("color", "1") + ), + new ParamTestCase( + 3.14, + new AbstractMap.SimpleEntry<>("color","3.14") + ), + new ParamTestCase( + "blue", + new AbstractMap.SimpleEntry<>("color", "blue") + ), + new ParamTestCase( + "hello world", + new AbstractMap.SimpleEntry<>("color", "hello world") + ), + new ParamTestCase( + "", + new AbstractMap.SimpleEntry<>("color", "") + ), + new ParamTestCase( + List.of(), + new AbstractMap.SimpleEntry<>("color", "") + ), + new ParamTestCase( + List.of("blue", "black", "brown"), + new AbstractMap.SimpleEntry<>("color", "blue,black,brown") + ), + new ParamTestCase( + List.of("blue", "black", "brown"), + new AbstractMap.SimpleEntry<>("color", "blue,black,brown"), + true + ), + new ParamTestCase( + Map.of(), + new AbstractMap.SimpleEntry<>("color", "") + ), + new ParamTestCase( + mapPayload, + new AbstractMap.SimpleEntry<>("color", "R,100,G,200,B,150") + ), + new ParamTestCase( + mapPayload, + new AbstractMap.SimpleEntry<>("color", "R=100,G=200,B=150"), + true + ) + ); + for (ParamTestCase testCase: testCases) { + var header = new HeaderParameter(testCase.explode); + var serialization = header.serialize(testCase.payload); + Assert.assertEquals(testCase.expectedSerialization, serialization); + } + var boolHeader = new HeaderParameter(false); + for (boolean value: Set.of(true, false)) { + Assert.assertThrows( + NotImplementedException.class, + () -> boolHeader.serialize(value) + ); + } + } + + public static class PathParameter extends SchemaParameter { + public PathParameter(@Nullable Boolean explode) { + super("color", ParameterInType.PATH, true, null, explode, null, AnyTypeJsonSchema.AnyTypeJsonSchema1.getInstance()); + } + } + + @Test + public void testPathSerialization() throws NotImplementedException { + var mapPayload = new LinkedHashMap(); + mapPayload.put("R", 100); + mapPayload.put("G", 200); + mapPayload.put("B", 150); + List testCases = List.of( + new ParamTestCase( + null, + new AbstractMap.SimpleEntry<>("color", "") + ), + new ParamTestCase( + 1, + new AbstractMap.SimpleEntry<>("color", "1") + ), + new ParamTestCase( + 3.14, + new AbstractMap.SimpleEntry<>("color","3.14") + ), + new ParamTestCase( + "blue", + new AbstractMap.SimpleEntry<>("color", "blue") + ), + new ParamTestCase( + "hello world", + new AbstractMap.SimpleEntry<>("color", "hello%20world") + ), + new ParamTestCase( + "", + new AbstractMap.SimpleEntry<>("color", "") + ), + new ParamTestCase( + List.of(), + new AbstractMap.SimpleEntry<>("color", "") + ), + new ParamTestCase( + List.of("blue", "black", "brown"), + new AbstractMap.SimpleEntry<>("color", "blue,black,brown") + ), + new ParamTestCase( + List.of("blue", "black", "brown"), + new AbstractMap.SimpleEntry<>("color", "blue,black,brown"), + true + ), + new ParamTestCase( + Map.of(), + new AbstractMap.SimpleEntry<>("color", "") + ), + new ParamTestCase( + mapPayload, + new AbstractMap.SimpleEntry<>("color", "R,100,G,200,B,150") + ), + new ParamTestCase( + mapPayload, + new AbstractMap.SimpleEntry<>("color", "R=100,G=200,B=150"), + true + ) + ); + for (ParamTestCase testCase: testCases) { + var pathParameter = new PathParameter(testCase.explode); + var serialization = pathParameter.serialize(testCase.payload); + Assert.assertEquals(testCase.expectedSerialization, serialization); + } + var pathParameter = new PathParameter(false); + for (boolean value: Set.of(true, false)) { + Assert.assertThrows( + NotImplementedException.class, + () -> pathParameter.serialize(value) + ); + } + } + + public static class CookieParameter extends SchemaParameter { + public CookieParameter(@Nullable Boolean explode) { + super("color", ParameterInType.COOKIE, true, null, explode, null, AnyTypeJsonSchema.AnyTypeJsonSchema1.getInstance()); + } + } + + @Test + public void testCookieSerialization() throws NotImplementedException { + var mapPayload = new LinkedHashMap(); + mapPayload.put("R", 100); + mapPayload.put("G", 200); + mapPayload.put("B", 150); + List testCases = List.of( + new ParamTestCase( + null, + new AbstractMap.SimpleEntry<>("color", "") + ), + new ParamTestCase( + 1, + new AbstractMap.SimpleEntry<>("color", "color=1") + ), + new ParamTestCase( + 3.14, + new AbstractMap.SimpleEntry<>("color","color=3.14") + ), + new ParamTestCase( + "blue", + new AbstractMap.SimpleEntry<>("color", "color=blue") + ), + new ParamTestCase( + "hello world", + new AbstractMap.SimpleEntry<>("color", "color=hello world") + ), + new ParamTestCase( + "", + new AbstractMap.SimpleEntry<>("color", "color=") + ), + new ParamTestCase( + List.of(), + new AbstractMap.SimpleEntry<>("color", "") + ), + new ParamTestCase( + List.of("blue", "black", "brown"), + new AbstractMap.SimpleEntry<>("color", "color=blue&color=black&color=brown") + ), + new ParamTestCase( + List.of("blue", "black", "brown"), + new AbstractMap.SimpleEntry<>("color", "color=blue&color=black&color=brown"), + true + ), + new ParamTestCase( + Map.of(), + new AbstractMap.SimpleEntry<>("color", "") + ), + new ParamTestCase( + mapPayload, + new AbstractMap.SimpleEntry<>("color", "R=100&G=200&B=150") + ), + new ParamTestCase( + mapPayload, + new AbstractMap.SimpleEntry<>("color", "R=100&G=200&B=150"), + true + ) + ); + for (ParamTestCase testCase: testCases) { + var cookieParameter = new CookieParameter(testCase.explode); + var serialization = cookieParameter.serialize(testCase.payload); + Assert.assertEquals(testCase.expectedSerialization, serialization); + } + var cookieParameter = new CookieParameter(false); + for (boolean value: Set.of(true, false)) { + Assert.assertThrows( + NotImplementedException.class, + () -> cookieParameter.serialize(value) + ); + } + } + + public static class PathMatrixParameter extends SchemaParameter { + public PathMatrixParameter(@Nullable Boolean explode) { + super("color", ParameterInType.PATH, true, ParameterStyle.MATRIX, explode, null, AnyTypeJsonSchema.AnyTypeJsonSchema1.getInstance()); + } + } + + @Test + public void testPathMatrixSerialization() throws NotImplementedException { + var mapPayload = new LinkedHashMap(); + mapPayload.put("R", 100); + mapPayload.put("G", 200); + mapPayload.put("B", 150); + List testCases = List.of( + new ParamTestCase( + null, + new AbstractMap.SimpleEntry<>("color", "") + ), + new ParamTestCase( + 1, + new AbstractMap.SimpleEntry<>("color", ";color=1") + ), + new ParamTestCase( + 3.14, + new AbstractMap.SimpleEntry<>("color",";color=3.14") + ), + new ParamTestCase( + "blue", + new AbstractMap.SimpleEntry<>("color", ";color=blue") + ), + new ParamTestCase( + "hello world", + new AbstractMap.SimpleEntry<>("color", ";color=hello%20world") + ), + new ParamTestCase( + "", + new AbstractMap.SimpleEntry<>("color", ";color") + ), + new ParamTestCase( + List.of(), + new AbstractMap.SimpleEntry<>("color", "") + ), + new ParamTestCase( + List.of("blue", "black", "brown"), + new AbstractMap.SimpleEntry<>("color", ";color=blue,black,brown") + ), + new ParamTestCase( + List.of("blue", "black", "brown"), + new AbstractMap.SimpleEntry<>("color", ";color=blue;color=black;color=brown"), + true + ), + new ParamTestCase( + Map.of(), + new AbstractMap.SimpleEntry<>("color", "") + ), + new ParamTestCase( + mapPayload, + new AbstractMap.SimpleEntry<>("color", ";color=R,100,G,200,B,150") + ), + new ParamTestCase( + mapPayload, + new AbstractMap.SimpleEntry<>("color", ";R=100;G=200;B=150"), + true + ) + ); + for (ParamTestCase testCase: testCases) { + var pathParameter = new PathMatrixParameter(testCase.explode); + var serialization = pathParameter.serialize(testCase.payload); + Assert.assertEquals(testCase.expectedSerialization, serialization); + } + } + + public static class PathLabelParameter extends SchemaParameter { + public PathLabelParameter(@Nullable Boolean explode) { + super("color", ParameterInType.PATH, true, ParameterStyle.LABEL, explode, null, AnyTypeJsonSchema.AnyTypeJsonSchema1.getInstance()); + } + } + + @Test + public void testPathLabelSerialization() throws NotImplementedException { + var mapPayload = new LinkedHashMap(); + mapPayload.put("R", 100); + mapPayload.put("G", 200); + mapPayload.put("B", 150); + List testCases = List.of( + new ParamTestCase( + null, + new AbstractMap.SimpleEntry<>("color", "") + ), + new ParamTestCase( + 1, + new AbstractMap.SimpleEntry<>("color", ".1") + ), + new ParamTestCase( + 3.14, + new AbstractMap.SimpleEntry<>("color",".3.14") + ), + new ParamTestCase( + "blue", + new AbstractMap.SimpleEntry<>("color", ".blue") + ), + new ParamTestCase( + "hello world", + new AbstractMap.SimpleEntry<>("color", ".hello%20world") + ), + new ParamTestCase( + "", + new AbstractMap.SimpleEntry<>("color", ".") + ), + new ParamTestCase( + List.of(), + new AbstractMap.SimpleEntry<>("color", "") + ), + new ParamTestCase( + List.of("blue", "black", "brown"), + new AbstractMap.SimpleEntry<>("color", ".blue.black.brown") + ), + new ParamTestCase( + List.of("blue", "black", "brown"), + new AbstractMap.SimpleEntry<>("color", ".blue.black.brown"), + true + ), + new ParamTestCase( + Map.of(), + new AbstractMap.SimpleEntry<>("color", "") + ), + new ParamTestCase( + mapPayload, + new AbstractMap.SimpleEntry<>("color", ".R.100.G.200.B.150") + ), + new ParamTestCase( + mapPayload, + new AbstractMap.SimpleEntry<>("color", ".R=100.G=200.B=150"), + true + ) + ); + for (ParamTestCase testCase: testCases) { + var pathParameter = new PathLabelParameter(testCase.explode); + var serialization = pathParameter.serialize(testCase.payload); + Assert.assertEquals(testCase.expectedSerialization, serialization); + } + } +} \ No newline at end of file diff --git a/src/main/resources/kotlin/src/test/kotlin/packagename/parameter/SchemaQueryParameterTest.hbs b/src/main/resources/kotlin/src/test/kotlin/packagename/parameter/SchemaQueryParameterTest.hbs new file mode 100644 index 00000000000..d6e4206daba --- /dev/null +++ b/src/main/resources/kotlin/src/test/kotlin/packagename/parameter/SchemaQueryParameterTest.hbs @@ -0,0 +1,193 @@ +package {{{packageName}}}.parameter; + +import org.checkerframework.checker.nullness.qual.Nullable; +import org.junit.Assert; +import org.junit.Test; +import {{{packageName}}}.exceptions.NotImplementedException; +import {{{packageName}}}.schemas.AnyTypeJsonSchema; + +import java.util.LinkedHashMap; +import java.util.List; +import java.util.AbstractMap; +import java.util.Map; +import java.util.Set; + +public class SchemaQueryParameterTest { + public record ParamTestCase(@Nullable Object payload, AbstractMap.SimpleEntry expectedSerialization, @Nullable Boolean explode) { + public ParamTestCase(@Nullable Object payload, AbstractMap.SimpleEntry expectedSerialization) { + this(payload, expectedSerialization, null); + } + } + + public static class QueryParameterNoStyle extends SchemaParameter { + public QueryParameterNoStyle(@Nullable Boolean explode) { + super("color", ParameterInType.QUERY, true, null, explode, null, AnyTypeJsonSchema.AnyTypeJsonSchema1.getInstance()); + } + } + + @Test + public void testQueryParameterNoStyleSerialization() throws NotImplementedException { + var mapPayload = new LinkedHashMap(); + mapPayload.put("R", 100); + mapPayload.put("G", 200); + mapPayload.put("B", 150); + List testCases = List.of( + new ParamTestCase( + null, + new AbstractMap.SimpleEntry<>("color", "") + ), + new ParamTestCase( + 1, + new AbstractMap.SimpleEntry<>("color", "color=1") + ), + new ParamTestCase( + 3.14, + new AbstractMap.SimpleEntry<>("color","color=3.14") + ), + new ParamTestCase( + "blue", + new AbstractMap.SimpleEntry<>("color", "color=blue") + ), + new ParamTestCase( + "hello world", + new AbstractMap.SimpleEntry<>("color", "color=hello%20world") + ), + new ParamTestCase( + "", + new AbstractMap.SimpleEntry<>("color", "color=") + ), + new ParamTestCase( + List.of(), + new AbstractMap.SimpleEntry<>("color", "") + ), + new ParamTestCase( + List.of("blue", "black", "brown"), + new AbstractMap.SimpleEntry<>("color", "color=blue&color=black&color=brown") + ), + new ParamTestCase( + List.of("blue", "black", "brown"), + new AbstractMap.SimpleEntry<>("color", "color=blue&color=black&color=brown"), + true + ), + new ParamTestCase( + Map.of(), + new AbstractMap.SimpleEntry<>("color", "") + ), + new ParamTestCase( + mapPayload, + new AbstractMap.SimpleEntry<>("color", "R=100&G=200&B=150") + ), + new ParamTestCase( + mapPayload, + new AbstractMap.SimpleEntry<>("color", "R=100&G=200&B=150"), + true + ) + ); + for (ParamTestCase testCase: testCases) { + var parameter = new QueryParameterNoStyle(testCase.explode); + var serialization = parameter.serialize(testCase.payload); + Assert.assertEquals(testCase.expectedSerialization, serialization); + } + var parameter = new QueryParameterNoStyle(false); + for (boolean value: Set.of(true, false)) { + Assert.assertThrows( + NotImplementedException.class, + () -> parameter.serialize(value) + ); + } + } + + public static class QueryParameterSpaceDelimited extends SchemaParameter { + public QueryParameterSpaceDelimited(@Nullable Boolean explode) { + super("color", ParameterInType.QUERY, true, ParameterStyle.SPACE_DELIMITED, explode, null, AnyTypeJsonSchema.AnyTypeJsonSchema1.getInstance()); + } + } + + @Test + public void testQueryParameterSpaceDelimitedSerialization() throws NotImplementedException { + var mapPayload = new LinkedHashMap(); + mapPayload.put("R", 100); + mapPayload.put("G", 200); + mapPayload.put("B", 150); + List testCases = List.of( + new ParamTestCase( + List.of(), + new AbstractMap.SimpleEntry<>("color", "") + ), + new ParamTestCase( + List.of("blue", "black", "brown"), + new AbstractMap.SimpleEntry<>("color", "blue%20black%20brown") + ), + new ParamTestCase( + List.of("blue", "black", "brown"), + new AbstractMap.SimpleEntry<>("color", "blue%20black%20brown"), + true + ), + new ParamTestCase( + Map.of(), + new AbstractMap.SimpleEntry<>("color", "") + ), + new ParamTestCase( + mapPayload, + new AbstractMap.SimpleEntry<>("color", "R%20100%20G%20200%20B%20150") + ), + new ParamTestCase( + mapPayload, + new AbstractMap.SimpleEntry<>("color", "R=100%20G=200%20B=150"), + true + ) + ); + for (ParamTestCase testCase: testCases) { + var parameter = new QueryParameterSpaceDelimited(testCase.explode); + var serialization = parameter.serialize(testCase.payload); + Assert.assertEquals(testCase.expectedSerialization, serialization); + } + } + + public static class QueryParameterPipeDelimited extends SchemaParameter { + public QueryParameterPipeDelimited(@Nullable Boolean explode) { + super("color", ParameterInType.QUERY, true, ParameterStyle.PIPE_DELIMITED, explode, null, AnyTypeJsonSchema.AnyTypeJsonSchema1.getInstance()); + } + } + + @Test + public void testQueryParameterPipeDelimitedSerialization() throws NotImplementedException { + var mapPayload = new LinkedHashMap(); + mapPayload.put("R", 100); + mapPayload.put("G", 200); + mapPayload.put("B", 150); + List testCases = List.of( + new ParamTestCase( + List.of(), + new AbstractMap.SimpleEntry<>("color", "") + ), + new ParamTestCase( + List.of("blue", "black", "brown"), + new AbstractMap.SimpleEntry<>("color", "blue|black|brown") + ), + new ParamTestCase( + List.of("blue", "black", "brown"), + new AbstractMap.SimpleEntry<>("color", "blue|black|brown"), + true + ), + new ParamTestCase( + Map.of(), + new AbstractMap.SimpleEntry<>("color", "") + ), + new ParamTestCase( + mapPayload, + new AbstractMap.SimpleEntry<>("color", "R|100|G|200|B|150") + ), + new ParamTestCase( + mapPayload, + new AbstractMap.SimpleEntry<>("color", "R=100|G=200|B=150"), + true + ) + ); + for (ParamTestCase testCase: testCases) { + var parameter = new QueryParameterPipeDelimited(testCase.explode); + var serialization = parameter.serialize(testCase.payload); + Assert.assertEquals(testCase.expectedSerialization, serialization); + } + } +} diff --git a/src/main/resources/kotlin/src/test/kotlin/packagename/requestbody/RequestBodySerializerTest.hbs b/src/main/resources/kotlin/src/test/kotlin/packagename/requestbody/RequestBodySerializerTest.hbs new file mode 100644 index 00000000000..b8c071ab29d --- /dev/null +++ b/src/main/resources/kotlin/src/test/kotlin/packagename/requestbody/RequestBodySerializerTest.hbs @@ -0,0 +1,181 @@ +package {{{packageName}}}.requestbody; + +import {{{packageName}}}.configurations.JsonSchemaKeywordFlags; +import {{{packageName}}}.configurations.SchemaConfiguration; +import {{{packageName}}}.contenttype.ContentTypeDetector; +import {{{packageName}}}.exceptions.NotImplementedException; +import {{{packageName}}}.exceptions.ValidationException; +import {{{packageName}}}.schemas.AnyTypeJsonSchema; +import {{{packageName}}}.schemas.StringJsonSchema; + +import org.checkerframework.checker.nullness.qual.Nullable; +import org.junit.Assert; +import org.junit.Test; + +import java.net.http.HttpResponse; +import java.nio.ByteBuffer; +import java.nio.charset.StandardCharsets; +import java.util.AbstractMap; +import java.util.List; +import java.util.Map; +import java.util.concurrent.Flow; + +public final class RequestBodySerializerTest { + public sealed interface SealedMediaType permits ApplicationjsonMediaType, TextplainMediaType {} + public record ApplicationjsonMediaType(AnyTypeJsonSchema.AnyTypeJsonSchema1 schema) implements SealedMediaType {} + public record TextplainMediaType(StringJsonSchema.StringJsonSchema1 schema) implements SealedMediaType {} + + public sealed interface SealedRequestBody permits ApplicationjsonRequestBody, TextplainRequestBody {} + public record ApplicationjsonRequestBody(AnyTypeJsonSchema.AnyTypeJsonSchema1Boxed body) implements SealedRequestBody, GenericRequestBody<@Nullable Object> { + @Override + public String contentType() { + return "application/json"; + } + } + public record TextplainRequestBody(StringJsonSchema.StringJsonSchema1Boxed body) implements SealedRequestBody, GenericRequestBody<@Nullable Object> { + @Override + public String contentType() { + return "text/plain"; + } + } + + public static class MyRequestBodySerializer extends RequestBodySerializer { + public MyRequestBodySerializer() { + super( + Map.ofEntries( + new AbstractMap.SimpleEntry<>("application/json", new ApplicationjsonMediaType(AnyTypeJsonSchema.AnyTypeJsonSchema1.getInstance())), + new AbstractMap.SimpleEntry<>("text/plain", new TextplainMediaType(StringJsonSchema.StringJsonSchema1.getInstance())) + ), + true); + } + + public SerializedRequestBody serialize(SealedRequestBody requestBody) throws NotImplementedException { + if (requestBody instanceof ApplicationjsonRequestBody requestBody0) { + return serialize(requestBody0.contentType(), requestBody0.body().getData()); + } else { + TextplainRequestBody requestBody1 = (TextplainRequestBody) requestBody; + return serialize(requestBody1.contentType(), requestBody1.body().getData()); + } + } + } + + @Test + public void testContentTypeIsJson() { + Assert.assertTrue(ContentTypeDetector.contentTypeIsJson("application/json")); + Assert.assertTrue(ContentTypeDetector.contentTypeIsJson("application/json; charset=UTF-8")); + Assert.assertTrue(ContentTypeDetector.contentTypeIsJson("application/json-patch+json")); + Assert.assertTrue(ContentTypeDetector.contentTypeIsJson("application/geo+json")); + + Assert.assertFalse(ContentTypeDetector.contentTypeIsJson("application/octet-stream")); + Assert.assertFalse(ContentTypeDetector.contentTypeIsJson("text/plain")); + } + + static final class StringSubscriber implements Flow.Subscriber { + final HttpResponse.BodySubscriber wrapped; + StringSubscriber(HttpResponse.BodySubscriber wrapped) { + this.wrapped = wrapped; + } + @Override + public void onSubscribe(Flow.Subscription subscription) { + wrapped.onSubscribe(subscription); + } + @Override + public void onNext(ByteBuffer item) { wrapped.onNext(List.of(item)); } + @Override + public void onError(Throwable throwable) { wrapped.onError(throwable); } + @Override + public void onComplete() { wrapped.onComplete(); } + } + + private String getJsonBody(SerializedRequestBody requestBody) { + var bodySubscriber = HttpResponse.BodySubscribers.ofString(StandardCharsets.UTF_8); + var flowSubscriber = new StringSubscriber(bodySubscriber); + requestBody.bodyPublisher.subscribe(flowSubscriber); + return bodySubscriber.getBody().toCompletableFuture().join(); + } + + @Test + public void testSerializeApplicationJson() throws ValidationException, NotImplementedException { + SchemaConfiguration configuration = new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().build()); + var serializer = new MyRequestBodySerializer(); + String jsonBody; + SerializedRequestBody requestBody = serializer.serialize( + new ApplicationjsonRequestBody( + AnyTypeJsonSchema.AnyTypeJsonSchema1.getInstance().validateAndBox(1, configuration) + ) + ); + Assert.assertEquals("application/json", requestBody.contentType); + jsonBody = getJsonBody(requestBody); + Assert.assertEquals(jsonBody, "1"); + + requestBody = serializer.serialize( + new ApplicationjsonRequestBody( + AnyTypeJsonSchema.AnyTypeJsonSchema1.getInstance().validateAndBox(3.14, configuration) + ) + ); + jsonBody = getJsonBody(requestBody); + Assert.assertEquals(jsonBody, "3.14"); + + requestBody = serializer.serialize( + new ApplicationjsonRequestBody( + AnyTypeJsonSchema.AnyTypeJsonSchema1.getInstance().validateAndBox((Nothing?) null, configuration) + ) + ); + jsonBody = getJsonBody(requestBody); + Assert.assertEquals(jsonBody, "null"); + + requestBody = serializer.serialize( + new ApplicationjsonRequestBody( + AnyTypeJsonSchema.AnyTypeJsonSchema1.getInstance().validateAndBox(true, configuration) + ) + ); + jsonBody = getJsonBody(requestBody); + Assert.assertEquals(jsonBody, "true"); + + requestBody = serializer.serialize( + new ApplicationjsonRequestBody( + AnyTypeJsonSchema.AnyTypeJsonSchema1.getInstance().validateAndBox(false, configuration) + ) + ); + jsonBody = getJsonBody(requestBody); + Assert.assertEquals(jsonBody, "false"); + + requestBody = serializer.serialize( + new ApplicationjsonRequestBody( + AnyTypeJsonSchema.AnyTypeJsonSchema1.getInstance().validateAndBox(List.of(), configuration) + ) + ); + jsonBody = getJsonBody(requestBody); + Assert.assertEquals(jsonBody, "[]"); + + requestBody = serializer.serialize( + new ApplicationjsonRequestBody( + AnyTypeJsonSchema.AnyTypeJsonSchema1.getInstance().validateAndBox(Map.of(), configuration) + ) + ); + jsonBody = getJsonBody(requestBody); + Assert.assertEquals(jsonBody, "{}"); + + requestBody = serializer.serialize( + new ApplicationjsonRequestBody( + AnyTypeJsonSchema.AnyTypeJsonSchema1.getInstance().validateAndBox(Map.of("k1", "v1", "k2", "v2"), configuration) + ) + ); + jsonBody = getJsonBody(requestBody); + Assert.assertEquals(jsonBody, "{\"k2\":\"v2\",\"k1\":\"v1\"}"); + } + + @Test + public void testSerializeTextPlain() throws ValidationException, NotImplementedException { + SchemaConfiguration configuration = new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().build()); + var serializer = new MyRequestBodySerializer(); + SerializedRequestBody requestBody = serializer.serialize( + new TextplainRequestBody( + StringJsonSchema.StringJsonSchema1.getInstance().validateAndBox("a", configuration) + ) + ); + Assert.assertEquals("text/plain", requestBody.contentType); + String textBody = getJsonBody(requestBody); + Assert.assertEquals(textBody, "a"); + } +} \ No newline at end of file diff --git a/src/main/resources/kotlin/src/test/kotlin/packagename/response/ResponseDeserializerTest.hbs b/src/main/resources/kotlin/src/test/kotlin/packagename/response/ResponseDeserializerTest.hbs new file mode 100644 index 00000000000..4611631e6ae --- /dev/null +++ b/src/main/resources/kotlin/src/test/kotlin/packagename/response/ResponseDeserializerTest.hbs @@ -0,0 +1,248 @@ +package {{{packageName}}}.response; + +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.ToNumberPolicy; +import org.checkerframework.checker.nullness.qual.Nullable; +import org.junit.Assert; +import org.junit.Test; +import {{{packageName}}}.configurations.JsonSchemaKeywordFlags; +import {{{packageName}}}.configurations.SchemaConfiguration; +import {{{packageName}}}.exceptions.NotImplementedException; +import {{{packageName}}}.exceptions.ApiException; +import {{{packageName}}}.exceptions.ValidationException; +import {{{packageName}}}.mediatype.MediaType; +import {{{packageName}}}.schemas.AnyTypeJsonSchema; +import {{{packageName}}}.schemas.StringJsonSchema; + +import javax.net.ssl.SSLSession; +import java.net.URI; +import java.net.http.HttpClient; +import java.net.http.HttpHeaders; +import java.net.http.HttpRequest; +import java.net.http.HttpResponse; +import java.nio.charset.StandardCharsets; +import java.util.List; +import java.util.Map; +import java.util.Optional; +import java.util.function.BiPredicate; + +public class ResponseDeserializerTest { + private static final Gson gson = new GsonBuilder() + .setObjectToNumberStrategy(ToNumberPolicy.LONG_OR_DOUBLE) + .setNumberToNumberStrategy(ToNumberPolicy.LONG_OR_DOUBLE) + .create(); + public sealed interface SealedResponseBody permits ApplicationjsonBody, TextplainBody { } + + public record ApplicationjsonBody(AnyTypeJsonSchema.AnyTypeJsonSchema1Boxed body) implements SealedResponseBody { } + + public record TextplainBody(StringJsonSchema.StringJsonSchema1Boxed body) implements SealedResponseBody {} + + public sealed interface SealedMediaType permits ApplicationjsonMediatype, TextplainMediatype { } + + public record ApplicationjsonMediatype(AnyTypeJsonSchema.AnyTypeJsonSchema1 schema) implements SealedMediaType, MediaType { + public ApplicationjsonMediatype() { + this(AnyTypeJsonSchema.AnyTypeJsonSchema1.getInstance()); + } + @Override + public Nothing? encoding() { + return null; + } + } + + public record TextplainMediatype(StringJsonSchema.StringJsonSchema1 schema) implements SealedMediaType, MediaType { + public TextplainMediatype() { + this(StringJsonSchema.StringJsonSchema1.getInstance()); + } + @Override + public Nothing? encoding() { + return null; + } + } + + public static class MyResponseDeserializer extends ResponseDeserializer { + + public MyResponseDeserializer() { + super(Map.of("application/json", new ApplicationjsonMediatype(), "text/plain", new TextplainMediatype())); + } + + @Override + protected SealedResponseBody getBody(String contentType, SealedMediaType mediaType, byte[] body, SchemaConfiguration configuration) throws ValidationException, NotImplementedException { + if (mediaType instanceof ApplicationjsonMediatype thisMediaType) { + var deserializedBody = deserializeBody(contentType, body, thisMediaType.schema(), configuration); + return new ApplicationjsonBody(deserializedBody); + } else { + TextplainMediatype thisMediaType = (TextplainMediatype) mediaType; + var deserializedBody = deserializeBody(contentType, body, thisMediaType.schema(), configuration); + return new TextplainBody(deserializedBody); + } + } + + @Override + protected Nothing? getHeaders(HttpHeaders headers, SchemaConfiguration configuration) { + return null; + } + } + + public static class BytesHttpResponse implements HttpResponse { + private final byte[] body; + private final HttpHeaders headers; + private final HttpRequest request; + private final URI uri; + private final HttpClient.Version version; + public BytesHttpResponse(byte[] body, String contentType) { + this.body = body; + BiPredicate headerFilter = (key, val) -> true; + headers = HttpHeaders.of(Map.of("Content-Type", List.of(contentType)), headerFilter); + uri = URI.create("https://abc.com/"); + request = HttpRequest.newBuilder().uri(uri).build(); + version = HttpClient.Version.HTTP_2; + } + + @Override + public int statusCode() { + return 202; + } + + @Override + public HttpRequest request() { + return request; + } + + @Override + public Optional> previousResponse() { + return Optional.empty(); + } + + @Override + public HttpHeaders headers() { + return headers; + } + + @Override + public byte[] body() { + return body; + } + + @Override + public Optional sslSession() { + return Optional.empty(); + } + + @Override + public URI uri() { + return uri; + } + + @Override + public HttpClient.Version version() { + return version; + } + } + + @SuppressWarnings("nullness") + private String toJson(@Nullable Object body) { + return gson.toJson(body); + } + + @SuppressWarnings("nullness") + private void assertNull(@Nullable Object object) { + Assert.assertNull(object); + } + + @Test + public void testDeserializeApplicationJsonNull() throws ValidationException, ApiException, NotImplementedException { + var deserializer = new MyResponseDeserializer(); + byte[] bodyBytes = toJson(null).getBytes(StandardCharsets.UTF_8); + BytesHttpResponse response = new BytesHttpResponse(bodyBytes, "application/json"); + SchemaConfiguration configuration = new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().build()); + DeserializedHttpResponse apiResponse = deserializer.deserialize(response, configuration); + if (!(apiResponse.body() instanceof ApplicationjsonBody jsonBody)) { + throw new RuntimeException("body must be type ApplicationjsonBody"); + } + if (!(jsonBody.body() instanceof AnyTypeJsonSchema.AnyTypeJsonSchema1BoxedVoid boxedVoid)) { + throw new RuntimeException("body must be type AnyTypeJsonSchema1BoxedVoid"); + } + assertNull(boxedVoid.data()); + } + + @Test + public void testDeserializeApplicationJsonTrue() throws ValidationException, ApiException, NotImplementedException { + var deserializer = new MyResponseDeserializer(); + byte[] bodyBytes = toJson(true).getBytes(StandardCharsets.UTF_8); + BytesHttpResponse response = new BytesHttpResponse(bodyBytes, "application/json"); + SchemaConfiguration configuration = new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().build()); + DeserializedHttpResponse apiResponse = deserializer.deserialize(response, configuration); + if (!(apiResponse.body() instanceof ApplicationjsonBody jsonBody)) { + throw new RuntimeException("body must be type ApplicationjsonBody"); + } + if (!(jsonBody.body() instanceof AnyTypeJsonSchema.AnyTypeJsonSchema1BoxedBoolean boxedBoolean)) { + throw new RuntimeException("body must be type AnyTypeJsonSchema1BoxedBoolean"); + } + Assert.assertTrue(boxedBoolean.data()); + } + + @Test + public void testDeserializeApplicationJsonFalse() throws ValidationException, ApiException, NotImplementedException { + var deserializer = new MyResponseDeserializer(); + byte[] bodyBytes = toJson(false).getBytes(StandardCharsets.UTF_8); + BytesHttpResponse response = new BytesHttpResponse(bodyBytes, "application/json"); + SchemaConfiguration configuration = new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().build()); + DeserializedHttpResponse apiResponse = deserializer.deserialize(response, configuration); + if (!(apiResponse.body() instanceof ApplicationjsonBody jsonBody)) { + throw new RuntimeException("body must be type ApplicationjsonBody"); + } + if (!(jsonBody.body() instanceof AnyTypeJsonSchema.AnyTypeJsonSchema1BoxedBoolean boxedBoolean)) { + throw new RuntimeException("body must be type AnyTypeJsonSchema1BoxedBoolean"); + } + Assert.assertFalse(boxedBoolean.data()); + } + + @Test + public void testDeserializeApplicationJsonInt() throws ValidationException, ApiException, NotImplementedException { + var deserializer = new MyResponseDeserializer(); + byte[] bodyBytes = toJson(1).getBytes(StandardCharsets.UTF_8); + BytesHttpResponse response = new BytesHttpResponse(bodyBytes, "application/json"); + SchemaConfiguration configuration = new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().build()); + DeserializedHttpResponse apiResponse = deserializer.deserialize(response, configuration); + if (!(apiResponse.body() instanceof ApplicationjsonBody jsonBody)) { + throw new RuntimeException("body must be type ApplicationjsonBody"); + } + if (!(jsonBody.body() instanceof AnyTypeJsonSchema.AnyTypeJsonSchema1BoxedNumber boxedNumber)) { + throw new RuntimeException("body must be type AnyTypeJsonSchema1BoxedNumber"); + } + Assert.assertEquals(boxedNumber.data(), 1L); + } + + @Test + public void testDeserializeApplicationJsonFloat() throws ValidationException, ApiException, NotImplementedException { + var deserializer = new MyResponseDeserializer(); + byte[] bodyBytes = toJson(3.14).getBytes(StandardCharsets.UTF_8); + BytesHttpResponse response = new BytesHttpResponse(bodyBytes, "application/json"); + SchemaConfiguration configuration = new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().build()); + DeserializedHttpResponse apiResponse = deserializer.deserialize(response, configuration); + if (!(apiResponse.body() instanceof ApplicationjsonBody jsonBody)) { + throw new RuntimeException("body must be type ApplicationjsonBody"); + } + if (!(jsonBody.body() instanceof AnyTypeJsonSchema.AnyTypeJsonSchema1BoxedNumber boxedNumber)) { + throw new RuntimeException("body must be type AnyTypeJsonSchema1BoxedNumber"); + } + Assert.assertEquals(boxedNumber.data(), 3.14); + } + + @Test + public void testDeserializeApplicationJsonString() throws ValidationException, ApiException, NotImplementedException { + var deserializer = new MyResponseDeserializer(); + byte[] bodyBytes = toJson("a").getBytes(StandardCharsets.UTF_8); + BytesHttpResponse response = new BytesHttpResponse(bodyBytes, "application/json"); + SchemaConfiguration configuration = new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().build()); + DeserializedHttpResponse apiResponse = deserializer.deserialize(response, configuration); + if (!(apiResponse.body() instanceof ApplicationjsonBody jsonBody)) { + throw new RuntimeException("body must be type ApplicationjsonBody"); + } + if (!(jsonBody.body() instanceof AnyTypeJsonSchema.AnyTypeJsonSchema1BoxedString boxedString)) { + throw new RuntimeException("body must be type AnyTypeJsonSchema1BoxedString"); + } + Assert.assertEquals(boxedString.data(), "a"); + } +} \ No newline at end of file diff --git a/src/main/resources/kotlin/src/test/kotlin/packagename/schemas/AnyTypeSchemaTest.hbs b/src/main/resources/kotlin/src/test/kotlin/packagename/schemas/AnyTypeSchemaTest.hbs new file mode 100644 index 00000000000..fc374e0b019 --- /dev/null +++ b/src/main/resources/kotlin/src/test/kotlin/packagename/schemas/AnyTypeSchemaTest.hbs @@ -0,0 +1,106 @@ +package {{{packageName}}}.schemas; + +import org.checkerframework.checker.nullness.qual.Nullable; +import org.junit.Assert; +import org.junit.Test; +import {{{packageName}}}.configurations.JsonSchemaKeywordFlags; +import {{{packageName}}}.configurations.SchemaConfiguration; +import {{{packageName}}}.exceptions.ValidationException; +import {{{packageName}}}.schemas.validation.FrozenList; +import {{{packageName}}}.schemas.validation.FrozenMap; + +import java.time.LocalDate; +import java.time.ZoneId; +import java.time.ZonedDateTime; +import java.util.ArrayList; +import java.util.LinkedHashMap; + + +public class AnyTypeSchemaTest { + static final AnyTypeJsonSchema.AnyTypeJsonSchema1 schema = AnyTypeJsonSchema.AnyTypeJsonSchema1.getInstance(); + static final SchemaConfiguration configuration = new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().build()); + + @SuppressWarnings("nullness") + private Nothing? assertNull(@Nullable Object object) { + Assert.assertNull(object); + return null; + } + + @Test + public void testValidateNull() throws ValidationException { + Nothing? validatedValue = schema.validate((Nothing?) null, configuration); + assertNull(validatedValue); + } + + @Test + public void testValidateBoolean() throws ValidationException { + boolean trueValue = schema.validate(true, configuration); + Assert.assertTrue(trueValue); + + boolean falseValue = schema.validate(false, configuration); + Assert.assertFalse(falseValue); + } + + @Test + public void testValidateInteger() throws ValidationException { + int validatedValue = schema.validate(1, configuration); + Assert.assertEquals(validatedValue, 1); + } + + @Test + public void testValidateLong() throws ValidationException { + long validatedValue = schema.validate(1L, configuration); + Assert.assertEquals(validatedValue, 1L); + } + + @Test + 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 { + double validatedValue = schema.validate(70.6458763d, configuration); + Assert.assertEquals(Double.compare(validatedValue, 70.6458763d), 0); + } + + @Test + public void testValidateString() throws ValidationException { + String validatedValue = schema.validate("a", configuration); + Assert.assertEquals(validatedValue, "a"); + } + + @Test + 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 { + String validatedValue = schema.validate(LocalDate.of(2017, 7, 21), configuration); + Assert.assertEquals(validatedValue, "2017-07-21"); + } + + @Test + public void testValidateMap() throws ValidationException { + LinkedHashMap inMap = new LinkedHashMap<>(); + inMap.put("today", LocalDate.of(2017, 7, 21)); + FrozenMap validatedValue = schema.validate(inMap, configuration); + LinkedHashMap outMap = new LinkedHashMap<>(); + outMap.put("today", "2017-07-21"); + Assert.assertEquals(validatedValue, outMap); + } + + @Test + public void testValidateList() throws ValidationException { + ArrayList inList = new ArrayList<>(); + inList.add(LocalDate.of(2017, 7, 21)); + FrozenList validatedValue = schema.validate(inList, configuration); + ArrayList outList = new ArrayList<>(); + outList.add( "2017-07-21"); + Assert.assertEquals(validatedValue, outList); + } +} + diff --git a/src/main/resources/kotlin/src/test/kotlin/packagename/schemas/ArrayTypeSchemaTest.hbs b/src/main/resources/kotlin/src/test/kotlin/packagename/schemas/ArrayTypeSchemaTest.hbs new file mode 100644 index 00000000000..b3ba44277e6 --- /dev/null +++ b/src/main/resources/kotlin/src/test/kotlin/packagename/schemas/ArrayTypeSchemaTest.hbs @@ -0,0 +1,252 @@ +package {{{packageName}}}.schemas; + +import org.checkerframework.checker.nullness.qual.Nullable; +import org.junit.Assert; +import org.junit.Test; +import {{{packageName}}}.configurations.JsonSchemaKeywordFlags; +import {{{packageName}}}.configurations.SchemaConfiguration; +import {{{packageName}}}.exceptions.ValidationException; +import {{{packageName}}}.schemas.validation.JsonSchema; +import {{{packageName}}}.schemas.validation.JsonSchemaInfo; +import {{{packageName}}}.schemas.validation.FrozenList; +import {{{packageName}}}.schemas.validation.PathToSchemasMap; +import {{{packageName}}}.schemas.validation.ListSchemaValidator; +import {{{packageName}}}.schemas.validation.ValidationMetadata; + +import java.util.ArrayList; +import java.util.HashSet; +import java.util.LinkedHashMap; +import java.util.LinkedHashSet; +import java.util.List; +import java.util.Objects; +import java.util.Set; + +public class ArrayTypeSchemaTest { + static final SchemaConfiguration configuration = new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().build()); + static final ValidationMetadata validationMetadata = new ValidationMetadata( + List.of("args[0"), + configuration, + new PathToSchemasMap(), + new LinkedHashSet<>() + ); + + public sealed interface ArrayWithItemsSchemaBoxed permits ArrayWithItemsSchemaBoxedList { + } + public record ArrayWithItemsSchemaBoxedList(FrozenList data) implements ArrayWithItemsSchemaBoxed { + } + + public static class ArrayWithItemsSchema extends JsonSchema implements ListSchemaValidator, ArrayWithItemsSchemaBoxedList> { + public ArrayWithItemsSchema() { + super(new JsonSchemaInfo() + .type(Set.of(List.class)) + .items(StringJsonSchema.StringJsonSchema1.class) + ); + } + + @Override + public FrozenList getNewInstance(List arg, List pathToItem, PathToSchemasMap pathToSchemas) { + List items = new ArrayList<>(); + int i = 0; + for (Object item: arg) { + List itemPathToItem = new ArrayList<>(pathToItem); + itemPathToItem.add(i); + LinkedHashMap, Nothing?> schemas = pathToSchemas.get(itemPathToItem); + if (schemas == null) { + 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 RuntimeException("Instantiated type of item is invalid"); + } + items.add((String) castItem); + i += 1; + } + return new FrozenList<>(items); + } + + 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); + SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().build())); + ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, new PathToSchemasMap(), new LinkedHashSet<>()); + PathToSchemasMap pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet); + return getNewInstance(castArg, validationMetadata.pathToItem(), pathToSchemasMap); + } + + @Override + public ArrayWithItemsSchemaBoxedList validateAndBox(List arg, SchemaConfiguration configuration) throws ValidationException { + return new ArrayWithItemsSchemaBoxedList(validate(arg, configuration)); + } + + @Override + public Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { + 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"); + } + + @Override + public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws 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"); + } + + @Override + public ArrayWithItemsSchemaBoxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws 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"); + } + } + + public static class ArrayWithOutputClsSchemaList extends FrozenList { + protected ArrayWithOutputClsSchemaList(FrozenList m) { + super(m); + } + + public static ArrayWithOutputClsSchemaList of(List arg, SchemaConfiguration configuration) throws ValidationException { + return new ArrayWithOutputClsSchema().validate(arg, configuration); + } + } + + public sealed interface ArrayWithOutputClsSchemaBoxed permits ArrayWithOutputClsSchemaBoxedList { + } + public record ArrayWithOutputClsSchemaBoxedList(ArrayWithOutputClsSchemaList data) implements ArrayWithOutputClsSchemaBoxed { + } + public static class ArrayWithOutputClsSchema extends JsonSchema implements ListSchemaValidator { + public ArrayWithOutputClsSchema() { + super(new JsonSchemaInfo() + .type(Set.of(List.class)) + .items(StringJsonSchema.StringJsonSchema1.class) + ); + + } + + @Override + public ArrayWithOutputClsSchemaList getNewInstance(List arg, List pathToItem, PathToSchemasMap pathToSchemas) { + List items = new ArrayList<>(); + int i = 0; + for (Object item: arg) { + List itemPathToItem = new ArrayList<>(pathToItem); + itemPathToItem.add(i); + LinkedHashMap, Nothing?> schemas = pathToSchemas.get(itemPathToItem); + if (schemas == null) { + 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 RuntimeException("Instantiated type of item is invalid"); + } + items.add((String) castItem); + i += 1; + } + FrozenList newInstanceItems = new FrozenList<>(items); + return new ArrayWithOutputClsSchemaList(newInstanceItems); + } + + 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); + SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().build())); + ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, new PathToSchemasMap(), new LinkedHashSet<>()); + PathToSchemasMap pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet); + return getNewInstance(castArg, validationMetadata.pathToItem(), pathToSchemasMap); + } + + @Override + public ArrayWithOutputClsSchemaBoxedList validateAndBox(List arg, SchemaConfiguration configuration) throws ValidationException { + return new ArrayWithOutputClsSchemaBoxedList(validate(arg, configuration)); + } + + @Override + public Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { + 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"); + } + + @Override + public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws 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"); + } + + @Override + public ArrayWithOutputClsSchemaBoxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws 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"); + } + } + + @Test + public void testExceptionThrownForInvalidType() { + Assert.assertThrows(ValidationException.class, () -> JsonSchema.validate( + new ArrayWithItemsSchema(), + null, + validationMetadata + )); + } + + @Test + public void testValidateArrayWithItemsSchema() throws ValidationException { + // list with only item works + List inList = new ArrayList<>(); + inList.add("abc"); + FrozenList validatedValue = new ArrayWithItemsSchema().validate(inList, configuration); + List outList = new ArrayList<>(); + outList.add("abc"); + Assert.assertEquals(validatedValue, outList); + + // list with no items works + inList = new ArrayList<>(); + validatedValue = new ArrayWithItemsSchema().validate(inList, configuration); + outList = new ArrayList<>(); + Assert.assertEquals(validatedValue, outList); + + // invalid item type fails + List intList = List.of(1); + Assert.assertThrows(ValidationException.class, () -> JsonSchema.validate( + new ArrayWithItemsSchema(), + intList, + validationMetadata + )); + } + + @Test + public void testValidateArrayWithOutputClsSchema() throws ValidationException { + // list with only item works + List inList = new ArrayList<>(); + inList.add("abc"); + ArrayWithOutputClsSchemaList validatedValue = new ArrayWithOutputClsSchema().validate(inList, configuration); + List outList = new ArrayList<>(); + outList.add("abc"); + Assert.assertEquals(validatedValue, outList); + + // list with no items works + inList = new ArrayList<>(); + validatedValue = new ArrayWithOutputClsSchema().validate(inList, configuration); + outList = new ArrayList<>(); + Assert.assertEquals(validatedValue, outList); + + // invalid item type fails + List intList = List.of(1); + Assert.assertThrows(ValidationException.class, () -> JsonSchema.validate( + new ArrayWithOutputClsSchema(), + intList, + validationMetadata + )); + } +} \ No newline at end of file diff --git a/src/main/resources/kotlin/src/test/kotlin/packagename/schemas/BooleanSchemaTest.hbs b/src/main/resources/kotlin/src/test/kotlin/packagename/schemas/BooleanSchemaTest.hbs new file mode 100644 index 00000000000..a7a42e569fe --- /dev/null +++ b/src/main/resources/kotlin/src/test/kotlin/packagename/schemas/BooleanSchemaTest.hbs @@ -0,0 +1,45 @@ +package {{{packageName}}}.schemas; + +import org.junit.Assert; +import org.junit.Test; +import {{{packageName}}}.configurations.JsonSchemaKeywordFlags; +import {{{packageName}}}.configurations.SchemaConfiguration; +import {{{packageName}}}.exceptions.ValidationException; +import {{{packageName}}}.schemas.validation.JsonSchema; +import {{{packageName}}}.schemas.validation.PathToSchemasMap; +import {{{packageName}}}.schemas.validation.ValidationMetadata; + +import java.util.LinkedHashSet; +import java.util.List; + +public class BooleanSchemaTest { + static final SchemaConfiguration configuration = new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().build()); + static final BooleanJsonSchema.BooleanJsonSchema1 booleanJsonSchema = BooleanJsonSchema.BooleanJsonSchema1.getInstance(); + static final ValidationMetadata validationMetadata = new ValidationMetadata( + List.of("args[0"), + configuration, + new PathToSchemasMap(), + new LinkedHashSet<>() + ); + + @Test + public void testValidateTrue() throws ValidationException { + boolean validatedValue = booleanJsonSchema.validate(true, configuration); + Assert.assertTrue(validatedValue); + } + + @Test + public void testValidateFalse() throws ValidationException { + boolean validatedValue = booleanJsonSchema.validate(false, configuration); + Assert.assertFalse(validatedValue); + } + + @Test + public void testExceptionThrownForInvalidType() { + Assert.assertThrows(ValidationException.class, () -> JsonSchema.validate( + booleanJsonSchema, + null, + validationMetadata + )); + } +} diff --git a/src/main/resources/kotlin/src/test/kotlin/packagename/schemas/ListBuilderTest.hbs b/src/main/resources/kotlin/src/test/kotlin/packagename/schemas/ListBuilderTest.hbs new file mode 100644 index 00000000000..3a5fd37c65c --- /dev/null +++ b/src/main/resources/kotlin/src/test/kotlin/packagename/schemas/ListBuilderTest.hbs @@ -0,0 +1,61 @@ +package {{{packageName}}}.schemas; + +import org.checkerframework.checker.nullness.qual.Nullable; +import org.junit.Assert; +import org.junit.Test; + +import java.util.ArrayList; +import java.util.List; + +public class ListBuilderTest { + public static class NullableListWithNullableItemsListBuilder { + // class to build List<@Nullable List> + private final List<@Nullable List> list; + + public NullableListWithNullableItemsListBuilder() { + list = new ArrayList<>(); + } + + public NullableListWithNullableItemsListBuilder(List<@Nullable List> list) { + this.list = list; + } + + public NullableListWithNullableItemsListBuilder add(Nothing? item) { + list.add(null); + return this; + } + + public NullableListWithNullableItemsListBuilder add(List item) { + list.add(item); + return this; + } + + public List<@Nullable List> build() { + return list; + } + } + + @Test + public void testSucceedsWithNullInput() { + List<@Nullable List> inList = new ArrayList<>(); + inList.add(null); + var builder = new NullableListWithNullableItemsListBuilder(inList); + Assert.assertEquals(inList, builder.build()); + + builder = new NullableListWithNullableItemsListBuilder(); + builder.add((Nothing?) null); + Assert.assertEquals(inList, builder.build()); + } + + @Test + public void testSucceedsWithNonNullInput() { + List<@Nullable List> inList = new ArrayList<>(); + inList.add(List.of(1)); + var builder = new NullableListWithNullableItemsListBuilder(inList); + Assert.assertEquals(inList, builder.build()); + + builder = new NullableListWithNullableItemsListBuilder(); + builder.add(List.of(1)); + Assert.assertEquals(inList, builder.build()); + } +} \ No newline at end of file diff --git a/src/main/resources/kotlin/src/test/kotlin/packagename/schemas/ListSchemaTest.hbs b/src/main/resources/kotlin/src/test/kotlin/packagename/schemas/ListSchemaTest.hbs new file mode 100644 index 00000000000..9d6d6c04740 --- /dev/null +++ b/src/main/resources/kotlin/src/test/kotlin/packagename/schemas/ListSchemaTest.hbs @@ -0,0 +1,46 @@ +package {{{packageName}}}.schemas; + +import org.checkerframework.checker.nullness.qual.Nullable; +import org.junit.Assert; +import org.junit.Test; +import {{{packageName}}}.configurations.JsonSchemaKeywordFlags; +import {{{packageName}}}.configurations.SchemaConfiguration; +import {{{packageName}}}.exceptions.ValidationException; +import {{{packageName}}}.schemas.validation.JsonSchema; +import {{{packageName}}}.schemas.validation.FrozenList; +import {{{packageName}}}.schemas.validation.PathToSchemasMap; +import {{{packageName}}}.schemas.validation.ValidationMetadata; + +import java.util.ArrayList; +import java.util.LinkedHashSet; +import java.util.List; + +public class ListSchemaTest { + static final SchemaConfiguration configuration = new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().build()); + static final ListJsonSchema.ListJsonSchema1 listJsonSchema = ListJsonSchema.ListJsonSchema1.getInstance(); + static final ValidationMetadata validationMetadata = new ValidationMetadata( + List.of("args[0"), + configuration, + new PathToSchemasMap(), + new LinkedHashSet<>() + ); + + @Test + public void testExceptionThrownForInvalidType() { + Assert.assertThrows(ValidationException.class, () -> JsonSchema.validate( + listJsonSchema, + null, + validationMetadata + )); + } + + @Test + public void testValidateList() throws ValidationException { + List inList = new ArrayList<>(); + inList.add("today"); + FrozenList<@Nullable Object> validatedValue = listJsonSchema.validate(inList, configuration); + ArrayList outList = new ArrayList<>(); + outList.add("today"); + Assert.assertEquals(validatedValue, outList); + } +} diff --git a/src/main/resources/kotlin/src/test/kotlin/packagename/schemas/MapSchemaTest.hbs b/src/main/resources/kotlin/src/test/kotlin/packagename/schemas/MapSchemaTest.hbs new file mode 100644 index 00000000000..f904e88b564 --- /dev/null +++ b/src/main/resources/kotlin/src/test/kotlin/packagename/schemas/MapSchemaTest.hbs @@ -0,0 +1,48 @@ +package {{{packageName}}}.schemas; + +import org.checkerframework.checker.nullness.qual.Nullable; +import org.junit.Assert; +import org.junit.Test; +import {{{packageName}}}.configurations.JsonSchemaKeywordFlags; +import {{{packageName}}}.configurations.SchemaConfiguration; +import {{{packageName}}}.exceptions.ValidationException; +import {{{packageName}}}.schemas.validation.JsonSchema; +import {{{packageName}}}.schemas.validation.FrozenMap; +import {{{packageName}}}.schemas.validation.PathToSchemasMap; +import {{{packageName}}}.schemas.validation.ValidationMetadata; + +import java.time.LocalDate; +import java.util.LinkedHashMap; +import java.util.LinkedHashSet; +import java.util.List; +import java.util.Map; + +public class MapSchemaTest { + static final SchemaConfiguration configuration = new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().build()); + static final MapJsonSchema.MapJsonSchema1 mapJsonSchema = MapJsonSchema.MapJsonSchema1.getInstance(); + static final ValidationMetadata validationMetadata = new ValidationMetadata( + List.of("args[0"), + configuration, + new PathToSchemasMap(), + new LinkedHashSet<>() + ); + + @Test + public void testExceptionThrownForInvalidType() { + Assert.assertThrows(ValidationException.class, () -> JsonSchema.validate( + mapJsonSchema, + null, + validationMetadata + )); + } + + @Test + 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); + LinkedHashMap outMap = new LinkedHashMap<>(); + outMap.put("today", "2017-07-21"); + Assert.assertEquals(validatedValue, outMap); + } +} diff --git a/src/main/resources/kotlin/src/test/kotlin/packagename/schemas/NullSchemaTest.hbs b/src/main/resources/kotlin/src/test/kotlin/packagename/schemas/NullSchemaTest.hbs new file mode 100644 index 00000000000..074a74cafd7 --- /dev/null +++ b/src/main/resources/kotlin/src/test/kotlin/packagename/schemas/NullSchemaTest.hbs @@ -0,0 +1,41 @@ +package {{{packageName}}}.schemas; + +import org.junit.Assert; +import org.junit.Test; +import {{{packageName}}}.configurations.JsonSchemaKeywordFlags; +import {{{packageName}}}.configurations.SchemaConfiguration; +import {{{packageName}}}.exceptions.ValidationException; +import {{{packageName}}}.schemas.validation.JsonSchema; +import {{{packageName}}}.schemas.validation.PathToSchemasMap; +import {{{packageName}}}.schemas.validation.ValidationMetadata; + +import java.util.LinkedHashSet; +import java.util.List; + +public class NullSchemaTest { + static final SchemaConfiguration configuration = new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().build()); + static final NullJsonSchema.NullJsonSchema1 nullJsonSchema = NullJsonSchema.NullJsonSchema1.getInstance(); + static final ValidationMetadata validationMetadata = new ValidationMetadata( + List.of("args[0"), + configuration, + new PathToSchemasMap(), + new LinkedHashSet<>() + ); + + + @Test + @SuppressWarnings("nullness") + public void testValidateNull() throws ValidationException { + Nothing? validatedValue = nullJsonSchema.validate(null, configuration); + Assert.assertNull(validatedValue); + } + + @Test + public void testExceptionThrownForInvalidType() { + Assert.assertThrows(ValidationException.class, () -> JsonSchema.validate( + nullJsonSchema, + Boolean.TRUE, + validationMetadata + )); + } +} diff --git a/src/main/resources/kotlin/src/test/kotlin/packagename/schemas/NumberSchemaTest.hbs b/src/main/resources/kotlin/src/test/kotlin/packagename/schemas/NumberSchemaTest.hbs new file mode 100644 index 00000000000..9c3b46cd028 --- /dev/null +++ b/src/main/resources/kotlin/src/test/kotlin/packagename/schemas/NumberSchemaTest.hbs @@ -0,0 +1,57 @@ +package {{{packageName}}}.schemas; + +import org.junit.Assert; +import org.junit.Test; +import {{{packageName}}}.configurations.JsonSchemaKeywordFlags; +import {{{packageName}}}.configurations.SchemaConfiguration; +import {{{packageName}}}.exceptions.ValidationException; +import {{{packageName}}}.schemas.validation.JsonSchema; +import {{{packageName}}}.schemas.validation.PathToSchemasMap; +import {{{packageName}}}.schemas.validation.ValidationMetadata; + +import java.util.LinkedHashSet; +import java.util.List; + +public class NumberSchemaTest { + static final SchemaConfiguration configuration = new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().build()); + static final NumberJsonSchema.NumberJsonSchema1 numberJsonSchema = NumberJsonSchema.NumberJsonSchema1.getInstance(); + static final ValidationMetadata validationMetadata = new ValidationMetadata( + List.of("args[0"), + configuration, + new PathToSchemasMap(), + new LinkedHashSet<>() + ); + + @Test + public void testValidateInteger() throws ValidationException { + int validatedValue = numberJsonSchema.validate(1, configuration); + Assert.assertEquals(validatedValue, 1); + } + + @Test + public void testValidateLong() throws ValidationException { + long validatedValue = numberJsonSchema.validate(1L, configuration); + Assert.assertEquals(validatedValue, 1L); + } + + @Test + 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 { + double validatedValue = numberJsonSchema.validate(3.14d, configuration); + Assert.assertEquals(Double.compare(validatedValue, 3.14d), 0); + } + + @Test + public void testExceptionThrownForInvalidType() { + Assert.assertThrows(ValidationException.class, () -> JsonSchema.validate( + numberJsonSchema, + null, + validationMetadata + )); + } +} diff --git a/src/main/resources/kotlin/src/test/kotlin/packagename/schemas/ObjectTypeSchemaTest.hbs b/src/main/resources/kotlin/src/test/kotlin/packagename/schemas/ObjectTypeSchemaTest.hbs new file mode 100644 index 00000000000..4648409144d --- /dev/null +++ b/src/main/resources/kotlin/src/test/kotlin/packagename/schemas/ObjectTypeSchemaTest.hbs @@ -0,0 +1,538 @@ +package {{{packageName}}}.schemas; + +import org.checkerframework.checker.nullness.qual.Nullable; +import org.junit.Assert; +import org.junit.Test; +import {{{packageName}}}.configurations.JsonSchemaKeywordFlags; +import {{{packageName}}}.configurations.SchemaConfiguration; +import {{{packageName}}}.exceptions.ValidationException; +import {{{packageName}}}.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}}}.schemas.validation.ValidationMetadata; + +import java.util.ArrayList; +import java.util.HashSet; +import java.util.LinkedHashMap; +import java.util.LinkedHashSet; +import java.util.List; +import java.util.Map; +import java.util.Objects; +import java.util.Set; + +public class ObjectTypeSchemaTest { + static final SchemaConfiguration configuration = new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().build()); + static final ValidationMetadata validationMetadata = new ValidationMetadata( + List.of("args[0"), + configuration, + new PathToSchemasMap(), + new LinkedHashSet<>() + ); + + public sealed interface ObjectWithPropsSchemaBoxed permits ObjectWithPropsSchemaBoxedMap { + } + public record ObjectWithPropsSchemaBoxedMap(FrozenMap<@Nullable Object> data) implements ObjectWithPropsSchemaBoxed { + } + public static class ObjectWithPropsSchema extends JsonSchema implements MapSchemaValidator, ObjectWithPropsSchemaBoxedMap> { + private static @Nullable ObjectWithPropsSchema instance = null; + private ObjectWithPropsSchema() { + super(new JsonSchemaInfo() + .type(Set.of(Map.class)) + .properties(Map.ofEntries( + new PropertyEntry("someString", StringJsonSchema.StringJsonSchema1.class) + )) + ); + + } + + public static ObjectWithPropsSchema getInstance() { + if (instance == null) { + instance = new ObjectWithPropsSchema(); + } + return instance; + } + + @Override + 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 RuntimeException("Invalid non-string key value"); + } + String propertyName = (String) entryKey; + List propertyPathToItem = new ArrayList<>(pathToItem); + propertyPathToItem.add(propertyName); + Object value = entry.getValue(); + LinkedHashMap, Nothing?> schemas = pathToSchemas.get(propertyPathToItem); + if (schemas == null) { + 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); + properties.put(propertyName, castValue); + } + return new FrozenMap<>(properties); + } + + public FrozenMap<@Nullable Object> validate(Map arg, SchemaConfiguration configuration) throws ValidationException { + Set> pathSet = new HashSet<>(); + List pathToItem = List.of("args[0"); + Map castArg = castToAllowedTypes(arg, pathToItem, pathSet); + SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().build())); + ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, new PathToSchemasMap(), new LinkedHashSet<>()); + PathToSchemasMap pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet); + return getNewInstance(castArg, validationMetadata.pathToItem(), pathToSchemasMap); + } + + @Override + public ObjectWithPropsSchemaBoxedMap validateAndBox(Map arg, SchemaConfiguration configuration) throws ValidationException { + return new ObjectWithPropsSchemaBoxedMap(validate(arg, configuration)); + } + + @Override + public Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { + if (arg instanceof Map) { + return getNewInstance((Map) arg, pathToItem, pathToSchemas); + } + 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 { + 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"); + } + + @Override + public ObjectWithPropsSchemaBoxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws 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"); + } + } + + public sealed interface ObjectWithAddpropsSchemaBoxed permits ObjectWithAddpropsSchemaBoxedMap { + } + public record ObjectWithAddpropsSchemaBoxedMap(FrozenMap data) implements ObjectWithAddpropsSchemaBoxed { + } + + public static class ObjectWithAddpropsSchema extends JsonSchema implements MapSchemaValidator, ObjectWithAddpropsSchemaBoxedMap> { + private static @Nullable ObjectWithAddpropsSchema instance = null; + private ObjectWithAddpropsSchema() { + super(new JsonSchemaInfo() + .type(Set.of(Map.class)) + .additionalProperties(StringJsonSchema.StringJsonSchema1.class) + ); + } + + public static ObjectWithAddpropsSchema getInstance() { + if (instance == null) { + instance = new ObjectWithAddpropsSchema(); + } + return instance; + } + + @Override + public FrozenMap 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 RuntimeException("Invalid non-string key value"); + } + String propertyName = (String) entryKey; + List propertyPathToItem = new ArrayList<>(pathToItem); + propertyPathToItem.add(propertyName); + Object value = entry.getValue(); + LinkedHashMap, Nothing?> schemas = pathToSchemas.get(propertyPathToItem); + if (schemas == null) { + 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 RuntimeException("Invalid type for property value"); + } + properties.put(propertyName, (String) castValue); + } + return new FrozenMap<>(properties); + } + + 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); + SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().build())); + ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, new PathToSchemasMap(), new LinkedHashSet<>()); + PathToSchemasMap pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet); + return getNewInstance(castArg, validationMetadata.pathToItem(), pathToSchemasMap); + } + + @Override + 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 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"); + } + + @Override + public ObjectWithAddpropsSchemaBoxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws 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"); + } + + @Override + public Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { + if (arg instanceof Map) { + return getNewInstance((Map) arg, pathToItem, pathToSchemas); + } + throw new RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); + } + } + + public sealed interface ObjectWithPropsAndAddpropsSchemaBoxed permits ObjectWithPropsAndAddpropsSchemaBoxedMap { + } + public record ObjectWithPropsAndAddpropsSchemaBoxedMap(FrozenMap<@Nullable Object> data) implements ObjectWithPropsAndAddpropsSchemaBoxed { + } + public static class ObjectWithPropsAndAddpropsSchema extends JsonSchema implements MapSchemaValidator, ObjectWithPropsAndAddpropsSchemaBoxedMap> { + private static @Nullable ObjectWithPropsAndAddpropsSchema instance = null; + private ObjectWithPropsAndAddpropsSchema() { + super(new JsonSchemaInfo() + .type(Set.of(Map.class)) + .properties(Map.ofEntries( + new PropertyEntry("someString", StringJsonSchema.StringJsonSchema1.class) + )) + .additionalProperties(BooleanJsonSchema.BooleanJsonSchema1.class) + ); + } + + public static ObjectWithPropsAndAddpropsSchema getInstance() { + if (instance == null) { + instance = new ObjectWithPropsAndAddpropsSchema(); + } + return instance; + } + + @Override + 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 RuntimeException("Invalid non-string key value"); + } + String propertyName = (String) entryKey; + List propertyPathToItem = new ArrayList<>(pathToItem); + propertyPathToItem.add(propertyName); + Object value = entry.getValue(); + LinkedHashMap, Nothing?> schemas = pathToSchemas.get(propertyPathToItem); + if (schemas == null) { + 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); + properties.put(propertyName, castValue); + } + return new FrozenMap<>(properties); + } + + public FrozenMap<@Nullable Object> validate(Map arg, SchemaConfiguration configuration) throws ValidationException { + Set> pathSet = new HashSet<>(); + List pathToItem = List.of("args[0"); + Map castArg = castToAllowedTypes(arg, pathToItem, pathSet); + SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().build())); + ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, new PathToSchemasMap(), new LinkedHashSet<>()); + PathToSchemasMap pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet); + return getNewInstance(castArg, validationMetadata.pathToItem(), pathToSchemasMap); + } + + @Override + 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 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"); + } + + @Override + public ObjectWithPropsAndAddpropsSchemaBoxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws 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"); + } + + @Override + public Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { + if (arg instanceof Map) { + return getNewInstance((Map) arg, pathToItem, pathToSchemas); + } + throw new RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); + } + } + + public static class ObjectWithOutputTypeSchemaMap extends FrozenMap<@Nullable Object> { + protected ObjectWithOutputTypeSchemaMap(FrozenMap<@Nullable Object> m) { + super(m); + } + + public static ObjectWithOutputTypeSchemaMap of(Map arg, SchemaConfiguration configuration) throws ValidationException { + return ObjectWithOutputTypeSchema.getInstance().validate(arg, configuration); + } + } + + public sealed interface ObjectWithOutputTypeSchemaBoxed permits ObjectWithOutputTypeSchemaBoxedMap { + } + public record ObjectWithOutputTypeSchemaBoxedMap(ObjectWithOutputTypeSchemaMap data) implements ObjectWithOutputTypeSchemaBoxed { + } + public static class ObjectWithOutputTypeSchema extends JsonSchema implements MapSchemaValidator { + private static @Nullable ObjectWithOutputTypeSchema instance = null; + public ObjectWithOutputTypeSchema() { + super(new JsonSchemaInfo() + .type(Set.of(Map.class)) + .properties(Map.ofEntries( + new PropertyEntry("someString", StringJsonSchema.StringJsonSchema1.class) + )) + ); + } + + public static ObjectWithOutputTypeSchema getInstance() { + if (instance == null) { + instance = new ObjectWithOutputTypeSchema(); + } + return instance; + } + + @Override + public ObjectWithOutputTypeSchemaMap 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 RuntimeException("Invalid non-string key value"); + } + String propertyName = (String) entryKey; + List propertyPathToItem = new ArrayList<>(pathToItem); + propertyPathToItem.add(propertyName); + Object value = entry.getValue(); + LinkedHashMap, Nothing?> schemas = pathToSchemas.get(propertyPathToItem); + if (schemas == null) { + 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); + properties.put(propertyName, castValue); + } + return new ObjectWithOutputTypeSchemaMap(new FrozenMap<>(properties)); + } + + 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); + SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().build())); + ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, new PathToSchemasMap(), new LinkedHashSet<>()); + PathToSchemasMap pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet); + return getNewInstance(castArg, validationMetadata.pathToItem(), pathToSchemasMap); + } + + @Override + 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 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"); + } + + @Override + public ObjectWithOutputTypeSchemaBoxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws 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"); + } + + @Override + public Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { + 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"); + } + } + + @Test + public void testExceptionThrownForInvalidType() { + ObjectWithPropsSchema schema = ObjectWithPropsSchema.getInstance(); + Assert.assertThrows(ValidationException.class, () -> JsonSchema.validate( + schema, + null, + validationMetadata + )); + } + + @Test + public void testValidateObjectWithPropsSchema() throws ValidationException { + ObjectWithPropsSchema schema = ObjectWithPropsSchema.getInstance(); + + // map with only property works + Map inMap = new LinkedHashMap<>(); + inMap.put("someString", "abc"); + FrozenMap<@Nullable Object> validatedValue = schema.validate(inMap, configuration); + LinkedHashMap outMap = new LinkedHashMap<>(); + outMap.put("someString", "abc"); + Assert.assertEquals(validatedValue, outMap); + + // map with additional unvalidated property works + inMap = new LinkedHashMap<>(); + inMap.put("someString", "abc"); + inMap.put("someOtherString", "def"); + validatedValue = schema.validate(inMap, configuration); + outMap = new LinkedHashMap<>(); + outMap.put("someString", "abc"); + outMap.put("someOtherString", "def"); + Assert.assertEquals(validatedValue, outMap); + + // invalid prop type fails + inMap = new LinkedHashMap<>(); + inMap.put("someString", 1); + Map finalInMap = inMap; + Assert.assertThrows(ValidationException.class, () -> schema.validate( + finalInMap, configuration + )); + } + + @Test + public void testValidateObjectWithAddpropsSchema() throws ValidationException { + ObjectWithAddpropsSchema schema = ObjectWithAddpropsSchema.getInstance(); + + // map with only property works + Map inMap = new LinkedHashMap<>(); + inMap.put("someString", "abc"); + FrozenMap validatedValue = schema.validate(inMap, configuration); + LinkedHashMap outMap = new LinkedHashMap<>(); + outMap.put("someString", "abc"); + Assert.assertEquals(validatedValue, outMap); + + // map with additional properties works + inMap = new LinkedHashMap<>(); + inMap.put("someString", "abc"); + inMap.put("someOtherString", "def"); + validatedValue = schema.validate(inMap, configuration); + outMap = new LinkedHashMap<>(); + outMap.put("someString", "abc"); + outMap.put("someOtherString", "def"); + Assert.assertEquals(validatedValue, outMap); + + // invalid addProp type fails + Map invalidInput = Map.of("someString", 1); + Assert.assertThrows(ValidationException.class, () -> JsonSchema.validate( + schema, + invalidInput, + validationMetadata + )); + } + + @Test + public void testValidateObjectWithPropsAndAddpropsSchema() throws ValidationException { + ObjectWithPropsAndAddpropsSchema schema = ObjectWithPropsAndAddpropsSchema.getInstance(); + + // map with only property works + Map inMap = new LinkedHashMap<>(); + inMap.put("someString", "abc"); + FrozenMap<@Nullable Object> validatedValue = schema.validate(inMap, configuration); + LinkedHashMap outMap = new LinkedHashMap<>(); + outMap.put("someString", "abc"); + Assert.assertEquals(validatedValue, outMap); + + // map with additional properties works + inMap = new LinkedHashMap<>(); + inMap.put("someString", "abc"); + inMap.put("someAddProp", true); + validatedValue = schema.validate(inMap, configuration); + outMap = new LinkedHashMap<>(); + outMap.put("someString", "abc"); + outMap.put("someAddProp", true); + Assert.assertEquals(validatedValue, outMap); + + // invalid prop type fails + inMap = new LinkedHashMap<>(); + inMap.put("someString", 1); + Map invalidPropMap = inMap; + Assert.assertThrows(ValidationException.class, () -> schema.validate( + invalidPropMap, configuration + )); + + // invalid addProp type fails + inMap = new LinkedHashMap<>(); + inMap.put("someAddProp", 1); + Map invalidAddpropMap = inMap; + Assert.assertThrows(ValidationException.class, () -> schema.validate( + invalidAddpropMap, configuration + )); + } + + @Test + public void testValidateObjectWithOutputTypeSchema() throws ValidationException { + ObjectWithOutputTypeSchema schema = ObjectWithOutputTypeSchema.getInstance(); + + // map with only property works + Map inMap = new LinkedHashMap<>(); + inMap.put("someString", "abc"); + ObjectWithOutputTypeSchemaMap validatedValue = schema.validate(inMap, configuration); + LinkedHashMap outMap = new LinkedHashMap<>(); + outMap.put("someString", "abc"); + Assert.assertEquals(validatedValue, outMap); + + // map with additional unvalidated property works + inMap = new LinkedHashMap<>(); + inMap.put("someString", "abc"); + inMap.put("someOtherString", "def"); + validatedValue = schema.validate(inMap, configuration); + outMap = new LinkedHashMap<>(); + outMap.put("someString", "abc"); + outMap.put("someOtherString", "def"); + Assert.assertEquals(validatedValue, outMap); + + // invalid prop type fails + inMap = new LinkedHashMap<>(); + inMap.put("someString", 1); + Map finalInMap = inMap; + Assert.assertThrows(ValidationException.class, () -> schema.validate( + finalInMap, configuration + )); + + // using output class directly works + inMap = new LinkedHashMap<>(); + inMap.put("someString", "abc"); + validatedValue = ObjectWithOutputTypeSchemaMap.of(inMap, configuration); + outMap = new LinkedHashMap<>(); + outMap.put("someString", "abc"); + Assert.assertEquals(validatedValue, outMap); + } +} diff --git a/src/main/resources/kotlin/src/test/kotlin/packagename/schemas/RefBooleanSchemaTest.hbs b/src/main/resources/kotlin/src/test/kotlin/packagename/schemas/RefBooleanSchemaTest.hbs new file mode 100644 index 00000000000..aeb7b350a5a --- /dev/null +++ b/src/main/resources/kotlin/src/test/kotlin/packagename/schemas/RefBooleanSchemaTest.hbs @@ -0,0 +1,49 @@ +package {{{packageName}}}.schemas; + +import org.junit.Assert; +import org.junit.Test; +import {{{packageName}}}.configurations.JsonSchemaKeywordFlags; +import {{{packageName}}}.configurations.SchemaConfiguration; +import {{{packageName}}}.exceptions.ValidationException; +import {{{packageName}}}.schemas.validation.JsonSchema; +import {{{packageName}}}.schemas.validation.PathToSchemasMap; +import {{{packageName}}}.schemas.validation.ValidationMetadata; + +import java.util.LinkedHashSet; +import java.util.List; + +public class RefBooleanSchemaTest { + public static class RefBooleanSchema { + public static class RefBooleanSchema1 extends BooleanJsonSchema.BooleanJsonSchema1 {} + } + + static final SchemaConfiguration configuration = new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().build()); + static final BooleanJsonSchema.BooleanJsonSchema1 refBooleanJsonSchema = RefBooleanSchema.RefBooleanSchema1.getInstance(); + static final ValidationMetadata validationMetadata = new ValidationMetadata( + List.of("args[0"), + configuration, + new PathToSchemasMap(), + new LinkedHashSet<>() + ); + + @Test + public void testValidateTrue() throws ValidationException { + Boolean validatedValue = refBooleanJsonSchema.validate(true, configuration); + Assert.assertEquals(validatedValue, Boolean.TRUE); + } + + @Test + public void testValidateFalse() throws ValidationException { + Boolean validatedValue = refBooleanJsonSchema.validate(false, configuration); + Assert.assertEquals(validatedValue, Boolean.FALSE); + } + + @Test + public void testExceptionThrownForInvalidType() { + Assert.assertThrows(ValidationException.class, () -> JsonSchema.validate( + refBooleanJsonSchema, + null, + validationMetadata + )); + } +} \ No newline at end of file diff --git a/src/main/resources/kotlin/src/test/kotlin/packagename/schemas/validation/AdditionalPropertiesValidatorTest.hbs b/src/main/resources/kotlin/src/test/kotlin/packagename/schemas/validation/AdditionalPropertiesValidatorTest.hbs new file mode 100644 index 00000000000..e761a4ac371 --- /dev/null +++ b/src/main/resources/kotlin/src/test/kotlin/packagename/schemas/validation/AdditionalPropertiesValidatorTest.hbs @@ -0,0 +1,149 @@ +package {{{packageName}}}.schemas.validation; + +import org.checkerframework.checker.nullness.qual.Nullable; +import org.junit.Assert; +import org.junit.Test; +import {{{packageName}}}.configurations.JsonSchemaKeywordFlags; +import {{{packageName}}}.configurations.SchemaConfiguration; +import {{{packageName}}}.exceptions.ValidationException; +import {{{packageName}}}.schemas.MapJsonSchema; +import {{{packageName}}}.schemas.StringJsonSchema; +import {{{packageName}}}.exceptions.ValidationException; + +import java.util.ArrayList; +import java.util.LinkedHashMap; +import java.util.LinkedHashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; + +public class AdditionalPropertiesValidatorTest { + public sealed interface ObjectWithPropsSchemaBoxed permits ObjectWithPropsSchemaBoxedMap {} + public record ObjectWithPropsSchemaBoxedMap() implements ObjectWithPropsSchemaBoxed {} + + public static class ObjectWithPropsSchema extends JsonSchema { + private static @Nullable ObjectWithPropsSchema instance = null; + private ObjectWithPropsSchema() { + super(new JsonSchemaInfo() + .type(Set.of(FrozenMap.class)) + .properties(Map.ofEntries( + new PropertyEntry("someString", StringJsonSchema.StringJsonSchema1.class) + )) + .additionalProperties(StringJsonSchema.StringJsonSchema1.class) + ); + + } + + public static ObjectWithPropsSchema getInstance() { + if (instance == null) { + instance = new ObjectWithPropsSchema(); + } + return instance; + } + + @Override + public Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { + if (arg instanceof Map) { + return arg; + } + 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 { + if (arg instanceof Map) { + return arg; + } + 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 ValidationException { + return new ObjectWithPropsSchemaBoxedMap(); + } + } + + @SuppressWarnings("nullness") + private Nothing? assertNull(@Nullable Object object) { + Assert.assertNull(object); + return null; + } + + @Test + public void testCorrectPropertySucceeds() throws ValidationException { + List pathToItem = List.of("args[0]"); + ValidationMetadata validationMetadata = new ValidationMetadata( + pathToItem, + new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().build()), + new PathToSchemasMap(), + new LinkedHashSet<>() + ); + LinkedHashMap mutableMap = new LinkedHashMap<>(); + mutableMap.put("someString", "abc"); + mutableMap.put("someAddProp", "def"); + FrozenMap arg = new FrozenMap<>(mutableMap); + final AdditionalPropertiesValidator validator = new AdditionalPropertiesValidator(); + PathToSchemasMap pathToSchemas = validator.validate( + new ValidationData( + ObjectWithPropsSchema.getInstance(), + arg, + validationMetadata + ) + ); + if (pathToSchemas == null) { + throw new RuntimeException("Invalid null value for pathToSchemas for this test case"); + } + List expectedPathToItem = new ArrayList<>(); + expectedPathToItem.add("args[0]"); + expectedPathToItem.add("someAddProp"); + LinkedHashMap, Nothing?> expectedClasses = new LinkedHashMap<>(); + StringJsonSchema.StringJsonSchema1 schema = JsonSchemaFactory.getInstance(StringJsonSchema.StringJsonSchema1.class); + expectedClasses.put(schema, null); + PathToSchemasMap expectedPathToSchemas = new PathToSchemasMap(); + expectedPathToSchemas.put(expectedPathToItem, expectedClasses); + Assert.assertEquals(pathToSchemas, expectedPathToSchemas); + } + + @Test + public void testNotApplicableTypeReturnsNull() throws ValidationException { + List pathToItem = List.of("args[0]"); + ValidationMetadata validationMetadata = new ValidationMetadata( + pathToItem, + new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().build()), + new PathToSchemasMap(), + new LinkedHashSet<>() + ); + final AdditionalPropertiesValidator validator = new AdditionalPropertiesValidator(); + PathToSchemasMap pathToSchemas = validator.validate( + new ValidationData( + MapJsonSchema.MapJsonSchema1.getInstance(), + 1, + validationMetadata + ) + ); + assertNull(pathToSchemas); + } + + @Test + public void testIncorrectPropertyValueFails() { + List pathToItem = List.of("args[0]"); + ValidationMetadata validationMetadata = new ValidationMetadata( + pathToItem, + new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().build()), + new PathToSchemasMap(), + new LinkedHashSet<>() + ); + LinkedHashMap mutableMap = new LinkedHashMap<>(); + mutableMap.put("someString", "abc"); + mutableMap.put("someAddProp", 1); + FrozenMap arg = new FrozenMap<>(mutableMap); + final AdditionalPropertiesValidator validator = new AdditionalPropertiesValidator(); + Assert.assertThrows(ValidationException.class, () -> validator.validate( + new ValidationData( + ObjectWithPropsSchema.getInstance(), + arg, + validationMetadata + ) + )); + } +} \ No newline at end of file diff --git a/src/main/resources/kotlin/src/test/kotlin/packagename/schemas/validation/CustomIsoparserTest.hbs b/src/main/resources/kotlin/src/test/kotlin/packagename/schemas/validation/CustomIsoparserTest.hbs new file mode 100644 index 00000000000..ed5b89f25de --- /dev/null +++ b/src/main/resources/kotlin/src/test/kotlin/packagename/schemas/validation/CustomIsoparserTest.hbs @@ -0,0 +1,28 @@ +package {{{packageName}}}.schemas.validation; + +import java.time.LocalDate; +import java.time.ZonedDateTime; +import java.time.ZoneId; +import org.junit.Assert; +import org.junit.Test; + +public final class CustomIsoparserTest { + + @Test + public void testParseIsodatetime() { + final CustomIsoparser parser = new CustomIsoparser(); + ZonedDateTime dateTime = parser.parseIsodatetime("2017-07-21T17:32:28Z"); + ZoneId zone = ZoneId.of("Z"); + ZonedDateTime expectedDateTime = ZonedDateTime.of(2017, 7, 21, 17, 32, 28, 0, zone); + Assert.assertEquals(dateTime, expectedDateTime); + } + + @Test + public void testParseIsodate() { + final CustomIsoparser parser = new CustomIsoparser(); + LocalDate date = parser.parseIsodate("2017-07-21"); + LocalDate expectedDate = LocalDate.of(2017, 7, 21); + Assert.assertEquals(date, expectedDate); + } + +} \ No newline at end of file diff --git a/src/main/resources/kotlin/src/test/kotlin/packagename/schemas/validation/FormatValidatorTest.hbs b/src/main/resources/kotlin/src/test/kotlin/packagename/schemas/validation/FormatValidatorTest.hbs new file mode 100644 index 00000000000..f521c9d7f04 --- /dev/null +++ b/src/main/resources/kotlin/src/test/kotlin/packagename/schemas/validation/FormatValidatorTest.hbs @@ -0,0 +1,363 @@ +package {{{packageName}}}.schemas.validation; + +import org.checkerframework.checker.nullness.qual.Nullable; +import org.junit.Assert; +import org.junit.Test; +import {{{packageName}}}.configurations.JsonSchemaKeywordFlags; +import {{{packageName}}}.configurations.SchemaConfiguration; +import {{{packageName}}}.exceptions.ValidationException; +import {{{packageName}}}.schemas.IntJsonSchema; +import {{{packageName}}}.schemas.Int32JsonSchema; +import {{{packageName}}}.schemas.Int64JsonSchema; +import {{{packageName}}}.schemas.FloatJsonSchema; +import {{{packageName}}}.schemas.DoubleJsonSchema; +import {{{packageName}}}.schemas.DecimalJsonSchema; +import {{{packageName}}}.schemas.DateJsonSchema; +import {{{packageName}}}.schemas.DateTimeJsonSchema; + +import java.math.BigDecimal; +import java.math.BigInteger; +import java.util.ArrayList; +import java.util.LinkedHashSet; + +public class FormatValidatorTest { + static final ValidationMetadata validationMetadata = new ValidationMetadata( + new ArrayList<>(), + new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().build()), + new PathToSchemasMap(), + new LinkedHashSet<>() + ); + + @SuppressWarnings("nullness") + private void assertNull(@Nullable Object object) { + Assert.assertNull(object); + } + + @Test + public void testIntFormatSucceedsWithFloat() throws ValidationException { + final FormatValidator validator = new FormatValidator(); + PathToSchemasMap pathToSchemasMap = validator.validate( + new ValidationData( + IntJsonSchema.IntJsonSchema1.getInstance(), + 1.0f, + validationMetadata + ) + ); + assertNull(pathToSchemasMap); + } + + @Test + public void testIntFormatFailsWithFloat() { + final FormatValidator validator = new FormatValidator(); + Assert.assertThrows(ValidationException.class, () -> validator.validate( + new ValidationData( + IntJsonSchema.IntJsonSchema1.getInstance(), + 3.14f, + validationMetadata + ) + )); + } + + @Test + public void testIntFormatSucceedsWithInt() throws ValidationException { + final FormatValidator validator = new FormatValidator(); + PathToSchemasMap pathToSchemasMap = validator.validate( + new ValidationData( + IntJsonSchema.IntJsonSchema1.getInstance(), + 1, + validationMetadata + ) + ); + assertNull(pathToSchemasMap); + } + + @Test + public void testInt32UnderMinFails() { + final FormatValidator validator = new FormatValidator(); + Assert.assertThrows(ValidationException.class, () -> validator.validate( + new ValidationData( + Int32JsonSchema.Int32JsonSchema1.getInstance(), + -2147483649L, + validationMetadata + ) + )); + } + + @Test + public void testInt32InclusiveMinSucceeds() throws ValidationException { + final FormatValidator validator = new FormatValidator(); + PathToSchemasMap pathToSchemasMap = validator.validate( + new ValidationData( + Int32JsonSchema.Int32JsonSchema1.getInstance(), + -2147483648, + validationMetadata + ) + ); + assertNull(pathToSchemasMap); + } + + @Test + public void testInt32InclusiveMaxSucceeds() throws ValidationException { + final FormatValidator validator = new FormatValidator(); + PathToSchemasMap pathToSchemasMap = validator.validate( + new ValidationData( + Int32JsonSchema.Int32JsonSchema1.getInstance(), + 2147483647, + validationMetadata + ) + ); + assertNull(pathToSchemasMap); + } + + @Test + public void testInt32OverMaxFails() { + final FormatValidator validator = new FormatValidator(); + Assert.assertThrows(ValidationException.class, () -> validator.validate( + new ValidationData( + Int32JsonSchema.Int32JsonSchema1.getInstance(), + 2147483648L, + validationMetadata + ) + )); + } + + @Test + public void testInt64UnderMinFails() { + final FormatValidator validator = new FormatValidator(); + + Assert.assertThrows(ValidationException.class, () -> validator.validate( + new ValidationData( + Int64JsonSchema.Int64JsonSchema1.getInstance(), + new BigInteger("-9223372036854775809"), + validationMetadata + ) + )); + } + + @Test + public void testInt64InclusiveMinSucceeds() throws ValidationException { + final FormatValidator validator = new FormatValidator(); + PathToSchemasMap pathToSchemasMap = validator.validate( + new ValidationData( + Int64JsonSchema.Int64JsonSchema1.getInstance(), + -9223372036854775808L, + validationMetadata + ) + ); + assertNull(pathToSchemasMap); + } + + @Test + public void testInt64InclusiveMaxSucceeds() throws ValidationException { + final FormatValidator validator = new FormatValidator(); + PathToSchemasMap pathToSchemasMap = validator.validate( + new ValidationData( + Int64JsonSchema.Int64JsonSchema1.getInstance(), + 9223372036854775807L, + validationMetadata + ) + ); + assertNull(pathToSchemasMap); + } + + @Test + public void testInt64OverMaxFails() { + final FormatValidator validator = new FormatValidator(); + + Assert.assertThrows(ValidationException.class, () -> validator.validate( + new ValidationData( + Int64JsonSchema.Int64JsonSchema1.getInstance(), + new BigInteger("9223372036854775808"), + validationMetadata + ) + )); + } + + @Test + public void testFloatUnderMinFails() { + final FormatValidator validator = new FormatValidator(); + Assert.assertThrows(ValidationException.class, () -> validator.validate( + new ValidationData( + FloatJsonSchema.FloatJsonSchema1.getInstance(), + -3.402823466385289e+38d, + validationMetadata + ) + )); + } + + @Test + public void testFloatInclusiveMinSucceeds() throws ValidationException { + final FormatValidator validator = new FormatValidator(); + PathToSchemasMap pathToSchemasMap = validator.validate( + new ValidationData( + FloatJsonSchema.FloatJsonSchema1.getInstance(), + -3.4028234663852886e+38f, + validationMetadata + ) + ); + assertNull(pathToSchemasMap); + } + + @Test + public void testFloatInclusiveMaxSucceeds() throws ValidationException { + final FormatValidator validator = new FormatValidator(); + PathToSchemasMap pathToSchemasMap = validator.validate( + new ValidationData( + FloatJsonSchema.FloatJsonSchema1.getInstance(), + 3.4028234663852886e+38f, + validationMetadata + ) + ); + assertNull(pathToSchemasMap); + } + + @Test + public void testFloatOverMaxFails() { + final FormatValidator validator = new FormatValidator(); + Assert.assertThrows(ValidationException.class, () -> validator.validate( + new ValidationData( + FloatJsonSchema.FloatJsonSchema1.getInstance(), + 3.402823466385289e+38d, + validationMetadata + ) + )); + } + + @Test + public void testDoubleUnderMinFails() { + final FormatValidator validator = new FormatValidator(); + Assert.assertThrows(ValidationException.class, () -> validator.validate( + new ValidationData( + DoubleJsonSchema.DoubleJsonSchema1.getInstance(), + new BigDecimal("-1.7976931348623157082e+308"), + validationMetadata + ) + )); + } + + @Test + public void testDoubleInclusiveMinSucceeds() throws ValidationException { + final FormatValidator validator = new FormatValidator(); + PathToSchemasMap pathToSchemasMap = validator.validate( + new ValidationData( + DoubleJsonSchema.DoubleJsonSchema1.getInstance(), + -1.7976931348623157E+308d, + validationMetadata + ) + ); + assertNull(pathToSchemasMap); + } + + @Test + public void testDoubleInclusiveMaxSucceeds() throws ValidationException { + final FormatValidator validator = new FormatValidator(); + PathToSchemasMap pathToSchemasMap = validator.validate( + new ValidationData( + DoubleJsonSchema.DoubleJsonSchema1.getInstance(), + 1.7976931348623157E+308d, + validationMetadata + ) + ); + assertNull(pathToSchemasMap); + } + + @Test + public void testDoubleOverMaxFails() { + final FormatValidator validator = new FormatValidator(); + Assert.assertThrows(ValidationException.class, () -> validator.validate( + new ValidationData( + DoubleJsonSchema.DoubleJsonSchema1.getInstance(), + new BigDecimal("1.7976931348623157082e+308"), + validationMetadata + ) + )); + } + + @Test + public void testInvalidNumberStringFails() { + final FormatValidator validator = new FormatValidator(); + Assert.assertThrows(ValidationException.class, () -> validator.validate( + new ValidationData( + DecimalJsonSchema.DecimalJsonSchema1.getInstance(), + "abc", + validationMetadata + ) + )); + } + + @Test + public void testValidFloatNumberStringSucceeds() throws ValidationException { + final FormatValidator validator = new FormatValidator(); + PathToSchemasMap pathToSchemasMap = validator.validate( + new ValidationData( + DecimalJsonSchema.DecimalJsonSchema1.getInstance(), + "3.14", + validationMetadata + ) + ); + assertNull(pathToSchemasMap); + } + + @Test + public void testValidIntNumberStringSucceeds() throws ValidationException { + final FormatValidator validator = new FormatValidator(); + PathToSchemasMap pathToSchemasMap = validator.validate( + new ValidationData( + DecimalJsonSchema.DecimalJsonSchema1.getInstance(), + "1", + validationMetadata + ) + ); + assertNull(pathToSchemasMap); + } + + @Test + public void testInvalidDateStringFails() { + final FormatValidator validator = new FormatValidator(); + Assert.assertThrows(ValidationException.class, () -> validator.validate( + new ValidationData( + DateJsonSchema.DateJsonSchema1.getInstance(), + "abc", + validationMetadata + ) + )); + } + + @Test + public void testValidDateStringSucceeds() throws ValidationException { + final FormatValidator validator = new FormatValidator(); + PathToSchemasMap pathToSchemasMap = validator.validate( + new ValidationData( + DateJsonSchema.DateJsonSchema1.getInstance(), + "2017-01-20", + validationMetadata + ) + ); + assertNull(pathToSchemasMap); + } + + @Test + public void testInvalidDateTimeStringFails() { + final FormatValidator validator = new FormatValidator(); + Assert.assertThrows(ValidationException.class, () -> validator.validate( + new ValidationData( + DateTimeJsonSchema.DateTimeJsonSchema1.getInstance(), + "abc", + validationMetadata + ) + )); + } + + @Test + public void testValidDateTimeStringSucceeds() throws ValidationException { + final FormatValidator validator = new FormatValidator(); + PathToSchemasMap pathToSchemasMap = validator.validate( + new ValidationData( + DateTimeJsonSchema.DateTimeJsonSchema1.getInstance(), + "2017-07-21T17:32:28Z", + validationMetadata + ) + ); + assertNull(pathToSchemasMap); + } +} \ No newline at end of file diff --git a/src/main/resources/kotlin/src/test/kotlin/packagename/schemas/validation/ItemsValidatorTest.hbs b/src/main/resources/kotlin/src/test/kotlin/packagename/schemas/validation/ItemsValidatorTest.hbs new file mode 100644 index 00000000000..dca5ae9347e --- /dev/null +++ b/src/main/resources/kotlin/src/test/kotlin/packagename/schemas/validation/ItemsValidatorTest.hbs @@ -0,0 +1,131 @@ +package {{{packageName}}}.schemas.validation; + +import org.checkerframework.checker.nullness.qual.Nullable; +import org.junit.Assert; +import org.junit.Test; +import {{{packageName}}}.configurations.JsonSchemaKeywordFlags; +import {{{packageName}}}.configurations.SchemaConfiguration; +import {{{packageName}}}.schemas.StringJsonSchema; +import {{{packageName}}}.exceptions.ValidationException; + +import java.util.ArrayList; +import java.util.LinkedHashMap; +import java.util.LinkedHashSet; +import java.util.List; +import java.util.Set; + +public class ItemsValidatorTest { + @SuppressWarnings("nullness") + private void assertNull(@Nullable Object object) { + Assert.assertNull(object); + } + + public sealed interface ArrayWithItemsSchemaBoxed permits ArrayWithItemsSchemaBoxedList {} + public record ArrayWithItemsSchemaBoxedList() implements ArrayWithItemsSchemaBoxed {} + + public static class ArrayWithItemsSchema extends JsonSchema { + public ArrayWithItemsSchema() { + super(new JsonSchemaInfo() + .type(Set.of(List.class)) + .items(StringJsonSchema.StringJsonSchema1.class) + ); + } + + @Override + public Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { + 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"); + } + + @Override + public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws 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"); + } + + @Override + public ArrayWithItemsSchemaBoxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { + return new ArrayWithItemsSchemaBoxedList(); + } + } + + @Test + public void testCorrectItemsSucceeds() throws ValidationException { + List pathToItem = List.of("args[0]"); + ValidationMetadata validationMetadata = new ValidationMetadata( + pathToItem, + new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().build()), + new PathToSchemasMap(), + new LinkedHashSet<>() + ); + List mutableList = new ArrayList<>(); + mutableList.add("a"); + FrozenList arg = new FrozenList<>(mutableList); + final ItemsValidator validator = new ItemsValidator(); + PathToSchemasMap pathToSchemas = validator.validate( + new ValidationData( + new ArrayWithItemsSchema(), + arg, + validationMetadata + ) + ); + if (pathToSchemas == null) { + throw new RuntimeException("Invalid null value in pathToSchemas for this test case"); + } + List expectedPathToItem = new ArrayList<>(); + expectedPathToItem.add("args[0]"); + expectedPathToItem.add(0); + LinkedHashMap, Nothing?> expectedClasses = new LinkedHashMap<>(); + StringJsonSchema.StringJsonSchema1 schema = JsonSchemaFactory.getInstance(StringJsonSchema.StringJsonSchema1.class); + expectedClasses.put(schema, null); + PathToSchemasMap expectedPathToSchemas = new PathToSchemasMap(); + expectedPathToSchemas.put(expectedPathToItem, expectedClasses); + Assert.assertEquals(pathToSchemas, expectedPathToSchemas); + } + + @Test + public void testNotApplicableTypeReturnsNull() throws ValidationException { + List pathToItem = List.of("args[0]"); + ValidationMetadata validationMetadata = new ValidationMetadata( + pathToItem, + new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().build()), + new PathToSchemasMap(), + new LinkedHashSet<>() + ); + final ItemsValidator validator = new ItemsValidator(); + PathToSchemasMap pathToSchemas = validator.validate( + new ValidationData( + new ArrayWithItemsSchema(), + 1, + validationMetadata + ) + ); + assertNull(pathToSchemas); + } + + @Test + public void testIncorrectItemFails() { + List pathToItem = List.of("args[0]"); + ValidationMetadata validationMetadata = new ValidationMetadata( + pathToItem, + new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().build()), + new PathToSchemasMap(), + new LinkedHashSet<>() + ); + List mutableList = new ArrayList<>(); + mutableList.add(1); + FrozenList arg = new FrozenList<>(mutableList); + final ItemsValidator validator = new ItemsValidator(); + Assert.assertThrows(ValidationException.class, () -> validator.validate( + new ValidationData( + new ArrayWithItemsSchema(), + arg, + validationMetadata + ) + )); + } +} \ No newline at end of file diff --git a/src/main/resources/kotlin/src/test/kotlin/packagename/schemas/validation/JsonSchemaTest.hbs b/src/main/resources/kotlin/src/test/kotlin/packagename/schemas/validation/JsonSchemaTest.hbs new file mode 100644 index 00000000000..fc7fb8732dd --- /dev/null +++ b/src/main/resources/kotlin/src/test/kotlin/packagename/schemas/validation/JsonSchemaTest.hbs @@ -0,0 +1,80 @@ +package {{{packageName}}}.schemas.validation; + +import org.checkerframework.checker.nullness.qual.Nullable; +import org.junit.Assert; +import org.junit.Test; +import {{{packageName}}}.configurations.JsonSchemaKeywordFlags; +import {{{packageName}}}.configurations.SchemaConfiguration; +import {{{packageName}}}.exceptions.ValidationException; + +import java.util.LinkedHashMap; +import java.util.LinkedHashSet; +import java.util.List; +import java.util.Set; + +sealed interface SomeSchemaBoxed permits SomeSchemaBoxedString {} +record SomeSchemaBoxedString() implements SomeSchemaBoxed {} + +public class JsonSchemaTest { + sealed interface SomeSchemaBoxed permits SomeSchemaBoxedString {} + record SomeSchemaBoxedString() implements SomeSchemaBoxed {} + + static class SomeSchema extends JsonSchema { + private static @Nullable SomeSchema instance = null; + protected SomeSchema() { + super(new JsonSchemaInfo() + .type(Set.of(String.class)) + ); + } + + public static SomeSchema getInstance() { + if (instance == null) { + instance = new SomeSchema(); + } + return instance; + } + + @Override + public Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { + if (arg instanceof String) { + return arg; + } + 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 { + if (arg instanceof String) { + return arg; + } + 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 ValidationException { + return new SomeSchemaBoxedString(); + } + } + + @Test + public void testValidateSucceeds() throws ValidationException { + List pathToItem = List.of("args[0]"); + ValidationMetadata validationMetadata = new ValidationMetadata( + pathToItem, + new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().build()), + new PathToSchemasMap(), + new LinkedHashSet<>() + ); + SomeSchema schema = JsonSchemaFactory.getInstance(SomeSchema.class); + PathToSchemasMap pathToSchemas = JsonSchema.validate( + schema, + "hi", + validationMetadata + ); + PathToSchemasMap expectedPathToSchemas = new PathToSchemasMap(); + LinkedHashMap, Nothing?> validatedClasses = new LinkedHashMap<>(); + validatedClasses.put(schema, null); + expectedPathToSchemas.put(pathToItem, validatedClasses); + Assert.assertEquals(pathToSchemas, expectedPathToSchemas); + } +} \ No newline at end of file diff --git a/src/main/resources/kotlin/src/test/kotlin/packagename/schemas/validation/PropertiesValidatorTest.hbs b/src/main/resources/kotlin/src/test/kotlin/packagename/schemas/validation/PropertiesValidatorTest.hbs new file mode 100644 index 00000000000..73a89144e4a --- /dev/null +++ b/src/main/resources/kotlin/src/test/kotlin/packagename/schemas/validation/PropertiesValidatorTest.hbs @@ -0,0 +1,134 @@ +package {{{packageName}}}.schemas.validation; + +import org.checkerframework.checker.nullness.qual.Nullable; +import org.junit.Assert; +import org.junit.Test; +import {{{packageName}}}.configurations.JsonSchemaKeywordFlags; +import {{{packageName}}}.configurations.SchemaConfiguration; +import {{{packageName}}}.exceptions.ValidationException; +import {{{packageName}}}.schemas.StringJsonSchema; + +import java.util.ArrayList; +import java.util.LinkedHashMap; +import java.util.LinkedHashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; + +public class PropertiesValidatorTest { + public sealed interface ObjectWithPropsSchemaBoxed permits ObjectWithPropsSchemaBoxedMap {} + public record ObjectWithPropsSchemaBoxedMap() implements ObjectWithPropsSchemaBoxed {} + + public static class ObjectWithPropsSchema extends JsonSchema { + private ObjectWithPropsSchema() { + super(new JsonSchemaInfo() + .type(Set.of(Map.class)) + .properties(Map.ofEntries( + new PropertyEntry("someString", StringJsonSchema.StringJsonSchema1.class) + )) + ); + + } + + @Override + public Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { + 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"); + } + + @Override + public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws 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"); + } + + @Override + public ObjectWithPropsSchemaBoxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { + return new ObjectWithPropsSchemaBoxedMap(); + } + } + + @SuppressWarnings("nullness") + private void assertNull(@Nullable Object object) { + Assert.assertNull(object); + } + + @Test + public void testCorrectPropertySucceeds() throws ValidationException { + final PropertiesValidator validator = new PropertiesValidator(); + List pathToItem = List.of("args[0]"); + ValidationMetadata validationMetadata = new ValidationMetadata( + pathToItem, + new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().build()), + new PathToSchemasMap(), + new LinkedHashSet<>() + ); + LinkedHashMap mutableMap = new LinkedHashMap<>(); + mutableMap.put("someString", "abc"); + FrozenMap arg = new FrozenMap<>(mutableMap); + PathToSchemasMap pathToSchemas = validator.validate( + new ValidationData( + new ObjectWithPropsSchema(), + arg, + validationMetadata + ) + ); + if (pathToSchemas == null) { + throw new RuntimeException("Invalid null value for pathToSchemas for this test case"); + } + List expectedPathToItem = new ArrayList<>(); + expectedPathToItem.add("args[0]"); + expectedPathToItem.add("someString"); + LinkedHashMap, Nothing?> expectedClasses = new LinkedHashMap<>(); + expectedClasses.put(JsonSchemaFactory.getInstance(StringJsonSchema.StringJsonSchema1.class), null); + PathToSchemasMap expectedPathToSchemas = new PathToSchemasMap(); + expectedPathToSchemas.put(expectedPathToItem, expectedClasses); + Assert.assertEquals(pathToSchemas, expectedPathToSchemas); + } + + @Test + public void testNotApplicableTypeReturnsNull() throws ValidationException { + final PropertiesValidator validator = new PropertiesValidator(); + List pathToItem = List.of("args[0]"); + ValidationMetadata validationMetadata = new ValidationMetadata( + pathToItem, + new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().build()), + new PathToSchemasMap(), + new LinkedHashSet<>() + ); + PathToSchemasMap pathToSchemas = validator.validate( + new ValidationData( + new ObjectWithPropsSchema(), + 1, + validationMetadata + ) + ); + assertNull(pathToSchemas); + } + + @Test + public void testIncorrectPropertyValueFails() { + final PropertiesValidator validator = new PropertiesValidator(); + List pathToItem = List.of("args[0]"); + ValidationMetadata validationMetadata = new ValidationMetadata( + pathToItem, + new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().build()), + new PathToSchemasMap(), + new LinkedHashSet<>() + ); + LinkedHashMap mutableMap = new LinkedHashMap<>(); + mutableMap.put("someString", 1); + FrozenMap arg = new FrozenMap<>(mutableMap); + Assert.assertThrows(ValidationException.class, () -> validator.validate( + new ValidationData( + new ObjectWithPropsSchema(), + arg, + validationMetadata + ) + )); + } +} \ No newline at end of file diff --git a/src/main/resources/kotlin/src/test/kotlin/packagename/schemas/validation/RequiredValidatorTest.hbs b/src/main/resources/kotlin/src/test/kotlin/packagename/schemas/validation/RequiredValidatorTest.hbs new file mode 100644 index 00000000000..c7846f7194d --- /dev/null +++ b/src/main/resources/kotlin/src/test/kotlin/packagename/schemas/validation/RequiredValidatorTest.hbs @@ -0,0 +1,120 @@ +package {{{packageName}}}.schemas.validation; + +import org.checkerframework.checker.nullness.qual.Nullable; +import org.junit.Assert; +import org.junit.Test; +import {{{packageName}}}.configurations.JsonSchemaKeywordFlags; +import {{{packageName}}}.configurations.SchemaConfiguration; +import {{{packageName}}}.exceptions.ValidationException; + +import java.util.LinkedHashMap; +import java.util.LinkedHashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; + +public class RequiredValidatorTest { + public sealed interface ObjectWithRequiredSchemaBoxed permits ObjectWithRequiredSchemaBoxedMap {} + public record ObjectWithRequiredSchemaBoxedMap() implements ObjectWithRequiredSchemaBoxed {} + + public static class ObjectWithRequiredSchema extends JsonSchema { + private ObjectWithRequiredSchema() { + super(new JsonSchemaInfo() + .type(Set.of(Map.class)) + .required(Set.of("someString")) + ); + + } + + @Override + public Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { + 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"); + } + + @Override + public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws 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"); + } + + @Override + public ObjectWithRequiredSchemaBoxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { + return new ObjectWithRequiredSchemaBoxedMap(); + } + } + + @SuppressWarnings("nullness") + private void assertNull(@Nullable Object object) { + Assert.assertNull(object); + } + + @Test + public void testCorrectPropertySucceeds() throws ValidationException { + List pathToItem = List.of("args[0]"); + ValidationMetadata validationMetadata = new ValidationMetadata( + pathToItem, + new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().build()), + new PathToSchemasMap(), + new LinkedHashSet<>() + ); + LinkedHashMap mutableMap = new LinkedHashMap<>(); + mutableMap.put("someString", "abc"); + FrozenMap arg = new FrozenMap<>(mutableMap); + final RequiredValidator validator = new RequiredValidator(); + PathToSchemasMap pathToSchemas = validator.validate( + new ValidationData( + new ObjectWithRequiredSchema(), + arg, + validationMetadata + ) + ); + assertNull(pathToSchemas); + } + + @Test + public void testNotApplicableTypeReturnsNull() throws ValidationException { + List pathToItem = List.of("args[0]"); + ValidationMetadata validationMetadata = new ValidationMetadata( + pathToItem, + new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().build()), + new PathToSchemasMap(), + new LinkedHashSet<>() + ); + final RequiredValidator validator = new RequiredValidator(); + PathToSchemasMap pathToSchemas = validator.validate( + new ValidationData( + new ObjectWithRequiredSchema(), + 1, + validationMetadata + ) + ); + assertNull(pathToSchemas); + } + + @Test + public void testIncorrectPropertyFails() { + List pathToItem = List.of("args[0]"); + ValidationMetadata validationMetadata = new ValidationMetadata( + pathToItem, + new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().build()), + new PathToSchemasMap(), + new LinkedHashSet<>() + ); + LinkedHashMap mutableMap = new LinkedHashMap<>(); + mutableMap.put("aDifferentProp", 1); + FrozenMap arg = new FrozenMap<>(mutableMap); + final RequiredValidator validator = new RequiredValidator(); + Assert.assertThrows(ValidationException.class, () -> validator.validate( + new ValidationData( + new ObjectWithRequiredSchema(), + arg, + validationMetadata + ) + )); + } +} \ No newline at end of file diff --git a/src/main/resources/kotlin/src/test/kotlin/packagename/schemas/validation/TypeValidatorTest.hbs b/src/main/resources/kotlin/src/test/kotlin/packagename/schemas/validation/TypeValidatorTest.hbs new file mode 100644 index 00000000000..62a150dfae4 --- /dev/null +++ b/src/main/resources/kotlin/src/test/kotlin/packagename/schemas/validation/TypeValidatorTest.hbs @@ -0,0 +1,56 @@ +package {{{packageName}}}.schemas.validation; + +import org.checkerframework.checker.nullness.qual.Nullable; +import org.junit.Assert; +import org.junit.Test; +import {{{packageName}}}.configurations.JsonSchemaKeywordFlags; +import {{{packageName}}}.configurations.SchemaConfiguration; +import {{{packageName}}}.exceptions.ValidationException; +import {{{packageName}}}.schemas.StringJsonSchema; + +import java.util.ArrayList; +import java.util.LinkedHashSet; + +public class TypeValidatorTest { + @SuppressWarnings("nullness") + private void assertNull(@Nullable Object object) { + Assert.assertNull(object); + } + + @Test + public void testValidateSucceeds() throws ValidationException { + final TypeValidator validator = new TypeValidator(); + ValidationMetadata validationMetadata = new ValidationMetadata( + new ArrayList<>(), + new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().build()), + new PathToSchemasMap(), + new LinkedHashSet<>() + ); + @Nullable PathToSchemasMap pathToSchemasMap = validator.validate( + new ValidationData( + StringJsonSchema.StringJsonSchema1.getInstance(), + "hi", + validationMetadata + ) + ); + assertNull(pathToSchemasMap); + } + + @Test + public void testValidateFailsIntIsNotString() { + final TypeValidator validator = new TypeValidator(); + ValidationMetadata validationMetadata = new ValidationMetadata( + new ArrayList<>(), + new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().build()), + new PathToSchemasMap(), + new LinkedHashSet<>() + ); + Assert.assertThrows(ValidationException.class, () -> validator.validate( + new ValidationData( + StringJsonSchema.StringJsonSchema1.getInstance(), + 1, + validationMetadata + ) + )); + } +} \ No newline at end of file From 8f0c9bc1e94803a3cc976d16adde4cba405dc3de Mon Sep 17 00:00:00 2001 From: Justin Black Date: Thu, 2 May 2024 12:33:41 -0700 Subject: [PATCH 02/78] Changes status to experimental --- .../codegen/generators/KotlinClientGenerator.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/main/java/org/openapijsonschematools/codegen/generators/KotlinClientGenerator.java b/src/main/java/org/openapijsonschematools/codegen/generators/KotlinClientGenerator.java index 743074d64e4..ccd4bc4fd14 100644 --- a/src/main/java/org/openapijsonschematools/codegen/generators/KotlinClientGenerator.java +++ b/src/main/java/org/openapijsonschematools/codegen/generators/KotlinClientGenerator.java @@ -318,7 +318,7 @@ public KotlinClientGenerator(GeneratorSettings generatorSettings, WorkflowSettin .language(GeneratorLanguage.KOTLIN) .languageVersion("17") .type(GeneratorType.CLIENT) - .stability(Stability.STABLE) + .stability(Stability.EXPERIMENTAL) .featureSet(featureSet) .generationMessage(String.format(Locale.ROOT, "OpenAPI JSON Schema Generator: %s (%s)", "kotlin", GeneratorType.CLIENT)) .helpMsg(String.join( From 028c5298d346d961e9b5bec7e7283e9826b3805b Mon Sep 17 00:00:00 2001 From: Justin Black Date: Mon, 6 May 2024 12:41:46 -0700 Subject: [PATCH 03/78] Updates 2 configuration classes --- .../client/petstore/kotlin/build.gradle.kts | 36 +- .../configurations/JsonSchemaKeywordFlags.kt | 660 ++++++++++-------- .../configurations/SchemaConfiguration.kt | 6 +- src/main/resources/kotlin/build.gradle.hbs | 35 +- .../configurations/JsonSchemaKeywordFlags.hbs | 656 +++++++++-------- .../configurations/SchemaConfiguration.hbs | 3 +- 6 files changed, 781 insertions(+), 615 deletions(-) diff --git a/samples/client/petstore/kotlin/build.gradle.kts b/samples/client/petstore/kotlin/build.gradle.kts index a8784c201b8..c0c0d5f25a0 100644 --- a/samples/client/petstore/kotlin/build.gradle.kts +++ b/samples/client/petstore/kotlin/build.gradle.kts @@ -1,8 +1,5 @@ -import org.checkerframework.gradle.plugin.CheckerFrameworkExtension - plugins { - `java-library` - `maven-publish` + kotlin("jvm") version "1.9.23" id("org.checkerframework") version "0.6.33" } @@ -17,23 +14,12 @@ dependencies { implementation("org.checkerframework:checker-qual:3.42.0") implementation("com.google.code.gson:gson:2.10.1") testImplementation("junit:junit:4.13.2") - checkerFramework("org.checkerframework:checker:3.42.0") -} - -configure { - checkers = listOf( - "org.checkerframework.checker.nullness.NullnessChecker" - ) } group = "org.openapijsonschematools" version = "1.0.0" description = "OpenAPI Kotlin" -val testsJar by tasks.registering(Jar::class) { - archiveClassifier = "tests" - from(sourceSets["test"].output) -} java { toolchain { @@ -43,22 +29,10 @@ java { withJavadocJar() } -publishing { - publications.create("maven") { - from(components["java"]) - artifact(testsJar) - } +kotlin { + jvmToolchain(17) } tasks.wrapper { - gradleVersion = "8.7" -} - -tasks.withType() { - options.encoding = "UTF-8" -} - -tasks.withType() { - enabled = false - options.encoding = "UTF-8" -} + gradleVersion = "8.1.1" +} \ No newline at end of file diff --git a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/configurations/JsonSchemaKeywordFlags.kt b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/configurations/JsonSchemaKeywordFlags.kt index 1223c57764c..f939b8dda4e 100644 --- a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/configurations/JsonSchemaKeywordFlags.kt +++ b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/configurations/JsonSchemaKeywordFlags.kt @@ -1,294 +1,406 @@ -package org.openapijsonschematools.client.configurations; - -import java.util.LinkedHashSet; - -public record JsonSchemaKeywordFlags( - boolean additionalProperties, - boolean allOf, - boolean anyOf, - boolean const_, - boolean contains, - boolean dependentRequired, - boolean dependentSchemas, - boolean discriminator, - boolean else_, - boolean enum_, - boolean exclusiveMaximum, - boolean exclusiveMinimum, - boolean format, - boolean if_, - boolean maximum, - boolean minimum, - boolean items, - boolean maxContains, - boolean maxItems, - boolean maxLength, - boolean maxProperties, - boolean minContains, - boolean minItems, - boolean minLength, - boolean minProperties, - boolean multipleOf, - boolean not, - boolean oneOf, - boolean pattern, - boolean patternProperties, - boolean prefixItems, - boolean properties, - boolean propertyNames, - boolean required, - boolean then, - boolean type, - boolean uniqueItems, - boolean unevaluatedItems, - boolean unevaluatedProperties - ) { - - public LinkedHashSet getKeywords() { - LinkedHashSet enabledKeywords = new LinkedHashSet<>(); - if (additionalProperties) { enabledKeywords.add("additionalProperties"); } - if (allOf) { enabledKeywords.add("allOf"); } - if (anyOf) { enabledKeywords.add("anyOf"); } - if (const_) { enabledKeywords.add("const"); } - if (contains) { enabledKeywords.add("contains"); } - if (dependentRequired) { enabledKeywords.add("dependentRequired"); } - if (dependentSchemas) { enabledKeywords.add("dependentSchemas"); } - if (discriminator) { enabledKeywords.add("discriminator"); } - if (else_) { enabledKeywords.add("else_"); } - if (enum_) { enabledKeywords.add("enum_"); } - if (exclusiveMaximum) { enabledKeywords.add("exclusiveMaximum"); } - if (exclusiveMinimum) { enabledKeywords.add("exclusiveMinimum"); } - if (format) { enabledKeywords.add("format"); } - if (if_) { enabledKeywords.add("if_"); } - if (maximum) { enabledKeywords.add("maximum"); } - if (minimum) { enabledKeywords.add("minimum"); } - if (items) { enabledKeywords.add("items"); } - if (maxContains) { enabledKeywords.add("maxContains"); } - if (maxItems) { enabledKeywords.add("maxItems"); } - if (maxLength) { enabledKeywords.add("maxLength"); } - if (maxProperties) { enabledKeywords.add("maxProperties"); } - if (minContains) { enabledKeywords.add("minContains"); } - if (minItems) { enabledKeywords.add("minItems"); } - if (minLength) { enabledKeywords.add("minLength"); } - if (minProperties) { enabledKeywords.add("minProperties"); } - if (multipleOf) { enabledKeywords.add("multipleOf"); } - if (not) { enabledKeywords.add("not"); } - if (oneOf) { enabledKeywords.add("oneOf"); } - if (pattern) { enabledKeywords.add("pattern"); } - if (patternProperties) { enabledKeywords.add("patternProperties"); } - if (prefixItems) { enabledKeywords.add("prefixItems"); } - if (properties) { enabledKeywords.add("properties"); } - if (propertyNames) { enabledKeywords.add("propertyNames"); } - if (required) { enabledKeywords.add("required"); } - if (then) { enabledKeywords.add("then"); } - if (type) { enabledKeywords.add("type"); } - if (uniqueItems) { enabledKeywords.add("uniqueItems"); } - if (unevaluatedItems) { enabledKeywords.add("unevaluatedItems"); } - if (unevaluatedProperties) { enabledKeywords.add("unevaluatedProperties"); } - return enabledKeywords; - } +package org.openapijsonschematools.client.configurations + +data class JsonSchemaKeywordFlags( + val additionalProperties: Boolean, + val allOf: Boolean, + val anyOf: Boolean, + val const_: Boolean, + val contains: Boolean, + val dependentRequired: Boolean, + val dependentSchemas: Boolean, + val discriminator: Boolean, + val else_: Boolean, + val enum_: Boolean, + val exclusiveMaximum: Boolean, + val exclusiveMinimum: Boolean, + val format: Boolean, + val if_: Boolean, + val maximum: Boolean, + val minimum: Boolean, + val items: Boolean, + val maxContains: Boolean, + val maxItems: Boolean, + val maxLength: Boolean, + val maxProperties: Boolean, + val minContains: Boolean, + val minItems: Boolean, + val minLength: Boolean, + val minProperties: Boolean, + val multipleOf: Boolean, + val not: Boolean, + val oneOf: Boolean, + val pattern: Boolean, + val patternProperties: Boolean, + val prefixItems: Boolean, + val properties: Boolean, + val propertyNames: Boolean, + val required: Boolean, + val then: Boolean, + val type: Boolean, + val uniqueItems: Boolean, + val unevaluatedItems: Boolean, + val unevaluatedProperties: Boolean +) { + val keywords: LinkedHashSet + get() { + val enabledKeywords = LinkedHashSet() + if (additionalProperties) { + enabledKeywords.add("additionalProperties") + } + if (allOf) { + enabledKeywords.add("allOf") + } + if (anyOf) { + enabledKeywords.add("anyOf") + } + if (const_) { + enabledKeywords.add("const") + } + if (contains) { + enabledKeywords.add("contains") + } + if (dependentRequired) { + enabledKeywords.add("dependentRequired") + } + if (dependentSchemas) { + enabledKeywords.add("dependentSchemas") + } + if (discriminator) { + enabledKeywords.add("discriminator") + } + if (else_) { + enabledKeywords.add("else_") + } + if (enum_) { + enabledKeywords.add("enum_") + } + if (exclusiveMaximum) { + enabledKeywords.add("exclusiveMaximum") + } + if (exclusiveMinimum) { + enabledKeywords.add("exclusiveMinimum") + } + if (format) { + enabledKeywords.add("format") + } + if (if_) { + enabledKeywords.add("if_") + } + if (maximum) { + enabledKeywords.add("maximum") + } + if (minimum) { + enabledKeywords.add("minimum") + } + if (items) { + enabledKeywords.add("items") + } + if (maxContains) { + enabledKeywords.add("maxContains") + } + if (maxItems) { + enabledKeywords.add("maxItems") + } + if (maxLength) { + enabledKeywords.add("maxLength") + } + if (maxProperties) { + enabledKeywords.add("maxProperties") + } + if (minContains) { + enabledKeywords.add("minContains") + } + if (minItems) { + enabledKeywords.add("minItems") + } + if (minLength) { + enabledKeywords.add("minLength") + } + if (minProperties) { + enabledKeywords.add("minProperties") + } + if (multipleOf) { + enabledKeywords.add("multipleOf") + } + if (not) { + enabledKeywords.add("not") + } + if (oneOf) { + enabledKeywords.add("oneOf") + } + if (pattern) { + enabledKeywords.add("pattern") + } + if (patternProperties) { + enabledKeywords.add("patternProperties") + } + if (prefixItems) { + enabledKeywords.add("prefixItems") + } + if (properties) { + enabledKeywords.add("properties") + } + if (propertyNames) { + enabledKeywords.add("propertyNames") + } + if (required) { + enabledKeywords.add("required") + } + if (then) { + enabledKeywords.add("then") + } + if (type) { + enabledKeywords.add("type") + } + if (uniqueItems) { + enabledKeywords.add("uniqueItems") + } + if (unevaluatedItems) { + enabledKeywords.add("unevaluatedItems") + } + if (unevaluatedProperties) { + enabledKeywords.add("unevaluatedProperties") + } + return enabledKeywords + } + + class Builder { + private var additionalProperties = false + private var allOf = false + private var anyOf = false + private var const_ = false + private var contains = false + private var dependentRequired = false + private var dependentSchemas = false + private var discriminator = false + private var else_ = false + private var enum_ = false + private var exclusiveMaximum = false + private var exclusiveMinimum = false + private var format = false + private var if_ = false + private var maximum = false + private var minimum = false + private var items = false + private var maxContains = false + private var maxItems = false + private var maxLength = false + private var maxProperties = false + private var minContains = false + private var minItems = false + private var minLength = false + private var minProperties = false + private var multipleOf = false + private var not = false + private var oneOf = false + private var pattern = false + private var patternProperties = false + private var prefixItems = false + private var properties = false + private var propertyNames = false + private var required = false + private var then = false + private var type = false + private var uniqueItems = false + private var unevaluatedItems = false + private var unevaluatedProperties = false + fun additionalProperties(): Builder { + additionalProperties = true + return this + } + + fun allOf(): Builder { + allOf = true + return this + } + + fun anyOf(): Builder { + anyOf = true + return this + } + + fun const_(): Builder { + const_ = true + return this + } + + fun contains(): Builder { + contains = true + return this + } + + fun dependentRequired(): Builder { + dependentRequired = true + return this + } + + fun dependentSchemas(): Builder { + dependentSchemas = true + return this + } + + fun discriminator(): Builder { + discriminator = true + return this + } + + fun else_(): Builder { + else_ = true + return this + } + + fun enum_(): Builder { + enum_ = true + return this + } + + fun exclusiveMaximum(): Builder { + exclusiveMaximum = true + return this + } + + fun exclusiveMinimum(): Builder { + exclusiveMinimum = true + return this + } + + fun format(): Builder { + format = true + return this + } + + fun if_(): Builder { + if_ = true + return this + } + + fun maximum(): Builder { + maximum = true + return this + } + + fun minimum(): Builder { + minimum = true + return this + } + + fun items(): Builder { + items = true + return this + } + + fun maxContains(): Builder { + maxContains = true + return this + } + + fun maxItems(): Builder { + maxItems = true + return this + } + + fun maxLength(): Builder { + maxLength = true + return this + } + + fun maxProperties(): Builder { + maxProperties = true + return this + } + + fun minContains(): Builder { + minContains = true + return this + } - public static class Builder { - private boolean additionalProperties; - private boolean allOf; - private boolean anyOf; - private boolean const_; - private boolean contains; - private boolean dependentRequired; - private boolean dependentSchemas; - private boolean discriminator; - private boolean else_; - private boolean enum_; - private boolean exclusiveMaximum; - private boolean exclusiveMinimum; - private boolean format; - private boolean if_; - private boolean maximum; - private boolean minimum; - private boolean items; - private boolean maxContains; - private boolean maxItems; - private boolean maxLength; - private boolean maxProperties; - private boolean minContains; - private boolean minItems; - private boolean minLength; - private boolean minProperties; - private boolean multipleOf; - private boolean not; - private boolean oneOf; - private boolean pattern; - private boolean patternProperties; - private boolean prefixItems; - private boolean properties; - private boolean propertyNames; - private boolean required; - private boolean then; - private boolean type; - private boolean uniqueItems; - private boolean unevaluatedItems; - private boolean unevaluatedProperties; - - public Builder() {} - - public Builder additionalProperties() { - additionalProperties = true; - return this; - } - public Builder allOf() { - allOf = true; - return this; - } - public Builder anyOf() { - anyOf = true; - return this; - } - public Builder const_() { - const_ = true; - return this; - } - public Builder contains() { - contains = true; - return this; - } - public Builder dependentRequired() { - dependentRequired = true; - return this; - } - public Builder dependentSchemas() { - dependentSchemas = true; - return this; - } - public Builder discriminator() { - discriminator = true; - return this; - } - public Builder else_() { - else_ = true; - return this; - } - public Builder enum_() { - enum_ = true; - return this; - } - public Builder exclusiveMaximum() { - exclusiveMaximum = true; - return this; - } - public Builder exclusiveMinimum() { - exclusiveMinimum = true; - return this; - } - public Builder format() { - format = true; - return this; - } - public Builder if_() { - if_ = true; - return this; - } - public Builder maximum() { - maximum = true; - return this; - } - public Builder minimum() { - minimum = true; - return this; - } - public Builder items() { - items = true; - return this; - } - public Builder maxContains() { - maxContains = true; - return this; - } - public Builder maxItems() { - maxItems = true; - return this; - } - public Builder maxLength() { - maxLength = true; - return this; - } - public Builder maxProperties() { - maxProperties = true; - return this; - } - public Builder minContains() { - minContains = true; - return this; - } - public Builder minItems() { - minItems = true; - return this; + fun minItems(): Builder { + minItems = true + return this } - public Builder minLength() { - minLength = true; - return this; + + fun minLength(): Builder { + minLength = true + return this } - public Builder minProperties() { - minProperties = true; - return this; + + fun minProperties(): Builder { + minProperties = true + return this } - public Builder multipleOf() { - multipleOf = true; - return this; + + fun multipleOf(): Builder { + multipleOf = true + return this } - public Builder not() { - not = true; - return this; + + operator fun not(): Builder { + not = true + return this } - public Builder oneOf() { - oneOf = true; - return this; + + fun oneOf(): Builder { + oneOf = true + return this } - public Builder pattern() { - pattern = true; - return this; + + fun pattern(): Builder { + pattern = true + return this } - public Builder patternProperties() { - patternProperties = true; - return this; + + fun patternProperties(): Builder { + patternProperties = true + return this } - public Builder prefixItems() { - prefixItems = true; - return this; + + fun prefixItems(): Builder { + prefixItems = true + return this } - public Builder properties() { - properties = true; - return this; + + fun properties(): Builder { + properties = true + return this } - public Builder propertyNames() { - propertyNames = true; - return this; + + fun propertyNames(): Builder { + propertyNames = true + return this } - public Builder required() { - required = true; - return this; + + fun required(): Builder { + required = true + return this } - public Builder then() { - then = true; - return this; + + fun then(): Builder { + then = true + return this } - public Builder type() { - type = true; - return this; + + fun type(): Builder { + type = true + return this } - public Builder uniqueItems() { - uniqueItems = true; - return this; + + fun uniqueItems(): Builder { + uniqueItems = true + return this } - public Builder unevaluatedItems() { - unevaluatedItems = true; - return this; + + fun unevaluatedItems(): Builder { + unevaluatedItems = true + return this } - public Builder unevaluatedProperties() { - unevaluatedProperties = true; - return this; + + fun unevaluatedProperties(): Builder { + unevaluatedProperties = true + return this } - public JsonSchemaKeywordFlags build() { - return new JsonSchemaKeywordFlags( + + fun build(): JsonSchemaKeywordFlags { + return JsonSchemaKeywordFlags( additionalProperties, allOf, anyOf, @@ -328,7 +440,7 @@ public record JsonSchemaKeywordFlags( uniqueItems, unevaluatedItems, unevaluatedProperties - ); + ) } } } \ No newline at end of file diff --git a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/configurations/SchemaConfiguration.kt b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/configurations/SchemaConfiguration.kt index 964a88d900a..1f1a5a422ff 100644 --- a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/configurations/SchemaConfiguration.kt +++ b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/configurations/SchemaConfiguration.kt @@ -1,4 +1,4 @@ -package org.openapijsonschematools.client.configurations; +package org.openapijsonschematools.client.configurations -public record SchemaConfiguration(JsonSchemaKeywordFlags disabledKeywordFlags) { -} \ No newline at end of file + +data class SchemaConfiguration(val disabledKeywordFlags: JsonSchemaKeywordFlags) \ No newline at end of file diff --git a/src/main/resources/kotlin/build.gradle.hbs b/src/main/resources/kotlin/build.gradle.hbs index 2b484053fcf..a20733d7cde 100644 --- a/src/main/resources/kotlin/build.gradle.hbs +++ b/src/main/resources/kotlin/build.gradle.hbs @@ -1,8 +1,5 @@ -import org.checkerframework.gradle.plugin.CheckerFrameworkExtension - plugins { - `java-library` - `maven-publish` + kotlin("jvm") version "1.9.23" id("org.checkerframework") version "0.6.33" } @@ -17,24 +14,12 @@ dependencies { implementation("org.checkerframework:checker-qual:3.42.0") implementation("com.google.code.gson:gson:2.10.1") testImplementation("junit:junit:4.13.2") - checkerFramework("org.checkerframework:checker:3.42.0") -} - -configure { - checkers = listOf( - "org.checkerframework.checker.nullness.NullnessChecker" - ) } group = "{{groupId}}" version = "{{artifactVersion}}" description = "{{artifactDescription}}" -val testsJar by tasks.registering(Jar::class) { - archiveClassifier = "tests" - from(sourceSets["test"].output) -} - java { toolchain { languageVersion.set(JavaLanguageVersion.of(17)) @@ -43,22 +28,6 @@ java { withJavadocJar() } -publishing { - publications.create("maven") { - from(components["java"]) - artifact(testsJar) - } -} - tasks.wrapper { - gradleVersion = "8.7" -} - -tasks.withType() { - options.encoding = "UTF-8" -} - -tasks.withType() { - enabled = false - options.encoding = "UTF-8" + gradleVersion = "8.1.1" } diff --git a/src/main/resources/kotlin/src/main/kotlin/packagename/configurations/JsonSchemaKeywordFlags.hbs b/src/main/resources/kotlin/src/main/kotlin/packagename/configurations/JsonSchemaKeywordFlags.hbs index 8301c727ef8..271621b8ffa 100644 --- a/src/main/resources/kotlin/src/main/kotlin/packagename/configurations/JsonSchemaKeywordFlags.hbs +++ b/src/main/resources/kotlin/src/main/kotlin/packagename/configurations/JsonSchemaKeywordFlags.hbs @@ -1,294 +1,406 @@ package {{{packageName}}}.configurations; -import java.util.LinkedHashSet; - -public record JsonSchemaKeywordFlags( - boolean additionalProperties, - boolean allOf, - boolean anyOf, - boolean const_, - boolean contains, - boolean dependentRequired, - boolean dependentSchemas, - boolean discriminator, - boolean else_, - boolean enum_, - boolean exclusiveMaximum, - boolean exclusiveMinimum, - boolean format, - boolean if_, - boolean maximum, - boolean minimum, - boolean items, - boolean maxContains, - boolean maxItems, - boolean maxLength, - boolean maxProperties, - boolean minContains, - boolean minItems, - boolean minLength, - boolean minProperties, - boolean multipleOf, - boolean not, - boolean oneOf, - boolean pattern, - boolean patternProperties, - boolean prefixItems, - boolean properties, - boolean propertyNames, - boolean required, - boolean then, - boolean type, - boolean uniqueItems, - boolean unevaluatedItems, - boolean unevaluatedProperties - ) { - - public LinkedHashSet getKeywords() { - LinkedHashSet enabledKeywords = new LinkedHashSet<>(); - if (additionalProperties) { enabledKeywords.add("additionalProperties"); } - if (allOf) { enabledKeywords.add("allOf"); } - if (anyOf) { enabledKeywords.add("anyOf"); } - if (const_) { enabledKeywords.add("const"); } - if (contains) { enabledKeywords.add("contains"); } - if (dependentRequired) { enabledKeywords.add("dependentRequired"); } - if (dependentSchemas) { enabledKeywords.add("dependentSchemas"); } - if (discriminator) { enabledKeywords.add("discriminator"); } - if (else_) { enabledKeywords.add("else_"); } - if (enum_) { enabledKeywords.add("enum_"); } - if (exclusiveMaximum) { enabledKeywords.add("exclusiveMaximum"); } - if (exclusiveMinimum) { enabledKeywords.add("exclusiveMinimum"); } - if (format) { enabledKeywords.add("format"); } - if (if_) { enabledKeywords.add("if_"); } - if (maximum) { enabledKeywords.add("maximum"); } - if (minimum) { enabledKeywords.add("minimum"); } - if (items) { enabledKeywords.add("items"); } - if (maxContains) { enabledKeywords.add("maxContains"); } - if (maxItems) { enabledKeywords.add("maxItems"); } - if (maxLength) { enabledKeywords.add("maxLength"); } - if (maxProperties) { enabledKeywords.add("maxProperties"); } - if (minContains) { enabledKeywords.add("minContains"); } - if (minItems) { enabledKeywords.add("minItems"); } - if (minLength) { enabledKeywords.add("minLength"); } - if (minProperties) { enabledKeywords.add("minProperties"); } - if (multipleOf) { enabledKeywords.add("multipleOf"); } - if (not) { enabledKeywords.add("not"); } - if (oneOf) { enabledKeywords.add("oneOf"); } - if (pattern) { enabledKeywords.add("pattern"); } - if (patternProperties) { enabledKeywords.add("patternProperties"); } - if (prefixItems) { enabledKeywords.add("prefixItems"); } - if (properties) { enabledKeywords.add("properties"); } - if (propertyNames) { enabledKeywords.add("propertyNames"); } - if (required) { enabledKeywords.add("required"); } - if (then) { enabledKeywords.add("then"); } - if (type) { enabledKeywords.add("type"); } - if (uniqueItems) { enabledKeywords.add("uniqueItems"); } - if (unevaluatedItems) { enabledKeywords.add("unevaluatedItems"); } - if (unevaluatedProperties) { enabledKeywords.add("unevaluatedProperties"); } - return enabledKeywords; - } +data class JsonSchemaKeywordFlags( + val additionalProperties: Boolean, + val allOf: Boolean, + val anyOf: Boolean, + val const_: Boolean, + val contains: Boolean, + val dependentRequired: Boolean, + val dependentSchemas: Boolean, + val discriminator: Boolean, + val else_: Boolean, + val enum_: Boolean, + val exclusiveMaximum: Boolean, + val exclusiveMinimum: Boolean, + val format: Boolean, + val if_: Boolean, + val maximum: Boolean, + val minimum: Boolean, + val items: Boolean, + val maxContains: Boolean, + val maxItems: Boolean, + val maxLength: Boolean, + val maxProperties: Boolean, + val minContains: Boolean, + val minItems: Boolean, + val minLength: Boolean, + val minProperties: Boolean, + val multipleOf: Boolean, + val not: Boolean, + val oneOf: Boolean, + val pattern: Boolean, + val patternProperties: Boolean, + val prefixItems: Boolean, + val properties: Boolean, + val propertyNames: Boolean, + val required: Boolean, + val then: Boolean, + val type: Boolean, + val uniqueItems: Boolean, + val unevaluatedItems: Boolean, + val unevaluatedProperties: Boolean +) { + val keywords: LinkedHashSet + get() { + val enabledKeywords = LinkedHashSet() + if (additionalProperties) { + enabledKeywords.add("additionalProperties") + } + if (allOf) { + enabledKeywords.add("allOf") + } + if (anyOf) { + enabledKeywords.add("anyOf") + } + if (const_) { + enabledKeywords.add("const") + } + if (contains) { + enabledKeywords.add("contains") + } + if (dependentRequired) { + enabledKeywords.add("dependentRequired") + } + if (dependentSchemas) { + enabledKeywords.add("dependentSchemas") + } + if (discriminator) { + enabledKeywords.add("discriminator") + } + if (else_) { + enabledKeywords.add("else_") + } + if (enum_) { + enabledKeywords.add("enum_") + } + if (exclusiveMaximum) { + enabledKeywords.add("exclusiveMaximum") + } + if (exclusiveMinimum) { + enabledKeywords.add("exclusiveMinimum") + } + if (format) { + enabledKeywords.add("format") + } + if (if_) { + enabledKeywords.add("if_") + } + if (maximum) { + enabledKeywords.add("maximum") + } + if (minimum) { + enabledKeywords.add("minimum") + } + if (items) { + enabledKeywords.add("items") + } + if (maxContains) { + enabledKeywords.add("maxContains") + } + if (maxItems) { + enabledKeywords.add("maxItems") + } + if (maxLength) { + enabledKeywords.add("maxLength") + } + if (maxProperties) { + enabledKeywords.add("maxProperties") + } + if (minContains) { + enabledKeywords.add("minContains") + } + if (minItems) { + enabledKeywords.add("minItems") + } + if (minLength) { + enabledKeywords.add("minLength") + } + if (minProperties) { + enabledKeywords.add("minProperties") + } + if (multipleOf) { + enabledKeywords.add("multipleOf") + } + if (not) { + enabledKeywords.add("not") + } + if (oneOf) { + enabledKeywords.add("oneOf") + } + if (pattern) { + enabledKeywords.add("pattern") + } + if (patternProperties) { + enabledKeywords.add("patternProperties") + } + if (prefixItems) { + enabledKeywords.add("prefixItems") + } + if (properties) { + enabledKeywords.add("properties") + } + if (propertyNames) { + enabledKeywords.add("propertyNames") + } + if (required) { + enabledKeywords.add("required") + } + if (then) { + enabledKeywords.add("then") + } + if (type) { + enabledKeywords.add("type") + } + if (uniqueItems) { + enabledKeywords.add("uniqueItems") + } + if (unevaluatedItems) { + enabledKeywords.add("unevaluatedItems") + } + if (unevaluatedProperties) { + enabledKeywords.add("unevaluatedProperties") + } + return enabledKeywords + } + + class Builder { + private var additionalProperties = false + private var allOf = false + private var anyOf = false + private var const_ = false + private var contains = false + private var dependentRequired = false + private var dependentSchemas = false + private var discriminator = false + private var else_ = false + private var enum_ = false + private var exclusiveMaximum = false + private var exclusiveMinimum = false + private var format = false + private var if_ = false + private var maximum = false + private var minimum = false + private var items = false + private var maxContains = false + private var maxItems = false + private var maxLength = false + private var maxProperties = false + private var minContains = false + private var minItems = false + private var minLength = false + private var minProperties = false + private var multipleOf = false + private var not = false + private var oneOf = false + private var pattern = false + private var patternProperties = false + private var prefixItems = false + private var properties = false + private var propertyNames = false + private var required = false + private var then = false + private var type = false + private var uniqueItems = false + private var unevaluatedItems = false + private var unevaluatedProperties = false + fun additionalProperties(): Builder { + additionalProperties = true + return this + } + + fun allOf(): Builder { + allOf = true + return this + } + + fun anyOf(): Builder { + anyOf = true + return this + } + + fun const_(): Builder { + const_ = true + return this + } + + fun contains(): Builder { + contains = true + return this + } + + fun dependentRequired(): Builder { + dependentRequired = true + return this + } + + fun dependentSchemas(): Builder { + dependentSchemas = true + return this + } - public static class Builder { - private boolean additionalProperties; - private boolean allOf; - private boolean anyOf; - private boolean const_; - private boolean contains; - private boolean dependentRequired; - private boolean dependentSchemas; - private boolean discriminator; - private boolean else_; - private boolean enum_; - private boolean exclusiveMaximum; - private boolean exclusiveMinimum; - private boolean format; - private boolean if_; - private boolean maximum; - private boolean minimum; - private boolean items; - private boolean maxContains; - private boolean maxItems; - private boolean maxLength; - private boolean maxProperties; - private boolean minContains; - private boolean minItems; - private boolean minLength; - private boolean minProperties; - private boolean multipleOf; - private boolean not; - private boolean oneOf; - private boolean pattern; - private boolean patternProperties; - private boolean prefixItems; - private boolean properties; - private boolean propertyNames; - private boolean required; - private boolean then; - private boolean type; - private boolean uniqueItems; - private boolean unevaluatedItems; - private boolean unevaluatedProperties; - - public Builder() {} - - public Builder additionalProperties() { - additionalProperties = true; - return this; - } - public Builder allOf() { - allOf = true; - return this; - } - public Builder anyOf() { - anyOf = true; - return this; - } - public Builder const_() { - const_ = true; - return this; - } - public Builder contains() { - contains = true; - return this; - } - public Builder dependentRequired() { - dependentRequired = true; - return this; - } - public Builder dependentSchemas() { - dependentSchemas = true; - return this; - } - public Builder discriminator() { - discriminator = true; - return this; - } - public Builder else_() { - else_ = true; - return this; - } - public Builder enum_() { - enum_ = true; - return this; - } - public Builder exclusiveMaximum() { - exclusiveMaximum = true; - return this; - } - public Builder exclusiveMinimum() { - exclusiveMinimum = true; - return this; - } - public Builder format() { - format = true; - return this; - } - public Builder if_() { - if_ = true; - return this; - } - public Builder maximum() { - maximum = true; - return this; - } - public Builder minimum() { - minimum = true; - return this; - } - public Builder items() { - items = true; - return this; - } - public Builder maxContains() { - maxContains = true; - return this; - } - public Builder maxItems() { - maxItems = true; - return this; - } - public Builder maxLength() { - maxLength = true; - return this; - } - public Builder maxProperties() { - maxProperties = true; - return this; - } - public Builder minContains() { - minContains = true; - return this; - } - public Builder minItems() { - minItems = true; - return this; + fun discriminator(): Builder { + discriminator = true + return this } - public Builder minLength() { - minLength = true; - return this; + + fun else_(): Builder { + else_ = true + return this } - public Builder minProperties() { - minProperties = true; - return this; + + fun enum_(): Builder { + enum_ = true + return this } - public Builder multipleOf() { - multipleOf = true; - return this; + + fun exclusiveMaximum(): Builder { + exclusiveMaximum = true + return this } - public Builder not() { - not = true; - return this; + + fun exclusiveMinimum(): Builder { + exclusiveMinimum = true + return this } - public Builder oneOf() { - oneOf = true; - return this; + + fun format(): Builder { + format = true + return this } - public Builder pattern() { - pattern = true; - return this; + + fun if_(): Builder { + if_ = true + return this } - public Builder patternProperties() { - patternProperties = true; - return this; + + fun maximum(): Builder { + maximum = true + return this } - public Builder prefixItems() { - prefixItems = true; - return this; + + fun minimum(): Builder { + minimum = true + return this } - public Builder properties() { - properties = true; - return this; + + fun items(): Builder { + items = true + return this } - public Builder propertyNames() { - propertyNames = true; - return this; + + fun maxContains(): Builder { + maxContains = true + return this } - public Builder required() { - required = true; - return this; + + fun maxItems(): Builder { + maxItems = true + return this } - public Builder then() { - then = true; - return this; + + fun maxLength(): Builder { + maxLength = true + return this } - public Builder type() { - type = true; - return this; + + fun maxProperties(): Builder { + maxProperties = true + return this } - public Builder uniqueItems() { - uniqueItems = true; - return this; + + fun minContains(): Builder { + minContains = true + return this } - public Builder unevaluatedItems() { - unevaluatedItems = true; - return this; + + fun minItems(): Builder { + minItems = true + return this } - public Builder unevaluatedProperties() { - unevaluatedProperties = true; - return this; + + fun minLength(): Builder { + minLength = true + return this } - public JsonSchemaKeywordFlags build() { - return new JsonSchemaKeywordFlags( + + fun minProperties(): Builder { + minProperties = true + return this + } + + fun multipleOf(): Builder { + multipleOf = true + return this + } + + operator fun not(): Builder { + not = true + return this + } + + fun oneOf(): Builder { + oneOf = true + return this + } + + fun pattern(): Builder { + pattern = true + return this + } + + fun patternProperties(): Builder { + patternProperties = true + return this + } + + fun prefixItems(): Builder { + prefixItems = true + return this + } + + fun properties(): Builder { + properties = true + return this + } + + fun propertyNames(): Builder { + propertyNames = true + return this + } + + fun required(): Builder { + required = true + return this + } + + fun then(): Builder { + then = true + return this + } + + fun type(): Builder { + type = true + return this + } + + fun uniqueItems(): Builder { + uniqueItems = true + return this + } + + fun unevaluatedItems(): Builder { + unevaluatedItems = true + return this + } + + fun unevaluatedProperties(): Builder { + unevaluatedProperties = true + return this + } + + fun build(): JsonSchemaKeywordFlags { + return JsonSchemaKeywordFlags( additionalProperties, allOf, anyOf, @@ -328,7 +440,7 @@ public record JsonSchemaKeywordFlags( uniqueItems, unevaluatedItems, unevaluatedProperties - ); + ) } } } \ No newline at end of file diff --git a/src/main/resources/kotlin/src/main/kotlin/packagename/configurations/SchemaConfiguration.hbs b/src/main/resources/kotlin/src/main/kotlin/packagename/configurations/SchemaConfiguration.hbs index c63928c0d7f..fd0ce0991d3 100644 --- a/src/main/resources/kotlin/src/main/kotlin/packagename/configurations/SchemaConfiguration.hbs +++ b/src/main/resources/kotlin/src/main/kotlin/packagename/configurations/SchemaConfiguration.hbs @@ -1,4 +1,3 @@ package {{{packageName}}}.configurations; -public record SchemaConfiguration(JsonSchemaKeywordFlags disabledKeywordFlags) { -} \ No newline at end of file +data class SchemaConfiguration(val disabledKeywordFlags: JsonSchemaKeywordFlags) \ No newline at end of file From 8efbe19b34786bda70653774fcce84184d9cada6 Mon Sep 17 00:00:00 2001 From: Justin Black Date: Mon, 6 May 2024 12:54:50 -0700 Subject: [PATCH 04/78] Converts all exceptions to kotlin --- .../client/exceptions/ApiException.kt | 14 +++----------- .../client/exceptions/BaseException.kt | 9 ++------- .../InvalidAdditionalPropertyException.kt | 9 ++------- .../client/exceptions/NotImplementedException.kt | 9 ++------- .../client/exceptions/UnsetPropertyException.kt | 9 ++------- .../client/exceptions/ValidationException.kt | 9 ++------- .../kotlin/packagename/exceptions/ApiException.hbs | 10 +--------- .../packagename/exceptions/BaseException.hbs | 7 +------ .../InvalidAdditionalPropertyException.hbs | 7 +------ .../exceptions/NotImplementedException.hbs | 7 +------ .../exceptions/UnsetPropertyException.hbs | 7 +------ .../packagename/exceptions/ValidationException.hbs | 7 +------ 12 files changed, 19 insertions(+), 85 deletions(-) diff --git a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/exceptions/ApiException.kt b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/exceptions/ApiException.kt index d308d4b90a1..e02ddae608d 100644 --- a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/exceptions/ApiException.kt +++ b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/exceptions/ApiException.kt @@ -1,13 +1,5 @@ -package org.openapijsonschematools.client.exceptions; +package org.openapijsonschematools.client.exceptions -import java.net.http.HttpResponse; +import java.net.http.HttpResponse -@SuppressWarnings("serial") -public class ApiException extends BaseException { - public HttpResponse response; - - public ApiException(String s, HttpResponse response) { - super(s); - this.response = response; - } -} \ No newline at end of file +class ApiException(s: String?, val response: HttpResponse) : BaseException(s) \ No newline at end of file diff --git a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/exceptions/BaseException.kt b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/exceptions/BaseException.kt index 268e9373289..302d2a3c510 100644 --- a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/exceptions/BaseException.kt +++ b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/exceptions/BaseException.kt @@ -1,8 +1,3 @@ -package org.openapijsonschematools.client.exceptions; +package org.openapijsonschematools.client.exceptions -@SuppressWarnings("serial") -public class BaseException extends Exception { - public BaseException(String s) { - super(s); - } -} \ No newline at end of file +open class BaseException(s: String?) : Exception(s) \ No newline at end of file diff --git a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/exceptions/InvalidAdditionalPropertyException.kt b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/exceptions/InvalidAdditionalPropertyException.kt index 424762f3cc9..8f652edb49e 100644 --- a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/exceptions/InvalidAdditionalPropertyException.kt +++ b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/exceptions/InvalidAdditionalPropertyException.kt @@ -1,8 +1,3 @@ -package org.openapijsonschematools.client.exceptions; +package org.openapijsonschematools.client.exceptions -@SuppressWarnings("serial") -public class InvalidAdditionalPropertyException extends BaseException { - public InvalidAdditionalPropertyException(String s) { - super(s); - } -} \ No newline at end of file +class InvalidAdditionalPropertyException(s: String?) : BaseException(s) \ No newline at end of file diff --git a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/exceptions/NotImplementedException.kt b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/exceptions/NotImplementedException.kt index 4e9633c9d8d..a6a98ed8136 100644 --- a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/exceptions/NotImplementedException.kt +++ b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/exceptions/NotImplementedException.kt @@ -1,8 +1,3 @@ -package org.openapijsonschematools.client.exceptions; +package org.openapijsonschematools.client.exceptions -@SuppressWarnings("serial") -public class NotImplementedException extends BaseException { - public NotImplementedException(String s) { - super(s); - } -} \ No newline at end of file +class NotImplementedException(s: String?) : BaseException(s) \ No newline at end of file diff --git a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/exceptions/UnsetPropertyException.kt b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/exceptions/UnsetPropertyException.kt index f709a440cb3..7c889056e9c 100644 --- a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/exceptions/UnsetPropertyException.kt +++ b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/exceptions/UnsetPropertyException.kt @@ -1,8 +1,3 @@ -package org.openapijsonschematools.client.exceptions; +package org.openapijsonschematools.client.exceptions -@SuppressWarnings("serial") -public class UnsetPropertyException extends BaseException { - public UnsetPropertyException(String s) { - super(s); - } -} \ No newline at end of file +class UnsetPropertyException(s: String?) : BaseException(s) \ No newline at end of file diff --git a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/exceptions/ValidationException.kt b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/exceptions/ValidationException.kt index bd2e7089700..66dabda704b 100644 --- a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/exceptions/ValidationException.kt +++ b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/exceptions/ValidationException.kt @@ -1,8 +1,3 @@ -package org.openapijsonschematools.client.exceptions; +package org.openapijsonschematools.client.exceptions -@SuppressWarnings("serial") -public class ValidationException extends BaseException { - public ValidationException(String s) { - super(s); - } -} \ No newline at end of file +class ValidationException(s: String?) : BaseException(s) \ No newline at end of file diff --git a/src/main/resources/kotlin/src/main/kotlin/packagename/exceptions/ApiException.hbs b/src/main/resources/kotlin/src/main/kotlin/packagename/exceptions/ApiException.hbs index 76c683b4c5a..538e79d633f 100644 --- a/src/main/resources/kotlin/src/main/kotlin/packagename/exceptions/ApiException.hbs +++ b/src/main/resources/kotlin/src/main/kotlin/packagename/exceptions/ApiException.hbs @@ -2,12 +2,4 @@ package {{{packageName}}}.exceptions; import java.net.http.HttpResponse; -@SuppressWarnings("serial") -public class ApiException extends BaseException { - public HttpResponse response; - - public ApiException(String s, HttpResponse response) { - super(s); - this.response = response; - } -} \ No newline at end of file +class ApiException(s: String?, val response: HttpResponse) : BaseException(s) \ No newline at end of file diff --git a/src/main/resources/kotlin/src/main/kotlin/packagename/exceptions/BaseException.hbs b/src/main/resources/kotlin/src/main/kotlin/packagename/exceptions/BaseException.hbs index d678e2fcaff..51528cde504 100644 --- a/src/main/resources/kotlin/src/main/kotlin/packagename/exceptions/BaseException.hbs +++ b/src/main/resources/kotlin/src/main/kotlin/packagename/exceptions/BaseException.hbs @@ -1,8 +1,3 @@ package {{{packageName}}}.exceptions; -@SuppressWarnings("serial") -public class BaseException extends Exception { - public BaseException(String s) { - super(s); - } -} \ No newline at end of file +open class BaseException(s: String?) : Exception(s) \ No newline at end of file diff --git a/src/main/resources/kotlin/src/main/kotlin/packagename/exceptions/InvalidAdditionalPropertyException.hbs b/src/main/resources/kotlin/src/main/kotlin/packagename/exceptions/InvalidAdditionalPropertyException.hbs index 6567ff7ad8f..cd5e66a6f46 100644 --- a/src/main/resources/kotlin/src/main/kotlin/packagename/exceptions/InvalidAdditionalPropertyException.hbs +++ b/src/main/resources/kotlin/src/main/kotlin/packagename/exceptions/InvalidAdditionalPropertyException.hbs @@ -1,8 +1,3 @@ package {{{packageName}}}.exceptions; -@SuppressWarnings("serial") -public class InvalidAdditionalPropertyException extends BaseException { - public InvalidAdditionalPropertyException(String s) { - super(s); - } -} \ No newline at end of file +class InvalidAdditionalPropertyException(s: String?) : BaseException(s) diff --git a/src/main/resources/kotlin/src/main/kotlin/packagename/exceptions/NotImplementedException.hbs b/src/main/resources/kotlin/src/main/kotlin/packagename/exceptions/NotImplementedException.hbs index 00cdf1273d6..4b09819638e 100644 --- a/src/main/resources/kotlin/src/main/kotlin/packagename/exceptions/NotImplementedException.hbs +++ b/src/main/resources/kotlin/src/main/kotlin/packagename/exceptions/NotImplementedException.hbs @@ -1,8 +1,3 @@ package {{{packageName}}}.exceptions; -@SuppressWarnings("serial") -public class NotImplementedException extends BaseException { - public NotImplementedException(String s) { - super(s); - } -} \ No newline at end of file +class NotImplementedException(s: String?) : BaseException(s) \ No newline at end of file diff --git a/src/main/resources/kotlin/src/main/kotlin/packagename/exceptions/UnsetPropertyException.hbs b/src/main/resources/kotlin/src/main/kotlin/packagename/exceptions/UnsetPropertyException.hbs index 16504af69fd..2eac3a273e9 100644 --- a/src/main/resources/kotlin/src/main/kotlin/packagename/exceptions/UnsetPropertyException.hbs +++ b/src/main/resources/kotlin/src/main/kotlin/packagename/exceptions/UnsetPropertyException.hbs @@ -1,8 +1,3 @@ package {{{packageName}}}.exceptions; -@SuppressWarnings("serial") -public class UnsetPropertyException extends BaseException { - public UnsetPropertyException(String s) { - super(s); - } -} \ No newline at end of file +class UnsetPropertyException(s: String?) : BaseException(s) \ No newline at end of file diff --git a/src/main/resources/kotlin/src/main/kotlin/packagename/exceptions/ValidationException.hbs b/src/main/resources/kotlin/src/main/kotlin/packagename/exceptions/ValidationException.hbs index c0be4e3d42c..595dca21426 100644 --- a/src/main/resources/kotlin/src/main/kotlin/packagename/exceptions/ValidationException.hbs +++ b/src/main/resources/kotlin/src/main/kotlin/packagename/exceptions/ValidationException.hbs @@ -1,8 +1,3 @@ package {{{packageName}}}.exceptions; -@SuppressWarnings("serial") -public class ValidationException extends BaseException { - public ValidationException(String s) { - super(s); - } -} \ No newline at end of file +class ValidationException(s: String?) : BaseException(s) \ No newline at end of file From fd1b0dd2dd4b974a2e1340a9c6496b8e8130cf01 Mon Sep 17 00:00:00 2001 From: Justin Black Date: Mon, 6 May 2024 13:17:27 -0700 Subject: [PATCH 05/78] Converts KeywordValidator and supporting classes to Kotlin --- .../schemas/validation/KeywordValidator.kt | 15 ++++----- .../schemas/validation/PathToSchemasMap.kt | 20 ++++-------- .../schemas/validation/ValidationData.kt | 32 ++++++------------- .../schemas/validation/ValidationMetadata.kt | 30 +++++++---------- .../schemas/validation/KeywordValidator.hbs | 11 +++---- .../schemas/validation/PathToSchemasMap.hbs | 18 +++-------- .../schemas/validation/ValidationData.hbs | 30 ++++++----------- .../schemas/validation/ValidationMetadata.hbs | 26 ++++++--------- 8 files changed, 62 insertions(+), 120 deletions(-) diff --git a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/schemas/validation/KeywordValidator.kt b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/schemas/validation/KeywordValidator.kt index 8a2bd782505..744a8cb6c0a 100644 --- a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/schemas/validation/KeywordValidator.kt +++ b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/schemas/validation/KeywordValidator.kt @@ -1,11 +1,10 @@ -package org.openapijsonschematools.client.schemas.validation; +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 -@FunctionalInterface -public interface KeywordValidator { - @Nullable PathToSchemasMap validate( - ValidationData data - ) throws ValidationException; +fun interface KeywordValidator { + @Throws(ValidationException::class) + fun validate( + data: ValidationData? + ): PathToSchemasMap? } \ No newline at end of file diff --git a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/schemas/validation/PathToSchemasMap.kt b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/schemas/validation/PathToSchemasMap.kt index 6e12d851bff..12bcd3a0a09 100644 --- a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/schemas/validation/PathToSchemasMap.kt +++ b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/schemas/validation/PathToSchemasMap.kt @@ -1,20 +1,12 @@ -package org.openapijsonschematools.client.schemas.validation; +package org.openapijsonschematools.client.schemas.validation -import java.util.LinkedHashMap; -import java.util.List; -import java.util.Map; - -@SuppressWarnings("serial") -public class PathToSchemasMap extends LinkedHashMap, LinkedHashMap, Nothing?>> { - - public void update(PathToSchemasMap other) { - for (Map.Entry, LinkedHashMap, Nothing?>> entry: other.entrySet()) { - List pathToItem = entry.getKey(); - LinkedHashMap, Nothing?> otherSchemas = entry.getValue(); +class PathToSchemasMap : LinkedHashMap?, LinkedHashMap?, Nothing?>?>() { + fun update(other: PathToSchemasMap) { + for ((pathToItem, otherSchemas) in other) { if (containsKey(pathToItem)) { - get(pathToItem).putAll(otherSchemas); + get(pathToItem)!!.putAll(otherSchemas!!) } else { - put(pathToItem, otherSchemas); + put(pathToItem, otherSchemas) } } } diff --git a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/schemas/validation/ValidationData.kt b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/schemas/validation/ValidationData.kt index 1563757d83a..4ac4e182fc6 100644 --- a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/schemas/validation/ValidationData.kt +++ b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/schemas/validation/ValidationData.kt @@ -1,23 +1,11 @@ -package org.openapijsonschematools.client.schemas.validation; +package org.openapijsonschematools.client.schemas.validation -import org.checkerframework.checker.nullness.qual.Nullable; - -import java.util.List; - -public record ValidationData( - JsonSchema schema, - @Nullable Object arg, - ValidationMetadata validationMetadata, - @Nullable List containsPathToSchemas, - @Nullable PathToSchemasMap patternPropertiesPathToSchemas, - @Nullable PathToSchemasMap ifPathToSchemas, - @Nullable PathToSchemasMap knownPathToSchemas -) { - public ValidationData( - JsonSchema schema, - @Nullable Object arg, - ValidationMetadata validationMetadata - ) { - this(schema, arg, validationMetadata, null, null, null, null); - } -} \ No newline at end of file +data class ValidationData( + val schema: JsonSchema<*>, + val arg: Any?, + val validationMetadata: ValidationMetadata, + val containsPathToSchemas: List?, + val patternPropertiesPathToSchemas: PathToSchemasMap?, + val ifPathToSchemas: PathToSchemasMap?, + val knownPathToSchemas: PathToSchemasMap? +) \ No newline at end of file diff --git a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/schemas/validation/ValidationMetadata.kt b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/schemas/validation/ValidationMetadata.kt index 9f5f81d00d3..6b7ab45ebf9 100644 --- a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/schemas/validation/ValidationMetadata.kt +++ b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/schemas/validation/ValidationMetadata.kt @@ -1,26 +1,18 @@ -package org.openapijsonschematools.client.schemas.validation; +package org.openapijsonschematools.client.schemas.validation -import org.checkerframework.checker.nullness.qual.Nullable; -import org.openapijsonschematools.client.configurations.SchemaConfiguration; -import java.util.List; -import java.util.Map; -import java.util.Set; +import org.openapijsonschematools.client.configurations.SchemaConfiguration -public record ValidationMetadata( - List pathToItem, - SchemaConfiguration configuration, - PathToSchemasMap validatedPathToSchemas, - Set> seenClasses +data class ValidationMetadata( + val pathToItem: List, + val configuration: SchemaConfiguration, + val validatedPathToSchemas: PathToSchemasMap, + val seenClasses: Set> ) { - - public boolean validationRanEarlier(JsonSchema schema) { - @Nullable Map, Nothing?> validatedSchemas = validatedPathToSchemas.get(pathToItem); + fun validationRanEarlier(schema: JsonSchema<*>): Boolean { + val validatedSchemas: Map?, Nothing?>? = validatedPathToSchemas[pathToItem] if (validatedSchemas != null && validatedSchemas.containsKey(schema)) { - return true; - } - if (seenClasses.contains(schema)) { - return true; + return true } - return false; + return seenClasses.contains(schema.javaClass) } } \ No newline at end of file diff --git a/src/main/resources/kotlin/src/main/kotlin/packagename/schemas/validation/KeywordValidator.hbs b/src/main/resources/kotlin/src/main/kotlin/packagename/schemas/validation/KeywordValidator.hbs index b95cc5d5fc2..5c0b37e2c91 100644 --- a/src/main/resources/kotlin/src/main/kotlin/packagename/schemas/validation/KeywordValidator.hbs +++ b/src/main/resources/kotlin/src/main/kotlin/packagename/schemas/validation/KeywordValidator.hbs @@ -1,11 +1,10 @@ package {{{packageName}}}.schemas.validation; import {{{packageName}}}.exceptions.ValidationException; -import org.checkerframework.checker.nullness.qual.Nullable; -@FunctionalInterface -public interface KeywordValidator { - @Nullable PathToSchemasMap validate( - ValidationData data - ) throws ValidationException; +fun interface KeywordValidator { + @Throws(ValidationException::class) + fun validate( + data: ValidationData? + ): PathToSchemasMap? } \ No newline at end of file diff --git a/src/main/resources/kotlin/src/main/kotlin/packagename/schemas/validation/PathToSchemasMap.hbs b/src/main/resources/kotlin/src/main/kotlin/packagename/schemas/validation/PathToSchemasMap.hbs index 5c3e08edc57..fea11730a25 100644 --- a/src/main/resources/kotlin/src/main/kotlin/packagename/schemas/validation/PathToSchemasMap.hbs +++ b/src/main/resources/kotlin/src/main/kotlin/packagename/schemas/validation/PathToSchemasMap.hbs @@ -1,20 +1,12 @@ package {{{packageName}}}.schemas.validation; -import java.util.LinkedHashMap; -import java.util.List; -import java.util.Map; - -@SuppressWarnings("serial") -public class PathToSchemasMap extends LinkedHashMap, LinkedHashMap, Nothing?>> { - - public void update(PathToSchemasMap other) { - for (Map.Entry, LinkedHashMap, Nothing?>> entry: other.entrySet()) { - List pathToItem = entry.getKey(); - LinkedHashMap, Nothing?> otherSchemas = entry.getValue(); +class PathToSchemasMap : LinkedHashMap?, LinkedHashMap?, Nothing?>?>() { + fun update(other: PathToSchemasMap) { + for ((pathToItem, otherSchemas) in other) { if (containsKey(pathToItem)) { - get(pathToItem).putAll(otherSchemas); + get(pathToItem)!!.putAll(otherSchemas!!) } else { - put(pathToItem, otherSchemas); + put(pathToItem, otherSchemas) } } } diff --git a/src/main/resources/kotlin/src/main/kotlin/packagename/schemas/validation/ValidationData.hbs b/src/main/resources/kotlin/src/main/kotlin/packagename/schemas/validation/ValidationData.hbs index b269cda57ef..bb09fee06d4 100644 --- a/src/main/resources/kotlin/src/main/kotlin/packagename/schemas/validation/ValidationData.hbs +++ b/src/main/resources/kotlin/src/main/kotlin/packagename/schemas/validation/ValidationData.hbs @@ -1,23 +1,11 @@ package {{{packageName}}}.schemas.validation; -import org.checkerframework.checker.nullness.qual.Nullable; - -import java.util.List; - -public record ValidationData( - JsonSchema schema, - @Nullable Object arg, - ValidationMetadata validationMetadata, - @Nullable List containsPathToSchemas, - @Nullable PathToSchemasMap patternPropertiesPathToSchemas, - @Nullable PathToSchemasMap ifPathToSchemas, - @Nullable PathToSchemasMap knownPathToSchemas -) { - public ValidationData( - JsonSchema schema, - @Nullable Object arg, - ValidationMetadata validationMetadata - ) { - this(schema, arg, validationMetadata, null, null, null, null); - } -} \ No newline at end of file +data class ValidationData( + val schema: JsonSchema<*>, + val arg: Any?, + val validationMetadata: ValidationMetadata, + val containsPathToSchemas: List?, + val patternPropertiesPathToSchemas: PathToSchemasMap?, + val ifPathToSchemas: PathToSchemasMap?, + val knownPathToSchemas: PathToSchemasMap? +) \ No newline at end of file diff --git a/src/main/resources/kotlin/src/main/kotlin/packagename/schemas/validation/ValidationMetadata.hbs b/src/main/resources/kotlin/src/main/kotlin/packagename/schemas/validation/ValidationMetadata.hbs index e16e9fb3095..6dc4e71ddda 100644 --- a/src/main/resources/kotlin/src/main/kotlin/packagename/schemas/validation/ValidationMetadata.hbs +++ b/src/main/resources/kotlin/src/main/kotlin/packagename/schemas/validation/ValidationMetadata.hbs @@ -1,26 +1,18 @@ package {{{packageName}}}.schemas.validation; -import org.checkerframework.checker.nullness.qual.Nullable; import {{{packageName}}}.configurations.SchemaConfiguration; -import java.util.List; -import java.util.Map; -import java.util.Set; -public record ValidationMetadata( - List pathToItem, - SchemaConfiguration configuration, - PathToSchemasMap validatedPathToSchemas, - Set> seenClasses +data class ValidationMetadata( + val pathToItem: List, + val configuration: SchemaConfiguration, + val validatedPathToSchemas: PathToSchemasMap, + val seenClasses: Set> ) { - - public boolean validationRanEarlier(JsonSchema schema) { - @Nullable Map, Nothing?> validatedSchemas = validatedPathToSchemas.get(pathToItem); + fun validationRanEarlier(schema: JsonSchema<*>): Boolean { + val validatedSchemas: Map?, Nothing?>? = validatedPathToSchemas[pathToItem] if (validatedSchemas != null && validatedSchemas.containsKey(schema)) { - return true; - } - if (seenClasses.contains(schema)) { - return true; + return true } - return false; + return seenClasses.contains(schema.javaClass) } } \ No newline at end of file From b930d5820e81c7cdd14f1663ab396b32cad40b67 Mon Sep 17 00:00:00 2001 From: Justin Black Date: Mon, 6 May 2024 15:58:17 -0700 Subject: [PATCH 06/78] Updates kotlin jsonschema templates and supporting classes --- ....kt => AdditionalPropertiesValidator.java} | 0 .../client/schemas/validation/JsonSchema.kt | 862 +++++++++--------- .../schemas/validation/JsonSchemaFactory.kt | 45 +- .../schemas/validation/JsonSchemaInfo.kt | 450 ++++----- .../schemas/validation/KeywordValidator.kt | 2 +- .../schemas/validation/PathToSchemasMap.kt | 4 +- .../schemas/validation/JsonSchema.hbs | 855 ++++++++--------- .../schemas/validation/JsonSchemaFactory.hbs | 43 +- .../schemas/validation/JsonSchemaInfo.hbs | 448 ++++----- .../schemas/validation/JsonSchema.hbs | 856 ++++++++--------- .../schemas/validation/JsonSchemaFactory.hbs | 41 +- .../schemas/validation/JsonSchemaInfo.hbs | 445 ++++----- .../schemas/validation/KeywordValidator.hbs | 2 +- .../schemas/validation/PathToSchemasMap.hbs | 4 +- 14 files changed, 2081 insertions(+), 1976 deletions(-) rename samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/schemas/validation/{AdditionalPropertiesValidator.kt => AdditionalPropertiesValidator.java} (100%) diff --git a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/schemas/validation/AdditionalPropertiesValidator.kt b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/schemas/validation/AdditionalPropertiesValidator.java similarity index 100% rename from samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/schemas/validation/AdditionalPropertiesValidator.kt rename to samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/schemas/validation/AdditionalPropertiesValidator.java diff --git a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/schemas/validation/JsonSchema.kt b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/schemas/validation/JsonSchema.kt index cd916ff197f..8f1f16d643c 100644 --- a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/schemas/validation/JsonSchema.kt +++ b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/schemas/validation/JsonSchema.kt @@ -1,499 +1,503 @@ -package org.openapijsonschematools.client.schemas.validation; +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.configurations.SchemaConfiguration +import org.openapijsonschematools.client.exceptions.ValidationException -import java.math.BigDecimal; -import java.time.LocalDate; -import java.time.ZonedDateTime; -import java.util.ArrayList; -import java.util.LinkedHashMap; -import java.util.LinkedHashSet; -import java.util.List; -import java.util.Map; -import java.util.Set; -import java.util.UUID; -import java.util.regex.Pattern; +import java.math.BigDecimal +import java.time.LocalDate +import java.time.ZonedDateTime +import java.util.regex.Pattern +import java.util.UUID -public abstract class JsonSchema { - public final @Nullable Set> type; - public final @Nullable String format; - public final @Nullable Class> items; - public final @Nullable Map>> properties; - public final @Nullable Set required; - public final @Nullable Number exclusiveMaximum; - public final @Nullable Number exclusiveMinimum; - public final @Nullable Integer maxItems; - public final @Nullable Integer minItems; - public final @Nullable Integer maxLength; - public final @Nullable Integer minLength; - public final @Nullable Integer maxProperties; - public final @Nullable Integer minProperties; - public final @Nullable Number maximum; - public final @Nullable Number minimum; - public final @Nullable BigDecimal multipleOf; - public final @Nullable Class> additionalProperties; - public final @Nullable List>> allOf; - public final @Nullable List>> anyOf; - public final @Nullable List>> oneOf; - public final @Nullable Class> not; - public final @Nullable Boolean uniqueItems; - public final @Nullable Set<@Nullable Object> enumValues; - public final @Nullable Pattern pattern; - public final @Nullable Object defaultValue; - public final boolean defaultValueSet; - public final @Nullable Object constValue; - public final boolean constValueSet; - public final @Nullable Class> contains; - public final @Nullable Integer maxContains; - public final @Nullable Integer minContains; - public final @Nullable Class> propertyNames; - public final @Nullable Map> dependentRequired; - public final @Nullable Map>> dependentSchemas; - public final @Nullable Map>> patternProperties; - public final @Nullable List>> prefixItems; - public final @Nullable Class> ifSchema; - public final @Nullable Class> then; - public final @Nullable Class> elseSchema; - public final @Nullable Class> unevaluatedItems; - public final @Nullable Class> unevaluatedProperties; - private final LinkedHashMap keywordToValidator; +abstract class JsonSchema protected constructor(jsonSchemaInfo: JsonSchemaInfo) { + val type: Set>? + val format: String? + val items: Class>? + val properties: Map>>? + val required: Set? + val exclusiveMaximum: Number? + val exclusiveMinimum: Number? + val maxItems: Int? + val minItems: Int? + val maxLength: Int? + val minLength: Int? + val maxProperties: Int? + val minProperties: Int? + val maximum: Number? + val minimum: Number? + val multipleOf: BigDecimal? + val additionalProperties: Class>? + val allOf: List>>? + val anyOf: List>>? + val oneOf: List>>? + val not: Class>? + val uniqueItems: Boolean? + val enumValues: Set? + val pattern: Pattern? + val defaultValue: Any? + val defaultValueSet: Boolean + val constValue: Any? + val constValueSet: Boolean + val contains: Class>? + val maxContains: Int? + val minContains: Int? + val propertyNames: Class>? + val dependentRequired: Map>? + val dependentSchemas: Map>>? + val patternProperties: Map>>? + val prefixItems: List>>? + val ifSchema: Class>? + val then: Class>? + val elseSchema: Class>? + val unevaluatedItems: Class>? + val unevaluatedProperties: Class>? + private val keywordToValidator: LinkedHashMap - protected JsonSchema(JsonSchemaInfo jsonSchemaInfo) { - LinkedHashMap keywordToValidator = new LinkedHashMap<>(); - this.type = jsonSchemaInfo.type; - if (this.type != null) { - keywordToValidator.put("type", new TypeValidator()); - } - this.format = jsonSchemaInfo.format; - if (this.format != null) { - keywordToValidator.put("format", new FormatValidator()); - } - this.items = jsonSchemaInfo.items; - if (this.items != null) { - keywordToValidator.put("items", new ItemsValidator()); - } - this.properties = jsonSchemaInfo.properties; - if (this.properties != null) { - keywordToValidator.put("properties", new PropertiesValidator()); - } - this.required = jsonSchemaInfo.required; - if (this.required != null) { - keywordToValidator.put("required", new RequiredValidator()); - } - this.exclusiveMaximum = jsonSchemaInfo.exclusiveMaximum; - if (this.exclusiveMaximum != null) { - keywordToValidator.put("exclusiveMaximum", new ExclusiveMaximumValidator()); - } - this.exclusiveMinimum = jsonSchemaInfo.exclusiveMinimum; - if (this.exclusiveMinimum != null) { - keywordToValidator.put("exclusiveMinimum", new ExclusiveMinimumValidator()); - } - this.maxItems = jsonSchemaInfo.maxItems; - if (this.maxItems != null) { - keywordToValidator.put("maxItems", new MaxItemsValidator()); - } - this.minItems = jsonSchemaInfo.minItems; - if (this.minItems != null) { - keywordToValidator.put("minItems", new MinItemsValidator()); - } - this.maxLength = jsonSchemaInfo.maxLength; - if (this.maxLength != null) { - keywordToValidator.put("maxLength", new MaxLengthValidator()); - } - this.minLength = jsonSchemaInfo.minLength; - if (this.minLength != null) { - keywordToValidator.put("minLength", new MinLengthValidator()); - } - this.maxProperties = jsonSchemaInfo.maxProperties; - if (this.maxProperties != null) { - keywordToValidator.put("maxProperties", new MaxPropertiesValidator()); - } - this.minProperties = jsonSchemaInfo.minProperties; - if (this.minProperties != null) { - keywordToValidator.put("minProperties", new MinPropertiesValidator()); - } - this.maximum = jsonSchemaInfo.maximum; - if (this.maximum != null) { - keywordToValidator.put("maximum", new MaximumValidator()); - } - this.minimum = jsonSchemaInfo.minimum; - if (this.minimum != null) { - keywordToValidator.put("minimum", new MinimumValidator()); - } - this.multipleOf = jsonSchemaInfo.multipleOf; - if (this.multipleOf != null) { - keywordToValidator.put("multipleOf", new MultipleOfValidator()); - } - this.additionalProperties = jsonSchemaInfo.additionalProperties; - if (this.additionalProperties != null) { - keywordToValidator.put("additionalProperties", new AdditionalPropertiesValidator()); - } - this.allOf = jsonSchemaInfo.allOf; - if (this.allOf != null) { - keywordToValidator.put("allOf", new AllOfValidator()); - } - this.anyOf = jsonSchemaInfo.anyOf; - if (this.anyOf != null) { - keywordToValidator.put("anyOf", new AnyOfValidator()); - } - this.oneOf = jsonSchemaInfo.oneOf; - if (this.oneOf != null) { - keywordToValidator.put("oneOf", new OneOfValidator()); - } - this.not = jsonSchemaInfo.not; - if (this.not != null) { - keywordToValidator.put("not", new NotValidator()); - } - this.uniqueItems = jsonSchemaInfo.uniqueItems; - if (this.uniqueItems != null) { - keywordToValidator.put("uniqueItems", new UniqueItemsValidator()); - } - this.enumValues = jsonSchemaInfo.enumValues; - if (this.enumValues != null) { - keywordToValidator.put("enum", new EnumValidator()); - } - this.pattern = jsonSchemaInfo.pattern; - if (this.pattern != null) { - keywordToValidator.put("pattern", new PatternValidator()); - } - this.defaultValue = jsonSchemaInfo.defaultValue; - this.defaultValueSet = jsonSchemaInfo.defaultValueSet; - this.constValue = jsonSchemaInfo.constValue; - this.constValueSet = jsonSchemaInfo.constValueSet; - if (this.constValueSet) { - keywordToValidator.put("const", new ConstValidator()); + init { + val keywordToValidator = LinkedHashMap() + type = jsonSchemaInfo.type + if (type != null) { + keywordToValidator["type"] = TypeValidator() + } + format = jsonSchemaInfo.format + if (format != null) { + keywordToValidator["format"] = FormatValidator() + } + items = jsonSchemaInfo.items + if (items != null) { + keywordToValidator["items"] = ItemsValidator() + } + properties = jsonSchemaInfo.properties + if (properties != null) { + keywordToValidator["properties"] = PropertiesValidator() + } + required = jsonSchemaInfo.required + if (required != null) { + keywordToValidator["required"] = RequiredValidator() + } + exclusiveMaximum = jsonSchemaInfo.exclusiveMaximum + if (exclusiveMaximum != null) { + keywordToValidator["exclusiveMaximum"] = ExclusiveMaximumValidator() + } + exclusiveMinimum = jsonSchemaInfo.exclusiveMinimum + if (exclusiveMinimum != null) { + keywordToValidator["exclusiveMinimum"] = ExclusiveMinimumValidator() + } + maxItems = jsonSchemaInfo.maxItems + if (maxItems != null) { + keywordToValidator["maxItems"] = MaxItemsValidator() + } + minItems = jsonSchemaInfo.minItems + if (minItems != null) { + keywordToValidator["minItems"] = MinItemsValidator() + } + maxLength = jsonSchemaInfo.maxLength + if (maxLength != null) { + keywordToValidator["maxLength"] = MaxLengthValidator() + } + minLength = jsonSchemaInfo.minLength + if (minLength != null) { + keywordToValidator["minLength"] = MinLengthValidator() + } + maxProperties = jsonSchemaInfo.maxProperties + if (maxProperties != null) { + keywordToValidator["maxProperties"] = MaxPropertiesValidator() + } + minProperties = jsonSchemaInfo.minProperties + if (minProperties != null) { + keywordToValidator["minProperties"] = MinPropertiesValidator() + } + maximum = jsonSchemaInfo.maximum + if (maximum != null) { + keywordToValidator["maximum"] = MaximumValidator() + } + minimum = jsonSchemaInfo.minimum + if (minimum != null) { + keywordToValidator["minimum"] = MinimumValidator() + } + multipleOf = jsonSchemaInfo.multipleOf + if (multipleOf != null) { + keywordToValidator["multipleOf"] = MultipleOfValidator() + } + additionalProperties = jsonSchemaInfo.additionalProperties + if (additionalProperties != null) { + keywordToValidator["additionalProperties"] = AdditionalPropertiesValidator() + } + allOf = jsonSchemaInfo.allOf + if (allOf != null) { + keywordToValidator["allOf"] = AllOfValidator() + } + anyOf = jsonSchemaInfo.anyOf + if (anyOf != null) { + keywordToValidator["anyOf"] = AnyOfValidator() + } + oneOf = jsonSchemaInfo.oneOf + if (oneOf != null) { + keywordToValidator["oneOf"] = OneOfValidator() + } + not = jsonSchemaInfo.not + if (not != null) { + keywordToValidator["not"] = NotValidator() + } + uniqueItems = jsonSchemaInfo.uniqueItems + if (uniqueItems != null) { + keywordToValidator["uniqueItems"] = UniqueItemsValidator() + } + enumValues = jsonSchemaInfo.enumValues + if (enumValues != null) { + keywordToValidator["enum"] = EnumValidator() + } + pattern = jsonSchemaInfo.pattern + if (pattern != null) { + keywordToValidator["pattern"] = PatternValidator() + } + defaultValue = jsonSchemaInfo.defaultValue + defaultValueSet = jsonSchemaInfo.defaultValueSet + constValue = jsonSchemaInfo.constValue + constValueSet = jsonSchemaInfo.constValueSet + if (constValueSet) { + keywordToValidator["const"] = ConstValidator() } - this.contains = jsonSchemaInfo.contains; - if (this.contains != null) { - keywordToValidator.put("contains", new ContainsValidator()); + contains = jsonSchemaInfo.contains + if (contains != null) { + keywordToValidator["contains"] = ContainsValidator() } - this.maxContains = jsonSchemaInfo.maxContains; - if (this.maxContains != null) { - keywordToValidator.put("maxContains", new MaxContainsValidator()); + maxContains = jsonSchemaInfo.maxContains + if (maxContains != null) { + keywordToValidator["maxContains"] = MaxContainsValidator() } - this.minContains = jsonSchemaInfo.minContains; - if (this.minContains != null) { - keywordToValidator.put("minContains", new MinContainsValidator()); + minContains = jsonSchemaInfo.minContains + if (minContains != null) { + keywordToValidator["minContains"] = MinContainsValidator() } - this.propertyNames = jsonSchemaInfo.propertyNames; - if (this.propertyNames != null) { - keywordToValidator.put("propertyNames", new PropertyNamesValidator()); + propertyNames = jsonSchemaInfo.propertyNames + if (propertyNames != null) { + keywordToValidator["propertyNames"] = PropertyNamesValidator() } - this.dependentRequired = jsonSchemaInfo.dependentRequired; - if (this.dependentRequired != null) { - keywordToValidator.put("dependentRequired", new DependentRequiredValidator()); + dependentRequired = jsonSchemaInfo.dependentRequired + if (dependentRequired != null) { + keywordToValidator["dependentRequired"] = DependentRequiredValidator() } - this.dependentSchemas = jsonSchemaInfo.dependentSchemas; - if (this.dependentSchemas != null) { - keywordToValidator.put("dependentSchemas", new DependentSchemasValidator()); + dependentSchemas = jsonSchemaInfo.dependentSchemas + if (dependentSchemas != null) { + keywordToValidator["dependentSchemas"] = DependentSchemasValidator() } - this.patternProperties = jsonSchemaInfo.patternProperties; - if (this.patternProperties != null) { - keywordToValidator.put("patternProperties", new PatternPropertiesValidator()); + patternProperties = jsonSchemaInfo.patternProperties + if (patternProperties != null) { + keywordToValidator["patternProperties"] = PatternPropertiesValidator() } - this.prefixItems = jsonSchemaInfo.prefixItems; - if (this.prefixItems != null) { - keywordToValidator.put("prefixItems", new PrefixItemsValidator()); + prefixItems = jsonSchemaInfo.prefixItems + if (prefixItems != null) { + keywordToValidator["prefixItems"] = PrefixItemsValidator() } - this.ifSchema = jsonSchemaInfo.ifSchema; - if (this.ifSchema != null) { - keywordToValidator.put("if", new IfValidator()); + ifSchema = jsonSchemaInfo.ifSchema + if (ifSchema != null) { + keywordToValidator["if"] = IfValidator() } - this.then = jsonSchemaInfo.then; - if (this.then != null) { - keywordToValidator.put("then", new ThenValidator()); + then = jsonSchemaInfo.then + if (then != null) { + keywordToValidator["then"] = ThenValidator() } - this.elseSchema = jsonSchemaInfo.elseSchema; - if (this.elseSchema != null) { - keywordToValidator.put("else", new ElseValidator()); + elseSchema = jsonSchemaInfo.elseSchema + if (elseSchema != null) { + keywordToValidator["else"] = ElseValidator() } - this.unevaluatedItems = jsonSchemaInfo.unevaluatedItems; - if (this.unevaluatedItems != null) { - keywordToValidator.put("unevaluatedItems", new UnevaluatedItemsValidator()); + unevaluatedItems = jsonSchemaInfo.unevaluatedItems + if (unevaluatedItems != null) { + keywordToValidator["unevaluatedItems"] = UnevaluatedItemsValidator() } - this.unevaluatedProperties = jsonSchemaInfo.unevaluatedProperties; - if (this.unevaluatedProperties != null) { - keywordToValidator.put("unevaluatedProperties", new UnevaluatedPropertiesValidator()); + unevaluatedProperties = jsonSchemaInfo.unevaluatedProperties + if (unevaluatedProperties != null) { + keywordToValidator["unevaluatedProperties"] = UnevaluatedPropertiesValidator() } - this.keywordToValidator = keywordToValidator; + 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; - - private List getContainsPathToSchemas( - @Nullable Object arg, - ValidationMetadata validationMetadata - ) { - if (!(arg instanceof List listArg) || contains == null) { - return new ArrayList<>(); - } - JsonSchema containsSchema = JsonSchemaFactory.getInstance(contains); - @Nullable List containsPathToSchemas = new ArrayList<>(); - for(int i = 0; i < listArg.size(); i++) { - PathToSchemasMap thesePathToSchemas = new PathToSchemasMap(); - List itemPathToItem = new ArrayList<>(validationMetadata.pathToItem()); - itemPathToItem.add(i); - ValidationMetadata itemValidationMetadata = new ValidationMetadata( - itemPathToItem, - validationMetadata.configuration(), - validationMetadata.validatedPathToSchemas(), - validationMetadata.seenClasses() - ); + abstract fun getNewInstance(arg: Any?, pathToItem: List?, pathToSchemas: PathToSchemasMap?): Any? + @Throws(ValidationException::class) + abstract fun validate(arg: Any?, configuration: SchemaConfiguration?): Any? + @Throws(ValidationException::class) + abstract fun validateAndBox(arg: Any?, configuration: SchemaConfiguration?): T + private fun getContainsPathToSchemas( + arg: Any?, + validationMetadata: ValidationMetadata + ): List? { + if (arg !is List<*> || contains == null) { + return ArrayList() + } + val containsSchema: JsonSchema<*> = JsonSchemaFactory.getInstance(contains) + val containsPathToSchemas: MutableList = ArrayList() + for (i in arg.indices) { + val thesePathToSchemas = PathToSchemasMap() + val itemPathToItem: MutableList = ArrayList(validationMetadata.pathToItem) + itemPathToItem.add(i) + val itemValidationMetadata = ValidationMetadata( + itemPathToItem, + validationMetadata.configuration, + validationMetadata.validatedPathToSchemas, + validationMetadata.seenClasses + ) if (itemValidationMetadata.validationRanEarlier(containsSchema)) { // todo add_deeper_validated_schemas - containsPathToSchemas.add(thesePathToSchemas); - continue; + containsPathToSchemas.add(thesePathToSchemas) + continue } - try { - PathToSchemasMap otherPathToSchemas = JsonSchema.validate( - containsSchema, listArg.get(i), itemValidationMetadata); - containsPathToSchemas.add(otherPathToSchemas); - } catch (ValidationException ignored) {} + val otherPathToSchemas = validate( + containsSchema, arg[i], itemValidationMetadata + ) + containsPathToSchemas.add(otherPathToSchemas) + } catch (ignored: ValidationException) { + } } - return containsPathToSchemas; + return containsPathToSchemas } - private PathToSchemasMap getPatternPropertiesPathToSchemas( - @Nullable Object arg, - ValidationMetadata validationMetadata - ) throws ValidationException { - if (!(arg instanceof Map mapArg) || patternProperties == null) { - return new PathToSchemasMap(); - } - PathToSchemasMap pathToSchemas = new PathToSchemasMap(); - 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"); - } - List propPathToItem = new ArrayList<>(validationMetadata.pathToItem()); - propPathToItem.add(key); - ValidationMetadata propValidationMetadata = new ValidationMetadata( - propPathToItem, - validationMetadata.configuration(), - validationMetadata.validatedPathToSchemas(), - validationMetadata.seenClasses() - ); - for (Map.Entry>> patternPropEntry: patternProperties.entrySet()) { - if (!patternPropEntry.getKey().matcher(key).find()) { - continue; + @Throws(ValidationException::class) + private fun getPatternPropertiesPathToSchemas( + arg: Any?, + validationMetadata: ValidationMetadata + ): PathToSchemasMap { + if (arg !is Map<*, *> || patternProperties == null) { + return PathToSchemasMap() + } + val pathToSchemas = PathToSchemasMap() + for ((key, value) in arg) { + val entryKey = key!! as? String + ?: throw ValidationException("Invalid non-string type for map key") + val propPathToItem: MutableList = ArrayList(validationMetadata.pathToItem()) + propPathToItem.add(entryKey) + val propValidationMetadata = ValidationMetadata( + propPathToItem, + validationMetadata.configuration, + validationMetadata.validatedPathToSchemas, + validationMetadata.seenClasses + ) + for ((key1, patternPropClass) in patternProperties) { + if (!key1.matcher(entryKey).find()) { + continue } - - Class> patternPropClass = patternPropEntry.getValue(); - JsonSchema patternPropSchema = JsonSchemaFactory.getInstance(patternPropClass); - PathToSchemasMap otherPathToSchemas = JsonSchema.validate(patternPropSchema, entry.getValue(), propValidationMetadata); - pathToSchemas.update(otherPathToSchemas); + val patternPropSchema: JsonSchema<*> = JsonSchemaFactory.getInstance(patternPropClass) + val otherPathToSchemas = validate(patternPropSchema, value, propValidationMetadata) + pathToSchemas.update(otherPathToSchemas) } } - return pathToSchemas; + return pathToSchemas } - private PathToSchemasMap getIfPathToSchemas( - @Nullable Object arg, - ValidationMetadata validationMetadata - ) { + private fun getIfPathToSchemas( + arg: Any?, + validationMetadata: ValidationMetadata + ): PathToSchemasMap { if (ifSchema == null) { - return new PathToSchemasMap(); + return PathToSchemasMap() } - JsonSchema ifSchemaInstance = JsonSchemaFactory.getInstance(ifSchema); - PathToSchemasMap pathToSchemas = new PathToSchemasMap(); + val ifSchemaInstance: JsonSchema<*> = JsonSchemaFactory.getInstance(ifSchema) + val pathToSchemas = PathToSchemasMap() try { - var otherPathToSchemas = JsonSchema.validate(ifSchemaInstance, arg, validationMetadata); - pathToSchemas.update(otherPathToSchemas); - } catch (ValidationException ignored) {} - return pathToSchemas; - } - - public static PathToSchemasMap validate( - JsonSchema jsonSchema, - @Nullable Object arg, - ValidationMetadata validationMetadata - ) throws ValidationException { - LinkedHashSet disabledKeywords = validationMetadata.configuration().disabledKeywordFlags().getKeywords(); - PathToSchemasMap pathToSchemas = new PathToSchemasMap(); - LinkedHashMap thisKeywordToValidator = jsonSchema.keywordToValidator; - @Nullable List containsPathToSchemas = null; - if (thisKeywordToValidator.containsKey("contains")) { - containsPathToSchemas = jsonSchema.getContainsPathToSchemas(arg, validationMetadata); - } - @Nullable PathToSchemasMap patternPropertiesPathToSchemas = null; - if (thisKeywordToValidator.containsKey("patternProperties")) { - patternPropertiesPathToSchemas = jsonSchema.getPatternPropertiesPathToSchemas(arg, validationMetadata); - } - @Nullable PathToSchemasMap ifPathToSchemas = null; - if (thisKeywordToValidator.containsKey("if")) { - ifPathToSchemas = jsonSchema.getIfPathToSchemas(arg, validationMetadata); - } - @Nullable PathToSchemasMap knownPathToSchemas = null; - for (Map.Entry entry: thisKeywordToValidator.entrySet()) { - String jsonKeyword = entry.getKey(); - if (disabledKeywords.contains(jsonKeyword)) { - boolean typeIntegerUseCase = jsonKeyword.equals("format") && "int".equals(jsonSchema.format); - if (!typeIntegerUseCase) { - continue; - } - } - if ("unevaluatedItems".equals(jsonKeyword) || "unevaluatedProperties".equals(jsonKeyword)) { - knownPathToSchemas = pathToSchemas; - } - KeywordValidator validator = entry.getValue(); - ValidationData data = new ValidationData( - jsonSchema, - arg, - validationMetadata, - containsPathToSchemas, - patternPropertiesPathToSchemas, - ifPathToSchemas, - knownPathToSchemas - ); - @Nullable PathToSchemasMap otherPathToSchemas = validator.validate(data); - if (otherPathToSchemas == null) { - continue; - } - pathToSchemas.update(otherPathToSchemas); - } - List pathToItem = validationMetadata.pathToItem(); - if (!pathToSchemas.containsKey(pathToItem)) { - pathToSchemas.put(validationMetadata.pathToItem(), new LinkedHashMap<>()); + val otherPathToSchemas = validate(ifSchemaInstance, arg, validationMetadata) + pathToSchemas.update(otherPathToSchemas) + } catch (ignored: ValidationException) { } - @Nullable LinkedHashMap, Nothing?> schemas = pathToSchemas.get(pathToItem); - if (schemas != null) { - schemas.put(jsonSchema, null); - } - return pathToSchemas; + return pathToSchemas } - protected String castToAllowedTypes(String arg, List pathToItem, Set> pathSet) { - pathSet.add(pathToItem); - return arg; + protected fun castToAllowedTypes(arg: String, pathToItem: List?, pathSet: MutableSet?>): String { + pathSet.add(pathToItem) + return arg } - protected Boolean castToAllowedTypes(Boolean arg, List pathToItem, Set> pathSet) { - pathSet.add(pathToItem); - return arg; + protected fun castToAllowedTypes(arg: Boolean, pathToItem: List?, pathSet: MutableSet?>): Boolean { + pathSet.add(pathToItem) + return arg } - protected Number castToAllowedTypes(Number arg, List pathToItem, Set> pathSet) { - pathSet.add(pathToItem); - return arg; + protected fun castToAllowedTypes(arg: Number, pathToItem: List?, pathSet: MutableSet?>): Number { + pathSet.add(pathToItem) + return arg } - protected Nothing? castToAllowedTypes(Nothing? arg, List pathToItem, Set> pathSet) { - pathSet.add(pathToItem); - return arg; + protected fun castToAllowedTypes(arg: Void?, pathToItem: List?, pathSet: MutableSet?>): Void? { + pathSet.add(pathToItem) + return arg } - protected List castToAllowedTypes(List arg, List pathToItem, Set> pathSet) throws ValidationException { - pathSet.add(pathToItem); - List<@Nullable Object> argFixed = new ArrayList<>(); - int i =0; - for (Object item: arg) { - List newPathToItem = new ArrayList<>(pathToItem); - newPathToItem.add(i); - Object fixedVal = castToAllowedObjectTypes(item, newPathToItem, pathSet); - argFixed.add(fixedVal); - i += 1; - } - return argFixed; + @Throws(ValidationException::class) + protected fun castToAllowedTypes(arg: List<*>, pathToItem: List?, pathSet: MutableSet?>): List<*> { + pathSet.add(pathToItem) + val argFixed: MutableList = ArrayList() + var i = 0 + for (item in arg) { + val newPathToItem: MutableList = ArrayList(pathToItem) + newPathToItem.add(i) + val fixedVal = castToAllowedObjectTypes(item, newPathToItem, pathSet) + argFixed.add(fixedVal) + i += 1 + } + return argFixed } - 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 ValidationException("Invalid non-string key value"); + @Throws(ValidationException::class) + protected fun castToAllowedTypes( + arg: Map<*, *>, + pathToItem: List?, + pathSet: MutableSet?> + ): Map<*, *> { + pathSet.add(pathToItem) + val argFixed = LinkedHashMap() + for ((entryKey, value) in arg) { + if (entryKey !is String) { + throw ValidationException("Invalid non-string key value") } - Object val = entry.getValue(); - List newPathToItem = new ArrayList<>(pathToItem); - newPathToItem.add(key); - Object fixedVal = castToAllowedObjectTypes(val, newPathToItem, pathSet); - argFixed.put(key, fixedVal); + val `val` = value!! + val newPathToItem: MutableList = ArrayList(pathToItem) + newPathToItem.add(entryKey) + val fixedVal = castToAllowedObjectTypes(`val`, newPathToItem, pathSet) + argFixed[entryKey] = fixedVal } - return argFixed; + return argFixed } - private @Nullable Object castToAllowedObjectTypes(@Nullable Object arg, List pathToItem, Set> pathSet) throws ValidationException { - if (arg == null) { - return castToAllowedTypes((Nothing?) null, pathToItem, pathSet); - } else if (arg instanceof String) { - return castToAllowedTypes((String) arg, pathToItem, pathSet); - } else if (arg instanceof Map) { - pathSet.add(pathToItem); - return castToAllowedTypes((Map) arg, pathToItem, pathSet); - } else if (arg instanceof Boolean) { - return castToAllowedTypes((Boolean) arg, pathToItem, pathSet); - } else if (arg instanceof Integer) { - return castToAllowedTypes((Number) arg, pathToItem, pathSet); - } else if (arg instanceof Long) { - return castToAllowedTypes((Number) arg, pathToItem, pathSet); - } else if (arg instanceof Float) { - return castToAllowedTypes((Number) arg, pathToItem, pathSet); - } else if (arg instanceof Double) { - return castToAllowedTypes((Number) arg, pathToItem, pathSet); - } else if (arg instanceof List) { - return castToAllowedTypes((List) arg, pathToItem, pathSet); - } else if (arg instanceof ZonedDateTime) { - return castToAllowedTypes(arg.toString(), pathToItem, pathSet); - } else if (arg instanceof LocalDate) { - return castToAllowedTypes(arg.toString(), pathToItem, pathSet); - } else if (arg instanceof UUID) { - return castToAllowedTypes(arg.toString(), pathToItem, pathSet); + @Throws(ValidationException::class) + private fun castToAllowedObjectTypes(arg: Any?, pathToItem: List, pathSet: MutableSet?>): Any? { + return if (arg == null) { + castToAllowedTypes(null as Void?, pathToItem, pathSet) + } else if (arg is String) { + castToAllowedTypes(arg, pathToItem, pathSet) + } else if (arg is Map<*, *>) { + pathSet.add(pathToItem) + castToAllowedTypes(arg, pathToItem, pathSet) + } else if (arg is Boolean) { + castToAllowedTypes(arg, pathToItem, pathSet) + } else if (arg is Int) { + castToAllowedTypes(arg as Number, pathToItem, pathSet) + } else if (arg is Long) { + castToAllowedTypes(arg as Number, pathToItem, pathSet) + } else if (arg is Float) { + castToAllowedTypes(arg as Number, pathToItem, pathSet) + } else if (arg is Double) { + castToAllowedTypes(arg as Number, pathToItem, pathSet) + } else if (arg is List<*>) { + castToAllowedTypes(arg, pathToItem, pathSet) + } else if (arg is ZonedDateTime) { + castToAllowedTypes(arg.toString(), pathToItem, pathSet) + } else if (arg is LocalDate) { + castToAllowedTypes(arg.toString(), pathToItem, pathSet) + } else if (arg is UUID) { + castToAllowedTypes(arg.toString(), pathToItem, pathSet) } else { - Class argClass = arg.getClass(); - throw new ValidationException("Invalid type passed in for input="+arg+" type="+argClass); + val argClass: Class<*> = arg.javaClass + throw ValidationException("Invalid type passed in for input=$arg type=$argClass") } } - public Nothing? getNewInstance(Nothing? arg, List pathToItem, PathToSchemasMap pathToSchemas) { - return arg; + fun getNewInstance(arg: Void, pathToItem: List?, pathToSchemas: PathToSchemasMap?): Void { + return arg } - public boolean getNewInstance(boolean arg, List pathToItem, PathToSchemasMap pathToSchemas) { - return arg; + fun getNewInstance(arg: Boolean, pathToItem: List?, pathToSchemas: PathToSchemasMap?): Boolean { + return arg } - public Number getNewInstance(Number arg, List pathToItem, PathToSchemasMap pathToSchemas) { - return arg; + fun getNewInstance(arg: Number, pathToItem: List?, pathToSchemas: PathToSchemasMap?): Number { + return arg } - public String getNewInstance(String arg, List pathToItem, PathToSchemasMap pathToSchemas) { - return arg; + fun getNewInstance(arg: String, pathToItem: List?, pathToSchemas: PathToSchemasMap?): String { + return arg } - 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); - pathToSchemasMap.update(otherPathToSchemas); - for (var schemas: pathToSchemasMap.values()) { - JsonSchema firstSchema = schemas.entrySet().iterator().next().getKey(); - schemas.clear(); - schemas.put(firstSchema, null); - } - pathSet.removeAll(pathToSchemasMap.keySet()); - if (!pathSet.isEmpty()) { - LinkedHashMap, Nothing?> unsetAnyTypeSchema = new LinkedHashMap<>(); - unsetAnyTypeSchema.put(UnsetAnyTypeJsonSchema.UnsetAnyTypeJsonSchema1.getInstance(), null); - for (List pathToItem: pathSet) { - pathToSchemasMap.put(pathToItem, unsetAnyTypeSchema); + companion object { + @Throws(ValidationException::class) + fun validate( + jsonSchema: JsonSchema<*>, + arg: Any?, + validationMetadata: ValidationMetadata + ): PathToSchemasMap { + val disabledKeywords: LinkedHashSet = + validationMetadata.configuration.disabledKeywordFlags.keywords + val pathToSchemas = PathToSchemasMap() + val thisKeywordToValidator = jsonSchema.keywordToValidator + var containsPathToSchemas: List? = null + if (thisKeywordToValidator.containsKey("contains")) { + containsPathToSchemas = jsonSchema.getContainsPathToSchemas(arg, validationMetadata) + } + var patternPropertiesPathToSchemas: PathToSchemasMap? = null + if (thisKeywordToValidator.containsKey("patternProperties")) { + patternPropertiesPathToSchemas = jsonSchema.getPatternPropertiesPathToSchemas(arg, validationMetadata) } + var ifPathToSchemas: PathToSchemasMap? = null + if (thisKeywordToValidator.containsKey("if")) { + ifPathToSchemas = jsonSchema.getIfPathToSchemas(arg, validationMetadata) + } + var knownPathToSchemas: PathToSchemasMap? = null + for ((jsonKeyword, validator) in thisKeywordToValidator) { + if (disabledKeywords.contains(jsonKeyword)) { + val typeIntegerUseCase = jsonKeyword == "format" && "int" == jsonSchema.format + if (!typeIntegerUseCase) { + continue + } + } + if ("unevaluatedItems" == jsonKeyword || "unevaluatedProperties" == jsonKeyword) { + knownPathToSchemas = pathToSchemas + } + val data = ValidationData( + jsonSchema, + arg, + validationMetadata, + containsPathToSchemas, + patternPropertiesPathToSchemas, + ifPathToSchemas, + knownPathToSchemas + ) + val otherPathToSchemas = validator.validate(data) ?: continue + pathToSchemas.update(otherPathToSchemas) + } + val pathToItem: List = validationMetadata.pathToItem + if (!pathToSchemas.containsKey(pathToItem)) { + pathToSchemas[validationMetadata.pathToItem] = LinkedHashMap() + } + val schemas: LinkedHashMap, Nothing?>? = pathToSchemas[pathToItem] + if (schemas != null) { + schemas[jsonSchema] = null + } + return pathToSchemas } - return pathToSchemasMap; - } - public static String getClass(@Nullable Object arg) { - if (arg == null) { - return Nothing?.class.getSimpleName(); - } else { - return arg.getClass().getSimpleName(); + @Throws(ValidationException::class) + protected fun getPathToSchemas( + jsonSchema: JsonSchema<*>, + arg: Any?, + validationMetadata: ValidationMetadata, + pathSet: Set> + ): PathToSchemasMap { + val pathToSchemasMap = PathToSchemasMap() + // todo add check of validationMetadata.validationRanEarlier(this) + val otherPathToSchemas = validate(jsonSchema, arg, validationMetadata) + pathToSchemasMap.update(otherPathToSchemas) + for (schemas in pathToSchemasMap.values) { + val firstSchema: JsonSchema<*> = schemas!!.entries.iterator().next().key!! + schemas.clear() + schemas[firstSchema] = null + } + var mutPathSet: MutableSet> = pathSet.toMutableSet() + mutPathSet.removeAll(pathToSchemasMap.keys) + if (!mutPathSet.isEmpty()) { + val unsetAnyTypeSchema = LinkedHashMap, Nothing?>() + unsetAnyTypeSchema[UnsetAnyTypeJsonSchema.UnsetAnyTypeJsonSchema1.getInstance()] = null + for (pathToItem in mutPathSet) { + pathToSchemasMap[pathToItem] = unsetAnyTypeSchema + } + } + return pathToSchemasMap } + + fun getClass(arg: Any?): String { + return if (arg == null) { + Void::class.java.getSimpleName() + } else { + arg.javaClass.getSimpleName() + } + } // todo add bytes and FileIO } - // todo add bytes and FileIO } \ No newline at end of file diff --git a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/schemas/validation/JsonSchemaFactory.kt b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/schemas/validation/JsonSchemaFactory.kt index 24729ac172d..8dcc3d416c3 100644 --- a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/schemas/validation/JsonSchemaFactory.kt +++ b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/schemas/validation/JsonSchemaFactory.kt @@ -1,32 +1,29 @@ -package org.openapijsonschematools.client.schemas.validation; +package org.openapijsonschematools.client.schemas.validation -import org.checkerframework.checker.nullness.qual.NonNull; -import org.checkerframework.checker.nullness.qual.Nullable; +import java.lang.reflect.InvocationTargetException -import java.lang.reflect.InvocationTargetException; -import java.lang.reflect.Method; -import java.util.HashMap; -import java.util.Map; +object JsonSchemaFactory { + private var classToInstance: MutableMap>, JsonSchema<*>> = HashMap() - -public class JsonSchemaFactory { - static Map>, JsonSchema> classToInstance = new HashMap<>(); - - public static > V getInstance(Class schemaCls) { - @Nullable JsonSchema cacheInst = classToInstance.get(schemaCls); - if (cacheInst != null) { - assert schemaCls.isInstance(cacheInst); - return schemaCls.cast(cacheInst); + fun > getInstance(schemaCls: Class): V { + val cacheInst: JsonSchema<*>? = classToInstance[schemaCls] + cacheInst?.let { + assert(schemaCls.isInstance(it)) + return schemaCls.cast(it) } try { - Method method = schemaCls.getMethod("getInstance"); - @SuppressWarnings("nullness") @NonNull Object obj = method.invoke(null); - assert schemaCls.isInstance(obj); - V inst = schemaCls.cast(obj); - classToInstance.put(schemaCls, inst); - return inst; - } catch (NoSuchMethodException | IllegalAccessException | InvocationTargetException e) { - throw new RuntimeException(e); + val method = schemaCls.getMethod("getInstance") + val obj = method.invoke(null) + assert(schemaCls.isInstance(obj)) + val inst = schemaCls.cast(obj) + classToInstance[schemaCls] = inst + return inst + } catch (e: NoSuchMethodException) { + throw RuntimeException(e) + } catch (e: IllegalAccessException) { + throw RuntimeException(e) + } catch (e: InvocationTargetException) { + throw RuntimeException(e) } } } \ No newline at end of file diff --git a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/schemas/validation/JsonSchemaInfo.kt b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/schemas/validation/JsonSchemaInfo.kt index 0a95fbbae6a..865401ff096 100644 --- a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/schemas/validation/JsonSchemaInfo.kt +++ b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/schemas/validation/JsonSchemaInfo.kt @@ -1,210 +1,244 @@ -package org.openapijsonschematools.client.schemas.validation; -import org.checkerframework.checker.nullness.qual.Nullable; - -import java.math.BigDecimal; -import java.util.List; -import java.util.Map; -import java.util.Set; -import java.util.regex.Pattern; - -public class JsonSchemaInfo { - public @Nullable Set> type = null; - public JsonSchemaInfo type(Set> type) { - this.type = type; - return this; - } - public @Nullable String format = null; - public JsonSchemaInfo format(String format) { - this.format = format; - return this; - } - public @Nullable Class> items = null; - public JsonSchemaInfo items(Class> items) { - this.items = items; - return this; - } - public @Nullable Map>> properties = null; - public JsonSchemaInfo properties(Map>> properties) { - this.properties = properties; - return this; - } - public @Nullable Set required = null; - public JsonSchemaInfo required(Set required) { - this.required = required; - return this; - } - public @Nullable Number exclusiveMaximum = null; - public JsonSchemaInfo exclusiveMaximum(Number exclusiveMaximum) { - this.exclusiveMaximum = exclusiveMaximum; - return this; - } - public @Nullable Number exclusiveMinimum = null; - public JsonSchemaInfo exclusiveMinimum(Number exclusiveMinimum) { - this.exclusiveMinimum = exclusiveMinimum; - return this; - } - public @Nullable Integer maxItems = null; - public JsonSchemaInfo maxItems(Integer maxItems) { - this.maxItems = maxItems; - return this; - } - public @Nullable Integer minItems = null; - public JsonSchemaInfo minItems(Integer minItems) { - this.minItems = minItems; - return this; - } - public @Nullable Integer maxLength = null; - public JsonSchemaInfo maxLength(Integer maxLength) { - this.maxLength = maxLength; - return this; - } - public @Nullable Integer minLength = null; - public JsonSchemaInfo minLength(Integer minLength) { - this.minLength = minLength; - return this; - } - public @Nullable Integer maxProperties = null; - public JsonSchemaInfo maxProperties(Integer maxProperties) { - this.maxProperties = maxProperties; - return this; - } - public @Nullable Integer minProperties = null; - public JsonSchemaInfo minProperties(Integer minProperties) { - this.minProperties = minProperties; - return this; - } - public @Nullable Number maximum = null; - public JsonSchemaInfo maximum(Number maximum) { - this.maximum = maximum; - return this; - } - public @Nullable Number minimum = null; - public JsonSchemaInfo minimum(Number minimum) { - this.minimum = minimum; - return this; - } - public @Nullable BigDecimal multipleOf = null; - public JsonSchemaInfo multipleOf(BigDecimal multipleOf) { - this.multipleOf = multipleOf; - return this; - } - public @Nullable Class> additionalProperties; - public JsonSchemaInfo additionalProperties(Class> additionalProperties) { - this.additionalProperties = additionalProperties; - return this; - } - public @Nullable List>> allOf = null; - public JsonSchemaInfo allOf(List>> allOf) { - this.allOf = allOf; - return this; - } - public @Nullable List>> anyOf = null; - public JsonSchemaInfo anyOf(List>> anyOf) { - this.anyOf = anyOf; - return this; - } - public @Nullable List>> oneOf = null; - public JsonSchemaInfo oneOf(List>> oneOf) { - this.oneOf = oneOf; - return this; - } - public @Nullable Class> not = null; - public JsonSchemaInfo not(Class> not) { - this.not = not; - return this; - } - public @Nullable Boolean uniqueItems = null; - public JsonSchemaInfo uniqueItems(Boolean uniqueItems) { - this.uniqueItems = uniqueItems; - return this; - } - public @Nullable Set<@Nullable Object> enumValues = null; - public JsonSchemaInfo enumValues(Set<@Nullable Object> enumValues) { - this.enumValues = enumValues; - return this; - } - public @Nullable Pattern pattern = null; - public JsonSchemaInfo pattern(Pattern pattern) { - this.pattern = pattern; - return this; - } - public @Nullable Object defaultValue = null; - public boolean defaultValueSet = false; - public JsonSchemaInfo defaultValue(@Nullable Object defaultValue) { - this.defaultValue = defaultValue; - this.defaultValueSet = true; - return this; - } - public @Nullable Object constValue = null; - public boolean constValueSet = false; - public JsonSchemaInfo constValue(@Nullable Object constValue) { - this.constValue = constValue; - this.constValueSet = true; - return this; - } - public @Nullable Class> contains = null; - public JsonSchemaInfo contains(Class> contains) { - this.contains = contains; - return this; - } - public @Nullable Integer maxContains = null; - public JsonSchemaInfo maxContains(Integer maxContains) { - this.maxContains = maxContains; - return this; - } - public @Nullable Integer minContains = null; - public JsonSchemaInfo minContains(Integer minContains) { - this.minContains = minContains; - return this; - } - public @Nullable Class> propertyNames = null; - public JsonSchemaInfo propertyNames(Class> propertyNames) { - this.propertyNames = propertyNames; - return this; - } - public @Nullable Map> dependentRequired = null; - public JsonSchemaInfo dependentRequired(Map> dependentRequired) { - this.dependentRequired = dependentRequired; - return this; - } - public @Nullable Map>> dependentSchemas = null; - public JsonSchemaInfo dependentSchemas(Map>> dependentSchemas) { - this.dependentSchemas = dependentSchemas; - return this; - } - public @Nullable Map>> patternProperties = null; - public JsonSchemaInfo patternProperties(Map>> patternProperties) { - this.patternProperties = patternProperties; - return this; - } - public @Nullable List>> prefixItems = null; - public JsonSchemaInfo prefixItems(List>> prefixItems) { - this.prefixItems = prefixItems; - return this; - } - public @Nullable Class> ifSchema = null; - public JsonSchemaInfo ifSchema(Class> ifSchema) { - this.ifSchema = ifSchema; - return this; - } - public @Nullable Class> then = null; - public JsonSchemaInfo then(Class> then) { - this.then = then; - return this; - } - public @Nullable Class> elseSchema = null; - public JsonSchemaInfo elseSchema(Class> elseSchema) { - this.elseSchema = elseSchema; - return this; - } - public @Nullable Class> unevaluatedItems = null; - public JsonSchemaInfo unevaluatedItems(Class> unevaluatedItems) { - this.unevaluatedItems = unevaluatedItems; - return this; - } - public @Nullable Class> unevaluatedProperties = null; - public JsonSchemaInfo unevaluatedProperties(Class> unevaluatedProperties) { - this.unevaluatedProperties = unevaluatedProperties; - return this; +package org.openapijsonschematools.client.schemas.validation + +import java.math.BigDecimal +import java.util.regex.Pattern + +class JsonSchemaInfo { + var type: Set>? = null + fun type(type: Set>?): JsonSchemaInfo { + this.type = type + return this + } + + var format: String? = null + fun format(format: String?): JsonSchemaInfo { + this.format = format + return this + } + + var items: Class?>? = null + fun items(items: Class?>?): JsonSchemaInfo { + this.items = items + return this + } + + var properties: Map?>>? = null + fun properties(properties: Map?>>?): JsonSchemaInfo { + this.properties = properties + return this + } + + var required: Set? = null + fun required(required: Set?): JsonSchemaInfo { + this.required = required + return this + } + + var exclusiveMaximum: Number? = null + fun exclusiveMaximum(exclusiveMaximum: Number?): JsonSchemaInfo { + this.exclusiveMaximum = exclusiveMaximum + return this + } + + var exclusiveMinimum: Number? = null + fun exclusiveMinimum(exclusiveMinimum: Number?): JsonSchemaInfo { + this.exclusiveMinimum = exclusiveMinimum + return this + } + + var maxItems: Int? = null + fun maxItems(maxItems: Int?): JsonSchemaInfo { + this.maxItems = maxItems + return this + } + + var minItems: Int? = null + fun minItems(minItems: Int?): JsonSchemaInfo { + this.minItems = minItems + return this + } + + var maxLength: Int? = null + fun maxLength(maxLength: Int?): JsonSchemaInfo { + this.maxLength = maxLength + return this + } + + var minLength: Int? = null + fun minLength(minLength: Int?): JsonSchemaInfo { + this.minLength = minLength + return this + } + + var maxProperties: Int? = null + fun maxProperties(maxProperties: Int?): JsonSchemaInfo { + this.maxProperties = maxProperties + return this + } + + var minProperties: Int? = null + fun minProperties(minProperties: Int?): JsonSchemaInfo { + this.minProperties = minProperties + return this + } + + var maximum: Number? = null + fun maximum(maximum: Number?): JsonSchemaInfo { + this.maximum = maximum + return this + } + + var minimum: Number? = null + fun minimum(minimum: Number?): JsonSchemaInfo { + this.minimum = minimum + return this + } + + var multipleOf: BigDecimal? = null + fun multipleOf(multipleOf: BigDecimal?): JsonSchemaInfo { + this.multipleOf = multipleOf + return this + } + + var additionalProperties: Class?>? = null + fun additionalProperties(additionalProperties: Class?>?): JsonSchemaInfo { + this.additionalProperties = additionalProperties + return this + } + + var allOf: List?>>? = null + fun allOf(allOf: List?>>?): JsonSchemaInfo { + this.allOf = allOf + return this + } + + var anyOf: List?>>? = null + fun anyOf(anyOf: List?>>?): JsonSchemaInfo { + this.anyOf = anyOf + return this + } + + var oneOf: List?>>? = null + fun oneOf(oneOf: List?>>?): JsonSchemaInfo { + this.oneOf = oneOf + return this + } + + var not: Class?>? = null + fun not(not: Class?>?): JsonSchemaInfo { + this.not = not + return this + } + + var uniqueItems: Boolean? = null + fun uniqueItems(uniqueItems: Boolean?): JsonSchemaInfo { + this.uniqueItems = uniqueItems + return this + } + + var enumValues: Set? = null + fun enumValues(enumValues: Set?): JsonSchemaInfo { + this.enumValues = enumValues + return this + } + + var pattern: Pattern? = null + fun pattern(pattern: Pattern?): JsonSchemaInfo { + this.pattern = pattern + return this + } + + var defaultValue: Any? = null + var defaultValueSet = false + fun defaultValue(defaultValue: Any?): JsonSchemaInfo { + this.defaultValue = defaultValue + defaultValueSet = true + return this + } + + var constValue: Any? = null + var constValueSet = false + fun constValue(constValue: Any?): JsonSchemaInfo { + this.constValue = constValue + constValueSet = true + return this + } + + var contains: Class?>? = null + fun contains(contains: Class?>?): JsonSchemaInfo { + this.contains = contains + return this + } + + var maxContains: Int? = null + fun maxContains(maxContains: Int?): JsonSchemaInfo { + this.maxContains = maxContains + return this + } + + var minContains: Int? = null + fun minContains(minContains: Int?): JsonSchemaInfo { + this.minContains = minContains + return this + } + + var propertyNames: Class?>? = null + fun propertyNames(propertyNames: Class?>?): JsonSchemaInfo { + this.propertyNames = propertyNames + return this + } + + var dependentRequired: Map>? = null + fun dependentRequired(dependentRequired: Map>?): JsonSchemaInfo { + this.dependentRequired = dependentRequired + return this + } + + var dependentSchemas: Map?>>? = null + fun dependentSchemas(dependentSchemas: Map?>>?): JsonSchemaInfo { + this.dependentSchemas = dependentSchemas + return this + } + + var patternProperties: Map?>>? = null + fun patternProperties(patternProperties: Map?>>?): JsonSchemaInfo { + this.patternProperties = patternProperties + return this + } + + var prefixItems: List?>>? = null + fun prefixItems(prefixItems: List?>>?): JsonSchemaInfo { + this.prefixItems = prefixItems + return this + } + + var ifSchema: Class?>? = null + fun ifSchema(ifSchema: Class?>?): JsonSchemaInfo { + this.ifSchema = ifSchema + return this + } + + var then: Class?>? = null + fun then(then: Class?>?): JsonSchemaInfo { + this.then = then + return this + } + + var elseSchema: Class?>? = null + fun elseSchema(elseSchema: Class?>?): JsonSchemaInfo { + this.elseSchema = elseSchema + return this + } + + var unevaluatedItems: Class?>? = null + fun unevaluatedItems(unevaluatedItems: Class?>?): JsonSchemaInfo { + this.unevaluatedItems = unevaluatedItems + return this + } + + var unevaluatedProperties: Class?>? = null + fun unevaluatedProperties(unevaluatedProperties: Class?>?): JsonSchemaInfo { + this.unevaluatedProperties = unevaluatedProperties + return this } } \ No newline at end of file diff --git a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/schemas/validation/KeywordValidator.kt b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/schemas/validation/KeywordValidator.kt index 744a8cb6c0a..c707681f8bf 100644 --- a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/schemas/validation/KeywordValidator.kt +++ b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/schemas/validation/KeywordValidator.kt @@ -5,6 +5,6 @@ import org.openapijsonschematools.client.exceptions.ValidationException fun interface KeywordValidator { @Throws(ValidationException::class) fun validate( - data: ValidationData? + data: ValidationData ): PathToSchemasMap? } \ No newline at end of file diff --git a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/schemas/validation/PathToSchemasMap.kt b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/schemas/validation/PathToSchemasMap.kt index 12bcd3a0a09..61d124a2a43 100644 --- a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/schemas/validation/PathToSchemasMap.kt +++ b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/schemas/validation/PathToSchemasMap.kt @@ -1,10 +1,10 @@ package org.openapijsonschematools.client.schemas.validation -class PathToSchemasMap : LinkedHashMap?, LinkedHashMap?, Nothing?>?>() { +class PathToSchemasMap : LinkedHashMap, LinkedHashMap, Nothing?>>() { fun update(other: PathToSchemasMap) { for ((pathToItem, otherSchemas) in other) { if (containsKey(pathToItem)) { - get(pathToItem)!!.putAll(otherSchemas!!) + get(pathToItem)!!.putAll(otherSchemas) } else { put(pathToItem, otherSchemas) } 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 840cbdaede2..7afb4d72329 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,499 +1,502 @@ package {{{packageName}}}.schemas.validation; -import org.checkerframework.checker.nullness.qual.Nullable; import {{{packageName}}}.configurations.SchemaConfiguration; import {{{packageName}}}.exceptions.ValidationException; -import java.math.BigDecimal; -import java.time.LocalDate; -import java.time.ZonedDateTime; -import java.util.ArrayList; -import java.util.LinkedHashMap; -import java.util.LinkedHashSet; -import java.util.List; -import java.util.Map; -import java.util.Set; -import java.util.UUID; -import java.util.regex.Pattern; +import java.math.BigDecimal +import java.time.LocalDate +import java.time.ZonedDateTime +import java.util.regex.Pattern +import java.util.UUID -public abstract class JsonSchema { - public final @Nullable Set> type; - public final @Nullable String format; - public final @Nullable Class> items; - public final @Nullable Map>> properties; - public final @Nullable Set required; - public final @Nullable Number exclusiveMaximum; - public final @Nullable Number exclusiveMinimum; - public final @Nullable Integer maxItems; - public final @Nullable Integer minItems; - public final @Nullable Integer maxLength; - public final @Nullable Integer minLength; - public final @Nullable Integer maxProperties; - public final @Nullable Integer minProperties; - public final @Nullable Number maximum; - public final @Nullable Number minimum; - public final @Nullable BigDecimal multipleOf; - public final @Nullable Class> additionalProperties; - public final @Nullable List>> allOf; - public final @Nullable List>> anyOf; - public final @Nullable List>> oneOf; - public final @Nullable Class> not; - public final @Nullable Boolean uniqueItems; - public final @Nullable Set<@Nullable Object> enumValues; - public final @Nullable Pattern pattern; - public final @Nullable Object defaultValue; - public final boolean defaultValueSet; - public final @Nullable Object constValue; - public final boolean constValueSet; - public final @Nullable Class> contains; - public final @Nullable Integer maxContains; - public final @Nullable Integer minContains; - public final @Nullable Class> propertyNames; - public final @Nullable Map> dependentRequired; - public final @Nullable Map>> dependentSchemas; - public final @Nullable Map>> patternProperties; - public final @Nullable List>> prefixItems; - public final @Nullable Class> ifSchema; - public final @Nullable Class> then; - public final @Nullable Class> elseSchema; - public final @Nullable Class> unevaluatedItems; - public final @Nullable Class> unevaluatedProperties; - private final LinkedHashMap keywordToValidator; +abstract class JsonSchema protected constructor(jsonSchemaInfo: JsonSchemaInfo) { + val type: Set>? + val format: String? + val items: Class?>? + val properties: Map?>>? + val required: Set? + val exclusiveMaximum: Number? + val exclusiveMinimum: Number? + val maxItems: Int? + val minItems: Int? + val maxLength: Int? + val minLength: Int? + val maxProperties: Int? + val minProperties: Int? + val maximum: Number? + val minimum: Number? + val multipleOf: BigDecimal? + val additionalProperties: Class?>? + val allOf: List?>>? + val anyOf: List?>>? + val oneOf: List?>>? + val not: Class?>? + val uniqueItems: Boolean? + val enumValues: Set? + val pattern: Pattern? + val defaultValue: Any? + val defaultValueSet: Boolean + val constValue: Any? + val constValueSet: Boolean + val contains: Class?>? + val maxContains: Int? + val minContains: Int? + val propertyNames: Class?>? + val dependentRequired: Map>? + val dependentSchemas: Map?>>? + val patternProperties: Map?>>? + val prefixItems: List?>>? + val ifSchema: Class?>? + val then: Class?>? + val elseSchema: Class?>? + val unevaluatedItems: Class?>? + val unevaluatedProperties: Class?>? + private val keywordToValidator: LinkedHashMap - protected JsonSchema(JsonSchemaInfo jsonSchemaInfo) { - LinkedHashMap keywordToValidator = new LinkedHashMap<>(); - this.type = jsonSchemaInfo.type; - if (this.type != null) { - keywordToValidator.put("type", new TypeValidator()); - } - this.format = jsonSchemaInfo.format; - if (this.format != null) { - keywordToValidator.put("format", new FormatValidator()); - } - this.items = jsonSchemaInfo.items; - if (this.items != null) { - keywordToValidator.put("items", new ItemsValidator()); - } - this.properties = jsonSchemaInfo.properties; - if (this.properties != null) { - keywordToValidator.put("properties", new PropertiesValidator()); - } - this.required = jsonSchemaInfo.required; - if (this.required != null) { - keywordToValidator.put("required", new RequiredValidator()); - } - this.exclusiveMaximum = jsonSchemaInfo.exclusiveMaximum; - if (this.exclusiveMaximum != null) { - keywordToValidator.put("exclusiveMaximum", new ExclusiveMaximumValidator()); - } - this.exclusiveMinimum = jsonSchemaInfo.exclusiveMinimum; - if (this.exclusiveMinimum != null) { - keywordToValidator.put("exclusiveMinimum", new ExclusiveMinimumValidator()); - } - this.maxItems = jsonSchemaInfo.maxItems; - if (this.maxItems != null) { - keywordToValidator.put("maxItems", new MaxItemsValidator()); - } - this.minItems = jsonSchemaInfo.minItems; - if (this.minItems != null) { - keywordToValidator.put("minItems", new MinItemsValidator()); - } - this.maxLength = jsonSchemaInfo.maxLength; - if (this.maxLength != null) { - keywordToValidator.put("maxLength", new MaxLengthValidator()); - } - this.minLength = jsonSchemaInfo.minLength; - if (this.minLength != null) { - keywordToValidator.put("minLength", new MinLengthValidator()); - } - this.maxProperties = jsonSchemaInfo.maxProperties; - if (this.maxProperties != null) { - keywordToValidator.put("maxProperties", new MaxPropertiesValidator()); - } - this.minProperties = jsonSchemaInfo.minProperties; - if (this.minProperties != null) { - keywordToValidator.put("minProperties", new MinPropertiesValidator()); - } - this.maximum = jsonSchemaInfo.maximum; - if (this.maximum != null) { - keywordToValidator.put("maximum", new MaximumValidator()); - } - this.minimum = jsonSchemaInfo.minimum; - if (this.minimum != null) { - keywordToValidator.put("minimum", new MinimumValidator()); - } - this.multipleOf = jsonSchemaInfo.multipleOf; - if (this.multipleOf != null) { - keywordToValidator.put("multipleOf", new MultipleOfValidator()); - } - this.additionalProperties = jsonSchemaInfo.additionalProperties; - if (this.additionalProperties != null) { - keywordToValidator.put("additionalProperties", new AdditionalPropertiesValidator()); - } - this.allOf = jsonSchemaInfo.allOf; - if (this.allOf != null) { - keywordToValidator.put("allOf", new AllOfValidator()); - } - this.anyOf = jsonSchemaInfo.anyOf; - if (this.anyOf != null) { - keywordToValidator.put("anyOf", new AnyOfValidator()); - } - this.oneOf = jsonSchemaInfo.oneOf; - if (this.oneOf != null) { - keywordToValidator.put("oneOf", new OneOfValidator()); - } - this.not = jsonSchemaInfo.not; - if (this.not != null) { - keywordToValidator.put("not", new NotValidator()); - } - this.uniqueItems = jsonSchemaInfo.uniqueItems; - if (this.uniqueItems != null) { - keywordToValidator.put("uniqueItems", new UniqueItemsValidator()); - } - this.enumValues = jsonSchemaInfo.enumValues; - if (this.enumValues != null) { - keywordToValidator.put("enum", new EnumValidator()); - } - this.pattern = jsonSchemaInfo.pattern; - if (this.pattern != null) { - keywordToValidator.put("pattern", new PatternValidator()); - } - this.defaultValue = jsonSchemaInfo.defaultValue; - this.defaultValueSet = jsonSchemaInfo.defaultValueSet; - this.constValue = jsonSchemaInfo.constValue; - this.constValueSet = jsonSchemaInfo.constValueSet; - if (this.constValueSet) { - keywordToValidator.put("const", new ConstValidator()); + init { + val keywordToValidator = LinkedHashMap() + type = jsonSchemaInfo.type + if (type != null) { + keywordToValidator["type"] = TypeValidator() + } + format = jsonSchemaInfo.format + if (format != null) { + keywordToValidator["format"] = FormatValidator() + } + items = jsonSchemaInfo.items + if (items != null) { + keywordToValidator["items"] = ItemsValidator() + } + properties = jsonSchemaInfo.properties + if (properties != null) { + keywordToValidator["properties"] = PropertiesValidator() + } + required = jsonSchemaInfo.required + if (required != null) { + keywordToValidator["required"] = RequiredValidator() + } + exclusiveMaximum = jsonSchemaInfo.exclusiveMaximum + if (exclusiveMaximum != null) { + keywordToValidator["exclusiveMaximum"] = ExclusiveMaximumValidator() + } + exclusiveMinimum = jsonSchemaInfo.exclusiveMinimum + if (exclusiveMinimum != null) { + keywordToValidator["exclusiveMinimum"] = ExclusiveMinimumValidator() + } + maxItems = jsonSchemaInfo.maxItems + if (maxItems != null) { + keywordToValidator["maxItems"] = MaxItemsValidator() + } + minItems = jsonSchemaInfo.minItems + if (minItems != null) { + keywordToValidator["minItems"] = MinItemsValidator() + } + maxLength = jsonSchemaInfo.maxLength + if (maxLength != null) { + keywordToValidator["maxLength"] = MaxLengthValidator() + } + minLength = jsonSchemaInfo.minLength + if (minLength != null) { + keywordToValidator["minLength"] = MinLengthValidator() + } + maxProperties = jsonSchemaInfo.maxProperties + if (maxProperties != null) { + keywordToValidator["maxProperties"] = MaxPropertiesValidator() + } + minProperties = jsonSchemaInfo.minProperties + if (minProperties != null) { + keywordToValidator["minProperties"] = MinPropertiesValidator() + } + maximum = jsonSchemaInfo.maximum + if (maximum != null) { + keywordToValidator["maximum"] = MaximumValidator() + } + minimum = jsonSchemaInfo.minimum + if (minimum != null) { + keywordToValidator["minimum"] = MinimumValidator() + } + multipleOf = jsonSchemaInfo.multipleOf + if (multipleOf != null) { + keywordToValidator["multipleOf"] = MultipleOfValidator() + } + additionalProperties = jsonSchemaInfo.additionalProperties + if (additionalProperties != null) { + keywordToValidator["additionalProperties"] = AdditionalPropertiesValidator() + } + allOf = jsonSchemaInfo.allOf + if (allOf != null) { + keywordToValidator["allOf"] = AllOfValidator() + } + anyOf = jsonSchemaInfo.anyOf + if (anyOf != null) { + keywordToValidator["anyOf"] = AnyOfValidator() + } + oneOf = jsonSchemaInfo.oneOf + if (oneOf != null) { + keywordToValidator["oneOf"] = OneOfValidator() + } + not = jsonSchemaInfo.not + if (not != null) { + keywordToValidator["not"] = NotValidator() + } + uniqueItems = jsonSchemaInfo.uniqueItems + if (uniqueItems != null) { + keywordToValidator["uniqueItems"] = UniqueItemsValidator() + } + enumValues = jsonSchemaInfo.enumValues + if (enumValues != null) { + keywordToValidator["enum"] = EnumValidator() + } + pattern = jsonSchemaInfo.pattern + if (pattern != null) { + keywordToValidator["pattern"] = PatternValidator() + } + defaultValue = jsonSchemaInfo.defaultValue + defaultValueSet = jsonSchemaInfo.defaultValueSet + constValue = jsonSchemaInfo.constValue + constValueSet = jsonSchemaInfo.constValueSet + if (constValueSet) { + keywordToValidator["const"] = ConstValidator() } - this.contains = jsonSchemaInfo.contains; - if (this.contains != null) { - keywordToValidator.put("contains", new ContainsValidator()); + contains = jsonSchemaInfo.contains + if (contains != null) { + keywordToValidator["contains"] = ContainsValidator() } - this.maxContains = jsonSchemaInfo.maxContains; - if (this.maxContains != null) { - keywordToValidator.put("maxContains", new MaxContainsValidator()); + maxContains = jsonSchemaInfo.maxContains + if (maxContains != null) { + keywordToValidator["maxContains"] = MaxContainsValidator() } - this.minContains = jsonSchemaInfo.minContains; - if (this.minContains != null) { - keywordToValidator.put("minContains", new MinContainsValidator()); + minContains = jsonSchemaInfo.minContains + if (minContains != null) { + keywordToValidator["minContains"] = MinContainsValidator() } - this.propertyNames = jsonSchemaInfo.propertyNames; - if (this.propertyNames != null) { - keywordToValidator.put("propertyNames", new PropertyNamesValidator()); + propertyNames = jsonSchemaInfo.propertyNames + if (propertyNames != null) { + keywordToValidator["propertyNames"] = PropertyNamesValidator() } - this.dependentRequired = jsonSchemaInfo.dependentRequired; - if (this.dependentRequired != null) { - keywordToValidator.put("dependentRequired", new DependentRequiredValidator()); + dependentRequired = jsonSchemaInfo.dependentRequired + if (dependentRequired != null) { + keywordToValidator["dependentRequired"] = DependentRequiredValidator() } - this.dependentSchemas = jsonSchemaInfo.dependentSchemas; - if (this.dependentSchemas != null) { - keywordToValidator.put("dependentSchemas", new DependentSchemasValidator()); + dependentSchemas = jsonSchemaInfo.dependentSchemas + if (dependentSchemas != null) { + keywordToValidator["dependentSchemas"] = DependentSchemasValidator() } - this.patternProperties = jsonSchemaInfo.patternProperties; - if (this.patternProperties != null) { - keywordToValidator.put("patternProperties", new PatternPropertiesValidator()); + patternProperties = jsonSchemaInfo.patternProperties + if (patternProperties != null) { + keywordToValidator["patternProperties"] = PatternPropertiesValidator() } - this.prefixItems = jsonSchemaInfo.prefixItems; - if (this.prefixItems != null) { - keywordToValidator.put("prefixItems", new PrefixItemsValidator()); + prefixItems = jsonSchemaInfo.prefixItems + if (prefixItems != null) { + keywordToValidator["prefixItems"] = PrefixItemsValidator() } - this.ifSchema = jsonSchemaInfo.ifSchema; - if (this.ifSchema != null) { - keywordToValidator.put("if", new IfValidator()); + ifSchema = jsonSchemaInfo.ifSchema + if (ifSchema != null) { + keywordToValidator["if"] = IfValidator() } - this.then = jsonSchemaInfo.then; - if (this.then != null) { - keywordToValidator.put("then", new ThenValidator()); + then = jsonSchemaInfo.then + if (then != null) { + keywordToValidator["then"] = ThenValidator() } - this.elseSchema = jsonSchemaInfo.elseSchema; - if (this.elseSchema != null) { - keywordToValidator.put("else", new ElseValidator()); + elseSchema = jsonSchemaInfo.elseSchema + if (elseSchema != null) { + keywordToValidator["else"] = ElseValidator() } - this.unevaluatedItems = jsonSchemaInfo.unevaluatedItems; - if (this.unevaluatedItems != null) { - keywordToValidator.put("unevaluatedItems", new UnevaluatedItemsValidator()); + unevaluatedItems = jsonSchemaInfo.unevaluatedItems + if (unevaluatedItems != null) { + keywordToValidator["unevaluatedItems"] = UnevaluatedItemsValidator() } - this.unevaluatedProperties = jsonSchemaInfo.unevaluatedProperties; - if (this.unevaluatedProperties != null) { - keywordToValidator.put("unevaluatedProperties", new UnevaluatedPropertiesValidator()); + unevaluatedProperties = jsonSchemaInfo.unevaluatedProperties + if (unevaluatedProperties != null) { + keywordToValidator["unevaluatedProperties"] = UnevaluatedPropertiesValidator() } - this.keywordToValidator = keywordToValidator; + 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; - - private List getContainsPathToSchemas( - @Nullable Object arg, - ValidationMetadata validationMetadata - ) { - if (!(arg instanceof List listArg) || contains == null) { - return new ArrayList<>(); - } - JsonSchema containsSchema = JsonSchemaFactory.getInstance(contains); - @Nullable List containsPathToSchemas = new ArrayList<>(); - for(int i = 0; i < listArg.size(); i++) { - PathToSchemasMap thesePathToSchemas = new PathToSchemasMap(); - List itemPathToItem = new ArrayList<>(validationMetadata.pathToItem()); - itemPathToItem.add(i); - ValidationMetadata itemValidationMetadata = new ValidationMetadata( - itemPathToItem, - validationMetadata.configuration(), - validationMetadata.validatedPathToSchemas(), - validationMetadata.seenClasses() - ); + abstract fun getNewInstance(arg: Any?, pathToItem: List?, pathToSchemas: PathToSchemasMap?): Any? + @Throws(ValidationException::class) + abstract fun validate(arg: Any?, configuration: SchemaConfiguration?): Any? + @Throws(ValidationException::class) + abstract fun validateAndBox(arg: Any?, configuration: SchemaConfiguration?): T + private fun getContainsPathToSchemas( + arg: Any?, + validationMetadata: ValidationMetadata + ): List? { + if (arg !is List<*> || contains == null) { + return ArrayList() + } + val containsSchema: JsonSchema<*> = JsonSchemaFactory.getInstance(contains) + val containsPathToSchemas: MutableList = ArrayList() + for (i in arg.indices) { + val thesePathToSchemas = PathToSchemasMap() + val itemPathToItem: MutableList = ArrayList(validationMetadata.pathToItem) + itemPathToItem.add(i) + val itemValidationMetadata = ValidationMetadata( + itemPathToItem, + validationMetadata.configuration, + validationMetadata.validatedPathToSchemas, + validationMetadata.seenClasses + ) if (itemValidationMetadata.validationRanEarlier(containsSchema)) { // todo add_deeper_validated_schemas - containsPathToSchemas.add(thesePathToSchemas); - continue; + containsPathToSchemas.add(thesePathToSchemas) + continue } - try { - PathToSchemasMap otherPathToSchemas = JsonSchema.validate( - containsSchema, listArg.get(i), itemValidationMetadata); - containsPathToSchemas.add(otherPathToSchemas); - } catch (ValidationException ignored) {} + val otherPathToSchemas = validate( + containsSchema, arg[i], itemValidationMetadata + ) + containsPathToSchemas.add(otherPathToSchemas) + } catch (ignored: ValidationException) { + } } - return containsPathToSchemas; + return containsPathToSchemas } - private PathToSchemasMap getPatternPropertiesPathToSchemas( - @Nullable Object arg, - ValidationMetadata validationMetadata - ) throws ValidationException { - if (!(arg instanceof Map mapArg) || patternProperties == null) { - return new PathToSchemasMap(); - } - PathToSchemasMap pathToSchemas = new PathToSchemasMap(); - 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"); - } - List propPathToItem = new ArrayList<>(validationMetadata.pathToItem()); - propPathToItem.add(key); - ValidationMetadata propValidationMetadata = new ValidationMetadata( - propPathToItem, - validationMetadata.configuration(), - validationMetadata.validatedPathToSchemas(), - validationMetadata.seenClasses() - ); - for (Map.Entry>> patternPropEntry: patternProperties.entrySet()) { - if (!patternPropEntry.getKey().matcher(key).find()) { - continue; + @Throws(ValidationException::class) + private fun getPatternPropertiesPathToSchemas( + arg: Any?, + validationMetadata: ValidationMetadata + ): PathToSchemasMap { + if (arg !is Map<*, *> || patternProperties == null) { + return PathToSchemasMap() + } + val pathToSchemas = PathToSchemasMap() + for ((key, value) in arg) { + val entryKey = key!! as? String + ?: throw ValidationException("Invalid non-string type for map key") + val propPathToItem: MutableList = ArrayList(validationMetadata.pathToItem()) + propPathToItem.add(entryKey) + val propValidationMetadata = ValidationMetadata( + propPathToItem, + validationMetadata.configuration, + validationMetadata.validatedPathToSchemas, + validationMetadata.seenClasses + ) + for ((key1, patternPropClass) in patternProperties) { + if (!key1.matcher(entryKey).find()) { + continue } - - Class> patternPropClass = patternPropEntry.getValue(); - JsonSchema patternPropSchema = JsonSchemaFactory.getInstance(patternPropClass); - PathToSchemasMap otherPathToSchemas = JsonSchema.validate(patternPropSchema, entry.getValue(), propValidationMetadata); - pathToSchemas.update(otherPathToSchemas); + val patternPropSchema: JsonSchema<*> = JsonSchemaFactory.getInstance(patternPropClass) + val otherPathToSchemas = validate(patternPropSchema, value, propValidationMetadata) + pathToSchemas.update(otherPathToSchemas) } } - return pathToSchemas; + return pathToSchemas } - private PathToSchemasMap getIfPathToSchemas( - @Nullable Object arg, - ValidationMetadata validationMetadata - ) { + private fun getIfPathToSchemas( + arg: Any?, + validationMetadata: ValidationMetadata + ): PathToSchemasMap { if (ifSchema == null) { - return new PathToSchemasMap(); + return PathToSchemasMap() } - JsonSchema ifSchemaInstance = JsonSchemaFactory.getInstance(ifSchema); - PathToSchemasMap pathToSchemas = new PathToSchemasMap(); + val ifSchemaInstance: JsonSchema<*> = JsonSchemaFactory.getInstance(ifSchema) + val pathToSchemas = PathToSchemasMap() try { - var otherPathToSchemas = JsonSchema.validate(ifSchemaInstance, arg, validationMetadata); - pathToSchemas.update(otherPathToSchemas); - } catch (ValidationException ignored) {} - return pathToSchemas; - } - - public static PathToSchemasMap validate( - JsonSchema jsonSchema, - @Nullable Object arg, - ValidationMetadata validationMetadata - ) throws ValidationException { - LinkedHashSet disabledKeywords = validationMetadata.configuration().disabledKeywordFlags().getKeywords(); - PathToSchemasMap pathToSchemas = new PathToSchemasMap(); - LinkedHashMap thisKeywordToValidator = jsonSchema.keywordToValidator; - @Nullable List containsPathToSchemas = null; - if (thisKeywordToValidator.containsKey("contains")) { - containsPathToSchemas = jsonSchema.getContainsPathToSchemas(arg, validationMetadata); - } - @Nullable PathToSchemasMap patternPropertiesPathToSchemas = null; - if (thisKeywordToValidator.containsKey("patternProperties")) { - patternPropertiesPathToSchemas = jsonSchema.getPatternPropertiesPathToSchemas(arg, validationMetadata); - } - @Nullable PathToSchemasMap ifPathToSchemas = null; - if (thisKeywordToValidator.containsKey("if")) { - ifPathToSchemas = jsonSchema.getIfPathToSchemas(arg, validationMetadata); - } - @Nullable PathToSchemasMap knownPathToSchemas = null; - for (Map.Entry entry: thisKeywordToValidator.entrySet()) { - String jsonKeyword = entry.getKey(); - if (disabledKeywords.contains(jsonKeyword)) { - boolean typeIntegerUseCase = jsonKeyword.equals("format") && "int".equals(jsonSchema.format); - if (!typeIntegerUseCase) { - continue; - } - } - if ("unevaluatedItems".equals(jsonKeyword) || "unevaluatedProperties".equals(jsonKeyword)) { - knownPathToSchemas = pathToSchemas; - } - KeywordValidator validator = entry.getValue(); - ValidationData data = new ValidationData( - jsonSchema, - arg, - validationMetadata, - containsPathToSchemas, - patternPropertiesPathToSchemas, - ifPathToSchemas, - knownPathToSchemas - ); - @Nullable PathToSchemasMap otherPathToSchemas = validator.validate(data); - if (otherPathToSchemas == null) { - continue; - } - pathToSchemas.update(otherPathToSchemas); - } - List pathToItem = validationMetadata.pathToItem(); - if (!pathToSchemas.containsKey(pathToItem)) { - pathToSchemas.put(validationMetadata.pathToItem(), new LinkedHashMap<>()); + val otherPathToSchemas = validate(ifSchemaInstance, arg, validationMetadata) + pathToSchemas.update(otherPathToSchemas) + } catch (ignored: ValidationException) { } - @Nullable LinkedHashMap, Void> schemas = pathToSchemas.get(pathToItem); - if (schemas != null) { - schemas.put(jsonSchema, null); - } - return pathToSchemas; + return pathToSchemas } - protected String castToAllowedTypes(String arg, List pathToItem, Set> pathSet) { - pathSet.add(pathToItem); - return arg; + protected fun castToAllowedTypes(arg: String, pathToItem: List?, pathSet: MutableSet?>): String { + pathSet.add(pathToItem) + return arg } - protected Boolean castToAllowedTypes(Boolean arg, List pathToItem, Set> pathSet) { - pathSet.add(pathToItem); - return arg; + protected fun castToAllowedTypes(arg: Boolean, pathToItem: List?, pathSet: MutableSet?>): Boolean { + pathSet.add(pathToItem) + return arg } - protected Number castToAllowedTypes(Number arg, List pathToItem, Set> pathSet) { - pathSet.add(pathToItem); - return arg; + protected fun castToAllowedTypes(arg: Number, pathToItem: List?, pathSet: MutableSet?>): Number { + pathSet.add(pathToItem) + return arg } - protected Void castToAllowedTypes(Void arg, List pathToItem, Set> pathSet) { - pathSet.add(pathToItem); - return arg; + protected fun castToAllowedTypes(arg: Void?, pathToItem: List?, pathSet: MutableSet?>): Void? { + pathSet.add(pathToItem) + return arg } - protected List castToAllowedTypes(List arg, List pathToItem, Set> pathSet) throws ValidationException { - pathSet.add(pathToItem); - List<@Nullable Object> argFixed = new ArrayList<>(); - int i =0; - for (Object item: arg) { - List newPathToItem = new ArrayList<>(pathToItem); - newPathToItem.add(i); - Object fixedVal = castToAllowedObjectTypes(item, newPathToItem, pathSet); - argFixed.add(fixedVal); - i += 1; - } - return argFixed; + @Throws(ValidationException::class) + protected fun castToAllowedTypes(arg: List<*>, pathToItem: List?, pathSet: MutableSet?>): List<*> { + pathSet.add(pathToItem) + val argFixed: MutableList = ArrayList() + var i = 0 + for (item in arg) { + val newPathToItem: MutableList = ArrayList(pathToItem) + newPathToItem.add(i) + val fixedVal = castToAllowedObjectTypes(item, newPathToItem, pathSet) + argFixed.add(fixedVal) + i += 1 + } + return argFixed } - 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 ValidationException("Invalid non-string key value"); + @Throws(ValidationException::class) + protected fun castToAllowedTypes( + arg: Map<*, *>, + pathToItem: List?, + pathSet: MutableSet?> + ): Map<*, *> { + pathSet.add(pathToItem) + val argFixed = LinkedHashMap() + for ((entryKey, value) in arg) { + if (entryKey !is String) { + throw ValidationException("Invalid non-string key value") } - Object val = entry.getValue(); - List newPathToItem = new ArrayList<>(pathToItem); - newPathToItem.add(key); - Object fixedVal = castToAllowedObjectTypes(val, newPathToItem, pathSet); - argFixed.put(key, fixedVal); + val `val` = value!! + val newPathToItem: MutableList = ArrayList(pathToItem) + newPathToItem.add(entryKey) + val fixedVal = castToAllowedObjectTypes(`val`, newPathToItem, pathSet) + argFixed[entryKey] = fixedVal } - return argFixed; + return argFixed } - 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) { - return castToAllowedTypes((String) arg, pathToItem, pathSet); - } else if (arg instanceof Map) { - pathSet.add(pathToItem); - return castToAllowedTypes((Map) arg, pathToItem, pathSet); - } else if (arg instanceof Boolean) { - return castToAllowedTypes((Boolean) arg, pathToItem, pathSet); - } else if (arg instanceof Integer) { - return castToAllowedTypes((Number) arg, pathToItem, pathSet); - } else if (arg instanceof Long) { - return castToAllowedTypes((Number) arg, pathToItem, pathSet); - } else if (arg instanceof Float) { - return castToAllowedTypes((Number) arg, pathToItem, pathSet); - } else if (arg instanceof Double) { - return castToAllowedTypes((Number) arg, pathToItem, pathSet); - } else if (arg instanceof List) { - return castToAllowedTypes((List) arg, pathToItem, pathSet); - } else if (arg instanceof ZonedDateTime) { - return castToAllowedTypes(arg.toString(), pathToItem, pathSet); - } else if (arg instanceof LocalDate) { - return castToAllowedTypes(arg.toString(), pathToItem, pathSet); - } else if (arg instanceof UUID) { - return castToAllowedTypes(arg.toString(), pathToItem, pathSet); + @Throws(ValidationException::class) + private fun castToAllowedObjectTypes(arg: Any?, pathToItem: List, pathSet: MutableSet?>): Any? { + return if (arg == null) { + castToAllowedTypes(null as Void?, pathToItem, pathSet) + } else if (arg is String) { + castToAllowedTypes(arg, pathToItem, pathSet) + } else if (arg is Map<*, *>) { + pathSet.add(pathToItem) + castToAllowedTypes(arg, pathToItem, pathSet) + } else if (arg is Boolean) { + castToAllowedTypes(arg, pathToItem, pathSet) + } else if (arg is Int) { + castToAllowedTypes(arg as Number, pathToItem, pathSet) + } else if (arg is Long) { + castToAllowedTypes(arg as Number, pathToItem, pathSet) + } else if (arg is Float) { + castToAllowedTypes(arg as Number, pathToItem, pathSet) + } else if (arg is Double) { + castToAllowedTypes(arg as Number, pathToItem, pathSet) + } else if (arg is List<*>) { + castToAllowedTypes(arg, pathToItem, pathSet) + } else if (arg is ZonedDateTime) { + castToAllowedTypes(arg.toString(), pathToItem, pathSet) + } else if (arg is LocalDate) { + castToAllowedTypes(arg.toString(), pathToItem, pathSet) + } else if (arg is UUID) { + castToAllowedTypes(arg.toString(), pathToItem, pathSet) } else { - Class argClass = arg.getClass(); - throw new ValidationException("Invalid type passed in for input="+arg+" type="+argClass); + val argClass: Class<*> = arg.javaClass + throw ValidationException("Invalid type passed in for input=$arg type=$argClass") } } - public Void getNewInstance(Void arg, List pathToItem, PathToSchemasMap pathToSchemas) { - return arg; + fun getNewInstance(arg: Void, pathToItem: List?, pathToSchemas: PathToSchemasMap?): Void { + return arg } - public boolean getNewInstance(boolean arg, List pathToItem, PathToSchemasMap pathToSchemas) { - return arg; + fun getNewInstance(arg: Boolean, pathToItem: List?, pathToSchemas: PathToSchemasMap?): Boolean { + return arg } - public Number getNewInstance(Number arg, List pathToItem, PathToSchemasMap pathToSchemas) { - return arg; + fun getNewInstance(arg: Number, pathToItem: List?, pathToSchemas: PathToSchemasMap?): Number { + return arg } - public String getNewInstance(String arg, List pathToItem, PathToSchemasMap pathToSchemas) { - return arg; + fun getNewInstance(arg: String, pathToItem: List?, pathToSchemas: PathToSchemasMap?): String { + return arg } - 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); - pathToSchemasMap.update(otherPathToSchemas); - for (var schemas: pathToSchemasMap.values()) { - JsonSchema firstSchema = schemas.entrySet().iterator().next().getKey(); - schemas.clear(); - schemas.put(firstSchema, null); - } - pathSet.removeAll(pathToSchemasMap.keySet()); - if (!pathSet.isEmpty()) { - LinkedHashMap, Void> unsetAnyTypeSchema = new LinkedHashMap<>(); - unsetAnyTypeSchema.put(UnsetAnyTypeJsonSchema.UnsetAnyTypeJsonSchema1.getInstance(), null); - for (List pathToItem: pathSet) { - pathToSchemasMap.put(pathToItem, unsetAnyTypeSchema); + companion object { + @Throws(ValidationException::class) + fun validate( + jsonSchema: JsonSchema<*>, + arg: Any?, + validationMetadata: ValidationMetadata + ): PathToSchemasMap { + val disabledKeywords: LinkedHashSet = + validationMetadata.configuration.disabledKeywordFlags.getKeywords() + val pathToSchemas = PathToSchemasMap() + val thisKeywordToValidator = jsonSchema.keywordToValidator + var containsPathToSchemas: List? = null + if (thisKeywordToValidator.containsKey("contains")) { + containsPathToSchemas = jsonSchema.getContainsPathToSchemas(arg, validationMetadata) + } + var patternPropertiesPathToSchemas: PathToSchemasMap? = null + if (thisKeywordToValidator.containsKey("patternProperties")) { + patternPropertiesPathToSchemas = jsonSchema.getPatternPropertiesPathToSchemas(arg, validationMetadata) } + var ifPathToSchemas: PathToSchemasMap? = null + if (thisKeywordToValidator.containsKey("if")) { + ifPathToSchemas = jsonSchema.getIfPathToSchemas(arg, validationMetadata) + } + var knownPathToSchemas: PathToSchemasMap? = null + for ((jsonKeyword, validator) in thisKeywordToValidator) { + if (disabledKeywords.contains(jsonKeyword)) { + val typeIntegerUseCase = jsonKeyword == "format" && "int" == jsonSchema.format + if (!typeIntegerUseCase) { + continue + } + } + if ("unevaluatedItems" == jsonKeyword || "unevaluatedProperties" == jsonKeyword) { + knownPathToSchemas = pathToSchemas + } + val data = ValidationData( + jsonSchema, + arg, + validationMetadata, + containsPathToSchemas, + patternPropertiesPathToSchemas, + ifPathToSchemas, + knownPathToSchemas + ) + val otherPathToSchemas = validator.validate(data) ?: continue + pathToSchemas.update(otherPathToSchemas) + } + val pathToItem: List = validationMetadata.pathToItem + if (!pathToSchemas.containsKey(pathToItem)) { + pathToSchemas[validationMetadata.pathToItem] = LinkedHashMap() + } + val schemas: LinkedHashMap?, Void?>? = pathToSchemas[pathToItem] + if (schemas != null) { + schemas[jsonSchema] = null + } + return pathToSchemas } - return pathToSchemasMap; - } - public static String getClass(@Nullable Object arg) { - if (arg == null) { - return Void.class.getSimpleName(); - } else { - return arg.getClass().getSimpleName(); + @Throws(ValidationException::class) + protected fun getPathToSchemas( + jsonSchema: JsonSchema<*>, + arg: Any?, + validationMetadata: ValidationMetadata, + pathSet: Set> + ): PathToSchemasMap { + val pathToSchemasMap = PathToSchemasMap() + // todo add check of validationMetadata.validationRanEarlier(this) + val otherPathToSchemas = validate(jsonSchema, arg, validationMetadata) + pathToSchemasMap.update(otherPathToSchemas) + for (schemas in pathToSchemasMap.values) { + val firstSchema: JsonSchema<*> = schemas!!.entries.iterator().next().getKey() + schemas.clear() + schemas[firstSchema] = null + } + pathSet.removeAll(pathToSchemasMap.keys) + if (!pathSet.isEmpty()) { + val unsetAnyTypeSchema = LinkedHashMap, Void?>() + unsetAnyTypeSchema[UnsetAnyTypeJsonSchema.UnsetAnyTypeJsonSchema1.getInstance()] = null + for (pathToItem in pathSet) { + pathToSchemasMap[pathToItem] = unsetAnyTypeSchema + } + } + return pathToSchemasMap } + + fun getClass(arg: Any?): String { + return if (arg == null) { + Void::class.java.getSimpleName() + } else { + arg.javaClass.getSimpleName() + } + } // todo add bytes and FileIO } - // todo add bytes and FileIO } \ No newline at end of file diff --git a/src/main/resources/java/src/main/java/packagename/schemas/validation/JsonSchemaFactory.hbs b/src/main/resources/java/src/main/java/packagename/schemas/validation/JsonSchemaFactory.hbs index ee529fb4fa1..5cd8aeedb72 100644 --- a/src/main/resources/java/src/main/java/packagename/schemas/validation/JsonSchemaFactory.hbs +++ b/src/main/resources/java/src/main/java/packagename/schemas/validation/JsonSchemaFactory.hbs @@ -1,32 +1,29 @@ package {{{packageName}}}.schemas.validation; -import org.checkerframework.checker.nullness.qual.NonNull; -import org.checkerframework.checker.nullness.qual.Nullable; +import java.lang.reflect.InvocationTargetException -import java.lang.reflect.InvocationTargetException; -import java.lang.reflect.Method; -import java.util.HashMap; -import java.util.Map; +object JsonSchemaFactory { + private var classToInstance: MutableMap>, JsonSchema<*>> = HashMap() - -public class JsonSchemaFactory { - static Map>, JsonSchema> classToInstance = new HashMap<>(); - - public static > V getInstance(Class schemaCls) { - @Nullable JsonSchema cacheInst = classToInstance.get(schemaCls); - if (cacheInst != null) { - assert schemaCls.isInstance(cacheInst); - return schemaCls.cast(cacheInst); + fun > getInstance(schemaCls: Class): V { + val cacheInst: JsonSchema<*>? = classToInstance[schemaCls] + cacheInst?.let { + assert(schemaCls.isInstance(cacheInst)) + return schemaCls.cast(cacheInst) } try { - Method method = schemaCls.getMethod("getInstance"); - @SuppressWarnings("nullness") @NonNull Object obj = method.invoke(null); - assert schemaCls.isInstance(obj); - V inst = schemaCls.cast(obj); - classToInstance.put(schemaCls, inst); - return inst; - } catch (NoSuchMethodException | IllegalAccessException | InvocationTargetException e) { - throw new RuntimeException(e); + val method = schemaCls.getMethod("getInstance") + val obj = method.invoke(null) + assert(schemaCls.isInstance(obj)) + val inst = schemaCls.cast(obj) + classToInstance[schemaCls] = inst + return inst + } catch (e: NoSuchMethodException) { + throw RuntimeException(e) + } catch (e: IllegalAccessException) { + throw RuntimeException(e) + } catch (e: InvocationTargetException) { + throw RuntimeException(e) } } } \ No newline at end of file diff --git a/src/main/resources/java/src/main/java/packagename/schemas/validation/JsonSchemaInfo.hbs b/src/main/resources/java/src/main/java/packagename/schemas/validation/JsonSchemaInfo.hbs index 0d7527947c8..ec4eb87de88 100644 --- a/src/main/resources/java/src/main/java/packagename/schemas/validation/JsonSchemaInfo.hbs +++ b/src/main/resources/java/src/main/java/packagename/schemas/validation/JsonSchemaInfo.hbs @@ -1,210 +1,244 @@ package {{{packageName}}}.schemas.validation; -import org.checkerframework.checker.nullness.qual.Nullable; - -import java.math.BigDecimal; -import java.util.List; -import java.util.Map; -import java.util.Set; -import java.util.regex.Pattern; - -public class JsonSchemaInfo { - public @Nullable Set> type = null; - public JsonSchemaInfo type(Set> type) { - this.type = type; - return this; - } - public @Nullable String format = null; - public JsonSchemaInfo format(String format) { - this.format = format; - return this; - } - public @Nullable Class> items = null; - public JsonSchemaInfo items(Class> items) { - this.items = items; - return this; - } - public @Nullable Map>> properties = null; - public JsonSchemaInfo properties(Map>> properties) { - this.properties = properties; - return this; - } - public @Nullable Set required = null; - public JsonSchemaInfo required(Set required) { - this.required = required; - return this; - } - public @Nullable Number exclusiveMaximum = null; - public JsonSchemaInfo exclusiveMaximum(Number exclusiveMaximum) { - this.exclusiveMaximum = exclusiveMaximum; - return this; - } - public @Nullable Number exclusiveMinimum = null; - public JsonSchemaInfo exclusiveMinimum(Number exclusiveMinimum) { - this.exclusiveMinimum = exclusiveMinimum; - return this; - } - public @Nullable Integer maxItems = null; - public JsonSchemaInfo maxItems(Integer maxItems) { - this.maxItems = maxItems; - return this; - } - public @Nullable Integer minItems = null; - public JsonSchemaInfo minItems(Integer minItems) { - this.minItems = minItems; - return this; - } - public @Nullable Integer maxLength = null; - public JsonSchemaInfo maxLength(Integer maxLength) { - this.maxLength = maxLength; - return this; - } - public @Nullable Integer minLength = null; - public JsonSchemaInfo minLength(Integer minLength) { - this.minLength = minLength; - return this; - } - public @Nullable Integer maxProperties = null; - public JsonSchemaInfo maxProperties(Integer maxProperties) { - this.maxProperties = maxProperties; - return this; - } - public @Nullable Integer minProperties = null; - public JsonSchemaInfo minProperties(Integer minProperties) { - this.minProperties = minProperties; - return this; - } - public @Nullable Number maximum = null; - public JsonSchemaInfo maximum(Number maximum) { - this.maximum = maximum; - return this; - } - public @Nullable Number minimum = null; - public JsonSchemaInfo minimum(Number minimum) { - this.minimum = minimum; - return this; - } - public @Nullable BigDecimal multipleOf = null; - public JsonSchemaInfo multipleOf(BigDecimal multipleOf) { - this.multipleOf = multipleOf; - return this; - } - public @Nullable Class> additionalProperties; - public JsonSchemaInfo additionalProperties(Class> additionalProperties) { - this.additionalProperties = additionalProperties; - return this; - } - public @Nullable List>> allOf = null; - public JsonSchemaInfo allOf(List>> allOf) { - this.allOf = allOf; - return this; - } - public @Nullable List>> anyOf = null; - public JsonSchemaInfo anyOf(List>> anyOf) { - this.anyOf = anyOf; - return this; - } - public @Nullable List>> oneOf = null; - public JsonSchemaInfo oneOf(List>> oneOf) { - this.oneOf = oneOf; - return this; - } - public @Nullable Class> not = null; - public JsonSchemaInfo not(Class> not) { - this.not = not; - return this; - } - public @Nullable Boolean uniqueItems = null; - public JsonSchemaInfo uniqueItems(Boolean uniqueItems) { - this.uniqueItems = uniqueItems; - return this; - } - public @Nullable Set<@Nullable Object> enumValues = null; - public JsonSchemaInfo enumValues(Set<@Nullable Object> enumValues) { - this.enumValues = enumValues; - return this; - } - public @Nullable Pattern pattern = null; - public JsonSchemaInfo pattern(Pattern pattern) { - this.pattern = pattern; - return this; - } - public @Nullable Object defaultValue = null; - public boolean defaultValueSet = false; - public JsonSchemaInfo defaultValue(@Nullable Object defaultValue) { - this.defaultValue = defaultValue; - this.defaultValueSet = true; - return this; - } - public @Nullable Object constValue = null; - public boolean constValueSet = false; - public JsonSchemaInfo constValue(@Nullable Object constValue) { - this.constValue = constValue; - this.constValueSet = true; - return this; - } - public @Nullable Class> contains = null; - public JsonSchemaInfo contains(Class> contains) { - this.contains = contains; - return this; - } - public @Nullable Integer maxContains = null; - public JsonSchemaInfo maxContains(Integer maxContains) { - this.maxContains = maxContains; - return this; - } - public @Nullable Integer minContains = null; - public JsonSchemaInfo minContains(Integer minContains) { - this.minContains = minContains; - return this; - } - public @Nullable Class> propertyNames = null; - public JsonSchemaInfo propertyNames(Class> propertyNames) { - this.propertyNames = propertyNames; - return this; - } - public @Nullable Map> dependentRequired = null; - public JsonSchemaInfo dependentRequired(Map> dependentRequired) { - this.dependentRequired = dependentRequired; - return this; - } - public @Nullable Map>> dependentSchemas = null; - public JsonSchemaInfo dependentSchemas(Map>> dependentSchemas) { - this.dependentSchemas = dependentSchemas; - return this; - } - public @Nullable Map>> patternProperties = null; - public JsonSchemaInfo patternProperties(Map>> patternProperties) { - this.patternProperties = patternProperties; - return this; - } - public @Nullable List>> prefixItems = null; - public JsonSchemaInfo prefixItems(List>> prefixItems) { - this.prefixItems = prefixItems; - return this; - } - public @Nullable Class> ifSchema = null; - public JsonSchemaInfo ifSchema(Class> ifSchema) { - this.ifSchema = ifSchema; - return this; - } - public @Nullable Class> then = null; - public JsonSchemaInfo then(Class> then) { - this.then = then; - return this; - } - public @Nullable Class> elseSchema = null; - public JsonSchemaInfo elseSchema(Class> elseSchema) { - this.elseSchema = elseSchema; - return this; - } - public @Nullable Class> unevaluatedItems = null; - public JsonSchemaInfo unevaluatedItems(Class> unevaluatedItems) { - this.unevaluatedItems = unevaluatedItems; - return this; - } - public @Nullable Class> unevaluatedProperties = null; - public JsonSchemaInfo unevaluatedProperties(Class> unevaluatedProperties) { - this.unevaluatedProperties = unevaluatedProperties; - return this; + +import java.math.BigDecimal +import java.util.regex.Pattern + +class JsonSchemaInfo { + var type: Set>? = null + fun type(type: Set>?): JsonSchemaInfo { + this.type = type + return this + } + + var format: String? = null + fun format(format: String?): JsonSchemaInfo { + this.format = format + return this + } + + var items: Class?>? = null + fun items(items: Class?>?): JsonSchemaInfo { + this.items = items + return this + } + + var properties: Map?>>? = null + fun properties(properties: Map?>>?): JsonSchemaInfo { + this.properties = properties + return this + } + + var required: Set? = null + fun required(required: Set?): JsonSchemaInfo { + this.required = required + return this + } + + var exclusiveMaximum: Number? = null + fun exclusiveMaximum(exclusiveMaximum: Number?): JsonSchemaInfo { + this.exclusiveMaximum = exclusiveMaximum + return this + } + + var exclusiveMinimum: Number? = null + fun exclusiveMinimum(exclusiveMinimum: Number?): JsonSchemaInfo { + this.exclusiveMinimum = exclusiveMinimum + return this + } + + var maxItems: Int? = null + fun maxItems(maxItems: Int?): JsonSchemaInfo { + this.maxItems = maxItems + return this + } + + var minItems: Int? = null + fun minItems(minItems: Int?): JsonSchemaInfo { + this.minItems = minItems + return this + } + + var maxLength: Int? = null + fun maxLength(maxLength: Int?): JsonSchemaInfo { + this.maxLength = maxLength + return this + } + + var minLength: Int? = null + fun minLength(minLength: Int?): JsonSchemaInfo { + this.minLength = minLength + return this + } + + var maxProperties: Int? = null + fun maxProperties(maxProperties: Int?): JsonSchemaInfo { + this.maxProperties = maxProperties + return this + } + + var minProperties: Int? = null + fun minProperties(minProperties: Int?): JsonSchemaInfo { + this.minProperties = minProperties + return this + } + + var maximum: Number? = null + fun maximum(maximum: Number?): JsonSchemaInfo { + this.maximum = maximum + return this + } + + var minimum: Number? = null + fun minimum(minimum: Number?): JsonSchemaInfo { + this.minimum = minimum + return this + } + + var multipleOf: BigDecimal? = null + fun multipleOf(multipleOf: BigDecimal?): JsonSchemaInfo { + this.multipleOf = multipleOf + return this + } + + var additionalProperties: Class?>? = null + fun additionalProperties(additionalProperties: Class?>?): JsonSchemaInfo { + this.additionalProperties = additionalProperties + return this + } + + var allOf: List?>>? = null + fun allOf(allOf: List?>>?): JsonSchemaInfo { + this.allOf = allOf + return this + } + + var anyOf: List?>>? = null + fun anyOf(anyOf: List?>>?): JsonSchemaInfo { + this.anyOf = anyOf + return this + } + + var oneOf: List?>>? = null + fun oneOf(oneOf: List?>>?): JsonSchemaInfo { + this.oneOf = oneOf + return this + } + + var not: Class?>? = null + fun not(not: Class?>?): JsonSchemaInfo { + this.not = not + return this + } + + var uniqueItems: Boolean? = null + fun uniqueItems(uniqueItems: Boolean?): JsonSchemaInfo { + this.uniqueItems = uniqueItems + return this + } + + var enumValues: Set? = null + fun enumValues(enumValues: Set?): JsonSchemaInfo { + this.enumValues = enumValues + return this + } + + var pattern: Pattern? = null + fun pattern(pattern: Pattern?): JsonSchemaInfo { + this.pattern = pattern + return this + } + + var defaultValue: Any? = null + var defaultValueSet = false + fun defaultValue(defaultValue: Any?): JsonSchemaInfo { + this.defaultValue = defaultValue + defaultValueSet = true + return this + } + + var constValue: Any? = null + var constValueSet = false + fun constValue(constValue: Any?): JsonSchemaInfo { + this.constValue = constValue + constValueSet = true + return this + } + + var contains: Class?>? = null + fun contains(contains: Class?>?): JsonSchemaInfo { + this.contains = contains + return this + } + + var maxContains: Int? = null + fun maxContains(maxContains: Int?): JsonSchemaInfo { + this.maxContains = maxContains + return this + } + + var minContains: Int? = null + fun minContains(minContains: Int?): JsonSchemaInfo { + this.minContains = minContains + return this + } + + var propertyNames: Class?>? = null + fun propertyNames(propertyNames: Class?>?): JsonSchemaInfo { + this.propertyNames = propertyNames + return this + } + + var dependentRequired: Map>? = null + fun dependentRequired(dependentRequired: Map>?): JsonSchemaInfo { + this.dependentRequired = dependentRequired + return this + } + + var dependentSchemas: Map?>>? = null + fun dependentSchemas(dependentSchemas: Map?>>?): JsonSchemaInfo { + this.dependentSchemas = dependentSchemas + return this + } + + var patternProperties: Map?>>? = null + fun patternProperties(patternProperties: Map?>>?): JsonSchemaInfo { + this.patternProperties = patternProperties + return this + } + + var prefixItems: List?>>? = null + fun prefixItems(prefixItems: List?>>?): JsonSchemaInfo { + this.prefixItems = prefixItems + return this + } + + var ifSchema: Class?>? = null + fun ifSchema(ifSchema: Class?>?): JsonSchemaInfo { + this.ifSchema = ifSchema + return this + } + + var then: Class?>? = null + fun then(then: Class?>?): JsonSchemaInfo { + this.then = then + return this + } + + var elseSchema: Class?>? = null + fun elseSchema(elseSchema: Class?>?): JsonSchemaInfo { + this.elseSchema = elseSchema + return this + } + + var unevaluatedItems: Class?>? = null + fun unevaluatedItems(unevaluatedItems: Class?>?): JsonSchemaInfo { + this.unevaluatedItems = unevaluatedItems + return this + } + + var unevaluatedProperties: Class?>? = null + fun unevaluatedProperties(unevaluatedProperties: Class?>?): JsonSchemaInfo { + this.unevaluatedProperties = unevaluatedProperties + return this } } \ No newline at end of file diff --git a/src/main/resources/kotlin/src/main/kotlin/packagename/schemas/validation/JsonSchema.hbs b/src/main/resources/kotlin/src/main/kotlin/packagename/schemas/validation/JsonSchema.hbs index 3ffb61a8eb7..04627a810a0 100644 --- a/src/main/resources/kotlin/src/main/kotlin/packagename/schemas/validation/JsonSchema.hbs +++ b/src/main/resources/kotlin/src/main/kotlin/packagename/schemas/validation/JsonSchema.hbs @@ -1,499 +1,503 @@ package {{{packageName}}}.schemas.validation; -import org.checkerframework.checker.nullness.qual.Nullable; import {{{packageName}}}.configurations.SchemaConfiguration; import {{{packageName}}}.exceptions.ValidationException; -import java.math.BigDecimal; -import java.time.LocalDate; -import java.time.ZonedDateTime; -import java.util.ArrayList; -import java.util.LinkedHashMap; -import java.util.LinkedHashSet; -import java.util.List; -import java.util.Map; -import java.util.Set; -import java.util.UUID; -import java.util.regex.Pattern; +import java.math.BigDecimal +import java.time.LocalDate +import java.time.ZonedDateTime +import java.util.regex.Pattern +import java.util.UUID -public abstract class JsonSchema { - public final @Nullable Set> type; - public final @Nullable String format; - public final @Nullable Class> items; - public final @Nullable Map>> properties; - public final @Nullable Set required; - public final @Nullable Number exclusiveMaximum; - public final @Nullable Number exclusiveMinimum; - public final @Nullable Integer maxItems; - public final @Nullable Integer minItems; - public final @Nullable Integer maxLength; - public final @Nullable Integer minLength; - public final @Nullable Integer maxProperties; - public final @Nullable Integer minProperties; - public final @Nullable Number maximum; - public final @Nullable Number minimum; - public final @Nullable BigDecimal multipleOf; - public final @Nullable Class> additionalProperties; - public final @Nullable List>> allOf; - public final @Nullable List>> anyOf; - public final @Nullable List>> oneOf; - public final @Nullable Class> not; - public final @Nullable Boolean uniqueItems; - public final @Nullable Set<@Nullable Object> enumValues; - public final @Nullable Pattern pattern; - public final @Nullable Object defaultValue; - public final boolean defaultValueSet; - public final @Nullable Object constValue; - public final boolean constValueSet; - public final @Nullable Class> contains; - public final @Nullable Integer maxContains; - public final @Nullable Integer minContains; - public final @Nullable Class> propertyNames; - public final @Nullable Map> dependentRequired; - public final @Nullable Map>> dependentSchemas; - public final @Nullable Map>> patternProperties; - public final @Nullable List>> prefixItems; - public final @Nullable Class> ifSchema; - public final @Nullable Class> then; - public final @Nullable Class> elseSchema; - public final @Nullable Class> unevaluatedItems; - public final @Nullable Class> unevaluatedProperties; - private final LinkedHashMap keywordToValidator; +abstract class JsonSchema protected constructor(jsonSchemaInfo: JsonSchemaInfo) { + val type: Set>? + val format: String? + val items: Class>? + val properties: Map>>? + val required: Set? + val exclusiveMaximum: Number? + val exclusiveMinimum: Number? + val maxItems: Int? + val minItems: Int? + val maxLength: Int? + val minLength: Int? + val maxProperties: Int? + val minProperties: Int? + val maximum: Number? + val minimum: Number? + val multipleOf: BigDecimal? + val additionalProperties: Class>? + val allOf: List>>? + val anyOf: List>>? + val oneOf: List>>? + val not: Class>? + val uniqueItems: Boolean? + val enumValues: Set? + val pattern: Pattern? + val defaultValue: Any? + val defaultValueSet: Boolean + val constValue: Any? + val constValueSet: Boolean + val contains: Class>? + val maxContains: Int? + val minContains: Int? + val propertyNames: Class>? + val dependentRequired: Map>? + val dependentSchemas: Map>>? + val patternProperties: Map>>? + val prefixItems: List>>? + val ifSchema: Class>? + val then: Class>? + val elseSchema: Class>? + val unevaluatedItems: Class>? + val unevaluatedProperties: Class>? + private val keywordToValidator: LinkedHashMap - protected JsonSchema(JsonSchemaInfo jsonSchemaInfo) { - LinkedHashMap keywordToValidator = new LinkedHashMap<>(); - this.type = jsonSchemaInfo.type; - if (this.type != null) { - keywordToValidator.put("type", new TypeValidator()); - } - this.format = jsonSchemaInfo.format; - if (this.format != null) { - keywordToValidator.put("format", new FormatValidator()); - } - this.items = jsonSchemaInfo.items; - if (this.items != null) { - keywordToValidator.put("items", new ItemsValidator()); - } - this.properties = jsonSchemaInfo.properties; - if (this.properties != null) { - keywordToValidator.put("properties", new PropertiesValidator()); - } - this.required = jsonSchemaInfo.required; - if (this.required != null) { - keywordToValidator.put("required", new RequiredValidator()); - } - this.exclusiveMaximum = jsonSchemaInfo.exclusiveMaximum; - if (this.exclusiveMaximum != null) { - keywordToValidator.put("exclusiveMaximum", new ExclusiveMaximumValidator()); - } - this.exclusiveMinimum = jsonSchemaInfo.exclusiveMinimum; - if (this.exclusiveMinimum != null) { - keywordToValidator.put("exclusiveMinimum", new ExclusiveMinimumValidator()); - } - this.maxItems = jsonSchemaInfo.maxItems; - if (this.maxItems != null) { - keywordToValidator.put("maxItems", new MaxItemsValidator()); - } - this.minItems = jsonSchemaInfo.minItems; - if (this.minItems != null) { - keywordToValidator.put("minItems", new MinItemsValidator()); - } - this.maxLength = jsonSchemaInfo.maxLength; - if (this.maxLength != null) { - keywordToValidator.put("maxLength", new MaxLengthValidator()); - } - this.minLength = jsonSchemaInfo.minLength; - if (this.minLength != null) { - keywordToValidator.put("minLength", new MinLengthValidator()); - } - this.maxProperties = jsonSchemaInfo.maxProperties; - if (this.maxProperties != null) { - keywordToValidator.put("maxProperties", new MaxPropertiesValidator()); - } - this.minProperties = jsonSchemaInfo.minProperties; - if (this.minProperties != null) { - keywordToValidator.put("minProperties", new MinPropertiesValidator()); - } - this.maximum = jsonSchemaInfo.maximum; - if (this.maximum != null) { - keywordToValidator.put("maximum", new MaximumValidator()); - } - this.minimum = jsonSchemaInfo.minimum; - if (this.minimum != null) { - keywordToValidator.put("minimum", new MinimumValidator()); - } - this.multipleOf = jsonSchemaInfo.multipleOf; - if (this.multipleOf != null) { - keywordToValidator.put("multipleOf", new MultipleOfValidator()); - } - this.additionalProperties = jsonSchemaInfo.additionalProperties; - if (this.additionalProperties != null) { - keywordToValidator.put("additionalProperties", new AdditionalPropertiesValidator()); - } - this.allOf = jsonSchemaInfo.allOf; - if (this.allOf != null) { - keywordToValidator.put("allOf", new AllOfValidator()); - } - this.anyOf = jsonSchemaInfo.anyOf; - if (this.anyOf != null) { - keywordToValidator.put("anyOf", new AnyOfValidator()); - } - this.oneOf = jsonSchemaInfo.oneOf; - if (this.oneOf != null) { - keywordToValidator.put("oneOf", new OneOfValidator()); - } - this.not = jsonSchemaInfo.not; - if (this.not != null) { - keywordToValidator.put("not", new NotValidator()); - } - this.uniqueItems = jsonSchemaInfo.uniqueItems; - if (this.uniqueItems != null) { - keywordToValidator.put("uniqueItems", new UniqueItemsValidator()); - } - this.enumValues = jsonSchemaInfo.enumValues; - if (this.enumValues != null) { - keywordToValidator.put("enum", new EnumValidator()); - } - this.pattern = jsonSchemaInfo.pattern; - if (this.pattern != null) { - keywordToValidator.put("pattern", new PatternValidator()); - } - this.defaultValue = jsonSchemaInfo.defaultValue; - this.defaultValueSet = jsonSchemaInfo.defaultValueSet; - this.constValue = jsonSchemaInfo.constValue; - this.constValueSet = jsonSchemaInfo.constValueSet; - if (this.constValueSet) { - keywordToValidator.put("const", new ConstValidator()); + init { + val keywordToValidator = LinkedHashMap() + type = jsonSchemaInfo.type + if (type != null) { + keywordToValidator["type"] = TypeValidator() + } + format = jsonSchemaInfo.format + if (format != null) { + keywordToValidator["format"] = FormatValidator() + } + items = jsonSchemaInfo.items + if (items != null) { + keywordToValidator["items"] = ItemsValidator() + } + properties = jsonSchemaInfo.properties + if (properties != null) { + keywordToValidator["properties"] = PropertiesValidator() + } + required = jsonSchemaInfo.required + if (required != null) { + keywordToValidator["required"] = RequiredValidator() + } + exclusiveMaximum = jsonSchemaInfo.exclusiveMaximum + if (exclusiveMaximum != null) { + keywordToValidator["exclusiveMaximum"] = ExclusiveMaximumValidator() + } + exclusiveMinimum = jsonSchemaInfo.exclusiveMinimum + if (exclusiveMinimum != null) { + keywordToValidator["exclusiveMinimum"] = ExclusiveMinimumValidator() + } + maxItems = jsonSchemaInfo.maxItems + if (maxItems != null) { + keywordToValidator["maxItems"] = MaxItemsValidator() + } + minItems = jsonSchemaInfo.minItems + if (minItems != null) { + keywordToValidator["minItems"] = MinItemsValidator() + } + maxLength = jsonSchemaInfo.maxLength + if (maxLength != null) { + keywordToValidator["maxLength"] = MaxLengthValidator() + } + minLength = jsonSchemaInfo.minLength + if (minLength != null) { + keywordToValidator["minLength"] = MinLengthValidator() + } + maxProperties = jsonSchemaInfo.maxProperties + if (maxProperties != null) { + keywordToValidator["maxProperties"] = MaxPropertiesValidator() + } + minProperties = jsonSchemaInfo.minProperties + if (minProperties != null) { + keywordToValidator["minProperties"] = MinPropertiesValidator() + } + maximum = jsonSchemaInfo.maximum + if (maximum != null) { + keywordToValidator["maximum"] = MaximumValidator() + } + minimum = jsonSchemaInfo.minimum + if (minimum != null) { + keywordToValidator["minimum"] = MinimumValidator() + } + multipleOf = jsonSchemaInfo.multipleOf + if (multipleOf != null) { + keywordToValidator["multipleOf"] = MultipleOfValidator() + } + additionalProperties = jsonSchemaInfo.additionalProperties + if (additionalProperties != null) { + keywordToValidator["additionalProperties"] = AdditionalPropertiesValidator() + } + allOf = jsonSchemaInfo.allOf + if (allOf != null) { + keywordToValidator["allOf"] = AllOfValidator() + } + anyOf = jsonSchemaInfo.anyOf + if (anyOf != null) { + keywordToValidator["anyOf"] = AnyOfValidator() + } + oneOf = jsonSchemaInfo.oneOf + if (oneOf != null) { + keywordToValidator["oneOf"] = OneOfValidator() + } + not = jsonSchemaInfo.not + if (not != null) { + keywordToValidator["not"] = NotValidator() + } + uniqueItems = jsonSchemaInfo.uniqueItems + if (uniqueItems != null) { + keywordToValidator["uniqueItems"] = UniqueItemsValidator() + } + enumValues = jsonSchemaInfo.enumValues + if (enumValues != null) { + keywordToValidator["enum"] = EnumValidator() + } + pattern = jsonSchemaInfo.pattern + if (pattern != null) { + keywordToValidator["pattern"] = PatternValidator() + } + defaultValue = jsonSchemaInfo.defaultValue + defaultValueSet = jsonSchemaInfo.defaultValueSet + constValue = jsonSchemaInfo.constValue + constValueSet = jsonSchemaInfo.constValueSet + if (constValueSet) { + keywordToValidator["const"] = ConstValidator() } - this.contains = jsonSchemaInfo.contains; - if (this.contains != null) { - keywordToValidator.put("contains", new ContainsValidator()); + contains = jsonSchemaInfo.contains + if (contains != null) { + keywordToValidator["contains"] = ContainsValidator() } - this.maxContains = jsonSchemaInfo.maxContains; - if (this.maxContains != null) { - keywordToValidator.put("maxContains", new MaxContainsValidator()); + maxContains = jsonSchemaInfo.maxContains + if (maxContains != null) { + keywordToValidator["maxContains"] = MaxContainsValidator() } - this.minContains = jsonSchemaInfo.minContains; - if (this.minContains != null) { - keywordToValidator.put("minContains", new MinContainsValidator()); + minContains = jsonSchemaInfo.minContains + if (minContains != null) { + keywordToValidator["minContains"] = MinContainsValidator() } - this.propertyNames = jsonSchemaInfo.propertyNames; - if (this.propertyNames != null) { - keywordToValidator.put("propertyNames", new PropertyNamesValidator()); + propertyNames = jsonSchemaInfo.propertyNames + if (propertyNames != null) { + keywordToValidator["propertyNames"] = PropertyNamesValidator() } - this.dependentRequired = jsonSchemaInfo.dependentRequired; - if (this.dependentRequired != null) { - keywordToValidator.put("dependentRequired", new DependentRequiredValidator()); + dependentRequired = jsonSchemaInfo.dependentRequired + if (dependentRequired != null) { + keywordToValidator["dependentRequired"] = DependentRequiredValidator() } - this.dependentSchemas = jsonSchemaInfo.dependentSchemas; - if (this.dependentSchemas != null) { - keywordToValidator.put("dependentSchemas", new DependentSchemasValidator()); + dependentSchemas = jsonSchemaInfo.dependentSchemas + if (dependentSchemas != null) { + keywordToValidator["dependentSchemas"] = DependentSchemasValidator() } - this.patternProperties = jsonSchemaInfo.patternProperties; - if (this.patternProperties != null) { - keywordToValidator.put("patternProperties", new PatternPropertiesValidator()); + patternProperties = jsonSchemaInfo.patternProperties + if (patternProperties != null) { + keywordToValidator["patternProperties"] = PatternPropertiesValidator() } - this.prefixItems = jsonSchemaInfo.prefixItems; - if (this.prefixItems != null) { - keywordToValidator.put("prefixItems", new PrefixItemsValidator()); + prefixItems = jsonSchemaInfo.prefixItems + if (prefixItems != null) { + keywordToValidator["prefixItems"] = PrefixItemsValidator() } - this.ifSchema = jsonSchemaInfo.ifSchema; - if (this.ifSchema != null) { - keywordToValidator.put("if", new IfValidator()); + ifSchema = jsonSchemaInfo.ifSchema + if (ifSchema != null) { + keywordToValidator["if"] = IfValidator() } - this.then = jsonSchemaInfo.then; - if (this.then != null) { - keywordToValidator.put("then", new ThenValidator()); + then = jsonSchemaInfo.then + if (then != null) { + keywordToValidator["then"] = ThenValidator() } - this.elseSchema = jsonSchemaInfo.elseSchema; - if (this.elseSchema != null) { - keywordToValidator.put("else", new ElseValidator()); + elseSchema = jsonSchemaInfo.elseSchema + if (elseSchema != null) { + keywordToValidator["else"] = ElseValidator() } - this.unevaluatedItems = jsonSchemaInfo.unevaluatedItems; - if (this.unevaluatedItems != null) { - keywordToValidator.put("unevaluatedItems", new UnevaluatedItemsValidator()); + unevaluatedItems = jsonSchemaInfo.unevaluatedItems + if (unevaluatedItems != null) { + keywordToValidator["unevaluatedItems"] = UnevaluatedItemsValidator() } - this.unevaluatedProperties = jsonSchemaInfo.unevaluatedProperties; - if (this.unevaluatedProperties != null) { - keywordToValidator.put("unevaluatedProperties", new UnevaluatedPropertiesValidator()); + unevaluatedProperties = jsonSchemaInfo.unevaluatedProperties + if (unevaluatedProperties != null) { + keywordToValidator["unevaluatedProperties"] = UnevaluatedPropertiesValidator() } - this.keywordToValidator = keywordToValidator; + 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; - - private List getContainsPathToSchemas( - @Nullable Object arg, - ValidationMetadata validationMetadata - ) { - if (!(arg instanceof List listArg) || contains == null) { - return new ArrayList<>(); - } - JsonSchema containsSchema = JsonSchemaFactory.getInstance(contains); - @Nullable List containsPathToSchemas = new ArrayList<>(); - for(int i = 0; i < listArg.size(); i++) { - PathToSchemasMap thesePathToSchemas = new PathToSchemasMap(); - List itemPathToItem = new ArrayList<>(validationMetadata.pathToItem()); - itemPathToItem.add(i); - ValidationMetadata itemValidationMetadata = new ValidationMetadata( - itemPathToItem, - validationMetadata.configuration(), - validationMetadata.validatedPathToSchemas(), - validationMetadata.seenClasses() - ); + abstract fun getNewInstance(arg: Any?, pathToItem: List?, pathToSchemas: PathToSchemasMap?): Any? + @Throws(ValidationException::class) + abstract fun validate(arg: Any?, configuration: SchemaConfiguration?): Any? + @Throws(ValidationException::class) + abstract fun validateAndBox(arg: Any?, configuration: SchemaConfiguration?): T + private fun getContainsPathToSchemas( + arg: Any?, + validationMetadata: ValidationMetadata + ): List? { + if (arg !is List<*> || contains == null) { + return ArrayList() + } + val containsSchema: JsonSchema<*> = JsonSchemaFactory.getInstance(contains) + val containsPathToSchemas: MutableList = ArrayList() + for (i in arg.indices) { + val thesePathToSchemas = PathToSchemasMap() + val itemPathToItem: MutableList = ArrayList(validationMetadata.pathToItem) + itemPathToItem.add(i) + val itemValidationMetadata = ValidationMetadata( + itemPathToItem, + validationMetadata.configuration, + validationMetadata.validatedPathToSchemas, + validationMetadata.seenClasses + ) if (itemValidationMetadata.validationRanEarlier(containsSchema)) { // todo add_deeper_validated_schemas - containsPathToSchemas.add(thesePathToSchemas); - continue; + containsPathToSchemas.add(thesePathToSchemas) + continue } - try { - PathToSchemasMap otherPathToSchemas = JsonSchema.validate( - containsSchema, listArg.get(i), itemValidationMetadata); - containsPathToSchemas.add(otherPathToSchemas); - } catch (ValidationException ignored) {} + val otherPathToSchemas = validate( + containsSchema, arg[i], itemValidationMetadata + ) + containsPathToSchemas.add(otherPathToSchemas) + } catch (ignored: ValidationException) { + } } - return containsPathToSchemas; + return containsPathToSchemas } - private PathToSchemasMap getPatternPropertiesPathToSchemas( - @Nullable Object arg, - ValidationMetadata validationMetadata - ) throws ValidationException { - if (!(arg instanceof Map mapArg) || patternProperties == null) { - return new PathToSchemasMap(); - } - PathToSchemasMap pathToSchemas = new PathToSchemasMap(); - 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"); - } - List propPathToItem = new ArrayList<>(validationMetadata.pathToItem()); - propPathToItem.add(key); - ValidationMetadata propValidationMetadata = new ValidationMetadata( - propPathToItem, - validationMetadata.configuration(), - validationMetadata.validatedPathToSchemas(), - validationMetadata.seenClasses() - ); - for (Map.Entry>> patternPropEntry: patternProperties.entrySet()) { - if (!patternPropEntry.getKey().matcher(key).find()) { - continue; + @Throws(ValidationException::class) + private fun getPatternPropertiesPathToSchemas( + arg: Any?, + validationMetadata: ValidationMetadata + ): PathToSchemasMap { + if (arg !is Map<*, *> || patternProperties == null) { + return PathToSchemasMap() + } + val pathToSchemas = PathToSchemasMap() + for ((key, value) in arg) { + val entryKey = key!! as? String + ?: throw ValidationException("Invalid non-string type for map key") + val propPathToItem: MutableList = ArrayList(validationMetadata.pathToItem()) + propPathToItem.add(entryKey) + val propValidationMetadata = ValidationMetadata( + propPathToItem, + validationMetadata.configuration, + validationMetadata.validatedPathToSchemas, + validationMetadata.seenClasses + ) + for ((key1, patternPropClass) in patternProperties) { + if (!key1.matcher(entryKey).find()) { + continue } - - Class> patternPropClass = patternPropEntry.getValue(); - JsonSchema patternPropSchema = JsonSchemaFactory.getInstance(patternPropClass); - PathToSchemasMap otherPathToSchemas = JsonSchema.validate(patternPropSchema, entry.getValue(), propValidationMetadata); - pathToSchemas.update(otherPathToSchemas); + val patternPropSchema: JsonSchema<*> = JsonSchemaFactory.getInstance(patternPropClass) + val otherPathToSchemas = validate(patternPropSchema, value, propValidationMetadata) + pathToSchemas.update(otherPathToSchemas) } } - return pathToSchemas; + return pathToSchemas } - private PathToSchemasMap getIfPathToSchemas( - @Nullable Object arg, - ValidationMetadata validationMetadata - ) { + private fun getIfPathToSchemas( + arg: Any?, + validationMetadata: ValidationMetadata + ): PathToSchemasMap { if (ifSchema == null) { - return new PathToSchemasMap(); + return PathToSchemasMap() } - JsonSchema ifSchemaInstance = JsonSchemaFactory.getInstance(ifSchema); - PathToSchemasMap pathToSchemas = new PathToSchemasMap(); + val ifSchemaInstance: JsonSchema<*> = JsonSchemaFactory.getInstance(ifSchema) + val pathToSchemas = PathToSchemasMap() try { - var otherPathToSchemas = JsonSchema.validate(ifSchemaInstance, arg, validationMetadata); - pathToSchemas.update(otherPathToSchemas); - } catch (ValidationException ignored) {} - return pathToSchemas; - } - - public static PathToSchemasMap validate( - JsonSchema jsonSchema, - @Nullable Object arg, - ValidationMetadata validationMetadata - ) throws ValidationException { - LinkedHashSet disabledKeywords = validationMetadata.configuration().disabledKeywordFlags().getKeywords(); - PathToSchemasMap pathToSchemas = new PathToSchemasMap(); - LinkedHashMap thisKeywordToValidator = jsonSchema.keywordToValidator; - @Nullable List containsPathToSchemas = null; - if (thisKeywordToValidator.containsKey("contains")) { - containsPathToSchemas = jsonSchema.getContainsPathToSchemas(arg, validationMetadata); - } - @Nullable PathToSchemasMap patternPropertiesPathToSchemas = null; - if (thisKeywordToValidator.containsKey("patternProperties")) { - patternPropertiesPathToSchemas = jsonSchema.getPatternPropertiesPathToSchemas(arg, validationMetadata); - } - @Nullable PathToSchemasMap ifPathToSchemas = null; - if (thisKeywordToValidator.containsKey("if")) { - ifPathToSchemas = jsonSchema.getIfPathToSchemas(arg, validationMetadata); - } - @Nullable PathToSchemasMap knownPathToSchemas = null; - for (Map.Entry entry: thisKeywordToValidator.entrySet()) { - String jsonKeyword = entry.getKey(); - if (disabledKeywords.contains(jsonKeyword)) { - boolean typeIntegerUseCase = jsonKeyword.equals("format") && "int".equals(jsonSchema.format); - if (!typeIntegerUseCase) { - continue; - } - } - if ("unevaluatedItems".equals(jsonKeyword) || "unevaluatedProperties".equals(jsonKeyword)) { - knownPathToSchemas = pathToSchemas; - } - KeywordValidator validator = entry.getValue(); - ValidationData data = new ValidationData( - jsonSchema, - arg, - validationMetadata, - containsPathToSchemas, - patternPropertiesPathToSchemas, - ifPathToSchemas, - knownPathToSchemas - ); - @Nullable PathToSchemasMap otherPathToSchemas = validator.validate(data); - if (otherPathToSchemas == null) { - continue; - } - pathToSchemas.update(otherPathToSchemas); - } - List pathToItem = validationMetadata.pathToItem(); - if (!pathToSchemas.containsKey(pathToItem)) { - pathToSchemas.put(validationMetadata.pathToItem(), new LinkedHashMap<>()); + val otherPathToSchemas = validate(ifSchemaInstance, arg, validationMetadata) + pathToSchemas.update(otherPathToSchemas) + } catch (ignored: ValidationException) { } - @Nullable LinkedHashMap, Nothing?> schemas = pathToSchemas.get(pathToItem); - if (schemas != null) { - schemas.put(jsonSchema, null); - } - return pathToSchemas; + return pathToSchemas } - protected String castToAllowedTypes(String arg, List pathToItem, Set> pathSet) { - pathSet.add(pathToItem); - return arg; + protected fun castToAllowedTypes(arg: String, pathToItem: List?, pathSet: MutableSet?>): String { + pathSet.add(pathToItem) + return arg } - protected Boolean castToAllowedTypes(Boolean arg, List pathToItem, Set> pathSet) { - pathSet.add(pathToItem); - return arg; + protected fun castToAllowedTypes(arg: Boolean, pathToItem: List?, pathSet: MutableSet?>): Boolean { + pathSet.add(pathToItem) + return arg } - protected Number castToAllowedTypes(Number arg, List pathToItem, Set> pathSet) { - pathSet.add(pathToItem); - return arg; + protected fun castToAllowedTypes(arg: Number, pathToItem: List?, pathSet: MutableSet?>): Number { + pathSet.add(pathToItem) + return arg } - protected Nothing? castToAllowedTypes(Nothing? arg, List pathToItem, Set> pathSet) { - pathSet.add(pathToItem); - return arg; + protected fun castToAllowedTypes(arg: Void?, pathToItem: List?, pathSet: MutableSet?>): Void? { + pathSet.add(pathToItem) + return arg } - protected List castToAllowedTypes(List arg, List pathToItem, Set> pathSet) throws ValidationException { - pathSet.add(pathToItem); - List<@Nullable Object> argFixed = new ArrayList<>(); - int i =0; - for (Object item: arg) { - List newPathToItem = new ArrayList<>(pathToItem); - newPathToItem.add(i); - Object fixedVal = castToAllowedObjectTypes(item, newPathToItem, pathSet); - argFixed.add(fixedVal); - i += 1; - } - return argFixed; + @Throws(ValidationException::class) + protected fun castToAllowedTypes(arg: List<*>, pathToItem: List?, pathSet: MutableSet?>): List<*> { + pathSet.add(pathToItem) + val argFixed: MutableList = ArrayList() + var i = 0 + for (item in arg) { + val newPathToItem: MutableList = ArrayList(pathToItem) + newPathToItem.add(i) + val fixedVal = castToAllowedObjectTypes(item, newPathToItem, pathSet) + argFixed.add(fixedVal) + i += 1 + } + return argFixed } - 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 ValidationException("Invalid non-string key value"); + @Throws(ValidationException::class) + protected fun castToAllowedTypes( + arg: Map<*, *>, + pathToItem: List?, + pathSet: MutableSet?> + ): Map<*, *> { + pathSet.add(pathToItem) + val argFixed = LinkedHashMap() + for ((entryKey, value) in arg) { + if (entryKey !is String) { + throw ValidationException("Invalid non-string key value") } - Object val = entry.getValue(); - List newPathToItem = new ArrayList<>(pathToItem); - newPathToItem.add(key); - Object fixedVal = castToAllowedObjectTypes(val, newPathToItem, pathSet); - argFixed.put(key, fixedVal); + val `val` = value!! + val newPathToItem: MutableList = ArrayList(pathToItem) + newPathToItem.add(entryKey) + val fixedVal = castToAllowedObjectTypes(`val`, newPathToItem, pathSet) + argFixed[entryKey] = fixedVal } - return argFixed; + return argFixed } - private @Nullable Object castToAllowedObjectTypes(@Nullable Object arg, List pathToItem, Set> pathSet) throws ValidationException { - if (arg == null) { - return castToAllowedTypes((Nothing?) null, pathToItem, pathSet); - } else if (arg instanceof String) { - return castToAllowedTypes((String) arg, pathToItem, pathSet); - } else if (arg instanceof Map) { - pathSet.add(pathToItem); - return castToAllowedTypes((Map) arg, pathToItem, pathSet); - } else if (arg instanceof Boolean) { - return castToAllowedTypes((Boolean) arg, pathToItem, pathSet); - } else if (arg instanceof Integer) { - return castToAllowedTypes((Number) arg, pathToItem, pathSet); - } else if (arg instanceof Long) { - return castToAllowedTypes((Number) arg, pathToItem, pathSet); - } else if (arg instanceof Float) { - return castToAllowedTypes((Number) arg, pathToItem, pathSet); - } else if (arg instanceof Double) { - return castToAllowedTypes((Number) arg, pathToItem, pathSet); - } else if (arg instanceof List) { - return castToAllowedTypes((List) arg, pathToItem, pathSet); - } else if (arg instanceof ZonedDateTime) { - return castToAllowedTypes(arg.toString(), pathToItem, pathSet); - } else if (arg instanceof LocalDate) { - return castToAllowedTypes(arg.toString(), pathToItem, pathSet); - } else if (arg instanceof UUID) { - return castToAllowedTypes(arg.toString(), pathToItem, pathSet); + @Throws(ValidationException::class) + private fun castToAllowedObjectTypes(arg: Any?, pathToItem: List, pathSet: MutableSet?>): Any? { + return if (arg == null) { + castToAllowedTypes(null as Void?, pathToItem, pathSet) + } else if (arg is String) { + castToAllowedTypes(arg, pathToItem, pathSet) + } else if (arg is Map<*, *>) { + pathSet.add(pathToItem) + castToAllowedTypes(arg, pathToItem, pathSet) + } else if (arg is Boolean) { + castToAllowedTypes(arg, pathToItem, pathSet) + } else if (arg is Int) { + castToAllowedTypes(arg as Number, pathToItem, pathSet) + } else if (arg is Long) { + castToAllowedTypes(arg as Number, pathToItem, pathSet) + } else if (arg is Float) { + castToAllowedTypes(arg as Number, pathToItem, pathSet) + } else if (arg is Double) { + castToAllowedTypes(arg as Number, pathToItem, pathSet) + } else if (arg is List<*>) { + castToAllowedTypes(arg, pathToItem, pathSet) + } else if (arg is ZonedDateTime) { + castToAllowedTypes(arg.toString(), pathToItem, pathSet) + } else if (arg is LocalDate) { + castToAllowedTypes(arg.toString(), pathToItem, pathSet) + } else if (arg is UUID) { + castToAllowedTypes(arg.toString(), pathToItem, pathSet) } else { - Class argClass = arg.getClass(); - throw new ValidationException("Invalid type passed in for input="+arg+" type="+argClass); + val argClass: Class<*> = arg.javaClass + throw ValidationException("Invalid type passed in for input=$arg type=$argClass") } } - public Nothing? getNewInstance(Nothing? arg, List pathToItem, PathToSchemasMap pathToSchemas) { - return arg; + fun getNewInstance(arg: Void, pathToItem: List?, pathToSchemas: PathToSchemasMap?): Void { + return arg } - public boolean getNewInstance(boolean arg, List pathToItem, PathToSchemasMap pathToSchemas) { - return arg; + fun getNewInstance(arg: Boolean, pathToItem: List?, pathToSchemas: PathToSchemasMap?): Boolean { + return arg } - public Number getNewInstance(Number arg, List pathToItem, PathToSchemasMap pathToSchemas) { - return arg; + fun getNewInstance(arg: Number, pathToItem: List?, pathToSchemas: PathToSchemasMap?): Number { + return arg } - public String getNewInstance(String arg, List pathToItem, PathToSchemasMap pathToSchemas) { - return arg; + fun getNewInstance(arg: String, pathToItem: List?, pathToSchemas: PathToSchemasMap?): String { + return arg } - 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); - pathToSchemasMap.update(otherPathToSchemas); - for (var schemas: pathToSchemasMap.values()) { - JsonSchema firstSchema = schemas.entrySet().iterator().next().getKey(); - schemas.clear(); - schemas.put(firstSchema, null); - } - pathSet.removeAll(pathToSchemasMap.keySet()); - if (!pathSet.isEmpty()) { - LinkedHashMap, Nothing?> unsetAnyTypeSchema = new LinkedHashMap<>(); - unsetAnyTypeSchema.put(UnsetAnyTypeJsonSchema.UnsetAnyTypeJsonSchema1.getInstance(), null); - for (List pathToItem: pathSet) { - pathToSchemasMap.put(pathToItem, unsetAnyTypeSchema); + companion object { + @Throws(ValidationException::class) + fun validate( + jsonSchema: JsonSchema<*>, + arg: Any?, + validationMetadata: ValidationMetadata + ): PathToSchemasMap { + val disabledKeywords: LinkedHashSet = + validationMetadata.configuration.disabledKeywordFlags.keywords + val pathToSchemas = PathToSchemasMap() + val thisKeywordToValidator = jsonSchema.keywordToValidator + var containsPathToSchemas: List? = null + if (thisKeywordToValidator.containsKey("contains")) { + containsPathToSchemas = jsonSchema.getContainsPathToSchemas(arg, validationMetadata) + } + var patternPropertiesPathToSchemas: PathToSchemasMap? = null + if (thisKeywordToValidator.containsKey("patternProperties")) { + patternPropertiesPathToSchemas = jsonSchema.getPatternPropertiesPathToSchemas(arg, validationMetadata) } + var ifPathToSchemas: PathToSchemasMap? = null + if (thisKeywordToValidator.containsKey("if")) { + ifPathToSchemas = jsonSchema.getIfPathToSchemas(arg, validationMetadata) + } + var knownPathToSchemas: PathToSchemasMap? = null + for ((jsonKeyword, validator) in thisKeywordToValidator) { + if (disabledKeywords.contains(jsonKeyword)) { + val typeIntegerUseCase = jsonKeyword == "format" && "int" == jsonSchema.format + if (!typeIntegerUseCase) { + continue + } + } + if ("unevaluatedItems" == jsonKeyword || "unevaluatedProperties" == jsonKeyword) { + knownPathToSchemas = pathToSchemas + } + val data = ValidationData( + jsonSchema, + arg, + validationMetadata, + containsPathToSchemas, + patternPropertiesPathToSchemas, + ifPathToSchemas, + knownPathToSchemas + ) + val otherPathToSchemas = validator.validate(data) ?: continue + pathToSchemas.update(otherPathToSchemas) + } + val pathToItem: List = validationMetadata.pathToItem + if (!pathToSchemas.containsKey(pathToItem)) { + pathToSchemas[validationMetadata.pathToItem] = LinkedHashMap() + } + val schemas: LinkedHashMap, Nothing?>? = pathToSchemas[pathToItem] + if (schemas != null) { + schemas[jsonSchema] = null + } + return pathToSchemas } - return pathToSchemasMap; - } - public static String getClass(@Nullable Object arg) { - if (arg == null) { - return Nothing?.class.getSimpleName(); - } else { - return arg.getClass().getSimpleName(); + @Throws(ValidationException::class) + protected fun getPathToSchemas( + jsonSchema: JsonSchema<*>, + arg: Any?, + validationMetadata: ValidationMetadata, + pathSet: Set> + ): PathToSchemasMap { + val pathToSchemasMap = PathToSchemasMap() + // todo add check of validationMetadata.validationRanEarlier(this) + val otherPathToSchemas = validate(jsonSchema, arg, validationMetadata) + pathToSchemasMap.update(otherPathToSchemas) + for (schemas in pathToSchemasMap.values) { + val firstSchema: JsonSchema<*> = schemas!!.entries.iterator().next().key!! + schemas.clear() + schemas[firstSchema] = null + } + var mutPathSet: MutableSet> = pathSet.toMutableSet() + mutPathSet.removeAll(pathToSchemasMap.keys) + if (!mutPathSet.isEmpty()) { + val unsetAnyTypeSchema = LinkedHashMap, Nothing?>() + unsetAnyTypeSchema[UnsetAnyTypeJsonSchema.UnsetAnyTypeJsonSchema1.getInstance()] = null + for (pathToItem in mutPathSet) { + pathToSchemasMap[pathToItem] = unsetAnyTypeSchema + } + } + return pathToSchemasMap } + + fun getClass(arg: Any?): String { + return if (arg == null) { + Void::class.java.getSimpleName() + } else { + arg.javaClass.getSimpleName() + } + } // todo add bytes and FileIO } - // todo add bytes and FileIO } \ No newline at end of file diff --git a/src/main/resources/kotlin/src/main/kotlin/packagename/schemas/validation/JsonSchemaFactory.hbs b/src/main/resources/kotlin/src/main/kotlin/packagename/schemas/validation/JsonSchemaFactory.hbs index ee529fb4fa1..928f96e82b6 100644 --- a/src/main/resources/kotlin/src/main/kotlin/packagename/schemas/validation/JsonSchemaFactory.hbs +++ b/src/main/resources/kotlin/src/main/kotlin/packagename/schemas/validation/JsonSchemaFactory.hbs @@ -1,32 +1,29 @@ package {{{packageName}}}.schemas.validation; -import org.checkerframework.checker.nullness.qual.NonNull; -import org.checkerframework.checker.nullness.qual.Nullable; - import java.lang.reflect.InvocationTargetException; -import java.lang.reflect.Method; -import java.util.HashMap; -import java.util.Map; - -public class JsonSchemaFactory { - static Map>, JsonSchema> classToInstance = new HashMap<>(); +object JsonSchemaFactory { + private var classToInstance: MutableMap>, JsonSchema<*>> = HashMap() - public static > V getInstance(Class schemaCls) { - @Nullable JsonSchema cacheInst = classToInstance.get(schemaCls); - if (cacheInst != null) { - assert schemaCls.isInstance(cacheInst); - return schemaCls.cast(cacheInst); + fun > getInstance(schemaCls: Class): V { + val cacheInst: JsonSchema<*>? = classToInstance[schemaCls] + cacheInst?.let { + assert(schemaCls.isInstance(it)) + return schemaCls.cast(it) } try { - Method method = schemaCls.getMethod("getInstance"); - @SuppressWarnings("nullness") @NonNull Object obj = method.invoke(null); - assert schemaCls.isInstance(obj); - V inst = schemaCls.cast(obj); - classToInstance.put(schemaCls, inst); - return inst; - } catch (NoSuchMethodException | IllegalAccessException | InvocationTargetException e) { - throw new RuntimeException(e); + val method = schemaCls.getMethod("getInstance") + val obj = method.invoke(null) + assert(schemaCls.isInstance(obj)) + val inst = schemaCls.cast(obj) + classToInstance[schemaCls] = inst + return inst + } catch (e: NoSuchMethodException) { + throw RuntimeException(e) + } catch (e: IllegalAccessException) { + throw RuntimeException(e) + } catch (e: InvocationTargetException) { + throw RuntimeException(e) } } } \ No newline at end of file diff --git a/src/main/resources/kotlin/src/main/kotlin/packagename/schemas/validation/JsonSchemaInfo.hbs b/src/main/resources/kotlin/src/main/kotlin/packagename/schemas/validation/JsonSchemaInfo.hbs index 0d7527947c8..b840b11f7ec 100644 --- a/src/main/resources/kotlin/src/main/kotlin/packagename/schemas/validation/JsonSchemaInfo.hbs +++ b/src/main/resources/kotlin/src/main/kotlin/packagename/schemas/validation/JsonSchemaInfo.hbs @@ -1,210 +1,245 @@ package {{{packageName}}}.schemas.validation; import org.checkerframework.checker.nullness.qual.Nullable; -import java.math.BigDecimal; -import java.util.List; -import java.util.Map; -import java.util.Set; -import java.util.regex.Pattern; - -public class JsonSchemaInfo { - public @Nullable Set> type = null; - public JsonSchemaInfo type(Set> type) { - this.type = type; - return this; - } - public @Nullable String format = null; - public JsonSchemaInfo format(String format) { - this.format = format; - return this; - } - public @Nullable Class> items = null; - public JsonSchemaInfo items(Class> items) { - this.items = items; - return this; - } - public @Nullable Map>> properties = null; - public JsonSchemaInfo properties(Map>> properties) { - this.properties = properties; - return this; - } - public @Nullable Set required = null; - public JsonSchemaInfo required(Set required) { - this.required = required; - return this; - } - public @Nullable Number exclusiveMaximum = null; - public JsonSchemaInfo exclusiveMaximum(Number exclusiveMaximum) { - this.exclusiveMaximum = exclusiveMaximum; - return this; - } - public @Nullable Number exclusiveMinimum = null; - public JsonSchemaInfo exclusiveMinimum(Number exclusiveMinimum) { - this.exclusiveMinimum = exclusiveMinimum; - return this; - } - public @Nullable Integer maxItems = null; - public JsonSchemaInfo maxItems(Integer maxItems) { - this.maxItems = maxItems; - return this; - } - public @Nullable Integer minItems = null; - public JsonSchemaInfo minItems(Integer minItems) { - this.minItems = minItems; - return this; - } - public @Nullable Integer maxLength = null; - public JsonSchemaInfo maxLength(Integer maxLength) { - this.maxLength = maxLength; - return this; - } - public @Nullable Integer minLength = null; - public JsonSchemaInfo minLength(Integer minLength) { - this.minLength = minLength; - return this; - } - public @Nullable Integer maxProperties = null; - public JsonSchemaInfo maxProperties(Integer maxProperties) { - this.maxProperties = maxProperties; - return this; - } - public @Nullable Integer minProperties = null; - public JsonSchemaInfo minProperties(Integer minProperties) { - this.minProperties = minProperties; - return this; - } - public @Nullable Number maximum = null; - public JsonSchemaInfo maximum(Number maximum) { - this.maximum = maximum; - return this; - } - public @Nullable Number minimum = null; - public JsonSchemaInfo minimum(Number minimum) { - this.minimum = minimum; - return this; - } - public @Nullable BigDecimal multipleOf = null; - public JsonSchemaInfo multipleOf(BigDecimal multipleOf) { - this.multipleOf = multipleOf; - return this; - } - public @Nullable Class> additionalProperties; - public JsonSchemaInfo additionalProperties(Class> additionalProperties) { - this.additionalProperties = additionalProperties; - return this; - } - public @Nullable List>> allOf = null; - public JsonSchemaInfo allOf(List>> allOf) { - this.allOf = allOf; - return this; - } - public @Nullable List>> anyOf = null; - public JsonSchemaInfo anyOf(List>> anyOf) { - this.anyOf = anyOf; - return this; - } - public @Nullable List>> oneOf = null; - public JsonSchemaInfo oneOf(List>> oneOf) { - this.oneOf = oneOf; - return this; - } - public @Nullable Class> not = null; - public JsonSchemaInfo not(Class> not) { - this.not = not; - return this; - } - public @Nullable Boolean uniqueItems = null; - public JsonSchemaInfo uniqueItems(Boolean uniqueItems) { - this.uniqueItems = uniqueItems; - return this; - } - public @Nullable Set<@Nullable Object> enumValues = null; - public JsonSchemaInfo enumValues(Set<@Nullable Object> enumValues) { - this.enumValues = enumValues; - return this; - } - public @Nullable Pattern pattern = null; - public JsonSchemaInfo pattern(Pattern pattern) { - this.pattern = pattern; - return this; - } - public @Nullable Object defaultValue = null; - public boolean defaultValueSet = false; - public JsonSchemaInfo defaultValue(@Nullable Object defaultValue) { - this.defaultValue = defaultValue; - this.defaultValueSet = true; - return this; - } - public @Nullable Object constValue = null; - public boolean constValueSet = false; - public JsonSchemaInfo constValue(@Nullable Object constValue) { - this.constValue = constValue; - this.constValueSet = true; - return this; - } - public @Nullable Class> contains = null; - public JsonSchemaInfo contains(Class> contains) { - this.contains = contains; - return this; - } - public @Nullable Integer maxContains = null; - public JsonSchemaInfo maxContains(Integer maxContains) { - this.maxContains = maxContains; - return this; - } - public @Nullable Integer minContains = null; - public JsonSchemaInfo minContains(Integer minContains) { - this.minContains = minContains; - return this; - } - public @Nullable Class> propertyNames = null; - public JsonSchemaInfo propertyNames(Class> propertyNames) { - this.propertyNames = propertyNames; - return this; - } - public @Nullable Map> dependentRequired = null; - public JsonSchemaInfo dependentRequired(Map> dependentRequired) { - this.dependentRequired = dependentRequired; - return this; - } - public @Nullable Map>> dependentSchemas = null; - public JsonSchemaInfo dependentSchemas(Map>> dependentSchemas) { - this.dependentSchemas = dependentSchemas; - return this; - } - public @Nullable Map>> patternProperties = null; - public JsonSchemaInfo patternProperties(Map>> patternProperties) { - this.patternProperties = patternProperties; - return this; - } - public @Nullable List>> prefixItems = null; - public JsonSchemaInfo prefixItems(List>> prefixItems) { - this.prefixItems = prefixItems; - return this; - } - public @Nullable Class> ifSchema = null; - public JsonSchemaInfo ifSchema(Class> ifSchema) { - this.ifSchema = ifSchema; - return this; - } - public @Nullable Class> then = null; - public JsonSchemaInfo then(Class> then) { - this.then = then; - return this; - } - public @Nullable Class> elseSchema = null; - public JsonSchemaInfo elseSchema(Class> elseSchema) { - this.elseSchema = elseSchema; - return this; - } - public @Nullable Class> unevaluatedItems = null; - public JsonSchemaInfo unevaluatedItems(Class> unevaluatedItems) { - this.unevaluatedItems = unevaluatedItems; - return this; - } - public @Nullable Class> unevaluatedProperties = null; - public JsonSchemaInfo unevaluatedProperties(Class> unevaluatedProperties) { - this.unevaluatedProperties = unevaluatedProperties; - return this; +import java.math.BigDecimal +import java.util.regex.Pattern + +class JsonSchemaInfo { + var type: Set>? = null + fun type(type: Set>?): JsonSchemaInfo { + this.type = type + return this + } + + var format: String? = null + fun format(format: String?): JsonSchemaInfo { + this.format = format + return this + } + + var items: Class?>? = null + fun items(items: Class?>?): JsonSchemaInfo { + this.items = items + return this + } + + var properties: Map?>>? = null + fun properties(properties: Map?>>?): JsonSchemaInfo { + this.properties = properties + return this + } + + var required: Set? = null + fun required(required: Set?): JsonSchemaInfo { + this.required = required + return this + } + + var exclusiveMaximum: Number? = null + fun exclusiveMaximum(exclusiveMaximum: Number?): JsonSchemaInfo { + this.exclusiveMaximum = exclusiveMaximum + return this + } + + var exclusiveMinimum: Number? = null + fun exclusiveMinimum(exclusiveMinimum: Number?): JsonSchemaInfo { + this.exclusiveMinimum = exclusiveMinimum + return this + } + + var maxItems: Int? = null + fun maxItems(maxItems: Int?): JsonSchemaInfo { + this.maxItems = maxItems + return this + } + + var minItems: Int? = null + fun minItems(minItems: Int?): JsonSchemaInfo { + this.minItems = minItems + return this + } + + var maxLength: Int? = null + fun maxLength(maxLength: Int?): JsonSchemaInfo { + this.maxLength = maxLength + return this + } + + var minLength: Int? = null + fun minLength(minLength: Int?): JsonSchemaInfo { + this.minLength = minLength + return this + } + + var maxProperties: Int? = null + fun maxProperties(maxProperties: Int?): JsonSchemaInfo { + this.maxProperties = maxProperties + return this + } + + var minProperties: Int? = null + fun minProperties(minProperties: Int?): JsonSchemaInfo { + this.minProperties = minProperties + return this + } + + var maximum: Number? = null + fun maximum(maximum: Number?): JsonSchemaInfo { + this.maximum = maximum + return this + } + + var minimum: Number? = null + fun minimum(minimum: Number?): JsonSchemaInfo { + this.minimum = minimum + return this + } + + var multipleOf: BigDecimal? = null + fun multipleOf(multipleOf: BigDecimal?): JsonSchemaInfo { + this.multipleOf = multipleOf + return this + } + + var additionalProperties: Class?>? = null + fun additionalProperties(additionalProperties: Class?>?): JsonSchemaInfo { + this.additionalProperties = additionalProperties + return this + } + + var allOf: List?>>? = null + fun allOf(allOf: List?>>?): JsonSchemaInfo { + this.allOf = allOf + return this + } + + var anyOf: List?>>? = null + fun anyOf(anyOf: List?>>?): JsonSchemaInfo { + this.anyOf = anyOf + return this + } + + var oneOf: List?>>? = null + fun oneOf(oneOf: List?>>?): JsonSchemaInfo { + this.oneOf = oneOf + return this + } + + var not: Class?>? = null + fun not(not: Class?>?): JsonSchemaInfo { + this.not = not + return this + } + + var uniqueItems: Boolean? = null + fun uniqueItems(uniqueItems: Boolean?): JsonSchemaInfo { + this.uniqueItems = uniqueItems + return this + } + + var enumValues: Set? = null + fun enumValues(enumValues: Set?): JsonSchemaInfo { + this.enumValues = enumValues + return this + } + + var pattern: Pattern? = null + fun pattern(pattern: Pattern?): JsonSchemaInfo { + this.pattern = pattern + return this + } + + var defaultValue: Any? = null + var defaultValueSet = false + fun defaultValue(defaultValue: Any?): JsonSchemaInfo { + this.defaultValue = defaultValue + defaultValueSet = true + return this + } + + var constValue: Any? = null + var constValueSet = false + fun constValue(constValue: Any?): JsonSchemaInfo { + this.constValue = constValue + constValueSet = true + return this + } + + var contains: Class?>? = null + fun contains(contains: Class?>?): JsonSchemaInfo { + this.contains = contains + return this + } + + var maxContains: Int? = null + fun maxContains(maxContains: Int?): JsonSchemaInfo { + this.maxContains = maxContains + return this + } + + var minContains: Int? = null + fun minContains(minContains: Int?): JsonSchemaInfo { + this.minContains = minContains + return this + } + + var propertyNames: Class?>? = null + fun propertyNames(propertyNames: Class?>?): JsonSchemaInfo { + this.propertyNames = propertyNames + return this + } + + var dependentRequired: Map>? = null + fun dependentRequired(dependentRequired: Map>?): JsonSchemaInfo { + this.dependentRequired = dependentRequired + return this + } + + var dependentSchemas: Map?>>? = null + fun dependentSchemas(dependentSchemas: Map?>>?): JsonSchemaInfo { + this.dependentSchemas = dependentSchemas + return this + } + + var patternProperties: Map?>>? = null + fun patternProperties(patternProperties: Map?>>?): JsonSchemaInfo { + this.patternProperties = patternProperties + return this + } + + var prefixItems: List?>>? = null + fun prefixItems(prefixItems: List?>>?): JsonSchemaInfo { + this.prefixItems = prefixItems + return this + } + + var ifSchema: Class?>? = null + fun ifSchema(ifSchema: Class?>?): JsonSchemaInfo { + this.ifSchema = ifSchema + return this + } + + var then: Class?>? = null + fun then(then: Class?>?): JsonSchemaInfo { + this.then = then + return this + } + + var elseSchema: Class?>? = null + fun elseSchema(elseSchema: Class?>?): JsonSchemaInfo { + this.elseSchema = elseSchema + return this + } + + var unevaluatedItems: Class?>? = null + fun unevaluatedItems(unevaluatedItems: Class?>?): JsonSchemaInfo { + this.unevaluatedItems = unevaluatedItems + return this + } + + var unevaluatedProperties: Class?>? = null + fun unevaluatedProperties(unevaluatedProperties: Class?>?): JsonSchemaInfo { + this.unevaluatedProperties = unevaluatedProperties + return this } } \ No newline at end of file diff --git a/src/main/resources/kotlin/src/main/kotlin/packagename/schemas/validation/KeywordValidator.hbs b/src/main/resources/kotlin/src/main/kotlin/packagename/schemas/validation/KeywordValidator.hbs index 5c0b37e2c91..8ed6092e1a8 100644 --- a/src/main/resources/kotlin/src/main/kotlin/packagename/schemas/validation/KeywordValidator.hbs +++ b/src/main/resources/kotlin/src/main/kotlin/packagename/schemas/validation/KeywordValidator.hbs @@ -5,6 +5,6 @@ import {{{packageName}}}.exceptions.ValidationException; fun interface KeywordValidator { @Throws(ValidationException::class) fun validate( - data: ValidationData? + data: ValidationData ): PathToSchemasMap? } \ No newline at end of file diff --git a/src/main/resources/kotlin/src/main/kotlin/packagename/schemas/validation/PathToSchemasMap.hbs b/src/main/resources/kotlin/src/main/kotlin/packagename/schemas/validation/PathToSchemasMap.hbs index fea11730a25..bdb4e341e59 100644 --- a/src/main/resources/kotlin/src/main/kotlin/packagename/schemas/validation/PathToSchemasMap.hbs +++ b/src/main/resources/kotlin/src/main/kotlin/packagename/schemas/validation/PathToSchemasMap.hbs @@ -1,10 +1,10 @@ package {{{packageName}}}.schemas.validation; -class PathToSchemasMap : LinkedHashMap?, LinkedHashMap?, Nothing?>?>() { +class PathToSchemasMap : LinkedHashMap, LinkedHashMap, Nothing?>>() { fun update(other: PathToSchemasMap) { for ((pathToItem, otherSchemas) in other) { if (containsKey(pathToItem)) { - get(pathToItem)!!.putAll(otherSchemas!!) + get(pathToItem)!!.putAll(otherSchemas) } else { put(pathToItem, otherSchemas) } From c5513c44df25c469e8e7147c8cb3e9a2bfe7f47c Mon Sep 17 00:00:00 2001 From: Justin Black Date: Mon, 6 May 2024 16:00:59 -0700 Subject: [PATCH 07/78] Reverts java templates --- .../schemas/validation/JsonSchema.hbs | 855 +++++++++--------- .../schemas/validation/JsonSchemaFactory.hbs | 43 +- .../schemas/validation/JsonSchemaInfo.hbs | 448 +++++---- 3 files changed, 656 insertions(+), 690 deletions(-) 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 7afb4d72329..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,502 +1,499 @@ package {{{packageName}}}.schemas.validation; +import org.checkerframework.checker.nullness.qual.Nullable; import {{{packageName}}}.configurations.SchemaConfiguration; import {{{packageName}}}.exceptions.ValidationException; -import java.math.BigDecimal -import java.time.LocalDate -import java.time.ZonedDateTime -import java.util.regex.Pattern -import java.util.UUID +import java.math.BigDecimal; +import java.time.LocalDate; +import java.time.ZonedDateTime; +import java.util.ArrayList; +import java.util.LinkedHashMap; +import java.util.LinkedHashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; +import java.util.UUID; +import java.util.regex.Pattern; -abstract class JsonSchema protected constructor(jsonSchemaInfo: JsonSchemaInfo) { - val type: Set>? - val format: String? - val items: Class?>? - val properties: Map?>>? - val required: Set? - val exclusiveMaximum: Number? - val exclusiveMinimum: Number? - val maxItems: Int? - val minItems: Int? - val maxLength: Int? - val minLength: Int? - val maxProperties: Int? - val minProperties: Int? - val maximum: Number? - val minimum: Number? - val multipleOf: BigDecimal? - val additionalProperties: Class?>? - val allOf: List?>>? - val anyOf: List?>>? - val oneOf: List?>>? - val not: Class?>? - val uniqueItems: Boolean? - val enumValues: Set? - val pattern: Pattern? - val defaultValue: Any? - val defaultValueSet: Boolean - val constValue: Any? - val constValueSet: Boolean - val contains: Class?>? - val maxContains: Int? - val minContains: Int? - val propertyNames: Class?>? - val dependentRequired: Map>? - val dependentSchemas: Map?>>? - val patternProperties: Map?>>? - val prefixItems: List?>>? - val ifSchema: Class?>? - val then: Class?>? - val elseSchema: Class?>? - val unevaluatedItems: Class?>? - val unevaluatedProperties: Class?>? - private val keywordToValidator: LinkedHashMap +public abstract class JsonSchema { + public final @Nullable Set> type; + public final @Nullable String format; + public final @Nullable Class> items; + public final @Nullable Map>> properties; + public final @Nullable Set required; + public final @Nullable Number exclusiveMaximum; + public final @Nullable Number exclusiveMinimum; + public final @Nullable Integer maxItems; + public final @Nullable Integer minItems; + public final @Nullable Integer maxLength; + public final @Nullable Integer minLength; + public final @Nullable Integer maxProperties; + public final @Nullable Integer minProperties; + public final @Nullable Number maximum; + public final @Nullable Number minimum; + public final @Nullable BigDecimal multipleOf; + public final @Nullable Class> additionalProperties; + public final @Nullable List>> allOf; + public final @Nullable List>> anyOf; + public final @Nullable List>> oneOf; + public final @Nullable Class> not; + public final @Nullable Boolean uniqueItems; + public final @Nullable Set<@Nullable Object> enumValues; + public final @Nullable Pattern pattern; + public final @Nullable Object defaultValue; + public final boolean defaultValueSet; + public final @Nullable Object constValue; + public final boolean constValueSet; + public final @Nullable Class> contains; + public final @Nullable Integer maxContains; + public final @Nullable Integer minContains; + public final @Nullable Class> propertyNames; + public final @Nullable Map> dependentRequired; + public final @Nullable Map>> dependentSchemas; + public final @Nullable Map>> patternProperties; + public final @Nullable List>> prefixItems; + public final @Nullable Class> ifSchema; + public final @Nullable Class> then; + public final @Nullable Class> elseSchema; + public final @Nullable Class> unevaluatedItems; + public final @Nullable Class> unevaluatedProperties; + private final LinkedHashMap keywordToValidator; - init { - val keywordToValidator = LinkedHashMap() - type = jsonSchemaInfo.type - if (type != null) { - keywordToValidator["type"] = TypeValidator() - } - format = jsonSchemaInfo.format - if (format != null) { - keywordToValidator["format"] = FormatValidator() - } - items = jsonSchemaInfo.items - if (items != null) { - keywordToValidator["items"] = ItemsValidator() - } - properties = jsonSchemaInfo.properties - if (properties != null) { - keywordToValidator["properties"] = PropertiesValidator() - } - required = jsonSchemaInfo.required - if (required != null) { - keywordToValidator["required"] = RequiredValidator() - } - exclusiveMaximum = jsonSchemaInfo.exclusiveMaximum - if (exclusiveMaximum != null) { - keywordToValidator["exclusiveMaximum"] = ExclusiveMaximumValidator() - } - exclusiveMinimum = jsonSchemaInfo.exclusiveMinimum - if (exclusiveMinimum != null) { - keywordToValidator["exclusiveMinimum"] = ExclusiveMinimumValidator() - } - maxItems = jsonSchemaInfo.maxItems - if (maxItems != null) { - keywordToValidator["maxItems"] = MaxItemsValidator() - } - minItems = jsonSchemaInfo.minItems - if (minItems != null) { - keywordToValidator["minItems"] = MinItemsValidator() - } - maxLength = jsonSchemaInfo.maxLength - if (maxLength != null) { - keywordToValidator["maxLength"] = MaxLengthValidator() - } - minLength = jsonSchemaInfo.minLength - if (minLength != null) { - keywordToValidator["minLength"] = MinLengthValidator() - } - maxProperties = jsonSchemaInfo.maxProperties - if (maxProperties != null) { - keywordToValidator["maxProperties"] = MaxPropertiesValidator() - } - minProperties = jsonSchemaInfo.minProperties - if (minProperties != null) { - keywordToValidator["minProperties"] = MinPropertiesValidator() - } - maximum = jsonSchemaInfo.maximum - if (maximum != null) { - keywordToValidator["maximum"] = MaximumValidator() - } - minimum = jsonSchemaInfo.minimum - if (minimum != null) { - keywordToValidator["minimum"] = MinimumValidator() - } - multipleOf = jsonSchemaInfo.multipleOf - if (multipleOf != null) { - keywordToValidator["multipleOf"] = MultipleOfValidator() - } - additionalProperties = jsonSchemaInfo.additionalProperties - if (additionalProperties != null) { - keywordToValidator["additionalProperties"] = AdditionalPropertiesValidator() - } - allOf = jsonSchemaInfo.allOf - if (allOf != null) { - keywordToValidator["allOf"] = AllOfValidator() - } - anyOf = jsonSchemaInfo.anyOf - if (anyOf != null) { - keywordToValidator["anyOf"] = AnyOfValidator() - } - oneOf = jsonSchemaInfo.oneOf - if (oneOf != null) { - keywordToValidator["oneOf"] = OneOfValidator() - } - not = jsonSchemaInfo.not - if (not != null) { - keywordToValidator["not"] = NotValidator() - } - uniqueItems = jsonSchemaInfo.uniqueItems - if (uniqueItems != null) { - keywordToValidator["uniqueItems"] = UniqueItemsValidator() - } - enumValues = jsonSchemaInfo.enumValues - if (enumValues != null) { - keywordToValidator["enum"] = EnumValidator() - } - pattern = jsonSchemaInfo.pattern - if (pattern != null) { - keywordToValidator["pattern"] = PatternValidator() - } - defaultValue = jsonSchemaInfo.defaultValue - defaultValueSet = jsonSchemaInfo.defaultValueSet - constValue = jsonSchemaInfo.constValue - constValueSet = jsonSchemaInfo.constValueSet - if (constValueSet) { - keywordToValidator["const"] = ConstValidator() + protected JsonSchema(JsonSchemaInfo jsonSchemaInfo) { + LinkedHashMap keywordToValidator = new LinkedHashMap<>(); + this.type = jsonSchemaInfo.type; + if (this.type != null) { + keywordToValidator.put("type", new TypeValidator()); + } + this.format = jsonSchemaInfo.format; + if (this.format != null) { + keywordToValidator.put("format", new FormatValidator()); + } + this.items = jsonSchemaInfo.items; + if (this.items != null) { + keywordToValidator.put("items", new ItemsValidator()); + } + this.properties = jsonSchemaInfo.properties; + if (this.properties != null) { + keywordToValidator.put("properties", new PropertiesValidator()); + } + this.required = jsonSchemaInfo.required; + if (this.required != null) { + keywordToValidator.put("required", new RequiredValidator()); + } + this.exclusiveMaximum = jsonSchemaInfo.exclusiveMaximum; + if (this.exclusiveMaximum != null) { + keywordToValidator.put("exclusiveMaximum", new ExclusiveMaximumValidator()); + } + this.exclusiveMinimum = jsonSchemaInfo.exclusiveMinimum; + if (this.exclusiveMinimum != null) { + keywordToValidator.put("exclusiveMinimum", new ExclusiveMinimumValidator()); + } + this.maxItems = jsonSchemaInfo.maxItems; + if (this.maxItems != null) { + keywordToValidator.put("maxItems", new MaxItemsValidator()); + } + this.minItems = jsonSchemaInfo.minItems; + if (this.minItems != null) { + keywordToValidator.put("minItems", new MinItemsValidator()); + } + this.maxLength = jsonSchemaInfo.maxLength; + if (this.maxLength != null) { + keywordToValidator.put("maxLength", new MaxLengthValidator()); + } + this.minLength = jsonSchemaInfo.minLength; + if (this.minLength != null) { + keywordToValidator.put("minLength", new MinLengthValidator()); + } + this.maxProperties = jsonSchemaInfo.maxProperties; + if (this.maxProperties != null) { + keywordToValidator.put("maxProperties", new MaxPropertiesValidator()); + } + this.minProperties = jsonSchemaInfo.minProperties; + if (this.minProperties != null) { + keywordToValidator.put("minProperties", new MinPropertiesValidator()); + } + this.maximum = jsonSchemaInfo.maximum; + if (this.maximum != null) { + keywordToValidator.put("maximum", new MaximumValidator()); + } + this.minimum = jsonSchemaInfo.minimum; + if (this.minimum != null) { + keywordToValidator.put("minimum", new MinimumValidator()); + } + this.multipleOf = jsonSchemaInfo.multipleOf; + if (this.multipleOf != null) { + keywordToValidator.put("multipleOf", new MultipleOfValidator()); + } + this.additionalProperties = jsonSchemaInfo.additionalProperties; + if (this.additionalProperties != null) { + keywordToValidator.put("additionalProperties", new AdditionalPropertiesValidator()); + } + this.allOf = jsonSchemaInfo.allOf; + if (this.allOf != null) { + keywordToValidator.put("allOf", new AllOfValidator()); + } + this.anyOf = jsonSchemaInfo.anyOf; + if (this.anyOf != null) { + keywordToValidator.put("anyOf", new AnyOfValidator()); + } + this.oneOf = jsonSchemaInfo.oneOf; + if (this.oneOf != null) { + keywordToValidator.put("oneOf", new OneOfValidator()); + } + this.not = jsonSchemaInfo.not; + if (this.not != null) { + keywordToValidator.put("not", new NotValidator()); + } + this.uniqueItems = jsonSchemaInfo.uniqueItems; + if (this.uniqueItems != null) { + keywordToValidator.put("uniqueItems", new UniqueItemsValidator()); + } + this.enumValues = jsonSchemaInfo.enumValues; + if (this.enumValues != null) { + keywordToValidator.put("enum", new EnumValidator()); + } + this.pattern = jsonSchemaInfo.pattern; + if (this.pattern != null) { + keywordToValidator.put("pattern", new PatternValidator()); + } + this.defaultValue = jsonSchemaInfo.defaultValue; + this.defaultValueSet = jsonSchemaInfo.defaultValueSet; + this.constValue = jsonSchemaInfo.constValue; + this.constValueSet = jsonSchemaInfo.constValueSet; + if (this.constValueSet) { + keywordToValidator.put("const", new ConstValidator()); } - contains = jsonSchemaInfo.contains - if (contains != null) { - keywordToValidator["contains"] = ContainsValidator() + this.contains = jsonSchemaInfo.contains; + if (this.contains != null) { + keywordToValidator.put("contains", new ContainsValidator()); } - maxContains = jsonSchemaInfo.maxContains - if (maxContains != null) { - keywordToValidator["maxContains"] = MaxContainsValidator() + this.maxContains = jsonSchemaInfo.maxContains; + if (this.maxContains != null) { + keywordToValidator.put("maxContains", new MaxContainsValidator()); } - minContains = jsonSchemaInfo.minContains - if (minContains != null) { - keywordToValidator["minContains"] = MinContainsValidator() + this.minContains = jsonSchemaInfo.minContains; + if (this.minContains != null) { + keywordToValidator.put("minContains", new MinContainsValidator()); } - propertyNames = jsonSchemaInfo.propertyNames - if (propertyNames != null) { - keywordToValidator["propertyNames"] = PropertyNamesValidator() + this.propertyNames = jsonSchemaInfo.propertyNames; + if (this.propertyNames != null) { + keywordToValidator.put("propertyNames", new PropertyNamesValidator()); } - dependentRequired = jsonSchemaInfo.dependentRequired - if (dependentRequired != null) { - keywordToValidator["dependentRequired"] = DependentRequiredValidator() + this.dependentRequired = jsonSchemaInfo.dependentRequired; + if (this.dependentRequired != null) { + keywordToValidator.put("dependentRequired", new DependentRequiredValidator()); } - dependentSchemas = jsonSchemaInfo.dependentSchemas - if (dependentSchemas != null) { - keywordToValidator["dependentSchemas"] = DependentSchemasValidator() + this.dependentSchemas = jsonSchemaInfo.dependentSchemas; + if (this.dependentSchemas != null) { + keywordToValidator.put("dependentSchemas", new DependentSchemasValidator()); } - patternProperties = jsonSchemaInfo.patternProperties - if (patternProperties != null) { - keywordToValidator["patternProperties"] = PatternPropertiesValidator() + this.patternProperties = jsonSchemaInfo.patternProperties; + if (this.patternProperties != null) { + keywordToValidator.put("patternProperties", new PatternPropertiesValidator()); } - prefixItems = jsonSchemaInfo.prefixItems - if (prefixItems != null) { - keywordToValidator["prefixItems"] = PrefixItemsValidator() + this.prefixItems = jsonSchemaInfo.prefixItems; + if (this.prefixItems != null) { + keywordToValidator.put("prefixItems", new PrefixItemsValidator()); } - ifSchema = jsonSchemaInfo.ifSchema - if (ifSchema != null) { - keywordToValidator["if"] = IfValidator() + this.ifSchema = jsonSchemaInfo.ifSchema; + if (this.ifSchema != null) { + keywordToValidator.put("if", new IfValidator()); } - then = jsonSchemaInfo.then - if (then != null) { - keywordToValidator["then"] = ThenValidator() + this.then = jsonSchemaInfo.then; + if (this.then != null) { + keywordToValidator.put("then", new ThenValidator()); } - elseSchema = jsonSchemaInfo.elseSchema - if (elseSchema != null) { - keywordToValidator["else"] = ElseValidator() + this.elseSchema = jsonSchemaInfo.elseSchema; + if (this.elseSchema != null) { + keywordToValidator.put("else", new ElseValidator()); } - unevaluatedItems = jsonSchemaInfo.unevaluatedItems - if (unevaluatedItems != null) { - keywordToValidator["unevaluatedItems"] = UnevaluatedItemsValidator() + this.unevaluatedItems = jsonSchemaInfo.unevaluatedItems; + if (this.unevaluatedItems != null) { + keywordToValidator.put("unevaluatedItems", new UnevaluatedItemsValidator()); } - unevaluatedProperties = jsonSchemaInfo.unevaluatedProperties - if (unevaluatedProperties != null) { - keywordToValidator["unevaluatedProperties"] = UnevaluatedPropertiesValidator() + this.unevaluatedProperties = jsonSchemaInfo.unevaluatedProperties; + if (this.unevaluatedProperties != null) { + keywordToValidator.put("unevaluatedProperties", new UnevaluatedPropertiesValidator()); } - this.keywordToValidator = keywordToValidator + this.keywordToValidator = keywordToValidator; } - abstract fun getNewInstance(arg: Any?, pathToItem: List?, pathToSchemas: PathToSchemasMap?): Any? - @Throws(ValidationException::class) - abstract fun validate(arg: Any?, configuration: SchemaConfiguration?): Any? - @Throws(ValidationException::class) - abstract fun validateAndBox(arg: Any?, configuration: SchemaConfiguration?): T - private fun getContainsPathToSchemas( - arg: Any?, - validationMetadata: ValidationMetadata - ): List? { - if (arg !is List<*> || contains == null) { - return ArrayList() - } - val containsSchema: JsonSchema<*> = JsonSchemaFactory.getInstance(contains) - val containsPathToSchemas: MutableList = ArrayList() - for (i in arg.indices) { - val thesePathToSchemas = PathToSchemasMap() - val itemPathToItem: MutableList = ArrayList(validationMetadata.pathToItem) - itemPathToItem.add(i) - val itemValidationMetadata = ValidationMetadata( - itemPathToItem, - validationMetadata.configuration, - validationMetadata.validatedPathToSchemas, - validationMetadata.seenClasses - ) + 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, + ValidationMetadata validationMetadata + ) { + if (!(arg instanceof List listArg) || contains == null) { + return new ArrayList<>(); + } + JsonSchema containsSchema = JsonSchemaFactory.getInstance(contains); + @Nullable List containsPathToSchemas = new ArrayList<>(); + for(int i = 0; i < listArg.size(); i++) { + PathToSchemasMap thesePathToSchemas = new PathToSchemasMap(); + List itemPathToItem = new ArrayList<>(validationMetadata.pathToItem()); + itemPathToItem.add(i); + ValidationMetadata itemValidationMetadata = new ValidationMetadata( + itemPathToItem, + validationMetadata.configuration(), + validationMetadata.validatedPathToSchemas(), + validationMetadata.seenClasses() + ); if (itemValidationMetadata.validationRanEarlier(containsSchema)) { // todo add_deeper_validated_schemas - containsPathToSchemas.add(thesePathToSchemas) - continue + containsPathToSchemas.add(thesePathToSchemas); + continue; } + try { - val otherPathToSchemas = validate( - containsSchema, arg[i], itemValidationMetadata - ) - containsPathToSchemas.add(otherPathToSchemas) - } catch (ignored: ValidationException) { - } + PathToSchemasMap otherPathToSchemas = JsonSchema.validate( + containsSchema, listArg.get(i), itemValidationMetadata); + containsPathToSchemas.add(otherPathToSchemas); + } catch (ValidationException ignored) {} } - return containsPathToSchemas + return containsPathToSchemas; } - @Throws(ValidationException::class) - private fun getPatternPropertiesPathToSchemas( - arg: Any?, - validationMetadata: ValidationMetadata - ): PathToSchemasMap { - if (arg !is Map<*, *> || patternProperties == null) { - return PathToSchemasMap() - } - val pathToSchemas = PathToSchemasMap() - for ((key, value) in arg) { - val entryKey = key!! as? String - ?: throw ValidationException("Invalid non-string type for map key") - val propPathToItem: MutableList = ArrayList(validationMetadata.pathToItem()) - propPathToItem.add(entryKey) - val propValidationMetadata = ValidationMetadata( - propPathToItem, - validationMetadata.configuration, - validationMetadata.validatedPathToSchemas, - validationMetadata.seenClasses - ) - for ((key1, patternPropClass) in patternProperties) { - if (!key1.matcher(entryKey).find()) { - continue + private PathToSchemasMap getPatternPropertiesPathToSchemas( + @Nullable Object arg, + ValidationMetadata validationMetadata + ) throws ValidationException { + if (!(arg instanceof Map mapArg) || patternProperties == null) { + return new PathToSchemasMap(); + } + PathToSchemasMap pathToSchemas = new PathToSchemasMap(); + 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"); + } + List propPathToItem = new ArrayList<>(validationMetadata.pathToItem()); + propPathToItem.add(key); + ValidationMetadata propValidationMetadata = new ValidationMetadata( + propPathToItem, + validationMetadata.configuration(), + validationMetadata.validatedPathToSchemas(), + validationMetadata.seenClasses() + ); + for (Map.Entry>> patternPropEntry: patternProperties.entrySet()) { + if (!patternPropEntry.getKey().matcher(key).find()) { + continue; } - val patternPropSchema: JsonSchema<*> = JsonSchemaFactory.getInstance(patternPropClass) - val otherPathToSchemas = validate(patternPropSchema, value, propValidationMetadata) - pathToSchemas.update(otherPathToSchemas) + + Class> patternPropClass = patternPropEntry.getValue(); + JsonSchema patternPropSchema = JsonSchemaFactory.getInstance(patternPropClass); + PathToSchemasMap otherPathToSchemas = JsonSchema.validate(patternPropSchema, entry.getValue(), propValidationMetadata); + pathToSchemas.update(otherPathToSchemas); } } - return pathToSchemas + return pathToSchemas; } - private fun getIfPathToSchemas( - arg: Any?, - validationMetadata: ValidationMetadata - ): PathToSchemasMap { + private PathToSchemasMap getIfPathToSchemas( + @Nullable Object arg, + ValidationMetadata validationMetadata + ) { if (ifSchema == null) { - return PathToSchemasMap() + return new PathToSchemasMap(); } - val ifSchemaInstance: JsonSchema<*> = JsonSchemaFactory.getInstance(ifSchema) - val pathToSchemas = PathToSchemasMap() + JsonSchema ifSchemaInstance = JsonSchemaFactory.getInstance(ifSchema); + PathToSchemasMap pathToSchemas = new PathToSchemasMap(); try { - val otherPathToSchemas = validate(ifSchemaInstance, arg, validationMetadata) - pathToSchemas.update(otherPathToSchemas) - } catch (ignored: ValidationException) { + var otherPathToSchemas = JsonSchema.validate(ifSchemaInstance, arg, validationMetadata); + pathToSchemas.update(otherPathToSchemas); + } catch (ValidationException ignored) {} + return pathToSchemas; + } + + public static PathToSchemasMap validate( + JsonSchema jsonSchema, + @Nullable Object arg, + ValidationMetadata validationMetadata + ) throws ValidationException { + LinkedHashSet disabledKeywords = validationMetadata.configuration().disabledKeywordFlags().getKeywords(); + PathToSchemasMap pathToSchemas = new PathToSchemasMap(); + LinkedHashMap thisKeywordToValidator = jsonSchema.keywordToValidator; + @Nullable List containsPathToSchemas = null; + if (thisKeywordToValidator.containsKey("contains")) { + containsPathToSchemas = jsonSchema.getContainsPathToSchemas(arg, validationMetadata); + } + @Nullable PathToSchemasMap patternPropertiesPathToSchemas = null; + if (thisKeywordToValidator.containsKey("patternProperties")) { + patternPropertiesPathToSchemas = jsonSchema.getPatternPropertiesPathToSchemas(arg, validationMetadata); + } + @Nullable PathToSchemasMap ifPathToSchemas = null; + if (thisKeywordToValidator.containsKey("if")) { + ifPathToSchemas = jsonSchema.getIfPathToSchemas(arg, validationMetadata); + } + @Nullable PathToSchemasMap knownPathToSchemas = null; + for (Map.Entry entry: thisKeywordToValidator.entrySet()) { + String jsonKeyword = entry.getKey(); + if (disabledKeywords.contains(jsonKeyword)) { + boolean typeIntegerUseCase = jsonKeyword.equals("format") && "int".equals(jsonSchema.format); + if (!typeIntegerUseCase) { + continue; + } + } + if ("unevaluatedItems".equals(jsonKeyword) || "unevaluatedProperties".equals(jsonKeyword)) { + knownPathToSchemas = pathToSchemas; + } + KeywordValidator validator = entry.getValue(); + ValidationData data = new ValidationData( + jsonSchema, + arg, + validationMetadata, + containsPathToSchemas, + patternPropertiesPathToSchemas, + ifPathToSchemas, + knownPathToSchemas + ); + @Nullable PathToSchemasMap otherPathToSchemas = validator.validate(data); + if (otherPathToSchemas == null) { + continue; + } + pathToSchemas.update(otherPathToSchemas); + } + List pathToItem = validationMetadata.pathToItem(); + if (!pathToSchemas.containsKey(pathToItem)) { + pathToSchemas.put(validationMetadata.pathToItem(), new LinkedHashMap<>()); } - return pathToSchemas + @Nullable LinkedHashMap, Void> schemas = pathToSchemas.get(pathToItem); + if (schemas != null) { + schemas.put(jsonSchema, null); + } + return pathToSchemas; } - protected fun castToAllowedTypes(arg: String, pathToItem: List?, pathSet: MutableSet?>): String { - pathSet.add(pathToItem) - return arg + protected String castToAllowedTypes(String arg, List pathToItem, Set> pathSet) { + pathSet.add(pathToItem); + return arg; } - protected fun castToAllowedTypes(arg: Boolean, pathToItem: List?, pathSet: MutableSet?>): Boolean { - pathSet.add(pathToItem) - return arg + protected Boolean castToAllowedTypes(Boolean arg, List pathToItem, Set> pathSet) { + pathSet.add(pathToItem); + return arg; } - protected fun castToAllowedTypes(arg: Number, pathToItem: List?, pathSet: MutableSet?>): Number { - pathSet.add(pathToItem) - return arg + protected Number castToAllowedTypes(Number arg, List pathToItem, Set> pathSet) { + pathSet.add(pathToItem); + return arg; } - protected fun castToAllowedTypes(arg: Void?, pathToItem: List?, pathSet: MutableSet?>): Void? { - pathSet.add(pathToItem) - return arg + protected Void castToAllowedTypes(Void arg, List pathToItem, Set> pathSet) { + pathSet.add(pathToItem); + return arg; } - @Throws(ValidationException::class) - protected fun castToAllowedTypes(arg: List<*>, pathToItem: List?, pathSet: MutableSet?>): List<*> { - pathSet.add(pathToItem) - val argFixed: MutableList = ArrayList() - var i = 0 - for (item in arg) { - val newPathToItem: MutableList = ArrayList(pathToItem) - newPathToItem.add(i) - val fixedVal = castToAllowedObjectTypes(item, newPathToItem, pathSet) - argFixed.add(fixedVal) - i += 1 - } - return argFixed + protected List castToAllowedTypes(List arg, List pathToItem, Set> pathSet) throws ValidationException { + pathSet.add(pathToItem); + List<@Nullable Object> argFixed = new ArrayList<>(); + int i =0; + for (Object item: arg) { + List newPathToItem = new ArrayList<>(pathToItem); + newPathToItem.add(i); + Object fixedVal = castToAllowedObjectTypes(item, newPathToItem, pathSet); + argFixed.add(fixedVal); + i += 1; + } + return argFixed; } - @Throws(ValidationException::class) - protected fun castToAllowedTypes( - arg: Map<*, *>, - pathToItem: List?, - pathSet: MutableSet?> - ): Map<*, *> { - pathSet.add(pathToItem) - val argFixed = LinkedHashMap() - for ((entryKey, value) in arg) { - if (entryKey !is String) { - throw ValidationException("Invalid non-string key value") + 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 ValidationException("Invalid non-string key value"); } - val `val` = value!! - val newPathToItem: MutableList = ArrayList(pathToItem) - newPathToItem.add(entryKey) - val fixedVal = castToAllowedObjectTypes(`val`, newPathToItem, pathSet) - argFixed[entryKey] = fixedVal + Object val = entry.getValue(); + List newPathToItem = new ArrayList<>(pathToItem); + newPathToItem.add(key); + Object fixedVal = castToAllowedObjectTypes(val, newPathToItem, pathSet); + argFixed.put(key, fixedVal); } - return argFixed + return argFixed; } - @Throws(ValidationException::class) - private fun castToAllowedObjectTypes(arg: Any?, pathToItem: List, pathSet: MutableSet?>): Any? { - return if (arg == null) { - castToAllowedTypes(null as Void?, pathToItem, pathSet) - } else if (arg is String) { - castToAllowedTypes(arg, pathToItem, pathSet) - } else if (arg is Map<*, *>) { - pathSet.add(pathToItem) - castToAllowedTypes(arg, pathToItem, pathSet) - } else if (arg is Boolean) { - castToAllowedTypes(arg, pathToItem, pathSet) - } else if (arg is Int) { - castToAllowedTypes(arg as Number, pathToItem, pathSet) - } else if (arg is Long) { - castToAllowedTypes(arg as Number, pathToItem, pathSet) - } else if (arg is Float) { - castToAllowedTypes(arg as Number, pathToItem, pathSet) - } else if (arg is Double) { - castToAllowedTypes(arg as Number, pathToItem, pathSet) - } else if (arg is List<*>) { - castToAllowedTypes(arg, pathToItem, pathSet) - } else if (arg is ZonedDateTime) { - castToAllowedTypes(arg.toString(), pathToItem, pathSet) - } else if (arg is LocalDate) { - castToAllowedTypes(arg.toString(), pathToItem, pathSet) - } else if (arg is UUID) { - castToAllowedTypes(arg.toString(), pathToItem, 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) { + return castToAllowedTypes((String) arg, pathToItem, pathSet); + } else if (arg instanceof Map) { + pathSet.add(pathToItem); + return castToAllowedTypes((Map) arg, pathToItem, pathSet); + } else if (arg instanceof Boolean) { + return castToAllowedTypes((Boolean) arg, pathToItem, pathSet); + } else if (arg instanceof Integer) { + return castToAllowedTypes((Number) arg, pathToItem, pathSet); + } else if (arg instanceof Long) { + return castToAllowedTypes((Number) arg, pathToItem, pathSet); + } else if (arg instanceof Float) { + return castToAllowedTypes((Number) arg, pathToItem, pathSet); + } else if (arg instanceof Double) { + return castToAllowedTypes((Number) arg, pathToItem, pathSet); + } else if (arg instanceof List) { + return castToAllowedTypes((List) arg, pathToItem, pathSet); + } else if (arg instanceof ZonedDateTime) { + return castToAllowedTypes(arg.toString(), pathToItem, pathSet); + } else if (arg instanceof LocalDate) { + return castToAllowedTypes(arg.toString(), pathToItem, pathSet); + } else if (arg instanceof UUID) { + return castToAllowedTypes(arg.toString(), pathToItem, pathSet); } else { - val argClass: Class<*> = arg.javaClass - throw ValidationException("Invalid type passed in for input=$arg type=$argClass") + Class argClass = arg.getClass(); + throw new ValidationException("Invalid type passed in for input="+arg+" type="+argClass); } } - fun getNewInstance(arg: Void, pathToItem: List?, pathToSchemas: PathToSchemasMap?): Void { - return arg + public Void getNewInstance(Void arg, List pathToItem, PathToSchemasMap pathToSchemas) { + return arg; } - fun getNewInstance(arg: Boolean, pathToItem: List?, pathToSchemas: PathToSchemasMap?): Boolean { - return arg + public boolean getNewInstance(boolean arg, List pathToItem, PathToSchemasMap pathToSchemas) { + return arg; } - fun getNewInstance(arg: Number, pathToItem: List?, pathToSchemas: PathToSchemasMap?): Number { - return arg + public Number getNewInstance(Number arg, List pathToItem, PathToSchemasMap pathToSchemas) { + return arg; } - fun getNewInstance(arg: String, pathToItem: List?, pathToSchemas: PathToSchemasMap?): String { - return arg + public String getNewInstance(String arg, List pathToItem, PathToSchemasMap pathToSchemas) { + return arg; } - companion object { - @Throws(ValidationException::class) - fun validate( - jsonSchema: JsonSchema<*>, - arg: Any?, - validationMetadata: ValidationMetadata - ): PathToSchemasMap { - val disabledKeywords: LinkedHashSet = - validationMetadata.configuration.disabledKeywordFlags.getKeywords() - val pathToSchemas = PathToSchemasMap() - val thisKeywordToValidator = jsonSchema.keywordToValidator - var containsPathToSchemas: List? = null - if (thisKeywordToValidator.containsKey("contains")) { - containsPathToSchemas = jsonSchema.getContainsPathToSchemas(arg, validationMetadata) - } - var patternPropertiesPathToSchemas: PathToSchemasMap? = null - if (thisKeywordToValidator.containsKey("patternProperties")) { - patternPropertiesPathToSchemas = jsonSchema.getPatternPropertiesPathToSchemas(arg, validationMetadata) + 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); + pathToSchemasMap.update(otherPathToSchemas); + for (var schemas: pathToSchemasMap.values()) { + JsonSchema firstSchema = schemas.entrySet().iterator().next().getKey(); + schemas.clear(); + schemas.put(firstSchema, null); + } + pathSet.removeAll(pathToSchemasMap.keySet()); + if (!pathSet.isEmpty()) { + LinkedHashMap, Void> unsetAnyTypeSchema = new LinkedHashMap<>(); + unsetAnyTypeSchema.put(UnsetAnyTypeJsonSchema.UnsetAnyTypeJsonSchema1.getInstance(), null); + for (List pathToItem: pathSet) { + pathToSchemasMap.put(pathToItem, unsetAnyTypeSchema); } - var ifPathToSchemas: PathToSchemasMap? = null - if (thisKeywordToValidator.containsKey("if")) { - ifPathToSchemas = jsonSchema.getIfPathToSchemas(arg, validationMetadata) - } - var knownPathToSchemas: PathToSchemasMap? = null - for ((jsonKeyword, validator) in thisKeywordToValidator) { - if (disabledKeywords.contains(jsonKeyword)) { - val typeIntegerUseCase = jsonKeyword == "format" && "int" == jsonSchema.format - if (!typeIntegerUseCase) { - continue - } - } - if ("unevaluatedItems" == jsonKeyword || "unevaluatedProperties" == jsonKeyword) { - knownPathToSchemas = pathToSchemas - } - val data = ValidationData( - jsonSchema, - arg, - validationMetadata, - containsPathToSchemas, - patternPropertiesPathToSchemas, - ifPathToSchemas, - knownPathToSchemas - ) - val otherPathToSchemas = validator.validate(data) ?: continue - pathToSchemas.update(otherPathToSchemas) - } - val pathToItem: List = validationMetadata.pathToItem - if (!pathToSchemas.containsKey(pathToItem)) { - pathToSchemas[validationMetadata.pathToItem] = LinkedHashMap() - } - val schemas: LinkedHashMap?, Void?>? = pathToSchemas[pathToItem] - if (schemas != null) { - schemas[jsonSchema] = null - } - return pathToSchemas } + return pathToSchemasMap; + } - @Throws(ValidationException::class) - protected fun getPathToSchemas( - jsonSchema: JsonSchema<*>, - arg: Any?, - validationMetadata: ValidationMetadata, - pathSet: Set> - ): PathToSchemasMap { - val pathToSchemasMap = PathToSchemasMap() - // todo add check of validationMetadata.validationRanEarlier(this) - val otherPathToSchemas = validate(jsonSchema, arg, validationMetadata) - pathToSchemasMap.update(otherPathToSchemas) - for (schemas in pathToSchemasMap.values) { - val firstSchema: JsonSchema<*> = schemas!!.entries.iterator().next().getKey() - schemas.clear() - schemas[firstSchema] = null - } - pathSet.removeAll(pathToSchemasMap.keys) - if (!pathSet.isEmpty()) { - val unsetAnyTypeSchema = LinkedHashMap, Void?>() - unsetAnyTypeSchema[UnsetAnyTypeJsonSchema.UnsetAnyTypeJsonSchema1.getInstance()] = null - for (pathToItem in pathSet) { - pathToSchemasMap[pathToItem] = unsetAnyTypeSchema - } - } - return pathToSchemasMap + public static String getClass(@Nullable Object arg) { + if (arg == null) { + return Void.class.getSimpleName(); + } else { + return arg.getClass().getSimpleName(); } - - fun getClass(arg: Any?): String { - return if (arg == null) { - Void::class.java.getSimpleName() - } else { - arg.javaClass.getSimpleName() - } - } // todo add bytes and FileIO } + // todo add bytes and FileIO } \ No newline at end of file diff --git a/src/main/resources/java/src/main/java/packagename/schemas/validation/JsonSchemaFactory.hbs b/src/main/resources/java/src/main/java/packagename/schemas/validation/JsonSchemaFactory.hbs index 5cd8aeedb72..ee529fb4fa1 100644 --- a/src/main/resources/java/src/main/java/packagename/schemas/validation/JsonSchemaFactory.hbs +++ b/src/main/resources/java/src/main/java/packagename/schemas/validation/JsonSchemaFactory.hbs @@ -1,29 +1,32 @@ package {{{packageName}}}.schemas.validation; -import java.lang.reflect.InvocationTargetException +import org.checkerframework.checker.nullness.qual.NonNull; +import org.checkerframework.checker.nullness.qual.Nullable; -object JsonSchemaFactory { - private var classToInstance: MutableMap>, JsonSchema<*>> = HashMap() +import java.lang.reflect.InvocationTargetException; +import java.lang.reflect.Method; +import java.util.HashMap; +import java.util.Map; - fun > getInstance(schemaCls: Class): V { - val cacheInst: JsonSchema<*>? = classToInstance[schemaCls] - cacheInst?.let { - assert(schemaCls.isInstance(cacheInst)) - return schemaCls.cast(cacheInst) + +public class JsonSchemaFactory { + static Map>, JsonSchema> classToInstance = new HashMap<>(); + + public static > V getInstance(Class schemaCls) { + @Nullable JsonSchema cacheInst = classToInstance.get(schemaCls); + if (cacheInst != null) { + assert schemaCls.isInstance(cacheInst); + return schemaCls.cast(cacheInst); } try { - val method = schemaCls.getMethod("getInstance") - val obj = method.invoke(null) - assert(schemaCls.isInstance(obj)) - val inst = schemaCls.cast(obj) - classToInstance[schemaCls] = inst - return inst - } catch (e: NoSuchMethodException) { - throw RuntimeException(e) - } catch (e: IllegalAccessException) { - throw RuntimeException(e) - } catch (e: InvocationTargetException) { - throw RuntimeException(e) + Method method = schemaCls.getMethod("getInstance"); + @SuppressWarnings("nullness") @NonNull Object obj = method.invoke(null); + assert schemaCls.isInstance(obj); + V inst = schemaCls.cast(obj); + classToInstance.put(schemaCls, inst); + return inst; + } catch (NoSuchMethodException | IllegalAccessException | InvocationTargetException e) { + throw new RuntimeException(e); } } } \ No newline at end of file diff --git a/src/main/resources/java/src/main/java/packagename/schemas/validation/JsonSchemaInfo.hbs b/src/main/resources/java/src/main/java/packagename/schemas/validation/JsonSchemaInfo.hbs index ec4eb87de88..0d7527947c8 100644 --- a/src/main/resources/java/src/main/java/packagename/schemas/validation/JsonSchemaInfo.hbs +++ b/src/main/resources/java/src/main/java/packagename/schemas/validation/JsonSchemaInfo.hbs @@ -1,244 +1,210 @@ package {{{packageName}}}.schemas.validation; - -import java.math.BigDecimal -import java.util.regex.Pattern - -class JsonSchemaInfo { - var type: Set>? = null - fun type(type: Set>?): JsonSchemaInfo { - this.type = type - return this - } - - var format: String? = null - fun format(format: String?): JsonSchemaInfo { - this.format = format - return this - } - - var items: Class?>? = null - fun items(items: Class?>?): JsonSchemaInfo { - this.items = items - return this - } - - var properties: Map?>>? = null - fun properties(properties: Map?>>?): JsonSchemaInfo { - this.properties = properties - return this - } - - var required: Set? = null - fun required(required: Set?): JsonSchemaInfo { - this.required = required - return this - } - - var exclusiveMaximum: Number? = null - fun exclusiveMaximum(exclusiveMaximum: Number?): JsonSchemaInfo { - this.exclusiveMaximum = exclusiveMaximum - return this - } - - var exclusiveMinimum: Number? = null - fun exclusiveMinimum(exclusiveMinimum: Number?): JsonSchemaInfo { - this.exclusiveMinimum = exclusiveMinimum - return this - } - - var maxItems: Int? = null - fun maxItems(maxItems: Int?): JsonSchemaInfo { - this.maxItems = maxItems - return this - } - - var minItems: Int? = null - fun minItems(minItems: Int?): JsonSchemaInfo { - this.minItems = minItems - return this - } - - var maxLength: Int? = null - fun maxLength(maxLength: Int?): JsonSchemaInfo { - this.maxLength = maxLength - return this - } - - var minLength: Int? = null - fun minLength(minLength: Int?): JsonSchemaInfo { - this.minLength = minLength - return this - } - - var maxProperties: Int? = null - fun maxProperties(maxProperties: Int?): JsonSchemaInfo { - this.maxProperties = maxProperties - return this - } - - var minProperties: Int? = null - fun minProperties(minProperties: Int?): JsonSchemaInfo { - this.minProperties = minProperties - return this - } - - var maximum: Number? = null - fun maximum(maximum: Number?): JsonSchemaInfo { - this.maximum = maximum - return this - } - - var minimum: Number? = null - fun minimum(minimum: Number?): JsonSchemaInfo { - this.minimum = minimum - return this - } - - var multipleOf: BigDecimal? = null - fun multipleOf(multipleOf: BigDecimal?): JsonSchemaInfo { - this.multipleOf = multipleOf - return this - } - - var additionalProperties: Class?>? = null - fun additionalProperties(additionalProperties: Class?>?): JsonSchemaInfo { - this.additionalProperties = additionalProperties - return this - } - - var allOf: List?>>? = null - fun allOf(allOf: List?>>?): JsonSchemaInfo { - this.allOf = allOf - return this - } - - var anyOf: List?>>? = null - fun anyOf(anyOf: List?>>?): JsonSchemaInfo { - this.anyOf = anyOf - return this - } - - var oneOf: List?>>? = null - fun oneOf(oneOf: List?>>?): JsonSchemaInfo { - this.oneOf = oneOf - return this - } - - var not: Class?>? = null - fun not(not: Class?>?): JsonSchemaInfo { - this.not = not - return this - } - - var uniqueItems: Boolean? = null - fun uniqueItems(uniqueItems: Boolean?): JsonSchemaInfo { - this.uniqueItems = uniqueItems - return this - } - - var enumValues: Set? = null - fun enumValues(enumValues: Set?): JsonSchemaInfo { - this.enumValues = enumValues - return this - } - - var pattern: Pattern? = null - fun pattern(pattern: Pattern?): JsonSchemaInfo { - this.pattern = pattern - return this - } - - var defaultValue: Any? = null - var defaultValueSet = false - fun defaultValue(defaultValue: Any?): JsonSchemaInfo { - this.defaultValue = defaultValue - defaultValueSet = true - return this - } - - var constValue: Any? = null - var constValueSet = false - fun constValue(constValue: Any?): JsonSchemaInfo { - this.constValue = constValue - constValueSet = true - return this - } - - var contains: Class?>? = null - fun contains(contains: Class?>?): JsonSchemaInfo { - this.contains = contains - return this - } - - var maxContains: Int? = null - fun maxContains(maxContains: Int?): JsonSchemaInfo { - this.maxContains = maxContains - return this - } - - var minContains: Int? = null - fun minContains(minContains: Int?): JsonSchemaInfo { - this.minContains = minContains - return this - } - - var propertyNames: Class?>? = null - fun propertyNames(propertyNames: Class?>?): JsonSchemaInfo { - this.propertyNames = propertyNames - return this - } - - var dependentRequired: Map>? = null - fun dependentRequired(dependentRequired: Map>?): JsonSchemaInfo { - this.dependentRequired = dependentRequired - return this - } - - var dependentSchemas: Map?>>? = null - fun dependentSchemas(dependentSchemas: Map?>>?): JsonSchemaInfo { - this.dependentSchemas = dependentSchemas - return this - } - - var patternProperties: Map?>>? = null - fun patternProperties(patternProperties: Map?>>?): JsonSchemaInfo { - this.patternProperties = patternProperties - return this - } - - var prefixItems: List?>>? = null - fun prefixItems(prefixItems: List?>>?): JsonSchemaInfo { - this.prefixItems = prefixItems - return this - } - - var ifSchema: Class?>? = null - fun ifSchema(ifSchema: Class?>?): JsonSchemaInfo { - this.ifSchema = ifSchema - return this - } - - var then: Class?>? = null - fun then(then: Class?>?): JsonSchemaInfo { - this.then = then - return this - } - - var elseSchema: Class?>? = null - fun elseSchema(elseSchema: Class?>?): JsonSchemaInfo { - this.elseSchema = elseSchema - return this - } - - var unevaluatedItems: Class?>? = null - fun unevaluatedItems(unevaluatedItems: Class?>?): JsonSchemaInfo { - this.unevaluatedItems = unevaluatedItems - return this - } - - var unevaluatedProperties: Class?>? = null - fun unevaluatedProperties(unevaluatedProperties: Class?>?): JsonSchemaInfo { - this.unevaluatedProperties = unevaluatedProperties - return this +import org.checkerframework.checker.nullness.qual.Nullable; + +import java.math.BigDecimal; +import java.util.List; +import java.util.Map; +import java.util.Set; +import java.util.regex.Pattern; + +public class JsonSchemaInfo { + public @Nullable Set> type = null; + public JsonSchemaInfo type(Set> type) { + this.type = type; + return this; + } + public @Nullable String format = null; + public JsonSchemaInfo format(String format) { + this.format = format; + return this; + } + public @Nullable Class> items = null; + public JsonSchemaInfo items(Class> items) { + this.items = items; + return this; + } + public @Nullable Map>> properties = null; + public JsonSchemaInfo properties(Map>> properties) { + this.properties = properties; + return this; + } + public @Nullable Set required = null; + public JsonSchemaInfo required(Set required) { + this.required = required; + return this; + } + public @Nullable Number exclusiveMaximum = null; + public JsonSchemaInfo exclusiveMaximum(Number exclusiveMaximum) { + this.exclusiveMaximum = exclusiveMaximum; + return this; + } + public @Nullable Number exclusiveMinimum = null; + public JsonSchemaInfo exclusiveMinimum(Number exclusiveMinimum) { + this.exclusiveMinimum = exclusiveMinimum; + return this; + } + public @Nullable Integer maxItems = null; + public JsonSchemaInfo maxItems(Integer maxItems) { + this.maxItems = maxItems; + return this; + } + public @Nullable Integer minItems = null; + public JsonSchemaInfo minItems(Integer minItems) { + this.minItems = minItems; + return this; + } + public @Nullable Integer maxLength = null; + public JsonSchemaInfo maxLength(Integer maxLength) { + this.maxLength = maxLength; + return this; + } + public @Nullable Integer minLength = null; + public JsonSchemaInfo minLength(Integer minLength) { + this.minLength = minLength; + return this; + } + public @Nullable Integer maxProperties = null; + public JsonSchemaInfo maxProperties(Integer maxProperties) { + this.maxProperties = maxProperties; + return this; + } + public @Nullable Integer minProperties = null; + public JsonSchemaInfo minProperties(Integer minProperties) { + this.minProperties = minProperties; + return this; + } + public @Nullable Number maximum = null; + public JsonSchemaInfo maximum(Number maximum) { + this.maximum = maximum; + return this; + } + public @Nullable Number minimum = null; + public JsonSchemaInfo minimum(Number minimum) { + this.minimum = minimum; + return this; + } + public @Nullable BigDecimal multipleOf = null; + public JsonSchemaInfo multipleOf(BigDecimal multipleOf) { + this.multipleOf = multipleOf; + return this; + } + public @Nullable Class> additionalProperties; + public JsonSchemaInfo additionalProperties(Class> additionalProperties) { + this.additionalProperties = additionalProperties; + return this; + } + public @Nullable List>> allOf = null; + public JsonSchemaInfo allOf(List>> allOf) { + this.allOf = allOf; + return this; + } + public @Nullable List>> anyOf = null; + public JsonSchemaInfo anyOf(List>> anyOf) { + this.anyOf = anyOf; + return this; + } + public @Nullable List>> oneOf = null; + public JsonSchemaInfo oneOf(List>> oneOf) { + this.oneOf = oneOf; + return this; + } + public @Nullable Class> not = null; + public JsonSchemaInfo not(Class> not) { + this.not = not; + return this; + } + public @Nullable Boolean uniqueItems = null; + public JsonSchemaInfo uniqueItems(Boolean uniqueItems) { + this.uniqueItems = uniqueItems; + return this; + } + public @Nullable Set<@Nullable Object> enumValues = null; + public JsonSchemaInfo enumValues(Set<@Nullable Object> enumValues) { + this.enumValues = enumValues; + return this; + } + public @Nullable Pattern pattern = null; + public JsonSchemaInfo pattern(Pattern pattern) { + this.pattern = pattern; + return this; + } + public @Nullable Object defaultValue = null; + public boolean defaultValueSet = false; + public JsonSchemaInfo defaultValue(@Nullable Object defaultValue) { + this.defaultValue = defaultValue; + this.defaultValueSet = true; + return this; + } + public @Nullable Object constValue = null; + public boolean constValueSet = false; + public JsonSchemaInfo constValue(@Nullable Object constValue) { + this.constValue = constValue; + this.constValueSet = true; + return this; + } + public @Nullable Class> contains = null; + public JsonSchemaInfo contains(Class> contains) { + this.contains = contains; + return this; + } + public @Nullable Integer maxContains = null; + public JsonSchemaInfo maxContains(Integer maxContains) { + this.maxContains = maxContains; + return this; + } + public @Nullable Integer minContains = null; + public JsonSchemaInfo minContains(Integer minContains) { + this.minContains = minContains; + return this; + } + public @Nullable Class> propertyNames = null; + public JsonSchemaInfo propertyNames(Class> propertyNames) { + this.propertyNames = propertyNames; + return this; + } + public @Nullable Map> dependentRequired = null; + public JsonSchemaInfo dependentRequired(Map> dependentRequired) { + this.dependentRequired = dependentRequired; + return this; + } + public @Nullable Map>> dependentSchemas = null; + public JsonSchemaInfo dependentSchemas(Map>> dependentSchemas) { + this.dependentSchemas = dependentSchemas; + return this; + } + public @Nullable Map>> patternProperties = null; + public JsonSchemaInfo patternProperties(Map>> patternProperties) { + this.patternProperties = patternProperties; + return this; + } + public @Nullable List>> prefixItems = null; + public JsonSchemaInfo prefixItems(List>> prefixItems) { + this.prefixItems = prefixItems; + return this; + } + public @Nullable Class> ifSchema = null; + public JsonSchemaInfo ifSchema(Class> ifSchema) { + this.ifSchema = ifSchema; + return this; + } + public @Nullable Class> then = null; + public JsonSchemaInfo then(Class> then) { + this.then = then; + return this; + } + public @Nullable Class> elseSchema = null; + public JsonSchemaInfo elseSchema(Class> elseSchema) { + this.elseSchema = elseSchema; + return this; + } + public @Nullable Class> unevaluatedItems = null; + public JsonSchemaInfo unevaluatedItems(Class> unevaluatedItems) { + this.unevaluatedItems = unevaluatedItems; + return this; + } + public @Nullable Class> unevaluatedProperties = null; + public JsonSchemaInfo unevaluatedProperties(Class> unevaluatedProperties) { + this.unevaluatedProperties = unevaluatedProperties; + return this; } } \ No newline at end of file From 63724fa4f2ad35f42916716942284fd301683069 Mon Sep 17 00:00:00 2001 From: Justin Black Date: Mon, 6 May 2024 16:27:20 -0700 Subject: [PATCH 08/78] Updates AdditionalPropertiesValidator --- .../AdditionalPropertiesValidator.java | 58 -------------- .../AdditionalPropertiesValidator.kt | 50 ++++++++++++ .../schemas/validation/JsonSchemaFactory.kt | 2 +- .../AdditionalPropertiesValidator.hbs | 76 +++++++++---------- .../schemas/validation/JsonSchemaFactory.hbs | 2 +- 5 files changed, 86 insertions(+), 102 deletions(-) delete mode 100644 samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/schemas/validation/AdditionalPropertiesValidator.java create mode 100644 samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/schemas/validation/AdditionalPropertiesValidator.kt diff --git a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/schemas/validation/AdditionalPropertiesValidator.java b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/schemas/validation/AdditionalPropertiesValidator.java deleted file mode 100644 index b7afc854c15..00000000000 --- a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/schemas/validation/AdditionalPropertiesValidator.java +++ /dev/null @@ -1,58 +0,0 @@ -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; -import java.util.List; -import java.util.Map; -import java.util.Set; - -public class AdditionalPropertiesValidator implements KeywordValidator { - @Override - public @Nullable PathToSchemasMap validate( - ValidationData data - ) throws ValidationException { - if (!(data.arg() instanceof Map mapArg)) { - return null; - } - var additionalProperties = data.schema().additionalProperties; - if (additionalProperties == null) { - return null; - } - Set presentAdditionalProperties = new LinkedHashSet<>(); - for (Object key: mapArg.keySet()) { - if (key instanceof String) { - presentAdditionalProperties.add((String) key); - } - } - var properties = data.schema().properties; - if (properties != null) { - presentAdditionalProperties.removeAll(properties.keySet()); - } - PathToSchemasMap pathToSchemas = new PathToSchemasMap(); - for(String addPropName: presentAdditionalProperties) { - @Nullable Object propValue = mapArg.get(addPropName); - List propPathToItem = new ArrayList<>(data.validationMetadata().pathToItem()); - propPathToItem.add(addPropName); - if (data.patternPropertiesPathToSchemas() != null && data.patternPropertiesPathToSchemas().containsKey(propPathToItem)) { - continue; - } - ValidationMetadata propValidationMetadata = new ValidationMetadata( - propPathToItem, - data.validationMetadata().configuration(), - data.validationMetadata().validatedPathToSchemas(), - data.validationMetadata().seenClasses() - ); - JsonSchema addPropsSchema = JsonSchemaFactory.getInstance(additionalProperties); - if (propValidationMetadata.validationRanEarlier(addPropsSchema)) { - // todo add_deeper_validated_schemas - continue; - } - PathToSchemasMap otherPathToSchemas = JsonSchema.validate(addPropsSchema, propValue, propValidationMetadata); - pathToSchemas.update(otherPathToSchemas); - } - return pathToSchemas; - } -} diff --git a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/schemas/validation/AdditionalPropertiesValidator.kt b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/schemas/validation/AdditionalPropertiesValidator.kt new file mode 100644 index 00000000000..5dfbbb7b0fa --- /dev/null +++ b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/schemas/validation/AdditionalPropertiesValidator.kt @@ -0,0 +1,50 @@ +package org.openapijsonschematools.client.schemas.validation + +import org.openapijsonschematools.client.exceptions.ValidationException + +class AdditionalPropertiesValidator : KeywordValidator { + @Throws(ValidationException::class) + override fun validate( + data: ValidationData + ): PathToSchemasMap? { + if (data.arg !is Map<*, *>) { + return null + } + val additionalProperties: Class> = data.schema.additionalProperties ?: return null + val presentAdditionalProperties: MutableSet = LinkedHashSet() + for (key in data.arg.keys) { + if (key is String) { + presentAdditionalProperties.add(key) + } + } + val properties: Map>>? = data.schema.properties + if (properties != null) { + presentAdditionalProperties.removeAll(properties.keys) + } + val pathToSchemas = PathToSchemasMap() + for (addPropName in presentAdditionalProperties) { + val propValue: Any? = data.arg.get(addPropName) + val propPathToItem: MutableList = ArrayList(data.validationMetadata.pathToItem) + propPathToItem.add(addPropName) + if (data.patternPropertiesPathToSchemas != null && data.patternPropertiesPathToSchemas + .containsKey(propPathToItem) + ) { + continue + } + val propValidationMetadata = ValidationMetadata( + propPathToItem, + data.validationMetadata.configuration, + data.validationMetadata.validatedPathToSchemas, + data.validationMetadata.seenClasses + ) + val addPropsSchema = JsonSchemaFactory.getInstance(additionalProperties) + if (propValidationMetadata.validationRanEarlier(addPropsSchema)) { + // todo add_deeper_validated_schemas + continue + } + val otherPathToSchemas = JsonSchema.validate(addPropsSchema, propValue, propValidationMetadata) + pathToSchemas.update(otherPathToSchemas) + } + return pathToSchemas + } +} diff --git a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/schemas/validation/JsonSchemaFactory.kt b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/schemas/validation/JsonSchemaFactory.kt index 8dcc3d416c3..d50c630a275 100644 --- a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/schemas/validation/JsonSchemaFactory.kt +++ b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/schemas/validation/JsonSchemaFactory.kt @@ -5,7 +5,7 @@ import java.lang.reflect.InvocationTargetException object JsonSchemaFactory { private var classToInstance: MutableMap>, JsonSchema<*>> = HashMap() - fun > getInstance(schemaCls: Class): V { + fun > getInstance(schemaCls: Class): V { val cacheInst: JsonSchema<*>? = classToInstance[schemaCls] cacheInst?.let { assert(schemaCls.isInstance(it)) diff --git a/src/main/resources/kotlin/src/main/kotlin/packagename/schemas/validation/AdditionalPropertiesValidator.hbs b/src/main/resources/kotlin/src/main/kotlin/packagename/schemas/validation/AdditionalPropertiesValidator.hbs index 7a7b89638e8..e3d349ee561 100644 --- a/src/main/resources/kotlin/src/main/kotlin/packagename/schemas/validation/AdditionalPropertiesValidator.hbs +++ b/src/main/resources/kotlin/src/main/kotlin/packagename/schemas/validation/AdditionalPropertiesValidator.hbs @@ -1,58 +1,50 @@ package {{{packageName}}}.schemas.validation; -import org.checkerframework.checker.nullness.qual.Nullable; import {{{packageName}}}.exceptions.ValidationException; -import java.util.ArrayList; -import java.util.LinkedHashSet; -import java.util.List; -import java.util.Map; -import java.util.Set; - -public class AdditionalPropertiesValidator implements KeywordValidator { - @Override - public @Nullable PathToSchemasMap validate( - ValidationData data - ) throws ValidationException { - if (!(data.arg() instanceof Map mapArg)) { - return null; - } - var additionalProperties = data.schema().additionalProperties; - if (additionalProperties == null) { - return null; +class AdditionalPropertiesValidator : KeywordValidator { + @Throws(ValidationException::class) + override fun validate( + data: ValidationData + ): PathToSchemasMap? { + if (data.arg !is Map<*, *>) { + return null } - Set presentAdditionalProperties = new LinkedHashSet<>(); - for (Object key: mapArg.keySet()) { - if (key instanceof String) { - presentAdditionalProperties.add((String) key); + val additionalProperties: Class> = data.schema.additionalProperties ?: return null + val presentAdditionalProperties: MutableSet = LinkedHashSet() + for (key in data.arg.keys) { + if (key is String) { + presentAdditionalProperties.add(key) } } - var properties = data.schema().properties; + val properties: Map>>? = data.schema.properties if (properties != null) { - presentAdditionalProperties.removeAll(properties.keySet()); + presentAdditionalProperties.removeAll(properties.keys) } - PathToSchemasMap pathToSchemas = new PathToSchemasMap(); - for(String addPropName: presentAdditionalProperties) { - @Nullable Object propValue = mapArg.get(addPropName); - List propPathToItem = new ArrayList<>(data.validationMetadata().pathToItem()); - propPathToItem.add(addPropName); - if (data.patternPropertiesPathToSchemas() != null && data.patternPropertiesPathToSchemas().containsKey(propPathToItem)) { - continue; + val pathToSchemas = PathToSchemasMap() + for (addPropName in presentAdditionalProperties) { + val propValue: Any? = data.arg.get(addPropName) + val propPathToItem: MutableList = ArrayList(data.validationMetadata.pathToItem) + propPathToItem.add(addPropName) + if (data.patternPropertiesPathToSchemas != null && data.patternPropertiesPathToSchemas + .containsKey(propPathToItem) + ) { + continue } - ValidationMetadata propValidationMetadata = new ValidationMetadata( - propPathToItem, - data.validationMetadata().configuration(), - data.validationMetadata().validatedPathToSchemas(), - data.validationMetadata().seenClasses() - ); - JsonSchema addPropsSchema = JsonSchemaFactory.getInstance(additionalProperties); + val propValidationMetadata = ValidationMetadata( + propPathToItem, + data.validationMetadata.configuration, + data.validationMetadata.validatedPathToSchemas, + data.validationMetadata.seenClasses + ) + val addPropsSchema = JsonSchemaFactory.getInstance(additionalProperties) if (propValidationMetadata.validationRanEarlier(addPropsSchema)) { // todo add_deeper_validated_schemas - continue; + continue } - PathToSchemasMap otherPathToSchemas = JsonSchema.validate(addPropsSchema, propValue, propValidationMetadata); - pathToSchemas.update(otherPathToSchemas); + val otherPathToSchemas = JsonSchema.validate(addPropsSchema, propValue, propValidationMetadata) + pathToSchemas.update(otherPathToSchemas) } - return pathToSchemas; + return pathToSchemas } } diff --git a/src/main/resources/kotlin/src/main/kotlin/packagename/schemas/validation/JsonSchemaFactory.hbs b/src/main/resources/kotlin/src/main/kotlin/packagename/schemas/validation/JsonSchemaFactory.hbs index 928f96e82b6..0e7e1bc693b 100644 --- a/src/main/resources/kotlin/src/main/kotlin/packagename/schemas/validation/JsonSchemaFactory.hbs +++ b/src/main/resources/kotlin/src/main/kotlin/packagename/schemas/validation/JsonSchemaFactory.hbs @@ -5,7 +5,7 @@ import java.lang.reflect.InvocationTargetException; object JsonSchemaFactory { private var classToInstance: MutableMap>, JsonSchema<*>> = HashMap() - fun > getInstance(schemaCls: Class): V { + fun > getInstance(schemaCls: Class): V { val cacheInst: JsonSchema<*>? = classToInstance[schemaCls] cacheInst?.let { assert(schemaCls.isInstance(it)) From 98f62574f84bef687af81dc100c0e00c96478d45 Mon Sep 17 00:00:00 2001 From: Justin Black Date: Mon, 6 May 2024 17:04:22 -0700 Subject: [PATCH 09/78] Updates UnsetAnyTypeJsonSchema --- .../client/schemas/validation/JsonSchema.kt | 29 +- .../validation/UnsetAnyTypeJsonSchema.kt | 481 +++++++++--------- .../validation/UnsetAnyTypeJsonSchema.hbs | 471 +++++++++-------- .../schemas/validation/JsonSchema.hbs | 29 +- 4 files changed, 529 insertions(+), 481 deletions(-) diff --git a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/schemas/validation/JsonSchema.kt b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/schemas/validation/JsonSchema.kt index 8f1f16d643c..eeffba0de1f 100644 --- a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/schemas/validation/JsonSchema.kt +++ b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/schemas/validation/JsonSchema.kt @@ -213,7 +213,7 @@ abstract class JsonSchema protected constructor(jsonSchemaInfo: JsonSchemaInf this.keywordToValidator = keywordToValidator } - abstract fun getNewInstance(arg: Any?, pathToItem: List?, pathToSchemas: PathToSchemasMap?): Any? + abstract fun getNewInstance(arg: Any?, pathToItem: List, pathToSchemas: PathToSchemasMap): Any? @Throws(ValidationException::class) abstract fun validate(arg: Any?, configuration: SchemaConfiguration?): Any? @Throws(ValidationException::class) @@ -302,28 +302,28 @@ abstract class JsonSchema protected constructor(jsonSchemaInfo: JsonSchemaInf return pathToSchemas } - protected fun castToAllowedTypes(arg: String, pathToItem: List?, pathSet: MutableSet?>): String { + protected fun castToAllowedTypes(arg: String, pathToItem: List, pathSet: MutableSet>): String { pathSet.add(pathToItem) return arg } - protected fun castToAllowedTypes(arg: Boolean, pathToItem: List?, pathSet: MutableSet?>): Boolean { + protected fun castToAllowedTypes(arg: Boolean, pathToItem: List, pathSet: MutableSet>): Boolean { pathSet.add(pathToItem) return arg } - protected fun castToAllowedTypes(arg: Number, pathToItem: List?, pathSet: MutableSet?>): Number { + protected fun castToAllowedTypes(arg: Number, pathToItem: List, pathSet: MutableSet>): Number { pathSet.add(pathToItem) return arg } - protected fun castToAllowedTypes(arg: Void?, pathToItem: List?, pathSet: MutableSet?>): Void? { + protected fun castToAllowedTypes(arg: Nothing?, pathToItem: List, pathSet: MutableSet>): Nothing? { pathSet.add(pathToItem) return arg } @Throws(ValidationException::class) - protected fun castToAllowedTypes(arg: List<*>, pathToItem: List?, pathSet: MutableSet?>): List<*> { + protected fun castToAllowedTypes(arg: List<*>, pathToItem: List, pathSet: MutableSet>): List<*> { pathSet.add(pathToItem) val argFixed: MutableList = ArrayList() var i = 0 @@ -340,8 +340,8 @@ abstract class JsonSchema protected constructor(jsonSchemaInfo: JsonSchemaInf @Throws(ValidationException::class) protected fun castToAllowedTypes( arg: Map<*, *>, - pathToItem: List?, - pathSet: MutableSet?> + pathToItem: List, + pathSet: MutableSet> ): Map<*, *> { pathSet.add(pathToItem) val argFixed = LinkedHashMap() @@ -359,7 +359,7 @@ abstract class JsonSchema protected constructor(jsonSchemaInfo: JsonSchemaInf } @Throws(ValidationException::class) - private fun castToAllowedObjectTypes(arg: Any?, pathToItem: List, pathSet: MutableSet?>): Any? { + private fun castToAllowedObjectTypes(arg: Any?, pathToItem: List, pathSet: MutableSet>): Any? { return if (arg == null) { castToAllowedTypes(null as Void?, pathToItem, pathSet) } else if (arg is String) { @@ -391,19 +391,19 @@ abstract class JsonSchema protected constructor(jsonSchemaInfo: JsonSchemaInf } } - fun getNewInstance(arg: Void, pathToItem: List?, pathToSchemas: PathToSchemasMap?): Void { + fun getNewInstance(arg: Nothing?, pathToItem: List, pathToSchemas: PathToSchemasMap): Nothing? { return arg } - fun getNewInstance(arg: Boolean, pathToItem: List?, pathToSchemas: PathToSchemasMap?): Boolean { + fun getNewInstance(arg: Boolean, pathToItem: List, pathToSchemas: PathToSchemasMap): Boolean { return arg } - fun getNewInstance(arg: Number, pathToItem: List?, pathToSchemas: PathToSchemasMap?): Number { + fun getNewInstance(arg: Number, pathToItem: List, pathToSchemas: PathToSchemasMap): Number { return arg } - fun getNewInstance(arg: String, pathToItem: List?, pathToSchemas: PathToSchemasMap?): String { + fun getNewInstance(arg: String, pathToItem: List, pathToSchemas: PathToSchemasMap): String { return arg } @@ -464,12 +464,13 @@ abstract class JsonSchema protected constructor(jsonSchemaInfo: JsonSchemaInf return pathToSchemas } + @JvmStatic @Throws(ValidationException::class) protected fun getPathToSchemas( jsonSchema: JsonSchema<*>, arg: Any?, validationMetadata: ValidationMetadata, - pathSet: Set> + pathSet: Set> ): PathToSchemasMap { val pathToSchemasMap = PathToSchemasMap() // todo add check of validationMetadata.validationRanEarlier(this) diff --git a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/schemas/validation/UnsetAnyTypeJsonSchema.kt b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/schemas/validation/UnsetAnyTypeJsonSchema.kt index 4e1b3500a04..b1c48aa50a2 100644 --- a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/schemas/validation/UnsetAnyTypeJsonSchema.kt +++ b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/schemas/validation/UnsetAnyTypeJsonSchema.kt @@ -1,302 +1,325 @@ -package org.openapijsonschematools.client.schemas.validation; - -import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags; -import org.openapijsonschematools.client.configurations.SchemaConfiguration; -import org.openapijsonschematools.client.exceptions.ValidationException; -import org.checkerframework.checker.nullness.qual.Nullable; - -import java.time.LocalDate; -import java.time.ZonedDateTime; -import java.util.LinkedHashMap; -import java.util.List; -import java.util.HashSet; -import java.util.ArrayList; -import java.util.LinkedHashSet; -import java.util.Set; -import java.util.Map; -import java.util.Objects; -import java.util.UUID; - -public class UnsetAnyTypeJsonSchema { - public sealed interface UnsetAnyTypeJsonSchema1Boxed permits UnsetAnyTypeJsonSchema1BoxedVoid, UnsetAnyTypeJsonSchema1BoxedBoolean, UnsetAnyTypeJsonSchema1BoxedNumber, UnsetAnyTypeJsonSchema1BoxedString, UnsetAnyTypeJsonSchema1BoxedList, UnsetAnyTypeJsonSchema1BoxedMap { - @Nullable Object getData(); - } - public record UnsetAnyTypeJsonSchema1BoxedVoid(Nothing? data) implements UnsetAnyTypeJsonSchema1Boxed { - @Override - public @Nullable Object getData() { - return data; - } +package org.openapijsonschematools.client.schemas.validation + +import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags +import org.openapijsonschematools.client.configurations.SchemaConfiguration +import org.openapijsonschematools.client.exceptions.ValidationException + +import java.time.LocalDate +import java.time.ZonedDateTime + +class UnsetAnyTypeJsonSchema { + interface UnsetAnyTypeJsonSchema1Boxed { + val data: Any? } - public record UnsetAnyTypeJsonSchema1BoxedBoolean(boolean data) implements UnsetAnyTypeJsonSchema1Boxed { - @Override - public @Nullable Object getData() { - return data; + + data class UnsetAnyTypeJsonSchema1BoxedVoid(override val data: Nothing?) : UnsetAnyTypeJsonSchema1Boxed { + fun getData(): Any? { + return data } } - public record UnsetAnyTypeJsonSchema1BoxedNumber(Number data) implements UnsetAnyTypeJsonSchema1Boxed { - @Override - public @Nullable Object getData() { - return data; + + data class UnsetAnyTypeJsonSchema1BoxedBoolean(override val data: Boolean) : UnsetAnyTypeJsonSchema1Boxed { + fun getData(): Any? { + return data } } - public record UnsetAnyTypeJsonSchema1BoxedString(String data) implements UnsetAnyTypeJsonSchema1Boxed { - @Override - public @Nullable Object getData() { - return data; + + data class UnsetAnyTypeJsonSchema1BoxedNumber(override val data: Number?) : UnsetAnyTypeJsonSchema1Boxed { + fun getData(): Any? { + return data } } - public record UnsetAnyTypeJsonSchema1BoxedList(FrozenList<@Nullable Object> data) implements UnsetAnyTypeJsonSchema1Boxed { - @Override - public @Nullable Object getData() { - return data; + + data class UnsetAnyTypeJsonSchema1BoxedString(override val data: String?) : UnsetAnyTypeJsonSchema1Boxed { + fun getData(): Any? { + return data } } - public record UnsetAnyTypeJsonSchema1BoxedMap(FrozenMap<@Nullable Object> data) implements UnsetAnyTypeJsonSchema1Boxed { - @Override - public @Nullable Object getData() { - return data; + + data class UnsetAnyTypeJsonSchema1BoxedList(override val data: FrozenList) : UnsetAnyTypeJsonSchema1Boxed { + fun getData(): Any? { + return data } } - public static class UnsetAnyTypeJsonSchema1 extends JsonSchema implements NullSchemaValidator, BooleanSchemaValidator, NumberSchemaValidator, StringSchemaValidator, ListSchemaValidator, UnsetAnyTypeJsonSchema1BoxedList>, MapSchemaValidator, UnsetAnyTypeJsonSchema1BoxedMap> { - private static @Nullable UnsetAnyTypeJsonSchema1 instance = null; - protected UnsetAnyTypeJsonSchema1() { - super(new JsonSchemaInfo()); + data class UnsetAnyTypeJsonSchema1BoxedMap(override val data: FrozenMap) : UnsetAnyTypeJsonSchema1Boxed { + fun getData(): Any? { + return data } + } - public static UnsetAnyTypeJsonSchema1 getInstance() { - if (instance == null) { - instance = new UnsetAnyTypeJsonSchema1(); + class UnsetAnyTypeJsonSchema1 protected constructor() : JsonSchema(JsonSchemaInfo()), + NullSchemaValidator, + BooleanSchemaValidator, + NumberSchemaValidator, + StringSchemaValidator, + ListSchemaValidator?, UnsetAnyTypeJsonSchema1BoxedList?>, + MapSchemaValidator?, UnsetAnyTypeJsonSchema1BoxedMap?> { + @Throws(ValidationException::class) + fun validate(arg: Nothing?, configuration: SchemaConfiguration?): Nothing? { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0]") + val castArg: Nothing? = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = Objects.requireNonNullElseGet(configuration) { + SchemaConfiguration( + JsonSchemaKeywordFlags.Builder().build() + ) } - return instance; + val validatedPathToSchemas = PathToSchemasMap() + val validationMetadata = + ValidationMetadata(pathToItem, usedConfiguration!!, validatedPathToSchemas, LinkedHashSet()) + val pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet) + return getNewInstance(castArg, validationMetadata.pathToItem, pathToSchemasMap) } - @Override - public Nothing? validate(Nothing? arg, SchemaConfiguration configuration) throws ValidationException { - Set> pathSet = new HashSet<>(); - List pathToItem = List.of("args[0]"); - Nothing? castArg = castToAllowedTypes(arg, pathToItem, pathSet); - SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().build())); - PathToSchemasMap validatedPathToSchemas = new PathToSchemasMap(); - ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, new LinkedHashSet<>()); - PathToSchemasMap pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet); - return getNewInstance(castArg, validationMetadata.pathToItem(), pathToSchemasMap); - } - - @Override - public boolean validate(boolean arg, SchemaConfiguration configuration) throws ValidationException { - Set> pathSet = new HashSet<>(); - List pathToItem = List.of("args[0]"); - boolean castArg = castToAllowedTypes(arg, pathToItem, pathSet); - SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().build())); - PathToSchemasMap validatedPathToSchemas = new PathToSchemasMap(); - ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, new LinkedHashSet<>()); - PathToSchemasMap pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet); - return getNewInstance(castArg, validationMetadata.pathToItem(), pathToSchemasMap); + @Throws(ValidationException::class) + fun validate(arg: Boolean, configuration: SchemaConfiguration?): Boolean { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0]") + val castArg: Boolean = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = Objects.requireNonNullElseGet(configuration) { + SchemaConfiguration( + JsonSchemaKeywordFlags.Builder().build() + ) + } + val validatedPathToSchemas = PathToSchemasMap() + val validationMetadata = + ValidationMetadata(pathToItem, usedConfiguration!!, validatedPathToSchemas, LinkedHashSet()) + val pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet) + return getNewInstance(castArg, validationMetadata.pathToItem, pathToSchemasMap) } - @Override - public Number validate(Number arg, SchemaConfiguration configuration) throws ValidationException { - Set> pathSet = new HashSet<>(); - List pathToItem = List.of("args[0]"); - Number castArg = castToAllowedTypes(arg, pathToItem, pathSet); - SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().build())); - PathToSchemasMap validatedPathToSchemas = new PathToSchemasMap(); - ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, new LinkedHashSet<>()); - PathToSchemasMap pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet); - return getNewInstance(castArg, validationMetadata.pathToItem(), pathToSchemasMap); + @Throws(ValidationException::class) + fun validate(arg: Number, configuration: SchemaConfiguration?): Number? { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0]") + val castArg: Number = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = Objects.requireNonNullElseGet(configuration) { + SchemaConfiguration( + JsonSchemaKeywordFlags.Builder().build() + ) + } + val validatedPathToSchemas = PathToSchemasMap() + val validationMetadata = + ValidationMetadata(pathToItem, usedConfiguration!!, validatedPathToSchemas, LinkedHashSet()) + val pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet) + return getNewInstance(castArg, validationMetadata.pathToItem, pathToSchemasMap) } - public int validate(int arg, SchemaConfiguration configuration) throws ValidationException { - return (int) validate((Number) arg, configuration); + @Throws(ValidationException::class) + fun validate(arg: Int, configuration: SchemaConfiguration?): Int { + return validate(arg as Number, configuration) as Int } - public long validate(long arg, SchemaConfiguration configuration) throws ValidationException { - return (long) validate((Number) arg, configuration); + @Throws(ValidationException::class) + fun validate(arg: Long, configuration: SchemaConfiguration?): Long { + return validate(arg as Number, configuration) as Long } - public float validate(float arg, SchemaConfiguration configuration) throws ValidationException { - return (float) validate((Number) arg, configuration); + @Throws(ValidationException::class) + fun validate(arg: Float, configuration: SchemaConfiguration?): Float { + return validate(arg as Number, configuration) as Float } - public double validate(double arg, SchemaConfiguration configuration) throws ValidationException { - return (double) validate((Number) arg, configuration); + @Throws(ValidationException::class) + fun validate(arg: Double, configuration: SchemaConfiguration?): Double { + return validate(arg as Number, configuration) as Double } - @Override - public String validate(String arg, SchemaConfiguration configuration) throws ValidationException { - Set> pathSet = new HashSet<>(); - List pathToItem = List.of("args[0]"); - String castArg = castToAllowedTypes(arg, pathToItem, pathSet); - SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().build())); - PathToSchemasMap validatedPathToSchemas = new PathToSchemasMap(); - ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, new LinkedHashSet<>()); - PathToSchemasMap pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet); - return getNewInstance(castArg, validationMetadata.pathToItem(), pathToSchemasMap); + @Throws(ValidationException::class) + fun validate(arg: String, configuration: SchemaConfiguration?): String? { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0]") + val castArg: String = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = Objects.requireNonNullElseGet(configuration) { + SchemaConfiguration( + JsonSchemaKeywordFlags.Builder().build() + ) + } + val validatedPathToSchemas = PathToSchemasMap() + val validationMetadata = + ValidationMetadata(pathToItem, usedConfiguration!!, validatedPathToSchemas, LinkedHashSet()) + val pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet) + return getNewInstance(castArg, validationMetadata.pathToItem, pathToSchemasMap) } - public String validate(LocalDate arg, SchemaConfiguration configuration) throws ValidationException { - return validate(arg.toString(), configuration); + @Throws(ValidationException::class) + fun validate(arg: LocalDate, configuration: SchemaConfiguration?): String? { + return validate(arg.toString(), configuration) } - public String validate(ZonedDateTime arg, SchemaConfiguration configuration) throws ValidationException { - return validate(arg.toString(), configuration); + @Throws(ValidationException::class) + fun validate(arg: ZonedDateTime, configuration: SchemaConfiguration?): String? { + return validate(arg.toString(), configuration) } - public String validate(UUID arg, SchemaConfiguration configuration) throws ValidationException { - return validate(arg.toString(), configuration); + @Throws(ValidationException::class) + fun validate(arg: UUID, configuration: SchemaConfiguration?): String? { + return validate(arg.toString(), configuration) } - @Override - public FrozenList<@Nullable Object> getNewInstance(List arg, List pathToItem, PathToSchemasMap pathToSchemas) { - List<@Nullable Object> items = new ArrayList<>(); - int i = 0; - for (Object item: arg) { - List itemPathToItem = new ArrayList<>(pathToItem); - itemPathToItem.add(i); - LinkedHashMap, Nothing?> schemas = pathToSchemas.get(itemPathToItem); - if (schemas == null) { - 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); - items.add(castItem); - i += 1; + fun getNewInstance(arg: List<*>, pathToItem: List, pathToSchemas: PathToSchemasMap): FrozenList { + val items: MutableList = ArrayList() + var i = 0 + for (item in arg) { + val itemPathToItem: MutableList = ArrayList(pathToItem) + itemPathToItem.add(i) + val schemas = pathToSchemas.get(itemPathToItem) + ?: throw RuntimeException("Validation result is invalid, schemas must exist for a pathToItem") + val itemSchema = schemas.entries.iterator().next().key + val castItem = itemSchema.getNewInstance(item, itemPathToItem, pathToSchemas) + items.add(castItem) + i += 1 } - return new FrozenList<>(items); + return FrozenList(items) } - 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); - SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().build())); - PathToSchemasMap validatedPathToSchemas = new PathToSchemasMap(); - ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, new LinkedHashSet<>()); - PathToSchemasMap pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet); - return getNewInstance(castArg, validationMetadata.pathToItem(), pathToSchemasMap); + @Throws(ValidationException::class) + fun validate(arg: List<*>, configuration: SchemaConfiguration?): FrozenList { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0]") + val castArg: List<*> = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = Objects.requireNonNullElseGet(configuration) { + SchemaConfiguration( + JsonSchemaKeywordFlags.Builder().build() + ) + } + val validatedPathToSchemas = PathToSchemasMap() + val validationMetadata = + ValidationMetadata(pathToItem, usedConfiguration!!, validatedPathToSchemas, LinkedHashSet()) + val pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet) + return getNewInstance(castArg, validationMetadata.pathToItem, pathToSchemasMap) } - @Override - 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 RuntimeException("Invalid non-string key value"); + fun getNewInstance(arg: Map<*, *>, pathToItem: List, pathToSchemas: PathToSchemasMap): FrozenMap { + val properties = LinkedHashMap() + for ((entryKey, value1) in arg) { + if (entryKey !is String) { + throw RuntimeException("Invalid non-string key value") } - String propertyName = (String) entryKey; - List propertyPathToItem = new ArrayList<>(pathToItem); - propertyPathToItem.add(propertyName); - Object value = entry.getValue(); - LinkedHashMap, Nothing?> schemas = pathToSchemas.get(propertyPathToItem); - if (schemas == null) { - 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); - properties.put(propertyName, castValue); + val propertyName = entryKey + val propertyPathToItem: MutableList = ArrayList(pathToItem) + propertyPathToItem.add(propertyName) + val value = value1!! + val schemas = pathToSchemas.get(propertyPathToItem) + ?: throw RuntimeException("Validation result is invalid, schemas must exist for a pathToItem") + val propertySchema = schemas.entries.iterator().next().key + val castValue = propertySchema.getNewInstance(value, propertyPathToItem, pathToSchemas) + properties[propertyName] = castValue } - return new FrozenMap<>(properties); + return FrozenMap(properties) } - public FrozenMap<@Nullable Object> validate(Map arg, SchemaConfiguration configuration) throws ValidationException { - Set> pathSet = new HashSet<>(); - List pathToItem = List.of("args[0]"); - Map castArg = castToAllowedTypes(arg, pathToItem, pathSet); - SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().build())); - PathToSchemasMap validatedPathToSchemas = new PathToSchemasMap(); - ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, new LinkedHashSet<>()); - PathToSchemasMap pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet); - return getNewInstance(castArg, validationMetadata.pathToItem(), pathToSchemasMap); + @Throws(ValidationException::class) + fun validate(arg: Map<*, *>, configuration: SchemaConfiguration?): FrozenMap { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0]") + val castArg: Map<*, *> = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = Objects.requireNonNullElseGet(configuration) { + SchemaConfiguration( + JsonSchemaKeywordFlags.Builder().build() + ) + } + val validatedPathToSchemas = PathToSchemasMap() + val validationMetadata = + ValidationMetadata(pathToItem, usedConfiguration!!, validatedPathToSchemas, LinkedHashSet()) + val pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet) + return getNewInstance(castArg, validationMetadata.pathToItem, pathToSchemasMap) } - @Override - public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { + override fun getNewInstance(arg: Any?, pathToItem: List, pathToSchemas: PathToSchemasMap): Any? { if (arg == null) { - return getNewInstance((Nothing?) null, pathToItem, pathToSchemas); - } else if (arg instanceof Boolean) { - boolean boolArg = (Boolean) arg; - return getNewInstance(boolArg, pathToItem, pathToSchemas); - } else if (arg instanceof Number) { - return getNewInstance((Number) arg, pathToItem, pathToSchemas); - } else if (arg instanceof String) { - return getNewInstance((String) arg, pathToItem, pathToSchemas); - } else if (arg instanceof List) { - return getNewInstance((List) arg, pathToItem, pathToSchemas); - } else if (arg instanceof Map) { - return getNewInstance((Map) arg, pathToItem, pathToSchemas); + return getNewInstance(arg, pathToItem, pathToSchemas) + } else if (arg is Boolean) { + return getNewInstance(arg, pathToItem, pathToSchemas) + } else if (arg is Number) { + return getNewInstance(arg as Number?, pathToItem, pathToSchemas) + } else if (arg is String) { + return getNewInstance(arg as String?, pathToItem, pathToSchemas) + } else if (arg is List<*>) { + return getNewInstance(arg, pathToItem, pathToSchemas) + } else if (arg is Map<*, *>) { + return getNewInstance(arg, pathToItem, pathToSchemas) } - throw new RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); + throw RuntimeException("Invalid input type=$javaClass. It can't be instantiated by this schema") } - @Override - public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { + @Throws(ValidationException::class) + override fun validate(arg: Any?, configuration: SchemaConfiguration?): Any? { if (arg == null) { - return validate((Nothing?) null, configuration); - } else if (arg instanceof Boolean) { - boolean boolArg = (Boolean) arg; - return validate(boolArg, configuration); - } else if (arg instanceof Number) { - return validate((Number) arg, configuration); - } else if (arg instanceof String) { - return validate((String) arg, configuration); - } else if (arg instanceof List) { - return validate((List) arg, configuration); - } else if (arg instanceof Map) { - return validate((Map) arg, configuration); + return validate(null as Nothing?, configuration) + } else if (arg is Boolean) { + return validate(arg, configuration) + } else if (arg is Number) { + return validate(arg as Number?, configuration) + } else if (arg is String) { + return validate(arg as String?, configuration) + } else if (arg is List<*>) { + return validate(arg as List<*>?, configuration) + } else if (arg is Map<*, *>) { + return validate(arg as Map<*, *>?, configuration) } - throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw ValidationException("Invalid input type=$javaClass. It can't be validated by this schema") } - @Override - public UnsetAnyTypeJsonSchema1BoxedVoid validateAndBox(Nothing? arg, SchemaConfiguration configuration) throws ValidationException { - return new UnsetAnyTypeJsonSchema1BoxedVoid(validate(arg, configuration)); + @Throws(ValidationException::class) + fun validateAndBox(arg: Nothing?, configuration: SchemaConfiguration?): UnsetAnyTypeJsonSchema1BoxedVoid { + return UnsetAnyTypeJsonSchema1BoxedVoid(validate(arg, configuration)) } - @Override - public UnsetAnyTypeJsonSchema1BoxedBoolean validateAndBox(boolean arg, SchemaConfiguration configuration) throws ValidationException { - return new UnsetAnyTypeJsonSchema1BoxedBoolean(validate(arg, configuration)); + @Throws(ValidationException::class) + fun validateAndBox(arg: Boolean, configuration: SchemaConfiguration?): UnsetAnyTypeJsonSchema1BoxedBoolean { + return UnsetAnyTypeJsonSchema1BoxedBoolean(validate(arg, configuration)) } - @Override - public UnsetAnyTypeJsonSchema1BoxedNumber validateAndBox(Number arg, SchemaConfiguration configuration) throws ValidationException { - return new UnsetAnyTypeJsonSchema1BoxedNumber(validate(arg, configuration)); + @Throws(ValidationException::class) + fun validateAndBox(arg: Number, configuration: SchemaConfiguration?): UnsetAnyTypeJsonSchema1BoxedNumber { + return UnsetAnyTypeJsonSchema1BoxedNumber(validate(arg, configuration)) } - @Override - public UnsetAnyTypeJsonSchema1BoxedString validateAndBox(String arg, SchemaConfiguration configuration) throws ValidationException { - return new UnsetAnyTypeJsonSchema1BoxedString(validate(arg, configuration)); + @Throws(ValidationException::class) + fun validateAndBox(arg: String, configuration: SchemaConfiguration?): UnsetAnyTypeJsonSchema1BoxedString { + return UnsetAnyTypeJsonSchema1BoxedString(validate(arg, configuration)) } - @Override - public UnsetAnyTypeJsonSchema1BoxedList validateAndBox(List arg, SchemaConfiguration configuration) throws ValidationException { - return new UnsetAnyTypeJsonSchema1BoxedList(validate(arg, configuration)); + @Throws(ValidationException::class) + fun validateAndBox(arg: List<*>, configuration: SchemaConfiguration?): UnsetAnyTypeJsonSchema1BoxedList { + return UnsetAnyTypeJsonSchema1BoxedList(validate(arg, configuration)) } - @Override - public UnsetAnyTypeJsonSchema1BoxedMap validateAndBox(Map arg, SchemaConfiguration configuration) throws ValidationException { - return new UnsetAnyTypeJsonSchema1BoxedMap(validate(arg, configuration)); + @Throws(ValidationException::class) + fun validateAndBox(arg: Map<*, *>, configuration: SchemaConfiguration?): UnsetAnyTypeJsonSchema1BoxedMap { + return UnsetAnyTypeJsonSchema1BoxedMap(validate(arg, configuration)) } - @Override - public UnsetAnyTypeJsonSchema1Boxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { + @Throws(ValidationException::class) + override fun validateAndBox(arg: Any?, configuration: SchemaConfiguration?): UnsetAnyTypeJsonSchema1Boxed { if (arg == null) { - Nothing? castArg = (Nothing?) arg; - return validateAndBox(castArg, configuration); - } else if (arg instanceof Boolean booleanArg) { - boolean castArg = booleanArg; - return validateAndBox(castArg, configuration); - } else if (arg instanceof String castArg) { - return validateAndBox(castArg, configuration); - } else if (arg instanceof Number castArg) { - return validateAndBox(castArg, configuration); - } else if (arg instanceof List castArg) { - return validateAndBox(castArg, configuration); - } else if (arg instanceof Map castArg) { - return validateAndBox(castArg, configuration); + return validateAndBox(arg, configuration) + } else if (arg is Boolean) { + val castArg: Boolean = arg + return validateAndBox(castArg, configuration) + } else if (arg is String) { + return validateAndBox(arg, configuration) + } else if (arg is Number) { + return validateAndBox(arg, configuration) + } else if (arg is List<*>) { + return validateAndBox(arg, configuration) + } else if (arg is Map<*, *>) { + return validateAndBox(arg, configuration) } - throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw ValidationException("Invalid input type=$javaClass. It can't be validated by this schema") + } + + companion object { + var instance: UnsetAnyTypeJsonSchema1? = null + get() { + if (field == null) { + field = UnsetAnyTypeJsonSchema1() + } + return field + } + private set } } } \ 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 b3f7f5e5054..aa3a55f35fc 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 @@ -3,300 +3,323 @@ package {{{packageName}}}.schemas.validation; import {{{packageName}}}.configurations.JsonSchemaKeywordFlags; import {{{packageName}}}.configurations.SchemaConfiguration; import {{{packageName}}}.exceptions.ValidationException; -import org.checkerframework.checker.nullness.qual.Nullable; - -import java.time.LocalDate; -import java.time.ZonedDateTime; -import java.util.LinkedHashMap; -import java.util.List; -import java.util.HashSet; -import java.util.ArrayList; -import java.util.LinkedHashSet; -import java.util.Set; -import java.util.Map; -import java.util.Objects; -import java.util.UUID; - -public class UnsetAnyTypeJsonSchema { - public sealed interface UnsetAnyTypeJsonSchema1Boxed permits UnsetAnyTypeJsonSchema1BoxedVoid, UnsetAnyTypeJsonSchema1BoxedBoolean, UnsetAnyTypeJsonSchema1BoxedNumber, UnsetAnyTypeJsonSchema1BoxedString, UnsetAnyTypeJsonSchema1BoxedList, UnsetAnyTypeJsonSchema1BoxedMap { - @Nullable Object getData(); - } - public record UnsetAnyTypeJsonSchema1BoxedVoid(Void data) implements UnsetAnyTypeJsonSchema1Boxed { - @Override - public @Nullable Object getData() { - return data; - } + +import java.time.LocalDate +import java.time.ZonedDateTime + +class UnsetAnyTypeJsonSchema { + interface UnsetAnyTypeJsonSchema1Boxed { + val data: Any? } - public record UnsetAnyTypeJsonSchema1BoxedBoolean(boolean data) implements UnsetAnyTypeJsonSchema1Boxed { - @Override - public @Nullable Object getData() { - return data; + + data class UnsetAnyTypeJsonSchema1BoxedVoid(override val data: Nothing?) : UnsetAnyTypeJsonSchema1Boxed { + fun getData(): Any? { + return data } } - public record UnsetAnyTypeJsonSchema1BoxedNumber(Number data) implements UnsetAnyTypeJsonSchema1Boxed { - @Override - public @Nullable Object getData() { - return data; + + data class UnsetAnyTypeJsonSchema1BoxedBoolean(override val data: Boolean) : UnsetAnyTypeJsonSchema1Boxed { + fun getData(): Any? { + return data } } - public record UnsetAnyTypeJsonSchema1BoxedString(String data) implements UnsetAnyTypeJsonSchema1Boxed { - @Override - public @Nullable Object getData() { - return data; + + data class UnsetAnyTypeJsonSchema1BoxedNumber(override val data: Number?) : UnsetAnyTypeJsonSchema1Boxed { + fun getData(): Any? { + return data } } - public record UnsetAnyTypeJsonSchema1BoxedList(FrozenList<@Nullable Object> data) implements UnsetAnyTypeJsonSchema1Boxed { - @Override - public @Nullable Object getData() { - return data; + + data class UnsetAnyTypeJsonSchema1BoxedString(override val data: String?) : UnsetAnyTypeJsonSchema1Boxed { + fun getData(): Any? { + return data } } - public record UnsetAnyTypeJsonSchema1BoxedMap(FrozenMap<@Nullable Object> data) implements UnsetAnyTypeJsonSchema1Boxed { - @Override - public @Nullable Object getData() { - return data; + + data class UnsetAnyTypeJsonSchema1BoxedList(override val data: FrozenList) : UnsetAnyTypeJsonSchema1Boxed { + fun getData(): Any? { + return data } } - public static class UnsetAnyTypeJsonSchema1 extends JsonSchema implements NullSchemaValidator, BooleanSchemaValidator, NumberSchemaValidator, StringSchemaValidator, ListSchemaValidator, UnsetAnyTypeJsonSchema1BoxedList>, MapSchemaValidator, UnsetAnyTypeJsonSchema1BoxedMap> { - private static @Nullable UnsetAnyTypeJsonSchema1 instance = null; - protected UnsetAnyTypeJsonSchema1() { - super(new JsonSchemaInfo()); + data class UnsetAnyTypeJsonSchema1BoxedMap(override val data: FrozenMap) : UnsetAnyTypeJsonSchema1Boxed { + fun getData(): Any? { + return data } + } - public static UnsetAnyTypeJsonSchema1 getInstance() { - if (instance == null) { - instance = new UnsetAnyTypeJsonSchema1(); + class UnsetAnyTypeJsonSchema1 protected constructor() : JsonSchema(JsonSchemaInfo()), + NullSchemaValidator, + BooleanSchemaValidator, + NumberSchemaValidator, + StringSchemaValidator, + ListSchemaValidator?, UnsetAnyTypeJsonSchema1BoxedList?>, + MapSchemaValidator?, UnsetAnyTypeJsonSchema1BoxedMap?> { + @Throws(ValidationException::class) + fun validate(arg: Nothing?, configuration: SchemaConfiguration?): Nothing? { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0]") + val castArg: Nothing? = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = Objects.requireNonNullElseGet(configuration) { + SchemaConfiguration( + JsonSchemaKeywordFlags.Builder().build() + ) } - return instance; - } - - @Override - public Void validate(Void arg, SchemaConfiguration configuration) throws ValidationException { - Set> pathSet = new HashSet<>(); - List pathToItem = List.of("args[0]"); - Void castArg = castToAllowedTypes(arg, pathToItem, pathSet); - SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().build())); - PathToSchemasMap validatedPathToSchemas = new PathToSchemasMap(); - ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, new LinkedHashSet<>()); - PathToSchemasMap pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet); - return getNewInstance(castArg, validationMetadata.pathToItem(), pathToSchemasMap); + val validatedPathToSchemas = PathToSchemasMap() + val validationMetadata = + ValidationMetadata(pathToItem, usedConfiguration!!, validatedPathToSchemas, LinkedHashSet()) + val pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet) + return getNewInstance(castArg, validationMetadata.pathToItem, pathToSchemasMap) } - @Override - public boolean validate(boolean arg, SchemaConfiguration configuration) throws ValidationException { - Set> pathSet = new HashSet<>(); - List pathToItem = List.of("args[0]"); - boolean castArg = castToAllowedTypes(arg, pathToItem, pathSet); - SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().build())); - PathToSchemasMap validatedPathToSchemas = new PathToSchemasMap(); - ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, new LinkedHashSet<>()); - PathToSchemasMap pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet); - return getNewInstance(castArg, validationMetadata.pathToItem(), pathToSchemasMap); + @Throws(ValidationException::class) + fun validate(arg: Boolean, configuration: SchemaConfiguration?): Boolean { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0]") + val castArg: Boolean = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = Objects.requireNonNullElseGet(configuration) { + SchemaConfiguration( + JsonSchemaKeywordFlags.Builder().build() + ) + } + val validatedPathToSchemas = PathToSchemasMap() + val validationMetadata = + ValidationMetadata(pathToItem, usedConfiguration!!, validatedPathToSchemas, LinkedHashSet()) + val pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet) + return getNewInstance(castArg, validationMetadata.pathToItem, pathToSchemasMap) } - @Override - public Number validate(Number arg, SchemaConfiguration configuration) throws ValidationException { - Set> pathSet = new HashSet<>(); - List pathToItem = List.of("args[0]"); - Number castArg = castToAllowedTypes(arg, pathToItem, pathSet); - SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().build())); - PathToSchemasMap validatedPathToSchemas = new PathToSchemasMap(); - ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, new LinkedHashSet<>()); - PathToSchemasMap pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet); - return getNewInstance(castArg, validationMetadata.pathToItem(), pathToSchemasMap); + @Throws(ValidationException::class) + fun validate(arg: Number, configuration: SchemaConfiguration?): Number? { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0]") + val castArg: Number = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = Objects.requireNonNullElseGet(configuration) { + SchemaConfiguration( + JsonSchemaKeywordFlags.Builder().build() + ) + } + val validatedPathToSchemas = PathToSchemasMap() + val validationMetadata = + ValidationMetadata(pathToItem, usedConfiguration!!, validatedPathToSchemas, LinkedHashSet()) + val pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet) + return getNewInstance(castArg, validationMetadata.pathToItem, pathToSchemasMap) } - public int validate(int arg, SchemaConfiguration configuration) throws ValidationException { - return (int) validate((Number) arg, configuration); + @Throws(ValidationException::class) + fun validate(arg: Int, configuration: SchemaConfiguration?): Int { + return validate(arg as Number, configuration) as Int } - public long validate(long arg, SchemaConfiguration configuration) throws ValidationException { - return (long) validate((Number) arg, configuration); + @Throws(ValidationException::class) + fun validate(arg: Long, configuration: SchemaConfiguration?): Long { + return validate(arg as Number, configuration) as Long } - public float validate(float arg, SchemaConfiguration configuration) throws ValidationException { - return (float) validate((Number) arg, configuration); + @Throws(ValidationException::class) + fun validate(arg: Float, configuration: SchemaConfiguration?): Float { + return validate(arg as Number, configuration) as Float } - public double validate(double arg, SchemaConfiguration configuration) throws ValidationException { - return (double) validate((Number) arg, configuration); + @Throws(ValidationException::class) + fun validate(arg: Double, configuration: SchemaConfiguration?): Double { + return validate(arg as Number, configuration) as Double } - @Override - public String validate(String arg, SchemaConfiguration configuration) throws ValidationException { - Set> pathSet = new HashSet<>(); - List pathToItem = List.of("args[0]"); - String castArg = castToAllowedTypes(arg, pathToItem, pathSet); - SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().build())); - PathToSchemasMap validatedPathToSchemas = new PathToSchemasMap(); - ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, new LinkedHashSet<>()); - PathToSchemasMap pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet); - return getNewInstance(castArg, validationMetadata.pathToItem(), pathToSchemasMap); + @Throws(ValidationException::class) + fun validate(arg: String, configuration: SchemaConfiguration?): String? { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0]") + val castArg: String = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = Objects.requireNonNullElseGet(configuration) { + SchemaConfiguration( + JsonSchemaKeywordFlags.Builder().build() + ) + } + val validatedPathToSchemas = PathToSchemasMap() + val validationMetadata = + ValidationMetadata(pathToItem, usedConfiguration!!, validatedPathToSchemas, LinkedHashSet()) + val pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet) + return getNewInstance(castArg, validationMetadata.pathToItem, pathToSchemasMap) } - public String validate(LocalDate arg, SchemaConfiguration configuration) throws ValidationException { - return validate(arg.toString(), configuration); + @Throws(ValidationException::class) + fun validate(arg: LocalDate, configuration: SchemaConfiguration?): String? { + return validate(arg.toString(), configuration) } - public String validate(ZonedDateTime arg, SchemaConfiguration configuration) throws ValidationException { - return validate(arg.toString(), configuration); + @Throws(ValidationException::class) + fun validate(arg: ZonedDateTime, configuration: SchemaConfiguration?): String? { + return validate(arg.toString(), configuration) } - public String validate(UUID arg, SchemaConfiguration configuration) throws ValidationException { - return validate(arg.toString(), configuration); + @Throws(ValidationException::class) + fun validate(arg: UUID, configuration: SchemaConfiguration?): String? { + return validate(arg.toString(), configuration) } - @Override - public FrozenList<@Nullable Object> getNewInstance(List arg, List pathToItem, PathToSchemasMap pathToSchemas) { - List<@Nullable Object> items = new ArrayList<>(); - int i = 0; - for (Object item: arg) { - List itemPathToItem = new ArrayList<>(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"); - } - JsonSchema itemSchema = schemas.entrySet().iterator().next().getKey(); - @Nullable Object castItem = itemSchema.getNewInstance(item, itemPathToItem, pathToSchemas); - items.add(castItem); - i += 1; + fun getNewInstance(arg: List<*>, pathToItem: List, pathToSchemas: PathToSchemasMap): FrozenList { + val items: MutableList = ArrayList() + var i = 0 + for (item in arg) { + val itemPathToItem: MutableList = ArrayList(pathToItem) + itemPathToItem.add(i) + val schemas = pathToSchemas.get(itemPathToItem) + ?: throw RuntimeException("Validation result is invalid, schemas must exist for a pathToItem") + val itemSchema = schemas.entries.iterator().next().key + val castItem = itemSchema.getNewInstance(item, itemPathToItem, pathToSchemas) + items.add(castItem) + i += 1 } - return new FrozenList<>(items); + return FrozenList(items) } - 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); - SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().build())); - PathToSchemasMap validatedPathToSchemas = new PathToSchemasMap(); - ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, new LinkedHashSet<>()); - PathToSchemasMap pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet); - return getNewInstance(castArg, validationMetadata.pathToItem(), pathToSchemasMap); + @Throws(ValidationException::class) + fun validate(arg: List<*>, configuration: SchemaConfiguration?): FrozenList { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0]") + val castArg: List<*> = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = Objects.requireNonNullElseGet(configuration) { + SchemaConfiguration( + JsonSchemaKeywordFlags.Builder().build() + ) + } + val validatedPathToSchemas = PathToSchemasMap() + val validationMetadata = + ValidationMetadata(pathToItem, usedConfiguration!!, validatedPathToSchemas, LinkedHashSet()) + val pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet) + return getNewInstance(castArg, validationMetadata.pathToItem, pathToSchemasMap) } - @Override - 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 RuntimeException("Invalid non-string key value"); + fun getNewInstance(arg: Map<*, *>, pathToItem: List, pathToSchemas: PathToSchemasMap): FrozenMap { + val properties = LinkedHashMap() + for ((entryKey, value1) in arg) { + if (entryKey !is String) { + throw RuntimeException("Invalid non-string key value") } - String propertyName = (String) entryKey; - List propertyPathToItem = new ArrayList<>(pathToItem); - propertyPathToItem.add(propertyName); - Object value = entry.getValue(); - LinkedHashMap, Void> schemas = pathToSchemas.get(propertyPathToItem); - if (schemas == null) { - 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); - properties.put(propertyName, castValue); + val propertyName = entryKey + val propertyPathToItem: MutableList = ArrayList(pathToItem) + propertyPathToItem.add(propertyName) + val value = value1!! + val schemas = pathToSchemas.get(propertyPathToItem) + ?: throw RuntimeException("Validation result is invalid, schemas must exist for a pathToItem") + val propertySchema = schemas.entries.iterator().next().key + val castValue = propertySchema.getNewInstance(value, propertyPathToItem, pathToSchemas) + properties[propertyName] = castValue } - return new FrozenMap<>(properties); + return FrozenMap(properties) } - public FrozenMap<@Nullable Object> validate(Map arg, SchemaConfiguration configuration) throws ValidationException { - Set> pathSet = new HashSet<>(); - List pathToItem = List.of("args[0]"); - Map castArg = castToAllowedTypes(arg, pathToItem, pathSet); - SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().build())); - PathToSchemasMap validatedPathToSchemas = new PathToSchemasMap(); - ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, new LinkedHashSet<>()); - PathToSchemasMap pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet); - return getNewInstance(castArg, validationMetadata.pathToItem(), pathToSchemasMap); + @Throws(ValidationException::class) + fun validate(arg: Map<*, *>, configuration: SchemaConfiguration?): FrozenMap { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0]") + val castArg: Map<*, *> = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = Objects.requireNonNullElseGet(configuration) { + SchemaConfiguration( + JsonSchemaKeywordFlags.Builder().build() + ) + } + val validatedPathToSchemas = PathToSchemasMap() + val validationMetadata = + ValidationMetadata(pathToItem, usedConfiguration!!, validatedPathToSchemas, LinkedHashSet()) + val pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet) + return getNewInstance(castArg, validationMetadata.pathToItem, pathToSchemasMap) } - @Override - public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { + override fun getNewInstance(arg: Any?, pathToItem: List, pathToSchemas: PathToSchemasMap): Any? { if (arg == null) { - return getNewInstance((Void) null, pathToItem, pathToSchemas); - } else if (arg instanceof Boolean) { - boolean boolArg = (Boolean) arg; - return getNewInstance(boolArg, pathToItem, pathToSchemas); - } else if (arg instanceof Number) { - return getNewInstance((Number) arg, pathToItem, pathToSchemas); - } else if (arg instanceof String) { - return getNewInstance((String) arg, pathToItem, pathToSchemas); - } else if (arg instanceof List) { - return getNewInstance((List) arg, pathToItem, pathToSchemas); - } else if (arg instanceof Map) { - return getNewInstance((Map) arg, pathToItem, pathToSchemas); + return getNewInstance(arg, pathToItem, pathToSchemas) + } else if (arg is Boolean) { + return getNewInstance(arg, pathToItem, pathToSchemas) + } else if (arg is Number) { + return getNewInstance(arg as Number?, pathToItem, pathToSchemas) + } else if (arg is String) { + return getNewInstance(arg as String?, pathToItem, pathToSchemas) + } else if (arg is List<*>) { + return getNewInstance(arg, pathToItem, pathToSchemas) + } else if (arg is Map<*, *>) { + return getNewInstance(arg, pathToItem, pathToSchemas) } - throw new RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); + throw RuntimeException("Invalid input type=$javaClass. It can't be instantiated by this schema") } - @Override - public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { + @Throws(ValidationException::class) + override fun validate(arg: Any?, configuration: SchemaConfiguration?): Any? { if (arg == null) { - return validate((Void) null, configuration); - } else if (arg instanceof Boolean) { - boolean boolArg = (Boolean) arg; - return validate(boolArg, configuration); - } else if (arg instanceof Number) { - return validate((Number) arg, configuration); - } else if (arg instanceof String) { - return validate((String) arg, configuration); - } else if (arg instanceof List) { - return validate((List) arg, configuration); - } else if (arg instanceof Map) { - return validate((Map) arg, configuration); + return validate(null as Nothing?, configuration) + } else if (arg is Boolean) { + return validate(arg, configuration) + } else if (arg is Number) { + return validate(arg as Number?, configuration) + } else if (arg is String) { + return validate(arg as String?, configuration) + } else if (arg is List<*>) { + return validate(arg as List<*>?, configuration) + } else if (arg is Map<*, *>) { + return validate(arg as Map<*, *>?, configuration) } - throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw ValidationException("Invalid input type=$javaClass. It can't be validated by this schema") } - @Override - public UnsetAnyTypeJsonSchema1BoxedVoid validateAndBox(Void arg, SchemaConfiguration configuration) throws ValidationException { - return new UnsetAnyTypeJsonSchema1BoxedVoid(validate(arg, configuration)); + @Throws(ValidationException::class) + fun validateAndBox(arg: Nothing?, configuration: SchemaConfiguration?): UnsetAnyTypeJsonSchema1BoxedVoid { + return UnsetAnyTypeJsonSchema1BoxedVoid(validate(arg, configuration)) } - @Override - public UnsetAnyTypeJsonSchema1BoxedBoolean validateAndBox(boolean arg, SchemaConfiguration configuration) throws ValidationException { - return new UnsetAnyTypeJsonSchema1BoxedBoolean(validate(arg, configuration)); + @Throws(ValidationException::class) + fun validateAndBox(arg: Boolean, configuration: SchemaConfiguration?): UnsetAnyTypeJsonSchema1BoxedBoolean { + return UnsetAnyTypeJsonSchema1BoxedBoolean(validate(arg, configuration)) } - @Override - public UnsetAnyTypeJsonSchema1BoxedNumber validateAndBox(Number arg, SchemaConfiguration configuration) throws ValidationException { - return new UnsetAnyTypeJsonSchema1BoxedNumber(validate(arg, configuration)); + @Throws(ValidationException::class) + fun validateAndBox(arg: Number, configuration: SchemaConfiguration?): UnsetAnyTypeJsonSchema1BoxedNumber { + return UnsetAnyTypeJsonSchema1BoxedNumber(validate(arg, configuration)) } - @Override - public UnsetAnyTypeJsonSchema1BoxedString validateAndBox(String arg, SchemaConfiguration configuration) throws ValidationException { - return new UnsetAnyTypeJsonSchema1BoxedString(validate(arg, configuration)); + @Throws(ValidationException::class) + fun validateAndBox(arg: String, configuration: SchemaConfiguration?): UnsetAnyTypeJsonSchema1BoxedString { + return UnsetAnyTypeJsonSchema1BoxedString(validate(arg, configuration)) } - @Override - public UnsetAnyTypeJsonSchema1BoxedList validateAndBox(List arg, SchemaConfiguration configuration) throws ValidationException { - return new UnsetAnyTypeJsonSchema1BoxedList(validate(arg, configuration)); + @Throws(ValidationException::class) + fun validateAndBox(arg: List<*>, configuration: SchemaConfiguration?): UnsetAnyTypeJsonSchema1BoxedList { + return UnsetAnyTypeJsonSchema1BoxedList(validate(arg, configuration)) } - @Override - public UnsetAnyTypeJsonSchema1BoxedMap validateAndBox(Map arg, SchemaConfiguration configuration) throws ValidationException { - return new UnsetAnyTypeJsonSchema1BoxedMap(validate(arg, configuration)); + @Throws(ValidationException::class) + fun validateAndBox(arg: Map<*, *>, configuration: SchemaConfiguration?): UnsetAnyTypeJsonSchema1BoxedMap { + return UnsetAnyTypeJsonSchema1BoxedMap(validate(arg, configuration)) } - @Override - public UnsetAnyTypeJsonSchema1Boxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { + @Throws(ValidationException::class) + override fun validateAndBox(arg: Any?, configuration: SchemaConfiguration?): UnsetAnyTypeJsonSchema1Boxed { if (arg == null) { - Void castArg = (Void) arg; - return validateAndBox(castArg, configuration); - } else if (arg instanceof Boolean booleanArg) { - boolean castArg = booleanArg; - return validateAndBox(castArg, configuration); - } else if (arg instanceof String castArg) { - return validateAndBox(castArg, configuration); - } else if (arg instanceof Number castArg) { - return validateAndBox(castArg, configuration); - } else if (arg instanceof List castArg) { - return validateAndBox(castArg, configuration); - } else if (arg instanceof Map castArg) { - return validateAndBox(castArg, configuration); + return validateAndBox(arg, configuration) + } else if (arg is Boolean) { + val castArg: Boolean = arg + return validateAndBox(castArg, configuration) + } else if (arg is String) { + return validateAndBox(arg, configuration) + } else if (arg is Number) { + return validateAndBox(arg, configuration) + } else if (arg is List<*>) { + return validateAndBox(arg, configuration) + } else if (arg is Map<*, *>) { + return validateAndBox(arg, configuration) } - throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw ValidationException("Invalid input type=$javaClass. It can't be validated by this schema") + } + + companion object { + var instance: UnsetAnyTypeJsonSchema1? = null + get() { + if (field == null) { + field = UnsetAnyTypeJsonSchema1() + } + return field + } + private set } } } \ No newline at end of file diff --git a/src/main/resources/kotlin/src/main/kotlin/packagename/schemas/validation/JsonSchema.hbs b/src/main/resources/kotlin/src/main/kotlin/packagename/schemas/validation/JsonSchema.hbs index 04627a810a0..33626ccc4c7 100644 --- a/src/main/resources/kotlin/src/main/kotlin/packagename/schemas/validation/JsonSchema.hbs +++ b/src/main/resources/kotlin/src/main/kotlin/packagename/schemas/validation/JsonSchema.hbs @@ -213,7 +213,7 @@ abstract class JsonSchema protected constructor(jsonSchemaInfo: JsonSchemaInf this.keywordToValidator = keywordToValidator } - abstract fun getNewInstance(arg: Any?, pathToItem: List?, pathToSchemas: PathToSchemasMap?): Any? + abstract fun getNewInstance(arg: Any?, pathToItem: List, pathToSchemas: PathToSchemasMap): Any? @Throws(ValidationException::class) abstract fun validate(arg: Any?, configuration: SchemaConfiguration?): Any? @Throws(ValidationException::class) @@ -302,28 +302,28 @@ abstract class JsonSchema protected constructor(jsonSchemaInfo: JsonSchemaInf return pathToSchemas } - protected fun castToAllowedTypes(arg: String, pathToItem: List?, pathSet: MutableSet?>): String { + protected fun castToAllowedTypes(arg: String, pathToItem: List, pathSet: MutableSet>): String { pathSet.add(pathToItem) return arg } - protected fun castToAllowedTypes(arg: Boolean, pathToItem: List?, pathSet: MutableSet?>): Boolean { + protected fun castToAllowedTypes(arg: Boolean, pathToItem: List, pathSet: MutableSet>): Boolean { pathSet.add(pathToItem) return arg } - protected fun castToAllowedTypes(arg: Number, pathToItem: List?, pathSet: MutableSet?>): Number { + protected fun castToAllowedTypes(arg: Number, pathToItem: List, pathSet: MutableSet>): Number { pathSet.add(pathToItem) return arg } - protected fun castToAllowedTypes(arg: Void?, pathToItem: List?, pathSet: MutableSet?>): Void? { + protected fun castToAllowedTypes(arg: Nothing?, pathToItem: List, pathSet: MutableSet>): Nothing? { pathSet.add(pathToItem) return arg } @Throws(ValidationException::class) - protected fun castToAllowedTypes(arg: List<*>, pathToItem: List?, pathSet: MutableSet?>): List<*> { + protected fun castToAllowedTypes(arg: List<*>, pathToItem: List, pathSet: MutableSet>): List<*> { pathSet.add(pathToItem) val argFixed: MutableList = ArrayList() var i = 0 @@ -340,8 +340,8 @@ abstract class JsonSchema protected constructor(jsonSchemaInfo: JsonSchemaInf @Throws(ValidationException::class) protected fun castToAllowedTypes( arg: Map<*, *>, - pathToItem: List?, - pathSet: MutableSet?> + pathToItem: List, + pathSet: MutableSet> ): Map<*, *> { pathSet.add(pathToItem) val argFixed = LinkedHashMap() @@ -359,7 +359,7 @@ abstract class JsonSchema protected constructor(jsonSchemaInfo: JsonSchemaInf } @Throws(ValidationException::class) - private fun castToAllowedObjectTypes(arg: Any?, pathToItem: List, pathSet: MutableSet?>): Any? { + private fun castToAllowedObjectTypes(arg: Any?, pathToItem: List, pathSet: MutableSet>): Any? { return if (arg == null) { castToAllowedTypes(null as Void?, pathToItem, pathSet) } else if (arg is String) { @@ -391,19 +391,19 @@ abstract class JsonSchema protected constructor(jsonSchemaInfo: JsonSchemaInf } } - fun getNewInstance(arg: Void, pathToItem: List?, pathToSchemas: PathToSchemasMap?): Void { + fun getNewInstance(arg: Nothing?, pathToItem: List, pathToSchemas: PathToSchemasMap): Nothing? { return arg } - fun getNewInstance(arg: Boolean, pathToItem: List?, pathToSchemas: PathToSchemasMap?): Boolean { + fun getNewInstance(arg: Boolean, pathToItem: List, pathToSchemas: PathToSchemasMap): Boolean { return arg } - fun getNewInstance(arg: Number, pathToItem: List?, pathToSchemas: PathToSchemasMap?): Number { + fun getNewInstance(arg: Number, pathToItem: List, pathToSchemas: PathToSchemasMap): Number { return arg } - fun getNewInstance(arg: String, pathToItem: List?, pathToSchemas: PathToSchemasMap?): String { + fun getNewInstance(arg: String, pathToItem: List, pathToSchemas: PathToSchemasMap): String { return arg } @@ -464,12 +464,13 @@ abstract class JsonSchema protected constructor(jsonSchemaInfo: JsonSchemaInf return pathToSchemas } + @JvmStatic @Throws(ValidationException::class) protected fun getPathToSchemas( jsonSchema: JsonSchema<*>, arg: Any?, validationMetadata: ValidationMetadata, - pathSet: Set> + pathSet: Set> ): PathToSchemasMap { val pathToSchemasMap = PathToSchemasMap() // todo add check of validationMetadata.validationRanEarlier(this) From 60a42f31179924afe42eeeee82df6e79c1c331de Mon Sep 17 00:00:00 2001 From: Justin Black Date: Mon, 6 May 2024 17:18:14 -0700 Subject: [PATCH 10/78] Move improvemnts for kotlin code of json schema and unset anytype schema --- .../client/schemas/validation/JsonSchema.kt | 6 +- .../validation/UnsetAnyTypeJsonSchema.kt | 1 + .../validation/UnsetAnyTypeJsonSchema.hbs | 471 +++++++++-------- .../schemas/validation/JsonSchema.hbs | 6 +- .../validation/UnsetAnyTypeJsonSchema.hbs | 472 +++++++++--------- 5 files changed, 479 insertions(+), 477 deletions(-) diff --git a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/schemas/validation/JsonSchema.kt b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/schemas/validation/JsonSchema.kt index eeffba0de1f..f71954ddb42 100644 --- a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/schemas/validation/JsonSchema.kt +++ b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/schemas/validation/JsonSchema.kt @@ -359,9 +359,9 @@ abstract class JsonSchema protected constructor(jsonSchemaInfo: JsonSchemaInf } @Throws(ValidationException::class) - private fun castToAllowedObjectTypes(arg: Any?, pathToItem: List, pathSet: MutableSet>): Any? { + private fun castToAllowedObjectTypes(arg: Any?, pathToItem: List, pathSet: MutableSet>): Any? { return if (arg == null) { - castToAllowedTypes(null as Void?, pathToItem, pathSet) + castToAllowedTypes(arg, pathToItem, pathSet) } else if (arg is String) { castToAllowedTypes(arg, pathToItem, pathSet) } else if (arg is Map<*, *>) { @@ -481,7 +481,7 @@ abstract class JsonSchema protected constructor(jsonSchemaInfo: JsonSchemaInf schemas.clear() schemas[firstSchema] = null } - var mutPathSet: MutableSet> = pathSet.toMutableSet() + var mutPathSet: MutableSet> = pathSet.toMutableSet() mutPathSet.removeAll(pathToSchemasMap.keys) if (!mutPathSet.isEmpty()) { val unsetAnyTypeSchema = LinkedHashMap, Nothing?>() diff --git a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/schemas/validation/UnsetAnyTypeJsonSchema.kt b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/schemas/validation/UnsetAnyTypeJsonSchema.kt index b1c48aa50a2..c796c129746 100644 --- a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/schemas/validation/UnsetAnyTypeJsonSchema.kt +++ b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/schemas/validation/UnsetAnyTypeJsonSchema.kt @@ -6,6 +6,7 @@ import org.openapijsonschematools.client.exceptions.ValidationException import java.time.LocalDate import java.time.ZonedDateTime +import java.util.UUID class UnsetAnyTypeJsonSchema { interface UnsetAnyTypeJsonSchema1Boxed { 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 aa3a55f35fc..b3f7f5e5054 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 @@ -3,323 +3,300 @@ package {{{packageName}}}.schemas.validation; import {{{packageName}}}.configurations.JsonSchemaKeywordFlags; import {{{packageName}}}.configurations.SchemaConfiguration; import {{{packageName}}}.exceptions.ValidationException; - -import java.time.LocalDate -import java.time.ZonedDateTime - -class UnsetAnyTypeJsonSchema { - interface UnsetAnyTypeJsonSchema1Boxed { - val data: Any? +import org.checkerframework.checker.nullness.qual.Nullable; + +import java.time.LocalDate; +import java.time.ZonedDateTime; +import java.util.LinkedHashMap; +import java.util.List; +import java.util.HashSet; +import java.util.ArrayList; +import java.util.LinkedHashSet; +import java.util.Set; +import java.util.Map; +import java.util.Objects; +import java.util.UUID; + +public class UnsetAnyTypeJsonSchema { + public sealed interface UnsetAnyTypeJsonSchema1Boxed permits UnsetAnyTypeJsonSchema1BoxedVoid, UnsetAnyTypeJsonSchema1BoxedBoolean, UnsetAnyTypeJsonSchema1BoxedNumber, UnsetAnyTypeJsonSchema1BoxedString, UnsetAnyTypeJsonSchema1BoxedList, UnsetAnyTypeJsonSchema1BoxedMap { + @Nullable Object getData(); } - - data class UnsetAnyTypeJsonSchema1BoxedVoid(override val data: Nothing?) : UnsetAnyTypeJsonSchema1Boxed { - fun getData(): Any? { - return data + public record UnsetAnyTypeJsonSchema1BoxedVoid(Void data) implements UnsetAnyTypeJsonSchema1Boxed { + @Override + public @Nullable Object getData() { + return data; } } - - data class UnsetAnyTypeJsonSchema1BoxedBoolean(override val data: Boolean) : UnsetAnyTypeJsonSchema1Boxed { - fun getData(): Any? { - return data + public record UnsetAnyTypeJsonSchema1BoxedBoolean(boolean data) implements UnsetAnyTypeJsonSchema1Boxed { + @Override + public @Nullable Object getData() { + return data; } } - - data class UnsetAnyTypeJsonSchema1BoxedNumber(override val data: Number?) : UnsetAnyTypeJsonSchema1Boxed { - fun getData(): Any? { - return data + public record UnsetAnyTypeJsonSchema1BoxedNumber(Number data) implements UnsetAnyTypeJsonSchema1Boxed { + @Override + public @Nullable Object getData() { + return data; } } - - data class UnsetAnyTypeJsonSchema1BoxedString(override val data: String?) : UnsetAnyTypeJsonSchema1Boxed { - fun getData(): Any? { - return data + public record UnsetAnyTypeJsonSchema1BoxedString(String data) implements UnsetAnyTypeJsonSchema1Boxed { + @Override + public @Nullable Object getData() { + return data; } } - - data class UnsetAnyTypeJsonSchema1BoxedList(override val data: FrozenList) : UnsetAnyTypeJsonSchema1Boxed { - fun getData(): Any? { - return data + public record UnsetAnyTypeJsonSchema1BoxedList(FrozenList<@Nullable Object> data) implements UnsetAnyTypeJsonSchema1Boxed { + @Override + public @Nullable Object getData() { + return data; } } - - data class UnsetAnyTypeJsonSchema1BoxedMap(override val data: FrozenMap) : UnsetAnyTypeJsonSchema1Boxed { - fun getData(): Any? { - return data + public record UnsetAnyTypeJsonSchema1BoxedMap(FrozenMap<@Nullable Object> data) implements UnsetAnyTypeJsonSchema1Boxed { + @Override + public @Nullable Object getData() { + return data; } } + public static class UnsetAnyTypeJsonSchema1 extends JsonSchema implements NullSchemaValidator, BooleanSchemaValidator, NumberSchemaValidator, StringSchemaValidator, ListSchemaValidator, UnsetAnyTypeJsonSchema1BoxedList>, MapSchemaValidator, UnsetAnyTypeJsonSchema1BoxedMap> { + private static @Nullable UnsetAnyTypeJsonSchema1 instance = null; - class UnsetAnyTypeJsonSchema1 protected constructor() : JsonSchema(JsonSchemaInfo()), - NullSchemaValidator, - BooleanSchemaValidator, - NumberSchemaValidator, - StringSchemaValidator, - ListSchemaValidator?, UnsetAnyTypeJsonSchema1BoxedList?>, - MapSchemaValidator?, UnsetAnyTypeJsonSchema1BoxedMap?> { - @Throws(ValidationException::class) - fun validate(arg: Nothing?, configuration: SchemaConfiguration?): Nothing? { - val pathSet: MutableSet> = HashSet() - val pathToItem = listOf("args[0]") - val castArg: Nothing? = castToAllowedTypes(arg, pathToItem, pathSet) - val usedConfiguration = Objects.requireNonNullElseGet(configuration) { - SchemaConfiguration( - JsonSchemaKeywordFlags.Builder().build() - ) - } - val validatedPathToSchemas = PathToSchemasMap() - val validationMetadata = - ValidationMetadata(pathToItem, usedConfiguration!!, validatedPathToSchemas, LinkedHashSet()) - val pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet) - return getNewInstance(castArg, validationMetadata.pathToItem, pathToSchemasMap) + protected UnsetAnyTypeJsonSchema1() { + super(new JsonSchemaInfo()); } - @Throws(ValidationException::class) - fun validate(arg: Boolean, configuration: SchemaConfiguration?): Boolean { - val pathSet: MutableSet> = HashSet() - val pathToItem = listOf("args[0]") - val castArg: Boolean = castToAllowedTypes(arg, pathToItem, pathSet) - val usedConfiguration = Objects.requireNonNullElseGet(configuration) { - SchemaConfiguration( - JsonSchemaKeywordFlags.Builder().build() - ) + public static UnsetAnyTypeJsonSchema1 getInstance() { + if (instance == null) { + instance = new UnsetAnyTypeJsonSchema1(); } - val validatedPathToSchemas = PathToSchemasMap() - val validationMetadata = - ValidationMetadata(pathToItem, usedConfiguration!!, validatedPathToSchemas, LinkedHashSet()) - val pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet) - return getNewInstance(castArg, validationMetadata.pathToItem, pathToSchemasMap) + return instance; } - @Throws(ValidationException::class) - fun validate(arg: Number, configuration: SchemaConfiguration?): Number? { - val pathSet: MutableSet> = HashSet() - val pathToItem = listOf("args[0]") - val castArg: Number = castToAllowedTypes(arg, pathToItem, pathSet) - val usedConfiguration = Objects.requireNonNullElseGet(configuration) { - SchemaConfiguration( - JsonSchemaKeywordFlags.Builder().build() - ) - } - val validatedPathToSchemas = PathToSchemasMap() - val validationMetadata = - ValidationMetadata(pathToItem, usedConfiguration!!, validatedPathToSchemas, LinkedHashSet()) - val pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet) - return getNewInstance(castArg, validationMetadata.pathToItem, pathToSchemasMap) + @Override + public Void validate(Void arg, SchemaConfiguration configuration) throws ValidationException { + Set> pathSet = new HashSet<>(); + List pathToItem = List.of("args[0]"); + Void castArg = castToAllowedTypes(arg, pathToItem, pathSet); + SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().build())); + PathToSchemasMap validatedPathToSchemas = new PathToSchemasMap(); + ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, new LinkedHashSet<>()); + PathToSchemasMap pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet); + return getNewInstance(castArg, validationMetadata.pathToItem(), pathToSchemasMap); } - @Throws(ValidationException::class) - fun validate(arg: Int, configuration: SchemaConfiguration?): Int { - return validate(arg as Number, configuration) as Int + @Override + public boolean validate(boolean arg, SchemaConfiguration configuration) throws ValidationException { + Set> pathSet = new HashSet<>(); + List pathToItem = List.of("args[0]"); + boolean castArg = castToAllowedTypes(arg, pathToItem, pathSet); + SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().build())); + PathToSchemasMap validatedPathToSchemas = new PathToSchemasMap(); + ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, new LinkedHashSet<>()); + PathToSchemasMap pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet); + return getNewInstance(castArg, validationMetadata.pathToItem(), pathToSchemasMap); } - @Throws(ValidationException::class) - fun validate(arg: Long, configuration: SchemaConfiguration?): Long { - return validate(arg as Number, configuration) as Long + @Override + public Number validate(Number arg, SchemaConfiguration configuration) throws ValidationException { + Set> pathSet = new HashSet<>(); + List pathToItem = List.of("args[0]"); + Number castArg = castToAllowedTypes(arg, pathToItem, pathSet); + SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().build())); + PathToSchemasMap validatedPathToSchemas = new PathToSchemasMap(); + ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, new LinkedHashSet<>()); + PathToSchemasMap pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet); + return getNewInstance(castArg, validationMetadata.pathToItem(), pathToSchemasMap); } - @Throws(ValidationException::class) - fun validate(arg: Float, configuration: SchemaConfiguration?): Float { - return validate(arg as Number, configuration) as Float + public int validate(int arg, SchemaConfiguration configuration) throws ValidationException { + return (int) validate((Number) arg, configuration); } - @Throws(ValidationException::class) - fun validate(arg: Double, configuration: SchemaConfiguration?): Double { - return validate(arg as Number, configuration) as Double + public long validate(long arg, SchemaConfiguration configuration) throws ValidationException { + return (long) validate((Number) arg, configuration); } - @Throws(ValidationException::class) - fun validate(arg: String, configuration: SchemaConfiguration?): String? { - val pathSet: MutableSet> = HashSet() - val pathToItem = listOf("args[0]") - val castArg: String = castToAllowedTypes(arg, pathToItem, pathSet) - val usedConfiguration = Objects.requireNonNullElseGet(configuration) { - SchemaConfiguration( - JsonSchemaKeywordFlags.Builder().build() - ) - } - val validatedPathToSchemas = PathToSchemasMap() - val validationMetadata = - ValidationMetadata(pathToItem, usedConfiguration!!, validatedPathToSchemas, LinkedHashSet()) - val pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet) - return getNewInstance(castArg, validationMetadata.pathToItem, pathToSchemasMap) + public float validate(float arg, SchemaConfiguration configuration) throws ValidationException { + return (float) validate((Number) arg, configuration); } - @Throws(ValidationException::class) - fun validate(arg: LocalDate, configuration: SchemaConfiguration?): String? { - return validate(arg.toString(), configuration) + public double validate(double arg, SchemaConfiguration configuration) throws ValidationException { + return (double) validate((Number) arg, configuration); } - @Throws(ValidationException::class) - fun validate(arg: ZonedDateTime, configuration: SchemaConfiguration?): String? { - return validate(arg.toString(), configuration) + @Override + public String validate(String arg, SchemaConfiguration configuration) throws ValidationException { + Set> pathSet = new HashSet<>(); + List pathToItem = List.of("args[0]"); + String castArg = castToAllowedTypes(arg, pathToItem, pathSet); + SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().build())); + PathToSchemasMap validatedPathToSchemas = new PathToSchemasMap(); + ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, new LinkedHashSet<>()); + PathToSchemasMap pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet); + return getNewInstance(castArg, validationMetadata.pathToItem(), pathToSchemasMap); } - @Throws(ValidationException::class) - fun validate(arg: UUID, configuration: SchemaConfiguration?): String? { - return validate(arg.toString(), configuration) + public String validate(LocalDate arg, SchemaConfiguration configuration) throws ValidationException { + return validate(arg.toString(), configuration); } - fun getNewInstance(arg: List<*>, pathToItem: List, pathToSchemas: PathToSchemasMap): FrozenList { - val items: MutableList = ArrayList() - var i = 0 - for (item in arg) { - val itemPathToItem: MutableList = ArrayList(pathToItem) - itemPathToItem.add(i) - val schemas = pathToSchemas.get(itemPathToItem) - ?: throw RuntimeException("Validation result is invalid, schemas must exist for a pathToItem") - val itemSchema = schemas.entries.iterator().next().key - val castItem = itemSchema.getNewInstance(item, itemPathToItem, pathToSchemas) - items.add(castItem) - i += 1 - } - return FrozenList(items) + public String validate(ZonedDateTime arg, SchemaConfiguration configuration) throws ValidationException { + return validate(arg.toString(), configuration); } - @Throws(ValidationException::class) - fun validate(arg: List<*>, configuration: SchemaConfiguration?): FrozenList { - val pathSet: MutableSet> = HashSet() - val pathToItem = listOf("args[0]") - val castArg: List<*> = castToAllowedTypes(arg, pathToItem, pathSet) - val usedConfiguration = Objects.requireNonNullElseGet(configuration) { - SchemaConfiguration( - JsonSchemaKeywordFlags.Builder().build() - ) - } - val validatedPathToSchemas = PathToSchemasMap() - val validationMetadata = - ValidationMetadata(pathToItem, usedConfiguration!!, validatedPathToSchemas, LinkedHashSet()) - val pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet) - return getNewInstance(castArg, validationMetadata.pathToItem, pathToSchemasMap) + public String validate(UUID arg, SchemaConfiguration configuration) throws ValidationException { + return validate(arg.toString(), configuration); } - fun getNewInstance(arg: Map<*, *>, pathToItem: List, pathToSchemas: PathToSchemasMap): FrozenMap { - val properties = LinkedHashMap() - for ((entryKey, value1) in arg) { - if (entryKey !is String) { - throw RuntimeException("Invalid non-string key value") + @Override + public FrozenList<@Nullable Object> getNewInstance(List arg, List pathToItem, PathToSchemasMap pathToSchemas) { + List<@Nullable Object> items = new ArrayList<>(); + int i = 0; + for (Object item: arg) { + List itemPathToItem = new ArrayList<>(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"); } - val propertyName = entryKey - val propertyPathToItem: MutableList = ArrayList(pathToItem) - propertyPathToItem.add(propertyName) - val value = value1!! - val schemas = pathToSchemas.get(propertyPathToItem) - ?: throw RuntimeException("Validation result is invalid, schemas must exist for a pathToItem") - val propertySchema = schemas.entries.iterator().next().key - val castValue = propertySchema.getNewInstance(value, propertyPathToItem, pathToSchemas) - properties[propertyName] = castValue + JsonSchema itemSchema = schemas.entrySet().iterator().next().getKey(); + @Nullable Object castItem = itemSchema.getNewInstance(item, itemPathToItem, pathToSchemas); + items.add(castItem); + i += 1; } - return FrozenMap(properties) + return new FrozenList<>(items); + } + + 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); + SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().build())); + PathToSchemasMap validatedPathToSchemas = new PathToSchemasMap(); + ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, new LinkedHashSet<>()); + PathToSchemasMap pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet); + return getNewInstance(castArg, validationMetadata.pathToItem(), pathToSchemasMap); } - @Throws(ValidationException::class) - fun validate(arg: Map<*, *>, configuration: SchemaConfiguration?): FrozenMap { - val pathSet: MutableSet> = HashSet() - val pathToItem = listOf("args[0]") - val castArg: Map<*, *> = castToAllowedTypes(arg, pathToItem, pathSet) - val usedConfiguration = Objects.requireNonNullElseGet(configuration) { - SchemaConfiguration( - JsonSchemaKeywordFlags.Builder().build() - ) + @Override + 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 RuntimeException("Invalid non-string key value"); + } + String propertyName = (String) entryKey; + List propertyPathToItem = new ArrayList<>(pathToItem); + propertyPathToItem.add(propertyName); + Object value = entry.getValue(); + LinkedHashMap, Void> schemas = pathToSchemas.get(propertyPathToItem); + if (schemas == null) { + 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); + properties.put(propertyName, castValue); } - val validatedPathToSchemas = PathToSchemasMap() - val validationMetadata = - ValidationMetadata(pathToItem, usedConfiguration!!, validatedPathToSchemas, LinkedHashSet()) - val pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet) - return getNewInstance(castArg, validationMetadata.pathToItem, pathToSchemasMap) + return new FrozenMap<>(properties); } - override fun getNewInstance(arg: Any?, pathToItem: List, pathToSchemas: PathToSchemasMap): Any? { + public FrozenMap<@Nullable Object> validate(Map arg, SchemaConfiguration configuration) throws ValidationException { + Set> pathSet = new HashSet<>(); + List pathToItem = List.of("args[0]"); + Map castArg = castToAllowedTypes(arg, pathToItem, pathSet); + SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().build())); + PathToSchemasMap validatedPathToSchemas = new PathToSchemasMap(); + ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, new LinkedHashSet<>()); + PathToSchemasMap pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet); + return getNewInstance(castArg, validationMetadata.pathToItem(), pathToSchemasMap); + } + + @Override + public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { if (arg == null) { - return getNewInstance(arg, pathToItem, pathToSchemas) - } else if (arg is Boolean) { - return getNewInstance(arg, pathToItem, pathToSchemas) - } else if (arg is Number) { - return getNewInstance(arg as Number?, pathToItem, pathToSchemas) - } else if (arg is String) { - return getNewInstance(arg as String?, pathToItem, pathToSchemas) - } else if (arg is List<*>) { - return getNewInstance(arg, pathToItem, pathToSchemas) - } else if (arg is Map<*, *>) { - return getNewInstance(arg, pathToItem, pathToSchemas) + return getNewInstance((Void) null, pathToItem, pathToSchemas); + } else if (arg instanceof Boolean) { + boolean boolArg = (Boolean) arg; + return getNewInstance(boolArg, pathToItem, pathToSchemas); + } else if (arg instanceof Number) { + return getNewInstance((Number) arg, pathToItem, pathToSchemas); + } else if (arg instanceof String) { + return getNewInstance((String) arg, pathToItem, pathToSchemas); + } else if (arg instanceof List) { + return getNewInstance((List) arg, pathToItem, pathToSchemas); + } else if (arg instanceof Map) { + return getNewInstance((Map) arg, pathToItem, pathToSchemas); } - throw RuntimeException("Invalid input type=$javaClass. It can't be instantiated by this schema") + throw new RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); } - @Throws(ValidationException::class) - override fun validate(arg: Any?, configuration: SchemaConfiguration?): Any? { + @Override + public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { if (arg == null) { - return validate(null as Nothing?, configuration) - } else if (arg is Boolean) { - return validate(arg, configuration) - } else if (arg is Number) { - return validate(arg as Number?, configuration) - } else if (arg is String) { - return validate(arg as String?, configuration) - } else if (arg is List<*>) { - return validate(arg as List<*>?, configuration) - } else if (arg is Map<*, *>) { - return validate(arg as Map<*, *>?, configuration) + return validate((Void) null, configuration); + } else if (arg instanceof Boolean) { + boolean boolArg = (Boolean) arg; + return validate(boolArg, configuration); + } else if (arg instanceof Number) { + return validate((Number) arg, configuration); + } else if (arg instanceof String) { + return validate((String) arg, configuration); + } else if (arg instanceof List) { + return validate((List) arg, configuration); + } else if (arg instanceof Map) { + return validate((Map) arg, configuration); } - throw ValidationException("Invalid input type=$javaClass. It can't be validated by this schema") + throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } - @Throws(ValidationException::class) - fun validateAndBox(arg: Nothing?, configuration: SchemaConfiguration?): UnsetAnyTypeJsonSchema1BoxedVoid { - return UnsetAnyTypeJsonSchema1BoxedVoid(validate(arg, configuration)) + @Override + public UnsetAnyTypeJsonSchema1BoxedVoid validateAndBox(Void arg, SchemaConfiguration configuration) throws ValidationException { + return new UnsetAnyTypeJsonSchema1BoxedVoid(validate(arg, configuration)); } - @Throws(ValidationException::class) - fun validateAndBox(arg: Boolean, configuration: SchemaConfiguration?): UnsetAnyTypeJsonSchema1BoxedBoolean { - return UnsetAnyTypeJsonSchema1BoxedBoolean(validate(arg, configuration)) + @Override + public UnsetAnyTypeJsonSchema1BoxedBoolean validateAndBox(boolean arg, SchemaConfiguration configuration) throws ValidationException { + return new UnsetAnyTypeJsonSchema1BoxedBoolean(validate(arg, configuration)); } - @Throws(ValidationException::class) - fun validateAndBox(arg: Number, configuration: SchemaConfiguration?): UnsetAnyTypeJsonSchema1BoxedNumber { - return UnsetAnyTypeJsonSchema1BoxedNumber(validate(arg, configuration)) + @Override + public UnsetAnyTypeJsonSchema1BoxedNumber validateAndBox(Number arg, SchemaConfiguration configuration) throws ValidationException { + return new UnsetAnyTypeJsonSchema1BoxedNumber(validate(arg, configuration)); } - @Throws(ValidationException::class) - fun validateAndBox(arg: String, configuration: SchemaConfiguration?): UnsetAnyTypeJsonSchema1BoxedString { - return UnsetAnyTypeJsonSchema1BoxedString(validate(arg, configuration)) + @Override + public UnsetAnyTypeJsonSchema1BoxedString validateAndBox(String arg, SchemaConfiguration configuration) throws ValidationException { + return new UnsetAnyTypeJsonSchema1BoxedString(validate(arg, configuration)); } - @Throws(ValidationException::class) - fun validateAndBox(arg: List<*>, configuration: SchemaConfiguration?): UnsetAnyTypeJsonSchema1BoxedList { - return UnsetAnyTypeJsonSchema1BoxedList(validate(arg, configuration)) + @Override + public UnsetAnyTypeJsonSchema1BoxedList validateAndBox(List arg, SchemaConfiguration configuration) throws ValidationException { + return new UnsetAnyTypeJsonSchema1BoxedList(validate(arg, configuration)); } - @Throws(ValidationException::class) - fun validateAndBox(arg: Map<*, *>, configuration: SchemaConfiguration?): UnsetAnyTypeJsonSchema1BoxedMap { - return UnsetAnyTypeJsonSchema1BoxedMap(validate(arg, configuration)) + @Override + public UnsetAnyTypeJsonSchema1BoxedMap validateAndBox(Map arg, SchemaConfiguration configuration) throws ValidationException { + return new UnsetAnyTypeJsonSchema1BoxedMap(validate(arg, configuration)); } - @Throws(ValidationException::class) - override fun validateAndBox(arg: Any?, configuration: SchemaConfiguration?): UnsetAnyTypeJsonSchema1Boxed { + @Override + public UnsetAnyTypeJsonSchema1Boxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { if (arg == null) { - return validateAndBox(arg, configuration) - } else if (arg is Boolean) { - val castArg: Boolean = arg - return validateAndBox(castArg, configuration) - } else if (arg is String) { - return validateAndBox(arg, configuration) - } else if (arg is Number) { - return validateAndBox(arg, configuration) - } else if (arg is List<*>) { - return validateAndBox(arg, configuration) - } else if (arg is Map<*, *>) { - return validateAndBox(arg, configuration) + Void castArg = (Void) arg; + return validateAndBox(castArg, configuration); + } else if (arg instanceof Boolean booleanArg) { + boolean castArg = booleanArg; + return validateAndBox(castArg, configuration); + } else if (arg instanceof String castArg) { + return validateAndBox(castArg, configuration); + } else if (arg instanceof Number castArg) { + return validateAndBox(castArg, configuration); + } else if (arg instanceof List castArg) { + return validateAndBox(castArg, configuration); + } else if (arg instanceof Map castArg) { + return validateAndBox(castArg, configuration); } - throw ValidationException("Invalid input type=$javaClass. It can't be validated by this schema") - } - - companion object { - var instance: UnsetAnyTypeJsonSchema1? = null - get() { - if (field == null) { - field = UnsetAnyTypeJsonSchema1() - } - return field - } - private set + 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/kotlin/src/main/kotlin/packagename/schemas/validation/JsonSchema.hbs b/src/main/resources/kotlin/src/main/kotlin/packagename/schemas/validation/JsonSchema.hbs index 33626ccc4c7..b057715a6f3 100644 --- a/src/main/resources/kotlin/src/main/kotlin/packagename/schemas/validation/JsonSchema.hbs +++ b/src/main/resources/kotlin/src/main/kotlin/packagename/schemas/validation/JsonSchema.hbs @@ -359,9 +359,9 @@ abstract class JsonSchema protected constructor(jsonSchemaInfo: JsonSchemaInf } @Throws(ValidationException::class) - private fun castToAllowedObjectTypes(arg: Any?, pathToItem: List, pathSet: MutableSet>): Any? { + private fun castToAllowedObjectTypes(arg: Any?, pathToItem: List, pathSet: MutableSet>): Any? { return if (arg == null) { - castToAllowedTypes(null as Void?, pathToItem, pathSet) + castToAllowedTypes(arg, pathToItem, pathSet) } else if (arg is String) { castToAllowedTypes(arg, pathToItem, pathSet) } else if (arg is Map<*, *>) { @@ -481,7 +481,7 @@ abstract class JsonSchema protected constructor(jsonSchemaInfo: JsonSchemaInf schemas.clear() schemas[firstSchema] = null } - var mutPathSet: MutableSet> = pathSet.toMutableSet() + var mutPathSet: MutableSet> = pathSet.toMutableSet() mutPathSet.removeAll(pathToSchemasMap.keys) if (!mutPathSet.isEmpty()) { val unsetAnyTypeSchema = LinkedHashMap, Nothing?>() diff --git a/src/main/resources/kotlin/src/main/kotlin/packagename/schemas/validation/UnsetAnyTypeJsonSchema.hbs b/src/main/resources/kotlin/src/main/kotlin/packagename/schemas/validation/UnsetAnyTypeJsonSchema.hbs index 8ef8ec61b31..db4d53acc7f 100644 --- a/src/main/resources/kotlin/src/main/kotlin/packagename/schemas/validation/UnsetAnyTypeJsonSchema.hbs +++ b/src/main/resources/kotlin/src/main/kotlin/packagename/schemas/validation/UnsetAnyTypeJsonSchema.hbs @@ -3,300 +3,324 @@ package {{{packageName}}}.schemas.validation; import {{{packageName}}}.configurations.JsonSchemaKeywordFlags; import {{{packageName}}}.configurations.SchemaConfiguration; import {{{packageName}}}.exceptions.ValidationException; -import org.checkerframework.checker.nullness.qual.Nullable; - -import java.time.LocalDate; -import java.time.ZonedDateTime; -import java.util.LinkedHashMap; -import java.util.List; -import java.util.HashSet; -import java.util.ArrayList; -import java.util.LinkedHashSet; -import java.util.Set; -import java.util.Map; -import java.util.Objects; -import java.util.UUID; - -public class UnsetAnyTypeJsonSchema { - public sealed interface UnsetAnyTypeJsonSchema1Boxed permits UnsetAnyTypeJsonSchema1BoxedVoid, UnsetAnyTypeJsonSchema1BoxedBoolean, UnsetAnyTypeJsonSchema1BoxedNumber, UnsetAnyTypeJsonSchema1BoxedString, UnsetAnyTypeJsonSchema1BoxedList, UnsetAnyTypeJsonSchema1BoxedMap { - @Nullable Object getData(); - } - public record UnsetAnyTypeJsonSchema1BoxedVoid(Nothing? data) implements UnsetAnyTypeJsonSchema1Boxed { - @Override - public @Nullable Object getData() { - return data; - } + +import java.time.LocalDate +import java.time.ZonedDateTime +import java.util.UUID + +class UnsetAnyTypeJsonSchema { + interface UnsetAnyTypeJsonSchema1Boxed { + val data: Any? } - public record UnsetAnyTypeJsonSchema1BoxedBoolean(boolean data) implements UnsetAnyTypeJsonSchema1Boxed { - @Override - public @Nullable Object getData() { - return data; + + data class UnsetAnyTypeJsonSchema1BoxedVoid(override val data: Nothing?) : UnsetAnyTypeJsonSchema1Boxed { + fun getData(): Any? { + return data } } - public record UnsetAnyTypeJsonSchema1BoxedNumber(Number data) implements UnsetAnyTypeJsonSchema1Boxed { - @Override - public @Nullable Object getData() { - return data; + + data class UnsetAnyTypeJsonSchema1BoxedBoolean(override val data: Boolean) : UnsetAnyTypeJsonSchema1Boxed { + fun getData(): Any? { + return data } } - public record UnsetAnyTypeJsonSchema1BoxedString(String data) implements UnsetAnyTypeJsonSchema1Boxed { - @Override - public @Nullable Object getData() { - return data; + + data class UnsetAnyTypeJsonSchema1BoxedNumber(override val data: Number?) : UnsetAnyTypeJsonSchema1Boxed { + fun getData(): Any? { + return data } } - public record UnsetAnyTypeJsonSchema1BoxedList(FrozenList<@Nullable Object> data) implements UnsetAnyTypeJsonSchema1Boxed { - @Override - public @Nullable Object getData() { - return data; + + data class UnsetAnyTypeJsonSchema1BoxedString(override val data: String?) : UnsetAnyTypeJsonSchema1Boxed { + fun getData(): Any? { + return data } } - public record UnsetAnyTypeJsonSchema1BoxedMap(FrozenMap<@Nullable Object> data) implements UnsetAnyTypeJsonSchema1Boxed { - @Override - public @Nullable Object getData() { - return data; + + data class UnsetAnyTypeJsonSchema1BoxedList(override val data: FrozenList) : UnsetAnyTypeJsonSchema1Boxed { + fun getData(): Any? { + return data } } - public static class UnsetAnyTypeJsonSchema1 extends JsonSchema implements NullSchemaValidator, BooleanSchemaValidator, NumberSchemaValidator, StringSchemaValidator, ListSchemaValidator, UnsetAnyTypeJsonSchema1BoxedList>, MapSchemaValidator, UnsetAnyTypeJsonSchema1BoxedMap> { - private static @Nullable UnsetAnyTypeJsonSchema1 instance = null; - protected UnsetAnyTypeJsonSchema1() { - super(new JsonSchemaInfo()); + data class UnsetAnyTypeJsonSchema1BoxedMap(override val data: FrozenMap) : UnsetAnyTypeJsonSchema1Boxed { + fun getData(): Any? { + return data } + } - public static UnsetAnyTypeJsonSchema1 getInstance() { - if (instance == null) { - instance = new UnsetAnyTypeJsonSchema1(); + class UnsetAnyTypeJsonSchema1 protected constructor() : JsonSchema(JsonSchemaInfo()), + NullSchemaValidator, + BooleanSchemaValidator, + NumberSchemaValidator, + StringSchemaValidator, + ListSchemaValidator?, UnsetAnyTypeJsonSchema1BoxedList?>, + MapSchemaValidator?, UnsetAnyTypeJsonSchema1BoxedMap?> { + @Throws(ValidationException::class) + fun validate(arg: Nothing?, configuration: SchemaConfiguration?): Nothing? { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0]") + val castArg: Nothing? = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = Objects.requireNonNullElseGet(configuration) { + SchemaConfiguration( + JsonSchemaKeywordFlags.Builder().build() + ) } - return instance; - } - - @Override - public Nothing? validate(Nothing? arg, SchemaConfiguration configuration) throws ValidationException { - Set> pathSet = new HashSet<>(); - List pathToItem = List.of("args[0]"); - Nothing? castArg = castToAllowedTypes(arg, pathToItem, pathSet); - SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().build())); - PathToSchemasMap validatedPathToSchemas = new PathToSchemasMap(); - ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, new LinkedHashSet<>()); - PathToSchemasMap pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet); - return getNewInstance(castArg, validationMetadata.pathToItem(), pathToSchemasMap); + val validatedPathToSchemas = PathToSchemasMap() + val validationMetadata = + ValidationMetadata(pathToItem, usedConfiguration!!, validatedPathToSchemas, LinkedHashSet()) + val pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet) + return getNewInstance(castArg, validationMetadata.pathToItem, pathToSchemasMap) } - @Override - public boolean validate(boolean arg, SchemaConfiguration configuration) throws ValidationException { - Set> pathSet = new HashSet<>(); - List pathToItem = List.of("args[0]"); - boolean castArg = castToAllowedTypes(arg, pathToItem, pathSet); - SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().build())); - PathToSchemasMap validatedPathToSchemas = new PathToSchemasMap(); - ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, new LinkedHashSet<>()); - PathToSchemasMap pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet); - return getNewInstance(castArg, validationMetadata.pathToItem(), pathToSchemasMap); + @Throws(ValidationException::class) + fun validate(arg: Boolean, configuration: SchemaConfiguration?): Boolean { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0]") + val castArg: Boolean = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = Objects.requireNonNullElseGet(configuration) { + SchemaConfiguration( + JsonSchemaKeywordFlags.Builder().build() + ) + } + val validatedPathToSchemas = PathToSchemasMap() + val validationMetadata = + ValidationMetadata(pathToItem, usedConfiguration!!, validatedPathToSchemas, LinkedHashSet()) + val pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet) + return getNewInstance(castArg, validationMetadata.pathToItem, pathToSchemasMap) } - @Override - public Number validate(Number arg, SchemaConfiguration configuration) throws ValidationException { - Set> pathSet = new HashSet<>(); - List pathToItem = List.of("args[0]"); - Number castArg = castToAllowedTypes(arg, pathToItem, pathSet); - SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().build())); - PathToSchemasMap validatedPathToSchemas = new PathToSchemasMap(); - ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, new LinkedHashSet<>()); - PathToSchemasMap pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet); - return getNewInstance(castArg, validationMetadata.pathToItem(), pathToSchemasMap); + @Throws(ValidationException::class) + fun validate(arg: Number, configuration: SchemaConfiguration?): Number? { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0]") + val castArg: Number = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = Objects.requireNonNullElseGet(configuration) { + SchemaConfiguration( + JsonSchemaKeywordFlags.Builder().build() + ) + } + val validatedPathToSchemas = PathToSchemasMap() + val validationMetadata = + ValidationMetadata(pathToItem, usedConfiguration!!, validatedPathToSchemas, LinkedHashSet()) + val pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet) + return getNewInstance(castArg, validationMetadata.pathToItem, pathToSchemasMap) } - public int validate(int arg, SchemaConfiguration configuration) throws ValidationException { - return (int) validate((Number) arg, configuration); + @Throws(ValidationException::class) + fun validate(arg: Int, configuration: SchemaConfiguration?): Int { + return validate(arg as Number, configuration) as Int } - public long validate(long arg, SchemaConfiguration configuration) throws ValidationException { - return (long) validate((Number) arg, configuration); + @Throws(ValidationException::class) + fun validate(arg: Long, configuration: SchemaConfiguration?): Long { + return validate(arg as Number, configuration) as Long } - public float validate(float arg, SchemaConfiguration configuration) throws ValidationException { - return (float) validate((Number) arg, configuration); + @Throws(ValidationException::class) + fun validate(arg: Float, configuration: SchemaConfiguration?): Float { + return validate(arg as Number, configuration) as Float } - public double validate(double arg, SchemaConfiguration configuration) throws ValidationException { - return (double) validate((Number) arg, configuration); + @Throws(ValidationException::class) + fun validate(arg: Double, configuration: SchemaConfiguration?): Double { + return validate(arg as Number, configuration) as Double } - @Override - public String validate(String arg, SchemaConfiguration configuration) throws ValidationException { - Set> pathSet = new HashSet<>(); - List pathToItem = List.of("args[0]"); - String castArg = castToAllowedTypes(arg, pathToItem, pathSet); - SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().build())); - PathToSchemasMap validatedPathToSchemas = new PathToSchemasMap(); - ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, new LinkedHashSet<>()); - PathToSchemasMap pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet); - return getNewInstance(castArg, validationMetadata.pathToItem(), pathToSchemasMap); + @Throws(ValidationException::class) + fun validate(arg: String, configuration: SchemaConfiguration?): String? { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0]") + val castArg: String = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = Objects.requireNonNullElseGet(configuration) { + SchemaConfiguration( + JsonSchemaKeywordFlags.Builder().build() + ) + } + val validatedPathToSchemas = PathToSchemasMap() + val validationMetadata = + ValidationMetadata(pathToItem, usedConfiguration!!, validatedPathToSchemas, LinkedHashSet()) + val pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet) + return getNewInstance(castArg, validationMetadata.pathToItem, pathToSchemasMap) } - public String validate(LocalDate arg, SchemaConfiguration configuration) throws ValidationException { - return validate(arg.toString(), configuration); + @Throws(ValidationException::class) + fun validate(arg: LocalDate, configuration: SchemaConfiguration?): String? { + return validate(arg.toString(), configuration) } - public String validate(ZonedDateTime arg, SchemaConfiguration configuration) throws ValidationException { - return validate(arg.toString(), configuration); + @Throws(ValidationException::class) + fun validate(arg: ZonedDateTime, configuration: SchemaConfiguration?): String? { + return validate(arg.toString(), configuration) } - public String validate(UUID arg, SchemaConfiguration configuration) throws ValidationException { - return validate(arg.toString(), configuration); + @Throws(ValidationException::class) + fun validate(arg: UUID, configuration: SchemaConfiguration?): String? { + return validate(arg.toString(), configuration) } - @Override - public FrozenList<@Nullable Object> getNewInstance(List arg, List pathToItem, PathToSchemasMap pathToSchemas) { - List<@Nullable Object> items = new ArrayList<>(); - int i = 0; - for (Object item: arg) { - List itemPathToItem = new ArrayList<>(pathToItem); - itemPathToItem.add(i); - LinkedHashMap, Nothing?> schemas = pathToSchemas.get(itemPathToItem); - if (schemas == null) { - 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); - items.add(castItem); - i += 1; + fun getNewInstance(arg: List<*>, pathToItem: List, pathToSchemas: PathToSchemasMap): FrozenList { + val items: MutableList = ArrayList() + var i = 0 + for (item in arg) { + val itemPathToItem: MutableList = ArrayList(pathToItem) + itemPathToItem.add(i) + val schemas = pathToSchemas.get(itemPathToItem) + ?: throw RuntimeException("Validation result is invalid, schemas must exist for a pathToItem") + val itemSchema = schemas.entries.iterator().next().key + val castItem = itemSchema.getNewInstance(item, itemPathToItem, pathToSchemas) + items.add(castItem) + i += 1 } - return new FrozenList<>(items); + return FrozenList(items) } - 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); - SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().build())); - PathToSchemasMap validatedPathToSchemas = new PathToSchemasMap(); - ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, new LinkedHashSet<>()); - PathToSchemasMap pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet); - return getNewInstance(castArg, validationMetadata.pathToItem(), pathToSchemasMap); + @Throws(ValidationException::class) + fun validate(arg: List<*>, configuration: SchemaConfiguration?): FrozenList { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0]") + val castArg: List<*> = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = Objects.requireNonNullElseGet(configuration) { + SchemaConfiguration( + JsonSchemaKeywordFlags.Builder().build() + ) + } + val validatedPathToSchemas = PathToSchemasMap() + val validationMetadata = + ValidationMetadata(pathToItem, usedConfiguration!!, validatedPathToSchemas, LinkedHashSet()) + val pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet) + return getNewInstance(castArg, validationMetadata.pathToItem, pathToSchemasMap) } - @Override - 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 RuntimeException("Invalid non-string key value"); + fun getNewInstance(arg: Map<*, *>, pathToItem: List, pathToSchemas: PathToSchemasMap): FrozenMap { + val properties = LinkedHashMap() + for ((entryKey, value1) in arg) { + if (entryKey !is String) { + throw RuntimeException("Invalid non-string key value") } - String propertyName = (String) entryKey; - List propertyPathToItem = new ArrayList<>(pathToItem); - propertyPathToItem.add(propertyName); - Object value = entry.getValue(); - LinkedHashMap, Nothing?> schemas = pathToSchemas.get(propertyPathToItem); - if (schemas == null) { - 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); - properties.put(propertyName, castValue); + val propertyName = entryKey + val propertyPathToItem: MutableList = ArrayList(pathToItem) + propertyPathToItem.add(propertyName) + val value = value1!! + val schemas = pathToSchemas.get(propertyPathToItem) + ?: throw RuntimeException("Validation result is invalid, schemas must exist for a pathToItem") + val propertySchema = schemas.entries.iterator().next().key + val castValue = propertySchema.getNewInstance(value, propertyPathToItem, pathToSchemas) + properties[propertyName] = castValue } - return new FrozenMap<>(properties); + return FrozenMap(properties) } - public FrozenMap<@Nullable Object> validate(Map arg, SchemaConfiguration configuration) throws ValidationException { - Set> pathSet = new HashSet<>(); - List pathToItem = List.of("args[0]"); - Map castArg = castToAllowedTypes(arg, pathToItem, pathSet); - SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().build())); - PathToSchemasMap validatedPathToSchemas = new PathToSchemasMap(); - ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, new LinkedHashSet<>()); - PathToSchemasMap pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet); - return getNewInstance(castArg, validationMetadata.pathToItem(), pathToSchemasMap); + @Throws(ValidationException::class) + fun validate(arg: Map<*, *>, configuration: SchemaConfiguration?): FrozenMap { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0]") + val castArg: Map<*, *> = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = Objects.requireNonNullElseGet(configuration) { + SchemaConfiguration( + JsonSchemaKeywordFlags.Builder().build() + ) + } + val validatedPathToSchemas = PathToSchemasMap() + val validationMetadata = + ValidationMetadata(pathToItem, usedConfiguration!!, validatedPathToSchemas, LinkedHashSet()) + val pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet) + return getNewInstance(castArg, validationMetadata.pathToItem, pathToSchemasMap) } - @Override - public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { + override fun getNewInstance(arg: Any?, pathToItem: List, pathToSchemas: PathToSchemasMap): Any? { if (arg == null) { - return getNewInstance((Nothing?) null, pathToItem, pathToSchemas); - } else if (arg instanceof Boolean) { - boolean boolArg = (Boolean) arg; - return getNewInstance(boolArg, pathToItem, pathToSchemas); - } else if (arg instanceof Number) { - return getNewInstance((Number) arg, pathToItem, pathToSchemas); - } else if (arg instanceof String) { - return getNewInstance((String) arg, pathToItem, pathToSchemas); - } else if (arg instanceof List) { - return getNewInstance((List) arg, pathToItem, pathToSchemas); - } else if (arg instanceof Map) { - return getNewInstance((Map) arg, pathToItem, pathToSchemas); + return getNewInstance(arg, pathToItem, pathToSchemas) + } else if (arg is Boolean) { + return getNewInstance(arg, pathToItem, pathToSchemas) + } else if (arg is Number) { + return getNewInstance(arg as Number?, pathToItem, pathToSchemas) + } else if (arg is String) { + return getNewInstance(arg as String?, pathToItem, pathToSchemas) + } else if (arg is List<*>) { + return getNewInstance(arg, pathToItem, pathToSchemas) + } else if (arg is Map<*, *>) { + return getNewInstance(arg, pathToItem, pathToSchemas) } - throw new RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); + throw RuntimeException("Invalid input type=$javaClass. It can't be instantiated by this schema") } - @Override - public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { + @Throws(ValidationException::class) + override fun validate(arg: Any?, configuration: SchemaConfiguration?): Any? { if (arg == null) { - return validate((Nothing?) null, configuration); - } else if (arg instanceof Boolean) { - boolean boolArg = (Boolean) arg; - return validate(boolArg, configuration); - } else if (arg instanceof Number) { - return validate((Number) arg, configuration); - } else if (arg instanceof String) { - return validate((String) arg, configuration); - } else if (arg instanceof List) { - return validate((List) arg, configuration); - } else if (arg instanceof Map) { - return validate((Map) arg, configuration); + return validate(null as Nothing?, configuration) + } else if (arg is Boolean) { + return validate(arg, configuration) + } else if (arg is Number) { + return validate(arg as Number?, configuration) + } else if (arg is String) { + return validate(arg as String?, configuration) + } else if (arg is List<*>) { + return validate(arg as List<*>?, configuration) + } else if (arg is Map<*, *>) { + return validate(arg as Map<*, *>?, configuration) } - throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw ValidationException("Invalid input type=$javaClass. It can't be validated by this schema") } - @Override - public UnsetAnyTypeJsonSchema1BoxedVoid validateAndBox(Nothing? arg, SchemaConfiguration configuration) throws ValidationException { - return new UnsetAnyTypeJsonSchema1BoxedVoid(validate(arg, configuration)); + @Throws(ValidationException::class) + fun validateAndBox(arg: Nothing?, configuration: SchemaConfiguration?): UnsetAnyTypeJsonSchema1BoxedVoid { + return UnsetAnyTypeJsonSchema1BoxedVoid(validate(arg, configuration)) } - @Override - public UnsetAnyTypeJsonSchema1BoxedBoolean validateAndBox(boolean arg, SchemaConfiguration configuration) throws ValidationException { - return new UnsetAnyTypeJsonSchema1BoxedBoolean(validate(arg, configuration)); + @Throws(ValidationException::class) + fun validateAndBox(arg: Boolean, configuration: SchemaConfiguration?): UnsetAnyTypeJsonSchema1BoxedBoolean { + return UnsetAnyTypeJsonSchema1BoxedBoolean(validate(arg, configuration)) } - @Override - public UnsetAnyTypeJsonSchema1BoxedNumber validateAndBox(Number arg, SchemaConfiguration configuration) throws ValidationException { - return new UnsetAnyTypeJsonSchema1BoxedNumber(validate(arg, configuration)); + @Throws(ValidationException::class) + fun validateAndBox(arg: Number, configuration: SchemaConfiguration?): UnsetAnyTypeJsonSchema1BoxedNumber { + return UnsetAnyTypeJsonSchema1BoxedNumber(validate(arg, configuration)) } - @Override - public UnsetAnyTypeJsonSchema1BoxedString validateAndBox(String arg, SchemaConfiguration configuration) throws ValidationException { - return new UnsetAnyTypeJsonSchema1BoxedString(validate(arg, configuration)); + @Throws(ValidationException::class) + fun validateAndBox(arg: String, configuration: SchemaConfiguration?): UnsetAnyTypeJsonSchema1BoxedString { + return UnsetAnyTypeJsonSchema1BoxedString(validate(arg, configuration)) } - @Override - public UnsetAnyTypeJsonSchema1BoxedList validateAndBox(List arg, SchemaConfiguration configuration) throws ValidationException { - return new UnsetAnyTypeJsonSchema1BoxedList(validate(arg, configuration)); + @Throws(ValidationException::class) + fun validateAndBox(arg: List<*>, configuration: SchemaConfiguration?): UnsetAnyTypeJsonSchema1BoxedList { + return UnsetAnyTypeJsonSchema1BoxedList(validate(arg, configuration)) } - @Override - public UnsetAnyTypeJsonSchema1BoxedMap validateAndBox(Map arg, SchemaConfiguration configuration) throws ValidationException { - return new UnsetAnyTypeJsonSchema1BoxedMap(validate(arg, configuration)); + @Throws(ValidationException::class) + fun validateAndBox(arg: Map<*, *>, configuration: SchemaConfiguration?): UnsetAnyTypeJsonSchema1BoxedMap { + return UnsetAnyTypeJsonSchema1BoxedMap(validate(arg, configuration)) } - @Override - public UnsetAnyTypeJsonSchema1Boxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { + @Throws(ValidationException::class) + override fun validateAndBox(arg: Any?, configuration: SchemaConfiguration?): UnsetAnyTypeJsonSchema1Boxed { if (arg == null) { - Nothing? castArg = (Nothing?) arg; - return validateAndBox(castArg, configuration); - } else if (arg instanceof Boolean booleanArg) { - boolean castArg = booleanArg; - return validateAndBox(castArg, configuration); - } else if (arg instanceof String castArg) { - return validateAndBox(castArg, configuration); - } else if (arg instanceof Number castArg) { - return validateAndBox(castArg, configuration); - } else if (arg instanceof List castArg) { - return validateAndBox(castArg, configuration); - } else if (arg instanceof Map castArg) { - return validateAndBox(castArg, configuration); + return validateAndBox(arg, configuration) + } else if (arg is Boolean) { + val castArg: Boolean = arg + return validateAndBox(castArg, configuration) + } else if (arg is String) { + return validateAndBox(arg, configuration) + } else if (arg is Number) { + return validateAndBox(arg, configuration) + } else if (arg is List<*>) { + return validateAndBox(arg, configuration) + } else if (arg is Map<*, *>) { + return validateAndBox(arg, configuration) } - throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw ValidationException("Invalid input type=$javaClass. It can't be validated by this schema") + } + + companion object { + var instance: UnsetAnyTypeJsonSchema1? = null + get() { + if (field == null) { + field = UnsetAnyTypeJsonSchema1() + } + return field + } + private set } } } \ No newline at end of file From 7ca254dd674a140c7404a0765e6b0dd8761c003e Mon Sep 17 00:00:00 2001 From: Justin Black Date: Mon, 6 May 2024 17:37:32 -0700 Subject: [PATCH 11/78] Updates companion object for unset any type schema --- .../schemas/validation/UnsetAnyTypeJsonSchema.kt | 13 ++++++------- .../schemas/validation/UnsetAnyTypeJsonSchema.hbs | 13 ++++++------- 2 files changed, 12 insertions(+), 14 deletions(-) diff --git a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/schemas/validation/UnsetAnyTypeJsonSchema.kt b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/schemas/validation/UnsetAnyTypeJsonSchema.kt index c796c129746..77cfc3bc461 100644 --- a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/schemas/validation/UnsetAnyTypeJsonSchema.kt +++ b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/schemas/validation/UnsetAnyTypeJsonSchema.kt @@ -313,14 +313,13 @@ class UnsetAnyTypeJsonSchema { } companion object { - var instance: UnsetAnyTypeJsonSchema1? = null - get() { - if (field == null) { - field = UnsetAnyTypeJsonSchema1() - } - return field + @Volatile + private var instance: UnsetAnyTypeJsonSchema1? = null + + fun getInstance() = + instance ?: synchronized(this) { + instance ?: UnsetAnyTypeJsonSchema1().also { instance = it } } - private set } } } \ No newline at end of file diff --git a/src/main/resources/kotlin/src/main/kotlin/packagename/schemas/validation/UnsetAnyTypeJsonSchema.hbs b/src/main/resources/kotlin/src/main/kotlin/packagename/schemas/validation/UnsetAnyTypeJsonSchema.hbs index db4d53acc7f..a1a3a084e8b 100644 --- a/src/main/resources/kotlin/src/main/kotlin/packagename/schemas/validation/UnsetAnyTypeJsonSchema.hbs +++ b/src/main/resources/kotlin/src/main/kotlin/packagename/schemas/validation/UnsetAnyTypeJsonSchema.hbs @@ -313,14 +313,13 @@ class UnsetAnyTypeJsonSchema { } companion object { - var instance: UnsetAnyTypeJsonSchema1? = null - get() { - if (field == null) { - field = UnsetAnyTypeJsonSchema1() - } - return field + @Volatile + private var instance: UnsetAnyTypeJsonSchema1? = null + + fun getInstance() = + instance ?: synchronized(this) { + instance ?: UnsetAnyTypeJsonSchema1().also { instance = it } } - private set } } } \ No newline at end of file From 3d50a91264c2108f55de729917a6055a56a36d5c Mon Sep 17 00:00:00 2001 From: Justin Black Date: Tue, 7 May 2024 12:10:55 -0700 Subject: [PATCH 12/78] More improvements to UnsetAnyTypeJsonSchema --- .../validation/UnsetAnyTypeJsonSchema.kt | 177 ++++++++++-------- .../validation/UnsetAnyTypeJsonSchema.hbs | 177 ++++++++++-------- 2 files changed, 188 insertions(+), 166 deletions(-) diff --git a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/schemas/validation/UnsetAnyTypeJsonSchema.kt b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/schemas/validation/UnsetAnyTypeJsonSchema.kt index 77cfc3bc461..75138c9821e 100644 --- a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/schemas/validation/UnsetAnyTypeJsonSchema.kt +++ b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/schemas/validation/UnsetAnyTypeJsonSchema.kt @@ -49,7 +49,7 @@ class UnsetAnyTypeJsonSchema { } } - class UnsetAnyTypeJsonSchema1 protected constructor() : JsonSchema(JsonSchemaInfo()), + class UnsetAnyTypeJsonSchema1 private constructor() : JsonSchema(JsonSchemaInfo()), NullSchemaValidator, BooleanSchemaValidator, NumberSchemaValidator, @@ -61,14 +61,10 @@ class UnsetAnyTypeJsonSchema { val pathSet: MutableSet> = HashSet() val pathToItem = listOf("args[0]") val castArg: Nothing? = castToAllowedTypes(arg, pathToItem, pathSet) - val usedConfiguration = Objects.requireNonNullElseGet(configuration) { - SchemaConfiguration( - JsonSchemaKeywordFlags.Builder().build() - ) - } + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) val validatedPathToSchemas = PathToSchemasMap() val validationMetadata = - ValidationMetadata(pathToItem, usedConfiguration!!, validatedPathToSchemas, LinkedHashSet()) + ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, LinkedHashSet()) val pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet) return getNewInstance(castArg, validationMetadata.pathToItem, pathToSchemasMap) } @@ -78,14 +74,10 @@ class UnsetAnyTypeJsonSchema { val pathSet: MutableSet> = HashSet() val pathToItem = listOf("args[0]") val castArg: Boolean = castToAllowedTypes(arg, pathToItem, pathSet) - val usedConfiguration = Objects.requireNonNullElseGet(configuration) { - SchemaConfiguration( - JsonSchemaKeywordFlags.Builder().build() - ) - } + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) val validatedPathToSchemas = PathToSchemasMap() val validationMetadata = - ValidationMetadata(pathToItem, usedConfiguration!!, validatedPathToSchemas, LinkedHashSet()) + ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, LinkedHashSet()) val pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet) return getNewInstance(castArg, validationMetadata.pathToItem, pathToSchemasMap) } @@ -95,14 +87,10 @@ class UnsetAnyTypeJsonSchema { val pathSet: MutableSet> = HashSet() val pathToItem = listOf("args[0]") val castArg: Number = castToAllowedTypes(arg, pathToItem, pathSet) - val usedConfiguration = Objects.requireNonNullElseGet(configuration) { - SchemaConfiguration( - JsonSchemaKeywordFlags.Builder().build() - ) - } + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) val validatedPathToSchemas = PathToSchemasMap() val validationMetadata = - ValidationMetadata(pathToItem, usedConfiguration!!, validatedPathToSchemas, LinkedHashSet()) + ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, LinkedHashSet()) val pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet) return getNewInstance(castArg, validationMetadata.pathToItem, pathToSchemasMap) } @@ -128,18 +116,14 @@ class UnsetAnyTypeJsonSchema { } @Throws(ValidationException::class) - fun validate(arg: String, configuration: SchemaConfiguration?): String? { + fun validate(arg: String, configuration: SchemaConfiguration?): String { val pathSet: MutableSet> = HashSet() val pathToItem = listOf("args[0]") val castArg: String = castToAllowedTypes(arg, pathToItem, pathSet) - val usedConfiguration = Objects.requireNonNullElseGet(configuration) { - SchemaConfiguration( - JsonSchemaKeywordFlags.Builder().build() - ) - } + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) val validatedPathToSchemas = PathToSchemasMap() val validationMetadata = - ValidationMetadata(pathToItem, usedConfiguration!!, validatedPathToSchemas, LinkedHashSet()) + ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, LinkedHashSet()) val pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet) return getNewInstance(castArg, validationMetadata.pathToItem, pathToSchemasMap) } @@ -165,7 +149,7 @@ class UnsetAnyTypeJsonSchema { for (item in arg) { val itemPathToItem: MutableList = ArrayList(pathToItem) itemPathToItem.add(i) - val schemas = pathToSchemas.get(itemPathToItem) + val schemas = pathToSchemas[itemPathToItem] ?: throw RuntimeException("Validation result is invalid, schemas must exist for a pathToItem") val itemSchema = schemas.entries.iterator().next().key val castItem = itemSchema.getNewInstance(item, itemPathToItem, pathToSchemas) @@ -180,14 +164,10 @@ class UnsetAnyTypeJsonSchema { val pathSet: MutableSet> = HashSet() val pathToItem = listOf("args[0]") val castArg: List<*> = castToAllowedTypes(arg, pathToItem, pathSet) - val usedConfiguration = Objects.requireNonNullElseGet(configuration) { - SchemaConfiguration( - JsonSchemaKeywordFlags.Builder().build() - ) - } + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) val validatedPathToSchemas = PathToSchemasMap() val validationMetadata = - ValidationMetadata(pathToItem, usedConfiguration!!, validatedPathToSchemas, LinkedHashSet()) + ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, LinkedHashSet()) val pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet) return getNewInstance(castArg, validationMetadata.pathToItem, pathToSchemasMap) } @@ -198,15 +178,14 @@ class UnsetAnyTypeJsonSchema { if (entryKey !is String) { throw RuntimeException("Invalid non-string key value") } - val propertyName = entryKey val propertyPathToItem: MutableList = ArrayList(pathToItem) - propertyPathToItem.add(propertyName) + propertyPathToItem.add(entryKey) val value = value1!! - val schemas = pathToSchemas.get(propertyPathToItem) + val schemas = pathToSchemas[propertyPathToItem] ?: throw RuntimeException("Validation result is invalid, schemas must exist for a pathToItem") val propertySchema = schemas.entries.iterator().next().key val castValue = propertySchema.getNewInstance(value, propertyPathToItem, pathToSchemas) - properties[propertyName] = castValue + properties[entryKey] = castValue } return FrozenMap(properties) } @@ -216,51 +195,71 @@ class UnsetAnyTypeJsonSchema { val pathSet: MutableSet> = HashSet() val pathToItem = listOf("args[0]") val castArg: Map<*, *> = castToAllowedTypes(arg, pathToItem, pathSet) - val usedConfiguration = Objects.requireNonNullElseGet(configuration) { - SchemaConfiguration( - JsonSchemaKeywordFlags.Builder().build() - ) - } + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) val validatedPathToSchemas = PathToSchemasMap() val validationMetadata = - ValidationMetadata(pathToItem, usedConfiguration!!, validatedPathToSchemas, LinkedHashSet()) + ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, LinkedHashSet()) val pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet) return getNewInstance(castArg, validationMetadata.pathToItem, pathToSchemasMap) } override fun getNewInstance(arg: Any?, pathToItem: List, pathToSchemas: PathToSchemasMap): Any? { - if (arg == null) { - return getNewInstance(arg, pathToItem, pathToSchemas) - } else if (arg is Boolean) { - return getNewInstance(arg, pathToItem, pathToSchemas) - } else if (arg is Number) { - return getNewInstance(arg as Number?, pathToItem, pathToSchemas) - } else if (arg is String) { - return getNewInstance(arg as String?, pathToItem, pathToSchemas) - } else if (arg is List<*>) { - return getNewInstance(arg, pathToItem, pathToSchemas) - } else if (arg is Map<*, *>) { - return getNewInstance(arg, pathToItem, pathToSchemas) + when (arg) { + null -> { + return getNewInstance(null, pathToItem, pathToSchemas) + } + is Boolean -> { + return getNewInstance(arg, pathToItem, pathToSchemas) + } + + is Number -> { + return getNewInstance(arg, pathToItem, pathToSchemas) + } + + is String -> { + return getNewInstance(arg, pathToItem, pathToSchemas) + } + + is List<*> -> { + return getNewInstance(arg, pathToItem, pathToSchemas) + } + + is Map<*, *> -> { + return getNewInstance(arg, pathToItem, pathToSchemas) + } + + else -> throw RuntimeException("Invalid input type=$javaClass. It can't be instantiated by this schema") } - throw RuntimeException("Invalid input type=$javaClass. It can't be instantiated by this schema") } @Throws(ValidationException::class) override fun validate(arg: Any?, configuration: SchemaConfiguration?): Any? { - if (arg == null) { - return validate(null as Nothing?, configuration) - } else if (arg is Boolean) { - return validate(arg, configuration) - } else if (arg is Number) { - return validate(arg as Number?, configuration) - } else if (arg is String) { - return validate(arg as String?, configuration) - } else if (arg is List<*>) { - return validate(arg as List<*>?, configuration) - } else if (arg is Map<*, *>) { - return validate(arg as Map<*, *>?, configuration) + when (arg) { + null -> { + return validate(null, configuration) + } + is Boolean -> { + return validate(arg, configuration) + } + + is Number -> { + return validate(arg, configuration) + } + + is String -> { + return validate(arg, configuration) + } + + is List<*> -> { + return validate(arg, configuration) + } + + is Map<*, *> -> { + return validate(arg, configuration) + } + + else -> throw ValidationException("Invalid input type=$javaClass. It can't be validated by this schema") } - throw ValidationException("Invalid input type=$javaClass. It can't be validated by this schema") } @Throws(ValidationException::class) @@ -295,21 +294,33 @@ class UnsetAnyTypeJsonSchema { @Throws(ValidationException::class) override fun validateAndBox(arg: Any?, configuration: SchemaConfiguration?): UnsetAnyTypeJsonSchema1Boxed { - if (arg == null) { - return validateAndBox(arg, configuration) - } else if (arg is Boolean) { - val castArg: Boolean = arg - return validateAndBox(castArg, configuration) - } else if (arg is String) { - return validateAndBox(arg, configuration) - } else if (arg is Number) { - return validateAndBox(arg, configuration) - } else if (arg is List<*>) { - return validateAndBox(arg, configuration) - } else if (arg is Map<*, *>) { - return validateAndBox(arg, configuration) + when (arg) { + null -> { + return validateAndBox(null, configuration) + } + is Boolean -> { + val castArg: Boolean = arg + return validateAndBox(castArg, configuration) + } + + is String -> { + return validateAndBox(arg, configuration) + } + + is Number -> { + return validateAndBox(arg, configuration) + } + + is List<*> -> { + return validateAndBox(arg, configuration) + } + + is Map<*, *> -> { + return validateAndBox(arg, configuration) + } + + else -> throw ValidationException("Invalid input type=$javaClass. It can't be validated by this schema") } - throw ValidationException("Invalid input type=$javaClass. It can't be validated by this schema") } companion object { diff --git a/src/main/resources/kotlin/src/main/kotlin/packagename/schemas/validation/UnsetAnyTypeJsonSchema.hbs b/src/main/resources/kotlin/src/main/kotlin/packagename/schemas/validation/UnsetAnyTypeJsonSchema.hbs index a1a3a084e8b..f28821a8469 100644 --- a/src/main/resources/kotlin/src/main/kotlin/packagename/schemas/validation/UnsetAnyTypeJsonSchema.hbs +++ b/src/main/resources/kotlin/src/main/kotlin/packagename/schemas/validation/UnsetAnyTypeJsonSchema.hbs @@ -49,7 +49,7 @@ class UnsetAnyTypeJsonSchema { } } - class UnsetAnyTypeJsonSchema1 protected constructor() : JsonSchema(JsonSchemaInfo()), + class UnsetAnyTypeJsonSchema1 private constructor() : JsonSchema(JsonSchemaInfo()), NullSchemaValidator, BooleanSchemaValidator, NumberSchemaValidator, @@ -61,14 +61,10 @@ class UnsetAnyTypeJsonSchema { val pathSet: MutableSet> = HashSet() val pathToItem = listOf("args[0]") val castArg: Nothing? = castToAllowedTypes(arg, pathToItem, pathSet) - val usedConfiguration = Objects.requireNonNullElseGet(configuration) { - SchemaConfiguration( - JsonSchemaKeywordFlags.Builder().build() - ) - } + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) val validatedPathToSchemas = PathToSchemasMap() val validationMetadata = - ValidationMetadata(pathToItem, usedConfiguration!!, validatedPathToSchemas, LinkedHashSet()) + ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, LinkedHashSet()) val pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet) return getNewInstance(castArg, validationMetadata.pathToItem, pathToSchemasMap) } @@ -78,14 +74,10 @@ class UnsetAnyTypeJsonSchema { val pathSet: MutableSet> = HashSet() val pathToItem = listOf("args[0]") val castArg: Boolean = castToAllowedTypes(arg, pathToItem, pathSet) - val usedConfiguration = Objects.requireNonNullElseGet(configuration) { - SchemaConfiguration( - JsonSchemaKeywordFlags.Builder().build() - ) - } + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) val validatedPathToSchemas = PathToSchemasMap() val validationMetadata = - ValidationMetadata(pathToItem, usedConfiguration!!, validatedPathToSchemas, LinkedHashSet()) + ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, LinkedHashSet()) val pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet) return getNewInstance(castArg, validationMetadata.pathToItem, pathToSchemasMap) } @@ -95,14 +87,10 @@ class UnsetAnyTypeJsonSchema { val pathSet: MutableSet> = HashSet() val pathToItem = listOf("args[0]") val castArg: Number = castToAllowedTypes(arg, pathToItem, pathSet) - val usedConfiguration = Objects.requireNonNullElseGet(configuration) { - SchemaConfiguration( - JsonSchemaKeywordFlags.Builder().build() - ) - } + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) val validatedPathToSchemas = PathToSchemasMap() val validationMetadata = - ValidationMetadata(pathToItem, usedConfiguration!!, validatedPathToSchemas, LinkedHashSet()) + ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, LinkedHashSet()) val pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet) return getNewInstance(castArg, validationMetadata.pathToItem, pathToSchemasMap) } @@ -128,18 +116,14 @@ class UnsetAnyTypeJsonSchema { } @Throws(ValidationException::class) - fun validate(arg: String, configuration: SchemaConfiguration?): String? { + fun validate(arg: String, configuration: SchemaConfiguration?): String { val pathSet: MutableSet> = HashSet() val pathToItem = listOf("args[0]") val castArg: String = castToAllowedTypes(arg, pathToItem, pathSet) - val usedConfiguration = Objects.requireNonNullElseGet(configuration) { - SchemaConfiguration( - JsonSchemaKeywordFlags.Builder().build() - ) - } + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) val validatedPathToSchemas = PathToSchemasMap() val validationMetadata = - ValidationMetadata(pathToItem, usedConfiguration!!, validatedPathToSchemas, LinkedHashSet()) + ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, LinkedHashSet()) val pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet) return getNewInstance(castArg, validationMetadata.pathToItem, pathToSchemasMap) } @@ -165,7 +149,7 @@ class UnsetAnyTypeJsonSchema { for (item in arg) { val itemPathToItem: MutableList = ArrayList(pathToItem) itemPathToItem.add(i) - val schemas = pathToSchemas.get(itemPathToItem) + val schemas = pathToSchemas[itemPathToItem] ?: throw RuntimeException("Validation result is invalid, schemas must exist for a pathToItem") val itemSchema = schemas.entries.iterator().next().key val castItem = itemSchema.getNewInstance(item, itemPathToItem, pathToSchemas) @@ -180,14 +164,10 @@ class UnsetAnyTypeJsonSchema { val pathSet: MutableSet> = HashSet() val pathToItem = listOf("args[0]") val castArg: List<*> = castToAllowedTypes(arg, pathToItem, pathSet) - val usedConfiguration = Objects.requireNonNullElseGet(configuration) { - SchemaConfiguration( - JsonSchemaKeywordFlags.Builder().build() - ) - } + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) val validatedPathToSchemas = PathToSchemasMap() val validationMetadata = - ValidationMetadata(pathToItem, usedConfiguration!!, validatedPathToSchemas, LinkedHashSet()) + ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, LinkedHashSet()) val pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet) return getNewInstance(castArg, validationMetadata.pathToItem, pathToSchemasMap) } @@ -198,15 +178,14 @@ class UnsetAnyTypeJsonSchema { if (entryKey !is String) { throw RuntimeException("Invalid non-string key value") } - val propertyName = entryKey val propertyPathToItem: MutableList = ArrayList(pathToItem) - propertyPathToItem.add(propertyName) + propertyPathToItem.add(entryKey) val value = value1!! - val schemas = pathToSchemas.get(propertyPathToItem) + val schemas = pathToSchemas[propertyPathToItem] ?: throw RuntimeException("Validation result is invalid, schemas must exist for a pathToItem") val propertySchema = schemas.entries.iterator().next().key val castValue = propertySchema.getNewInstance(value, propertyPathToItem, pathToSchemas) - properties[propertyName] = castValue + properties[entryKey] = castValue } return FrozenMap(properties) } @@ -216,51 +195,71 @@ class UnsetAnyTypeJsonSchema { val pathSet: MutableSet> = HashSet() val pathToItem = listOf("args[0]") val castArg: Map<*, *> = castToAllowedTypes(arg, pathToItem, pathSet) - val usedConfiguration = Objects.requireNonNullElseGet(configuration) { - SchemaConfiguration( - JsonSchemaKeywordFlags.Builder().build() - ) - } + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) val validatedPathToSchemas = PathToSchemasMap() val validationMetadata = - ValidationMetadata(pathToItem, usedConfiguration!!, validatedPathToSchemas, LinkedHashSet()) + ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, LinkedHashSet()) val pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet) return getNewInstance(castArg, validationMetadata.pathToItem, pathToSchemasMap) } override fun getNewInstance(arg: Any?, pathToItem: List, pathToSchemas: PathToSchemasMap): Any? { - if (arg == null) { - return getNewInstance(arg, pathToItem, pathToSchemas) - } else if (arg is Boolean) { - return getNewInstance(arg, pathToItem, pathToSchemas) - } else if (arg is Number) { - return getNewInstance(arg as Number?, pathToItem, pathToSchemas) - } else if (arg is String) { - return getNewInstance(arg as String?, pathToItem, pathToSchemas) - } else if (arg is List<*>) { - return getNewInstance(arg, pathToItem, pathToSchemas) - } else if (arg is Map<*, *>) { - return getNewInstance(arg, pathToItem, pathToSchemas) + when (arg) { + null -> { + return getNewInstance(null, pathToItem, pathToSchemas) + } + is Boolean -> { + return getNewInstance(arg, pathToItem, pathToSchemas) + } + + is Number -> { + return getNewInstance(arg, pathToItem, pathToSchemas) + } + + is String -> { + return getNewInstance(arg, pathToItem, pathToSchemas) + } + + is List<*> -> { + return getNewInstance(arg, pathToItem, pathToSchemas) + } + + is Map<*, *> -> { + return getNewInstance(arg, pathToItem, pathToSchemas) + } + + else -> throw RuntimeException("Invalid input type=$javaClass. It can't be instantiated by this schema") } - throw RuntimeException("Invalid input type=$javaClass. It can't be instantiated by this schema") } @Throws(ValidationException::class) override fun validate(arg: Any?, configuration: SchemaConfiguration?): Any? { - if (arg == null) { - return validate(null as Nothing?, configuration) - } else if (arg is Boolean) { - return validate(arg, configuration) - } else if (arg is Number) { - return validate(arg as Number?, configuration) - } else if (arg is String) { - return validate(arg as String?, configuration) - } else if (arg is List<*>) { - return validate(arg as List<*>?, configuration) - } else if (arg is Map<*, *>) { - return validate(arg as Map<*, *>?, configuration) + when (arg) { + null -> { + return validate(null, configuration) + } + is Boolean -> { + return validate(arg, configuration) + } + + is Number -> { + return validate(arg, configuration) + } + + is String -> { + return validate(arg, configuration) + } + + is List<*> -> { + return validate(arg, configuration) + } + + is Map<*, *> -> { + return validate(arg, configuration) + } + + else -> throw ValidationException("Invalid input type=$javaClass. It can't be validated by this schema") } - throw ValidationException("Invalid input type=$javaClass. It can't be validated by this schema") } @Throws(ValidationException::class) @@ -295,21 +294,33 @@ class UnsetAnyTypeJsonSchema { @Throws(ValidationException::class) override fun validateAndBox(arg: Any?, configuration: SchemaConfiguration?): UnsetAnyTypeJsonSchema1Boxed { - if (arg == null) { - return validateAndBox(arg, configuration) - } else if (arg is Boolean) { - val castArg: Boolean = arg - return validateAndBox(castArg, configuration) - } else if (arg is String) { - return validateAndBox(arg, configuration) - } else if (arg is Number) { - return validateAndBox(arg, configuration) - } else if (arg is List<*>) { - return validateAndBox(arg, configuration) - } else if (arg is Map<*, *>) { - return validateAndBox(arg, configuration) + when (arg) { + null -> { + return validateAndBox(null, configuration) + } + is Boolean -> { + val castArg: Boolean = arg + return validateAndBox(castArg, configuration) + } + + is String -> { + return validateAndBox(arg, configuration) + } + + is Number -> { + return validateAndBox(arg, configuration) + } + + is List<*> -> { + return validateAndBox(arg, configuration) + } + + is Map<*, *> -> { + return validateAndBox(arg, configuration) + } + + else -> throw ValidationException("Invalid input type=$javaClass. It can't be validated by this schema") } - throw ValidationException("Invalid input type=$javaClass. It can't be validated by this schema") } companion object { From c9122986b3c4584bcc864b30076eee1b038f0191 Mon Sep 17 00:00:00 2001 From: Justin Black Date: Tue, 7 May 2024 12:21:20 -0700 Subject: [PATCH 13/78] Fixes more types in UnsetAnyTypeJsonSchema1Boxed --- .../validation/UnsetAnyTypeJsonSchema.kt | 44 +++++++++---------- .../validation/UnsetAnyTypeJsonSchema.hbs | 44 +++++++++---------- 2 files changed, 44 insertions(+), 44 deletions(-) diff --git a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/schemas/validation/UnsetAnyTypeJsonSchema.kt b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/schemas/validation/UnsetAnyTypeJsonSchema.kt index 75138c9821e..c3434b3a565 100644 --- a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/schemas/validation/UnsetAnyTypeJsonSchema.kt +++ b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/schemas/validation/UnsetAnyTypeJsonSchema.kt @@ -9,42 +9,42 @@ import java.time.ZonedDateTime import java.util.UUID class UnsetAnyTypeJsonSchema { - interface UnsetAnyTypeJsonSchema1Boxed { - val data: Any? + sealed interface UnsetAnyTypeJsonSchema1Boxed { + fun getData(): Any? } - data class UnsetAnyTypeJsonSchema1BoxedVoid(override val data: Nothing?) : UnsetAnyTypeJsonSchema1Boxed { - fun getData(): Any? { + data class UnsetAnyTypeJsonSchema1BoxedVoid(val data: Nothing?) : UnsetAnyTypeJsonSchema1Boxed { + override fun getData(): Any? { return data } } - data class UnsetAnyTypeJsonSchema1BoxedBoolean(override val data: Boolean) : UnsetAnyTypeJsonSchema1Boxed { - fun getData(): Any? { + data class UnsetAnyTypeJsonSchema1BoxedBoolean(val data: Boolean) : UnsetAnyTypeJsonSchema1Boxed { + override fun getData(): Boolean { return data } } - data class UnsetAnyTypeJsonSchema1BoxedNumber(override val data: Number?) : UnsetAnyTypeJsonSchema1Boxed { - fun getData(): Any? { + data class UnsetAnyTypeJsonSchema1BoxedNumber(val data: Number) : UnsetAnyTypeJsonSchema1Boxed { + override fun getData(): Number { return data } } - data class UnsetAnyTypeJsonSchema1BoxedString(override val data: String?) : UnsetAnyTypeJsonSchema1Boxed { - fun getData(): Any? { + data class UnsetAnyTypeJsonSchema1BoxedString(val data: String) : UnsetAnyTypeJsonSchema1Boxed { + override fun getData(): String { return data } } - data class UnsetAnyTypeJsonSchema1BoxedList(override val data: FrozenList) : UnsetAnyTypeJsonSchema1Boxed { - fun getData(): Any? { + data class UnsetAnyTypeJsonSchema1BoxedList(val data: FrozenList) : UnsetAnyTypeJsonSchema1Boxed { + override fun getData(): FrozenList { return data } } - data class UnsetAnyTypeJsonSchema1BoxedMap(override val data: FrozenMap) : UnsetAnyTypeJsonSchema1Boxed { - fun getData(): Any? { + data class UnsetAnyTypeJsonSchema1BoxedMap(val data: FrozenMap) : UnsetAnyTypeJsonSchema1Boxed { + override fun getData(): FrozenMap { return data } } @@ -83,7 +83,7 @@ class UnsetAnyTypeJsonSchema { } @Throws(ValidationException::class) - fun validate(arg: Number, configuration: SchemaConfiguration?): Number? { + fun validate(arg: Number, configuration: SchemaConfiguration?): Number { val pathSet: MutableSet> = HashSet() val pathToItem = listOf("args[0]") val castArg: Number = castToAllowedTypes(arg, pathToItem, pathSet) @@ -129,21 +129,21 @@ class UnsetAnyTypeJsonSchema { } @Throws(ValidationException::class) - fun validate(arg: LocalDate, configuration: SchemaConfiguration?): String? { + fun validate(arg: LocalDate, configuration: SchemaConfiguration?): String { return validate(arg.toString(), configuration) } @Throws(ValidationException::class) - fun validate(arg: ZonedDateTime, configuration: SchemaConfiguration?): String? { + fun validate(arg: ZonedDateTime, configuration: SchemaConfiguration?): String { return validate(arg.toString(), configuration) } @Throws(ValidationException::class) - fun validate(arg: UUID, configuration: SchemaConfiguration?): String? { + fun validate(arg: UUID, configuration: SchemaConfiguration?): String { return validate(arg.toString(), configuration) } - fun getNewInstance(arg: List<*>, pathToItem: List, pathToSchemas: PathToSchemasMap): FrozenList { + fun getNewInstance(arg: List<*>, pathToItem: List, pathToSchemas: PathToSchemasMap): FrozenList { val items: MutableList = ArrayList() var i = 0 for (item in arg) { @@ -160,7 +160,7 @@ class UnsetAnyTypeJsonSchema { } @Throws(ValidationException::class) - fun validate(arg: List<*>, configuration: SchemaConfiguration?): FrozenList { + fun validate(arg: List<*>, configuration: SchemaConfiguration?): FrozenList { val pathSet: MutableSet> = HashSet() val pathToItem = listOf("args[0]") val castArg: List<*> = castToAllowedTypes(arg, pathToItem, pathSet) @@ -172,7 +172,7 @@ class UnsetAnyTypeJsonSchema { return getNewInstance(castArg, validationMetadata.pathToItem, pathToSchemasMap) } - fun getNewInstance(arg: Map<*, *>, pathToItem: List, pathToSchemas: PathToSchemasMap): FrozenMap { + fun getNewInstance(arg: Map<*, *>, pathToItem: List, pathToSchemas: PathToSchemasMap): FrozenMap { val properties = LinkedHashMap() for ((entryKey, value1) in arg) { if (entryKey !is String) { @@ -191,7 +191,7 @@ class UnsetAnyTypeJsonSchema { } @Throws(ValidationException::class) - fun validate(arg: Map<*, *>, configuration: SchemaConfiguration?): FrozenMap { + fun validate(arg: Map<*, *>, configuration: SchemaConfiguration?): FrozenMap { val pathSet: MutableSet> = HashSet() val pathToItem = listOf("args[0]") val castArg: Map<*, *> = castToAllowedTypes(arg, pathToItem, pathSet) diff --git a/src/main/resources/kotlin/src/main/kotlin/packagename/schemas/validation/UnsetAnyTypeJsonSchema.hbs b/src/main/resources/kotlin/src/main/kotlin/packagename/schemas/validation/UnsetAnyTypeJsonSchema.hbs index f28821a8469..52b8187a0e2 100644 --- a/src/main/resources/kotlin/src/main/kotlin/packagename/schemas/validation/UnsetAnyTypeJsonSchema.hbs +++ b/src/main/resources/kotlin/src/main/kotlin/packagename/schemas/validation/UnsetAnyTypeJsonSchema.hbs @@ -9,42 +9,42 @@ import java.time.ZonedDateTime import java.util.UUID class UnsetAnyTypeJsonSchema { - interface UnsetAnyTypeJsonSchema1Boxed { - val data: Any? + sealed interface UnsetAnyTypeJsonSchema1Boxed { + fun getData(): Any? } - data class UnsetAnyTypeJsonSchema1BoxedVoid(override val data: Nothing?) : UnsetAnyTypeJsonSchema1Boxed { - fun getData(): Any? { + data class UnsetAnyTypeJsonSchema1BoxedVoid(val data: Nothing?) : UnsetAnyTypeJsonSchema1Boxed { + override fun getData(): Any? { return data } } - data class UnsetAnyTypeJsonSchema1BoxedBoolean(override val data: Boolean) : UnsetAnyTypeJsonSchema1Boxed { - fun getData(): Any? { + data class UnsetAnyTypeJsonSchema1BoxedBoolean(val data: Boolean) : UnsetAnyTypeJsonSchema1Boxed { + override fun getData(): Boolean { return data } } - data class UnsetAnyTypeJsonSchema1BoxedNumber(override val data: Number?) : UnsetAnyTypeJsonSchema1Boxed { - fun getData(): Any? { + data class UnsetAnyTypeJsonSchema1BoxedNumber(val data: Number) : UnsetAnyTypeJsonSchema1Boxed { + override fun getData(): Number { return data } } - data class UnsetAnyTypeJsonSchema1BoxedString(override val data: String?) : UnsetAnyTypeJsonSchema1Boxed { - fun getData(): Any? { + data class UnsetAnyTypeJsonSchema1BoxedString(val data: String) : UnsetAnyTypeJsonSchema1Boxed { + override fun getData(): String { return data } } - data class UnsetAnyTypeJsonSchema1BoxedList(override val data: FrozenList) : UnsetAnyTypeJsonSchema1Boxed { - fun getData(): Any? { + data class UnsetAnyTypeJsonSchema1BoxedList(val data: FrozenList) : UnsetAnyTypeJsonSchema1Boxed { + override fun getData(): FrozenList { return data } } - data class UnsetAnyTypeJsonSchema1BoxedMap(override val data: FrozenMap) : UnsetAnyTypeJsonSchema1Boxed { - fun getData(): Any? { + data class UnsetAnyTypeJsonSchema1BoxedMap(val data: FrozenMap) : UnsetAnyTypeJsonSchema1Boxed { + override fun getData(): FrozenMap { return data } } @@ -83,7 +83,7 @@ class UnsetAnyTypeJsonSchema { } @Throws(ValidationException::class) - fun validate(arg: Number, configuration: SchemaConfiguration?): Number? { + fun validate(arg: Number, configuration: SchemaConfiguration?): Number { val pathSet: MutableSet> = HashSet() val pathToItem = listOf("args[0]") val castArg: Number = castToAllowedTypes(arg, pathToItem, pathSet) @@ -129,21 +129,21 @@ class UnsetAnyTypeJsonSchema { } @Throws(ValidationException::class) - fun validate(arg: LocalDate, configuration: SchemaConfiguration?): String? { + fun validate(arg: LocalDate, configuration: SchemaConfiguration?): String { return validate(arg.toString(), configuration) } @Throws(ValidationException::class) - fun validate(arg: ZonedDateTime, configuration: SchemaConfiguration?): String? { + fun validate(arg: ZonedDateTime, configuration: SchemaConfiguration?): String { return validate(arg.toString(), configuration) } @Throws(ValidationException::class) - fun validate(arg: UUID, configuration: SchemaConfiguration?): String? { + fun validate(arg: UUID, configuration: SchemaConfiguration?): String { return validate(arg.toString(), configuration) } - fun getNewInstance(arg: List<*>, pathToItem: List, pathToSchemas: PathToSchemasMap): FrozenList { + fun getNewInstance(arg: List<*>, pathToItem: List, pathToSchemas: PathToSchemasMap): FrozenList { val items: MutableList = ArrayList() var i = 0 for (item in arg) { @@ -160,7 +160,7 @@ class UnsetAnyTypeJsonSchema { } @Throws(ValidationException::class) - fun validate(arg: List<*>, configuration: SchemaConfiguration?): FrozenList { + fun validate(arg: List<*>, configuration: SchemaConfiguration?): FrozenList { val pathSet: MutableSet> = HashSet() val pathToItem = listOf("args[0]") val castArg: List<*> = castToAllowedTypes(arg, pathToItem, pathSet) @@ -172,7 +172,7 @@ class UnsetAnyTypeJsonSchema { return getNewInstance(castArg, validationMetadata.pathToItem, pathToSchemasMap) } - fun getNewInstance(arg: Map<*, *>, pathToItem: List, pathToSchemas: PathToSchemasMap): FrozenMap { + fun getNewInstance(arg: Map<*, *>, pathToItem: List, pathToSchemas: PathToSchemasMap): FrozenMap { val properties = LinkedHashMap() for ((entryKey, value1) in arg) { if (entryKey !is String) { @@ -191,7 +191,7 @@ class UnsetAnyTypeJsonSchema { } @Throws(ValidationException::class) - fun validate(arg: Map<*, *>, configuration: SchemaConfiguration?): FrozenMap { + fun validate(arg: Map<*, *>, configuration: SchemaConfiguration?): FrozenMap { val pathSet: MutableSet> = HashSet() val pathToItem = listOf("args[0]") val castArg: Map<*, *> = castToAllowedTypes(arg, pathToItem, pathSet) From 8e2371f7f7e473cdbcd34e5b2865df0818ff78cc Mon Sep 17 00:00:00 2001 From: Justin Black Date: Tue, 7 May 2024 12:59:14 -0700 Subject: [PATCH 14/78] Updates FrozenList and FrozenMap --- .../client/schemas/validation/FrozenList.kt | 29 ++++------ .../client/schemas/validation/FrozenMap.kt | 55 ++++++++----------- .../schemas/validation/FrozenList.hbs | 26 +++------ .../schemas/validation/FrozenMap.hbs | 51 +++++++---------- 4 files changed, 61 insertions(+), 100 deletions(-) diff --git a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/schemas/validation/FrozenList.kt b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/schemas/validation/FrozenList.kt index ab3ff21cbe1..5aa24bf1b9b 100644 --- a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/schemas/validation/FrozenList.kt +++ b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/schemas/validation/FrozenList.kt @@ -1,30 +1,21 @@ -package org.openapijsonschematools.client.schemas.validation; +package org.openapijsonschematools.client.schemas.validation -import java.util.AbstractList; -import java.util.ArrayList; -import java.util.Collection; -import java.util.List; - -public class FrozenList extends AbstractList { +open class FrozenList(m: Collection) : AbstractList() { /* A frozen List Once schema validation has been run, indexed access returns values of the correct type If values were mutable, the types in those methods would not agree with returned values */ - private final List list; - public FrozenList(Collection m) { - super(); - list = new ArrayList<>(m); - } + private val list: List - @Override - public E get(int index) { - return list.get(index); + init { + list = ArrayList(m) } - @Override - public int size() { - return list.size(); + override val size: Int + get() = list.size + + override fun get(index: Int): E { + return list[index] } } - diff --git a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/schemas/validation/FrozenMap.kt b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/schemas/validation/FrozenMap.kt index f3b178dd724..fcf7f39e691 100644 --- a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/schemas/validation/FrozenMap.kt +++ b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/schemas/validation/FrozenMap.kt @@ -1,54 +1,43 @@ -package org.openapijsonschematools.client.schemas.validation; +package org.openapijsonschematools.client.schemas.validation -import org.checkerframework.checker.nullness.qual.KeyFor; -import org.openapijsonschematools.client.exceptions.UnsetPropertyException; -import org.openapijsonschematools.client.exceptions.InvalidAdditionalPropertyException; +import org.openapijsonschematools.client.exceptions.InvalidAdditionalPropertyException +import org.openapijsonschematools.client.exceptions.UnsetPropertyException -import java.util.AbstractMap; -import java.util.HashMap; -import java.util.HashSet; -import java.util.Map; -import java.util.Set; -import java.util.stream.Collectors; - -public class FrozenMap extends AbstractMap { +open class FrozenMap(m: Map) : AbstractMap() { /* A frozen Map Once schema validation has been run, written accessor methods return values of the correct type If values were mutable, the types in those methods would not agree with returned values */ - private final Map map; - public FrozenMap(Map m) { + private val map: Map - super(); - map = new HashMap<>(m); + init { + map = HashMap(m) } - protected V getOrThrow(String key) throws UnsetPropertyException { + @Throws(UnsetPropertyException::class) + protected fun getOrThrow(key: String): V? { if (containsKey(key)) { - return get(key); + return get(key) } - throw new UnsetPropertyException(key+" is unset"); + throw UnsetPropertyException("$key is unset") } - protected void throwIfKeyNotPresent(String key) throws UnsetPropertyException { + @Throws(UnsetPropertyException::class) + protected fun throwIfKeyNotPresent(key: String) { if (!containsKey(key)) { - throw new UnsetPropertyException(key+" is unset"); + throw UnsetPropertyException("$key is unset") } } - protected void throwIfKeyKnown(String key, Set requiredKeys, Set optionalKeys) throws InvalidAdditionalPropertyException { - Set knownKeys = new HashSet<>(); - knownKeys.addAll(requiredKeys); - knownKeys.addAll(optionalKeys); - MapUtils.throwIfKeyKnown(key, knownKeys, false); + @Throws(InvalidAdditionalPropertyException::class) + protected fun throwIfKeyKnown(key: String?, requiredKeys: Set?, optionalKeys: Set?) { + val knownKeys: MutableSet = HashSet() + knownKeys.addAll(requiredKeys!!) + knownKeys.addAll(optionalKeys!!) + MapUtils.throwIfKeyKnown(key, knownKeys, false) } - @Override - public Set> entrySet() { - return map.entrySet().stream() - .map(x -> new AbstractMap.SimpleEntry<>(x.getKey(), x.getValue())) - .collect(Collectors.toSet()); - } + override val entries: Set> + get() = map.entries } - diff --git a/src/main/resources/java/src/main/java/packagename/schemas/validation/FrozenList.hbs b/src/main/resources/java/src/main/java/packagename/schemas/validation/FrozenList.hbs index 6711610f68a..443a488dbc2 100644 --- a/src/main/resources/java/src/main/java/packagename/schemas/validation/FrozenList.hbs +++ b/src/main/resources/java/src/main/java/packagename/schemas/validation/FrozenList.hbs @@ -1,30 +1,22 @@ package {{{packageName}}}.schemas.validation; -import java.util.AbstractList; -import java.util.ArrayList; -import java.util.Collection; -import java.util.List; - -public class FrozenList extends AbstractList { +open class FrozenList(m: Collection) : AbstractList() { /* A frozen List Once schema validation has been run, indexed access returns values of the correct type If values were mutable, the types in those methods would not agree with returned values */ - private final List list; - public FrozenList(Collection m) { - super(); - list = new ArrayList<>(m); - } + private val list: List - @Override - public E get(int index) { - return list.get(index); + init { + list = ArrayList(m) } - @Override - public int size() { - return list.size(); + override val size: Int + get() = list.size + + override fun get(index: Int): E { + return list[index] } } diff --git a/src/main/resources/java/src/main/java/packagename/schemas/validation/FrozenMap.hbs b/src/main/resources/java/src/main/java/packagename/schemas/validation/FrozenMap.hbs index 827f423c112..017c3863a50 100644 --- a/src/main/resources/java/src/main/java/packagename/schemas/validation/FrozenMap.hbs +++ b/src/main/resources/java/src/main/java/packagename/schemas/validation/FrozenMap.hbs @@ -1,54 +1,43 @@ package {{{packageName}}}.schemas.validation; -import org.checkerframework.checker.nullness.qual.KeyFor; import {{{packageName}}}.exceptions.UnsetPropertyException; import {{{packageName}}}.exceptions.InvalidAdditionalPropertyException; -import java.util.AbstractMap; -import java.util.HashMap; -import java.util.HashSet; -import java.util.Map; -import java.util.Set; -import java.util.stream.Collectors; - -public class FrozenMap extends AbstractMap { +open class FrozenMap(m: Map) : AbstractMap() { /* A frozen Map Once schema validation has been run, written accessor methods return values of the correct type If values were mutable, the types in those methods would not agree with returned values */ - private final Map map; - public FrozenMap(Map m) { + private val map: Map - super(); - map = new HashMap<>(m); + init { + map = HashMap(m) } - protected V getOrThrow(String key) throws UnsetPropertyException { + @Throws(UnsetPropertyException::class) + protected fun getOrThrow(key: String): V? { if (containsKey(key)) { - return get(key); + return get(key) } - throw new UnsetPropertyException(key+" is unset"); + throw UnsetPropertyException("$key is unset") } - protected void throwIfKeyNotPresent(String key) throws UnsetPropertyException { + @Throws(UnsetPropertyException::class) + protected fun throwIfKeyNotPresent(key: String) { if (!containsKey(key)) { - throw new UnsetPropertyException(key+" is unset"); + throw UnsetPropertyException("$key is unset") } } - protected void throwIfKeyKnown(String key, Set requiredKeys, Set optionalKeys) throws InvalidAdditionalPropertyException { - Set knownKeys = new HashSet<>(); - knownKeys.addAll(requiredKeys); - knownKeys.addAll(optionalKeys); - MapUtils.throwIfKeyKnown(key, knownKeys, false); - } - - @Override - public Set> entrySet() { - return map.entrySet().stream() - .map(x -> new AbstractMap.SimpleEntry<>(x.getKey(), x.getValue())) - .collect(Collectors.toSet()); + @Throws(InvalidAdditionalPropertyException::class) + protected fun throwIfKeyKnown(key: String?, requiredKeys: Set?, optionalKeys: Set?) { + val knownKeys: MutableSet = HashSet() + knownKeys.addAll(requiredKeys!!) + knownKeys.addAll(optionalKeys!!) + MapUtils.throwIfKeyKnown(key, knownKeys, false) } -} + override val entries: Set> + get() = map.entries +} \ No newline at end of file From 7a4b722aa150983c575537d3908b5ca4a4b3a0df Mon Sep 17 00:00:00 2001 From: Justin Black Date: Tue, 7 May 2024 13:12:21 -0700 Subject: [PATCH 15/78] Updates FrozenList/Map --- .../client/schemas/validation/FrozenMap.kt | 6 +-- .../client/schemas/validation/MapUtils.kt | 32 ++++++------- .../schemas/validation/FrozenList.hbs | 26 ++++++---- .../schemas/validation/FrozenMap.hbs | 43 +++++++++-------- .../schemas/validation/MapUtils.hbs | 4 -- .../schemas/validation/FrozenList.hbs | 26 ++++------ .../schemas/validation/FrozenMap.hbs | 48 ++++++++----------- .../schemas/validation/MapUtils.hbs | 28 +++++------ 8 files changed, 97 insertions(+), 116 deletions(-) diff --git a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/schemas/validation/FrozenMap.kt b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/schemas/validation/FrozenMap.kt index fcf7f39e691..def24dec10e 100644 --- a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/schemas/validation/FrozenMap.kt +++ b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/schemas/validation/FrozenMap.kt @@ -31,10 +31,10 @@ open class FrozenMap(m: Map) : AbstractMap() { } @Throws(InvalidAdditionalPropertyException::class) - protected fun throwIfKeyKnown(key: String?, requiredKeys: Set?, optionalKeys: Set?) { + protected fun throwIfKeyKnown(key: String, requiredKeys: Set, optionalKeys: Set) { val knownKeys: MutableSet = HashSet() - knownKeys.addAll(requiredKeys!!) - knownKeys.addAll(optionalKeys!!) + knownKeys.addAll(requiredKeys) + knownKeys.addAll(optionalKeys) MapUtils.throwIfKeyKnown(key, knownKeys, false) } diff --git a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/schemas/validation/MapUtils.kt b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/schemas/validation/MapUtils.kt index 122b3507936..e94182da537 100644 --- a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/schemas/validation/MapUtils.kt +++ b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/schemas/validation/MapUtils.kt @@ -1,12 +1,8 @@ -package org.openapijsonschematools.client.schemas.validation; +package org.openapijsonschematools.client.schemas.validation -import org.openapijsonschematools.client.exceptions.InvalidAdditionalPropertyException; +import org.openapijsonschematools.client.exceptions.InvalidAdditionalPropertyException -import java.util.HashMap; -import java.util.Map; -import java.util.Set; - -public class MapUtils { +object MapUtils { /** * A builder for maps that allows in null values * Schema tests + doc code samples need it @@ -14,24 +10,24 @@ public class MapUtils { * @return the output map * @param key type * @param value type - */ + */ @SafeVarargs - @SuppressWarnings("varargs") - public static Map makeMap(Map.Entry... entries) { - Map map = new HashMap<>(); - for (Map.Entry entry : entries) { - map.put(entry.getKey(), entry.getValue()); + fun makeMap(vararg entries: Map.Entry): Map { + val map: MutableMap = HashMap() + for ((key, value) in entries) { + map[key] = value } - return map; + return map } - public static void throwIfKeyKnown(String key, Set knownKeys, boolean setting) throws InvalidAdditionalPropertyException { + @Throws(InvalidAdditionalPropertyException::class) + fun throwIfKeyKnown(key: String, knownKeys: Set, setting: Boolean) { if (knownKeys.contains(key)) { - String verb = "getting"; + var verb = "getting" if (setting) { - verb = "setting"; + verb = "setting" } - throw new InvalidAdditionalPropertyException ("The known key " + key + " may not be passed in when "+verb+" an additional property"); + throw InvalidAdditionalPropertyException("The known key $key may not be passed in when $verb an additional property") } } } \ No newline at end of file diff --git a/src/main/resources/java/src/main/java/packagename/schemas/validation/FrozenList.hbs b/src/main/resources/java/src/main/java/packagename/schemas/validation/FrozenList.hbs index 443a488dbc2..6711610f68a 100644 --- a/src/main/resources/java/src/main/java/packagename/schemas/validation/FrozenList.hbs +++ b/src/main/resources/java/src/main/java/packagename/schemas/validation/FrozenList.hbs @@ -1,22 +1,30 @@ package {{{packageName}}}.schemas.validation; -open class FrozenList(m: Collection) : AbstractList() { +import java.util.AbstractList; +import java.util.ArrayList; +import java.util.Collection; +import java.util.List; + +public class FrozenList extends AbstractList { /* A frozen List Once schema validation has been run, indexed access returns values of the correct type If values were mutable, the types in those methods would not agree with returned values */ - private val list: List - - init { - list = ArrayList(m) + private final List list; + public FrozenList(Collection m) { + super(); + list = new ArrayList<>(m); } - override val size: Int - get() = list.size + @Override + public E get(int index) { + return list.get(index); + } - override fun get(index: Int): E { - return list[index] + @Override + public int size() { + return list.size(); } } diff --git a/src/main/resources/java/src/main/java/packagename/schemas/validation/FrozenMap.hbs b/src/main/resources/java/src/main/java/packagename/schemas/validation/FrozenMap.hbs index 017c3863a50..10a75afb3a5 100644 --- a/src/main/resources/java/src/main/java/packagename/schemas/validation/FrozenMap.hbs +++ b/src/main/resources/java/src/main/java/packagename/schemas/validation/FrozenMap.hbs @@ -3,41 +3,44 @@ package {{{packageName}}}.schemas.validation; import {{{packageName}}}.exceptions.UnsetPropertyException; import {{{packageName}}}.exceptions.InvalidAdditionalPropertyException; -open class FrozenMap(m: Map) : AbstractMap() { +public class FrozenMap extends AbstractMap { /* A frozen Map Once schema validation has been run, written accessor methods return values of the correct type If values were mutable, the types in those methods would not agree with returned values */ - private val map: Map + private final Map map; + public FrozenMap(Map m) { - init { - map = HashMap(m) + super(); + map = new HashMap<>(m); } - @Throws(UnsetPropertyException::class) - protected fun getOrThrow(key: String): V? { + protected V getOrThrow(String key) throws UnsetPropertyException { if (containsKey(key)) { - return get(key) + return get(key); } - throw UnsetPropertyException("$key is unset") + throw new UnsetPropertyException(key+" is unset"); } - @Throws(UnsetPropertyException::class) - protected fun throwIfKeyNotPresent(key: String) { + protected void throwIfKeyNotPresent(String key) throws UnsetPropertyException { if (!containsKey(key)) { - throw UnsetPropertyException("$key is unset") + throw new UnsetPropertyException(key+" is unset"); } } - @Throws(InvalidAdditionalPropertyException::class) - protected fun throwIfKeyKnown(key: String?, requiredKeys: Set?, optionalKeys: Set?) { - val knownKeys: MutableSet = HashSet() - knownKeys.addAll(requiredKeys!!) - knownKeys.addAll(optionalKeys!!) - MapUtils.throwIfKeyKnown(key, knownKeys, false) + protected void throwIfKeyKnown(String key, Set requiredKeys, Set optionalKeys) throws InvalidAdditionalPropertyException { + Set knownKeys = new HashSet<>(); + knownKeys.addAll(requiredKeys); + knownKeys.addAll(optionalKeys); + MapUtils.throwIfKeyKnown(key, knownKeys, false); } - override val entries: Set> - get() = map.entries -} \ No newline at end of file + @Override + public Set> entrySet() { + return map.entrySet().stream() + .map(x -> new AbstractMap.SimpleEntry<>(x.getKey(), x.getValue())) + .collect(Collectors.toSet()); + } +} + diff --git a/src/main/resources/java/src/main/java/packagename/schemas/validation/MapUtils.hbs b/src/main/resources/java/src/main/java/packagename/schemas/validation/MapUtils.hbs index 17ef79f4e6d..7164893fd07 100644 --- a/src/main/resources/java/src/main/java/packagename/schemas/validation/MapUtils.hbs +++ b/src/main/resources/java/src/main/java/packagename/schemas/validation/MapUtils.hbs @@ -2,10 +2,6 @@ package {{{packageName}}}.schemas.validation; import {{{packageName}}}.exceptions.InvalidAdditionalPropertyException; -import java.util.HashMap; -import java.util.Map; -import java.util.Set; - public class MapUtils { /** * A builder for maps that allows in null values diff --git a/src/main/resources/kotlin/src/main/kotlin/packagename/schemas/validation/FrozenList.hbs b/src/main/resources/kotlin/src/main/kotlin/packagename/schemas/validation/FrozenList.hbs index 6711610f68a..443a488dbc2 100644 --- a/src/main/resources/kotlin/src/main/kotlin/packagename/schemas/validation/FrozenList.hbs +++ b/src/main/resources/kotlin/src/main/kotlin/packagename/schemas/validation/FrozenList.hbs @@ -1,30 +1,22 @@ package {{{packageName}}}.schemas.validation; -import java.util.AbstractList; -import java.util.ArrayList; -import java.util.Collection; -import java.util.List; - -public class FrozenList extends AbstractList { +open class FrozenList(m: Collection) : AbstractList() { /* A frozen List Once schema validation has been run, indexed access returns values of the correct type If values were mutable, the types in those methods would not agree with returned values */ - private final List list; - public FrozenList(Collection m) { - super(); - list = new ArrayList<>(m); - } + private val list: List - @Override - public E get(int index) { - return list.get(index); + init { + list = ArrayList(m) } - @Override - public int size() { - return list.size(); + override val size: Int + get() = list.size + + override fun get(index: Int): E { + return list[index] } } diff --git a/src/main/resources/kotlin/src/main/kotlin/packagename/schemas/validation/FrozenMap.hbs b/src/main/resources/kotlin/src/main/kotlin/packagename/schemas/validation/FrozenMap.hbs index 827f423c112..079e94b03d5 100644 --- a/src/main/resources/kotlin/src/main/kotlin/packagename/schemas/validation/FrozenMap.hbs +++ b/src/main/resources/kotlin/src/main/kotlin/packagename/schemas/validation/FrozenMap.hbs @@ -1,54 +1,44 @@ package {{{packageName}}}.schemas.validation; -import org.checkerframework.checker.nullness.qual.KeyFor; import {{{packageName}}}.exceptions.UnsetPropertyException; import {{{packageName}}}.exceptions.InvalidAdditionalPropertyException; -import java.util.AbstractMap; -import java.util.HashMap; -import java.util.HashSet; -import java.util.Map; -import java.util.Set; -import java.util.stream.Collectors; - -public class FrozenMap extends AbstractMap { +open class FrozenMap(m: Map) : AbstractMap() { /* A frozen Map Once schema validation has been run, written accessor methods return values of the correct type If values were mutable, the types in those methods would not agree with returned values */ - private final Map map; - public FrozenMap(Map m) { + private val map: Map - super(); - map = new HashMap<>(m); + init { + map = HashMap(m) } - protected V getOrThrow(String key) throws UnsetPropertyException { + @Throws(UnsetPropertyException::class) + protected fun getOrThrow(key: String): V? { if (containsKey(key)) { - return get(key); + return get(key) } - throw new UnsetPropertyException(key+" is unset"); + throw UnsetPropertyException("$key is unset") } - protected void throwIfKeyNotPresent(String key) throws UnsetPropertyException { + @Throws(UnsetPropertyException::class) + protected fun throwIfKeyNotPresent(key: String) { if (!containsKey(key)) { - throw new UnsetPropertyException(key+" is unset"); + throw UnsetPropertyException("$key is unset") } } - protected void throwIfKeyKnown(String key, Set requiredKeys, Set optionalKeys) throws InvalidAdditionalPropertyException { - Set knownKeys = new HashSet<>(); - knownKeys.addAll(requiredKeys); - knownKeys.addAll(optionalKeys); - MapUtils.throwIfKeyKnown(key, knownKeys, false); + @Throws(InvalidAdditionalPropertyException::class) + protected fun throwIfKeyKnown(key: String, requiredKeys: Set, optionalKeys: Set) { + val knownKeys: MutableSet = HashSet() + knownKeys.addAll(requiredKeys) + knownKeys.addAll(optionalKeys) + MapUtils.throwIfKeyKnown(key, knownKeys, false) } - @Override - public Set> entrySet() { - return map.entrySet().stream() - .map(x -> new AbstractMap.SimpleEntry<>(x.getKey(), x.getValue())) - .collect(Collectors.toSet()); - } + override val entries: Set> + get() = map.entries } diff --git a/src/main/resources/kotlin/src/main/kotlin/packagename/schemas/validation/MapUtils.hbs b/src/main/resources/kotlin/src/main/kotlin/packagename/schemas/validation/MapUtils.hbs index 17ef79f4e6d..2af65c47a9b 100644 --- a/src/main/resources/kotlin/src/main/kotlin/packagename/schemas/validation/MapUtils.hbs +++ b/src/main/resources/kotlin/src/main/kotlin/packagename/schemas/validation/MapUtils.hbs @@ -2,11 +2,7 @@ package {{{packageName}}}.schemas.validation; import {{{packageName}}}.exceptions.InvalidAdditionalPropertyException; -import java.util.HashMap; -import java.util.Map; -import java.util.Set; - -public class MapUtils { +object MapUtils { /** * A builder for maps that allows in null values * Schema tests + doc code samples need it @@ -14,24 +10,24 @@ public class MapUtils { * @return the output map * @param key type * @param value type - */ + */ @SafeVarargs - @SuppressWarnings("varargs") - public static Map makeMap(Map.Entry... entries) { - Map map = new HashMap<>(); - for (Map.Entry entry : entries) { - map.put(entry.getKey(), entry.getValue()); + fun makeMap(vararg entries: Map.Entry): Map { + val map: MutableMap = HashMap() + for ((key, value) in entries) { + map[key] = value } - return map; + return map } - public static void throwIfKeyKnown(String key, Set knownKeys, boolean setting) throws InvalidAdditionalPropertyException { + @Throws(InvalidAdditionalPropertyException::class) + fun throwIfKeyKnown(key: String, knownKeys: Set, setting: Boolean) { if (knownKeys.contains(key)) { - String verb = "getting"; + var verb = "getting" if (setting) { - verb = "setting"; + verb = "setting" } - throw new InvalidAdditionalPropertyException ("The known key " + key + " may not be passed in when "+verb+" an additional property"); + throw InvalidAdditionalPropertyException("The known key $key may not be passed in when $verb an additional property") } } } \ No newline at end of file From 2a472c36f2a14252b07bf7d55531c4bc40d5cbd0 Mon Sep 17 00:00:00 2001 From: Justin Black Date: Tue, 7 May 2024 13:15:40 -0700 Subject: [PATCH 16/78] Reverts java template changes --- .../java/packagename/schemas/validation/FrozenMap.hbs | 8 ++++++++ .../main/java/packagename/schemas/validation/MapUtils.hbs | 4 ++++ 2 files changed, 12 insertions(+) diff --git a/src/main/resources/java/src/main/java/packagename/schemas/validation/FrozenMap.hbs b/src/main/resources/java/src/main/java/packagename/schemas/validation/FrozenMap.hbs index 10a75afb3a5..827f423c112 100644 --- a/src/main/resources/java/src/main/java/packagename/schemas/validation/FrozenMap.hbs +++ b/src/main/resources/java/src/main/java/packagename/schemas/validation/FrozenMap.hbs @@ -1,8 +1,16 @@ package {{{packageName}}}.schemas.validation; +import org.checkerframework.checker.nullness.qual.KeyFor; import {{{packageName}}}.exceptions.UnsetPropertyException; import {{{packageName}}}.exceptions.InvalidAdditionalPropertyException; +import java.util.AbstractMap; +import java.util.HashMap; +import java.util.HashSet; +import java.util.Map; +import java.util.Set; +import java.util.stream.Collectors; + public class FrozenMap extends AbstractMap { /* A frozen Map diff --git a/src/main/resources/java/src/main/java/packagename/schemas/validation/MapUtils.hbs b/src/main/resources/java/src/main/java/packagename/schemas/validation/MapUtils.hbs index 7164893fd07..17ef79f4e6d 100644 --- a/src/main/resources/java/src/main/java/packagename/schemas/validation/MapUtils.hbs +++ b/src/main/resources/java/src/main/java/packagename/schemas/validation/MapUtils.hbs @@ -2,6 +2,10 @@ package {{{packageName}}}.schemas.validation; import {{{packageName}}}.exceptions.InvalidAdditionalPropertyException; +import java.util.HashMap; +import java.util.Map; +import java.util.Set; + public class MapUtils { /** * A builder for maps that allows in null values From 585f865f5a1ec1949757331f8723b8bf64b00e1d Mon Sep 17 00:00:00 2001 From: Justin Black Date: Tue, 7 May 2024 13:55:14 -0700 Subject: [PATCH 17/78] Fixes all of the type validator interfaces --- .../validation/BooleanSchemaValidator.kt | 15 ++++--- .../schemas/validation/ListSchemaValidator.kt | 19 +++++---- .../schemas/validation/MapSchemaValidator.kt | 20 +++++---- .../schemas/validation/NullSchemaValidator.kt | 15 ++++--- .../validation/NumberSchemaValidator.kt | 15 ++++--- .../validation/StringSchemaValidator.kt | 15 ++++--- .../validation/UnsetAnyTypeJsonSchema.kt | 42 +++++++++---------- .../validation/BooleanSchemaValidator.hbs | 9 ++-- .../validation/ListSchemaValidator.hbs | 13 +++--- .../schemas/validation/MapSchemaValidator.hbs | 14 ++++--- .../validation/NullSchemaValidator.hbs | 9 ++-- .../validation/NumberSchemaValidator.hbs | 9 ++-- .../validation/StringSchemaValidator.hbs | 9 ++-- .../validation/UnsetAnyTypeJsonSchema.hbs | 42 +++++++++---------- 14 files changed, 140 insertions(+), 106 deletions(-) diff --git a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/schemas/validation/BooleanSchemaValidator.kt b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/schemas/validation/BooleanSchemaValidator.kt index 96c69f5a7a2..acdd61917b7 100644 --- a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/schemas/validation/BooleanSchemaValidator.kt +++ b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/schemas/validation/BooleanSchemaValidator.kt @@ -1,9 +1,12 @@ -package org.openapijsonschematools.client.schemas.validation; +package org.openapijsonschematools.client.schemas.validation -import org.openapijsonschematools.client.configurations.SchemaConfiguration; -import org.openapijsonschematools.client.exceptions.ValidationException; +import org.openapijsonschematools.client.configurations.SchemaConfiguration +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; +interface BooleanSchemaValidator { + @Throws(ValidationException::class) + fun validate(arg: Boolean, configuration: SchemaConfiguration?): Boolean + + @Throws(ValidationException::class) + fun validateAndBox(arg: Boolean, configuration: SchemaConfiguration?): T } \ No newline at end of file diff --git a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/schemas/validation/ListSchemaValidator.kt b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/schemas/validation/ListSchemaValidator.kt index a7752b37595..59c8c533bb2 100644 --- a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/schemas/validation/ListSchemaValidator.kt +++ b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/schemas/validation/ListSchemaValidator.kt @@ -1,12 +1,15 @@ -package org.openapijsonschematools.client.schemas.validation; +package org.openapijsonschematools.client.schemas.validation -import org.openapijsonschematools.client.configurations.SchemaConfiguration; -import org.openapijsonschematools.client.exceptions.ValidationException; +import org.openapijsonschematools.client.configurations.SchemaConfiguration +import org.openapijsonschematools.client.exceptions.ValidationException -import java.util.List; +interface ListSchemaValidator { + @Throws(ValidationException::class) + fun getNewInstance(arg: List<*>, pathToItem: List, pathToSchemas: PathToSchemasMap): OutType -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; + @Throws(ValidationException::class) + fun validate(arg: List<*>, configuration: SchemaConfiguration?): OutType + + @Throws(ValidationException::class) + fun validateAndBox(arg: List<*>, configuration: SchemaConfiguration?): BoxedType } \ No newline at end of file diff --git a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/schemas/validation/MapSchemaValidator.kt b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/schemas/validation/MapSchemaValidator.kt index 9bd7d432165..bf11248a121 100644 --- a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/schemas/validation/MapSchemaValidator.kt +++ b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/schemas/validation/MapSchemaValidator.kt @@ -1,13 +1,15 @@ -package org.openapijsonschematools.client.schemas.validation; +package org.openapijsonschematools.client.schemas.validation -import org.openapijsonschematools.client.configurations.SchemaConfiguration; -import org.openapijsonschematools.client.exceptions.ValidationException; +import org.openapijsonschematools.client.configurations.SchemaConfiguration +import org.openapijsonschematools.client.exceptions.ValidationException -import java.util.List; -import java.util.Map; +interface MapSchemaValidator { + @Throws(ValidationException::class) + fun getNewInstance(arg: Map<*, *>, pathToItem: List, pathToSchemas: PathToSchemasMap): OutType -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; + @Throws(ValidationException::class) + fun validate(arg: Map<*, *>, configuration: SchemaConfiguration?): OutType + + @Throws(ValidationException::class) + fun validateAndBox(arg: Map<*, *>, configuration: SchemaConfiguration?): BoxedType } \ No newline at end of file diff --git a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/schemas/validation/NullSchemaValidator.kt b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/schemas/validation/NullSchemaValidator.kt index b06d8285e01..b0e8462d4cf 100644 --- a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/schemas/validation/NullSchemaValidator.kt +++ b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/schemas/validation/NullSchemaValidator.kt @@ -1,9 +1,12 @@ -package org.openapijsonschematools.client.schemas.validation; +package org.openapijsonschematools.client.schemas.validation -import org.openapijsonschematools.client.configurations.SchemaConfiguration; -import org.openapijsonschematools.client.exceptions.ValidationException; +import org.openapijsonschematools.client.configurations.SchemaConfiguration +import org.openapijsonschematools.client.exceptions.ValidationException -public interface NullSchemaValidator { - Nothing? validate(Nothing? arg, SchemaConfiguration configuration) throws ValidationException; - T validateAndBox(Nothing? arg, SchemaConfiguration configuration) throws ValidationException; +interface NullSchemaValidator { + @Throws(ValidationException::class) + fun validate(arg: Nothing?, configuration: SchemaConfiguration?): Nothing? + + @Throws(ValidationException::class) + fun validateAndBox(arg: Nothing?, configuration: SchemaConfiguration?): T } \ No newline at end of file diff --git a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/schemas/validation/NumberSchemaValidator.kt b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/schemas/validation/NumberSchemaValidator.kt index dd3c349ad69..cf4b7e2365b 100644 --- a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/schemas/validation/NumberSchemaValidator.kt +++ b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/schemas/validation/NumberSchemaValidator.kt @@ -1,9 +1,12 @@ -package org.openapijsonschematools.client.schemas.validation; +package org.openapijsonschematools.client.schemas.validation -import org.openapijsonschematools.client.configurations.SchemaConfiguration; -import org.openapijsonschematools.client.exceptions.ValidationException; +import org.openapijsonschematools.client.configurations.SchemaConfiguration +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; +interface NumberSchemaValidator { + @Throws(ValidationException::class) + fun validate(arg: Number, configuration: SchemaConfiguration?): Number + + @Throws(ValidationException::class) + fun validateAndBox(arg: Number, configuration: SchemaConfiguration?): T } \ No newline at end of file diff --git a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/schemas/validation/StringSchemaValidator.kt b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/schemas/validation/StringSchemaValidator.kt index e6729893fca..b9622585d38 100644 --- a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/schemas/validation/StringSchemaValidator.kt +++ b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/schemas/validation/StringSchemaValidator.kt @@ -1,9 +1,12 @@ -package org.openapijsonschematools.client.schemas.validation; +package org.openapijsonschematools.client.schemas.validation -import org.openapijsonschematools.client.configurations.SchemaConfiguration; -import org.openapijsonschematools.client.exceptions.ValidationException; +import org.openapijsonschematools.client.configurations.SchemaConfiguration +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; +interface StringSchemaValidator { + @Throws(ValidationException::class) + fun validate(arg: String, configuration: SchemaConfiguration?): String + + @Throws(ValidationException::class) + fun validateAndBox(arg: String, configuration: SchemaConfiguration?): T } \ No newline at end of file diff --git a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/schemas/validation/UnsetAnyTypeJsonSchema.kt b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/schemas/validation/UnsetAnyTypeJsonSchema.kt index c3434b3a565..8be46ceedc6 100644 --- a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/schemas/validation/UnsetAnyTypeJsonSchema.kt +++ b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/schemas/validation/UnsetAnyTypeJsonSchema.kt @@ -49,15 +49,15 @@ class UnsetAnyTypeJsonSchema { } } - class UnsetAnyTypeJsonSchema1 private constructor() : JsonSchema(JsonSchemaInfo()), - NullSchemaValidator, - BooleanSchemaValidator, - NumberSchemaValidator, - StringSchemaValidator, - ListSchemaValidator?, UnsetAnyTypeJsonSchema1BoxedList?>, - MapSchemaValidator?, UnsetAnyTypeJsonSchema1BoxedMap?> { + class UnsetAnyTypeJsonSchema1 private constructor() : JsonSchema(JsonSchemaInfo()), + NullSchemaValidator, + BooleanSchemaValidator, + NumberSchemaValidator, + StringSchemaValidator, + ListSchemaValidator, UnsetAnyTypeJsonSchema1BoxedList>, + MapSchemaValidator, UnsetAnyTypeJsonSchema1BoxedMap> { @Throws(ValidationException::class) - fun validate(arg: Nothing?, configuration: SchemaConfiguration?): Nothing? { + override fun validate(arg: Nothing?, configuration: SchemaConfiguration?): Nothing? { val pathSet: MutableSet> = HashSet() val pathToItem = listOf("args[0]") val castArg: Nothing? = castToAllowedTypes(arg, pathToItem, pathSet) @@ -70,7 +70,7 @@ class UnsetAnyTypeJsonSchema { } @Throws(ValidationException::class) - fun validate(arg: Boolean, configuration: SchemaConfiguration?): Boolean { + override fun validate(arg: Boolean, configuration: SchemaConfiguration?): Boolean { val pathSet: MutableSet> = HashSet() val pathToItem = listOf("args[0]") val castArg: Boolean = castToAllowedTypes(arg, pathToItem, pathSet) @@ -83,7 +83,7 @@ class UnsetAnyTypeJsonSchema { } @Throws(ValidationException::class) - fun validate(arg: Number, configuration: SchemaConfiguration?): Number { + override fun validate(arg: Number, configuration: SchemaConfiguration?): Number { val pathSet: MutableSet> = HashSet() val pathToItem = listOf("args[0]") val castArg: Number = castToAllowedTypes(arg, pathToItem, pathSet) @@ -116,7 +116,7 @@ class UnsetAnyTypeJsonSchema { } @Throws(ValidationException::class) - fun validate(arg: String, configuration: SchemaConfiguration?): String { + override fun validate(arg: String, configuration: SchemaConfiguration?): String { val pathSet: MutableSet> = HashSet() val pathToItem = listOf("args[0]") val castArg: String = castToAllowedTypes(arg, pathToItem, pathSet) @@ -143,7 +143,7 @@ class UnsetAnyTypeJsonSchema { return validate(arg.toString(), configuration) } - fun getNewInstance(arg: List<*>, pathToItem: List, pathToSchemas: PathToSchemasMap): FrozenList { + override fun getNewInstance(arg: List<*>, pathToItem: List, pathToSchemas: PathToSchemasMap): FrozenList { val items: MutableList = ArrayList() var i = 0 for (item in arg) { @@ -160,7 +160,7 @@ class UnsetAnyTypeJsonSchema { } @Throws(ValidationException::class) - fun validate(arg: List<*>, configuration: SchemaConfiguration?): FrozenList { + override fun validate(arg: List<*>, configuration: SchemaConfiguration?): FrozenList { val pathSet: MutableSet> = HashSet() val pathToItem = listOf("args[0]") val castArg: List<*> = castToAllowedTypes(arg, pathToItem, pathSet) @@ -172,7 +172,7 @@ class UnsetAnyTypeJsonSchema { return getNewInstance(castArg, validationMetadata.pathToItem, pathToSchemasMap) } - fun getNewInstance(arg: Map<*, *>, pathToItem: List, pathToSchemas: PathToSchemasMap): FrozenMap { + override fun getNewInstance(arg: Map<*, *>, pathToItem: List, pathToSchemas: PathToSchemasMap): FrozenMap { val properties = LinkedHashMap() for ((entryKey, value1) in arg) { if (entryKey !is String) { @@ -191,7 +191,7 @@ class UnsetAnyTypeJsonSchema { } @Throws(ValidationException::class) - fun validate(arg: Map<*, *>, configuration: SchemaConfiguration?): FrozenMap { + override fun validate(arg: Map<*, *>, configuration: SchemaConfiguration?): FrozenMap { val pathSet: MutableSet> = HashSet() val pathToItem = listOf("args[0]") val castArg: Map<*, *> = castToAllowedTypes(arg, pathToItem, pathSet) @@ -263,32 +263,32 @@ class UnsetAnyTypeJsonSchema { } @Throws(ValidationException::class) - fun validateAndBox(arg: Nothing?, configuration: SchemaConfiguration?): UnsetAnyTypeJsonSchema1BoxedVoid { + override fun validateAndBox(arg: Nothing?, configuration: SchemaConfiguration?): UnsetAnyTypeJsonSchema1BoxedVoid { return UnsetAnyTypeJsonSchema1BoxedVoid(validate(arg, configuration)) } @Throws(ValidationException::class) - fun validateAndBox(arg: Boolean, configuration: SchemaConfiguration?): UnsetAnyTypeJsonSchema1BoxedBoolean { + override fun validateAndBox(arg: Boolean, configuration: SchemaConfiguration?): UnsetAnyTypeJsonSchema1BoxedBoolean { return UnsetAnyTypeJsonSchema1BoxedBoolean(validate(arg, configuration)) } @Throws(ValidationException::class) - fun validateAndBox(arg: Number, configuration: SchemaConfiguration?): UnsetAnyTypeJsonSchema1BoxedNumber { + override fun validateAndBox(arg: Number, configuration: SchemaConfiguration?): UnsetAnyTypeJsonSchema1BoxedNumber { return UnsetAnyTypeJsonSchema1BoxedNumber(validate(arg, configuration)) } @Throws(ValidationException::class) - fun validateAndBox(arg: String, configuration: SchemaConfiguration?): UnsetAnyTypeJsonSchema1BoxedString { + override fun validateAndBox(arg: String, configuration: SchemaConfiguration?): UnsetAnyTypeJsonSchema1BoxedString { return UnsetAnyTypeJsonSchema1BoxedString(validate(arg, configuration)) } @Throws(ValidationException::class) - fun validateAndBox(arg: List<*>, configuration: SchemaConfiguration?): UnsetAnyTypeJsonSchema1BoxedList { + override fun validateAndBox(arg: List<*>, configuration: SchemaConfiguration?): UnsetAnyTypeJsonSchema1BoxedList { return UnsetAnyTypeJsonSchema1BoxedList(validate(arg, configuration)) } @Throws(ValidationException::class) - fun validateAndBox(arg: Map<*, *>, configuration: SchemaConfiguration?): UnsetAnyTypeJsonSchema1BoxedMap { + override fun validateAndBox(arg: Map<*, *>, configuration: SchemaConfiguration?): UnsetAnyTypeJsonSchema1BoxedMap { return UnsetAnyTypeJsonSchema1BoxedMap(validate(arg, configuration)) } diff --git a/src/main/resources/kotlin/src/main/kotlin/packagename/schemas/validation/BooleanSchemaValidator.hbs b/src/main/resources/kotlin/src/main/kotlin/packagename/schemas/validation/BooleanSchemaValidator.hbs index 8ac8de93950..d7104fd5bec 100644 --- a/src/main/resources/kotlin/src/main/kotlin/packagename/schemas/validation/BooleanSchemaValidator.hbs +++ b/src/main/resources/kotlin/src/main/kotlin/packagename/schemas/validation/BooleanSchemaValidator.hbs @@ -3,7 +3,10 @@ package {{{packageName}}}.schemas.validation; import {{{packageName}}}.configurations.SchemaConfiguration; import {{{packageName}}}.exceptions.ValidationException; -public interface BooleanSchemaValidator { - boolean validate(boolean arg, SchemaConfiguration configuration) throws ValidationException; - T validateAndBox(boolean arg, SchemaConfiguration configuration) throws ValidationException; +interface BooleanSchemaValidator { + @Throws(ValidationException::class) + fun validate(arg: Boolean, configuration: SchemaConfiguration?): Boolean + + @Throws(ValidationException::class) + fun validateAndBox(arg: Boolean, configuration: SchemaConfiguration?): T } \ No newline at end of file diff --git a/src/main/resources/kotlin/src/main/kotlin/packagename/schemas/validation/ListSchemaValidator.hbs b/src/main/resources/kotlin/src/main/kotlin/packagename/schemas/validation/ListSchemaValidator.hbs index 90408f24eee..91d1f767cce 100644 --- a/src/main/resources/kotlin/src/main/kotlin/packagename/schemas/validation/ListSchemaValidator.hbs +++ b/src/main/resources/kotlin/src/main/kotlin/packagename/schemas/validation/ListSchemaValidator.hbs @@ -3,10 +3,13 @@ package {{{packageName}}}.schemas.validation; import {{{packageName}}}.configurations.SchemaConfiguration; import {{{packageName}}}.exceptions.ValidationException; -import java.util.List; +interface ListSchemaValidator { + @Throws(ValidationException::class) + fun getNewInstance(arg: List<*>, pathToItem: List, pathToSchemas: PathToSchemasMap): OutType -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; + @Throws(ValidationException::class) + fun validate(arg: List<*>, configuration: SchemaConfiguration?): OutType + + @Throws(ValidationException::class) + fun validateAndBox(arg: List<*>, configuration: SchemaConfiguration?): BoxedType } \ No newline at end of file diff --git a/src/main/resources/kotlin/src/main/kotlin/packagename/schemas/validation/MapSchemaValidator.hbs b/src/main/resources/kotlin/src/main/kotlin/packagename/schemas/validation/MapSchemaValidator.hbs index 3926cf38ca8..f528f687e54 100644 --- a/src/main/resources/kotlin/src/main/kotlin/packagename/schemas/validation/MapSchemaValidator.hbs +++ b/src/main/resources/kotlin/src/main/kotlin/packagename/schemas/validation/MapSchemaValidator.hbs @@ -3,11 +3,13 @@ package {{{packageName}}}.schemas.validation; import {{{packageName}}}.configurations.SchemaConfiguration; import {{{packageName}}}.exceptions.ValidationException; -import java.util.List; -import java.util.Map; +interface MapSchemaValidator { + @Throws(ValidationException::class) + fun getNewInstance(arg: Map<*, *>, pathToItem: List, pathToSchemas: PathToSchemasMap): OutType -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; + @Throws(ValidationException::class) + fun validate(arg: Map<*, *>, configuration: SchemaConfiguration?): OutType + + @Throws(ValidationException::class) + fun validateAndBox(arg: Map<*, *>, configuration: SchemaConfiguration?): BoxedType } \ No newline at end of file diff --git a/src/main/resources/kotlin/src/main/kotlin/packagename/schemas/validation/NullSchemaValidator.hbs b/src/main/resources/kotlin/src/main/kotlin/packagename/schemas/validation/NullSchemaValidator.hbs index daaed85e35c..6e655912dbf 100644 --- a/src/main/resources/kotlin/src/main/kotlin/packagename/schemas/validation/NullSchemaValidator.hbs +++ b/src/main/resources/kotlin/src/main/kotlin/packagename/schemas/validation/NullSchemaValidator.hbs @@ -3,7 +3,10 @@ package {{{packageName}}}.schemas.validation; import {{{packageName}}}.configurations.SchemaConfiguration; import {{{packageName}}}.exceptions.ValidationException; -public interface NullSchemaValidator { - Nothing? validate(Nothing? arg, SchemaConfiguration configuration) throws ValidationException; - T validateAndBox(Nothing? arg, SchemaConfiguration configuration) throws ValidationException; +interface NullSchemaValidator { + @Throws(ValidationException::class) + fun validate(arg: Nothing?, configuration: SchemaConfiguration?): Nothing? + + @Throws(ValidationException::class) + fun validateAndBox(arg: Nothing?, configuration: SchemaConfiguration?): T } \ No newline at end of file diff --git a/src/main/resources/kotlin/src/main/kotlin/packagename/schemas/validation/NumberSchemaValidator.hbs b/src/main/resources/kotlin/src/main/kotlin/packagename/schemas/validation/NumberSchemaValidator.hbs index 63f4ac97158..a5225ad8f86 100644 --- a/src/main/resources/kotlin/src/main/kotlin/packagename/schemas/validation/NumberSchemaValidator.hbs +++ b/src/main/resources/kotlin/src/main/kotlin/packagename/schemas/validation/NumberSchemaValidator.hbs @@ -3,7 +3,10 @@ package {{{packageName}}}.schemas.validation; import {{{packageName}}}.configurations.SchemaConfiguration; import {{{packageName}}}.exceptions.ValidationException; -public interface NumberSchemaValidator { - Number validate(Number arg, SchemaConfiguration configuration) throws ValidationException; - T validateAndBox(Number arg, SchemaConfiguration configuration) throws ValidationException; +interface NumberSchemaValidator { + @Throws(ValidationException::class) + fun validate(arg: Number, configuration: SchemaConfiguration?): Number + + @Throws(ValidationException::class) + fun validateAndBox(arg: Number, configuration: SchemaConfiguration?): T } \ No newline at end of file diff --git a/src/main/resources/kotlin/src/main/kotlin/packagename/schemas/validation/StringSchemaValidator.hbs b/src/main/resources/kotlin/src/main/kotlin/packagename/schemas/validation/StringSchemaValidator.hbs index 30724ee6f48..c750ce2bdaa 100644 --- a/src/main/resources/kotlin/src/main/kotlin/packagename/schemas/validation/StringSchemaValidator.hbs +++ b/src/main/resources/kotlin/src/main/kotlin/packagename/schemas/validation/StringSchemaValidator.hbs @@ -3,7 +3,10 @@ package {{{packageName}}}.schemas.validation; import {{{packageName}}}.configurations.SchemaConfiguration; import {{{packageName}}}.exceptions.ValidationException; -public interface StringSchemaValidator { - String validate(String arg, SchemaConfiguration configuration) throws ValidationException; - T validateAndBox(String arg, SchemaConfiguration configuration) throws ValidationException; +interface StringSchemaValidator { + @Throws(ValidationException::class) + fun validate(arg: String, configuration: SchemaConfiguration?): String + + @Throws(ValidationException::class) + fun validateAndBox(arg: String, configuration: SchemaConfiguration?): T } \ No newline at end of file diff --git a/src/main/resources/kotlin/src/main/kotlin/packagename/schemas/validation/UnsetAnyTypeJsonSchema.hbs b/src/main/resources/kotlin/src/main/kotlin/packagename/schemas/validation/UnsetAnyTypeJsonSchema.hbs index 52b8187a0e2..380977e12f3 100644 --- a/src/main/resources/kotlin/src/main/kotlin/packagename/schemas/validation/UnsetAnyTypeJsonSchema.hbs +++ b/src/main/resources/kotlin/src/main/kotlin/packagename/schemas/validation/UnsetAnyTypeJsonSchema.hbs @@ -49,15 +49,15 @@ class UnsetAnyTypeJsonSchema { } } - class UnsetAnyTypeJsonSchema1 private constructor() : JsonSchema(JsonSchemaInfo()), - NullSchemaValidator, - BooleanSchemaValidator, - NumberSchemaValidator, - StringSchemaValidator, - ListSchemaValidator?, UnsetAnyTypeJsonSchema1BoxedList?>, - MapSchemaValidator?, UnsetAnyTypeJsonSchema1BoxedMap?> { + class UnsetAnyTypeJsonSchema1 private constructor() : JsonSchema(JsonSchemaInfo()), + NullSchemaValidator, + BooleanSchemaValidator, + NumberSchemaValidator, + StringSchemaValidator, + ListSchemaValidator, UnsetAnyTypeJsonSchema1BoxedList>, + MapSchemaValidator, UnsetAnyTypeJsonSchema1BoxedMap> { @Throws(ValidationException::class) - fun validate(arg: Nothing?, configuration: SchemaConfiguration?): Nothing? { + override fun validate(arg: Nothing?, configuration: SchemaConfiguration?): Nothing? { val pathSet: MutableSet> = HashSet() val pathToItem = listOf("args[0]") val castArg: Nothing? = castToAllowedTypes(arg, pathToItem, pathSet) @@ -70,7 +70,7 @@ class UnsetAnyTypeJsonSchema { } @Throws(ValidationException::class) - fun validate(arg: Boolean, configuration: SchemaConfiguration?): Boolean { + override fun validate(arg: Boolean, configuration: SchemaConfiguration?): Boolean { val pathSet: MutableSet> = HashSet() val pathToItem = listOf("args[0]") val castArg: Boolean = castToAllowedTypes(arg, pathToItem, pathSet) @@ -83,7 +83,7 @@ class UnsetAnyTypeJsonSchema { } @Throws(ValidationException::class) - fun validate(arg: Number, configuration: SchemaConfiguration?): Number { + override fun validate(arg: Number, configuration: SchemaConfiguration?): Number { val pathSet: MutableSet> = HashSet() val pathToItem = listOf("args[0]") val castArg: Number = castToAllowedTypes(arg, pathToItem, pathSet) @@ -116,7 +116,7 @@ class UnsetAnyTypeJsonSchema { } @Throws(ValidationException::class) - fun validate(arg: String, configuration: SchemaConfiguration?): String { + override fun validate(arg: String, configuration: SchemaConfiguration?): String { val pathSet: MutableSet> = HashSet() val pathToItem = listOf("args[0]") val castArg: String = castToAllowedTypes(arg, pathToItem, pathSet) @@ -143,7 +143,7 @@ class UnsetAnyTypeJsonSchema { return validate(arg.toString(), configuration) } - fun getNewInstance(arg: List<*>, pathToItem: List, pathToSchemas: PathToSchemasMap): FrozenList { + override fun getNewInstance(arg: List<*>, pathToItem: List, pathToSchemas: PathToSchemasMap): FrozenList { val items: MutableList = ArrayList() var i = 0 for (item in arg) { @@ -160,7 +160,7 @@ class UnsetAnyTypeJsonSchema { } @Throws(ValidationException::class) - fun validate(arg: List<*>, configuration: SchemaConfiguration?): FrozenList { + override fun validate(arg: List<*>, configuration: SchemaConfiguration?): FrozenList { val pathSet: MutableSet> = HashSet() val pathToItem = listOf("args[0]") val castArg: List<*> = castToAllowedTypes(arg, pathToItem, pathSet) @@ -172,7 +172,7 @@ class UnsetAnyTypeJsonSchema { return getNewInstance(castArg, validationMetadata.pathToItem, pathToSchemasMap) } - fun getNewInstance(arg: Map<*, *>, pathToItem: List, pathToSchemas: PathToSchemasMap): FrozenMap { + override fun getNewInstance(arg: Map<*, *>, pathToItem: List, pathToSchemas: PathToSchemasMap): FrozenMap { val properties = LinkedHashMap() for ((entryKey, value1) in arg) { if (entryKey !is String) { @@ -191,7 +191,7 @@ class UnsetAnyTypeJsonSchema { } @Throws(ValidationException::class) - fun validate(arg: Map<*, *>, configuration: SchemaConfiguration?): FrozenMap { + override fun validate(arg: Map<*, *>, configuration: SchemaConfiguration?): FrozenMap { val pathSet: MutableSet> = HashSet() val pathToItem = listOf("args[0]") val castArg: Map<*, *> = castToAllowedTypes(arg, pathToItem, pathSet) @@ -263,32 +263,32 @@ class UnsetAnyTypeJsonSchema { } @Throws(ValidationException::class) - fun validateAndBox(arg: Nothing?, configuration: SchemaConfiguration?): UnsetAnyTypeJsonSchema1BoxedVoid { + override fun validateAndBox(arg: Nothing?, configuration: SchemaConfiguration?): UnsetAnyTypeJsonSchema1BoxedVoid { return UnsetAnyTypeJsonSchema1BoxedVoid(validate(arg, configuration)) } @Throws(ValidationException::class) - fun validateAndBox(arg: Boolean, configuration: SchemaConfiguration?): UnsetAnyTypeJsonSchema1BoxedBoolean { + override fun validateAndBox(arg: Boolean, configuration: SchemaConfiguration?): UnsetAnyTypeJsonSchema1BoxedBoolean { return UnsetAnyTypeJsonSchema1BoxedBoolean(validate(arg, configuration)) } @Throws(ValidationException::class) - fun validateAndBox(arg: Number, configuration: SchemaConfiguration?): UnsetAnyTypeJsonSchema1BoxedNumber { + override fun validateAndBox(arg: Number, configuration: SchemaConfiguration?): UnsetAnyTypeJsonSchema1BoxedNumber { return UnsetAnyTypeJsonSchema1BoxedNumber(validate(arg, configuration)) } @Throws(ValidationException::class) - fun validateAndBox(arg: String, configuration: SchemaConfiguration?): UnsetAnyTypeJsonSchema1BoxedString { + override fun validateAndBox(arg: String, configuration: SchemaConfiguration?): UnsetAnyTypeJsonSchema1BoxedString { return UnsetAnyTypeJsonSchema1BoxedString(validate(arg, configuration)) } @Throws(ValidationException::class) - fun validateAndBox(arg: List<*>, configuration: SchemaConfiguration?): UnsetAnyTypeJsonSchema1BoxedList { + override fun validateAndBox(arg: List<*>, configuration: SchemaConfiguration?): UnsetAnyTypeJsonSchema1BoxedList { return UnsetAnyTypeJsonSchema1BoxedList(validate(arg, configuration)) } @Throws(ValidationException::class) - fun validateAndBox(arg: Map<*, *>, configuration: SchemaConfiguration?): UnsetAnyTypeJsonSchema1BoxedMap { + override fun validateAndBox(arg: Map<*, *>, configuration: SchemaConfiguration?): UnsetAnyTypeJsonSchema1BoxedMap { return UnsetAnyTypeJsonSchema1BoxedMap(validate(arg, configuration)) } From fb9dc332ddab3f436d3040964358fe2d805ac174 Mon Sep 17 00:00:00 2001 From: Justin Black Date: Tue, 7 May 2024 14:08:34 -0700 Subject: [PATCH 18/78] Updates type validator --- .../schemas/validation/TypeValidator.kt | 54 +++++++++---------- .../schemas/validation/TypeValidator.hbs | 52 +++++++++--------- 2 files changed, 53 insertions(+), 53 deletions(-) diff --git a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/schemas/validation/TypeValidator.kt b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/schemas/validation/TypeValidator.kt index 2bc9cd05e10..ab39b361b91 100644 --- a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/schemas/validation/TypeValidator.kt +++ b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/schemas/validation/TypeValidator.kt @@ -1,34 +1,34 @@ -package org.openapijsonschematools.client.schemas.validation; +package org.openapijsonschematools.client.schemas.validation -import org.checkerframework.checker.nullness.qual.Nullable; -import org.openapijsonschematools.client.exceptions.ValidationException; +import org.openapijsonschematools.client.exceptions.ValidationException -import java.util.List; -import java.util.Map; - -public class TypeValidator implements KeywordValidator { - @Override - public @Nullable PathToSchemasMap validate( - ValidationData data - ) throws ValidationException { - var type = data.schema().type; - if (type == null) { - return null; +class TypeValidator : KeywordValidator { + @Throws(ValidationException::class) + override fun validate( + data: ValidationData + ): PathToSchemasMap? { + if (data.schema.type == null) { + return null } - Class argClass; - var arg = data.arg(); - if (arg == null) { - argClass = Nothing?.class; - } else if (arg instanceof List) { - argClass = List.class; - } else if (arg instanceof Map) { - argClass = Map.class; - } else { - argClass = arg.getClass(); + val argClass = when (data.arg) { + null -> { + Void::class.java + } + is List<*> -> { + MutableList::class.java + } + + is Map<*, *> -> { + MutableMap::class.java + } + + else -> { + data.arg.javaClass + } } - if (!type.contains(argClass)) { - throw new ValidationException("invalid type"); + if (!data.schema.type.contains(argClass)) { + throw ValidationException("invalid type") } - return null; + return null } } diff --git a/src/main/resources/kotlin/src/main/kotlin/packagename/schemas/validation/TypeValidator.hbs b/src/main/resources/kotlin/src/main/kotlin/packagename/schemas/validation/TypeValidator.hbs index 7f4c27fa89f..c19ed0d810d 100644 --- a/src/main/resources/kotlin/src/main/kotlin/packagename/schemas/validation/TypeValidator.hbs +++ b/src/main/resources/kotlin/src/main/kotlin/packagename/schemas/validation/TypeValidator.hbs @@ -1,34 +1,34 @@ package {{{packageName}}}.schemas.validation; -import org.checkerframework.checker.nullness.qual.Nullable; import {{{packageName}}}.exceptions.ValidationException; -import java.util.List; -import java.util.Map; - -public class TypeValidator implements KeywordValidator { - @Override - public @Nullable PathToSchemasMap validate( - ValidationData data - ) throws ValidationException { - var type = data.schema().type; - if (type == null) { - return null; +class TypeValidator : KeywordValidator { + @Throws(ValidationException::class) + override fun validate( + data: ValidationData + ): PathToSchemasMap? { + if (data.schema.type == null) { + return null } - Class argClass; - var arg = data.arg(); - if (arg == null) { - argClass = Nothing?.class; - } else if (arg instanceof List) { - argClass = List.class; - } else if (arg instanceof Map) { - argClass = Map.class; - } else { - argClass = arg.getClass(); + val argClass = when (data.arg) { + null -> { + Void::class.java + } + is List<*> -> { + MutableList::class.java + } + + is Map<*, *> -> { + MutableMap::class.java + } + + else -> { + data.arg.javaClass + } } - if (!type.contains(argClass)) { - throw new ValidationException("invalid type"); + if (!data.schema.type.contains(argClass)) { + throw ValidationException("invalid type") } - return null; + return null } -} +} \ No newline at end of file From 8f3e822b7de0d16572e0ecd3fe4009357d495e63 Mon Sep 17 00:00:00 2001 From: Justin Black Date: Tue, 7 May 2024 14:49:23 -0700 Subject: [PATCH 19/78] Updates FormatValidator --- .../schemas/validation/CustomIsoparser.kt | 22 +- .../schemas/validation/FormatValidator.kt | 280 +++++++++--------- .../schemas/validation/CustomIsoparser.hbs | 16 +- .../schemas/validation/FormatValidator.hbs | 278 ++++++++--------- 4 files changed, 308 insertions(+), 288 deletions(-) diff --git a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/schemas/validation/CustomIsoparser.kt b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/schemas/validation/CustomIsoparser.kt index c4344d77bfe..0728ffd7151 100644 --- a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/schemas/validation/CustomIsoparser.kt +++ b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/schemas/validation/CustomIsoparser.kt @@ -1,16 +1,16 @@ -package org.openapijsonschematools.client.schemas.validation; +package org.openapijsonschematools.client.schemas.validation -import java.time.ZonedDateTime; -import java.time.LocalDate; +import java.time.LocalDate +import java.time.ZonedDateTime -public final class CustomIsoparser { +class CustomIsoparser { + companion object { + fun parseIsodatetime(dateTime: String): ZonedDateTime { + return ZonedDateTime.parse(dateTime) + } - public ZonedDateTime parseIsodatetime(String dateTime) { - return ZonedDateTime.parse(dateTime); + fun parseIsodate(date: String): LocalDate { + return LocalDate.parse(date) + } } - - public LocalDate parseIsodate(String date) { - return LocalDate.parse(date); - } - } \ No newline at end of file diff --git a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/schemas/validation/FormatValidator.kt b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/schemas/validation/FormatValidator.kt index 35c089a03c7..a9b86d4e635 100644 --- a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/schemas/validation/FormatValidator.kt +++ b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/schemas/validation/FormatValidator.kt @@ -1,158 +1,168 @@ -package org.openapijsonschematools.client.schemas.validation; +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.math.BigDecimal +import java.math.BigInteger +import java.time.format.DateTimeParseException +import java.util.UUID +import kotlin.math.floor -import java.math.BigDecimal; -import java.math.BigInteger; -import java.time.format.DateTimeParseException; -import java.util.UUID; +class FormatValidator : KeywordValidator { + @Throws(ValidationException::class) + override fun validate( + data: ValidationData + ): PathToSchemasMap? { + val format: String = data.schema.format ?: return null + if (data.arg is Number) { + validateNumericFormat( + data.arg, + data.validationMetadata, + format + ) + return null + } else if (data.arg is String) { + validateStringFormat( + data.arg, + data.validationMetadata, + format + ) + return null + } + return null + } -public class FormatValidator implements KeywordValidator { - private final static BigInteger int32InclusiveMinimum = BigInteger.valueOf(-2147483648L); - private final static BigInteger int32InclusiveMaximum = BigInteger.valueOf(2147483647L); - private final static BigInteger int64InclusiveMinimum = BigInteger.valueOf(-9223372036854775808L); - private final static BigInteger int64InclusiveMaximum = BigInteger.valueOf(9223372036854775807L); - private final static BigDecimal floatInclusiveMinimum = BigDecimal.valueOf(-3.4028234663852886e+38); - private final static BigDecimal floatInclusiveMaximum = BigDecimal.valueOf(3.4028234663852886e+38); - private final static BigDecimal doubleInclusiveMinimum = BigDecimal.valueOf(-1.7976931348623157E+308d); - private final static BigDecimal doubleInclusiveMaximum = BigDecimal.valueOf(1.7976931348623157E+308d); + companion object { + private val int32InclusiveMinimum = BigInteger.valueOf(-2147483648L) + private val int32InclusiveMaximum = BigInteger.valueOf(2147483647L) + private val int64InclusiveMinimum = BigInteger.valueOf(Long.MIN_VALUE) + private val int64InclusiveMaximum = BigInteger.valueOf(Long.MAX_VALUE) + private val floatInclusiveMinimum = BigDecimal.valueOf(-3.4028234663852886e+38) + private val floatInclusiveMaximum = BigDecimal.valueOf(3.4028234663852886e+38) + private val doubleInclusiveMinimum = BigDecimal.valueOf(-1.7976931348623157E+308) + private val doubleInclusiveMaximum = BigDecimal.valueOf(1.7976931348623157E+308) + @Throws(ValidationException::class) + private fun validateNumericFormat(arg: Number, validationMetadata: ValidationMetadata, format: String) { + if (format.startsWith("int")) { + // there is a json schema test where 1.0 validates as an integer + val intArg: BigInteger + when (arg) { + is Float, is Double -> { + val doubleArg: Double = (arg as? Float)?.toDouble() ?: arg as Double + if (floor(doubleArg) != doubleArg) { + throw ValidationException( + "Invalid non-integer value " + arg + " for format " + format + " at " + validationMetadata.pathToItem + ) + } + intArg = if (arg is Float) { + val smallInt = Math.round(arg) + BigInteger.valueOf(smallInt.toLong()) + } else { + BigInteger.valueOf(Math.round((arg as Double))) + } + } - 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; - if (arg instanceof Float || arg instanceof Double) { - double doubleArg; - if (arg instanceof Float) { - doubleArg = arg.doubleValue(); - } else { - doubleArg = (Double) arg; - } - if (Math.floor(doubleArg) != doubleArg) { - throw new ValidationException( - "Invalid non-integer value " + arg + " for format " + format + " at " + validationMetadata.pathToItem() - ); - } - if (arg instanceof Float) { - Integer smallInt = Math.round((Float) arg); - intArg = BigInteger.valueOf(smallInt.longValue()); - } else { - intArg = BigInteger.valueOf(Math.round((Double) arg)); - } - } else if (arg instanceof Integer) { - intArg = BigInteger.valueOf(arg.longValue()); - } else if (arg instanceof Long) { - intArg = BigInteger.valueOf((Long) arg); - } else { - intArg = (BigInteger) arg; - } - if (format.equals("int32")) { - if (intArg.compareTo(int32InclusiveMinimum) < 0 || intArg.compareTo(int32InclusiveMaximum) > 0) { - throw new ValidationException( - "Invalid value " + arg + " for format int32 at " + validationMetadata.pathToItem() - ); + is Int -> { + intArg = BigInteger.valueOf(arg.toLong()) + } + + is Long -> { + intArg = BigInteger.valueOf(arg) + } + + else -> { + intArg = arg as BigInteger + } } - } else if (format.equals("int64")) { - if (intArg.compareTo(int64InclusiveMinimum) < 0 || intArg.compareTo(int64InclusiveMaximum) > 0) { - throw new ValidationException( - "Invalid value " + arg + " for format int64 at " + validationMetadata.pathToItem() - ); + if (format == "int32") { + if (intArg.compareTo(int32InclusiveMinimum) < 0 || intArg.compareTo(int32InclusiveMaximum) > 0) { + throw ValidationException( + "Invalid value " + arg + " for format int32 at " + validationMetadata.pathToItem + ) + } + } else if (format == "int64") { + if (intArg.compareTo(int64InclusiveMinimum) < 0 || intArg.compareTo(int64InclusiveMaximum) > 0) { + throw ValidationException( + "Invalid value " + arg + " for format int64 at " + validationMetadata.pathToItem + ) + } } - } - } else if (format.equals("float") || format.equals("double")) { - BigDecimal decimalArg; - if (arg instanceof Float) { - decimalArg = BigDecimal.valueOf(arg.doubleValue()); - } else if (arg instanceof Double) { - decimalArg = BigDecimal.valueOf((Double) arg); - } else { - decimalArg = (BigDecimal) arg; - } - if (format.equals("float")) { - if (decimalArg.compareTo(floatInclusiveMinimum) < 0 || decimalArg.compareTo(floatInclusiveMaximum) > 0 ){ - throw new ValidationException( - "Invalid value "+arg+" for format float at "+validationMetadata.pathToItem() - ); + } else if (format == "float" || format == "double") { + val decimalArg: BigDecimal = when (arg) { + is Float -> { + BigDecimal.valueOf(arg.toDouble()) + } + + is Double -> { + BigDecimal.valueOf(arg) + } + + else -> { + arg as BigDecimal + } } - } else { - if (decimalArg.compareTo(doubleInclusiveMinimum) < 0 || decimalArg.compareTo(doubleInclusiveMaximum) > 0 ){ - throw new ValidationException( - "Invalid value "+arg+" for format double at "+validationMetadata.pathToItem() - ); + if (format == "float") { + if (decimalArg.compareTo(floatInclusiveMinimum) < 0 || decimalArg.compareTo(floatInclusiveMaximum) > 0) { + throw ValidationException( + "Invalid value " + arg + " for format float at " + validationMetadata.pathToItem + ) + } + } else { + if (decimalArg.compareTo(doubleInclusiveMinimum) < 0 || decimalArg.compareTo(doubleInclusiveMaximum) > 0) { + throw ValidationException( + "Invalid value " + arg + " for format double at " + validationMetadata.pathToItem + ) + } } } } - } - private static void validateStringFormat(String arg, ValidationMetadata validationMetadata, String format) throws ValidationException { - switch (format) { - case "uuid" -> { - try { - UUID.fromString(arg); - } catch (IllegalArgumentException e) { - throw new ValidationException( + @Throws(ValidationException::class) + private fun validateStringFormat(arg: String, validationMetadata: ValidationMetadata, format: String) { + when (format) { + "uuid" -> { + try { + UUID.fromString(arg) + } catch (e: IllegalArgumentException) { + throw ValidationException( "Value cannot be converted to a UUID. Invalid value " + - arg + " for format uuid at " + validationMetadata.pathToItem() - ); + arg + " for format uuid at " + validationMetadata.pathToItem + ) + } } - } - case "number" -> { - try { - new BigDecimal(arg); - } catch (NumberFormatException e) { - throw new ValidationException( + + "number" -> { + try { + BigDecimal(arg) + } catch (e: NumberFormatException) { + throw ValidationException( "Value cannot be converted to a decimal. Invalid value " + - arg + " for format number at " + validationMetadata.pathToItem() - ); + arg + " for format number at " + validationMetadata.pathToItem + ) + } } - } - case "date" -> { - try { - new CustomIsoparser().parseIsodate(arg); - } catch (DateTimeParseException e) { - throw new ValidationException( + + "date" -> { + try { + CustomIsoparser.parseIsodate(arg) + } catch (e: DateTimeParseException) { + throw ValidationException( "Value does not conform to the required ISO-8601 date format. " + - "Invalid value " + arg + " for format date at " + validationMetadata.pathToItem() - ); + "Invalid value " + arg + " for format date at " + validationMetadata.pathToItem + ) + } } - } - case "date-time" -> { - try { - new CustomIsoparser().parseIsodatetime(arg); - } catch (DateTimeParseException e) { - throw new ValidationException( + + "date-time" -> { + try { + CustomIsoparser.parseIsodatetime(arg) + } catch (e: DateTimeParseException) { + throw ValidationException( "Value does not conform to the required ISO-8601 datetime format. " + - "Invalid value " + arg + " for format datetime at " + validationMetadata.pathToItem() - ); + "Invalid value " + arg + " for format datetime at " + validationMetadata.pathToItem + ) + } } } } } - - @Override - public @Nullable PathToSchemasMap validate( - ValidationData data - ) throws ValidationException { - var format = data.schema().format; - if (format == null) { - return null; - } - if (data.arg() instanceof Number numberArg) { - validateNumericFormat( - numberArg, - data.validationMetadata(), - format - ); - return null; - } else if (data.arg() instanceof String stringArg) { - validateStringFormat( - stringArg, - data.validationMetadata(), - format - ); - return null; - } - return null; - } } diff --git a/src/main/resources/kotlin/src/main/kotlin/packagename/schemas/validation/CustomIsoparser.hbs b/src/main/resources/kotlin/src/main/kotlin/packagename/schemas/validation/CustomIsoparser.hbs index ab111822f9f..0594d8e577a 100644 --- a/src/main/resources/kotlin/src/main/kotlin/packagename/schemas/validation/CustomIsoparser.hbs +++ b/src/main/resources/kotlin/src/main/kotlin/packagename/schemas/validation/CustomIsoparser.hbs @@ -3,14 +3,14 @@ package {{{packageName}}}.schemas.validation; import java.time.ZonedDateTime; import java.time.LocalDate; -public final class CustomIsoparser { +class CustomIsoparser { + companion object { + fun parseIsodatetime(dateTime: String): ZonedDateTime { + return ZonedDateTime.parse(dateTime) + } - public ZonedDateTime parseIsodatetime(String dateTime) { - return ZonedDateTime.parse(dateTime); + fun parseIsodate(date: String): LocalDate { + return LocalDate.parse(date) + } } - - public LocalDate parseIsodate(String date) { - return LocalDate.parse(date); - } - } \ No newline at end of file diff --git a/src/main/resources/kotlin/src/main/kotlin/packagename/schemas/validation/FormatValidator.hbs b/src/main/resources/kotlin/src/main/kotlin/packagename/schemas/validation/FormatValidator.hbs index 282a9516a6a..a1b8d7f6123 100644 --- a/src/main/resources/kotlin/src/main/kotlin/packagename/schemas/validation/FormatValidator.hbs +++ b/src/main/resources/kotlin/src/main/kotlin/packagename/schemas/validation/FormatValidator.hbs @@ -1,158 +1,168 @@ package {{{packageName}}}.schemas.validation; import {{{packageName}}}.exceptions.ValidationException; -import org.checkerframework.checker.nullness.qual.Nullable; +import java.math.BigDecimal +import java.math.BigInteger +import java.time.format.DateTimeParseException +import java.util.UUID +import kotlin.math.floor -import java.math.BigDecimal; -import java.math.BigInteger; -import java.time.format.DateTimeParseException; -import java.util.UUID; +class FormatValidator : KeywordValidator { + @Throws(ValidationException::class) + override fun validate( + data: ValidationData + ): PathToSchemasMap? { + val format: String = data.schema.format ?: return null + if (data.arg is Number) { + validateNumericFormat( + data.arg, + data.validationMetadata, + format + ) + return null + } else if (data.arg is String) { + validateStringFormat( + data.arg, + data.validationMetadata, + format + ) + return null + } + return null + } -public class FormatValidator implements KeywordValidator { - private final static BigInteger int32InclusiveMinimum = BigInteger.valueOf(-2147483648L); - private final static BigInteger int32InclusiveMaximum = BigInteger.valueOf(2147483647L); - private final static BigInteger int64InclusiveMinimum = BigInteger.valueOf(-9223372036854775808L); - private final static BigInteger int64InclusiveMaximum = BigInteger.valueOf(9223372036854775807L); - private final static BigDecimal floatInclusiveMinimum = BigDecimal.valueOf(-3.4028234663852886e+38); - private final static BigDecimal floatInclusiveMaximum = BigDecimal.valueOf(3.4028234663852886e+38); - private final static BigDecimal doubleInclusiveMinimum = BigDecimal.valueOf(-1.7976931348623157E+308d); - private final static BigDecimal doubleInclusiveMaximum = BigDecimal.valueOf(1.7976931348623157E+308d); + companion object { + private val int32InclusiveMinimum = BigInteger.valueOf(-2147483648L) + private val int32InclusiveMaximum = BigInteger.valueOf(2147483647L) + private val int64InclusiveMinimum = BigInteger.valueOf(Long.MIN_VALUE) + private val int64InclusiveMaximum = BigInteger.valueOf(Long.MAX_VALUE) + private val floatInclusiveMinimum = BigDecimal.valueOf(-3.4028234663852886e+38) + private val floatInclusiveMaximum = BigDecimal.valueOf(3.4028234663852886e+38) + private val doubleInclusiveMinimum = BigDecimal.valueOf(-1.7976931348623157E+308) + private val doubleInclusiveMaximum = BigDecimal.valueOf(1.7976931348623157E+308) + @Throws(ValidationException::class) + private fun validateNumericFormat(arg: Number, validationMetadata: ValidationMetadata, format: String) { + if (format.startsWith("int")) { + // there is a json schema test where 1.0 validates as an integer + val intArg: BigInteger + when (arg) { + is Float, is Double -> { + val doubleArg: Double = (arg as? Float)?.toDouble() ?: arg as Double + if (floor(doubleArg) != doubleArg) { + throw ValidationException( + "Invalid non-integer value " + arg + " for format " + format + " at " + validationMetadata.pathToItem + ) + } + intArg = if (arg is Float) { + val smallInt = Math.round(arg) + BigInteger.valueOf(smallInt.toLong()) + } else { + BigInteger.valueOf(Math.round((arg as Double))) + } + } - 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; - if (arg instanceof Float || arg instanceof Double) { - double doubleArg; - if (arg instanceof Float) { - doubleArg = arg.doubleValue(); - } else { - doubleArg = (Double) arg; - } - if (Math.floor(doubleArg) != doubleArg) { - throw new ValidationException( - "Invalid non-integer value " + arg + " for format " + format + " at " + validationMetadata.pathToItem() - ); - } - if (arg instanceof Float) { - Integer smallInt = Math.round((Float) arg); - intArg = BigInteger.valueOf(smallInt.longValue()); - } else { - intArg = BigInteger.valueOf(Math.round((Double) arg)); - } - } else if (arg instanceof Integer) { - intArg = BigInteger.valueOf(arg.longValue()); - } else if (arg instanceof Long) { - intArg = BigInteger.valueOf((Long) arg); - } else { - intArg = (BigInteger) arg; - } - if (format.equals("int32")) { - if (intArg.compareTo(int32InclusiveMinimum) < 0 || intArg.compareTo(int32InclusiveMaximum) > 0) { - throw new ValidationException( - "Invalid value " + arg + " for format int32 at " + validationMetadata.pathToItem() - ); + is Int -> { + intArg = BigInteger.valueOf(arg.toLong()) + } + + is Long -> { + intArg = BigInteger.valueOf(arg) + } + + else -> { + intArg = arg as BigInteger + } } - } else if (format.equals("int64")) { - if (intArg.compareTo(int64InclusiveMinimum) < 0 || intArg.compareTo(int64InclusiveMaximum) > 0) { - throw new ValidationException( - "Invalid value " + arg + " for format int64 at " + validationMetadata.pathToItem() - ); + if (format == "int32") { + if (intArg.compareTo(int32InclusiveMinimum) < 0 || intArg.compareTo(int32InclusiveMaximum) > 0) { + throw ValidationException( + "Invalid value " + arg + " for format int32 at " + validationMetadata.pathToItem + ) + } + } else if (format == "int64") { + if (intArg.compareTo(int64InclusiveMinimum) < 0 || intArg.compareTo(int64InclusiveMaximum) > 0) { + throw ValidationException( + "Invalid value " + arg + " for format int64 at " + validationMetadata.pathToItem + ) + } } - } - } else if (format.equals("float") || format.equals("double")) { - BigDecimal decimalArg; - if (arg instanceof Float) { - decimalArg = BigDecimal.valueOf(arg.doubleValue()); - } else if (arg instanceof Double) { - decimalArg = BigDecimal.valueOf((Double) arg); - } else { - decimalArg = (BigDecimal) arg; - } - if (format.equals("float")) { - if (decimalArg.compareTo(floatInclusiveMinimum) < 0 || decimalArg.compareTo(floatInclusiveMaximum) > 0 ){ - throw new ValidationException( - "Invalid value "+arg+" for format float at "+validationMetadata.pathToItem() - ); + } else if (format == "float" || format == "double") { + val decimalArg: BigDecimal = when (arg) { + is Float -> { + BigDecimal.valueOf(arg.toDouble()) + } + + is Double -> { + BigDecimal.valueOf(arg) + } + + else -> { + arg as BigDecimal + } } - } else { - if (decimalArg.compareTo(doubleInclusiveMinimum) < 0 || decimalArg.compareTo(doubleInclusiveMaximum) > 0 ){ - throw new ValidationException( - "Invalid value "+arg+" for format double at "+validationMetadata.pathToItem() - ); + if (format == "float") { + if (decimalArg.compareTo(floatInclusiveMinimum) < 0 || decimalArg.compareTo(floatInclusiveMaximum) > 0) { + throw ValidationException( + "Invalid value " + arg + " for format float at " + validationMetadata.pathToItem + ) + } + } else { + if (decimalArg.compareTo(doubleInclusiveMinimum) < 0 || decimalArg.compareTo(doubleInclusiveMaximum) > 0) { + throw ValidationException( + "Invalid value " + arg + " for format double at " + validationMetadata.pathToItem + ) + } } } } - } - private static void validateStringFormat(String arg, ValidationMetadata validationMetadata, String format) throws ValidationException { - switch (format) { - case "uuid" -> { - try { - UUID.fromString(arg); - } catch (IllegalArgumentException e) { - throw new ValidationException( + @Throws(ValidationException::class) + private fun validateStringFormat(arg: String, validationMetadata: ValidationMetadata, format: String) { + when (format) { + "uuid" -> { + try { + UUID.fromString(arg) + } catch (e: IllegalArgumentException) { + throw ValidationException( "Value cannot be converted to a UUID. Invalid value " + - arg + " for format uuid at " + validationMetadata.pathToItem() - ); + arg + " for format uuid at " + validationMetadata.pathToItem + ) + } } - } - case "number" -> { - try { - new BigDecimal(arg); - } catch (NumberFormatException e) { - throw new ValidationException( + + "number" -> { + try { + BigDecimal(arg) + } catch (e: NumberFormatException) { + throw ValidationException( "Value cannot be converted to a decimal. Invalid value " + - arg + " for format number at " + validationMetadata.pathToItem() - ); + arg + " for format number at " + validationMetadata.pathToItem + ) + } } - } - case "date" -> { - try { - new CustomIsoparser().parseIsodate(arg); - } catch (DateTimeParseException e) { - throw new ValidationException( + + "date" -> { + try { + CustomIsoparser.parseIsodate(arg) + } catch (e: DateTimeParseException) { + throw ValidationException( "Value does not conform to the required ISO-8601 date format. " + - "Invalid value " + arg + " for format date at " + validationMetadata.pathToItem() - ); + "Invalid value " + arg + " for format date at " + validationMetadata.pathToItem + ) + } } - } - case "date-time" -> { - try { - new CustomIsoparser().parseIsodatetime(arg); - } catch (DateTimeParseException e) { - throw new ValidationException( + + "date-time" -> { + try { + CustomIsoparser.parseIsodatetime(arg) + } catch (e: DateTimeParseException) { + throw ValidationException( "Value does not conform to the required ISO-8601 datetime format. " + - "Invalid value " + arg + " for format datetime at " + validationMetadata.pathToItem() - ); + "Invalid value " + arg + " for format datetime at " + validationMetadata.pathToItem + ) + } } } } } - - @Override - public @Nullable PathToSchemasMap validate( - ValidationData data - ) throws ValidationException { - var format = data.schema().format; - if (format == null) { - return null; - } - if (data.arg() instanceof Number numberArg) { - validateNumericFormat( - numberArg, - data.validationMetadata(), - format - ); - return null; - } else if (data.arg() instanceof String stringArg) { - validateStringFormat( - stringArg, - data.validationMetadata(), - format - ); - return null; - } - return null; - } -} +} \ No newline at end of file From bd8bed43670955ac27d0250cecd890c6caf1ad83 Mon Sep 17 00:00:00 2001 From: Justin Black Date: Wed, 8 May 2024 09:27:43 -0700 Subject: [PATCH 20/78] Updates ItemsValidator --- .../schemas/validation/ItemsValidator.kt | 63 +++++++++---------- .../schemas/validation/ItemsValidator.hbs | 59 ++++++++--------- 2 files changed, 54 insertions(+), 68 deletions(-) diff --git a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/schemas/validation/ItemsValidator.kt b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/schemas/validation/ItemsValidator.kt index 68d62107337..b4f7e9b9a77 100644 --- a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/schemas/validation/ItemsValidator.kt +++ b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/schemas/validation/ItemsValidator.kt @@ -1,45 +1,38 @@ -package org.openapijsonschematools.client.schemas.validation; +package org.openapijsonschematools.client.schemas.validation -import org.checkerframework.checker.nullness.qual.Nullable; -import org.openapijsonschematools.client.exceptions.ValidationException; +import org.openapijsonschematools.client.exceptions.ValidationException -import java.util.ArrayList; -import java.util.List; - -public class ItemsValidator implements KeywordValidator { - @Override - public @Nullable PathToSchemasMap validate( - ValidationData data - ) throws ValidationException { - var items = data.schema().items; - if (items == null) { - return null; - } - if (!(data.arg() instanceof List listArg)) { - return null; +class ItemsValidator : KeywordValidator { + @Throws(ValidationException::class) + override fun validate( + data: ValidationData + ): PathToSchemasMap? { + val items: Class> = data.schema.items ?: return null + if (data.arg !is List<*>) { + return null } - if (listArg.isEmpty()) { - return null; + if (data.arg.isEmpty()) { + return null } - PathToSchemasMap pathToSchemas = new PathToSchemasMap(); - int minIndex = data.schema().prefixItems != null ? data.schema().prefixItems.size() : 0; - JsonSchema itemsSchema = JsonSchemaFactory.getInstance(items); - for(int i = minIndex; i < listArg.size(); i++) { - List itemPathToItem = new ArrayList<>(data.validationMetadata().pathToItem()); - itemPathToItem.add(i); - ValidationMetadata itemValidationMetadata = new ValidationMetadata( - itemPathToItem, - data.validationMetadata().configuration(), - data.validationMetadata().validatedPathToSchemas(), - data.validationMetadata().seenClasses() - ); + val pathToSchemas = PathToSchemasMap() + val minIndex = if (data.schema.prefixItems != null) data.schema.prefixItems.size else 0 + val itemsSchema = JsonSchemaFactory.getInstance(items) + for (i in minIndex until data.arg.size) { + val itemPathToItem: MutableList = ArrayList(data.validationMetadata.pathToItem) + itemPathToItem.add(i) + val itemValidationMetadata = ValidationMetadata( + itemPathToItem, + data.validationMetadata.configuration, + data.validationMetadata.validatedPathToSchemas, + data.validationMetadata.seenClasses + ) if (itemValidationMetadata.validationRanEarlier(itemsSchema)) { // todo add_deeper_validated_schemas - continue; + continue } - PathToSchemasMap otherPathToSchemas = JsonSchema.validate(itemsSchema, listArg.get(i), itemValidationMetadata); - pathToSchemas.update(otherPathToSchemas); + val otherPathToSchemas = JsonSchema.validate(itemsSchema, data.arg[i], itemValidationMetadata) + pathToSchemas.update(otherPathToSchemas) } - return pathToSchemas; + return pathToSchemas } } diff --git a/src/main/resources/kotlin/src/main/kotlin/packagename/schemas/validation/ItemsValidator.hbs b/src/main/resources/kotlin/src/main/kotlin/packagename/schemas/validation/ItemsValidator.hbs index 314bb5ee2dc..b54a521b09d 100644 --- a/src/main/resources/kotlin/src/main/kotlin/packagename/schemas/validation/ItemsValidator.hbs +++ b/src/main/resources/kotlin/src/main/kotlin/packagename/schemas/validation/ItemsValidator.hbs @@ -1,45 +1,38 @@ package {{{packageName}}}.schemas.validation; -import org.checkerframework.checker.nullness.qual.Nullable; import {{{packageName}}}.exceptions.ValidationException; -import java.util.ArrayList; -import java.util.List; - -public class ItemsValidator implements KeywordValidator { - @Override - public @Nullable PathToSchemasMap validate( - ValidationData data - ) throws ValidationException { - var items = data.schema().items; - if (items == null) { - return null; - } - if (!(data.arg() instanceof List listArg)) { - return null; +class ItemsValidator : KeywordValidator { + @Throws(ValidationException::class) + override fun validate( + data: ValidationData + ): PathToSchemasMap? { + val items: Class> = data.schema.items ?: return null + if (data.arg !is List<*>) { + return null } - if (listArg.isEmpty()) { - return null; + if (data.arg.isEmpty()) { + return null } - PathToSchemasMap pathToSchemas = new PathToSchemasMap(); - int minIndex = data.schema().prefixItems != null ? data.schema().prefixItems.size() : 0; - JsonSchema itemsSchema = JsonSchemaFactory.getInstance(items); - for(int i = minIndex; i < listArg.size(); i++) { - List itemPathToItem = new ArrayList<>(data.validationMetadata().pathToItem()); - itemPathToItem.add(i); - ValidationMetadata itemValidationMetadata = new ValidationMetadata( - itemPathToItem, - data.validationMetadata().configuration(), - data.validationMetadata().validatedPathToSchemas(), - data.validationMetadata().seenClasses() - ); + val pathToSchemas = PathToSchemasMap() + val minIndex = if (data.schema.prefixItems != null) data.schema.prefixItems.size else 0 + val itemsSchema = JsonSchemaFactory.getInstance(items) + for (i in minIndex until data.arg.size) { + val itemPathToItem: MutableList = ArrayList(data.validationMetadata.pathToItem) + itemPathToItem.add(i) + val itemValidationMetadata = ValidationMetadata( + itemPathToItem, + data.validationMetadata.configuration, + data.validationMetadata.validatedPathToSchemas, + data.validationMetadata.seenClasses + ) if (itemValidationMetadata.validationRanEarlier(itemsSchema)) { // todo add_deeper_validated_schemas - continue; + continue } - PathToSchemasMap otherPathToSchemas = JsonSchema.validate(itemsSchema, listArg.get(i), itemValidationMetadata); - pathToSchemas.update(otherPathToSchemas); + val otherPathToSchemas = JsonSchema.validate(itemsSchema, data.arg[i], itemValidationMetadata) + pathToSchemas.update(otherPathToSchemas) } - return pathToSchemas; + return pathToSchemas } } From 05a77b9a54c556db10c285bb7a1861c7c1cc1dae Mon Sep 17 00:00:00 2001 From: Justin Black Date: Wed, 8 May 2024 10:32:59 -0700 Subject: [PATCH 21/78] Updates RequiredValidator --- .../schemas/validation/PropertiesValidator.kt | 74 ++++++++----------- .../schemas/validation/RequiredValidator.kt | 55 ++++++-------- .../validation/PropertiesValidator.hbs | 70 ++++++++---------- .../schemas/validation/RequiredValidator.hbs | 51 ++++++------- 4 files changed, 104 insertions(+), 146 deletions(-) diff --git a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/schemas/validation/PropertiesValidator.kt b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/schemas/validation/PropertiesValidator.kt index 8803b661fd6..93cb2bcb320 100644 --- a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/schemas/validation/PropertiesValidator.kt +++ b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/schemas/validation/PropertiesValidator.kt @@ -1,56 +1,44 @@ -package org.openapijsonschematools.client.schemas.validation; +package org.openapijsonschematools.client.schemas.validation -import org.checkerframework.checker.nullness.qual.Nullable; -import org.openapijsonschematools.client.exceptions.ValidationException; +import org.openapijsonschematools.client.exceptions.ValidationException -import java.util.ArrayList; -import java.util.LinkedHashSet; -import java.util.List; -import java.util.Map; -import java.util.Set; - -public class PropertiesValidator implements KeywordValidator { - @Override - public @Nullable PathToSchemasMap validate( - ValidationData data - ) throws ValidationException { - var properties = data.schema().properties; - if (properties == null) { - return null; - } - if (!(data.arg() instanceof Map mapArg)) { - return null; +class PropertiesValidator : KeywordValidator { + @Throws(ValidationException::class) + override fun validate( + data: ValidationData + ): PathToSchemasMap? { + val properties: Map>> = data.schema.properties ?: return null + if (data.arg !is Map<*, *>) { + return null } - PathToSchemasMap pathToSchemas = new PathToSchemasMap(); - Set presentProperties = new LinkedHashSet<>(); - for (Object key: mapArg.keySet()) { - if (key instanceof String) { - presentProperties.add((String) key); + val pathToSchemas = PathToSchemasMap() + val presentProperties: MutableSet = LinkedHashSet() + for (key in data.arg.keys) { + if (key is String) { + presentProperties.add(key) } } - for(Map.Entry>> entry: properties.entrySet()) { - String propName = entry.getKey(); + for ((propName, propClass) in properties.entries) { if (!presentProperties.contains(propName)) { - continue; + continue } - @Nullable Object propValue = mapArg.get(propName); - List propPathToItem = new ArrayList<>(data.validationMetadata().pathToItem()); - propPathToItem.add(propName); - ValidationMetadata propValidationMetadata = new ValidationMetadata( - propPathToItem, - data.validationMetadata().configuration(), - data.validationMetadata().validatedPathToSchemas(), - data.validationMetadata().seenClasses() - ); - Class> propClass = entry.getValue(); - JsonSchema propSchema = JsonSchemaFactory.getInstance(propClass); + val propValue: Any? = data.arg[propName] + val propPathToItem: MutableList = ArrayList(data.validationMetadata.pathToItem) + propPathToItem.add(propName) + val propValidationMetadata = ValidationMetadata( + propPathToItem, + data.validationMetadata.configuration, + data.validationMetadata.validatedPathToSchemas, + data.validationMetadata.seenClasses + ) + val propSchema = JsonSchemaFactory.getInstance(propClass) if (propValidationMetadata.validationRanEarlier(propSchema)) { // todo add_deeper_validated_schemas - continue; + continue } - PathToSchemasMap otherPathToSchemas = JsonSchema.validate(propSchema, propValue, propValidationMetadata); - pathToSchemas.update(otherPathToSchemas); + val otherPathToSchemas = JsonSchema.validate(propSchema, propValue, propValidationMetadata) + pathToSchemas.update(otherPathToSchemas) } - return pathToSchemas; + return pathToSchemas } } diff --git a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/schemas/validation/RequiredValidator.kt b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/schemas/validation/RequiredValidator.kt index 2519cbcfd3b..d2ac79c82d7 100644 --- a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/schemas/validation/RequiredValidator.kt +++ b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/schemas/validation/RequiredValidator.kt @@ -1,41 +1,32 @@ -package org.openapijsonschematools.client.schemas.validation; +package org.openapijsonschematools.client.schemas.validation -import org.checkerframework.checker.nullness.qual.Nullable; -import org.openapijsonschematools.client.exceptions.ValidationException; +import org.openapijsonschematools.client.exceptions.ValidationException -import java.util.HashSet; -import java.util.List; -import java.util.Map; -import java.util.Set; - -public class RequiredValidator implements KeywordValidator { - @Override - public @Nullable PathToSchemasMap validate( - ValidationData data - ) throws ValidationException { - var required = data.schema().required; - if (required == null) { - return null; - } - if (!(data.arg() instanceof Map mapArg)) { - return null; +class RequiredValidator : KeywordValidator { + @Throws(ValidationException::class) + override fun validate( + data: ValidationData + ): PathToSchemasMap? { + val required: Set = data.schema.required ?: return null + if (data.arg !is Map<*, *>) { + return null } - Set missingRequiredProperties = new HashSet<>(required); - for (Object key: mapArg.keySet()) { - if (key instanceof String) { - missingRequiredProperties.remove(key); + val missingRequiredProperties: MutableSet = HashSet(required) + for (key in data.arg.keys) { + if (key is String) { + missingRequiredProperties.remove(key) } } - if (!missingRequiredProperties.isEmpty()) { - List missingReqProps = missingRequiredProperties.stream().sorted().toList(); - String pluralChar = ""; - if (missingRequiredProperties.size() > 1) { - pluralChar = "s"; + if (missingRequiredProperties.isNotEmpty()) { + val missingReqProps: List = missingRequiredProperties.toList().sorted() + var pluralChar = "" + if (missingRequiredProperties.size > 1) { + pluralChar = "s" } - throw new ValidationException( - data.schema().getClass()+" is missing "+missingRequiredProperties.size()+" required argument"+pluralChar+": "+missingReqProps - ); + throw ValidationException( + data.schema.javaClass.simpleName + " is missing " + missingRequiredProperties.size + " required argument" + pluralChar + ": " + missingReqProps + ) } - return null; + return null } } diff --git a/src/main/resources/kotlin/src/main/kotlin/packagename/schemas/validation/PropertiesValidator.hbs b/src/main/resources/kotlin/src/main/kotlin/packagename/schemas/validation/PropertiesValidator.hbs index f339a2b52e5..606b77c3959 100644 --- a/src/main/resources/kotlin/src/main/kotlin/packagename/schemas/validation/PropertiesValidator.hbs +++ b/src/main/resources/kotlin/src/main/kotlin/packagename/schemas/validation/PropertiesValidator.hbs @@ -1,56 +1,44 @@ package {{{packageName}}}.schemas.validation; -import org.checkerframework.checker.nullness.qual.Nullable; import {{{packageName}}}.exceptions.ValidationException; -import java.util.ArrayList; -import java.util.LinkedHashSet; -import java.util.List; -import java.util.Map; -import java.util.Set; - -public class PropertiesValidator implements KeywordValidator { - @Override - public @Nullable PathToSchemasMap validate( - ValidationData data - ) throws ValidationException { - var properties = data.schema().properties; - if (properties == null) { - return null; - } - if (!(data.arg() instanceof Map mapArg)) { - return null; +class PropertiesValidator : KeywordValidator { + @Throws(ValidationException::class) + override fun validate( + data: ValidationData + ): PathToSchemasMap? { + val properties: Map>> = data.schema.properties ?: return null + if (data.arg !is Map<*, *>) { + return null } - PathToSchemasMap pathToSchemas = new PathToSchemasMap(); - Set presentProperties = new LinkedHashSet<>(); - for (Object key: mapArg.keySet()) { - if (key instanceof String) { - presentProperties.add((String) key); + val pathToSchemas = PathToSchemasMap() + val presentProperties: MutableSet = LinkedHashSet() + for (key in data.arg.keys) { + if (key is String) { + presentProperties.add(key) } } - for(Map.Entry>> entry: properties.entrySet()) { - String propName = entry.getKey(); + for ((propName, propClass) in properties.entries) { if (!presentProperties.contains(propName)) { - continue; + continue } - @Nullable Object propValue = mapArg.get(propName); - List propPathToItem = new ArrayList<>(data.validationMetadata().pathToItem()); - propPathToItem.add(propName); - ValidationMetadata propValidationMetadata = new ValidationMetadata( - propPathToItem, - data.validationMetadata().configuration(), - data.validationMetadata().validatedPathToSchemas(), - data.validationMetadata().seenClasses() - ); - Class> propClass = entry.getValue(); - JsonSchema propSchema = JsonSchemaFactory.getInstance(propClass); + val propValue: Any? = data.arg[propName] + val propPathToItem: MutableList = ArrayList(data.validationMetadata.pathToItem) + propPathToItem.add(propName) + val propValidationMetadata = ValidationMetadata( + propPathToItem, + data.validationMetadata.configuration, + data.validationMetadata.validatedPathToSchemas, + data.validationMetadata.seenClasses + ) + val propSchema = JsonSchemaFactory.getInstance(propClass) if (propValidationMetadata.validationRanEarlier(propSchema)) { // todo add_deeper_validated_schemas - continue; + continue } - PathToSchemasMap otherPathToSchemas = JsonSchema.validate(propSchema, propValue, propValidationMetadata); - pathToSchemas.update(otherPathToSchemas); + val otherPathToSchemas = JsonSchema.validate(propSchema, propValue, propValidationMetadata) + pathToSchemas.update(otherPathToSchemas) } - return pathToSchemas; + return pathToSchemas } } diff --git a/src/main/resources/kotlin/src/main/kotlin/packagename/schemas/validation/RequiredValidator.hbs b/src/main/resources/kotlin/src/main/kotlin/packagename/schemas/validation/RequiredValidator.hbs index e21584c2c19..27253408dee 100644 --- a/src/main/resources/kotlin/src/main/kotlin/packagename/schemas/validation/RequiredValidator.hbs +++ b/src/main/resources/kotlin/src/main/kotlin/packagename/schemas/validation/RequiredValidator.hbs @@ -1,41 +1,32 @@ package {{{packageName}}}.schemas.validation; -import org.checkerframework.checker.nullness.qual.Nullable; import {{{packageName}}}.exceptions.ValidationException; -import java.util.HashSet; -import java.util.List; -import java.util.Map; -import java.util.Set; - -public class RequiredValidator implements KeywordValidator { - @Override - public @Nullable PathToSchemasMap validate( - ValidationData data - ) throws ValidationException { - var required = data.schema().required; - if (required == null) { - return null; - } - if (!(data.arg() instanceof Map mapArg)) { - return null; +class RequiredValidator : KeywordValidator { + @Throws(ValidationException::class) + override fun validate( + data: ValidationData + ): PathToSchemasMap? { + val required: Set = data.schema.required ?: return null + if (data.arg !is Map<*, *>) { + return null } - Set missingRequiredProperties = new HashSet<>(required); - for (Object key: mapArg.keySet()) { - if (key instanceof String) { - missingRequiredProperties.remove(key); + val missingRequiredProperties: MutableSet = HashSet(required) + for (key in data.arg.keys) { + if (key is String) { + missingRequiredProperties.remove(key) } } - if (!missingRequiredProperties.isEmpty()) { - List missingReqProps = missingRequiredProperties.stream().sorted().toList(); - String pluralChar = ""; - if (missingRequiredProperties.size() > 1) { - pluralChar = "s"; + if (missingRequiredProperties.isNotEmpty()) { + val missingReqProps: List = missingRequiredProperties.toList().sorted() + var pluralChar = "" + if (missingRequiredProperties.size > 1) { + pluralChar = "s" } - throw new ValidationException( - data.schema().getClass()+" is missing "+missingRequiredProperties.size()+" required argument"+pluralChar+": "+missingReqProps - ); + throw ValidationException( + data.schema.javaClass.simpleName + " is missing " + missingRequiredProperties.size + " required argument" + pluralChar + ": " + missingReqProps + ) } - return null; + return null } } From a6a1f1b2013cb069911aafdc1122da0842405ab6 Mon Sep 17 00:00:00 2001 From: Justin Black Date: Wed, 8 May 2024 10:41:07 -0700 Subject: [PATCH 22/78] Updates ExclusiveMaximumValidator --- .../validation/ExclusiveMaximumValidator.kt | 61 +++++++++---------- .../validation/ExclusiveMaximumValidator.hbs | 57 ++++++++--------- 2 files changed, 56 insertions(+), 62 deletions(-) diff --git a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/schemas/validation/ExclusiveMaximumValidator.kt b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/schemas/validation/ExclusiveMaximumValidator.kt index e05df98079f..49bb752755b 100644 --- a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/schemas/validation/ExclusiveMaximumValidator.kt +++ b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/schemas/validation/ExclusiveMaximumValidator.kt @@ -1,45 +1,42 @@ -package org.openapijsonschematools.client.schemas.validation; +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 -public class ExclusiveMaximumValidator implements KeywordValidator { - @Override - public @Nullable PathToSchemasMap validate( - ValidationData data - ) throws ValidationException { - var exclusiveMaximum = data.schema().exclusiveMaximum; - if (exclusiveMaximum == null) { - return null; +class ExclusiveMaximumValidator : KeywordValidator { + @Throws(ValidationException::class) + override fun validate( + data: ValidationData + ): PathToSchemasMap? { + val exclusiveMaximum: Number = data.schema.exclusiveMaximum ?: return null + if (data.arg !is Number) { + return null } - if (!(data.arg() instanceof Number)) { - return null; - } - String msg = "Value " + data.arg() + " is invalid because it is >= the exclusiveMaximum of " + exclusiveMaximum; - if (data.arg() instanceof Integer intArg) { - if (intArg.compareTo(exclusiveMaximum.intValue()) > -1) { - throw new ValidationException(msg); + val msg = + "Value " + data.arg + " is invalid because it is >= the exclusiveMaximum of " + exclusiveMaximum + if (data.arg is Int) { + if (data.arg.compareTo(exclusiveMaximum.toInt()) > -1) { + throw ValidationException(msg) } - return null; + return null } - if (data.arg() instanceof Long longArg) { - if (longArg.compareTo(exclusiveMaximum.longValue()) > -1) { - throw new ValidationException(msg); + if (data.arg is Long) { + if (data.arg.compareTo(exclusiveMaximum.toLong()) > -1) { + throw ValidationException(msg) } - return null; + return null } - if (data.arg() instanceof Float floatArg) { - if (floatArg.compareTo(exclusiveMaximum.floatValue()) > -1) { - throw new ValidationException(msg); + if (data.arg is Float) { + if (data.arg.compareTo(exclusiveMaximum.toFloat()) > -1) { + throw ValidationException(msg) } - return null; + return null } - if (data.arg() instanceof Double doubleArg) { - if (doubleArg.compareTo(exclusiveMaximum.doubleValue()) > -1) { - throw new ValidationException(msg); + if (data.arg is Double) { + if (data.arg.compareTo(exclusiveMaximum.toDouble()) > -1) { + throw ValidationException(msg) } - return null; + return null } - return null; + return null } } diff --git a/src/main/resources/kotlin/src/main/kotlin/packagename/schemas/validation/ExclusiveMaximumValidator.hbs b/src/main/resources/kotlin/src/main/kotlin/packagename/schemas/validation/ExclusiveMaximumValidator.hbs index 33299752bf0..9343dc2052e 100644 --- a/src/main/resources/kotlin/src/main/kotlin/packagename/schemas/validation/ExclusiveMaximumValidator.hbs +++ b/src/main/resources/kotlin/src/main/kotlin/packagename/schemas/validation/ExclusiveMaximumValidator.hbs @@ -1,45 +1,42 @@ package {{{packageName}}}.schemas.validation; import {{{packageName}}}.exceptions.ValidationException; -import org.checkerframework.checker.nullness.qual.Nullable; -public class ExclusiveMaximumValidator implements KeywordValidator { - @Override - public @Nullable PathToSchemasMap validate( - ValidationData data - ) throws ValidationException { - var exclusiveMaximum = data.schema().exclusiveMaximum; - if (exclusiveMaximum == null) { - return null; +class ExclusiveMaximumValidator : KeywordValidator { + @Throws(ValidationException::class) + override fun validate( + data: ValidationData + ): PathToSchemasMap? { + val exclusiveMaximum: Number = data.schema.exclusiveMaximum ?: return null + if (data.arg !is Number) { + return null } - if (!(data.arg() instanceof Number)) { - return null; - } - String msg = "Value " + data.arg() + " is invalid because it is >= the exclusiveMaximum of " + exclusiveMaximum; - if (data.arg() instanceof Integer intArg) { - if (intArg.compareTo(exclusiveMaximum.intValue()) > -1) { - throw new ValidationException(msg); + val msg = + "Value " + data.arg + " is invalid because it is >= the exclusiveMaximum of " + exclusiveMaximum + if (data.arg is Int) { + if (data.arg.compareTo(exclusiveMaximum.toInt()) > -1) { + throw ValidationException(msg) } - return null; + return null } - if (data.arg() instanceof Long longArg) { - if (longArg.compareTo(exclusiveMaximum.longValue()) > -1) { - throw new ValidationException(msg); + if (data.arg is Long) { + if (data.arg.compareTo(exclusiveMaximum.toLong()) > -1) { + throw ValidationException(msg) } - return null; + return null } - if (data.arg() instanceof Float floatArg) { - if (floatArg.compareTo(exclusiveMaximum.floatValue()) > -1) { - throw new ValidationException(msg); + if (data.arg is Float) { + if (data.arg.compareTo(exclusiveMaximum.toFloat()) > -1) { + throw ValidationException(msg) } - return null; + return null } - if (data.arg() instanceof Double doubleArg) { - if (doubleArg.compareTo(exclusiveMaximum.doubleValue()) > -1) { - throw new ValidationException(msg); + if (data.arg is Double) { + if (data.arg.compareTo(exclusiveMaximum.toDouble()) > -1) { + throw ValidationException(msg) } - return null; + return null } - return null; + return null } } From 8d2f0b28fa20437d82f02eb0885be08059a5eb28 Mon Sep 17 00:00:00 2001 From: Justin Black Date: Wed, 8 May 2024 11:02:01 -0700 Subject: [PATCH 23/78] Updates ExclusiveMinimumValidator --- .../validation/ExclusiveMaximumValidator.kt | 39 +++++------ .../validation/ExclusiveMinimumValidator.kt | 68 +++++++++---------- .../validation/ExclusiveMaximumValidator.hbs | 39 +++++------ .../validation/ExclusiveMinimumValidator.hbs | 64 +++++++++-------- 4 files changed, 104 insertions(+), 106 deletions(-) diff --git a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/schemas/validation/ExclusiveMaximumValidator.kt b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/schemas/validation/ExclusiveMaximumValidator.kt index 49bb752755b..5b55d46a38d 100644 --- a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/schemas/validation/ExclusiveMaximumValidator.kt +++ b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/schemas/validation/ExclusiveMaximumValidator.kt @@ -13,29 +13,30 @@ class ExclusiveMaximumValidator : KeywordValidator { } val msg = "Value " + data.arg + " is invalid because it is >= the exclusiveMaximum of " + exclusiveMaximum - if (data.arg is Int) { - if (data.arg.compareTo(exclusiveMaximum.toInt()) > -1) { - throw ValidationException(msg) + when (data.arg) { + is Int -> { + if (data.arg.compareTo(exclusiveMaximum.toInt()) > -1) { + throw ValidationException(msg) + } } - return null - } - if (data.arg is Long) { - if (data.arg.compareTo(exclusiveMaximum.toLong()) > -1) { - throw ValidationException(msg) + + is Long -> { + if (data.arg.compareTo(exclusiveMaximum.toLong()) > -1) { + throw ValidationException(msg) + } } - return null - } - if (data.arg is Float) { - if (data.arg.compareTo(exclusiveMaximum.toFloat()) > -1) { - throw ValidationException(msg) + + is Float -> { + if (data.arg.compareTo(exclusiveMaximum.toFloat()) > -1) { + throw ValidationException(msg) + } } - return null - } - if (data.arg is Double) { - if (data.arg.compareTo(exclusiveMaximum.toDouble()) > -1) { - throw ValidationException(msg) + + is Double -> { + if (data.arg.compareTo(exclusiveMaximum.toDouble()) > -1) { + throw ValidationException(msg) + } } - return null } return null } diff --git a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/schemas/validation/ExclusiveMinimumValidator.kt b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/schemas/validation/ExclusiveMinimumValidator.kt index 0e06f391f62..e19f44defe9 100644 --- a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/schemas/validation/ExclusiveMinimumValidator.kt +++ b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/schemas/validation/ExclusiveMinimumValidator.kt @@ -1,45 +1,43 @@ -package org.openapijsonschematools.client.schemas.validation; +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 -public class ExclusiveMinimumValidator implements KeywordValidator { - @Override - public @Nullable PathToSchemasMap validate( - ValidationData data - ) throws ValidationException { - var exclusiveMinimum = data.schema().exclusiveMinimum; - if (exclusiveMinimum == null) { - return null; +class ExclusiveMinimumValidator : KeywordValidator { + @Throws(ValidationException::class) + override fun validate( + data: ValidationData + ): PathToSchemasMap? { + val exclusiveMinimum: Number = data.schema.exclusiveMinimum ?: return null + if (data.arg !is Number) { + return null } - if (!(data.arg() instanceof Number)) { - return null; - } - String msg = "Value " + data.arg() + " is invalid because it is <= the exclusiveMinimum of " + exclusiveMinimum; - if (data.arg() instanceof Integer intArg) { - if (intArg.compareTo(exclusiveMinimum.intValue()) < 1) { - throw new ValidationException(msg); + val msg = + "Value " + data.arg + " is invalid because it is <= the exclusiveMinimum of " + exclusiveMinimum + when (data.arg) { + is Int -> { + if (data.arg.compareTo(exclusiveMinimum.toInt()) < 1) { + throw ValidationException(msg) + } } - return null; - } - if (data.arg() instanceof Long longArg) { - if (longArg.compareTo(exclusiveMinimum.longValue()) < 1) { - throw new ValidationException(msg); + + is Long -> { + if (data.arg.compareTo(exclusiveMinimum.toLong()) < 1) { + throw ValidationException(msg) + } } - return null; - } - if (data.arg() instanceof Float floatArg) { - if (floatArg.compareTo(exclusiveMinimum.floatValue()) < 1) { - throw new ValidationException(msg); + + is Float -> { + if (data.arg.compareTo(exclusiveMinimum.toFloat()) < 1) { + throw ValidationException(msg) + } } - return null; - } - if (data.arg() instanceof Double doubleArg) { - if (doubleArg.compareTo(exclusiveMinimum.doubleValue()) < 1) { - throw new ValidationException(msg); + + is Double -> { + if (data.arg.compareTo(exclusiveMinimum.toDouble()) < 1) { + throw ValidationException(msg) + } } - return null; } - return null; + return null } } diff --git a/src/main/resources/kotlin/src/main/kotlin/packagename/schemas/validation/ExclusiveMaximumValidator.hbs b/src/main/resources/kotlin/src/main/kotlin/packagename/schemas/validation/ExclusiveMaximumValidator.hbs index 9343dc2052e..e07f3d81257 100644 --- a/src/main/resources/kotlin/src/main/kotlin/packagename/schemas/validation/ExclusiveMaximumValidator.hbs +++ b/src/main/resources/kotlin/src/main/kotlin/packagename/schemas/validation/ExclusiveMaximumValidator.hbs @@ -13,29 +13,30 @@ class ExclusiveMaximumValidator : KeywordValidator { } val msg = "Value " + data.arg + " is invalid because it is >= the exclusiveMaximum of " + exclusiveMaximum - if (data.arg is Int) { - if (data.arg.compareTo(exclusiveMaximum.toInt()) > -1) { - throw ValidationException(msg) + when (data.arg) { + is Int -> { + if (data.arg.compareTo(exclusiveMaximum.toInt()) > -1) { + throw ValidationException(msg) + } } - return null - } - if (data.arg is Long) { - if (data.arg.compareTo(exclusiveMaximum.toLong()) > -1) { - throw ValidationException(msg) + + is Long -> { + if (data.arg.compareTo(exclusiveMaximum.toLong()) > -1) { + throw ValidationException(msg) + } } - return null - } - if (data.arg is Float) { - if (data.arg.compareTo(exclusiveMaximum.toFloat()) > -1) { - throw ValidationException(msg) + + is Float -> { + if (data.arg.compareTo(exclusiveMaximum.toFloat()) > -1) { + throw ValidationException(msg) + } } - return null - } - if (data.arg is Double) { - if (data.arg.compareTo(exclusiveMaximum.toDouble()) > -1) { - throw ValidationException(msg) + + is Double -> { + if (data.arg.compareTo(exclusiveMaximum.toDouble()) > -1) { + throw ValidationException(msg) + } } - return null } return null } diff --git a/src/main/resources/kotlin/src/main/kotlin/packagename/schemas/validation/ExclusiveMinimumValidator.hbs b/src/main/resources/kotlin/src/main/kotlin/packagename/schemas/validation/ExclusiveMinimumValidator.hbs index 3ba4f4e778c..60f62091701 100644 --- a/src/main/resources/kotlin/src/main/kotlin/packagename/schemas/validation/ExclusiveMinimumValidator.hbs +++ b/src/main/resources/kotlin/src/main/kotlin/packagename/schemas/validation/ExclusiveMinimumValidator.hbs @@ -1,45 +1,43 @@ package {{{packageName}}}.schemas.validation; import {{{packageName}}}.exceptions.ValidationException; -import org.checkerframework.checker.nullness.qual.Nullable; -public class ExclusiveMinimumValidator implements KeywordValidator { - @Override - public @Nullable PathToSchemasMap validate( - ValidationData data - ) throws ValidationException { - var exclusiveMinimum = data.schema().exclusiveMinimum; - if (exclusiveMinimum == null) { - return null; +class ExclusiveMinimumValidator : KeywordValidator { + @Throws(ValidationException::class) + override fun validate( + data: ValidationData + ): PathToSchemasMap? { + val exclusiveMinimum: Number = data.schema.exclusiveMinimum ?: return null + if (data.arg !is Number) { + return null } - if (!(data.arg() instanceof Number)) { - return null; - } - String msg = "Value " + data.arg() + " is invalid because it is <= the exclusiveMinimum of " + exclusiveMinimum; - if (data.arg() instanceof Integer intArg) { - if (intArg.compareTo(exclusiveMinimum.intValue()) < 1) { - throw new ValidationException(msg); + val msg = + "Value " + data.arg + " is invalid because it is <= the exclusiveMinimum of " + exclusiveMinimum + when (data.arg) { + is Int -> { + if (data.arg.compareTo(exclusiveMinimum.toInt()) < 1) { + throw ValidationException(msg) + } } - return null; - } - if (data.arg() instanceof Long longArg) { - if (longArg.compareTo(exclusiveMinimum.longValue()) < 1) { - throw new ValidationException(msg); + + is Long -> { + if (data.arg.compareTo(exclusiveMinimum.toLong()) < 1) { + throw ValidationException(msg) + } } - return null; - } - if (data.arg() instanceof Float floatArg) { - if (floatArg.compareTo(exclusiveMinimum.floatValue()) < 1) { - throw new ValidationException(msg); + + is Float -> { + if (data.arg.compareTo(exclusiveMinimum.toFloat()) < 1) { + throw ValidationException(msg) + } } - return null; - } - if (data.arg() instanceof Double doubleArg) { - if (doubleArg.compareTo(exclusiveMinimum.doubleValue()) < 1) { - throw new ValidationException(msg); + + is Double -> { + if (data.arg.compareTo(exclusiveMinimum.toDouble()) < 1) { + throw ValidationException(msg) + } } - return null; } - return null; + return null } } From 447f1b06dc1e5644f081265aa6b46471cadd0927 Mon Sep 17 00:00:00 2001 From: Justin Black Date: Wed, 8 May 2024 11:14:15 -0700 Subject: [PATCH 24/78] Updates max and min items validators --- .../schemas/validation/MaxItemsValidator.kt | 32 ++++++++----------- .../schemas/validation/MinItemsValidator.kt | 32 ++++++++----------- .../schemas/validation/MaxItemsValidator.hbs | 28 +++++++--------- .../schemas/validation/MinItemsValidator.hbs | 30 +++++++---------- 4 files changed, 49 insertions(+), 73 deletions(-) diff --git a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/schemas/validation/MaxItemsValidator.kt b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/schemas/validation/MaxItemsValidator.kt index 2749843cbf2..d18c07d9b79 100644 --- a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/schemas/validation/MaxItemsValidator.kt +++ b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/schemas/validation/MaxItemsValidator.kt @@ -1,25 +1,19 @@ -package org.openapijsonschematools.client.schemas.validation; +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; - -public class MaxItemsValidator implements KeywordValidator { - @Override - public @Nullable PathToSchemasMap validate( - ValidationData data - ) throws ValidationException { - var maxItems = data.schema().maxItems; - if (maxItems == null) { - return null; - } - if (!(data.arg() instanceof List listArg)) { - return null; +class MaxItemsValidator : KeywordValidator { + @Throws(ValidationException::class) + override fun validate( + data: ValidationData + ): PathToSchemasMap? { + val maxItems: Int = data.schema.maxItems ?: return null + if (data.arg !is List<*>) { + return null } - if (listArg.size() > maxItems) { - throw new ValidationException("Value " + listArg + " is invalid because has > the maxItems of " + maxItems); + if (data.arg.size > maxItems) { + throw ValidationException("Value ${data.arg} is invalid because has > the maxItems of $maxItems") } - return null; + return null } } diff --git a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/schemas/validation/MinItemsValidator.kt b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/schemas/validation/MinItemsValidator.kt index 25bae60bda7..26d4e218e0e 100644 --- a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/schemas/validation/MinItemsValidator.kt +++ b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/schemas/validation/MinItemsValidator.kt @@ -1,25 +1,19 @@ -package org.openapijsonschematools.client.schemas.validation; +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; - -public class MinItemsValidator implements KeywordValidator { - @Override - public @Nullable PathToSchemasMap validate( - ValidationData data - ) throws ValidationException { - var minItems = data.schema().minItems; - if (minItems == null) { - return null; - } - if (!(data.arg() instanceof List listArg)) { - return null; +class MinItemsValidator : KeywordValidator { + @Throws(ValidationException::class) + override fun validate( + data: ValidationData + ): PathToSchemasMap? { + val minItems: Int = data.schema.minItems ?: return null + if (data.arg !is List<*>) { + return null } - if (listArg.size() < minItems) { - throw new ValidationException("Value " + listArg + " is invalid because has < the minItems of " + minItems); + if (data.arg.size < minItems) { + throw ValidationException("Value ${data.arg} is invalid because has < the minItems of $minItems") } - return null; + return null } } diff --git a/src/main/resources/kotlin/src/main/kotlin/packagename/schemas/validation/MaxItemsValidator.hbs b/src/main/resources/kotlin/src/main/kotlin/packagename/schemas/validation/MaxItemsValidator.hbs index 500b858fc52..b4d3898a42a 100644 --- a/src/main/resources/kotlin/src/main/kotlin/packagename/schemas/validation/MaxItemsValidator.hbs +++ b/src/main/resources/kotlin/src/main/kotlin/packagename/schemas/validation/MaxItemsValidator.hbs @@ -1,25 +1,19 @@ package {{{packageName}}}.schemas.validation; import {{{packageName}}}.exceptions.ValidationException; -import org.checkerframework.checker.nullness.qual.Nullable; -import java.util.List; - -public class MaxItemsValidator implements KeywordValidator { - @Override - public @Nullable PathToSchemasMap validate( - ValidationData data - ) throws ValidationException { - var maxItems = data.schema().maxItems; - if (maxItems == null) { - return null; - } - if (!(data.arg() instanceof List listArg)) { - return null; +class MaxItemsValidator : KeywordValidator { + @Throws(ValidationException::class) + override fun validate( + data: ValidationData + ): PathToSchemasMap? { + val maxItems: Int = data.schema.maxItems ?: return null + if (data.arg !is List<*>) { + return null } - if (listArg.size() > maxItems) { - throw new ValidationException("Value " + listArg + " is invalid because has > the maxItems of " + maxItems); + if (data.arg.size > maxItems) { + throw ValidationException("Value ${data.arg} is invalid because has > the maxItems of $maxItems") } - return null; + return null } } diff --git a/src/main/resources/kotlin/src/main/kotlin/packagename/schemas/validation/MinItemsValidator.hbs b/src/main/resources/kotlin/src/main/kotlin/packagename/schemas/validation/MinItemsValidator.hbs index ede47652f99..70f8f75a1aa 100644 --- a/src/main/resources/kotlin/src/main/kotlin/packagename/schemas/validation/MinItemsValidator.hbs +++ b/src/main/resources/kotlin/src/main/kotlin/packagename/schemas/validation/MinItemsValidator.hbs @@ -1,25 +1,19 @@ package {{{packageName}}}.schemas.validation; import {{{packageName}}}.exceptions.ValidationException; -import org.checkerframework.checker.nullness.qual.Nullable; -import java.util.List; - -public class MinItemsValidator implements KeywordValidator { - @Override - public @Nullable PathToSchemasMap validate( - ValidationData data - ) throws ValidationException { - var minItems = data.schema().minItems; - if (minItems == null) { - return null; - } - if (!(data.arg() instanceof List listArg)) { - return null; +class MinItemsValidator : KeywordValidator { + @Throws(ValidationException::class) + override fun validate( + data: ValidationData + ): PathToSchemasMap? { + val minItems: Int = data.schema.minItems ?: return null + if (data.arg !is List<*>) { + return null } - if (listArg.size() < minItems) { - throw new ValidationException("Value " + listArg + " is invalid because has < the minItems of " + minItems); + if (data.arg.size < minItems) { + throw ValidationException("Value ${data.arg} is invalid because has < the minItems of $minItems") } - return null; + return null } -} +} \ No newline at end of file From 4f1703ad4634e91e48300d81b159e650affc7a0f Mon Sep 17 00:00:00 2001 From: Justin Black Date: Wed, 8 May 2024 11:23:25 -0700 Subject: [PATCH 25/78] Updates Max and Min length validators --- .../schemas/validation/LengthValidator.kt | 20 ++++++------- .../schemas/validation/MaxLengthValidator.kt | 30 ++++++++----------- .../schemas/validation/MinLengthValidator.kt | 30 ++++++++----------- .../schemas/validation/LengthValidator.hbs | 16 +++++----- .../schemas/validation/MaxLengthValidator.hbs | 26 +++++++--------- .../schemas/validation/MinLengthValidator.hbs | 26 +++++++--------- 6 files changed, 66 insertions(+), 82 deletions(-) diff --git a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/schemas/validation/LengthValidator.kt b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/schemas/validation/LengthValidator.kt index f99e359cab4..50a273b85eb 100644 --- a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/schemas/validation/LengthValidator.kt +++ b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/schemas/validation/LengthValidator.kt @@ -1,16 +1,16 @@ -package org.openapijsonschematools.client.schemas.validation; +package org.openapijsonschematools.client.schemas.validation -import java.text.BreakIterator; +import java.text.BreakIterator -public abstract class LengthValidator { - protected int getLength(String text) { - int graphemeCount = 0; - BreakIterator graphemeCounter = BreakIterator - .getCharacterInstance(); - graphemeCounter.setText(text); +abstract class LengthValidator { + protected fun getLength(text: String?): Int { + var graphemeCount = 0 + val graphemeCounter = BreakIterator + .getCharacterInstance() + graphemeCounter.setText(text) while (graphemeCounter.next() != BreakIterator.DONE) { - graphemeCount++; + graphemeCount++ } - return graphemeCount; + return graphemeCount } } diff --git a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/schemas/validation/MaxLengthValidator.kt b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/schemas/validation/MaxLengthValidator.kt index f2a77fa91f6..ca9c267dbd9 100644 --- a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/schemas/validation/MaxLengthValidator.kt +++ b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/schemas/validation/MaxLengthValidator.kt @@ -1,24 +1,20 @@ -package org.openapijsonschematools.client.schemas.validation; +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 -public class MaxLengthValidator extends LengthValidator implements KeywordValidator { - @Override - public @Nullable PathToSchemasMap validate( - ValidationData data - ) throws ValidationException { - var maxLength = data.schema().maxLength; - if (maxLength == null) { - return null; +class MaxLengthValidator : LengthValidator(), KeywordValidator { + @Throws(ValidationException::class) + override fun validate( + data: ValidationData + ): PathToSchemasMap? { + val maxLength: Int = data.schema.maxLength ?: return null + if (data.arg !is String) { + return null } - if (!(data.arg() instanceof String stringArg)) { - return null; - } - int length = getLength(stringArg); + val length: Int = getLength(data.arg) if (length > maxLength) { - throw new ValidationException("Value " + stringArg + " is invalid because has > the maxLength of " + maxLength); + throw ValidationException("Value ${data.arg} is invalid because has > the maxLength of $maxLength") } - return null; + return null } } diff --git a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/schemas/validation/MinLengthValidator.kt b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/schemas/validation/MinLengthValidator.kt index f4639e8a207..95228a8e132 100644 --- a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/schemas/validation/MinLengthValidator.kt +++ b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/schemas/validation/MinLengthValidator.kt @@ -1,24 +1,20 @@ -package org.openapijsonschematools.client.schemas.validation; +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 -public class MinLengthValidator extends LengthValidator implements KeywordValidator { - @Override - public @Nullable PathToSchemasMap validate( - ValidationData data - ) throws ValidationException { - var minLength = data.schema().minLength; - if (minLength == null) { - return null; +class MinLengthValidator : LengthValidator(), KeywordValidator { + @Throws(ValidationException::class) + override fun validate( + data: ValidationData + ): PathToSchemasMap? { + val minLength: Int = data.schema.minLength ?: return null + if (data.arg !is String) { + return null } - if (!(data.arg() instanceof String stringArg)) { - return null; - } - int length = getLength(stringArg); + val length = getLength(data.arg) if (length < minLength) { - throw new ValidationException("Value " + stringArg + " is invalid because has < the minLength of " + minLength); + throw ValidationException("Value ${data.arg} is invalid because has < the minLength of $minLength") } - return null; + return null } } \ No newline at end of file diff --git a/src/main/resources/kotlin/src/main/kotlin/packagename/schemas/validation/LengthValidator.hbs b/src/main/resources/kotlin/src/main/kotlin/packagename/schemas/validation/LengthValidator.hbs index 08bb770ae29..72987a9bb6b 100644 --- a/src/main/resources/kotlin/src/main/kotlin/packagename/schemas/validation/LengthValidator.hbs +++ b/src/main/resources/kotlin/src/main/kotlin/packagename/schemas/validation/LengthValidator.hbs @@ -2,15 +2,15 @@ package {{{packageName}}}.schemas.validation; import java.text.BreakIterator; -public abstract class LengthValidator { - protected int getLength(String text) { - int graphemeCount = 0; - BreakIterator graphemeCounter = BreakIterator - .getCharacterInstance(); - graphemeCounter.setText(text); +abstract class LengthValidator { + protected fun getLength(text: String?): Int { + var graphemeCount = 0 + val graphemeCounter = BreakIterator + .getCharacterInstance() + graphemeCounter.setText(text) while (graphemeCounter.next() != BreakIterator.DONE) { - graphemeCount++; + graphemeCount++ } - return graphemeCount; + return graphemeCount } } diff --git a/src/main/resources/kotlin/src/main/kotlin/packagename/schemas/validation/MaxLengthValidator.hbs b/src/main/resources/kotlin/src/main/kotlin/packagename/schemas/validation/MaxLengthValidator.hbs index cfa5bfd0f5a..a2083b49177 100644 --- a/src/main/resources/kotlin/src/main/kotlin/packagename/schemas/validation/MaxLengthValidator.hbs +++ b/src/main/resources/kotlin/src/main/kotlin/packagename/schemas/validation/MaxLengthValidator.hbs @@ -1,24 +1,20 @@ package {{{packageName}}}.schemas.validation; import {{{packageName}}}.exceptions.ValidationException; -import org.checkerframework.checker.nullness.qual.Nullable; -public class MaxLengthValidator extends LengthValidator implements KeywordValidator { - @Override - public @Nullable PathToSchemasMap validate( - ValidationData data - ) throws ValidationException { - var maxLength = data.schema().maxLength; - if (maxLength == null) { - return null; +class MaxLengthValidator : LengthValidator(), KeywordValidator { + @Throws(ValidationException::class) + override fun validate( + data: ValidationData + ): PathToSchemasMap? { + val maxLength: Int = data.schema.maxLength ?: return null + if (data.arg !is String) { + return null } - if (!(data.arg() instanceof String stringArg)) { - return null; - } - int length = getLength(stringArg); + val length: Int = getLength(data.arg) if (length > maxLength) { - throw new ValidationException("Value " + stringArg + " is invalid because has > the maxLength of " + maxLength); + throw ValidationException("Value ${data.arg} is invalid because has > the maxLength of $maxLength") } - return null; + return null } } diff --git a/src/main/resources/kotlin/src/main/kotlin/packagename/schemas/validation/MinLengthValidator.hbs b/src/main/resources/kotlin/src/main/kotlin/packagename/schemas/validation/MinLengthValidator.hbs index 38782795048..746efbbf76c 100644 --- a/src/main/resources/kotlin/src/main/kotlin/packagename/schemas/validation/MinLengthValidator.hbs +++ b/src/main/resources/kotlin/src/main/kotlin/packagename/schemas/validation/MinLengthValidator.hbs @@ -1,24 +1,20 @@ package {{{packageName}}}.schemas.validation; import {{{packageName}}}.exceptions.ValidationException; -import org.checkerframework.checker.nullness.qual.Nullable; -public class MinLengthValidator extends LengthValidator implements KeywordValidator { - @Override - public @Nullable PathToSchemasMap validate( - ValidationData data - ) throws ValidationException { - var minLength = data.schema().minLength; - if (minLength == null) { - return null; +class MinLengthValidator : LengthValidator(), KeywordValidator { + @Throws(ValidationException::class) + override fun validate( + data: ValidationData + ): PathToSchemasMap? { + val minLength: Int = data.schema.minLength ?: return null + if (data.arg !is String) { + return null } - if (!(data.arg() instanceof String stringArg)) { - return null; - } - int length = getLength(stringArg); + val length = getLength(data.arg) if (length < minLength) { - throw new ValidationException("Value " + stringArg + " is invalid because has < the minLength of " + minLength); + throw ValidationException("Value ${data.arg} is invalid because has < the minLength of $minLength") } - return null; + return null } } \ No newline at end of file From 11bd25611ffbafacd180af6682693aa0a3243646 Mon Sep 17 00:00:00 2001 From: Justin Black Date: Wed, 8 May 2024 11:28:29 -0700 Subject: [PATCH 26/78] Updates max and min properties validator --- .../validation/MaxPropertiesValidator.kt | 32 ++++++++----------- .../validation/MinPropertiesValidator.kt | 32 ++++++++----------- .../validation/MaxPropertiesValidator.hbs | 30 +++++++---------- .../validation/MinPropertiesValidator.hbs | 30 +++++++---------- 4 files changed, 50 insertions(+), 74 deletions(-) diff --git a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/schemas/validation/MaxPropertiesValidator.kt b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/schemas/validation/MaxPropertiesValidator.kt index 57a53e71be5..44b5a773ad9 100644 --- a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/schemas/validation/MaxPropertiesValidator.kt +++ b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/schemas/validation/MaxPropertiesValidator.kt @@ -1,25 +1,19 @@ -package org.openapijsonschematools.client.schemas.validation; +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.Map; - -public class MaxPropertiesValidator implements KeywordValidator { - @Override - public @Nullable PathToSchemasMap validate( - ValidationData data - ) throws ValidationException { - var maxProperties = data.schema().maxProperties; - if (maxProperties == null) { - return null; - } - if (!(data.arg() instanceof Map mapArg)) { - return null; +class MaxPropertiesValidator : KeywordValidator { + @Throws(ValidationException::class) + override fun validate( + data: ValidationData + ): PathToSchemasMap? { + val maxProperties: Int = data.schema.maxProperties ?: return null + if (data.arg !is Map<*, *>) { + return null } - if (mapArg.size() > maxProperties) { - throw new ValidationException("Value " + mapArg + " is invalid because has > the maxProperties of " + maxProperties); + if (data.arg.size > maxProperties) { + throw ValidationException("Value ${data.arg} is invalid because has > the maxProperties of $maxProperties") } - return null; + return null } } diff --git a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/schemas/validation/MinPropertiesValidator.kt b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/schemas/validation/MinPropertiesValidator.kt index 011ac76dd31..a28e4137356 100644 --- a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/schemas/validation/MinPropertiesValidator.kt +++ b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/schemas/validation/MinPropertiesValidator.kt @@ -1,25 +1,19 @@ -package org.openapijsonschematools.client.schemas.validation; +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.Map; - -public class MinPropertiesValidator implements KeywordValidator { - @Override - public @Nullable PathToSchemasMap validate( - ValidationData data - ) throws ValidationException { - var minProperties = data.schema().minProperties; - if (minProperties == null) { - return null; - } - if (!(data.arg() instanceof Map mapArg)) { - return null; +class MinPropertiesValidator : KeywordValidator { + @Throws(ValidationException::class) + override fun validate( + data: ValidationData + ): PathToSchemasMap? { + val minProperties: Int = data.schema.minProperties ?: return null + if (data.arg !is Map<*, *>) { + return null } - if (mapArg.size() < minProperties) { - throw new ValidationException("Value " + mapArg + " is invalid because has < the minProperties of " + minProperties); + if (data.arg.size < minProperties) { + throw ValidationException("Value ${data.arg} is invalid because has < the minProperties of $minProperties") } - return null; + return null } } diff --git a/src/main/resources/kotlin/src/main/kotlin/packagename/schemas/validation/MaxPropertiesValidator.hbs b/src/main/resources/kotlin/src/main/kotlin/packagename/schemas/validation/MaxPropertiesValidator.hbs index d29dea4a9a1..abc293b1cb2 100644 --- a/src/main/resources/kotlin/src/main/kotlin/packagename/schemas/validation/MaxPropertiesValidator.hbs +++ b/src/main/resources/kotlin/src/main/kotlin/packagename/schemas/validation/MaxPropertiesValidator.hbs @@ -1,25 +1,19 @@ package {{{packageName}}}.schemas.validation; import {{{packageName}}}.exceptions.ValidationException; -import org.checkerframework.checker.nullness.qual.Nullable; -import java.util.Map; - -public class MaxPropertiesValidator implements KeywordValidator { - @Override - public @Nullable PathToSchemasMap validate( - ValidationData data - ) throws ValidationException { - var maxProperties = data.schema().maxProperties; - if (maxProperties == null) { - return null; - } - if (!(data.arg() instanceof Map mapArg)) { - return null; +class MaxPropertiesValidator : KeywordValidator { + @Throws(ValidationException::class) + override fun validate( + data: ValidationData + ): PathToSchemasMap? { + val maxProperties: Int = data.schema.maxProperties ?: return null + if (data.arg !is Map<*, *>) { + return null } - if (mapArg.size() > maxProperties) { - throw new ValidationException("Value " + mapArg + " is invalid because has > the maxProperties of " + maxProperties); + if (data.arg.size > maxProperties) { + throw ValidationException("Value ${data.arg} is invalid because has > the maxProperties of $maxProperties") } - return null; + return null } -} +} \ No newline at end of file diff --git a/src/main/resources/kotlin/src/main/kotlin/packagename/schemas/validation/MinPropertiesValidator.hbs b/src/main/resources/kotlin/src/main/kotlin/packagename/schemas/validation/MinPropertiesValidator.hbs index d383472a7a6..63429267c2a 100644 --- a/src/main/resources/kotlin/src/main/kotlin/packagename/schemas/validation/MinPropertiesValidator.hbs +++ b/src/main/resources/kotlin/src/main/kotlin/packagename/schemas/validation/MinPropertiesValidator.hbs @@ -1,25 +1,19 @@ package {{{packageName}}}.schemas.validation; import {{{packageName}}}.exceptions.ValidationException; -import org.checkerframework.checker.nullness.qual.Nullable; -import java.util.Map; - -public class MinPropertiesValidator implements KeywordValidator { - @Override - public @Nullable PathToSchemasMap validate( - ValidationData data - ) throws ValidationException { - var minProperties = data.schema().minProperties; - if (minProperties == null) { - return null; - } - if (!(data.arg() instanceof Map mapArg)) { - return null; +class MinPropertiesValidator : KeywordValidator { + @Throws(ValidationException::class) + override fun validate( + data: ValidationData + ): PathToSchemasMap? { + val minProperties: Int = data.schema.minProperties ?: return null + if (data.arg !is Map<*, *>) { + return null } - if (mapArg.size() < minProperties) { - throw new ValidationException("Value " + mapArg + " is invalid because has < the minProperties of " + minProperties); + if (data.arg.size < minProperties) { + throw ValidationException("Value ${data.arg} is invalid because has < the minProperties of $minProperties") } - return null; + return null } -} +} \ No newline at end of file From 6051806f53d8aee848b28bcadc05f9df6dd3996a Mon Sep 17 00:00:00 2001 From: Justin Black Date: Wed, 8 May 2024 11:35:41 -0700 Subject: [PATCH 27/78] Updates max and min validator --- .../schemas/validation/MaximumValidator.kt | 67 +++++++++---------- .../schemas/validation/MinimumValidator.kt | 67 +++++++++---------- .../schemas/validation/MaximumValidator.hbs | 63 +++++++++-------- .../schemas/validation/MinimumValidator.hbs | 65 +++++++++--------- 4 files changed, 125 insertions(+), 137 deletions(-) diff --git a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/schemas/validation/MaximumValidator.kt b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/schemas/validation/MaximumValidator.kt index df1c7f5c338..b8070b6c4d1 100644 --- a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/schemas/validation/MaximumValidator.kt +++ b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/schemas/validation/MaximumValidator.kt @@ -1,45 +1,42 @@ -package org.openapijsonschematools.client.schemas.validation; +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 -public class MaximumValidator implements KeywordValidator { - @Override - public @Nullable PathToSchemasMap validate( - ValidationData data - ) throws ValidationException { - var maximum = data.schema().maximum; - if (maximum == null) { - return null; +class MaximumValidator : KeywordValidator { + @Throws(ValidationException::class) + override fun validate( + data: ValidationData + ): PathToSchemasMap? { + val maximum: Number = data.schema.maximum ?: return null + if (data.arg !is Number) { + return null } - if (!(data.arg() instanceof Number)) { - return null; - } - String msg = "Value " + data.arg() + " is invalid because it is > the maximum of " + maximum; - if (data.arg() instanceof Integer intArg) { - if (intArg.compareTo(maximum.intValue()) > 0) { - throw new ValidationException(msg); + val msg = "Value " + data.arg + " is invalid because it is > the maximum of " + maximum + when (data.arg) { + is Int -> { + if (data.arg.compareTo(maximum.toInt()) > 0) { + throw ValidationException(msg) + } } - return null; - } - if (data.arg() instanceof Long longArg) { - if (longArg.compareTo(maximum.longValue()) > 0) { - throw new ValidationException(msg); + + is Long -> { + if (data.arg.compareTo(maximum.toLong()) > 0) { + throw ValidationException(msg) + } } - return null; - } - if (data.arg() instanceof Float floatArg) { - if (floatArg.compareTo(maximum.floatValue()) > 0) { - throw new ValidationException(msg); + + is Float -> { + if (data.arg.compareTo(maximum.toFloat()) > 0) { + throw ValidationException(msg) + } } - return null; - } - if (data.arg() instanceof Double doubleArg) { - if (doubleArg.compareTo(maximum.doubleValue()) > 0) { - throw new ValidationException(msg); + + is Double -> { + if (data.arg.compareTo(maximum.toDouble()) > 0) { + throw ValidationException(msg) + } } - return null; } - return null; + return null } } \ No newline at end of file diff --git a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/schemas/validation/MinimumValidator.kt b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/schemas/validation/MinimumValidator.kt index 76065fe50b5..65c7323f362 100644 --- a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/schemas/validation/MinimumValidator.kt +++ b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/schemas/validation/MinimumValidator.kt @@ -1,45 +1,42 @@ -package org.openapijsonschematools.client.schemas.validation; +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 -public class MinimumValidator implements KeywordValidator { - @Override - public @Nullable PathToSchemasMap validate( - ValidationData data - ) throws ValidationException { - var minimum = data.schema().minimum; - if (minimum == null) { - return null; +class MinimumValidator : KeywordValidator { + @Throws(ValidationException::class) + override fun validate( + data: ValidationData + ): PathToSchemasMap? { + val minimum: Number = data.schema.minimum ?: return null + if (data.arg !is Number) { + return null } - if (!(data.arg() instanceof Number)) { - return null; - } - String msg = "Value " + data.arg() + " is invalid because it is < the minimum of " + minimum; - if (data.arg() instanceof Integer intArg) { - if (intArg.compareTo(minimum.intValue()) < 0) { - throw new ValidationException(msg); + val msg = "Value " + data.arg + " is invalid because it is < the minimum of " + minimum + when (data.arg) { + is Int -> { + if (data.arg.compareTo(minimum.toInt()) < 0) { + throw ValidationException(msg) + } } - return null; - } - if (data.arg() instanceof Long longArg) { - if (longArg.compareTo(minimum.longValue()) < 0) { - throw new ValidationException(msg); + + is Long -> { + if (data.arg.compareTo(minimum.toLong()) < 0) { + throw ValidationException(msg) + } } - return null; - } - if (data.arg() instanceof Float floatArg) { - if (floatArg.compareTo(minimum.floatValue()) < 0) { - throw new ValidationException(msg); + + is Float -> { + if (data.arg.compareTo(minimum.toFloat()) < 0) { + throw ValidationException(msg) + } } - return null; - } - if (data.arg() instanceof Double doubleArg) { - if (doubleArg.compareTo(minimum.doubleValue()) < 0) { - throw new ValidationException(msg); + + is Double -> { + if (data.arg.compareTo(minimum.toDouble()) < 0) { + throw ValidationException(msg) + } } - return null; } - return null; + return null } } diff --git a/src/main/resources/kotlin/src/main/kotlin/packagename/schemas/validation/MaximumValidator.hbs b/src/main/resources/kotlin/src/main/kotlin/packagename/schemas/validation/MaximumValidator.hbs index e366516dfc0..f9c15d630f6 100644 --- a/src/main/resources/kotlin/src/main/kotlin/packagename/schemas/validation/MaximumValidator.hbs +++ b/src/main/resources/kotlin/src/main/kotlin/packagename/schemas/validation/MaximumValidator.hbs @@ -1,45 +1,42 @@ package {{{packageName}}}.schemas.validation; import {{{packageName}}}.exceptions.ValidationException; -import org.checkerframework.checker.nullness.qual.Nullable; -public class MaximumValidator implements KeywordValidator { - @Override - public @Nullable PathToSchemasMap validate( - ValidationData data - ) throws ValidationException { - var maximum = data.schema().maximum; - if (maximum == null) { - return null; +class MaximumValidator : KeywordValidator { + @Throws(ValidationException::class) + override fun validate( + data: ValidationData + ): PathToSchemasMap? { + val maximum: Number = data.schema.maximum ?: return null + if (data.arg !is Number) { + return null } - if (!(data.arg() instanceof Number)) { - return null; - } - String msg = "Value " + data.arg() + " is invalid because it is > the maximum of " + maximum; - if (data.arg() instanceof Integer intArg) { - if (intArg.compareTo(maximum.intValue()) > 0) { - throw new ValidationException(msg); + val msg = "Value " + data.arg + " is invalid because it is > the maximum of " + maximum + when (data.arg) { + is Int -> { + if (data.arg.compareTo(maximum.toInt()) > 0) { + throw ValidationException(msg) + } } - return null; - } - if (data.arg() instanceof Long longArg) { - if (longArg.compareTo(maximum.longValue()) > 0) { - throw new ValidationException(msg); + + is Long -> { + if (data.arg.compareTo(maximum.toLong()) > 0) { + throw ValidationException(msg) + } } - return null; - } - if (data.arg() instanceof Float floatArg) { - if (floatArg.compareTo(maximum.floatValue()) > 0) { - throw new ValidationException(msg); + + is Float -> { + if (data.arg.compareTo(maximum.toFloat()) > 0) { + throw ValidationException(msg) + } } - return null; - } - if (data.arg() instanceof Double doubleArg) { - if (doubleArg.compareTo(maximum.doubleValue()) > 0) { - throw new ValidationException(msg); + + is Double -> { + if (data.arg.compareTo(maximum.toDouble()) > 0) { + throw ValidationException(msg) + } } - return null; } - return null; + return null } } \ No newline at end of file diff --git a/src/main/resources/kotlin/src/main/kotlin/packagename/schemas/validation/MinimumValidator.hbs b/src/main/resources/kotlin/src/main/kotlin/packagename/schemas/validation/MinimumValidator.hbs index eba8b4387fa..962fe6be12a 100644 --- a/src/main/resources/kotlin/src/main/kotlin/packagename/schemas/validation/MinimumValidator.hbs +++ b/src/main/resources/kotlin/src/main/kotlin/packagename/schemas/validation/MinimumValidator.hbs @@ -1,45 +1,42 @@ package {{{packageName}}}.schemas.validation; import {{{packageName}}}.exceptions.ValidationException; -import org.checkerframework.checker.nullness.qual.Nullable; -public class MinimumValidator implements KeywordValidator { - @Override - public @Nullable PathToSchemasMap validate( - ValidationData data - ) throws ValidationException { - var minimum = data.schema().minimum; - if (minimum == null) { - return null; +class MinimumValidator : KeywordValidator { + @Throws(ValidationException::class) + override fun validate( + data: ValidationData + ): PathToSchemasMap? { + val minimum: Number = data.schema.minimum ?: return null + if (data.arg !is Number) { + return null } - if (!(data.arg() instanceof Number)) { - return null; - } - String msg = "Value " + data.arg() + " is invalid because it is < the minimum of " + minimum; - if (data.arg() instanceof Integer intArg) { - if (intArg.compareTo(minimum.intValue()) < 0) { - throw new ValidationException(msg); + val msg = "Value " + data.arg + " is invalid because it is < the minimum of " + minimum + when (data.arg) { + is Int -> { + if (data.arg.compareTo(minimum.toInt()) < 0) { + throw ValidationException(msg) + } } - return null; - } - if (data.arg() instanceof Long longArg) { - if (longArg.compareTo(minimum.longValue()) < 0) { - throw new ValidationException(msg); + + is Long -> { + if (data.arg.compareTo(minimum.toLong()) < 0) { + throw ValidationException(msg) + } } - return null; - } - if (data.arg() instanceof Float floatArg) { - if (floatArg.compareTo(minimum.floatValue()) < 0) { - throw new ValidationException(msg); + + is Float -> { + if (data.arg.compareTo(minimum.toFloat()) < 0) { + throw ValidationException(msg) + } } - return null; - } - if (data.arg() instanceof Double doubleArg) { - if (doubleArg.compareTo(minimum.doubleValue()) < 0) { - throw new ValidationException(msg); + + is Double -> { + if (data.arg.compareTo(minimum.toDouble()) < 0) { + throw ValidationException(msg) + } } - return null; } - return null; + return null } -} +} \ No newline at end of file From 7d0d2f2eec8d9b694824daf45481cbfcb8011e48 Mon Sep 17 00:00:00 2001 From: Justin Black Date: Wed, 8 May 2024 11:59:09 -0700 Subject: [PATCH 28/78] Fixes some intelij warnings in the jsonschema class --- .../client/schemas/validation/JsonSchema.kt | 94 ++++++++++--------- .../schemas/validation/JsonSchema.hbs | 94 ++++++++++--------- 2 files changed, 102 insertions(+), 86 deletions(-) diff --git a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/schemas/validation/JsonSchema.kt b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/schemas/validation/JsonSchema.kt index f71954ddb42..3af35c88274 100644 --- a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/schemas/validation/JsonSchema.kt +++ b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/schemas/validation/JsonSchema.kt @@ -221,7 +221,7 @@ abstract class JsonSchema protected constructor(jsonSchemaInfo: JsonSchemaInf private fun getContainsPathToSchemas( arg: Any?, validationMetadata: ValidationMetadata - ): List? { + ): List { if (arg !is List<*> || contains == null) { return ArrayList() } @@ -229,8 +229,7 @@ abstract class JsonSchema protected constructor(jsonSchemaInfo: JsonSchemaInf val containsPathToSchemas: MutableList = ArrayList() for (i in arg.indices) { val thesePathToSchemas = PathToSchemasMap() - val itemPathToItem: MutableList = ArrayList(validationMetadata.pathToItem) - itemPathToItem.add(i) + val itemPathToItem: List = validationMetadata.pathToItem + i val itemValidationMetadata = ValidationMetadata( itemPathToItem, validationMetadata.configuration, @@ -265,8 +264,7 @@ abstract class JsonSchema protected constructor(jsonSchemaInfo: JsonSchemaInf for ((key, value) in arg) { val entryKey = key!! as? String ?: throw ValidationException("Invalid non-string type for map key") - val propPathToItem: MutableList = ArrayList(validationMetadata.pathToItem()) - propPathToItem.add(entryKey) + val propPathToItem: List = validationMetadata.pathToItem + entryKey val propValidationMetadata = ValidationMetadata( propPathToItem, validationMetadata.configuration, @@ -328,8 +326,7 @@ abstract class JsonSchema protected constructor(jsonSchemaInfo: JsonSchemaInf val argFixed: MutableList = ArrayList() var i = 0 for (item in arg) { - val newPathToItem: MutableList = ArrayList(pathToItem) - newPathToItem.add(i) + val newPathToItem: List = pathToItem + i val fixedVal = castToAllowedObjectTypes(item, newPathToItem, pathSet) argFixed.add(fixedVal) i += 1 @@ -349,10 +346,8 @@ abstract class JsonSchema protected constructor(jsonSchemaInfo: JsonSchemaInf if (entryKey !is String) { throw ValidationException("Invalid non-string key value") } - val `val` = value!! - val newPathToItem: MutableList = ArrayList(pathToItem) - newPathToItem.add(entryKey) - val fixedVal = castToAllowedObjectTypes(`val`, newPathToItem, pathSet) + val newPathToItem: List = pathToItem + entryKey + val fixedVal = castToAllowedObjectTypes(value, newPathToItem, pathSet) argFixed[entryKey] = fixedVal } return argFixed @@ -360,34 +355,47 @@ abstract class JsonSchema protected constructor(jsonSchemaInfo: JsonSchemaInf @Throws(ValidationException::class) private fun castToAllowedObjectTypes(arg: Any?, pathToItem: List, pathSet: MutableSet>): Any? { - return if (arg == null) { - castToAllowedTypes(arg, pathToItem, pathSet) - } else if (arg is String) { - castToAllowedTypes(arg, pathToItem, pathSet) - } else if (arg is Map<*, *>) { - pathSet.add(pathToItem) - castToAllowedTypes(arg, pathToItem, pathSet) - } else if (arg is Boolean) { - castToAllowedTypes(arg, pathToItem, pathSet) - } else if (arg is Int) { - castToAllowedTypes(arg as Number, pathToItem, pathSet) - } else if (arg is Long) { - castToAllowedTypes(arg as Number, pathToItem, pathSet) - } else if (arg is Float) { - castToAllowedTypes(arg as Number, pathToItem, pathSet) - } else if (arg is Double) { - castToAllowedTypes(arg as Number, pathToItem, pathSet) - } else if (arg is List<*>) { - castToAllowedTypes(arg, pathToItem, pathSet) - } else if (arg is ZonedDateTime) { - castToAllowedTypes(arg.toString(), pathToItem, pathSet) - } else if (arg is LocalDate) { - castToAllowedTypes(arg.toString(), pathToItem, pathSet) - } else if (arg is UUID) { - castToAllowedTypes(arg.toString(), pathToItem, pathSet) - } else { - val argClass: Class<*> = arg.javaClass - throw ValidationException("Invalid type passed in for input=$arg type=$argClass") + return when (arg) { + null -> { + castToAllowedTypes(null, pathToItem, pathSet) + } + is String -> { + castToAllowedTypes(arg, pathToItem, pathSet) + } + + is Map<*, *> -> { + pathSet.add(pathToItem) + castToAllowedTypes(arg, pathToItem, pathSet) + } + + is Boolean -> { + castToAllowedTypes(arg, pathToItem, pathSet) + } + + is Number -> { + castToAllowedTypes(arg, pathToItem, pathSet) + } + + is List<*> -> { + castToAllowedTypes(arg, pathToItem, pathSet) + } + + is ZonedDateTime -> { + castToAllowedTypes(arg.toString(), pathToItem, pathSet) + } + + is LocalDate -> { + castToAllowedTypes(arg.toString(), pathToItem, pathSet) + } + + is UUID -> { + castToAllowedTypes(arg.toString(), pathToItem, pathSet) + } + + else -> { + val argClass = arg.javaClass + throw ValidationException("Invalid type passed in for input=$arg type=$argClass") + } } } @@ -455,7 +463,7 @@ abstract class JsonSchema protected constructor(jsonSchemaInfo: JsonSchemaInf } val pathToItem: List = validationMetadata.pathToItem if (!pathToSchemas.containsKey(pathToItem)) { - pathToSchemas[validationMetadata.pathToItem] = LinkedHashMap() + pathToSchemas[validationMetadata.pathToItem] = LinkedHashMap() } val schemas: LinkedHashMap, Nothing?>? = pathToSchemas[pathToItem] if (schemas != null) { @@ -477,13 +485,13 @@ abstract class JsonSchema protected constructor(jsonSchemaInfo: JsonSchemaInf val otherPathToSchemas = validate(jsonSchema, arg, validationMetadata) pathToSchemasMap.update(otherPathToSchemas) for (schemas in pathToSchemasMap.values) { - val firstSchema: JsonSchema<*> = schemas!!.entries.iterator().next().key!! + val firstSchema: JsonSchema<*> = schemas.entries.iterator().next().key schemas.clear() schemas[firstSchema] = null } - var mutPathSet: MutableSet> = pathSet.toMutableSet() + val mutPathSet: MutableSet> = pathSet.toMutableSet() mutPathSet.removeAll(pathToSchemasMap.keys) - if (!mutPathSet.isEmpty()) { + if (mutPathSet.isNotEmpty()) { val unsetAnyTypeSchema = LinkedHashMap, Nothing?>() unsetAnyTypeSchema[UnsetAnyTypeJsonSchema.UnsetAnyTypeJsonSchema1.getInstance()] = null for (pathToItem in mutPathSet) { diff --git a/src/main/resources/kotlin/src/main/kotlin/packagename/schemas/validation/JsonSchema.hbs b/src/main/resources/kotlin/src/main/kotlin/packagename/schemas/validation/JsonSchema.hbs index b057715a6f3..da68b52c10d 100644 --- a/src/main/resources/kotlin/src/main/kotlin/packagename/schemas/validation/JsonSchema.hbs +++ b/src/main/resources/kotlin/src/main/kotlin/packagename/schemas/validation/JsonSchema.hbs @@ -221,7 +221,7 @@ abstract class JsonSchema protected constructor(jsonSchemaInfo: JsonSchemaInf private fun getContainsPathToSchemas( arg: Any?, validationMetadata: ValidationMetadata - ): List? { + ): List { if (arg !is List<*> || contains == null) { return ArrayList() } @@ -229,8 +229,7 @@ abstract class JsonSchema protected constructor(jsonSchemaInfo: JsonSchemaInf val containsPathToSchemas: MutableList = ArrayList() for (i in arg.indices) { val thesePathToSchemas = PathToSchemasMap() - val itemPathToItem: MutableList = ArrayList(validationMetadata.pathToItem) - itemPathToItem.add(i) + val itemPathToItem: List = validationMetadata.pathToItem + i val itemValidationMetadata = ValidationMetadata( itemPathToItem, validationMetadata.configuration, @@ -265,8 +264,7 @@ abstract class JsonSchema protected constructor(jsonSchemaInfo: JsonSchemaInf for ((key, value) in arg) { val entryKey = key!! as? String ?: throw ValidationException("Invalid non-string type for map key") - val propPathToItem: MutableList = ArrayList(validationMetadata.pathToItem()) - propPathToItem.add(entryKey) + val propPathToItem: List = validationMetadata.pathToItem + entryKey val propValidationMetadata = ValidationMetadata( propPathToItem, validationMetadata.configuration, @@ -328,8 +326,7 @@ abstract class JsonSchema protected constructor(jsonSchemaInfo: JsonSchemaInf val argFixed: MutableList = ArrayList() var i = 0 for (item in arg) { - val newPathToItem: MutableList = ArrayList(pathToItem) - newPathToItem.add(i) + val newPathToItem: List = pathToItem + i val fixedVal = castToAllowedObjectTypes(item, newPathToItem, pathSet) argFixed.add(fixedVal) i += 1 @@ -349,10 +346,8 @@ abstract class JsonSchema protected constructor(jsonSchemaInfo: JsonSchemaInf if (entryKey !is String) { throw ValidationException("Invalid non-string key value") } - val `val` = value!! - val newPathToItem: MutableList = ArrayList(pathToItem) - newPathToItem.add(entryKey) - val fixedVal = castToAllowedObjectTypes(`val`, newPathToItem, pathSet) + val newPathToItem: List = pathToItem + entryKey + val fixedVal = castToAllowedObjectTypes(value, newPathToItem, pathSet) argFixed[entryKey] = fixedVal } return argFixed @@ -360,34 +355,47 @@ abstract class JsonSchema protected constructor(jsonSchemaInfo: JsonSchemaInf @Throws(ValidationException::class) private fun castToAllowedObjectTypes(arg: Any?, pathToItem: List, pathSet: MutableSet>): Any? { - return if (arg == null) { - castToAllowedTypes(arg, pathToItem, pathSet) - } else if (arg is String) { - castToAllowedTypes(arg, pathToItem, pathSet) - } else if (arg is Map<*, *>) { - pathSet.add(pathToItem) - castToAllowedTypes(arg, pathToItem, pathSet) - } else if (arg is Boolean) { - castToAllowedTypes(arg, pathToItem, pathSet) - } else if (arg is Int) { - castToAllowedTypes(arg as Number, pathToItem, pathSet) - } else if (arg is Long) { - castToAllowedTypes(arg as Number, pathToItem, pathSet) - } else if (arg is Float) { - castToAllowedTypes(arg as Number, pathToItem, pathSet) - } else if (arg is Double) { - castToAllowedTypes(arg as Number, pathToItem, pathSet) - } else if (arg is List<*>) { - castToAllowedTypes(arg, pathToItem, pathSet) - } else if (arg is ZonedDateTime) { - castToAllowedTypes(arg.toString(), pathToItem, pathSet) - } else if (arg is LocalDate) { - castToAllowedTypes(arg.toString(), pathToItem, pathSet) - } else if (arg is UUID) { - castToAllowedTypes(arg.toString(), pathToItem, pathSet) - } else { - val argClass: Class<*> = arg.javaClass - throw ValidationException("Invalid type passed in for input=$arg type=$argClass") + return when (arg) { + null -> { + castToAllowedTypes(null, pathToItem, pathSet) + } + is String -> { + castToAllowedTypes(arg, pathToItem, pathSet) + } + + is Map<*, *> -> { + pathSet.add(pathToItem) + castToAllowedTypes(arg, pathToItem, pathSet) + } + + is Boolean -> { + castToAllowedTypes(arg, pathToItem, pathSet) + } + + is Number -> { + castToAllowedTypes(arg, pathToItem, pathSet) + } + + is List<*> -> { + castToAllowedTypes(arg, pathToItem, pathSet) + } + + is ZonedDateTime -> { + castToAllowedTypes(arg.toString(), pathToItem, pathSet) + } + + is LocalDate -> { + castToAllowedTypes(arg.toString(), pathToItem, pathSet) + } + + is UUID -> { + castToAllowedTypes(arg.toString(), pathToItem, pathSet) + } + + else -> { + val argClass = arg.javaClass + throw ValidationException("Invalid type passed in for input=$arg type=$argClass") + } } } @@ -455,7 +463,7 @@ abstract class JsonSchema protected constructor(jsonSchemaInfo: JsonSchemaInf } val pathToItem: List = validationMetadata.pathToItem if (!pathToSchemas.containsKey(pathToItem)) { - pathToSchemas[validationMetadata.pathToItem] = LinkedHashMap() + pathToSchemas[validationMetadata.pathToItem] = LinkedHashMap() } val schemas: LinkedHashMap, Nothing?>? = pathToSchemas[pathToItem] if (schemas != null) { @@ -477,13 +485,13 @@ abstract class JsonSchema protected constructor(jsonSchemaInfo: JsonSchemaInf val otherPathToSchemas = validate(jsonSchema, arg, validationMetadata) pathToSchemasMap.update(otherPathToSchemas) for (schemas in pathToSchemasMap.values) { - val firstSchema: JsonSchema<*> = schemas!!.entries.iterator().next().key!! + val firstSchema: JsonSchema<*> = schemas.entries.iterator().next().key schemas.clear() schemas[firstSchema] = null } - var mutPathSet: MutableSet> = pathSet.toMutableSet() + val mutPathSet: MutableSet> = pathSet.toMutableSet() mutPathSet.removeAll(pathToSchemasMap.keys) - if (!mutPathSet.isEmpty()) { + if (mutPathSet.isNotEmpty()) { val unsetAnyTypeSchema = LinkedHashMap, Nothing?>() unsetAnyTypeSchema[UnsetAnyTypeJsonSchema.UnsetAnyTypeJsonSchema1.getInstance()] = null for (pathToItem in mutPathSet) { From d0ac93c726e00c46dc95da72f40f4bf82d0e818f Mon Sep 17 00:00:00 2001 From: Justin Black Date: Wed, 8 May 2024 12:08:58 -0700 Subject: [PATCH 29/78] Updates AllOfValidator --- .../AdditionalPropertiesValidator.kt | 3 +- .../schemas/validation/AllOfValidator.kt | 32 +++++++-------- .../schemas/validation/BigDecimalValidator.kt | 40 ++++++++++++------- .../schemas/validation/MultipleOfValidator.kt | 35 +++++++--------- .../AdditionalPropertiesValidator.hbs | 3 +- .../schemas/validation/AllOfValidator.hbs | 30 ++++++-------- .../validation/BigDecimalValidator.hbs | 35 ++++++++++------ .../validation/MultipleOfValidator.hbs | 28 ++++++------- 8 files changed, 104 insertions(+), 102 deletions(-) diff --git a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/schemas/validation/AdditionalPropertiesValidator.kt b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/schemas/validation/AdditionalPropertiesValidator.kt index 5dfbbb7b0fa..c7123fd5823 100644 --- a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/schemas/validation/AdditionalPropertiesValidator.kt +++ b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/schemas/validation/AdditionalPropertiesValidator.kt @@ -24,8 +24,7 @@ class AdditionalPropertiesValidator : KeywordValidator { val pathToSchemas = PathToSchemasMap() for (addPropName in presentAdditionalProperties) { val propValue: Any? = data.arg.get(addPropName) - val propPathToItem: MutableList = ArrayList(data.validationMetadata.pathToItem) - propPathToItem.add(addPropName) + val propPathToItem: List = data.validationMetadata.pathToItem + addPropName if (data.patternPropertiesPathToSchemas != null && data.patternPropertiesPathToSchemas .containsKey(propPathToItem) ) { diff --git a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/schemas/validation/AllOfValidator.kt b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/schemas/validation/AllOfValidator.kt index 4b969c68a20..f4c9c9f099f 100644 --- a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/schemas/validation/AllOfValidator.kt +++ b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/schemas/validation/AllOfValidator.kt @@ -1,23 +1,19 @@ -package org.openapijsonschematools.client.schemas.validation; +package org.openapijsonschematools.client.schemas.validation -import org.checkerframework.checker.nullness.qual.Nullable; -import org.openapijsonschematools.client.exceptions.ValidationException; +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; +class AllOfValidator : KeywordValidator { + @Throws(ValidationException::class) + override fun validate( + data: ValidationData + ): PathToSchemasMap? { + val allOf: List>> = data.schema.allOf ?: return null + val pathToSchemas = PathToSchemasMap() + for (allOfClass in allOf) { + val allOfSchema = JsonSchemaFactory.getInstance(allOfClass) + val otherPathToSchemas = JsonSchema.validate(allOfSchema, data.arg, data.validationMetadata) + pathToSchemas.update(otherPathToSchemas) } - PathToSchemasMap pathToSchemas = new PathToSchemasMap(); - for(Class> allOfClass: allOf) { - JsonSchema allOfSchema = JsonSchemaFactory.getInstance(allOfClass); - PathToSchemasMap otherPathToSchemas = JsonSchema.validate(allOfSchema, data.arg(), data.validationMetadata()); - pathToSchemas.update(otherPathToSchemas); - } - return pathToSchemas; + return pathToSchemas } } diff --git a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/schemas/validation/BigDecimalValidator.kt b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/schemas/validation/BigDecimalValidator.kt index 639d32e889e..ea662867a25 100644 --- a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/schemas/validation/BigDecimalValidator.kt +++ b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/schemas/validation/BigDecimalValidator.kt @@ -1,21 +1,31 @@ -package org.openapijsonschematools.client.schemas.validation; +package org.openapijsonschematools.client.schemas.validation -import org.openapijsonschematools.client.exceptions.ValidationException; +import org.openapijsonschematools.client.exceptions.ValidationException +import java.math.BigDecimal -import java.math.BigDecimal; +abstract class BigDecimalValidator { + @Throws(ValidationException::class) + protected fun getBigDecimal(arg: Number): BigDecimal { + return when (arg) { + is Int -> { + BigDecimal(arg) + } -public abstract class BigDecimalValidator { - protected BigDecimal getBigDecimal(Number arg) throws ValidationException { - if (arg instanceof Integer) { - return new BigDecimal((Integer) arg); - } else if (arg instanceof Long) { - return new BigDecimal((Long) arg); - } else if (arg instanceof Float) { - return new BigDecimal(Float.toString((Float) arg)); - } else if (arg instanceof Double) { - return new BigDecimal(Double.toString((Double) arg)); - } else { - throw new ValidationException("Invalid type input for arg"); + is Long -> { + BigDecimal(arg) + } + + is Float -> { + BigDecimal(arg.toString()) + } + + is Double -> { + BigDecimal(arg.toString()) + } + + else -> { + throw ValidationException("Invalid type input for arg") + } } } } diff --git a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/schemas/validation/MultipleOfValidator.kt b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/schemas/validation/MultipleOfValidator.kt index d8273d04d9c..8af9262ff80 100644 --- a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/schemas/validation/MultipleOfValidator.kt +++ b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/schemas/validation/MultipleOfValidator.kt @@ -1,27 +1,22 @@ -package org.openapijsonschematools.client.schemas.validation; +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.math.BigDecimal -import java.math.BigDecimal; - -public class MultipleOfValidator extends BigDecimalValidator implements KeywordValidator { - @Override - public @Nullable PathToSchemasMap validate( - ValidationData data - ) throws ValidationException { - var multipleOf = data.schema().multipleOf; - if (multipleOf == null) { - return null; - } - if (!(data.arg() instanceof Number numberArg)) { - return null; +class MultipleOfValidator : BigDecimalValidator(), KeywordValidator { + @Throws(ValidationException::class) + override fun validate( + data: ValidationData + ): PathToSchemasMap? { + val multipleOf: BigDecimal = data.schema.multipleOf ?: return null + if (data.arg !is Number) { + return null } - BigDecimal castArg = getBigDecimal(numberArg); - String msg = "Value " + numberArg + " is invalid because it is not a multiple of " + multipleOf; + val castArg: BigDecimal = getBigDecimal(data.arg) + val msg = "Value ${data.arg} is invalid because it is not a multiple of $multipleOf" if (castArg.remainder(multipleOf).compareTo(BigDecimal.ZERO) != 0) { - throw new ValidationException(msg); + throw ValidationException(msg) } - return null; + return null } } \ No newline at end of file diff --git a/src/main/resources/kotlin/src/main/kotlin/packagename/schemas/validation/AdditionalPropertiesValidator.hbs b/src/main/resources/kotlin/src/main/kotlin/packagename/schemas/validation/AdditionalPropertiesValidator.hbs index e3d349ee561..daa4d7b5a20 100644 --- a/src/main/resources/kotlin/src/main/kotlin/packagename/schemas/validation/AdditionalPropertiesValidator.hbs +++ b/src/main/resources/kotlin/src/main/kotlin/packagename/schemas/validation/AdditionalPropertiesValidator.hbs @@ -24,8 +24,7 @@ class AdditionalPropertiesValidator : KeywordValidator { val pathToSchemas = PathToSchemasMap() for (addPropName in presentAdditionalProperties) { val propValue: Any? = data.arg.get(addPropName) - val propPathToItem: MutableList = ArrayList(data.validationMetadata.pathToItem) - propPathToItem.add(addPropName) + val propPathToItem: List = data.validationMetadata.pathToItem + addPropName if (data.patternPropertiesPathToSchemas != null && data.patternPropertiesPathToSchemas .containsKey(propPathToItem) ) { diff --git a/src/main/resources/kotlin/src/main/kotlin/packagename/schemas/validation/AllOfValidator.hbs b/src/main/resources/kotlin/src/main/kotlin/packagename/schemas/validation/AllOfValidator.hbs index e4d3b3e0d78..4ab7af7c450 100644 --- a/src/main/resources/kotlin/src/main/kotlin/packagename/schemas/validation/AllOfValidator.hbs +++ b/src/main/resources/kotlin/src/main/kotlin/packagename/schemas/validation/AllOfValidator.hbs @@ -1,23 +1,19 @@ 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; +class AllOfValidator : KeywordValidator { + @Throws(ValidationException::class) + override fun validate( + data: ValidationData + ): PathToSchemasMap? { + val allOf: List>> = data.schema.allOf ?: return null + val pathToSchemas = PathToSchemasMap() + for (allOfClass in allOf) { + val allOfSchema = JsonSchemaFactory.getInstance(allOfClass) + val otherPathToSchemas = JsonSchema.validate(allOfSchema, data.arg, data.validationMetadata) + pathToSchemas.update(otherPathToSchemas) } - PathToSchemasMap pathToSchemas = new PathToSchemasMap(); - for(Class> allOfClass: allOf) { - JsonSchema allOfSchema = JsonSchemaFactory.getInstance(allOfClass); - PathToSchemasMap otherPathToSchemas = JsonSchema.validate(allOfSchema, data.arg(), data.validationMetadata()); - pathToSchemas.update(otherPathToSchemas); - } - return pathToSchemas; + return pathToSchemas } -} +} \ No newline at end of file diff --git a/src/main/resources/kotlin/src/main/kotlin/packagename/schemas/validation/BigDecimalValidator.hbs b/src/main/resources/kotlin/src/main/kotlin/packagename/schemas/validation/BigDecimalValidator.hbs index 47a5be850ee..96a4754e6b4 100644 --- a/src/main/resources/kotlin/src/main/kotlin/packagename/schemas/validation/BigDecimalValidator.hbs +++ b/src/main/resources/kotlin/src/main/kotlin/packagename/schemas/validation/BigDecimalValidator.hbs @@ -4,18 +4,29 @@ import {{{packageName}}}.exceptions.ValidationException; import java.math.BigDecimal; -public abstract class BigDecimalValidator { - protected BigDecimal getBigDecimal(Number arg) throws ValidationException { - if (arg instanceof Integer) { - return new BigDecimal((Integer) arg); - } else if (arg instanceof Long) { - return new BigDecimal((Long) arg); - } else if (arg instanceof Float) { - return new BigDecimal(Float.toString((Float) arg)); - } else if (arg instanceof Double) { - return new BigDecimal(Double.toString((Double) arg)); - } else { - throw new ValidationException("Invalid type input for arg"); +abstract class BigDecimalValidator { + @Throws(ValidationException::class) + protected fun getBigDecimal(arg: Number): BigDecimal { + return when (arg) { + is Int -> { + BigDecimal(arg) + } + + is Long -> { + BigDecimal(arg) + } + + is Float -> { + BigDecimal(arg.toString()) + } + + is Double -> { + BigDecimal(arg.toString()) + } + + else -> { + throw ValidationException("Invalid type input for arg") + } } } } diff --git a/src/main/resources/kotlin/src/main/kotlin/packagename/schemas/validation/MultipleOfValidator.hbs b/src/main/resources/kotlin/src/main/kotlin/packagename/schemas/validation/MultipleOfValidator.hbs index 2b97d0ae2ed..42575621098 100644 --- a/src/main/resources/kotlin/src/main/kotlin/packagename/schemas/validation/MultipleOfValidator.hbs +++ b/src/main/resources/kotlin/src/main/kotlin/packagename/schemas/validation/MultipleOfValidator.hbs @@ -1,27 +1,23 @@ package {{{packageName}}}.schemas.validation; import {{{packageName}}}.exceptions.ValidationException; -import org.checkerframework.checker.nullness.qual.Nullable; import java.math.BigDecimal; -public class MultipleOfValidator extends BigDecimalValidator implements KeywordValidator { - @Override - public @Nullable PathToSchemasMap validate( - ValidationData data - ) throws ValidationException { - var multipleOf = data.schema().multipleOf; - if (multipleOf == null) { - return null; +class MultipleOfValidator : BigDecimalValidator(), KeywordValidator { + @Throws(ValidationException::class) + override fun validate( + data: ValidationData + ): PathToSchemasMap? { + val multipleOf: BigDecimal = data.schema.multipleOf ?: return null + if (data.arg !is Number) { + return null } - if (!(data.arg() instanceof Number numberArg)) { - return null; - } - BigDecimal castArg = getBigDecimal(numberArg); - String msg = "Value " + numberArg + " is invalid because it is not a multiple of " + multipleOf; + val castArg: BigDecimal = getBigDecimal(data.arg) + val msg = "Value ${data.arg} is invalid because it is not a multiple of $multipleOf" if (castArg.remainder(multipleOf).compareTo(BigDecimal.ZERO) != 0) { - throw new ValidationException(msg); + throw ValidationException(msg) } - return null; + return null } } \ No newline at end of file From 646db81ca480bfd811caaab9a4c0210b9356aab0 Mon Sep 17 00:00:00 2001 From: Justin Black Date: Wed, 8 May 2024 12:16:09 -0700 Subject: [PATCH 30/78] Updates anyof and oneof validators --- .../schemas/validation/AnyOfValidator.kt | 54 +++++++--------- .../schemas/validation/OneOfValidator.kt | 63 +++++++++---------- .../schemas/validation/AnyOfValidator.hbs | 52 +++++++-------- .../schemas/validation/OneOfValidator.hbs | 61 +++++++++--------- 4 files changed, 104 insertions(+), 126 deletions(-) diff --git a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/schemas/validation/AnyOfValidator.kt b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/schemas/validation/AnyOfValidator.kt index 19d4e0337c9..31dd5ce3041 100644 --- a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/schemas/validation/AnyOfValidator.kt +++ b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/schemas/validation/AnyOfValidator.kt @@ -1,45 +1,39 @@ -package org.openapijsonschematools.client.schemas.validation; +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.ArrayList; -import java.util.List; - -public class AnyOfValidator implements KeywordValidator { - @Override - public @Nullable PathToSchemasMap validate( - ValidationData data - ) throws ValidationException { - var anyOf = data.schema().anyOf; - if (anyOf == null) { - return null; - } - PathToSchemasMap pathToSchemas = new PathToSchemasMap(); - List>> validatedAnyOfClasses = new ArrayList<>(); - for(Class> anyOfClass: anyOf) { - if (anyOfClass == data.schema().getClass()) { +class AnyOfValidator : KeywordValidator { + @Throws(ValidationException::class) + override fun validate( + data: ValidationData + ): PathToSchemasMap? { + val anyOf: List>> = data.schema.anyOf ?: return null + val pathToSchemas = PathToSchemasMap() + val validatedAnyOfClasses: MutableList>> = ArrayList() + for (anyOfClass in anyOf) { + if (anyOfClass == data.schema.javaClass) { /* optimistically assume that schema will pass validation do not invoke _validate on it because that is recursive */ - validatedAnyOfClasses.add(anyOfClass); - continue; + validatedAnyOfClasses.add(anyOfClass) + continue } try { - JsonSchema anyOfSchema = JsonSchemaFactory.getInstance(anyOfClass); - PathToSchemasMap otherPathToSchemas = JsonSchema.validate(anyOfSchema, data.arg(), data.validationMetadata()); - validatedAnyOfClasses.add(anyOfClass); - pathToSchemas.update(otherPathToSchemas); - } catch (ValidationException e) { + val anyOfSchema = JsonSchemaFactory.getInstance(anyOfClass) + val otherPathToSchemas = JsonSchema.validate(anyOfSchema, data.arg, data.validationMetadata) + validatedAnyOfClasses.add(anyOfClass) + pathToSchemas.update(otherPathToSchemas) + } catch (e: ValidationException) { // silence exceptions because the code needs to accumulate anyof_classes } } if (validatedAnyOfClasses.isEmpty()) { - throw new ValidationException("Invalid inputs given to generate an instance of "+data.schema().getClass()+". None "+ - "of the anyOf schemas matched the input data." - ); + throw ValidationException( + "Invalid inputs given to generate an instance of " + data.schema.javaClass.simpleName + ". None " + + "of the anyOf schemas matched the input data." + ) } - return pathToSchemas; + return pathToSchemas } } diff --git a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/schemas/validation/OneOfValidator.kt b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/schemas/validation/OneOfValidator.kt index 7dd5f4128ac..53be8889574 100644 --- a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/schemas/validation/OneOfValidator.kt +++ b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/schemas/validation/OneOfValidator.kt @@ -1,50 +1,45 @@ -package org.openapijsonschematools.client.schemas.validation; +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.ArrayList; -import java.util.List; - -public class OneOfValidator implements KeywordValidator { - @Override - public @Nullable PathToSchemasMap validate( - ValidationData data - ) throws ValidationException { - var oneOf = data.schema().oneOf; - if (oneOf == null) { - return null; - } - PathToSchemasMap pathToSchemas = new PathToSchemasMap(); - List>> validatedOneOfClasses = new ArrayList<>(); - for(Class> oneOfClass: oneOf) { - if (oneOfClass == data.schema().getClass()) { +class OneOfValidator : KeywordValidator { + @Throws(ValidationException::class) + override fun validate( + data: ValidationData + ): PathToSchemasMap? { + val oneOf: List>> = data.schema.oneOf ?: return null + val pathToSchemas = PathToSchemasMap() + val validatedOneOfClasses: MutableList>> = ArrayList() + for (oneOfClass in oneOf) { + if (oneOfClass == data.schema.javaClass) { /* optimistically assume that schema will pass validation do not invoke validate on it because that is recursive */ - validatedOneOfClasses.add(oneOfClass); - continue; + validatedOneOfClasses.add(oneOfClass) + continue } try { - JsonSchema oneOfSchema = JsonSchemaFactory.getInstance(oneOfClass); - PathToSchemasMap otherPathToSchemas = JsonSchema.validate(oneOfSchema, data.arg(), data.validationMetadata()); - validatedOneOfClasses.add(oneOfClass); - pathToSchemas.update(otherPathToSchemas); - } catch (ValidationException e) { + val oneOfSchema = JsonSchemaFactory.getInstance(oneOfClass) + val otherPathToSchemas = JsonSchema.validate(oneOfSchema, data.arg, data.validationMetadata) + validatedOneOfClasses.add(oneOfClass) + pathToSchemas.update(otherPathToSchemas) + } catch (e: ValidationException) { // silence exceptions because the code needs to accumulate validatedOneOfClasses } } if (validatedOneOfClasses.isEmpty()) { - throw new ValidationException("Invalid inputs given to generate an instance of "+data.schema().getClass()+". None "+ - "of the oneOf schemas matched the input data." - ); + throw ValidationException( + "Invalid inputs given to generate an instance of " + data.schema.javaClass + ". None " + + "of the oneOf schemas matched the input data." + ) } - if (validatedOneOfClasses.size() > 1) { - throw new ValidationException("Invalid inputs given to generate an instance of "+data.schema().getClass()+". Multiple "+ - "oneOf schemas validated the data, but a max of one is allowed." - ); + if (validatedOneOfClasses.size > 1) { + throw ValidationException( + "Invalid inputs given to generate an instance of " + data.schema.javaClass + + ". Multiple oneOf schemas validated the data, but a max of one is allowed." + ) } - return pathToSchemas; + return pathToSchemas } } diff --git a/src/main/resources/kotlin/src/main/kotlin/packagename/schemas/validation/AnyOfValidator.hbs b/src/main/resources/kotlin/src/main/kotlin/packagename/schemas/validation/AnyOfValidator.hbs index 16514902bde..639db2e2061 100644 --- a/src/main/resources/kotlin/src/main/kotlin/packagename/schemas/validation/AnyOfValidator.hbs +++ b/src/main/resources/kotlin/src/main/kotlin/packagename/schemas/validation/AnyOfValidator.hbs @@ -1,45 +1,39 @@ package {{{packageName}}}.schemas.validation; import {{{packageName}}}.exceptions.ValidationException; -import org.checkerframework.checker.nullness.qual.Nullable; -import java.util.ArrayList; -import java.util.List; - -public class AnyOfValidator implements KeywordValidator { - @Override - public @Nullable PathToSchemasMap validate( - ValidationData data - ) throws ValidationException { - var anyOf = data.schema().anyOf; - if (anyOf == null) { - return null; - } - PathToSchemasMap pathToSchemas = new PathToSchemasMap(); - List>> validatedAnyOfClasses = new ArrayList<>(); - for(Class> anyOfClass: anyOf) { - if (anyOfClass == data.schema().getClass()) { +class AnyOfValidator : KeywordValidator { + @Throws(ValidationException::class) + override fun validate( + data: ValidationData + ): PathToSchemasMap? { + val anyOf: List>> = data.schema.anyOf ?: return null + val pathToSchemas = PathToSchemasMap() + val validatedAnyOfClasses: MutableList>> = ArrayList() + for (anyOfClass in anyOf) { + if (anyOfClass == data.schema.javaClass) { /* optimistically assume that schema will pass validation do not invoke _validate on it because that is recursive */ - validatedAnyOfClasses.add(anyOfClass); - continue; + validatedAnyOfClasses.add(anyOfClass) + continue } try { - JsonSchema anyOfSchema = JsonSchemaFactory.getInstance(anyOfClass); - PathToSchemasMap otherPathToSchemas = JsonSchema.validate(anyOfSchema, data.arg(), data.validationMetadata()); - validatedAnyOfClasses.add(anyOfClass); - pathToSchemas.update(otherPathToSchemas); - } catch (ValidationException e) { + val anyOfSchema = JsonSchemaFactory.getInstance(anyOfClass) + val otherPathToSchemas = JsonSchema.validate(anyOfSchema, data.arg, data.validationMetadata) + validatedAnyOfClasses.add(anyOfClass) + pathToSchemas.update(otherPathToSchemas) + } catch (e: ValidationException) { // silence exceptions because the code needs to accumulate anyof_classes } } if (validatedAnyOfClasses.isEmpty()) { - throw new ValidationException("Invalid inputs given to generate an instance of "+data.schema().getClass()+". None "+ - "of the anyOf schemas matched the input data." - ); + throw ValidationException( + "Invalid inputs given to generate an instance of " + data.schema.javaClass.simpleName + ". None " + + "of the anyOf schemas matched the input data." + ) } - return pathToSchemas; + return pathToSchemas } -} +} \ No newline at end of file diff --git a/src/main/resources/kotlin/src/main/kotlin/packagename/schemas/validation/OneOfValidator.hbs b/src/main/resources/kotlin/src/main/kotlin/packagename/schemas/validation/OneOfValidator.hbs index d4fc3652aef..a9e421b2262 100644 --- a/src/main/resources/kotlin/src/main/kotlin/packagename/schemas/validation/OneOfValidator.hbs +++ b/src/main/resources/kotlin/src/main/kotlin/packagename/schemas/validation/OneOfValidator.hbs @@ -1,50 +1,45 @@ package {{{packageName}}}.schemas.validation; import {{{packageName}}}.exceptions.ValidationException; -import org.checkerframework.checker.nullness.qual.Nullable; -import java.util.ArrayList; -import java.util.List; - -public class OneOfValidator implements KeywordValidator { - @Override - public @Nullable PathToSchemasMap validate( - ValidationData data - ) throws ValidationException { - var oneOf = data.schema().oneOf; - if (oneOf == null) { - return null; - } - PathToSchemasMap pathToSchemas = new PathToSchemasMap(); - List>> validatedOneOfClasses = new ArrayList<>(); - for(Class> oneOfClass: oneOf) { - if (oneOfClass == data.schema().getClass()) { +class OneOfValidator : KeywordValidator { + @Throws(ValidationException::class) + override fun validate( + data: ValidationData + ): PathToSchemasMap? { + val oneOf: List>> = data.schema.oneOf ?: return null + val pathToSchemas = PathToSchemasMap() + val validatedOneOfClasses: MutableList>> = ArrayList() + for (oneOfClass in oneOf) { + if (oneOfClass == data.schema.javaClass) { /* optimistically assume that schema will pass validation do not invoke validate on it because that is recursive */ - validatedOneOfClasses.add(oneOfClass); - continue; + validatedOneOfClasses.add(oneOfClass) + continue } try { - JsonSchema oneOfSchema = JsonSchemaFactory.getInstance(oneOfClass); - PathToSchemasMap otherPathToSchemas = JsonSchema.validate(oneOfSchema, data.arg(), data.validationMetadata()); - validatedOneOfClasses.add(oneOfClass); - pathToSchemas.update(otherPathToSchemas); - } catch (ValidationException e) { + val oneOfSchema = JsonSchemaFactory.getInstance(oneOfClass) + val otherPathToSchemas = JsonSchema.validate(oneOfSchema, data.arg, data.validationMetadata) + validatedOneOfClasses.add(oneOfClass) + pathToSchemas.update(otherPathToSchemas) + } catch (e: ValidationException) { // silence exceptions because the code needs to accumulate validatedOneOfClasses } } if (validatedOneOfClasses.isEmpty()) { - throw new ValidationException("Invalid inputs given to generate an instance of "+data.schema().getClass()+". None "+ - "of the oneOf schemas matched the input data." - ); + throw ValidationException( + "Invalid inputs given to generate an instance of " + data.schema.javaClass + ". None " + + "of the oneOf schemas matched the input data." + ) } - if (validatedOneOfClasses.size() > 1) { - throw new ValidationException("Invalid inputs given to generate an instance of "+data.schema().getClass()+". Multiple "+ - "oneOf schemas validated the data, but a max of one is allowed." - ); + if (validatedOneOfClasses.size > 1) { + throw ValidationException( + "Invalid inputs given to generate an instance of " + data.schema.javaClass + + ". Multiple oneOf schemas validated the data, but a max of one is allowed." + ) } - return pathToSchemas; + return pathToSchemas } -} +} \ No newline at end of file From f9addbf3147cb4a63d6bf06968d90648af539fa7 Mon Sep 17 00:00:00 2001 From: Justin Black Date: Wed, 8 May 2024 12:26:27 -0700 Subject: [PATCH 31/78] Updates not and unique items validators --- .../client/schemas/validation/NotValidator.kt | 41 ++++++++--------- .../validation/UniqueItemsValidator.kt | 44 ++++++++----------- .../schemas/validation/NotValidator.hbs | 37 +++++++--------- .../validation/UniqueItemsValidator.hbs | 40 +++++++---------- 4 files changed, 68 insertions(+), 94 deletions(-) diff --git a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/schemas/validation/NotValidator.kt b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/schemas/validation/NotValidator.kt index 3e6b8e91e7c..fe2eeaa2dfa 100644 --- a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/schemas/validation/NotValidator.kt +++ b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/schemas/validation/NotValidator.kt @@ -1,30 +1,25 @@ -package org.openapijsonschematools.client.schemas.validation; +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 -public class NotValidator implements KeywordValidator { - @Override - public @Nullable PathToSchemasMap validate( - ValidationData data - ) throws ValidationException { - var not = data.schema().not; - if (not == null) { - return null; - } - PathToSchemasMap pathToSchemas; - try { - JsonSchema notSchema = JsonSchemaFactory.getInstance(not); - pathToSchemas = JsonSchema.validate(notSchema, data.arg(), data.validationMetadata()); - } catch (ValidationException e) { - return null; +class NotValidator : KeywordValidator { + @Throws(ValidationException::class) + override fun validate( + data: ValidationData + ): PathToSchemasMap? { + val not: Class> = data.schema.not ?: return null + val pathToSchemas: PathToSchemasMap = try { + val notSchema = JsonSchemaFactory.getInstance(not) + JsonSchema.validate(notSchema, data.arg, data.validationMetadata) + } catch (e: ValidationException) { + return null } if (!pathToSchemas.isEmpty()) { - throw new ValidationException( - "Invalid value "+data.arg()+" was passed in to "+data.schema().getClass()+". "+ - "Value is invalid because it is disallowed by not "+not - ); + throw ValidationException( + "Invalid value " + data.arg + " was passed in to " + data.schema.javaClass + + ". Value is invalid because it is disallowed by not " + not + ) } - return null; + return null } } diff --git a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/schemas/validation/UniqueItemsValidator.kt b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/schemas/validation/UniqueItemsValidator.kt index 6b40ba79fff..2c2f41591b0 100644 --- a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/schemas/validation/UniqueItemsValidator.kt +++ b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/schemas/validation/UniqueItemsValidator.kt @@ -1,35 +1,27 @@ -package org.openapijsonschematools.client.schemas.validation; +package org.openapijsonschematools.client.schemas.validation -import org.checkerframework.checker.nullness.qual.Nullable; -import org.openapijsonschematools.client.exceptions.ValidationException; +import org.openapijsonschematools.client.exceptions.ValidationException -import java.util.HashSet; -import java.util.List; -import java.util.Set; - -public class UniqueItemsValidator implements KeywordValidator { - @Override - public @Nullable PathToSchemasMap validate( - ValidationData data - ) throws ValidationException { - var uniqueItems = data.schema().uniqueItems; - if (uniqueItems == null) { - return null; - } - if (!(data.arg() instanceof List listArg)) { - return null; +class UniqueItemsValidator : KeywordValidator { + @Throws(ValidationException::class) + override fun validate( + data: ValidationData + ): PathToSchemasMap? { + val uniqueItems: Boolean = data.schema.uniqueItems ?: return null + if (data.arg !is List<*>) { + return null } if (!uniqueItems) { - return null; + return null } - Set<@Nullable Object> seenItems = new HashSet<>(); - for (@Nullable Object item: listArg) { - int startingSeenItemsSize = seenItems.size(); - seenItems.add(item); - if (seenItems.size() == startingSeenItemsSize) { - throw new ValidationException("Invalid list value, list contains duplicate items when uniqueItems is true"); + val seenItems: MutableSet = HashSet() + for (item in data.arg) { + val startingSeenItemsSize = seenItems.size + seenItems.add(item) + if (seenItems.size == startingSeenItemsSize) { + throw ValidationException("Invalid list value, list contains duplicate items when uniqueItems is true") } } - return null; + return null } } diff --git a/src/main/resources/kotlin/src/main/kotlin/packagename/schemas/validation/NotValidator.hbs b/src/main/resources/kotlin/src/main/kotlin/packagename/schemas/validation/NotValidator.hbs index 388fa8cee0d..a8f479b1a53 100644 --- a/src/main/resources/kotlin/src/main/kotlin/packagename/schemas/validation/NotValidator.hbs +++ b/src/main/resources/kotlin/src/main/kotlin/packagename/schemas/validation/NotValidator.hbs @@ -1,30 +1,25 @@ package {{{packageName}}}.schemas.validation; import {{{packageName}}}.exceptions.ValidationException; -import org.checkerframework.checker.nullness.qual.Nullable; -public class NotValidator implements KeywordValidator { - @Override - public @Nullable PathToSchemasMap validate( - ValidationData data - ) throws ValidationException { - var not = data.schema().not; - if (not == null) { - return null; - } - PathToSchemasMap pathToSchemas; - try { - JsonSchema notSchema = JsonSchemaFactory.getInstance(not); - pathToSchemas = JsonSchema.validate(notSchema, data.arg(), data.validationMetadata()); - } catch (ValidationException e) { - return null; +class NotValidator : KeywordValidator { + @Throws(ValidationException::class) + override fun validate( + data: ValidationData + ): PathToSchemasMap? { + val not: Class> = data.schema.not ?: return null + val pathToSchemas: PathToSchemasMap = try { + val notSchema = JsonSchemaFactory.getInstance(not) + JsonSchema.validate(notSchema, data.arg, data.validationMetadata) + } catch (e: ValidationException) { + return null } if (!pathToSchemas.isEmpty()) { - throw new ValidationException( - "Invalid value "+data.arg()+" was passed in to "+data.schema().getClass()+". "+ - "Value is invalid because it is disallowed by not "+not - ); + throw ValidationException( + "Invalid value " + data.arg + " was passed in to " + data.schema.javaClass + + ". Value is invalid because it is disallowed by not " + not + ) } - return null; + return null } } diff --git a/src/main/resources/kotlin/src/main/kotlin/packagename/schemas/validation/UniqueItemsValidator.hbs b/src/main/resources/kotlin/src/main/kotlin/packagename/schemas/validation/UniqueItemsValidator.hbs index aba5b63684c..1ff48ea2f7c 100644 --- a/src/main/resources/kotlin/src/main/kotlin/packagename/schemas/validation/UniqueItemsValidator.hbs +++ b/src/main/resources/kotlin/src/main/kotlin/packagename/schemas/validation/UniqueItemsValidator.hbs @@ -1,35 +1,27 @@ package {{{packageName}}}.schemas.validation; -import org.checkerframework.checker.nullness.qual.Nullable; import {{{packageName}}}.exceptions.ValidationException; -import java.util.HashSet; -import java.util.List; -import java.util.Set; - -public class UniqueItemsValidator implements KeywordValidator { - @Override - public @Nullable PathToSchemasMap validate( - ValidationData data - ) throws ValidationException { - var uniqueItems = data.schema().uniqueItems; - if (uniqueItems == null) { - return null; - } - if (!(data.arg() instanceof List listArg)) { - return null; +class UniqueItemsValidator : KeywordValidator { + @Throws(ValidationException::class) + override fun validate( + data: ValidationData + ): PathToSchemasMap? { + val uniqueItems: Boolean = data.schema.uniqueItems ?: return null + if (data.arg !is List<*>) { + return null } if (!uniqueItems) { - return null; + return null } - Set<@Nullable Object> seenItems = new HashSet<>(); - for (@Nullable Object item: listArg) { - int startingSeenItemsSize = seenItems.size(); - seenItems.add(item); - if (seenItems.size() == startingSeenItemsSize) { - throw new ValidationException("Invalid list value, list contains duplicate items when uniqueItems is true"); + val seenItems: MutableSet = HashSet() + for (item in data.arg) { + val startingSeenItemsSize = seenItems.size + seenItems.add(item) + if (seenItems.size == startingSeenItemsSize) { + throw ValidationException("Invalid list value, list contains duplicate items when uniqueItems is true") } } - return null; + return null } } From 006774b47ec463ca4ed0fd05d32a1627de5a6326 Mon Sep 17 00:00:00 2001 From: Justin Black Date: Wed, 8 May 2024 15:23:43 -0700 Subject: [PATCH 32/78] Updates enum + pattern validators --- .../schemas/validation/EnumValidator.kt | 55 +++++++++---------- .../schemas/validation/PatternValidator.kt | 31 +++++------ .../schemas/validation/EnumValidator.hbs | 50 ++++++++--------- .../schemas/validation/PatternValidator.hbs | 26 ++++----- 4 files changed, 73 insertions(+), 89 deletions(-) diff --git a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/schemas/validation/EnumValidator.kt b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/schemas/validation/EnumValidator.kt index 66563d80960..a7435100340 100644 --- a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/schemas/validation/EnumValidator.kt +++ b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/schemas/validation/EnumValidator.kt @@ -1,43 +1,38 @@ -package org.openapijsonschematools.client.schemas.validation; +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.math.BigDecimal -import java.math.BigDecimal; -import java.util.Set; - -public class EnumValidator extends BigDecimalValidator implements KeywordValidator { - @SuppressWarnings("nullness") - private static boolean enumContainsArg(Set<@Nullable Object> enumValues, @Nullable Object arg){ - return enumValues.contains(arg); - } - - @Override - public @Nullable PathToSchemasMap validate( - ValidationData data - ) throws ValidationException { - var enumValues = data.schema().enumValues; - if (enumValues == null) { - return null; - } +class EnumValidator : BigDecimalValidator(), KeywordValidator { + @Throws(ValidationException::class) + override fun validate( + data: ValidationData + ): PathToSchemasMap? { + val enumValues: Set = data.schema.enumValues ?: return null if (enumValues.isEmpty()) { - throw new ValidationException("No value can match enum because enum is empty"); + throw ValidationException("No value can match enum because enum is empty") } - if (data.arg() instanceof Number numberArg) { - BigDecimal castArg = getBigDecimal(numberArg); + if (data.arg is Number) { + val castArg = getBigDecimal(data.arg) if (enumContainsArg(enumValues, castArg)) { - return null; + return null } - for (Object enumValue: enumValues) { - if (enumValue instanceof BigDecimal && ((BigDecimal) enumValue).compareTo(castArg) == 0) { - return null; + for (enumValue in enumValues) { + if (enumValue is BigDecimal && enumValue.compareTo(castArg) == 0) { + return null } } } else { - if (enumContainsArg(enumValues, data.arg())) { - return null; + if (enumContainsArg(enumValues, data.arg)) { + return null } } - throw new ValidationException("Invalid value "+data.arg()+" was not one of the allowed enum "+enumValues); + throw ValidationException("Invalid value " + data.arg + " was not one of the allowed enum " + enumValues) + } + + companion object { + private fun enumContainsArg(enumValues: Set, arg: Any?): Boolean { + return enumValues.contains(arg) + } } } diff --git a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/schemas/validation/PatternValidator.kt b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/schemas/validation/PatternValidator.kt index d7eebd78098..1f9010a65a9 100644 --- a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/schemas/validation/PatternValidator.kt +++ b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/schemas/validation/PatternValidator.kt @@ -1,23 +1,20 @@ -package org.openapijsonschematools.client.schemas.validation; +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.regex.Pattern -public class PatternValidator implements KeywordValidator { - @Override - public @Nullable PathToSchemasMap validate( - ValidationData data - ) throws ValidationException { - var pattern = data.schema().pattern; - if (pattern == null) { - return null; +class PatternValidator : KeywordValidator { + @Throws(ValidationException::class) + override fun validate( + data: ValidationData + ): PathToSchemasMap? { + val pattern: Pattern = data.schema.pattern ?: return null + if (data.arg !is String) { + return null } - if (!(data.arg() instanceof String stringArg)) { - return null; + if (!pattern.matcher(data.arg).find()) { + throw ValidationException("Invalid value ${data.arg} did not find a match for pattern $pattern") } - if (!pattern.matcher(stringArg).find()) { - throw new ValidationException("Invalid value "+stringArg+" did not find a match for pattern "+pattern); - } - return null; + return null } } \ No newline at end of file diff --git a/src/main/resources/kotlin/src/main/kotlin/packagename/schemas/validation/EnumValidator.hbs b/src/main/resources/kotlin/src/main/kotlin/packagename/schemas/validation/EnumValidator.hbs index 3d95fc99cfa..b246a030560 100644 --- a/src/main/resources/kotlin/src/main/kotlin/packagename/schemas/validation/EnumValidator.hbs +++ b/src/main/resources/kotlin/src/main/kotlin/packagename/schemas/validation/EnumValidator.hbs @@ -1,43 +1,39 @@ package {{{packageName}}}.schemas.validation; import {{{packageName}}}.exceptions.ValidationException; -import org.checkerframework.checker.nullness.qual.Nullable; import java.math.BigDecimal; -import java.util.Set; -public class EnumValidator extends BigDecimalValidator implements KeywordValidator { - @SuppressWarnings("nullness") - private static boolean enumContainsArg(Set<@Nullable Object> enumValues, @Nullable Object arg){ - return enumValues.contains(arg); - } - - @Override - public @Nullable PathToSchemasMap validate( - ValidationData data - ) throws ValidationException { - var enumValues = data.schema().enumValues; - if (enumValues == null) { - return null; - } +class EnumValidator : BigDecimalValidator(), KeywordValidator { + @Throws(ValidationException::class) + override fun validate( + data: ValidationData + ): PathToSchemasMap? { + val enumValues: Set = data.schema.enumValues ?: return null if (enumValues.isEmpty()) { - throw new ValidationException("No value can match enum because enum is empty"); + throw ValidationException("No value can match enum because enum is empty") } - if (data.arg() instanceof Number numberArg) { - BigDecimal castArg = getBigDecimal(numberArg); + if (data.arg is Number) { + val castArg = getBigDecimal(data.arg) if (enumContainsArg(enumValues, castArg)) { - return null; + return null } - for (Object enumValue: enumValues) { - if (enumValue instanceof BigDecimal && ((BigDecimal) enumValue).compareTo(castArg) == 0) { - return null; + for (enumValue in enumValues) { + if (enumValue is BigDecimal && enumValue.compareTo(castArg) == 0) { + return null } } } else { - if (enumContainsArg(enumValues, data.arg())) { - return null; + if (enumContainsArg(enumValues, data.arg)) { + return null } } - throw new ValidationException("Invalid value "+data.arg()+" was not one of the allowed enum "+enumValues); + throw ValidationException("Invalid value " + data.arg + " was not one of the allowed enum " + enumValues) + } + + companion object { + private fun enumContainsArg(enumValues: Set, arg: Any?): Boolean { + return enumValues.contains(arg) + } } -} +} \ No newline at end of file diff --git a/src/main/resources/kotlin/src/main/kotlin/packagename/schemas/validation/PatternValidator.hbs b/src/main/resources/kotlin/src/main/kotlin/packagename/schemas/validation/PatternValidator.hbs index 08f40c93530..690e7fe47cb 100644 --- a/src/main/resources/kotlin/src/main/kotlin/packagename/schemas/validation/PatternValidator.hbs +++ b/src/main/resources/kotlin/src/main/kotlin/packagename/schemas/validation/PatternValidator.hbs @@ -1,23 +1,19 @@ package {{{packageName}}}.schemas.validation; import {{{packageName}}}.exceptions.ValidationException; -import org.checkerframework.checker.nullness.qual.Nullable; -public class PatternValidator implements KeywordValidator { - @Override - public @Nullable PathToSchemasMap validate( - ValidationData data - ) throws ValidationException { - var pattern = data.schema().pattern; - if (pattern == null) { - return null; +class PatternValidator : KeywordValidator { + @Throws(ValidationException::class) + override fun validate( + data: ValidationData + ): PathToSchemasMap? { + val pattern: Pattern = data.schema.pattern ?: return null + if (data.arg !is String) { + return null } - if (!(data.arg() instanceof String stringArg)) { - return null; + if (!pattern.matcher(data.arg).find()) { + throw ValidationException("Invalid value ${data.arg} did not find a match for pattern $pattern") } - if (!pattern.matcher(stringArg).find()) { - throw new ValidationException("Invalid value "+stringArg+" did not find a match for pattern "+pattern); - } - return null; + return null } } \ No newline at end of file From 1f7652b93c5fd6b3adaab45c6a46652771a221e0 Mon Sep 17 00:00:00 2001 From: Justin Black Date: Wed, 8 May 2024 15:39:42 -0700 Subject: [PATCH 33/78] Updates const and contains validator --- .../schemas/validation/ConstValidator.kt | 43 +++++++++---------- .../schemas/validation/ContainsValidator.kt | 41 ++++++++---------- .../schemas/validation/ConstValidator.hbs | 36 ++++++++-------- .../schemas/validation/ContainsValidator.hbs | 37 ++++++++-------- 4 files changed, 73 insertions(+), 84 deletions(-) diff --git a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/schemas/validation/ConstValidator.kt b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/schemas/validation/ConstValidator.kt index 93872adcc2f..7abc259d734 100644 --- a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/schemas/validation/ConstValidator.kt +++ b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/schemas/validation/ConstValidator.kt @@ -1,33 +1,30 @@ -package org.openapijsonschematools.client.schemas.validation; +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.math.BigDecimal -import java.math.BigDecimal; -import java.util.Objects; - -public class ConstValidator extends BigDecimalValidator implements KeywordValidator { - @Override - public @Nullable PathToSchemasMap validate( - ValidationData data - ) throws ValidationException { - if (!data.schema().constValueSet) { - return null; +class ConstValidator : BigDecimalValidator(), KeywordValidator { + @Throws(ValidationException::class) + override fun validate( + data: ValidationData + ): PathToSchemasMap? { + if (!data.schema.constValueSet) { + return null } - var constValue = data.schema().constValue; - if (data.arg() instanceof Number numberArg) { - BigDecimal castArg = getBigDecimal(numberArg); - if (Objects.equals(castArg, constValue)) { - return null; + val constValue: Any? = data.schema.constValue + if (data.arg is Number) { + val castArg = getBigDecimal(data.arg) + if (castArg == constValue) { + return null } - if (constValue instanceof BigDecimal && ((BigDecimal) constValue).compareTo(castArg) == 0) { - return null; + if (constValue is BigDecimal && constValue.compareTo(castArg) == 0) { + return null } } else { - if (Objects.equals(data.arg(), constValue)) { - return null; + if (data.arg == constValue) { + return null } } - throw new ValidationException("Invalid value "+data.arg()+" was not equal to const "+constValue); + throw ValidationException("Invalid value " + data.arg + " was not equal to const " + constValue) } } \ No newline at end of file diff --git a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/schemas/validation/ContainsValidator.kt b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/schemas/validation/ContainsValidator.kt index 41565577d58..133e45944c0 100644 --- a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/schemas/validation/ContainsValidator.kt +++ b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/schemas/validation/ContainsValidator.kt @@ -1,30 +1,27 @@ -package org.openapijsonschematools.client.schemas.validation; +package org.openapijsonschematools.client.schemas.validation -import org.checkerframework.checker.nullness.qual.Nullable; -import org.openapijsonschematools.client.exceptions.ValidationException; +import org.openapijsonschematools.client.exceptions.ValidationException -import java.util.List; - -public class ContainsValidator implements KeywordValidator { - @Override - public @Nullable PathToSchemasMap validate( - ValidationData data - ) throws ValidationException { - if (!(data.arg() instanceof List)) { - return null; +class ContainsValidator : KeywordValidator { + @Throws(ValidationException::class) + override fun validate( + data: ValidationData + ): PathToSchemasMap? { + if (data.arg !is List<*>) { + return null } - var containsPathToSchemas = data.containsPathToSchemas(); - if (containsPathToSchemas == null || containsPathToSchemas.isEmpty()) { - throw new ValidationException( - "Validation failed for contains keyword in class="+data.schema().getClass() - + " at pathToItem="+data.validationMetadata().pathToItem()+". No " + val containsPathToSchemas: List? = data.containsPathToSchemas + if (containsPathToSchemas.isNullOrEmpty()) { + throw ValidationException( + "Validation failed for contains keyword in class=${data.schema.javaClass}" + + " at pathToItem=${data.validationMetadata.pathToItem}. No " + "items validated to the contains schema." - ); + ) } - PathToSchemasMap pathToSchemas = new PathToSchemasMap(); - for (PathToSchemasMap otherPathToSchema: containsPathToSchemas) { - pathToSchemas.update(otherPathToSchema); + val pathToSchemas = PathToSchemasMap() + for (otherPathToSchema in containsPathToSchemas) { + pathToSchemas.update(otherPathToSchema) } - return pathToSchemas; + return pathToSchemas } } \ No newline at end of file diff --git a/src/main/resources/kotlin/src/main/kotlin/packagename/schemas/validation/ConstValidator.hbs b/src/main/resources/kotlin/src/main/kotlin/packagename/schemas/validation/ConstValidator.hbs index c45ceaf07b2..dc781da65c6 100644 --- a/src/main/resources/kotlin/src/main/kotlin/packagename/schemas/validation/ConstValidator.hbs +++ b/src/main/resources/kotlin/src/main/kotlin/packagename/schemas/validation/ConstValidator.hbs @@ -1,33 +1,31 @@ package {{{packageName}}}.schemas.validation; import {{{packageName}}}.exceptions.ValidationException; -import org.checkerframework.checker.nullness.qual.Nullable; import java.math.BigDecimal; -import java.util.Objects; -public class ConstValidator extends BigDecimalValidator implements KeywordValidator { - @Override - public @Nullable PathToSchemasMap validate( - ValidationData data - ) throws ValidationException { - if (!data.schema().constValueSet) { - return null; +class ConstValidator : BigDecimalValidator(), KeywordValidator { + @Throws(ValidationException::class) + override fun validate( + data: ValidationData + ): PathToSchemasMap? { + if (!data.schema.constValueSet) { + return null } - var constValue = data.schema().constValue; - if (data.arg() instanceof Number numberArg) { - BigDecimal castArg = getBigDecimal(numberArg); - if (Objects.equals(castArg, constValue)) { - return null; + val constValue: Any? = data.schema.constValue + if (data.arg is Number) { + val castArg = getBigDecimal(data.arg) + if (castArg == constValue) { + return null } - if (constValue instanceof BigDecimal && ((BigDecimal) constValue).compareTo(castArg) == 0) { - return null; + if (constValue is BigDecimal && constValue.compareTo(castArg) == 0) { + return null } } else { - if (Objects.equals(data.arg(), constValue)) { - return null; + if (data.arg == constValue) { + return null } } - throw new ValidationException("Invalid value "+data.arg()+" was not equal to const "+constValue); + throw ValidationException("Invalid value " + data.arg + " was not equal to const " + constValue) } } \ No newline at end of file diff --git a/src/main/resources/kotlin/src/main/kotlin/packagename/schemas/validation/ContainsValidator.hbs b/src/main/resources/kotlin/src/main/kotlin/packagename/schemas/validation/ContainsValidator.hbs index 8bd70adb570..9e94ecf5b94 100644 --- a/src/main/resources/kotlin/src/main/kotlin/packagename/schemas/validation/ContainsValidator.hbs +++ b/src/main/resources/kotlin/src/main/kotlin/packagename/schemas/validation/ContainsValidator.hbs @@ -1,30 +1,27 @@ package {{{packageName}}}.schemas.validation; -import org.checkerframework.checker.nullness.qual.Nullable; import {{{packageName}}}.exceptions.ValidationException; -import java.util.List; - -public class ContainsValidator implements KeywordValidator { - @Override - public @Nullable PathToSchemasMap validate( - ValidationData data - ) throws ValidationException { - if (!(data.arg() instanceof List)) { - return null; +class ContainsValidator : KeywordValidator { + @Throws(ValidationException::class) + override fun validate( + data: ValidationData + ): PathToSchemasMap? { + if (data.arg !is List<*>) { + return null } - var containsPathToSchemas = data.containsPathToSchemas(); - if (containsPathToSchemas == null || containsPathToSchemas.isEmpty()) { - throw new ValidationException( - "Validation failed for contains keyword in class="+data.schema().getClass() - + " at pathToItem="+data.validationMetadata().pathToItem()+". No " + val containsPathToSchemas: List? = data.containsPathToSchemas + if (containsPathToSchemas.isNullOrEmpty()) { + throw ValidationException( + "Validation failed for contains keyword in class=${data.schema.javaClass}" + + " at pathToItem=${data.validationMetadata.pathToItem}. No " + "items validated to the contains schema." - ); + ) } - PathToSchemasMap pathToSchemas = new PathToSchemasMap(); - for (PathToSchemasMap otherPathToSchema: containsPathToSchemas) { - pathToSchemas.update(otherPathToSchema); + val pathToSchemas = PathToSchemasMap() + for (otherPathToSchema in containsPathToSchemas) { + pathToSchemas.update(otherPathToSchema) } - return pathToSchemas; + return pathToSchemas } } \ No newline at end of file From e7b057ac0b79e63013ea8f6767dffd12ebe24975 Mon Sep 17 00:00:00 2001 From: Justin Black Date: Wed, 8 May 2024 15:50:33 -0700 Subject: [PATCH 34/78] Updates max and min contains validators --- .../validation/MaxContainsValidator.kt | 45 ++++++++----------- .../validation/MinContainsValidator.kt | 44 +++++++++--------- .../validation/MaxContainsValidator.hbs | 41 +++++++---------- .../validation/MinContainsValidator.hbs | 40 ++++++++--------- 4 files changed, 74 insertions(+), 96 deletions(-) diff --git a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/schemas/validation/MaxContainsValidator.kt b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/schemas/validation/MaxContainsValidator.kt index 315771b9e0c..3783b2da69e 100644 --- a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/schemas/validation/MaxContainsValidator.kt +++ b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/schemas/validation/MaxContainsValidator.kt @@ -1,32 +1,25 @@ -package org.openapijsonschematools.client.schemas.validation; +package org.openapijsonschematools.client.schemas.validation -import org.checkerframework.checker.nullness.qual.Nullable; -import org.openapijsonschematools.client.exceptions.ValidationException; +import org.openapijsonschematools.client.exceptions.ValidationException -import java.util.List; - -public class MaxContainsValidator implements KeywordValidator { - @Override - public @Nullable PathToSchemasMap validate( - ValidationData data - ) throws ValidationException { - var maxContains = data.schema().maxContains; - if (maxContains == null) { - return null; - } - if (!(data.arg() instanceof List)) { - return null; - } - var containsPathToSchemas = data.containsPathToSchemas(); - if (containsPathToSchemas == null) { - return null; +class MaxContainsValidator : KeywordValidator { + @Throws(ValidationException::class) + override fun validate( + data: ValidationData + ): PathToSchemasMap? { + val maxContains: Int = data.schema.maxContains ?: return null + if (data.arg !is List<*>) { + return null } - if (containsPathToSchemas.size() > maxContains) { - throw new ValidationException( - "Validation failed for maxContains keyword in class="+data.schema().getClass()+ - " at pathToItem="+data.validationMetadata().pathToItem()+". Too many items validated to the contains schema." - ); + val containsPathToSchemas: List = data.containsPathToSchemas ?: return null + if (containsPathToSchemas.size > maxContains) { + throw ValidationException(""" + |Validation failed for maxContains keyword in class=${data.schema.javaClass} + | at pathToItem=${data.validationMetadata.pathToItem}. Too many items" + | validated to the contains schema. + """.trimMargin() + ) } - return null; + return null } } \ No newline at end of file diff --git a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/schemas/validation/MinContainsValidator.kt b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/schemas/validation/MinContainsValidator.kt index 6ea4404dc1f..73b74a6b3aa 100644 --- a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/schemas/validation/MinContainsValidator.kt +++ b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/schemas/validation/MinContainsValidator.kt @@ -1,31 +1,27 @@ -package org.openapijsonschematools.client.schemas.validation; +package org.openapijsonschematools.client.schemas.validation -import org.checkerframework.checker.nullness.qual.Nullable; -import org.openapijsonschematools.client.exceptions.ValidationException; +import org.openapijsonschematools.client.exceptions.ValidationException -import java.util.List; - -public class MinContainsValidator implements KeywordValidator { - @Override - public @Nullable PathToSchemasMap validate( - ValidationData data - ) throws ValidationException { - var minContains = data.schema().minContains; - if (minContains == null) { - return null; - } - if (!(data.arg() instanceof List)) { - return null; +class MinContainsValidator : KeywordValidator { + @Throws(ValidationException::class) + override fun validate( + data: ValidationData + ): PathToSchemasMap? { + val minContains: Int = data.schema.minContains ?: return null + if (data.arg !is List<*>) { + return null } - if (data.containsPathToSchemas() == null) { - return null; + if (data.containsPathToSchemas == null) { + return null } - if (data.containsPathToSchemas().size() < minContains) { - throw new ValidationException( - "Validation failed for minContains keyword in class="+data.schema().getClass()+ - " at pathToItem="+data.validationMetadata().pathToItem()+". Too few items validated to the contains schema." - ); + if (data.containsPathToSchemas.size < minContains) { + throw ValidationException(""" + |Validation failed for minContains keyword in class=${data.schema.javaClass} at + | pathToItem=${data.validationMetadata.pathToItem}. + | Too few items validated to the contains schema. + """.trimMargin() + ) } - return null; + return null } } \ No newline at end of file diff --git a/src/main/resources/kotlin/src/main/kotlin/packagename/schemas/validation/MaxContainsValidator.hbs b/src/main/resources/kotlin/src/main/kotlin/packagename/schemas/validation/MaxContainsValidator.hbs index 9cd76afd2ef..ab5917515bb 100644 --- a/src/main/resources/kotlin/src/main/kotlin/packagename/schemas/validation/MaxContainsValidator.hbs +++ b/src/main/resources/kotlin/src/main/kotlin/packagename/schemas/validation/MaxContainsValidator.hbs @@ -1,32 +1,25 @@ package {{{packageName}}}.schemas.validation; -import org.checkerframework.checker.nullness.qual.Nullable; import {{{packageName}}}.exceptions.ValidationException; -import java.util.List; - -public class MaxContainsValidator implements KeywordValidator { - @Override - public @Nullable PathToSchemasMap validate( - ValidationData data - ) throws ValidationException { - var maxContains = data.schema().maxContains; - if (maxContains == null) { - return null; - } - if (!(data.arg() instanceof List)) { - return null; - } - var containsPathToSchemas = data.containsPathToSchemas(); - if (containsPathToSchemas == null) { - return null; +class MaxContainsValidator : KeywordValidator { + @Throws(ValidationException::class) + override fun validate( + data: ValidationData + ): PathToSchemasMap? { + val maxContains: Int = data.schema.maxContains ?: return null + if (data.arg !is List<*>) { + return null } - if (containsPathToSchemas.size() > maxContains) { - throw new ValidationException( - "Validation failed for maxContains keyword in class="+data.schema().getClass()+ - " at pathToItem="+data.validationMetadata().pathToItem()+". Too many items validated to the contains schema." - ); + val containsPathToSchemas: List = data.containsPathToSchemas ?: return null + if (containsPathToSchemas.size > maxContains) { + throw ValidationException(""" + |Validation failed for maxContains keyword in class=${data.schema.javaClass} + | at pathToItem=${data.validationMetadata.pathToItem}. Too many items" + | validated to the contains schema. + """.trimMargin() + ) } - return null; + return null } } \ No newline at end of file diff --git a/src/main/resources/kotlin/src/main/kotlin/packagename/schemas/validation/MinContainsValidator.hbs b/src/main/resources/kotlin/src/main/kotlin/packagename/schemas/validation/MinContainsValidator.hbs index 4628c705229..d355218d5b0 100644 --- a/src/main/resources/kotlin/src/main/kotlin/packagename/schemas/validation/MinContainsValidator.hbs +++ b/src/main/resources/kotlin/src/main/kotlin/packagename/schemas/validation/MinContainsValidator.hbs @@ -1,31 +1,27 @@ package {{{packageName}}}.schemas.validation; -import org.checkerframework.checker.nullness.qual.Nullable; import {{{packageName}}}.exceptions.ValidationException; -import java.util.List; - -public class MinContainsValidator implements KeywordValidator { - @Override - public @Nullable PathToSchemasMap validate( - ValidationData data - ) throws ValidationException { - var minContains = data.schema().minContains; - if (minContains == null) { - return null; - } - if (!(data.arg() instanceof List)) { - return null; +class MinContainsValidator : KeywordValidator { + @Throws(ValidationException::class) + override fun validate( + data: ValidationData + ): PathToSchemasMap? { + val minContains: Int = data.schema.minContains ?: return null + if (data.arg !is List<*>) { + return null } - if (data.containsPathToSchemas() == null) { - return null; + if (data.containsPathToSchemas == null) { + return null } - if (data.containsPathToSchemas().size() < minContains) { - throw new ValidationException( - "Validation failed for minContains keyword in class="+data.schema().getClass()+ - " at pathToItem="+data.validationMetadata().pathToItem()+". Too few items validated to the contains schema." - ); + if (data.containsPathToSchemas.size < minContains) { + throw ValidationException(""" + |Validation failed for minContains keyword in class=${data.schema.javaClass} at + | pathToItem=${data.validationMetadata.pathToItem}. + | Too few items validated to the contains schema. + """.trimMargin() + ) } - return null; + return null } } \ No newline at end of file From cd1ac1d1222457f0f7e999ae8200486c2c4be48f Mon Sep 17 00:00:00 2001 From: Justin Black Date: Wed, 8 May 2024 15:58:13 -0700 Subject: [PATCH 35/78] Updates DependentRequiredValidator + PropertyNamesValidator --- .../validation/DependentRequiredValidator.kt | 56 +++++++++---------- .../validation/PropertyNamesValidator.kt | 53 ++++++++---------- .../validation/DependentRequiredValidator.hbs | 54 ++++++++---------- .../validation/PropertyNamesValidator.hbs | 49 +++++++--------- 4 files changed, 91 insertions(+), 121 deletions(-) diff --git a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/schemas/validation/DependentRequiredValidator.kt b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/schemas/validation/DependentRequiredValidator.kt index 2640e2f6d8d..d475c422292 100644 --- a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/schemas/validation/DependentRequiredValidator.kt +++ b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/schemas/validation/DependentRequiredValidator.kt @@ -1,42 +1,36 @@ -package org.openapijsonschematools.client.schemas.validation; +package org.openapijsonschematools.client.schemas.validation -import org.checkerframework.checker.nullness.qual.Nullable; -import org.openapijsonschematools.client.exceptions.ValidationException; +import org.openapijsonschematools.client.exceptions.ValidationException -import java.util.HashSet; -import java.util.Map; -import java.util.Set; - -public class DependentRequiredValidator implements KeywordValidator { - @Override - public @Nullable PathToSchemasMap validate( - ValidationData data - ) throws ValidationException { - if (!(data.arg() instanceof Map mapArg)) { - return null; - } - var dependentRequired = data.schema().dependentRequired; - if (dependentRequired == null) { - return null; +class DependentRequiredValidator : KeywordValidator { + @Throws(ValidationException::class) + override fun validate( + data: ValidationData + ): PathToSchemasMap? { + if (data.arg !is Map<*, *>) { + return null } - for (Map.Entry> entry: dependentRequired.entrySet()) { - if (!mapArg.containsKey(entry.getKey())) { - continue; + val dependentRequired: Map> = data.schema.dependentRequired ?: return null + for ((key, value) in dependentRequired.entries) { + if (!data.arg.containsKey(key)) { + continue } - Set missingKeys = new HashSet<>(entry.getValue()); - for (Object objKey: mapArg.keySet()) { - if (objKey instanceof String key) { - missingKeys.remove(key); + val missingKeys: MutableSet = HashSet(value) + for (objKey in data.arg.keys) { + if (objKey is String) { + missingKeys.remove(objKey) } } if (missingKeys.isEmpty()) { - continue; + continue } - throw new ValidationException( - "Validation failed for dependentRequired because these_keys="+missingKeys+" are "+ - "missing at pathToItem="+data.validationMetadata().pathToItem()+" in class "+data.schema().getClass() - ); + throw ValidationException(""" + |Validation failed for dependentRequired because these_keys=$missingKeys are + | missing at pathToItem=${data.validationMetadata.pathToItem} in class + | ${data.schema.javaClass} + """.trimMargin() + ) } - return null; + return null } } diff --git a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/schemas/validation/PropertyNamesValidator.kt b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/schemas/validation/PropertyNamesValidator.kt index 0169ff5bdba..3e41a82ebb8 100644 --- a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/schemas/validation/PropertyNamesValidator.kt +++ b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/schemas/validation/PropertyNamesValidator.kt @@ -1,38 +1,29 @@ -package org.openapijsonschematools.client.schemas.validation; +package org.openapijsonschematools.client.schemas.validation -import org.checkerframework.checker.nullness.qual.Nullable; -import org.openapijsonschematools.client.exceptions.ValidationException; +import org.openapijsonschematools.client.exceptions.ValidationException -import java.util.ArrayList; -import java.util.List; -import java.util.Map; - -public class PropertyNamesValidator implements KeywordValidator { - @Override - public @Nullable PathToSchemasMap validate( - ValidationData data - ) throws ValidationException { - var propertyNames = data.schema().propertyNames; - if (propertyNames == null) { - return null; - } - if (!(data.arg() instanceof Map mapArg)) { - return null; +class PropertyNamesValidator : KeywordValidator { + @Throws(ValidationException::class) + override fun validate( + data: ValidationData + ): PathToSchemasMap? { + val propertyNames: Class> = data.schema.propertyNames ?: return null + if (data.arg !is Map<*, *>) { + return null } - JsonSchema propertyNamesSchema = JsonSchemaFactory.getInstance(propertyNames); - for (Object objKey: mapArg.keySet()) { - if (objKey instanceof String key) { - List propPathToItem = new ArrayList<>(data.validationMetadata().pathToItem()); - propPathToItem.add(key); - ValidationMetadata keyValidationMetadata = new ValidationMetadata( - propPathToItem, - data.validationMetadata().configuration(), - data.validationMetadata().validatedPathToSchemas(), - data.validationMetadata().seenClasses() - ); - JsonSchema.validate(propertyNamesSchema, key, keyValidationMetadata); + val propertyNamesSchema = JsonSchemaFactory.getInstance(propertyNames) + for (objKey in data.arg.keys) { + if (objKey is String) { + val propPathToItem: List = data.validationMetadata.pathToItem + objKey + val keyValidationMetadata = ValidationMetadata( + propPathToItem, + data.validationMetadata.configuration, + data.validationMetadata.validatedPathToSchemas, + data.validationMetadata.seenClasses + ) + JsonSchema.validate(propertyNamesSchema, objKey, keyValidationMetadata) } } - return null; + return null } } diff --git a/src/main/resources/kotlin/src/main/kotlin/packagename/schemas/validation/DependentRequiredValidator.hbs b/src/main/resources/kotlin/src/main/kotlin/packagename/schemas/validation/DependentRequiredValidator.hbs index 83b1f7cf1bc..458f030ca12 100644 --- a/src/main/resources/kotlin/src/main/kotlin/packagename/schemas/validation/DependentRequiredValidator.hbs +++ b/src/main/resources/kotlin/src/main/kotlin/packagename/schemas/validation/DependentRequiredValidator.hbs @@ -1,42 +1,36 @@ package {{{packageName}}}.schemas.validation; -import org.checkerframework.checker.nullness.qual.Nullable; import {{{packageName}}}.exceptions.ValidationException; -import java.util.HashSet; -import java.util.Map; -import java.util.Set; - -public class DependentRequiredValidator implements KeywordValidator { - @Override - public @Nullable PathToSchemasMap validate( - ValidationData data - ) throws ValidationException { - if (!(data.arg() instanceof Map mapArg)) { - return null; - } - var dependentRequired = data.schema().dependentRequired; - if (dependentRequired == null) { - return null; +class DependentRequiredValidator : KeywordValidator { + @Throws(ValidationException::class) + override fun validate( + data: ValidationData + ): PathToSchemasMap? { + if (data.arg !is Map<*, *>) { + return null } - for (Map.Entry> entry: dependentRequired.entrySet()) { - if (!mapArg.containsKey(entry.getKey())) { - continue; + val dependentRequired: Map> = data.schema.dependentRequired ?: return null + for ((key, value) in dependentRequired.entries) { + if (!data.arg.containsKey(key)) { + continue } - Set missingKeys = new HashSet<>(entry.getValue()); - for (Object objKey: mapArg.keySet()) { - if (objKey instanceof String key) { - missingKeys.remove(key); + val missingKeys: MutableSet = HashSet(value) + for (objKey in data.arg.keys) { + if (objKey is String) { + missingKeys.remove(objKey) } } if (missingKeys.isEmpty()) { - continue; + continue } - throw new ValidationException( - "Validation failed for dependentRequired because these_keys="+missingKeys+" are "+ - "missing at pathToItem="+data.validationMetadata().pathToItem()+" in class "+data.schema().getClass() - ); + throw ValidationException(""" + |Validation failed for dependentRequired because these_keys=$missingKeys are + | missing at pathToItem=${data.validationMetadata.pathToItem} in class + | ${data.schema.javaClass} + """.trimMargin() + ) } - return null; + return null } -} +} \ No newline at end of file diff --git a/src/main/resources/kotlin/src/main/kotlin/packagename/schemas/validation/PropertyNamesValidator.hbs b/src/main/resources/kotlin/src/main/kotlin/packagename/schemas/validation/PropertyNamesValidator.hbs index 90b1599ee61..ff1b005e0c4 100644 --- a/src/main/resources/kotlin/src/main/kotlin/packagename/schemas/validation/PropertyNamesValidator.hbs +++ b/src/main/resources/kotlin/src/main/kotlin/packagename/schemas/validation/PropertyNamesValidator.hbs @@ -1,38 +1,29 @@ package {{{packageName}}}.schemas.validation; -import org.checkerframework.checker.nullness.qual.Nullable; import {{{packageName}}}.exceptions.ValidationException; -import java.util.ArrayList; -import java.util.List; -import java.util.Map; - -public class PropertyNamesValidator implements KeywordValidator { - @Override - public @Nullable PathToSchemasMap validate( - ValidationData data - ) throws ValidationException { - var propertyNames = data.schema().propertyNames; - if (propertyNames == null) { - return null; - } - if (!(data.arg() instanceof Map mapArg)) { - return null; +class PropertyNamesValidator : KeywordValidator { + @Throws(ValidationException::class) + override fun validate( + data: ValidationData + ): PathToSchemasMap? { + val propertyNames: Class> = data.schema.propertyNames ?: return null + if (data.arg !is Map<*, *>) { + return null } - JsonSchema propertyNamesSchema = JsonSchemaFactory.getInstance(propertyNames); - for (Object objKey: mapArg.keySet()) { - if (objKey instanceof String key) { - List propPathToItem = new ArrayList<>(data.validationMetadata().pathToItem()); - propPathToItem.add(key); - ValidationMetadata keyValidationMetadata = new ValidationMetadata( - propPathToItem, - data.validationMetadata().configuration(), - data.validationMetadata().validatedPathToSchemas(), - data.validationMetadata().seenClasses() - ); - JsonSchema.validate(propertyNamesSchema, key, keyValidationMetadata); + val propertyNamesSchema = JsonSchemaFactory.getInstance(propertyNames) + for (objKey in data.arg.keys) { + if (objKey is String) { + val propPathToItem: List = data.validationMetadata.pathToItem + objKey + val keyValidationMetadata = ValidationMetadata( + propPathToItem, + data.validationMetadata.configuration, + data.validationMetadata.validatedPathToSchemas, + data.validationMetadata.seenClasses + ) + JsonSchema.validate(propertyNamesSchema, objKey, keyValidationMetadata) } } - return null; + return null } } From 20f5613c1546848586617a28ff1a57456f06d00e Mon Sep 17 00:00:00 2001 From: Justin Black Date: Wed, 8 May 2024 16:07:23 -0700 Subject: [PATCH 36/78] Updates DependentSchemasValidator + PatternPropertiesValidator --- .../validation/DependentSchemasValidator.kt | 53 ++++++++----------- .../validation/PatternPropertiesValidator.kt | 28 ++++------ .../validation/DependentSchemasValidator.hbs | 48 +++++++---------- .../validation/PatternPropertiesValidator.hbs | 26 ++++----- 4 files changed, 62 insertions(+), 93 deletions(-) diff --git a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/schemas/validation/DependentSchemasValidator.kt b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/schemas/validation/DependentSchemasValidator.kt index f51b5eaf339..83f8f6de5c4 100644 --- a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/schemas/validation/DependentSchemasValidator.kt +++ b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/schemas/validation/DependentSchemasValidator.kt @@ -1,41 +1,32 @@ -package org.openapijsonschematools.client.schemas.validation; +package org.openapijsonschematools.client.schemas.validation -import org.checkerframework.checker.nullness.qual.Nullable; -import org.openapijsonschematools.client.exceptions.ValidationException; +import org.openapijsonschematools.client.exceptions.ValidationException +import org.openapijsonschematools.client.schemas.validation.JsonSchemaFactory.getInstance -import java.util.LinkedHashSet; -import java.util.Map; -import java.util.Set; - -public class DependentSchemasValidator implements KeywordValidator { - @Override - public @Nullable PathToSchemasMap validate( - ValidationData data - ) throws ValidationException { - if (!(data.arg() instanceof Map mapArg)) { - return null; - } - var dependentSchemas = data.schema().dependentSchemas; - if (dependentSchemas == null) { - return null; +class DependentSchemasValidator : KeywordValidator { + @Throws(ValidationException::class) + override fun validate( + data: ValidationData + ): PathToSchemasMap? { + if (data.arg !is Map<*, *>) { + return null } - PathToSchemasMap pathToSchemas = new PathToSchemasMap(); - Set presentProperties = new LinkedHashSet<>(); - for (Object key: mapArg.keySet()) { - if (key instanceof String) { - presentProperties.add((String) key); + val dependentSchemas: Map>> = data.schema.dependentSchemas ?: return null + val pathToSchemas = PathToSchemasMap() + val presentProperties: MutableSet = LinkedHashSet() + for (key in data.arg.keys) { + if (key is String) { + presentProperties.add(key) } } - for(Map.Entry>> entry: dependentSchemas.entrySet()) { - String propName = entry.getKey(); + for ((propName, dependentSchemaClass) in dependentSchemas.entries) { if (!presentProperties.contains(propName)) { - continue; + continue } - Class> dependentSchemaClass = entry.getValue(); - JsonSchema dependentSchema = JsonSchemaFactory.getInstance(dependentSchemaClass); - PathToSchemasMap otherPathToSchemas = JsonSchema.validate(dependentSchema, mapArg, data.validationMetadata()); - pathToSchemas.update(otherPathToSchemas); + val dependentSchema = getInstance(dependentSchemaClass) + val otherPathToSchemas = JsonSchema.validate(dependentSchema, data.arg, data.validationMetadata) + pathToSchemas.update(otherPathToSchemas) } - return pathToSchemas; + return pathToSchemas } } diff --git a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/schemas/validation/PatternPropertiesValidator.kt b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/schemas/validation/PatternPropertiesValidator.kt index 9e951e23ed2..1ba9fd8396b 100644 --- a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/schemas/validation/PatternPropertiesValidator.kt +++ b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/schemas/validation/PatternPropertiesValidator.kt @@ -1,21 +1,15 @@ -package org.openapijsonschematools.client.schemas.validation; +package org.openapijsonschematools.client.schemas.validation -import org.checkerframework.checker.nullness.qual.Nullable; - -import java.util.Map; - -public class PatternPropertiesValidator implements KeywordValidator { - @Override - public @Nullable PathToSchemasMap validate( - ValidationData data - ) { - var patternProperties = data.schema().patternProperties; - if (patternProperties == null) { - return null; - } - if (!(data.arg() instanceof Map)) { - return null; +class PatternPropertiesValidator : KeywordValidator { + override fun validate( + data: ValidationData + ): PathToSchemasMap? + { + if (data.schema.patternProperties == null) { + return null } - return data.patternPropertiesPathToSchemas(); + return if (data.arg !is Map<*, *>) { + null + } else data.patternPropertiesPathToSchemas } } diff --git a/src/main/resources/kotlin/src/main/kotlin/packagename/schemas/validation/DependentSchemasValidator.hbs b/src/main/resources/kotlin/src/main/kotlin/packagename/schemas/validation/DependentSchemasValidator.hbs index 6c05666c132..7148ef13d45 100644 --- a/src/main/resources/kotlin/src/main/kotlin/packagename/schemas/validation/DependentSchemasValidator.hbs +++ b/src/main/resources/kotlin/src/main/kotlin/packagename/schemas/validation/DependentSchemasValidator.hbs @@ -1,41 +1,31 @@ package {{{packageName}}}.schemas.validation; -import org.checkerframework.checker.nullness.qual.Nullable; import {{{packageName}}}.exceptions.ValidationException; -import java.util.LinkedHashSet; -import java.util.Map; -import java.util.Set; - -public class DependentSchemasValidator implements KeywordValidator { - @Override - public @Nullable PathToSchemasMap validate( - ValidationData data - ) throws ValidationException { - if (!(data.arg() instanceof Map mapArg)) { - return null; - } - var dependentSchemas = data.schema().dependentSchemas; - if (dependentSchemas == null) { - return null; +class DependentSchemasValidator : KeywordValidator { + @Throws(ValidationException::class) + override fun validate( + data: ValidationData + ): PathToSchemasMap? { + if (data.arg !is Map<*, *>) { + return null } - PathToSchemasMap pathToSchemas = new PathToSchemasMap(); - Set presentProperties = new LinkedHashSet<>(); - for (Object key: mapArg.keySet()) { - if (key instanceof String) { - presentProperties.add((String) key); + val dependentSchemas: Map>> = data.schema.dependentSchemas ?: return null + val pathToSchemas = PathToSchemasMap() + val presentProperties: MutableSet = LinkedHashSet() + for (key in data.arg.keys) { + if (key is String) { + presentProperties.add(key) } } - for(Map.Entry>> entry: dependentSchemas.entrySet()) { - String propName = entry.getKey(); + for ((propName, dependentSchemaClass) in dependentSchemas.entries) { if (!presentProperties.contains(propName)) { - continue; + continue } - Class> dependentSchemaClass = entry.getValue(); - JsonSchema dependentSchema = JsonSchemaFactory.getInstance(dependentSchemaClass); - PathToSchemasMap otherPathToSchemas = JsonSchema.validate(dependentSchema, mapArg, data.validationMetadata()); - pathToSchemas.update(otherPathToSchemas); + val dependentSchema = getInstance(dependentSchemaClass) + val otherPathToSchemas = JsonSchema.validate(dependentSchema, data.arg, data.validationMetadata) + pathToSchemas.update(otherPathToSchemas) } - return pathToSchemas; + return pathToSchemas } } diff --git a/src/main/resources/kotlin/src/main/kotlin/packagename/schemas/validation/PatternPropertiesValidator.hbs b/src/main/resources/kotlin/src/main/kotlin/packagename/schemas/validation/PatternPropertiesValidator.hbs index a3d8ffa424c..cc06c1fb6a6 100644 --- a/src/main/resources/kotlin/src/main/kotlin/packagename/schemas/validation/PatternPropertiesValidator.hbs +++ b/src/main/resources/kotlin/src/main/kotlin/packagename/schemas/validation/PatternPropertiesValidator.hbs @@ -1,21 +1,15 @@ package {{{packageName}}}.schemas.validation; -import org.checkerframework.checker.nullness.qual.Nullable; - -import java.util.Map; - -public class PatternPropertiesValidator implements KeywordValidator { - @Override - public @Nullable PathToSchemasMap validate( - ValidationData data - ) { - var patternProperties = data.schema().patternProperties; - if (patternProperties == null) { - return null; - } - if (!(data.arg() instanceof Map)) { - return null; +class PatternPropertiesValidator : KeywordValidator { + override fun validate( + data: ValidationData + ): PathToSchemasMap? + { + if (data.schema.patternProperties == null) { + return null } - return data.patternPropertiesPathToSchemas(); + return if (data.arg !is Map<*, *>) { + null + } else data.patternPropertiesPathToSchemas } } From ae18ab2c8b6ad2c021f01fcc52752e5775a3f7e0 Mon Sep 17 00:00:00 2001 From: Justin Black Date: Wed, 8 May 2024 16:18:40 -0700 Subject: [PATCH 37/78] Updates IfValidator + PrefixItemsValidator --- .../client/schemas/validation/IfValidator.kt | 26 ++++---- .../validation/PrefixItemsValidator.kt | 61 ++++++++----------- .../schemas/validation/IfValidator.hbs | 24 ++++---- .../validation/PrefixItemsValidator.hbs | 58 ++++++++---------- 4 files changed, 76 insertions(+), 93 deletions(-) diff --git a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/schemas/validation/IfValidator.kt b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/schemas/validation/IfValidator.kt index 2a05893a22a..5e4e086bfe5 100644 --- a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/schemas/validation/IfValidator.kt +++ b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/schemas/validation/IfValidator.kt @@ -1,19 +1,17 @@ -package org.openapijsonschematools.client.schemas.validation; +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 -public class IfValidator implements KeywordValidator { - @Override - public @Nullable PathToSchemasMap validate( - ValidationData data - ) throws ValidationException { - var ifSchema = data.schema().ifSchema; - if (ifSchema == null) { - return null; +class IfValidator : KeywordValidator { + @Throws(ValidationException::class) + override fun validate( + data: ValidationData + ): PathToSchemasMap? { + if (data.schema.ifSchema == null) { + return null } - if (data.ifPathToSchemas() == null) { - throw new ValidationException("Invalid type for ifPathToSchemas"); + if (data.ifPathToSchemas == null) { + throw ValidationException("Invalid type for ifPathToSchemas") } /* if is false use case @@ -23,6 +21,6 @@ public class IfValidator implements KeywordValidator { if true, then true -> true for whole schema so validate_then will add ifPathToSchemas data to pathToSchemas */ - return null; + return null } } diff --git a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/schemas/validation/PrefixItemsValidator.kt b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/schemas/validation/PrefixItemsValidator.kt index 510f3a8760e..d79d74d14c2 100644 --- a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/schemas/validation/PrefixItemsValidator.kt +++ b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/schemas/validation/PrefixItemsValidator.kt @@ -1,41 +1,34 @@ -package org.openapijsonschematools.client.schemas.validation; +package org.openapijsonschematools.client.schemas.validation -import org.checkerframework.checker.nullness.qual.Nullable; -import org.openapijsonschematools.client.exceptions.ValidationException; +import org.openapijsonschematools.client.exceptions.ValidationException +import kotlin.math.min -import java.util.ArrayList; -import java.util.List; - -public class PrefixItemsValidator implements KeywordValidator { - @Override - public @Nullable PathToSchemasMap validate( - ValidationData data - ) throws ValidationException { - var prefixItems = data.schema().prefixItems; - if (prefixItems == null) { - return null; - } - if (!(data.arg() instanceof List listArg)) { - return null; +class PrefixItemsValidator : KeywordValidator { + @Throws(ValidationException::class) + override fun validate( + data: ValidationData + ): PathToSchemasMap? { + val prefixItems: List>> = data.schema.prefixItems ?: return null + if (data.arg !is List<*>) { + return null } - if (listArg.isEmpty()) { - return null; + if (data.arg.isEmpty()) { + return null } - PathToSchemasMap pathToSchemas = new PathToSchemasMap(); - int maxIndex = Math.min(listArg.size(), prefixItems.size()); - for (int i=0; i < maxIndex; i++) { - List itemPathToItem = new ArrayList<>(data.validationMetadata().pathToItem()); - itemPathToItem.add(i); - ValidationMetadata itemValidationMetadata = new ValidationMetadata( - itemPathToItem, - data.validationMetadata().configuration(), - data.validationMetadata().validatedPathToSchemas(), - data.validationMetadata().seenClasses() - ); - JsonSchema itemsSchema = JsonSchemaFactory.getInstance(prefixItems.get(i)); - PathToSchemasMap otherPathToSchemas = JsonSchema.validate(itemsSchema, listArg.get(i), itemValidationMetadata); - pathToSchemas.update(otherPathToSchemas); + val pathToSchemas = PathToSchemasMap() + val maxIndex: Int = min(data.arg.size, prefixItems.size) + for (i in 0 until maxIndex) { + val itemPathToItem: List = data.validationMetadata.pathToItem + i + val itemValidationMetadata = ValidationMetadata( + itemPathToItem, + data.validationMetadata.configuration, + data.validationMetadata.validatedPathToSchemas, + data.validationMetadata.seenClasses + ) + val itemsSchema: JsonSchema<*> = JsonSchemaFactory.getInstance(prefixItems[i]) + val otherPathToSchemas = JsonSchema.validate(itemsSchema, data.arg[i], itemValidationMetadata) + pathToSchemas.update(otherPathToSchemas) } - return pathToSchemas; + return pathToSchemas } } diff --git a/src/main/resources/kotlin/src/main/kotlin/packagename/schemas/validation/IfValidator.hbs b/src/main/resources/kotlin/src/main/kotlin/packagename/schemas/validation/IfValidator.hbs index c9f1f79597c..b3c8e6d5515 100644 --- a/src/main/resources/kotlin/src/main/kotlin/packagename/schemas/validation/IfValidator.hbs +++ b/src/main/resources/kotlin/src/main/kotlin/packagename/schemas/validation/IfValidator.hbs @@ -1,19 +1,17 @@ package {{{packageName}}}.schemas.validation; import {{{packageName}}}.exceptions.ValidationException; -import org.checkerframework.checker.nullness.qual.Nullable; -public class IfValidator implements KeywordValidator { - @Override - public @Nullable PathToSchemasMap validate( - ValidationData data - ) throws ValidationException { - var ifSchema = data.schema().ifSchema; - if (ifSchema == null) { - return null; +class IfValidator : KeywordValidator { + @Throws(ValidationException::class) + override fun validate( + data: ValidationData + ): PathToSchemasMap? { + if (data.schema.ifSchema == null) { + return null } - if (data.ifPathToSchemas() == null) { - throw new ValidationException("Invalid type for ifPathToSchemas"); + if (data.ifPathToSchemas == null) { + throw ValidationException("Invalid type for ifPathToSchemas") } /* if is false use case @@ -23,6 +21,6 @@ public class IfValidator implements KeywordValidator { if true, then true -> true for whole schema so validate_then will add ifPathToSchemas data to pathToSchemas */ - return null; + return null } -} +} \ No newline at end of file diff --git a/src/main/resources/kotlin/src/main/kotlin/packagename/schemas/validation/PrefixItemsValidator.hbs b/src/main/resources/kotlin/src/main/kotlin/packagename/schemas/validation/PrefixItemsValidator.hbs index 8a778500981..83ca97fa5fc 100644 --- a/src/main/resources/kotlin/src/main/kotlin/packagename/schemas/validation/PrefixItemsValidator.hbs +++ b/src/main/resources/kotlin/src/main/kotlin/packagename/schemas/validation/PrefixItemsValidator.hbs @@ -1,41 +1,35 @@ package {{{packageName}}}.schemas.validation; -import org.checkerframework.checker.nullness.qual.Nullable; import {{{packageName}}}.exceptions.ValidationException; -import java.util.ArrayList; -import java.util.List; +import kotlin.math.min -public class PrefixItemsValidator implements KeywordValidator { - @Override - public @Nullable PathToSchemasMap validate( - ValidationData data - ) throws ValidationException { - var prefixItems = data.schema().prefixItems; - if (prefixItems == null) { - return null; +class PrefixItemsValidator : KeywordValidator { + @Throws(ValidationException::class) + override fun validate( + data: ValidationData + ): PathToSchemasMap? { + val prefixItems: List>> = data.schema.prefixItems ?: return null + if (data.arg !is List<*>) { + return null } - if (!(data.arg() instanceof List listArg)) { - return null; + if (data.arg.isEmpty()) { + return null } - if (listArg.isEmpty()) { - return null; + val pathToSchemas = PathToSchemasMap() + val maxIndex: Int = min(data.arg.size, prefixItems.size) + for (i in 0 until maxIndex) { + val itemPathToItem: List = data.validationMetadata.pathToItem + i + val itemValidationMetadata = ValidationMetadata( + itemPathToItem, + data.validationMetadata.configuration, + data.validationMetadata.validatedPathToSchemas, + data.validationMetadata.seenClasses + ) + val itemsSchema: JsonSchema<*> = JsonSchemaFactory.getInstance(prefixItems[i]) + val otherPathToSchemas = JsonSchema.validate(itemsSchema, data.arg[i], itemValidationMetadata) + pathToSchemas.update(otherPathToSchemas) } - PathToSchemasMap pathToSchemas = new PathToSchemasMap(); - int maxIndex = Math.min(listArg.size(), prefixItems.size()); - for (int i=0; i < maxIndex; i++) { - List itemPathToItem = new ArrayList<>(data.validationMetadata().pathToItem()); - itemPathToItem.add(i); - ValidationMetadata itemValidationMetadata = new ValidationMetadata( - itemPathToItem, - data.validationMetadata().configuration(), - data.validationMetadata().validatedPathToSchemas(), - data.validationMetadata().seenClasses() - ); - JsonSchema itemsSchema = JsonSchemaFactory.getInstance(prefixItems.get(i)); - PathToSchemasMap otherPathToSchemas = JsonSchema.validate(itemsSchema, listArg.get(i), itemValidationMetadata); - pathToSchemas.update(otherPathToSchemas); - } - return pathToSchemas; + return pathToSchemas } -} +} \ No newline at end of file From 643da091bed48a91131d0f9cb3886184c3e3c140 Mon Sep 17 00:00:00 2001 From: Justin Black Date: Wed, 8 May 2024 16:25:53 -0700 Subject: [PATCH 38/78] Updates ElseValidator + ThenValidator --- .../schemas/validation/ElseValidator.kt | 40 ++++++++---------- .../schemas/validation/ThenValidator.kt | 42 ++++++++----------- .../schemas/validation/ElseValidator.hbs | 38 +++++++---------- .../schemas/validation/ThenValidator.hbs | 40 ++++++++---------- 4 files changed, 68 insertions(+), 92 deletions(-) diff --git a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/schemas/validation/ElseValidator.kt b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/schemas/validation/ElseValidator.kt index 18573a77ef7..f6e367b3bd9 100644 --- a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/schemas/validation/ElseValidator.kt +++ b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/schemas/validation/ElseValidator.kt @@ -1,31 +1,25 @@ -package org.openapijsonschematools.client.schemas.validation; +package org.openapijsonschematools.client.schemas.validation -import org.checkerframework.checker.nullness.qual.Nullable; -import org.openapijsonschematools.client.exceptions.ValidationException; +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; - } - var ifPathToSchemas = data.ifPathToSchemas(); - if (ifPathToSchemas == null) { - // if unset - return null; - } +class ElseValidator : KeywordValidator { + @Throws(ValidationException::class) + override fun validate( + data: ValidationData + ): PathToSchemasMap? { + val elseSchema: Class> = data.schema.elseSchema ?: return null + val ifPathToSchemas: PathToSchemasMap = data.ifPathToSchemas + ?: // if unset + return null if (!ifPathToSchemas.isEmpty()) { // if validation is true - return null; + return null } - JsonSchema elseSchemaInstance = JsonSchemaFactory.getInstance(elseSchema); - PathToSchemasMap pathToSchemas = new PathToSchemasMap(); - var elsePathToSchemas = JsonSchema.validate(elseSchemaInstance, data.arg(), data.validationMetadata()); + val elseSchemaInstance = JsonSchemaFactory.getInstance(elseSchema) + val pathToSchemas = PathToSchemasMap() + val elsePathToSchemas = JsonSchema.validate(elseSchemaInstance, data.arg, data.validationMetadata) // todo capture validation error and describe it as an else error? - pathToSchemas.update(elsePathToSchemas); - return pathToSchemas; + pathToSchemas.update(elsePathToSchemas) + return pathToSchemas } } diff --git a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/schemas/validation/ThenValidator.kt b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/schemas/validation/ThenValidator.kt index 75c083e2edc..22221d1e40a 100644 --- a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/schemas/validation/ThenValidator.kt +++ b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/schemas/validation/ThenValidator.kt @@ -1,32 +1,26 @@ -package org.openapijsonschematools.client.schemas.validation; +package org.openapijsonschematools.client.schemas.validation -import org.checkerframework.checker.nullness.qual.Nullable; -import org.openapijsonschematools.client.exceptions.ValidationException; +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; - } - var ifPathToSchemas = data.ifPathToSchemas(); - if (ifPathToSchemas == null) { - // if unset - return null; - } +class ThenValidator : KeywordValidator { + @Throws(ValidationException::class) + override fun validate( + data: ValidationData + ): PathToSchemasMap? { + val then: Class> = data.schema.then ?: return null + val ifPathToSchemas: PathToSchemasMap = data.ifPathToSchemas + ?: // if unset + return null if (ifPathToSchemas.isEmpty()) { // if validation is false - return null; + return null } - JsonSchema thenSchema = JsonSchemaFactory.getInstance(then); - PathToSchemasMap pathToSchemas = new PathToSchemasMap(); - var thenPathToSchemas = JsonSchema.validate(thenSchema, data.arg(), data.validationMetadata()); + val thenSchema = JsonSchemaFactory.getInstance(then) + val pathToSchemas = PathToSchemasMap() + val thenPathToSchemas = JsonSchema.validate(thenSchema, data.arg, data.validationMetadata) // todo capture validation error and describe it as an then error? - pathToSchemas.update(ifPathToSchemas); - pathToSchemas.update(thenPathToSchemas); - return pathToSchemas; + pathToSchemas.update(ifPathToSchemas) + pathToSchemas.update(thenPathToSchemas) + return pathToSchemas } } diff --git a/src/main/resources/kotlin/src/main/kotlin/packagename/schemas/validation/ElseValidator.hbs b/src/main/resources/kotlin/src/main/kotlin/packagename/schemas/validation/ElseValidator.hbs index f4963b7f04f..554612910e3 100644 --- a/src/main/resources/kotlin/src/main/kotlin/packagename/schemas/validation/ElseValidator.hbs +++ b/src/main/resources/kotlin/src/main/kotlin/packagename/schemas/validation/ElseValidator.hbs @@ -1,31 +1,25 @@ package {{{packageName}}}.schemas.validation; -import org.checkerframework.checker.nullness.qual.Nullable; import {{{packageName}}}.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; - } - var ifPathToSchemas = data.ifPathToSchemas(); - if (ifPathToSchemas == null) { - // if unset - return null; - } +class ElseValidator : KeywordValidator { + @Throws(ValidationException::class) + override fun validate( + data: ValidationData + ): PathToSchemasMap? { + val elseSchema: Class> = data.schema.elseSchema ?: return null + val ifPathToSchemas: PathToSchemasMap = data.ifPathToSchemas + ?: // if unset + return null if (!ifPathToSchemas.isEmpty()) { // if validation is true - return null; + return null } - JsonSchema elseSchemaInstance = JsonSchemaFactory.getInstance(elseSchema); - PathToSchemasMap pathToSchemas = new PathToSchemasMap(); - var elsePathToSchemas = JsonSchema.validate(elseSchemaInstance, data.arg(), data.validationMetadata()); + val elseSchemaInstance = JsonSchemaFactory.getInstance(elseSchema) + val pathToSchemas = PathToSchemasMap() + val elsePathToSchemas = JsonSchema.validate(elseSchemaInstance, data.arg, data.validationMetadata) // todo capture validation error and describe it as an else error? - pathToSchemas.update(elsePathToSchemas); - return pathToSchemas; + pathToSchemas.update(elsePathToSchemas) + return pathToSchemas } -} +} \ No newline at end of file diff --git a/src/main/resources/kotlin/src/main/kotlin/packagename/schemas/validation/ThenValidator.hbs b/src/main/resources/kotlin/src/main/kotlin/packagename/schemas/validation/ThenValidator.hbs index 4b759d4a34b..3f8872c70ac 100644 --- a/src/main/resources/kotlin/src/main/kotlin/packagename/schemas/validation/ThenValidator.hbs +++ b/src/main/resources/kotlin/src/main/kotlin/packagename/schemas/validation/ThenValidator.hbs @@ -1,32 +1,26 @@ package {{{packageName}}}.schemas.validation; -import org.checkerframework.checker.nullness.qual.Nullable; 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; - } - var ifPathToSchemas = data.ifPathToSchemas(); - if (ifPathToSchemas == null) { - // if unset - return null; - } +class ThenValidator : KeywordValidator { + @Throws(ValidationException::class) + override fun validate( + data: ValidationData + ): PathToSchemasMap? { + val then: Class> = data.schema.then ?: return null + val ifPathToSchemas: PathToSchemasMap = data.ifPathToSchemas + ?: // if unset + return null if (ifPathToSchemas.isEmpty()) { // if validation is false - return null; + return null } - JsonSchema thenSchema = JsonSchemaFactory.getInstance(then); - PathToSchemasMap pathToSchemas = new PathToSchemasMap(); - var thenPathToSchemas = JsonSchema.validate(thenSchema, data.arg(), data.validationMetadata()); + val thenSchema = JsonSchemaFactory.getInstance(then) + val pathToSchemas = PathToSchemasMap() + val thenPathToSchemas = JsonSchema.validate(thenSchema, data.arg, data.validationMetadata) // todo capture validation error and describe it as an then error? - pathToSchemas.update(ifPathToSchemas); - pathToSchemas.update(thenPathToSchemas); - return pathToSchemas; + pathToSchemas.update(ifPathToSchemas) + pathToSchemas.update(thenPathToSchemas) + return pathToSchemas } -} +} \ No newline at end of file From e21dd3403e4990d46b30b8b558c6c1357b4e6a92 Mon Sep 17 00:00:00 2001 From: Justin Black Date: Wed, 8 May 2024 16:53:23 -0700 Subject: [PATCH 39/78] Updates UnevaluatedItemsValidator + UnevaluatedPropertiesValidator --- .../validation/UnevaluatedItemsValidator.kt | 69 ++++++++----------- .../UnevaluatedPropertiesValidator.kt | 67 ++++++++---------- .../schemas/validation/JsonSchemaInfo.hbs | 1 - .../validation/UnevaluatedItemsValidator.hbs | 67 ++++++++---------- .../UnevaluatedPropertiesValidator.hbs | 63 +++++++---------- 5 files changed, 109 insertions(+), 158 deletions(-) diff --git a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/schemas/validation/UnevaluatedItemsValidator.kt b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/schemas/validation/UnevaluatedItemsValidator.kt index 407904da444..c640d0485ad 100644 --- a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/schemas/validation/UnevaluatedItemsValidator.kt +++ b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/schemas/validation/UnevaluatedItemsValidator.kt @@ -1,52 +1,41 @@ -package org.openapijsonschematools.client.schemas.validation; +package org.openapijsonschematools.client.schemas.validation -import org.checkerframework.checker.nullness.qual.Nullable; -import org.openapijsonschematools.client.exceptions.ValidationException; +import org.openapijsonschematools.client.exceptions.ValidationException -import java.util.ArrayList; -import java.util.List; - -public class UnevaluatedItemsValidator implements KeywordValidator { - @Override - public @Nullable PathToSchemasMap validate( - ValidationData data - ) throws ValidationException { - var unevaluatedItems = data.schema().unevaluatedItems; - if (unevaluatedItems == null) { - return null; - } - var knownPathToSchemas = data.knownPathToSchemas(); - if (knownPathToSchemas == null) { - return null; - } - if (!(data.arg() instanceof List listArg)) { - return null; +class UnevaluatedItemsValidator : KeywordValidator { + @Throws(ValidationException::class) + override fun validate( + data: ValidationData + ): PathToSchemasMap? { + val unevaluatedItems: Class> = data.schema.unevaluatedItems ?: return null + val knownPathToSchemas: PathToSchemasMap = data.knownPathToSchemas ?: return null + if (data.arg !is List<*>) { + return null } - if (listArg.isEmpty()) { - return null; + if (data.arg.isEmpty()) { + return null } - PathToSchemasMap pathToSchemas = new PathToSchemasMap(); - int minIndex = data.schema().prefixItems != null ? data.schema().prefixItems.size() : 0; - JsonSchema unevaluatedItemsSchema = JsonSchemaFactory.getInstance(unevaluatedItems); - for(int i = minIndex; i < listArg.size(); i++) { - List itemPathToItem = new ArrayList<>(data.validationMetadata().pathToItem()); - itemPathToItem.add(i); + val pathToSchemas = PathToSchemasMap() + val minIndex = if (data.schema.prefixItems != null) data.schema.prefixItems.size else 0 + val unevaluatedItemsSchema = JsonSchemaFactory.getInstance(unevaluatedItems) + for (i in minIndex until data.arg.size) { + val itemPathToItem: List = data.validationMetadata.pathToItem + i if (knownPathToSchemas.containsKey(itemPathToItem)) { - continue; + continue } - ValidationMetadata itemValidationMetadata = new ValidationMetadata( - itemPathToItem, - data.validationMetadata().configuration(), - data.validationMetadata().validatedPathToSchemas(), - data.validationMetadata().seenClasses() - ); + val itemValidationMetadata = ValidationMetadata( + itemPathToItem, + data.validationMetadata.configuration, + data.validationMetadata.validatedPathToSchemas, + data.validationMetadata.seenClasses + ) if (itemValidationMetadata.validationRanEarlier(unevaluatedItemsSchema)) { // todo add_deeper_validated_schemas - continue; + continue } - PathToSchemasMap otherPathToSchemas = JsonSchema.validate(unevaluatedItemsSchema, listArg.get(i), itemValidationMetadata); - pathToSchemas.update(otherPathToSchemas); + val otherPathToSchemas = JsonSchema.validate(unevaluatedItemsSchema, data.arg[i], itemValidationMetadata) + pathToSchemas.update(otherPathToSchemas) } - return pathToSchemas; + return pathToSchemas } } diff --git a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/schemas/validation/UnevaluatedPropertiesValidator.kt b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/schemas/validation/UnevaluatedPropertiesValidator.kt index 8fd34950404..f78940fc822 100644 --- a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/schemas/validation/UnevaluatedPropertiesValidator.kt +++ b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/schemas/validation/UnevaluatedPropertiesValidator.kt @@ -1,49 +1,36 @@ -package org.openapijsonschematools.client.schemas.validation; +package org.openapijsonschematools.client.schemas.validation -import org.checkerframework.checker.nullness.qual.Nullable; -import org.openapijsonschematools.client.exceptions.ValidationException; +import org.openapijsonschematools.client.exceptions.ValidationException -import java.util.ArrayList; -import java.util.List; -import java.util.Map; - -public class UnevaluatedPropertiesValidator implements KeywordValidator { - @Override - public @Nullable PathToSchemasMap validate( - ValidationData data - ) throws ValidationException { - var unevaluatedProperties = data.schema().unevaluatedProperties; - if (unevaluatedProperties == null) { - return null; - } - var knownPathToSchemas = data.knownPathToSchemas(); - if (knownPathToSchemas == null) { - return null; - } - if (!(data.arg() instanceof Map mapArg)) { - return null; +class UnevaluatedPropertiesValidator : KeywordValidator { + @Throws(ValidationException::class) + override fun validate( + data: ValidationData + ): PathToSchemasMap? { + val unevaluatedProperties: Class> = data.schema.unevaluatedProperties ?: return null + val knownPathToSchemas: PathToSchemasMap = data.knownPathToSchemas ?: return null + if (data.arg !is Map<*, *>) { + return null } - PathToSchemasMap pathToSchemas = new PathToSchemasMap(); - 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"); + val pathToSchemas = PathToSchemasMap() + val unevaluatedPropertiesSchema = JsonSchemaFactory.getInstance(unevaluatedProperties) + for ((key, value) in data.arg.entries) { + if (key !is String) { + throw ValidationException("Map keys must be strings") } - List propPathToItem = new ArrayList<>(data.validationMetadata().pathToItem()); - propPathToItem.add(propName); + val propPathToItem: List = data.validationMetadata.pathToItem + key if (knownPathToSchemas.containsKey(propPathToItem)) { - continue; + continue } - @Nullable Object propValue = mapArg.get(propName); - ValidationMetadata propValidationMetadata = new ValidationMetadata( - propPathToItem, - data.validationMetadata().configuration(), - data.validationMetadata().validatedPathToSchemas(), - data.validationMetadata().seenClasses() - ); - PathToSchemasMap otherPathToSchemas = JsonSchema.validate(unevaluatedPropertiesSchema, propValue, propValidationMetadata); - pathToSchemas.update(otherPathToSchemas); + val propValidationMetadata = ValidationMetadata( + propPathToItem, + data.validationMetadata.configuration, + data.validationMetadata.validatedPathToSchemas, + data.validationMetadata.seenClasses + ) + val otherPathToSchemas = JsonSchema.validate(unevaluatedPropertiesSchema, value, propValidationMetadata) + pathToSchemas.update(otherPathToSchemas) } - return pathToSchemas; + return pathToSchemas } } \ No newline at end of file diff --git a/src/main/resources/kotlin/src/main/kotlin/packagename/schemas/validation/JsonSchemaInfo.hbs b/src/main/resources/kotlin/src/main/kotlin/packagename/schemas/validation/JsonSchemaInfo.hbs index b840b11f7ec..ec4eb87de88 100644 --- a/src/main/resources/kotlin/src/main/kotlin/packagename/schemas/validation/JsonSchemaInfo.hbs +++ b/src/main/resources/kotlin/src/main/kotlin/packagename/schemas/validation/JsonSchemaInfo.hbs @@ -1,5 +1,4 @@ package {{{packageName}}}.schemas.validation; -import org.checkerframework.checker.nullness.qual.Nullable; import java.math.BigDecimal import java.util.regex.Pattern diff --git a/src/main/resources/kotlin/src/main/kotlin/packagename/schemas/validation/UnevaluatedItemsValidator.hbs b/src/main/resources/kotlin/src/main/kotlin/packagename/schemas/validation/UnevaluatedItemsValidator.hbs index f22ca53b47e..ef404a10906 100644 --- a/src/main/resources/kotlin/src/main/kotlin/packagename/schemas/validation/UnevaluatedItemsValidator.hbs +++ b/src/main/resources/kotlin/src/main/kotlin/packagename/schemas/validation/UnevaluatedItemsValidator.hbs @@ -1,52 +1,41 @@ package {{{packageName}}}.schemas.validation; -import org.checkerframework.checker.nullness.qual.Nullable; import {{{packageName}}}.exceptions.ValidationException; -import java.util.ArrayList; -import java.util.List; - -public class UnevaluatedItemsValidator implements KeywordValidator { - @Override - public @Nullable PathToSchemasMap validate( - ValidationData data - ) throws ValidationException { - var unevaluatedItems = data.schema().unevaluatedItems; - if (unevaluatedItems == null) { - return null; - } - var knownPathToSchemas = data.knownPathToSchemas(); - if (knownPathToSchemas == null) { - return null; - } - if (!(data.arg() instanceof List listArg)) { - return null; +class UnevaluatedItemsValidator : KeywordValidator { + @Throws(ValidationException::class) + override fun validate( + data: ValidationData + ): PathToSchemasMap? { + val unevaluatedItems: Class> = data.schema.unevaluatedItems ?: return null + val knownPathToSchemas: PathToSchemasMap = data.knownPathToSchemas ?: return null + if (data.arg !is List<*>) { + return null } - if (listArg.isEmpty()) { - return null; + if (data.arg.isEmpty()) { + return null } - PathToSchemasMap pathToSchemas = new PathToSchemasMap(); - int minIndex = data.schema().prefixItems != null ? data.schema().prefixItems.size() : 0; - JsonSchema unevaluatedItemsSchema = JsonSchemaFactory.getInstance(unevaluatedItems); - for(int i = minIndex; i < listArg.size(); i++) { - List itemPathToItem = new ArrayList<>(data.validationMetadata().pathToItem()); - itemPathToItem.add(i); + val pathToSchemas = PathToSchemasMap() + val minIndex = if (data.schema.prefixItems != null) data.schema.prefixItems.size else 0 + val unevaluatedItemsSchema = JsonSchemaFactory.getInstance(unevaluatedItems) + for (i in minIndex until data.arg.size) { + val itemPathToItem: List = data.validationMetadata.pathToItem + i if (knownPathToSchemas.containsKey(itemPathToItem)) { - continue; + continue } - ValidationMetadata itemValidationMetadata = new ValidationMetadata( - itemPathToItem, - data.validationMetadata().configuration(), - data.validationMetadata().validatedPathToSchemas(), - data.validationMetadata().seenClasses() - ); + val itemValidationMetadata = ValidationMetadata( + itemPathToItem, + data.validationMetadata.configuration, + data.validationMetadata.validatedPathToSchemas, + data.validationMetadata.seenClasses + ) if (itemValidationMetadata.validationRanEarlier(unevaluatedItemsSchema)) { // todo add_deeper_validated_schemas - continue; + continue } - PathToSchemasMap otherPathToSchemas = JsonSchema.validate(unevaluatedItemsSchema, listArg.get(i), itemValidationMetadata); - pathToSchemas.update(otherPathToSchemas); + val otherPathToSchemas = JsonSchema.validate(unevaluatedItemsSchema, data.arg[i], itemValidationMetadata) + pathToSchemas.update(otherPathToSchemas) } - return pathToSchemas; + return pathToSchemas } -} +} \ No newline at end of file diff --git a/src/main/resources/kotlin/src/main/kotlin/packagename/schemas/validation/UnevaluatedPropertiesValidator.hbs b/src/main/resources/kotlin/src/main/kotlin/packagename/schemas/validation/UnevaluatedPropertiesValidator.hbs index 9539d7d73b0..29ddb865016 100644 --- a/src/main/resources/kotlin/src/main/kotlin/packagename/schemas/validation/UnevaluatedPropertiesValidator.hbs +++ b/src/main/resources/kotlin/src/main/kotlin/packagename/schemas/validation/UnevaluatedPropertiesValidator.hbs @@ -1,49 +1,36 @@ package {{{packageName}}}.schemas.validation; -import org.checkerframework.checker.nullness.qual.Nullable; import {{{packageName}}}.exceptions.ValidationException; -import java.util.ArrayList; -import java.util.List; -import java.util.Map; - -public class UnevaluatedPropertiesValidator implements KeywordValidator { - @Override - public @Nullable PathToSchemasMap validate( - ValidationData data - ) throws ValidationException { - var unevaluatedProperties = data.schema().unevaluatedProperties; - if (unevaluatedProperties == null) { - return null; - } - var knownPathToSchemas = data.knownPathToSchemas(); - if (knownPathToSchemas == null) { - return null; - } - if (!(data.arg() instanceof Map mapArg)) { - return null; +class UnevaluatedPropertiesValidator : KeywordValidator { + @Throws(ValidationException::class) + override fun validate( + data: ValidationData + ): PathToSchemasMap? { + val unevaluatedProperties: Class> = data.schema.unevaluatedProperties ?: return null + val knownPathToSchemas: PathToSchemasMap = data.knownPathToSchemas ?: return null + if (data.arg !is Map<*, *>) { + return null } - PathToSchemasMap pathToSchemas = new PathToSchemasMap(); - 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"); + val pathToSchemas = PathToSchemasMap() + val unevaluatedPropertiesSchema = JsonSchemaFactory.getInstance(unevaluatedProperties) + for ((key, value) in data.arg.entries) { + if (key !is String) { + throw ValidationException("Map keys must be strings") } - List propPathToItem = new ArrayList<>(data.validationMetadata().pathToItem()); - propPathToItem.add(propName); + val propPathToItem: List = data.validationMetadata.pathToItem + key if (knownPathToSchemas.containsKey(propPathToItem)) { - continue; + continue } - @Nullable Object propValue = mapArg.get(propName); - ValidationMetadata propValidationMetadata = new ValidationMetadata( - propPathToItem, - data.validationMetadata().configuration(), - data.validationMetadata().validatedPathToSchemas(), - data.validationMetadata().seenClasses() - ); - PathToSchemasMap otherPathToSchemas = JsonSchema.validate(unevaluatedPropertiesSchema, propValue, propValidationMetadata); - pathToSchemas.update(otherPathToSchemas); + val propValidationMetadata = ValidationMetadata( + propPathToItem, + data.validationMetadata.configuration, + data.validationMetadata.validatedPathToSchemas, + data.validationMetadata.seenClasses + ) + val otherPathToSchemas = JsonSchema.validate(unevaluatedPropertiesSchema, value, propValidationMetadata) + pathToSchemas.update(otherPathToSchemas) } - return pathToSchemas; + return pathToSchemas } } \ No newline at end of file From 5521ebe19dc40c0846524e061ab27570547077e4 Mon Sep 17 00:00:00 2001 From: Justin Black Date: Wed, 8 May 2024 17:20:03 -0700 Subject: [PATCH 40/78] Updates AnyTypeJsonSchema --- .../client/schemas/AnyTypeJsonSchema.kt | 528 ++++++++++-------- .../packagename/schemas/AnyTypeJsonSchema.hbs | 495 ++++++++-------- 2 files changed, 554 insertions(+), 469 deletions(-) diff --git a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/schemas/AnyTypeJsonSchema.kt b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/schemas/AnyTypeJsonSchema.kt index 1f1c918ca27..1c74c52cf44 100644 --- a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/schemas/AnyTypeJsonSchema.kt +++ b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/schemas/AnyTypeJsonSchema.kt @@ -1,315 +1,357 @@ -package org.openapijsonschematools.client.schemas; - -import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags; -import org.openapijsonschematools.client.configurations.SchemaConfiguration; -import org.openapijsonschematools.client.exceptions.ValidationException; -import org.openapijsonschematools.client.schemas.validation.FrozenList; -import org.openapijsonschematools.client.schemas.validation.FrozenMap; -import org.openapijsonschematools.client.schemas.validation.JsonSchema; -import org.openapijsonschematools.client.schemas.validation.JsonSchemaInfo; -import org.openapijsonschematools.client.schemas.validation.PathToSchemasMap; -import org.openapijsonschematools.client.schemas.validation.NullSchemaValidator; -import org.openapijsonschematools.client.schemas.validation.BooleanSchemaValidator; -import org.openapijsonschematools.client.schemas.validation.NumberSchemaValidator; -import org.openapijsonschematools.client.schemas.validation.StringSchemaValidator; -import org.openapijsonschematools.client.schemas.validation.ListSchemaValidator; -import org.openapijsonschematools.client.schemas.validation.MapSchemaValidator; -import org.openapijsonschematools.client.schemas.validation.ValidationMetadata; -import org.checkerframework.checker.nullness.qual.Nullable; - -import java.time.LocalDate; -import java.time.ZonedDateTime; -import java.util.LinkedHashMap; -import java.util.List; -import java.util.HashSet; -import java.util.ArrayList; -import java.util.LinkedHashSet; -import java.util.Set; -import java.util.Map; -import java.util.Objects; -import java.util.UUID; - -public class AnyTypeJsonSchema { - public sealed interface AnyTypeJsonSchema1Boxed permits AnyTypeJsonSchema1BoxedVoid, AnyTypeJsonSchema1BoxedBoolean, AnyTypeJsonSchema1BoxedNumber, AnyTypeJsonSchema1BoxedString, AnyTypeJsonSchema1BoxedList, AnyTypeJsonSchema1BoxedMap { - @Nullable Object getData(); +package org.openapijsonschematools.client.schemas + +import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags +import org.openapijsonschematools.client.configurations.SchemaConfiguration +import org.openapijsonschematools.client.exceptions.ValidationException +import org.openapijsonschematools.client.schemas.validation.BooleanSchemaValidator +import org.openapijsonschematools.client.schemas.validation.FrozenList +import org.openapijsonschematools.client.schemas.validation.FrozenMap +import org.openapijsonschematools.client.schemas.validation.JsonSchema +import org.openapijsonschematools.client.schemas.validation.JsonSchemaInfo +import org.openapijsonschematools.client.schemas.validation.ListSchemaValidator +import org.openapijsonschematools.client.schemas.validation.MapSchemaValidator +import org.openapijsonschematools.client.schemas.validation.NullSchemaValidator +import org.openapijsonschematools.client.schemas.validation.NumberSchemaValidator +import org.openapijsonschematools.client.schemas.validation.PathToSchemasMap +import org.openapijsonschematools.client.schemas.validation.StringSchemaValidator +import org.openapijsonschematools.client.schemas.validation.ValidationMetadata +import java.time.LocalDate +import java.time.ZonedDateTime +import java.util.UUID + +class AnyTypeJsonSchema { + sealed interface AnyTypeJsonSchema1Boxed { + fun getData(): Any? } - public record AnyTypeJsonSchema1BoxedVoid(Nothing? data) implements AnyTypeJsonSchema1Boxed { - @Override - public @Nullable Object getData() { - return data; + + + data class AnyTypeJsonSchema1BoxedVoid(val data: Nothing?) : AnyTypeJsonSchema1Boxed { + override fun getData(): Any? { + return data } } - public record AnyTypeJsonSchema1BoxedBoolean(boolean data) implements AnyTypeJsonSchema1Boxed { - @Override - public @Nullable Object getData() { - return data; + + + data class AnyTypeJsonSchema1BoxedBoolean(val data: Boolean) : AnyTypeJsonSchema1Boxed { + override fun getData(): Boolean { + return data } } - public record AnyTypeJsonSchema1BoxedNumber(Number data) implements AnyTypeJsonSchema1Boxed { - @Override - public @Nullable Object getData() { - return data; + + + data class AnyTypeJsonSchema1BoxedNumber(val data: Number) : AnyTypeJsonSchema1Boxed { + override fun getData(): Number { + return data } } - public record AnyTypeJsonSchema1BoxedString(String data) implements AnyTypeJsonSchema1Boxed { - @Override - public @Nullable Object getData() { - return data; + + + data class AnyTypeJsonSchema1BoxedString(val data: String) : AnyTypeJsonSchema1Boxed { + override fun getData(): String { + return data } + } - public record AnyTypeJsonSchema1BoxedList(FrozenList<@Nullable Object> data) implements AnyTypeJsonSchema1Boxed { - @Override - public @Nullable Object getData() { - return data; + + + data class AnyTypeJsonSchema1BoxedList(val data: FrozenList) : AnyTypeJsonSchema1Boxed { + override fun getData(): FrozenList { + return data } } - public record AnyTypeJsonSchema1BoxedMap(FrozenMap<@Nullable Object> data) implements AnyTypeJsonSchema1Boxed { - @Override - public @Nullable Object getData() { - return data; + + + data class AnyTypeJsonSchema1BoxedMap(val data: FrozenMap) : AnyTypeJsonSchema1Boxed { + override fun getData(): FrozenMap { + return data } } - public static class AnyTypeJsonSchema1 extends JsonSchema implements NullSchemaValidator, BooleanSchemaValidator, NumberSchemaValidator, StringSchemaValidator, ListSchemaValidator, AnyTypeJsonSchema1BoxedList>, MapSchemaValidator, AnyTypeJsonSchema1BoxedMap> { - private static @Nullable AnyTypeJsonSchema1 instance = null; - - protected AnyTypeJsonSchema1() { - super(new JsonSchemaInfo()); + class AnyTypeJsonSchema1 private constructor() : JsonSchema(JsonSchemaInfo()), + NullSchemaValidator, BooleanSchemaValidator, + NumberSchemaValidator, StringSchemaValidator, + ListSchemaValidator, AnyTypeJsonSchema1BoxedList>, + MapSchemaValidator, AnyTypeJsonSchema1BoxedMap> { + @Throws(ValidationException::class) + override fun validate(arg: Nothing?, configuration: SchemaConfiguration?): Nothing? { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0]") + val castArg: Nothing? = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validatedPathToSchemas = PathToSchemasMap() + val validationMetadata = + ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, LinkedHashSet()) + val pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet) + return getNewInstance(castArg, validationMetadata.pathToItem, pathToSchemasMap) } - public static AnyTypeJsonSchema1 getInstance() { - if (instance == null) { - instance = new AnyTypeJsonSchema1(); - } - return instance; + @Throws(ValidationException::class) + override fun validate(arg: Boolean, configuration: SchemaConfiguration?): Boolean { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0]") + val castArg: Boolean = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validatedPathToSchemas = PathToSchemasMap() + val validationMetadata = + ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, LinkedHashSet()) + val pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet) + return getNewInstance(castArg, validationMetadata.pathToItem, pathToSchemasMap) } - @Override - public Nothing? validate(Nothing? arg, SchemaConfiguration configuration) throws ValidationException { - Set> pathSet = new HashSet<>(); - List pathToItem = List.of("args[0]"); - Nothing? castArg = castToAllowedTypes(arg, pathToItem, pathSet); - SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().build())); - PathToSchemasMap validatedPathToSchemas = new PathToSchemasMap(); - ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, new LinkedHashSet<>()); - PathToSchemasMap pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet); - return getNewInstance(castArg, validationMetadata.pathToItem(), pathToSchemasMap); + @Throws(ValidationException::class) + override fun validate(arg: Number, configuration: SchemaConfiguration?): Number { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0]") + val castArg: Number = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validatedPathToSchemas = PathToSchemasMap() + val validationMetadata = + ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, LinkedHashSet()) + val pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet) + return getNewInstance(castArg, validationMetadata.pathToItem, pathToSchemasMap) } - @Override - public boolean validate(boolean arg, SchemaConfiguration configuration) throws ValidationException { - Set> pathSet = new HashSet<>(); - List pathToItem = List.of("args[0]"); - boolean castArg = castToAllowedTypes(arg, pathToItem, pathSet); - SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().build())); - PathToSchemasMap validatedPathToSchemas = new PathToSchemasMap(); - ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, new LinkedHashSet<>()); - PathToSchemasMap pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet); - return getNewInstance(castArg, validationMetadata.pathToItem(), pathToSchemasMap); + @Throws(ValidationException::class) + fun validate(arg: Int, configuration: SchemaConfiguration?): Int { + return validate(arg as Number, configuration) as Int } - @Override - public Number validate(Number arg, SchemaConfiguration configuration) throws ValidationException { - Set> pathSet = new HashSet<>(); - List pathToItem = List.of("args[0]"); - Number castArg = castToAllowedTypes(arg, pathToItem, pathSet); - SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().build())); - PathToSchemasMap validatedPathToSchemas = new PathToSchemasMap(); - ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, new LinkedHashSet<>()); - PathToSchemasMap pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet); - return getNewInstance(castArg, validationMetadata.pathToItem(), pathToSchemasMap); + @Throws(ValidationException::class) + fun validate(arg: Long, configuration: SchemaConfiguration?): Long { + return validate(arg as Number, configuration) as Long } - public int validate(int arg, SchemaConfiguration configuration) throws ValidationException { - return (int) validate((Number) arg, configuration); + @Throws(ValidationException::class) + fun validate(arg: Float, configuration: SchemaConfiguration?): Float { + return validate(arg as Number, configuration) as Float } - public long validate(long arg, SchemaConfiguration configuration) throws ValidationException { - return (long) validate((Number) arg, configuration); + @Throws(ValidationException::class) + fun validate(arg: Double, configuration: SchemaConfiguration?): Double { + return validate(arg as Number, configuration) as Double } - public float validate(float arg, SchemaConfiguration configuration) throws ValidationException { - return (float) validate((Number) arg, configuration); + @Throws(ValidationException::class) + override fun validate(arg: String, configuration: SchemaConfiguration?): String { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0]") + val castArg: String = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validatedPathToSchemas = PathToSchemasMap() + val validationMetadata = + ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, LinkedHashSet()) + val pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet) + return getNewInstance(castArg, validationMetadata.pathToItem, pathToSchemasMap) } - public double validate(double arg, SchemaConfiguration configuration) throws ValidationException { - return (double) validate((Number) arg, configuration); + @Throws(ValidationException::class) + fun validate(arg: LocalDate, configuration: SchemaConfiguration?): String { + return validate(arg.toString(), configuration) } - @Override - public String validate(String arg, SchemaConfiguration configuration) throws ValidationException { - Set> pathSet = new HashSet<>(); - List pathToItem = List.of("args[0]"); - String castArg = castToAllowedTypes(arg, pathToItem, pathSet); - SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().build())); - PathToSchemasMap validatedPathToSchemas = new PathToSchemasMap(); - ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, new LinkedHashSet<>()); - PathToSchemasMap pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet); - return getNewInstance(castArg, validationMetadata.pathToItem(), pathToSchemasMap); + @Throws(ValidationException::class) + fun validate(arg: ZonedDateTime, configuration: SchemaConfiguration?): String { + return validate(arg.toString(), configuration) } - public String validate(LocalDate arg, SchemaConfiguration configuration) throws ValidationException { - return validate(arg.toString(), configuration); + @Throws(ValidationException::class) + fun validate(arg: UUID, configuration: SchemaConfiguration?): String { + return validate(arg.toString(), configuration) } - public String validate(ZonedDateTime arg, SchemaConfiguration configuration) throws ValidationException { - return validate(arg.toString(), configuration); + override fun getNewInstance( + arg: List<*>, + pathToItem: List, + pathToSchemas: PathToSchemasMap + ): FrozenList { + val items: MutableList = ArrayList() + var i = 0 + for (item in arg) { + val itemPathToItem: List = pathToItem + i + val schemas = pathToSchemas[itemPathToItem] + ?: throw RuntimeException("Validation result is invalid, schemas must exist for a pathToItem") + val itemSchema = schemas.entries.iterator().next().key + val castItem = itemSchema.getNewInstance(item, itemPathToItem, pathToSchemas) + items.add(castItem) + i += 1 + } + return FrozenList(items) } - public String validate(UUID arg, SchemaConfiguration configuration) throws ValidationException { - return validate(arg.toString(), configuration); + @Throws(ValidationException::class) + override fun validate(arg: List<*>, configuration: SchemaConfiguration?): FrozenList { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0]") + val castArg: List<*> = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validatedPathToSchemas = PathToSchemasMap() + val validationMetadata = + ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, LinkedHashSet()) + val pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet) + return getNewInstance(castArg, validationMetadata.pathToItem, pathToSchemasMap) } - @Override - public FrozenList<@Nullable Object> getNewInstance(List arg, List pathToItem, PathToSchemasMap pathToSchemas) { - List<@Nullable Object> items = new ArrayList<>(); - int i = 0; - for (Object item: arg) { - List itemPathToItem = new ArrayList<>(pathToItem); - itemPathToItem.add(i); - LinkedHashMap, Nothing?> schemas = pathToSchemas.get(itemPathToItem); - if (schemas == null) { - throw new RuntimeException("Validation result is invalid, schemas must exist for a pathToItem"); + override fun getNewInstance( + arg: Map<*, *>, + pathToItem: List, + pathToSchemas: PathToSchemasMap + ): FrozenMap { + val properties = LinkedHashMap() + for ((entryKey, value1) in arg) { + if (entryKey !is String) { + throw RuntimeException("Invalid non-string key value") } - JsonSchema itemSchema = schemas.entrySet().iterator().next().getKey(); - @Nullable Object castItem = itemSchema.getNewInstance(item, itemPathToItem, pathToSchemas); - items.add(castItem); - i += 1; + val propertyPathToItem: List = pathToItem + entryKey + val schemas = pathToSchemas[propertyPathToItem] + ?: throw RuntimeException("Validation result is invalid, schemas must exist for a pathToItem") + val propertySchema = schemas.entries.iterator().next().key + val castValue = propertySchema.getNewInstance(value1, propertyPathToItem, pathToSchemas) + properties[entryKey] = castValue } - return new FrozenList<>(items); + return FrozenMap(properties) } - 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); - SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().build())); - PathToSchemasMap validatedPathToSchemas = new PathToSchemasMap(); - ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, new LinkedHashSet<>()); - PathToSchemasMap pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet); - return getNewInstance(castArg, validationMetadata.pathToItem(), pathToSchemasMap); + @Throws(ValidationException::class) + override fun validate(arg: Map<*, *>, configuration: SchemaConfiguration?): FrozenMap { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0]") + val castArg: Map<*, *> = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validatedPathToSchemas = PathToSchemasMap() + val validationMetadata = + ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, LinkedHashSet()) + val pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet) + return getNewInstance(castArg, validationMetadata.pathToItem, pathToSchemasMap) } - @Override - 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 RuntimeException("Invalid non-string key value"); + override fun getNewInstance(arg: Any?, pathToItem: List, pathToSchemas: PathToSchemasMap): Any? { + when (arg) { + null -> { + return getNewInstance(null, pathToItem, pathToSchemas) } - String propertyName = (String) entryKey; - List propertyPathToItem = new ArrayList<>(pathToItem); - propertyPathToItem.add(propertyName); - Object value = entry.getValue(); - LinkedHashMap, Nothing?> schemas = pathToSchemas.get(propertyPathToItem); - if (schemas == null) { - throw new RuntimeException("Validation result is invalid, schemas must exist for a pathToItem"); + is Boolean -> { + return getNewInstance(arg, pathToItem, pathToSchemas) } - JsonSchema propertySchema = schemas.entrySet().iterator().next().getKey(); - @Nullable Object castValue = propertySchema.getNewInstance(value, propertyPathToItem, pathToSchemas); - properties.put(propertyName, castValue); - } - return new FrozenMap<>(properties); - } - public FrozenMap<@Nullable Object> validate(Map arg, SchemaConfiguration configuration) throws ValidationException { - Set> pathSet = new HashSet<>(); - List pathToItem = List.of("args[0]"); - Map castArg = castToAllowedTypes(arg, pathToItem, pathSet); - SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().build())); - PathToSchemasMap validatedPathToSchemas = new PathToSchemasMap(); - ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, new LinkedHashSet<>()); - PathToSchemasMap pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet); - return getNewInstance(castArg, validationMetadata.pathToItem(), pathToSchemasMap); - } + is Number -> { + return getNewInstance(arg as Number?, pathToItem, pathToSchemas) + } + + is String -> { + return getNewInstance(arg as String?, pathToItem, pathToSchemas) + } - @Override - public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { - if (arg == null) { - return getNewInstance((Nothing?) null, pathToItem, pathToSchemas); - } else if (arg instanceof Boolean) { - boolean boolArg = (Boolean) arg; - return getNewInstance(boolArg, pathToItem, pathToSchemas); - } else if (arg instanceof Number) { - return getNewInstance((Number) arg, pathToItem, pathToSchemas); - } else if (arg instanceof String) { - return getNewInstance((String) arg, pathToItem, pathToSchemas); - } else if (arg instanceof List) { - return getNewInstance((List) arg, pathToItem, pathToSchemas); - } else if (arg instanceof Map) { - return getNewInstance((Map) arg, pathToItem, pathToSchemas); + is List<*> -> { + return getNewInstance(arg, pathToItem, pathToSchemas) + } + + is Map<*, *> -> { + return getNewInstance(arg, pathToItem, pathToSchemas) + } + + else -> throw RuntimeException("Invalid input type=$javaClass. It can't be instantiated by this schema") } - 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 { - if (arg == null) { - return validate((Nothing?) null, configuration); - } else if (arg instanceof Boolean) { - boolean boolArg = (Boolean) arg; - return validate(boolArg, configuration); - } else if (arg instanceof Number) { - return validate((Number) arg, configuration); - } else if (arg instanceof String) { - return validate((String) arg, configuration); - } else if (arg instanceof List) { - return validate((List) arg, configuration); - } else if (arg instanceof Map) { - return validate((Map) arg, configuration); + @Throws(ValidationException::class) + override fun validate(arg: Any?, configuration: SchemaConfiguration?): Any? { + when (arg) { + null -> { + return validate(null, configuration) + } + is Boolean -> { + return validate(arg, configuration) + } + + is Number -> { + return validate(arg, configuration) + } + + is String -> { + return validate(arg, configuration) + } + + is List<*> -> { + return validate(arg as List<*>?, configuration) + } + + is Map<*, *> -> { + return validate(arg as Map<*, *>?, configuration) + } + + else -> throw ValidationException("Invalid input type=$javaClass. It can'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(Nothing? arg, SchemaConfiguration configuration) throws ValidationException { - return new AnyTypeJsonSchema1BoxedVoid(validate(arg, configuration)); + @Throws(ValidationException::class) + override fun validateAndBox(arg: Nothing?, configuration: SchemaConfiguration?): AnyTypeJsonSchema1BoxedVoid { + return AnyTypeJsonSchema1BoxedVoid(validate(arg, configuration)) } - @Override - public AnyTypeJsonSchema1BoxedBoolean validateAndBox(boolean arg, SchemaConfiguration configuration) throws ValidationException { - return new AnyTypeJsonSchema1BoxedBoolean(validate(arg, configuration)); + @Throws(ValidationException::class) + override fun validateAndBox(arg: Boolean, configuration: SchemaConfiguration?): AnyTypeJsonSchema1BoxedBoolean { + return AnyTypeJsonSchema1BoxedBoolean(validate(arg, configuration)) } - @Override - public AnyTypeJsonSchema1BoxedNumber validateAndBox(Number arg, SchemaConfiguration configuration) throws ValidationException { - return new AnyTypeJsonSchema1BoxedNumber(validate(arg, configuration)); + @Throws(ValidationException::class) + override fun validateAndBox(arg: Number, configuration: SchemaConfiguration?): AnyTypeJsonSchema1BoxedNumber { + return AnyTypeJsonSchema1BoxedNumber(validate(arg, configuration)) } - @Override - public AnyTypeJsonSchema1BoxedString validateAndBox(String arg, SchemaConfiguration configuration) throws ValidationException { - return new AnyTypeJsonSchema1BoxedString(validate(arg, configuration)); + @Throws(ValidationException::class) + override fun validateAndBox(arg: String, configuration: SchemaConfiguration?): AnyTypeJsonSchema1BoxedString { + return AnyTypeJsonSchema1BoxedString(validate(arg, configuration)) } - @Override - public AnyTypeJsonSchema1BoxedList validateAndBox(List arg, SchemaConfiguration configuration) throws ValidationException { - return new AnyTypeJsonSchema1BoxedList(validate(arg, configuration)); + @Throws(ValidationException::class) + override fun validateAndBox(arg: List<*>, configuration: SchemaConfiguration?): AnyTypeJsonSchema1BoxedList { + return AnyTypeJsonSchema1BoxedList(validate(arg, configuration)) } - @Override - public AnyTypeJsonSchema1BoxedMap validateAndBox(Map arg, SchemaConfiguration configuration) throws ValidationException { - return new AnyTypeJsonSchema1BoxedMap(validate(arg, configuration)); + @Throws(ValidationException::class) + override fun validateAndBox(arg: Map<*, *>, configuration: SchemaConfiguration?): AnyTypeJsonSchema1BoxedMap { + return AnyTypeJsonSchema1BoxedMap(validate(arg, configuration)) } - @Override - public AnyTypeJsonSchema1Boxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { - if (arg == null) { - Nothing? castArg = (Nothing?) arg; - return validateAndBox(castArg, configuration); - } else if (arg instanceof Boolean booleanArg) { - boolean castArg = booleanArg; - return validateAndBox(castArg, configuration); - } else if (arg instanceof String castArg) { - return validateAndBox(castArg, configuration); - } else if (arg instanceof Number castArg) { - return validateAndBox(castArg, configuration); - } else if (arg instanceof List castArg) { - return validateAndBox(castArg, configuration); - } else if (arg instanceof Map castArg) { - return validateAndBox(castArg, configuration); + @Throws(ValidationException::class) + override fun validateAndBox(arg: Any?, configuration: SchemaConfiguration?): AnyTypeJsonSchema1Boxed { + when (arg) { + null -> { + return validateAndBox(null, configuration) + } + is Boolean -> { + val castArg: Boolean = arg + return validateAndBox(castArg, configuration) + } + + is String -> { + return validateAndBox(arg, configuration) + } + + is Number -> { + return validateAndBox(arg, configuration) + } + + is List<*> -> { + return validateAndBox(arg, configuration) + } + + is Map<*, *> -> { + return validateAndBox(arg, configuration) + } + + else -> throw ValidationException("Invalid input type=$javaClass. It can't be validated by this schema") } - throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + } + + companion object { + @Volatile + private var instance: AnyTypeJsonSchema1? = null + + fun getInstance() = + instance ?: synchronized(this) { + instance ?: AnyTypeJsonSchema1().also { instance = it } + } } } } \ No newline at end of file diff --git a/src/main/resources/kotlin/src/main/kotlin/packagename/schemas/AnyTypeJsonSchema.hbs b/src/main/resources/kotlin/src/main/kotlin/packagename/schemas/AnyTypeJsonSchema.hbs index 74c850ef7af..7a47067791d 100644 --- a/src/main/resources/kotlin/src/main/kotlin/packagename/schemas/AnyTypeJsonSchema.hbs +++ b/src/main/resources/kotlin/src/main/kotlin/packagename/schemas/AnyTypeJsonSchema.hbs @@ -15,301 +15,344 @@ import {{{packageName}}}.schemas.validation.StringSchemaValidator; import {{{packageName}}}.schemas.validation.ListSchemaValidator; import {{{packageName}}}.schemas.validation.MapSchemaValidator; import {{{packageName}}}.schemas.validation.ValidationMetadata; -import org.checkerframework.checker.nullness.qual.Nullable; - -import java.time.LocalDate; -import java.time.ZonedDateTime; -import java.util.LinkedHashMap; -import java.util.List; -import java.util.HashSet; -import java.util.ArrayList; -import java.util.LinkedHashSet; -import java.util.Set; -import java.util.Map; -import java.util.Objects; -import java.util.UUID; - -public class AnyTypeJsonSchema { - public sealed interface AnyTypeJsonSchema1Boxed permits AnyTypeJsonSchema1BoxedVoid, AnyTypeJsonSchema1BoxedBoolean, AnyTypeJsonSchema1BoxedNumber, AnyTypeJsonSchema1BoxedString, AnyTypeJsonSchema1BoxedList, AnyTypeJsonSchema1BoxedMap { - @Nullable Object getData(); + +import java.time.LocalDate +import java.time.ZonedDateTime +import java.util.UUID + +class AnyTypeJsonSchema { + sealed interface AnyTypeJsonSchema1Boxed { + fun getData(): Any? } - public record AnyTypeJsonSchema1BoxedVoid(Nothing? data) implements AnyTypeJsonSchema1Boxed { - @Override - public @Nullable Object getData() { - return data; + + + data class AnyTypeJsonSchema1BoxedVoid(val data: Nothing?) : AnyTypeJsonSchema1Boxed { + override fun getData(): Any? { + return data } } - public record AnyTypeJsonSchema1BoxedBoolean(boolean data) implements AnyTypeJsonSchema1Boxed { - @Override - public @Nullable Object getData() { - return data; + + + data class AnyTypeJsonSchema1BoxedBoolean(val data: Boolean) : AnyTypeJsonSchema1Boxed { + override fun getData(): Boolean { + return data } } - public record AnyTypeJsonSchema1BoxedNumber(Number data) implements AnyTypeJsonSchema1Boxed { - @Override - public @Nullable Object getData() { - return data; + + + data class AnyTypeJsonSchema1BoxedNumber(val data: Number) : AnyTypeJsonSchema1Boxed { + override fun getData(): Number { + return data } } - public record AnyTypeJsonSchema1BoxedString(String data) implements AnyTypeJsonSchema1Boxed { - @Override - public @Nullable Object getData() { - return data; + + + data class AnyTypeJsonSchema1BoxedString(val data: String) : AnyTypeJsonSchema1Boxed { + override fun getData(): String { + return data } + } - public record AnyTypeJsonSchema1BoxedList(FrozenList<@Nullable Object> data) implements AnyTypeJsonSchema1Boxed { - @Override - public @Nullable Object getData() { - return data; + + + data class AnyTypeJsonSchema1BoxedList(val data: FrozenList) : AnyTypeJsonSchema1Boxed { + override fun getData(): FrozenList { + return data } } - public record AnyTypeJsonSchema1BoxedMap(FrozenMap<@Nullable Object> data) implements AnyTypeJsonSchema1Boxed { - @Override - public @Nullable Object getData() { - return data; + + + data class AnyTypeJsonSchema1BoxedMap(val data: FrozenMap) : AnyTypeJsonSchema1Boxed { + override fun getData(): FrozenMap { + return data } } - public static class AnyTypeJsonSchema1 extends JsonSchema implements NullSchemaValidator, BooleanSchemaValidator, NumberSchemaValidator, StringSchemaValidator, ListSchemaValidator, AnyTypeJsonSchema1BoxedList>, MapSchemaValidator, AnyTypeJsonSchema1BoxedMap> { - private static @Nullable AnyTypeJsonSchema1 instance = null; - - protected AnyTypeJsonSchema1() { - super(new JsonSchemaInfo()); + class AnyTypeJsonSchema1 private constructor() : JsonSchema(JsonSchemaInfo()), + NullSchemaValidator, BooleanSchemaValidator, + NumberSchemaValidator, StringSchemaValidator, + ListSchemaValidator, AnyTypeJsonSchema1BoxedList>, + MapSchemaValidator, AnyTypeJsonSchema1BoxedMap> { + @Throws(ValidationException::class) + override fun validate(arg: Nothing?, configuration: SchemaConfiguration?): Nothing? { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0]") + val castArg: Nothing? = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validatedPathToSchemas = PathToSchemasMap() + val validationMetadata = + ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, LinkedHashSet()) + val pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet) + return getNewInstance(castArg, validationMetadata.pathToItem, pathToSchemasMap) } - public static AnyTypeJsonSchema1 getInstance() { - if (instance == null) { - instance = new AnyTypeJsonSchema1(); - } - return instance; + @Throws(ValidationException::class) + override fun validate(arg: Boolean, configuration: SchemaConfiguration?): Boolean { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0]") + val castArg: Boolean = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validatedPathToSchemas = PathToSchemasMap() + val validationMetadata = + ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, LinkedHashSet()) + val pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet) + return getNewInstance(castArg, validationMetadata.pathToItem, pathToSchemasMap) } - @Override - public Nothing? validate(Nothing? arg, SchemaConfiguration configuration) throws ValidationException { - Set> pathSet = new HashSet<>(); - List pathToItem = List.of("args[0]"); - Nothing? castArg = castToAllowedTypes(arg, pathToItem, pathSet); - SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().build())); - PathToSchemasMap validatedPathToSchemas = new PathToSchemasMap(); - ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, new LinkedHashSet<>()); - PathToSchemasMap pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet); - return getNewInstance(castArg, validationMetadata.pathToItem(), pathToSchemasMap); + @Throws(ValidationException::class) + override fun validate(arg: Number, configuration: SchemaConfiguration?): Number { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0]") + val castArg: Number = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validatedPathToSchemas = PathToSchemasMap() + val validationMetadata = + ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, LinkedHashSet()) + val pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet) + return getNewInstance(castArg, validationMetadata.pathToItem, pathToSchemasMap) } - @Override - public boolean validate(boolean arg, SchemaConfiguration configuration) throws ValidationException { - Set> pathSet = new HashSet<>(); - List pathToItem = List.of("args[0]"); - boolean castArg = castToAllowedTypes(arg, pathToItem, pathSet); - SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().build())); - PathToSchemasMap validatedPathToSchemas = new PathToSchemasMap(); - ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, new LinkedHashSet<>()); - PathToSchemasMap pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet); - return getNewInstance(castArg, validationMetadata.pathToItem(), pathToSchemasMap); + @Throws(ValidationException::class) + fun validate(arg: Int, configuration: SchemaConfiguration?): Int { + return validate(arg as Number, configuration) as Int } - @Override - public Number validate(Number arg, SchemaConfiguration configuration) throws ValidationException { - Set> pathSet = new HashSet<>(); - List pathToItem = List.of("args[0]"); - Number castArg = castToAllowedTypes(arg, pathToItem, pathSet); - SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().build())); - PathToSchemasMap validatedPathToSchemas = new PathToSchemasMap(); - ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, new LinkedHashSet<>()); - PathToSchemasMap pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet); - return getNewInstance(castArg, validationMetadata.pathToItem(), pathToSchemasMap); + @Throws(ValidationException::class) + fun validate(arg: Long, configuration: SchemaConfiguration?): Long { + return validate(arg as Number, configuration) as Long } - public int validate(int arg, SchemaConfiguration configuration) throws ValidationException { - return (int) validate((Number) arg, configuration); + @Throws(ValidationException::class) + fun validate(arg: Float, configuration: SchemaConfiguration?): Float { + return validate(arg as Number, configuration) as Float } - public long validate(long arg, SchemaConfiguration configuration) throws ValidationException { - return (long) validate((Number) arg, configuration); + @Throws(ValidationException::class) + fun validate(arg: Double, configuration: SchemaConfiguration?): Double { + return validate(arg as Number, configuration) as Double } - public float validate(float arg, SchemaConfiguration configuration) throws ValidationException { - return (float) validate((Number) arg, configuration); + @Throws(ValidationException::class) + override fun validate(arg: String, configuration: SchemaConfiguration?): String { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0]") + val castArg: String = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validatedPathToSchemas = PathToSchemasMap() + val validationMetadata = + ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, LinkedHashSet()) + val pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet) + return getNewInstance(castArg, validationMetadata.pathToItem, pathToSchemasMap) } - public double validate(double arg, SchemaConfiguration configuration) throws ValidationException { - return (double) validate((Number) arg, configuration); + @Throws(ValidationException::class) + fun validate(arg: LocalDate, configuration: SchemaConfiguration?): String { + return validate(arg.toString(), configuration) } - @Override - public String validate(String arg, SchemaConfiguration configuration) throws ValidationException { - Set> pathSet = new HashSet<>(); - List pathToItem = List.of("args[0]"); - String castArg = castToAllowedTypes(arg, pathToItem, pathSet); - SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().build())); - PathToSchemasMap validatedPathToSchemas = new PathToSchemasMap(); - ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, new LinkedHashSet<>()); - PathToSchemasMap pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet); - return getNewInstance(castArg, validationMetadata.pathToItem(), pathToSchemasMap); + @Throws(ValidationException::class) + fun validate(arg: ZonedDateTime, configuration: SchemaConfiguration?): String { + return validate(arg.toString(), configuration) } - public String validate(LocalDate arg, SchemaConfiguration configuration) throws ValidationException { - return validate(arg.toString(), configuration); + @Throws(ValidationException::class) + fun validate(arg: UUID, configuration: SchemaConfiguration?): String { + return validate(arg.toString(), configuration) } - public String validate(ZonedDateTime arg, SchemaConfiguration configuration) throws ValidationException { - return validate(arg.toString(), configuration); + override fun getNewInstance( + arg: List<*>, + pathToItem: List, + pathToSchemas: PathToSchemasMap + ): FrozenList { + val items: MutableList = ArrayList() + var i = 0 + for (item in arg) { + val itemPathToItem: List = pathToItem + i + val schemas = pathToSchemas[itemPathToItem] + ?: throw RuntimeException("Validation result is invalid, schemas must exist for a pathToItem") + val itemSchema = schemas.entries.iterator().next().key + val castItem = itemSchema.getNewInstance(item, itemPathToItem, pathToSchemas) + items.add(castItem) + i += 1 + } + return FrozenList(items) } - public String validate(UUID arg, SchemaConfiguration configuration) throws ValidationException { - return validate(arg.toString(), configuration); + @Throws(ValidationException::class) + override fun validate(arg: List<*>, configuration: SchemaConfiguration?): FrozenList { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0]") + val castArg: List<*> = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validatedPathToSchemas = PathToSchemasMap() + val validationMetadata = + ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, LinkedHashSet()) + val pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet) + return getNewInstance(castArg, validationMetadata.pathToItem, pathToSchemasMap) } - @Override - public FrozenList<@Nullable Object> getNewInstance(List arg, List pathToItem, PathToSchemasMap pathToSchemas) { - List<@Nullable Object> items = new ArrayList<>(); - int i = 0; - for (Object item: arg) { - List itemPathToItem = new ArrayList<>(pathToItem); - itemPathToItem.add(i); - LinkedHashMap, Nothing?> schemas = pathToSchemas.get(itemPathToItem); - if (schemas == null) { - throw new RuntimeException("Validation result is invalid, schemas must exist for a pathToItem"); + override fun getNewInstance( + arg: Map<*, *>, + pathToItem: List, + pathToSchemas: PathToSchemasMap + ): FrozenMap { + val properties = LinkedHashMap() + for ((entryKey, value1) in arg) { + if (entryKey !is String) { + throw RuntimeException("Invalid non-string key value") } - JsonSchema itemSchema = schemas.entrySet().iterator().next().getKey(); - @Nullable Object castItem = itemSchema.getNewInstance(item, itemPathToItem, pathToSchemas); - items.add(castItem); - i += 1; + val propertyPathToItem: List = pathToItem + entryKey + val schemas = pathToSchemas[propertyPathToItem] + ?: throw RuntimeException("Validation result is invalid, schemas must exist for a pathToItem") + val propertySchema = schemas.entries.iterator().next().key + val castValue = propertySchema.getNewInstance(value1, propertyPathToItem, pathToSchemas) + properties[entryKey] = castValue } - return new FrozenList<>(items); + return FrozenMap(properties) } - 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); - SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().build())); - PathToSchemasMap validatedPathToSchemas = new PathToSchemasMap(); - ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, new LinkedHashSet<>()); - PathToSchemasMap pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet); - return getNewInstance(castArg, validationMetadata.pathToItem(), pathToSchemasMap); + @Throws(ValidationException::class) + override fun validate(arg: Map<*, *>, configuration: SchemaConfiguration?): FrozenMap { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0]") + val castArg: Map<*, *> = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validatedPathToSchemas = PathToSchemasMap() + val validationMetadata = + ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, LinkedHashSet()) + val pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet) + return getNewInstance(castArg, validationMetadata.pathToItem, pathToSchemasMap) } - @Override - 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 RuntimeException("Invalid non-string key value"); + override fun getNewInstance(arg: Any?, pathToItem: List, pathToSchemas: PathToSchemasMap): Any? { + when (arg) { + null -> { + return getNewInstance(null, pathToItem, pathToSchemas) } - String propertyName = (String) entryKey; - List propertyPathToItem = new ArrayList<>(pathToItem); - propertyPathToItem.add(propertyName); - Object value = entry.getValue(); - LinkedHashMap, Nothing?> schemas = pathToSchemas.get(propertyPathToItem); - if (schemas == null) { - throw new RuntimeException("Validation result is invalid, schemas must exist for a pathToItem"); + is Boolean -> { + return getNewInstance(arg, pathToItem, pathToSchemas) } - JsonSchema propertySchema = schemas.entrySet().iterator().next().getKey(); - @Nullable Object castValue = propertySchema.getNewInstance(value, propertyPathToItem, pathToSchemas); - properties.put(propertyName, castValue); - } - return new FrozenMap<>(properties); - } - public FrozenMap<@Nullable Object> validate(Map arg, SchemaConfiguration configuration) throws ValidationException { - Set> pathSet = new HashSet<>(); - List pathToItem = List.of("args[0]"); - Map castArg = castToAllowedTypes(arg, pathToItem, pathSet); - SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().build())); - PathToSchemasMap validatedPathToSchemas = new PathToSchemasMap(); - ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, new LinkedHashSet<>()); - PathToSchemasMap pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet); - return getNewInstance(castArg, validationMetadata.pathToItem(), pathToSchemasMap); - } + is Number -> { + return getNewInstance(arg as Number?, pathToItem, pathToSchemas) + } + + is String -> { + return getNewInstance(arg as String?, pathToItem, pathToSchemas) + } + + is List<*> -> { + return getNewInstance(arg, pathToItem, pathToSchemas) + } + + is Map<*, *> -> { + return getNewInstance(arg, pathToItem, pathToSchemas) + } - @Override - public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { - if (arg == null) { - return getNewInstance((Nothing?) null, pathToItem, pathToSchemas); - } else if (arg instanceof Boolean) { - boolean boolArg = (Boolean) arg; - return getNewInstance(boolArg, pathToItem, pathToSchemas); - } else if (arg instanceof Number) { - return getNewInstance((Number) arg, pathToItem, pathToSchemas); - } else if (arg instanceof String) { - return getNewInstance((String) arg, pathToItem, pathToSchemas); - } else if (arg instanceof List) { - return getNewInstance((List) arg, pathToItem, pathToSchemas); - } else if (arg instanceof Map) { - return getNewInstance((Map) arg, pathToItem, pathToSchemas); + else -> throw RuntimeException("Invalid input type=$javaClass. It can'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 { - if (arg == null) { - return validate((Nothing?) null, configuration); - } else if (arg instanceof Boolean) { - boolean boolArg = (Boolean) arg; - return validate(boolArg, configuration); - } else if (arg instanceof Number) { - return validate((Number) arg, configuration); - } else if (arg instanceof String) { - return validate((String) arg, configuration); - } else if (arg instanceof List) { - return validate((List) arg, configuration); - } else if (arg instanceof Map) { - return validate((Map) arg, configuration); + @Throws(ValidationException::class) + override fun validate(arg: Any?, configuration: SchemaConfiguration?): Any? { + when (arg) { + null -> { + return validate(null, configuration) + } + is Boolean -> { + return validate(arg, configuration) + } + + is Number -> { + return validate(arg, configuration) + } + + is String -> { + return validate(arg, configuration) + } + + is List<*> -> { + return validate(arg as List<*>?, configuration) + } + + is Map<*, *> -> { + return validate(arg as Map<*, *>?, configuration) + } + + else -> throw ValidationException("Invalid input type=$javaClass. It can'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(Nothing? arg, SchemaConfiguration configuration) throws ValidationException { - return new AnyTypeJsonSchema1BoxedVoid(validate(arg, configuration)); + @Throws(ValidationException::class) + override fun validateAndBox(arg: Nothing?, configuration: SchemaConfiguration?): AnyTypeJsonSchema1BoxedVoid { + return AnyTypeJsonSchema1BoxedVoid(validate(arg, configuration)) } - @Override - public AnyTypeJsonSchema1BoxedBoolean validateAndBox(boolean arg, SchemaConfiguration configuration) throws ValidationException { - return new AnyTypeJsonSchema1BoxedBoolean(validate(arg, configuration)); + @Throws(ValidationException::class) + override fun validateAndBox(arg: Boolean, configuration: SchemaConfiguration?): AnyTypeJsonSchema1BoxedBoolean { + return AnyTypeJsonSchema1BoxedBoolean(validate(arg, configuration)) } - @Override - public AnyTypeJsonSchema1BoxedNumber validateAndBox(Number arg, SchemaConfiguration configuration) throws ValidationException { - return new AnyTypeJsonSchema1BoxedNumber(validate(arg, configuration)); + @Throws(ValidationException::class) + override fun validateAndBox(arg: Number, configuration: SchemaConfiguration?): AnyTypeJsonSchema1BoxedNumber { + return AnyTypeJsonSchema1BoxedNumber(validate(arg, configuration)) } - @Override - public AnyTypeJsonSchema1BoxedString validateAndBox(String arg, SchemaConfiguration configuration) throws ValidationException { - return new AnyTypeJsonSchema1BoxedString(validate(arg, configuration)); + @Throws(ValidationException::class) + override fun validateAndBox(arg: String, configuration: SchemaConfiguration?): AnyTypeJsonSchema1BoxedString { + return AnyTypeJsonSchema1BoxedString(validate(arg, configuration)) } - @Override - public AnyTypeJsonSchema1BoxedList validateAndBox(List arg, SchemaConfiguration configuration) throws ValidationException { - return new AnyTypeJsonSchema1BoxedList(validate(arg, configuration)); + @Throws(ValidationException::class) + override fun validateAndBox(arg: List<*>, configuration: SchemaConfiguration?): AnyTypeJsonSchema1BoxedList { + return AnyTypeJsonSchema1BoxedList(validate(arg, configuration)) } - @Override - public AnyTypeJsonSchema1BoxedMap validateAndBox(Map arg, SchemaConfiguration configuration) throws ValidationException { - return new AnyTypeJsonSchema1BoxedMap(validate(arg, configuration)); + @Throws(ValidationException::class) + override fun validateAndBox(arg: Map<*, *>, configuration: SchemaConfiguration?): AnyTypeJsonSchema1BoxedMap { + return AnyTypeJsonSchema1BoxedMap(validate(arg, configuration)) } - @Override - public AnyTypeJsonSchema1Boxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { - if (arg == null) { - Nothing? castArg = (Nothing?) arg; - return validateAndBox(castArg, configuration); - } else if (arg instanceof Boolean booleanArg) { - boolean castArg = booleanArg; - return validateAndBox(castArg, configuration); - } else if (arg instanceof String castArg) { - return validateAndBox(castArg, configuration); - } else if (arg instanceof Number castArg) { - return validateAndBox(castArg, configuration); - } else if (arg instanceof List castArg) { - return validateAndBox(castArg, configuration); - } else if (arg instanceof Map castArg) { - return validateAndBox(castArg, configuration); + @Throws(ValidationException::class) + override fun validateAndBox(arg: Any?, configuration: SchemaConfiguration?): AnyTypeJsonSchema1Boxed { + when (arg) { + null -> { + return validateAndBox(null, configuration) + } + is Boolean -> { + val castArg: Boolean = arg + return validateAndBox(castArg, configuration) + } + + is String -> { + return validateAndBox(arg, configuration) + } + + is Number -> { + return validateAndBox(arg, configuration) + } + + is List<*> -> { + return validateAndBox(arg, configuration) + } + + is Map<*, *> -> { + return validateAndBox(arg, configuration) + } + + else -> throw ValidationException("Invalid input type=$javaClass. It can't be validated by this schema") } - throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + } + + companion object { + @Volatile + private var instance: AnyTypeJsonSchema1? = null + + fun getInstance() = + instance ?: synchronized(this) { + instance ?: AnyTypeJsonSchema1().also { instance = it } + } } } } \ No newline at end of file From f887577f8c20263b6305caf92caef084256ea83f Mon Sep 17 00:00:00 2001 From: Justin Black Date: Wed, 8 May 2024 17:30:56 -0700 Subject: [PATCH 41/78] Updates NotAnyTypeJsonSchema --- .../client/schemas/NotAnyTypeJsonSchema.kt | 552 ++++++++++-------- .../schemas/NotAnyTypeJsonSchema.hbs | 518 ++++++++-------- 2 files changed, 597 insertions(+), 473 deletions(-) diff --git a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/schemas/NotAnyTypeJsonSchema.kt b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/schemas/NotAnyTypeJsonSchema.kt index 79aa987aae8..7a893519d45 100644 --- a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/schemas/NotAnyTypeJsonSchema.kt +++ b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/schemas/NotAnyTypeJsonSchema.kt @@ -1,317 +1,379 @@ -package org.openapijsonschematools.client.schemas; - -import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags; -import org.openapijsonschematools.client.configurations.SchemaConfiguration; -import org.openapijsonschematools.client.exceptions.ValidationException; -import org.openapijsonschematools.client.schemas.validation.FrozenList; -import org.openapijsonschematools.client.schemas.validation.FrozenMap; -import org.openapijsonschematools.client.schemas.validation.JsonSchema; -import org.openapijsonschematools.client.schemas.validation.JsonSchemaInfo; -import org.openapijsonschematools.client.schemas.validation.PathToSchemasMap; -import org.openapijsonschematools.client.schemas.validation.NullSchemaValidator; -import org.openapijsonschematools.client.schemas.validation.BooleanSchemaValidator; -import org.openapijsonschematools.client.schemas.validation.NumberSchemaValidator; -import org.openapijsonschematools.client.schemas.validation.StringSchemaValidator; -import org.openapijsonschematools.client.schemas.validation.ListSchemaValidator; -import org.openapijsonschematools.client.schemas.validation.MapSchemaValidator; -import org.openapijsonschematools.client.schemas.validation.ValidationMetadata; -import org.checkerframework.checker.nullness.qual.Nullable; - -import java.time.LocalDate; -import java.time.ZonedDateTime; -import java.util.LinkedHashMap; -import java.util.List; -import java.util.HashSet; -import java.util.ArrayList; -import java.util.LinkedHashSet; -import java.util.Set; -import java.util.Map; -import java.util.Objects; -import java.util.UUID; - -public class NotAnyTypeJsonSchema { - public sealed interface NotAnyTypeJsonSchema1Boxed permits NotAnyTypeJsonSchema1BoxedVoid, NotAnyTypeJsonSchema1BoxedBoolean, NotAnyTypeJsonSchema1BoxedNumber, NotAnyTypeJsonSchema1BoxedString, NotAnyTypeJsonSchema1BoxedList, NotAnyTypeJsonSchema1BoxedMap { - @Nullable Object getData(); +package org.openapijsonschematools.client.schemas + +import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags +import org.openapijsonschematools.client.configurations.SchemaConfiguration +import org.openapijsonschematools.client.exceptions.ValidationException +import org.openapijsonschematools.client.schemas.AnyTypeJsonSchema.AnyTypeJsonSchema1 +import org.openapijsonschematools.client.schemas.validation.BooleanSchemaValidator +import org.openapijsonschematools.client.schemas.validation.FrozenList +import org.openapijsonschematools.client.schemas.validation.FrozenMap +import org.openapijsonschematools.client.schemas.validation.JsonSchema +import org.openapijsonschematools.client.schemas.validation.JsonSchemaInfo +import org.openapijsonschematools.client.schemas.validation.ListSchemaValidator +import org.openapijsonschematools.client.schemas.validation.MapSchemaValidator +import org.openapijsonschematools.client.schemas.validation.NullSchemaValidator +import org.openapijsonschematools.client.schemas.validation.NumberSchemaValidator +import org.openapijsonschematools.client.schemas.validation.PathToSchemasMap +import org.openapijsonschematools.client.schemas.validation.StringSchemaValidator +import org.openapijsonschematools.client.schemas.validation.ValidationMetadata +import java.time.LocalDate +import java.time.ZonedDateTime +import java.util.UUID + +class NotAnyTypeJsonSchema { + sealed interface NotAnyTypeJsonSchema1Boxed { + fun getData(): Any? } - public record NotAnyTypeJsonSchema1BoxedVoid(Nothing? data) implements NotAnyTypeJsonSchema1Boxed { - @Override - public @Nullable Object getData() { - return data; + + + data class NotAnyTypeJsonSchema1BoxedVoid(val data: Void?) : NotAnyTypeJsonSchema1Boxed { + override fun getData(): Any? { + return data } } - public record NotAnyTypeJsonSchema1BoxedBoolean(boolean data) implements NotAnyTypeJsonSchema1Boxed { - @Override - public @Nullable Object getData() { - return data; + + + data class NotAnyTypeJsonSchema1BoxedBoolean(val data: Boolean) : NotAnyTypeJsonSchema1Boxed { + override fun getData(): Boolean { + return data } + } - public record NotAnyTypeJsonSchema1BoxedNumber(Number data) implements NotAnyTypeJsonSchema1Boxed { - @Override - public @Nullable Object getData() { - return data; + + + data class NotAnyTypeJsonSchema1BoxedNumber(val data: Number) : NotAnyTypeJsonSchema1Boxed { + override fun getData(): Number { + return data } } - public record NotAnyTypeJsonSchema1BoxedString(String data) implements NotAnyTypeJsonSchema1Boxed { - @Override - public @Nullable Object getData() { - return data; + + + data class NotAnyTypeJsonSchema1BoxedString(val data: String) : NotAnyTypeJsonSchema1Boxed { + override fun getData(): String { + return data } } - public record NotAnyTypeJsonSchema1BoxedList(FrozenList<@Nullable Object> data) implements NotAnyTypeJsonSchema1Boxed { - @Override - public @Nullable Object getData() { - return data; + + + data class NotAnyTypeJsonSchema1BoxedList(val data: FrozenList) : NotAnyTypeJsonSchema1Boxed { + override fun getData(): FrozenList { + return data } } - public record NotAnyTypeJsonSchema1BoxedMap(FrozenMap<@Nullable Object> data) implements NotAnyTypeJsonSchema1Boxed { - @Override - public @Nullable Object getData() { - return data; + + + data class NotAnyTypeJsonSchema1BoxedMap(val data: FrozenMap) : NotAnyTypeJsonSchema1Boxed { + override fun getData(): FrozenMap { + return data } } - public static class NotAnyTypeJsonSchema1 extends JsonSchema implements NullSchemaValidator, BooleanSchemaValidator, NumberSchemaValidator, StringSchemaValidator, ListSchemaValidator, NotAnyTypeJsonSchema1BoxedList>, MapSchemaValidator, NotAnyTypeJsonSchema1BoxedMap> { - private static @Nullable NotAnyTypeJsonSchema1 instance = null; - - protected NotAnyTypeJsonSchema1() { - super(new JsonSchemaInfo() - .not(AnyTypeJsonSchema.AnyTypeJsonSchema1.class) - ); + class NotAnyTypeJsonSchema1 private constructor() : JsonSchema( + JsonSchemaInfo() + .not(AnyTypeJsonSchema1::class.java) + ), NullSchemaValidator, BooleanSchemaValidator, + NumberSchemaValidator, + StringSchemaValidator, + ListSchemaValidator?, NotAnyTypeJsonSchema1BoxedList?>, + MapSchemaValidator?, NotAnyTypeJsonSchema1BoxedMap?> { + @Throws(ValidationException::class) + override fun validate(arg: Nothing?, configuration: SchemaConfiguration?): Nothing? { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0]") + val castArg: Nothing? = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validatedPathToSchemas = PathToSchemasMap() + val validationMetadata = + ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, LinkedHashSet()) + val pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet) + return getNewInstance(castArg, validationMetadata.pathToItem, pathToSchemasMap) } - public static NotAnyTypeJsonSchema1 getInstance() { - if (instance == null) { - instance = new NotAnyTypeJsonSchema1(); - } - return instance; + @Throws(ValidationException::class) + override fun validate(arg: Boolean, configuration: SchemaConfiguration?): Boolean { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0]") + val castArg: Boolean = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validatedPathToSchemas = PathToSchemasMap() + val validationMetadata = + ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, LinkedHashSet()) + val pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet) + return getNewInstance(castArg, validationMetadata.pathToItem, pathToSchemasMap) } - @Override - public Nothing? validate(Nothing? arg, SchemaConfiguration configuration) throws ValidationException { - Set> pathSet = new HashSet<>(); - List pathToItem = List.of("args[0]"); - Nothing? castArg = castToAllowedTypes(arg, pathToItem, pathSet); - SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().build())); - PathToSchemasMap validatedPathToSchemas = new PathToSchemasMap(); - ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, new LinkedHashSet<>()); - PathToSchemasMap pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet); - return getNewInstance(castArg, validationMetadata.pathToItem(), pathToSchemasMap); + @Throws(ValidationException::class) + override fun validate(arg: Number, configuration: SchemaConfiguration?): Number { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0]") + val castArg: Number = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validatedPathToSchemas = PathToSchemasMap() + val validationMetadata = + ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, LinkedHashSet()) + val pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet) + return getNewInstance(castArg, validationMetadata.pathToItem, pathToSchemasMap) } - @Override - public boolean validate(boolean arg, SchemaConfiguration configuration) throws ValidationException { - Set> pathSet = new HashSet<>(); - List pathToItem = List.of("args[0]"); - boolean castArg = castToAllowedTypes(arg, pathToItem, pathSet); - SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().build())); - PathToSchemasMap validatedPathToSchemas = new PathToSchemasMap(); - ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, new LinkedHashSet<>()); - PathToSchemasMap pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet); - return getNewInstance(castArg, validationMetadata.pathToItem(), pathToSchemasMap); + @Throws(ValidationException::class) + fun validate(arg: Int, configuration: SchemaConfiguration?): Int { + return validate(arg as Number, configuration) as Int } - @Override - public Number validate(Number arg, SchemaConfiguration configuration) throws ValidationException { - Set> pathSet = new HashSet<>(); - List pathToItem = List.of("args[0]"); - Number castArg = castToAllowedTypes(arg, pathToItem, pathSet); - SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().build())); - PathToSchemasMap validatedPathToSchemas = new PathToSchemasMap(); - ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, new LinkedHashSet<>()); - PathToSchemasMap pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet); - return getNewInstance(castArg, validationMetadata.pathToItem(), pathToSchemasMap); + @Throws(ValidationException::class) + fun validate(arg: Long, configuration: SchemaConfiguration?): Long { + return validate(arg as Number, configuration) as Long } - public int validate(int arg, SchemaConfiguration configuration) throws ValidationException { - return (int) validate((Number) arg, configuration); + @Throws(ValidationException::class) + fun validate(arg: Float, configuration: SchemaConfiguration?): Float { + return validate(arg as Number, configuration) as Float } - public long validate(long arg, SchemaConfiguration configuration) throws ValidationException { - return (long) validate((Number) arg, configuration); + @Throws(ValidationException::class) + fun validate(arg: Double, configuration: SchemaConfiguration?): Double { + return validate(arg as Number, configuration) as Double } - public float validate(float arg, SchemaConfiguration configuration) throws ValidationException { - return (float) validate((Number) arg, configuration); + @Throws(ValidationException::class) + override fun validate(arg: String, configuration: SchemaConfiguration?): String { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0]") + val castArg: String = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validatedPathToSchemas = PathToSchemasMap() + val validationMetadata = + ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, LinkedHashSet()) + val pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet) + return getNewInstance(castArg, validationMetadata.pathToItem, pathToSchemasMap) } - public double validate(double arg, SchemaConfiguration configuration) throws ValidationException { - return (double) validate((Number) arg, configuration); + @Throws(ValidationException::class) + fun validate(arg: LocalDate, configuration: SchemaConfiguration?): String { + return validate(arg.toString(), configuration) } - @Override - public String validate(String arg, SchemaConfiguration configuration) throws ValidationException { - Set> pathSet = new HashSet<>(); - List pathToItem = List.of("args[0]"); - String castArg = castToAllowedTypes(arg, pathToItem, pathSet); - SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().build())); - PathToSchemasMap validatedPathToSchemas = new PathToSchemasMap(); - ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, new LinkedHashSet<>()); - PathToSchemasMap pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet); - return getNewInstance(castArg, validationMetadata.pathToItem(), pathToSchemasMap); + @Throws(ValidationException::class) + fun validate(arg: ZonedDateTime, configuration: SchemaConfiguration?): String { + return validate(arg.toString(), configuration) } - public String validate(LocalDate arg, SchemaConfiguration configuration) throws ValidationException { - return validate(arg.toString(), configuration); + @Throws(ValidationException::class) + fun validate(arg: UUID, configuration: SchemaConfiguration?): String { + return validate(arg.toString(), configuration) } - public String validate(ZonedDateTime arg, SchemaConfiguration configuration) throws ValidationException { - return validate(arg.toString(), configuration); + override fun getNewInstance( + arg: List<*>, + pathToItem: List, + pathToSchemas: PathToSchemasMap + ): FrozenList { + val items: MutableList = ArrayList() + var i = 0 + for (item in arg) { + val itemPathToItem: MutableList = ArrayList(pathToItem) + itemPathToItem.add(i) + val schemas = pathToSchemas[itemPathToItem] + ?: throw RuntimeException("Validation result is invalid, schemas must exist for a pathToItem") + val itemSchema = schemas.entries.iterator().next().key + val castItem = itemSchema.getNewInstance(item, itemPathToItem, pathToSchemas) + items.add(castItem) + i += 1 + } + return FrozenList(items) } - public String validate(UUID arg, SchemaConfiguration configuration) throws ValidationException { - return validate(arg.toString(), configuration); + @Throws(ValidationException::class) + override fun validate(arg: List<*>, configuration: SchemaConfiguration?): FrozenList { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0]") + val castArg: List<*> = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validatedPathToSchemas = PathToSchemasMap() + val validationMetadata = + ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, LinkedHashSet()) + val pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet) + return getNewInstance(castArg, validationMetadata.pathToItem, pathToSchemasMap) } - @Override - public FrozenList<@Nullable Object> getNewInstance(List arg, List pathToItem, PathToSchemasMap pathToSchemas) { - List<@Nullable Object> items = new ArrayList<>(); - int i = 0; - for (Object item: arg) { - List itemPathToItem = new ArrayList<>(pathToItem); - itemPathToItem.add(i); - LinkedHashMap, Nothing?> schemas = pathToSchemas.get(itemPathToItem); - if (schemas == null) { - throw new RuntimeException("Validation result is invalid, schemas must exist for a pathToItem"); + override fun getNewInstance( + arg: Map<*, *>, + pathToItem: List, + pathToSchemas: PathToSchemasMap + ): FrozenMap { + val properties = LinkedHashMap() + for ((entryKey, value1) in arg) { + if (entryKey !is String) { + throw RuntimeException("Invalid non-string key value") } - JsonSchema itemSchema = schemas.entrySet().iterator().next().getKey(); - @Nullable Object castItem = itemSchema.getNewInstance(item, itemPathToItem, pathToSchemas); - items.add(castItem); - i += 1; + val propertyPathToItem: MutableList = ArrayList(pathToItem) + propertyPathToItem.add(entryKey) + val schemas = pathToSchemas[propertyPathToItem] + ?: throw RuntimeException("Validation result is invalid, schemas must exist for a pathToItem") + val propertySchema = schemas.entries.iterator().next().key + val castValue = propertySchema.getNewInstance(value1, propertyPathToItem, pathToSchemas) + properties[entryKey] = castValue } - return new FrozenList<>(items); + return FrozenMap(properties) } - 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); - SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().build())); - PathToSchemasMap validatedPathToSchemas = new PathToSchemasMap(); - ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, new LinkedHashSet<>()); - PathToSchemasMap pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet); - return getNewInstance(castArg, validationMetadata.pathToItem(), pathToSchemasMap); + @Throws(ValidationException::class) + override fun validate(arg: Map<*, *>, configuration: SchemaConfiguration?): FrozenMap { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0]") + val castArg: Map<*, *> = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validatedPathToSchemas = PathToSchemasMap() + val validationMetadata = + ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, LinkedHashSet()) + val pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet) + return getNewInstance(castArg, validationMetadata.pathToItem, pathToSchemasMap) } - @Override - 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 RuntimeException("Invalid non-string key value"); + override fun getNewInstance(arg: Any?, pathToItem: List, pathToSchemas: PathToSchemasMap): Any? { + when (arg) { + null -> { + return getNewInstance(null as Void?, pathToItem, pathToSchemas) } - String propertyName = (String) entryKey; - List propertyPathToItem = new ArrayList<>(pathToItem); - propertyPathToItem.add(propertyName); - Object value = entry.getValue(); - LinkedHashMap, Nothing?> schemas = pathToSchemas.get(propertyPathToItem); - if (schemas == null) { - throw new RuntimeException("Validation result is invalid, schemas must exist for a pathToItem"); + is Boolean -> { + return getNewInstance(arg, pathToItem, pathToSchemas) } - JsonSchema propertySchema = schemas.entrySet().iterator().next().getKey(); - @Nullable Object castValue = propertySchema.getNewInstance(value, propertyPathToItem, pathToSchemas); - properties.put(propertyName, castValue); - } - return new FrozenMap<>(properties); - } - public FrozenMap<@Nullable Object> validate(Map arg, SchemaConfiguration configuration) throws ValidationException { - Set> pathSet = new HashSet<>(); - List pathToItem = List.of("args[0]"); - Map castArg = castToAllowedTypes(arg, pathToItem, pathSet); - SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().build())); - PathToSchemasMap validatedPathToSchemas = new PathToSchemasMap(); - ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, new LinkedHashSet<>()); - PathToSchemasMap pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet); - return getNewInstance(castArg, validationMetadata.pathToItem(), pathToSchemasMap); - } + is Number -> { + return getNewInstance(arg as Number?, pathToItem, pathToSchemas) + } + + is String -> { + return getNewInstance(arg as String?, pathToItem, pathToSchemas) + } - @Override - public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { - if (arg == null) { - return getNewInstance((Nothing?) null, pathToItem, pathToSchemas); - } else if (arg instanceof Boolean) { - boolean boolArg = (Boolean) arg; - return getNewInstance(boolArg, pathToItem, pathToSchemas); - } else if (arg instanceof Number) { - return getNewInstance((Number) arg, pathToItem, pathToSchemas); - } else if (arg instanceof String) { - return getNewInstance((String) arg, pathToItem, pathToSchemas); - } else if (arg instanceof List) { - return getNewInstance((List) arg, pathToItem, pathToSchemas); - } else if (arg instanceof Map) { - return getNewInstance((Map) arg, pathToItem, pathToSchemas); + is List<*> -> { + return getNewInstance(arg, pathToItem, pathToSchemas) + } + + is Map<*, *> -> { + return getNewInstance(arg, pathToItem, pathToSchemas) + } + + else -> throw RuntimeException("Invalid input type=$javaClass. It can't be instantiated by this schema") } - 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 { - if (arg == null) { - return validate((Nothing?) null, configuration); - } else if (arg instanceof Boolean) { - boolean boolArg = (Boolean) arg; - return validate(boolArg, configuration); - } else if (arg instanceof Number) { - return validate((Number) arg, configuration); - } else if (arg instanceof String) { - return validate((String) arg, configuration); - } else if (arg instanceof List) { - return validate((List) arg, configuration); - } else if (arg instanceof Map) { - return validate((Map) arg, configuration); + @Throws(ValidationException::class) + override fun validate(arg: Any?, configuration: SchemaConfiguration?): Any? { + when (arg) { + null -> { + return validate(null as Void?, configuration) + } + is Boolean -> { + return validate(arg, configuration) + } + + is Number -> { + return validate(arg, configuration) + } + + is String -> { + return validate(arg, configuration) + } + + is List<*> -> { + return validate(arg as List<*>?, configuration) + } + + is Map<*, *> -> { + return validate(arg as Map<*, *>?, configuration) + } + + else -> throw ValidationException("Invalid input type=$javaClass. It can'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(Nothing? arg, SchemaConfiguration configuration) throws ValidationException { - return new NotAnyTypeJsonSchema1BoxedVoid(validate(arg, configuration)); + @Throws(ValidationException::class) + override fun validateAndBox(arg: Nothing?, configuration: SchemaConfiguration?): NotAnyTypeJsonSchema1BoxedVoid { + return NotAnyTypeJsonSchema1BoxedVoid(validate(arg, configuration)) } - @Override - public NotAnyTypeJsonSchema1BoxedBoolean validateAndBox(boolean arg, SchemaConfiguration configuration) throws ValidationException { - return new NotAnyTypeJsonSchema1BoxedBoolean(validate(arg, configuration)); + @Throws(ValidationException::class) + override fun validateAndBox( + arg: Boolean, + configuration: SchemaConfiguration? + ): NotAnyTypeJsonSchema1BoxedBoolean { + return NotAnyTypeJsonSchema1BoxedBoolean(validate(arg, configuration)) } - @Override - public NotAnyTypeJsonSchema1BoxedNumber validateAndBox(Number arg, SchemaConfiguration configuration) throws ValidationException { - return new NotAnyTypeJsonSchema1BoxedNumber(validate(arg, configuration)); + @Throws(ValidationException::class) + override fun validateAndBox( + arg: Number, + configuration: SchemaConfiguration? + ): NotAnyTypeJsonSchema1BoxedNumber { + return NotAnyTypeJsonSchema1BoxedNumber(validate(arg, configuration)) } - @Override - public NotAnyTypeJsonSchema1BoxedString validateAndBox(String arg, SchemaConfiguration configuration) throws ValidationException { - return new NotAnyTypeJsonSchema1BoxedString(validate(arg, configuration)); + @Throws(ValidationException::class) + override fun validateAndBox( + arg: String, + configuration: SchemaConfiguration? + ): NotAnyTypeJsonSchema1BoxedString { + return NotAnyTypeJsonSchema1BoxedString(validate(arg, configuration)) } - @Override - public NotAnyTypeJsonSchema1BoxedList validateAndBox(List arg, SchemaConfiguration configuration) throws ValidationException { - return new NotAnyTypeJsonSchema1BoxedList(validate(arg, configuration)); + @Throws(ValidationException::class) + override fun validateAndBox( + arg: List<*>, + configuration: SchemaConfiguration? + ): NotAnyTypeJsonSchema1BoxedList { + return NotAnyTypeJsonSchema1BoxedList(validate(arg, configuration)) } - @Override - public NotAnyTypeJsonSchema1BoxedMap validateAndBox(Map arg, SchemaConfiguration configuration) throws ValidationException { - return new NotAnyTypeJsonSchema1BoxedMap(validate(arg, configuration)); + @Throws(ValidationException::class) + override fun validateAndBox( + arg: Map<*, *>, + configuration: SchemaConfiguration? + ): NotAnyTypeJsonSchema1BoxedMap { + return NotAnyTypeJsonSchema1BoxedMap(validate(arg, configuration)) } - @Override - public NotAnyTypeJsonSchema1Boxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { - if (arg == null) { - Nothing? castArg = (Nothing?) arg; - return validateAndBox(castArg, configuration); - } else if (arg instanceof Boolean booleanArg) { - boolean castArg = booleanArg; - return validateAndBox(castArg, configuration); - } else if (arg instanceof String castArg) { - return validateAndBox(castArg, configuration); - } else if (arg instanceof Number castArg) { - return validateAndBox(castArg, configuration); - } else if (arg instanceof List castArg) { - return validateAndBox(castArg, configuration); - } else if (arg instanceof Map castArg) { - return validateAndBox(castArg, configuration); + @Throws(ValidationException::class) + override fun validateAndBox(arg: Any?, configuration: SchemaConfiguration?): NotAnyTypeJsonSchema1Boxed { + when (arg) { + null -> { + return validateAndBox(null, configuration) + } + is Boolean -> { + val castArg: Boolean = arg + return validateAndBox(castArg, configuration) + } + + is String -> { + return validateAndBox(arg, configuration) + } + + is Number -> { + return validateAndBox(arg, configuration) + } + + is List<*> -> { + return validateAndBox(arg, configuration) + } + + is Map<*, *> -> { + return validateAndBox(arg, configuration) + } + + else -> throw ValidationException("Invalid input type=$javaClass. It can't be validated by this schema") } - throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + } + + companion object { + var instance: NotAnyTypeJsonSchema1? = null + get() { + if (field == null) { + field = NotAnyTypeJsonSchema1() + } + return field + } + private set } } } \ No newline at end of file diff --git a/src/main/resources/kotlin/src/main/kotlin/packagename/schemas/NotAnyTypeJsonSchema.hbs b/src/main/resources/kotlin/src/main/kotlin/packagename/schemas/NotAnyTypeJsonSchema.hbs index 07f10999fef..74a9621c013 100644 --- a/src/main/resources/kotlin/src/main/kotlin/packagename/schemas/NotAnyTypeJsonSchema.hbs +++ b/src/main/resources/kotlin/src/main/kotlin/packagename/schemas/NotAnyTypeJsonSchema.hbs @@ -15,303 +15,365 @@ import {{{packageName}}}.schemas.validation.StringSchemaValidator; import {{{packageName}}}.schemas.validation.ListSchemaValidator; import {{{packageName}}}.schemas.validation.MapSchemaValidator; import {{{packageName}}}.schemas.validation.ValidationMetadata; -import org.checkerframework.checker.nullness.qual.Nullable; - -import java.time.LocalDate; -import java.time.ZonedDateTime; -import java.util.LinkedHashMap; -import java.util.List; -import java.util.HashSet; -import java.util.ArrayList; -import java.util.LinkedHashSet; -import java.util.Set; -import java.util.Map; -import java.util.Objects; -import java.util.UUID; - -public class NotAnyTypeJsonSchema { - public sealed interface NotAnyTypeJsonSchema1Boxed permits NotAnyTypeJsonSchema1BoxedVoid, NotAnyTypeJsonSchema1BoxedBoolean, NotAnyTypeJsonSchema1BoxedNumber, NotAnyTypeJsonSchema1BoxedString, NotAnyTypeJsonSchema1BoxedList, NotAnyTypeJsonSchema1BoxedMap { - @Nullable Object getData(); + +import java.time.LocalDate +import java.time.ZonedDateTime +import java.util.UUID + +class NotAnyTypeJsonSchema { + sealed interface NotAnyTypeJsonSchema1Boxed { + fun getData(): Any? } - public record NotAnyTypeJsonSchema1BoxedVoid(Nothing? data) implements NotAnyTypeJsonSchema1Boxed { - @Override - public @Nullable Object getData() { - return data; + + + data class NotAnyTypeJsonSchema1BoxedVoid(val data: Void?) : NotAnyTypeJsonSchema1Boxed { + override fun getData(): Any? { + return data } } - public record NotAnyTypeJsonSchema1BoxedBoolean(boolean data) implements NotAnyTypeJsonSchema1Boxed { - @Override - public @Nullable Object getData() { - return data; + + + data class NotAnyTypeJsonSchema1BoxedBoolean(val data: Boolean) : NotAnyTypeJsonSchema1Boxed { + override fun getData(): Boolean { + return data } + } - public record NotAnyTypeJsonSchema1BoxedNumber(Number data) implements NotAnyTypeJsonSchema1Boxed { - @Override - public @Nullable Object getData() { - return data; + + + data class NotAnyTypeJsonSchema1BoxedNumber(val data: Number) : NotAnyTypeJsonSchema1Boxed { + override fun getData(): Number { + return data } } - public record NotAnyTypeJsonSchema1BoxedString(String data) implements NotAnyTypeJsonSchema1Boxed { - @Override - public @Nullable Object getData() { - return data; + + + data class NotAnyTypeJsonSchema1BoxedString(val data: String) : NotAnyTypeJsonSchema1Boxed { + override fun getData(): String { + return data } } - public record NotAnyTypeJsonSchema1BoxedList(FrozenList<@Nullable Object> data) implements NotAnyTypeJsonSchema1Boxed { - @Override - public @Nullable Object getData() { - return data; + + + data class NotAnyTypeJsonSchema1BoxedList(val data: FrozenList) : NotAnyTypeJsonSchema1Boxed { + override fun getData(): FrozenList { + return data } } - public record NotAnyTypeJsonSchema1BoxedMap(FrozenMap<@Nullable Object> data) implements NotAnyTypeJsonSchema1Boxed { - @Override - public @Nullable Object getData() { - return data; + + + data class NotAnyTypeJsonSchema1BoxedMap(val data: FrozenMap) : NotAnyTypeJsonSchema1Boxed { + override fun getData(): FrozenMap { + return data } } - public static class NotAnyTypeJsonSchema1 extends JsonSchema implements NullSchemaValidator, BooleanSchemaValidator, NumberSchemaValidator, StringSchemaValidator, ListSchemaValidator, NotAnyTypeJsonSchema1BoxedList>, MapSchemaValidator, NotAnyTypeJsonSchema1BoxedMap> { - private static @Nullable NotAnyTypeJsonSchema1 instance = null; - - protected NotAnyTypeJsonSchema1() { - super(new JsonSchemaInfo() - .not(AnyTypeJsonSchema.AnyTypeJsonSchema1.class) - ); + class NotAnyTypeJsonSchema1 private constructor() : JsonSchema( + JsonSchemaInfo() + .not(AnyTypeJsonSchema1::class.java) + ), NullSchemaValidator, BooleanSchemaValidator, + NumberSchemaValidator, + StringSchemaValidator, + ListSchemaValidator?, NotAnyTypeJsonSchema1BoxedList?>, + MapSchemaValidator?, NotAnyTypeJsonSchema1BoxedMap?> { + @Throws(ValidationException::class) + override fun validate(arg: Nothing?, configuration: SchemaConfiguration?): Nothing? { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0]") + val castArg: Nothing? = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validatedPathToSchemas = PathToSchemasMap() + val validationMetadata = + ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, LinkedHashSet()) + val pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet) + return getNewInstance(castArg, validationMetadata.pathToItem, pathToSchemasMap) } - public static NotAnyTypeJsonSchema1 getInstance() { - if (instance == null) { - instance = new NotAnyTypeJsonSchema1(); - } - return instance; + @Throws(ValidationException::class) + override fun validate(arg: Boolean, configuration: SchemaConfiguration?): Boolean { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0]") + val castArg: Boolean = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validatedPathToSchemas = PathToSchemasMap() + val validationMetadata = + ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, LinkedHashSet()) + val pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet) + return getNewInstance(castArg, validationMetadata.pathToItem, pathToSchemasMap) } - @Override - public Nothing? validate(Nothing? arg, SchemaConfiguration configuration) throws ValidationException { - Set> pathSet = new HashSet<>(); - List pathToItem = List.of("args[0]"); - Nothing? castArg = castToAllowedTypes(arg, pathToItem, pathSet); - SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().build())); - PathToSchemasMap validatedPathToSchemas = new PathToSchemasMap(); - ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, new LinkedHashSet<>()); - PathToSchemasMap pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet); - return getNewInstance(castArg, validationMetadata.pathToItem(), pathToSchemasMap); + @Throws(ValidationException::class) + override fun validate(arg: Number, configuration: SchemaConfiguration?): Number { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0]") + val castArg: Number = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validatedPathToSchemas = PathToSchemasMap() + val validationMetadata = + ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, LinkedHashSet()) + val pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet) + return getNewInstance(castArg, validationMetadata.pathToItem, pathToSchemasMap) } - @Override - public boolean validate(boolean arg, SchemaConfiguration configuration) throws ValidationException { - Set> pathSet = new HashSet<>(); - List pathToItem = List.of("args[0]"); - boolean castArg = castToAllowedTypes(arg, pathToItem, pathSet); - SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().build())); - PathToSchemasMap validatedPathToSchemas = new PathToSchemasMap(); - ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, new LinkedHashSet<>()); - PathToSchemasMap pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet); - return getNewInstance(castArg, validationMetadata.pathToItem(), pathToSchemasMap); + @Throws(ValidationException::class) + fun validate(arg: Int, configuration: SchemaConfiguration?): Int { + return validate(arg as Number, configuration) as Int } - @Override - public Number validate(Number arg, SchemaConfiguration configuration) throws ValidationException { - Set> pathSet = new HashSet<>(); - List pathToItem = List.of("args[0]"); - Number castArg = castToAllowedTypes(arg, pathToItem, pathSet); - SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().build())); - PathToSchemasMap validatedPathToSchemas = new PathToSchemasMap(); - ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, new LinkedHashSet<>()); - PathToSchemasMap pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet); - return getNewInstance(castArg, validationMetadata.pathToItem(), pathToSchemasMap); + @Throws(ValidationException::class) + fun validate(arg: Long, configuration: SchemaConfiguration?): Long { + return validate(arg as Number, configuration) as Long } - public int validate(int arg, SchemaConfiguration configuration) throws ValidationException { - return (int) validate((Number) arg, configuration); + @Throws(ValidationException::class) + fun validate(arg: Float, configuration: SchemaConfiguration?): Float { + return validate(arg as Number, configuration) as Float } - public long validate(long arg, SchemaConfiguration configuration) throws ValidationException { - return (long) validate((Number) arg, configuration); + @Throws(ValidationException::class) + fun validate(arg: Double, configuration: SchemaConfiguration?): Double { + return validate(arg as Number, configuration) as Double } - public float validate(float arg, SchemaConfiguration configuration) throws ValidationException { - return (float) validate((Number) arg, configuration); + @Throws(ValidationException::class) + override fun validate(arg: String, configuration: SchemaConfiguration?): String { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0]") + val castArg: String = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validatedPathToSchemas = PathToSchemasMap() + val validationMetadata = + ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, LinkedHashSet()) + val pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet) + return getNewInstance(castArg, validationMetadata.pathToItem, pathToSchemasMap) } - public double validate(double arg, SchemaConfiguration configuration) throws ValidationException { - return (double) validate((Number) arg, configuration); + @Throws(ValidationException::class) + fun validate(arg: LocalDate, configuration: SchemaConfiguration?): String { + return validate(arg.toString(), configuration) } - @Override - public String validate(String arg, SchemaConfiguration configuration) throws ValidationException { - Set> pathSet = new HashSet<>(); - List pathToItem = List.of("args[0]"); - String castArg = castToAllowedTypes(arg, pathToItem, pathSet); - SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().build())); - PathToSchemasMap validatedPathToSchemas = new PathToSchemasMap(); - ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, new LinkedHashSet<>()); - PathToSchemasMap pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet); - return getNewInstance(castArg, validationMetadata.pathToItem(), pathToSchemasMap); + @Throws(ValidationException::class) + fun validate(arg: ZonedDateTime, configuration: SchemaConfiguration?): String { + return validate(arg.toString(), configuration) } - public String validate(LocalDate arg, SchemaConfiguration configuration) throws ValidationException { - return validate(arg.toString(), configuration); + @Throws(ValidationException::class) + fun validate(arg: UUID, configuration: SchemaConfiguration?): String { + return validate(arg.toString(), configuration) } - public String validate(ZonedDateTime arg, SchemaConfiguration configuration) throws ValidationException { - return validate(arg.toString(), configuration); + override fun getNewInstance( + arg: List<*>, + pathToItem: List, + pathToSchemas: PathToSchemasMap + ): FrozenList { + val items: MutableList = ArrayList() + var i = 0 + for (item in arg) { + val itemPathToItem: MutableList = ArrayList(pathToItem) + itemPathToItem.add(i) + val schemas = pathToSchemas[itemPathToItem] + ?: throw RuntimeException("Validation result is invalid, schemas must exist for a pathToItem") + val itemSchema = schemas.entries.iterator().next().key + val castItem = itemSchema.getNewInstance(item, itemPathToItem, pathToSchemas) + items.add(castItem) + i += 1 + } + return FrozenList(items) } - public String validate(UUID arg, SchemaConfiguration configuration) throws ValidationException { - return validate(arg.toString(), configuration); + @Throws(ValidationException::class) + override fun validate(arg: List<*>, configuration: SchemaConfiguration?): FrozenList { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0]") + val castArg: List<*> = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validatedPathToSchemas = PathToSchemasMap() + val validationMetadata = + ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, LinkedHashSet()) + val pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet) + return getNewInstance(castArg, validationMetadata.pathToItem, pathToSchemasMap) } - @Override - public FrozenList<@Nullable Object> getNewInstance(List arg, List pathToItem, PathToSchemasMap pathToSchemas) { - List<@Nullable Object> items = new ArrayList<>(); - int i = 0; - for (Object item: arg) { - List itemPathToItem = new ArrayList<>(pathToItem); - itemPathToItem.add(i); - LinkedHashMap, Nothing?> schemas = pathToSchemas.get(itemPathToItem); - if (schemas == null) { - throw new RuntimeException("Validation result is invalid, schemas must exist for a pathToItem"); + override fun getNewInstance( + arg: Map<*, *>, + pathToItem: List, + pathToSchemas: PathToSchemasMap + ): FrozenMap { + val properties = LinkedHashMap() + for ((entryKey, value1) in arg) { + if (entryKey !is String) { + throw RuntimeException("Invalid non-string key value") } - JsonSchema itemSchema = schemas.entrySet().iterator().next().getKey(); - @Nullable Object castItem = itemSchema.getNewInstance(item, itemPathToItem, pathToSchemas); - items.add(castItem); - i += 1; + val propertyPathToItem: MutableList = ArrayList(pathToItem) + propertyPathToItem.add(entryKey) + val schemas = pathToSchemas[propertyPathToItem] + ?: throw RuntimeException("Validation result is invalid, schemas must exist for a pathToItem") + val propertySchema = schemas.entries.iterator().next().key + val castValue = propertySchema.getNewInstance(value1, propertyPathToItem, pathToSchemas) + properties[entryKey] = castValue } - return new FrozenList<>(items); + return FrozenMap(properties) } - 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); - SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().build())); - PathToSchemasMap validatedPathToSchemas = new PathToSchemasMap(); - ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, new LinkedHashSet<>()); - PathToSchemasMap pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet); - return getNewInstance(castArg, validationMetadata.pathToItem(), pathToSchemasMap); + @Throws(ValidationException::class) + override fun validate(arg: Map<*, *>, configuration: SchemaConfiguration?): FrozenMap { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0]") + val castArg: Map<*, *> = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validatedPathToSchemas = PathToSchemasMap() + val validationMetadata = + ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, LinkedHashSet()) + val pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet) + return getNewInstance(castArg, validationMetadata.pathToItem, pathToSchemasMap) } - @Override - 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 RuntimeException("Invalid non-string key value"); + override fun getNewInstance(arg: Any?, pathToItem: List, pathToSchemas: PathToSchemasMap): Any? { + when (arg) { + null -> { + return getNewInstance(null as Void?, pathToItem, pathToSchemas) } - String propertyName = (String) entryKey; - List propertyPathToItem = new ArrayList<>(pathToItem); - propertyPathToItem.add(propertyName); - Object value = entry.getValue(); - LinkedHashMap, Nothing?> schemas = pathToSchemas.get(propertyPathToItem); - if (schemas == null) { - throw new RuntimeException("Validation result is invalid, schemas must exist for a pathToItem"); + is Boolean -> { + return getNewInstance(arg, pathToItem, pathToSchemas) } - JsonSchema propertySchema = schemas.entrySet().iterator().next().getKey(); - @Nullable Object castValue = propertySchema.getNewInstance(value, propertyPathToItem, pathToSchemas); - properties.put(propertyName, castValue); - } - return new FrozenMap<>(properties); - } - public FrozenMap<@Nullable Object> validate(Map arg, SchemaConfiguration configuration) throws ValidationException { - Set> pathSet = new HashSet<>(); - List pathToItem = List.of("args[0]"); - Map castArg = castToAllowedTypes(arg, pathToItem, pathSet); - SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().build())); - PathToSchemasMap validatedPathToSchemas = new PathToSchemasMap(); - ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, new LinkedHashSet<>()); - PathToSchemasMap pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet); - return getNewInstance(castArg, validationMetadata.pathToItem(), pathToSchemasMap); - } + is Number -> { + return getNewInstance(arg as Number?, pathToItem, pathToSchemas) + } + + is String -> { + return getNewInstance(arg as String?, pathToItem, pathToSchemas) + } - @Override - public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { - if (arg == null) { - return getNewInstance((Nothing?) null, pathToItem, pathToSchemas); - } else if (arg instanceof Boolean) { - boolean boolArg = (Boolean) arg; - return getNewInstance(boolArg, pathToItem, pathToSchemas); - } else if (arg instanceof Number) { - return getNewInstance((Number) arg, pathToItem, pathToSchemas); - } else if (arg instanceof String) { - return getNewInstance((String) arg, pathToItem, pathToSchemas); - } else if (arg instanceof List) { - return getNewInstance((List) arg, pathToItem, pathToSchemas); - } else if (arg instanceof Map) { - return getNewInstance((Map) arg, pathToItem, pathToSchemas); + is List<*> -> { + return getNewInstance(arg, pathToItem, pathToSchemas) + } + + is Map<*, *> -> { + return getNewInstance(arg, pathToItem, pathToSchemas) + } + + else -> throw RuntimeException("Invalid input type=$javaClass. It can't be instantiated by this schema") } - 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 { - if (arg == null) { - return validate((Nothing?) null, configuration); - } else if (arg instanceof Boolean) { - boolean boolArg = (Boolean) arg; - return validate(boolArg, configuration); - } else if (arg instanceof Number) { - return validate((Number) arg, configuration); - } else if (arg instanceof String) { - return validate((String) arg, configuration); - } else if (arg instanceof List) { - return validate((List) arg, configuration); - } else if (arg instanceof Map) { - return validate((Map) arg, configuration); + @Throws(ValidationException::class) + override fun validate(arg: Any?, configuration: SchemaConfiguration?): Any? { + when (arg) { + null -> { + return validate(null as Void?, configuration) + } + is Boolean -> { + return validate(arg, configuration) + } + + is Number -> { + return validate(arg, configuration) + } + + is String -> { + return validate(arg, configuration) + } + + is List<*> -> { + return validate(arg as List<*>?, configuration) + } + + is Map<*, *> -> { + return validate(arg as Map<*, *>?, configuration) + } + + else -> throw ValidationException("Invalid input type=$javaClass. It can'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(Nothing? arg, SchemaConfiguration configuration) throws ValidationException { - return new NotAnyTypeJsonSchema1BoxedVoid(validate(arg, configuration)); + @Throws(ValidationException::class) + override fun validateAndBox(arg: Nothing?, configuration: SchemaConfiguration?): NotAnyTypeJsonSchema1BoxedVoid { + return NotAnyTypeJsonSchema1BoxedVoid(validate(arg, configuration)) } - @Override - public NotAnyTypeJsonSchema1BoxedBoolean validateAndBox(boolean arg, SchemaConfiguration configuration) throws ValidationException { - return new NotAnyTypeJsonSchema1BoxedBoolean(validate(arg, configuration)); + @Throws(ValidationException::class) + override fun validateAndBox( + arg: Boolean, + configuration: SchemaConfiguration? + ): NotAnyTypeJsonSchema1BoxedBoolean { + return NotAnyTypeJsonSchema1BoxedBoolean(validate(arg, configuration)) } - @Override - public NotAnyTypeJsonSchema1BoxedNumber validateAndBox(Number arg, SchemaConfiguration configuration) throws ValidationException { - return new NotAnyTypeJsonSchema1BoxedNumber(validate(arg, configuration)); + @Throws(ValidationException::class) + override fun validateAndBox( + arg: Number, + configuration: SchemaConfiguration? + ): NotAnyTypeJsonSchema1BoxedNumber { + return NotAnyTypeJsonSchema1BoxedNumber(validate(arg, configuration)) } - @Override - public NotAnyTypeJsonSchema1BoxedString validateAndBox(String arg, SchemaConfiguration configuration) throws ValidationException { - return new NotAnyTypeJsonSchema1BoxedString(validate(arg, configuration)); + @Throws(ValidationException::class) + override fun validateAndBox( + arg: String, + configuration: SchemaConfiguration? + ): NotAnyTypeJsonSchema1BoxedString { + return NotAnyTypeJsonSchema1BoxedString(validate(arg, configuration)) } - @Override - public NotAnyTypeJsonSchema1BoxedList validateAndBox(List arg, SchemaConfiguration configuration) throws ValidationException { - return new NotAnyTypeJsonSchema1BoxedList(validate(arg, configuration)); + @Throws(ValidationException::class) + override fun validateAndBox( + arg: List<*>, + configuration: SchemaConfiguration? + ): NotAnyTypeJsonSchema1BoxedList { + return NotAnyTypeJsonSchema1BoxedList(validate(arg, configuration)) } - @Override - public NotAnyTypeJsonSchema1BoxedMap validateAndBox(Map arg, SchemaConfiguration configuration) throws ValidationException { - return new NotAnyTypeJsonSchema1BoxedMap(validate(arg, configuration)); + @Throws(ValidationException::class) + override fun validateAndBox( + arg: Map<*, *>, + configuration: SchemaConfiguration? + ): NotAnyTypeJsonSchema1BoxedMap { + return NotAnyTypeJsonSchema1BoxedMap(validate(arg, configuration)) } - @Override - public NotAnyTypeJsonSchema1Boxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { - if (arg == null) { - Nothing? castArg = (Nothing?) arg; - return validateAndBox(castArg, configuration); - } else if (arg instanceof Boolean booleanArg) { - boolean castArg = booleanArg; - return validateAndBox(castArg, configuration); - } else if (arg instanceof String castArg) { - return validateAndBox(castArg, configuration); - } else if (arg instanceof Number castArg) { - return validateAndBox(castArg, configuration); - } else if (arg instanceof List castArg) { - return validateAndBox(castArg, configuration); - } else if (arg instanceof Map castArg) { - return validateAndBox(castArg, configuration); + @Throws(ValidationException::class) + override fun validateAndBox(arg: Any?, configuration: SchemaConfiguration?): NotAnyTypeJsonSchema1Boxed { + when (arg) { + null -> { + return validateAndBox(null, configuration) + } + is Boolean -> { + val castArg: Boolean = arg + return validateAndBox(castArg, configuration) + } + + is String -> { + return validateAndBox(arg, configuration) + } + + is Number -> { + return validateAndBox(arg, configuration) + } + + is List<*> -> { + return validateAndBox(arg, configuration) + } + + is Map<*, *> -> { + return validateAndBox(arg, configuration) + } + + else -> throw ValidationException("Invalid input type=$javaClass. It can't be validated by this schema") } - throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + } + + companion object { + var instance: NotAnyTypeJsonSchema1? = null + get() { + if (field == null) { + field = NotAnyTypeJsonSchema1() + } + return field + } + private set } } } \ No newline at end of file From 4efe3641f7d14b12c2f11beae27d8a8fbc618fb6 Mon Sep 17 00:00:00 2001 From: Justin Black Date: Wed, 8 May 2024 17:38:18 -0700 Subject: [PATCH 42/78] Updates BooleanJsonSchema --- .../client/schemas/BooleanJsonSchema.kt | 122 ++++++++---------- .../packagename/schemas/BooleanJsonSchema.hbs | 104 +++++++-------- 2 files changed, 103 insertions(+), 123 deletions(-) diff --git a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/schemas/BooleanJsonSchema.kt b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/schemas/BooleanJsonSchema.kt index 86598ab393d..6c8287571ac 100644 --- a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/schemas/BooleanJsonSchema.kt +++ b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/schemas/BooleanJsonSchema.kt @@ -1,88 +1,78 @@ -package org.openapijsonschematools.client.schemas; +package org.openapijsonschematools.client.schemas -import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags; -import org.openapijsonschematools.client.configurations.SchemaConfiguration; -import org.openapijsonschematools.client.exceptions.ValidationException; -import org.openapijsonschematools.client.schemas.validation.JsonSchema; -import org.openapijsonschematools.client.schemas.validation.JsonSchemaInfo; -import org.openapijsonschematools.client.schemas.validation.PathToSchemasMap; -import org.openapijsonschematools.client.schemas.validation.BooleanSchemaValidator; -import org.openapijsonschematools.client.schemas.validation.ValidationMetadata; -import org.checkerframework.checker.nullness.qual.Nullable; +import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags +import org.openapijsonschematools.client.configurations.SchemaConfiguration +import org.openapijsonschematools.client.exceptions.ValidationException +import org.openapijsonschematools.client.schemas.validation.BooleanSchemaValidator +import org.openapijsonschematools.client.schemas.validation.JsonSchema +import org.openapijsonschematools.client.schemas.validation.JsonSchemaInfo +import org.openapijsonschematools.client.schemas.validation.PathToSchemasMap +import org.openapijsonschematools.client.schemas.validation.ValidationMetadata -import java.util.HashSet; -import java.util.LinkedHashSet; -import java.util.List; -import java.util.Objects; -import java.util.Set; - -public class BooleanJsonSchema { - public sealed interface BooleanJsonSchema1Boxed permits BooleanJsonSchema1BoxedBoolean { - @Nullable Object getData(); +class BooleanJsonSchema { + sealed interface BooleanJsonSchema1Boxed { + fun getData(): Any? } - public record BooleanJsonSchema1BoxedBoolean(boolean data) implements BooleanJsonSchema1Boxed { - @Override - public @Nullable Object getData() { - return data; + + data class BooleanJsonSchema1BoxedBoolean(val data: Boolean) : BooleanJsonSchema1Boxed { + override fun getData(): Boolean { + return data } } - public static class BooleanJsonSchema1 extends JsonSchema implements BooleanSchemaValidator { - private static @Nullable BooleanJsonSchema1 instance = null; - protected BooleanJsonSchema1() { - super(new JsonSchemaInfo() - .type(Set.of(Boolean.class)) - ); + class BooleanJsonSchema1 private constructor() : JsonSchema( + JsonSchemaInfo() + .type(setOf(Boolean::class.java)) + ), BooleanSchemaValidator { + @Throws(ValidationException::class) + override fun validate(arg: Boolean, configuration: SchemaConfiguration?): Boolean { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg: Boolean = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validationMetadata = + ValidationMetadata(pathToItem, usedConfiguration, PathToSchemasMap(), LinkedHashSet()) + val pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet) + return getNewInstance(castArg, validationMetadata.pathToItem, pathToSchemasMap) } - public static BooleanJsonSchema1 getInstance() { - if (instance == null) { - instance = new BooleanJsonSchema1(); + override fun getNewInstance(arg: Any?, pathToItem: List, pathToSchemas: PathToSchemasMap): Boolean { + if (arg is Boolean) { + return getNewInstance(arg, pathToItem, pathToSchemas) } - return instance; + throw RuntimeException("Invalid input type=$javaClass. It can't be instantiated by this schema") } - @Override - public boolean validate(boolean arg, SchemaConfiguration configuration) throws ValidationException { - Set> pathSet = new HashSet<>(); - List pathToItem = List.of("args[0"); - boolean castArg = castToAllowedTypes(arg, pathToItem, pathSet); - SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().build())); - ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, new PathToSchemasMap(), new LinkedHashSet<>()); - PathToSchemasMap pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet); - return getNewInstance(castArg, validationMetadata.pathToItem(), pathToSchemasMap); + @Throws(ValidationException::class) + override fun validate(arg: Any?, configuration: SchemaConfiguration?): Boolean { + if (arg is Boolean) { + return validate(arg, configuration) + } + throw ValidationException("Invalid input type=$javaClass. It can't be validated by this schema") } - @Override - 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 RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); + @Throws(ValidationException::class) + override fun validateAndBox(arg: Boolean, configuration: SchemaConfiguration?): BooleanJsonSchema1BoxedBoolean { + return BooleanJsonSchema1BoxedBoolean(validate(arg, configuration)) } - @Override - public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { - if (arg instanceof Boolean) { - boolean boolArg = (Boolean) arg; - return validate(boolArg, configuration); + @Throws(ValidationException::class) + override fun validateAndBox(arg: Any?, configuration: SchemaConfiguration?): BooleanJsonSchema1Boxed { + if (arg is Boolean) { + val castArg: Boolean = arg + return validateAndBox(castArg, configuration) } - throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw ValidationException("Invalid input type=$javaClass. It can't be validated by this schema") } - @Override - public BooleanJsonSchema1BoxedBoolean validateAndBox(boolean arg, SchemaConfiguration configuration) throws ValidationException { - return new BooleanJsonSchema1BoxedBoolean(validate(arg, configuration)); - } + companion object { + @Volatile + private var instance: BooleanJsonSchema1? = null - @Override - public BooleanJsonSchema1Boxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { - 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"); + fun getInstance() = + instance ?: synchronized(this) { + instance ?: BooleanJsonSchema1().also { instance = it } + } } } } \ No newline at end of file diff --git a/src/main/resources/kotlin/src/main/kotlin/packagename/schemas/BooleanJsonSchema.hbs b/src/main/resources/kotlin/src/main/kotlin/packagename/schemas/BooleanJsonSchema.hbs index 03aa21b39c6..c6ea7bfadba 100644 --- a/src/main/resources/kotlin/src/main/kotlin/packagename/schemas/BooleanJsonSchema.hbs +++ b/src/main/resources/kotlin/src/main/kotlin/packagename/schemas/BooleanJsonSchema.hbs @@ -8,81 +8,71 @@ import {{{packageName}}}.schemas.validation.JsonSchemaInfo; import {{{packageName}}}.schemas.validation.PathToSchemasMap; import {{{packageName}}}.schemas.validation.BooleanSchemaValidator; import {{{packageName}}}.schemas.validation.ValidationMetadata; -import org.checkerframework.checker.nullness.qual.Nullable; -import java.util.HashSet; -import java.util.LinkedHashSet; -import java.util.List; -import java.util.Objects; -import java.util.Set; - -public class BooleanJsonSchema { - public sealed interface BooleanJsonSchema1Boxed permits BooleanJsonSchema1BoxedBoolean { - @Nullable Object getData(); +class BooleanJsonSchema { + sealed interface BooleanJsonSchema1Boxed { + fun getData(): Any? } - public record BooleanJsonSchema1BoxedBoolean(boolean data) implements BooleanJsonSchema1Boxed { - @Override - public @Nullable Object getData() { - return data; + + data class BooleanJsonSchema1BoxedBoolean(val data: Boolean) : BooleanJsonSchema1Boxed { + override fun getData(): Boolean { + return data } } - public static class BooleanJsonSchema1 extends JsonSchema implements BooleanSchemaValidator { - private static @Nullable BooleanJsonSchema1 instance = null; - protected BooleanJsonSchema1() { - super(new JsonSchemaInfo() - .type(Set.of(Boolean.class)) - ); + class BooleanJsonSchema1 private constructor() : JsonSchema( + JsonSchemaInfo() + .type(setOf(Boolean::class.java)) + ), BooleanSchemaValidator { + @Throws(ValidationException::class) + override fun validate(arg: Boolean, configuration: SchemaConfiguration?): Boolean { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg: Boolean = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validationMetadata = + ValidationMetadata(pathToItem, usedConfiguration, PathToSchemasMap(), LinkedHashSet()) + val pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet) + return getNewInstance(castArg, validationMetadata.pathToItem, pathToSchemasMap) } - public static BooleanJsonSchema1 getInstance() { - if (instance == null) { - instance = new BooleanJsonSchema1(); + override fun getNewInstance(arg: Any?, pathToItem: List, pathToSchemas: PathToSchemasMap): Boolean { + if (arg is Boolean) { + return getNewInstance(arg, pathToItem, pathToSchemas) } - return instance; + throw RuntimeException("Invalid input type=$javaClass. It can't be instantiated by this schema") } - @Override - public boolean validate(boolean arg, SchemaConfiguration configuration) throws ValidationException { - Set> pathSet = new HashSet<>(); - List pathToItem = List.of("args[0"); - boolean castArg = castToAllowedTypes(arg, pathToItem, pathSet); - SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().build())); - ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, new PathToSchemasMap(), new LinkedHashSet<>()); - PathToSchemasMap pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet); - return getNewInstance(castArg, validationMetadata.pathToItem(), pathToSchemasMap); + @Throws(ValidationException::class) + override fun validate(arg: Any?, configuration: SchemaConfiguration?): Boolean { + if (arg is Boolean) { + return validate(arg, configuration) + } + throw ValidationException("Invalid input type=$javaClass. It can't be validated by this schema") } - @Override - 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 RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); + @Throws(ValidationException::class) + override fun validateAndBox(arg: Boolean, configuration: SchemaConfiguration?): BooleanJsonSchema1BoxedBoolean { + return BooleanJsonSchema1BoxedBoolean(validate(arg, configuration)) } - @Override - public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { - if (arg instanceof Boolean) { - boolean boolArg = (Boolean) arg; - return validate(boolArg, configuration); + @Throws(ValidationException::class) + override fun validateAndBox(arg: Any?, configuration: SchemaConfiguration?): BooleanJsonSchema1Boxed { + if (arg is Boolean) { + val castArg: Boolean = arg + return validateAndBox(castArg, configuration) } - throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw ValidationException("Invalid input type=$javaClass. It can't be validated by this schema") } - @Override - public BooleanJsonSchema1BoxedBoolean validateAndBox(boolean arg, SchemaConfiguration configuration) throws ValidationException { - return new BooleanJsonSchema1BoxedBoolean(validate(arg, configuration)); - } + companion object { + @Volatile + private var instance: BooleanJsonSchema1? = null - @Override - public BooleanJsonSchema1Boxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { - 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"); + fun getInstance() = + instance ?: synchronized(this) { + instance ?: BooleanJsonSchema1().also { instance = it } + } } } } \ No newline at end of file From 798b77a1b142b822a442e367ac7a4f64c6a477e4 Mon Sep 17 00:00:00 2001 From: Justin Black Date: Wed, 8 May 2024 17:46:06 -0700 Subject: [PATCH 43/78] Adds NullJsonSchema --- .../client/schemas/BooleanJsonSchema.kt | 4 +- .../client/schemas/NullJsonSchema.kt | 118 ++++++++---------- .../packagename/schemas/BooleanJsonSchema.hbs | 4 +- .../packagename/schemas/NullJsonSchema.hbs | 100 +++++++-------- 4 files changed, 103 insertions(+), 123 deletions(-) diff --git a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/schemas/BooleanJsonSchema.kt b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/schemas/BooleanJsonSchema.kt index 6c8287571ac..dfc7dbd0de2 100644 --- a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/schemas/BooleanJsonSchema.kt +++ b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/schemas/BooleanJsonSchema.kt @@ -20,10 +20,10 @@ class BooleanJsonSchema { } } - class BooleanJsonSchema1 private constructor() : JsonSchema( + class BooleanJsonSchema1 private constructor() : JsonSchema( JsonSchemaInfo() .type(setOf(Boolean::class.java)) - ), BooleanSchemaValidator { + ), BooleanSchemaValidator { @Throws(ValidationException::class) override fun validate(arg: Boolean, configuration: SchemaConfiguration?): Boolean { val pathSet: MutableSet> = HashSet() diff --git a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/schemas/NullJsonSchema.kt b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/schemas/NullJsonSchema.kt index 4cc01b26bad..39cb7099ca7 100644 --- a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/schemas/NullJsonSchema.kt +++ b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/schemas/NullJsonSchema.kt @@ -1,87 +1,77 @@ -package org.openapijsonschematools.client.schemas; +package org.openapijsonschematools.client.schemas -import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags; -import org.openapijsonschematools.client.configurations.SchemaConfiguration; -import org.openapijsonschematools.client.exceptions.ValidationException; -import org.openapijsonschematools.client.schemas.validation.JsonSchema; -import org.openapijsonschematools.client.schemas.validation.JsonSchemaInfo; -import org.openapijsonschematools.client.schemas.validation.PathToSchemasMap; -import org.openapijsonschematools.client.schemas.validation.NullSchemaValidator; -import org.openapijsonschematools.client.schemas.validation.ValidationMetadata; -import org.checkerframework.checker.nullness.qual.Nullable; +import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags +import org.openapijsonschematools.client.configurations.SchemaConfiguration +import org.openapijsonschematools.client.exceptions.ValidationException +import org.openapijsonschematools.client.schemas.validation.JsonSchema +import org.openapijsonschematools.client.schemas.validation.JsonSchemaInfo +import org.openapijsonschematools.client.schemas.validation.NullSchemaValidator +import org.openapijsonschematools.client.schemas.validation.PathToSchemasMap +import org.openapijsonschematools.client.schemas.validation.ValidationMetadata -import java.util.HashSet; -import java.util.LinkedHashSet; -import java.util.List; -import java.util.Objects; -import java.util.Set; - -public class NullJsonSchema { - public sealed interface NullJsonSchema1Boxed permits NullJsonSchema1BoxedVoid { - @Nullable Object getData(); - } - public record NullJsonSchema1BoxedVoid(Nothing? data) implements NullJsonSchema1Boxed { - @Override - public @Nullable Object getData() { - return data; - } +class NullJsonSchema { + sealed interface NullJsonSchema1Boxed { + fun getData(): Any? } - public static class NullJsonSchema1 extends JsonSchema implements NullSchemaValidator { - private static @Nullable NullJsonSchema1 instance = null; - - protected NullJsonSchema1() { - super(new JsonSchemaInfo() - .type(Set.of(Nothing?.class)) - ); - } - - public static NullJsonSchema1 getInstance() { - if (instance == null) { - instance = new NullJsonSchema1(); - } - return instance; + data class NullJsonSchema1BoxedVoid(val data: Nothing?) : NullJsonSchema1Boxed { + override fun getData(): Any? { + return data } + } - @Override - public Nothing? validate(Nothing? arg, SchemaConfiguration configuration) throws ValidationException { - Set> pathSet = new HashSet<>(); - List pathToItem = List.of("args[0"); - Nothing? castArg = castToAllowedTypes(arg, pathToItem, pathSet); - SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().build())); - ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, new PathToSchemasMap(), new LinkedHashSet<>()); - PathToSchemasMap pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet); - return getNewInstance(castArg, validationMetadata.pathToItem(), pathToSchemasMap); + class NullJsonSchema1 private constructor() : JsonSchema( + JsonSchemaInfo() + .type(setOf(Void::class.java)) + ), NullSchemaValidator { + @Throws(ValidationException::class) + override fun validate(arg: Nothing?, configuration: SchemaConfiguration?): Nothing? { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg: Nothing? = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validationMetadata = + ValidationMetadata(pathToItem, usedConfiguration, PathToSchemasMap(), LinkedHashSet()) + val pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet) + return getNewInstance(castArg, validationMetadata.pathToItem, pathToSchemasMap) } - @Override - public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { + override fun getNewInstance(arg: Any?, pathToItem: List, pathToSchemas: PathToSchemasMap): Any? { if (arg == null) { - return getNewInstance((Nothing?) null, pathToItem, pathToSchemas); + return getNewInstance(null, pathToItem, pathToSchemas) } - throw new RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); + throw RuntimeException("Invalid input type=$javaClass. It can't be instantiated by this schema") } - @Override - public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { + @Throws(ValidationException::class) + override fun validate(arg: Any?, configuration: SchemaConfiguration?): Any? { if (arg == null) { - return validate((Nothing?) null, configuration); + return validate(null, configuration) } - throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw ValidationException("Invalid input type=$javaClass. It can't be validated by this schema") } - @Override - public NullJsonSchema1BoxedVoid validateAndBox(Nothing? arg, SchemaConfiguration configuration) throws ValidationException { - return new NullJsonSchema1BoxedVoid(validate(arg, configuration)); + @Throws(ValidationException::class) + override fun validateAndBox(arg: Nothing?, configuration: SchemaConfiguration?): NullJsonSchema1BoxedVoid { + return NullJsonSchema1BoxedVoid(validate(arg, configuration)) } - @Override - public NullJsonSchema1Boxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { + @Throws(ValidationException::class) + override fun validateAndBox(arg: Any?, configuration: SchemaConfiguration?): NullJsonSchema1Boxed { if (arg == null) { - Nothing? castArg = (Nothing?) arg; - return validateAndBox(castArg, configuration); + return validateAndBox(null, configuration) } - throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw ValidationException("Invalid input type=$javaClass. It can't be validated by this schema") + } + + companion object { + @Volatile + private var instance: NullJsonSchema1? = null + + fun getInstance() = + instance ?: synchronized(this) { + instance ?: NullJsonSchema1().also { instance = it } + } } } } diff --git a/src/main/resources/kotlin/src/main/kotlin/packagename/schemas/BooleanJsonSchema.hbs b/src/main/resources/kotlin/src/main/kotlin/packagename/schemas/BooleanJsonSchema.hbs index c6ea7bfadba..7341bffdec1 100644 --- a/src/main/resources/kotlin/src/main/kotlin/packagename/schemas/BooleanJsonSchema.hbs +++ b/src/main/resources/kotlin/src/main/kotlin/packagename/schemas/BooleanJsonSchema.hbs @@ -20,10 +20,10 @@ class BooleanJsonSchema { } } - class BooleanJsonSchema1 private constructor() : JsonSchema( + class BooleanJsonSchema1 private constructor() : JsonSchema( JsonSchemaInfo() .type(setOf(Boolean::class.java)) - ), BooleanSchemaValidator { + ), BooleanSchemaValidator { @Throws(ValidationException::class) override fun validate(arg: Boolean, configuration: SchemaConfiguration?): Boolean { val pathSet: MutableSet> = HashSet() diff --git a/src/main/resources/kotlin/src/main/kotlin/packagename/schemas/NullJsonSchema.hbs b/src/main/resources/kotlin/src/main/kotlin/packagename/schemas/NullJsonSchema.hbs index 8cc09c8e104..c7d5577fa85 100644 --- a/src/main/resources/kotlin/src/main/kotlin/packagename/schemas/NullJsonSchema.hbs +++ b/src/main/resources/kotlin/src/main/kotlin/packagename/schemas/NullJsonSchema.hbs @@ -8,80 +8,70 @@ import {{{packageName}}}.schemas.validation.JsonSchemaInfo; import {{{packageName}}}.schemas.validation.PathToSchemasMap; import {{{packageName}}}.schemas.validation.NullSchemaValidator; import {{{packageName}}}.schemas.validation.ValidationMetadata; -import org.checkerframework.checker.nullness.qual.Nullable; -import java.util.HashSet; -import java.util.LinkedHashSet; -import java.util.List; -import java.util.Objects; -import java.util.Set; - -public class NullJsonSchema { - public sealed interface NullJsonSchema1Boxed permits NullJsonSchema1BoxedVoid { - @Nullable Object getData(); - } - public record NullJsonSchema1BoxedVoid(Nothing? data) implements NullJsonSchema1Boxed { - @Override - public @Nullable Object getData() { - return data; - } +class NullJsonSchema { + sealed interface NullJsonSchema1Boxed { + fun getData(): Any? } - public static class NullJsonSchema1 extends JsonSchema implements NullSchemaValidator { - private static @Nullable NullJsonSchema1 instance = null; - - protected NullJsonSchema1() { - super(new JsonSchemaInfo() - .type(Set.of(Nothing?.class)) - ); - } - - public static NullJsonSchema1 getInstance() { - if (instance == null) { - instance = new NullJsonSchema1(); - } - return instance; + data class NullJsonSchema1BoxedVoid(val data: Nothing?) : NullJsonSchema1Boxed { + override fun getData(): Any? { + return data } + } - @Override - public Nothing? validate(Nothing? arg, SchemaConfiguration configuration) throws ValidationException { - Set> pathSet = new HashSet<>(); - List pathToItem = List.of("args[0"); - Nothing? castArg = castToAllowedTypes(arg, pathToItem, pathSet); - SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().build())); - ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, new PathToSchemasMap(), new LinkedHashSet<>()); - PathToSchemasMap pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet); - return getNewInstance(castArg, validationMetadata.pathToItem(), pathToSchemasMap); + class NullJsonSchema1 private constructor() : JsonSchema( + JsonSchemaInfo() + .type(setOf(Void::class.java)) + ), NullSchemaValidator { + @Throws(ValidationException::class) + override fun validate(arg: Nothing?, configuration: SchemaConfiguration?): Nothing? { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg: Nothing? = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validationMetadata = + ValidationMetadata(pathToItem, usedConfiguration, PathToSchemasMap(), LinkedHashSet()) + val pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet) + return getNewInstance(castArg, validationMetadata.pathToItem, pathToSchemasMap) } - @Override - public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { + override fun getNewInstance(arg: Any?, pathToItem: List, pathToSchemas: PathToSchemasMap): Any? { if (arg == null) { - return getNewInstance((Nothing?) null, pathToItem, pathToSchemas); + return getNewInstance(null, pathToItem, pathToSchemas) } - throw new RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); + throw RuntimeException("Invalid input type=$javaClass. It can't be instantiated by this schema") } - @Override - public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { + @Throws(ValidationException::class) + override fun validate(arg: Any?, configuration: SchemaConfiguration?): Any? { if (arg == null) { - return validate((Nothing?) null, configuration); + return validate(null, configuration) } - throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw ValidationException("Invalid input type=$javaClass. It can't be validated by this schema") } - @Override - public NullJsonSchema1BoxedVoid validateAndBox(Nothing? arg, SchemaConfiguration configuration) throws ValidationException { - return new NullJsonSchema1BoxedVoid(validate(arg, configuration)); + @Throws(ValidationException::class) + override fun validateAndBox(arg: Nothing?, configuration: SchemaConfiguration?): NullJsonSchema1BoxedVoid { + return NullJsonSchema1BoxedVoid(validate(arg, configuration)) } - @Override - public NullJsonSchema1Boxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { + @Throws(ValidationException::class) + override fun validateAndBox(arg: Any?, configuration: SchemaConfiguration?): NullJsonSchema1Boxed { if (arg == null) { - Nothing? castArg = (Nothing?) arg; - return validateAndBox(castArg, configuration); + return validateAndBox(null, configuration) } - throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw ValidationException("Invalid input type=$javaClass. It can't be validated by this schema") + } + + companion object { + @Volatile + private var instance: NullJsonSchema1? = null + + fun getInstance() = + instance ?: synchronized(this) { + instance ?: NullJsonSchema1().also { instance = it } + } } } } From 036ecc9b18449241275fd8b468c8020b8d54046c Mon Sep 17 00:00:00 2001 From: Justin Black Date: Wed, 8 May 2024 17:50:58 -0700 Subject: [PATCH 44/78] Updates StringJsonSchema --- .../client/schemas/StringJsonSchema.kt | 168 +++++++++--------- .../packagename/schemas/StringJsonSchema.hbs | 149 ++++++++-------- 2 files changed, 163 insertions(+), 154 deletions(-) diff --git a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/schemas/StringJsonSchema.kt b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/schemas/StringJsonSchema.kt index 92570628dd0..60ff4558af6 100644 --- a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/schemas/StringJsonSchema.kt +++ b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/schemas/StringJsonSchema.kt @@ -1,106 +1,110 @@ -package org.openapijsonschematools.client.schemas; - -import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags; -import org.openapijsonschematools.client.configurations.SchemaConfiguration; -import org.openapijsonschematools.client.exceptions.ValidationException; -import org.openapijsonschematools.client.schemas.validation.JsonSchema; -import org.openapijsonschematools.client.schemas.validation.JsonSchemaInfo; -import org.openapijsonschematools.client.schemas.validation.PathToSchemasMap; -import org.openapijsonschematools.client.schemas.validation.StringSchemaValidator; -import org.openapijsonschematools.client.schemas.validation.ValidationMetadata; -import org.checkerframework.checker.nullness.qual.Nullable; - -import java.time.LocalDate; -import java.time.ZonedDateTime; -import java.util.HashSet; -import java.util.LinkedHashSet; -import java.util.List; -import java.util.Objects; -import java.util.Set; -import java.util.UUID; - -public class StringJsonSchema { - public sealed interface StringJsonSchema1Boxed permits StringJsonSchema1BoxedString { - @Nullable Object getData(); +package org.openapijsonschematools.client.schemas + +import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags +import org.openapijsonschematools.client.configurations.SchemaConfiguration +import org.openapijsonschematools.client.exceptions.ValidationException +import org.openapijsonschematools.client.schemas.validation.JsonSchema +import org.openapijsonschematools.client.schemas.validation.JsonSchemaInfo +import org.openapijsonschematools.client.schemas.validation.PathToSchemasMap +import org.openapijsonschematools.client.schemas.validation.StringSchemaValidator +import org.openapijsonschematools.client.schemas.validation.ValidationMetadata +import java.time.LocalDate +import java.time.ZonedDateTime +import java.util.UUID + +class StringJsonSchema { + interface StringJsonSchema1Boxed { + fun getData(): Any? } - public record StringJsonSchema1BoxedString(String data) implements StringJsonSchema1Boxed { - @Override - public @Nullable Object getData() { - return data; + + data class StringJsonSchema1BoxedString(val data: String) : StringJsonSchema1Boxed { + override fun getData(): String { + return data } } - public static class StringJsonSchema1 extends JsonSchema implements StringSchemaValidator { - private static @Nullable StringJsonSchema1 instance = null; - protected StringJsonSchema1() { - super(new JsonSchemaInfo() - .type(Set.of(String.class)) - ); + class StringJsonSchema1 private constructor() : JsonSchema( + JsonSchemaInfo() + .type(setOf(String::class.java)) + ), StringSchemaValidator { + @Throws(ValidationException::class) + override fun validate(arg: String, configuration: SchemaConfiguration?): String { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg: String = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validationMetadata = + ValidationMetadata(pathToItem, usedConfiguration, PathToSchemasMap(), LinkedHashSet()) + val pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet) + return getNewInstance(castArg, validationMetadata.pathToItem, pathToSchemasMap) } - public static StringJsonSchema1 getInstance() { - if (instance == null) { - instance = new StringJsonSchema1(); - } - return instance; + @Throws(ValidationException::class) + fun validate(arg: LocalDate, configuration: SchemaConfiguration?): String { + return validate(arg.toString(), configuration) } - @Override - public String validate(String arg, SchemaConfiguration configuration) throws ValidationException { - Set> pathSet = new HashSet<>(); - List pathToItem = List.of("args[0"); - String castArg = castToAllowedTypes(arg, pathToItem, pathSet); - SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().build())); - ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, new PathToSchemasMap(), new LinkedHashSet<>()); - PathToSchemasMap pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet); - return getNewInstance(castArg, validationMetadata.pathToItem(), pathToSchemasMap); + @Throws(ValidationException::class) + fun validate(arg: ZonedDateTime, configuration: SchemaConfiguration?): String { + return validate(arg.toString(), configuration) } - public String validate(LocalDate arg, SchemaConfiguration configuration) throws ValidationException { - return validate(arg.toString(), configuration); + @Throws(ValidationException::class) + fun validate(arg: UUID, configuration: SchemaConfiguration?): String { + return validate(arg.toString(), configuration) } - public String validate(ZonedDateTime arg, SchemaConfiguration configuration) throws ValidationException { - return validate(arg.toString(), configuration); + override fun getNewInstance(arg: Any?, pathToItem: List, pathToSchemas: PathToSchemasMap): Any? { + if (arg is String) { + return getNewInstance(arg as String?, pathToItem, pathToSchemas) + } + throw RuntimeException("Invalid input type=$javaClass. It can't be instantiated by this schema") } - public String validate(UUID arg, SchemaConfiguration configuration) throws ValidationException { - return validate(arg.toString(), configuration); - } + @Throws(ValidationException::class) + override fun validate(arg: Any?, configuration: SchemaConfiguration?): String { + when (arg) { + is UUID -> { + return validate(arg, configuration) + } - @Override - public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { - 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"); - } + is LocalDate -> { + return validate(arg, configuration) + } + + is ZonedDateTime -> { + return validate(arg, configuration) + } + + is String -> { + return validate(arg, configuration) + } - @Override - 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) { - return validate((LocalDate) arg, configuration); - } else if (arg instanceof ZonedDateTime) { - return validate((ZonedDateTime) arg, configuration); - } else if (arg instanceof String) { - return validate((String) arg, configuration); + else -> throw ValidationException("Invalid input type=$javaClass. It can'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 { - return new StringJsonSchema1BoxedString(validate(arg, configuration)); + @Throws(ValidationException::class) + override fun validateAndBox(arg: String, configuration: SchemaConfiguration?): StringJsonSchema1BoxedString { + return StringJsonSchema1BoxedString(validate(arg, configuration)) } - @Override - public StringJsonSchema1Boxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { - if (arg instanceof String castArg) { - return validateAndBox(castArg, configuration); + @Throws(ValidationException::class) + override fun validateAndBox(arg: Any?, configuration: SchemaConfiguration?): StringJsonSchema1Boxed { + if (arg is String) { + return validateAndBox(arg, configuration) } - throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw ValidationException("Invalid input type=$javaClass. It can't be validated by this schema") + } + + companion object { + @Volatile + private var instance: StringJsonSchema1? = null + + fun getInstance() = + instance ?: synchronized(this) { + instance ?: StringJsonSchema1().also { instance = it } + } } } -} +} \ No newline at end of file diff --git a/src/main/resources/kotlin/src/main/kotlin/packagename/schemas/StringJsonSchema.hbs b/src/main/resources/kotlin/src/main/kotlin/packagename/schemas/StringJsonSchema.hbs index 56912a48a39..135f242e72b 100644 --- a/src/main/resources/kotlin/src/main/kotlin/packagename/schemas/StringJsonSchema.hbs +++ b/src/main/resources/kotlin/src/main/kotlin/packagename/schemas/StringJsonSchema.hbs @@ -8,99 +8,104 @@ import {{{packageName}}}.schemas.validation.JsonSchemaInfo; import {{{packageName}}}.schemas.validation.PathToSchemasMap; import {{{packageName}}}.schemas.validation.StringSchemaValidator; import {{{packageName}}}.schemas.validation.ValidationMetadata; -import org.checkerframework.checker.nullness.qual.Nullable; - -import java.time.LocalDate; -import java.time.ZonedDateTime; -import java.util.HashSet; -import java.util.LinkedHashSet; -import java.util.List; -import java.util.Objects; -import java.util.Set; -import java.util.UUID; - -public class StringJsonSchema { - public sealed interface StringJsonSchema1Boxed permits StringJsonSchema1BoxedString { - @Nullable Object getData(); + +import java.time.LocalDate +import java.time.ZonedDateTime +import java.util.UUID + +class StringJsonSchema { + interface StringJsonSchema1Boxed { + fun getData(): Any? } - public record StringJsonSchema1BoxedString(String data) implements StringJsonSchema1Boxed { - @Override - public @Nullable Object getData() { - return data; + + data class StringJsonSchema1BoxedString(val data: String) : StringJsonSchema1Boxed { + override fun getData(): String { + return data } } - public static class StringJsonSchema1 extends JsonSchema implements StringSchemaValidator { - private static @Nullable StringJsonSchema1 instance = null; - protected StringJsonSchema1() { - super(new JsonSchemaInfo() - .type(Set.of(String.class)) - ); + class StringJsonSchema1 private constructor() : JsonSchema( + JsonSchemaInfo() + .type(setOf(String::class.java)) + ), StringSchemaValidator { + @Throws(ValidationException::class) + override fun validate(arg: String, configuration: SchemaConfiguration?): String { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg: String = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validationMetadata = + ValidationMetadata(pathToItem, usedConfiguration, PathToSchemasMap(), LinkedHashSet()) + val pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet) + return getNewInstance(castArg, validationMetadata.pathToItem, pathToSchemasMap) } - public static StringJsonSchema1 getInstance() { - if (instance == null) { - instance = new StringJsonSchema1(); - } - return instance; + @Throws(ValidationException::class) + fun validate(arg: LocalDate, configuration: SchemaConfiguration?): String { + return validate(arg.toString(), configuration) } - @Override - public String validate(String arg, SchemaConfiguration configuration) throws ValidationException { - Set> pathSet = new HashSet<>(); - List pathToItem = List.of("args[0"); - String castArg = castToAllowedTypes(arg, pathToItem, pathSet); - SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().build())); - ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, new PathToSchemasMap(), new LinkedHashSet<>()); - PathToSchemasMap pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet); - return getNewInstance(castArg, validationMetadata.pathToItem(), pathToSchemasMap); + @Throws(ValidationException::class) + fun validate(arg: ZonedDateTime, configuration: SchemaConfiguration?): String { + return validate(arg.toString(), configuration) } - public String validate(LocalDate arg, SchemaConfiguration configuration) throws ValidationException { - return validate(arg.toString(), configuration); + @Throws(ValidationException::class) + fun validate(arg: UUID, configuration: SchemaConfiguration?): String { + return validate(arg.toString(), configuration) } - public String validate(ZonedDateTime arg, SchemaConfiguration configuration) throws ValidationException { - return validate(arg.toString(), configuration); + override fun getNewInstance(arg: Any?, pathToItem: List, pathToSchemas: PathToSchemasMap): Any? { + if (arg is String) { + return getNewInstance(arg as String?, pathToItem, pathToSchemas) + } + throw RuntimeException("Invalid input type=$javaClass. It can't be instantiated by this schema") } - public String validate(UUID arg, SchemaConfiguration configuration) throws ValidationException { - return validate(arg.toString(), configuration); - } + @Throws(ValidationException::class) + override fun validate(arg: Any?, configuration: SchemaConfiguration?): String { + when (arg) { + is UUID -> { + return validate(arg, configuration) + } - @Override - public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { - 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"); - } + is LocalDate -> { + return validate(arg, configuration) + } + + is ZonedDateTime -> { + return validate(arg, configuration) + } + + is String -> { + return validate(arg, configuration) + } - @Override - 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) { - return validate((LocalDate) arg, configuration); - } else if (arg instanceof ZonedDateTime) { - return validate((ZonedDateTime) arg, configuration); - } else if (arg instanceof String) { - return validate((String) arg, configuration); + else -> throw ValidationException("Invalid input type=$javaClass. It can'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 { - return new StringJsonSchema1BoxedString(validate(arg, configuration)); + @Throws(ValidationException::class) + override fun validateAndBox(arg: String, configuration: SchemaConfiguration?): StringJsonSchema1BoxedString { + return StringJsonSchema1BoxedString(validate(arg, configuration)) } - @Override - public StringJsonSchema1Boxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { - if (arg instanceof String castArg) { - return validateAndBox(castArg, configuration); + @Throws(ValidationException::class) + override fun validateAndBox(arg: Any?, configuration: SchemaConfiguration?): StringJsonSchema1Boxed { + if (arg is String) { + return validateAndBox(arg, configuration) } - throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw ValidationException("Invalid input type=$javaClass. It can't be validated by this schema") + } + + companion object { + @Volatile + private var instance: StringJsonSchema1? = null + + fun getInstance() = + instance ?: synchronized(this) { + instance ?: StringJsonSchema1().also { instance = it } + } } } -} +} \ No newline at end of file From 2c451ae78d0b699d8044a346b62c0bc831f95d23 Mon Sep 17 00:00:00 2001 From: Justin Black Date: Wed, 8 May 2024 18:01:43 -0700 Subject: [PATCH 45/78] Updates ListJsonSchema --- .../client/schemas/ListJsonSchema.kt | 158 ++++++++---------- .../packagename/schemas/ListJsonSchema.hbs | 140 +++++++--------- 2 files changed, 139 insertions(+), 159 deletions(-) diff --git a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/schemas/ListJsonSchema.kt b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/schemas/ListJsonSchema.kt index 801b1d1bc48..c84f7c3deb0 100644 --- a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/schemas/ListJsonSchema.kt +++ b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/schemas/ListJsonSchema.kt @@ -1,108 +1,98 @@ -package org.openapijsonschematools.client.schemas; +package org.openapijsonschematools.client.schemas -import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags; -import org.openapijsonschematools.client.exceptions.ValidationException; -import org.openapijsonschematools.client.schemas.validation.FrozenList; -import org.openapijsonschematools.client.schemas.validation.JsonSchema; -import org.openapijsonschematools.client.schemas.validation.JsonSchemaInfo; -import org.openapijsonschematools.client.configurations.SchemaConfiguration; -import org.openapijsonschematools.client.schemas.validation.PathToSchemasMap; -import org.openapijsonschematools.client.schemas.validation.ListSchemaValidator; -import org.openapijsonschematools.client.schemas.validation.ValidationMetadata; -import org.checkerframework.checker.nullness.qual.Nullable; +import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags +import org.openapijsonschematools.client.configurations.SchemaConfiguration +import org.openapijsonschematools.client.exceptions.ValidationException +import org.openapijsonschematools.client.schemas.validation.FrozenList +import org.openapijsonschematools.client.schemas.validation.JsonSchema +import org.openapijsonschematools.client.schemas.validation.JsonSchemaInfo +import org.openapijsonschematools.client.schemas.validation.ListSchemaValidator +import org.openapijsonschematools.client.schemas.validation.PathToSchemasMap +import org.openapijsonschematools.client.schemas.validation.ValidationMetadata -import java.util.ArrayList; -import java.util.HashSet; -import java.util.LinkedHashMap; -import java.util.LinkedHashSet; -import java.util.List; -import java.util.Objects; -import java.util.Set; - -public class ListJsonSchema { - public sealed interface ListJsonSchema1Boxed permits ListJsonSchema1BoxedList { - @Nullable Object getData(); +class ListJsonSchema { + sealed interface ListJsonSchema1Boxed { + fun getData(): Any? } - public record ListJsonSchema1BoxedList(FrozenList<@Nullable Object> data) implements ListJsonSchema1Boxed { - @Override - public @Nullable Object getData() { - return data; + + data class ListJsonSchema1BoxedList(val data: FrozenList) : ListJsonSchema1Boxed { + override fun getData(): FrozenList { + return data } } - public static class ListJsonSchema1 extends JsonSchema implements ListSchemaValidator, ListJsonSchema1BoxedList> { - private static @Nullable ListJsonSchema1 instance = null; - - protected ListJsonSchema1() { - super(new JsonSchemaInfo() - .type(Set.of(List.class)) - ); + class ListJsonSchema1 private constructor() : JsonSchema( + JsonSchemaInfo() + .type(setOf(List::class.java)) + ), ListSchemaValidator, ListJsonSchema1BoxedList> { + override fun getNewInstance( + arg: List<*>, + pathToItem: List, + pathToSchemas: PathToSchemasMap + ): FrozenList { + val items: MutableList = ArrayList() + var i = 0 + for (item in arg) { + val itemPathToItem: List = pathToItem + i + val schemas: LinkedHashMap, Nothing?> = pathToSchemas[itemPathToItem] + ?: throw RuntimeException("Validation result is invalid, schemas must exist for a pathToItem") + val itemSchema: JsonSchema<*> = schemas.entries.iterator().next().key + val castItem = itemSchema.getNewInstance(item, itemPathToItem, pathToSchemas) + items.add(castItem) + i += 1 + } + return FrozenList(items) } - public static ListJsonSchema1 getInstance() { - if (instance == null) { - instance = new ListJsonSchema1(); - } - return instance; + @Throws(ValidationException::class) + override fun validate(arg: List<*>, configuration: SchemaConfiguration?): FrozenList { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0]") + val castArg: List<*> = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validatedPathToSchemas = PathToSchemasMap() + val validationMetadata = + ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, LinkedHashSet()) + val pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet) + return getNewInstance(castArg, validationMetadata.pathToItem, pathToSchemasMap) } - @Override - public FrozenList<@Nullable Object> getNewInstance(List arg, List pathToItem, PathToSchemasMap pathToSchemas) { - List<@Nullable Object> items = new ArrayList<>(); - int i = 0; - for (Object item: arg) { - List itemPathToItem = new ArrayList<>(pathToItem); - itemPathToItem.add(i); - LinkedHashMap, Nothing?> schemas = pathToSchemas.get(itemPathToItem); - if (schemas == null) { - 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); - items.add(castItem); - i += 1; + override fun getNewInstance(arg: Any?, pathToItem: List, pathToSchemas: PathToSchemasMap): FrozenList { + if (arg is List<*>) { + return getNewInstance(arg, pathToItem, pathToSchemas) } - return new FrozenList<>(items); + throw RuntimeException("Invalid input type=$javaClass. It can't be instantiated by this schema") } - 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); - SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().build())); - PathToSchemasMap validatedPathToSchemas = new PathToSchemasMap(); - ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, new LinkedHashSet<>()); - PathToSchemasMap pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet); - return getNewInstance(castArg, validationMetadata.pathToItem(), pathToSchemasMap); + @Throws(ValidationException::class) + override fun validate(arg: Any?, configuration: SchemaConfiguration?): Any? { + if (arg is List<*>) { + return validate(arg as List<*>?, configuration) + } + throw ValidationException("Invalid input type=$javaClass. It can't be instantiated by this schema") } - @Override - public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { - 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"); + @Throws(ValidationException::class) + override fun validateAndBox(arg: List<*>, configuration: SchemaConfiguration?): ListJsonSchema1BoxedList { + return ListJsonSchema1BoxedList(validate(arg, configuration)) } - @Override - public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { - if (arg instanceof List) { - return validate((List) arg, configuration); + @Throws(ValidationException::class) + override fun validateAndBox(arg: Any?, configuration: SchemaConfiguration?): ListJsonSchema1Boxed { + if (arg is List<*>) { + return validateAndBox(arg, configuration) } - throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); + throw ValidationException("Invalid input type=$javaClass. It can't be validated by this schema") } - @Override - public ListJsonSchema1BoxedList validateAndBox(List arg, SchemaConfiguration configuration) throws ValidationException { - return new ListJsonSchema1BoxedList(validate(arg, configuration)); - } + companion object { + @Volatile + private var instance: ListJsonSchema1? = null - @Override - public ListJsonSchema1Boxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { - 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"); + fun getInstance() = + instance ?: synchronized(this) { + instance ?: ListJsonSchema1().also { instance = it } + } } } } diff --git a/src/main/resources/kotlin/src/main/kotlin/packagename/schemas/ListJsonSchema.hbs b/src/main/resources/kotlin/src/main/kotlin/packagename/schemas/ListJsonSchema.hbs index 57abd9e0e89..3d44684252d 100644 --- a/src/main/resources/kotlin/src/main/kotlin/packagename/schemas/ListJsonSchema.hbs +++ b/src/main/resources/kotlin/src/main/kotlin/packagename/schemas/ListJsonSchema.hbs @@ -9,100 +9,90 @@ import {{{packageName}}}.configurations.SchemaConfiguration; import {{{packageName}}}.schemas.validation.PathToSchemasMap; import {{{packageName}}}.schemas.validation.ListSchemaValidator; import {{{packageName}}}.schemas.validation.ValidationMetadata; -import org.checkerframework.checker.nullness.qual.Nullable; -import java.util.ArrayList; -import java.util.HashSet; -import java.util.LinkedHashMap; -import java.util.LinkedHashSet; -import java.util.List; -import java.util.Objects; -import java.util.Set; - -public class ListJsonSchema { - public sealed interface ListJsonSchema1Boxed permits ListJsonSchema1BoxedList { - @Nullable Object getData(); +class ListJsonSchema { + sealed interface ListJsonSchema1Boxed { + fun getData(): Any? } - public record ListJsonSchema1BoxedList(FrozenList<@Nullable Object> data) implements ListJsonSchema1Boxed { - @Override - public @Nullable Object getData() { - return data; + + data class ListJsonSchema1BoxedList(val data: FrozenList) : ListJsonSchema1Boxed { + override fun getData(): FrozenList { + return data } } - public static class ListJsonSchema1 extends JsonSchema implements ListSchemaValidator, ListJsonSchema1BoxedList> { - private static @Nullable ListJsonSchema1 instance = null; - - protected ListJsonSchema1() { - super(new JsonSchemaInfo() - .type(Set.of(List.class)) - ); + class ListJsonSchema1 private constructor() : JsonSchema( + JsonSchemaInfo() + .type(setOf(List::class.java)) + ), ListSchemaValidator, ListJsonSchema1BoxedList> { + override fun getNewInstance( + arg: List<*>, + pathToItem: List, + pathToSchemas: PathToSchemasMap + ): FrozenList { + val items: MutableList = ArrayList() + var i = 0 + for (item in arg) { + val itemPathToItem: List = pathToItem + i + val schemas: LinkedHashMap, Nothing?> = pathToSchemas[itemPathToItem] + ?: throw RuntimeException("Validation result is invalid, schemas must exist for a pathToItem") + val itemSchema: JsonSchema<*> = schemas.entries.iterator().next().key + val castItem = itemSchema.getNewInstance(item, itemPathToItem, pathToSchemas) + items.add(castItem) + i += 1 + } + return FrozenList(items) } - public static ListJsonSchema1 getInstance() { - if (instance == null) { - instance = new ListJsonSchema1(); - } - return instance; + @Throws(ValidationException::class) + override fun validate(arg: List<*>, configuration: SchemaConfiguration?): FrozenList { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0]") + val castArg: List<*> = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validatedPathToSchemas = PathToSchemasMap() + val validationMetadata = + ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, LinkedHashSet()) + val pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet) + return getNewInstance(castArg, validationMetadata.pathToItem, pathToSchemasMap) } - @Override - public FrozenList<@Nullable Object> getNewInstance(List arg, List pathToItem, PathToSchemasMap pathToSchemas) { - List<@Nullable Object> items = new ArrayList<>(); - int i = 0; - for (Object item: arg) { - List itemPathToItem = new ArrayList<>(pathToItem); - itemPathToItem.add(i); - LinkedHashMap, Nothing?> schemas = pathToSchemas.get(itemPathToItem); - if (schemas == null) { - 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); - items.add(castItem); - i += 1; + override fun getNewInstance(arg: Any?, pathToItem: List, pathToSchemas: PathToSchemasMap): FrozenList { + if (arg is List<*>) { + return getNewInstance(arg, pathToItem, pathToSchemas) } - return new FrozenList<>(items); + throw RuntimeException("Invalid input type=$javaClass. It can't be instantiated by this schema") } - 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); - SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().build())); - PathToSchemasMap validatedPathToSchemas = new PathToSchemasMap(); - ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, new LinkedHashSet<>()); - PathToSchemasMap pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet); - return getNewInstance(castArg, validationMetadata.pathToItem(), pathToSchemasMap); + @Throws(ValidationException::class) + override fun validate(arg: Any?, configuration: SchemaConfiguration?): Any? { + if (arg is List<*>) { + return validate(arg as List<*>?, configuration) + } + throw ValidationException("Invalid input type=$javaClass. It can't be instantiated by this schema") } - @Override - public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { - 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"); + @Throws(ValidationException::class) + override fun validateAndBox(arg: List<*>, configuration: SchemaConfiguration?): ListJsonSchema1BoxedList { + return ListJsonSchema1BoxedList(validate(arg, configuration)) } - @Override - public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { - if (arg instanceof List) { - return validate((List) arg, configuration); + @Throws(ValidationException::class) + override fun validateAndBox(arg: Any?, configuration: SchemaConfiguration?): ListJsonSchema1Boxed { + if (arg is List<*>) { + return validateAndBox(arg, configuration) } - throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); + throw ValidationException("Invalid input type=$javaClass. It can't be validated by this schema") } - @Override - public ListJsonSchema1BoxedList validateAndBox(List arg, SchemaConfiguration configuration) throws ValidationException { - return new ListJsonSchema1BoxedList(validate(arg, configuration)); - } + companion object { + @Volatile + private var instance: ListJsonSchema1? = null - @Override - public ListJsonSchema1Boxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { - 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"); + fun getInstance() = + instance ?: synchronized(this) { + instance ?: ListJsonSchema1().also { instance = it } + } } } -} +} \ No newline at end of file From ad7cd07911a502567d7df8d11f8f424e308dfaf9 Mon Sep 17 00:00:00 2001 From: Justin Black Date: Wed, 8 May 2024 18:09:04 -0700 Subject: [PATCH 46/78] Updates MapJsonSchema --- .../client/schemas/MapJsonSchema.kt | 162 ++++++++---------- .../packagename/schemas/MapJsonSchema.hbs | 144 +++++++--------- 2 files changed, 139 insertions(+), 167 deletions(-) diff --git a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/schemas/MapJsonSchema.kt b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/schemas/MapJsonSchema.kt index 2e9b35a11dd..3db88f6bf52 100644 --- a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/schemas/MapJsonSchema.kt +++ b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/schemas/MapJsonSchema.kt @@ -1,112 +1,98 @@ -package org.openapijsonschematools.client.schemas; +package org.openapijsonschematools.client.schemas -import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags; -import org.openapijsonschematools.client.exceptions.ValidationException; -import org.openapijsonschematools.client.schemas.validation.FrozenMap; -import org.openapijsonschematools.client.schemas.validation.JsonSchema; -import org.openapijsonschematools.client.schemas.validation.JsonSchemaInfo; -import org.openapijsonschematools.client.configurations.SchemaConfiguration; -import org.openapijsonschematools.client.schemas.validation.PathToSchemasMap; -import org.openapijsonschematools.client.schemas.validation.MapSchemaValidator; -import org.openapijsonschematools.client.schemas.validation.ValidationMetadata; -import org.checkerframework.checker.nullness.qual.Nullable; +import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags +import org.openapijsonschematools.client.configurations.SchemaConfiguration +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.schemas.validation.MapSchemaValidator +import org.openapijsonschematools.client.schemas.validation.PathToSchemasMap +import org.openapijsonschematools.client.schemas.validation.ValidationMetadata -import java.util.ArrayList; -import java.util.HashSet; -import java.util.LinkedHashMap; -import java.util.LinkedHashSet; -import java.util.List; -import java.util.Map; -import java.util.Objects; -import java.util.Set; - -public class MapJsonSchema { - public sealed interface MapJsonSchema1Boxed permits MapJsonSchema1BoxedMap { - @Nullable Object getData(); - } - public record MapJsonSchema1BoxedMap(FrozenMap<@Nullable Object> data) implements MapJsonSchema1Boxed { - @Override - public @Nullable Object getData() { - return data; - } +class MapJsonSchema { + sealed interface MapJsonSchema1Boxed { + fun getData(): Any? } - public static class MapJsonSchema1 extends JsonSchema implements MapSchemaValidator, MapJsonSchema1BoxedMap> { - private static @Nullable MapJsonSchema1 instance = null; - - protected MapJsonSchema1() { - super(new JsonSchemaInfo() - .type(Set.of(Map.class)) - ); - } - - public static MapJsonSchema1 getInstance() { - if (instance == null) { - instance = new MapJsonSchema1(); - } - return instance; + data class MapJsonSchema1BoxedMap(val data: FrozenMap) : MapJsonSchema1Boxed { + override fun getData(): FrozenMap { + return data } + } - @Override - 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 RuntimeException("Invalid non-string key value"); - } - String propertyName = (String) entryKey; - List propertyPathToItem = new ArrayList<>(pathToItem); - propertyPathToItem.add(propertyName); - Object value = entry.getValue(); - LinkedHashMap, Nothing?> schemas = pathToSchemas.get(propertyPathToItem); - if (schemas == null) { - throw new RuntimeException("Validation result is invalid, schemas must exist for a pathToItem"); + class MapJsonSchema1 private constructor() : JsonSchema( + JsonSchemaInfo() + .type(setOf(Map::class.java)) + ), MapSchemaValidator, MapJsonSchema1BoxedMap> { + override fun getNewInstance( + arg: Map<*, *>, + pathToItem: List, + pathToSchemas: PathToSchemasMap + ): FrozenMap { + val properties = LinkedHashMap() + for ((entryKey, value1) in arg) { + if (entryKey !is String) { + throw RuntimeException("Invalid non-string key value") } - JsonSchema propertySchema = schemas.entrySet().iterator().next().getKey(); - @Nullable Object castValue = propertySchema.getNewInstance(value, propertyPathToItem, pathToSchemas); - properties.put(propertyName, castValue); + val propertyPathToItem: List = pathToItem + entryKey + val schemas: LinkedHashMap, Nothing?> = pathToSchemas[propertyPathToItem] + ?: throw RuntimeException("Validation result is invalid, schemas must exist for a pathToItem") + val propertySchema: JsonSchema<*> = schemas.entries.iterator().next().key + val castValue = propertySchema.getNewInstance(value1, propertyPathToItem, pathToSchemas) + properties[entryKey] = castValue } - return new FrozenMap<>(properties); + return FrozenMap(properties) } - public FrozenMap<@Nullable Object> validate(Map arg, SchemaConfiguration configuration) throws ValidationException { - Set> pathSet = new HashSet<>(); - List pathToItem = List.of("args[0"); - Map castArg = castToAllowedTypes(arg, pathToItem, pathSet); - SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().build())); - ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, new PathToSchemasMap(), new LinkedHashSet<>()); - PathToSchemasMap pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet); - return getNewInstance(castArg, validationMetadata.pathToItem(), pathToSchemasMap); + @Throws(ValidationException::class) + override fun validate(arg: Map<*, *>, configuration: SchemaConfiguration?): FrozenMap { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg: Map<*, *> = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validationMetadata = + ValidationMetadata(pathToItem, usedConfiguration, PathToSchemasMap(), LinkedHashSet()) + val pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet) + return getNewInstance(castArg, validationMetadata.pathToItem, pathToSchemasMap) } - @Override - public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { - if (arg instanceof FrozenMap) { - return getNewInstance((Map) arg, pathToItem, pathToSchemas); + override fun getNewInstance(arg: Any?, pathToItem: List, pathToSchemas: PathToSchemasMap): FrozenMap { + if (arg is FrozenMap<*>) { + return getNewInstance(arg as Map<*, *>, pathToItem, pathToSchemas) } - throw new RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); + throw RuntimeException("Invalid input type=$javaClass. It can't be instantiated by this schema") } - @Override - public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { - if (arg instanceof Map) { - return validate((Map) arg, configuration); + @Throws(ValidationException::class) + override fun validate(arg: Any?, configuration: SchemaConfiguration?): Any? { + if (arg is Map<*, *>) { + return validate(arg as Map<*, *>?, configuration) } - throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw ValidationException("Invalid input type=$javaClass. It can't be validated by this schema") } - @Override - public MapJsonSchema1BoxedMap validateAndBox(Map arg, SchemaConfiguration configuration) throws ValidationException { - return new MapJsonSchema1BoxedMap(validate(arg, configuration)); + @Throws(ValidationException::class) + override fun validateAndBox(arg: Map<*, *>, configuration: SchemaConfiguration?): MapJsonSchema1BoxedMap { + return MapJsonSchema1BoxedMap(validate(arg, configuration)) } - @Override - public MapJsonSchema1Boxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { - if (arg instanceof Map castArg) { - return validateAndBox(castArg, configuration); + @Throws(ValidationException::class) + override fun validateAndBox(arg: Any?, configuration: SchemaConfiguration?): MapJsonSchema1Boxed { + if (arg is Map<*, *>) { + return validateAndBox(arg, configuration) } - throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw ValidationException("Invalid input type=$javaClass. It can't be validated by this schema") + } + + companion object { + @Volatile + private var instance: MapJsonSchema1? = null + + fun getInstance() = + instance ?: synchronized(this) { + instance ?: MapJsonSchema1().also { instance = it } + } } } } diff --git a/src/main/resources/kotlin/src/main/kotlin/packagename/schemas/MapJsonSchema.hbs b/src/main/resources/kotlin/src/main/kotlin/packagename/schemas/MapJsonSchema.hbs index 0a86355e4ac..8f5768998a2 100644 --- a/src/main/resources/kotlin/src/main/kotlin/packagename/schemas/MapJsonSchema.hbs +++ b/src/main/resources/kotlin/src/main/kotlin/packagename/schemas/MapJsonSchema.hbs @@ -9,104 +9,90 @@ import {{{packageName}}}.configurations.SchemaConfiguration; import {{{packageName}}}.schemas.validation.PathToSchemasMap; import {{{packageName}}}.schemas.validation.MapSchemaValidator; import {{{packageName}}}.schemas.validation.ValidationMetadata; -import org.checkerframework.checker.nullness.qual.Nullable; -import java.util.ArrayList; -import java.util.HashSet; -import java.util.LinkedHashMap; -import java.util.LinkedHashSet; -import java.util.List; -import java.util.Map; -import java.util.Objects; -import java.util.Set; - -public class MapJsonSchema { - public sealed interface MapJsonSchema1Boxed permits MapJsonSchema1BoxedMap { - @Nullable Object getData(); - } - public record MapJsonSchema1BoxedMap(FrozenMap<@Nullable Object> data) implements MapJsonSchema1Boxed { - @Override - public @Nullable Object getData() { - return data; - } +class MapJsonSchema { + sealed interface MapJsonSchema1Boxed { + fun getData(): Any? } - public static class MapJsonSchema1 extends JsonSchema implements MapSchemaValidator, MapJsonSchema1BoxedMap> { - private static @Nullable MapJsonSchema1 instance = null; - - protected MapJsonSchema1() { - super(new JsonSchemaInfo() - .type(Set.of(Map.class)) - ); - } - - public static MapJsonSchema1 getInstance() { - if (instance == null) { - instance = new MapJsonSchema1(); - } - return instance; + data class MapJsonSchema1BoxedMap(val data: FrozenMap) : MapJsonSchema1Boxed { + override fun getData(): FrozenMap { + return data } + } - @Override - 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 RuntimeException("Invalid non-string key value"); - } - String propertyName = (String) entryKey; - List propertyPathToItem = new ArrayList<>(pathToItem); - propertyPathToItem.add(propertyName); - Object value = entry.getValue(); - LinkedHashMap, Nothing?> schemas = pathToSchemas.get(propertyPathToItem); - if (schemas == null) { - throw new RuntimeException("Validation result is invalid, schemas must exist for a pathToItem"); + class MapJsonSchema1 private constructor() : JsonSchema( + JsonSchemaInfo() + .type(setOf(Map::class.java)) + ), MapSchemaValidator, MapJsonSchema1BoxedMap> { + override fun getNewInstance( + arg: Map<*, *>, + pathToItem: List, + pathToSchemas: PathToSchemasMap + ): FrozenMap { + val properties = LinkedHashMap() + for ((entryKey, value1) in arg) { + if (entryKey !is String) { + throw RuntimeException("Invalid non-string key value") } - JsonSchema propertySchema = schemas.entrySet().iterator().next().getKey(); - @Nullable Object castValue = propertySchema.getNewInstance(value, propertyPathToItem, pathToSchemas); - properties.put(propertyName, castValue); + val propertyPathToItem: List = pathToItem + entryKey + val schemas: LinkedHashMap, Nothing?> = pathToSchemas[propertyPathToItem] + ?: throw RuntimeException("Validation result is invalid, schemas must exist for a pathToItem") + val propertySchema: JsonSchema<*> = schemas.entries.iterator().next().key + val castValue = propertySchema.getNewInstance(value1, propertyPathToItem, pathToSchemas) + properties[entryKey] = castValue } - return new FrozenMap<>(properties); + return FrozenMap(properties) } - public FrozenMap<@Nullable Object> validate(Map arg, SchemaConfiguration configuration) throws ValidationException { - Set> pathSet = new HashSet<>(); - List pathToItem = List.of("args[0"); - Map castArg = castToAllowedTypes(arg, pathToItem, pathSet); - SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().build())); - ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, new PathToSchemasMap(), new LinkedHashSet<>()); - PathToSchemasMap pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet); - return getNewInstance(castArg, validationMetadata.pathToItem(), pathToSchemasMap); + @Throws(ValidationException::class) + override fun validate(arg: Map<*, *>, configuration: SchemaConfiguration?): FrozenMap { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg: Map<*, *> = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validationMetadata = + ValidationMetadata(pathToItem, usedConfiguration, PathToSchemasMap(), LinkedHashSet()) + val pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet) + return getNewInstance(castArg, validationMetadata.pathToItem, pathToSchemasMap) } - @Override - public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { - if (arg instanceof FrozenMap) { - return getNewInstance((Map) arg, pathToItem, pathToSchemas); + override fun getNewInstance(arg: Any?, pathToItem: List, pathToSchemas: PathToSchemasMap): FrozenMap { + if (arg is FrozenMap<*>) { + return getNewInstance(arg as Map<*, *>, pathToItem, pathToSchemas) } - throw new RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); + throw RuntimeException("Invalid input type=$javaClass. It can't be instantiated by this schema") } - @Override - public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { - if (arg instanceof Map) { - return validate((Map) arg, configuration); + @Throws(ValidationException::class) + override fun validate(arg: Any?, configuration: SchemaConfiguration?): Any? { + if (arg is Map<*, *>) { + return validate(arg as Map<*, *>?, configuration) } - throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw ValidationException("Invalid input type=$javaClass. It can't be validated by this schema") } - @Override - public MapJsonSchema1BoxedMap validateAndBox(Map arg, SchemaConfiguration configuration) throws ValidationException { - return new MapJsonSchema1BoxedMap(validate(arg, configuration)); + @Throws(ValidationException::class) + override fun validateAndBox(arg: Map<*, *>, configuration: SchemaConfiguration?): MapJsonSchema1BoxedMap { + return MapJsonSchema1BoxedMap(validate(arg, configuration)) } - @Override - public MapJsonSchema1Boxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { - if (arg instanceof Map castArg) { - return validateAndBox(castArg, configuration); + @Throws(ValidationException::class) + override fun validateAndBox(arg: Any?, configuration: SchemaConfiguration?): MapJsonSchema1Boxed { + if (arg is Map<*, *>) { + return validateAndBox(arg, configuration) } - throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw ValidationException("Invalid input type=$javaClass. It can't be validated by this schema") + } + + companion object { + @Volatile + private var instance: MapJsonSchema1? = null + + fun getInstance() = + instance ?: synchronized(this) { + instance ?: MapJsonSchema1().also { instance = it } + } } } -} +} \ No newline at end of file From 3106125187197530678279974f743e9b4eb55f6a Mon Sep 17 00:00:00 2001 From: Justin Black Date: Thu, 9 May 2024 09:52:36 -0700 Subject: [PATCH 47/78] Updates NumberJsonSchema --- .../client/schemas/NumberJsonSchema.kt | 153 +++++++++--------- .../packagename/schemas/NumberJsonSchema.hbs | 135 ++++++++-------- 2 files changed, 141 insertions(+), 147 deletions(-) diff --git a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/schemas/NumberJsonSchema.kt b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/schemas/NumberJsonSchema.kt index 260d4e15a44..680da45bdbd 100644 --- a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/schemas/NumberJsonSchema.kt +++ b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/schemas/NumberJsonSchema.kt @@ -1,107 +1,104 @@ -package org.openapijsonschematools.client.schemas; +package org.openapijsonschematools.client.schemas -import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags; -import org.openapijsonschematools.client.exceptions.ValidationException; -import org.openapijsonschematools.client.schemas.validation.JsonSchema; -import org.openapijsonschematools.client.schemas.validation.JsonSchemaInfo; -import org.openapijsonschematools.client.configurations.SchemaConfiguration; -import org.openapijsonschematools.client.schemas.validation.PathToSchemasMap; -import org.openapijsonschematools.client.schemas.validation.NumberSchemaValidator; -import org.openapijsonschematools.client.schemas.validation.ValidationMetadata; -import org.checkerframework.checker.nullness.qual.Nullable; +import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags +import org.openapijsonschematools.client.configurations.SchemaConfiguration +import org.openapijsonschematools.client.exceptions.ValidationException +import org.openapijsonschematools.client.schemas.validation.JsonSchema +import org.openapijsonschematools.client.schemas.validation.JsonSchemaInfo +import org.openapijsonschematools.client.schemas.validation.NumberSchemaValidator +import org.openapijsonschematools.client.schemas.validation.PathToSchemasMap +import org.openapijsonschematools.client.schemas.validation.ValidationMetadata -import java.util.HashSet; -import java.util.LinkedHashSet; -import java.util.List; -import java.util.Objects; -import java.util.Set; - -public class NumberJsonSchema { - public sealed interface NumberJsonSchema1Boxed permits NumberJsonSchema1BoxedNumber { - @Nullable Object getData(); +class NumberJsonSchema { + sealed interface NumberJsonSchema1Boxed { + fun getData(): Any? } - public record NumberJsonSchema1BoxedNumber(Number data) implements NumberJsonSchema1Boxed { - @Override - public @Nullable Object getData() { - return data; + + data class NumberJsonSchema1BoxedNumber(val data: Number) : NumberJsonSchema1Boxed { + override fun getData(): Number { + return data } } - public static class NumberJsonSchema1 extends JsonSchema implements NumberSchemaValidator { - private static @Nullable NumberJsonSchema1 instance = null; - - protected NumberJsonSchema1() { - super(new JsonSchemaInfo() - .type(Set.of( - Integer.class, - Long.class, - Float.class, - Double.class - )) - ); + class NumberJsonSchema1 private constructor() : JsonSchema( + JsonSchemaInfo() + .type( + setOf( + Int::class.java, + Long::class.java, + Float::class.java, + Double::class.java + ) + ) + ), NumberSchemaValidator { + @Throws(ValidationException::class) + override fun validate(arg: Number, configuration: SchemaConfiguration?): Number { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg: Number = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validationMetadata = + ValidationMetadata(pathToItem, usedConfiguration, PathToSchemasMap(), LinkedHashSet()) + val pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet) + return getNewInstance(castArg, validationMetadata.pathToItem, pathToSchemasMap) } - public static NumberJsonSchema1 getInstance() { - if (instance == null) { - instance = new NumberJsonSchema1(); - } - return instance; + @Throws(ValidationException::class) + fun validate(arg: Int, configuration: SchemaConfiguration?): Int { + return validate(arg as Number, configuration) as Int } - @Override - public Number validate(Number arg, SchemaConfiguration configuration) throws ValidationException { - Set> pathSet = new HashSet<>(); - List pathToItem = List.of("args[0"); - Number castArg = castToAllowedTypes(arg, pathToItem, pathSet); - SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().build())); - ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, new PathToSchemasMap(), new LinkedHashSet<>()); - PathToSchemasMap pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet); - return getNewInstance(castArg, validationMetadata.pathToItem(), pathToSchemasMap); + @Throws(ValidationException::class) + fun validate(arg: Long, configuration: SchemaConfiguration?): Long { + return validate(arg as Number, configuration) as Long } - public int validate(int arg, SchemaConfiguration configuration) throws ValidationException { - return (int) validate((Number) arg, configuration); + @Throws(ValidationException::class) + fun validate(arg: Float, configuration: SchemaConfiguration?): Float { + return validate(arg as Number, configuration) as Float } - public long validate(long arg, SchemaConfiguration configuration) throws ValidationException { - return (long) validate((Number) arg, configuration); + @Throws(ValidationException::class) + fun validate(arg: Double, configuration: SchemaConfiguration?): Double { + return validate(arg as Number, configuration) as Double } - public float validate(float arg, SchemaConfiguration configuration) throws ValidationException { - return (float) validate((Number) arg, configuration); + override fun getNewInstance(arg: Any?, pathToItem: List, pathToSchemas: PathToSchemasMap): Any? { + if (arg is Number) { + return getNewInstance(arg as Number?, pathToItem, pathToSchemas) + } + throw RuntimeException("Invalid input type=$javaClass. It can't be instantiated by this schema") } - public double validate(double arg, SchemaConfiguration configuration) throws ValidationException { - return (double) validate((Number) arg, configuration); + @Throws(ValidationException::class) + override fun validate(arg: Any?, configuration: SchemaConfiguration?): Number { + if (arg is Number) { + return validate(arg, configuration) + } + throw ValidationException("Invalid input type=$javaClass. It can't be validated by this schema") } - @Override - public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { - 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"); + @Throws(ValidationException::class) + override fun validateAndBox(arg: Number, configuration: SchemaConfiguration?): NumberJsonSchema1BoxedNumber { + return NumberJsonSchema1BoxedNumber(validate(arg, configuration)) } - @Override - public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { - if (arg instanceof Number) { - return validate((Number) arg, configuration); + @Throws(ValidationException::class) + override fun validateAndBox(arg: Any?, configuration: SchemaConfiguration?): NumberJsonSchema1Boxed { + if (arg is Number) { + return validateAndBox(arg, configuration) } - throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw ValidationException("Invalid input type=$javaClass. It can't be validated by this schema") } - @Override - public NumberJsonSchema1BoxedNumber validateAndBox(Number arg, SchemaConfiguration configuration) throws ValidationException { - return new NumberJsonSchema1BoxedNumber(validate(arg, configuration)); - } + companion object { + @Volatile + private var instance: NumberJsonSchema1? = null - @Override - public NumberJsonSchema1Boxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { - 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"); + fun getInstance() = + instance ?: synchronized(this) { + instance ?: NumberJsonSchema1().also { instance = it } + } } } } \ No newline at end of file diff --git a/src/main/resources/kotlin/src/main/kotlin/packagename/schemas/NumberJsonSchema.hbs b/src/main/resources/kotlin/src/main/kotlin/packagename/schemas/NumberJsonSchema.hbs index 736994d2f51..1b03c9b44e3 100644 --- a/src/main/resources/kotlin/src/main/kotlin/packagename/schemas/NumberJsonSchema.hbs +++ b/src/main/resources/kotlin/src/main/kotlin/packagename/schemas/NumberJsonSchema.hbs @@ -8,100 +8,97 @@ import {{{packageName}}}.configurations.SchemaConfiguration; import {{{packageName}}}.schemas.validation.PathToSchemasMap; import {{{packageName}}}.schemas.validation.NumberSchemaValidator; import {{{packageName}}}.schemas.validation.ValidationMetadata; -import org.checkerframework.checker.nullness.qual.Nullable; -import java.util.HashSet; -import java.util.LinkedHashSet; -import java.util.List; -import java.util.Objects; -import java.util.Set; - -public class NumberJsonSchema { - public sealed interface NumberJsonSchema1Boxed permits NumberJsonSchema1BoxedNumber { - @Nullable Object getData(); +class NumberJsonSchema { + sealed interface NumberJsonSchema1Boxed { + fun getData(): Any? } - public record NumberJsonSchema1BoxedNumber(Number data) implements NumberJsonSchema1Boxed { - @Override - public @Nullable Object getData() { - return data; + + data class NumberJsonSchema1BoxedNumber(val data: Number) : NumberJsonSchema1Boxed { + override fun getData(): Number { + return data } } - public static class NumberJsonSchema1 extends JsonSchema implements NumberSchemaValidator { - private static @Nullable NumberJsonSchema1 instance = null; - - protected NumberJsonSchema1() { - super(new JsonSchemaInfo() - .type(Set.of( - Integer.class, - Long.class, - Float.class, - Double.class - )) - ); + class NumberJsonSchema1 private constructor() : JsonSchema( + JsonSchemaInfo() + .type( + setOf( + Int::class.java, + Long::class.java, + Float::class.java, + Double::class.java + ) + ) + ), NumberSchemaValidator { + @Throws(ValidationException::class) + override fun validate(arg: Number, configuration: SchemaConfiguration?): Number { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg: Number = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validationMetadata = + ValidationMetadata(pathToItem, usedConfiguration, PathToSchemasMap(), LinkedHashSet()) + val pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet) + return getNewInstance(castArg, validationMetadata.pathToItem, pathToSchemasMap) } - public static NumberJsonSchema1 getInstance() { - if (instance == null) { - instance = new NumberJsonSchema1(); - } - return instance; + @Throws(ValidationException::class) + fun validate(arg: Int, configuration: SchemaConfiguration?): Int { + return validate(arg as Number, configuration) as Int } - @Override - public Number validate(Number arg, SchemaConfiguration configuration) throws ValidationException { - Set> pathSet = new HashSet<>(); - List pathToItem = List.of("args[0"); - Number castArg = castToAllowedTypes(arg, pathToItem, pathSet); - SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().build())); - ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, new PathToSchemasMap(), new LinkedHashSet<>()); - PathToSchemasMap pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet); - return getNewInstance(castArg, validationMetadata.pathToItem(), pathToSchemasMap); + @Throws(ValidationException::class) + fun validate(arg: Long, configuration: SchemaConfiguration?): Long { + return validate(arg as Number, configuration) as Long } - public int validate(int arg, SchemaConfiguration configuration) throws ValidationException { - return (int) validate((Number) arg, configuration); + @Throws(ValidationException::class) + fun validate(arg: Float, configuration: SchemaConfiguration?): Float { + return validate(arg as Number, configuration) as Float } - public long validate(long arg, SchemaConfiguration configuration) throws ValidationException { - return (long) validate((Number) arg, configuration); + @Throws(ValidationException::class) + fun validate(arg: Double, configuration: SchemaConfiguration?): Double { + return validate(arg as Number, configuration) as Double } - public float validate(float arg, SchemaConfiguration configuration) throws ValidationException { - return (float) validate((Number) arg, configuration); + override fun getNewInstance(arg: Any?, pathToItem: List, pathToSchemas: PathToSchemasMap): Any? { + if (arg is Number) { + return getNewInstance(arg as Number?, pathToItem, pathToSchemas) + } + throw RuntimeException("Invalid input type=$javaClass. It can't be instantiated by this schema") } - public double validate(double arg, SchemaConfiguration configuration) throws ValidationException { - return (double) validate((Number) arg, configuration); + @Throws(ValidationException::class) + override fun validate(arg: Any?, configuration: SchemaConfiguration?): Number { + if (arg is Number) { + return validate(arg, configuration) + } + throw ValidationException("Invalid input type=$javaClass. It can't be validated by this schema") } - @Override - public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { - 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"); + @Throws(ValidationException::class) + override fun validateAndBox(arg: Number, configuration: SchemaConfiguration?): NumberJsonSchema1BoxedNumber { + return NumberJsonSchema1BoxedNumber(validate(arg, configuration)) } - @Override - public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { - if (arg instanceof Number) { - return validate((Number) arg, configuration); + @Throws(ValidationException::class) + override fun validateAndBox(arg: Any?, configuration: SchemaConfiguration?): NumberJsonSchema1Boxed { + if (arg is Number) { + return validateAndBox(arg, configuration) } - throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw ValidationException("Invalid input type=$javaClass. It can't be validated by this schema") } - @Override - public NumberJsonSchema1BoxedNumber validateAndBox(Number arg, SchemaConfiguration configuration) throws ValidationException { - return new NumberJsonSchema1BoxedNumber(validate(arg, configuration)); - } + companion object { + @Volatile + private var instance: NumberJsonSchema1? = null - @Override - public NumberJsonSchema1Boxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { - 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"); + fun getInstance() = + instance ?: synchronized(this) { + instance ?: NumberJsonSchema1().also { instance = it } + } } } } \ No newline at end of file From e05b1707ee2c35a2de6a7b1503dc3238e6187c1e Mon Sep 17 00:00:00 2001 From: Justin Black Date: Thu, 9 May 2024 10:00:45 -0700 Subject: [PATCH 48/78] Updates DateJsonSchema --- .../client/schemas/DateJsonSchema.kt | 138 +++++++++--------- .../client/schemas/NumberJsonSchema.kt | 4 +- .../packagename/schemas/DateJsonSchema.hbs | 117 ++++++++------- .../packagename/schemas/NumberJsonSchema.hbs | 4 +- 4 files changed, 128 insertions(+), 135 deletions(-) diff --git a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/schemas/DateJsonSchema.kt b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/schemas/DateJsonSchema.kt index 9e795318d67..57bd17ea4e6 100644 --- a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/schemas/DateJsonSchema.kt +++ b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/schemas/DateJsonSchema.kt @@ -1,94 +1,90 @@ -package org.openapijsonschematools.client.schemas; +package org.openapijsonschematools.client.schemas -import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags; -import org.openapijsonschematools.client.configurations.SchemaConfiguration; -import org.openapijsonschematools.client.exceptions.ValidationException; -import org.openapijsonschematools.client.schemas.validation.JsonSchema; -import org.openapijsonschematools.client.schemas.validation.JsonSchemaInfo; -import org.openapijsonschematools.client.schemas.validation.PathToSchemasMap; -import org.openapijsonschematools.client.schemas.validation.StringSchemaValidator; -import org.openapijsonschematools.client.schemas.validation.ValidationMetadata; -import org.checkerframework.checker.nullness.qual.Nullable; +import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags +import org.openapijsonschematools.client.configurations.SchemaConfiguration +import org.openapijsonschematools.client.exceptions.ValidationException +import org.openapijsonschematools.client.schemas.validation.JsonSchema +import org.openapijsonschematools.client.schemas.validation.JsonSchemaInfo +import org.openapijsonschematools.client.schemas.validation.PathToSchemasMap +import org.openapijsonschematools.client.schemas.validation.StringSchemaValidator +import org.openapijsonschematools.client.schemas.validation.ValidationMetadata +import java.time.LocalDate -import java.time.LocalDate; -import java.util.HashSet; -import java.util.LinkedHashSet; -import java.util.List; -import java.util.Objects; -import java.util.Set; - -public class DateJsonSchema { - public sealed interface DateJsonSchema1Boxed permits DateJsonSchema1BoxedString { - @Nullable Object getData(); - } - public record DateJsonSchema1BoxedString(String data) implements DateJsonSchema1Boxed { - @Override - public @Nullable Object getData() { - return data; - } +class DateJsonSchema { + sealed interface DateJsonSchema1Boxed { + fun getData(): Any? } - public static class DateJsonSchema1 extends JsonSchema implements StringSchemaValidator { - private static @Nullable DateJsonSchema1 instance = null; - - protected DateJsonSchema1() { - super(new JsonSchemaInfo() - .type(Set.of(String.class)) - .format("date") - ); + data class DateJsonSchema1BoxedString(val data: String) : DateJsonSchema1Boxed { + override fun getData(): String { + return data } + } - public static DateJsonSchema1 getInstance() { - if (instance == null) { - instance = new DateJsonSchema1(); + class DateJsonSchema1 private constructor() : JsonSchema( + JsonSchemaInfo() + .type(setOf(String::class.java)) + .format("date") + ), StringSchemaValidator { + @Throws(ValidationException::class) + override fun validate(arg: String, configuration: SchemaConfiguration?): String { + val pathSet: Set> = HashSet() + val pathToItem = listOf("args[0") + val castArg: String = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = Objects.requireNonNullElseGet(configuration) { + SchemaConfiguration( + JsonSchemaKeywordFlags.Builder().build() + ) } - return instance; + val validationMetadata = + ValidationMetadata(pathToItem, usedConfiguration!!, PathToSchemasMap(), LinkedHashSet()) + val pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet) + return getNewInstance(castArg, validationMetadata.pathToItem(), pathToSchemasMap) } - @Override - public String validate(String arg, SchemaConfiguration configuration) throws ValidationException { - Set> pathSet = new HashSet<>(); - List pathToItem = List.of("args[0"); - String castArg = castToAllowedTypes(arg, pathToItem, pathSet); - SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().build())); - ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, new PathToSchemasMap(), new LinkedHashSet<>()); - PathToSchemasMap pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet); - return getNewInstance(castArg, validationMetadata.pathToItem(), pathToSchemasMap); + @Throws(ValidationException::class) + fun validate(arg: LocalDate, configuration: SchemaConfiguration?): String { + return validate(arg.toString(), configuration) } - public String validate(LocalDate arg, SchemaConfiguration configuration) throws ValidationException { - return validate(arg.toString(), configuration); - } - - @Override - public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { - if (arg instanceof String) { - return getNewInstance((String) arg, pathToItem, pathToSchemas); + override fun getNewInstance(arg: Any?, pathToItem: List, pathToSchemas: PathToSchemasMap): Any? { + if (arg is String) { + return getNewInstance(arg as String?, pathToItem, pathToSchemas) } - throw new RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); + throw RuntimeException("Invalid input type=$javaClass. It can't be instantiated by this schema") } - @Override - 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); + @Throws(ValidationException::class) + override fun validate(arg: Any?, configuration: SchemaConfiguration?): String { + if (arg is String) { + return validate(arg, configuration) + } else if (arg is LocalDate) { + return validate(arg, configuration) } - throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw ValidationException("Invalid input type=$javaClass. It can't be validated by this schema") } - @Override - public DateJsonSchema1BoxedString validateAndBox(String arg, SchemaConfiguration configuration) throws ValidationException { - return new DateJsonSchema1BoxedString(validate(arg, configuration)); + @Throws(ValidationException::class) + override fun validateAndBox(arg: String, configuration: SchemaConfiguration?): DateJsonSchema1BoxedString { + return DateJsonSchema1BoxedString(validate(arg, configuration)) } - @Override - public DateJsonSchema1Boxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { - if (arg instanceof String castArg) { - return validateAndBox(castArg, configuration); + @Throws(ValidationException::class) + override fun validateAndBox(arg: Any?, configuration: SchemaConfiguration?): DateJsonSchema1Boxed { + if (arg is String) { + return validateAndBox(arg, configuration) } - throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw ValidationException("Invalid input type=$javaClass. It can't be validated by this schema") + } + + companion object { + @Volatile + private var instance: DateJsonSchema1? = null + + fun getInstance() = + instance ?: synchronized(this) { + instance ?: DateJsonSchema1().also { instance = it } + } } } } \ No newline at end of file diff --git a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/schemas/NumberJsonSchema.kt b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/schemas/NumberJsonSchema.kt index 680da45bdbd..657f349e763 100644 --- a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/schemas/NumberJsonSchema.kt +++ b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/schemas/NumberJsonSchema.kt @@ -20,7 +20,7 @@ class NumberJsonSchema { } } - class NumberJsonSchema1 private constructor() : JsonSchema( + class NumberJsonSchema1 private constructor() : JsonSchema( JsonSchemaInfo() .type( setOf( @@ -30,7 +30,7 @@ class NumberJsonSchema { Double::class.java ) ) - ), NumberSchemaValidator { + ), NumberSchemaValidator { @Throws(ValidationException::class) override fun validate(arg: Number, configuration: SchemaConfiguration?): Number { val pathSet: MutableSet> = HashSet() diff --git a/src/main/resources/kotlin/src/main/kotlin/packagename/schemas/DateJsonSchema.hbs b/src/main/resources/kotlin/src/main/kotlin/packagename/schemas/DateJsonSchema.hbs index da5e22633bf..0fb1b4504ed 100644 --- a/src/main/resources/kotlin/src/main/kotlin/packagename/schemas/DateJsonSchema.hbs +++ b/src/main/resources/kotlin/src/main/kotlin/packagename/schemas/DateJsonSchema.hbs @@ -8,87 +8,84 @@ import {{{packageName}}}.schemas.validation.JsonSchemaInfo; import {{{packageName}}}.schemas.validation.PathToSchemasMap; import {{{packageName}}}.schemas.validation.StringSchemaValidator; import {{{packageName}}}.schemas.validation.ValidationMetadata; -import org.checkerframework.checker.nullness.qual.Nullable; import java.time.LocalDate; -import java.util.HashSet; -import java.util.LinkedHashSet; -import java.util.List; -import java.util.Objects; -import java.util.Set; -public class DateJsonSchema { - public sealed interface DateJsonSchema1Boxed permits DateJsonSchema1BoxedString { - @Nullable Object getData(); +class DateJsonSchema { + sealed interface DateJsonSchema1Boxed { + fun getData(): Any? } - public record DateJsonSchema1BoxedString(String data) implements DateJsonSchema1Boxed { - @Override - public @Nullable Object getData() { - return data; - } - } - - public static class DateJsonSchema1 extends JsonSchema implements StringSchemaValidator { - private static @Nullable DateJsonSchema1 instance = null; - protected DateJsonSchema1() { - super(new JsonSchemaInfo() - .type(Set.of(String.class)) - .format("date") - ); + data class DateJsonSchema1BoxedString(val data: String) : DateJsonSchema1Boxed { + override fun getData(): String { + return data } + } - public static DateJsonSchema1 getInstance() { - if (instance == null) { - instance = new DateJsonSchema1(); + class DateJsonSchema1 private constructor() : JsonSchema( + JsonSchemaInfo() + .type(setOf(String::class.java)) + .format("date") + ), StringSchemaValidator { + @Throws(ValidationException::class) + override fun validate(arg: String, configuration: SchemaConfiguration?): String { + val pathSet: Set> = HashSet() + val pathToItem = listOf("args[0") + val castArg: String = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = Objects.requireNonNullElseGet(configuration) { + SchemaConfiguration( + JsonSchemaKeywordFlags.Builder().build() + ) } - return instance; + val validationMetadata = + ValidationMetadata(pathToItem, usedConfiguration!!, PathToSchemasMap(), LinkedHashSet()) + val pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet) + return getNewInstance(castArg, validationMetadata.pathToItem(), pathToSchemasMap) } - @Override - public String validate(String arg, SchemaConfiguration configuration) throws ValidationException { - Set> pathSet = new HashSet<>(); - List pathToItem = List.of("args[0"); - String castArg = castToAllowedTypes(arg, pathToItem, pathSet); - SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().build())); - ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, new PathToSchemasMap(), new LinkedHashSet<>()); - PathToSchemasMap pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet); - return getNewInstance(castArg, validationMetadata.pathToItem(), pathToSchemasMap); + @Throws(ValidationException::class) + fun validate(arg: LocalDate, configuration: SchemaConfiguration?): String { + return validate(arg.toString(), configuration) } - public String validate(LocalDate arg, SchemaConfiguration configuration) throws ValidationException { - return validate(arg.toString(), configuration); - } - - @Override - public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { - if (arg instanceof String) { - return getNewInstance((String) arg, pathToItem, pathToSchemas); + override fun getNewInstance(arg: Any?, pathToItem: List, pathToSchemas: PathToSchemasMap): Any? { + if (arg is String) { + return getNewInstance(arg as String?, pathToItem, pathToSchemas) } - throw new RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); + throw RuntimeException("Invalid input type=$javaClass. It can't be instantiated by this schema") } - @Override - 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); + @Throws(ValidationException::class) + override fun validate(arg: Any?, configuration: SchemaConfiguration?): String { + if (arg is String) { + return validate(arg, configuration) + } else if (arg is LocalDate) { + return validate(arg, configuration) } - throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw ValidationException("Invalid input type=$javaClass. It can't be validated by this schema") } - @Override - public DateJsonSchema1BoxedString validateAndBox(String arg, SchemaConfiguration configuration) throws ValidationException { - return new DateJsonSchema1BoxedString(validate(arg, configuration)); + @Throws(ValidationException::class) + override fun validateAndBox(arg: String, configuration: SchemaConfiguration?): DateJsonSchema1BoxedString { + return DateJsonSchema1BoxedString(validate(arg, configuration)) } - @Override - public DateJsonSchema1Boxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { - if (arg instanceof String castArg) { - return validateAndBox(castArg, configuration); + @Throws(ValidationException::class) + override fun validateAndBox(arg: Any?, configuration: SchemaConfiguration?): DateJsonSchema1Boxed { + if (arg is String) { + return validateAndBox(arg, configuration) } - throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw ValidationException("Invalid input type=$javaClass. It can't be validated by this schema") + } + + companion object { + @Volatile + private var instance: DateJsonSchema1? = null + + fun getInstance() = + instance ?: synchronized(this) { + instance ?: DateJsonSchema1().also { instance = it } + } } } } \ No newline at end of file diff --git a/src/main/resources/kotlin/src/main/kotlin/packagename/schemas/NumberJsonSchema.hbs b/src/main/resources/kotlin/src/main/kotlin/packagename/schemas/NumberJsonSchema.hbs index 1b03c9b44e3..7964b5deb83 100644 --- a/src/main/resources/kotlin/src/main/kotlin/packagename/schemas/NumberJsonSchema.hbs +++ b/src/main/resources/kotlin/src/main/kotlin/packagename/schemas/NumberJsonSchema.hbs @@ -20,7 +20,7 @@ class NumberJsonSchema { } } - class NumberJsonSchema1 private constructor() : JsonSchema( + class NumberJsonSchema1 private constructor() : JsonSchema( JsonSchemaInfo() .type( setOf( @@ -30,7 +30,7 @@ class NumberJsonSchema { Double::class.java ) ) - ), NumberSchemaValidator { + ), NumberSchemaValidator { @Throws(ValidationException::class) override fun validate(arg: Number, configuration: SchemaConfiguration?): Number { val pathSet: MutableSet> = HashSet() From 5eeae6a579eb268f386f95d79fa3d5480c252f43 Mon Sep 17 00:00:00 2001 From: Justin Black Date: Thu, 9 May 2024 10:04:20 -0700 Subject: [PATCH 49/78] Updates DateTimeJsonSchema --- .../client/schemas/DateTimeJsonSchema.kt | 133 +++++++++--------- .../schemas/DateTimeJsonSchema.hbs | 113 +++++++-------- 2 files changed, 116 insertions(+), 130 deletions(-) diff --git a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/schemas/DateTimeJsonSchema.kt b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/schemas/DateTimeJsonSchema.kt index 3304924e331..836a128d9a5 100644 --- a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/schemas/DateTimeJsonSchema.kt +++ b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/schemas/DateTimeJsonSchema.kt @@ -1,94 +1,87 @@ -package org.openapijsonschematools.client.schemas; +package org.openapijsonschematools.client.schemas -import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags; -import org.openapijsonschematools.client.configurations.SchemaConfiguration; -import org.openapijsonschematools.client.exceptions.ValidationException; -import org.openapijsonschematools.client.schemas.validation.JsonSchema; -import org.openapijsonschematools.client.schemas.validation.JsonSchemaInfo; -import org.openapijsonschematools.client.schemas.validation.PathToSchemasMap; -import org.openapijsonschematools.client.schemas.validation.StringSchemaValidator; -import org.openapijsonschematools.client.schemas.validation.ValidationMetadata; -import org.checkerframework.checker.nullness.qual.Nullable; +import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags +import org.openapijsonschematools.client.configurations.SchemaConfiguration +import org.openapijsonschematools.client.exceptions.ValidationException +import org.openapijsonschematools.client.schemas.validation.JsonSchema +import org.openapijsonschematools.client.schemas.validation.JsonSchemaInfo +import org.openapijsonschematools.client.schemas.validation.PathToSchemasMap +import org.openapijsonschematools.client.schemas.validation.StringSchemaValidator +import org.openapijsonschematools.client.schemas.validation.ValidationMetadata -import java.time.ZonedDateTime; -import java.util.HashSet; -import java.util.LinkedHashSet; -import java.util.List; -import java.util.Objects; -import java.util.Set; +import java.time.ZonedDateTime -public class DateTimeJsonSchema { - public sealed interface DateTimeJsonSchema1Boxed permits DateTimeJsonSchema1BoxedString { - @Nullable Object getData(); +class DateTimeJsonSchema { + sealed interface DateTimeJsonSchema1Boxed { + fun getData(): Any? } - public record DateTimeJsonSchema1BoxedString(String data) implements DateTimeJsonSchema1Boxed { - @Override - public @Nullable Object getData() { - return data; + + data class DateTimeJsonSchema1BoxedString(val data: String) : DateTimeJsonSchema1Boxed { + override fun getData(): String { + return data } } - public static class DateTimeJsonSchema1 extends JsonSchema implements StringSchemaValidator { - private static @Nullable DateTimeJsonSchema1 instance = null; - - protected DateTimeJsonSchema1() { - super(new JsonSchemaInfo() - .type(Set.of(String.class)) - .format("date-time") - ); + class DateTimeJsonSchema1 private constructor() : JsonSchema( + JsonSchemaInfo() + .type(setOf(String::class.java)) + .format("date-time") + ), StringSchemaValidator { + @Throws(ValidationException::class) + override fun validate(arg: String, configuration: SchemaConfiguration?): String { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg: String = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validationMetadata = + ValidationMetadata(pathToItem, usedConfiguration, PathToSchemasMap(), LinkedHashSet()) + val pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet) + return getNewInstance(castArg, validationMetadata.pathToItem, pathToSchemasMap) } - public static DateTimeJsonSchema1 getInstance() { - if (instance == null) { - instance = new DateTimeJsonSchema1(); - } - return instance; + @Throws(ValidationException::class) + fun validate(arg: ZonedDateTime, configuration: SchemaConfiguration?): String { + return validate(arg.toString(), configuration) } - @Override - public String validate(String arg, SchemaConfiguration configuration) throws ValidationException { - Set> pathSet = new HashSet<>(); - List pathToItem = List.of("args[0"); - String castArg = castToAllowedTypes(arg, pathToItem, pathSet); - SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().build())); - ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, new PathToSchemasMap(), new LinkedHashSet<>()); - PathToSchemasMap pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet); - return getNewInstance(castArg, validationMetadata.pathToItem(), pathToSchemasMap); + override fun getNewInstance(arg: Any?, pathToItem: List, pathToSchemas: PathToSchemasMap): Any? { + if (arg is String) { + return getNewInstance(arg as String?, pathToItem, pathToSchemas) + } + throw RuntimeException("Invalid input type=$javaClass. It can't be instantiated by this schema") } - public String validate(ZonedDateTime arg, SchemaConfiguration configuration) throws ValidationException { - return validate(arg.toString(), configuration); + @Throws(ValidationException::class) + override fun validate(arg: Any?, configuration: SchemaConfiguration?): String { + if (arg is String) { + return validate(arg, configuration) + } else if (arg is ZonedDateTime) { + return validate(arg, configuration) + } + throw ValidationException("Invalid input type=$javaClass. It can't be validated by this schema") } - @Override - public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { - 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"); + @Throws(ValidationException::class) + override fun validateAndBox(arg: String, configuration: SchemaConfiguration?): DateTimeJsonSchema1BoxedString { + return DateTimeJsonSchema1BoxedString(validate(arg, configuration)) } - @Override - 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); + @Throws(ValidationException::class) + override fun validateAndBox(arg: Any?, configuration: SchemaConfiguration?): DateTimeJsonSchema1Boxed { + if (arg is String) { + return validateAndBox(arg, configuration) } - throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw ValidationException("Invalid input type=$javaClass. It can't be validated by this schema") } - @Override - public DateTimeJsonSchema1BoxedString validateAndBox(String arg, SchemaConfiguration configuration) throws ValidationException { - return new DateTimeJsonSchema1BoxedString(validate(arg, configuration)); - } + companion object { + @Volatile + private var instance: DateTimeJsonSchema1? = null - @Override - public DateTimeJsonSchema1Boxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { - 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"); + fun getInstance() = + instance ?: synchronized(this) { + instance ?: DateTimeJsonSchema1().also { instance = it } + } } } } \ No newline at end of file diff --git a/src/main/resources/kotlin/src/main/kotlin/packagename/schemas/DateTimeJsonSchema.hbs b/src/main/resources/kotlin/src/main/kotlin/packagename/schemas/DateTimeJsonSchema.hbs index 71684407104..ba877d8217b 100644 --- a/src/main/resources/kotlin/src/main/kotlin/packagename/schemas/DateTimeJsonSchema.hbs +++ b/src/main/resources/kotlin/src/main/kotlin/packagename/schemas/DateTimeJsonSchema.hbs @@ -8,87 +8,80 @@ import {{{packageName}}}.schemas.validation.JsonSchemaInfo; import {{{packageName}}}.schemas.validation.PathToSchemasMap; import {{{packageName}}}.schemas.validation.StringSchemaValidator; import {{{packageName}}}.schemas.validation.ValidationMetadata; -import org.checkerframework.checker.nullness.qual.Nullable; import java.time.ZonedDateTime; -import java.util.HashSet; -import java.util.LinkedHashSet; -import java.util.List; -import java.util.Objects; -import java.util.Set; -public class DateTimeJsonSchema { - public sealed interface DateTimeJsonSchema1Boxed permits DateTimeJsonSchema1BoxedString { - @Nullable Object getData(); +class DateTimeJsonSchema { + sealed interface DateTimeJsonSchema1Boxed { + fun getData(): Any? } - public record DateTimeJsonSchema1BoxedString(String data) implements DateTimeJsonSchema1Boxed { - @Override - public @Nullable Object getData() { - return data; + + data class DateTimeJsonSchema1BoxedString(val data: String) : DateTimeJsonSchema1Boxed { + override fun getData(): String { + return data } } - public static class DateTimeJsonSchema1 extends JsonSchema implements StringSchemaValidator { - private static @Nullable DateTimeJsonSchema1 instance = null; - - protected DateTimeJsonSchema1() { - super(new JsonSchemaInfo() - .type(Set.of(String.class)) - .format("date-time") - ); + class DateTimeJsonSchema1 private constructor() : JsonSchema( + JsonSchemaInfo() + .type(setOf(String::class.java)) + .format("date-time") + ), StringSchemaValidator { + @Throws(ValidationException::class) + override fun validate(arg: String, configuration: SchemaConfiguration?): String { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg: String = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validationMetadata = + ValidationMetadata(pathToItem, usedConfiguration, PathToSchemasMap(), LinkedHashSet()) + val pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet) + return getNewInstance(castArg, validationMetadata.pathToItem, pathToSchemasMap) } - public static DateTimeJsonSchema1 getInstance() { - if (instance == null) { - instance = new DateTimeJsonSchema1(); - } - return instance; + @Throws(ValidationException::class) + fun validate(arg: ZonedDateTime, configuration: SchemaConfiguration?): String { + return validate(arg.toString(), configuration) } - @Override - public String validate(String arg, SchemaConfiguration configuration) throws ValidationException { - Set> pathSet = new HashSet<>(); - List pathToItem = List.of("args[0"); - String castArg = castToAllowedTypes(arg, pathToItem, pathSet); - SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().build())); - ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, new PathToSchemasMap(), new LinkedHashSet<>()); - PathToSchemasMap pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet); - return getNewInstance(castArg, validationMetadata.pathToItem(), pathToSchemasMap); + override fun getNewInstance(arg: Any?, pathToItem: List, pathToSchemas: PathToSchemasMap): Any? { + if (arg is String) { + return getNewInstance(arg as String?, pathToItem, pathToSchemas) + } + throw RuntimeException("Invalid input type=$javaClass. It can't be instantiated by this schema") } - public String validate(ZonedDateTime arg, SchemaConfiguration configuration) throws ValidationException { - return validate(arg.toString(), configuration); + @Throws(ValidationException::class) + override fun validate(arg: Any?, configuration: SchemaConfiguration?): String { + if (arg is String) { + return validate(arg, configuration) + } else if (arg is ZonedDateTime) { + return validate(arg, configuration) + } + throw ValidationException("Invalid input type=$javaClass. It can't be validated by this schema") } - @Override - public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { - 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"); + @Throws(ValidationException::class) + override fun validateAndBox(arg: String, configuration: SchemaConfiguration?): DateTimeJsonSchema1BoxedString { + return DateTimeJsonSchema1BoxedString(validate(arg, configuration)) } - @Override - 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); + @Throws(ValidationException::class) + override fun validateAndBox(arg: Any?, configuration: SchemaConfiguration?): DateTimeJsonSchema1Boxed { + if (arg is String) { + return validateAndBox(arg, configuration) } - throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw ValidationException("Invalid input type=$javaClass. It can't be validated by this schema") } - @Override - public DateTimeJsonSchema1BoxedString validateAndBox(String arg, SchemaConfiguration configuration) throws ValidationException { - return new DateTimeJsonSchema1BoxedString(validate(arg, configuration)); - } + companion object { + @Volatile + private var instance: DateTimeJsonSchema1? = null - @Override - public DateTimeJsonSchema1Boxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { - 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"); + fun getInstance() = + instance ?: synchronized(this) { + instance ?: DateTimeJsonSchema1().also { instance = it } + } } } } \ No newline at end of file From b1f7250adeda5977afd9b32b7115e1dbc7cd0047 Mon Sep 17 00:00:00 2001 From: Justin Black Date: Thu, 9 May 2024 10:08:30 -0700 Subject: [PATCH 50/78] Updates DecimalJsonSchema --- .../client/schemas/DecimalJsonSchema.kt | 121 ++++++++---------- .../packagename/schemas/DecimalJsonSchema.hbs | 103 +++++++-------- 2 files changed, 103 insertions(+), 121 deletions(-) diff --git a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/schemas/DecimalJsonSchema.kt b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/schemas/DecimalJsonSchema.kt index f9e3f6a6f3b..3d03d10ba29 100644 --- a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/schemas/DecimalJsonSchema.kt +++ b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/schemas/DecimalJsonSchema.kt @@ -1,87 +1,78 @@ -package org.openapijsonschematools.client.schemas; +package org.openapijsonschematools.client.schemas -import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags; -import org.openapijsonschematools.client.configurations.SchemaConfiguration; -import org.openapijsonschematools.client.exceptions.ValidationException; -import org.openapijsonschematools.client.schemas.validation.JsonSchema; -import org.openapijsonschematools.client.schemas.validation.JsonSchemaInfo; -import org.openapijsonschematools.client.schemas.validation.PathToSchemasMap; -import org.openapijsonschematools.client.schemas.validation.StringSchemaValidator; -import org.openapijsonschematools.client.schemas.validation.ValidationMetadata; -import org.checkerframework.checker.nullness.qual.Nullable; +import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags +import org.openapijsonschematools.client.configurations.SchemaConfiguration +import org.openapijsonschematools.client.exceptions.ValidationException +import org.openapijsonschematools.client.schemas.validation.JsonSchema +import org.openapijsonschematools.client.schemas.validation.JsonSchemaInfo +import org.openapijsonschematools.client.schemas.validation.PathToSchemasMap +import org.openapijsonschematools.client.schemas.validation.StringSchemaValidator +import org.openapijsonschematools.client.schemas.validation.ValidationMetadata -import java.util.HashSet; -import java.util.LinkedHashSet; -import java.util.List; -import java.util.Objects; -import java.util.Set; - -public class DecimalJsonSchema { - public sealed interface DecimalJsonSchema1Boxed permits DecimalJsonSchema1BoxedString { - @Nullable Object getData(); +class DecimalJsonSchema { + sealed interface DecimalJsonSchema1Boxed { + fun getData(): Any? } - public record DecimalJsonSchema1BoxedString(String data) implements DecimalJsonSchema1Boxed { - @Override - public @Nullable Object getData() { - return data; + + data class DecimalJsonSchema1BoxedString(val data: String) : DecimalJsonSchema1Boxed { + override fun getData(): String { + return data } } - public static class DecimalJsonSchema1 extends JsonSchema implements StringSchemaValidator { - private static @Nullable DecimalJsonSchema1 instance = null; - - protected DecimalJsonSchema1() { - super(new JsonSchemaInfo() - .type(Set.of(String.class)) - .format("number") - ); + class DecimalJsonSchema1 private constructor() : JsonSchema( + JsonSchemaInfo() + .type(setOf(String::class.java)) + .format("number") + ), StringSchemaValidator { + @Throws(ValidationException::class) + override fun validate(arg: String, configuration: SchemaConfiguration?): String { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg: String = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validationMetadata = + ValidationMetadata(pathToItem, usedConfiguration, PathToSchemasMap(), LinkedHashSet()) + val pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet) + return getNewInstance(castArg, validationMetadata.pathToItem, pathToSchemasMap) } - public static DecimalJsonSchema1 getInstance() { - if (instance == null) { - instance = new DecimalJsonSchema1(); + override fun getNewInstance(arg: Any?, pathToItem: List, pathToSchemas: PathToSchemasMap): Any? { + if (arg is String) { + return getNewInstance(arg as String?, pathToItem, pathToSchemas) } - return instance; + throw RuntimeException("Invalid input type=$javaClass. It can't be instantiated by this schema") } - @Override - public String validate(String arg, SchemaConfiguration configuration) throws ValidationException { - Set> pathSet = new HashSet<>(); - List pathToItem = List.of("args[0"); - String castArg = castToAllowedTypes(arg, pathToItem, pathSet); - SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().build())); - ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, new PathToSchemasMap(), new LinkedHashSet<>()); - PathToSchemasMap pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet); - return getNewInstance(castArg, validationMetadata.pathToItem(), pathToSchemasMap); + @Throws(ValidationException::class) + override fun validate(arg: Any?, configuration: SchemaConfiguration?): String { + if (arg is String) { + return validate(arg, configuration) + } + throw ValidationException("Invalid input type=$javaClass. It can't be validated by this schema") } - @Override - public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { - 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"); + @Throws(ValidationException::class) + override fun validateAndBox(arg: String, configuration: SchemaConfiguration?): DecimalJsonSchema1BoxedString { + return DecimalJsonSchema1BoxedString(validate(arg, configuration)) } - @Override - public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { - if (arg instanceof String) { - return validate((String) arg, configuration); + @Throws(ValidationException::class) + override fun validateAndBox(arg: Any?, configuration: SchemaConfiguration?): DecimalJsonSchema1Boxed { + if (arg is String) { + return validateAndBox(arg, configuration) } - throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw ValidationException("Invalid input type=$javaClass. It can't be validated by this schema") } - @Override - public DecimalJsonSchema1BoxedString validateAndBox(String arg, SchemaConfiguration configuration) throws ValidationException { - return new DecimalJsonSchema1BoxedString(validate(arg, configuration)); - } + companion object { + @Volatile + private var instance: DecimalJsonSchema1? = null - @Override - public DecimalJsonSchema1Boxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { - 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"); + fun getInstance() = + instance ?: synchronized(this) { + instance ?: DecimalJsonSchema1().also { instance = it } + } } } } \ No newline at end of file diff --git a/src/main/resources/kotlin/src/main/kotlin/packagename/schemas/DecimalJsonSchema.hbs b/src/main/resources/kotlin/src/main/kotlin/packagename/schemas/DecimalJsonSchema.hbs index c6628ee64c5..15c0d9e4ee7 100644 --- a/src/main/resources/kotlin/src/main/kotlin/packagename/schemas/DecimalJsonSchema.hbs +++ b/src/main/resources/kotlin/src/main/kotlin/packagename/schemas/DecimalJsonSchema.hbs @@ -8,80 +8,71 @@ import {{{packageName}}}.schemas.validation.JsonSchemaInfo; import {{{packageName}}}.schemas.validation.PathToSchemasMap; import {{{packageName}}}.schemas.validation.StringSchemaValidator; import {{{packageName}}}.schemas.validation.ValidationMetadata; -import org.checkerframework.checker.nullness.qual.Nullable; -import java.util.HashSet; -import java.util.LinkedHashSet; -import java.util.List; -import java.util.Objects; -import java.util.Set; - -public class DecimalJsonSchema { - public sealed interface DecimalJsonSchema1Boxed permits DecimalJsonSchema1BoxedString { - @Nullable Object getData(); +class DecimalJsonSchema { + sealed interface DecimalJsonSchema1Boxed { + fun getData(): Any? } - public record DecimalJsonSchema1BoxedString(String data) implements DecimalJsonSchema1Boxed { - @Override - public @Nullable Object getData() { - return data; + + data class DecimalJsonSchema1BoxedString(val data: String) : DecimalJsonSchema1Boxed { + override fun getData(): String { + return data } } - public static class DecimalJsonSchema1 extends JsonSchema implements StringSchemaValidator { - private static @Nullable DecimalJsonSchema1 instance = null; - - protected DecimalJsonSchema1() { - super(new JsonSchemaInfo() - .type(Set.of(String.class)) - .format("number") - ); + class DecimalJsonSchema1 private constructor() : JsonSchema( + JsonSchemaInfo() + .type(setOf(String::class.java)) + .format("number") + ), StringSchemaValidator { + @Throws(ValidationException::class) + override fun validate(arg: String, configuration: SchemaConfiguration?): String { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg: String = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validationMetadata = + ValidationMetadata(pathToItem, usedConfiguration, PathToSchemasMap(), LinkedHashSet()) + val pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet) + return getNewInstance(castArg, validationMetadata.pathToItem, pathToSchemasMap) } - public static DecimalJsonSchema1 getInstance() { - if (instance == null) { - instance = new DecimalJsonSchema1(); + override fun getNewInstance(arg: Any?, pathToItem: List, pathToSchemas: PathToSchemasMap): Any? { + if (arg is String) { + return getNewInstance(arg as String?, pathToItem, pathToSchemas) } - return instance; + throw RuntimeException("Invalid input type=$javaClass. It can't be instantiated by this schema") } - @Override - public String validate(String arg, SchemaConfiguration configuration) throws ValidationException { - Set> pathSet = new HashSet<>(); - List pathToItem = List.of("args[0"); - String castArg = castToAllowedTypes(arg, pathToItem, pathSet); - SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().build())); - ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, new PathToSchemasMap(), new LinkedHashSet<>()); - PathToSchemasMap pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet); - return getNewInstance(castArg, validationMetadata.pathToItem(), pathToSchemasMap); + @Throws(ValidationException::class) + override fun validate(arg: Any?, configuration: SchemaConfiguration?): String { + if (arg is String) { + return validate(arg, configuration) + } + throw ValidationException("Invalid input type=$javaClass. It can't be validated by this schema") } - @Override - public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { - 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"); + @Throws(ValidationException::class) + override fun validateAndBox(arg: String, configuration: SchemaConfiguration?): DecimalJsonSchema1BoxedString { + return DecimalJsonSchema1BoxedString(validate(arg, configuration)) } - @Override - public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { - if (arg instanceof String) { - return validate((String) arg, configuration); + @Throws(ValidationException::class) + override fun validateAndBox(arg: Any?, configuration: SchemaConfiguration?): DecimalJsonSchema1Boxed { + if (arg is String) { + return validateAndBox(arg, configuration) } - throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw ValidationException("Invalid input type=$javaClass. It can't be validated by this schema") } - @Override - public DecimalJsonSchema1BoxedString validateAndBox(String arg, SchemaConfiguration configuration) throws ValidationException { - return new DecimalJsonSchema1BoxedString(validate(arg, configuration)); - } + companion object { + @Volatile + private var instance: DecimalJsonSchema1? = null - @Override - public DecimalJsonSchema1Boxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { - 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"); + fun getInstance() = + instance ?: synchronized(this) { + instance ?: DecimalJsonSchema1().also { instance = it } + } } } } \ No newline at end of file From bd787ab405f84a3022cdf2dfc1d1527859ca8b79 Mon Sep 17 00:00:00 2001 From: Justin Black Date: Thu, 9 May 2024 10:12:55 -0700 Subject: [PATCH 51/78] Adds DoubleJsonSchema --- .../client/schemas/DoubleJsonSchema.kt | 128 ++++++++---------- .../packagename/schemas/DoubleJsonSchema.hbs | 119 +++++++--------- 2 files changed, 111 insertions(+), 136 deletions(-) diff --git a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/schemas/DoubleJsonSchema.kt b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/schemas/DoubleJsonSchema.kt index c45d985d95d..28603219fff 100644 --- a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/schemas/DoubleJsonSchema.kt +++ b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/schemas/DoubleJsonSchema.kt @@ -1,91 +1,83 @@ -package org.openapijsonschematools.client.schemas; +package org.openapijsonschematools.client.schemas -import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags; -import org.openapijsonschematools.client.configurations.SchemaConfiguration; -import org.openapijsonschematools.client.exceptions.ValidationException; -import org.openapijsonschematools.client.schemas.validation.JsonSchema; -import org.openapijsonschematools.client.schemas.validation.JsonSchemaInfo; -import org.openapijsonschematools.client.schemas.validation.PathToSchemasMap; -import org.openapijsonschematools.client.schemas.validation.NumberSchemaValidator; -import org.openapijsonschematools.client.schemas.validation.ValidationMetadata; -import org.checkerframework.checker.nullness.qual.Nullable; +import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags +import org.openapijsonschematools.client.configurations.SchemaConfiguration +import org.openapijsonschematools.client.exceptions.ValidationException +import org.openapijsonschematools.client.schemas.validation.JsonSchema +import org.openapijsonschematools.client.schemas.validation.JsonSchemaInfo +import org.openapijsonschematools.client.schemas.validation.NumberSchemaValidator +import org.openapijsonschematools.client.schemas.validation.PathToSchemasMap +import org.openapijsonschematools.client.schemas.validation.ValidationMetadata -import java.util.HashSet; -import java.util.LinkedHashSet; -import java.util.List; -import java.util.Objects; -import java.util.Set; - -public class DoubleJsonSchema { - public sealed interface DoubleJsonSchema1Boxed permits DoubleJsonSchema1BoxedNumber { - @Nullable Object getData(); +class DoubleJsonSchema { + sealed interface DoubleJsonSchema1Boxed { + fun getData(): Any? } - public record DoubleJsonSchema1BoxedNumber(Number data) implements DoubleJsonSchema1Boxed { - @Override - public @Nullable Object getData() { - return data; + + data class DoubleJsonSchema1BoxedNumber(val data: Number) : DoubleJsonSchema1Boxed { + override fun getData(): Number { + return data } } - public static class DoubleJsonSchema1 extends JsonSchema implements NumberSchemaValidator { - private static @Nullable DoubleJsonSchema1 instance = null; - - protected DoubleJsonSchema1() { - super(new JsonSchemaInfo() - .type(Set.of(Double.class)) - .format("double") - ); + class DoubleJsonSchema1 private constructor() : JsonSchema( + JsonSchemaInfo() + .type(setOf(Double::class.java)) + .format("double") + ), NumberSchemaValidator { + @Throws(ValidationException::class) + override fun validate(arg: Number, configuration: SchemaConfiguration?): Number { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg: Number = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validationMetadata = + ValidationMetadata(pathToItem, usedConfiguration, PathToSchemasMap(), LinkedHashSet()) + val pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet) + return getNewInstance(castArg, validationMetadata.pathToItem, pathToSchemasMap) } - public static DoubleJsonSchema1 getInstance() { - if (instance == null) { - instance = new DoubleJsonSchema1(); - } - return instance; + @Throws(ValidationException::class) + fun validate(arg: Double, configuration: SchemaConfiguration?): Double { + return validate(arg as Number, configuration) as Double } - @Override - public Number validate(Number arg, SchemaConfiguration configuration) throws ValidationException { - Set> pathSet = new HashSet<>(); - List pathToItem = List.of("args[0"); - Number castArg = castToAllowedTypes(arg, pathToItem, pathSet); - SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().build())); - ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, new PathToSchemasMap(), new LinkedHashSet<>()); - PathToSchemasMap pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet); - return getNewInstance(castArg, validationMetadata.pathToItem(), pathToSchemasMap); + override fun getNewInstance(arg: Any?, pathToItem: List, pathToSchemas: PathToSchemasMap): Any? { + if (arg is Number) { + return getNewInstance(arg as Number?, pathToItem, pathToSchemas) + } + throw RuntimeException("Invalid input type=$javaClass. It can't be instantiated by this schema") } - public double validate(double arg, SchemaConfiguration configuration) throws ValidationException { - return (double) validate((Number) arg, configuration); + @Throws(ValidationException::class) + override fun validate(arg: Any?, configuration: SchemaConfiguration?): Number { + if (arg is Number) { + return validate(arg, configuration) + } + throw ValidationException("Invalid input type=$javaClass. It can't be validated by this schema") } - @Override - public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { - 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"); + @Throws(ValidationException::class) + override fun validateAndBox(arg: Number, configuration: SchemaConfiguration?): DoubleJsonSchema1BoxedNumber { + return DoubleJsonSchema1BoxedNumber(validate(arg, configuration)) } - @Override - public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { - if (arg instanceof Number) { - return validate((Number) arg, configuration); + @Throws(ValidationException::class) + override fun validateAndBox(arg: Any?, configuration: SchemaConfiguration?): DoubleJsonSchema1Boxed { + if (arg is Number) { + return validateAndBox(arg, configuration) } - throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw ValidationException("Invalid input type=$javaClass. It can't be validated by this schema") } - @Override - public DoubleJsonSchema1BoxedNumber validateAndBox(Number arg, SchemaConfiguration configuration) throws ValidationException { - return new DoubleJsonSchema1BoxedNumber(validate(arg, configuration)); - } + companion object { + @Volatile + private var instance: DoubleJsonSchema1? = null - @Override - public DoubleJsonSchema1Boxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { - 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"); + fun getInstance() = + instance ?: synchronized(this) { + instance ?: DoubleJsonSchema1().also { instance = it } + } } } } \ No newline at end of file diff --git a/src/main/resources/kotlin/src/main/kotlin/packagename/schemas/DoubleJsonSchema.hbs b/src/main/resources/kotlin/src/main/kotlin/packagename/schemas/DoubleJsonSchema.hbs index bc9a5f71a19..274087de6e0 100644 --- a/src/main/resources/kotlin/src/main/kotlin/packagename/schemas/DoubleJsonSchema.hbs +++ b/src/main/resources/kotlin/src/main/kotlin/packagename/schemas/DoubleJsonSchema.hbs @@ -8,93 +8,76 @@ import {{{packageName}}}.schemas.validation.JsonSchemaInfo; import {{{packageName}}}.schemas.validation.PathToSchemasMap; import {{{packageName}}}.schemas.validation.NumberSchemaValidator; import {{{packageName}}}.schemas.validation.ValidationMetadata; -import org.checkerframework.checker.nullness.qual.Nullable; -import java.util.HashSet; -import java.util.LinkedHashSet; -import java.util.List; -import java.util.Objects; -import java.util.Set; - -public class DoubleJsonSchema { - public sealed interface DoubleJsonSchema1Boxed permits DoubleJsonSchema1BoxedNumber { - @Nullable Object getData(); +class DoubleJsonSchema { + sealed interface DoubleJsonSchema1Boxed { + fun getData(): Any? } - public record DoubleJsonSchema1BoxedNumber(Number data) implements DoubleJsonSchema1Boxed { - @Override - public @Nullable Object getData() { - return data; + + data class DoubleJsonSchema1BoxedNumber(val data: Number) : DoubleJsonSchema1Boxed { + override fun getData(): Number { + return data } } - public static class DoubleJsonSchema1 extends JsonSchema implements NumberSchemaValidator { - private static @Nullable DoubleJsonSchema1 instance = null; - - protected DoubleJsonSchema1() { - super(new JsonSchemaInfo() - {{#if generatorSettings.intsAllowedForFloatDoubleFormats}} - .type(Set.of( - Integer.class, - Long.class, - Float.class, - Double.class - )) - {{else}} - .type(Set.of(Double.class)) - {{/if}} - .format("double") - ); + class DoubleJsonSchema1 private constructor() : JsonSchema( + JsonSchemaInfo() + .type(setOf(Double::class.java)) + .format("double") + ), NumberSchemaValidator { + @Throws(ValidationException::class) + override fun validate(arg: Number, configuration: SchemaConfiguration?): Number { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg: Number = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validationMetadata = + ValidationMetadata(pathToItem, usedConfiguration, PathToSchemasMap(), LinkedHashSet()) + val pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet) + return getNewInstance(castArg, validationMetadata.pathToItem, pathToSchemasMap) } - public static DoubleJsonSchema1 getInstance() { - if (instance == null) { - instance = new DoubleJsonSchema1(); - } - return instance; + @Throws(ValidationException::class) + fun validate(arg: Double, configuration: SchemaConfiguration?): Double { + return validate(arg as Number, configuration) as Double } - @Override - public Number validate(Number arg, SchemaConfiguration configuration) throws ValidationException { - Set> pathSet = new HashSet<>(); - List pathToItem = List.of("args[0"); - Number castArg = castToAllowedTypes(arg, pathToItem, pathSet); - SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().build())); - ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, new PathToSchemasMap(), new LinkedHashSet<>()); - PathToSchemasMap pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet); - return getNewInstance(castArg, validationMetadata.pathToItem(), pathToSchemasMap); + override fun getNewInstance(arg: Any?, pathToItem: List, pathToSchemas: PathToSchemasMap): Any? { + if (arg is Number) { + return getNewInstance(arg as Number?, pathToItem, pathToSchemas) + } + throw RuntimeException("Invalid input type=$javaClass. It can't be instantiated by this schema") } - public double validate(double arg, SchemaConfiguration configuration) throws ValidationException { - return (double) validate((Number) arg, configuration); + @Throws(ValidationException::class) + override fun validate(arg: Any?, configuration: SchemaConfiguration?): Number { + if (arg is Number) { + return validate(arg, configuration) + } + throw ValidationException("Invalid input type=$javaClass. It can't be validated by this schema") } - @Override - public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { - 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"); + @Throws(ValidationException::class) + override fun validateAndBox(arg: Number, configuration: SchemaConfiguration?): DoubleJsonSchema1BoxedNumber { + return DoubleJsonSchema1BoxedNumber(validate(arg, configuration)) } - @Override - public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { - if (arg instanceof Number) { - return validate((Number) arg, configuration); + @Throws(ValidationException::class) + override fun validateAndBox(arg: Any?, configuration: SchemaConfiguration?): DoubleJsonSchema1Boxed { + if (arg is Number) { + return validateAndBox(arg, configuration) } - throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw ValidationException("Invalid input type=$javaClass. It can't be validated by this schema") } - @Override - public DoubleJsonSchema1BoxedNumber validateAndBox(Number arg, SchemaConfiguration configuration) throws ValidationException { - return new DoubleJsonSchema1BoxedNumber(validate(arg, configuration)); - } + companion object { + @Volatile + private var instance: DoubleJsonSchema1? = null - @Override - public DoubleJsonSchema1Boxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { - 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"); + fun getInstance() = + instance ?: synchronized(this) { + instance ?: DoubleJsonSchema1().also { instance = it } + } } } } \ No newline at end of file From c4abd5e0bd24b3b171cb10c1009f82609e34f841 Mon Sep 17 00:00:00 2001 From: Justin Black Date: Thu, 9 May 2024 10:22:56 -0700 Subject: [PATCH 52/78] Updates FloatJsonSchema --- .../client/schemas/FloatJsonSchema.kt | 128 ++++++++---------- .../packagename/schemas/FloatJsonSchema.hbs | 119 +++++++--------- 2 files changed, 112 insertions(+), 135 deletions(-) diff --git a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/schemas/FloatJsonSchema.kt b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/schemas/FloatJsonSchema.kt index 06a918eecb0..4c5e59a6753 100644 --- a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/schemas/FloatJsonSchema.kt +++ b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/schemas/FloatJsonSchema.kt @@ -1,91 +1,83 @@ -package org.openapijsonschematools.client.schemas; +package org.openapijsonschematools.client.schemas -import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags; -import org.openapijsonschematools.client.configurations.SchemaConfiguration; -import org.openapijsonschematools.client.exceptions.ValidationException; -import org.openapijsonschematools.client.schemas.validation.JsonSchema; -import org.openapijsonschematools.client.schemas.validation.JsonSchemaInfo; -import org.openapijsonschematools.client.schemas.validation.PathToSchemasMap; -import org.openapijsonschematools.client.schemas.validation.NumberSchemaValidator; -import org.openapijsonschematools.client.schemas.validation.ValidationMetadata; -import org.checkerframework.checker.nullness.qual.Nullable; +import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags +import org.openapijsonschematools.client.configurations.SchemaConfiguration +import org.openapijsonschematools.client.exceptions.ValidationException +import org.openapijsonschematools.client.schemas.validation.JsonSchema +import org.openapijsonschematools.client.schemas.validation.JsonSchemaInfo +import org.openapijsonschematools.client.schemas.validation.NumberSchemaValidator +import org.openapijsonschematools.client.schemas.validation.PathToSchemasMap +import org.openapijsonschematools.client.schemas.validation.ValidationMetadata -import java.util.HashSet; -import java.util.LinkedHashSet; -import java.util.List; -import java.util.Objects; -import java.util.Set; - -public class FloatJsonSchema { - public sealed interface FloatJsonSchema1Boxed permits FloatJsonSchema1BoxedNumber { - @Nullable Object getData(); +class FloatJsonSchema { + sealed interface FloatJsonSchema1Boxed { + fun getData(): Any? } - public record FloatJsonSchema1BoxedNumber(Number data) implements FloatJsonSchema1Boxed { - @Override - public @Nullable Object getData() { - return data; + + data class FloatJsonSchema1BoxedNumber(val data: Number) : FloatJsonSchema1Boxed { + override fun getData(): Number { + return data } } - public static class FloatJsonSchema1 extends JsonSchema implements NumberSchemaValidator { - private static @Nullable FloatJsonSchema1 instance = null; - - protected FloatJsonSchema1() { - super(new JsonSchemaInfo() - .type(Set.of(Float.class)) - .format("float") - ); + class FloatJsonSchema1 private constructor() : JsonSchema( + JsonSchemaInfo() + .type(setOf(Float::class.java)) + .format("float") + ), NumberSchemaValidator { + @Throws(ValidationException::class) + override fun validate(arg: Number, configuration: SchemaConfiguration?): Number { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg: Number = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validationMetadata = + ValidationMetadata(pathToItem, usedConfiguration, PathToSchemasMap(), LinkedHashSet()) + val pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet) + return getNewInstance(castArg, validationMetadata.pathToItem, pathToSchemasMap) } - public static FloatJsonSchema1 getInstance() { - if (instance == null) { - instance = new FloatJsonSchema1(); - } - return instance; + @Throws(ValidationException::class) + fun validate(arg: Float, configuration: SchemaConfiguration?): Float { + return validate(arg as Number, configuration) as Float } - @Override - public Number validate(Number arg, SchemaConfiguration configuration) throws ValidationException { - Set> pathSet = new HashSet<>(); - List pathToItem = List.of("args[0"); - Number castArg = castToAllowedTypes(arg, pathToItem, pathSet); - SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().build())); - ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, new PathToSchemasMap(), new LinkedHashSet<>()); - PathToSchemasMap pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet); - return getNewInstance(castArg, validationMetadata.pathToItem(), pathToSchemasMap); + override fun getNewInstance(arg: Any?, pathToItem: List, pathToSchemas: PathToSchemasMap): Any? { + if (arg is Number) { + return getNewInstance(arg as Number?, pathToItem, pathToSchemas) + } + throw RuntimeException("Invalid input type=$javaClass. It can't be instantiated by this schema") } - public float validate(float arg, SchemaConfiguration configuration) throws ValidationException { - return (float) validate((Number) arg, configuration); + @Throws(ValidationException::class) + override fun validate(arg: Any?, configuration: SchemaConfiguration?): Number { + if (arg is Number) { + return validate(arg, configuration) + } + throw ValidationException("Invalid input type=$javaClass. It can't be validated by this schema") } - @Override - public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { - 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"); + @Throws(ValidationException::class) + override fun validateAndBox(arg: Number, configuration: SchemaConfiguration?): FloatJsonSchema1BoxedNumber { + return FloatJsonSchema1BoxedNumber(validate(arg, configuration)) } - @Override - public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { - if (arg instanceof Number) { - return validate((Number) arg, configuration); + @Throws(ValidationException::class) + override fun validateAndBox(arg: Any?, configuration: SchemaConfiguration?): FloatJsonSchema1Boxed { + if (arg is Number) { + return validateAndBox(arg, configuration) } - throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw ValidationException("Invalid input type=$javaClass. It can't be validated by this schema") } - @Override - public FloatJsonSchema1BoxedNumber validateAndBox(Number arg, SchemaConfiguration configuration) throws ValidationException { - return new FloatJsonSchema1BoxedNumber(validate(arg, configuration)); - } + companion object { + @Volatile + private var instance: FloatJsonSchema1? = null - @Override - public FloatJsonSchema1Boxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { - 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"); + fun getInstance() = + instance ?: synchronized(this) { + instance ?: FloatJsonSchema1().also { instance = it } + } } } } diff --git a/src/main/resources/kotlin/src/main/kotlin/packagename/schemas/FloatJsonSchema.hbs b/src/main/resources/kotlin/src/main/kotlin/packagename/schemas/FloatJsonSchema.hbs index 40c08d7866d..cdf00fc70cb 100644 --- a/src/main/resources/kotlin/src/main/kotlin/packagename/schemas/FloatJsonSchema.hbs +++ b/src/main/resources/kotlin/src/main/kotlin/packagename/schemas/FloatJsonSchema.hbs @@ -8,91 +8,76 @@ import {{{packageName}}}.schemas.validation.JsonSchemaInfo; import {{{packageName}}}.schemas.validation.PathToSchemasMap; import {{{packageName}}}.schemas.validation.NumberSchemaValidator; import {{{packageName}}}.schemas.validation.ValidationMetadata; -import org.checkerframework.checker.nullness.qual.Nullable; -import java.util.HashSet; -import java.util.LinkedHashSet; -import java.util.List; -import java.util.Objects; -import java.util.Set; - -public class FloatJsonSchema { - public sealed interface FloatJsonSchema1Boxed permits FloatJsonSchema1BoxedNumber { - @Nullable Object getData(); +class FloatJsonSchema { + sealed interface FloatJsonSchema1Boxed { + fun getData(): Any? } - public record FloatJsonSchema1BoxedNumber(Number data) implements FloatJsonSchema1Boxed { - @Override - public @Nullable Object getData() { - return data; + + data class FloatJsonSchema1BoxedNumber(val data: Number) : FloatJsonSchema1Boxed { + override fun getData(): Number { + return data } } - public static class FloatJsonSchema1 extends JsonSchema implements NumberSchemaValidator { - private static @Nullable FloatJsonSchema1 instance = null; - - protected FloatJsonSchema1() { - super(new JsonSchemaInfo() - {{#if generatorSettings.intsAllowedForFloatDoubleFormats}} - .type(Set.of( - Integer.class, - Float.class - )) - {{else}} - .type(Set.of(Float.class)) - {{/if}} - .format("float") - ); + class FloatJsonSchema1 private constructor() : JsonSchema( + JsonSchemaInfo() + .type(setOf(Float::class.java)) + .format("float") + ), NumberSchemaValidator { + @Throws(ValidationException::class) + override fun validate(arg: Number, configuration: SchemaConfiguration?): Number { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg: Number = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validationMetadata = + ValidationMetadata(pathToItem, usedConfiguration, PathToSchemasMap(), LinkedHashSet()) + val pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet) + return getNewInstance(castArg, validationMetadata.pathToItem, pathToSchemasMap) } - public static FloatJsonSchema1 getInstance() { - if (instance == null) { - instance = new FloatJsonSchema1(); - } - return instance; + @Throws(ValidationException::class) + fun validate(arg: Float, configuration: SchemaConfiguration?): Float { + return validate(arg as Number, configuration) as Float } - @Override - public Number validate(Number arg, SchemaConfiguration configuration) throws ValidationException { - Set> pathSet = new HashSet<>(); - List pathToItem = List.of("args[0"); - Number castArg = castToAllowedTypes(arg, pathToItem, pathSet); - SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().build())); - ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, new PathToSchemasMap(), new LinkedHashSet<>()); - PathToSchemasMap pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet); - return getNewInstance(castArg, validationMetadata.pathToItem(), pathToSchemasMap); + override fun getNewInstance(arg: Any?, pathToItem: List, pathToSchemas: PathToSchemasMap): Any? { + if (arg is Number) { + return getNewInstance(arg as Number?, pathToItem, pathToSchemas) + } + throw RuntimeException("Invalid input type=$javaClass. It can't be instantiated by this schema") } - public float validate(float arg, SchemaConfiguration configuration) throws ValidationException { - return (float) validate((Number) arg, configuration); + @Throws(ValidationException::class) + override fun validate(arg: Any?, configuration: SchemaConfiguration?): Number { + if (arg is Number) { + return validate(arg, configuration) + } + throw ValidationException("Invalid input type=$javaClass. It can't be validated by this schema") } - @Override - public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { - 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"); + @Throws(ValidationException::class) + override fun validateAndBox(arg: Number, configuration: SchemaConfiguration?): FloatJsonSchema1BoxedNumber { + return FloatJsonSchema1BoxedNumber(validate(arg, configuration)) } - @Override - public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { - if (arg instanceof Number) { - return validate((Number) arg, configuration); + @Throws(ValidationException::class) + override fun validateAndBox(arg: Any?, configuration: SchemaConfiguration?): FloatJsonSchema1Boxed { + if (arg is Number) { + return validateAndBox(arg, configuration) } - throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw ValidationException("Invalid input type=$javaClass. It can't be validated by this schema") } - @Override - public FloatJsonSchema1BoxedNumber validateAndBox(Number arg, SchemaConfiguration configuration) throws ValidationException { - return new FloatJsonSchema1BoxedNumber(validate(arg, configuration)); - } + companion object { + @Volatile + private var instance: FloatJsonSchema1? = null - @Override - public FloatJsonSchema1Boxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { - 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"); + fun getInstance() = + instance ?: synchronized(this) { + instance ?: FloatJsonSchema1().also { instance = it } + } } } -} +} \ No newline at end of file From 2ef5e389a5f634fddafbe535735afbbf69c60a09 Mon Sep 17 00:00:00 2001 From: Justin Black Date: Thu, 9 May 2024 10:24:13 -0700 Subject: [PATCH 53/78] Updates GenericBuilder --- .../client/schemas/GenericBuilder.kt | 8 ++++---- .../main/kotlin/packagename/schemas/GenericBuilder.hbs | 8 ++++---- 2 files changed, 8 insertions(+), 8 deletions(-) diff --git a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/schemas/GenericBuilder.kt b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/schemas/GenericBuilder.kt index b33d2e56600..433966f49bf 100644 --- a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/schemas/GenericBuilder.kt +++ b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/schemas/GenericBuilder.kt @@ -1,9 +1,9 @@ -package org.openapijsonschematools.client.schemas; +package org.openapijsonschematools.client.schemas /** * Builders must implement this class * @param the type that the builder returns - */ -public interface GenericBuilder { - T build(); + */ +interface GenericBuilder { + fun build(): T } diff --git a/src/main/resources/kotlin/src/main/kotlin/packagename/schemas/GenericBuilder.hbs b/src/main/resources/kotlin/src/main/kotlin/packagename/schemas/GenericBuilder.hbs index c456cd38958..7086941dfc0 100644 --- a/src/main/resources/kotlin/src/main/kotlin/packagename/schemas/GenericBuilder.hbs +++ b/src/main/resources/kotlin/src/main/kotlin/packagename/schemas/GenericBuilder.hbs @@ -3,7 +3,7 @@ package {{{packageName}}}.schemas; /** * Builders must implement this class * @param the type that the builder returns - */ -public interface GenericBuilder { - T build(); -} + */ +interface GenericBuilder { + fun build(): T +} \ No newline at end of file From f331bf8ab224ed666bcf44dcb20885d63325abf4 Mon Sep 17 00:00:00 2001 From: Justin Black Date: Thu, 9 May 2024 10:33:20 -0700 Subject: [PATCH 54/78] Uses intsAllowedForFloatDoubleFormats in Float/Double schemas --- .../main/kotlin/packagename/schemas/DoubleJsonSchema.hbs | 9 +++++++++ .../main/kotlin/packagename/schemas/FloatJsonSchema.hbs | 7 +++++++ 2 files changed, 16 insertions(+) diff --git a/src/main/resources/kotlin/src/main/kotlin/packagename/schemas/DoubleJsonSchema.hbs b/src/main/resources/kotlin/src/main/kotlin/packagename/schemas/DoubleJsonSchema.hbs index 274087de6e0..735177b6c6b 100644 --- a/src/main/resources/kotlin/src/main/kotlin/packagename/schemas/DoubleJsonSchema.hbs +++ b/src/main/resources/kotlin/src/main/kotlin/packagename/schemas/DoubleJsonSchema.hbs @@ -22,7 +22,16 @@ class DoubleJsonSchema { class DoubleJsonSchema1 private constructor() : JsonSchema( JsonSchemaInfo() + {{#if generatorSettings.intsAllowedForFloatDoubleFormats}} + .type(setOf( + Integer::class.java, + Long::class.java, + Float::class.java, + Double::class.java + )) + {{else}} .type(setOf(Double::class.java)) + {{/if}} .format("double") ), NumberSchemaValidator { @Throws(ValidationException::class) diff --git a/src/main/resources/kotlin/src/main/kotlin/packagename/schemas/FloatJsonSchema.hbs b/src/main/resources/kotlin/src/main/kotlin/packagename/schemas/FloatJsonSchema.hbs index cdf00fc70cb..c8afaeb5684 100644 --- a/src/main/resources/kotlin/src/main/kotlin/packagename/schemas/FloatJsonSchema.hbs +++ b/src/main/resources/kotlin/src/main/kotlin/packagename/schemas/FloatJsonSchema.hbs @@ -22,7 +22,14 @@ class FloatJsonSchema { class FloatJsonSchema1 private constructor() : JsonSchema( JsonSchemaInfo() + {{#if generatorSettings.intsAllowedForFloatDoubleFormats}} + .type(setOf( + Integer::class.java, + Float::class.java + )) + {{else}} .type(setOf(Float::class.java)) + {{/if}} .format("float") ), NumberSchemaValidator { @Throws(ValidationException::class) From 3be6a1e4f730048e3cc723cac33b3e9a2f7dd0fb Mon Sep 17 00:00:00 2001 From: Justin Black Date: Thu, 9 May 2024 10:38:06 -0700 Subject: [PATCH 55/78] Updates Int32JsonSchema --- .../client/schemas/Int32JsonSchema.kt | 141 +++++++++--------- .../packagename/schemas/Int32JsonSchema.hbs | 123 ++++++++------- 2 files changed, 127 insertions(+), 137 deletions(-) diff --git a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/schemas/Int32JsonSchema.kt b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/schemas/Int32JsonSchema.kt index b31b7688b58..3f7786bda2b 100644 --- a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/schemas/Int32JsonSchema.kt +++ b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/schemas/Int32JsonSchema.kt @@ -1,98 +1,93 @@ -package org.openapijsonschematools.client.schemas; +package org.openapijsonschematools.client.schemas -import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags; -import org.openapijsonschematools.client.exceptions.ValidationException; -import org.openapijsonschematools.client.schemas.validation.JsonSchema; -import org.openapijsonschematools.client.schemas.validation.JsonSchemaInfo; -import org.openapijsonschematools.client.configurations.SchemaConfiguration; -import org.openapijsonschematools.client.schemas.validation.PathToSchemasMap; -import org.openapijsonschematools.client.schemas.validation.NumberSchemaValidator; -import org.openapijsonschematools.client.schemas.validation.ValidationMetadata; -import org.checkerframework.checker.nullness.qual.Nullable; +import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags +import org.openapijsonschematools.client.configurations.SchemaConfiguration +import org.openapijsonschematools.client.exceptions.ValidationException +import org.openapijsonschematools.client.schemas.validation.JsonSchema +import org.openapijsonschematools.client.schemas.validation.JsonSchemaInfo +import org.openapijsonschematools.client.schemas.validation.NumberSchemaValidator +import org.openapijsonschematools.client.schemas.validation.PathToSchemasMap +import org.openapijsonschematools.client.schemas.validation.ValidationMetadata -import java.util.HashSet; -import java.util.LinkedHashSet; -import java.util.List; -import java.util.Objects; -import java.util.Set; - -public class Int32JsonSchema { - public sealed interface Int32JsonSchema1Boxed permits Int32JsonSchema1BoxedNumber { - @Nullable Object getData(); +class Int32JsonSchema { + sealed interface Int32JsonSchema1Boxed { + fun getData(): Any? } - public record Int32JsonSchema1BoxedNumber(Number data) implements Int32JsonSchema1Boxed { - @Override - public @Nullable Object getData() { - return data; + + data class Int32JsonSchema1BoxedNumber(val data: Number) : Int32JsonSchema1Boxed { + override fun getData(): Number { + return data } } - public static class Int32JsonSchema1 extends JsonSchema implements NumberSchemaValidator { - private static @Nullable Int32JsonSchema1 instance = null; - - protected Int32JsonSchema1() { - super(new JsonSchemaInfo() - .type(Set.of( - Integer.class, - Float.class - )) - .format("int32") - ); + class Int32JsonSchema1 private constructor() : JsonSchema( + JsonSchemaInfo() + .type( + setOf( + Int::class.java, + Float::class.java + ) + ) + .format("int32") + ), NumberSchemaValidator { + @Throws(ValidationException::class) + override fun validate(arg: Number, configuration: SchemaConfiguration?): Number { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg: Number = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validationMetadata = + ValidationMetadata(pathToItem, usedConfiguration, PathToSchemasMap(), LinkedHashSet()) + val pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet) + return getNewInstance(castArg, validationMetadata.pathToItem, pathToSchemasMap) } - public static Int32JsonSchema1 getInstance() { - if (instance == null) { - instance = new Int32JsonSchema1(); - } - return instance; + @Throws(ValidationException::class) + fun validate(arg: Int, configuration: SchemaConfiguration?): Int { + return validate(arg as Number, configuration) as Int } - @Override - public Number validate(Number arg, SchemaConfiguration configuration) throws ValidationException { - Set> pathSet = new HashSet<>(); - List pathToItem = List.of("args[0"); - Number castArg = castToAllowedTypes(arg, pathToItem, pathSet); - SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().build())); - ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, new PathToSchemasMap(), new LinkedHashSet<>()); - PathToSchemasMap pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet); - return getNewInstance(castArg, validationMetadata.pathToItem(), pathToSchemasMap); + @Throws(ValidationException::class) + fun validate(arg: Float, configuration: SchemaConfiguration?): Float { + return validate(arg as Number, configuration) as Float } - public int validate(int arg, SchemaConfiguration configuration) throws ValidationException { - return (int) validate((Number) arg, configuration); + override fun getNewInstance(arg: Any?, pathToItem: List, pathToSchemas: PathToSchemasMap): Any? { + if (arg is Number) { + return getNewInstance(arg as Number?, pathToItem, pathToSchemas) + } + throw RuntimeException("Invalid input type=$javaClass. It can't be instantiated by this schema") } - public float validate(float arg, SchemaConfiguration configuration) throws ValidationException { - return (float) validate((Number) arg, configuration); + @Throws(ValidationException::class) + override fun validate(arg: Any?, configuration: SchemaConfiguration?): Number { + if (arg is Number) { + return validate(arg, configuration) + } + throw ValidationException("Invalid input type=$javaClass. It can't be validated by this schema") } - @Override - public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { - 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"); + @Throws(ValidationException::class) + override fun validateAndBox(arg: Number, configuration: SchemaConfiguration?): Int32JsonSchema1BoxedNumber { + return Int32JsonSchema1BoxedNumber(validate(arg, configuration)) } - @Override - public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { - if (arg instanceof Number) { - return validate((Number) arg, configuration); + @Throws(ValidationException::class) + override fun validateAndBox(arg: Any?, configuration: SchemaConfiguration?): Int32JsonSchema1Boxed { + if (arg is Number) { + return validateAndBox(arg, configuration) } - throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw ValidationException("Invalid input type=$javaClass. It can't be validated by this schema") } - @Override - public Int32JsonSchema1BoxedNumber validateAndBox(Number arg, SchemaConfiguration configuration) throws ValidationException { - return new Int32JsonSchema1BoxedNumber(validate(arg, configuration)); - } + companion object { + @Volatile + private var instance: Int32JsonSchema1? = null - @Override - public Int32JsonSchema1Boxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { - 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"); + fun getInstance() = + instance ?: synchronized(this) { + instance ?: Int32JsonSchema1().also { instance = it } + } } } } \ No newline at end of file diff --git a/src/main/resources/kotlin/src/main/kotlin/packagename/schemas/Int32JsonSchema.hbs b/src/main/resources/kotlin/src/main/kotlin/packagename/schemas/Int32JsonSchema.hbs index 8e5990d2b9a..fcdf3b0d9e5 100644 --- a/src/main/resources/kotlin/src/main/kotlin/packagename/schemas/Int32JsonSchema.hbs +++ b/src/main/resources/kotlin/src/main/kotlin/packagename/schemas/Int32JsonSchema.hbs @@ -8,91 +8,86 @@ import {{{packageName}}}.configurations.SchemaConfiguration; import {{{packageName}}}.schemas.validation.PathToSchemasMap; import {{{packageName}}}.schemas.validation.NumberSchemaValidator; import {{{packageName}}}.schemas.validation.ValidationMetadata; -import org.checkerframework.checker.nullness.qual.Nullable; -import java.util.HashSet; -import java.util.LinkedHashSet; -import java.util.List; -import java.util.Objects; -import java.util.Set; - -public class Int32JsonSchema { - public sealed interface Int32JsonSchema1Boxed permits Int32JsonSchema1BoxedNumber { - @Nullable Object getData(); +class Int32JsonSchema { + sealed interface Int32JsonSchema1Boxed { + fun getData(): Any? } - public record Int32JsonSchema1BoxedNumber(Number data) implements Int32JsonSchema1Boxed { - @Override - public @Nullable Object getData() { - return data; + + data class Int32JsonSchema1BoxedNumber(val data: Number) : Int32JsonSchema1Boxed { + override fun getData(): Number { + return data } } - public static class Int32JsonSchema1 extends JsonSchema implements NumberSchemaValidator { - private static @Nullable Int32JsonSchema1 instance = null; - - protected Int32JsonSchema1() { - super(new JsonSchemaInfo() - .type(Set.of( - Integer.class, - Float.class - )) - .format("int32") - ); + class Int32JsonSchema1 private constructor() : JsonSchema( + JsonSchemaInfo() + .type( + setOf( + Int::class.java, + Float::class.java + ) + ) + .format("int32") + ), NumberSchemaValidator { + @Throws(ValidationException::class) + override fun validate(arg: Number, configuration: SchemaConfiguration?): Number { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg: Number = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validationMetadata = + ValidationMetadata(pathToItem, usedConfiguration, PathToSchemasMap(), LinkedHashSet()) + val pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet) + return getNewInstance(castArg, validationMetadata.pathToItem, pathToSchemasMap) } - public static Int32JsonSchema1 getInstance() { - if (instance == null) { - instance = new Int32JsonSchema1(); - } - return instance; + @Throws(ValidationException::class) + fun validate(arg: Int, configuration: SchemaConfiguration?): Int { + return validate(arg as Number, configuration) as Int } - @Override - public Number validate(Number arg, SchemaConfiguration configuration) throws ValidationException { - Set> pathSet = new HashSet<>(); - List pathToItem = List.of("args[0"); - Number castArg = castToAllowedTypes(arg, pathToItem, pathSet); - SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().build())); - ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, new PathToSchemasMap(), new LinkedHashSet<>()); - PathToSchemasMap pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet); - return getNewInstance(castArg, validationMetadata.pathToItem(), pathToSchemasMap); + @Throws(ValidationException::class) + fun validate(arg: Float, configuration: SchemaConfiguration?): Float { + return validate(arg as Number, configuration) as Float } - public int validate(int arg, SchemaConfiguration configuration) throws ValidationException { - return (int) validate((Number) arg, configuration); + override fun getNewInstance(arg: Any?, pathToItem: List, pathToSchemas: PathToSchemasMap): Any? { + if (arg is Number) { + return getNewInstance(arg as Number?, pathToItem, pathToSchemas) + } + throw RuntimeException("Invalid input type=$javaClass. It can't be instantiated by this schema") } - public float validate(float arg, SchemaConfiguration configuration) throws ValidationException { - return (float) validate((Number) arg, configuration); + @Throws(ValidationException::class) + override fun validate(arg: Any?, configuration: SchemaConfiguration?): Number { + if (arg is Number) { + return validate(arg, configuration) + } + throw ValidationException("Invalid input type=$javaClass. It can't be validated by this schema") } - @Override - public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { - 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"); + @Throws(ValidationException::class) + override fun validateAndBox(arg: Number, configuration: SchemaConfiguration?): Int32JsonSchema1BoxedNumber { + return Int32JsonSchema1BoxedNumber(validate(arg, configuration)) } - @Override - public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { - if (arg instanceof Number) { - return validate((Number) arg, configuration); + @Throws(ValidationException::class) + override fun validateAndBox(arg: Any?, configuration: SchemaConfiguration?): Int32JsonSchema1Boxed { + if (arg is Number) { + return validateAndBox(arg, configuration) } - throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw ValidationException("Invalid input type=$javaClass. It can't be validated by this schema") } - @Override - public Int32JsonSchema1BoxedNumber validateAndBox(Number arg, SchemaConfiguration configuration) throws ValidationException { - return new Int32JsonSchema1BoxedNumber(validate(arg, configuration)); - } + companion object { + @Volatile + private var instance: Int32JsonSchema1? = null - @Override - public Int32JsonSchema1Boxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { - 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"); + fun getInstance() = + instance ?: synchronized(this) { + instance ?: Int32JsonSchema1().also { instance = it } + } } } } \ No newline at end of file From b71e16370a32f815b23cf09888dc198da35e4eb0 Mon Sep 17 00:00:00 2001 From: Justin Black Date: Thu, 9 May 2024 10:43:55 -0700 Subject: [PATCH 56/78] Updates Int64JsonSchema --- .../client/schemas/Int64JsonSchema.kt | 155 +++++++++--------- .../packagename/schemas/Int64JsonSchema.hbs | 137 ++++++++-------- 2 files changed, 143 insertions(+), 149 deletions(-) diff --git a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/schemas/Int64JsonSchema.kt b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/schemas/Int64JsonSchema.kt index 4ea9603434e..92e893b1ab9 100644 --- a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/schemas/Int64JsonSchema.kt +++ b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/schemas/Int64JsonSchema.kt @@ -1,108 +1,105 @@ -package org.openapijsonschematools.client.schemas; +package org.openapijsonschematools.client.schemas -import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags; -import org.openapijsonschematools.client.exceptions.ValidationException; -import org.openapijsonschematools.client.schemas.validation.JsonSchema; -import org.openapijsonschematools.client.schemas.validation.JsonSchemaInfo; -import org.openapijsonschematools.client.configurations.SchemaConfiguration; -import org.openapijsonschematools.client.schemas.validation.PathToSchemasMap; -import org.openapijsonschematools.client.schemas.validation.NumberSchemaValidator; -import org.openapijsonschematools.client.schemas.validation.ValidationMetadata; -import org.checkerframework.checker.nullness.qual.Nullable; +import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags +import org.openapijsonschematools.client.configurations.SchemaConfiguration +import org.openapijsonschematools.client.exceptions.ValidationException +import org.openapijsonschematools.client.schemas.validation.JsonSchema +import org.openapijsonschematools.client.schemas.validation.JsonSchemaInfo +import org.openapijsonschematools.client.schemas.validation.NumberSchemaValidator +import org.openapijsonschematools.client.schemas.validation.PathToSchemasMap +import org.openapijsonschematools.client.schemas.validation.ValidationMetadata -import java.util.HashSet; -import java.util.LinkedHashSet; -import java.util.List; -import java.util.Objects; -import java.util.Set; - -public class Int64JsonSchema { - public sealed interface Int64JsonSchema1Boxed permits Int64JsonSchema1BoxedNumber { - @Nullable Object getData(); +class Int64JsonSchema { + sealed interface Int64JsonSchema1Boxed { + fun getData(): Any? } - public record Int64JsonSchema1BoxedNumber(Number data) implements Int64JsonSchema1Boxed { - @Override - public @Nullable Object getData() { - return data; + + data class Int64JsonSchema1BoxedNumber(val data: Number) : Int64JsonSchema1Boxed { + override fun getData(): Number { + return data } } - public static class Int64JsonSchema1 extends JsonSchema implements NumberSchemaValidator { - private static @Nullable Int64JsonSchema1 instance = null; - - protected Int64JsonSchema1() { - super(new JsonSchemaInfo() - .type(Set.of( - Integer.class, - Long.class, - Float.class, - Double.class - )) - .format("int64") - ); + class Int64JsonSchema1 private constructor() : JsonSchema( + JsonSchemaInfo() + .type( + setOf( + Int::class.java, + Long::class.java, + Float::class.java, + Double::class.java + ) + ) + .format("int64") + ), NumberSchemaValidator { + @Throws(ValidationException::class) + override fun validate(arg: Number, configuration: SchemaConfiguration?): Number { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg: Number = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validationMetadata = + ValidationMetadata(pathToItem, usedConfiguration, PathToSchemasMap(), LinkedHashSet()) + val pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet) + return getNewInstance(castArg, validationMetadata.pathToItem, pathToSchemasMap) } - public static Int64JsonSchema1 getInstance() { - if (instance == null) { - instance = new Int64JsonSchema1(); - } - return instance; + @Throws(ValidationException::class) + fun validate(arg: Int, configuration: SchemaConfiguration?): Int { + return validate(arg as Number, configuration) as Int } - @Override - public Number validate(Number arg, SchemaConfiguration configuration) throws ValidationException { - Set> pathSet = new HashSet<>(); - List pathToItem = List.of("args[0"); - Number castArg = castToAllowedTypes(arg, pathToItem, pathSet); - SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().build())); - ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, new PathToSchemasMap(), new LinkedHashSet<>()); - PathToSchemasMap pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet); - return getNewInstance(castArg, validationMetadata.pathToItem(), pathToSchemasMap); + @Throws(ValidationException::class) + fun validate(arg: Long, configuration: SchemaConfiguration?): Long { + return validate(arg as Number, configuration) as Long } - public int validate(int arg, SchemaConfiguration configuration) throws ValidationException { - return (int) validate((Number) arg, configuration); + @Throws(ValidationException::class) + fun validate(arg: Float, configuration: SchemaConfiguration?): Float { + return validate(arg as Number, configuration) as Float } - public long validate(long arg, SchemaConfiguration configuration) throws ValidationException { - return (long) validate((Number) arg, configuration); + @Throws(ValidationException::class) + fun validate(arg: Double, configuration: SchemaConfiguration?): Double { + return validate(arg as Number, configuration) as Double } - public float validate(float arg, SchemaConfiguration configuration) throws ValidationException { - return (float) validate((Number) arg, configuration); + override fun getNewInstance(arg: Any?, pathToItem: List, pathToSchemas: PathToSchemasMap): Any? { + if (arg is Number) { + return getNewInstance(arg as Number?, pathToItem, pathToSchemas) + } + throw RuntimeException("Invalid input type=$javaClass. It can't be instantiated by this schema") } - public double validate(double arg, SchemaConfiguration configuration) throws ValidationException { - return (double) validate((Number) arg, configuration); + @Throws(ValidationException::class) + override fun validate(arg: Any?, configuration: SchemaConfiguration?): Number { + if (arg is Number) { + return validate(arg, configuration) + } + throw ValidationException("Invalid input type=$javaClass. It can't be validated by this schema") } - @Override - public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { - 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"); + @Throws(ValidationException::class) + override fun validateAndBox(arg: Number, configuration: SchemaConfiguration?): Int64JsonSchema1BoxedNumber { + return Int64JsonSchema1BoxedNumber(validate(arg, configuration)) } - @Override - public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { - if (arg instanceof Number) { - return validate((Number) arg, configuration); + @Throws(ValidationException::class) + override fun validateAndBox(arg: Any?, configuration: SchemaConfiguration?): Int64JsonSchema1Boxed { + if (arg is Number) { + return validateAndBox(arg, configuration) } - throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw ValidationException("Invalid input type=$javaClass. It can't be validated by this schema") } - @Override - public Int64JsonSchema1BoxedNumber validateAndBox(Number arg, SchemaConfiguration configuration) throws ValidationException { - return new Int64JsonSchema1BoxedNumber(validate(arg, configuration)); - } + companion object { + @Volatile + private var instance: Int64JsonSchema1? = null - @Override - public Int64JsonSchema1Boxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { - 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"); + fun getInstance() = + instance ?: synchronized(this) { + instance ?: Int64JsonSchema1().also { instance = it } + } } } } \ No newline at end of file diff --git a/src/main/resources/kotlin/src/main/kotlin/packagename/schemas/Int64JsonSchema.hbs b/src/main/resources/kotlin/src/main/kotlin/packagename/schemas/Int64JsonSchema.hbs index 4ef6aa5f5a7..693695434ff 100644 --- a/src/main/resources/kotlin/src/main/kotlin/packagename/schemas/Int64JsonSchema.hbs +++ b/src/main/resources/kotlin/src/main/kotlin/packagename/schemas/Int64JsonSchema.hbs @@ -8,101 +8,98 @@ import {{{packageName}}}.configurations.SchemaConfiguration; import {{{packageName}}}.schemas.validation.PathToSchemasMap; import {{{packageName}}}.schemas.validation.NumberSchemaValidator; import {{{packageName}}}.schemas.validation.ValidationMetadata; -import org.checkerframework.checker.nullness.qual.Nullable; -import java.util.HashSet; -import java.util.LinkedHashSet; -import java.util.List; -import java.util.Objects; -import java.util.Set; - -public class Int64JsonSchema { - public sealed interface Int64JsonSchema1Boxed permits Int64JsonSchema1BoxedNumber { - @Nullable Object getData(); +class Int64JsonSchema { + sealed interface Int64JsonSchema1Boxed { + fun getData(): Any? } - public record Int64JsonSchema1BoxedNumber(Number data) implements Int64JsonSchema1Boxed { - @Override - public @Nullable Object getData() { - return data; + + data class Int64JsonSchema1BoxedNumber(val data: Number) : Int64JsonSchema1Boxed { + override fun getData(): Number { + return data } } - public static class Int64JsonSchema1 extends JsonSchema implements NumberSchemaValidator { - private static @Nullable Int64JsonSchema1 instance = null; - - protected Int64JsonSchema1() { - super(new JsonSchemaInfo() - .type(Set.of( - Integer.class, - Long.class, - Float.class, - Double.class - )) - .format("int64") - ); + class Int64JsonSchema1 private constructor() : JsonSchema( + JsonSchemaInfo() + .type( + setOf( + Int::class.java, + Long::class.java, + Float::class.java, + Double::class.java + ) + ) + .format("int64") + ), NumberSchemaValidator { + @Throws(ValidationException::class) + override fun validate(arg: Number, configuration: SchemaConfiguration?): Number { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg: Number = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validationMetadata = + ValidationMetadata(pathToItem, usedConfiguration, PathToSchemasMap(), LinkedHashSet()) + val pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet) + return getNewInstance(castArg, validationMetadata.pathToItem, pathToSchemasMap) } - public static Int64JsonSchema1 getInstance() { - if (instance == null) { - instance = new Int64JsonSchema1(); - } - return instance; + @Throws(ValidationException::class) + fun validate(arg: Int, configuration: SchemaConfiguration?): Int { + return validate(arg as Number, configuration) as Int } - @Override - public Number validate(Number arg, SchemaConfiguration configuration) throws ValidationException { - Set> pathSet = new HashSet<>(); - List pathToItem = List.of("args[0"); - Number castArg = castToAllowedTypes(arg, pathToItem, pathSet); - SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().build())); - ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, new PathToSchemasMap(), new LinkedHashSet<>()); - PathToSchemasMap pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet); - return getNewInstance(castArg, validationMetadata.pathToItem(), pathToSchemasMap); + @Throws(ValidationException::class) + fun validate(arg: Long, configuration: SchemaConfiguration?): Long { + return validate(arg as Number, configuration) as Long } - public int validate(int arg, SchemaConfiguration configuration) throws ValidationException { - return (int) validate((Number) arg, configuration); + @Throws(ValidationException::class) + fun validate(arg: Float, configuration: SchemaConfiguration?): Float { + return validate(arg as Number, configuration) as Float } - public long validate(long arg, SchemaConfiguration configuration) throws ValidationException { - return (long) validate((Number) arg, configuration); + @Throws(ValidationException::class) + fun validate(arg: Double, configuration: SchemaConfiguration?): Double { + return validate(arg as Number, configuration) as Double } - public float validate(float arg, SchemaConfiguration configuration) throws ValidationException { - return (float) validate((Number) arg, configuration); + override fun getNewInstance(arg: Any?, pathToItem: List, pathToSchemas: PathToSchemasMap): Any? { + if (arg is Number) { + return getNewInstance(arg as Number?, pathToItem, pathToSchemas) + } + throw RuntimeException("Invalid input type=$javaClass. It can't be instantiated by this schema") } - public double validate(double arg, SchemaConfiguration configuration) throws ValidationException { - return (double) validate((Number) arg, configuration); + @Throws(ValidationException::class) + override fun validate(arg: Any?, configuration: SchemaConfiguration?): Number { + if (arg is Number) { + return validate(arg, configuration) + } + throw ValidationException("Invalid input type=$javaClass. It can't be validated by this schema") } - @Override - public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { - 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"); + @Throws(ValidationException::class) + override fun validateAndBox(arg: Number, configuration: SchemaConfiguration?): Int64JsonSchema1BoxedNumber { + return Int64JsonSchema1BoxedNumber(validate(arg, configuration)) } - @Override - public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { - if (arg instanceof Number) { - return validate((Number) arg, configuration); + @Throws(ValidationException::class) + override fun validateAndBox(arg: Any?, configuration: SchemaConfiguration?): Int64JsonSchema1Boxed { + if (arg is Number) { + return validateAndBox(arg, configuration) } - throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw ValidationException("Invalid input type=$javaClass. It can't be validated by this schema") } - @Override - public Int64JsonSchema1BoxedNumber validateAndBox(Number arg, SchemaConfiguration configuration) throws ValidationException { - return new Int64JsonSchema1BoxedNumber(validate(arg, configuration)); - } + companion object { + @Volatile + private var instance: Int64JsonSchema1? = null - @Override - public Int64JsonSchema1Boxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { - 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"); + fun getInstance() = + instance ?: synchronized(this) { + instance ?: Int64JsonSchema1().also { instance = it } + } } } } \ No newline at end of file From 9313454ed042c99c2212027b118d35479ecd0cab Mon Sep 17 00:00:00 2001 From: Justin Black Date: Thu, 9 May 2024 10:47:21 -0700 Subject: [PATCH 57/78] Updates IntJsonSchema --- .../client/schemas/IntJsonSchema.kt | 155 +++++++++--------- .../packagename/schemas/IntJsonSchema.hbs | 137 ++++++++-------- 2 files changed, 143 insertions(+), 149 deletions(-) diff --git a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/schemas/IntJsonSchema.kt b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/schemas/IntJsonSchema.kt index a89a70c02c5..f69bb5eca59 100644 --- a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/schemas/IntJsonSchema.kt +++ b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/schemas/IntJsonSchema.kt @@ -1,108 +1,105 @@ -package org.openapijsonschematools.client.schemas; +package org.openapijsonschematools.client.schemas -import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags; -import org.openapijsonschematools.client.exceptions.ValidationException; -import org.openapijsonschematools.client.schemas.validation.JsonSchema; -import org.openapijsonschematools.client.schemas.validation.JsonSchemaInfo; -import org.openapijsonschematools.client.configurations.SchemaConfiguration; -import org.openapijsonschematools.client.schemas.validation.PathToSchemasMap; -import org.openapijsonschematools.client.schemas.validation.NumberSchemaValidator; -import org.openapijsonschematools.client.schemas.validation.ValidationMetadata; -import org.checkerframework.checker.nullness.qual.Nullable; +import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags +import org.openapijsonschematools.client.configurations.SchemaConfiguration +import org.openapijsonschematools.client.exceptions.ValidationException +import org.openapijsonschematools.client.schemas.validation.JsonSchema +import org.openapijsonschematools.client.schemas.validation.JsonSchemaInfo +import org.openapijsonschematools.client.schemas.validation.NumberSchemaValidator +import org.openapijsonschematools.client.schemas.validation.PathToSchemasMap +import org.openapijsonschematools.client.schemas.validation.ValidationMetadata -import java.util.HashSet; -import java.util.LinkedHashSet; -import java.util.List; -import java.util.Objects; -import java.util.Set; - -public class IntJsonSchema { - public sealed interface IntJsonSchema1Boxed permits IntJsonSchema1BoxedNumber { - @Nullable Object getData(); +class IntJsonSchema { + sealed interface IntJsonSchema1Boxed { + fun getData(): Any? } - public record IntJsonSchema1BoxedNumber(Number data) implements IntJsonSchema1Boxed { - @Override - public @Nullable Object getData() { - return data; + + data class IntJsonSchema1BoxedNumber(val data: Number) : IntJsonSchema1Boxed { + override fun getData(): Number { + return data } } - public static class IntJsonSchema1 extends JsonSchema implements NumberSchemaValidator { - private static @Nullable IntJsonSchema1 instance = null; - - protected IntJsonSchema1() { - super(new JsonSchemaInfo() - .type(Set.of( - Integer.class, - Long.class, - Float.class, - Double.class - )) - .format("int") - ); + class IntJsonSchema1 private constructor() : JsonSchema( + JsonSchemaInfo() + .type( + setOf( + Int::class.java, + Long::class.java, + Float::class.java, + Double::class.java + ) + ) + .format("int") + ), NumberSchemaValidator { + @Throws(ValidationException::class) + override fun validate(arg: Number, configuration: SchemaConfiguration?): Number { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg: Number = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validationMetadata = + ValidationMetadata(pathToItem, usedConfiguration, PathToSchemasMap(), LinkedHashSet()) + val pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet) + return getNewInstance(castArg, validationMetadata.pathToItem, pathToSchemasMap) } - public static IntJsonSchema1 getInstance() { - if (instance == null) { - instance = new IntJsonSchema1(); - } - return instance; + @Throws(ValidationException::class) + fun validate(arg: Int, configuration: SchemaConfiguration?): Int { + return validate(arg as Number, configuration) as Int } - @Override - public Number validate(Number arg, SchemaConfiguration configuration) throws ValidationException { - Set> pathSet = new HashSet<>(); - List pathToItem = List.of("args[0"); - Number castArg = castToAllowedTypes(arg, pathToItem, pathSet); - SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().build())); - ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, new PathToSchemasMap(), new LinkedHashSet<>()); - PathToSchemasMap pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet); - return getNewInstance(castArg, validationMetadata.pathToItem(), pathToSchemasMap); + @Throws(ValidationException::class) + fun validate(arg: Long, configuration: SchemaConfiguration?): Long { + return validate(arg as Number, configuration) as Long } - public int validate(int arg, SchemaConfiguration configuration) throws ValidationException { - return (int) validate((Number) arg, configuration); + @Throws(ValidationException::class) + fun validate(arg: Float, configuration: SchemaConfiguration?): Float { + return validate(arg as Number, configuration) as Float } - public long validate(long arg, SchemaConfiguration configuration) throws ValidationException { - return (long) validate((Number) arg, configuration); + @Throws(ValidationException::class) + fun validate(arg: Double, configuration: SchemaConfiguration?): Double { + return validate(arg as Number, configuration) as Double } - public float validate(float arg, SchemaConfiguration configuration) throws ValidationException { - return (float) validate((Number) arg, configuration); + override fun getNewInstance(arg: Any?, pathToItem: List, pathToSchemas: PathToSchemasMap): Any? { + if (arg is Number) { + return getNewInstance(arg as Number?, pathToItem, pathToSchemas) + } + throw RuntimeException("Invalid input type=$javaClass. It can't be instantiated by this schema") } - public double validate(double arg, SchemaConfiguration configuration) throws ValidationException { - return (double) validate((Number) arg, configuration); + @Throws(ValidationException::class) + override fun validate(arg: Any?, configuration: SchemaConfiguration?): Number { + if (arg is Number) { + return validate(arg, configuration) + } + throw ValidationException("Invalid input type=$javaClass. It can't be validated by this schema") } - @Override - public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { - 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"); + @Throws(ValidationException::class) + override fun validateAndBox(arg: Number, configuration: SchemaConfiguration?): IntJsonSchema1BoxedNumber { + return IntJsonSchema1BoxedNumber(validate(arg, configuration)) } - @Override - public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { - if (arg instanceof Number) { - return validate((Number) arg, configuration); + @Throws(ValidationException::class) + override fun validateAndBox(arg: Any?, configuration: SchemaConfiguration?): IntJsonSchema1Boxed { + if (arg is Number) { + return validateAndBox(arg, configuration) } - throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw ValidationException("Invalid input type=$javaClass. It can't be validated by this schema") } - @Override - public IntJsonSchema1BoxedNumber validateAndBox(Number arg, SchemaConfiguration configuration) throws ValidationException { - return new IntJsonSchema1BoxedNumber(validate(arg, configuration)); - } + companion object { + @Volatile + private var instance: IntJsonSchema1? = null - @Override - public IntJsonSchema1Boxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { - 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"); + fun getInstance() = + instance ?: synchronized(this) { + instance ?: IntJsonSchema1().also { instance = it } + } } } } \ No newline at end of file diff --git a/src/main/resources/kotlin/src/main/kotlin/packagename/schemas/IntJsonSchema.hbs b/src/main/resources/kotlin/src/main/kotlin/packagename/schemas/IntJsonSchema.hbs index d4d8980f787..88b98067776 100644 --- a/src/main/resources/kotlin/src/main/kotlin/packagename/schemas/IntJsonSchema.hbs +++ b/src/main/resources/kotlin/src/main/kotlin/packagename/schemas/IntJsonSchema.hbs @@ -8,101 +8,98 @@ import {{{packageName}}}.configurations.SchemaConfiguration; import {{{packageName}}}.schemas.validation.PathToSchemasMap; import {{{packageName}}}.schemas.validation.NumberSchemaValidator; import {{{packageName}}}.schemas.validation.ValidationMetadata; -import org.checkerframework.checker.nullness.qual.Nullable; -import java.util.HashSet; -import java.util.LinkedHashSet; -import java.util.List; -import java.util.Objects; -import java.util.Set; - -public class IntJsonSchema { - public sealed interface IntJsonSchema1Boxed permits IntJsonSchema1BoxedNumber { - @Nullable Object getData(); +class IntJsonSchema { + sealed interface IntJsonSchema1Boxed { + fun getData(): Any? } - public record IntJsonSchema1BoxedNumber(Number data) implements IntJsonSchema1Boxed { - @Override - public @Nullable Object getData() { - return data; + + data class IntJsonSchema1BoxedNumber(val data: Number) : IntJsonSchema1Boxed { + override fun getData(): Number { + return data } } - public static class IntJsonSchema1 extends JsonSchema implements NumberSchemaValidator { - private static @Nullable IntJsonSchema1 instance = null; - - protected IntJsonSchema1() { - super(new JsonSchemaInfo() - .type(Set.of( - Integer.class, - Long.class, - Float.class, - Double.class - )) - .format("int") - ); + class IntJsonSchema1 private constructor() : JsonSchema( + JsonSchemaInfo() + .type( + setOf( + Int::class.java, + Long::class.java, + Float::class.java, + Double::class.java + ) + ) + .format("int") + ), NumberSchemaValidator { + @Throws(ValidationException::class) + override fun validate(arg: Number, configuration: SchemaConfiguration?): Number { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg: Number = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validationMetadata = + ValidationMetadata(pathToItem, usedConfiguration, PathToSchemasMap(), LinkedHashSet()) + val pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet) + return getNewInstance(castArg, validationMetadata.pathToItem, pathToSchemasMap) } - public static IntJsonSchema1 getInstance() { - if (instance == null) { - instance = new IntJsonSchema1(); - } - return instance; + @Throws(ValidationException::class) + fun validate(arg: Int, configuration: SchemaConfiguration?): Int { + return validate(arg as Number, configuration) as Int } - @Override - public Number validate(Number arg, SchemaConfiguration configuration) throws ValidationException { - Set> pathSet = new HashSet<>(); - List pathToItem = List.of("args[0"); - Number castArg = castToAllowedTypes(arg, pathToItem, pathSet); - SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().build())); - ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, new PathToSchemasMap(), new LinkedHashSet<>()); - PathToSchemasMap pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet); - return getNewInstance(castArg, validationMetadata.pathToItem(), pathToSchemasMap); + @Throws(ValidationException::class) + fun validate(arg: Long, configuration: SchemaConfiguration?): Long { + return validate(arg as Number, configuration) as Long } - public int validate(int arg, SchemaConfiguration configuration) throws ValidationException { - return (int) validate((Number) arg, configuration); + @Throws(ValidationException::class) + fun validate(arg: Float, configuration: SchemaConfiguration?): Float { + return validate(arg as Number, configuration) as Float } - public long validate(long arg, SchemaConfiguration configuration) throws ValidationException { - return (long) validate((Number) arg, configuration); + @Throws(ValidationException::class) + fun validate(arg: Double, configuration: SchemaConfiguration?): Double { + return validate(arg as Number, configuration) as Double } - public float validate(float arg, SchemaConfiguration configuration) throws ValidationException { - return (float) validate((Number) arg, configuration); + override fun getNewInstance(arg: Any?, pathToItem: List, pathToSchemas: PathToSchemasMap): Any? { + if (arg is Number) { + return getNewInstance(arg as Number?, pathToItem, pathToSchemas) + } + throw RuntimeException("Invalid input type=$javaClass. It can't be instantiated by this schema") } - public double validate(double arg, SchemaConfiguration configuration) throws ValidationException { - return (double) validate((Number) arg, configuration); + @Throws(ValidationException::class) + override fun validate(arg: Any?, configuration: SchemaConfiguration?): Number { + if (arg is Number) { + return validate(arg, configuration) + } + throw ValidationException("Invalid input type=$javaClass. It can't be validated by this schema") } - @Override - public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { - 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"); + @Throws(ValidationException::class) + override fun validateAndBox(arg: Number, configuration: SchemaConfiguration?): IntJsonSchema1BoxedNumber { + return IntJsonSchema1BoxedNumber(validate(arg, configuration)) } - @Override - public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { - if (arg instanceof Number) { - return validate((Number) arg, configuration); + @Throws(ValidationException::class) + override fun validateAndBox(arg: Any?, configuration: SchemaConfiguration?): IntJsonSchema1Boxed { + if (arg is Number) { + return validateAndBox(arg, configuration) } - throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw ValidationException("Invalid input type=$javaClass. It can't be validated by this schema") } - @Override - public IntJsonSchema1BoxedNumber validateAndBox(Number arg, SchemaConfiguration configuration) throws ValidationException { - return new IntJsonSchema1BoxedNumber(validate(arg, configuration)); - } + companion object { + @Volatile + private var instance: IntJsonSchema1? = null - @Override - public IntJsonSchema1Boxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { - 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"); + fun getInstance() = + instance ?: synchronized(this) { + instance ?: IntJsonSchema1().also { instance = it } + } } } } \ No newline at end of file From 4bc351bb69adb5d3e048970158993ad101512878 Mon Sep 17 00:00:00 2001 From: Justin Black Date: Thu, 9 May 2024 11:05:55 -0700 Subject: [PATCH 58/78] Updates SetMaker and UnsetAddPropsSetter Updates UuidJsonSchema Updates AdditionalPropertiesValidatorTest Removes unused kotlin files in petstore Updates the type value method interfaces and enum validators Updates some lingering java code to kotlin Fixes compile errors Fixes JsonSchemaKeywordFlagsTest Fixes JsonSchemaFactory and existing tests FIxes CustomIsoparserTest Updates FormatValidatorTest Updates ItemsValidatorTest Updates JsonSchemaTest Updates PropertiesValidatorTest Updates RequiredValidatorTest Updates TypeValidatorTest Updates AnyTypeSchemaTest Updates ArrayTypeSchemaTest Updates BooleanSchemaTest Updates ListBuilderTest Updates ListSchemaTest Updates MapSchemaTest Updates NullSchemaTest Updates NumberSchemaTest Partial updated to ObjectTypeSchemaTest kt file only More partial updates to ObjectTypeSchemaTest kt file Adds ObjectTypeSchemaTest Partial update of RefBooleanSchemaTest Updates RefBooleanSchemaTest Stops generating api client and rest client if there are no paths in kotlin Kotlin does not generate response sif there are not component responses or paths Makes request body kotlin generation conditional on presence of paths or component request bodies Conditionally generate parameters and headers packages for kotlin 303 sample regen Conditionally generates mediatype in kotlin Kotlin makes contenttype generation conditional Refactors supporting file adding into one method in kotlin Conditionally generate ApiCOnfiguration, fix artifactId warning Conditionally generates ApiException Makes generation of NotImplementedException conditional Updates readme to detect no endpoints, updates readme and gradle settings to use generatorSettings Fixes readme reference to artifactVersion Fixes various kotlin bugs, tests now pass without generated schemas Kotlin 303 regen, component schemas and tests deleted Fixes object output class initialization and requiredProps and optionalProps static vars Fixes object output class property methods Fixes output types for kotlin Fixes kotlin input types Fixes of input type definitions Removes list map and set imports Objects import removed Many schema generation fixes, imports property methods Removes casts because kotlin smart casts Many fixes for builder setter interfaces and methods More improvements to builder setters Fixes setters and builder classes Fixes sealed interfaces for schemas Updates type values Udpates properties, moves JsonSchemaInfo higher Partial validate fix Adds needed schema constructors Updates getNewInstance Fixes broken code in validate methods Removes PropertyEntry, more fixes Fixes many more kotlin errors Fixes some kotlin casting issues Updates schema info list creation to use listOf Updates code to use setOf Fixes array input and output classes Fixes schema extension of primitive json schemas Fixes enum types Fixes json schema enum data Fixes defaultValue method Fixes character escaping Removes many unneeded semicolons Fixes kotlin 303 tests Kotlin 303 sample added to ci Adds kotlin doc Adds circleci test for kotlin tweaks circleci file Turns off kotlinc version printing Checks gradle wrapper version Updates android image Switches image version Changes kotlin image ot use openjdk Removes kotlinc log Updates wrapper invocation Turns on test logging, forces to be rerun --- .circleci/config.yml | 24 +- .circleci/parallel.sh | 7 + .circleci/testKotlinClientSamples.sh | 1 + .../kotlin_3_0_3_unit_test.yaml | 6 + docs/generators/kotlin.md | 329 ++ .../kotlin/.gitignore | 0 .../kotlin/.openapi-generator-ignore | 0 .../kotlin/.openapi-generator/FILES | 304 ++ .../kotlin/.openapi-generator/VERSION | 0 .../client/3_0_3_unit_test/kotlin/README.md | 224 + .../kotlin/build.gradle.kts | 19 +- .../kotlin/docs/RootServerInfo.md | 8 +- ...pertiesAllowsASchemaWhichShouldValidate.md | 446 ++ ...AdditionalpropertiesAreAllowedByDefault.md | 496 ++ .../AdditionalpropertiesCanExistByItself.md | 159 + ...nalpropertiesShouldNotLookInApplicators.md | 578 +++ .../kotlin/docs/components/schemas/Allof.md | 674 +++ .../schemas/AllofCombinedWithAnyofOneof.md | 636 +++ .../components/schemas/AllofSimpleTypes.md | 479 ++ .../components/schemas/AllofWithBaseSchema.md | 770 +++ .../schemas/AllofWithOneEmptySchema.md | 302 ++ .../schemas/AllofWithTheFirstEmptySchema.md | 340 ++ .../schemas/AllofWithTheLastEmptySchema.md | 340 ++ .../schemas/AllofWithTwoEmptySchemas.md | 435 ++ .../kotlin/docs/components/schemas/Anyof.md | 362 ++ .../components/schemas/AnyofComplexTypes.md | 674 +++ .../components/schemas/AnyofWithBaseSchema.md | 394 ++ .../schemas/AnyofWithOneEmptySchema.md | 340 ++ .../schemas/ArrayTypeMatchesArrays.md | 260 + .../schemas/BooleanTypeMatchesBooleans.md | 52 + .../kotlin/docs/components/schemas/ByInt.md | 169 + .../docs/components/schemas/ByNumber.md | 169 + .../docs/components/schemas/BySmallNumber.md | 169 + .../docs/components/schemas/DateTimeFormat.md | 169 + .../docs/components/schemas/EmailFormat.md | 169 + .../schemas/EnumWith0DoesNotMatchFalse.md | 133 + .../schemas/EnumWith1DoesNotMatchTrue.md | 133 + .../schemas/EnumWithEscapedCharacters.md | 99 + .../schemas/EnumWithFalseDoesNotMatch0.md | 98 + .../schemas/EnumWithTrueDoesNotMatch1.md | 98 + .../components/schemas/EnumsInProperties.md | 320 ++ .../components/schemas/ForbiddenProperty.md | 353 ++ .../docs/components/schemas/HostnameFormat.md | 169 + .../schemas/IntegerTypeMatchesIntegers.md | 52 + ...ShouldNotRaiseErrorWhenFloatDivisionInf.md | 85 + .../schemas/InvalidStringValueForDefault.md | 283 ++ .../docs/components/schemas/Ipv4Format.md | 169 + .../docs/components/schemas/Ipv6Format.md | 169 + .../components/schemas/JsonPointerFormat.md | 169 + .../components/schemas/MaximumValidation.md | 169 + .../MaximumValidationWithUnsignedInteger.md | 169 + .../components/schemas/MaxitemsValidation.md | 169 + .../components/schemas/MaxlengthValidation.md | 169 + .../Maxproperties0MeansTheObjectIsEmpty.md | 169 + .../schemas/MaxpropertiesValidation.md | 169 + .../components/schemas/MinimumValidation.md | 169 + .../MinimumValidationWithSignedInteger.md | 169 + .../components/schemas/MinitemsValidation.md | 169 + .../components/schemas/MinlengthValidation.md | 169 + .../schemas/MinpropertiesValidation.md | 169 + .../NestedAllofToCheckValidationSemantics.md | 362 ++ .../NestedAnyofToCheckValidationSemantics.md | 362 ++ .../docs/components/schemas/NestedItems.md | 492 ++ .../NestedOneofToCheckValidationSemantics.md | 362 ++ .../kotlin/docs/components/schemas/Not.md | 207 + .../schemas/NotMoreComplexSchema.md | 324 ++ .../schemas/NulCharactersInStrings.md | 98 + .../NullTypeMatchesOnlyTheNullObject.md | 52 + .../schemas/NumberTypeMatchesNumbers.md | 52 + .../schemas/ObjectPropertiesValidation.md | 293 ++ .../schemas/ObjectTypeMatchesObjects.md | 52 + .../kotlin/docs/components/schemas/Oneof.md | 362 ++ .../components/schemas/OneofComplexTypes.md | 674 +++ .../components/schemas/OneofWithBaseSchema.md | 394 ++ .../schemas/OneofWithEmptySchema.md | 340 ++ .../components/schemas/OneofWithRequired.md | 617 +++ .../schemas/PatternIsNotAnchored.md | 169 + .../components/schemas/PatternValidation.md | 169 + .../PropertiesWithEscapedCharacters.md | 463 ++ .../PropertyNamedRefThatIsNotAReference.md | 250 + .../schemas/RefInAdditionalproperties.md | 127 + .../docs/components/schemas/RefInAllof.md | 169 + .../docs/components/schemas/RefInAnyof.md | 169 + .../docs/components/schemas/RefInItems.md | 127 + .../docs/components/schemas/RefInNot.md | 169 + .../docs/components/schemas/RefInOneof.md | 169 + .../docs/components/schemas/RefInProperty.md | 220 + .../schemas/RequiredDefaultValidation.md | 353 ++ .../components/schemas/RequiredValidation.md | 512 ++ .../schemas/RequiredWithEmptyArray.md | 353 ++ .../schemas/RequiredWithEscapedCharacters.md | 2884 +++++++++++ .../schemas/SimpleEnumValidation.md | 141 + .../schemas/StringTypeMatchesStrings.md | 52 + ...DoesNotDoAnythingIfThePropertyIsMissing.md | 205 + .../schemas/UniqueitemsFalseValidation.md | 169 + .../schemas/UniqueitemsValidation.md | 169 + .../docs/components/schemas/UriFormat.md | 169 + .../components/schemas/UriReferenceFormat.md | 169 + .../components/schemas/UriTemplateFormat.md | 169 + .../kotlin/docs/servers/RootServer0.md} | 13 +- .../kotlin/settings.gradle.kts | 2 + .../client/RootServerInfo.kt | 20 + ...pertiesAllowsASchemaWhichShouldValidate.kt | 351 ++ ...AdditionalpropertiesAreAllowedByDefault.kt | 518 ++ .../AdditionalpropertiesCanExistByItself.kt | 183 + ...nalpropertiesShouldNotLookInApplicators.kt | 787 +++ .../client/components/schemas/Allof.kt | 1060 ++++ .../schemas/AllofCombinedWithAnyofOneof.kt | 1142 +++++ .../components/schemas/AllofSimpleTypes.kt | 861 ++++ .../components/schemas/AllofWithBaseSchema.kt | 1151 +++++ .../schemas/AllofWithOneEmptySchema.kt | 324 ++ .../schemas/AllofWithTheFirstEmptySchema.kt | 339 ++ .../schemas/AllofWithTheLastEmptySchema.kt | 339 ++ .../schemas/AllofWithTwoEmptySchemas.kt | 338 ++ .../client/components/schemas/Anyof.kt | 600 +++ .../components/schemas/AnyofComplexTypes.kt | 1060 ++++ .../components/schemas/AnyofWithBaseSchema.kt | 653 +++ .../schemas/AnyofWithOneEmptySchema.kt | 339 ++ .../schemas/ArrayTypeMatchesArrays.kt | 187 + .../schemas/BooleanTypeMatchesBooleans.kt | 20 + .../client/components/schemas/ByInt.kt | 309 ++ .../client/components/schemas/ByNumber.kt | 309 ++ .../components/schemas/BySmallNumber.kt | 309 ++ .../components/schemas/DateTimeFormat.kt | 308 ++ .../client/components/schemas/EmailFormat.kt | 308 ++ .../schemas/EnumWith0DoesNotMatchFalse.kt | 173 + .../schemas/EnumWith1DoesNotMatchTrue.kt | 173 + .../schemas/EnumWithEscapedCharacters.kt | 106 + .../schemas/EnumWithFalseDoesNotMatch0.kt | 102 + .../schemas/EnumWithTrueDoesNotMatch1.kt | 102 + .../components/schemas/EnumsInProperties.kt | 394 ++ .../components/schemas/ForbiddenProperty.kt | 437 ++ .../components/schemas/HostnameFormat.kt | 308 ++ .../schemas/IntegerTypeMatchesIntegers.kt | 20 + ...ShouldNotRaiseErrorWhenFloatDivisionInf.kt | 112 + .../schemas/InvalidStringValueForDefault.kt | 455 ++ .../client/components/schemas/Ipv4Format.kt | 308 ++ .../client/components/schemas/Ipv6Format.kt | 308 ++ .../components/schemas/JsonPointerFormat.kt | 308 ++ .../components/schemas/MaximumValidation.kt | 308 ++ .../MaximumValidationWithUnsignedInteger.kt | 308 ++ .../components/schemas/MaxitemsValidation.kt | 308 ++ .../components/schemas/MaxlengthValidation.kt | 308 ++ .../Maxproperties0MeansTheObjectIsEmpty.kt | 308 ++ .../schemas/MaxpropertiesValidation.kt | 308 ++ .../components/schemas/MinimumValidation.kt | 308 ++ .../MinimumValidationWithSignedInteger.kt | 308 ++ .../components/schemas/MinitemsValidation.kt | 308 ++ .../components/schemas/MinlengthValidation.kt | 308 ++ .../schemas/MinpropertiesValidation.kt | 308 ++ .../NestedAllofToCheckValidationSemantics.kt | 601 +++ .../NestedAnyofToCheckValidationSemantics.kt | 601 +++ .../client/components/schemas/NestedItems.kt | 510 ++ .../NestedOneofToCheckValidationSemantics.kt | 601 +++ .../client/components/schemas/Not.kt | 322 ++ .../schemas/NotMoreComplexSchema.kt | 478 ++ .../schemas/NulCharactersInStrings.kt | 104 + .../NullTypeMatchesOnlyTheNullObject.kt | 20 + .../schemas/NumberTypeMatchesNumbers.kt | 20 + .../schemas/ObjectPropertiesValidation.kt | 453 ++ .../schemas/ObjectTypeMatchesObjects.kt | 21 + .../client/components/schemas/Oneof.kt | 600 +++ .../components/schemas/OneofComplexTypes.kt | 1060 ++++ .../components/schemas/OneofWithBaseSchema.kt | 653 +++ .../schemas/OneofWithEmptySchema.kt | 339 ++ .../components/schemas/OneofWithRequired.kt | 1096 +++++ .../schemas/PatternIsNotAnchored.kt | 311 ++ .../components/schemas/PatternValidation.kt | 311 ++ .../PropertiesWithEscapedCharacters.kt | 640 +++ .../PropertyNamedRefThatIsNotAReference.kt | 382 ++ .../schemas/RefInAdditionalproperties.kt | 228 + .../client/components/schemas/RefInAllof.kt | 310 ++ .../client/components/schemas/RefInAnyof.kt | 310 ++ .../client/components/schemas/RefInItems.kt | 176 + .../client/components/schemas/RefInNot.kt | 308 ++ .../client/components/schemas/RefInOneof.kt | 310 ++ .../components/schemas/RefInProperty.kt | 427 ++ .../schemas/RequiredDefaultValidation.kt | 435 ++ .../components/schemas/RequiredValidation.kt | 531 ++ .../schemas/RequiredWithEmptyArray.kt | 435 ++ .../schemas/RequiredWithEscapedCharacters.kt | 1677 +++++++ .../schemas/SimpleEnumValidation.kt | 183 + .../schemas/StringTypeMatchesStrings.kt | 20 + ...DoesNotDoAnythingIfThePropertyIsMissing.kt | 291 ++ .../schemas/UniqueitemsFalseValidation.kt | 308 ++ .../schemas/UniqueitemsValidation.kt | 308 ++ .../client/components/schemas/UriFormat.kt | 308 ++ .../components/schemas/UriReferenceFormat.kt | 308 ++ .../components/schemas/UriTemplateFormat.kt | 308 ++ .../configurations/JsonSchemaKeywordFlags.kt | 2 +- .../configurations/SchemaConfiguration.kt | 3 + .../client/exceptions/BaseException.kt | 3 + .../InvalidAdditionalPropertyException.kt | 4 +- .../exceptions/UnsetPropertyException.kt | 3 + .../client/exceptions/ValidationException.kt | 3 + .../client/schemas/AnyTypeJsonSchema.kt | 43 +- .../client/schemas/BooleanJsonSchema.kt | 8 +- .../client/schemas/DateJsonSchema.kt | 21 +- .../client/schemas/DateTimeJsonSchema.kt | 8 +- .../client/schemas/DecimalJsonSchema.kt | 8 +- .../client/schemas/DoubleJsonSchema.kt | 17 +- .../client/schemas/FloatJsonSchema.kt | 17 +- .../client/schemas/GenericBuilder.kt | 2 +- .../client/schemas/Int32JsonSchema.kt | 12 +- .../client/schemas/Int64JsonSchema.kt | 12 +- .../client/schemas/IntJsonSchema.kt | 12 +- .../client/schemas/ListJsonSchema.kt | 14 +- .../client/schemas/MapJsonSchema.kt | 18 +- .../client/schemas/NotAnyTypeJsonSchema.kt | 56 +- .../client/schemas/NullJsonSchema.kt | 6 +- .../client/schemas/NumberJsonSchema.kt | 12 +- .../client/schemas/StringJsonSchema.kt | 9 +- .../client/schemas/UnsetAddPropsSetter.kt | 81 + .../client/schemas/UuidJsonSchema.kt | 87 + .../AdditionalPropertiesValidator.kt | 0 .../schemas/validation/AllOfValidator.kt | 2 +- .../schemas/validation/AnyOfValidator.kt | 2 +- .../schemas/validation/BigDecimalValidator.kt | 1 + .../validation/BooleanEnumValidator.kt | 9 + .../validation/BooleanSchemaValidator.kt | 0 .../schemas/validation/BooleanValueMethod.kt | 5 + .../schemas/validation/ConstValidator.kt | 1 + .../schemas/validation/ContainsValidator.kt | 0 .../schemas/validation/CustomIsoparser.kt | 2 +- .../schemas/validation/DefaultValueMethod.kt | 8 + .../validation/DependentRequiredValidator.kt | 2 +- .../validation/DependentSchemasValidator.kt | 3 +- .../schemas/validation/DoubleEnumValidator.kt | 9 + .../schemas/validation/DoubleValueMethod.kt | 5 + .../schemas/validation/ElseValidator.kt | 2 +- .../schemas/validation/EnumValidator.kt | 3 +- .../validation/ExclusiveMaximumValidator.kt | 0 .../validation/ExclusiveMinimumValidator.kt | 0 .../schemas/validation/FloatEnumValidator.kt | 9 + .../schemas/validation/FloatValueMethod.kt | 5 + .../schemas/validation/FormatValidator.kt | 2 +- .../client/schemas/validation/FrozenList.kt | 1 + .../client/schemas/validation/FrozenMap.kt | 3 +- .../client/schemas/validation/IfValidator.kt | 2 +- .../validation/IntegerEnumValidator.kt | 9 + .../schemas/validation/IntegerValueMethod.kt | 5 + .../schemas/validation/ItemsValidator.kt | 0 .../client/schemas/validation/JsonSchema.kt | 8 +- .../schemas/validation/JsonSchemaFactory.kt | 5 +- .../schemas/validation/JsonSchemaInfo.kt | 108 +- .../client/schemas/validation/KeywordEntry.kt | 6 + .../schemas/validation/KeywordValidator.kt | 0 .../schemas/validation/LengthValidator.kt | 0 .../schemas/validation/ListSchemaValidator.kt | 0 .../schemas/validation/LongEnumValidator.kt | 9 + .../schemas/validation/LongValueMethod.kt | 5 + .../schemas/validation/MapSchemaValidator.kt | 0 .../client/schemas/validation/MapUtils.kt | 35 + .../validation/MaxContainsValidator.kt | 0 .../schemas/validation/MaxItemsValidator.kt | 0 .../schemas/validation/MaxLengthValidator.kt | 0 .../validation/MaxPropertiesValidator.kt | 2 +- .../schemas/validation/MaximumValidator.kt | 0 .../validation/MinContainsValidator.kt | 0 .../schemas/validation/MinItemsValidator.kt | 2 +- .../schemas/validation/MinLengthValidator.kt | 0 .../validation/MinPropertiesValidator.kt | 2 +- .../schemas/validation/MinimumValidator.kt | 2 +- .../schemas/validation/MultipleOfValidator.kt | 1 + .../client/schemas/validation/NotValidator.kt | 0 .../schemas/validation/NullEnumValidator.kt | 9 + .../schemas/validation/NullSchemaValidator.kt | 0 .../schemas/validation/NullValueMethod.kt | 5 + .../validation/NumberSchemaValidator.kt | 0 .../schemas/validation/OneOfValidator.kt | 2 +- .../schemas/validation/PathToSchemasMap.kt | 0 .../validation/PatternPropertiesValidator.kt | 0 .../schemas/validation/PatternValidator.kt | 1 + .../validation/PrefixItemsValidator.kt | 3 +- .../schemas/validation/PropertiesValidator.kt | 0 .../validation/PropertyNamesValidator.kt | 0 .../schemas/validation/RequiredValidator.kt | 0 .../schemas/validation/StringEnumValidator.kt | 9 + .../validation/StringSchemaValidator.kt | 0 .../schemas/validation/StringValueMethod.kt | 5 + .../schemas/validation/ThenValidator.kt | 2 +- .../schemas/validation/TypeValidator.kt | 23 +- .../validation/UnevaluatedItemsValidator.kt | 2 +- .../UnevaluatedPropertiesValidator.kt | 0 .../validation/UniqueItemsValidator.kt | 0 .../validation/UnsetAnyTypeJsonSchema.kt | 10 +- .../schemas/validation/ValidationData.kt | 11 + .../schemas/validation/ValidationMetadata.kt | 2 +- .../client/servers/RootServer0.kt | 6 + .../client/servers/Server.kt | 5 +- .../client/servers/ServerProvider.kt | 6 + .../client/servers/ServerWithVariables.kt | 20 + .../client/servers/ServerWithoutVariables.kt | 8 + ...iesAllowsASchemaWhichShouldValidateTest.kt | 79 + ...tionalpropertiesAreAllowedByDefaultTest.kt | 37 + ...dditionalpropertiesCanExistByItselfTest.kt | 48 + ...ropertiesShouldNotLookInApplicatorsTest.kt | 56 + .../AllofCombinedWithAnyofOneofTest.kt | 122 + .../schemas/AllofSimpleTypesTest.kt | 38 + .../client/components/schemas/AllofTest.kt | 94 + .../schemas/AllofWithBaseSchemaTest.kt | 125 + .../schemas/AllofWithOneEmptySchemaTest.kt | 24 + .../AllofWithTheFirstEmptySchemaTest.kt | 38 + .../AllofWithTheLastEmptySchemaTest.kt | 38 + .../schemas/AllofWithTwoEmptySchemasTest.kt | 24 + .../schemas/AnyofComplexTypesTest.kt | 86 + .../client/components/schemas/AnyofTest.kt | 58 + .../schemas/AnyofWithBaseSchemaTest.kt | 52 + .../schemas/AnyofWithOneEmptySchemaTest.kt | 34 + .../schemas/ArrayTypeMatchesArraysTest.kt | 110 + .../schemas/BooleanTypeMatchesBooleansTest.kt | 148 + .../client/components/schemas/ByIntTest.kt | 48 + .../client/components/schemas/ByNumberTest.kt | 48 + .../components/schemas/BySmallNumberTest.kt | 38 + .../components/schemas/DateTimeFormatTest.kt | 76 + .../components/schemas/EmailFormatTest.kt | 76 + .../schemas/EnumWith0DoesNotMatchFalseTest.kt | 48 + .../schemas/EnumWith1DoesNotMatchTrueTest.kt | 48 + .../schemas/EnumWithEscapedCharactersTest.kt | 48 + .../schemas/EnumWithFalseDoesNotMatch0Test.kt | 52 + .../schemas/EnumWithTrueDoesNotMatch1Test.kt | 52 + .../schemas/EnumsInPropertiesTest.kt | 128 + .../schemas/ForbiddenPropertyTest.kt | 56 + .../components/schemas/HostnameFormatTest.kt | 76 + .../schemas/IntegerTypeMatchesIntegersTest.kt | 134 + ...ldNotRaiseErrorWhenFloatDivisionInfTest.kt | 38 + .../InvalidStringValueForDefaultTest.kt | 40 + .../components/schemas/Ipv4FormatTest.kt | 76 + .../components/schemas/Ipv6FormatTest.kt | 76 + .../schemas/JsonPointerFormatTest.kt | 76 + .../schemas/MaximumValidationTest.kt | 58 + ...aximumValidationWithUnsignedIntegerTest.kt | 58 + .../schemas/MaxitemsValidationTest.kt | 67 + .../schemas/MaxlengthValidationTest.kt | 68 + ...Maxproperties0MeansTheObjectIsEmptyTest.kt | 44 + .../schemas/MaxpropertiesValidationTest.kt | 109 + .../schemas/MinimumValidationTest.kt | 58 + .../MinimumValidationWithSignedIntegerTest.kt | 92 + .../schemas/MinitemsValidationTest.kt | 64 + .../schemas/MinlengthValidationTest.kt | 72 + .../schemas/MinpropertiesValidationTest.kt | 94 + ...stedAllofToCheckValidationSemanticsTest.kt | 38 + ...stedAnyofToCheckValidationSemanticsTest.kt | 38 + .../components/schemas/NestedItemsTest.kt | 137 + ...stedOneofToCheckValidationSemanticsTest.kt | 38 + .../schemas/NotMoreComplexSchemaTest.kt | 58 + .../client/components/schemas/NotTest.kt | 38 + .../schemas/NulCharactersInStringsTest.kt | 38 + .../NullTypeMatchesOnlyTheNullObjectTest.kt | 152 + .../schemas/NumberTypeMatchesNumbersTest.kt | 130 + .../schemas/ObjectPropertiesValidationTest.kt | 119 + .../schemas/ObjectTypeMatchesObjectsTest.kt | 110 + .../schemas/OneofComplexTypesTest.kt | 90 + .../client/components/schemas/OneofTest.kt | 62 + .../schemas/OneofWithBaseSchemaTest.kt | 52 + .../schemas/OneofWithEmptySchemaTest.kt | 38 + .../schemas/OneofWithRequiredTest.kt | 98 + .../schemas/PatternIsNotAnchoredTest.kt | 24 + .../schemas/PatternValidationTest.kt | 100 + .../PropertiesWithEscapedCharactersTest.kt | 88 + ...PropertyNamedRefThatIsNotAReferenceTest.kt | 48 + .../schemas/RefInAdditionalpropertiesTest.kt | 58 + .../components/schemas/RefInAllofTest.kt | 48 + .../components/schemas/RefInAnyofTest.kt | 48 + .../components/schemas/RefInItemsTest.kt | 54 + .../client/components/schemas/RefInNotTest.kt | 48 + .../components/schemas/RefInOneofTest.kt | 48 + .../components/schemas/RefInPropertyTest.kt | 58 + .../schemas/RequiredDefaultValidationTest.kt | 25 + .../schemas/RequiredValidationTest.kt | 79 + .../schemas/RequiredWithEmptyArrayTest.kt | 25 + .../RequiredWithEscapedCharactersTest.kt | 72 + .../schemas/SimpleEnumValidationTest.kt | 38 + .../schemas/StringTypeMatchesStringsTest.kt | 130 + ...NotDoAnythingIfThePropertyIsMissingTest.kt | 59 + .../schemas/UniqueitemsFalseValidationTest.kt | 312 ++ .../schemas/UniqueitemsValidationTest.kt | 577 +++ .../components/schemas/UriFormatTest.kt | 76 + .../schemas/UriReferenceFormatTest.kt | 76 + .../schemas/UriTemplateFormatTest.kt | 76 + .../JsonSchemaKeywordFlagsTest.kt | 141 + .../client/schemas/AnyTypeSchemaTest.kt | 113 + .../client/schemas/ArrayTypeSchemaTest.kt | 251 + .../client/schemas/BooleanSchemaTest.kt | 53 + .../client/schemas/ListBuilderTest.kt | 55 + .../client/schemas/ListSchemaTest.kt | 49 + .../client/schemas/MapSchemaTest.kt | 50 + .../client/schemas/NullSchemaTest.kt | 46 + .../client/schemas/NumberSchemaTest.kt | 66 + .../client/schemas/ObjectTypeSchemaTest.kt | 569 +++ .../client/schemas/RefBooleanSchemaTest.kt | 67 + .../AdditionalPropertiesValidatorTest.kt | 140 + .../schemas/validation/CustomIsoparserTest.kt | 25 + .../schemas/validation/FormatValidatorTest.kt | 418 ++ .../schemas/validation/ItemsValidatorTest.kt | 120 + .../schemas/validation/JsonSchemaTest.kt | 71 + .../validation/PropertiesValidatorTest.kt | 123 + .../validation/RequiredValidatorTest.kt | 110 + .../schemas/validation/TypeValidatorTest.kt | 54 + .../petstore/kotlin/.openapi-generator/FILES | 2000 -------- samples/client/petstore/kotlin/README.md | 474 -- .../docs/apis/paths/Anotherfakedummy.md | 119 - .../docs/apis/paths/Commonparamsubdir.md | 321 -- .../petstore/kotlin/docs/apis/paths/Fake.md | 460 -- ...akeadditionalpropertieswitharrayofenums.md | 105 - .../docs/apis/paths/Fakebodywithfileschema.md | 119 - .../apis/paths/Fakebodywithqueryparams.md | 143 - .../apis/paths/Fakecasesensitiveparams.md | 120 - .../docs/apis/paths/Fakeclassnametest.md | 131 - .../docs/apis/paths/Fakedeletecoffeeid.md | 120 - .../kotlin/docs/apis/paths/Fakehealth.md | 103 - .../paths/Fakeinlineadditionalproperties.md | 117 - .../docs/apis/paths/Fakeinlinecomposition.md | 112 - .../docs/apis/paths/Fakejsonformdata.md | 105 - .../kotlin/docs/apis/paths/Fakejsonpatch.md | 105 - .../docs/apis/paths/Fakejsonwithcharset.md | 105 - .../Fakemultiplerequestbodycontenttypes.md | 107 - .../apis/paths/Fakemultipleresponsebodies.md | 109 - .../docs/apis/paths/Fakemultiplesecurities.md | 120 - .../kotlin/docs/apis/paths/Fakeobjinquery.md | 102 - .../Fakeparametercollisions1ababselfab.md | 128 - .../docs/apis/paths/Fakepemcontenttype.md | 105 - .../Fakepetiduploadimagewithrequiredfile.md | 128 - .../Fakequeryparamwithjsoncontenttype.md | 114 - .../kotlin/docs/apis/paths/Fakeredirection.md | 105 - .../docs/apis/paths/Fakerefobjinquery.md | 102 - .../docs/apis/paths/Fakerefsarraymodel.md | 107 - .../docs/apis/paths/Fakerefsarrayofenums.md | 105 - .../kotlin/docs/apis/paths/Fakerefsboolean.md | 107 - ...erefscomposedoneofnumberwithvalidations.md | 107 - .../kotlin/docs/apis/paths/Fakerefsenum.md | 107 - .../kotlin/docs/apis/paths/Fakerefsmammal.md | 110 - .../kotlin/docs/apis/paths/Fakerefsnumber.md | 107 - .../paths/Fakerefsobjectmodelwithrefprops.md | 107 - .../kotlin/docs/apis/paths/Fakerefsstring.md | 107 - .../apis/paths/Fakeresponsewithoutschema.md | 101 - .../docs/apis/paths/Faketestqueryparamters.md | 141 - .../docs/apis/paths/Fakeuploaddownloadfile.md | 115 - .../kotlin/docs/apis/paths/Fakeuploadfile.md | 107 - .../kotlin/docs/apis/paths/Fakeuploadfiles.md | 107 - .../docs/apis/paths/Fakewildcardresponses.md | 122 - .../petstore/kotlin/docs/apis/paths/Foo.md | 102 - .../petstore/kotlin/docs/apis/paths/Pet.md | 315 -- .../kotlin/docs/apis/paths/Petfindbystatus.md | 137 - .../kotlin/docs/apis/paths/Petfindbytags.md | 134 - .../kotlin/docs/apis/paths/Petpetid.md | 377 -- .../docs/apis/paths/Petpetiduploadimage.md | 128 - .../kotlin/docs/apis/paths/Solidus.md | 101 - .../kotlin/docs/apis/paths/Storeinventory.md | 117 - .../kotlin/docs/apis/paths/Storeorder.md | 137 - .../docs/apis/paths/Storeorderorderid.md | 233 - .../petstore/kotlin/docs/apis/paths/User.md | 133 - .../docs/apis/paths/Usercreatewitharray.md | 155 - .../docs/apis/paths/Usercreatewithlist.md | 155 - .../kotlin/docs/apis/paths/Userlogin.md | 129 - .../kotlin/docs/apis/paths/Userlogout.md | 103 - .../kotlin/docs/apis/paths/Userusername.md | 369 -- .../kotlin/docs/apis/tags/Anotherfake.md | 119 - .../petstore/kotlin/docs/apis/tags/Default.md | 103 - .../petstore/kotlin/docs/apis/tags/Fake.md | 4304 ----------------- .../docs/apis/tags/Fakeclassnametags123.md | 131 - .../petstore/kotlin/docs/apis/tags/Pet.md | 1155 ----- .../petstore/kotlin/docs/apis/tags/Store.md | 462 -- .../petstore/kotlin/docs/apis/tags/User.md | 980 ---- .../headers/Int32JsonContentTypeHeader.md | 59 - .../docs/components/headers/NumberHeader.md | 40 - .../headers/RefContentSchemaHeader.md | 59 - .../components/headers/RefSchemaHeader.md | 40 - .../components/headers/RefStringHeader.md | 20 - .../docs/components/headers/StringHeader.md | 40 - .../Int32JsonContentTypeHeaderSchema.md | 49 - .../numberheader/NumberHeaderSchema.md | 49 - .../RefContentSchemaHeaderSchema.md | 19 - .../refschemaheader/RefSchemaHeaderSchema.md | 19 - .../stringheader/StringHeaderSchema.md | 49 - .../ComponentRefSchemaStringWithValidation.md | 60 - .../components/parameters/PathUserName.md | 41 - .../components/parameters/RefPathUserName.md | 20 - .../RefSchemaStringWithValidation.md | 41 - .../applicationjson/ApplicationjsonSchema.md | 19 - .../parameters/pathusername/Schema.md | 49 - .../refschemastringwithvalidation/Schema.md | 19 - .../docs/components/requestbodies/Client.md | 93 - .../docs/components/requestbodies/Pet.md | 131 - .../components/requestbodies/RefUserArray.md | 20 - .../components/requestbodies/UserArray.md | 93 - .../applicationjson/ApplicationjsonSchema.md | 19 - .../applicationjson/ApplicationjsonSchema.md | 19 - .../applicationxml/ApplicationxmlSchema.md | 19 - .../applicationjson/ApplicationjsonSchema.md | 156 - .../components/responses/HeadersWithNoBody.md | 35 - .../responses/RefSuccessDescriptionOnly.md | 20 - .../RefSuccessfulXmlAndJsonArrayOfPet.md | 20 - .../responses/SuccessDescriptionOnly.md | 35 - .../SuccessInlineContentAndHeader.md | 90 - .../responses/SuccessWithJsonApiResponse.md | 90 - .../SuccessfulXmlAndJsonArrayOfPet.md | 126 - .../HeadersWithNoBodyHeadersSchema.md | 252 - .../headers/location/LocationSchema.md | 49 - .../applicationjson/ApplicationjsonSchema.md | 162 - .../applicationxml/ApplicationxmlSchema.md | 162 - ...cessInlineContentAndHeaderHeadersSchema.md | 252 - .../applicationjson/ApplicationjsonSchema.md | 157 - .../headers/someheader/SomeHeaderSchema.md | 49 - ...SuccessWithJsonApiResponseHeadersSchema.md | 527 -- .../applicationjson/ApplicationjsonSchema.md | 19 - .../components/schemas/AbstractStepMessage.md | 356 -- .../schemas/AdditionalPropertiesClass.md | 1419 ------ .../schemas/AdditionalPropertiesSchema.md | 839 ---- .../AdditionalPropertiesWithArrayOfEnums.md | 233 - .../kotlin/docs/components/schemas/Address.md | 162 - .../kotlin/docs/components/schemas/Animal.md | 259 - .../docs/components/schemas/AnimalFarm.md | 131 - .../components/schemas/AnyTypeAndFormat.md | 1608 ------ .../components/schemas/AnyTypeNotString.md | 207 - .../components/schemas/ApiResponseSchema.md | 254 - .../kotlin/docs/components/schemas/Apple.md | 318 -- .../docs/components/schemas/AppleReq.md | 351 -- .../components/schemas/ArrayHoldingAnyType.md | 263 - .../schemas/ArrayOfArrayOfNumberOnly.md | 392 -- .../docs/components/schemas/ArrayOfEnums.md | 124 - .../components/schemas/ArrayOfNumberOnly.md | 282 -- .../docs/components/schemas/ArrayTest.md | 792 --- .../schemas/ArrayWithValidationsInItems.md | 196 - .../kotlin/docs/components/schemas/Banana.md | 188 - .../docs/components/schemas/BananaReq.md | 354 -- .../kotlin/docs/components/schemas/Bar.md | 84 - .../docs/components/schemas/BasquePig.md | 232 - .../docs/components/schemas/BooleanEnum.md | 98 - .../docs/components/schemas/BooleanSchema.md | 52 - .../docs/components/schemas/Capitalization.md | 382 -- .../kotlin/docs/components/schemas/Cat.md | 324 -- .../docs/components/schemas/Category.md | 262 - .../docs/components/schemas/ChildCat.md | 324 -- .../docs/components/schemas/ClassModel.md | 253 - .../kotlin/docs/components/schemas/Client.md | 169 - .../schemas/ComplexQuadrilateral.md | 371 -- ...omposedAnyOfDifferentTypesNoValidations.md | 956 ---- .../docs/components/schemas/ComposedArray.md | 260 - .../docs/components/schemas/ComposedBool.md | 217 - .../docs/components/schemas/ComposedNone.md | 217 - .../docs/components/schemas/ComposedNumber.md | 217 - .../docs/components/schemas/ComposedObject.md | 194 - .../schemas/ComposedOneOfDifferentTypes.md | 615 --- .../docs/components/schemas/ComposedString.md | 217 - .../docs/components/schemas/Currency.md | 99 - .../docs/components/schemas/DanishPig.md | 232 - .../docs/components/schemas/DateTimeTest.md | 85 - .../schemas/DateTimeWithValidations.md | 85 - .../components/schemas/DateWithValidations.md | 85 - .../docs/components/schemas/DecimalPayload.md | 52 - .../kotlin/docs/components/schemas/Dog.md | 324 -- .../kotlin/docs/components/schemas/Drawing.md | 277 -- .../docs/components/schemas/EnumArrays.md | 416 -- .../docs/components/schemas/EnumClass.md | 103 - .../docs/components/schemas/EnumTest.md | 597 --- .../components/schemas/EquilateralTriangle.md | 371 -- .../kotlin/docs/components/schemas/File.md | 175 - .../components/schemas/FileSchemaTestClass.md | 240 - .../kotlin/docs/components/schemas/Foo.md | 129 - .../docs/components/schemas/FormatTest.md | 1696 ------- .../docs/components/schemas/FromSchema.md | 214 - .../kotlin/docs/components/schemas/Fruit.md | 251 - .../docs/components/schemas/FruitReq.md | 207 - .../kotlin/docs/components/schemas/GmFruit.md | 251 - .../components/schemas/GrandparentAnimal.md | 185 - .../components/schemas/HasOnlyReadOnly.md | 211 - .../components/schemas/HealthCheckResult.md | 231 - .../docs/components/schemas/IntegerEnum.md | 142 - .../docs/components/schemas/IntegerEnumBig.md | 142 - .../components/schemas/IntegerEnumOneValue.md | 134 - .../schemas/IntegerEnumWithDefaultValue.md | 143 - .../docs/components/schemas/IntegerMax10.md | 85 - .../docs/components/schemas/IntegerMin15.md | 85 - .../components/schemas/IsoscelesTriangle.md | 371 -- .../kotlin/docs/components/schemas/Items.md | 160 - .../docs/components/schemas/ItemsSchema.md | 253 - .../components/schemas/JSONPatchRequest.md | 282 -- .../schemas/JSONPatchRequestAddReplaceTest.md | 678 --- .../schemas/JSONPatchRequestMoveCopy.md | 552 --- .../schemas/JSONPatchRequestRemove.md | 437 -- .../kotlin/docs/components/schemas/Mammal.md | 169 - .../kotlin/docs/components/schemas/MapTest.md | 753 --- ...dPropertiesAndAdditionalPropertiesClass.md | 345 -- .../kotlin/docs/components/schemas/Money.md | 347 -- .../schemas/MultiPropertiesSchema.md | 463 -- .../docs/components/schemas/MyObjectDto.md | 293 -- .../kotlin/docs/components/schemas/Name.md | 354 -- .../schemas/NoAdditionalProperties.md | 357 -- .../docs/components/schemas/NullableClass.md | 2041 -------- .../docs/components/schemas/NullableShape.md | 210 - .../docs/components/schemas/NullableString.md | 110 - .../docs/components/schemas/NumberOnly.md | 172 - .../docs/components/schemas/NumberSchema.md | 52 - .../schemas/NumberWithExclusiveMinMax.md | 85 - .../schemas/NumberWithValidations.md | 85 - .../schemas/ObjWithRequiredProps.md | 186 - .../schemas/ObjWithRequiredPropsBase.md | 185 - .../components/schemas/ObjectInterface.md | 52 - .../ObjectModelWithArgAndArgsProperties.md | 259 - .../schemas/ObjectModelWithRefProps.md | 139 - ...ithAllOfWithReqTestPropFromUnsetAddProp.md | 350 -- .../schemas/ObjectWithCollidingProperties.md | 210 - .../schemas/ObjectWithDecimalProperties.md | 187 - .../ObjectWithDifficultlyNamedProps.md | 276 -- .../ObjectWithInlineCompositionProperty.md | 362 -- .../ObjectWithInvalidNamedRefedProperties.md | 196 - .../ObjectWithNonIntersectingValues.md | 205 - .../schemas/ObjectWithOnlyOptionalProps.md | 478 -- .../schemas/ObjectWithOptionalTestProp.md | 169 - .../schemas/ObjectWithValidations.md | 61 - .../kotlin/docs/components/schemas/Order.md | 438 -- .../schemas/PaginatedResultMyObjectDto.md | 458 -- .../docs/components/schemas/ParentPet.md | 61 - .../kotlin/docs/components/schemas/Pet.md | 652 --- .../kotlin/docs/components/schemas/Pig.md | 169 - .../kotlin/docs/components/schemas/Player.md | 174 - .../docs/components/schemas/PublicKey.md | 172 - .../docs/components/schemas/Quadrilateral.md | 169 - .../schemas/QuadrilateralInterface.md | 386 -- .../docs/components/schemas/ReadOnlyFirst.md | 211 - .../kotlin/docs/components/schemas/RefPet.md | 22 - .../schemas/ReqPropsFromExplicitAddProps.md | 211 - .../schemas/ReqPropsFromTrueAddProps.md | 344 -- .../schemas/ReqPropsFromUnsetAddProps.md | 210 - .../docs/components/schemas/ReturnSchema.md | 257 - .../components/schemas/ScaleneTriangle.md | 371 -- .../components/schemas/Schema200Response.md | 297 -- .../schemas/SelfReferencingArrayModel.md | 119 - .../schemas/SelfReferencingObjectModel.md | 122 - .../kotlin/docs/components/schemas/Shape.md | 169 - .../docs/components/schemas/ShapeOrNull.md | 210 - .../components/schemas/SimpleQuadrilateral.md | 371 -- .../docs/components/schemas/SomeObject.md | 169 - .../components/schemas/SpecialModelname.md | 172 - .../components/schemas/StringBooleanMap.md | 159 - .../docs/components/schemas/StringEnum.md | 143 - .../schemas/StringEnumWithDefaultValue.md | 101 - .../docs/components/schemas/StringSchema.md | 52 - .../schemas/StringWithValidation.md | 84 - .../kotlin/docs/components/schemas/Tag.md | 214 - .../docs/components/schemas/Triangle.md | 169 - .../components/schemas/TriangleInterface.md | 386 -- .../docs/components/schemas/UUIDString.md | 85 - .../kotlin/docs/components/schemas/User.md | 1109 ----- .../kotlin/docs/components/schemas/Whale.md | 316 -- .../kotlin/docs/components/schemas/Zebra.md | 456 -- .../docs/components/securityschemes/ApiKey.md | 22 - .../components/securityschemes/ApiKeyQuery.md | 22 - .../components/securityschemes/BearerTest.md | 22 - .../securityschemes/HttpBasicTest.md | 22 - .../securityschemes/HttpSignatureTest.md | 22 - .../securityschemes/OpenIdConnectTest.md | 22 - .../securityschemes/PetstoreAuth.md | 22 - .../anotherfakedummy/AnotherfakedummyPatch.md | 188 - .../patch/AnotherfakedummyPatchRequestBody.md | 17 - .../patch/AnotherfakedummyPatchResponses.md | 29 - .../AnotherfakedummyPatchCode200Response.md | 87 - .../applicationjson/ApplicationjsonSchema.md | 19 - .../CommonparamsubdirDelete.md | 189 - .../commonparamsubdir/CommonparamsubdirGet.md | 189 - .../CommonparamsubdirPost.md | 189 - ...CommonparamsubdirDeleteHeaderParameters.md | 252 - .../CommonparamsubdirDeletePathParameters.md | 269 -- .../CommonparamsubdirDeleteResponses.md | 29 - .../delete/parameters/parameter0/Schema0.md | 49 - .../delete/parameters/parameter1/Schema1.md | 96 - .../CommonparamsubdirDeleteCode200Response.md | 17 - .../get/CommonparamsubdirGetPathParameters.md | 269 -- .../CommonparamsubdirGetQueryParameters.md | 252 - .../get/CommonparamsubdirGetResponses.md | 29 - .../get/parameters/parameter0/Schema0.md | 49 - .../CommonparamsubdirGetCode200Response.md | 17 - .../routeparameter0/RouteParamSchema0.md | 96 - .../CommonparamsubdirPostHeaderParameters.md | 252 - .../CommonparamsubdirPostPathParameters.md | 269 -- .../post/CommonparamsubdirPostResponses.md | 29 - .../post/parameters/parameter0/Schema0.md | 49 - .../CommonparamsubdirPostCode200Response.md | 17 - .../kotlin/docs/paths/fake/FakeDelete.md | 255 - .../kotlin/docs/paths/fake/FakeGet.md | 156 - .../kotlin/docs/paths/fake/FakePatch.md | 188 - .../kotlin/docs/paths/fake/FakePost.md | 164 - .../fake/delete/FakeDeleteHeaderParameters.md | 274 -- .../fake/delete/FakeDeleteQueryParameters.md | 321 -- .../paths/fake/delete/FakeDeleteResponses.md | 29 - .../fake/delete/FakeDeleteSecurityInfo.md | 40 - .../delete/parameters/parameter0/Schema0.md | 49 - .../delete/parameters/parameter1/Schema1.md | 96 - .../delete/parameters/parameter2/Schema2.md | 49 - .../delete/parameters/parameter3/Schema3.md | 49 - .../delete/parameters/parameter4/Schema4.md | 96 - .../delete/parameters/parameter5/Schema5.md | 49 - .../responses/FakeDeleteCode200Response.md | 17 - .../FakeDeleteSecurityRequirementObject0.md | 15 - .../paths/fake/get/FakeGetHeaderParameters.md | 260 - .../paths/fake/get/FakeGetQueryParameters.md | 278 -- .../docs/paths/fake/get/FakeGetRequestBody.md | 90 - .../docs/paths/fake/get/FakeGetResponses.md | 29 - .../fake/get/parameters/parameter0/Schema0.md | 205 - .../fake/get/parameters/parameter1/Schema1.md | 98 - .../fake/get/parameters/parameter2/Schema2.md | 205 - .../fake/get/parameters/parameter3/Schema3.md | 98 - .../fake/get/parameters/parameter4/Schema4.md | 135 - .../fake/get/parameters/parameter5/Schema5.md | 109 - .../ApplicationxwwwformurlencodedSchema.md | 422 -- .../get/responses/FakeGetCode200Response.md | 17 - .../get/responses/FakeGetCode404Response.md | 87 - .../applicationjson/ApplicationjsonSchema.md | 49 - .../paths/fake/patch/FakePatchRequestBody.md | 17 - .../paths/fake/patch/FakePatchResponses.md | 29 - .../responses/FakePatchCode200Response.md | 87 - .../applicationjson/ApplicationjsonSchema.md | 19 - .../paths/fake/post/FakePostRequestBody.md | 90 - .../docs/paths/fake/post/FakePostResponses.md | 29 - .../paths/fake/post/FakePostSecurityInfo.md | 40 - .../ApplicationxwwwformurlencodedSchema.md | 1331 ----- .../post/responses/FakePostCode200Response.md | 17 - .../post/responses/FakePostCode404Response.md | 32 - .../FakePostSecurityRequirementObject0.md | 15 - ...additionalpropertieswitharrayofenumsGet.md | 148 - ...ropertieswitharrayofenumsGetRequestBody.md | 90 - ...lpropertieswitharrayofenumsGetResponses.md | 29 - .../applicationjson/ApplicationjsonSchema.md | 19 - ...rtieswitharrayofenumsGetCode200Response.md | 87 - .../applicationjson/ApplicationjsonSchema.md | 19 - .../FakebodywithfileschemaPut.md | 188 - .../FakebodywithfileschemaPutRequestBody.md | 90 - .../put/FakebodywithfileschemaPutResponses.md | 29 - .../applicationjson/ApplicationjsonSchema.md | 19 - ...akebodywithfileschemaPutCode200Response.md | 17 - .../FakebodywithqueryparamsPut.md | 249 - ...kebodywithqueryparamsPutQueryParameters.md | 268 - .../FakebodywithqueryparamsPutRequestBody.md | 90 - .../FakebodywithqueryparamsPutResponses.md | 29 - .../put/parameters/parameter0/Schema0.md | 49 - .../applicationjson/ApplicationjsonSchema.md | 19 - ...kebodywithqueryparamsPutCode200Response.md | 17 - .../FakecasesensitiveparamsPut.md | 189 - ...kecasesensitiveparamsPutQueryParameters.md | 375 -- .../FakecasesensitiveparamsPutResponses.md | 29 - .../put/parameters/parameter0/Schema0.md | 49 - .../put/parameters/parameter1/Schema1.md | 49 - .../put/parameters/parameter2/Schema2.md | 49 - ...kecasesensitiveparamsPutCode200Response.md | 17 - .../FakeclassnametestPatch.md | 203 - .../FakeclassnametestPatchRequestBody.md | 17 - .../patch/FakeclassnametestPatchResponses.md | 29 - .../FakeclassnametestPatchSecurityInfo.md | 40 - .../FakeclassnametestPatchCode200Response.md | 87 - .../applicationjson/ApplicationjsonSchema.md | 19 - ...nametestPatchSecurityRequirementObject0.md | 15 - .../FakedeletecoffeeidDelete.md | 189 - .../FakedeletecoffeeidDeletePathParameters.md | 268 - .../FakedeletecoffeeidDeleteResponses.md | 40 - .../delete/parameters/parameter0/Schema0.md | 49 - ...FakedeletecoffeeidDeleteCode200Response.md | 17 - ...deletecoffeeidDeleteCodedefaultResponse.md | 32 - .../docs/paths/fakehealth/FakehealthGet.md | 144 - .../fakehealth/get/FakehealthGetResponses.md | 29 - .../responses/FakehealthGetCode200Response.md | 87 - .../applicationjson/ApplicationjsonSchema.md | 19 - .../FakeinlineadditionalpropertiesPost.md | 186 - ...lineadditionalpropertiesPostRequestBody.md | 90 - ...inlineadditionalpropertiesPostResponses.md | 29 - .../applicationjson/ApplicationjsonSchema.md | 156 - ...additionalpropertiesPostCode200Response.md | 17 - .../FakeinlinecompositionPost.md | 155 - ...akeinlinecompositionPostQueryParameters.md | 264 - .../FakeinlinecompositionPostRequestBody.md | 128 - .../FakeinlinecompositionPostResponses.md | 29 - .../post/parameters/parameter0/Schema0.md | 236 - .../post/parameters/parameter1/Schema1.md | 359 -- .../applicationjson/ApplicationjsonSchema.md | 236 - .../MultipartformdataSchema.md | 359 -- ...akeinlinecompositionPostCode200Response.md | 123 - .../applicationjson/ApplicationjsonSchema.md | 236 - .../MultipartformdataSchema.md | 359 -- .../fakejsonformdata/FakejsonformdataGet.md | 146 - .../get/FakejsonformdataGetRequestBody.md | 90 - .../get/FakejsonformdataGetResponses.md | 29 - .../ApplicationxwwwformurlencodedSchema.md | 262 - .../FakejsonformdataGetCode200Response.md | 17 - .../paths/fakejsonpatch/FakejsonpatchPatch.md | 146 - .../patch/FakejsonpatchPatchRequestBody.md | 90 - .../patch/FakejsonpatchPatchResponses.md | 29 - .../ApplicationjsonpatchjsonSchema.md | 19 - .../FakejsonpatchPatchCode200Response.md | 17 - .../FakejsonwithcharsetPost.md | 148 - .../FakejsonwithcharsetPostRequestBody.md | 90 - .../post/FakejsonwithcharsetPostResponses.md | 29 - .../Applicationjsoncharsetutf8Schema.md | 144 - .../FakejsonwithcharsetPostCode200Response.md | 87 - .../Applicationjsoncharsetutf8Schema.md | 144 - ...FakemultiplerequestbodycontenttypesPost.md | 148 - ...erequestbodycontenttypesPostRequestBody.md | 128 - ...plerequestbodycontenttypesPostResponses.md | 29 - .../applicationjson/ApplicationjsonSchema.md | 166 - .../MultipartformdataSchema.md | 166 - ...uestbodycontenttypesPostCode200Response.md | 87 - .../applicationjson/ApplicationjsonSchema.md | 144 - .../FakemultipleresponsebodiesGet.md | 150 - .../FakemultipleresponsebodiesGetResponses.md | 40 - ...ultipleresponsebodiesGetCode200Response.md | 87 - ...ultipleresponsebodiesGetCode202Response.md | 87 - .../applicationjson/ApplicationjsonSchema.md | 144 - .../applicationjson/ApplicationjsonSchema.md | 144 - .../FakemultiplesecuritiesGet.md | 163 - .../get/FakemultiplesecuritiesGetResponses.md | 29 - .../FakemultiplesecuritiesGetSecurityInfo.md | 44 - ...akemultiplesecuritiesGetCode200Response.md | 87 - .../applicationjson/ApplicationjsonSchema.md | 144 - ...securitiesGetSecurityRequirementObject0.md | 15 - ...securitiesGetSecurityRequirementObject1.md | 15 - ...securitiesGetSecurityRequirementObject2.md | 15 - .../paths/fakeobjinquery/FakeobjinqueryGet.md | 145 - .../get/FakeobjinqueryGetQueryParameters.md | 258 - .../get/FakeobjinqueryGetResponses.md | 29 - .../get/parameters/parameter0/Schema0.md | 166 - .../FakeobjinqueryGetCode200Response.md | 17 - .../Fakeparametercollisions1ababselfabPost.md | 211 - ...llisions1ababselfabPostCookieParameters.md | 267 - ...llisions1ababselfabPostHeaderParameters.md | 263 - ...collisions1ababselfabPostPathParameters.md | 808 ---- ...ollisions1ababselfabPostQueryParameters.md | 267 - ...tercollisions1ababselfabPostRequestBody.md | 90 - ...metercollisions1ababselfabPostResponses.md | 29 - .../post/parameters/parameter0/Schema0.md | 49 - .../post/parameters/parameter1/Schema1.md | 49 - .../post/parameters/parameter10/Schema10.md | 49 - .../post/parameters/parameter11/Schema11.md | 49 - .../post/parameters/parameter12/Schema12.md | 49 - .../post/parameters/parameter13/Schema13.md | 49 - .../post/parameters/parameter14/Schema14.md | 49 - .../post/parameters/parameter15/Schema15.md | 49 - .../post/parameters/parameter16/Schema16.md | 49 - .../post/parameters/parameter17/Schema17.md | 49 - .../post/parameters/parameter18/Schema18.md | 49 - .../post/parameters/parameter2/Schema2.md | 49 - .../post/parameters/parameter3/Schema3.md | 49 - .../post/parameters/parameter4/Schema4.md | 49 - .../post/parameters/parameter5/Schema5.md | 49 - .../post/parameters/parameter6/Schema6.md | 49 - .../post/parameters/parameter7/Schema7.md | 49 - .../post/parameters/parameter8/Schema8.md | 49 - .../post/parameters/parameter9/Schema9.md | 49 - .../applicationjson/ApplicationjsonSchema.md | 144 - ...ollisions1ababselfabPostCode200Response.md | 87 - .../applicationjson/ApplicationjsonSchema.md | 144 - .../FakepemcontenttypeGet.md | 148 - .../get/FakepemcontenttypeGetRequestBody.md | 90 - .../get/FakepemcontenttypeGetResponses.md | 29 - .../ApplicationxpemfileSchema.md | 49 - .../FakepemcontenttypeGetCode200Response.md | 87 - .../ApplicationxpemfileSchema.md | 49 - ...akepetiduploadimagewithrequiredfilePost.md | 203 - ...imagewithrequiredfilePostPathParameters.md | 271 -- ...oadimagewithrequiredfilePostRequestBody.md | 90 - ...ploadimagewithrequiredfilePostResponses.md | 29 - ...adimagewithrequiredfilePostSecurityInfo.md | 40 - .../post/parameters/parameter0/Schema0.md | 49 - .../MultipartformdataSchema.md | 206 - ...magewithrequiredfilePostCode200Response.md | 87 - .../applicationjson/ApplicationjsonSchema.md | 19 - ...uiredfilePostSecurityRequirementObject0.md | 15 - .../FakequeryparamwithjsoncontenttypeGet.md | 185 - ...amwithjsoncontenttypeGetQueryParameters.md | 274 -- ...eryparamwithjsoncontenttypeGetResponses.md | 29 - .../content/applicationjson/Schema0.md | 144 - ...amwithjsoncontenttypeGetCode200Response.md | 87 - .../applicationjson/ApplicationjsonSchema.md | 144 - .../fakeredirection/FakeredirectionGet.md | 146 - .../get/FakeredirectionGetResponses.md | 40 - .../FakeredirectionGetCode303Response.md | 32 - .../FakeredirectionGetCode3XXResponse.md | 32 - .../fakerefobjinquery/FakerefobjinqueryGet.md | 145 - .../FakerefobjinqueryGetQueryParameters.md | 258 - .../get/FakerefobjinqueryGetResponses.md | 29 - .../get/parameters/parameter0/Schema0.md | 19 - .../FakerefobjinqueryGetCode200Response.md | 17 - .../FakerefsarraymodelPost.md | 148 - .../post/FakerefsarraymodelPostRequestBody.md | 90 - .../post/FakerefsarraymodelPostResponses.md | 29 - .../applicationjson/ApplicationjsonSchema.md | 19 - .../FakerefsarraymodelPostCode200Response.md | 87 - .../applicationjson/ApplicationjsonSchema.md | 19 - .../FakerefsarrayofenumsPost.md | 148 - .../FakerefsarrayofenumsPostRequestBody.md | 90 - .../post/FakerefsarrayofenumsPostResponses.md | 29 - .../applicationjson/ApplicationjsonSchema.md | 19 - ...FakerefsarrayofenumsPostCode200Response.md | 87 - .../applicationjson/ApplicationjsonSchema.md | 19 - .../fakerefsboolean/FakerefsbooleanPost.md | 148 - .../post/FakerefsbooleanPostRequestBody.md | 90 - .../post/FakerefsbooleanPostResponses.md | 29 - .../applicationjson/ApplicationjsonSchema.md | 19 - .../FakerefsbooleanPostCode200Response.md | 87 - .../applicationjson/ApplicationjsonSchema.md | 19 - ...scomposedoneofnumberwithvalidationsPost.md | 148 - ...eofnumberwithvalidationsPostRequestBody.md | 90 - ...oneofnumberwithvalidationsPostResponses.md | 29 - .../applicationjson/ApplicationjsonSchema.md | 19 - ...umberwithvalidationsPostCode200Response.md | 87 - .../applicationjson/ApplicationjsonSchema.md | 19 - .../paths/fakerefsenum/FakerefsenumPost.md | 148 - .../post/FakerefsenumPostRequestBody.md | 90 - .../post/FakerefsenumPostResponses.md | 29 - .../applicationjson/ApplicationjsonSchema.md | 19 - .../FakerefsenumPostCode200Response.md | 87 - .../applicationjson/ApplicationjsonSchema.md | 19 - .../fakerefsmammal/FakerefsmammalPost.md | 179 - .../post/FakerefsmammalPostRequestBody.md | 90 - .../post/FakerefsmammalPostResponses.md | 29 - .../applicationjson/ApplicationjsonSchema.md | 19 - .../FakerefsmammalPostCode200Response.md | 87 - .../applicationjson/ApplicationjsonSchema.md | 19 - .../fakerefsnumber/FakerefsnumberPost.md | 148 - .../post/FakerefsnumberPostRequestBody.md | 90 - .../post/FakerefsnumberPostResponses.md | 29 - .../applicationjson/ApplicationjsonSchema.md | 19 - .../FakerefsnumberPostCode200Response.md | 87 - .../applicationjson/ApplicationjsonSchema.md | 19 - .../FakerefsobjectmodelwithrefpropsPost.md | 148 - ...sobjectmodelwithrefpropsPostRequestBody.md | 90 - ...efsobjectmodelwithrefpropsPostResponses.md | 29 - .../applicationjson/ApplicationjsonSchema.md | 19 - ...ectmodelwithrefpropsPostCode200Response.md | 87 - .../applicationjson/ApplicationjsonSchema.md | 19 - .../fakerefsstring/FakerefsstringPost.md | 148 - .../post/FakerefsstringPostRequestBody.md | 90 - .../post/FakerefsstringPostResponses.md | 29 - .../applicationjson/ApplicationjsonSchema.md | 19 - .../FakerefsstringPostCode200Response.md | 87 - .../applicationjson/ApplicationjsonSchema.md | 19 - .../FakeresponsewithoutschemaGet.md | 142 - .../FakeresponsewithoutschemaGetResponses.md | 29 - ...responsewithoutschemaGetCode200Response.md | 32 - .../FaketestqueryparamtersPut.md | 210 - ...aketestqueryparamtersPutQueryParameters.md | 1419 ------ .../put/FaketestqueryparamtersPutResponses.md | 29 - .../put/parameters/parameter0/Schema0.md | 156 - .../put/parameters/parameter1/Schema1.md | 156 - .../put/parameters/parameter2/Schema2.md | 156 - .../put/parameters/parameter3/Schema3.md | 156 - .../put/parameters/parameter4/Schema4.md | 156 - .../put/parameters/parameter5/Schema5.md | 19 - ...aketestqueryparamtersPutCode200Response.md | 17 - .../FakeuploaddownloadfilePost.md | 184 - .../FakeuploaddownloadfilePostRequestBody.md | 90 - .../FakeuploaddownloadfilePostResponses.md | 29 - .../ApplicationoctetstreamSchema.md | 28 - ...keuploaddownloadfilePostCode200Response.md | 87 - .../ApplicationoctetstreamSchema.md | 28 - .../fakeuploadfile/FakeuploadfilePost.md | 148 - .../post/FakeuploadfilePostRequestBody.md | 90 - .../post/FakeuploadfilePostResponses.md | 29 - .../MultipartformdataSchema.md | 206 - .../FakeuploadfilePostCode200Response.md | 87 - .../applicationjson/ApplicationjsonSchema.md | 19 - .../fakeuploadfiles/FakeuploadfilesPost.md | 148 - .../post/FakeuploadfilesPostRequestBody.md | 90 - .../post/FakeuploadfilesPostResponses.md | 29 - .../MultipartformdataSchema.md | 252 - .../FakeuploadfilesPostCode200Response.md | 87 - .../applicationjson/ApplicationjsonSchema.md | 19 - .../FakewildcardresponsesGet.md | 163 - .../get/FakewildcardresponsesGetResponses.md | 62 - ...FakewildcardresponsesGetCode1XXResponse.md | 87 - ...FakewildcardresponsesGetCode200Response.md | 87 - ...FakewildcardresponsesGetCode2XXResponse.md | 87 - ...FakewildcardresponsesGetCode3XXResponse.md | 87 - ...FakewildcardresponsesGetCode4XXResponse.md | 87 - ...FakewildcardresponsesGetCode5XXResponse.md | 87 - .../applicationjson/ApplicationjsonSchema.md | 144 - .../applicationjson/ApplicationjsonSchema.md | 144 - .../applicationjson/ApplicationjsonSchema.md | 144 - .../applicationjson/ApplicationjsonSchema.md | 144 - .../applicationjson/ApplicationjsonSchema.md | 144 - .../applicationjson/ApplicationjsonSchema.md | 144 - .../petstore/kotlin/docs/paths/foo/FooGet.md | 143 - .../docs/paths/foo/get/FooGetResponses.md | 29 - .../docs/paths/foo/get/FooGetServerInfo.md | 62 - .../responses/FooGetCodedefaultResponse.md | 87 - .../applicationjson/ApplicationjsonSchema.md | 134 - .../paths/foo/get/servers/FooGetServer0.md | 14 - .../paths/foo/get/servers/FooGetServer1.md | 16 - .../servers/server1/FooGetServer1Variables.md | 355 -- .../petstore/kotlin/docs/paths/pet/PetPost.md | 238 - .../petstore/kotlin/docs/paths/pet/PetPut.md | 234 - .../docs/paths/pet/post/PetPostRequestBody.md | 17 - .../docs/paths/pet/post/PetPostResponses.md | 29 - .../paths/pet/post/PetPostSecurityInfo.md | 44 - .../post/responses/PetPostCode200Response.md | 17 - .../post/responses/PetPostCode405Response.md | 32 - .../PetPostSecurityRequirementObject0.md | 15 - .../PetPostSecurityRequirementObject1.md | 15 - .../PetPostSecurityRequirementObject2.md | 15 - .../docs/paths/pet/put/PetPutRequestBody.md | 17 - .../docs/paths/pet/put/PetPutResponses.md | 10 - .../docs/paths/pet/put/PetPutSecurityInfo.md | 42 - .../put/responses/PetPutCode400Response.md | 32 - .../put/responses/PetPutCode404Response.md | 32 - .../put/responses/PetPutCode405Response.md | 32 - .../PetPutSecurityRequirementObject0.md | 15 - .../PetPutSecurityRequirementObject1.md | 15 - .../petfindbystatus/PetfindbystatusGet.md | 209 - .../PetfindbystatusServerInfo.md | 62 - .../get/PetfindbystatusGetQueryParameters.md | 271 -- .../get/PetfindbystatusGetResponses.md | 29 - .../get/PetfindbystatusGetSecurityInfo.md | 44 - .../get/parameters/parameter0/Schema0.md | 206 - .../PetfindbystatusGetCode200Response.md | 17 - .../PetfindbystatusGetCode400Response.md | 32 - ...ndbystatusGetSecurityRequirementObject0.md | 15 - ...ndbystatusGetSecurityRequirementObject1.md | 15 - ...ndbystatusGetSecurityRequirementObject2.md | 15 - .../servers/PetfindbystatusServer0.md | 14 - .../servers/PetfindbystatusServer1.md | 16 - .../PetfindbystatusServer1Variables.md | 355 -- .../paths/petfindbytags/PetfindbytagsGet.md | 206 - .../get/PetfindbytagsGetQueryParameters.md | 271 -- .../get/PetfindbytagsGetResponses.md | 29 - .../get/PetfindbytagsGetSecurityInfo.md | 42 - .../get/parameters/parameter0/Schema0.md | 156 - .../PetfindbytagsGetCode200Response.md | 17 - .../PetfindbytagsGetCode400Response.md | 32 - ...findbytagsGetSecurityRequirementObject0.md | 15 - ...findbytagsGetSecurityRequirementObject1.md | 15 - .../docs/paths/petpetid/PetpetidDelete.md | 207 - .../kotlin/docs/paths/petpetid/PetpetidGet.md | 211 - .../docs/paths/petpetid/PetpetidPost.md | 207 - .../delete/PetpetidDeleteHeaderParameters.md | 252 - .../delete/PetpetidDeletePathParameters.md | 271 -- .../delete/PetpetidDeleteResponses.md | 10 - .../delete/PetpetidDeleteSecurityInfo.md | 42 - .../delete/parameters/parameter0/Schema0.md | 49 - .../delete/parameters/parameter1/Schema1.md | 49 - .../PetpetidDeleteCode400Response.md | 32 - ...etpetidDeleteSecurityRequirementObject0.md | 15 - ...etpetidDeleteSecurityRequirementObject1.md | 15 - .../petpetid/get/PetpetidGetPathParameters.md | 271 -- .../petpetid/get/PetpetidGetResponses.md | 29 - .../petpetid/get/PetpetidGetSecurityInfo.md | 40 - .../get/parameters/parameter0/Schema0.md | 49 - .../responses/PetpetidGetCode200Response.md | 123 - .../responses/PetpetidGetCode400Response.md | 32 - .../responses/PetpetidGetCode404Response.md | 32 - .../applicationjson/ApplicationjsonSchema.md | 19 - .../applicationxml/ApplicationxmlSchema.md | 19 - .../PetpetidGetSecurityRequirementObject0.md | 15 - .../post/PetpetidPostPathParameters.md | 271 -- .../petpetid/post/PetpetidPostRequestBody.md | 90 - .../petpetid/post/PetpetidPostResponses.md | 10 - .../petpetid/post/PetpetidPostSecurityInfo.md | 42 - .../post/parameters/parameter0/Schema0.md | 49 - .../ApplicationxwwwformurlencodedSchema.md | 214 - .../responses/PetpetidPostCode405Response.md | 32 - .../PetpetidPostSecurityRequirementObject0.md | 15 - .../PetpetidPostSecurityRequirementObject1.md | 15 - .../PetpetiduploadimagePost.md | 203 - .../PetpetiduploadimagePostPathParameters.md | 271 -- .../PetpetiduploadimagePostRequestBody.md | 90 - .../post/PetpetiduploadimagePostResponses.md | 29 - .../PetpetiduploadimagePostSecurityInfo.md | 40 - .../post/parameters/parameter0/Schema0.md | 49 - .../MultipartformdataSchema.md | 190 - .../PetpetiduploadimagePostCode200Response.md | 17 - ...loadimagePostSecurityRequirementObject0.md | 15 - .../kotlin/docs/paths/solidus/SolidusGet.md | 142 - .../paths/solidus/get/SolidusGetResponses.md | 29 - .../responses/SolidusGetCode200Response.md | 17 - .../paths/storeinventory/StoreinventoryGet.md | 158 - .../get/StoreinventoryGetResponses.md | 29 - .../get/StoreinventoryGetSecurityInfo.md | 40 - .../StoreinventoryGetCode200Response.md | 17 - ...einventoryGetSecurityRequirementObject0.md | 15 - .../docs/paths/storeorder/StoreorderPost.md | 206 - .../post/StoreorderPostRequestBody.md | 90 - .../post/StoreorderPostResponses.md | 29 - .../applicationjson/ApplicationjsonSchema.md | 19 - .../StoreorderPostCode200Response.md | 123 - .../StoreorderPostCode400Response.md | 32 - .../applicationjson/ApplicationjsonSchema.md | 19 - .../applicationxml/ApplicationxmlSchema.md | 19 - .../StoreorderorderidDelete.md | 188 - .../storeorderorderid/StoreorderorderidGet.md | 196 - .../StoreorderorderidDeletePathParameters.md | 268 - .../StoreorderorderidDeleteResponses.md | 10 - .../delete/parameters/parameter0/Schema0.md | 49 - .../StoreorderorderidDeleteCode400Response.md | 32 - .../StoreorderorderidDeleteCode404Response.md | 32 - .../get/StoreorderorderidGetPathParameters.md | 271 -- .../get/StoreorderorderidGetResponses.md | 29 - .../get/parameters/parameter0/Schema0.md | 83 - .../StoreorderorderidGetCode200Response.md | 123 - .../StoreorderorderidGetCode400Response.md | 32 - .../StoreorderorderidGetCode404Response.md | 32 - .../applicationjson/ApplicationjsonSchema.md | 19 - .../applicationxml/ApplicationxmlSchema.md | 19 - .../kotlin/docs/paths/user/UserPost.md | 202 - .../paths/user/post/UserPostRequestBody.md | 90 - .../docs/paths/user/post/UserPostResponses.md | 29 - .../applicationjson/ApplicationjsonSchema.md | 19 - .../responses/UserPostCodedefaultResponse.md | 32 - .../UsercreatewitharrayPost.md | 224 - .../UsercreatewitharrayPostRequestBody.md | 17 - .../post/UsercreatewitharrayPostResponses.md | 29 - ...rcreatewitharrayPostCodedefaultResponse.md | 32 - .../UsercreatewithlistPost.md | 224 - .../post/UsercreatewithlistPostRequestBody.md | 17 - .../post/UsercreatewithlistPostResponses.md | 29 - ...ercreatewithlistPostCodedefaultResponse.md | 32 - .../docs/paths/userlogin/UserloginGet.md | 198 - .../get/UserloginGetQueryParameters.md | 304 -- .../userlogin/get/UserloginGetResponses.md | 29 - .../get/parameters/parameter0/Schema0.md | 49 - .../get/parameters/parameter1/Schema1.md | 49 - .../responses/UserloginGetCode200Response.md | 123 - .../responses/UserloginGetCode400Response.md | 32 - ...serloginGetCode200ResponseHeadersSchema.md | 389 -- .../applicationjson/ApplicationjsonSchema.md | 49 - .../applicationxml/ApplicationxmlSchema.md | 49 - .../xexpiresafter/XExpiresAfterSchema.md | 49 - .../applicationjson/XRateLimitSchema.md | 49 - .../docs/paths/userlogout/UserlogoutGet.md | 142 - .../userlogout/get/UserlogoutGetResponses.md | 29 - .../UserlogoutGetCodedefaultResponse.md | 17 - .../paths/userusername/UserusernameDelete.md | 189 - .../paths/userusername/UserusernameGet.md | 196 - .../paths/userusername/UserusernamePut.md | 252 - .../UserusernameDeletePathParameters.md | 268 - .../delete/UserusernameDeleteResponses.md | 29 - .../UserusernameDeleteCode200Response.md | 17 - .../UserusernameDeleteCode404Response.md | 32 - .../get/UserusernameGetPathParameters.md | 268 - .../get/UserusernameGetResponses.md | 29 - .../UserusernameGetCode200Response.md | 123 - .../UserusernameGetCode400Response.md | 32 - .../UserusernameGetCode404Response.md | 32 - .../applicationjson/ApplicationjsonSchema.md | 19 - .../applicationxml/ApplicationxmlSchema.md | 19 - .../put/UserusernamePutPathParameters.md | 268 - .../put/UserusernamePutRequestBody.md | 90 - .../put/UserusernamePutResponses.md | 10 - .../applicationjson/ApplicationjsonSchema.md | 19 - .../UserusernamePutCode400Response.md | 32 - .../UserusernamePutCode404Response.md | 32 - .../kotlin/docs/servers/RootServer0.md | 22 - .../kotlin/docs/servers/RootServer1.md | 22 - .../rootserver0/RootServer0Variables.md | 486 -- .../rootserver1/RootServer1Variables.md | 355 -- .../petstore/kotlin/settings.gradle.kts | 2 - .../client/RootServerInfo.kt | 77 - .../client/apiclient/ApiClient.kt | 39 - .../client/apis/paths/Anotherfakedummy.kt | 14 - .../client/apis/paths/Commonparamsubdir.kt | 18 - .../client/apis/paths/Fake.kt | 20 - ...akeadditionalpropertieswitharrayofenums.kt | 14 - .../apis/paths/Fakebodywithfileschema.kt | 14 - .../apis/paths/Fakebodywithqueryparams.kt | 14 - .../apis/paths/Fakecasesensitiveparams.kt | 14 - .../client/apis/paths/Fakeclassnametest.kt | 14 - .../client/apis/paths/Fakedeletecoffeeid.kt | 14 - .../client/apis/paths/Fakehealth.kt | 14 - .../paths/Fakeinlineadditionalproperties.kt | 14 - .../apis/paths/Fakeinlinecomposition.kt | 14 - .../client/apis/paths/Fakejsonformdata.kt | 14 - .../client/apis/paths/Fakejsonpatch.kt | 14 - .../client/apis/paths/Fakejsonwithcharset.kt | 14 - .../Fakemultiplerequestbodycontenttypes.kt | 14 - .../apis/paths/Fakemultipleresponsebodies.kt | 14 - .../apis/paths/Fakemultiplesecurities.kt | 14 - .../client/apis/paths/Fakeobjinquery.kt | 14 - .../Fakeparametercollisions1ababselfab.kt | 14 - .../client/apis/paths/Fakepemcontenttype.kt | 14 - .../Fakepetiduploadimagewithrequiredfile.kt | 14 - .../Fakequeryparamwithjsoncontenttype.kt | 14 - .../client/apis/paths/Fakeredirection.kt | 14 - .../client/apis/paths/Fakerefobjinquery.kt | 14 - .../client/apis/paths/Fakerefsarraymodel.kt | 14 - .../client/apis/paths/Fakerefsarrayofenums.kt | 14 - .../client/apis/paths/Fakerefsboolean.kt | 14 - ...erefscomposedoneofnumberwithvalidations.kt | 14 - .../client/apis/paths/Fakerefsenum.kt | 14 - .../client/apis/paths/Fakerefsmammal.kt | 14 - .../client/apis/paths/Fakerefsnumber.kt | 14 - .../paths/Fakerefsobjectmodelwithrefprops.kt | 14 - .../client/apis/paths/Fakerefsstring.kt | 14 - .../apis/paths/Fakeresponsewithoutschema.kt | 14 - .../apis/paths/Faketestqueryparamters.kt | 14 - .../apis/paths/Fakeuploaddownloadfile.kt | 14 - .../client/apis/paths/Fakeuploadfile.kt | 14 - .../client/apis/paths/Fakeuploadfiles.kt | 14 - .../apis/paths/Fakewildcardresponses.kt | 14 - .../client/apis/paths/Foo.kt | 14 - .../client/apis/paths/Pet.kt | 16 - .../client/apis/paths/Petfindbystatus.kt | 14 - .../client/apis/paths/Petfindbytags.kt | 14 - .../client/apis/paths/Petpetid.kt | 18 - .../client/apis/paths/Petpetiduploadimage.kt | 14 - .../client/apis/paths/Solidus.kt | 14 - .../client/apis/paths/Storeinventory.kt | 14 - .../client/apis/paths/Storeorder.kt | 14 - .../client/apis/paths/Storeorderorderid.kt | 16 - .../client/apis/paths/User.kt | 14 - .../client/apis/paths/Usercreatewitharray.kt | 14 - .../client/apis/paths/Usercreatewithlist.kt | 14 - .../client/apis/paths/Userlogin.kt | 14 - .../client/apis/paths/Userlogout.kt | 14 - .../client/apis/paths/Userusername.kt | 18 - .../client/apis/tags/Anotherfake.kt | 14 - .../client/apis/tags/Default.kt | 14 - .../client/apis/tags/Fake.kt | 98 - .../client/apis/tags/Fakeclassnametags123.kt | 14 - .../client/apis/tags/Pet.kt | 30 - .../client/apis/tags/Store.kt | 20 - .../client/apis/tags/User.kt | 28 - .../headers/Int32JsonContentTypeHeader.kt | 31 - .../client/components/headers/NumberHeader.kt | 18 - .../headers/RefContentSchemaHeader.kt | 31 - .../components/headers/RefSchemaHeader.kt | 18 - .../components/headers/RefStringHeader.kt | 6 - .../client/components/headers/StringHeader.kt | 18 - .../Int32JsonContentTypeHeaderSchema.kt | 19 - .../numberheader/NumberHeaderSchema.kt | 19 - .../RefContentSchemaHeaderSchema.kt | 19 - .../refschemaheader/RefSchemaHeaderSchema.kt | 19 - .../stringheader/StringHeaderSchema.kt | 19 - .../ComponentRefSchemaStringWithValidation.kt | 35 - .../components/parameters/PathUserName.kt | 23 - .../components/parameters/RefPathUserName.kt | 6 - .../RefSchemaStringWithValidation.kt | 23 - .../applicationjson/ApplicationjsonSchema.kt | 19 - .../parameters/pathusername/Schema.kt | 19 - .../refschemastringwithvalidation/Schema.kt | 19 - .../client/components/requestbodies/Client.kt | 49 - .../client/components/requestbodies/Pet.kt | 71 - .../components/requestbodies/RefUserArray.kt | 6 - .../components/requestbodies/UserArray.kt | 49 - .../applicationjson/ApplicationjsonSchema.kt | 19 - .../applicationjson/ApplicationjsonSchema.kt | 19 - .../applicationxml/ApplicationxmlSchema.kt | 20 - .../applicationjson/ApplicationjsonSchema.kt | 148 - .../components/responses/HeadersWithNoBody.kt | 47 - .../responses/RefSuccessDescriptionOnly.kt | 6 - .../RefSuccessfulXmlAndJsonArrayOfPet.kt | 6 - .../responses/SuccessDescriptionOnly.kt | 45 - .../SuccessInlineContentAndHeader.kt | 65 - .../responses/SuccessWithJsonApiResponse.kt | 65 - .../SuccessfulXmlAndJsonArrayOfPet.kt | 81 - .../responses/headerswithnobody/Headers.kt | 18 - .../HeadersWithNoBodyHeadersSchema.kt | 191 - .../headerswithnobody/headers/Location.kt | 18 - .../headers/location/LocationSchema.kt | 19 - .../applicationjson/ApplicationjsonSchema.kt | 149 - .../applicationxml/ApplicationxmlSchema.kt | 148 - .../successinlinecontentandheader/Headers.kt | 18 - ...cessInlineContentAndHeaderHeadersSchema.kt | 191 - .../applicationjson/ApplicationjsonSchema.kt | 190 - .../headers/SomeHeader.kt | 18 - .../headers/someheader/SomeHeaderSchema.kt | 19 - .../successwithjsonapiresponse/Headers.kt | 26 - ...SuccessWithJsonApiResponseHeadersSchema.kt | 528 -- .../applicationjson/ApplicationjsonSchema.kt | 19 - .../headers/Int32.kt | 7 - .../headers/NumberHeader.kt | 3 - .../headers/Refcontentschemaheader.kt | 7 - .../headers/Refschemaheader.kt | 7 - .../headers/StringHeader.kt | 7 - .../components/schemas/AbstractStepMessage.kt | 455 -- .../schemas/AdditionalPropertiesClass.kt | 1405 ------ .../schemas/AdditionalPropertiesSchema.kt | 1309 ----- .../AdditionalPropertiesWithArrayOfEnums.kt | 310 -- .../client/components/schemas/Address.kt | 210 - .../client/components/schemas/Animal.kt | 323 -- .../client/components/schemas/AnimalFarm.kt | 153 - .../components/schemas/AnyTypeAndFormat.kt | 3342 ------------- .../components/schemas/AnyTypeNotString.kt | 339 -- .../components/schemas/ApiResponseSchema.kt | 289 -- .../client/components/schemas/Apple.kt | 412 -- .../client/components/schemas/AppleReq.kt | 265 - .../components/schemas/ArrayHoldingAnyType.kt | 201 - .../schemas/ArrayOfArrayOfNumberOnly.kt | 467 -- .../client/components/schemas/ArrayOfEnums.kt | 166 - .../components/schemas/ArrayOfNumberOnly.kt | 345 -- .../client/components/schemas/ArrayTest.kt | 899 ---- .../schemas/ArrayWithValidationsInItems.kt | 258 - .../client/components/schemas/Banana.kt | 235 - .../client/components/schemas/BananaReq.kt | 283 -- .../client/components/schemas/Bar.kt | 103 - .../client/components/schemas/BasquePig.kt | 304 -- .../client/components/schemas/BooleanEnum.kt | 119 - .../components/schemas/BooleanSchema.kt | 19 - .../components/schemas/Capitalization.kt | 396 -- .../client/components/schemas/Cat.kt | 503 -- .../client/components/schemas/Category.kt | 341 -- .../client/components/schemas/ChildCat.kt | 503 -- .../client/components/schemas/ClassModel.kt | 401 -- .../client/components/schemas/Client.kt | 206 - .../schemas/ComplexQuadrilateral.kt | 589 --- ...omposedAnyOfDifferentTypesNoValidations.kt | 693 --- .../components/schemas/ComposedArray.kt | 201 - .../client/components/schemas/ComposedBool.kt | 111 - .../client/components/schemas/ComposedNone.kt | 109 - .../components/schemas/ComposedNumber.kt | 129 - .../components/schemas/ComposedObject.kt | 138 - .../schemas/ComposedOneOfDifferentTypes.kt | 700 --- .../components/schemas/ComposedString.kt | 110 - .../client/components/schemas/Currency.kt | 120 - .../client/components/schemas/DanishPig.kt | 304 -- .../client/components/schemas/DateTimeTest.kt | 105 - .../schemas/DateTimeWithValidations.kt | 101 - .../components/schemas/DateWithValidations.kt | 101 - .../components/schemas/DecimalPayload.kt | 19 - .../client/components/schemas/Dog.kt | 503 -- .../client/components/schemas/Drawing.kt | 656 --- .../client/components/schemas/EnumArrays.kt | 542 --- .../client/components/schemas/EnumClass.kt | 134 - .../client/components/schemas/EnumTest.kt | 1117 ----- .../components/schemas/EquilateralTriangle.kt | 589 --- .../client/components/schemas/File.kt | 208 - .../components/schemas/FileSchemaTestClass.kt | 345 -- .../client/components/schemas/Foo.kt | 194 - .../client/components/schemas/FormatTest.kt | 2038 -------- .../client/components/schemas/FromSchema.kt | 263 - .../client/components/schemas/Fruit.kt | 413 -- .../client/components/schemas/FruitReq.kt | 343 -- .../client/components/schemas/GmFruit.kt | 413 -- .../components/schemas/GrandparentAnimal.kt | 217 - .../components/schemas/HasOnlyReadOnly.kt | 244 - .../components/schemas/HealthCheckResult.kt | 303 -- .../client/components/schemas/IntegerEnum.kt | 206 - .../components/schemas/IntegerEnumBig.kt | 206 - .../components/schemas/IntegerEnumOneValue.kt | 196 - .../schemas/IntegerEnumWithDefaultValue.kt | 208 - .../client/components/schemas/IntegerMax10.kt | 116 - .../client/components/schemas/IntegerMin15.kt | 116 - .../components/schemas/IsoscelesTriangle.kt | 589 --- .../client/components/schemas/Items.kt | 167 - .../client/components/schemas/ItemsSchema.kt | 282 -- .../components/schemas/JSONPatchRequest.kt | 490 -- .../schemas/JSONPatchRequestAddReplaceTest.kt | 520 -- .../schemas/JSONPatchRequestMoveCopy.kt | 473 -- .../schemas/JSONPatchRequestRemove.kt | 373 -- .../client/components/schemas/Mammal.kt | 331 -- .../client/components/schemas/MapTest.kt | 979 ---- ...dPropertiesAndAdditionalPropertiesClass.kt | 396 -- .../client/components/schemas/Money.kt | 277 -- .../schemas/MultiPropertiesSchema.kt | 422 -- .../client/components/schemas/MyObjectDto.kt | 208 - .../client/components/schemas/Name.kt | 512 -- .../schemas/NoAdditionalProperties.kt | 294 -- .../components/schemas/NullableClass.kt | 2834 ----------- .../components/schemas/NullableShape.kt | 345 -- .../components/schemas/NullableString.kt | 127 - .../client/components/schemas/NumberOnly.kt | 224 - .../client/components/schemas/NumberSchema.kt | 19 - .../schemas/NumberWithExclusiveMinMax.kt | 116 - .../schemas/NumberWithValidations.kt | 116 - .../schemas/ObjWithRequiredProps.kt | 220 - .../schemas/ObjWithRequiredPropsBase.kt | 217 - .../components/schemas/ObjectInterface.kt | 20 - .../ObjectModelWithArgAndArgsProperties.kt | 280 -- .../schemas/ObjectModelWithRefProps.kt | 268 - ...ithAllOfWithReqTestPropFromUnsetAddProp.kt | 589 --- .../schemas/ObjectWithCollidingProperties.kt | 246 - .../schemas/ObjectWithDecimalProperties.kt | 260 - .../ObjectWithDifficultlyNamedProps.kt | 306 -- .../ObjectWithInlineCompositionProperty.kt | 602 --- .../ObjectWithInvalidNamedRefedProperties.kt | 249 - .../ObjectWithNonIntersectingValues.kt | 256 - .../schemas/ObjectWithOnlyOptionalProps.kt | 463 -- .../schemas/ObjectWithOptionalTestProp.kt | 206 - .../schemas/ObjectWithValidations.kt | 124 - .../client/components/schemas/Order.kt | 533 -- .../schemas/PaginatedResultMyObjectDto.kt | 416 -- .../client/components/schemas/ParentPet.kt | 126 - .../client/components/schemas/Pet.kt | 770 --- .../client/components/schemas/Pig.kt | 330 -- .../client/components/schemas/Player.kt | 235 - .../client/components/schemas/PublicKey.kt | 208 - .../components/schemas/Quadrilateral.kt | 330 -- .../schemas/QuadrilateralInterface.kt | 570 --- .../components/schemas/ReadOnlyFirst.kt | 244 - .../client/components/schemas/RefPet.kt | 18 - .../schemas/ReqPropsFromExplicitAddProps.kt | 272 -- .../schemas/ReqPropsFromTrueAddProps.kt | 421 -- .../schemas/ReqPropsFromUnsetAddProps.kt | 340 -- .../client/components/schemas/ReturnSchema.kt | 407 -- .../components/schemas/ScaleneTriangle.kt | 589 --- .../components/schemas/Schema200Response.kt | 446 -- .../schemas/SelfReferencingArrayModel.kt | 152 - .../schemas/SelfReferencingObjectModel.kt | 211 - .../client/components/schemas/Shape.kt | 330 -- .../client/components/schemas/ShapeOrNull.kt | 345 -- .../components/schemas/SimpleQuadrilateral.kt | 589 --- .../client/components/schemas/SomeObject.kt | 329 -- .../components/schemas/SpecialModelname.kt | 208 - .../components/schemas/StringBooleanMap.kt | 194 - .../client/components/schemas/StringEnum.kt | 180 - .../schemas/StringEnumWithDefaultValue.kt | 130 - .../client/components/schemas/StringSchema.kt | 19 - .../schemas/StringWithValidation.kt | 96 - .../client/components/schemas/Tag.kt | 263 - .../client/components/schemas/Triangle.kt | 331 -- .../components/schemas/TriangleInterface.kt | 570 --- .../client/components/schemas/UUIDString.kt | 98 - .../client/components/schemas/User.kt | 1227 ----- .../client/components/schemas/Whale.kt | 382 -- .../client/components/schemas/Zebra.kt | 512 -- .../components/securityschemes/ApiKey.kt | 12 - .../components/securityschemes/ApiKeyQuery.kt | 12 - .../components/securityschemes/BearerTest.kt | 12 - .../securityschemes/HttpBasicTest.kt | 12 - .../securityschemes/HttpSignatureTest.kt | 9 - .../securityschemes/OpenIdConnectTest.kt | 9 - .../securityschemes/PetstoreAuth.kt | 10 - .../client/configurations/ApiConfiguration.kt | 500 -- .../configurations/SchemaConfiguration.kt | 4 - .../contenttype/ContentTypeDeserializer.kt | 18 - .../client/contenttype/ContentTypeDetector.kt | 18 - .../contenttype/ContentTypeSerializer.kt | 18 - .../client/exceptions/ApiException.kt | 5 - .../client/exceptions/BaseException.kt | 3 - .../exceptions/NotImplementedException.kt | 3 - .../exceptions/UnsetPropertyException.kt | 3 - .../client/exceptions/ValidationException.kt | 3 - .../client/header/ContentHeader.kt | 59 - .../client/header/Header.kt | 14 - .../client/header/HeaderBase.kt | 18 - .../client/header/PrefixSeparatorIterator.kt | 27 - .../client/header/Rfc6570Serializer.kt | 197 - .../client/header/SchemaHeader.kt | 97 - .../client/header/StyleSerializer.kt | 99 - .../client/mediatype/Encoding.kt | 30 - .../client/mediatype/MediaType.kt | 16 - .../client/parameter/ContentParameter.kt | 30 - .../client/parameter/CookieSerializer.kt | 36 - .../client/parameter/HeadersSerializer.kt | 32 - .../client/parameter/Parameter.kt | 10 - .../client/parameter/ParameterBase.kt | 15 - .../client/parameter/ParameterInType.kt | 8 - .../client/parameter/ParameterStyle.kt | 11 - .../client/parameter/PathSerializer.kt | 30 - .../client/parameter/QuerySerializer.kt | 48 - .../client/parameter/SchemaParameter.kt | 60 - .../client/paths/Anotherfakedummy.kt | 5 - .../client/paths/Commonparamsubdir.kt | 5 - .../client/paths/Fake.kt | 5 - ...akeadditionalpropertieswitharrayofenums.kt | 5 - .../client/paths/Fakebodywithfileschema.kt | 5 - .../client/paths/Fakebodywithqueryparams.kt | 5 - .../client/paths/Fakecasesensitiveparams.kt | 5 - .../client/paths/Fakeclassnametest.kt | 5 - .../client/paths/Fakedeletecoffeeid.kt | 5 - .../client/paths/Fakehealth.kt | 5 - .../paths/Fakeinlineadditionalproperties.kt | 5 - .../client/paths/Fakeinlinecomposition.kt | 5 - .../client/paths/Fakejsonformdata.kt | 5 - .../client/paths/Fakejsonpatch.kt | 5 - .../client/paths/Fakejsonwithcharset.kt | 5 - .../Fakemultiplerequestbodycontenttypes.kt | 5 - .../paths/Fakemultipleresponsebodies.kt | 5 - .../client/paths/Fakemultiplesecurities.kt | 5 - .../client/paths/Fakeobjinquery.kt | 5 - .../Fakeparametercollisions1ababselfab.kt | 5 - .../client/paths/Fakepemcontenttype.kt | 5 - .../Fakepetiduploadimagewithrequiredfile.kt | 5 - .../Fakequeryparamwithjsoncontenttype.kt | 5 - .../client/paths/Fakeredirection.kt | 5 - .../client/paths/Fakerefobjinquery.kt | 5 - .../client/paths/Fakerefsarraymodel.kt | 5 - .../client/paths/Fakerefsarrayofenums.kt | 5 - .../client/paths/Fakerefsboolean.kt | 5 - ...erefscomposedoneofnumberwithvalidations.kt | 5 - .../client/paths/Fakerefsenum.kt | 5 - .../client/paths/Fakerefsmammal.kt | 5 - .../client/paths/Fakerefsnumber.kt | 5 - .../paths/Fakerefsobjectmodelwithrefprops.kt | 5 - .../client/paths/Fakerefsstring.kt | 5 - .../client/paths/Fakeresponsewithoutschema.kt | 5 - .../client/paths/Faketestqueryparamters.kt | 5 - .../client/paths/Fakeuploaddownloadfile.kt | 5 - .../client/paths/Fakeuploadfile.kt | 5 - .../client/paths/Fakeuploadfiles.kt | 5 - .../client/paths/Fakewildcardresponses.kt | 5 - .../client/paths/Foo.kt | 5 - .../client/paths/Pet.kt | 5 - .../client/paths/Petfindbystatus.kt | 5 - .../client/paths/Petfindbytags.kt | 5 - .../client/paths/Petpetid.kt | 5 - .../client/paths/Petpetiduploadimage.kt | 5 - .../client/paths/Solidus.kt | 5 - .../client/paths/Storeinventory.kt | 5 - .../client/paths/Storeorder.kt | 5 - .../client/paths/Storeorderorderid.kt | 5 - .../client/paths/User.kt | 5 - .../client/paths/Usercreatewitharray.kt | 5 - .../client/paths/Usercreatewithlist.kt | 5 - .../client/paths/Userlogin.kt | 5 - .../client/paths/Userlogout.kt | 5 - .../client/paths/Userusername.kt | 5 - .../anotherfakedummy/AnotherfakedummyPatch.kt | 183 - .../patch/AnotherfakedummyPatchRequestBody.kt | 7 - .../patch/AnotherfakedummyPatchResponses.kt | 53 - .../AnotherfakedummyPatchCode200Response.kt | 63 - .../applicationjson/ApplicationjsonSchema.kt | 19 - .../CommonparamsubdirDelete.kt | 205 - .../commonparamsubdir/CommonparamsubdirGet.kt | 206 - .../CommonparamsubdirPost.kt | 205 - ...CommonparamsubdirDeleteHeaderParameters.kt | 191 - .../CommonparamsubdirDeletePathParameters.kt | 211 - .../CommonparamsubdirDeleteResponses.kt | 53 - .../commonparamsubdir/delete/Parameters.kt | 32 - .../delete/parameters/Parameter0.kt | 23 - .../delete/parameters/Parameter1.kt | 23 - .../delete/parameters/parameter0/Schema0.kt | 19 - .../delete/parameters/parameter1/Schema1.kt | 114 - .../CommonparamsubdirDeleteCode200Response.kt | 7 - .../get/CommonparamsubdirGetPathParameters.kt | 211 - .../CommonparamsubdirGetQueryParameters.kt | 191 - .../get/CommonparamsubdirGetResponses.kt | 53 - .../paths/commonparamsubdir/get/Parameters.kt | 32 - .../get/parameters/Parameter0.kt | 23 - .../get/parameters/parameter0/Schema0.kt | 19 - .../CommonparamsubdirGetCode200Response.kt | 7 - .../parameters/RouteParameter0.kt | 23 - .../routeparameter0/RouteParamSchema0.kt | 114 - .../CommonparamsubdirPostHeaderParameters.kt | 191 - .../CommonparamsubdirPostPathParameters.kt | 211 - .../post/CommonparamsubdirPostResponses.kt | 53 - .../commonparamsubdir/post/Parameters.kt | 32 - .../post/parameters/Parameter0.kt | 23 - .../post/parameters/parameter0/Schema0.kt | 19 - .../CommonparamsubdirPostCode200Response.kt | 7 - .../client/paths/fake/FakeDelete.kt | 270 -- .../client/paths/fake/FakeGet.kt | 198 - .../client/paths/fake/FakePatch.kt | 183 - .../client/paths/fake/FakePost.kt | 180 - .../fake/delete/FakeDeleteHeaderParameters.kt | 246 - .../fake/delete/FakeDeleteQueryParameters.kt | 351 -- .../paths/fake/delete/FakeDeleteResponses.kt | 53 - .../fake/delete/FakeDeleteSecurityInfo.kt | 24 - .../client/paths/fake/delete/Parameters.kt | 40 - .../fake/delete/parameters/Parameter0.kt | 23 - .../fake/delete/parameters/Parameter1.kt | 23 - .../fake/delete/parameters/Parameter2.kt | 23 - .../fake/delete/parameters/Parameter3.kt | 23 - .../fake/delete/parameters/Parameter4.kt | 23 - .../fake/delete/parameters/Parameter5.kt | 23 - .../delete/parameters/parameter0/Schema0.kt | 19 - .../delete/parameters/parameter1/Schema1.kt | 114 - .../delete/parameters/parameter2/Schema2.kt | 19 - .../delete/parameters/parameter3/Schema3.kt | 19 - .../delete/parameters/parameter4/Schema4.kt | 114 - .../delete/parameters/parameter5/Schema5.kt | 19 - .../responses/FakeDeleteCode200Response.kt | 7 - .../FakeDeleteSecurityRequirementObject0.kt | 24 - .../paths/fake/get/FakeGetHeaderParameters.kt | 228 - .../paths/fake/get/FakeGetQueryParameters.kt | 344 -- .../paths/fake/get/FakeGetRequestBody.kt | 49 - .../client/paths/fake/get/FakeGetResponses.kt | 66 - .../client/paths/fake/get/Parameters.kt | 40 - .../paths/fake/get/parameters/Parameter0.kt | 23 - .../paths/fake/get/parameters/Parameter1.kt | 23 - .../paths/fake/get/parameters/Parameter2.kt | 23 - .../paths/fake/get/parameters/Parameter3.kt | 23 - .../paths/fake/get/parameters/Parameter4.kt | 23 - .../paths/fake/get/parameters/Parameter5.kt | 23 - .../fake/get/parameters/parameter0/Schema0.kt | 253 - .../fake/get/parameters/parameter1/Schema1.kt | 124 - .../fake/get/parameters/parameter2/Schema2.kt | 253 - .../fake/get/parameters/parameter3/Schema3.kt | 124 - .../fake/get/parameters/parameter4/Schema4.kt | 187 - .../fake/get/parameters/parameter5/Schema5.kt | 142 - .../ApplicationxwwwformurlencodedSchema.kt | 553 --- .../get/responses/FakeGetCode200Response.kt | 7 - .../get/responses/FakeGetCode404Response.kt | 63 - .../applicationjson/ApplicationjsonSchema.kt | 20 - .../paths/fake/patch/FakePatchRequestBody.kt | 7 - .../paths/fake/patch/FakePatchResponses.kt | 53 - .../responses/FakePatchCode200Response.kt | 63 - .../applicationjson/ApplicationjsonSchema.kt | 19 - .../paths/fake/post/FakePostRequestBody.kt | 49 - .../paths/fake/post/FakePostResponses.kt | 66 - .../paths/fake/post/FakePostSecurityInfo.kt | 24 - .../ApplicationxwwwformurlencodedSchema.kt | 1591 ------ .../post/responses/FakePostCode200Response.kt | 7 - .../post/responses/FakePostCode404Response.kt | 45 - .../FakePostSecurityRequirementObject0.kt | 24 - ...additionalpropertieswitharrayofenumsGet.kt | 152 - ...ropertieswitharrayofenumsGetRequestBody.kt | 49 - ...lpropertieswitharrayofenumsGetResponses.kt | 53 - .../applicationjson/ApplicationjsonSchema.kt | 19 - ...rtieswitharrayofenumsGetCode200Response.kt | 63 - .../applicationjson/ApplicationjsonSchema.kt | 19 - .../FakebodywithfileschemaPut.kt | 183 - .../FakebodywithfileschemaPutRequestBody.kt | 49 - .../put/FakebodywithfileschemaPutResponses.kt | 53 - .../applicationjson/ApplicationjsonSchema.kt | 19 - ...akebodywithfileschemaPutCode200Response.kt | 7 - .../FakebodywithqueryparamsPut.kt | 242 - ...kebodywithqueryparamsPutQueryParameters.kt | 205 - .../FakebodywithqueryparamsPutRequestBody.kt | 49 - .../FakebodywithqueryparamsPutResponses.kt | 53 - .../fakebodywithqueryparams/put/Parameters.kt | 20 - .../put/parameters/Parameter0.kt | 23 - .../put/parameters/parameter0/Schema0.kt | 19 - .../applicationjson/ApplicationjsonSchema.kt | 19 - ...kebodywithqueryparamsPutCode200Response.kt | 7 - .../FakecasesensitiveparamsPut.kt | 180 - ...kecasesensitiveparamsPutQueryParameters.kt | 343 -- .../FakecasesensitiveparamsPutResponses.kt | 53 - .../fakecasesensitiveparams/put/Parameters.kt | 24 - .../put/parameters/Parameter0.kt | 23 - .../put/parameters/Parameter1.kt | 23 - .../put/parameters/Parameter2.kt | 23 - .../put/parameters/parameter0/Schema0.kt | 19 - .../put/parameters/parameter1/Schema1.kt | 19 - .../put/parameters/parameter2/Schema2.kt | 19 - ...kecasesensitiveparamsPutCode200Response.kt | 7 - .../FakeclassnametestPatch.kt | 215 - .../FakeclassnametestPatchRequestBody.kt | 7 - .../patch/FakeclassnametestPatchResponses.kt | 53 - .../FakeclassnametestPatchSecurityInfo.kt | 24 - .../FakeclassnametestPatchCode200Response.kt | 63 - .../applicationjson/ApplicationjsonSchema.kt | 19 - ...nametestPatchSecurityRequirementObject0.kt | 24 - .../FakedeletecoffeeidDelete.kt | 179 - .../FakedeletecoffeeidDeletePathParameters.kt | 205 - .../FakedeletecoffeeidDeleteResponses.kt | 61 - .../fakedeletecoffeeid/delete/Parameters.kt | 20 - .../delete/parameters/Parameter0.kt | 23 - .../delete/parameters/parameter0/Schema0.kt | 19 - ...FakedeletecoffeeidDeleteCode200Response.kt | 7 - ...deletecoffeeidDeleteCodedefaultResponse.kt | 45 - .../client/paths/fakehealth/FakehealthGet.kt | 124 - .../fakehealth/get/FakehealthGetResponses.kt | 53 - .../responses/FakehealthGetCode200Response.kt | 63 - .../applicationjson/ApplicationjsonSchema.kt | 19 - .../FakeinlineadditionalpropertiesPost.kt | 183 - ...lineadditionalpropertiesPostRequestBody.kt | 49 - ...inlineadditionalpropertiesPostResponses.kt | 53 - .../applicationjson/ApplicationjsonSchema.kt | 183 - ...additionalpropertiesPostCode200Response.kt | 7 - .../FakeinlinecompositionPost.kt | 176 - ...akeinlinecompositionPostQueryParameters.kt | 270 -- .../FakeinlinecompositionPostRequestBody.kt | 71 - .../FakeinlinecompositionPostResponses.kt | 53 - .../fakeinlinecomposition/post/Parameters.kt | 22 - .../post/parameters/Parameter0.kt | 23 - .../post/parameters/Parameter1.kt | 23 - .../post/parameters/parameter0/Schema0.kt | 393 -- .../post/parameters/parameter1/Schema1.kt | 596 --- .../applicationjson/ApplicationjsonSchema.kt | 393 -- .../MultipartformdataSchema.kt | 596 --- ...akeinlinecompositionPostCode200Response.kt | 81 - .../applicationjson/ApplicationjsonSchema.kt | 393 -- .../MultipartformdataSchema.kt | 596 --- .../fakejsonformdata/FakejsonformdataGet.kt | 152 - .../get/FakejsonformdataGetRequestBody.kt | 49 - .../get/FakejsonformdataGetResponses.kt | 53 - .../ApplicationxwwwformurlencodedSchema.kt | 274 -- .../FakejsonformdataGetCode200Response.kt | 7 - .../paths/fakejsonpatch/FakejsonpatchPatch.kt | 152 - .../patch/FakejsonpatchPatchRequestBody.kt | 49 - .../patch/FakejsonpatchPatchResponses.kt | 53 - .../ApplicationjsonpatchjsonSchema.kt | 19 - .../FakejsonpatchPatchCode200Response.kt | 7 - .../FakejsonwithcharsetPost.kt | 152 - .../FakejsonwithcharsetPostRequestBody.kt | 49 - .../post/FakejsonwithcharsetPostResponses.kt | 53 - .../Applicationjsoncharsetutf8Schema.kt | 19 - .../FakejsonwithcharsetPostCode200Response.kt | 63 - .../Applicationjsoncharsetutf8Schema.kt | 19 - ...FakemultiplerequestbodycontenttypesPost.kt | 152 - ...erequestbodycontenttypesPostRequestBody.kt | 71 - ...plerequestbodycontenttypesPostResponses.kt | 53 - .../applicationjson/ApplicationjsonSchema.kt | 200 - .../MultipartformdataSchema.kt | 200 - ...uestbodycontenttypesPostCode200Response.kt | 63 - .../applicationjson/ApplicationjsonSchema.kt | 19 - .../FakemultipleresponsebodiesGet.kt | 124 - .../FakemultipleresponsebodiesGetResponses.kt | 69 - ...ultipleresponsebodiesGetCode200Response.kt | 63 - ...ultipleresponsebodiesGetCode202Response.kt | 63 - .../applicationjson/ApplicationjsonSchema.kt | 19 - .../applicationjson/ApplicationjsonSchema.kt | 19 - .../FakemultiplesecuritiesGet.kt | 152 - .../get/FakemultiplesecuritiesGetResponses.kt | 53 - .../FakemultiplesecuritiesGetSecurityInfo.kt | 39 - ...akemultiplesecuritiesGetCode200Response.kt | 63 - .../applicationjson/ApplicationjsonSchema.kt | 19 - ...securitiesGetSecurityRequirementObject0.kt | 5 - ...securitiesGetSecurityRequirementObject1.kt | 29 - ...securitiesGetSecurityRequirementObject2.kt | 24 - .../paths/fakeobjinquery/FakeobjinqueryGet.kt | 148 - .../get/FakeobjinqueryGetQueryParameters.kt | 191 - .../get/FakeobjinqueryGetResponses.kt | 53 - .../paths/fakeobjinquery/get/Parameters.kt | 20 - .../get/parameters/Parameter0.kt | 23 - .../get/parameters/parameter0/Schema0.kt | 200 - .../FakeobjinqueryGetCode200Response.kt | 7 - .../Fakeparametercollisions1ababselfabPost.kt | 291 -- ...llisions1ababselfabPostCookieParameters.kt | 286 -- ...llisions1ababselfabPostHeaderParameters.kt | 258 - ...collisions1ababselfabPostPathParameters.kt | 819 ---- ...ollisions1ababselfabPostQueryParameters.kt | 286 -- ...tercollisions1ababselfabPostRequestBody.kt | 49 - ...metercollisions1ababselfabPostResponses.kt | 53 - .../post/Parameters.kt | 86 - .../post/parameters/Parameter0.kt | 23 - .../post/parameters/Parameter1.kt | 23 - .../post/parameters/Parameter10.kt | 23 - .../post/parameters/Parameter11.kt | 23 - .../post/parameters/Parameter12.kt | 23 - .../post/parameters/Parameter13.kt | 23 - .../post/parameters/Parameter14.kt | 23 - .../post/parameters/Parameter15.kt | 23 - .../post/parameters/Parameter16.kt | 23 - .../post/parameters/Parameter17.kt | 23 - .../post/parameters/Parameter18.kt | 23 - .../post/parameters/Parameter2.kt | 23 - .../post/parameters/Parameter3.kt | 23 - .../post/parameters/Parameter4.kt | 23 - .../post/parameters/Parameter5.kt | 23 - .../post/parameters/Parameter6.kt | 23 - .../post/parameters/Parameter7.kt | 23 - .../post/parameters/Parameter8.kt | 23 - .../post/parameters/Parameter9.kt | 23 - .../post/parameters/parameter0/Schema0.kt | 19 - .../post/parameters/parameter1/Schema1.kt | 19 - .../post/parameters/parameter10/Schema10.kt | 19 - .../post/parameters/parameter11/Schema11.kt | 19 - .../post/parameters/parameter12/Schema12.kt | 19 - .../post/parameters/parameter13/Schema13.kt | 19 - .../post/parameters/parameter14/Schema14.kt | 19 - .../post/parameters/parameter15/Schema15.kt | 19 - .../post/parameters/parameter16/Schema16.kt | 19 - .../post/parameters/parameter17/Schema17.kt | 19 - .../post/parameters/parameter18/Schema18.kt | 19 - .../post/parameters/parameter2/Schema2.kt | 19 - .../post/parameters/parameter3/Schema3.kt | 19 - .../post/parameters/parameter4/Schema4.kt | 19 - .../post/parameters/parameter5/Schema5.kt | 19 - .../post/parameters/parameter6/Schema6.kt | 19 - .../post/parameters/parameter7/Schema7.kt | 19 - .../post/parameters/parameter8/Schema8.kt | 19 - .../post/parameters/parameter9/Schema9.kt | 19 - .../applicationjson/ApplicationjsonSchema.kt | 19 - ...ollisions1ababselfabPostCode200Response.kt | 63 - .../applicationjson/ApplicationjsonSchema.kt | 19 - .../FakepemcontenttypeGet.kt | 152 - .../get/FakepemcontenttypeGetRequestBody.kt | 49 - .../get/FakepemcontenttypeGetResponses.kt | 53 - .../ApplicationxpemfileSchema.kt | 19 - .../FakepemcontenttypeGetCode200Response.kt | 63 - .../ApplicationxpemfileSchema.kt | 19 - ...akepetiduploadimagewithrequiredfilePost.kt | 243 - ...imagewithrequiredfilePostPathParameters.kt | 223 - ...oadimagewithrequiredfilePostRequestBody.kt | 49 - ...ploadimagewithrequiredfilePostResponses.kt | 53 - ...adimagewithrequiredfilePostSecurityInfo.kt | 24 - .../post/Parameters.kt | 20 - .../post/parameters/Parameter0.kt | 23 - .../post/parameters/parameter0/Schema0.kt | 19 - .../MultipartformdataSchema.kt | 251 - ...magewithrequiredfilePostCode200Response.kt | 63 - .../applicationjson/ApplicationjsonSchema.kt | 19 - ...uiredfilePostSecurityRequirementObject0.kt | 24 - .../FakequeryparamwithjsoncontenttypeGet.kt | 180 - ...amwithjsoncontenttypeGetQueryParameters.kt | 253 - ...eryparamwithjsoncontenttypeGetResponses.kt | 53 - .../get/Parameters.kt | 20 - .../get/parameters/Parameter0.kt | 35 - .../content/applicationjson/Schema0.kt | 19 - ...amwithjsoncontenttypeGetCode200Response.kt | 63 - .../applicationjson/ApplicationjsonSchema.kt | 19 - .../fakeredirection/FakeredirectionGet.kt | 124 - .../get/FakeredirectionGetResponses.kt | 79 - .../FakeredirectionGetCode303Response.kt | 45 - .../FakeredirectionGetCode3XXResponse.kt | 45 - .../fakerefobjinquery/FakerefobjinqueryGet.kt | 148 - .../FakerefobjinqueryGetQueryParameters.kt | 191 - .../get/FakerefobjinqueryGetResponses.kt | 53 - .../paths/fakerefobjinquery/get/Parameters.kt | 20 - .../get/parameters/Parameter0.kt | 23 - .../get/parameters/parameter0/Schema0.kt | 19 - .../FakerefobjinqueryGetCode200Response.kt | 7 - .../FakerefsarraymodelPost.kt | 152 - .../post/FakerefsarraymodelPostRequestBody.kt | 49 - .../post/FakerefsarraymodelPostResponses.kt | 53 - .../applicationjson/ApplicationjsonSchema.kt | 19 - .../FakerefsarraymodelPostCode200Response.kt | 63 - .../applicationjson/ApplicationjsonSchema.kt | 19 - .../FakerefsarrayofenumsPost.kt | 152 - .../FakerefsarrayofenumsPostRequestBody.kt | 49 - .../post/FakerefsarrayofenumsPostResponses.kt | 53 - .../applicationjson/ApplicationjsonSchema.kt | 19 - ...FakerefsarrayofenumsPostCode200Response.kt | 63 - .../applicationjson/ApplicationjsonSchema.kt | 19 - .../fakerefsboolean/FakerefsbooleanPost.kt | 152 - .../post/FakerefsbooleanPostRequestBody.kt | 49 - .../post/FakerefsbooleanPostResponses.kt | 53 - .../applicationjson/ApplicationjsonSchema.kt | 19 - .../FakerefsbooleanPostCode200Response.kt | 63 - .../applicationjson/ApplicationjsonSchema.kt | 19 - ...scomposedoneofnumberwithvalidationsPost.kt | 152 - ...eofnumberwithvalidationsPostRequestBody.kt | 49 - ...oneofnumberwithvalidationsPostResponses.kt | 53 - .../applicationjson/ApplicationjsonSchema.kt | 19 - ...umberwithvalidationsPostCode200Response.kt | 63 - .../applicationjson/ApplicationjsonSchema.kt | 19 - .../paths/fakerefsenum/FakerefsenumPost.kt | 152 - .../post/FakerefsenumPostRequestBody.kt | 49 - .../post/FakerefsenumPostResponses.kt | 53 - .../applicationjson/ApplicationjsonSchema.kt | 19 - .../FakerefsenumPostCode200Response.kt | 63 - .../applicationjson/ApplicationjsonSchema.kt | 19 - .../fakerefsmammal/FakerefsmammalPost.kt | 183 - .../post/FakerefsmammalPostRequestBody.kt | 49 - .../post/FakerefsmammalPostResponses.kt | 53 - .../applicationjson/ApplicationjsonSchema.kt | 19 - .../FakerefsmammalPostCode200Response.kt | 63 - .../applicationjson/ApplicationjsonSchema.kt | 19 - .../fakerefsnumber/FakerefsnumberPost.kt | 152 - .../post/FakerefsnumberPostRequestBody.kt | 49 - .../post/FakerefsnumberPostResponses.kt | 53 - .../applicationjson/ApplicationjsonSchema.kt | 19 - .../FakerefsnumberPostCode200Response.kt | 63 - .../applicationjson/ApplicationjsonSchema.kt | 19 - .../FakerefsobjectmodelwithrefpropsPost.kt | 152 - ...sobjectmodelwithrefpropsPostRequestBody.kt | 49 - ...efsobjectmodelwithrefpropsPostResponses.kt | 53 - .../applicationjson/ApplicationjsonSchema.kt | 19 - ...ectmodelwithrefpropsPostCode200Response.kt | 63 - .../applicationjson/ApplicationjsonSchema.kt | 19 - .../fakerefsstring/FakerefsstringPost.kt | 152 - .../post/FakerefsstringPostRequestBody.kt | 49 - .../post/FakerefsstringPostResponses.kt | 53 - .../applicationjson/ApplicationjsonSchema.kt | 19 - .../FakerefsstringPostCode200Response.kt | 63 - .../applicationjson/ApplicationjsonSchema.kt | 19 - .../FakeresponsewithoutschemaGet.kt | 124 - .../FakeresponsewithoutschemaGetResponses.kt | 53 - ...responsewithoutschemaGetCode200Response.kt | 48 - .../FaketestqueryparamtersPut.kt | 180 - ...aketestqueryparamtersPutQueryParameters.kt | 1515 ------ .../put/FaketestqueryparamtersPutResponses.kt | 53 - .../faketestqueryparamters/put/Parameters.kt | 30 - .../put/parameters/Parameter0.kt | 23 - .../put/parameters/Parameter1.kt | 23 - .../put/parameters/Parameter2.kt | 23 - .../put/parameters/Parameter3.kt | 23 - .../put/parameters/Parameter4.kt | 23 - .../put/parameters/Parameter5.kt | 23 - .../put/parameters/parameter0/Schema0.kt | 157 - .../put/parameters/parameter1/Schema1.kt | 157 - .../put/parameters/parameter2/Schema2.kt | 157 - .../put/parameters/parameter3/Schema3.kt | 157 - .../put/parameters/parameter4/Schema4.kt | 157 - .../put/parameters/parameter5/Schema5.kt | 19 - ...aketestqueryparamtersPutCode200Response.kt | 7 - .../FakeuploaddownloadfilePost.kt | 183 - .../FakeuploaddownloadfilePostRequestBody.kt | 49 - .../FakeuploaddownloadfilePostResponses.kt | 53 - .../ApplicationoctetstreamSchema.kt | 20 - ...keuploaddownloadfilePostCode200Response.kt | 63 - .../ApplicationoctetstreamSchema.kt | 20 - .../fakeuploadfile/FakeuploadfilePost.kt | 152 - .../post/FakeuploadfilePostRequestBody.kt | 49 - .../post/FakeuploadfilePostResponses.kt | 53 - .../MultipartformdataSchema.kt | 251 - .../FakeuploadfilePostCode200Response.kt | 63 - .../applicationjson/ApplicationjsonSchema.kt | 19 - .../fakeuploadfiles/FakeuploadfilesPost.kt | 152 - .../post/FakeuploadfilesPostRequestBody.kt | 49 - .../post/FakeuploadfilesPostResponses.kt | 53 - .../MultipartformdataSchema.kt | 325 -- .../FakeuploadfilesPostCode200Response.kt | 63 - .../applicationjson/ApplicationjsonSchema.kt | 19 - .../FakewildcardresponsesGet.kt | 124 - .../get/FakewildcardresponsesGetResponses.kt | 139 - ...FakewildcardresponsesGetCode1XXResponse.kt | 63 - ...FakewildcardresponsesGetCode200Response.kt | 63 - ...FakewildcardresponsesGetCode2XXResponse.kt | 63 - ...FakewildcardresponsesGetCode3XXResponse.kt | 63 - ...FakewildcardresponsesGetCode4XXResponse.kt | 63 - ...FakewildcardresponsesGetCode5XXResponse.kt | 63 - .../applicationjson/ApplicationjsonSchema.kt | 19 - .../applicationjson/ApplicationjsonSchema.kt | 19 - .../applicationjson/ApplicationjsonSchema.kt | 19 - .../applicationjson/ApplicationjsonSchema.kt | 19 - .../applicationjson/ApplicationjsonSchema.kt | 19 - .../applicationjson/ApplicationjsonSchema.kt | 19 - .../client/paths/foo/FooGet.kt | 124 - .../client/paths/foo/get/FooGetResponses.kt | 37 - .../client/paths/foo/get/FooGetServerInfo.kt | 63 - .../responses/FooGetCodedefaultResponse.kt | 63 - .../applicationjson/ApplicationjsonSchema.kt | 179 - .../paths/foo/get/servers/FooGetServer0.kt | 9 - .../paths/foo/get/servers/FooGetServer1.kt | 35 - .../servers/server1/FooGetServer1Variables.kt | 313 -- .../client/paths/pet/PetPost.kt | 215 - .../client/paths/pet/PetPut.kt | 214 - .../paths/pet/post/PetPostRequestBody.kt | 7 - .../client/paths/pet/post/PetPostResponses.kt | 66 - .../paths/pet/post/PetPostSecurityInfo.kt | 39 - .../post/responses/PetPostCode200Response.kt | 7 - .../post/responses/PetPostCode405Response.kt | 45 - .../PetPostSecurityRequirementObject0.kt | 24 - .../PetPostSecurityRequirementObject1.kt | 24 - .../PetPostSecurityRequirementObject2.kt | 24 - .../client/paths/pet/put/PetPutRequestBody.kt | 7 - .../client/paths/pet/put/PetPutResponses.kt | 72 - .../paths/pet/put/PetPutSecurityInfo.kt | 33 - .../put/responses/PetPutCode400Response.kt | 45 - .../put/responses/PetPutCode404Response.kt | 45 - .../put/responses/PetPutCode405Response.kt | 45 - .../PetPutSecurityRequirementObject0.kt | 24 - .../PetPutSecurityRequirementObject1.kt | 24 - .../petfindbystatus/PetfindbystatusGet.kt | 212 - .../PetfindbystatusServerInfo.kt | 63 - .../paths/petfindbystatus/get/Parameters.kt | 20 - .../get/PetfindbystatusGetQueryParameters.kt | 206 - .../get/PetfindbystatusGetResponses.kt | 66 - .../get/PetfindbystatusGetSecurityInfo.kt | 39 - .../get/parameters/Parameter0.kt | 23 - .../get/parameters/parameter0/Schema0.kt | 255 - .../PetfindbystatusGetCode200Response.kt | 7 - .../PetfindbystatusGetCode400Response.kt | 45 - ...ndbystatusGetSecurityRequirementObject0.kt | 24 - ...ndbystatusGetSecurityRequirementObject1.kt | 24 - ...ndbystatusGetSecurityRequirementObject2.kt | 24 - .../servers/PetfindbystatusServer0.kt | 9 - .../servers/PetfindbystatusServer1.kt | 35 - .../PetfindbystatusServer1Variables.kt | 313 -- .../paths/petfindbytags/PetfindbytagsGet.kt | 212 - .../paths/petfindbytags/get/Parameters.kt | 20 - .../get/PetfindbytagsGetQueryParameters.kt | 206 - .../get/PetfindbytagsGetResponses.kt | 66 - .../get/PetfindbytagsGetSecurityInfo.kt | 33 - .../get/parameters/Parameter0.kt | 23 - .../get/parameters/parameter0/Schema0.kt | 157 - .../PetfindbytagsGetCode200Response.kt | 7 - .../PetfindbytagsGetCode400Response.kt | 45 - ...findbytagsGetSecurityRequirementObject0.kt | 24 - ...findbytagsGetSecurityRequirementObject1.kt | 24 - .../client/paths/petpetid/PetpetidDelete.kt | 236 - .../client/paths/petpetid/PetpetidGet.kt | 211 - .../client/paths/petpetid/PetpetidPost.kt | 242 - .../paths/petpetid/delete/Parameters.kt | 32 - .../delete/PetpetidDeleteHeaderParameters.kt | 191 - .../delete/PetpetidDeletePathParameters.kt | 223 - .../delete/PetpetidDeleteResponses.kt | 48 - .../delete/PetpetidDeleteSecurityInfo.kt | 33 - .../petpetid/delete/parameters/Parameter0.kt | 23 - .../petpetid/delete/parameters/Parameter1.kt | 23 - .../delete/parameters/parameter0/Schema0.kt | 19 - .../delete/parameters/parameter1/Schema1.kt | 19 - .../PetpetidDeleteCode400Response.kt | 45 - ...etpetidDeleteSecurityRequirementObject0.kt | 24 - ...etpetidDeleteSecurityRequirementObject1.kt | 24 - .../client/paths/petpetid/get/Parameters.kt | 20 - .../petpetid/get/PetpetidGetPathParameters.kt | 223 - .../petpetid/get/PetpetidGetResponses.kt | 77 - .../petpetid/get/PetpetidGetSecurityInfo.kt | 24 - .../petpetid/get/parameters/Parameter0.kt | 23 - .../get/parameters/parameter0/Schema0.kt | 19 - .../responses/PetpetidGetCode200Response.kt | 81 - .../responses/PetpetidGetCode400Response.kt | 45 - .../responses/PetpetidGetCode404Response.kt | 45 - .../applicationjson/ApplicationjsonSchema.kt | 20 - .../applicationxml/ApplicationxmlSchema.kt | 19 - .../PetpetidGetSecurityRequirementObject0.kt | 24 - .../client/paths/petpetid/post/Parameters.kt | 20 - .../post/PetpetidPostPathParameters.kt | 223 - .../petpetid/post/PetpetidPostRequestBody.kt | 49 - .../petpetid/post/PetpetidPostResponses.kt | 48 - .../petpetid/post/PetpetidPostSecurityInfo.kt | 33 - .../petpetid/post/parameters/Parameter0.kt | 23 - .../post/parameters/parameter0/Schema0.kt | 19 - .../ApplicationxwwwformurlencodedSchema.kt | 238 - .../responses/PetpetidPostCode405Response.kt | 45 - .../PetpetidPostSecurityRequirementObject0.kt | 24 - .../PetpetidPostSecurityRequirementObject1.kt | 24 - .../PetpetiduploadimagePost.kt | 243 - .../petpetiduploadimage/post/Parameters.kt | 20 - .../PetpetiduploadimagePostPathParameters.kt | 223 - .../PetpetiduploadimagePostRequestBody.kt | 49 - .../post/PetpetiduploadimagePostResponses.kt | 54 - .../PetpetiduploadimagePostSecurityInfo.kt | 24 - .../post/parameters/Parameter0.kt | 23 - .../post/parameters/parameter0/Schema0.kt | 19 - .../MultipartformdataSchema.kt | 239 - .../PetpetiduploadimagePostCode200Response.kt | 7 - ...loadimagePostSecurityRequirementObject0.kt | 24 - .../client/paths/solidus/SolidusGet.kt | 124 - .../paths/solidus/get/SolidusGetResponses.kt | 53 - .../responses/SolidusGetCode200Response.kt | 7 - .../paths/storeinventory/StoreinventoryGet.kt | 152 - .../get/StoreinventoryGetResponses.kt | 54 - .../get/StoreinventoryGetSecurityInfo.kt | 24 - .../StoreinventoryGetCode200Response.kt | 7 - ...einventoryGetSecurityRequirementObject0.kt | 24 - .../client/paths/storeorder/StoreorderPost.kt | 183 - .../post/StoreorderPostRequestBody.kt | 49 - .../post/StoreorderPostResponses.kt | 66 - .../applicationjson/ApplicationjsonSchema.kt | 19 - .../StoreorderPostCode200Response.kt | 81 - .../StoreorderPostCode400Response.kt | 45 - .../applicationjson/ApplicationjsonSchema.kt | 19 - .../applicationxml/ApplicationxmlSchema.kt | 19 - .../StoreorderorderidDelete.kt | 178 - .../storeorderorderid/StoreorderorderidGet.kt | 179 - .../storeorderorderid/delete/Parameters.kt | 20 - .../StoreorderorderidDeletePathParameters.kt | 205 - .../StoreorderorderidDeleteResponses.kt | 61 - .../delete/parameters/Parameter0.kt | 23 - .../delete/parameters/parameter0/Schema0.kt | 19 - .../StoreorderorderidDeleteCode400Response.kt | 45 - .../StoreorderorderidDeleteCode404Response.kt | 45 - .../paths/storeorderorderid/get/Parameters.kt | 20 - .../get/StoreorderorderidGetPathParameters.kt | 223 - .../get/StoreorderorderidGetResponses.kt | 77 - .../get/parameters/Parameter0.kt | 23 - .../get/parameters/parameter0/Schema0.kt | 111 - .../StoreorderorderidGetCode200Response.kt | 81 - .../StoreorderorderidGetCode400Response.kt | 45 - .../StoreorderorderidGetCode404Response.kt | 45 - .../applicationjson/ApplicationjsonSchema.kt | 19 - .../applicationxml/ApplicationxmlSchema.kt | 19 - .../client/paths/user/UserPost.kt | 183 - .../paths/user/post/UserPostRequestBody.kt | 49 - .../paths/user/post/UserPostResponses.kt | 37 - .../applicationjson/ApplicationjsonSchema.kt | 19 - .../responses/UserPostCodedefaultResponse.kt | 45 - .../UsercreatewitharrayPost.kt | 183 - .../UsercreatewitharrayPostRequestBody.kt | 7 - .../post/UsercreatewitharrayPostResponses.kt | 37 - ...rcreatewitharrayPostCodedefaultResponse.kt | 45 - .../UsercreatewithlistPost.kt | 183 - .../post/UsercreatewithlistPostRequestBody.kt | 7 - .../post/UsercreatewithlistPostResponses.kt | 37 - ...ercreatewithlistPostCodedefaultResponse.kt | 45 - .../client/paths/userlogin/UserloginGet.kt | 180 - .../client/paths/userlogin/get/Parameters.kt | 22 - .../get/UserloginGetQueryParameters.kt | 255 - .../userlogin/get/UserloginGetResponses.kt | 67 - .../userlogin/get/parameters/Parameter0.kt | 23 - .../userlogin/get/parameters/Parameter1.kt | 23 - .../get/parameters/parameter0/Schema0.kt | 19 - .../get/parameters/parameter1/Schema1.kt | 19 - .../responses/UserloginGetCode200Response.kt | 83 - .../responses/UserloginGetCode400Response.kt | 45 - .../get/responses/code200response/Headers.kt | 26 - ...serloginGetCode200ResponseHeadersSchema.kt | 389 -- .../applicationjson/ApplicationjsonSchema.kt | 19 - .../applicationxml/ApplicationxmlSchema.kt | 19 - .../code200response/headers/Int32.kt | 7 - .../code200response/headers/NumberHeader.kt | 3 - .../headers/Refcontentschemaheader.kt | 7 - .../code200response/headers/XExpiresAfter.kt | 18 - .../code200response/headers/XRateLimit.kt | 31 - .../xexpiresafter/XExpiresAfterSchema.kt | 19 - .../applicationjson/XRateLimitSchema.kt | 19 - .../client/paths/userlogout/UserlogoutGet.kt | 124 - .../userlogout/get/UserlogoutGetResponses.kt | 37 - .../UserlogoutGetCodedefaultResponse.kt | 7 - .../paths/userusername/UserusernameDelete.kt | 179 - .../paths/userusername/UserusernameGet.kt | 179 - .../paths/userusername/UserusernamePut.kt | 240 - .../paths/userusername/delete/Parameters.kt | 20 - .../UserusernameDeletePathParameters.kt | 205 - .../delete/UserusernameDeleteResponses.kt | 66 - .../delete/parameters/Parameter0.kt | 7 - .../UserusernameDeleteCode200Response.kt | 7 - .../UserusernameDeleteCode404Response.kt | 45 - .../paths/userusername/get/Parameters.kt | 20 - .../get/UserusernameGetPathParameters.kt | 205 - .../get/UserusernameGetResponses.kt | 77 - .../userusername/get/parameters/Parameter0.kt | 7 - .../UserusernameGetCode200Response.kt | 81 - .../UserusernameGetCode400Response.kt | 45 - .../UserusernameGetCode404Response.kt | 45 - .../applicationjson/ApplicationjsonSchema.kt | 19 - .../applicationxml/ApplicationxmlSchema.kt | 19 - .../paths/userusername/put/Parameters.kt | 20 - .../put/UserusernamePutPathParameters.kt | 205 - .../put/UserusernamePutRequestBody.kt | 49 - .../put/UserusernamePutResponses.kt | 61 - .../userusername/put/parameters/Parameter0.kt | 7 - .../applicationjson/ApplicationjsonSchema.kt | 19 - .../UserusernamePutCode400Response.kt | 45 - .../UserusernamePutCode404Response.kt | 45 - .../client/requestbody/GenericRequestBody.kt | 6 - .../requestbody/RequestBodySerializer.kt | 47 - .../requestbody/SerializedRequestBody.kt | 13 - .../client/response/ApiResponse.kt | 9 - .../response/DeserializedHttpResponse.kt | 6 - .../client/response/HeadersDeserializer.kt | 37 - .../client/response/ResponseDeserializer.kt | 74 - .../client/response/ResponsesDeserializer.kt | 11 - .../client/restclient/RestClient.kt | 67 - .../client/schemas/SetMaker.kt | 20 - .../client/schemas/UnsetAddPropsSetter.kt | 77 - .../client/schemas/UuidJsonSchema.kt | 94 - .../validation/BooleanEnumValidator.kt | 8 - .../schemas/validation/BooleanValueMethod.kt | 5 - .../schemas/validation/DefaultValueMethod.kt | 7 - .../schemas/validation/DoubleEnumValidator.kt | 8 - .../schemas/validation/DoubleValueMethod.kt | 5 - .../schemas/validation/FloatEnumValidator.kt | 8 - .../schemas/validation/FloatValueMethod.kt | 5 - .../validation/IntegerEnumValidator.kt | 8 - .../schemas/validation/IntegerValueMethod.kt | 5 - .../client/schemas/validation/KeywordEntry.kt | 10 - .../schemas/validation/LongEnumValidator.kt | 8 - .../schemas/validation/LongValueMethod.kt | 5 - .../client/schemas/validation/MapUtils.kt | 33 - .../schemas/validation/NullEnumValidator.kt | 8 - .../schemas/validation/NullValueMethod.kt | 5 - .../schemas/validation/PropertyEntry.kt | 10 - .../schemas/validation/StringEnumValidator.kt | 8 - .../schemas/validation/StringValueMethod.kt | 5 - .../schemas/validation/ValidationData.kt | 11 - .../securityrequirementobjects/AuthApplier.kt | 40 - .../EmptySecurityRequirementObject.kt | 10 - .../SecurityRequirementObject.kt | 14 - .../SecurityRequirementObjectProvider.kt | 6 - .../ApiKeyCookieSecurityScheme.kt | 35 - .../ApiKeyHeaderSecurityScheme.kt | 31 - .../ApiKeyQuerySecurityScheme.kt | 33 - .../HttpBasicSecurityScheme.kt | 39 - .../HttpBearerSecurityScheme.kt | 41 - .../HttpDigestSecurityScheme.kt | 21 - .../HttpSignatureSecurityScheme.kt | 21 - .../MutualTlsSecurityScheme.kt | 20 - .../securityschemes/OAuth2SecurityScheme.kt | 21 - .../OpenIdConnectSecurityScheme.kt | 21 - .../client/securityschemes/SecurityScheme.kt | 19 - .../client/servers/RootServer0.kt | 38 - .../client/servers/RootServer1.kt | 37 - .../client/servers/RootServer2.kt | 9 - .../client/servers/ServerProvider.kt | 6 - .../client/servers/ServerWithVariables.kt | 21 - .../client/servers/ServerWithoutVariables.kt | 14 - .../rootserver0/RootServer0Variables.kt | 471 -- .../rootserver1/RootServer1Variables.kt | 313 -- .../schemas/AbstractStepMessageTest.kt | 18 - .../schemas/AdditionalPropertiesClassTest.kt | 18 - .../schemas/AdditionalPropertiesSchemaTest.kt | 18 - ...dditionalPropertiesWithArrayOfEnumsTest.kt | 18 - .../client/components/schemas/AddressTest.kt | 18 - .../components/schemas/AnimalFarmTest.kt | 18 - .../client/components/schemas/AnimalTest.kt | 18 - .../schemas/AnyTypeAndFormatTest.kt | 18 - .../schemas/AnyTypeNotStringTest.kt | 18 - .../schemas/ApiResponseSchemaTest.kt | 18 - .../client/components/schemas/AppleReqTest.kt | 18 - .../client/components/schemas/AppleTest.kt | 18 - .../schemas/ArrayHoldingAnyTypeTest.kt | 18 - .../schemas/ArrayOfArrayOfNumberOnlyTest.kt | 18 - .../components/schemas/ArrayOfEnumsTest.kt | 18 - .../schemas/ArrayOfNumberOnlyTest.kt | 18 - .../components/schemas/ArrayTestTest.kt | 18 - .../ArrayWithValidationsInItemsTest.kt | 18 - .../components/schemas/BananaReqTest.kt | 18 - .../client/components/schemas/BananaTest.kt | 18 - .../client/components/schemas/BarTest.kt | 18 - .../components/schemas/BasquePigTest.kt | 18 - .../components/schemas/BooleanEnumTest.kt | 18 - .../components/schemas/BooleanSchemaTest.kt | 18 - .../components/schemas/CapitalizationTest.kt | 18 - .../client/components/schemas/CatTest.kt | 18 - .../client/components/schemas/CategoryTest.kt | 18 - .../client/components/schemas/ChildCatTest.kt | 18 - .../components/schemas/ClassModelTest.kt | 18 - .../client/components/schemas/ClientTest.kt | 18 - .../schemas/ComplexQuadrilateralTest.kt | 18 - ...sedAnyOfDifferentTypesNoValidationsTest.kt | 18 - .../components/schemas/ComposedArrayTest.kt | 18 - .../components/schemas/ComposedBoolTest.kt | 18 - .../components/schemas/ComposedNoneTest.kt | 18 - .../components/schemas/ComposedNumberTest.kt | 18 - .../components/schemas/ComposedObjectTest.kt | 18 - .../ComposedOneOfDifferentTypesTest.kt | 18 - .../components/schemas/ComposedStringTest.kt | 18 - .../client/components/schemas/CurrencyTest.kt | 18 - .../components/schemas/DanishPigTest.kt | 18 - .../components/schemas/DateTimeTestTest.kt | 18 - .../schemas/DateTimeWithValidationsTest.kt | 18 - .../schemas/DateWithValidationsTest.kt | 18 - .../components/schemas/DecimalPayloadTest.kt | 18 - .../client/components/schemas/DogTest.kt | 18 - .../client/components/schemas/DrawingTest.kt | 18 - .../components/schemas/EnumArraysTest.kt | 18 - .../components/schemas/EnumClassTest.kt | 18 - .../client/components/schemas/EnumTestTest.kt | 18 - .../schemas/EquilateralTriangleTest.kt | 18 - .../schemas/FileSchemaTestClassTest.kt | 18 - .../client/components/schemas/FileTest.kt | 18 - .../client/components/schemas/FooTest.kt | 18 - .../components/schemas/FormatTestTest.kt | 18 - .../components/schemas/FromSchemaTest.kt | 18 - .../client/components/schemas/FruitReqTest.kt | 18 - .../client/components/schemas/FruitTest.kt | 18 - .../client/components/schemas/GmFruitTest.kt | 18 - .../schemas/GrandparentAnimalTest.kt | 18 - .../components/schemas/HasOnlyReadOnlyTest.kt | 18 - .../schemas/HealthCheckResultTest.kt | 18 - .../components/schemas/IntegerEnumBigTest.kt | 18 - .../schemas/IntegerEnumOneValueTest.kt | 18 - .../components/schemas/IntegerEnumTest.kt | 18 - .../IntegerEnumWithDefaultValueTest.kt | 18 - .../components/schemas/IntegerMax10Test.kt | 18 - .../components/schemas/IntegerMin15Test.kt | 18 - .../schemas/IsoscelesTriangleTest.kt | 18 - .../components/schemas/ItemsSchemaTest.kt | 18 - .../client/components/schemas/ItemsTest.kt | 18 - .../JSONPatchRequestAddReplaceTestTest.kt | 18 - .../schemas/JSONPatchRequestMoveCopyTest.kt | 18 - .../schemas/JSONPatchRequestRemoveTest.kt | 18 - .../schemas/JSONPatchRequestTest.kt | 18 - .../client/components/schemas/MammalTest.kt | 18 - .../client/components/schemas/MapTestTest.kt | 18 - ...pertiesAndAdditionalPropertiesClassTest.kt | 18 - .../client/components/schemas/MoneyTest.kt | 18 - .../schemas/MultiPropertiesSchemaTest.kt | 18 - .../components/schemas/MyObjectDtoTest.kt | 18 - .../client/components/schemas/NameTest.kt | 18 - .../schemas/NoAdditionalPropertiesTest.kt | 18 - .../components/schemas/NullableClassTest.kt | 18 - .../components/schemas/NullableShapeTest.kt | 18 - .../components/schemas/NullableStringTest.kt | 18 - .../components/schemas/NumberOnlyTest.kt | 18 - .../components/schemas/NumberSchemaTest.kt | 18 - .../schemas/NumberWithExclusiveMinMaxTest.kt | 18 - .../schemas/NumberWithValidationsTest.kt | 18 - .../schemas/ObjWithRequiredPropsBaseTest.kt | 18 - .../schemas/ObjWithRequiredPropsTest.kt | 18 - .../components/schemas/ObjectInterfaceTest.kt | 18 - ...ObjectModelWithArgAndArgsPropertiesTest.kt | 18 - .../schemas/ObjectModelWithRefPropsTest.kt | 18 - ...llOfWithReqTestPropFromUnsetAddPropTest.kt | 18 - .../ObjectWithCollidingPropertiesTest.kt | 18 - .../ObjectWithDecimalPropertiesTest.kt | 18 - .../ObjectWithDifficultlyNamedPropsTest.kt | 18 - ...ObjectWithInlineCompositionPropertyTest.kt | 18 - ...jectWithInvalidNamedRefedPropertiesTest.kt | 18 - .../ObjectWithNonIntersectingValuesTest.kt | 18 - .../ObjectWithOnlyOptionalPropsTest.kt | 18 - .../schemas/ObjectWithOptionalTestPropTest.kt | 18 - .../schemas/ObjectWithValidationsTest.kt | 18 - .../client/components/schemas/OrderTest.kt | 18 - .../schemas/PaginatedResultMyObjectDtoTest.kt | 18 - .../components/schemas/ParentPetTest.kt | 18 - .../client/components/schemas/PetTest.kt | 18 - .../client/components/schemas/PigTest.kt | 18 - .../client/components/schemas/PlayerTest.kt | 18 - .../components/schemas/PublicKeyTest.kt | 18 - .../schemas/QuadrilateralInterfaceTest.kt | 18 - .../components/schemas/QuadrilateralTest.kt | 18 - .../components/schemas/ReadOnlyFirstTest.kt | 18 - .../client/components/schemas/RefPetTest.kt | 18 - .../ReqPropsFromExplicitAddPropsTest.kt | 18 - .../schemas/ReqPropsFromTrueAddPropsTest.kt | 18 - .../schemas/ReqPropsFromUnsetAddPropsTest.kt | 18 - .../components/schemas/ReturnSchemaTest.kt | 18 - .../components/schemas/ScaleneTriangleTest.kt | 18 - .../schemas/Schema200ResponseTest.kt | 18 - .../schemas/SelfReferencingArrayModelTest.kt | 18 - .../schemas/SelfReferencingObjectModelTest.kt | 18 - .../components/schemas/ShapeOrNullTest.kt | 18 - .../client/components/schemas/ShapeTest.kt | 18 - .../schemas/SimpleQuadrilateralTest.kt | 18 - .../components/schemas/SomeObjectTest.kt | 18 - .../schemas/SpecialModelnameTest.kt | 18 - .../schemas/StringBooleanMapTest.kt | 18 - .../components/schemas/StringEnumTest.kt | 18 - .../schemas/StringEnumWithDefaultValueTest.kt | 18 - .../components/schemas/StringSchemaTest.kt | 18 - .../schemas/StringWithValidationTest.kt | 18 - .../client/components/schemas/TagTest.kt | 18 - .../schemas/TriangleInterfaceTest.kt | 18 - .../client/components/schemas/TriangleTest.kt | 18 - .../components/schemas/UUIDStringTest.kt | 18 - .../client/components/schemas/UserTest.kt | 18 - .../client/components/schemas/WhaleTest.kt | 18 - .../client/components/schemas/ZebraTest.kt | 18 - .../JsonSchemaKeywordFlagsTest.kt | 143 - .../client/header/ContentHeaderTest.kt | 120 - .../client/header/SchemaHeaderTest.kt | 177 - .../client/parameter/CookieSerializerTest.kt | 45 - .../client/parameter/HeadersSerializerTest.kt | 49 - .../client/parameter/PathSerializerTest.kt | 46 - .../client/parameter/QuerySerializerTest.kt | 52 - .../parameter/SchemaNonQueryParameterTest.kt | 397 -- .../parameter/SchemaQueryParameterTest.kt | 193 - .../requestbody/RequestBodySerializerTest.kt | 181 - .../response/ResponseDeserializerTest.kt | 248 - .../client/schemas/AnyTypeSchemaTest.kt | 106 - .../client/schemas/ArrayTypeSchemaTest.kt | 252 - .../client/schemas/BooleanSchemaTest.kt | 45 - .../client/schemas/ListBuilderTest.kt | 61 - .../client/schemas/ListSchemaTest.kt | 46 - .../client/schemas/MapSchemaTest.kt | 48 - .../client/schemas/NullSchemaTest.kt | 41 - .../client/schemas/NumberSchemaTest.kt | 57 - .../client/schemas/ObjectTypeSchemaTest.kt | 538 --- .../client/schemas/RefBooleanSchemaTest.kt | 49 - .../AdditionalPropertiesValidatorTest.kt | 149 - .../schemas/validation/CustomIsoparserTest.kt | 28 - .../schemas/validation/FormatValidatorTest.kt | 363 -- .../schemas/validation/ItemsValidatorTest.kt | 131 - .../schemas/validation/JsonSchemaTest.kt | 80 - .../validation/PropertiesValidatorTest.kt | 134 - .../validation/RequiredValidatorTest.kt | 120 - .../schemas/validation/TypeValidatorTest.kt | 56 - .../codegen/common/CodegenConstants.java | 2 +- .../codegen/config/CodegenConfigurator.java | 6 - .../codegen/config/GeneratorSettings.java | 6 - .../DefaultGeneratorRunner.java | 6 +- .../codegen/generators/DefaultGenerator.java | 4 +- .../codegen/generators/Generator.java | 2 +- .../generators/KotlinClientGenerator.java | 1012 ++-- src/main/resources/java/README.hbs | 10 +- src/main/resources/java/build.gradle.hbs | 2 +- src/main/resources/java/pom.hbs | 6 +- src/main/resources/java/settings.gradle.hbs | 2 +- src/main/resources/kotlin/README.hbs | 12 +- src/main/resources/kotlin/build.gradle.hbs | 14 +- src/main/resources/kotlin/settings.gradle.hbs | 2 +- .../packagename/components/schemas/Schema.hbs | 6 +- .../_Schema_anytypeOrMultitype.hbs | 259 +- .../schemas/SchemaClass/_Schema_boolean.hbs | 87 +- .../schemas/SchemaClass/_Schema_list.hbs | 123 +- .../schemas/SchemaClass/_Schema_map.hbs | 129 +- .../schemas/SchemaClass/_Schema_null.hbs | 87 +- .../schemas/SchemaClass/_Schema_number.hbs | 123 +- .../schemas/SchemaClass/_Schema_string.hbs | 120 +- .../SchemaClass/_Schema_varEqualsClass.hbs | 56 +- .../SchemaClass/_additionalProperties.hbs | 8 +- .../components/schemas/SchemaClass/_allOf.hbs | 16 +- .../components/schemas/SchemaClass/_anyOf.hbs | 16 +- .../schemas/SchemaClass/_boxedBoolean.hbs | 11 +- .../schemas/SchemaClass/_boxedClass.hbs | 6 +- .../schemas/SchemaClass/_boxedList.hbs | 17 +- .../schemas/SchemaClass/_boxedMap.hbs | 17 +- .../schemas/SchemaClass/_boxedNumber.hbs | 13 +- .../schemas/SchemaClass/_boxedString.hbs | 13 +- .../schemas/SchemaClass/_boxedVoid.hbs | 13 +- .../schemas/SchemaClass/_contains.hbs | 8 +- .../SchemaClass/_dependentRequired.hbs | 4 +- .../schemas/SchemaClass/_dependentSchemas.hbs | 16 +- .../components/schemas/SchemaClass/_else.hbs | 8 +- .../components/schemas/SchemaClass/_enum.hbs | 6 +- .../_getNewInstanceObject_implementor.hbs | 45 +- .../components/schemas/SchemaClass/_if.hbs | 8 +- .../components/schemas/SchemaClass/_items.hbs | 8 +- .../schemas/SchemaClass/_multipleOf.hbs | 4 +- .../components/schemas/SchemaClass/_not.hbs | 8 +- .../components/schemas/SchemaClass/_oneOf.hbs | 16 +- .../SchemaClass/_patternProperties.hbs | 16 +- .../schemas/SchemaClass/_prefixItems.hbs | 16 +- .../schemas/SchemaClass/_properties.hbs | 16 +- .../schemas/SchemaClass/_propertyNames.hbs | 8 +- .../schemas/SchemaClass/_required.hbs | 4 +- .../components/schemas/SchemaClass/_then.hbs | 8 +- .../components/schemas/SchemaClass/_types.hbs | 48 +- .../schemas/SchemaClass/_unevaluatedItems.hbs | 8 +- .../SchemaClass/_unevaluatedProperties.hbs | 8 +- .../schemas/SchemaClass/_validateAndBox.hbs | 62 +- .../SchemaClass/_validateAndBoxBoolean.hbs | 6 +- .../SchemaClass/_validateAndBoxList.hbs | 6 +- .../SchemaClass/_validateAndBoxMap.hbs | 6 +- .../SchemaClass/_validateAndBoxNumber.hbs | 6 +- .../SchemaClass/_validateAndBoxString.hbs | 6 +- .../SchemaClass/_validateAndBoxVoid.hbs | 6 +- .../SchemaClass/_validate_implementor.hbs | 600 +-- .../components/schemas/Schema_doc.hbs | 20 +- .../components/schemas/_arrayInputAddItem.hbs | 214 +- .../components/schemas/_arrayInputType.hbs | 21 +- .../components/schemas/_arrayOutputType.hbs | 12 +- .../schemas/_containerClassName.hbs | 32 +- .../components/schemas/_enumTypes.hbs | 72 +- .../schemas/_objectInputAddPropSetter.hbs | 321 +- .../_objectInputAddPropUnsetSetterDocs.hbs | 18 +- .../components/schemas/_objectInputSetter.hbs | 264 +- .../components/schemas/_objectInputType.hbs | 68 +- .../schemas/_objectOutputGetProperty.hbs | 30 +- .../schemas/_objectOutputProperties.hbs | 41 +- .../components/schemas/_objectOutputType.hbs | 47 +- .../schemas/docschema_arrayInput.hbs | 10 +- .../schemas/docschema_fields_field.hbs | 6 +- .../components/schemas/docschema_io_types.hbs | 98 +- .../schemas/docschema_objectInput.hbs | 8 +- .../schemas/helpers/payload_renderer.hbs | 10 +- .../schemas/types/_schema_input_type_base.hbs | 44 +- .../types/_schema_output_type_base.hbs | 40 +- .../schemas/validateSchemaCodeSample.hbs | 4 +- .../packagename/schemas/AnyTypeJsonSchema.hbs | 56 +- .../packagename/schemas/BooleanJsonSchema.hbs | 24 +- .../packagename/schemas/DateJsonSchema.hbs | 40 +- .../schemas/DateTimeJsonSchema.hbs | 28 +- .../packagename/schemas/DecimalJsonSchema.hbs | 26 +- .../packagename/schemas/DoubleJsonSchema.hbs | 28 +- .../packagename/schemas/FloatJsonSchema.hbs | 28 +- .../packagename/schemas/GenericBuilder.hbs | 2 +- .../packagename/schemas/Int32JsonSchema.hbs | 26 +- .../packagename/schemas/Int64JsonSchema.hbs | 26 +- .../packagename/schemas/IntJsonSchema.hbs | 26 +- .../packagename/schemas/ListJsonSchema.hbs | 28 +- .../packagename/schemas/MapJsonSchema.hbs | 32 +- .../schemas/NotAnyTypeJsonSchema.hbs | 68 +- .../packagename/schemas/NullJsonSchema.hbs | 22 +- .../packagename/schemas/NumberJsonSchema.hbs | 26 +- .../kotlin/packagename/schemas/SetMaker.hbs | 20 - .../packagename/schemas/StringJsonSchema.hbs | 26 +- .../schemas/UnsetAddPropsSetter.hbs | 120 +- .../packagename/schemas/UuidJsonSchema.hbs | 133 +- .../AdditionalPropertiesValidator.hbs | 4 +- .../schemas/validation/AllOfValidator.hbs | 4 +- .../schemas/validation/AnyOfValidator.hbs | 4 +- .../validation/BigDecimalValidator.hbs | 6 +- .../validation/BooleanEnumValidator.hbs | 11 +- .../validation/BooleanSchemaValidator.hbs | 6 +- .../schemas/validation/BooleanValueMethod.hbs | 6 +- .../schemas/validation/ConstValidator.hbs | 6 +- .../schemas/validation/ContainsValidator.hbs | 4 +- .../schemas/validation/CustomIsoparser.hbs | 6 +- .../schemas/validation/DefaultValueMethod.hbs | 9 +- .../validation/DependentRequiredValidator.hbs | 4 +- .../validation/DependentSchemasValidator.hbs | 6 +- .../validation/DoubleEnumValidator.hbs | 11 +- .../schemas/validation/DoubleValueMethod.hbs | 6 +- .../schemas/validation/ElseValidator.hbs | 4 +- .../schemas/validation/EnumValidator.hbs | 6 +- .../validation/ExclusiveMaximumValidator.hbs | 4 +- .../validation/ExclusiveMinimumValidator.hbs | 4 +- .../schemas/validation/FloatEnumValidator.hbs | 11 +- .../schemas/validation/FloatValueMethod.hbs | 6 +- .../schemas/validation/FormatValidator.hbs | 4 +- .../schemas/validation/FrozenList.hbs | 2 +- .../schemas/validation/FrozenMap.hbs | 6 +- .../schemas/validation/IfValidator.hbs | 4 +- .../validation/IntegerEnumValidator.hbs | 11 +- .../schemas/validation/IntegerValueMethod.hbs | 6 +- .../schemas/validation/ItemsValidator.hbs | 4 +- .../schemas/validation/JsonSchema.hbs | 14 +- .../schemas/validation/JsonSchemaFactory.hbs | 9 +- .../schemas/validation/JsonSchemaInfo.hbs | 110 +- .../schemas/validation/KeywordEntry.hbs | 12 +- .../schemas/validation/KeywordValidator.hbs | 4 +- .../schemas/validation/LengthValidator.hbs | 4 +- .../schemas/validation/ListMaker.hbs | 10 +- .../validation/ListSchemaValidator.hbs | 6 +- .../schemas/validation/LongEnumValidator.hbs | 11 +- .../schemas/validation/LongValueMethod.hbs | 6 +- .../schemas/validation/MapSchemaValidator.hbs | 6 +- .../schemas/validation/MapUtils.hbs | 52 +- .../validation/MaxContainsValidator.hbs | 4 +- .../schemas/validation/MaxItemsValidator.hbs | 4 +- .../schemas/validation/MaxLengthValidator.hbs | 4 +- .../validation/MaxPropertiesValidator.hbs | 4 +- .../schemas/validation/MaximumValidator.hbs | 4 +- .../validation/MinContainsValidator.hbs | 4 +- .../schemas/validation/MinItemsValidator.hbs | 4 +- .../schemas/validation/MinLengthValidator.hbs | 4 +- .../validation/MinPropertiesValidator.hbs | 4 +- .../schemas/validation/MinimumValidator.hbs | 4 +- .../validation/MultipleOfValidator.hbs | 6 +- .../schemas/validation/NotValidator.hbs | 4 +- .../schemas/validation/NullEnumValidator.hbs | 11 +- .../validation/NullSchemaValidator.hbs | 6 +- .../schemas/validation/NullValueMethod.hbs | 6 +- .../validation/NumberSchemaValidator.hbs | 6 +- .../schemas/validation/OneOfValidator.hbs | 4 +- .../schemas/validation/PathToSchemasMap.hbs | 2 +- .../validation/PatternPropertiesValidator.hbs | 2 +- .../schemas/validation/PatternValidator.hbs | 6 +- .../validation/PrefixItemsValidator.hbs | 4 +- .../validation/PropertiesValidator.hbs | 4 +- .../schemas/validation/PropertyEntry.hbs | 10 - .../validation/PropertyNamesValidator.hbs | 4 +- .../schemas/validation/RequiredValidator.hbs | 4 +- .../validation/StringEnumValidator.hbs | 11 +- .../validation/StringSchemaValidator.hbs | 6 +- .../schemas/validation/StringValueMethod.hbs | 6 +- .../schemas/validation/ThenValidator.hbs | 4 +- .../schemas/validation/TypeValidator.hbs | 25 +- .../validation/UnevaluatedItemsValidator.hbs | 4 +- .../UnevaluatedPropertiesValidator.hbs | 4 +- .../validation/UniqueItemsValidator.hbs | 4 +- .../validation/UnsetAnyTypeJsonSchema.hbs | 18 +- .../schemas/validation/ValidationData.hbs | 10 +- .../schemas/validation/ValidationMetadata.hbs | 6 +- .../kotlin/packagename/servers/Server.hbs | 5 +- .../kotlin/packagename/servers/ServerInfo.hbs | 60 +- .../kotlin/packagename/servers/ServerN.hbs | 7 +- .../packagename/servers/ServerProvider.hbs | 4 +- .../servers/ServerWithVariables.hbs | 27 +- .../servers/ServerWithoutVariables.hbs | 12 +- .../components/schemas/Schema_test.hbs | 53 +- .../JsonSchemaKeywordFlagsTest.hbs | 190 +- .../packagename/schemas/AnyTypeSchemaTest.hbs | 153 +- .../schemas/ArrayTypeSchemaTest.hbs | 391 +- .../packagename/schemas/BooleanSchemaTest.hbs | 76 +- .../packagename/schemas/ListBuilderTest.hbs | 74 +- .../packagename/schemas/ListSchemaTest.hbs | 79 +- .../packagename/schemas/MapSchemaTest.hbs | 82 +- .../packagename/schemas/NullSchemaTest.hbs | 71 +- .../packagename/schemas/NumberSchemaTest.hbs | 93 +- .../schemas/ObjectTypeSchemaTest.hbs | 859 ++-- .../schemas/RefBooleanSchemaTest.hbs | 94 +- .../AdditionalPropertiesValidatorTest.hbs | 239 +- .../validation/CustomIsoparserTest.hbs | 35 +- .../validation/FormatValidatorTest.hbs | 599 +-- .../schemas/validation/ItemsValidatorTest.hbs | 207 +- .../schemas/validation/JsonSchemaTest.hbs | 117 +- .../validation/PropertiesValidatorTest.hbs | 213 +- .../validation/RequiredValidatorTest.hbs | 186 +- .../schemas/validation/TypeValidatorTest.hbs | 90 +- 2523 files changed, 75870 insertions(+), 236066 deletions(-) create mode 100644 .circleci/testKotlinClientSamples.sh create mode 100644 bin/generate_samples_configs/kotlin_3_0_3_unit_test.yaml create mode 100644 docs/generators/kotlin.md rename samples/client/{petstore => 3_0_3_unit_test}/kotlin/.gitignore (100%) rename samples/client/{petstore => 3_0_3_unit_test}/kotlin/.openapi-generator-ignore (100%) create mode 100644 samples/client/3_0_3_unit_test/kotlin/.openapi-generator/FILES rename samples/client/{petstore => 3_0_3_unit_test}/kotlin/.openapi-generator/VERSION (100%) create mode 100644 samples/client/3_0_3_unit_test/kotlin/README.md rename samples/client/{petstore => 3_0_3_unit_test}/kotlin/build.gradle.kts (71%) rename samples/client/{petstore => 3_0_3_unit_test}/kotlin/docs/RootServerInfo.md (77%) create mode 100644 samples/client/3_0_3_unit_test/kotlin/docs/components/schemas/AdditionalpropertiesAllowsASchemaWhichShouldValidate.md create mode 100644 samples/client/3_0_3_unit_test/kotlin/docs/components/schemas/AdditionalpropertiesAreAllowedByDefault.md create mode 100644 samples/client/3_0_3_unit_test/kotlin/docs/components/schemas/AdditionalpropertiesCanExistByItself.md create mode 100644 samples/client/3_0_3_unit_test/kotlin/docs/components/schemas/AdditionalpropertiesShouldNotLookInApplicators.md create mode 100644 samples/client/3_0_3_unit_test/kotlin/docs/components/schemas/Allof.md create mode 100644 samples/client/3_0_3_unit_test/kotlin/docs/components/schemas/AllofCombinedWithAnyofOneof.md create mode 100644 samples/client/3_0_3_unit_test/kotlin/docs/components/schemas/AllofSimpleTypes.md create mode 100644 samples/client/3_0_3_unit_test/kotlin/docs/components/schemas/AllofWithBaseSchema.md create mode 100644 samples/client/3_0_3_unit_test/kotlin/docs/components/schemas/AllofWithOneEmptySchema.md create mode 100644 samples/client/3_0_3_unit_test/kotlin/docs/components/schemas/AllofWithTheFirstEmptySchema.md create mode 100644 samples/client/3_0_3_unit_test/kotlin/docs/components/schemas/AllofWithTheLastEmptySchema.md create mode 100644 samples/client/3_0_3_unit_test/kotlin/docs/components/schemas/AllofWithTwoEmptySchemas.md create mode 100644 samples/client/3_0_3_unit_test/kotlin/docs/components/schemas/Anyof.md create mode 100644 samples/client/3_0_3_unit_test/kotlin/docs/components/schemas/AnyofComplexTypes.md create mode 100644 samples/client/3_0_3_unit_test/kotlin/docs/components/schemas/AnyofWithBaseSchema.md create mode 100644 samples/client/3_0_3_unit_test/kotlin/docs/components/schemas/AnyofWithOneEmptySchema.md create mode 100644 samples/client/3_0_3_unit_test/kotlin/docs/components/schemas/ArrayTypeMatchesArrays.md create mode 100644 samples/client/3_0_3_unit_test/kotlin/docs/components/schemas/BooleanTypeMatchesBooleans.md create mode 100644 samples/client/3_0_3_unit_test/kotlin/docs/components/schemas/ByInt.md create mode 100644 samples/client/3_0_3_unit_test/kotlin/docs/components/schemas/ByNumber.md create mode 100644 samples/client/3_0_3_unit_test/kotlin/docs/components/schemas/BySmallNumber.md create mode 100644 samples/client/3_0_3_unit_test/kotlin/docs/components/schemas/DateTimeFormat.md create mode 100644 samples/client/3_0_3_unit_test/kotlin/docs/components/schemas/EmailFormat.md create mode 100644 samples/client/3_0_3_unit_test/kotlin/docs/components/schemas/EnumWith0DoesNotMatchFalse.md create mode 100644 samples/client/3_0_3_unit_test/kotlin/docs/components/schemas/EnumWith1DoesNotMatchTrue.md create mode 100644 samples/client/3_0_3_unit_test/kotlin/docs/components/schemas/EnumWithEscapedCharacters.md create mode 100644 samples/client/3_0_3_unit_test/kotlin/docs/components/schemas/EnumWithFalseDoesNotMatch0.md create mode 100644 samples/client/3_0_3_unit_test/kotlin/docs/components/schemas/EnumWithTrueDoesNotMatch1.md create mode 100644 samples/client/3_0_3_unit_test/kotlin/docs/components/schemas/EnumsInProperties.md create mode 100644 samples/client/3_0_3_unit_test/kotlin/docs/components/schemas/ForbiddenProperty.md create mode 100644 samples/client/3_0_3_unit_test/kotlin/docs/components/schemas/HostnameFormat.md create mode 100644 samples/client/3_0_3_unit_test/kotlin/docs/components/schemas/IntegerTypeMatchesIntegers.md create mode 100644 samples/client/3_0_3_unit_test/kotlin/docs/components/schemas/InvalidInstanceShouldNotRaiseErrorWhenFloatDivisionInf.md create mode 100644 samples/client/3_0_3_unit_test/kotlin/docs/components/schemas/InvalidStringValueForDefault.md create mode 100644 samples/client/3_0_3_unit_test/kotlin/docs/components/schemas/Ipv4Format.md create mode 100644 samples/client/3_0_3_unit_test/kotlin/docs/components/schemas/Ipv6Format.md create mode 100644 samples/client/3_0_3_unit_test/kotlin/docs/components/schemas/JsonPointerFormat.md create mode 100644 samples/client/3_0_3_unit_test/kotlin/docs/components/schemas/MaximumValidation.md create mode 100644 samples/client/3_0_3_unit_test/kotlin/docs/components/schemas/MaximumValidationWithUnsignedInteger.md create mode 100644 samples/client/3_0_3_unit_test/kotlin/docs/components/schemas/MaxitemsValidation.md create mode 100644 samples/client/3_0_3_unit_test/kotlin/docs/components/schemas/MaxlengthValidation.md create mode 100644 samples/client/3_0_3_unit_test/kotlin/docs/components/schemas/Maxproperties0MeansTheObjectIsEmpty.md create mode 100644 samples/client/3_0_3_unit_test/kotlin/docs/components/schemas/MaxpropertiesValidation.md create mode 100644 samples/client/3_0_3_unit_test/kotlin/docs/components/schemas/MinimumValidation.md create mode 100644 samples/client/3_0_3_unit_test/kotlin/docs/components/schemas/MinimumValidationWithSignedInteger.md create mode 100644 samples/client/3_0_3_unit_test/kotlin/docs/components/schemas/MinitemsValidation.md create mode 100644 samples/client/3_0_3_unit_test/kotlin/docs/components/schemas/MinlengthValidation.md create mode 100644 samples/client/3_0_3_unit_test/kotlin/docs/components/schemas/MinpropertiesValidation.md create mode 100644 samples/client/3_0_3_unit_test/kotlin/docs/components/schemas/NestedAllofToCheckValidationSemantics.md create mode 100644 samples/client/3_0_3_unit_test/kotlin/docs/components/schemas/NestedAnyofToCheckValidationSemantics.md create mode 100644 samples/client/3_0_3_unit_test/kotlin/docs/components/schemas/NestedItems.md create mode 100644 samples/client/3_0_3_unit_test/kotlin/docs/components/schemas/NestedOneofToCheckValidationSemantics.md create mode 100644 samples/client/3_0_3_unit_test/kotlin/docs/components/schemas/Not.md create mode 100644 samples/client/3_0_3_unit_test/kotlin/docs/components/schemas/NotMoreComplexSchema.md create mode 100644 samples/client/3_0_3_unit_test/kotlin/docs/components/schemas/NulCharactersInStrings.md create mode 100644 samples/client/3_0_3_unit_test/kotlin/docs/components/schemas/NullTypeMatchesOnlyTheNullObject.md create mode 100644 samples/client/3_0_3_unit_test/kotlin/docs/components/schemas/NumberTypeMatchesNumbers.md create mode 100644 samples/client/3_0_3_unit_test/kotlin/docs/components/schemas/ObjectPropertiesValidation.md create mode 100644 samples/client/3_0_3_unit_test/kotlin/docs/components/schemas/ObjectTypeMatchesObjects.md create mode 100644 samples/client/3_0_3_unit_test/kotlin/docs/components/schemas/Oneof.md create mode 100644 samples/client/3_0_3_unit_test/kotlin/docs/components/schemas/OneofComplexTypes.md create mode 100644 samples/client/3_0_3_unit_test/kotlin/docs/components/schemas/OneofWithBaseSchema.md create mode 100644 samples/client/3_0_3_unit_test/kotlin/docs/components/schemas/OneofWithEmptySchema.md create mode 100644 samples/client/3_0_3_unit_test/kotlin/docs/components/schemas/OneofWithRequired.md create mode 100644 samples/client/3_0_3_unit_test/kotlin/docs/components/schemas/PatternIsNotAnchored.md create mode 100644 samples/client/3_0_3_unit_test/kotlin/docs/components/schemas/PatternValidation.md create mode 100644 samples/client/3_0_3_unit_test/kotlin/docs/components/schemas/PropertiesWithEscapedCharacters.md create mode 100644 samples/client/3_0_3_unit_test/kotlin/docs/components/schemas/PropertyNamedRefThatIsNotAReference.md create mode 100644 samples/client/3_0_3_unit_test/kotlin/docs/components/schemas/RefInAdditionalproperties.md create mode 100644 samples/client/3_0_3_unit_test/kotlin/docs/components/schemas/RefInAllof.md create mode 100644 samples/client/3_0_3_unit_test/kotlin/docs/components/schemas/RefInAnyof.md create mode 100644 samples/client/3_0_3_unit_test/kotlin/docs/components/schemas/RefInItems.md create mode 100644 samples/client/3_0_3_unit_test/kotlin/docs/components/schemas/RefInNot.md create mode 100644 samples/client/3_0_3_unit_test/kotlin/docs/components/schemas/RefInOneof.md create mode 100644 samples/client/3_0_3_unit_test/kotlin/docs/components/schemas/RefInProperty.md create mode 100644 samples/client/3_0_3_unit_test/kotlin/docs/components/schemas/RequiredDefaultValidation.md create mode 100644 samples/client/3_0_3_unit_test/kotlin/docs/components/schemas/RequiredValidation.md create mode 100644 samples/client/3_0_3_unit_test/kotlin/docs/components/schemas/RequiredWithEmptyArray.md create mode 100644 samples/client/3_0_3_unit_test/kotlin/docs/components/schemas/RequiredWithEscapedCharacters.md create mode 100644 samples/client/3_0_3_unit_test/kotlin/docs/components/schemas/SimpleEnumValidation.md create mode 100644 samples/client/3_0_3_unit_test/kotlin/docs/components/schemas/StringTypeMatchesStrings.md create mode 100644 samples/client/3_0_3_unit_test/kotlin/docs/components/schemas/TheDefaultKeywordDoesNotDoAnythingIfThePropertyIsMissing.md create mode 100644 samples/client/3_0_3_unit_test/kotlin/docs/components/schemas/UniqueitemsFalseValidation.md create mode 100644 samples/client/3_0_3_unit_test/kotlin/docs/components/schemas/UniqueitemsValidation.md create mode 100644 samples/client/3_0_3_unit_test/kotlin/docs/components/schemas/UriFormat.md create mode 100644 samples/client/3_0_3_unit_test/kotlin/docs/components/schemas/UriReferenceFormat.md create mode 100644 samples/client/3_0_3_unit_test/kotlin/docs/components/schemas/UriTemplateFormat.md rename samples/client/{petstore/kotlin/docs/servers/RootServer2.md => 3_0_3_unit_test/kotlin/docs/servers/RootServer0.md} (57%) create mode 100644 samples/client/3_0_3_unit_test/kotlin/settings.gradle.kts create mode 100644 samples/client/3_0_3_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/RootServerInfo.kt create mode 100644 samples/client/3_0_3_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/schemas/AdditionalpropertiesAllowsASchemaWhichShouldValidate.kt create mode 100644 samples/client/3_0_3_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/schemas/AdditionalpropertiesAreAllowedByDefault.kt create mode 100644 samples/client/3_0_3_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/schemas/AdditionalpropertiesCanExistByItself.kt create mode 100644 samples/client/3_0_3_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/schemas/AdditionalpropertiesShouldNotLookInApplicators.kt create mode 100644 samples/client/3_0_3_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/schemas/Allof.kt create mode 100644 samples/client/3_0_3_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/schemas/AllofCombinedWithAnyofOneof.kt create mode 100644 samples/client/3_0_3_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/schemas/AllofSimpleTypes.kt create mode 100644 samples/client/3_0_3_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/schemas/AllofWithBaseSchema.kt create mode 100644 samples/client/3_0_3_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/schemas/AllofWithOneEmptySchema.kt create mode 100644 samples/client/3_0_3_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/schemas/AllofWithTheFirstEmptySchema.kt create mode 100644 samples/client/3_0_3_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/schemas/AllofWithTheLastEmptySchema.kt create mode 100644 samples/client/3_0_3_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/schemas/AllofWithTwoEmptySchemas.kt create mode 100644 samples/client/3_0_3_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/schemas/Anyof.kt create mode 100644 samples/client/3_0_3_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/schemas/AnyofComplexTypes.kt create mode 100644 samples/client/3_0_3_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/schemas/AnyofWithBaseSchema.kt create mode 100644 samples/client/3_0_3_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/schemas/AnyofWithOneEmptySchema.kt create mode 100644 samples/client/3_0_3_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/schemas/ArrayTypeMatchesArrays.kt create mode 100644 samples/client/3_0_3_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/schemas/BooleanTypeMatchesBooleans.kt create mode 100644 samples/client/3_0_3_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/schemas/ByInt.kt create mode 100644 samples/client/3_0_3_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/schemas/ByNumber.kt create mode 100644 samples/client/3_0_3_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/schemas/BySmallNumber.kt create mode 100644 samples/client/3_0_3_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/schemas/DateTimeFormat.kt create mode 100644 samples/client/3_0_3_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/schemas/EmailFormat.kt create mode 100644 samples/client/3_0_3_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/schemas/EnumWith0DoesNotMatchFalse.kt create mode 100644 samples/client/3_0_3_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/schemas/EnumWith1DoesNotMatchTrue.kt create mode 100644 samples/client/3_0_3_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/schemas/EnumWithEscapedCharacters.kt create mode 100644 samples/client/3_0_3_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/schemas/EnumWithFalseDoesNotMatch0.kt create mode 100644 samples/client/3_0_3_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/schemas/EnumWithTrueDoesNotMatch1.kt create mode 100644 samples/client/3_0_3_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/schemas/EnumsInProperties.kt create mode 100644 samples/client/3_0_3_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/schemas/ForbiddenProperty.kt create mode 100644 samples/client/3_0_3_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/schemas/HostnameFormat.kt create mode 100644 samples/client/3_0_3_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/schemas/IntegerTypeMatchesIntegers.kt create mode 100644 samples/client/3_0_3_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/schemas/InvalidInstanceShouldNotRaiseErrorWhenFloatDivisionInf.kt create mode 100644 samples/client/3_0_3_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/schemas/InvalidStringValueForDefault.kt create mode 100644 samples/client/3_0_3_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/schemas/Ipv4Format.kt create mode 100644 samples/client/3_0_3_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/schemas/Ipv6Format.kt create mode 100644 samples/client/3_0_3_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/schemas/JsonPointerFormat.kt create mode 100644 samples/client/3_0_3_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/schemas/MaximumValidation.kt create mode 100644 samples/client/3_0_3_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/schemas/MaximumValidationWithUnsignedInteger.kt create mode 100644 samples/client/3_0_3_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/schemas/MaxitemsValidation.kt create mode 100644 samples/client/3_0_3_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/schemas/MaxlengthValidation.kt create mode 100644 samples/client/3_0_3_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/schemas/Maxproperties0MeansTheObjectIsEmpty.kt create mode 100644 samples/client/3_0_3_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/schemas/MaxpropertiesValidation.kt create mode 100644 samples/client/3_0_3_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/schemas/MinimumValidation.kt create mode 100644 samples/client/3_0_3_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/schemas/MinimumValidationWithSignedInteger.kt create mode 100644 samples/client/3_0_3_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/schemas/MinitemsValidation.kt create mode 100644 samples/client/3_0_3_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/schemas/MinlengthValidation.kt create mode 100644 samples/client/3_0_3_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/schemas/MinpropertiesValidation.kt create mode 100644 samples/client/3_0_3_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/schemas/NestedAllofToCheckValidationSemantics.kt create mode 100644 samples/client/3_0_3_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/schemas/NestedAnyofToCheckValidationSemantics.kt create mode 100644 samples/client/3_0_3_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/schemas/NestedItems.kt create mode 100644 samples/client/3_0_3_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/schemas/NestedOneofToCheckValidationSemantics.kt create mode 100644 samples/client/3_0_3_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/schemas/Not.kt create mode 100644 samples/client/3_0_3_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/schemas/NotMoreComplexSchema.kt create mode 100644 samples/client/3_0_3_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/schemas/NulCharactersInStrings.kt create mode 100644 samples/client/3_0_3_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/schemas/NullTypeMatchesOnlyTheNullObject.kt create mode 100644 samples/client/3_0_3_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/schemas/NumberTypeMatchesNumbers.kt create mode 100644 samples/client/3_0_3_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/schemas/ObjectPropertiesValidation.kt create mode 100644 samples/client/3_0_3_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/schemas/ObjectTypeMatchesObjects.kt create mode 100644 samples/client/3_0_3_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/schemas/Oneof.kt create mode 100644 samples/client/3_0_3_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/schemas/OneofComplexTypes.kt create mode 100644 samples/client/3_0_3_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/schemas/OneofWithBaseSchema.kt create mode 100644 samples/client/3_0_3_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/schemas/OneofWithEmptySchema.kt create mode 100644 samples/client/3_0_3_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/schemas/OneofWithRequired.kt create mode 100644 samples/client/3_0_3_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/schemas/PatternIsNotAnchored.kt create mode 100644 samples/client/3_0_3_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/schemas/PatternValidation.kt create mode 100644 samples/client/3_0_3_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/schemas/PropertiesWithEscapedCharacters.kt create mode 100644 samples/client/3_0_3_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/schemas/PropertyNamedRefThatIsNotAReference.kt create mode 100644 samples/client/3_0_3_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/schemas/RefInAdditionalproperties.kt create mode 100644 samples/client/3_0_3_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/schemas/RefInAllof.kt create mode 100644 samples/client/3_0_3_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/schemas/RefInAnyof.kt create mode 100644 samples/client/3_0_3_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/schemas/RefInItems.kt create mode 100644 samples/client/3_0_3_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/schemas/RefInNot.kt create mode 100644 samples/client/3_0_3_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/schemas/RefInOneof.kt create mode 100644 samples/client/3_0_3_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/schemas/RefInProperty.kt create mode 100644 samples/client/3_0_3_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/schemas/RequiredDefaultValidation.kt create mode 100644 samples/client/3_0_3_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/schemas/RequiredValidation.kt create mode 100644 samples/client/3_0_3_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/schemas/RequiredWithEmptyArray.kt create mode 100644 samples/client/3_0_3_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/schemas/RequiredWithEscapedCharacters.kt create mode 100644 samples/client/3_0_3_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/schemas/SimpleEnumValidation.kt create mode 100644 samples/client/3_0_3_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/schemas/StringTypeMatchesStrings.kt create mode 100644 samples/client/3_0_3_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/schemas/TheDefaultKeywordDoesNotDoAnythingIfThePropertyIsMissing.kt create mode 100644 samples/client/3_0_3_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/schemas/UniqueitemsFalseValidation.kt create mode 100644 samples/client/3_0_3_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/schemas/UniqueitemsValidation.kt create mode 100644 samples/client/3_0_3_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/schemas/UriFormat.kt create mode 100644 samples/client/3_0_3_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/schemas/UriReferenceFormat.kt create mode 100644 samples/client/3_0_3_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/schemas/UriTemplateFormat.kt rename samples/client/{petstore => 3_0_3_unit_test}/kotlin/src/main/kotlin/org/openapijsonschematools/client/configurations/JsonSchemaKeywordFlags.kt (99%) create mode 100644 samples/client/3_0_3_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/configurations/SchemaConfiguration.kt create mode 100644 samples/client/3_0_3_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/exceptions/BaseException.kt rename samples/client/{petstore => 3_0_3_unit_test}/kotlin/src/main/kotlin/org/openapijsonschematools/client/exceptions/InvalidAdditionalPropertyException.kt (51%) create mode 100644 samples/client/3_0_3_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/exceptions/UnsetPropertyException.kt create mode 100644 samples/client/3_0_3_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/exceptions/ValidationException.kt rename samples/client/{petstore => 3_0_3_unit_test}/kotlin/src/main/kotlin/org/openapijsonschematools/client/schemas/AnyTypeJsonSchema.kt (95%) rename samples/client/{petstore => 3_0_3_unit_test}/kotlin/src/main/kotlin/org/openapijsonschematools/client/schemas/BooleanJsonSchema.kt (95%) rename samples/client/{petstore => 3_0_3_unit_test}/kotlin/src/main/kotlin/org/openapijsonschematools/client/schemas/DateJsonSchema.kt (85%) rename samples/client/{petstore => 3_0_3_unit_test}/kotlin/src/main/kotlin/org/openapijsonschematools/client/schemas/DateTimeJsonSchema.kt (93%) rename samples/client/{petstore => 3_0_3_unit_test}/kotlin/src/main/kotlin/org/openapijsonschematools/client/schemas/DecimalJsonSchema.kt (93%) rename samples/client/{petstore => 3_0_3_unit_test}/kotlin/src/main/kotlin/org/openapijsonschematools/client/schemas/DoubleJsonSchema.kt (89%) rename samples/client/{petstore => 3_0_3_unit_test}/kotlin/src/main/kotlin/org/openapijsonschematools/client/schemas/FloatJsonSchema.kt (91%) rename samples/client/{petstore => 3_0_3_unit_test}/kotlin/src/main/kotlin/org/openapijsonschematools/client/schemas/GenericBuilder.kt (99%) rename samples/client/{petstore => 3_0_3_unit_test}/kotlin/src/main/kotlin/org/openapijsonschematools/client/schemas/Int32JsonSchema.kt (94%) rename samples/client/{petstore => 3_0_3_unit_test}/kotlin/src/main/kotlin/org/openapijsonschematools/client/schemas/Int64JsonSchema.kt (94%) rename samples/client/{petstore => 3_0_3_unit_test}/kotlin/src/main/kotlin/org/openapijsonschematools/client/schemas/IntJsonSchema.kt (95%) rename samples/client/{petstore => 3_0_3_unit_test}/kotlin/src/main/kotlin/org/openapijsonschematools/client/schemas/ListJsonSchema.kt (95%) rename samples/client/{petstore => 3_0_3_unit_test}/kotlin/src/main/kotlin/org/openapijsonschematools/client/schemas/MapJsonSchema.kt (92%) rename samples/client/{petstore => 3_0_3_unit_test}/kotlin/src/main/kotlin/org/openapijsonschematools/client/schemas/NotAnyTypeJsonSchema.kt (92%) rename samples/client/{petstore => 3_0_3_unit_test}/kotlin/src/main/kotlin/org/openapijsonschematools/client/schemas/NullJsonSchema.kt (96%) rename samples/client/{petstore => 3_0_3_unit_test}/kotlin/src/main/kotlin/org/openapijsonschematools/client/schemas/NumberJsonSchema.kt (94%) rename samples/client/{petstore => 3_0_3_unit_test}/kotlin/src/main/kotlin/org/openapijsonschematools/client/schemas/StringJsonSchema.kt (94%) create mode 100644 samples/client/3_0_3_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/schemas/UnsetAddPropsSetter.kt create mode 100644 samples/client/3_0_3_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/schemas/UuidJsonSchema.kt rename samples/client/{petstore => 3_0_3_unit_test}/kotlin/src/main/kotlin/org/openapijsonschematools/client/schemas/validation/AdditionalPropertiesValidator.kt (100%) rename samples/client/{petstore => 3_0_3_unit_test}/kotlin/src/main/kotlin/org/openapijsonschematools/client/schemas/validation/AllOfValidator.kt (99%) rename samples/client/{petstore => 3_0_3_unit_test}/kotlin/src/main/kotlin/org/openapijsonschematools/client/schemas/validation/AnyOfValidator.kt (99%) rename samples/client/{petstore => 3_0_3_unit_test}/kotlin/src/main/kotlin/org/openapijsonschematools/client/schemas/validation/BigDecimalValidator.kt (99%) create mode 100644 samples/client/3_0_3_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/schemas/validation/BooleanEnumValidator.kt rename samples/client/{petstore => 3_0_3_unit_test}/kotlin/src/main/kotlin/org/openapijsonschematools/client/schemas/validation/BooleanSchemaValidator.kt (100%) create mode 100644 samples/client/3_0_3_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/schemas/validation/BooleanValueMethod.kt rename samples/client/{petstore => 3_0_3_unit_test}/kotlin/src/main/kotlin/org/openapijsonschematools/client/schemas/validation/ConstValidator.kt (99%) rename samples/client/{petstore => 3_0_3_unit_test}/kotlin/src/main/kotlin/org/openapijsonschematools/client/schemas/validation/ContainsValidator.kt (100%) rename samples/client/{petstore => 3_0_3_unit_test}/kotlin/src/main/kotlin/org/openapijsonschematools/client/schemas/validation/CustomIsoparser.kt (100%) create mode 100644 samples/client/3_0_3_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/schemas/validation/DefaultValueMethod.kt rename samples/client/{petstore => 3_0_3_unit_test}/kotlin/src/main/kotlin/org/openapijsonschematools/client/schemas/validation/DependentRequiredValidator.kt (99%) rename samples/client/{petstore => 3_0_3_unit_test}/kotlin/src/main/kotlin/org/openapijsonschematools/client/schemas/validation/DependentSchemasValidator.kt (87%) create mode 100644 samples/client/3_0_3_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/schemas/validation/DoubleEnumValidator.kt create mode 100644 samples/client/3_0_3_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/schemas/validation/DoubleValueMethod.kt rename samples/client/{petstore => 3_0_3_unit_test}/kotlin/src/main/kotlin/org/openapijsonschematools/client/schemas/validation/ElseValidator.kt (99%) rename samples/client/{petstore => 3_0_3_unit_test}/kotlin/src/main/kotlin/org/openapijsonschematools/client/schemas/validation/EnumValidator.kt (99%) rename samples/client/{petstore => 3_0_3_unit_test}/kotlin/src/main/kotlin/org/openapijsonschematools/client/schemas/validation/ExclusiveMaximumValidator.kt (100%) rename samples/client/{petstore => 3_0_3_unit_test}/kotlin/src/main/kotlin/org/openapijsonschematools/client/schemas/validation/ExclusiveMinimumValidator.kt (100%) create mode 100644 samples/client/3_0_3_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/schemas/validation/FloatEnumValidator.kt create mode 100644 samples/client/3_0_3_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/schemas/validation/FloatValueMethod.kt rename samples/client/{petstore => 3_0_3_unit_test}/kotlin/src/main/kotlin/org/openapijsonschematools/client/schemas/validation/FormatValidator.kt (99%) rename samples/client/{petstore => 3_0_3_unit_test}/kotlin/src/main/kotlin/org/openapijsonschematools/client/schemas/validation/FrozenList.kt (99%) rename samples/client/{petstore => 3_0_3_unit_test}/kotlin/src/main/kotlin/org/openapijsonschematools/client/schemas/validation/FrozenMap.kt (99%) rename samples/client/{petstore => 3_0_3_unit_test}/kotlin/src/main/kotlin/org/openapijsonschematools/client/schemas/validation/IfValidator.kt (99%) create mode 100644 samples/client/3_0_3_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/schemas/validation/IntegerEnumValidator.kt create mode 100644 samples/client/3_0_3_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/schemas/validation/IntegerValueMethod.kt rename samples/client/{petstore => 3_0_3_unit_test}/kotlin/src/main/kotlin/org/openapijsonschematools/client/schemas/validation/ItemsValidator.kt (100%) rename samples/client/{petstore => 3_0_3_unit_test}/kotlin/src/main/kotlin/org/openapijsonschematools/client/schemas/validation/JsonSchema.kt (97%) rename samples/client/{petstore => 3_0_3_unit_test}/kotlin/src/main/kotlin/org/openapijsonschematools/client/schemas/validation/JsonSchemaFactory.kt (83%) rename samples/client/{petstore => 3_0_3_unit_test}/kotlin/src/main/kotlin/org/openapijsonschematools/client/schemas/validation/JsonSchemaInfo.kt (57%) create mode 100644 samples/client/3_0_3_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/schemas/validation/KeywordEntry.kt rename samples/client/{petstore => 3_0_3_unit_test}/kotlin/src/main/kotlin/org/openapijsonschematools/client/schemas/validation/KeywordValidator.kt (100%) rename samples/client/{petstore => 3_0_3_unit_test}/kotlin/src/main/kotlin/org/openapijsonschematools/client/schemas/validation/LengthValidator.kt (100%) rename samples/client/{petstore => 3_0_3_unit_test}/kotlin/src/main/kotlin/org/openapijsonschematools/client/schemas/validation/ListSchemaValidator.kt (100%) create mode 100644 samples/client/3_0_3_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/schemas/validation/LongEnumValidator.kt create mode 100644 samples/client/3_0_3_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/schemas/validation/LongValueMethod.kt rename samples/client/{petstore => 3_0_3_unit_test}/kotlin/src/main/kotlin/org/openapijsonschematools/client/schemas/validation/MapSchemaValidator.kt (100%) create mode 100644 samples/client/3_0_3_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/schemas/validation/MapUtils.kt rename samples/client/{petstore => 3_0_3_unit_test}/kotlin/src/main/kotlin/org/openapijsonschematools/client/schemas/validation/MaxContainsValidator.kt (100%) rename samples/client/{petstore => 3_0_3_unit_test}/kotlin/src/main/kotlin/org/openapijsonschematools/client/schemas/validation/MaxItemsValidator.kt (100%) rename samples/client/{petstore => 3_0_3_unit_test}/kotlin/src/main/kotlin/org/openapijsonschematools/client/schemas/validation/MaxLengthValidator.kt (100%) rename samples/client/{petstore => 3_0_3_unit_test}/kotlin/src/main/kotlin/org/openapijsonschematools/client/schemas/validation/MaxPropertiesValidator.kt (99%) rename samples/client/{petstore => 3_0_3_unit_test}/kotlin/src/main/kotlin/org/openapijsonschematools/client/schemas/validation/MaximumValidator.kt (100%) rename samples/client/{petstore => 3_0_3_unit_test}/kotlin/src/main/kotlin/org/openapijsonschematools/client/schemas/validation/MinContainsValidator.kt (100%) rename samples/client/{petstore => 3_0_3_unit_test}/kotlin/src/main/kotlin/org/openapijsonschematools/client/schemas/validation/MinItemsValidator.kt (99%) rename samples/client/{petstore => 3_0_3_unit_test}/kotlin/src/main/kotlin/org/openapijsonschematools/client/schemas/validation/MinLengthValidator.kt (100%) rename samples/client/{petstore => 3_0_3_unit_test}/kotlin/src/main/kotlin/org/openapijsonschematools/client/schemas/validation/MinPropertiesValidator.kt (99%) rename samples/client/{petstore => 3_0_3_unit_test}/kotlin/src/main/kotlin/org/openapijsonschematools/client/schemas/validation/MinimumValidator.kt (99%) rename samples/client/{petstore => 3_0_3_unit_test}/kotlin/src/main/kotlin/org/openapijsonschematools/client/schemas/validation/MultipleOfValidator.kt (99%) rename samples/client/{petstore => 3_0_3_unit_test}/kotlin/src/main/kotlin/org/openapijsonschematools/client/schemas/validation/NotValidator.kt (100%) create mode 100644 samples/client/3_0_3_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/schemas/validation/NullEnumValidator.kt rename samples/client/{petstore => 3_0_3_unit_test}/kotlin/src/main/kotlin/org/openapijsonschematools/client/schemas/validation/NullSchemaValidator.kt (100%) create mode 100644 samples/client/3_0_3_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/schemas/validation/NullValueMethod.kt rename samples/client/{petstore => 3_0_3_unit_test}/kotlin/src/main/kotlin/org/openapijsonschematools/client/schemas/validation/NumberSchemaValidator.kt (100%) rename samples/client/{petstore => 3_0_3_unit_test}/kotlin/src/main/kotlin/org/openapijsonschematools/client/schemas/validation/OneOfValidator.kt (99%) rename samples/client/{petstore => 3_0_3_unit_test}/kotlin/src/main/kotlin/org/openapijsonschematools/client/schemas/validation/PathToSchemasMap.kt (100%) rename samples/client/{petstore => 3_0_3_unit_test}/kotlin/src/main/kotlin/org/openapijsonschematools/client/schemas/validation/PatternPropertiesValidator.kt (100%) rename samples/client/{petstore => 3_0_3_unit_test}/kotlin/src/main/kotlin/org/openapijsonschematools/client/schemas/validation/PatternValidator.kt (99%) rename samples/client/{petstore => 3_0_3_unit_test}/kotlin/src/main/kotlin/org/openapijsonschematools/client/schemas/validation/PrefixItemsValidator.kt (99%) rename samples/client/{petstore => 3_0_3_unit_test}/kotlin/src/main/kotlin/org/openapijsonschematools/client/schemas/validation/PropertiesValidator.kt (100%) rename samples/client/{petstore => 3_0_3_unit_test}/kotlin/src/main/kotlin/org/openapijsonschematools/client/schemas/validation/PropertyNamesValidator.kt (100%) rename samples/client/{petstore => 3_0_3_unit_test}/kotlin/src/main/kotlin/org/openapijsonschematools/client/schemas/validation/RequiredValidator.kt (100%) create mode 100644 samples/client/3_0_3_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/schemas/validation/StringEnumValidator.kt rename samples/client/{petstore => 3_0_3_unit_test}/kotlin/src/main/kotlin/org/openapijsonschematools/client/schemas/validation/StringSchemaValidator.kt (100%) create mode 100644 samples/client/3_0_3_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/schemas/validation/StringValueMethod.kt rename samples/client/{petstore => 3_0_3_unit_test}/kotlin/src/main/kotlin/org/openapijsonschematools/client/schemas/validation/ThenValidator.kt (99%) rename samples/client/{petstore => 3_0_3_unit_test}/kotlin/src/main/kotlin/org/openapijsonschematools/client/schemas/validation/TypeValidator.kt (64%) rename samples/client/{petstore => 3_0_3_unit_test}/kotlin/src/main/kotlin/org/openapijsonschematools/client/schemas/validation/UnevaluatedItemsValidator.kt (99%) rename samples/client/{petstore => 3_0_3_unit_test}/kotlin/src/main/kotlin/org/openapijsonschematools/client/schemas/validation/UnevaluatedPropertiesValidator.kt (100%) rename samples/client/{petstore => 3_0_3_unit_test}/kotlin/src/main/kotlin/org/openapijsonschematools/client/schemas/validation/UniqueItemsValidator.kt (100%) rename samples/client/{petstore => 3_0_3_unit_test}/kotlin/src/main/kotlin/org/openapijsonschematools/client/schemas/validation/UnsetAnyTypeJsonSchema.kt (98%) create mode 100644 samples/client/3_0_3_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/schemas/validation/ValidationData.kt rename samples/client/{petstore => 3_0_3_unit_test}/kotlin/src/main/kotlin/org/openapijsonschematools/client/schemas/validation/ValidationMetadata.kt (85%) create mode 100644 samples/client/3_0_3_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/servers/RootServer0.kt rename samples/client/{petstore => 3_0_3_unit_test}/kotlin/src/main/kotlin/org/openapijsonschematools/client/servers/Server.kt (54%) create mode 100644 samples/client/3_0_3_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/servers/ServerProvider.kt create mode 100644 samples/client/3_0_3_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/servers/ServerWithVariables.kt create mode 100644 samples/client/3_0_3_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/servers/ServerWithoutVariables.kt create mode 100644 samples/client/3_0_3_unit_test/kotlin/src/test/kotlin/org/openapijsonschematools/client/components/schemas/AdditionalpropertiesAllowsASchemaWhichShouldValidateTest.kt create mode 100644 samples/client/3_0_3_unit_test/kotlin/src/test/kotlin/org/openapijsonschematools/client/components/schemas/AdditionalpropertiesAreAllowedByDefaultTest.kt create mode 100644 samples/client/3_0_3_unit_test/kotlin/src/test/kotlin/org/openapijsonschematools/client/components/schemas/AdditionalpropertiesCanExistByItselfTest.kt create mode 100644 samples/client/3_0_3_unit_test/kotlin/src/test/kotlin/org/openapijsonschematools/client/components/schemas/AdditionalpropertiesShouldNotLookInApplicatorsTest.kt create mode 100644 samples/client/3_0_3_unit_test/kotlin/src/test/kotlin/org/openapijsonschematools/client/components/schemas/AllofCombinedWithAnyofOneofTest.kt create mode 100644 samples/client/3_0_3_unit_test/kotlin/src/test/kotlin/org/openapijsonschematools/client/components/schemas/AllofSimpleTypesTest.kt create mode 100644 samples/client/3_0_3_unit_test/kotlin/src/test/kotlin/org/openapijsonschematools/client/components/schemas/AllofTest.kt create mode 100644 samples/client/3_0_3_unit_test/kotlin/src/test/kotlin/org/openapijsonschematools/client/components/schemas/AllofWithBaseSchemaTest.kt create mode 100644 samples/client/3_0_3_unit_test/kotlin/src/test/kotlin/org/openapijsonschematools/client/components/schemas/AllofWithOneEmptySchemaTest.kt create mode 100644 samples/client/3_0_3_unit_test/kotlin/src/test/kotlin/org/openapijsonschematools/client/components/schemas/AllofWithTheFirstEmptySchemaTest.kt create mode 100644 samples/client/3_0_3_unit_test/kotlin/src/test/kotlin/org/openapijsonschematools/client/components/schemas/AllofWithTheLastEmptySchemaTest.kt create mode 100644 samples/client/3_0_3_unit_test/kotlin/src/test/kotlin/org/openapijsonschematools/client/components/schemas/AllofWithTwoEmptySchemasTest.kt create mode 100644 samples/client/3_0_3_unit_test/kotlin/src/test/kotlin/org/openapijsonschematools/client/components/schemas/AnyofComplexTypesTest.kt create mode 100644 samples/client/3_0_3_unit_test/kotlin/src/test/kotlin/org/openapijsonschematools/client/components/schemas/AnyofTest.kt create mode 100644 samples/client/3_0_3_unit_test/kotlin/src/test/kotlin/org/openapijsonschematools/client/components/schemas/AnyofWithBaseSchemaTest.kt create mode 100644 samples/client/3_0_3_unit_test/kotlin/src/test/kotlin/org/openapijsonschematools/client/components/schemas/AnyofWithOneEmptySchemaTest.kt create mode 100644 samples/client/3_0_3_unit_test/kotlin/src/test/kotlin/org/openapijsonschematools/client/components/schemas/ArrayTypeMatchesArraysTest.kt create mode 100644 samples/client/3_0_3_unit_test/kotlin/src/test/kotlin/org/openapijsonschematools/client/components/schemas/BooleanTypeMatchesBooleansTest.kt create mode 100644 samples/client/3_0_3_unit_test/kotlin/src/test/kotlin/org/openapijsonschematools/client/components/schemas/ByIntTest.kt create mode 100644 samples/client/3_0_3_unit_test/kotlin/src/test/kotlin/org/openapijsonschematools/client/components/schemas/ByNumberTest.kt create mode 100644 samples/client/3_0_3_unit_test/kotlin/src/test/kotlin/org/openapijsonschematools/client/components/schemas/BySmallNumberTest.kt create mode 100644 samples/client/3_0_3_unit_test/kotlin/src/test/kotlin/org/openapijsonschematools/client/components/schemas/DateTimeFormatTest.kt create mode 100644 samples/client/3_0_3_unit_test/kotlin/src/test/kotlin/org/openapijsonschematools/client/components/schemas/EmailFormatTest.kt create mode 100644 samples/client/3_0_3_unit_test/kotlin/src/test/kotlin/org/openapijsonschematools/client/components/schemas/EnumWith0DoesNotMatchFalseTest.kt create mode 100644 samples/client/3_0_3_unit_test/kotlin/src/test/kotlin/org/openapijsonschematools/client/components/schemas/EnumWith1DoesNotMatchTrueTest.kt create mode 100644 samples/client/3_0_3_unit_test/kotlin/src/test/kotlin/org/openapijsonschematools/client/components/schemas/EnumWithEscapedCharactersTest.kt create mode 100644 samples/client/3_0_3_unit_test/kotlin/src/test/kotlin/org/openapijsonschematools/client/components/schemas/EnumWithFalseDoesNotMatch0Test.kt create mode 100644 samples/client/3_0_3_unit_test/kotlin/src/test/kotlin/org/openapijsonschematools/client/components/schemas/EnumWithTrueDoesNotMatch1Test.kt create mode 100644 samples/client/3_0_3_unit_test/kotlin/src/test/kotlin/org/openapijsonschematools/client/components/schemas/EnumsInPropertiesTest.kt create mode 100644 samples/client/3_0_3_unit_test/kotlin/src/test/kotlin/org/openapijsonschematools/client/components/schemas/ForbiddenPropertyTest.kt create mode 100644 samples/client/3_0_3_unit_test/kotlin/src/test/kotlin/org/openapijsonschematools/client/components/schemas/HostnameFormatTest.kt create mode 100644 samples/client/3_0_3_unit_test/kotlin/src/test/kotlin/org/openapijsonschematools/client/components/schemas/IntegerTypeMatchesIntegersTest.kt create mode 100644 samples/client/3_0_3_unit_test/kotlin/src/test/kotlin/org/openapijsonschematools/client/components/schemas/InvalidInstanceShouldNotRaiseErrorWhenFloatDivisionInfTest.kt create mode 100644 samples/client/3_0_3_unit_test/kotlin/src/test/kotlin/org/openapijsonschematools/client/components/schemas/InvalidStringValueForDefaultTest.kt create mode 100644 samples/client/3_0_3_unit_test/kotlin/src/test/kotlin/org/openapijsonschematools/client/components/schemas/Ipv4FormatTest.kt create mode 100644 samples/client/3_0_3_unit_test/kotlin/src/test/kotlin/org/openapijsonschematools/client/components/schemas/Ipv6FormatTest.kt create mode 100644 samples/client/3_0_3_unit_test/kotlin/src/test/kotlin/org/openapijsonschematools/client/components/schemas/JsonPointerFormatTest.kt create mode 100644 samples/client/3_0_3_unit_test/kotlin/src/test/kotlin/org/openapijsonschematools/client/components/schemas/MaximumValidationTest.kt create mode 100644 samples/client/3_0_3_unit_test/kotlin/src/test/kotlin/org/openapijsonschematools/client/components/schemas/MaximumValidationWithUnsignedIntegerTest.kt create mode 100644 samples/client/3_0_3_unit_test/kotlin/src/test/kotlin/org/openapijsonschematools/client/components/schemas/MaxitemsValidationTest.kt create mode 100644 samples/client/3_0_3_unit_test/kotlin/src/test/kotlin/org/openapijsonschematools/client/components/schemas/MaxlengthValidationTest.kt create mode 100644 samples/client/3_0_3_unit_test/kotlin/src/test/kotlin/org/openapijsonschematools/client/components/schemas/Maxproperties0MeansTheObjectIsEmptyTest.kt create mode 100644 samples/client/3_0_3_unit_test/kotlin/src/test/kotlin/org/openapijsonschematools/client/components/schemas/MaxpropertiesValidationTest.kt create mode 100644 samples/client/3_0_3_unit_test/kotlin/src/test/kotlin/org/openapijsonschematools/client/components/schemas/MinimumValidationTest.kt create mode 100644 samples/client/3_0_3_unit_test/kotlin/src/test/kotlin/org/openapijsonschematools/client/components/schemas/MinimumValidationWithSignedIntegerTest.kt create mode 100644 samples/client/3_0_3_unit_test/kotlin/src/test/kotlin/org/openapijsonschematools/client/components/schemas/MinitemsValidationTest.kt create mode 100644 samples/client/3_0_3_unit_test/kotlin/src/test/kotlin/org/openapijsonschematools/client/components/schemas/MinlengthValidationTest.kt create mode 100644 samples/client/3_0_3_unit_test/kotlin/src/test/kotlin/org/openapijsonschematools/client/components/schemas/MinpropertiesValidationTest.kt create mode 100644 samples/client/3_0_3_unit_test/kotlin/src/test/kotlin/org/openapijsonschematools/client/components/schemas/NestedAllofToCheckValidationSemanticsTest.kt create mode 100644 samples/client/3_0_3_unit_test/kotlin/src/test/kotlin/org/openapijsonschematools/client/components/schemas/NestedAnyofToCheckValidationSemanticsTest.kt create mode 100644 samples/client/3_0_3_unit_test/kotlin/src/test/kotlin/org/openapijsonschematools/client/components/schemas/NestedItemsTest.kt create mode 100644 samples/client/3_0_3_unit_test/kotlin/src/test/kotlin/org/openapijsonschematools/client/components/schemas/NestedOneofToCheckValidationSemanticsTest.kt create mode 100644 samples/client/3_0_3_unit_test/kotlin/src/test/kotlin/org/openapijsonschematools/client/components/schemas/NotMoreComplexSchemaTest.kt create mode 100644 samples/client/3_0_3_unit_test/kotlin/src/test/kotlin/org/openapijsonschematools/client/components/schemas/NotTest.kt create mode 100644 samples/client/3_0_3_unit_test/kotlin/src/test/kotlin/org/openapijsonschematools/client/components/schemas/NulCharactersInStringsTest.kt create mode 100644 samples/client/3_0_3_unit_test/kotlin/src/test/kotlin/org/openapijsonschematools/client/components/schemas/NullTypeMatchesOnlyTheNullObjectTest.kt create mode 100644 samples/client/3_0_3_unit_test/kotlin/src/test/kotlin/org/openapijsonschematools/client/components/schemas/NumberTypeMatchesNumbersTest.kt create mode 100644 samples/client/3_0_3_unit_test/kotlin/src/test/kotlin/org/openapijsonschematools/client/components/schemas/ObjectPropertiesValidationTest.kt create mode 100644 samples/client/3_0_3_unit_test/kotlin/src/test/kotlin/org/openapijsonschematools/client/components/schemas/ObjectTypeMatchesObjectsTest.kt create mode 100644 samples/client/3_0_3_unit_test/kotlin/src/test/kotlin/org/openapijsonschematools/client/components/schemas/OneofComplexTypesTest.kt create mode 100644 samples/client/3_0_3_unit_test/kotlin/src/test/kotlin/org/openapijsonschematools/client/components/schemas/OneofTest.kt create mode 100644 samples/client/3_0_3_unit_test/kotlin/src/test/kotlin/org/openapijsonschematools/client/components/schemas/OneofWithBaseSchemaTest.kt create mode 100644 samples/client/3_0_3_unit_test/kotlin/src/test/kotlin/org/openapijsonschematools/client/components/schemas/OneofWithEmptySchemaTest.kt create mode 100644 samples/client/3_0_3_unit_test/kotlin/src/test/kotlin/org/openapijsonschematools/client/components/schemas/OneofWithRequiredTest.kt create mode 100644 samples/client/3_0_3_unit_test/kotlin/src/test/kotlin/org/openapijsonschematools/client/components/schemas/PatternIsNotAnchoredTest.kt create mode 100644 samples/client/3_0_3_unit_test/kotlin/src/test/kotlin/org/openapijsonschematools/client/components/schemas/PatternValidationTest.kt create mode 100644 samples/client/3_0_3_unit_test/kotlin/src/test/kotlin/org/openapijsonschematools/client/components/schemas/PropertiesWithEscapedCharactersTest.kt create mode 100644 samples/client/3_0_3_unit_test/kotlin/src/test/kotlin/org/openapijsonschematools/client/components/schemas/PropertyNamedRefThatIsNotAReferenceTest.kt create mode 100644 samples/client/3_0_3_unit_test/kotlin/src/test/kotlin/org/openapijsonschematools/client/components/schemas/RefInAdditionalpropertiesTest.kt create mode 100644 samples/client/3_0_3_unit_test/kotlin/src/test/kotlin/org/openapijsonschematools/client/components/schemas/RefInAllofTest.kt create mode 100644 samples/client/3_0_3_unit_test/kotlin/src/test/kotlin/org/openapijsonschematools/client/components/schemas/RefInAnyofTest.kt create mode 100644 samples/client/3_0_3_unit_test/kotlin/src/test/kotlin/org/openapijsonschematools/client/components/schemas/RefInItemsTest.kt create mode 100644 samples/client/3_0_3_unit_test/kotlin/src/test/kotlin/org/openapijsonschematools/client/components/schemas/RefInNotTest.kt create mode 100644 samples/client/3_0_3_unit_test/kotlin/src/test/kotlin/org/openapijsonschematools/client/components/schemas/RefInOneofTest.kt create mode 100644 samples/client/3_0_3_unit_test/kotlin/src/test/kotlin/org/openapijsonschematools/client/components/schemas/RefInPropertyTest.kt create mode 100644 samples/client/3_0_3_unit_test/kotlin/src/test/kotlin/org/openapijsonschematools/client/components/schemas/RequiredDefaultValidationTest.kt create mode 100644 samples/client/3_0_3_unit_test/kotlin/src/test/kotlin/org/openapijsonschematools/client/components/schemas/RequiredValidationTest.kt create mode 100644 samples/client/3_0_3_unit_test/kotlin/src/test/kotlin/org/openapijsonschematools/client/components/schemas/RequiredWithEmptyArrayTest.kt create mode 100644 samples/client/3_0_3_unit_test/kotlin/src/test/kotlin/org/openapijsonschematools/client/components/schemas/RequiredWithEscapedCharactersTest.kt create mode 100644 samples/client/3_0_3_unit_test/kotlin/src/test/kotlin/org/openapijsonschematools/client/components/schemas/SimpleEnumValidationTest.kt create mode 100644 samples/client/3_0_3_unit_test/kotlin/src/test/kotlin/org/openapijsonschematools/client/components/schemas/StringTypeMatchesStringsTest.kt create mode 100644 samples/client/3_0_3_unit_test/kotlin/src/test/kotlin/org/openapijsonschematools/client/components/schemas/TheDefaultKeywordDoesNotDoAnythingIfThePropertyIsMissingTest.kt create mode 100644 samples/client/3_0_3_unit_test/kotlin/src/test/kotlin/org/openapijsonschematools/client/components/schemas/UniqueitemsFalseValidationTest.kt create mode 100644 samples/client/3_0_3_unit_test/kotlin/src/test/kotlin/org/openapijsonschematools/client/components/schemas/UniqueitemsValidationTest.kt create mode 100644 samples/client/3_0_3_unit_test/kotlin/src/test/kotlin/org/openapijsonschematools/client/components/schemas/UriFormatTest.kt create mode 100644 samples/client/3_0_3_unit_test/kotlin/src/test/kotlin/org/openapijsonschematools/client/components/schemas/UriReferenceFormatTest.kt create mode 100644 samples/client/3_0_3_unit_test/kotlin/src/test/kotlin/org/openapijsonschematools/client/components/schemas/UriTemplateFormatTest.kt create mode 100644 samples/client/3_0_3_unit_test/kotlin/src/test/kotlin/org/openapijsonschematools/client/configurations/JsonSchemaKeywordFlagsTest.kt create mode 100644 samples/client/3_0_3_unit_test/kotlin/src/test/kotlin/org/openapijsonschematools/client/schemas/AnyTypeSchemaTest.kt create mode 100644 samples/client/3_0_3_unit_test/kotlin/src/test/kotlin/org/openapijsonschematools/client/schemas/ArrayTypeSchemaTest.kt create mode 100644 samples/client/3_0_3_unit_test/kotlin/src/test/kotlin/org/openapijsonschematools/client/schemas/BooleanSchemaTest.kt create mode 100644 samples/client/3_0_3_unit_test/kotlin/src/test/kotlin/org/openapijsonschematools/client/schemas/ListBuilderTest.kt create mode 100644 samples/client/3_0_3_unit_test/kotlin/src/test/kotlin/org/openapijsonschematools/client/schemas/ListSchemaTest.kt create mode 100644 samples/client/3_0_3_unit_test/kotlin/src/test/kotlin/org/openapijsonschematools/client/schemas/MapSchemaTest.kt create mode 100644 samples/client/3_0_3_unit_test/kotlin/src/test/kotlin/org/openapijsonschematools/client/schemas/NullSchemaTest.kt create mode 100644 samples/client/3_0_3_unit_test/kotlin/src/test/kotlin/org/openapijsonschematools/client/schemas/NumberSchemaTest.kt create mode 100644 samples/client/3_0_3_unit_test/kotlin/src/test/kotlin/org/openapijsonschematools/client/schemas/ObjectTypeSchemaTest.kt create mode 100644 samples/client/3_0_3_unit_test/kotlin/src/test/kotlin/org/openapijsonschematools/client/schemas/RefBooleanSchemaTest.kt create mode 100644 samples/client/3_0_3_unit_test/kotlin/src/test/kotlin/org/openapijsonschematools/client/schemas/validation/AdditionalPropertiesValidatorTest.kt create mode 100644 samples/client/3_0_3_unit_test/kotlin/src/test/kotlin/org/openapijsonschematools/client/schemas/validation/CustomIsoparserTest.kt create mode 100644 samples/client/3_0_3_unit_test/kotlin/src/test/kotlin/org/openapijsonschematools/client/schemas/validation/FormatValidatorTest.kt create mode 100644 samples/client/3_0_3_unit_test/kotlin/src/test/kotlin/org/openapijsonschematools/client/schemas/validation/ItemsValidatorTest.kt create mode 100644 samples/client/3_0_3_unit_test/kotlin/src/test/kotlin/org/openapijsonschematools/client/schemas/validation/JsonSchemaTest.kt create mode 100644 samples/client/3_0_3_unit_test/kotlin/src/test/kotlin/org/openapijsonschematools/client/schemas/validation/PropertiesValidatorTest.kt create mode 100644 samples/client/3_0_3_unit_test/kotlin/src/test/kotlin/org/openapijsonschematools/client/schemas/validation/RequiredValidatorTest.kt create mode 100644 samples/client/3_0_3_unit_test/kotlin/src/test/kotlin/org/openapijsonschematools/client/schemas/validation/TypeValidatorTest.kt delete mode 100644 samples/client/petstore/kotlin/.openapi-generator/FILES delete mode 100644 samples/client/petstore/kotlin/README.md delete mode 100644 samples/client/petstore/kotlin/docs/apis/paths/Anotherfakedummy.md delete mode 100644 samples/client/petstore/kotlin/docs/apis/paths/Commonparamsubdir.md delete mode 100644 samples/client/petstore/kotlin/docs/apis/paths/Fake.md delete mode 100644 samples/client/petstore/kotlin/docs/apis/paths/Fakeadditionalpropertieswitharrayofenums.md delete mode 100644 samples/client/petstore/kotlin/docs/apis/paths/Fakebodywithfileschema.md delete mode 100644 samples/client/petstore/kotlin/docs/apis/paths/Fakebodywithqueryparams.md delete mode 100644 samples/client/petstore/kotlin/docs/apis/paths/Fakecasesensitiveparams.md delete mode 100644 samples/client/petstore/kotlin/docs/apis/paths/Fakeclassnametest.md delete mode 100644 samples/client/petstore/kotlin/docs/apis/paths/Fakedeletecoffeeid.md delete mode 100644 samples/client/petstore/kotlin/docs/apis/paths/Fakehealth.md delete mode 100644 samples/client/petstore/kotlin/docs/apis/paths/Fakeinlineadditionalproperties.md delete mode 100644 samples/client/petstore/kotlin/docs/apis/paths/Fakeinlinecomposition.md delete mode 100644 samples/client/petstore/kotlin/docs/apis/paths/Fakejsonformdata.md delete mode 100644 samples/client/petstore/kotlin/docs/apis/paths/Fakejsonpatch.md delete mode 100644 samples/client/petstore/kotlin/docs/apis/paths/Fakejsonwithcharset.md delete mode 100644 samples/client/petstore/kotlin/docs/apis/paths/Fakemultiplerequestbodycontenttypes.md delete mode 100644 samples/client/petstore/kotlin/docs/apis/paths/Fakemultipleresponsebodies.md delete mode 100644 samples/client/petstore/kotlin/docs/apis/paths/Fakemultiplesecurities.md delete mode 100644 samples/client/petstore/kotlin/docs/apis/paths/Fakeobjinquery.md delete mode 100644 samples/client/petstore/kotlin/docs/apis/paths/Fakeparametercollisions1ababselfab.md delete mode 100644 samples/client/petstore/kotlin/docs/apis/paths/Fakepemcontenttype.md delete mode 100644 samples/client/petstore/kotlin/docs/apis/paths/Fakepetiduploadimagewithrequiredfile.md delete mode 100644 samples/client/petstore/kotlin/docs/apis/paths/Fakequeryparamwithjsoncontenttype.md delete mode 100644 samples/client/petstore/kotlin/docs/apis/paths/Fakeredirection.md delete mode 100644 samples/client/petstore/kotlin/docs/apis/paths/Fakerefobjinquery.md delete mode 100644 samples/client/petstore/kotlin/docs/apis/paths/Fakerefsarraymodel.md delete mode 100644 samples/client/petstore/kotlin/docs/apis/paths/Fakerefsarrayofenums.md delete mode 100644 samples/client/petstore/kotlin/docs/apis/paths/Fakerefsboolean.md delete mode 100644 samples/client/petstore/kotlin/docs/apis/paths/Fakerefscomposedoneofnumberwithvalidations.md delete mode 100644 samples/client/petstore/kotlin/docs/apis/paths/Fakerefsenum.md delete mode 100644 samples/client/petstore/kotlin/docs/apis/paths/Fakerefsmammal.md delete mode 100644 samples/client/petstore/kotlin/docs/apis/paths/Fakerefsnumber.md delete mode 100644 samples/client/petstore/kotlin/docs/apis/paths/Fakerefsobjectmodelwithrefprops.md delete mode 100644 samples/client/petstore/kotlin/docs/apis/paths/Fakerefsstring.md delete mode 100644 samples/client/petstore/kotlin/docs/apis/paths/Fakeresponsewithoutschema.md delete mode 100644 samples/client/petstore/kotlin/docs/apis/paths/Faketestqueryparamters.md delete mode 100644 samples/client/petstore/kotlin/docs/apis/paths/Fakeuploaddownloadfile.md delete mode 100644 samples/client/petstore/kotlin/docs/apis/paths/Fakeuploadfile.md delete mode 100644 samples/client/petstore/kotlin/docs/apis/paths/Fakeuploadfiles.md delete mode 100644 samples/client/petstore/kotlin/docs/apis/paths/Fakewildcardresponses.md delete mode 100644 samples/client/petstore/kotlin/docs/apis/paths/Foo.md delete mode 100644 samples/client/petstore/kotlin/docs/apis/paths/Pet.md delete mode 100644 samples/client/petstore/kotlin/docs/apis/paths/Petfindbystatus.md delete mode 100644 samples/client/petstore/kotlin/docs/apis/paths/Petfindbytags.md delete mode 100644 samples/client/petstore/kotlin/docs/apis/paths/Petpetid.md delete mode 100644 samples/client/petstore/kotlin/docs/apis/paths/Petpetiduploadimage.md delete mode 100644 samples/client/petstore/kotlin/docs/apis/paths/Solidus.md delete mode 100644 samples/client/petstore/kotlin/docs/apis/paths/Storeinventory.md delete mode 100644 samples/client/petstore/kotlin/docs/apis/paths/Storeorder.md delete mode 100644 samples/client/petstore/kotlin/docs/apis/paths/Storeorderorderid.md delete mode 100644 samples/client/petstore/kotlin/docs/apis/paths/User.md delete mode 100644 samples/client/petstore/kotlin/docs/apis/paths/Usercreatewitharray.md delete mode 100644 samples/client/petstore/kotlin/docs/apis/paths/Usercreatewithlist.md delete mode 100644 samples/client/petstore/kotlin/docs/apis/paths/Userlogin.md delete mode 100644 samples/client/petstore/kotlin/docs/apis/paths/Userlogout.md delete mode 100644 samples/client/petstore/kotlin/docs/apis/paths/Userusername.md delete mode 100644 samples/client/petstore/kotlin/docs/apis/tags/Anotherfake.md delete mode 100644 samples/client/petstore/kotlin/docs/apis/tags/Default.md delete mode 100644 samples/client/petstore/kotlin/docs/apis/tags/Fake.md delete mode 100644 samples/client/petstore/kotlin/docs/apis/tags/Fakeclassnametags123.md delete mode 100644 samples/client/petstore/kotlin/docs/apis/tags/Pet.md delete mode 100644 samples/client/petstore/kotlin/docs/apis/tags/Store.md delete mode 100644 samples/client/petstore/kotlin/docs/apis/tags/User.md delete mode 100644 samples/client/petstore/kotlin/docs/components/headers/Int32JsonContentTypeHeader.md delete mode 100644 samples/client/petstore/kotlin/docs/components/headers/NumberHeader.md delete mode 100644 samples/client/petstore/kotlin/docs/components/headers/RefContentSchemaHeader.md delete mode 100644 samples/client/petstore/kotlin/docs/components/headers/RefSchemaHeader.md delete mode 100644 samples/client/petstore/kotlin/docs/components/headers/RefStringHeader.md delete mode 100644 samples/client/petstore/kotlin/docs/components/headers/StringHeader.md delete mode 100644 samples/client/petstore/kotlin/docs/components/headers/int32jsoncontenttypeheader/content/applicationjson/Int32JsonContentTypeHeaderSchema.md delete mode 100644 samples/client/petstore/kotlin/docs/components/headers/numberheader/NumberHeaderSchema.md delete mode 100644 samples/client/petstore/kotlin/docs/components/headers/refcontentschemaheader/content/applicationjson/RefContentSchemaHeaderSchema.md delete mode 100644 samples/client/petstore/kotlin/docs/components/headers/refschemaheader/RefSchemaHeaderSchema.md delete mode 100644 samples/client/petstore/kotlin/docs/components/headers/stringheader/StringHeaderSchema.md delete mode 100644 samples/client/petstore/kotlin/docs/components/parameters/ComponentRefSchemaStringWithValidation.md delete mode 100644 samples/client/petstore/kotlin/docs/components/parameters/PathUserName.md delete mode 100644 samples/client/petstore/kotlin/docs/components/parameters/RefPathUserName.md delete mode 100644 samples/client/petstore/kotlin/docs/components/parameters/RefSchemaStringWithValidation.md delete mode 100644 samples/client/petstore/kotlin/docs/components/parameters/componentrefschemastringwithvalidation/content/applicationjson/ApplicationjsonSchema.md delete mode 100644 samples/client/petstore/kotlin/docs/components/parameters/pathusername/Schema.md delete mode 100644 samples/client/petstore/kotlin/docs/components/parameters/refschemastringwithvalidation/Schema.md delete mode 100644 samples/client/petstore/kotlin/docs/components/requestbodies/Client.md delete mode 100644 samples/client/petstore/kotlin/docs/components/requestbodies/Pet.md delete mode 100644 samples/client/petstore/kotlin/docs/components/requestbodies/RefUserArray.md delete mode 100644 samples/client/petstore/kotlin/docs/components/requestbodies/UserArray.md delete mode 100644 samples/client/petstore/kotlin/docs/components/requestbodies/client/content/applicationjson/ApplicationjsonSchema.md delete mode 100644 samples/client/petstore/kotlin/docs/components/requestbodies/pet/content/applicationjson/ApplicationjsonSchema.md delete mode 100644 samples/client/petstore/kotlin/docs/components/requestbodies/pet/content/applicationxml/ApplicationxmlSchema.md delete mode 100644 samples/client/petstore/kotlin/docs/components/requestbodies/userarray/content/applicationjson/ApplicationjsonSchema.md delete mode 100644 samples/client/petstore/kotlin/docs/components/responses/HeadersWithNoBody.md delete mode 100644 samples/client/petstore/kotlin/docs/components/responses/RefSuccessDescriptionOnly.md delete mode 100644 samples/client/petstore/kotlin/docs/components/responses/RefSuccessfulXmlAndJsonArrayOfPet.md delete mode 100644 samples/client/petstore/kotlin/docs/components/responses/SuccessDescriptionOnly.md delete mode 100644 samples/client/petstore/kotlin/docs/components/responses/SuccessInlineContentAndHeader.md delete mode 100644 samples/client/petstore/kotlin/docs/components/responses/SuccessWithJsonApiResponse.md delete mode 100644 samples/client/petstore/kotlin/docs/components/responses/SuccessfulXmlAndJsonArrayOfPet.md delete mode 100644 samples/client/petstore/kotlin/docs/components/responses/headerswithnobody/HeadersWithNoBodyHeadersSchema.md delete mode 100644 samples/client/petstore/kotlin/docs/components/responses/headerswithnobody/headers/location/LocationSchema.md delete mode 100644 samples/client/petstore/kotlin/docs/components/responses/successfulxmlandjsonarrayofpet/content/applicationjson/ApplicationjsonSchema.md delete mode 100644 samples/client/petstore/kotlin/docs/components/responses/successfulxmlandjsonarrayofpet/content/applicationxml/ApplicationxmlSchema.md delete mode 100644 samples/client/petstore/kotlin/docs/components/responses/successinlinecontentandheader/SuccessInlineContentAndHeaderHeadersSchema.md delete mode 100644 samples/client/petstore/kotlin/docs/components/responses/successinlinecontentandheader/content/applicationjson/ApplicationjsonSchema.md delete mode 100644 samples/client/petstore/kotlin/docs/components/responses/successinlinecontentandheader/headers/someheader/SomeHeaderSchema.md delete mode 100644 samples/client/petstore/kotlin/docs/components/responses/successwithjsonapiresponse/SuccessWithJsonApiResponseHeadersSchema.md delete mode 100644 samples/client/petstore/kotlin/docs/components/responses/successwithjsonapiresponse/content/applicationjson/ApplicationjsonSchema.md delete mode 100644 samples/client/petstore/kotlin/docs/components/schemas/AbstractStepMessage.md delete mode 100644 samples/client/petstore/kotlin/docs/components/schemas/AdditionalPropertiesClass.md delete mode 100644 samples/client/petstore/kotlin/docs/components/schemas/AdditionalPropertiesSchema.md delete mode 100644 samples/client/petstore/kotlin/docs/components/schemas/AdditionalPropertiesWithArrayOfEnums.md delete mode 100644 samples/client/petstore/kotlin/docs/components/schemas/Address.md delete mode 100644 samples/client/petstore/kotlin/docs/components/schemas/Animal.md delete mode 100644 samples/client/petstore/kotlin/docs/components/schemas/AnimalFarm.md delete mode 100644 samples/client/petstore/kotlin/docs/components/schemas/AnyTypeAndFormat.md delete mode 100644 samples/client/petstore/kotlin/docs/components/schemas/AnyTypeNotString.md delete mode 100644 samples/client/petstore/kotlin/docs/components/schemas/ApiResponseSchema.md delete mode 100644 samples/client/petstore/kotlin/docs/components/schemas/Apple.md delete mode 100644 samples/client/petstore/kotlin/docs/components/schemas/AppleReq.md delete mode 100644 samples/client/petstore/kotlin/docs/components/schemas/ArrayHoldingAnyType.md delete mode 100644 samples/client/petstore/kotlin/docs/components/schemas/ArrayOfArrayOfNumberOnly.md delete mode 100644 samples/client/petstore/kotlin/docs/components/schemas/ArrayOfEnums.md delete mode 100644 samples/client/petstore/kotlin/docs/components/schemas/ArrayOfNumberOnly.md delete mode 100644 samples/client/petstore/kotlin/docs/components/schemas/ArrayTest.md delete mode 100644 samples/client/petstore/kotlin/docs/components/schemas/ArrayWithValidationsInItems.md delete mode 100644 samples/client/petstore/kotlin/docs/components/schemas/Banana.md delete mode 100644 samples/client/petstore/kotlin/docs/components/schemas/BananaReq.md delete mode 100644 samples/client/petstore/kotlin/docs/components/schemas/Bar.md delete mode 100644 samples/client/petstore/kotlin/docs/components/schemas/BasquePig.md delete mode 100644 samples/client/petstore/kotlin/docs/components/schemas/BooleanEnum.md delete mode 100644 samples/client/petstore/kotlin/docs/components/schemas/BooleanSchema.md delete mode 100644 samples/client/petstore/kotlin/docs/components/schemas/Capitalization.md delete mode 100644 samples/client/petstore/kotlin/docs/components/schemas/Cat.md delete mode 100644 samples/client/petstore/kotlin/docs/components/schemas/Category.md delete mode 100644 samples/client/petstore/kotlin/docs/components/schemas/ChildCat.md delete mode 100644 samples/client/petstore/kotlin/docs/components/schemas/ClassModel.md delete mode 100644 samples/client/petstore/kotlin/docs/components/schemas/Client.md delete mode 100644 samples/client/petstore/kotlin/docs/components/schemas/ComplexQuadrilateral.md delete mode 100644 samples/client/petstore/kotlin/docs/components/schemas/ComposedAnyOfDifferentTypesNoValidations.md delete mode 100644 samples/client/petstore/kotlin/docs/components/schemas/ComposedArray.md delete mode 100644 samples/client/petstore/kotlin/docs/components/schemas/ComposedBool.md delete mode 100644 samples/client/petstore/kotlin/docs/components/schemas/ComposedNone.md delete mode 100644 samples/client/petstore/kotlin/docs/components/schemas/ComposedNumber.md delete mode 100644 samples/client/petstore/kotlin/docs/components/schemas/ComposedObject.md delete mode 100644 samples/client/petstore/kotlin/docs/components/schemas/ComposedOneOfDifferentTypes.md delete mode 100644 samples/client/petstore/kotlin/docs/components/schemas/ComposedString.md delete mode 100644 samples/client/petstore/kotlin/docs/components/schemas/Currency.md delete mode 100644 samples/client/petstore/kotlin/docs/components/schemas/DanishPig.md delete mode 100644 samples/client/petstore/kotlin/docs/components/schemas/DateTimeTest.md delete mode 100644 samples/client/petstore/kotlin/docs/components/schemas/DateTimeWithValidations.md delete mode 100644 samples/client/petstore/kotlin/docs/components/schemas/DateWithValidations.md delete mode 100644 samples/client/petstore/kotlin/docs/components/schemas/DecimalPayload.md delete mode 100644 samples/client/petstore/kotlin/docs/components/schemas/Dog.md delete mode 100644 samples/client/petstore/kotlin/docs/components/schemas/Drawing.md delete mode 100644 samples/client/petstore/kotlin/docs/components/schemas/EnumArrays.md delete mode 100644 samples/client/petstore/kotlin/docs/components/schemas/EnumClass.md delete mode 100644 samples/client/petstore/kotlin/docs/components/schemas/EnumTest.md delete mode 100644 samples/client/petstore/kotlin/docs/components/schemas/EquilateralTriangle.md delete mode 100644 samples/client/petstore/kotlin/docs/components/schemas/File.md delete mode 100644 samples/client/petstore/kotlin/docs/components/schemas/FileSchemaTestClass.md delete mode 100644 samples/client/petstore/kotlin/docs/components/schemas/Foo.md delete mode 100644 samples/client/petstore/kotlin/docs/components/schemas/FormatTest.md delete mode 100644 samples/client/petstore/kotlin/docs/components/schemas/FromSchema.md delete mode 100644 samples/client/petstore/kotlin/docs/components/schemas/Fruit.md delete mode 100644 samples/client/petstore/kotlin/docs/components/schemas/FruitReq.md delete mode 100644 samples/client/petstore/kotlin/docs/components/schemas/GmFruit.md delete mode 100644 samples/client/petstore/kotlin/docs/components/schemas/GrandparentAnimal.md delete mode 100644 samples/client/petstore/kotlin/docs/components/schemas/HasOnlyReadOnly.md delete mode 100644 samples/client/petstore/kotlin/docs/components/schemas/HealthCheckResult.md delete mode 100644 samples/client/petstore/kotlin/docs/components/schemas/IntegerEnum.md delete mode 100644 samples/client/petstore/kotlin/docs/components/schemas/IntegerEnumBig.md delete mode 100644 samples/client/petstore/kotlin/docs/components/schemas/IntegerEnumOneValue.md delete mode 100644 samples/client/petstore/kotlin/docs/components/schemas/IntegerEnumWithDefaultValue.md delete mode 100644 samples/client/petstore/kotlin/docs/components/schemas/IntegerMax10.md delete mode 100644 samples/client/petstore/kotlin/docs/components/schemas/IntegerMin15.md delete mode 100644 samples/client/petstore/kotlin/docs/components/schemas/IsoscelesTriangle.md delete mode 100644 samples/client/petstore/kotlin/docs/components/schemas/Items.md delete mode 100644 samples/client/petstore/kotlin/docs/components/schemas/ItemsSchema.md delete mode 100644 samples/client/petstore/kotlin/docs/components/schemas/JSONPatchRequest.md delete mode 100644 samples/client/petstore/kotlin/docs/components/schemas/JSONPatchRequestAddReplaceTest.md delete mode 100644 samples/client/petstore/kotlin/docs/components/schemas/JSONPatchRequestMoveCopy.md delete mode 100644 samples/client/petstore/kotlin/docs/components/schemas/JSONPatchRequestRemove.md delete mode 100644 samples/client/petstore/kotlin/docs/components/schemas/Mammal.md delete mode 100644 samples/client/petstore/kotlin/docs/components/schemas/MapTest.md delete mode 100644 samples/client/petstore/kotlin/docs/components/schemas/MixedPropertiesAndAdditionalPropertiesClass.md delete mode 100644 samples/client/petstore/kotlin/docs/components/schemas/Money.md delete mode 100644 samples/client/petstore/kotlin/docs/components/schemas/MultiPropertiesSchema.md delete mode 100644 samples/client/petstore/kotlin/docs/components/schemas/MyObjectDto.md delete mode 100644 samples/client/petstore/kotlin/docs/components/schemas/Name.md delete mode 100644 samples/client/petstore/kotlin/docs/components/schemas/NoAdditionalProperties.md delete mode 100644 samples/client/petstore/kotlin/docs/components/schemas/NullableClass.md delete mode 100644 samples/client/petstore/kotlin/docs/components/schemas/NullableShape.md delete mode 100644 samples/client/petstore/kotlin/docs/components/schemas/NullableString.md delete mode 100644 samples/client/petstore/kotlin/docs/components/schemas/NumberOnly.md delete mode 100644 samples/client/petstore/kotlin/docs/components/schemas/NumberSchema.md delete mode 100644 samples/client/petstore/kotlin/docs/components/schemas/NumberWithExclusiveMinMax.md delete mode 100644 samples/client/petstore/kotlin/docs/components/schemas/NumberWithValidations.md delete mode 100644 samples/client/petstore/kotlin/docs/components/schemas/ObjWithRequiredProps.md delete mode 100644 samples/client/petstore/kotlin/docs/components/schemas/ObjWithRequiredPropsBase.md delete mode 100644 samples/client/petstore/kotlin/docs/components/schemas/ObjectInterface.md delete mode 100644 samples/client/petstore/kotlin/docs/components/schemas/ObjectModelWithArgAndArgsProperties.md delete mode 100644 samples/client/petstore/kotlin/docs/components/schemas/ObjectModelWithRefProps.md delete mode 100644 samples/client/petstore/kotlin/docs/components/schemas/ObjectWithAllOfWithReqTestPropFromUnsetAddProp.md delete mode 100644 samples/client/petstore/kotlin/docs/components/schemas/ObjectWithCollidingProperties.md delete mode 100644 samples/client/petstore/kotlin/docs/components/schemas/ObjectWithDecimalProperties.md delete mode 100644 samples/client/petstore/kotlin/docs/components/schemas/ObjectWithDifficultlyNamedProps.md delete mode 100644 samples/client/petstore/kotlin/docs/components/schemas/ObjectWithInlineCompositionProperty.md delete mode 100644 samples/client/petstore/kotlin/docs/components/schemas/ObjectWithInvalidNamedRefedProperties.md delete mode 100644 samples/client/petstore/kotlin/docs/components/schemas/ObjectWithNonIntersectingValues.md delete mode 100644 samples/client/petstore/kotlin/docs/components/schemas/ObjectWithOnlyOptionalProps.md delete mode 100644 samples/client/petstore/kotlin/docs/components/schemas/ObjectWithOptionalTestProp.md delete mode 100644 samples/client/petstore/kotlin/docs/components/schemas/ObjectWithValidations.md delete mode 100644 samples/client/petstore/kotlin/docs/components/schemas/Order.md delete mode 100644 samples/client/petstore/kotlin/docs/components/schemas/PaginatedResultMyObjectDto.md delete mode 100644 samples/client/petstore/kotlin/docs/components/schemas/ParentPet.md delete mode 100644 samples/client/petstore/kotlin/docs/components/schemas/Pet.md delete mode 100644 samples/client/petstore/kotlin/docs/components/schemas/Pig.md delete mode 100644 samples/client/petstore/kotlin/docs/components/schemas/Player.md delete mode 100644 samples/client/petstore/kotlin/docs/components/schemas/PublicKey.md delete mode 100644 samples/client/petstore/kotlin/docs/components/schemas/Quadrilateral.md delete mode 100644 samples/client/petstore/kotlin/docs/components/schemas/QuadrilateralInterface.md delete mode 100644 samples/client/petstore/kotlin/docs/components/schemas/ReadOnlyFirst.md delete mode 100644 samples/client/petstore/kotlin/docs/components/schemas/RefPet.md delete mode 100644 samples/client/petstore/kotlin/docs/components/schemas/ReqPropsFromExplicitAddProps.md delete mode 100644 samples/client/petstore/kotlin/docs/components/schemas/ReqPropsFromTrueAddProps.md delete mode 100644 samples/client/petstore/kotlin/docs/components/schemas/ReqPropsFromUnsetAddProps.md delete mode 100644 samples/client/petstore/kotlin/docs/components/schemas/ReturnSchema.md delete mode 100644 samples/client/petstore/kotlin/docs/components/schemas/ScaleneTriangle.md delete mode 100644 samples/client/petstore/kotlin/docs/components/schemas/Schema200Response.md delete mode 100644 samples/client/petstore/kotlin/docs/components/schemas/SelfReferencingArrayModel.md delete mode 100644 samples/client/petstore/kotlin/docs/components/schemas/SelfReferencingObjectModel.md delete mode 100644 samples/client/petstore/kotlin/docs/components/schemas/Shape.md delete mode 100644 samples/client/petstore/kotlin/docs/components/schemas/ShapeOrNull.md delete mode 100644 samples/client/petstore/kotlin/docs/components/schemas/SimpleQuadrilateral.md delete mode 100644 samples/client/petstore/kotlin/docs/components/schemas/SomeObject.md delete mode 100644 samples/client/petstore/kotlin/docs/components/schemas/SpecialModelname.md delete mode 100644 samples/client/petstore/kotlin/docs/components/schemas/StringBooleanMap.md delete mode 100644 samples/client/petstore/kotlin/docs/components/schemas/StringEnum.md delete mode 100644 samples/client/petstore/kotlin/docs/components/schemas/StringEnumWithDefaultValue.md delete mode 100644 samples/client/petstore/kotlin/docs/components/schemas/StringSchema.md delete mode 100644 samples/client/petstore/kotlin/docs/components/schemas/StringWithValidation.md delete mode 100644 samples/client/petstore/kotlin/docs/components/schemas/Tag.md delete mode 100644 samples/client/petstore/kotlin/docs/components/schemas/Triangle.md delete mode 100644 samples/client/petstore/kotlin/docs/components/schemas/TriangleInterface.md delete mode 100644 samples/client/petstore/kotlin/docs/components/schemas/UUIDString.md delete mode 100644 samples/client/petstore/kotlin/docs/components/schemas/User.md delete mode 100644 samples/client/petstore/kotlin/docs/components/schemas/Whale.md delete mode 100644 samples/client/petstore/kotlin/docs/components/schemas/Zebra.md delete mode 100644 samples/client/petstore/kotlin/docs/components/securityschemes/ApiKey.md delete mode 100644 samples/client/petstore/kotlin/docs/components/securityschemes/ApiKeyQuery.md delete mode 100644 samples/client/petstore/kotlin/docs/components/securityschemes/BearerTest.md delete mode 100644 samples/client/petstore/kotlin/docs/components/securityschemes/HttpBasicTest.md delete mode 100644 samples/client/petstore/kotlin/docs/components/securityschemes/HttpSignatureTest.md delete mode 100644 samples/client/petstore/kotlin/docs/components/securityschemes/OpenIdConnectTest.md delete mode 100644 samples/client/petstore/kotlin/docs/components/securityschemes/PetstoreAuth.md delete mode 100644 samples/client/petstore/kotlin/docs/paths/anotherfakedummy/AnotherfakedummyPatch.md delete mode 100644 samples/client/petstore/kotlin/docs/paths/anotherfakedummy/patch/AnotherfakedummyPatchRequestBody.md delete mode 100644 samples/client/petstore/kotlin/docs/paths/anotherfakedummy/patch/AnotherfakedummyPatchResponses.md delete mode 100644 samples/client/petstore/kotlin/docs/paths/anotherfakedummy/patch/responses/AnotherfakedummyPatchCode200Response.md delete mode 100644 samples/client/petstore/kotlin/docs/paths/anotherfakedummy/patch/responses/code200response/content/applicationjson/ApplicationjsonSchema.md delete mode 100644 samples/client/petstore/kotlin/docs/paths/commonparamsubdir/CommonparamsubdirDelete.md delete mode 100644 samples/client/petstore/kotlin/docs/paths/commonparamsubdir/CommonparamsubdirGet.md delete mode 100644 samples/client/petstore/kotlin/docs/paths/commonparamsubdir/CommonparamsubdirPost.md delete mode 100644 samples/client/petstore/kotlin/docs/paths/commonparamsubdir/delete/CommonparamsubdirDeleteHeaderParameters.md delete mode 100644 samples/client/petstore/kotlin/docs/paths/commonparamsubdir/delete/CommonparamsubdirDeletePathParameters.md delete mode 100644 samples/client/petstore/kotlin/docs/paths/commonparamsubdir/delete/CommonparamsubdirDeleteResponses.md delete mode 100644 samples/client/petstore/kotlin/docs/paths/commonparamsubdir/delete/parameters/parameter0/Schema0.md delete mode 100644 samples/client/petstore/kotlin/docs/paths/commonparamsubdir/delete/parameters/parameter1/Schema1.md delete mode 100644 samples/client/petstore/kotlin/docs/paths/commonparamsubdir/delete/responses/CommonparamsubdirDeleteCode200Response.md delete mode 100644 samples/client/petstore/kotlin/docs/paths/commonparamsubdir/get/CommonparamsubdirGetPathParameters.md delete mode 100644 samples/client/petstore/kotlin/docs/paths/commonparamsubdir/get/CommonparamsubdirGetQueryParameters.md delete mode 100644 samples/client/petstore/kotlin/docs/paths/commonparamsubdir/get/CommonparamsubdirGetResponses.md delete mode 100644 samples/client/petstore/kotlin/docs/paths/commonparamsubdir/get/parameters/parameter0/Schema0.md delete mode 100644 samples/client/petstore/kotlin/docs/paths/commonparamsubdir/get/responses/CommonparamsubdirGetCode200Response.md delete mode 100644 samples/client/petstore/kotlin/docs/paths/commonparamsubdir/parameters/routeparameter0/RouteParamSchema0.md delete mode 100644 samples/client/petstore/kotlin/docs/paths/commonparamsubdir/post/CommonparamsubdirPostHeaderParameters.md delete mode 100644 samples/client/petstore/kotlin/docs/paths/commonparamsubdir/post/CommonparamsubdirPostPathParameters.md delete mode 100644 samples/client/petstore/kotlin/docs/paths/commonparamsubdir/post/CommonparamsubdirPostResponses.md delete mode 100644 samples/client/petstore/kotlin/docs/paths/commonparamsubdir/post/parameters/parameter0/Schema0.md delete mode 100644 samples/client/petstore/kotlin/docs/paths/commonparamsubdir/post/responses/CommonparamsubdirPostCode200Response.md delete mode 100644 samples/client/petstore/kotlin/docs/paths/fake/FakeDelete.md delete mode 100644 samples/client/petstore/kotlin/docs/paths/fake/FakeGet.md delete mode 100644 samples/client/petstore/kotlin/docs/paths/fake/FakePatch.md delete mode 100644 samples/client/petstore/kotlin/docs/paths/fake/FakePost.md delete mode 100644 samples/client/petstore/kotlin/docs/paths/fake/delete/FakeDeleteHeaderParameters.md delete mode 100644 samples/client/petstore/kotlin/docs/paths/fake/delete/FakeDeleteQueryParameters.md delete mode 100644 samples/client/petstore/kotlin/docs/paths/fake/delete/FakeDeleteResponses.md delete mode 100644 samples/client/petstore/kotlin/docs/paths/fake/delete/FakeDeleteSecurityInfo.md delete mode 100644 samples/client/petstore/kotlin/docs/paths/fake/delete/parameters/parameter0/Schema0.md delete mode 100644 samples/client/petstore/kotlin/docs/paths/fake/delete/parameters/parameter1/Schema1.md delete mode 100644 samples/client/petstore/kotlin/docs/paths/fake/delete/parameters/parameter2/Schema2.md delete mode 100644 samples/client/petstore/kotlin/docs/paths/fake/delete/parameters/parameter3/Schema3.md delete mode 100644 samples/client/petstore/kotlin/docs/paths/fake/delete/parameters/parameter4/Schema4.md delete mode 100644 samples/client/petstore/kotlin/docs/paths/fake/delete/parameters/parameter5/Schema5.md delete mode 100644 samples/client/petstore/kotlin/docs/paths/fake/delete/responses/FakeDeleteCode200Response.md delete mode 100644 samples/client/petstore/kotlin/docs/paths/fake/delete/security/FakeDeleteSecurityRequirementObject0.md delete mode 100644 samples/client/petstore/kotlin/docs/paths/fake/get/FakeGetHeaderParameters.md delete mode 100644 samples/client/petstore/kotlin/docs/paths/fake/get/FakeGetQueryParameters.md delete mode 100644 samples/client/petstore/kotlin/docs/paths/fake/get/FakeGetRequestBody.md delete mode 100644 samples/client/petstore/kotlin/docs/paths/fake/get/FakeGetResponses.md delete mode 100644 samples/client/petstore/kotlin/docs/paths/fake/get/parameters/parameter0/Schema0.md delete mode 100644 samples/client/petstore/kotlin/docs/paths/fake/get/parameters/parameter1/Schema1.md delete mode 100644 samples/client/petstore/kotlin/docs/paths/fake/get/parameters/parameter2/Schema2.md delete mode 100644 samples/client/petstore/kotlin/docs/paths/fake/get/parameters/parameter3/Schema3.md delete mode 100644 samples/client/petstore/kotlin/docs/paths/fake/get/parameters/parameter4/Schema4.md delete mode 100644 samples/client/petstore/kotlin/docs/paths/fake/get/parameters/parameter5/Schema5.md delete mode 100644 samples/client/petstore/kotlin/docs/paths/fake/get/requestbody/content/applicationxwwwformurlencoded/ApplicationxwwwformurlencodedSchema.md delete mode 100644 samples/client/petstore/kotlin/docs/paths/fake/get/responses/FakeGetCode200Response.md delete mode 100644 samples/client/petstore/kotlin/docs/paths/fake/get/responses/FakeGetCode404Response.md delete mode 100644 samples/client/petstore/kotlin/docs/paths/fake/get/responses/code404response/content/applicationjson/ApplicationjsonSchema.md delete mode 100644 samples/client/petstore/kotlin/docs/paths/fake/patch/FakePatchRequestBody.md delete mode 100644 samples/client/petstore/kotlin/docs/paths/fake/patch/FakePatchResponses.md delete mode 100644 samples/client/petstore/kotlin/docs/paths/fake/patch/responses/FakePatchCode200Response.md delete mode 100644 samples/client/petstore/kotlin/docs/paths/fake/patch/responses/code200response/content/applicationjson/ApplicationjsonSchema.md delete mode 100644 samples/client/petstore/kotlin/docs/paths/fake/post/FakePostRequestBody.md delete mode 100644 samples/client/petstore/kotlin/docs/paths/fake/post/FakePostResponses.md delete mode 100644 samples/client/petstore/kotlin/docs/paths/fake/post/FakePostSecurityInfo.md delete mode 100644 samples/client/petstore/kotlin/docs/paths/fake/post/requestbody/content/applicationxwwwformurlencoded/ApplicationxwwwformurlencodedSchema.md delete mode 100644 samples/client/petstore/kotlin/docs/paths/fake/post/responses/FakePostCode200Response.md delete mode 100644 samples/client/petstore/kotlin/docs/paths/fake/post/responses/FakePostCode404Response.md delete mode 100644 samples/client/petstore/kotlin/docs/paths/fake/post/security/FakePostSecurityRequirementObject0.md delete mode 100644 samples/client/petstore/kotlin/docs/paths/fakeadditionalpropertieswitharrayofenums/FakeadditionalpropertieswitharrayofenumsGet.md delete mode 100644 samples/client/petstore/kotlin/docs/paths/fakeadditionalpropertieswitharrayofenums/get/FakeadditionalpropertieswitharrayofenumsGetRequestBody.md delete mode 100644 samples/client/petstore/kotlin/docs/paths/fakeadditionalpropertieswitharrayofenums/get/FakeadditionalpropertieswitharrayofenumsGetResponses.md delete mode 100644 samples/client/petstore/kotlin/docs/paths/fakeadditionalpropertieswitharrayofenums/get/requestbody/content/applicationjson/ApplicationjsonSchema.md delete mode 100644 samples/client/petstore/kotlin/docs/paths/fakeadditionalpropertieswitharrayofenums/get/responses/FakeadditionalpropertieswitharrayofenumsGetCode200Response.md delete mode 100644 samples/client/petstore/kotlin/docs/paths/fakeadditionalpropertieswitharrayofenums/get/responses/code200response/content/applicationjson/ApplicationjsonSchema.md delete mode 100644 samples/client/petstore/kotlin/docs/paths/fakebodywithfileschema/FakebodywithfileschemaPut.md delete mode 100644 samples/client/petstore/kotlin/docs/paths/fakebodywithfileschema/put/FakebodywithfileschemaPutRequestBody.md delete mode 100644 samples/client/petstore/kotlin/docs/paths/fakebodywithfileschema/put/FakebodywithfileschemaPutResponses.md delete mode 100644 samples/client/petstore/kotlin/docs/paths/fakebodywithfileschema/put/requestbody/content/applicationjson/ApplicationjsonSchema.md delete mode 100644 samples/client/petstore/kotlin/docs/paths/fakebodywithfileschema/put/responses/FakebodywithfileschemaPutCode200Response.md delete mode 100644 samples/client/petstore/kotlin/docs/paths/fakebodywithqueryparams/FakebodywithqueryparamsPut.md delete mode 100644 samples/client/petstore/kotlin/docs/paths/fakebodywithqueryparams/put/FakebodywithqueryparamsPutQueryParameters.md delete mode 100644 samples/client/petstore/kotlin/docs/paths/fakebodywithqueryparams/put/FakebodywithqueryparamsPutRequestBody.md delete mode 100644 samples/client/petstore/kotlin/docs/paths/fakebodywithqueryparams/put/FakebodywithqueryparamsPutResponses.md delete mode 100644 samples/client/petstore/kotlin/docs/paths/fakebodywithqueryparams/put/parameters/parameter0/Schema0.md delete mode 100644 samples/client/petstore/kotlin/docs/paths/fakebodywithqueryparams/put/requestbody/content/applicationjson/ApplicationjsonSchema.md delete mode 100644 samples/client/petstore/kotlin/docs/paths/fakebodywithqueryparams/put/responses/FakebodywithqueryparamsPutCode200Response.md delete mode 100644 samples/client/petstore/kotlin/docs/paths/fakecasesensitiveparams/FakecasesensitiveparamsPut.md delete mode 100644 samples/client/petstore/kotlin/docs/paths/fakecasesensitiveparams/put/FakecasesensitiveparamsPutQueryParameters.md delete mode 100644 samples/client/petstore/kotlin/docs/paths/fakecasesensitiveparams/put/FakecasesensitiveparamsPutResponses.md delete mode 100644 samples/client/petstore/kotlin/docs/paths/fakecasesensitiveparams/put/parameters/parameter0/Schema0.md delete mode 100644 samples/client/petstore/kotlin/docs/paths/fakecasesensitiveparams/put/parameters/parameter1/Schema1.md delete mode 100644 samples/client/petstore/kotlin/docs/paths/fakecasesensitiveparams/put/parameters/parameter2/Schema2.md delete mode 100644 samples/client/petstore/kotlin/docs/paths/fakecasesensitiveparams/put/responses/FakecasesensitiveparamsPutCode200Response.md delete mode 100644 samples/client/petstore/kotlin/docs/paths/fakeclassnametest/FakeclassnametestPatch.md delete mode 100644 samples/client/petstore/kotlin/docs/paths/fakeclassnametest/patch/FakeclassnametestPatchRequestBody.md delete mode 100644 samples/client/petstore/kotlin/docs/paths/fakeclassnametest/patch/FakeclassnametestPatchResponses.md delete mode 100644 samples/client/petstore/kotlin/docs/paths/fakeclassnametest/patch/FakeclassnametestPatchSecurityInfo.md delete mode 100644 samples/client/petstore/kotlin/docs/paths/fakeclassnametest/patch/responses/FakeclassnametestPatchCode200Response.md delete mode 100644 samples/client/petstore/kotlin/docs/paths/fakeclassnametest/patch/responses/code200response/content/applicationjson/ApplicationjsonSchema.md delete mode 100644 samples/client/petstore/kotlin/docs/paths/fakeclassnametest/patch/security/FakeclassnametestPatchSecurityRequirementObject0.md delete mode 100644 samples/client/petstore/kotlin/docs/paths/fakedeletecoffeeid/FakedeletecoffeeidDelete.md delete mode 100644 samples/client/petstore/kotlin/docs/paths/fakedeletecoffeeid/delete/FakedeletecoffeeidDeletePathParameters.md delete mode 100644 samples/client/petstore/kotlin/docs/paths/fakedeletecoffeeid/delete/FakedeletecoffeeidDeleteResponses.md delete mode 100644 samples/client/petstore/kotlin/docs/paths/fakedeletecoffeeid/delete/parameters/parameter0/Schema0.md delete mode 100644 samples/client/petstore/kotlin/docs/paths/fakedeletecoffeeid/delete/responses/FakedeletecoffeeidDeleteCode200Response.md delete mode 100644 samples/client/petstore/kotlin/docs/paths/fakedeletecoffeeid/delete/responses/FakedeletecoffeeidDeleteCodedefaultResponse.md delete mode 100644 samples/client/petstore/kotlin/docs/paths/fakehealth/FakehealthGet.md delete mode 100644 samples/client/petstore/kotlin/docs/paths/fakehealth/get/FakehealthGetResponses.md delete mode 100644 samples/client/petstore/kotlin/docs/paths/fakehealth/get/responses/FakehealthGetCode200Response.md delete mode 100644 samples/client/petstore/kotlin/docs/paths/fakehealth/get/responses/code200response/content/applicationjson/ApplicationjsonSchema.md delete mode 100644 samples/client/petstore/kotlin/docs/paths/fakeinlineadditionalproperties/FakeinlineadditionalpropertiesPost.md delete mode 100644 samples/client/petstore/kotlin/docs/paths/fakeinlineadditionalproperties/post/FakeinlineadditionalpropertiesPostRequestBody.md delete mode 100644 samples/client/petstore/kotlin/docs/paths/fakeinlineadditionalproperties/post/FakeinlineadditionalpropertiesPostResponses.md delete mode 100644 samples/client/petstore/kotlin/docs/paths/fakeinlineadditionalproperties/post/requestbody/content/applicationjson/ApplicationjsonSchema.md delete mode 100644 samples/client/petstore/kotlin/docs/paths/fakeinlineadditionalproperties/post/responses/FakeinlineadditionalpropertiesPostCode200Response.md delete mode 100644 samples/client/petstore/kotlin/docs/paths/fakeinlinecomposition/FakeinlinecompositionPost.md delete mode 100644 samples/client/petstore/kotlin/docs/paths/fakeinlinecomposition/post/FakeinlinecompositionPostQueryParameters.md delete mode 100644 samples/client/petstore/kotlin/docs/paths/fakeinlinecomposition/post/FakeinlinecompositionPostRequestBody.md delete mode 100644 samples/client/petstore/kotlin/docs/paths/fakeinlinecomposition/post/FakeinlinecompositionPostResponses.md delete mode 100644 samples/client/petstore/kotlin/docs/paths/fakeinlinecomposition/post/parameters/parameter0/Schema0.md delete mode 100644 samples/client/petstore/kotlin/docs/paths/fakeinlinecomposition/post/parameters/parameter1/Schema1.md delete mode 100644 samples/client/petstore/kotlin/docs/paths/fakeinlinecomposition/post/requestbody/content/applicationjson/ApplicationjsonSchema.md delete mode 100644 samples/client/petstore/kotlin/docs/paths/fakeinlinecomposition/post/requestbody/content/multipartformdata/MultipartformdataSchema.md delete mode 100644 samples/client/petstore/kotlin/docs/paths/fakeinlinecomposition/post/responses/FakeinlinecompositionPostCode200Response.md delete mode 100644 samples/client/petstore/kotlin/docs/paths/fakeinlinecomposition/post/responses/code200response/content/applicationjson/ApplicationjsonSchema.md delete mode 100644 samples/client/petstore/kotlin/docs/paths/fakeinlinecomposition/post/responses/code200response/content/multipartformdata/MultipartformdataSchema.md delete mode 100644 samples/client/petstore/kotlin/docs/paths/fakejsonformdata/FakejsonformdataGet.md delete mode 100644 samples/client/petstore/kotlin/docs/paths/fakejsonformdata/get/FakejsonformdataGetRequestBody.md delete mode 100644 samples/client/petstore/kotlin/docs/paths/fakejsonformdata/get/FakejsonformdataGetResponses.md delete mode 100644 samples/client/petstore/kotlin/docs/paths/fakejsonformdata/get/requestbody/content/applicationxwwwformurlencoded/ApplicationxwwwformurlencodedSchema.md delete mode 100644 samples/client/petstore/kotlin/docs/paths/fakejsonformdata/get/responses/FakejsonformdataGetCode200Response.md delete mode 100644 samples/client/petstore/kotlin/docs/paths/fakejsonpatch/FakejsonpatchPatch.md delete mode 100644 samples/client/petstore/kotlin/docs/paths/fakejsonpatch/patch/FakejsonpatchPatchRequestBody.md delete mode 100644 samples/client/petstore/kotlin/docs/paths/fakejsonpatch/patch/FakejsonpatchPatchResponses.md delete mode 100644 samples/client/petstore/kotlin/docs/paths/fakejsonpatch/patch/requestbody/content/applicationjsonpatchjson/ApplicationjsonpatchjsonSchema.md delete mode 100644 samples/client/petstore/kotlin/docs/paths/fakejsonpatch/patch/responses/FakejsonpatchPatchCode200Response.md delete mode 100644 samples/client/petstore/kotlin/docs/paths/fakejsonwithcharset/FakejsonwithcharsetPost.md delete mode 100644 samples/client/petstore/kotlin/docs/paths/fakejsonwithcharset/post/FakejsonwithcharsetPostRequestBody.md delete mode 100644 samples/client/petstore/kotlin/docs/paths/fakejsonwithcharset/post/FakejsonwithcharsetPostResponses.md delete mode 100644 samples/client/petstore/kotlin/docs/paths/fakejsonwithcharset/post/requestbody/content/applicationjsoncharsetutf8/Applicationjsoncharsetutf8Schema.md delete mode 100644 samples/client/petstore/kotlin/docs/paths/fakejsonwithcharset/post/responses/FakejsonwithcharsetPostCode200Response.md delete mode 100644 samples/client/petstore/kotlin/docs/paths/fakejsonwithcharset/post/responses/code200response/content/applicationjsoncharsetutf8/Applicationjsoncharsetutf8Schema.md delete mode 100644 samples/client/petstore/kotlin/docs/paths/fakemultiplerequestbodycontenttypes/FakemultiplerequestbodycontenttypesPost.md delete mode 100644 samples/client/petstore/kotlin/docs/paths/fakemultiplerequestbodycontenttypes/post/FakemultiplerequestbodycontenttypesPostRequestBody.md delete mode 100644 samples/client/petstore/kotlin/docs/paths/fakemultiplerequestbodycontenttypes/post/FakemultiplerequestbodycontenttypesPostResponses.md delete mode 100644 samples/client/petstore/kotlin/docs/paths/fakemultiplerequestbodycontenttypes/post/requestbody/content/applicationjson/ApplicationjsonSchema.md delete mode 100644 samples/client/petstore/kotlin/docs/paths/fakemultiplerequestbodycontenttypes/post/requestbody/content/multipartformdata/MultipartformdataSchema.md delete mode 100644 samples/client/petstore/kotlin/docs/paths/fakemultiplerequestbodycontenttypes/post/responses/FakemultiplerequestbodycontenttypesPostCode200Response.md delete mode 100644 samples/client/petstore/kotlin/docs/paths/fakemultiplerequestbodycontenttypes/post/responses/code200response/content/applicationjson/ApplicationjsonSchema.md delete mode 100644 samples/client/petstore/kotlin/docs/paths/fakemultipleresponsebodies/FakemultipleresponsebodiesGet.md delete mode 100644 samples/client/petstore/kotlin/docs/paths/fakemultipleresponsebodies/get/FakemultipleresponsebodiesGetResponses.md delete mode 100644 samples/client/petstore/kotlin/docs/paths/fakemultipleresponsebodies/get/responses/FakemultipleresponsebodiesGetCode200Response.md delete mode 100644 samples/client/petstore/kotlin/docs/paths/fakemultipleresponsebodies/get/responses/FakemultipleresponsebodiesGetCode202Response.md delete mode 100644 samples/client/petstore/kotlin/docs/paths/fakemultipleresponsebodies/get/responses/code200response/content/applicationjson/ApplicationjsonSchema.md delete mode 100644 samples/client/petstore/kotlin/docs/paths/fakemultipleresponsebodies/get/responses/code202response/content/applicationjson/ApplicationjsonSchema.md delete mode 100644 samples/client/petstore/kotlin/docs/paths/fakemultiplesecurities/FakemultiplesecuritiesGet.md delete mode 100644 samples/client/petstore/kotlin/docs/paths/fakemultiplesecurities/get/FakemultiplesecuritiesGetResponses.md delete mode 100644 samples/client/petstore/kotlin/docs/paths/fakemultiplesecurities/get/FakemultiplesecuritiesGetSecurityInfo.md delete mode 100644 samples/client/petstore/kotlin/docs/paths/fakemultiplesecurities/get/responses/FakemultiplesecuritiesGetCode200Response.md delete mode 100644 samples/client/petstore/kotlin/docs/paths/fakemultiplesecurities/get/responses/code200response/content/applicationjson/ApplicationjsonSchema.md delete mode 100644 samples/client/petstore/kotlin/docs/paths/fakemultiplesecurities/get/security/FakemultiplesecuritiesGetSecurityRequirementObject0.md delete mode 100644 samples/client/petstore/kotlin/docs/paths/fakemultiplesecurities/get/security/FakemultiplesecuritiesGetSecurityRequirementObject1.md delete mode 100644 samples/client/petstore/kotlin/docs/paths/fakemultiplesecurities/get/security/FakemultiplesecuritiesGetSecurityRequirementObject2.md delete mode 100644 samples/client/petstore/kotlin/docs/paths/fakeobjinquery/FakeobjinqueryGet.md delete mode 100644 samples/client/petstore/kotlin/docs/paths/fakeobjinquery/get/FakeobjinqueryGetQueryParameters.md delete mode 100644 samples/client/petstore/kotlin/docs/paths/fakeobjinquery/get/FakeobjinqueryGetResponses.md delete mode 100644 samples/client/petstore/kotlin/docs/paths/fakeobjinquery/get/parameters/parameter0/Schema0.md delete mode 100644 samples/client/petstore/kotlin/docs/paths/fakeobjinquery/get/responses/FakeobjinqueryGetCode200Response.md delete mode 100644 samples/client/petstore/kotlin/docs/paths/fakeparametercollisions1ababselfab/Fakeparametercollisions1ababselfabPost.md delete mode 100644 samples/client/petstore/kotlin/docs/paths/fakeparametercollisions1ababselfab/post/Fakeparametercollisions1ababselfabPostCookieParameters.md delete mode 100644 samples/client/petstore/kotlin/docs/paths/fakeparametercollisions1ababselfab/post/Fakeparametercollisions1ababselfabPostHeaderParameters.md delete mode 100644 samples/client/petstore/kotlin/docs/paths/fakeparametercollisions1ababselfab/post/Fakeparametercollisions1ababselfabPostPathParameters.md delete mode 100644 samples/client/petstore/kotlin/docs/paths/fakeparametercollisions1ababselfab/post/Fakeparametercollisions1ababselfabPostQueryParameters.md delete mode 100644 samples/client/petstore/kotlin/docs/paths/fakeparametercollisions1ababselfab/post/Fakeparametercollisions1ababselfabPostRequestBody.md delete mode 100644 samples/client/petstore/kotlin/docs/paths/fakeparametercollisions1ababselfab/post/Fakeparametercollisions1ababselfabPostResponses.md delete mode 100644 samples/client/petstore/kotlin/docs/paths/fakeparametercollisions1ababselfab/post/parameters/parameter0/Schema0.md delete mode 100644 samples/client/petstore/kotlin/docs/paths/fakeparametercollisions1ababselfab/post/parameters/parameter1/Schema1.md delete mode 100644 samples/client/petstore/kotlin/docs/paths/fakeparametercollisions1ababselfab/post/parameters/parameter10/Schema10.md delete mode 100644 samples/client/petstore/kotlin/docs/paths/fakeparametercollisions1ababselfab/post/parameters/parameter11/Schema11.md delete mode 100644 samples/client/petstore/kotlin/docs/paths/fakeparametercollisions1ababselfab/post/parameters/parameter12/Schema12.md delete mode 100644 samples/client/petstore/kotlin/docs/paths/fakeparametercollisions1ababselfab/post/parameters/parameter13/Schema13.md delete mode 100644 samples/client/petstore/kotlin/docs/paths/fakeparametercollisions1ababselfab/post/parameters/parameter14/Schema14.md delete mode 100644 samples/client/petstore/kotlin/docs/paths/fakeparametercollisions1ababselfab/post/parameters/parameter15/Schema15.md delete mode 100644 samples/client/petstore/kotlin/docs/paths/fakeparametercollisions1ababselfab/post/parameters/parameter16/Schema16.md delete mode 100644 samples/client/petstore/kotlin/docs/paths/fakeparametercollisions1ababselfab/post/parameters/parameter17/Schema17.md delete mode 100644 samples/client/petstore/kotlin/docs/paths/fakeparametercollisions1ababselfab/post/parameters/parameter18/Schema18.md delete mode 100644 samples/client/petstore/kotlin/docs/paths/fakeparametercollisions1ababselfab/post/parameters/parameter2/Schema2.md delete mode 100644 samples/client/petstore/kotlin/docs/paths/fakeparametercollisions1ababselfab/post/parameters/parameter3/Schema3.md delete mode 100644 samples/client/petstore/kotlin/docs/paths/fakeparametercollisions1ababselfab/post/parameters/parameter4/Schema4.md delete mode 100644 samples/client/petstore/kotlin/docs/paths/fakeparametercollisions1ababselfab/post/parameters/parameter5/Schema5.md delete mode 100644 samples/client/petstore/kotlin/docs/paths/fakeparametercollisions1ababselfab/post/parameters/parameter6/Schema6.md delete mode 100644 samples/client/petstore/kotlin/docs/paths/fakeparametercollisions1ababselfab/post/parameters/parameter7/Schema7.md delete mode 100644 samples/client/petstore/kotlin/docs/paths/fakeparametercollisions1ababselfab/post/parameters/parameter8/Schema8.md delete mode 100644 samples/client/petstore/kotlin/docs/paths/fakeparametercollisions1ababselfab/post/parameters/parameter9/Schema9.md delete mode 100644 samples/client/petstore/kotlin/docs/paths/fakeparametercollisions1ababselfab/post/requestbody/content/applicationjson/ApplicationjsonSchema.md delete mode 100644 samples/client/petstore/kotlin/docs/paths/fakeparametercollisions1ababselfab/post/responses/Fakeparametercollisions1ababselfabPostCode200Response.md delete mode 100644 samples/client/petstore/kotlin/docs/paths/fakeparametercollisions1ababselfab/post/responses/code200response/content/applicationjson/ApplicationjsonSchema.md delete mode 100644 samples/client/petstore/kotlin/docs/paths/fakepemcontenttype/FakepemcontenttypeGet.md delete mode 100644 samples/client/petstore/kotlin/docs/paths/fakepemcontenttype/get/FakepemcontenttypeGetRequestBody.md delete mode 100644 samples/client/petstore/kotlin/docs/paths/fakepemcontenttype/get/FakepemcontenttypeGetResponses.md delete mode 100644 samples/client/petstore/kotlin/docs/paths/fakepemcontenttype/get/requestbody/content/applicationxpemfile/ApplicationxpemfileSchema.md delete mode 100644 samples/client/petstore/kotlin/docs/paths/fakepemcontenttype/get/responses/FakepemcontenttypeGetCode200Response.md delete mode 100644 samples/client/petstore/kotlin/docs/paths/fakepemcontenttype/get/responses/code200response/content/applicationxpemfile/ApplicationxpemfileSchema.md delete mode 100644 samples/client/petstore/kotlin/docs/paths/fakepetiduploadimagewithrequiredfile/FakepetiduploadimagewithrequiredfilePost.md delete mode 100644 samples/client/petstore/kotlin/docs/paths/fakepetiduploadimagewithrequiredfile/post/FakepetiduploadimagewithrequiredfilePostPathParameters.md delete mode 100644 samples/client/petstore/kotlin/docs/paths/fakepetiduploadimagewithrequiredfile/post/FakepetiduploadimagewithrequiredfilePostRequestBody.md delete mode 100644 samples/client/petstore/kotlin/docs/paths/fakepetiduploadimagewithrequiredfile/post/FakepetiduploadimagewithrequiredfilePostResponses.md delete mode 100644 samples/client/petstore/kotlin/docs/paths/fakepetiduploadimagewithrequiredfile/post/FakepetiduploadimagewithrequiredfilePostSecurityInfo.md delete mode 100644 samples/client/petstore/kotlin/docs/paths/fakepetiduploadimagewithrequiredfile/post/parameters/parameter0/Schema0.md delete mode 100644 samples/client/petstore/kotlin/docs/paths/fakepetiduploadimagewithrequiredfile/post/requestbody/content/multipartformdata/MultipartformdataSchema.md delete mode 100644 samples/client/petstore/kotlin/docs/paths/fakepetiduploadimagewithrequiredfile/post/responses/FakepetiduploadimagewithrequiredfilePostCode200Response.md delete mode 100644 samples/client/petstore/kotlin/docs/paths/fakepetiduploadimagewithrequiredfile/post/responses/code200response/content/applicationjson/ApplicationjsonSchema.md delete mode 100644 samples/client/petstore/kotlin/docs/paths/fakepetiduploadimagewithrequiredfile/post/security/FakepetiduploadimagewithrequiredfilePostSecurityRequirementObject0.md delete mode 100644 samples/client/petstore/kotlin/docs/paths/fakequeryparamwithjsoncontenttype/FakequeryparamwithjsoncontenttypeGet.md delete mode 100644 samples/client/petstore/kotlin/docs/paths/fakequeryparamwithjsoncontenttype/get/FakequeryparamwithjsoncontenttypeGetQueryParameters.md delete mode 100644 samples/client/petstore/kotlin/docs/paths/fakequeryparamwithjsoncontenttype/get/FakequeryparamwithjsoncontenttypeGetResponses.md delete mode 100644 samples/client/petstore/kotlin/docs/paths/fakequeryparamwithjsoncontenttype/get/parameters/parameter0/content/applicationjson/Schema0.md delete mode 100644 samples/client/petstore/kotlin/docs/paths/fakequeryparamwithjsoncontenttype/get/responses/FakequeryparamwithjsoncontenttypeGetCode200Response.md delete mode 100644 samples/client/petstore/kotlin/docs/paths/fakequeryparamwithjsoncontenttype/get/responses/code200response/content/applicationjson/ApplicationjsonSchema.md delete mode 100644 samples/client/petstore/kotlin/docs/paths/fakeredirection/FakeredirectionGet.md delete mode 100644 samples/client/petstore/kotlin/docs/paths/fakeredirection/get/FakeredirectionGetResponses.md delete mode 100644 samples/client/petstore/kotlin/docs/paths/fakeredirection/get/responses/FakeredirectionGetCode303Response.md delete mode 100644 samples/client/petstore/kotlin/docs/paths/fakeredirection/get/responses/FakeredirectionGetCode3XXResponse.md delete mode 100644 samples/client/petstore/kotlin/docs/paths/fakerefobjinquery/FakerefobjinqueryGet.md delete mode 100644 samples/client/petstore/kotlin/docs/paths/fakerefobjinquery/get/FakerefobjinqueryGetQueryParameters.md delete mode 100644 samples/client/petstore/kotlin/docs/paths/fakerefobjinquery/get/FakerefobjinqueryGetResponses.md delete mode 100644 samples/client/petstore/kotlin/docs/paths/fakerefobjinquery/get/parameters/parameter0/Schema0.md delete mode 100644 samples/client/petstore/kotlin/docs/paths/fakerefobjinquery/get/responses/FakerefobjinqueryGetCode200Response.md delete mode 100644 samples/client/petstore/kotlin/docs/paths/fakerefsarraymodel/FakerefsarraymodelPost.md delete mode 100644 samples/client/petstore/kotlin/docs/paths/fakerefsarraymodel/post/FakerefsarraymodelPostRequestBody.md delete mode 100644 samples/client/petstore/kotlin/docs/paths/fakerefsarraymodel/post/FakerefsarraymodelPostResponses.md delete mode 100644 samples/client/petstore/kotlin/docs/paths/fakerefsarraymodel/post/requestbody/content/applicationjson/ApplicationjsonSchema.md delete mode 100644 samples/client/petstore/kotlin/docs/paths/fakerefsarraymodel/post/responses/FakerefsarraymodelPostCode200Response.md delete mode 100644 samples/client/petstore/kotlin/docs/paths/fakerefsarraymodel/post/responses/code200response/content/applicationjson/ApplicationjsonSchema.md delete mode 100644 samples/client/petstore/kotlin/docs/paths/fakerefsarrayofenums/FakerefsarrayofenumsPost.md delete mode 100644 samples/client/petstore/kotlin/docs/paths/fakerefsarrayofenums/post/FakerefsarrayofenumsPostRequestBody.md delete mode 100644 samples/client/petstore/kotlin/docs/paths/fakerefsarrayofenums/post/FakerefsarrayofenumsPostResponses.md delete mode 100644 samples/client/petstore/kotlin/docs/paths/fakerefsarrayofenums/post/requestbody/content/applicationjson/ApplicationjsonSchema.md delete mode 100644 samples/client/petstore/kotlin/docs/paths/fakerefsarrayofenums/post/responses/FakerefsarrayofenumsPostCode200Response.md delete mode 100644 samples/client/petstore/kotlin/docs/paths/fakerefsarrayofenums/post/responses/code200response/content/applicationjson/ApplicationjsonSchema.md delete mode 100644 samples/client/petstore/kotlin/docs/paths/fakerefsboolean/FakerefsbooleanPost.md delete mode 100644 samples/client/petstore/kotlin/docs/paths/fakerefsboolean/post/FakerefsbooleanPostRequestBody.md delete mode 100644 samples/client/petstore/kotlin/docs/paths/fakerefsboolean/post/FakerefsbooleanPostResponses.md delete mode 100644 samples/client/petstore/kotlin/docs/paths/fakerefsboolean/post/requestbody/content/applicationjson/ApplicationjsonSchema.md delete mode 100644 samples/client/petstore/kotlin/docs/paths/fakerefsboolean/post/responses/FakerefsbooleanPostCode200Response.md delete mode 100644 samples/client/petstore/kotlin/docs/paths/fakerefsboolean/post/responses/code200response/content/applicationjson/ApplicationjsonSchema.md delete mode 100644 samples/client/petstore/kotlin/docs/paths/fakerefscomposedoneofnumberwithvalidations/FakerefscomposedoneofnumberwithvalidationsPost.md delete mode 100644 samples/client/petstore/kotlin/docs/paths/fakerefscomposedoneofnumberwithvalidations/post/FakerefscomposedoneofnumberwithvalidationsPostRequestBody.md delete mode 100644 samples/client/petstore/kotlin/docs/paths/fakerefscomposedoneofnumberwithvalidations/post/FakerefscomposedoneofnumberwithvalidationsPostResponses.md delete mode 100644 samples/client/petstore/kotlin/docs/paths/fakerefscomposedoneofnumberwithvalidations/post/requestbody/content/applicationjson/ApplicationjsonSchema.md delete mode 100644 samples/client/petstore/kotlin/docs/paths/fakerefscomposedoneofnumberwithvalidations/post/responses/FakerefscomposedoneofnumberwithvalidationsPostCode200Response.md delete mode 100644 samples/client/petstore/kotlin/docs/paths/fakerefscomposedoneofnumberwithvalidations/post/responses/code200response/content/applicationjson/ApplicationjsonSchema.md delete mode 100644 samples/client/petstore/kotlin/docs/paths/fakerefsenum/FakerefsenumPost.md delete mode 100644 samples/client/petstore/kotlin/docs/paths/fakerefsenum/post/FakerefsenumPostRequestBody.md delete mode 100644 samples/client/petstore/kotlin/docs/paths/fakerefsenum/post/FakerefsenumPostResponses.md delete mode 100644 samples/client/petstore/kotlin/docs/paths/fakerefsenum/post/requestbody/content/applicationjson/ApplicationjsonSchema.md delete mode 100644 samples/client/petstore/kotlin/docs/paths/fakerefsenum/post/responses/FakerefsenumPostCode200Response.md delete mode 100644 samples/client/petstore/kotlin/docs/paths/fakerefsenum/post/responses/code200response/content/applicationjson/ApplicationjsonSchema.md delete mode 100644 samples/client/petstore/kotlin/docs/paths/fakerefsmammal/FakerefsmammalPost.md delete mode 100644 samples/client/petstore/kotlin/docs/paths/fakerefsmammal/post/FakerefsmammalPostRequestBody.md delete mode 100644 samples/client/petstore/kotlin/docs/paths/fakerefsmammal/post/FakerefsmammalPostResponses.md delete mode 100644 samples/client/petstore/kotlin/docs/paths/fakerefsmammal/post/requestbody/content/applicationjson/ApplicationjsonSchema.md delete mode 100644 samples/client/petstore/kotlin/docs/paths/fakerefsmammal/post/responses/FakerefsmammalPostCode200Response.md delete mode 100644 samples/client/petstore/kotlin/docs/paths/fakerefsmammal/post/responses/code200response/content/applicationjson/ApplicationjsonSchema.md delete mode 100644 samples/client/petstore/kotlin/docs/paths/fakerefsnumber/FakerefsnumberPost.md delete mode 100644 samples/client/petstore/kotlin/docs/paths/fakerefsnumber/post/FakerefsnumberPostRequestBody.md delete mode 100644 samples/client/petstore/kotlin/docs/paths/fakerefsnumber/post/FakerefsnumberPostResponses.md delete mode 100644 samples/client/petstore/kotlin/docs/paths/fakerefsnumber/post/requestbody/content/applicationjson/ApplicationjsonSchema.md delete mode 100644 samples/client/petstore/kotlin/docs/paths/fakerefsnumber/post/responses/FakerefsnumberPostCode200Response.md delete mode 100644 samples/client/petstore/kotlin/docs/paths/fakerefsnumber/post/responses/code200response/content/applicationjson/ApplicationjsonSchema.md delete mode 100644 samples/client/petstore/kotlin/docs/paths/fakerefsobjectmodelwithrefprops/FakerefsobjectmodelwithrefpropsPost.md delete mode 100644 samples/client/petstore/kotlin/docs/paths/fakerefsobjectmodelwithrefprops/post/FakerefsobjectmodelwithrefpropsPostRequestBody.md delete mode 100644 samples/client/petstore/kotlin/docs/paths/fakerefsobjectmodelwithrefprops/post/FakerefsobjectmodelwithrefpropsPostResponses.md delete mode 100644 samples/client/petstore/kotlin/docs/paths/fakerefsobjectmodelwithrefprops/post/requestbody/content/applicationjson/ApplicationjsonSchema.md delete mode 100644 samples/client/petstore/kotlin/docs/paths/fakerefsobjectmodelwithrefprops/post/responses/FakerefsobjectmodelwithrefpropsPostCode200Response.md delete mode 100644 samples/client/petstore/kotlin/docs/paths/fakerefsobjectmodelwithrefprops/post/responses/code200response/content/applicationjson/ApplicationjsonSchema.md delete mode 100644 samples/client/petstore/kotlin/docs/paths/fakerefsstring/FakerefsstringPost.md delete mode 100644 samples/client/petstore/kotlin/docs/paths/fakerefsstring/post/FakerefsstringPostRequestBody.md delete mode 100644 samples/client/petstore/kotlin/docs/paths/fakerefsstring/post/FakerefsstringPostResponses.md delete mode 100644 samples/client/petstore/kotlin/docs/paths/fakerefsstring/post/requestbody/content/applicationjson/ApplicationjsonSchema.md delete mode 100644 samples/client/petstore/kotlin/docs/paths/fakerefsstring/post/responses/FakerefsstringPostCode200Response.md delete mode 100644 samples/client/petstore/kotlin/docs/paths/fakerefsstring/post/responses/code200response/content/applicationjson/ApplicationjsonSchema.md delete mode 100644 samples/client/petstore/kotlin/docs/paths/fakeresponsewithoutschema/FakeresponsewithoutschemaGet.md delete mode 100644 samples/client/petstore/kotlin/docs/paths/fakeresponsewithoutschema/get/FakeresponsewithoutschemaGetResponses.md delete mode 100644 samples/client/petstore/kotlin/docs/paths/fakeresponsewithoutschema/get/responses/FakeresponsewithoutschemaGetCode200Response.md delete mode 100644 samples/client/petstore/kotlin/docs/paths/faketestqueryparamters/FaketestqueryparamtersPut.md delete mode 100644 samples/client/petstore/kotlin/docs/paths/faketestqueryparamters/put/FaketestqueryparamtersPutQueryParameters.md delete mode 100644 samples/client/petstore/kotlin/docs/paths/faketestqueryparamters/put/FaketestqueryparamtersPutResponses.md delete mode 100644 samples/client/petstore/kotlin/docs/paths/faketestqueryparamters/put/parameters/parameter0/Schema0.md delete mode 100644 samples/client/petstore/kotlin/docs/paths/faketestqueryparamters/put/parameters/parameter1/Schema1.md delete mode 100644 samples/client/petstore/kotlin/docs/paths/faketestqueryparamters/put/parameters/parameter2/Schema2.md delete mode 100644 samples/client/petstore/kotlin/docs/paths/faketestqueryparamters/put/parameters/parameter3/Schema3.md delete mode 100644 samples/client/petstore/kotlin/docs/paths/faketestqueryparamters/put/parameters/parameter4/Schema4.md delete mode 100644 samples/client/petstore/kotlin/docs/paths/faketestqueryparamters/put/parameters/parameter5/Schema5.md delete mode 100644 samples/client/petstore/kotlin/docs/paths/faketestqueryparamters/put/responses/FaketestqueryparamtersPutCode200Response.md delete mode 100644 samples/client/petstore/kotlin/docs/paths/fakeuploaddownloadfile/FakeuploaddownloadfilePost.md delete mode 100644 samples/client/petstore/kotlin/docs/paths/fakeuploaddownloadfile/post/FakeuploaddownloadfilePostRequestBody.md delete mode 100644 samples/client/petstore/kotlin/docs/paths/fakeuploaddownloadfile/post/FakeuploaddownloadfilePostResponses.md delete mode 100644 samples/client/petstore/kotlin/docs/paths/fakeuploaddownloadfile/post/requestbody/content/applicationoctetstream/ApplicationoctetstreamSchema.md delete mode 100644 samples/client/petstore/kotlin/docs/paths/fakeuploaddownloadfile/post/responses/FakeuploaddownloadfilePostCode200Response.md delete mode 100644 samples/client/petstore/kotlin/docs/paths/fakeuploaddownloadfile/post/responses/code200response/content/applicationoctetstream/ApplicationoctetstreamSchema.md delete mode 100644 samples/client/petstore/kotlin/docs/paths/fakeuploadfile/FakeuploadfilePost.md delete mode 100644 samples/client/petstore/kotlin/docs/paths/fakeuploadfile/post/FakeuploadfilePostRequestBody.md delete mode 100644 samples/client/petstore/kotlin/docs/paths/fakeuploadfile/post/FakeuploadfilePostResponses.md delete mode 100644 samples/client/petstore/kotlin/docs/paths/fakeuploadfile/post/requestbody/content/multipartformdata/MultipartformdataSchema.md delete mode 100644 samples/client/petstore/kotlin/docs/paths/fakeuploadfile/post/responses/FakeuploadfilePostCode200Response.md delete mode 100644 samples/client/petstore/kotlin/docs/paths/fakeuploadfile/post/responses/code200response/content/applicationjson/ApplicationjsonSchema.md delete mode 100644 samples/client/petstore/kotlin/docs/paths/fakeuploadfiles/FakeuploadfilesPost.md delete mode 100644 samples/client/petstore/kotlin/docs/paths/fakeuploadfiles/post/FakeuploadfilesPostRequestBody.md delete mode 100644 samples/client/petstore/kotlin/docs/paths/fakeuploadfiles/post/FakeuploadfilesPostResponses.md delete mode 100644 samples/client/petstore/kotlin/docs/paths/fakeuploadfiles/post/requestbody/content/multipartformdata/MultipartformdataSchema.md delete mode 100644 samples/client/petstore/kotlin/docs/paths/fakeuploadfiles/post/responses/FakeuploadfilesPostCode200Response.md delete mode 100644 samples/client/petstore/kotlin/docs/paths/fakeuploadfiles/post/responses/code200response/content/applicationjson/ApplicationjsonSchema.md delete mode 100644 samples/client/petstore/kotlin/docs/paths/fakewildcardresponses/FakewildcardresponsesGet.md delete mode 100644 samples/client/petstore/kotlin/docs/paths/fakewildcardresponses/get/FakewildcardresponsesGetResponses.md delete mode 100644 samples/client/petstore/kotlin/docs/paths/fakewildcardresponses/get/responses/FakewildcardresponsesGetCode1XXResponse.md delete mode 100644 samples/client/petstore/kotlin/docs/paths/fakewildcardresponses/get/responses/FakewildcardresponsesGetCode200Response.md delete mode 100644 samples/client/petstore/kotlin/docs/paths/fakewildcardresponses/get/responses/FakewildcardresponsesGetCode2XXResponse.md delete mode 100644 samples/client/petstore/kotlin/docs/paths/fakewildcardresponses/get/responses/FakewildcardresponsesGetCode3XXResponse.md delete mode 100644 samples/client/petstore/kotlin/docs/paths/fakewildcardresponses/get/responses/FakewildcardresponsesGetCode4XXResponse.md delete mode 100644 samples/client/petstore/kotlin/docs/paths/fakewildcardresponses/get/responses/FakewildcardresponsesGetCode5XXResponse.md delete mode 100644 samples/client/petstore/kotlin/docs/paths/fakewildcardresponses/get/responses/code1xxresponse/content/applicationjson/ApplicationjsonSchema.md delete mode 100644 samples/client/petstore/kotlin/docs/paths/fakewildcardresponses/get/responses/code200response/content/applicationjson/ApplicationjsonSchema.md delete mode 100644 samples/client/petstore/kotlin/docs/paths/fakewildcardresponses/get/responses/code2xxresponse/content/applicationjson/ApplicationjsonSchema.md delete mode 100644 samples/client/petstore/kotlin/docs/paths/fakewildcardresponses/get/responses/code3xxresponse/content/applicationjson/ApplicationjsonSchema.md delete mode 100644 samples/client/petstore/kotlin/docs/paths/fakewildcardresponses/get/responses/code4xxresponse/content/applicationjson/ApplicationjsonSchema.md delete mode 100644 samples/client/petstore/kotlin/docs/paths/fakewildcardresponses/get/responses/code5xxresponse/content/applicationjson/ApplicationjsonSchema.md delete mode 100644 samples/client/petstore/kotlin/docs/paths/foo/FooGet.md delete mode 100644 samples/client/petstore/kotlin/docs/paths/foo/get/FooGetResponses.md delete mode 100644 samples/client/petstore/kotlin/docs/paths/foo/get/FooGetServerInfo.md delete mode 100644 samples/client/petstore/kotlin/docs/paths/foo/get/responses/FooGetCodedefaultResponse.md delete mode 100644 samples/client/petstore/kotlin/docs/paths/foo/get/responses/codedefaultresponse/content/applicationjson/ApplicationjsonSchema.md delete mode 100644 samples/client/petstore/kotlin/docs/paths/foo/get/servers/FooGetServer0.md delete mode 100644 samples/client/petstore/kotlin/docs/paths/foo/get/servers/FooGetServer1.md delete mode 100644 samples/client/petstore/kotlin/docs/paths/foo/get/servers/server1/FooGetServer1Variables.md delete mode 100644 samples/client/petstore/kotlin/docs/paths/pet/PetPost.md delete mode 100644 samples/client/petstore/kotlin/docs/paths/pet/PetPut.md delete mode 100644 samples/client/petstore/kotlin/docs/paths/pet/post/PetPostRequestBody.md delete mode 100644 samples/client/petstore/kotlin/docs/paths/pet/post/PetPostResponses.md delete mode 100644 samples/client/petstore/kotlin/docs/paths/pet/post/PetPostSecurityInfo.md delete mode 100644 samples/client/petstore/kotlin/docs/paths/pet/post/responses/PetPostCode200Response.md delete mode 100644 samples/client/petstore/kotlin/docs/paths/pet/post/responses/PetPostCode405Response.md delete mode 100644 samples/client/petstore/kotlin/docs/paths/pet/post/security/PetPostSecurityRequirementObject0.md delete mode 100644 samples/client/petstore/kotlin/docs/paths/pet/post/security/PetPostSecurityRequirementObject1.md delete mode 100644 samples/client/petstore/kotlin/docs/paths/pet/post/security/PetPostSecurityRequirementObject2.md delete mode 100644 samples/client/petstore/kotlin/docs/paths/pet/put/PetPutRequestBody.md delete mode 100644 samples/client/petstore/kotlin/docs/paths/pet/put/PetPutResponses.md delete mode 100644 samples/client/petstore/kotlin/docs/paths/pet/put/PetPutSecurityInfo.md delete mode 100644 samples/client/petstore/kotlin/docs/paths/pet/put/responses/PetPutCode400Response.md delete mode 100644 samples/client/petstore/kotlin/docs/paths/pet/put/responses/PetPutCode404Response.md delete mode 100644 samples/client/petstore/kotlin/docs/paths/pet/put/responses/PetPutCode405Response.md delete mode 100644 samples/client/petstore/kotlin/docs/paths/pet/put/security/PetPutSecurityRequirementObject0.md delete mode 100644 samples/client/petstore/kotlin/docs/paths/pet/put/security/PetPutSecurityRequirementObject1.md delete mode 100644 samples/client/petstore/kotlin/docs/paths/petfindbystatus/PetfindbystatusGet.md delete mode 100644 samples/client/petstore/kotlin/docs/paths/petfindbystatus/PetfindbystatusServerInfo.md delete mode 100644 samples/client/petstore/kotlin/docs/paths/petfindbystatus/get/PetfindbystatusGetQueryParameters.md delete mode 100644 samples/client/petstore/kotlin/docs/paths/petfindbystatus/get/PetfindbystatusGetResponses.md delete mode 100644 samples/client/petstore/kotlin/docs/paths/petfindbystatus/get/PetfindbystatusGetSecurityInfo.md delete mode 100644 samples/client/petstore/kotlin/docs/paths/petfindbystatus/get/parameters/parameter0/Schema0.md delete mode 100644 samples/client/petstore/kotlin/docs/paths/petfindbystatus/get/responses/PetfindbystatusGetCode200Response.md delete mode 100644 samples/client/petstore/kotlin/docs/paths/petfindbystatus/get/responses/PetfindbystatusGetCode400Response.md delete mode 100644 samples/client/petstore/kotlin/docs/paths/petfindbystatus/get/security/PetfindbystatusGetSecurityRequirementObject0.md delete mode 100644 samples/client/petstore/kotlin/docs/paths/petfindbystatus/get/security/PetfindbystatusGetSecurityRequirementObject1.md delete mode 100644 samples/client/petstore/kotlin/docs/paths/petfindbystatus/get/security/PetfindbystatusGetSecurityRequirementObject2.md delete mode 100644 samples/client/petstore/kotlin/docs/paths/petfindbystatus/servers/PetfindbystatusServer0.md delete mode 100644 samples/client/petstore/kotlin/docs/paths/petfindbystatus/servers/PetfindbystatusServer1.md delete mode 100644 samples/client/petstore/kotlin/docs/paths/petfindbystatus/servers/server1/PetfindbystatusServer1Variables.md delete mode 100644 samples/client/petstore/kotlin/docs/paths/petfindbytags/PetfindbytagsGet.md delete mode 100644 samples/client/petstore/kotlin/docs/paths/petfindbytags/get/PetfindbytagsGetQueryParameters.md delete mode 100644 samples/client/petstore/kotlin/docs/paths/petfindbytags/get/PetfindbytagsGetResponses.md delete mode 100644 samples/client/petstore/kotlin/docs/paths/petfindbytags/get/PetfindbytagsGetSecurityInfo.md delete mode 100644 samples/client/petstore/kotlin/docs/paths/petfindbytags/get/parameters/parameter0/Schema0.md delete mode 100644 samples/client/petstore/kotlin/docs/paths/petfindbytags/get/responses/PetfindbytagsGetCode200Response.md delete mode 100644 samples/client/petstore/kotlin/docs/paths/petfindbytags/get/responses/PetfindbytagsGetCode400Response.md delete mode 100644 samples/client/petstore/kotlin/docs/paths/petfindbytags/get/security/PetfindbytagsGetSecurityRequirementObject0.md delete mode 100644 samples/client/petstore/kotlin/docs/paths/petfindbytags/get/security/PetfindbytagsGetSecurityRequirementObject1.md delete mode 100644 samples/client/petstore/kotlin/docs/paths/petpetid/PetpetidDelete.md delete mode 100644 samples/client/petstore/kotlin/docs/paths/petpetid/PetpetidGet.md delete mode 100644 samples/client/petstore/kotlin/docs/paths/petpetid/PetpetidPost.md delete mode 100644 samples/client/petstore/kotlin/docs/paths/petpetid/delete/PetpetidDeleteHeaderParameters.md delete mode 100644 samples/client/petstore/kotlin/docs/paths/petpetid/delete/PetpetidDeletePathParameters.md delete mode 100644 samples/client/petstore/kotlin/docs/paths/petpetid/delete/PetpetidDeleteResponses.md delete mode 100644 samples/client/petstore/kotlin/docs/paths/petpetid/delete/PetpetidDeleteSecurityInfo.md delete mode 100644 samples/client/petstore/kotlin/docs/paths/petpetid/delete/parameters/parameter0/Schema0.md delete mode 100644 samples/client/petstore/kotlin/docs/paths/petpetid/delete/parameters/parameter1/Schema1.md delete mode 100644 samples/client/petstore/kotlin/docs/paths/petpetid/delete/responses/PetpetidDeleteCode400Response.md delete mode 100644 samples/client/petstore/kotlin/docs/paths/petpetid/delete/security/PetpetidDeleteSecurityRequirementObject0.md delete mode 100644 samples/client/petstore/kotlin/docs/paths/petpetid/delete/security/PetpetidDeleteSecurityRequirementObject1.md delete mode 100644 samples/client/petstore/kotlin/docs/paths/petpetid/get/PetpetidGetPathParameters.md delete mode 100644 samples/client/petstore/kotlin/docs/paths/petpetid/get/PetpetidGetResponses.md delete mode 100644 samples/client/petstore/kotlin/docs/paths/petpetid/get/PetpetidGetSecurityInfo.md delete mode 100644 samples/client/petstore/kotlin/docs/paths/petpetid/get/parameters/parameter0/Schema0.md delete mode 100644 samples/client/petstore/kotlin/docs/paths/petpetid/get/responses/PetpetidGetCode200Response.md delete mode 100644 samples/client/petstore/kotlin/docs/paths/petpetid/get/responses/PetpetidGetCode400Response.md delete mode 100644 samples/client/petstore/kotlin/docs/paths/petpetid/get/responses/PetpetidGetCode404Response.md delete mode 100644 samples/client/petstore/kotlin/docs/paths/petpetid/get/responses/code200response/content/applicationjson/ApplicationjsonSchema.md delete mode 100644 samples/client/petstore/kotlin/docs/paths/petpetid/get/responses/code200response/content/applicationxml/ApplicationxmlSchema.md delete mode 100644 samples/client/petstore/kotlin/docs/paths/petpetid/get/security/PetpetidGetSecurityRequirementObject0.md delete mode 100644 samples/client/petstore/kotlin/docs/paths/petpetid/post/PetpetidPostPathParameters.md delete mode 100644 samples/client/petstore/kotlin/docs/paths/petpetid/post/PetpetidPostRequestBody.md delete mode 100644 samples/client/petstore/kotlin/docs/paths/petpetid/post/PetpetidPostResponses.md delete mode 100644 samples/client/petstore/kotlin/docs/paths/petpetid/post/PetpetidPostSecurityInfo.md delete mode 100644 samples/client/petstore/kotlin/docs/paths/petpetid/post/parameters/parameter0/Schema0.md delete mode 100644 samples/client/petstore/kotlin/docs/paths/petpetid/post/requestbody/content/applicationxwwwformurlencoded/ApplicationxwwwformurlencodedSchema.md delete mode 100644 samples/client/petstore/kotlin/docs/paths/petpetid/post/responses/PetpetidPostCode405Response.md delete mode 100644 samples/client/petstore/kotlin/docs/paths/petpetid/post/security/PetpetidPostSecurityRequirementObject0.md delete mode 100644 samples/client/petstore/kotlin/docs/paths/petpetid/post/security/PetpetidPostSecurityRequirementObject1.md delete mode 100644 samples/client/petstore/kotlin/docs/paths/petpetiduploadimage/PetpetiduploadimagePost.md delete mode 100644 samples/client/petstore/kotlin/docs/paths/petpetiduploadimage/post/PetpetiduploadimagePostPathParameters.md delete mode 100644 samples/client/petstore/kotlin/docs/paths/petpetiduploadimage/post/PetpetiduploadimagePostRequestBody.md delete mode 100644 samples/client/petstore/kotlin/docs/paths/petpetiduploadimage/post/PetpetiduploadimagePostResponses.md delete mode 100644 samples/client/petstore/kotlin/docs/paths/petpetiduploadimage/post/PetpetiduploadimagePostSecurityInfo.md delete mode 100644 samples/client/petstore/kotlin/docs/paths/petpetiduploadimage/post/parameters/parameter0/Schema0.md delete mode 100644 samples/client/petstore/kotlin/docs/paths/petpetiduploadimage/post/requestbody/content/multipartformdata/MultipartformdataSchema.md delete mode 100644 samples/client/petstore/kotlin/docs/paths/petpetiduploadimage/post/responses/PetpetiduploadimagePostCode200Response.md delete mode 100644 samples/client/petstore/kotlin/docs/paths/petpetiduploadimage/post/security/PetpetiduploadimagePostSecurityRequirementObject0.md delete mode 100644 samples/client/petstore/kotlin/docs/paths/solidus/SolidusGet.md delete mode 100644 samples/client/petstore/kotlin/docs/paths/solidus/get/SolidusGetResponses.md delete mode 100644 samples/client/petstore/kotlin/docs/paths/solidus/get/responses/SolidusGetCode200Response.md delete mode 100644 samples/client/petstore/kotlin/docs/paths/storeinventory/StoreinventoryGet.md delete mode 100644 samples/client/petstore/kotlin/docs/paths/storeinventory/get/StoreinventoryGetResponses.md delete mode 100644 samples/client/petstore/kotlin/docs/paths/storeinventory/get/StoreinventoryGetSecurityInfo.md delete mode 100644 samples/client/petstore/kotlin/docs/paths/storeinventory/get/responses/StoreinventoryGetCode200Response.md delete mode 100644 samples/client/petstore/kotlin/docs/paths/storeinventory/get/security/StoreinventoryGetSecurityRequirementObject0.md delete mode 100644 samples/client/petstore/kotlin/docs/paths/storeorder/StoreorderPost.md delete mode 100644 samples/client/petstore/kotlin/docs/paths/storeorder/post/StoreorderPostRequestBody.md delete mode 100644 samples/client/petstore/kotlin/docs/paths/storeorder/post/StoreorderPostResponses.md delete mode 100644 samples/client/petstore/kotlin/docs/paths/storeorder/post/requestbody/content/applicationjson/ApplicationjsonSchema.md delete mode 100644 samples/client/petstore/kotlin/docs/paths/storeorder/post/responses/StoreorderPostCode200Response.md delete mode 100644 samples/client/petstore/kotlin/docs/paths/storeorder/post/responses/StoreorderPostCode400Response.md delete mode 100644 samples/client/petstore/kotlin/docs/paths/storeorder/post/responses/code200response/content/applicationjson/ApplicationjsonSchema.md delete mode 100644 samples/client/petstore/kotlin/docs/paths/storeorder/post/responses/code200response/content/applicationxml/ApplicationxmlSchema.md delete mode 100644 samples/client/petstore/kotlin/docs/paths/storeorderorderid/StoreorderorderidDelete.md delete mode 100644 samples/client/petstore/kotlin/docs/paths/storeorderorderid/StoreorderorderidGet.md delete mode 100644 samples/client/petstore/kotlin/docs/paths/storeorderorderid/delete/StoreorderorderidDeletePathParameters.md delete mode 100644 samples/client/petstore/kotlin/docs/paths/storeorderorderid/delete/StoreorderorderidDeleteResponses.md delete mode 100644 samples/client/petstore/kotlin/docs/paths/storeorderorderid/delete/parameters/parameter0/Schema0.md delete mode 100644 samples/client/petstore/kotlin/docs/paths/storeorderorderid/delete/responses/StoreorderorderidDeleteCode400Response.md delete mode 100644 samples/client/petstore/kotlin/docs/paths/storeorderorderid/delete/responses/StoreorderorderidDeleteCode404Response.md delete mode 100644 samples/client/petstore/kotlin/docs/paths/storeorderorderid/get/StoreorderorderidGetPathParameters.md delete mode 100644 samples/client/petstore/kotlin/docs/paths/storeorderorderid/get/StoreorderorderidGetResponses.md delete mode 100644 samples/client/petstore/kotlin/docs/paths/storeorderorderid/get/parameters/parameter0/Schema0.md delete mode 100644 samples/client/petstore/kotlin/docs/paths/storeorderorderid/get/responses/StoreorderorderidGetCode200Response.md delete mode 100644 samples/client/petstore/kotlin/docs/paths/storeorderorderid/get/responses/StoreorderorderidGetCode400Response.md delete mode 100644 samples/client/petstore/kotlin/docs/paths/storeorderorderid/get/responses/StoreorderorderidGetCode404Response.md delete mode 100644 samples/client/petstore/kotlin/docs/paths/storeorderorderid/get/responses/code200response/content/applicationjson/ApplicationjsonSchema.md delete mode 100644 samples/client/petstore/kotlin/docs/paths/storeorderorderid/get/responses/code200response/content/applicationxml/ApplicationxmlSchema.md delete mode 100644 samples/client/petstore/kotlin/docs/paths/user/UserPost.md delete mode 100644 samples/client/petstore/kotlin/docs/paths/user/post/UserPostRequestBody.md delete mode 100644 samples/client/petstore/kotlin/docs/paths/user/post/UserPostResponses.md delete mode 100644 samples/client/petstore/kotlin/docs/paths/user/post/requestbody/content/applicationjson/ApplicationjsonSchema.md delete mode 100644 samples/client/petstore/kotlin/docs/paths/user/post/responses/UserPostCodedefaultResponse.md delete mode 100644 samples/client/petstore/kotlin/docs/paths/usercreatewitharray/UsercreatewitharrayPost.md delete mode 100644 samples/client/petstore/kotlin/docs/paths/usercreatewitharray/post/UsercreatewitharrayPostRequestBody.md delete mode 100644 samples/client/petstore/kotlin/docs/paths/usercreatewitharray/post/UsercreatewitharrayPostResponses.md delete mode 100644 samples/client/petstore/kotlin/docs/paths/usercreatewitharray/post/responses/UsercreatewitharrayPostCodedefaultResponse.md delete mode 100644 samples/client/petstore/kotlin/docs/paths/usercreatewithlist/UsercreatewithlistPost.md delete mode 100644 samples/client/petstore/kotlin/docs/paths/usercreatewithlist/post/UsercreatewithlistPostRequestBody.md delete mode 100644 samples/client/petstore/kotlin/docs/paths/usercreatewithlist/post/UsercreatewithlistPostResponses.md delete mode 100644 samples/client/petstore/kotlin/docs/paths/usercreatewithlist/post/responses/UsercreatewithlistPostCodedefaultResponse.md delete mode 100644 samples/client/petstore/kotlin/docs/paths/userlogin/UserloginGet.md delete mode 100644 samples/client/petstore/kotlin/docs/paths/userlogin/get/UserloginGetQueryParameters.md delete mode 100644 samples/client/petstore/kotlin/docs/paths/userlogin/get/UserloginGetResponses.md delete mode 100644 samples/client/petstore/kotlin/docs/paths/userlogin/get/parameters/parameter0/Schema0.md delete mode 100644 samples/client/petstore/kotlin/docs/paths/userlogin/get/parameters/parameter1/Schema1.md delete mode 100644 samples/client/petstore/kotlin/docs/paths/userlogin/get/responses/UserloginGetCode200Response.md delete mode 100644 samples/client/petstore/kotlin/docs/paths/userlogin/get/responses/UserloginGetCode400Response.md delete mode 100644 samples/client/petstore/kotlin/docs/paths/userlogin/get/responses/code200response/UserloginGetCode200ResponseHeadersSchema.md delete mode 100644 samples/client/petstore/kotlin/docs/paths/userlogin/get/responses/code200response/content/applicationjson/ApplicationjsonSchema.md delete mode 100644 samples/client/petstore/kotlin/docs/paths/userlogin/get/responses/code200response/content/applicationxml/ApplicationxmlSchema.md delete mode 100644 samples/client/petstore/kotlin/docs/paths/userlogin/get/responses/code200response/headers/xexpiresafter/XExpiresAfterSchema.md delete mode 100644 samples/client/petstore/kotlin/docs/paths/userlogin/get/responses/code200response/headers/xratelimit/content/applicationjson/XRateLimitSchema.md delete mode 100644 samples/client/petstore/kotlin/docs/paths/userlogout/UserlogoutGet.md delete mode 100644 samples/client/petstore/kotlin/docs/paths/userlogout/get/UserlogoutGetResponses.md delete mode 100644 samples/client/petstore/kotlin/docs/paths/userlogout/get/responses/UserlogoutGetCodedefaultResponse.md delete mode 100644 samples/client/petstore/kotlin/docs/paths/userusername/UserusernameDelete.md delete mode 100644 samples/client/petstore/kotlin/docs/paths/userusername/UserusernameGet.md delete mode 100644 samples/client/petstore/kotlin/docs/paths/userusername/UserusernamePut.md delete mode 100644 samples/client/petstore/kotlin/docs/paths/userusername/delete/UserusernameDeletePathParameters.md delete mode 100644 samples/client/petstore/kotlin/docs/paths/userusername/delete/UserusernameDeleteResponses.md delete mode 100644 samples/client/petstore/kotlin/docs/paths/userusername/delete/responses/UserusernameDeleteCode200Response.md delete mode 100644 samples/client/petstore/kotlin/docs/paths/userusername/delete/responses/UserusernameDeleteCode404Response.md delete mode 100644 samples/client/petstore/kotlin/docs/paths/userusername/get/UserusernameGetPathParameters.md delete mode 100644 samples/client/petstore/kotlin/docs/paths/userusername/get/UserusernameGetResponses.md delete mode 100644 samples/client/petstore/kotlin/docs/paths/userusername/get/responses/UserusernameGetCode200Response.md delete mode 100644 samples/client/petstore/kotlin/docs/paths/userusername/get/responses/UserusernameGetCode400Response.md delete mode 100644 samples/client/petstore/kotlin/docs/paths/userusername/get/responses/UserusernameGetCode404Response.md delete mode 100644 samples/client/petstore/kotlin/docs/paths/userusername/get/responses/code200response/content/applicationjson/ApplicationjsonSchema.md delete mode 100644 samples/client/petstore/kotlin/docs/paths/userusername/get/responses/code200response/content/applicationxml/ApplicationxmlSchema.md delete mode 100644 samples/client/petstore/kotlin/docs/paths/userusername/put/UserusernamePutPathParameters.md delete mode 100644 samples/client/petstore/kotlin/docs/paths/userusername/put/UserusernamePutRequestBody.md delete mode 100644 samples/client/petstore/kotlin/docs/paths/userusername/put/UserusernamePutResponses.md delete mode 100644 samples/client/petstore/kotlin/docs/paths/userusername/put/requestbody/content/applicationjson/ApplicationjsonSchema.md delete mode 100644 samples/client/petstore/kotlin/docs/paths/userusername/put/responses/UserusernamePutCode400Response.md delete mode 100644 samples/client/petstore/kotlin/docs/paths/userusername/put/responses/UserusernamePutCode404Response.md delete mode 100644 samples/client/petstore/kotlin/docs/servers/RootServer0.md delete mode 100644 samples/client/petstore/kotlin/docs/servers/RootServer1.md delete mode 100644 samples/client/petstore/kotlin/docs/servers/rootserver0/RootServer0Variables.md delete mode 100644 samples/client/petstore/kotlin/docs/servers/rootserver1/RootServer1Variables.md delete mode 100644 samples/client/petstore/kotlin/settings.gradle.kts delete mode 100644 samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/RootServerInfo.kt delete mode 100644 samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/apiclient/ApiClient.kt delete mode 100644 samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/apis/paths/Anotherfakedummy.kt delete mode 100644 samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/apis/paths/Commonparamsubdir.kt delete mode 100644 samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/apis/paths/Fake.kt delete mode 100644 samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/apis/paths/Fakeadditionalpropertieswitharrayofenums.kt delete mode 100644 samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/apis/paths/Fakebodywithfileschema.kt delete mode 100644 samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/apis/paths/Fakebodywithqueryparams.kt delete mode 100644 samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/apis/paths/Fakecasesensitiveparams.kt delete mode 100644 samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/apis/paths/Fakeclassnametest.kt delete mode 100644 samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/apis/paths/Fakedeletecoffeeid.kt delete mode 100644 samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/apis/paths/Fakehealth.kt delete mode 100644 samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/apis/paths/Fakeinlineadditionalproperties.kt delete mode 100644 samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/apis/paths/Fakeinlinecomposition.kt delete mode 100644 samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/apis/paths/Fakejsonformdata.kt delete mode 100644 samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/apis/paths/Fakejsonpatch.kt delete mode 100644 samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/apis/paths/Fakejsonwithcharset.kt delete mode 100644 samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/apis/paths/Fakemultiplerequestbodycontenttypes.kt delete mode 100644 samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/apis/paths/Fakemultipleresponsebodies.kt delete mode 100644 samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/apis/paths/Fakemultiplesecurities.kt delete mode 100644 samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/apis/paths/Fakeobjinquery.kt delete mode 100644 samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/apis/paths/Fakeparametercollisions1ababselfab.kt delete mode 100644 samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/apis/paths/Fakepemcontenttype.kt delete mode 100644 samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/apis/paths/Fakepetiduploadimagewithrequiredfile.kt delete mode 100644 samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/apis/paths/Fakequeryparamwithjsoncontenttype.kt delete mode 100644 samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/apis/paths/Fakeredirection.kt delete mode 100644 samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/apis/paths/Fakerefobjinquery.kt delete mode 100644 samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/apis/paths/Fakerefsarraymodel.kt delete mode 100644 samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/apis/paths/Fakerefsarrayofenums.kt delete mode 100644 samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/apis/paths/Fakerefsboolean.kt delete mode 100644 samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/apis/paths/Fakerefscomposedoneofnumberwithvalidations.kt delete mode 100644 samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/apis/paths/Fakerefsenum.kt delete mode 100644 samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/apis/paths/Fakerefsmammal.kt delete mode 100644 samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/apis/paths/Fakerefsnumber.kt delete mode 100644 samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/apis/paths/Fakerefsobjectmodelwithrefprops.kt delete mode 100644 samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/apis/paths/Fakerefsstring.kt delete mode 100644 samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/apis/paths/Fakeresponsewithoutschema.kt delete mode 100644 samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/apis/paths/Faketestqueryparamters.kt delete mode 100644 samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/apis/paths/Fakeuploaddownloadfile.kt delete mode 100644 samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/apis/paths/Fakeuploadfile.kt delete mode 100644 samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/apis/paths/Fakeuploadfiles.kt delete mode 100644 samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/apis/paths/Fakewildcardresponses.kt delete mode 100644 samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/apis/paths/Foo.kt delete mode 100644 samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/apis/paths/Pet.kt delete mode 100644 samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/apis/paths/Petfindbystatus.kt delete mode 100644 samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/apis/paths/Petfindbytags.kt delete mode 100644 samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/apis/paths/Petpetid.kt delete mode 100644 samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/apis/paths/Petpetiduploadimage.kt delete mode 100644 samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/apis/paths/Solidus.kt delete mode 100644 samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/apis/paths/Storeinventory.kt delete mode 100644 samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/apis/paths/Storeorder.kt delete mode 100644 samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/apis/paths/Storeorderorderid.kt delete mode 100644 samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/apis/paths/User.kt delete mode 100644 samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/apis/paths/Usercreatewitharray.kt delete mode 100644 samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/apis/paths/Usercreatewithlist.kt delete mode 100644 samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/apis/paths/Userlogin.kt delete mode 100644 samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/apis/paths/Userlogout.kt delete mode 100644 samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/apis/paths/Userusername.kt delete mode 100644 samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/apis/tags/Anotherfake.kt delete mode 100644 samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/apis/tags/Default.kt delete mode 100644 samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/apis/tags/Fake.kt delete mode 100644 samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/apis/tags/Fakeclassnametags123.kt delete mode 100644 samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/apis/tags/Pet.kt delete mode 100644 samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/apis/tags/Store.kt delete mode 100644 samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/apis/tags/User.kt delete mode 100644 samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/headers/Int32JsonContentTypeHeader.kt delete mode 100644 samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/headers/NumberHeader.kt delete mode 100644 samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/headers/RefContentSchemaHeader.kt delete mode 100644 samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/headers/RefSchemaHeader.kt delete mode 100644 samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/headers/RefStringHeader.kt delete mode 100644 samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/headers/StringHeader.kt delete mode 100644 samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/headers/int32jsoncontenttypeheader/content/applicationjson/Int32JsonContentTypeHeaderSchema.kt delete mode 100644 samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/headers/numberheader/NumberHeaderSchema.kt delete mode 100644 samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/headers/refcontentschemaheader/content/applicationjson/RefContentSchemaHeaderSchema.kt delete mode 100644 samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/headers/refschemaheader/RefSchemaHeaderSchema.kt delete mode 100644 samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/headers/stringheader/StringHeaderSchema.kt delete mode 100644 samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/parameters/ComponentRefSchemaStringWithValidation.kt delete mode 100644 samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/parameters/PathUserName.kt delete mode 100644 samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/parameters/RefPathUserName.kt delete mode 100644 samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/parameters/RefSchemaStringWithValidation.kt delete mode 100644 samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/parameters/componentrefschemastringwithvalidation/content/applicationjson/ApplicationjsonSchema.kt delete mode 100644 samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/parameters/pathusername/Schema.kt delete mode 100644 samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/parameters/refschemastringwithvalidation/Schema.kt delete mode 100644 samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/requestbodies/Client.kt delete mode 100644 samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/requestbodies/Pet.kt delete mode 100644 samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/requestbodies/RefUserArray.kt delete mode 100644 samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/requestbodies/UserArray.kt delete mode 100644 samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/requestbodies/client/content/applicationjson/ApplicationjsonSchema.kt delete mode 100644 samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/requestbodies/pet/content/applicationjson/ApplicationjsonSchema.kt delete mode 100644 samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/requestbodies/pet/content/applicationxml/ApplicationxmlSchema.kt delete mode 100644 samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/requestbodies/userarray/content/applicationjson/ApplicationjsonSchema.kt delete mode 100644 samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/responses/HeadersWithNoBody.kt delete mode 100644 samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/responses/RefSuccessDescriptionOnly.kt delete mode 100644 samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/responses/RefSuccessfulXmlAndJsonArrayOfPet.kt delete mode 100644 samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/responses/SuccessDescriptionOnly.kt delete mode 100644 samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/responses/SuccessInlineContentAndHeader.kt delete mode 100644 samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/responses/SuccessWithJsonApiResponse.kt delete mode 100644 samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/responses/SuccessfulXmlAndJsonArrayOfPet.kt delete mode 100644 samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/responses/headerswithnobody/Headers.kt delete mode 100644 samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/responses/headerswithnobody/HeadersWithNoBodyHeadersSchema.kt delete mode 100644 samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/responses/headerswithnobody/headers/Location.kt delete mode 100644 samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/responses/headerswithnobody/headers/location/LocationSchema.kt delete mode 100644 samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/responses/successfulxmlandjsonarrayofpet/content/applicationjson/ApplicationjsonSchema.kt delete mode 100644 samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/responses/successfulxmlandjsonarrayofpet/content/applicationxml/ApplicationxmlSchema.kt delete mode 100644 samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/responses/successinlinecontentandheader/Headers.kt delete mode 100644 samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/responses/successinlinecontentandheader/SuccessInlineContentAndHeaderHeadersSchema.kt delete mode 100644 samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/responses/successinlinecontentandheader/content/applicationjson/ApplicationjsonSchema.kt delete mode 100644 samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/responses/successinlinecontentandheader/headers/SomeHeader.kt delete mode 100644 samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/responses/successinlinecontentandheader/headers/someheader/SomeHeaderSchema.kt delete mode 100644 samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/responses/successwithjsonapiresponse/Headers.kt delete mode 100644 samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/responses/successwithjsonapiresponse/SuccessWithJsonApiResponseHeadersSchema.kt delete mode 100644 samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/responses/successwithjsonapiresponse/content/applicationjson/ApplicationjsonSchema.kt delete mode 100644 samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/responses/successwithjsonapiresponse/headers/Int32.kt delete mode 100644 samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/responses/successwithjsonapiresponse/headers/NumberHeader.kt delete mode 100644 samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/responses/successwithjsonapiresponse/headers/Refcontentschemaheader.kt delete mode 100644 samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/responses/successwithjsonapiresponse/headers/Refschemaheader.kt delete mode 100644 samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/responses/successwithjsonapiresponse/headers/StringHeader.kt delete mode 100644 samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/schemas/AbstractStepMessage.kt delete mode 100644 samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/schemas/AdditionalPropertiesClass.kt delete mode 100644 samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/schemas/AdditionalPropertiesSchema.kt delete mode 100644 samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/schemas/AdditionalPropertiesWithArrayOfEnums.kt delete mode 100644 samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/schemas/Address.kt delete mode 100644 samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/schemas/Animal.kt delete mode 100644 samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/schemas/AnimalFarm.kt delete mode 100644 samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/schemas/AnyTypeAndFormat.kt delete mode 100644 samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/schemas/AnyTypeNotString.kt delete mode 100644 samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/schemas/ApiResponseSchema.kt delete mode 100644 samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/schemas/Apple.kt delete mode 100644 samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/schemas/AppleReq.kt delete mode 100644 samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/schemas/ArrayHoldingAnyType.kt delete mode 100644 samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/schemas/ArrayOfArrayOfNumberOnly.kt delete mode 100644 samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/schemas/ArrayOfEnums.kt delete mode 100644 samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/schemas/ArrayOfNumberOnly.kt delete mode 100644 samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/schemas/ArrayTest.kt delete mode 100644 samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/schemas/ArrayWithValidationsInItems.kt delete mode 100644 samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/schemas/Banana.kt delete mode 100644 samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/schemas/BananaReq.kt delete mode 100644 samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/schemas/Bar.kt delete mode 100644 samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/schemas/BasquePig.kt delete mode 100644 samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/schemas/BooleanEnum.kt delete mode 100644 samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/schemas/BooleanSchema.kt delete mode 100644 samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/schemas/Capitalization.kt delete mode 100644 samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/schemas/Cat.kt delete mode 100644 samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/schemas/Category.kt delete mode 100644 samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/schemas/ChildCat.kt delete mode 100644 samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/schemas/ClassModel.kt delete mode 100644 samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/schemas/Client.kt delete mode 100644 samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/schemas/ComplexQuadrilateral.kt delete mode 100644 samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/schemas/ComposedAnyOfDifferentTypesNoValidations.kt delete mode 100644 samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/schemas/ComposedArray.kt delete mode 100644 samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/schemas/ComposedBool.kt delete mode 100644 samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/schemas/ComposedNone.kt delete mode 100644 samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/schemas/ComposedNumber.kt delete mode 100644 samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/schemas/ComposedObject.kt delete mode 100644 samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/schemas/ComposedOneOfDifferentTypes.kt delete mode 100644 samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/schemas/ComposedString.kt delete mode 100644 samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/schemas/Currency.kt delete mode 100644 samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/schemas/DanishPig.kt delete mode 100644 samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/schemas/DateTimeTest.kt delete mode 100644 samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/schemas/DateTimeWithValidations.kt delete mode 100644 samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/schemas/DateWithValidations.kt delete mode 100644 samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/schemas/DecimalPayload.kt delete mode 100644 samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/schemas/Dog.kt delete mode 100644 samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/schemas/Drawing.kt delete mode 100644 samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/schemas/EnumArrays.kt delete mode 100644 samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/schemas/EnumClass.kt delete mode 100644 samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/schemas/EnumTest.kt delete mode 100644 samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/schemas/EquilateralTriangle.kt delete mode 100644 samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/schemas/File.kt delete mode 100644 samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/schemas/FileSchemaTestClass.kt delete mode 100644 samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/schemas/Foo.kt delete mode 100644 samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/schemas/FormatTest.kt delete mode 100644 samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/schemas/FromSchema.kt delete mode 100644 samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/schemas/Fruit.kt delete mode 100644 samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/schemas/FruitReq.kt delete mode 100644 samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/schemas/GmFruit.kt delete mode 100644 samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/schemas/GrandparentAnimal.kt delete mode 100644 samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/schemas/HasOnlyReadOnly.kt delete mode 100644 samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/schemas/HealthCheckResult.kt delete mode 100644 samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/schemas/IntegerEnum.kt delete mode 100644 samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/schemas/IntegerEnumBig.kt delete mode 100644 samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/schemas/IntegerEnumOneValue.kt delete mode 100644 samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/schemas/IntegerEnumWithDefaultValue.kt delete mode 100644 samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/schemas/IntegerMax10.kt delete mode 100644 samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/schemas/IntegerMin15.kt delete mode 100644 samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/schemas/IsoscelesTriangle.kt delete mode 100644 samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/schemas/Items.kt delete mode 100644 samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/schemas/ItemsSchema.kt delete mode 100644 samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/schemas/JSONPatchRequest.kt delete mode 100644 samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/schemas/JSONPatchRequestAddReplaceTest.kt delete mode 100644 samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/schemas/JSONPatchRequestMoveCopy.kt delete mode 100644 samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/schemas/JSONPatchRequestRemove.kt delete mode 100644 samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/schemas/Mammal.kt delete mode 100644 samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/schemas/MapTest.kt delete mode 100644 samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/schemas/MixedPropertiesAndAdditionalPropertiesClass.kt delete mode 100644 samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/schemas/Money.kt delete mode 100644 samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/schemas/MultiPropertiesSchema.kt delete mode 100644 samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/schemas/MyObjectDto.kt delete mode 100644 samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/schemas/Name.kt delete mode 100644 samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/schemas/NoAdditionalProperties.kt delete mode 100644 samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/schemas/NullableClass.kt delete mode 100644 samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/schemas/NullableShape.kt delete mode 100644 samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/schemas/NullableString.kt delete mode 100644 samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/schemas/NumberOnly.kt delete mode 100644 samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/schemas/NumberSchema.kt delete mode 100644 samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/schemas/NumberWithExclusiveMinMax.kt delete mode 100644 samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/schemas/NumberWithValidations.kt delete mode 100644 samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/schemas/ObjWithRequiredProps.kt delete mode 100644 samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/schemas/ObjWithRequiredPropsBase.kt delete mode 100644 samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/schemas/ObjectInterface.kt delete mode 100644 samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/schemas/ObjectModelWithArgAndArgsProperties.kt delete mode 100644 samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/schemas/ObjectModelWithRefProps.kt delete mode 100644 samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/schemas/ObjectWithAllOfWithReqTestPropFromUnsetAddProp.kt delete mode 100644 samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/schemas/ObjectWithCollidingProperties.kt delete mode 100644 samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/schemas/ObjectWithDecimalProperties.kt delete mode 100644 samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/schemas/ObjectWithDifficultlyNamedProps.kt delete mode 100644 samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/schemas/ObjectWithInlineCompositionProperty.kt delete mode 100644 samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/schemas/ObjectWithInvalidNamedRefedProperties.kt delete mode 100644 samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/schemas/ObjectWithNonIntersectingValues.kt delete mode 100644 samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/schemas/ObjectWithOnlyOptionalProps.kt delete mode 100644 samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/schemas/ObjectWithOptionalTestProp.kt delete mode 100644 samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/schemas/ObjectWithValidations.kt delete mode 100644 samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/schemas/Order.kt delete mode 100644 samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/schemas/PaginatedResultMyObjectDto.kt delete mode 100644 samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/schemas/ParentPet.kt delete mode 100644 samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/schemas/Pet.kt delete mode 100644 samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/schemas/Pig.kt delete mode 100644 samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/schemas/Player.kt delete mode 100644 samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/schemas/PublicKey.kt delete mode 100644 samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/schemas/Quadrilateral.kt delete mode 100644 samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/schemas/QuadrilateralInterface.kt delete mode 100644 samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/schemas/ReadOnlyFirst.kt delete mode 100644 samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/schemas/RefPet.kt delete mode 100644 samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/schemas/ReqPropsFromExplicitAddProps.kt delete mode 100644 samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/schemas/ReqPropsFromTrueAddProps.kt delete mode 100644 samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/schemas/ReqPropsFromUnsetAddProps.kt delete mode 100644 samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/schemas/ReturnSchema.kt delete mode 100644 samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/schemas/ScaleneTriangle.kt delete mode 100644 samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/schemas/Schema200Response.kt delete mode 100644 samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/schemas/SelfReferencingArrayModel.kt delete mode 100644 samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/schemas/SelfReferencingObjectModel.kt delete mode 100644 samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/schemas/Shape.kt delete mode 100644 samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/schemas/ShapeOrNull.kt delete mode 100644 samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/schemas/SimpleQuadrilateral.kt delete mode 100644 samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/schemas/SomeObject.kt delete mode 100644 samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/schemas/SpecialModelname.kt delete mode 100644 samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/schemas/StringBooleanMap.kt delete mode 100644 samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/schemas/StringEnum.kt delete mode 100644 samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/schemas/StringEnumWithDefaultValue.kt delete mode 100644 samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/schemas/StringSchema.kt delete mode 100644 samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/schemas/StringWithValidation.kt delete mode 100644 samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/schemas/Tag.kt delete mode 100644 samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/schemas/Triangle.kt delete mode 100644 samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/schemas/TriangleInterface.kt delete mode 100644 samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/schemas/UUIDString.kt delete mode 100644 samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/schemas/User.kt delete mode 100644 samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/schemas/Whale.kt delete mode 100644 samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/schemas/Zebra.kt delete mode 100644 samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/securityschemes/ApiKey.kt delete mode 100644 samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/securityschemes/ApiKeyQuery.kt delete mode 100644 samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/securityschemes/BearerTest.kt delete mode 100644 samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/securityschemes/HttpBasicTest.kt delete mode 100644 samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/securityschemes/HttpSignatureTest.kt delete mode 100644 samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/securityschemes/OpenIdConnectTest.kt delete mode 100644 samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/securityschemes/PetstoreAuth.kt delete mode 100644 samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/configurations/ApiConfiguration.kt delete mode 100644 samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/configurations/SchemaConfiguration.kt delete mode 100644 samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/contenttype/ContentTypeDeserializer.kt delete mode 100644 samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/contenttype/ContentTypeDetector.kt delete mode 100644 samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/contenttype/ContentTypeSerializer.kt delete mode 100644 samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/exceptions/ApiException.kt delete mode 100644 samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/exceptions/BaseException.kt delete mode 100644 samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/exceptions/NotImplementedException.kt delete mode 100644 samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/exceptions/UnsetPropertyException.kt delete mode 100644 samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/exceptions/ValidationException.kt delete mode 100644 samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/header/ContentHeader.kt delete mode 100644 samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/header/Header.kt delete mode 100644 samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/header/HeaderBase.kt delete mode 100644 samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/header/PrefixSeparatorIterator.kt delete mode 100644 samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/header/Rfc6570Serializer.kt delete mode 100644 samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/header/SchemaHeader.kt delete mode 100644 samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/header/StyleSerializer.kt delete mode 100644 samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/mediatype/Encoding.kt delete mode 100644 samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/mediatype/MediaType.kt delete mode 100644 samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/parameter/ContentParameter.kt delete mode 100644 samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/parameter/CookieSerializer.kt delete mode 100644 samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/parameter/HeadersSerializer.kt delete mode 100644 samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/parameter/Parameter.kt delete mode 100644 samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/parameter/ParameterBase.kt delete mode 100644 samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/parameter/ParameterInType.kt delete mode 100644 samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/parameter/ParameterStyle.kt delete mode 100644 samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/parameter/PathSerializer.kt delete mode 100644 samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/parameter/QuerySerializer.kt delete mode 100644 samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/parameter/SchemaParameter.kt delete mode 100644 samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/Anotherfakedummy.kt delete mode 100644 samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/Commonparamsubdir.kt delete mode 100644 samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/Fake.kt delete mode 100644 samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/Fakeadditionalpropertieswitharrayofenums.kt delete mode 100644 samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/Fakebodywithfileschema.kt delete mode 100644 samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/Fakebodywithqueryparams.kt delete mode 100644 samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/Fakecasesensitiveparams.kt delete mode 100644 samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/Fakeclassnametest.kt delete mode 100644 samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/Fakedeletecoffeeid.kt delete mode 100644 samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/Fakehealth.kt delete mode 100644 samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/Fakeinlineadditionalproperties.kt delete mode 100644 samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/Fakeinlinecomposition.kt delete mode 100644 samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/Fakejsonformdata.kt delete mode 100644 samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/Fakejsonpatch.kt delete mode 100644 samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/Fakejsonwithcharset.kt delete mode 100644 samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/Fakemultiplerequestbodycontenttypes.kt delete mode 100644 samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/Fakemultipleresponsebodies.kt delete mode 100644 samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/Fakemultiplesecurities.kt delete mode 100644 samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/Fakeobjinquery.kt delete mode 100644 samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/Fakeparametercollisions1ababselfab.kt delete mode 100644 samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/Fakepemcontenttype.kt delete mode 100644 samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/Fakepetiduploadimagewithrequiredfile.kt delete mode 100644 samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/Fakequeryparamwithjsoncontenttype.kt delete mode 100644 samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/Fakeredirection.kt delete mode 100644 samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/Fakerefobjinquery.kt delete mode 100644 samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/Fakerefsarraymodel.kt delete mode 100644 samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/Fakerefsarrayofenums.kt delete mode 100644 samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/Fakerefsboolean.kt delete mode 100644 samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/Fakerefscomposedoneofnumberwithvalidations.kt delete mode 100644 samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/Fakerefsenum.kt delete mode 100644 samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/Fakerefsmammal.kt delete mode 100644 samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/Fakerefsnumber.kt delete mode 100644 samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/Fakerefsobjectmodelwithrefprops.kt delete mode 100644 samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/Fakerefsstring.kt delete mode 100644 samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/Fakeresponsewithoutschema.kt delete mode 100644 samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/Faketestqueryparamters.kt delete mode 100644 samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/Fakeuploaddownloadfile.kt delete mode 100644 samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/Fakeuploadfile.kt delete mode 100644 samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/Fakeuploadfiles.kt delete mode 100644 samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/Fakewildcardresponses.kt delete mode 100644 samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/Foo.kt delete mode 100644 samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/Pet.kt delete mode 100644 samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/Petfindbystatus.kt delete mode 100644 samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/Petfindbytags.kt delete mode 100644 samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/Petpetid.kt delete mode 100644 samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/Petpetiduploadimage.kt delete mode 100644 samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/Solidus.kt delete mode 100644 samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/Storeinventory.kt delete mode 100644 samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/Storeorder.kt delete mode 100644 samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/Storeorderorderid.kt delete mode 100644 samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/User.kt delete mode 100644 samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/Usercreatewitharray.kt delete mode 100644 samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/Usercreatewithlist.kt delete mode 100644 samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/Userlogin.kt delete mode 100644 samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/Userlogout.kt delete mode 100644 samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/Userusername.kt delete mode 100644 samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/anotherfakedummy/AnotherfakedummyPatch.kt delete mode 100644 samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/anotherfakedummy/patch/AnotherfakedummyPatchRequestBody.kt delete mode 100644 samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/anotherfakedummy/patch/AnotherfakedummyPatchResponses.kt delete mode 100644 samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/anotherfakedummy/patch/responses/AnotherfakedummyPatchCode200Response.kt delete mode 100644 samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/anotherfakedummy/patch/responses/code200response/content/applicationjson/ApplicationjsonSchema.kt delete mode 100644 samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/commonparamsubdir/CommonparamsubdirDelete.kt delete mode 100644 samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/commonparamsubdir/CommonparamsubdirGet.kt delete mode 100644 samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/commonparamsubdir/CommonparamsubdirPost.kt delete mode 100644 samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/commonparamsubdir/delete/CommonparamsubdirDeleteHeaderParameters.kt delete mode 100644 samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/commonparamsubdir/delete/CommonparamsubdirDeletePathParameters.kt delete mode 100644 samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/commonparamsubdir/delete/CommonparamsubdirDeleteResponses.kt delete mode 100644 samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/commonparamsubdir/delete/Parameters.kt delete mode 100644 samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/commonparamsubdir/delete/parameters/Parameter0.kt delete mode 100644 samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/commonparamsubdir/delete/parameters/Parameter1.kt delete mode 100644 samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/commonparamsubdir/delete/parameters/parameter0/Schema0.kt delete mode 100644 samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/commonparamsubdir/delete/parameters/parameter1/Schema1.kt delete mode 100644 samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/commonparamsubdir/delete/responses/CommonparamsubdirDeleteCode200Response.kt delete mode 100644 samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/commonparamsubdir/get/CommonparamsubdirGetPathParameters.kt delete mode 100644 samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/commonparamsubdir/get/CommonparamsubdirGetQueryParameters.kt delete mode 100644 samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/commonparamsubdir/get/CommonparamsubdirGetResponses.kt delete mode 100644 samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/commonparamsubdir/get/Parameters.kt delete mode 100644 samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/commonparamsubdir/get/parameters/Parameter0.kt delete mode 100644 samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/commonparamsubdir/get/parameters/parameter0/Schema0.kt delete mode 100644 samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/commonparamsubdir/get/responses/CommonparamsubdirGetCode200Response.kt delete mode 100644 samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/commonparamsubdir/parameters/RouteParameter0.kt delete mode 100644 samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/commonparamsubdir/parameters/routeparameter0/RouteParamSchema0.kt delete mode 100644 samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/commonparamsubdir/post/CommonparamsubdirPostHeaderParameters.kt delete mode 100644 samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/commonparamsubdir/post/CommonparamsubdirPostPathParameters.kt delete mode 100644 samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/commonparamsubdir/post/CommonparamsubdirPostResponses.kt delete mode 100644 samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/commonparamsubdir/post/Parameters.kt delete mode 100644 samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/commonparamsubdir/post/parameters/Parameter0.kt delete mode 100644 samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/commonparamsubdir/post/parameters/parameter0/Schema0.kt delete mode 100644 samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/commonparamsubdir/post/responses/CommonparamsubdirPostCode200Response.kt delete mode 100644 samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/fake/FakeDelete.kt delete mode 100644 samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/fake/FakeGet.kt delete mode 100644 samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/fake/FakePatch.kt delete mode 100644 samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/fake/FakePost.kt delete mode 100644 samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/fake/delete/FakeDeleteHeaderParameters.kt delete mode 100644 samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/fake/delete/FakeDeleteQueryParameters.kt delete mode 100644 samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/fake/delete/FakeDeleteResponses.kt delete mode 100644 samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/fake/delete/FakeDeleteSecurityInfo.kt delete mode 100644 samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/fake/delete/Parameters.kt delete mode 100644 samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/fake/delete/parameters/Parameter0.kt delete mode 100644 samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/fake/delete/parameters/Parameter1.kt delete mode 100644 samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/fake/delete/parameters/Parameter2.kt delete mode 100644 samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/fake/delete/parameters/Parameter3.kt delete mode 100644 samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/fake/delete/parameters/Parameter4.kt delete mode 100644 samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/fake/delete/parameters/Parameter5.kt delete mode 100644 samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/fake/delete/parameters/parameter0/Schema0.kt delete mode 100644 samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/fake/delete/parameters/parameter1/Schema1.kt delete mode 100644 samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/fake/delete/parameters/parameter2/Schema2.kt delete mode 100644 samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/fake/delete/parameters/parameter3/Schema3.kt delete mode 100644 samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/fake/delete/parameters/parameter4/Schema4.kt delete mode 100644 samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/fake/delete/parameters/parameter5/Schema5.kt delete mode 100644 samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/fake/delete/responses/FakeDeleteCode200Response.kt delete mode 100644 samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/fake/delete/security/FakeDeleteSecurityRequirementObject0.kt delete mode 100644 samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/fake/get/FakeGetHeaderParameters.kt delete mode 100644 samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/fake/get/FakeGetQueryParameters.kt delete mode 100644 samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/fake/get/FakeGetRequestBody.kt delete mode 100644 samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/fake/get/FakeGetResponses.kt delete mode 100644 samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/fake/get/Parameters.kt delete mode 100644 samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/fake/get/parameters/Parameter0.kt delete mode 100644 samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/fake/get/parameters/Parameter1.kt delete mode 100644 samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/fake/get/parameters/Parameter2.kt delete mode 100644 samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/fake/get/parameters/Parameter3.kt delete mode 100644 samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/fake/get/parameters/Parameter4.kt delete mode 100644 samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/fake/get/parameters/Parameter5.kt delete mode 100644 samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/fake/get/parameters/parameter0/Schema0.kt delete mode 100644 samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/fake/get/parameters/parameter1/Schema1.kt delete mode 100644 samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/fake/get/parameters/parameter2/Schema2.kt delete mode 100644 samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/fake/get/parameters/parameter3/Schema3.kt delete mode 100644 samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/fake/get/parameters/parameter4/Schema4.kt delete mode 100644 samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/fake/get/parameters/parameter5/Schema5.kt delete mode 100644 samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/fake/get/requestbody/content/applicationxwwwformurlencoded/ApplicationxwwwformurlencodedSchema.kt delete mode 100644 samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/fake/get/responses/FakeGetCode200Response.kt delete mode 100644 samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/fake/get/responses/FakeGetCode404Response.kt delete mode 100644 samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/fake/get/responses/code404response/content/applicationjson/ApplicationjsonSchema.kt delete mode 100644 samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/fake/patch/FakePatchRequestBody.kt delete mode 100644 samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/fake/patch/FakePatchResponses.kt delete mode 100644 samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/fake/patch/responses/FakePatchCode200Response.kt delete mode 100644 samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/fake/patch/responses/code200response/content/applicationjson/ApplicationjsonSchema.kt delete mode 100644 samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/fake/post/FakePostRequestBody.kt delete mode 100644 samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/fake/post/FakePostResponses.kt delete mode 100644 samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/fake/post/FakePostSecurityInfo.kt delete mode 100644 samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/fake/post/requestbody/content/applicationxwwwformurlencoded/ApplicationxwwwformurlencodedSchema.kt delete mode 100644 samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/fake/post/responses/FakePostCode200Response.kt delete mode 100644 samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/fake/post/responses/FakePostCode404Response.kt delete mode 100644 samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/fake/post/security/FakePostSecurityRequirementObject0.kt delete mode 100644 samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/fakeadditionalpropertieswitharrayofenums/FakeadditionalpropertieswitharrayofenumsGet.kt delete mode 100644 samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/fakeadditionalpropertieswitharrayofenums/get/FakeadditionalpropertieswitharrayofenumsGetRequestBody.kt delete mode 100644 samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/fakeadditionalpropertieswitharrayofenums/get/FakeadditionalpropertieswitharrayofenumsGetResponses.kt delete mode 100644 samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/fakeadditionalpropertieswitharrayofenums/get/requestbody/content/applicationjson/ApplicationjsonSchema.kt delete mode 100644 samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/fakeadditionalpropertieswitharrayofenums/get/responses/FakeadditionalpropertieswitharrayofenumsGetCode200Response.kt delete mode 100644 samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/fakeadditionalpropertieswitharrayofenums/get/responses/code200response/content/applicationjson/ApplicationjsonSchema.kt delete mode 100644 samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/fakebodywithfileschema/FakebodywithfileschemaPut.kt delete mode 100644 samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/fakebodywithfileschema/put/FakebodywithfileschemaPutRequestBody.kt delete mode 100644 samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/fakebodywithfileschema/put/FakebodywithfileschemaPutResponses.kt delete mode 100644 samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/fakebodywithfileschema/put/requestbody/content/applicationjson/ApplicationjsonSchema.kt delete mode 100644 samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/fakebodywithfileschema/put/responses/FakebodywithfileschemaPutCode200Response.kt delete mode 100644 samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/fakebodywithqueryparams/FakebodywithqueryparamsPut.kt delete mode 100644 samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/fakebodywithqueryparams/put/FakebodywithqueryparamsPutQueryParameters.kt delete mode 100644 samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/fakebodywithqueryparams/put/FakebodywithqueryparamsPutRequestBody.kt delete mode 100644 samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/fakebodywithqueryparams/put/FakebodywithqueryparamsPutResponses.kt delete mode 100644 samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/fakebodywithqueryparams/put/Parameters.kt delete mode 100644 samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/fakebodywithqueryparams/put/parameters/Parameter0.kt delete mode 100644 samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/fakebodywithqueryparams/put/parameters/parameter0/Schema0.kt delete mode 100644 samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/fakebodywithqueryparams/put/requestbody/content/applicationjson/ApplicationjsonSchema.kt delete mode 100644 samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/fakebodywithqueryparams/put/responses/FakebodywithqueryparamsPutCode200Response.kt delete mode 100644 samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/fakecasesensitiveparams/FakecasesensitiveparamsPut.kt delete mode 100644 samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/fakecasesensitiveparams/put/FakecasesensitiveparamsPutQueryParameters.kt delete mode 100644 samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/fakecasesensitiveparams/put/FakecasesensitiveparamsPutResponses.kt delete mode 100644 samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/fakecasesensitiveparams/put/Parameters.kt delete mode 100644 samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/fakecasesensitiveparams/put/parameters/Parameter0.kt delete mode 100644 samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/fakecasesensitiveparams/put/parameters/Parameter1.kt delete mode 100644 samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/fakecasesensitiveparams/put/parameters/Parameter2.kt delete mode 100644 samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/fakecasesensitiveparams/put/parameters/parameter0/Schema0.kt delete mode 100644 samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/fakecasesensitiveparams/put/parameters/parameter1/Schema1.kt delete mode 100644 samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/fakecasesensitiveparams/put/parameters/parameter2/Schema2.kt delete mode 100644 samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/fakecasesensitiveparams/put/responses/FakecasesensitiveparamsPutCode200Response.kt delete mode 100644 samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/fakeclassnametest/FakeclassnametestPatch.kt delete mode 100644 samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/fakeclassnametest/patch/FakeclassnametestPatchRequestBody.kt delete mode 100644 samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/fakeclassnametest/patch/FakeclassnametestPatchResponses.kt delete mode 100644 samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/fakeclassnametest/patch/FakeclassnametestPatchSecurityInfo.kt delete mode 100644 samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/fakeclassnametest/patch/responses/FakeclassnametestPatchCode200Response.kt delete mode 100644 samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/fakeclassnametest/patch/responses/code200response/content/applicationjson/ApplicationjsonSchema.kt delete mode 100644 samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/fakeclassnametest/patch/security/FakeclassnametestPatchSecurityRequirementObject0.kt delete mode 100644 samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/fakedeletecoffeeid/FakedeletecoffeeidDelete.kt delete mode 100644 samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/fakedeletecoffeeid/delete/FakedeletecoffeeidDeletePathParameters.kt delete mode 100644 samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/fakedeletecoffeeid/delete/FakedeletecoffeeidDeleteResponses.kt delete mode 100644 samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/fakedeletecoffeeid/delete/Parameters.kt delete mode 100644 samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/fakedeletecoffeeid/delete/parameters/Parameter0.kt delete mode 100644 samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/fakedeletecoffeeid/delete/parameters/parameter0/Schema0.kt delete mode 100644 samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/fakedeletecoffeeid/delete/responses/FakedeletecoffeeidDeleteCode200Response.kt delete mode 100644 samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/fakedeletecoffeeid/delete/responses/FakedeletecoffeeidDeleteCodedefaultResponse.kt delete mode 100644 samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/fakehealth/FakehealthGet.kt delete mode 100644 samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/fakehealth/get/FakehealthGetResponses.kt delete mode 100644 samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/fakehealth/get/responses/FakehealthGetCode200Response.kt delete mode 100644 samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/fakehealth/get/responses/code200response/content/applicationjson/ApplicationjsonSchema.kt delete mode 100644 samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/fakeinlineadditionalproperties/FakeinlineadditionalpropertiesPost.kt delete mode 100644 samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/fakeinlineadditionalproperties/post/FakeinlineadditionalpropertiesPostRequestBody.kt delete mode 100644 samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/fakeinlineadditionalproperties/post/FakeinlineadditionalpropertiesPostResponses.kt delete mode 100644 samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/fakeinlineadditionalproperties/post/requestbody/content/applicationjson/ApplicationjsonSchema.kt delete mode 100644 samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/fakeinlineadditionalproperties/post/responses/FakeinlineadditionalpropertiesPostCode200Response.kt delete mode 100644 samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/fakeinlinecomposition/FakeinlinecompositionPost.kt delete mode 100644 samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/fakeinlinecomposition/post/FakeinlinecompositionPostQueryParameters.kt delete mode 100644 samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/fakeinlinecomposition/post/FakeinlinecompositionPostRequestBody.kt delete mode 100644 samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/fakeinlinecomposition/post/FakeinlinecompositionPostResponses.kt delete mode 100644 samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/fakeinlinecomposition/post/Parameters.kt delete mode 100644 samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/fakeinlinecomposition/post/parameters/Parameter0.kt delete mode 100644 samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/fakeinlinecomposition/post/parameters/Parameter1.kt delete mode 100644 samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/fakeinlinecomposition/post/parameters/parameter0/Schema0.kt delete mode 100644 samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/fakeinlinecomposition/post/parameters/parameter1/Schema1.kt delete mode 100644 samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/fakeinlinecomposition/post/requestbody/content/applicationjson/ApplicationjsonSchema.kt delete mode 100644 samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/fakeinlinecomposition/post/requestbody/content/multipartformdata/MultipartformdataSchema.kt delete mode 100644 samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/fakeinlinecomposition/post/responses/FakeinlinecompositionPostCode200Response.kt delete mode 100644 samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/fakeinlinecomposition/post/responses/code200response/content/applicationjson/ApplicationjsonSchema.kt delete mode 100644 samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/fakeinlinecomposition/post/responses/code200response/content/multipartformdata/MultipartformdataSchema.kt delete mode 100644 samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/fakejsonformdata/FakejsonformdataGet.kt delete mode 100644 samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/fakejsonformdata/get/FakejsonformdataGetRequestBody.kt delete mode 100644 samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/fakejsonformdata/get/FakejsonformdataGetResponses.kt delete mode 100644 samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/fakejsonformdata/get/requestbody/content/applicationxwwwformurlencoded/ApplicationxwwwformurlencodedSchema.kt delete mode 100644 samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/fakejsonformdata/get/responses/FakejsonformdataGetCode200Response.kt delete mode 100644 samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/fakejsonpatch/FakejsonpatchPatch.kt delete mode 100644 samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/fakejsonpatch/patch/FakejsonpatchPatchRequestBody.kt delete mode 100644 samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/fakejsonpatch/patch/FakejsonpatchPatchResponses.kt delete mode 100644 samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/fakejsonpatch/patch/requestbody/content/applicationjsonpatchjson/ApplicationjsonpatchjsonSchema.kt delete mode 100644 samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/fakejsonpatch/patch/responses/FakejsonpatchPatchCode200Response.kt delete mode 100644 samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/fakejsonwithcharset/FakejsonwithcharsetPost.kt delete mode 100644 samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/fakejsonwithcharset/post/FakejsonwithcharsetPostRequestBody.kt delete mode 100644 samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/fakejsonwithcharset/post/FakejsonwithcharsetPostResponses.kt delete mode 100644 samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/fakejsonwithcharset/post/requestbody/content/applicationjsoncharsetutf8/Applicationjsoncharsetutf8Schema.kt delete mode 100644 samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/fakejsonwithcharset/post/responses/FakejsonwithcharsetPostCode200Response.kt delete mode 100644 samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/fakejsonwithcharset/post/responses/code200response/content/applicationjsoncharsetutf8/Applicationjsoncharsetutf8Schema.kt delete mode 100644 samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/fakemultiplerequestbodycontenttypes/FakemultiplerequestbodycontenttypesPost.kt delete mode 100644 samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/fakemultiplerequestbodycontenttypes/post/FakemultiplerequestbodycontenttypesPostRequestBody.kt delete mode 100644 samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/fakemultiplerequestbodycontenttypes/post/FakemultiplerequestbodycontenttypesPostResponses.kt delete mode 100644 samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/fakemultiplerequestbodycontenttypes/post/requestbody/content/applicationjson/ApplicationjsonSchema.kt delete mode 100644 samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/fakemultiplerequestbodycontenttypes/post/requestbody/content/multipartformdata/MultipartformdataSchema.kt delete mode 100644 samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/fakemultiplerequestbodycontenttypes/post/responses/FakemultiplerequestbodycontenttypesPostCode200Response.kt delete mode 100644 samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/fakemultiplerequestbodycontenttypes/post/responses/code200response/content/applicationjson/ApplicationjsonSchema.kt delete mode 100644 samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/fakemultipleresponsebodies/FakemultipleresponsebodiesGet.kt delete mode 100644 samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/fakemultipleresponsebodies/get/FakemultipleresponsebodiesGetResponses.kt delete mode 100644 samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/fakemultipleresponsebodies/get/responses/FakemultipleresponsebodiesGetCode200Response.kt delete mode 100644 samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/fakemultipleresponsebodies/get/responses/FakemultipleresponsebodiesGetCode202Response.kt delete mode 100644 samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/fakemultipleresponsebodies/get/responses/code200response/content/applicationjson/ApplicationjsonSchema.kt delete mode 100644 samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/fakemultipleresponsebodies/get/responses/code202response/content/applicationjson/ApplicationjsonSchema.kt delete mode 100644 samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/fakemultiplesecurities/FakemultiplesecuritiesGet.kt delete mode 100644 samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/fakemultiplesecurities/get/FakemultiplesecuritiesGetResponses.kt delete mode 100644 samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/fakemultiplesecurities/get/FakemultiplesecuritiesGetSecurityInfo.kt delete mode 100644 samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/fakemultiplesecurities/get/responses/FakemultiplesecuritiesGetCode200Response.kt delete mode 100644 samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/fakemultiplesecurities/get/responses/code200response/content/applicationjson/ApplicationjsonSchema.kt delete mode 100644 samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/fakemultiplesecurities/get/security/FakemultiplesecuritiesGetSecurityRequirementObject0.kt delete mode 100644 samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/fakemultiplesecurities/get/security/FakemultiplesecuritiesGetSecurityRequirementObject1.kt delete mode 100644 samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/fakemultiplesecurities/get/security/FakemultiplesecuritiesGetSecurityRequirementObject2.kt delete mode 100644 samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/fakeobjinquery/FakeobjinqueryGet.kt delete mode 100644 samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/fakeobjinquery/get/FakeobjinqueryGetQueryParameters.kt delete mode 100644 samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/fakeobjinquery/get/FakeobjinqueryGetResponses.kt delete mode 100644 samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/fakeobjinquery/get/Parameters.kt delete mode 100644 samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/fakeobjinquery/get/parameters/Parameter0.kt delete mode 100644 samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/fakeobjinquery/get/parameters/parameter0/Schema0.kt delete mode 100644 samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/fakeobjinquery/get/responses/FakeobjinqueryGetCode200Response.kt delete mode 100644 samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/fakeparametercollisions1ababselfab/Fakeparametercollisions1ababselfabPost.kt delete mode 100644 samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/fakeparametercollisions1ababselfab/post/Fakeparametercollisions1ababselfabPostCookieParameters.kt delete mode 100644 samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/fakeparametercollisions1ababselfab/post/Fakeparametercollisions1ababselfabPostHeaderParameters.kt delete mode 100644 samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/fakeparametercollisions1ababselfab/post/Fakeparametercollisions1ababselfabPostPathParameters.kt delete mode 100644 samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/fakeparametercollisions1ababselfab/post/Fakeparametercollisions1ababselfabPostQueryParameters.kt delete mode 100644 samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/fakeparametercollisions1ababselfab/post/Fakeparametercollisions1ababselfabPostRequestBody.kt delete mode 100644 samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/fakeparametercollisions1ababselfab/post/Fakeparametercollisions1ababselfabPostResponses.kt delete mode 100644 samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/fakeparametercollisions1ababselfab/post/Parameters.kt delete mode 100644 samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/fakeparametercollisions1ababselfab/post/parameters/Parameter0.kt delete mode 100644 samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/fakeparametercollisions1ababselfab/post/parameters/Parameter1.kt delete mode 100644 samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/fakeparametercollisions1ababselfab/post/parameters/Parameter10.kt delete mode 100644 samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/fakeparametercollisions1ababselfab/post/parameters/Parameter11.kt delete mode 100644 samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/fakeparametercollisions1ababselfab/post/parameters/Parameter12.kt delete mode 100644 samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/fakeparametercollisions1ababselfab/post/parameters/Parameter13.kt delete mode 100644 samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/fakeparametercollisions1ababselfab/post/parameters/Parameter14.kt delete mode 100644 samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/fakeparametercollisions1ababselfab/post/parameters/Parameter15.kt delete mode 100644 samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/fakeparametercollisions1ababselfab/post/parameters/Parameter16.kt delete mode 100644 samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/fakeparametercollisions1ababselfab/post/parameters/Parameter17.kt delete mode 100644 samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/fakeparametercollisions1ababselfab/post/parameters/Parameter18.kt delete mode 100644 samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/fakeparametercollisions1ababselfab/post/parameters/Parameter2.kt delete mode 100644 samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/fakeparametercollisions1ababselfab/post/parameters/Parameter3.kt delete mode 100644 samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/fakeparametercollisions1ababselfab/post/parameters/Parameter4.kt delete mode 100644 samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/fakeparametercollisions1ababselfab/post/parameters/Parameter5.kt delete mode 100644 samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/fakeparametercollisions1ababselfab/post/parameters/Parameter6.kt delete mode 100644 samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/fakeparametercollisions1ababselfab/post/parameters/Parameter7.kt delete mode 100644 samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/fakeparametercollisions1ababselfab/post/parameters/Parameter8.kt delete mode 100644 samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/fakeparametercollisions1ababselfab/post/parameters/Parameter9.kt delete mode 100644 samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/fakeparametercollisions1ababselfab/post/parameters/parameter0/Schema0.kt delete mode 100644 samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/fakeparametercollisions1ababselfab/post/parameters/parameter1/Schema1.kt delete mode 100644 samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/fakeparametercollisions1ababselfab/post/parameters/parameter10/Schema10.kt delete mode 100644 samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/fakeparametercollisions1ababselfab/post/parameters/parameter11/Schema11.kt delete mode 100644 samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/fakeparametercollisions1ababselfab/post/parameters/parameter12/Schema12.kt delete mode 100644 samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/fakeparametercollisions1ababselfab/post/parameters/parameter13/Schema13.kt delete mode 100644 samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/fakeparametercollisions1ababselfab/post/parameters/parameter14/Schema14.kt delete mode 100644 samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/fakeparametercollisions1ababselfab/post/parameters/parameter15/Schema15.kt delete mode 100644 samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/fakeparametercollisions1ababselfab/post/parameters/parameter16/Schema16.kt delete mode 100644 samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/fakeparametercollisions1ababselfab/post/parameters/parameter17/Schema17.kt delete mode 100644 samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/fakeparametercollisions1ababselfab/post/parameters/parameter18/Schema18.kt delete mode 100644 samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/fakeparametercollisions1ababselfab/post/parameters/parameter2/Schema2.kt delete mode 100644 samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/fakeparametercollisions1ababselfab/post/parameters/parameter3/Schema3.kt delete mode 100644 samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/fakeparametercollisions1ababselfab/post/parameters/parameter4/Schema4.kt delete mode 100644 samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/fakeparametercollisions1ababselfab/post/parameters/parameter5/Schema5.kt delete mode 100644 samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/fakeparametercollisions1ababselfab/post/parameters/parameter6/Schema6.kt delete mode 100644 samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/fakeparametercollisions1ababselfab/post/parameters/parameter7/Schema7.kt delete mode 100644 samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/fakeparametercollisions1ababselfab/post/parameters/parameter8/Schema8.kt delete mode 100644 samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/fakeparametercollisions1ababselfab/post/parameters/parameter9/Schema9.kt delete mode 100644 samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/fakeparametercollisions1ababselfab/post/requestbody/content/applicationjson/ApplicationjsonSchema.kt delete mode 100644 samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/fakeparametercollisions1ababselfab/post/responses/Fakeparametercollisions1ababselfabPostCode200Response.kt delete mode 100644 samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/fakeparametercollisions1ababselfab/post/responses/code200response/content/applicationjson/ApplicationjsonSchema.kt delete mode 100644 samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/fakepemcontenttype/FakepemcontenttypeGet.kt delete mode 100644 samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/fakepemcontenttype/get/FakepemcontenttypeGetRequestBody.kt delete mode 100644 samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/fakepemcontenttype/get/FakepemcontenttypeGetResponses.kt delete mode 100644 samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/fakepemcontenttype/get/requestbody/content/applicationxpemfile/ApplicationxpemfileSchema.kt delete mode 100644 samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/fakepemcontenttype/get/responses/FakepemcontenttypeGetCode200Response.kt delete mode 100644 samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/fakepemcontenttype/get/responses/code200response/content/applicationxpemfile/ApplicationxpemfileSchema.kt delete mode 100644 samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/fakepetiduploadimagewithrequiredfile/FakepetiduploadimagewithrequiredfilePost.kt delete mode 100644 samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/fakepetiduploadimagewithrequiredfile/post/FakepetiduploadimagewithrequiredfilePostPathParameters.kt delete mode 100644 samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/fakepetiduploadimagewithrequiredfile/post/FakepetiduploadimagewithrequiredfilePostRequestBody.kt delete mode 100644 samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/fakepetiduploadimagewithrequiredfile/post/FakepetiduploadimagewithrequiredfilePostResponses.kt delete mode 100644 samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/fakepetiduploadimagewithrequiredfile/post/FakepetiduploadimagewithrequiredfilePostSecurityInfo.kt delete mode 100644 samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/fakepetiduploadimagewithrequiredfile/post/Parameters.kt delete mode 100644 samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/fakepetiduploadimagewithrequiredfile/post/parameters/Parameter0.kt delete mode 100644 samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/fakepetiduploadimagewithrequiredfile/post/parameters/parameter0/Schema0.kt delete mode 100644 samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/fakepetiduploadimagewithrequiredfile/post/requestbody/content/multipartformdata/MultipartformdataSchema.kt delete mode 100644 samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/fakepetiduploadimagewithrequiredfile/post/responses/FakepetiduploadimagewithrequiredfilePostCode200Response.kt delete mode 100644 samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/fakepetiduploadimagewithrequiredfile/post/responses/code200response/content/applicationjson/ApplicationjsonSchema.kt delete mode 100644 samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/fakepetiduploadimagewithrequiredfile/post/security/FakepetiduploadimagewithrequiredfilePostSecurityRequirementObject0.kt delete mode 100644 samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/fakequeryparamwithjsoncontenttype/FakequeryparamwithjsoncontenttypeGet.kt delete mode 100644 samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/fakequeryparamwithjsoncontenttype/get/FakequeryparamwithjsoncontenttypeGetQueryParameters.kt delete mode 100644 samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/fakequeryparamwithjsoncontenttype/get/FakequeryparamwithjsoncontenttypeGetResponses.kt delete mode 100644 samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/fakequeryparamwithjsoncontenttype/get/Parameters.kt delete mode 100644 samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/fakequeryparamwithjsoncontenttype/get/parameters/Parameter0.kt delete mode 100644 samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/fakequeryparamwithjsoncontenttype/get/parameters/parameter0/content/applicationjson/Schema0.kt delete mode 100644 samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/fakequeryparamwithjsoncontenttype/get/responses/FakequeryparamwithjsoncontenttypeGetCode200Response.kt delete mode 100644 samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/fakequeryparamwithjsoncontenttype/get/responses/code200response/content/applicationjson/ApplicationjsonSchema.kt delete mode 100644 samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/fakeredirection/FakeredirectionGet.kt delete mode 100644 samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/fakeredirection/get/FakeredirectionGetResponses.kt delete mode 100644 samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/fakeredirection/get/responses/FakeredirectionGetCode303Response.kt delete mode 100644 samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/fakeredirection/get/responses/FakeredirectionGetCode3XXResponse.kt delete mode 100644 samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/fakerefobjinquery/FakerefobjinqueryGet.kt delete mode 100644 samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/fakerefobjinquery/get/FakerefobjinqueryGetQueryParameters.kt delete mode 100644 samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/fakerefobjinquery/get/FakerefobjinqueryGetResponses.kt delete mode 100644 samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/fakerefobjinquery/get/Parameters.kt delete mode 100644 samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/fakerefobjinquery/get/parameters/Parameter0.kt delete mode 100644 samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/fakerefobjinquery/get/parameters/parameter0/Schema0.kt delete mode 100644 samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/fakerefobjinquery/get/responses/FakerefobjinqueryGetCode200Response.kt delete mode 100644 samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/fakerefsarraymodel/FakerefsarraymodelPost.kt delete mode 100644 samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/fakerefsarraymodel/post/FakerefsarraymodelPostRequestBody.kt delete mode 100644 samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/fakerefsarraymodel/post/FakerefsarraymodelPostResponses.kt delete mode 100644 samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/fakerefsarraymodel/post/requestbody/content/applicationjson/ApplicationjsonSchema.kt delete mode 100644 samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/fakerefsarraymodel/post/responses/FakerefsarraymodelPostCode200Response.kt delete mode 100644 samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/fakerefsarraymodel/post/responses/code200response/content/applicationjson/ApplicationjsonSchema.kt delete mode 100644 samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/fakerefsarrayofenums/FakerefsarrayofenumsPost.kt delete mode 100644 samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/fakerefsarrayofenums/post/FakerefsarrayofenumsPostRequestBody.kt delete mode 100644 samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/fakerefsarrayofenums/post/FakerefsarrayofenumsPostResponses.kt delete mode 100644 samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/fakerefsarrayofenums/post/requestbody/content/applicationjson/ApplicationjsonSchema.kt delete mode 100644 samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/fakerefsarrayofenums/post/responses/FakerefsarrayofenumsPostCode200Response.kt delete mode 100644 samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/fakerefsarrayofenums/post/responses/code200response/content/applicationjson/ApplicationjsonSchema.kt delete mode 100644 samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/fakerefsboolean/FakerefsbooleanPost.kt delete mode 100644 samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/fakerefsboolean/post/FakerefsbooleanPostRequestBody.kt delete mode 100644 samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/fakerefsboolean/post/FakerefsbooleanPostResponses.kt delete mode 100644 samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/fakerefsboolean/post/requestbody/content/applicationjson/ApplicationjsonSchema.kt delete mode 100644 samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/fakerefsboolean/post/responses/FakerefsbooleanPostCode200Response.kt delete mode 100644 samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/fakerefsboolean/post/responses/code200response/content/applicationjson/ApplicationjsonSchema.kt delete mode 100644 samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/fakerefscomposedoneofnumberwithvalidations/FakerefscomposedoneofnumberwithvalidationsPost.kt delete mode 100644 samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/fakerefscomposedoneofnumberwithvalidations/post/FakerefscomposedoneofnumberwithvalidationsPostRequestBody.kt delete mode 100644 samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/fakerefscomposedoneofnumberwithvalidations/post/FakerefscomposedoneofnumberwithvalidationsPostResponses.kt delete mode 100644 samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/fakerefscomposedoneofnumberwithvalidations/post/requestbody/content/applicationjson/ApplicationjsonSchema.kt delete mode 100644 samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/fakerefscomposedoneofnumberwithvalidations/post/responses/FakerefscomposedoneofnumberwithvalidationsPostCode200Response.kt delete mode 100644 samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/fakerefscomposedoneofnumberwithvalidations/post/responses/code200response/content/applicationjson/ApplicationjsonSchema.kt delete mode 100644 samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/fakerefsenum/FakerefsenumPost.kt delete mode 100644 samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/fakerefsenum/post/FakerefsenumPostRequestBody.kt delete mode 100644 samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/fakerefsenum/post/FakerefsenumPostResponses.kt delete mode 100644 samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/fakerefsenum/post/requestbody/content/applicationjson/ApplicationjsonSchema.kt delete mode 100644 samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/fakerefsenum/post/responses/FakerefsenumPostCode200Response.kt delete mode 100644 samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/fakerefsenum/post/responses/code200response/content/applicationjson/ApplicationjsonSchema.kt delete mode 100644 samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/fakerefsmammal/FakerefsmammalPost.kt delete mode 100644 samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/fakerefsmammal/post/FakerefsmammalPostRequestBody.kt delete mode 100644 samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/fakerefsmammal/post/FakerefsmammalPostResponses.kt delete mode 100644 samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/fakerefsmammal/post/requestbody/content/applicationjson/ApplicationjsonSchema.kt delete mode 100644 samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/fakerefsmammal/post/responses/FakerefsmammalPostCode200Response.kt delete mode 100644 samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/fakerefsmammal/post/responses/code200response/content/applicationjson/ApplicationjsonSchema.kt delete mode 100644 samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/fakerefsnumber/FakerefsnumberPost.kt delete mode 100644 samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/fakerefsnumber/post/FakerefsnumberPostRequestBody.kt delete mode 100644 samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/fakerefsnumber/post/FakerefsnumberPostResponses.kt delete mode 100644 samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/fakerefsnumber/post/requestbody/content/applicationjson/ApplicationjsonSchema.kt delete mode 100644 samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/fakerefsnumber/post/responses/FakerefsnumberPostCode200Response.kt delete mode 100644 samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/fakerefsnumber/post/responses/code200response/content/applicationjson/ApplicationjsonSchema.kt delete mode 100644 samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/fakerefsobjectmodelwithrefprops/FakerefsobjectmodelwithrefpropsPost.kt delete mode 100644 samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/fakerefsobjectmodelwithrefprops/post/FakerefsobjectmodelwithrefpropsPostRequestBody.kt delete mode 100644 samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/fakerefsobjectmodelwithrefprops/post/FakerefsobjectmodelwithrefpropsPostResponses.kt delete mode 100644 samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/fakerefsobjectmodelwithrefprops/post/requestbody/content/applicationjson/ApplicationjsonSchema.kt delete mode 100644 samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/fakerefsobjectmodelwithrefprops/post/responses/FakerefsobjectmodelwithrefpropsPostCode200Response.kt delete mode 100644 samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/fakerefsobjectmodelwithrefprops/post/responses/code200response/content/applicationjson/ApplicationjsonSchema.kt delete mode 100644 samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/fakerefsstring/FakerefsstringPost.kt delete mode 100644 samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/fakerefsstring/post/FakerefsstringPostRequestBody.kt delete mode 100644 samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/fakerefsstring/post/FakerefsstringPostResponses.kt delete mode 100644 samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/fakerefsstring/post/requestbody/content/applicationjson/ApplicationjsonSchema.kt delete mode 100644 samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/fakerefsstring/post/responses/FakerefsstringPostCode200Response.kt delete mode 100644 samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/fakerefsstring/post/responses/code200response/content/applicationjson/ApplicationjsonSchema.kt delete mode 100644 samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/fakeresponsewithoutschema/FakeresponsewithoutschemaGet.kt delete mode 100644 samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/fakeresponsewithoutschema/get/FakeresponsewithoutschemaGetResponses.kt delete mode 100644 samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/fakeresponsewithoutschema/get/responses/FakeresponsewithoutschemaGetCode200Response.kt delete mode 100644 samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/faketestqueryparamters/FaketestqueryparamtersPut.kt delete mode 100644 samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/faketestqueryparamters/put/FaketestqueryparamtersPutQueryParameters.kt delete mode 100644 samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/faketestqueryparamters/put/FaketestqueryparamtersPutResponses.kt delete mode 100644 samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/faketestqueryparamters/put/Parameters.kt delete mode 100644 samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/faketestqueryparamters/put/parameters/Parameter0.kt delete mode 100644 samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/faketestqueryparamters/put/parameters/Parameter1.kt delete mode 100644 samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/faketestqueryparamters/put/parameters/Parameter2.kt delete mode 100644 samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/faketestqueryparamters/put/parameters/Parameter3.kt delete mode 100644 samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/faketestqueryparamters/put/parameters/Parameter4.kt delete mode 100644 samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/faketestqueryparamters/put/parameters/Parameter5.kt delete mode 100644 samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/faketestqueryparamters/put/parameters/parameter0/Schema0.kt delete mode 100644 samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/faketestqueryparamters/put/parameters/parameter1/Schema1.kt delete mode 100644 samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/faketestqueryparamters/put/parameters/parameter2/Schema2.kt delete mode 100644 samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/faketestqueryparamters/put/parameters/parameter3/Schema3.kt delete mode 100644 samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/faketestqueryparamters/put/parameters/parameter4/Schema4.kt delete mode 100644 samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/faketestqueryparamters/put/parameters/parameter5/Schema5.kt delete mode 100644 samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/faketestqueryparamters/put/responses/FaketestqueryparamtersPutCode200Response.kt delete mode 100644 samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/fakeuploaddownloadfile/FakeuploaddownloadfilePost.kt delete mode 100644 samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/fakeuploaddownloadfile/post/FakeuploaddownloadfilePostRequestBody.kt delete mode 100644 samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/fakeuploaddownloadfile/post/FakeuploaddownloadfilePostResponses.kt delete mode 100644 samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/fakeuploaddownloadfile/post/requestbody/content/applicationoctetstream/ApplicationoctetstreamSchema.kt delete mode 100644 samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/fakeuploaddownloadfile/post/responses/FakeuploaddownloadfilePostCode200Response.kt delete mode 100644 samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/fakeuploaddownloadfile/post/responses/code200response/content/applicationoctetstream/ApplicationoctetstreamSchema.kt delete mode 100644 samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/fakeuploadfile/FakeuploadfilePost.kt delete mode 100644 samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/fakeuploadfile/post/FakeuploadfilePostRequestBody.kt delete mode 100644 samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/fakeuploadfile/post/FakeuploadfilePostResponses.kt delete mode 100644 samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/fakeuploadfile/post/requestbody/content/multipartformdata/MultipartformdataSchema.kt delete mode 100644 samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/fakeuploadfile/post/responses/FakeuploadfilePostCode200Response.kt delete mode 100644 samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/fakeuploadfile/post/responses/code200response/content/applicationjson/ApplicationjsonSchema.kt delete mode 100644 samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/fakeuploadfiles/FakeuploadfilesPost.kt delete mode 100644 samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/fakeuploadfiles/post/FakeuploadfilesPostRequestBody.kt delete mode 100644 samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/fakeuploadfiles/post/FakeuploadfilesPostResponses.kt delete mode 100644 samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/fakeuploadfiles/post/requestbody/content/multipartformdata/MultipartformdataSchema.kt delete mode 100644 samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/fakeuploadfiles/post/responses/FakeuploadfilesPostCode200Response.kt delete mode 100644 samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/fakeuploadfiles/post/responses/code200response/content/applicationjson/ApplicationjsonSchema.kt delete mode 100644 samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/fakewildcardresponses/FakewildcardresponsesGet.kt delete mode 100644 samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/fakewildcardresponses/get/FakewildcardresponsesGetResponses.kt delete mode 100644 samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/fakewildcardresponses/get/responses/FakewildcardresponsesGetCode1XXResponse.kt delete mode 100644 samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/fakewildcardresponses/get/responses/FakewildcardresponsesGetCode200Response.kt delete mode 100644 samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/fakewildcardresponses/get/responses/FakewildcardresponsesGetCode2XXResponse.kt delete mode 100644 samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/fakewildcardresponses/get/responses/FakewildcardresponsesGetCode3XXResponse.kt delete mode 100644 samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/fakewildcardresponses/get/responses/FakewildcardresponsesGetCode4XXResponse.kt delete mode 100644 samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/fakewildcardresponses/get/responses/FakewildcardresponsesGetCode5XXResponse.kt delete mode 100644 samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/fakewildcardresponses/get/responses/code1xxresponse/content/applicationjson/ApplicationjsonSchema.kt delete mode 100644 samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/fakewildcardresponses/get/responses/code200response/content/applicationjson/ApplicationjsonSchema.kt delete mode 100644 samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/fakewildcardresponses/get/responses/code2xxresponse/content/applicationjson/ApplicationjsonSchema.kt delete mode 100644 samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/fakewildcardresponses/get/responses/code3xxresponse/content/applicationjson/ApplicationjsonSchema.kt delete mode 100644 samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/fakewildcardresponses/get/responses/code4xxresponse/content/applicationjson/ApplicationjsonSchema.kt delete mode 100644 samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/fakewildcardresponses/get/responses/code5xxresponse/content/applicationjson/ApplicationjsonSchema.kt delete mode 100644 samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/foo/FooGet.kt delete mode 100644 samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/foo/get/FooGetResponses.kt delete mode 100644 samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/foo/get/FooGetServerInfo.kt delete mode 100644 samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/foo/get/responses/FooGetCodedefaultResponse.kt delete mode 100644 samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/foo/get/responses/codedefaultresponse/content/applicationjson/ApplicationjsonSchema.kt delete mode 100644 samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/foo/get/servers/FooGetServer0.kt delete mode 100644 samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/foo/get/servers/FooGetServer1.kt delete mode 100644 samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/foo/get/servers/server1/FooGetServer1Variables.kt delete mode 100644 samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/pet/PetPost.kt delete mode 100644 samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/pet/PetPut.kt delete mode 100644 samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/pet/post/PetPostRequestBody.kt delete mode 100644 samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/pet/post/PetPostResponses.kt delete mode 100644 samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/pet/post/PetPostSecurityInfo.kt delete mode 100644 samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/pet/post/responses/PetPostCode200Response.kt delete mode 100644 samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/pet/post/responses/PetPostCode405Response.kt delete mode 100644 samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/pet/post/security/PetPostSecurityRequirementObject0.kt delete mode 100644 samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/pet/post/security/PetPostSecurityRequirementObject1.kt delete mode 100644 samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/pet/post/security/PetPostSecurityRequirementObject2.kt delete mode 100644 samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/pet/put/PetPutRequestBody.kt delete mode 100644 samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/pet/put/PetPutResponses.kt delete mode 100644 samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/pet/put/PetPutSecurityInfo.kt delete mode 100644 samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/pet/put/responses/PetPutCode400Response.kt delete mode 100644 samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/pet/put/responses/PetPutCode404Response.kt delete mode 100644 samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/pet/put/responses/PetPutCode405Response.kt delete mode 100644 samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/pet/put/security/PetPutSecurityRequirementObject0.kt delete mode 100644 samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/pet/put/security/PetPutSecurityRequirementObject1.kt delete mode 100644 samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/petfindbystatus/PetfindbystatusGet.kt delete mode 100644 samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/petfindbystatus/PetfindbystatusServerInfo.kt delete mode 100644 samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/petfindbystatus/get/Parameters.kt delete mode 100644 samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/petfindbystatus/get/PetfindbystatusGetQueryParameters.kt delete mode 100644 samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/petfindbystatus/get/PetfindbystatusGetResponses.kt delete mode 100644 samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/petfindbystatus/get/PetfindbystatusGetSecurityInfo.kt delete mode 100644 samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/petfindbystatus/get/parameters/Parameter0.kt delete mode 100644 samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/petfindbystatus/get/parameters/parameter0/Schema0.kt delete mode 100644 samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/petfindbystatus/get/responses/PetfindbystatusGetCode200Response.kt delete mode 100644 samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/petfindbystatus/get/responses/PetfindbystatusGetCode400Response.kt delete mode 100644 samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/petfindbystatus/get/security/PetfindbystatusGetSecurityRequirementObject0.kt delete mode 100644 samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/petfindbystatus/get/security/PetfindbystatusGetSecurityRequirementObject1.kt delete mode 100644 samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/petfindbystatus/get/security/PetfindbystatusGetSecurityRequirementObject2.kt delete mode 100644 samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/petfindbystatus/servers/PetfindbystatusServer0.kt delete mode 100644 samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/petfindbystatus/servers/PetfindbystatusServer1.kt delete mode 100644 samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/petfindbystatus/servers/server1/PetfindbystatusServer1Variables.kt delete mode 100644 samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/petfindbytags/PetfindbytagsGet.kt delete mode 100644 samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/petfindbytags/get/Parameters.kt delete mode 100644 samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/petfindbytags/get/PetfindbytagsGetQueryParameters.kt delete mode 100644 samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/petfindbytags/get/PetfindbytagsGetResponses.kt delete mode 100644 samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/petfindbytags/get/PetfindbytagsGetSecurityInfo.kt delete mode 100644 samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/petfindbytags/get/parameters/Parameter0.kt delete mode 100644 samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/petfindbytags/get/parameters/parameter0/Schema0.kt delete mode 100644 samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/petfindbytags/get/responses/PetfindbytagsGetCode200Response.kt delete mode 100644 samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/petfindbytags/get/responses/PetfindbytagsGetCode400Response.kt delete mode 100644 samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/petfindbytags/get/security/PetfindbytagsGetSecurityRequirementObject0.kt delete mode 100644 samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/petfindbytags/get/security/PetfindbytagsGetSecurityRequirementObject1.kt delete mode 100644 samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/petpetid/PetpetidDelete.kt delete mode 100644 samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/petpetid/PetpetidGet.kt delete mode 100644 samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/petpetid/PetpetidPost.kt delete mode 100644 samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/petpetid/delete/Parameters.kt delete mode 100644 samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/petpetid/delete/PetpetidDeleteHeaderParameters.kt delete mode 100644 samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/petpetid/delete/PetpetidDeletePathParameters.kt delete mode 100644 samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/petpetid/delete/PetpetidDeleteResponses.kt delete mode 100644 samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/petpetid/delete/PetpetidDeleteSecurityInfo.kt delete mode 100644 samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/petpetid/delete/parameters/Parameter0.kt delete mode 100644 samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/petpetid/delete/parameters/Parameter1.kt delete mode 100644 samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/petpetid/delete/parameters/parameter0/Schema0.kt delete mode 100644 samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/petpetid/delete/parameters/parameter1/Schema1.kt delete mode 100644 samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/petpetid/delete/responses/PetpetidDeleteCode400Response.kt delete mode 100644 samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/petpetid/delete/security/PetpetidDeleteSecurityRequirementObject0.kt delete mode 100644 samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/petpetid/delete/security/PetpetidDeleteSecurityRequirementObject1.kt delete mode 100644 samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/petpetid/get/Parameters.kt delete mode 100644 samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/petpetid/get/PetpetidGetPathParameters.kt delete mode 100644 samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/petpetid/get/PetpetidGetResponses.kt delete mode 100644 samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/petpetid/get/PetpetidGetSecurityInfo.kt delete mode 100644 samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/petpetid/get/parameters/Parameter0.kt delete mode 100644 samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/petpetid/get/parameters/parameter0/Schema0.kt delete mode 100644 samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/petpetid/get/responses/PetpetidGetCode200Response.kt delete mode 100644 samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/petpetid/get/responses/PetpetidGetCode400Response.kt delete mode 100644 samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/petpetid/get/responses/PetpetidGetCode404Response.kt delete mode 100644 samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/petpetid/get/responses/code200response/content/applicationjson/ApplicationjsonSchema.kt delete mode 100644 samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/petpetid/get/responses/code200response/content/applicationxml/ApplicationxmlSchema.kt delete mode 100644 samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/petpetid/get/security/PetpetidGetSecurityRequirementObject0.kt delete mode 100644 samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/petpetid/post/Parameters.kt delete mode 100644 samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/petpetid/post/PetpetidPostPathParameters.kt delete mode 100644 samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/petpetid/post/PetpetidPostRequestBody.kt delete mode 100644 samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/petpetid/post/PetpetidPostResponses.kt delete mode 100644 samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/petpetid/post/PetpetidPostSecurityInfo.kt delete mode 100644 samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/petpetid/post/parameters/Parameter0.kt delete mode 100644 samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/petpetid/post/parameters/parameter0/Schema0.kt delete mode 100644 samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/petpetid/post/requestbody/content/applicationxwwwformurlencoded/ApplicationxwwwformurlencodedSchema.kt delete mode 100644 samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/petpetid/post/responses/PetpetidPostCode405Response.kt delete mode 100644 samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/petpetid/post/security/PetpetidPostSecurityRequirementObject0.kt delete mode 100644 samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/petpetid/post/security/PetpetidPostSecurityRequirementObject1.kt delete mode 100644 samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/petpetiduploadimage/PetpetiduploadimagePost.kt delete mode 100644 samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/petpetiduploadimage/post/Parameters.kt delete mode 100644 samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/petpetiduploadimage/post/PetpetiduploadimagePostPathParameters.kt delete mode 100644 samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/petpetiduploadimage/post/PetpetiduploadimagePostRequestBody.kt delete mode 100644 samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/petpetiduploadimage/post/PetpetiduploadimagePostResponses.kt delete mode 100644 samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/petpetiduploadimage/post/PetpetiduploadimagePostSecurityInfo.kt delete mode 100644 samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/petpetiduploadimage/post/parameters/Parameter0.kt delete mode 100644 samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/petpetiduploadimage/post/parameters/parameter0/Schema0.kt delete mode 100644 samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/petpetiduploadimage/post/requestbody/content/multipartformdata/MultipartformdataSchema.kt delete mode 100644 samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/petpetiduploadimage/post/responses/PetpetiduploadimagePostCode200Response.kt delete mode 100644 samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/petpetiduploadimage/post/security/PetpetiduploadimagePostSecurityRequirementObject0.kt delete mode 100644 samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/solidus/SolidusGet.kt delete mode 100644 samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/solidus/get/SolidusGetResponses.kt delete mode 100644 samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/solidus/get/responses/SolidusGetCode200Response.kt delete mode 100644 samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/storeinventory/StoreinventoryGet.kt delete mode 100644 samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/storeinventory/get/StoreinventoryGetResponses.kt delete mode 100644 samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/storeinventory/get/StoreinventoryGetSecurityInfo.kt delete mode 100644 samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/storeinventory/get/responses/StoreinventoryGetCode200Response.kt delete mode 100644 samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/storeinventory/get/security/StoreinventoryGetSecurityRequirementObject0.kt delete mode 100644 samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/storeorder/StoreorderPost.kt delete mode 100644 samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/storeorder/post/StoreorderPostRequestBody.kt delete mode 100644 samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/storeorder/post/StoreorderPostResponses.kt delete mode 100644 samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/storeorder/post/requestbody/content/applicationjson/ApplicationjsonSchema.kt delete mode 100644 samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/storeorder/post/responses/StoreorderPostCode200Response.kt delete mode 100644 samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/storeorder/post/responses/StoreorderPostCode400Response.kt delete mode 100644 samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/storeorder/post/responses/code200response/content/applicationjson/ApplicationjsonSchema.kt delete mode 100644 samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/storeorder/post/responses/code200response/content/applicationxml/ApplicationxmlSchema.kt delete mode 100644 samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/storeorderorderid/StoreorderorderidDelete.kt delete mode 100644 samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/storeorderorderid/StoreorderorderidGet.kt delete mode 100644 samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/storeorderorderid/delete/Parameters.kt delete mode 100644 samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/storeorderorderid/delete/StoreorderorderidDeletePathParameters.kt delete mode 100644 samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/storeorderorderid/delete/StoreorderorderidDeleteResponses.kt delete mode 100644 samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/storeorderorderid/delete/parameters/Parameter0.kt delete mode 100644 samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/storeorderorderid/delete/parameters/parameter0/Schema0.kt delete mode 100644 samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/storeorderorderid/delete/responses/StoreorderorderidDeleteCode400Response.kt delete mode 100644 samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/storeorderorderid/delete/responses/StoreorderorderidDeleteCode404Response.kt delete mode 100644 samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/storeorderorderid/get/Parameters.kt delete mode 100644 samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/storeorderorderid/get/StoreorderorderidGetPathParameters.kt delete mode 100644 samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/storeorderorderid/get/StoreorderorderidGetResponses.kt delete mode 100644 samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/storeorderorderid/get/parameters/Parameter0.kt delete mode 100644 samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/storeorderorderid/get/parameters/parameter0/Schema0.kt delete mode 100644 samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/storeorderorderid/get/responses/StoreorderorderidGetCode200Response.kt delete mode 100644 samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/storeorderorderid/get/responses/StoreorderorderidGetCode400Response.kt delete mode 100644 samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/storeorderorderid/get/responses/StoreorderorderidGetCode404Response.kt delete mode 100644 samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/storeorderorderid/get/responses/code200response/content/applicationjson/ApplicationjsonSchema.kt delete mode 100644 samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/storeorderorderid/get/responses/code200response/content/applicationxml/ApplicationxmlSchema.kt delete mode 100644 samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/user/UserPost.kt delete mode 100644 samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/user/post/UserPostRequestBody.kt delete mode 100644 samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/user/post/UserPostResponses.kt delete mode 100644 samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/user/post/requestbody/content/applicationjson/ApplicationjsonSchema.kt delete mode 100644 samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/user/post/responses/UserPostCodedefaultResponse.kt delete mode 100644 samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/usercreatewitharray/UsercreatewitharrayPost.kt delete mode 100644 samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/usercreatewitharray/post/UsercreatewitharrayPostRequestBody.kt delete mode 100644 samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/usercreatewitharray/post/UsercreatewitharrayPostResponses.kt delete mode 100644 samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/usercreatewitharray/post/responses/UsercreatewitharrayPostCodedefaultResponse.kt delete mode 100644 samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/usercreatewithlist/UsercreatewithlistPost.kt delete mode 100644 samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/usercreatewithlist/post/UsercreatewithlistPostRequestBody.kt delete mode 100644 samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/usercreatewithlist/post/UsercreatewithlistPostResponses.kt delete mode 100644 samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/usercreatewithlist/post/responses/UsercreatewithlistPostCodedefaultResponse.kt delete mode 100644 samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/userlogin/UserloginGet.kt delete mode 100644 samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/userlogin/get/Parameters.kt delete mode 100644 samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/userlogin/get/UserloginGetQueryParameters.kt delete mode 100644 samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/userlogin/get/UserloginGetResponses.kt delete mode 100644 samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/userlogin/get/parameters/Parameter0.kt delete mode 100644 samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/userlogin/get/parameters/Parameter1.kt delete mode 100644 samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/userlogin/get/parameters/parameter0/Schema0.kt delete mode 100644 samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/userlogin/get/parameters/parameter1/Schema1.kt delete mode 100644 samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/userlogin/get/responses/UserloginGetCode200Response.kt delete mode 100644 samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/userlogin/get/responses/UserloginGetCode400Response.kt delete mode 100644 samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/userlogin/get/responses/code200response/Headers.kt delete mode 100644 samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/userlogin/get/responses/code200response/UserloginGetCode200ResponseHeadersSchema.kt delete mode 100644 samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/userlogin/get/responses/code200response/content/applicationjson/ApplicationjsonSchema.kt delete mode 100644 samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/userlogin/get/responses/code200response/content/applicationxml/ApplicationxmlSchema.kt delete mode 100644 samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/userlogin/get/responses/code200response/headers/Int32.kt delete mode 100644 samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/userlogin/get/responses/code200response/headers/NumberHeader.kt delete mode 100644 samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/userlogin/get/responses/code200response/headers/Refcontentschemaheader.kt delete mode 100644 samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/userlogin/get/responses/code200response/headers/XExpiresAfter.kt delete mode 100644 samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/userlogin/get/responses/code200response/headers/XRateLimit.kt delete mode 100644 samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/userlogin/get/responses/code200response/headers/xexpiresafter/XExpiresAfterSchema.kt delete mode 100644 samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/userlogin/get/responses/code200response/headers/xratelimit/content/applicationjson/XRateLimitSchema.kt delete mode 100644 samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/userlogout/UserlogoutGet.kt delete mode 100644 samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/userlogout/get/UserlogoutGetResponses.kt delete mode 100644 samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/userlogout/get/responses/UserlogoutGetCodedefaultResponse.kt delete mode 100644 samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/userusername/UserusernameDelete.kt delete mode 100644 samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/userusername/UserusernameGet.kt delete mode 100644 samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/userusername/UserusernamePut.kt delete mode 100644 samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/userusername/delete/Parameters.kt delete mode 100644 samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/userusername/delete/UserusernameDeletePathParameters.kt delete mode 100644 samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/userusername/delete/UserusernameDeleteResponses.kt delete mode 100644 samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/userusername/delete/parameters/Parameter0.kt delete mode 100644 samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/userusername/delete/responses/UserusernameDeleteCode200Response.kt delete mode 100644 samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/userusername/delete/responses/UserusernameDeleteCode404Response.kt delete mode 100644 samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/userusername/get/Parameters.kt delete mode 100644 samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/userusername/get/UserusernameGetPathParameters.kt delete mode 100644 samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/userusername/get/UserusernameGetResponses.kt delete mode 100644 samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/userusername/get/parameters/Parameter0.kt delete mode 100644 samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/userusername/get/responses/UserusernameGetCode200Response.kt delete mode 100644 samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/userusername/get/responses/UserusernameGetCode400Response.kt delete mode 100644 samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/userusername/get/responses/UserusernameGetCode404Response.kt delete mode 100644 samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/userusername/get/responses/code200response/content/applicationjson/ApplicationjsonSchema.kt delete mode 100644 samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/userusername/get/responses/code200response/content/applicationxml/ApplicationxmlSchema.kt delete mode 100644 samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/userusername/put/Parameters.kt delete mode 100644 samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/userusername/put/UserusernamePutPathParameters.kt delete mode 100644 samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/userusername/put/UserusernamePutRequestBody.kt delete mode 100644 samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/userusername/put/UserusernamePutResponses.kt delete mode 100644 samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/userusername/put/parameters/Parameter0.kt delete mode 100644 samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/userusername/put/requestbody/content/applicationjson/ApplicationjsonSchema.kt delete mode 100644 samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/userusername/put/responses/UserusernamePutCode400Response.kt delete mode 100644 samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/userusername/put/responses/UserusernamePutCode404Response.kt delete mode 100644 samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/requestbody/GenericRequestBody.kt delete mode 100644 samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/requestbody/RequestBodySerializer.kt delete mode 100644 samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/requestbody/SerializedRequestBody.kt delete mode 100644 samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/response/ApiResponse.kt delete mode 100644 samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/response/DeserializedHttpResponse.kt delete mode 100644 samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/response/HeadersDeserializer.kt delete mode 100644 samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/response/ResponseDeserializer.kt delete mode 100644 samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/response/ResponsesDeserializer.kt delete mode 100644 samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/restclient/RestClient.kt delete mode 100644 samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/schemas/SetMaker.kt delete mode 100644 samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/schemas/UnsetAddPropsSetter.kt delete mode 100644 samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/schemas/UuidJsonSchema.kt delete mode 100644 samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/schemas/validation/BooleanEnumValidator.kt delete mode 100644 samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/schemas/validation/BooleanValueMethod.kt delete mode 100644 samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/schemas/validation/DefaultValueMethod.kt delete mode 100644 samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/schemas/validation/DoubleEnumValidator.kt delete mode 100644 samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/schemas/validation/DoubleValueMethod.kt delete mode 100644 samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/schemas/validation/FloatEnumValidator.kt delete mode 100644 samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/schemas/validation/FloatValueMethod.kt delete mode 100644 samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/schemas/validation/IntegerEnumValidator.kt delete mode 100644 samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/schemas/validation/IntegerValueMethod.kt delete mode 100644 samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/schemas/validation/KeywordEntry.kt delete mode 100644 samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/schemas/validation/LongEnumValidator.kt delete mode 100644 samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/schemas/validation/LongValueMethod.kt delete mode 100644 samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/schemas/validation/MapUtils.kt delete mode 100644 samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/schemas/validation/NullEnumValidator.kt delete mode 100644 samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/schemas/validation/NullValueMethod.kt delete mode 100644 samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/schemas/validation/PropertyEntry.kt delete mode 100644 samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/schemas/validation/StringEnumValidator.kt delete mode 100644 samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/schemas/validation/StringValueMethod.kt delete mode 100644 samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/schemas/validation/ValidationData.kt delete mode 100644 samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/securityrequirementobjects/AuthApplier.kt delete mode 100644 samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/securityrequirementobjects/EmptySecurityRequirementObject.kt delete mode 100644 samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/securityrequirementobjects/SecurityRequirementObject.kt delete mode 100644 samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/securityrequirementobjects/SecurityRequirementObjectProvider.kt delete mode 100644 samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/securityschemes/ApiKeyCookieSecurityScheme.kt delete mode 100644 samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/securityschemes/ApiKeyHeaderSecurityScheme.kt delete mode 100644 samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/securityschemes/ApiKeyQuerySecurityScheme.kt delete mode 100644 samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/securityschemes/HttpBasicSecurityScheme.kt delete mode 100644 samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/securityschemes/HttpBearerSecurityScheme.kt delete mode 100644 samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/securityschemes/HttpDigestSecurityScheme.kt delete mode 100644 samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/securityschemes/HttpSignatureSecurityScheme.kt delete mode 100644 samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/securityschemes/MutualTlsSecurityScheme.kt delete mode 100644 samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/securityschemes/OAuth2SecurityScheme.kt delete mode 100644 samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/securityschemes/OpenIdConnectSecurityScheme.kt delete mode 100644 samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/securityschemes/SecurityScheme.kt delete mode 100644 samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/servers/RootServer0.kt delete mode 100644 samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/servers/RootServer1.kt delete mode 100644 samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/servers/RootServer2.kt delete mode 100644 samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/servers/ServerProvider.kt delete mode 100644 samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/servers/ServerWithVariables.kt delete mode 100644 samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/servers/ServerWithoutVariables.kt delete mode 100644 samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/servers/rootserver0/RootServer0Variables.kt delete mode 100644 samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/servers/rootserver1/RootServer1Variables.kt delete mode 100644 samples/client/petstore/kotlin/src/test/kotlin/org/openapijsonschematools/client/components/schemas/AbstractStepMessageTest.kt delete mode 100644 samples/client/petstore/kotlin/src/test/kotlin/org/openapijsonschematools/client/components/schemas/AdditionalPropertiesClassTest.kt delete mode 100644 samples/client/petstore/kotlin/src/test/kotlin/org/openapijsonschematools/client/components/schemas/AdditionalPropertiesSchemaTest.kt delete mode 100644 samples/client/petstore/kotlin/src/test/kotlin/org/openapijsonschematools/client/components/schemas/AdditionalPropertiesWithArrayOfEnumsTest.kt delete mode 100644 samples/client/petstore/kotlin/src/test/kotlin/org/openapijsonschematools/client/components/schemas/AddressTest.kt delete mode 100644 samples/client/petstore/kotlin/src/test/kotlin/org/openapijsonschematools/client/components/schemas/AnimalFarmTest.kt delete mode 100644 samples/client/petstore/kotlin/src/test/kotlin/org/openapijsonschematools/client/components/schemas/AnimalTest.kt delete mode 100644 samples/client/petstore/kotlin/src/test/kotlin/org/openapijsonschematools/client/components/schemas/AnyTypeAndFormatTest.kt delete mode 100644 samples/client/petstore/kotlin/src/test/kotlin/org/openapijsonschematools/client/components/schemas/AnyTypeNotStringTest.kt delete mode 100644 samples/client/petstore/kotlin/src/test/kotlin/org/openapijsonschematools/client/components/schemas/ApiResponseSchemaTest.kt delete mode 100644 samples/client/petstore/kotlin/src/test/kotlin/org/openapijsonschematools/client/components/schemas/AppleReqTest.kt delete mode 100644 samples/client/petstore/kotlin/src/test/kotlin/org/openapijsonschematools/client/components/schemas/AppleTest.kt delete mode 100644 samples/client/petstore/kotlin/src/test/kotlin/org/openapijsonschematools/client/components/schemas/ArrayHoldingAnyTypeTest.kt delete mode 100644 samples/client/petstore/kotlin/src/test/kotlin/org/openapijsonschematools/client/components/schemas/ArrayOfArrayOfNumberOnlyTest.kt delete mode 100644 samples/client/petstore/kotlin/src/test/kotlin/org/openapijsonschematools/client/components/schemas/ArrayOfEnumsTest.kt delete mode 100644 samples/client/petstore/kotlin/src/test/kotlin/org/openapijsonschematools/client/components/schemas/ArrayOfNumberOnlyTest.kt delete mode 100644 samples/client/petstore/kotlin/src/test/kotlin/org/openapijsonschematools/client/components/schemas/ArrayTestTest.kt delete mode 100644 samples/client/petstore/kotlin/src/test/kotlin/org/openapijsonschematools/client/components/schemas/ArrayWithValidationsInItemsTest.kt delete mode 100644 samples/client/petstore/kotlin/src/test/kotlin/org/openapijsonschematools/client/components/schemas/BananaReqTest.kt delete mode 100644 samples/client/petstore/kotlin/src/test/kotlin/org/openapijsonschematools/client/components/schemas/BananaTest.kt delete mode 100644 samples/client/petstore/kotlin/src/test/kotlin/org/openapijsonschematools/client/components/schemas/BarTest.kt delete mode 100644 samples/client/petstore/kotlin/src/test/kotlin/org/openapijsonschematools/client/components/schemas/BasquePigTest.kt delete mode 100644 samples/client/petstore/kotlin/src/test/kotlin/org/openapijsonschematools/client/components/schemas/BooleanEnumTest.kt delete mode 100644 samples/client/petstore/kotlin/src/test/kotlin/org/openapijsonschematools/client/components/schemas/BooleanSchemaTest.kt delete mode 100644 samples/client/petstore/kotlin/src/test/kotlin/org/openapijsonschematools/client/components/schemas/CapitalizationTest.kt delete mode 100644 samples/client/petstore/kotlin/src/test/kotlin/org/openapijsonschematools/client/components/schemas/CatTest.kt delete mode 100644 samples/client/petstore/kotlin/src/test/kotlin/org/openapijsonschematools/client/components/schemas/CategoryTest.kt delete mode 100644 samples/client/petstore/kotlin/src/test/kotlin/org/openapijsonschematools/client/components/schemas/ChildCatTest.kt delete mode 100644 samples/client/petstore/kotlin/src/test/kotlin/org/openapijsonschematools/client/components/schemas/ClassModelTest.kt delete mode 100644 samples/client/petstore/kotlin/src/test/kotlin/org/openapijsonschematools/client/components/schemas/ClientTest.kt delete mode 100644 samples/client/petstore/kotlin/src/test/kotlin/org/openapijsonschematools/client/components/schemas/ComplexQuadrilateralTest.kt delete mode 100644 samples/client/petstore/kotlin/src/test/kotlin/org/openapijsonschematools/client/components/schemas/ComposedAnyOfDifferentTypesNoValidationsTest.kt delete mode 100644 samples/client/petstore/kotlin/src/test/kotlin/org/openapijsonschematools/client/components/schemas/ComposedArrayTest.kt delete mode 100644 samples/client/petstore/kotlin/src/test/kotlin/org/openapijsonschematools/client/components/schemas/ComposedBoolTest.kt delete mode 100644 samples/client/petstore/kotlin/src/test/kotlin/org/openapijsonschematools/client/components/schemas/ComposedNoneTest.kt delete mode 100644 samples/client/petstore/kotlin/src/test/kotlin/org/openapijsonschematools/client/components/schemas/ComposedNumberTest.kt delete mode 100644 samples/client/petstore/kotlin/src/test/kotlin/org/openapijsonschematools/client/components/schemas/ComposedObjectTest.kt delete mode 100644 samples/client/petstore/kotlin/src/test/kotlin/org/openapijsonschematools/client/components/schemas/ComposedOneOfDifferentTypesTest.kt delete mode 100644 samples/client/petstore/kotlin/src/test/kotlin/org/openapijsonschematools/client/components/schemas/ComposedStringTest.kt delete mode 100644 samples/client/petstore/kotlin/src/test/kotlin/org/openapijsonschematools/client/components/schemas/CurrencyTest.kt delete mode 100644 samples/client/petstore/kotlin/src/test/kotlin/org/openapijsonschematools/client/components/schemas/DanishPigTest.kt delete mode 100644 samples/client/petstore/kotlin/src/test/kotlin/org/openapijsonschematools/client/components/schemas/DateTimeTestTest.kt delete mode 100644 samples/client/petstore/kotlin/src/test/kotlin/org/openapijsonschematools/client/components/schemas/DateTimeWithValidationsTest.kt delete mode 100644 samples/client/petstore/kotlin/src/test/kotlin/org/openapijsonschematools/client/components/schemas/DateWithValidationsTest.kt delete mode 100644 samples/client/petstore/kotlin/src/test/kotlin/org/openapijsonschematools/client/components/schemas/DecimalPayloadTest.kt delete mode 100644 samples/client/petstore/kotlin/src/test/kotlin/org/openapijsonschematools/client/components/schemas/DogTest.kt delete mode 100644 samples/client/petstore/kotlin/src/test/kotlin/org/openapijsonschematools/client/components/schemas/DrawingTest.kt delete mode 100644 samples/client/petstore/kotlin/src/test/kotlin/org/openapijsonschematools/client/components/schemas/EnumArraysTest.kt delete mode 100644 samples/client/petstore/kotlin/src/test/kotlin/org/openapijsonschematools/client/components/schemas/EnumClassTest.kt delete mode 100644 samples/client/petstore/kotlin/src/test/kotlin/org/openapijsonschematools/client/components/schemas/EnumTestTest.kt delete mode 100644 samples/client/petstore/kotlin/src/test/kotlin/org/openapijsonschematools/client/components/schemas/EquilateralTriangleTest.kt delete mode 100644 samples/client/petstore/kotlin/src/test/kotlin/org/openapijsonschematools/client/components/schemas/FileSchemaTestClassTest.kt delete mode 100644 samples/client/petstore/kotlin/src/test/kotlin/org/openapijsonschematools/client/components/schemas/FileTest.kt delete mode 100644 samples/client/petstore/kotlin/src/test/kotlin/org/openapijsonschematools/client/components/schemas/FooTest.kt delete mode 100644 samples/client/petstore/kotlin/src/test/kotlin/org/openapijsonschematools/client/components/schemas/FormatTestTest.kt delete mode 100644 samples/client/petstore/kotlin/src/test/kotlin/org/openapijsonschematools/client/components/schemas/FromSchemaTest.kt delete mode 100644 samples/client/petstore/kotlin/src/test/kotlin/org/openapijsonschematools/client/components/schemas/FruitReqTest.kt delete mode 100644 samples/client/petstore/kotlin/src/test/kotlin/org/openapijsonschematools/client/components/schemas/FruitTest.kt delete mode 100644 samples/client/petstore/kotlin/src/test/kotlin/org/openapijsonschematools/client/components/schemas/GmFruitTest.kt delete mode 100644 samples/client/petstore/kotlin/src/test/kotlin/org/openapijsonschematools/client/components/schemas/GrandparentAnimalTest.kt delete mode 100644 samples/client/petstore/kotlin/src/test/kotlin/org/openapijsonschematools/client/components/schemas/HasOnlyReadOnlyTest.kt delete mode 100644 samples/client/petstore/kotlin/src/test/kotlin/org/openapijsonschematools/client/components/schemas/HealthCheckResultTest.kt delete mode 100644 samples/client/petstore/kotlin/src/test/kotlin/org/openapijsonschematools/client/components/schemas/IntegerEnumBigTest.kt delete mode 100644 samples/client/petstore/kotlin/src/test/kotlin/org/openapijsonschematools/client/components/schemas/IntegerEnumOneValueTest.kt delete mode 100644 samples/client/petstore/kotlin/src/test/kotlin/org/openapijsonschematools/client/components/schemas/IntegerEnumTest.kt delete mode 100644 samples/client/petstore/kotlin/src/test/kotlin/org/openapijsonschematools/client/components/schemas/IntegerEnumWithDefaultValueTest.kt delete mode 100644 samples/client/petstore/kotlin/src/test/kotlin/org/openapijsonschematools/client/components/schemas/IntegerMax10Test.kt delete mode 100644 samples/client/petstore/kotlin/src/test/kotlin/org/openapijsonschematools/client/components/schemas/IntegerMin15Test.kt delete mode 100644 samples/client/petstore/kotlin/src/test/kotlin/org/openapijsonschematools/client/components/schemas/IsoscelesTriangleTest.kt delete mode 100644 samples/client/petstore/kotlin/src/test/kotlin/org/openapijsonschematools/client/components/schemas/ItemsSchemaTest.kt delete mode 100644 samples/client/petstore/kotlin/src/test/kotlin/org/openapijsonschematools/client/components/schemas/ItemsTest.kt delete mode 100644 samples/client/petstore/kotlin/src/test/kotlin/org/openapijsonschematools/client/components/schemas/JSONPatchRequestAddReplaceTestTest.kt delete mode 100644 samples/client/petstore/kotlin/src/test/kotlin/org/openapijsonschematools/client/components/schemas/JSONPatchRequestMoveCopyTest.kt delete mode 100644 samples/client/petstore/kotlin/src/test/kotlin/org/openapijsonschematools/client/components/schemas/JSONPatchRequestRemoveTest.kt delete mode 100644 samples/client/petstore/kotlin/src/test/kotlin/org/openapijsonschematools/client/components/schemas/JSONPatchRequestTest.kt delete mode 100644 samples/client/petstore/kotlin/src/test/kotlin/org/openapijsonschematools/client/components/schemas/MammalTest.kt delete mode 100644 samples/client/petstore/kotlin/src/test/kotlin/org/openapijsonschematools/client/components/schemas/MapTestTest.kt delete mode 100644 samples/client/petstore/kotlin/src/test/kotlin/org/openapijsonschematools/client/components/schemas/MixedPropertiesAndAdditionalPropertiesClassTest.kt delete mode 100644 samples/client/petstore/kotlin/src/test/kotlin/org/openapijsonschematools/client/components/schemas/MoneyTest.kt delete mode 100644 samples/client/petstore/kotlin/src/test/kotlin/org/openapijsonschematools/client/components/schemas/MultiPropertiesSchemaTest.kt delete mode 100644 samples/client/petstore/kotlin/src/test/kotlin/org/openapijsonschematools/client/components/schemas/MyObjectDtoTest.kt delete mode 100644 samples/client/petstore/kotlin/src/test/kotlin/org/openapijsonschematools/client/components/schemas/NameTest.kt delete mode 100644 samples/client/petstore/kotlin/src/test/kotlin/org/openapijsonschematools/client/components/schemas/NoAdditionalPropertiesTest.kt delete mode 100644 samples/client/petstore/kotlin/src/test/kotlin/org/openapijsonschematools/client/components/schemas/NullableClassTest.kt delete mode 100644 samples/client/petstore/kotlin/src/test/kotlin/org/openapijsonschematools/client/components/schemas/NullableShapeTest.kt delete mode 100644 samples/client/petstore/kotlin/src/test/kotlin/org/openapijsonschematools/client/components/schemas/NullableStringTest.kt delete mode 100644 samples/client/petstore/kotlin/src/test/kotlin/org/openapijsonschematools/client/components/schemas/NumberOnlyTest.kt delete mode 100644 samples/client/petstore/kotlin/src/test/kotlin/org/openapijsonschematools/client/components/schemas/NumberSchemaTest.kt delete mode 100644 samples/client/petstore/kotlin/src/test/kotlin/org/openapijsonschematools/client/components/schemas/NumberWithExclusiveMinMaxTest.kt delete mode 100644 samples/client/petstore/kotlin/src/test/kotlin/org/openapijsonschematools/client/components/schemas/NumberWithValidationsTest.kt delete mode 100644 samples/client/petstore/kotlin/src/test/kotlin/org/openapijsonschematools/client/components/schemas/ObjWithRequiredPropsBaseTest.kt delete mode 100644 samples/client/petstore/kotlin/src/test/kotlin/org/openapijsonschematools/client/components/schemas/ObjWithRequiredPropsTest.kt delete mode 100644 samples/client/petstore/kotlin/src/test/kotlin/org/openapijsonschematools/client/components/schemas/ObjectInterfaceTest.kt delete mode 100644 samples/client/petstore/kotlin/src/test/kotlin/org/openapijsonschematools/client/components/schemas/ObjectModelWithArgAndArgsPropertiesTest.kt delete mode 100644 samples/client/petstore/kotlin/src/test/kotlin/org/openapijsonschematools/client/components/schemas/ObjectModelWithRefPropsTest.kt delete mode 100644 samples/client/petstore/kotlin/src/test/kotlin/org/openapijsonschematools/client/components/schemas/ObjectWithAllOfWithReqTestPropFromUnsetAddPropTest.kt delete mode 100644 samples/client/petstore/kotlin/src/test/kotlin/org/openapijsonschematools/client/components/schemas/ObjectWithCollidingPropertiesTest.kt delete mode 100644 samples/client/petstore/kotlin/src/test/kotlin/org/openapijsonschematools/client/components/schemas/ObjectWithDecimalPropertiesTest.kt delete mode 100644 samples/client/petstore/kotlin/src/test/kotlin/org/openapijsonschematools/client/components/schemas/ObjectWithDifficultlyNamedPropsTest.kt delete mode 100644 samples/client/petstore/kotlin/src/test/kotlin/org/openapijsonschematools/client/components/schemas/ObjectWithInlineCompositionPropertyTest.kt delete mode 100644 samples/client/petstore/kotlin/src/test/kotlin/org/openapijsonschematools/client/components/schemas/ObjectWithInvalidNamedRefedPropertiesTest.kt delete mode 100644 samples/client/petstore/kotlin/src/test/kotlin/org/openapijsonschematools/client/components/schemas/ObjectWithNonIntersectingValuesTest.kt delete mode 100644 samples/client/petstore/kotlin/src/test/kotlin/org/openapijsonschematools/client/components/schemas/ObjectWithOnlyOptionalPropsTest.kt delete mode 100644 samples/client/petstore/kotlin/src/test/kotlin/org/openapijsonschematools/client/components/schemas/ObjectWithOptionalTestPropTest.kt delete mode 100644 samples/client/petstore/kotlin/src/test/kotlin/org/openapijsonschematools/client/components/schemas/ObjectWithValidationsTest.kt delete mode 100644 samples/client/petstore/kotlin/src/test/kotlin/org/openapijsonschematools/client/components/schemas/OrderTest.kt delete mode 100644 samples/client/petstore/kotlin/src/test/kotlin/org/openapijsonschematools/client/components/schemas/PaginatedResultMyObjectDtoTest.kt delete mode 100644 samples/client/petstore/kotlin/src/test/kotlin/org/openapijsonschematools/client/components/schemas/ParentPetTest.kt delete mode 100644 samples/client/petstore/kotlin/src/test/kotlin/org/openapijsonschematools/client/components/schemas/PetTest.kt delete mode 100644 samples/client/petstore/kotlin/src/test/kotlin/org/openapijsonschematools/client/components/schemas/PigTest.kt delete mode 100644 samples/client/petstore/kotlin/src/test/kotlin/org/openapijsonschematools/client/components/schemas/PlayerTest.kt delete mode 100644 samples/client/petstore/kotlin/src/test/kotlin/org/openapijsonschematools/client/components/schemas/PublicKeyTest.kt delete mode 100644 samples/client/petstore/kotlin/src/test/kotlin/org/openapijsonschematools/client/components/schemas/QuadrilateralInterfaceTest.kt delete mode 100644 samples/client/petstore/kotlin/src/test/kotlin/org/openapijsonschematools/client/components/schemas/QuadrilateralTest.kt delete mode 100644 samples/client/petstore/kotlin/src/test/kotlin/org/openapijsonschematools/client/components/schemas/ReadOnlyFirstTest.kt delete mode 100644 samples/client/petstore/kotlin/src/test/kotlin/org/openapijsonschematools/client/components/schemas/RefPetTest.kt delete mode 100644 samples/client/petstore/kotlin/src/test/kotlin/org/openapijsonschematools/client/components/schemas/ReqPropsFromExplicitAddPropsTest.kt delete mode 100644 samples/client/petstore/kotlin/src/test/kotlin/org/openapijsonschematools/client/components/schemas/ReqPropsFromTrueAddPropsTest.kt delete mode 100644 samples/client/petstore/kotlin/src/test/kotlin/org/openapijsonschematools/client/components/schemas/ReqPropsFromUnsetAddPropsTest.kt delete mode 100644 samples/client/petstore/kotlin/src/test/kotlin/org/openapijsonschematools/client/components/schemas/ReturnSchemaTest.kt delete mode 100644 samples/client/petstore/kotlin/src/test/kotlin/org/openapijsonschematools/client/components/schemas/ScaleneTriangleTest.kt delete mode 100644 samples/client/petstore/kotlin/src/test/kotlin/org/openapijsonschematools/client/components/schemas/Schema200ResponseTest.kt delete mode 100644 samples/client/petstore/kotlin/src/test/kotlin/org/openapijsonschematools/client/components/schemas/SelfReferencingArrayModelTest.kt delete mode 100644 samples/client/petstore/kotlin/src/test/kotlin/org/openapijsonschematools/client/components/schemas/SelfReferencingObjectModelTest.kt delete mode 100644 samples/client/petstore/kotlin/src/test/kotlin/org/openapijsonschematools/client/components/schemas/ShapeOrNullTest.kt delete mode 100644 samples/client/petstore/kotlin/src/test/kotlin/org/openapijsonschematools/client/components/schemas/ShapeTest.kt delete mode 100644 samples/client/petstore/kotlin/src/test/kotlin/org/openapijsonschematools/client/components/schemas/SimpleQuadrilateralTest.kt delete mode 100644 samples/client/petstore/kotlin/src/test/kotlin/org/openapijsonschematools/client/components/schemas/SomeObjectTest.kt delete mode 100644 samples/client/petstore/kotlin/src/test/kotlin/org/openapijsonschematools/client/components/schemas/SpecialModelnameTest.kt delete mode 100644 samples/client/petstore/kotlin/src/test/kotlin/org/openapijsonschematools/client/components/schemas/StringBooleanMapTest.kt delete mode 100644 samples/client/petstore/kotlin/src/test/kotlin/org/openapijsonschematools/client/components/schemas/StringEnumTest.kt delete mode 100644 samples/client/petstore/kotlin/src/test/kotlin/org/openapijsonschematools/client/components/schemas/StringEnumWithDefaultValueTest.kt delete mode 100644 samples/client/petstore/kotlin/src/test/kotlin/org/openapijsonschematools/client/components/schemas/StringSchemaTest.kt delete mode 100644 samples/client/petstore/kotlin/src/test/kotlin/org/openapijsonschematools/client/components/schemas/StringWithValidationTest.kt delete mode 100644 samples/client/petstore/kotlin/src/test/kotlin/org/openapijsonschematools/client/components/schemas/TagTest.kt delete mode 100644 samples/client/petstore/kotlin/src/test/kotlin/org/openapijsonschematools/client/components/schemas/TriangleInterfaceTest.kt delete mode 100644 samples/client/petstore/kotlin/src/test/kotlin/org/openapijsonschematools/client/components/schemas/TriangleTest.kt delete mode 100644 samples/client/petstore/kotlin/src/test/kotlin/org/openapijsonschematools/client/components/schemas/UUIDStringTest.kt delete mode 100644 samples/client/petstore/kotlin/src/test/kotlin/org/openapijsonschematools/client/components/schemas/UserTest.kt delete mode 100644 samples/client/petstore/kotlin/src/test/kotlin/org/openapijsonschematools/client/components/schemas/WhaleTest.kt delete mode 100644 samples/client/petstore/kotlin/src/test/kotlin/org/openapijsonschematools/client/components/schemas/ZebraTest.kt delete mode 100644 samples/client/petstore/kotlin/src/test/kotlin/org/openapijsonschematools/client/configurations/JsonSchemaKeywordFlagsTest.kt delete mode 100644 samples/client/petstore/kotlin/src/test/kotlin/org/openapijsonschematools/client/header/ContentHeaderTest.kt delete mode 100644 samples/client/petstore/kotlin/src/test/kotlin/org/openapijsonschematools/client/header/SchemaHeaderTest.kt delete mode 100644 samples/client/petstore/kotlin/src/test/kotlin/org/openapijsonschematools/client/parameter/CookieSerializerTest.kt delete mode 100644 samples/client/petstore/kotlin/src/test/kotlin/org/openapijsonschematools/client/parameter/HeadersSerializerTest.kt delete mode 100644 samples/client/petstore/kotlin/src/test/kotlin/org/openapijsonschematools/client/parameter/PathSerializerTest.kt delete mode 100644 samples/client/petstore/kotlin/src/test/kotlin/org/openapijsonschematools/client/parameter/QuerySerializerTest.kt delete mode 100644 samples/client/petstore/kotlin/src/test/kotlin/org/openapijsonschematools/client/parameter/SchemaNonQueryParameterTest.kt delete mode 100644 samples/client/petstore/kotlin/src/test/kotlin/org/openapijsonschematools/client/parameter/SchemaQueryParameterTest.kt delete mode 100644 samples/client/petstore/kotlin/src/test/kotlin/org/openapijsonschematools/client/requestbody/RequestBodySerializerTest.kt delete mode 100644 samples/client/petstore/kotlin/src/test/kotlin/org/openapijsonschematools/client/response/ResponseDeserializerTest.kt delete mode 100644 samples/client/petstore/kotlin/src/test/kotlin/org/openapijsonschematools/client/schemas/AnyTypeSchemaTest.kt delete mode 100644 samples/client/petstore/kotlin/src/test/kotlin/org/openapijsonschematools/client/schemas/ArrayTypeSchemaTest.kt delete mode 100644 samples/client/petstore/kotlin/src/test/kotlin/org/openapijsonschematools/client/schemas/BooleanSchemaTest.kt delete mode 100644 samples/client/petstore/kotlin/src/test/kotlin/org/openapijsonschematools/client/schemas/ListBuilderTest.kt delete mode 100644 samples/client/petstore/kotlin/src/test/kotlin/org/openapijsonschematools/client/schemas/ListSchemaTest.kt delete mode 100644 samples/client/petstore/kotlin/src/test/kotlin/org/openapijsonschematools/client/schemas/MapSchemaTest.kt delete mode 100644 samples/client/petstore/kotlin/src/test/kotlin/org/openapijsonschematools/client/schemas/NullSchemaTest.kt delete mode 100644 samples/client/petstore/kotlin/src/test/kotlin/org/openapijsonschematools/client/schemas/NumberSchemaTest.kt delete mode 100644 samples/client/petstore/kotlin/src/test/kotlin/org/openapijsonschematools/client/schemas/ObjectTypeSchemaTest.kt delete mode 100644 samples/client/petstore/kotlin/src/test/kotlin/org/openapijsonschematools/client/schemas/RefBooleanSchemaTest.kt delete mode 100644 samples/client/petstore/kotlin/src/test/kotlin/org/openapijsonschematools/client/schemas/validation/AdditionalPropertiesValidatorTest.kt delete mode 100644 samples/client/petstore/kotlin/src/test/kotlin/org/openapijsonschematools/client/schemas/validation/CustomIsoparserTest.kt delete mode 100644 samples/client/petstore/kotlin/src/test/kotlin/org/openapijsonschematools/client/schemas/validation/FormatValidatorTest.kt delete mode 100644 samples/client/petstore/kotlin/src/test/kotlin/org/openapijsonschematools/client/schemas/validation/ItemsValidatorTest.kt delete mode 100644 samples/client/petstore/kotlin/src/test/kotlin/org/openapijsonschematools/client/schemas/validation/JsonSchemaTest.kt delete mode 100644 samples/client/petstore/kotlin/src/test/kotlin/org/openapijsonschematools/client/schemas/validation/PropertiesValidatorTest.kt delete mode 100644 samples/client/petstore/kotlin/src/test/kotlin/org/openapijsonschematools/client/schemas/validation/RequiredValidatorTest.kt delete mode 100644 samples/client/petstore/kotlin/src/test/kotlin/org/openapijsonschematools/client/schemas/validation/TypeValidatorTest.kt delete mode 100644 src/main/resources/kotlin/src/main/kotlin/packagename/schemas/SetMaker.hbs delete mode 100644 src/main/resources/kotlin/src/main/kotlin/packagename/schemas/validation/PropertyEntry.hbs diff --git a/.circleci/config.yml b/.circleci/config.yml index 9f3940193f1..7bb844036e3 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -12,10 +12,7 @@ commands: # a reusable command with parameters # In many cases you can simplify this from what is generated here. # 'See docs on artifact collection here https://circleci.com/docs/2.0/artifacts/' - run: mkdir -p $CIRCLE_ARTIFACTS $CIRCLE_TEST_REPORTS - # This is based on your 1.0 configuration file or project settings - - run: - command: java -version - # Test + # Show jobId - run: name: "Setup custom environment variables" command: echo 'export CIRCLE_JOB_ID="<>"' >> $BASH_ENV @@ -137,6 +134,24 @@ jobs: key: javaClientMavenCache paths: - ~/.m2 + testKotlinClientSamples: + docker: + - image: cimg/openjdk:17.0.9 + working_directory: ~/OpenAPITools/openapi-json-schema-generator + shell: /bin/bash --login + environment: + CIRCLE_ARTIFACTS: /tmp/circleci-artifacts + CIRCLE_TEST_REPORTS: /tmp/circleci-test-results + steps: + - restore_cache: + keys: + - kotlinClientGradleCache + - command_build_and_test: + jobId: "testKotlinClientSamples" + - save_cache: + key: kotlinClientGradleCache + paths: + - ~/build workflows: version: 2 build: @@ -146,3 +161,4 @@ workflows: - testPython38ClientSamples - testPython39ClientSamples - testJava17ClientSamples + - testKotlinClientSamples diff --git a/.circleci/parallel.sh b/.circleci/parallel.sh index 804100e29eb..5085b172187 100755 --- a/.circleci/parallel.sh +++ b/.circleci/parallel.sh @@ -33,6 +33,13 @@ elif [ "$JOB_ID" = "testJava17ClientSamples" ]; then cat ./.circleci/testJava17ClientSamples.sh | parallel +elif [ "$JOB_ID" = "testKotlinClientSamples" ]; then + echo "Running job $JOB_ID ..." + gradle --version + java -version + + cat ./.circleci/testKotlinClientSamples.sh | parallel + else echo "Running job $JOB_ID" diff --git a/.circleci/testKotlinClientSamples.sh b/.circleci/testKotlinClientSamples.sh new file mode 100644 index 00000000000..e846f7f3bde --- /dev/null +++ b/.circleci/testKotlinClientSamples.sh @@ -0,0 +1 @@ + (cd samples/client/3_0_3_unit_test/kotlin && gradle wrapper && ./gradlew cleanTest test) \ No newline at end of file diff --git a/bin/generate_samples_configs/kotlin_3_0_3_unit_test.yaml b/bin/generate_samples_configs/kotlin_3_0_3_unit_test.yaml new file mode 100644 index 00000000000..75f12b901db --- /dev/null +++ b/bin/generate_samples_configs/kotlin_3_0_3_unit_test.yaml @@ -0,0 +1,6 @@ +generatorName: kotlin +outputDir: samples/client/3_0_3_unit_test/kotlin +inputSpec: src/test/resources/3_0/unit_test_spec/3_0_3_unit_test_spec_nopaths.yaml +intsAllowedForFloatDoubleFormats: true +artifactId: unit-test-api +hideGenerationTimestamp: true \ No newline at end of file diff --git a/docs/generators/kotlin.md b/docs/generators/kotlin.md new file mode 100644 index 00000000000..d8cf5fac87d --- /dev/null +++ b/docs/generators/kotlin.md @@ -0,0 +1,329 @@ +--- +title: Documentation for the kotlin generator +--- + +## METADATA + +| Property | Value | Notes | +| -------- | ----- | ----- | +| generator name | kotlin | pass this to the generate command after -g | +| generator stability | EXPERIMENTAL | | +| generator type | CLIENT | | +| generator language | Kotlin | | +| generator language version | 1.9.23 | | +| generator default templating engine | handlebars | | +| helpMsg | Generates a Kotlin client library

Features in this generator:
- v3.0.0 - [v3.1.0](#schema-feature) OpenAPI Specification support
- Very thorough documentation generated in the style of javadocs
- Input types constrained for a Schema in SomeSchema.validate
- validate method can accept arbitrary List/Map/null/int/long/double/float/String json data
- Immutable List output classes generated and returned by validate for List<?> input
- Immutable Map output classes generated and returned by validate for Map<?, ?> input
- Strictly typed list input can be instantiated in client code using generated ListBuilders
- Strictly typed map input can be instantiated in client code using generated MapBuilders
- Sequential map builders are generated ensuring that required properties are set before build is invoked. Looks like:
- `new MapBuilder().requiredA("a").requiredB("b").build()`
- `new MapBuilder().requiredA("a").requiredB("b").optionalProp("c").additionalProperty("someAddProp", "d").build()`
- Run time type checking and validation when
- validating schema payloads
- instantiating List output class (validation run)
- instantiating Map output class (validation run)
- Note: if needed, validation of json schema keywords can be deactivated via a SchemaConfiguration class
- Enums classes are generated and may be input into Schema.validate or the List/MapBuilder add/setter methods
- Invalid (in Kotlin) property names supported like `class`, `1var`, `hi-there` etc in
- component schema names
- schema property names (a fallback setter is written in the MapBuilder)
- Generated interfaces are largely consistent with the python code
- Openapi spec inline schemas supported at any depth in any location
- Format support for: int32, int64, float, double, date, datetime, uuid
- Payload values are not coerced when validated, so a date/date-time value can pass other validations that describe the payload only as type string
- enum types are generated for enums of type string/integer/number/boolean/null
- String transmission of numbers supported with type: string, format: number | | + +## CONFIG OPTIONS +These options may be applied as additional-properties (cli) or configOptions (plugins). Refer to [configuration docs](https://openapi-generator.tech/docs/configuration) for more details. + +| Option | Description | Values | Default | +| ------ | ----------- | ------ | ------- | +|allowUnicodeIdentifiers|boolean, toggles whether unicode identifiers are allowed in names or not, default is false| |false| +|artifactDescription|artifact description in generated pom.xml| |OpenAPI Kotlin| +|artifactUrl|artifact URL in generated pom.xml| |https://github.com/openapi-json-schema-tools/openapi-json-schema-generator| +|artifactVersion|artifact version in generated pom.xml. This also becomes part of the generated library's filename| |1.0.0| +|developerEmail|developer email in generated pom.xml| |team@openapijsonschematools.org| +|developerName|developer name in generated pom.xml| |OpenAPI-Generator Contributors| +|developerOrganization|developer organization in generated pom.xml| |OpenAPITools.org| +|developerOrganizationUrl|developer organization URL in generated pom.xml| |http://openapijsonschematools.org| +|groupId|groupId in generated pom.xml| |org.openapijsonschematools| +|invokerPackage|root package for generated code| |org.openapijsonschematools.client| +|licenseName|The name of the license| |Unlicense| +|licenseUrl|The URL of the license| |http://unlicense.org| +|parentArtifactId|parent artifactId in generated pom N.B. parentGroupId, parentArtifactId and parentVersion must all be specified for any of them to take effect| |null| +|parentGroupId|parent groupId in generated pom N.B. parentGroupId, parentArtifactId and parentVersion must all be specified for any of them to take effect| |null| +|parentVersion|parent version in generated pom N.B. parentGroupId, parentArtifactId and parentVersion must all be specified for any of them to take effect| |null| +|scmConnection|SCM connection in generated pom.xml| |scm:git:git@github.com:openapi-json-schema-tools/openapi-json-schema-generator.git| +|scmDeveloperConnection|SCM developer connection in generated pom.xml| |scm:git:git@github.com:openapi-json-schema-tools/openapi-json-schema-generator.git| +|scmUrl|SCM URL in generated pom.xml| |https://github.com/openapi-json-schema-tools/openapi-json-schema-generator| +|snapshotVersion|Uses a SNAPSHOT version.|
**true**
Use a SnapShot Version
**false**
Use a Release Version
|null| +|sourceFolder|source folder for generated code| |src/main/kotlin| +|testOutput|Set output folder for models and APIs tests| |${project.build.directory}/generated-test-sources/openapi| + +## SUPPORTED VENDOR EXTENSIONS + +| Extension name | Description | Applicable for | Default value | +| -------------- | ----------- | -------------- | ------------- | +|x-enum-varnames|A list of strings that defines the enum variable names, must be adjacent to enum|SCHEMA|[] +|x-enum-descriptions|A list of strings that defines the enum descriptions, must be adjacent to enum|SCHEMA|[] + + +## INSTANTIATION TYPES + +| Type/Alias | Instantiated By | +| ---------- | --------------- | +|array|FrozenList| +|boolean|Boolean| +|integer|Number (Int, Long, Float with integer values, Double with integer values)| +|null|Nothing? (null)| +|number|Number (Int, Long, Float, Double)| +|object|FrozenMap| +|string|String| + + +## LANGUAGE PRIMITIVES + +
    +
  • Any
  • +
  • Boolean
  • +
  • Double
  • +
  • Float
  • +
  • Int
  • +
  • Long
  • +
  • String
  • +
+ +## RESERVED WORDS + +
    +
  • abstract
  • +
  • actual
  • +
  • annotation
  • +
  • apiresponse
  • +
  • as
  • +
  • break
  • +
  • class
  • +
  • companion
  • +
  • const
  • +
  • constructor
  • +
  • continue
  • +
  • contract
  • +
  • crossinline
  • +
  • data
  • +
  • delegate
  • +
  • do
  • +
  • dynamic
  • +
  • else
  • +
  • enum
  • +
  • expect
  • +
  • external
  • +
  • false
  • +
  • field
  • +
  • final
  • +
  • finally
  • +
  • for
  • +
  • fun
  • +
  • if
  • +
  • import
  • +
  • in
  • +
  • infix
  • +
  • init
  • +
  • inline
  • +
  • inner
  • +
  • interface
  • +
  • internal
  • +
  • is
  • +
  • it
  • +
  • lateinit
  • +
  • noinline
  • +
  • null
  • +
  • object
  • +
  • open
  • +
  • operator
  • +
  • out
  • +
  • override
  • +
  • package
  • +
  • param
  • +
  • private
  • +
  • property
  • +
  • protected
  • +
  • public
  • +
  • receiver
  • +
  • reified
  • +
  • return
  • +
  • sealed
  • +
  • setparam
  • +
  • super
  • +
  • suspend
  • +
  • tailrec
  • +
  • this
  • +
  • throw
  • +
  • true
  • +
  • try
  • +
  • typealias
  • +
  • typeof
  • +
  • val
  • +
  • value
  • +
  • var
  • +
  • vararg
  • +
  • when
  • +
  • where
  • +
  • while
  • +
+ +## FEATURE SET + + +### Client Modification Feature +| Name | Supported | Defined By | +| ---- | --------- | ---------- | +|BasePath|✗|ToolingExtension +|Authorizations|✗|ToolingExtension +|UserAgent|✗|ToolingExtension +|MockServer|✗|ToolingExtension + +### Components Feature +| Name | Supported | Defined By | +| ---- | --------- | ---------- | +|schemas|✓|OAS3 +|responses|✓|OAS3 +|parameters|✓|OAS3 +|examples|✗|OAS3 +|requestBodies|✓|OAS3 +|headers|✓|OAS3 +|securitySchemes|✓|OAS3 +|links|✗|OAS3 +|callbacks|✗|OAS3 +|pathItems|✗|OAS3 + +### Data Type Feature +| Name | Supported | Defined By | +| ---- | --------- | ---------- | +|Custom|✗|OAS2,OAS3 +|Int32|✓|OAS2,OAS3 +|Int64|✓|OAS2,OAS3 +|Integer|✓|OAS2,OAS3 +|Float|✓|OAS2,OAS3 +|Double|✓|OAS2,OAS3 +|Number|✓|OAS2,OAS3 +|String|✓|OAS2,OAS3 +|Byte|✗|OAS2,OAS3 +|Binary|✗|OAS2,OAS3 +|Boolean|✓|OAS2,OAS3 +|Date|✓|OAS2,OAS3 +|DateTime|✓|OAS2,OAS3 +|Password|✗|OAS2,OAS3 +|File|✗|OAS2 +|Uuid|✓|OAS2,OAS3 +|Array|✓|OAS2,OAS3 +|Null|✓|OAS3 +|AnyType|✓|OAS2,OAS3 +|Object|✓|OAS2,OAS3 +|Enum|✓|OAS2,OAS3 + +### Documentation Feature +| Name | Supported | Defined By | +| ---- | --------- | ---------- | +|Readme|✓|ToolingExtension +|Servers|✓|OAS3 +|Security|✓|OAS2,OAS3 +|ComponentSchemas|✓|OAS3 +|ComponentResponses|✓|OAS3 +|ComponentParameters|✓|OAS3 +|ComponentRequestBodies|✓|OAS3 +|ComponentHeaders|✓|OAS3 +|ComponentSecuritySchemes|✓|OAS3 +|ComponentLinks|✗|OAS3 +|ComponentCallbacks|✗|OAS3 +|ComponentPathItems|✗|OAS3 +|Api|✓|ToolingExtension + +### Global Feature +| Name | Supported | Defined By | +| ---- | --------- | ---------- | +|Info|✓|OAS2,OAS3 +|Servers|✓|OAS3 +|Paths|✓|OAS2,OAS3 +|Webhooks|✗|OAS3 +|Components|✓|OAS3 +|Security|✓|OAS2,OAS3 +|Tags|✗|OAS2,OAS3 +|ExternalDocs|✗|OAS2,OAS3 + +### Operation Feature +| Name | Supported | Defined By | +| ---- | --------- | ---------- | +|Responses_HttpStatusCode|✓|OAS3 +|Responses_RangedResponseCodes|✓|OAS3 +|Responses_Default|✓|OAS3 +|Responses_RedirectionResponse|✓|OAS3 +|Security|✓|OAS2,OAS3 +|Servers|✓|OAS3 + +### Parameter Feature +| Name | Supported | Defined By | +| ---- | --------- | ---------- | +|Name|✗|OAS2,OAS3 +|Required|✗|OAS2,OAS3 +|In_Path|✗|OAS2,OAS3 +|In_Query|✗|OAS2,OAS3 +|In_Header|✗|OAS2,OAS3 +|In_Cookie|✗|OAS3 +|Style_Matrix|✗|OAS3 +|Style_Label|✗|OAS3 +|Style_Form|✗|OAS3 +|Style_Simple|✗|OAS3 +|Style_SpaceDelimited|✗|OAS3 +|Style_PipeDelimited|✗|OAS3 +|Style_DeepObject|✗|OAS3 +|Explode|✗|OAS3 +|Schema|✗|OAS3 +|Content|✗|OAS3 + +### Schema Feature +| Name | Supported | Defined By | +| ---- | --------- | ---------- | +|AdditionalProperties|✓|OAS2,OAS3 +|AllOf|✓|OAS2,OAS3 +|AnyOf|✓|OAS3 +|Const|✓|OAS3 +|Contains|✓|OAS3 +|Default|✓|OAS2,OAS3 +|DependentRequired|✓|OAS3 +|DependentSchemas|✓|OAS3 +|Discriminator|✗|OAS2,OAS3 +|Else|✓|OAS3 +|Enum|✓|OAS2,OAS3 +|ExclusiveMinimum|✓|OAS2,OAS3 +|ExclusiveMaximum|✓|OAS2,OAS3 +|Format|✓|OAS2,OAS3 +|If|✓|OAS3 +|Items|✓|OAS2,OAS3 +|MaxContains|✓|OAS3 +|MaxItems|✓|OAS2,OAS3 +|MaxLength|✓|OAS2,OAS3 +|MaxProperties|✓|OAS2,OAS3 +|Maximum|✓|OAS2,OAS3 +|MinContains|✓|OAS3 +|MinItems|✓|OAS2,OAS3 +|MinLength|✓|OAS2,OAS3 +|MinProperties|✓|OAS2,OAS3 +|Minimum|✓|OAS2,OAS3 +|MultipleOf|✓|OAS2,OAS3 +|Not|✓|OAS3 +|Nullable|✓|OAS3 +|OneOf|✓|OAS3 +|Pattern|✓|OAS2,OAS3 +|PatternProperties|✓|OAS3 +|PrefixItems|✓|OAS3 +|Properties|✓|OAS2,OAS3 +|PropertyNames|✓|OAS3 +|Ref|✓|OAS2,OAS3 +|Required|✓|OAS2,OAS3 +|Then|✓|OAS3 +|Type|✓|OAS2,OAS3 +|UnevaluatedItems|✓|OAS3 +|UnevaluatedProperties|✓|OAS3 +|UniqueItems|✓|OAS2,OAS3 +|Xml|✗|OAS2,OAS3 + +### Security Feature +| Name | Supported | Defined By | +| ---- | --------- | ---------- | +|HTTP_Basic|✓|OAS2,OAS3 +|ApiKey|✓|OAS2,OAS3 +|OpenIDConnect|✗|OAS3 +|HTTP_Bearer|✓|OAS2,OAS3 +|OAuth2_Implicit|✗|OAS2,OAS3 +|OAuth2_Password|✗|OAS2,OAS3 +|OAuth2_ClientCredentials|✗|OAS2,OAS3 +|OAuth2_AuthorizationCode|✗|OAS2,OAS3 + +### Wire Format Feature +| Name | Supported | Defined By | +| ---- | --------- | ---------- | +|JSON|✓|OAS2,OAS3 +|XML|✗|OAS2,OAS3 +|PROTOBUF|✗|ToolingExtension +|Custom|✗|OAS2,OAS3 diff --git a/samples/client/petstore/kotlin/.gitignore b/samples/client/3_0_3_unit_test/kotlin/.gitignore similarity index 100% rename from samples/client/petstore/kotlin/.gitignore rename to samples/client/3_0_3_unit_test/kotlin/.gitignore diff --git a/samples/client/petstore/kotlin/.openapi-generator-ignore b/samples/client/3_0_3_unit_test/kotlin/.openapi-generator-ignore similarity index 100% rename from samples/client/petstore/kotlin/.openapi-generator-ignore rename to samples/client/3_0_3_unit_test/kotlin/.openapi-generator-ignore diff --git a/samples/client/3_0_3_unit_test/kotlin/.openapi-generator/FILES b/samples/client/3_0_3_unit_test/kotlin/.openapi-generator/FILES new file mode 100644 index 00000000000..d1894677fa0 --- /dev/null +++ b/samples/client/3_0_3_unit_test/kotlin/.openapi-generator/FILES @@ -0,0 +1,304 @@ +.gitignore +README.md +build.gradle.kts +docs/RootServerInfo.md +docs/components/schemas/AdditionalpropertiesAllowsASchemaWhichShouldValidate.md +docs/components/schemas/AdditionalpropertiesAreAllowedByDefault.md +docs/components/schemas/AdditionalpropertiesCanExistByItself.md +docs/components/schemas/AdditionalpropertiesShouldNotLookInApplicators.md +docs/components/schemas/Allof.md +docs/components/schemas/AllofCombinedWithAnyofOneof.md +docs/components/schemas/AllofSimpleTypes.md +docs/components/schemas/AllofWithBaseSchema.md +docs/components/schemas/AllofWithOneEmptySchema.md +docs/components/schemas/AllofWithTheFirstEmptySchema.md +docs/components/schemas/AllofWithTheLastEmptySchema.md +docs/components/schemas/AllofWithTwoEmptySchemas.md +docs/components/schemas/Anyof.md +docs/components/schemas/AnyofComplexTypes.md +docs/components/schemas/AnyofWithBaseSchema.md +docs/components/schemas/AnyofWithOneEmptySchema.md +docs/components/schemas/ArrayTypeMatchesArrays.md +docs/components/schemas/BooleanTypeMatchesBooleans.md +docs/components/schemas/ByInt.md +docs/components/schemas/ByNumber.md +docs/components/schemas/BySmallNumber.md +docs/components/schemas/DateTimeFormat.md +docs/components/schemas/EmailFormat.md +docs/components/schemas/EnumWith0DoesNotMatchFalse.md +docs/components/schemas/EnumWith1DoesNotMatchTrue.md +docs/components/schemas/EnumWithEscapedCharacters.md +docs/components/schemas/EnumWithFalseDoesNotMatch0.md +docs/components/schemas/EnumWithTrueDoesNotMatch1.md +docs/components/schemas/EnumsInProperties.md +docs/components/schemas/ForbiddenProperty.md +docs/components/schemas/HostnameFormat.md +docs/components/schemas/IntegerTypeMatchesIntegers.md +docs/components/schemas/InvalidInstanceShouldNotRaiseErrorWhenFloatDivisionInf.md +docs/components/schemas/InvalidStringValueForDefault.md +docs/components/schemas/Ipv4Format.md +docs/components/schemas/Ipv6Format.md +docs/components/schemas/JsonPointerFormat.md +docs/components/schemas/MaximumValidation.md +docs/components/schemas/MaximumValidationWithUnsignedInteger.md +docs/components/schemas/MaxitemsValidation.md +docs/components/schemas/MaxlengthValidation.md +docs/components/schemas/Maxproperties0MeansTheObjectIsEmpty.md +docs/components/schemas/MaxpropertiesValidation.md +docs/components/schemas/MinimumValidation.md +docs/components/schemas/MinimumValidationWithSignedInteger.md +docs/components/schemas/MinitemsValidation.md +docs/components/schemas/MinlengthValidation.md +docs/components/schemas/MinpropertiesValidation.md +docs/components/schemas/NestedAllofToCheckValidationSemantics.md +docs/components/schemas/NestedAnyofToCheckValidationSemantics.md +docs/components/schemas/NestedItems.md +docs/components/schemas/NestedOneofToCheckValidationSemantics.md +docs/components/schemas/Not.md +docs/components/schemas/NotMoreComplexSchema.md +docs/components/schemas/NulCharactersInStrings.md +docs/components/schemas/NullTypeMatchesOnlyTheNullObject.md +docs/components/schemas/NumberTypeMatchesNumbers.md +docs/components/schemas/ObjectPropertiesValidation.md +docs/components/schemas/ObjectTypeMatchesObjects.md +docs/components/schemas/Oneof.md +docs/components/schemas/OneofComplexTypes.md +docs/components/schemas/OneofWithBaseSchema.md +docs/components/schemas/OneofWithEmptySchema.md +docs/components/schemas/OneofWithRequired.md +docs/components/schemas/PatternIsNotAnchored.md +docs/components/schemas/PatternValidation.md +docs/components/schemas/PropertiesWithEscapedCharacters.md +docs/components/schemas/PropertyNamedRefThatIsNotAReference.md +docs/components/schemas/RefInAdditionalproperties.md +docs/components/schemas/RefInAllof.md +docs/components/schemas/RefInAnyof.md +docs/components/schemas/RefInItems.md +docs/components/schemas/RefInNot.md +docs/components/schemas/RefInOneof.md +docs/components/schemas/RefInProperty.md +docs/components/schemas/RequiredDefaultValidation.md +docs/components/schemas/RequiredValidation.md +docs/components/schemas/RequiredWithEmptyArray.md +docs/components/schemas/RequiredWithEscapedCharacters.md +docs/components/schemas/SimpleEnumValidation.md +docs/components/schemas/StringTypeMatchesStrings.md +docs/components/schemas/TheDefaultKeywordDoesNotDoAnythingIfThePropertyIsMissing.md +docs/components/schemas/UniqueitemsFalseValidation.md +docs/components/schemas/UniqueitemsValidation.md +docs/components/schemas/UriFormat.md +docs/components/schemas/UriReferenceFormat.md +docs/components/schemas/UriTemplateFormat.md +docs/servers/RootServer0.md +settings.gradle.kts +src/main/kotlin/org/openapijsonschematools/client/RootServerInfo.kt +src/main/kotlin/org/openapijsonschematools/client/components/schemas/AdditionalpropertiesAllowsASchemaWhichShouldValidate.kt +src/main/kotlin/org/openapijsonschematools/client/components/schemas/AdditionalpropertiesAreAllowedByDefault.kt +src/main/kotlin/org/openapijsonschematools/client/components/schemas/AdditionalpropertiesCanExistByItself.kt +src/main/kotlin/org/openapijsonschematools/client/components/schemas/AdditionalpropertiesShouldNotLookInApplicators.kt +src/main/kotlin/org/openapijsonschematools/client/components/schemas/Allof.kt +src/main/kotlin/org/openapijsonschematools/client/components/schemas/AllofCombinedWithAnyofOneof.kt +src/main/kotlin/org/openapijsonschematools/client/components/schemas/AllofSimpleTypes.kt +src/main/kotlin/org/openapijsonschematools/client/components/schemas/AllofWithBaseSchema.kt +src/main/kotlin/org/openapijsonschematools/client/components/schemas/AllofWithOneEmptySchema.kt +src/main/kotlin/org/openapijsonschematools/client/components/schemas/AllofWithTheFirstEmptySchema.kt +src/main/kotlin/org/openapijsonschematools/client/components/schemas/AllofWithTheLastEmptySchema.kt +src/main/kotlin/org/openapijsonschematools/client/components/schemas/AllofWithTwoEmptySchemas.kt +src/main/kotlin/org/openapijsonschematools/client/components/schemas/Anyof.kt +src/main/kotlin/org/openapijsonschematools/client/components/schemas/AnyofComplexTypes.kt +src/main/kotlin/org/openapijsonschematools/client/components/schemas/AnyofWithBaseSchema.kt +src/main/kotlin/org/openapijsonschematools/client/components/schemas/AnyofWithOneEmptySchema.kt +src/main/kotlin/org/openapijsonschematools/client/components/schemas/ArrayTypeMatchesArrays.kt +src/main/kotlin/org/openapijsonschematools/client/components/schemas/BooleanTypeMatchesBooleans.kt +src/main/kotlin/org/openapijsonschematools/client/components/schemas/ByInt.kt +src/main/kotlin/org/openapijsonschematools/client/components/schemas/ByNumber.kt +src/main/kotlin/org/openapijsonschematools/client/components/schemas/BySmallNumber.kt +src/main/kotlin/org/openapijsonschematools/client/components/schemas/DateTimeFormat.kt +src/main/kotlin/org/openapijsonschematools/client/components/schemas/EmailFormat.kt +src/main/kotlin/org/openapijsonschematools/client/components/schemas/EnumWith0DoesNotMatchFalse.kt +src/main/kotlin/org/openapijsonschematools/client/components/schemas/EnumWith1DoesNotMatchTrue.kt +src/main/kotlin/org/openapijsonschematools/client/components/schemas/EnumWithEscapedCharacters.kt +src/main/kotlin/org/openapijsonschematools/client/components/schemas/EnumWithFalseDoesNotMatch0.kt +src/main/kotlin/org/openapijsonschematools/client/components/schemas/EnumWithTrueDoesNotMatch1.kt +src/main/kotlin/org/openapijsonschematools/client/components/schemas/EnumsInProperties.kt +src/main/kotlin/org/openapijsonschematools/client/components/schemas/ForbiddenProperty.kt +src/main/kotlin/org/openapijsonschematools/client/components/schemas/HostnameFormat.kt +src/main/kotlin/org/openapijsonschematools/client/components/schemas/IntegerTypeMatchesIntegers.kt +src/main/kotlin/org/openapijsonschematools/client/components/schemas/InvalidInstanceShouldNotRaiseErrorWhenFloatDivisionInf.kt +src/main/kotlin/org/openapijsonschematools/client/components/schemas/InvalidStringValueForDefault.kt +src/main/kotlin/org/openapijsonschematools/client/components/schemas/Ipv4Format.kt +src/main/kotlin/org/openapijsonschematools/client/components/schemas/Ipv6Format.kt +src/main/kotlin/org/openapijsonschematools/client/components/schemas/JsonPointerFormat.kt +src/main/kotlin/org/openapijsonschematools/client/components/schemas/MaximumValidation.kt +src/main/kotlin/org/openapijsonschematools/client/components/schemas/MaximumValidationWithUnsignedInteger.kt +src/main/kotlin/org/openapijsonschematools/client/components/schemas/MaxitemsValidation.kt +src/main/kotlin/org/openapijsonschematools/client/components/schemas/MaxlengthValidation.kt +src/main/kotlin/org/openapijsonschematools/client/components/schemas/Maxproperties0MeansTheObjectIsEmpty.kt +src/main/kotlin/org/openapijsonschematools/client/components/schemas/MaxpropertiesValidation.kt +src/main/kotlin/org/openapijsonschematools/client/components/schemas/MinimumValidation.kt +src/main/kotlin/org/openapijsonschematools/client/components/schemas/MinimumValidationWithSignedInteger.kt +src/main/kotlin/org/openapijsonschematools/client/components/schemas/MinitemsValidation.kt +src/main/kotlin/org/openapijsonschematools/client/components/schemas/MinlengthValidation.kt +src/main/kotlin/org/openapijsonschematools/client/components/schemas/MinpropertiesValidation.kt +src/main/kotlin/org/openapijsonschematools/client/components/schemas/NestedAllofToCheckValidationSemantics.kt +src/main/kotlin/org/openapijsonschematools/client/components/schemas/NestedAnyofToCheckValidationSemantics.kt +src/main/kotlin/org/openapijsonschematools/client/components/schemas/NestedItems.kt +src/main/kotlin/org/openapijsonschematools/client/components/schemas/NestedOneofToCheckValidationSemantics.kt +src/main/kotlin/org/openapijsonschematools/client/components/schemas/Not.kt +src/main/kotlin/org/openapijsonschematools/client/components/schemas/NotMoreComplexSchema.kt +src/main/kotlin/org/openapijsonschematools/client/components/schemas/NulCharactersInStrings.kt +src/main/kotlin/org/openapijsonschematools/client/components/schemas/NullTypeMatchesOnlyTheNullObject.kt +src/main/kotlin/org/openapijsonschematools/client/components/schemas/NumberTypeMatchesNumbers.kt +src/main/kotlin/org/openapijsonschematools/client/components/schemas/ObjectPropertiesValidation.kt +src/main/kotlin/org/openapijsonschematools/client/components/schemas/ObjectTypeMatchesObjects.kt +src/main/kotlin/org/openapijsonschematools/client/components/schemas/Oneof.kt +src/main/kotlin/org/openapijsonschematools/client/components/schemas/OneofComplexTypes.kt +src/main/kotlin/org/openapijsonschematools/client/components/schemas/OneofWithBaseSchema.kt +src/main/kotlin/org/openapijsonschematools/client/components/schemas/OneofWithEmptySchema.kt +src/main/kotlin/org/openapijsonschematools/client/components/schemas/OneofWithRequired.kt +src/main/kotlin/org/openapijsonschematools/client/components/schemas/PatternIsNotAnchored.kt +src/main/kotlin/org/openapijsonschematools/client/components/schemas/PatternValidation.kt +src/main/kotlin/org/openapijsonschematools/client/components/schemas/PropertiesWithEscapedCharacters.kt +src/main/kotlin/org/openapijsonschematools/client/components/schemas/PropertyNamedRefThatIsNotAReference.kt +src/main/kotlin/org/openapijsonschematools/client/components/schemas/RefInAdditionalproperties.kt +src/main/kotlin/org/openapijsonschematools/client/components/schemas/RefInAllof.kt +src/main/kotlin/org/openapijsonschematools/client/components/schemas/RefInAnyof.kt +src/main/kotlin/org/openapijsonschematools/client/components/schemas/RefInItems.kt +src/main/kotlin/org/openapijsonschematools/client/components/schemas/RefInNot.kt +src/main/kotlin/org/openapijsonschematools/client/components/schemas/RefInOneof.kt +src/main/kotlin/org/openapijsonschematools/client/components/schemas/RefInProperty.kt +src/main/kotlin/org/openapijsonschematools/client/components/schemas/RequiredDefaultValidation.kt +src/main/kotlin/org/openapijsonschematools/client/components/schemas/RequiredValidation.kt +src/main/kotlin/org/openapijsonschematools/client/components/schemas/RequiredWithEmptyArray.kt +src/main/kotlin/org/openapijsonschematools/client/components/schemas/RequiredWithEscapedCharacters.kt +src/main/kotlin/org/openapijsonschematools/client/components/schemas/SimpleEnumValidation.kt +src/main/kotlin/org/openapijsonschematools/client/components/schemas/StringTypeMatchesStrings.kt +src/main/kotlin/org/openapijsonschematools/client/components/schemas/TheDefaultKeywordDoesNotDoAnythingIfThePropertyIsMissing.kt +src/main/kotlin/org/openapijsonschematools/client/components/schemas/UniqueitemsFalseValidation.kt +src/main/kotlin/org/openapijsonschematools/client/components/schemas/UniqueitemsValidation.kt +src/main/kotlin/org/openapijsonschematools/client/components/schemas/UriFormat.kt +src/main/kotlin/org/openapijsonschematools/client/components/schemas/UriReferenceFormat.kt +src/main/kotlin/org/openapijsonschematools/client/components/schemas/UriTemplateFormat.kt +src/main/kotlin/org/openapijsonschematools/client/configurations/JsonSchemaKeywordFlags.kt +src/main/kotlin/org/openapijsonschematools/client/configurations/SchemaConfiguration.kt +src/main/kotlin/org/openapijsonschematools/client/exceptions/BaseException.kt +src/main/kotlin/org/openapijsonschematools/client/exceptions/InvalidAdditionalPropertyException.kt +src/main/kotlin/org/openapijsonschematools/client/exceptions/UnsetPropertyException.kt +src/main/kotlin/org/openapijsonschematools/client/exceptions/ValidationException.kt +src/main/kotlin/org/openapijsonschematools/client/schemas/AnyTypeJsonSchema.kt +src/main/kotlin/org/openapijsonschematools/client/schemas/BooleanJsonSchema.kt +src/main/kotlin/org/openapijsonschematools/client/schemas/DateJsonSchema.kt +src/main/kotlin/org/openapijsonschematools/client/schemas/DateTimeJsonSchema.kt +src/main/kotlin/org/openapijsonschematools/client/schemas/DecimalJsonSchema.kt +src/main/kotlin/org/openapijsonschematools/client/schemas/DoubleJsonSchema.kt +src/main/kotlin/org/openapijsonschematools/client/schemas/FloatJsonSchema.kt +src/main/kotlin/org/openapijsonschematools/client/schemas/GenericBuilder.kt +src/main/kotlin/org/openapijsonschematools/client/schemas/Int32JsonSchema.kt +src/main/kotlin/org/openapijsonschematools/client/schemas/Int64JsonSchema.kt +src/main/kotlin/org/openapijsonschematools/client/schemas/IntJsonSchema.kt +src/main/kotlin/org/openapijsonschematools/client/schemas/ListJsonSchema.kt +src/main/kotlin/org/openapijsonschematools/client/schemas/MapJsonSchema.kt +src/main/kotlin/org/openapijsonschematools/client/schemas/NotAnyTypeJsonSchema.kt +src/main/kotlin/org/openapijsonschematools/client/schemas/NullJsonSchema.kt +src/main/kotlin/org/openapijsonschematools/client/schemas/NumberJsonSchema.kt +src/main/kotlin/org/openapijsonschematools/client/schemas/StringJsonSchema.kt +src/main/kotlin/org/openapijsonschematools/client/schemas/UnsetAddPropsSetter.kt +src/main/kotlin/org/openapijsonschematools/client/schemas/UuidJsonSchema.kt +src/main/kotlin/org/openapijsonschematools/client/schemas/validation/AdditionalPropertiesValidator.kt +src/main/kotlin/org/openapijsonschematools/client/schemas/validation/AllOfValidator.kt +src/main/kotlin/org/openapijsonschematools/client/schemas/validation/AnyOfValidator.kt +src/main/kotlin/org/openapijsonschematools/client/schemas/validation/BigDecimalValidator.kt +src/main/kotlin/org/openapijsonschematools/client/schemas/validation/BooleanEnumValidator.kt +src/main/kotlin/org/openapijsonschematools/client/schemas/validation/BooleanSchemaValidator.kt +src/main/kotlin/org/openapijsonschematools/client/schemas/validation/BooleanValueMethod.kt +src/main/kotlin/org/openapijsonschematools/client/schemas/validation/ConstValidator.kt +src/main/kotlin/org/openapijsonschematools/client/schemas/validation/ContainsValidator.kt +src/main/kotlin/org/openapijsonschematools/client/schemas/validation/CustomIsoparser.kt +src/main/kotlin/org/openapijsonschematools/client/schemas/validation/DefaultValueMethod.kt +src/main/kotlin/org/openapijsonschematools/client/schemas/validation/DependentRequiredValidator.kt +src/main/kotlin/org/openapijsonschematools/client/schemas/validation/DependentSchemasValidator.kt +src/main/kotlin/org/openapijsonschematools/client/schemas/validation/DoubleEnumValidator.kt +src/main/kotlin/org/openapijsonschematools/client/schemas/validation/DoubleValueMethod.kt +src/main/kotlin/org/openapijsonschematools/client/schemas/validation/ElseValidator.kt +src/main/kotlin/org/openapijsonschematools/client/schemas/validation/EnumValidator.kt +src/main/kotlin/org/openapijsonschematools/client/schemas/validation/ExclusiveMaximumValidator.kt +src/main/kotlin/org/openapijsonschematools/client/schemas/validation/ExclusiveMinimumValidator.kt +src/main/kotlin/org/openapijsonschematools/client/schemas/validation/FloatEnumValidator.kt +src/main/kotlin/org/openapijsonschematools/client/schemas/validation/FloatValueMethod.kt +src/main/kotlin/org/openapijsonschematools/client/schemas/validation/FormatValidator.kt +src/main/kotlin/org/openapijsonschematools/client/schemas/validation/FrozenList.kt +src/main/kotlin/org/openapijsonschematools/client/schemas/validation/FrozenMap.kt +src/main/kotlin/org/openapijsonschematools/client/schemas/validation/IfValidator.kt +src/main/kotlin/org/openapijsonschematools/client/schemas/validation/IntegerEnumValidator.kt +src/main/kotlin/org/openapijsonschematools/client/schemas/validation/IntegerValueMethod.kt +src/main/kotlin/org/openapijsonschematools/client/schemas/validation/ItemsValidator.kt +src/main/kotlin/org/openapijsonschematools/client/schemas/validation/JsonSchema.kt +src/main/kotlin/org/openapijsonschematools/client/schemas/validation/JsonSchemaFactory.kt +src/main/kotlin/org/openapijsonschematools/client/schemas/validation/JsonSchemaInfo.kt +src/main/kotlin/org/openapijsonschematools/client/schemas/validation/KeywordEntry.kt +src/main/kotlin/org/openapijsonschematools/client/schemas/validation/KeywordValidator.kt +src/main/kotlin/org/openapijsonschematools/client/schemas/validation/LengthValidator.kt +src/main/kotlin/org/openapijsonschematools/client/schemas/validation/ListSchemaValidator.kt +src/main/kotlin/org/openapijsonschematools/client/schemas/validation/LongEnumValidator.kt +src/main/kotlin/org/openapijsonschematools/client/schemas/validation/LongValueMethod.kt +src/main/kotlin/org/openapijsonschematools/client/schemas/validation/MapSchemaValidator.kt +src/main/kotlin/org/openapijsonschematools/client/schemas/validation/MapUtils.kt +src/main/kotlin/org/openapijsonschematools/client/schemas/validation/MaxContainsValidator.kt +src/main/kotlin/org/openapijsonschematools/client/schemas/validation/MaxItemsValidator.kt +src/main/kotlin/org/openapijsonschematools/client/schemas/validation/MaxLengthValidator.kt +src/main/kotlin/org/openapijsonschematools/client/schemas/validation/MaxPropertiesValidator.kt +src/main/kotlin/org/openapijsonschematools/client/schemas/validation/MaximumValidator.kt +src/main/kotlin/org/openapijsonschematools/client/schemas/validation/MinContainsValidator.kt +src/main/kotlin/org/openapijsonschematools/client/schemas/validation/MinItemsValidator.kt +src/main/kotlin/org/openapijsonschematools/client/schemas/validation/MinLengthValidator.kt +src/main/kotlin/org/openapijsonschematools/client/schemas/validation/MinPropertiesValidator.kt +src/main/kotlin/org/openapijsonschematools/client/schemas/validation/MinimumValidator.kt +src/main/kotlin/org/openapijsonschematools/client/schemas/validation/MultipleOfValidator.kt +src/main/kotlin/org/openapijsonschematools/client/schemas/validation/NotValidator.kt +src/main/kotlin/org/openapijsonschematools/client/schemas/validation/NullEnumValidator.kt +src/main/kotlin/org/openapijsonschematools/client/schemas/validation/NullSchemaValidator.kt +src/main/kotlin/org/openapijsonschematools/client/schemas/validation/NullValueMethod.kt +src/main/kotlin/org/openapijsonschematools/client/schemas/validation/NumberSchemaValidator.kt +src/main/kotlin/org/openapijsonschematools/client/schemas/validation/OneOfValidator.kt +src/main/kotlin/org/openapijsonschematools/client/schemas/validation/PathToSchemasMap.kt +src/main/kotlin/org/openapijsonschematools/client/schemas/validation/PatternPropertiesValidator.kt +src/main/kotlin/org/openapijsonschematools/client/schemas/validation/PatternValidator.kt +src/main/kotlin/org/openapijsonschematools/client/schemas/validation/PrefixItemsValidator.kt +src/main/kotlin/org/openapijsonschematools/client/schemas/validation/PropertiesValidator.kt +src/main/kotlin/org/openapijsonschematools/client/schemas/validation/PropertyNamesValidator.kt +src/main/kotlin/org/openapijsonschematools/client/schemas/validation/RequiredValidator.kt +src/main/kotlin/org/openapijsonschematools/client/schemas/validation/StringEnumValidator.kt +src/main/kotlin/org/openapijsonschematools/client/schemas/validation/StringSchemaValidator.kt +src/main/kotlin/org/openapijsonschematools/client/schemas/validation/StringValueMethod.kt +src/main/kotlin/org/openapijsonschematools/client/schemas/validation/ThenValidator.kt +src/main/kotlin/org/openapijsonschematools/client/schemas/validation/TypeValidator.kt +src/main/kotlin/org/openapijsonschematools/client/schemas/validation/UnevaluatedItemsValidator.kt +src/main/kotlin/org/openapijsonschematools/client/schemas/validation/UnevaluatedPropertiesValidator.kt +src/main/kotlin/org/openapijsonschematools/client/schemas/validation/UniqueItemsValidator.kt +src/main/kotlin/org/openapijsonschematools/client/schemas/validation/UnsetAnyTypeJsonSchema.kt +src/main/kotlin/org/openapijsonschematools/client/schemas/validation/ValidationData.kt +src/main/kotlin/org/openapijsonschematools/client/schemas/validation/ValidationMetadata.kt +src/main/kotlin/org/openapijsonschematools/client/servers/RootServer0.kt +src/main/kotlin/org/openapijsonschematools/client/servers/Server.kt +src/main/kotlin/org/openapijsonschematools/client/servers/ServerProvider.kt +src/main/kotlin/org/openapijsonschematools/client/servers/ServerWithVariables.kt +src/main/kotlin/org/openapijsonschematools/client/servers/ServerWithoutVariables.kt +src/test/kotlin/org/openapijsonschematools/client/configurations/JsonSchemaKeywordFlagsTest.kt +src/test/kotlin/org/openapijsonschematools/client/schemas/AnyTypeSchemaTest.kt +src/test/kotlin/org/openapijsonschematools/client/schemas/ArrayTypeSchemaTest.kt +src/test/kotlin/org/openapijsonschematools/client/schemas/BooleanSchemaTest.kt +src/test/kotlin/org/openapijsonschematools/client/schemas/ListBuilderTest.kt +src/test/kotlin/org/openapijsonschematools/client/schemas/ListSchemaTest.kt +src/test/kotlin/org/openapijsonschematools/client/schemas/MapSchemaTest.kt +src/test/kotlin/org/openapijsonschematools/client/schemas/NullSchemaTest.kt +src/test/kotlin/org/openapijsonschematools/client/schemas/NumberSchemaTest.kt +src/test/kotlin/org/openapijsonschematools/client/schemas/ObjectTypeSchemaTest.kt +src/test/kotlin/org/openapijsonschematools/client/schemas/RefBooleanSchemaTest.kt +src/test/kotlin/org/openapijsonschematools/client/schemas/validation/AdditionalPropertiesValidatorTest.kt +src/test/kotlin/org/openapijsonschematools/client/schemas/validation/CustomIsoparserTest.kt +src/test/kotlin/org/openapijsonschematools/client/schemas/validation/FormatValidatorTest.kt +src/test/kotlin/org/openapijsonschematools/client/schemas/validation/ItemsValidatorTest.kt +src/test/kotlin/org/openapijsonschematools/client/schemas/validation/JsonSchemaTest.kt +src/test/kotlin/org/openapijsonschematools/client/schemas/validation/PropertiesValidatorTest.kt +src/test/kotlin/org/openapijsonschematools/client/schemas/validation/RequiredValidatorTest.kt +src/test/kotlin/org/openapijsonschematools/client/schemas/validation/TypeValidatorTest.kt diff --git a/samples/client/petstore/kotlin/.openapi-generator/VERSION b/samples/client/3_0_3_unit_test/kotlin/.openapi-generator/VERSION similarity index 100% rename from samples/client/petstore/kotlin/.openapi-generator/VERSION rename to samples/client/3_0_3_unit_test/kotlin/.openapi-generator/VERSION diff --git a/samples/client/3_0_3_unit_test/kotlin/README.md b/samples/client/3_0_3_unit_test/kotlin/README.md new file mode 100644 index 00000000000..90844f8e353 --- /dev/null +++ b/samples/client/3_0_3_unit_test/kotlin/README.md @@ -0,0 +1,224 @@ +# unit-test-api +sample spec for testing openapi functionality, built from json schema tests for draft6 + +This Kotlin package is automatically generated by the [OpenAPI JSON Schema Generator](https://github.com/openapi-json-schema-tools/openapi-json-schema-generator) project: + +- OpenAPI document version: 0.0.1 +- Kotlin Package version: 0.0.1 +- OpenAPI JSON Schema Generator, Generator: KotlinClientGenerator + +## Requirements + +1. Kotlin 1.9.23 +2. Gradle + +## Installation + +To install the API client library to your local Maven repository, simply execute: + +```shell +gradle wrapper +gradlew clean build +``` + +### Gradle users + +Add this dependency to your project's build file: + +``` +repositories { + mavenCentral() // Needed if the 'unit-test-api' jar has been published to maven centra + mavenLocal() // Needed if the 'unit-test-api' jar has been published to the local maven repo +} + +dependencies { + implementation "org.openapijsonschematools:unit-test-api:0.0.1" +} +``` + +## Usage Notes +### Validation, Immutability, and Data Type +This Kotlin code validates data to schema classes and return back an immutable instance containing the data. This ensure that +- valid data cannot be mutated and become invalid to a set of schemas + - the one exception is that files are not immutable, so schema instances storing/sending/receiving files are not immutable + +Here is the mapping from json schema types to Kotlin types: + +| Json Schema Type | Kotlin Base Class | +| ---------------- | --------------- | +| object | FrozenMap (Map) | +| array | FrozenList (List) | +| string | String | +| number | Number (int, long, float, double) | +| integer | int, long, float, double (with values equal to integers) | +| boolean | boolean | +| null | Nothing? (null) | +| AnyType (unset) | Object? | + +### Storage of Json Schema Definition in Kotlin JsonSchema Classes +In openapi v3.0.3 there are ~ 28 json schema keywords. Almost all of them can apply if +type is unset. I have chosen to separate the storage of +- json schema definition info +- output classes for validated Map (json schema type object) payloads +- output classes for validated List (json schema type array) payloads + +
+ Reason + +This json schema data is stored in each class that is written for a schema, in a component or +other openapi document location. This class is only responsible for storing schema info. +Output classes like those that store map payloads are written separately and are +returned by the JsonSchema.validate method when that method is passed in Map input. +This prevents payload property access methods from +colliding with json schema definition. +
+ +### Json Schema Type Object +Most component schemas (models) are probably of type object. Which is a map data structure. +Json schema allows string keys in this map, which means schema properties can have key names that are +invalid Kotlin variable names. Names like: +- "hi-there" +- "1variable" +- "@now" +- " " +- "from" + +To allow these use cases to work, FrozenMap (which extends AbstractMap) is used as the base class of type object schemas. +This means that one can use normal Map methods on instances of these classes. + +
+ Other Details + +- getters are written for validly named required and optional properties +- null is only allowed in as a value if type: "null" was included or nullable: true was set + - because null is an allowed property value, it is not used to represent an unset property state +- if an optional property is requested and it does not exist in the Map, an UnsetPropertyException is thrown +
+ +### Json Schema Type + Format, Validated Data Storage +N schemas can be validated on the same payload. +To allow multiple schemas to validate, the data must be stored using one base class whether or not +a json schema format constraint exists in the schema. + +In json schema, type: number with no format validates both integers and floats, +so int and float values are stored for type number. + +
+ String + Date Example + +For example the string payload '2023-12-20' is validates to both of these schemas: +1. string only +``` +- type: string +``` +2. string and date format +``` +- type: string + format: date +``` +Because of use cases like this, a LocalDate is allowed as an input to this schema, but the data +is stored as a string. +
+ +## Getting Started + +Please follow the [installation procedure](#installation) and then use the JsonSchema classes in +org.openapijsonschematools.client.components.schemas to validate input payloads and instances of validated Map and List +output classes. Json schemas allow multiple types for one schema, so a schema's validate method can have +allowed input and output types. + +## Servers +| server_index | Class | Description | +| ------------ | ----- | ----------- | +| 0 | [RootServer0](docs/servers/RootServer0.md) | | + +## Component Schemas +| Class | Description | +| ----- | ----------- | +| [AdditionalpropertiesAllowsASchemaWhichShouldValidate.AdditionalpropertiesAllowsASchemaWhichShouldValidate1](docs/components/schemas/AdditionalpropertiesAllowsASchemaWhichShouldValidate.md#additionalpropertiesallowsaschemawhichshouldvalidate1) | | +| [AdditionalpropertiesAreAllowedByDefault.AdditionalpropertiesAreAllowedByDefault1](docs/components/schemas/AdditionalpropertiesAreAllowedByDefault.md#additionalpropertiesareallowedbydefault1) | | +| [AdditionalpropertiesCanExistByItself.AdditionalpropertiesCanExistByItself1](docs/components/schemas/AdditionalpropertiesCanExistByItself.md#additionalpropertiescanexistbyitself1) | | +| [AdditionalpropertiesShouldNotLookInApplicators.AdditionalpropertiesShouldNotLookInApplicators1](docs/components/schemas/AdditionalpropertiesShouldNotLookInApplicators.md#additionalpropertiesshouldnotlookinapplicators1) | | +| [Allof.Allof1](docs/components/schemas/Allof.md#allof1) | | +| [AllofCombinedWithAnyofOneof.AllofCombinedWithAnyofOneof1](docs/components/schemas/AllofCombinedWithAnyofOneof.md#allofcombinedwithanyofoneof1) | | +| [AllofSimpleTypes.AllofSimpleTypes1](docs/components/schemas/AllofSimpleTypes.md#allofsimpletypes1) | | +| [AllofWithBaseSchema.AllofWithBaseSchema1](docs/components/schemas/AllofWithBaseSchema.md#allofwithbaseschema1) | | +| [AllofWithOneEmptySchema.AllofWithOneEmptySchema1](docs/components/schemas/AllofWithOneEmptySchema.md#allofwithoneemptyschema1) | | +| [AllofWithTheFirstEmptySchema.AllofWithTheFirstEmptySchema1](docs/components/schemas/AllofWithTheFirstEmptySchema.md#allofwiththefirstemptyschema1) | | +| [AllofWithTheLastEmptySchema.AllofWithTheLastEmptySchema1](docs/components/schemas/AllofWithTheLastEmptySchema.md#allofwiththelastemptyschema1) | | +| [AllofWithTwoEmptySchemas.AllofWithTwoEmptySchemas1](docs/components/schemas/AllofWithTwoEmptySchemas.md#allofwithtwoemptyschemas1) | | +| [Anyof.Anyof1](docs/components/schemas/Anyof.md#anyof1) | | +| [AnyofComplexTypes.AnyofComplexTypes1](docs/components/schemas/AnyofComplexTypes.md#anyofcomplextypes1) | | +| [AnyofWithBaseSchema.AnyofWithBaseSchema1](docs/components/schemas/AnyofWithBaseSchema.md#anyofwithbaseschema1) | | +| [AnyofWithOneEmptySchema.AnyofWithOneEmptySchema1](docs/components/schemas/AnyofWithOneEmptySchema.md#anyofwithoneemptyschema1) | | +| [ArrayTypeMatchesArrays.ArrayTypeMatchesArrays1](docs/components/schemas/ArrayTypeMatchesArrays.md#arraytypematchesarrays1) | | +| [BooleanTypeMatchesBooleans.BooleanTypeMatchesBooleans1](docs/components/schemas/BooleanTypeMatchesBooleans.md#booleantypematchesbooleans1) | | +| [ByInt.ByInt1](docs/components/schemas/ByInt.md#byint1) | | +| [ByNumber.ByNumber1](docs/components/schemas/ByNumber.md#bynumber1) | | +| [BySmallNumber.BySmallNumber1](docs/components/schemas/BySmallNumber.md#bysmallnumber1) | | +| [DateTimeFormat.DateTimeFormat1](docs/components/schemas/DateTimeFormat.md#datetimeformat1) | | +| [EmailFormat.EmailFormat1](docs/components/schemas/EmailFormat.md#emailformat1) | | +| [EnumWith0DoesNotMatchFalse.EnumWith0DoesNotMatchFalse1](docs/components/schemas/EnumWith0DoesNotMatchFalse.md#enumwith0doesnotmatchfalse1) | | +| [EnumWith1DoesNotMatchTrue.EnumWith1DoesNotMatchTrue1](docs/components/schemas/EnumWith1DoesNotMatchTrue.md#enumwith1doesnotmatchtrue1) | | +| [EnumWithEscapedCharacters.EnumWithEscapedCharacters1](docs/components/schemas/EnumWithEscapedCharacters.md#enumwithescapedcharacters1) | | +| [EnumWithFalseDoesNotMatch0.EnumWithFalseDoesNotMatch01](docs/components/schemas/EnumWithFalseDoesNotMatch0.md#enumwithfalsedoesnotmatch01) | | +| [EnumWithTrueDoesNotMatch1.EnumWithTrueDoesNotMatch11](docs/components/schemas/EnumWithTrueDoesNotMatch1.md#enumwithtruedoesnotmatch11) | | +| [EnumsInProperties.EnumsInProperties1](docs/components/schemas/EnumsInProperties.md#enumsinproperties1) | | +| [ForbiddenProperty.ForbiddenProperty1](docs/components/schemas/ForbiddenProperty.md#forbiddenproperty1) | | +| [HostnameFormat.HostnameFormat1](docs/components/schemas/HostnameFormat.md#hostnameformat1) | | +| [IntegerTypeMatchesIntegers.IntegerTypeMatchesIntegers1](docs/components/schemas/IntegerTypeMatchesIntegers.md#integertypematchesintegers1) | | +| [InvalidInstanceShouldNotRaiseErrorWhenFloatDivisionInf.InvalidInstanceShouldNotRaiseErrorWhenFloatDivisionInf1](docs/components/schemas/InvalidInstanceShouldNotRaiseErrorWhenFloatDivisionInf.md#invalidinstanceshouldnotraiseerrorwhenfloatdivisioninf1) | | +| [InvalidStringValueForDefault.InvalidStringValueForDefault1](docs/components/schemas/InvalidStringValueForDefault.md#invalidstringvaluefordefault1) | | +| [Ipv4Format.Ipv4Format1](docs/components/schemas/Ipv4Format.md#ipv4format1) | | +| [Ipv6Format.Ipv6Format1](docs/components/schemas/Ipv6Format.md#ipv6format1) | | +| [JsonPointerFormat.JsonPointerFormat1](docs/components/schemas/JsonPointerFormat.md#jsonpointerformat1) | | +| [MaximumValidation.MaximumValidation1](docs/components/schemas/MaximumValidation.md#maximumvalidation1) | | +| [MaximumValidationWithUnsignedInteger.MaximumValidationWithUnsignedInteger1](docs/components/schemas/MaximumValidationWithUnsignedInteger.md#maximumvalidationwithunsignedinteger1) | | +| [MaxitemsValidation.MaxitemsValidation1](docs/components/schemas/MaxitemsValidation.md#maxitemsvalidation1) | | +| [MaxlengthValidation.MaxlengthValidation1](docs/components/schemas/MaxlengthValidation.md#maxlengthvalidation1) | | +| [Maxproperties0MeansTheObjectIsEmpty.Maxproperties0MeansTheObjectIsEmpty1](docs/components/schemas/Maxproperties0MeansTheObjectIsEmpty.md#maxproperties0meanstheobjectisempty1) | | +| [MaxpropertiesValidation.MaxpropertiesValidation1](docs/components/schemas/MaxpropertiesValidation.md#maxpropertiesvalidation1) | | +| [MinimumValidation.MinimumValidation1](docs/components/schemas/MinimumValidation.md#minimumvalidation1) | | +| [MinimumValidationWithSignedInteger.MinimumValidationWithSignedInteger1](docs/components/schemas/MinimumValidationWithSignedInteger.md#minimumvalidationwithsignedinteger1) | | +| [MinitemsValidation.MinitemsValidation1](docs/components/schemas/MinitemsValidation.md#minitemsvalidation1) | | +| [MinlengthValidation.MinlengthValidation1](docs/components/schemas/MinlengthValidation.md#minlengthvalidation1) | | +| [MinpropertiesValidation.MinpropertiesValidation1](docs/components/schemas/MinpropertiesValidation.md#minpropertiesvalidation1) | | +| [NestedAllofToCheckValidationSemantics.NestedAllofToCheckValidationSemantics1](docs/components/schemas/NestedAllofToCheckValidationSemantics.md#nestedalloftocheckvalidationsemantics1) | | +| [NestedAnyofToCheckValidationSemantics.NestedAnyofToCheckValidationSemantics1](docs/components/schemas/NestedAnyofToCheckValidationSemantics.md#nestedanyoftocheckvalidationsemantics1) | | +| [NestedItems.NestedItems1](docs/components/schemas/NestedItems.md#nesteditems1) | | +| [NestedOneofToCheckValidationSemantics.NestedOneofToCheckValidationSemantics1](docs/components/schemas/NestedOneofToCheckValidationSemantics.md#nestedoneoftocheckvalidationsemantics1) | | +| [Not.Not1](docs/components/schemas/Not.md#not1) | | +| [NotMoreComplexSchema.NotMoreComplexSchema1](docs/components/schemas/NotMoreComplexSchema.md#notmorecomplexschema1) | | +| [NulCharactersInStrings.NulCharactersInStrings1](docs/components/schemas/NulCharactersInStrings.md#nulcharactersinstrings1) | | +| [NullTypeMatchesOnlyTheNullObject.NullTypeMatchesOnlyTheNullObject1](docs/components/schemas/NullTypeMatchesOnlyTheNullObject.md#nulltypematchesonlythenullobject1) | | +| [NumberTypeMatchesNumbers.NumberTypeMatchesNumbers1](docs/components/schemas/NumberTypeMatchesNumbers.md#numbertypematchesnumbers1) | | +| [ObjectPropertiesValidation.ObjectPropertiesValidation1](docs/components/schemas/ObjectPropertiesValidation.md#objectpropertiesvalidation1) | | +| [ObjectTypeMatchesObjects.ObjectTypeMatchesObjects1](docs/components/schemas/ObjectTypeMatchesObjects.md#objecttypematchesobjects1) | | +| [Oneof.Oneof1](docs/components/schemas/Oneof.md#oneof1) | | +| [OneofComplexTypes.OneofComplexTypes1](docs/components/schemas/OneofComplexTypes.md#oneofcomplextypes1) | | +| [OneofWithBaseSchema.OneofWithBaseSchema1](docs/components/schemas/OneofWithBaseSchema.md#oneofwithbaseschema1) | | +| [OneofWithEmptySchema.OneofWithEmptySchema1](docs/components/schemas/OneofWithEmptySchema.md#oneofwithemptyschema1) | | +| [OneofWithRequired.OneofWithRequired1](docs/components/schemas/OneofWithRequired.md#oneofwithrequired1) | | +| [PatternIsNotAnchored.PatternIsNotAnchored1](docs/components/schemas/PatternIsNotAnchored.md#patternisnotanchored1) | | +| [PatternValidation.PatternValidation1](docs/components/schemas/PatternValidation.md#patternvalidation1) | | +| [PropertiesWithEscapedCharacters.PropertiesWithEscapedCharacters1](docs/components/schemas/PropertiesWithEscapedCharacters.md#propertieswithescapedcharacters1) | | +| [PropertyNamedRefThatIsNotAReference.PropertyNamedRefThatIsNotAReference1](docs/components/schemas/PropertyNamedRefThatIsNotAReference.md#propertynamedrefthatisnotareference1) | | +| [RefInAdditionalproperties.RefInAdditionalproperties1](docs/components/schemas/RefInAdditionalproperties.md#refinadditionalproperties1) | | +| [RefInAllof.RefInAllof1](docs/components/schemas/RefInAllof.md#refinallof1) | | +| [RefInAnyof.RefInAnyof1](docs/components/schemas/RefInAnyof.md#refinanyof1) | | +| [RefInItems.RefInItems1](docs/components/schemas/RefInItems.md#refinitems1) | | +| [RefInNot.RefInNot1](docs/components/schemas/RefInNot.md#refinnot1) | | +| [RefInOneof.RefInOneof1](docs/components/schemas/RefInOneof.md#refinoneof1) | | +| [RefInProperty.RefInProperty1](docs/components/schemas/RefInProperty.md#refinproperty1) | | +| [RequiredDefaultValidation.RequiredDefaultValidation1](docs/components/schemas/RequiredDefaultValidation.md#requireddefaultvalidation1) | | +| [RequiredValidation.RequiredValidation1](docs/components/schemas/RequiredValidation.md#requiredvalidation1) | | +| [RequiredWithEmptyArray.RequiredWithEmptyArray1](docs/components/schemas/RequiredWithEmptyArray.md#requiredwithemptyarray1) | | +| [RequiredWithEscapedCharacters.RequiredWithEscapedCharacters1](docs/components/schemas/RequiredWithEscapedCharacters.md#requiredwithescapedcharacters1) | | +| [SimpleEnumValidation.SimpleEnumValidation1](docs/components/schemas/SimpleEnumValidation.md#simpleenumvalidation1) | | +| [StringTypeMatchesStrings.StringTypeMatchesStrings1](docs/components/schemas/StringTypeMatchesStrings.md#stringtypematchesstrings1) | | +| [TheDefaultKeywordDoesNotDoAnythingIfThePropertyIsMissing.TheDefaultKeywordDoesNotDoAnythingIfThePropertyIsMissing1](docs/components/schemas/TheDefaultKeywordDoesNotDoAnythingIfThePropertyIsMissing.md#thedefaultkeyworddoesnotdoanythingifthepropertyismissing1) | | +| [UniqueitemsFalseValidation.UniqueitemsFalseValidation1](docs/components/schemas/UniqueitemsFalseValidation.md#uniqueitemsfalsevalidation1) | | +| [UniqueitemsValidation.UniqueitemsValidation1](docs/components/schemas/UniqueitemsValidation.md#uniqueitemsvalidation1) | | +| [UriFormat.UriFormat1](docs/components/schemas/UriFormat.md#uriformat1) | | +| [UriReferenceFormat.UriReferenceFormat1](docs/components/schemas/UriReferenceFormat.md#urireferenceformat1) | | +| [UriTemplateFormat.UriTemplateFormat1](docs/components/schemas/UriTemplateFormat.md#uritemplateformat1) | | diff --git a/samples/client/petstore/kotlin/build.gradle.kts b/samples/client/3_0_3_unit_test/kotlin/build.gradle.kts similarity index 71% rename from samples/client/petstore/kotlin/build.gradle.kts rename to samples/client/3_0_3_unit_test/kotlin/build.gradle.kts index c0c0d5f25a0..0f8b6b3945c 100644 --- a/samples/client/petstore/kotlin/build.gradle.kts +++ b/samples/client/3_0_3_unit_test/kotlin/build.gradle.kts @@ -1,6 +1,5 @@ plugins { kotlin("jvm") version "1.9.23" - id("org.checkerframework") version "0.6.33" } repositories { @@ -11,28 +10,30 @@ repositories { } dependencies { + implementation(kotlin("reflect")) + testImplementation(kotlin("test")) implementation("org.checkerframework:checker-qual:3.42.0") implementation("com.google.code.gson:gson:2.10.1") testImplementation("junit:junit:4.13.2") } group = "org.openapijsonschematools" -version = "1.0.0" +version = "0.0.1" description = "OpenAPI Kotlin" - java { toolchain { languageVersion.set(JavaLanguageVersion.of(17)) } - withSourcesJar() - withJavadocJar() -} - -kotlin { - jvmToolchain(17) } tasks.wrapper { gradleVersion = "8.1.1" +} + +tasks.test { + useJUnitPlatform() + testLogging { + events( "started", "passed", "skipped", "failed") + } } \ No newline at end of file diff --git a/samples/client/petstore/kotlin/docs/RootServerInfo.md b/samples/client/3_0_3_unit_test/kotlin/docs/RootServerInfo.md similarity index 77% rename from samples/client/petstore/kotlin/docs/RootServerInfo.md rename to samples/client/3_0_3_unit_test/kotlin/docs/RootServerInfo.md index efe32cf743d..46c3ca818e6 100644 --- a/samples/client/petstore/kotlin/docs/RootServerInfo.md +++ b/samples/client/3_0_3_unit_test/kotlin/docs/RootServerInfo.md @@ -23,14 +23,12 @@ A class that stores servers and allows one to be returned with a ServerIndex ins ### Constructor Summary | Constructor and Description | | --------------------------- | -| RootServerInfo1(@Nullable [RootServer0](servers/RootServer0.md) server0,@Nullable [RootServer1](servers/RootServer1.md) server1,@Nullable [RootServer2](servers/RootServer2.md) server2)
Creates an instance using passed in servers | +| RootServerInfo1(@Nullable [RootServer0](servers/RootServer0.md) server0)
Creates an instance using passed in servers | ### Field Summary | Modifier and Type | Field and Description | | ----------------- | --------------------- | | [RootServer0](servers/RootServer0.md) | server0 | -| [RootServer1](servers/RootServer1.md) | server1 | -| [RootServer2](servers/RootServer2.md) | server2 | ### Method Summary | Modifier and Type | Method and Description | @@ -50,8 +48,6 @@ a builder for [RootServerInfo1](#rootserverinfo1) | Modifier and Type | Method and Description | | ----------------- | ---------------------- | | [RootServerInfoBuilder](#rootserverinfobuilder) | rootServer0([RootServer0](servers/RootServer0.md) server0)
sets the server | -| [RootServerInfoBuilder](#rootserverinfobuilder) | rootServer1([RootServer1](servers/RootServer1.md) server1)
sets the server | -| [RootServerInfoBuilder](#rootserverinfobuilder) | rootServer2([RootServer2](servers/RootServer2.md) server2)
sets the server | | [RootServerInfo1](#rootserverinfo1) | build() | ## ServerIndex @@ -61,5 +57,3 @@ enum ServerIndex
| Enum Constant And Description | | ----------------------------- | | SERVER_0
server 0 | -| SERVER_1
server 1 | -| SERVER_2
server 2 | diff --git a/samples/client/3_0_3_unit_test/kotlin/docs/components/schemas/AdditionalpropertiesAllowsASchemaWhichShouldValidate.md b/samples/client/3_0_3_unit_test/kotlin/docs/components/schemas/AdditionalpropertiesAllowsASchemaWhichShouldValidate.md new file mode 100644 index 00000000000..4cb6a86186d --- /dev/null +++ b/samples/client/3_0_3_unit_test/kotlin/docs/components/schemas/AdditionalpropertiesAllowsASchemaWhichShouldValidate.md @@ -0,0 +1,446 @@ +# AdditionalpropertiesAllowsASchemaWhichShouldValidate +org.openapijsonschematools.client.components.schemas.AdditionalpropertiesAllowsASchemaWhichShouldValidate.java +class AdditionalpropertiesAllowsASchemaWhichShouldValidate
+ +A class that contains necessary nested +- schema classes (which validate payloads), extends JsonSchema +- sealed interfaces which store validated payloads, Kotlin version of a sum type +- boxed classes which store validated payloads, sealed permits class implementations +- classes to store validated map payloads, extends FrozenMap +- classes to build inputs for map payloads + +## Nested Class Summary +| Modifier and Type | Class and Description | +| ----------------- | ---------------------- | +| sealed interface | [AdditionalpropertiesAllowsASchemaWhichShouldValidate.AdditionalpropertiesAllowsASchemaWhichShouldValidate1Boxed](#additionalpropertiesallowsaschemawhichshouldvalidate1boxed)
sealed interface for validated payloads | +| record | [AdditionalpropertiesAllowsASchemaWhichShouldValidate.AdditionalpropertiesAllowsASchemaWhichShouldValidate1BoxedMap](#additionalpropertiesallowsaschemawhichshouldvalidate1boxedmap)
boxed class to store validated Map payloads | +| static class | [AdditionalpropertiesAllowsASchemaWhichShouldValidate.AdditionalpropertiesAllowsASchemaWhichShouldValidate1](#additionalpropertiesallowsaschemawhichshouldvalidate1)
schema class | +| static class | [AdditionalpropertiesAllowsASchemaWhichShouldValidate.AdditionalpropertiesAllowsASchemaWhichShouldValidateMapBuilder](#additionalpropertiesallowsaschemawhichshouldvalidatemapbuilder)
builder for Map payloads | +| static class | [AdditionalpropertiesAllowsASchemaWhichShouldValidate.AdditionalpropertiesAllowsASchemaWhichShouldValidateMap](#additionalpropertiesallowsaschemawhichshouldvalidatemap)
output class for Map payloads | +| sealed interface | [AdditionalpropertiesAllowsASchemaWhichShouldValidate.BarBoxed](#barboxed)
sealed interface for validated payloads | +| record | [AdditionalpropertiesAllowsASchemaWhichShouldValidate.BarBoxedVoid](#barboxedvoid)
boxed class to store validated null payloads | +| record | [AdditionalpropertiesAllowsASchemaWhichShouldValidate.BarBoxedBoolean](#barboxedboolean)
boxed class to store validated boolean payloads | +| record | [AdditionalpropertiesAllowsASchemaWhichShouldValidate.BarBoxedNumber](#barboxednumber)
boxed class to store validated Number payloads | +| record | [AdditionalpropertiesAllowsASchemaWhichShouldValidate.BarBoxedString](#barboxedstring)
boxed class to store validated String payloads | +| record | [AdditionalpropertiesAllowsASchemaWhichShouldValidate.BarBoxedList](#barboxedlist)
boxed class to store validated List payloads | +| record | [AdditionalpropertiesAllowsASchemaWhichShouldValidate.BarBoxedMap](#barboxedmap)
boxed class to store validated Map payloads | +| static class | [AdditionalpropertiesAllowsASchemaWhichShouldValidate.Bar](#bar)
schema class | +| sealed interface | [AdditionalpropertiesAllowsASchemaWhichShouldValidate.FooBoxed](#fooboxed)
sealed interface for validated payloads | +| record | [AdditionalpropertiesAllowsASchemaWhichShouldValidate.FooBoxedVoid](#fooboxedvoid)
boxed class to store validated null payloads | +| record | [AdditionalpropertiesAllowsASchemaWhichShouldValidate.FooBoxedBoolean](#fooboxedboolean)
boxed class to store validated boolean payloads | +| record | [AdditionalpropertiesAllowsASchemaWhichShouldValidate.FooBoxedNumber](#fooboxednumber)
boxed class to store validated Number payloads | +| record | [AdditionalpropertiesAllowsASchemaWhichShouldValidate.FooBoxedString](#fooboxedstring)
boxed class to store validated String payloads | +| record | [AdditionalpropertiesAllowsASchemaWhichShouldValidate.FooBoxedList](#fooboxedlist)
boxed class to store validated List payloads | +| record | [AdditionalpropertiesAllowsASchemaWhichShouldValidate.FooBoxedMap](#fooboxedmap)
boxed class to store validated Map payloads | +| static class | [AdditionalpropertiesAllowsASchemaWhichShouldValidate.Foo](#foo)
schema class | +| sealed interface | [AdditionalpropertiesAllowsASchemaWhichShouldValidate.AdditionalPropertiesBoxed](#additionalpropertiesboxed)
sealed interface for validated payloads | +| record | [AdditionalpropertiesAllowsASchemaWhichShouldValidate.AdditionalPropertiesBoxedBoolean](#additionalpropertiesboxedboolean)
boxed class to store validated boolean payloads | +| static class | [AdditionalpropertiesAllowsASchemaWhichShouldValidate.AdditionalProperties](#additionalproperties)
schema class | + +## AdditionalpropertiesAllowsASchemaWhichShouldValidate1Boxed +sealed interface AdditionalpropertiesAllowsASchemaWhichShouldValidate1Boxed
+permits
+[AdditionalpropertiesAllowsASchemaWhichShouldValidate1BoxedMap](#additionalpropertiesallowsaschemawhichshouldvalidate1boxedmap) + +sealed interface that stores validated payloads using boxed classes + +## AdditionalpropertiesAllowsASchemaWhichShouldValidate1BoxedMap +data class AdditionalpropertiesAllowsASchemaWhichShouldValidate1BoxedMap
+implements [AdditionalpropertiesAllowsASchemaWhichShouldValidate1Boxed](#additionalpropertiesallowsaschemawhichshouldvalidate1boxed) + +data class that stores validated Map payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| AdditionalpropertiesAllowsASchemaWhichShouldValidate1BoxedMap([AdditionalpropertiesAllowsASchemaWhichShouldValidateMap](#additionalpropertiesallowsaschemawhichshouldvalidatemap) data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| [AdditionalpropertiesAllowsASchemaWhichShouldValidateMap](#additionalpropertiesallowsaschemawhichshouldvalidatemap) | data()
validated payload | +| Any? | getData()
validated payload | + +## AdditionalpropertiesAllowsASchemaWhichShouldValidate1 +class AdditionalpropertiesAllowsASchemaWhichShouldValidate1
+extends JsonSchema + +A schema class that validates payloads + +### Code Sample +``` +import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags; +import org.openapijsonschematools.client.configurations.SchemaConfiguration; +import org.openapijsonschematools.client.exceptions.ValidationException; +import org.openapijsonschematools.client.schemas.validation.MapUtils; +import org.openapijsonschematools.client.schemas.validation.FrozenList; +import org.openapijsonschematools.client.schemas.validation.FrozenMap; +import org.openapijsonschematools.client.components.schemas.AdditionalpropertiesAllowsASchemaWhichShouldValidate; + +import java.util.Arrays; +import java.util.List; +import java.util.AbstractMap; + +static final SchemaConfiguration configuration = new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().build()); + +// Map validation +AdditionalpropertiesAllowsASchemaWhichShouldValidate.AdditionalpropertiesAllowsASchemaWhichShouldValidateMap validatedPayload = + AdditionalpropertiesAllowsASchemaWhichShouldValidate.AdditionalpropertiesAllowsASchemaWhichShouldValidate1.validate( + new AdditionalpropertiesAllowsASchemaWhichShouldValidate.AdditionalpropertiesAllowsASchemaWhichShouldValidateMapBuilder() + .additionalProperty("someAdditionalProperty", true) + + .build(), + configuration +); +``` + +### Field Summary +| Modifier and Type | Field and Description | +| ----------------- | ---------------------- | +| Set> | type = setOf(Map::class.java) | +| Map> | properties = mapOf(
    "foo" to [Foo::class.java](#foo)),
    "bar" to [Bar::class.java](#bar))
)
| +| Class | additionalProperties = [AdditionalProperties::class.java](#additionalproperties) | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| [AdditionalpropertiesAllowsASchemaWhichShouldValidateMap](#additionalpropertiesallowsaschemawhichshouldvalidatemap) | validate(arg: [Map<?, ?>](#additionalpropertiesallowsaschemawhichshouldvalidatemapbuilder), configuration: SchemaConfiguration) | +| [AdditionalpropertiesAllowsASchemaWhichShouldValidate1BoxedMap](#additionalpropertiesallowsaschemawhichshouldvalidate1boxedmap) | validateAndBox([Map<?, ?>](#additionalpropertiesallowsaschemawhichshouldvalidatemapbuilder), configuration: SchemaConfiguration) | +| [AdditionalpropertiesAllowsASchemaWhichShouldValidate1Boxed](#additionalpropertiesallowsaschemawhichshouldvalidate1boxed) | validateAndBox(Any?, configuration: SchemaConfiguration) | +| Any? | validate(arg: Any?, configuration: SchemaConfiguration) | + +## AdditionalpropertiesAllowsASchemaWhichShouldValidateMapBuilder +class AdditionalpropertiesAllowsASchemaWhichShouldValidateMapBuilder
+builder for `Map` + +A class that builds the Map input type + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| AdditionalpropertiesAllowsASchemaWhichShouldValidateMapBuilder()
Creates a builder that contains an empty map | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| Map | build()
Returns map input that should be used with Schema.validate | +| [AdditionalpropertiesAllowsASchemaWhichShouldValidateMapBuilder](#additionalpropertiesallowsaschemawhichshouldvalidatemapbuilder) | foo(value: Nothing?) | +| [AdditionalpropertiesAllowsASchemaWhichShouldValidateMapBuilder](#additionalpropertiesallowsaschemawhichshouldvalidatemapbuilder) | foo(value: Boolean) | +| [AdditionalpropertiesAllowsASchemaWhichShouldValidateMapBuilder](#additionalpropertiesallowsaschemawhichshouldvalidatemapbuilder) | foo(value: String) | +| [AdditionalpropertiesAllowsASchemaWhichShouldValidateMapBuilder](#additionalpropertiesallowsaschemawhichshouldvalidatemapbuilder) | foo(value: Int) | +| [AdditionalpropertiesAllowsASchemaWhichShouldValidateMapBuilder](#additionalpropertiesallowsaschemawhichshouldvalidatemapbuilder) | foo(value: Float) | +| [AdditionalpropertiesAllowsASchemaWhichShouldValidateMapBuilder](#additionalpropertiesallowsaschemawhichshouldvalidatemapbuilder) | foo(value: Long) | +| [AdditionalpropertiesAllowsASchemaWhichShouldValidateMapBuilder](#additionalpropertiesallowsaschemawhichshouldvalidatemapbuilder) | foo(value: Double) | +| [AdditionalpropertiesAllowsASchemaWhichShouldValidateMapBuilder](#additionalpropertiesallowsaschemawhichshouldvalidatemapbuilder) | foo(value: List) | +| [AdditionalpropertiesAllowsASchemaWhichShouldValidateMapBuilder](#additionalpropertiesallowsaschemawhichshouldvalidatemapbuilder) | foo(value: Map) | +| [AdditionalpropertiesAllowsASchemaWhichShouldValidateMapBuilder](#additionalpropertiesallowsaschemawhichshouldvalidatemapbuilder) | bar(value: Nothing?) | +| [AdditionalpropertiesAllowsASchemaWhichShouldValidateMapBuilder](#additionalpropertiesallowsaschemawhichshouldvalidatemapbuilder) | bar(value: Boolean) | +| [AdditionalpropertiesAllowsASchemaWhichShouldValidateMapBuilder](#additionalpropertiesallowsaschemawhichshouldvalidatemapbuilder) | bar(value: String) | +| [AdditionalpropertiesAllowsASchemaWhichShouldValidateMapBuilder](#additionalpropertiesallowsaschemawhichshouldvalidatemapbuilder) | bar(value: Int) | +| [AdditionalpropertiesAllowsASchemaWhichShouldValidateMapBuilder](#additionalpropertiesallowsaschemawhichshouldvalidatemapbuilder) | bar(value: Float) | +| [AdditionalpropertiesAllowsASchemaWhichShouldValidateMapBuilder](#additionalpropertiesallowsaschemawhichshouldvalidatemapbuilder) | bar(value: Long) | +| [AdditionalpropertiesAllowsASchemaWhichShouldValidateMapBuilder](#additionalpropertiesallowsaschemawhichshouldvalidatemapbuilder) | bar(value: Double) | +| [AdditionalpropertiesAllowsASchemaWhichShouldValidateMapBuilder](#additionalpropertiesallowsaschemawhichshouldvalidatemapbuilder) | bar(value: List) | +| [AdditionalpropertiesAllowsASchemaWhichShouldValidateMapBuilder](#additionalpropertiesallowsaschemawhichshouldvalidatemapbuilder) | bar(value: Map) | +| [AdditionalpropertiesAllowsASchemaWhichShouldValidateMapBuilder](#additionalpropertiesallowsaschemawhichshouldvalidatemapbuilder) | additionalProperty(key: String, value: Boolean) | + +## AdditionalpropertiesAllowsASchemaWhichShouldValidateMap +class AdditionalpropertiesAllowsASchemaWhichShouldValidateMap
+extends FrozenMap + +A class to store validated Map payloads + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| static [AdditionalpropertiesAllowsASchemaWhichShouldValidateMap](#additionalpropertiesallowsaschemawhichshouldvalidatemap) | of([Map](#additionalpropertiesallowsaschemawhichshouldvalidatemapbuilder) arg, SchemaConfiguration configuration) | +| Any? | foo()
[optional] | +| Any? | bar()
[optional] | +| Boolean | getAdditionalProperty(String name)
provides type safety for additional properties | + +## BarBoxed +sealed interface BarBoxed
+permits
+[BarBoxedVoid](#barboxedvoid), +[BarBoxedBoolean](#barboxedboolean), +[BarBoxedNumber](#barboxednumber), +[BarBoxedString](#barboxedstring), +[BarBoxedList](#barboxedlist), +[BarBoxedMap](#barboxedmap) + +sealed interface that stores validated payloads using boxed classes + +## BarBoxedVoid +data class BarBoxedVoid
+implements [BarBoxed](#barboxed) + +data class that stores validated null payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| BarBoxedVoid(Nothing? data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| Nothing? | data()
validated payload | +| Any? | getData()
validated payload | + +## BarBoxedBoolean +data class BarBoxedBoolean
+implements [BarBoxed](#barboxed) + +record that stores validated boolean payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| BarBoxedBoolean(boolean data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| boolean | data()
validated payload | +| Any? | getData()
validated payload | + +## BarBoxedNumber +data class BarBoxedNumber
+implements [BarBoxed](#barboxed) + +data class that stores validated Number payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| BarBoxedNumber(Number data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| Number | data()
validated payload | +| Any? | getData()
validated payload | + +## BarBoxedString +data class BarBoxedString
+implements [BarBoxed](#barboxed) + +data class that stores validated String payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| BarBoxedString(String data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| String | data()
validated payload | +| Any? | getData()
validated payload | + +## BarBoxedList +data class BarBoxedList
+implements [BarBoxed](#barboxed) + +data class that stores validated List payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| BarBoxedList(FrozenList data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| FrozenList | data()
validated payload | +| Any? | getData()
validated payload | + +## BarBoxedMap +data class BarBoxedMap
+implements [BarBoxed](#barboxed) + +data class that stores validated Map payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| BarBoxedMap(FrozenMap data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| FrozenMap | data()
validated payload | +| Any? | getData()
validated payload | + +## Bar +class Bar
+extends AnyTypeJsonSchema.AnyTypeJsonSchema1 + +A schema class that validates payloads + +| Methods Inherited from class org.openapijsonschematools.client.schemas.AnyTypeJsonSchema.AnyTypeJsonSchema1 | +| ------------------------------------------------------------------ | +| validate | +| validateAndBox | + +## FooBoxed +sealed interface FooBoxed
+permits
+[FooBoxedVoid](#fooboxedvoid), +[FooBoxedBoolean](#fooboxedboolean), +[FooBoxedNumber](#fooboxednumber), +[FooBoxedString](#fooboxedstring), +[FooBoxedList](#fooboxedlist), +[FooBoxedMap](#fooboxedmap) + +sealed interface that stores validated payloads using boxed classes + +## FooBoxedVoid +data class FooBoxedVoid
+implements [FooBoxed](#fooboxed) + +data class that stores validated null payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| FooBoxedVoid(Nothing? data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| Nothing? | data()
validated payload | +| Any? | getData()
validated payload | + +## FooBoxedBoolean +data class FooBoxedBoolean
+implements [FooBoxed](#fooboxed) + +record that stores validated boolean payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| FooBoxedBoolean(boolean data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| boolean | data()
validated payload | +| Any? | getData()
validated payload | + +## FooBoxedNumber +data class FooBoxedNumber
+implements [FooBoxed](#fooboxed) + +data class that stores validated Number payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| FooBoxedNumber(Number data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| Number | data()
validated payload | +| Any? | getData()
validated payload | + +## FooBoxedString +data class FooBoxedString
+implements [FooBoxed](#fooboxed) + +data class that stores validated String payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| FooBoxedString(String data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| String | data()
validated payload | +| Any? | getData()
validated payload | + +## FooBoxedList +data class FooBoxedList
+implements [FooBoxed](#fooboxed) + +data class that stores validated List payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| FooBoxedList(FrozenList data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| FrozenList | data()
validated payload | +| Any? | getData()
validated payload | + +## FooBoxedMap +data class FooBoxedMap
+implements [FooBoxed](#fooboxed) + +data class that stores validated Map payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| FooBoxedMap(FrozenMap data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| FrozenMap | data()
validated payload | +| Any? | getData()
validated payload | + +## Foo +class Foo
+extends AnyTypeJsonSchema.AnyTypeJsonSchema1 + +A schema class that validates payloads + +| Methods Inherited from class org.openapijsonschematools.client.schemas.AnyTypeJsonSchema.AnyTypeJsonSchema1 | +| ------------------------------------------------------------------ | +| validate | +| validateAndBox | + +## AdditionalPropertiesBoxed +sealed interface AdditionalPropertiesBoxed
+permits
+[AdditionalPropertiesBoxedBoolean](#additionalpropertiesboxedboolean) + +sealed interface that stores validated payloads using boxed classes + +## AdditionalPropertiesBoxedBoolean +data class AdditionalPropertiesBoxedBoolean
+implements [AdditionalPropertiesBoxed](#additionalpropertiesboxed) + +record that stores validated boolean payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| AdditionalPropertiesBoxedBoolean(boolean data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| boolean | data()
validated payload | +| Any? | getData()
validated payload | + +## AdditionalProperties +class AdditionalProperties
+extends BooleanJsonSchema.BooleanJsonSchema1 + +A schema class that validates payloads + +| Methods Inherited from class org.openapijsonschematools.client.schemas.BooleanJsonSchema.BooleanJsonSchema1 | +| ------------------------------------------------------------------ | +| validate | +| validateAndBox | + +[[Back to top]](#top) [[Back to Component Schemas]](../../../README.md#Component-Schemas) [[Back to README]](../../../README.md) diff --git a/samples/client/3_0_3_unit_test/kotlin/docs/components/schemas/AdditionalpropertiesAreAllowedByDefault.md b/samples/client/3_0_3_unit_test/kotlin/docs/components/schemas/AdditionalpropertiesAreAllowedByDefault.md new file mode 100644 index 00000000000..c3785564640 --- /dev/null +++ b/samples/client/3_0_3_unit_test/kotlin/docs/components/schemas/AdditionalpropertiesAreAllowedByDefault.md @@ -0,0 +1,496 @@ +# AdditionalpropertiesAreAllowedByDefault +org.openapijsonschematools.client.components.schemas.AdditionalpropertiesAreAllowedByDefault.java +class AdditionalpropertiesAreAllowedByDefault
+ +A class that contains necessary nested +- schema classes (which validate payloads), extends JsonSchema +- sealed interfaces which store validated payloads, Kotlin version of a sum type +- boxed classes which store validated payloads, sealed permits class implementations +- classes to store validated map payloads, extends FrozenMap +- classes to build inputs for map payloads + +## Nested Class Summary +| Modifier and Type | Class and Description | +| ----------------- | ---------------------- | +| sealed interface | [AdditionalpropertiesAreAllowedByDefault.AdditionalpropertiesAreAllowedByDefault1Boxed](#additionalpropertiesareallowedbydefault1boxed)
sealed interface for validated payloads | +| record | [AdditionalpropertiesAreAllowedByDefault.AdditionalpropertiesAreAllowedByDefault1BoxedVoid](#additionalpropertiesareallowedbydefault1boxedvoid)
boxed class to store validated null payloads | +| record | [AdditionalpropertiesAreAllowedByDefault.AdditionalpropertiesAreAllowedByDefault1BoxedBoolean](#additionalpropertiesareallowedbydefault1boxedboolean)
boxed class to store validated boolean payloads | +| record | [AdditionalpropertiesAreAllowedByDefault.AdditionalpropertiesAreAllowedByDefault1BoxedNumber](#additionalpropertiesareallowedbydefault1boxednumber)
boxed class to store validated Number payloads | +| record | [AdditionalpropertiesAreAllowedByDefault.AdditionalpropertiesAreAllowedByDefault1BoxedString](#additionalpropertiesareallowedbydefault1boxedstring)
boxed class to store validated String payloads | +| record | [AdditionalpropertiesAreAllowedByDefault.AdditionalpropertiesAreAllowedByDefault1BoxedList](#additionalpropertiesareallowedbydefault1boxedlist)
boxed class to store validated List payloads | +| record | [AdditionalpropertiesAreAllowedByDefault.AdditionalpropertiesAreAllowedByDefault1BoxedMap](#additionalpropertiesareallowedbydefault1boxedmap)
boxed class to store validated Map payloads | +| static class | [AdditionalpropertiesAreAllowedByDefault.AdditionalpropertiesAreAllowedByDefault1](#additionalpropertiesareallowedbydefault1)
schema class | +| static class | [AdditionalpropertiesAreAllowedByDefault.AdditionalpropertiesAreAllowedByDefaultMapBuilder](#additionalpropertiesareallowedbydefaultmapbuilder)
builder for Map payloads | +| static class | [AdditionalpropertiesAreAllowedByDefault.AdditionalpropertiesAreAllowedByDefaultMap](#additionalpropertiesareallowedbydefaultmap)
output class for Map payloads | +| sealed interface | [AdditionalpropertiesAreAllowedByDefault.BarBoxed](#barboxed)
sealed interface for validated payloads | +| record | [AdditionalpropertiesAreAllowedByDefault.BarBoxedVoid](#barboxedvoid)
boxed class to store validated null payloads | +| record | [AdditionalpropertiesAreAllowedByDefault.BarBoxedBoolean](#barboxedboolean)
boxed class to store validated boolean payloads | +| record | [AdditionalpropertiesAreAllowedByDefault.BarBoxedNumber](#barboxednumber)
boxed class to store validated Number payloads | +| record | [AdditionalpropertiesAreAllowedByDefault.BarBoxedString](#barboxedstring)
boxed class to store validated String payloads | +| record | [AdditionalpropertiesAreAllowedByDefault.BarBoxedList](#barboxedlist)
boxed class to store validated List payloads | +| record | [AdditionalpropertiesAreAllowedByDefault.BarBoxedMap](#barboxedmap)
boxed class to store validated Map payloads | +| static class | [AdditionalpropertiesAreAllowedByDefault.Bar](#bar)
schema class | +| sealed interface | [AdditionalpropertiesAreAllowedByDefault.FooBoxed](#fooboxed)
sealed interface for validated payloads | +| record | [AdditionalpropertiesAreAllowedByDefault.FooBoxedVoid](#fooboxedvoid)
boxed class to store validated null payloads | +| record | [AdditionalpropertiesAreAllowedByDefault.FooBoxedBoolean](#fooboxedboolean)
boxed class to store validated boolean payloads | +| record | [AdditionalpropertiesAreAllowedByDefault.FooBoxedNumber](#fooboxednumber)
boxed class to store validated Number payloads | +| record | [AdditionalpropertiesAreAllowedByDefault.FooBoxedString](#fooboxedstring)
boxed class to store validated String payloads | +| record | [AdditionalpropertiesAreAllowedByDefault.FooBoxedList](#fooboxedlist)
boxed class to store validated List payloads | +| record | [AdditionalpropertiesAreAllowedByDefault.FooBoxedMap](#fooboxedmap)
boxed class to store validated Map payloads | +| static class | [AdditionalpropertiesAreAllowedByDefault.Foo](#foo)
schema class | + +## AdditionalpropertiesAreAllowedByDefault1Boxed +sealed interface AdditionalpropertiesAreAllowedByDefault1Boxed
+permits
+[AdditionalpropertiesAreAllowedByDefault1BoxedVoid](#additionalpropertiesareallowedbydefault1boxedvoid), +[AdditionalpropertiesAreAllowedByDefault1BoxedBoolean](#additionalpropertiesareallowedbydefault1boxedboolean), +[AdditionalpropertiesAreAllowedByDefault1BoxedNumber](#additionalpropertiesareallowedbydefault1boxednumber), +[AdditionalpropertiesAreAllowedByDefault1BoxedString](#additionalpropertiesareallowedbydefault1boxedstring), +[AdditionalpropertiesAreAllowedByDefault1BoxedList](#additionalpropertiesareallowedbydefault1boxedlist), +[AdditionalpropertiesAreAllowedByDefault1BoxedMap](#additionalpropertiesareallowedbydefault1boxedmap) + +sealed interface that stores validated payloads using boxed classes + +## AdditionalpropertiesAreAllowedByDefault1BoxedVoid +data class AdditionalpropertiesAreAllowedByDefault1BoxedVoid
+implements [AdditionalpropertiesAreAllowedByDefault1Boxed](#additionalpropertiesareallowedbydefault1boxed) + +data class that stores validated null payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| AdditionalpropertiesAreAllowedByDefault1BoxedVoid(Nothing? data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| Nothing? | data()
validated payload | +| Any? | getData()
validated payload | + +## AdditionalpropertiesAreAllowedByDefault1BoxedBoolean +data class AdditionalpropertiesAreAllowedByDefault1BoxedBoolean
+implements [AdditionalpropertiesAreAllowedByDefault1Boxed](#additionalpropertiesareallowedbydefault1boxed) + +record that stores validated boolean payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| AdditionalpropertiesAreAllowedByDefault1BoxedBoolean(boolean data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| boolean | data()
validated payload | +| Any? | getData()
validated payload | + +## AdditionalpropertiesAreAllowedByDefault1BoxedNumber +data class AdditionalpropertiesAreAllowedByDefault1BoxedNumber
+implements [AdditionalpropertiesAreAllowedByDefault1Boxed](#additionalpropertiesareallowedbydefault1boxed) + +data class that stores validated Number payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| AdditionalpropertiesAreAllowedByDefault1BoxedNumber(Number data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| Number | data()
validated payload | +| Any? | getData()
validated payload | + +## AdditionalpropertiesAreAllowedByDefault1BoxedString +data class AdditionalpropertiesAreAllowedByDefault1BoxedString
+implements [AdditionalpropertiesAreAllowedByDefault1Boxed](#additionalpropertiesareallowedbydefault1boxed) + +data class that stores validated String payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| AdditionalpropertiesAreAllowedByDefault1BoxedString(String data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| String | data()
validated payload | +| Any? | getData()
validated payload | + +## AdditionalpropertiesAreAllowedByDefault1BoxedList +data class AdditionalpropertiesAreAllowedByDefault1BoxedList
+implements [AdditionalpropertiesAreAllowedByDefault1Boxed](#additionalpropertiesareallowedbydefault1boxed) + +data class that stores validated List payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| AdditionalpropertiesAreAllowedByDefault1BoxedList(FrozenList data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| FrozenList | data()
validated payload | +| Any? | getData()
validated payload | + +## AdditionalpropertiesAreAllowedByDefault1BoxedMap +data class AdditionalpropertiesAreAllowedByDefault1BoxedMap
+implements [AdditionalpropertiesAreAllowedByDefault1Boxed](#additionalpropertiesareallowedbydefault1boxed) + +data class that stores validated Map payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| AdditionalpropertiesAreAllowedByDefault1BoxedMap([AdditionalpropertiesAreAllowedByDefaultMap](#additionalpropertiesareallowedbydefaultmap) data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| [AdditionalpropertiesAreAllowedByDefaultMap](#additionalpropertiesareallowedbydefaultmap) | data()
validated payload | +| Any? | getData()
validated payload | + +## AdditionalpropertiesAreAllowedByDefault1 +class AdditionalpropertiesAreAllowedByDefault1
+extends JsonSchema + +A schema class that validates payloads + +### Field Summary +| Modifier and Type | Field and Description | +| ----------------- | ---------------------- | +| Map> | properties = mapOf(
    "foo" to [Foo::class.java](#foo)),
    "bar" to [Bar::class.java](#bar))
)
| + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| String | validate(arg: String, configuration: SchemaConfiguration) | +| Nothing? | validate(arg: Nothing?, configuration: SchemaConfiguration) | +| int | validate(arg: int, configuration: SchemaConfiguration) | +| long | validate(arg: long, configuration: SchemaConfiguration) | +| float | validate(arg: float, configuration: SchemaConfiguration) | +| double | validate(arg: double, configuration: SchemaConfiguration) | +| Number | validate(arg: Number, configuration: SchemaConfiguration) | +| boolean | validate(arg: boolean, configuration: SchemaConfiguration) | +| [AdditionalpropertiesAreAllowedByDefaultMap](#additionalpropertiesareallowedbydefaultmap) | validate(arg: [Map<?, ?>](#additionalpropertiesareallowedbydefaultmapbuilder), configuration: SchemaConfiguration) | +| FrozenList | validate(arg: List<*>, configuration: SchemaConfiguration) | +| [AdditionalpropertiesAreAllowedByDefault1BoxedString](#additionalpropertiesareallowedbydefault1boxedstring) | validateAndBox(String, configuration: SchemaConfiguration) | +| [AdditionalpropertiesAreAllowedByDefault1BoxedVoid](#additionalpropertiesareallowedbydefault1boxedvoid) | validateAndBox(Nothing?, configuration: SchemaConfiguration) | +| [AdditionalpropertiesAreAllowedByDefault1BoxedNumber](#additionalpropertiesareallowedbydefault1boxednumber) | validateAndBox(Number, configuration: SchemaConfiguration) | +| [AdditionalpropertiesAreAllowedByDefault1BoxedBoolean](#additionalpropertiesareallowedbydefault1boxedboolean) | validateAndBox(boolean, configuration: SchemaConfiguration) | +| [AdditionalpropertiesAreAllowedByDefault1BoxedMap](#additionalpropertiesareallowedbydefault1boxedmap) | validateAndBox([Map<?, ?>](#additionalpropertiesareallowedbydefaultmapbuilder), configuration: SchemaConfiguration) | +| [AdditionalpropertiesAreAllowedByDefault1BoxedList](#additionalpropertiesareallowedbydefault1boxedlist) | validateAndBox(List<*>, configuration: SchemaConfiguration) | +| [AdditionalpropertiesAreAllowedByDefault1Boxed](#additionalpropertiesareallowedbydefault1boxed) | validateAndBox(Any?, configuration: SchemaConfiguration) | +| Any? | validate(arg: Any?, configuration: SchemaConfiguration) | + +## AdditionalpropertiesAreAllowedByDefaultMapBuilder +class AdditionalpropertiesAreAllowedByDefaultMapBuilder
+builder for `Map` + +A class that builds the Map input type + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| AdditionalpropertiesAreAllowedByDefaultMapBuilder()
Creates a builder that contains an empty map | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| Map | build()
Returns map input that should be used with Schema.validate | +| [AdditionalpropertiesAreAllowedByDefaultMapBuilder](#additionalpropertiesareallowedbydefaultmapbuilder) | foo(value: Nothing?) | +| [AdditionalpropertiesAreAllowedByDefaultMapBuilder](#additionalpropertiesareallowedbydefaultmapbuilder) | foo(value: Boolean) | +| [AdditionalpropertiesAreAllowedByDefaultMapBuilder](#additionalpropertiesareallowedbydefaultmapbuilder) | foo(value: String) | +| [AdditionalpropertiesAreAllowedByDefaultMapBuilder](#additionalpropertiesareallowedbydefaultmapbuilder) | foo(value: Int) | +| [AdditionalpropertiesAreAllowedByDefaultMapBuilder](#additionalpropertiesareallowedbydefaultmapbuilder) | foo(value: Float) | +| [AdditionalpropertiesAreAllowedByDefaultMapBuilder](#additionalpropertiesareallowedbydefaultmapbuilder) | foo(value: Long) | +| [AdditionalpropertiesAreAllowedByDefaultMapBuilder](#additionalpropertiesareallowedbydefaultmapbuilder) | foo(value: Double) | +| [AdditionalpropertiesAreAllowedByDefaultMapBuilder](#additionalpropertiesareallowedbydefaultmapbuilder) | foo(value: List) | +| [AdditionalpropertiesAreAllowedByDefaultMapBuilder](#additionalpropertiesareallowedbydefaultmapbuilder) | foo(value: Map) | +| [AdditionalpropertiesAreAllowedByDefaultMapBuilder](#additionalpropertiesareallowedbydefaultmapbuilder) | bar(value: Nothing?) | +| [AdditionalpropertiesAreAllowedByDefaultMapBuilder](#additionalpropertiesareallowedbydefaultmapbuilder) | bar(value: Boolean) | +| [AdditionalpropertiesAreAllowedByDefaultMapBuilder](#additionalpropertiesareallowedbydefaultmapbuilder) | bar(value: String) | +| [AdditionalpropertiesAreAllowedByDefaultMapBuilder](#additionalpropertiesareallowedbydefaultmapbuilder) | bar(value: Int) | +| [AdditionalpropertiesAreAllowedByDefaultMapBuilder](#additionalpropertiesareallowedbydefaultmapbuilder) | bar(value: Float) | +| [AdditionalpropertiesAreAllowedByDefaultMapBuilder](#additionalpropertiesareallowedbydefaultmapbuilder) | bar(value: Long) | +| [AdditionalpropertiesAreAllowedByDefaultMapBuilder](#additionalpropertiesareallowedbydefaultmapbuilder) | bar(value: Double) | +| [AdditionalpropertiesAreAllowedByDefaultMapBuilder](#additionalpropertiesareallowedbydefaultmapbuilder) | bar(value: List) | +| [AdditionalpropertiesAreAllowedByDefaultMapBuilder](#additionalpropertiesareallowedbydefaultmapbuilder) | bar(value: Map) | +| [AdditionalpropertiesAreAllowedByDefaultMapBuilder](#additionalpropertiesareallowedbydefaultmapbuilder) | additionalProperty(key: String, value: Nothing?) | +| [AdditionalpropertiesAreAllowedByDefaultMapBuilder](#additionalpropertiesareallowedbydefaultmapbuilder) | additionalProperty(key: String, value: Boolean) | +| [AdditionalpropertiesAreAllowedByDefaultMapBuilder](#additionalpropertiesareallowedbydefaultmapbuilder) | additionalProperty(key: String, value: String) | +| [AdditionalpropertiesAreAllowedByDefaultMapBuilder](#additionalpropertiesareallowedbydefaultmapbuilder) | additionalProperty(key: String, value: Int) | +| [AdditionalpropertiesAreAllowedByDefaultMapBuilder](#additionalpropertiesareallowedbydefaultmapbuilder) | additionalProperty(key: String, value: Float) | +| [AdditionalpropertiesAreAllowedByDefaultMapBuilder](#additionalpropertiesareallowedbydefaultmapbuilder) | additionalProperty(key: String, value: Long) | +| [AdditionalpropertiesAreAllowedByDefaultMapBuilder](#additionalpropertiesareallowedbydefaultmapbuilder) | additionalProperty(key: String, value: Double) | +| [AdditionalpropertiesAreAllowedByDefaultMapBuilder](#additionalpropertiesareallowedbydefaultmapbuilder) | additionalProperty(key: String, value: List) | +| [AdditionalpropertiesAreAllowedByDefaultMapBuilder](#additionalpropertiesareallowedbydefaultmapbuilder) | additionalProperty(key: String, value: Map) | + +## AdditionalpropertiesAreAllowedByDefaultMap +class AdditionalpropertiesAreAllowedByDefaultMap
+extends FrozenMap + +A class to store validated Map payloads + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| static [AdditionalpropertiesAreAllowedByDefaultMap](#additionalpropertiesareallowedbydefaultmap) | of([Map](#additionalpropertiesareallowedbydefaultmapbuilder) arg, SchemaConfiguration configuration) | +| Any? | foo()
[optional] | +| Any? | bar()
[optional] | +| Any? | getAdditionalProperty(String name)
provides type safety for additional properties | + +## BarBoxed +sealed interface BarBoxed
+permits
+[BarBoxedVoid](#barboxedvoid), +[BarBoxedBoolean](#barboxedboolean), +[BarBoxedNumber](#barboxednumber), +[BarBoxedString](#barboxedstring), +[BarBoxedList](#barboxedlist), +[BarBoxedMap](#barboxedmap) + +sealed interface that stores validated payloads using boxed classes + +## BarBoxedVoid +data class BarBoxedVoid
+implements [BarBoxed](#barboxed) + +data class that stores validated null payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| BarBoxedVoid(Nothing? data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| Nothing? | data()
validated payload | +| Any? | getData()
validated payload | + +## BarBoxedBoolean +data class BarBoxedBoolean
+implements [BarBoxed](#barboxed) + +record that stores validated boolean payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| BarBoxedBoolean(boolean data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| boolean | data()
validated payload | +| Any? | getData()
validated payload | + +## BarBoxedNumber +data class BarBoxedNumber
+implements [BarBoxed](#barboxed) + +data class that stores validated Number payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| BarBoxedNumber(Number data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| Number | data()
validated payload | +| Any? | getData()
validated payload | + +## BarBoxedString +data class BarBoxedString
+implements [BarBoxed](#barboxed) + +data class that stores validated String payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| BarBoxedString(String data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| String | data()
validated payload | +| Any? | getData()
validated payload | + +## BarBoxedList +data class BarBoxedList
+implements [BarBoxed](#barboxed) + +data class that stores validated List payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| BarBoxedList(FrozenList data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| FrozenList | data()
validated payload | +| Any? | getData()
validated payload | + +## BarBoxedMap +data class BarBoxedMap
+implements [BarBoxed](#barboxed) + +data class that stores validated Map payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| BarBoxedMap(FrozenMap data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| FrozenMap | data()
validated payload | +| Any? | getData()
validated payload | + +## Bar +class Bar
+extends AnyTypeJsonSchema.AnyTypeJsonSchema1 + +A schema class that validates payloads + +| Methods Inherited from class org.openapijsonschematools.client.schemas.AnyTypeJsonSchema.AnyTypeJsonSchema1 | +| ------------------------------------------------------------------ | +| validate | +| validateAndBox | + +## FooBoxed +sealed interface FooBoxed
+permits
+[FooBoxedVoid](#fooboxedvoid), +[FooBoxedBoolean](#fooboxedboolean), +[FooBoxedNumber](#fooboxednumber), +[FooBoxedString](#fooboxedstring), +[FooBoxedList](#fooboxedlist), +[FooBoxedMap](#fooboxedmap) + +sealed interface that stores validated payloads using boxed classes + +## FooBoxedVoid +data class FooBoxedVoid
+implements [FooBoxed](#fooboxed) + +data class that stores validated null payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| FooBoxedVoid(Nothing? data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| Nothing? | data()
validated payload | +| Any? | getData()
validated payload | + +## FooBoxedBoolean +data class FooBoxedBoolean
+implements [FooBoxed](#fooboxed) + +record that stores validated boolean payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| FooBoxedBoolean(boolean data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| boolean | data()
validated payload | +| Any? | getData()
validated payload | + +## FooBoxedNumber +data class FooBoxedNumber
+implements [FooBoxed](#fooboxed) + +data class that stores validated Number payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| FooBoxedNumber(Number data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| Number | data()
validated payload | +| Any? | getData()
validated payload | + +## FooBoxedString +data class FooBoxedString
+implements [FooBoxed](#fooboxed) + +data class that stores validated String payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| FooBoxedString(String data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| String | data()
validated payload | +| Any? | getData()
validated payload | + +## FooBoxedList +data class FooBoxedList
+implements [FooBoxed](#fooboxed) + +data class that stores validated List payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| FooBoxedList(FrozenList data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| FrozenList | data()
validated payload | +| Any? | getData()
validated payload | + +## FooBoxedMap +data class FooBoxedMap
+implements [FooBoxed](#fooboxed) + +data class that stores validated Map payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| FooBoxedMap(FrozenMap data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| FrozenMap | data()
validated payload | +| Any? | getData()
validated payload | + +## Foo +class Foo
+extends AnyTypeJsonSchema.AnyTypeJsonSchema1 + +A schema class that validates payloads + +| Methods Inherited from class org.openapijsonschematools.client.schemas.AnyTypeJsonSchema.AnyTypeJsonSchema1 | +| ------------------------------------------------------------------ | +| validate | +| validateAndBox | + +[[Back to top]](#top) [[Back to Component Schemas]](../../../README.md#Component-Schemas) [[Back to README]](../../../README.md) diff --git a/samples/client/3_0_3_unit_test/kotlin/docs/components/schemas/AdditionalpropertiesCanExistByItself.md b/samples/client/3_0_3_unit_test/kotlin/docs/components/schemas/AdditionalpropertiesCanExistByItself.md new file mode 100644 index 00000000000..fdc764ec2a1 --- /dev/null +++ b/samples/client/3_0_3_unit_test/kotlin/docs/components/schemas/AdditionalpropertiesCanExistByItself.md @@ -0,0 +1,159 @@ +# AdditionalpropertiesCanExistByItself +org.openapijsonschematools.client.components.schemas.AdditionalpropertiesCanExistByItself.java +class AdditionalpropertiesCanExistByItself
+ +A class that contains necessary nested +- schema classes (which validate payloads), extends JsonSchema +- sealed interfaces which store validated payloads, Kotlin version of a sum type +- boxed classes which store validated payloads, sealed permits class implementations +- classes to store validated map payloads, extends FrozenMap +- classes to build inputs for map payloads + +## Nested Class Summary +| Modifier and Type | Class and Description | +| ----------------- | ---------------------- | +| sealed interface | [AdditionalpropertiesCanExistByItself.AdditionalpropertiesCanExistByItself1Boxed](#additionalpropertiescanexistbyitself1boxed)
sealed interface for validated payloads | +| record | [AdditionalpropertiesCanExistByItself.AdditionalpropertiesCanExistByItself1BoxedMap](#additionalpropertiescanexistbyitself1boxedmap)
boxed class to store validated Map payloads | +| static class | [AdditionalpropertiesCanExistByItself.AdditionalpropertiesCanExistByItself1](#additionalpropertiescanexistbyitself1)
schema class | +| static class | [AdditionalpropertiesCanExistByItself.AdditionalpropertiesCanExistByItselfMapBuilder](#additionalpropertiescanexistbyitselfmapbuilder)
builder for Map payloads | +| static class | [AdditionalpropertiesCanExistByItself.AdditionalpropertiesCanExistByItselfMap](#additionalpropertiescanexistbyitselfmap)
output class for Map payloads | +| sealed interface | [AdditionalpropertiesCanExistByItself.AdditionalPropertiesBoxed](#additionalpropertiesboxed)
sealed interface for validated payloads | +| record | [AdditionalpropertiesCanExistByItself.AdditionalPropertiesBoxedBoolean](#additionalpropertiesboxedboolean)
boxed class to store validated boolean payloads | +| static class | [AdditionalpropertiesCanExistByItself.AdditionalProperties](#additionalproperties)
schema class | + +## AdditionalpropertiesCanExistByItself1Boxed +sealed interface AdditionalpropertiesCanExistByItself1Boxed
+permits
+[AdditionalpropertiesCanExistByItself1BoxedMap](#additionalpropertiescanexistbyitself1boxedmap) + +sealed interface that stores validated payloads using boxed classes + +## AdditionalpropertiesCanExistByItself1BoxedMap +data class AdditionalpropertiesCanExistByItself1BoxedMap
+implements [AdditionalpropertiesCanExistByItself1Boxed](#additionalpropertiescanexistbyitself1boxed) + +data class that stores validated Map payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| AdditionalpropertiesCanExistByItself1BoxedMap([AdditionalpropertiesCanExistByItselfMap](#additionalpropertiescanexistbyitselfmap) data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| [AdditionalpropertiesCanExistByItselfMap](#additionalpropertiescanexistbyitselfmap) | data()
validated payload | +| Any? | getData()
validated payload | + +## AdditionalpropertiesCanExistByItself1 +class AdditionalpropertiesCanExistByItself1
+extends JsonSchema + +A schema class that validates payloads + +### Code Sample +``` +import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags; +import org.openapijsonschematools.client.configurations.SchemaConfiguration; +import org.openapijsonschematools.client.exceptions.ValidationException; +import org.openapijsonschematools.client.schemas.validation.MapUtils; +import org.openapijsonschematools.client.schemas.validation.FrozenList; +import org.openapijsonschematools.client.schemas.validation.FrozenMap; +import org.openapijsonschematools.client.components.schemas.AdditionalpropertiesCanExistByItself; + +import java.util.Arrays; +import java.util.List; +import java.util.AbstractMap; + +static final SchemaConfiguration configuration = new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().build()); + +// Map validation +AdditionalpropertiesCanExistByItself.AdditionalpropertiesCanExistByItselfMap validatedPayload = + AdditionalpropertiesCanExistByItself.AdditionalpropertiesCanExistByItself1.validate( + new AdditionalpropertiesCanExistByItself.AdditionalpropertiesCanExistByItselfMapBuilder() + .additionalProperty("someAdditionalProperty", true) + + .build(), + configuration +); +``` + +### Field Summary +| Modifier and Type | Field and Description | +| ----------------- | ---------------------- | +| Set> | type = setOf(Map::class.java) | +| Class | additionalProperties = [AdditionalProperties::class.java](#additionalproperties) | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| [AdditionalpropertiesCanExistByItselfMap](#additionalpropertiescanexistbyitselfmap) | validate(arg: [Map<?, ?>](#additionalpropertiescanexistbyitselfmapbuilder), configuration: SchemaConfiguration) | +| [AdditionalpropertiesCanExistByItself1BoxedMap](#additionalpropertiescanexistbyitself1boxedmap) | validateAndBox([Map<?, ?>](#additionalpropertiescanexistbyitselfmapbuilder), configuration: SchemaConfiguration) | +| [AdditionalpropertiesCanExistByItself1Boxed](#additionalpropertiescanexistbyitself1boxed) | validateAndBox(Any?, configuration: SchemaConfiguration) | +| Any? | validate(arg: Any?, configuration: SchemaConfiguration) | + +## AdditionalpropertiesCanExistByItselfMapBuilder +class AdditionalpropertiesCanExistByItselfMapBuilder
+builder for `Map` + +A class that builds the Map input type + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| AdditionalpropertiesCanExistByItselfMapBuilder()
Creates a builder that contains an empty map | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| Map | build()
Returns map input that should be used with Schema.validate | +| [AdditionalpropertiesCanExistByItselfMapBuilder](#additionalpropertiescanexistbyitselfmapbuilder) | additionalProperty(key: String, value: Boolean) | + +## AdditionalpropertiesCanExistByItselfMap +class AdditionalpropertiesCanExistByItselfMap
+extends FrozenMap + +A class to store validated Map payloads + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| static [AdditionalpropertiesCanExistByItselfMap](#additionalpropertiescanexistbyitselfmap) | of([Map](#additionalpropertiescanexistbyitselfmapbuilder) arg, SchemaConfiguration configuration) | +| Boolean | getAdditionalProperty(String name)
provides type safety for additional properties | + +## AdditionalPropertiesBoxed +sealed interface AdditionalPropertiesBoxed
+permits
+[AdditionalPropertiesBoxedBoolean](#additionalpropertiesboxedboolean) + +sealed interface that stores validated payloads using boxed classes + +## AdditionalPropertiesBoxedBoolean +data class AdditionalPropertiesBoxedBoolean
+implements [AdditionalPropertiesBoxed](#additionalpropertiesboxed) + +record that stores validated boolean payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| AdditionalPropertiesBoxedBoolean(boolean data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| boolean | data()
validated payload | +| Any? | getData()
validated payload | + +## AdditionalProperties +class AdditionalProperties
+extends BooleanJsonSchema.BooleanJsonSchema1 + +A schema class that validates payloads + +| Methods Inherited from class org.openapijsonschematools.client.schemas.BooleanJsonSchema.BooleanJsonSchema1 | +| ------------------------------------------------------------------ | +| validate | +| validateAndBox | + +[[Back to top]](#top) [[Back to Component Schemas]](../../../README.md#Component-Schemas) [[Back to README]](../../../README.md) diff --git a/samples/client/3_0_3_unit_test/kotlin/docs/components/schemas/AdditionalpropertiesShouldNotLookInApplicators.md b/samples/client/3_0_3_unit_test/kotlin/docs/components/schemas/AdditionalpropertiesShouldNotLookInApplicators.md new file mode 100644 index 00000000000..9e7412315c2 --- /dev/null +++ b/samples/client/3_0_3_unit_test/kotlin/docs/components/schemas/AdditionalpropertiesShouldNotLookInApplicators.md @@ -0,0 +1,578 @@ +# AdditionalpropertiesShouldNotLookInApplicators +org.openapijsonschematools.client.components.schemas.AdditionalpropertiesShouldNotLookInApplicators.java +class AdditionalpropertiesShouldNotLookInApplicators
+ +A class that contains necessary nested +- schema classes (which validate payloads), extends JsonSchema +- sealed interfaces which store validated payloads, Kotlin version of a sum type +- boxed classes which store validated payloads, sealed permits class implementations +- classes to store validated map payloads, extends FrozenMap +- classes to build inputs for map payloads + +## Nested Class Summary +| Modifier and Type | Class and Description | +| ----------------- | ---------------------- | +| sealed interface | [AdditionalpropertiesShouldNotLookInApplicators.AdditionalpropertiesShouldNotLookInApplicators1Boxed](#additionalpropertiesshouldnotlookinapplicators1boxed)
sealed interface for validated payloads | +| record | [AdditionalpropertiesShouldNotLookInApplicators.AdditionalpropertiesShouldNotLookInApplicators1BoxedVoid](#additionalpropertiesshouldnotlookinapplicators1boxedvoid)
boxed class to store validated null payloads | +| record | [AdditionalpropertiesShouldNotLookInApplicators.AdditionalpropertiesShouldNotLookInApplicators1BoxedBoolean](#additionalpropertiesshouldnotlookinapplicators1boxedboolean)
boxed class to store validated boolean payloads | +| record | [AdditionalpropertiesShouldNotLookInApplicators.AdditionalpropertiesShouldNotLookInApplicators1BoxedNumber](#additionalpropertiesshouldnotlookinapplicators1boxednumber)
boxed class to store validated Number payloads | +| record | [AdditionalpropertiesShouldNotLookInApplicators.AdditionalpropertiesShouldNotLookInApplicators1BoxedString](#additionalpropertiesshouldnotlookinapplicators1boxedstring)
boxed class to store validated String payloads | +| record | [AdditionalpropertiesShouldNotLookInApplicators.AdditionalpropertiesShouldNotLookInApplicators1BoxedList](#additionalpropertiesshouldnotlookinapplicators1boxedlist)
boxed class to store validated List payloads | +| record | [AdditionalpropertiesShouldNotLookInApplicators.AdditionalpropertiesShouldNotLookInApplicators1BoxedMap](#additionalpropertiesshouldnotlookinapplicators1boxedmap)
boxed class to store validated Map payloads | +| static class | [AdditionalpropertiesShouldNotLookInApplicators.AdditionalpropertiesShouldNotLookInApplicators1](#additionalpropertiesshouldnotlookinapplicators1)
schema class | +| static class | [AdditionalpropertiesShouldNotLookInApplicators.AdditionalpropertiesShouldNotLookInApplicatorsMapBuilder](#additionalpropertiesshouldnotlookinapplicatorsmapbuilder)
builder for Map payloads | +| static class | [AdditionalpropertiesShouldNotLookInApplicators.AdditionalpropertiesShouldNotLookInApplicatorsMap](#additionalpropertiesshouldnotlookinapplicatorsmap)
output class for Map payloads | +| sealed interface | [AdditionalpropertiesShouldNotLookInApplicators.Schema0Boxed](#schema0boxed)
sealed interface for validated payloads | +| record | [AdditionalpropertiesShouldNotLookInApplicators.Schema0BoxedVoid](#schema0boxedvoid)
boxed class to store validated null payloads | +| record | [AdditionalpropertiesShouldNotLookInApplicators.Schema0BoxedBoolean](#schema0boxedboolean)
boxed class to store validated boolean payloads | +| record | [AdditionalpropertiesShouldNotLookInApplicators.Schema0BoxedNumber](#schema0boxednumber)
boxed class to store validated Number payloads | +| record | [AdditionalpropertiesShouldNotLookInApplicators.Schema0BoxedString](#schema0boxedstring)
boxed class to store validated String payloads | +| record | [AdditionalpropertiesShouldNotLookInApplicators.Schema0BoxedList](#schema0boxedlist)
boxed class to store validated List payloads | +| record | [AdditionalpropertiesShouldNotLookInApplicators.Schema0BoxedMap](#schema0boxedmap)
boxed class to store validated Map payloads | +| static class | [AdditionalpropertiesShouldNotLookInApplicators.Schema0](#schema0)
schema class | +| static class | [AdditionalpropertiesShouldNotLookInApplicators.Schema0MapBuilder](#schema0mapbuilder)
builder for Map payloads | +| static class | [AdditionalpropertiesShouldNotLookInApplicators.Schema0Map](#schema0map)
output class for Map payloads | +| sealed interface | [AdditionalpropertiesShouldNotLookInApplicators.FooBoxed](#fooboxed)
sealed interface for validated payloads | +| record | [AdditionalpropertiesShouldNotLookInApplicators.FooBoxedVoid](#fooboxedvoid)
boxed class to store validated null payloads | +| record | [AdditionalpropertiesShouldNotLookInApplicators.FooBoxedBoolean](#fooboxedboolean)
boxed class to store validated boolean payloads | +| record | [AdditionalpropertiesShouldNotLookInApplicators.FooBoxedNumber](#fooboxednumber)
boxed class to store validated Number payloads | +| record | [AdditionalpropertiesShouldNotLookInApplicators.FooBoxedString](#fooboxedstring)
boxed class to store validated String payloads | +| record | [AdditionalpropertiesShouldNotLookInApplicators.FooBoxedList](#fooboxedlist)
boxed class to store validated List payloads | +| record | [AdditionalpropertiesShouldNotLookInApplicators.FooBoxedMap](#fooboxedmap)
boxed class to store validated Map payloads | +| static class | [AdditionalpropertiesShouldNotLookInApplicators.Foo](#foo)
schema class | +| sealed interface | [AdditionalpropertiesShouldNotLookInApplicators.AdditionalPropertiesBoxed](#additionalpropertiesboxed)
sealed interface for validated payloads | +| record | [AdditionalpropertiesShouldNotLookInApplicators.AdditionalPropertiesBoxedBoolean](#additionalpropertiesboxedboolean)
boxed class to store validated boolean payloads | +| static class | [AdditionalpropertiesShouldNotLookInApplicators.AdditionalProperties](#additionalproperties)
schema class | + +## AdditionalpropertiesShouldNotLookInApplicators1Boxed +sealed interface AdditionalpropertiesShouldNotLookInApplicators1Boxed
+permits
+[AdditionalpropertiesShouldNotLookInApplicators1BoxedVoid](#additionalpropertiesshouldnotlookinapplicators1boxedvoid), +[AdditionalpropertiesShouldNotLookInApplicators1BoxedBoolean](#additionalpropertiesshouldnotlookinapplicators1boxedboolean), +[AdditionalpropertiesShouldNotLookInApplicators1BoxedNumber](#additionalpropertiesshouldnotlookinapplicators1boxednumber), +[AdditionalpropertiesShouldNotLookInApplicators1BoxedString](#additionalpropertiesshouldnotlookinapplicators1boxedstring), +[AdditionalpropertiesShouldNotLookInApplicators1BoxedList](#additionalpropertiesshouldnotlookinapplicators1boxedlist), +[AdditionalpropertiesShouldNotLookInApplicators1BoxedMap](#additionalpropertiesshouldnotlookinapplicators1boxedmap) + +sealed interface that stores validated payloads using boxed classes + +## AdditionalpropertiesShouldNotLookInApplicators1BoxedVoid +data class AdditionalpropertiesShouldNotLookInApplicators1BoxedVoid
+implements [AdditionalpropertiesShouldNotLookInApplicators1Boxed](#additionalpropertiesshouldnotlookinapplicators1boxed) + +data class that stores validated null payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| AdditionalpropertiesShouldNotLookInApplicators1BoxedVoid(Nothing? data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| Nothing? | data()
validated payload | +| Any? | getData()
validated payload | + +## AdditionalpropertiesShouldNotLookInApplicators1BoxedBoolean +data class AdditionalpropertiesShouldNotLookInApplicators1BoxedBoolean
+implements [AdditionalpropertiesShouldNotLookInApplicators1Boxed](#additionalpropertiesshouldnotlookinapplicators1boxed) + +record that stores validated boolean payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| AdditionalpropertiesShouldNotLookInApplicators1BoxedBoolean(boolean data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| boolean | data()
validated payload | +| Any? | getData()
validated payload | + +## AdditionalpropertiesShouldNotLookInApplicators1BoxedNumber +data class AdditionalpropertiesShouldNotLookInApplicators1BoxedNumber
+implements [AdditionalpropertiesShouldNotLookInApplicators1Boxed](#additionalpropertiesshouldnotlookinapplicators1boxed) + +data class that stores validated Number payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| AdditionalpropertiesShouldNotLookInApplicators1BoxedNumber(Number data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| Number | data()
validated payload | +| Any? | getData()
validated payload | + +## AdditionalpropertiesShouldNotLookInApplicators1BoxedString +data class AdditionalpropertiesShouldNotLookInApplicators1BoxedString
+implements [AdditionalpropertiesShouldNotLookInApplicators1Boxed](#additionalpropertiesshouldnotlookinapplicators1boxed) + +data class that stores validated String payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| AdditionalpropertiesShouldNotLookInApplicators1BoxedString(String data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| String | data()
validated payload | +| Any? | getData()
validated payload | + +## AdditionalpropertiesShouldNotLookInApplicators1BoxedList +data class AdditionalpropertiesShouldNotLookInApplicators1BoxedList
+implements [AdditionalpropertiesShouldNotLookInApplicators1Boxed](#additionalpropertiesshouldnotlookinapplicators1boxed) + +data class that stores validated List payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| AdditionalpropertiesShouldNotLookInApplicators1BoxedList(FrozenList data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| FrozenList | data()
validated payload | +| Any? | getData()
validated payload | + +## AdditionalpropertiesShouldNotLookInApplicators1BoxedMap +data class AdditionalpropertiesShouldNotLookInApplicators1BoxedMap
+implements [AdditionalpropertiesShouldNotLookInApplicators1Boxed](#additionalpropertiesshouldnotlookinapplicators1boxed) + +data class that stores validated Map payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| AdditionalpropertiesShouldNotLookInApplicators1BoxedMap([AdditionalpropertiesShouldNotLookInApplicatorsMap](#additionalpropertiesshouldnotlookinapplicatorsmap) data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| [AdditionalpropertiesShouldNotLookInApplicatorsMap](#additionalpropertiesshouldnotlookinapplicatorsmap) | data()
validated payload | +| Any? | getData()
validated payload | + +## AdditionalpropertiesShouldNotLookInApplicators1 +class AdditionalpropertiesShouldNotLookInApplicators1
+extends JsonSchema + +A schema class that validates payloads + +### Field Summary +| Modifier and Type | Field and Description | +| ----------------- | ---------------------- | +| Class | additionalProperties = [AdditionalProperties::class.java](#additionalproperties) | +| List> | allOf = listOf(
    [Schema0::class.java](#schema0)
;)
| + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| String | validate(arg: String, configuration: SchemaConfiguration) | +| Nothing? | validate(arg: Nothing?, configuration: SchemaConfiguration) | +| int | validate(arg: int, configuration: SchemaConfiguration) | +| long | validate(arg: long, configuration: SchemaConfiguration) | +| float | validate(arg: float, configuration: SchemaConfiguration) | +| double | validate(arg: double, configuration: SchemaConfiguration) | +| Number | validate(arg: Number, configuration: SchemaConfiguration) | +| boolean | validate(arg: boolean, configuration: SchemaConfiguration) | +| [AdditionalpropertiesShouldNotLookInApplicatorsMap](#additionalpropertiesshouldnotlookinapplicatorsmap) | validate(arg: [Map<?, ?>](#additionalpropertiesshouldnotlookinapplicatorsmapbuilder), configuration: SchemaConfiguration) | +| FrozenList | validate(arg: List<*>, configuration: SchemaConfiguration) | +| [AdditionalpropertiesShouldNotLookInApplicators1BoxedString](#additionalpropertiesshouldnotlookinapplicators1boxedstring) | validateAndBox(String, configuration: SchemaConfiguration) | +| [AdditionalpropertiesShouldNotLookInApplicators1BoxedVoid](#additionalpropertiesshouldnotlookinapplicators1boxedvoid) | validateAndBox(Nothing?, configuration: SchemaConfiguration) | +| [AdditionalpropertiesShouldNotLookInApplicators1BoxedNumber](#additionalpropertiesshouldnotlookinapplicators1boxednumber) | validateAndBox(Number, configuration: SchemaConfiguration) | +| [AdditionalpropertiesShouldNotLookInApplicators1BoxedBoolean](#additionalpropertiesshouldnotlookinapplicators1boxedboolean) | validateAndBox(boolean, configuration: SchemaConfiguration) | +| [AdditionalpropertiesShouldNotLookInApplicators1BoxedMap](#additionalpropertiesshouldnotlookinapplicators1boxedmap) | validateAndBox([Map<?, ?>](#additionalpropertiesshouldnotlookinapplicatorsmapbuilder), configuration: SchemaConfiguration) | +| [AdditionalpropertiesShouldNotLookInApplicators1BoxedList](#additionalpropertiesshouldnotlookinapplicators1boxedlist) | validateAndBox(List<*>, configuration: SchemaConfiguration) | +| [AdditionalpropertiesShouldNotLookInApplicators1Boxed](#additionalpropertiesshouldnotlookinapplicators1boxed) | validateAndBox(Any?, configuration: SchemaConfiguration) | +| Any? | validate(arg: Any?, configuration: SchemaConfiguration) | + +## AdditionalpropertiesShouldNotLookInApplicatorsMapBuilder +class AdditionalpropertiesShouldNotLookInApplicatorsMapBuilder
+builder for `Map` + +A class that builds the Map input type + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| AdditionalpropertiesShouldNotLookInApplicatorsMapBuilder()
Creates a builder that contains an empty map | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| Map | build()
Returns map input that should be used with Schema.validate | +| [AdditionalpropertiesShouldNotLookInApplicatorsMapBuilder](#additionalpropertiesshouldnotlookinapplicatorsmapbuilder) | additionalProperty(key: String, value: Boolean) | + +## AdditionalpropertiesShouldNotLookInApplicatorsMap +class AdditionalpropertiesShouldNotLookInApplicatorsMap
+extends FrozenMap + +A class to store validated Map payloads + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| static [AdditionalpropertiesShouldNotLookInApplicatorsMap](#additionalpropertiesshouldnotlookinapplicatorsmap) | of([Map](#additionalpropertiesshouldnotlookinapplicatorsmapbuilder) arg, SchemaConfiguration configuration) | +| Boolean | getAdditionalProperty(String name)
provides type safety for additional properties | + +## Schema0Boxed +sealed interface Schema0Boxed
+permits
+[Schema0BoxedVoid](#schema0boxedvoid), +[Schema0BoxedBoolean](#schema0boxedboolean), +[Schema0BoxedNumber](#schema0boxednumber), +[Schema0BoxedString](#schema0boxedstring), +[Schema0BoxedList](#schema0boxedlist), +[Schema0BoxedMap](#schema0boxedmap) + +sealed interface that stores validated payloads using boxed classes + +## Schema0BoxedVoid +data class Schema0BoxedVoid
+implements [Schema0Boxed](#schema0boxed) + +data class that stores validated null payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| Schema0BoxedVoid(Nothing? data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| Nothing? | data()
validated payload | +| Any? | getData()
validated payload | + +## Schema0BoxedBoolean +data class Schema0BoxedBoolean
+implements [Schema0Boxed](#schema0boxed) + +record that stores validated boolean payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| Schema0BoxedBoolean(boolean data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| boolean | data()
validated payload | +| Any? | getData()
validated payload | + +## Schema0BoxedNumber +data class Schema0BoxedNumber
+implements [Schema0Boxed](#schema0boxed) + +data class that stores validated Number payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| Schema0BoxedNumber(Number data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| Number | data()
validated payload | +| Any? | getData()
validated payload | + +## Schema0BoxedString +data class Schema0BoxedString
+implements [Schema0Boxed](#schema0boxed) + +data class that stores validated String payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| Schema0BoxedString(String data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| String | data()
validated payload | +| Any? | getData()
validated payload | + +## Schema0BoxedList +data class Schema0BoxedList
+implements [Schema0Boxed](#schema0boxed) + +data class that stores validated List payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| Schema0BoxedList(FrozenList data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| FrozenList | data()
validated payload | +| Any? | getData()
validated payload | + +## Schema0BoxedMap +data class Schema0BoxedMap
+implements [Schema0Boxed](#schema0boxed) + +data class that stores validated Map payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| Schema0BoxedMap([Schema0Map](#schema0map) data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| [Schema0Map](#schema0map) | data()
validated payload | +| Any? | getData()
validated payload | + +## Schema0 +class Schema0
+extends JsonSchema + +A schema class that validates payloads + +### Field Summary +| Modifier and Type | Field and Description | +| ----------------- | ---------------------- | +| Map> | properties = mapOf(
    "foo" to [Foo::class.java](#foo))
)
| + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| String | validate(arg: String, configuration: SchemaConfiguration) | +| Nothing? | validate(arg: Nothing?, configuration: SchemaConfiguration) | +| int | validate(arg: int, configuration: SchemaConfiguration) | +| long | validate(arg: long, configuration: SchemaConfiguration) | +| float | validate(arg: float, configuration: SchemaConfiguration) | +| double | validate(arg: double, configuration: SchemaConfiguration) | +| Number | validate(arg: Number, configuration: SchemaConfiguration) | +| boolean | validate(arg: boolean, configuration: SchemaConfiguration) | +| [Schema0Map](#schema0map) | validate(arg: [Map<?, ?>](#schema0mapbuilder), configuration: SchemaConfiguration) | +| FrozenList | validate(arg: List<*>, configuration: SchemaConfiguration) | +| [Schema0BoxedString](#schema0boxedstring) | validateAndBox(String, configuration: SchemaConfiguration) | +| [Schema0BoxedVoid](#schema0boxedvoid) | validateAndBox(Nothing?, configuration: SchemaConfiguration) | +| [Schema0BoxedNumber](#schema0boxednumber) | validateAndBox(Number, configuration: SchemaConfiguration) | +| [Schema0BoxedBoolean](#schema0boxedboolean) | validateAndBox(boolean, configuration: SchemaConfiguration) | +| [Schema0BoxedMap](#schema0boxedmap) | validateAndBox([Map<?, ?>](#schema0mapbuilder), configuration: SchemaConfiguration) | +| [Schema0BoxedList](#schema0boxedlist) | validateAndBox(List<*>, configuration: SchemaConfiguration) | +| [Schema0Boxed](#schema0boxed) | validateAndBox(Any?, configuration: SchemaConfiguration) | +| Any? | validate(arg: Any?, configuration: SchemaConfiguration) | + +## Schema0MapBuilder +class Schema0MapBuilder
+builder for `Map` + +A class that builds the Map input type + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| Schema0MapBuilder()
Creates a builder that contains an empty map | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| Map | build()
Returns map input that should be used with Schema.validate | +| [Schema0MapBuilder](#schema0mapbuilder) | foo(value: Nothing?) | +| [Schema0MapBuilder](#schema0mapbuilder) | foo(value: Boolean) | +| [Schema0MapBuilder](#schema0mapbuilder) | foo(value: String) | +| [Schema0MapBuilder](#schema0mapbuilder) | foo(value: Int) | +| [Schema0MapBuilder](#schema0mapbuilder) | foo(value: Float) | +| [Schema0MapBuilder](#schema0mapbuilder) | foo(value: Long) | +| [Schema0MapBuilder](#schema0mapbuilder) | foo(value: Double) | +| [Schema0MapBuilder](#schema0mapbuilder) | foo(value: List) | +| [Schema0MapBuilder](#schema0mapbuilder) | foo(value: Map) | +| [Schema0MapBuilder](#schema0mapbuilder) | additionalProperty(key: String, value: Nothing?) | +| [Schema0MapBuilder](#schema0mapbuilder) | additionalProperty(key: String, value: Boolean) | +| [Schema0MapBuilder](#schema0mapbuilder) | additionalProperty(key: String, value: String) | +| [Schema0MapBuilder](#schema0mapbuilder) | additionalProperty(key: String, value: Int) | +| [Schema0MapBuilder](#schema0mapbuilder) | additionalProperty(key: String, value: Float) | +| [Schema0MapBuilder](#schema0mapbuilder) | additionalProperty(key: String, value: Long) | +| [Schema0MapBuilder](#schema0mapbuilder) | additionalProperty(key: String, value: Double) | +| [Schema0MapBuilder](#schema0mapbuilder) | additionalProperty(key: String, value: List) | +| [Schema0MapBuilder](#schema0mapbuilder) | additionalProperty(key: String, value: Map) | + +## Schema0Map +class Schema0Map
+extends FrozenMap + +A class to store validated Map payloads + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| static [Schema0Map](#schema0map) | of([Map](#schema0mapbuilder) arg, SchemaConfiguration configuration) | +| Any? | foo()
[optional] | +| Any? | getAdditionalProperty(String name)
provides type safety for additional properties | + +## FooBoxed +sealed interface FooBoxed
+permits
+[FooBoxedVoid](#fooboxedvoid), +[FooBoxedBoolean](#fooboxedboolean), +[FooBoxedNumber](#fooboxednumber), +[FooBoxedString](#fooboxedstring), +[FooBoxedList](#fooboxedlist), +[FooBoxedMap](#fooboxedmap) + +sealed interface that stores validated payloads using boxed classes + +## FooBoxedVoid +data class FooBoxedVoid
+implements [FooBoxed](#fooboxed) + +data class that stores validated null payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| FooBoxedVoid(Nothing? data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| Nothing? | data()
validated payload | +| Any? | getData()
validated payload | + +## FooBoxedBoolean +data class FooBoxedBoolean
+implements [FooBoxed](#fooboxed) + +record that stores validated boolean payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| FooBoxedBoolean(boolean data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| boolean | data()
validated payload | +| Any? | getData()
validated payload | + +## FooBoxedNumber +data class FooBoxedNumber
+implements [FooBoxed](#fooboxed) + +data class that stores validated Number payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| FooBoxedNumber(Number data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| Number | data()
validated payload | +| Any? | getData()
validated payload | + +## FooBoxedString +data class FooBoxedString
+implements [FooBoxed](#fooboxed) + +data class that stores validated String payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| FooBoxedString(String data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| String | data()
validated payload | +| Any? | getData()
validated payload | + +## FooBoxedList +data class FooBoxedList
+implements [FooBoxed](#fooboxed) + +data class that stores validated List payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| FooBoxedList(FrozenList data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| FrozenList | data()
validated payload | +| Any? | getData()
validated payload | + +## FooBoxedMap +data class FooBoxedMap
+implements [FooBoxed](#fooboxed) + +data class that stores validated Map payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| FooBoxedMap(FrozenMap data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| FrozenMap | data()
validated payload | +| Any? | getData()
validated payload | + +## Foo +class Foo
+extends AnyTypeJsonSchema.AnyTypeJsonSchema1 + +A schema class that validates payloads + +| Methods Inherited from class org.openapijsonschematools.client.schemas.AnyTypeJsonSchema.AnyTypeJsonSchema1 | +| ------------------------------------------------------------------ | +| validate | +| validateAndBox | + +## AdditionalPropertiesBoxed +sealed interface AdditionalPropertiesBoxed
+permits
+[AdditionalPropertiesBoxedBoolean](#additionalpropertiesboxedboolean) + +sealed interface that stores validated payloads using boxed classes + +## AdditionalPropertiesBoxedBoolean +data class AdditionalPropertiesBoxedBoolean
+implements [AdditionalPropertiesBoxed](#additionalpropertiesboxed) + +record that stores validated boolean payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| AdditionalPropertiesBoxedBoolean(boolean data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| boolean | data()
validated payload | +| Any? | getData()
validated payload | + +## AdditionalProperties +class AdditionalProperties
+extends BooleanJsonSchema.BooleanJsonSchema1 + +A schema class that validates payloads + +| Methods Inherited from class org.openapijsonschematools.client.schemas.BooleanJsonSchema.BooleanJsonSchema1 | +| ------------------------------------------------------------------ | +| validate | +| validateAndBox | + +[[Back to top]](#top) [[Back to Component Schemas]](../../../README.md#Component-Schemas) [[Back to README]](../../../README.md) diff --git a/samples/client/3_0_3_unit_test/kotlin/docs/components/schemas/Allof.md b/samples/client/3_0_3_unit_test/kotlin/docs/components/schemas/Allof.md new file mode 100644 index 00000000000..5a211961ac4 --- /dev/null +++ b/samples/client/3_0_3_unit_test/kotlin/docs/components/schemas/Allof.md @@ -0,0 +1,674 @@ +# Allof +org.openapijsonschematools.client.components.schemas.Allof.java +class Allof
+ +A class that contains necessary nested +- schema classes (which validate payloads), extends JsonSchema +- sealed interfaces which store validated payloads, Kotlin version of a sum type +- boxed classes which store validated payloads, sealed permits class implementations +- classes to store validated map payloads, extends FrozenMap +- classes to build inputs for map payloads + +## Nested Class Summary +| Modifier and Type | Class and Description | +| ----------------- | ---------------------- | +| sealed interface | [Allof.Allof1Boxed](#allof1boxed)
sealed interface for validated payloads | +| record | [Allof.Allof1BoxedVoid](#allof1boxedvoid)
boxed class to store validated null payloads | +| record | [Allof.Allof1BoxedBoolean](#allof1boxedboolean)
boxed class to store validated boolean payloads | +| record | [Allof.Allof1BoxedNumber](#allof1boxednumber)
boxed class to store validated Number payloads | +| record | [Allof.Allof1BoxedString](#allof1boxedstring)
boxed class to store validated String payloads | +| record | [Allof.Allof1BoxedList](#allof1boxedlist)
boxed class to store validated List payloads | +| record | [Allof.Allof1BoxedMap](#allof1boxedmap)
boxed class to store validated Map payloads | +| static class | [Allof.Allof1](#allof1)
schema class | +| sealed interface | [Allof.Schema1Boxed](#schema1boxed)
sealed interface for validated payloads | +| record | [Allof.Schema1BoxedVoid](#schema1boxedvoid)
boxed class to store validated null payloads | +| record | [Allof.Schema1BoxedBoolean](#schema1boxedboolean)
boxed class to store validated boolean payloads | +| record | [Allof.Schema1BoxedNumber](#schema1boxednumber)
boxed class to store validated Number payloads | +| record | [Allof.Schema1BoxedString](#schema1boxedstring)
boxed class to store validated String payloads | +| record | [Allof.Schema1BoxedList](#schema1boxedlist)
boxed class to store validated List payloads | +| record | [Allof.Schema1BoxedMap](#schema1boxedmap)
boxed class to store validated Map payloads | +| static class | [Allof.Schema1](#schema1)
schema class | +| static class | [Allof.Schema1MapBuilder](#schema1mapbuilder)
builder for Map payloads | +| static class | [Allof.Schema1Map](#schema1map)
output class for Map payloads | +| sealed interface | [Allof.FooBoxed](#fooboxed)
sealed interface for validated payloads | +| record | [Allof.FooBoxedString](#fooboxedstring)
boxed class to store validated String payloads | +| static class | [Allof.Foo](#foo)
schema class | +| sealed interface | [Allof.Schema0Boxed](#schema0boxed)
sealed interface for validated payloads | +| record | [Allof.Schema0BoxedVoid](#schema0boxedvoid)
boxed class to store validated null payloads | +| record | [Allof.Schema0BoxedBoolean](#schema0boxedboolean)
boxed class to store validated boolean payloads | +| record | [Allof.Schema0BoxedNumber](#schema0boxednumber)
boxed class to store validated Number payloads | +| record | [Allof.Schema0BoxedString](#schema0boxedstring)
boxed class to store validated String payloads | +| record | [Allof.Schema0BoxedList](#schema0boxedlist)
boxed class to store validated List payloads | +| record | [Allof.Schema0BoxedMap](#schema0boxedmap)
boxed class to store validated Map payloads | +| static class | [Allof.Schema0](#schema0)
schema class | +| static class | [Allof.Schema0MapBuilder](#schema0mapbuilder)
builder for Map payloads | +| static class | [Allof.Schema0Map](#schema0map)
output class for Map payloads | +| sealed interface | [Allof.BarBoxed](#barboxed)
sealed interface for validated payloads | +| record | [Allof.BarBoxedNumber](#barboxednumber)
boxed class to store validated Number payloads | +| static class | [Allof.Bar](#bar)
schema class | + +## Allof1Boxed +sealed interface Allof1Boxed
+permits
+[Allof1BoxedVoid](#allof1boxedvoid), +[Allof1BoxedBoolean](#allof1boxedboolean), +[Allof1BoxedNumber](#allof1boxednumber), +[Allof1BoxedString](#allof1boxedstring), +[Allof1BoxedList](#allof1boxedlist), +[Allof1BoxedMap](#allof1boxedmap) + +sealed interface that stores validated payloads using boxed classes + +## Allof1BoxedVoid +data class Allof1BoxedVoid
+implements [Allof1Boxed](#allof1boxed) + +data class that stores validated null payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| Allof1BoxedVoid(Nothing? data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| Nothing? | data()
validated payload | +| Any? | getData()
validated payload | + +## Allof1BoxedBoolean +data class Allof1BoxedBoolean
+implements [Allof1Boxed](#allof1boxed) + +record that stores validated boolean payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| Allof1BoxedBoolean(boolean data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| boolean | data()
validated payload | +| Any? | getData()
validated payload | + +## Allof1BoxedNumber +data class Allof1BoxedNumber
+implements [Allof1Boxed](#allof1boxed) + +data class that stores validated Number payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| Allof1BoxedNumber(Number data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| Number | data()
validated payload | +| Any? | getData()
validated payload | + +## Allof1BoxedString +data class Allof1BoxedString
+implements [Allof1Boxed](#allof1boxed) + +data class that stores validated String payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| Allof1BoxedString(String data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| String | data()
validated payload | +| Any? | getData()
validated payload | + +## Allof1BoxedList +data class Allof1BoxedList
+implements [Allof1Boxed](#allof1boxed) + +data class that stores validated List payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| Allof1BoxedList(FrozenList data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| FrozenList | data()
validated payload | +| Any? | getData()
validated payload | + +## Allof1BoxedMap +data class Allof1BoxedMap
+implements [Allof1Boxed](#allof1boxed) + +data class that stores validated Map payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| Allof1BoxedMap(FrozenMap data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| FrozenMap | data()
validated payload | +| Any? | getData()
validated payload | + +## Allof1 +class Allof1
+extends JsonSchema + +A schema class that validates payloads + +### Field Summary +| Modifier and Type | Field and Description | +| ----------------- | ---------------------- | +| List> | allOf = listOf(
    [Schema0::class.java](#schema0),
    [Schema1::class.java](#schema1)
;)
| + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| String | validate(arg: String, configuration: SchemaConfiguration) | +| Nothing? | validate(arg: Nothing?, configuration: SchemaConfiguration) | +| int | validate(arg: int, configuration: SchemaConfiguration) | +| long | validate(arg: long, configuration: SchemaConfiguration) | +| float | validate(arg: float, configuration: SchemaConfiguration) | +| double | validate(arg: double, configuration: SchemaConfiguration) | +| Number | validate(arg: Number, configuration: SchemaConfiguration) | +| boolean | validate(arg: boolean, configuration: SchemaConfiguration) | +| FrozenMap | validate(arg: Map<?, ?>, configuration: SchemaConfiguration) | +| FrozenList | validate(arg: List<*>, configuration: SchemaConfiguration) | +| [Allof1BoxedString](#allof1boxedstring) | validateAndBox(String, configuration: SchemaConfiguration) | +| [Allof1BoxedVoid](#allof1boxedvoid) | validateAndBox(Nothing?, configuration: SchemaConfiguration) | +| [Allof1BoxedNumber](#allof1boxednumber) | validateAndBox(Number, configuration: SchemaConfiguration) | +| [Allof1BoxedBoolean](#allof1boxedboolean) | validateAndBox(boolean, configuration: SchemaConfiguration) | +| [Allof1BoxedMap](#allof1boxedmap) | validateAndBox(Map<?, ?>, configuration: SchemaConfiguration) | +| [Allof1BoxedList](#allof1boxedlist) | validateAndBox(List<*>, configuration: SchemaConfiguration) | +| [Allof1Boxed](#allof1boxed) | validateAndBox(Any?, configuration: SchemaConfiguration) | +| Any? | validate(arg: Any?, configuration: SchemaConfiguration) | + +## Schema1Boxed +sealed interface Schema1Boxed
+permits
+[Schema1BoxedVoid](#schema1boxedvoid), +[Schema1BoxedBoolean](#schema1boxedboolean), +[Schema1BoxedNumber](#schema1boxednumber), +[Schema1BoxedString](#schema1boxedstring), +[Schema1BoxedList](#schema1boxedlist), +[Schema1BoxedMap](#schema1boxedmap) + +sealed interface that stores validated payloads using boxed classes + +## Schema1BoxedVoid +data class Schema1BoxedVoid
+implements [Schema1Boxed](#schema1boxed) + +data class that stores validated null payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| Schema1BoxedVoid(Nothing? data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| Nothing? | data()
validated payload | +| Any? | getData()
validated payload | + +## Schema1BoxedBoolean +data class Schema1BoxedBoolean
+implements [Schema1Boxed](#schema1boxed) + +record that stores validated boolean payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| Schema1BoxedBoolean(boolean data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| boolean | data()
validated payload | +| Any? | getData()
validated payload | + +## Schema1BoxedNumber +data class Schema1BoxedNumber
+implements [Schema1Boxed](#schema1boxed) + +data class that stores validated Number payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| Schema1BoxedNumber(Number data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| Number | data()
validated payload | +| Any? | getData()
validated payload | + +## Schema1BoxedString +data class Schema1BoxedString
+implements [Schema1Boxed](#schema1boxed) + +data class that stores validated String payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| Schema1BoxedString(String data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| String | data()
validated payload | +| Any? | getData()
validated payload | + +## Schema1BoxedList +data class Schema1BoxedList
+implements [Schema1Boxed](#schema1boxed) + +data class that stores validated List payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| Schema1BoxedList(FrozenList data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| FrozenList | data()
validated payload | +| Any? | getData()
validated payload | + +## Schema1BoxedMap +data class Schema1BoxedMap
+implements [Schema1Boxed](#schema1boxed) + +data class that stores validated Map payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| Schema1BoxedMap([Schema1Map](#schema1map) data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| [Schema1Map](#schema1map) | data()
validated payload | +| Any? | getData()
validated payload | + +## Schema1 +class Schema1
+extends JsonSchema + +A schema class that validates payloads + +### Field Summary +| Modifier and Type | Field and Description | +| ----------------- | ---------------------- | +| Map> | properties = mapOf(
    "foo" to [Foo::class.java](#foo))
)
| +| Set | required = setOf(
    "foo"
)
| + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| String | validate(arg: String, configuration: SchemaConfiguration) | +| Nothing? | validate(arg: Nothing?, configuration: SchemaConfiguration) | +| int | validate(arg: int, configuration: SchemaConfiguration) | +| long | validate(arg: long, configuration: SchemaConfiguration) | +| float | validate(arg: float, configuration: SchemaConfiguration) | +| double | validate(arg: double, configuration: SchemaConfiguration) | +| Number | validate(arg: Number, configuration: SchemaConfiguration) | +| boolean | validate(arg: boolean, configuration: SchemaConfiguration) | +| [Schema1Map](#schema1map) | validate(arg: [Map<?, ?>](#schema1mapbuilder), configuration: SchemaConfiguration) | +| FrozenList | validate(arg: List<*>, configuration: SchemaConfiguration) | +| [Schema1BoxedString](#schema1boxedstring) | validateAndBox(String, configuration: SchemaConfiguration) | +| [Schema1BoxedVoid](#schema1boxedvoid) | validateAndBox(Nothing?, configuration: SchemaConfiguration) | +| [Schema1BoxedNumber](#schema1boxednumber) | validateAndBox(Number, configuration: SchemaConfiguration) | +| [Schema1BoxedBoolean](#schema1boxedboolean) | validateAndBox(boolean, configuration: SchemaConfiguration) | +| [Schema1BoxedMap](#schema1boxedmap) | validateAndBox([Map<?, ?>](#schema1mapbuilder), configuration: SchemaConfiguration) | +| [Schema1BoxedList](#schema1boxedlist) | validateAndBox(List<*>, configuration: SchemaConfiguration) | +| [Schema1Boxed](#schema1boxed) | validateAndBox(Any?, configuration: SchemaConfiguration) | +| Any? | validate(arg: Any?, configuration: SchemaConfiguration) | + +## Schema1Map0Builder +class Schema1Map0Builder
+builder for `Map` + +A class that builds the Map input type + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| Schema1Map0Builder(Map instance)
Creates a builder that contains the passed instance | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| Map | build()
Returns map input that should be used with Schema.validate | +| [Schema1Map0Builder](#schema1map0builder) | additionalProperty(key: String, value: Nothing?) | +| [Schema1Map0Builder](#schema1map0builder) | additionalProperty(key: String, value: Boolean) | +| [Schema1Map0Builder](#schema1map0builder) | additionalProperty(key: String, value: String) | +| [Schema1Map0Builder](#schema1map0builder) | additionalProperty(key: String, value: Int) | +| [Schema1Map0Builder](#schema1map0builder) | additionalProperty(key: String, value: Float) | +| [Schema1Map0Builder](#schema1map0builder) | additionalProperty(key: String, value: Long) | +| [Schema1Map0Builder](#schema1map0builder) | additionalProperty(key: String, value: Double) | +| [Schema1Map0Builder](#schema1map0builder) | additionalProperty(key: String, value: List) | +| [Schema1Map0Builder](#schema1map0builder) | additionalProperty(key: String, value: Map) | + +## Schema1MapBuilder +class Schema1MapBuilder
+builder for `Map` + +A class that builds the Map input type + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| Schema1MapBuilder()
Creates a builder that contains an empty map | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| [Schema1Map0Builder](#schema1map0builder) | foo(value: String) | + +## Schema1Map +class Schema1Map
+extends FrozenMap + +A class to store validated Map payloads + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| static [Schema1Map](#schema1map) | of([Map](#schema1mapbuilder) arg, SchemaConfiguration configuration) | +| String | foo()
| +| Any? | getAdditionalProperty(String name)
provides type safety for additional properties | + +## FooBoxed +sealed interface FooBoxed
+permits
+[FooBoxedString](#fooboxedstring) + +sealed interface that stores validated payloads using boxed classes + +## FooBoxedString +data class FooBoxedString
+implements [FooBoxed](#fooboxed) + +data class that stores validated String payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| FooBoxedString(String data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| String | data()
validated payload | +| Any? | getData()
validated payload | + +## Foo +class Foo
+extends StringJsonSchema.StringJsonSchema1 + +A schema class that validates payloads + +| Methods Inherited from class org.openapijsonschematools.client.schemas.StringJsonSchema.StringJsonSchema1 | +| ------------------------------------------------------------------ | +| validate | +| validateAndBox | + +## Schema0Boxed +sealed interface Schema0Boxed
+permits
+[Schema0BoxedVoid](#schema0boxedvoid), +[Schema0BoxedBoolean](#schema0boxedboolean), +[Schema0BoxedNumber](#schema0boxednumber), +[Schema0BoxedString](#schema0boxedstring), +[Schema0BoxedList](#schema0boxedlist), +[Schema0BoxedMap](#schema0boxedmap) + +sealed interface that stores validated payloads using boxed classes + +## Schema0BoxedVoid +data class Schema0BoxedVoid
+implements [Schema0Boxed](#schema0boxed) + +data class that stores validated null payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| Schema0BoxedVoid(Nothing? data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| Nothing? | data()
validated payload | +| Any? | getData()
validated payload | + +## Schema0BoxedBoolean +data class Schema0BoxedBoolean
+implements [Schema0Boxed](#schema0boxed) + +record that stores validated boolean payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| Schema0BoxedBoolean(boolean data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| boolean | data()
validated payload | +| Any? | getData()
validated payload | + +## Schema0BoxedNumber +data class Schema0BoxedNumber
+implements [Schema0Boxed](#schema0boxed) + +data class that stores validated Number payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| Schema0BoxedNumber(Number data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| Number | data()
validated payload | +| Any? | getData()
validated payload | + +## Schema0BoxedString +data class Schema0BoxedString
+implements [Schema0Boxed](#schema0boxed) + +data class that stores validated String payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| Schema0BoxedString(String data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| String | data()
validated payload | +| Any? | getData()
validated payload | + +## Schema0BoxedList +data class Schema0BoxedList
+implements [Schema0Boxed](#schema0boxed) + +data class that stores validated List payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| Schema0BoxedList(FrozenList data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| FrozenList | data()
validated payload | +| Any? | getData()
validated payload | + +## Schema0BoxedMap +data class Schema0BoxedMap
+implements [Schema0Boxed](#schema0boxed) + +data class that stores validated Map payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| Schema0BoxedMap([Schema0Map](#schema0map) data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| [Schema0Map](#schema0map) | data()
validated payload | +| Any? | getData()
validated payload | + +## Schema0 +class Schema0
+extends JsonSchema + +A schema class that validates payloads + +### Field Summary +| Modifier and Type | Field and Description | +| ----------------- | ---------------------- | +| Map> | properties = mapOf(
    "bar" to [Bar::class.java](#bar))
)
| +| Set | required = setOf(
    "bar"
)
| + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| String | validate(arg: String, configuration: SchemaConfiguration) | +| Nothing? | validate(arg: Nothing?, configuration: SchemaConfiguration) | +| int | validate(arg: int, configuration: SchemaConfiguration) | +| long | validate(arg: long, configuration: SchemaConfiguration) | +| float | validate(arg: float, configuration: SchemaConfiguration) | +| double | validate(arg: double, configuration: SchemaConfiguration) | +| Number | validate(arg: Number, configuration: SchemaConfiguration) | +| boolean | validate(arg: boolean, configuration: SchemaConfiguration) | +| [Schema0Map](#schema0map) | validate(arg: [Map<?, ?>](#schema0mapbuilder), configuration: SchemaConfiguration) | +| FrozenList | validate(arg: List<*>, configuration: SchemaConfiguration) | +| [Schema0BoxedString](#schema0boxedstring) | validateAndBox(String, configuration: SchemaConfiguration) | +| [Schema0BoxedVoid](#schema0boxedvoid) | validateAndBox(Nothing?, configuration: SchemaConfiguration) | +| [Schema0BoxedNumber](#schema0boxednumber) | validateAndBox(Number, configuration: SchemaConfiguration) | +| [Schema0BoxedBoolean](#schema0boxedboolean) | validateAndBox(boolean, configuration: SchemaConfiguration) | +| [Schema0BoxedMap](#schema0boxedmap) | validateAndBox([Map<?, ?>](#schema0mapbuilder), configuration: SchemaConfiguration) | +| [Schema0BoxedList](#schema0boxedlist) | validateAndBox(List<*>, configuration: SchemaConfiguration) | +| [Schema0Boxed](#schema0boxed) | validateAndBox(Any?, configuration: SchemaConfiguration) | +| Any? | validate(arg: Any?, configuration: SchemaConfiguration) | + +## Schema0Map0Builder +class Schema0Map0Builder
+builder for `Map` + +A class that builds the Map input type + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| Schema0Map0Builder(Map instance)
Creates a builder that contains the passed instance | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| Map | build()
Returns map input that should be used with Schema.validate | +| [Schema0Map0Builder](#schema0map0builder) | additionalProperty(key: String, value: Nothing?) | +| [Schema0Map0Builder](#schema0map0builder) | additionalProperty(key: String, value: Boolean) | +| [Schema0Map0Builder](#schema0map0builder) | additionalProperty(key: String, value: String) | +| [Schema0Map0Builder](#schema0map0builder) | additionalProperty(key: String, value: Int) | +| [Schema0Map0Builder](#schema0map0builder) | additionalProperty(key: String, value: Float) | +| [Schema0Map0Builder](#schema0map0builder) | additionalProperty(key: String, value: Long) | +| [Schema0Map0Builder](#schema0map0builder) | additionalProperty(key: String, value: Double) | +| [Schema0Map0Builder](#schema0map0builder) | additionalProperty(key: String, value: List) | +| [Schema0Map0Builder](#schema0map0builder) | additionalProperty(key: String, value: Map) | + +## Schema0MapBuilder +class Schema0MapBuilder
+builder for `Map` + +A class that builds the Map input type + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| Schema0MapBuilder()
Creates a builder that contains an empty map | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| [Schema0Map0Builder](#schema0map0builder) | bar(value: Int) | +| [Schema0Map0Builder](#schema0map0builder) | bar(value: Float) | +| [Schema0Map0Builder](#schema0map0builder) | bar(value: Long) | +| [Schema0Map0Builder](#schema0map0builder) | bar(value: Double) | + +## Schema0Map +class Schema0Map
+extends FrozenMap + +A class to store validated Map payloads + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| static [Schema0Map](#schema0map) | of([Map](#schema0mapbuilder) arg, SchemaConfiguration configuration) | +| Number | bar()
| +| Any? | getAdditionalProperty(String name)
provides type safety for additional properties | + +## BarBoxed +sealed interface BarBoxed
+permits
+[BarBoxedNumber](#barboxednumber) + +sealed interface that stores validated payloads using boxed classes + +## BarBoxedNumber +data class BarBoxedNumber
+implements [BarBoxed](#barboxed) + +data class that stores validated Number payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| BarBoxedNumber(Number data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| Number | data()
validated payload | +| Any? | getData()
validated payload | + +## Bar +class Bar
+extends IntJsonSchema.IntJsonSchema1 + +A schema class that validates payloads + +| Methods Inherited from class org.openapijsonschematools.client.schemas.IntJsonSchema.IntJsonSchema1 | +| ------------------------------------------------------------------ | +| validate | +| validateAndBox | + +[[Back to top]](#top) [[Back to Component Schemas]](../../../README.md#Component-Schemas) [[Back to README]](../../../README.md) diff --git a/samples/client/3_0_3_unit_test/kotlin/docs/components/schemas/AllofCombinedWithAnyofOneof.md b/samples/client/3_0_3_unit_test/kotlin/docs/components/schemas/AllofCombinedWithAnyofOneof.md new file mode 100644 index 00000000000..be071761cb0 --- /dev/null +++ b/samples/client/3_0_3_unit_test/kotlin/docs/components/schemas/AllofCombinedWithAnyofOneof.md @@ -0,0 +1,636 @@ +# AllofCombinedWithAnyofOneof +org.openapijsonschematools.client.components.schemas.AllofCombinedWithAnyofOneof.java +class AllofCombinedWithAnyofOneof
+ +A class that contains necessary nested +- schema classes (which validate payloads), extends JsonSchema +- sealed interfaces which store validated payloads, Kotlin version of a sum type +- boxed classes which store validated payloads, sealed permits class implementations + +## Nested Class Summary +| Modifier and Type | Class and Description | +| ----------------- | ---------------------- | +| sealed interface | [AllofCombinedWithAnyofOneof.AllofCombinedWithAnyofOneof1Boxed](#allofcombinedwithanyofoneof1boxed)
sealed interface for validated payloads | +| record | [AllofCombinedWithAnyofOneof.AllofCombinedWithAnyofOneof1BoxedVoid](#allofcombinedwithanyofoneof1boxedvoid)
boxed class to store validated null payloads | +| record | [AllofCombinedWithAnyofOneof.AllofCombinedWithAnyofOneof1BoxedBoolean](#allofcombinedwithanyofoneof1boxedboolean)
boxed class to store validated boolean payloads | +| record | [AllofCombinedWithAnyofOneof.AllofCombinedWithAnyofOneof1BoxedNumber](#allofcombinedwithanyofoneof1boxednumber)
boxed class to store validated Number payloads | +| record | [AllofCombinedWithAnyofOneof.AllofCombinedWithAnyofOneof1BoxedString](#allofcombinedwithanyofoneof1boxedstring)
boxed class to store validated String payloads | +| record | [AllofCombinedWithAnyofOneof.AllofCombinedWithAnyofOneof1BoxedList](#allofcombinedwithanyofoneof1boxedlist)
boxed class to store validated List payloads | +| record | [AllofCombinedWithAnyofOneof.AllofCombinedWithAnyofOneof1BoxedMap](#allofcombinedwithanyofoneof1boxedmap)
boxed class to store validated Map payloads | +| static class | [AllofCombinedWithAnyofOneof.AllofCombinedWithAnyofOneof1](#allofcombinedwithanyofoneof1)
schema class | +| sealed interface | [AllofCombinedWithAnyofOneof.Schema0Boxed](#schema0boxed)
sealed interface for validated payloads | +| record | [AllofCombinedWithAnyofOneof.Schema0BoxedVoid](#schema0boxedvoid)
boxed class to store validated null payloads | +| record | [AllofCombinedWithAnyofOneof.Schema0BoxedBoolean](#schema0boxedboolean)
boxed class to store validated boolean payloads | +| record | [AllofCombinedWithAnyofOneof.Schema0BoxedNumber](#schema0boxednumber)
boxed class to store validated Number payloads | +| record | [AllofCombinedWithAnyofOneof.Schema0BoxedString](#schema0boxedstring)
boxed class to store validated String payloads | +| record | [AllofCombinedWithAnyofOneof.Schema0BoxedList](#schema0boxedlist)
boxed class to store validated List payloads | +| record | [AllofCombinedWithAnyofOneof.Schema0BoxedMap](#schema0boxedmap)
boxed class to store validated Map payloads | +| static class | [AllofCombinedWithAnyofOneof.Schema0](#schema0)
schema class | +| sealed interface | [AllofCombinedWithAnyofOneof.Schema01Boxed](#schema01boxed)
sealed interface for validated payloads | +| record | [AllofCombinedWithAnyofOneof.Schema01BoxedVoid](#schema01boxedvoid)
boxed class to store validated null payloads | +| record | [AllofCombinedWithAnyofOneof.Schema01BoxedBoolean](#schema01boxedboolean)
boxed class to store validated boolean payloads | +| record | [AllofCombinedWithAnyofOneof.Schema01BoxedNumber](#schema01boxednumber)
boxed class to store validated Number payloads | +| record | [AllofCombinedWithAnyofOneof.Schema01BoxedString](#schema01boxedstring)
boxed class to store validated String payloads | +| record | [AllofCombinedWithAnyofOneof.Schema01BoxedList](#schema01boxedlist)
boxed class to store validated List payloads | +| record | [AllofCombinedWithAnyofOneof.Schema01BoxedMap](#schema01boxedmap)
boxed class to store validated Map payloads | +| static class | [AllofCombinedWithAnyofOneof.Schema01](#schema01)
schema class | +| sealed interface | [AllofCombinedWithAnyofOneof.Schema02Boxed](#schema02boxed)
sealed interface for validated payloads | +| record | [AllofCombinedWithAnyofOneof.Schema02BoxedVoid](#schema02boxedvoid)
boxed class to store validated null payloads | +| record | [AllofCombinedWithAnyofOneof.Schema02BoxedBoolean](#schema02boxedboolean)
boxed class to store validated boolean payloads | +| record | [AllofCombinedWithAnyofOneof.Schema02BoxedNumber](#schema02boxednumber)
boxed class to store validated Number payloads | +| record | [AllofCombinedWithAnyofOneof.Schema02BoxedString](#schema02boxedstring)
boxed class to store validated String payloads | +| record | [AllofCombinedWithAnyofOneof.Schema02BoxedList](#schema02boxedlist)
boxed class to store validated List payloads | +| record | [AllofCombinedWithAnyofOneof.Schema02BoxedMap](#schema02boxedmap)
boxed class to store validated Map payloads | +| static class | [AllofCombinedWithAnyofOneof.Schema02](#schema02)
schema class | + +## AllofCombinedWithAnyofOneof1Boxed +sealed interface AllofCombinedWithAnyofOneof1Boxed
+permits
+[AllofCombinedWithAnyofOneof1BoxedVoid](#allofcombinedwithanyofoneof1boxedvoid), +[AllofCombinedWithAnyofOneof1BoxedBoolean](#allofcombinedwithanyofoneof1boxedboolean), +[AllofCombinedWithAnyofOneof1BoxedNumber](#allofcombinedwithanyofoneof1boxednumber), +[AllofCombinedWithAnyofOneof1BoxedString](#allofcombinedwithanyofoneof1boxedstring), +[AllofCombinedWithAnyofOneof1BoxedList](#allofcombinedwithanyofoneof1boxedlist), +[AllofCombinedWithAnyofOneof1BoxedMap](#allofcombinedwithanyofoneof1boxedmap) + +sealed interface that stores validated payloads using boxed classes + +## AllofCombinedWithAnyofOneof1BoxedVoid +data class AllofCombinedWithAnyofOneof1BoxedVoid
+implements [AllofCombinedWithAnyofOneof1Boxed](#allofcombinedwithanyofoneof1boxed) + +data class that stores validated null payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| AllofCombinedWithAnyofOneof1BoxedVoid(Nothing? data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| Nothing? | data()
validated payload | +| Any? | getData()
validated payload | + +## AllofCombinedWithAnyofOneof1BoxedBoolean +data class AllofCombinedWithAnyofOneof1BoxedBoolean
+implements [AllofCombinedWithAnyofOneof1Boxed](#allofcombinedwithanyofoneof1boxed) + +record that stores validated boolean payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| AllofCombinedWithAnyofOneof1BoxedBoolean(boolean data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| boolean | data()
validated payload | +| Any? | getData()
validated payload | + +## AllofCombinedWithAnyofOneof1BoxedNumber +data class AllofCombinedWithAnyofOneof1BoxedNumber
+implements [AllofCombinedWithAnyofOneof1Boxed](#allofcombinedwithanyofoneof1boxed) + +data class that stores validated Number payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| AllofCombinedWithAnyofOneof1BoxedNumber(Number data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| Number | data()
validated payload | +| Any? | getData()
validated payload | + +## AllofCombinedWithAnyofOneof1BoxedString +data class AllofCombinedWithAnyofOneof1BoxedString
+implements [AllofCombinedWithAnyofOneof1Boxed](#allofcombinedwithanyofoneof1boxed) + +data class that stores validated String payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| AllofCombinedWithAnyofOneof1BoxedString(String data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| String | data()
validated payload | +| Any? | getData()
validated payload | + +## AllofCombinedWithAnyofOneof1BoxedList +data class AllofCombinedWithAnyofOneof1BoxedList
+implements [AllofCombinedWithAnyofOneof1Boxed](#allofcombinedwithanyofoneof1boxed) + +data class that stores validated List payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| AllofCombinedWithAnyofOneof1BoxedList(FrozenList data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| FrozenList | data()
validated payload | +| Any? | getData()
validated payload | + +## AllofCombinedWithAnyofOneof1BoxedMap +data class AllofCombinedWithAnyofOneof1BoxedMap
+implements [AllofCombinedWithAnyofOneof1Boxed](#allofcombinedwithanyofoneof1boxed) + +data class that stores validated Map payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| AllofCombinedWithAnyofOneof1BoxedMap(FrozenMap data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| FrozenMap | data()
validated payload | +| Any? | getData()
validated payload | + +## AllofCombinedWithAnyofOneof1 +class AllofCombinedWithAnyofOneof1
+extends JsonSchema + +A schema class that validates payloads + +### Field Summary +| Modifier and Type | Field and Description | +| ----------------- | ---------------------- | +| List> | allOf = listOf(
    [Schema02::class.java](#schema02)
;)
| +| List> | anyOf = listOf(
    [Schema01::class.java](#schema01)
)
| +| List> | oneOf = listOf(
    [Schema0::class.java](#schema0)
))
| + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| String | validate(arg: String, configuration: SchemaConfiguration) | +| Nothing? | validate(arg: Nothing?, configuration: SchemaConfiguration) | +| int | validate(arg: int, configuration: SchemaConfiguration) | +| long | validate(arg: long, configuration: SchemaConfiguration) | +| float | validate(arg: float, configuration: SchemaConfiguration) | +| double | validate(arg: double, configuration: SchemaConfiguration) | +| Number | validate(arg: Number, configuration: SchemaConfiguration) | +| boolean | validate(arg: boolean, configuration: SchemaConfiguration) | +| FrozenMap | validate(arg: Map<?, ?>, configuration: SchemaConfiguration) | +| FrozenList | validate(arg: List<*>, configuration: SchemaConfiguration) | +| [AllofCombinedWithAnyofOneof1BoxedString](#allofcombinedwithanyofoneof1boxedstring) | validateAndBox(String, configuration: SchemaConfiguration) | +| [AllofCombinedWithAnyofOneof1BoxedVoid](#allofcombinedwithanyofoneof1boxedvoid) | validateAndBox(Nothing?, configuration: SchemaConfiguration) | +| [AllofCombinedWithAnyofOneof1BoxedNumber](#allofcombinedwithanyofoneof1boxednumber) | validateAndBox(Number, configuration: SchemaConfiguration) | +| [AllofCombinedWithAnyofOneof1BoxedBoolean](#allofcombinedwithanyofoneof1boxedboolean) | validateAndBox(boolean, configuration: SchemaConfiguration) | +| [AllofCombinedWithAnyofOneof1BoxedMap](#allofcombinedwithanyofoneof1boxedmap) | validateAndBox(Map<?, ?>, configuration: SchemaConfiguration) | +| [AllofCombinedWithAnyofOneof1BoxedList](#allofcombinedwithanyofoneof1boxedlist) | validateAndBox(List<*>, configuration: SchemaConfiguration) | +| [AllofCombinedWithAnyofOneof1Boxed](#allofcombinedwithanyofoneof1boxed) | validateAndBox(Any?, configuration: SchemaConfiguration) | +| Any? | validate(arg: Any?, configuration: SchemaConfiguration) | + +## Schema0Boxed +sealed interface Schema0Boxed
+permits
+[Schema0BoxedVoid](#schema0boxedvoid), +[Schema0BoxedBoolean](#schema0boxedboolean), +[Schema0BoxedNumber](#schema0boxednumber), +[Schema0BoxedString](#schema0boxedstring), +[Schema0BoxedList](#schema0boxedlist), +[Schema0BoxedMap](#schema0boxedmap) + +sealed interface that stores validated payloads using boxed classes + +## Schema0BoxedVoid +data class Schema0BoxedVoid
+implements [Schema0Boxed](#schema0boxed) + +data class that stores validated null payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| Schema0BoxedVoid(Nothing? data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| Nothing? | data()
validated payload | +| Any? | getData()
validated payload | + +## Schema0BoxedBoolean +data class Schema0BoxedBoolean
+implements [Schema0Boxed](#schema0boxed) + +record that stores validated boolean payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| Schema0BoxedBoolean(boolean data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| boolean | data()
validated payload | +| Any? | getData()
validated payload | + +## Schema0BoxedNumber +data class Schema0BoxedNumber
+implements [Schema0Boxed](#schema0boxed) + +data class that stores validated Number payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| Schema0BoxedNumber(Number data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| Number | data()
validated payload | +| Any? | getData()
validated payload | + +## Schema0BoxedString +data class Schema0BoxedString
+implements [Schema0Boxed](#schema0boxed) + +data class that stores validated String payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| Schema0BoxedString(String data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| String | data()
validated payload | +| Any? | getData()
validated payload | + +## Schema0BoxedList +data class Schema0BoxedList
+implements [Schema0Boxed](#schema0boxed) + +data class that stores validated List payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| Schema0BoxedList(FrozenList data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| FrozenList | data()
validated payload | +| Any? | getData()
validated payload | + +## Schema0BoxedMap +data class Schema0BoxedMap
+implements [Schema0Boxed](#schema0boxed) + +data class that stores validated Map payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| Schema0BoxedMap(FrozenMap data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| FrozenMap | data()
validated payload | +| Any? | getData()
validated payload | + +## Schema0 +class Schema0
+extends JsonSchema + +A schema class that validates payloads + +### Field Summary +| Modifier and Type | Field and Description | +| ----------------- | ---------------------- | +| BigDecimal | multipleOf = BigDecimal("5") | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| String | validate(arg: String, configuration: SchemaConfiguration) | +| Nothing? | validate(arg: Nothing?, configuration: SchemaConfiguration) | +| int | validate(arg: int, configuration: SchemaConfiguration) | +| long | validate(arg: long, configuration: SchemaConfiguration) | +| float | validate(arg: float, configuration: SchemaConfiguration) | +| double | validate(arg: double, configuration: SchemaConfiguration) | +| Number | validate(arg: Number, configuration: SchemaConfiguration) | +| boolean | validate(arg: boolean, configuration: SchemaConfiguration) | +| FrozenMap | validate(arg: Map<?, ?>, configuration: SchemaConfiguration) | +| FrozenList | validate(arg: List<*>, configuration: SchemaConfiguration) | +| [Schema0BoxedString](#schema0boxedstring) | validateAndBox(String, configuration: SchemaConfiguration) | +| [Schema0BoxedVoid](#schema0boxedvoid) | validateAndBox(Nothing?, configuration: SchemaConfiguration) | +| [Schema0BoxedNumber](#schema0boxednumber) | validateAndBox(Number, configuration: SchemaConfiguration) | +| [Schema0BoxedBoolean](#schema0boxedboolean) | validateAndBox(boolean, configuration: SchemaConfiguration) | +| [Schema0BoxedMap](#schema0boxedmap) | validateAndBox(Map<?, ?>, configuration: SchemaConfiguration) | +| [Schema0BoxedList](#schema0boxedlist) | validateAndBox(List<*>, configuration: SchemaConfiguration) | +| [Schema0Boxed](#schema0boxed) | validateAndBox(Any?, configuration: SchemaConfiguration) | +| Any? | validate(arg: Any?, configuration: SchemaConfiguration) | + +## Schema01Boxed +sealed interface Schema01Boxed
+permits
+[Schema01BoxedVoid](#schema01boxedvoid), +[Schema01BoxedBoolean](#schema01boxedboolean), +[Schema01BoxedNumber](#schema01boxednumber), +[Schema01BoxedString](#schema01boxedstring), +[Schema01BoxedList](#schema01boxedlist), +[Schema01BoxedMap](#schema01boxedmap) + +sealed interface that stores validated payloads using boxed classes + +## Schema01BoxedVoid +data class Schema01BoxedVoid
+implements [Schema01Boxed](#schema01boxed) + +data class that stores validated null payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| Schema01BoxedVoid(Nothing? data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| Nothing? | data()
validated payload | +| Any? | getData()
validated payload | + +## Schema01BoxedBoolean +data class Schema01BoxedBoolean
+implements [Schema01Boxed](#schema01boxed) + +record that stores validated boolean payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| Schema01BoxedBoolean(boolean data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| boolean | data()
validated payload | +| Any? | getData()
validated payload | + +## Schema01BoxedNumber +data class Schema01BoxedNumber
+implements [Schema01Boxed](#schema01boxed) + +data class that stores validated Number payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| Schema01BoxedNumber(Number data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| Number | data()
validated payload | +| Any? | getData()
validated payload | + +## Schema01BoxedString +data class Schema01BoxedString
+implements [Schema01Boxed](#schema01boxed) + +data class that stores validated String payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| Schema01BoxedString(String data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| String | data()
validated payload | +| Any? | getData()
validated payload | + +## Schema01BoxedList +data class Schema01BoxedList
+implements [Schema01Boxed](#schema01boxed) + +data class that stores validated List payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| Schema01BoxedList(FrozenList data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| FrozenList | data()
validated payload | +| Any? | getData()
validated payload | + +## Schema01BoxedMap +data class Schema01BoxedMap
+implements [Schema01Boxed](#schema01boxed) + +data class that stores validated Map payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| Schema01BoxedMap(FrozenMap data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| FrozenMap | data()
validated payload | +| Any? | getData()
validated payload | + +## Schema01 +class Schema01
+extends JsonSchema + +A schema class that validates payloads + +### Field Summary +| Modifier and Type | Field and Description | +| ----------------- | ---------------------- | +| BigDecimal | multipleOf = BigDecimal("3") | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| String | validate(arg: String, configuration: SchemaConfiguration) | +| Nothing? | validate(arg: Nothing?, configuration: SchemaConfiguration) | +| int | validate(arg: int, configuration: SchemaConfiguration) | +| long | validate(arg: long, configuration: SchemaConfiguration) | +| float | validate(arg: float, configuration: SchemaConfiguration) | +| double | validate(arg: double, configuration: SchemaConfiguration) | +| Number | validate(arg: Number, configuration: SchemaConfiguration) | +| boolean | validate(arg: boolean, configuration: SchemaConfiguration) | +| FrozenMap | validate(arg: Map<?, ?>, configuration: SchemaConfiguration) | +| FrozenList | validate(arg: List<*>, configuration: SchemaConfiguration) | +| [Schema01BoxedString](#schema01boxedstring) | validateAndBox(String, configuration: SchemaConfiguration) | +| [Schema01BoxedVoid](#schema01boxedvoid) | validateAndBox(Nothing?, configuration: SchemaConfiguration) | +| [Schema01BoxedNumber](#schema01boxednumber) | validateAndBox(Number, configuration: SchemaConfiguration) | +| [Schema01BoxedBoolean](#schema01boxedboolean) | validateAndBox(boolean, configuration: SchemaConfiguration) | +| [Schema01BoxedMap](#schema01boxedmap) | validateAndBox(Map<?, ?>, configuration: SchemaConfiguration) | +| [Schema01BoxedList](#schema01boxedlist) | validateAndBox(List<*>, configuration: SchemaConfiguration) | +| [Schema01Boxed](#schema01boxed) | validateAndBox(Any?, configuration: SchemaConfiguration) | +| Any? | validate(arg: Any?, configuration: SchemaConfiguration) | + +## Schema02Boxed +sealed interface Schema02Boxed
+permits
+[Schema02BoxedVoid](#schema02boxedvoid), +[Schema02BoxedBoolean](#schema02boxedboolean), +[Schema02BoxedNumber](#schema02boxednumber), +[Schema02BoxedString](#schema02boxedstring), +[Schema02BoxedList](#schema02boxedlist), +[Schema02BoxedMap](#schema02boxedmap) + +sealed interface that stores validated payloads using boxed classes + +## Schema02BoxedVoid +data class Schema02BoxedVoid
+implements [Schema02Boxed](#schema02boxed) + +data class that stores validated null payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| Schema02BoxedVoid(Nothing? data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| Nothing? | data()
validated payload | +| Any? | getData()
validated payload | + +## Schema02BoxedBoolean +data class Schema02BoxedBoolean
+implements [Schema02Boxed](#schema02boxed) + +record that stores validated boolean payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| Schema02BoxedBoolean(boolean data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| boolean | data()
validated payload | +| Any? | getData()
validated payload | + +## Schema02BoxedNumber +data class Schema02BoxedNumber
+implements [Schema02Boxed](#schema02boxed) + +data class that stores validated Number payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| Schema02BoxedNumber(Number data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| Number | data()
validated payload | +| Any? | getData()
validated payload | + +## Schema02BoxedString +data class Schema02BoxedString
+implements [Schema02Boxed](#schema02boxed) + +data class that stores validated String payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| Schema02BoxedString(String data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| String | data()
validated payload | +| Any? | getData()
validated payload | + +## Schema02BoxedList +data class Schema02BoxedList
+implements [Schema02Boxed](#schema02boxed) + +data class that stores validated List payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| Schema02BoxedList(FrozenList data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| FrozenList | data()
validated payload | +| Any? | getData()
validated payload | + +## Schema02BoxedMap +data class Schema02BoxedMap
+implements [Schema02Boxed](#schema02boxed) + +data class that stores validated Map payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| Schema02BoxedMap(FrozenMap data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| FrozenMap | data()
validated payload | +| Any? | getData()
validated payload | + +## Schema02 +class Schema02
+extends JsonSchema + +A schema class that validates payloads + +### Field Summary +| Modifier and Type | Field and Description | +| ----------------- | ---------------------- | +| BigDecimal | multipleOf = BigDecimal("2") | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| String | validate(arg: String, configuration: SchemaConfiguration) | +| Nothing? | validate(arg: Nothing?, configuration: SchemaConfiguration) | +| int | validate(arg: int, configuration: SchemaConfiguration) | +| long | validate(arg: long, configuration: SchemaConfiguration) | +| float | validate(arg: float, configuration: SchemaConfiguration) | +| double | validate(arg: double, configuration: SchemaConfiguration) | +| Number | validate(arg: Number, configuration: SchemaConfiguration) | +| boolean | validate(arg: boolean, configuration: SchemaConfiguration) | +| FrozenMap | validate(arg: Map<?, ?>, configuration: SchemaConfiguration) | +| FrozenList | validate(arg: List<*>, configuration: SchemaConfiguration) | +| [Schema02BoxedString](#schema02boxedstring) | validateAndBox(String, configuration: SchemaConfiguration) | +| [Schema02BoxedVoid](#schema02boxedvoid) | validateAndBox(Nothing?, configuration: SchemaConfiguration) | +| [Schema02BoxedNumber](#schema02boxednumber) | validateAndBox(Number, configuration: SchemaConfiguration) | +| [Schema02BoxedBoolean](#schema02boxedboolean) | validateAndBox(boolean, configuration: SchemaConfiguration) | +| [Schema02BoxedMap](#schema02boxedmap) | validateAndBox(Map<?, ?>, configuration: SchemaConfiguration) | +| [Schema02BoxedList](#schema02boxedlist) | validateAndBox(List<*>, configuration: SchemaConfiguration) | +| [Schema02Boxed](#schema02boxed) | validateAndBox(Any?, configuration: SchemaConfiguration) | +| Any? | validate(arg: Any?, configuration: SchemaConfiguration) | + +[[Back to top]](#top) [[Back to Component Schemas]](../../../README.md#Component-Schemas) [[Back to README]](../../../README.md) diff --git a/samples/client/3_0_3_unit_test/kotlin/docs/components/schemas/AllofSimpleTypes.md b/samples/client/3_0_3_unit_test/kotlin/docs/components/schemas/AllofSimpleTypes.md new file mode 100644 index 00000000000..3797e536800 --- /dev/null +++ b/samples/client/3_0_3_unit_test/kotlin/docs/components/schemas/AllofSimpleTypes.md @@ -0,0 +1,479 @@ +# AllofSimpleTypes +org.openapijsonschematools.client.components.schemas.AllofSimpleTypes.java +class AllofSimpleTypes
+ +A class that contains necessary nested +- schema classes (which validate payloads), extends JsonSchema +- sealed interfaces which store validated payloads, Kotlin version of a sum type +- boxed classes which store validated payloads, sealed permits class implementations + +## Nested Class Summary +| Modifier and Type | Class and Description | +| ----------------- | ---------------------- | +| sealed interface | [AllofSimpleTypes.AllofSimpleTypes1Boxed](#allofsimpletypes1boxed)
sealed interface for validated payloads | +| record | [AllofSimpleTypes.AllofSimpleTypes1BoxedVoid](#allofsimpletypes1boxedvoid)
boxed class to store validated null payloads | +| record | [AllofSimpleTypes.AllofSimpleTypes1BoxedBoolean](#allofsimpletypes1boxedboolean)
boxed class to store validated boolean payloads | +| record | [AllofSimpleTypes.AllofSimpleTypes1BoxedNumber](#allofsimpletypes1boxednumber)
boxed class to store validated Number payloads | +| record | [AllofSimpleTypes.AllofSimpleTypes1BoxedString](#allofsimpletypes1boxedstring)
boxed class to store validated String payloads | +| record | [AllofSimpleTypes.AllofSimpleTypes1BoxedList](#allofsimpletypes1boxedlist)
boxed class to store validated List payloads | +| record | [AllofSimpleTypes.AllofSimpleTypes1BoxedMap](#allofsimpletypes1boxedmap)
boxed class to store validated Map payloads | +| static class | [AllofSimpleTypes.AllofSimpleTypes1](#allofsimpletypes1)
schema class | +| sealed interface | [AllofSimpleTypes.Schema1Boxed](#schema1boxed)
sealed interface for validated payloads | +| record | [AllofSimpleTypes.Schema1BoxedVoid](#schema1boxedvoid)
boxed class to store validated null payloads | +| record | [AllofSimpleTypes.Schema1BoxedBoolean](#schema1boxedboolean)
boxed class to store validated boolean payloads | +| record | [AllofSimpleTypes.Schema1BoxedNumber](#schema1boxednumber)
boxed class to store validated Number payloads | +| record | [AllofSimpleTypes.Schema1BoxedString](#schema1boxedstring)
boxed class to store validated String payloads | +| record | [AllofSimpleTypes.Schema1BoxedList](#schema1boxedlist)
boxed class to store validated List payloads | +| record | [AllofSimpleTypes.Schema1BoxedMap](#schema1boxedmap)
boxed class to store validated Map payloads | +| static class | [AllofSimpleTypes.Schema1](#schema1)
schema class | +| sealed interface | [AllofSimpleTypes.Schema0Boxed](#schema0boxed)
sealed interface for validated payloads | +| record | [AllofSimpleTypes.Schema0BoxedVoid](#schema0boxedvoid)
boxed class to store validated null payloads | +| record | [AllofSimpleTypes.Schema0BoxedBoolean](#schema0boxedboolean)
boxed class to store validated boolean payloads | +| record | [AllofSimpleTypes.Schema0BoxedNumber](#schema0boxednumber)
boxed class to store validated Number payloads | +| record | [AllofSimpleTypes.Schema0BoxedString](#schema0boxedstring)
boxed class to store validated String payloads | +| record | [AllofSimpleTypes.Schema0BoxedList](#schema0boxedlist)
boxed class to store validated List payloads | +| record | [AllofSimpleTypes.Schema0BoxedMap](#schema0boxedmap)
boxed class to store validated Map payloads | +| static class | [AllofSimpleTypes.Schema0](#schema0)
schema class | + +## AllofSimpleTypes1Boxed +sealed interface AllofSimpleTypes1Boxed
+permits
+[AllofSimpleTypes1BoxedVoid](#allofsimpletypes1boxedvoid), +[AllofSimpleTypes1BoxedBoolean](#allofsimpletypes1boxedboolean), +[AllofSimpleTypes1BoxedNumber](#allofsimpletypes1boxednumber), +[AllofSimpleTypes1BoxedString](#allofsimpletypes1boxedstring), +[AllofSimpleTypes1BoxedList](#allofsimpletypes1boxedlist), +[AllofSimpleTypes1BoxedMap](#allofsimpletypes1boxedmap) + +sealed interface that stores validated payloads using boxed classes + +## AllofSimpleTypes1BoxedVoid +data class AllofSimpleTypes1BoxedVoid
+implements [AllofSimpleTypes1Boxed](#allofsimpletypes1boxed) + +data class that stores validated null payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| AllofSimpleTypes1BoxedVoid(Nothing? data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| Nothing? | data()
validated payload | +| Any? | getData()
validated payload | + +## AllofSimpleTypes1BoxedBoolean +data class AllofSimpleTypes1BoxedBoolean
+implements [AllofSimpleTypes1Boxed](#allofsimpletypes1boxed) + +record that stores validated boolean payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| AllofSimpleTypes1BoxedBoolean(boolean data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| boolean | data()
validated payload | +| Any? | getData()
validated payload | + +## AllofSimpleTypes1BoxedNumber +data class AllofSimpleTypes1BoxedNumber
+implements [AllofSimpleTypes1Boxed](#allofsimpletypes1boxed) + +data class that stores validated Number payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| AllofSimpleTypes1BoxedNumber(Number data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| Number | data()
validated payload | +| Any? | getData()
validated payload | + +## AllofSimpleTypes1BoxedString +data class AllofSimpleTypes1BoxedString
+implements [AllofSimpleTypes1Boxed](#allofsimpletypes1boxed) + +data class that stores validated String payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| AllofSimpleTypes1BoxedString(String data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| String | data()
validated payload | +| Any? | getData()
validated payload | + +## AllofSimpleTypes1BoxedList +data class AllofSimpleTypes1BoxedList
+implements [AllofSimpleTypes1Boxed](#allofsimpletypes1boxed) + +data class that stores validated List payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| AllofSimpleTypes1BoxedList(FrozenList data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| FrozenList | data()
validated payload | +| Any? | getData()
validated payload | + +## AllofSimpleTypes1BoxedMap +data class AllofSimpleTypes1BoxedMap
+implements [AllofSimpleTypes1Boxed](#allofsimpletypes1boxed) + +data class that stores validated Map payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| AllofSimpleTypes1BoxedMap(FrozenMap data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| FrozenMap | data()
validated payload | +| Any? | getData()
validated payload | + +## AllofSimpleTypes1 +class AllofSimpleTypes1
+extends JsonSchema + +A schema class that validates payloads + +### Field Summary +| Modifier and Type | Field and Description | +| ----------------- | ---------------------- | +| List> | allOf = listOf(
    [Schema0::class.java](#schema0),
    [Schema1::class.java](#schema1)
;)
| + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| String | validate(arg: String, configuration: SchemaConfiguration) | +| Nothing? | validate(arg: Nothing?, configuration: SchemaConfiguration) | +| int | validate(arg: int, configuration: SchemaConfiguration) | +| long | validate(arg: long, configuration: SchemaConfiguration) | +| float | validate(arg: float, configuration: SchemaConfiguration) | +| double | validate(arg: double, configuration: SchemaConfiguration) | +| Number | validate(arg: Number, configuration: SchemaConfiguration) | +| boolean | validate(arg: boolean, configuration: SchemaConfiguration) | +| FrozenMap | validate(arg: Map<?, ?>, configuration: SchemaConfiguration) | +| FrozenList | validate(arg: List<*>, configuration: SchemaConfiguration) | +| [AllofSimpleTypes1BoxedString](#allofsimpletypes1boxedstring) | validateAndBox(String, configuration: SchemaConfiguration) | +| [AllofSimpleTypes1BoxedVoid](#allofsimpletypes1boxedvoid) | validateAndBox(Nothing?, configuration: SchemaConfiguration) | +| [AllofSimpleTypes1BoxedNumber](#allofsimpletypes1boxednumber) | validateAndBox(Number, configuration: SchemaConfiguration) | +| [AllofSimpleTypes1BoxedBoolean](#allofsimpletypes1boxedboolean) | validateAndBox(boolean, configuration: SchemaConfiguration) | +| [AllofSimpleTypes1BoxedMap](#allofsimpletypes1boxedmap) | validateAndBox(Map<?, ?>, configuration: SchemaConfiguration) | +| [AllofSimpleTypes1BoxedList](#allofsimpletypes1boxedlist) | validateAndBox(List<*>, configuration: SchemaConfiguration) | +| [AllofSimpleTypes1Boxed](#allofsimpletypes1boxed) | validateAndBox(Any?, configuration: SchemaConfiguration) | +| Any? | validate(arg: Any?, configuration: SchemaConfiguration) | + +## Schema1Boxed +sealed interface Schema1Boxed
+permits
+[Schema1BoxedVoid](#schema1boxedvoid), +[Schema1BoxedBoolean](#schema1boxedboolean), +[Schema1BoxedNumber](#schema1boxednumber), +[Schema1BoxedString](#schema1boxedstring), +[Schema1BoxedList](#schema1boxedlist), +[Schema1BoxedMap](#schema1boxedmap) + +sealed interface that stores validated payloads using boxed classes + +## Schema1BoxedVoid +data class Schema1BoxedVoid
+implements [Schema1Boxed](#schema1boxed) + +data class that stores validated null payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| Schema1BoxedVoid(Nothing? data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| Nothing? | data()
validated payload | +| Any? | getData()
validated payload | + +## Schema1BoxedBoolean +data class Schema1BoxedBoolean
+implements [Schema1Boxed](#schema1boxed) + +record that stores validated boolean payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| Schema1BoxedBoolean(boolean data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| boolean | data()
validated payload | +| Any? | getData()
validated payload | + +## Schema1BoxedNumber +data class Schema1BoxedNumber
+implements [Schema1Boxed](#schema1boxed) + +data class that stores validated Number payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| Schema1BoxedNumber(Number data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| Number | data()
validated payload | +| Any? | getData()
validated payload | + +## Schema1BoxedString +data class Schema1BoxedString
+implements [Schema1Boxed](#schema1boxed) + +data class that stores validated String payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| Schema1BoxedString(String data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| String | data()
validated payload | +| Any? | getData()
validated payload | + +## Schema1BoxedList +data class Schema1BoxedList
+implements [Schema1Boxed](#schema1boxed) + +data class that stores validated List payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| Schema1BoxedList(FrozenList data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| FrozenList | data()
validated payload | +| Any? | getData()
validated payload | + +## Schema1BoxedMap +data class Schema1BoxedMap
+implements [Schema1Boxed](#schema1boxed) + +data class that stores validated Map payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| Schema1BoxedMap(FrozenMap data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| FrozenMap | data()
validated payload | +| Any? | getData()
validated payload | + +## Schema1 +class Schema1
+extends JsonSchema + +A schema class that validates payloads + +### Field Summary +| Modifier and Type | Field and Description | +| ----------------- | ---------------------- | +| Number | minimum = 20 | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| String | validate(arg: String, configuration: SchemaConfiguration) | +| Nothing? | validate(arg: Nothing?, configuration: SchemaConfiguration) | +| int | validate(arg: int, configuration: SchemaConfiguration) | +| long | validate(arg: long, configuration: SchemaConfiguration) | +| float | validate(arg: float, configuration: SchemaConfiguration) | +| double | validate(arg: double, configuration: SchemaConfiguration) | +| Number | validate(arg: Number, configuration: SchemaConfiguration) | +| boolean | validate(arg: boolean, configuration: SchemaConfiguration) | +| FrozenMap | validate(arg: Map<?, ?>, configuration: SchemaConfiguration) | +| FrozenList | validate(arg: List<*>, configuration: SchemaConfiguration) | +| [Schema1BoxedString](#schema1boxedstring) | validateAndBox(String, configuration: SchemaConfiguration) | +| [Schema1BoxedVoid](#schema1boxedvoid) | validateAndBox(Nothing?, configuration: SchemaConfiguration) | +| [Schema1BoxedNumber](#schema1boxednumber) | validateAndBox(Number, configuration: SchemaConfiguration) | +| [Schema1BoxedBoolean](#schema1boxedboolean) | validateAndBox(boolean, configuration: SchemaConfiguration) | +| [Schema1BoxedMap](#schema1boxedmap) | validateAndBox(Map<?, ?>, configuration: SchemaConfiguration) | +| [Schema1BoxedList](#schema1boxedlist) | validateAndBox(List<*>, configuration: SchemaConfiguration) | +| [Schema1Boxed](#schema1boxed) | validateAndBox(Any?, configuration: SchemaConfiguration) | +| Any? | validate(arg: Any?, configuration: SchemaConfiguration) | + +## Schema0Boxed +sealed interface Schema0Boxed
+permits
+[Schema0BoxedVoid](#schema0boxedvoid), +[Schema0BoxedBoolean](#schema0boxedboolean), +[Schema0BoxedNumber](#schema0boxednumber), +[Schema0BoxedString](#schema0boxedstring), +[Schema0BoxedList](#schema0boxedlist), +[Schema0BoxedMap](#schema0boxedmap) + +sealed interface that stores validated payloads using boxed classes + +## Schema0BoxedVoid +data class Schema0BoxedVoid
+implements [Schema0Boxed](#schema0boxed) + +data class that stores validated null payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| Schema0BoxedVoid(Nothing? data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| Nothing? | data()
validated payload | +| Any? | getData()
validated payload | + +## Schema0BoxedBoolean +data class Schema0BoxedBoolean
+implements [Schema0Boxed](#schema0boxed) + +record that stores validated boolean payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| Schema0BoxedBoolean(boolean data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| boolean | data()
validated payload | +| Any? | getData()
validated payload | + +## Schema0BoxedNumber +data class Schema0BoxedNumber
+implements [Schema0Boxed](#schema0boxed) + +data class that stores validated Number payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| Schema0BoxedNumber(Number data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| Number | data()
validated payload | +| Any? | getData()
validated payload | + +## Schema0BoxedString +data class Schema0BoxedString
+implements [Schema0Boxed](#schema0boxed) + +data class that stores validated String payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| Schema0BoxedString(String data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| String | data()
validated payload | +| Any? | getData()
validated payload | + +## Schema0BoxedList +data class Schema0BoxedList
+implements [Schema0Boxed](#schema0boxed) + +data class that stores validated List payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| Schema0BoxedList(FrozenList data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| FrozenList | data()
validated payload | +| Any? | getData()
validated payload | + +## Schema0BoxedMap +data class Schema0BoxedMap
+implements [Schema0Boxed](#schema0boxed) + +data class that stores validated Map payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| Schema0BoxedMap(FrozenMap data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| FrozenMap | data()
validated payload | +| Any? | getData()
validated payload | + +## Schema0 +class Schema0
+extends JsonSchema + +A schema class that validates payloads + +### Field Summary +| Modifier and Type | Field and Description | +| ----------------- | ---------------------- | +| Number | maximum = 30 | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| String | validate(arg: String, configuration: SchemaConfiguration) | +| Nothing? | validate(arg: Nothing?, configuration: SchemaConfiguration) | +| int | validate(arg: int, configuration: SchemaConfiguration) | +| long | validate(arg: long, configuration: SchemaConfiguration) | +| float | validate(arg: float, configuration: SchemaConfiguration) | +| double | validate(arg: double, configuration: SchemaConfiguration) | +| Number | validate(arg: Number, configuration: SchemaConfiguration) | +| boolean | validate(arg: boolean, configuration: SchemaConfiguration) | +| FrozenMap | validate(arg: Map<?, ?>, configuration: SchemaConfiguration) | +| FrozenList | validate(arg: List<*>, configuration: SchemaConfiguration) | +| [Schema0BoxedString](#schema0boxedstring) | validateAndBox(String, configuration: SchemaConfiguration) | +| [Schema0BoxedVoid](#schema0boxedvoid) | validateAndBox(Nothing?, configuration: SchemaConfiguration) | +| [Schema0BoxedNumber](#schema0boxednumber) | validateAndBox(Number, configuration: SchemaConfiguration) | +| [Schema0BoxedBoolean](#schema0boxedboolean) | validateAndBox(boolean, configuration: SchemaConfiguration) | +| [Schema0BoxedMap](#schema0boxedmap) | validateAndBox(Map<?, ?>, configuration: SchemaConfiguration) | +| [Schema0BoxedList](#schema0boxedlist) | validateAndBox(List<*>, configuration: SchemaConfiguration) | +| [Schema0Boxed](#schema0boxed) | validateAndBox(Any?, configuration: SchemaConfiguration) | +| Any? | validate(arg: Any?, configuration: SchemaConfiguration) | + +[[Back to top]](#top) [[Back to Component Schemas]](../../../README.md#Component-Schemas) [[Back to README]](../../../README.md) diff --git a/samples/client/3_0_3_unit_test/kotlin/docs/components/schemas/AllofWithBaseSchema.md b/samples/client/3_0_3_unit_test/kotlin/docs/components/schemas/AllofWithBaseSchema.md new file mode 100644 index 00000000000..2f94b4b3b6a --- /dev/null +++ b/samples/client/3_0_3_unit_test/kotlin/docs/components/schemas/AllofWithBaseSchema.md @@ -0,0 +1,770 @@ +# AllofWithBaseSchema +org.openapijsonschematools.client.components.schemas.AllofWithBaseSchema.java +class AllofWithBaseSchema
+ +A class that contains necessary nested +- schema classes (which validate payloads), extends JsonSchema +- sealed interfaces which store validated payloads, Kotlin version of a sum type +- boxed classes which store validated payloads, sealed permits class implementations +- classes to store validated map payloads, extends FrozenMap +- classes to build inputs for map payloads + +## Nested Class Summary +| Modifier and Type | Class and Description | +| ----------------- | ---------------------- | +| sealed interface | [AllofWithBaseSchema.AllofWithBaseSchema1Boxed](#allofwithbaseschema1boxed)
sealed interface for validated payloads | +| record | [AllofWithBaseSchema.AllofWithBaseSchema1BoxedVoid](#allofwithbaseschema1boxedvoid)
boxed class to store validated null payloads | +| record | [AllofWithBaseSchema.AllofWithBaseSchema1BoxedBoolean](#allofwithbaseschema1boxedboolean)
boxed class to store validated boolean payloads | +| record | [AllofWithBaseSchema.AllofWithBaseSchema1BoxedNumber](#allofwithbaseschema1boxednumber)
boxed class to store validated Number payloads | +| record | [AllofWithBaseSchema.AllofWithBaseSchema1BoxedString](#allofwithbaseschema1boxedstring)
boxed class to store validated String payloads | +| record | [AllofWithBaseSchema.AllofWithBaseSchema1BoxedList](#allofwithbaseschema1boxedlist)
boxed class to store validated List payloads | +| record | [AllofWithBaseSchema.AllofWithBaseSchema1BoxedMap](#allofwithbaseschema1boxedmap)
boxed class to store validated Map payloads | +| static class | [AllofWithBaseSchema.AllofWithBaseSchema1](#allofwithbaseschema1)
schema class | +| static class | [AllofWithBaseSchema.AllofWithBaseSchemaMapBuilder](#allofwithbaseschemamapbuilder)
builder for Map payloads | +| static class | [AllofWithBaseSchema.AllofWithBaseSchemaMap](#allofwithbaseschemamap)
output class for Map payloads | +| sealed interface | [AllofWithBaseSchema.BarBoxed](#barboxed)
sealed interface for validated payloads | +| record | [AllofWithBaseSchema.BarBoxedNumber](#barboxednumber)
boxed class to store validated Number payloads | +| static class | [AllofWithBaseSchema.Bar](#bar)
schema class | +| sealed interface | [AllofWithBaseSchema.Schema1Boxed](#schema1boxed)
sealed interface for validated payloads | +| record | [AllofWithBaseSchema.Schema1BoxedVoid](#schema1boxedvoid)
boxed class to store validated null payloads | +| record | [AllofWithBaseSchema.Schema1BoxedBoolean](#schema1boxedboolean)
boxed class to store validated boolean payloads | +| record | [AllofWithBaseSchema.Schema1BoxedNumber](#schema1boxednumber)
boxed class to store validated Number payloads | +| record | [AllofWithBaseSchema.Schema1BoxedString](#schema1boxedstring)
boxed class to store validated String payloads | +| record | [AllofWithBaseSchema.Schema1BoxedList](#schema1boxedlist)
boxed class to store validated List payloads | +| record | [AllofWithBaseSchema.Schema1BoxedMap](#schema1boxedmap)
boxed class to store validated Map payloads | +| static class | [AllofWithBaseSchema.Schema1](#schema1)
schema class | +| static class | [AllofWithBaseSchema.Schema1MapBuilder](#schema1mapbuilder)
builder for Map payloads | +| static class | [AllofWithBaseSchema.Schema1Map](#schema1map)
output class for Map payloads | +| sealed interface | [AllofWithBaseSchema.BazBoxed](#bazboxed)
sealed interface for validated payloads | +| record | [AllofWithBaseSchema.BazBoxedVoid](#bazboxedvoid)
boxed class to store validated null payloads | +| static class | [AllofWithBaseSchema.Baz](#baz)
schema class | +| sealed interface | [AllofWithBaseSchema.Schema0Boxed](#schema0boxed)
sealed interface for validated payloads | +| record | [AllofWithBaseSchema.Schema0BoxedVoid](#schema0boxedvoid)
boxed class to store validated null payloads | +| record | [AllofWithBaseSchema.Schema0BoxedBoolean](#schema0boxedboolean)
boxed class to store validated boolean payloads | +| record | [AllofWithBaseSchema.Schema0BoxedNumber](#schema0boxednumber)
boxed class to store validated Number payloads | +| record | [AllofWithBaseSchema.Schema0BoxedString](#schema0boxedstring)
boxed class to store validated String payloads | +| record | [AllofWithBaseSchema.Schema0BoxedList](#schema0boxedlist)
boxed class to store validated List payloads | +| record | [AllofWithBaseSchema.Schema0BoxedMap](#schema0boxedmap)
boxed class to store validated Map payloads | +| static class | [AllofWithBaseSchema.Schema0](#schema0)
schema class | +| static class | [AllofWithBaseSchema.Schema0MapBuilder](#schema0mapbuilder)
builder for Map payloads | +| static class | [AllofWithBaseSchema.Schema0Map](#schema0map)
output class for Map payloads | +| sealed interface | [AllofWithBaseSchema.FooBoxed](#fooboxed)
sealed interface for validated payloads | +| record | [AllofWithBaseSchema.FooBoxedString](#fooboxedstring)
boxed class to store validated String payloads | +| static class | [AllofWithBaseSchema.Foo](#foo)
schema class | + +## AllofWithBaseSchema1Boxed +sealed interface AllofWithBaseSchema1Boxed
+permits
+[AllofWithBaseSchema1BoxedVoid](#allofwithbaseschema1boxedvoid), +[AllofWithBaseSchema1BoxedBoolean](#allofwithbaseschema1boxedboolean), +[AllofWithBaseSchema1BoxedNumber](#allofwithbaseschema1boxednumber), +[AllofWithBaseSchema1BoxedString](#allofwithbaseschema1boxedstring), +[AllofWithBaseSchema1BoxedList](#allofwithbaseschema1boxedlist), +[AllofWithBaseSchema1BoxedMap](#allofwithbaseschema1boxedmap) + +sealed interface that stores validated payloads using boxed classes + +## AllofWithBaseSchema1BoxedVoid +data class AllofWithBaseSchema1BoxedVoid
+implements [AllofWithBaseSchema1Boxed](#allofwithbaseschema1boxed) + +data class that stores validated null payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| AllofWithBaseSchema1BoxedVoid(Nothing? data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| Nothing? | data()
validated payload | +| Any? | getData()
validated payload | + +## AllofWithBaseSchema1BoxedBoolean +data class AllofWithBaseSchema1BoxedBoolean
+implements [AllofWithBaseSchema1Boxed](#allofwithbaseschema1boxed) + +record that stores validated boolean payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| AllofWithBaseSchema1BoxedBoolean(boolean data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| boolean | data()
validated payload | +| Any? | getData()
validated payload | + +## AllofWithBaseSchema1BoxedNumber +data class AllofWithBaseSchema1BoxedNumber
+implements [AllofWithBaseSchema1Boxed](#allofwithbaseschema1boxed) + +data class that stores validated Number payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| AllofWithBaseSchema1BoxedNumber(Number data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| Number | data()
validated payload | +| Any? | getData()
validated payload | + +## AllofWithBaseSchema1BoxedString +data class AllofWithBaseSchema1BoxedString
+implements [AllofWithBaseSchema1Boxed](#allofwithbaseschema1boxed) + +data class that stores validated String payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| AllofWithBaseSchema1BoxedString(String data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| String | data()
validated payload | +| Any? | getData()
validated payload | + +## AllofWithBaseSchema1BoxedList +data class AllofWithBaseSchema1BoxedList
+implements [AllofWithBaseSchema1Boxed](#allofwithbaseschema1boxed) + +data class that stores validated List payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| AllofWithBaseSchema1BoxedList(FrozenList data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| FrozenList | data()
validated payload | +| Any? | getData()
validated payload | + +## AllofWithBaseSchema1BoxedMap +data class AllofWithBaseSchema1BoxedMap
+implements [AllofWithBaseSchema1Boxed](#allofwithbaseschema1boxed) + +data class that stores validated Map payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| AllofWithBaseSchema1BoxedMap([AllofWithBaseSchemaMap](#allofwithbaseschemamap) data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| [AllofWithBaseSchemaMap](#allofwithbaseschemamap) | data()
validated payload | +| Any? | getData()
validated payload | + +## AllofWithBaseSchema1 +class AllofWithBaseSchema1
+extends JsonSchema + +A schema class that validates payloads + +### Field Summary +| Modifier and Type | Field and Description | +| ----------------- | ---------------------- | +| Map> | properties = mapOf(
    "bar" to [Bar::class.java](#bar))
)
| +| Set | required = setOf(
    "bar"
)
| +| List> | allOf = listOf(
    [Schema0::class.java](#schema0),
    [Schema1::class.java](#schema1)
;)
| + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| String | validate(arg: String, configuration: SchemaConfiguration) | +| Nothing? | validate(arg: Nothing?, configuration: SchemaConfiguration) | +| int | validate(arg: int, configuration: SchemaConfiguration) | +| long | validate(arg: long, configuration: SchemaConfiguration) | +| float | validate(arg: float, configuration: SchemaConfiguration) | +| double | validate(arg: double, configuration: SchemaConfiguration) | +| Number | validate(arg: Number, configuration: SchemaConfiguration) | +| boolean | validate(arg: boolean, configuration: SchemaConfiguration) | +| [AllofWithBaseSchemaMap](#allofwithbaseschemamap) | validate(arg: [Map<?, ?>](#allofwithbaseschemamapbuilder), configuration: SchemaConfiguration) | +| FrozenList | validate(arg: List<*>, configuration: SchemaConfiguration) | +| [AllofWithBaseSchema1BoxedString](#allofwithbaseschema1boxedstring) | validateAndBox(String, configuration: SchemaConfiguration) | +| [AllofWithBaseSchema1BoxedVoid](#allofwithbaseschema1boxedvoid) | validateAndBox(Nothing?, configuration: SchemaConfiguration) | +| [AllofWithBaseSchema1BoxedNumber](#allofwithbaseschema1boxednumber) | validateAndBox(Number, configuration: SchemaConfiguration) | +| [AllofWithBaseSchema1BoxedBoolean](#allofwithbaseschema1boxedboolean) | validateAndBox(boolean, configuration: SchemaConfiguration) | +| [AllofWithBaseSchema1BoxedMap](#allofwithbaseschema1boxedmap) | validateAndBox([Map<?, ?>](#allofwithbaseschemamapbuilder), configuration: SchemaConfiguration) | +| [AllofWithBaseSchema1BoxedList](#allofwithbaseschema1boxedlist) | validateAndBox(List<*>, configuration: SchemaConfiguration) | +| [AllofWithBaseSchema1Boxed](#allofwithbaseschema1boxed) | validateAndBox(Any?, configuration: SchemaConfiguration) | +| Any? | validate(arg: Any?, configuration: SchemaConfiguration) | + +## AllofWithBaseSchemaMap0Builder +class AllofWithBaseSchemaMap0Builder
+builder for `Map` + +A class that builds the Map input type + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| AllofWithBaseSchemaMap0Builder(Map instance)
Creates a builder that contains the passed instance | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| Map | build()
Returns map input that should be used with Schema.validate | +| [AllofWithBaseSchemaMap0Builder](#allofwithbaseschemamap0builder) | additionalProperty(key: String, value: Nothing?) | +| [AllofWithBaseSchemaMap0Builder](#allofwithbaseschemamap0builder) | additionalProperty(key: String, value: Boolean) | +| [AllofWithBaseSchemaMap0Builder](#allofwithbaseschemamap0builder) | additionalProperty(key: String, value: String) | +| [AllofWithBaseSchemaMap0Builder](#allofwithbaseschemamap0builder) | additionalProperty(key: String, value: Int) | +| [AllofWithBaseSchemaMap0Builder](#allofwithbaseschemamap0builder) | additionalProperty(key: String, value: Float) | +| [AllofWithBaseSchemaMap0Builder](#allofwithbaseschemamap0builder) | additionalProperty(key: String, value: Long) | +| [AllofWithBaseSchemaMap0Builder](#allofwithbaseschemamap0builder) | additionalProperty(key: String, value: Double) | +| [AllofWithBaseSchemaMap0Builder](#allofwithbaseschemamap0builder) | additionalProperty(key: String, value: List) | +| [AllofWithBaseSchemaMap0Builder](#allofwithbaseschemamap0builder) | additionalProperty(key: String, value: Map) | + +## AllofWithBaseSchemaMapBuilder +class AllofWithBaseSchemaMapBuilder
+builder for `Map` + +A class that builds the Map input type + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| AllofWithBaseSchemaMapBuilder()
Creates a builder that contains an empty map | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| [AllofWithBaseSchemaMap0Builder](#allofwithbaseschemamap0builder) | bar(value: Int) | +| [AllofWithBaseSchemaMap0Builder](#allofwithbaseschemamap0builder) | bar(value: Float) | +| [AllofWithBaseSchemaMap0Builder](#allofwithbaseschemamap0builder) | bar(value: Long) | +| [AllofWithBaseSchemaMap0Builder](#allofwithbaseschemamap0builder) | bar(value: Double) | + +## AllofWithBaseSchemaMap +class AllofWithBaseSchemaMap
+extends FrozenMap + +A class to store validated Map payloads + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| static [AllofWithBaseSchemaMap](#allofwithbaseschemamap) | of([Map](#allofwithbaseschemamapbuilder) arg, SchemaConfiguration configuration) | +| Number | bar()
| +| Any? | getAdditionalProperty(String name)
provides type safety for additional properties | + +## BarBoxed +sealed interface BarBoxed
+permits
+[BarBoxedNumber](#barboxednumber) + +sealed interface that stores validated payloads using boxed classes + +## BarBoxedNumber +data class BarBoxedNumber
+implements [BarBoxed](#barboxed) + +data class that stores validated Number payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| BarBoxedNumber(Number data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| Number | data()
validated payload | +| Any? | getData()
validated payload | + +## Bar +class Bar
+extends IntJsonSchema.IntJsonSchema1 + +A schema class that validates payloads + +| Methods Inherited from class org.openapijsonschematools.client.schemas.IntJsonSchema.IntJsonSchema1 | +| ------------------------------------------------------------------ | +| validate | +| validateAndBox | + +## Schema1Boxed +sealed interface Schema1Boxed
+permits
+[Schema1BoxedVoid](#schema1boxedvoid), +[Schema1BoxedBoolean](#schema1boxedboolean), +[Schema1BoxedNumber](#schema1boxednumber), +[Schema1BoxedString](#schema1boxedstring), +[Schema1BoxedList](#schema1boxedlist), +[Schema1BoxedMap](#schema1boxedmap) + +sealed interface that stores validated payloads using boxed classes + +## Schema1BoxedVoid +data class Schema1BoxedVoid
+implements [Schema1Boxed](#schema1boxed) + +data class that stores validated null payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| Schema1BoxedVoid(Nothing? data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| Nothing? | data()
validated payload | +| Any? | getData()
validated payload | + +## Schema1BoxedBoolean +data class Schema1BoxedBoolean
+implements [Schema1Boxed](#schema1boxed) + +record that stores validated boolean payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| Schema1BoxedBoolean(boolean data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| boolean | data()
validated payload | +| Any? | getData()
validated payload | + +## Schema1BoxedNumber +data class Schema1BoxedNumber
+implements [Schema1Boxed](#schema1boxed) + +data class that stores validated Number payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| Schema1BoxedNumber(Number data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| Number | data()
validated payload | +| Any? | getData()
validated payload | + +## Schema1BoxedString +data class Schema1BoxedString
+implements [Schema1Boxed](#schema1boxed) + +data class that stores validated String payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| Schema1BoxedString(String data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| String | data()
validated payload | +| Any? | getData()
validated payload | + +## Schema1BoxedList +data class Schema1BoxedList
+implements [Schema1Boxed](#schema1boxed) + +data class that stores validated List payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| Schema1BoxedList(FrozenList data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| FrozenList | data()
validated payload | +| Any? | getData()
validated payload | + +## Schema1BoxedMap +data class Schema1BoxedMap
+implements [Schema1Boxed](#schema1boxed) + +data class that stores validated Map payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| Schema1BoxedMap([Schema1Map](#schema1map) data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| [Schema1Map](#schema1map) | data()
validated payload | +| Any? | getData()
validated payload | + +## Schema1 +class Schema1
+extends JsonSchema + +A schema class that validates payloads + +### Field Summary +| Modifier and Type | Field and Description | +| ----------------- | ---------------------- | +| Map> | properties = mapOf(
    "baz" to [Baz::class.java](#baz))
)
| +| Set | required = setOf(
    "baz"
)
| + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| String | validate(arg: String, configuration: SchemaConfiguration) | +| Nothing? | validate(arg: Nothing?, configuration: SchemaConfiguration) | +| int | validate(arg: int, configuration: SchemaConfiguration) | +| long | validate(arg: long, configuration: SchemaConfiguration) | +| float | validate(arg: float, configuration: SchemaConfiguration) | +| double | validate(arg: double, configuration: SchemaConfiguration) | +| Number | validate(arg: Number, configuration: SchemaConfiguration) | +| boolean | validate(arg: boolean, configuration: SchemaConfiguration) | +| [Schema1Map](#schema1map) | validate(arg: [Map<?, ?>](#schema1mapbuilder), configuration: SchemaConfiguration) | +| FrozenList | validate(arg: List<*>, configuration: SchemaConfiguration) | +| [Schema1BoxedString](#schema1boxedstring) | validateAndBox(String, configuration: SchemaConfiguration) | +| [Schema1BoxedVoid](#schema1boxedvoid) | validateAndBox(Nothing?, configuration: SchemaConfiguration) | +| [Schema1BoxedNumber](#schema1boxednumber) | validateAndBox(Number, configuration: SchemaConfiguration) | +| [Schema1BoxedBoolean](#schema1boxedboolean) | validateAndBox(boolean, configuration: SchemaConfiguration) | +| [Schema1BoxedMap](#schema1boxedmap) | validateAndBox([Map<?, ?>](#schema1mapbuilder), configuration: SchemaConfiguration) | +| [Schema1BoxedList](#schema1boxedlist) | validateAndBox(List<*>, configuration: SchemaConfiguration) | +| [Schema1Boxed](#schema1boxed) | validateAndBox(Any?, configuration: SchemaConfiguration) | +| Any? | validate(arg: Any?, configuration: SchemaConfiguration) | + +## Schema1Map0Builder +class Schema1Map0Builder
+builder for `Map` + +A class that builds the Map input type + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| Schema1Map0Builder(Map instance)
Creates a builder that contains the passed instance | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| Map | build()
Returns map input that should be used with Schema.validate | +| [Schema1Map0Builder](#schema1map0builder) | additionalProperty(key: String, value: Nothing?) | +| [Schema1Map0Builder](#schema1map0builder) | additionalProperty(key: String, value: Boolean) | +| [Schema1Map0Builder](#schema1map0builder) | additionalProperty(key: String, value: String) | +| [Schema1Map0Builder](#schema1map0builder) | additionalProperty(key: String, value: Int) | +| [Schema1Map0Builder](#schema1map0builder) | additionalProperty(key: String, value: Float) | +| [Schema1Map0Builder](#schema1map0builder) | additionalProperty(key: String, value: Long) | +| [Schema1Map0Builder](#schema1map0builder) | additionalProperty(key: String, value: Double) | +| [Schema1Map0Builder](#schema1map0builder) | additionalProperty(key: String, value: List) | +| [Schema1Map0Builder](#schema1map0builder) | additionalProperty(key: String, value: Map) | + +## Schema1MapBuilder +class Schema1MapBuilder
+builder for `Map` + +A class that builds the Map input type + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| Schema1MapBuilder()
Creates a builder that contains an empty map | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| [Schema1Map0Builder](#schema1map0builder) | baz(value: Nothing?) | + +## Schema1Map +class Schema1Map
+extends FrozenMap + +A class to store validated Map payloads + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| static [Schema1Map](#schema1map) | of([Map](#schema1mapbuilder) arg, SchemaConfiguration configuration) | +| Nothing? | baz()
| +| Any? | getAdditionalProperty(String name)
provides type safety for additional properties | + +## BazBoxed +sealed interface BazBoxed
+permits
+[BazBoxedVoid](#bazboxedvoid) + +sealed interface that stores validated payloads using boxed classes + +## BazBoxedVoid +data class BazBoxedVoid
+implements [BazBoxed](#bazboxed) + +data class that stores validated null payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| BazBoxedVoid(Nothing? data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| Nothing? | data()
validated payload | +| Any? | getData()
validated payload | + +## Baz +class Baz
+extends NullJsonSchema.NullJsonSchema1 + +A schema class that validates payloads + +| Methods Inherited from class org.openapijsonschematools.client.schemas.NullJsonSchema.NullJsonSchema1 | +| ------------------------------------------------------------------ | +| validate | +| validateAndBox | + +## Schema0Boxed +sealed interface Schema0Boxed
+permits
+[Schema0BoxedVoid](#schema0boxedvoid), +[Schema0BoxedBoolean](#schema0boxedboolean), +[Schema0BoxedNumber](#schema0boxednumber), +[Schema0BoxedString](#schema0boxedstring), +[Schema0BoxedList](#schema0boxedlist), +[Schema0BoxedMap](#schema0boxedmap) + +sealed interface that stores validated payloads using boxed classes + +## Schema0BoxedVoid +data class Schema0BoxedVoid
+implements [Schema0Boxed](#schema0boxed) + +data class that stores validated null payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| Schema0BoxedVoid(Nothing? data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| Nothing? | data()
validated payload | +| Any? | getData()
validated payload | + +## Schema0BoxedBoolean +data class Schema0BoxedBoolean
+implements [Schema0Boxed](#schema0boxed) + +record that stores validated boolean payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| Schema0BoxedBoolean(boolean data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| boolean | data()
validated payload | +| Any? | getData()
validated payload | + +## Schema0BoxedNumber +data class Schema0BoxedNumber
+implements [Schema0Boxed](#schema0boxed) + +data class that stores validated Number payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| Schema0BoxedNumber(Number data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| Number | data()
validated payload | +| Any? | getData()
validated payload | + +## Schema0BoxedString +data class Schema0BoxedString
+implements [Schema0Boxed](#schema0boxed) + +data class that stores validated String payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| Schema0BoxedString(String data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| String | data()
validated payload | +| Any? | getData()
validated payload | + +## Schema0BoxedList +data class Schema0BoxedList
+implements [Schema0Boxed](#schema0boxed) + +data class that stores validated List payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| Schema0BoxedList(FrozenList data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| FrozenList | data()
validated payload | +| Any? | getData()
validated payload | + +## Schema0BoxedMap +data class Schema0BoxedMap
+implements [Schema0Boxed](#schema0boxed) + +data class that stores validated Map payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| Schema0BoxedMap([Schema0Map](#schema0map) data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| [Schema0Map](#schema0map) | data()
validated payload | +| Any? | getData()
validated payload | + +## Schema0 +class Schema0
+extends JsonSchema + +A schema class that validates payloads + +### Field Summary +| Modifier and Type | Field and Description | +| ----------------- | ---------------------- | +| Map> | properties = mapOf(
    "foo" to [Foo::class.java](#foo))
)
| +| Set | required = setOf(
    "foo"
)
| + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| String | validate(arg: String, configuration: SchemaConfiguration) | +| Nothing? | validate(arg: Nothing?, configuration: SchemaConfiguration) | +| int | validate(arg: int, configuration: SchemaConfiguration) | +| long | validate(arg: long, configuration: SchemaConfiguration) | +| float | validate(arg: float, configuration: SchemaConfiguration) | +| double | validate(arg: double, configuration: SchemaConfiguration) | +| Number | validate(arg: Number, configuration: SchemaConfiguration) | +| boolean | validate(arg: boolean, configuration: SchemaConfiguration) | +| [Schema0Map](#schema0map) | validate(arg: [Map<?, ?>](#schema0mapbuilder), configuration: SchemaConfiguration) | +| FrozenList | validate(arg: List<*>, configuration: SchemaConfiguration) | +| [Schema0BoxedString](#schema0boxedstring) | validateAndBox(String, configuration: SchemaConfiguration) | +| [Schema0BoxedVoid](#schema0boxedvoid) | validateAndBox(Nothing?, configuration: SchemaConfiguration) | +| [Schema0BoxedNumber](#schema0boxednumber) | validateAndBox(Number, configuration: SchemaConfiguration) | +| [Schema0BoxedBoolean](#schema0boxedboolean) | validateAndBox(boolean, configuration: SchemaConfiguration) | +| [Schema0BoxedMap](#schema0boxedmap) | validateAndBox([Map<?, ?>](#schema0mapbuilder), configuration: SchemaConfiguration) | +| [Schema0BoxedList](#schema0boxedlist) | validateAndBox(List<*>, configuration: SchemaConfiguration) | +| [Schema0Boxed](#schema0boxed) | validateAndBox(Any?, configuration: SchemaConfiguration) | +| Any? | validate(arg: Any?, configuration: SchemaConfiguration) | + +## Schema0Map0Builder +class Schema0Map0Builder
+builder for `Map` + +A class that builds the Map input type + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| Schema0Map0Builder(Map instance)
Creates a builder that contains the passed instance | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| Map | build()
Returns map input that should be used with Schema.validate | +| [Schema0Map0Builder](#schema0map0builder) | additionalProperty(key: String, value: Nothing?) | +| [Schema0Map0Builder](#schema0map0builder) | additionalProperty(key: String, value: Boolean) | +| [Schema0Map0Builder](#schema0map0builder) | additionalProperty(key: String, value: String) | +| [Schema0Map0Builder](#schema0map0builder) | additionalProperty(key: String, value: Int) | +| [Schema0Map0Builder](#schema0map0builder) | additionalProperty(key: String, value: Float) | +| [Schema0Map0Builder](#schema0map0builder) | additionalProperty(key: String, value: Long) | +| [Schema0Map0Builder](#schema0map0builder) | additionalProperty(key: String, value: Double) | +| [Schema0Map0Builder](#schema0map0builder) | additionalProperty(key: String, value: List) | +| [Schema0Map0Builder](#schema0map0builder) | additionalProperty(key: String, value: Map) | + +## Schema0MapBuilder +class Schema0MapBuilder
+builder for `Map` + +A class that builds the Map input type + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| Schema0MapBuilder()
Creates a builder that contains an empty map | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| [Schema0Map0Builder](#schema0map0builder) | foo(value: String) | + +## Schema0Map +class Schema0Map
+extends FrozenMap + +A class to store validated Map payloads + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| static [Schema0Map](#schema0map) | of([Map](#schema0mapbuilder) arg, SchemaConfiguration configuration) | +| String | foo()
| +| Any? | getAdditionalProperty(String name)
provides type safety for additional properties | + +## FooBoxed +sealed interface FooBoxed
+permits
+[FooBoxedString](#fooboxedstring) + +sealed interface that stores validated payloads using boxed classes + +## FooBoxedString +data class FooBoxedString
+implements [FooBoxed](#fooboxed) + +data class that stores validated String payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| FooBoxedString(String data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| String | data()
validated payload | +| Any? | getData()
validated payload | + +## Foo +class Foo
+extends StringJsonSchema.StringJsonSchema1 + +A schema class that validates payloads + +| Methods Inherited from class org.openapijsonschematools.client.schemas.StringJsonSchema.StringJsonSchema1 | +| ------------------------------------------------------------------ | +| validate | +| validateAndBox | + +[[Back to top]](#top) [[Back to Component Schemas]](../../../README.md#Component-Schemas) [[Back to README]](../../../README.md) diff --git a/samples/client/3_0_3_unit_test/kotlin/docs/components/schemas/AllofWithOneEmptySchema.md b/samples/client/3_0_3_unit_test/kotlin/docs/components/schemas/AllofWithOneEmptySchema.md new file mode 100644 index 00000000000..3a4586b5661 --- /dev/null +++ b/samples/client/3_0_3_unit_test/kotlin/docs/components/schemas/AllofWithOneEmptySchema.md @@ -0,0 +1,302 @@ +# AllofWithOneEmptySchema +org.openapijsonschematools.client.components.schemas.AllofWithOneEmptySchema.java +class AllofWithOneEmptySchema
+ +A class that contains necessary nested +- schema classes (which validate payloads), extends JsonSchema +- sealed interfaces which store validated payloads, Kotlin version of a sum type +- boxed classes which store validated payloads, sealed permits class implementations + +## Nested Class Summary +| Modifier and Type | Class and Description | +| ----------------- | ---------------------- | +| sealed interface | [AllofWithOneEmptySchema.AllofWithOneEmptySchema1Boxed](#allofwithoneemptyschema1boxed)
sealed interface for validated payloads | +| record | [AllofWithOneEmptySchema.AllofWithOneEmptySchema1BoxedVoid](#allofwithoneemptyschema1boxedvoid)
boxed class to store validated null payloads | +| record | [AllofWithOneEmptySchema.AllofWithOneEmptySchema1BoxedBoolean](#allofwithoneemptyschema1boxedboolean)
boxed class to store validated boolean payloads | +| record | [AllofWithOneEmptySchema.AllofWithOneEmptySchema1BoxedNumber](#allofwithoneemptyschema1boxednumber)
boxed class to store validated Number payloads | +| record | [AllofWithOneEmptySchema.AllofWithOneEmptySchema1BoxedString](#allofwithoneemptyschema1boxedstring)
boxed class to store validated String payloads | +| record | [AllofWithOneEmptySchema.AllofWithOneEmptySchema1BoxedList](#allofwithoneemptyschema1boxedlist)
boxed class to store validated List payloads | +| record | [AllofWithOneEmptySchema.AllofWithOneEmptySchema1BoxedMap](#allofwithoneemptyschema1boxedmap)
boxed class to store validated Map payloads | +| static class | [AllofWithOneEmptySchema.AllofWithOneEmptySchema1](#allofwithoneemptyschema1)
schema class | +| sealed interface | [AllofWithOneEmptySchema.Schema0Boxed](#schema0boxed)
sealed interface for validated payloads | +| record | [AllofWithOneEmptySchema.Schema0BoxedVoid](#schema0boxedvoid)
boxed class to store validated null payloads | +| record | [AllofWithOneEmptySchema.Schema0BoxedBoolean](#schema0boxedboolean)
boxed class to store validated boolean payloads | +| record | [AllofWithOneEmptySchema.Schema0BoxedNumber](#schema0boxednumber)
boxed class to store validated Number payloads | +| record | [AllofWithOneEmptySchema.Schema0BoxedString](#schema0boxedstring)
boxed class to store validated String payloads | +| record | [AllofWithOneEmptySchema.Schema0BoxedList](#schema0boxedlist)
boxed class to store validated List payloads | +| record | [AllofWithOneEmptySchema.Schema0BoxedMap](#schema0boxedmap)
boxed class to store validated Map payloads | +| static class | [AllofWithOneEmptySchema.Schema0](#schema0)
schema class | + +## AllofWithOneEmptySchema1Boxed +sealed interface AllofWithOneEmptySchema1Boxed
+permits
+[AllofWithOneEmptySchema1BoxedVoid](#allofwithoneemptyschema1boxedvoid), +[AllofWithOneEmptySchema1BoxedBoolean](#allofwithoneemptyschema1boxedboolean), +[AllofWithOneEmptySchema1BoxedNumber](#allofwithoneemptyschema1boxednumber), +[AllofWithOneEmptySchema1BoxedString](#allofwithoneemptyschema1boxedstring), +[AllofWithOneEmptySchema1BoxedList](#allofwithoneemptyschema1boxedlist), +[AllofWithOneEmptySchema1BoxedMap](#allofwithoneemptyschema1boxedmap) + +sealed interface that stores validated payloads using boxed classes + +## AllofWithOneEmptySchema1BoxedVoid +data class AllofWithOneEmptySchema1BoxedVoid
+implements [AllofWithOneEmptySchema1Boxed](#allofwithoneemptyschema1boxed) + +data class that stores validated null payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| AllofWithOneEmptySchema1BoxedVoid(Nothing? data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| Nothing? | data()
validated payload | +| Any? | getData()
validated payload | + +## AllofWithOneEmptySchema1BoxedBoolean +data class AllofWithOneEmptySchema1BoxedBoolean
+implements [AllofWithOneEmptySchema1Boxed](#allofwithoneemptyschema1boxed) + +record that stores validated boolean payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| AllofWithOneEmptySchema1BoxedBoolean(boolean data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| boolean | data()
validated payload | +| Any? | getData()
validated payload | + +## AllofWithOneEmptySchema1BoxedNumber +data class AllofWithOneEmptySchema1BoxedNumber
+implements [AllofWithOneEmptySchema1Boxed](#allofwithoneemptyschema1boxed) + +data class that stores validated Number payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| AllofWithOneEmptySchema1BoxedNumber(Number data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| Number | data()
validated payload | +| Any? | getData()
validated payload | + +## AllofWithOneEmptySchema1BoxedString +data class AllofWithOneEmptySchema1BoxedString
+implements [AllofWithOneEmptySchema1Boxed](#allofwithoneemptyschema1boxed) + +data class that stores validated String payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| AllofWithOneEmptySchema1BoxedString(String data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| String | data()
validated payload | +| Any? | getData()
validated payload | + +## AllofWithOneEmptySchema1BoxedList +data class AllofWithOneEmptySchema1BoxedList
+implements [AllofWithOneEmptySchema1Boxed](#allofwithoneemptyschema1boxed) + +data class that stores validated List payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| AllofWithOneEmptySchema1BoxedList(FrozenList data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| FrozenList | data()
validated payload | +| Any? | getData()
validated payload | + +## AllofWithOneEmptySchema1BoxedMap +data class AllofWithOneEmptySchema1BoxedMap
+implements [AllofWithOneEmptySchema1Boxed](#allofwithoneemptyschema1boxed) + +data class that stores validated Map payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| AllofWithOneEmptySchema1BoxedMap(FrozenMap data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| FrozenMap | data()
validated payload | +| Any? | getData()
validated payload | + +## AllofWithOneEmptySchema1 +class AllofWithOneEmptySchema1
+extends JsonSchema + +A schema class that validates payloads + +### Field Summary +| Modifier and Type | Field and Description | +| ----------------- | ---------------------- | +| List> | allOf = listOf(
    [Schema0::class.java](#schema0)
;)
| + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| String | validate(arg: String, configuration: SchemaConfiguration) | +| Nothing? | validate(arg: Nothing?, configuration: SchemaConfiguration) | +| int | validate(arg: int, configuration: SchemaConfiguration) | +| long | validate(arg: long, configuration: SchemaConfiguration) | +| float | validate(arg: float, configuration: SchemaConfiguration) | +| double | validate(arg: double, configuration: SchemaConfiguration) | +| Number | validate(arg: Number, configuration: SchemaConfiguration) | +| boolean | validate(arg: boolean, configuration: SchemaConfiguration) | +| FrozenMap | validate(arg: Map<?, ?>, configuration: SchemaConfiguration) | +| FrozenList | validate(arg: List<*>, configuration: SchemaConfiguration) | +| [AllofWithOneEmptySchema1BoxedString](#allofwithoneemptyschema1boxedstring) | validateAndBox(String, configuration: SchemaConfiguration) | +| [AllofWithOneEmptySchema1BoxedVoid](#allofwithoneemptyschema1boxedvoid) | validateAndBox(Nothing?, configuration: SchemaConfiguration) | +| [AllofWithOneEmptySchema1BoxedNumber](#allofwithoneemptyschema1boxednumber) | validateAndBox(Number, configuration: SchemaConfiguration) | +| [AllofWithOneEmptySchema1BoxedBoolean](#allofwithoneemptyschema1boxedboolean) | validateAndBox(boolean, configuration: SchemaConfiguration) | +| [AllofWithOneEmptySchema1BoxedMap](#allofwithoneemptyschema1boxedmap) | validateAndBox(Map<?, ?>, configuration: SchemaConfiguration) | +| [AllofWithOneEmptySchema1BoxedList](#allofwithoneemptyschema1boxedlist) | validateAndBox(List<*>, configuration: SchemaConfiguration) | +| [AllofWithOneEmptySchema1Boxed](#allofwithoneemptyschema1boxed) | validateAndBox(Any?, configuration: SchemaConfiguration) | +| Any? | validate(arg: Any?, configuration: SchemaConfiguration) | + +## Schema0Boxed +sealed interface Schema0Boxed
+permits
+[Schema0BoxedVoid](#schema0boxedvoid), +[Schema0BoxedBoolean](#schema0boxedboolean), +[Schema0BoxedNumber](#schema0boxednumber), +[Schema0BoxedString](#schema0boxedstring), +[Schema0BoxedList](#schema0boxedlist), +[Schema0BoxedMap](#schema0boxedmap) + +sealed interface that stores validated payloads using boxed classes + +## Schema0BoxedVoid +data class Schema0BoxedVoid
+implements [Schema0Boxed](#schema0boxed) + +data class that stores validated null payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| Schema0BoxedVoid(Nothing? data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| Nothing? | data()
validated payload | +| Any? | getData()
validated payload | + +## Schema0BoxedBoolean +data class Schema0BoxedBoolean
+implements [Schema0Boxed](#schema0boxed) + +record that stores validated boolean payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| Schema0BoxedBoolean(boolean data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| boolean | data()
validated payload | +| Any? | getData()
validated payload | + +## Schema0BoxedNumber +data class Schema0BoxedNumber
+implements [Schema0Boxed](#schema0boxed) + +data class that stores validated Number payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| Schema0BoxedNumber(Number data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| Number | data()
validated payload | +| Any? | getData()
validated payload | + +## Schema0BoxedString +data class Schema0BoxedString
+implements [Schema0Boxed](#schema0boxed) + +data class that stores validated String payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| Schema0BoxedString(String data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| String | data()
validated payload | +| Any? | getData()
validated payload | + +## Schema0BoxedList +data class Schema0BoxedList
+implements [Schema0Boxed](#schema0boxed) + +data class that stores validated List payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| Schema0BoxedList(FrozenList data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| FrozenList | data()
validated payload | +| Any? | getData()
validated payload | + +## Schema0BoxedMap +data class Schema0BoxedMap
+implements [Schema0Boxed](#schema0boxed) + +data class that stores validated Map payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| Schema0BoxedMap(FrozenMap data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| FrozenMap | data()
validated payload | +| Any? | getData()
validated payload | + +## Schema0 +class Schema0
+extends AnyTypeJsonSchema.AnyTypeJsonSchema1 + +A schema class that validates payloads + +| Methods Inherited from class org.openapijsonschematools.client.schemas.AnyTypeJsonSchema.AnyTypeJsonSchema1 | +| ------------------------------------------------------------------ | +| validate | +| validateAndBox | + +[[Back to top]](#top) [[Back to Component Schemas]](../../../README.md#Component-Schemas) [[Back to README]](../../../README.md) diff --git a/samples/client/3_0_3_unit_test/kotlin/docs/components/schemas/AllofWithTheFirstEmptySchema.md b/samples/client/3_0_3_unit_test/kotlin/docs/components/schemas/AllofWithTheFirstEmptySchema.md new file mode 100644 index 00000000000..9e14a960664 --- /dev/null +++ b/samples/client/3_0_3_unit_test/kotlin/docs/components/schemas/AllofWithTheFirstEmptySchema.md @@ -0,0 +1,340 @@ +# AllofWithTheFirstEmptySchema +org.openapijsonschematools.client.components.schemas.AllofWithTheFirstEmptySchema.java +class AllofWithTheFirstEmptySchema
+ +A class that contains necessary nested +- schema classes (which validate payloads), extends JsonSchema +- sealed interfaces which store validated payloads, Kotlin version of a sum type +- boxed classes which store validated payloads, sealed permits class implementations + +## Nested Class Summary +| Modifier and Type | Class and Description | +| ----------------- | ---------------------- | +| sealed interface | [AllofWithTheFirstEmptySchema.AllofWithTheFirstEmptySchema1Boxed](#allofwiththefirstemptyschema1boxed)
sealed interface for validated payloads | +| record | [AllofWithTheFirstEmptySchema.AllofWithTheFirstEmptySchema1BoxedVoid](#allofwiththefirstemptyschema1boxedvoid)
boxed class to store validated null payloads | +| record | [AllofWithTheFirstEmptySchema.AllofWithTheFirstEmptySchema1BoxedBoolean](#allofwiththefirstemptyschema1boxedboolean)
boxed class to store validated boolean payloads | +| record | [AllofWithTheFirstEmptySchema.AllofWithTheFirstEmptySchema1BoxedNumber](#allofwiththefirstemptyschema1boxednumber)
boxed class to store validated Number payloads | +| record | [AllofWithTheFirstEmptySchema.AllofWithTheFirstEmptySchema1BoxedString](#allofwiththefirstemptyschema1boxedstring)
boxed class to store validated String payloads | +| record | [AllofWithTheFirstEmptySchema.AllofWithTheFirstEmptySchema1BoxedList](#allofwiththefirstemptyschema1boxedlist)
boxed class to store validated List payloads | +| record | [AllofWithTheFirstEmptySchema.AllofWithTheFirstEmptySchema1BoxedMap](#allofwiththefirstemptyschema1boxedmap)
boxed class to store validated Map payloads | +| static class | [AllofWithTheFirstEmptySchema.AllofWithTheFirstEmptySchema1](#allofwiththefirstemptyschema1)
schema class | +| sealed interface | [AllofWithTheFirstEmptySchema.Schema1Boxed](#schema1boxed)
sealed interface for validated payloads | +| record | [AllofWithTheFirstEmptySchema.Schema1BoxedNumber](#schema1boxednumber)
boxed class to store validated Number payloads | +| static class | [AllofWithTheFirstEmptySchema.Schema1](#schema1)
schema class | +| sealed interface | [AllofWithTheFirstEmptySchema.Schema0Boxed](#schema0boxed)
sealed interface for validated payloads | +| record | [AllofWithTheFirstEmptySchema.Schema0BoxedVoid](#schema0boxedvoid)
boxed class to store validated null payloads | +| record | [AllofWithTheFirstEmptySchema.Schema0BoxedBoolean](#schema0boxedboolean)
boxed class to store validated boolean payloads | +| record | [AllofWithTheFirstEmptySchema.Schema0BoxedNumber](#schema0boxednumber)
boxed class to store validated Number payloads | +| record | [AllofWithTheFirstEmptySchema.Schema0BoxedString](#schema0boxedstring)
boxed class to store validated String payloads | +| record | [AllofWithTheFirstEmptySchema.Schema0BoxedList](#schema0boxedlist)
boxed class to store validated List payloads | +| record | [AllofWithTheFirstEmptySchema.Schema0BoxedMap](#schema0boxedmap)
boxed class to store validated Map payloads | +| static class | [AllofWithTheFirstEmptySchema.Schema0](#schema0)
schema class | + +## AllofWithTheFirstEmptySchema1Boxed +sealed interface AllofWithTheFirstEmptySchema1Boxed
+permits
+[AllofWithTheFirstEmptySchema1BoxedVoid](#allofwiththefirstemptyschema1boxedvoid), +[AllofWithTheFirstEmptySchema1BoxedBoolean](#allofwiththefirstemptyschema1boxedboolean), +[AllofWithTheFirstEmptySchema1BoxedNumber](#allofwiththefirstemptyschema1boxednumber), +[AllofWithTheFirstEmptySchema1BoxedString](#allofwiththefirstemptyschema1boxedstring), +[AllofWithTheFirstEmptySchema1BoxedList](#allofwiththefirstemptyschema1boxedlist), +[AllofWithTheFirstEmptySchema1BoxedMap](#allofwiththefirstemptyschema1boxedmap) + +sealed interface that stores validated payloads using boxed classes + +## AllofWithTheFirstEmptySchema1BoxedVoid +data class AllofWithTheFirstEmptySchema1BoxedVoid
+implements [AllofWithTheFirstEmptySchema1Boxed](#allofwiththefirstemptyschema1boxed) + +data class that stores validated null payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| AllofWithTheFirstEmptySchema1BoxedVoid(Nothing? data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| Nothing? | data()
validated payload | +| Any? | getData()
validated payload | + +## AllofWithTheFirstEmptySchema1BoxedBoolean +data class AllofWithTheFirstEmptySchema1BoxedBoolean
+implements [AllofWithTheFirstEmptySchema1Boxed](#allofwiththefirstemptyschema1boxed) + +record that stores validated boolean payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| AllofWithTheFirstEmptySchema1BoxedBoolean(boolean data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| boolean | data()
validated payload | +| Any? | getData()
validated payload | + +## AllofWithTheFirstEmptySchema1BoxedNumber +data class AllofWithTheFirstEmptySchema1BoxedNumber
+implements [AllofWithTheFirstEmptySchema1Boxed](#allofwiththefirstemptyschema1boxed) + +data class that stores validated Number payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| AllofWithTheFirstEmptySchema1BoxedNumber(Number data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| Number | data()
validated payload | +| Any? | getData()
validated payload | + +## AllofWithTheFirstEmptySchema1BoxedString +data class AllofWithTheFirstEmptySchema1BoxedString
+implements [AllofWithTheFirstEmptySchema1Boxed](#allofwiththefirstemptyschema1boxed) + +data class that stores validated String payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| AllofWithTheFirstEmptySchema1BoxedString(String data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| String | data()
validated payload | +| Any? | getData()
validated payload | + +## AllofWithTheFirstEmptySchema1BoxedList +data class AllofWithTheFirstEmptySchema1BoxedList
+implements [AllofWithTheFirstEmptySchema1Boxed](#allofwiththefirstemptyschema1boxed) + +data class that stores validated List payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| AllofWithTheFirstEmptySchema1BoxedList(FrozenList data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| FrozenList | data()
validated payload | +| Any? | getData()
validated payload | + +## AllofWithTheFirstEmptySchema1BoxedMap +data class AllofWithTheFirstEmptySchema1BoxedMap
+implements [AllofWithTheFirstEmptySchema1Boxed](#allofwiththefirstemptyschema1boxed) + +data class that stores validated Map payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| AllofWithTheFirstEmptySchema1BoxedMap(FrozenMap data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| FrozenMap | data()
validated payload | +| Any? | getData()
validated payload | + +## AllofWithTheFirstEmptySchema1 +class AllofWithTheFirstEmptySchema1
+extends JsonSchema + +A schema class that validates payloads + +### Field Summary +| Modifier and Type | Field and Description | +| ----------------- | ---------------------- | +| List> | allOf = listOf(
    [Schema0::class.java](#schema0),
    [Schema1::class.java](#schema1)
;)
| + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| String | validate(arg: String, configuration: SchemaConfiguration) | +| Nothing? | validate(arg: Nothing?, configuration: SchemaConfiguration) | +| int | validate(arg: int, configuration: SchemaConfiguration) | +| long | validate(arg: long, configuration: SchemaConfiguration) | +| float | validate(arg: float, configuration: SchemaConfiguration) | +| double | validate(arg: double, configuration: SchemaConfiguration) | +| Number | validate(arg: Number, configuration: SchemaConfiguration) | +| boolean | validate(arg: boolean, configuration: SchemaConfiguration) | +| FrozenMap | validate(arg: Map<?, ?>, configuration: SchemaConfiguration) | +| FrozenList | validate(arg: List<*>, configuration: SchemaConfiguration) | +| [AllofWithTheFirstEmptySchema1BoxedString](#allofwiththefirstemptyschema1boxedstring) | validateAndBox(String, configuration: SchemaConfiguration) | +| [AllofWithTheFirstEmptySchema1BoxedVoid](#allofwiththefirstemptyschema1boxedvoid) | validateAndBox(Nothing?, configuration: SchemaConfiguration) | +| [AllofWithTheFirstEmptySchema1BoxedNumber](#allofwiththefirstemptyschema1boxednumber) | validateAndBox(Number, configuration: SchemaConfiguration) | +| [AllofWithTheFirstEmptySchema1BoxedBoolean](#allofwiththefirstemptyschema1boxedboolean) | validateAndBox(boolean, configuration: SchemaConfiguration) | +| [AllofWithTheFirstEmptySchema1BoxedMap](#allofwiththefirstemptyschema1boxedmap) | validateAndBox(Map<?, ?>, configuration: SchemaConfiguration) | +| [AllofWithTheFirstEmptySchema1BoxedList](#allofwiththefirstemptyschema1boxedlist) | validateAndBox(List<*>, configuration: SchemaConfiguration) | +| [AllofWithTheFirstEmptySchema1Boxed](#allofwiththefirstemptyschema1boxed) | validateAndBox(Any?, configuration: SchemaConfiguration) | +| Any? | validate(arg: Any?, configuration: SchemaConfiguration) | + +## Schema1Boxed +sealed interface Schema1Boxed
+permits
+[Schema1BoxedNumber](#schema1boxednumber) + +sealed interface that stores validated payloads using boxed classes + +## Schema1BoxedNumber +data class Schema1BoxedNumber
+implements [Schema1Boxed](#schema1boxed) + +data class that stores validated Number payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| Schema1BoxedNumber(Number data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| Number | data()
validated payload | +| Any? | getData()
validated payload | + +## Schema1 +class Schema1
+extends NumberJsonSchema.NumberJsonSchema1 + +A schema class that validates payloads + +| Methods Inherited from class org.openapijsonschematools.client.schemas.NumberJsonSchema.NumberJsonSchema1 | +| ------------------------------------------------------------------ | +| validate | +| validateAndBox | + +## Schema0Boxed +sealed interface Schema0Boxed
+permits
+[Schema0BoxedVoid](#schema0boxedvoid), +[Schema0BoxedBoolean](#schema0boxedboolean), +[Schema0BoxedNumber](#schema0boxednumber), +[Schema0BoxedString](#schema0boxedstring), +[Schema0BoxedList](#schema0boxedlist), +[Schema0BoxedMap](#schema0boxedmap) + +sealed interface that stores validated payloads using boxed classes + +## Schema0BoxedVoid +data class Schema0BoxedVoid
+implements [Schema0Boxed](#schema0boxed) + +data class that stores validated null payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| Schema0BoxedVoid(Nothing? data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| Nothing? | data()
validated payload | +| Any? | getData()
validated payload | + +## Schema0BoxedBoolean +data class Schema0BoxedBoolean
+implements [Schema0Boxed](#schema0boxed) + +record that stores validated boolean payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| Schema0BoxedBoolean(boolean data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| boolean | data()
validated payload | +| Any? | getData()
validated payload | + +## Schema0BoxedNumber +data class Schema0BoxedNumber
+implements [Schema0Boxed](#schema0boxed) + +data class that stores validated Number payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| Schema0BoxedNumber(Number data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| Number | data()
validated payload | +| Any? | getData()
validated payload | + +## Schema0BoxedString +data class Schema0BoxedString
+implements [Schema0Boxed](#schema0boxed) + +data class that stores validated String payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| Schema0BoxedString(String data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| String | data()
validated payload | +| Any? | getData()
validated payload | + +## Schema0BoxedList +data class Schema0BoxedList
+implements [Schema0Boxed](#schema0boxed) + +data class that stores validated List payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| Schema0BoxedList(FrozenList data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| FrozenList | data()
validated payload | +| Any? | getData()
validated payload | + +## Schema0BoxedMap +data class Schema0BoxedMap
+implements [Schema0Boxed](#schema0boxed) + +data class that stores validated Map payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| Schema0BoxedMap(FrozenMap data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| FrozenMap | data()
validated payload | +| Any? | getData()
validated payload | + +## Schema0 +class Schema0
+extends AnyTypeJsonSchema.AnyTypeJsonSchema1 + +A schema class that validates payloads + +| Methods Inherited from class org.openapijsonschematools.client.schemas.AnyTypeJsonSchema.AnyTypeJsonSchema1 | +| ------------------------------------------------------------------ | +| validate | +| validateAndBox | + +[[Back to top]](#top) [[Back to Component Schemas]](../../../README.md#Component-Schemas) [[Back to README]](../../../README.md) diff --git a/samples/client/3_0_3_unit_test/kotlin/docs/components/schemas/AllofWithTheLastEmptySchema.md b/samples/client/3_0_3_unit_test/kotlin/docs/components/schemas/AllofWithTheLastEmptySchema.md new file mode 100644 index 00000000000..b67c14c1c5a --- /dev/null +++ b/samples/client/3_0_3_unit_test/kotlin/docs/components/schemas/AllofWithTheLastEmptySchema.md @@ -0,0 +1,340 @@ +# AllofWithTheLastEmptySchema +org.openapijsonschematools.client.components.schemas.AllofWithTheLastEmptySchema.java +class AllofWithTheLastEmptySchema
+ +A class that contains necessary nested +- schema classes (which validate payloads), extends JsonSchema +- sealed interfaces which store validated payloads, Kotlin version of a sum type +- boxed classes which store validated payloads, sealed permits class implementations + +## Nested Class Summary +| Modifier and Type | Class and Description | +| ----------------- | ---------------------- | +| sealed interface | [AllofWithTheLastEmptySchema.AllofWithTheLastEmptySchema1Boxed](#allofwiththelastemptyschema1boxed)
sealed interface for validated payloads | +| record | [AllofWithTheLastEmptySchema.AllofWithTheLastEmptySchema1BoxedVoid](#allofwiththelastemptyschema1boxedvoid)
boxed class to store validated null payloads | +| record | [AllofWithTheLastEmptySchema.AllofWithTheLastEmptySchema1BoxedBoolean](#allofwiththelastemptyschema1boxedboolean)
boxed class to store validated boolean payloads | +| record | [AllofWithTheLastEmptySchema.AllofWithTheLastEmptySchema1BoxedNumber](#allofwiththelastemptyschema1boxednumber)
boxed class to store validated Number payloads | +| record | [AllofWithTheLastEmptySchema.AllofWithTheLastEmptySchema1BoxedString](#allofwiththelastemptyschema1boxedstring)
boxed class to store validated String payloads | +| record | [AllofWithTheLastEmptySchema.AllofWithTheLastEmptySchema1BoxedList](#allofwiththelastemptyschema1boxedlist)
boxed class to store validated List payloads | +| record | [AllofWithTheLastEmptySchema.AllofWithTheLastEmptySchema1BoxedMap](#allofwiththelastemptyschema1boxedmap)
boxed class to store validated Map payloads | +| static class | [AllofWithTheLastEmptySchema.AllofWithTheLastEmptySchema1](#allofwiththelastemptyschema1)
schema class | +| sealed interface | [AllofWithTheLastEmptySchema.Schema1Boxed](#schema1boxed)
sealed interface for validated payloads | +| record | [AllofWithTheLastEmptySchema.Schema1BoxedVoid](#schema1boxedvoid)
boxed class to store validated null payloads | +| record | [AllofWithTheLastEmptySchema.Schema1BoxedBoolean](#schema1boxedboolean)
boxed class to store validated boolean payloads | +| record | [AllofWithTheLastEmptySchema.Schema1BoxedNumber](#schema1boxednumber)
boxed class to store validated Number payloads | +| record | [AllofWithTheLastEmptySchema.Schema1BoxedString](#schema1boxedstring)
boxed class to store validated String payloads | +| record | [AllofWithTheLastEmptySchema.Schema1BoxedList](#schema1boxedlist)
boxed class to store validated List payloads | +| record | [AllofWithTheLastEmptySchema.Schema1BoxedMap](#schema1boxedmap)
boxed class to store validated Map payloads | +| static class | [AllofWithTheLastEmptySchema.Schema1](#schema1)
schema class | +| sealed interface | [AllofWithTheLastEmptySchema.Schema0Boxed](#schema0boxed)
sealed interface for validated payloads | +| record | [AllofWithTheLastEmptySchema.Schema0BoxedNumber](#schema0boxednumber)
boxed class to store validated Number payloads | +| static class | [AllofWithTheLastEmptySchema.Schema0](#schema0)
schema class | + +## AllofWithTheLastEmptySchema1Boxed +sealed interface AllofWithTheLastEmptySchema1Boxed
+permits
+[AllofWithTheLastEmptySchema1BoxedVoid](#allofwiththelastemptyschema1boxedvoid), +[AllofWithTheLastEmptySchema1BoxedBoolean](#allofwiththelastemptyschema1boxedboolean), +[AllofWithTheLastEmptySchema1BoxedNumber](#allofwiththelastemptyschema1boxednumber), +[AllofWithTheLastEmptySchema1BoxedString](#allofwiththelastemptyschema1boxedstring), +[AllofWithTheLastEmptySchema1BoxedList](#allofwiththelastemptyschema1boxedlist), +[AllofWithTheLastEmptySchema1BoxedMap](#allofwiththelastemptyschema1boxedmap) + +sealed interface that stores validated payloads using boxed classes + +## AllofWithTheLastEmptySchema1BoxedVoid +data class AllofWithTheLastEmptySchema1BoxedVoid
+implements [AllofWithTheLastEmptySchema1Boxed](#allofwiththelastemptyschema1boxed) + +data class that stores validated null payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| AllofWithTheLastEmptySchema1BoxedVoid(Nothing? data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| Nothing? | data()
validated payload | +| Any? | getData()
validated payload | + +## AllofWithTheLastEmptySchema1BoxedBoolean +data class AllofWithTheLastEmptySchema1BoxedBoolean
+implements [AllofWithTheLastEmptySchema1Boxed](#allofwiththelastemptyschema1boxed) + +record that stores validated boolean payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| AllofWithTheLastEmptySchema1BoxedBoolean(boolean data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| boolean | data()
validated payload | +| Any? | getData()
validated payload | + +## AllofWithTheLastEmptySchema1BoxedNumber +data class AllofWithTheLastEmptySchema1BoxedNumber
+implements [AllofWithTheLastEmptySchema1Boxed](#allofwiththelastemptyschema1boxed) + +data class that stores validated Number payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| AllofWithTheLastEmptySchema1BoxedNumber(Number data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| Number | data()
validated payload | +| Any? | getData()
validated payload | + +## AllofWithTheLastEmptySchema1BoxedString +data class AllofWithTheLastEmptySchema1BoxedString
+implements [AllofWithTheLastEmptySchema1Boxed](#allofwiththelastemptyschema1boxed) + +data class that stores validated String payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| AllofWithTheLastEmptySchema1BoxedString(String data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| String | data()
validated payload | +| Any? | getData()
validated payload | + +## AllofWithTheLastEmptySchema1BoxedList +data class AllofWithTheLastEmptySchema1BoxedList
+implements [AllofWithTheLastEmptySchema1Boxed](#allofwiththelastemptyschema1boxed) + +data class that stores validated List payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| AllofWithTheLastEmptySchema1BoxedList(FrozenList data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| FrozenList | data()
validated payload | +| Any? | getData()
validated payload | + +## AllofWithTheLastEmptySchema1BoxedMap +data class AllofWithTheLastEmptySchema1BoxedMap
+implements [AllofWithTheLastEmptySchema1Boxed](#allofwiththelastemptyschema1boxed) + +data class that stores validated Map payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| AllofWithTheLastEmptySchema1BoxedMap(FrozenMap data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| FrozenMap | data()
validated payload | +| Any? | getData()
validated payload | + +## AllofWithTheLastEmptySchema1 +class AllofWithTheLastEmptySchema1
+extends JsonSchema + +A schema class that validates payloads + +### Field Summary +| Modifier and Type | Field and Description | +| ----------------- | ---------------------- | +| List> | allOf = listOf(
    [Schema0::class.java](#schema0),
    [Schema1::class.java](#schema1)
;)
| + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| String | validate(arg: String, configuration: SchemaConfiguration) | +| Nothing? | validate(arg: Nothing?, configuration: SchemaConfiguration) | +| int | validate(arg: int, configuration: SchemaConfiguration) | +| long | validate(arg: long, configuration: SchemaConfiguration) | +| float | validate(arg: float, configuration: SchemaConfiguration) | +| double | validate(arg: double, configuration: SchemaConfiguration) | +| Number | validate(arg: Number, configuration: SchemaConfiguration) | +| boolean | validate(arg: boolean, configuration: SchemaConfiguration) | +| FrozenMap | validate(arg: Map<?, ?>, configuration: SchemaConfiguration) | +| FrozenList | validate(arg: List<*>, configuration: SchemaConfiguration) | +| [AllofWithTheLastEmptySchema1BoxedString](#allofwiththelastemptyschema1boxedstring) | validateAndBox(String, configuration: SchemaConfiguration) | +| [AllofWithTheLastEmptySchema1BoxedVoid](#allofwiththelastemptyschema1boxedvoid) | validateAndBox(Nothing?, configuration: SchemaConfiguration) | +| [AllofWithTheLastEmptySchema1BoxedNumber](#allofwiththelastemptyschema1boxednumber) | validateAndBox(Number, configuration: SchemaConfiguration) | +| [AllofWithTheLastEmptySchema1BoxedBoolean](#allofwiththelastemptyschema1boxedboolean) | validateAndBox(boolean, configuration: SchemaConfiguration) | +| [AllofWithTheLastEmptySchema1BoxedMap](#allofwiththelastemptyschema1boxedmap) | validateAndBox(Map<?, ?>, configuration: SchemaConfiguration) | +| [AllofWithTheLastEmptySchema1BoxedList](#allofwiththelastemptyschema1boxedlist) | validateAndBox(List<*>, configuration: SchemaConfiguration) | +| [AllofWithTheLastEmptySchema1Boxed](#allofwiththelastemptyschema1boxed) | validateAndBox(Any?, configuration: SchemaConfiguration) | +| Any? | validate(arg: Any?, configuration: SchemaConfiguration) | + +## Schema1Boxed +sealed interface Schema1Boxed
+permits
+[Schema1BoxedVoid](#schema1boxedvoid), +[Schema1BoxedBoolean](#schema1boxedboolean), +[Schema1BoxedNumber](#schema1boxednumber), +[Schema1BoxedString](#schema1boxedstring), +[Schema1BoxedList](#schema1boxedlist), +[Schema1BoxedMap](#schema1boxedmap) + +sealed interface that stores validated payloads using boxed classes + +## Schema1BoxedVoid +data class Schema1BoxedVoid
+implements [Schema1Boxed](#schema1boxed) + +data class that stores validated null payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| Schema1BoxedVoid(Nothing? data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| Nothing? | data()
validated payload | +| Any? | getData()
validated payload | + +## Schema1BoxedBoolean +data class Schema1BoxedBoolean
+implements [Schema1Boxed](#schema1boxed) + +record that stores validated boolean payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| Schema1BoxedBoolean(boolean data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| boolean | data()
validated payload | +| Any? | getData()
validated payload | + +## Schema1BoxedNumber +data class Schema1BoxedNumber
+implements [Schema1Boxed](#schema1boxed) + +data class that stores validated Number payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| Schema1BoxedNumber(Number data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| Number | data()
validated payload | +| Any? | getData()
validated payload | + +## Schema1BoxedString +data class Schema1BoxedString
+implements [Schema1Boxed](#schema1boxed) + +data class that stores validated String payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| Schema1BoxedString(String data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| String | data()
validated payload | +| Any? | getData()
validated payload | + +## Schema1BoxedList +data class Schema1BoxedList
+implements [Schema1Boxed](#schema1boxed) + +data class that stores validated List payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| Schema1BoxedList(FrozenList data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| FrozenList | data()
validated payload | +| Any? | getData()
validated payload | + +## Schema1BoxedMap +data class Schema1BoxedMap
+implements [Schema1Boxed](#schema1boxed) + +data class that stores validated Map payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| Schema1BoxedMap(FrozenMap data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| FrozenMap | data()
validated payload | +| Any? | getData()
validated payload | + +## Schema1 +class Schema1
+extends AnyTypeJsonSchema.AnyTypeJsonSchema1 + +A schema class that validates payloads + +| Methods Inherited from class org.openapijsonschematools.client.schemas.AnyTypeJsonSchema.AnyTypeJsonSchema1 | +| ------------------------------------------------------------------ | +| validate | +| validateAndBox | + +## Schema0Boxed +sealed interface Schema0Boxed
+permits
+[Schema0BoxedNumber](#schema0boxednumber) + +sealed interface that stores validated payloads using boxed classes + +## Schema0BoxedNumber +data class Schema0BoxedNumber
+implements [Schema0Boxed](#schema0boxed) + +data class that stores validated Number payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| Schema0BoxedNumber(Number data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| Number | data()
validated payload | +| Any? | getData()
validated payload | + +## Schema0 +class Schema0
+extends NumberJsonSchema.NumberJsonSchema1 + +A schema class that validates payloads + +| Methods Inherited from class org.openapijsonschematools.client.schemas.NumberJsonSchema.NumberJsonSchema1 | +| ------------------------------------------------------------------ | +| validate | +| validateAndBox | + +[[Back to top]](#top) [[Back to Component Schemas]](../../../README.md#Component-Schemas) [[Back to README]](../../../README.md) diff --git a/samples/client/3_0_3_unit_test/kotlin/docs/components/schemas/AllofWithTwoEmptySchemas.md b/samples/client/3_0_3_unit_test/kotlin/docs/components/schemas/AllofWithTwoEmptySchemas.md new file mode 100644 index 00000000000..18791b95b8d --- /dev/null +++ b/samples/client/3_0_3_unit_test/kotlin/docs/components/schemas/AllofWithTwoEmptySchemas.md @@ -0,0 +1,435 @@ +# AllofWithTwoEmptySchemas +org.openapijsonschematools.client.components.schemas.AllofWithTwoEmptySchemas.java +class AllofWithTwoEmptySchemas
+ +A class that contains necessary nested +- schema classes (which validate payloads), extends JsonSchema +- sealed interfaces which store validated payloads, Kotlin version of a sum type +- boxed classes which store validated payloads, sealed permits class implementations + +## Nested Class Summary +| Modifier and Type | Class and Description | +| ----------------- | ---------------------- | +| sealed interface | [AllofWithTwoEmptySchemas.AllofWithTwoEmptySchemas1Boxed](#allofwithtwoemptyschemas1boxed)
sealed interface for validated payloads | +| record | [AllofWithTwoEmptySchemas.AllofWithTwoEmptySchemas1BoxedVoid](#allofwithtwoemptyschemas1boxedvoid)
boxed class to store validated null payloads | +| record | [AllofWithTwoEmptySchemas.AllofWithTwoEmptySchemas1BoxedBoolean](#allofwithtwoemptyschemas1boxedboolean)
boxed class to store validated boolean payloads | +| record | [AllofWithTwoEmptySchemas.AllofWithTwoEmptySchemas1BoxedNumber](#allofwithtwoemptyschemas1boxednumber)
boxed class to store validated Number payloads | +| record | [AllofWithTwoEmptySchemas.AllofWithTwoEmptySchemas1BoxedString](#allofwithtwoemptyschemas1boxedstring)
boxed class to store validated String payloads | +| record | [AllofWithTwoEmptySchemas.AllofWithTwoEmptySchemas1BoxedList](#allofwithtwoemptyschemas1boxedlist)
boxed class to store validated List payloads | +| record | [AllofWithTwoEmptySchemas.AllofWithTwoEmptySchemas1BoxedMap](#allofwithtwoemptyschemas1boxedmap)
boxed class to store validated Map payloads | +| static class | [AllofWithTwoEmptySchemas.AllofWithTwoEmptySchemas1](#allofwithtwoemptyschemas1)
schema class | +| sealed interface | [AllofWithTwoEmptySchemas.Schema1Boxed](#schema1boxed)
sealed interface for validated payloads | +| record | [AllofWithTwoEmptySchemas.Schema1BoxedVoid](#schema1boxedvoid)
boxed class to store validated null payloads | +| record | [AllofWithTwoEmptySchemas.Schema1BoxedBoolean](#schema1boxedboolean)
boxed class to store validated boolean payloads | +| record | [AllofWithTwoEmptySchemas.Schema1BoxedNumber](#schema1boxednumber)
boxed class to store validated Number payloads | +| record | [AllofWithTwoEmptySchemas.Schema1BoxedString](#schema1boxedstring)
boxed class to store validated String payloads | +| record | [AllofWithTwoEmptySchemas.Schema1BoxedList](#schema1boxedlist)
boxed class to store validated List payloads | +| record | [AllofWithTwoEmptySchemas.Schema1BoxedMap](#schema1boxedmap)
boxed class to store validated Map payloads | +| static class | [AllofWithTwoEmptySchemas.Schema1](#schema1)
schema class | +| sealed interface | [AllofWithTwoEmptySchemas.Schema0Boxed](#schema0boxed)
sealed interface for validated payloads | +| record | [AllofWithTwoEmptySchemas.Schema0BoxedVoid](#schema0boxedvoid)
boxed class to store validated null payloads | +| record | [AllofWithTwoEmptySchemas.Schema0BoxedBoolean](#schema0boxedboolean)
boxed class to store validated boolean payloads | +| record | [AllofWithTwoEmptySchemas.Schema0BoxedNumber](#schema0boxednumber)
boxed class to store validated Number payloads | +| record | [AllofWithTwoEmptySchemas.Schema0BoxedString](#schema0boxedstring)
boxed class to store validated String payloads | +| record | [AllofWithTwoEmptySchemas.Schema0BoxedList](#schema0boxedlist)
boxed class to store validated List payloads | +| record | [AllofWithTwoEmptySchemas.Schema0BoxedMap](#schema0boxedmap)
boxed class to store validated Map payloads | +| static class | [AllofWithTwoEmptySchemas.Schema0](#schema0)
schema class | + +## AllofWithTwoEmptySchemas1Boxed +sealed interface AllofWithTwoEmptySchemas1Boxed
+permits
+[AllofWithTwoEmptySchemas1BoxedVoid](#allofwithtwoemptyschemas1boxedvoid), +[AllofWithTwoEmptySchemas1BoxedBoolean](#allofwithtwoemptyschemas1boxedboolean), +[AllofWithTwoEmptySchemas1BoxedNumber](#allofwithtwoemptyschemas1boxednumber), +[AllofWithTwoEmptySchemas1BoxedString](#allofwithtwoemptyschemas1boxedstring), +[AllofWithTwoEmptySchemas1BoxedList](#allofwithtwoemptyschemas1boxedlist), +[AllofWithTwoEmptySchemas1BoxedMap](#allofwithtwoemptyschemas1boxedmap) + +sealed interface that stores validated payloads using boxed classes + +## AllofWithTwoEmptySchemas1BoxedVoid +data class AllofWithTwoEmptySchemas1BoxedVoid
+implements [AllofWithTwoEmptySchemas1Boxed](#allofwithtwoemptyschemas1boxed) + +data class that stores validated null payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| AllofWithTwoEmptySchemas1BoxedVoid(Nothing? data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| Nothing? | data()
validated payload | +| Any? | getData()
validated payload | + +## AllofWithTwoEmptySchemas1BoxedBoolean +data class AllofWithTwoEmptySchemas1BoxedBoolean
+implements [AllofWithTwoEmptySchemas1Boxed](#allofwithtwoemptyschemas1boxed) + +record that stores validated boolean payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| AllofWithTwoEmptySchemas1BoxedBoolean(boolean data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| boolean | data()
validated payload | +| Any? | getData()
validated payload | + +## AllofWithTwoEmptySchemas1BoxedNumber +data class AllofWithTwoEmptySchemas1BoxedNumber
+implements [AllofWithTwoEmptySchemas1Boxed](#allofwithtwoemptyschemas1boxed) + +data class that stores validated Number payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| AllofWithTwoEmptySchemas1BoxedNumber(Number data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| Number | data()
validated payload | +| Any? | getData()
validated payload | + +## AllofWithTwoEmptySchemas1BoxedString +data class AllofWithTwoEmptySchemas1BoxedString
+implements [AllofWithTwoEmptySchemas1Boxed](#allofwithtwoemptyschemas1boxed) + +data class that stores validated String payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| AllofWithTwoEmptySchemas1BoxedString(String data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| String | data()
validated payload | +| Any? | getData()
validated payload | + +## AllofWithTwoEmptySchemas1BoxedList +data class AllofWithTwoEmptySchemas1BoxedList
+implements [AllofWithTwoEmptySchemas1Boxed](#allofwithtwoemptyschemas1boxed) + +data class that stores validated List payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| AllofWithTwoEmptySchemas1BoxedList(FrozenList data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| FrozenList | data()
validated payload | +| Any? | getData()
validated payload | + +## AllofWithTwoEmptySchemas1BoxedMap +data class AllofWithTwoEmptySchemas1BoxedMap
+implements [AllofWithTwoEmptySchemas1Boxed](#allofwithtwoemptyschemas1boxed) + +data class that stores validated Map payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| AllofWithTwoEmptySchemas1BoxedMap(FrozenMap data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| FrozenMap | data()
validated payload | +| Any? | getData()
validated payload | + +## AllofWithTwoEmptySchemas1 +class AllofWithTwoEmptySchemas1
+extends JsonSchema + +A schema class that validates payloads + +### Field Summary +| Modifier and Type | Field and Description | +| ----------------- | ---------------------- | +| List> | allOf = listOf(
    [Schema0::class.java](#schema0),
    [Schema1::class.java](#schema1)
;)
| + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| String | validate(arg: String, configuration: SchemaConfiguration) | +| Nothing? | validate(arg: Nothing?, configuration: SchemaConfiguration) | +| int | validate(arg: int, configuration: SchemaConfiguration) | +| long | validate(arg: long, configuration: SchemaConfiguration) | +| float | validate(arg: float, configuration: SchemaConfiguration) | +| double | validate(arg: double, configuration: SchemaConfiguration) | +| Number | validate(arg: Number, configuration: SchemaConfiguration) | +| boolean | validate(arg: boolean, configuration: SchemaConfiguration) | +| FrozenMap | validate(arg: Map<?, ?>, configuration: SchemaConfiguration) | +| FrozenList | validate(arg: List<*>, configuration: SchemaConfiguration) | +| [AllofWithTwoEmptySchemas1BoxedString](#allofwithtwoemptyschemas1boxedstring) | validateAndBox(String, configuration: SchemaConfiguration) | +| [AllofWithTwoEmptySchemas1BoxedVoid](#allofwithtwoemptyschemas1boxedvoid) | validateAndBox(Nothing?, configuration: SchemaConfiguration) | +| [AllofWithTwoEmptySchemas1BoxedNumber](#allofwithtwoemptyschemas1boxednumber) | validateAndBox(Number, configuration: SchemaConfiguration) | +| [AllofWithTwoEmptySchemas1BoxedBoolean](#allofwithtwoemptyschemas1boxedboolean) | validateAndBox(boolean, configuration: SchemaConfiguration) | +| [AllofWithTwoEmptySchemas1BoxedMap](#allofwithtwoemptyschemas1boxedmap) | validateAndBox(Map<?, ?>, configuration: SchemaConfiguration) | +| [AllofWithTwoEmptySchemas1BoxedList](#allofwithtwoemptyschemas1boxedlist) | validateAndBox(List<*>, configuration: SchemaConfiguration) | +| [AllofWithTwoEmptySchemas1Boxed](#allofwithtwoemptyschemas1boxed) | validateAndBox(Any?, configuration: SchemaConfiguration) | +| Any? | validate(arg: Any?, configuration: SchemaConfiguration) | + +## Schema1Boxed +sealed interface Schema1Boxed
+permits
+[Schema1BoxedVoid](#schema1boxedvoid), +[Schema1BoxedBoolean](#schema1boxedboolean), +[Schema1BoxedNumber](#schema1boxednumber), +[Schema1BoxedString](#schema1boxedstring), +[Schema1BoxedList](#schema1boxedlist), +[Schema1BoxedMap](#schema1boxedmap) + +sealed interface that stores validated payloads using boxed classes + +## Schema1BoxedVoid +data class Schema1BoxedVoid
+implements [Schema1Boxed](#schema1boxed) + +data class that stores validated null payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| Schema1BoxedVoid(Nothing? data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| Nothing? | data()
validated payload | +| Any? | getData()
validated payload | + +## Schema1BoxedBoolean +data class Schema1BoxedBoolean
+implements [Schema1Boxed](#schema1boxed) + +record that stores validated boolean payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| Schema1BoxedBoolean(boolean data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| boolean | data()
validated payload | +| Any? | getData()
validated payload | + +## Schema1BoxedNumber +data class Schema1BoxedNumber
+implements [Schema1Boxed](#schema1boxed) + +data class that stores validated Number payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| Schema1BoxedNumber(Number data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| Number | data()
validated payload | +| Any? | getData()
validated payload | + +## Schema1BoxedString +data class Schema1BoxedString
+implements [Schema1Boxed](#schema1boxed) + +data class that stores validated String payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| Schema1BoxedString(String data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| String | data()
validated payload | +| Any? | getData()
validated payload | + +## Schema1BoxedList +data class Schema1BoxedList
+implements [Schema1Boxed](#schema1boxed) + +data class that stores validated List payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| Schema1BoxedList(FrozenList data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| FrozenList | data()
validated payload | +| Any? | getData()
validated payload | + +## Schema1BoxedMap +data class Schema1BoxedMap
+implements [Schema1Boxed](#schema1boxed) + +data class that stores validated Map payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| Schema1BoxedMap(FrozenMap data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| FrozenMap | data()
validated payload | +| Any? | getData()
validated payload | + +## Schema1 +class Schema1
+extends AnyTypeJsonSchema.AnyTypeJsonSchema1 + +A schema class that validates payloads + +| Methods Inherited from class org.openapijsonschematools.client.schemas.AnyTypeJsonSchema.AnyTypeJsonSchema1 | +| ------------------------------------------------------------------ | +| validate | +| validateAndBox | + +## Schema0Boxed +sealed interface Schema0Boxed
+permits
+[Schema0BoxedVoid](#schema0boxedvoid), +[Schema0BoxedBoolean](#schema0boxedboolean), +[Schema0BoxedNumber](#schema0boxednumber), +[Schema0BoxedString](#schema0boxedstring), +[Schema0BoxedList](#schema0boxedlist), +[Schema0BoxedMap](#schema0boxedmap) + +sealed interface that stores validated payloads using boxed classes + +## Schema0BoxedVoid +data class Schema0BoxedVoid
+implements [Schema0Boxed](#schema0boxed) + +data class that stores validated null payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| Schema0BoxedVoid(Nothing? data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| Nothing? | data()
validated payload | +| Any? | getData()
validated payload | + +## Schema0BoxedBoolean +data class Schema0BoxedBoolean
+implements [Schema0Boxed](#schema0boxed) + +record that stores validated boolean payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| Schema0BoxedBoolean(boolean data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| boolean | data()
validated payload | +| Any? | getData()
validated payload | + +## Schema0BoxedNumber +data class Schema0BoxedNumber
+implements [Schema0Boxed](#schema0boxed) + +data class that stores validated Number payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| Schema0BoxedNumber(Number data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| Number | data()
validated payload | +| Any? | getData()
validated payload | + +## Schema0BoxedString +data class Schema0BoxedString
+implements [Schema0Boxed](#schema0boxed) + +data class that stores validated String payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| Schema0BoxedString(String data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| String | data()
validated payload | +| Any? | getData()
validated payload | + +## Schema0BoxedList +data class Schema0BoxedList
+implements [Schema0Boxed](#schema0boxed) + +data class that stores validated List payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| Schema0BoxedList(FrozenList data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| FrozenList | data()
validated payload | +| Any? | getData()
validated payload | + +## Schema0BoxedMap +data class Schema0BoxedMap
+implements [Schema0Boxed](#schema0boxed) + +data class that stores validated Map payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| Schema0BoxedMap(FrozenMap data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| FrozenMap | data()
validated payload | +| Any? | getData()
validated payload | + +## Schema0 +class Schema0
+extends AnyTypeJsonSchema.AnyTypeJsonSchema1 + +A schema class that validates payloads + +| Methods Inherited from class org.openapijsonschematools.client.schemas.AnyTypeJsonSchema.AnyTypeJsonSchema1 | +| ------------------------------------------------------------------ | +| validate | +| validateAndBox | + +[[Back to top]](#top) [[Back to Component Schemas]](../../../README.md#Component-Schemas) [[Back to README]](../../../README.md) diff --git a/samples/client/3_0_3_unit_test/kotlin/docs/components/schemas/Anyof.md b/samples/client/3_0_3_unit_test/kotlin/docs/components/schemas/Anyof.md new file mode 100644 index 00000000000..0b400ccbe95 --- /dev/null +++ b/samples/client/3_0_3_unit_test/kotlin/docs/components/schemas/Anyof.md @@ -0,0 +1,362 @@ +# Anyof +org.openapijsonschematools.client.components.schemas.Anyof.java +class Anyof
+ +A class that contains necessary nested +- schema classes (which validate payloads), extends JsonSchema +- sealed interfaces which store validated payloads, Kotlin version of a sum type +- boxed classes which store validated payloads, sealed permits class implementations + +## Nested Class Summary +| Modifier and Type | Class and Description | +| ----------------- | ---------------------- | +| sealed interface | [Anyof.Anyof1Boxed](#anyof1boxed)
sealed interface for validated payloads | +| record | [Anyof.Anyof1BoxedVoid](#anyof1boxedvoid)
boxed class to store validated null payloads | +| record | [Anyof.Anyof1BoxedBoolean](#anyof1boxedboolean)
boxed class to store validated boolean payloads | +| record | [Anyof.Anyof1BoxedNumber](#anyof1boxednumber)
boxed class to store validated Number payloads | +| record | [Anyof.Anyof1BoxedString](#anyof1boxedstring)
boxed class to store validated String payloads | +| record | [Anyof.Anyof1BoxedList](#anyof1boxedlist)
boxed class to store validated List payloads | +| record | [Anyof.Anyof1BoxedMap](#anyof1boxedmap)
boxed class to store validated Map payloads | +| static class | [Anyof.Anyof1](#anyof1)
schema class | +| sealed interface | [Anyof.Schema1Boxed](#schema1boxed)
sealed interface for validated payloads | +| record | [Anyof.Schema1BoxedVoid](#schema1boxedvoid)
boxed class to store validated null payloads | +| record | [Anyof.Schema1BoxedBoolean](#schema1boxedboolean)
boxed class to store validated boolean payloads | +| record | [Anyof.Schema1BoxedNumber](#schema1boxednumber)
boxed class to store validated Number payloads | +| record | [Anyof.Schema1BoxedString](#schema1boxedstring)
boxed class to store validated String payloads | +| record | [Anyof.Schema1BoxedList](#schema1boxedlist)
boxed class to store validated List payloads | +| record | [Anyof.Schema1BoxedMap](#schema1boxedmap)
boxed class to store validated Map payloads | +| static class | [Anyof.Schema1](#schema1)
schema class | +| sealed interface | [Anyof.Schema0Boxed](#schema0boxed)
sealed interface for validated payloads | +| record | [Anyof.Schema0BoxedNumber](#schema0boxednumber)
boxed class to store validated Number payloads | +| static class | [Anyof.Schema0](#schema0)
schema class | + +## Anyof1Boxed +sealed interface Anyof1Boxed
+permits
+[Anyof1BoxedVoid](#anyof1boxedvoid), +[Anyof1BoxedBoolean](#anyof1boxedboolean), +[Anyof1BoxedNumber](#anyof1boxednumber), +[Anyof1BoxedString](#anyof1boxedstring), +[Anyof1BoxedList](#anyof1boxedlist), +[Anyof1BoxedMap](#anyof1boxedmap) + +sealed interface that stores validated payloads using boxed classes + +## Anyof1BoxedVoid +data class Anyof1BoxedVoid
+implements [Anyof1Boxed](#anyof1boxed) + +data class that stores validated null payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| Anyof1BoxedVoid(Nothing? data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| Nothing? | data()
validated payload | +| Any? | getData()
validated payload | + +## Anyof1BoxedBoolean +data class Anyof1BoxedBoolean
+implements [Anyof1Boxed](#anyof1boxed) + +record that stores validated boolean payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| Anyof1BoxedBoolean(boolean data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| boolean | data()
validated payload | +| Any? | getData()
validated payload | + +## Anyof1BoxedNumber +data class Anyof1BoxedNumber
+implements [Anyof1Boxed](#anyof1boxed) + +data class that stores validated Number payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| Anyof1BoxedNumber(Number data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| Number | data()
validated payload | +| Any? | getData()
validated payload | + +## Anyof1BoxedString +data class Anyof1BoxedString
+implements [Anyof1Boxed](#anyof1boxed) + +data class that stores validated String payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| Anyof1BoxedString(String data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| String | data()
validated payload | +| Any? | getData()
validated payload | + +## Anyof1BoxedList +data class Anyof1BoxedList
+implements [Anyof1Boxed](#anyof1boxed) + +data class that stores validated List payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| Anyof1BoxedList(FrozenList data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| FrozenList | data()
validated payload | +| Any? | getData()
validated payload | + +## Anyof1BoxedMap +data class Anyof1BoxedMap
+implements [Anyof1Boxed](#anyof1boxed) + +data class that stores validated Map payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| Anyof1BoxedMap(FrozenMap data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| FrozenMap | data()
validated payload | +| Any? | getData()
validated payload | + +## Anyof1 +class Anyof1
+extends JsonSchema + +A schema class that validates payloads + +### Field Summary +| Modifier and Type | Field and Description | +| ----------------- | ---------------------- | +| List> | anyOf = listOf(
    [Schema0::class.java](#schema0),
    [Schema1::class.java](#schema1)
)
| + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| String | validate(arg: String, configuration: SchemaConfiguration) | +| Nothing? | validate(arg: Nothing?, configuration: SchemaConfiguration) | +| int | validate(arg: int, configuration: SchemaConfiguration) | +| long | validate(arg: long, configuration: SchemaConfiguration) | +| float | validate(arg: float, configuration: SchemaConfiguration) | +| double | validate(arg: double, configuration: SchemaConfiguration) | +| Number | validate(arg: Number, configuration: SchemaConfiguration) | +| boolean | validate(arg: boolean, configuration: SchemaConfiguration) | +| FrozenMap | validate(arg: Map<?, ?>, configuration: SchemaConfiguration) | +| FrozenList | validate(arg: List<*>, configuration: SchemaConfiguration) | +| [Anyof1BoxedString](#anyof1boxedstring) | validateAndBox(String, configuration: SchemaConfiguration) | +| [Anyof1BoxedVoid](#anyof1boxedvoid) | validateAndBox(Nothing?, configuration: SchemaConfiguration) | +| [Anyof1BoxedNumber](#anyof1boxednumber) | validateAndBox(Number, configuration: SchemaConfiguration) | +| [Anyof1BoxedBoolean](#anyof1boxedboolean) | validateAndBox(boolean, configuration: SchemaConfiguration) | +| [Anyof1BoxedMap](#anyof1boxedmap) | validateAndBox(Map<?, ?>, configuration: SchemaConfiguration) | +| [Anyof1BoxedList](#anyof1boxedlist) | validateAndBox(List<*>, configuration: SchemaConfiguration) | +| [Anyof1Boxed](#anyof1boxed) | validateAndBox(Any?, configuration: SchemaConfiguration) | +| Any? | validate(arg: Any?, configuration: SchemaConfiguration) | + +## Schema1Boxed +sealed interface Schema1Boxed
+permits
+[Schema1BoxedVoid](#schema1boxedvoid), +[Schema1BoxedBoolean](#schema1boxedboolean), +[Schema1BoxedNumber](#schema1boxednumber), +[Schema1BoxedString](#schema1boxedstring), +[Schema1BoxedList](#schema1boxedlist), +[Schema1BoxedMap](#schema1boxedmap) + +sealed interface that stores validated payloads using boxed classes + +## Schema1BoxedVoid +data class Schema1BoxedVoid
+implements [Schema1Boxed](#schema1boxed) + +data class that stores validated null payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| Schema1BoxedVoid(Nothing? data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| Nothing? | data()
validated payload | +| Any? | getData()
validated payload | + +## Schema1BoxedBoolean +data class Schema1BoxedBoolean
+implements [Schema1Boxed](#schema1boxed) + +record that stores validated boolean payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| Schema1BoxedBoolean(boolean data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| boolean | data()
validated payload | +| Any? | getData()
validated payload | + +## Schema1BoxedNumber +data class Schema1BoxedNumber
+implements [Schema1Boxed](#schema1boxed) + +data class that stores validated Number payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| Schema1BoxedNumber(Number data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| Number | data()
validated payload | +| Any? | getData()
validated payload | + +## Schema1BoxedString +data class Schema1BoxedString
+implements [Schema1Boxed](#schema1boxed) + +data class that stores validated String payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| Schema1BoxedString(String data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| String | data()
validated payload | +| Any? | getData()
validated payload | + +## Schema1BoxedList +data class Schema1BoxedList
+implements [Schema1Boxed](#schema1boxed) + +data class that stores validated List payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| Schema1BoxedList(FrozenList data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| FrozenList | data()
validated payload | +| Any? | getData()
validated payload | + +## Schema1BoxedMap +data class Schema1BoxedMap
+implements [Schema1Boxed](#schema1boxed) + +data class that stores validated Map payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| Schema1BoxedMap(FrozenMap data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| FrozenMap | data()
validated payload | +| Any? | getData()
validated payload | + +## Schema1 +class Schema1
+extends JsonSchema + +A schema class that validates payloads + +### Field Summary +| Modifier and Type | Field and Description | +| ----------------- | ---------------------- | +| Number | minimum = 2 | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| String | validate(arg: String, configuration: SchemaConfiguration) | +| Nothing? | validate(arg: Nothing?, configuration: SchemaConfiguration) | +| int | validate(arg: int, configuration: SchemaConfiguration) | +| long | validate(arg: long, configuration: SchemaConfiguration) | +| float | validate(arg: float, configuration: SchemaConfiguration) | +| double | validate(arg: double, configuration: SchemaConfiguration) | +| Number | validate(arg: Number, configuration: SchemaConfiguration) | +| boolean | validate(arg: boolean, configuration: SchemaConfiguration) | +| FrozenMap | validate(arg: Map<?, ?>, configuration: SchemaConfiguration) | +| FrozenList | validate(arg: List<*>, configuration: SchemaConfiguration) | +| [Schema1BoxedString](#schema1boxedstring) | validateAndBox(String, configuration: SchemaConfiguration) | +| [Schema1BoxedVoid](#schema1boxedvoid) | validateAndBox(Nothing?, configuration: SchemaConfiguration) | +| [Schema1BoxedNumber](#schema1boxednumber) | validateAndBox(Number, configuration: SchemaConfiguration) | +| [Schema1BoxedBoolean](#schema1boxedboolean) | validateAndBox(boolean, configuration: SchemaConfiguration) | +| [Schema1BoxedMap](#schema1boxedmap) | validateAndBox(Map<?, ?>, configuration: SchemaConfiguration) | +| [Schema1BoxedList](#schema1boxedlist) | validateAndBox(List<*>, configuration: SchemaConfiguration) | +| [Schema1Boxed](#schema1boxed) | validateAndBox(Any?, configuration: SchemaConfiguration) | +| Any? | validate(arg: Any?, configuration: SchemaConfiguration) | + +## Schema0Boxed +sealed interface Schema0Boxed
+permits
+[Schema0BoxedNumber](#schema0boxednumber) + +sealed interface that stores validated payloads using boxed classes + +## Schema0BoxedNumber +data class Schema0BoxedNumber
+implements [Schema0Boxed](#schema0boxed) + +data class that stores validated Number payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| Schema0BoxedNumber(Number data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| Number | data()
validated payload | +| Any? | getData()
validated payload | + +## Schema0 +class Schema0
+extends IntJsonSchema.IntJsonSchema1 + +A schema class that validates payloads + +| Methods Inherited from class org.openapijsonschematools.client.schemas.IntJsonSchema.IntJsonSchema1 | +| ------------------------------------------------------------------ | +| validate | +| validateAndBox | + +[[Back to top]](#top) [[Back to Component Schemas]](../../../README.md#Component-Schemas) [[Back to README]](../../../README.md) diff --git a/samples/client/3_0_3_unit_test/kotlin/docs/components/schemas/AnyofComplexTypes.md b/samples/client/3_0_3_unit_test/kotlin/docs/components/schemas/AnyofComplexTypes.md new file mode 100644 index 00000000000..fa38731618a --- /dev/null +++ b/samples/client/3_0_3_unit_test/kotlin/docs/components/schemas/AnyofComplexTypes.md @@ -0,0 +1,674 @@ +# AnyofComplexTypes +org.openapijsonschematools.client.components.schemas.AnyofComplexTypes.java +class AnyofComplexTypes
+ +A class that contains necessary nested +- schema classes (which validate payloads), extends JsonSchema +- sealed interfaces which store validated payloads, Kotlin version of a sum type +- boxed classes which store validated payloads, sealed permits class implementations +- classes to store validated map payloads, extends FrozenMap +- classes to build inputs for map payloads + +## Nested Class Summary +| Modifier and Type | Class and Description | +| ----------------- | ---------------------- | +| sealed interface | [AnyofComplexTypes.AnyofComplexTypes1Boxed](#anyofcomplextypes1boxed)
sealed interface for validated payloads | +| record | [AnyofComplexTypes.AnyofComplexTypes1BoxedVoid](#anyofcomplextypes1boxedvoid)
boxed class to store validated null payloads | +| record | [AnyofComplexTypes.AnyofComplexTypes1BoxedBoolean](#anyofcomplextypes1boxedboolean)
boxed class to store validated boolean payloads | +| record | [AnyofComplexTypes.AnyofComplexTypes1BoxedNumber](#anyofcomplextypes1boxednumber)
boxed class to store validated Number payloads | +| record | [AnyofComplexTypes.AnyofComplexTypes1BoxedString](#anyofcomplextypes1boxedstring)
boxed class to store validated String payloads | +| record | [AnyofComplexTypes.AnyofComplexTypes1BoxedList](#anyofcomplextypes1boxedlist)
boxed class to store validated List payloads | +| record | [AnyofComplexTypes.AnyofComplexTypes1BoxedMap](#anyofcomplextypes1boxedmap)
boxed class to store validated Map payloads | +| static class | [AnyofComplexTypes.AnyofComplexTypes1](#anyofcomplextypes1)
schema class | +| sealed interface | [AnyofComplexTypes.Schema1Boxed](#schema1boxed)
sealed interface for validated payloads | +| record | [AnyofComplexTypes.Schema1BoxedVoid](#schema1boxedvoid)
boxed class to store validated null payloads | +| record | [AnyofComplexTypes.Schema1BoxedBoolean](#schema1boxedboolean)
boxed class to store validated boolean payloads | +| record | [AnyofComplexTypes.Schema1BoxedNumber](#schema1boxednumber)
boxed class to store validated Number payloads | +| record | [AnyofComplexTypes.Schema1BoxedString](#schema1boxedstring)
boxed class to store validated String payloads | +| record | [AnyofComplexTypes.Schema1BoxedList](#schema1boxedlist)
boxed class to store validated List payloads | +| record | [AnyofComplexTypes.Schema1BoxedMap](#schema1boxedmap)
boxed class to store validated Map payloads | +| static class | [AnyofComplexTypes.Schema1](#schema1)
schema class | +| static class | [AnyofComplexTypes.Schema1MapBuilder](#schema1mapbuilder)
builder for Map payloads | +| static class | [AnyofComplexTypes.Schema1Map](#schema1map)
output class for Map payloads | +| sealed interface | [AnyofComplexTypes.FooBoxed](#fooboxed)
sealed interface for validated payloads | +| record | [AnyofComplexTypes.FooBoxedString](#fooboxedstring)
boxed class to store validated String payloads | +| static class | [AnyofComplexTypes.Foo](#foo)
schema class | +| sealed interface | [AnyofComplexTypes.Schema0Boxed](#schema0boxed)
sealed interface for validated payloads | +| record | [AnyofComplexTypes.Schema0BoxedVoid](#schema0boxedvoid)
boxed class to store validated null payloads | +| record | [AnyofComplexTypes.Schema0BoxedBoolean](#schema0boxedboolean)
boxed class to store validated boolean payloads | +| record | [AnyofComplexTypes.Schema0BoxedNumber](#schema0boxednumber)
boxed class to store validated Number payloads | +| record | [AnyofComplexTypes.Schema0BoxedString](#schema0boxedstring)
boxed class to store validated String payloads | +| record | [AnyofComplexTypes.Schema0BoxedList](#schema0boxedlist)
boxed class to store validated List payloads | +| record | [AnyofComplexTypes.Schema0BoxedMap](#schema0boxedmap)
boxed class to store validated Map payloads | +| static class | [AnyofComplexTypes.Schema0](#schema0)
schema class | +| static class | [AnyofComplexTypes.Schema0MapBuilder](#schema0mapbuilder)
builder for Map payloads | +| static class | [AnyofComplexTypes.Schema0Map](#schema0map)
output class for Map payloads | +| sealed interface | [AnyofComplexTypes.BarBoxed](#barboxed)
sealed interface for validated payloads | +| record | [AnyofComplexTypes.BarBoxedNumber](#barboxednumber)
boxed class to store validated Number payloads | +| static class | [AnyofComplexTypes.Bar](#bar)
schema class | + +## AnyofComplexTypes1Boxed +sealed interface AnyofComplexTypes1Boxed
+permits
+[AnyofComplexTypes1BoxedVoid](#anyofcomplextypes1boxedvoid), +[AnyofComplexTypes1BoxedBoolean](#anyofcomplextypes1boxedboolean), +[AnyofComplexTypes1BoxedNumber](#anyofcomplextypes1boxednumber), +[AnyofComplexTypes1BoxedString](#anyofcomplextypes1boxedstring), +[AnyofComplexTypes1BoxedList](#anyofcomplextypes1boxedlist), +[AnyofComplexTypes1BoxedMap](#anyofcomplextypes1boxedmap) + +sealed interface that stores validated payloads using boxed classes + +## AnyofComplexTypes1BoxedVoid +data class AnyofComplexTypes1BoxedVoid
+implements [AnyofComplexTypes1Boxed](#anyofcomplextypes1boxed) + +data class that stores validated null payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| AnyofComplexTypes1BoxedVoid(Nothing? data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| Nothing? | data()
validated payload | +| Any? | getData()
validated payload | + +## AnyofComplexTypes1BoxedBoolean +data class AnyofComplexTypes1BoxedBoolean
+implements [AnyofComplexTypes1Boxed](#anyofcomplextypes1boxed) + +record that stores validated boolean payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| AnyofComplexTypes1BoxedBoolean(boolean data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| boolean | data()
validated payload | +| Any? | getData()
validated payload | + +## AnyofComplexTypes1BoxedNumber +data class AnyofComplexTypes1BoxedNumber
+implements [AnyofComplexTypes1Boxed](#anyofcomplextypes1boxed) + +data class that stores validated Number payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| AnyofComplexTypes1BoxedNumber(Number data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| Number | data()
validated payload | +| Any? | getData()
validated payload | + +## AnyofComplexTypes1BoxedString +data class AnyofComplexTypes1BoxedString
+implements [AnyofComplexTypes1Boxed](#anyofcomplextypes1boxed) + +data class that stores validated String payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| AnyofComplexTypes1BoxedString(String data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| String | data()
validated payload | +| Any? | getData()
validated payload | + +## AnyofComplexTypes1BoxedList +data class AnyofComplexTypes1BoxedList
+implements [AnyofComplexTypes1Boxed](#anyofcomplextypes1boxed) + +data class that stores validated List payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| AnyofComplexTypes1BoxedList(FrozenList data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| FrozenList | data()
validated payload | +| Any? | getData()
validated payload | + +## AnyofComplexTypes1BoxedMap +data class AnyofComplexTypes1BoxedMap
+implements [AnyofComplexTypes1Boxed](#anyofcomplextypes1boxed) + +data class that stores validated Map payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| AnyofComplexTypes1BoxedMap(FrozenMap data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| FrozenMap | data()
validated payload | +| Any? | getData()
validated payload | + +## AnyofComplexTypes1 +class AnyofComplexTypes1
+extends JsonSchema + +A schema class that validates payloads + +### Field Summary +| Modifier and Type | Field and Description | +| ----------------- | ---------------------- | +| List> | anyOf = listOf(
    [Schema0::class.java](#schema0),
    [Schema1::class.java](#schema1)
)
| + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| String | validate(arg: String, configuration: SchemaConfiguration) | +| Nothing? | validate(arg: Nothing?, configuration: SchemaConfiguration) | +| int | validate(arg: int, configuration: SchemaConfiguration) | +| long | validate(arg: long, configuration: SchemaConfiguration) | +| float | validate(arg: float, configuration: SchemaConfiguration) | +| double | validate(arg: double, configuration: SchemaConfiguration) | +| Number | validate(arg: Number, configuration: SchemaConfiguration) | +| boolean | validate(arg: boolean, configuration: SchemaConfiguration) | +| FrozenMap | validate(arg: Map<?, ?>, configuration: SchemaConfiguration) | +| FrozenList | validate(arg: List<*>, configuration: SchemaConfiguration) | +| [AnyofComplexTypes1BoxedString](#anyofcomplextypes1boxedstring) | validateAndBox(String, configuration: SchemaConfiguration) | +| [AnyofComplexTypes1BoxedVoid](#anyofcomplextypes1boxedvoid) | validateAndBox(Nothing?, configuration: SchemaConfiguration) | +| [AnyofComplexTypes1BoxedNumber](#anyofcomplextypes1boxednumber) | validateAndBox(Number, configuration: SchemaConfiguration) | +| [AnyofComplexTypes1BoxedBoolean](#anyofcomplextypes1boxedboolean) | validateAndBox(boolean, configuration: SchemaConfiguration) | +| [AnyofComplexTypes1BoxedMap](#anyofcomplextypes1boxedmap) | validateAndBox(Map<?, ?>, configuration: SchemaConfiguration) | +| [AnyofComplexTypes1BoxedList](#anyofcomplextypes1boxedlist) | validateAndBox(List<*>, configuration: SchemaConfiguration) | +| [AnyofComplexTypes1Boxed](#anyofcomplextypes1boxed) | validateAndBox(Any?, configuration: SchemaConfiguration) | +| Any? | validate(arg: Any?, configuration: SchemaConfiguration) | + +## Schema1Boxed +sealed interface Schema1Boxed
+permits
+[Schema1BoxedVoid](#schema1boxedvoid), +[Schema1BoxedBoolean](#schema1boxedboolean), +[Schema1BoxedNumber](#schema1boxednumber), +[Schema1BoxedString](#schema1boxedstring), +[Schema1BoxedList](#schema1boxedlist), +[Schema1BoxedMap](#schema1boxedmap) + +sealed interface that stores validated payloads using boxed classes + +## Schema1BoxedVoid +data class Schema1BoxedVoid
+implements [Schema1Boxed](#schema1boxed) + +data class that stores validated null payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| Schema1BoxedVoid(Nothing? data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| Nothing? | data()
validated payload | +| Any? | getData()
validated payload | + +## Schema1BoxedBoolean +data class Schema1BoxedBoolean
+implements [Schema1Boxed](#schema1boxed) + +record that stores validated boolean payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| Schema1BoxedBoolean(boolean data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| boolean | data()
validated payload | +| Any? | getData()
validated payload | + +## Schema1BoxedNumber +data class Schema1BoxedNumber
+implements [Schema1Boxed](#schema1boxed) + +data class that stores validated Number payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| Schema1BoxedNumber(Number data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| Number | data()
validated payload | +| Any? | getData()
validated payload | + +## Schema1BoxedString +data class Schema1BoxedString
+implements [Schema1Boxed](#schema1boxed) + +data class that stores validated String payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| Schema1BoxedString(String data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| String | data()
validated payload | +| Any? | getData()
validated payload | + +## Schema1BoxedList +data class Schema1BoxedList
+implements [Schema1Boxed](#schema1boxed) + +data class that stores validated List payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| Schema1BoxedList(FrozenList data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| FrozenList | data()
validated payload | +| Any? | getData()
validated payload | + +## Schema1BoxedMap +data class Schema1BoxedMap
+implements [Schema1Boxed](#schema1boxed) + +data class that stores validated Map payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| Schema1BoxedMap([Schema1Map](#schema1map) data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| [Schema1Map](#schema1map) | data()
validated payload | +| Any? | getData()
validated payload | + +## Schema1 +class Schema1
+extends JsonSchema + +A schema class that validates payloads + +### Field Summary +| Modifier and Type | Field and Description | +| ----------------- | ---------------------- | +| Map> | properties = mapOf(
    "foo" to [Foo::class.java](#foo))
)
| +| Set | required = setOf(
    "foo"
)
| + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| String | validate(arg: String, configuration: SchemaConfiguration) | +| Nothing? | validate(arg: Nothing?, configuration: SchemaConfiguration) | +| int | validate(arg: int, configuration: SchemaConfiguration) | +| long | validate(arg: long, configuration: SchemaConfiguration) | +| float | validate(arg: float, configuration: SchemaConfiguration) | +| double | validate(arg: double, configuration: SchemaConfiguration) | +| Number | validate(arg: Number, configuration: SchemaConfiguration) | +| boolean | validate(arg: boolean, configuration: SchemaConfiguration) | +| [Schema1Map](#schema1map) | validate(arg: [Map<?, ?>](#schema1mapbuilder), configuration: SchemaConfiguration) | +| FrozenList | validate(arg: List<*>, configuration: SchemaConfiguration) | +| [Schema1BoxedString](#schema1boxedstring) | validateAndBox(String, configuration: SchemaConfiguration) | +| [Schema1BoxedVoid](#schema1boxedvoid) | validateAndBox(Nothing?, configuration: SchemaConfiguration) | +| [Schema1BoxedNumber](#schema1boxednumber) | validateAndBox(Number, configuration: SchemaConfiguration) | +| [Schema1BoxedBoolean](#schema1boxedboolean) | validateAndBox(boolean, configuration: SchemaConfiguration) | +| [Schema1BoxedMap](#schema1boxedmap) | validateAndBox([Map<?, ?>](#schema1mapbuilder), configuration: SchemaConfiguration) | +| [Schema1BoxedList](#schema1boxedlist) | validateAndBox(List<*>, configuration: SchemaConfiguration) | +| [Schema1Boxed](#schema1boxed) | validateAndBox(Any?, configuration: SchemaConfiguration) | +| Any? | validate(arg: Any?, configuration: SchemaConfiguration) | + +## Schema1Map0Builder +class Schema1Map0Builder
+builder for `Map` + +A class that builds the Map input type + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| Schema1Map0Builder(Map instance)
Creates a builder that contains the passed instance | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| Map | build()
Returns map input that should be used with Schema.validate | +| [Schema1Map0Builder](#schema1map0builder) | additionalProperty(key: String, value: Nothing?) | +| [Schema1Map0Builder](#schema1map0builder) | additionalProperty(key: String, value: Boolean) | +| [Schema1Map0Builder](#schema1map0builder) | additionalProperty(key: String, value: String) | +| [Schema1Map0Builder](#schema1map0builder) | additionalProperty(key: String, value: Int) | +| [Schema1Map0Builder](#schema1map0builder) | additionalProperty(key: String, value: Float) | +| [Schema1Map0Builder](#schema1map0builder) | additionalProperty(key: String, value: Long) | +| [Schema1Map0Builder](#schema1map0builder) | additionalProperty(key: String, value: Double) | +| [Schema1Map0Builder](#schema1map0builder) | additionalProperty(key: String, value: List) | +| [Schema1Map0Builder](#schema1map0builder) | additionalProperty(key: String, value: Map) | + +## Schema1MapBuilder +class Schema1MapBuilder
+builder for `Map` + +A class that builds the Map input type + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| Schema1MapBuilder()
Creates a builder that contains an empty map | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| [Schema1Map0Builder](#schema1map0builder) | foo(value: String) | + +## Schema1Map +class Schema1Map
+extends FrozenMap + +A class to store validated Map payloads + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| static [Schema1Map](#schema1map) | of([Map](#schema1mapbuilder) arg, SchemaConfiguration configuration) | +| String | foo()
| +| Any? | getAdditionalProperty(String name)
provides type safety for additional properties | + +## FooBoxed +sealed interface FooBoxed
+permits
+[FooBoxedString](#fooboxedstring) + +sealed interface that stores validated payloads using boxed classes + +## FooBoxedString +data class FooBoxedString
+implements [FooBoxed](#fooboxed) + +data class that stores validated String payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| FooBoxedString(String data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| String | data()
validated payload | +| Any? | getData()
validated payload | + +## Foo +class Foo
+extends StringJsonSchema.StringJsonSchema1 + +A schema class that validates payloads + +| Methods Inherited from class org.openapijsonschematools.client.schemas.StringJsonSchema.StringJsonSchema1 | +| ------------------------------------------------------------------ | +| validate | +| validateAndBox | + +## Schema0Boxed +sealed interface Schema0Boxed
+permits
+[Schema0BoxedVoid](#schema0boxedvoid), +[Schema0BoxedBoolean](#schema0boxedboolean), +[Schema0BoxedNumber](#schema0boxednumber), +[Schema0BoxedString](#schema0boxedstring), +[Schema0BoxedList](#schema0boxedlist), +[Schema0BoxedMap](#schema0boxedmap) + +sealed interface that stores validated payloads using boxed classes + +## Schema0BoxedVoid +data class Schema0BoxedVoid
+implements [Schema0Boxed](#schema0boxed) + +data class that stores validated null payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| Schema0BoxedVoid(Nothing? data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| Nothing? | data()
validated payload | +| Any? | getData()
validated payload | + +## Schema0BoxedBoolean +data class Schema0BoxedBoolean
+implements [Schema0Boxed](#schema0boxed) + +record that stores validated boolean payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| Schema0BoxedBoolean(boolean data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| boolean | data()
validated payload | +| Any? | getData()
validated payload | + +## Schema0BoxedNumber +data class Schema0BoxedNumber
+implements [Schema0Boxed](#schema0boxed) + +data class that stores validated Number payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| Schema0BoxedNumber(Number data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| Number | data()
validated payload | +| Any? | getData()
validated payload | + +## Schema0BoxedString +data class Schema0BoxedString
+implements [Schema0Boxed](#schema0boxed) + +data class that stores validated String payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| Schema0BoxedString(String data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| String | data()
validated payload | +| Any? | getData()
validated payload | + +## Schema0BoxedList +data class Schema0BoxedList
+implements [Schema0Boxed](#schema0boxed) + +data class that stores validated List payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| Schema0BoxedList(FrozenList data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| FrozenList | data()
validated payload | +| Any? | getData()
validated payload | + +## Schema0BoxedMap +data class Schema0BoxedMap
+implements [Schema0Boxed](#schema0boxed) + +data class that stores validated Map payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| Schema0BoxedMap([Schema0Map](#schema0map) data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| [Schema0Map](#schema0map) | data()
validated payload | +| Any? | getData()
validated payload | + +## Schema0 +class Schema0
+extends JsonSchema + +A schema class that validates payloads + +### Field Summary +| Modifier and Type | Field and Description | +| ----------------- | ---------------------- | +| Map> | properties = mapOf(
    "bar" to [Bar::class.java](#bar))
)
| +| Set | required = setOf(
    "bar"
)
| + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| String | validate(arg: String, configuration: SchemaConfiguration) | +| Nothing? | validate(arg: Nothing?, configuration: SchemaConfiguration) | +| int | validate(arg: int, configuration: SchemaConfiguration) | +| long | validate(arg: long, configuration: SchemaConfiguration) | +| float | validate(arg: float, configuration: SchemaConfiguration) | +| double | validate(arg: double, configuration: SchemaConfiguration) | +| Number | validate(arg: Number, configuration: SchemaConfiguration) | +| boolean | validate(arg: boolean, configuration: SchemaConfiguration) | +| [Schema0Map](#schema0map) | validate(arg: [Map<?, ?>](#schema0mapbuilder), configuration: SchemaConfiguration) | +| FrozenList | validate(arg: List<*>, configuration: SchemaConfiguration) | +| [Schema0BoxedString](#schema0boxedstring) | validateAndBox(String, configuration: SchemaConfiguration) | +| [Schema0BoxedVoid](#schema0boxedvoid) | validateAndBox(Nothing?, configuration: SchemaConfiguration) | +| [Schema0BoxedNumber](#schema0boxednumber) | validateAndBox(Number, configuration: SchemaConfiguration) | +| [Schema0BoxedBoolean](#schema0boxedboolean) | validateAndBox(boolean, configuration: SchemaConfiguration) | +| [Schema0BoxedMap](#schema0boxedmap) | validateAndBox([Map<?, ?>](#schema0mapbuilder), configuration: SchemaConfiguration) | +| [Schema0BoxedList](#schema0boxedlist) | validateAndBox(List<*>, configuration: SchemaConfiguration) | +| [Schema0Boxed](#schema0boxed) | validateAndBox(Any?, configuration: SchemaConfiguration) | +| Any? | validate(arg: Any?, configuration: SchemaConfiguration) | + +## Schema0Map0Builder +class Schema0Map0Builder
+builder for `Map` + +A class that builds the Map input type + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| Schema0Map0Builder(Map instance)
Creates a builder that contains the passed instance | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| Map | build()
Returns map input that should be used with Schema.validate | +| [Schema0Map0Builder](#schema0map0builder) | additionalProperty(key: String, value: Nothing?) | +| [Schema0Map0Builder](#schema0map0builder) | additionalProperty(key: String, value: Boolean) | +| [Schema0Map0Builder](#schema0map0builder) | additionalProperty(key: String, value: String) | +| [Schema0Map0Builder](#schema0map0builder) | additionalProperty(key: String, value: Int) | +| [Schema0Map0Builder](#schema0map0builder) | additionalProperty(key: String, value: Float) | +| [Schema0Map0Builder](#schema0map0builder) | additionalProperty(key: String, value: Long) | +| [Schema0Map0Builder](#schema0map0builder) | additionalProperty(key: String, value: Double) | +| [Schema0Map0Builder](#schema0map0builder) | additionalProperty(key: String, value: List) | +| [Schema0Map0Builder](#schema0map0builder) | additionalProperty(key: String, value: Map) | + +## Schema0MapBuilder +class Schema0MapBuilder
+builder for `Map` + +A class that builds the Map input type + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| Schema0MapBuilder()
Creates a builder that contains an empty map | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| [Schema0Map0Builder](#schema0map0builder) | bar(value: Int) | +| [Schema0Map0Builder](#schema0map0builder) | bar(value: Float) | +| [Schema0Map0Builder](#schema0map0builder) | bar(value: Long) | +| [Schema0Map0Builder](#schema0map0builder) | bar(value: Double) | + +## Schema0Map +class Schema0Map
+extends FrozenMap + +A class to store validated Map payloads + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| static [Schema0Map](#schema0map) | of([Map](#schema0mapbuilder) arg, SchemaConfiguration configuration) | +| Number | bar()
| +| Any? | getAdditionalProperty(String name)
provides type safety for additional properties | + +## BarBoxed +sealed interface BarBoxed
+permits
+[BarBoxedNumber](#barboxednumber) + +sealed interface that stores validated payloads using boxed classes + +## BarBoxedNumber +data class BarBoxedNumber
+implements [BarBoxed](#barboxed) + +data class that stores validated Number payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| BarBoxedNumber(Number data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| Number | data()
validated payload | +| Any? | getData()
validated payload | + +## Bar +class Bar
+extends IntJsonSchema.IntJsonSchema1 + +A schema class that validates payloads + +| Methods Inherited from class org.openapijsonschematools.client.schemas.IntJsonSchema.IntJsonSchema1 | +| ------------------------------------------------------------------ | +| validate | +| validateAndBox | + +[[Back to top]](#top) [[Back to Component Schemas]](../../../README.md#Component-Schemas) [[Back to README]](../../../README.md) diff --git a/samples/client/3_0_3_unit_test/kotlin/docs/components/schemas/AnyofWithBaseSchema.md b/samples/client/3_0_3_unit_test/kotlin/docs/components/schemas/AnyofWithBaseSchema.md new file mode 100644 index 00000000000..d0175fa0d3d --- /dev/null +++ b/samples/client/3_0_3_unit_test/kotlin/docs/components/schemas/AnyofWithBaseSchema.md @@ -0,0 +1,394 @@ +# AnyofWithBaseSchema +org.openapijsonschematools.client.components.schemas.AnyofWithBaseSchema.java +class AnyofWithBaseSchema
+ +A class that contains necessary nested +- schema classes (which validate payloads), extends JsonSchema +- sealed interfaces which store validated payloads, Kotlin version of a sum type +- boxed classes which store validated payloads, sealed permits class implementations + +## Nested Class Summary +| Modifier and Type | Class and Description | +| ----------------- | ---------------------- | +| sealed interface | [AnyofWithBaseSchema.AnyofWithBaseSchema1Boxed](#anyofwithbaseschema1boxed)
sealed interface for validated payloads | +| record | [AnyofWithBaseSchema.AnyofWithBaseSchema1BoxedString](#anyofwithbaseschema1boxedstring)
boxed class to store validated String payloads | +| static class | [AnyofWithBaseSchema.AnyofWithBaseSchema1](#anyofwithbaseschema1)
schema class | +| sealed interface | [AnyofWithBaseSchema.Schema1Boxed](#schema1boxed)
sealed interface for validated payloads | +| record | [AnyofWithBaseSchema.Schema1BoxedVoid](#schema1boxedvoid)
boxed class to store validated null payloads | +| record | [AnyofWithBaseSchema.Schema1BoxedBoolean](#schema1boxedboolean)
boxed class to store validated boolean payloads | +| record | [AnyofWithBaseSchema.Schema1BoxedNumber](#schema1boxednumber)
boxed class to store validated Number payloads | +| record | [AnyofWithBaseSchema.Schema1BoxedString](#schema1boxedstring)
boxed class to store validated String payloads | +| record | [AnyofWithBaseSchema.Schema1BoxedList](#schema1boxedlist)
boxed class to store validated List payloads | +| record | [AnyofWithBaseSchema.Schema1BoxedMap](#schema1boxedmap)
boxed class to store validated Map payloads | +| static class | [AnyofWithBaseSchema.Schema1](#schema1)
schema class | +| sealed interface | [AnyofWithBaseSchema.Schema0Boxed](#schema0boxed)
sealed interface for validated payloads | +| record | [AnyofWithBaseSchema.Schema0BoxedVoid](#schema0boxedvoid)
boxed class to store validated null payloads | +| record | [AnyofWithBaseSchema.Schema0BoxedBoolean](#schema0boxedboolean)
boxed class to store validated boolean payloads | +| record | [AnyofWithBaseSchema.Schema0BoxedNumber](#schema0boxednumber)
boxed class to store validated Number payloads | +| record | [AnyofWithBaseSchema.Schema0BoxedString](#schema0boxedstring)
boxed class to store validated String payloads | +| record | [AnyofWithBaseSchema.Schema0BoxedList](#schema0boxedlist)
boxed class to store validated List payloads | +| record | [AnyofWithBaseSchema.Schema0BoxedMap](#schema0boxedmap)
boxed class to store validated Map payloads | +| static class | [AnyofWithBaseSchema.Schema0](#schema0)
schema class | + +## AnyofWithBaseSchema1Boxed +sealed interface AnyofWithBaseSchema1Boxed
+permits
+[AnyofWithBaseSchema1BoxedString](#anyofwithbaseschema1boxedstring) + +sealed interface that stores validated payloads using boxed classes + +## AnyofWithBaseSchema1BoxedString +data class AnyofWithBaseSchema1BoxedString
+implements [AnyofWithBaseSchema1Boxed](#anyofwithbaseschema1boxed) + +data class that stores validated String payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| AnyofWithBaseSchema1BoxedString(String data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| String | data()
validated payload | +| Any? | getData()
validated payload | + +## AnyofWithBaseSchema1 +class AnyofWithBaseSchema1
+extends JsonSchema + +A schema class that validates payloads + +### Code Sample +``` +import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags; +import org.openapijsonschematools.client.configurations.SchemaConfiguration; +import org.openapijsonschematools.client.exceptions.ValidationException; +import org.openapijsonschematools.client.schemas.validation.MapUtils; +import org.openapijsonschematools.client.schemas.validation.FrozenList; +import org.openapijsonschematools.client.schemas.validation.FrozenMap; +import org.openapijsonschematools.client.components.schemas.AnyofWithBaseSchema; + +import java.util.Arrays; +import java.util.List; +import java.util.AbstractMap; + +static final SchemaConfiguration configuration = new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().build()); + +// String validation +String validatedPayload = AnyofWithBaseSchema.AnyofWithBaseSchema1.validate( + "a", + configuration +); +``` + +### Field Summary +| Modifier and Type | Field and Description | +| ----------------- | ---------------------- | +| Set> | type = setOf(
    String::class.java
)
| +| List> | anyOf = listOf(
    [Schema0::class.java](#schema0),
    [Schema1::class.java](#schema1)
)
| + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| String | validate(arg: String, configuration: SchemaConfiguration) | +| [AnyofWithBaseSchema1BoxedString](#anyofwithbaseschema1boxedstring) | validateAndBox(String, configuration: SchemaConfiguration) | +| [AnyofWithBaseSchema1Boxed](#anyofwithbaseschema1boxed) | validateAndBox(Any?, configuration: SchemaConfiguration) | +| Any? | validate(arg: Any?, configuration: SchemaConfiguration) | + +## Schema1Boxed +sealed interface Schema1Boxed
+permits
+[Schema1BoxedVoid](#schema1boxedvoid), +[Schema1BoxedBoolean](#schema1boxedboolean), +[Schema1BoxedNumber](#schema1boxednumber), +[Schema1BoxedString](#schema1boxedstring), +[Schema1BoxedList](#schema1boxedlist), +[Schema1BoxedMap](#schema1boxedmap) + +sealed interface that stores validated payloads using boxed classes + +## Schema1BoxedVoid +data class Schema1BoxedVoid
+implements [Schema1Boxed](#schema1boxed) + +data class that stores validated null payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| Schema1BoxedVoid(Nothing? data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| Nothing? | data()
validated payload | +| Any? | getData()
validated payload | + +## Schema1BoxedBoolean +data class Schema1BoxedBoolean
+implements [Schema1Boxed](#schema1boxed) + +record that stores validated boolean payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| Schema1BoxedBoolean(boolean data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| boolean | data()
validated payload | +| Any? | getData()
validated payload | + +## Schema1BoxedNumber +data class Schema1BoxedNumber
+implements [Schema1Boxed](#schema1boxed) + +data class that stores validated Number payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| Schema1BoxedNumber(Number data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| Number | data()
validated payload | +| Any? | getData()
validated payload | + +## Schema1BoxedString +data class Schema1BoxedString
+implements [Schema1Boxed](#schema1boxed) + +data class that stores validated String payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| Schema1BoxedString(String data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| String | data()
validated payload | +| Any? | getData()
validated payload | + +## Schema1BoxedList +data class Schema1BoxedList
+implements [Schema1Boxed](#schema1boxed) + +data class that stores validated List payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| Schema1BoxedList(FrozenList data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| FrozenList | data()
validated payload | +| Any? | getData()
validated payload | + +## Schema1BoxedMap +data class Schema1BoxedMap
+implements [Schema1Boxed](#schema1boxed) + +data class that stores validated Map payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| Schema1BoxedMap(FrozenMap data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| FrozenMap | data()
validated payload | +| Any? | getData()
validated payload | + +## Schema1 +class Schema1
+extends JsonSchema + +A schema class that validates payloads + +### Field Summary +| Modifier and Type | Field and Description | +| ----------------- | ---------------------- | +| Integer | minLength = 4 | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| String | validate(arg: String, configuration: SchemaConfiguration) | +| Nothing? | validate(arg: Nothing?, configuration: SchemaConfiguration) | +| int | validate(arg: int, configuration: SchemaConfiguration) | +| long | validate(arg: long, configuration: SchemaConfiguration) | +| float | validate(arg: float, configuration: SchemaConfiguration) | +| double | validate(arg: double, configuration: SchemaConfiguration) | +| Number | validate(arg: Number, configuration: SchemaConfiguration) | +| boolean | validate(arg: boolean, configuration: SchemaConfiguration) | +| FrozenMap | validate(arg: Map<?, ?>, configuration: SchemaConfiguration) | +| FrozenList | validate(arg: List<*>, configuration: SchemaConfiguration) | +| [Schema1BoxedString](#schema1boxedstring) | validateAndBox(String, configuration: SchemaConfiguration) | +| [Schema1BoxedVoid](#schema1boxedvoid) | validateAndBox(Nothing?, configuration: SchemaConfiguration) | +| [Schema1BoxedNumber](#schema1boxednumber) | validateAndBox(Number, configuration: SchemaConfiguration) | +| [Schema1BoxedBoolean](#schema1boxedboolean) | validateAndBox(boolean, configuration: SchemaConfiguration) | +| [Schema1BoxedMap](#schema1boxedmap) | validateAndBox(Map<?, ?>, configuration: SchemaConfiguration) | +| [Schema1BoxedList](#schema1boxedlist) | validateAndBox(List<*>, configuration: SchemaConfiguration) | +| [Schema1Boxed](#schema1boxed) | validateAndBox(Any?, configuration: SchemaConfiguration) | +| Any? | validate(arg: Any?, configuration: SchemaConfiguration) | + +## Schema0Boxed +sealed interface Schema0Boxed
+permits
+[Schema0BoxedVoid](#schema0boxedvoid), +[Schema0BoxedBoolean](#schema0boxedboolean), +[Schema0BoxedNumber](#schema0boxednumber), +[Schema0BoxedString](#schema0boxedstring), +[Schema0BoxedList](#schema0boxedlist), +[Schema0BoxedMap](#schema0boxedmap) + +sealed interface that stores validated payloads using boxed classes + +## Schema0BoxedVoid +data class Schema0BoxedVoid
+implements [Schema0Boxed](#schema0boxed) + +data class that stores validated null payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| Schema0BoxedVoid(Nothing? data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| Nothing? | data()
validated payload | +| Any? | getData()
validated payload | + +## Schema0BoxedBoolean +data class Schema0BoxedBoolean
+implements [Schema0Boxed](#schema0boxed) + +record that stores validated boolean payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| Schema0BoxedBoolean(boolean data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| boolean | data()
validated payload | +| Any? | getData()
validated payload | + +## Schema0BoxedNumber +data class Schema0BoxedNumber
+implements [Schema0Boxed](#schema0boxed) + +data class that stores validated Number payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| Schema0BoxedNumber(Number data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| Number | data()
validated payload | +| Any? | getData()
validated payload | + +## Schema0BoxedString +data class Schema0BoxedString
+implements [Schema0Boxed](#schema0boxed) + +data class that stores validated String payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| Schema0BoxedString(String data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| String | data()
validated payload | +| Any? | getData()
validated payload | + +## Schema0BoxedList +data class Schema0BoxedList
+implements [Schema0Boxed](#schema0boxed) + +data class that stores validated List payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| Schema0BoxedList(FrozenList data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| FrozenList | data()
validated payload | +| Any? | getData()
validated payload | + +## Schema0BoxedMap +data class Schema0BoxedMap
+implements [Schema0Boxed](#schema0boxed) + +data class that stores validated Map payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| Schema0BoxedMap(FrozenMap data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| FrozenMap | data()
validated payload | +| Any? | getData()
validated payload | + +## Schema0 +class Schema0
+extends JsonSchema + +A schema class that validates payloads + +### Field Summary +| Modifier and Type | Field and Description | +| ----------------- | ---------------------- | +| Integer | maxLength = 2 | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| String | validate(arg: String, configuration: SchemaConfiguration) | +| Nothing? | validate(arg: Nothing?, configuration: SchemaConfiguration) | +| int | validate(arg: int, configuration: SchemaConfiguration) | +| long | validate(arg: long, configuration: SchemaConfiguration) | +| float | validate(arg: float, configuration: SchemaConfiguration) | +| double | validate(arg: double, configuration: SchemaConfiguration) | +| Number | validate(arg: Number, configuration: SchemaConfiguration) | +| boolean | validate(arg: boolean, configuration: SchemaConfiguration) | +| FrozenMap | validate(arg: Map<?, ?>, configuration: SchemaConfiguration) | +| FrozenList | validate(arg: List<*>, configuration: SchemaConfiguration) | +| [Schema0BoxedString](#schema0boxedstring) | validateAndBox(String, configuration: SchemaConfiguration) | +| [Schema0BoxedVoid](#schema0boxedvoid) | validateAndBox(Nothing?, configuration: SchemaConfiguration) | +| [Schema0BoxedNumber](#schema0boxednumber) | validateAndBox(Number, configuration: SchemaConfiguration) | +| [Schema0BoxedBoolean](#schema0boxedboolean) | validateAndBox(boolean, configuration: SchemaConfiguration) | +| [Schema0BoxedMap](#schema0boxedmap) | validateAndBox(Map<?, ?>, configuration: SchemaConfiguration) | +| [Schema0BoxedList](#schema0boxedlist) | validateAndBox(List<*>, configuration: SchemaConfiguration) | +| [Schema0Boxed](#schema0boxed) | validateAndBox(Any?, configuration: SchemaConfiguration) | +| Any? | validate(arg: Any?, configuration: SchemaConfiguration) | + +[[Back to top]](#top) [[Back to Component Schemas]](../../../README.md#Component-Schemas) [[Back to README]](../../../README.md) diff --git a/samples/client/3_0_3_unit_test/kotlin/docs/components/schemas/AnyofWithOneEmptySchema.md b/samples/client/3_0_3_unit_test/kotlin/docs/components/schemas/AnyofWithOneEmptySchema.md new file mode 100644 index 00000000000..9dacfd34348 --- /dev/null +++ b/samples/client/3_0_3_unit_test/kotlin/docs/components/schemas/AnyofWithOneEmptySchema.md @@ -0,0 +1,340 @@ +# AnyofWithOneEmptySchema +org.openapijsonschematools.client.components.schemas.AnyofWithOneEmptySchema.java +class AnyofWithOneEmptySchema
+ +A class that contains necessary nested +- schema classes (which validate payloads), extends JsonSchema +- sealed interfaces which store validated payloads, Kotlin version of a sum type +- boxed classes which store validated payloads, sealed permits class implementations + +## Nested Class Summary +| Modifier and Type | Class and Description | +| ----------------- | ---------------------- | +| sealed interface | [AnyofWithOneEmptySchema.AnyofWithOneEmptySchema1Boxed](#anyofwithoneemptyschema1boxed)
sealed interface for validated payloads | +| record | [AnyofWithOneEmptySchema.AnyofWithOneEmptySchema1BoxedVoid](#anyofwithoneemptyschema1boxedvoid)
boxed class to store validated null payloads | +| record | [AnyofWithOneEmptySchema.AnyofWithOneEmptySchema1BoxedBoolean](#anyofwithoneemptyschema1boxedboolean)
boxed class to store validated boolean payloads | +| record | [AnyofWithOneEmptySchema.AnyofWithOneEmptySchema1BoxedNumber](#anyofwithoneemptyschema1boxednumber)
boxed class to store validated Number payloads | +| record | [AnyofWithOneEmptySchema.AnyofWithOneEmptySchema1BoxedString](#anyofwithoneemptyschema1boxedstring)
boxed class to store validated String payloads | +| record | [AnyofWithOneEmptySchema.AnyofWithOneEmptySchema1BoxedList](#anyofwithoneemptyschema1boxedlist)
boxed class to store validated List payloads | +| record | [AnyofWithOneEmptySchema.AnyofWithOneEmptySchema1BoxedMap](#anyofwithoneemptyschema1boxedmap)
boxed class to store validated Map payloads | +| static class | [AnyofWithOneEmptySchema.AnyofWithOneEmptySchema1](#anyofwithoneemptyschema1)
schema class | +| sealed interface | [AnyofWithOneEmptySchema.Schema1Boxed](#schema1boxed)
sealed interface for validated payloads | +| record | [AnyofWithOneEmptySchema.Schema1BoxedVoid](#schema1boxedvoid)
boxed class to store validated null payloads | +| record | [AnyofWithOneEmptySchema.Schema1BoxedBoolean](#schema1boxedboolean)
boxed class to store validated boolean payloads | +| record | [AnyofWithOneEmptySchema.Schema1BoxedNumber](#schema1boxednumber)
boxed class to store validated Number payloads | +| record | [AnyofWithOneEmptySchema.Schema1BoxedString](#schema1boxedstring)
boxed class to store validated String payloads | +| record | [AnyofWithOneEmptySchema.Schema1BoxedList](#schema1boxedlist)
boxed class to store validated List payloads | +| record | [AnyofWithOneEmptySchema.Schema1BoxedMap](#schema1boxedmap)
boxed class to store validated Map payloads | +| static class | [AnyofWithOneEmptySchema.Schema1](#schema1)
schema class | +| sealed interface | [AnyofWithOneEmptySchema.Schema0Boxed](#schema0boxed)
sealed interface for validated payloads | +| record | [AnyofWithOneEmptySchema.Schema0BoxedNumber](#schema0boxednumber)
boxed class to store validated Number payloads | +| static class | [AnyofWithOneEmptySchema.Schema0](#schema0)
schema class | + +## AnyofWithOneEmptySchema1Boxed +sealed interface AnyofWithOneEmptySchema1Boxed
+permits
+[AnyofWithOneEmptySchema1BoxedVoid](#anyofwithoneemptyschema1boxedvoid), +[AnyofWithOneEmptySchema1BoxedBoolean](#anyofwithoneemptyschema1boxedboolean), +[AnyofWithOneEmptySchema1BoxedNumber](#anyofwithoneemptyschema1boxednumber), +[AnyofWithOneEmptySchema1BoxedString](#anyofwithoneemptyschema1boxedstring), +[AnyofWithOneEmptySchema1BoxedList](#anyofwithoneemptyschema1boxedlist), +[AnyofWithOneEmptySchema1BoxedMap](#anyofwithoneemptyschema1boxedmap) + +sealed interface that stores validated payloads using boxed classes + +## AnyofWithOneEmptySchema1BoxedVoid +data class AnyofWithOneEmptySchema1BoxedVoid
+implements [AnyofWithOneEmptySchema1Boxed](#anyofwithoneemptyschema1boxed) + +data class that stores validated null payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| AnyofWithOneEmptySchema1BoxedVoid(Nothing? data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| Nothing? | data()
validated payload | +| Any? | getData()
validated payload | + +## AnyofWithOneEmptySchema1BoxedBoolean +data class AnyofWithOneEmptySchema1BoxedBoolean
+implements [AnyofWithOneEmptySchema1Boxed](#anyofwithoneemptyschema1boxed) + +record that stores validated boolean payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| AnyofWithOneEmptySchema1BoxedBoolean(boolean data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| boolean | data()
validated payload | +| Any? | getData()
validated payload | + +## AnyofWithOneEmptySchema1BoxedNumber +data class AnyofWithOneEmptySchema1BoxedNumber
+implements [AnyofWithOneEmptySchema1Boxed](#anyofwithoneemptyschema1boxed) + +data class that stores validated Number payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| AnyofWithOneEmptySchema1BoxedNumber(Number data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| Number | data()
validated payload | +| Any? | getData()
validated payload | + +## AnyofWithOneEmptySchema1BoxedString +data class AnyofWithOneEmptySchema1BoxedString
+implements [AnyofWithOneEmptySchema1Boxed](#anyofwithoneemptyschema1boxed) + +data class that stores validated String payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| AnyofWithOneEmptySchema1BoxedString(String data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| String | data()
validated payload | +| Any? | getData()
validated payload | + +## AnyofWithOneEmptySchema1BoxedList +data class AnyofWithOneEmptySchema1BoxedList
+implements [AnyofWithOneEmptySchema1Boxed](#anyofwithoneemptyschema1boxed) + +data class that stores validated List payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| AnyofWithOneEmptySchema1BoxedList(FrozenList data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| FrozenList | data()
validated payload | +| Any? | getData()
validated payload | + +## AnyofWithOneEmptySchema1BoxedMap +data class AnyofWithOneEmptySchema1BoxedMap
+implements [AnyofWithOneEmptySchema1Boxed](#anyofwithoneemptyschema1boxed) + +data class that stores validated Map payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| AnyofWithOneEmptySchema1BoxedMap(FrozenMap data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| FrozenMap | data()
validated payload | +| Any? | getData()
validated payload | + +## AnyofWithOneEmptySchema1 +class AnyofWithOneEmptySchema1
+extends JsonSchema + +A schema class that validates payloads + +### Field Summary +| Modifier and Type | Field and Description | +| ----------------- | ---------------------- | +| List> | anyOf = listOf(
    [Schema0::class.java](#schema0),
    [Schema1::class.java](#schema1)
)
| + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| String | validate(arg: String, configuration: SchemaConfiguration) | +| Nothing? | validate(arg: Nothing?, configuration: SchemaConfiguration) | +| int | validate(arg: int, configuration: SchemaConfiguration) | +| long | validate(arg: long, configuration: SchemaConfiguration) | +| float | validate(arg: float, configuration: SchemaConfiguration) | +| double | validate(arg: double, configuration: SchemaConfiguration) | +| Number | validate(arg: Number, configuration: SchemaConfiguration) | +| boolean | validate(arg: boolean, configuration: SchemaConfiguration) | +| FrozenMap | validate(arg: Map<?, ?>, configuration: SchemaConfiguration) | +| FrozenList | validate(arg: List<*>, configuration: SchemaConfiguration) | +| [AnyofWithOneEmptySchema1BoxedString](#anyofwithoneemptyschema1boxedstring) | validateAndBox(String, configuration: SchemaConfiguration) | +| [AnyofWithOneEmptySchema1BoxedVoid](#anyofwithoneemptyschema1boxedvoid) | validateAndBox(Nothing?, configuration: SchemaConfiguration) | +| [AnyofWithOneEmptySchema1BoxedNumber](#anyofwithoneemptyschema1boxednumber) | validateAndBox(Number, configuration: SchemaConfiguration) | +| [AnyofWithOneEmptySchema1BoxedBoolean](#anyofwithoneemptyschema1boxedboolean) | validateAndBox(boolean, configuration: SchemaConfiguration) | +| [AnyofWithOneEmptySchema1BoxedMap](#anyofwithoneemptyschema1boxedmap) | validateAndBox(Map<?, ?>, configuration: SchemaConfiguration) | +| [AnyofWithOneEmptySchema1BoxedList](#anyofwithoneemptyschema1boxedlist) | validateAndBox(List<*>, configuration: SchemaConfiguration) | +| [AnyofWithOneEmptySchema1Boxed](#anyofwithoneemptyschema1boxed) | validateAndBox(Any?, configuration: SchemaConfiguration) | +| Any? | validate(arg: Any?, configuration: SchemaConfiguration) | + +## Schema1Boxed +sealed interface Schema1Boxed
+permits
+[Schema1BoxedVoid](#schema1boxedvoid), +[Schema1BoxedBoolean](#schema1boxedboolean), +[Schema1BoxedNumber](#schema1boxednumber), +[Schema1BoxedString](#schema1boxedstring), +[Schema1BoxedList](#schema1boxedlist), +[Schema1BoxedMap](#schema1boxedmap) + +sealed interface that stores validated payloads using boxed classes + +## Schema1BoxedVoid +data class Schema1BoxedVoid
+implements [Schema1Boxed](#schema1boxed) + +data class that stores validated null payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| Schema1BoxedVoid(Nothing? data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| Nothing? | data()
validated payload | +| Any? | getData()
validated payload | + +## Schema1BoxedBoolean +data class Schema1BoxedBoolean
+implements [Schema1Boxed](#schema1boxed) + +record that stores validated boolean payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| Schema1BoxedBoolean(boolean data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| boolean | data()
validated payload | +| Any? | getData()
validated payload | + +## Schema1BoxedNumber +data class Schema1BoxedNumber
+implements [Schema1Boxed](#schema1boxed) + +data class that stores validated Number payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| Schema1BoxedNumber(Number data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| Number | data()
validated payload | +| Any? | getData()
validated payload | + +## Schema1BoxedString +data class Schema1BoxedString
+implements [Schema1Boxed](#schema1boxed) + +data class that stores validated String payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| Schema1BoxedString(String data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| String | data()
validated payload | +| Any? | getData()
validated payload | + +## Schema1BoxedList +data class Schema1BoxedList
+implements [Schema1Boxed](#schema1boxed) + +data class that stores validated List payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| Schema1BoxedList(FrozenList data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| FrozenList | data()
validated payload | +| Any? | getData()
validated payload | + +## Schema1BoxedMap +data class Schema1BoxedMap
+implements [Schema1Boxed](#schema1boxed) + +data class that stores validated Map payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| Schema1BoxedMap(FrozenMap data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| FrozenMap | data()
validated payload | +| Any? | getData()
validated payload | + +## Schema1 +class Schema1
+extends AnyTypeJsonSchema.AnyTypeJsonSchema1 + +A schema class that validates payloads + +| Methods Inherited from class org.openapijsonschematools.client.schemas.AnyTypeJsonSchema.AnyTypeJsonSchema1 | +| ------------------------------------------------------------------ | +| validate | +| validateAndBox | + +## Schema0Boxed +sealed interface Schema0Boxed
+permits
+[Schema0BoxedNumber](#schema0boxednumber) + +sealed interface that stores validated payloads using boxed classes + +## Schema0BoxedNumber +data class Schema0BoxedNumber
+implements [Schema0Boxed](#schema0boxed) + +data class that stores validated Number payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| Schema0BoxedNumber(Number data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| Number | data()
validated payload | +| Any? | getData()
validated payload | + +## Schema0 +class Schema0
+extends NumberJsonSchema.NumberJsonSchema1 + +A schema class that validates payloads + +| Methods Inherited from class org.openapijsonschematools.client.schemas.NumberJsonSchema.NumberJsonSchema1 | +| ------------------------------------------------------------------ | +| validate | +| validateAndBox | + +[[Back to top]](#top) [[Back to Component Schemas]](../../../README.md#Component-Schemas) [[Back to README]](../../../README.md) diff --git a/samples/client/3_0_3_unit_test/kotlin/docs/components/schemas/ArrayTypeMatchesArrays.md b/samples/client/3_0_3_unit_test/kotlin/docs/components/schemas/ArrayTypeMatchesArrays.md new file mode 100644 index 00000000000..c59750a9d4d --- /dev/null +++ b/samples/client/3_0_3_unit_test/kotlin/docs/components/schemas/ArrayTypeMatchesArrays.md @@ -0,0 +1,260 @@ +# ArrayTypeMatchesArrays +org.openapijsonschematools.client.components.schemas.ArrayTypeMatchesArrays.java +class ArrayTypeMatchesArrays
+ +A class that contains necessary nested +- schema classes (which validate payloads), extends JsonSchema +- sealed interfaces which store validated payloads, Kotlin version of a sum type +- boxed classes which store validated payloads, sealed permits class implementations +- classes to store validated list payloads, extends FrozenList +- classes to build inputs for list payloads + +## Nested Class Summary +| Modifier and Type | Class and Description | +| ----------------- | ---------------------- | +| sealed interface | [ArrayTypeMatchesArrays.ArrayTypeMatchesArrays1Boxed](#arraytypematchesarrays1boxed)
sealed interface for validated payloads | +| record | [ArrayTypeMatchesArrays.ArrayTypeMatchesArrays1BoxedList](#arraytypematchesarrays1boxedlist)
boxed class to store validated List payloads | +| static class | [ArrayTypeMatchesArrays.ArrayTypeMatchesArrays1](#arraytypematchesarrays1)
schema class | +| static class | [ArrayTypeMatchesArrays.ArrayTypeMatchesArraysListBuilder](#arraytypematchesarrayslistbuilder)
builder for List payloads | +| static class | [ArrayTypeMatchesArrays.ArrayTypeMatchesArraysList](#arraytypematchesarrayslist)
output class for List payloads | +| sealed interface | [ArrayTypeMatchesArrays.ItemsBoxed](#itemsboxed)
sealed interface for validated payloads | +| record | [ArrayTypeMatchesArrays.ItemsBoxedVoid](#itemsboxedvoid)
boxed class to store validated null payloads | +| record | [ArrayTypeMatchesArrays.ItemsBoxedBoolean](#itemsboxedboolean)
boxed class to store validated boolean payloads | +| record | [ArrayTypeMatchesArrays.ItemsBoxedNumber](#itemsboxednumber)
boxed class to store validated Number payloads | +| record | [ArrayTypeMatchesArrays.ItemsBoxedString](#itemsboxedstring)
boxed class to store validated String payloads | +| record | [ArrayTypeMatchesArrays.ItemsBoxedList](#itemsboxedlist)
boxed class to store validated List payloads | +| record | [ArrayTypeMatchesArrays.ItemsBoxedMap](#itemsboxedmap)
boxed class to store validated Map payloads | +| static class | [ArrayTypeMatchesArrays.Items](#items)
schema class | + +## ArrayTypeMatchesArrays1Boxed +sealed interface ArrayTypeMatchesArrays1Boxed
+permits
+[ArrayTypeMatchesArrays1BoxedList](#arraytypematchesarrays1boxedlist) + +sealed interface that stores validated payloads using boxed classes + +## ArrayTypeMatchesArrays1BoxedList +data class ArrayTypeMatchesArrays1BoxedList
+implements [ArrayTypeMatchesArrays1Boxed](#arraytypematchesarrays1boxed) + +data class that stores validated List payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| ArrayTypeMatchesArrays1BoxedList([ArrayTypeMatchesArraysList](#arraytypematchesarrayslist) data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| [ArrayTypeMatchesArraysList](#arraytypematchesarrayslist) | data()
validated payload | +| Any? | getData()
validated payload | + +## ArrayTypeMatchesArrays1 +class ArrayTypeMatchesArrays1
+extends JsonSchema + +A schema class that validates payloads + +### Code Sample +``` +import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags; +import org.openapijsonschematools.client.configurations.SchemaConfiguration; +import org.openapijsonschematools.client.exceptions.ValidationException; +import org.openapijsonschematools.client.schemas.validation.MapUtils; +import org.openapijsonschematools.client.schemas.validation.FrozenList; +import org.openapijsonschematools.client.schemas.validation.FrozenMap; +import org.openapijsonschematools.client.components.schemas.ArrayTypeMatchesArrays; + +import java.util.Arrays; +import java.util.List; +import java.util.AbstractMap; + +static final SchemaConfiguration configuration = new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().build()); + +// List validation +ArrayTypeMatchesArrays.ArrayTypeMatchesArraysList validatedPayload = + ArrayTypeMatchesArrays.ArrayTypeMatchesArrays1.validate( + new ArrayTypeMatchesArrays.ArrayTypeMatchesArraysListBuilder() + .build(), + configuration +); +``` + +### Field Summary +| Modifier and Type | Field and Description | +| ----------------- | ---------------------- | +| Set> | type = setOf(List::class.java) | +| Class | items = [Items::class.java](#items) | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| [ArrayTypeMatchesArraysList](#arraytypematchesarrayslist) | validate(arg: [List<*>](#arraytypematchesarrayslistbuilder), configuration: SchemaConfiguration) | +| [ArrayTypeMatchesArrays1BoxedList](#arraytypematchesarrays1boxedlist) | validateAndBox([List<*>](#arraytypematchesarrayslistbuilder), configuration: SchemaConfiguration) | +| [ArrayTypeMatchesArrays1Boxed](#arraytypematchesarrays1boxed) | validateAndBox(Any?, configuration: SchemaConfiguration) | +| Any? | validate(arg: Any?, configuration: SchemaConfiguration) | + +## ArrayTypeMatchesArraysListBuilder +class ArrayTypeMatchesArraysListBuilder
+builder for `List` + +A class that builds the List input type + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| ArrayTypeMatchesArraysListBuilder()
Creates an empty list | +| ArrayTypeMatchesArraysListBuilder(List items)
Stores the items in a list | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| ArrayTypeMatchesArraysListBuilder | add(item: Nothing?) | +| ArrayTypeMatchesArraysListBuilder | add(item: Boolean) | +| ArrayTypeMatchesArraysListBuilder | add(item: String) | +| ArrayTypeMatchesArraysListBuilder | add(item: Int) | +| ArrayTypeMatchesArraysListBuilder | add(item: Float) | +| ArrayTypeMatchesArraysListBuilder | add(item: Long) | +| ArrayTypeMatchesArraysListBuilder | add(item: Double) | +| ArrayTypeMatchesArraysListBuilder | add(item: List) | +| ArrayTypeMatchesArraysListBuilder | add(item: Map) | +| List | build()
Returns list input that should be used with Schema.validate | + +## ArrayTypeMatchesArraysList +class ArrayTypeMatchesArraysList
+extends `FrozenList` + +A class to store validated List payloads + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| static [ArrayTypeMatchesArraysList](#arraytypematchesarrayslist) | of([List](#arraytypematchesarrayslistbuilder) arg, SchemaConfiguration configuration) | + +## ItemsBoxed +sealed interface ItemsBoxed
+permits
+[ItemsBoxedVoid](#itemsboxedvoid), +[ItemsBoxedBoolean](#itemsboxedboolean), +[ItemsBoxedNumber](#itemsboxednumber), +[ItemsBoxedString](#itemsboxedstring), +[ItemsBoxedList](#itemsboxedlist), +[ItemsBoxedMap](#itemsboxedmap) + +sealed interface that stores validated payloads using boxed classes + +## ItemsBoxedVoid +data class ItemsBoxedVoid
+implements [ItemsBoxed](#itemsboxed) + +data class that stores validated null payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| ItemsBoxedVoid(Nothing? data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| Nothing? | data()
validated payload | +| Any? | getData()
validated payload | + +## ItemsBoxedBoolean +data class ItemsBoxedBoolean
+implements [ItemsBoxed](#itemsboxed) + +record that stores validated boolean payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| ItemsBoxedBoolean(boolean data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| boolean | data()
validated payload | +| Any? | getData()
validated payload | + +## ItemsBoxedNumber +data class ItemsBoxedNumber
+implements [ItemsBoxed](#itemsboxed) + +data class that stores validated Number payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| ItemsBoxedNumber(Number data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| Number | data()
validated payload | +| Any? | getData()
validated payload | + +## ItemsBoxedString +data class ItemsBoxedString
+implements [ItemsBoxed](#itemsboxed) + +data class that stores validated String payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| ItemsBoxedString(String data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| String | data()
validated payload | +| Any? | getData()
validated payload | + +## ItemsBoxedList +data class ItemsBoxedList
+implements [ItemsBoxed](#itemsboxed) + +data class that stores validated List payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| ItemsBoxedList(FrozenList data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| FrozenList | data()
validated payload | +| Any? | getData()
validated payload | + +## ItemsBoxedMap +data class ItemsBoxedMap
+implements [ItemsBoxed](#itemsboxed) + +data class that stores validated Map payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| ItemsBoxedMap(FrozenMap data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| FrozenMap | data()
validated payload | +| Any? | getData()
validated payload | + +## Items +class Items
+extends AnyTypeJsonSchema.AnyTypeJsonSchema1 + +A schema class that validates payloads + +| Methods Inherited from class org.openapijsonschematools.client.schemas.AnyTypeJsonSchema.AnyTypeJsonSchema1 | +| ------------------------------------------------------------------ | +| validate | +| validateAndBox | + +[[Back to top]](#top) [[Back to Component Schemas]](../../../README.md#Component-Schemas) [[Back to README]](../../../README.md) diff --git a/samples/client/3_0_3_unit_test/kotlin/docs/components/schemas/BooleanTypeMatchesBooleans.md b/samples/client/3_0_3_unit_test/kotlin/docs/components/schemas/BooleanTypeMatchesBooleans.md new file mode 100644 index 00000000000..e64f7f92c4a --- /dev/null +++ b/samples/client/3_0_3_unit_test/kotlin/docs/components/schemas/BooleanTypeMatchesBooleans.md @@ -0,0 +1,52 @@ +# BooleanTypeMatchesBooleans +org.openapijsonschematools.client.components.schemas.BooleanTypeMatchesBooleans.java +class BooleanTypeMatchesBooleans
+ +A class that contains necessary nested +- schema classes (which validate payloads), extends JsonSchema +- sealed interfaces which store validated payloads, Kotlin version of a sum type +- boxed classes which store validated payloads, sealed permits class implementations + +## Nested Class Summary +| Modifier and Type | Class and Description | +| ----------------- | ---------------------- | +| sealed interface | [BooleanTypeMatchesBooleans.BooleanTypeMatchesBooleans1Boxed](#booleantypematchesbooleans1boxed)
sealed interface for validated payloads | +| record | [BooleanTypeMatchesBooleans.BooleanTypeMatchesBooleans1BoxedBoolean](#booleantypematchesbooleans1boxedboolean)
boxed class to store validated boolean payloads | +| static class | [BooleanTypeMatchesBooleans.BooleanTypeMatchesBooleans1](#booleantypematchesbooleans1)
schema class | + +## BooleanTypeMatchesBooleans1Boxed +sealed interface BooleanTypeMatchesBooleans1Boxed
+permits
+[BooleanTypeMatchesBooleans1BoxedBoolean](#booleantypematchesbooleans1boxedboolean) + +sealed interface that stores validated payloads using boxed classes + +## BooleanTypeMatchesBooleans1BoxedBoolean +data class BooleanTypeMatchesBooleans1BoxedBoolean
+implements [BooleanTypeMatchesBooleans1Boxed](#booleantypematchesbooleans1boxed) + +record that stores validated boolean payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| BooleanTypeMatchesBooleans1BoxedBoolean(boolean data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| boolean | data()
validated payload | +| Any? | getData()
validated payload | + +## BooleanTypeMatchesBooleans1 +class BooleanTypeMatchesBooleans1
+extends BooleanJsonSchema.BooleanJsonSchema1 + +A schema class that validates payloads + +| Methods Inherited from class org.openapijsonschematools.client.schemas.BooleanJsonSchema.BooleanJsonSchema1 | +| ------------------------------------------------------------------ | +| validate | +| validateAndBox | + +[[Back to top]](#top) [[Back to Component Schemas]](../../../README.md#Component-Schemas) [[Back to README]](../../../README.md) diff --git a/samples/client/3_0_3_unit_test/kotlin/docs/components/schemas/ByInt.md b/samples/client/3_0_3_unit_test/kotlin/docs/components/schemas/ByInt.md new file mode 100644 index 00000000000..1d2e173784f --- /dev/null +++ b/samples/client/3_0_3_unit_test/kotlin/docs/components/schemas/ByInt.md @@ -0,0 +1,169 @@ +# ByInt +org.openapijsonschematools.client.components.schemas.ByInt.java +class ByInt
+ +A class that contains necessary nested +- schema classes (which validate payloads), extends JsonSchema +- sealed interfaces which store validated payloads, Kotlin version of a sum type +- boxed classes which store validated payloads, sealed permits class implementations + +## Nested Class Summary +| Modifier and Type | Class and Description | +| ----------------- | ---------------------- | +| sealed interface | [ByInt.ByInt1Boxed](#byint1boxed)
sealed interface for validated payloads | +| record | [ByInt.ByInt1BoxedVoid](#byint1boxedvoid)
boxed class to store validated null payloads | +| record | [ByInt.ByInt1BoxedBoolean](#byint1boxedboolean)
boxed class to store validated boolean payloads | +| record | [ByInt.ByInt1BoxedNumber](#byint1boxednumber)
boxed class to store validated Number payloads | +| record | [ByInt.ByInt1BoxedString](#byint1boxedstring)
boxed class to store validated String payloads | +| record | [ByInt.ByInt1BoxedList](#byint1boxedlist)
boxed class to store validated List payloads | +| record | [ByInt.ByInt1BoxedMap](#byint1boxedmap)
boxed class to store validated Map payloads | +| static class | [ByInt.ByInt1](#byint1)
schema class | + +## ByInt1Boxed +sealed interface ByInt1Boxed
+permits
+[ByInt1BoxedVoid](#byint1boxedvoid), +[ByInt1BoxedBoolean](#byint1boxedboolean), +[ByInt1BoxedNumber](#byint1boxednumber), +[ByInt1BoxedString](#byint1boxedstring), +[ByInt1BoxedList](#byint1boxedlist), +[ByInt1BoxedMap](#byint1boxedmap) + +sealed interface that stores validated payloads using boxed classes + +## ByInt1BoxedVoid +data class ByInt1BoxedVoid
+implements [ByInt1Boxed](#byint1boxed) + +data class that stores validated null payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| ByInt1BoxedVoid(Nothing? data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| Nothing? | data()
validated payload | +| Any? | getData()
validated payload | + +## ByInt1BoxedBoolean +data class ByInt1BoxedBoolean
+implements [ByInt1Boxed](#byint1boxed) + +record that stores validated boolean payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| ByInt1BoxedBoolean(boolean data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| boolean | data()
validated payload | +| Any? | getData()
validated payload | + +## ByInt1BoxedNumber +data class ByInt1BoxedNumber
+implements [ByInt1Boxed](#byint1boxed) + +data class that stores validated Number payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| ByInt1BoxedNumber(Number data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| Number | data()
validated payload | +| Any? | getData()
validated payload | + +## ByInt1BoxedString +data class ByInt1BoxedString
+implements [ByInt1Boxed](#byint1boxed) + +data class that stores validated String payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| ByInt1BoxedString(String data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| String | data()
validated payload | +| Any? | getData()
validated payload | + +## ByInt1BoxedList +data class ByInt1BoxedList
+implements [ByInt1Boxed](#byint1boxed) + +data class that stores validated List payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| ByInt1BoxedList(FrozenList data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| FrozenList | data()
validated payload | +| Any? | getData()
validated payload | + +## ByInt1BoxedMap +data class ByInt1BoxedMap
+implements [ByInt1Boxed](#byint1boxed) + +data class that stores validated Map payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| ByInt1BoxedMap(FrozenMap data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| FrozenMap | data()
validated payload | +| Any? | getData()
validated payload | + +## ByInt1 +class ByInt1
+extends JsonSchema + +A schema class that validates payloads + +### Field Summary +| Modifier and Type | Field and Description | +| ----------------- | ---------------------- | +| BigDecimal | multipleOf = BigDecimal("2") | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| String | validate(arg: String, configuration: SchemaConfiguration) | +| Nothing? | validate(arg: Nothing?, configuration: SchemaConfiguration) | +| int | validate(arg: int, configuration: SchemaConfiguration) | +| long | validate(arg: long, configuration: SchemaConfiguration) | +| float | validate(arg: float, configuration: SchemaConfiguration) | +| double | validate(arg: double, configuration: SchemaConfiguration) | +| Number | validate(arg: Number, configuration: SchemaConfiguration) | +| boolean | validate(arg: boolean, configuration: SchemaConfiguration) | +| FrozenMap | validate(arg: Map<?, ?>, configuration: SchemaConfiguration) | +| FrozenList | validate(arg: List<*>, configuration: SchemaConfiguration) | +| [ByInt1BoxedString](#byint1boxedstring) | validateAndBox(String, configuration: SchemaConfiguration) | +| [ByInt1BoxedVoid](#byint1boxedvoid) | validateAndBox(Nothing?, configuration: SchemaConfiguration) | +| [ByInt1BoxedNumber](#byint1boxednumber) | validateAndBox(Number, configuration: SchemaConfiguration) | +| [ByInt1BoxedBoolean](#byint1boxedboolean) | validateAndBox(boolean, configuration: SchemaConfiguration) | +| [ByInt1BoxedMap](#byint1boxedmap) | validateAndBox(Map<?, ?>, configuration: SchemaConfiguration) | +| [ByInt1BoxedList](#byint1boxedlist) | validateAndBox(List<*>, configuration: SchemaConfiguration) | +| [ByInt1Boxed](#byint1boxed) | validateAndBox(Any?, configuration: SchemaConfiguration) | +| Any? | validate(arg: Any?, configuration: SchemaConfiguration) | + +[[Back to top]](#top) [[Back to Component Schemas]](../../../README.md#Component-Schemas) [[Back to README]](../../../README.md) diff --git a/samples/client/3_0_3_unit_test/kotlin/docs/components/schemas/ByNumber.md b/samples/client/3_0_3_unit_test/kotlin/docs/components/schemas/ByNumber.md new file mode 100644 index 00000000000..0ef752b157e --- /dev/null +++ b/samples/client/3_0_3_unit_test/kotlin/docs/components/schemas/ByNumber.md @@ -0,0 +1,169 @@ +# ByNumber +org.openapijsonschematools.client.components.schemas.ByNumber.java +class ByNumber
+ +A class that contains necessary nested +- schema classes (which validate payloads), extends JsonSchema +- sealed interfaces which store validated payloads, Kotlin version of a sum type +- boxed classes which store validated payloads, sealed permits class implementations + +## Nested Class Summary +| Modifier and Type | Class and Description | +| ----------------- | ---------------------- | +| sealed interface | [ByNumber.ByNumber1Boxed](#bynumber1boxed)
sealed interface for validated payloads | +| record | [ByNumber.ByNumber1BoxedVoid](#bynumber1boxedvoid)
boxed class to store validated null payloads | +| record | [ByNumber.ByNumber1BoxedBoolean](#bynumber1boxedboolean)
boxed class to store validated boolean payloads | +| record | [ByNumber.ByNumber1BoxedNumber](#bynumber1boxednumber)
boxed class to store validated Number payloads | +| record | [ByNumber.ByNumber1BoxedString](#bynumber1boxedstring)
boxed class to store validated String payloads | +| record | [ByNumber.ByNumber1BoxedList](#bynumber1boxedlist)
boxed class to store validated List payloads | +| record | [ByNumber.ByNumber1BoxedMap](#bynumber1boxedmap)
boxed class to store validated Map payloads | +| static class | [ByNumber.ByNumber1](#bynumber1)
schema class | + +## ByNumber1Boxed +sealed interface ByNumber1Boxed
+permits
+[ByNumber1BoxedVoid](#bynumber1boxedvoid), +[ByNumber1BoxedBoolean](#bynumber1boxedboolean), +[ByNumber1BoxedNumber](#bynumber1boxednumber), +[ByNumber1BoxedString](#bynumber1boxedstring), +[ByNumber1BoxedList](#bynumber1boxedlist), +[ByNumber1BoxedMap](#bynumber1boxedmap) + +sealed interface that stores validated payloads using boxed classes + +## ByNumber1BoxedVoid +data class ByNumber1BoxedVoid
+implements [ByNumber1Boxed](#bynumber1boxed) + +data class that stores validated null payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| ByNumber1BoxedVoid(Nothing? data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| Nothing? | data()
validated payload | +| Any? | getData()
validated payload | + +## ByNumber1BoxedBoolean +data class ByNumber1BoxedBoolean
+implements [ByNumber1Boxed](#bynumber1boxed) + +record that stores validated boolean payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| ByNumber1BoxedBoolean(boolean data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| boolean | data()
validated payload | +| Any? | getData()
validated payload | + +## ByNumber1BoxedNumber +data class ByNumber1BoxedNumber
+implements [ByNumber1Boxed](#bynumber1boxed) + +data class that stores validated Number payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| ByNumber1BoxedNumber(Number data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| Number | data()
validated payload | +| Any? | getData()
validated payload | + +## ByNumber1BoxedString +data class ByNumber1BoxedString
+implements [ByNumber1Boxed](#bynumber1boxed) + +data class that stores validated String payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| ByNumber1BoxedString(String data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| String | data()
validated payload | +| Any? | getData()
validated payload | + +## ByNumber1BoxedList +data class ByNumber1BoxedList
+implements [ByNumber1Boxed](#bynumber1boxed) + +data class that stores validated List payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| ByNumber1BoxedList(FrozenList data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| FrozenList | data()
validated payload | +| Any? | getData()
validated payload | + +## ByNumber1BoxedMap +data class ByNumber1BoxedMap
+implements [ByNumber1Boxed](#bynumber1boxed) + +data class that stores validated Map payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| ByNumber1BoxedMap(FrozenMap data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| FrozenMap | data()
validated payload | +| Any? | getData()
validated payload | + +## ByNumber1 +class ByNumber1
+extends JsonSchema + +A schema class that validates payloads + +### Field Summary +| Modifier and Type | Field and Description | +| ----------------- | ---------------------- | +| BigDecimal | multipleOf = BigDecimal("1.5") | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| String | validate(arg: String, configuration: SchemaConfiguration) | +| Nothing? | validate(arg: Nothing?, configuration: SchemaConfiguration) | +| int | validate(arg: int, configuration: SchemaConfiguration) | +| long | validate(arg: long, configuration: SchemaConfiguration) | +| float | validate(arg: float, configuration: SchemaConfiguration) | +| double | validate(arg: double, configuration: SchemaConfiguration) | +| Number | validate(arg: Number, configuration: SchemaConfiguration) | +| boolean | validate(arg: boolean, configuration: SchemaConfiguration) | +| FrozenMap | validate(arg: Map<?, ?>, configuration: SchemaConfiguration) | +| FrozenList | validate(arg: List<*>, configuration: SchemaConfiguration) | +| [ByNumber1BoxedString](#bynumber1boxedstring) | validateAndBox(String, configuration: SchemaConfiguration) | +| [ByNumber1BoxedVoid](#bynumber1boxedvoid) | validateAndBox(Nothing?, configuration: SchemaConfiguration) | +| [ByNumber1BoxedNumber](#bynumber1boxednumber) | validateAndBox(Number, configuration: SchemaConfiguration) | +| [ByNumber1BoxedBoolean](#bynumber1boxedboolean) | validateAndBox(boolean, configuration: SchemaConfiguration) | +| [ByNumber1BoxedMap](#bynumber1boxedmap) | validateAndBox(Map<?, ?>, configuration: SchemaConfiguration) | +| [ByNumber1BoxedList](#bynumber1boxedlist) | validateAndBox(List<*>, configuration: SchemaConfiguration) | +| [ByNumber1Boxed](#bynumber1boxed) | validateAndBox(Any?, configuration: SchemaConfiguration) | +| Any? | validate(arg: Any?, configuration: SchemaConfiguration) | + +[[Back to top]](#top) [[Back to Component Schemas]](../../../README.md#Component-Schemas) [[Back to README]](../../../README.md) diff --git a/samples/client/3_0_3_unit_test/kotlin/docs/components/schemas/BySmallNumber.md b/samples/client/3_0_3_unit_test/kotlin/docs/components/schemas/BySmallNumber.md new file mode 100644 index 00000000000..efb24198916 --- /dev/null +++ b/samples/client/3_0_3_unit_test/kotlin/docs/components/schemas/BySmallNumber.md @@ -0,0 +1,169 @@ +# BySmallNumber +org.openapijsonschematools.client.components.schemas.BySmallNumber.java +class BySmallNumber
+ +A class that contains necessary nested +- schema classes (which validate payloads), extends JsonSchema +- sealed interfaces which store validated payloads, Kotlin version of a sum type +- boxed classes which store validated payloads, sealed permits class implementations + +## Nested Class Summary +| Modifier and Type | Class and Description | +| ----------------- | ---------------------- | +| sealed interface | [BySmallNumber.BySmallNumber1Boxed](#bysmallnumber1boxed)
sealed interface for validated payloads | +| record | [BySmallNumber.BySmallNumber1BoxedVoid](#bysmallnumber1boxedvoid)
boxed class to store validated null payloads | +| record | [BySmallNumber.BySmallNumber1BoxedBoolean](#bysmallnumber1boxedboolean)
boxed class to store validated boolean payloads | +| record | [BySmallNumber.BySmallNumber1BoxedNumber](#bysmallnumber1boxednumber)
boxed class to store validated Number payloads | +| record | [BySmallNumber.BySmallNumber1BoxedString](#bysmallnumber1boxedstring)
boxed class to store validated String payloads | +| record | [BySmallNumber.BySmallNumber1BoxedList](#bysmallnumber1boxedlist)
boxed class to store validated List payloads | +| record | [BySmallNumber.BySmallNumber1BoxedMap](#bysmallnumber1boxedmap)
boxed class to store validated Map payloads | +| static class | [BySmallNumber.BySmallNumber1](#bysmallnumber1)
schema class | + +## BySmallNumber1Boxed +sealed interface BySmallNumber1Boxed
+permits
+[BySmallNumber1BoxedVoid](#bysmallnumber1boxedvoid), +[BySmallNumber1BoxedBoolean](#bysmallnumber1boxedboolean), +[BySmallNumber1BoxedNumber](#bysmallnumber1boxednumber), +[BySmallNumber1BoxedString](#bysmallnumber1boxedstring), +[BySmallNumber1BoxedList](#bysmallnumber1boxedlist), +[BySmallNumber1BoxedMap](#bysmallnumber1boxedmap) + +sealed interface that stores validated payloads using boxed classes + +## BySmallNumber1BoxedVoid +data class BySmallNumber1BoxedVoid
+implements [BySmallNumber1Boxed](#bysmallnumber1boxed) + +data class that stores validated null payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| BySmallNumber1BoxedVoid(Nothing? data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| Nothing? | data()
validated payload | +| Any? | getData()
validated payload | + +## BySmallNumber1BoxedBoolean +data class BySmallNumber1BoxedBoolean
+implements [BySmallNumber1Boxed](#bysmallnumber1boxed) + +record that stores validated boolean payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| BySmallNumber1BoxedBoolean(boolean data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| boolean | data()
validated payload | +| Any? | getData()
validated payload | + +## BySmallNumber1BoxedNumber +data class BySmallNumber1BoxedNumber
+implements [BySmallNumber1Boxed](#bysmallnumber1boxed) + +data class that stores validated Number payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| BySmallNumber1BoxedNumber(Number data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| Number | data()
validated payload | +| Any? | getData()
validated payload | + +## BySmallNumber1BoxedString +data class BySmallNumber1BoxedString
+implements [BySmallNumber1Boxed](#bysmallnumber1boxed) + +data class that stores validated String payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| BySmallNumber1BoxedString(String data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| String | data()
validated payload | +| Any? | getData()
validated payload | + +## BySmallNumber1BoxedList +data class BySmallNumber1BoxedList
+implements [BySmallNumber1Boxed](#bysmallnumber1boxed) + +data class that stores validated List payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| BySmallNumber1BoxedList(FrozenList data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| FrozenList | data()
validated payload | +| Any? | getData()
validated payload | + +## BySmallNumber1BoxedMap +data class BySmallNumber1BoxedMap
+implements [BySmallNumber1Boxed](#bysmallnumber1boxed) + +data class that stores validated Map payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| BySmallNumber1BoxedMap(FrozenMap data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| FrozenMap | data()
validated payload | +| Any? | getData()
validated payload | + +## BySmallNumber1 +class BySmallNumber1
+extends JsonSchema + +A schema class that validates payloads + +### Field Summary +| Modifier and Type | Field and Description | +| ----------------- | ---------------------- | +| BigDecimal | multipleOf = BigDecimal("0.00010") | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| String | validate(arg: String, configuration: SchemaConfiguration) | +| Nothing? | validate(arg: Nothing?, configuration: SchemaConfiguration) | +| int | validate(arg: int, configuration: SchemaConfiguration) | +| long | validate(arg: long, configuration: SchemaConfiguration) | +| float | validate(arg: float, configuration: SchemaConfiguration) | +| double | validate(arg: double, configuration: SchemaConfiguration) | +| Number | validate(arg: Number, configuration: SchemaConfiguration) | +| boolean | validate(arg: boolean, configuration: SchemaConfiguration) | +| FrozenMap | validate(arg: Map<?, ?>, configuration: SchemaConfiguration) | +| FrozenList | validate(arg: List<*>, configuration: SchemaConfiguration) | +| [BySmallNumber1BoxedString](#bysmallnumber1boxedstring) | validateAndBox(String, configuration: SchemaConfiguration) | +| [BySmallNumber1BoxedVoid](#bysmallnumber1boxedvoid) | validateAndBox(Nothing?, configuration: SchemaConfiguration) | +| [BySmallNumber1BoxedNumber](#bysmallnumber1boxednumber) | validateAndBox(Number, configuration: SchemaConfiguration) | +| [BySmallNumber1BoxedBoolean](#bysmallnumber1boxedboolean) | validateAndBox(boolean, configuration: SchemaConfiguration) | +| [BySmallNumber1BoxedMap](#bysmallnumber1boxedmap) | validateAndBox(Map<?, ?>, configuration: SchemaConfiguration) | +| [BySmallNumber1BoxedList](#bysmallnumber1boxedlist) | validateAndBox(List<*>, configuration: SchemaConfiguration) | +| [BySmallNumber1Boxed](#bysmallnumber1boxed) | validateAndBox(Any?, configuration: SchemaConfiguration) | +| Any? | validate(arg: Any?, configuration: SchemaConfiguration) | + +[[Back to top]](#top) [[Back to Component Schemas]](../../../README.md#Component-Schemas) [[Back to README]](../../../README.md) diff --git a/samples/client/3_0_3_unit_test/kotlin/docs/components/schemas/DateTimeFormat.md b/samples/client/3_0_3_unit_test/kotlin/docs/components/schemas/DateTimeFormat.md new file mode 100644 index 00000000000..1844f22cea8 --- /dev/null +++ b/samples/client/3_0_3_unit_test/kotlin/docs/components/schemas/DateTimeFormat.md @@ -0,0 +1,169 @@ +# DateTimeFormat +org.openapijsonschematools.client.components.schemas.DateTimeFormat.java +class DateTimeFormat
+ +A class that contains necessary nested +- schema classes (which validate payloads), extends JsonSchema +- sealed interfaces which store validated payloads, Kotlin version of a sum type +- boxed classes which store validated payloads, sealed permits class implementations + +## Nested Class Summary +| Modifier and Type | Class and Description | +| ----------------- | ---------------------- | +| sealed interface | [DateTimeFormat.DateTimeFormat1Boxed](#datetimeformat1boxed)
sealed interface for validated payloads | +| record | [DateTimeFormat.DateTimeFormat1BoxedVoid](#datetimeformat1boxedvoid)
boxed class to store validated null payloads | +| record | [DateTimeFormat.DateTimeFormat1BoxedBoolean](#datetimeformat1boxedboolean)
boxed class to store validated boolean payloads | +| record | [DateTimeFormat.DateTimeFormat1BoxedNumber](#datetimeformat1boxednumber)
boxed class to store validated Number payloads | +| record | [DateTimeFormat.DateTimeFormat1BoxedString](#datetimeformat1boxedstring)
boxed class to store validated String payloads | +| record | [DateTimeFormat.DateTimeFormat1BoxedList](#datetimeformat1boxedlist)
boxed class to store validated List payloads | +| record | [DateTimeFormat.DateTimeFormat1BoxedMap](#datetimeformat1boxedmap)
boxed class to store validated Map payloads | +| static class | [DateTimeFormat.DateTimeFormat1](#datetimeformat1)
schema class | + +## DateTimeFormat1Boxed +sealed interface DateTimeFormat1Boxed
+permits
+[DateTimeFormat1BoxedVoid](#datetimeformat1boxedvoid), +[DateTimeFormat1BoxedBoolean](#datetimeformat1boxedboolean), +[DateTimeFormat1BoxedNumber](#datetimeformat1boxednumber), +[DateTimeFormat1BoxedString](#datetimeformat1boxedstring), +[DateTimeFormat1BoxedList](#datetimeformat1boxedlist), +[DateTimeFormat1BoxedMap](#datetimeformat1boxedmap) + +sealed interface that stores validated payloads using boxed classes + +## DateTimeFormat1BoxedVoid +data class DateTimeFormat1BoxedVoid
+implements [DateTimeFormat1Boxed](#datetimeformat1boxed) + +data class that stores validated null payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| DateTimeFormat1BoxedVoid(Nothing? data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| Nothing? | data()
validated payload | +| Any? | getData()
validated payload | + +## DateTimeFormat1BoxedBoolean +data class DateTimeFormat1BoxedBoolean
+implements [DateTimeFormat1Boxed](#datetimeformat1boxed) + +record that stores validated boolean payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| DateTimeFormat1BoxedBoolean(boolean data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| boolean | data()
validated payload | +| Any? | getData()
validated payload | + +## DateTimeFormat1BoxedNumber +data class DateTimeFormat1BoxedNumber
+implements [DateTimeFormat1Boxed](#datetimeformat1boxed) + +data class that stores validated Number payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| DateTimeFormat1BoxedNumber(Number data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| Number | data()
validated payload | +| Any? | getData()
validated payload | + +## DateTimeFormat1BoxedString +data class DateTimeFormat1BoxedString
+implements [DateTimeFormat1Boxed](#datetimeformat1boxed) + +data class that stores validated String payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| DateTimeFormat1BoxedString(String data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| String | data()
validated payload | +| Any? | getData()
validated payload | + +## DateTimeFormat1BoxedList +data class DateTimeFormat1BoxedList
+implements [DateTimeFormat1Boxed](#datetimeformat1boxed) + +data class that stores validated List payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| DateTimeFormat1BoxedList(FrozenList data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| FrozenList | data()
validated payload | +| Any? | getData()
validated payload | + +## DateTimeFormat1BoxedMap +data class DateTimeFormat1BoxedMap
+implements [DateTimeFormat1Boxed](#datetimeformat1boxed) + +data class that stores validated Map payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| DateTimeFormat1BoxedMap(FrozenMap data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| FrozenMap | data()
validated payload | +| Any? | getData()
validated payload | + +## DateTimeFormat1 +class DateTimeFormat1
+extends JsonSchema + +A schema class that validates payloads + +### Field Summary +| Modifier and Type | Field and Description | +| ----------------- | ---------------------- | +| String | type = "date-time"; | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| String | validate(arg: String, configuration: SchemaConfiguration) | +| Nothing? | validate(arg: Nothing?, configuration: SchemaConfiguration) | +| int | validate(arg: int, configuration: SchemaConfiguration) | +| long | validate(arg: long, configuration: SchemaConfiguration) | +| float | validate(arg: float, configuration: SchemaConfiguration) | +| double | validate(arg: double, configuration: SchemaConfiguration) | +| Number | validate(arg: Number, configuration: SchemaConfiguration) | +| boolean | validate(arg: boolean, configuration: SchemaConfiguration) | +| FrozenMap | validate(arg: Map<?, ?>, configuration: SchemaConfiguration) | +| FrozenList | validate(arg: List<*>, configuration: SchemaConfiguration) | +| [DateTimeFormat1BoxedString](#datetimeformat1boxedstring) | validateAndBox(String, configuration: SchemaConfiguration) | +| [DateTimeFormat1BoxedVoid](#datetimeformat1boxedvoid) | validateAndBox(Nothing?, configuration: SchemaConfiguration) | +| [DateTimeFormat1BoxedNumber](#datetimeformat1boxednumber) | validateAndBox(Number, configuration: SchemaConfiguration) | +| [DateTimeFormat1BoxedBoolean](#datetimeformat1boxedboolean) | validateAndBox(boolean, configuration: SchemaConfiguration) | +| [DateTimeFormat1BoxedMap](#datetimeformat1boxedmap) | validateAndBox(Map<?, ?>, configuration: SchemaConfiguration) | +| [DateTimeFormat1BoxedList](#datetimeformat1boxedlist) | validateAndBox(List<*>, configuration: SchemaConfiguration) | +| [DateTimeFormat1Boxed](#datetimeformat1boxed) | validateAndBox(Any?, configuration: SchemaConfiguration) | +| Any? | validate(arg: Any?, configuration: SchemaConfiguration) | + +[[Back to top]](#top) [[Back to Component Schemas]](../../../README.md#Component-Schemas) [[Back to README]](../../../README.md) diff --git a/samples/client/3_0_3_unit_test/kotlin/docs/components/schemas/EmailFormat.md b/samples/client/3_0_3_unit_test/kotlin/docs/components/schemas/EmailFormat.md new file mode 100644 index 00000000000..53b4cde33e0 --- /dev/null +++ b/samples/client/3_0_3_unit_test/kotlin/docs/components/schemas/EmailFormat.md @@ -0,0 +1,169 @@ +# EmailFormat +org.openapijsonschematools.client.components.schemas.EmailFormat.java +class EmailFormat
+ +A class that contains necessary nested +- schema classes (which validate payloads), extends JsonSchema +- sealed interfaces which store validated payloads, Kotlin version of a sum type +- boxed classes which store validated payloads, sealed permits class implementations + +## Nested Class Summary +| Modifier and Type | Class and Description | +| ----------------- | ---------------------- | +| sealed interface | [EmailFormat.EmailFormat1Boxed](#emailformat1boxed)
sealed interface for validated payloads | +| record | [EmailFormat.EmailFormat1BoxedVoid](#emailformat1boxedvoid)
boxed class to store validated null payloads | +| record | [EmailFormat.EmailFormat1BoxedBoolean](#emailformat1boxedboolean)
boxed class to store validated boolean payloads | +| record | [EmailFormat.EmailFormat1BoxedNumber](#emailformat1boxednumber)
boxed class to store validated Number payloads | +| record | [EmailFormat.EmailFormat1BoxedString](#emailformat1boxedstring)
boxed class to store validated String payloads | +| record | [EmailFormat.EmailFormat1BoxedList](#emailformat1boxedlist)
boxed class to store validated List payloads | +| record | [EmailFormat.EmailFormat1BoxedMap](#emailformat1boxedmap)
boxed class to store validated Map payloads | +| static class | [EmailFormat.EmailFormat1](#emailformat1)
schema class | + +## EmailFormat1Boxed +sealed interface EmailFormat1Boxed
+permits
+[EmailFormat1BoxedVoid](#emailformat1boxedvoid), +[EmailFormat1BoxedBoolean](#emailformat1boxedboolean), +[EmailFormat1BoxedNumber](#emailformat1boxednumber), +[EmailFormat1BoxedString](#emailformat1boxedstring), +[EmailFormat1BoxedList](#emailformat1boxedlist), +[EmailFormat1BoxedMap](#emailformat1boxedmap) + +sealed interface that stores validated payloads using boxed classes + +## EmailFormat1BoxedVoid +data class EmailFormat1BoxedVoid
+implements [EmailFormat1Boxed](#emailformat1boxed) + +data class that stores validated null payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| EmailFormat1BoxedVoid(Nothing? data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| Nothing? | data()
validated payload | +| Any? | getData()
validated payload | + +## EmailFormat1BoxedBoolean +data class EmailFormat1BoxedBoolean
+implements [EmailFormat1Boxed](#emailformat1boxed) + +record that stores validated boolean payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| EmailFormat1BoxedBoolean(boolean data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| boolean | data()
validated payload | +| Any? | getData()
validated payload | + +## EmailFormat1BoxedNumber +data class EmailFormat1BoxedNumber
+implements [EmailFormat1Boxed](#emailformat1boxed) + +data class that stores validated Number payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| EmailFormat1BoxedNumber(Number data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| Number | data()
validated payload | +| Any? | getData()
validated payload | + +## EmailFormat1BoxedString +data class EmailFormat1BoxedString
+implements [EmailFormat1Boxed](#emailformat1boxed) + +data class that stores validated String payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| EmailFormat1BoxedString(String data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| String | data()
validated payload | +| Any? | getData()
validated payload | + +## EmailFormat1BoxedList +data class EmailFormat1BoxedList
+implements [EmailFormat1Boxed](#emailformat1boxed) + +data class that stores validated List payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| EmailFormat1BoxedList(FrozenList data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| FrozenList | data()
validated payload | +| Any? | getData()
validated payload | + +## EmailFormat1BoxedMap +data class EmailFormat1BoxedMap
+implements [EmailFormat1Boxed](#emailformat1boxed) + +data class that stores validated Map payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| EmailFormat1BoxedMap(FrozenMap data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| FrozenMap | data()
validated payload | +| Any? | getData()
validated payload | + +## EmailFormat1 +class EmailFormat1
+extends JsonSchema + +A schema class that validates payloads + +### Field Summary +| Modifier and Type | Field and Description | +| ----------------- | ---------------------- | +| String | type = "email"; | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| String | validate(arg: String, configuration: SchemaConfiguration) | +| Nothing? | validate(arg: Nothing?, configuration: SchemaConfiguration) | +| int | validate(arg: int, configuration: SchemaConfiguration) | +| long | validate(arg: long, configuration: SchemaConfiguration) | +| float | validate(arg: float, configuration: SchemaConfiguration) | +| double | validate(arg: double, configuration: SchemaConfiguration) | +| Number | validate(arg: Number, configuration: SchemaConfiguration) | +| boolean | validate(arg: boolean, configuration: SchemaConfiguration) | +| FrozenMap | validate(arg: Map<?, ?>, configuration: SchemaConfiguration) | +| FrozenList | validate(arg: List<*>, configuration: SchemaConfiguration) | +| [EmailFormat1BoxedString](#emailformat1boxedstring) | validateAndBox(String, configuration: SchemaConfiguration) | +| [EmailFormat1BoxedVoid](#emailformat1boxedvoid) | validateAndBox(Nothing?, configuration: SchemaConfiguration) | +| [EmailFormat1BoxedNumber](#emailformat1boxednumber) | validateAndBox(Number, configuration: SchemaConfiguration) | +| [EmailFormat1BoxedBoolean](#emailformat1boxedboolean) | validateAndBox(boolean, configuration: SchemaConfiguration) | +| [EmailFormat1BoxedMap](#emailformat1boxedmap) | validateAndBox(Map<?, ?>, configuration: SchemaConfiguration) | +| [EmailFormat1BoxedList](#emailformat1boxedlist) | validateAndBox(List<*>, configuration: SchemaConfiguration) | +| [EmailFormat1Boxed](#emailformat1boxed) | validateAndBox(Any?, configuration: SchemaConfiguration) | +| Any? | validate(arg: Any?, configuration: SchemaConfiguration) | + +[[Back to top]](#top) [[Back to Component Schemas]](../../../README.md#Component-Schemas) [[Back to README]](../../../README.md) diff --git a/samples/client/3_0_3_unit_test/kotlin/docs/components/schemas/EnumWith0DoesNotMatchFalse.md b/samples/client/3_0_3_unit_test/kotlin/docs/components/schemas/EnumWith0DoesNotMatchFalse.md new file mode 100644 index 00000000000..b33bd6fd650 --- /dev/null +++ b/samples/client/3_0_3_unit_test/kotlin/docs/components/schemas/EnumWith0DoesNotMatchFalse.md @@ -0,0 +1,133 @@ +# EnumWith0DoesNotMatchFalse +org.openapijsonschematools.client.components.schemas.EnumWith0DoesNotMatchFalse.java +class EnumWith0DoesNotMatchFalse
+ +A class that contains necessary nested +- schema classes (which validate payloads), extends JsonSchema +- sealed interfaces which store validated payloads, Kotlin version of a sum type +- boxed classes which store validated payloads, sealed permits class implementations +- enum classes + +## Nested Class Summary +| Modifier and Type | Class and Description | +| ----------------- | ---------------------- | +| sealed interface | [EnumWith0DoesNotMatchFalse.EnumWith0DoesNotMatchFalse1Boxed](#enumwith0doesnotmatchfalse1boxed)
sealed interface for validated payloads | +| record | [EnumWith0DoesNotMatchFalse.EnumWith0DoesNotMatchFalse1BoxedNumber](#enumwith0doesnotmatchfalse1boxednumber)
boxed class to store validated Number payloads | +| static class | [EnumWith0DoesNotMatchFalse.EnumWith0DoesNotMatchFalse1](#enumwith0doesnotmatchfalse1)
schema class | +| enum | [EnumWith0DoesNotMatchFalse.IntegerEnumWith0DoesNotMatchFalseEnums](#integerenumwith0doesnotmatchfalseenums)
Integer enum | +| enum | [EnumWith0DoesNotMatchFalse.LongEnumWith0DoesNotMatchFalseEnums](#longenumwith0doesnotmatchfalseenums)
Long enum | +| enum | [EnumWith0DoesNotMatchFalse.FloatEnumWith0DoesNotMatchFalseEnums](#floatenumwith0doesnotmatchfalseenums)
Float enum | +| enum | [EnumWith0DoesNotMatchFalse.DoubleEnumWith0DoesNotMatchFalseEnums](#doubleenumwith0doesnotmatchfalseenums)
Double enum | + +## EnumWith0DoesNotMatchFalse1Boxed +sealed interface EnumWith0DoesNotMatchFalse1Boxed
+permits
+[EnumWith0DoesNotMatchFalse1BoxedNumber](#enumwith0doesnotmatchfalse1boxednumber) + +sealed interface that stores validated payloads using boxed classes + +## EnumWith0DoesNotMatchFalse1BoxedNumber +data class EnumWith0DoesNotMatchFalse1BoxedNumber
+implements [EnumWith0DoesNotMatchFalse1Boxed](#enumwith0doesnotmatchfalse1boxed) + +data class that stores validated Number payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| EnumWith0DoesNotMatchFalse1BoxedNumber(Number data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| Number | data()
validated payload | +| Any? | getData()
validated payload | + +## EnumWith0DoesNotMatchFalse1 +class EnumWith0DoesNotMatchFalse1
+extends JsonSchema + +A schema class that validates payloads + +### Code Sample +``` +import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags; +import org.openapijsonschematools.client.configurations.SchemaConfiguration; +import org.openapijsonschematools.client.exceptions.ValidationException; +import org.openapijsonschematools.client.schemas.validation.MapUtils; +import org.openapijsonschematools.client.schemas.validation.FrozenList; +import org.openapijsonschematools.client.schemas.validation.FrozenMap; +import org.openapijsonschematools.client.components.schemas.EnumWith0DoesNotMatchFalse; + +import java.util.Arrays; +import java.util.List; +import java.util.AbstractMap; + +static final SchemaConfiguration configuration = new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().build()); + +// int validation +int validatedPayload = EnumWith0DoesNotMatchFalse.EnumWith0DoesNotMatchFalse1.validate( + 1, + configuration +); +``` + +### Field Summary +| Modifier and Type | Field and Description | +| ----------------- | ---------------------- | +| Set> | type = setOf(
    Int::class.java,
    Long::class.java,
    Float::class.java,
    Double::class.java
)
| +| Set | enumValues = setOf(
    0
)
| + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| Number | validate(arg: Number, configuration: SchemaConfiguration) | +| [EnumWith0DoesNotMatchFalse1BoxedNumber](#enumwith0doesnotmatchfalse1boxednumber) | validateAndBox(Number, configuration: SchemaConfiguration) | +| [EnumWith0DoesNotMatchFalse1Boxed](#enumwith0doesnotmatchfalse1boxed) | validateAndBox(Any?, configuration: SchemaConfiguration) | +| Any? | validate(arg: Any?, configuration: SchemaConfiguration) | + +## IntegerEnumWith0DoesNotMatchFalseEnums +public enum IntegerEnumWith0DoesNotMatchFalseEnums
+extends `Enum` + +A class that stores Integer enum values + +### Enum Constant Summary +| Enum Constant | Description | +| ------------- | ----------- | +| POSITIVE_0 | value = 0 | + +## LongEnumWith0DoesNotMatchFalseEnums +public enum LongEnumWith0DoesNotMatchFalseEnums
+extends `Enum` + +A class that stores Long enum values + +### Enum Constant Summary +| Enum Constant | Description | +| ------------- | ----------- | +| POSITIVE_0 | value = 0L | + +## FloatEnumWith0DoesNotMatchFalseEnums +public enum FloatEnumWith0DoesNotMatchFalseEnums
+extends `Enum` + +A class that stores Float enum values + +### Enum Constant Summary +| Enum Constant | Description | +| ------------- | ----------- | +| POSITIVE_0 | value = 0.0f | + +## DoubleEnumWith0DoesNotMatchFalseEnums +public enum DoubleEnumWith0DoesNotMatchFalseEnums
+extends `Enum` + +A class that stores Double enum values + +### Enum Constant Summary +| Enum Constant | Description | +| ------------- | ----------- | +| POSITIVE_0 | value = 0.0d | + +[[Back to top]](#top) [[Back to Component Schemas]](../../../README.md#Component-Schemas) [[Back to README]](../../../README.md) diff --git a/samples/client/3_0_3_unit_test/kotlin/docs/components/schemas/EnumWith1DoesNotMatchTrue.md b/samples/client/3_0_3_unit_test/kotlin/docs/components/schemas/EnumWith1DoesNotMatchTrue.md new file mode 100644 index 00000000000..a296b3a613f --- /dev/null +++ b/samples/client/3_0_3_unit_test/kotlin/docs/components/schemas/EnumWith1DoesNotMatchTrue.md @@ -0,0 +1,133 @@ +# EnumWith1DoesNotMatchTrue +org.openapijsonschematools.client.components.schemas.EnumWith1DoesNotMatchTrue.java +class EnumWith1DoesNotMatchTrue
+ +A class that contains necessary nested +- schema classes (which validate payloads), extends JsonSchema +- sealed interfaces which store validated payloads, Kotlin version of a sum type +- boxed classes which store validated payloads, sealed permits class implementations +- enum classes + +## Nested Class Summary +| Modifier and Type | Class and Description | +| ----------------- | ---------------------- | +| sealed interface | [EnumWith1DoesNotMatchTrue.EnumWith1DoesNotMatchTrue1Boxed](#enumwith1doesnotmatchtrue1boxed)
sealed interface for validated payloads | +| record | [EnumWith1DoesNotMatchTrue.EnumWith1DoesNotMatchTrue1BoxedNumber](#enumwith1doesnotmatchtrue1boxednumber)
boxed class to store validated Number payloads | +| static class | [EnumWith1DoesNotMatchTrue.EnumWith1DoesNotMatchTrue1](#enumwith1doesnotmatchtrue1)
schema class | +| enum | [EnumWith1DoesNotMatchTrue.IntegerEnumWith1DoesNotMatchTrueEnums](#integerenumwith1doesnotmatchtrueenums)
Integer enum | +| enum | [EnumWith1DoesNotMatchTrue.LongEnumWith1DoesNotMatchTrueEnums](#longenumwith1doesnotmatchtrueenums)
Long enum | +| enum | [EnumWith1DoesNotMatchTrue.FloatEnumWith1DoesNotMatchTrueEnums](#floatenumwith1doesnotmatchtrueenums)
Float enum | +| enum | [EnumWith1DoesNotMatchTrue.DoubleEnumWith1DoesNotMatchTrueEnums](#doubleenumwith1doesnotmatchtrueenums)
Double enum | + +## EnumWith1DoesNotMatchTrue1Boxed +sealed interface EnumWith1DoesNotMatchTrue1Boxed
+permits
+[EnumWith1DoesNotMatchTrue1BoxedNumber](#enumwith1doesnotmatchtrue1boxednumber) + +sealed interface that stores validated payloads using boxed classes + +## EnumWith1DoesNotMatchTrue1BoxedNumber +data class EnumWith1DoesNotMatchTrue1BoxedNumber
+implements [EnumWith1DoesNotMatchTrue1Boxed](#enumwith1doesnotmatchtrue1boxed) + +data class that stores validated Number payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| EnumWith1DoesNotMatchTrue1BoxedNumber(Number data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| Number | data()
validated payload | +| Any? | getData()
validated payload | + +## EnumWith1DoesNotMatchTrue1 +class EnumWith1DoesNotMatchTrue1
+extends JsonSchema + +A schema class that validates payloads + +### Code Sample +``` +import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags; +import org.openapijsonschematools.client.configurations.SchemaConfiguration; +import org.openapijsonschematools.client.exceptions.ValidationException; +import org.openapijsonschematools.client.schemas.validation.MapUtils; +import org.openapijsonschematools.client.schemas.validation.FrozenList; +import org.openapijsonschematools.client.schemas.validation.FrozenMap; +import org.openapijsonschematools.client.components.schemas.EnumWith1DoesNotMatchTrue; + +import java.util.Arrays; +import java.util.List; +import java.util.AbstractMap; + +static final SchemaConfiguration configuration = new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().build()); + +// int validation +int validatedPayload = EnumWith1DoesNotMatchTrue.EnumWith1DoesNotMatchTrue1.validate( + 1, + configuration +); +``` + +### Field Summary +| Modifier and Type | Field and Description | +| ----------------- | ---------------------- | +| Set> | type = setOf(
    Int::class.java,
    Long::class.java,
    Float::class.java,
    Double::class.java
)
| +| Set | enumValues = setOf(
    1
)
| + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| Number | validate(arg: Number, configuration: SchemaConfiguration) | +| [EnumWith1DoesNotMatchTrue1BoxedNumber](#enumwith1doesnotmatchtrue1boxednumber) | validateAndBox(Number, configuration: SchemaConfiguration) | +| [EnumWith1DoesNotMatchTrue1Boxed](#enumwith1doesnotmatchtrue1boxed) | validateAndBox(Any?, configuration: SchemaConfiguration) | +| Any? | validate(arg: Any?, configuration: SchemaConfiguration) | + +## IntegerEnumWith1DoesNotMatchTrueEnums +public enum IntegerEnumWith1DoesNotMatchTrueEnums
+extends `Enum` + +A class that stores Integer enum values + +### Enum Constant Summary +| Enum Constant | Description | +| ------------- | ----------- | +| POSITIVE_1 | value = 1 | + +## LongEnumWith1DoesNotMatchTrueEnums +public enum LongEnumWith1DoesNotMatchTrueEnums
+extends `Enum` + +A class that stores Long enum values + +### Enum Constant Summary +| Enum Constant | Description | +| ------------- | ----------- | +| POSITIVE_1 | value = 1L | + +## FloatEnumWith1DoesNotMatchTrueEnums +public enum FloatEnumWith1DoesNotMatchTrueEnums
+extends `Enum` + +A class that stores Float enum values + +### Enum Constant Summary +| Enum Constant | Description | +| ------------- | ----------- | +| POSITIVE_1 | value = 1.0f | + +## DoubleEnumWith1DoesNotMatchTrueEnums +public enum DoubleEnumWith1DoesNotMatchTrueEnums
+extends `Enum` + +A class that stores Double enum values + +### Enum Constant Summary +| Enum Constant | Description | +| ------------- | ----------- | +| POSITIVE_1 | value = 1.0d | + +[[Back to top]](#top) [[Back to Component Schemas]](../../../README.md#Component-Schemas) [[Back to README]](../../../README.md) diff --git a/samples/client/3_0_3_unit_test/kotlin/docs/components/schemas/EnumWithEscapedCharacters.md b/samples/client/3_0_3_unit_test/kotlin/docs/components/schemas/EnumWithEscapedCharacters.md new file mode 100644 index 00000000000..54458d5522a --- /dev/null +++ b/samples/client/3_0_3_unit_test/kotlin/docs/components/schemas/EnumWithEscapedCharacters.md @@ -0,0 +1,99 @@ +# EnumWithEscapedCharacters +org.openapijsonschematools.client.components.schemas.EnumWithEscapedCharacters.java +class EnumWithEscapedCharacters
+ +A class that contains necessary nested +- schema classes (which validate payloads), extends JsonSchema +- sealed interfaces which store validated payloads, Kotlin version of a sum type +- boxed classes which store validated payloads, sealed permits class implementations +- enum classes + +## Nested Class Summary +| Modifier and Type | Class and Description | +| ----------------- | ---------------------- | +| sealed interface | [EnumWithEscapedCharacters.EnumWithEscapedCharacters1Boxed](#enumwithescapedcharacters1boxed)
sealed interface for validated payloads | +| record | [EnumWithEscapedCharacters.EnumWithEscapedCharacters1BoxedString](#enumwithescapedcharacters1boxedstring)
boxed class to store validated String payloads | +| static class | [EnumWithEscapedCharacters.EnumWithEscapedCharacters1](#enumwithescapedcharacters1)
schema class | +| enum | [EnumWithEscapedCharacters.StringEnumWithEscapedCharactersEnums](#stringenumwithescapedcharactersenums)
String enum | + +## EnumWithEscapedCharacters1Boxed +sealed interface EnumWithEscapedCharacters1Boxed
+permits
+[EnumWithEscapedCharacters1BoxedString](#enumwithescapedcharacters1boxedstring) + +sealed interface that stores validated payloads using boxed classes + +## EnumWithEscapedCharacters1BoxedString +data class EnumWithEscapedCharacters1BoxedString
+implements [EnumWithEscapedCharacters1Boxed](#enumwithescapedcharacters1boxed) + +data class that stores validated String payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| EnumWithEscapedCharacters1BoxedString(String data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| String | data()
validated payload | +| Any? | getData()
validated payload | + +## EnumWithEscapedCharacters1 +class EnumWithEscapedCharacters1
+extends JsonSchema + +A schema class that validates payloads + +### Code Sample +``` +import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags; +import org.openapijsonschematools.client.configurations.SchemaConfiguration; +import org.openapijsonschematools.client.exceptions.ValidationException; +import org.openapijsonschematools.client.schemas.validation.MapUtils; +import org.openapijsonschematools.client.schemas.validation.FrozenList; +import org.openapijsonschematools.client.schemas.validation.FrozenMap; +import org.openapijsonschematools.client.components.schemas.EnumWithEscapedCharacters; + +import java.util.Arrays; +import java.util.List; +import java.util.AbstractMap; + +static final SchemaConfiguration configuration = new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().build()); + +// String validation +String validatedPayload = EnumWithEscapedCharacters.EnumWithEscapedCharacters1.validate( + "foo\nbar", + configuration +); +``` + +### Field Summary +| Modifier and Type | Field and Description | +| ----------------- | ---------------------- | +| Set> | type = setOf(
    String::class.java
)
| +| Set | enumValues = setOf(
    "foo\nbar",
    "foo\rbar"
)
| + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| String | validate(arg: String, configuration: SchemaConfiguration) | +| String | validate(arg: [StringEnumWithEscapedCharactersEnums](#stringenumwithescapedcharactersenums), configuration: SchemaConfiguration) | +| [EnumWithEscapedCharacters1BoxedString](#enumwithescapedcharacters1boxedstring) | validateAndBox(String, configuration: SchemaConfiguration) | +| [EnumWithEscapedCharacters1Boxed](#enumwithescapedcharacters1boxed) | validateAndBox(Any?, configuration: SchemaConfiguration) | +| Any? | validate(arg: Any?, configuration: SchemaConfiguration) | + +## StringEnumWithEscapedCharactersEnums +public enum StringEnumWithEscapedCharactersEnums
+extends `Enum` + +A class that stores String enum values + +### Enum Constant Summary +| Enum Constant | Description | +| ------------- | ----------- | +| FOO_LINE_FEED_LF_BAR | value = "foo\nbar" | +| FOO_CARRIAGE_RETURN_CR_BAR | value = "foo\rbar" | + +[[Back to top]](#top) [[Back to Component Schemas]](../../../README.md#Component-Schemas) [[Back to README]](../../../README.md) diff --git a/samples/client/3_0_3_unit_test/kotlin/docs/components/schemas/EnumWithFalseDoesNotMatch0.md b/samples/client/3_0_3_unit_test/kotlin/docs/components/schemas/EnumWithFalseDoesNotMatch0.md new file mode 100644 index 00000000000..8055fb6b4d9 --- /dev/null +++ b/samples/client/3_0_3_unit_test/kotlin/docs/components/schemas/EnumWithFalseDoesNotMatch0.md @@ -0,0 +1,98 @@ +# EnumWithFalseDoesNotMatch0 +org.openapijsonschematools.client.components.schemas.EnumWithFalseDoesNotMatch0.java +class EnumWithFalseDoesNotMatch0
+ +A class that contains necessary nested +- schema classes (which validate payloads), extends JsonSchema +- sealed interfaces which store validated payloads, Kotlin version of a sum type +- boxed classes which store validated payloads, sealed permits class implementations +- enum classes + +## Nested Class Summary +| Modifier and Type | Class and Description | +| ----------------- | ---------------------- | +| sealed interface | [EnumWithFalseDoesNotMatch0.EnumWithFalseDoesNotMatch01Boxed](#enumwithfalsedoesnotmatch01boxed)
sealed interface for validated payloads | +| record | [EnumWithFalseDoesNotMatch0.EnumWithFalseDoesNotMatch01BoxedBoolean](#enumwithfalsedoesnotmatch01boxedboolean)
boxed class to store validated boolean payloads | +| static class | [EnumWithFalseDoesNotMatch0.EnumWithFalseDoesNotMatch01](#enumwithfalsedoesnotmatch01)
schema class | +| enum | [EnumWithFalseDoesNotMatch0.BooleanEnumWithFalseDoesNotMatch0Enums](#booleanenumwithfalsedoesnotmatch0enums)
boolean enum | + +## EnumWithFalseDoesNotMatch01Boxed +sealed interface EnumWithFalseDoesNotMatch01Boxed
+permits
+[EnumWithFalseDoesNotMatch01BoxedBoolean](#enumwithfalsedoesnotmatch01boxedboolean) + +sealed interface that stores validated payloads using boxed classes + +## EnumWithFalseDoesNotMatch01BoxedBoolean +data class EnumWithFalseDoesNotMatch01BoxedBoolean
+implements [EnumWithFalseDoesNotMatch01Boxed](#enumwithfalsedoesnotmatch01boxed) + +record that stores validated boolean payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| EnumWithFalseDoesNotMatch01BoxedBoolean(boolean data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| boolean | data()
validated payload | +| Any? | getData()
validated payload | + +## EnumWithFalseDoesNotMatch01 +class EnumWithFalseDoesNotMatch01
+extends JsonSchema + +A schema class that validates payloads + +### Code Sample +``` +import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags; +import org.openapijsonschematools.client.configurations.SchemaConfiguration; +import org.openapijsonschematools.client.exceptions.ValidationException; +import org.openapijsonschematools.client.schemas.validation.MapUtils; +import org.openapijsonschematools.client.schemas.validation.FrozenList; +import org.openapijsonschematools.client.schemas.validation.FrozenMap; +import org.openapijsonschematools.client.components.schemas.EnumWithFalseDoesNotMatch0; + +import java.util.Arrays; +import java.util.List; +import java.util.AbstractMap; + +static final SchemaConfiguration configuration = new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().build()); + +// boolean validation +boolean validatedPayload = EnumWithFalseDoesNotMatch0.EnumWithFalseDoesNotMatch01.validate( + false, + configuration +); +``` + +### Field Summary +| Modifier and Type | Field and Description | +| ----------------- | ---------------------- | +| Set> | type = setOf(Boolean::class.java) | +| Set | enumValues = setOf(
    false
)
| + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| boolean | validate(arg: boolean, configuration: SchemaConfiguration) | +| boolean | validate(arg: [BooleanEnumWithFalseDoesNotMatch0Enums](#booleanenumwithfalsedoesnotmatch0enums), configuration: SchemaConfiguration) | +| [EnumWithFalseDoesNotMatch01BoxedBoolean](#enumwithfalsedoesnotmatch01boxedboolean) | validateAndBox(boolean, configuration: SchemaConfiguration) | +| [EnumWithFalseDoesNotMatch01Boxed](#enumwithfalsedoesnotmatch01boxed) | validateAndBox(Any?, configuration: SchemaConfiguration) | +| Any? | validate(arg: Any?, configuration: SchemaConfiguration) | + +## BooleanEnumWithFalseDoesNotMatch0Enums +public enum BooleanEnumWithFalseDoesNotMatch0Enums
+extends `Enum` + +A class that stores boolean enum values + +### Enum Constant Summary +| Enum Constant | Description | +| ------------- | ----------- | +| FALSE | value = false | + +[[Back to top]](#top) [[Back to Component Schemas]](../../../README.md#Component-Schemas) [[Back to README]](../../../README.md) diff --git a/samples/client/3_0_3_unit_test/kotlin/docs/components/schemas/EnumWithTrueDoesNotMatch1.md b/samples/client/3_0_3_unit_test/kotlin/docs/components/schemas/EnumWithTrueDoesNotMatch1.md new file mode 100644 index 00000000000..c22cd9303bb --- /dev/null +++ b/samples/client/3_0_3_unit_test/kotlin/docs/components/schemas/EnumWithTrueDoesNotMatch1.md @@ -0,0 +1,98 @@ +# EnumWithTrueDoesNotMatch1 +org.openapijsonschematools.client.components.schemas.EnumWithTrueDoesNotMatch1.java +class EnumWithTrueDoesNotMatch1
+ +A class that contains necessary nested +- schema classes (which validate payloads), extends JsonSchema +- sealed interfaces which store validated payloads, Kotlin version of a sum type +- boxed classes which store validated payloads, sealed permits class implementations +- enum classes + +## Nested Class Summary +| Modifier and Type | Class and Description | +| ----------------- | ---------------------- | +| sealed interface | [EnumWithTrueDoesNotMatch1.EnumWithTrueDoesNotMatch11Boxed](#enumwithtruedoesnotmatch11boxed)
sealed interface for validated payloads | +| record | [EnumWithTrueDoesNotMatch1.EnumWithTrueDoesNotMatch11BoxedBoolean](#enumwithtruedoesnotmatch11boxedboolean)
boxed class to store validated boolean payloads | +| static class | [EnumWithTrueDoesNotMatch1.EnumWithTrueDoesNotMatch11](#enumwithtruedoesnotmatch11)
schema class | +| enum | [EnumWithTrueDoesNotMatch1.BooleanEnumWithTrueDoesNotMatch1Enums](#booleanenumwithtruedoesnotmatch1enums)
boolean enum | + +## EnumWithTrueDoesNotMatch11Boxed +sealed interface EnumWithTrueDoesNotMatch11Boxed
+permits
+[EnumWithTrueDoesNotMatch11BoxedBoolean](#enumwithtruedoesnotmatch11boxedboolean) + +sealed interface that stores validated payloads using boxed classes + +## EnumWithTrueDoesNotMatch11BoxedBoolean +data class EnumWithTrueDoesNotMatch11BoxedBoolean
+implements [EnumWithTrueDoesNotMatch11Boxed](#enumwithtruedoesnotmatch11boxed) + +record that stores validated boolean payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| EnumWithTrueDoesNotMatch11BoxedBoolean(boolean data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| boolean | data()
validated payload | +| Any? | getData()
validated payload | + +## EnumWithTrueDoesNotMatch11 +class EnumWithTrueDoesNotMatch11
+extends JsonSchema + +A schema class that validates payloads + +### Code Sample +``` +import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags; +import org.openapijsonschematools.client.configurations.SchemaConfiguration; +import org.openapijsonschematools.client.exceptions.ValidationException; +import org.openapijsonschematools.client.schemas.validation.MapUtils; +import org.openapijsonschematools.client.schemas.validation.FrozenList; +import org.openapijsonschematools.client.schemas.validation.FrozenMap; +import org.openapijsonschematools.client.components.schemas.EnumWithTrueDoesNotMatch1; + +import java.util.Arrays; +import java.util.List; +import java.util.AbstractMap; + +static final SchemaConfiguration configuration = new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().build()); + +// boolean validation +boolean validatedPayload = EnumWithTrueDoesNotMatch1.EnumWithTrueDoesNotMatch11.validate( + true, + configuration +); +``` + +### Field Summary +| Modifier and Type | Field and Description | +| ----------------- | ---------------------- | +| Set> | type = setOf(Boolean::class.java) | +| Set | enumValues = setOf(
    true
)
| + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| boolean | validate(arg: boolean, configuration: SchemaConfiguration) | +| boolean | validate(arg: [BooleanEnumWithTrueDoesNotMatch1Enums](#booleanenumwithtruedoesnotmatch1enums), configuration: SchemaConfiguration) | +| [EnumWithTrueDoesNotMatch11BoxedBoolean](#enumwithtruedoesnotmatch11boxedboolean) | validateAndBox(boolean, configuration: SchemaConfiguration) | +| [EnumWithTrueDoesNotMatch11Boxed](#enumwithtruedoesnotmatch11boxed) | validateAndBox(Any?, configuration: SchemaConfiguration) | +| Any? | validate(arg: Any?, configuration: SchemaConfiguration) | + +## BooleanEnumWithTrueDoesNotMatch1Enums +public enum BooleanEnumWithTrueDoesNotMatch1Enums
+extends `Enum` + +A class that stores boolean enum values + +### Enum Constant Summary +| Enum Constant | Description | +| ------------- | ----------- | +| TRUE | value = true | + +[[Back to top]](#top) [[Back to Component Schemas]](../../../README.md#Component-Schemas) [[Back to README]](../../../README.md) diff --git a/samples/client/3_0_3_unit_test/kotlin/docs/components/schemas/EnumsInProperties.md b/samples/client/3_0_3_unit_test/kotlin/docs/components/schemas/EnumsInProperties.md new file mode 100644 index 00000000000..dad4dd136ad --- /dev/null +++ b/samples/client/3_0_3_unit_test/kotlin/docs/components/schemas/EnumsInProperties.md @@ -0,0 +1,320 @@ +# EnumsInProperties +org.openapijsonschematools.client.components.schemas.EnumsInProperties.java +class EnumsInProperties
+ +A class that contains necessary nested +- schema classes (which validate payloads), extends JsonSchema +- sealed interfaces which store validated payloads, Kotlin version of a sum type +- boxed classes which store validated payloads, sealed permits class implementations +- classes to store validated map payloads, extends FrozenMap +- classes to build inputs for map payloads +- enum classes + +## Nested Class Summary +| Modifier and Type | Class and Description | +| ----------------- | ---------------------- | +| sealed interface | [EnumsInProperties.EnumsInProperties1Boxed](#enumsinproperties1boxed)
sealed interface for validated payloads | +| record | [EnumsInProperties.EnumsInProperties1BoxedMap](#enumsinproperties1boxedmap)
boxed class to store validated Map payloads | +| static class | [EnumsInProperties.EnumsInProperties1](#enumsinproperties1)
schema class | +| static class | [EnumsInProperties.EnumsInPropertiesMapBuilder](#enumsinpropertiesmapbuilder)
builder for Map payloads | +| static class | [EnumsInProperties.EnumsInPropertiesMap](#enumsinpropertiesmap)
output class for Map payloads | +| sealed interface | [EnumsInProperties.BarBoxed](#barboxed)
sealed interface for validated payloads | +| record | [EnumsInProperties.BarBoxedString](#barboxedstring)
boxed class to store validated String payloads | +| static class | [EnumsInProperties.Bar](#bar)
schema class | +| enum | [EnumsInProperties.StringBarEnums](#stringbarenums)
String enum | +| sealed interface | [EnumsInProperties.FooBoxed](#fooboxed)
sealed interface for validated payloads | +| record | [EnumsInProperties.FooBoxedString](#fooboxedstring)
boxed class to store validated String payloads | +| static class | [EnumsInProperties.Foo](#foo)
schema class | +| enum | [EnumsInProperties.StringFooEnums](#stringfooenums)
String enum | + +## EnumsInProperties1Boxed +sealed interface EnumsInProperties1Boxed
+permits
+[EnumsInProperties1BoxedMap](#enumsinproperties1boxedmap) + +sealed interface that stores validated payloads using boxed classes + +## EnumsInProperties1BoxedMap +data class EnumsInProperties1BoxedMap
+implements [EnumsInProperties1Boxed](#enumsinproperties1boxed) + +data class that stores validated Map payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| EnumsInProperties1BoxedMap([EnumsInPropertiesMap](#enumsinpropertiesmap) data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| [EnumsInPropertiesMap](#enumsinpropertiesmap) | data()
validated payload | +| Any? | getData()
validated payload | + +## EnumsInProperties1 +class EnumsInProperties1
+extends JsonSchema + +A schema class that validates payloads + +### Code Sample +``` +import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags; +import org.openapijsonschematools.client.configurations.SchemaConfiguration; +import org.openapijsonschematools.client.exceptions.ValidationException; +import org.openapijsonschematools.client.schemas.validation.MapUtils; +import org.openapijsonschematools.client.schemas.validation.FrozenList; +import org.openapijsonschematools.client.schemas.validation.FrozenMap; +import org.openapijsonschematools.client.components.schemas.EnumsInProperties; + +import java.util.Arrays; +import java.util.List; +import java.util.AbstractMap; + +static final SchemaConfiguration configuration = new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().build()); + +// Map validation +EnumsInProperties.EnumsInPropertiesMap validatedPayload = + EnumsInProperties.EnumsInProperties1.validate( + new EnumsInProperties.EnumsInPropertiesMapBuilder() + .bar("bar") + + .foo("foo") + + .build(), + configuration +); +``` + +### Field Summary +| Modifier and Type | Field and Description | +| ----------------- | ---------------------- | +| Set> | type = setOf(Map::class.java) | +| Map> | properties = mapOf(
    "foo" to [Foo::class.java](#foo)),
    "bar" to [Bar::class.java](#bar))
)
| +| Set | required = setOf(
    "bar"
)
| + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| [EnumsInPropertiesMap](#enumsinpropertiesmap) | validate(arg: [Map<?, ?>](#enumsinpropertiesmapbuilder), configuration: SchemaConfiguration) | +| [EnumsInProperties1BoxedMap](#enumsinproperties1boxedmap) | validateAndBox([Map<?, ?>](#enumsinpropertiesmapbuilder), configuration: SchemaConfiguration) | +| [EnumsInProperties1Boxed](#enumsinproperties1boxed) | validateAndBox(Any?, configuration: SchemaConfiguration) | +| Any? | validate(arg: Any?, configuration: SchemaConfiguration) | + +## EnumsInPropertiesMap0Builder +class EnumsInPropertiesMap0Builder
+builder for `Map` + +A class that builds the Map input type + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| EnumsInPropertiesMap0Builder(Map instance)
Creates a builder that contains the passed instance | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| Map | build()
Returns map input that should be used with Schema.validate | +| [EnumsInPropertiesMap0Builder](#enumsinpropertiesmap0builder) | foo(value: String) | +| [EnumsInPropertiesMap0Builder](#enumsinpropertiesmap0builder) | foo(value: [StringFooEnums](#stringfooenums)) | +| [EnumsInPropertiesMap0Builder](#enumsinpropertiesmap0builder) | additionalProperty(key: String, value: Nothing?) | +| [EnumsInPropertiesMap0Builder](#enumsinpropertiesmap0builder) | additionalProperty(key: String, value: Boolean) | +| [EnumsInPropertiesMap0Builder](#enumsinpropertiesmap0builder) | additionalProperty(key: String, value: String) | +| [EnumsInPropertiesMap0Builder](#enumsinpropertiesmap0builder) | additionalProperty(key: String, value: Int) | +| [EnumsInPropertiesMap0Builder](#enumsinpropertiesmap0builder) | additionalProperty(key: String, value: Float) | +| [EnumsInPropertiesMap0Builder](#enumsinpropertiesmap0builder) | additionalProperty(key: String, value: Long) | +| [EnumsInPropertiesMap0Builder](#enumsinpropertiesmap0builder) | additionalProperty(key: String, value: Double) | +| [EnumsInPropertiesMap0Builder](#enumsinpropertiesmap0builder) | additionalProperty(key: String, value: List) | +| [EnumsInPropertiesMap0Builder](#enumsinpropertiesmap0builder) | additionalProperty(key: String, value: Map) | + +## EnumsInPropertiesMapBuilder +class EnumsInPropertiesMapBuilder
+builder for `Map` + +A class that builds the Map input type + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| EnumsInPropertiesMapBuilder()
Creates a builder that contains an empty map | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| [EnumsInPropertiesMap0Builder](#enumsinpropertiesmap0builder) | bar(value: String) | +| [EnumsInPropertiesMap0Builder](#enumsinpropertiesmap0builder) | bar(value: [StringBarEnums](#stringbarenums)) | + +## EnumsInPropertiesMap +class EnumsInPropertiesMap
+extends FrozenMap + +A class to store validated Map payloads + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| static [EnumsInPropertiesMap](#enumsinpropertiesmap) | of([Map](#enumsinpropertiesmapbuilder) arg, SchemaConfiguration configuration) | +| String | bar()
must be one of ["bar"] | +| String | foo()
[optional] must be one of ["foo"] | +| Any? | getAdditionalProperty(String name)
provides type safety for additional properties | + +## BarBoxed +sealed interface BarBoxed
+permits
+[BarBoxedString](#barboxedstring) + +sealed interface that stores validated payloads using boxed classes + +## BarBoxedString +data class BarBoxedString
+implements [BarBoxed](#barboxed) + +data class that stores validated String payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| BarBoxedString(String data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| String | data()
validated payload | +| Any? | getData()
validated payload | + +## Bar +class Bar
+extends JsonSchema + +A schema class that validates payloads + +### Code Sample +``` +import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags; +import org.openapijsonschematools.client.configurations.SchemaConfiguration; +import org.openapijsonschematools.client.exceptions.ValidationException; +import org.openapijsonschematools.client.schemas.validation.MapUtils; +import org.openapijsonschematools.client.schemas.validation.FrozenList; +import org.openapijsonschematools.client.schemas.validation.FrozenMap; +import org.openapijsonschematools.client.components.schemas.EnumsInProperties; + +import java.util.Arrays; +import java.util.List; +import java.util.AbstractMap; + +static final SchemaConfiguration configuration = new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().build()); + +// String validation +String validatedPayload = EnumsInProperties.Bar.validate( + "bar", + configuration +); +``` + +### Field Summary +| Modifier and Type | Field and Description | +| ----------------- | ---------------------- | +| Set> | type = setOf(
    String::class.java
)
| +| Set | enumValues = setOf(
    "bar"
)
| + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| String | validate(arg: String, configuration: SchemaConfiguration) | +| String | validate(arg: [StringBarEnums](#stringbarenums), configuration: SchemaConfiguration) | +| [BarBoxedString](#barboxedstring) | validateAndBox(String, configuration: SchemaConfiguration) | +| [BarBoxed](#barboxed) | validateAndBox(Any?, configuration: SchemaConfiguration) | +| Any? | validate(arg: Any?, configuration: SchemaConfiguration) | + +## StringBarEnums +public enum StringBarEnums
+extends `Enum` + +A class that stores String enum values + +### Enum Constant Summary +| Enum Constant | Description | +| ------------- | ----------- | +| BAR | value = "bar" | + +## FooBoxed +sealed interface FooBoxed
+permits
+[FooBoxedString](#fooboxedstring) + +sealed interface that stores validated payloads using boxed classes + +## FooBoxedString +data class FooBoxedString
+implements [FooBoxed](#fooboxed) + +data class that stores validated String payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| FooBoxedString(String data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| String | data()
validated payload | +| Any? | getData()
validated payload | + +## Foo +class Foo
+extends JsonSchema + +A schema class that validates payloads + +### Code Sample +``` +import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags; +import org.openapijsonschematools.client.configurations.SchemaConfiguration; +import org.openapijsonschematools.client.exceptions.ValidationException; +import org.openapijsonschematools.client.schemas.validation.MapUtils; +import org.openapijsonschematools.client.schemas.validation.FrozenList; +import org.openapijsonschematools.client.schemas.validation.FrozenMap; +import org.openapijsonschematools.client.components.schemas.EnumsInProperties; + +import java.util.Arrays; +import java.util.List; +import java.util.AbstractMap; + +static final SchemaConfiguration configuration = new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().build()); + +// String validation +String validatedPayload = EnumsInProperties.Foo.validate( + "foo", + configuration +); +``` + +### Field Summary +| Modifier and Type | Field and Description | +| ----------------- | ---------------------- | +| Set> | type = setOf(
    String::class.java
)
| +| Set | enumValues = setOf(
    "foo"
)
| + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| String | validate(arg: String, configuration: SchemaConfiguration) | +| String | validate(arg: [StringFooEnums](#stringfooenums), configuration: SchemaConfiguration) | +| [FooBoxedString](#fooboxedstring) | validateAndBox(String, configuration: SchemaConfiguration) | +| [FooBoxed](#fooboxed) | validateAndBox(Any?, configuration: SchemaConfiguration) | +| Any? | validate(arg: Any?, configuration: SchemaConfiguration) | + +## StringFooEnums +public enum StringFooEnums
+extends `Enum` + +A class that stores String enum values + +### Enum Constant Summary +| Enum Constant | Description | +| ------------- | ----------- | +| FOO | value = "foo" | + +[[Back to top]](#top) [[Back to Component Schemas]](../../../README.md#Component-Schemas) [[Back to README]](../../../README.md) diff --git a/samples/client/3_0_3_unit_test/kotlin/docs/components/schemas/ForbiddenProperty.md b/samples/client/3_0_3_unit_test/kotlin/docs/components/schemas/ForbiddenProperty.md new file mode 100644 index 00000000000..59362492629 --- /dev/null +++ b/samples/client/3_0_3_unit_test/kotlin/docs/components/schemas/ForbiddenProperty.md @@ -0,0 +1,353 @@ +# ForbiddenProperty +org.openapijsonschematools.client.components.schemas.ForbiddenProperty.java +class ForbiddenProperty
+ +A class that contains necessary nested +- schema classes (which validate payloads), extends JsonSchema +- sealed interfaces which store validated payloads, Kotlin version of a sum type +- boxed classes which store validated payloads, sealed permits class implementations +- classes to store validated map payloads, extends FrozenMap +- classes to build inputs for map payloads + +## Nested Class Summary +| Modifier and Type | Class and Description | +| ----------------- | ---------------------- | +| sealed interface | [ForbiddenProperty.ForbiddenProperty1Boxed](#forbiddenproperty1boxed)
sealed interface for validated payloads | +| record | [ForbiddenProperty.ForbiddenProperty1BoxedVoid](#forbiddenproperty1boxedvoid)
boxed class to store validated null payloads | +| record | [ForbiddenProperty.ForbiddenProperty1BoxedBoolean](#forbiddenproperty1boxedboolean)
boxed class to store validated boolean payloads | +| record | [ForbiddenProperty.ForbiddenProperty1BoxedNumber](#forbiddenproperty1boxednumber)
boxed class to store validated Number payloads | +| record | [ForbiddenProperty.ForbiddenProperty1BoxedString](#forbiddenproperty1boxedstring)
boxed class to store validated String payloads | +| record | [ForbiddenProperty.ForbiddenProperty1BoxedList](#forbiddenproperty1boxedlist)
boxed class to store validated List payloads | +| record | [ForbiddenProperty.ForbiddenProperty1BoxedMap](#forbiddenproperty1boxedmap)
boxed class to store validated Map payloads | +| static class | [ForbiddenProperty.ForbiddenProperty1](#forbiddenproperty1)
schema class | +| static class | [ForbiddenProperty.ForbiddenPropertyMapBuilder](#forbiddenpropertymapbuilder)
builder for Map payloads | +| static class | [ForbiddenProperty.ForbiddenPropertyMap](#forbiddenpropertymap)
output class for Map payloads | +| sealed interface | [ForbiddenProperty.FooBoxed](#fooboxed)
sealed interface for validated payloads | +| record | [ForbiddenProperty.FooBoxedVoid](#fooboxedvoid)
boxed class to store validated null payloads | +| record | [ForbiddenProperty.FooBoxedBoolean](#fooboxedboolean)
boxed class to store validated boolean payloads | +| record | [ForbiddenProperty.FooBoxedNumber](#fooboxednumber)
boxed class to store validated Number payloads | +| record | [ForbiddenProperty.FooBoxedString](#fooboxedstring)
boxed class to store validated String payloads | +| record | [ForbiddenProperty.FooBoxedList](#fooboxedlist)
boxed class to store validated List payloads | +| record | [ForbiddenProperty.FooBoxedMap](#fooboxedmap)
boxed class to store validated Map payloads | +| static class | [ForbiddenProperty.Foo](#foo)
schema class | + +## ForbiddenProperty1Boxed +sealed interface ForbiddenProperty1Boxed
+permits
+[ForbiddenProperty1BoxedVoid](#forbiddenproperty1boxedvoid), +[ForbiddenProperty1BoxedBoolean](#forbiddenproperty1boxedboolean), +[ForbiddenProperty1BoxedNumber](#forbiddenproperty1boxednumber), +[ForbiddenProperty1BoxedString](#forbiddenproperty1boxedstring), +[ForbiddenProperty1BoxedList](#forbiddenproperty1boxedlist), +[ForbiddenProperty1BoxedMap](#forbiddenproperty1boxedmap) + +sealed interface that stores validated payloads using boxed classes + +## ForbiddenProperty1BoxedVoid +data class ForbiddenProperty1BoxedVoid
+implements [ForbiddenProperty1Boxed](#forbiddenproperty1boxed) + +data class that stores validated null payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| ForbiddenProperty1BoxedVoid(Nothing? data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| Nothing? | data()
validated payload | +| Any? | getData()
validated payload | + +## ForbiddenProperty1BoxedBoolean +data class ForbiddenProperty1BoxedBoolean
+implements [ForbiddenProperty1Boxed](#forbiddenproperty1boxed) + +record that stores validated boolean payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| ForbiddenProperty1BoxedBoolean(boolean data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| boolean | data()
validated payload | +| Any? | getData()
validated payload | + +## ForbiddenProperty1BoxedNumber +data class ForbiddenProperty1BoxedNumber
+implements [ForbiddenProperty1Boxed](#forbiddenproperty1boxed) + +data class that stores validated Number payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| ForbiddenProperty1BoxedNumber(Number data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| Number | data()
validated payload | +| Any? | getData()
validated payload | + +## ForbiddenProperty1BoxedString +data class ForbiddenProperty1BoxedString
+implements [ForbiddenProperty1Boxed](#forbiddenproperty1boxed) + +data class that stores validated String payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| ForbiddenProperty1BoxedString(String data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| String | data()
validated payload | +| Any? | getData()
validated payload | + +## ForbiddenProperty1BoxedList +data class ForbiddenProperty1BoxedList
+implements [ForbiddenProperty1Boxed](#forbiddenproperty1boxed) + +data class that stores validated List payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| ForbiddenProperty1BoxedList(FrozenList data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| FrozenList | data()
validated payload | +| Any? | getData()
validated payload | + +## ForbiddenProperty1BoxedMap +data class ForbiddenProperty1BoxedMap
+implements [ForbiddenProperty1Boxed](#forbiddenproperty1boxed) + +data class that stores validated Map payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| ForbiddenProperty1BoxedMap([ForbiddenPropertyMap](#forbiddenpropertymap) data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| [ForbiddenPropertyMap](#forbiddenpropertymap) | data()
validated payload | +| Any? | getData()
validated payload | + +## ForbiddenProperty1 +class ForbiddenProperty1
+extends JsonSchema + +A schema class that validates payloads + +### Field Summary +| Modifier and Type | Field and Description | +| ----------------- | ---------------------- | +| Map> | properties = mapOf(
    "foo" to [Foo::class.java](#foo))
)
| + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| String | validate(arg: String, configuration: SchemaConfiguration) | +| Nothing? | validate(arg: Nothing?, configuration: SchemaConfiguration) | +| int | validate(arg: int, configuration: SchemaConfiguration) | +| long | validate(arg: long, configuration: SchemaConfiguration) | +| float | validate(arg: float, configuration: SchemaConfiguration) | +| double | validate(arg: double, configuration: SchemaConfiguration) | +| Number | validate(arg: Number, configuration: SchemaConfiguration) | +| boolean | validate(arg: boolean, configuration: SchemaConfiguration) | +| [ForbiddenPropertyMap](#forbiddenpropertymap) | validate(arg: [Map<?, ?>](#forbiddenpropertymapbuilder), configuration: SchemaConfiguration) | +| FrozenList | validate(arg: List<*>, configuration: SchemaConfiguration) | +| [ForbiddenProperty1BoxedString](#forbiddenproperty1boxedstring) | validateAndBox(String, configuration: SchemaConfiguration) | +| [ForbiddenProperty1BoxedVoid](#forbiddenproperty1boxedvoid) | validateAndBox(Nothing?, configuration: SchemaConfiguration) | +| [ForbiddenProperty1BoxedNumber](#forbiddenproperty1boxednumber) | validateAndBox(Number, configuration: SchemaConfiguration) | +| [ForbiddenProperty1BoxedBoolean](#forbiddenproperty1boxedboolean) | validateAndBox(boolean, configuration: SchemaConfiguration) | +| [ForbiddenProperty1BoxedMap](#forbiddenproperty1boxedmap) | validateAndBox([Map<?, ?>](#forbiddenpropertymapbuilder), configuration: SchemaConfiguration) | +| [ForbiddenProperty1BoxedList](#forbiddenproperty1boxedlist) | validateAndBox(List<*>, configuration: SchemaConfiguration) | +| [ForbiddenProperty1Boxed](#forbiddenproperty1boxed) | validateAndBox(Any?, configuration: SchemaConfiguration) | +| Any? | validate(arg: Any?, configuration: SchemaConfiguration) | + +## ForbiddenPropertyMapBuilder +class ForbiddenPropertyMapBuilder
+builder for `Map` + +A class that builds the Map input type + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| ForbiddenPropertyMapBuilder()
Creates a builder that contains an empty map | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| Map | build()
Returns map input that should be used with Schema.validate | +| [ForbiddenPropertyMapBuilder](#forbiddenpropertymapbuilder) | foo(value: Nothing?) | +| [ForbiddenPropertyMapBuilder](#forbiddenpropertymapbuilder) | foo(value: Boolean) | +| [ForbiddenPropertyMapBuilder](#forbiddenpropertymapbuilder) | foo(value: String) | +| [ForbiddenPropertyMapBuilder](#forbiddenpropertymapbuilder) | foo(value: Int) | +| [ForbiddenPropertyMapBuilder](#forbiddenpropertymapbuilder) | foo(value: Float) | +| [ForbiddenPropertyMapBuilder](#forbiddenpropertymapbuilder) | foo(value: Long) | +| [ForbiddenPropertyMapBuilder](#forbiddenpropertymapbuilder) | foo(value: Double) | +| [ForbiddenPropertyMapBuilder](#forbiddenpropertymapbuilder) | foo(value: List) | +| [ForbiddenPropertyMapBuilder](#forbiddenpropertymapbuilder) | foo(value: Map) | +| [ForbiddenPropertyMapBuilder](#forbiddenpropertymapbuilder) | additionalProperty(key: String, value: Nothing?) | +| [ForbiddenPropertyMapBuilder](#forbiddenpropertymapbuilder) | additionalProperty(key: String, value: Boolean) | +| [ForbiddenPropertyMapBuilder](#forbiddenpropertymapbuilder) | additionalProperty(key: String, value: String) | +| [ForbiddenPropertyMapBuilder](#forbiddenpropertymapbuilder) | additionalProperty(key: String, value: Int) | +| [ForbiddenPropertyMapBuilder](#forbiddenpropertymapbuilder) | additionalProperty(key: String, value: Float) | +| [ForbiddenPropertyMapBuilder](#forbiddenpropertymapbuilder) | additionalProperty(key: String, value: Long) | +| [ForbiddenPropertyMapBuilder](#forbiddenpropertymapbuilder) | additionalProperty(key: String, value: Double) | +| [ForbiddenPropertyMapBuilder](#forbiddenpropertymapbuilder) | additionalProperty(key: String, value: List) | +| [ForbiddenPropertyMapBuilder](#forbiddenpropertymapbuilder) | additionalProperty(key: String, value: Map) | + +## ForbiddenPropertyMap +class ForbiddenPropertyMap
+extends FrozenMap + +A class to store validated Map payloads + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| static [ForbiddenPropertyMap](#forbiddenpropertymap) | of([Map](#forbiddenpropertymapbuilder) arg, SchemaConfiguration configuration) | +| Any? | foo()
[optional] | +| Any? | getAdditionalProperty(String name)
provides type safety for additional properties | + +## FooBoxed +sealed interface FooBoxed
+permits
+[FooBoxedVoid](#fooboxedvoid), +[FooBoxedBoolean](#fooboxedboolean), +[FooBoxedNumber](#fooboxednumber), +[FooBoxedString](#fooboxedstring), +[FooBoxedList](#fooboxedlist), +[FooBoxedMap](#fooboxedmap) + +sealed interface that stores validated payloads using boxed classes + +## FooBoxedVoid +data class FooBoxedVoid
+implements [FooBoxed](#fooboxed) + +data class that stores validated null payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| FooBoxedVoid(Nothing? data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| Nothing? | data()
validated payload | +| Any? | getData()
validated payload | + +## FooBoxedBoolean +data class FooBoxedBoolean
+implements [FooBoxed](#fooboxed) + +record that stores validated boolean payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| FooBoxedBoolean(boolean data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| boolean | data()
validated payload | +| Any? | getData()
validated payload | + +## FooBoxedNumber +data class FooBoxedNumber
+implements [FooBoxed](#fooboxed) + +data class that stores validated Number payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| FooBoxedNumber(Number data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| Number | data()
validated payload | +| Any? | getData()
validated payload | + +## FooBoxedString +data class FooBoxedString
+implements [FooBoxed](#fooboxed) + +data class that stores validated String payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| FooBoxedString(String data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| String | data()
validated payload | +| Any? | getData()
validated payload | + +## FooBoxedList +data class FooBoxedList
+implements [FooBoxed](#fooboxed) + +data class that stores validated List payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| FooBoxedList(FrozenList data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| FrozenList | data()
validated payload | +| Any? | getData()
validated payload | + +## FooBoxedMap +data class FooBoxedMap
+implements [FooBoxed](#fooboxed) + +data class that stores validated Map payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| FooBoxedMap(FrozenMap data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| FrozenMap | data()
validated payload | +| Any? | getData()
validated payload | + +## Foo +class Foo
+extends NotAnyTypeJsonSchema.NotAnyTypeJsonSchema1 + +A schema class that validates payloads + +| Methods Inherited from class org.openapijsonschematools.client.schemas.NotAnyTypeJsonSchema.NotAnyTypeJsonSchema1 | +| ------------------------------------------------------------------ | +| validate | +| validateAndBox | + +[[Back to top]](#top) [[Back to Component Schemas]](../../../README.md#Component-Schemas) [[Back to README]](../../../README.md) diff --git a/samples/client/3_0_3_unit_test/kotlin/docs/components/schemas/HostnameFormat.md b/samples/client/3_0_3_unit_test/kotlin/docs/components/schemas/HostnameFormat.md new file mode 100644 index 00000000000..9bfb2c2b465 --- /dev/null +++ b/samples/client/3_0_3_unit_test/kotlin/docs/components/schemas/HostnameFormat.md @@ -0,0 +1,169 @@ +# HostnameFormat +org.openapijsonschematools.client.components.schemas.HostnameFormat.java +class HostnameFormat
+ +A class that contains necessary nested +- schema classes (which validate payloads), extends JsonSchema +- sealed interfaces which store validated payloads, Kotlin version of a sum type +- boxed classes which store validated payloads, sealed permits class implementations + +## Nested Class Summary +| Modifier and Type | Class and Description | +| ----------------- | ---------------------- | +| sealed interface | [HostnameFormat.HostnameFormat1Boxed](#hostnameformat1boxed)
sealed interface for validated payloads | +| record | [HostnameFormat.HostnameFormat1BoxedVoid](#hostnameformat1boxedvoid)
boxed class to store validated null payloads | +| record | [HostnameFormat.HostnameFormat1BoxedBoolean](#hostnameformat1boxedboolean)
boxed class to store validated boolean payloads | +| record | [HostnameFormat.HostnameFormat1BoxedNumber](#hostnameformat1boxednumber)
boxed class to store validated Number payloads | +| record | [HostnameFormat.HostnameFormat1BoxedString](#hostnameformat1boxedstring)
boxed class to store validated String payloads | +| record | [HostnameFormat.HostnameFormat1BoxedList](#hostnameformat1boxedlist)
boxed class to store validated List payloads | +| record | [HostnameFormat.HostnameFormat1BoxedMap](#hostnameformat1boxedmap)
boxed class to store validated Map payloads | +| static class | [HostnameFormat.HostnameFormat1](#hostnameformat1)
schema class | + +## HostnameFormat1Boxed +sealed interface HostnameFormat1Boxed
+permits
+[HostnameFormat1BoxedVoid](#hostnameformat1boxedvoid), +[HostnameFormat1BoxedBoolean](#hostnameformat1boxedboolean), +[HostnameFormat1BoxedNumber](#hostnameformat1boxednumber), +[HostnameFormat1BoxedString](#hostnameformat1boxedstring), +[HostnameFormat1BoxedList](#hostnameformat1boxedlist), +[HostnameFormat1BoxedMap](#hostnameformat1boxedmap) + +sealed interface that stores validated payloads using boxed classes + +## HostnameFormat1BoxedVoid +data class HostnameFormat1BoxedVoid
+implements [HostnameFormat1Boxed](#hostnameformat1boxed) + +data class that stores validated null payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| HostnameFormat1BoxedVoid(Nothing? data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| Nothing? | data()
validated payload | +| Any? | getData()
validated payload | + +## HostnameFormat1BoxedBoolean +data class HostnameFormat1BoxedBoolean
+implements [HostnameFormat1Boxed](#hostnameformat1boxed) + +record that stores validated boolean payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| HostnameFormat1BoxedBoolean(boolean data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| boolean | data()
validated payload | +| Any? | getData()
validated payload | + +## HostnameFormat1BoxedNumber +data class HostnameFormat1BoxedNumber
+implements [HostnameFormat1Boxed](#hostnameformat1boxed) + +data class that stores validated Number payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| HostnameFormat1BoxedNumber(Number data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| Number | data()
validated payload | +| Any? | getData()
validated payload | + +## HostnameFormat1BoxedString +data class HostnameFormat1BoxedString
+implements [HostnameFormat1Boxed](#hostnameformat1boxed) + +data class that stores validated String payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| HostnameFormat1BoxedString(String data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| String | data()
validated payload | +| Any? | getData()
validated payload | + +## HostnameFormat1BoxedList +data class HostnameFormat1BoxedList
+implements [HostnameFormat1Boxed](#hostnameformat1boxed) + +data class that stores validated List payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| HostnameFormat1BoxedList(FrozenList data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| FrozenList | data()
validated payload | +| Any? | getData()
validated payload | + +## HostnameFormat1BoxedMap +data class HostnameFormat1BoxedMap
+implements [HostnameFormat1Boxed](#hostnameformat1boxed) + +data class that stores validated Map payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| HostnameFormat1BoxedMap(FrozenMap data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| FrozenMap | data()
validated payload | +| Any? | getData()
validated payload | + +## HostnameFormat1 +class HostnameFormat1
+extends JsonSchema + +A schema class that validates payloads + +### Field Summary +| Modifier and Type | Field and Description | +| ----------------- | ---------------------- | +| String | type = "hostname"; | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| String | validate(arg: String, configuration: SchemaConfiguration) | +| Nothing? | validate(arg: Nothing?, configuration: SchemaConfiguration) | +| int | validate(arg: int, configuration: SchemaConfiguration) | +| long | validate(arg: long, configuration: SchemaConfiguration) | +| float | validate(arg: float, configuration: SchemaConfiguration) | +| double | validate(arg: double, configuration: SchemaConfiguration) | +| Number | validate(arg: Number, configuration: SchemaConfiguration) | +| boolean | validate(arg: boolean, configuration: SchemaConfiguration) | +| FrozenMap | validate(arg: Map<?, ?>, configuration: SchemaConfiguration) | +| FrozenList | validate(arg: List<*>, configuration: SchemaConfiguration) | +| [HostnameFormat1BoxedString](#hostnameformat1boxedstring) | validateAndBox(String, configuration: SchemaConfiguration) | +| [HostnameFormat1BoxedVoid](#hostnameformat1boxedvoid) | validateAndBox(Nothing?, configuration: SchemaConfiguration) | +| [HostnameFormat1BoxedNumber](#hostnameformat1boxednumber) | validateAndBox(Number, configuration: SchemaConfiguration) | +| [HostnameFormat1BoxedBoolean](#hostnameformat1boxedboolean) | validateAndBox(boolean, configuration: SchemaConfiguration) | +| [HostnameFormat1BoxedMap](#hostnameformat1boxedmap) | validateAndBox(Map<?, ?>, configuration: SchemaConfiguration) | +| [HostnameFormat1BoxedList](#hostnameformat1boxedlist) | validateAndBox(List<*>, configuration: SchemaConfiguration) | +| [HostnameFormat1Boxed](#hostnameformat1boxed) | validateAndBox(Any?, configuration: SchemaConfiguration) | +| Any? | validate(arg: Any?, configuration: SchemaConfiguration) | + +[[Back to top]](#top) [[Back to Component Schemas]](../../../README.md#Component-Schemas) [[Back to README]](../../../README.md) diff --git a/samples/client/3_0_3_unit_test/kotlin/docs/components/schemas/IntegerTypeMatchesIntegers.md b/samples/client/3_0_3_unit_test/kotlin/docs/components/schemas/IntegerTypeMatchesIntegers.md new file mode 100644 index 00000000000..39131a09a05 --- /dev/null +++ b/samples/client/3_0_3_unit_test/kotlin/docs/components/schemas/IntegerTypeMatchesIntegers.md @@ -0,0 +1,52 @@ +# IntegerTypeMatchesIntegers +org.openapijsonschematools.client.components.schemas.IntegerTypeMatchesIntegers.java +class IntegerTypeMatchesIntegers
+ +A class that contains necessary nested +- schema classes (which validate payloads), extends JsonSchema +- sealed interfaces which store validated payloads, Kotlin version of a sum type +- boxed classes which store validated payloads, sealed permits class implementations + +## Nested Class Summary +| Modifier and Type | Class and Description | +| ----------------- | ---------------------- | +| sealed interface | [IntegerTypeMatchesIntegers.IntegerTypeMatchesIntegers1Boxed](#integertypematchesintegers1boxed)
sealed interface for validated payloads | +| record | [IntegerTypeMatchesIntegers.IntegerTypeMatchesIntegers1BoxedNumber](#integertypematchesintegers1boxednumber)
boxed class to store validated Number payloads | +| static class | [IntegerTypeMatchesIntegers.IntegerTypeMatchesIntegers1](#integertypematchesintegers1)
schema class | + +## IntegerTypeMatchesIntegers1Boxed +sealed interface IntegerTypeMatchesIntegers1Boxed
+permits
+[IntegerTypeMatchesIntegers1BoxedNumber](#integertypematchesintegers1boxednumber) + +sealed interface that stores validated payloads using boxed classes + +## IntegerTypeMatchesIntegers1BoxedNumber +data class IntegerTypeMatchesIntegers1BoxedNumber
+implements [IntegerTypeMatchesIntegers1Boxed](#integertypematchesintegers1boxed) + +data class that stores validated Number payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| IntegerTypeMatchesIntegers1BoxedNumber(Number data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| Number | data()
validated payload | +| Any? | getData()
validated payload | + +## IntegerTypeMatchesIntegers1 +class IntegerTypeMatchesIntegers1
+extends IntJsonSchema.IntJsonSchema1 + +A schema class that validates payloads + +| Methods Inherited from class org.openapijsonschematools.client.schemas.IntJsonSchema.IntJsonSchema1 | +| ------------------------------------------------------------------ | +| validate | +| validateAndBox | + +[[Back to top]](#top) [[Back to Component Schemas]](../../../README.md#Component-Schemas) [[Back to README]](../../../README.md) diff --git a/samples/client/3_0_3_unit_test/kotlin/docs/components/schemas/InvalidInstanceShouldNotRaiseErrorWhenFloatDivisionInf.md b/samples/client/3_0_3_unit_test/kotlin/docs/components/schemas/InvalidInstanceShouldNotRaiseErrorWhenFloatDivisionInf.md new file mode 100644 index 00000000000..75d8899d5fb --- /dev/null +++ b/samples/client/3_0_3_unit_test/kotlin/docs/components/schemas/InvalidInstanceShouldNotRaiseErrorWhenFloatDivisionInf.md @@ -0,0 +1,85 @@ +# InvalidInstanceShouldNotRaiseErrorWhenFloatDivisionInf +org.openapijsonschematools.client.components.schemas.InvalidInstanceShouldNotRaiseErrorWhenFloatDivisionInf.java +class InvalidInstanceShouldNotRaiseErrorWhenFloatDivisionInf
+ +A class that contains necessary nested +- schema classes (which validate payloads), extends JsonSchema +- sealed interfaces which store validated payloads, Kotlin version of a sum type +- boxed classes which store validated payloads, sealed permits class implementations + +## Nested Class Summary +| Modifier and Type | Class and Description | +| ----------------- | ---------------------- | +| sealed interface | [InvalidInstanceShouldNotRaiseErrorWhenFloatDivisionInf.InvalidInstanceShouldNotRaiseErrorWhenFloatDivisionInf1Boxed](#invalidinstanceshouldnotraiseerrorwhenfloatdivisioninf1boxed)
sealed interface for validated payloads | +| record | [InvalidInstanceShouldNotRaiseErrorWhenFloatDivisionInf.InvalidInstanceShouldNotRaiseErrorWhenFloatDivisionInf1BoxedNumber](#invalidinstanceshouldnotraiseerrorwhenfloatdivisioninf1boxednumber)
boxed class to store validated Number payloads | +| static class | [InvalidInstanceShouldNotRaiseErrorWhenFloatDivisionInf.InvalidInstanceShouldNotRaiseErrorWhenFloatDivisionInf1](#invalidinstanceshouldnotraiseerrorwhenfloatdivisioninf1)
schema class | + +## InvalidInstanceShouldNotRaiseErrorWhenFloatDivisionInf1Boxed +sealed interface InvalidInstanceShouldNotRaiseErrorWhenFloatDivisionInf1Boxed
+permits
+[InvalidInstanceShouldNotRaiseErrorWhenFloatDivisionInf1BoxedNumber](#invalidinstanceshouldnotraiseerrorwhenfloatdivisioninf1boxednumber) + +sealed interface that stores validated payloads using boxed classes + +## InvalidInstanceShouldNotRaiseErrorWhenFloatDivisionInf1BoxedNumber +data class InvalidInstanceShouldNotRaiseErrorWhenFloatDivisionInf1BoxedNumber
+implements [InvalidInstanceShouldNotRaiseErrorWhenFloatDivisionInf1Boxed](#invalidinstanceshouldnotraiseerrorwhenfloatdivisioninf1boxed) + +data class that stores validated Number payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| InvalidInstanceShouldNotRaiseErrorWhenFloatDivisionInf1BoxedNumber(Number data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| Number | data()
validated payload | +| Any? | getData()
validated payload | + +## InvalidInstanceShouldNotRaiseErrorWhenFloatDivisionInf1 +class InvalidInstanceShouldNotRaiseErrorWhenFloatDivisionInf1
+extends JsonSchema + +A schema class that validates payloads + +### Code Sample +``` +import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags; +import org.openapijsonschematools.client.configurations.SchemaConfiguration; +import org.openapijsonschematools.client.exceptions.ValidationException; +import org.openapijsonschematools.client.schemas.validation.MapUtils; +import org.openapijsonschematools.client.schemas.validation.FrozenList; +import org.openapijsonschematools.client.schemas.validation.FrozenMap; +import org.openapijsonschematools.client.components.schemas.InvalidInstanceShouldNotRaiseErrorWhenFloatDivisionInf; + +import java.util.Arrays; +import java.util.List; +import java.util.AbstractMap; + +static final SchemaConfiguration configuration = new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().build()); + +// int validation +int validatedPayload = InvalidInstanceShouldNotRaiseErrorWhenFloatDivisionInf.InvalidInstanceShouldNotRaiseErrorWhenFloatDivisionInf1.validate( + 1L, + configuration +); +``` + +### Field Summary +| Modifier and Type | Field and Description | +| ----------------- | ---------------------- | +| Set> | type = setOf(
    Int::class.java,
    Long::class.java,
    Float::class.java,
    Double::class.java
)
| +| String | type = "int"; | +| BigDecimal | multipleOf = BigDecimal("0.123456789") | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| long | validate(arg: long, configuration: SchemaConfiguration) | +| [InvalidInstanceShouldNotRaiseErrorWhenFloatDivisionInf1BoxedNumber](#invalidinstanceshouldnotraiseerrorwhenfloatdivisioninf1boxednumber) | validateAndBox(Number, configuration: SchemaConfiguration) | +| [InvalidInstanceShouldNotRaiseErrorWhenFloatDivisionInf1Boxed](#invalidinstanceshouldnotraiseerrorwhenfloatdivisioninf1boxed) | validateAndBox(Any?, configuration: SchemaConfiguration) | +| Any? | validate(arg: Any?, configuration: SchemaConfiguration) | + +[[Back to top]](#top) [[Back to Component Schemas]](../../../README.md#Component-Schemas) [[Back to README]](../../../README.md) diff --git a/samples/client/3_0_3_unit_test/kotlin/docs/components/schemas/InvalidStringValueForDefault.md b/samples/client/3_0_3_unit_test/kotlin/docs/components/schemas/InvalidStringValueForDefault.md new file mode 100644 index 00000000000..d94689558b8 --- /dev/null +++ b/samples/client/3_0_3_unit_test/kotlin/docs/components/schemas/InvalidStringValueForDefault.md @@ -0,0 +1,283 @@ +# InvalidStringValueForDefault +org.openapijsonschematools.client.components.schemas.InvalidStringValueForDefault.java +class InvalidStringValueForDefault
+ +A class that contains necessary nested +- schema classes (which validate payloads), extends JsonSchema +- sealed interfaces which store validated payloads, Kotlin version of a sum type +- boxed classes which store validated payloads, sealed permits class implementations +- classes to store validated map payloads, extends FrozenMap +- classes to build inputs for map payloads + +## Nested Class Summary +| Modifier and Type | Class and Description | +| ----------------- | ---------------------- | +| sealed interface | [InvalidStringValueForDefault.InvalidStringValueForDefault1Boxed](#invalidstringvaluefordefault1boxed)
sealed interface for validated payloads | +| record | [InvalidStringValueForDefault.InvalidStringValueForDefault1BoxedVoid](#invalidstringvaluefordefault1boxedvoid)
boxed class to store validated null payloads | +| record | [InvalidStringValueForDefault.InvalidStringValueForDefault1BoxedBoolean](#invalidstringvaluefordefault1boxedboolean)
boxed class to store validated boolean payloads | +| record | [InvalidStringValueForDefault.InvalidStringValueForDefault1BoxedNumber](#invalidstringvaluefordefault1boxednumber)
boxed class to store validated Number payloads | +| record | [InvalidStringValueForDefault.InvalidStringValueForDefault1BoxedString](#invalidstringvaluefordefault1boxedstring)
boxed class to store validated String payloads | +| record | [InvalidStringValueForDefault.InvalidStringValueForDefault1BoxedList](#invalidstringvaluefordefault1boxedlist)
boxed class to store validated List payloads | +| record | [InvalidStringValueForDefault.InvalidStringValueForDefault1BoxedMap](#invalidstringvaluefordefault1boxedmap)
boxed class to store validated Map payloads | +| static class | [InvalidStringValueForDefault.InvalidStringValueForDefault1](#invalidstringvaluefordefault1)
schema class | +| static class | [InvalidStringValueForDefault.InvalidStringValueForDefaultMapBuilder](#invalidstringvaluefordefaultmapbuilder)
builder for Map payloads | +| static class | [InvalidStringValueForDefault.InvalidStringValueForDefaultMap](#invalidstringvaluefordefaultmap)
output class for Map payloads | +| sealed interface | [InvalidStringValueForDefault.BarBoxed](#barboxed)
sealed interface for validated payloads | +| record | [InvalidStringValueForDefault.BarBoxedString](#barboxedstring)
boxed class to store validated String payloads | +| static class | [InvalidStringValueForDefault.Bar](#bar)
schema class | + +## InvalidStringValueForDefault1Boxed +sealed interface InvalidStringValueForDefault1Boxed
+permits
+[InvalidStringValueForDefault1BoxedVoid](#invalidstringvaluefordefault1boxedvoid), +[InvalidStringValueForDefault1BoxedBoolean](#invalidstringvaluefordefault1boxedboolean), +[InvalidStringValueForDefault1BoxedNumber](#invalidstringvaluefordefault1boxednumber), +[InvalidStringValueForDefault1BoxedString](#invalidstringvaluefordefault1boxedstring), +[InvalidStringValueForDefault1BoxedList](#invalidstringvaluefordefault1boxedlist), +[InvalidStringValueForDefault1BoxedMap](#invalidstringvaluefordefault1boxedmap) + +sealed interface that stores validated payloads using boxed classes + +## InvalidStringValueForDefault1BoxedVoid +data class InvalidStringValueForDefault1BoxedVoid
+implements [InvalidStringValueForDefault1Boxed](#invalidstringvaluefordefault1boxed) + +data class that stores validated null payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| InvalidStringValueForDefault1BoxedVoid(Nothing? data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| Nothing? | data()
validated payload | +| Any? | getData()
validated payload | + +## InvalidStringValueForDefault1BoxedBoolean +data class InvalidStringValueForDefault1BoxedBoolean
+implements [InvalidStringValueForDefault1Boxed](#invalidstringvaluefordefault1boxed) + +record that stores validated boolean payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| InvalidStringValueForDefault1BoxedBoolean(boolean data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| boolean | data()
validated payload | +| Any? | getData()
validated payload | + +## InvalidStringValueForDefault1BoxedNumber +data class InvalidStringValueForDefault1BoxedNumber
+implements [InvalidStringValueForDefault1Boxed](#invalidstringvaluefordefault1boxed) + +data class that stores validated Number payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| InvalidStringValueForDefault1BoxedNumber(Number data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| Number | data()
validated payload | +| Any? | getData()
validated payload | + +## InvalidStringValueForDefault1BoxedString +data class InvalidStringValueForDefault1BoxedString
+implements [InvalidStringValueForDefault1Boxed](#invalidstringvaluefordefault1boxed) + +data class that stores validated String payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| InvalidStringValueForDefault1BoxedString(String data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| String | data()
validated payload | +| Any? | getData()
validated payload | + +## InvalidStringValueForDefault1BoxedList +data class InvalidStringValueForDefault1BoxedList
+implements [InvalidStringValueForDefault1Boxed](#invalidstringvaluefordefault1boxed) + +data class that stores validated List payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| InvalidStringValueForDefault1BoxedList(FrozenList data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| FrozenList | data()
validated payload | +| Any? | getData()
validated payload | + +## InvalidStringValueForDefault1BoxedMap +data class InvalidStringValueForDefault1BoxedMap
+implements [InvalidStringValueForDefault1Boxed](#invalidstringvaluefordefault1boxed) + +data class that stores validated Map payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| InvalidStringValueForDefault1BoxedMap([InvalidStringValueForDefaultMap](#invalidstringvaluefordefaultmap) data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| [InvalidStringValueForDefaultMap](#invalidstringvaluefordefaultmap) | data()
validated payload | +| Any? | getData()
validated payload | + +## InvalidStringValueForDefault1 +class InvalidStringValueForDefault1
+extends JsonSchema + +A schema class that validates payloads + +### Field Summary +| Modifier and Type | Field and Description | +| ----------------- | ---------------------- | +| Map> | properties = mapOf(
    "bar" to [Bar::class.java](#bar))
)
| + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| String | validate(arg: String, configuration: SchemaConfiguration) | +| Nothing? | validate(arg: Nothing?, configuration: SchemaConfiguration) | +| int | validate(arg: int, configuration: SchemaConfiguration) | +| long | validate(arg: long, configuration: SchemaConfiguration) | +| float | validate(arg: float, configuration: SchemaConfiguration) | +| double | validate(arg: double, configuration: SchemaConfiguration) | +| Number | validate(arg: Number, configuration: SchemaConfiguration) | +| boolean | validate(arg: boolean, configuration: SchemaConfiguration) | +| [InvalidStringValueForDefaultMap](#invalidstringvaluefordefaultmap) | validate(arg: [Map<?, ?>](#invalidstringvaluefordefaultmapbuilder), configuration: SchemaConfiguration) | +| FrozenList | validate(arg: List<*>, configuration: SchemaConfiguration) | +| [InvalidStringValueForDefault1BoxedString](#invalidstringvaluefordefault1boxedstring) | validateAndBox(String, configuration: SchemaConfiguration) | +| [InvalidStringValueForDefault1BoxedVoid](#invalidstringvaluefordefault1boxedvoid) | validateAndBox(Nothing?, configuration: SchemaConfiguration) | +| [InvalidStringValueForDefault1BoxedNumber](#invalidstringvaluefordefault1boxednumber) | validateAndBox(Number, configuration: SchemaConfiguration) | +| [InvalidStringValueForDefault1BoxedBoolean](#invalidstringvaluefordefault1boxedboolean) | validateAndBox(boolean, configuration: SchemaConfiguration) | +| [InvalidStringValueForDefault1BoxedMap](#invalidstringvaluefordefault1boxedmap) | validateAndBox([Map<?, ?>](#invalidstringvaluefordefaultmapbuilder), configuration: SchemaConfiguration) | +| [InvalidStringValueForDefault1BoxedList](#invalidstringvaluefordefault1boxedlist) | validateAndBox(List<*>, configuration: SchemaConfiguration) | +| [InvalidStringValueForDefault1Boxed](#invalidstringvaluefordefault1boxed) | validateAndBox(Any?, configuration: SchemaConfiguration) | +| Any? | validate(arg: Any?, configuration: SchemaConfiguration) | + +## InvalidStringValueForDefaultMapBuilder +class InvalidStringValueForDefaultMapBuilder
+builder for `Map` + +A class that builds the Map input type + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| InvalidStringValueForDefaultMapBuilder()
Creates a builder that contains an empty map | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| Map | build()
Returns map input that should be used with Schema.validate | +| [InvalidStringValueForDefaultMapBuilder](#invalidstringvaluefordefaultmapbuilder) | bar(value: String) | +| [InvalidStringValueForDefaultMapBuilder](#invalidstringvaluefordefaultmapbuilder) | additionalProperty(key: String, value: Nothing?) | +| [InvalidStringValueForDefaultMapBuilder](#invalidstringvaluefordefaultmapbuilder) | additionalProperty(key: String, value: Boolean) | +| [InvalidStringValueForDefaultMapBuilder](#invalidstringvaluefordefaultmapbuilder) | additionalProperty(key: String, value: String) | +| [InvalidStringValueForDefaultMapBuilder](#invalidstringvaluefordefaultmapbuilder) | additionalProperty(key: String, value: Int) | +| [InvalidStringValueForDefaultMapBuilder](#invalidstringvaluefordefaultmapbuilder) | additionalProperty(key: String, value: Float) | +| [InvalidStringValueForDefaultMapBuilder](#invalidstringvaluefordefaultmapbuilder) | additionalProperty(key: String, value: Long) | +| [InvalidStringValueForDefaultMapBuilder](#invalidstringvaluefordefaultmapbuilder) | additionalProperty(key: String, value: Double) | +| [InvalidStringValueForDefaultMapBuilder](#invalidstringvaluefordefaultmapbuilder) | additionalProperty(key: String, value: List) | +| [InvalidStringValueForDefaultMapBuilder](#invalidstringvaluefordefaultmapbuilder) | additionalProperty(key: String, value: Map) | + +## InvalidStringValueForDefaultMap +class InvalidStringValueForDefaultMap
+extends FrozenMap + +A class to store validated Map payloads + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| static [InvalidStringValueForDefaultMap](#invalidstringvaluefordefaultmap) | of([Map](#invalidstringvaluefordefaultmapbuilder) arg, SchemaConfiguration configuration) | +| String | bar()
[optional] if omitted the server will use the default value of bad | +| Any? | getAdditionalProperty(String name)
provides type safety for additional properties | + +## BarBoxed +sealed interface BarBoxed
+permits
+[BarBoxedString](#barboxedstring) + +sealed interface that stores validated payloads using boxed classes + +## BarBoxedString +data class BarBoxedString
+implements [BarBoxed](#barboxed) + +data class that stores validated String payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| BarBoxedString(String data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| String | data()
validated payload | +| Any? | getData()
validated payload | + +## Bar +class Bar
+extends JsonSchema + +A schema class that validates payloads + +### Code Sample +``` +import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags; +import org.openapijsonschematools.client.configurations.SchemaConfiguration; +import org.openapijsonschematools.client.exceptions.ValidationException; +import org.openapijsonschematools.client.schemas.validation.MapUtils; +import org.openapijsonschematools.client.schemas.validation.FrozenList; +import org.openapijsonschematools.client.schemas.validation.FrozenMap; +import org.openapijsonschematools.client.components.schemas.InvalidStringValueForDefault; + +import java.util.Arrays; +import java.util.List; +import java.util.AbstractMap; + +static final SchemaConfiguration configuration = new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().build()); + +// String validation +String validatedPayload = InvalidStringValueForDefault.Bar.validate( + "a", + configuration +); +``` + +### Field Summary +| Modifier and Type | Field and Description | +| ----------------- | ---------------------- | +| Set> | type = setOf(
    String::class.java
)
| +| Integer | minLength = 4 | +| Any? | defaultValue = "bad" | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| String | validate(arg: String, configuration: SchemaConfiguration) | +| [BarBoxedString](#barboxedstring) | validateAndBox(String, configuration: SchemaConfiguration) | +| [BarBoxed](#barboxed) | validateAndBox(Any?, configuration: SchemaConfiguration) | +| Any? | validate(arg: Any?, configuration: SchemaConfiguration) | + +[[Back to top]](#top) [[Back to Component Schemas]](../../../README.md#Component-Schemas) [[Back to README]](../../../README.md) diff --git a/samples/client/3_0_3_unit_test/kotlin/docs/components/schemas/Ipv4Format.md b/samples/client/3_0_3_unit_test/kotlin/docs/components/schemas/Ipv4Format.md new file mode 100644 index 00000000000..0ddec8c4233 --- /dev/null +++ b/samples/client/3_0_3_unit_test/kotlin/docs/components/schemas/Ipv4Format.md @@ -0,0 +1,169 @@ +# Ipv4Format +org.openapijsonschematools.client.components.schemas.Ipv4Format.java +class Ipv4Format
+ +A class that contains necessary nested +- schema classes (which validate payloads), extends JsonSchema +- sealed interfaces which store validated payloads, Kotlin version of a sum type +- boxed classes which store validated payloads, sealed permits class implementations + +## Nested Class Summary +| Modifier and Type | Class and Description | +| ----------------- | ---------------------- | +| sealed interface | [Ipv4Format.Ipv4Format1Boxed](#ipv4format1boxed)
sealed interface for validated payloads | +| record | [Ipv4Format.Ipv4Format1BoxedVoid](#ipv4format1boxedvoid)
boxed class to store validated null payloads | +| record | [Ipv4Format.Ipv4Format1BoxedBoolean](#ipv4format1boxedboolean)
boxed class to store validated boolean payloads | +| record | [Ipv4Format.Ipv4Format1BoxedNumber](#ipv4format1boxednumber)
boxed class to store validated Number payloads | +| record | [Ipv4Format.Ipv4Format1BoxedString](#ipv4format1boxedstring)
boxed class to store validated String payloads | +| record | [Ipv4Format.Ipv4Format1BoxedList](#ipv4format1boxedlist)
boxed class to store validated List payloads | +| record | [Ipv4Format.Ipv4Format1BoxedMap](#ipv4format1boxedmap)
boxed class to store validated Map payloads | +| static class | [Ipv4Format.Ipv4Format1](#ipv4format1)
schema class | + +## Ipv4Format1Boxed +sealed interface Ipv4Format1Boxed
+permits
+[Ipv4Format1BoxedVoid](#ipv4format1boxedvoid), +[Ipv4Format1BoxedBoolean](#ipv4format1boxedboolean), +[Ipv4Format1BoxedNumber](#ipv4format1boxednumber), +[Ipv4Format1BoxedString](#ipv4format1boxedstring), +[Ipv4Format1BoxedList](#ipv4format1boxedlist), +[Ipv4Format1BoxedMap](#ipv4format1boxedmap) + +sealed interface that stores validated payloads using boxed classes + +## Ipv4Format1BoxedVoid +data class Ipv4Format1BoxedVoid
+implements [Ipv4Format1Boxed](#ipv4format1boxed) + +data class that stores validated null payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| Ipv4Format1BoxedVoid(Nothing? data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| Nothing? | data()
validated payload | +| Any? | getData()
validated payload | + +## Ipv4Format1BoxedBoolean +data class Ipv4Format1BoxedBoolean
+implements [Ipv4Format1Boxed](#ipv4format1boxed) + +record that stores validated boolean payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| Ipv4Format1BoxedBoolean(boolean data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| boolean | data()
validated payload | +| Any? | getData()
validated payload | + +## Ipv4Format1BoxedNumber +data class Ipv4Format1BoxedNumber
+implements [Ipv4Format1Boxed](#ipv4format1boxed) + +data class that stores validated Number payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| Ipv4Format1BoxedNumber(Number data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| Number | data()
validated payload | +| Any? | getData()
validated payload | + +## Ipv4Format1BoxedString +data class Ipv4Format1BoxedString
+implements [Ipv4Format1Boxed](#ipv4format1boxed) + +data class that stores validated String payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| Ipv4Format1BoxedString(String data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| String | data()
validated payload | +| Any? | getData()
validated payload | + +## Ipv4Format1BoxedList +data class Ipv4Format1BoxedList
+implements [Ipv4Format1Boxed](#ipv4format1boxed) + +data class that stores validated List payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| Ipv4Format1BoxedList(FrozenList data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| FrozenList | data()
validated payload | +| Any? | getData()
validated payload | + +## Ipv4Format1BoxedMap +data class Ipv4Format1BoxedMap
+implements [Ipv4Format1Boxed](#ipv4format1boxed) + +data class that stores validated Map payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| Ipv4Format1BoxedMap(FrozenMap data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| FrozenMap | data()
validated payload | +| Any? | getData()
validated payload | + +## Ipv4Format1 +class Ipv4Format1
+extends JsonSchema + +A schema class that validates payloads + +### Field Summary +| Modifier and Type | Field and Description | +| ----------------- | ---------------------- | +| String | type = "ipv4"; | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| String | validate(arg: String, configuration: SchemaConfiguration) | +| Nothing? | validate(arg: Nothing?, configuration: SchemaConfiguration) | +| int | validate(arg: int, configuration: SchemaConfiguration) | +| long | validate(arg: long, configuration: SchemaConfiguration) | +| float | validate(arg: float, configuration: SchemaConfiguration) | +| double | validate(arg: double, configuration: SchemaConfiguration) | +| Number | validate(arg: Number, configuration: SchemaConfiguration) | +| boolean | validate(arg: boolean, configuration: SchemaConfiguration) | +| FrozenMap | validate(arg: Map<?, ?>, configuration: SchemaConfiguration) | +| FrozenList | validate(arg: List<*>, configuration: SchemaConfiguration) | +| [Ipv4Format1BoxedString](#ipv4format1boxedstring) | validateAndBox(String, configuration: SchemaConfiguration) | +| [Ipv4Format1BoxedVoid](#ipv4format1boxedvoid) | validateAndBox(Nothing?, configuration: SchemaConfiguration) | +| [Ipv4Format1BoxedNumber](#ipv4format1boxednumber) | validateAndBox(Number, configuration: SchemaConfiguration) | +| [Ipv4Format1BoxedBoolean](#ipv4format1boxedboolean) | validateAndBox(boolean, configuration: SchemaConfiguration) | +| [Ipv4Format1BoxedMap](#ipv4format1boxedmap) | validateAndBox(Map<?, ?>, configuration: SchemaConfiguration) | +| [Ipv4Format1BoxedList](#ipv4format1boxedlist) | validateAndBox(List<*>, configuration: SchemaConfiguration) | +| [Ipv4Format1Boxed](#ipv4format1boxed) | validateAndBox(Any?, configuration: SchemaConfiguration) | +| Any? | validate(arg: Any?, configuration: SchemaConfiguration) | + +[[Back to top]](#top) [[Back to Component Schemas]](../../../README.md#Component-Schemas) [[Back to README]](../../../README.md) diff --git a/samples/client/3_0_3_unit_test/kotlin/docs/components/schemas/Ipv6Format.md b/samples/client/3_0_3_unit_test/kotlin/docs/components/schemas/Ipv6Format.md new file mode 100644 index 00000000000..d78fd50c8b4 --- /dev/null +++ b/samples/client/3_0_3_unit_test/kotlin/docs/components/schemas/Ipv6Format.md @@ -0,0 +1,169 @@ +# Ipv6Format +org.openapijsonschematools.client.components.schemas.Ipv6Format.java +class Ipv6Format
+ +A class that contains necessary nested +- schema classes (which validate payloads), extends JsonSchema +- sealed interfaces which store validated payloads, Kotlin version of a sum type +- boxed classes which store validated payloads, sealed permits class implementations + +## Nested Class Summary +| Modifier and Type | Class and Description | +| ----------------- | ---------------------- | +| sealed interface | [Ipv6Format.Ipv6Format1Boxed](#ipv6format1boxed)
sealed interface for validated payloads | +| record | [Ipv6Format.Ipv6Format1BoxedVoid](#ipv6format1boxedvoid)
boxed class to store validated null payloads | +| record | [Ipv6Format.Ipv6Format1BoxedBoolean](#ipv6format1boxedboolean)
boxed class to store validated boolean payloads | +| record | [Ipv6Format.Ipv6Format1BoxedNumber](#ipv6format1boxednumber)
boxed class to store validated Number payloads | +| record | [Ipv6Format.Ipv6Format1BoxedString](#ipv6format1boxedstring)
boxed class to store validated String payloads | +| record | [Ipv6Format.Ipv6Format1BoxedList](#ipv6format1boxedlist)
boxed class to store validated List payloads | +| record | [Ipv6Format.Ipv6Format1BoxedMap](#ipv6format1boxedmap)
boxed class to store validated Map payloads | +| static class | [Ipv6Format.Ipv6Format1](#ipv6format1)
schema class | + +## Ipv6Format1Boxed +sealed interface Ipv6Format1Boxed
+permits
+[Ipv6Format1BoxedVoid](#ipv6format1boxedvoid), +[Ipv6Format1BoxedBoolean](#ipv6format1boxedboolean), +[Ipv6Format1BoxedNumber](#ipv6format1boxednumber), +[Ipv6Format1BoxedString](#ipv6format1boxedstring), +[Ipv6Format1BoxedList](#ipv6format1boxedlist), +[Ipv6Format1BoxedMap](#ipv6format1boxedmap) + +sealed interface that stores validated payloads using boxed classes + +## Ipv6Format1BoxedVoid +data class Ipv6Format1BoxedVoid
+implements [Ipv6Format1Boxed](#ipv6format1boxed) + +data class that stores validated null payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| Ipv6Format1BoxedVoid(Nothing? data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| Nothing? | data()
validated payload | +| Any? | getData()
validated payload | + +## Ipv6Format1BoxedBoolean +data class Ipv6Format1BoxedBoolean
+implements [Ipv6Format1Boxed](#ipv6format1boxed) + +record that stores validated boolean payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| Ipv6Format1BoxedBoolean(boolean data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| boolean | data()
validated payload | +| Any? | getData()
validated payload | + +## Ipv6Format1BoxedNumber +data class Ipv6Format1BoxedNumber
+implements [Ipv6Format1Boxed](#ipv6format1boxed) + +data class that stores validated Number payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| Ipv6Format1BoxedNumber(Number data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| Number | data()
validated payload | +| Any? | getData()
validated payload | + +## Ipv6Format1BoxedString +data class Ipv6Format1BoxedString
+implements [Ipv6Format1Boxed](#ipv6format1boxed) + +data class that stores validated String payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| Ipv6Format1BoxedString(String data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| String | data()
validated payload | +| Any? | getData()
validated payload | + +## Ipv6Format1BoxedList +data class Ipv6Format1BoxedList
+implements [Ipv6Format1Boxed](#ipv6format1boxed) + +data class that stores validated List payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| Ipv6Format1BoxedList(FrozenList data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| FrozenList | data()
validated payload | +| Any? | getData()
validated payload | + +## Ipv6Format1BoxedMap +data class Ipv6Format1BoxedMap
+implements [Ipv6Format1Boxed](#ipv6format1boxed) + +data class that stores validated Map payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| Ipv6Format1BoxedMap(FrozenMap data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| FrozenMap | data()
validated payload | +| Any? | getData()
validated payload | + +## Ipv6Format1 +class Ipv6Format1
+extends JsonSchema + +A schema class that validates payloads + +### Field Summary +| Modifier and Type | Field and Description | +| ----------------- | ---------------------- | +| String | type = "ipv6"; | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| String | validate(arg: String, configuration: SchemaConfiguration) | +| Nothing? | validate(arg: Nothing?, configuration: SchemaConfiguration) | +| int | validate(arg: int, configuration: SchemaConfiguration) | +| long | validate(arg: long, configuration: SchemaConfiguration) | +| float | validate(arg: float, configuration: SchemaConfiguration) | +| double | validate(arg: double, configuration: SchemaConfiguration) | +| Number | validate(arg: Number, configuration: SchemaConfiguration) | +| boolean | validate(arg: boolean, configuration: SchemaConfiguration) | +| FrozenMap | validate(arg: Map<?, ?>, configuration: SchemaConfiguration) | +| FrozenList | validate(arg: List<*>, configuration: SchemaConfiguration) | +| [Ipv6Format1BoxedString](#ipv6format1boxedstring) | validateAndBox(String, configuration: SchemaConfiguration) | +| [Ipv6Format1BoxedVoid](#ipv6format1boxedvoid) | validateAndBox(Nothing?, configuration: SchemaConfiguration) | +| [Ipv6Format1BoxedNumber](#ipv6format1boxednumber) | validateAndBox(Number, configuration: SchemaConfiguration) | +| [Ipv6Format1BoxedBoolean](#ipv6format1boxedboolean) | validateAndBox(boolean, configuration: SchemaConfiguration) | +| [Ipv6Format1BoxedMap](#ipv6format1boxedmap) | validateAndBox(Map<?, ?>, configuration: SchemaConfiguration) | +| [Ipv6Format1BoxedList](#ipv6format1boxedlist) | validateAndBox(List<*>, configuration: SchemaConfiguration) | +| [Ipv6Format1Boxed](#ipv6format1boxed) | validateAndBox(Any?, configuration: SchemaConfiguration) | +| Any? | validate(arg: Any?, configuration: SchemaConfiguration) | + +[[Back to top]](#top) [[Back to Component Schemas]](../../../README.md#Component-Schemas) [[Back to README]](../../../README.md) diff --git a/samples/client/3_0_3_unit_test/kotlin/docs/components/schemas/JsonPointerFormat.md b/samples/client/3_0_3_unit_test/kotlin/docs/components/schemas/JsonPointerFormat.md new file mode 100644 index 00000000000..6eddd588dff --- /dev/null +++ b/samples/client/3_0_3_unit_test/kotlin/docs/components/schemas/JsonPointerFormat.md @@ -0,0 +1,169 @@ +# JsonPointerFormat +org.openapijsonschematools.client.components.schemas.JsonPointerFormat.java +class JsonPointerFormat
+ +A class that contains necessary nested +- schema classes (which validate payloads), extends JsonSchema +- sealed interfaces which store validated payloads, Kotlin version of a sum type +- boxed classes which store validated payloads, sealed permits class implementations + +## Nested Class Summary +| Modifier and Type | Class and Description | +| ----------------- | ---------------------- | +| sealed interface | [JsonPointerFormat.JsonPointerFormat1Boxed](#jsonpointerformat1boxed)
sealed interface for validated payloads | +| record | [JsonPointerFormat.JsonPointerFormat1BoxedVoid](#jsonpointerformat1boxedvoid)
boxed class to store validated null payloads | +| record | [JsonPointerFormat.JsonPointerFormat1BoxedBoolean](#jsonpointerformat1boxedboolean)
boxed class to store validated boolean payloads | +| record | [JsonPointerFormat.JsonPointerFormat1BoxedNumber](#jsonpointerformat1boxednumber)
boxed class to store validated Number payloads | +| record | [JsonPointerFormat.JsonPointerFormat1BoxedString](#jsonpointerformat1boxedstring)
boxed class to store validated String payloads | +| record | [JsonPointerFormat.JsonPointerFormat1BoxedList](#jsonpointerformat1boxedlist)
boxed class to store validated List payloads | +| record | [JsonPointerFormat.JsonPointerFormat1BoxedMap](#jsonpointerformat1boxedmap)
boxed class to store validated Map payloads | +| static class | [JsonPointerFormat.JsonPointerFormat1](#jsonpointerformat1)
schema class | + +## JsonPointerFormat1Boxed +sealed interface JsonPointerFormat1Boxed
+permits
+[JsonPointerFormat1BoxedVoid](#jsonpointerformat1boxedvoid), +[JsonPointerFormat1BoxedBoolean](#jsonpointerformat1boxedboolean), +[JsonPointerFormat1BoxedNumber](#jsonpointerformat1boxednumber), +[JsonPointerFormat1BoxedString](#jsonpointerformat1boxedstring), +[JsonPointerFormat1BoxedList](#jsonpointerformat1boxedlist), +[JsonPointerFormat1BoxedMap](#jsonpointerformat1boxedmap) + +sealed interface that stores validated payloads using boxed classes + +## JsonPointerFormat1BoxedVoid +data class JsonPointerFormat1BoxedVoid
+implements [JsonPointerFormat1Boxed](#jsonpointerformat1boxed) + +data class that stores validated null payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| JsonPointerFormat1BoxedVoid(Nothing? data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| Nothing? | data()
validated payload | +| Any? | getData()
validated payload | + +## JsonPointerFormat1BoxedBoolean +data class JsonPointerFormat1BoxedBoolean
+implements [JsonPointerFormat1Boxed](#jsonpointerformat1boxed) + +record that stores validated boolean payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| JsonPointerFormat1BoxedBoolean(boolean data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| boolean | data()
validated payload | +| Any? | getData()
validated payload | + +## JsonPointerFormat1BoxedNumber +data class JsonPointerFormat1BoxedNumber
+implements [JsonPointerFormat1Boxed](#jsonpointerformat1boxed) + +data class that stores validated Number payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| JsonPointerFormat1BoxedNumber(Number data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| Number | data()
validated payload | +| Any? | getData()
validated payload | + +## JsonPointerFormat1BoxedString +data class JsonPointerFormat1BoxedString
+implements [JsonPointerFormat1Boxed](#jsonpointerformat1boxed) + +data class that stores validated String payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| JsonPointerFormat1BoxedString(String data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| String | data()
validated payload | +| Any? | getData()
validated payload | + +## JsonPointerFormat1BoxedList +data class JsonPointerFormat1BoxedList
+implements [JsonPointerFormat1Boxed](#jsonpointerformat1boxed) + +data class that stores validated List payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| JsonPointerFormat1BoxedList(FrozenList data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| FrozenList | data()
validated payload | +| Any? | getData()
validated payload | + +## JsonPointerFormat1BoxedMap +data class JsonPointerFormat1BoxedMap
+implements [JsonPointerFormat1Boxed](#jsonpointerformat1boxed) + +data class that stores validated Map payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| JsonPointerFormat1BoxedMap(FrozenMap data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| FrozenMap | data()
validated payload | +| Any? | getData()
validated payload | + +## JsonPointerFormat1 +class JsonPointerFormat1
+extends JsonSchema + +A schema class that validates payloads + +### Field Summary +| Modifier and Type | Field and Description | +| ----------------- | ---------------------- | +| String | type = "json-pointer"; | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| String | validate(arg: String, configuration: SchemaConfiguration) | +| Nothing? | validate(arg: Nothing?, configuration: SchemaConfiguration) | +| int | validate(arg: int, configuration: SchemaConfiguration) | +| long | validate(arg: long, configuration: SchemaConfiguration) | +| float | validate(arg: float, configuration: SchemaConfiguration) | +| double | validate(arg: double, configuration: SchemaConfiguration) | +| Number | validate(arg: Number, configuration: SchemaConfiguration) | +| boolean | validate(arg: boolean, configuration: SchemaConfiguration) | +| FrozenMap | validate(arg: Map<?, ?>, configuration: SchemaConfiguration) | +| FrozenList | validate(arg: List<*>, configuration: SchemaConfiguration) | +| [JsonPointerFormat1BoxedString](#jsonpointerformat1boxedstring) | validateAndBox(String, configuration: SchemaConfiguration) | +| [JsonPointerFormat1BoxedVoid](#jsonpointerformat1boxedvoid) | validateAndBox(Nothing?, configuration: SchemaConfiguration) | +| [JsonPointerFormat1BoxedNumber](#jsonpointerformat1boxednumber) | validateAndBox(Number, configuration: SchemaConfiguration) | +| [JsonPointerFormat1BoxedBoolean](#jsonpointerformat1boxedboolean) | validateAndBox(boolean, configuration: SchemaConfiguration) | +| [JsonPointerFormat1BoxedMap](#jsonpointerformat1boxedmap) | validateAndBox(Map<?, ?>, configuration: SchemaConfiguration) | +| [JsonPointerFormat1BoxedList](#jsonpointerformat1boxedlist) | validateAndBox(List<*>, configuration: SchemaConfiguration) | +| [JsonPointerFormat1Boxed](#jsonpointerformat1boxed) | validateAndBox(Any?, configuration: SchemaConfiguration) | +| Any? | validate(arg: Any?, configuration: SchemaConfiguration) | + +[[Back to top]](#top) [[Back to Component Schemas]](../../../README.md#Component-Schemas) [[Back to README]](../../../README.md) diff --git a/samples/client/3_0_3_unit_test/kotlin/docs/components/schemas/MaximumValidation.md b/samples/client/3_0_3_unit_test/kotlin/docs/components/schemas/MaximumValidation.md new file mode 100644 index 00000000000..30da56e71cc --- /dev/null +++ b/samples/client/3_0_3_unit_test/kotlin/docs/components/schemas/MaximumValidation.md @@ -0,0 +1,169 @@ +# MaximumValidation +org.openapijsonschematools.client.components.schemas.MaximumValidation.java +class MaximumValidation
+ +A class that contains necessary nested +- schema classes (which validate payloads), extends JsonSchema +- sealed interfaces which store validated payloads, Kotlin version of a sum type +- boxed classes which store validated payloads, sealed permits class implementations + +## Nested Class Summary +| Modifier and Type | Class and Description | +| ----------------- | ---------------------- | +| sealed interface | [MaximumValidation.MaximumValidation1Boxed](#maximumvalidation1boxed)
sealed interface for validated payloads | +| record | [MaximumValidation.MaximumValidation1BoxedVoid](#maximumvalidation1boxedvoid)
boxed class to store validated null payloads | +| record | [MaximumValidation.MaximumValidation1BoxedBoolean](#maximumvalidation1boxedboolean)
boxed class to store validated boolean payloads | +| record | [MaximumValidation.MaximumValidation1BoxedNumber](#maximumvalidation1boxednumber)
boxed class to store validated Number payloads | +| record | [MaximumValidation.MaximumValidation1BoxedString](#maximumvalidation1boxedstring)
boxed class to store validated String payloads | +| record | [MaximumValidation.MaximumValidation1BoxedList](#maximumvalidation1boxedlist)
boxed class to store validated List payloads | +| record | [MaximumValidation.MaximumValidation1BoxedMap](#maximumvalidation1boxedmap)
boxed class to store validated Map payloads | +| static class | [MaximumValidation.MaximumValidation1](#maximumvalidation1)
schema class | + +## MaximumValidation1Boxed +sealed interface MaximumValidation1Boxed
+permits
+[MaximumValidation1BoxedVoid](#maximumvalidation1boxedvoid), +[MaximumValidation1BoxedBoolean](#maximumvalidation1boxedboolean), +[MaximumValidation1BoxedNumber](#maximumvalidation1boxednumber), +[MaximumValidation1BoxedString](#maximumvalidation1boxedstring), +[MaximumValidation1BoxedList](#maximumvalidation1boxedlist), +[MaximumValidation1BoxedMap](#maximumvalidation1boxedmap) + +sealed interface that stores validated payloads using boxed classes + +## MaximumValidation1BoxedVoid +data class MaximumValidation1BoxedVoid
+implements [MaximumValidation1Boxed](#maximumvalidation1boxed) + +data class that stores validated null payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| MaximumValidation1BoxedVoid(Nothing? data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| Nothing? | data()
validated payload | +| Any? | getData()
validated payload | + +## MaximumValidation1BoxedBoolean +data class MaximumValidation1BoxedBoolean
+implements [MaximumValidation1Boxed](#maximumvalidation1boxed) + +record that stores validated boolean payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| MaximumValidation1BoxedBoolean(boolean data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| boolean | data()
validated payload | +| Any? | getData()
validated payload | + +## MaximumValidation1BoxedNumber +data class MaximumValidation1BoxedNumber
+implements [MaximumValidation1Boxed](#maximumvalidation1boxed) + +data class that stores validated Number payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| MaximumValidation1BoxedNumber(Number data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| Number | data()
validated payload | +| Any? | getData()
validated payload | + +## MaximumValidation1BoxedString +data class MaximumValidation1BoxedString
+implements [MaximumValidation1Boxed](#maximumvalidation1boxed) + +data class that stores validated String payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| MaximumValidation1BoxedString(String data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| String | data()
validated payload | +| Any? | getData()
validated payload | + +## MaximumValidation1BoxedList +data class MaximumValidation1BoxedList
+implements [MaximumValidation1Boxed](#maximumvalidation1boxed) + +data class that stores validated List payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| MaximumValidation1BoxedList(FrozenList data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| FrozenList | data()
validated payload | +| Any? | getData()
validated payload | + +## MaximumValidation1BoxedMap +data class MaximumValidation1BoxedMap
+implements [MaximumValidation1Boxed](#maximumvalidation1boxed) + +data class that stores validated Map payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| MaximumValidation1BoxedMap(FrozenMap data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| FrozenMap | data()
validated payload | +| Any? | getData()
validated payload | + +## MaximumValidation1 +class MaximumValidation1
+extends JsonSchema + +A schema class that validates payloads + +### Field Summary +| Modifier and Type | Field and Description | +| ----------------- | ---------------------- | +| Number | maximum = 3.0 | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| String | validate(arg: String, configuration: SchemaConfiguration) | +| Nothing? | validate(arg: Nothing?, configuration: SchemaConfiguration) | +| int | validate(arg: int, configuration: SchemaConfiguration) | +| long | validate(arg: long, configuration: SchemaConfiguration) | +| float | validate(arg: float, configuration: SchemaConfiguration) | +| double | validate(arg: double, configuration: SchemaConfiguration) | +| Number | validate(arg: Number, configuration: SchemaConfiguration) | +| boolean | validate(arg: boolean, configuration: SchemaConfiguration) | +| FrozenMap | validate(arg: Map<?, ?>, configuration: SchemaConfiguration) | +| FrozenList | validate(arg: List<*>, configuration: SchemaConfiguration) | +| [MaximumValidation1BoxedString](#maximumvalidation1boxedstring) | validateAndBox(String, configuration: SchemaConfiguration) | +| [MaximumValidation1BoxedVoid](#maximumvalidation1boxedvoid) | validateAndBox(Nothing?, configuration: SchemaConfiguration) | +| [MaximumValidation1BoxedNumber](#maximumvalidation1boxednumber) | validateAndBox(Number, configuration: SchemaConfiguration) | +| [MaximumValidation1BoxedBoolean](#maximumvalidation1boxedboolean) | validateAndBox(boolean, configuration: SchemaConfiguration) | +| [MaximumValidation1BoxedMap](#maximumvalidation1boxedmap) | validateAndBox(Map<?, ?>, configuration: SchemaConfiguration) | +| [MaximumValidation1BoxedList](#maximumvalidation1boxedlist) | validateAndBox(List<*>, configuration: SchemaConfiguration) | +| [MaximumValidation1Boxed](#maximumvalidation1boxed) | validateAndBox(Any?, configuration: SchemaConfiguration) | +| Any? | validate(arg: Any?, configuration: SchemaConfiguration) | + +[[Back to top]](#top) [[Back to Component Schemas]](../../../README.md#Component-Schemas) [[Back to README]](../../../README.md) diff --git a/samples/client/3_0_3_unit_test/kotlin/docs/components/schemas/MaximumValidationWithUnsignedInteger.md b/samples/client/3_0_3_unit_test/kotlin/docs/components/schemas/MaximumValidationWithUnsignedInteger.md new file mode 100644 index 00000000000..c9730a8592b --- /dev/null +++ b/samples/client/3_0_3_unit_test/kotlin/docs/components/schemas/MaximumValidationWithUnsignedInteger.md @@ -0,0 +1,169 @@ +# MaximumValidationWithUnsignedInteger +org.openapijsonschematools.client.components.schemas.MaximumValidationWithUnsignedInteger.java +class MaximumValidationWithUnsignedInteger
+ +A class that contains necessary nested +- schema classes (which validate payloads), extends JsonSchema +- sealed interfaces which store validated payloads, Kotlin version of a sum type +- boxed classes which store validated payloads, sealed permits class implementations + +## Nested Class Summary +| Modifier and Type | Class and Description | +| ----------------- | ---------------------- | +| sealed interface | [MaximumValidationWithUnsignedInteger.MaximumValidationWithUnsignedInteger1Boxed](#maximumvalidationwithunsignedinteger1boxed)
sealed interface for validated payloads | +| record | [MaximumValidationWithUnsignedInteger.MaximumValidationWithUnsignedInteger1BoxedVoid](#maximumvalidationwithunsignedinteger1boxedvoid)
boxed class to store validated null payloads | +| record | [MaximumValidationWithUnsignedInteger.MaximumValidationWithUnsignedInteger1BoxedBoolean](#maximumvalidationwithunsignedinteger1boxedboolean)
boxed class to store validated boolean payloads | +| record | [MaximumValidationWithUnsignedInteger.MaximumValidationWithUnsignedInteger1BoxedNumber](#maximumvalidationwithunsignedinteger1boxednumber)
boxed class to store validated Number payloads | +| record | [MaximumValidationWithUnsignedInteger.MaximumValidationWithUnsignedInteger1BoxedString](#maximumvalidationwithunsignedinteger1boxedstring)
boxed class to store validated String payloads | +| record | [MaximumValidationWithUnsignedInteger.MaximumValidationWithUnsignedInteger1BoxedList](#maximumvalidationwithunsignedinteger1boxedlist)
boxed class to store validated List payloads | +| record | [MaximumValidationWithUnsignedInteger.MaximumValidationWithUnsignedInteger1BoxedMap](#maximumvalidationwithunsignedinteger1boxedmap)
boxed class to store validated Map payloads | +| static class | [MaximumValidationWithUnsignedInteger.MaximumValidationWithUnsignedInteger1](#maximumvalidationwithunsignedinteger1)
schema class | + +## MaximumValidationWithUnsignedInteger1Boxed +sealed interface MaximumValidationWithUnsignedInteger1Boxed
+permits
+[MaximumValidationWithUnsignedInteger1BoxedVoid](#maximumvalidationwithunsignedinteger1boxedvoid), +[MaximumValidationWithUnsignedInteger1BoxedBoolean](#maximumvalidationwithunsignedinteger1boxedboolean), +[MaximumValidationWithUnsignedInteger1BoxedNumber](#maximumvalidationwithunsignedinteger1boxednumber), +[MaximumValidationWithUnsignedInteger1BoxedString](#maximumvalidationwithunsignedinteger1boxedstring), +[MaximumValidationWithUnsignedInteger1BoxedList](#maximumvalidationwithunsignedinteger1boxedlist), +[MaximumValidationWithUnsignedInteger1BoxedMap](#maximumvalidationwithunsignedinteger1boxedmap) + +sealed interface that stores validated payloads using boxed classes + +## MaximumValidationWithUnsignedInteger1BoxedVoid +data class MaximumValidationWithUnsignedInteger1BoxedVoid
+implements [MaximumValidationWithUnsignedInteger1Boxed](#maximumvalidationwithunsignedinteger1boxed) + +data class that stores validated null payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| MaximumValidationWithUnsignedInteger1BoxedVoid(Nothing? data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| Nothing? | data()
validated payload | +| Any? | getData()
validated payload | + +## MaximumValidationWithUnsignedInteger1BoxedBoolean +data class MaximumValidationWithUnsignedInteger1BoxedBoolean
+implements [MaximumValidationWithUnsignedInteger1Boxed](#maximumvalidationwithunsignedinteger1boxed) + +record that stores validated boolean payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| MaximumValidationWithUnsignedInteger1BoxedBoolean(boolean data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| boolean | data()
validated payload | +| Any? | getData()
validated payload | + +## MaximumValidationWithUnsignedInteger1BoxedNumber +data class MaximumValidationWithUnsignedInteger1BoxedNumber
+implements [MaximumValidationWithUnsignedInteger1Boxed](#maximumvalidationwithunsignedinteger1boxed) + +data class that stores validated Number payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| MaximumValidationWithUnsignedInteger1BoxedNumber(Number data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| Number | data()
validated payload | +| Any? | getData()
validated payload | + +## MaximumValidationWithUnsignedInteger1BoxedString +data class MaximumValidationWithUnsignedInteger1BoxedString
+implements [MaximumValidationWithUnsignedInteger1Boxed](#maximumvalidationwithunsignedinteger1boxed) + +data class that stores validated String payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| MaximumValidationWithUnsignedInteger1BoxedString(String data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| String | data()
validated payload | +| Any? | getData()
validated payload | + +## MaximumValidationWithUnsignedInteger1BoxedList +data class MaximumValidationWithUnsignedInteger1BoxedList
+implements [MaximumValidationWithUnsignedInteger1Boxed](#maximumvalidationwithunsignedinteger1boxed) + +data class that stores validated List payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| MaximumValidationWithUnsignedInteger1BoxedList(FrozenList data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| FrozenList | data()
validated payload | +| Any? | getData()
validated payload | + +## MaximumValidationWithUnsignedInteger1BoxedMap +data class MaximumValidationWithUnsignedInteger1BoxedMap
+implements [MaximumValidationWithUnsignedInteger1Boxed](#maximumvalidationwithunsignedinteger1boxed) + +data class that stores validated Map payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| MaximumValidationWithUnsignedInteger1BoxedMap(FrozenMap data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| FrozenMap | data()
validated payload | +| Any? | getData()
validated payload | + +## MaximumValidationWithUnsignedInteger1 +class MaximumValidationWithUnsignedInteger1
+extends JsonSchema + +A schema class that validates payloads + +### Field Summary +| Modifier and Type | Field and Description | +| ----------------- | ---------------------- | +| Number | maximum = 300 | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| String | validate(arg: String, configuration: SchemaConfiguration) | +| Nothing? | validate(arg: Nothing?, configuration: SchemaConfiguration) | +| int | validate(arg: int, configuration: SchemaConfiguration) | +| long | validate(arg: long, configuration: SchemaConfiguration) | +| float | validate(arg: float, configuration: SchemaConfiguration) | +| double | validate(arg: double, configuration: SchemaConfiguration) | +| Number | validate(arg: Number, configuration: SchemaConfiguration) | +| boolean | validate(arg: boolean, configuration: SchemaConfiguration) | +| FrozenMap | validate(arg: Map<?, ?>, configuration: SchemaConfiguration) | +| FrozenList | validate(arg: List<*>, configuration: SchemaConfiguration) | +| [MaximumValidationWithUnsignedInteger1BoxedString](#maximumvalidationwithunsignedinteger1boxedstring) | validateAndBox(String, configuration: SchemaConfiguration) | +| [MaximumValidationWithUnsignedInteger1BoxedVoid](#maximumvalidationwithunsignedinteger1boxedvoid) | validateAndBox(Nothing?, configuration: SchemaConfiguration) | +| [MaximumValidationWithUnsignedInteger1BoxedNumber](#maximumvalidationwithunsignedinteger1boxednumber) | validateAndBox(Number, configuration: SchemaConfiguration) | +| [MaximumValidationWithUnsignedInteger1BoxedBoolean](#maximumvalidationwithunsignedinteger1boxedboolean) | validateAndBox(boolean, configuration: SchemaConfiguration) | +| [MaximumValidationWithUnsignedInteger1BoxedMap](#maximumvalidationwithunsignedinteger1boxedmap) | validateAndBox(Map<?, ?>, configuration: SchemaConfiguration) | +| [MaximumValidationWithUnsignedInteger1BoxedList](#maximumvalidationwithunsignedinteger1boxedlist) | validateAndBox(List<*>, configuration: SchemaConfiguration) | +| [MaximumValidationWithUnsignedInteger1Boxed](#maximumvalidationwithunsignedinteger1boxed) | validateAndBox(Any?, configuration: SchemaConfiguration) | +| Any? | validate(arg: Any?, configuration: SchemaConfiguration) | + +[[Back to top]](#top) [[Back to Component Schemas]](../../../README.md#Component-Schemas) [[Back to README]](../../../README.md) diff --git a/samples/client/3_0_3_unit_test/kotlin/docs/components/schemas/MaxitemsValidation.md b/samples/client/3_0_3_unit_test/kotlin/docs/components/schemas/MaxitemsValidation.md new file mode 100644 index 00000000000..3ea5955c1d2 --- /dev/null +++ b/samples/client/3_0_3_unit_test/kotlin/docs/components/schemas/MaxitemsValidation.md @@ -0,0 +1,169 @@ +# MaxitemsValidation +org.openapijsonschematools.client.components.schemas.MaxitemsValidation.java +class MaxitemsValidation
+ +A class that contains necessary nested +- schema classes (which validate payloads), extends JsonSchema +- sealed interfaces which store validated payloads, Kotlin version of a sum type +- boxed classes which store validated payloads, sealed permits class implementations + +## Nested Class Summary +| Modifier and Type | Class and Description | +| ----------------- | ---------------------- | +| sealed interface | [MaxitemsValidation.MaxitemsValidation1Boxed](#maxitemsvalidation1boxed)
sealed interface for validated payloads | +| record | [MaxitemsValidation.MaxitemsValidation1BoxedVoid](#maxitemsvalidation1boxedvoid)
boxed class to store validated null payloads | +| record | [MaxitemsValidation.MaxitemsValidation1BoxedBoolean](#maxitemsvalidation1boxedboolean)
boxed class to store validated boolean payloads | +| record | [MaxitemsValidation.MaxitemsValidation1BoxedNumber](#maxitemsvalidation1boxednumber)
boxed class to store validated Number payloads | +| record | [MaxitemsValidation.MaxitemsValidation1BoxedString](#maxitemsvalidation1boxedstring)
boxed class to store validated String payloads | +| record | [MaxitemsValidation.MaxitemsValidation1BoxedList](#maxitemsvalidation1boxedlist)
boxed class to store validated List payloads | +| record | [MaxitemsValidation.MaxitemsValidation1BoxedMap](#maxitemsvalidation1boxedmap)
boxed class to store validated Map payloads | +| static class | [MaxitemsValidation.MaxitemsValidation1](#maxitemsvalidation1)
schema class | + +## MaxitemsValidation1Boxed +sealed interface MaxitemsValidation1Boxed
+permits
+[MaxitemsValidation1BoxedVoid](#maxitemsvalidation1boxedvoid), +[MaxitemsValidation1BoxedBoolean](#maxitemsvalidation1boxedboolean), +[MaxitemsValidation1BoxedNumber](#maxitemsvalidation1boxednumber), +[MaxitemsValidation1BoxedString](#maxitemsvalidation1boxedstring), +[MaxitemsValidation1BoxedList](#maxitemsvalidation1boxedlist), +[MaxitemsValidation1BoxedMap](#maxitemsvalidation1boxedmap) + +sealed interface that stores validated payloads using boxed classes + +## MaxitemsValidation1BoxedVoid +data class MaxitemsValidation1BoxedVoid
+implements [MaxitemsValidation1Boxed](#maxitemsvalidation1boxed) + +data class that stores validated null payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| MaxitemsValidation1BoxedVoid(Nothing? data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| Nothing? | data()
validated payload | +| Any? | getData()
validated payload | + +## MaxitemsValidation1BoxedBoolean +data class MaxitemsValidation1BoxedBoolean
+implements [MaxitemsValidation1Boxed](#maxitemsvalidation1boxed) + +record that stores validated boolean payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| MaxitemsValidation1BoxedBoolean(boolean data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| boolean | data()
validated payload | +| Any? | getData()
validated payload | + +## MaxitemsValidation1BoxedNumber +data class MaxitemsValidation1BoxedNumber
+implements [MaxitemsValidation1Boxed](#maxitemsvalidation1boxed) + +data class that stores validated Number payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| MaxitemsValidation1BoxedNumber(Number data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| Number | data()
validated payload | +| Any? | getData()
validated payload | + +## MaxitemsValidation1BoxedString +data class MaxitemsValidation1BoxedString
+implements [MaxitemsValidation1Boxed](#maxitemsvalidation1boxed) + +data class that stores validated String payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| MaxitemsValidation1BoxedString(String data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| String | data()
validated payload | +| Any? | getData()
validated payload | + +## MaxitemsValidation1BoxedList +data class MaxitemsValidation1BoxedList
+implements [MaxitemsValidation1Boxed](#maxitemsvalidation1boxed) + +data class that stores validated List payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| MaxitemsValidation1BoxedList(FrozenList data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| FrozenList | data()
validated payload | +| Any? | getData()
validated payload | + +## MaxitemsValidation1BoxedMap +data class MaxitemsValidation1BoxedMap
+implements [MaxitemsValidation1Boxed](#maxitemsvalidation1boxed) + +data class that stores validated Map payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| MaxitemsValidation1BoxedMap(FrozenMap data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| FrozenMap | data()
validated payload | +| Any? | getData()
validated payload | + +## MaxitemsValidation1 +class MaxitemsValidation1
+extends JsonSchema + +A schema class that validates payloads + +### Field Summary +| Modifier and Type | Field and Description | +| ----------------- | ---------------------- | +| Integer | maxItems = 2 | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| String | validate(arg: String, configuration: SchemaConfiguration) | +| Nothing? | validate(arg: Nothing?, configuration: SchemaConfiguration) | +| int | validate(arg: int, configuration: SchemaConfiguration) | +| long | validate(arg: long, configuration: SchemaConfiguration) | +| float | validate(arg: float, configuration: SchemaConfiguration) | +| double | validate(arg: double, configuration: SchemaConfiguration) | +| Number | validate(arg: Number, configuration: SchemaConfiguration) | +| boolean | validate(arg: boolean, configuration: SchemaConfiguration) | +| FrozenMap | validate(arg: Map<?, ?>, configuration: SchemaConfiguration) | +| FrozenList | validate(arg: List<*>, configuration: SchemaConfiguration) | +| [MaxitemsValidation1BoxedString](#maxitemsvalidation1boxedstring) | validateAndBox(String, configuration: SchemaConfiguration) | +| [MaxitemsValidation1BoxedVoid](#maxitemsvalidation1boxedvoid) | validateAndBox(Nothing?, configuration: SchemaConfiguration) | +| [MaxitemsValidation1BoxedNumber](#maxitemsvalidation1boxednumber) | validateAndBox(Number, configuration: SchemaConfiguration) | +| [MaxitemsValidation1BoxedBoolean](#maxitemsvalidation1boxedboolean) | validateAndBox(boolean, configuration: SchemaConfiguration) | +| [MaxitemsValidation1BoxedMap](#maxitemsvalidation1boxedmap) | validateAndBox(Map<?, ?>, configuration: SchemaConfiguration) | +| [MaxitemsValidation1BoxedList](#maxitemsvalidation1boxedlist) | validateAndBox(List<*>, configuration: SchemaConfiguration) | +| [MaxitemsValidation1Boxed](#maxitemsvalidation1boxed) | validateAndBox(Any?, configuration: SchemaConfiguration) | +| Any? | validate(arg: Any?, configuration: SchemaConfiguration) | + +[[Back to top]](#top) [[Back to Component Schemas]](../../../README.md#Component-Schemas) [[Back to README]](../../../README.md) diff --git a/samples/client/3_0_3_unit_test/kotlin/docs/components/schemas/MaxlengthValidation.md b/samples/client/3_0_3_unit_test/kotlin/docs/components/schemas/MaxlengthValidation.md new file mode 100644 index 00000000000..bce5aed91d9 --- /dev/null +++ b/samples/client/3_0_3_unit_test/kotlin/docs/components/schemas/MaxlengthValidation.md @@ -0,0 +1,169 @@ +# MaxlengthValidation +org.openapijsonschematools.client.components.schemas.MaxlengthValidation.java +class MaxlengthValidation
+ +A class that contains necessary nested +- schema classes (which validate payloads), extends JsonSchema +- sealed interfaces which store validated payloads, Kotlin version of a sum type +- boxed classes which store validated payloads, sealed permits class implementations + +## Nested Class Summary +| Modifier and Type | Class and Description | +| ----------------- | ---------------------- | +| sealed interface | [MaxlengthValidation.MaxlengthValidation1Boxed](#maxlengthvalidation1boxed)
sealed interface for validated payloads | +| record | [MaxlengthValidation.MaxlengthValidation1BoxedVoid](#maxlengthvalidation1boxedvoid)
boxed class to store validated null payloads | +| record | [MaxlengthValidation.MaxlengthValidation1BoxedBoolean](#maxlengthvalidation1boxedboolean)
boxed class to store validated boolean payloads | +| record | [MaxlengthValidation.MaxlengthValidation1BoxedNumber](#maxlengthvalidation1boxednumber)
boxed class to store validated Number payloads | +| record | [MaxlengthValidation.MaxlengthValidation1BoxedString](#maxlengthvalidation1boxedstring)
boxed class to store validated String payloads | +| record | [MaxlengthValidation.MaxlengthValidation1BoxedList](#maxlengthvalidation1boxedlist)
boxed class to store validated List payloads | +| record | [MaxlengthValidation.MaxlengthValidation1BoxedMap](#maxlengthvalidation1boxedmap)
boxed class to store validated Map payloads | +| static class | [MaxlengthValidation.MaxlengthValidation1](#maxlengthvalidation1)
schema class | + +## MaxlengthValidation1Boxed +sealed interface MaxlengthValidation1Boxed
+permits
+[MaxlengthValidation1BoxedVoid](#maxlengthvalidation1boxedvoid), +[MaxlengthValidation1BoxedBoolean](#maxlengthvalidation1boxedboolean), +[MaxlengthValidation1BoxedNumber](#maxlengthvalidation1boxednumber), +[MaxlengthValidation1BoxedString](#maxlengthvalidation1boxedstring), +[MaxlengthValidation1BoxedList](#maxlengthvalidation1boxedlist), +[MaxlengthValidation1BoxedMap](#maxlengthvalidation1boxedmap) + +sealed interface that stores validated payloads using boxed classes + +## MaxlengthValidation1BoxedVoid +data class MaxlengthValidation1BoxedVoid
+implements [MaxlengthValidation1Boxed](#maxlengthvalidation1boxed) + +data class that stores validated null payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| MaxlengthValidation1BoxedVoid(Nothing? data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| Nothing? | data()
validated payload | +| Any? | getData()
validated payload | + +## MaxlengthValidation1BoxedBoolean +data class MaxlengthValidation1BoxedBoolean
+implements [MaxlengthValidation1Boxed](#maxlengthvalidation1boxed) + +record that stores validated boolean payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| MaxlengthValidation1BoxedBoolean(boolean data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| boolean | data()
validated payload | +| Any? | getData()
validated payload | + +## MaxlengthValidation1BoxedNumber +data class MaxlengthValidation1BoxedNumber
+implements [MaxlengthValidation1Boxed](#maxlengthvalidation1boxed) + +data class that stores validated Number payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| MaxlengthValidation1BoxedNumber(Number data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| Number | data()
validated payload | +| Any? | getData()
validated payload | + +## MaxlengthValidation1BoxedString +data class MaxlengthValidation1BoxedString
+implements [MaxlengthValidation1Boxed](#maxlengthvalidation1boxed) + +data class that stores validated String payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| MaxlengthValidation1BoxedString(String data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| String | data()
validated payload | +| Any? | getData()
validated payload | + +## MaxlengthValidation1BoxedList +data class MaxlengthValidation1BoxedList
+implements [MaxlengthValidation1Boxed](#maxlengthvalidation1boxed) + +data class that stores validated List payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| MaxlengthValidation1BoxedList(FrozenList data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| FrozenList | data()
validated payload | +| Any? | getData()
validated payload | + +## MaxlengthValidation1BoxedMap +data class MaxlengthValidation1BoxedMap
+implements [MaxlengthValidation1Boxed](#maxlengthvalidation1boxed) + +data class that stores validated Map payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| MaxlengthValidation1BoxedMap(FrozenMap data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| FrozenMap | data()
validated payload | +| Any? | getData()
validated payload | + +## MaxlengthValidation1 +class MaxlengthValidation1
+extends JsonSchema + +A schema class that validates payloads + +### Field Summary +| Modifier and Type | Field and Description | +| ----------------- | ---------------------- | +| Integer | maxLength = 2 | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| String | validate(arg: String, configuration: SchemaConfiguration) | +| Nothing? | validate(arg: Nothing?, configuration: SchemaConfiguration) | +| int | validate(arg: int, configuration: SchemaConfiguration) | +| long | validate(arg: long, configuration: SchemaConfiguration) | +| float | validate(arg: float, configuration: SchemaConfiguration) | +| double | validate(arg: double, configuration: SchemaConfiguration) | +| Number | validate(arg: Number, configuration: SchemaConfiguration) | +| boolean | validate(arg: boolean, configuration: SchemaConfiguration) | +| FrozenMap | validate(arg: Map<?, ?>, configuration: SchemaConfiguration) | +| FrozenList | validate(arg: List<*>, configuration: SchemaConfiguration) | +| [MaxlengthValidation1BoxedString](#maxlengthvalidation1boxedstring) | validateAndBox(String, configuration: SchemaConfiguration) | +| [MaxlengthValidation1BoxedVoid](#maxlengthvalidation1boxedvoid) | validateAndBox(Nothing?, configuration: SchemaConfiguration) | +| [MaxlengthValidation1BoxedNumber](#maxlengthvalidation1boxednumber) | validateAndBox(Number, configuration: SchemaConfiguration) | +| [MaxlengthValidation1BoxedBoolean](#maxlengthvalidation1boxedboolean) | validateAndBox(boolean, configuration: SchemaConfiguration) | +| [MaxlengthValidation1BoxedMap](#maxlengthvalidation1boxedmap) | validateAndBox(Map<?, ?>, configuration: SchemaConfiguration) | +| [MaxlengthValidation1BoxedList](#maxlengthvalidation1boxedlist) | validateAndBox(List<*>, configuration: SchemaConfiguration) | +| [MaxlengthValidation1Boxed](#maxlengthvalidation1boxed) | validateAndBox(Any?, configuration: SchemaConfiguration) | +| Any? | validate(arg: Any?, configuration: SchemaConfiguration) | + +[[Back to top]](#top) [[Back to Component Schemas]](../../../README.md#Component-Schemas) [[Back to README]](../../../README.md) diff --git a/samples/client/3_0_3_unit_test/kotlin/docs/components/schemas/Maxproperties0MeansTheObjectIsEmpty.md b/samples/client/3_0_3_unit_test/kotlin/docs/components/schemas/Maxproperties0MeansTheObjectIsEmpty.md new file mode 100644 index 00000000000..06a37326fda --- /dev/null +++ b/samples/client/3_0_3_unit_test/kotlin/docs/components/schemas/Maxproperties0MeansTheObjectIsEmpty.md @@ -0,0 +1,169 @@ +# Maxproperties0MeansTheObjectIsEmpty +org.openapijsonschematools.client.components.schemas.Maxproperties0MeansTheObjectIsEmpty.java +class Maxproperties0MeansTheObjectIsEmpty
+ +A class that contains necessary nested +- schema classes (which validate payloads), extends JsonSchema +- sealed interfaces which store validated payloads, Kotlin version of a sum type +- boxed classes which store validated payloads, sealed permits class implementations + +## Nested Class Summary +| Modifier and Type | Class and Description | +| ----------------- | ---------------------- | +| sealed interface | [Maxproperties0MeansTheObjectIsEmpty.Maxproperties0MeansTheObjectIsEmpty1Boxed](#maxproperties0meanstheobjectisempty1boxed)
sealed interface for validated payloads | +| record | [Maxproperties0MeansTheObjectIsEmpty.Maxproperties0MeansTheObjectIsEmpty1BoxedVoid](#maxproperties0meanstheobjectisempty1boxedvoid)
boxed class to store validated null payloads | +| record | [Maxproperties0MeansTheObjectIsEmpty.Maxproperties0MeansTheObjectIsEmpty1BoxedBoolean](#maxproperties0meanstheobjectisempty1boxedboolean)
boxed class to store validated boolean payloads | +| record | [Maxproperties0MeansTheObjectIsEmpty.Maxproperties0MeansTheObjectIsEmpty1BoxedNumber](#maxproperties0meanstheobjectisempty1boxednumber)
boxed class to store validated Number payloads | +| record | [Maxproperties0MeansTheObjectIsEmpty.Maxproperties0MeansTheObjectIsEmpty1BoxedString](#maxproperties0meanstheobjectisempty1boxedstring)
boxed class to store validated String payloads | +| record | [Maxproperties0MeansTheObjectIsEmpty.Maxproperties0MeansTheObjectIsEmpty1BoxedList](#maxproperties0meanstheobjectisempty1boxedlist)
boxed class to store validated List payloads | +| record | [Maxproperties0MeansTheObjectIsEmpty.Maxproperties0MeansTheObjectIsEmpty1BoxedMap](#maxproperties0meanstheobjectisempty1boxedmap)
boxed class to store validated Map payloads | +| static class | [Maxproperties0MeansTheObjectIsEmpty.Maxproperties0MeansTheObjectIsEmpty1](#maxproperties0meanstheobjectisempty1)
schema class | + +## Maxproperties0MeansTheObjectIsEmpty1Boxed +sealed interface Maxproperties0MeansTheObjectIsEmpty1Boxed
+permits
+[Maxproperties0MeansTheObjectIsEmpty1BoxedVoid](#maxproperties0meanstheobjectisempty1boxedvoid), +[Maxproperties0MeansTheObjectIsEmpty1BoxedBoolean](#maxproperties0meanstheobjectisempty1boxedboolean), +[Maxproperties0MeansTheObjectIsEmpty1BoxedNumber](#maxproperties0meanstheobjectisempty1boxednumber), +[Maxproperties0MeansTheObjectIsEmpty1BoxedString](#maxproperties0meanstheobjectisempty1boxedstring), +[Maxproperties0MeansTheObjectIsEmpty1BoxedList](#maxproperties0meanstheobjectisempty1boxedlist), +[Maxproperties0MeansTheObjectIsEmpty1BoxedMap](#maxproperties0meanstheobjectisempty1boxedmap) + +sealed interface that stores validated payloads using boxed classes + +## Maxproperties0MeansTheObjectIsEmpty1BoxedVoid +data class Maxproperties0MeansTheObjectIsEmpty1BoxedVoid
+implements [Maxproperties0MeansTheObjectIsEmpty1Boxed](#maxproperties0meanstheobjectisempty1boxed) + +data class that stores validated null payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| Maxproperties0MeansTheObjectIsEmpty1BoxedVoid(Nothing? data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| Nothing? | data()
validated payload | +| Any? | getData()
validated payload | + +## Maxproperties0MeansTheObjectIsEmpty1BoxedBoolean +data class Maxproperties0MeansTheObjectIsEmpty1BoxedBoolean
+implements [Maxproperties0MeansTheObjectIsEmpty1Boxed](#maxproperties0meanstheobjectisempty1boxed) + +record that stores validated boolean payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| Maxproperties0MeansTheObjectIsEmpty1BoxedBoolean(boolean data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| boolean | data()
validated payload | +| Any? | getData()
validated payload | + +## Maxproperties0MeansTheObjectIsEmpty1BoxedNumber +data class Maxproperties0MeansTheObjectIsEmpty1BoxedNumber
+implements [Maxproperties0MeansTheObjectIsEmpty1Boxed](#maxproperties0meanstheobjectisempty1boxed) + +data class that stores validated Number payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| Maxproperties0MeansTheObjectIsEmpty1BoxedNumber(Number data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| Number | data()
validated payload | +| Any? | getData()
validated payload | + +## Maxproperties0MeansTheObjectIsEmpty1BoxedString +data class Maxproperties0MeansTheObjectIsEmpty1BoxedString
+implements [Maxproperties0MeansTheObjectIsEmpty1Boxed](#maxproperties0meanstheobjectisempty1boxed) + +data class that stores validated String payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| Maxproperties0MeansTheObjectIsEmpty1BoxedString(String data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| String | data()
validated payload | +| Any? | getData()
validated payload | + +## Maxproperties0MeansTheObjectIsEmpty1BoxedList +data class Maxproperties0MeansTheObjectIsEmpty1BoxedList
+implements [Maxproperties0MeansTheObjectIsEmpty1Boxed](#maxproperties0meanstheobjectisempty1boxed) + +data class that stores validated List payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| Maxproperties0MeansTheObjectIsEmpty1BoxedList(FrozenList data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| FrozenList | data()
validated payload | +| Any? | getData()
validated payload | + +## Maxproperties0MeansTheObjectIsEmpty1BoxedMap +data class Maxproperties0MeansTheObjectIsEmpty1BoxedMap
+implements [Maxproperties0MeansTheObjectIsEmpty1Boxed](#maxproperties0meanstheobjectisempty1boxed) + +data class that stores validated Map payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| Maxproperties0MeansTheObjectIsEmpty1BoxedMap(FrozenMap data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| FrozenMap | data()
validated payload | +| Any? | getData()
validated payload | + +## Maxproperties0MeansTheObjectIsEmpty1 +class Maxproperties0MeansTheObjectIsEmpty1
+extends JsonSchema + +A schema class that validates payloads + +### Field Summary +| Modifier and Type | Field and Description | +| ----------------- | ---------------------- | +| Integer | maxProperties = 0 | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| String | validate(arg: String, configuration: SchemaConfiguration) | +| Nothing? | validate(arg: Nothing?, configuration: SchemaConfiguration) | +| int | validate(arg: int, configuration: SchemaConfiguration) | +| long | validate(arg: long, configuration: SchemaConfiguration) | +| float | validate(arg: float, configuration: SchemaConfiguration) | +| double | validate(arg: double, configuration: SchemaConfiguration) | +| Number | validate(arg: Number, configuration: SchemaConfiguration) | +| boolean | validate(arg: boolean, configuration: SchemaConfiguration) | +| FrozenMap | validate(arg: Map<?, ?>, configuration: SchemaConfiguration) | +| FrozenList | validate(arg: List<*>, configuration: SchemaConfiguration) | +| [Maxproperties0MeansTheObjectIsEmpty1BoxedString](#maxproperties0meanstheobjectisempty1boxedstring) | validateAndBox(String, configuration: SchemaConfiguration) | +| [Maxproperties0MeansTheObjectIsEmpty1BoxedVoid](#maxproperties0meanstheobjectisempty1boxedvoid) | validateAndBox(Nothing?, configuration: SchemaConfiguration) | +| [Maxproperties0MeansTheObjectIsEmpty1BoxedNumber](#maxproperties0meanstheobjectisempty1boxednumber) | validateAndBox(Number, configuration: SchemaConfiguration) | +| [Maxproperties0MeansTheObjectIsEmpty1BoxedBoolean](#maxproperties0meanstheobjectisempty1boxedboolean) | validateAndBox(boolean, configuration: SchemaConfiguration) | +| [Maxproperties0MeansTheObjectIsEmpty1BoxedMap](#maxproperties0meanstheobjectisempty1boxedmap) | validateAndBox(Map<?, ?>, configuration: SchemaConfiguration) | +| [Maxproperties0MeansTheObjectIsEmpty1BoxedList](#maxproperties0meanstheobjectisempty1boxedlist) | validateAndBox(List<*>, configuration: SchemaConfiguration) | +| [Maxproperties0MeansTheObjectIsEmpty1Boxed](#maxproperties0meanstheobjectisempty1boxed) | validateAndBox(Any?, configuration: SchemaConfiguration) | +| Any? | validate(arg: Any?, configuration: SchemaConfiguration) | + +[[Back to top]](#top) [[Back to Component Schemas]](../../../README.md#Component-Schemas) [[Back to README]](../../../README.md) diff --git a/samples/client/3_0_3_unit_test/kotlin/docs/components/schemas/MaxpropertiesValidation.md b/samples/client/3_0_3_unit_test/kotlin/docs/components/schemas/MaxpropertiesValidation.md new file mode 100644 index 00000000000..8b04a4d21ac --- /dev/null +++ b/samples/client/3_0_3_unit_test/kotlin/docs/components/schemas/MaxpropertiesValidation.md @@ -0,0 +1,169 @@ +# MaxpropertiesValidation +org.openapijsonschematools.client.components.schemas.MaxpropertiesValidation.java +class MaxpropertiesValidation
+ +A class that contains necessary nested +- schema classes (which validate payloads), extends JsonSchema +- sealed interfaces which store validated payloads, Kotlin version of a sum type +- boxed classes which store validated payloads, sealed permits class implementations + +## Nested Class Summary +| Modifier and Type | Class and Description | +| ----------------- | ---------------------- | +| sealed interface | [MaxpropertiesValidation.MaxpropertiesValidation1Boxed](#maxpropertiesvalidation1boxed)
sealed interface for validated payloads | +| record | [MaxpropertiesValidation.MaxpropertiesValidation1BoxedVoid](#maxpropertiesvalidation1boxedvoid)
boxed class to store validated null payloads | +| record | [MaxpropertiesValidation.MaxpropertiesValidation1BoxedBoolean](#maxpropertiesvalidation1boxedboolean)
boxed class to store validated boolean payloads | +| record | [MaxpropertiesValidation.MaxpropertiesValidation1BoxedNumber](#maxpropertiesvalidation1boxednumber)
boxed class to store validated Number payloads | +| record | [MaxpropertiesValidation.MaxpropertiesValidation1BoxedString](#maxpropertiesvalidation1boxedstring)
boxed class to store validated String payloads | +| record | [MaxpropertiesValidation.MaxpropertiesValidation1BoxedList](#maxpropertiesvalidation1boxedlist)
boxed class to store validated List payloads | +| record | [MaxpropertiesValidation.MaxpropertiesValidation1BoxedMap](#maxpropertiesvalidation1boxedmap)
boxed class to store validated Map payloads | +| static class | [MaxpropertiesValidation.MaxpropertiesValidation1](#maxpropertiesvalidation1)
schema class | + +## MaxpropertiesValidation1Boxed +sealed interface MaxpropertiesValidation1Boxed
+permits
+[MaxpropertiesValidation1BoxedVoid](#maxpropertiesvalidation1boxedvoid), +[MaxpropertiesValidation1BoxedBoolean](#maxpropertiesvalidation1boxedboolean), +[MaxpropertiesValidation1BoxedNumber](#maxpropertiesvalidation1boxednumber), +[MaxpropertiesValidation1BoxedString](#maxpropertiesvalidation1boxedstring), +[MaxpropertiesValidation1BoxedList](#maxpropertiesvalidation1boxedlist), +[MaxpropertiesValidation1BoxedMap](#maxpropertiesvalidation1boxedmap) + +sealed interface that stores validated payloads using boxed classes + +## MaxpropertiesValidation1BoxedVoid +data class MaxpropertiesValidation1BoxedVoid
+implements [MaxpropertiesValidation1Boxed](#maxpropertiesvalidation1boxed) + +data class that stores validated null payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| MaxpropertiesValidation1BoxedVoid(Nothing? data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| Nothing? | data()
validated payload | +| Any? | getData()
validated payload | + +## MaxpropertiesValidation1BoxedBoolean +data class MaxpropertiesValidation1BoxedBoolean
+implements [MaxpropertiesValidation1Boxed](#maxpropertiesvalidation1boxed) + +record that stores validated boolean payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| MaxpropertiesValidation1BoxedBoolean(boolean data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| boolean | data()
validated payload | +| Any? | getData()
validated payload | + +## MaxpropertiesValidation1BoxedNumber +data class MaxpropertiesValidation1BoxedNumber
+implements [MaxpropertiesValidation1Boxed](#maxpropertiesvalidation1boxed) + +data class that stores validated Number payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| MaxpropertiesValidation1BoxedNumber(Number data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| Number | data()
validated payload | +| Any? | getData()
validated payload | + +## MaxpropertiesValidation1BoxedString +data class MaxpropertiesValidation1BoxedString
+implements [MaxpropertiesValidation1Boxed](#maxpropertiesvalidation1boxed) + +data class that stores validated String payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| MaxpropertiesValidation1BoxedString(String data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| String | data()
validated payload | +| Any? | getData()
validated payload | + +## MaxpropertiesValidation1BoxedList +data class MaxpropertiesValidation1BoxedList
+implements [MaxpropertiesValidation1Boxed](#maxpropertiesvalidation1boxed) + +data class that stores validated List payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| MaxpropertiesValidation1BoxedList(FrozenList data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| FrozenList | data()
validated payload | +| Any? | getData()
validated payload | + +## MaxpropertiesValidation1BoxedMap +data class MaxpropertiesValidation1BoxedMap
+implements [MaxpropertiesValidation1Boxed](#maxpropertiesvalidation1boxed) + +data class that stores validated Map payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| MaxpropertiesValidation1BoxedMap(FrozenMap data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| FrozenMap | data()
validated payload | +| Any? | getData()
validated payload | + +## MaxpropertiesValidation1 +class MaxpropertiesValidation1
+extends JsonSchema + +A schema class that validates payloads + +### Field Summary +| Modifier and Type | Field and Description | +| ----------------- | ---------------------- | +| Integer | maxProperties = 2 | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| String | validate(arg: String, configuration: SchemaConfiguration) | +| Nothing? | validate(arg: Nothing?, configuration: SchemaConfiguration) | +| int | validate(arg: int, configuration: SchemaConfiguration) | +| long | validate(arg: long, configuration: SchemaConfiguration) | +| float | validate(arg: float, configuration: SchemaConfiguration) | +| double | validate(arg: double, configuration: SchemaConfiguration) | +| Number | validate(arg: Number, configuration: SchemaConfiguration) | +| boolean | validate(arg: boolean, configuration: SchemaConfiguration) | +| FrozenMap | validate(arg: Map<?, ?>, configuration: SchemaConfiguration) | +| FrozenList | validate(arg: List<*>, configuration: SchemaConfiguration) | +| [MaxpropertiesValidation1BoxedString](#maxpropertiesvalidation1boxedstring) | validateAndBox(String, configuration: SchemaConfiguration) | +| [MaxpropertiesValidation1BoxedVoid](#maxpropertiesvalidation1boxedvoid) | validateAndBox(Nothing?, configuration: SchemaConfiguration) | +| [MaxpropertiesValidation1BoxedNumber](#maxpropertiesvalidation1boxednumber) | validateAndBox(Number, configuration: SchemaConfiguration) | +| [MaxpropertiesValidation1BoxedBoolean](#maxpropertiesvalidation1boxedboolean) | validateAndBox(boolean, configuration: SchemaConfiguration) | +| [MaxpropertiesValidation1BoxedMap](#maxpropertiesvalidation1boxedmap) | validateAndBox(Map<?, ?>, configuration: SchemaConfiguration) | +| [MaxpropertiesValidation1BoxedList](#maxpropertiesvalidation1boxedlist) | validateAndBox(List<*>, configuration: SchemaConfiguration) | +| [MaxpropertiesValidation1Boxed](#maxpropertiesvalidation1boxed) | validateAndBox(Any?, configuration: SchemaConfiguration) | +| Any? | validate(arg: Any?, configuration: SchemaConfiguration) | + +[[Back to top]](#top) [[Back to Component Schemas]](../../../README.md#Component-Schemas) [[Back to README]](../../../README.md) diff --git a/samples/client/3_0_3_unit_test/kotlin/docs/components/schemas/MinimumValidation.md b/samples/client/3_0_3_unit_test/kotlin/docs/components/schemas/MinimumValidation.md new file mode 100644 index 00000000000..94694cf69ec --- /dev/null +++ b/samples/client/3_0_3_unit_test/kotlin/docs/components/schemas/MinimumValidation.md @@ -0,0 +1,169 @@ +# MinimumValidation +org.openapijsonschematools.client.components.schemas.MinimumValidation.java +class MinimumValidation
+ +A class that contains necessary nested +- schema classes (which validate payloads), extends JsonSchema +- sealed interfaces which store validated payloads, Kotlin version of a sum type +- boxed classes which store validated payloads, sealed permits class implementations + +## Nested Class Summary +| Modifier and Type | Class and Description | +| ----------------- | ---------------------- | +| sealed interface | [MinimumValidation.MinimumValidation1Boxed](#minimumvalidation1boxed)
sealed interface for validated payloads | +| record | [MinimumValidation.MinimumValidation1BoxedVoid](#minimumvalidation1boxedvoid)
boxed class to store validated null payloads | +| record | [MinimumValidation.MinimumValidation1BoxedBoolean](#minimumvalidation1boxedboolean)
boxed class to store validated boolean payloads | +| record | [MinimumValidation.MinimumValidation1BoxedNumber](#minimumvalidation1boxednumber)
boxed class to store validated Number payloads | +| record | [MinimumValidation.MinimumValidation1BoxedString](#minimumvalidation1boxedstring)
boxed class to store validated String payloads | +| record | [MinimumValidation.MinimumValidation1BoxedList](#minimumvalidation1boxedlist)
boxed class to store validated List payloads | +| record | [MinimumValidation.MinimumValidation1BoxedMap](#minimumvalidation1boxedmap)
boxed class to store validated Map payloads | +| static class | [MinimumValidation.MinimumValidation1](#minimumvalidation1)
schema class | + +## MinimumValidation1Boxed +sealed interface MinimumValidation1Boxed
+permits
+[MinimumValidation1BoxedVoid](#minimumvalidation1boxedvoid), +[MinimumValidation1BoxedBoolean](#minimumvalidation1boxedboolean), +[MinimumValidation1BoxedNumber](#minimumvalidation1boxednumber), +[MinimumValidation1BoxedString](#minimumvalidation1boxedstring), +[MinimumValidation1BoxedList](#minimumvalidation1boxedlist), +[MinimumValidation1BoxedMap](#minimumvalidation1boxedmap) + +sealed interface that stores validated payloads using boxed classes + +## MinimumValidation1BoxedVoid +data class MinimumValidation1BoxedVoid
+implements [MinimumValidation1Boxed](#minimumvalidation1boxed) + +data class that stores validated null payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| MinimumValidation1BoxedVoid(Nothing? data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| Nothing? | data()
validated payload | +| Any? | getData()
validated payload | + +## MinimumValidation1BoxedBoolean +data class MinimumValidation1BoxedBoolean
+implements [MinimumValidation1Boxed](#minimumvalidation1boxed) + +record that stores validated boolean payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| MinimumValidation1BoxedBoolean(boolean data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| boolean | data()
validated payload | +| Any? | getData()
validated payload | + +## MinimumValidation1BoxedNumber +data class MinimumValidation1BoxedNumber
+implements [MinimumValidation1Boxed](#minimumvalidation1boxed) + +data class that stores validated Number payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| MinimumValidation1BoxedNumber(Number data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| Number | data()
validated payload | +| Any? | getData()
validated payload | + +## MinimumValidation1BoxedString +data class MinimumValidation1BoxedString
+implements [MinimumValidation1Boxed](#minimumvalidation1boxed) + +data class that stores validated String payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| MinimumValidation1BoxedString(String data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| String | data()
validated payload | +| Any? | getData()
validated payload | + +## MinimumValidation1BoxedList +data class MinimumValidation1BoxedList
+implements [MinimumValidation1Boxed](#minimumvalidation1boxed) + +data class that stores validated List payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| MinimumValidation1BoxedList(FrozenList data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| FrozenList | data()
validated payload | +| Any? | getData()
validated payload | + +## MinimumValidation1BoxedMap +data class MinimumValidation1BoxedMap
+implements [MinimumValidation1Boxed](#minimumvalidation1boxed) + +data class that stores validated Map payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| MinimumValidation1BoxedMap(FrozenMap data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| FrozenMap | data()
validated payload | +| Any? | getData()
validated payload | + +## MinimumValidation1 +class MinimumValidation1
+extends JsonSchema + +A schema class that validates payloads + +### Field Summary +| Modifier and Type | Field and Description | +| ----------------- | ---------------------- | +| Number | minimum = 1.1 | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| String | validate(arg: String, configuration: SchemaConfiguration) | +| Nothing? | validate(arg: Nothing?, configuration: SchemaConfiguration) | +| int | validate(arg: int, configuration: SchemaConfiguration) | +| long | validate(arg: long, configuration: SchemaConfiguration) | +| float | validate(arg: float, configuration: SchemaConfiguration) | +| double | validate(arg: double, configuration: SchemaConfiguration) | +| Number | validate(arg: Number, configuration: SchemaConfiguration) | +| boolean | validate(arg: boolean, configuration: SchemaConfiguration) | +| FrozenMap | validate(arg: Map<?, ?>, configuration: SchemaConfiguration) | +| FrozenList | validate(arg: List<*>, configuration: SchemaConfiguration) | +| [MinimumValidation1BoxedString](#minimumvalidation1boxedstring) | validateAndBox(String, configuration: SchemaConfiguration) | +| [MinimumValidation1BoxedVoid](#minimumvalidation1boxedvoid) | validateAndBox(Nothing?, configuration: SchemaConfiguration) | +| [MinimumValidation1BoxedNumber](#minimumvalidation1boxednumber) | validateAndBox(Number, configuration: SchemaConfiguration) | +| [MinimumValidation1BoxedBoolean](#minimumvalidation1boxedboolean) | validateAndBox(boolean, configuration: SchemaConfiguration) | +| [MinimumValidation1BoxedMap](#minimumvalidation1boxedmap) | validateAndBox(Map<?, ?>, configuration: SchemaConfiguration) | +| [MinimumValidation1BoxedList](#minimumvalidation1boxedlist) | validateAndBox(List<*>, configuration: SchemaConfiguration) | +| [MinimumValidation1Boxed](#minimumvalidation1boxed) | validateAndBox(Any?, configuration: SchemaConfiguration) | +| Any? | validate(arg: Any?, configuration: SchemaConfiguration) | + +[[Back to top]](#top) [[Back to Component Schemas]](../../../README.md#Component-Schemas) [[Back to README]](../../../README.md) diff --git a/samples/client/3_0_3_unit_test/kotlin/docs/components/schemas/MinimumValidationWithSignedInteger.md b/samples/client/3_0_3_unit_test/kotlin/docs/components/schemas/MinimumValidationWithSignedInteger.md new file mode 100644 index 00000000000..b898faa9cd1 --- /dev/null +++ b/samples/client/3_0_3_unit_test/kotlin/docs/components/schemas/MinimumValidationWithSignedInteger.md @@ -0,0 +1,169 @@ +# MinimumValidationWithSignedInteger +org.openapijsonschematools.client.components.schemas.MinimumValidationWithSignedInteger.java +class MinimumValidationWithSignedInteger
+ +A class that contains necessary nested +- schema classes (which validate payloads), extends JsonSchema +- sealed interfaces which store validated payloads, Kotlin version of a sum type +- boxed classes which store validated payloads, sealed permits class implementations + +## Nested Class Summary +| Modifier and Type | Class and Description | +| ----------------- | ---------------------- | +| sealed interface | [MinimumValidationWithSignedInteger.MinimumValidationWithSignedInteger1Boxed](#minimumvalidationwithsignedinteger1boxed)
sealed interface for validated payloads | +| record | [MinimumValidationWithSignedInteger.MinimumValidationWithSignedInteger1BoxedVoid](#minimumvalidationwithsignedinteger1boxedvoid)
boxed class to store validated null payloads | +| record | [MinimumValidationWithSignedInteger.MinimumValidationWithSignedInteger1BoxedBoolean](#minimumvalidationwithsignedinteger1boxedboolean)
boxed class to store validated boolean payloads | +| record | [MinimumValidationWithSignedInteger.MinimumValidationWithSignedInteger1BoxedNumber](#minimumvalidationwithsignedinteger1boxednumber)
boxed class to store validated Number payloads | +| record | [MinimumValidationWithSignedInteger.MinimumValidationWithSignedInteger1BoxedString](#minimumvalidationwithsignedinteger1boxedstring)
boxed class to store validated String payloads | +| record | [MinimumValidationWithSignedInteger.MinimumValidationWithSignedInteger1BoxedList](#minimumvalidationwithsignedinteger1boxedlist)
boxed class to store validated List payloads | +| record | [MinimumValidationWithSignedInteger.MinimumValidationWithSignedInteger1BoxedMap](#minimumvalidationwithsignedinteger1boxedmap)
boxed class to store validated Map payloads | +| static class | [MinimumValidationWithSignedInteger.MinimumValidationWithSignedInteger1](#minimumvalidationwithsignedinteger1)
schema class | + +## MinimumValidationWithSignedInteger1Boxed +sealed interface MinimumValidationWithSignedInteger1Boxed
+permits
+[MinimumValidationWithSignedInteger1BoxedVoid](#minimumvalidationwithsignedinteger1boxedvoid), +[MinimumValidationWithSignedInteger1BoxedBoolean](#minimumvalidationwithsignedinteger1boxedboolean), +[MinimumValidationWithSignedInteger1BoxedNumber](#minimumvalidationwithsignedinteger1boxednumber), +[MinimumValidationWithSignedInteger1BoxedString](#minimumvalidationwithsignedinteger1boxedstring), +[MinimumValidationWithSignedInteger1BoxedList](#minimumvalidationwithsignedinteger1boxedlist), +[MinimumValidationWithSignedInteger1BoxedMap](#minimumvalidationwithsignedinteger1boxedmap) + +sealed interface that stores validated payloads using boxed classes + +## MinimumValidationWithSignedInteger1BoxedVoid +data class MinimumValidationWithSignedInteger1BoxedVoid
+implements [MinimumValidationWithSignedInteger1Boxed](#minimumvalidationwithsignedinteger1boxed) + +data class that stores validated null payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| MinimumValidationWithSignedInteger1BoxedVoid(Nothing? data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| Nothing? | data()
validated payload | +| Any? | getData()
validated payload | + +## MinimumValidationWithSignedInteger1BoxedBoolean +data class MinimumValidationWithSignedInteger1BoxedBoolean
+implements [MinimumValidationWithSignedInteger1Boxed](#minimumvalidationwithsignedinteger1boxed) + +record that stores validated boolean payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| MinimumValidationWithSignedInteger1BoxedBoolean(boolean data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| boolean | data()
validated payload | +| Any? | getData()
validated payload | + +## MinimumValidationWithSignedInteger1BoxedNumber +data class MinimumValidationWithSignedInteger1BoxedNumber
+implements [MinimumValidationWithSignedInteger1Boxed](#minimumvalidationwithsignedinteger1boxed) + +data class that stores validated Number payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| MinimumValidationWithSignedInteger1BoxedNumber(Number data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| Number | data()
validated payload | +| Any? | getData()
validated payload | + +## MinimumValidationWithSignedInteger1BoxedString +data class MinimumValidationWithSignedInteger1BoxedString
+implements [MinimumValidationWithSignedInteger1Boxed](#minimumvalidationwithsignedinteger1boxed) + +data class that stores validated String payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| MinimumValidationWithSignedInteger1BoxedString(String data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| String | data()
validated payload | +| Any? | getData()
validated payload | + +## MinimumValidationWithSignedInteger1BoxedList +data class MinimumValidationWithSignedInteger1BoxedList
+implements [MinimumValidationWithSignedInteger1Boxed](#minimumvalidationwithsignedinteger1boxed) + +data class that stores validated List payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| MinimumValidationWithSignedInteger1BoxedList(FrozenList data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| FrozenList | data()
validated payload | +| Any? | getData()
validated payload | + +## MinimumValidationWithSignedInteger1BoxedMap +data class MinimumValidationWithSignedInteger1BoxedMap
+implements [MinimumValidationWithSignedInteger1Boxed](#minimumvalidationwithsignedinteger1boxed) + +data class that stores validated Map payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| MinimumValidationWithSignedInteger1BoxedMap(FrozenMap data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| FrozenMap | data()
validated payload | +| Any? | getData()
validated payload | + +## MinimumValidationWithSignedInteger1 +class MinimumValidationWithSignedInteger1
+extends JsonSchema + +A schema class that validates payloads + +### Field Summary +| Modifier and Type | Field and Description | +| ----------------- | ---------------------- | +| Number | minimum = -2 | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| String | validate(arg: String, configuration: SchemaConfiguration) | +| Nothing? | validate(arg: Nothing?, configuration: SchemaConfiguration) | +| int | validate(arg: int, configuration: SchemaConfiguration) | +| long | validate(arg: long, configuration: SchemaConfiguration) | +| float | validate(arg: float, configuration: SchemaConfiguration) | +| double | validate(arg: double, configuration: SchemaConfiguration) | +| Number | validate(arg: Number, configuration: SchemaConfiguration) | +| boolean | validate(arg: boolean, configuration: SchemaConfiguration) | +| FrozenMap | validate(arg: Map<?, ?>, configuration: SchemaConfiguration) | +| FrozenList | validate(arg: List<*>, configuration: SchemaConfiguration) | +| [MinimumValidationWithSignedInteger1BoxedString](#minimumvalidationwithsignedinteger1boxedstring) | validateAndBox(String, configuration: SchemaConfiguration) | +| [MinimumValidationWithSignedInteger1BoxedVoid](#minimumvalidationwithsignedinteger1boxedvoid) | validateAndBox(Nothing?, configuration: SchemaConfiguration) | +| [MinimumValidationWithSignedInteger1BoxedNumber](#minimumvalidationwithsignedinteger1boxednumber) | validateAndBox(Number, configuration: SchemaConfiguration) | +| [MinimumValidationWithSignedInteger1BoxedBoolean](#minimumvalidationwithsignedinteger1boxedboolean) | validateAndBox(boolean, configuration: SchemaConfiguration) | +| [MinimumValidationWithSignedInteger1BoxedMap](#minimumvalidationwithsignedinteger1boxedmap) | validateAndBox(Map<?, ?>, configuration: SchemaConfiguration) | +| [MinimumValidationWithSignedInteger1BoxedList](#minimumvalidationwithsignedinteger1boxedlist) | validateAndBox(List<*>, configuration: SchemaConfiguration) | +| [MinimumValidationWithSignedInteger1Boxed](#minimumvalidationwithsignedinteger1boxed) | validateAndBox(Any?, configuration: SchemaConfiguration) | +| Any? | validate(arg: Any?, configuration: SchemaConfiguration) | + +[[Back to top]](#top) [[Back to Component Schemas]](../../../README.md#Component-Schemas) [[Back to README]](../../../README.md) diff --git a/samples/client/3_0_3_unit_test/kotlin/docs/components/schemas/MinitemsValidation.md b/samples/client/3_0_3_unit_test/kotlin/docs/components/schemas/MinitemsValidation.md new file mode 100644 index 00000000000..e095c974cd9 --- /dev/null +++ b/samples/client/3_0_3_unit_test/kotlin/docs/components/schemas/MinitemsValidation.md @@ -0,0 +1,169 @@ +# MinitemsValidation +org.openapijsonschematools.client.components.schemas.MinitemsValidation.java +class MinitemsValidation
+ +A class that contains necessary nested +- schema classes (which validate payloads), extends JsonSchema +- sealed interfaces which store validated payloads, Kotlin version of a sum type +- boxed classes which store validated payloads, sealed permits class implementations + +## Nested Class Summary +| Modifier and Type | Class and Description | +| ----------------- | ---------------------- | +| sealed interface | [MinitemsValidation.MinitemsValidation1Boxed](#minitemsvalidation1boxed)
sealed interface for validated payloads | +| record | [MinitemsValidation.MinitemsValidation1BoxedVoid](#minitemsvalidation1boxedvoid)
boxed class to store validated null payloads | +| record | [MinitemsValidation.MinitemsValidation1BoxedBoolean](#minitemsvalidation1boxedboolean)
boxed class to store validated boolean payloads | +| record | [MinitemsValidation.MinitemsValidation1BoxedNumber](#minitemsvalidation1boxednumber)
boxed class to store validated Number payloads | +| record | [MinitemsValidation.MinitemsValidation1BoxedString](#minitemsvalidation1boxedstring)
boxed class to store validated String payloads | +| record | [MinitemsValidation.MinitemsValidation1BoxedList](#minitemsvalidation1boxedlist)
boxed class to store validated List payloads | +| record | [MinitemsValidation.MinitemsValidation1BoxedMap](#minitemsvalidation1boxedmap)
boxed class to store validated Map payloads | +| static class | [MinitemsValidation.MinitemsValidation1](#minitemsvalidation1)
schema class | + +## MinitemsValidation1Boxed +sealed interface MinitemsValidation1Boxed
+permits
+[MinitemsValidation1BoxedVoid](#minitemsvalidation1boxedvoid), +[MinitemsValidation1BoxedBoolean](#minitemsvalidation1boxedboolean), +[MinitemsValidation1BoxedNumber](#minitemsvalidation1boxednumber), +[MinitemsValidation1BoxedString](#minitemsvalidation1boxedstring), +[MinitemsValidation1BoxedList](#minitemsvalidation1boxedlist), +[MinitemsValidation1BoxedMap](#minitemsvalidation1boxedmap) + +sealed interface that stores validated payloads using boxed classes + +## MinitemsValidation1BoxedVoid +data class MinitemsValidation1BoxedVoid
+implements [MinitemsValidation1Boxed](#minitemsvalidation1boxed) + +data class that stores validated null payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| MinitemsValidation1BoxedVoid(Nothing? data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| Nothing? | data()
validated payload | +| Any? | getData()
validated payload | + +## MinitemsValidation1BoxedBoolean +data class MinitemsValidation1BoxedBoolean
+implements [MinitemsValidation1Boxed](#minitemsvalidation1boxed) + +record that stores validated boolean payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| MinitemsValidation1BoxedBoolean(boolean data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| boolean | data()
validated payload | +| Any? | getData()
validated payload | + +## MinitemsValidation1BoxedNumber +data class MinitemsValidation1BoxedNumber
+implements [MinitemsValidation1Boxed](#minitemsvalidation1boxed) + +data class that stores validated Number payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| MinitemsValidation1BoxedNumber(Number data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| Number | data()
validated payload | +| Any? | getData()
validated payload | + +## MinitemsValidation1BoxedString +data class MinitemsValidation1BoxedString
+implements [MinitemsValidation1Boxed](#minitemsvalidation1boxed) + +data class that stores validated String payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| MinitemsValidation1BoxedString(String data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| String | data()
validated payload | +| Any? | getData()
validated payload | + +## MinitemsValidation1BoxedList +data class MinitemsValidation1BoxedList
+implements [MinitemsValidation1Boxed](#minitemsvalidation1boxed) + +data class that stores validated List payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| MinitemsValidation1BoxedList(FrozenList data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| FrozenList | data()
validated payload | +| Any? | getData()
validated payload | + +## MinitemsValidation1BoxedMap +data class MinitemsValidation1BoxedMap
+implements [MinitemsValidation1Boxed](#minitemsvalidation1boxed) + +data class that stores validated Map payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| MinitemsValidation1BoxedMap(FrozenMap data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| FrozenMap | data()
validated payload | +| Any? | getData()
validated payload | + +## MinitemsValidation1 +class MinitemsValidation1
+extends JsonSchema + +A schema class that validates payloads + +### Field Summary +| Modifier and Type | Field and Description | +| ----------------- | ---------------------- | +| Integer | minItems = 1 | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| String | validate(arg: String, configuration: SchemaConfiguration) | +| Nothing? | validate(arg: Nothing?, configuration: SchemaConfiguration) | +| int | validate(arg: int, configuration: SchemaConfiguration) | +| long | validate(arg: long, configuration: SchemaConfiguration) | +| float | validate(arg: float, configuration: SchemaConfiguration) | +| double | validate(arg: double, configuration: SchemaConfiguration) | +| Number | validate(arg: Number, configuration: SchemaConfiguration) | +| boolean | validate(arg: boolean, configuration: SchemaConfiguration) | +| FrozenMap | validate(arg: Map<?, ?>, configuration: SchemaConfiguration) | +| FrozenList | validate(arg: List<*>, configuration: SchemaConfiguration) | +| [MinitemsValidation1BoxedString](#minitemsvalidation1boxedstring) | validateAndBox(String, configuration: SchemaConfiguration) | +| [MinitemsValidation1BoxedVoid](#minitemsvalidation1boxedvoid) | validateAndBox(Nothing?, configuration: SchemaConfiguration) | +| [MinitemsValidation1BoxedNumber](#minitemsvalidation1boxednumber) | validateAndBox(Number, configuration: SchemaConfiguration) | +| [MinitemsValidation1BoxedBoolean](#minitemsvalidation1boxedboolean) | validateAndBox(boolean, configuration: SchemaConfiguration) | +| [MinitemsValidation1BoxedMap](#minitemsvalidation1boxedmap) | validateAndBox(Map<?, ?>, configuration: SchemaConfiguration) | +| [MinitemsValidation1BoxedList](#minitemsvalidation1boxedlist) | validateAndBox(List<*>, configuration: SchemaConfiguration) | +| [MinitemsValidation1Boxed](#minitemsvalidation1boxed) | validateAndBox(Any?, configuration: SchemaConfiguration) | +| Any? | validate(arg: Any?, configuration: SchemaConfiguration) | + +[[Back to top]](#top) [[Back to Component Schemas]](../../../README.md#Component-Schemas) [[Back to README]](../../../README.md) diff --git a/samples/client/3_0_3_unit_test/kotlin/docs/components/schemas/MinlengthValidation.md b/samples/client/3_0_3_unit_test/kotlin/docs/components/schemas/MinlengthValidation.md new file mode 100644 index 00000000000..3905f4a2411 --- /dev/null +++ b/samples/client/3_0_3_unit_test/kotlin/docs/components/schemas/MinlengthValidation.md @@ -0,0 +1,169 @@ +# MinlengthValidation +org.openapijsonschematools.client.components.schemas.MinlengthValidation.java +class MinlengthValidation
+ +A class that contains necessary nested +- schema classes (which validate payloads), extends JsonSchema +- sealed interfaces which store validated payloads, Kotlin version of a sum type +- boxed classes which store validated payloads, sealed permits class implementations + +## Nested Class Summary +| Modifier and Type | Class and Description | +| ----------------- | ---------------------- | +| sealed interface | [MinlengthValidation.MinlengthValidation1Boxed](#minlengthvalidation1boxed)
sealed interface for validated payloads | +| record | [MinlengthValidation.MinlengthValidation1BoxedVoid](#minlengthvalidation1boxedvoid)
boxed class to store validated null payloads | +| record | [MinlengthValidation.MinlengthValidation1BoxedBoolean](#minlengthvalidation1boxedboolean)
boxed class to store validated boolean payloads | +| record | [MinlengthValidation.MinlengthValidation1BoxedNumber](#minlengthvalidation1boxednumber)
boxed class to store validated Number payloads | +| record | [MinlengthValidation.MinlengthValidation1BoxedString](#minlengthvalidation1boxedstring)
boxed class to store validated String payloads | +| record | [MinlengthValidation.MinlengthValidation1BoxedList](#minlengthvalidation1boxedlist)
boxed class to store validated List payloads | +| record | [MinlengthValidation.MinlengthValidation1BoxedMap](#minlengthvalidation1boxedmap)
boxed class to store validated Map payloads | +| static class | [MinlengthValidation.MinlengthValidation1](#minlengthvalidation1)
schema class | + +## MinlengthValidation1Boxed +sealed interface MinlengthValidation1Boxed
+permits
+[MinlengthValidation1BoxedVoid](#minlengthvalidation1boxedvoid), +[MinlengthValidation1BoxedBoolean](#minlengthvalidation1boxedboolean), +[MinlengthValidation1BoxedNumber](#minlengthvalidation1boxednumber), +[MinlengthValidation1BoxedString](#minlengthvalidation1boxedstring), +[MinlengthValidation1BoxedList](#minlengthvalidation1boxedlist), +[MinlengthValidation1BoxedMap](#minlengthvalidation1boxedmap) + +sealed interface that stores validated payloads using boxed classes + +## MinlengthValidation1BoxedVoid +data class MinlengthValidation1BoxedVoid
+implements [MinlengthValidation1Boxed](#minlengthvalidation1boxed) + +data class that stores validated null payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| MinlengthValidation1BoxedVoid(Nothing? data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| Nothing? | data()
validated payload | +| Any? | getData()
validated payload | + +## MinlengthValidation1BoxedBoolean +data class MinlengthValidation1BoxedBoolean
+implements [MinlengthValidation1Boxed](#minlengthvalidation1boxed) + +record that stores validated boolean payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| MinlengthValidation1BoxedBoolean(boolean data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| boolean | data()
validated payload | +| Any? | getData()
validated payload | + +## MinlengthValidation1BoxedNumber +data class MinlengthValidation1BoxedNumber
+implements [MinlengthValidation1Boxed](#minlengthvalidation1boxed) + +data class that stores validated Number payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| MinlengthValidation1BoxedNumber(Number data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| Number | data()
validated payload | +| Any? | getData()
validated payload | + +## MinlengthValidation1BoxedString +data class MinlengthValidation1BoxedString
+implements [MinlengthValidation1Boxed](#minlengthvalidation1boxed) + +data class that stores validated String payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| MinlengthValidation1BoxedString(String data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| String | data()
validated payload | +| Any? | getData()
validated payload | + +## MinlengthValidation1BoxedList +data class MinlengthValidation1BoxedList
+implements [MinlengthValidation1Boxed](#minlengthvalidation1boxed) + +data class that stores validated List payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| MinlengthValidation1BoxedList(FrozenList data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| FrozenList | data()
validated payload | +| Any? | getData()
validated payload | + +## MinlengthValidation1BoxedMap +data class MinlengthValidation1BoxedMap
+implements [MinlengthValidation1Boxed](#minlengthvalidation1boxed) + +data class that stores validated Map payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| MinlengthValidation1BoxedMap(FrozenMap data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| FrozenMap | data()
validated payload | +| Any? | getData()
validated payload | + +## MinlengthValidation1 +class MinlengthValidation1
+extends JsonSchema + +A schema class that validates payloads + +### Field Summary +| Modifier and Type | Field and Description | +| ----------------- | ---------------------- | +| Integer | minLength = 2 | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| String | validate(arg: String, configuration: SchemaConfiguration) | +| Nothing? | validate(arg: Nothing?, configuration: SchemaConfiguration) | +| int | validate(arg: int, configuration: SchemaConfiguration) | +| long | validate(arg: long, configuration: SchemaConfiguration) | +| float | validate(arg: float, configuration: SchemaConfiguration) | +| double | validate(arg: double, configuration: SchemaConfiguration) | +| Number | validate(arg: Number, configuration: SchemaConfiguration) | +| boolean | validate(arg: boolean, configuration: SchemaConfiguration) | +| FrozenMap | validate(arg: Map<?, ?>, configuration: SchemaConfiguration) | +| FrozenList | validate(arg: List<*>, configuration: SchemaConfiguration) | +| [MinlengthValidation1BoxedString](#minlengthvalidation1boxedstring) | validateAndBox(String, configuration: SchemaConfiguration) | +| [MinlengthValidation1BoxedVoid](#minlengthvalidation1boxedvoid) | validateAndBox(Nothing?, configuration: SchemaConfiguration) | +| [MinlengthValidation1BoxedNumber](#minlengthvalidation1boxednumber) | validateAndBox(Number, configuration: SchemaConfiguration) | +| [MinlengthValidation1BoxedBoolean](#minlengthvalidation1boxedboolean) | validateAndBox(boolean, configuration: SchemaConfiguration) | +| [MinlengthValidation1BoxedMap](#minlengthvalidation1boxedmap) | validateAndBox(Map<?, ?>, configuration: SchemaConfiguration) | +| [MinlengthValidation1BoxedList](#minlengthvalidation1boxedlist) | validateAndBox(List<*>, configuration: SchemaConfiguration) | +| [MinlengthValidation1Boxed](#minlengthvalidation1boxed) | validateAndBox(Any?, configuration: SchemaConfiguration) | +| Any? | validate(arg: Any?, configuration: SchemaConfiguration) | + +[[Back to top]](#top) [[Back to Component Schemas]](../../../README.md#Component-Schemas) [[Back to README]](../../../README.md) diff --git a/samples/client/3_0_3_unit_test/kotlin/docs/components/schemas/MinpropertiesValidation.md b/samples/client/3_0_3_unit_test/kotlin/docs/components/schemas/MinpropertiesValidation.md new file mode 100644 index 00000000000..27161315772 --- /dev/null +++ b/samples/client/3_0_3_unit_test/kotlin/docs/components/schemas/MinpropertiesValidation.md @@ -0,0 +1,169 @@ +# MinpropertiesValidation +org.openapijsonschematools.client.components.schemas.MinpropertiesValidation.java +class MinpropertiesValidation
+ +A class that contains necessary nested +- schema classes (which validate payloads), extends JsonSchema +- sealed interfaces which store validated payloads, Kotlin version of a sum type +- boxed classes which store validated payloads, sealed permits class implementations + +## Nested Class Summary +| Modifier and Type | Class and Description | +| ----------------- | ---------------------- | +| sealed interface | [MinpropertiesValidation.MinpropertiesValidation1Boxed](#minpropertiesvalidation1boxed)
sealed interface for validated payloads | +| record | [MinpropertiesValidation.MinpropertiesValidation1BoxedVoid](#minpropertiesvalidation1boxedvoid)
boxed class to store validated null payloads | +| record | [MinpropertiesValidation.MinpropertiesValidation1BoxedBoolean](#minpropertiesvalidation1boxedboolean)
boxed class to store validated boolean payloads | +| record | [MinpropertiesValidation.MinpropertiesValidation1BoxedNumber](#minpropertiesvalidation1boxednumber)
boxed class to store validated Number payloads | +| record | [MinpropertiesValidation.MinpropertiesValidation1BoxedString](#minpropertiesvalidation1boxedstring)
boxed class to store validated String payloads | +| record | [MinpropertiesValidation.MinpropertiesValidation1BoxedList](#minpropertiesvalidation1boxedlist)
boxed class to store validated List payloads | +| record | [MinpropertiesValidation.MinpropertiesValidation1BoxedMap](#minpropertiesvalidation1boxedmap)
boxed class to store validated Map payloads | +| static class | [MinpropertiesValidation.MinpropertiesValidation1](#minpropertiesvalidation1)
schema class | + +## MinpropertiesValidation1Boxed +sealed interface MinpropertiesValidation1Boxed
+permits
+[MinpropertiesValidation1BoxedVoid](#minpropertiesvalidation1boxedvoid), +[MinpropertiesValidation1BoxedBoolean](#minpropertiesvalidation1boxedboolean), +[MinpropertiesValidation1BoxedNumber](#minpropertiesvalidation1boxednumber), +[MinpropertiesValidation1BoxedString](#minpropertiesvalidation1boxedstring), +[MinpropertiesValidation1BoxedList](#minpropertiesvalidation1boxedlist), +[MinpropertiesValidation1BoxedMap](#minpropertiesvalidation1boxedmap) + +sealed interface that stores validated payloads using boxed classes + +## MinpropertiesValidation1BoxedVoid +data class MinpropertiesValidation1BoxedVoid
+implements [MinpropertiesValidation1Boxed](#minpropertiesvalidation1boxed) + +data class that stores validated null payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| MinpropertiesValidation1BoxedVoid(Nothing? data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| Nothing? | data()
validated payload | +| Any? | getData()
validated payload | + +## MinpropertiesValidation1BoxedBoolean +data class MinpropertiesValidation1BoxedBoolean
+implements [MinpropertiesValidation1Boxed](#minpropertiesvalidation1boxed) + +record that stores validated boolean payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| MinpropertiesValidation1BoxedBoolean(boolean data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| boolean | data()
validated payload | +| Any? | getData()
validated payload | + +## MinpropertiesValidation1BoxedNumber +data class MinpropertiesValidation1BoxedNumber
+implements [MinpropertiesValidation1Boxed](#minpropertiesvalidation1boxed) + +data class that stores validated Number payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| MinpropertiesValidation1BoxedNumber(Number data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| Number | data()
validated payload | +| Any? | getData()
validated payload | + +## MinpropertiesValidation1BoxedString +data class MinpropertiesValidation1BoxedString
+implements [MinpropertiesValidation1Boxed](#minpropertiesvalidation1boxed) + +data class that stores validated String payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| MinpropertiesValidation1BoxedString(String data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| String | data()
validated payload | +| Any? | getData()
validated payload | + +## MinpropertiesValidation1BoxedList +data class MinpropertiesValidation1BoxedList
+implements [MinpropertiesValidation1Boxed](#minpropertiesvalidation1boxed) + +data class that stores validated List payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| MinpropertiesValidation1BoxedList(FrozenList data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| FrozenList | data()
validated payload | +| Any? | getData()
validated payload | + +## MinpropertiesValidation1BoxedMap +data class MinpropertiesValidation1BoxedMap
+implements [MinpropertiesValidation1Boxed](#minpropertiesvalidation1boxed) + +data class that stores validated Map payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| MinpropertiesValidation1BoxedMap(FrozenMap data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| FrozenMap | data()
validated payload | +| Any? | getData()
validated payload | + +## MinpropertiesValidation1 +class MinpropertiesValidation1
+extends JsonSchema + +A schema class that validates payloads + +### Field Summary +| Modifier and Type | Field and Description | +| ----------------- | ---------------------- | +| Integer | minProperties = 1 | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| String | validate(arg: String, configuration: SchemaConfiguration) | +| Nothing? | validate(arg: Nothing?, configuration: SchemaConfiguration) | +| int | validate(arg: int, configuration: SchemaConfiguration) | +| long | validate(arg: long, configuration: SchemaConfiguration) | +| float | validate(arg: float, configuration: SchemaConfiguration) | +| double | validate(arg: double, configuration: SchemaConfiguration) | +| Number | validate(arg: Number, configuration: SchemaConfiguration) | +| boolean | validate(arg: boolean, configuration: SchemaConfiguration) | +| FrozenMap | validate(arg: Map<?, ?>, configuration: SchemaConfiguration) | +| FrozenList | validate(arg: List<*>, configuration: SchemaConfiguration) | +| [MinpropertiesValidation1BoxedString](#minpropertiesvalidation1boxedstring) | validateAndBox(String, configuration: SchemaConfiguration) | +| [MinpropertiesValidation1BoxedVoid](#minpropertiesvalidation1boxedvoid) | validateAndBox(Nothing?, configuration: SchemaConfiguration) | +| [MinpropertiesValidation1BoxedNumber](#minpropertiesvalidation1boxednumber) | validateAndBox(Number, configuration: SchemaConfiguration) | +| [MinpropertiesValidation1BoxedBoolean](#minpropertiesvalidation1boxedboolean) | validateAndBox(boolean, configuration: SchemaConfiguration) | +| [MinpropertiesValidation1BoxedMap](#minpropertiesvalidation1boxedmap) | validateAndBox(Map<?, ?>, configuration: SchemaConfiguration) | +| [MinpropertiesValidation1BoxedList](#minpropertiesvalidation1boxedlist) | validateAndBox(List<*>, configuration: SchemaConfiguration) | +| [MinpropertiesValidation1Boxed](#minpropertiesvalidation1boxed) | validateAndBox(Any?, configuration: SchemaConfiguration) | +| Any? | validate(arg: Any?, configuration: SchemaConfiguration) | + +[[Back to top]](#top) [[Back to Component Schemas]](../../../README.md#Component-Schemas) [[Back to README]](../../../README.md) diff --git a/samples/client/3_0_3_unit_test/kotlin/docs/components/schemas/NestedAllofToCheckValidationSemantics.md b/samples/client/3_0_3_unit_test/kotlin/docs/components/schemas/NestedAllofToCheckValidationSemantics.md new file mode 100644 index 00000000000..708628006e4 --- /dev/null +++ b/samples/client/3_0_3_unit_test/kotlin/docs/components/schemas/NestedAllofToCheckValidationSemantics.md @@ -0,0 +1,362 @@ +# NestedAllofToCheckValidationSemantics +org.openapijsonschematools.client.components.schemas.NestedAllofToCheckValidationSemantics.java +class NestedAllofToCheckValidationSemantics
+ +A class that contains necessary nested +- schema classes (which validate payloads), extends JsonSchema +- sealed interfaces which store validated payloads, Kotlin version of a sum type +- boxed classes which store validated payloads, sealed permits class implementations + +## Nested Class Summary +| Modifier and Type | Class and Description | +| ----------------- | ---------------------- | +| sealed interface | [NestedAllofToCheckValidationSemantics.NestedAllofToCheckValidationSemantics1Boxed](#nestedalloftocheckvalidationsemantics1boxed)
sealed interface for validated payloads | +| record | [NestedAllofToCheckValidationSemantics.NestedAllofToCheckValidationSemantics1BoxedVoid](#nestedalloftocheckvalidationsemantics1boxedvoid)
boxed class to store validated null payloads | +| record | [NestedAllofToCheckValidationSemantics.NestedAllofToCheckValidationSemantics1BoxedBoolean](#nestedalloftocheckvalidationsemantics1boxedboolean)
boxed class to store validated boolean payloads | +| record | [NestedAllofToCheckValidationSemantics.NestedAllofToCheckValidationSemantics1BoxedNumber](#nestedalloftocheckvalidationsemantics1boxednumber)
boxed class to store validated Number payloads | +| record | [NestedAllofToCheckValidationSemantics.NestedAllofToCheckValidationSemantics1BoxedString](#nestedalloftocheckvalidationsemantics1boxedstring)
boxed class to store validated String payloads | +| record | [NestedAllofToCheckValidationSemantics.NestedAllofToCheckValidationSemantics1BoxedList](#nestedalloftocheckvalidationsemantics1boxedlist)
boxed class to store validated List payloads | +| record | [NestedAllofToCheckValidationSemantics.NestedAllofToCheckValidationSemantics1BoxedMap](#nestedalloftocheckvalidationsemantics1boxedmap)
boxed class to store validated Map payloads | +| static class | [NestedAllofToCheckValidationSemantics.NestedAllofToCheckValidationSemantics1](#nestedalloftocheckvalidationsemantics1)
schema class | +| sealed interface | [NestedAllofToCheckValidationSemantics.Schema0Boxed](#schema0boxed)
sealed interface for validated payloads | +| record | [NestedAllofToCheckValidationSemantics.Schema0BoxedVoid](#schema0boxedvoid)
boxed class to store validated null payloads | +| record | [NestedAllofToCheckValidationSemantics.Schema0BoxedBoolean](#schema0boxedboolean)
boxed class to store validated boolean payloads | +| record | [NestedAllofToCheckValidationSemantics.Schema0BoxedNumber](#schema0boxednumber)
boxed class to store validated Number payloads | +| record | [NestedAllofToCheckValidationSemantics.Schema0BoxedString](#schema0boxedstring)
boxed class to store validated String payloads | +| record | [NestedAllofToCheckValidationSemantics.Schema0BoxedList](#schema0boxedlist)
boxed class to store validated List payloads | +| record | [NestedAllofToCheckValidationSemantics.Schema0BoxedMap](#schema0boxedmap)
boxed class to store validated Map payloads | +| static class | [NestedAllofToCheckValidationSemantics.Schema0](#schema0)
schema class | +| sealed interface | [NestedAllofToCheckValidationSemantics.Schema01Boxed](#schema01boxed)
sealed interface for validated payloads | +| record | [NestedAllofToCheckValidationSemantics.Schema01BoxedVoid](#schema01boxedvoid)
boxed class to store validated null payloads | +| static class | [NestedAllofToCheckValidationSemantics.Schema01](#schema01)
schema class | + +## NestedAllofToCheckValidationSemantics1Boxed +sealed interface NestedAllofToCheckValidationSemantics1Boxed
+permits
+[NestedAllofToCheckValidationSemantics1BoxedVoid](#nestedalloftocheckvalidationsemantics1boxedvoid), +[NestedAllofToCheckValidationSemantics1BoxedBoolean](#nestedalloftocheckvalidationsemantics1boxedboolean), +[NestedAllofToCheckValidationSemantics1BoxedNumber](#nestedalloftocheckvalidationsemantics1boxednumber), +[NestedAllofToCheckValidationSemantics1BoxedString](#nestedalloftocheckvalidationsemantics1boxedstring), +[NestedAllofToCheckValidationSemantics1BoxedList](#nestedalloftocheckvalidationsemantics1boxedlist), +[NestedAllofToCheckValidationSemantics1BoxedMap](#nestedalloftocheckvalidationsemantics1boxedmap) + +sealed interface that stores validated payloads using boxed classes + +## NestedAllofToCheckValidationSemantics1BoxedVoid +data class NestedAllofToCheckValidationSemantics1BoxedVoid
+implements [NestedAllofToCheckValidationSemantics1Boxed](#nestedalloftocheckvalidationsemantics1boxed) + +data class that stores validated null payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| NestedAllofToCheckValidationSemantics1BoxedVoid(Nothing? data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| Nothing? | data()
validated payload | +| Any? | getData()
validated payload | + +## NestedAllofToCheckValidationSemantics1BoxedBoolean +data class NestedAllofToCheckValidationSemantics1BoxedBoolean
+implements [NestedAllofToCheckValidationSemantics1Boxed](#nestedalloftocheckvalidationsemantics1boxed) + +record that stores validated boolean payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| NestedAllofToCheckValidationSemantics1BoxedBoolean(boolean data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| boolean | data()
validated payload | +| Any? | getData()
validated payload | + +## NestedAllofToCheckValidationSemantics1BoxedNumber +data class NestedAllofToCheckValidationSemantics1BoxedNumber
+implements [NestedAllofToCheckValidationSemantics1Boxed](#nestedalloftocheckvalidationsemantics1boxed) + +data class that stores validated Number payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| NestedAllofToCheckValidationSemantics1BoxedNumber(Number data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| Number | data()
validated payload | +| Any? | getData()
validated payload | + +## NestedAllofToCheckValidationSemantics1BoxedString +data class NestedAllofToCheckValidationSemantics1BoxedString
+implements [NestedAllofToCheckValidationSemantics1Boxed](#nestedalloftocheckvalidationsemantics1boxed) + +data class that stores validated String payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| NestedAllofToCheckValidationSemantics1BoxedString(String data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| String | data()
validated payload | +| Any? | getData()
validated payload | + +## NestedAllofToCheckValidationSemantics1BoxedList +data class NestedAllofToCheckValidationSemantics1BoxedList
+implements [NestedAllofToCheckValidationSemantics1Boxed](#nestedalloftocheckvalidationsemantics1boxed) + +data class that stores validated List payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| NestedAllofToCheckValidationSemantics1BoxedList(FrozenList data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| FrozenList | data()
validated payload | +| Any? | getData()
validated payload | + +## NestedAllofToCheckValidationSemantics1BoxedMap +data class NestedAllofToCheckValidationSemantics1BoxedMap
+implements [NestedAllofToCheckValidationSemantics1Boxed](#nestedalloftocheckvalidationsemantics1boxed) + +data class that stores validated Map payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| NestedAllofToCheckValidationSemantics1BoxedMap(FrozenMap data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| FrozenMap | data()
validated payload | +| Any? | getData()
validated payload | + +## NestedAllofToCheckValidationSemantics1 +class NestedAllofToCheckValidationSemantics1
+extends JsonSchema + +A schema class that validates payloads + +### Field Summary +| Modifier and Type | Field and Description | +| ----------------- | ---------------------- | +| List> | allOf = listOf(
    [Schema0::class.java](#schema0)
;)
| + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| String | validate(arg: String, configuration: SchemaConfiguration) | +| Nothing? | validate(arg: Nothing?, configuration: SchemaConfiguration) | +| int | validate(arg: int, configuration: SchemaConfiguration) | +| long | validate(arg: long, configuration: SchemaConfiguration) | +| float | validate(arg: float, configuration: SchemaConfiguration) | +| double | validate(arg: double, configuration: SchemaConfiguration) | +| Number | validate(arg: Number, configuration: SchemaConfiguration) | +| boolean | validate(arg: boolean, configuration: SchemaConfiguration) | +| FrozenMap | validate(arg: Map<?, ?>, configuration: SchemaConfiguration) | +| FrozenList | validate(arg: List<*>, configuration: SchemaConfiguration) | +| [NestedAllofToCheckValidationSemantics1BoxedString](#nestedalloftocheckvalidationsemantics1boxedstring) | validateAndBox(String, configuration: SchemaConfiguration) | +| [NestedAllofToCheckValidationSemantics1BoxedVoid](#nestedalloftocheckvalidationsemantics1boxedvoid) | validateAndBox(Nothing?, configuration: SchemaConfiguration) | +| [NestedAllofToCheckValidationSemantics1BoxedNumber](#nestedalloftocheckvalidationsemantics1boxednumber) | validateAndBox(Number, configuration: SchemaConfiguration) | +| [NestedAllofToCheckValidationSemantics1BoxedBoolean](#nestedalloftocheckvalidationsemantics1boxedboolean) | validateAndBox(boolean, configuration: SchemaConfiguration) | +| [NestedAllofToCheckValidationSemantics1BoxedMap](#nestedalloftocheckvalidationsemantics1boxedmap) | validateAndBox(Map<?, ?>, configuration: SchemaConfiguration) | +| [NestedAllofToCheckValidationSemantics1BoxedList](#nestedalloftocheckvalidationsemantics1boxedlist) | validateAndBox(List<*>, configuration: SchemaConfiguration) | +| [NestedAllofToCheckValidationSemantics1Boxed](#nestedalloftocheckvalidationsemantics1boxed) | validateAndBox(Any?, configuration: SchemaConfiguration) | +| Any? | validate(arg: Any?, configuration: SchemaConfiguration) | + +## Schema0Boxed +sealed interface Schema0Boxed
+permits
+[Schema0BoxedVoid](#schema0boxedvoid), +[Schema0BoxedBoolean](#schema0boxedboolean), +[Schema0BoxedNumber](#schema0boxednumber), +[Schema0BoxedString](#schema0boxedstring), +[Schema0BoxedList](#schema0boxedlist), +[Schema0BoxedMap](#schema0boxedmap) + +sealed interface that stores validated payloads using boxed classes + +## Schema0BoxedVoid +data class Schema0BoxedVoid
+implements [Schema0Boxed](#schema0boxed) + +data class that stores validated null payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| Schema0BoxedVoid(Nothing? data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| Nothing? | data()
validated payload | +| Any? | getData()
validated payload | + +## Schema0BoxedBoolean +data class Schema0BoxedBoolean
+implements [Schema0Boxed](#schema0boxed) + +record that stores validated boolean payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| Schema0BoxedBoolean(boolean data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| boolean | data()
validated payload | +| Any? | getData()
validated payload | + +## Schema0BoxedNumber +data class Schema0BoxedNumber
+implements [Schema0Boxed](#schema0boxed) + +data class that stores validated Number payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| Schema0BoxedNumber(Number data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| Number | data()
validated payload | +| Any? | getData()
validated payload | + +## Schema0BoxedString +data class Schema0BoxedString
+implements [Schema0Boxed](#schema0boxed) + +data class that stores validated String payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| Schema0BoxedString(String data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| String | data()
validated payload | +| Any? | getData()
validated payload | + +## Schema0BoxedList +data class Schema0BoxedList
+implements [Schema0Boxed](#schema0boxed) + +data class that stores validated List payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| Schema0BoxedList(FrozenList data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| FrozenList | data()
validated payload | +| Any? | getData()
validated payload | + +## Schema0BoxedMap +data class Schema0BoxedMap
+implements [Schema0Boxed](#schema0boxed) + +data class that stores validated Map payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| Schema0BoxedMap(FrozenMap data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| FrozenMap | data()
validated payload | +| Any? | getData()
validated payload | + +## Schema0 +class Schema0
+extends JsonSchema + +A schema class that validates payloads + +### Field Summary +| Modifier and Type | Field and Description | +| ----------------- | ---------------------- | +| List> | allOf = listOf(
    [Schema01::class.java](#schema01)
;)
| + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| String | validate(arg: String, configuration: SchemaConfiguration) | +| Nothing? | validate(arg: Nothing?, configuration: SchemaConfiguration) | +| int | validate(arg: int, configuration: SchemaConfiguration) | +| long | validate(arg: long, configuration: SchemaConfiguration) | +| float | validate(arg: float, configuration: SchemaConfiguration) | +| double | validate(arg: double, configuration: SchemaConfiguration) | +| Number | validate(arg: Number, configuration: SchemaConfiguration) | +| boolean | validate(arg: boolean, configuration: SchemaConfiguration) | +| FrozenMap | validate(arg: Map<?, ?>, configuration: SchemaConfiguration) | +| FrozenList | validate(arg: List<*>, configuration: SchemaConfiguration) | +| [Schema0BoxedString](#schema0boxedstring) | validateAndBox(String, configuration: SchemaConfiguration) | +| [Schema0BoxedVoid](#schema0boxedvoid) | validateAndBox(Nothing?, configuration: SchemaConfiguration) | +| [Schema0BoxedNumber](#schema0boxednumber) | validateAndBox(Number, configuration: SchemaConfiguration) | +| [Schema0BoxedBoolean](#schema0boxedboolean) | validateAndBox(boolean, configuration: SchemaConfiguration) | +| [Schema0BoxedMap](#schema0boxedmap) | validateAndBox(Map<?, ?>, configuration: SchemaConfiguration) | +| [Schema0BoxedList](#schema0boxedlist) | validateAndBox(List<*>, configuration: SchemaConfiguration) | +| [Schema0Boxed](#schema0boxed) | validateAndBox(Any?, configuration: SchemaConfiguration) | +| Any? | validate(arg: Any?, configuration: SchemaConfiguration) | + +## Schema01Boxed +sealed interface Schema01Boxed
+permits
+[Schema01BoxedVoid](#schema01boxedvoid) + +sealed interface that stores validated payloads using boxed classes + +## Schema01BoxedVoid +data class Schema01BoxedVoid
+implements [Schema01Boxed](#schema01boxed) + +data class that stores validated null payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| Schema01BoxedVoid(Nothing? data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| Nothing? | data()
validated payload | +| Any? | getData()
validated payload | + +## Schema01 +class Schema01
+extends NullJsonSchema.NullJsonSchema1 + +A schema class that validates payloads + +| Methods Inherited from class org.openapijsonschematools.client.schemas.NullJsonSchema.NullJsonSchema1 | +| ------------------------------------------------------------------ | +| validate | +| validateAndBox | + +[[Back to top]](#top) [[Back to Component Schemas]](../../../README.md#Component-Schemas) [[Back to README]](../../../README.md) diff --git a/samples/client/3_0_3_unit_test/kotlin/docs/components/schemas/NestedAnyofToCheckValidationSemantics.md b/samples/client/3_0_3_unit_test/kotlin/docs/components/schemas/NestedAnyofToCheckValidationSemantics.md new file mode 100644 index 00000000000..d145f8fdf0a --- /dev/null +++ b/samples/client/3_0_3_unit_test/kotlin/docs/components/schemas/NestedAnyofToCheckValidationSemantics.md @@ -0,0 +1,362 @@ +# NestedAnyofToCheckValidationSemantics +org.openapijsonschematools.client.components.schemas.NestedAnyofToCheckValidationSemantics.java +class NestedAnyofToCheckValidationSemantics
+ +A class that contains necessary nested +- schema classes (which validate payloads), extends JsonSchema +- sealed interfaces which store validated payloads, Kotlin version of a sum type +- boxed classes which store validated payloads, sealed permits class implementations + +## Nested Class Summary +| Modifier and Type | Class and Description | +| ----------------- | ---------------------- | +| sealed interface | [NestedAnyofToCheckValidationSemantics.NestedAnyofToCheckValidationSemantics1Boxed](#nestedanyoftocheckvalidationsemantics1boxed)
sealed interface for validated payloads | +| record | [NestedAnyofToCheckValidationSemantics.NestedAnyofToCheckValidationSemantics1BoxedVoid](#nestedanyoftocheckvalidationsemantics1boxedvoid)
boxed class to store validated null payloads | +| record | [NestedAnyofToCheckValidationSemantics.NestedAnyofToCheckValidationSemantics1BoxedBoolean](#nestedanyoftocheckvalidationsemantics1boxedboolean)
boxed class to store validated boolean payloads | +| record | [NestedAnyofToCheckValidationSemantics.NestedAnyofToCheckValidationSemantics1BoxedNumber](#nestedanyoftocheckvalidationsemantics1boxednumber)
boxed class to store validated Number payloads | +| record | [NestedAnyofToCheckValidationSemantics.NestedAnyofToCheckValidationSemantics1BoxedString](#nestedanyoftocheckvalidationsemantics1boxedstring)
boxed class to store validated String payloads | +| record | [NestedAnyofToCheckValidationSemantics.NestedAnyofToCheckValidationSemantics1BoxedList](#nestedanyoftocheckvalidationsemantics1boxedlist)
boxed class to store validated List payloads | +| record | [NestedAnyofToCheckValidationSemantics.NestedAnyofToCheckValidationSemantics1BoxedMap](#nestedanyoftocheckvalidationsemantics1boxedmap)
boxed class to store validated Map payloads | +| static class | [NestedAnyofToCheckValidationSemantics.NestedAnyofToCheckValidationSemantics1](#nestedanyoftocheckvalidationsemantics1)
schema class | +| sealed interface | [NestedAnyofToCheckValidationSemantics.Schema0Boxed](#schema0boxed)
sealed interface for validated payloads | +| record | [NestedAnyofToCheckValidationSemantics.Schema0BoxedVoid](#schema0boxedvoid)
boxed class to store validated null payloads | +| record | [NestedAnyofToCheckValidationSemantics.Schema0BoxedBoolean](#schema0boxedboolean)
boxed class to store validated boolean payloads | +| record | [NestedAnyofToCheckValidationSemantics.Schema0BoxedNumber](#schema0boxednumber)
boxed class to store validated Number payloads | +| record | [NestedAnyofToCheckValidationSemantics.Schema0BoxedString](#schema0boxedstring)
boxed class to store validated String payloads | +| record | [NestedAnyofToCheckValidationSemantics.Schema0BoxedList](#schema0boxedlist)
boxed class to store validated List payloads | +| record | [NestedAnyofToCheckValidationSemantics.Schema0BoxedMap](#schema0boxedmap)
boxed class to store validated Map payloads | +| static class | [NestedAnyofToCheckValidationSemantics.Schema0](#schema0)
schema class | +| sealed interface | [NestedAnyofToCheckValidationSemantics.Schema01Boxed](#schema01boxed)
sealed interface for validated payloads | +| record | [NestedAnyofToCheckValidationSemantics.Schema01BoxedVoid](#schema01boxedvoid)
boxed class to store validated null payloads | +| static class | [NestedAnyofToCheckValidationSemantics.Schema01](#schema01)
schema class | + +## NestedAnyofToCheckValidationSemantics1Boxed +sealed interface NestedAnyofToCheckValidationSemantics1Boxed
+permits
+[NestedAnyofToCheckValidationSemantics1BoxedVoid](#nestedanyoftocheckvalidationsemantics1boxedvoid), +[NestedAnyofToCheckValidationSemantics1BoxedBoolean](#nestedanyoftocheckvalidationsemantics1boxedboolean), +[NestedAnyofToCheckValidationSemantics1BoxedNumber](#nestedanyoftocheckvalidationsemantics1boxednumber), +[NestedAnyofToCheckValidationSemantics1BoxedString](#nestedanyoftocheckvalidationsemantics1boxedstring), +[NestedAnyofToCheckValidationSemantics1BoxedList](#nestedanyoftocheckvalidationsemantics1boxedlist), +[NestedAnyofToCheckValidationSemantics1BoxedMap](#nestedanyoftocheckvalidationsemantics1boxedmap) + +sealed interface that stores validated payloads using boxed classes + +## NestedAnyofToCheckValidationSemantics1BoxedVoid +data class NestedAnyofToCheckValidationSemantics1BoxedVoid
+implements [NestedAnyofToCheckValidationSemantics1Boxed](#nestedanyoftocheckvalidationsemantics1boxed) + +data class that stores validated null payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| NestedAnyofToCheckValidationSemantics1BoxedVoid(Nothing? data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| Nothing? | data()
validated payload | +| Any? | getData()
validated payload | + +## NestedAnyofToCheckValidationSemantics1BoxedBoolean +data class NestedAnyofToCheckValidationSemantics1BoxedBoolean
+implements [NestedAnyofToCheckValidationSemantics1Boxed](#nestedanyoftocheckvalidationsemantics1boxed) + +record that stores validated boolean payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| NestedAnyofToCheckValidationSemantics1BoxedBoolean(boolean data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| boolean | data()
validated payload | +| Any? | getData()
validated payload | + +## NestedAnyofToCheckValidationSemantics1BoxedNumber +data class NestedAnyofToCheckValidationSemantics1BoxedNumber
+implements [NestedAnyofToCheckValidationSemantics1Boxed](#nestedanyoftocheckvalidationsemantics1boxed) + +data class that stores validated Number payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| NestedAnyofToCheckValidationSemantics1BoxedNumber(Number data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| Number | data()
validated payload | +| Any? | getData()
validated payload | + +## NestedAnyofToCheckValidationSemantics1BoxedString +data class NestedAnyofToCheckValidationSemantics1BoxedString
+implements [NestedAnyofToCheckValidationSemantics1Boxed](#nestedanyoftocheckvalidationsemantics1boxed) + +data class that stores validated String payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| NestedAnyofToCheckValidationSemantics1BoxedString(String data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| String | data()
validated payload | +| Any? | getData()
validated payload | + +## NestedAnyofToCheckValidationSemantics1BoxedList +data class NestedAnyofToCheckValidationSemantics1BoxedList
+implements [NestedAnyofToCheckValidationSemantics1Boxed](#nestedanyoftocheckvalidationsemantics1boxed) + +data class that stores validated List payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| NestedAnyofToCheckValidationSemantics1BoxedList(FrozenList data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| FrozenList | data()
validated payload | +| Any? | getData()
validated payload | + +## NestedAnyofToCheckValidationSemantics1BoxedMap +data class NestedAnyofToCheckValidationSemantics1BoxedMap
+implements [NestedAnyofToCheckValidationSemantics1Boxed](#nestedanyoftocheckvalidationsemantics1boxed) + +data class that stores validated Map payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| NestedAnyofToCheckValidationSemantics1BoxedMap(FrozenMap data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| FrozenMap | data()
validated payload | +| Any? | getData()
validated payload | + +## NestedAnyofToCheckValidationSemantics1 +class NestedAnyofToCheckValidationSemantics1
+extends JsonSchema + +A schema class that validates payloads + +### Field Summary +| Modifier and Type | Field and Description | +| ----------------- | ---------------------- | +| List> | anyOf = listOf(
    [Schema0::class.java](#schema0)
)
| + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| String | validate(arg: String, configuration: SchemaConfiguration) | +| Nothing? | validate(arg: Nothing?, configuration: SchemaConfiguration) | +| int | validate(arg: int, configuration: SchemaConfiguration) | +| long | validate(arg: long, configuration: SchemaConfiguration) | +| float | validate(arg: float, configuration: SchemaConfiguration) | +| double | validate(arg: double, configuration: SchemaConfiguration) | +| Number | validate(arg: Number, configuration: SchemaConfiguration) | +| boolean | validate(arg: boolean, configuration: SchemaConfiguration) | +| FrozenMap | validate(arg: Map<?, ?>, configuration: SchemaConfiguration) | +| FrozenList | validate(arg: List<*>, configuration: SchemaConfiguration) | +| [NestedAnyofToCheckValidationSemantics1BoxedString](#nestedanyoftocheckvalidationsemantics1boxedstring) | validateAndBox(String, configuration: SchemaConfiguration) | +| [NestedAnyofToCheckValidationSemantics1BoxedVoid](#nestedanyoftocheckvalidationsemantics1boxedvoid) | validateAndBox(Nothing?, configuration: SchemaConfiguration) | +| [NestedAnyofToCheckValidationSemantics1BoxedNumber](#nestedanyoftocheckvalidationsemantics1boxednumber) | validateAndBox(Number, configuration: SchemaConfiguration) | +| [NestedAnyofToCheckValidationSemantics1BoxedBoolean](#nestedanyoftocheckvalidationsemantics1boxedboolean) | validateAndBox(boolean, configuration: SchemaConfiguration) | +| [NestedAnyofToCheckValidationSemantics1BoxedMap](#nestedanyoftocheckvalidationsemantics1boxedmap) | validateAndBox(Map<?, ?>, configuration: SchemaConfiguration) | +| [NestedAnyofToCheckValidationSemantics1BoxedList](#nestedanyoftocheckvalidationsemantics1boxedlist) | validateAndBox(List<*>, configuration: SchemaConfiguration) | +| [NestedAnyofToCheckValidationSemantics1Boxed](#nestedanyoftocheckvalidationsemantics1boxed) | validateAndBox(Any?, configuration: SchemaConfiguration) | +| Any? | validate(arg: Any?, configuration: SchemaConfiguration) | + +## Schema0Boxed +sealed interface Schema0Boxed
+permits
+[Schema0BoxedVoid](#schema0boxedvoid), +[Schema0BoxedBoolean](#schema0boxedboolean), +[Schema0BoxedNumber](#schema0boxednumber), +[Schema0BoxedString](#schema0boxedstring), +[Schema0BoxedList](#schema0boxedlist), +[Schema0BoxedMap](#schema0boxedmap) + +sealed interface that stores validated payloads using boxed classes + +## Schema0BoxedVoid +data class Schema0BoxedVoid
+implements [Schema0Boxed](#schema0boxed) + +data class that stores validated null payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| Schema0BoxedVoid(Nothing? data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| Nothing? | data()
validated payload | +| Any? | getData()
validated payload | + +## Schema0BoxedBoolean +data class Schema0BoxedBoolean
+implements [Schema0Boxed](#schema0boxed) + +record that stores validated boolean payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| Schema0BoxedBoolean(boolean data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| boolean | data()
validated payload | +| Any? | getData()
validated payload | + +## Schema0BoxedNumber +data class Schema0BoxedNumber
+implements [Schema0Boxed](#schema0boxed) + +data class that stores validated Number payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| Schema0BoxedNumber(Number data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| Number | data()
validated payload | +| Any? | getData()
validated payload | + +## Schema0BoxedString +data class Schema0BoxedString
+implements [Schema0Boxed](#schema0boxed) + +data class that stores validated String payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| Schema0BoxedString(String data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| String | data()
validated payload | +| Any? | getData()
validated payload | + +## Schema0BoxedList +data class Schema0BoxedList
+implements [Schema0Boxed](#schema0boxed) + +data class that stores validated List payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| Schema0BoxedList(FrozenList data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| FrozenList | data()
validated payload | +| Any? | getData()
validated payload | + +## Schema0BoxedMap +data class Schema0BoxedMap
+implements [Schema0Boxed](#schema0boxed) + +data class that stores validated Map payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| Schema0BoxedMap(FrozenMap data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| FrozenMap | data()
validated payload | +| Any? | getData()
validated payload | + +## Schema0 +class Schema0
+extends JsonSchema + +A schema class that validates payloads + +### Field Summary +| Modifier and Type | Field and Description | +| ----------------- | ---------------------- | +| List> | anyOf = listOf(
    [Schema01::class.java](#schema01)
)
| + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| String | validate(arg: String, configuration: SchemaConfiguration) | +| Nothing? | validate(arg: Nothing?, configuration: SchemaConfiguration) | +| int | validate(arg: int, configuration: SchemaConfiguration) | +| long | validate(arg: long, configuration: SchemaConfiguration) | +| float | validate(arg: float, configuration: SchemaConfiguration) | +| double | validate(arg: double, configuration: SchemaConfiguration) | +| Number | validate(arg: Number, configuration: SchemaConfiguration) | +| boolean | validate(arg: boolean, configuration: SchemaConfiguration) | +| FrozenMap | validate(arg: Map<?, ?>, configuration: SchemaConfiguration) | +| FrozenList | validate(arg: List<*>, configuration: SchemaConfiguration) | +| [Schema0BoxedString](#schema0boxedstring) | validateAndBox(String, configuration: SchemaConfiguration) | +| [Schema0BoxedVoid](#schema0boxedvoid) | validateAndBox(Nothing?, configuration: SchemaConfiguration) | +| [Schema0BoxedNumber](#schema0boxednumber) | validateAndBox(Number, configuration: SchemaConfiguration) | +| [Schema0BoxedBoolean](#schema0boxedboolean) | validateAndBox(boolean, configuration: SchemaConfiguration) | +| [Schema0BoxedMap](#schema0boxedmap) | validateAndBox(Map<?, ?>, configuration: SchemaConfiguration) | +| [Schema0BoxedList](#schema0boxedlist) | validateAndBox(List<*>, configuration: SchemaConfiguration) | +| [Schema0Boxed](#schema0boxed) | validateAndBox(Any?, configuration: SchemaConfiguration) | +| Any? | validate(arg: Any?, configuration: SchemaConfiguration) | + +## Schema01Boxed +sealed interface Schema01Boxed
+permits
+[Schema01BoxedVoid](#schema01boxedvoid) + +sealed interface that stores validated payloads using boxed classes + +## Schema01BoxedVoid +data class Schema01BoxedVoid
+implements [Schema01Boxed](#schema01boxed) + +data class that stores validated null payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| Schema01BoxedVoid(Nothing? data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| Nothing? | data()
validated payload | +| Any? | getData()
validated payload | + +## Schema01 +class Schema01
+extends NullJsonSchema.NullJsonSchema1 + +A schema class that validates payloads + +| Methods Inherited from class org.openapijsonschematools.client.schemas.NullJsonSchema.NullJsonSchema1 | +| ------------------------------------------------------------------ | +| validate | +| validateAndBox | + +[[Back to top]](#top) [[Back to Component Schemas]](../../../README.md#Component-Schemas) [[Back to README]](../../../README.md) diff --git a/samples/client/3_0_3_unit_test/kotlin/docs/components/schemas/NestedItems.md b/samples/client/3_0_3_unit_test/kotlin/docs/components/schemas/NestedItems.md new file mode 100644 index 00000000000..f609bc5ec46 --- /dev/null +++ b/samples/client/3_0_3_unit_test/kotlin/docs/components/schemas/NestedItems.md @@ -0,0 +1,492 @@ +# NestedItems +org.openapijsonschematools.client.components.schemas.NestedItems.java +class NestedItems
+ +A class that contains necessary nested +- schema classes (which validate payloads), extends JsonSchema +- sealed interfaces which store validated payloads, Kotlin version of a sum type +- boxed classes which store validated payloads, sealed permits class implementations +- classes to store validated list payloads, extends FrozenList +- classes to build inputs for list payloads + +## Nested Class Summary +| Modifier and Type | Class and Description | +| ----------------- | ---------------------- | +| sealed interface | [NestedItems.NestedItems1Boxed](#nesteditems1boxed)
sealed interface for validated payloads | +| record | [NestedItems.NestedItems1BoxedList](#nesteditems1boxedlist)
boxed class to store validated List payloads | +| static class | [NestedItems.NestedItems1](#nesteditems1)
schema class | +| static class | [NestedItems.NestedItemsListBuilder](#nesteditemslistbuilder)
builder for List payloads | +| static class | [NestedItems.NestedItemsList](#nesteditemslist)
output class for List payloads | +| sealed interface | [NestedItems.ItemsBoxed](#itemsboxed)
sealed interface for validated payloads | +| record | [NestedItems.ItemsBoxedList](#itemsboxedlist)
boxed class to store validated List payloads | +| static class | [NestedItems.Items](#items)
schema class | +| static class | [NestedItems.ItemsListBuilder2](#itemslistbuilder2)
builder for List payloads | +| static class | [NestedItems.ItemsList2](#itemslist2)
output class for List payloads | +| sealed interface | [NestedItems.Items1Boxed](#items1boxed)
sealed interface for validated payloads | +| record | [NestedItems.Items1BoxedList](#items1boxedlist)
boxed class to store validated List payloads | +| static class | [NestedItems.Items1](#items1)
schema class | +| static class | [NestedItems.ItemsListBuilder1](#itemslistbuilder1)
builder for List payloads | +| static class | [NestedItems.ItemsList1](#itemslist1)
output class for List payloads | +| sealed interface | [NestedItems.Items2Boxed](#items2boxed)
sealed interface for validated payloads | +| record | [NestedItems.Items2BoxedList](#items2boxedlist)
boxed class to store validated List payloads | +| static class | [NestedItems.Items2](#items2)
schema class | +| static class | [NestedItems.ItemsListBuilder](#itemslistbuilder)
builder for List payloads | +| static class | [NestedItems.ItemsList](#itemslist)
output class for List payloads | +| sealed interface | [NestedItems.Items3Boxed](#items3boxed)
sealed interface for validated payloads | +| record | [NestedItems.Items3BoxedNumber](#items3boxednumber)
boxed class to store validated Number payloads | +| static class | [NestedItems.Items3](#items3)
schema class | + +## NestedItems1Boxed +sealed interface NestedItems1Boxed
+permits
+[NestedItems1BoxedList](#nesteditems1boxedlist) + +sealed interface that stores validated payloads using boxed classes + +## NestedItems1BoxedList +data class NestedItems1BoxedList
+implements [NestedItems1Boxed](#nesteditems1boxed) + +data class that stores validated List payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| NestedItems1BoxedList([NestedItemsList](#nesteditemslist) data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| [NestedItemsList](#nesteditemslist) | data()
validated payload | +| Any? | getData()
validated payload | + +## NestedItems1 +class NestedItems1
+extends JsonSchema + +A schema class that validates payloads + +### Code Sample +``` +import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags; +import org.openapijsonschematools.client.configurations.SchemaConfiguration; +import org.openapijsonschematools.client.exceptions.ValidationException; +import org.openapijsonschematools.client.schemas.validation.MapUtils; +import org.openapijsonschematools.client.schemas.validation.FrozenList; +import org.openapijsonschematools.client.schemas.validation.FrozenMap; +import org.openapijsonschematools.client.components.schemas.NestedItems; + +import java.util.Arrays; +import java.util.List; +import java.util.AbstractMap; + +static final SchemaConfiguration configuration = new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().build()); + +// List validation +NestedItems.NestedItemsList validatedPayload = + NestedItems.NestedItems1.validate( + new NestedItems.NestedItemsListBuilder() + .add( + listOf( + listOf( + listOf( + 1 + ) + ) + ) + ) + .build(), + configuration +); +``` + +### Field Summary +| Modifier and Type | Field and Description | +| ----------------- | ---------------------- | +| Set> | type = setOf(List::class.java) | +| Class | items = [Items::class.java](#items) | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| [NestedItemsList](#nesteditemslist) | validate(arg: [List<*>](#nesteditemslistbuilder), configuration: SchemaConfiguration) | +| [NestedItems1BoxedList](#nesteditems1boxedlist) | validateAndBox([List<*>](#nesteditemslistbuilder), configuration: SchemaConfiguration) | +| [NestedItems1Boxed](#nesteditems1boxed) | validateAndBox(Any?, configuration: SchemaConfiguration) | +| Any? | validate(arg: Any?, configuration: SchemaConfiguration) | + +## NestedItemsListBuilder +class NestedItemsListBuilder
+builder for `List>>>` + +A class that builds the List input type + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| NestedItemsListBuilder()
Creates an empty list | +| NestedItemsListBuilder(List>>> items)
Stores the items in a list | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| NestedItemsListBuilder | add(item: List>>) | +| List>>> | build()
Returns list input that should be used with Schema.validate | + +## NestedItemsList +class NestedItemsList
+extends `FrozenList` + +A class to store validated List payloads + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| static [NestedItemsList](#nesteditemslist) | of([List>>>](#nesteditemslistbuilder) arg, SchemaConfiguration configuration) | + +## ItemsBoxed +sealed interface ItemsBoxed
+permits
+[ItemsBoxedList](#itemsboxedlist) + +sealed interface that stores validated payloads using boxed classes + +## ItemsBoxedList +data class ItemsBoxedList
+implements [ItemsBoxed](#itemsboxed) + +data class that stores validated List payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| ItemsBoxedList([ItemsList2](#itemslist2) data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| [ItemsList2](#itemslist2) | data()
validated payload | +| Any? | getData()
validated payload | + +## Items +class Items
+extends JsonSchema + +A schema class that validates payloads + +### Code Sample +``` +import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags; +import org.openapijsonschematools.client.configurations.SchemaConfiguration; +import org.openapijsonschematools.client.exceptions.ValidationException; +import org.openapijsonschematools.client.schemas.validation.MapUtils; +import org.openapijsonschematools.client.schemas.validation.FrozenList; +import org.openapijsonschematools.client.schemas.validation.FrozenMap; +import org.openapijsonschematools.client.components.schemas.NestedItems; + +import java.util.Arrays; +import java.util.List; +import java.util.AbstractMap; + +static final SchemaConfiguration configuration = new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().build()); + +// List validation +NestedItems.ItemsList2 validatedPayload = + NestedItems.Items.validate( + new NestedItems.ItemsListBuilder2() + .add( + listOf( + listOf( + 1 + ) + ) + ) + .build(), + configuration +); +``` + +### Field Summary +| Modifier and Type | Field and Description | +| ----------------- | ---------------------- | +| Set> | type = setOf(List::class.java) | +| Class | items = [Items1::class.java](#items1) | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| [ItemsList2](#itemslist2) | validate(arg: [List<*>](#itemslistbuilder2), configuration: SchemaConfiguration) | +| [ItemsBoxedList](#itemsboxedlist) | validateAndBox([List<*>](#itemslistbuilder2), configuration: SchemaConfiguration) | +| [ItemsBoxed](#itemsboxed) | validateAndBox(Any?, configuration: SchemaConfiguration) | +| Any? | validate(arg: Any?, configuration: SchemaConfiguration) | + +## ItemsListBuilder2 +class ItemsListBuilder2
+builder for `List>>` + +A class that builds the List input type + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| ItemsListBuilder2()
Creates an empty list | +| ItemsListBuilder2(List>> items)
Stores the items in a list | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| ItemsListBuilder2 | add(item: List>) | +| List>> | build()
Returns list input that should be used with Schema.validate | + +## ItemsList2 +class ItemsList2
+extends `FrozenList` + +A class to store validated List payloads + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| static [ItemsList2](#itemslist2) | of([List>>](#itemslistbuilder2) arg, SchemaConfiguration configuration) | + +## Items1Boxed +sealed interface Items1Boxed
+permits
+[Items1BoxedList](#items1boxedlist) + +sealed interface that stores validated payloads using boxed classes + +## Items1BoxedList +data class Items1BoxedList
+implements [Items1Boxed](#items1boxed) + +data class that stores validated List payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| Items1BoxedList([ItemsList1](#itemslist1) data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| [ItemsList1](#itemslist1) | data()
validated payload | +| Any? | getData()
validated payload | + +## Items1 +class Items1
+extends JsonSchema + +A schema class that validates payloads + +### Code Sample +``` +import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags; +import org.openapijsonschematools.client.configurations.SchemaConfiguration; +import org.openapijsonschematools.client.exceptions.ValidationException; +import org.openapijsonschematools.client.schemas.validation.MapUtils; +import org.openapijsonschematools.client.schemas.validation.FrozenList; +import org.openapijsonschematools.client.schemas.validation.FrozenMap; +import org.openapijsonschematools.client.components.schemas.NestedItems; + +import java.util.Arrays; +import java.util.List; +import java.util.AbstractMap; + +static final SchemaConfiguration configuration = new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().build()); + +// List validation +NestedItems.ItemsList1 validatedPayload = + NestedItems.Items1.validate( + new NestedItems.ItemsListBuilder1() + .add( + listOf( + 1 + ) + ) + .build(), + configuration +); +``` + +### Field Summary +| Modifier and Type | Field and Description | +| ----------------- | ---------------------- | +| Set> | type = setOf(List::class.java) | +| Class | items = [Items2::class.java](#items2) | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| [ItemsList1](#itemslist1) | validate(arg: [List<*>](#itemslistbuilder1), configuration: SchemaConfiguration) | +| [Items1BoxedList](#items1boxedlist) | validateAndBox([List<*>](#itemslistbuilder1), configuration: SchemaConfiguration) | +| [Items1Boxed](#items1boxed) | validateAndBox(Any?, configuration: SchemaConfiguration) | +| Any? | validate(arg: Any?, configuration: SchemaConfiguration) | + +## ItemsListBuilder1 +class ItemsListBuilder1
+builder for `List>` + +A class that builds the List input type + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| ItemsListBuilder1()
Creates an empty list | +| ItemsListBuilder1(List> items)
Stores the items in a list | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| ItemsListBuilder1 | add(item: List) | +| List> | build()
Returns list input that should be used with Schema.validate | + +## ItemsList1 +class ItemsList1
+extends `FrozenList` + +A class to store validated List payloads + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| static [ItemsList1](#itemslist1) | of([List>](#itemslistbuilder1) arg, SchemaConfiguration configuration) | + +## Items2Boxed +sealed interface Items2Boxed
+permits
+[Items2BoxedList](#items2boxedlist) + +sealed interface that stores validated payloads using boxed classes + +## Items2BoxedList +data class Items2BoxedList
+implements [Items2Boxed](#items2boxed) + +data class that stores validated List payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| Items2BoxedList([ItemsList](#itemslist) data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| [ItemsList](#itemslist) | data()
validated payload | +| Any? | getData()
validated payload | + +## Items2 +class Items2
+extends JsonSchema + +A schema class that validates payloads + +### Code Sample +``` +import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags; +import org.openapijsonschematools.client.configurations.SchemaConfiguration; +import org.openapijsonschematools.client.exceptions.ValidationException; +import org.openapijsonschematools.client.schemas.validation.MapUtils; +import org.openapijsonschematools.client.schemas.validation.FrozenList; +import org.openapijsonschematools.client.schemas.validation.FrozenMap; +import org.openapijsonschematools.client.components.schemas.NestedItems; + +import java.util.Arrays; +import java.util.List; +import java.util.AbstractMap; + +static final SchemaConfiguration configuration = new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().build()); + +// List validation +NestedItems.ItemsList validatedPayload = + NestedItems.Items2.validate( + new NestedItems.ItemsListBuilder() + .add(1) + + .build(), + configuration +); +``` + +### Field Summary +| Modifier and Type | Field and Description | +| ----------------- | ---------------------- | +| Set> | type = setOf(List::class.java) | +| Class | items = [Items3::class.java](#items3) | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| [ItemsList](#itemslist) | validate(arg: [List<*>](#itemslistbuilder), configuration: SchemaConfiguration) | +| [Items2BoxedList](#items2boxedlist) | validateAndBox([List<*>](#itemslistbuilder), configuration: SchemaConfiguration) | +| [Items2Boxed](#items2boxed) | validateAndBox(Any?, configuration: SchemaConfiguration) | +| Any? | validate(arg: Any?, configuration: SchemaConfiguration) | + +## ItemsListBuilder +class ItemsListBuilder
+builder for `List` + +A class that builds the List input type + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| ItemsListBuilder()
Creates an empty list | +| ItemsListBuilder(List items)
Stores the items in a list | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| ItemsListBuilder | add(item: Int) | +| ItemsListBuilder | add(item: Float) | +| ItemsListBuilder | add(item: Long) | +| ItemsListBuilder | add(item: Double) | +| List | build()
Returns list input that should be used with Schema.validate | + +## ItemsList +class ItemsList
+extends `FrozenList` + +A class to store validated List payloads + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| static [ItemsList](#itemslist) | of([List](#itemslistbuilder) arg, SchemaConfiguration configuration) | + +## Items3Boxed +sealed interface Items3Boxed
+permits
+[Items3BoxedNumber](#items3boxednumber) + +sealed interface that stores validated payloads using boxed classes + +## Items3BoxedNumber +data class Items3BoxedNumber
+implements [Items3Boxed](#items3boxed) + +data class that stores validated Number payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| Items3BoxedNumber(Number data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| Number | data()
validated payload | +| Any? | getData()
validated payload | + +## Items3 +class Items3
+extends NumberJsonSchema.NumberJsonSchema1 + +A schema class that validates payloads + +| Methods Inherited from class org.openapijsonschematools.client.schemas.NumberJsonSchema.NumberJsonSchema1 | +| ------------------------------------------------------------------ | +| validate | +| validateAndBox | + +[[Back to top]](#top) [[Back to Component Schemas]](../../../README.md#Component-Schemas) [[Back to README]](../../../README.md) diff --git a/samples/client/3_0_3_unit_test/kotlin/docs/components/schemas/NestedOneofToCheckValidationSemantics.md b/samples/client/3_0_3_unit_test/kotlin/docs/components/schemas/NestedOneofToCheckValidationSemantics.md new file mode 100644 index 00000000000..6e78e1ba783 --- /dev/null +++ b/samples/client/3_0_3_unit_test/kotlin/docs/components/schemas/NestedOneofToCheckValidationSemantics.md @@ -0,0 +1,362 @@ +# NestedOneofToCheckValidationSemantics +org.openapijsonschematools.client.components.schemas.NestedOneofToCheckValidationSemantics.java +class NestedOneofToCheckValidationSemantics
+ +A class that contains necessary nested +- schema classes (which validate payloads), extends JsonSchema +- sealed interfaces which store validated payloads, Kotlin version of a sum type +- boxed classes which store validated payloads, sealed permits class implementations + +## Nested Class Summary +| Modifier and Type | Class and Description | +| ----------------- | ---------------------- | +| sealed interface | [NestedOneofToCheckValidationSemantics.NestedOneofToCheckValidationSemantics1Boxed](#nestedoneoftocheckvalidationsemantics1boxed)
sealed interface for validated payloads | +| record | [NestedOneofToCheckValidationSemantics.NestedOneofToCheckValidationSemantics1BoxedVoid](#nestedoneoftocheckvalidationsemantics1boxedvoid)
boxed class to store validated null payloads | +| record | [NestedOneofToCheckValidationSemantics.NestedOneofToCheckValidationSemantics1BoxedBoolean](#nestedoneoftocheckvalidationsemantics1boxedboolean)
boxed class to store validated boolean payloads | +| record | [NestedOneofToCheckValidationSemantics.NestedOneofToCheckValidationSemantics1BoxedNumber](#nestedoneoftocheckvalidationsemantics1boxednumber)
boxed class to store validated Number payloads | +| record | [NestedOneofToCheckValidationSemantics.NestedOneofToCheckValidationSemantics1BoxedString](#nestedoneoftocheckvalidationsemantics1boxedstring)
boxed class to store validated String payloads | +| record | [NestedOneofToCheckValidationSemantics.NestedOneofToCheckValidationSemantics1BoxedList](#nestedoneoftocheckvalidationsemantics1boxedlist)
boxed class to store validated List payloads | +| record | [NestedOneofToCheckValidationSemantics.NestedOneofToCheckValidationSemantics1BoxedMap](#nestedoneoftocheckvalidationsemantics1boxedmap)
boxed class to store validated Map payloads | +| static class | [NestedOneofToCheckValidationSemantics.NestedOneofToCheckValidationSemantics1](#nestedoneoftocheckvalidationsemantics1)
schema class | +| sealed interface | [NestedOneofToCheckValidationSemantics.Schema0Boxed](#schema0boxed)
sealed interface for validated payloads | +| record | [NestedOneofToCheckValidationSemantics.Schema0BoxedVoid](#schema0boxedvoid)
boxed class to store validated null payloads | +| record | [NestedOneofToCheckValidationSemantics.Schema0BoxedBoolean](#schema0boxedboolean)
boxed class to store validated boolean payloads | +| record | [NestedOneofToCheckValidationSemantics.Schema0BoxedNumber](#schema0boxednumber)
boxed class to store validated Number payloads | +| record | [NestedOneofToCheckValidationSemantics.Schema0BoxedString](#schema0boxedstring)
boxed class to store validated String payloads | +| record | [NestedOneofToCheckValidationSemantics.Schema0BoxedList](#schema0boxedlist)
boxed class to store validated List payloads | +| record | [NestedOneofToCheckValidationSemantics.Schema0BoxedMap](#schema0boxedmap)
boxed class to store validated Map payloads | +| static class | [NestedOneofToCheckValidationSemantics.Schema0](#schema0)
schema class | +| sealed interface | [NestedOneofToCheckValidationSemantics.Schema01Boxed](#schema01boxed)
sealed interface for validated payloads | +| record | [NestedOneofToCheckValidationSemantics.Schema01BoxedVoid](#schema01boxedvoid)
boxed class to store validated null payloads | +| static class | [NestedOneofToCheckValidationSemantics.Schema01](#schema01)
schema class | + +## NestedOneofToCheckValidationSemantics1Boxed +sealed interface NestedOneofToCheckValidationSemantics1Boxed
+permits
+[NestedOneofToCheckValidationSemantics1BoxedVoid](#nestedoneoftocheckvalidationsemantics1boxedvoid), +[NestedOneofToCheckValidationSemantics1BoxedBoolean](#nestedoneoftocheckvalidationsemantics1boxedboolean), +[NestedOneofToCheckValidationSemantics1BoxedNumber](#nestedoneoftocheckvalidationsemantics1boxednumber), +[NestedOneofToCheckValidationSemantics1BoxedString](#nestedoneoftocheckvalidationsemantics1boxedstring), +[NestedOneofToCheckValidationSemantics1BoxedList](#nestedoneoftocheckvalidationsemantics1boxedlist), +[NestedOneofToCheckValidationSemantics1BoxedMap](#nestedoneoftocheckvalidationsemantics1boxedmap) + +sealed interface that stores validated payloads using boxed classes + +## NestedOneofToCheckValidationSemantics1BoxedVoid +data class NestedOneofToCheckValidationSemantics1BoxedVoid
+implements [NestedOneofToCheckValidationSemantics1Boxed](#nestedoneoftocheckvalidationsemantics1boxed) + +data class that stores validated null payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| NestedOneofToCheckValidationSemantics1BoxedVoid(Nothing? data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| Nothing? | data()
validated payload | +| Any? | getData()
validated payload | + +## NestedOneofToCheckValidationSemantics1BoxedBoolean +data class NestedOneofToCheckValidationSemantics1BoxedBoolean
+implements [NestedOneofToCheckValidationSemantics1Boxed](#nestedoneoftocheckvalidationsemantics1boxed) + +record that stores validated boolean payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| NestedOneofToCheckValidationSemantics1BoxedBoolean(boolean data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| boolean | data()
validated payload | +| Any? | getData()
validated payload | + +## NestedOneofToCheckValidationSemantics1BoxedNumber +data class NestedOneofToCheckValidationSemantics1BoxedNumber
+implements [NestedOneofToCheckValidationSemantics1Boxed](#nestedoneoftocheckvalidationsemantics1boxed) + +data class that stores validated Number payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| NestedOneofToCheckValidationSemantics1BoxedNumber(Number data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| Number | data()
validated payload | +| Any? | getData()
validated payload | + +## NestedOneofToCheckValidationSemantics1BoxedString +data class NestedOneofToCheckValidationSemantics1BoxedString
+implements [NestedOneofToCheckValidationSemantics1Boxed](#nestedoneoftocheckvalidationsemantics1boxed) + +data class that stores validated String payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| NestedOneofToCheckValidationSemantics1BoxedString(String data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| String | data()
validated payload | +| Any? | getData()
validated payload | + +## NestedOneofToCheckValidationSemantics1BoxedList +data class NestedOneofToCheckValidationSemantics1BoxedList
+implements [NestedOneofToCheckValidationSemantics1Boxed](#nestedoneoftocheckvalidationsemantics1boxed) + +data class that stores validated List payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| NestedOneofToCheckValidationSemantics1BoxedList(FrozenList data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| FrozenList | data()
validated payload | +| Any? | getData()
validated payload | + +## NestedOneofToCheckValidationSemantics1BoxedMap +data class NestedOneofToCheckValidationSemantics1BoxedMap
+implements [NestedOneofToCheckValidationSemantics1Boxed](#nestedoneoftocheckvalidationsemantics1boxed) + +data class that stores validated Map payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| NestedOneofToCheckValidationSemantics1BoxedMap(FrozenMap data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| FrozenMap | data()
validated payload | +| Any? | getData()
validated payload | + +## NestedOneofToCheckValidationSemantics1 +class NestedOneofToCheckValidationSemantics1
+extends JsonSchema + +A schema class that validates payloads + +### Field Summary +| Modifier and Type | Field and Description | +| ----------------- | ---------------------- | +| List> | oneOf = listOf(
    [Schema0::class.java](#schema0)
))
| + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| String | validate(arg: String, configuration: SchemaConfiguration) | +| Nothing? | validate(arg: Nothing?, configuration: SchemaConfiguration) | +| int | validate(arg: int, configuration: SchemaConfiguration) | +| long | validate(arg: long, configuration: SchemaConfiguration) | +| float | validate(arg: float, configuration: SchemaConfiguration) | +| double | validate(arg: double, configuration: SchemaConfiguration) | +| Number | validate(arg: Number, configuration: SchemaConfiguration) | +| boolean | validate(arg: boolean, configuration: SchemaConfiguration) | +| FrozenMap | validate(arg: Map<?, ?>, configuration: SchemaConfiguration) | +| FrozenList | validate(arg: List<*>, configuration: SchemaConfiguration) | +| [NestedOneofToCheckValidationSemantics1BoxedString](#nestedoneoftocheckvalidationsemantics1boxedstring) | validateAndBox(String, configuration: SchemaConfiguration) | +| [NestedOneofToCheckValidationSemantics1BoxedVoid](#nestedoneoftocheckvalidationsemantics1boxedvoid) | validateAndBox(Nothing?, configuration: SchemaConfiguration) | +| [NestedOneofToCheckValidationSemantics1BoxedNumber](#nestedoneoftocheckvalidationsemantics1boxednumber) | validateAndBox(Number, configuration: SchemaConfiguration) | +| [NestedOneofToCheckValidationSemantics1BoxedBoolean](#nestedoneoftocheckvalidationsemantics1boxedboolean) | validateAndBox(boolean, configuration: SchemaConfiguration) | +| [NestedOneofToCheckValidationSemantics1BoxedMap](#nestedoneoftocheckvalidationsemantics1boxedmap) | validateAndBox(Map<?, ?>, configuration: SchemaConfiguration) | +| [NestedOneofToCheckValidationSemantics1BoxedList](#nestedoneoftocheckvalidationsemantics1boxedlist) | validateAndBox(List<*>, configuration: SchemaConfiguration) | +| [NestedOneofToCheckValidationSemantics1Boxed](#nestedoneoftocheckvalidationsemantics1boxed) | validateAndBox(Any?, configuration: SchemaConfiguration) | +| Any? | validate(arg: Any?, configuration: SchemaConfiguration) | + +## Schema0Boxed +sealed interface Schema0Boxed
+permits
+[Schema0BoxedVoid](#schema0boxedvoid), +[Schema0BoxedBoolean](#schema0boxedboolean), +[Schema0BoxedNumber](#schema0boxednumber), +[Schema0BoxedString](#schema0boxedstring), +[Schema0BoxedList](#schema0boxedlist), +[Schema0BoxedMap](#schema0boxedmap) + +sealed interface that stores validated payloads using boxed classes + +## Schema0BoxedVoid +data class Schema0BoxedVoid
+implements [Schema0Boxed](#schema0boxed) + +data class that stores validated null payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| Schema0BoxedVoid(Nothing? data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| Nothing? | data()
validated payload | +| Any? | getData()
validated payload | + +## Schema0BoxedBoolean +data class Schema0BoxedBoolean
+implements [Schema0Boxed](#schema0boxed) + +record that stores validated boolean payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| Schema0BoxedBoolean(boolean data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| boolean | data()
validated payload | +| Any? | getData()
validated payload | + +## Schema0BoxedNumber +data class Schema0BoxedNumber
+implements [Schema0Boxed](#schema0boxed) + +data class that stores validated Number payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| Schema0BoxedNumber(Number data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| Number | data()
validated payload | +| Any? | getData()
validated payload | + +## Schema0BoxedString +data class Schema0BoxedString
+implements [Schema0Boxed](#schema0boxed) + +data class that stores validated String payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| Schema0BoxedString(String data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| String | data()
validated payload | +| Any? | getData()
validated payload | + +## Schema0BoxedList +data class Schema0BoxedList
+implements [Schema0Boxed](#schema0boxed) + +data class that stores validated List payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| Schema0BoxedList(FrozenList data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| FrozenList | data()
validated payload | +| Any? | getData()
validated payload | + +## Schema0BoxedMap +data class Schema0BoxedMap
+implements [Schema0Boxed](#schema0boxed) + +data class that stores validated Map payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| Schema0BoxedMap(FrozenMap data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| FrozenMap | data()
validated payload | +| Any? | getData()
validated payload | + +## Schema0 +class Schema0
+extends JsonSchema + +A schema class that validates payloads + +### Field Summary +| Modifier and Type | Field and Description | +| ----------------- | ---------------------- | +| List> | oneOf = listOf(
    [Schema01::class.java](#schema01)
))
| + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| String | validate(arg: String, configuration: SchemaConfiguration) | +| Nothing? | validate(arg: Nothing?, configuration: SchemaConfiguration) | +| int | validate(arg: int, configuration: SchemaConfiguration) | +| long | validate(arg: long, configuration: SchemaConfiguration) | +| float | validate(arg: float, configuration: SchemaConfiguration) | +| double | validate(arg: double, configuration: SchemaConfiguration) | +| Number | validate(arg: Number, configuration: SchemaConfiguration) | +| boolean | validate(arg: boolean, configuration: SchemaConfiguration) | +| FrozenMap | validate(arg: Map<?, ?>, configuration: SchemaConfiguration) | +| FrozenList | validate(arg: List<*>, configuration: SchemaConfiguration) | +| [Schema0BoxedString](#schema0boxedstring) | validateAndBox(String, configuration: SchemaConfiguration) | +| [Schema0BoxedVoid](#schema0boxedvoid) | validateAndBox(Nothing?, configuration: SchemaConfiguration) | +| [Schema0BoxedNumber](#schema0boxednumber) | validateAndBox(Number, configuration: SchemaConfiguration) | +| [Schema0BoxedBoolean](#schema0boxedboolean) | validateAndBox(boolean, configuration: SchemaConfiguration) | +| [Schema0BoxedMap](#schema0boxedmap) | validateAndBox(Map<?, ?>, configuration: SchemaConfiguration) | +| [Schema0BoxedList](#schema0boxedlist) | validateAndBox(List<*>, configuration: SchemaConfiguration) | +| [Schema0Boxed](#schema0boxed) | validateAndBox(Any?, configuration: SchemaConfiguration) | +| Any? | validate(arg: Any?, configuration: SchemaConfiguration) | + +## Schema01Boxed +sealed interface Schema01Boxed
+permits
+[Schema01BoxedVoid](#schema01boxedvoid) + +sealed interface that stores validated payloads using boxed classes + +## Schema01BoxedVoid +data class Schema01BoxedVoid
+implements [Schema01Boxed](#schema01boxed) + +data class that stores validated null payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| Schema01BoxedVoid(Nothing? data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| Nothing? | data()
validated payload | +| Any? | getData()
validated payload | + +## Schema01 +class Schema01
+extends NullJsonSchema.NullJsonSchema1 + +A schema class that validates payloads + +| Methods Inherited from class org.openapijsonschematools.client.schemas.NullJsonSchema.NullJsonSchema1 | +| ------------------------------------------------------------------ | +| validate | +| validateAndBox | + +[[Back to top]](#top) [[Back to Component Schemas]](../../../README.md#Component-Schemas) [[Back to README]](../../../README.md) diff --git a/samples/client/3_0_3_unit_test/kotlin/docs/components/schemas/Not.md b/samples/client/3_0_3_unit_test/kotlin/docs/components/schemas/Not.md new file mode 100644 index 00000000000..4e1250b94c4 --- /dev/null +++ b/samples/client/3_0_3_unit_test/kotlin/docs/components/schemas/Not.md @@ -0,0 +1,207 @@ +# Not +org.openapijsonschematools.client.components.schemas.Not.java +class Not
+ +A class that contains necessary nested +- schema classes (which validate payloads), extends JsonSchema +- sealed interfaces which store validated payloads, Kotlin version of a sum type +- boxed classes which store validated payloads, sealed permits class implementations + +## Nested Class Summary +| Modifier and Type | Class and Description | +| ----------------- | ---------------------- | +| sealed interface | [Not.Not1Boxed](#not1boxed)
sealed interface for validated payloads | +| record | [Not.Not1BoxedVoid](#not1boxedvoid)
boxed class to store validated null payloads | +| record | [Not.Not1BoxedBoolean](#not1boxedboolean)
boxed class to store validated boolean payloads | +| record | [Not.Not1BoxedNumber](#not1boxednumber)
boxed class to store validated Number payloads | +| record | [Not.Not1BoxedString](#not1boxedstring)
boxed class to store validated String payloads | +| record | [Not.Not1BoxedList](#not1boxedlist)
boxed class to store validated List payloads | +| record | [Not.Not1BoxedMap](#not1boxedmap)
boxed class to store validated Map payloads | +| static class | [Not.Not1](#not1)
schema class | +| sealed interface | [Not.Not2Boxed](#not2boxed)
sealed interface for validated payloads | +| record | [Not.Not2BoxedNumber](#not2boxednumber)
boxed class to store validated Number payloads | +| static class | [Not.Not2](#not2)
schema class | + +## Not1Boxed +sealed interface Not1Boxed
+permits
+[Not1BoxedVoid](#not1boxedvoid), +[Not1BoxedBoolean](#not1boxedboolean), +[Not1BoxedNumber](#not1boxednumber), +[Not1BoxedString](#not1boxedstring), +[Not1BoxedList](#not1boxedlist), +[Not1BoxedMap](#not1boxedmap) + +sealed interface that stores validated payloads using boxed classes + +## Not1BoxedVoid +data class Not1BoxedVoid
+implements [Not1Boxed](#not1boxed) + +data class that stores validated null payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| Not1BoxedVoid(Nothing? data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| Nothing? | data()
validated payload | +| Any? | getData()
validated payload | + +## Not1BoxedBoolean +data class Not1BoxedBoolean
+implements [Not1Boxed](#not1boxed) + +record that stores validated boolean payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| Not1BoxedBoolean(boolean data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| boolean | data()
validated payload | +| Any? | getData()
validated payload | + +## Not1BoxedNumber +data class Not1BoxedNumber
+implements [Not1Boxed](#not1boxed) + +data class that stores validated Number payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| Not1BoxedNumber(Number data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| Number | data()
validated payload | +| Any? | getData()
validated payload | + +## Not1BoxedString +data class Not1BoxedString
+implements [Not1Boxed](#not1boxed) + +data class that stores validated String payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| Not1BoxedString(String data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| String | data()
validated payload | +| Any? | getData()
validated payload | + +## Not1BoxedList +data class Not1BoxedList
+implements [Not1Boxed](#not1boxed) + +data class that stores validated List payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| Not1BoxedList(FrozenList data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| FrozenList | data()
validated payload | +| Any? | getData()
validated payload | + +## Not1BoxedMap +data class Not1BoxedMap
+implements [Not1Boxed](#not1boxed) + +data class that stores validated Map payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| Not1BoxedMap(FrozenMap data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| FrozenMap | data()
validated payload | +| Any? | getData()
validated payload | + +## Not1 +class Not1
+extends JsonSchema + +A schema class that validates payloads + +### Field Summary +| Modifier and Type | Field and Description | +| ----------------- | ---------------------- | +| Class | not = [Not2::class.java](#not2) | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| String | validate(arg: String, configuration: SchemaConfiguration) | +| Nothing? | validate(arg: Nothing?, configuration: SchemaConfiguration) | +| int | validate(arg: int, configuration: SchemaConfiguration) | +| long | validate(arg: long, configuration: SchemaConfiguration) | +| float | validate(arg: float, configuration: SchemaConfiguration) | +| double | validate(arg: double, configuration: SchemaConfiguration) | +| Number | validate(arg: Number, configuration: SchemaConfiguration) | +| boolean | validate(arg: boolean, configuration: SchemaConfiguration) | +| FrozenMap | validate(arg: Map<?, ?>, configuration: SchemaConfiguration) | +| FrozenList | validate(arg: List<*>, configuration: SchemaConfiguration) | +| [Not1BoxedString](#not1boxedstring) | validateAndBox(String, configuration: SchemaConfiguration) | +| [Not1BoxedVoid](#not1boxedvoid) | validateAndBox(Nothing?, configuration: SchemaConfiguration) | +| [Not1BoxedNumber](#not1boxednumber) | validateAndBox(Number, configuration: SchemaConfiguration) | +| [Not1BoxedBoolean](#not1boxedboolean) | validateAndBox(boolean, configuration: SchemaConfiguration) | +| [Not1BoxedMap](#not1boxedmap) | validateAndBox(Map<?, ?>, configuration: SchemaConfiguration) | +| [Not1BoxedList](#not1boxedlist) | validateAndBox(List<*>, configuration: SchemaConfiguration) | +| [Not1Boxed](#not1boxed) | validateAndBox(Any?, configuration: SchemaConfiguration) | +| Any? | validate(arg: Any?, configuration: SchemaConfiguration) | + +## Not2Boxed +sealed interface Not2Boxed
+permits
+[Not2BoxedNumber](#not2boxednumber) + +sealed interface that stores validated payloads using boxed classes + +## Not2BoxedNumber +data class Not2BoxedNumber
+implements [Not2Boxed](#not2boxed) + +data class that stores validated Number payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| Not2BoxedNumber(Number data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| Number | data()
validated payload | +| Any? | getData()
validated payload | + +## Not2 +class Not2
+extends IntJsonSchema.IntJsonSchema1 + +A schema class that validates payloads + +| Methods Inherited from class org.openapijsonschematools.client.schemas.IntJsonSchema.IntJsonSchema1 | +| ------------------------------------------------------------------ | +| validate | +| validateAndBox | + +[[Back to top]](#top) [[Back to Component Schemas]](../../../README.md#Component-Schemas) [[Back to README]](../../../README.md) diff --git a/samples/client/3_0_3_unit_test/kotlin/docs/components/schemas/NotMoreComplexSchema.md b/samples/client/3_0_3_unit_test/kotlin/docs/components/schemas/NotMoreComplexSchema.md new file mode 100644 index 00000000000..2578fcfd7c1 --- /dev/null +++ b/samples/client/3_0_3_unit_test/kotlin/docs/components/schemas/NotMoreComplexSchema.md @@ -0,0 +1,324 @@ +# NotMoreComplexSchema +org.openapijsonschematools.client.components.schemas.NotMoreComplexSchema.java +class NotMoreComplexSchema
+ +A class that contains necessary nested +- schema classes (which validate payloads), extends JsonSchema +- sealed interfaces which store validated payloads, Kotlin version of a sum type +- boxed classes which store validated payloads, sealed permits class implementations +- classes to store validated map payloads, extends FrozenMap +- classes to build inputs for map payloads + +## Nested Class Summary +| Modifier and Type | Class and Description | +| ----------------- | ---------------------- | +| sealed interface | [NotMoreComplexSchema.NotMoreComplexSchema1Boxed](#notmorecomplexschema1boxed)
sealed interface for validated payloads | +| record | [NotMoreComplexSchema.NotMoreComplexSchema1BoxedVoid](#notmorecomplexschema1boxedvoid)
boxed class to store validated null payloads | +| record | [NotMoreComplexSchema.NotMoreComplexSchema1BoxedBoolean](#notmorecomplexschema1boxedboolean)
boxed class to store validated boolean payloads | +| record | [NotMoreComplexSchema.NotMoreComplexSchema1BoxedNumber](#notmorecomplexschema1boxednumber)
boxed class to store validated Number payloads | +| record | [NotMoreComplexSchema.NotMoreComplexSchema1BoxedString](#notmorecomplexschema1boxedstring)
boxed class to store validated String payloads | +| record | [NotMoreComplexSchema.NotMoreComplexSchema1BoxedList](#notmorecomplexschema1boxedlist)
boxed class to store validated List payloads | +| record | [NotMoreComplexSchema.NotMoreComplexSchema1BoxedMap](#notmorecomplexschema1boxedmap)
boxed class to store validated Map payloads | +| static class | [NotMoreComplexSchema.NotMoreComplexSchema1](#notmorecomplexschema1)
schema class | +| sealed interface | [NotMoreComplexSchema.NotBoxed](#notboxed)
sealed interface for validated payloads | +| record | [NotMoreComplexSchema.NotBoxedMap](#notboxedmap)
boxed class to store validated Map payloads | +| static class | [NotMoreComplexSchema.Not](#not)
schema class | +| static class | [NotMoreComplexSchema.NotMapBuilder](#notmapbuilder)
builder for Map payloads | +| static class | [NotMoreComplexSchema.NotMap](#notmap)
output class for Map payloads | +| sealed interface | [NotMoreComplexSchema.FooBoxed](#fooboxed)
sealed interface for validated payloads | +| record | [NotMoreComplexSchema.FooBoxedString](#fooboxedstring)
boxed class to store validated String payloads | +| static class | [NotMoreComplexSchema.Foo](#foo)
schema class | + +## NotMoreComplexSchema1Boxed +sealed interface NotMoreComplexSchema1Boxed
+permits
+[NotMoreComplexSchema1BoxedVoid](#notmorecomplexschema1boxedvoid), +[NotMoreComplexSchema1BoxedBoolean](#notmorecomplexschema1boxedboolean), +[NotMoreComplexSchema1BoxedNumber](#notmorecomplexschema1boxednumber), +[NotMoreComplexSchema1BoxedString](#notmorecomplexschema1boxedstring), +[NotMoreComplexSchema1BoxedList](#notmorecomplexschema1boxedlist), +[NotMoreComplexSchema1BoxedMap](#notmorecomplexschema1boxedmap) + +sealed interface that stores validated payloads using boxed classes + +## NotMoreComplexSchema1BoxedVoid +data class NotMoreComplexSchema1BoxedVoid
+implements [NotMoreComplexSchema1Boxed](#notmorecomplexschema1boxed) + +data class that stores validated null payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| NotMoreComplexSchema1BoxedVoid(Nothing? data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| Nothing? | data()
validated payload | +| Any? | getData()
validated payload | + +## NotMoreComplexSchema1BoxedBoolean +data class NotMoreComplexSchema1BoxedBoolean
+implements [NotMoreComplexSchema1Boxed](#notmorecomplexschema1boxed) + +record that stores validated boolean payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| NotMoreComplexSchema1BoxedBoolean(boolean data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| boolean | data()
validated payload | +| Any? | getData()
validated payload | + +## NotMoreComplexSchema1BoxedNumber +data class NotMoreComplexSchema1BoxedNumber
+implements [NotMoreComplexSchema1Boxed](#notmorecomplexschema1boxed) + +data class that stores validated Number payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| NotMoreComplexSchema1BoxedNumber(Number data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| Number | data()
validated payload | +| Any? | getData()
validated payload | + +## NotMoreComplexSchema1BoxedString +data class NotMoreComplexSchema1BoxedString
+implements [NotMoreComplexSchema1Boxed](#notmorecomplexschema1boxed) + +data class that stores validated String payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| NotMoreComplexSchema1BoxedString(String data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| String | data()
validated payload | +| Any? | getData()
validated payload | + +## NotMoreComplexSchema1BoxedList +data class NotMoreComplexSchema1BoxedList
+implements [NotMoreComplexSchema1Boxed](#notmorecomplexschema1boxed) + +data class that stores validated List payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| NotMoreComplexSchema1BoxedList(FrozenList data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| FrozenList | data()
validated payload | +| Any? | getData()
validated payload | + +## NotMoreComplexSchema1BoxedMap +data class NotMoreComplexSchema1BoxedMap
+implements [NotMoreComplexSchema1Boxed](#notmorecomplexschema1boxed) + +data class that stores validated Map payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| NotMoreComplexSchema1BoxedMap(FrozenMap data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| FrozenMap | data()
validated payload | +| Any? | getData()
validated payload | + +## NotMoreComplexSchema1 +class NotMoreComplexSchema1
+extends JsonSchema + +A schema class that validates payloads + +### Field Summary +| Modifier and Type | Field and Description | +| ----------------- | ---------------------- | +| Class | not = [Not::class.java](#not) | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| String | validate(arg: String, configuration: SchemaConfiguration) | +| Nothing? | validate(arg: Nothing?, configuration: SchemaConfiguration) | +| int | validate(arg: int, configuration: SchemaConfiguration) | +| long | validate(arg: long, configuration: SchemaConfiguration) | +| float | validate(arg: float, configuration: SchemaConfiguration) | +| double | validate(arg: double, configuration: SchemaConfiguration) | +| Number | validate(arg: Number, configuration: SchemaConfiguration) | +| boolean | validate(arg: boolean, configuration: SchemaConfiguration) | +| FrozenMap | validate(arg: Map<?, ?>, configuration: SchemaConfiguration) | +| FrozenList | validate(arg: List<*>, configuration: SchemaConfiguration) | +| [NotMoreComplexSchema1BoxedString](#notmorecomplexschema1boxedstring) | validateAndBox(String, configuration: SchemaConfiguration) | +| [NotMoreComplexSchema1BoxedVoid](#notmorecomplexschema1boxedvoid) | validateAndBox(Nothing?, configuration: SchemaConfiguration) | +| [NotMoreComplexSchema1BoxedNumber](#notmorecomplexschema1boxednumber) | validateAndBox(Number, configuration: SchemaConfiguration) | +| [NotMoreComplexSchema1BoxedBoolean](#notmorecomplexschema1boxedboolean) | validateAndBox(boolean, configuration: SchemaConfiguration) | +| [NotMoreComplexSchema1BoxedMap](#notmorecomplexschema1boxedmap) | validateAndBox(Map<?, ?>, configuration: SchemaConfiguration) | +| [NotMoreComplexSchema1BoxedList](#notmorecomplexschema1boxedlist) | validateAndBox(List<*>, configuration: SchemaConfiguration) | +| [NotMoreComplexSchema1Boxed](#notmorecomplexschema1boxed) | validateAndBox(Any?, configuration: SchemaConfiguration) | +| Any? | validate(arg: Any?, configuration: SchemaConfiguration) | + +## NotBoxed +sealed interface NotBoxed
+permits
+[NotBoxedMap](#notboxedmap) + +sealed interface that stores validated payloads using boxed classes + +## NotBoxedMap +data class NotBoxedMap
+implements [NotBoxed](#notboxed) + +data class that stores validated Map payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| NotBoxedMap([NotMap](#notmap) data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| [NotMap](#notmap) | data()
validated payload | +| Any? | getData()
validated payload | + +## Not +class Not
+extends JsonSchema + +A schema class that validates payloads + +### Code Sample +``` +import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags; +import org.openapijsonschematools.client.configurations.SchemaConfiguration; +import org.openapijsonschematools.client.exceptions.ValidationException; +import org.openapijsonschematools.client.schemas.validation.MapUtils; +import org.openapijsonschematools.client.schemas.validation.FrozenList; +import org.openapijsonschematools.client.schemas.validation.FrozenMap; +import org.openapijsonschematools.client.components.schemas.NotMoreComplexSchema; + +import java.util.Arrays; +import java.util.List; +import java.util.AbstractMap; + +static final SchemaConfiguration configuration = new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().build()); + +// Map validation +NotMoreComplexSchema.NotMap validatedPayload = + NotMoreComplexSchema.Not.validate( + new NotMoreComplexSchema.NotMapBuilder() + .foo("a") + + .build(), + configuration +); +``` + +### Field Summary +| Modifier and Type | Field and Description | +| ----------------- | ---------------------- | +| Set> | type = setOf(Map::class.java) | +| Map> | properties = mapOf(
    "foo" to [Foo::class.java](#foo))
)
| + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| [NotMap](#notmap) | validate(arg: [Map<?, ?>](#notmapbuilder), configuration: SchemaConfiguration) | +| [NotBoxedMap](#notboxedmap) | validateAndBox([Map<?, ?>](#notmapbuilder), configuration: SchemaConfiguration) | +| [NotBoxed](#notboxed) | validateAndBox(Any?, configuration: SchemaConfiguration) | +| Any? | validate(arg: Any?, configuration: SchemaConfiguration) | + +## NotMapBuilder +class NotMapBuilder
+builder for `Map` + +A class that builds the Map input type + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| NotMapBuilder()
Creates a builder that contains an empty map | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| Map | build()
Returns map input that should be used with Schema.validate | +| [NotMapBuilder](#notmapbuilder) | foo(value: String) | +| [NotMapBuilder](#notmapbuilder) | additionalProperty(key: String, value: Nothing?) | +| [NotMapBuilder](#notmapbuilder) | additionalProperty(key: String, value: Boolean) | +| [NotMapBuilder](#notmapbuilder) | additionalProperty(key: String, value: String) | +| [NotMapBuilder](#notmapbuilder) | additionalProperty(key: String, value: Int) | +| [NotMapBuilder](#notmapbuilder) | additionalProperty(key: String, value: Float) | +| [NotMapBuilder](#notmapbuilder) | additionalProperty(key: String, value: Long) | +| [NotMapBuilder](#notmapbuilder) | additionalProperty(key: String, value: Double) | +| [NotMapBuilder](#notmapbuilder) | additionalProperty(key: String, value: List) | +| [NotMapBuilder](#notmapbuilder) | additionalProperty(key: String, value: Map) | + +## NotMap +class NotMap
+extends FrozenMap + +A class to store validated Map payloads + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| static [NotMap](#notmap) | of([Map](#notmapbuilder) arg, SchemaConfiguration configuration) | +| String | foo()
[optional] | +| Any? | getAdditionalProperty(String name)
provides type safety for additional properties | + +## FooBoxed +sealed interface FooBoxed
+permits
+[FooBoxedString](#fooboxedstring) + +sealed interface that stores validated payloads using boxed classes + +## FooBoxedString +data class FooBoxedString
+implements [FooBoxed](#fooboxed) + +data class that stores validated String payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| FooBoxedString(String data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| String | data()
validated payload | +| Any? | getData()
validated payload | + +## Foo +class Foo
+extends StringJsonSchema.StringJsonSchema1 + +A schema class that validates payloads + +| Methods Inherited from class org.openapijsonschematools.client.schemas.StringJsonSchema.StringJsonSchema1 | +| ------------------------------------------------------------------ | +| validate | +| validateAndBox | + +[[Back to top]](#top) [[Back to Component Schemas]](../../../README.md#Component-Schemas) [[Back to README]](../../../README.md) diff --git a/samples/client/3_0_3_unit_test/kotlin/docs/components/schemas/NulCharactersInStrings.md b/samples/client/3_0_3_unit_test/kotlin/docs/components/schemas/NulCharactersInStrings.md new file mode 100644 index 00000000000..3fa79cb0018 --- /dev/null +++ b/samples/client/3_0_3_unit_test/kotlin/docs/components/schemas/NulCharactersInStrings.md @@ -0,0 +1,98 @@ +# NulCharactersInStrings +org.openapijsonschematools.client.components.schemas.NulCharactersInStrings.java +class NulCharactersInStrings
+ +A class that contains necessary nested +- schema classes (which validate payloads), extends JsonSchema +- sealed interfaces which store validated payloads, Kotlin version of a sum type +- boxed classes which store validated payloads, sealed permits class implementations +- enum classes + +## Nested Class Summary +| Modifier and Type | Class and Description | +| ----------------- | ---------------------- | +| sealed interface | [NulCharactersInStrings.NulCharactersInStrings1Boxed](#nulcharactersinstrings1boxed)
sealed interface for validated payloads | +| record | [NulCharactersInStrings.NulCharactersInStrings1BoxedString](#nulcharactersinstrings1boxedstring)
boxed class to store validated String payloads | +| static class | [NulCharactersInStrings.NulCharactersInStrings1](#nulcharactersinstrings1)
schema class | +| enum | [NulCharactersInStrings.StringNulCharactersInStringsEnums](#stringnulcharactersinstringsenums)
String enum | + +## NulCharactersInStrings1Boxed +sealed interface NulCharactersInStrings1Boxed
+permits
+[NulCharactersInStrings1BoxedString](#nulcharactersinstrings1boxedstring) + +sealed interface that stores validated payloads using boxed classes + +## NulCharactersInStrings1BoxedString +data class NulCharactersInStrings1BoxedString
+implements [NulCharactersInStrings1Boxed](#nulcharactersinstrings1boxed) + +data class that stores validated String payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| NulCharactersInStrings1BoxedString(String data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| String | data()
validated payload | +| Any? | getData()
validated payload | + +## NulCharactersInStrings1 +class NulCharactersInStrings1
+extends JsonSchema + +A schema class that validates payloads + +### Code Sample +``` +import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags; +import org.openapijsonschematools.client.configurations.SchemaConfiguration; +import org.openapijsonschematools.client.exceptions.ValidationException; +import org.openapijsonschematools.client.schemas.validation.MapUtils; +import org.openapijsonschematools.client.schemas.validation.FrozenList; +import org.openapijsonschematools.client.schemas.validation.FrozenMap; +import org.openapijsonschematools.client.components.schemas.NulCharactersInStrings; + +import java.util.Arrays; +import java.util.List; +import java.util.AbstractMap; + +static final SchemaConfiguration configuration = new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().build()); + +// String validation +String validatedPayload = NulCharactersInStrings.NulCharactersInStrings1.validate( + "hello\u0000there", + configuration +); +``` + +### Field Summary +| Modifier and Type | Field and Description | +| ----------------- | ---------------------- | +| Set> | type = setOf(
    String::class.java
)
| +| Set | enumValues = setOf(
    "hello\u0000there"
)
| + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| String | validate(arg: String, configuration: SchemaConfiguration) | +| String | validate(arg: [StringNulCharactersInStringsEnums](#stringnulcharactersinstringsenums), configuration: SchemaConfiguration) | +| [NulCharactersInStrings1BoxedString](#nulcharactersinstrings1boxedstring) | validateAndBox(String, configuration: SchemaConfiguration) | +| [NulCharactersInStrings1Boxed](#nulcharactersinstrings1boxed) | validateAndBox(Any?, configuration: SchemaConfiguration) | +| Any? | validate(arg: Any?, configuration: SchemaConfiguration) | + +## StringNulCharactersInStringsEnums +public enum StringNulCharactersInStringsEnums
+extends `Enum` + +A class that stores String enum values + +### Enum Constant Summary +| Enum Constant | Description | +| ------------- | ----------- | +| HELLO_NULL_THERE | value = "hello\u0000there" | + +[[Back to top]](#top) [[Back to Component Schemas]](../../../README.md#Component-Schemas) [[Back to README]](../../../README.md) diff --git a/samples/client/3_0_3_unit_test/kotlin/docs/components/schemas/NullTypeMatchesOnlyTheNullObject.md b/samples/client/3_0_3_unit_test/kotlin/docs/components/schemas/NullTypeMatchesOnlyTheNullObject.md new file mode 100644 index 00000000000..0bcdf2e30e4 --- /dev/null +++ b/samples/client/3_0_3_unit_test/kotlin/docs/components/schemas/NullTypeMatchesOnlyTheNullObject.md @@ -0,0 +1,52 @@ +# NullTypeMatchesOnlyTheNullObject +org.openapijsonschematools.client.components.schemas.NullTypeMatchesOnlyTheNullObject.java +class NullTypeMatchesOnlyTheNullObject
+ +A class that contains necessary nested +- schema classes (which validate payloads), extends JsonSchema +- sealed interfaces which store validated payloads, Kotlin version of a sum type +- boxed classes which store validated payloads, sealed permits class implementations + +## Nested Class Summary +| Modifier and Type | Class and Description | +| ----------------- | ---------------------- | +| sealed interface | [NullTypeMatchesOnlyTheNullObject.NullTypeMatchesOnlyTheNullObject1Boxed](#nulltypematchesonlythenullobject1boxed)
sealed interface for validated payloads | +| record | [NullTypeMatchesOnlyTheNullObject.NullTypeMatchesOnlyTheNullObject1BoxedVoid](#nulltypematchesonlythenullobject1boxedvoid)
boxed class to store validated null payloads | +| static class | [NullTypeMatchesOnlyTheNullObject.NullTypeMatchesOnlyTheNullObject1](#nulltypematchesonlythenullobject1)
schema class | + +## NullTypeMatchesOnlyTheNullObject1Boxed +sealed interface NullTypeMatchesOnlyTheNullObject1Boxed
+permits
+[NullTypeMatchesOnlyTheNullObject1BoxedVoid](#nulltypematchesonlythenullobject1boxedvoid) + +sealed interface that stores validated payloads using boxed classes + +## NullTypeMatchesOnlyTheNullObject1BoxedVoid +data class NullTypeMatchesOnlyTheNullObject1BoxedVoid
+implements [NullTypeMatchesOnlyTheNullObject1Boxed](#nulltypematchesonlythenullobject1boxed) + +data class that stores validated null payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| NullTypeMatchesOnlyTheNullObject1BoxedVoid(Nothing? data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| Nothing? | data()
validated payload | +| Any? | getData()
validated payload | + +## NullTypeMatchesOnlyTheNullObject1 +class NullTypeMatchesOnlyTheNullObject1
+extends NullJsonSchema.NullJsonSchema1 + +A schema class that validates payloads + +| Methods Inherited from class org.openapijsonschematools.client.schemas.NullJsonSchema.NullJsonSchema1 | +| ------------------------------------------------------------------ | +| validate | +| validateAndBox | + +[[Back to top]](#top) [[Back to Component Schemas]](../../../README.md#Component-Schemas) [[Back to README]](../../../README.md) diff --git a/samples/client/3_0_3_unit_test/kotlin/docs/components/schemas/NumberTypeMatchesNumbers.md b/samples/client/3_0_3_unit_test/kotlin/docs/components/schemas/NumberTypeMatchesNumbers.md new file mode 100644 index 00000000000..02a48980434 --- /dev/null +++ b/samples/client/3_0_3_unit_test/kotlin/docs/components/schemas/NumberTypeMatchesNumbers.md @@ -0,0 +1,52 @@ +# NumberTypeMatchesNumbers +org.openapijsonschematools.client.components.schemas.NumberTypeMatchesNumbers.java +class NumberTypeMatchesNumbers
+ +A class that contains necessary nested +- schema classes (which validate payloads), extends JsonSchema +- sealed interfaces which store validated payloads, Kotlin version of a sum type +- boxed classes which store validated payloads, sealed permits class implementations + +## Nested Class Summary +| Modifier and Type | Class and Description | +| ----------------- | ---------------------- | +| sealed interface | [NumberTypeMatchesNumbers.NumberTypeMatchesNumbers1Boxed](#numbertypematchesnumbers1boxed)
sealed interface for validated payloads | +| record | [NumberTypeMatchesNumbers.NumberTypeMatchesNumbers1BoxedNumber](#numbertypematchesnumbers1boxednumber)
boxed class to store validated Number payloads | +| static class | [NumberTypeMatchesNumbers.NumberTypeMatchesNumbers1](#numbertypematchesnumbers1)
schema class | + +## NumberTypeMatchesNumbers1Boxed +sealed interface NumberTypeMatchesNumbers1Boxed
+permits
+[NumberTypeMatchesNumbers1BoxedNumber](#numbertypematchesnumbers1boxednumber) + +sealed interface that stores validated payloads using boxed classes + +## NumberTypeMatchesNumbers1BoxedNumber +data class NumberTypeMatchesNumbers1BoxedNumber
+implements [NumberTypeMatchesNumbers1Boxed](#numbertypematchesnumbers1boxed) + +data class that stores validated Number payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| NumberTypeMatchesNumbers1BoxedNumber(Number data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| Number | data()
validated payload | +| Any? | getData()
validated payload | + +## NumberTypeMatchesNumbers1 +class NumberTypeMatchesNumbers1
+extends NumberJsonSchema.NumberJsonSchema1 + +A schema class that validates payloads + +| Methods Inherited from class org.openapijsonschematools.client.schemas.NumberJsonSchema.NumberJsonSchema1 | +| ------------------------------------------------------------------ | +| validate | +| validateAndBox | + +[[Back to top]](#top) [[Back to Component Schemas]](../../../README.md#Component-Schemas) [[Back to README]](../../../README.md) diff --git a/samples/client/3_0_3_unit_test/kotlin/docs/components/schemas/ObjectPropertiesValidation.md b/samples/client/3_0_3_unit_test/kotlin/docs/components/schemas/ObjectPropertiesValidation.md new file mode 100644 index 00000000000..a80a93be1e8 --- /dev/null +++ b/samples/client/3_0_3_unit_test/kotlin/docs/components/schemas/ObjectPropertiesValidation.md @@ -0,0 +1,293 @@ +# ObjectPropertiesValidation +org.openapijsonschematools.client.components.schemas.ObjectPropertiesValidation.java +class ObjectPropertiesValidation
+ +A class that contains necessary nested +- schema classes (which validate payloads), extends JsonSchema +- sealed interfaces which store validated payloads, Kotlin version of a sum type +- boxed classes which store validated payloads, sealed permits class implementations +- classes to store validated map payloads, extends FrozenMap +- classes to build inputs for map payloads + +## Nested Class Summary +| Modifier and Type | Class and Description | +| ----------------- | ---------------------- | +| sealed interface | [ObjectPropertiesValidation.ObjectPropertiesValidation1Boxed](#objectpropertiesvalidation1boxed)
sealed interface for validated payloads | +| record | [ObjectPropertiesValidation.ObjectPropertiesValidation1BoxedVoid](#objectpropertiesvalidation1boxedvoid)
boxed class to store validated null payloads | +| record | [ObjectPropertiesValidation.ObjectPropertiesValidation1BoxedBoolean](#objectpropertiesvalidation1boxedboolean)
boxed class to store validated boolean payloads | +| record | [ObjectPropertiesValidation.ObjectPropertiesValidation1BoxedNumber](#objectpropertiesvalidation1boxednumber)
boxed class to store validated Number payloads | +| record | [ObjectPropertiesValidation.ObjectPropertiesValidation1BoxedString](#objectpropertiesvalidation1boxedstring)
boxed class to store validated String payloads | +| record | [ObjectPropertiesValidation.ObjectPropertiesValidation1BoxedList](#objectpropertiesvalidation1boxedlist)
boxed class to store validated List payloads | +| record | [ObjectPropertiesValidation.ObjectPropertiesValidation1BoxedMap](#objectpropertiesvalidation1boxedmap)
boxed class to store validated Map payloads | +| static class | [ObjectPropertiesValidation.ObjectPropertiesValidation1](#objectpropertiesvalidation1)
schema class | +| static class | [ObjectPropertiesValidation.ObjectPropertiesValidationMapBuilder](#objectpropertiesvalidationmapbuilder)
builder for Map payloads | +| static class | [ObjectPropertiesValidation.ObjectPropertiesValidationMap](#objectpropertiesvalidationmap)
output class for Map payloads | +| sealed interface | [ObjectPropertiesValidation.BarBoxed](#barboxed)
sealed interface for validated payloads | +| record | [ObjectPropertiesValidation.BarBoxedString](#barboxedstring)
boxed class to store validated String payloads | +| static class | [ObjectPropertiesValidation.Bar](#bar)
schema class | +| sealed interface | [ObjectPropertiesValidation.FooBoxed](#fooboxed)
sealed interface for validated payloads | +| record | [ObjectPropertiesValidation.FooBoxedNumber](#fooboxednumber)
boxed class to store validated Number payloads | +| static class | [ObjectPropertiesValidation.Foo](#foo)
schema class | + +## ObjectPropertiesValidation1Boxed +sealed interface ObjectPropertiesValidation1Boxed
+permits
+[ObjectPropertiesValidation1BoxedVoid](#objectpropertiesvalidation1boxedvoid), +[ObjectPropertiesValidation1BoxedBoolean](#objectpropertiesvalidation1boxedboolean), +[ObjectPropertiesValidation1BoxedNumber](#objectpropertiesvalidation1boxednumber), +[ObjectPropertiesValidation1BoxedString](#objectpropertiesvalidation1boxedstring), +[ObjectPropertiesValidation1BoxedList](#objectpropertiesvalidation1boxedlist), +[ObjectPropertiesValidation1BoxedMap](#objectpropertiesvalidation1boxedmap) + +sealed interface that stores validated payloads using boxed classes + +## ObjectPropertiesValidation1BoxedVoid +data class ObjectPropertiesValidation1BoxedVoid
+implements [ObjectPropertiesValidation1Boxed](#objectpropertiesvalidation1boxed) + +data class that stores validated null payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| ObjectPropertiesValidation1BoxedVoid(Nothing? data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| Nothing? | data()
validated payload | +| Any? | getData()
validated payload | + +## ObjectPropertiesValidation1BoxedBoolean +data class ObjectPropertiesValidation1BoxedBoolean
+implements [ObjectPropertiesValidation1Boxed](#objectpropertiesvalidation1boxed) + +record that stores validated boolean payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| ObjectPropertiesValidation1BoxedBoolean(boolean data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| boolean | data()
validated payload | +| Any? | getData()
validated payload | + +## ObjectPropertiesValidation1BoxedNumber +data class ObjectPropertiesValidation1BoxedNumber
+implements [ObjectPropertiesValidation1Boxed](#objectpropertiesvalidation1boxed) + +data class that stores validated Number payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| ObjectPropertiesValidation1BoxedNumber(Number data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| Number | data()
validated payload | +| Any? | getData()
validated payload | + +## ObjectPropertiesValidation1BoxedString +data class ObjectPropertiesValidation1BoxedString
+implements [ObjectPropertiesValidation1Boxed](#objectpropertiesvalidation1boxed) + +data class that stores validated String payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| ObjectPropertiesValidation1BoxedString(String data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| String | data()
validated payload | +| Any? | getData()
validated payload | + +## ObjectPropertiesValidation1BoxedList +data class ObjectPropertiesValidation1BoxedList
+implements [ObjectPropertiesValidation1Boxed](#objectpropertiesvalidation1boxed) + +data class that stores validated List payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| ObjectPropertiesValidation1BoxedList(FrozenList data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| FrozenList | data()
validated payload | +| Any? | getData()
validated payload | + +## ObjectPropertiesValidation1BoxedMap +data class ObjectPropertiesValidation1BoxedMap
+implements [ObjectPropertiesValidation1Boxed](#objectpropertiesvalidation1boxed) + +data class that stores validated Map payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| ObjectPropertiesValidation1BoxedMap([ObjectPropertiesValidationMap](#objectpropertiesvalidationmap) data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| [ObjectPropertiesValidationMap](#objectpropertiesvalidationmap) | data()
validated payload | +| Any? | getData()
validated payload | + +## ObjectPropertiesValidation1 +class ObjectPropertiesValidation1
+extends JsonSchema + +A schema class that validates payloads + +### Field Summary +| Modifier and Type | Field and Description | +| ----------------- | ---------------------- | +| Map> | properties = mapOf(
    "foo" to [Foo::class.java](#foo)),
    "bar" to [Bar::class.java](#bar))
)
| + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| String | validate(arg: String, configuration: SchemaConfiguration) | +| Nothing? | validate(arg: Nothing?, configuration: SchemaConfiguration) | +| int | validate(arg: int, configuration: SchemaConfiguration) | +| long | validate(arg: long, configuration: SchemaConfiguration) | +| float | validate(arg: float, configuration: SchemaConfiguration) | +| double | validate(arg: double, configuration: SchemaConfiguration) | +| Number | validate(arg: Number, configuration: SchemaConfiguration) | +| boolean | validate(arg: boolean, configuration: SchemaConfiguration) | +| [ObjectPropertiesValidationMap](#objectpropertiesvalidationmap) | validate(arg: [Map<?, ?>](#objectpropertiesvalidationmapbuilder), configuration: SchemaConfiguration) | +| FrozenList | validate(arg: List<*>, configuration: SchemaConfiguration) | +| [ObjectPropertiesValidation1BoxedString](#objectpropertiesvalidation1boxedstring) | validateAndBox(String, configuration: SchemaConfiguration) | +| [ObjectPropertiesValidation1BoxedVoid](#objectpropertiesvalidation1boxedvoid) | validateAndBox(Nothing?, configuration: SchemaConfiguration) | +| [ObjectPropertiesValidation1BoxedNumber](#objectpropertiesvalidation1boxednumber) | validateAndBox(Number, configuration: SchemaConfiguration) | +| [ObjectPropertiesValidation1BoxedBoolean](#objectpropertiesvalidation1boxedboolean) | validateAndBox(boolean, configuration: SchemaConfiguration) | +| [ObjectPropertiesValidation1BoxedMap](#objectpropertiesvalidation1boxedmap) | validateAndBox([Map<?, ?>](#objectpropertiesvalidationmapbuilder), configuration: SchemaConfiguration) | +| [ObjectPropertiesValidation1BoxedList](#objectpropertiesvalidation1boxedlist) | validateAndBox(List<*>, configuration: SchemaConfiguration) | +| [ObjectPropertiesValidation1Boxed](#objectpropertiesvalidation1boxed) | validateAndBox(Any?, configuration: SchemaConfiguration) | +| Any? | validate(arg: Any?, configuration: SchemaConfiguration) | + +## ObjectPropertiesValidationMapBuilder +class ObjectPropertiesValidationMapBuilder
+builder for `Map` + +A class that builds the Map input type + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| ObjectPropertiesValidationMapBuilder()
Creates a builder that contains an empty map | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| Map | build()
Returns map input that should be used with Schema.validate | +| [ObjectPropertiesValidationMapBuilder](#objectpropertiesvalidationmapbuilder) | foo(value: Int) | +| [ObjectPropertiesValidationMapBuilder](#objectpropertiesvalidationmapbuilder) | foo(value: Float) | +| [ObjectPropertiesValidationMapBuilder](#objectpropertiesvalidationmapbuilder) | foo(value: Long) | +| [ObjectPropertiesValidationMapBuilder](#objectpropertiesvalidationmapbuilder) | foo(value: Double) | +| [ObjectPropertiesValidationMapBuilder](#objectpropertiesvalidationmapbuilder) | bar(value: String) | +| [ObjectPropertiesValidationMapBuilder](#objectpropertiesvalidationmapbuilder) | additionalProperty(key: String, value: Nothing?) | +| [ObjectPropertiesValidationMapBuilder](#objectpropertiesvalidationmapbuilder) | additionalProperty(key: String, value: Boolean) | +| [ObjectPropertiesValidationMapBuilder](#objectpropertiesvalidationmapbuilder) | additionalProperty(key: String, value: String) | +| [ObjectPropertiesValidationMapBuilder](#objectpropertiesvalidationmapbuilder) | additionalProperty(key: String, value: Int) | +| [ObjectPropertiesValidationMapBuilder](#objectpropertiesvalidationmapbuilder) | additionalProperty(key: String, value: Float) | +| [ObjectPropertiesValidationMapBuilder](#objectpropertiesvalidationmapbuilder) | additionalProperty(key: String, value: Long) | +| [ObjectPropertiesValidationMapBuilder](#objectpropertiesvalidationmapbuilder) | additionalProperty(key: String, value: Double) | +| [ObjectPropertiesValidationMapBuilder](#objectpropertiesvalidationmapbuilder) | additionalProperty(key: String, value: List) | +| [ObjectPropertiesValidationMapBuilder](#objectpropertiesvalidationmapbuilder) | additionalProperty(key: String, value: Map) | + +## ObjectPropertiesValidationMap +class ObjectPropertiesValidationMap
+extends FrozenMap + +A class to store validated Map payloads + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| static [ObjectPropertiesValidationMap](#objectpropertiesvalidationmap) | of([Map](#objectpropertiesvalidationmapbuilder) arg, SchemaConfiguration configuration) | +| Number | foo()
[optional] | +| String | bar()
[optional] | +| Any? | getAdditionalProperty(String name)
provides type safety for additional properties | + +## BarBoxed +sealed interface BarBoxed
+permits
+[BarBoxedString](#barboxedstring) + +sealed interface that stores validated payloads using boxed classes + +## BarBoxedString +data class BarBoxedString
+implements [BarBoxed](#barboxed) + +data class that stores validated String payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| BarBoxedString(String data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| String | data()
validated payload | +| Any? | getData()
validated payload | + +## Bar +class Bar
+extends StringJsonSchema.StringJsonSchema1 + +A schema class that validates payloads + +| Methods Inherited from class org.openapijsonschematools.client.schemas.StringJsonSchema.StringJsonSchema1 | +| ------------------------------------------------------------------ | +| validate | +| validateAndBox | + +## FooBoxed +sealed interface FooBoxed
+permits
+[FooBoxedNumber](#fooboxednumber) + +sealed interface that stores validated payloads using boxed classes + +## FooBoxedNumber +data class FooBoxedNumber
+implements [FooBoxed](#fooboxed) + +data class that stores validated Number payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| FooBoxedNumber(Number data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| Number | data()
validated payload | +| Any? | getData()
validated payload | + +## Foo +class Foo
+extends IntJsonSchema.IntJsonSchema1 + +A schema class that validates payloads + +| Methods Inherited from class org.openapijsonschematools.client.schemas.IntJsonSchema.IntJsonSchema1 | +| ------------------------------------------------------------------ | +| validate | +| validateAndBox | + +[[Back to top]](#top) [[Back to Component Schemas]](../../../README.md#Component-Schemas) [[Back to README]](../../../README.md) diff --git a/samples/client/3_0_3_unit_test/kotlin/docs/components/schemas/ObjectTypeMatchesObjects.md b/samples/client/3_0_3_unit_test/kotlin/docs/components/schemas/ObjectTypeMatchesObjects.md new file mode 100644 index 00000000000..ddc0d8b8aa6 --- /dev/null +++ b/samples/client/3_0_3_unit_test/kotlin/docs/components/schemas/ObjectTypeMatchesObjects.md @@ -0,0 +1,52 @@ +# ObjectTypeMatchesObjects +org.openapijsonschematools.client.components.schemas.ObjectTypeMatchesObjects.java +class ObjectTypeMatchesObjects
+ +A class that contains necessary nested +- schema classes (which validate payloads), extends JsonSchema +- sealed interfaces which store validated payloads, Kotlin version of a sum type +- boxed classes which store validated payloads, sealed permits class implementations + +## Nested Class Summary +| Modifier and Type | Class and Description | +| ----------------- | ---------------------- | +| sealed interface | [ObjectTypeMatchesObjects.ObjectTypeMatchesObjects1Boxed](#objecttypematchesobjects1boxed)
sealed interface for validated payloads | +| record | [ObjectTypeMatchesObjects.ObjectTypeMatchesObjects1BoxedMap](#objecttypematchesobjects1boxedmap)
boxed class to store validated Map payloads | +| static class | [ObjectTypeMatchesObjects.ObjectTypeMatchesObjects1](#objecttypematchesobjects1)
schema class | + +## ObjectTypeMatchesObjects1Boxed +sealed interface ObjectTypeMatchesObjects1Boxed
+permits
+[ObjectTypeMatchesObjects1BoxedMap](#objecttypematchesobjects1boxedmap) + +sealed interface that stores validated payloads using boxed classes + +## ObjectTypeMatchesObjects1BoxedMap +data class ObjectTypeMatchesObjects1BoxedMap
+implements [ObjectTypeMatchesObjects1Boxed](#objecttypematchesobjects1boxed) + +data class that stores validated Map payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| ObjectTypeMatchesObjects1BoxedMap(FrozenMap data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| FrozenMap | data()
validated payload | +| Any? | getData()
validated payload | + +## ObjectTypeMatchesObjects1 +class ObjectTypeMatchesObjects1
+extends MapJsonSchema.MapJsonSchema1 + +A schema class that validates payloads + +| Methods Inherited from class org.openapijsonschematools.client.schemas.MapJsonSchema.MapJsonSchema1 | +| ------------------------------------------------------------------ | +| validate | +| validateAndBox | + +[[Back to top]](#top) [[Back to Component Schemas]](../../../README.md#Component-Schemas) [[Back to README]](../../../README.md) diff --git a/samples/client/3_0_3_unit_test/kotlin/docs/components/schemas/Oneof.md b/samples/client/3_0_3_unit_test/kotlin/docs/components/schemas/Oneof.md new file mode 100644 index 00000000000..c94e5017546 --- /dev/null +++ b/samples/client/3_0_3_unit_test/kotlin/docs/components/schemas/Oneof.md @@ -0,0 +1,362 @@ +# Oneof +org.openapijsonschematools.client.components.schemas.Oneof.java +class Oneof
+ +A class that contains necessary nested +- schema classes (which validate payloads), extends JsonSchema +- sealed interfaces which store validated payloads, Kotlin version of a sum type +- boxed classes which store validated payloads, sealed permits class implementations + +## Nested Class Summary +| Modifier and Type | Class and Description | +| ----------------- | ---------------------- | +| sealed interface | [Oneof.Oneof1Boxed](#oneof1boxed)
sealed interface for validated payloads | +| record | [Oneof.Oneof1BoxedVoid](#oneof1boxedvoid)
boxed class to store validated null payloads | +| record | [Oneof.Oneof1BoxedBoolean](#oneof1boxedboolean)
boxed class to store validated boolean payloads | +| record | [Oneof.Oneof1BoxedNumber](#oneof1boxednumber)
boxed class to store validated Number payloads | +| record | [Oneof.Oneof1BoxedString](#oneof1boxedstring)
boxed class to store validated String payloads | +| record | [Oneof.Oneof1BoxedList](#oneof1boxedlist)
boxed class to store validated List payloads | +| record | [Oneof.Oneof1BoxedMap](#oneof1boxedmap)
boxed class to store validated Map payloads | +| static class | [Oneof.Oneof1](#oneof1)
schema class | +| sealed interface | [Oneof.Schema1Boxed](#schema1boxed)
sealed interface for validated payloads | +| record | [Oneof.Schema1BoxedVoid](#schema1boxedvoid)
boxed class to store validated null payloads | +| record | [Oneof.Schema1BoxedBoolean](#schema1boxedboolean)
boxed class to store validated boolean payloads | +| record | [Oneof.Schema1BoxedNumber](#schema1boxednumber)
boxed class to store validated Number payloads | +| record | [Oneof.Schema1BoxedString](#schema1boxedstring)
boxed class to store validated String payloads | +| record | [Oneof.Schema1BoxedList](#schema1boxedlist)
boxed class to store validated List payloads | +| record | [Oneof.Schema1BoxedMap](#schema1boxedmap)
boxed class to store validated Map payloads | +| static class | [Oneof.Schema1](#schema1)
schema class | +| sealed interface | [Oneof.Schema0Boxed](#schema0boxed)
sealed interface for validated payloads | +| record | [Oneof.Schema0BoxedNumber](#schema0boxednumber)
boxed class to store validated Number payloads | +| static class | [Oneof.Schema0](#schema0)
schema class | + +## Oneof1Boxed +sealed interface Oneof1Boxed
+permits
+[Oneof1BoxedVoid](#oneof1boxedvoid), +[Oneof1BoxedBoolean](#oneof1boxedboolean), +[Oneof1BoxedNumber](#oneof1boxednumber), +[Oneof1BoxedString](#oneof1boxedstring), +[Oneof1BoxedList](#oneof1boxedlist), +[Oneof1BoxedMap](#oneof1boxedmap) + +sealed interface that stores validated payloads using boxed classes + +## Oneof1BoxedVoid +data class Oneof1BoxedVoid
+implements [Oneof1Boxed](#oneof1boxed) + +data class that stores validated null payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| Oneof1BoxedVoid(Nothing? data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| Nothing? | data()
validated payload | +| Any? | getData()
validated payload | + +## Oneof1BoxedBoolean +data class Oneof1BoxedBoolean
+implements [Oneof1Boxed](#oneof1boxed) + +record that stores validated boolean payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| Oneof1BoxedBoolean(boolean data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| boolean | data()
validated payload | +| Any? | getData()
validated payload | + +## Oneof1BoxedNumber +data class Oneof1BoxedNumber
+implements [Oneof1Boxed](#oneof1boxed) + +data class that stores validated Number payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| Oneof1BoxedNumber(Number data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| Number | data()
validated payload | +| Any? | getData()
validated payload | + +## Oneof1BoxedString +data class Oneof1BoxedString
+implements [Oneof1Boxed](#oneof1boxed) + +data class that stores validated String payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| Oneof1BoxedString(String data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| String | data()
validated payload | +| Any? | getData()
validated payload | + +## Oneof1BoxedList +data class Oneof1BoxedList
+implements [Oneof1Boxed](#oneof1boxed) + +data class that stores validated List payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| Oneof1BoxedList(FrozenList data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| FrozenList | data()
validated payload | +| Any? | getData()
validated payload | + +## Oneof1BoxedMap +data class Oneof1BoxedMap
+implements [Oneof1Boxed](#oneof1boxed) + +data class that stores validated Map payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| Oneof1BoxedMap(FrozenMap data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| FrozenMap | data()
validated payload | +| Any? | getData()
validated payload | + +## Oneof1 +class Oneof1
+extends JsonSchema + +A schema class that validates payloads + +### Field Summary +| Modifier and Type | Field and Description | +| ----------------- | ---------------------- | +| List> | oneOf = listOf(
    [Schema0::class.java](#schema0),
    [Schema1::class.java](#schema1)
))
| + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| String | validate(arg: String, configuration: SchemaConfiguration) | +| Nothing? | validate(arg: Nothing?, configuration: SchemaConfiguration) | +| int | validate(arg: int, configuration: SchemaConfiguration) | +| long | validate(arg: long, configuration: SchemaConfiguration) | +| float | validate(arg: float, configuration: SchemaConfiguration) | +| double | validate(arg: double, configuration: SchemaConfiguration) | +| Number | validate(arg: Number, configuration: SchemaConfiguration) | +| boolean | validate(arg: boolean, configuration: SchemaConfiguration) | +| FrozenMap | validate(arg: Map<?, ?>, configuration: SchemaConfiguration) | +| FrozenList | validate(arg: List<*>, configuration: SchemaConfiguration) | +| [Oneof1BoxedString](#oneof1boxedstring) | validateAndBox(String, configuration: SchemaConfiguration) | +| [Oneof1BoxedVoid](#oneof1boxedvoid) | validateAndBox(Nothing?, configuration: SchemaConfiguration) | +| [Oneof1BoxedNumber](#oneof1boxednumber) | validateAndBox(Number, configuration: SchemaConfiguration) | +| [Oneof1BoxedBoolean](#oneof1boxedboolean) | validateAndBox(boolean, configuration: SchemaConfiguration) | +| [Oneof1BoxedMap](#oneof1boxedmap) | validateAndBox(Map<?, ?>, configuration: SchemaConfiguration) | +| [Oneof1BoxedList](#oneof1boxedlist) | validateAndBox(List<*>, configuration: SchemaConfiguration) | +| [Oneof1Boxed](#oneof1boxed) | validateAndBox(Any?, configuration: SchemaConfiguration) | +| Any? | validate(arg: Any?, configuration: SchemaConfiguration) | + +## Schema1Boxed +sealed interface Schema1Boxed
+permits
+[Schema1BoxedVoid](#schema1boxedvoid), +[Schema1BoxedBoolean](#schema1boxedboolean), +[Schema1BoxedNumber](#schema1boxednumber), +[Schema1BoxedString](#schema1boxedstring), +[Schema1BoxedList](#schema1boxedlist), +[Schema1BoxedMap](#schema1boxedmap) + +sealed interface that stores validated payloads using boxed classes + +## Schema1BoxedVoid +data class Schema1BoxedVoid
+implements [Schema1Boxed](#schema1boxed) + +data class that stores validated null payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| Schema1BoxedVoid(Nothing? data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| Nothing? | data()
validated payload | +| Any? | getData()
validated payload | + +## Schema1BoxedBoolean +data class Schema1BoxedBoolean
+implements [Schema1Boxed](#schema1boxed) + +record that stores validated boolean payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| Schema1BoxedBoolean(boolean data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| boolean | data()
validated payload | +| Any? | getData()
validated payload | + +## Schema1BoxedNumber +data class Schema1BoxedNumber
+implements [Schema1Boxed](#schema1boxed) + +data class that stores validated Number payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| Schema1BoxedNumber(Number data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| Number | data()
validated payload | +| Any? | getData()
validated payload | + +## Schema1BoxedString +data class Schema1BoxedString
+implements [Schema1Boxed](#schema1boxed) + +data class that stores validated String payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| Schema1BoxedString(String data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| String | data()
validated payload | +| Any? | getData()
validated payload | + +## Schema1BoxedList +data class Schema1BoxedList
+implements [Schema1Boxed](#schema1boxed) + +data class that stores validated List payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| Schema1BoxedList(FrozenList data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| FrozenList | data()
validated payload | +| Any? | getData()
validated payload | + +## Schema1BoxedMap +data class Schema1BoxedMap
+implements [Schema1Boxed](#schema1boxed) + +data class that stores validated Map payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| Schema1BoxedMap(FrozenMap data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| FrozenMap | data()
validated payload | +| Any? | getData()
validated payload | + +## Schema1 +class Schema1
+extends JsonSchema + +A schema class that validates payloads + +### Field Summary +| Modifier and Type | Field and Description | +| ----------------- | ---------------------- | +| Number | minimum = 2 | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| String | validate(arg: String, configuration: SchemaConfiguration) | +| Nothing? | validate(arg: Nothing?, configuration: SchemaConfiguration) | +| int | validate(arg: int, configuration: SchemaConfiguration) | +| long | validate(arg: long, configuration: SchemaConfiguration) | +| float | validate(arg: float, configuration: SchemaConfiguration) | +| double | validate(arg: double, configuration: SchemaConfiguration) | +| Number | validate(arg: Number, configuration: SchemaConfiguration) | +| boolean | validate(arg: boolean, configuration: SchemaConfiguration) | +| FrozenMap | validate(arg: Map<?, ?>, configuration: SchemaConfiguration) | +| FrozenList | validate(arg: List<*>, configuration: SchemaConfiguration) | +| [Schema1BoxedString](#schema1boxedstring) | validateAndBox(String, configuration: SchemaConfiguration) | +| [Schema1BoxedVoid](#schema1boxedvoid) | validateAndBox(Nothing?, configuration: SchemaConfiguration) | +| [Schema1BoxedNumber](#schema1boxednumber) | validateAndBox(Number, configuration: SchemaConfiguration) | +| [Schema1BoxedBoolean](#schema1boxedboolean) | validateAndBox(boolean, configuration: SchemaConfiguration) | +| [Schema1BoxedMap](#schema1boxedmap) | validateAndBox(Map<?, ?>, configuration: SchemaConfiguration) | +| [Schema1BoxedList](#schema1boxedlist) | validateAndBox(List<*>, configuration: SchemaConfiguration) | +| [Schema1Boxed](#schema1boxed) | validateAndBox(Any?, configuration: SchemaConfiguration) | +| Any? | validate(arg: Any?, configuration: SchemaConfiguration) | + +## Schema0Boxed +sealed interface Schema0Boxed
+permits
+[Schema0BoxedNumber](#schema0boxednumber) + +sealed interface that stores validated payloads using boxed classes + +## Schema0BoxedNumber +data class Schema0BoxedNumber
+implements [Schema0Boxed](#schema0boxed) + +data class that stores validated Number payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| Schema0BoxedNumber(Number data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| Number | data()
validated payload | +| Any? | getData()
validated payload | + +## Schema0 +class Schema0
+extends IntJsonSchema.IntJsonSchema1 + +A schema class that validates payloads + +| Methods Inherited from class org.openapijsonschematools.client.schemas.IntJsonSchema.IntJsonSchema1 | +| ------------------------------------------------------------------ | +| validate | +| validateAndBox | + +[[Back to top]](#top) [[Back to Component Schemas]](../../../README.md#Component-Schemas) [[Back to README]](../../../README.md) diff --git a/samples/client/3_0_3_unit_test/kotlin/docs/components/schemas/OneofComplexTypes.md b/samples/client/3_0_3_unit_test/kotlin/docs/components/schemas/OneofComplexTypes.md new file mode 100644 index 00000000000..42bf6a2067a --- /dev/null +++ b/samples/client/3_0_3_unit_test/kotlin/docs/components/schemas/OneofComplexTypes.md @@ -0,0 +1,674 @@ +# OneofComplexTypes +org.openapijsonschematools.client.components.schemas.OneofComplexTypes.java +class OneofComplexTypes
+ +A class that contains necessary nested +- schema classes (which validate payloads), extends JsonSchema +- sealed interfaces which store validated payloads, Kotlin version of a sum type +- boxed classes which store validated payloads, sealed permits class implementations +- classes to store validated map payloads, extends FrozenMap +- classes to build inputs for map payloads + +## Nested Class Summary +| Modifier and Type | Class and Description | +| ----------------- | ---------------------- | +| sealed interface | [OneofComplexTypes.OneofComplexTypes1Boxed](#oneofcomplextypes1boxed)
sealed interface for validated payloads | +| record | [OneofComplexTypes.OneofComplexTypes1BoxedVoid](#oneofcomplextypes1boxedvoid)
boxed class to store validated null payloads | +| record | [OneofComplexTypes.OneofComplexTypes1BoxedBoolean](#oneofcomplextypes1boxedboolean)
boxed class to store validated boolean payloads | +| record | [OneofComplexTypes.OneofComplexTypes1BoxedNumber](#oneofcomplextypes1boxednumber)
boxed class to store validated Number payloads | +| record | [OneofComplexTypes.OneofComplexTypes1BoxedString](#oneofcomplextypes1boxedstring)
boxed class to store validated String payloads | +| record | [OneofComplexTypes.OneofComplexTypes1BoxedList](#oneofcomplextypes1boxedlist)
boxed class to store validated List payloads | +| record | [OneofComplexTypes.OneofComplexTypes1BoxedMap](#oneofcomplextypes1boxedmap)
boxed class to store validated Map payloads | +| static class | [OneofComplexTypes.OneofComplexTypes1](#oneofcomplextypes1)
schema class | +| sealed interface | [OneofComplexTypes.Schema1Boxed](#schema1boxed)
sealed interface for validated payloads | +| record | [OneofComplexTypes.Schema1BoxedVoid](#schema1boxedvoid)
boxed class to store validated null payloads | +| record | [OneofComplexTypes.Schema1BoxedBoolean](#schema1boxedboolean)
boxed class to store validated boolean payloads | +| record | [OneofComplexTypes.Schema1BoxedNumber](#schema1boxednumber)
boxed class to store validated Number payloads | +| record | [OneofComplexTypes.Schema1BoxedString](#schema1boxedstring)
boxed class to store validated String payloads | +| record | [OneofComplexTypes.Schema1BoxedList](#schema1boxedlist)
boxed class to store validated List payloads | +| record | [OneofComplexTypes.Schema1BoxedMap](#schema1boxedmap)
boxed class to store validated Map payloads | +| static class | [OneofComplexTypes.Schema1](#schema1)
schema class | +| static class | [OneofComplexTypes.Schema1MapBuilder](#schema1mapbuilder)
builder for Map payloads | +| static class | [OneofComplexTypes.Schema1Map](#schema1map)
output class for Map payloads | +| sealed interface | [OneofComplexTypes.FooBoxed](#fooboxed)
sealed interface for validated payloads | +| record | [OneofComplexTypes.FooBoxedString](#fooboxedstring)
boxed class to store validated String payloads | +| static class | [OneofComplexTypes.Foo](#foo)
schema class | +| sealed interface | [OneofComplexTypes.Schema0Boxed](#schema0boxed)
sealed interface for validated payloads | +| record | [OneofComplexTypes.Schema0BoxedVoid](#schema0boxedvoid)
boxed class to store validated null payloads | +| record | [OneofComplexTypes.Schema0BoxedBoolean](#schema0boxedboolean)
boxed class to store validated boolean payloads | +| record | [OneofComplexTypes.Schema0BoxedNumber](#schema0boxednumber)
boxed class to store validated Number payloads | +| record | [OneofComplexTypes.Schema0BoxedString](#schema0boxedstring)
boxed class to store validated String payloads | +| record | [OneofComplexTypes.Schema0BoxedList](#schema0boxedlist)
boxed class to store validated List payloads | +| record | [OneofComplexTypes.Schema0BoxedMap](#schema0boxedmap)
boxed class to store validated Map payloads | +| static class | [OneofComplexTypes.Schema0](#schema0)
schema class | +| static class | [OneofComplexTypes.Schema0MapBuilder](#schema0mapbuilder)
builder for Map payloads | +| static class | [OneofComplexTypes.Schema0Map](#schema0map)
output class for Map payloads | +| sealed interface | [OneofComplexTypes.BarBoxed](#barboxed)
sealed interface for validated payloads | +| record | [OneofComplexTypes.BarBoxedNumber](#barboxednumber)
boxed class to store validated Number payloads | +| static class | [OneofComplexTypes.Bar](#bar)
schema class | + +## OneofComplexTypes1Boxed +sealed interface OneofComplexTypes1Boxed
+permits
+[OneofComplexTypes1BoxedVoid](#oneofcomplextypes1boxedvoid), +[OneofComplexTypes1BoxedBoolean](#oneofcomplextypes1boxedboolean), +[OneofComplexTypes1BoxedNumber](#oneofcomplextypes1boxednumber), +[OneofComplexTypes1BoxedString](#oneofcomplextypes1boxedstring), +[OneofComplexTypes1BoxedList](#oneofcomplextypes1boxedlist), +[OneofComplexTypes1BoxedMap](#oneofcomplextypes1boxedmap) + +sealed interface that stores validated payloads using boxed classes + +## OneofComplexTypes1BoxedVoid +data class OneofComplexTypes1BoxedVoid
+implements [OneofComplexTypes1Boxed](#oneofcomplextypes1boxed) + +data class that stores validated null payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| OneofComplexTypes1BoxedVoid(Nothing? data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| Nothing? | data()
validated payload | +| Any? | getData()
validated payload | + +## OneofComplexTypes1BoxedBoolean +data class OneofComplexTypes1BoxedBoolean
+implements [OneofComplexTypes1Boxed](#oneofcomplextypes1boxed) + +record that stores validated boolean payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| OneofComplexTypes1BoxedBoolean(boolean data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| boolean | data()
validated payload | +| Any? | getData()
validated payload | + +## OneofComplexTypes1BoxedNumber +data class OneofComplexTypes1BoxedNumber
+implements [OneofComplexTypes1Boxed](#oneofcomplextypes1boxed) + +data class that stores validated Number payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| OneofComplexTypes1BoxedNumber(Number data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| Number | data()
validated payload | +| Any? | getData()
validated payload | + +## OneofComplexTypes1BoxedString +data class OneofComplexTypes1BoxedString
+implements [OneofComplexTypes1Boxed](#oneofcomplextypes1boxed) + +data class that stores validated String payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| OneofComplexTypes1BoxedString(String data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| String | data()
validated payload | +| Any? | getData()
validated payload | + +## OneofComplexTypes1BoxedList +data class OneofComplexTypes1BoxedList
+implements [OneofComplexTypes1Boxed](#oneofcomplextypes1boxed) + +data class that stores validated List payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| OneofComplexTypes1BoxedList(FrozenList data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| FrozenList | data()
validated payload | +| Any? | getData()
validated payload | + +## OneofComplexTypes1BoxedMap +data class OneofComplexTypes1BoxedMap
+implements [OneofComplexTypes1Boxed](#oneofcomplextypes1boxed) + +data class that stores validated Map payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| OneofComplexTypes1BoxedMap(FrozenMap data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| FrozenMap | data()
validated payload | +| Any? | getData()
validated payload | + +## OneofComplexTypes1 +class OneofComplexTypes1
+extends JsonSchema + +A schema class that validates payloads + +### Field Summary +| Modifier and Type | Field and Description | +| ----------------- | ---------------------- | +| List> | oneOf = listOf(
    [Schema0::class.java](#schema0),
    [Schema1::class.java](#schema1)
))
| + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| String | validate(arg: String, configuration: SchemaConfiguration) | +| Nothing? | validate(arg: Nothing?, configuration: SchemaConfiguration) | +| int | validate(arg: int, configuration: SchemaConfiguration) | +| long | validate(arg: long, configuration: SchemaConfiguration) | +| float | validate(arg: float, configuration: SchemaConfiguration) | +| double | validate(arg: double, configuration: SchemaConfiguration) | +| Number | validate(arg: Number, configuration: SchemaConfiguration) | +| boolean | validate(arg: boolean, configuration: SchemaConfiguration) | +| FrozenMap | validate(arg: Map<?, ?>, configuration: SchemaConfiguration) | +| FrozenList | validate(arg: List<*>, configuration: SchemaConfiguration) | +| [OneofComplexTypes1BoxedString](#oneofcomplextypes1boxedstring) | validateAndBox(String, configuration: SchemaConfiguration) | +| [OneofComplexTypes1BoxedVoid](#oneofcomplextypes1boxedvoid) | validateAndBox(Nothing?, configuration: SchemaConfiguration) | +| [OneofComplexTypes1BoxedNumber](#oneofcomplextypes1boxednumber) | validateAndBox(Number, configuration: SchemaConfiguration) | +| [OneofComplexTypes1BoxedBoolean](#oneofcomplextypes1boxedboolean) | validateAndBox(boolean, configuration: SchemaConfiguration) | +| [OneofComplexTypes1BoxedMap](#oneofcomplextypes1boxedmap) | validateAndBox(Map<?, ?>, configuration: SchemaConfiguration) | +| [OneofComplexTypes1BoxedList](#oneofcomplextypes1boxedlist) | validateAndBox(List<*>, configuration: SchemaConfiguration) | +| [OneofComplexTypes1Boxed](#oneofcomplextypes1boxed) | validateAndBox(Any?, configuration: SchemaConfiguration) | +| Any? | validate(arg: Any?, configuration: SchemaConfiguration) | + +## Schema1Boxed +sealed interface Schema1Boxed
+permits
+[Schema1BoxedVoid](#schema1boxedvoid), +[Schema1BoxedBoolean](#schema1boxedboolean), +[Schema1BoxedNumber](#schema1boxednumber), +[Schema1BoxedString](#schema1boxedstring), +[Schema1BoxedList](#schema1boxedlist), +[Schema1BoxedMap](#schema1boxedmap) + +sealed interface that stores validated payloads using boxed classes + +## Schema1BoxedVoid +data class Schema1BoxedVoid
+implements [Schema1Boxed](#schema1boxed) + +data class that stores validated null payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| Schema1BoxedVoid(Nothing? data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| Nothing? | data()
validated payload | +| Any? | getData()
validated payload | + +## Schema1BoxedBoolean +data class Schema1BoxedBoolean
+implements [Schema1Boxed](#schema1boxed) + +record that stores validated boolean payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| Schema1BoxedBoolean(boolean data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| boolean | data()
validated payload | +| Any? | getData()
validated payload | + +## Schema1BoxedNumber +data class Schema1BoxedNumber
+implements [Schema1Boxed](#schema1boxed) + +data class that stores validated Number payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| Schema1BoxedNumber(Number data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| Number | data()
validated payload | +| Any? | getData()
validated payload | + +## Schema1BoxedString +data class Schema1BoxedString
+implements [Schema1Boxed](#schema1boxed) + +data class that stores validated String payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| Schema1BoxedString(String data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| String | data()
validated payload | +| Any? | getData()
validated payload | + +## Schema1BoxedList +data class Schema1BoxedList
+implements [Schema1Boxed](#schema1boxed) + +data class that stores validated List payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| Schema1BoxedList(FrozenList data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| FrozenList | data()
validated payload | +| Any? | getData()
validated payload | + +## Schema1BoxedMap +data class Schema1BoxedMap
+implements [Schema1Boxed](#schema1boxed) + +data class that stores validated Map payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| Schema1BoxedMap([Schema1Map](#schema1map) data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| [Schema1Map](#schema1map) | data()
validated payload | +| Any? | getData()
validated payload | + +## Schema1 +class Schema1
+extends JsonSchema + +A schema class that validates payloads + +### Field Summary +| Modifier and Type | Field and Description | +| ----------------- | ---------------------- | +| Map> | properties = mapOf(
    "foo" to [Foo::class.java](#foo))
)
| +| Set | required = setOf(
    "foo"
)
| + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| String | validate(arg: String, configuration: SchemaConfiguration) | +| Nothing? | validate(arg: Nothing?, configuration: SchemaConfiguration) | +| int | validate(arg: int, configuration: SchemaConfiguration) | +| long | validate(arg: long, configuration: SchemaConfiguration) | +| float | validate(arg: float, configuration: SchemaConfiguration) | +| double | validate(arg: double, configuration: SchemaConfiguration) | +| Number | validate(arg: Number, configuration: SchemaConfiguration) | +| boolean | validate(arg: boolean, configuration: SchemaConfiguration) | +| [Schema1Map](#schema1map) | validate(arg: [Map<?, ?>](#schema1mapbuilder), configuration: SchemaConfiguration) | +| FrozenList | validate(arg: List<*>, configuration: SchemaConfiguration) | +| [Schema1BoxedString](#schema1boxedstring) | validateAndBox(String, configuration: SchemaConfiguration) | +| [Schema1BoxedVoid](#schema1boxedvoid) | validateAndBox(Nothing?, configuration: SchemaConfiguration) | +| [Schema1BoxedNumber](#schema1boxednumber) | validateAndBox(Number, configuration: SchemaConfiguration) | +| [Schema1BoxedBoolean](#schema1boxedboolean) | validateAndBox(boolean, configuration: SchemaConfiguration) | +| [Schema1BoxedMap](#schema1boxedmap) | validateAndBox([Map<?, ?>](#schema1mapbuilder), configuration: SchemaConfiguration) | +| [Schema1BoxedList](#schema1boxedlist) | validateAndBox(List<*>, configuration: SchemaConfiguration) | +| [Schema1Boxed](#schema1boxed) | validateAndBox(Any?, configuration: SchemaConfiguration) | +| Any? | validate(arg: Any?, configuration: SchemaConfiguration) | + +## Schema1Map0Builder +class Schema1Map0Builder
+builder for `Map` + +A class that builds the Map input type + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| Schema1Map0Builder(Map instance)
Creates a builder that contains the passed instance | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| Map | build()
Returns map input that should be used with Schema.validate | +| [Schema1Map0Builder](#schema1map0builder) | additionalProperty(key: String, value: Nothing?) | +| [Schema1Map0Builder](#schema1map0builder) | additionalProperty(key: String, value: Boolean) | +| [Schema1Map0Builder](#schema1map0builder) | additionalProperty(key: String, value: String) | +| [Schema1Map0Builder](#schema1map0builder) | additionalProperty(key: String, value: Int) | +| [Schema1Map0Builder](#schema1map0builder) | additionalProperty(key: String, value: Float) | +| [Schema1Map0Builder](#schema1map0builder) | additionalProperty(key: String, value: Long) | +| [Schema1Map0Builder](#schema1map0builder) | additionalProperty(key: String, value: Double) | +| [Schema1Map0Builder](#schema1map0builder) | additionalProperty(key: String, value: List) | +| [Schema1Map0Builder](#schema1map0builder) | additionalProperty(key: String, value: Map) | + +## Schema1MapBuilder +class Schema1MapBuilder
+builder for `Map` + +A class that builds the Map input type + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| Schema1MapBuilder()
Creates a builder that contains an empty map | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| [Schema1Map0Builder](#schema1map0builder) | foo(value: String) | + +## Schema1Map +class Schema1Map
+extends FrozenMap + +A class to store validated Map payloads + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| static [Schema1Map](#schema1map) | of([Map](#schema1mapbuilder) arg, SchemaConfiguration configuration) | +| String | foo()
| +| Any? | getAdditionalProperty(String name)
provides type safety for additional properties | + +## FooBoxed +sealed interface FooBoxed
+permits
+[FooBoxedString](#fooboxedstring) + +sealed interface that stores validated payloads using boxed classes + +## FooBoxedString +data class FooBoxedString
+implements [FooBoxed](#fooboxed) + +data class that stores validated String payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| FooBoxedString(String data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| String | data()
validated payload | +| Any? | getData()
validated payload | + +## Foo +class Foo
+extends StringJsonSchema.StringJsonSchema1 + +A schema class that validates payloads + +| Methods Inherited from class org.openapijsonschematools.client.schemas.StringJsonSchema.StringJsonSchema1 | +| ------------------------------------------------------------------ | +| validate | +| validateAndBox | + +## Schema0Boxed +sealed interface Schema0Boxed
+permits
+[Schema0BoxedVoid](#schema0boxedvoid), +[Schema0BoxedBoolean](#schema0boxedboolean), +[Schema0BoxedNumber](#schema0boxednumber), +[Schema0BoxedString](#schema0boxedstring), +[Schema0BoxedList](#schema0boxedlist), +[Schema0BoxedMap](#schema0boxedmap) + +sealed interface that stores validated payloads using boxed classes + +## Schema0BoxedVoid +data class Schema0BoxedVoid
+implements [Schema0Boxed](#schema0boxed) + +data class that stores validated null payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| Schema0BoxedVoid(Nothing? data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| Nothing? | data()
validated payload | +| Any? | getData()
validated payload | + +## Schema0BoxedBoolean +data class Schema0BoxedBoolean
+implements [Schema0Boxed](#schema0boxed) + +record that stores validated boolean payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| Schema0BoxedBoolean(boolean data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| boolean | data()
validated payload | +| Any? | getData()
validated payload | + +## Schema0BoxedNumber +data class Schema0BoxedNumber
+implements [Schema0Boxed](#schema0boxed) + +data class that stores validated Number payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| Schema0BoxedNumber(Number data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| Number | data()
validated payload | +| Any? | getData()
validated payload | + +## Schema0BoxedString +data class Schema0BoxedString
+implements [Schema0Boxed](#schema0boxed) + +data class that stores validated String payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| Schema0BoxedString(String data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| String | data()
validated payload | +| Any? | getData()
validated payload | + +## Schema0BoxedList +data class Schema0BoxedList
+implements [Schema0Boxed](#schema0boxed) + +data class that stores validated List payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| Schema0BoxedList(FrozenList data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| FrozenList | data()
validated payload | +| Any? | getData()
validated payload | + +## Schema0BoxedMap +data class Schema0BoxedMap
+implements [Schema0Boxed](#schema0boxed) + +data class that stores validated Map payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| Schema0BoxedMap([Schema0Map](#schema0map) data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| [Schema0Map](#schema0map) | data()
validated payload | +| Any? | getData()
validated payload | + +## Schema0 +class Schema0
+extends JsonSchema + +A schema class that validates payloads + +### Field Summary +| Modifier and Type | Field and Description | +| ----------------- | ---------------------- | +| Map> | properties = mapOf(
    "bar" to [Bar::class.java](#bar))
)
| +| Set | required = setOf(
    "bar"
)
| + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| String | validate(arg: String, configuration: SchemaConfiguration) | +| Nothing? | validate(arg: Nothing?, configuration: SchemaConfiguration) | +| int | validate(arg: int, configuration: SchemaConfiguration) | +| long | validate(arg: long, configuration: SchemaConfiguration) | +| float | validate(arg: float, configuration: SchemaConfiguration) | +| double | validate(arg: double, configuration: SchemaConfiguration) | +| Number | validate(arg: Number, configuration: SchemaConfiguration) | +| boolean | validate(arg: boolean, configuration: SchemaConfiguration) | +| [Schema0Map](#schema0map) | validate(arg: [Map<?, ?>](#schema0mapbuilder), configuration: SchemaConfiguration) | +| FrozenList | validate(arg: List<*>, configuration: SchemaConfiguration) | +| [Schema0BoxedString](#schema0boxedstring) | validateAndBox(String, configuration: SchemaConfiguration) | +| [Schema0BoxedVoid](#schema0boxedvoid) | validateAndBox(Nothing?, configuration: SchemaConfiguration) | +| [Schema0BoxedNumber](#schema0boxednumber) | validateAndBox(Number, configuration: SchemaConfiguration) | +| [Schema0BoxedBoolean](#schema0boxedboolean) | validateAndBox(boolean, configuration: SchemaConfiguration) | +| [Schema0BoxedMap](#schema0boxedmap) | validateAndBox([Map<?, ?>](#schema0mapbuilder), configuration: SchemaConfiguration) | +| [Schema0BoxedList](#schema0boxedlist) | validateAndBox(List<*>, configuration: SchemaConfiguration) | +| [Schema0Boxed](#schema0boxed) | validateAndBox(Any?, configuration: SchemaConfiguration) | +| Any? | validate(arg: Any?, configuration: SchemaConfiguration) | + +## Schema0Map0Builder +class Schema0Map0Builder
+builder for `Map` + +A class that builds the Map input type + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| Schema0Map0Builder(Map instance)
Creates a builder that contains the passed instance | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| Map | build()
Returns map input that should be used with Schema.validate | +| [Schema0Map0Builder](#schema0map0builder) | additionalProperty(key: String, value: Nothing?) | +| [Schema0Map0Builder](#schema0map0builder) | additionalProperty(key: String, value: Boolean) | +| [Schema0Map0Builder](#schema0map0builder) | additionalProperty(key: String, value: String) | +| [Schema0Map0Builder](#schema0map0builder) | additionalProperty(key: String, value: Int) | +| [Schema0Map0Builder](#schema0map0builder) | additionalProperty(key: String, value: Float) | +| [Schema0Map0Builder](#schema0map0builder) | additionalProperty(key: String, value: Long) | +| [Schema0Map0Builder](#schema0map0builder) | additionalProperty(key: String, value: Double) | +| [Schema0Map0Builder](#schema0map0builder) | additionalProperty(key: String, value: List) | +| [Schema0Map0Builder](#schema0map0builder) | additionalProperty(key: String, value: Map) | + +## Schema0MapBuilder +class Schema0MapBuilder
+builder for `Map` + +A class that builds the Map input type + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| Schema0MapBuilder()
Creates a builder that contains an empty map | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| [Schema0Map0Builder](#schema0map0builder) | bar(value: Int) | +| [Schema0Map0Builder](#schema0map0builder) | bar(value: Float) | +| [Schema0Map0Builder](#schema0map0builder) | bar(value: Long) | +| [Schema0Map0Builder](#schema0map0builder) | bar(value: Double) | + +## Schema0Map +class Schema0Map
+extends FrozenMap + +A class to store validated Map payloads + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| static [Schema0Map](#schema0map) | of([Map](#schema0mapbuilder) arg, SchemaConfiguration configuration) | +| Number | bar()
| +| Any? | getAdditionalProperty(String name)
provides type safety for additional properties | + +## BarBoxed +sealed interface BarBoxed
+permits
+[BarBoxedNumber](#barboxednumber) + +sealed interface that stores validated payloads using boxed classes + +## BarBoxedNumber +data class BarBoxedNumber
+implements [BarBoxed](#barboxed) + +data class that stores validated Number payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| BarBoxedNumber(Number data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| Number | data()
validated payload | +| Any? | getData()
validated payload | + +## Bar +class Bar
+extends IntJsonSchema.IntJsonSchema1 + +A schema class that validates payloads + +| Methods Inherited from class org.openapijsonschematools.client.schemas.IntJsonSchema.IntJsonSchema1 | +| ------------------------------------------------------------------ | +| validate | +| validateAndBox | + +[[Back to top]](#top) [[Back to Component Schemas]](../../../README.md#Component-Schemas) [[Back to README]](../../../README.md) diff --git a/samples/client/3_0_3_unit_test/kotlin/docs/components/schemas/OneofWithBaseSchema.md b/samples/client/3_0_3_unit_test/kotlin/docs/components/schemas/OneofWithBaseSchema.md new file mode 100644 index 00000000000..ec2efa5bd7a --- /dev/null +++ b/samples/client/3_0_3_unit_test/kotlin/docs/components/schemas/OneofWithBaseSchema.md @@ -0,0 +1,394 @@ +# OneofWithBaseSchema +org.openapijsonschematools.client.components.schemas.OneofWithBaseSchema.java +class OneofWithBaseSchema
+ +A class that contains necessary nested +- schema classes (which validate payloads), extends JsonSchema +- sealed interfaces which store validated payloads, Kotlin version of a sum type +- boxed classes which store validated payloads, sealed permits class implementations + +## Nested Class Summary +| Modifier and Type | Class and Description | +| ----------------- | ---------------------- | +| sealed interface | [OneofWithBaseSchema.OneofWithBaseSchema1Boxed](#oneofwithbaseschema1boxed)
sealed interface for validated payloads | +| record | [OneofWithBaseSchema.OneofWithBaseSchema1BoxedString](#oneofwithbaseschema1boxedstring)
boxed class to store validated String payloads | +| static class | [OneofWithBaseSchema.OneofWithBaseSchema1](#oneofwithbaseschema1)
schema class | +| sealed interface | [OneofWithBaseSchema.Schema1Boxed](#schema1boxed)
sealed interface for validated payloads | +| record | [OneofWithBaseSchema.Schema1BoxedVoid](#schema1boxedvoid)
boxed class to store validated null payloads | +| record | [OneofWithBaseSchema.Schema1BoxedBoolean](#schema1boxedboolean)
boxed class to store validated boolean payloads | +| record | [OneofWithBaseSchema.Schema1BoxedNumber](#schema1boxednumber)
boxed class to store validated Number payloads | +| record | [OneofWithBaseSchema.Schema1BoxedString](#schema1boxedstring)
boxed class to store validated String payloads | +| record | [OneofWithBaseSchema.Schema1BoxedList](#schema1boxedlist)
boxed class to store validated List payloads | +| record | [OneofWithBaseSchema.Schema1BoxedMap](#schema1boxedmap)
boxed class to store validated Map payloads | +| static class | [OneofWithBaseSchema.Schema1](#schema1)
schema class | +| sealed interface | [OneofWithBaseSchema.Schema0Boxed](#schema0boxed)
sealed interface for validated payloads | +| record | [OneofWithBaseSchema.Schema0BoxedVoid](#schema0boxedvoid)
boxed class to store validated null payloads | +| record | [OneofWithBaseSchema.Schema0BoxedBoolean](#schema0boxedboolean)
boxed class to store validated boolean payloads | +| record | [OneofWithBaseSchema.Schema0BoxedNumber](#schema0boxednumber)
boxed class to store validated Number payloads | +| record | [OneofWithBaseSchema.Schema0BoxedString](#schema0boxedstring)
boxed class to store validated String payloads | +| record | [OneofWithBaseSchema.Schema0BoxedList](#schema0boxedlist)
boxed class to store validated List payloads | +| record | [OneofWithBaseSchema.Schema0BoxedMap](#schema0boxedmap)
boxed class to store validated Map payloads | +| static class | [OneofWithBaseSchema.Schema0](#schema0)
schema class | + +## OneofWithBaseSchema1Boxed +sealed interface OneofWithBaseSchema1Boxed
+permits
+[OneofWithBaseSchema1BoxedString](#oneofwithbaseschema1boxedstring) + +sealed interface that stores validated payloads using boxed classes + +## OneofWithBaseSchema1BoxedString +data class OneofWithBaseSchema1BoxedString
+implements [OneofWithBaseSchema1Boxed](#oneofwithbaseschema1boxed) + +data class that stores validated String payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| OneofWithBaseSchema1BoxedString(String data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| String | data()
validated payload | +| Any? | getData()
validated payload | + +## OneofWithBaseSchema1 +class OneofWithBaseSchema1
+extends JsonSchema + +A schema class that validates payloads + +### Code Sample +``` +import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags; +import org.openapijsonschematools.client.configurations.SchemaConfiguration; +import org.openapijsonschematools.client.exceptions.ValidationException; +import org.openapijsonschematools.client.schemas.validation.MapUtils; +import org.openapijsonschematools.client.schemas.validation.FrozenList; +import org.openapijsonschematools.client.schemas.validation.FrozenMap; +import org.openapijsonschematools.client.components.schemas.OneofWithBaseSchema; + +import java.util.Arrays; +import java.util.List; +import java.util.AbstractMap; + +static final SchemaConfiguration configuration = new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().build()); + +// String validation +String validatedPayload = OneofWithBaseSchema.OneofWithBaseSchema1.validate( + "a", + configuration +); +``` + +### Field Summary +| Modifier and Type | Field and Description | +| ----------------- | ---------------------- | +| Set> | type = setOf(
    String::class.java
)
| +| List> | oneOf = listOf(
    [Schema0::class.java](#schema0),
    [Schema1::class.java](#schema1)
))
| + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| String | validate(arg: String, configuration: SchemaConfiguration) | +| [OneofWithBaseSchema1BoxedString](#oneofwithbaseschema1boxedstring) | validateAndBox(String, configuration: SchemaConfiguration) | +| [OneofWithBaseSchema1Boxed](#oneofwithbaseschema1boxed) | validateAndBox(Any?, configuration: SchemaConfiguration) | +| Any? | validate(arg: Any?, configuration: SchemaConfiguration) | + +## Schema1Boxed +sealed interface Schema1Boxed
+permits
+[Schema1BoxedVoid](#schema1boxedvoid), +[Schema1BoxedBoolean](#schema1boxedboolean), +[Schema1BoxedNumber](#schema1boxednumber), +[Schema1BoxedString](#schema1boxedstring), +[Schema1BoxedList](#schema1boxedlist), +[Schema1BoxedMap](#schema1boxedmap) + +sealed interface that stores validated payloads using boxed classes + +## Schema1BoxedVoid +data class Schema1BoxedVoid
+implements [Schema1Boxed](#schema1boxed) + +data class that stores validated null payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| Schema1BoxedVoid(Nothing? data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| Nothing? | data()
validated payload | +| Any? | getData()
validated payload | + +## Schema1BoxedBoolean +data class Schema1BoxedBoolean
+implements [Schema1Boxed](#schema1boxed) + +record that stores validated boolean payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| Schema1BoxedBoolean(boolean data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| boolean | data()
validated payload | +| Any? | getData()
validated payload | + +## Schema1BoxedNumber +data class Schema1BoxedNumber
+implements [Schema1Boxed](#schema1boxed) + +data class that stores validated Number payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| Schema1BoxedNumber(Number data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| Number | data()
validated payload | +| Any? | getData()
validated payload | + +## Schema1BoxedString +data class Schema1BoxedString
+implements [Schema1Boxed](#schema1boxed) + +data class that stores validated String payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| Schema1BoxedString(String data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| String | data()
validated payload | +| Any? | getData()
validated payload | + +## Schema1BoxedList +data class Schema1BoxedList
+implements [Schema1Boxed](#schema1boxed) + +data class that stores validated List payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| Schema1BoxedList(FrozenList data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| FrozenList | data()
validated payload | +| Any? | getData()
validated payload | + +## Schema1BoxedMap +data class Schema1BoxedMap
+implements [Schema1Boxed](#schema1boxed) + +data class that stores validated Map payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| Schema1BoxedMap(FrozenMap data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| FrozenMap | data()
validated payload | +| Any? | getData()
validated payload | + +## Schema1 +class Schema1
+extends JsonSchema + +A schema class that validates payloads + +### Field Summary +| Modifier and Type | Field and Description | +| ----------------- | ---------------------- | +| Integer | maxLength = 4 | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| String | validate(arg: String, configuration: SchemaConfiguration) | +| Nothing? | validate(arg: Nothing?, configuration: SchemaConfiguration) | +| int | validate(arg: int, configuration: SchemaConfiguration) | +| long | validate(arg: long, configuration: SchemaConfiguration) | +| float | validate(arg: float, configuration: SchemaConfiguration) | +| double | validate(arg: double, configuration: SchemaConfiguration) | +| Number | validate(arg: Number, configuration: SchemaConfiguration) | +| boolean | validate(arg: boolean, configuration: SchemaConfiguration) | +| FrozenMap | validate(arg: Map<?, ?>, configuration: SchemaConfiguration) | +| FrozenList | validate(arg: List<*>, configuration: SchemaConfiguration) | +| [Schema1BoxedString](#schema1boxedstring) | validateAndBox(String, configuration: SchemaConfiguration) | +| [Schema1BoxedVoid](#schema1boxedvoid) | validateAndBox(Nothing?, configuration: SchemaConfiguration) | +| [Schema1BoxedNumber](#schema1boxednumber) | validateAndBox(Number, configuration: SchemaConfiguration) | +| [Schema1BoxedBoolean](#schema1boxedboolean) | validateAndBox(boolean, configuration: SchemaConfiguration) | +| [Schema1BoxedMap](#schema1boxedmap) | validateAndBox(Map<?, ?>, configuration: SchemaConfiguration) | +| [Schema1BoxedList](#schema1boxedlist) | validateAndBox(List<*>, configuration: SchemaConfiguration) | +| [Schema1Boxed](#schema1boxed) | validateAndBox(Any?, configuration: SchemaConfiguration) | +| Any? | validate(arg: Any?, configuration: SchemaConfiguration) | + +## Schema0Boxed +sealed interface Schema0Boxed
+permits
+[Schema0BoxedVoid](#schema0boxedvoid), +[Schema0BoxedBoolean](#schema0boxedboolean), +[Schema0BoxedNumber](#schema0boxednumber), +[Schema0BoxedString](#schema0boxedstring), +[Schema0BoxedList](#schema0boxedlist), +[Schema0BoxedMap](#schema0boxedmap) + +sealed interface that stores validated payloads using boxed classes + +## Schema0BoxedVoid +data class Schema0BoxedVoid
+implements [Schema0Boxed](#schema0boxed) + +data class that stores validated null payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| Schema0BoxedVoid(Nothing? data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| Nothing? | data()
validated payload | +| Any? | getData()
validated payload | + +## Schema0BoxedBoolean +data class Schema0BoxedBoolean
+implements [Schema0Boxed](#schema0boxed) + +record that stores validated boolean payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| Schema0BoxedBoolean(boolean data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| boolean | data()
validated payload | +| Any? | getData()
validated payload | + +## Schema0BoxedNumber +data class Schema0BoxedNumber
+implements [Schema0Boxed](#schema0boxed) + +data class that stores validated Number payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| Schema0BoxedNumber(Number data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| Number | data()
validated payload | +| Any? | getData()
validated payload | + +## Schema0BoxedString +data class Schema0BoxedString
+implements [Schema0Boxed](#schema0boxed) + +data class that stores validated String payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| Schema0BoxedString(String data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| String | data()
validated payload | +| Any? | getData()
validated payload | + +## Schema0BoxedList +data class Schema0BoxedList
+implements [Schema0Boxed](#schema0boxed) + +data class that stores validated List payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| Schema0BoxedList(FrozenList data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| FrozenList | data()
validated payload | +| Any? | getData()
validated payload | + +## Schema0BoxedMap +data class Schema0BoxedMap
+implements [Schema0Boxed](#schema0boxed) + +data class that stores validated Map payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| Schema0BoxedMap(FrozenMap data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| FrozenMap | data()
validated payload | +| Any? | getData()
validated payload | + +## Schema0 +class Schema0
+extends JsonSchema + +A schema class that validates payloads + +### Field Summary +| Modifier and Type | Field and Description | +| ----------------- | ---------------------- | +| Integer | minLength = 2 | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| String | validate(arg: String, configuration: SchemaConfiguration) | +| Nothing? | validate(arg: Nothing?, configuration: SchemaConfiguration) | +| int | validate(arg: int, configuration: SchemaConfiguration) | +| long | validate(arg: long, configuration: SchemaConfiguration) | +| float | validate(arg: float, configuration: SchemaConfiguration) | +| double | validate(arg: double, configuration: SchemaConfiguration) | +| Number | validate(arg: Number, configuration: SchemaConfiguration) | +| boolean | validate(arg: boolean, configuration: SchemaConfiguration) | +| FrozenMap | validate(arg: Map<?, ?>, configuration: SchemaConfiguration) | +| FrozenList | validate(arg: List<*>, configuration: SchemaConfiguration) | +| [Schema0BoxedString](#schema0boxedstring) | validateAndBox(String, configuration: SchemaConfiguration) | +| [Schema0BoxedVoid](#schema0boxedvoid) | validateAndBox(Nothing?, configuration: SchemaConfiguration) | +| [Schema0BoxedNumber](#schema0boxednumber) | validateAndBox(Number, configuration: SchemaConfiguration) | +| [Schema0BoxedBoolean](#schema0boxedboolean) | validateAndBox(boolean, configuration: SchemaConfiguration) | +| [Schema0BoxedMap](#schema0boxedmap) | validateAndBox(Map<?, ?>, configuration: SchemaConfiguration) | +| [Schema0BoxedList](#schema0boxedlist) | validateAndBox(List<*>, configuration: SchemaConfiguration) | +| [Schema0Boxed](#schema0boxed) | validateAndBox(Any?, configuration: SchemaConfiguration) | +| Any? | validate(arg: Any?, configuration: SchemaConfiguration) | + +[[Back to top]](#top) [[Back to Component Schemas]](../../../README.md#Component-Schemas) [[Back to README]](../../../README.md) diff --git a/samples/client/3_0_3_unit_test/kotlin/docs/components/schemas/OneofWithEmptySchema.md b/samples/client/3_0_3_unit_test/kotlin/docs/components/schemas/OneofWithEmptySchema.md new file mode 100644 index 00000000000..3c41a98cb37 --- /dev/null +++ b/samples/client/3_0_3_unit_test/kotlin/docs/components/schemas/OneofWithEmptySchema.md @@ -0,0 +1,340 @@ +# OneofWithEmptySchema +org.openapijsonschematools.client.components.schemas.OneofWithEmptySchema.java +class OneofWithEmptySchema
+ +A class that contains necessary nested +- schema classes (which validate payloads), extends JsonSchema +- sealed interfaces which store validated payloads, Kotlin version of a sum type +- boxed classes which store validated payloads, sealed permits class implementations + +## Nested Class Summary +| Modifier and Type | Class and Description | +| ----------------- | ---------------------- | +| sealed interface | [OneofWithEmptySchema.OneofWithEmptySchema1Boxed](#oneofwithemptyschema1boxed)
sealed interface for validated payloads | +| record | [OneofWithEmptySchema.OneofWithEmptySchema1BoxedVoid](#oneofwithemptyschema1boxedvoid)
boxed class to store validated null payloads | +| record | [OneofWithEmptySchema.OneofWithEmptySchema1BoxedBoolean](#oneofwithemptyschema1boxedboolean)
boxed class to store validated boolean payloads | +| record | [OneofWithEmptySchema.OneofWithEmptySchema1BoxedNumber](#oneofwithemptyschema1boxednumber)
boxed class to store validated Number payloads | +| record | [OneofWithEmptySchema.OneofWithEmptySchema1BoxedString](#oneofwithemptyschema1boxedstring)
boxed class to store validated String payloads | +| record | [OneofWithEmptySchema.OneofWithEmptySchema1BoxedList](#oneofwithemptyschema1boxedlist)
boxed class to store validated List payloads | +| record | [OneofWithEmptySchema.OneofWithEmptySchema1BoxedMap](#oneofwithemptyschema1boxedmap)
boxed class to store validated Map payloads | +| static class | [OneofWithEmptySchema.OneofWithEmptySchema1](#oneofwithemptyschema1)
schema class | +| sealed interface | [OneofWithEmptySchema.Schema1Boxed](#schema1boxed)
sealed interface for validated payloads | +| record | [OneofWithEmptySchema.Schema1BoxedVoid](#schema1boxedvoid)
boxed class to store validated null payloads | +| record | [OneofWithEmptySchema.Schema1BoxedBoolean](#schema1boxedboolean)
boxed class to store validated boolean payloads | +| record | [OneofWithEmptySchema.Schema1BoxedNumber](#schema1boxednumber)
boxed class to store validated Number payloads | +| record | [OneofWithEmptySchema.Schema1BoxedString](#schema1boxedstring)
boxed class to store validated String payloads | +| record | [OneofWithEmptySchema.Schema1BoxedList](#schema1boxedlist)
boxed class to store validated List payloads | +| record | [OneofWithEmptySchema.Schema1BoxedMap](#schema1boxedmap)
boxed class to store validated Map payloads | +| static class | [OneofWithEmptySchema.Schema1](#schema1)
schema class | +| sealed interface | [OneofWithEmptySchema.Schema0Boxed](#schema0boxed)
sealed interface for validated payloads | +| record | [OneofWithEmptySchema.Schema0BoxedNumber](#schema0boxednumber)
boxed class to store validated Number payloads | +| static class | [OneofWithEmptySchema.Schema0](#schema0)
schema class | + +## OneofWithEmptySchema1Boxed +sealed interface OneofWithEmptySchema1Boxed
+permits
+[OneofWithEmptySchema1BoxedVoid](#oneofwithemptyschema1boxedvoid), +[OneofWithEmptySchema1BoxedBoolean](#oneofwithemptyschema1boxedboolean), +[OneofWithEmptySchema1BoxedNumber](#oneofwithemptyschema1boxednumber), +[OneofWithEmptySchema1BoxedString](#oneofwithemptyschema1boxedstring), +[OneofWithEmptySchema1BoxedList](#oneofwithemptyschema1boxedlist), +[OneofWithEmptySchema1BoxedMap](#oneofwithemptyschema1boxedmap) + +sealed interface that stores validated payloads using boxed classes + +## OneofWithEmptySchema1BoxedVoid +data class OneofWithEmptySchema1BoxedVoid
+implements [OneofWithEmptySchema1Boxed](#oneofwithemptyschema1boxed) + +data class that stores validated null payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| OneofWithEmptySchema1BoxedVoid(Nothing? data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| Nothing? | data()
validated payload | +| Any? | getData()
validated payload | + +## OneofWithEmptySchema1BoxedBoolean +data class OneofWithEmptySchema1BoxedBoolean
+implements [OneofWithEmptySchema1Boxed](#oneofwithemptyschema1boxed) + +record that stores validated boolean payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| OneofWithEmptySchema1BoxedBoolean(boolean data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| boolean | data()
validated payload | +| Any? | getData()
validated payload | + +## OneofWithEmptySchema1BoxedNumber +data class OneofWithEmptySchema1BoxedNumber
+implements [OneofWithEmptySchema1Boxed](#oneofwithemptyschema1boxed) + +data class that stores validated Number payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| OneofWithEmptySchema1BoxedNumber(Number data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| Number | data()
validated payload | +| Any? | getData()
validated payload | + +## OneofWithEmptySchema1BoxedString +data class OneofWithEmptySchema1BoxedString
+implements [OneofWithEmptySchema1Boxed](#oneofwithemptyschema1boxed) + +data class that stores validated String payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| OneofWithEmptySchema1BoxedString(String data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| String | data()
validated payload | +| Any? | getData()
validated payload | + +## OneofWithEmptySchema1BoxedList +data class OneofWithEmptySchema1BoxedList
+implements [OneofWithEmptySchema1Boxed](#oneofwithemptyschema1boxed) + +data class that stores validated List payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| OneofWithEmptySchema1BoxedList(FrozenList data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| FrozenList | data()
validated payload | +| Any? | getData()
validated payload | + +## OneofWithEmptySchema1BoxedMap +data class OneofWithEmptySchema1BoxedMap
+implements [OneofWithEmptySchema1Boxed](#oneofwithemptyschema1boxed) + +data class that stores validated Map payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| OneofWithEmptySchema1BoxedMap(FrozenMap data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| FrozenMap | data()
validated payload | +| Any? | getData()
validated payload | + +## OneofWithEmptySchema1 +class OneofWithEmptySchema1
+extends JsonSchema + +A schema class that validates payloads + +### Field Summary +| Modifier and Type | Field and Description | +| ----------------- | ---------------------- | +| List> | oneOf = listOf(
    [Schema0::class.java](#schema0),
    [Schema1::class.java](#schema1)
))
| + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| String | validate(arg: String, configuration: SchemaConfiguration) | +| Nothing? | validate(arg: Nothing?, configuration: SchemaConfiguration) | +| int | validate(arg: int, configuration: SchemaConfiguration) | +| long | validate(arg: long, configuration: SchemaConfiguration) | +| float | validate(arg: float, configuration: SchemaConfiguration) | +| double | validate(arg: double, configuration: SchemaConfiguration) | +| Number | validate(arg: Number, configuration: SchemaConfiguration) | +| boolean | validate(arg: boolean, configuration: SchemaConfiguration) | +| FrozenMap | validate(arg: Map<?, ?>, configuration: SchemaConfiguration) | +| FrozenList | validate(arg: List<*>, configuration: SchemaConfiguration) | +| [OneofWithEmptySchema1BoxedString](#oneofwithemptyschema1boxedstring) | validateAndBox(String, configuration: SchemaConfiguration) | +| [OneofWithEmptySchema1BoxedVoid](#oneofwithemptyschema1boxedvoid) | validateAndBox(Nothing?, configuration: SchemaConfiguration) | +| [OneofWithEmptySchema1BoxedNumber](#oneofwithemptyschema1boxednumber) | validateAndBox(Number, configuration: SchemaConfiguration) | +| [OneofWithEmptySchema1BoxedBoolean](#oneofwithemptyschema1boxedboolean) | validateAndBox(boolean, configuration: SchemaConfiguration) | +| [OneofWithEmptySchema1BoxedMap](#oneofwithemptyschema1boxedmap) | validateAndBox(Map<?, ?>, configuration: SchemaConfiguration) | +| [OneofWithEmptySchema1BoxedList](#oneofwithemptyschema1boxedlist) | validateAndBox(List<*>, configuration: SchemaConfiguration) | +| [OneofWithEmptySchema1Boxed](#oneofwithemptyschema1boxed) | validateAndBox(Any?, configuration: SchemaConfiguration) | +| Any? | validate(arg: Any?, configuration: SchemaConfiguration) | + +## Schema1Boxed +sealed interface Schema1Boxed
+permits
+[Schema1BoxedVoid](#schema1boxedvoid), +[Schema1BoxedBoolean](#schema1boxedboolean), +[Schema1BoxedNumber](#schema1boxednumber), +[Schema1BoxedString](#schema1boxedstring), +[Schema1BoxedList](#schema1boxedlist), +[Schema1BoxedMap](#schema1boxedmap) + +sealed interface that stores validated payloads using boxed classes + +## Schema1BoxedVoid +data class Schema1BoxedVoid
+implements [Schema1Boxed](#schema1boxed) + +data class that stores validated null payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| Schema1BoxedVoid(Nothing? data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| Nothing? | data()
validated payload | +| Any? | getData()
validated payload | + +## Schema1BoxedBoolean +data class Schema1BoxedBoolean
+implements [Schema1Boxed](#schema1boxed) + +record that stores validated boolean payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| Schema1BoxedBoolean(boolean data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| boolean | data()
validated payload | +| Any? | getData()
validated payload | + +## Schema1BoxedNumber +data class Schema1BoxedNumber
+implements [Schema1Boxed](#schema1boxed) + +data class that stores validated Number payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| Schema1BoxedNumber(Number data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| Number | data()
validated payload | +| Any? | getData()
validated payload | + +## Schema1BoxedString +data class Schema1BoxedString
+implements [Schema1Boxed](#schema1boxed) + +data class that stores validated String payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| Schema1BoxedString(String data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| String | data()
validated payload | +| Any? | getData()
validated payload | + +## Schema1BoxedList +data class Schema1BoxedList
+implements [Schema1Boxed](#schema1boxed) + +data class that stores validated List payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| Schema1BoxedList(FrozenList data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| FrozenList | data()
validated payload | +| Any? | getData()
validated payload | + +## Schema1BoxedMap +data class Schema1BoxedMap
+implements [Schema1Boxed](#schema1boxed) + +data class that stores validated Map payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| Schema1BoxedMap(FrozenMap data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| FrozenMap | data()
validated payload | +| Any? | getData()
validated payload | + +## Schema1 +class Schema1
+extends AnyTypeJsonSchema.AnyTypeJsonSchema1 + +A schema class that validates payloads + +| Methods Inherited from class org.openapijsonschematools.client.schemas.AnyTypeJsonSchema.AnyTypeJsonSchema1 | +| ------------------------------------------------------------------ | +| validate | +| validateAndBox | + +## Schema0Boxed +sealed interface Schema0Boxed
+permits
+[Schema0BoxedNumber](#schema0boxednumber) + +sealed interface that stores validated payloads using boxed classes + +## Schema0BoxedNumber +data class Schema0BoxedNumber
+implements [Schema0Boxed](#schema0boxed) + +data class that stores validated Number payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| Schema0BoxedNumber(Number data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| Number | data()
validated payload | +| Any? | getData()
validated payload | + +## Schema0 +class Schema0
+extends NumberJsonSchema.NumberJsonSchema1 + +A schema class that validates payloads + +| Methods Inherited from class org.openapijsonschematools.client.schemas.NumberJsonSchema.NumberJsonSchema1 | +| ------------------------------------------------------------------ | +| validate | +| validateAndBox | + +[[Back to top]](#top) [[Back to Component Schemas]](../../../README.md#Component-Schemas) [[Back to README]](../../../README.md) diff --git a/samples/client/3_0_3_unit_test/kotlin/docs/components/schemas/OneofWithRequired.md b/samples/client/3_0_3_unit_test/kotlin/docs/components/schemas/OneofWithRequired.md new file mode 100644 index 00000000000..5fb44f316d2 --- /dev/null +++ b/samples/client/3_0_3_unit_test/kotlin/docs/components/schemas/OneofWithRequired.md @@ -0,0 +1,617 @@ +# OneofWithRequired +org.openapijsonschematools.client.components.schemas.OneofWithRequired.java +class OneofWithRequired
+ +A class that contains necessary nested +- schema classes (which validate payloads), extends JsonSchema +- sealed interfaces which store validated payloads, Kotlin version of a sum type +- boxed classes which store validated payloads, sealed permits class implementations +- classes to store validated map payloads, extends FrozenMap +- classes to build inputs for map payloads + +## Nested Class Summary +| Modifier and Type | Class and Description | +| ----------------- | ---------------------- | +| sealed interface | [OneofWithRequired.OneofWithRequired1Boxed](#oneofwithrequired1boxed)
sealed interface for validated payloads | +| record | [OneofWithRequired.OneofWithRequired1BoxedMap](#oneofwithrequired1boxedmap)
boxed class to store validated Map payloads | +| static class | [OneofWithRequired.OneofWithRequired1](#oneofwithrequired1)
schema class | +| sealed interface | [OneofWithRequired.Schema1Boxed](#schema1boxed)
sealed interface for validated payloads | +| record | [OneofWithRequired.Schema1BoxedVoid](#schema1boxedvoid)
boxed class to store validated null payloads | +| record | [OneofWithRequired.Schema1BoxedBoolean](#schema1boxedboolean)
boxed class to store validated boolean payloads | +| record | [OneofWithRequired.Schema1BoxedNumber](#schema1boxednumber)
boxed class to store validated Number payloads | +| record | [OneofWithRequired.Schema1BoxedString](#schema1boxedstring)
boxed class to store validated String payloads | +| record | [OneofWithRequired.Schema1BoxedList](#schema1boxedlist)
boxed class to store validated List payloads | +| record | [OneofWithRequired.Schema1BoxedMap](#schema1boxedmap)
boxed class to store validated Map payloads | +| static class | [OneofWithRequired.Schema1](#schema1)
schema class | +| static class | [OneofWithRequired.Schema1MapBuilder](#schema1mapbuilder)
builder for Map payloads | +| static class | [OneofWithRequired.Schema1Map](#schema1map)
output class for Map payloads | +| sealed interface | [OneofWithRequired.Schema0Boxed](#schema0boxed)
sealed interface for validated payloads | +| record | [OneofWithRequired.Schema0BoxedVoid](#schema0boxedvoid)
boxed class to store validated null payloads | +| record | [OneofWithRequired.Schema0BoxedBoolean](#schema0boxedboolean)
boxed class to store validated boolean payloads | +| record | [OneofWithRequired.Schema0BoxedNumber](#schema0boxednumber)
boxed class to store validated Number payloads | +| record | [OneofWithRequired.Schema0BoxedString](#schema0boxedstring)
boxed class to store validated String payloads | +| record | [OneofWithRequired.Schema0BoxedList](#schema0boxedlist)
boxed class to store validated List payloads | +| record | [OneofWithRequired.Schema0BoxedMap](#schema0boxedmap)
boxed class to store validated Map payloads | +| static class | [OneofWithRequired.Schema0](#schema0)
schema class | +| static class | [OneofWithRequired.Schema0MapBuilder](#schema0mapbuilder)
builder for Map payloads | +| static class | [OneofWithRequired.Schema0Map](#schema0map)
output class for Map payloads | + +## OneofWithRequired1Boxed +sealed interface OneofWithRequired1Boxed
+permits
+[OneofWithRequired1BoxedMap](#oneofwithrequired1boxedmap) + +sealed interface that stores validated payloads using boxed classes + +## OneofWithRequired1BoxedMap +data class OneofWithRequired1BoxedMap
+implements [OneofWithRequired1Boxed](#oneofwithrequired1boxed) + +data class that stores validated Map payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| OneofWithRequired1BoxedMap(FrozenMap data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| FrozenMap | data()
validated payload | +| Any? | getData()
validated payload | + +## OneofWithRequired1 +class OneofWithRequired1
+extends JsonSchema + +A schema class that validates payloads + +### Field Summary +| Modifier and Type | Field and Description | +| ----------------- | ---------------------- | +| Set> | type = setOf(Map::class.java) | +| List> | oneOf = listOf(
    [Schema0::class.java](#schema0),
    [Schema1::class.java](#schema1)
))
| + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| FrozenMap | validate(arg: Map<?, ?>, configuration: SchemaConfiguration) | +| [OneofWithRequired1BoxedMap](#oneofwithrequired1boxedmap) | validateAndBox(Map<?, ?>, configuration: SchemaConfiguration) | +| [OneofWithRequired1Boxed](#oneofwithrequired1boxed) | validateAndBox(Any?, configuration: SchemaConfiguration) | +| Any? | validate(arg: Any?, configuration: SchemaConfiguration) | + +## Schema1Boxed +sealed interface Schema1Boxed
+permits
+[Schema1BoxedVoid](#schema1boxedvoid), +[Schema1BoxedBoolean](#schema1boxedboolean), +[Schema1BoxedNumber](#schema1boxednumber), +[Schema1BoxedString](#schema1boxedstring), +[Schema1BoxedList](#schema1boxedlist), +[Schema1BoxedMap](#schema1boxedmap) + +sealed interface that stores validated payloads using boxed classes + +## Schema1BoxedVoid +data class Schema1BoxedVoid
+implements [Schema1Boxed](#schema1boxed) + +data class that stores validated null payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| Schema1BoxedVoid(Nothing? data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| Nothing? | data()
validated payload | +| Any? | getData()
validated payload | + +## Schema1BoxedBoolean +data class Schema1BoxedBoolean
+implements [Schema1Boxed](#schema1boxed) + +record that stores validated boolean payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| Schema1BoxedBoolean(boolean data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| boolean | data()
validated payload | +| Any? | getData()
validated payload | + +## Schema1BoxedNumber +data class Schema1BoxedNumber
+implements [Schema1Boxed](#schema1boxed) + +data class that stores validated Number payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| Schema1BoxedNumber(Number data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| Number | data()
validated payload | +| Any? | getData()
validated payload | + +## Schema1BoxedString +data class Schema1BoxedString
+implements [Schema1Boxed](#schema1boxed) + +data class that stores validated String payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| Schema1BoxedString(String data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| String | data()
validated payload | +| Any? | getData()
validated payload | + +## Schema1BoxedList +data class Schema1BoxedList
+implements [Schema1Boxed](#schema1boxed) + +data class that stores validated List payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| Schema1BoxedList(FrozenList data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| FrozenList | data()
validated payload | +| Any? | getData()
validated payload | + +## Schema1BoxedMap +data class Schema1BoxedMap
+implements [Schema1Boxed](#schema1boxed) + +data class that stores validated Map payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| Schema1BoxedMap([Schema1Map](#schema1map) data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| [Schema1Map](#schema1map) | data()
validated payload | +| Any? | getData()
validated payload | + +## Schema1 +class Schema1
+extends JsonSchema + +A schema class that validates payloads + +### Field Summary +| Modifier and Type | Field and Description | +| ----------------- | ---------------------- | +| Set | required = setOf(
    "baz",
    "foo"
)
| + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| String | validate(arg: String, configuration: SchemaConfiguration) | +| Nothing? | validate(arg: Nothing?, configuration: SchemaConfiguration) | +| int | validate(arg: int, configuration: SchemaConfiguration) | +| long | validate(arg: long, configuration: SchemaConfiguration) | +| float | validate(arg: float, configuration: SchemaConfiguration) | +| double | validate(arg: double, configuration: SchemaConfiguration) | +| Number | validate(arg: Number, configuration: SchemaConfiguration) | +| boolean | validate(arg: boolean, configuration: SchemaConfiguration) | +| [Schema1Map](#schema1map) | validate(arg: [Map<?, ?>](#schema1mapbuilder), configuration: SchemaConfiguration) | +| FrozenList | validate(arg: List<*>, configuration: SchemaConfiguration) | +| [Schema1BoxedString](#schema1boxedstring) | validateAndBox(String, configuration: SchemaConfiguration) | +| [Schema1BoxedVoid](#schema1boxedvoid) | validateAndBox(Nothing?, configuration: SchemaConfiguration) | +| [Schema1BoxedNumber](#schema1boxednumber) | validateAndBox(Number, configuration: SchemaConfiguration) | +| [Schema1BoxedBoolean](#schema1boxedboolean) | validateAndBox(boolean, configuration: SchemaConfiguration) | +| [Schema1BoxedMap](#schema1boxedmap) | validateAndBox([Map<?, ?>](#schema1mapbuilder), configuration: SchemaConfiguration) | +| [Schema1BoxedList](#schema1boxedlist) | validateAndBox(List<*>, configuration: SchemaConfiguration) | +| [Schema1Boxed](#schema1boxed) | validateAndBox(Any?, configuration: SchemaConfiguration) | +| Any? | validate(arg: Any?, configuration: SchemaConfiguration) | + +## Schema1Map00Builder +class Schema1Map00Builder
+builder for `Map` + +A class that builds the Map input type + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| Schema1Map00Builder(Map instance)
Creates a builder that contains the passed instance | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| Map | build()
Returns map input that should be used with Schema.validate | +| [Schema1Map00Builder](#schema1map00builder) | additionalProperty(key: String, value: Nothing?) | +| [Schema1Map00Builder](#schema1map00builder) | additionalProperty(key: String, value: Boolean) | +| [Schema1Map00Builder](#schema1map00builder) | additionalProperty(key: String, value: String) | +| [Schema1Map00Builder](#schema1map00builder) | additionalProperty(key: String, value: Int) | +| [Schema1Map00Builder](#schema1map00builder) | additionalProperty(key: String, value: Float) | +| [Schema1Map00Builder](#schema1map00builder) | additionalProperty(key: String, value: Long) | +| [Schema1Map00Builder](#schema1map00builder) | additionalProperty(key: String, value: Double) | +| [Schema1Map00Builder](#schema1map00builder) | additionalProperty(key: String, value: List) | +| [Schema1Map00Builder](#schema1map00builder) | additionalProperty(key: String, value: Map) | + +## Schema1Map01Builder +class Schema1Map01Builder
+builder for `Map` + +A class that builds the Map input type + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| Schema1Map01Builder(Map instance)
Creates a builder that contains the passed instance | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| [Schema1Map00Builder](#schema1map00builder) | foo(value: Nothing?) | +| [Schema1Map00Builder](#schema1map00builder) | foo(value: Boolean) | +| [Schema1Map00Builder](#schema1map00builder) | foo(value: String) | +| [Schema1Map00Builder](#schema1map00builder) | foo(value: Int) | +| [Schema1Map00Builder](#schema1map00builder) | foo(value: Float) | +| [Schema1Map00Builder](#schema1map00builder) | foo(value: Long) | +| [Schema1Map00Builder](#schema1map00builder) | foo(value: Double) | +| [Schema1Map00Builder](#schema1map00builder) | foo(value: List) | +| [Schema1Map00Builder](#schema1map00builder) | foo(value: Map) | + +## Schema1Map10Builder +class Schema1Map10Builder
+builder for `Map` + +A class that builds the Map input type + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| Schema1Map10Builder(Map instance)
Creates a builder that contains the passed instance | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| [Schema1Map00Builder](#schema1map00builder) | baz(value: Nothing?) | +| [Schema1Map00Builder](#schema1map00builder) | baz(value: Boolean) | +| [Schema1Map00Builder](#schema1map00builder) | baz(value: String) | +| [Schema1Map00Builder](#schema1map00builder) | baz(value: Int) | +| [Schema1Map00Builder](#schema1map00builder) | baz(value: Float) | +| [Schema1Map00Builder](#schema1map00builder) | baz(value: Long) | +| [Schema1Map00Builder](#schema1map00builder) | baz(value: Double) | +| [Schema1Map00Builder](#schema1map00builder) | baz(value: List) | +| [Schema1Map00Builder](#schema1map00builder) | baz(value: Map) | + +## Schema1MapBuilder +class Schema1MapBuilder
+builder for `Map` + +A class that builds the Map input type + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| Schema1MapBuilder()
Creates a builder that contains an empty map | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| [Schema1Map01Builder](#schema1map01builder) | baz(value: Nothing?) | +| [Schema1Map01Builder](#schema1map01builder) | baz(value: Boolean) | +| [Schema1Map01Builder](#schema1map01builder) | baz(value: String) | +| [Schema1Map01Builder](#schema1map01builder) | baz(value: Int) | +| [Schema1Map01Builder](#schema1map01builder) | baz(value: Float) | +| [Schema1Map01Builder](#schema1map01builder) | baz(value: Long) | +| [Schema1Map01Builder](#schema1map01builder) | baz(value: Double) | +| [Schema1Map01Builder](#schema1map01builder) | baz(value: List) | +| [Schema1Map01Builder](#schema1map01builder) | baz(value: Map) | +| [Schema1Map10Builder](#schema1map10builder) | foo(value: Nothing?) | +| [Schema1Map10Builder](#schema1map10builder) | foo(value: Boolean) | +| [Schema1Map10Builder](#schema1map10builder) | foo(value: String) | +| [Schema1Map10Builder](#schema1map10builder) | foo(value: Int) | +| [Schema1Map10Builder](#schema1map10builder) | foo(value: Float) | +| [Schema1Map10Builder](#schema1map10builder) | foo(value: Long) | +| [Schema1Map10Builder](#schema1map10builder) | foo(value: Double) | +| [Schema1Map10Builder](#schema1map10builder) | foo(value: List) | +| [Schema1Map10Builder](#schema1map10builder) | foo(value: Map) | + +## Schema1Map +class Schema1Map
+extends FrozenMap + +A class to store validated Map payloads + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| static [Schema1Map](#schema1map) | of([Map](#schema1mapbuilder) arg, SchemaConfiguration configuration) | +| Any? | baz()
| +| Any? | foo()
| +| Any? | getAdditionalProperty(String name)
provides type safety for additional properties | + +## Schema0Boxed +sealed interface Schema0Boxed
+permits
+[Schema0BoxedVoid](#schema0boxedvoid), +[Schema0BoxedBoolean](#schema0boxedboolean), +[Schema0BoxedNumber](#schema0boxednumber), +[Schema0BoxedString](#schema0boxedstring), +[Schema0BoxedList](#schema0boxedlist), +[Schema0BoxedMap](#schema0boxedmap) + +sealed interface that stores validated payloads using boxed classes + +## Schema0BoxedVoid +data class Schema0BoxedVoid
+implements [Schema0Boxed](#schema0boxed) + +data class that stores validated null payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| Schema0BoxedVoid(Nothing? data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| Nothing? | data()
validated payload | +| Any? | getData()
validated payload | + +## Schema0BoxedBoolean +data class Schema0BoxedBoolean
+implements [Schema0Boxed](#schema0boxed) + +record that stores validated boolean payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| Schema0BoxedBoolean(boolean data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| boolean | data()
validated payload | +| Any? | getData()
validated payload | + +## Schema0BoxedNumber +data class Schema0BoxedNumber
+implements [Schema0Boxed](#schema0boxed) + +data class that stores validated Number payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| Schema0BoxedNumber(Number data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| Number | data()
validated payload | +| Any? | getData()
validated payload | + +## Schema0BoxedString +data class Schema0BoxedString
+implements [Schema0Boxed](#schema0boxed) + +data class that stores validated String payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| Schema0BoxedString(String data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| String | data()
validated payload | +| Any? | getData()
validated payload | + +## Schema0BoxedList +data class Schema0BoxedList
+implements [Schema0Boxed](#schema0boxed) + +data class that stores validated List payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| Schema0BoxedList(FrozenList data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| FrozenList | data()
validated payload | +| Any? | getData()
validated payload | + +## Schema0BoxedMap +data class Schema0BoxedMap
+implements [Schema0Boxed](#schema0boxed) + +data class that stores validated Map payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| Schema0BoxedMap([Schema0Map](#schema0map) data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| [Schema0Map](#schema0map) | data()
validated payload | +| Any? | getData()
validated payload | + +## Schema0 +class Schema0
+extends JsonSchema + +A schema class that validates payloads + +### Field Summary +| Modifier and Type | Field and Description | +| ----------------- | ---------------------- | +| Set | required = setOf(
    "bar",
    "foo"
)
| + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| String | validate(arg: String, configuration: SchemaConfiguration) | +| Nothing? | validate(arg: Nothing?, configuration: SchemaConfiguration) | +| int | validate(arg: int, configuration: SchemaConfiguration) | +| long | validate(arg: long, configuration: SchemaConfiguration) | +| float | validate(arg: float, configuration: SchemaConfiguration) | +| double | validate(arg: double, configuration: SchemaConfiguration) | +| Number | validate(arg: Number, configuration: SchemaConfiguration) | +| boolean | validate(arg: boolean, configuration: SchemaConfiguration) | +| [Schema0Map](#schema0map) | validate(arg: [Map<?, ?>](#schema0mapbuilder), configuration: SchemaConfiguration) | +| FrozenList | validate(arg: List<*>, configuration: SchemaConfiguration) | +| [Schema0BoxedString](#schema0boxedstring) | validateAndBox(String, configuration: SchemaConfiguration) | +| [Schema0BoxedVoid](#schema0boxedvoid) | validateAndBox(Nothing?, configuration: SchemaConfiguration) | +| [Schema0BoxedNumber](#schema0boxednumber) | validateAndBox(Number, configuration: SchemaConfiguration) | +| [Schema0BoxedBoolean](#schema0boxedboolean) | validateAndBox(boolean, configuration: SchemaConfiguration) | +| [Schema0BoxedMap](#schema0boxedmap) | validateAndBox([Map<?, ?>](#schema0mapbuilder), configuration: SchemaConfiguration) | +| [Schema0BoxedList](#schema0boxedlist) | validateAndBox(List<*>, configuration: SchemaConfiguration) | +| [Schema0Boxed](#schema0boxed) | validateAndBox(Any?, configuration: SchemaConfiguration) | +| Any? | validate(arg: Any?, configuration: SchemaConfiguration) | + +## Schema0Map00Builder +class Schema0Map00Builder
+builder for `Map` + +A class that builds the Map input type + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| Schema0Map00Builder(Map instance)
Creates a builder that contains the passed instance | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| Map | build()
Returns map input that should be used with Schema.validate | +| [Schema0Map00Builder](#schema0map00builder) | additionalProperty(key: String, value: Nothing?) | +| [Schema0Map00Builder](#schema0map00builder) | additionalProperty(key: String, value: Boolean) | +| [Schema0Map00Builder](#schema0map00builder) | additionalProperty(key: String, value: String) | +| [Schema0Map00Builder](#schema0map00builder) | additionalProperty(key: String, value: Int) | +| [Schema0Map00Builder](#schema0map00builder) | additionalProperty(key: String, value: Float) | +| [Schema0Map00Builder](#schema0map00builder) | additionalProperty(key: String, value: Long) | +| [Schema0Map00Builder](#schema0map00builder) | additionalProperty(key: String, value: Double) | +| [Schema0Map00Builder](#schema0map00builder) | additionalProperty(key: String, value: List) | +| [Schema0Map00Builder](#schema0map00builder) | additionalProperty(key: String, value: Map) | + +## Schema0Map01Builder +class Schema0Map01Builder
+builder for `Map` + +A class that builds the Map input type + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| Schema0Map01Builder(Map instance)
Creates a builder that contains the passed instance | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| [Schema0Map00Builder](#schema0map00builder) | foo(value: Nothing?) | +| [Schema0Map00Builder](#schema0map00builder) | foo(value: Boolean) | +| [Schema0Map00Builder](#schema0map00builder) | foo(value: String) | +| [Schema0Map00Builder](#schema0map00builder) | foo(value: Int) | +| [Schema0Map00Builder](#schema0map00builder) | foo(value: Float) | +| [Schema0Map00Builder](#schema0map00builder) | foo(value: Long) | +| [Schema0Map00Builder](#schema0map00builder) | foo(value: Double) | +| [Schema0Map00Builder](#schema0map00builder) | foo(value: List) | +| [Schema0Map00Builder](#schema0map00builder) | foo(value: Map) | + +## Schema0Map10Builder +class Schema0Map10Builder
+builder for `Map` + +A class that builds the Map input type + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| Schema0Map10Builder(Map instance)
Creates a builder that contains the passed instance | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| [Schema0Map00Builder](#schema0map00builder) | bar(value: Nothing?) | +| [Schema0Map00Builder](#schema0map00builder) | bar(value: Boolean) | +| [Schema0Map00Builder](#schema0map00builder) | bar(value: String) | +| [Schema0Map00Builder](#schema0map00builder) | bar(value: Int) | +| [Schema0Map00Builder](#schema0map00builder) | bar(value: Float) | +| [Schema0Map00Builder](#schema0map00builder) | bar(value: Long) | +| [Schema0Map00Builder](#schema0map00builder) | bar(value: Double) | +| [Schema0Map00Builder](#schema0map00builder) | bar(value: List) | +| [Schema0Map00Builder](#schema0map00builder) | bar(value: Map) | + +## Schema0MapBuilder +class Schema0MapBuilder
+builder for `Map` + +A class that builds the Map input type + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| Schema0MapBuilder()
Creates a builder that contains an empty map | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| [Schema0Map01Builder](#schema0map01builder) | bar(value: Nothing?) | +| [Schema0Map01Builder](#schema0map01builder) | bar(value: Boolean) | +| [Schema0Map01Builder](#schema0map01builder) | bar(value: String) | +| [Schema0Map01Builder](#schema0map01builder) | bar(value: Int) | +| [Schema0Map01Builder](#schema0map01builder) | bar(value: Float) | +| [Schema0Map01Builder](#schema0map01builder) | bar(value: Long) | +| [Schema0Map01Builder](#schema0map01builder) | bar(value: Double) | +| [Schema0Map01Builder](#schema0map01builder) | bar(value: List) | +| [Schema0Map01Builder](#schema0map01builder) | bar(value: Map) | +| [Schema0Map10Builder](#schema0map10builder) | foo(value: Nothing?) | +| [Schema0Map10Builder](#schema0map10builder) | foo(value: Boolean) | +| [Schema0Map10Builder](#schema0map10builder) | foo(value: String) | +| [Schema0Map10Builder](#schema0map10builder) | foo(value: Int) | +| [Schema0Map10Builder](#schema0map10builder) | foo(value: Float) | +| [Schema0Map10Builder](#schema0map10builder) | foo(value: Long) | +| [Schema0Map10Builder](#schema0map10builder) | foo(value: Double) | +| [Schema0Map10Builder](#schema0map10builder) | foo(value: List) | +| [Schema0Map10Builder](#schema0map10builder) | foo(value: Map) | + +## Schema0Map +class Schema0Map
+extends FrozenMap + +A class to store validated Map payloads + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| static [Schema0Map](#schema0map) | of([Map](#schema0mapbuilder) arg, SchemaConfiguration configuration) | +| Any? | bar()
| +| Any? | foo()
| +| Any? | getAdditionalProperty(String name)
provides type safety for additional properties | + +[[Back to top]](#top) [[Back to Component Schemas]](../../../README.md#Component-Schemas) [[Back to README]](../../../README.md) diff --git a/samples/client/3_0_3_unit_test/kotlin/docs/components/schemas/PatternIsNotAnchored.md b/samples/client/3_0_3_unit_test/kotlin/docs/components/schemas/PatternIsNotAnchored.md new file mode 100644 index 00000000000..db50b22bddc --- /dev/null +++ b/samples/client/3_0_3_unit_test/kotlin/docs/components/schemas/PatternIsNotAnchored.md @@ -0,0 +1,169 @@ +# PatternIsNotAnchored +org.openapijsonschematools.client.components.schemas.PatternIsNotAnchored.java +class PatternIsNotAnchored
+ +A class that contains necessary nested +- schema classes (which validate payloads), extends JsonSchema +- sealed interfaces which store validated payloads, Kotlin version of a sum type +- boxed classes which store validated payloads, sealed permits class implementations + +## Nested Class Summary +| Modifier and Type | Class and Description | +| ----------------- | ---------------------- | +| sealed interface | [PatternIsNotAnchored.PatternIsNotAnchored1Boxed](#patternisnotanchored1boxed)
sealed interface for validated payloads | +| record | [PatternIsNotAnchored.PatternIsNotAnchored1BoxedVoid](#patternisnotanchored1boxedvoid)
boxed class to store validated null payloads | +| record | [PatternIsNotAnchored.PatternIsNotAnchored1BoxedBoolean](#patternisnotanchored1boxedboolean)
boxed class to store validated boolean payloads | +| record | [PatternIsNotAnchored.PatternIsNotAnchored1BoxedNumber](#patternisnotanchored1boxednumber)
boxed class to store validated Number payloads | +| record | [PatternIsNotAnchored.PatternIsNotAnchored1BoxedString](#patternisnotanchored1boxedstring)
boxed class to store validated String payloads | +| record | [PatternIsNotAnchored.PatternIsNotAnchored1BoxedList](#patternisnotanchored1boxedlist)
boxed class to store validated List payloads | +| record | [PatternIsNotAnchored.PatternIsNotAnchored1BoxedMap](#patternisnotanchored1boxedmap)
boxed class to store validated Map payloads | +| static class | [PatternIsNotAnchored.PatternIsNotAnchored1](#patternisnotanchored1)
schema class | + +## PatternIsNotAnchored1Boxed +sealed interface PatternIsNotAnchored1Boxed
+permits
+[PatternIsNotAnchored1BoxedVoid](#patternisnotanchored1boxedvoid), +[PatternIsNotAnchored1BoxedBoolean](#patternisnotanchored1boxedboolean), +[PatternIsNotAnchored1BoxedNumber](#patternisnotanchored1boxednumber), +[PatternIsNotAnchored1BoxedString](#patternisnotanchored1boxedstring), +[PatternIsNotAnchored1BoxedList](#patternisnotanchored1boxedlist), +[PatternIsNotAnchored1BoxedMap](#patternisnotanchored1boxedmap) + +sealed interface that stores validated payloads using boxed classes + +## PatternIsNotAnchored1BoxedVoid +data class PatternIsNotAnchored1BoxedVoid
+implements [PatternIsNotAnchored1Boxed](#patternisnotanchored1boxed) + +data class that stores validated null payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| PatternIsNotAnchored1BoxedVoid(Nothing? data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| Nothing? | data()
validated payload | +| Any? | getData()
validated payload | + +## PatternIsNotAnchored1BoxedBoolean +data class PatternIsNotAnchored1BoxedBoolean
+implements [PatternIsNotAnchored1Boxed](#patternisnotanchored1boxed) + +record that stores validated boolean payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| PatternIsNotAnchored1BoxedBoolean(boolean data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| boolean | data()
validated payload | +| Any? | getData()
validated payload | + +## PatternIsNotAnchored1BoxedNumber +data class PatternIsNotAnchored1BoxedNumber
+implements [PatternIsNotAnchored1Boxed](#patternisnotanchored1boxed) + +data class that stores validated Number payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| PatternIsNotAnchored1BoxedNumber(Number data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| Number | data()
validated payload | +| Any? | getData()
validated payload | + +## PatternIsNotAnchored1BoxedString +data class PatternIsNotAnchored1BoxedString
+implements [PatternIsNotAnchored1Boxed](#patternisnotanchored1boxed) + +data class that stores validated String payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| PatternIsNotAnchored1BoxedString(String data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| String | data()
validated payload | +| Any? | getData()
validated payload | + +## PatternIsNotAnchored1BoxedList +data class PatternIsNotAnchored1BoxedList
+implements [PatternIsNotAnchored1Boxed](#patternisnotanchored1boxed) + +data class that stores validated List payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| PatternIsNotAnchored1BoxedList(FrozenList data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| FrozenList | data()
validated payload | +| Any? | getData()
validated payload | + +## PatternIsNotAnchored1BoxedMap +data class PatternIsNotAnchored1BoxedMap
+implements [PatternIsNotAnchored1Boxed](#patternisnotanchored1boxed) + +data class that stores validated Map payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| PatternIsNotAnchored1BoxedMap(FrozenMap data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| FrozenMap | data()
validated payload | +| Any? | getData()
validated payload | + +## PatternIsNotAnchored1 +class PatternIsNotAnchored1
+extends JsonSchema + +A schema class that validates payloads + +### Field Summary +| Modifier and Type | Field and Description | +| ----------------- | ---------------------- | +| Pattern | pattern = Pattern.compile(
    "a+"
)
| + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| String | validate(arg: String, configuration: SchemaConfiguration) | +| Nothing? | validate(arg: Nothing?, configuration: SchemaConfiguration) | +| int | validate(arg: int, configuration: SchemaConfiguration) | +| long | validate(arg: long, configuration: SchemaConfiguration) | +| float | validate(arg: float, configuration: SchemaConfiguration) | +| double | validate(arg: double, configuration: SchemaConfiguration) | +| Number | validate(arg: Number, configuration: SchemaConfiguration) | +| boolean | validate(arg: boolean, configuration: SchemaConfiguration) | +| FrozenMap | validate(arg: Map<?, ?>, configuration: SchemaConfiguration) | +| FrozenList | validate(arg: List<*>, configuration: SchemaConfiguration) | +| [PatternIsNotAnchored1BoxedString](#patternisnotanchored1boxedstring) | validateAndBox(String, configuration: SchemaConfiguration) | +| [PatternIsNotAnchored1BoxedVoid](#patternisnotanchored1boxedvoid) | validateAndBox(Nothing?, configuration: SchemaConfiguration) | +| [PatternIsNotAnchored1BoxedNumber](#patternisnotanchored1boxednumber) | validateAndBox(Number, configuration: SchemaConfiguration) | +| [PatternIsNotAnchored1BoxedBoolean](#patternisnotanchored1boxedboolean) | validateAndBox(boolean, configuration: SchemaConfiguration) | +| [PatternIsNotAnchored1BoxedMap](#patternisnotanchored1boxedmap) | validateAndBox(Map<?, ?>, configuration: SchemaConfiguration) | +| [PatternIsNotAnchored1BoxedList](#patternisnotanchored1boxedlist) | validateAndBox(List<*>, configuration: SchemaConfiguration) | +| [PatternIsNotAnchored1Boxed](#patternisnotanchored1boxed) | validateAndBox(Any?, configuration: SchemaConfiguration) | +| Any? | validate(arg: Any?, configuration: SchemaConfiguration) | + +[[Back to top]](#top) [[Back to Component Schemas]](../../../README.md#Component-Schemas) [[Back to README]](../../../README.md) diff --git a/samples/client/3_0_3_unit_test/kotlin/docs/components/schemas/PatternValidation.md b/samples/client/3_0_3_unit_test/kotlin/docs/components/schemas/PatternValidation.md new file mode 100644 index 00000000000..38aabdd0f51 --- /dev/null +++ b/samples/client/3_0_3_unit_test/kotlin/docs/components/schemas/PatternValidation.md @@ -0,0 +1,169 @@ +# PatternValidation +org.openapijsonschematools.client.components.schemas.PatternValidation.java +class PatternValidation
+ +A class that contains necessary nested +- schema classes (which validate payloads), extends JsonSchema +- sealed interfaces which store validated payloads, Kotlin version of a sum type +- boxed classes which store validated payloads, sealed permits class implementations + +## Nested Class Summary +| Modifier and Type | Class and Description | +| ----------------- | ---------------------- | +| sealed interface | [PatternValidation.PatternValidation1Boxed](#patternvalidation1boxed)
sealed interface for validated payloads | +| record | [PatternValidation.PatternValidation1BoxedVoid](#patternvalidation1boxedvoid)
boxed class to store validated null payloads | +| record | [PatternValidation.PatternValidation1BoxedBoolean](#patternvalidation1boxedboolean)
boxed class to store validated boolean payloads | +| record | [PatternValidation.PatternValidation1BoxedNumber](#patternvalidation1boxednumber)
boxed class to store validated Number payloads | +| record | [PatternValidation.PatternValidation1BoxedString](#patternvalidation1boxedstring)
boxed class to store validated String payloads | +| record | [PatternValidation.PatternValidation1BoxedList](#patternvalidation1boxedlist)
boxed class to store validated List payloads | +| record | [PatternValidation.PatternValidation1BoxedMap](#patternvalidation1boxedmap)
boxed class to store validated Map payloads | +| static class | [PatternValidation.PatternValidation1](#patternvalidation1)
schema class | + +## PatternValidation1Boxed +sealed interface PatternValidation1Boxed
+permits
+[PatternValidation1BoxedVoid](#patternvalidation1boxedvoid), +[PatternValidation1BoxedBoolean](#patternvalidation1boxedboolean), +[PatternValidation1BoxedNumber](#patternvalidation1boxednumber), +[PatternValidation1BoxedString](#patternvalidation1boxedstring), +[PatternValidation1BoxedList](#patternvalidation1boxedlist), +[PatternValidation1BoxedMap](#patternvalidation1boxedmap) + +sealed interface that stores validated payloads using boxed classes + +## PatternValidation1BoxedVoid +data class PatternValidation1BoxedVoid
+implements [PatternValidation1Boxed](#patternvalidation1boxed) + +data class that stores validated null payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| PatternValidation1BoxedVoid(Nothing? data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| Nothing? | data()
validated payload | +| Any? | getData()
validated payload | + +## PatternValidation1BoxedBoolean +data class PatternValidation1BoxedBoolean
+implements [PatternValidation1Boxed](#patternvalidation1boxed) + +record that stores validated boolean payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| PatternValidation1BoxedBoolean(boolean data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| boolean | data()
validated payload | +| Any? | getData()
validated payload | + +## PatternValidation1BoxedNumber +data class PatternValidation1BoxedNumber
+implements [PatternValidation1Boxed](#patternvalidation1boxed) + +data class that stores validated Number payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| PatternValidation1BoxedNumber(Number data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| Number | data()
validated payload | +| Any? | getData()
validated payload | + +## PatternValidation1BoxedString +data class PatternValidation1BoxedString
+implements [PatternValidation1Boxed](#patternvalidation1boxed) + +data class that stores validated String payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| PatternValidation1BoxedString(String data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| String | data()
validated payload | +| Any? | getData()
validated payload | + +## PatternValidation1BoxedList +data class PatternValidation1BoxedList
+implements [PatternValidation1Boxed](#patternvalidation1boxed) + +data class that stores validated List payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| PatternValidation1BoxedList(FrozenList data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| FrozenList | data()
validated payload | +| Any? | getData()
validated payload | + +## PatternValidation1BoxedMap +data class PatternValidation1BoxedMap
+implements [PatternValidation1Boxed](#patternvalidation1boxed) + +data class that stores validated Map payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| PatternValidation1BoxedMap(FrozenMap data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| FrozenMap | data()
validated payload | +| Any? | getData()
validated payload | + +## PatternValidation1 +class PatternValidation1
+extends JsonSchema + +A schema class that validates payloads + +### Field Summary +| Modifier and Type | Field and Description | +| ----------------- | ---------------------- | +| Pattern | pattern = Pattern.compile(
    "^a*\$"
)
| + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| String | validate(arg: String, configuration: SchemaConfiguration) | +| Nothing? | validate(arg: Nothing?, configuration: SchemaConfiguration) | +| int | validate(arg: int, configuration: SchemaConfiguration) | +| long | validate(arg: long, configuration: SchemaConfiguration) | +| float | validate(arg: float, configuration: SchemaConfiguration) | +| double | validate(arg: double, configuration: SchemaConfiguration) | +| Number | validate(arg: Number, configuration: SchemaConfiguration) | +| boolean | validate(arg: boolean, configuration: SchemaConfiguration) | +| FrozenMap | validate(arg: Map<?, ?>, configuration: SchemaConfiguration) | +| FrozenList | validate(arg: List<*>, configuration: SchemaConfiguration) | +| [PatternValidation1BoxedString](#patternvalidation1boxedstring) | validateAndBox(String, configuration: SchemaConfiguration) | +| [PatternValidation1BoxedVoid](#patternvalidation1boxedvoid) | validateAndBox(Nothing?, configuration: SchemaConfiguration) | +| [PatternValidation1BoxedNumber](#patternvalidation1boxednumber) | validateAndBox(Number, configuration: SchemaConfiguration) | +| [PatternValidation1BoxedBoolean](#patternvalidation1boxedboolean) | validateAndBox(boolean, configuration: SchemaConfiguration) | +| [PatternValidation1BoxedMap](#patternvalidation1boxedmap) | validateAndBox(Map<?, ?>, configuration: SchemaConfiguration) | +| [PatternValidation1BoxedList](#patternvalidation1boxedlist) | validateAndBox(List<*>, configuration: SchemaConfiguration) | +| [PatternValidation1Boxed](#patternvalidation1boxed) | validateAndBox(Any?, configuration: SchemaConfiguration) | +| Any? | validate(arg: Any?, configuration: SchemaConfiguration) | + +[[Back to top]](#top) [[Back to Component Schemas]](../../../README.md#Component-Schemas) [[Back to README]](../../../README.md) diff --git a/samples/client/3_0_3_unit_test/kotlin/docs/components/schemas/PropertiesWithEscapedCharacters.md b/samples/client/3_0_3_unit_test/kotlin/docs/components/schemas/PropertiesWithEscapedCharacters.md new file mode 100644 index 00000000000..385cc3ca185 --- /dev/null +++ b/samples/client/3_0_3_unit_test/kotlin/docs/components/schemas/PropertiesWithEscapedCharacters.md @@ -0,0 +1,463 @@ +# PropertiesWithEscapedCharacters +org.openapijsonschematools.client.components.schemas.PropertiesWithEscapedCharacters.java +class PropertiesWithEscapedCharacters
+ +A class that contains necessary nested +- schema classes (which validate payloads), extends JsonSchema +- sealed interfaces which store validated payloads, Kotlin version of a sum type +- boxed classes which store validated payloads, sealed permits class implementations +- classes to store validated map payloads, extends FrozenMap +- classes to build inputs for map payloads + +## Nested Class Summary +| Modifier and Type | Class and Description | +| ----------------- | ---------------------- | +| sealed interface | [PropertiesWithEscapedCharacters.PropertiesWithEscapedCharacters1Boxed](#propertieswithescapedcharacters1boxed)
sealed interface for validated payloads | +| record | [PropertiesWithEscapedCharacters.PropertiesWithEscapedCharacters1BoxedVoid](#propertieswithescapedcharacters1boxedvoid)
boxed class to store validated null payloads | +| record | [PropertiesWithEscapedCharacters.PropertiesWithEscapedCharacters1BoxedBoolean](#propertieswithescapedcharacters1boxedboolean)
boxed class to store validated boolean payloads | +| record | [PropertiesWithEscapedCharacters.PropertiesWithEscapedCharacters1BoxedNumber](#propertieswithescapedcharacters1boxednumber)
boxed class to store validated Number payloads | +| record | [PropertiesWithEscapedCharacters.PropertiesWithEscapedCharacters1BoxedString](#propertieswithescapedcharacters1boxedstring)
boxed class to store validated String payloads | +| record | [PropertiesWithEscapedCharacters.PropertiesWithEscapedCharacters1BoxedList](#propertieswithescapedcharacters1boxedlist)
boxed class to store validated List payloads | +| record | [PropertiesWithEscapedCharacters.PropertiesWithEscapedCharacters1BoxedMap](#propertieswithescapedcharacters1boxedmap)
boxed class to store validated Map payloads | +| static class | [PropertiesWithEscapedCharacters.PropertiesWithEscapedCharacters1](#propertieswithescapedcharacters1)
schema class | +| static class | [PropertiesWithEscapedCharacters.PropertiesWithEscapedCharactersMapBuilder](#propertieswithescapedcharactersmapbuilder)
builder for Map payloads | +| static class | [PropertiesWithEscapedCharacters.PropertiesWithEscapedCharactersMap](#propertieswithescapedcharactersmap)
output class for Map payloads | +| sealed interface | [PropertiesWithEscapedCharacters.Foou000CbarBoxed](#foou000cbarboxed)
sealed interface for validated payloads | +| record | [PropertiesWithEscapedCharacters.Foou000CbarBoxedNumber](#foou000cbarboxednumber)
boxed class to store validated Number payloads | +| static class | [PropertiesWithEscapedCharacters.Foou000Cbar](#foou000cbar)
schema class | +| sealed interface | [PropertiesWithEscapedCharacters.FootbarBoxed](#footbarboxed)
sealed interface for validated payloads | +| record | [PropertiesWithEscapedCharacters.FootbarBoxedNumber](#footbarboxednumber)
boxed class to store validated Number payloads | +| static class | [PropertiesWithEscapedCharacters.Footbar](#footbar)
schema class | +| sealed interface | [PropertiesWithEscapedCharacters.FoorbarBoxed](#foorbarboxed)
sealed interface for validated payloads | +| record | [PropertiesWithEscapedCharacters.FoorbarBoxedNumber](#foorbarboxednumber)
boxed class to store validated Number payloads | +| static class | [PropertiesWithEscapedCharacters.Foorbar](#foorbar)
schema class | +| sealed interface | [PropertiesWithEscapedCharacters.Foobar1Boxed](#foobar1boxed)
sealed interface for validated payloads | +| record | [PropertiesWithEscapedCharacters.Foobar1BoxedNumber](#foobar1boxednumber)
boxed class to store validated Number payloads | +| static class | [PropertiesWithEscapedCharacters.Foobar1](#foobar1)
schema class | +| sealed interface | [PropertiesWithEscapedCharacters.FoobarBoxed](#foobarboxed)
sealed interface for validated payloads | +| record | [PropertiesWithEscapedCharacters.FoobarBoxedNumber](#foobarboxednumber)
boxed class to store validated Number payloads | +| static class | [PropertiesWithEscapedCharacters.Foobar](#foobar)
schema class | +| sealed interface | [PropertiesWithEscapedCharacters.FoonbarBoxed](#foonbarboxed)
sealed interface for validated payloads | +| record | [PropertiesWithEscapedCharacters.FoonbarBoxedNumber](#foonbarboxednumber)
boxed class to store validated Number payloads | +| static class | [PropertiesWithEscapedCharacters.Foonbar](#foonbar)
schema class | + +## PropertiesWithEscapedCharacters1Boxed +sealed interface PropertiesWithEscapedCharacters1Boxed
+permits
+[PropertiesWithEscapedCharacters1BoxedVoid](#propertieswithescapedcharacters1boxedvoid), +[PropertiesWithEscapedCharacters1BoxedBoolean](#propertieswithescapedcharacters1boxedboolean), +[PropertiesWithEscapedCharacters1BoxedNumber](#propertieswithescapedcharacters1boxednumber), +[PropertiesWithEscapedCharacters1BoxedString](#propertieswithescapedcharacters1boxedstring), +[PropertiesWithEscapedCharacters1BoxedList](#propertieswithescapedcharacters1boxedlist), +[PropertiesWithEscapedCharacters1BoxedMap](#propertieswithescapedcharacters1boxedmap) + +sealed interface that stores validated payloads using boxed classes + +## PropertiesWithEscapedCharacters1BoxedVoid +data class PropertiesWithEscapedCharacters1BoxedVoid
+implements [PropertiesWithEscapedCharacters1Boxed](#propertieswithescapedcharacters1boxed) + +data class that stores validated null payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| PropertiesWithEscapedCharacters1BoxedVoid(Nothing? data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| Nothing? | data()
validated payload | +| Any? | getData()
validated payload | + +## PropertiesWithEscapedCharacters1BoxedBoolean +data class PropertiesWithEscapedCharacters1BoxedBoolean
+implements [PropertiesWithEscapedCharacters1Boxed](#propertieswithescapedcharacters1boxed) + +record that stores validated boolean payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| PropertiesWithEscapedCharacters1BoxedBoolean(boolean data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| boolean | data()
validated payload | +| Any? | getData()
validated payload | + +## PropertiesWithEscapedCharacters1BoxedNumber +data class PropertiesWithEscapedCharacters1BoxedNumber
+implements [PropertiesWithEscapedCharacters1Boxed](#propertieswithescapedcharacters1boxed) + +data class that stores validated Number payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| PropertiesWithEscapedCharacters1BoxedNumber(Number data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| Number | data()
validated payload | +| Any? | getData()
validated payload | + +## PropertiesWithEscapedCharacters1BoxedString +data class PropertiesWithEscapedCharacters1BoxedString
+implements [PropertiesWithEscapedCharacters1Boxed](#propertieswithescapedcharacters1boxed) + +data class that stores validated String payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| PropertiesWithEscapedCharacters1BoxedString(String data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| String | data()
validated payload | +| Any? | getData()
validated payload | + +## PropertiesWithEscapedCharacters1BoxedList +data class PropertiesWithEscapedCharacters1BoxedList
+implements [PropertiesWithEscapedCharacters1Boxed](#propertieswithescapedcharacters1boxed) + +data class that stores validated List payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| PropertiesWithEscapedCharacters1BoxedList(FrozenList data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| FrozenList | data()
validated payload | +| Any? | getData()
validated payload | + +## PropertiesWithEscapedCharacters1BoxedMap +data class PropertiesWithEscapedCharacters1BoxedMap
+implements [PropertiesWithEscapedCharacters1Boxed](#propertieswithescapedcharacters1boxed) + +data class that stores validated Map payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| PropertiesWithEscapedCharacters1BoxedMap([PropertiesWithEscapedCharactersMap](#propertieswithescapedcharactersmap) data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| [PropertiesWithEscapedCharactersMap](#propertieswithescapedcharactersmap) | data()
validated payload | +| Any? | getData()
validated payload | + +## PropertiesWithEscapedCharacters1 +class PropertiesWithEscapedCharacters1
+extends JsonSchema + +A schema class that validates payloads + +### Field Summary +| Modifier and Type | Field and Description | +| ----------------- | ---------------------- | +| Map> | properties = mapOf(
    "foo\nbar" to [Foonbar::class.java](#foonbar)),
    "foo\"bar" to [Foobar::class.java](#foobar)),
    "foo\\bar" to [Foobar1::class.java](#foobar1)),
    "foo\rbar" to [Foorbar::class.java](#foorbar)),
    "foo\tbar" to [Footbar::class.java](#footbar)),
    "foo\u000Cbar" to [Foou000Cbar::class.java](#foou000cbar))
)
| + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| String | validate(arg: String, configuration: SchemaConfiguration) | +| Nothing? | validate(arg: Nothing?, configuration: SchemaConfiguration) | +| int | validate(arg: int, configuration: SchemaConfiguration) | +| long | validate(arg: long, configuration: SchemaConfiguration) | +| float | validate(arg: float, configuration: SchemaConfiguration) | +| double | validate(arg: double, configuration: SchemaConfiguration) | +| Number | validate(arg: Number, configuration: SchemaConfiguration) | +| boolean | validate(arg: boolean, configuration: SchemaConfiguration) | +| [PropertiesWithEscapedCharactersMap](#propertieswithescapedcharactersmap) | validate(arg: [Map<?, ?>](#propertieswithescapedcharactersmapbuilder), configuration: SchemaConfiguration) | +| FrozenList | validate(arg: List<*>, configuration: SchemaConfiguration) | +| [PropertiesWithEscapedCharacters1BoxedString](#propertieswithescapedcharacters1boxedstring) | validateAndBox(String, configuration: SchemaConfiguration) | +| [PropertiesWithEscapedCharacters1BoxedVoid](#propertieswithescapedcharacters1boxedvoid) | validateAndBox(Nothing?, configuration: SchemaConfiguration) | +| [PropertiesWithEscapedCharacters1BoxedNumber](#propertieswithescapedcharacters1boxednumber) | validateAndBox(Number, configuration: SchemaConfiguration) | +| [PropertiesWithEscapedCharacters1BoxedBoolean](#propertieswithescapedcharacters1boxedboolean) | validateAndBox(boolean, configuration: SchemaConfiguration) | +| [PropertiesWithEscapedCharacters1BoxedMap](#propertieswithescapedcharacters1boxedmap) | validateAndBox([Map<?, ?>](#propertieswithescapedcharactersmapbuilder), configuration: SchemaConfiguration) | +| [PropertiesWithEscapedCharacters1BoxedList](#propertieswithescapedcharacters1boxedlist) | validateAndBox(List<*>, configuration: SchemaConfiguration) | +| [PropertiesWithEscapedCharacters1Boxed](#propertieswithescapedcharacters1boxed) | validateAndBox(Any?, configuration: SchemaConfiguration) | +| Any? | validate(arg: Any?, configuration: SchemaConfiguration) | + +## PropertiesWithEscapedCharactersMapBuilder +class PropertiesWithEscapedCharactersMapBuilder
+builder for `Map` + +A class that builds the Map input type + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| PropertiesWithEscapedCharactersMapBuilder()
Creates a builder that contains an empty map | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| Map | build()
Returns map input that should be used with Schema.validate | +| [PropertiesWithEscapedCharactersMapBuilder](#propertieswithescapedcharactersmapbuilder) | fooReverseSolidusNbar(value: Int) | +| [PropertiesWithEscapedCharactersMapBuilder](#propertieswithescapedcharactersmapbuilder) | fooReverseSolidusNbar(value: Float) | +| [PropertiesWithEscapedCharactersMapBuilder](#propertieswithescapedcharactersmapbuilder) | fooReverseSolidusNbar(value: Long) | +| [PropertiesWithEscapedCharactersMapBuilder](#propertieswithescapedcharactersmapbuilder) | fooReverseSolidusNbar(value: Double) | +| [PropertiesWithEscapedCharactersMapBuilder](#propertieswithescapedcharactersmapbuilder) | fooReverseSolidusQuotationMarkBar(value: Int) | +| [PropertiesWithEscapedCharactersMapBuilder](#propertieswithescapedcharactersmapbuilder) | fooReverseSolidusQuotationMarkBar(value: Float) | +| [PropertiesWithEscapedCharactersMapBuilder](#propertieswithescapedcharactersmapbuilder) | fooReverseSolidusQuotationMarkBar(value: Long) | +| [PropertiesWithEscapedCharactersMapBuilder](#propertieswithescapedcharactersmapbuilder) | fooReverseSolidusQuotationMarkBar(value: Double) | +| [PropertiesWithEscapedCharactersMapBuilder](#propertieswithescapedcharactersmapbuilder) | fooReverseSolidusReverseSolidusBar(value: Int) | +| [PropertiesWithEscapedCharactersMapBuilder](#propertieswithescapedcharactersmapbuilder) | fooReverseSolidusReverseSolidusBar(value: Float) | +| [PropertiesWithEscapedCharactersMapBuilder](#propertieswithescapedcharactersmapbuilder) | fooReverseSolidusReverseSolidusBar(value: Long) | +| [PropertiesWithEscapedCharactersMapBuilder](#propertieswithescapedcharactersmapbuilder) | fooReverseSolidusReverseSolidusBar(value: Double) | +| [PropertiesWithEscapedCharactersMapBuilder](#propertieswithescapedcharactersmapbuilder) | fooReverseSolidusRbar(value: Int) | +| [PropertiesWithEscapedCharactersMapBuilder](#propertieswithescapedcharactersmapbuilder) | fooReverseSolidusRbar(value: Float) | +| [PropertiesWithEscapedCharactersMapBuilder](#propertieswithescapedcharactersmapbuilder) | fooReverseSolidusRbar(value: Long) | +| [PropertiesWithEscapedCharactersMapBuilder](#propertieswithescapedcharactersmapbuilder) | fooReverseSolidusRbar(value: Double) | +| [PropertiesWithEscapedCharactersMapBuilder](#propertieswithescapedcharactersmapbuilder) | fooReverseSolidusTbar(value: Int) | +| [PropertiesWithEscapedCharactersMapBuilder](#propertieswithescapedcharactersmapbuilder) | fooReverseSolidusTbar(value: Float) | +| [PropertiesWithEscapedCharactersMapBuilder](#propertieswithescapedcharactersmapbuilder) | fooReverseSolidusTbar(value: Long) | +| [PropertiesWithEscapedCharactersMapBuilder](#propertieswithescapedcharactersmapbuilder) | fooReverseSolidusTbar(value: Double) | +| [PropertiesWithEscapedCharactersMapBuilder](#propertieswithescapedcharactersmapbuilder) | fooReverseSolidusU000cbar(value: Int) | +| [PropertiesWithEscapedCharactersMapBuilder](#propertieswithescapedcharactersmapbuilder) | fooReverseSolidusU000cbar(value: Float) | +| [PropertiesWithEscapedCharactersMapBuilder](#propertieswithescapedcharactersmapbuilder) | fooReverseSolidusU000cbar(value: Long) | +| [PropertiesWithEscapedCharactersMapBuilder](#propertieswithescapedcharactersmapbuilder) | fooReverseSolidusU000cbar(value: Double) | +| [PropertiesWithEscapedCharactersMapBuilder](#propertieswithescapedcharactersmapbuilder) | additionalProperty(key: String, value: Nothing?) | +| [PropertiesWithEscapedCharactersMapBuilder](#propertieswithescapedcharactersmapbuilder) | additionalProperty(key: String, value: Boolean) | +| [PropertiesWithEscapedCharactersMapBuilder](#propertieswithescapedcharactersmapbuilder) | additionalProperty(key: String, value: String) | +| [PropertiesWithEscapedCharactersMapBuilder](#propertieswithescapedcharactersmapbuilder) | additionalProperty(key: String, value: Int) | +| [PropertiesWithEscapedCharactersMapBuilder](#propertieswithescapedcharactersmapbuilder) | additionalProperty(key: String, value: Float) | +| [PropertiesWithEscapedCharactersMapBuilder](#propertieswithescapedcharactersmapbuilder) | additionalProperty(key: String, value: Long) | +| [PropertiesWithEscapedCharactersMapBuilder](#propertieswithescapedcharactersmapbuilder) | additionalProperty(key: String, value: Double) | +| [PropertiesWithEscapedCharactersMapBuilder](#propertieswithescapedcharactersmapbuilder) | additionalProperty(key: String, value: List) | +| [PropertiesWithEscapedCharactersMapBuilder](#propertieswithescapedcharactersmapbuilder) | additionalProperty(key: String, value: Map) | + +## PropertiesWithEscapedCharactersMap +class PropertiesWithEscapedCharactersMap
+extends FrozenMap + +A class to store validated Map payloads + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| static [PropertiesWithEscapedCharactersMap](#propertieswithescapedcharactersmap) | of([Map](#propertieswithescapedcharactersmapbuilder) arg, SchemaConfiguration configuration) | +| Any? | get(String key)
This schema has invalid Kotlin names so this method must be used when you access instance["foo\nbar"], instance["foo\"bar"], instance["foo\\bar"], instance["foo\rbar"], instance["foo\tbar"], instance["foo\u000Cbar"], | +| Any? | getAdditionalProperty(String name)
provides type safety for additional properties | + +## Foou000CbarBoxed +sealed interface Foou000CbarBoxed
+permits
+[Foou000CbarBoxedNumber](#foou000cbarboxednumber) + +sealed interface that stores validated payloads using boxed classes + +## Foou000CbarBoxedNumber +data class Foou000CbarBoxedNumber
+implements [Foou000CbarBoxed](#foou000cbarboxed) + +data class that stores validated Number payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| Foou000CbarBoxedNumber(Number data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| Number | data()
validated payload | +| Any? | getData()
validated payload | + +## Foou000Cbar +class Foou000Cbar
+extends NumberJsonSchema.NumberJsonSchema1 + +A schema class that validates payloads + +| Methods Inherited from class org.openapijsonschematools.client.schemas.NumberJsonSchema.NumberJsonSchema1 | +| ------------------------------------------------------------------ | +| validate | +| validateAndBox | + +## FootbarBoxed +sealed interface FootbarBoxed
+permits
+[FootbarBoxedNumber](#footbarboxednumber) + +sealed interface that stores validated payloads using boxed classes + +## FootbarBoxedNumber +data class FootbarBoxedNumber
+implements [FootbarBoxed](#footbarboxed) + +data class that stores validated Number payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| FootbarBoxedNumber(Number data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| Number | data()
validated payload | +| Any? | getData()
validated payload | + +## Footbar +class Footbar
+extends NumberJsonSchema.NumberJsonSchema1 + +A schema class that validates payloads + +| Methods Inherited from class org.openapijsonschematools.client.schemas.NumberJsonSchema.NumberJsonSchema1 | +| ------------------------------------------------------------------ | +| validate | +| validateAndBox | + +## FoorbarBoxed +sealed interface FoorbarBoxed
+permits
+[FoorbarBoxedNumber](#foorbarboxednumber) + +sealed interface that stores validated payloads using boxed classes + +## FoorbarBoxedNumber +data class FoorbarBoxedNumber
+implements [FoorbarBoxed](#foorbarboxed) + +data class that stores validated Number payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| FoorbarBoxedNumber(Number data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| Number | data()
validated payload | +| Any? | getData()
validated payload | + +## Foorbar +class Foorbar
+extends NumberJsonSchema.NumberJsonSchema1 + +A schema class that validates payloads + +| Methods Inherited from class org.openapijsonschematools.client.schemas.NumberJsonSchema.NumberJsonSchema1 | +| ------------------------------------------------------------------ | +| validate | +| validateAndBox | + +## Foobar1Boxed +sealed interface Foobar1Boxed
+permits
+[Foobar1BoxedNumber](#foobar1boxednumber) + +sealed interface that stores validated payloads using boxed classes + +## Foobar1BoxedNumber +data class Foobar1BoxedNumber
+implements [Foobar1Boxed](#foobar1boxed) + +data class that stores validated Number payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| Foobar1BoxedNumber(Number data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| Number | data()
validated payload | +| Any? | getData()
validated payload | + +## Foobar1 +class Foobar1
+extends NumberJsonSchema.NumberJsonSchema1 + +A schema class that validates payloads + +| Methods Inherited from class org.openapijsonschematools.client.schemas.NumberJsonSchema.NumberJsonSchema1 | +| ------------------------------------------------------------------ | +| validate | +| validateAndBox | + +## FoobarBoxed +sealed interface FoobarBoxed
+permits
+[FoobarBoxedNumber](#foobarboxednumber) + +sealed interface that stores validated payloads using boxed classes + +## FoobarBoxedNumber +data class FoobarBoxedNumber
+implements [FoobarBoxed](#foobarboxed) + +data class that stores validated Number payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| FoobarBoxedNumber(Number data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| Number | data()
validated payload | +| Any? | getData()
validated payload | + +## Foobar +class Foobar
+extends NumberJsonSchema.NumberJsonSchema1 + +A schema class that validates payloads + +| Methods Inherited from class org.openapijsonschematools.client.schemas.NumberJsonSchema.NumberJsonSchema1 | +| ------------------------------------------------------------------ | +| validate | +| validateAndBox | + +## FoonbarBoxed +sealed interface FoonbarBoxed
+permits
+[FoonbarBoxedNumber](#foonbarboxednumber) + +sealed interface that stores validated payloads using boxed classes + +## FoonbarBoxedNumber +data class FoonbarBoxedNumber
+implements [FoonbarBoxed](#foonbarboxed) + +data class that stores validated Number payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| FoonbarBoxedNumber(Number data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| Number | data()
validated payload | +| Any? | getData()
validated payload | + +## Foonbar +class Foonbar
+extends NumberJsonSchema.NumberJsonSchema1 + +A schema class that validates payloads + +| Methods Inherited from class org.openapijsonschematools.client.schemas.NumberJsonSchema.NumberJsonSchema1 | +| ------------------------------------------------------------------ | +| validate | +| validateAndBox | + +[[Back to top]](#top) [[Back to Component Schemas]](../../../README.md#Component-Schemas) [[Back to README]](../../../README.md) diff --git a/samples/client/3_0_3_unit_test/kotlin/docs/components/schemas/PropertyNamedRefThatIsNotAReference.md b/samples/client/3_0_3_unit_test/kotlin/docs/components/schemas/PropertyNamedRefThatIsNotAReference.md new file mode 100644 index 00000000000..9a3d24c717a --- /dev/null +++ b/samples/client/3_0_3_unit_test/kotlin/docs/components/schemas/PropertyNamedRefThatIsNotAReference.md @@ -0,0 +1,250 @@ +# PropertyNamedRefThatIsNotAReference +org.openapijsonschematools.client.components.schemas.PropertyNamedRefThatIsNotAReference.java +class PropertyNamedRefThatIsNotAReference
+ +A class that contains necessary nested +- schema classes (which validate payloads), extends JsonSchema +- sealed interfaces which store validated payloads, Kotlin version of a sum type +- boxed classes which store validated payloads, sealed permits class implementations +- classes to store validated map payloads, extends FrozenMap +- classes to build inputs for map payloads + +## Nested Class Summary +| Modifier and Type | Class and Description | +| ----------------- | ---------------------- | +| sealed interface | [PropertyNamedRefThatIsNotAReference.PropertyNamedRefThatIsNotAReference1Boxed](#propertynamedrefthatisnotareference1boxed)
sealed interface for validated payloads | +| record | [PropertyNamedRefThatIsNotAReference.PropertyNamedRefThatIsNotAReference1BoxedVoid](#propertynamedrefthatisnotareference1boxedvoid)
boxed class to store validated null payloads | +| record | [PropertyNamedRefThatIsNotAReference.PropertyNamedRefThatIsNotAReference1BoxedBoolean](#propertynamedrefthatisnotareference1boxedboolean)
boxed class to store validated boolean payloads | +| record | [PropertyNamedRefThatIsNotAReference.PropertyNamedRefThatIsNotAReference1BoxedNumber](#propertynamedrefthatisnotareference1boxednumber)
boxed class to store validated Number payloads | +| record | [PropertyNamedRefThatIsNotAReference.PropertyNamedRefThatIsNotAReference1BoxedString](#propertynamedrefthatisnotareference1boxedstring)
boxed class to store validated String payloads | +| record | [PropertyNamedRefThatIsNotAReference.PropertyNamedRefThatIsNotAReference1BoxedList](#propertynamedrefthatisnotareference1boxedlist)
boxed class to store validated List payloads | +| record | [PropertyNamedRefThatIsNotAReference.PropertyNamedRefThatIsNotAReference1BoxedMap](#propertynamedrefthatisnotareference1boxedmap)
boxed class to store validated Map payloads | +| static class | [PropertyNamedRefThatIsNotAReference.PropertyNamedRefThatIsNotAReference1](#propertynamedrefthatisnotareference1)
schema class | +| static class | [PropertyNamedRefThatIsNotAReference.PropertyNamedRefThatIsNotAReferenceMapBuilder](#propertynamedrefthatisnotareferencemapbuilder)
builder for Map payloads | +| static class | [PropertyNamedRefThatIsNotAReference.PropertyNamedRefThatIsNotAReferenceMap](#propertynamedrefthatisnotareferencemap)
output class for Map payloads | +| sealed interface | [PropertyNamedRefThatIsNotAReference.RefBoxed](#refboxed)
sealed interface for validated payloads | +| record | [PropertyNamedRefThatIsNotAReference.RefBoxedString](#refboxedstring)
boxed class to store validated String payloads | +| static class | [PropertyNamedRefThatIsNotAReference.Ref](#ref)
schema class | + +## PropertyNamedRefThatIsNotAReference1Boxed +sealed interface PropertyNamedRefThatIsNotAReference1Boxed
+permits
+[PropertyNamedRefThatIsNotAReference1BoxedVoid](#propertynamedrefthatisnotareference1boxedvoid), +[PropertyNamedRefThatIsNotAReference1BoxedBoolean](#propertynamedrefthatisnotareference1boxedboolean), +[PropertyNamedRefThatIsNotAReference1BoxedNumber](#propertynamedrefthatisnotareference1boxednumber), +[PropertyNamedRefThatIsNotAReference1BoxedString](#propertynamedrefthatisnotareference1boxedstring), +[PropertyNamedRefThatIsNotAReference1BoxedList](#propertynamedrefthatisnotareference1boxedlist), +[PropertyNamedRefThatIsNotAReference1BoxedMap](#propertynamedrefthatisnotareference1boxedmap) + +sealed interface that stores validated payloads using boxed classes + +## PropertyNamedRefThatIsNotAReference1BoxedVoid +data class PropertyNamedRefThatIsNotAReference1BoxedVoid
+implements [PropertyNamedRefThatIsNotAReference1Boxed](#propertynamedrefthatisnotareference1boxed) + +data class that stores validated null payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| PropertyNamedRefThatIsNotAReference1BoxedVoid(Nothing? data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| Nothing? | data()
validated payload | +| Any? | getData()
validated payload | + +## PropertyNamedRefThatIsNotAReference1BoxedBoolean +data class PropertyNamedRefThatIsNotAReference1BoxedBoolean
+implements [PropertyNamedRefThatIsNotAReference1Boxed](#propertynamedrefthatisnotareference1boxed) + +record that stores validated boolean payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| PropertyNamedRefThatIsNotAReference1BoxedBoolean(boolean data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| boolean | data()
validated payload | +| Any? | getData()
validated payload | + +## PropertyNamedRefThatIsNotAReference1BoxedNumber +data class PropertyNamedRefThatIsNotAReference1BoxedNumber
+implements [PropertyNamedRefThatIsNotAReference1Boxed](#propertynamedrefthatisnotareference1boxed) + +data class that stores validated Number payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| PropertyNamedRefThatIsNotAReference1BoxedNumber(Number data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| Number | data()
validated payload | +| Any? | getData()
validated payload | + +## PropertyNamedRefThatIsNotAReference1BoxedString +data class PropertyNamedRefThatIsNotAReference1BoxedString
+implements [PropertyNamedRefThatIsNotAReference1Boxed](#propertynamedrefthatisnotareference1boxed) + +data class that stores validated String payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| PropertyNamedRefThatIsNotAReference1BoxedString(String data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| String | data()
validated payload | +| Any? | getData()
validated payload | + +## PropertyNamedRefThatIsNotAReference1BoxedList +data class PropertyNamedRefThatIsNotAReference1BoxedList
+implements [PropertyNamedRefThatIsNotAReference1Boxed](#propertynamedrefthatisnotareference1boxed) + +data class that stores validated List payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| PropertyNamedRefThatIsNotAReference1BoxedList(FrozenList data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| FrozenList | data()
validated payload | +| Any? | getData()
validated payload | + +## PropertyNamedRefThatIsNotAReference1BoxedMap +data class PropertyNamedRefThatIsNotAReference1BoxedMap
+implements [PropertyNamedRefThatIsNotAReference1Boxed](#propertynamedrefthatisnotareference1boxed) + +data class that stores validated Map payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| PropertyNamedRefThatIsNotAReference1BoxedMap([PropertyNamedRefThatIsNotAReferenceMap](#propertynamedrefthatisnotareferencemap) data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| [PropertyNamedRefThatIsNotAReferenceMap](#propertynamedrefthatisnotareferencemap) | data()
validated payload | +| Any? | getData()
validated payload | + +## PropertyNamedRefThatIsNotAReference1 +class PropertyNamedRefThatIsNotAReference1
+extends JsonSchema + +A schema class that validates payloads + +### Field Summary +| Modifier and Type | Field and Description | +| ----------------- | ---------------------- | +| Map> | properties = mapOf(
    "\$ref" to [Ref::class.java](#ref))
)
| + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| String | validate(arg: String, configuration: SchemaConfiguration) | +| Nothing? | validate(arg: Nothing?, configuration: SchemaConfiguration) | +| int | validate(arg: int, configuration: SchemaConfiguration) | +| long | validate(arg: long, configuration: SchemaConfiguration) | +| float | validate(arg: float, configuration: SchemaConfiguration) | +| double | validate(arg: double, configuration: SchemaConfiguration) | +| Number | validate(arg: Number, configuration: SchemaConfiguration) | +| boolean | validate(arg: boolean, configuration: SchemaConfiguration) | +| [PropertyNamedRefThatIsNotAReferenceMap](#propertynamedrefthatisnotareferencemap) | validate(arg: [Map<?, ?>](#propertynamedrefthatisnotareferencemapbuilder), configuration: SchemaConfiguration) | +| FrozenList | validate(arg: List<*>, configuration: SchemaConfiguration) | +| [PropertyNamedRefThatIsNotAReference1BoxedString](#propertynamedrefthatisnotareference1boxedstring) | validateAndBox(String, configuration: SchemaConfiguration) | +| [PropertyNamedRefThatIsNotAReference1BoxedVoid](#propertynamedrefthatisnotareference1boxedvoid) | validateAndBox(Nothing?, configuration: SchemaConfiguration) | +| [PropertyNamedRefThatIsNotAReference1BoxedNumber](#propertynamedrefthatisnotareference1boxednumber) | validateAndBox(Number, configuration: SchemaConfiguration) | +| [PropertyNamedRefThatIsNotAReference1BoxedBoolean](#propertynamedrefthatisnotareference1boxedboolean) | validateAndBox(boolean, configuration: SchemaConfiguration) | +| [PropertyNamedRefThatIsNotAReference1BoxedMap](#propertynamedrefthatisnotareference1boxedmap) | validateAndBox([Map<?, ?>](#propertynamedrefthatisnotareferencemapbuilder), configuration: SchemaConfiguration) | +| [PropertyNamedRefThatIsNotAReference1BoxedList](#propertynamedrefthatisnotareference1boxedlist) | validateAndBox(List<*>, configuration: SchemaConfiguration) | +| [PropertyNamedRefThatIsNotAReference1Boxed](#propertynamedrefthatisnotareference1boxed) | validateAndBox(Any?, configuration: SchemaConfiguration) | +| Any? | validate(arg: Any?, configuration: SchemaConfiguration) | + +## PropertyNamedRefThatIsNotAReferenceMapBuilder +class PropertyNamedRefThatIsNotAReferenceMapBuilder
+builder for `Map` + +A class that builds the Map input type + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| PropertyNamedRefThatIsNotAReferenceMapBuilder()
Creates a builder that contains an empty map | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| Map | build()
Returns map input that should be used with Schema.validate | +| [PropertyNamedRefThatIsNotAReferenceMapBuilder](#propertynamedrefthatisnotareferencemapbuilder) | reverseSolidusDollarSignRef(value: String) | +| [PropertyNamedRefThatIsNotAReferenceMapBuilder](#propertynamedrefthatisnotareferencemapbuilder) | additionalProperty(key: String, value: Nothing?) | +| [PropertyNamedRefThatIsNotAReferenceMapBuilder](#propertynamedrefthatisnotareferencemapbuilder) | additionalProperty(key: String, value: Boolean) | +| [PropertyNamedRefThatIsNotAReferenceMapBuilder](#propertynamedrefthatisnotareferencemapbuilder) | additionalProperty(key: String, value: String) | +| [PropertyNamedRefThatIsNotAReferenceMapBuilder](#propertynamedrefthatisnotareferencemapbuilder) | additionalProperty(key: String, value: Int) | +| [PropertyNamedRefThatIsNotAReferenceMapBuilder](#propertynamedrefthatisnotareferencemapbuilder) | additionalProperty(key: String, value: Float) | +| [PropertyNamedRefThatIsNotAReferenceMapBuilder](#propertynamedrefthatisnotareferencemapbuilder) | additionalProperty(key: String, value: Long) | +| [PropertyNamedRefThatIsNotAReferenceMapBuilder](#propertynamedrefthatisnotareferencemapbuilder) | additionalProperty(key: String, value: Double) | +| [PropertyNamedRefThatIsNotAReferenceMapBuilder](#propertynamedrefthatisnotareferencemapbuilder) | additionalProperty(key: String, value: List) | +| [PropertyNamedRefThatIsNotAReferenceMapBuilder](#propertynamedrefthatisnotareferencemapbuilder) | additionalProperty(key: String, value: Map) | + +## PropertyNamedRefThatIsNotAReferenceMap +class PropertyNamedRefThatIsNotAReferenceMap
+extends FrozenMap + +A class to store validated Map payloads + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| static [PropertyNamedRefThatIsNotAReferenceMap](#propertynamedrefthatisnotareferencemap) | of([Map](#propertynamedrefthatisnotareferencemapbuilder) arg, SchemaConfiguration configuration) | +| Any? | get(String key)
This schema has invalid Kotlin names so this method must be used when you access instance["\$ref"], | +| Any? | getAdditionalProperty(String name)
provides type safety for additional properties | + +## RefBoxed +sealed interface RefBoxed
+permits
+[RefBoxedString](#refboxedstring) + +sealed interface that stores validated payloads using boxed classes + +## RefBoxedString +data class RefBoxedString
+implements [RefBoxed](#refboxed) + +data class that stores validated String payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| RefBoxedString(String data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| String | data()
validated payload | +| Any? | getData()
validated payload | + +## Ref +class Ref
+extends StringJsonSchema.StringJsonSchema1 + +A schema class that validates payloads + +| Methods Inherited from class org.openapijsonschematools.client.schemas.StringJsonSchema.StringJsonSchema1 | +| ------------------------------------------------------------------ | +| validate | +| validateAndBox | + +[[Back to top]](#top) [[Back to Component Schemas]](../../../README.md#Component-Schemas) [[Back to README]](../../../README.md) diff --git a/samples/client/3_0_3_unit_test/kotlin/docs/components/schemas/RefInAdditionalproperties.md b/samples/client/3_0_3_unit_test/kotlin/docs/components/schemas/RefInAdditionalproperties.md new file mode 100644 index 00000000000..bbb9fea7c84 --- /dev/null +++ b/samples/client/3_0_3_unit_test/kotlin/docs/components/schemas/RefInAdditionalproperties.md @@ -0,0 +1,127 @@ +# RefInAdditionalproperties +org.openapijsonschematools.client.components.schemas.RefInAdditionalproperties.java +class RefInAdditionalproperties
+ +A class that contains necessary nested +- schema classes (which validate payloads), extends JsonSchema +- sealed interfaces which store validated payloads, Kotlin version of a sum type +- boxed classes which store validated payloads, sealed permits class implementations +- classes to store validated map payloads, extends FrozenMap +- classes to build inputs for map payloads + +## Nested Class Summary +| Modifier and Type | Class and Description | +| ----------------- | ---------------------- | +| sealed interface | [RefInAdditionalproperties.RefInAdditionalproperties1Boxed](#refinadditionalproperties1boxed)
sealed interface for validated payloads | +| record | [RefInAdditionalproperties.RefInAdditionalproperties1BoxedMap](#refinadditionalproperties1boxedmap)
boxed class to store validated Map payloads | +| static class | [RefInAdditionalproperties.RefInAdditionalproperties1](#refinadditionalproperties1)
schema class | +| static class | [RefInAdditionalproperties.RefInAdditionalpropertiesMapBuilder](#refinadditionalpropertiesmapbuilder)
builder for Map payloads | +| static class | [RefInAdditionalproperties.RefInAdditionalpropertiesMap](#refinadditionalpropertiesmap)
output class for Map payloads | + +## RefInAdditionalproperties1Boxed +sealed interface RefInAdditionalproperties1Boxed
+permits
+[RefInAdditionalproperties1BoxedMap](#refinadditionalproperties1boxedmap) + +sealed interface that stores validated payloads using boxed classes + +## RefInAdditionalproperties1BoxedMap +data class RefInAdditionalproperties1BoxedMap
+implements [RefInAdditionalproperties1Boxed](#refinadditionalproperties1boxed) + +data class that stores validated Map payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| RefInAdditionalproperties1BoxedMap([RefInAdditionalpropertiesMap](#refinadditionalpropertiesmap) data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| [RefInAdditionalpropertiesMap](#refinadditionalpropertiesmap) | data()
validated payload | +| Any? | getData()
validated payload | + +## RefInAdditionalproperties1 +class RefInAdditionalproperties1
+extends JsonSchema + +A schema class that validates payloads + +### Code Sample +``` +import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags; +import org.openapijsonschematools.client.configurations.SchemaConfiguration; +import org.openapijsonschematools.client.exceptions.ValidationException; +import org.openapijsonschematools.client.schemas.validation.MapUtils; +import org.openapijsonschematools.client.schemas.validation.FrozenList; +import org.openapijsonschematools.client.schemas.validation.FrozenMap; +import org.openapijsonschematools.client.components.schemas.RefInAdditionalproperties; + +import java.util.Arrays; +import java.util.List; +import java.util.AbstractMap; + +static final SchemaConfiguration configuration = new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().build()); + +// Map validation +RefInAdditionalproperties.RefInAdditionalpropertiesMap validatedPayload = + RefInAdditionalproperties.RefInAdditionalproperties1.validate( + new RefInAdditionalproperties.RefInAdditionalpropertiesMapBuilder() + .build(), + configuration +); +``` + +### Field Summary +| Modifier and Type | Field and Description | +| ----------------- | ---------------------- | +| Set> | type = setOf(Map::class.java) | +| Class | additionalProperties = [PropertyNamedRefThatIsNotAReference.PropertyNamedRefThatIsNotAReference1::class.java](../../components/schemas/PropertyNamedRefThatIsNotAReference.md#propertynamedrefthatisnotareference1) | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| [RefInAdditionalpropertiesMap](#refinadditionalpropertiesmap) | validate(arg: [Map<?, ?>](#refinadditionalpropertiesmapbuilder), configuration: SchemaConfiguration) | +| [RefInAdditionalproperties1BoxedMap](#refinadditionalproperties1boxedmap) | validateAndBox([Map<?, ?>](#refinadditionalpropertiesmapbuilder), configuration: SchemaConfiguration) | +| [RefInAdditionalproperties1Boxed](#refinadditionalproperties1boxed) | validateAndBox(Any?, configuration: SchemaConfiguration) | +| Any? | validate(arg: Any?, configuration: SchemaConfiguration) | + +## RefInAdditionalpropertiesMapBuilder +class RefInAdditionalpropertiesMapBuilder
+builder for `Map` + +A class that builds the Map input type + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| RefInAdditionalpropertiesMapBuilder()
Creates a builder that contains an empty map | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| Map | build()
Returns map input that should be used with Schema.validate | +| [RefInAdditionalpropertiesMapBuilder](#refinadditionalpropertiesmapbuilder) | additionalProperty(key: String, value: Nothing?) | +| [RefInAdditionalpropertiesMapBuilder](#refinadditionalpropertiesmapbuilder) | additionalProperty(key: String, value: Boolean) | +| [RefInAdditionalpropertiesMapBuilder](#refinadditionalpropertiesmapbuilder) | additionalProperty(key: String, value: String) | +| [RefInAdditionalpropertiesMapBuilder](#refinadditionalpropertiesmapbuilder) | additionalProperty(key: String, value: Int) | +| [RefInAdditionalpropertiesMapBuilder](#refinadditionalpropertiesmapbuilder) | additionalProperty(key: String, value: Float) | +| [RefInAdditionalpropertiesMapBuilder](#refinadditionalpropertiesmapbuilder) | additionalProperty(key: String, value: Long) | +| [RefInAdditionalpropertiesMapBuilder](#refinadditionalpropertiesmapbuilder) | additionalProperty(key: String, value: Double) | +| [RefInAdditionalpropertiesMapBuilder](#refinadditionalpropertiesmapbuilder) | additionalProperty(key: String, value: List) | +| [RefInAdditionalpropertiesMapBuilder](#refinadditionalpropertiesmapbuilder) | additionalProperty(key: String, value: Map) | + +## RefInAdditionalpropertiesMap +class RefInAdditionalpropertiesMap
+extends FrozenMap + +A class to store validated Map payloads + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| static [RefInAdditionalpropertiesMap](#refinadditionalpropertiesmap) | of([Map](#refinadditionalpropertiesmapbuilder) arg, SchemaConfiguration configuration) | +| Any? | getAdditionalProperty(String name)
provides type safety for additional properties | + +[[Back to top]](#top) [[Back to Component Schemas]](../../../README.md#Component-Schemas) [[Back to README]](../../../README.md) diff --git a/samples/client/3_0_3_unit_test/kotlin/docs/components/schemas/RefInAllof.md b/samples/client/3_0_3_unit_test/kotlin/docs/components/schemas/RefInAllof.md new file mode 100644 index 00000000000..7342790e9f3 --- /dev/null +++ b/samples/client/3_0_3_unit_test/kotlin/docs/components/schemas/RefInAllof.md @@ -0,0 +1,169 @@ +# RefInAllof +org.openapijsonschematools.client.components.schemas.RefInAllof.java +class RefInAllof
+ +A class that contains necessary nested +- schema classes (which validate payloads), extends JsonSchema +- sealed interfaces which store validated payloads, Kotlin version of a sum type +- boxed classes which store validated payloads, sealed permits class implementations + +## Nested Class Summary +| Modifier and Type | Class and Description | +| ----------------- | ---------------------- | +| sealed interface | [RefInAllof.RefInAllof1Boxed](#refinallof1boxed)
sealed interface for validated payloads | +| record | [RefInAllof.RefInAllof1BoxedVoid](#refinallof1boxedvoid)
boxed class to store validated null payloads | +| record | [RefInAllof.RefInAllof1BoxedBoolean](#refinallof1boxedboolean)
boxed class to store validated boolean payloads | +| record | [RefInAllof.RefInAllof1BoxedNumber](#refinallof1boxednumber)
boxed class to store validated Number payloads | +| record | [RefInAllof.RefInAllof1BoxedString](#refinallof1boxedstring)
boxed class to store validated String payloads | +| record | [RefInAllof.RefInAllof1BoxedList](#refinallof1boxedlist)
boxed class to store validated List payloads | +| record | [RefInAllof.RefInAllof1BoxedMap](#refinallof1boxedmap)
boxed class to store validated Map payloads | +| static class | [RefInAllof.RefInAllof1](#refinallof1)
schema class | + +## RefInAllof1Boxed +sealed interface RefInAllof1Boxed
+permits
+[RefInAllof1BoxedVoid](#refinallof1boxedvoid), +[RefInAllof1BoxedBoolean](#refinallof1boxedboolean), +[RefInAllof1BoxedNumber](#refinallof1boxednumber), +[RefInAllof1BoxedString](#refinallof1boxedstring), +[RefInAllof1BoxedList](#refinallof1boxedlist), +[RefInAllof1BoxedMap](#refinallof1boxedmap) + +sealed interface that stores validated payloads using boxed classes + +## RefInAllof1BoxedVoid +data class RefInAllof1BoxedVoid
+implements [RefInAllof1Boxed](#refinallof1boxed) + +data class that stores validated null payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| RefInAllof1BoxedVoid(Nothing? data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| Nothing? | data()
validated payload | +| Any? | getData()
validated payload | + +## RefInAllof1BoxedBoolean +data class RefInAllof1BoxedBoolean
+implements [RefInAllof1Boxed](#refinallof1boxed) + +record that stores validated boolean payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| RefInAllof1BoxedBoolean(boolean data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| boolean | data()
validated payload | +| Any? | getData()
validated payload | + +## RefInAllof1BoxedNumber +data class RefInAllof1BoxedNumber
+implements [RefInAllof1Boxed](#refinallof1boxed) + +data class that stores validated Number payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| RefInAllof1BoxedNumber(Number data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| Number | data()
validated payload | +| Any? | getData()
validated payload | + +## RefInAllof1BoxedString +data class RefInAllof1BoxedString
+implements [RefInAllof1Boxed](#refinallof1boxed) + +data class that stores validated String payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| RefInAllof1BoxedString(String data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| String | data()
validated payload | +| Any? | getData()
validated payload | + +## RefInAllof1BoxedList +data class RefInAllof1BoxedList
+implements [RefInAllof1Boxed](#refinallof1boxed) + +data class that stores validated List payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| RefInAllof1BoxedList(FrozenList data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| FrozenList | data()
validated payload | +| Any? | getData()
validated payload | + +## RefInAllof1BoxedMap +data class RefInAllof1BoxedMap
+implements [RefInAllof1Boxed](#refinallof1boxed) + +data class that stores validated Map payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| RefInAllof1BoxedMap(FrozenMap data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| FrozenMap | data()
validated payload | +| Any? | getData()
validated payload | + +## RefInAllof1 +class RefInAllof1
+extends JsonSchema + +A schema class that validates payloads + +### Field Summary +| Modifier and Type | Field and Description | +| ----------------- | ---------------------- | +| List> | allOf = listOf(
    [PropertyNamedRefThatIsNotAReference.PropertyNamedRefThatIsNotAReference1::class.java](../../components/schemas/PropertyNamedRefThatIsNotAReference.md#propertynamedrefthatisnotareference1)
;)
| + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| String | validate(arg: String, configuration: SchemaConfiguration) | +| Nothing? | validate(arg: Nothing?, configuration: SchemaConfiguration) | +| int | validate(arg: int, configuration: SchemaConfiguration) | +| long | validate(arg: long, configuration: SchemaConfiguration) | +| float | validate(arg: float, configuration: SchemaConfiguration) | +| double | validate(arg: double, configuration: SchemaConfiguration) | +| Number | validate(arg: Number, configuration: SchemaConfiguration) | +| boolean | validate(arg: boolean, configuration: SchemaConfiguration) | +| FrozenMap | validate(arg: Map<?, ?>, configuration: SchemaConfiguration) | +| FrozenList | validate(arg: List<*>, configuration: SchemaConfiguration) | +| [RefInAllof1BoxedString](#refinallof1boxedstring) | validateAndBox(String, configuration: SchemaConfiguration) | +| [RefInAllof1BoxedVoid](#refinallof1boxedvoid) | validateAndBox(Nothing?, configuration: SchemaConfiguration) | +| [RefInAllof1BoxedNumber](#refinallof1boxednumber) | validateAndBox(Number, configuration: SchemaConfiguration) | +| [RefInAllof1BoxedBoolean](#refinallof1boxedboolean) | validateAndBox(boolean, configuration: SchemaConfiguration) | +| [RefInAllof1BoxedMap](#refinallof1boxedmap) | validateAndBox(Map<?, ?>, configuration: SchemaConfiguration) | +| [RefInAllof1BoxedList](#refinallof1boxedlist) | validateAndBox(List<*>, configuration: SchemaConfiguration) | +| [RefInAllof1Boxed](#refinallof1boxed) | validateAndBox(Any?, configuration: SchemaConfiguration) | +| Any? | validate(arg: Any?, configuration: SchemaConfiguration) | + +[[Back to top]](#top) [[Back to Component Schemas]](../../../README.md#Component-Schemas) [[Back to README]](../../../README.md) diff --git a/samples/client/3_0_3_unit_test/kotlin/docs/components/schemas/RefInAnyof.md b/samples/client/3_0_3_unit_test/kotlin/docs/components/schemas/RefInAnyof.md new file mode 100644 index 00000000000..f7b064e8afc --- /dev/null +++ b/samples/client/3_0_3_unit_test/kotlin/docs/components/schemas/RefInAnyof.md @@ -0,0 +1,169 @@ +# RefInAnyof +org.openapijsonschematools.client.components.schemas.RefInAnyof.java +class RefInAnyof
+ +A class that contains necessary nested +- schema classes (which validate payloads), extends JsonSchema +- sealed interfaces which store validated payloads, Kotlin version of a sum type +- boxed classes which store validated payloads, sealed permits class implementations + +## Nested Class Summary +| Modifier and Type | Class and Description | +| ----------------- | ---------------------- | +| sealed interface | [RefInAnyof.RefInAnyof1Boxed](#refinanyof1boxed)
sealed interface for validated payloads | +| record | [RefInAnyof.RefInAnyof1BoxedVoid](#refinanyof1boxedvoid)
boxed class to store validated null payloads | +| record | [RefInAnyof.RefInAnyof1BoxedBoolean](#refinanyof1boxedboolean)
boxed class to store validated boolean payloads | +| record | [RefInAnyof.RefInAnyof1BoxedNumber](#refinanyof1boxednumber)
boxed class to store validated Number payloads | +| record | [RefInAnyof.RefInAnyof1BoxedString](#refinanyof1boxedstring)
boxed class to store validated String payloads | +| record | [RefInAnyof.RefInAnyof1BoxedList](#refinanyof1boxedlist)
boxed class to store validated List payloads | +| record | [RefInAnyof.RefInAnyof1BoxedMap](#refinanyof1boxedmap)
boxed class to store validated Map payloads | +| static class | [RefInAnyof.RefInAnyof1](#refinanyof1)
schema class | + +## RefInAnyof1Boxed +sealed interface RefInAnyof1Boxed
+permits
+[RefInAnyof1BoxedVoid](#refinanyof1boxedvoid), +[RefInAnyof1BoxedBoolean](#refinanyof1boxedboolean), +[RefInAnyof1BoxedNumber](#refinanyof1boxednumber), +[RefInAnyof1BoxedString](#refinanyof1boxedstring), +[RefInAnyof1BoxedList](#refinanyof1boxedlist), +[RefInAnyof1BoxedMap](#refinanyof1boxedmap) + +sealed interface that stores validated payloads using boxed classes + +## RefInAnyof1BoxedVoid +data class RefInAnyof1BoxedVoid
+implements [RefInAnyof1Boxed](#refinanyof1boxed) + +data class that stores validated null payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| RefInAnyof1BoxedVoid(Nothing? data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| Nothing? | data()
validated payload | +| Any? | getData()
validated payload | + +## RefInAnyof1BoxedBoolean +data class RefInAnyof1BoxedBoolean
+implements [RefInAnyof1Boxed](#refinanyof1boxed) + +record that stores validated boolean payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| RefInAnyof1BoxedBoolean(boolean data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| boolean | data()
validated payload | +| Any? | getData()
validated payload | + +## RefInAnyof1BoxedNumber +data class RefInAnyof1BoxedNumber
+implements [RefInAnyof1Boxed](#refinanyof1boxed) + +data class that stores validated Number payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| RefInAnyof1BoxedNumber(Number data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| Number | data()
validated payload | +| Any? | getData()
validated payload | + +## RefInAnyof1BoxedString +data class RefInAnyof1BoxedString
+implements [RefInAnyof1Boxed](#refinanyof1boxed) + +data class that stores validated String payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| RefInAnyof1BoxedString(String data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| String | data()
validated payload | +| Any? | getData()
validated payload | + +## RefInAnyof1BoxedList +data class RefInAnyof1BoxedList
+implements [RefInAnyof1Boxed](#refinanyof1boxed) + +data class that stores validated List payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| RefInAnyof1BoxedList(FrozenList data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| FrozenList | data()
validated payload | +| Any? | getData()
validated payload | + +## RefInAnyof1BoxedMap +data class RefInAnyof1BoxedMap
+implements [RefInAnyof1Boxed](#refinanyof1boxed) + +data class that stores validated Map payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| RefInAnyof1BoxedMap(FrozenMap data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| FrozenMap | data()
validated payload | +| Any? | getData()
validated payload | + +## RefInAnyof1 +class RefInAnyof1
+extends JsonSchema + +A schema class that validates payloads + +### Field Summary +| Modifier and Type | Field and Description | +| ----------------- | ---------------------- | +| List> | anyOf = listOf(
    [PropertyNamedRefThatIsNotAReference.PropertyNamedRefThatIsNotAReference1::class.java](../../components/schemas/PropertyNamedRefThatIsNotAReference.md#propertynamedrefthatisnotareference1)
)
| + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| String | validate(arg: String, configuration: SchemaConfiguration) | +| Nothing? | validate(arg: Nothing?, configuration: SchemaConfiguration) | +| int | validate(arg: int, configuration: SchemaConfiguration) | +| long | validate(arg: long, configuration: SchemaConfiguration) | +| float | validate(arg: float, configuration: SchemaConfiguration) | +| double | validate(arg: double, configuration: SchemaConfiguration) | +| Number | validate(arg: Number, configuration: SchemaConfiguration) | +| boolean | validate(arg: boolean, configuration: SchemaConfiguration) | +| FrozenMap | validate(arg: Map<?, ?>, configuration: SchemaConfiguration) | +| FrozenList | validate(arg: List<*>, configuration: SchemaConfiguration) | +| [RefInAnyof1BoxedString](#refinanyof1boxedstring) | validateAndBox(String, configuration: SchemaConfiguration) | +| [RefInAnyof1BoxedVoid](#refinanyof1boxedvoid) | validateAndBox(Nothing?, configuration: SchemaConfiguration) | +| [RefInAnyof1BoxedNumber](#refinanyof1boxednumber) | validateAndBox(Number, configuration: SchemaConfiguration) | +| [RefInAnyof1BoxedBoolean](#refinanyof1boxedboolean) | validateAndBox(boolean, configuration: SchemaConfiguration) | +| [RefInAnyof1BoxedMap](#refinanyof1boxedmap) | validateAndBox(Map<?, ?>, configuration: SchemaConfiguration) | +| [RefInAnyof1BoxedList](#refinanyof1boxedlist) | validateAndBox(List<*>, configuration: SchemaConfiguration) | +| [RefInAnyof1Boxed](#refinanyof1boxed) | validateAndBox(Any?, configuration: SchemaConfiguration) | +| Any? | validate(arg: Any?, configuration: SchemaConfiguration) | + +[[Back to top]](#top) [[Back to Component Schemas]](../../../README.md#Component-Schemas) [[Back to README]](../../../README.md) diff --git a/samples/client/3_0_3_unit_test/kotlin/docs/components/schemas/RefInItems.md b/samples/client/3_0_3_unit_test/kotlin/docs/components/schemas/RefInItems.md new file mode 100644 index 00000000000..713b342f973 --- /dev/null +++ b/samples/client/3_0_3_unit_test/kotlin/docs/components/schemas/RefInItems.md @@ -0,0 +1,127 @@ +# RefInItems +org.openapijsonschematools.client.components.schemas.RefInItems.java +class RefInItems
+ +A class that contains necessary nested +- schema classes (which validate payloads), extends JsonSchema +- sealed interfaces which store validated payloads, Kotlin version of a sum type +- boxed classes which store validated payloads, sealed permits class implementations +- classes to store validated list payloads, extends FrozenList +- classes to build inputs for list payloads + +## Nested Class Summary +| Modifier and Type | Class and Description | +| ----------------- | ---------------------- | +| sealed interface | [RefInItems.RefInItems1Boxed](#refinitems1boxed)
sealed interface for validated payloads | +| record | [RefInItems.RefInItems1BoxedList](#refinitems1boxedlist)
boxed class to store validated List payloads | +| static class | [RefInItems.RefInItems1](#refinitems1)
schema class | +| static class | [RefInItems.RefInItemsListBuilder](#refinitemslistbuilder)
builder for List payloads | +| static class | [RefInItems.RefInItemsList](#refinitemslist)
output class for List payloads | + +## RefInItems1Boxed +sealed interface RefInItems1Boxed
+permits
+[RefInItems1BoxedList](#refinitems1boxedlist) + +sealed interface that stores validated payloads using boxed classes + +## RefInItems1BoxedList +data class RefInItems1BoxedList
+implements [RefInItems1Boxed](#refinitems1boxed) + +data class that stores validated List payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| RefInItems1BoxedList([RefInItemsList](#refinitemslist) data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| [RefInItemsList](#refinitemslist) | data()
validated payload | +| Any? | getData()
validated payload | + +## RefInItems1 +class RefInItems1
+extends JsonSchema + +A schema class that validates payloads + +### Code Sample +``` +import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags; +import org.openapijsonschematools.client.configurations.SchemaConfiguration; +import org.openapijsonschematools.client.exceptions.ValidationException; +import org.openapijsonschematools.client.schemas.validation.MapUtils; +import org.openapijsonschematools.client.schemas.validation.FrozenList; +import org.openapijsonschematools.client.schemas.validation.FrozenMap; +import org.openapijsonschematools.client.components.schemas.RefInItems; + +import java.util.Arrays; +import java.util.List; +import java.util.AbstractMap; + +static final SchemaConfiguration configuration = new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().build()); + +// List validation +RefInItems.RefInItemsList validatedPayload = + RefInItems.RefInItems1.validate( + new RefInItems.RefInItemsListBuilder() + .build(), + configuration +); +``` + +### Field Summary +| Modifier and Type | Field and Description | +| ----------------- | ---------------------- | +| Set> | type = setOf(List::class.java) | +| Class | items = [PropertyNamedRefThatIsNotAReference.PropertyNamedRefThatIsNotAReference1::class.java](../../components/schemas/PropertyNamedRefThatIsNotAReference.md#propertynamedrefthatisnotareference1) | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| [RefInItemsList](#refinitemslist) | validate(arg: [List<*>](#refinitemslistbuilder), configuration: SchemaConfiguration) | +| [RefInItems1BoxedList](#refinitems1boxedlist) | validateAndBox([List<*>](#refinitemslistbuilder), configuration: SchemaConfiguration) | +| [RefInItems1Boxed](#refinitems1boxed) | validateAndBox(Any?, configuration: SchemaConfiguration) | +| Any? | validate(arg: Any?, configuration: SchemaConfiguration) | + +## RefInItemsListBuilder +class RefInItemsListBuilder
+builder for `List` + +A class that builds the List input type + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| RefInItemsListBuilder()
Creates an empty list | +| RefInItemsListBuilder(List items)
Stores the items in a list | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| RefInItemsListBuilder | add(item: Nothing?) | +| RefInItemsListBuilder | add(item: Boolean) | +| RefInItemsListBuilder | add(item: String) | +| RefInItemsListBuilder | add(item: Int) | +| RefInItemsListBuilder | add(item: Float) | +| RefInItemsListBuilder | add(item: Long) | +| RefInItemsListBuilder | add(item: Double) | +| RefInItemsListBuilder | add(item: List) | +| RefInItemsListBuilder | add(item: Map) | +| List | build()
Returns list input that should be used with Schema.validate | + +## RefInItemsList +class RefInItemsList
+extends `FrozenList` + +A class to store validated List payloads + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| static [RefInItemsList](#refinitemslist) | of([List](#refinitemslistbuilder) arg, SchemaConfiguration configuration) | + +[[Back to top]](#top) [[Back to Component Schemas]](../../../README.md#Component-Schemas) [[Back to README]](../../../README.md) diff --git a/samples/client/3_0_3_unit_test/kotlin/docs/components/schemas/RefInNot.md b/samples/client/3_0_3_unit_test/kotlin/docs/components/schemas/RefInNot.md new file mode 100644 index 00000000000..a7ff963604f --- /dev/null +++ b/samples/client/3_0_3_unit_test/kotlin/docs/components/schemas/RefInNot.md @@ -0,0 +1,169 @@ +# RefInNot +org.openapijsonschematools.client.components.schemas.RefInNot.java +class RefInNot
+ +A class that contains necessary nested +- schema classes (which validate payloads), extends JsonSchema +- sealed interfaces which store validated payloads, Kotlin version of a sum type +- boxed classes which store validated payloads, sealed permits class implementations + +## Nested Class Summary +| Modifier and Type | Class and Description | +| ----------------- | ---------------------- | +| sealed interface | [RefInNot.RefInNot1Boxed](#refinnot1boxed)
sealed interface for validated payloads | +| record | [RefInNot.RefInNot1BoxedVoid](#refinnot1boxedvoid)
boxed class to store validated null payloads | +| record | [RefInNot.RefInNot1BoxedBoolean](#refinnot1boxedboolean)
boxed class to store validated boolean payloads | +| record | [RefInNot.RefInNot1BoxedNumber](#refinnot1boxednumber)
boxed class to store validated Number payloads | +| record | [RefInNot.RefInNot1BoxedString](#refinnot1boxedstring)
boxed class to store validated String payloads | +| record | [RefInNot.RefInNot1BoxedList](#refinnot1boxedlist)
boxed class to store validated List payloads | +| record | [RefInNot.RefInNot1BoxedMap](#refinnot1boxedmap)
boxed class to store validated Map payloads | +| static class | [RefInNot.RefInNot1](#refinnot1)
schema class | + +## RefInNot1Boxed +sealed interface RefInNot1Boxed
+permits
+[RefInNot1BoxedVoid](#refinnot1boxedvoid), +[RefInNot1BoxedBoolean](#refinnot1boxedboolean), +[RefInNot1BoxedNumber](#refinnot1boxednumber), +[RefInNot1BoxedString](#refinnot1boxedstring), +[RefInNot1BoxedList](#refinnot1boxedlist), +[RefInNot1BoxedMap](#refinnot1boxedmap) + +sealed interface that stores validated payloads using boxed classes + +## RefInNot1BoxedVoid +data class RefInNot1BoxedVoid
+implements [RefInNot1Boxed](#refinnot1boxed) + +data class that stores validated null payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| RefInNot1BoxedVoid(Nothing? data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| Nothing? | data()
validated payload | +| Any? | getData()
validated payload | + +## RefInNot1BoxedBoolean +data class RefInNot1BoxedBoolean
+implements [RefInNot1Boxed](#refinnot1boxed) + +record that stores validated boolean payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| RefInNot1BoxedBoolean(boolean data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| boolean | data()
validated payload | +| Any? | getData()
validated payload | + +## RefInNot1BoxedNumber +data class RefInNot1BoxedNumber
+implements [RefInNot1Boxed](#refinnot1boxed) + +data class that stores validated Number payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| RefInNot1BoxedNumber(Number data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| Number | data()
validated payload | +| Any? | getData()
validated payload | + +## RefInNot1BoxedString +data class RefInNot1BoxedString
+implements [RefInNot1Boxed](#refinnot1boxed) + +data class that stores validated String payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| RefInNot1BoxedString(String data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| String | data()
validated payload | +| Any? | getData()
validated payload | + +## RefInNot1BoxedList +data class RefInNot1BoxedList
+implements [RefInNot1Boxed](#refinnot1boxed) + +data class that stores validated List payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| RefInNot1BoxedList(FrozenList data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| FrozenList | data()
validated payload | +| Any? | getData()
validated payload | + +## RefInNot1BoxedMap +data class RefInNot1BoxedMap
+implements [RefInNot1Boxed](#refinnot1boxed) + +data class that stores validated Map payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| RefInNot1BoxedMap(FrozenMap data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| FrozenMap | data()
validated payload | +| Any? | getData()
validated payload | + +## RefInNot1 +class RefInNot1
+extends JsonSchema + +A schema class that validates payloads + +### Field Summary +| Modifier and Type | Field and Description | +| ----------------- | ---------------------- | +| Class | not = [PropertyNamedRefThatIsNotAReference.PropertyNamedRefThatIsNotAReference1::class.java](../../components/schemas/PropertyNamedRefThatIsNotAReference.md#propertynamedrefthatisnotareference1) | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| String | validate(arg: String, configuration: SchemaConfiguration) | +| Nothing? | validate(arg: Nothing?, configuration: SchemaConfiguration) | +| int | validate(arg: int, configuration: SchemaConfiguration) | +| long | validate(arg: long, configuration: SchemaConfiguration) | +| float | validate(arg: float, configuration: SchemaConfiguration) | +| double | validate(arg: double, configuration: SchemaConfiguration) | +| Number | validate(arg: Number, configuration: SchemaConfiguration) | +| boolean | validate(arg: boolean, configuration: SchemaConfiguration) | +| FrozenMap | validate(arg: Map<?, ?>, configuration: SchemaConfiguration) | +| FrozenList | validate(arg: List<*>, configuration: SchemaConfiguration) | +| [RefInNot1BoxedString](#refinnot1boxedstring) | validateAndBox(String, configuration: SchemaConfiguration) | +| [RefInNot1BoxedVoid](#refinnot1boxedvoid) | validateAndBox(Nothing?, configuration: SchemaConfiguration) | +| [RefInNot1BoxedNumber](#refinnot1boxednumber) | validateAndBox(Number, configuration: SchemaConfiguration) | +| [RefInNot1BoxedBoolean](#refinnot1boxedboolean) | validateAndBox(boolean, configuration: SchemaConfiguration) | +| [RefInNot1BoxedMap](#refinnot1boxedmap) | validateAndBox(Map<?, ?>, configuration: SchemaConfiguration) | +| [RefInNot1BoxedList](#refinnot1boxedlist) | validateAndBox(List<*>, configuration: SchemaConfiguration) | +| [RefInNot1Boxed](#refinnot1boxed) | validateAndBox(Any?, configuration: SchemaConfiguration) | +| Any? | validate(arg: Any?, configuration: SchemaConfiguration) | + +[[Back to top]](#top) [[Back to Component Schemas]](../../../README.md#Component-Schemas) [[Back to README]](../../../README.md) diff --git a/samples/client/3_0_3_unit_test/kotlin/docs/components/schemas/RefInOneof.md b/samples/client/3_0_3_unit_test/kotlin/docs/components/schemas/RefInOneof.md new file mode 100644 index 00000000000..641ff36e8c5 --- /dev/null +++ b/samples/client/3_0_3_unit_test/kotlin/docs/components/schemas/RefInOneof.md @@ -0,0 +1,169 @@ +# RefInOneof +org.openapijsonschematools.client.components.schemas.RefInOneof.java +class RefInOneof
+ +A class that contains necessary nested +- schema classes (which validate payloads), extends JsonSchema +- sealed interfaces which store validated payloads, Kotlin version of a sum type +- boxed classes which store validated payloads, sealed permits class implementations + +## Nested Class Summary +| Modifier and Type | Class and Description | +| ----------------- | ---------------------- | +| sealed interface | [RefInOneof.RefInOneof1Boxed](#refinoneof1boxed)
sealed interface for validated payloads | +| record | [RefInOneof.RefInOneof1BoxedVoid](#refinoneof1boxedvoid)
boxed class to store validated null payloads | +| record | [RefInOneof.RefInOneof1BoxedBoolean](#refinoneof1boxedboolean)
boxed class to store validated boolean payloads | +| record | [RefInOneof.RefInOneof1BoxedNumber](#refinoneof1boxednumber)
boxed class to store validated Number payloads | +| record | [RefInOneof.RefInOneof1BoxedString](#refinoneof1boxedstring)
boxed class to store validated String payloads | +| record | [RefInOneof.RefInOneof1BoxedList](#refinoneof1boxedlist)
boxed class to store validated List payloads | +| record | [RefInOneof.RefInOneof1BoxedMap](#refinoneof1boxedmap)
boxed class to store validated Map payloads | +| static class | [RefInOneof.RefInOneof1](#refinoneof1)
schema class | + +## RefInOneof1Boxed +sealed interface RefInOneof1Boxed
+permits
+[RefInOneof1BoxedVoid](#refinoneof1boxedvoid), +[RefInOneof1BoxedBoolean](#refinoneof1boxedboolean), +[RefInOneof1BoxedNumber](#refinoneof1boxednumber), +[RefInOneof1BoxedString](#refinoneof1boxedstring), +[RefInOneof1BoxedList](#refinoneof1boxedlist), +[RefInOneof1BoxedMap](#refinoneof1boxedmap) + +sealed interface that stores validated payloads using boxed classes + +## RefInOneof1BoxedVoid +data class RefInOneof1BoxedVoid
+implements [RefInOneof1Boxed](#refinoneof1boxed) + +data class that stores validated null payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| RefInOneof1BoxedVoid(Nothing? data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| Nothing? | data()
validated payload | +| Any? | getData()
validated payload | + +## RefInOneof1BoxedBoolean +data class RefInOneof1BoxedBoolean
+implements [RefInOneof1Boxed](#refinoneof1boxed) + +record that stores validated boolean payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| RefInOneof1BoxedBoolean(boolean data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| boolean | data()
validated payload | +| Any? | getData()
validated payload | + +## RefInOneof1BoxedNumber +data class RefInOneof1BoxedNumber
+implements [RefInOneof1Boxed](#refinoneof1boxed) + +data class that stores validated Number payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| RefInOneof1BoxedNumber(Number data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| Number | data()
validated payload | +| Any? | getData()
validated payload | + +## RefInOneof1BoxedString +data class RefInOneof1BoxedString
+implements [RefInOneof1Boxed](#refinoneof1boxed) + +data class that stores validated String payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| RefInOneof1BoxedString(String data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| String | data()
validated payload | +| Any? | getData()
validated payload | + +## RefInOneof1BoxedList +data class RefInOneof1BoxedList
+implements [RefInOneof1Boxed](#refinoneof1boxed) + +data class that stores validated List payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| RefInOneof1BoxedList(FrozenList data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| FrozenList | data()
validated payload | +| Any? | getData()
validated payload | + +## RefInOneof1BoxedMap +data class RefInOneof1BoxedMap
+implements [RefInOneof1Boxed](#refinoneof1boxed) + +data class that stores validated Map payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| RefInOneof1BoxedMap(FrozenMap data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| FrozenMap | data()
validated payload | +| Any? | getData()
validated payload | + +## RefInOneof1 +class RefInOneof1
+extends JsonSchema + +A schema class that validates payloads + +### Field Summary +| Modifier and Type | Field and Description | +| ----------------- | ---------------------- | +| List> | oneOf = listOf(
    [PropertyNamedRefThatIsNotAReference.PropertyNamedRefThatIsNotAReference1::class.java](../../components/schemas/PropertyNamedRefThatIsNotAReference.md#propertynamedrefthatisnotareference1)
))
| + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| String | validate(arg: String, configuration: SchemaConfiguration) | +| Nothing? | validate(arg: Nothing?, configuration: SchemaConfiguration) | +| int | validate(arg: int, configuration: SchemaConfiguration) | +| long | validate(arg: long, configuration: SchemaConfiguration) | +| float | validate(arg: float, configuration: SchemaConfiguration) | +| double | validate(arg: double, configuration: SchemaConfiguration) | +| Number | validate(arg: Number, configuration: SchemaConfiguration) | +| boolean | validate(arg: boolean, configuration: SchemaConfiguration) | +| FrozenMap | validate(arg: Map<?, ?>, configuration: SchemaConfiguration) | +| FrozenList | validate(arg: List<*>, configuration: SchemaConfiguration) | +| [RefInOneof1BoxedString](#refinoneof1boxedstring) | validateAndBox(String, configuration: SchemaConfiguration) | +| [RefInOneof1BoxedVoid](#refinoneof1boxedvoid) | validateAndBox(Nothing?, configuration: SchemaConfiguration) | +| [RefInOneof1BoxedNumber](#refinoneof1boxednumber) | validateAndBox(Number, configuration: SchemaConfiguration) | +| [RefInOneof1BoxedBoolean](#refinoneof1boxedboolean) | validateAndBox(boolean, configuration: SchemaConfiguration) | +| [RefInOneof1BoxedMap](#refinoneof1boxedmap) | validateAndBox(Map<?, ?>, configuration: SchemaConfiguration) | +| [RefInOneof1BoxedList](#refinoneof1boxedlist) | validateAndBox(List<*>, configuration: SchemaConfiguration) | +| [RefInOneof1Boxed](#refinoneof1boxed) | validateAndBox(Any?, configuration: SchemaConfiguration) | +| Any? | validate(arg: Any?, configuration: SchemaConfiguration) | + +[[Back to top]](#top) [[Back to Component Schemas]](../../../README.md#Component-Schemas) [[Back to README]](../../../README.md) diff --git a/samples/client/3_0_3_unit_test/kotlin/docs/components/schemas/RefInProperty.md b/samples/client/3_0_3_unit_test/kotlin/docs/components/schemas/RefInProperty.md new file mode 100644 index 00000000000..b7402792e0e --- /dev/null +++ b/samples/client/3_0_3_unit_test/kotlin/docs/components/schemas/RefInProperty.md @@ -0,0 +1,220 @@ +# RefInProperty +org.openapijsonschematools.client.components.schemas.RefInProperty.java +class RefInProperty
+ +A class that contains necessary nested +- schema classes (which validate payloads), extends JsonSchema +- sealed interfaces which store validated payloads, Kotlin version of a sum type +- boxed classes which store validated payloads, sealed permits class implementations +- classes to store validated map payloads, extends FrozenMap +- classes to build inputs for map payloads + +## Nested Class Summary +| Modifier and Type | Class and Description | +| ----------------- | ---------------------- | +| sealed interface | [RefInProperty.RefInProperty1Boxed](#refinproperty1boxed)
sealed interface for validated payloads | +| record | [RefInProperty.RefInProperty1BoxedVoid](#refinproperty1boxedvoid)
boxed class to store validated null payloads | +| record | [RefInProperty.RefInProperty1BoxedBoolean](#refinproperty1boxedboolean)
boxed class to store validated boolean payloads | +| record | [RefInProperty.RefInProperty1BoxedNumber](#refinproperty1boxednumber)
boxed class to store validated Number payloads | +| record | [RefInProperty.RefInProperty1BoxedString](#refinproperty1boxedstring)
boxed class to store validated String payloads | +| record | [RefInProperty.RefInProperty1BoxedList](#refinproperty1boxedlist)
boxed class to store validated List payloads | +| record | [RefInProperty.RefInProperty1BoxedMap](#refinproperty1boxedmap)
boxed class to store validated Map payloads | +| static class | [RefInProperty.RefInProperty1](#refinproperty1)
schema class | +| static class | [RefInProperty.RefInPropertyMapBuilder](#refinpropertymapbuilder)
builder for Map payloads | +| static class | [RefInProperty.RefInPropertyMap](#refinpropertymap)
output class for Map payloads | + +## RefInProperty1Boxed +sealed interface RefInProperty1Boxed
+permits
+[RefInProperty1BoxedVoid](#refinproperty1boxedvoid), +[RefInProperty1BoxedBoolean](#refinproperty1boxedboolean), +[RefInProperty1BoxedNumber](#refinproperty1boxednumber), +[RefInProperty1BoxedString](#refinproperty1boxedstring), +[RefInProperty1BoxedList](#refinproperty1boxedlist), +[RefInProperty1BoxedMap](#refinproperty1boxedmap) + +sealed interface that stores validated payloads using boxed classes + +## RefInProperty1BoxedVoid +data class RefInProperty1BoxedVoid
+implements [RefInProperty1Boxed](#refinproperty1boxed) + +data class that stores validated null payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| RefInProperty1BoxedVoid(Nothing? data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| Nothing? | data()
validated payload | +| Any? | getData()
validated payload | + +## RefInProperty1BoxedBoolean +data class RefInProperty1BoxedBoolean
+implements [RefInProperty1Boxed](#refinproperty1boxed) + +record that stores validated boolean payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| RefInProperty1BoxedBoolean(boolean data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| boolean | data()
validated payload | +| Any? | getData()
validated payload | + +## RefInProperty1BoxedNumber +data class RefInProperty1BoxedNumber
+implements [RefInProperty1Boxed](#refinproperty1boxed) + +data class that stores validated Number payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| RefInProperty1BoxedNumber(Number data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| Number | data()
validated payload | +| Any? | getData()
validated payload | + +## RefInProperty1BoxedString +data class RefInProperty1BoxedString
+implements [RefInProperty1Boxed](#refinproperty1boxed) + +data class that stores validated String payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| RefInProperty1BoxedString(String data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| String | data()
validated payload | +| Any? | getData()
validated payload | + +## RefInProperty1BoxedList +data class RefInProperty1BoxedList
+implements [RefInProperty1Boxed](#refinproperty1boxed) + +data class that stores validated List payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| RefInProperty1BoxedList(FrozenList data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| FrozenList | data()
validated payload | +| Any? | getData()
validated payload | + +## RefInProperty1BoxedMap +data class RefInProperty1BoxedMap
+implements [RefInProperty1Boxed](#refinproperty1boxed) + +data class that stores validated Map payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| RefInProperty1BoxedMap([RefInPropertyMap](#refinpropertymap) data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| [RefInPropertyMap](#refinpropertymap) | data()
validated payload | +| Any? | getData()
validated payload | + +## RefInProperty1 +class RefInProperty1
+extends JsonSchema + +A schema class that validates payloads + +### Field Summary +| Modifier and Type | Field and Description | +| ----------------- | ---------------------- | +| Map> | properties = mapOf(
    "a" to [PropertyNamedRefThatIsNotAReference.PropertyNamedRefThatIsNotAReference1::class.java](../../components/schemas/PropertyNamedRefThatIsNotAReference.md#propertynamedrefthatisnotareference1)
)
| + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| String | validate(arg: String, configuration: SchemaConfiguration) | +| Nothing? | validate(arg: Nothing?, configuration: SchemaConfiguration) | +| int | validate(arg: int, configuration: SchemaConfiguration) | +| long | validate(arg: long, configuration: SchemaConfiguration) | +| float | validate(arg: float, configuration: SchemaConfiguration) | +| double | validate(arg: double, configuration: SchemaConfiguration) | +| Number | validate(arg: Number, configuration: SchemaConfiguration) | +| boolean | validate(arg: boolean, configuration: SchemaConfiguration) | +| [RefInPropertyMap](#refinpropertymap) | validate(arg: [Map<?, ?>](#refinpropertymapbuilder), configuration: SchemaConfiguration) | +| FrozenList | validate(arg: List<*>, configuration: SchemaConfiguration) | +| [RefInProperty1BoxedString](#refinproperty1boxedstring) | validateAndBox(String, configuration: SchemaConfiguration) | +| [RefInProperty1BoxedVoid](#refinproperty1boxedvoid) | validateAndBox(Nothing?, configuration: SchemaConfiguration) | +| [RefInProperty1BoxedNumber](#refinproperty1boxednumber) | validateAndBox(Number, configuration: SchemaConfiguration) | +| [RefInProperty1BoxedBoolean](#refinproperty1boxedboolean) | validateAndBox(boolean, configuration: SchemaConfiguration) | +| [RefInProperty1BoxedMap](#refinproperty1boxedmap) | validateAndBox([Map<?, ?>](#refinpropertymapbuilder), configuration: SchemaConfiguration) | +| [RefInProperty1BoxedList](#refinproperty1boxedlist) | validateAndBox(List<*>, configuration: SchemaConfiguration) | +| [RefInProperty1Boxed](#refinproperty1boxed) | validateAndBox(Any?, configuration: SchemaConfiguration) | +| Any? | validate(arg: Any?, configuration: SchemaConfiguration) | + +## RefInPropertyMapBuilder +class RefInPropertyMapBuilder
+builder for `Map` + +A class that builds the Map input type + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| RefInPropertyMapBuilder()
Creates a builder that contains an empty map | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| Map | build()
Returns map input that should be used with Schema.validate | +| [RefInPropertyMapBuilder](#refinpropertymapbuilder) | a(value: Nothing?) | +| [RefInPropertyMapBuilder](#refinpropertymapbuilder) | a(value: Boolean) | +| [RefInPropertyMapBuilder](#refinpropertymapbuilder) | a(value: String) | +| [RefInPropertyMapBuilder](#refinpropertymapbuilder) | a(value: Int) | +| [RefInPropertyMapBuilder](#refinpropertymapbuilder) | a(value: Float) | +| [RefInPropertyMapBuilder](#refinpropertymapbuilder) | a(value: Long) | +| [RefInPropertyMapBuilder](#refinpropertymapbuilder) | a(value: Double) | +| [RefInPropertyMapBuilder](#refinpropertymapbuilder) | a(value: List) | +| [RefInPropertyMapBuilder](#refinpropertymapbuilder) | a(value: Map) | +| [RefInPropertyMapBuilder](#refinpropertymapbuilder) | additionalProperty(key: String, value: Nothing?) | +| [RefInPropertyMapBuilder](#refinpropertymapbuilder) | additionalProperty(key: String, value: Boolean) | +| [RefInPropertyMapBuilder](#refinpropertymapbuilder) | additionalProperty(key: String, value: String) | +| [RefInPropertyMapBuilder](#refinpropertymapbuilder) | additionalProperty(key: String, value: Int) | +| [RefInPropertyMapBuilder](#refinpropertymapbuilder) | additionalProperty(key: String, value: Float) | +| [RefInPropertyMapBuilder](#refinpropertymapbuilder) | additionalProperty(key: String, value: Long) | +| [RefInPropertyMapBuilder](#refinpropertymapbuilder) | additionalProperty(key: String, value: Double) | +| [RefInPropertyMapBuilder](#refinpropertymapbuilder) | additionalProperty(key: String, value: List) | +| [RefInPropertyMapBuilder](#refinpropertymapbuilder) | additionalProperty(key: String, value: Map) | + +## RefInPropertyMap +class RefInPropertyMap
+extends FrozenMap + +A class to store validated Map payloads + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| static [RefInPropertyMap](#refinpropertymap) | of([Map](#refinpropertymapbuilder) arg, SchemaConfiguration configuration) | +| Any? | a()
[optional] | +| Any? | getAdditionalProperty(String name)
provides type safety for additional properties | + +[[Back to top]](#top) [[Back to Component Schemas]](../../../README.md#Component-Schemas) [[Back to README]](../../../README.md) diff --git a/samples/client/3_0_3_unit_test/kotlin/docs/components/schemas/RequiredDefaultValidation.md b/samples/client/3_0_3_unit_test/kotlin/docs/components/schemas/RequiredDefaultValidation.md new file mode 100644 index 00000000000..7b71ca0e3f6 --- /dev/null +++ b/samples/client/3_0_3_unit_test/kotlin/docs/components/schemas/RequiredDefaultValidation.md @@ -0,0 +1,353 @@ +# RequiredDefaultValidation +org.openapijsonschematools.client.components.schemas.RequiredDefaultValidation.java +class RequiredDefaultValidation
+ +A class that contains necessary nested +- schema classes (which validate payloads), extends JsonSchema +- sealed interfaces which store validated payloads, Kotlin version of a sum type +- boxed classes which store validated payloads, sealed permits class implementations +- classes to store validated map payloads, extends FrozenMap +- classes to build inputs for map payloads + +## Nested Class Summary +| Modifier and Type | Class and Description | +| ----------------- | ---------------------- | +| sealed interface | [RequiredDefaultValidation.RequiredDefaultValidation1Boxed](#requireddefaultvalidation1boxed)
sealed interface for validated payloads | +| record | [RequiredDefaultValidation.RequiredDefaultValidation1BoxedVoid](#requireddefaultvalidation1boxedvoid)
boxed class to store validated null payloads | +| record | [RequiredDefaultValidation.RequiredDefaultValidation1BoxedBoolean](#requireddefaultvalidation1boxedboolean)
boxed class to store validated boolean payloads | +| record | [RequiredDefaultValidation.RequiredDefaultValidation1BoxedNumber](#requireddefaultvalidation1boxednumber)
boxed class to store validated Number payloads | +| record | [RequiredDefaultValidation.RequiredDefaultValidation1BoxedString](#requireddefaultvalidation1boxedstring)
boxed class to store validated String payloads | +| record | [RequiredDefaultValidation.RequiredDefaultValidation1BoxedList](#requireddefaultvalidation1boxedlist)
boxed class to store validated List payloads | +| record | [RequiredDefaultValidation.RequiredDefaultValidation1BoxedMap](#requireddefaultvalidation1boxedmap)
boxed class to store validated Map payloads | +| static class | [RequiredDefaultValidation.RequiredDefaultValidation1](#requireddefaultvalidation1)
schema class | +| static class | [RequiredDefaultValidation.RequiredDefaultValidationMapBuilder](#requireddefaultvalidationmapbuilder)
builder for Map payloads | +| static class | [RequiredDefaultValidation.RequiredDefaultValidationMap](#requireddefaultvalidationmap)
output class for Map payloads | +| sealed interface | [RequiredDefaultValidation.FooBoxed](#fooboxed)
sealed interface for validated payloads | +| record | [RequiredDefaultValidation.FooBoxedVoid](#fooboxedvoid)
boxed class to store validated null payloads | +| record | [RequiredDefaultValidation.FooBoxedBoolean](#fooboxedboolean)
boxed class to store validated boolean payloads | +| record | [RequiredDefaultValidation.FooBoxedNumber](#fooboxednumber)
boxed class to store validated Number payloads | +| record | [RequiredDefaultValidation.FooBoxedString](#fooboxedstring)
boxed class to store validated String payloads | +| record | [RequiredDefaultValidation.FooBoxedList](#fooboxedlist)
boxed class to store validated List payloads | +| record | [RequiredDefaultValidation.FooBoxedMap](#fooboxedmap)
boxed class to store validated Map payloads | +| static class | [RequiredDefaultValidation.Foo](#foo)
schema class | + +## RequiredDefaultValidation1Boxed +sealed interface RequiredDefaultValidation1Boxed
+permits
+[RequiredDefaultValidation1BoxedVoid](#requireddefaultvalidation1boxedvoid), +[RequiredDefaultValidation1BoxedBoolean](#requireddefaultvalidation1boxedboolean), +[RequiredDefaultValidation1BoxedNumber](#requireddefaultvalidation1boxednumber), +[RequiredDefaultValidation1BoxedString](#requireddefaultvalidation1boxedstring), +[RequiredDefaultValidation1BoxedList](#requireddefaultvalidation1boxedlist), +[RequiredDefaultValidation1BoxedMap](#requireddefaultvalidation1boxedmap) + +sealed interface that stores validated payloads using boxed classes + +## RequiredDefaultValidation1BoxedVoid +data class RequiredDefaultValidation1BoxedVoid
+implements [RequiredDefaultValidation1Boxed](#requireddefaultvalidation1boxed) + +data class that stores validated null payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| RequiredDefaultValidation1BoxedVoid(Nothing? data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| Nothing? | data()
validated payload | +| Any? | getData()
validated payload | + +## RequiredDefaultValidation1BoxedBoolean +data class RequiredDefaultValidation1BoxedBoolean
+implements [RequiredDefaultValidation1Boxed](#requireddefaultvalidation1boxed) + +record that stores validated boolean payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| RequiredDefaultValidation1BoxedBoolean(boolean data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| boolean | data()
validated payload | +| Any? | getData()
validated payload | + +## RequiredDefaultValidation1BoxedNumber +data class RequiredDefaultValidation1BoxedNumber
+implements [RequiredDefaultValidation1Boxed](#requireddefaultvalidation1boxed) + +data class that stores validated Number payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| RequiredDefaultValidation1BoxedNumber(Number data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| Number | data()
validated payload | +| Any? | getData()
validated payload | + +## RequiredDefaultValidation1BoxedString +data class RequiredDefaultValidation1BoxedString
+implements [RequiredDefaultValidation1Boxed](#requireddefaultvalidation1boxed) + +data class that stores validated String payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| RequiredDefaultValidation1BoxedString(String data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| String | data()
validated payload | +| Any? | getData()
validated payload | + +## RequiredDefaultValidation1BoxedList +data class RequiredDefaultValidation1BoxedList
+implements [RequiredDefaultValidation1Boxed](#requireddefaultvalidation1boxed) + +data class that stores validated List payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| RequiredDefaultValidation1BoxedList(FrozenList data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| FrozenList | data()
validated payload | +| Any? | getData()
validated payload | + +## RequiredDefaultValidation1BoxedMap +data class RequiredDefaultValidation1BoxedMap
+implements [RequiredDefaultValidation1Boxed](#requireddefaultvalidation1boxed) + +data class that stores validated Map payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| RequiredDefaultValidation1BoxedMap([RequiredDefaultValidationMap](#requireddefaultvalidationmap) data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| [RequiredDefaultValidationMap](#requireddefaultvalidationmap) | data()
validated payload | +| Any? | getData()
validated payload | + +## RequiredDefaultValidation1 +class RequiredDefaultValidation1
+extends JsonSchema + +A schema class that validates payloads + +### Field Summary +| Modifier and Type | Field and Description | +| ----------------- | ---------------------- | +| Map> | properties = mapOf(
    "foo" to [Foo::class.java](#foo))
)
| + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| String | validate(arg: String, configuration: SchemaConfiguration) | +| Nothing? | validate(arg: Nothing?, configuration: SchemaConfiguration) | +| int | validate(arg: int, configuration: SchemaConfiguration) | +| long | validate(arg: long, configuration: SchemaConfiguration) | +| float | validate(arg: float, configuration: SchemaConfiguration) | +| double | validate(arg: double, configuration: SchemaConfiguration) | +| Number | validate(arg: Number, configuration: SchemaConfiguration) | +| boolean | validate(arg: boolean, configuration: SchemaConfiguration) | +| [RequiredDefaultValidationMap](#requireddefaultvalidationmap) | validate(arg: [Map<?, ?>](#requireddefaultvalidationmapbuilder), configuration: SchemaConfiguration) | +| FrozenList | validate(arg: List<*>, configuration: SchemaConfiguration) | +| [RequiredDefaultValidation1BoxedString](#requireddefaultvalidation1boxedstring) | validateAndBox(String, configuration: SchemaConfiguration) | +| [RequiredDefaultValidation1BoxedVoid](#requireddefaultvalidation1boxedvoid) | validateAndBox(Nothing?, configuration: SchemaConfiguration) | +| [RequiredDefaultValidation1BoxedNumber](#requireddefaultvalidation1boxednumber) | validateAndBox(Number, configuration: SchemaConfiguration) | +| [RequiredDefaultValidation1BoxedBoolean](#requireddefaultvalidation1boxedboolean) | validateAndBox(boolean, configuration: SchemaConfiguration) | +| [RequiredDefaultValidation1BoxedMap](#requireddefaultvalidation1boxedmap) | validateAndBox([Map<?, ?>](#requireddefaultvalidationmapbuilder), configuration: SchemaConfiguration) | +| [RequiredDefaultValidation1BoxedList](#requireddefaultvalidation1boxedlist) | validateAndBox(List<*>, configuration: SchemaConfiguration) | +| [RequiredDefaultValidation1Boxed](#requireddefaultvalidation1boxed) | validateAndBox(Any?, configuration: SchemaConfiguration) | +| Any? | validate(arg: Any?, configuration: SchemaConfiguration) | + +## RequiredDefaultValidationMapBuilder +class RequiredDefaultValidationMapBuilder
+builder for `Map` + +A class that builds the Map input type + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| RequiredDefaultValidationMapBuilder()
Creates a builder that contains an empty map | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| Map | build()
Returns map input that should be used with Schema.validate | +| [RequiredDefaultValidationMapBuilder](#requireddefaultvalidationmapbuilder) | foo(value: Nothing?) | +| [RequiredDefaultValidationMapBuilder](#requireddefaultvalidationmapbuilder) | foo(value: Boolean) | +| [RequiredDefaultValidationMapBuilder](#requireddefaultvalidationmapbuilder) | foo(value: String) | +| [RequiredDefaultValidationMapBuilder](#requireddefaultvalidationmapbuilder) | foo(value: Int) | +| [RequiredDefaultValidationMapBuilder](#requireddefaultvalidationmapbuilder) | foo(value: Float) | +| [RequiredDefaultValidationMapBuilder](#requireddefaultvalidationmapbuilder) | foo(value: Long) | +| [RequiredDefaultValidationMapBuilder](#requireddefaultvalidationmapbuilder) | foo(value: Double) | +| [RequiredDefaultValidationMapBuilder](#requireddefaultvalidationmapbuilder) | foo(value: List) | +| [RequiredDefaultValidationMapBuilder](#requireddefaultvalidationmapbuilder) | foo(value: Map) | +| [RequiredDefaultValidationMapBuilder](#requireddefaultvalidationmapbuilder) | additionalProperty(key: String, value: Nothing?) | +| [RequiredDefaultValidationMapBuilder](#requireddefaultvalidationmapbuilder) | additionalProperty(key: String, value: Boolean) | +| [RequiredDefaultValidationMapBuilder](#requireddefaultvalidationmapbuilder) | additionalProperty(key: String, value: String) | +| [RequiredDefaultValidationMapBuilder](#requireddefaultvalidationmapbuilder) | additionalProperty(key: String, value: Int) | +| [RequiredDefaultValidationMapBuilder](#requireddefaultvalidationmapbuilder) | additionalProperty(key: String, value: Float) | +| [RequiredDefaultValidationMapBuilder](#requireddefaultvalidationmapbuilder) | additionalProperty(key: String, value: Long) | +| [RequiredDefaultValidationMapBuilder](#requireddefaultvalidationmapbuilder) | additionalProperty(key: String, value: Double) | +| [RequiredDefaultValidationMapBuilder](#requireddefaultvalidationmapbuilder) | additionalProperty(key: String, value: List) | +| [RequiredDefaultValidationMapBuilder](#requireddefaultvalidationmapbuilder) | additionalProperty(key: String, value: Map) | + +## RequiredDefaultValidationMap +class RequiredDefaultValidationMap
+extends FrozenMap + +A class to store validated Map payloads + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| static [RequiredDefaultValidationMap](#requireddefaultvalidationmap) | of([Map](#requireddefaultvalidationmapbuilder) arg, SchemaConfiguration configuration) | +| Any? | foo()
[optional] | +| Any? | getAdditionalProperty(String name)
provides type safety for additional properties | + +## FooBoxed +sealed interface FooBoxed
+permits
+[FooBoxedVoid](#fooboxedvoid), +[FooBoxedBoolean](#fooboxedboolean), +[FooBoxedNumber](#fooboxednumber), +[FooBoxedString](#fooboxedstring), +[FooBoxedList](#fooboxedlist), +[FooBoxedMap](#fooboxedmap) + +sealed interface that stores validated payloads using boxed classes + +## FooBoxedVoid +data class FooBoxedVoid
+implements [FooBoxed](#fooboxed) + +data class that stores validated null payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| FooBoxedVoid(Nothing? data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| Nothing? | data()
validated payload | +| Any? | getData()
validated payload | + +## FooBoxedBoolean +data class FooBoxedBoolean
+implements [FooBoxed](#fooboxed) + +record that stores validated boolean payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| FooBoxedBoolean(boolean data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| boolean | data()
validated payload | +| Any? | getData()
validated payload | + +## FooBoxedNumber +data class FooBoxedNumber
+implements [FooBoxed](#fooboxed) + +data class that stores validated Number payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| FooBoxedNumber(Number data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| Number | data()
validated payload | +| Any? | getData()
validated payload | + +## FooBoxedString +data class FooBoxedString
+implements [FooBoxed](#fooboxed) + +data class that stores validated String payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| FooBoxedString(String data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| String | data()
validated payload | +| Any? | getData()
validated payload | + +## FooBoxedList +data class FooBoxedList
+implements [FooBoxed](#fooboxed) + +data class that stores validated List payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| FooBoxedList(FrozenList data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| FrozenList | data()
validated payload | +| Any? | getData()
validated payload | + +## FooBoxedMap +data class FooBoxedMap
+implements [FooBoxed](#fooboxed) + +data class that stores validated Map payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| FooBoxedMap(FrozenMap data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| FrozenMap | data()
validated payload | +| Any? | getData()
validated payload | + +## Foo +class Foo
+extends AnyTypeJsonSchema.AnyTypeJsonSchema1 + +A schema class that validates payloads + +| Methods Inherited from class org.openapijsonschematools.client.schemas.AnyTypeJsonSchema.AnyTypeJsonSchema1 | +| ------------------------------------------------------------------ | +| validate | +| validateAndBox | + +[[Back to top]](#top) [[Back to Component Schemas]](../../../README.md#Component-Schemas) [[Back to README]](../../../README.md) diff --git a/samples/client/3_0_3_unit_test/kotlin/docs/components/schemas/RequiredValidation.md b/samples/client/3_0_3_unit_test/kotlin/docs/components/schemas/RequiredValidation.md new file mode 100644 index 00000000000..448abb465fe --- /dev/null +++ b/samples/client/3_0_3_unit_test/kotlin/docs/components/schemas/RequiredValidation.md @@ -0,0 +1,512 @@ +# RequiredValidation +org.openapijsonschematools.client.components.schemas.RequiredValidation.java +class RequiredValidation
+ +A class that contains necessary nested +- schema classes (which validate payloads), extends JsonSchema +- sealed interfaces which store validated payloads, Kotlin version of a sum type +- boxed classes which store validated payloads, sealed permits class implementations +- classes to store validated map payloads, extends FrozenMap +- classes to build inputs for map payloads + +## Nested Class Summary +| Modifier and Type | Class and Description | +| ----------------- | ---------------------- | +| sealed interface | [RequiredValidation.RequiredValidation1Boxed](#requiredvalidation1boxed)
sealed interface for validated payloads | +| record | [RequiredValidation.RequiredValidation1BoxedVoid](#requiredvalidation1boxedvoid)
boxed class to store validated null payloads | +| record | [RequiredValidation.RequiredValidation1BoxedBoolean](#requiredvalidation1boxedboolean)
boxed class to store validated boolean payloads | +| record | [RequiredValidation.RequiredValidation1BoxedNumber](#requiredvalidation1boxednumber)
boxed class to store validated Number payloads | +| record | [RequiredValidation.RequiredValidation1BoxedString](#requiredvalidation1boxedstring)
boxed class to store validated String payloads | +| record | [RequiredValidation.RequiredValidation1BoxedList](#requiredvalidation1boxedlist)
boxed class to store validated List payloads | +| record | [RequiredValidation.RequiredValidation1BoxedMap](#requiredvalidation1boxedmap)
boxed class to store validated Map payloads | +| static class | [RequiredValidation.RequiredValidation1](#requiredvalidation1)
schema class | +| static class | [RequiredValidation.RequiredValidationMapBuilder](#requiredvalidationmapbuilder)
builder for Map payloads | +| static class | [RequiredValidation.RequiredValidationMap](#requiredvalidationmap)
output class for Map payloads | +| sealed interface | [RequiredValidation.BarBoxed](#barboxed)
sealed interface for validated payloads | +| record | [RequiredValidation.BarBoxedVoid](#barboxedvoid)
boxed class to store validated null payloads | +| record | [RequiredValidation.BarBoxedBoolean](#barboxedboolean)
boxed class to store validated boolean payloads | +| record | [RequiredValidation.BarBoxedNumber](#barboxednumber)
boxed class to store validated Number payloads | +| record | [RequiredValidation.BarBoxedString](#barboxedstring)
boxed class to store validated String payloads | +| record | [RequiredValidation.BarBoxedList](#barboxedlist)
boxed class to store validated List payloads | +| record | [RequiredValidation.BarBoxedMap](#barboxedmap)
boxed class to store validated Map payloads | +| static class | [RequiredValidation.Bar](#bar)
schema class | +| sealed interface | [RequiredValidation.FooBoxed](#fooboxed)
sealed interface for validated payloads | +| record | [RequiredValidation.FooBoxedVoid](#fooboxedvoid)
boxed class to store validated null payloads | +| record | [RequiredValidation.FooBoxedBoolean](#fooboxedboolean)
boxed class to store validated boolean payloads | +| record | [RequiredValidation.FooBoxedNumber](#fooboxednumber)
boxed class to store validated Number payloads | +| record | [RequiredValidation.FooBoxedString](#fooboxedstring)
boxed class to store validated String payloads | +| record | [RequiredValidation.FooBoxedList](#fooboxedlist)
boxed class to store validated List payloads | +| record | [RequiredValidation.FooBoxedMap](#fooboxedmap)
boxed class to store validated Map payloads | +| static class | [RequiredValidation.Foo](#foo)
schema class | + +## RequiredValidation1Boxed +sealed interface RequiredValidation1Boxed
+permits
+[RequiredValidation1BoxedVoid](#requiredvalidation1boxedvoid), +[RequiredValidation1BoxedBoolean](#requiredvalidation1boxedboolean), +[RequiredValidation1BoxedNumber](#requiredvalidation1boxednumber), +[RequiredValidation1BoxedString](#requiredvalidation1boxedstring), +[RequiredValidation1BoxedList](#requiredvalidation1boxedlist), +[RequiredValidation1BoxedMap](#requiredvalidation1boxedmap) + +sealed interface that stores validated payloads using boxed classes + +## RequiredValidation1BoxedVoid +data class RequiredValidation1BoxedVoid
+implements [RequiredValidation1Boxed](#requiredvalidation1boxed) + +data class that stores validated null payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| RequiredValidation1BoxedVoid(Nothing? data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| Nothing? | data()
validated payload | +| Any? | getData()
validated payload | + +## RequiredValidation1BoxedBoolean +data class RequiredValidation1BoxedBoolean
+implements [RequiredValidation1Boxed](#requiredvalidation1boxed) + +record that stores validated boolean payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| RequiredValidation1BoxedBoolean(boolean data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| boolean | data()
validated payload | +| Any? | getData()
validated payload | + +## RequiredValidation1BoxedNumber +data class RequiredValidation1BoxedNumber
+implements [RequiredValidation1Boxed](#requiredvalidation1boxed) + +data class that stores validated Number payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| RequiredValidation1BoxedNumber(Number data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| Number | data()
validated payload | +| Any? | getData()
validated payload | + +## RequiredValidation1BoxedString +data class RequiredValidation1BoxedString
+implements [RequiredValidation1Boxed](#requiredvalidation1boxed) + +data class that stores validated String payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| RequiredValidation1BoxedString(String data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| String | data()
validated payload | +| Any? | getData()
validated payload | + +## RequiredValidation1BoxedList +data class RequiredValidation1BoxedList
+implements [RequiredValidation1Boxed](#requiredvalidation1boxed) + +data class that stores validated List payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| RequiredValidation1BoxedList(FrozenList data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| FrozenList | data()
validated payload | +| Any? | getData()
validated payload | + +## RequiredValidation1BoxedMap +data class RequiredValidation1BoxedMap
+implements [RequiredValidation1Boxed](#requiredvalidation1boxed) + +data class that stores validated Map payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| RequiredValidation1BoxedMap([RequiredValidationMap](#requiredvalidationmap) data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| [RequiredValidationMap](#requiredvalidationmap) | data()
validated payload | +| Any? | getData()
validated payload | + +## RequiredValidation1 +class RequiredValidation1
+extends JsonSchema + +A schema class that validates payloads + +### Field Summary +| Modifier and Type | Field and Description | +| ----------------- | ---------------------- | +| Map> | properties = mapOf(
    "foo" to [Foo::class.java](#foo)),
    "bar" to [Bar::class.java](#bar))
)
| +| Set | required = setOf(
    "foo"
)
| + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| String | validate(arg: String, configuration: SchemaConfiguration) | +| Nothing? | validate(arg: Nothing?, configuration: SchemaConfiguration) | +| int | validate(arg: int, configuration: SchemaConfiguration) | +| long | validate(arg: long, configuration: SchemaConfiguration) | +| float | validate(arg: float, configuration: SchemaConfiguration) | +| double | validate(arg: double, configuration: SchemaConfiguration) | +| Number | validate(arg: Number, configuration: SchemaConfiguration) | +| boolean | validate(arg: boolean, configuration: SchemaConfiguration) | +| [RequiredValidationMap](#requiredvalidationmap) | validate(arg: [Map<?, ?>](#requiredvalidationmapbuilder), configuration: SchemaConfiguration) | +| FrozenList | validate(arg: List<*>, configuration: SchemaConfiguration) | +| [RequiredValidation1BoxedString](#requiredvalidation1boxedstring) | validateAndBox(String, configuration: SchemaConfiguration) | +| [RequiredValidation1BoxedVoid](#requiredvalidation1boxedvoid) | validateAndBox(Nothing?, configuration: SchemaConfiguration) | +| [RequiredValidation1BoxedNumber](#requiredvalidation1boxednumber) | validateAndBox(Number, configuration: SchemaConfiguration) | +| [RequiredValidation1BoxedBoolean](#requiredvalidation1boxedboolean) | validateAndBox(boolean, configuration: SchemaConfiguration) | +| [RequiredValidation1BoxedMap](#requiredvalidation1boxedmap) | validateAndBox([Map<?, ?>](#requiredvalidationmapbuilder), configuration: SchemaConfiguration) | +| [RequiredValidation1BoxedList](#requiredvalidation1boxedlist) | validateAndBox(List<*>, configuration: SchemaConfiguration) | +| [RequiredValidation1Boxed](#requiredvalidation1boxed) | validateAndBox(Any?, configuration: SchemaConfiguration) | +| Any? | validate(arg: Any?, configuration: SchemaConfiguration) | + +## RequiredValidationMap0Builder +class RequiredValidationMap0Builder
+builder for `Map` + +A class that builds the Map input type + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| RequiredValidationMap0Builder(Map instance)
Creates a builder that contains the passed instance | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| Map | build()
Returns map input that should be used with Schema.validate | +| [RequiredValidationMap0Builder](#requiredvalidationmap0builder) | bar(value: Nothing?) | +| [RequiredValidationMap0Builder](#requiredvalidationmap0builder) | bar(value: Boolean) | +| [RequiredValidationMap0Builder](#requiredvalidationmap0builder) | bar(value: String) | +| [RequiredValidationMap0Builder](#requiredvalidationmap0builder) | bar(value: Int) | +| [RequiredValidationMap0Builder](#requiredvalidationmap0builder) | bar(value: Float) | +| [RequiredValidationMap0Builder](#requiredvalidationmap0builder) | bar(value: Long) | +| [RequiredValidationMap0Builder](#requiredvalidationmap0builder) | bar(value: Double) | +| [RequiredValidationMap0Builder](#requiredvalidationmap0builder) | bar(value: List) | +| [RequiredValidationMap0Builder](#requiredvalidationmap0builder) | bar(value: Map) | +| [RequiredValidationMap0Builder](#requiredvalidationmap0builder) | additionalProperty(key: String, value: Nothing?) | +| [RequiredValidationMap0Builder](#requiredvalidationmap0builder) | additionalProperty(key: String, value: Boolean) | +| [RequiredValidationMap0Builder](#requiredvalidationmap0builder) | additionalProperty(key: String, value: String) | +| [RequiredValidationMap0Builder](#requiredvalidationmap0builder) | additionalProperty(key: String, value: Int) | +| [RequiredValidationMap0Builder](#requiredvalidationmap0builder) | additionalProperty(key: String, value: Float) | +| [RequiredValidationMap0Builder](#requiredvalidationmap0builder) | additionalProperty(key: String, value: Long) | +| [RequiredValidationMap0Builder](#requiredvalidationmap0builder) | additionalProperty(key: String, value: Double) | +| [RequiredValidationMap0Builder](#requiredvalidationmap0builder) | additionalProperty(key: String, value: List) | +| [RequiredValidationMap0Builder](#requiredvalidationmap0builder) | additionalProperty(key: String, value: Map) | + +## RequiredValidationMapBuilder +class RequiredValidationMapBuilder
+builder for `Map` + +A class that builds the Map input type + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| RequiredValidationMapBuilder()
Creates a builder that contains an empty map | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| [RequiredValidationMap0Builder](#requiredvalidationmap0builder) | foo(value: Nothing?) | +| [RequiredValidationMap0Builder](#requiredvalidationmap0builder) | foo(value: Boolean) | +| [RequiredValidationMap0Builder](#requiredvalidationmap0builder) | foo(value: String) | +| [RequiredValidationMap0Builder](#requiredvalidationmap0builder) | foo(value: Int) | +| [RequiredValidationMap0Builder](#requiredvalidationmap0builder) | foo(value: Float) | +| [RequiredValidationMap0Builder](#requiredvalidationmap0builder) | foo(value: Long) | +| [RequiredValidationMap0Builder](#requiredvalidationmap0builder) | foo(value: Double) | +| [RequiredValidationMap0Builder](#requiredvalidationmap0builder) | foo(value: List) | +| [RequiredValidationMap0Builder](#requiredvalidationmap0builder) | foo(value: Map) | + +## RequiredValidationMap +class RequiredValidationMap
+extends FrozenMap + +A class to store validated Map payloads + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| static [RequiredValidationMap](#requiredvalidationmap) | of([Map](#requiredvalidationmapbuilder) arg, SchemaConfiguration configuration) | +| Any? | foo()
| +| Any? | bar()
[optional] | +| Any? | getAdditionalProperty(String name)
provides type safety for additional properties | + +## BarBoxed +sealed interface BarBoxed
+permits
+[BarBoxedVoid](#barboxedvoid), +[BarBoxedBoolean](#barboxedboolean), +[BarBoxedNumber](#barboxednumber), +[BarBoxedString](#barboxedstring), +[BarBoxedList](#barboxedlist), +[BarBoxedMap](#barboxedmap) + +sealed interface that stores validated payloads using boxed classes + +## BarBoxedVoid +data class BarBoxedVoid
+implements [BarBoxed](#barboxed) + +data class that stores validated null payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| BarBoxedVoid(Nothing? data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| Nothing? | data()
validated payload | +| Any? | getData()
validated payload | + +## BarBoxedBoolean +data class BarBoxedBoolean
+implements [BarBoxed](#barboxed) + +record that stores validated boolean payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| BarBoxedBoolean(boolean data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| boolean | data()
validated payload | +| Any? | getData()
validated payload | + +## BarBoxedNumber +data class BarBoxedNumber
+implements [BarBoxed](#barboxed) + +data class that stores validated Number payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| BarBoxedNumber(Number data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| Number | data()
validated payload | +| Any? | getData()
validated payload | + +## BarBoxedString +data class BarBoxedString
+implements [BarBoxed](#barboxed) + +data class that stores validated String payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| BarBoxedString(String data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| String | data()
validated payload | +| Any? | getData()
validated payload | + +## BarBoxedList +data class BarBoxedList
+implements [BarBoxed](#barboxed) + +data class that stores validated List payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| BarBoxedList(FrozenList data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| FrozenList | data()
validated payload | +| Any? | getData()
validated payload | + +## BarBoxedMap +data class BarBoxedMap
+implements [BarBoxed](#barboxed) + +data class that stores validated Map payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| BarBoxedMap(FrozenMap data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| FrozenMap | data()
validated payload | +| Any? | getData()
validated payload | + +## Bar +class Bar
+extends AnyTypeJsonSchema.AnyTypeJsonSchema1 + +A schema class that validates payloads + +| Methods Inherited from class org.openapijsonschematools.client.schemas.AnyTypeJsonSchema.AnyTypeJsonSchema1 | +| ------------------------------------------------------------------ | +| validate | +| validateAndBox | + +## FooBoxed +sealed interface FooBoxed
+permits
+[FooBoxedVoid](#fooboxedvoid), +[FooBoxedBoolean](#fooboxedboolean), +[FooBoxedNumber](#fooboxednumber), +[FooBoxedString](#fooboxedstring), +[FooBoxedList](#fooboxedlist), +[FooBoxedMap](#fooboxedmap) + +sealed interface that stores validated payloads using boxed classes + +## FooBoxedVoid +data class FooBoxedVoid
+implements [FooBoxed](#fooboxed) + +data class that stores validated null payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| FooBoxedVoid(Nothing? data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| Nothing? | data()
validated payload | +| Any? | getData()
validated payload | + +## FooBoxedBoolean +data class FooBoxedBoolean
+implements [FooBoxed](#fooboxed) + +record that stores validated boolean payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| FooBoxedBoolean(boolean data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| boolean | data()
validated payload | +| Any? | getData()
validated payload | + +## FooBoxedNumber +data class FooBoxedNumber
+implements [FooBoxed](#fooboxed) + +data class that stores validated Number payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| FooBoxedNumber(Number data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| Number | data()
validated payload | +| Any? | getData()
validated payload | + +## FooBoxedString +data class FooBoxedString
+implements [FooBoxed](#fooboxed) + +data class that stores validated String payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| FooBoxedString(String data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| String | data()
validated payload | +| Any? | getData()
validated payload | + +## FooBoxedList +data class FooBoxedList
+implements [FooBoxed](#fooboxed) + +data class that stores validated List payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| FooBoxedList(FrozenList data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| FrozenList | data()
validated payload | +| Any? | getData()
validated payload | + +## FooBoxedMap +data class FooBoxedMap
+implements [FooBoxed](#fooboxed) + +data class that stores validated Map payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| FooBoxedMap(FrozenMap data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| FrozenMap | data()
validated payload | +| Any? | getData()
validated payload | + +## Foo +class Foo
+extends AnyTypeJsonSchema.AnyTypeJsonSchema1 + +A schema class that validates payloads + +| Methods Inherited from class org.openapijsonschematools.client.schemas.AnyTypeJsonSchema.AnyTypeJsonSchema1 | +| ------------------------------------------------------------------ | +| validate | +| validateAndBox | + +[[Back to top]](#top) [[Back to Component Schemas]](../../../README.md#Component-Schemas) [[Back to README]](../../../README.md) diff --git a/samples/client/3_0_3_unit_test/kotlin/docs/components/schemas/RequiredWithEmptyArray.md b/samples/client/3_0_3_unit_test/kotlin/docs/components/schemas/RequiredWithEmptyArray.md new file mode 100644 index 00000000000..85125a5f8d2 --- /dev/null +++ b/samples/client/3_0_3_unit_test/kotlin/docs/components/schemas/RequiredWithEmptyArray.md @@ -0,0 +1,353 @@ +# RequiredWithEmptyArray +org.openapijsonschematools.client.components.schemas.RequiredWithEmptyArray.java +class RequiredWithEmptyArray
+ +A class that contains necessary nested +- schema classes (which validate payloads), extends JsonSchema +- sealed interfaces which store validated payloads, Kotlin version of a sum type +- boxed classes which store validated payloads, sealed permits class implementations +- classes to store validated map payloads, extends FrozenMap +- classes to build inputs for map payloads + +## Nested Class Summary +| Modifier and Type | Class and Description | +| ----------------- | ---------------------- | +| sealed interface | [RequiredWithEmptyArray.RequiredWithEmptyArray1Boxed](#requiredwithemptyarray1boxed)
sealed interface for validated payloads | +| record | [RequiredWithEmptyArray.RequiredWithEmptyArray1BoxedVoid](#requiredwithemptyarray1boxedvoid)
boxed class to store validated null payloads | +| record | [RequiredWithEmptyArray.RequiredWithEmptyArray1BoxedBoolean](#requiredwithemptyarray1boxedboolean)
boxed class to store validated boolean payloads | +| record | [RequiredWithEmptyArray.RequiredWithEmptyArray1BoxedNumber](#requiredwithemptyarray1boxednumber)
boxed class to store validated Number payloads | +| record | [RequiredWithEmptyArray.RequiredWithEmptyArray1BoxedString](#requiredwithemptyarray1boxedstring)
boxed class to store validated String payloads | +| record | [RequiredWithEmptyArray.RequiredWithEmptyArray1BoxedList](#requiredwithemptyarray1boxedlist)
boxed class to store validated List payloads | +| record | [RequiredWithEmptyArray.RequiredWithEmptyArray1BoxedMap](#requiredwithemptyarray1boxedmap)
boxed class to store validated Map payloads | +| static class | [RequiredWithEmptyArray.RequiredWithEmptyArray1](#requiredwithemptyarray1)
schema class | +| static class | [RequiredWithEmptyArray.RequiredWithEmptyArrayMapBuilder](#requiredwithemptyarraymapbuilder)
builder for Map payloads | +| static class | [RequiredWithEmptyArray.RequiredWithEmptyArrayMap](#requiredwithemptyarraymap)
output class for Map payloads | +| sealed interface | [RequiredWithEmptyArray.FooBoxed](#fooboxed)
sealed interface for validated payloads | +| record | [RequiredWithEmptyArray.FooBoxedVoid](#fooboxedvoid)
boxed class to store validated null payloads | +| record | [RequiredWithEmptyArray.FooBoxedBoolean](#fooboxedboolean)
boxed class to store validated boolean payloads | +| record | [RequiredWithEmptyArray.FooBoxedNumber](#fooboxednumber)
boxed class to store validated Number payloads | +| record | [RequiredWithEmptyArray.FooBoxedString](#fooboxedstring)
boxed class to store validated String payloads | +| record | [RequiredWithEmptyArray.FooBoxedList](#fooboxedlist)
boxed class to store validated List payloads | +| record | [RequiredWithEmptyArray.FooBoxedMap](#fooboxedmap)
boxed class to store validated Map payloads | +| static class | [RequiredWithEmptyArray.Foo](#foo)
schema class | + +## RequiredWithEmptyArray1Boxed +sealed interface RequiredWithEmptyArray1Boxed
+permits
+[RequiredWithEmptyArray1BoxedVoid](#requiredwithemptyarray1boxedvoid), +[RequiredWithEmptyArray1BoxedBoolean](#requiredwithemptyarray1boxedboolean), +[RequiredWithEmptyArray1BoxedNumber](#requiredwithemptyarray1boxednumber), +[RequiredWithEmptyArray1BoxedString](#requiredwithemptyarray1boxedstring), +[RequiredWithEmptyArray1BoxedList](#requiredwithemptyarray1boxedlist), +[RequiredWithEmptyArray1BoxedMap](#requiredwithemptyarray1boxedmap) + +sealed interface that stores validated payloads using boxed classes + +## RequiredWithEmptyArray1BoxedVoid +data class RequiredWithEmptyArray1BoxedVoid
+implements [RequiredWithEmptyArray1Boxed](#requiredwithemptyarray1boxed) + +data class that stores validated null payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| RequiredWithEmptyArray1BoxedVoid(Nothing? data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| Nothing? | data()
validated payload | +| Any? | getData()
validated payload | + +## RequiredWithEmptyArray1BoxedBoolean +data class RequiredWithEmptyArray1BoxedBoolean
+implements [RequiredWithEmptyArray1Boxed](#requiredwithemptyarray1boxed) + +record that stores validated boolean payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| RequiredWithEmptyArray1BoxedBoolean(boolean data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| boolean | data()
validated payload | +| Any? | getData()
validated payload | + +## RequiredWithEmptyArray1BoxedNumber +data class RequiredWithEmptyArray1BoxedNumber
+implements [RequiredWithEmptyArray1Boxed](#requiredwithemptyarray1boxed) + +data class that stores validated Number payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| RequiredWithEmptyArray1BoxedNumber(Number data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| Number | data()
validated payload | +| Any? | getData()
validated payload | + +## RequiredWithEmptyArray1BoxedString +data class RequiredWithEmptyArray1BoxedString
+implements [RequiredWithEmptyArray1Boxed](#requiredwithemptyarray1boxed) + +data class that stores validated String payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| RequiredWithEmptyArray1BoxedString(String data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| String | data()
validated payload | +| Any? | getData()
validated payload | + +## RequiredWithEmptyArray1BoxedList +data class RequiredWithEmptyArray1BoxedList
+implements [RequiredWithEmptyArray1Boxed](#requiredwithemptyarray1boxed) + +data class that stores validated List payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| RequiredWithEmptyArray1BoxedList(FrozenList data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| FrozenList | data()
validated payload | +| Any? | getData()
validated payload | + +## RequiredWithEmptyArray1BoxedMap +data class RequiredWithEmptyArray1BoxedMap
+implements [RequiredWithEmptyArray1Boxed](#requiredwithemptyarray1boxed) + +data class that stores validated Map payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| RequiredWithEmptyArray1BoxedMap([RequiredWithEmptyArrayMap](#requiredwithemptyarraymap) data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| [RequiredWithEmptyArrayMap](#requiredwithemptyarraymap) | data()
validated payload | +| Any? | getData()
validated payload | + +## RequiredWithEmptyArray1 +class RequiredWithEmptyArray1
+extends JsonSchema + +A schema class that validates payloads + +### Field Summary +| Modifier and Type | Field and Description | +| ----------------- | ---------------------- | +| Map> | properties = mapOf(
    "foo" to [Foo::class.java](#foo))
)
| + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| String | validate(arg: String, configuration: SchemaConfiguration) | +| Nothing? | validate(arg: Nothing?, configuration: SchemaConfiguration) | +| int | validate(arg: int, configuration: SchemaConfiguration) | +| long | validate(arg: long, configuration: SchemaConfiguration) | +| float | validate(arg: float, configuration: SchemaConfiguration) | +| double | validate(arg: double, configuration: SchemaConfiguration) | +| Number | validate(arg: Number, configuration: SchemaConfiguration) | +| boolean | validate(arg: boolean, configuration: SchemaConfiguration) | +| [RequiredWithEmptyArrayMap](#requiredwithemptyarraymap) | validate(arg: [Map<?, ?>](#requiredwithemptyarraymapbuilder), configuration: SchemaConfiguration) | +| FrozenList | validate(arg: List<*>, configuration: SchemaConfiguration) | +| [RequiredWithEmptyArray1BoxedString](#requiredwithemptyarray1boxedstring) | validateAndBox(String, configuration: SchemaConfiguration) | +| [RequiredWithEmptyArray1BoxedVoid](#requiredwithemptyarray1boxedvoid) | validateAndBox(Nothing?, configuration: SchemaConfiguration) | +| [RequiredWithEmptyArray1BoxedNumber](#requiredwithemptyarray1boxednumber) | validateAndBox(Number, configuration: SchemaConfiguration) | +| [RequiredWithEmptyArray1BoxedBoolean](#requiredwithemptyarray1boxedboolean) | validateAndBox(boolean, configuration: SchemaConfiguration) | +| [RequiredWithEmptyArray1BoxedMap](#requiredwithemptyarray1boxedmap) | validateAndBox([Map<?, ?>](#requiredwithemptyarraymapbuilder), configuration: SchemaConfiguration) | +| [RequiredWithEmptyArray1BoxedList](#requiredwithemptyarray1boxedlist) | validateAndBox(List<*>, configuration: SchemaConfiguration) | +| [RequiredWithEmptyArray1Boxed](#requiredwithemptyarray1boxed) | validateAndBox(Any?, configuration: SchemaConfiguration) | +| Any? | validate(arg: Any?, configuration: SchemaConfiguration) | + +## RequiredWithEmptyArrayMapBuilder +class RequiredWithEmptyArrayMapBuilder
+builder for `Map` + +A class that builds the Map input type + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| RequiredWithEmptyArrayMapBuilder()
Creates a builder that contains an empty map | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| Map | build()
Returns map input that should be used with Schema.validate | +| [RequiredWithEmptyArrayMapBuilder](#requiredwithemptyarraymapbuilder) | foo(value: Nothing?) | +| [RequiredWithEmptyArrayMapBuilder](#requiredwithemptyarraymapbuilder) | foo(value: Boolean) | +| [RequiredWithEmptyArrayMapBuilder](#requiredwithemptyarraymapbuilder) | foo(value: String) | +| [RequiredWithEmptyArrayMapBuilder](#requiredwithemptyarraymapbuilder) | foo(value: Int) | +| [RequiredWithEmptyArrayMapBuilder](#requiredwithemptyarraymapbuilder) | foo(value: Float) | +| [RequiredWithEmptyArrayMapBuilder](#requiredwithemptyarraymapbuilder) | foo(value: Long) | +| [RequiredWithEmptyArrayMapBuilder](#requiredwithemptyarraymapbuilder) | foo(value: Double) | +| [RequiredWithEmptyArrayMapBuilder](#requiredwithemptyarraymapbuilder) | foo(value: List) | +| [RequiredWithEmptyArrayMapBuilder](#requiredwithemptyarraymapbuilder) | foo(value: Map) | +| [RequiredWithEmptyArrayMapBuilder](#requiredwithemptyarraymapbuilder) | additionalProperty(key: String, value: Nothing?) | +| [RequiredWithEmptyArrayMapBuilder](#requiredwithemptyarraymapbuilder) | additionalProperty(key: String, value: Boolean) | +| [RequiredWithEmptyArrayMapBuilder](#requiredwithemptyarraymapbuilder) | additionalProperty(key: String, value: String) | +| [RequiredWithEmptyArrayMapBuilder](#requiredwithemptyarraymapbuilder) | additionalProperty(key: String, value: Int) | +| [RequiredWithEmptyArrayMapBuilder](#requiredwithemptyarraymapbuilder) | additionalProperty(key: String, value: Float) | +| [RequiredWithEmptyArrayMapBuilder](#requiredwithemptyarraymapbuilder) | additionalProperty(key: String, value: Long) | +| [RequiredWithEmptyArrayMapBuilder](#requiredwithemptyarraymapbuilder) | additionalProperty(key: String, value: Double) | +| [RequiredWithEmptyArrayMapBuilder](#requiredwithemptyarraymapbuilder) | additionalProperty(key: String, value: List) | +| [RequiredWithEmptyArrayMapBuilder](#requiredwithemptyarraymapbuilder) | additionalProperty(key: String, value: Map) | + +## RequiredWithEmptyArrayMap +class RequiredWithEmptyArrayMap
+extends FrozenMap + +A class to store validated Map payloads + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| static [RequiredWithEmptyArrayMap](#requiredwithemptyarraymap) | of([Map](#requiredwithemptyarraymapbuilder) arg, SchemaConfiguration configuration) | +| Any? | foo()
[optional] | +| Any? | getAdditionalProperty(String name)
provides type safety for additional properties | + +## FooBoxed +sealed interface FooBoxed
+permits
+[FooBoxedVoid](#fooboxedvoid), +[FooBoxedBoolean](#fooboxedboolean), +[FooBoxedNumber](#fooboxednumber), +[FooBoxedString](#fooboxedstring), +[FooBoxedList](#fooboxedlist), +[FooBoxedMap](#fooboxedmap) + +sealed interface that stores validated payloads using boxed classes + +## FooBoxedVoid +data class FooBoxedVoid
+implements [FooBoxed](#fooboxed) + +data class that stores validated null payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| FooBoxedVoid(Nothing? data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| Nothing? | data()
validated payload | +| Any? | getData()
validated payload | + +## FooBoxedBoolean +data class FooBoxedBoolean
+implements [FooBoxed](#fooboxed) + +record that stores validated boolean payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| FooBoxedBoolean(boolean data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| boolean | data()
validated payload | +| Any? | getData()
validated payload | + +## FooBoxedNumber +data class FooBoxedNumber
+implements [FooBoxed](#fooboxed) + +data class that stores validated Number payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| FooBoxedNumber(Number data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| Number | data()
validated payload | +| Any? | getData()
validated payload | + +## FooBoxedString +data class FooBoxedString
+implements [FooBoxed](#fooboxed) + +data class that stores validated String payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| FooBoxedString(String data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| String | data()
validated payload | +| Any? | getData()
validated payload | + +## FooBoxedList +data class FooBoxedList
+implements [FooBoxed](#fooboxed) + +data class that stores validated List payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| FooBoxedList(FrozenList data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| FrozenList | data()
validated payload | +| Any? | getData()
validated payload | + +## FooBoxedMap +data class FooBoxedMap
+implements [FooBoxed](#fooboxed) + +data class that stores validated Map payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| FooBoxedMap(FrozenMap data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| FrozenMap | data()
validated payload | +| Any? | getData()
validated payload | + +## Foo +class Foo
+extends AnyTypeJsonSchema.AnyTypeJsonSchema1 + +A schema class that validates payloads + +| Methods Inherited from class org.openapijsonschematools.client.schemas.AnyTypeJsonSchema.AnyTypeJsonSchema1 | +| ------------------------------------------------------------------ | +| validate | +| validateAndBox | + +[[Back to top]](#top) [[Back to Component Schemas]](../../../README.md#Component-Schemas) [[Back to README]](../../../README.md) diff --git a/samples/client/3_0_3_unit_test/kotlin/docs/components/schemas/RequiredWithEscapedCharacters.md b/samples/client/3_0_3_unit_test/kotlin/docs/components/schemas/RequiredWithEscapedCharacters.md new file mode 100644 index 00000000000..eb8d365df0d --- /dev/null +++ b/samples/client/3_0_3_unit_test/kotlin/docs/components/schemas/RequiredWithEscapedCharacters.md @@ -0,0 +1,2884 @@ +# RequiredWithEscapedCharacters +org.openapijsonschematools.client.components.schemas.RequiredWithEscapedCharacters.java +class RequiredWithEscapedCharacters
+ +A class that contains necessary nested +- schema classes (which validate payloads), extends JsonSchema +- sealed interfaces which store validated payloads, Kotlin version of a sum type +- boxed classes which store validated payloads, sealed permits class implementations +- classes to store validated map payloads, extends FrozenMap +- classes to build inputs for map payloads + +## Nested Class Summary +| Modifier and Type | Class and Description | +| ----------------- | ---------------------- | +| sealed interface | [RequiredWithEscapedCharacters.RequiredWithEscapedCharacters1Boxed](#requiredwithescapedcharacters1boxed)
sealed interface for validated payloads | +| record | [RequiredWithEscapedCharacters.RequiredWithEscapedCharacters1BoxedVoid](#requiredwithescapedcharacters1boxedvoid)
boxed class to store validated null payloads | +| record | [RequiredWithEscapedCharacters.RequiredWithEscapedCharacters1BoxedBoolean](#requiredwithescapedcharacters1boxedboolean)
boxed class to store validated boolean payloads | +| record | [RequiredWithEscapedCharacters.RequiredWithEscapedCharacters1BoxedNumber](#requiredwithescapedcharacters1boxednumber)
boxed class to store validated Number payloads | +| record | [RequiredWithEscapedCharacters.RequiredWithEscapedCharacters1BoxedString](#requiredwithescapedcharacters1boxedstring)
boxed class to store validated String payloads | +| record | [RequiredWithEscapedCharacters.RequiredWithEscapedCharacters1BoxedList](#requiredwithescapedcharacters1boxedlist)
boxed class to store validated List payloads | +| record | [RequiredWithEscapedCharacters.RequiredWithEscapedCharacters1BoxedMap](#requiredwithescapedcharacters1boxedmap)
boxed class to store validated Map payloads | +| static class | [RequiredWithEscapedCharacters.RequiredWithEscapedCharacters1](#requiredwithescapedcharacters1)
schema class | +| static class | [RequiredWithEscapedCharacters.RequiredWithEscapedCharactersMapBuilder](#requiredwithescapedcharactersmapbuilder)
builder for Map payloads | +| static class | [RequiredWithEscapedCharacters.RequiredWithEscapedCharactersMap](#requiredwithescapedcharactersmap)
output class for Map payloads | + +## RequiredWithEscapedCharacters1Boxed +sealed interface RequiredWithEscapedCharacters1Boxed
+permits
+[RequiredWithEscapedCharacters1BoxedVoid](#requiredwithescapedcharacters1boxedvoid), +[RequiredWithEscapedCharacters1BoxedBoolean](#requiredwithescapedcharacters1boxedboolean), +[RequiredWithEscapedCharacters1BoxedNumber](#requiredwithescapedcharacters1boxednumber), +[RequiredWithEscapedCharacters1BoxedString](#requiredwithescapedcharacters1boxedstring), +[RequiredWithEscapedCharacters1BoxedList](#requiredwithescapedcharacters1boxedlist), +[RequiredWithEscapedCharacters1BoxedMap](#requiredwithescapedcharacters1boxedmap) + +sealed interface that stores validated payloads using boxed classes + +## RequiredWithEscapedCharacters1BoxedVoid +data class RequiredWithEscapedCharacters1BoxedVoid
+implements [RequiredWithEscapedCharacters1Boxed](#requiredwithescapedcharacters1boxed) + +data class that stores validated null payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| RequiredWithEscapedCharacters1BoxedVoid(Nothing? data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| Nothing? | data()
validated payload | +| Any? | getData()
validated payload | + +## RequiredWithEscapedCharacters1BoxedBoolean +data class RequiredWithEscapedCharacters1BoxedBoolean
+implements [RequiredWithEscapedCharacters1Boxed](#requiredwithescapedcharacters1boxed) + +record that stores validated boolean payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| RequiredWithEscapedCharacters1BoxedBoolean(boolean data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| boolean | data()
validated payload | +| Any? | getData()
validated payload | + +## RequiredWithEscapedCharacters1BoxedNumber +data class RequiredWithEscapedCharacters1BoxedNumber
+implements [RequiredWithEscapedCharacters1Boxed](#requiredwithescapedcharacters1boxed) + +data class that stores validated Number payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| RequiredWithEscapedCharacters1BoxedNumber(Number data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| Number | data()
validated payload | +| Any? | getData()
validated payload | + +## RequiredWithEscapedCharacters1BoxedString +data class RequiredWithEscapedCharacters1BoxedString
+implements [RequiredWithEscapedCharacters1Boxed](#requiredwithescapedcharacters1boxed) + +data class that stores validated String payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| RequiredWithEscapedCharacters1BoxedString(String data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| String | data()
validated payload | +| Any? | getData()
validated payload | + +## RequiredWithEscapedCharacters1BoxedList +data class RequiredWithEscapedCharacters1BoxedList
+implements [RequiredWithEscapedCharacters1Boxed](#requiredwithescapedcharacters1boxed) + +data class that stores validated List payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| RequiredWithEscapedCharacters1BoxedList(FrozenList data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| FrozenList | data()
validated payload | +| Any? | getData()
validated payload | + +## RequiredWithEscapedCharacters1BoxedMap +data class RequiredWithEscapedCharacters1BoxedMap
+implements [RequiredWithEscapedCharacters1Boxed](#requiredwithescapedcharacters1boxed) + +data class that stores validated Map payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| RequiredWithEscapedCharacters1BoxedMap([RequiredWithEscapedCharactersMap](#requiredwithescapedcharactersmap) data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| [RequiredWithEscapedCharactersMap](#requiredwithescapedcharactersmap) | data()
validated payload | +| Any? | getData()
validated payload | + +## RequiredWithEscapedCharacters1 +class RequiredWithEscapedCharacters1
+extends JsonSchema + +A schema class that validates payloads + +### Field Summary +| Modifier and Type | Field and Description | +| ----------------- | ---------------------- | +| Set | required = setOf(
    "foo\tbar",
    "foo\nbar",
    "foo\u000Cbar",
    "foo\rbar",
    "foo\"bar",
    "foo\\bar"
)
| + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| String | validate(arg: String, configuration: SchemaConfiguration) | +| Nothing? | validate(arg: Nothing?, configuration: SchemaConfiguration) | +| int | validate(arg: int, configuration: SchemaConfiguration) | +| long | validate(arg: long, configuration: SchemaConfiguration) | +| float | validate(arg: float, configuration: SchemaConfiguration) | +| double | validate(arg: double, configuration: SchemaConfiguration) | +| Number | validate(arg: Number, configuration: SchemaConfiguration) | +| boolean | validate(arg: boolean, configuration: SchemaConfiguration) | +| [RequiredWithEscapedCharactersMap](#requiredwithescapedcharactersmap) | validate(arg: [Map<?, ?>](#requiredwithescapedcharactersmapbuilder), configuration: SchemaConfiguration) | +| FrozenList | validate(arg: List<*>, configuration: SchemaConfiguration) | +| [RequiredWithEscapedCharacters1BoxedString](#requiredwithescapedcharacters1boxedstring) | validateAndBox(String, configuration: SchemaConfiguration) | +| [RequiredWithEscapedCharacters1BoxedVoid](#requiredwithescapedcharacters1boxedvoid) | validateAndBox(Nothing?, configuration: SchemaConfiguration) | +| [RequiredWithEscapedCharacters1BoxedNumber](#requiredwithescapedcharacters1boxednumber) | validateAndBox(Number, configuration: SchemaConfiguration) | +| [RequiredWithEscapedCharacters1BoxedBoolean](#requiredwithescapedcharacters1boxedboolean) | validateAndBox(boolean, configuration: SchemaConfiguration) | +| [RequiredWithEscapedCharacters1BoxedMap](#requiredwithescapedcharacters1boxedmap) | validateAndBox([Map<?, ?>](#requiredwithescapedcharactersmapbuilder), configuration: SchemaConfiguration) | +| [RequiredWithEscapedCharacters1BoxedList](#requiredwithescapedcharacters1boxedlist) | validateAndBox(List<*>, configuration: SchemaConfiguration) | +| [RequiredWithEscapedCharacters1Boxed](#requiredwithescapedcharacters1boxed) | validateAndBox(Any?, configuration: SchemaConfiguration) | +| Any? | validate(arg: Any?, configuration: SchemaConfiguration) | + +## RequiredWithEscapedCharactersMap000000Builder +class RequiredWithEscapedCharactersMap000000Builder
+builder for `Map` + +A class that builds the Map input type + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| RequiredWithEscapedCharactersMap000000Builder(Map instance)
Creates a builder that contains the passed instance | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| Map | build()
Returns map input that should be used with Schema.validate | +| [RequiredWithEscapedCharactersMap000000Builder](#requiredwithescapedcharactersmap000000builder) | additionalProperty(key: String, value: Nothing?) | +| [RequiredWithEscapedCharactersMap000000Builder](#requiredwithescapedcharactersmap000000builder) | additionalProperty(key: String, value: Boolean) | +| [RequiredWithEscapedCharactersMap000000Builder](#requiredwithescapedcharactersmap000000builder) | additionalProperty(key: String, value: String) | +| [RequiredWithEscapedCharactersMap000000Builder](#requiredwithescapedcharactersmap000000builder) | additionalProperty(key: String, value: Int) | +| [RequiredWithEscapedCharactersMap000000Builder](#requiredwithescapedcharactersmap000000builder) | additionalProperty(key: String, value: Float) | +| [RequiredWithEscapedCharactersMap000000Builder](#requiredwithescapedcharactersmap000000builder) | additionalProperty(key: String, value: Long) | +| [RequiredWithEscapedCharactersMap000000Builder](#requiredwithescapedcharactersmap000000builder) | additionalProperty(key: String, value: Double) | +| [RequiredWithEscapedCharactersMap000000Builder](#requiredwithescapedcharactersmap000000builder) | additionalProperty(key: String, value: List) | +| [RequiredWithEscapedCharactersMap000000Builder](#requiredwithescapedcharactersmap000000builder) | additionalProperty(key: String, value: Map) | + +## RequiredWithEscapedCharactersMap000001Builder +class RequiredWithEscapedCharactersMap000001Builder
+builder for `Map` + +A class that builds the Map input type + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| RequiredWithEscapedCharactersMap000001Builder(Map instance)
Creates a builder that contains the passed instance | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| [RequiredWithEscapedCharactersMap000000Builder](#requiredwithescapedcharactersmap000000builder) | fooReverseSolidusReverseSolidusBar(value: Nothing?) | +| [RequiredWithEscapedCharactersMap000000Builder](#requiredwithescapedcharactersmap000000builder) | fooReverseSolidusReverseSolidusBar(value: Boolean) | +| [RequiredWithEscapedCharactersMap000000Builder](#requiredwithescapedcharactersmap000000builder) | fooReverseSolidusReverseSolidusBar(value: String) | +| [RequiredWithEscapedCharactersMap000000Builder](#requiredwithescapedcharactersmap000000builder) | fooReverseSolidusReverseSolidusBar(value: Int) | +| [RequiredWithEscapedCharactersMap000000Builder](#requiredwithescapedcharactersmap000000builder) | fooReverseSolidusReverseSolidusBar(value: Float) | +| [RequiredWithEscapedCharactersMap000000Builder](#requiredwithescapedcharactersmap000000builder) | fooReverseSolidusReverseSolidusBar(value: Long) | +| [RequiredWithEscapedCharactersMap000000Builder](#requiredwithescapedcharactersmap000000builder) | fooReverseSolidusReverseSolidusBar(value: Double) | +| [RequiredWithEscapedCharactersMap000000Builder](#requiredwithescapedcharactersmap000000builder) | fooReverseSolidusReverseSolidusBar(value: List) | +| [RequiredWithEscapedCharactersMap000000Builder](#requiredwithescapedcharactersmap000000builder) | fooReverseSolidusReverseSolidusBar(value: Map) | + +## RequiredWithEscapedCharactersMap000010Builder +class RequiredWithEscapedCharactersMap000010Builder
+builder for `Map` + +A class that builds the Map input type + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| RequiredWithEscapedCharactersMap000010Builder(Map instance)
Creates a builder that contains the passed instance | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| [RequiredWithEscapedCharactersMap000000Builder](#requiredwithescapedcharactersmap000000builder) | fooReverseSolidusQuotationMarkBar(value: Nothing?) | +| [RequiredWithEscapedCharactersMap000000Builder](#requiredwithescapedcharactersmap000000builder) | fooReverseSolidusQuotationMarkBar(value: Boolean) | +| [RequiredWithEscapedCharactersMap000000Builder](#requiredwithescapedcharactersmap000000builder) | fooReverseSolidusQuotationMarkBar(value: String) | +| [RequiredWithEscapedCharactersMap000000Builder](#requiredwithescapedcharactersmap000000builder) | fooReverseSolidusQuotationMarkBar(value: Int) | +| [RequiredWithEscapedCharactersMap000000Builder](#requiredwithescapedcharactersmap000000builder) | fooReverseSolidusQuotationMarkBar(value: Float) | +| [RequiredWithEscapedCharactersMap000000Builder](#requiredwithescapedcharactersmap000000builder) | fooReverseSolidusQuotationMarkBar(value: Long) | +| [RequiredWithEscapedCharactersMap000000Builder](#requiredwithescapedcharactersmap000000builder) | fooReverseSolidusQuotationMarkBar(value: Double) | +| [RequiredWithEscapedCharactersMap000000Builder](#requiredwithescapedcharactersmap000000builder) | fooReverseSolidusQuotationMarkBar(value: List) | +| [RequiredWithEscapedCharactersMap000000Builder](#requiredwithescapedcharactersmap000000builder) | fooReverseSolidusQuotationMarkBar(value: Map) | + +## RequiredWithEscapedCharactersMap000011Builder +class RequiredWithEscapedCharactersMap000011Builder
+builder for `Map` + +A class that builds the Map input type + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| RequiredWithEscapedCharactersMap000011Builder(Map instance)
Creates a builder that contains the passed instance | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| [RequiredWithEscapedCharactersMap000001Builder](#requiredwithescapedcharactersmap000001builder) | fooReverseSolidusQuotationMarkBar(value: Nothing?) | +| [RequiredWithEscapedCharactersMap000001Builder](#requiredwithescapedcharactersmap000001builder) | fooReverseSolidusQuotationMarkBar(value: Boolean) | +| [RequiredWithEscapedCharactersMap000001Builder](#requiredwithescapedcharactersmap000001builder) | fooReverseSolidusQuotationMarkBar(value: String) | +| [RequiredWithEscapedCharactersMap000001Builder](#requiredwithescapedcharactersmap000001builder) | fooReverseSolidusQuotationMarkBar(value: Int) | +| [RequiredWithEscapedCharactersMap000001Builder](#requiredwithescapedcharactersmap000001builder) | fooReverseSolidusQuotationMarkBar(value: Float) | +| [RequiredWithEscapedCharactersMap000001Builder](#requiredwithescapedcharactersmap000001builder) | fooReverseSolidusQuotationMarkBar(value: Long) | +| [RequiredWithEscapedCharactersMap000001Builder](#requiredwithescapedcharactersmap000001builder) | fooReverseSolidusQuotationMarkBar(value: Double) | +| [RequiredWithEscapedCharactersMap000001Builder](#requiredwithescapedcharactersmap000001builder) | fooReverseSolidusQuotationMarkBar(value: List) | +| [RequiredWithEscapedCharactersMap000001Builder](#requiredwithescapedcharactersmap000001builder) | fooReverseSolidusQuotationMarkBar(value: Map) | +| [RequiredWithEscapedCharactersMap000010Builder](#requiredwithescapedcharactersmap000010builder) | fooReverseSolidusReverseSolidusBar(value: Nothing?) | +| [RequiredWithEscapedCharactersMap000010Builder](#requiredwithescapedcharactersmap000010builder) | fooReverseSolidusReverseSolidusBar(value: Boolean) | +| [RequiredWithEscapedCharactersMap000010Builder](#requiredwithescapedcharactersmap000010builder) | fooReverseSolidusReverseSolidusBar(value: String) | +| [RequiredWithEscapedCharactersMap000010Builder](#requiredwithescapedcharactersmap000010builder) | fooReverseSolidusReverseSolidusBar(value: Int) | +| [RequiredWithEscapedCharactersMap000010Builder](#requiredwithescapedcharactersmap000010builder) | fooReverseSolidusReverseSolidusBar(value: Float) | +| [RequiredWithEscapedCharactersMap000010Builder](#requiredwithescapedcharactersmap000010builder) | fooReverseSolidusReverseSolidusBar(value: Long) | +| [RequiredWithEscapedCharactersMap000010Builder](#requiredwithescapedcharactersmap000010builder) | fooReverseSolidusReverseSolidusBar(value: Double) | +| [RequiredWithEscapedCharactersMap000010Builder](#requiredwithescapedcharactersmap000010builder) | fooReverseSolidusReverseSolidusBar(value: List) | +| [RequiredWithEscapedCharactersMap000010Builder](#requiredwithescapedcharactersmap000010builder) | fooReverseSolidusReverseSolidusBar(value: Map) | + +## RequiredWithEscapedCharactersMap000100Builder +class RequiredWithEscapedCharactersMap000100Builder
+builder for `Map` + +A class that builds the Map input type + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| RequiredWithEscapedCharactersMap000100Builder(Map instance)
Creates a builder that contains the passed instance | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| [RequiredWithEscapedCharactersMap000000Builder](#requiredwithescapedcharactersmap000000builder) | fooReverseSolidusRbar(value: Nothing?) | +| [RequiredWithEscapedCharactersMap000000Builder](#requiredwithescapedcharactersmap000000builder) | fooReverseSolidusRbar(value: Boolean) | +| [RequiredWithEscapedCharactersMap000000Builder](#requiredwithescapedcharactersmap000000builder) | fooReverseSolidusRbar(value: String) | +| [RequiredWithEscapedCharactersMap000000Builder](#requiredwithescapedcharactersmap000000builder) | fooReverseSolidusRbar(value: Int) | +| [RequiredWithEscapedCharactersMap000000Builder](#requiredwithescapedcharactersmap000000builder) | fooReverseSolidusRbar(value: Float) | +| [RequiredWithEscapedCharactersMap000000Builder](#requiredwithescapedcharactersmap000000builder) | fooReverseSolidusRbar(value: Long) | +| [RequiredWithEscapedCharactersMap000000Builder](#requiredwithescapedcharactersmap000000builder) | fooReverseSolidusRbar(value: Double) | +| [RequiredWithEscapedCharactersMap000000Builder](#requiredwithescapedcharactersmap000000builder) | fooReverseSolidusRbar(value: List) | +| [RequiredWithEscapedCharactersMap000000Builder](#requiredwithescapedcharactersmap000000builder) | fooReverseSolidusRbar(value: Map) | + +## RequiredWithEscapedCharactersMap000101Builder +class RequiredWithEscapedCharactersMap000101Builder
+builder for `Map` + +A class that builds the Map input type + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| RequiredWithEscapedCharactersMap000101Builder(Map instance)
Creates a builder that contains the passed instance | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| [RequiredWithEscapedCharactersMap000001Builder](#requiredwithescapedcharactersmap000001builder) | fooReverseSolidusRbar(value: Nothing?) | +| [RequiredWithEscapedCharactersMap000001Builder](#requiredwithescapedcharactersmap000001builder) | fooReverseSolidusRbar(value: Boolean) | +| [RequiredWithEscapedCharactersMap000001Builder](#requiredwithescapedcharactersmap000001builder) | fooReverseSolidusRbar(value: String) | +| [RequiredWithEscapedCharactersMap000001Builder](#requiredwithescapedcharactersmap000001builder) | fooReverseSolidusRbar(value: Int) | +| [RequiredWithEscapedCharactersMap000001Builder](#requiredwithescapedcharactersmap000001builder) | fooReverseSolidusRbar(value: Float) | +| [RequiredWithEscapedCharactersMap000001Builder](#requiredwithescapedcharactersmap000001builder) | fooReverseSolidusRbar(value: Long) | +| [RequiredWithEscapedCharactersMap000001Builder](#requiredwithescapedcharactersmap000001builder) | fooReverseSolidusRbar(value: Double) | +| [RequiredWithEscapedCharactersMap000001Builder](#requiredwithescapedcharactersmap000001builder) | fooReverseSolidusRbar(value: List) | +| [RequiredWithEscapedCharactersMap000001Builder](#requiredwithescapedcharactersmap000001builder) | fooReverseSolidusRbar(value: Map) | +| [RequiredWithEscapedCharactersMap000100Builder](#requiredwithescapedcharactersmap000100builder) | fooReverseSolidusReverseSolidusBar(value: Nothing?) | +| [RequiredWithEscapedCharactersMap000100Builder](#requiredwithescapedcharactersmap000100builder) | fooReverseSolidusReverseSolidusBar(value: Boolean) | +| [RequiredWithEscapedCharactersMap000100Builder](#requiredwithescapedcharactersmap000100builder) | fooReverseSolidusReverseSolidusBar(value: String) | +| [RequiredWithEscapedCharactersMap000100Builder](#requiredwithescapedcharactersmap000100builder) | fooReverseSolidusReverseSolidusBar(value: Int) | +| [RequiredWithEscapedCharactersMap000100Builder](#requiredwithescapedcharactersmap000100builder) | fooReverseSolidusReverseSolidusBar(value: Float) | +| [RequiredWithEscapedCharactersMap000100Builder](#requiredwithescapedcharactersmap000100builder) | fooReverseSolidusReverseSolidusBar(value: Long) | +| [RequiredWithEscapedCharactersMap000100Builder](#requiredwithescapedcharactersmap000100builder) | fooReverseSolidusReverseSolidusBar(value: Double) | +| [RequiredWithEscapedCharactersMap000100Builder](#requiredwithescapedcharactersmap000100builder) | fooReverseSolidusReverseSolidusBar(value: List) | +| [RequiredWithEscapedCharactersMap000100Builder](#requiredwithescapedcharactersmap000100builder) | fooReverseSolidusReverseSolidusBar(value: Map) | + +## RequiredWithEscapedCharactersMap000110Builder +class RequiredWithEscapedCharactersMap000110Builder
+builder for `Map` + +A class that builds the Map input type + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| RequiredWithEscapedCharactersMap000110Builder(Map instance)
Creates a builder that contains the passed instance | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| [RequiredWithEscapedCharactersMap000010Builder](#requiredwithescapedcharactersmap000010builder) | fooReverseSolidusRbar(value: Nothing?) | +| [RequiredWithEscapedCharactersMap000010Builder](#requiredwithescapedcharactersmap000010builder) | fooReverseSolidusRbar(value: Boolean) | +| [RequiredWithEscapedCharactersMap000010Builder](#requiredwithescapedcharactersmap000010builder) | fooReverseSolidusRbar(value: String) | +| [RequiredWithEscapedCharactersMap000010Builder](#requiredwithescapedcharactersmap000010builder) | fooReverseSolidusRbar(value: Int) | +| [RequiredWithEscapedCharactersMap000010Builder](#requiredwithescapedcharactersmap000010builder) | fooReverseSolidusRbar(value: Float) | +| [RequiredWithEscapedCharactersMap000010Builder](#requiredwithescapedcharactersmap000010builder) | fooReverseSolidusRbar(value: Long) | +| [RequiredWithEscapedCharactersMap000010Builder](#requiredwithescapedcharactersmap000010builder) | fooReverseSolidusRbar(value: Double) | +| [RequiredWithEscapedCharactersMap000010Builder](#requiredwithescapedcharactersmap000010builder) | fooReverseSolidusRbar(value: List) | +| [RequiredWithEscapedCharactersMap000010Builder](#requiredwithescapedcharactersmap000010builder) | fooReverseSolidusRbar(value: Map) | +| [RequiredWithEscapedCharactersMap000100Builder](#requiredwithescapedcharactersmap000100builder) | fooReverseSolidusQuotationMarkBar(value: Nothing?) | +| [RequiredWithEscapedCharactersMap000100Builder](#requiredwithescapedcharactersmap000100builder) | fooReverseSolidusQuotationMarkBar(value: Boolean) | +| [RequiredWithEscapedCharactersMap000100Builder](#requiredwithescapedcharactersmap000100builder) | fooReverseSolidusQuotationMarkBar(value: String) | +| [RequiredWithEscapedCharactersMap000100Builder](#requiredwithescapedcharactersmap000100builder) | fooReverseSolidusQuotationMarkBar(value: Int) | +| [RequiredWithEscapedCharactersMap000100Builder](#requiredwithescapedcharactersmap000100builder) | fooReverseSolidusQuotationMarkBar(value: Float) | +| [RequiredWithEscapedCharactersMap000100Builder](#requiredwithescapedcharactersmap000100builder) | fooReverseSolidusQuotationMarkBar(value: Long) | +| [RequiredWithEscapedCharactersMap000100Builder](#requiredwithescapedcharactersmap000100builder) | fooReverseSolidusQuotationMarkBar(value: Double) | +| [RequiredWithEscapedCharactersMap000100Builder](#requiredwithescapedcharactersmap000100builder) | fooReverseSolidusQuotationMarkBar(value: List) | +| [RequiredWithEscapedCharactersMap000100Builder](#requiredwithescapedcharactersmap000100builder) | fooReverseSolidusQuotationMarkBar(value: Map) | + +## RequiredWithEscapedCharactersMap000111Builder +class RequiredWithEscapedCharactersMap000111Builder
+builder for `Map` + +A class that builds the Map input type + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| RequiredWithEscapedCharactersMap000111Builder(Map instance)
Creates a builder that contains the passed instance | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| [RequiredWithEscapedCharactersMap000011Builder](#requiredwithescapedcharactersmap000011builder) | fooReverseSolidusRbar(value: Nothing?) | +| [RequiredWithEscapedCharactersMap000011Builder](#requiredwithescapedcharactersmap000011builder) | fooReverseSolidusRbar(value: Boolean) | +| [RequiredWithEscapedCharactersMap000011Builder](#requiredwithescapedcharactersmap000011builder) | fooReverseSolidusRbar(value: String) | +| [RequiredWithEscapedCharactersMap000011Builder](#requiredwithescapedcharactersmap000011builder) | fooReverseSolidusRbar(value: Int) | +| [RequiredWithEscapedCharactersMap000011Builder](#requiredwithescapedcharactersmap000011builder) | fooReverseSolidusRbar(value: Float) | +| [RequiredWithEscapedCharactersMap000011Builder](#requiredwithescapedcharactersmap000011builder) | fooReverseSolidusRbar(value: Long) | +| [RequiredWithEscapedCharactersMap000011Builder](#requiredwithescapedcharactersmap000011builder) | fooReverseSolidusRbar(value: Double) | +| [RequiredWithEscapedCharactersMap000011Builder](#requiredwithescapedcharactersmap000011builder) | fooReverseSolidusRbar(value: List) | +| [RequiredWithEscapedCharactersMap000011Builder](#requiredwithescapedcharactersmap000011builder) | fooReverseSolidusRbar(value: Map) | +| [RequiredWithEscapedCharactersMap000101Builder](#requiredwithescapedcharactersmap000101builder) | fooReverseSolidusQuotationMarkBar(value: Nothing?) | +| [RequiredWithEscapedCharactersMap000101Builder](#requiredwithescapedcharactersmap000101builder) | fooReverseSolidusQuotationMarkBar(value: Boolean) | +| [RequiredWithEscapedCharactersMap000101Builder](#requiredwithescapedcharactersmap000101builder) | fooReverseSolidusQuotationMarkBar(value: String) | +| [RequiredWithEscapedCharactersMap000101Builder](#requiredwithescapedcharactersmap000101builder) | fooReverseSolidusQuotationMarkBar(value: Int) | +| [RequiredWithEscapedCharactersMap000101Builder](#requiredwithescapedcharactersmap000101builder) | fooReverseSolidusQuotationMarkBar(value: Float) | +| [RequiredWithEscapedCharactersMap000101Builder](#requiredwithescapedcharactersmap000101builder) | fooReverseSolidusQuotationMarkBar(value: Long) | +| [RequiredWithEscapedCharactersMap000101Builder](#requiredwithescapedcharactersmap000101builder) | fooReverseSolidusQuotationMarkBar(value: Double) | +| [RequiredWithEscapedCharactersMap000101Builder](#requiredwithescapedcharactersmap000101builder) | fooReverseSolidusQuotationMarkBar(value: List) | +| [RequiredWithEscapedCharactersMap000101Builder](#requiredwithescapedcharactersmap000101builder) | fooReverseSolidusQuotationMarkBar(value: Map) | +| [RequiredWithEscapedCharactersMap000110Builder](#requiredwithescapedcharactersmap000110builder) | fooReverseSolidusReverseSolidusBar(value: Nothing?) | +| [RequiredWithEscapedCharactersMap000110Builder](#requiredwithescapedcharactersmap000110builder) | fooReverseSolidusReverseSolidusBar(value: Boolean) | +| [RequiredWithEscapedCharactersMap000110Builder](#requiredwithescapedcharactersmap000110builder) | fooReverseSolidusReverseSolidusBar(value: String) | +| [RequiredWithEscapedCharactersMap000110Builder](#requiredwithescapedcharactersmap000110builder) | fooReverseSolidusReverseSolidusBar(value: Int) | +| [RequiredWithEscapedCharactersMap000110Builder](#requiredwithescapedcharactersmap000110builder) | fooReverseSolidusReverseSolidusBar(value: Float) | +| [RequiredWithEscapedCharactersMap000110Builder](#requiredwithescapedcharactersmap000110builder) | fooReverseSolidusReverseSolidusBar(value: Long) | +| [RequiredWithEscapedCharactersMap000110Builder](#requiredwithescapedcharactersmap000110builder) | fooReverseSolidusReverseSolidusBar(value: Double) | +| [RequiredWithEscapedCharactersMap000110Builder](#requiredwithescapedcharactersmap000110builder) | fooReverseSolidusReverseSolidusBar(value: List) | +| [RequiredWithEscapedCharactersMap000110Builder](#requiredwithescapedcharactersmap000110builder) | fooReverseSolidusReverseSolidusBar(value: Map) | + +## RequiredWithEscapedCharactersMap001000Builder +class RequiredWithEscapedCharactersMap001000Builder
+builder for `Map` + +A class that builds the Map input type + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| RequiredWithEscapedCharactersMap001000Builder(Map instance)
Creates a builder that contains the passed instance | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| [RequiredWithEscapedCharactersMap000000Builder](#requiredwithescapedcharactersmap000000builder) | fooReverseSolidusU000cbar(value: Nothing?) | +| [RequiredWithEscapedCharactersMap000000Builder](#requiredwithescapedcharactersmap000000builder) | fooReverseSolidusU000cbar(value: Boolean) | +| [RequiredWithEscapedCharactersMap000000Builder](#requiredwithescapedcharactersmap000000builder) | fooReverseSolidusU000cbar(value: String) | +| [RequiredWithEscapedCharactersMap000000Builder](#requiredwithescapedcharactersmap000000builder) | fooReverseSolidusU000cbar(value: Int) | +| [RequiredWithEscapedCharactersMap000000Builder](#requiredwithescapedcharactersmap000000builder) | fooReverseSolidusU000cbar(value: Float) | +| [RequiredWithEscapedCharactersMap000000Builder](#requiredwithescapedcharactersmap000000builder) | fooReverseSolidusU000cbar(value: Long) | +| [RequiredWithEscapedCharactersMap000000Builder](#requiredwithescapedcharactersmap000000builder) | fooReverseSolidusU000cbar(value: Double) | +| [RequiredWithEscapedCharactersMap000000Builder](#requiredwithescapedcharactersmap000000builder) | fooReverseSolidusU000cbar(value: List) | +| [RequiredWithEscapedCharactersMap000000Builder](#requiredwithescapedcharactersmap000000builder) | fooReverseSolidusU000cbar(value: Map) | + +## RequiredWithEscapedCharactersMap001001Builder +class RequiredWithEscapedCharactersMap001001Builder
+builder for `Map` + +A class that builds the Map input type + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| RequiredWithEscapedCharactersMap001001Builder(Map instance)
Creates a builder that contains the passed instance | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| [RequiredWithEscapedCharactersMap000001Builder](#requiredwithescapedcharactersmap000001builder) | fooReverseSolidusU000cbar(value: Nothing?) | +| [RequiredWithEscapedCharactersMap000001Builder](#requiredwithescapedcharactersmap000001builder) | fooReverseSolidusU000cbar(value: Boolean) | +| [RequiredWithEscapedCharactersMap000001Builder](#requiredwithescapedcharactersmap000001builder) | fooReverseSolidusU000cbar(value: String) | +| [RequiredWithEscapedCharactersMap000001Builder](#requiredwithescapedcharactersmap000001builder) | fooReverseSolidusU000cbar(value: Int) | +| [RequiredWithEscapedCharactersMap000001Builder](#requiredwithescapedcharactersmap000001builder) | fooReverseSolidusU000cbar(value: Float) | +| [RequiredWithEscapedCharactersMap000001Builder](#requiredwithescapedcharactersmap000001builder) | fooReverseSolidusU000cbar(value: Long) | +| [RequiredWithEscapedCharactersMap000001Builder](#requiredwithescapedcharactersmap000001builder) | fooReverseSolidusU000cbar(value: Double) | +| [RequiredWithEscapedCharactersMap000001Builder](#requiredwithescapedcharactersmap000001builder) | fooReverseSolidusU000cbar(value: List) | +| [RequiredWithEscapedCharactersMap000001Builder](#requiredwithescapedcharactersmap000001builder) | fooReverseSolidusU000cbar(value: Map) | +| [RequiredWithEscapedCharactersMap001000Builder](#requiredwithescapedcharactersmap001000builder) | fooReverseSolidusReverseSolidusBar(value: Nothing?) | +| [RequiredWithEscapedCharactersMap001000Builder](#requiredwithescapedcharactersmap001000builder) | fooReverseSolidusReverseSolidusBar(value: Boolean) | +| [RequiredWithEscapedCharactersMap001000Builder](#requiredwithescapedcharactersmap001000builder) | fooReverseSolidusReverseSolidusBar(value: String) | +| [RequiredWithEscapedCharactersMap001000Builder](#requiredwithescapedcharactersmap001000builder) | fooReverseSolidusReverseSolidusBar(value: Int) | +| [RequiredWithEscapedCharactersMap001000Builder](#requiredwithescapedcharactersmap001000builder) | fooReverseSolidusReverseSolidusBar(value: Float) | +| [RequiredWithEscapedCharactersMap001000Builder](#requiredwithescapedcharactersmap001000builder) | fooReverseSolidusReverseSolidusBar(value: Long) | +| [RequiredWithEscapedCharactersMap001000Builder](#requiredwithescapedcharactersmap001000builder) | fooReverseSolidusReverseSolidusBar(value: Double) | +| [RequiredWithEscapedCharactersMap001000Builder](#requiredwithescapedcharactersmap001000builder) | fooReverseSolidusReverseSolidusBar(value: List) | +| [RequiredWithEscapedCharactersMap001000Builder](#requiredwithescapedcharactersmap001000builder) | fooReverseSolidusReverseSolidusBar(value: Map) | + +## RequiredWithEscapedCharactersMap001010Builder +class RequiredWithEscapedCharactersMap001010Builder
+builder for `Map` + +A class that builds the Map input type + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| RequiredWithEscapedCharactersMap001010Builder(Map instance)
Creates a builder that contains the passed instance | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| [RequiredWithEscapedCharactersMap000010Builder](#requiredwithescapedcharactersmap000010builder) | fooReverseSolidusU000cbar(value: Nothing?) | +| [RequiredWithEscapedCharactersMap000010Builder](#requiredwithescapedcharactersmap000010builder) | fooReverseSolidusU000cbar(value: Boolean) | +| [RequiredWithEscapedCharactersMap000010Builder](#requiredwithescapedcharactersmap000010builder) | fooReverseSolidusU000cbar(value: String) | +| [RequiredWithEscapedCharactersMap000010Builder](#requiredwithescapedcharactersmap000010builder) | fooReverseSolidusU000cbar(value: Int) | +| [RequiredWithEscapedCharactersMap000010Builder](#requiredwithescapedcharactersmap000010builder) | fooReverseSolidusU000cbar(value: Float) | +| [RequiredWithEscapedCharactersMap000010Builder](#requiredwithescapedcharactersmap000010builder) | fooReverseSolidusU000cbar(value: Long) | +| [RequiredWithEscapedCharactersMap000010Builder](#requiredwithescapedcharactersmap000010builder) | fooReverseSolidusU000cbar(value: Double) | +| [RequiredWithEscapedCharactersMap000010Builder](#requiredwithescapedcharactersmap000010builder) | fooReverseSolidusU000cbar(value: List) | +| [RequiredWithEscapedCharactersMap000010Builder](#requiredwithescapedcharactersmap000010builder) | fooReverseSolidusU000cbar(value: Map) | +| [RequiredWithEscapedCharactersMap001000Builder](#requiredwithescapedcharactersmap001000builder) | fooReverseSolidusQuotationMarkBar(value: Nothing?) | +| [RequiredWithEscapedCharactersMap001000Builder](#requiredwithescapedcharactersmap001000builder) | fooReverseSolidusQuotationMarkBar(value: Boolean) | +| [RequiredWithEscapedCharactersMap001000Builder](#requiredwithescapedcharactersmap001000builder) | fooReverseSolidusQuotationMarkBar(value: String) | +| [RequiredWithEscapedCharactersMap001000Builder](#requiredwithescapedcharactersmap001000builder) | fooReverseSolidusQuotationMarkBar(value: Int) | +| [RequiredWithEscapedCharactersMap001000Builder](#requiredwithescapedcharactersmap001000builder) | fooReverseSolidusQuotationMarkBar(value: Float) | +| [RequiredWithEscapedCharactersMap001000Builder](#requiredwithescapedcharactersmap001000builder) | fooReverseSolidusQuotationMarkBar(value: Long) | +| [RequiredWithEscapedCharactersMap001000Builder](#requiredwithescapedcharactersmap001000builder) | fooReverseSolidusQuotationMarkBar(value: Double) | +| [RequiredWithEscapedCharactersMap001000Builder](#requiredwithescapedcharactersmap001000builder) | fooReverseSolidusQuotationMarkBar(value: List) | +| [RequiredWithEscapedCharactersMap001000Builder](#requiredwithescapedcharactersmap001000builder) | fooReverseSolidusQuotationMarkBar(value: Map) | + +## RequiredWithEscapedCharactersMap001011Builder +class RequiredWithEscapedCharactersMap001011Builder
+builder for `Map` + +A class that builds the Map input type + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| RequiredWithEscapedCharactersMap001011Builder(Map instance)
Creates a builder that contains the passed instance | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| [RequiredWithEscapedCharactersMap000011Builder](#requiredwithescapedcharactersmap000011builder) | fooReverseSolidusU000cbar(value: Nothing?) | +| [RequiredWithEscapedCharactersMap000011Builder](#requiredwithescapedcharactersmap000011builder) | fooReverseSolidusU000cbar(value: Boolean) | +| [RequiredWithEscapedCharactersMap000011Builder](#requiredwithescapedcharactersmap000011builder) | fooReverseSolidusU000cbar(value: String) | +| [RequiredWithEscapedCharactersMap000011Builder](#requiredwithescapedcharactersmap000011builder) | fooReverseSolidusU000cbar(value: Int) | +| [RequiredWithEscapedCharactersMap000011Builder](#requiredwithescapedcharactersmap000011builder) | fooReverseSolidusU000cbar(value: Float) | +| [RequiredWithEscapedCharactersMap000011Builder](#requiredwithescapedcharactersmap000011builder) | fooReverseSolidusU000cbar(value: Long) | +| [RequiredWithEscapedCharactersMap000011Builder](#requiredwithescapedcharactersmap000011builder) | fooReverseSolidusU000cbar(value: Double) | +| [RequiredWithEscapedCharactersMap000011Builder](#requiredwithescapedcharactersmap000011builder) | fooReverseSolidusU000cbar(value: List) | +| [RequiredWithEscapedCharactersMap000011Builder](#requiredwithescapedcharactersmap000011builder) | fooReverseSolidusU000cbar(value: Map) | +| [RequiredWithEscapedCharactersMap001001Builder](#requiredwithescapedcharactersmap001001builder) | fooReverseSolidusQuotationMarkBar(value: Nothing?) | +| [RequiredWithEscapedCharactersMap001001Builder](#requiredwithescapedcharactersmap001001builder) | fooReverseSolidusQuotationMarkBar(value: Boolean) | +| [RequiredWithEscapedCharactersMap001001Builder](#requiredwithescapedcharactersmap001001builder) | fooReverseSolidusQuotationMarkBar(value: String) | +| [RequiredWithEscapedCharactersMap001001Builder](#requiredwithescapedcharactersmap001001builder) | fooReverseSolidusQuotationMarkBar(value: Int) | +| [RequiredWithEscapedCharactersMap001001Builder](#requiredwithescapedcharactersmap001001builder) | fooReverseSolidusQuotationMarkBar(value: Float) | +| [RequiredWithEscapedCharactersMap001001Builder](#requiredwithescapedcharactersmap001001builder) | fooReverseSolidusQuotationMarkBar(value: Long) | +| [RequiredWithEscapedCharactersMap001001Builder](#requiredwithescapedcharactersmap001001builder) | fooReverseSolidusQuotationMarkBar(value: Double) | +| [RequiredWithEscapedCharactersMap001001Builder](#requiredwithescapedcharactersmap001001builder) | fooReverseSolidusQuotationMarkBar(value: List) | +| [RequiredWithEscapedCharactersMap001001Builder](#requiredwithescapedcharactersmap001001builder) | fooReverseSolidusQuotationMarkBar(value: Map) | +| [RequiredWithEscapedCharactersMap001010Builder](#requiredwithescapedcharactersmap001010builder) | fooReverseSolidusReverseSolidusBar(value: Nothing?) | +| [RequiredWithEscapedCharactersMap001010Builder](#requiredwithescapedcharactersmap001010builder) | fooReverseSolidusReverseSolidusBar(value: Boolean) | +| [RequiredWithEscapedCharactersMap001010Builder](#requiredwithescapedcharactersmap001010builder) | fooReverseSolidusReverseSolidusBar(value: String) | +| [RequiredWithEscapedCharactersMap001010Builder](#requiredwithescapedcharactersmap001010builder) | fooReverseSolidusReverseSolidusBar(value: Int) | +| [RequiredWithEscapedCharactersMap001010Builder](#requiredwithescapedcharactersmap001010builder) | fooReverseSolidusReverseSolidusBar(value: Float) | +| [RequiredWithEscapedCharactersMap001010Builder](#requiredwithescapedcharactersmap001010builder) | fooReverseSolidusReverseSolidusBar(value: Long) | +| [RequiredWithEscapedCharactersMap001010Builder](#requiredwithescapedcharactersmap001010builder) | fooReverseSolidusReverseSolidusBar(value: Double) | +| [RequiredWithEscapedCharactersMap001010Builder](#requiredwithescapedcharactersmap001010builder) | fooReverseSolidusReverseSolidusBar(value: List) | +| [RequiredWithEscapedCharactersMap001010Builder](#requiredwithescapedcharactersmap001010builder) | fooReverseSolidusReverseSolidusBar(value: Map) | + +## RequiredWithEscapedCharactersMap001100Builder +class RequiredWithEscapedCharactersMap001100Builder
+builder for `Map` + +A class that builds the Map input type + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| RequiredWithEscapedCharactersMap001100Builder(Map instance)
Creates a builder that contains the passed instance | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| [RequiredWithEscapedCharactersMap000100Builder](#requiredwithescapedcharactersmap000100builder) | fooReverseSolidusU000cbar(value: Nothing?) | +| [RequiredWithEscapedCharactersMap000100Builder](#requiredwithescapedcharactersmap000100builder) | fooReverseSolidusU000cbar(value: Boolean) | +| [RequiredWithEscapedCharactersMap000100Builder](#requiredwithescapedcharactersmap000100builder) | fooReverseSolidusU000cbar(value: String) | +| [RequiredWithEscapedCharactersMap000100Builder](#requiredwithescapedcharactersmap000100builder) | fooReverseSolidusU000cbar(value: Int) | +| [RequiredWithEscapedCharactersMap000100Builder](#requiredwithescapedcharactersmap000100builder) | fooReverseSolidusU000cbar(value: Float) | +| [RequiredWithEscapedCharactersMap000100Builder](#requiredwithescapedcharactersmap000100builder) | fooReverseSolidusU000cbar(value: Long) | +| [RequiredWithEscapedCharactersMap000100Builder](#requiredwithescapedcharactersmap000100builder) | fooReverseSolidusU000cbar(value: Double) | +| [RequiredWithEscapedCharactersMap000100Builder](#requiredwithescapedcharactersmap000100builder) | fooReverseSolidusU000cbar(value: List) | +| [RequiredWithEscapedCharactersMap000100Builder](#requiredwithescapedcharactersmap000100builder) | fooReverseSolidusU000cbar(value: Map) | +| [RequiredWithEscapedCharactersMap001000Builder](#requiredwithescapedcharactersmap001000builder) | fooReverseSolidusRbar(value: Nothing?) | +| [RequiredWithEscapedCharactersMap001000Builder](#requiredwithescapedcharactersmap001000builder) | fooReverseSolidusRbar(value: Boolean) | +| [RequiredWithEscapedCharactersMap001000Builder](#requiredwithescapedcharactersmap001000builder) | fooReverseSolidusRbar(value: String) | +| [RequiredWithEscapedCharactersMap001000Builder](#requiredwithescapedcharactersmap001000builder) | fooReverseSolidusRbar(value: Int) | +| [RequiredWithEscapedCharactersMap001000Builder](#requiredwithescapedcharactersmap001000builder) | fooReverseSolidusRbar(value: Float) | +| [RequiredWithEscapedCharactersMap001000Builder](#requiredwithescapedcharactersmap001000builder) | fooReverseSolidusRbar(value: Long) | +| [RequiredWithEscapedCharactersMap001000Builder](#requiredwithescapedcharactersmap001000builder) | fooReverseSolidusRbar(value: Double) | +| [RequiredWithEscapedCharactersMap001000Builder](#requiredwithescapedcharactersmap001000builder) | fooReverseSolidusRbar(value: List) | +| [RequiredWithEscapedCharactersMap001000Builder](#requiredwithescapedcharactersmap001000builder) | fooReverseSolidusRbar(value: Map) | + +## RequiredWithEscapedCharactersMap001101Builder +class RequiredWithEscapedCharactersMap001101Builder
+builder for `Map` + +A class that builds the Map input type + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| RequiredWithEscapedCharactersMap001101Builder(Map instance)
Creates a builder that contains the passed instance | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| [RequiredWithEscapedCharactersMap000101Builder](#requiredwithescapedcharactersmap000101builder) | fooReverseSolidusU000cbar(value: Nothing?) | +| [RequiredWithEscapedCharactersMap000101Builder](#requiredwithescapedcharactersmap000101builder) | fooReverseSolidusU000cbar(value: Boolean) | +| [RequiredWithEscapedCharactersMap000101Builder](#requiredwithescapedcharactersmap000101builder) | fooReverseSolidusU000cbar(value: String) | +| [RequiredWithEscapedCharactersMap000101Builder](#requiredwithescapedcharactersmap000101builder) | fooReverseSolidusU000cbar(value: Int) | +| [RequiredWithEscapedCharactersMap000101Builder](#requiredwithescapedcharactersmap000101builder) | fooReverseSolidusU000cbar(value: Float) | +| [RequiredWithEscapedCharactersMap000101Builder](#requiredwithescapedcharactersmap000101builder) | fooReverseSolidusU000cbar(value: Long) | +| [RequiredWithEscapedCharactersMap000101Builder](#requiredwithescapedcharactersmap000101builder) | fooReverseSolidusU000cbar(value: Double) | +| [RequiredWithEscapedCharactersMap000101Builder](#requiredwithescapedcharactersmap000101builder) | fooReverseSolidusU000cbar(value: List) | +| [RequiredWithEscapedCharactersMap000101Builder](#requiredwithescapedcharactersmap000101builder) | fooReverseSolidusU000cbar(value: Map) | +| [RequiredWithEscapedCharactersMap001001Builder](#requiredwithescapedcharactersmap001001builder) | fooReverseSolidusRbar(value: Nothing?) | +| [RequiredWithEscapedCharactersMap001001Builder](#requiredwithescapedcharactersmap001001builder) | fooReverseSolidusRbar(value: Boolean) | +| [RequiredWithEscapedCharactersMap001001Builder](#requiredwithescapedcharactersmap001001builder) | fooReverseSolidusRbar(value: String) | +| [RequiredWithEscapedCharactersMap001001Builder](#requiredwithescapedcharactersmap001001builder) | fooReverseSolidusRbar(value: Int) | +| [RequiredWithEscapedCharactersMap001001Builder](#requiredwithescapedcharactersmap001001builder) | fooReverseSolidusRbar(value: Float) | +| [RequiredWithEscapedCharactersMap001001Builder](#requiredwithescapedcharactersmap001001builder) | fooReverseSolidusRbar(value: Long) | +| [RequiredWithEscapedCharactersMap001001Builder](#requiredwithescapedcharactersmap001001builder) | fooReverseSolidusRbar(value: Double) | +| [RequiredWithEscapedCharactersMap001001Builder](#requiredwithescapedcharactersmap001001builder) | fooReverseSolidusRbar(value: List) | +| [RequiredWithEscapedCharactersMap001001Builder](#requiredwithescapedcharactersmap001001builder) | fooReverseSolidusRbar(value: Map) | +| [RequiredWithEscapedCharactersMap001100Builder](#requiredwithescapedcharactersmap001100builder) | fooReverseSolidusReverseSolidusBar(value: Nothing?) | +| [RequiredWithEscapedCharactersMap001100Builder](#requiredwithescapedcharactersmap001100builder) | fooReverseSolidusReverseSolidusBar(value: Boolean) | +| [RequiredWithEscapedCharactersMap001100Builder](#requiredwithescapedcharactersmap001100builder) | fooReverseSolidusReverseSolidusBar(value: String) | +| [RequiredWithEscapedCharactersMap001100Builder](#requiredwithescapedcharactersmap001100builder) | fooReverseSolidusReverseSolidusBar(value: Int) | +| [RequiredWithEscapedCharactersMap001100Builder](#requiredwithescapedcharactersmap001100builder) | fooReverseSolidusReverseSolidusBar(value: Float) | +| [RequiredWithEscapedCharactersMap001100Builder](#requiredwithescapedcharactersmap001100builder) | fooReverseSolidusReverseSolidusBar(value: Long) | +| [RequiredWithEscapedCharactersMap001100Builder](#requiredwithescapedcharactersmap001100builder) | fooReverseSolidusReverseSolidusBar(value: Double) | +| [RequiredWithEscapedCharactersMap001100Builder](#requiredwithescapedcharactersmap001100builder) | fooReverseSolidusReverseSolidusBar(value: List) | +| [RequiredWithEscapedCharactersMap001100Builder](#requiredwithescapedcharactersmap001100builder) | fooReverseSolidusReverseSolidusBar(value: Map) | + +## RequiredWithEscapedCharactersMap001110Builder +class RequiredWithEscapedCharactersMap001110Builder
+builder for `Map` + +A class that builds the Map input type + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| RequiredWithEscapedCharactersMap001110Builder(Map instance)
Creates a builder that contains the passed instance | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| [RequiredWithEscapedCharactersMap000110Builder](#requiredwithescapedcharactersmap000110builder) | fooReverseSolidusU000cbar(value: Nothing?) | +| [RequiredWithEscapedCharactersMap000110Builder](#requiredwithescapedcharactersmap000110builder) | fooReverseSolidusU000cbar(value: Boolean) | +| [RequiredWithEscapedCharactersMap000110Builder](#requiredwithescapedcharactersmap000110builder) | fooReverseSolidusU000cbar(value: String) | +| [RequiredWithEscapedCharactersMap000110Builder](#requiredwithescapedcharactersmap000110builder) | fooReverseSolidusU000cbar(value: Int) | +| [RequiredWithEscapedCharactersMap000110Builder](#requiredwithescapedcharactersmap000110builder) | fooReverseSolidusU000cbar(value: Float) | +| [RequiredWithEscapedCharactersMap000110Builder](#requiredwithescapedcharactersmap000110builder) | fooReverseSolidusU000cbar(value: Long) | +| [RequiredWithEscapedCharactersMap000110Builder](#requiredwithescapedcharactersmap000110builder) | fooReverseSolidusU000cbar(value: Double) | +| [RequiredWithEscapedCharactersMap000110Builder](#requiredwithescapedcharactersmap000110builder) | fooReverseSolidusU000cbar(value: List) | +| [RequiredWithEscapedCharactersMap000110Builder](#requiredwithescapedcharactersmap000110builder) | fooReverseSolidusU000cbar(value: Map) | +| [RequiredWithEscapedCharactersMap001010Builder](#requiredwithescapedcharactersmap001010builder) | fooReverseSolidusRbar(value: Nothing?) | +| [RequiredWithEscapedCharactersMap001010Builder](#requiredwithescapedcharactersmap001010builder) | fooReverseSolidusRbar(value: Boolean) | +| [RequiredWithEscapedCharactersMap001010Builder](#requiredwithescapedcharactersmap001010builder) | fooReverseSolidusRbar(value: String) | +| [RequiredWithEscapedCharactersMap001010Builder](#requiredwithescapedcharactersmap001010builder) | fooReverseSolidusRbar(value: Int) | +| [RequiredWithEscapedCharactersMap001010Builder](#requiredwithescapedcharactersmap001010builder) | fooReverseSolidusRbar(value: Float) | +| [RequiredWithEscapedCharactersMap001010Builder](#requiredwithescapedcharactersmap001010builder) | fooReverseSolidusRbar(value: Long) | +| [RequiredWithEscapedCharactersMap001010Builder](#requiredwithescapedcharactersmap001010builder) | fooReverseSolidusRbar(value: Double) | +| [RequiredWithEscapedCharactersMap001010Builder](#requiredwithescapedcharactersmap001010builder) | fooReverseSolidusRbar(value: List) | +| [RequiredWithEscapedCharactersMap001010Builder](#requiredwithescapedcharactersmap001010builder) | fooReverseSolidusRbar(value: Map) | +| [RequiredWithEscapedCharactersMap001100Builder](#requiredwithescapedcharactersmap001100builder) | fooReverseSolidusQuotationMarkBar(value: Nothing?) | +| [RequiredWithEscapedCharactersMap001100Builder](#requiredwithescapedcharactersmap001100builder) | fooReverseSolidusQuotationMarkBar(value: Boolean) | +| [RequiredWithEscapedCharactersMap001100Builder](#requiredwithescapedcharactersmap001100builder) | fooReverseSolidusQuotationMarkBar(value: String) | +| [RequiredWithEscapedCharactersMap001100Builder](#requiredwithescapedcharactersmap001100builder) | fooReverseSolidusQuotationMarkBar(value: Int) | +| [RequiredWithEscapedCharactersMap001100Builder](#requiredwithescapedcharactersmap001100builder) | fooReverseSolidusQuotationMarkBar(value: Float) | +| [RequiredWithEscapedCharactersMap001100Builder](#requiredwithescapedcharactersmap001100builder) | fooReverseSolidusQuotationMarkBar(value: Long) | +| [RequiredWithEscapedCharactersMap001100Builder](#requiredwithescapedcharactersmap001100builder) | fooReverseSolidusQuotationMarkBar(value: Double) | +| [RequiredWithEscapedCharactersMap001100Builder](#requiredwithescapedcharactersmap001100builder) | fooReverseSolidusQuotationMarkBar(value: List) | +| [RequiredWithEscapedCharactersMap001100Builder](#requiredwithescapedcharactersmap001100builder) | fooReverseSolidusQuotationMarkBar(value: Map) | + +## RequiredWithEscapedCharactersMap001111Builder +class RequiredWithEscapedCharactersMap001111Builder
+builder for `Map` + +A class that builds the Map input type + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| RequiredWithEscapedCharactersMap001111Builder(Map instance)
Creates a builder that contains the passed instance | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| [RequiredWithEscapedCharactersMap000111Builder](#requiredwithescapedcharactersmap000111builder) | fooReverseSolidusU000cbar(value: Nothing?) | +| [RequiredWithEscapedCharactersMap000111Builder](#requiredwithescapedcharactersmap000111builder) | fooReverseSolidusU000cbar(value: Boolean) | +| [RequiredWithEscapedCharactersMap000111Builder](#requiredwithescapedcharactersmap000111builder) | fooReverseSolidusU000cbar(value: String) | +| [RequiredWithEscapedCharactersMap000111Builder](#requiredwithescapedcharactersmap000111builder) | fooReverseSolidusU000cbar(value: Int) | +| [RequiredWithEscapedCharactersMap000111Builder](#requiredwithescapedcharactersmap000111builder) | fooReverseSolidusU000cbar(value: Float) | +| [RequiredWithEscapedCharactersMap000111Builder](#requiredwithescapedcharactersmap000111builder) | fooReverseSolidusU000cbar(value: Long) | +| [RequiredWithEscapedCharactersMap000111Builder](#requiredwithescapedcharactersmap000111builder) | fooReverseSolidusU000cbar(value: Double) | +| [RequiredWithEscapedCharactersMap000111Builder](#requiredwithescapedcharactersmap000111builder) | fooReverseSolidusU000cbar(value: List) | +| [RequiredWithEscapedCharactersMap000111Builder](#requiredwithescapedcharactersmap000111builder) | fooReverseSolidusU000cbar(value: Map) | +| [RequiredWithEscapedCharactersMap001011Builder](#requiredwithescapedcharactersmap001011builder) | fooReverseSolidusRbar(value: Nothing?) | +| [RequiredWithEscapedCharactersMap001011Builder](#requiredwithescapedcharactersmap001011builder) | fooReverseSolidusRbar(value: Boolean) | +| [RequiredWithEscapedCharactersMap001011Builder](#requiredwithescapedcharactersmap001011builder) | fooReverseSolidusRbar(value: String) | +| [RequiredWithEscapedCharactersMap001011Builder](#requiredwithescapedcharactersmap001011builder) | fooReverseSolidusRbar(value: Int) | +| [RequiredWithEscapedCharactersMap001011Builder](#requiredwithescapedcharactersmap001011builder) | fooReverseSolidusRbar(value: Float) | +| [RequiredWithEscapedCharactersMap001011Builder](#requiredwithescapedcharactersmap001011builder) | fooReverseSolidusRbar(value: Long) | +| [RequiredWithEscapedCharactersMap001011Builder](#requiredwithescapedcharactersmap001011builder) | fooReverseSolidusRbar(value: Double) | +| [RequiredWithEscapedCharactersMap001011Builder](#requiredwithescapedcharactersmap001011builder) | fooReverseSolidusRbar(value: List) | +| [RequiredWithEscapedCharactersMap001011Builder](#requiredwithescapedcharactersmap001011builder) | fooReverseSolidusRbar(value: Map) | +| [RequiredWithEscapedCharactersMap001101Builder](#requiredwithescapedcharactersmap001101builder) | fooReverseSolidusQuotationMarkBar(value: Nothing?) | +| [RequiredWithEscapedCharactersMap001101Builder](#requiredwithescapedcharactersmap001101builder) | fooReverseSolidusQuotationMarkBar(value: Boolean) | +| [RequiredWithEscapedCharactersMap001101Builder](#requiredwithescapedcharactersmap001101builder) | fooReverseSolidusQuotationMarkBar(value: String) | +| [RequiredWithEscapedCharactersMap001101Builder](#requiredwithescapedcharactersmap001101builder) | fooReverseSolidusQuotationMarkBar(value: Int) | +| [RequiredWithEscapedCharactersMap001101Builder](#requiredwithescapedcharactersmap001101builder) | fooReverseSolidusQuotationMarkBar(value: Float) | +| [RequiredWithEscapedCharactersMap001101Builder](#requiredwithescapedcharactersmap001101builder) | fooReverseSolidusQuotationMarkBar(value: Long) | +| [RequiredWithEscapedCharactersMap001101Builder](#requiredwithescapedcharactersmap001101builder) | fooReverseSolidusQuotationMarkBar(value: Double) | +| [RequiredWithEscapedCharactersMap001101Builder](#requiredwithescapedcharactersmap001101builder) | fooReverseSolidusQuotationMarkBar(value: List) | +| [RequiredWithEscapedCharactersMap001101Builder](#requiredwithescapedcharactersmap001101builder) | fooReverseSolidusQuotationMarkBar(value: Map) | +| [RequiredWithEscapedCharactersMap001110Builder](#requiredwithescapedcharactersmap001110builder) | fooReverseSolidusReverseSolidusBar(value: Nothing?) | +| [RequiredWithEscapedCharactersMap001110Builder](#requiredwithescapedcharactersmap001110builder) | fooReverseSolidusReverseSolidusBar(value: Boolean) | +| [RequiredWithEscapedCharactersMap001110Builder](#requiredwithescapedcharactersmap001110builder) | fooReverseSolidusReverseSolidusBar(value: String) | +| [RequiredWithEscapedCharactersMap001110Builder](#requiredwithescapedcharactersmap001110builder) | fooReverseSolidusReverseSolidusBar(value: Int) | +| [RequiredWithEscapedCharactersMap001110Builder](#requiredwithescapedcharactersmap001110builder) | fooReverseSolidusReverseSolidusBar(value: Float) | +| [RequiredWithEscapedCharactersMap001110Builder](#requiredwithescapedcharactersmap001110builder) | fooReverseSolidusReverseSolidusBar(value: Long) | +| [RequiredWithEscapedCharactersMap001110Builder](#requiredwithescapedcharactersmap001110builder) | fooReverseSolidusReverseSolidusBar(value: Double) | +| [RequiredWithEscapedCharactersMap001110Builder](#requiredwithescapedcharactersmap001110builder) | fooReverseSolidusReverseSolidusBar(value: List) | +| [RequiredWithEscapedCharactersMap001110Builder](#requiredwithescapedcharactersmap001110builder) | fooReverseSolidusReverseSolidusBar(value: Map) | + +## RequiredWithEscapedCharactersMap010000Builder +class RequiredWithEscapedCharactersMap010000Builder
+builder for `Map` + +A class that builds the Map input type + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| RequiredWithEscapedCharactersMap010000Builder(Map instance)
Creates a builder that contains the passed instance | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| [RequiredWithEscapedCharactersMap000000Builder](#requiredwithescapedcharactersmap000000builder) | fooReverseSolidusNbar(value: Nothing?) | +| [RequiredWithEscapedCharactersMap000000Builder](#requiredwithescapedcharactersmap000000builder) | fooReverseSolidusNbar(value: Boolean) | +| [RequiredWithEscapedCharactersMap000000Builder](#requiredwithescapedcharactersmap000000builder) | fooReverseSolidusNbar(value: String) | +| [RequiredWithEscapedCharactersMap000000Builder](#requiredwithescapedcharactersmap000000builder) | fooReverseSolidusNbar(value: Int) | +| [RequiredWithEscapedCharactersMap000000Builder](#requiredwithescapedcharactersmap000000builder) | fooReverseSolidusNbar(value: Float) | +| [RequiredWithEscapedCharactersMap000000Builder](#requiredwithescapedcharactersmap000000builder) | fooReverseSolidusNbar(value: Long) | +| [RequiredWithEscapedCharactersMap000000Builder](#requiredwithescapedcharactersmap000000builder) | fooReverseSolidusNbar(value: Double) | +| [RequiredWithEscapedCharactersMap000000Builder](#requiredwithescapedcharactersmap000000builder) | fooReverseSolidusNbar(value: List) | +| [RequiredWithEscapedCharactersMap000000Builder](#requiredwithescapedcharactersmap000000builder) | fooReverseSolidusNbar(value: Map) | + +## RequiredWithEscapedCharactersMap010001Builder +class RequiredWithEscapedCharactersMap010001Builder
+builder for `Map` + +A class that builds the Map input type + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| RequiredWithEscapedCharactersMap010001Builder(Map instance)
Creates a builder that contains the passed instance | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| [RequiredWithEscapedCharactersMap000001Builder](#requiredwithescapedcharactersmap000001builder) | fooReverseSolidusNbar(value: Nothing?) | +| [RequiredWithEscapedCharactersMap000001Builder](#requiredwithescapedcharactersmap000001builder) | fooReverseSolidusNbar(value: Boolean) | +| [RequiredWithEscapedCharactersMap000001Builder](#requiredwithescapedcharactersmap000001builder) | fooReverseSolidusNbar(value: String) | +| [RequiredWithEscapedCharactersMap000001Builder](#requiredwithescapedcharactersmap000001builder) | fooReverseSolidusNbar(value: Int) | +| [RequiredWithEscapedCharactersMap000001Builder](#requiredwithescapedcharactersmap000001builder) | fooReverseSolidusNbar(value: Float) | +| [RequiredWithEscapedCharactersMap000001Builder](#requiredwithescapedcharactersmap000001builder) | fooReverseSolidusNbar(value: Long) | +| [RequiredWithEscapedCharactersMap000001Builder](#requiredwithescapedcharactersmap000001builder) | fooReverseSolidusNbar(value: Double) | +| [RequiredWithEscapedCharactersMap000001Builder](#requiredwithescapedcharactersmap000001builder) | fooReverseSolidusNbar(value: List) | +| [RequiredWithEscapedCharactersMap000001Builder](#requiredwithescapedcharactersmap000001builder) | fooReverseSolidusNbar(value: Map) | +| [RequiredWithEscapedCharactersMap010000Builder](#requiredwithescapedcharactersmap010000builder) | fooReverseSolidusReverseSolidusBar(value: Nothing?) | +| [RequiredWithEscapedCharactersMap010000Builder](#requiredwithescapedcharactersmap010000builder) | fooReverseSolidusReverseSolidusBar(value: Boolean) | +| [RequiredWithEscapedCharactersMap010000Builder](#requiredwithescapedcharactersmap010000builder) | fooReverseSolidusReverseSolidusBar(value: String) | +| [RequiredWithEscapedCharactersMap010000Builder](#requiredwithescapedcharactersmap010000builder) | fooReverseSolidusReverseSolidusBar(value: Int) | +| [RequiredWithEscapedCharactersMap010000Builder](#requiredwithescapedcharactersmap010000builder) | fooReverseSolidusReverseSolidusBar(value: Float) | +| [RequiredWithEscapedCharactersMap010000Builder](#requiredwithescapedcharactersmap010000builder) | fooReverseSolidusReverseSolidusBar(value: Long) | +| [RequiredWithEscapedCharactersMap010000Builder](#requiredwithescapedcharactersmap010000builder) | fooReverseSolidusReverseSolidusBar(value: Double) | +| [RequiredWithEscapedCharactersMap010000Builder](#requiredwithescapedcharactersmap010000builder) | fooReverseSolidusReverseSolidusBar(value: List) | +| [RequiredWithEscapedCharactersMap010000Builder](#requiredwithescapedcharactersmap010000builder) | fooReverseSolidusReverseSolidusBar(value: Map) | + +## RequiredWithEscapedCharactersMap010010Builder +class RequiredWithEscapedCharactersMap010010Builder
+builder for `Map` + +A class that builds the Map input type + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| RequiredWithEscapedCharactersMap010010Builder(Map instance)
Creates a builder that contains the passed instance | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| [RequiredWithEscapedCharactersMap000010Builder](#requiredwithescapedcharactersmap000010builder) | fooReverseSolidusNbar(value: Nothing?) | +| [RequiredWithEscapedCharactersMap000010Builder](#requiredwithescapedcharactersmap000010builder) | fooReverseSolidusNbar(value: Boolean) | +| [RequiredWithEscapedCharactersMap000010Builder](#requiredwithescapedcharactersmap000010builder) | fooReverseSolidusNbar(value: String) | +| [RequiredWithEscapedCharactersMap000010Builder](#requiredwithescapedcharactersmap000010builder) | fooReverseSolidusNbar(value: Int) | +| [RequiredWithEscapedCharactersMap000010Builder](#requiredwithescapedcharactersmap000010builder) | fooReverseSolidusNbar(value: Float) | +| [RequiredWithEscapedCharactersMap000010Builder](#requiredwithescapedcharactersmap000010builder) | fooReverseSolidusNbar(value: Long) | +| [RequiredWithEscapedCharactersMap000010Builder](#requiredwithescapedcharactersmap000010builder) | fooReverseSolidusNbar(value: Double) | +| [RequiredWithEscapedCharactersMap000010Builder](#requiredwithescapedcharactersmap000010builder) | fooReverseSolidusNbar(value: List) | +| [RequiredWithEscapedCharactersMap000010Builder](#requiredwithescapedcharactersmap000010builder) | fooReverseSolidusNbar(value: Map) | +| [RequiredWithEscapedCharactersMap010000Builder](#requiredwithescapedcharactersmap010000builder) | fooReverseSolidusQuotationMarkBar(value: Nothing?) | +| [RequiredWithEscapedCharactersMap010000Builder](#requiredwithescapedcharactersmap010000builder) | fooReverseSolidusQuotationMarkBar(value: Boolean) | +| [RequiredWithEscapedCharactersMap010000Builder](#requiredwithescapedcharactersmap010000builder) | fooReverseSolidusQuotationMarkBar(value: String) | +| [RequiredWithEscapedCharactersMap010000Builder](#requiredwithescapedcharactersmap010000builder) | fooReverseSolidusQuotationMarkBar(value: Int) | +| [RequiredWithEscapedCharactersMap010000Builder](#requiredwithescapedcharactersmap010000builder) | fooReverseSolidusQuotationMarkBar(value: Float) | +| [RequiredWithEscapedCharactersMap010000Builder](#requiredwithescapedcharactersmap010000builder) | fooReverseSolidusQuotationMarkBar(value: Long) | +| [RequiredWithEscapedCharactersMap010000Builder](#requiredwithescapedcharactersmap010000builder) | fooReverseSolidusQuotationMarkBar(value: Double) | +| [RequiredWithEscapedCharactersMap010000Builder](#requiredwithescapedcharactersmap010000builder) | fooReverseSolidusQuotationMarkBar(value: List) | +| [RequiredWithEscapedCharactersMap010000Builder](#requiredwithescapedcharactersmap010000builder) | fooReverseSolidusQuotationMarkBar(value: Map) | + +## RequiredWithEscapedCharactersMap010011Builder +class RequiredWithEscapedCharactersMap010011Builder
+builder for `Map` + +A class that builds the Map input type + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| RequiredWithEscapedCharactersMap010011Builder(Map instance)
Creates a builder that contains the passed instance | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| [RequiredWithEscapedCharactersMap000011Builder](#requiredwithescapedcharactersmap000011builder) | fooReverseSolidusNbar(value: Nothing?) | +| [RequiredWithEscapedCharactersMap000011Builder](#requiredwithescapedcharactersmap000011builder) | fooReverseSolidusNbar(value: Boolean) | +| [RequiredWithEscapedCharactersMap000011Builder](#requiredwithescapedcharactersmap000011builder) | fooReverseSolidusNbar(value: String) | +| [RequiredWithEscapedCharactersMap000011Builder](#requiredwithescapedcharactersmap000011builder) | fooReverseSolidusNbar(value: Int) | +| [RequiredWithEscapedCharactersMap000011Builder](#requiredwithescapedcharactersmap000011builder) | fooReverseSolidusNbar(value: Float) | +| [RequiredWithEscapedCharactersMap000011Builder](#requiredwithescapedcharactersmap000011builder) | fooReverseSolidusNbar(value: Long) | +| [RequiredWithEscapedCharactersMap000011Builder](#requiredwithescapedcharactersmap000011builder) | fooReverseSolidusNbar(value: Double) | +| [RequiredWithEscapedCharactersMap000011Builder](#requiredwithescapedcharactersmap000011builder) | fooReverseSolidusNbar(value: List) | +| [RequiredWithEscapedCharactersMap000011Builder](#requiredwithescapedcharactersmap000011builder) | fooReverseSolidusNbar(value: Map) | +| [RequiredWithEscapedCharactersMap010001Builder](#requiredwithescapedcharactersmap010001builder) | fooReverseSolidusQuotationMarkBar(value: Nothing?) | +| [RequiredWithEscapedCharactersMap010001Builder](#requiredwithescapedcharactersmap010001builder) | fooReverseSolidusQuotationMarkBar(value: Boolean) | +| [RequiredWithEscapedCharactersMap010001Builder](#requiredwithescapedcharactersmap010001builder) | fooReverseSolidusQuotationMarkBar(value: String) | +| [RequiredWithEscapedCharactersMap010001Builder](#requiredwithescapedcharactersmap010001builder) | fooReverseSolidusQuotationMarkBar(value: Int) | +| [RequiredWithEscapedCharactersMap010001Builder](#requiredwithescapedcharactersmap010001builder) | fooReverseSolidusQuotationMarkBar(value: Float) | +| [RequiredWithEscapedCharactersMap010001Builder](#requiredwithescapedcharactersmap010001builder) | fooReverseSolidusQuotationMarkBar(value: Long) | +| [RequiredWithEscapedCharactersMap010001Builder](#requiredwithescapedcharactersmap010001builder) | fooReverseSolidusQuotationMarkBar(value: Double) | +| [RequiredWithEscapedCharactersMap010001Builder](#requiredwithescapedcharactersmap010001builder) | fooReverseSolidusQuotationMarkBar(value: List) | +| [RequiredWithEscapedCharactersMap010001Builder](#requiredwithescapedcharactersmap010001builder) | fooReverseSolidusQuotationMarkBar(value: Map) | +| [RequiredWithEscapedCharactersMap010010Builder](#requiredwithescapedcharactersmap010010builder) | fooReverseSolidusReverseSolidusBar(value: Nothing?) | +| [RequiredWithEscapedCharactersMap010010Builder](#requiredwithescapedcharactersmap010010builder) | fooReverseSolidusReverseSolidusBar(value: Boolean) | +| [RequiredWithEscapedCharactersMap010010Builder](#requiredwithescapedcharactersmap010010builder) | fooReverseSolidusReverseSolidusBar(value: String) | +| [RequiredWithEscapedCharactersMap010010Builder](#requiredwithescapedcharactersmap010010builder) | fooReverseSolidusReverseSolidusBar(value: Int) | +| [RequiredWithEscapedCharactersMap010010Builder](#requiredwithescapedcharactersmap010010builder) | fooReverseSolidusReverseSolidusBar(value: Float) | +| [RequiredWithEscapedCharactersMap010010Builder](#requiredwithescapedcharactersmap010010builder) | fooReverseSolidusReverseSolidusBar(value: Long) | +| [RequiredWithEscapedCharactersMap010010Builder](#requiredwithescapedcharactersmap010010builder) | fooReverseSolidusReverseSolidusBar(value: Double) | +| [RequiredWithEscapedCharactersMap010010Builder](#requiredwithescapedcharactersmap010010builder) | fooReverseSolidusReverseSolidusBar(value: List) | +| [RequiredWithEscapedCharactersMap010010Builder](#requiredwithescapedcharactersmap010010builder) | fooReverseSolidusReverseSolidusBar(value: Map) | + +## RequiredWithEscapedCharactersMap010100Builder +class RequiredWithEscapedCharactersMap010100Builder
+builder for `Map` + +A class that builds the Map input type + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| RequiredWithEscapedCharactersMap010100Builder(Map instance)
Creates a builder that contains the passed instance | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| [RequiredWithEscapedCharactersMap000100Builder](#requiredwithescapedcharactersmap000100builder) | fooReverseSolidusNbar(value: Nothing?) | +| [RequiredWithEscapedCharactersMap000100Builder](#requiredwithescapedcharactersmap000100builder) | fooReverseSolidusNbar(value: Boolean) | +| [RequiredWithEscapedCharactersMap000100Builder](#requiredwithescapedcharactersmap000100builder) | fooReverseSolidusNbar(value: String) | +| [RequiredWithEscapedCharactersMap000100Builder](#requiredwithescapedcharactersmap000100builder) | fooReverseSolidusNbar(value: Int) | +| [RequiredWithEscapedCharactersMap000100Builder](#requiredwithescapedcharactersmap000100builder) | fooReverseSolidusNbar(value: Float) | +| [RequiredWithEscapedCharactersMap000100Builder](#requiredwithescapedcharactersmap000100builder) | fooReverseSolidusNbar(value: Long) | +| [RequiredWithEscapedCharactersMap000100Builder](#requiredwithescapedcharactersmap000100builder) | fooReverseSolidusNbar(value: Double) | +| [RequiredWithEscapedCharactersMap000100Builder](#requiredwithescapedcharactersmap000100builder) | fooReverseSolidusNbar(value: List) | +| [RequiredWithEscapedCharactersMap000100Builder](#requiredwithescapedcharactersmap000100builder) | fooReverseSolidusNbar(value: Map) | +| [RequiredWithEscapedCharactersMap010000Builder](#requiredwithescapedcharactersmap010000builder) | fooReverseSolidusRbar(value: Nothing?) | +| [RequiredWithEscapedCharactersMap010000Builder](#requiredwithescapedcharactersmap010000builder) | fooReverseSolidusRbar(value: Boolean) | +| [RequiredWithEscapedCharactersMap010000Builder](#requiredwithescapedcharactersmap010000builder) | fooReverseSolidusRbar(value: String) | +| [RequiredWithEscapedCharactersMap010000Builder](#requiredwithescapedcharactersmap010000builder) | fooReverseSolidusRbar(value: Int) | +| [RequiredWithEscapedCharactersMap010000Builder](#requiredwithescapedcharactersmap010000builder) | fooReverseSolidusRbar(value: Float) | +| [RequiredWithEscapedCharactersMap010000Builder](#requiredwithescapedcharactersmap010000builder) | fooReverseSolidusRbar(value: Long) | +| [RequiredWithEscapedCharactersMap010000Builder](#requiredwithescapedcharactersmap010000builder) | fooReverseSolidusRbar(value: Double) | +| [RequiredWithEscapedCharactersMap010000Builder](#requiredwithescapedcharactersmap010000builder) | fooReverseSolidusRbar(value: List) | +| [RequiredWithEscapedCharactersMap010000Builder](#requiredwithescapedcharactersmap010000builder) | fooReverseSolidusRbar(value: Map) | + +## RequiredWithEscapedCharactersMap010101Builder +class RequiredWithEscapedCharactersMap010101Builder
+builder for `Map` + +A class that builds the Map input type + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| RequiredWithEscapedCharactersMap010101Builder(Map instance)
Creates a builder that contains the passed instance | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| [RequiredWithEscapedCharactersMap000101Builder](#requiredwithescapedcharactersmap000101builder) | fooReverseSolidusNbar(value: Nothing?) | +| [RequiredWithEscapedCharactersMap000101Builder](#requiredwithescapedcharactersmap000101builder) | fooReverseSolidusNbar(value: Boolean) | +| [RequiredWithEscapedCharactersMap000101Builder](#requiredwithescapedcharactersmap000101builder) | fooReverseSolidusNbar(value: String) | +| [RequiredWithEscapedCharactersMap000101Builder](#requiredwithescapedcharactersmap000101builder) | fooReverseSolidusNbar(value: Int) | +| [RequiredWithEscapedCharactersMap000101Builder](#requiredwithescapedcharactersmap000101builder) | fooReverseSolidusNbar(value: Float) | +| [RequiredWithEscapedCharactersMap000101Builder](#requiredwithescapedcharactersmap000101builder) | fooReverseSolidusNbar(value: Long) | +| [RequiredWithEscapedCharactersMap000101Builder](#requiredwithescapedcharactersmap000101builder) | fooReverseSolidusNbar(value: Double) | +| [RequiredWithEscapedCharactersMap000101Builder](#requiredwithescapedcharactersmap000101builder) | fooReverseSolidusNbar(value: List) | +| [RequiredWithEscapedCharactersMap000101Builder](#requiredwithescapedcharactersmap000101builder) | fooReverseSolidusNbar(value: Map) | +| [RequiredWithEscapedCharactersMap010001Builder](#requiredwithescapedcharactersmap010001builder) | fooReverseSolidusRbar(value: Nothing?) | +| [RequiredWithEscapedCharactersMap010001Builder](#requiredwithescapedcharactersmap010001builder) | fooReverseSolidusRbar(value: Boolean) | +| [RequiredWithEscapedCharactersMap010001Builder](#requiredwithescapedcharactersmap010001builder) | fooReverseSolidusRbar(value: String) | +| [RequiredWithEscapedCharactersMap010001Builder](#requiredwithescapedcharactersmap010001builder) | fooReverseSolidusRbar(value: Int) | +| [RequiredWithEscapedCharactersMap010001Builder](#requiredwithescapedcharactersmap010001builder) | fooReverseSolidusRbar(value: Float) | +| [RequiredWithEscapedCharactersMap010001Builder](#requiredwithescapedcharactersmap010001builder) | fooReverseSolidusRbar(value: Long) | +| [RequiredWithEscapedCharactersMap010001Builder](#requiredwithescapedcharactersmap010001builder) | fooReverseSolidusRbar(value: Double) | +| [RequiredWithEscapedCharactersMap010001Builder](#requiredwithescapedcharactersmap010001builder) | fooReverseSolidusRbar(value: List) | +| [RequiredWithEscapedCharactersMap010001Builder](#requiredwithescapedcharactersmap010001builder) | fooReverseSolidusRbar(value: Map) | +| [RequiredWithEscapedCharactersMap010100Builder](#requiredwithescapedcharactersmap010100builder) | fooReverseSolidusReverseSolidusBar(value: Nothing?) | +| [RequiredWithEscapedCharactersMap010100Builder](#requiredwithescapedcharactersmap010100builder) | fooReverseSolidusReverseSolidusBar(value: Boolean) | +| [RequiredWithEscapedCharactersMap010100Builder](#requiredwithescapedcharactersmap010100builder) | fooReverseSolidusReverseSolidusBar(value: String) | +| [RequiredWithEscapedCharactersMap010100Builder](#requiredwithescapedcharactersmap010100builder) | fooReverseSolidusReverseSolidusBar(value: Int) | +| [RequiredWithEscapedCharactersMap010100Builder](#requiredwithescapedcharactersmap010100builder) | fooReverseSolidusReverseSolidusBar(value: Float) | +| [RequiredWithEscapedCharactersMap010100Builder](#requiredwithescapedcharactersmap010100builder) | fooReverseSolidusReverseSolidusBar(value: Long) | +| [RequiredWithEscapedCharactersMap010100Builder](#requiredwithescapedcharactersmap010100builder) | fooReverseSolidusReverseSolidusBar(value: Double) | +| [RequiredWithEscapedCharactersMap010100Builder](#requiredwithescapedcharactersmap010100builder) | fooReverseSolidusReverseSolidusBar(value: List) | +| [RequiredWithEscapedCharactersMap010100Builder](#requiredwithescapedcharactersmap010100builder) | fooReverseSolidusReverseSolidusBar(value: Map) | + +## RequiredWithEscapedCharactersMap010110Builder +class RequiredWithEscapedCharactersMap010110Builder
+builder for `Map` + +A class that builds the Map input type + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| RequiredWithEscapedCharactersMap010110Builder(Map instance)
Creates a builder that contains the passed instance | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| [RequiredWithEscapedCharactersMap000110Builder](#requiredwithescapedcharactersmap000110builder) | fooReverseSolidusNbar(value: Nothing?) | +| [RequiredWithEscapedCharactersMap000110Builder](#requiredwithescapedcharactersmap000110builder) | fooReverseSolidusNbar(value: Boolean) | +| [RequiredWithEscapedCharactersMap000110Builder](#requiredwithescapedcharactersmap000110builder) | fooReverseSolidusNbar(value: String) | +| [RequiredWithEscapedCharactersMap000110Builder](#requiredwithescapedcharactersmap000110builder) | fooReverseSolidusNbar(value: Int) | +| [RequiredWithEscapedCharactersMap000110Builder](#requiredwithescapedcharactersmap000110builder) | fooReverseSolidusNbar(value: Float) | +| [RequiredWithEscapedCharactersMap000110Builder](#requiredwithescapedcharactersmap000110builder) | fooReverseSolidusNbar(value: Long) | +| [RequiredWithEscapedCharactersMap000110Builder](#requiredwithescapedcharactersmap000110builder) | fooReverseSolidusNbar(value: Double) | +| [RequiredWithEscapedCharactersMap000110Builder](#requiredwithescapedcharactersmap000110builder) | fooReverseSolidusNbar(value: List) | +| [RequiredWithEscapedCharactersMap000110Builder](#requiredwithescapedcharactersmap000110builder) | fooReverseSolidusNbar(value: Map) | +| [RequiredWithEscapedCharactersMap010010Builder](#requiredwithescapedcharactersmap010010builder) | fooReverseSolidusRbar(value: Nothing?) | +| [RequiredWithEscapedCharactersMap010010Builder](#requiredwithescapedcharactersmap010010builder) | fooReverseSolidusRbar(value: Boolean) | +| [RequiredWithEscapedCharactersMap010010Builder](#requiredwithescapedcharactersmap010010builder) | fooReverseSolidusRbar(value: String) | +| [RequiredWithEscapedCharactersMap010010Builder](#requiredwithescapedcharactersmap010010builder) | fooReverseSolidusRbar(value: Int) | +| [RequiredWithEscapedCharactersMap010010Builder](#requiredwithescapedcharactersmap010010builder) | fooReverseSolidusRbar(value: Float) | +| [RequiredWithEscapedCharactersMap010010Builder](#requiredwithescapedcharactersmap010010builder) | fooReverseSolidusRbar(value: Long) | +| [RequiredWithEscapedCharactersMap010010Builder](#requiredwithescapedcharactersmap010010builder) | fooReverseSolidusRbar(value: Double) | +| [RequiredWithEscapedCharactersMap010010Builder](#requiredwithescapedcharactersmap010010builder) | fooReverseSolidusRbar(value: List) | +| [RequiredWithEscapedCharactersMap010010Builder](#requiredwithescapedcharactersmap010010builder) | fooReverseSolidusRbar(value: Map) | +| [RequiredWithEscapedCharactersMap010100Builder](#requiredwithescapedcharactersmap010100builder) | fooReverseSolidusQuotationMarkBar(value: Nothing?) | +| [RequiredWithEscapedCharactersMap010100Builder](#requiredwithescapedcharactersmap010100builder) | fooReverseSolidusQuotationMarkBar(value: Boolean) | +| [RequiredWithEscapedCharactersMap010100Builder](#requiredwithescapedcharactersmap010100builder) | fooReverseSolidusQuotationMarkBar(value: String) | +| [RequiredWithEscapedCharactersMap010100Builder](#requiredwithescapedcharactersmap010100builder) | fooReverseSolidusQuotationMarkBar(value: Int) | +| [RequiredWithEscapedCharactersMap010100Builder](#requiredwithescapedcharactersmap010100builder) | fooReverseSolidusQuotationMarkBar(value: Float) | +| [RequiredWithEscapedCharactersMap010100Builder](#requiredwithescapedcharactersmap010100builder) | fooReverseSolidusQuotationMarkBar(value: Long) | +| [RequiredWithEscapedCharactersMap010100Builder](#requiredwithescapedcharactersmap010100builder) | fooReverseSolidusQuotationMarkBar(value: Double) | +| [RequiredWithEscapedCharactersMap010100Builder](#requiredwithescapedcharactersmap010100builder) | fooReverseSolidusQuotationMarkBar(value: List) | +| [RequiredWithEscapedCharactersMap010100Builder](#requiredwithescapedcharactersmap010100builder) | fooReverseSolidusQuotationMarkBar(value: Map) | + +## RequiredWithEscapedCharactersMap010111Builder +class RequiredWithEscapedCharactersMap010111Builder
+builder for `Map` + +A class that builds the Map input type + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| RequiredWithEscapedCharactersMap010111Builder(Map instance)
Creates a builder that contains the passed instance | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| [RequiredWithEscapedCharactersMap000111Builder](#requiredwithescapedcharactersmap000111builder) | fooReverseSolidusNbar(value: Nothing?) | +| [RequiredWithEscapedCharactersMap000111Builder](#requiredwithescapedcharactersmap000111builder) | fooReverseSolidusNbar(value: Boolean) | +| [RequiredWithEscapedCharactersMap000111Builder](#requiredwithescapedcharactersmap000111builder) | fooReverseSolidusNbar(value: String) | +| [RequiredWithEscapedCharactersMap000111Builder](#requiredwithescapedcharactersmap000111builder) | fooReverseSolidusNbar(value: Int) | +| [RequiredWithEscapedCharactersMap000111Builder](#requiredwithescapedcharactersmap000111builder) | fooReverseSolidusNbar(value: Float) | +| [RequiredWithEscapedCharactersMap000111Builder](#requiredwithescapedcharactersmap000111builder) | fooReverseSolidusNbar(value: Long) | +| [RequiredWithEscapedCharactersMap000111Builder](#requiredwithescapedcharactersmap000111builder) | fooReverseSolidusNbar(value: Double) | +| [RequiredWithEscapedCharactersMap000111Builder](#requiredwithescapedcharactersmap000111builder) | fooReverseSolidusNbar(value: List) | +| [RequiredWithEscapedCharactersMap000111Builder](#requiredwithescapedcharactersmap000111builder) | fooReverseSolidusNbar(value: Map) | +| [RequiredWithEscapedCharactersMap010011Builder](#requiredwithescapedcharactersmap010011builder) | fooReverseSolidusRbar(value: Nothing?) | +| [RequiredWithEscapedCharactersMap010011Builder](#requiredwithescapedcharactersmap010011builder) | fooReverseSolidusRbar(value: Boolean) | +| [RequiredWithEscapedCharactersMap010011Builder](#requiredwithescapedcharactersmap010011builder) | fooReverseSolidusRbar(value: String) | +| [RequiredWithEscapedCharactersMap010011Builder](#requiredwithescapedcharactersmap010011builder) | fooReverseSolidusRbar(value: Int) | +| [RequiredWithEscapedCharactersMap010011Builder](#requiredwithescapedcharactersmap010011builder) | fooReverseSolidusRbar(value: Float) | +| [RequiredWithEscapedCharactersMap010011Builder](#requiredwithescapedcharactersmap010011builder) | fooReverseSolidusRbar(value: Long) | +| [RequiredWithEscapedCharactersMap010011Builder](#requiredwithescapedcharactersmap010011builder) | fooReverseSolidusRbar(value: Double) | +| [RequiredWithEscapedCharactersMap010011Builder](#requiredwithescapedcharactersmap010011builder) | fooReverseSolidusRbar(value: List) | +| [RequiredWithEscapedCharactersMap010011Builder](#requiredwithescapedcharactersmap010011builder) | fooReverseSolidusRbar(value: Map) | +| [RequiredWithEscapedCharactersMap010101Builder](#requiredwithescapedcharactersmap010101builder) | fooReverseSolidusQuotationMarkBar(value: Nothing?) | +| [RequiredWithEscapedCharactersMap010101Builder](#requiredwithescapedcharactersmap010101builder) | fooReverseSolidusQuotationMarkBar(value: Boolean) | +| [RequiredWithEscapedCharactersMap010101Builder](#requiredwithescapedcharactersmap010101builder) | fooReverseSolidusQuotationMarkBar(value: String) | +| [RequiredWithEscapedCharactersMap010101Builder](#requiredwithescapedcharactersmap010101builder) | fooReverseSolidusQuotationMarkBar(value: Int) | +| [RequiredWithEscapedCharactersMap010101Builder](#requiredwithescapedcharactersmap010101builder) | fooReverseSolidusQuotationMarkBar(value: Float) | +| [RequiredWithEscapedCharactersMap010101Builder](#requiredwithescapedcharactersmap010101builder) | fooReverseSolidusQuotationMarkBar(value: Long) | +| [RequiredWithEscapedCharactersMap010101Builder](#requiredwithescapedcharactersmap010101builder) | fooReverseSolidusQuotationMarkBar(value: Double) | +| [RequiredWithEscapedCharactersMap010101Builder](#requiredwithescapedcharactersmap010101builder) | fooReverseSolidusQuotationMarkBar(value: List) | +| [RequiredWithEscapedCharactersMap010101Builder](#requiredwithescapedcharactersmap010101builder) | fooReverseSolidusQuotationMarkBar(value: Map) | +| [RequiredWithEscapedCharactersMap010110Builder](#requiredwithescapedcharactersmap010110builder) | fooReverseSolidusReverseSolidusBar(value: Nothing?) | +| [RequiredWithEscapedCharactersMap010110Builder](#requiredwithescapedcharactersmap010110builder) | fooReverseSolidusReverseSolidusBar(value: Boolean) | +| [RequiredWithEscapedCharactersMap010110Builder](#requiredwithescapedcharactersmap010110builder) | fooReverseSolidusReverseSolidusBar(value: String) | +| [RequiredWithEscapedCharactersMap010110Builder](#requiredwithescapedcharactersmap010110builder) | fooReverseSolidusReverseSolidusBar(value: Int) | +| [RequiredWithEscapedCharactersMap010110Builder](#requiredwithescapedcharactersmap010110builder) | fooReverseSolidusReverseSolidusBar(value: Float) | +| [RequiredWithEscapedCharactersMap010110Builder](#requiredwithescapedcharactersmap010110builder) | fooReverseSolidusReverseSolidusBar(value: Long) | +| [RequiredWithEscapedCharactersMap010110Builder](#requiredwithescapedcharactersmap010110builder) | fooReverseSolidusReverseSolidusBar(value: Double) | +| [RequiredWithEscapedCharactersMap010110Builder](#requiredwithescapedcharactersmap010110builder) | fooReverseSolidusReverseSolidusBar(value: List) | +| [RequiredWithEscapedCharactersMap010110Builder](#requiredwithescapedcharactersmap010110builder) | fooReverseSolidusReverseSolidusBar(value: Map) | + +## RequiredWithEscapedCharactersMap011000Builder +class RequiredWithEscapedCharactersMap011000Builder
+builder for `Map` + +A class that builds the Map input type + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| RequiredWithEscapedCharactersMap011000Builder(Map instance)
Creates a builder that contains the passed instance | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| [RequiredWithEscapedCharactersMap001000Builder](#requiredwithescapedcharactersmap001000builder) | fooReverseSolidusNbar(value: Nothing?) | +| [RequiredWithEscapedCharactersMap001000Builder](#requiredwithescapedcharactersmap001000builder) | fooReverseSolidusNbar(value: Boolean) | +| [RequiredWithEscapedCharactersMap001000Builder](#requiredwithescapedcharactersmap001000builder) | fooReverseSolidusNbar(value: String) | +| [RequiredWithEscapedCharactersMap001000Builder](#requiredwithescapedcharactersmap001000builder) | fooReverseSolidusNbar(value: Int) | +| [RequiredWithEscapedCharactersMap001000Builder](#requiredwithescapedcharactersmap001000builder) | fooReverseSolidusNbar(value: Float) | +| [RequiredWithEscapedCharactersMap001000Builder](#requiredwithescapedcharactersmap001000builder) | fooReverseSolidusNbar(value: Long) | +| [RequiredWithEscapedCharactersMap001000Builder](#requiredwithescapedcharactersmap001000builder) | fooReverseSolidusNbar(value: Double) | +| [RequiredWithEscapedCharactersMap001000Builder](#requiredwithescapedcharactersmap001000builder) | fooReverseSolidusNbar(value: List) | +| [RequiredWithEscapedCharactersMap001000Builder](#requiredwithescapedcharactersmap001000builder) | fooReverseSolidusNbar(value: Map) | +| [RequiredWithEscapedCharactersMap010000Builder](#requiredwithescapedcharactersmap010000builder) | fooReverseSolidusU000cbar(value: Nothing?) | +| [RequiredWithEscapedCharactersMap010000Builder](#requiredwithescapedcharactersmap010000builder) | fooReverseSolidusU000cbar(value: Boolean) | +| [RequiredWithEscapedCharactersMap010000Builder](#requiredwithescapedcharactersmap010000builder) | fooReverseSolidusU000cbar(value: String) | +| [RequiredWithEscapedCharactersMap010000Builder](#requiredwithescapedcharactersmap010000builder) | fooReverseSolidusU000cbar(value: Int) | +| [RequiredWithEscapedCharactersMap010000Builder](#requiredwithescapedcharactersmap010000builder) | fooReverseSolidusU000cbar(value: Float) | +| [RequiredWithEscapedCharactersMap010000Builder](#requiredwithescapedcharactersmap010000builder) | fooReverseSolidusU000cbar(value: Long) | +| [RequiredWithEscapedCharactersMap010000Builder](#requiredwithescapedcharactersmap010000builder) | fooReverseSolidusU000cbar(value: Double) | +| [RequiredWithEscapedCharactersMap010000Builder](#requiredwithescapedcharactersmap010000builder) | fooReverseSolidusU000cbar(value: List) | +| [RequiredWithEscapedCharactersMap010000Builder](#requiredwithescapedcharactersmap010000builder) | fooReverseSolidusU000cbar(value: Map) | + +## RequiredWithEscapedCharactersMap011001Builder +class RequiredWithEscapedCharactersMap011001Builder
+builder for `Map` + +A class that builds the Map input type + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| RequiredWithEscapedCharactersMap011001Builder(Map instance)
Creates a builder that contains the passed instance | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| [RequiredWithEscapedCharactersMap001001Builder](#requiredwithescapedcharactersmap001001builder) | fooReverseSolidusNbar(value: Nothing?) | +| [RequiredWithEscapedCharactersMap001001Builder](#requiredwithescapedcharactersmap001001builder) | fooReverseSolidusNbar(value: Boolean) | +| [RequiredWithEscapedCharactersMap001001Builder](#requiredwithescapedcharactersmap001001builder) | fooReverseSolidusNbar(value: String) | +| [RequiredWithEscapedCharactersMap001001Builder](#requiredwithescapedcharactersmap001001builder) | fooReverseSolidusNbar(value: Int) | +| [RequiredWithEscapedCharactersMap001001Builder](#requiredwithescapedcharactersmap001001builder) | fooReverseSolidusNbar(value: Float) | +| [RequiredWithEscapedCharactersMap001001Builder](#requiredwithescapedcharactersmap001001builder) | fooReverseSolidusNbar(value: Long) | +| [RequiredWithEscapedCharactersMap001001Builder](#requiredwithescapedcharactersmap001001builder) | fooReverseSolidusNbar(value: Double) | +| [RequiredWithEscapedCharactersMap001001Builder](#requiredwithescapedcharactersmap001001builder) | fooReverseSolidusNbar(value: List) | +| [RequiredWithEscapedCharactersMap001001Builder](#requiredwithescapedcharactersmap001001builder) | fooReverseSolidusNbar(value: Map) | +| [RequiredWithEscapedCharactersMap010001Builder](#requiredwithescapedcharactersmap010001builder) | fooReverseSolidusU000cbar(value: Nothing?) | +| [RequiredWithEscapedCharactersMap010001Builder](#requiredwithescapedcharactersmap010001builder) | fooReverseSolidusU000cbar(value: Boolean) | +| [RequiredWithEscapedCharactersMap010001Builder](#requiredwithescapedcharactersmap010001builder) | fooReverseSolidusU000cbar(value: String) | +| [RequiredWithEscapedCharactersMap010001Builder](#requiredwithescapedcharactersmap010001builder) | fooReverseSolidusU000cbar(value: Int) | +| [RequiredWithEscapedCharactersMap010001Builder](#requiredwithescapedcharactersmap010001builder) | fooReverseSolidusU000cbar(value: Float) | +| [RequiredWithEscapedCharactersMap010001Builder](#requiredwithescapedcharactersmap010001builder) | fooReverseSolidusU000cbar(value: Long) | +| [RequiredWithEscapedCharactersMap010001Builder](#requiredwithescapedcharactersmap010001builder) | fooReverseSolidusU000cbar(value: Double) | +| [RequiredWithEscapedCharactersMap010001Builder](#requiredwithescapedcharactersmap010001builder) | fooReverseSolidusU000cbar(value: List) | +| [RequiredWithEscapedCharactersMap010001Builder](#requiredwithescapedcharactersmap010001builder) | fooReverseSolidusU000cbar(value: Map) | +| [RequiredWithEscapedCharactersMap011000Builder](#requiredwithescapedcharactersmap011000builder) | fooReverseSolidusReverseSolidusBar(value: Nothing?) | +| [RequiredWithEscapedCharactersMap011000Builder](#requiredwithescapedcharactersmap011000builder) | fooReverseSolidusReverseSolidusBar(value: Boolean) | +| [RequiredWithEscapedCharactersMap011000Builder](#requiredwithescapedcharactersmap011000builder) | fooReverseSolidusReverseSolidusBar(value: String) | +| [RequiredWithEscapedCharactersMap011000Builder](#requiredwithescapedcharactersmap011000builder) | fooReverseSolidusReverseSolidusBar(value: Int) | +| [RequiredWithEscapedCharactersMap011000Builder](#requiredwithescapedcharactersmap011000builder) | fooReverseSolidusReverseSolidusBar(value: Float) | +| [RequiredWithEscapedCharactersMap011000Builder](#requiredwithescapedcharactersmap011000builder) | fooReverseSolidusReverseSolidusBar(value: Long) | +| [RequiredWithEscapedCharactersMap011000Builder](#requiredwithescapedcharactersmap011000builder) | fooReverseSolidusReverseSolidusBar(value: Double) | +| [RequiredWithEscapedCharactersMap011000Builder](#requiredwithescapedcharactersmap011000builder) | fooReverseSolidusReverseSolidusBar(value: List) | +| [RequiredWithEscapedCharactersMap011000Builder](#requiredwithescapedcharactersmap011000builder) | fooReverseSolidusReverseSolidusBar(value: Map) | + +## RequiredWithEscapedCharactersMap011010Builder +class RequiredWithEscapedCharactersMap011010Builder
+builder for `Map` + +A class that builds the Map input type + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| RequiredWithEscapedCharactersMap011010Builder(Map instance)
Creates a builder that contains the passed instance | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| [RequiredWithEscapedCharactersMap001010Builder](#requiredwithescapedcharactersmap001010builder) | fooReverseSolidusNbar(value: Nothing?) | +| [RequiredWithEscapedCharactersMap001010Builder](#requiredwithescapedcharactersmap001010builder) | fooReverseSolidusNbar(value: Boolean) | +| [RequiredWithEscapedCharactersMap001010Builder](#requiredwithescapedcharactersmap001010builder) | fooReverseSolidusNbar(value: String) | +| [RequiredWithEscapedCharactersMap001010Builder](#requiredwithescapedcharactersmap001010builder) | fooReverseSolidusNbar(value: Int) | +| [RequiredWithEscapedCharactersMap001010Builder](#requiredwithescapedcharactersmap001010builder) | fooReverseSolidusNbar(value: Float) | +| [RequiredWithEscapedCharactersMap001010Builder](#requiredwithescapedcharactersmap001010builder) | fooReverseSolidusNbar(value: Long) | +| [RequiredWithEscapedCharactersMap001010Builder](#requiredwithescapedcharactersmap001010builder) | fooReverseSolidusNbar(value: Double) | +| [RequiredWithEscapedCharactersMap001010Builder](#requiredwithescapedcharactersmap001010builder) | fooReverseSolidusNbar(value: List) | +| [RequiredWithEscapedCharactersMap001010Builder](#requiredwithescapedcharactersmap001010builder) | fooReverseSolidusNbar(value: Map) | +| [RequiredWithEscapedCharactersMap010010Builder](#requiredwithescapedcharactersmap010010builder) | fooReverseSolidusU000cbar(value: Nothing?) | +| [RequiredWithEscapedCharactersMap010010Builder](#requiredwithescapedcharactersmap010010builder) | fooReverseSolidusU000cbar(value: Boolean) | +| [RequiredWithEscapedCharactersMap010010Builder](#requiredwithescapedcharactersmap010010builder) | fooReverseSolidusU000cbar(value: String) | +| [RequiredWithEscapedCharactersMap010010Builder](#requiredwithescapedcharactersmap010010builder) | fooReverseSolidusU000cbar(value: Int) | +| [RequiredWithEscapedCharactersMap010010Builder](#requiredwithescapedcharactersmap010010builder) | fooReverseSolidusU000cbar(value: Float) | +| [RequiredWithEscapedCharactersMap010010Builder](#requiredwithescapedcharactersmap010010builder) | fooReverseSolidusU000cbar(value: Long) | +| [RequiredWithEscapedCharactersMap010010Builder](#requiredwithescapedcharactersmap010010builder) | fooReverseSolidusU000cbar(value: Double) | +| [RequiredWithEscapedCharactersMap010010Builder](#requiredwithescapedcharactersmap010010builder) | fooReverseSolidusU000cbar(value: List) | +| [RequiredWithEscapedCharactersMap010010Builder](#requiredwithescapedcharactersmap010010builder) | fooReverseSolidusU000cbar(value: Map) | +| [RequiredWithEscapedCharactersMap011000Builder](#requiredwithescapedcharactersmap011000builder) | fooReverseSolidusQuotationMarkBar(value: Nothing?) | +| [RequiredWithEscapedCharactersMap011000Builder](#requiredwithescapedcharactersmap011000builder) | fooReverseSolidusQuotationMarkBar(value: Boolean) | +| [RequiredWithEscapedCharactersMap011000Builder](#requiredwithescapedcharactersmap011000builder) | fooReverseSolidusQuotationMarkBar(value: String) | +| [RequiredWithEscapedCharactersMap011000Builder](#requiredwithescapedcharactersmap011000builder) | fooReverseSolidusQuotationMarkBar(value: Int) | +| [RequiredWithEscapedCharactersMap011000Builder](#requiredwithescapedcharactersmap011000builder) | fooReverseSolidusQuotationMarkBar(value: Float) | +| [RequiredWithEscapedCharactersMap011000Builder](#requiredwithescapedcharactersmap011000builder) | fooReverseSolidusQuotationMarkBar(value: Long) | +| [RequiredWithEscapedCharactersMap011000Builder](#requiredwithescapedcharactersmap011000builder) | fooReverseSolidusQuotationMarkBar(value: Double) | +| [RequiredWithEscapedCharactersMap011000Builder](#requiredwithescapedcharactersmap011000builder) | fooReverseSolidusQuotationMarkBar(value: List) | +| [RequiredWithEscapedCharactersMap011000Builder](#requiredwithescapedcharactersmap011000builder) | fooReverseSolidusQuotationMarkBar(value: Map) | + +## RequiredWithEscapedCharactersMap011011Builder +class RequiredWithEscapedCharactersMap011011Builder
+builder for `Map` + +A class that builds the Map input type + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| RequiredWithEscapedCharactersMap011011Builder(Map instance)
Creates a builder that contains the passed instance | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| [RequiredWithEscapedCharactersMap001011Builder](#requiredwithescapedcharactersmap001011builder) | fooReverseSolidusNbar(value: Nothing?) | +| [RequiredWithEscapedCharactersMap001011Builder](#requiredwithescapedcharactersmap001011builder) | fooReverseSolidusNbar(value: Boolean) | +| [RequiredWithEscapedCharactersMap001011Builder](#requiredwithescapedcharactersmap001011builder) | fooReverseSolidusNbar(value: String) | +| [RequiredWithEscapedCharactersMap001011Builder](#requiredwithescapedcharactersmap001011builder) | fooReverseSolidusNbar(value: Int) | +| [RequiredWithEscapedCharactersMap001011Builder](#requiredwithescapedcharactersmap001011builder) | fooReverseSolidusNbar(value: Float) | +| [RequiredWithEscapedCharactersMap001011Builder](#requiredwithescapedcharactersmap001011builder) | fooReverseSolidusNbar(value: Long) | +| [RequiredWithEscapedCharactersMap001011Builder](#requiredwithescapedcharactersmap001011builder) | fooReverseSolidusNbar(value: Double) | +| [RequiredWithEscapedCharactersMap001011Builder](#requiredwithescapedcharactersmap001011builder) | fooReverseSolidusNbar(value: List) | +| [RequiredWithEscapedCharactersMap001011Builder](#requiredwithescapedcharactersmap001011builder) | fooReverseSolidusNbar(value: Map) | +| [RequiredWithEscapedCharactersMap010011Builder](#requiredwithescapedcharactersmap010011builder) | fooReverseSolidusU000cbar(value: Nothing?) | +| [RequiredWithEscapedCharactersMap010011Builder](#requiredwithescapedcharactersmap010011builder) | fooReverseSolidusU000cbar(value: Boolean) | +| [RequiredWithEscapedCharactersMap010011Builder](#requiredwithescapedcharactersmap010011builder) | fooReverseSolidusU000cbar(value: String) | +| [RequiredWithEscapedCharactersMap010011Builder](#requiredwithescapedcharactersmap010011builder) | fooReverseSolidusU000cbar(value: Int) | +| [RequiredWithEscapedCharactersMap010011Builder](#requiredwithescapedcharactersmap010011builder) | fooReverseSolidusU000cbar(value: Float) | +| [RequiredWithEscapedCharactersMap010011Builder](#requiredwithescapedcharactersmap010011builder) | fooReverseSolidusU000cbar(value: Long) | +| [RequiredWithEscapedCharactersMap010011Builder](#requiredwithescapedcharactersmap010011builder) | fooReverseSolidusU000cbar(value: Double) | +| [RequiredWithEscapedCharactersMap010011Builder](#requiredwithescapedcharactersmap010011builder) | fooReverseSolidusU000cbar(value: List) | +| [RequiredWithEscapedCharactersMap010011Builder](#requiredwithescapedcharactersmap010011builder) | fooReverseSolidusU000cbar(value: Map) | +| [RequiredWithEscapedCharactersMap011001Builder](#requiredwithescapedcharactersmap011001builder) | fooReverseSolidusQuotationMarkBar(value: Nothing?) | +| [RequiredWithEscapedCharactersMap011001Builder](#requiredwithescapedcharactersmap011001builder) | fooReverseSolidusQuotationMarkBar(value: Boolean) | +| [RequiredWithEscapedCharactersMap011001Builder](#requiredwithescapedcharactersmap011001builder) | fooReverseSolidusQuotationMarkBar(value: String) | +| [RequiredWithEscapedCharactersMap011001Builder](#requiredwithescapedcharactersmap011001builder) | fooReverseSolidusQuotationMarkBar(value: Int) | +| [RequiredWithEscapedCharactersMap011001Builder](#requiredwithescapedcharactersmap011001builder) | fooReverseSolidusQuotationMarkBar(value: Float) | +| [RequiredWithEscapedCharactersMap011001Builder](#requiredwithescapedcharactersmap011001builder) | fooReverseSolidusQuotationMarkBar(value: Long) | +| [RequiredWithEscapedCharactersMap011001Builder](#requiredwithescapedcharactersmap011001builder) | fooReverseSolidusQuotationMarkBar(value: Double) | +| [RequiredWithEscapedCharactersMap011001Builder](#requiredwithescapedcharactersmap011001builder) | fooReverseSolidusQuotationMarkBar(value: List) | +| [RequiredWithEscapedCharactersMap011001Builder](#requiredwithescapedcharactersmap011001builder) | fooReverseSolidusQuotationMarkBar(value: Map) | +| [RequiredWithEscapedCharactersMap011010Builder](#requiredwithescapedcharactersmap011010builder) | fooReverseSolidusReverseSolidusBar(value: Nothing?) | +| [RequiredWithEscapedCharactersMap011010Builder](#requiredwithescapedcharactersmap011010builder) | fooReverseSolidusReverseSolidusBar(value: Boolean) | +| [RequiredWithEscapedCharactersMap011010Builder](#requiredwithescapedcharactersmap011010builder) | fooReverseSolidusReverseSolidusBar(value: String) | +| [RequiredWithEscapedCharactersMap011010Builder](#requiredwithescapedcharactersmap011010builder) | fooReverseSolidusReverseSolidusBar(value: Int) | +| [RequiredWithEscapedCharactersMap011010Builder](#requiredwithescapedcharactersmap011010builder) | fooReverseSolidusReverseSolidusBar(value: Float) | +| [RequiredWithEscapedCharactersMap011010Builder](#requiredwithescapedcharactersmap011010builder) | fooReverseSolidusReverseSolidusBar(value: Long) | +| [RequiredWithEscapedCharactersMap011010Builder](#requiredwithescapedcharactersmap011010builder) | fooReverseSolidusReverseSolidusBar(value: Double) | +| [RequiredWithEscapedCharactersMap011010Builder](#requiredwithescapedcharactersmap011010builder) | fooReverseSolidusReverseSolidusBar(value: List) | +| [RequiredWithEscapedCharactersMap011010Builder](#requiredwithescapedcharactersmap011010builder) | fooReverseSolidusReverseSolidusBar(value: Map) | + +## RequiredWithEscapedCharactersMap011100Builder +class RequiredWithEscapedCharactersMap011100Builder
+builder for `Map` + +A class that builds the Map input type + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| RequiredWithEscapedCharactersMap011100Builder(Map instance)
Creates a builder that contains the passed instance | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| [RequiredWithEscapedCharactersMap001100Builder](#requiredwithescapedcharactersmap001100builder) | fooReverseSolidusNbar(value: Nothing?) | +| [RequiredWithEscapedCharactersMap001100Builder](#requiredwithescapedcharactersmap001100builder) | fooReverseSolidusNbar(value: Boolean) | +| [RequiredWithEscapedCharactersMap001100Builder](#requiredwithescapedcharactersmap001100builder) | fooReverseSolidusNbar(value: String) | +| [RequiredWithEscapedCharactersMap001100Builder](#requiredwithescapedcharactersmap001100builder) | fooReverseSolidusNbar(value: Int) | +| [RequiredWithEscapedCharactersMap001100Builder](#requiredwithescapedcharactersmap001100builder) | fooReverseSolidusNbar(value: Float) | +| [RequiredWithEscapedCharactersMap001100Builder](#requiredwithescapedcharactersmap001100builder) | fooReverseSolidusNbar(value: Long) | +| [RequiredWithEscapedCharactersMap001100Builder](#requiredwithescapedcharactersmap001100builder) | fooReverseSolidusNbar(value: Double) | +| [RequiredWithEscapedCharactersMap001100Builder](#requiredwithescapedcharactersmap001100builder) | fooReverseSolidusNbar(value: List) | +| [RequiredWithEscapedCharactersMap001100Builder](#requiredwithescapedcharactersmap001100builder) | fooReverseSolidusNbar(value: Map) | +| [RequiredWithEscapedCharactersMap010100Builder](#requiredwithescapedcharactersmap010100builder) | fooReverseSolidusU000cbar(value: Nothing?) | +| [RequiredWithEscapedCharactersMap010100Builder](#requiredwithescapedcharactersmap010100builder) | fooReverseSolidusU000cbar(value: Boolean) | +| [RequiredWithEscapedCharactersMap010100Builder](#requiredwithescapedcharactersmap010100builder) | fooReverseSolidusU000cbar(value: String) | +| [RequiredWithEscapedCharactersMap010100Builder](#requiredwithescapedcharactersmap010100builder) | fooReverseSolidusU000cbar(value: Int) | +| [RequiredWithEscapedCharactersMap010100Builder](#requiredwithescapedcharactersmap010100builder) | fooReverseSolidusU000cbar(value: Float) | +| [RequiredWithEscapedCharactersMap010100Builder](#requiredwithescapedcharactersmap010100builder) | fooReverseSolidusU000cbar(value: Long) | +| [RequiredWithEscapedCharactersMap010100Builder](#requiredwithescapedcharactersmap010100builder) | fooReverseSolidusU000cbar(value: Double) | +| [RequiredWithEscapedCharactersMap010100Builder](#requiredwithescapedcharactersmap010100builder) | fooReverseSolidusU000cbar(value: List) | +| [RequiredWithEscapedCharactersMap010100Builder](#requiredwithescapedcharactersmap010100builder) | fooReverseSolidusU000cbar(value: Map) | +| [RequiredWithEscapedCharactersMap011000Builder](#requiredwithescapedcharactersmap011000builder) | fooReverseSolidusRbar(value: Nothing?) | +| [RequiredWithEscapedCharactersMap011000Builder](#requiredwithescapedcharactersmap011000builder) | fooReverseSolidusRbar(value: Boolean) | +| [RequiredWithEscapedCharactersMap011000Builder](#requiredwithescapedcharactersmap011000builder) | fooReverseSolidusRbar(value: String) | +| [RequiredWithEscapedCharactersMap011000Builder](#requiredwithescapedcharactersmap011000builder) | fooReverseSolidusRbar(value: Int) | +| [RequiredWithEscapedCharactersMap011000Builder](#requiredwithescapedcharactersmap011000builder) | fooReverseSolidusRbar(value: Float) | +| [RequiredWithEscapedCharactersMap011000Builder](#requiredwithescapedcharactersmap011000builder) | fooReverseSolidusRbar(value: Long) | +| [RequiredWithEscapedCharactersMap011000Builder](#requiredwithescapedcharactersmap011000builder) | fooReverseSolidusRbar(value: Double) | +| [RequiredWithEscapedCharactersMap011000Builder](#requiredwithescapedcharactersmap011000builder) | fooReverseSolidusRbar(value: List) | +| [RequiredWithEscapedCharactersMap011000Builder](#requiredwithescapedcharactersmap011000builder) | fooReverseSolidusRbar(value: Map) | + +## RequiredWithEscapedCharactersMap011101Builder +class RequiredWithEscapedCharactersMap011101Builder
+builder for `Map` + +A class that builds the Map input type + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| RequiredWithEscapedCharactersMap011101Builder(Map instance)
Creates a builder that contains the passed instance | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| [RequiredWithEscapedCharactersMap001101Builder](#requiredwithescapedcharactersmap001101builder) | fooReverseSolidusNbar(value: Nothing?) | +| [RequiredWithEscapedCharactersMap001101Builder](#requiredwithescapedcharactersmap001101builder) | fooReverseSolidusNbar(value: Boolean) | +| [RequiredWithEscapedCharactersMap001101Builder](#requiredwithescapedcharactersmap001101builder) | fooReverseSolidusNbar(value: String) | +| [RequiredWithEscapedCharactersMap001101Builder](#requiredwithescapedcharactersmap001101builder) | fooReverseSolidusNbar(value: Int) | +| [RequiredWithEscapedCharactersMap001101Builder](#requiredwithescapedcharactersmap001101builder) | fooReverseSolidusNbar(value: Float) | +| [RequiredWithEscapedCharactersMap001101Builder](#requiredwithescapedcharactersmap001101builder) | fooReverseSolidusNbar(value: Long) | +| [RequiredWithEscapedCharactersMap001101Builder](#requiredwithescapedcharactersmap001101builder) | fooReverseSolidusNbar(value: Double) | +| [RequiredWithEscapedCharactersMap001101Builder](#requiredwithescapedcharactersmap001101builder) | fooReverseSolidusNbar(value: List) | +| [RequiredWithEscapedCharactersMap001101Builder](#requiredwithescapedcharactersmap001101builder) | fooReverseSolidusNbar(value: Map) | +| [RequiredWithEscapedCharactersMap010101Builder](#requiredwithescapedcharactersmap010101builder) | fooReverseSolidusU000cbar(value: Nothing?) | +| [RequiredWithEscapedCharactersMap010101Builder](#requiredwithescapedcharactersmap010101builder) | fooReverseSolidusU000cbar(value: Boolean) | +| [RequiredWithEscapedCharactersMap010101Builder](#requiredwithescapedcharactersmap010101builder) | fooReverseSolidusU000cbar(value: String) | +| [RequiredWithEscapedCharactersMap010101Builder](#requiredwithescapedcharactersmap010101builder) | fooReverseSolidusU000cbar(value: Int) | +| [RequiredWithEscapedCharactersMap010101Builder](#requiredwithescapedcharactersmap010101builder) | fooReverseSolidusU000cbar(value: Float) | +| [RequiredWithEscapedCharactersMap010101Builder](#requiredwithescapedcharactersmap010101builder) | fooReverseSolidusU000cbar(value: Long) | +| [RequiredWithEscapedCharactersMap010101Builder](#requiredwithescapedcharactersmap010101builder) | fooReverseSolidusU000cbar(value: Double) | +| [RequiredWithEscapedCharactersMap010101Builder](#requiredwithescapedcharactersmap010101builder) | fooReverseSolidusU000cbar(value: List) | +| [RequiredWithEscapedCharactersMap010101Builder](#requiredwithescapedcharactersmap010101builder) | fooReverseSolidusU000cbar(value: Map) | +| [RequiredWithEscapedCharactersMap011001Builder](#requiredwithescapedcharactersmap011001builder) | fooReverseSolidusRbar(value: Nothing?) | +| [RequiredWithEscapedCharactersMap011001Builder](#requiredwithescapedcharactersmap011001builder) | fooReverseSolidusRbar(value: Boolean) | +| [RequiredWithEscapedCharactersMap011001Builder](#requiredwithescapedcharactersmap011001builder) | fooReverseSolidusRbar(value: String) | +| [RequiredWithEscapedCharactersMap011001Builder](#requiredwithescapedcharactersmap011001builder) | fooReverseSolidusRbar(value: Int) | +| [RequiredWithEscapedCharactersMap011001Builder](#requiredwithescapedcharactersmap011001builder) | fooReverseSolidusRbar(value: Float) | +| [RequiredWithEscapedCharactersMap011001Builder](#requiredwithescapedcharactersmap011001builder) | fooReverseSolidusRbar(value: Long) | +| [RequiredWithEscapedCharactersMap011001Builder](#requiredwithescapedcharactersmap011001builder) | fooReverseSolidusRbar(value: Double) | +| [RequiredWithEscapedCharactersMap011001Builder](#requiredwithescapedcharactersmap011001builder) | fooReverseSolidusRbar(value: List) | +| [RequiredWithEscapedCharactersMap011001Builder](#requiredwithescapedcharactersmap011001builder) | fooReverseSolidusRbar(value: Map) | +| [RequiredWithEscapedCharactersMap011100Builder](#requiredwithescapedcharactersmap011100builder) | fooReverseSolidusReverseSolidusBar(value: Nothing?) | +| [RequiredWithEscapedCharactersMap011100Builder](#requiredwithescapedcharactersmap011100builder) | fooReverseSolidusReverseSolidusBar(value: Boolean) | +| [RequiredWithEscapedCharactersMap011100Builder](#requiredwithescapedcharactersmap011100builder) | fooReverseSolidusReverseSolidusBar(value: String) | +| [RequiredWithEscapedCharactersMap011100Builder](#requiredwithescapedcharactersmap011100builder) | fooReverseSolidusReverseSolidusBar(value: Int) | +| [RequiredWithEscapedCharactersMap011100Builder](#requiredwithescapedcharactersmap011100builder) | fooReverseSolidusReverseSolidusBar(value: Float) | +| [RequiredWithEscapedCharactersMap011100Builder](#requiredwithescapedcharactersmap011100builder) | fooReverseSolidusReverseSolidusBar(value: Long) | +| [RequiredWithEscapedCharactersMap011100Builder](#requiredwithescapedcharactersmap011100builder) | fooReverseSolidusReverseSolidusBar(value: Double) | +| [RequiredWithEscapedCharactersMap011100Builder](#requiredwithescapedcharactersmap011100builder) | fooReverseSolidusReverseSolidusBar(value: List) | +| [RequiredWithEscapedCharactersMap011100Builder](#requiredwithescapedcharactersmap011100builder) | fooReverseSolidusReverseSolidusBar(value: Map) | + +## RequiredWithEscapedCharactersMap011110Builder +class RequiredWithEscapedCharactersMap011110Builder
+builder for `Map` + +A class that builds the Map input type + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| RequiredWithEscapedCharactersMap011110Builder(Map instance)
Creates a builder that contains the passed instance | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| [RequiredWithEscapedCharactersMap001110Builder](#requiredwithescapedcharactersmap001110builder) | fooReverseSolidusNbar(value: Nothing?) | +| [RequiredWithEscapedCharactersMap001110Builder](#requiredwithescapedcharactersmap001110builder) | fooReverseSolidusNbar(value: Boolean) | +| [RequiredWithEscapedCharactersMap001110Builder](#requiredwithescapedcharactersmap001110builder) | fooReverseSolidusNbar(value: String) | +| [RequiredWithEscapedCharactersMap001110Builder](#requiredwithescapedcharactersmap001110builder) | fooReverseSolidusNbar(value: Int) | +| [RequiredWithEscapedCharactersMap001110Builder](#requiredwithescapedcharactersmap001110builder) | fooReverseSolidusNbar(value: Float) | +| [RequiredWithEscapedCharactersMap001110Builder](#requiredwithescapedcharactersmap001110builder) | fooReverseSolidusNbar(value: Long) | +| [RequiredWithEscapedCharactersMap001110Builder](#requiredwithescapedcharactersmap001110builder) | fooReverseSolidusNbar(value: Double) | +| [RequiredWithEscapedCharactersMap001110Builder](#requiredwithescapedcharactersmap001110builder) | fooReverseSolidusNbar(value: List) | +| [RequiredWithEscapedCharactersMap001110Builder](#requiredwithescapedcharactersmap001110builder) | fooReverseSolidusNbar(value: Map) | +| [RequiredWithEscapedCharactersMap010110Builder](#requiredwithescapedcharactersmap010110builder) | fooReverseSolidusU000cbar(value: Nothing?) | +| [RequiredWithEscapedCharactersMap010110Builder](#requiredwithescapedcharactersmap010110builder) | fooReverseSolidusU000cbar(value: Boolean) | +| [RequiredWithEscapedCharactersMap010110Builder](#requiredwithescapedcharactersmap010110builder) | fooReverseSolidusU000cbar(value: String) | +| [RequiredWithEscapedCharactersMap010110Builder](#requiredwithescapedcharactersmap010110builder) | fooReverseSolidusU000cbar(value: Int) | +| [RequiredWithEscapedCharactersMap010110Builder](#requiredwithescapedcharactersmap010110builder) | fooReverseSolidusU000cbar(value: Float) | +| [RequiredWithEscapedCharactersMap010110Builder](#requiredwithescapedcharactersmap010110builder) | fooReverseSolidusU000cbar(value: Long) | +| [RequiredWithEscapedCharactersMap010110Builder](#requiredwithescapedcharactersmap010110builder) | fooReverseSolidusU000cbar(value: Double) | +| [RequiredWithEscapedCharactersMap010110Builder](#requiredwithescapedcharactersmap010110builder) | fooReverseSolidusU000cbar(value: List) | +| [RequiredWithEscapedCharactersMap010110Builder](#requiredwithescapedcharactersmap010110builder) | fooReverseSolidusU000cbar(value: Map) | +| [RequiredWithEscapedCharactersMap011010Builder](#requiredwithescapedcharactersmap011010builder) | fooReverseSolidusRbar(value: Nothing?) | +| [RequiredWithEscapedCharactersMap011010Builder](#requiredwithescapedcharactersmap011010builder) | fooReverseSolidusRbar(value: Boolean) | +| [RequiredWithEscapedCharactersMap011010Builder](#requiredwithescapedcharactersmap011010builder) | fooReverseSolidusRbar(value: String) | +| [RequiredWithEscapedCharactersMap011010Builder](#requiredwithescapedcharactersmap011010builder) | fooReverseSolidusRbar(value: Int) | +| [RequiredWithEscapedCharactersMap011010Builder](#requiredwithescapedcharactersmap011010builder) | fooReverseSolidusRbar(value: Float) | +| [RequiredWithEscapedCharactersMap011010Builder](#requiredwithescapedcharactersmap011010builder) | fooReverseSolidusRbar(value: Long) | +| [RequiredWithEscapedCharactersMap011010Builder](#requiredwithescapedcharactersmap011010builder) | fooReverseSolidusRbar(value: Double) | +| [RequiredWithEscapedCharactersMap011010Builder](#requiredwithescapedcharactersmap011010builder) | fooReverseSolidusRbar(value: List) | +| [RequiredWithEscapedCharactersMap011010Builder](#requiredwithescapedcharactersmap011010builder) | fooReverseSolidusRbar(value: Map) | +| [RequiredWithEscapedCharactersMap011100Builder](#requiredwithescapedcharactersmap011100builder) | fooReverseSolidusQuotationMarkBar(value: Nothing?) | +| [RequiredWithEscapedCharactersMap011100Builder](#requiredwithescapedcharactersmap011100builder) | fooReverseSolidusQuotationMarkBar(value: Boolean) | +| [RequiredWithEscapedCharactersMap011100Builder](#requiredwithescapedcharactersmap011100builder) | fooReverseSolidusQuotationMarkBar(value: String) | +| [RequiredWithEscapedCharactersMap011100Builder](#requiredwithescapedcharactersmap011100builder) | fooReverseSolidusQuotationMarkBar(value: Int) | +| [RequiredWithEscapedCharactersMap011100Builder](#requiredwithescapedcharactersmap011100builder) | fooReverseSolidusQuotationMarkBar(value: Float) | +| [RequiredWithEscapedCharactersMap011100Builder](#requiredwithescapedcharactersmap011100builder) | fooReverseSolidusQuotationMarkBar(value: Long) | +| [RequiredWithEscapedCharactersMap011100Builder](#requiredwithescapedcharactersmap011100builder) | fooReverseSolidusQuotationMarkBar(value: Double) | +| [RequiredWithEscapedCharactersMap011100Builder](#requiredwithescapedcharactersmap011100builder) | fooReverseSolidusQuotationMarkBar(value: List) | +| [RequiredWithEscapedCharactersMap011100Builder](#requiredwithescapedcharactersmap011100builder) | fooReverseSolidusQuotationMarkBar(value: Map) | + +## RequiredWithEscapedCharactersMap011111Builder +class RequiredWithEscapedCharactersMap011111Builder
+builder for `Map` + +A class that builds the Map input type + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| RequiredWithEscapedCharactersMap011111Builder(Map instance)
Creates a builder that contains the passed instance | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| [RequiredWithEscapedCharactersMap001111Builder](#requiredwithescapedcharactersmap001111builder) | fooReverseSolidusNbar(value: Nothing?) | +| [RequiredWithEscapedCharactersMap001111Builder](#requiredwithescapedcharactersmap001111builder) | fooReverseSolidusNbar(value: Boolean) | +| [RequiredWithEscapedCharactersMap001111Builder](#requiredwithescapedcharactersmap001111builder) | fooReverseSolidusNbar(value: String) | +| [RequiredWithEscapedCharactersMap001111Builder](#requiredwithescapedcharactersmap001111builder) | fooReverseSolidusNbar(value: Int) | +| [RequiredWithEscapedCharactersMap001111Builder](#requiredwithescapedcharactersmap001111builder) | fooReverseSolidusNbar(value: Float) | +| [RequiredWithEscapedCharactersMap001111Builder](#requiredwithescapedcharactersmap001111builder) | fooReverseSolidusNbar(value: Long) | +| [RequiredWithEscapedCharactersMap001111Builder](#requiredwithescapedcharactersmap001111builder) | fooReverseSolidusNbar(value: Double) | +| [RequiredWithEscapedCharactersMap001111Builder](#requiredwithescapedcharactersmap001111builder) | fooReverseSolidusNbar(value: List) | +| [RequiredWithEscapedCharactersMap001111Builder](#requiredwithescapedcharactersmap001111builder) | fooReverseSolidusNbar(value: Map) | +| [RequiredWithEscapedCharactersMap010111Builder](#requiredwithescapedcharactersmap010111builder) | fooReverseSolidusU000cbar(value: Nothing?) | +| [RequiredWithEscapedCharactersMap010111Builder](#requiredwithescapedcharactersmap010111builder) | fooReverseSolidusU000cbar(value: Boolean) | +| [RequiredWithEscapedCharactersMap010111Builder](#requiredwithescapedcharactersmap010111builder) | fooReverseSolidusU000cbar(value: String) | +| [RequiredWithEscapedCharactersMap010111Builder](#requiredwithescapedcharactersmap010111builder) | fooReverseSolidusU000cbar(value: Int) | +| [RequiredWithEscapedCharactersMap010111Builder](#requiredwithescapedcharactersmap010111builder) | fooReverseSolidusU000cbar(value: Float) | +| [RequiredWithEscapedCharactersMap010111Builder](#requiredwithescapedcharactersmap010111builder) | fooReverseSolidusU000cbar(value: Long) | +| [RequiredWithEscapedCharactersMap010111Builder](#requiredwithescapedcharactersmap010111builder) | fooReverseSolidusU000cbar(value: Double) | +| [RequiredWithEscapedCharactersMap010111Builder](#requiredwithescapedcharactersmap010111builder) | fooReverseSolidusU000cbar(value: List) | +| [RequiredWithEscapedCharactersMap010111Builder](#requiredwithescapedcharactersmap010111builder) | fooReverseSolidusU000cbar(value: Map) | +| [RequiredWithEscapedCharactersMap011011Builder](#requiredwithescapedcharactersmap011011builder) | fooReverseSolidusRbar(value: Nothing?) | +| [RequiredWithEscapedCharactersMap011011Builder](#requiredwithescapedcharactersmap011011builder) | fooReverseSolidusRbar(value: Boolean) | +| [RequiredWithEscapedCharactersMap011011Builder](#requiredwithescapedcharactersmap011011builder) | fooReverseSolidusRbar(value: String) | +| [RequiredWithEscapedCharactersMap011011Builder](#requiredwithescapedcharactersmap011011builder) | fooReverseSolidusRbar(value: Int) | +| [RequiredWithEscapedCharactersMap011011Builder](#requiredwithescapedcharactersmap011011builder) | fooReverseSolidusRbar(value: Float) | +| [RequiredWithEscapedCharactersMap011011Builder](#requiredwithescapedcharactersmap011011builder) | fooReverseSolidusRbar(value: Long) | +| [RequiredWithEscapedCharactersMap011011Builder](#requiredwithescapedcharactersmap011011builder) | fooReverseSolidusRbar(value: Double) | +| [RequiredWithEscapedCharactersMap011011Builder](#requiredwithescapedcharactersmap011011builder) | fooReverseSolidusRbar(value: List) | +| [RequiredWithEscapedCharactersMap011011Builder](#requiredwithescapedcharactersmap011011builder) | fooReverseSolidusRbar(value: Map) | +| [RequiredWithEscapedCharactersMap011101Builder](#requiredwithescapedcharactersmap011101builder) | fooReverseSolidusQuotationMarkBar(value: Nothing?) | +| [RequiredWithEscapedCharactersMap011101Builder](#requiredwithescapedcharactersmap011101builder) | fooReverseSolidusQuotationMarkBar(value: Boolean) | +| [RequiredWithEscapedCharactersMap011101Builder](#requiredwithescapedcharactersmap011101builder) | fooReverseSolidusQuotationMarkBar(value: String) | +| [RequiredWithEscapedCharactersMap011101Builder](#requiredwithescapedcharactersmap011101builder) | fooReverseSolidusQuotationMarkBar(value: Int) | +| [RequiredWithEscapedCharactersMap011101Builder](#requiredwithescapedcharactersmap011101builder) | fooReverseSolidusQuotationMarkBar(value: Float) | +| [RequiredWithEscapedCharactersMap011101Builder](#requiredwithescapedcharactersmap011101builder) | fooReverseSolidusQuotationMarkBar(value: Long) | +| [RequiredWithEscapedCharactersMap011101Builder](#requiredwithescapedcharactersmap011101builder) | fooReverseSolidusQuotationMarkBar(value: Double) | +| [RequiredWithEscapedCharactersMap011101Builder](#requiredwithescapedcharactersmap011101builder) | fooReverseSolidusQuotationMarkBar(value: List) | +| [RequiredWithEscapedCharactersMap011101Builder](#requiredwithescapedcharactersmap011101builder) | fooReverseSolidusQuotationMarkBar(value: Map) | +| [RequiredWithEscapedCharactersMap011110Builder](#requiredwithescapedcharactersmap011110builder) | fooReverseSolidusReverseSolidusBar(value: Nothing?) | +| [RequiredWithEscapedCharactersMap011110Builder](#requiredwithescapedcharactersmap011110builder) | fooReverseSolidusReverseSolidusBar(value: Boolean) | +| [RequiredWithEscapedCharactersMap011110Builder](#requiredwithescapedcharactersmap011110builder) | fooReverseSolidusReverseSolidusBar(value: String) | +| [RequiredWithEscapedCharactersMap011110Builder](#requiredwithescapedcharactersmap011110builder) | fooReverseSolidusReverseSolidusBar(value: Int) | +| [RequiredWithEscapedCharactersMap011110Builder](#requiredwithescapedcharactersmap011110builder) | fooReverseSolidusReverseSolidusBar(value: Float) | +| [RequiredWithEscapedCharactersMap011110Builder](#requiredwithescapedcharactersmap011110builder) | fooReverseSolidusReverseSolidusBar(value: Long) | +| [RequiredWithEscapedCharactersMap011110Builder](#requiredwithescapedcharactersmap011110builder) | fooReverseSolidusReverseSolidusBar(value: Double) | +| [RequiredWithEscapedCharactersMap011110Builder](#requiredwithescapedcharactersmap011110builder) | fooReverseSolidusReverseSolidusBar(value: List) | +| [RequiredWithEscapedCharactersMap011110Builder](#requiredwithescapedcharactersmap011110builder) | fooReverseSolidusReverseSolidusBar(value: Map) | + +## RequiredWithEscapedCharactersMap100000Builder +class RequiredWithEscapedCharactersMap100000Builder
+builder for `Map` + +A class that builds the Map input type + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| RequiredWithEscapedCharactersMap100000Builder(Map instance)
Creates a builder that contains the passed instance | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| [RequiredWithEscapedCharactersMap000000Builder](#requiredwithescapedcharactersmap000000builder) | fooReverseSolidusTbar(value: Nothing?) | +| [RequiredWithEscapedCharactersMap000000Builder](#requiredwithescapedcharactersmap000000builder) | fooReverseSolidusTbar(value: Boolean) | +| [RequiredWithEscapedCharactersMap000000Builder](#requiredwithescapedcharactersmap000000builder) | fooReverseSolidusTbar(value: String) | +| [RequiredWithEscapedCharactersMap000000Builder](#requiredwithescapedcharactersmap000000builder) | fooReverseSolidusTbar(value: Int) | +| [RequiredWithEscapedCharactersMap000000Builder](#requiredwithescapedcharactersmap000000builder) | fooReverseSolidusTbar(value: Float) | +| [RequiredWithEscapedCharactersMap000000Builder](#requiredwithescapedcharactersmap000000builder) | fooReverseSolidusTbar(value: Long) | +| [RequiredWithEscapedCharactersMap000000Builder](#requiredwithescapedcharactersmap000000builder) | fooReverseSolidusTbar(value: Double) | +| [RequiredWithEscapedCharactersMap000000Builder](#requiredwithescapedcharactersmap000000builder) | fooReverseSolidusTbar(value: List) | +| [RequiredWithEscapedCharactersMap000000Builder](#requiredwithescapedcharactersmap000000builder) | fooReverseSolidusTbar(value: Map) | + +## RequiredWithEscapedCharactersMap100001Builder +class RequiredWithEscapedCharactersMap100001Builder
+builder for `Map` + +A class that builds the Map input type + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| RequiredWithEscapedCharactersMap100001Builder(Map instance)
Creates a builder that contains the passed instance | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| [RequiredWithEscapedCharactersMap000001Builder](#requiredwithescapedcharactersmap000001builder) | fooReverseSolidusTbar(value: Nothing?) | +| [RequiredWithEscapedCharactersMap000001Builder](#requiredwithescapedcharactersmap000001builder) | fooReverseSolidusTbar(value: Boolean) | +| [RequiredWithEscapedCharactersMap000001Builder](#requiredwithescapedcharactersmap000001builder) | fooReverseSolidusTbar(value: String) | +| [RequiredWithEscapedCharactersMap000001Builder](#requiredwithescapedcharactersmap000001builder) | fooReverseSolidusTbar(value: Int) | +| [RequiredWithEscapedCharactersMap000001Builder](#requiredwithescapedcharactersmap000001builder) | fooReverseSolidusTbar(value: Float) | +| [RequiredWithEscapedCharactersMap000001Builder](#requiredwithescapedcharactersmap000001builder) | fooReverseSolidusTbar(value: Long) | +| [RequiredWithEscapedCharactersMap000001Builder](#requiredwithescapedcharactersmap000001builder) | fooReverseSolidusTbar(value: Double) | +| [RequiredWithEscapedCharactersMap000001Builder](#requiredwithescapedcharactersmap000001builder) | fooReverseSolidusTbar(value: List) | +| [RequiredWithEscapedCharactersMap000001Builder](#requiredwithescapedcharactersmap000001builder) | fooReverseSolidusTbar(value: Map) | +| [RequiredWithEscapedCharactersMap100000Builder](#requiredwithescapedcharactersmap100000builder) | fooReverseSolidusReverseSolidusBar(value: Nothing?) | +| [RequiredWithEscapedCharactersMap100000Builder](#requiredwithescapedcharactersmap100000builder) | fooReverseSolidusReverseSolidusBar(value: Boolean) | +| [RequiredWithEscapedCharactersMap100000Builder](#requiredwithescapedcharactersmap100000builder) | fooReverseSolidusReverseSolidusBar(value: String) | +| [RequiredWithEscapedCharactersMap100000Builder](#requiredwithescapedcharactersmap100000builder) | fooReverseSolidusReverseSolidusBar(value: Int) | +| [RequiredWithEscapedCharactersMap100000Builder](#requiredwithescapedcharactersmap100000builder) | fooReverseSolidusReverseSolidusBar(value: Float) | +| [RequiredWithEscapedCharactersMap100000Builder](#requiredwithescapedcharactersmap100000builder) | fooReverseSolidusReverseSolidusBar(value: Long) | +| [RequiredWithEscapedCharactersMap100000Builder](#requiredwithescapedcharactersmap100000builder) | fooReverseSolidusReverseSolidusBar(value: Double) | +| [RequiredWithEscapedCharactersMap100000Builder](#requiredwithescapedcharactersmap100000builder) | fooReverseSolidusReverseSolidusBar(value: List) | +| [RequiredWithEscapedCharactersMap100000Builder](#requiredwithescapedcharactersmap100000builder) | fooReverseSolidusReverseSolidusBar(value: Map) | + +## RequiredWithEscapedCharactersMap100010Builder +class RequiredWithEscapedCharactersMap100010Builder
+builder for `Map` + +A class that builds the Map input type + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| RequiredWithEscapedCharactersMap100010Builder(Map instance)
Creates a builder that contains the passed instance | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| [RequiredWithEscapedCharactersMap000010Builder](#requiredwithescapedcharactersmap000010builder) | fooReverseSolidusTbar(value: Nothing?) | +| [RequiredWithEscapedCharactersMap000010Builder](#requiredwithescapedcharactersmap000010builder) | fooReverseSolidusTbar(value: Boolean) | +| [RequiredWithEscapedCharactersMap000010Builder](#requiredwithescapedcharactersmap000010builder) | fooReverseSolidusTbar(value: String) | +| [RequiredWithEscapedCharactersMap000010Builder](#requiredwithescapedcharactersmap000010builder) | fooReverseSolidusTbar(value: Int) | +| [RequiredWithEscapedCharactersMap000010Builder](#requiredwithescapedcharactersmap000010builder) | fooReverseSolidusTbar(value: Float) | +| [RequiredWithEscapedCharactersMap000010Builder](#requiredwithescapedcharactersmap000010builder) | fooReverseSolidusTbar(value: Long) | +| [RequiredWithEscapedCharactersMap000010Builder](#requiredwithescapedcharactersmap000010builder) | fooReverseSolidusTbar(value: Double) | +| [RequiredWithEscapedCharactersMap000010Builder](#requiredwithescapedcharactersmap000010builder) | fooReverseSolidusTbar(value: List) | +| [RequiredWithEscapedCharactersMap000010Builder](#requiredwithescapedcharactersmap000010builder) | fooReverseSolidusTbar(value: Map) | +| [RequiredWithEscapedCharactersMap100000Builder](#requiredwithescapedcharactersmap100000builder) | fooReverseSolidusQuotationMarkBar(value: Nothing?) | +| [RequiredWithEscapedCharactersMap100000Builder](#requiredwithescapedcharactersmap100000builder) | fooReverseSolidusQuotationMarkBar(value: Boolean) | +| [RequiredWithEscapedCharactersMap100000Builder](#requiredwithescapedcharactersmap100000builder) | fooReverseSolidusQuotationMarkBar(value: String) | +| [RequiredWithEscapedCharactersMap100000Builder](#requiredwithescapedcharactersmap100000builder) | fooReverseSolidusQuotationMarkBar(value: Int) | +| [RequiredWithEscapedCharactersMap100000Builder](#requiredwithescapedcharactersmap100000builder) | fooReverseSolidusQuotationMarkBar(value: Float) | +| [RequiredWithEscapedCharactersMap100000Builder](#requiredwithescapedcharactersmap100000builder) | fooReverseSolidusQuotationMarkBar(value: Long) | +| [RequiredWithEscapedCharactersMap100000Builder](#requiredwithescapedcharactersmap100000builder) | fooReverseSolidusQuotationMarkBar(value: Double) | +| [RequiredWithEscapedCharactersMap100000Builder](#requiredwithescapedcharactersmap100000builder) | fooReverseSolidusQuotationMarkBar(value: List) | +| [RequiredWithEscapedCharactersMap100000Builder](#requiredwithescapedcharactersmap100000builder) | fooReverseSolidusQuotationMarkBar(value: Map) | + +## RequiredWithEscapedCharactersMap100011Builder +class RequiredWithEscapedCharactersMap100011Builder
+builder for `Map` + +A class that builds the Map input type + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| RequiredWithEscapedCharactersMap100011Builder(Map instance)
Creates a builder that contains the passed instance | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| [RequiredWithEscapedCharactersMap000011Builder](#requiredwithescapedcharactersmap000011builder) | fooReverseSolidusTbar(value: Nothing?) | +| [RequiredWithEscapedCharactersMap000011Builder](#requiredwithescapedcharactersmap000011builder) | fooReverseSolidusTbar(value: Boolean) | +| [RequiredWithEscapedCharactersMap000011Builder](#requiredwithescapedcharactersmap000011builder) | fooReverseSolidusTbar(value: String) | +| [RequiredWithEscapedCharactersMap000011Builder](#requiredwithescapedcharactersmap000011builder) | fooReverseSolidusTbar(value: Int) | +| [RequiredWithEscapedCharactersMap000011Builder](#requiredwithescapedcharactersmap000011builder) | fooReverseSolidusTbar(value: Float) | +| [RequiredWithEscapedCharactersMap000011Builder](#requiredwithescapedcharactersmap000011builder) | fooReverseSolidusTbar(value: Long) | +| [RequiredWithEscapedCharactersMap000011Builder](#requiredwithescapedcharactersmap000011builder) | fooReverseSolidusTbar(value: Double) | +| [RequiredWithEscapedCharactersMap000011Builder](#requiredwithescapedcharactersmap000011builder) | fooReverseSolidusTbar(value: List) | +| [RequiredWithEscapedCharactersMap000011Builder](#requiredwithescapedcharactersmap000011builder) | fooReverseSolidusTbar(value: Map) | +| [RequiredWithEscapedCharactersMap100001Builder](#requiredwithescapedcharactersmap100001builder) | fooReverseSolidusQuotationMarkBar(value: Nothing?) | +| [RequiredWithEscapedCharactersMap100001Builder](#requiredwithescapedcharactersmap100001builder) | fooReverseSolidusQuotationMarkBar(value: Boolean) | +| [RequiredWithEscapedCharactersMap100001Builder](#requiredwithescapedcharactersmap100001builder) | fooReverseSolidusQuotationMarkBar(value: String) | +| [RequiredWithEscapedCharactersMap100001Builder](#requiredwithescapedcharactersmap100001builder) | fooReverseSolidusQuotationMarkBar(value: Int) | +| [RequiredWithEscapedCharactersMap100001Builder](#requiredwithescapedcharactersmap100001builder) | fooReverseSolidusQuotationMarkBar(value: Float) | +| [RequiredWithEscapedCharactersMap100001Builder](#requiredwithescapedcharactersmap100001builder) | fooReverseSolidusQuotationMarkBar(value: Long) | +| [RequiredWithEscapedCharactersMap100001Builder](#requiredwithescapedcharactersmap100001builder) | fooReverseSolidusQuotationMarkBar(value: Double) | +| [RequiredWithEscapedCharactersMap100001Builder](#requiredwithescapedcharactersmap100001builder) | fooReverseSolidusQuotationMarkBar(value: List) | +| [RequiredWithEscapedCharactersMap100001Builder](#requiredwithescapedcharactersmap100001builder) | fooReverseSolidusQuotationMarkBar(value: Map) | +| [RequiredWithEscapedCharactersMap100010Builder](#requiredwithescapedcharactersmap100010builder) | fooReverseSolidusReverseSolidusBar(value: Nothing?) | +| [RequiredWithEscapedCharactersMap100010Builder](#requiredwithescapedcharactersmap100010builder) | fooReverseSolidusReverseSolidusBar(value: Boolean) | +| [RequiredWithEscapedCharactersMap100010Builder](#requiredwithescapedcharactersmap100010builder) | fooReverseSolidusReverseSolidusBar(value: String) | +| [RequiredWithEscapedCharactersMap100010Builder](#requiredwithescapedcharactersmap100010builder) | fooReverseSolidusReverseSolidusBar(value: Int) | +| [RequiredWithEscapedCharactersMap100010Builder](#requiredwithescapedcharactersmap100010builder) | fooReverseSolidusReverseSolidusBar(value: Float) | +| [RequiredWithEscapedCharactersMap100010Builder](#requiredwithescapedcharactersmap100010builder) | fooReverseSolidusReverseSolidusBar(value: Long) | +| [RequiredWithEscapedCharactersMap100010Builder](#requiredwithescapedcharactersmap100010builder) | fooReverseSolidusReverseSolidusBar(value: Double) | +| [RequiredWithEscapedCharactersMap100010Builder](#requiredwithescapedcharactersmap100010builder) | fooReverseSolidusReverseSolidusBar(value: List) | +| [RequiredWithEscapedCharactersMap100010Builder](#requiredwithescapedcharactersmap100010builder) | fooReverseSolidusReverseSolidusBar(value: Map) | + +## RequiredWithEscapedCharactersMap100100Builder +class RequiredWithEscapedCharactersMap100100Builder
+builder for `Map` + +A class that builds the Map input type + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| RequiredWithEscapedCharactersMap100100Builder(Map instance)
Creates a builder that contains the passed instance | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| [RequiredWithEscapedCharactersMap000100Builder](#requiredwithescapedcharactersmap000100builder) | fooReverseSolidusTbar(value: Nothing?) | +| [RequiredWithEscapedCharactersMap000100Builder](#requiredwithescapedcharactersmap000100builder) | fooReverseSolidusTbar(value: Boolean) | +| [RequiredWithEscapedCharactersMap000100Builder](#requiredwithescapedcharactersmap000100builder) | fooReverseSolidusTbar(value: String) | +| [RequiredWithEscapedCharactersMap000100Builder](#requiredwithescapedcharactersmap000100builder) | fooReverseSolidusTbar(value: Int) | +| [RequiredWithEscapedCharactersMap000100Builder](#requiredwithescapedcharactersmap000100builder) | fooReverseSolidusTbar(value: Float) | +| [RequiredWithEscapedCharactersMap000100Builder](#requiredwithescapedcharactersmap000100builder) | fooReverseSolidusTbar(value: Long) | +| [RequiredWithEscapedCharactersMap000100Builder](#requiredwithescapedcharactersmap000100builder) | fooReverseSolidusTbar(value: Double) | +| [RequiredWithEscapedCharactersMap000100Builder](#requiredwithescapedcharactersmap000100builder) | fooReverseSolidusTbar(value: List) | +| [RequiredWithEscapedCharactersMap000100Builder](#requiredwithescapedcharactersmap000100builder) | fooReverseSolidusTbar(value: Map) | +| [RequiredWithEscapedCharactersMap100000Builder](#requiredwithescapedcharactersmap100000builder) | fooReverseSolidusRbar(value: Nothing?) | +| [RequiredWithEscapedCharactersMap100000Builder](#requiredwithescapedcharactersmap100000builder) | fooReverseSolidusRbar(value: Boolean) | +| [RequiredWithEscapedCharactersMap100000Builder](#requiredwithescapedcharactersmap100000builder) | fooReverseSolidusRbar(value: String) | +| [RequiredWithEscapedCharactersMap100000Builder](#requiredwithescapedcharactersmap100000builder) | fooReverseSolidusRbar(value: Int) | +| [RequiredWithEscapedCharactersMap100000Builder](#requiredwithescapedcharactersmap100000builder) | fooReverseSolidusRbar(value: Float) | +| [RequiredWithEscapedCharactersMap100000Builder](#requiredwithescapedcharactersmap100000builder) | fooReverseSolidusRbar(value: Long) | +| [RequiredWithEscapedCharactersMap100000Builder](#requiredwithescapedcharactersmap100000builder) | fooReverseSolidusRbar(value: Double) | +| [RequiredWithEscapedCharactersMap100000Builder](#requiredwithescapedcharactersmap100000builder) | fooReverseSolidusRbar(value: List) | +| [RequiredWithEscapedCharactersMap100000Builder](#requiredwithescapedcharactersmap100000builder) | fooReverseSolidusRbar(value: Map) | + +## RequiredWithEscapedCharactersMap100101Builder +class RequiredWithEscapedCharactersMap100101Builder
+builder for `Map` + +A class that builds the Map input type + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| RequiredWithEscapedCharactersMap100101Builder(Map instance)
Creates a builder that contains the passed instance | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| [RequiredWithEscapedCharactersMap000101Builder](#requiredwithescapedcharactersmap000101builder) | fooReverseSolidusTbar(value: Nothing?) | +| [RequiredWithEscapedCharactersMap000101Builder](#requiredwithescapedcharactersmap000101builder) | fooReverseSolidusTbar(value: Boolean) | +| [RequiredWithEscapedCharactersMap000101Builder](#requiredwithescapedcharactersmap000101builder) | fooReverseSolidusTbar(value: String) | +| [RequiredWithEscapedCharactersMap000101Builder](#requiredwithescapedcharactersmap000101builder) | fooReverseSolidusTbar(value: Int) | +| [RequiredWithEscapedCharactersMap000101Builder](#requiredwithescapedcharactersmap000101builder) | fooReverseSolidusTbar(value: Float) | +| [RequiredWithEscapedCharactersMap000101Builder](#requiredwithescapedcharactersmap000101builder) | fooReverseSolidusTbar(value: Long) | +| [RequiredWithEscapedCharactersMap000101Builder](#requiredwithescapedcharactersmap000101builder) | fooReverseSolidusTbar(value: Double) | +| [RequiredWithEscapedCharactersMap000101Builder](#requiredwithescapedcharactersmap000101builder) | fooReverseSolidusTbar(value: List) | +| [RequiredWithEscapedCharactersMap000101Builder](#requiredwithescapedcharactersmap000101builder) | fooReverseSolidusTbar(value: Map) | +| [RequiredWithEscapedCharactersMap100001Builder](#requiredwithescapedcharactersmap100001builder) | fooReverseSolidusRbar(value: Nothing?) | +| [RequiredWithEscapedCharactersMap100001Builder](#requiredwithescapedcharactersmap100001builder) | fooReverseSolidusRbar(value: Boolean) | +| [RequiredWithEscapedCharactersMap100001Builder](#requiredwithescapedcharactersmap100001builder) | fooReverseSolidusRbar(value: String) | +| [RequiredWithEscapedCharactersMap100001Builder](#requiredwithescapedcharactersmap100001builder) | fooReverseSolidusRbar(value: Int) | +| [RequiredWithEscapedCharactersMap100001Builder](#requiredwithescapedcharactersmap100001builder) | fooReverseSolidusRbar(value: Float) | +| [RequiredWithEscapedCharactersMap100001Builder](#requiredwithescapedcharactersmap100001builder) | fooReverseSolidusRbar(value: Long) | +| [RequiredWithEscapedCharactersMap100001Builder](#requiredwithescapedcharactersmap100001builder) | fooReverseSolidusRbar(value: Double) | +| [RequiredWithEscapedCharactersMap100001Builder](#requiredwithescapedcharactersmap100001builder) | fooReverseSolidusRbar(value: List) | +| [RequiredWithEscapedCharactersMap100001Builder](#requiredwithescapedcharactersmap100001builder) | fooReverseSolidusRbar(value: Map) | +| [RequiredWithEscapedCharactersMap100100Builder](#requiredwithescapedcharactersmap100100builder) | fooReverseSolidusReverseSolidusBar(value: Nothing?) | +| [RequiredWithEscapedCharactersMap100100Builder](#requiredwithescapedcharactersmap100100builder) | fooReverseSolidusReverseSolidusBar(value: Boolean) | +| [RequiredWithEscapedCharactersMap100100Builder](#requiredwithescapedcharactersmap100100builder) | fooReverseSolidusReverseSolidusBar(value: String) | +| [RequiredWithEscapedCharactersMap100100Builder](#requiredwithescapedcharactersmap100100builder) | fooReverseSolidusReverseSolidusBar(value: Int) | +| [RequiredWithEscapedCharactersMap100100Builder](#requiredwithescapedcharactersmap100100builder) | fooReverseSolidusReverseSolidusBar(value: Float) | +| [RequiredWithEscapedCharactersMap100100Builder](#requiredwithescapedcharactersmap100100builder) | fooReverseSolidusReverseSolidusBar(value: Long) | +| [RequiredWithEscapedCharactersMap100100Builder](#requiredwithescapedcharactersmap100100builder) | fooReverseSolidusReverseSolidusBar(value: Double) | +| [RequiredWithEscapedCharactersMap100100Builder](#requiredwithescapedcharactersmap100100builder) | fooReverseSolidusReverseSolidusBar(value: List) | +| [RequiredWithEscapedCharactersMap100100Builder](#requiredwithescapedcharactersmap100100builder) | fooReverseSolidusReverseSolidusBar(value: Map) | + +## RequiredWithEscapedCharactersMap100110Builder +class RequiredWithEscapedCharactersMap100110Builder
+builder for `Map` + +A class that builds the Map input type + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| RequiredWithEscapedCharactersMap100110Builder(Map instance)
Creates a builder that contains the passed instance | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| [RequiredWithEscapedCharactersMap000110Builder](#requiredwithescapedcharactersmap000110builder) | fooReverseSolidusTbar(value: Nothing?) | +| [RequiredWithEscapedCharactersMap000110Builder](#requiredwithescapedcharactersmap000110builder) | fooReverseSolidusTbar(value: Boolean) | +| [RequiredWithEscapedCharactersMap000110Builder](#requiredwithescapedcharactersmap000110builder) | fooReverseSolidusTbar(value: String) | +| [RequiredWithEscapedCharactersMap000110Builder](#requiredwithescapedcharactersmap000110builder) | fooReverseSolidusTbar(value: Int) | +| [RequiredWithEscapedCharactersMap000110Builder](#requiredwithescapedcharactersmap000110builder) | fooReverseSolidusTbar(value: Float) | +| [RequiredWithEscapedCharactersMap000110Builder](#requiredwithescapedcharactersmap000110builder) | fooReverseSolidusTbar(value: Long) | +| [RequiredWithEscapedCharactersMap000110Builder](#requiredwithescapedcharactersmap000110builder) | fooReverseSolidusTbar(value: Double) | +| [RequiredWithEscapedCharactersMap000110Builder](#requiredwithescapedcharactersmap000110builder) | fooReverseSolidusTbar(value: List) | +| [RequiredWithEscapedCharactersMap000110Builder](#requiredwithescapedcharactersmap000110builder) | fooReverseSolidusTbar(value: Map) | +| [RequiredWithEscapedCharactersMap100010Builder](#requiredwithescapedcharactersmap100010builder) | fooReverseSolidusRbar(value: Nothing?) | +| [RequiredWithEscapedCharactersMap100010Builder](#requiredwithescapedcharactersmap100010builder) | fooReverseSolidusRbar(value: Boolean) | +| [RequiredWithEscapedCharactersMap100010Builder](#requiredwithescapedcharactersmap100010builder) | fooReverseSolidusRbar(value: String) | +| [RequiredWithEscapedCharactersMap100010Builder](#requiredwithescapedcharactersmap100010builder) | fooReverseSolidusRbar(value: Int) | +| [RequiredWithEscapedCharactersMap100010Builder](#requiredwithescapedcharactersmap100010builder) | fooReverseSolidusRbar(value: Float) | +| [RequiredWithEscapedCharactersMap100010Builder](#requiredwithescapedcharactersmap100010builder) | fooReverseSolidusRbar(value: Long) | +| [RequiredWithEscapedCharactersMap100010Builder](#requiredwithescapedcharactersmap100010builder) | fooReverseSolidusRbar(value: Double) | +| [RequiredWithEscapedCharactersMap100010Builder](#requiredwithescapedcharactersmap100010builder) | fooReverseSolidusRbar(value: List) | +| [RequiredWithEscapedCharactersMap100010Builder](#requiredwithescapedcharactersmap100010builder) | fooReverseSolidusRbar(value: Map) | +| [RequiredWithEscapedCharactersMap100100Builder](#requiredwithescapedcharactersmap100100builder) | fooReverseSolidusQuotationMarkBar(value: Nothing?) | +| [RequiredWithEscapedCharactersMap100100Builder](#requiredwithescapedcharactersmap100100builder) | fooReverseSolidusQuotationMarkBar(value: Boolean) | +| [RequiredWithEscapedCharactersMap100100Builder](#requiredwithescapedcharactersmap100100builder) | fooReverseSolidusQuotationMarkBar(value: String) | +| [RequiredWithEscapedCharactersMap100100Builder](#requiredwithescapedcharactersmap100100builder) | fooReverseSolidusQuotationMarkBar(value: Int) | +| [RequiredWithEscapedCharactersMap100100Builder](#requiredwithescapedcharactersmap100100builder) | fooReverseSolidusQuotationMarkBar(value: Float) | +| [RequiredWithEscapedCharactersMap100100Builder](#requiredwithescapedcharactersmap100100builder) | fooReverseSolidusQuotationMarkBar(value: Long) | +| [RequiredWithEscapedCharactersMap100100Builder](#requiredwithescapedcharactersmap100100builder) | fooReverseSolidusQuotationMarkBar(value: Double) | +| [RequiredWithEscapedCharactersMap100100Builder](#requiredwithescapedcharactersmap100100builder) | fooReverseSolidusQuotationMarkBar(value: List) | +| [RequiredWithEscapedCharactersMap100100Builder](#requiredwithescapedcharactersmap100100builder) | fooReverseSolidusQuotationMarkBar(value: Map) | + +## RequiredWithEscapedCharactersMap100111Builder +class RequiredWithEscapedCharactersMap100111Builder
+builder for `Map` + +A class that builds the Map input type + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| RequiredWithEscapedCharactersMap100111Builder(Map instance)
Creates a builder that contains the passed instance | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| [RequiredWithEscapedCharactersMap000111Builder](#requiredwithescapedcharactersmap000111builder) | fooReverseSolidusTbar(value: Nothing?) | +| [RequiredWithEscapedCharactersMap000111Builder](#requiredwithescapedcharactersmap000111builder) | fooReverseSolidusTbar(value: Boolean) | +| [RequiredWithEscapedCharactersMap000111Builder](#requiredwithescapedcharactersmap000111builder) | fooReverseSolidusTbar(value: String) | +| [RequiredWithEscapedCharactersMap000111Builder](#requiredwithescapedcharactersmap000111builder) | fooReverseSolidusTbar(value: Int) | +| [RequiredWithEscapedCharactersMap000111Builder](#requiredwithescapedcharactersmap000111builder) | fooReverseSolidusTbar(value: Float) | +| [RequiredWithEscapedCharactersMap000111Builder](#requiredwithescapedcharactersmap000111builder) | fooReverseSolidusTbar(value: Long) | +| [RequiredWithEscapedCharactersMap000111Builder](#requiredwithescapedcharactersmap000111builder) | fooReverseSolidusTbar(value: Double) | +| [RequiredWithEscapedCharactersMap000111Builder](#requiredwithescapedcharactersmap000111builder) | fooReverseSolidusTbar(value: List) | +| [RequiredWithEscapedCharactersMap000111Builder](#requiredwithescapedcharactersmap000111builder) | fooReverseSolidusTbar(value: Map) | +| [RequiredWithEscapedCharactersMap100011Builder](#requiredwithescapedcharactersmap100011builder) | fooReverseSolidusRbar(value: Nothing?) | +| [RequiredWithEscapedCharactersMap100011Builder](#requiredwithescapedcharactersmap100011builder) | fooReverseSolidusRbar(value: Boolean) | +| [RequiredWithEscapedCharactersMap100011Builder](#requiredwithescapedcharactersmap100011builder) | fooReverseSolidusRbar(value: String) | +| [RequiredWithEscapedCharactersMap100011Builder](#requiredwithescapedcharactersmap100011builder) | fooReverseSolidusRbar(value: Int) | +| [RequiredWithEscapedCharactersMap100011Builder](#requiredwithescapedcharactersmap100011builder) | fooReverseSolidusRbar(value: Float) | +| [RequiredWithEscapedCharactersMap100011Builder](#requiredwithescapedcharactersmap100011builder) | fooReverseSolidusRbar(value: Long) | +| [RequiredWithEscapedCharactersMap100011Builder](#requiredwithescapedcharactersmap100011builder) | fooReverseSolidusRbar(value: Double) | +| [RequiredWithEscapedCharactersMap100011Builder](#requiredwithescapedcharactersmap100011builder) | fooReverseSolidusRbar(value: List) | +| [RequiredWithEscapedCharactersMap100011Builder](#requiredwithescapedcharactersmap100011builder) | fooReverseSolidusRbar(value: Map) | +| [RequiredWithEscapedCharactersMap100101Builder](#requiredwithescapedcharactersmap100101builder) | fooReverseSolidusQuotationMarkBar(value: Nothing?) | +| [RequiredWithEscapedCharactersMap100101Builder](#requiredwithescapedcharactersmap100101builder) | fooReverseSolidusQuotationMarkBar(value: Boolean) | +| [RequiredWithEscapedCharactersMap100101Builder](#requiredwithescapedcharactersmap100101builder) | fooReverseSolidusQuotationMarkBar(value: String) | +| [RequiredWithEscapedCharactersMap100101Builder](#requiredwithescapedcharactersmap100101builder) | fooReverseSolidusQuotationMarkBar(value: Int) | +| [RequiredWithEscapedCharactersMap100101Builder](#requiredwithescapedcharactersmap100101builder) | fooReverseSolidusQuotationMarkBar(value: Float) | +| [RequiredWithEscapedCharactersMap100101Builder](#requiredwithescapedcharactersmap100101builder) | fooReverseSolidusQuotationMarkBar(value: Long) | +| [RequiredWithEscapedCharactersMap100101Builder](#requiredwithescapedcharactersmap100101builder) | fooReverseSolidusQuotationMarkBar(value: Double) | +| [RequiredWithEscapedCharactersMap100101Builder](#requiredwithescapedcharactersmap100101builder) | fooReverseSolidusQuotationMarkBar(value: List) | +| [RequiredWithEscapedCharactersMap100101Builder](#requiredwithescapedcharactersmap100101builder) | fooReverseSolidusQuotationMarkBar(value: Map) | +| [RequiredWithEscapedCharactersMap100110Builder](#requiredwithescapedcharactersmap100110builder) | fooReverseSolidusReverseSolidusBar(value: Nothing?) | +| [RequiredWithEscapedCharactersMap100110Builder](#requiredwithescapedcharactersmap100110builder) | fooReverseSolidusReverseSolidusBar(value: Boolean) | +| [RequiredWithEscapedCharactersMap100110Builder](#requiredwithescapedcharactersmap100110builder) | fooReverseSolidusReverseSolidusBar(value: String) | +| [RequiredWithEscapedCharactersMap100110Builder](#requiredwithescapedcharactersmap100110builder) | fooReverseSolidusReverseSolidusBar(value: Int) | +| [RequiredWithEscapedCharactersMap100110Builder](#requiredwithescapedcharactersmap100110builder) | fooReverseSolidusReverseSolidusBar(value: Float) | +| [RequiredWithEscapedCharactersMap100110Builder](#requiredwithescapedcharactersmap100110builder) | fooReverseSolidusReverseSolidusBar(value: Long) | +| [RequiredWithEscapedCharactersMap100110Builder](#requiredwithescapedcharactersmap100110builder) | fooReverseSolidusReverseSolidusBar(value: Double) | +| [RequiredWithEscapedCharactersMap100110Builder](#requiredwithescapedcharactersmap100110builder) | fooReverseSolidusReverseSolidusBar(value: List) | +| [RequiredWithEscapedCharactersMap100110Builder](#requiredwithescapedcharactersmap100110builder) | fooReverseSolidusReverseSolidusBar(value: Map) | + +## RequiredWithEscapedCharactersMap101000Builder +class RequiredWithEscapedCharactersMap101000Builder
+builder for `Map` + +A class that builds the Map input type + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| RequiredWithEscapedCharactersMap101000Builder(Map instance)
Creates a builder that contains the passed instance | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| [RequiredWithEscapedCharactersMap001000Builder](#requiredwithescapedcharactersmap001000builder) | fooReverseSolidusTbar(value: Nothing?) | +| [RequiredWithEscapedCharactersMap001000Builder](#requiredwithescapedcharactersmap001000builder) | fooReverseSolidusTbar(value: Boolean) | +| [RequiredWithEscapedCharactersMap001000Builder](#requiredwithescapedcharactersmap001000builder) | fooReverseSolidusTbar(value: String) | +| [RequiredWithEscapedCharactersMap001000Builder](#requiredwithescapedcharactersmap001000builder) | fooReverseSolidusTbar(value: Int) | +| [RequiredWithEscapedCharactersMap001000Builder](#requiredwithescapedcharactersmap001000builder) | fooReverseSolidusTbar(value: Float) | +| [RequiredWithEscapedCharactersMap001000Builder](#requiredwithescapedcharactersmap001000builder) | fooReverseSolidusTbar(value: Long) | +| [RequiredWithEscapedCharactersMap001000Builder](#requiredwithescapedcharactersmap001000builder) | fooReverseSolidusTbar(value: Double) | +| [RequiredWithEscapedCharactersMap001000Builder](#requiredwithescapedcharactersmap001000builder) | fooReverseSolidusTbar(value: List) | +| [RequiredWithEscapedCharactersMap001000Builder](#requiredwithescapedcharactersmap001000builder) | fooReverseSolidusTbar(value: Map) | +| [RequiredWithEscapedCharactersMap100000Builder](#requiredwithescapedcharactersmap100000builder) | fooReverseSolidusU000cbar(value: Nothing?) | +| [RequiredWithEscapedCharactersMap100000Builder](#requiredwithescapedcharactersmap100000builder) | fooReverseSolidusU000cbar(value: Boolean) | +| [RequiredWithEscapedCharactersMap100000Builder](#requiredwithescapedcharactersmap100000builder) | fooReverseSolidusU000cbar(value: String) | +| [RequiredWithEscapedCharactersMap100000Builder](#requiredwithescapedcharactersmap100000builder) | fooReverseSolidusU000cbar(value: Int) | +| [RequiredWithEscapedCharactersMap100000Builder](#requiredwithescapedcharactersmap100000builder) | fooReverseSolidusU000cbar(value: Float) | +| [RequiredWithEscapedCharactersMap100000Builder](#requiredwithescapedcharactersmap100000builder) | fooReverseSolidusU000cbar(value: Long) | +| [RequiredWithEscapedCharactersMap100000Builder](#requiredwithescapedcharactersmap100000builder) | fooReverseSolidusU000cbar(value: Double) | +| [RequiredWithEscapedCharactersMap100000Builder](#requiredwithescapedcharactersmap100000builder) | fooReverseSolidusU000cbar(value: List) | +| [RequiredWithEscapedCharactersMap100000Builder](#requiredwithescapedcharactersmap100000builder) | fooReverseSolidusU000cbar(value: Map) | + +## RequiredWithEscapedCharactersMap101001Builder +class RequiredWithEscapedCharactersMap101001Builder
+builder for `Map` + +A class that builds the Map input type + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| RequiredWithEscapedCharactersMap101001Builder(Map instance)
Creates a builder that contains the passed instance | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| [RequiredWithEscapedCharactersMap001001Builder](#requiredwithescapedcharactersmap001001builder) | fooReverseSolidusTbar(value: Nothing?) | +| [RequiredWithEscapedCharactersMap001001Builder](#requiredwithescapedcharactersmap001001builder) | fooReverseSolidusTbar(value: Boolean) | +| [RequiredWithEscapedCharactersMap001001Builder](#requiredwithescapedcharactersmap001001builder) | fooReverseSolidusTbar(value: String) | +| [RequiredWithEscapedCharactersMap001001Builder](#requiredwithescapedcharactersmap001001builder) | fooReverseSolidusTbar(value: Int) | +| [RequiredWithEscapedCharactersMap001001Builder](#requiredwithescapedcharactersmap001001builder) | fooReverseSolidusTbar(value: Float) | +| [RequiredWithEscapedCharactersMap001001Builder](#requiredwithescapedcharactersmap001001builder) | fooReverseSolidusTbar(value: Long) | +| [RequiredWithEscapedCharactersMap001001Builder](#requiredwithescapedcharactersmap001001builder) | fooReverseSolidusTbar(value: Double) | +| [RequiredWithEscapedCharactersMap001001Builder](#requiredwithescapedcharactersmap001001builder) | fooReverseSolidusTbar(value: List) | +| [RequiredWithEscapedCharactersMap001001Builder](#requiredwithescapedcharactersmap001001builder) | fooReverseSolidusTbar(value: Map) | +| [RequiredWithEscapedCharactersMap100001Builder](#requiredwithescapedcharactersmap100001builder) | fooReverseSolidusU000cbar(value: Nothing?) | +| [RequiredWithEscapedCharactersMap100001Builder](#requiredwithescapedcharactersmap100001builder) | fooReverseSolidusU000cbar(value: Boolean) | +| [RequiredWithEscapedCharactersMap100001Builder](#requiredwithescapedcharactersmap100001builder) | fooReverseSolidusU000cbar(value: String) | +| [RequiredWithEscapedCharactersMap100001Builder](#requiredwithescapedcharactersmap100001builder) | fooReverseSolidusU000cbar(value: Int) | +| [RequiredWithEscapedCharactersMap100001Builder](#requiredwithescapedcharactersmap100001builder) | fooReverseSolidusU000cbar(value: Float) | +| [RequiredWithEscapedCharactersMap100001Builder](#requiredwithescapedcharactersmap100001builder) | fooReverseSolidusU000cbar(value: Long) | +| [RequiredWithEscapedCharactersMap100001Builder](#requiredwithescapedcharactersmap100001builder) | fooReverseSolidusU000cbar(value: Double) | +| [RequiredWithEscapedCharactersMap100001Builder](#requiredwithescapedcharactersmap100001builder) | fooReverseSolidusU000cbar(value: List) | +| [RequiredWithEscapedCharactersMap100001Builder](#requiredwithescapedcharactersmap100001builder) | fooReverseSolidusU000cbar(value: Map) | +| [RequiredWithEscapedCharactersMap101000Builder](#requiredwithescapedcharactersmap101000builder) | fooReverseSolidusReverseSolidusBar(value: Nothing?) | +| [RequiredWithEscapedCharactersMap101000Builder](#requiredwithescapedcharactersmap101000builder) | fooReverseSolidusReverseSolidusBar(value: Boolean) | +| [RequiredWithEscapedCharactersMap101000Builder](#requiredwithescapedcharactersmap101000builder) | fooReverseSolidusReverseSolidusBar(value: String) | +| [RequiredWithEscapedCharactersMap101000Builder](#requiredwithescapedcharactersmap101000builder) | fooReverseSolidusReverseSolidusBar(value: Int) | +| [RequiredWithEscapedCharactersMap101000Builder](#requiredwithescapedcharactersmap101000builder) | fooReverseSolidusReverseSolidusBar(value: Float) | +| [RequiredWithEscapedCharactersMap101000Builder](#requiredwithescapedcharactersmap101000builder) | fooReverseSolidusReverseSolidusBar(value: Long) | +| [RequiredWithEscapedCharactersMap101000Builder](#requiredwithescapedcharactersmap101000builder) | fooReverseSolidusReverseSolidusBar(value: Double) | +| [RequiredWithEscapedCharactersMap101000Builder](#requiredwithescapedcharactersmap101000builder) | fooReverseSolidusReverseSolidusBar(value: List) | +| [RequiredWithEscapedCharactersMap101000Builder](#requiredwithescapedcharactersmap101000builder) | fooReverseSolidusReverseSolidusBar(value: Map) | + +## RequiredWithEscapedCharactersMap101010Builder +class RequiredWithEscapedCharactersMap101010Builder
+builder for `Map` + +A class that builds the Map input type + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| RequiredWithEscapedCharactersMap101010Builder(Map instance)
Creates a builder that contains the passed instance | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| [RequiredWithEscapedCharactersMap001010Builder](#requiredwithescapedcharactersmap001010builder) | fooReverseSolidusTbar(value: Nothing?) | +| [RequiredWithEscapedCharactersMap001010Builder](#requiredwithescapedcharactersmap001010builder) | fooReverseSolidusTbar(value: Boolean) | +| [RequiredWithEscapedCharactersMap001010Builder](#requiredwithescapedcharactersmap001010builder) | fooReverseSolidusTbar(value: String) | +| [RequiredWithEscapedCharactersMap001010Builder](#requiredwithescapedcharactersmap001010builder) | fooReverseSolidusTbar(value: Int) | +| [RequiredWithEscapedCharactersMap001010Builder](#requiredwithescapedcharactersmap001010builder) | fooReverseSolidusTbar(value: Float) | +| [RequiredWithEscapedCharactersMap001010Builder](#requiredwithescapedcharactersmap001010builder) | fooReverseSolidusTbar(value: Long) | +| [RequiredWithEscapedCharactersMap001010Builder](#requiredwithescapedcharactersmap001010builder) | fooReverseSolidusTbar(value: Double) | +| [RequiredWithEscapedCharactersMap001010Builder](#requiredwithescapedcharactersmap001010builder) | fooReverseSolidusTbar(value: List) | +| [RequiredWithEscapedCharactersMap001010Builder](#requiredwithescapedcharactersmap001010builder) | fooReverseSolidusTbar(value: Map) | +| [RequiredWithEscapedCharactersMap100010Builder](#requiredwithescapedcharactersmap100010builder) | fooReverseSolidusU000cbar(value: Nothing?) | +| [RequiredWithEscapedCharactersMap100010Builder](#requiredwithescapedcharactersmap100010builder) | fooReverseSolidusU000cbar(value: Boolean) | +| [RequiredWithEscapedCharactersMap100010Builder](#requiredwithescapedcharactersmap100010builder) | fooReverseSolidusU000cbar(value: String) | +| [RequiredWithEscapedCharactersMap100010Builder](#requiredwithescapedcharactersmap100010builder) | fooReverseSolidusU000cbar(value: Int) | +| [RequiredWithEscapedCharactersMap100010Builder](#requiredwithescapedcharactersmap100010builder) | fooReverseSolidusU000cbar(value: Float) | +| [RequiredWithEscapedCharactersMap100010Builder](#requiredwithescapedcharactersmap100010builder) | fooReverseSolidusU000cbar(value: Long) | +| [RequiredWithEscapedCharactersMap100010Builder](#requiredwithescapedcharactersmap100010builder) | fooReverseSolidusU000cbar(value: Double) | +| [RequiredWithEscapedCharactersMap100010Builder](#requiredwithescapedcharactersmap100010builder) | fooReverseSolidusU000cbar(value: List) | +| [RequiredWithEscapedCharactersMap100010Builder](#requiredwithescapedcharactersmap100010builder) | fooReverseSolidusU000cbar(value: Map) | +| [RequiredWithEscapedCharactersMap101000Builder](#requiredwithescapedcharactersmap101000builder) | fooReverseSolidusQuotationMarkBar(value: Nothing?) | +| [RequiredWithEscapedCharactersMap101000Builder](#requiredwithescapedcharactersmap101000builder) | fooReverseSolidusQuotationMarkBar(value: Boolean) | +| [RequiredWithEscapedCharactersMap101000Builder](#requiredwithescapedcharactersmap101000builder) | fooReverseSolidusQuotationMarkBar(value: String) | +| [RequiredWithEscapedCharactersMap101000Builder](#requiredwithescapedcharactersmap101000builder) | fooReverseSolidusQuotationMarkBar(value: Int) | +| [RequiredWithEscapedCharactersMap101000Builder](#requiredwithescapedcharactersmap101000builder) | fooReverseSolidusQuotationMarkBar(value: Float) | +| [RequiredWithEscapedCharactersMap101000Builder](#requiredwithescapedcharactersmap101000builder) | fooReverseSolidusQuotationMarkBar(value: Long) | +| [RequiredWithEscapedCharactersMap101000Builder](#requiredwithescapedcharactersmap101000builder) | fooReverseSolidusQuotationMarkBar(value: Double) | +| [RequiredWithEscapedCharactersMap101000Builder](#requiredwithescapedcharactersmap101000builder) | fooReverseSolidusQuotationMarkBar(value: List) | +| [RequiredWithEscapedCharactersMap101000Builder](#requiredwithescapedcharactersmap101000builder) | fooReverseSolidusQuotationMarkBar(value: Map) | + +## RequiredWithEscapedCharactersMap101011Builder +class RequiredWithEscapedCharactersMap101011Builder
+builder for `Map` + +A class that builds the Map input type + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| RequiredWithEscapedCharactersMap101011Builder(Map instance)
Creates a builder that contains the passed instance | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| [RequiredWithEscapedCharactersMap001011Builder](#requiredwithescapedcharactersmap001011builder) | fooReverseSolidusTbar(value: Nothing?) | +| [RequiredWithEscapedCharactersMap001011Builder](#requiredwithescapedcharactersmap001011builder) | fooReverseSolidusTbar(value: Boolean) | +| [RequiredWithEscapedCharactersMap001011Builder](#requiredwithescapedcharactersmap001011builder) | fooReverseSolidusTbar(value: String) | +| [RequiredWithEscapedCharactersMap001011Builder](#requiredwithescapedcharactersmap001011builder) | fooReverseSolidusTbar(value: Int) | +| [RequiredWithEscapedCharactersMap001011Builder](#requiredwithescapedcharactersmap001011builder) | fooReverseSolidusTbar(value: Float) | +| [RequiredWithEscapedCharactersMap001011Builder](#requiredwithescapedcharactersmap001011builder) | fooReverseSolidusTbar(value: Long) | +| [RequiredWithEscapedCharactersMap001011Builder](#requiredwithescapedcharactersmap001011builder) | fooReverseSolidusTbar(value: Double) | +| [RequiredWithEscapedCharactersMap001011Builder](#requiredwithescapedcharactersmap001011builder) | fooReverseSolidusTbar(value: List) | +| [RequiredWithEscapedCharactersMap001011Builder](#requiredwithescapedcharactersmap001011builder) | fooReverseSolidusTbar(value: Map) | +| [RequiredWithEscapedCharactersMap100011Builder](#requiredwithescapedcharactersmap100011builder) | fooReverseSolidusU000cbar(value: Nothing?) | +| [RequiredWithEscapedCharactersMap100011Builder](#requiredwithescapedcharactersmap100011builder) | fooReverseSolidusU000cbar(value: Boolean) | +| [RequiredWithEscapedCharactersMap100011Builder](#requiredwithescapedcharactersmap100011builder) | fooReverseSolidusU000cbar(value: String) | +| [RequiredWithEscapedCharactersMap100011Builder](#requiredwithescapedcharactersmap100011builder) | fooReverseSolidusU000cbar(value: Int) | +| [RequiredWithEscapedCharactersMap100011Builder](#requiredwithescapedcharactersmap100011builder) | fooReverseSolidusU000cbar(value: Float) | +| [RequiredWithEscapedCharactersMap100011Builder](#requiredwithescapedcharactersmap100011builder) | fooReverseSolidusU000cbar(value: Long) | +| [RequiredWithEscapedCharactersMap100011Builder](#requiredwithescapedcharactersmap100011builder) | fooReverseSolidusU000cbar(value: Double) | +| [RequiredWithEscapedCharactersMap100011Builder](#requiredwithescapedcharactersmap100011builder) | fooReverseSolidusU000cbar(value: List) | +| [RequiredWithEscapedCharactersMap100011Builder](#requiredwithescapedcharactersmap100011builder) | fooReverseSolidusU000cbar(value: Map) | +| [RequiredWithEscapedCharactersMap101001Builder](#requiredwithescapedcharactersmap101001builder) | fooReverseSolidusQuotationMarkBar(value: Nothing?) | +| [RequiredWithEscapedCharactersMap101001Builder](#requiredwithescapedcharactersmap101001builder) | fooReverseSolidusQuotationMarkBar(value: Boolean) | +| [RequiredWithEscapedCharactersMap101001Builder](#requiredwithescapedcharactersmap101001builder) | fooReverseSolidusQuotationMarkBar(value: String) | +| [RequiredWithEscapedCharactersMap101001Builder](#requiredwithescapedcharactersmap101001builder) | fooReverseSolidusQuotationMarkBar(value: Int) | +| [RequiredWithEscapedCharactersMap101001Builder](#requiredwithescapedcharactersmap101001builder) | fooReverseSolidusQuotationMarkBar(value: Float) | +| [RequiredWithEscapedCharactersMap101001Builder](#requiredwithescapedcharactersmap101001builder) | fooReverseSolidusQuotationMarkBar(value: Long) | +| [RequiredWithEscapedCharactersMap101001Builder](#requiredwithescapedcharactersmap101001builder) | fooReverseSolidusQuotationMarkBar(value: Double) | +| [RequiredWithEscapedCharactersMap101001Builder](#requiredwithescapedcharactersmap101001builder) | fooReverseSolidusQuotationMarkBar(value: List) | +| [RequiredWithEscapedCharactersMap101001Builder](#requiredwithescapedcharactersmap101001builder) | fooReverseSolidusQuotationMarkBar(value: Map) | +| [RequiredWithEscapedCharactersMap101010Builder](#requiredwithescapedcharactersmap101010builder) | fooReverseSolidusReverseSolidusBar(value: Nothing?) | +| [RequiredWithEscapedCharactersMap101010Builder](#requiredwithescapedcharactersmap101010builder) | fooReverseSolidusReverseSolidusBar(value: Boolean) | +| [RequiredWithEscapedCharactersMap101010Builder](#requiredwithescapedcharactersmap101010builder) | fooReverseSolidusReverseSolidusBar(value: String) | +| [RequiredWithEscapedCharactersMap101010Builder](#requiredwithescapedcharactersmap101010builder) | fooReverseSolidusReverseSolidusBar(value: Int) | +| [RequiredWithEscapedCharactersMap101010Builder](#requiredwithescapedcharactersmap101010builder) | fooReverseSolidusReverseSolidusBar(value: Float) | +| [RequiredWithEscapedCharactersMap101010Builder](#requiredwithescapedcharactersmap101010builder) | fooReverseSolidusReverseSolidusBar(value: Long) | +| [RequiredWithEscapedCharactersMap101010Builder](#requiredwithescapedcharactersmap101010builder) | fooReverseSolidusReverseSolidusBar(value: Double) | +| [RequiredWithEscapedCharactersMap101010Builder](#requiredwithescapedcharactersmap101010builder) | fooReverseSolidusReverseSolidusBar(value: List) | +| [RequiredWithEscapedCharactersMap101010Builder](#requiredwithescapedcharactersmap101010builder) | fooReverseSolidusReverseSolidusBar(value: Map) | + +## RequiredWithEscapedCharactersMap101100Builder +class RequiredWithEscapedCharactersMap101100Builder
+builder for `Map` + +A class that builds the Map input type + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| RequiredWithEscapedCharactersMap101100Builder(Map instance)
Creates a builder that contains the passed instance | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| [RequiredWithEscapedCharactersMap001100Builder](#requiredwithescapedcharactersmap001100builder) | fooReverseSolidusTbar(value: Nothing?) | +| [RequiredWithEscapedCharactersMap001100Builder](#requiredwithescapedcharactersmap001100builder) | fooReverseSolidusTbar(value: Boolean) | +| [RequiredWithEscapedCharactersMap001100Builder](#requiredwithescapedcharactersmap001100builder) | fooReverseSolidusTbar(value: String) | +| [RequiredWithEscapedCharactersMap001100Builder](#requiredwithescapedcharactersmap001100builder) | fooReverseSolidusTbar(value: Int) | +| [RequiredWithEscapedCharactersMap001100Builder](#requiredwithescapedcharactersmap001100builder) | fooReverseSolidusTbar(value: Float) | +| [RequiredWithEscapedCharactersMap001100Builder](#requiredwithescapedcharactersmap001100builder) | fooReverseSolidusTbar(value: Long) | +| [RequiredWithEscapedCharactersMap001100Builder](#requiredwithescapedcharactersmap001100builder) | fooReverseSolidusTbar(value: Double) | +| [RequiredWithEscapedCharactersMap001100Builder](#requiredwithescapedcharactersmap001100builder) | fooReverseSolidusTbar(value: List) | +| [RequiredWithEscapedCharactersMap001100Builder](#requiredwithescapedcharactersmap001100builder) | fooReverseSolidusTbar(value: Map) | +| [RequiredWithEscapedCharactersMap100100Builder](#requiredwithescapedcharactersmap100100builder) | fooReverseSolidusU000cbar(value: Nothing?) | +| [RequiredWithEscapedCharactersMap100100Builder](#requiredwithescapedcharactersmap100100builder) | fooReverseSolidusU000cbar(value: Boolean) | +| [RequiredWithEscapedCharactersMap100100Builder](#requiredwithescapedcharactersmap100100builder) | fooReverseSolidusU000cbar(value: String) | +| [RequiredWithEscapedCharactersMap100100Builder](#requiredwithescapedcharactersmap100100builder) | fooReverseSolidusU000cbar(value: Int) | +| [RequiredWithEscapedCharactersMap100100Builder](#requiredwithescapedcharactersmap100100builder) | fooReverseSolidusU000cbar(value: Float) | +| [RequiredWithEscapedCharactersMap100100Builder](#requiredwithescapedcharactersmap100100builder) | fooReverseSolidusU000cbar(value: Long) | +| [RequiredWithEscapedCharactersMap100100Builder](#requiredwithescapedcharactersmap100100builder) | fooReverseSolidusU000cbar(value: Double) | +| [RequiredWithEscapedCharactersMap100100Builder](#requiredwithescapedcharactersmap100100builder) | fooReverseSolidusU000cbar(value: List) | +| [RequiredWithEscapedCharactersMap100100Builder](#requiredwithescapedcharactersmap100100builder) | fooReverseSolidusU000cbar(value: Map) | +| [RequiredWithEscapedCharactersMap101000Builder](#requiredwithescapedcharactersmap101000builder) | fooReverseSolidusRbar(value: Nothing?) | +| [RequiredWithEscapedCharactersMap101000Builder](#requiredwithescapedcharactersmap101000builder) | fooReverseSolidusRbar(value: Boolean) | +| [RequiredWithEscapedCharactersMap101000Builder](#requiredwithescapedcharactersmap101000builder) | fooReverseSolidusRbar(value: String) | +| [RequiredWithEscapedCharactersMap101000Builder](#requiredwithescapedcharactersmap101000builder) | fooReverseSolidusRbar(value: Int) | +| [RequiredWithEscapedCharactersMap101000Builder](#requiredwithescapedcharactersmap101000builder) | fooReverseSolidusRbar(value: Float) | +| [RequiredWithEscapedCharactersMap101000Builder](#requiredwithescapedcharactersmap101000builder) | fooReverseSolidusRbar(value: Long) | +| [RequiredWithEscapedCharactersMap101000Builder](#requiredwithescapedcharactersmap101000builder) | fooReverseSolidusRbar(value: Double) | +| [RequiredWithEscapedCharactersMap101000Builder](#requiredwithescapedcharactersmap101000builder) | fooReverseSolidusRbar(value: List) | +| [RequiredWithEscapedCharactersMap101000Builder](#requiredwithescapedcharactersmap101000builder) | fooReverseSolidusRbar(value: Map) | + +## RequiredWithEscapedCharactersMap101101Builder +class RequiredWithEscapedCharactersMap101101Builder
+builder for `Map` + +A class that builds the Map input type + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| RequiredWithEscapedCharactersMap101101Builder(Map instance)
Creates a builder that contains the passed instance | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| [RequiredWithEscapedCharactersMap001101Builder](#requiredwithescapedcharactersmap001101builder) | fooReverseSolidusTbar(value: Nothing?) | +| [RequiredWithEscapedCharactersMap001101Builder](#requiredwithescapedcharactersmap001101builder) | fooReverseSolidusTbar(value: Boolean) | +| [RequiredWithEscapedCharactersMap001101Builder](#requiredwithescapedcharactersmap001101builder) | fooReverseSolidusTbar(value: String) | +| [RequiredWithEscapedCharactersMap001101Builder](#requiredwithescapedcharactersmap001101builder) | fooReverseSolidusTbar(value: Int) | +| [RequiredWithEscapedCharactersMap001101Builder](#requiredwithescapedcharactersmap001101builder) | fooReverseSolidusTbar(value: Float) | +| [RequiredWithEscapedCharactersMap001101Builder](#requiredwithescapedcharactersmap001101builder) | fooReverseSolidusTbar(value: Long) | +| [RequiredWithEscapedCharactersMap001101Builder](#requiredwithescapedcharactersmap001101builder) | fooReverseSolidusTbar(value: Double) | +| [RequiredWithEscapedCharactersMap001101Builder](#requiredwithescapedcharactersmap001101builder) | fooReverseSolidusTbar(value: List) | +| [RequiredWithEscapedCharactersMap001101Builder](#requiredwithescapedcharactersmap001101builder) | fooReverseSolidusTbar(value: Map) | +| [RequiredWithEscapedCharactersMap100101Builder](#requiredwithescapedcharactersmap100101builder) | fooReverseSolidusU000cbar(value: Nothing?) | +| [RequiredWithEscapedCharactersMap100101Builder](#requiredwithescapedcharactersmap100101builder) | fooReverseSolidusU000cbar(value: Boolean) | +| [RequiredWithEscapedCharactersMap100101Builder](#requiredwithescapedcharactersmap100101builder) | fooReverseSolidusU000cbar(value: String) | +| [RequiredWithEscapedCharactersMap100101Builder](#requiredwithescapedcharactersmap100101builder) | fooReverseSolidusU000cbar(value: Int) | +| [RequiredWithEscapedCharactersMap100101Builder](#requiredwithescapedcharactersmap100101builder) | fooReverseSolidusU000cbar(value: Float) | +| [RequiredWithEscapedCharactersMap100101Builder](#requiredwithescapedcharactersmap100101builder) | fooReverseSolidusU000cbar(value: Long) | +| [RequiredWithEscapedCharactersMap100101Builder](#requiredwithescapedcharactersmap100101builder) | fooReverseSolidusU000cbar(value: Double) | +| [RequiredWithEscapedCharactersMap100101Builder](#requiredwithescapedcharactersmap100101builder) | fooReverseSolidusU000cbar(value: List) | +| [RequiredWithEscapedCharactersMap100101Builder](#requiredwithescapedcharactersmap100101builder) | fooReverseSolidusU000cbar(value: Map) | +| [RequiredWithEscapedCharactersMap101001Builder](#requiredwithescapedcharactersmap101001builder) | fooReverseSolidusRbar(value: Nothing?) | +| [RequiredWithEscapedCharactersMap101001Builder](#requiredwithescapedcharactersmap101001builder) | fooReverseSolidusRbar(value: Boolean) | +| [RequiredWithEscapedCharactersMap101001Builder](#requiredwithescapedcharactersmap101001builder) | fooReverseSolidusRbar(value: String) | +| [RequiredWithEscapedCharactersMap101001Builder](#requiredwithescapedcharactersmap101001builder) | fooReverseSolidusRbar(value: Int) | +| [RequiredWithEscapedCharactersMap101001Builder](#requiredwithescapedcharactersmap101001builder) | fooReverseSolidusRbar(value: Float) | +| [RequiredWithEscapedCharactersMap101001Builder](#requiredwithescapedcharactersmap101001builder) | fooReverseSolidusRbar(value: Long) | +| [RequiredWithEscapedCharactersMap101001Builder](#requiredwithescapedcharactersmap101001builder) | fooReverseSolidusRbar(value: Double) | +| [RequiredWithEscapedCharactersMap101001Builder](#requiredwithescapedcharactersmap101001builder) | fooReverseSolidusRbar(value: List) | +| [RequiredWithEscapedCharactersMap101001Builder](#requiredwithescapedcharactersmap101001builder) | fooReverseSolidusRbar(value: Map) | +| [RequiredWithEscapedCharactersMap101100Builder](#requiredwithescapedcharactersmap101100builder) | fooReverseSolidusReverseSolidusBar(value: Nothing?) | +| [RequiredWithEscapedCharactersMap101100Builder](#requiredwithescapedcharactersmap101100builder) | fooReverseSolidusReverseSolidusBar(value: Boolean) | +| [RequiredWithEscapedCharactersMap101100Builder](#requiredwithescapedcharactersmap101100builder) | fooReverseSolidusReverseSolidusBar(value: String) | +| [RequiredWithEscapedCharactersMap101100Builder](#requiredwithescapedcharactersmap101100builder) | fooReverseSolidusReverseSolidusBar(value: Int) | +| [RequiredWithEscapedCharactersMap101100Builder](#requiredwithescapedcharactersmap101100builder) | fooReverseSolidusReverseSolidusBar(value: Float) | +| [RequiredWithEscapedCharactersMap101100Builder](#requiredwithescapedcharactersmap101100builder) | fooReverseSolidusReverseSolidusBar(value: Long) | +| [RequiredWithEscapedCharactersMap101100Builder](#requiredwithescapedcharactersmap101100builder) | fooReverseSolidusReverseSolidusBar(value: Double) | +| [RequiredWithEscapedCharactersMap101100Builder](#requiredwithescapedcharactersmap101100builder) | fooReverseSolidusReverseSolidusBar(value: List) | +| [RequiredWithEscapedCharactersMap101100Builder](#requiredwithescapedcharactersmap101100builder) | fooReverseSolidusReverseSolidusBar(value: Map) | + +## RequiredWithEscapedCharactersMap101110Builder +class RequiredWithEscapedCharactersMap101110Builder
+builder for `Map` + +A class that builds the Map input type + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| RequiredWithEscapedCharactersMap101110Builder(Map instance)
Creates a builder that contains the passed instance | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| [RequiredWithEscapedCharactersMap001110Builder](#requiredwithescapedcharactersmap001110builder) | fooReverseSolidusTbar(value: Nothing?) | +| [RequiredWithEscapedCharactersMap001110Builder](#requiredwithescapedcharactersmap001110builder) | fooReverseSolidusTbar(value: Boolean) | +| [RequiredWithEscapedCharactersMap001110Builder](#requiredwithescapedcharactersmap001110builder) | fooReverseSolidusTbar(value: String) | +| [RequiredWithEscapedCharactersMap001110Builder](#requiredwithescapedcharactersmap001110builder) | fooReverseSolidusTbar(value: Int) | +| [RequiredWithEscapedCharactersMap001110Builder](#requiredwithescapedcharactersmap001110builder) | fooReverseSolidusTbar(value: Float) | +| [RequiredWithEscapedCharactersMap001110Builder](#requiredwithescapedcharactersmap001110builder) | fooReverseSolidusTbar(value: Long) | +| [RequiredWithEscapedCharactersMap001110Builder](#requiredwithescapedcharactersmap001110builder) | fooReverseSolidusTbar(value: Double) | +| [RequiredWithEscapedCharactersMap001110Builder](#requiredwithescapedcharactersmap001110builder) | fooReverseSolidusTbar(value: List) | +| [RequiredWithEscapedCharactersMap001110Builder](#requiredwithescapedcharactersmap001110builder) | fooReverseSolidusTbar(value: Map) | +| [RequiredWithEscapedCharactersMap100110Builder](#requiredwithescapedcharactersmap100110builder) | fooReverseSolidusU000cbar(value: Nothing?) | +| [RequiredWithEscapedCharactersMap100110Builder](#requiredwithescapedcharactersmap100110builder) | fooReverseSolidusU000cbar(value: Boolean) | +| [RequiredWithEscapedCharactersMap100110Builder](#requiredwithescapedcharactersmap100110builder) | fooReverseSolidusU000cbar(value: String) | +| [RequiredWithEscapedCharactersMap100110Builder](#requiredwithescapedcharactersmap100110builder) | fooReverseSolidusU000cbar(value: Int) | +| [RequiredWithEscapedCharactersMap100110Builder](#requiredwithescapedcharactersmap100110builder) | fooReverseSolidusU000cbar(value: Float) | +| [RequiredWithEscapedCharactersMap100110Builder](#requiredwithescapedcharactersmap100110builder) | fooReverseSolidusU000cbar(value: Long) | +| [RequiredWithEscapedCharactersMap100110Builder](#requiredwithescapedcharactersmap100110builder) | fooReverseSolidusU000cbar(value: Double) | +| [RequiredWithEscapedCharactersMap100110Builder](#requiredwithescapedcharactersmap100110builder) | fooReverseSolidusU000cbar(value: List) | +| [RequiredWithEscapedCharactersMap100110Builder](#requiredwithescapedcharactersmap100110builder) | fooReverseSolidusU000cbar(value: Map) | +| [RequiredWithEscapedCharactersMap101010Builder](#requiredwithescapedcharactersmap101010builder) | fooReverseSolidusRbar(value: Nothing?) | +| [RequiredWithEscapedCharactersMap101010Builder](#requiredwithescapedcharactersmap101010builder) | fooReverseSolidusRbar(value: Boolean) | +| [RequiredWithEscapedCharactersMap101010Builder](#requiredwithescapedcharactersmap101010builder) | fooReverseSolidusRbar(value: String) | +| [RequiredWithEscapedCharactersMap101010Builder](#requiredwithescapedcharactersmap101010builder) | fooReverseSolidusRbar(value: Int) | +| [RequiredWithEscapedCharactersMap101010Builder](#requiredwithescapedcharactersmap101010builder) | fooReverseSolidusRbar(value: Float) | +| [RequiredWithEscapedCharactersMap101010Builder](#requiredwithescapedcharactersmap101010builder) | fooReverseSolidusRbar(value: Long) | +| [RequiredWithEscapedCharactersMap101010Builder](#requiredwithescapedcharactersmap101010builder) | fooReverseSolidusRbar(value: Double) | +| [RequiredWithEscapedCharactersMap101010Builder](#requiredwithescapedcharactersmap101010builder) | fooReverseSolidusRbar(value: List) | +| [RequiredWithEscapedCharactersMap101010Builder](#requiredwithescapedcharactersmap101010builder) | fooReverseSolidusRbar(value: Map) | +| [RequiredWithEscapedCharactersMap101100Builder](#requiredwithescapedcharactersmap101100builder) | fooReverseSolidusQuotationMarkBar(value: Nothing?) | +| [RequiredWithEscapedCharactersMap101100Builder](#requiredwithescapedcharactersmap101100builder) | fooReverseSolidusQuotationMarkBar(value: Boolean) | +| [RequiredWithEscapedCharactersMap101100Builder](#requiredwithescapedcharactersmap101100builder) | fooReverseSolidusQuotationMarkBar(value: String) | +| [RequiredWithEscapedCharactersMap101100Builder](#requiredwithescapedcharactersmap101100builder) | fooReverseSolidusQuotationMarkBar(value: Int) | +| [RequiredWithEscapedCharactersMap101100Builder](#requiredwithescapedcharactersmap101100builder) | fooReverseSolidusQuotationMarkBar(value: Float) | +| [RequiredWithEscapedCharactersMap101100Builder](#requiredwithescapedcharactersmap101100builder) | fooReverseSolidusQuotationMarkBar(value: Long) | +| [RequiredWithEscapedCharactersMap101100Builder](#requiredwithescapedcharactersmap101100builder) | fooReverseSolidusQuotationMarkBar(value: Double) | +| [RequiredWithEscapedCharactersMap101100Builder](#requiredwithescapedcharactersmap101100builder) | fooReverseSolidusQuotationMarkBar(value: List) | +| [RequiredWithEscapedCharactersMap101100Builder](#requiredwithescapedcharactersmap101100builder) | fooReverseSolidusQuotationMarkBar(value: Map) | + +## RequiredWithEscapedCharactersMap101111Builder +class RequiredWithEscapedCharactersMap101111Builder
+builder for `Map` + +A class that builds the Map input type + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| RequiredWithEscapedCharactersMap101111Builder(Map instance)
Creates a builder that contains the passed instance | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| [RequiredWithEscapedCharactersMap001111Builder](#requiredwithescapedcharactersmap001111builder) | fooReverseSolidusTbar(value: Nothing?) | +| [RequiredWithEscapedCharactersMap001111Builder](#requiredwithescapedcharactersmap001111builder) | fooReverseSolidusTbar(value: Boolean) | +| [RequiredWithEscapedCharactersMap001111Builder](#requiredwithescapedcharactersmap001111builder) | fooReverseSolidusTbar(value: String) | +| [RequiredWithEscapedCharactersMap001111Builder](#requiredwithescapedcharactersmap001111builder) | fooReverseSolidusTbar(value: Int) | +| [RequiredWithEscapedCharactersMap001111Builder](#requiredwithescapedcharactersmap001111builder) | fooReverseSolidusTbar(value: Float) | +| [RequiredWithEscapedCharactersMap001111Builder](#requiredwithescapedcharactersmap001111builder) | fooReverseSolidusTbar(value: Long) | +| [RequiredWithEscapedCharactersMap001111Builder](#requiredwithescapedcharactersmap001111builder) | fooReverseSolidusTbar(value: Double) | +| [RequiredWithEscapedCharactersMap001111Builder](#requiredwithescapedcharactersmap001111builder) | fooReverseSolidusTbar(value: List) | +| [RequiredWithEscapedCharactersMap001111Builder](#requiredwithescapedcharactersmap001111builder) | fooReverseSolidusTbar(value: Map) | +| [RequiredWithEscapedCharactersMap100111Builder](#requiredwithescapedcharactersmap100111builder) | fooReverseSolidusU000cbar(value: Nothing?) | +| [RequiredWithEscapedCharactersMap100111Builder](#requiredwithescapedcharactersmap100111builder) | fooReverseSolidusU000cbar(value: Boolean) | +| [RequiredWithEscapedCharactersMap100111Builder](#requiredwithescapedcharactersmap100111builder) | fooReverseSolidusU000cbar(value: String) | +| [RequiredWithEscapedCharactersMap100111Builder](#requiredwithescapedcharactersmap100111builder) | fooReverseSolidusU000cbar(value: Int) | +| [RequiredWithEscapedCharactersMap100111Builder](#requiredwithescapedcharactersmap100111builder) | fooReverseSolidusU000cbar(value: Float) | +| [RequiredWithEscapedCharactersMap100111Builder](#requiredwithescapedcharactersmap100111builder) | fooReverseSolidusU000cbar(value: Long) | +| [RequiredWithEscapedCharactersMap100111Builder](#requiredwithescapedcharactersmap100111builder) | fooReverseSolidusU000cbar(value: Double) | +| [RequiredWithEscapedCharactersMap100111Builder](#requiredwithescapedcharactersmap100111builder) | fooReverseSolidusU000cbar(value: List) | +| [RequiredWithEscapedCharactersMap100111Builder](#requiredwithescapedcharactersmap100111builder) | fooReverseSolidusU000cbar(value: Map) | +| [RequiredWithEscapedCharactersMap101011Builder](#requiredwithescapedcharactersmap101011builder) | fooReverseSolidusRbar(value: Nothing?) | +| [RequiredWithEscapedCharactersMap101011Builder](#requiredwithescapedcharactersmap101011builder) | fooReverseSolidusRbar(value: Boolean) | +| [RequiredWithEscapedCharactersMap101011Builder](#requiredwithescapedcharactersmap101011builder) | fooReverseSolidusRbar(value: String) | +| [RequiredWithEscapedCharactersMap101011Builder](#requiredwithescapedcharactersmap101011builder) | fooReverseSolidusRbar(value: Int) | +| [RequiredWithEscapedCharactersMap101011Builder](#requiredwithescapedcharactersmap101011builder) | fooReverseSolidusRbar(value: Float) | +| [RequiredWithEscapedCharactersMap101011Builder](#requiredwithescapedcharactersmap101011builder) | fooReverseSolidusRbar(value: Long) | +| [RequiredWithEscapedCharactersMap101011Builder](#requiredwithescapedcharactersmap101011builder) | fooReverseSolidusRbar(value: Double) | +| [RequiredWithEscapedCharactersMap101011Builder](#requiredwithescapedcharactersmap101011builder) | fooReverseSolidusRbar(value: List) | +| [RequiredWithEscapedCharactersMap101011Builder](#requiredwithescapedcharactersmap101011builder) | fooReverseSolidusRbar(value: Map) | +| [RequiredWithEscapedCharactersMap101101Builder](#requiredwithescapedcharactersmap101101builder) | fooReverseSolidusQuotationMarkBar(value: Nothing?) | +| [RequiredWithEscapedCharactersMap101101Builder](#requiredwithescapedcharactersmap101101builder) | fooReverseSolidusQuotationMarkBar(value: Boolean) | +| [RequiredWithEscapedCharactersMap101101Builder](#requiredwithescapedcharactersmap101101builder) | fooReverseSolidusQuotationMarkBar(value: String) | +| [RequiredWithEscapedCharactersMap101101Builder](#requiredwithescapedcharactersmap101101builder) | fooReverseSolidusQuotationMarkBar(value: Int) | +| [RequiredWithEscapedCharactersMap101101Builder](#requiredwithescapedcharactersmap101101builder) | fooReverseSolidusQuotationMarkBar(value: Float) | +| [RequiredWithEscapedCharactersMap101101Builder](#requiredwithescapedcharactersmap101101builder) | fooReverseSolidusQuotationMarkBar(value: Long) | +| [RequiredWithEscapedCharactersMap101101Builder](#requiredwithescapedcharactersmap101101builder) | fooReverseSolidusQuotationMarkBar(value: Double) | +| [RequiredWithEscapedCharactersMap101101Builder](#requiredwithescapedcharactersmap101101builder) | fooReverseSolidusQuotationMarkBar(value: List) | +| [RequiredWithEscapedCharactersMap101101Builder](#requiredwithescapedcharactersmap101101builder) | fooReverseSolidusQuotationMarkBar(value: Map) | +| [RequiredWithEscapedCharactersMap101110Builder](#requiredwithescapedcharactersmap101110builder) | fooReverseSolidusReverseSolidusBar(value: Nothing?) | +| [RequiredWithEscapedCharactersMap101110Builder](#requiredwithescapedcharactersmap101110builder) | fooReverseSolidusReverseSolidusBar(value: Boolean) | +| [RequiredWithEscapedCharactersMap101110Builder](#requiredwithescapedcharactersmap101110builder) | fooReverseSolidusReverseSolidusBar(value: String) | +| [RequiredWithEscapedCharactersMap101110Builder](#requiredwithescapedcharactersmap101110builder) | fooReverseSolidusReverseSolidusBar(value: Int) | +| [RequiredWithEscapedCharactersMap101110Builder](#requiredwithescapedcharactersmap101110builder) | fooReverseSolidusReverseSolidusBar(value: Float) | +| [RequiredWithEscapedCharactersMap101110Builder](#requiredwithescapedcharactersmap101110builder) | fooReverseSolidusReverseSolidusBar(value: Long) | +| [RequiredWithEscapedCharactersMap101110Builder](#requiredwithescapedcharactersmap101110builder) | fooReverseSolidusReverseSolidusBar(value: Double) | +| [RequiredWithEscapedCharactersMap101110Builder](#requiredwithescapedcharactersmap101110builder) | fooReverseSolidusReverseSolidusBar(value: List) | +| [RequiredWithEscapedCharactersMap101110Builder](#requiredwithescapedcharactersmap101110builder) | fooReverseSolidusReverseSolidusBar(value: Map) | + +## RequiredWithEscapedCharactersMap110000Builder +class RequiredWithEscapedCharactersMap110000Builder
+builder for `Map` + +A class that builds the Map input type + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| RequiredWithEscapedCharactersMap110000Builder(Map instance)
Creates a builder that contains the passed instance | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| [RequiredWithEscapedCharactersMap010000Builder](#requiredwithescapedcharactersmap010000builder) | fooReverseSolidusTbar(value: Nothing?) | +| [RequiredWithEscapedCharactersMap010000Builder](#requiredwithescapedcharactersmap010000builder) | fooReverseSolidusTbar(value: Boolean) | +| [RequiredWithEscapedCharactersMap010000Builder](#requiredwithescapedcharactersmap010000builder) | fooReverseSolidusTbar(value: String) | +| [RequiredWithEscapedCharactersMap010000Builder](#requiredwithescapedcharactersmap010000builder) | fooReverseSolidusTbar(value: Int) | +| [RequiredWithEscapedCharactersMap010000Builder](#requiredwithescapedcharactersmap010000builder) | fooReverseSolidusTbar(value: Float) | +| [RequiredWithEscapedCharactersMap010000Builder](#requiredwithescapedcharactersmap010000builder) | fooReverseSolidusTbar(value: Long) | +| [RequiredWithEscapedCharactersMap010000Builder](#requiredwithescapedcharactersmap010000builder) | fooReverseSolidusTbar(value: Double) | +| [RequiredWithEscapedCharactersMap010000Builder](#requiredwithescapedcharactersmap010000builder) | fooReverseSolidusTbar(value: List) | +| [RequiredWithEscapedCharactersMap010000Builder](#requiredwithescapedcharactersmap010000builder) | fooReverseSolidusTbar(value: Map) | +| [RequiredWithEscapedCharactersMap100000Builder](#requiredwithescapedcharactersmap100000builder) | fooReverseSolidusNbar(value: Nothing?) | +| [RequiredWithEscapedCharactersMap100000Builder](#requiredwithescapedcharactersmap100000builder) | fooReverseSolidusNbar(value: Boolean) | +| [RequiredWithEscapedCharactersMap100000Builder](#requiredwithescapedcharactersmap100000builder) | fooReverseSolidusNbar(value: String) | +| [RequiredWithEscapedCharactersMap100000Builder](#requiredwithescapedcharactersmap100000builder) | fooReverseSolidusNbar(value: Int) | +| [RequiredWithEscapedCharactersMap100000Builder](#requiredwithescapedcharactersmap100000builder) | fooReverseSolidusNbar(value: Float) | +| [RequiredWithEscapedCharactersMap100000Builder](#requiredwithescapedcharactersmap100000builder) | fooReverseSolidusNbar(value: Long) | +| [RequiredWithEscapedCharactersMap100000Builder](#requiredwithescapedcharactersmap100000builder) | fooReverseSolidusNbar(value: Double) | +| [RequiredWithEscapedCharactersMap100000Builder](#requiredwithescapedcharactersmap100000builder) | fooReverseSolidusNbar(value: List) | +| [RequiredWithEscapedCharactersMap100000Builder](#requiredwithescapedcharactersmap100000builder) | fooReverseSolidusNbar(value: Map) | + +## RequiredWithEscapedCharactersMap110001Builder +class RequiredWithEscapedCharactersMap110001Builder
+builder for `Map` + +A class that builds the Map input type + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| RequiredWithEscapedCharactersMap110001Builder(Map instance)
Creates a builder that contains the passed instance | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| [RequiredWithEscapedCharactersMap010001Builder](#requiredwithescapedcharactersmap010001builder) | fooReverseSolidusTbar(value: Nothing?) | +| [RequiredWithEscapedCharactersMap010001Builder](#requiredwithescapedcharactersmap010001builder) | fooReverseSolidusTbar(value: Boolean) | +| [RequiredWithEscapedCharactersMap010001Builder](#requiredwithescapedcharactersmap010001builder) | fooReverseSolidusTbar(value: String) | +| [RequiredWithEscapedCharactersMap010001Builder](#requiredwithescapedcharactersmap010001builder) | fooReverseSolidusTbar(value: Int) | +| [RequiredWithEscapedCharactersMap010001Builder](#requiredwithescapedcharactersmap010001builder) | fooReverseSolidusTbar(value: Float) | +| [RequiredWithEscapedCharactersMap010001Builder](#requiredwithescapedcharactersmap010001builder) | fooReverseSolidusTbar(value: Long) | +| [RequiredWithEscapedCharactersMap010001Builder](#requiredwithescapedcharactersmap010001builder) | fooReverseSolidusTbar(value: Double) | +| [RequiredWithEscapedCharactersMap010001Builder](#requiredwithescapedcharactersmap010001builder) | fooReverseSolidusTbar(value: List) | +| [RequiredWithEscapedCharactersMap010001Builder](#requiredwithescapedcharactersmap010001builder) | fooReverseSolidusTbar(value: Map) | +| [RequiredWithEscapedCharactersMap100001Builder](#requiredwithescapedcharactersmap100001builder) | fooReverseSolidusNbar(value: Nothing?) | +| [RequiredWithEscapedCharactersMap100001Builder](#requiredwithescapedcharactersmap100001builder) | fooReverseSolidusNbar(value: Boolean) | +| [RequiredWithEscapedCharactersMap100001Builder](#requiredwithescapedcharactersmap100001builder) | fooReverseSolidusNbar(value: String) | +| [RequiredWithEscapedCharactersMap100001Builder](#requiredwithescapedcharactersmap100001builder) | fooReverseSolidusNbar(value: Int) | +| [RequiredWithEscapedCharactersMap100001Builder](#requiredwithescapedcharactersmap100001builder) | fooReverseSolidusNbar(value: Float) | +| [RequiredWithEscapedCharactersMap100001Builder](#requiredwithescapedcharactersmap100001builder) | fooReverseSolidusNbar(value: Long) | +| [RequiredWithEscapedCharactersMap100001Builder](#requiredwithescapedcharactersmap100001builder) | fooReverseSolidusNbar(value: Double) | +| [RequiredWithEscapedCharactersMap100001Builder](#requiredwithescapedcharactersmap100001builder) | fooReverseSolidusNbar(value: List) | +| [RequiredWithEscapedCharactersMap100001Builder](#requiredwithescapedcharactersmap100001builder) | fooReverseSolidusNbar(value: Map) | +| [RequiredWithEscapedCharactersMap110000Builder](#requiredwithescapedcharactersmap110000builder) | fooReverseSolidusReverseSolidusBar(value: Nothing?) | +| [RequiredWithEscapedCharactersMap110000Builder](#requiredwithescapedcharactersmap110000builder) | fooReverseSolidusReverseSolidusBar(value: Boolean) | +| [RequiredWithEscapedCharactersMap110000Builder](#requiredwithescapedcharactersmap110000builder) | fooReverseSolidusReverseSolidusBar(value: String) | +| [RequiredWithEscapedCharactersMap110000Builder](#requiredwithescapedcharactersmap110000builder) | fooReverseSolidusReverseSolidusBar(value: Int) | +| [RequiredWithEscapedCharactersMap110000Builder](#requiredwithescapedcharactersmap110000builder) | fooReverseSolidusReverseSolidusBar(value: Float) | +| [RequiredWithEscapedCharactersMap110000Builder](#requiredwithescapedcharactersmap110000builder) | fooReverseSolidusReverseSolidusBar(value: Long) | +| [RequiredWithEscapedCharactersMap110000Builder](#requiredwithescapedcharactersmap110000builder) | fooReverseSolidusReverseSolidusBar(value: Double) | +| [RequiredWithEscapedCharactersMap110000Builder](#requiredwithescapedcharactersmap110000builder) | fooReverseSolidusReverseSolidusBar(value: List) | +| [RequiredWithEscapedCharactersMap110000Builder](#requiredwithescapedcharactersmap110000builder) | fooReverseSolidusReverseSolidusBar(value: Map) | + +## RequiredWithEscapedCharactersMap110010Builder +class RequiredWithEscapedCharactersMap110010Builder
+builder for `Map` + +A class that builds the Map input type + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| RequiredWithEscapedCharactersMap110010Builder(Map instance)
Creates a builder that contains the passed instance | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| [RequiredWithEscapedCharactersMap010010Builder](#requiredwithescapedcharactersmap010010builder) | fooReverseSolidusTbar(value: Nothing?) | +| [RequiredWithEscapedCharactersMap010010Builder](#requiredwithescapedcharactersmap010010builder) | fooReverseSolidusTbar(value: Boolean) | +| [RequiredWithEscapedCharactersMap010010Builder](#requiredwithescapedcharactersmap010010builder) | fooReverseSolidusTbar(value: String) | +| [RequiredWithEscapedCharactersMap010010Builder](#requiredwithescapedcharactersmap010010builder) | fooReverseSolidusTbar(value: Int) | +| [RequiredWithEscapedCharactersMap010010Builder](#requiredwithescapedcharactersmap010010builder) | fooReverseSolidusTbar(value: Float) | +| [RequiredWithEscapedCharactersMap010010Builder](#requiredwithescapedcharactersmap010010builder) | fooReverseSolidusTbar(value: Long) | +| [RequiredWithEscapedCharactersMap010010Builder](#requiredwithescapedcharactersmap010010builder) | fooReverseSolidusTbar(value: Double) | +| [RequiredWithEscapedCharactersMap010010Builder](#requiredwithescapedcharactersmap010010builder) | fooReverseSolidusTbar(value: List) | +| [RequiredWithEscapedCharactersMap010010Builder](#requiredwithescapedcharactersmap010010builder) | fooReverseSolidusTbar(value: Map) | +| [RequiredWithEscapedCharactersMap100010Builder](#requiredwithescapedcharactersmap100010builder) | fooReverseSolidusNbar(value: Nothing?) | +| [RequiredWithEscapedCharactersMap100010Builder](#requiredwithescapedcharactersmap100010builder) | fooReverseSolidusNbar(value: Boolean) | +| [RequiredWithEscapedCharactersMap100010Builder](#requiredwithescapedcharactersmap100010builder) | fooReverseSolidusNbar(value: String) | +| [RequiredWithEscapedCharactersMap100010Builder](#requiredwithescapedcharactersmap100010builder) | fooReverseSolidusNbar(value: Int) | +| [RequiredWithEscapedCharactersMap100010Builder](#requiredwithescapedcharactersmap100010builder) | fooReverseSolidusNbar(value: Float) | +| [RequiredWithEscapedCharactersMap100010Builder](#requiredwithescapedcharactersmap100010builder) | fooReverseSolidusNbar(value: Long) | +| [RequiredWithEscapedCharactersMap100010Builder](#requiredwithescapedcharactersmap100010builder) | fooReverseSolidusNbar(value: Double) | +| [RequiredWithEscapedCharactersMap100010Builder](#requiredwithescapedcharactersmap100010builder) | fooReverseSolidusNbar(value: List) | +| [RequiredWithEscapedCharactersMap100010Builder](#requiredwithescapedcharactersmap100010builder) | fooReverseSolidusNbar(value: Map) | +| [RequiredWithEscapedCharactersMap110000Builder](#requiredwithescapedcharactersmap110000builder) | fooReverseSolidusQuotationMarkBar(value: Nothing?) | +| [RequiredWithEscapedCharactersMap110000Builder](#requiredwithescapedcharactersmap110000builder) | fooReverseSolidusQuotationMarkBar(value: Boolean) | +| [RequiredWithEscapedCharactersMap110000Builder](#requiredwithescapedcharactersmap110000builder) | fooReverseSolidusQuotationMarkBar(value: String) | +| [RequiredWithEscapedCharactersMap110000Builder](#requiredwithescapedcharactersmap110000builder) | fooReverseSolidusQuotationMarkBar(value: Int) | +| [RequiredWithEscapedCharactersMap110000Builder](#requiredwithescapedcharactersmap110000builder) | fooReverseSolidusQuotationMarkBar(value: Float) | +| [RequiredWithEscapedCharactersMap110000Builder](#requiredwithescapedcharactersmap110000builder) | fooReverseSolidusQuotationMarkBar(value: Long) | +| [RequiredWithEscapedCharactersMap110000Builder](#requiredwithescapedcharactersmap110000builder) | fooReverseSolidusQuotationMarkBar(value: Double) | +| [RequiredWithEscapedCharactersMap110000Builder](#requiredwithescapedcharactersmap110000builder) | fooReverseSolidusQuotationMarkBar(value: List) | +| [RequiredWithEscapedCharactersMap110000Builder](#requiredwithescapedcharactersmap110000builder) | fooReverseSolidusQuotationMarkBar(value: Map) | + +## RequiredWithEscapedCharactersMap110011Builder +class RequiredWithEscapedCharactersMap110011Builder
+builder for `Map` + +A class that builds the Map input type + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| RequiredWithEscapedCharactersMap110011Builder(Map instance)
Creates a builder that contains the passed instance | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| [RequiredWithEscapedCharactersMap010011Builder](#requiredwithescapedcharactersmap010011builder) | fooReverseSolidusTbar(value: Nothing?) | +| [RequiredWithEscapedCharactersMap010011Builder](#requiredwithescapedcharactersmap010011builder) | fooReverseSolidusTbar(value: Boolean) | +| [RequiredWithEscapedCharactersMap010011Builder](#requiredwithescapedcharactersmap010011builder) | fooReverseSolidusTbar(value: String) | +| [RequiredWithEscapedCharactersMap010011Builder](#requiredwithescapedcharactersmap010011builder) | fooReverseSolidusTbar(value: Int) | +| [RequiredWithEscapedCharactersMap010011Builder](#requiredwithescapedcharactersmap010011builder) | fooReverseSolidusTbar(value: Float) | +| [RequiredWithEscapedCharactersMap010011Builder](#requiredwithescapedcharactersmap010011builder) | fooReverseSolidusTbar(value: Long) | +| [RequiredWithEscapedCharactersMap010011Builder](#requiredwithescapedcharactersmap010011builder) | fooReverseSolidusTbar(value: Double) | +| [RequiredWithEscapedCharactersMap010011Builder](#requiredwithescapedcharactersmap010011builder) | fooReverseSolidusTbar(value: List) | +| [RequiredWithEscapedCharactersMap010011Builder](#requiredwithescapedcharactersmap010011builder) | fooReverseSolidusTbar(value: Map) | +| [RequiredWithEscapedCharactersMap100011Builder](#requiredwithescapedcharactersmap100011builder) | fooReverseSolidusNbar(value: Nothing?) | +| [RequiredWithEscapedCharactersMap100011Builder](#requiredwithescapedcharactersmap100011builder) | fooReverseSolidusNbar(value: Boolean) | +| [RequiredWithEscapedCharactersMap100011Builder](#requiredwithescapedcharactersmap100011builder) | fooReverseSolidusNbar(value: String) | +| [RequiredWithEscapedCharactersMap100011Builder](#requiredwithescapedcharactersmap100011builder) | fooReverseSolidusNbar(value: Int) | +| [RequiredWithEscapedCharactersMap100011Builder](#requiredwithescapedcharactersmap100011builder) | fooReverseSolidusNbar(value: Float) | +| [RequiredWithEscapedCharactersMap100011Builder](#requiredwithescapedcharactersmap100011builder) | fooReverseSolidusNbar(value: Long) | +| [RequiredWithEscapedCharactersMap100011Builder](#requiredwithescapedcharactersmap100011builder) | fooReverseSolidusNbar(value: Double) | +| [RequiredWithEscapedCharactersMap100011Builder](#requiredwithescapedcharactersmap100011builder) | fooReverseSolidusNbar(value: List) | +| [RequiredWithEscapedCharactersMap100011Builder](#requiredwithescapedcharactersmap100011builder) | fooReverseSolidusNbar(value: Map) | +| [RequiredWithEscapedCharactersMap110001Builder](#requiredwithescapedcharactersmap110001builder) | fooReverseSolidusQuotationMarkBar(value: Nothing?) | +| [RequiredWithEscapedCharactersMap110001Builder](#requiredwithescapedcharactersmap110001builder) | fooReverseSolidusQuotationMarkBar(value: Boolean) | +| [RequiredWithEscapedCharactersMap110001Builder](#requiredwithescapedcharactersmap110001builder) | fooReverseSolidusQuotationMarkBar(value: String) | +| [RequiredWithEscapedCharactersMap110001Builder](#requiredwithescapedcharactersmap110001builder) | fooReverseSolidusQuotationMarkBar(value: Int) | +| [RequiredWithEscapedCharactersMap110001Builder](#requiredwithescapedcharactersmap110001builder) | fooReverseSolidusQuotationMarkBar(value: Float) | +| [RequiredWithEscapedCharactersMap110001Builder](#requiredwithescapedcharactersmap110001builder) | fooReverseSolidusQuotationMarkBar(value: Long) | +| [RequiredWithEscapedCharactersMap110001Builder](#requiredwithescapedcharactersmap110001builder) | fooReverseSolidusQuotationMarkBar(value: Double) | +| [RequiredWithEscapedCharactersMap110001Builder](#requiredwithescapedcharactersmap110001builder) | fooReverseSolidusQuotationMarkBar(value: List) | +| [RequiredWithEscapedCharactersMap110001Builder](#requiredwithescapedcharactersmap110001builder) | fooReverseSolidusQuotationMarkBar(value: Map) | +| [RequiredWithEscapedCharactersMap110010Builder](#requiredwithescapedcharactersmap110010builder) | fooReverseSolidusReverseSolidusBar(value: Nothing?) | +| [RequiredWithEscapedCharactersMap110010Builder](#requiredwithescapedcharactersmap110010builder) | fooReverseSolidusReverseSolidusBar(value: Boolean) | +| [RequiredWithEscapedCharactersMap110010Builder](#requiredwithescapedcharactersmap110010builder) | fooReverseSolidusReverseSolidusBar(value: String) | +| [RequiredWithEscapedCharactersMap110010Builder](#requiredwithescapedcharactersmap110010builder) | fooReverseSolidusReverseSolidusBar(value: Int) | +| [RequiredWithEscapedCharactersMap110010Builder](#requiredwithescapedcharactersmap110010builder) | fooReverseSolidusReverseSolidusBar(value: Float) | +| [RequiredWithEscapedCharactersMap110010Builder](#requiredwithescapedcharactersmap110010builder) | fooReverseSolidusReverseSolidusBar(value: Long) | +| [RequiredWithEscapedCharactersMap110010Builder](#requiredwithescapedcharactersmap110010builder) | fooReverseSolidusReverseSolidusBar(value: Double) | +| [RequiredWithEscapedCharactersMap110010Builder](#requiredwithescapedcharactersmap110010builder) | fooReverseSolidusReverseSolidusBar(value: List) | +| [RequiredWithEscapedCharactersMap110010Builder](#requiredwithescapedcharactersmap110010builder) | fooReverseSolidusReverseSolidusBar(value: Map) | + +## RequiredWithEscapedCharactersMap110100Builder +class RequiredWithEscapedCharactersMap110100Builder
+builder for `Map` + +A class that builds the Map input type + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| RequiredWithEscapedCharactersMap110100Builder(Map instance)
Creates a builder that contains the passed instance | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| [RequiredWithEscapedCharactersMap010100Builder](#requiredwithescapedcharactersmap010100builder) | fooReverseSolidusTbar(value: Nothing?) | +| [RequiredWithEscapedCharactersMap010100Builder](#requiredwithescapedcharactersmap010100builder) | fooReverseSolidusTbar(value: Boolean) | +| [RequiredWithEscapedCharactersMap010100Builder](#requiredwithescapedcharactersmap010100builder) | fooReverseSolidusTbar(value: String) | +| [RequiredWithEscapedCharactersMap010100Builder](#requiredwithescapedcharactersmap010100builder) | fooReverseSolidusTbar(value: Int) | +| [RequiredWithEscapedCharactersMap010100Builder](#requiredwithescapedcharactersmap010100builder) | fooReverseSolidusTbar(value: Float) | +| [RequiredWithEscapedCharactersMap010100Builder](#requiredwithescapedcharactersmap010100builder) | fooReverseSolidusTbar(value: Long) | +| [RequiredWithEscapedCharactersMap010100Builder](#requiredwithescapedcharactersmap010100builder) | fooReverseSolidusTbar(value: Double) | +| [RequiredWithEscapedCharactersMap010100Builder](#requiredwithescapedcharactersmap010100builder) | fooReverseSolidusTbar(value: List) | +| [RequiredWithEscapedCharactersMap010100Builder](#requiredwithescapedcharactersmap010100builder) | fooReverseSolidusTbar(value: Map) | +| [RequiredWithEscapedCharactersMap100100Builder](#requiredwithescapedcharactersmap100100builder) | fooReverseSolidusNbar(value: Nothing?) | +| [RequiredWithEscapedCharactersMap100100Builder](#requiredwithescapedcharactersmap100100builder) | fooReverseSolidusNbar(value: Boolean) | +| [RequiredWithEscapedCharactersMap100100Builder](#requiredwithescapedcharactersmap100100builder) | fooReverseSolidusNbar(value: String) | +| [RequiredWithEscapedCharactersMap100100Builder](#requiredwithescapedcharactersmap100100builder) | fooReverseSolidusNbar(value: Int) | +| [RequiredWithEscapedCharactersMap100100Builder](#requiredwithescapedcharactersmap100100builder) | fooReverseSolidusNbar(value: Float) | +| [RequiredWithEscapedCharactersMap100100Builder](#requiredwithescapedcharactersmap100100builder) | fooReverseSolidusNbar(value: Long) | +| [RequiredWithEscapedCharactersMap100100Builder](#requiredwithescapedcharactersmap100100builder) | fooReverseSolidusNbar(value: Double) | +| [RequiredWithEscapedCharactersMap100100Builder](#requiredwithescapedcharactersmap100100builder) | fooReverseSolidusNbar(value: List) | +| [RequiredWithEscapedCharactersMap100100Builder](#requiredwithescapedcharactersmap100100builder) | fooReverseSolidusNbar(value: Map) | +| [RequiredWithEscapedCharactersMap110000Builder](#requiredwithescapedcharactersmap110000builder) | fooReverseSolidusRbar(value: Nothing?) | +| [RequiredWithEscapedCharactersMap110000Builder](#requiredwithescapedcharactersmap110000builder) | fooReverseSolidusRbar(value: Boolean) | +| [RequiredWithEscapedCharactersMap110000Builder](#requiredwithescapedcharactersmap110000builder) | fooReverseSolidusRbar(value: String) | +| [RequiredWithEscapedCharactersMap110000Builder](#requiredwithescapedcharactersmap110000builder) | fooReverseSolidusRbar(value: Int) | +| [RequiredWithEscapedCharactersMap110000Builder](#requiredwithescapedcharactersmap110000builder) | fooReverseSolidusRbar(value: Float) | +| [RequiredWithEscapedCharactersMap110000Builder](#requiredwithescapedcharactersmap110000builder) | fooReverseSolidusRbar(value: Long) | +| [RequiredWithEscapedCharactersMap110000Builder](#requiredwithescapedcharactersmap110000builder) | fooReverseSolidusRbar(value: Double) | +| [RequiredWithEscapedCharactersMap110000Builder](#requiredwithescapedcharactersmap110000builder) | fooReverseSolidusRbar(value: List) | +| [RequiredWithEscapedCharactersMap110000Builder](#requiredwithescapedcharactersmap110000builder) | fooReverseSolidusRbar(value: Map) | + +## RequiredWithEscapedCharactersMap110101Builder +class RequiredWithEscapedCharactersMap110101Builder
+builder for `Map` + +A class that builds the Map input type + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| RequiredWithEscapedCharactersMap110101Builder(Map instance)
Creates a builder that contains the passed instance | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| [RequiredWithEscapedCharactersMap010101Builder](#requiredwithescapedcharactersmap010101builder) | fooReverseSolidusTbar(value: Nothing?) | +| [RequiredWithEscapedCharactersMap010101Builder](#requiredwithescapedcharactersmap010101builder) | fooReverseSolidusTbar(value: Boolean) | +| [RequiredWithEscapedCharactersMap010101Builder](#requiredwithescapedcharactersmap010101builder) | fooReverseSolidusTbar(value: String) | +| [RequiredWithEscapedCharactersMap010101Builder](#requiredwithescapedcharactersmap010101builder) | fooReverseSolidusTbar(value: Int) | +| [RequiredWithEscapedCharactersMap010101Builder](#requiredwithescapedcharactersmap010101builder) | fooReverseSolidusTbar(value: Float) | +| [RequiredWithEscapedCharactersMap010101Builder](#requiredwithescapedcharactersmap010101builder) | fooReverseSolidusTbar(value: Long) | +| [RequiredWithEscapedCharactersMap010101Builder](#requiredwithescapedcharactersmap010101builder) | fooReverseSolidusTbar(value: Double) | +| [RequiredWithEscapedCharactersMap010101Builder](#requiredwithescapedcharactersmap010101builder) | fooReverseSolidusTbar(value: List) | +| [RequiredWithEscapedCharactersMap010101Builder](#requiredwithescapedcharactersmap010101builder) | fooReverseSolidusTbar(value: Map) | +| [RequiredWithEscapedCharactersMap100101Builder](#requiredwithescapedcharactersmap100101builder) | fooReverseSolidusNbar(value: Nothing?) | +| [RequiredWithEscapedCharactersMap100101Builder](#requiredwithescapedcharactersmap100101builder) | fooReverseSolidusNbar(value: Boolean) | +| [RequiredWithEscapedCharactersMap100101Builder](#requiredwithescapedcharactersmap100101builder) | fooReverseSolidusNbar(value: String) | +| [RequiredWithEscapedCharactersMap100101Builder](#requiredwithescapedcharactersmap100101builder) | fooReverseSolidusNbar(value: Int) | +| [RequiredWithEscapedCharactersMap100101Builder](#requiredwithescapedcharactersmap100101builder) | fooReverseSolidusNbar(value: Float) | +| [RequiredWithEscapedCharactersMap100101Builder](#requiredwithescapedcharactersmap100101builder) | fooReverseSolidusNbar(value: Long) | +| [RequiredWithEscapedCharactersMap100101Builder](#requiredwithescapedcharactersmap100101builder) | fooReverseSolidusNbar(value: Double) | +| [RequiredWithEscapedCharactersMap100101Builder](#requiredwithescapedcharactersmap100101builder) | fooReverseSolidusNbar(value: List) | +| [RequiredWithEscapedCharactersMap100101Builder](#requiredwithescapedcharactersmap100101builder) | fooReverseSolidusNbar(value: Map) | +| [RequiredWithEscapedCharactersMap110001Builder](#requiredwithescapedcharactersmap110001builder) | fooReverseSolidusRbar(value: Nothing?) | +| [RequiredWithEscapedCharactersMap110001Builder](#requiredwithescapedcharactersmap110001builder) | fooReverseSolidusRbar(value: Boolean) | +| [RequiredWithEscapedCharactersMap110001Builder](#requiredwithescapedcharactersmap110001builder) | fooReverseSolidusRbar(value: String) | +| [RequiredWithEscapedCharactersMap110001Builder](#requiredwithescapedcharactersmap110001builder) | fooReverseSolidusRbar(value: Int) | +| [RequiredWithEscapedCharactersMap110001Builder](#requiredwithescapedcharactersmap110001builder) | fooReverseSolidusRbar(value: Float) | +| [RequiredWithEscapedCharactersMap110001Builder](#requiredwithescapedcharactersmap110001builder) | fooReverseSolidusRbar(value: Long) | +| [RequiredWithEscapedCharactersMap110001Builder](#requiredwithescapedcharactersmap110001builder) | fooReverseSolidusRbar(value: Double) | +| [RequiredWithEscapedCharactersMap110001Builder](#requiredwithescapedcharactersmap110001builder) | fooReverseSolidusRbar(value: List) | +| [RequiredWithEscapedCharactersMap110001Builder](#requiredwithescapedcharactersmap110001builder) | fooReverseSolidusRbar(value: Map) | +| [RequiredWithEscapedCharactersMap110100Builder](#requiredwithescapedcharactersmap110100builder) | fooReverseSolidusReverseSolidusBar(value: Nothing?) | +| [RequiredWithEscapedCharactersMap110100Builder](#requiredwithescapedcharactersmap110100builder) | fooReverseSolidusReverseSolidusBar(value: Boolean) | +| [RequiredWithEscapedCharactersMap110100Builder](#requiredwithescapedcharactersmap110100builder) | fooReverseSolidusReverseSolidusBar(value: String) | +| [RequiredWithEscapedCharactersMap110100Builder](#requiredwithescapedcharactersmap110100builder) | fooReverseSolidusReverseSolidusBar(value: Int) | +| [RequiredWithEscapedCharactersMap110100Builder](#requiredwithescapedcharactersmap110100builder) | fooReverseSolidusReverseSolidusBar(value: Float) | +| [RequiredWithEscapedCharactersMap110100Builder](#requiredwithescapedcharactersmap110100builder) | fooReverseSolidusReverseSolidusBar(value: Long) | +| [RequiredWithEscapedCharactersMap110100Builder](#requiredwithescapedcharactersmap110100builder) | fooReverseSolidusReverseSolidusBar(value: Double) | +| [RequiredWithEscapedCharactersMap110100Builder](#requiredwithescapedcharactersmap110100builder) | fooReverseSolidusReverseSolidusBar(value: List) | +| [RequiredWithEscapedCharactersMap110100Builder](#requiredwithescapedcharactersmap110100builder) | fooReverseSolidusReverseSolidusBar(value: Map) | + +## RequiredWithEscapedCharactersMap110110Builder +class RequiredWithEscapedCharactersMap110110Builder
+builder for `Map` + +A class that builds the Map input type + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| RequiredWithEscapedCharactersMap110110Builder(Map instance)
Creates a builder that contains the passed instance | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| [RequiredWithEscapedCharactersMap010110Builder](#requiredwithescapedcharactersmap010110builder) | fooReverseSolidusTbar(value: Nothing?) | +| [RequiredWithEscapedCharactersMap010110Builder](#requiredwithescapedcharactersmap010110builder) | fooReverseSolidusTbar(value: Boolean) | +| [RequiredWithEscapedCharactersMap010110Builder](#requiredwithescapedcharactersmap010110builder) | fooReverseSolidusTbar(value: String) | +| [RequiredWithEscapedCharactersMap010110Builder](#requiredwithescapedcharactersmap010110builder) | fooReverseSolidusTbar(value: Int) | +| [RequiredWithEscapedCharactersMap010110Builder](#requiredwithescapedcharactersmap010110builder) | fooReverseSolidusTbar(value: Float) | +| [RequiredWithEscapedCharactersMap010110Builder](#requiredwithescapedcharactersmap010110builder) | fooReverseSolidusTbar(value: Long) | +| [RequiredWithEscapedCharactersMap010110Builder](#requiredwithescapedcharactersmap010110builder) | fooReverseSolidusTbar(value: Double) | +| [RequiredWithEscapedCharactersMap010110Builder](#requiredwithescapedcharactersmap010110builder) | fooReverseSolidusTbar(value: List) | +| [RequiredWithEscapedCharactersMap010110Builder](#requiredwithescapedcharactersmap010110builder) | fooReverseSolidusTbar(value: Map) | +| [RequiredWithEscapedCharactersMap100110Builder](#requiredwithescapedcharactersmap100110builder) | fooReverseSolidusNbar(value: Nothing?) | +| [RequiredWithEscapedCharactersMap100110Builder](#requiredwithescapedcharactersmap100110builder) | fooReverseSolidusNbar(value: Boolean) | +| [RequiredWithEscapedCharactersMap100110Builder](#requiredwithescapedcharactersmap100110builder) | fooReverseSolidusNbar(value: String) | +| [RequiredWithEscapedCharactersMap100110Builder](#requiredwithescapedcharactersmap100110builder) | fooReverseSolidusNbar(value: Int) | +| [RequiredWithEscapedCharactersMap100110Builder](#requiredwithescapedcharactersmap100110builder) | fooReverseSolidusNbar(value: Float) | +| [RequiredWithEscapedCharactersMap100110Builder](#requiredwithescapedcharactersmap100110builder) | fooReverseSolidusNbar(value: Long) | +| [RequiredWithEscapedCharactersMap100110Builder](#requiredwithescapedcharactersmap100110builder) | fooReverseSolidusNbar(value: Double) | +| [RequiredWithEscapedCharactersMap100110Builder](#requiredwithescapedcharactersmap100110builder) | fooReverseSolidusNbar(value: List) | +| [RequiredWithEscapedCharactersMap100110Builder](#requiredwithescapedcharactersmap100110builder) | fooReverseSolidusNbar(value: Map) | +| [RequiredWithEscapedCharactersMap110010Builder](#requiredwithescapedcharactersmap110010builder) | fooReverseSolidusRbar(value: Nothing?) | +| [RequiredWithEscapedCharactersMap110010Builder](#requiredwithescapedcharactersmap110010builder) | fooReverseSolidusRbar(value: Boolean) | +| [RequiredWithEscapedCharactersMap110010Builder](#requiredwithescapedcharactersmap110010builder) | fooReverseSolidusRbar(value: String) | +| [RequiredWithEscapedCharactersMap110010Builder](#requiredwithescapedcharactersmap110010builder) | fooReverseSolidusRbar(value: Int) | +| [RequiredWithEscapedCharactersMap110010Builder](#requiredwithescapedcharactersmap110010builder) | fooReverseSolidusRbar(value: Float) | +| [RequiredWithEscapedCharactersMap110010Builder](#requiredwithescapedcharactersmap110010builder) | fooReverseSolidusRbar(value: Long) | +| [RequiredWithEscapedCharactersMap110010Builder](#requiredwithescapedcharactersmap110010builder) | fooReverseSolidusRbar(value: Double) | +| [RequiredWithEscapedCharactersMap110010Builder](#requiredwithescapedcharactersmap110010builder) | fooReverseSolidusRbar(value: List) | +| [RequiredWithEscapedCharactersMap110010Builder](#requiredwithescapedcharactersmap110010builder) | fooReverseSolidusRbar(value: Map) | +| [RequiredWithEscapedCharactersMap110100Builder](#requiredwithescapedcharactersmap110100builder) | fooReverseSolidusQuotationMarkBar(value: Nothing?) | +| [RequiredWithEscapedCharactersMap110100Builder](#requiredwithescapedcharactersmap110100builder) | fooReverseSolidusQuotationMarkBar(value: Boolean) | +| [RequiredWithEscapedCharactersMap110100Builder](#requiredwithescapedcharactersmap110100builder) | fooReverseSolidusQuotationMarkBar(value: String) | +| [RequiredWithEscapedCharactersMap110100Builder](#requiredwithescapedcharactersmap110100builder) | fooReverseSolidusQuotationMarkBar(value: Int) | +| [RequiredWithEscapedCharactersMap110100Builder](#requiredwithescapedcharactersmap110100builder) | fooReverseSolidusQuotationMarkBar(value: Float) | +| [RequiredWithEscapedCharactersMap110100Builder](#requiredwithescapedcharactersmap110100builder) | fooReverseSolidusQuotationMarkBar(value: Long) | +| [RequiredWithEscapedCharactersMap110100Builder](#requiredwithescapedcharactersmap110100builder) | fooReverseSolidusQuotationMarkBar(value: Double) | +| [RequiredWithEscapedCharactersMap110100Builder](#requiredwithescapedcharactersmap110100builder) | fooReverseSolidusQuotationMarkBar(value: List) | +| [RequiredWithEscapedCharactersMap110100Builder](#requiredwithescapedcharactersmap110100builder) | fooReverseSolidusQuotationMarkBar(value: Map) | + +## RequiredWithEscapedCharactersMap110111Builder +class RequiredWithEscapedCharactersMap110111Builder
+builder for `Map` + +A class that builds the Map input type + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| RequiredWithEscapedCharactersMap110111Builder(Map instance)
Creates a builder that contains the passed instance | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| [RequiredWithEscapedCharactersMap010111Builder](#requiredwithescapedcharactersmap010111builder) | fooReverseSolidusTbar(value: Nothing?) | +| [RequiredWithEscapedCharactersMap010111Builder](#requiredwithescapedcharactersmap010111builder) | fooReverseSolidusTbar(value: Boolean) | +| [RequiredWithEscapedCharactersMap010111Builder](#requiredwithescapedcharactersmap010111builder) | fooReverseSolidusTbar(value: String) | +| [RequiredWithEscapedCharactersMap010111Builder](#requiredwithescapedcharactersmap010111builder) | fooReverseSolidusTbar(value: Int) | +| [RequiredWithEscapedCharactersMap010111Builder](#requiredwithescapedcharactersmap010111builder) | fooReverseSolidusTbar(value: Float) | +| [RequiredWithEscapedCharactersMap010111Builder](#requiredwithescapedcharactersmap010111builder) | fooReverseSolidusTbar(value: Long) | +| [RequiredWithEscapedCharactersMap010111Builder](#requiredwithescapedcharactersmap010111builder) | fooReverseSolidusTbar(value: Double) | +| [RequiredWithEscapedCharactersMap010111Builder](#requiredwithescapedcharactersmap010111builder) | fooReverseSolidusTbar(value: List) | +| [RequiredWithEscapedCharactersMap010111Builder](#requiredwithescapedcharactersmap010111builder) | fooReverseSolidusTbar(value: Map) | +| [RequiredWithEscapedCharactersMap100111Builder](#requiredwithescapedcharactersmap100111builder) | fooReverseSolidusNbar(value: Nothing?) | +| [RequiredWithEscapedCharactersMap100111Builder](#requiredwithescapedcharactersmap100111builder) | fooReverseSolidusNbar(value: Boolean) | +| [RequiredWithEscapedCharactersMap100111Builder](#requiredwithescapedcharactersmap100111builder) | fooReverseSolidusNbar(value: String) | +| [RequiredWithEscapedCharactersMap100111Builder](#requiredwithescapedcharactersmap100111builder) | fooReverseSolidusNbar(value: Int) | +| [RequiredWithEscapedCharactersMap100111Builder](#requiredwithescapedcharactersmap100111builder) | fooReverseSolidusNbar(value: Float) | +| [RequiredWithEscapedCharactersMap100111Builder](#requiredwithescapedcharactersmap100111builder) | fooReverseSolidusNbar(value: Long) | +| [RequiredWithEscapedCharactersMap100111Builder](#requiredwithescapedcharactersmap100111builder) | fooReverseSolidusNbar(value: Double) | +| [RequiredWithEscapedCharactersMap100111Builder](#requiredwithescapedcharactersmap100111builder) | fooReverseSolidusNbar(value: List) | +| [RequiredWithEscapedCharactersMap100111Builder](#requiredwithescapedcharactersmap100111builder) | fooReverseSolidusNbar(value: Map) | +| [RequiredWithEscapedCharactersMap110011Builder](#requiredwithescapedcharactersmap110011builder) | fooReverseSolidusRbar(value: Nothing?) | +| [RequiredWithEscapedCharactersMap110011Builder](#requiredwithescapedcharactersmap110011builder) | fooReverseSolidusRbar(value: Boolean) | +| [RequiredWithEscapedCharactersMap110011Builder](#requiredwithescapedcharactersmap110011builder) | fooReverseSolidusRbar(value: String) | +| [RequiredWithEscapedCharactersMap110011Builder](#requiredwithescapedcharactersmap110011builder) | fooReverseSolidusRbar(value: Int) | +| [RequiredWithEscapedCharactersMap110011Builder](#requiredwithescapedcharactersmap110011builder) | fooReverseSolidusRbar(value: Float) | +| [RequiredWithEscapedCharactersMap110011Builder](#requiredwithescapedcharactersmap110011builder) | fooReverseSolidusRbar(value: Long) | +| [RequiredWithEscapedCharactersMap110011Builder](#requiredwithescapedcharactersmap110011builder) | fooReverseSolidusRbar(value: Double) | +| [RequiredWithEscapedCharactersMap110011Builder](#requiredwithescapedcharactersmap110011builder) | fooReverseSolidusRbar(value: List) | +| [RequiredWithEscapedCharactersMap110011Builder](#requiredwithescapedcharactersmap110011builder) | fooReverseSolidusRbar(value: Map) | +| [RequiredWithEscapedCharactersMap110101Builder](#requiredwithescapedcharactersmap110101builder) | fooReverseSolidusQuotationMarkBar(value: Nothing?) | +| [RequiredWithEscapedCharactersMap110101Builder](#requiredwithescapedcharactersmap110101builder) | fooReverseSolidusQuotationMarkBar(value: Boolean) | +| [RequiredWithEscapedCharactersMap110101Builder](#requiredwithescapedcharactersmap110101builder) | fooReverseSolidusQuotationMarkBar(value: String) | +| [RequiredWithEscapedCharactersMap110101Builder](#requiredwithescapedcharactersmap110101builder) | fooReverseSolidusQuotationMarkBar(value: Int) | +| [RequiredWithEscapedCharactersMap110101Builder](#requiredwithescapedcharactersmap110101builder) | fooReverseSolidusQuotationMarkBar(value: Float) | +| [RequiredWithEscapedCharactersMap110101Builder](#requiredwithescapedcharactersmap110101builder) | fooReverseSolidusQuotationMarkBar(value: Long) | +| [RequiredWithEscapedCharactersMap110101Builder](#requiredwithescapedcharactersmap110101builder) | fooReverseSolidusQuotationMarkBar(value: Double) | +| [RequiredWithEscapedCharactersMap110101Builder](#requiredwithescapedcharactersmap110101builder) | fooReverseSolidusQuotationMarkBar(value: List) | +| [RequiredWithEscapedCharactersMap110101Builder](#requiredwithescapedcharactersmap110101builder) | fooReverseSolidusQuotationMarkBar(value: Map) | +| [RequiredWithEscapedCharactersMap110110Builder](#requiredwithescapedcharactersmap110110builder) | fooReverseSolidusReverseSolidusBar(value: Nothing?) | +| [RequiredWithEscapedCharactersMap110110Builder](#requiredwithescapedcharactersmap110110builder) | fooReverseSolidusReverseSolidusBar(value: Boolean) | +| [RequiredWithEscapedCharactersMap110110Builder](#requiredwithescapedcharactersmap110110builder) | fooReverseSolidusReverseSolidusBar(value: String) | +| [RequiredWithEscapedCharactersMap110110Builder](#requiredwithescapedcharactersmap110110builder) | fooReverseSolidusReverseSolidusBar(value: Int) | +| [RequiredWithEscapedCharactersMap110110Builder](#requiredwithescapedcharactersmap110110builder) | fooReverseSolidusReverseSolidusBar(value: Float) | +| [RequiredWithEscapedCharactersMap110110Builder](#requiredwithescapedcharactersmap110110builder) | fooReverseSolidusReverseSolidusBar(value: Long) | +| [RequiredWithEscapedCharactersMap110110Builder](#requiredwithescapedcharactersmap110110builder) | fooReverseSolidusReverseSolidusBar(value: Double) | +| [RequiredWithEscapedCharactersMap110110Builder](#requiredwithescapedcharactersmap110110builder) | fooReverseSolidusReverseSolidusBar(value: List) | +| [RequiredWithEscapedCharactersMap110110Builder](#requiredwithescapedcharactersmap110110builder) | fooReverseSolidusReverseSolidusBar(value: Map) | + +## RequiredWithEscapedCharactersMap111000Builder +class RequiredWithEscapedCharactersMap111000Builder
+builder for `Map` + +A class that builds the Map input type + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| RequiredWithEscapedCharactersMap111000Builder(Map instance)
Creates a builder that contains the passed instance | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| [RequiredWithEscapedCharactersMap011000Builder](#requiredwithescapedcharactersmap011000builder) | fooReverseSolidusTbar(value: Nothing?) | +| [RequiredWithEscapedCharactersMap011000Builder](#requiredwithescapedcharactersmap011000builder) | fooReverseSolidusTbar(value: Boolean) | +| [RequiredWithEscapedCharactersMap011000Builder](#requiredwithescapedcharactersmap011000builder) | fooReverseSolidusTbar(value: String) | +| [RequiredWithEscapedCharactersMap011000Builder](#requiredwithescapedcharactersmap011000builder) | fooReverseSolidusTbar(value: Int) | +| [RequiredWithEscapedCharactersMap011000Builder](#requiredwithescapedcharactersmap011000builder) | fooReverseSolidusTbar(value: Float) | +| [RequiredWithEscapedCharactersMap011000Builder](#requiredwithescapedcharactersmap011000builder) | fooReverseSolidusTbar(value: Long) | +| [RequiredWithEscapedCharactersMap011000Builder](#requiredwithescapedcharactersmap011000builder) | fooReverseSolidusTbar(value: Double) | +| [RequiredWithEscapedCharactersMap011000Builder](#requiredwithescapedcharactersmap011000builder) | fooReverseSolidusTbar(value: List) | +| [RequiredWithEscapedCharactersMap011000Builder](#requiredwithescapedcharactersmap011000builder) | fooReverseSolidusTbar(value: Map) | +| [RequiredWithEscapedCharactersMap101000Builder](#requiredwithescapedcharactersmap101000builder) | fooReverseSolidusNbar(value: Nothing?) | +| [RequiredWithEscapedCharactersMap101000Builder](#requiredwithescapedcharactersmap101000builder) | fooReverseSolidusNbar(value: Boolean) | +| [RequiredWithEscapedCharactersMap101000Builder](#requiredwithescapedcharactersmap101000builder) | fooReverseSolidusNbar(value: String) | +| [RequiredWithEscapedCharactersMap101000Builder](#requiredwithescapedcharactersmap101000builder) | fooReverseSolidusNbar(value: Int) | +| [RequiredWithEscapedCharactersMap101000Builder](#requiredwithescapedcharactersmap101000builder) | fooReverseSolidusNbar(value: Float) | +| [RequiredWithEscapedCharactersMap101000Builder](#requiredwithescapedcharactersmap101000builder) | fooReverseSolidusNbar(value: Long) | +| [RequiredWithEscapedCharactersMap101000Builder](#requiredwithescapedcharactersmap101000builder) | fooReverseSolidusNbar(value: Double) | +| [RequiredWithEscapedCharactersMap101000Builder](#requiredwithescapedcharactersmap101000builder) | fooReverseSolidusNbar(value: List) | +| [RequiredWithEscapedCharactersMap101000Builder](#requiredwithescapedcharactersmap101000builder) | fooReverseSolidusNbar(value: Map) | +| [RequiredWithEscapedCharactersMap110000Builder](#requiredwithescapedcharactersmap110000builder) | fooReverseSolidusU000cbar(value: Nothing?) | +| [RequiredWithEscapedCharactersMap110000Builder](#requiredwithescapedcharactersmap110000builder) | fooReverseSolidusU000cbar(value: Boolean) | +| [RequiredWithEscapedCharactersMap110000Builder](#requiredwithescapedcharactersmap110000builder) | fooReverseSolidusU000cbar(value: String) | +| [RequiredWithEscapedCharactersMap110000Builder](#requiredwithescapedcharactersmap110000builder) | fooReverseSolidusU000cbar(value: Int) | +| [RequiredWithEscapedCharactersMap110000Builder](#requiredwithescapedcharactersmap110000builder) | fooReverseSolidusU000cbar(value: Float) | +| [RequiredWithEscapedCharactersMap110000Builder](#requiredwithescapedcharactersmap110000builder) | fooReverseSolidusU000cbar(value: Long) | +| [RequiredWithEscapedCharactersMap110000Builder](#requiredwithescapedcharactersmap110000builder) | fooReverseSolidusU000cbar(value: Double) | +| [RequiredWithEscapedCharactersMap110000Builder](#requiredwithescapedcharactersmap110000builder) | fooReverseSolidusU000cbar(value: List) | +| [RequiredWithEscapedCharactersMap110000Builder](#requiredwithescapedcharactersmap110000builder) | fooReverseSolidusU000cbar(value: Map) | + +## RequiredWithEscapedCharactersMap111001Builder +class RequiredWithEscapedCharactersMap111001Builder
+builder for `Map` + +A class that builds the Map input type + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| RequiredWithEscapedCharactersMap111001Builder(Map instance)
Creates a builder that contains the passed instance | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| [RequiredWithEscapedCharactersMap011001Builder](#requiredwithescapedcharactersmap011001builder) | fooReverseSolidusTbar(value: Nothing?) | +| [RequiredWithEscapedCharactersMap011001Builder](#requiredwithescapedcharactersmap011001builder) | fooReverseSolidusTbar(value: Boolean) | +| [RequiredWithEscapedCharactersMap011001Builder](#requiredwithescapedcharactersmap011001builder) | fooReverseSolidusTbar(value: String) | +| [RequiredWithEscapedCharactersMap011001Builder](#requiredwithescapedcharactersmap011001builder) | fooReverseSolidusTbar(value: Int) | +| [RequiredWithEscapedCharactersMap011001Builder](#requiredwithescapedcharactersmap011001builder) | fooReverseSolidusTbar(value: Float) | +| [RequiredWithEscapedCharactersMap011001Builder](#requiredwithescapedcharactersmap011001builder) | fooReverseSolidusTbar(value: Long) | +| [RequiredWithEscapedCharactersMap011001Builder](#requiredwithescapedcharactersmap011001builder) | fooReverseSolidusTbar(value: Double) | +| [RequiredWithEscapedCharactersMap011001Builder](#requiredwithescapedcharactersmap011001builder) | fooReverseSolidusTbar(value: List) | +| [RequiredWithEscapedCharactersMap011001Builder](#requiredwithescapedcharactersmap011001builder) | fooReverseSolidusTbar(value: Map) | +| [RequiredWithEscapedCharactersMap101001Builder](#requiredwithescapedcharactersmap101001builder) | fooReverseSolidusNbar(value: Nothing?) | +| [RequiredWithEscapedCharactersMap101001Builder](#requiredwithescapedcharactersmap101001builder) | fooReverseSolidusNbar(value: Boolean) | +| [RequiredWithEscapedCharactersMap101001Builder](#requiredwithescapedcharactersmap101001builder) | fooReverseSolidusNbar(value: String) | +| [RequiredWithEscapedCharactersMap101001Builder](#requiredwithescapedcharactersmap101001builder) | fooReverseSolidusNbar(value: Int) | +| [RequiredWithEscapedCharactersMap101001Builder](#requiredwithescapedcharactersmap101001builder) | fooReverseSolidusNbar(value: Float) | +| [RequiredWithEscapedCharactersMap101001Builder](#requiredwithescapedcharactersmap101001builder) | fooReverseSolidusNbar(value: Long) | +| [RequiredWithEscapedCharactersMap101001Builder](#requiredwithescapedcharactersmap101001builder) | fooReverseSolidusNbar(value: Double) | +| [RequiredWithEscapedCharactersMap101001Builder](#requiredwithescapedcharactersmap101001builder) | fooReverseSolidusNbar(value: List) | +| [RequiredWithEscapedCharactersMap101001Builder](#requiredwithescapedcharactersmap101001builder) | fooReverseSolidusNbar(value: Map) | +| [RequiredWithEscapedCharactersMap110001Builder](#requiredwithescapedcharactersmap110001builder) | fooReverseSolidusU000cbar(value: Nothing?) | +| [RequiredWithEscapedCharactersMap110001Builder](#requiredwithescapedcharactersmap110001builder) | fooReverseSolidusU000cbar(value: Boolean) | +| [RequiredWithEscapedCharactersMap110001Builder](#requiredwithescapedcharactersmap110001builder) | fooReverseSolidusU000cbar(value: String) | +| [RequiredWithEscapedCharactersMap110001Builder](#requiredwithescapedcharactersmap110001builder) | fooReverseSolidusU000cbar(value: Int) | +| [RequiredWithEscapedCharactersMap110001Builder](#requiredwithescapedcharactersmap110001builder) | fooReverseSolidusU000cbar(value: Float) | +| [RequiredWithEscapedCharactersMap110001Builder](#requiredwithescapedcharactersmap110001builder) | fooReverseSolidusU000cbar(value: Long) | +| [RequiredWithEscapedCharactersMap110001Builder](#requiredwithescapedcharactersmap110001builder) | fooReverseSolidusU000cbar(value: Double) | +| [RequiredWithEscapedCharactersMap110001Builder](#requiredwithescapedcharactersmap110001builder) | fooReverseSolidusU000cbar(value: List) | +| [RequiredWithEscapedCharactersMap110001Builder](#requiredwithescapedcharactersmap110001builder) | fooReverseSolidusU000cbar(value: Map) | +| [RequiredWithEscapedCharactersMap111000Builder](#requiredwithescapedcharactersmap111000builder) | fooReverseSolidusReverseSolidusBar(value: Nothing?) | +| [RequiredWithEscapedCharactersMap111000Builder](#requiredwithescapedcharactersmap111000builder) | fooReverseSolidusReverseSolidusBar(value: Boolean) | +| [RequiredWithEscapedCharactersMap111000Builder](#requiredwithescapedcharactersmap111000builder) | fooReverseSolidusReverseSolidusBar(value: String) | +| [RequiredWithEscapedCharactersMap111000Builder](#requiredwithescapedcharactersmap111000builder) | fooReverseSolidusReverseSolidusBar(value: Int) | +| [RequiredWithEscapedCharactersMap111000Builder](#requiredwithescapedcharactersmap111000builder) | fooReverseSolidusReverseSolidusBar(value: Float) | +| [RequiredWithEscapedCharactersMap111000Builder](#requiredwithescapedcharactersmap111000builder) | fooReverseSolidusReverseSolidusBar(value: Long) | +| [RequiredWithEscapedCharactersMap111000Builder](#requiredwithescapedcharactersmap111000builder) | fooReverseSolidusReverseSolidusBar(value: Double) | +| [RequiredWithEscapedCharactersMap111000Builder](#requiredwithescapedcharactersmap111000builder) | fooReverseSolidusReverseSolidusBar(value: List) | +| [RequiredWithEscapedCharactersMap111000Builder](#requiredwithescapedcharactersmap111000builder) | fooReverseSolidusReverseSolidusBar(value: Map) | + +## RequiredWithEscapedCharactersMap111010Builder +class RequiredWithEscapedCharactersMap111010Builder
+builder for `Map` + +A class that builds the Map input type + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| RequiredWithEscapedCharactersMap111010Builder(Map instance)
Creates a builder that contains the passed instance | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| [RequiredWithEscapedCharactersMap011010Builder](#requiredwithescapedcharactersmap011010builder) | fooReverseSolidusTbar(value: Nothing?) | +| [RequiredWithEscapedCharactersMap011010Builder](#requiredwithescapedcharactersmap011010builder) | fooReverseSolidusTbar(value: Boolean) | +| [RequiredWithEscapedCharactersMap011010Builder](#requiredwithescapedcharactersmap011010builder) | fooReverseSolidusTbar(value: String) | +| [RequiredWithEscapedCharactersMap011010Builder](#requiredwithescapedcharactersmap011010builder) | fooReverseSolidusTbar(value: Int) | +| [RequiredWithEscapedCharactersMap011010Builder](#requiredwithescapedcharactersmap011010builder) | fooReverseSolidusTbar(value: Float) | +| [RequiredWithEscapedCharactersMap011010Builder](#requiredwithescapedcharactersmap011010builder) | fooReverseSolidusTbar(value: Long) | +| [RequiredWithEscapedCharactersMap011010Builder](#requiredwithescapedcharactersmap011010builder) | fooReverseSolidusTbar(value: Double) | +| [RequiredWithEscapedCharactersMap011010Builder](#requiredwithescapedcharactersmap011010builder) | fooReverseSolidusTbar(value: List) | +| [RequiredWithEscapedCharactersMap011010Builder](#requiredwithescapedcharactersmap011010builder) | fooReverseSolidusTbar(value: Map) | +| [RequiredWithEscapedCharactersMap101010Builder](#requiredwithescapedcharactersmap101010builder) | fooReverseSolidusNbar(value: Nothing?) | +| [RequiredWithEscapedCharactersMap101010Builder](#requiredwithescapedcharactersmap101010builder) | fooReverseSolidusNbar(value: Boolean) | +| [RequiredWithEscapedCharactersMap101010Builder](#requiredwithescapedcharactersmap101010builder) | fooReverseSolidusNbar(value: String) | +| [RequiredWithEscapedCharactersMap101010Builder](#requiredwithescapedcharactersmap101010builder) | fooReverseSolidusNbar(value: Int) | +| [RequiredWithEscapedCharactersMap101010Builder](#requiredwithescapedcharactersmap101010builder) | fooReverseSolidusNbar(value: Float) | +| [RequiredWithEscapedCharactersMap101010Builder](#requiredwithescapedcharactersmap101010builder) | fooReverseSolidusNbar(value: Long) | +| [RequiredWithEscapedCharactersMap101010Builder](#requiredwithescapedcharactersmap101010builder) | fooReverseSolidusNbar(value: Double) | +| [RequiredWithEscapedCharactersMap101010Builder](#requiredwithescapedcharactersmap101010builder) | fooReverseSolidusNbar(value: List) | +| [RequiredWithEscapedCharactersMap101010Builder](#requiredwithescapedcharactersmap101010builder) | fooReverseSolidusNbar(value: Map) | +| [RequiredWithEscapedCharactersMap110010Builder](#requiredwithescapedcharactersmap110010builder) | fooReverseSolidusU000cbar(value: Nothing?) | +| [RequiredWithEscapedCharactersMap110010Builder](#requiredwithescapedcharactersmap110010builder) | fooReverseSolidusU000cbar(value: Boolean) | +| [RequiredWithEscapedCharactersMap110010Builder](#requiredwithescapedcharactersmap110010builder) | fooReverseSolidusU000cbar(value: String) | +| [RequiredWithEscapedCharactersMap110010Builder](#requiredwithescapedcharactersmap110010builder) | fooReverseSolidusU000cbar(value: Int) | +| [RequiredWithEscapedCharactersMap110010Builder](#requiredwithescapedcharactersmap110010builder) | fooReverseSolidusU000cbar(value: Float) | +| [RequiredWithEscapedCharactersMap110010Builder](#requiredwithescapedcharactersmap110010builder) | fooReverseSolidusU000cbar(value: Long) | +| [RequiredWithEscapedCharactersMap110010Builder](#requiredwithescapedcharactersmap110010builder) | fooReverseSolidusU000cbar(value: Double) | +| [RequiredWithEscapedCharactersMap110010Builder](#requiredwithescapedcharactersmap110010builder) | fooReverseSolidusU000cbar(value: List) | +| [RequiredWithEscapedCharactersMap110010Builder](#requiredwithescapedcharactersmap110010builder) | fooReverseSolidusU000cbar(value: Map) | +| [RequiredWithEscapedCharactersMap111000Builder](#requiredwithescapedcharactersmap111000builder) | fooReverseSolidusQuotationMarkBar(value: Nothing?) | +| [RequiredWithEscapedCharactersMap111000Builder](#requiredwithescapedcharactersmap111000builder) | fooReverseSolidusQuotationMarkBar(value: Boolean) | +| [RequiredWithEscapedCharactersMap111000Builder](#requiredwithescapedcharactersmap111000builder) | fooReverseSolidusQuotationMarkBar(value: String) | +| [RequiredWithEscapedCharactersMap111000Builder](#requiredwithescapedcharactersmap111000builder) | fooReverseSolidusQuotationMarkBar(value: Int) | +| [RequiredWithEscapedCharactersMap111000Builder](#requiredwithescapedcharactersmap111000builder) | fooReverseSolidusQuotationMarkBar(value: Float) | +| [RequiredWithEscapedCharactersMap111000Builder](#requiredwithescapedcharactersmap111000builder) | fooReverseSolidusQuotationMarkBar(value: Long) | +| [RequiredWithEscapedCharactersMap111000Builder](#requiredwithescapedcharactersmap111000builder) | fooReverseSolidusQuotationMarkBar(value: Double) | +| [RequiredWithEscapedCharactersMap111000Builder](#requiredwithescapedcharactersmap111000builder) | fooReverseSolidusQuotationMarkBar(value: List) | +| [RequiredWithEscapedCharactersMap111000Builder](#requiredwithescapedcharactersmap111000builder) | fooReverseSolidusQuotationMarkBar(value: Map) | + +## RequiredWithEscapedCharactersMap111011Builder +class RequiredWithEscapedCharactersMap111011Builder
+builder for `Map` + +A class that builds the Map input type + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| RequiredWithEscapedCharactersMap111011Builder(Map instance)
Creates a builder that contains the passed instance | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| [RequiredWithEscapedCharactersMap011011Builder](#requiredwithescapedcharactersmap011011builder) | fooReverseSolidusTbar(value: Nothing?) | +| [RequiredWithEscapedCharactersMap011011Builder](#requiredwithescapedcharactersmap011011builder) | fooReverseSolidusTbar(value: Boolean) | +| [RequiredWithEscapedCharactersMap011011Builder](#requiredwithescapedcharactersmap011011builder) | fooReverseSolidusTbar(value: String) | +| [RequiredWithEscapedCharactersMap011011Builder](#requiredwithescapedcharactersmap011011builder) | fooReverseSolidusTbar(value: Int) | +| [RequiredWithEscapedCharactersMap011011Builder](#requiredwithescapedcharactersmap011011builder) | fooReverseSolidusTbar(value: Float) | +| [RequiredWithEscapedCharactersMap011011Builder](#requiredwithescapedcharactersmap011011builder) | fooReverseSolidusTbar(value: Long) | +| [RequiredWithEscapedCharactersMap011011Builder](#requiredwithescapedcharactersmap011011builder) | fooReverseSolidusTbar(value: Double) | +| [RequiredWithEscapedCharactersMap011011Builder](#requiredwithescapedcharactersmap011011builder) | fooReverseSolidusTbar(value: List) | +| [RequiredWithEscapedCharactersMap011011Builder](#requiredwithescapedcharactersmap011011builder) | fooReverseSolidusTbar(value: Map) | +| [RequiredWithEscapedCharactersMap101011Builder](#requiredwithescapedcharactersmap101011builder) | fooReverseSolidusNbar(value: Nothing?) | +| [RequiredWithEscapedCharactersMap101011Builder](#requiredwithescapedcharactersmap101011builder) | fooReverseSolidusNbar(value: Boolean) | +| [RequiredWithEscapedCharactersMap101011Builder](#requiredwithescapedcharactersmap101011builder) | fooReverseSolidusNbar(value: String) | +| [RequiredWithEscapedCharactersMap101011Builder](#requiredwithescapedcharactersmap101011builder) | fooReverseSolidusNbar(value: Int) | +| [RequiredWithEscapedCharactersMap101011Builder](#requiredwithescapedcharactersmap101011builder) | fooReverseSolidusNbar(value: Float) | +| [RequiredWithEscapedCharactersMap101011Builder](#requiredwithescapedcharactersmap101011builder) | fooReverseSolidusNbar(value: Long) | +| [RequiredWithEscapedCharactersMap101011Builder](#requiredwithescapedcharactersmap101011builder) | fooReverseSolidusNbar(value: Double) | +| [RequiredWithEscapedCharactersMap101011Builder](#requiredwithescapedcharactersmap101011builder) | fooReverseSolidusNbar(value: List) | +| [RequiredWithEscapedCharactersMap101011Builder](#requiredwithescapedcharactersmap101011builder) | fooReverseSolidusNbar(value: Map) | +| [RequiredWithEscapedCharactersMap110011Builder](#requiredwithescapedcharactersmap110011builder) | fooReverseSolidusU000cbar(value: Nothing?) | +| [RequiredWithEscapedCharactersMap110011Builder](#requiredwithescapedcharactersmap110011builder) | fooReverseSolidusU000cbar(value: Boolean) | +| [RequiredWithEscapedCharactersMap110011Builder](#requiredwithescapedcharactersmap110011builder) | fooReverseSolidusU000cbar(value: String) | +| [RequiredWithEscapedCharactersMap110011Builder](#requiredwithescapedcharactersmap110011builder) | fooReverseSolidusU000cbar(value: Int) | +| [RequiredWithEscapedCharactersMap110011Builder](#requiredwithescapedcharactersmap110011builder) | fooReverseSolidusU000cbar(value: Float) | +| [RequiredWithEscapedCharactersMap110011Builder](#requiredwithescapedcharactersmap110011builder) | fooReverseSolidusU000cbar(value: Long) | +| [RequiredWithEscapedCharactersMap110011Builder](#requiredwithescapedcharactersmap110011builder) | fooReverseSolidusU000cbar(value: Double) | +| [RequiredWithEscapedCharactersMap110011Builder](#requiredwithescapedcharactersmap110011builder) | fooReverseSolidusU000cbar(value: List) | +| [RequiredWithEscapedCharactersMap110011Builder](#requiredwithescapedcharactersmap110011builder) | fooReverseSolidusU000cbar(value: Map) | +| [RequiredWithEscapedCharactersMap111001Builder](#requiredwithescapedcharactersmap111001builder) | fooReverseSolidusQuotationMarkBar(value: Nothing?) | +| [RequiredWithEscapedCharactersMap111001Builder](#requiredwithescapedcharactersmap111001builder) | fooReverseSolidusQuotationMarkBar(value: Boolean) | +| [RequiredWithEscapedCharactersMap111001Builder](#requiredwithescapedcharactersmap111001builder) | fooReverseSolidusQuotationMarkBar(value: String) | +| [RequiredWithEscapedCharactersMap111001Builder](#requiredwithescapedcharactersmap111001builder) | fooReverseSolidusQuotationMarkBar(value: Int) | +| [RequiredWithEscapedCharactersMap111001Builder](#requiredwithescapedcharactersmap111001builder) | fooReverseSolidusQuotationMarkBar(value: Float) | +| [RequiredWithEscapedCharactersMap111001Builder](#requiredwithescapedcharactersmap111001builder) | fooReverseSolidusQuotationMarkBar(value: Long) | +| [RequiredWithEscapedCharactersMap111001Builder](#requiredwithescapedcharactersmap111001builder) | fooReverseSolidusQuotationMarkBar(value: Double) | +| [RequiredWithEscapedCharactersMap111001Builder](#requiredwithescapedcharactersmap111001builder) | fooReverseSolidusQuotationMarkBar(value: List) | +| [RequiredWithEscapedCharactersMap111001Builder](#requiredwithescapedcharactersmap111001builder) | fooReverseSolidusQuotationMarkBar(value: Map) | +| [RequiredWithEscapedCharactersMap111010Builder](#requiredwithescapedcharactersmap111010builder) | fooReverseSolidusReverseSolidusBar(value: Nothing?) | +| [RequiredWithEscapedCharactersMap111010Builder](#requiredwithescapedcharactersmap111010builder) | fooReverseSolidusReverseSolidusBar(value: Boolean) | +| [RequiredWithEscapedCharactersMap111010Builder](#requiredwithescapedcharactersmap111010builder) | fooReverseSolidusReverseSolidusBar(value: String) | +| [RequiredWithEscapedCharactersMap111010Builder](#requiredwithescapedcharactersmap111010builder) | fooReverseSolidusReverseSolidusBar(value: Int) | +| [RequiredWithEscapedCharactersMap111010Builder](#requiredwithescapedcharactersmap111010builder) | fooReverseSolidusReverseSolidusBar(value: Float) | +| [RequiredWithEscapedCharactersMap111010Builder](#requiredwithescapedcharactersmap111010builder) | fooReverseSolidusReverseSolidusBar(value: Long) | +| [RequiredWithEscapedCharactersMap111010Builder](#requiredwithescapedcharactersmap111010builder) | fooReverseSolidusReverseSolidusBar(value: Double) | +| [RequiredWithEscapedCharactersMap111010Builder](#requiredwithescapedcharactersmap111010builder) | fooReverseSolidusReverseSolidusBar(value: List) | +| [RequiredWithEscapedCharactersMap111010Builder](#requiredwithescapedcharactersmap111010builder) | fooReverseSolidusReverseSolidusBar(value: Map) | + +## RequiredWithEscapedCharactersMap111100Builder +class RequiredWithEscapedCharactersMap111100Builder
+builder for `Map` + +A class that builds the Map input type + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| RequiredWithEscapedCharactersMap111100Builder(Map instance)
Creates a builder that contains the passed instance | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| [RequiredWithEscapedCharactersMap011100Builder](#requiredwithescapedcharactersmap011100builder) | fooReverseSolidusTbar(value: Nothing?) | +| [RequiredWithEscapedCharactersMap011100Builder](#requiredwithescapedcharactersmap011100builder) | fooReverseSolidusTbar(value: Boolean) | +| [RequiredWithEscapedCharactersMap011100Builder](#requiredwithescapedcharactersmap011100builder) | fooReverseSolidusTbar(value: String) | +| [RequiredWithEscapedCharactersMap011100Builder](#requiredwithescapedcharactersmap011100builder) | fooReverseSolidusTbar(value: Int) | +| [RequiredWithEscapedCharactersMap011100Builder](#requiredwithescapedcharactersmap011100builder) | fooReverseSolidusTbar(value: Float) | +| [RequiredWithEscapedCharactersMap011100Builder](#requiredwithescapedcharactersmap011100builder) | fooReverseSolidusTbar(value: Long) | +| [RequiredWithEscapedCharactersMap011100Builder](#requiredwithescapedcharactersmap011100builder) | fooReverseSolidusTbar(value: Double) | +| [RequiredWithEscapedCharactersMap011100Builder](#requiredwithescapedcharactersmap011100builder) | fooReverseSolidusTbar(value: List) | +| [RequiredWithEscapedCharactersMap011100Builder](#requiredwithescapedcharactersmap011100builder) | fooReverseSolidusTbar(value: Map) | +| [RequiredWithEscapedCharactersMap101100Builder](#requiredwithescapedcharactersmap101100builder) | fooReverseSolidusNbar(value: Nothing?) | +| [RequiredWithEscapedCharactersMap101100Builder](#requiredwithescapedcharactersmap101100builder) | fooReverseSolidusNbar(value: Boolean) | +| [RequiredWithEscapedCharactersMap101100Builder](#requiredwithescapedcharactersmap101100builder) | fooReverseSolidusNbar(value: String) | +| [RequiredWithEscapedCharactersMap101100Builder](#requiredwithescapedcharactersmap101100builder) | fooReverseSolidusNbar(value: Int) | +| [RequiredWithEscapedCharactersMap101100Builder](#requiredwithescapedcharactersmap101100builder) | fooReverseSolidusNbar(value: Float) | +| [RequiredWithEscapedCharactersMap101100Builder](#requiredwithescapedcharactersmap101100builder) | fooReverseSolidusNbar(value: Long) | +| [RequiredWithEscapedCharactersMap101100Builder](#requiredwithescapedcharactersmap101100builder) | fooReverseSolidusNbar(value: Double) | +| [RequiredWithEscapedCharactersMap101100Builder](#requiredwithescapedcharactersmap101100builder) | fooReverseSolidusNbar(value: List) | +| [RequiredWithEscapedCharactersMap101100Builder](#requiredwithescapedcharactersmap101100builder) | fooReverseSolidusNbar(value: Map) | +| [RequiredWithEscapedCharactersMap110100Builder](#requiredwithescapedcharactersmap110100builder) | fooReverseSolidusU000cbar(value: Nothing?) | +| [RequiredWithEscapedCharactersMap110100Builder](#requiredwithescapedcharactersmap110100builder) | fooReverseSolidusU000cbar(value: Boolean) | +| [RequiredWithEscapedCharactersMap110100Builder](#requiredwithescapedcharactersmap110100builder) | fooReverseSolidusU000cbar(value: String) | +| [RequiredWithEscapedCharactersMap110100Builder](#requiredwithescapedcharactersmap110100builder) | fooReverseSolidusU000cbar(value: Int) | +| [RequiredWithEscapedCharactersMap110100Builder](#requiredwithescapedcharactersmap110100builder) | fooReverseSolidusU000cbar(value: Float) | +| [RequiredWithEscapedCharactersMap110100Builder](#requiredwithescapedcharactersmap110100builder) | fooReverseSolidusU000cbar(value: Long) | +| [RequiredWithEscapedCharactersMap110100Builder](#requiredwithescapedcharactersmap110100builder) | fooReverseSolidusU000cbar(value: Double) | +| [RequiredWithEscapedCharactersMap110100Builder](#requiredwithescapedcharactersmap110100builder) | fooReverseSolidusU000cbar(value: List) | +| [RequiredWithEscapedCharactersMap110100Builder](#requiredwithescapedcharactersmap110100builder) | fooReverseSolidusU000cbar(value: Map) | +| [RequiredWithEscapedCharactersMap111000Builder](#requiredwithescapedcharactersmap111000builder) | fooReverseSolidusRbar(value: Nothing?) | +| [RequiredWithEscapedCharactersMap111000Builder](#requiredwithescapedcharactersmap111000builder) | fooReverseSolidusRbar(value: Boolean) | +| [RequiredWithEscapedCharactersMap111000Builder](#requiredwithescapedcharactersmap111000builder) | fooReverseSolidusRbar(value: String) | +| [RequiredWithEscapedCharactersMap111000Builder](#requiredwithescapedcharactersmap111000builder) | fooReverseSolidusRbar(value: Int) | +| [RequiredWithEscapedCharactersMap111000Builder](#requiredwithescapedcharactersmap111000builder) | fooReverseSolidusRbar(value: Float) | +| [RequiredWithEscapedCharactersMap111000Builder](#requiredwithescapedcharactersmap111000builder) | fooReverseSolidusRbar(value: Long) | +| [RequiredWithEscapedCharactersMap111000Builder](#requiredwithescapedcharactersmap111000builder) | fooReverseSolidusRbar(value: Double) | +| [RequiredWithEscapedCharactersMap111000Builder](#requiredwithescapedcharactersmap111000builder) | fooReverseSolidusRbar(value: List) | +| [RequiredWithEscapedCharactersMap111000Builder](#requiredwithescapedcharactersmap111000builder) | fooReverseSolidusRbar(value: Map) | + +## RequiredWithEscapedCharactersMap111101Builder +class RequiredWithEscapedCharactersMap111101Builder
+builder for `Map` + +A class that builds the Map input type + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| RequiredWithEscapedCharactersMap111101Builder(Map instance)
Creates a builder that contains the passed instance | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| [RequiredWithEscapedCharactersMap011101Builder](#requiredwithescapedcharactersmap011101builder) | fooReverseSolidusTbar(value: Nothing?) | +| [RequiredWithEscapedCharactersMap011101Builder](#requiredwithescapedcharactersmap011101builder) | fooReverseSolidusTbar(value: Boolean) | +| [RequiredWithEscapedCharactersMap011101Builder](#requiredwithescapedcharactersmap011101builder) | fooReverseSolidusTbar(value: String) | +| [RequiredWithEscapedCharactersMap011101Builder](#requiredwithescapedcharactersmap011101builder) | fooReverseSolidusTbar(value: Int) | +| [RequiredWithEscapedCharactersMap011101Builder](#requiredwithescapedcharactersmap011101builder) | fooReverseSolidusTbar(value: Float) | +| [RequiredWithEscapedCharactersMap011101Builder](#requiredwithescapedcharactersmap011101builder) | fooReverseSolidusTbar(value: Long) | +| [RequiredWithEscapedCharactersMap011101Builder](#requiredwithescapedcharactersmap011101builder) | fooReverseSolidusTbar(value: Double) | +| [RequiredWithEscapedCharactersMap011101Builder](#requiredwithescapedcharactersmap011101builder) | fooReverseSolidusTbar(value: List) | +| [RequiredWithEscapedCharactersMap011101Builder](#requiredwithescapedcharactersmap011101builder) | fooReverseSolidusTbar(value: Map) | +| [RequiredWithEscapedCharactersMap101101Builder](#requiredwithescapedcharactersmap101101builder) | fooReverseSolidusNbar(value: Nothing?) | +| [RequiredWithEscapedCharactersMap101101Builder](#requiredwithescapedcharactersmap101101builder) | fooReverseSolidusNbar(value: Boolean) | +| [RequiredWithEscapedCharactersMap101101Builder](#requiredwithescapedcharactersmap101101builder) | fooReverseSolidusNbar(value: String) | +| [RequiredWithEscapedCharactersMap101101Builder](#requiredwithescapedcharactersmap101101builder) | fooReverseSolidusNbar(value: Int) | +| [RequiredWithEscapedCharactersMap101101Builder](#requiredwithescapedcharactersmap101101builder) | fooReverseSolidusNbar(value: Float) | +| [RequiredWithEscapedCharactersMap101101Builder](#requiredwithescapedcharactersmap101101builder) | fooReverseSolidusNbar(value: Long) | +| [RequiredWithEscapedCharactersMap101101Builder](#requiredwithescapedcharactersmap101101builder) | fooReverseSolidusNbar(value: Double) | +| [RequiredWithEscapedCharactersMap101101Builder](#requiredwithescapedcharactersmap101101builder) | fooReverseSolidusNbar(value: List) | +| [RequiredWithEscapedCharactersMap101101Builder](#requiredwithescapedcharactersmap101101builder) | fooReverseSolidusNbar(value: Map) | +| [RequiredWithEscapedCharactersMap110101Builder](#requiredwithescapedcharactersmap110101builder) | fooReverseSolidusU000cbar(value: Nothing?) | +| [RequiredWithEscapedCharactersMap110101Builder](#requiredwithescapedcharactersmap110101builder) | fooReverseSolidusU000cbar(value: Boolean) | +| [RequiredWithEscapedCharactersMap110101Builder](#requiredwithescapedcharactersmap110101builder) | fooReverseSolidusU000cbar(value: String) | +| [RequiredWithEscapedCharactersMap110101Builder](#requiredwithescapedcharactersmap110101builder) | fooReverseSolidusU000cbar(value: Int) | +| [RequiredWithEscapedCharactersMap110101Builder](#requiredwithescapedcharactersmap110101builder) | fooReverseSolidusU000cbar(value: Float) | +| [RequiredWithEscapedCharactersMap110101Builder](#requiredwithescapedcharactersmap110101builder) | fooReverseSolidusU000cbar(value: Long) | +| [RequiredWithEscapedCharactersMap110101Builder](#requiredwithescapedcharactersmap110101builder) | fooReverseSolidusU000cbar(value: Double) | +| [RequiredWithEscapedCharactersMap110101Builder](#requiredwithescapedcharactersmap110101builder) | fooReverseSolidusU000cbar(value: List) | +| [RequiredWithEscapedCharactersMap110101Builder](#requiredwithescapedcharactersmap110101builder) | fooReverseSolidusU000cbar(value: Map) | +| [RequiredWithEscapedCharactersMap111001Builder](#requiredwithescapedcharactersmap111001builder) | fooReverseSolidusRbar(value: Nothing?) | +| [RequiredWithEscapedCharactersMap111001Builder](#requiredwithescapedcharactersmap111001builder) | fooReverseSolidusRbar(value: Boolean) | +| [RequiredWithEscapedCharactersMap111001Builder](#requiredwithescapedcharactersmap111001builder) | fooReverseSolidusRbar(value: String) | +| [RequiredWithEscapedCharactersMap111001Builder](#requiredwithescapedcharactersmap111001builder) | fooReverseSolidusRbar(value: Int) | +| [RequiredWithEscapedCharactersMap111001Builder](#requiredwithescapedcharactersmap111001builder) | fooReverseSolidusRbar(value: Float) | +| [RequiredWithEscapedCharactersMap111001Builder](#requiredwithescapedcharactersmap111001builder) | fooReverseSolidusRbar(value: Long) | +| [RequiredWithEscapedCharactersMap111001Builder](#requiredwithescapedcharactersmap111001builder) | fooReverseSolidusRbar(value: Double) | +| [RequiredWithEscapedCharactersMap111001Builder](#requiredwithescapedcharactersmap111001builder) | fooReverseSolidusRbar(value: List) | +| [RequiredWithEscapedCharactersMap111001Builder](#requiredwithescapedcharactersmap111001builder) | fooReverseSolidusRbar(value: Map) | +| [RequiredWithEscapedCharactersMap111100Builder](#requiredwithescapedcharactersmap111100builder) | fooReverseSolidusReverseSolidusBar(value: Nothing?) | +| [RequiredWithEscapedCharactersMap111100Builder](#requiredwithescapedcharactersmap111100builder) | fooReverseSolidusReverseSolidusBar(value: Boolean) | +| [RequiredWithEscapedCharactersMap111100Builder](#requiredwithescapedcharactersmap111100builder) | fooReverseSolidusReverseSolidusBar(value: String) | +| [RequiredWithEscapedCharactersMap111100Builder](#requiredwithescapedcharactersmap111100builder) | fooReverseSolidusReverseSolidusBar(value: Int) | +| [RequiredWithEscapedCharactersMap111100Builder](#requiredwithescapedcharactersmap111100builder) | fooReverseSolidusReverseSolidusBar(value: Float) | +| [RequiredWithEscapedCharactersMap111100Builder](#requiredwithescapedcharactersmap111100builder) | fooReverseSolidusReverseSolidusBar(value: Long) | +| [RequiredWithEscapedCharactersMap111100Builder](#requiredwithescapedcharactersmap111100builder) | fooReverseSolidusReverseSolidusBar(value: Double) | +| [RequiredWithEscapedCharactersMap111100Builder](#requiredwithescapedcharactersmap111100builder) | fooReverseSolidusReverseSolidusBar(value: List) | +| [RequiredWithEscapedCharactersMap111100Builder](#requiredwithescapedcharactersmap111100builder) | fooReverseSolidusReverseSolidusBar(value: Map) | + +## RequiredWithEscapedCharactersMap111110Builder +class RequiredWithEscapedCharactersMap111110Builder
+builder for `Map` + +A class that builds the Map input type + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| RequiredWithEscapedCharactersMap111110Builder(Map instance)
Creates a builder that contains the passed instance | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| [RequiredWithEscapedCharactersMap011110Builder](#requiredwithescapedcharactersmap011110builder) | fooReverseSolidusTbar(value: Nothing?) | +| [RequiredWithEscapedCharactersMap011110Builder](#requiredwithescapedcharactersmap011110builder) | fooReverseSolidusTbar(value: Boolean) | +| [RequiredWithEscapedCharactersMap011110Builder](#requiredwithescapedcharactersmap011110builder) | fooReverseSolidusTbar(value: String) | +| [RequiredWithEscapedCharactersMap011110Builder](#requiredwithescapedcharactersmap011110builder) | fooReverseSolidusTbar(value: Int) | +| [RequiredWithEscapedCharactersMap011110Builder](#requiredwithescapedcharactersmap011110builder) | fooReverseSolidusTbar(value: Float) | +| [RequiredWithEscapedCharactersMap011110Builder](#requiredwithescapedcharactersmap011110builder) | fooReverseSolidusTbar(value: Long) | +| [RequiredWithEscapedCharactersMap011110Builder](#requiredwithescapedcharactersmap011110builder) | fooReverseSolidusTbar(value: Double) | +| [RequiredWithEscapedCharactersMap011110Builder](#requiredwithescapedcharactersmap011110builder) | fooReverseSolidusTbar(value: List) | +| [RequiredWithEscapedCharactersMap011110Builder](#requiredwithescapedcharactersmap011110builder) | fooReverseSolidusTbar(value: Map) | +| [RequiredWithEscapedCharactersMap101110Builder](#requiredwithescapedcharactersmap101110builder) | fooReverseSolidusNbar(value: Nothing?) | +| [RequiredWithEscapedCharactersMap101110Builder](#requiredwithescapedcharactersmap101110builder) | fooReverseSolidusNbar(value: Boolean) | +| [RequiredWithEscapedCharactersMap101110Builder](#requiredwithescapedcharactersmap101110builder) | fooReverseSolidusNbar(value: String) | +| [RequiredWithEscapedCharactersMap101110Builder](#requiredwithescapedcharactersmap101110builder) | fooReverseSolidusNbar(value: Int) | +| [RequiredWithEscapedCharactersMap101110Builder](#requiredwithescapedcharactersmap101110builder) | fooReverseSolidusNbar(value: Float) | +| [RequiredWithEscapedCharactersMap101110Builder](#requiredwithescapedcharactersmap101110builder) | fooReverseSolidusNbar(value: Long) | +| [RequiredWithEscapedCharactersMap101110Builder](#requiredwithescapedcharactersmap101110builder) | fooReverseSolidusNbar(value: Double) | +| [RequiredWithEscapedCharactersMap101110Builder](#requiredwithescapedcharactersmap101110builder) | fooReverseSolidusNbar(value: List) | +| [RequiredWithEscapedCharactersMap101110Builder](#requiredwithescapedcharactersmap101110builder) | fooReverseSolidusNbar(value: Map) | +| [RequiredWithEscapedCharactersMap110110Builder](#requiredwithescapedcharactersmap110110builder) | fooReverseSolidusU000cbar(value: Nothing?) | +| [RequiredWithEscapedCharactersMap110110Builder](#requiredwithescapedcharactersmap110110builder) | fooReverseSolidusU000cbar(value: Boolean) | +| [RequiredWithEscapedCharactersMap110110Builder](#requiredwithescapedcharactersmap110110builder) | fooReverseSolidusU000cbar(value: String) | +| [RequiredWithEscapedCharactersMap110110Builder](#requiredwithescapedcharactersmap110110builder) | fooReverseSolidusU000cbar(value: Int) | +| [RequiredWithEscapedCharactersMap110110Builder](#requiredwithescapedcharactersmap110110builder) | fooReverseSolidusU000cbar(value: Float) | +| [RequiredWithEscapedCharactersMap110110Builder](#requiredwithescapedcharactersmap110110builder) | fooReverseSolidusU000cbar(value: Long) | +| [RequiredWithEscapedCharactersMap110110Builder](#requiredwithescapedcharactersmap110110builder) | fooReverseSolidusU000cbar(value: Double) | +| [RequiredWithEscapedCharactersMap110110Builder](#requiredwithescapedcharactersmap110110builder) | fooReverseSolidusU000cbar(value: List) | +| [RequiredWithEscapedCharactersMap110110Builder](#requiredwithescapedcharactersmap110110builder) | fooReverseSolidusU000cbar(value: Map) | +| [RequiredWithEscapedCharactersMap111010Builder](#requiredwithescapedcharactersmap111010builder) | fooReverseSolidusRbar(value: Nothing?) | +| [RequiredWithEscapedCharactersMap111010Builder](#requiredwithescapedcharactersmap111010builder) | fooReverseSolidusRbar(value: Boolean) | +| [RequiredWithEscapedCharactersMap111010Builder](#requiredwithescapedcharactersmap111010builder) | fooReverseSolidusRbar(value: String) | +| [RequiredWithEscapedCharactersMap111010Builder](#requiredwithescapedcharactersmap111010builder) | fooReverseSolidusRbar(value: Int) | +| [RequiredWithEscapedCharactersMap111010Builder](#requiredwithescapedcharactersmap111010builder) | fooReverseSolidusRbar(value: Float) | +| [RequiredWithEscapedCharactersMap111010Builder](#requiredwithescapedcharactersmap111010builder) | fooReverseSolidusRbar(value: Long) | +| [RequiredWithEscapedCharactersMap111010Builder](#requiredwithescapedcharactersmap111010builder) | fooReverseSolidusRbar(value: Double) | +| [RequiredWithEscapedCharactersMap111010Builder](#requiredwithescapedcharactersmap111010builder) | fooReverseSolidusRbar(value: List) | +| [RequiredWithEscapedCharactersMap111010Builder](#requiredwithescapedcharactersmap111010builder) | fooReverseSolidusRbar(value: Map) | +| [RequiredWithEscapedCharactersMap111100Builder](#requiredwithescapedcharactersmap111100builder) | fooReverseSolidusQuotationMarkBar(value: Nothing?) | +| [RequiredWithEscapedCharactersMap111100Builder](#requiredwithescapedcharactersmap111100builder) | fooReverseSolidusQuotationMarkBar(value: Boolean) | +| [RequiredWithEscapedCharactersMap111100Builder](#requiredwithescapedcharactersmap111100builder) | fooReverseSolidusQuotationMarkBar(value: String) | +| [RequiredWithEscapedCharactersMap111100Builder](#requiredwithescapedcharactersmap111100builder) | fooReverseSolidusQuotationMarkBar(value: Int) | +| [RequiredWithEscapedCharactersMap111100Builder](#requiredwithescapedcharactersmap111100builder) | fooReverseSolidusQuotationMarkBar(value: Float) | +| [RequiredWithEscapedCharactersMap111100Builder](#requiredwithescapedcharactersmap111100builder) | fooReverseSolidusQuotationMarkBar(value: Long) | +| [RequiredWithEscapedCharactersMap111100Builder](#requiredwithescapedcharactersmap111100builder) | fooReverseSolidusQuotationMarkBar(value: Double) | +| [RequiredWithEscapedCharactersMap111100Builder](#requiredwithescapedcharactersmap111100builder) | fooReverseSolidusQuotationMarkBar(value: List) | +| [RequiredWithEscapedCharactersMap111100Builder](#requiredwithescapedcharactersmap111100builder) | fooReverseSolidusQuotationMarkBar(value: Map) | + +## RequiredWithEscapedCharactersMapBuilder +class RequiredWithEscapedCharactersMapBuilder
+builder for `Map` + +A class that builds the Map input type + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| RequiredWithEscapedCharactersMapBuilder()
Creates a builder that contains an empty map | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| [RequiredWithEscapedCharactersMap011111Builder](#requiredwithescapedcharactersmap011111builder) | fooReverseSolidusTbar(value: Nothing?) | +| [RequiredWithEscapedCharactersMap011111Builder](#requiredwithescapedcharactersmap011111builder) | fooReverseSolidusTbar(value: Boolean) | +| [RequiredWithEscapedCharactersMap011111Builder](#requiredwithescapedcharactersmap011111builder) | fooReverseSolidusTbar(value: String) | +| [RequiredWithEscapedCharactersMap011111Builder](#requiredwithescapedcharactersmap011111builder) | fooReverseSolidusTbar(value: Int) | +| [RequiredWithEscapedCharactersMap011111Builder](#requiredwithescapedcharactersmap011111builder) | fooReverseSolidusTbar(value: Float) | +| [RequiredWithEscapedCharactersMap011111Builder](#requiredwithescapedcharactersmap011111builder) | fooReverseSolidusTbar(value: Long) | +| [RequiredWithEscapedCharactersMap011111Builder](#requiredwithescapedcharactersmap011111builder) | fooReverseSolidusTbar(value: Double) | +| [RequiredWithEscapedCharactersMap011111Builder](#requiredwithescapedcharactersmap011111builder) | fooReverseSolidusTbar(value: List) | +| [RequiredWithEscapedCharactersMap011111Builder](#requiredwithescapedcharactersmap011111builder) | fooReverseSolidusTbar(value: Map) | +| [RequiredWithEscapedCharactersMap101111Builder](#requiredwithescapedcharactersmap101111builder) | fooReverseSolidusNbar(value: Nothing?) | +| [RequiredWithEscapedCharactersMap101111Builder](#requiredwithescapedcharactersmap101111builder) | fooReverseSolidusNbar(value: Boolean) | +| [RequiredWithEscapedCharactersMap101111Builder](#requiredwithescapedcharactersmap101111builder) | fooReverseSolidusNbar(value: String) | +| [RequiredWithEscapedCharactersMap101111Builder](#requiredwithescapedcharactersmap101111builder) | fooReverseSolidusNbar(value: Int) | +| [RequiredWithEscapedCharactersMap101111Builder](#requiredwithescapedcharactersmap101111builder) | fooReverseSolidusNbar(value: Float) | +| [RequiredWithEscapedCharactersMap101111Builder](#requiredwithescapedcharactersmap101111builder) | fooReverseSolidusNbar(value: Long) | +| [RequiredWithEscapedCharactersMap101111Builder](#requiredwithescapedcharactersmap101111builder) | fooReverseSolidusNbar(value: Double) | +| [RequiredWithEscapedCharactersMap101111Builder](#requiredwithescapedcharactersmap101111builder) | fooReverseSolidusNbar(value: List) | +| [RequiredWithEscapedCharactersMap101111Builder](#requiredwithescapedcharactersmap101111builder) | fooReverseSolidusNbar(value: Map) | +| [RequiredWithEscapedCharactersMap110111Builder](#requiredwithescapedcharactersmap110111builder) | fooReverseSolidusU000cbar(value: Nothing?) | +| [RequiredWithEscapedCharactersMap110111Builder](#requiredwithescapedcharactersmap110111builder) | fooReverseSolidusU000cbar(value: Boolean) | +| [RequiredWithEscapedCharactersMap110111Builder](#requiredwithescapedcharactersmap110111builder) | fooReverseSolidusU000cbar(value: String) | +| [RequiredWithEscapedCharactersMap110111Builder](#requiredwithescapedcharactersmap110111builder) | fooReverseSolidusU000cbar(value: Int) | +| [RequiredWithEscapedCharactersMap110111Builder](#requiredwithescapedcharactersmap110111builder) | fooReverseSolidusU000cbar(value: Float) | +| [RequiredWithEscapedCharactersMap110111Builder](#requiredwithescapedcharactersmap110111builder) | fooReverseSolidusU000cbar(value: Long) | +| [RequiredWithEscapedCharactersMap110111Builder](#requiredwithescapedcharactersmap110111builder) | fooReverseSolidusU000cbar(value: Double) | +| [RequiredWithEscapedCharactersMap110111Builder](#requiredwithescapedcharactersmap110111builder) | fooReverseSolidusU000cbar(value: List) | +| [RequiredWithEscapedCharactersMap110111Builder](#requiredwithescapedcharactersmap110111builder) | fooReverseSolidusU000cbar(value: Map) | +| [RequiredWithEscapedCharactersMap111011Builder](#requiredwithescapedcharactersmap111011builder) | fooReverseSolidusRbar(value: Nothing?) | +| [RequiredWithEscapedCharactersMap111011Builder](#requiredwithescapedcharactersmap111011builder) | fooReverseSolidusRbar(value: Boolean) | +| [RequiredWithEscapedCharactersMap111011Builder](#requiredwithescapedcharactersmap111011builder) | fooReverseSolidusRbar(value: String) | +| [RequiredWithEscapedCharactersMap111011Builder](#requiredwithescapedcharactersmap111011builder) | fooReverseSolidusRbar(value: Int) | +| [RequiredWithEscapedCharactersMap111011Builder](#requiredwithescapedcharactersmap111011builder) | fooReverseSolidusRbar(value: Float) | +| [RequiredWithEscapedCharactersMap111011Builder](#requiredwithescapedcharactersmap111011builder) | fooReverseSolidusRbar(value: Long) | +| [RequiredWithEscapedCharactersMap111011Builder](#requiredwithescapedcharactersmap111011builder) | fooReverseSolidusRbar(value: Double) | +| [RequiredWithEscapedCharactersMap111011Builder](#requiredwithescapedcharactersmap111011builder) | fooReverseSolidusRbar(value: List) | +| [RequiredWithEscapedCharactersMap111011Builder](#requiredwithescapedcharactersmap111011builder) | fooReverseSolidusRbar(value: Map) | +| [RequiredWithEscapedCharactersMap111101Builder](#requiredwithescapedcharactersmap111101builder) | fooReverseSolidusQuotationMarkBar(value: Nothing?) | +| [RequiredWithEscapedCharactersMap111101Builder](#requiredwithescapedcharactersmap111101builder) | fooReverseSolidusQuotationMarkBar(value: Boolean) | +| [RequiredWithEscapedCharactersMap111101Builder](#requiredwithescapedcharactersmap111101builder) | fooReverseSolidusQuotationMarkBar(value: String) | +| [RequiredWithEscapedCharactersMap111101Builder](#requiredwithescapedcharactersmap111101builder) | fooReverseSolidusQuotationMarkBar(value: Int) | +| [RequiredWithEscapedCharactersMap111101Builder](#requiredwithescapedcharactersmap111101builder) | fooReverseSolidusQuotationMarkBar(value: Float) | +| [RequiredWithEscapedCharactersMap111101Builder](#requiredwithescapedcharactersmap111101builder) | fooReverseSolidusQuotationMarkBar(value: Long) | +| [RequiredWithEscapedCharactersMap111101Builder](#requiredwithescapedcharactersmap111101builder) | fooReverseSolidusQuotationMarkBar(value: Double) | +| [RequiredWithEscapedCharactersMap111101Builder](#requiredwithescapedcharactersmap111101builder) | fooReverseSolidusQuotationMarkBar(value: List) | +| [RequiredWithEscapedCharactersMap111101Builder](#requiredwithescapedcharactersmap111101builder) | fooReverseSolidusQuotationMarkBar(value: Map) | +| [RequiredWithEscapedCharactersMap111110Builder](#requiredwithescapedcharactersmap111110builder) | fooReverseSolidusReverseSolidusBar(value: Nothing?) | +| [RequiredWithEscapedCharactersMap111110Builder](#requiredwithescapedcharactersmap111110builder) | fooReverseSolidusReverseSolidusBar(value: Boolean) | +| [RequiredWithEscapedCharactersMap111110Builder](#requiredwithescapedcharactersmap111110builder) | fooReverseSolidusReverseSolidusBar(value: String) | +| [RequiredWithEscapedCharactersMap111110Builder](#requiredwithescapedcharactersmap111110builder) | fooReverseSolidusReverseSolidusBar(value: Int) | +| [RequiredWithEscapedCharactersMap111110Builder](#requiredwithescapedcharactersmap111110builder) | fooReverseSolidusReverseSolidusBar(value: Float) | +| [RequiredWithEscapedCharactersMap111110Builder](#requiredwithescapedcharactersmap111110builder) | fooReverseSolidusReverseSolidusBar(value: Long) | +| [RequiredWithEscapedCharactersMap111110Builder](#requiredwithescapedcharactersmap111110builder) | fooReverseSolidusReverseSolidusBar(value: Double) | +| [RequiredWithEscapedCharactersMap111110Builder](#requiredwithescapedcharactersmap111110builder) | fooReverseSolidusReverseSolidusBar(value: List) | +| [RequiredWithEscapedCharactersMap111110Builder](#requiredwithescapedcharactersmap111110builder) | fooReverseSolidusReverseSolidusBar(value: Map) | + +## RequiredWithEscapedCharactersMap +class RequiredWithEscapedCharactersMap
+extends FrozenMap + +A class to store validated Map payloads + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| static [RequiredWithEscapedCharactersMap](#requiredwithescapedcharactersmap) | of([Map](#requiredwithescapedcharactersmapbuilder) arg, SchemaConfiguration configuration) | +| Any? | get(String key)
This schema has invalid Kotlin names so this method must be used when you access instance["foo\tbar"], instance["foo\nbar"], instance["foo\u000Cbar"], instance["foo\rbar"], instance["foo\"bar"], instance["foo\\bar"], | +| Any? | getAdditionalProperty(String name)
provides type safety for additional properties | + +[[Back to top]](#top) [[Back to Component Schemas]](../../../README.md#Component-Schemas) [[Back to README]](../../../README.md) diff --git a/samples/client/3_0_3_unit_test/kotlin/docs/components/schemas/SimpleEnumValidation.md b/samples/client/3_0_3_unit_test/kotlin/docs/components/schemas/SimpleEnumValidation.md new file mode 100644 index 00000000000..08da7286908 --- /dev/null +++ b/samples/client/3_0_3_unit_test/kotlin/docs/components/schemas/SimpleEnumValidation.md @@ -0,0 +1,141 @@ +# SimpleEnumValidation +org.openapijsonschematools.client.components.schemas.SimpleEnumValidation.java +class SimpleEnumValidation
+ +A class that contains necessary nested +- schema classes (which validate payloads), extends JsonSchema +- sealed interfaces which store validated payloads, Kotlin version of a sum type +- boxed classes which store validated payloads, sealed permits class implementations +- enum classes + +## Nested Class Summary +| Modifier and Type | Class and Description | +| ----------------- | ---------------------- | +| sealed interface | [SimpleEnumValidation.SimpleEnumValidation1Boxed](#simpleenumvalidation1boxed)
sealed interface for validated payloads | +| record | [SimpleEnumValidation.SimpleEnumValidation1BoxedNumber](#simpleenumvalidation1boxednumber)
boxed class to store validated Number payloads | +| static class | [SimpleEnumValidation.SimpleEnumValidation1](#simpleenumvalidation1)
schema class | +| enum | [SimpleEnumValidation.IntegerSimpleEnumValidationEnums](#integersimpleenumvalidationenums)
Integer enum | +| enum | [SimpleEnumValidation.LongSimpleEnumValidationEnums](#longsimpleenumvalidationenums)
Long enum | +| enum | [SimpleEnumValidation.FloatSimpleEnumValidationEnums](#floatsimpleenumvalidationenums)
Float enum | +| enum | [SimpleEnumValidation.DoubleSimpleEnumValidationEnums](#doublesimpleenumvalidationenums)
Double enum | + +## SimpleEnumValidation1Boxed +sealed interface SimpleEnumValidation1Boxed
+permits
+[SimpleEnumValidation1BoxedNumber](#simpleenumvalidation1boxednumber) + +sealed interface that stores validated payloads using boxed classes + +## SimpleEnumValidation1BoxedNumber +data class SimpleEnumValidation1BoxedNumber
+implements [SimpleEnumValidation1Boxed](#simpleenumvalidation1boxed) + +data class that stores validated Number payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| SimpleEnumValidation1BoxedNumber(Number data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| Number | data()
validated payload | +| Any? | getData()
validated payload | + +## SimpleEnumValidation1 +class SimpleEnumValidation1
+extends JsonSchema + +A schema class that validates payloads + +### Code Sample +``` +import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags; +import org.openapijsonschematools.client.configurations.SchemaConfiguration; +import org.openapijsonschematools.client.exceptions.ValidationException; +import org.openapijsonschematools.client.schemas.validation.MapUtils; +import org.openapijsonschematools.client.schemas.validation.FrozenList; +import org.openapijsonschematools.client.schemas.validation.FrozenMap; +import org.openapijsonschematools.client.components.schemas.SimpleEnumValidation; + +import java.util.Arrays; +import java.util.List; +import java.util.AbstractMap; + +static final SchemaConfiguration configuration = new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().build()); + +// int validation +int validatedPayload = SimpleEnumValidation.SimpleEnumValidation1.validate( + 1, + configuration +); +``` + +### Field Summary +| Modifier and Type | Field and Description | +| ----------------- | ---------------------- | +| Set> | type = setOf(
    Int::class.java,
    Long::class.java,
    Float::class.java,
    Double::class.java
)
| +| Set | enumValues = setOf(
    1,
    2,
    3
)
| + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| Number | validate(arg: Number, configuration: SchemaConfiguration) | +| [SimpleEnumValidation1BoxedNumber](#simpleenumvalidation1boxednumber) | validateAndBox(Number, configuration: SchemaConfiguration) | +| [SimpleEnumValidation1Boxed](#simpleenumvalidation1boxed) | validateAndBox(Any?, configuration: SchemaConfiguration) | +| Any? | validate(arg: Any?, configuration: SchemaConfiguration) | + +## IntegerSimpleEnumValidationEnums +public enum IntegerSimpleEnumValidationEnums
+extends `Enum` + +A class that stores Integer enum values + +### Enum Constant Summary +| Enum Constant | Description | +| ------------- | ----------- | +| POSITIVE_1 | value = 1 | +| POSITIVE_2 | value = 2 | +| POSITIVE_3 | value = 3 | + +## LongSimpleEnumValidationEnums +public enum LongSimpleEnumValidationEnums
+extends `Enum` + +A class that stores Long enum values + +### Enum Constant Summary +| Enum Constant | Description | +| ------------- | ----------- | +| POSITIVE_1 | value = 1L | +| POSITIVE_2 | value = 2L | +| POSITIVE_3 | value = 3L | + +## FloatSimpleEnumValidationEnums +public enum FloatSimpleEnumValidationEnums
+extends `Enum` + +A class that stores Float enum values + +### Enum Constant Summary +| Enum Constant | Description | +| ------------- | ----------- | +| POSITIVE_1 | value = 1.0f | +| POSITIVE_2 | value = 2.0f | +| POSITIVE_3 | value = 3.0f | + +## DoubleSimpleEnumValidationEnums +public enum DoubleSimpleEnumValidationEnums
+extends `Enum` + +A class that stores Double enum values + +### Enum Constant Summary +| Enum Constant | Description | +| ------------- | ----------- | +| POSITIVE_1 | value = 1.0d | +| POSITIVE_2 | value = 2.0d | +| POSITIVE_3 | value = 3.0d | + +[[Back to top]](#top) [[Back to Component Schemas]](../../../README.md#Component-Schemas) [[Back to README]](../../../README.md) diff --git a/samples/client/3_0_3_unit_test/kotlin/docs/components/schemas/StringTypeMatchesStrings.md b/samples/client/3_0_3_unit_test/kotlin/docs/components/schemas/StringTypeMatchesStrings.md new file mode 100644 index 00000000000..30d0ca293d7 --- /dev/null +++ b/samples/client/3_0_3_unit_test/kotlin/docs/components/schemas/StringTypeMatchesStrings.md @@ -0,0 +1,52 @@ +# StringTypeMatchesStrings +org.openapijsonschematools.client.components.schemas.StringTypeMatchesStrings.java +class StringTypeMatchesStrings
+ +A class that contains necessary nested +- schema classes (which validate payloads), extends JsonSchema +- sealed interfaces which store validated payloads, Kotlin version of a sum type +- boxed classes which store validated payloads, sealed permits class implementations + +## Nested Class Summary +| Modifier and Type | Class and Description | +| ----------------- | ---------------------- | +| sealed interface | [StringTypeMatchesStrings.StringTypeMatchesStrings1Boxed](#stringtypematchesstrings1boxed)
sealed interface for validated payloads | +| record | [StringTypeMatchesStrings.StringTypeMatchesStrings1BoxedString](#stringtypematchesstrings1boxedstring)
boxed class to store validated String payloads | +| static class | [StringTypeMatchesStrings.StringTypeMatchesStrings1](#stringtypematchesstrings1)
schema class | + +## StringTypeMatchesStrings1Boxed +sealed interface StringTypeMatchesStrings1Boxed
+permits
+[StringTypeMatchesStrings1BoxedString](#stringtypematchesstrings1boxedstring) + +sealed interface that stores validated payloads using boxed classes + +## StringTypeMatchesStrings1BoxedString +data class StringTypeMatchesStrings1BoxedString
+implements [StringTypeMatchesStrings1Boxed](#stringtypematchesstrings1boxed) + +data class that stores validated String payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| StringTypeMatchesStrings1BoxedString(String data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| String | data()
validated payload | +| Any? | getData()
validated payload | + +## StringTypeMatchesStrings1 +class StringTypeMatchesStrings1
+extends StringJsonSchema.StringJsonSchema1 + +A schema class that validates payloads + +| Methods Inherited from class org.openapijsonschematools.client.schemas.StringJsonSchema.StringJsonSchema1 | +| ------------------------------------------------------------------ | +| validate | +| validateAndBox | + +[[Back to top]](#top) [[Back to Component Schemas]](../../../README.md#Component-Schemas) [[Back to README]](../../../README.md) diff --git a/samples/client/3_0_3_unit_test/kotlin/docs/components/schemas/TheDefaultKeywordDoesNotDoAnythingIfThePropertyIsMissing.md b/samples/client/3_0_3_unit_test/kotlin/docs/components/schemas/TheDefaultKeywordDoesNotDoAnythingIfThePropertyIsMissing.md new file mode 100644 index 00000000000..e6bd7249646 --- /dev/null +++ b/samples/client/3_0_3_unit_test/kotlin/docs/components/schemas/TheDefaultKeywordDoesNotDoAnythingIfThePropertyIsMissing.md @@ -0,0 +1,205 @@ +# TheDefaultKeywordDoesNotDoAnythingIfThePropertyIsMissing +org.openapijsonschematools.client.components.schemas.TheDefaultKeywordDoesNotDoAnythingIfThePropertyIsMissing.java +class TheDefaultKeywordDoesNotDoAnythingIfThePropertyIsMissing
+ +A class that contains necessary nested +- schema classes (which validate payloads), extends JsonSchema +- sealed interfaces which store validated payloads, Kotlin version of a sum type +- boxed classes which store validated payloads, sealed permits class implementations +- classes to store validated map payloads, extends FrozenMap +- classes to build inputs for map payloads + +## Nested Class Summary +| Modifier and Type | Class and Description | +| ----------------- | ---------------------- | +| sealed interface | [TheDefaultKeywordDoesNotDoAnythingIfThePropertyIsMissing.TheDefaultKeywordDoesNotDoAnythingIfThePropertyIsMissing1Boxed](#thedefaultkeyworddoesnotdoanythingifthepropertyismissing1boxed)
sealed interface for validated payloads | +| record | [TheDefaultKeywordDoesNotDoAnythingIfThePropertyIsMissing.TheDefaultKeywordDoesNotDoAnythingIfThePropertyIsMissing1BoxedMap](#thedefaultkeyworddoesnotdoanythingifthepropertyismissing1boxedmap)
boxed class to store validated Map payloads | +| static class | [TheDefaultKeywordDoesNotDoAnythingIfThePropertyIsMissing.TheDefaultKeywordDoesNotDoAnythingIfThePropertyIsMissing1](#thedefaultkeyworddoesnotdoanythingifthepropertyismissing1)
schema class | +| static class | [TheDefaultKeywordDoesNotDoAnythingIfThePropertyIsMissing.TheDefaultKeywordDoesNotDoAnythingIfThePropertyIsMissingMapBuilder](#thedefaultkeyworddoesnotdoanythingifthepropertyismissingmapbuilder)
builder for Map payloads | +| static class | [TheDefaultKeywordDoesNotDoAnythingIfThePropertyIsMissing.TheDefaultKeywordDoesNotDoAnythingIfThePropertyIsMissingMap](#thedefaultkeyworddoesnotdoanythingifthepropertyismissingmap)
output class for Map payloads | +| sealed interface | [TheDefaultKeywordDoesNotDoAnythingIfThePropertyIsMissing.AlphaBoxed](#alphaboxed)
sealed interface for validated payloads | +| record | [TheDefaultKeywordDoesNotDoAnythingIfThePropertyIsMissing.AlphaBoxedNumber](#alphaboxednumber)
boxed class to store validated Number payloads | +| static class | [TheDefaultKeywordDoesNotDoAnythingIfThePropertyIsMissing.Alpha](#alpha)
schema class | + +## TheDefaultKeywordDoesNotDoAnythingIfThePropertyIsMissing1Boxed +sealed interface TheDefaultKeywordDoesNotDoAnythingIfThePropertyIsMissing1Boxed
+permits
+[TheDefaultKeywordDoesNotDoAnythingIfThePropertyIsMissing1BoxedMap](#thedefaultkeyworddoesnotdoanythingifthepropertyismissing1boxedmap) + +sealed interface that stores validated payloads using boxed classes + +## TheDefaultKeywordDoesNotDoAnythingIfThePropertyIsMissing1BoxedMap +data class TheDefaultKeywordDoesNotDoAnythingIfThePropertyIsMissing1BoxedMap
+implements [TheDefaultKeywordDoesNotDoAnythingIfThePropertyIsMissing1Boxed](#thedefaultkeyworddoesnotdoanythingifthepropertyismissing1boxed) + +data class that stores validated Map payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| TheDefaultKeywordDoesNotDoAnythingIfThePropertyIsMissing1BoxedMap([TheDefaultKeywordDoesNotDoAnythingIfThePropertyIsMissingMap](#thedefaultkeyworddoesnotdoanythingifthepropertyismissingmap) data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| [TheDefaultKeywordDoesNotDoAnythingIfThePropertyIsMissingMap](#thedefaultkeyworddoesnotdoanythingifthepropertyismissingmap) | data()
validated payload | +| Any? | getData()
validated payload | + +## TheDefaultKeywordDoesNotDoAnythingIfThePropertyIsMissing1 +class TheDefaultKeywordDoesNotDoAnythingIfThePropertyIsMissing1
+extends JsonSchema + +A schema class that validates payloads + +### Code Sample +``` +import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags; +import org.openapijsonschematools.client.configurations.SchemaConfiguration; +import org.openapijsonschematools.client.exceptions.ValidationException; +import org.openapijsonschematools.client.schemas.validation.MapUtils; +import org.openapijsonschematools.client.schemas.validation.FrozenList; +import org.openapijsonschematools.client.schemas.validation.FrozenMap; +import org.openapijsonschematools.client.components.schemas.TheDefaultKeywordDoesNotDoAnythingIfThePropertyIsMissing; + +import java.util.Arrays; +import java.util.List; +import java.util.AbstractMap; + +static final SchemaConfiguration configuration = new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().build()); + +// Map validation +TheDefaultKeywordDoesNotDoAnythingIfThePropertyIsMissing.TheDefaultKeywordDoesNotDoAnythingIfThePropertyIsMissingMap validatedPayload = + TheDefaultKeywordDoesNotDoAnythingIfThePropertyIsMissing.TheDefaultKeywordDoesNotDoAnythingIfThePropertyIsMissing1.validate( + new TheDefaultKeywordDoesNotDoAnythingIfThePropertyIsMissing.TheDefaultKeywordDoesNotDoAnythingIfThePropertyIsMissingMapBuilder() + .alpha(1) + + .build(), + configuration +); +``` + +### Field Summary +| Modifier and Type | Field and Description | +| ----------------- | ---------------------- | +| Set> | type = setOf(Map::class.java) | +| Map> | properties = mapOf(
    "alpha" to [Alpha::class.java](#alpha))
)
| + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| [TheDefaultKeywordDoesNotDoAnythingIfThePropertyIsMissingMap](#thedefaultkeyworddoesnotdoanythingifthepropertyismissingmap) | validate(arg: [Map<?, ?>](#thedefaultkeyworddoesnotdoanythingifthepropertyismissingmapbuilder), configuration: SchemaConfiguration) | +| [TheDefaultKeywordDoesNotDoAnythingIfThePropertyIsMissing1BoxedMap](#thedefaultkeyworddoesnotdoanythingifthepropertyismissing1boxedmap) | validateAndBox([Map<?, ?>](#thedefaultkeyworddoesnotdoanythingifthepropertyismissingmapbuilder), configuration: SchemaConfiguration) | +| [TheDefaultKeywordDoesNotDoAnythingIfThePropertyIsMissing1Boxed](#thedefaultkeyworddoesnotdoanythingifthepropertyismissing1boxed) | validateAndBox(Any?, configuration: SchemaConfiguration) | +| Any? | validate(arg: Any?, configuration: SchemaConfiguration) | + +## TheDefaultKeywordDoesNotDoAnythingIfThePropertyIsMissingMapBuilder +class TheDefaultKeywordDoesNotDoAnythingIfThePropertyIsMissingMapBuilder
+builder for `Map` + +A class that builds the Map input type + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| TheDefaultKeywordDoesNotDoAnythingIfThePropertyIsMissingMapBuilder()
Creates a builder that contains an empty map | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| Map | build()
Returns map input that should be used with Schema.validate | +| [TheDefaultKeywordDoesNotDoAnythingIfThePropertyIsMissingMapBuilder](#thedefaultkeyworddoesnotdoanythingifthepropertyismissingmapbuilder) | alpha(value: Int) | +| [TheDefaultKeywordDoesNotDoAnythingIfThePropertyIsMissingMapBuilder](#thedefaultkeyworddoesnotdoanythingifthepropertyismissingmapbuilder) | alpha(value: Float) | +| [TheDefaultKeywordDoesNotDoAnythingIfThePropertyIsMissingMapBuilder](#thedefaultkeyworddoesnotdoanythingifthepropertyismissingmapbuilder) | alpha(value: Long) | +| [TheDefaultKeywordDoesNotDoAnythingIfThePropertyIsMissingMapBuilder](#thedefaultkeyworddoesnotdoanythingifthepropertyismissingmapbuilder) | alpha(value: Double) | +| [TheDefaultKeywordDoesNotDoAnythingIfThePropertyIsMissingMapBuilder](#thedefaultkeyworddoesnotdoanythingifthepropertyismissingmapbuilder) | additionalProperty(key: String, value: Nothing?) | +| [TheDefaultKeywordDoesNotDoAnythingIfThePropertyIsMissingMapBuilder](#thedefaultkeyworddoesnotdoanythingifthepropertyismissingmapbuilder) | additionalProperty(key: String, value: Boolean) | +| [TheDefaultKeywordDoesNotDoAnythingIfThePropertyIsMissingMapBuilder](#thedefaultkeyworddoesnotdoanythingifthepropertyismissingmapbuilder) | additionalProperty(key: String, value: String) | +| [TheDefaultKeywordDoesNotDoAnythingIfThePropertyIsMissingMapBuilder](#thedefaultkeyworddoesnotdoanythingifthepropertyismissingmapbuilder) | additionalProperty(key: String, value: Int) | +| [TheDefaultKeywordDoesNotDoAnythingIfThePropertyIsMissingMapBuilder](#thedefaultkeyworddoesnotdoanythingifthepropertyismissingmapbuilder) | additionalProperty(key: String, value: Float) | +| [TheDefaultKeywordDoesNotDoAnythingIfThePropertyIsMissingMapBuilder](#thedefaultkeyworddoesnotdoanythingifthepropertyismissingmapbuilder) | additionalProperty(key: String, value: Long) | +| [TheDefaultKeywordDoesNotDoAnythingIfThePropertyIsMissingMapBuilder](#thedefaultkeyworddoesnotdoanythingifthepropertyismissingmapbuilder) | additionalProperty(key: String, value: Double) | +| [TheDefaultKeywordDoesNotDoAnythingIfThePropertyIsMissingMapBuilder](#thedefaultkeyworddoesnotdoanythingifthepropertyismissingmapbuilder) | additionalProperty(key: String, value: List) | +| [TheDefaultKeywordDoesNotDoAnythingIfThePropertyIsMissingMapBuilder](#thedefaultkeyworddoesnotdoanythingifthepropertyismissingmapbuilder) | additionalProperty(key: String, value: Map) | + +## TheDefaultKeywordDoesNotDoAnythingIfThePropertyIsMissingMap +class TheDefaultKeywordDoesNotDoAnythingIfThePropertyIsMissingMap
+extends FrozenMap + +A class to store validated Map payloads + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| static [TheDefaultKeywordDoesNotDoAnythingIfThePropertyIsMissingMap](#thedefaultkeyworddoesnotdoanythingifthepropertyismissingmap) | of([Map](#thedefaultkeyworddoesnotdoanythingifthepropertyismissingmapbuilder) arg, SchemaConfiguration configuration) | +| Number | alpha()
[optional] if omitted the server will use the default value of 5.0 | +| Any? | getAdditionalProperty(String name)
provides type safety for additional properties | + +## AlphaBoxed +sealed interface AlphaBoxed
+permits
+[AlphaBoxedNumber](#alphaboxednumber) + +sealed interface that stores validated payloads using boxed classes + +## AlphaBoxedNumber +data class AlphaBoxedNumber
+implements [AlphaBoxed](#alphaboxed) + +data class that stores validated Number payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| AlphaBoxedNumber(Number data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| Number | data()
validated payload | +| Any? | getData()
validated payload | + +## Alpha +class Alpha
+extends JsonSchema + +A schema class that validates payloads + +### Code Sample +``` +import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags; +import org.openapijsonschematools.client.configurations.SchemaConfiguration; +import org.openapijsonschematools.client.exceptions.ValidationException; +import org.openapijsonschematools.client.schemas.validation.MapUtils; +import org.openapijsonschematools.client.schemas.validation.FrozenList; +import org.openapijsonschematools.client.schemas.validation.FrozenMap; +import org.openapijsonschematools.client.components.schemas.TheDefaultKeywordDoesNotDoAnythingIfThePropertyIsMissing; + +import java.util.Arrays; +import java.util.List; +import java.util.AbstractMap; + +static final SchemaConfiguration configuration = new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().build()); + +// int validation +int validatedPayload = TheDefaultKeywordDoesNotDoAnythingIfThePropertyIsMissing.Alpha.validate( + 1, + configuration +); +``` + +### Field Summary +| Modifier and Type | Field and Description | +| ----------------- | ---------------------- | +| Set> | type = setOf(
    Int::class.java,
    Long::class.java,
    Float::class.java,
    Double::class.java
)
| +| Number | maximum = 3 | +| Any? | defaultValue = 5.0 | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| Number | validate(arg: Number, configuration: SchemaConfiguration) | +| [AlphaBoxedNumber](#alphaboxednumber) | validateAndBox(Number, configuration: SchemaConfiguration) | +| [AlphaBoxed](#alphaboxed) | validateAndBox(Any?, configuration: SchemaConfiguration) | +| Any? | validate(arg: Any?, configuration: SchemaConfiguration) | + +[[Back to top]](#top) [[Back to Component Schemas]](../../../README.md#Component-Schemas) [[Back to README]](../../../README.md) diff --git a/samples/client/3_0_3_unit_test/kotlin/docs/components/schemas/UniqueitemsFalseValidation.md b/samples/client/3_0_3_unit_test/kotlin/docs/components/schemas/UniqueitemsFalseValidation.md new file mode 100644 index 00000000000..5529c997fa9 --- /dev/null +++ b/samples/client/3_0_3_unit_test/kotlin/docs/components/schemas/UniqueitemsFalseValidation.md @@ -0,0 +1,169 @@ +# UniqueitemsFalseValidation +org.openapijsonschematools.client.components.schemas.UniqueitemsFalseValidation.java +class UniqueitemsFalseValidation
+ +A class that contains necessary nested +- schema classes (which validate payloads), extends JsonSchema +- sealed interfaces which store validated payloads, Kotlin version of a sum type +- boxed classes which store validated payloads, sealed permits class implementations + +## Nested Class Summary +| Modifier and Type | Class and Description | +| ----------------- | ---------------------- | +| sealed interface | [UniqueitemsFalseValidation.UniqueitemsFalseValidation1Boxed](#uniqueitemsfalsevalidation1boxed)
sealed interface for validated payloads | +| record | [UniqueitemsFalseValidation.UniqueitemsFalseValidation1BoxedVoid](#uniqueitemsfalsevalidation1boxedvoid)
boxed class to store validated null payloads | +| record | [UniqueitemsFalseValidation.UniqueitemsFalseValidation1BoxedBoolean](#uniqueitemsfalsevalidation1boxedboolean)
boxed class to store validated boolean payloads | +| record | [UniqueitemsFalseValidation.UniqueitemsFalseValidation1BoxedNumber](#uniqueitemsfalsevalidation1boxednumber)
boxed class to store validated Number payloads | +| record | [UniqueitemsFalseValidation.UniqueitemsFalseValidation1BoxedString](#uniqueitemsfalsevalidation1boxedstring)
boxed class to store validated String payloads | +| record | [UniqueitemsFalseValidation.UniqueitemsFalseValidation1BoxedList](#uniqueitemsfalsevalidation1boxedlist)
boxed class to store validated List payloads | +| record | [UniqueitemsFalseValidation.UniqueitemsFalseValidation1BoxedMap](#uniqueitemsfalsevalidation1boxedmap)
boxed class to store validated Map payloads | +| static class | [UniqueitemsFalseValidation.UniqueitemsFalseValidation1](#uniqueitemsfalsevalidation1)
schema class | + +## UniqueitemsFalseValidation1Boxed +sealed interface UniqueitemsFalseValidation1Boxed
+permits
+[UniqueitemsFalseValidation1BoxedVoid](#uniqueitemsfalsevalidation1boxedvoid), +[UniqueitemsFalseValidation1BoxedBoolean](#uniqueitemsfalsevalidation1boxedboolean), +[UniqueitemsFalseValidation1BoxedNumber](#uniqueitemsfalsevalidation1boxednumber), +[UniqueitemsFalseValidation1BoxedString](#uniqueitemsfalsevalidation1boxedstring), +[UniqueitemsFalseValidation1BoxedList](#uniqueitemsfalsevalidation1boxedlist), +[UniqueitemsFalseValidation1BoxedMap](#uniqueitemsfalsevalidation1boxedmap) + +sealed interface that stores validated payloads using boxed classes + +## UniqueitemsFalseValidation1BoxedVoid +data class UniqueitemsFalseValidation1BoxedVoid
+implements [UniqueitemsFalseValidation1Boxed](#uniqueitemsfalsevalidation1boxed) + +data class that stores validated null payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| UniqueitemsFalseValidation1BoxedVoid(Nothing? data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| Nothing? | data()
validated payload | +| Any? | getData()
validated payload | + +## UniqueitemsFalseValidation1BoxedBoolean +data class UniqueitemsFalseValidation1BoxedBoolean
+implements [UniqueitemsFalseValidation1Boxed](#uniqueitemsfalsevalidation1boxed) + +record that stores validated boolean payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| UniqueitemsFalseValidation1BoxedBoolean(boolean data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| boolean | data()
validated payload | +| Any? | getData()
validated payload | + +## UniqueitemsFalseValidation1BoxedNumber +data class UniqueitemsFalseValidation1BoxedNumber
+implements [UniqueitemsFalseValidation1Boxed](#uniqueitemsfalsevalidation1boxed) + +data class that stores validated Number payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| UniqueitemsFalseValidation1BoxedNumber(Number data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| Number | data()
validated payload | +| Any? | getData()
validated payload | + +## UniqueitemsFalseValidation1BoxedString +data class UniqueitemsFalseValidation1BoxedString
+implements [UniqueitemsFalseValidation1Boxed](#uniqueitemsfalsevalidation1boxed) + +data class that stores validated String payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| UniqueitemsFalseValidation1BoxedString(String data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| String | data()
validated payload | +| Any? | getData()
validated payload | + +## UniqueitemsFalseValidation1BoxedList +data class UniqueitemsFalseValidation1BoxedList
+implements [UniqueitemsFalseValidation1Boxed](#uniqueitemsfalsevalidation1boxed) + +data class that stores validated List payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| UniqueitemsFalseValidation1BoxedList(FrozenList data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| FrozenList | data()
validated payload | +| Any? | getData()
validated payload | + +## UniqueitemsFalseValidation1BoxedMap +data class UniqueitemsFalseValidation1BoxedMap
+implements [UniqueitemsFalseValidation1Boxed](#uniqueitemsfalsevalidation1boxed) + +data class that stores validated Map payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| UniqueitemsFalseValidation1BoxedMap(FrozenMap data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| FrozenMap | data()
validated payload | +| Any? | getData()
validated payload | + +## UniqueitemsFalseValidation1 +class UniqueitemsFalseValidation1
+extends JsonSchema + +A schema class that validates payloads + +### Field Summary +| Modifier and Type | Field and Description | +| ----------------- | ---------------------- | +| Boolean | uniqueItems = false | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| String | validate(arg: String, configuration: SchemaConfiguration) | +| Nothing? | validate(arg: Nothing?, configuration: SchemaConfiguration) | +| int | validate(arg: int, configuration: SchemaConfiguration) | +| long | validate(arg: long, configuration: SchemaConfiguration) | +| float | validate(arg: float, configuration: SchemaConfiguration) | +| double | validate(arg: double, configuration: SchemaConfiguration) | +| Number | validate(arg: Number, configuration: SchemaConfiguration) | +| boolean | validate(arg: boolean, configuration: SchemaConfiguration) | +| FrozenMap | validate(arg: Map<?, ?>, configuration: SchemaConfiguration) | +| FrozenList | validate(arg: List<*>, configuration: SchemaConfiguration) | +| [UniqueitemsFalseValidation1BoxedString](#uniqueitemsfalsevalidation1boxedstring) | validateAndBox(String, configuration: SchemaConfiguration) | +| [UniqueitemsFalseValidation1BoxedVoid](#uniqueitemsfalsevalidation1boxedvoid) | validateAndBox(Nothing?, configuration: SchemaConfiguration) | +| [UniqueitemsFalseValidation1BoxedNumber](#uniqueitemsfalsevalidation1boxednumber) | validateAndBox(Number, configuration: SchemaConfiguration) | +| [UniqueitemsFalseValidation1BoxedBoolean](#uniqueitemsfalsevalidation1boxedboolean) | validateAndBox(boolean, configuration: SchemaConfiguration) | +| [UniqueitemsFalseValidation1BoxedMap](#uniqueitemsfalsevalidation1boxedmap) | validateAndBox(Map<?, ?>, configuration: SchemaConfiguration) | +| [UniqueitemsFalseValidation1BoxedList](#uniqueitemsfalsevalidation1boxedlist) | validateAndBox(List<*>, configuration: SchemaConfiguration) | +| [UniqueitemsFalseValidation1Boxed](#uniqueitemsfalsevalidation1boxed) | validateAndBox(Any?, configuration: SchemaConfiguration) | +| Any? | validate(arg: Any?, configuration: SchemaConfiguration) | + +[[Back to top]](#top) [[Back to Component Schemas]](../../../README.md#Component-Schemas) [[Back to README]](../../../README.md) diff --git a/samples/client/3_0_3_unit_test/kotlin/docs/components/schemas/UniqueitemsValidation.md b/samples/client/3_0_3_unit_test/kotlin/docs/components/schemas/UniqueitemsValidation.md new file mode 100644 index 00000000000..09861dec784 --- /dev/null +++ b/samples/client/3_0_3_unit_test/kotlin/docs/components/schemas/UniqueitemsValidation.md @@ -0,0 +1,169 @@ +# UniqueitemsValidation +org.openapijsonschematools.client.components.schemas.UniqueitemsValidation.java +class UniqueitemsValidation
+ +A class that contains necessary nested +- schema classes (which validate payloads), extends JsonSchema +- sealed interfaces which store validated payloads, Kotlin version of a sum type +- boxed classes which store validated payloads, sealed permits class implementations + +## Nested Class Summary +| Modifier and Type | Class and Description | +| ----------------- | ---------------------- | +| sealed interface | [UniqueitemsValidation.UniqueitemsValidation1Boxed](#uniqueitemsvalidation1boxed)
sealed interface for validated payloads | +| record | [UniqueitemsValidation.UniqueitemsValidation1BoxedVoid](#uniqueitemsvalidation1boxedvoid)
boxed class to store validated null payloads | +| record | [UniqueitemsValidation.UniqueitemsValidation1BoxedBoolean](#uniqueitemsvalidation1boxedboolean)
boxed class to store validated boolean payloads | +| record | [UniqueitemsValidation.UniqueitemsValidation1BoxedNumber](#uniqueitemsvalidation1boxednumber)
boxed class to store validated Number payloads | +| record | [UniqueitemsValidation.UniqueitemsValidation1BoxedString](#uniqueitemsvalidation1boxedstring)
boxed class to store validated String payloads | +| record | [UniqueitemsValidation.UniqueitemsValidation1BoxedList](#uniqueitemsvalidation1boxedlist)
boxed class to store validated List payloads | +| record | [UniqueitemsValidation.UniqueitemsValidation1BoxedMap](#uniqueitemsvalidation1boxedmap)
boxed class to store validated Map payloads | +| static class | [UniqueitemsValidation.UniqueitemsValidation1](#uniqueitemsvalidation1)
schema class | + +## UniqueitemsValidation1Boxed +sealed interface UniqueitemsValidation1Boxed
+permits
+[UniqueitemsValidation1BoxedVoid](#uniqueitemsvalidation1boxedvoid), +[UniqueitemsValidation1BoxedBoolean](#uniqueitemsvalidation1boxedboolean), +[UniqueitemsValidation1BoxedNumber](#uniqueitemsvalidation1boxednumber), +[UniqueitemsValidation1BoxedString](#uniqueitemsvalidation1boxedstring), +[UniqueitemsValidation1BoxedList](#uniqueitemsvalidation1boxedlist), +[UniqueitemsValidation1BoxedMap](#uniqueitemsvalidation1boxedmap) + +sealed interface that stores validated payloads using boxed classes + +## UniqueitemsValidation1BoxedVoid +data class UniqueitemsValidation1BoxedVoid
+implements [UniqueitemsValidation1Boxed](#uniqueitemsvalidation1boxed) + +data class that stores validated null payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| UniqueitemsValidation1BoxedVoid(Nothing? data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| Nothing? | data()
validated payload | +| Any? | getData()
validated payload | + +## UniqueitemsValidation1BoxedBoolean +data class UniqueitemsValidation1BoxedBoolean
+implements [UniqueitemsValidation1Boxed](#uniqueitemsvalidation1boxed) + +record that stores validated boolean payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| UniqueitemsValidation1BoxedBoolean(boolean data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| boolean | data()
validated payload | +| Any? | getData()
validated payload | + +## UniqueitemsValidation1BoxedNumber +data class UniqueitemsValidation1BoxedNumber
+implements [UniqueitemsValidation1Boxed](#uniqueitemsvalidation1boxed) + +data class that stores validated Number payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| UniqueitemsValidation1BoxedNumber(Number data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| Number | data()
validated payload | +| Any? | getData()
validated payload | + +## UniqueitemsValidation1BoxedString +data class UniqueitemsValidation1BoxedString
+implements [UniqueitemsValidation1Boxed](#uniqueitemsvalidation1boxed) + +data class that stores validated String payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| UniqueitemsValidation1BoxedString(String data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| String | data()
validated payload | +| Any? | getData()
validated payload | + +## UniqueitemsValidation1BoxedList +data class UniqueitemsValidation1BoxedList
+implements [UniqueitemsValidation1Boxed](#uniqueitemsvalidation1boxed) + +data class that stores validated List payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| UniqueitemsValidation1BoxedList(FrozenList data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| FrozenList | data()
validated payload | +| Any? | getData()
validated payload | + +## UniqueitemsValidation1BoxedMap +data class UniqueitemsValidation1BoxedMap
+implements [UniqueitemsValidation1Boxed](#uniqueitemsvalidation1boxed) + +data class that stores validated Map payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| UniqueitemsValidation1BoxedMap(FrozenMap data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| FrozenMap | data()
validated payload | +| Any? | getData()
validated payload | + +## UniqueitemsValidation1 +class UniqueitemsValidation1
+extends JsonSchema + +A schema class that validates payloads + +### Field Summary +| Modifier and Type | Field and Description | +| ----------------- | ---------------------- | +| Boolean | uniqueItems = true | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| String | validate(arg: String, configuration: SchemaConfiguration) | +| Nothing? | validate(arg: Nothing?, configuration: SchemaConfiguration) | +| int | validate(arg: int, configuration: SchemaConfiguration) | +| long | validate(arg: long, configuration: SchemaConfiguration) | +| float | validate(arg: float, configuration: SchemaConfiguration) | +| double | validate(arg: double, configuration: SchemaConfiguration) | +| Number | validate(arg: Number, configuration: SchemaConfiguration) | +| boolean | validate(arg: boolean, configuration: SchemaConfiguration) | +| FrozenMap | validate(arg: Map<?, ?>, configuration: SchemaConfiguration) | +| FrozenList | validate(arg: List<*>, configuration: SchemaConfiguration) | +| [UniqueitemsValidation1BoxedString](#uniqueitemsvalidation1boxedstring) | validateAndBox(String, configuration: SchemaConfiguration) | +| [UniqueitemsValidation1BoxedVoid](#uniqueitemsvalidation1boxedvoid) | validateAndBox(Nothing?, configuration: SchemaConfiguration) | +| [UniqueitemsValidation1BoxedNumber](#uniqueitemsvalidation1boxednumber) | validateAndBox(Number, configuration: SchemaConfiguration) | +| [UniqueitemsValidation1BoxedBoolean](#uniqueitemsvalidation1boxedboolean) | validateAndBox(boolean, configuration: SchemaConfiguration) | +| [UniqueitemsValidation1BoxedMap](#uniqueitemsvalidation1boxedmap) | validateAndBox(Map<?, ?>, configuration: SchemaConfiguration) | +| [UniqueitemsValidation1BoxedList](#uniqueitemsvalidation1boxedlist) | validateAndBox(List<*>, configuration: SchemaConfiguration) | +| [UniqueitemsValidation1Boxed](#uniqueitemsvalidation1boxed) | validateAndBox(Any?, configuration: SchemaConfiguration) | +| Any? | validate(arg: Any?, configuration: SchemaConfiguration) | + +[[Back to top]](#top) [[Back to Component Schemas]](../../../README.md#Component-Schemas) [[Back to README]](../../../README.md) diff --git a/samples/client/3_0_3_unit_test/kotlin/docs/components/schemas/UriFormat.md b/samples/client/3_0_3_unit_test/kotlin/docs/components/schemas/UriFormat.md new file mode 100644 index 00000000000..ee78e984294 --- /dev/null +++ b/samples/client/3_0_3_unit_test/kotlin/docs/components/schemas/UriFormat.md @@ -0,0 +1,169 @@ +# UriFormat +org.openapijsonschematools.client.components.schemas.UriFormat.java +class UriFormat
+ +A class that contains necessary nested +- schema classes (which validate payloads), extends JsonSchema +- sealed interfaces which store validated payloads, Kotlin version of a sum type +- boxed classes which store validated payloads, sealed permits class implementations + +## Nested Class Summary +| Modifier and Type | Class and Description | +| ----------------- | ---------------------- | +| sealed interface | [UriFormat.UriFormat1Boxed](#uriformat1boxed)
sealed interface for validated payloads | +| record | [UriFormat.UriFormat1BoxedVoid](#uriformat1boxedvoid)
boxed class to store validated null payloads | +| record | [UriFormat.UriFormat1BoxedBoolean](#uriformat1boxedboolean)
boxed class to store validated boolean payloads | +| record | [UriFormat.UriFormat1BoxedNumber](#uriformat1boxednumber)
boxed class to store validated Number payloads | +| record | [UriFormat.UriFormat1BoxedString](#uriformat1boxedstring)
boxed class to store validated String payloads | +| record | [UriFormat.UriFormat1BoxedList](#uriformat1boxedlist)
boxed class to store validated List payloads | +| record | [UriFormat.UriFormat1BoxedMap](#uriformat1boxedmap)
boxed class to store validated Map payloads | +| static class | [UriFormat.UriFormat1](#uriformat1)
schema class | + +## UriFormat1Boxed +sealed interface UriFormat1Boxed
+permits
+[UriFormat1BoxedVoid](#uriformat1boxedvoid), +[UriFormat1BoxedBoolean](#uriformat1boxedboolean), +[UriFormat1BoxedNumber](#uriformat1boxednumber), +[UriFormat1BoxedString](#uriformat1boxedstring), +[UriFormat1BoxedList](#uriformat1boxedlist), +[UriFormat1BoxedMap](#uriformat1boxedmap) + +sealed interface that stores validated payloads using boxed classes + +## UriFormat1BoxedVoid +data class UriFormat1BoxedVoid
+implements [UriFormat1Boxed](#uriformat1boxed) + +data class that stores validated null payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| UriFormat1BoxedVoid(Nothing? data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| Nothing? | data()
validated payload | +| Any? | getData()
validated payload | + +## UriFormat1BoxedBoolean +data class UriFormat1BoxedBoolean
+implements [UriFormat1Boxed](#uriformat1boxed) + +record that stores validated boolean payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| UriFormat1BoxedBoolean(boolean data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| boolean | data()
validated payload | +| Any? | getData()
validated payload | + +## UriFormat1BoxedNumber +data class UriFormat1BoxedNumber
+implements [UriFormat1Boxed](#uriformat1boxed) + +data class that stores validated Number payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| UriFormat1BoxedNumber(Number data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| Number | data()
validated payload | +| Any? | getData()
validated payload | + +## UriFormat1BoxedString +data class UriFormat1BoxedString
+implements [UriFormat1Boxed](#uriformat1boxed) + +data class that stores validated String payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| UriFormat1BoxedString(String data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| String | data()
validated payload | +| Any? | getData()
validated payload | + +## UriFormat1BoxedList +data class UriFormat1BoxedList
+implements [UriFormat1Boxed](#uriformat1boxed) + +data class that stores validated List payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| UriFormat1BoxedList(FrozenList data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| FrozenList | data()
validated payload | +| Any? | getData()
validated payload | + +## UriFormat1BoxedMap +data class UriFormat1BoxedMap
+implements [UriFormat1Boxed](#uriformat1boxed) + +data class that stores validated Map payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| UriFormat1BoxedMap(FrozenMap data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| FrozenMap | data()
validated payload | +| Any? | getData()
validated payload | + +## UriFormat1 +class UriFormat1
+extends JsonSchema + +A schema class that validates payloads + +### Field Summary +| Modifier and Type | Field and Description | +| ----------------- | ---------------------- | +| String | type = "uri"; | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| String | validate(arg: String, configuration: SchemaConfiguration) | +| Nothing? | validate(arg: Nothing?, configuration: SchemaConfiguration) | +| int | validate(arg: int, configuration: SchemaConfiguration) | +| long | validate(arg: long, configuration: SchemaConfiguration) | +| float | validate(arg: float, configuration: SchemaConfiguration) | +| double | validate(arg: double, configuration: SchemaConfiguration) | +| Number | validate(arg: Number, configuration: SchemaConfiguration) | +| boolean | validate(arg: boolean, configuration: SchemaConfiguration) | +| FrozenMap | validate(arg: Map<?, ?>, configuration: SchemaConfiguration) | +| FrozenList | validate(arg: List<*>, configuration: SchemaConfiguration) | +| [UriFormat1BoxedString](#uriformat1boxedstring) | validateAndBox(String, configuration: SchemaConfiguration) | +| [UriFormat1BoxedVoid](#uriformat1boxedvoid) | validateAndBox(Nothing?, configuration: SchemaConfiguration) | +| [UriFormat1BoxedNumber](#uriformat1boxednumber) | validateAndBox(Number, configuration: SchemaConfiguration) | +| [UriFormat1BoxedBoolean](#uriformat1boxedboolean) | validateAndBox(boolean, configuration: SchemaConfiguration) | +| [UriFormat1BoxedMap](#uriformat1boxedmap) | validateAndBox(Map<?, ?>, configuration: SchemaConfiguration) | +| [UriFormat1BoxedList](#uriformat1boxedlist) | validateAndBox(List<*>, configuration: SchemaConfiguration) | +| [UriFormat1Boxed](#uriformat1boxed) | validateAndBox(Any?, configuration: SchemaConfiguration) | +| Any? | validate(arg: Any?, configuration: SchemaConfiguration) | + +[[Back to top]](#top) [[Back to Component Schemas]](../../../README.md#Component-Schemas) [[Back to README]](../../../README.md) diff --git a/samples/client/3_0_3_unit_test/kotlin/docs/components/schemas/UriReferenceFormat.md b/samples/client/3_0_3_unit_test/kotlin/docs/components/schemas/UriReferenceFormat.md new file mode 100644 index 00000000000..34c794017c3 --- /dev/null +++ b/samples/client/3_0_3_unit_test/kotlin/docs/components/schemas/UriReferenceFormat.md @@ -0,0 +1,169 @@ +# UriReferenceFormat +org.openapijsonschematools.client.components.schemas.UriReferenceFormat.java +class UriReferenceFormat
+ +A class that contains necessary nested +- schema classes (which validate payloads), extends JsonSchema +- sealed interfaces which store validated payloads, Kotlin version of a sum type +- boxed classes which store validated payloads, sealed permits class implementations + +## Nested Class Summary +| Modifier and Type | Class and Description | +| ----------------- | ---------------------- | +| sealed interface | [UriReferenceFormat.UriReferenceFormat1Boxed](#urireferenceformat1boxed)
sealed interface for validated payloads | +| record | [UriReferenceFormat.UriReferenceFormat1BoxedVoid](#urireferenceformat1boxedvoid)
boxed class to store validated null payloads | +| record | [UriReferenceFormat.UriReferenceFormat1BoxedBoolean](#urireferenceformat1boxedboolean)
boxed class to store validated boolean payloads | +| record | [UriReferenceFormat.UriReferenceFormat1BoxedNumber](#urireferenceformat1boxednumber)
boxed class to store validated Number payloads | +| record | [UriReferenceFormat.UriReferenceFormat1BoxedString](#urireferenceformat1boxedstring)
boxed class to store validated String payloads | +| record | [UriReferenceFormat.UriReferenceFormat1BoxedList](#urireferenceformat1boxedlist)
boxed class to store validated List payloads | +| record | [UriReferenceFormat.UriReferenceFormat1BoxedMap](#urireferenceformat1boxedmap)
boxed class to store validated Map payloads | +| static class | [UriReferenceFormat.UriReferenceFormat1](#urireferenceformat1)
schema class | + +## UriReferenceFormat1Boxed +sealed interface UriReferenceFormat1Boxed
+permits
+[UriReferenceFormat1BoxedVoid](#urireferenceformat1boxedvoid), +[UriReferenceFormat1BoxedBoolean](#urireferenceformat1boxedboolean), +[UriReferenceFormat1BoxedNumber](#urireferenceformat1boxednumber), +[UriReferenceFormat1BoxedString](#urireferenceformat1boxedstring), +[UriReferenceFormat1BoxedList](#urireferenceformat1boxedlist), +[UriReferenceFormat1BoxedMap](#urireferenceformat1boxedmap) + +sealed interface that stores validated payloads using boxed classes + +## UriReferenceFormat1BoxedVoid +data class UriReferenceFormat1BoxedVoid
+implements [UriReferenceFormat1Boxed](#urireferenceformat1boxed) + +data class that stores validated null payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| UriReferenceFormat1BoxedVoid(Nothing? data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| Nothing? | data()
validated payload | +| Any? | getData()
validated payload | + +## UriReferenceFormat1BoxedBoolean +data class UriReferenceFormat1BoxedBoolean
+implements [UriReferenceFormat1Boxed](#urireferenceformat1boxed) + +record that stores validated boolean payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| UriReferenceFormat1BoxedBoolean(boolean data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| boolean | data()
validated payload | +| Any? | getData()
validated payload | + +## UriReferenceFormat1BoxedNumber +data class UriReferenceFormat1BoxedNumber
+implements [UriReferenceFormat1Boxed](#urireferenceformat1boxed) + +data class that stores validated Number payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| UriReferenceFormat1BoxedNumber(Number data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| Number | data()
validated payload | +| Any? | getData()
validated payload | + +## UriReferenceFormat1BoxedString +data class UriReferenceFormat1BoxedString
+implements [UriReferenceFormat1Boxed](#urireferenceformat1boxed) + +data class that stores validated String payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| UriReferenceFormat1BoxedString(String data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| String | data()
validated payload | +| Any? | getData()
validated payload | + +## UriReferenceFormat1BoxedList +data class UriReferenceFormat1BoxedList
+implements [UriReferenceFormat1Boxed](#urireferenceformat1boxed) + +data class that stores validated List payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| UriReferenceFormat1BoxedList(FrozenList data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| FrozenList | data()
validated payload | +| Any? | getData()
validated payload | + +## UriReferenceFormat1BoxedMap +data class UriReferenceFormat1BoxedMap
+implements [UriReferenceFormat1Boxed](#urireferenceformat1boxed) + +data class that stores validated Map payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| UriReferenceFormat1BoxedMap(FrozenMap data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| FrozenMap | data()
validated payload | +| Any? | getData()
validated payload | + +## UriReferenceFormat1 +class UriReferenceFormat1
+extends JsonSchema + +A schema class that validates payloads + +### Field Summary +| Modifier and Type | Field and Description | +| ----------------- | ---------------------- | +| String | type = "uri-reference"; | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| String | validate(arg: String, configuration: SchemaConfiguration) | +| Nothing? | validate(arg: Nothing?, configuration: SchemaConfiguration) | +| int | validate(arg: int, configuration: SchemaConfiguration) | +| long | validate(arg: long, configuration: SchemaConfiguration) | +| float | validate(arg: float, configuration: SchemaConfiguration) | +| double | validate(arg: double, configuration: SchemaConfiguration) | +| Number | validate(arg: Number, configuration: SchemaConfiguration) | +| boolean | validate(arg: boolean, configuration: SchemaConfiguration) | +| FrozenMap | validate(arg: Map<?, ?>, configuration: SchemaConfiguration) | +| FrozenList | validate(arg: List<*>, configuration: SchemaConfiguration) | +| [UriReferenceFormat1BoxedString](#urireferenceformat1boxedstring) | validateAndBox(String, configuration: SchemaConfiguration) | +| [UriReferenceFormat1BoxedVoid](#urireferenceformat1boxedvoid) | validateAndBox(Nothing?, configuration: SchemaConfiguration) | +| [UriReferenceFormat1BoxedNumber](#urireferenceformat1boxednumber) | validateAndBox(Number, configuration: SchemaConfiguration) | +| [UriReferenceFormat1BoxedBoolean](#urireferenceformat1boxedboolean) | validateAndBox(boolean, configuration: SchemaConfiguration) | +| [UriReferenceFormat1BoxedMap](#urireferenceformat1boxedmap) | validateAndBox(Map<?, ?>, configuration: SchemaConfiguration) | +| [UriReferenceFormat1BoxedList](#urireferenceformat1boxedlist) | validateAndBox(List<*>, configuration: SchemaConfiguration) | +| [UriReferenceFormat1Boxed](#urireferenceformat1boxed) | validateAndBox(Any?, configuration: SchemaConfiguration) | +| Any? | validate(arg: Any?, configuration: SchemaConfiguration) | + +[[Back to top]](#top) [[Back to Component Schemas]](../../../README.md#Component-Schemas) [[Back to README]](../../../README.md) diff --git a/samples/client/3_0_3_unit_test/kotlin/docs/components/schemas/UriTemplateFormat.md b/samples/client/3_0_3_unit_test/kotlin/docs/components/schemas/UriTemplateFormat.md new file mode 100644 index 00000000000..1c17c912d35 --- /dev/null +++ b/samples/client/3_0_3_unit_test/kotlin/docs/components/schemas/UriTemplateFormat.md @@ -0,0 +1,169 @@ +# UriTemplateFormat +org.openapijsonschematools.client.components.schemas.UriTemplateFormat.java +class UriTemplateFormat
+ +A class that contains necessary nested +- schema classes (which validate payloads), extends JsonSchema +- sealed interfaces which store validated payloads, Kotlin version of a sum type +- boxed classes which store validated payloads, sealed permits class implementations + +## Nested Class Summary +| Modifier and Type | Class and Description | +| ----------------- | ---------------------- | +| sealed interface | [UriTemplateFormat.UriTemplateFormat1Boxed](#uritemplateformat1boxed)
sealed interface for validated payloads | +| record | [UriTemplateFormat.UriTemplateFormat1BoxedVoid](#uritemplateformat1boxedvoid)
boxed class to store validated null payloads | +| record | [UriTemplateFormat.UriTemplateFormat1BoxedBoolean](#uritemplateformat1boxedboolean)
boxed class to store validated boolean payloads | +| record | [UriTemplateFormat.UriTemplateFormat1BoxedNumber](#uritemplateformat1boxednumber)
boxed class to store validated Number payloads | +| record | [UriTemplateFormat.UriTemplateFormat1BoxedString](#uritemplateformat1boxedstring)
boxed class to store validated String payloads | +| record | [UriTemplateFormat.UriTemplateFormat1BoxedList](#uritemplateformat1boxedlist)
boxed class to store validated List payloads | +| record | [UriTemplateFormat.UriTemplateFormat1BoxedMap](#uritemplateformat1boxedmap)
boxed class to store validated Map payloads | +| static class | [UriTemplateFormat.UriTemplateFormat1](#uritemplateformat1)
schema class | + +## UriTemplateFormat1Boxed +sealed interface UriTemplateFormat1Boxed
+permits
+[UriTemplateFormat1BoxedVoid](#uritemplateformat1boxedvoid), +[UriTemplateFormat1BoxedBoolean](#uritemplateformat1boxedboolean), +[UriTemplateFormat1BoxedNumber](#uritemplateformat1boxednumber), +[UriTemplateFormat1BoxedString](#uritemplateformat1boxedstring), +[UriTemplateFormat1BoxedList](#uritemplateformat1boxedlist), +[UriTemplateFormat1BoxedMap](#uritemplateformat1boxedmap) + +sealed interface that stores validated payloads using boxed classes + +## UriTemplateFormat1BoxedVoid +data class UriTemplateFormat1BoxedVoid
+implements [UriTemplateFormat1Boxed](#uritemplateformat1boxed) + +data class that stores validated null payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| UriTemplateFormat1BoxedVoid(Nothing? data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| Nothing? | data()
validated payload | +| Any? | getData()
validated payload | + +## UriTemplateFormat1BoxedBoolean +data class UriTemplateFormat1BoxedBoolean
+implements [UriTemplateFormat1Boxed](#uritemplateformat1boxed) + +record that stores validated boolean payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| UriTemplateFormat1BoxedBoolean(boolean data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| boolean | data()
validated payload | +| Any? | getData()
validated payload | + +## UriTemplateFormat1BoxedNumber +data class UriTemplateFormat1BoxedNumber
+implements [UriTemplateFormat1Boxed](#uritemplateformat1boxed) + +data class that stores validated Number payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| UriTemplateFormat1BoxedNumber(Number data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| Number | data()
validated payload | +| Any? | getData()
validated payload | + +## UriTemplateFormat1BoxedString +data class UriTemplateFormat1BoxedString
+implements [UriTemplateFormat1Boxed](#uritemplateformat1boxed) + +data class that stores validated String payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| UriTemplateFormat1BoxedString(String data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| String | data()
validated payload | +| Any? | getData()
validated payload | + +## UriTemplateFormat1BoxedList +data class UriTemplateFormat1BoxedList
+implements [UriTemplateFormat1Boxed](#uritemplateformat1boxed) + +data class that stores validated List payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| UriTemplateFormat1BoxedList(FrozenList data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| FrozenList | data()
validated payload | +| Any? | getData()
validated payload | + +## UriTemplateFormat1BoxedMap +data class UriTemplateFormat1BoxedMap
+implements [UriTemplateFormat1Boxed](#uritemplateformat1boxed) + +data class that stores validated Map payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| UriTemplateFormat1BoxedMap(FrozenMap data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| FrozenMap | data()
validated payload | +| Any? | getData()
validated payload | + +## UriTemplateFormat1 +class UriTemplateFormat1
+extends JsonSchema + +A schema class that validates payloads + +### Field Summary +| Modifier and Type | Field and Description | +| ----------------- | ---------------------- | +| String | type = "uri-template"; | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| String | validate(arg: String, configuration: SchemaConfiguration) | +| Nothing? | validate(arg: Nothing?, configuration: SchemaConfiguration) | +| int | validate(arg: int, configuration: SchemaConfiguration) | +| long | validate(arg: long, configuration: SchemaConfiguration) | +| float | validate(arg: float, configuration: SchemaConfiguration) | +| double | validate(arg: double, configuration: SchemaConfiguration) | +| Number | validate(arg: Number, configuration: SchemaConfiguration) | +| boolean | validate(arg: boolean, configuration: SchemaConfiguration) | +| FrozenMap | validate(arg: Map<?, ?>, configuration: SchemaConfiguration) | +| FrozenList | validate(arg: List<*>, configuration: SchemaConfiguration) | +| [UriTemplateFormat1BoxedString](#uritemplateformat1boxedstring) | validateAndBox(String, configuration: SchemaConfiguration) | +| [UriTemplateFormat1BoxedVoid](#uritemplateformat1boxedvoid) | validateAndBox(Nothing?, configuration: SchemaConfiguration) | +| [UriTemplateFormat1BoxedNumber](#uritemplateformat1boxednumber) | validateAndBox(Number, configuration: SchemaConfiguration) | +| [UriTemplateFormat1BoxedBoolean](#uritemplateformat1boxedboolean) | validateAndBox(boolean, configuration: SchemaConfiguration) | +| [UriTemplateFormat1BoxedMap](#uritemplateformat1boxedmap) | validateAndBox(Map<?, ?>, configuration: SchemaConfiguration) | +| [UriTemplateFormat1BoxedList](#uritemplateformat1boxedlist) | validateAndBox(List<*>, configuration: SchemaConfiguration) | +| [UriTemplateFormat1Boxed](#uritemplateformat1boxed) | validateAndBox(Any?, configuration: SchemaConfiguration) | +| Any? | validate(arg: Any?, configuration: SchemaConfiguration) | + +[[Back to top]](#top) [[Back to Component Schemas]](../../../README.md#Component-Schemas) [[Back to README]](../../../README.md) diff --git a/samples/client/petstore/kotlin/docs/servers/RootServer2.md b/samples/client/3_0_3_unit_test/kotlin/docs/servers/RootServer0.md similarity index 57% rename from samples/client/petstore/kotlin/docs/servers/RootServer2.md rename to samples/client/3_0_3_unit_test/kotlin/docs/servers/RootServer0.md index e220476499a..08ddb1be947 100644 --- a/samples/client/petstore/kotlin/docs/servers/RootServer2.md +++ b/samples/client/3_0_3_unit_test/kotlin/docs/servers/RootServer0.md @@ -1,20 +1,17 @@ -org.openapijsonschematools.client.servers.RootServer2 -# Server RootServer2 -public class RootServer2 +org.openapijsonschematools.client.servers.RootServer0 +# Server RootServer0 +public class RootServer0 A class that stores a server url -## Description -staging server with no variables - ### Constructor Summary | Constructor and Description | | --------------------------- | -| RootServer2()
Creates a server | +| RootServer0()
Creates a server | ### Field Summary | Modifier and Type | Field and Description | | ----------------- | --------------------- | -| String | url = "https://localhost:8080" | +| String | url = "https://someserver.com/v1" | [[Back to top]](#top) [[Back to Servers]](../../README.md#Servers) [[Back to README]](../../README.md) diff --git a/samples/client/3_0_3_unit_test/kotlin/settings.gradle.kts b/samples/client/3_0_3_unit_test/kotlin/settings.gradle.kts new file mode 100644 index 00000000000..65c368589f6 --- /dev/null +++ b/samples/client/3_0_3_unit_test/kotlin/settings.gradle.kts @@ -0,0 +1,2 @@ +rootProject.name = "unit-test-api" + diff --git a/samples/client/3_0_3_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/RootServerInfo.kt b/samples/client/3_0_3_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/RootServerInfo.kt new file mode 100644 index 00000000000..2d583252938 --- /dev/null +++ b/samples/client/3_0_3_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/RootServerInfo.kt @@ -0,0 +1,20 @@ +package org.openapijsonschematools.client + +import org.openapijsonschematools.client.servers.RootServer0 +import org.openapijsonschematools.client.servers.Server +import org.openapijsonschematools.client.servers.ServerProvider + +class RootServerInfo { + class RootServerInfo1( + private val server0: RootServer0 = RootServer0() + ) : ServerProvider { + + override fun getServer(serverIndex: ServerIndex): Server { + return server0 + } + } + + enum class ServerIndex { + SERVER_0 + } +} \ No newline at end of file diff --git a/samples/client/3_0_3_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/schemas/AdditionalpropertiesAllowsASchemaWhichShouldValidate.kt b/samples/client/3_0_3_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/schemas/AdditionalpropertiesAllowsASchemaWhichShouldValidate.kt new file mode 100644 index 00000000000..c7945bd6c82 --- /dev/null +++ b/samples/client/3_0_3_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/schemas/AdditionalpropertiesAllowsASchemaWhichShouldValidate.kt @@ -0,0 +1,351 @@ +package org.openapijsonschematools.client.components.schemas +import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags +import org.openapijsonschematools.client.configurations.SchemaConfiguration +import org.openapijsonschematools.client.exceptions.InvalidAdditionalPropertyException +import org.openapijsonschematools.client.exceptions.UnsetPropertyException +import org.openapijsonschematools.client.exceptions.ValidationException +import org.openapijsonschematools.client.schemas.AnyTypeJsonSchema +import org.openapijsonschematools.client.schemas.BooleanJsonSchema +import org.openapijsonschematools.client.schemas.GenericBuilder +import org.openapijsonschematools.client.schemas.validation.FrozenMap +import org.openapijsonschematools.client.schemas.validation.JsonSchema +import org.openapijsonschematools.client.schemas.validation.JsonSchemaInfo +import org.openapijsonschematools.client.schemas.validation.MapSchemaValidator +import org.openapijsonschematools.client.schemas.validation.MapUtils +import org.openapijsonschematools.client.schemas.validation.PathToSchemasMap +import org.openapijsonschematools.client.schemas.validation.ValidationMetadata + +class AdditionalpropertiesAllowsASchemaWhichShouldValidate { + // nest classes so all schemas and input/output classes can be public + + + class AdditionalProperties : BooleanJsonSchema.BooleanJsonSchema1() { + companion object { + @Volatile + private var instance: AdditionalProperties? = null + + fun getInstance() = + instance ?: synchronized(this) { + instance ?: AdditionalProperties().also { instance = it } + } + } + } + + + class Foo : AnyTypeJsonSchema.AnyTypeJsonSchema1() { + companion object { + @Volatile + private var instance: Foo? = null + + fun getInstance() = + instance ?: synchronized(this) { + instance ?: Foo().also { instance = it } + } + } + } + + + class Bar : AnyTypeJsonSchema.AnyTypeJsonSchema1() { + companion object { + @Volatile + private var instance: Bar? = null + + fun getInstance() = + instance ?: synchronized(this) { + instance ?: Bar().also { instance = it } + } + } + } + + + class AdditionalpropertiesAllowsASchemaWhichShouldValidateMap(m: FrozenMap) : FrozenMap(m) { + companion object { + val requiredKeys: Set = setOf() + val optionalKeys: Set = setOf( + "foo", + "bar" + ) + @Throws(ValidationException::class) + fun of(arg: Map, configuration: SchemaConfiguration): AdditionalpropertiesAllowsASchemaWhichShouldValidateMap { + return AdditionalpropertiesAllowsASchemaWhichShouldValidate1.getInstance().validate(arg, configuration) + } + } + + @Throws(UnsetPropertyException::class) + fun foo(): Any? { + return getOrThrow("foo") + } + + @Throws(UnsetPropertyException::class) + fun bar(): Any? { + return getOrThrow("bar") + } + + @Throws(UnsetPropertyException::class, InvalidAdditionalPropertyException::class) + fun getAdditionalProperty(name: String): Boolean { + throwIfKeyKnown(name, requiredKeys, optionalKeys) + val value = getOrThrow(name) + if (!(value is Boolean)) { + throw RuntimeException("Invalid value stored for " + name) + } + return value + } + } + + interface SetterForFoo { + fun getInstance(): MutableMap + fun getBuilderAfterFoo(instance: MutableMap): T + + fun foo(value: Nothing?): T { + val instance = getInstance() + instance["foo"] = null + return getBuilderAfterFoo(instance) + } + + fun foo(value: Boolean): T { + val instance = getInstance() + instance["foo"] = value + return getBuilderAfterFoo(instance) + } + + fun foo(value: String): T { + val instance = getInstance() + instance["foo"] = value + return getBuilderAfterFoo(instance) + } + + fun foo(value: Int): T { + val instance = getInstance() + instance["foo"] = value + return getBuilderAfterFoo(instance) + } + + fun foo(value: Float): T { + val instance = getInstance() + instance["foo"] = value + return getBuilderAfterFoo(instance) + } + + fun foo(value: Long): T { + val instance = getInstance() + instance["foo"] = value + return getBuilderAfterFoo(instance) + } + + fun foo(value: Double): T { + val instance = getInstance() + instance["foo"] = value + return getBuilderAfterFoo(instance) + } + + fun foo(value: List): T { + val instance = getInstance() + instance["foo"] = value + return getBuilderAfterFoo(instance) + } + + fun foo(value: Map): T { + val instance = getInstance() + instance["foo"] = value + return getBuilderAfterFoo(instance) + } + } + + interface SetterForBar { + fun getInstance(): MutableMap + fun getBuilderAfterBar(instance: MutableMap): T + + fun bar(value: Nothing?): T { + val instance = getInstance() + instance["bar"] = null + return getBuilderAfterBar(instance) + } + + fun bar(value: Boolean): T { + val instance = getInstance() + instance["bar"] = value + return getBuilderAfterBar(instance) + } + + fun bar(value: String): T { + val instance = getInstance() + instance["bar"] = value + return getBuilderAfterBar(instance) + } + + fun bar(value: Int): T { + val instance = getInstance() + instance["bar"] = value + return getBuilderAfterBar(instance) + } + + fun bar(value: Float): T { + val instance = getInstance() + instance["bar"] = value + return getBuilderAfterBar(instance) + } + + fun bar(value: Long): T { + val instance = getInstance() + instance["bar"] = value + return getBuilderAfterBar(instance) + } + + fun bar(value: Double): T { + val instance = getInstance() + instance["bar"] = value + return getBuilderAfterBar(instance) + } + + fun bar(value: List): T { + val instance = getInstance() + instance["bar"] = value + return getBuilderAfterBar(instance) + } + + fun bar(value: Map): T { + val instance = getInstance() + instance["bar"] = value + return getBuilderAfterBar(instance) + } + } + + interface SetterForAdditionalProperties { + fun getKnownKeys(): Set + fun getInstance(): MutableMap + fun getBuilderAfterAdditionalProperty(instance: MutableMap): T + + @Throws(InvalidAdditionalPropertyException::class) + fun additionalProperty(key: String, value: Boolean): T { + MapUtils.throwIfKeyKnown(key, getKnownKeys(), true) + val instance = getInstance() + instance[key] = value + return getBuilderAfterAdditionalProperty(instance) + } + } + + class AdditionalpropertiesAllowsASchemaWhichShouldValidateMapBuilder: GenericBuilder>, SetterForFoo, SetterForBar, SetterForAdditionalProperties { + private val knownKeys: Set = setOf( + "foo", + "bar" + ) + override fun getKnownKeys(): Set { + return knownKeys + } + private val instance: MutableMap + init { + this.instance = LinkedHashMap() + } + override fun build(): Map { + return instance + } + override fun getInstance(): MutableMap { + return instance + } + override fun getBuilderAfterFoo(instance: MutableMap): AdditionalpropertiesAllowsASchemaWhichShouldValidateMapBuilder { + return this + } + override fun getBuilderAfterBar(instance: MutableMap): AdditionalpropertiesAllowsASchemaWhichShouldValidateMapBuilder { + return this + } + override fun getBuilderAfterAdditionalProperty(instance: MutableMap): AdditionalpropertiesAllowsASchemaWhichShouldValidateMapBuilder { + return this + } + } + + + sealed interface AdditionalpropertiesAllowsASchemaWhichShouldValidate1Boxed { + fun getData(): Any? + } + + data class AdditionalpropertiesAllowsASchemaWhichShouldValidate1BoxedMap(val data: AdditionalpropertiesAllowsASchemaWhichShouldValidateMap) : AdditionalpropertiesAllowsASchemaWhichShouldValidate1Boxed { + override fun getData(): Any? { + return data + } + } + + + class AdditionalpropertiesAllowsASchemaWhichShouldValidate1 private constructor(): JsonSchema( + JsonSchemaInfo() + .type(setOf(Map::class.java)) + .properties(mapOf( + "foo" to Foo::class.java, + "bar" to Bar::class.java + )) + .additionalProperties(AdditionalProperties::class.java) + ), MapSchemaValidator { + /* + NOTE: This class is auto generated by OpenAPI JSON Schema Generator. + Ref: https://github.com/openapi-json-schema-tools/openapi-json-schema-generator + + Do not edit the class manually. + */ + + companion object { + @Volatile + private var instance: AdditionalpropertiesAllowsASchemaWhichShouldValidate1? = null + + fun getInstance() = + instance ?: synchronized(this) { + instance ?: AdditionalpropertiesAllowsASchemaWhichShouldValidate1().also { instance = it } + } + } + + override fun getNewInstance(arg: Map<*, *>, pathToItem: List, pathToSchemas: PathToSchemasMap): AdditionalpropertiesAllowsASchemaWhichShouldValidateMap { + val properties: LinkedHashMap = LinkedHashMap() + for((entryKey, value) in arg) { + if (!(entryKey is String)) { + throw RuntimeException("Invalid non-string key value") + } + val propertyPathToItem: List = pathToItem + entryKey + val schemas: LinkedHashMap, Nothing?>? = pathToSchemas.get(propertyPathToItem) + if (schemas == null) { + throw RuntimeException("Validation result is invalid, schemas must exist for a pathToItem") + } + val propertySchema: JsonSchema<*> = schemas.entries.iterator().next().key + val propertyInstance: Any? = propertySchema.getNewInstance(value, propertyPathToItem, pathToSchemas) + properties[entryKey] = propertyInstance + } + val castProperties: FrozenMap = FrozenMap(properties) + return AdditionalpropertiesAllowsASchemaWhichShouldValidateMap(castProperties) + } + + @Throws(ValidationException::class) + override fun validate(arg: Map<*, *>, configuration: SchemaConfiguration?): AdditionalpropertiesAllowsASchemaWhichShouldValidateMap { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, PathToSchemasMap(), LinkedHashSet()) + val pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet) + return getNewInstance(castArg, validationMetadata.pathToItem, pathToSchemasMap) + } + + + @Throws(ValidationException::class) + override fun validate(arg: Any?, configuration: SchemaConfiguration?): Any? { + if (arg is Map<*, *>) { + return validate(arg, configuration) + } + throw ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema") + } + override fun getNewInstance(arg: Any?, pathToItem: List, pathToSchemas: PathToSchemasMap): Any? { + if (arg is Map<*, *>) { + return getNewInstance(arg, pathToItem, pathToSchemas) + } + throw RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema") + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: Map<*, *>, configuration: SchemaConfiguration?): AdditionalpropertiesAllowsASchemaWhichShouldValidate1BoxedMap { + return AdditionalpropertiesAllowsASchemaWhichShouldValidate1BoxedMap(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: Any?, configuration: SchemaConfiguration?): AdditionalpropertiesAllowsASchemaWhichShouldValidate1Boxed { + if (arg is Map<*, *>) { + return validateAndBox(arg, configuration) + } + throw ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema") + } + } + +} diff --git a/samples/client/3_0_3_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/schemas/AdditionalpropertiesAreAllowedByDefault.kt b/samples/client/3_0_3_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/schemas/AdditionalpropertiesAreAllowedByDefault.kt new file mode 100644 index 00000000000..2966b3216d6 --- /dev/null +++ b/samples/client/3_0_3_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/schemas/AdditionalpropertiesAreAllowedByDefault.kt @@ -0,0 +1,518 @@ +package org.openapijsonschematools.client.components.schemas +import java.time.LocalDate +import java.time.ZonedDateTime +import java.util.UUID +import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags +import org.openapijsonschematools.client.configurations.SchemaConfiguration +import org.openapijsonschematools.client.exceptions.InvalidAdditionalPropertyException +import org.openapijsonschematools.client.exceptions.UnsetPropertyException +import org.openapijsonschematools.client.exceptions.ValidationException +import org.openapijsonschematools.client.schemas.AnyTypeJsonSchema +import org.openapijsonschematools.client.schemas.GenericBuilder +import org.openapijsonschematools.client.schemas.UnsetAddPropsSetter +import org.openapijsonschematools.client.schemas.validation.BooleanSchemaValidator +import org.openapijsonschematools.client.schemas.validation.FrozenList +import org.openapijsonschematools.client.schemas.validation.FrozenMap +import org.openapijsonschematools.client.schemas.validation.JsonSchema +import org.openapijsonschematools.client.schemas.validation.JsonSchemaInfo +import org.openapijsonschematools.client.schemas.validation.ListSchemaValidator +import org.openapijsonschematools.client.schemas.validation.MapSchemaValidator +import org.openapijsonschematools.client.schemas.validation.NullSchemaValidator +import org.openapijsonschematools.client.schemas.validation.NumberSchemaValidator +import org.openapijsonschematools.client.schemas.validation.PathToSchemasMap +import org.openapijsonschematools.client.schemas.validation.StringSchemaValidator +import org.openapijsonschematools.client.schemas.validation.ValidationMetadata + +class AdditionalpropertiesAreAllowedByDefault { + // nest classes so all schemas and input/output classes can be public + + + class Foo : AnyTypeJsonSchema.AnyTypeJsonSchema1() { + companion object { + @Volatile + private var instance: Foo? = null + + fun getInstance() = + instance ?: synchronized(this) { + instance ?: Foo().also { instance = it } + } + } + } + + + class Bar : AnyTypeJsonSchema.AnyTypeJsonSchema1() { + companion object { + @Volatile + private var instance: Bar? = null + + fun getInstance() = + instance ?: synchronized(this) { + instance ?: Bar().also { instance = it } + } + } + } + + + class AdditionalpropertiesAreAllowedByDefaultMap(m: FrozenMap) : FrozenMap(m) { + companion object { + val requiredKeys: Set = setOf() + val optionalKeys: Set = setOf( + "foo", + "bar" + ) + @Throws(ValidationException::class) + fun of(arg: Map, configuration: SchemaConfiguration): AdditionalpropertiesAreAllowedByDefaultMap { + return AdditionalpropertiesAreAllowedByDefault1.getInstance().validate(arg, configuration) + } + } + + @Throws(UnsetPropertyException::class) + fun foo(): Any? { + return getOrThrow("foo") + } + + @Throws(UnsetPropertyException::class) + fun bar(): Any? { + return getOrThrow("bar") + } + + @Throws(UnsetPropertyException::class, InvalidAdditionalPropertyException::class) + fun getAdditionalProperty(name: String): Any? { + throwIfKeyKnown(name, requiredKeys, optionalKeys) + throwIfKeyNotPresent(name) + return get(name) + } + } + + interface SetterForFoo { + fun getInstance(): MutableMap + fun getBuilderAfterFoo(instance: MutableMap): T + + fun foo(value: Nothing?): T { + val instance = getInstance() + instance["foo"] = null + return getBuilderAfterFoo(instance) + } + + fun foo(value: Boolean): T { + val instance = getInstance() + instance["foo"] = value + return getBuilderAfterFoo(instance) + } + + fun foo(value: String): T { + val instance = getInstance() + instance["foo"] = value + return getBuilderAfterFoo(instance) + } + + fun foo(value: Int): T { + val instance = getInstance() + instance["foo"] = value + return getBuilderAfterFoo(instance) + } + + fun foo(value: Float): T { + val instance = getInstance() + instance["foo"] = value + return getBuilderAfterFoo(instance) + } + + fun foo(value: Long): T { + val instance = getInstance() + instance["foo"] = value + return getBuilderAfterFoo(instance) + } + + fun foo(value: Double): T { + val instance = getInstance() + instance["foo"] = value + return getBuilderAfterFoo(instance) + } + + fun foo(value: List): T { + val instance = getInstance() + instance["foo"] = value + return getBuilderAfterFoo(instance) + } + + fun foo(value: Map): T { + val instance = getInstance() + instance["foo"] = value + return getBuilderAfterFoo(instance) + } + } + + interface SetterForBar { + fun getInstance(): MutableMap + fun getBuilderAfterBar(instance: MutableMap): T + + fun bar(value: Nothing?): T { + val instance = getInstance() + instance["bar"] = null + return getBuilderAfterBar(instance) + } + + fun bar(value: Boolean): T { + val instance = getInstance() + instance["bar"] = value + return getBuilderAfterBar(instance) + } + + fun bar(value: String): T { + val instance = getInstance() + instance["bar"] = value + return getBuilderAfterBar(instance) + } + + fun bar(value: Int): T { + val instance = getInstance() + instance["bar"] = value + return getBuilderAfterBar(instance) + } + + fun bar(value: Float): T { + val instance = getInstance() + instance["bar"] = value + return getBuilderAfterBar(instance) + } + + fun bar(value: Long): T { + val instance = getInstance() + instance["bar"] = value + return getBuilderAfterBar(instance) + } + + fun bar(value: Double): T { + val instance = getInstance() + instance["bar"] = value + return getBuilderAfterBar(instance) + } + + fun bar(value: List): T { + val instance = getInstance() + instance["bar"] = value + return getBuilderAfterBar(instance) + } + + fun bar(value: Map): T { + val instance = getInstance() + instance["bar"] = value + return getBuilderAfterBar(instance) + } + } + + class AdditionalpropertiesAreAllowedByDefaultMapBuilder: UnsetAddPropsSetter, GenericBuilder>, SetterForFoo, SetterForBar { + private val knownKeys: Set = setOf( + "foo", + "bar" + ) + override fun getKnownKeys(): Set { + return knownKeys + } + private val instance: MutableMap + init { + this.instance = LinkedHashMap() + } + override fun build(): Map { + return instance + } + override fun getInstance(): MutableMap { + return instance + } + override fun getBuilderAfterFoo(instance: MutableMap): AdditionalpropertiesAreAllowedByDefaultMapBuilder { + return this + } + override fun getBuilderAfterBar(instance: MutableMap): AdditionalpropertiesAreAllowedByDefaultMapBuilder { + return this + } + override fun getBuilderAfterAdditionalProperty(instance: MutableMap): AdditionalpropertiesAreAllowedByDefaultMapBuilder { + return this + } + } + + + sealed interface AdditionalpropertiesAreAllowedByDefault1Boxed { + fun getData(): Any? + } + + data class AdditionalpropertiesAreAllowedByDefault1BoxedVoid(val data: Nothing?) : AdditionalpropertiesAreAllowedByDefault1Boxed { + override fun getData(): Any? { + return data + } + } + + data class AdditionalpropertiesAreAllowedByDefault1BoxedBoolean(val data: Boolean): AdditionalpropertiesAreAllowedByDefault1Boxed { + override fun getData(): Any? { + return data + } + } + + data class AdditionalpropertiesAreAllowedByDefault1BoxedNumber(val data: Number) : AdditionalpropertiesAreAllowedByDefault1Boxed { + override fun getData(): Any? { + return data + } + } + + data class AdditionalpropertiesAreAllowedByDefault1BoxedString(val data: String) : AdditionalpropertiesAreAllowedByDefault1Boxed { + override fun getData(): Any? { + return data + } + } + + data class AdditionalpropertiesAreAllowedByDefault1BoxedList(val data: FrozenList) : AdditionalpropertiesAreAllowedByDefault1Boxed { + override fun getData(): Any? { + return data + } + } + + data class AdditionalpropertiesAreAllowedByDefault1BoxedMap(val data: AdditionalpropertiesAreAllowedByDefaultMap) : AdditionalpropertiesAreAllowedByDefault1Boxed { + override fun getData(): Any? { + return data + } + } + + + class AdditionalpropertiesAreAllowedByDefault1 private constructor(): JsonSchema( + JsonSchemaInfo() + .properties(mapOf( + "foo" to Foo::class.java, + "bar" to Bar::class.java + )) + ), NullSchemaValidator, BooleanSchemaValidator, NumberSchemaValidator, StringSchemaValidator, ListSchemaValidator, AdditionalpropertiesAreAllowedByDefault1BoxedList>, MapSchemaValidator { + /* + NOTE: This class is auto generated by OpenAPI JSON Schema Generator. + Ref: https://github.com/openapi-json-schema-tools/openapi-json-schema-generator + + Do not edit the class manually. + */ + + companion object { + @Volatile + private var instance: AdditionalpropertiesAreAllowedByDefault1? = null + + fun getInstance() = + instance ?: synchronized(this) { + instance ?: AdditionalpropertiesAreAllowedByDefault1().also { instance = it } + } + } + + @Throws(ValidationException::class) + override fun validate(arg: Nothing?, configuration: SchemaConfiguration?): Nothing? { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validatedPathToSchemas = PathToSchemasMap() + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, LinkedHashSet()) + getPathToSchemas(this, castArg, validationMetadata, pathSet) + return castArg + } + + @Throws(ValidationException::class) + override fun validate(arg: Boolean, configuration: SchemaConfiguration?): Boolean { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validatedPathToSchemas = PathToSchemasMap() + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, LinkedHashSet()) + getPathToSchemas(this, castArg, validationMetadata, pathSet) + return castArg + } + + @Throws(ValidationException::class) + override fun validate(arg: Number, configuration: SchemaConfiguration?): Number { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validatedPathToSchemas = PathToSchemasMap() + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, LinkedHashSet()) + getPathToSchemas(this, castArg, validationMetadata, pathSet) + return castArg + } + + @Throws(ValidationException::class) + fun validate(arg: Int, configuration: SchemaConfiguration?): Int { + return validate(arg as Number, configuration) as Int + } + + @Throws(ValidationException::class) + fun validate(arg: Long, configuration: SchemaConfiguration?): Long { + return validate(arg as Number, configuration) as Long + } + + @Throws(ValidationException::class) + fun validate(arg: Float, configuration: SchemaConfiguration?): Float { + return validate(arg as Number, configuration) as Float + } + + @Throws(ValidationException::class) + fun validate(arg: Double, configuration: SchemaConfiguration?): Double { + return validate(arg as Number, configuration) as Double + } + + @Throws(ValidationException::class) + override fun validate(arg: String, configuration: SchemaConfiguration?): String { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validatedPathToSchemas = PathToSchemasMap() + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, LinkedHashSet()) + getPathToSchemas(this, castArg, validationMetadata, pathSet) + return castArg + } + + @Throws(ValidationException::class) + fun validate(arg: LocalDate, configuration: SchemaConfiguration?): String { + return validate(arg.toString(), configuration) + } + + @Throws(ValidationException::class) + fun validate(arg: ZonedDateTime, configuration: SchemaConfiguration?): String { + return validate(arg.toString(), configuration) + } + + @Throws(ValidationException::class) + fun validate(arg: UUID, configuration: SchemaConfiguration?): String { + return validate(arg.toString(), configuration) + } + + override fun getNewInstance(arg: List<*>, pathToItem: List, pathToSchemas: PathToSchemasMap): FrozenList { + val items: MutableList = ArrayList() + var i: Int = 0 + for (item: Any? in arg) { + val itemPathToItem = pathToItem + i + val schemas: LinkedHashMap, Nothing?>? = pathToSchemas.get(itemPathToItem) + if (schemas == null) { + throw RuntimeException("Validation result is invalid, schemas must exist for a pathToItem") + } + val itemSchema: JsonSchema<*> = schemas.entries.iterator().next().key + val itemInstance: Any? = itemSchema.getNewInstance(item, itemPathToItem, pathToSchemas) + items.add(itemInstance) + i += 1 + } + val newInstanceItems: FrozenList = FrozenList(items) + return newInstanceItems + } + + @Throws(ValidationException::class) + override fun validate(arg: List<*>, configuration: SchemaConfiguration?): FrozenList { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, PathToSchemasMap(), LinkedHashSet()) + val pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet) + return getNewInstance(castArg, validationMetadata.pathToItem, pathToSchemasMap) + } + + override fun getNewInstance(arg: Map<*, *>, pathToItem: List, pathToSchemas: PathToSchemasMap): AdditionalpropertiesAreAllowedByDefaultMap { + val properties: LinkedHashMap = LinkedHashMap() + for((propertyName, value) in arg) { + if (!(propertyName is String)) { + throw RuntimeException("Invalid non-string key value") + } + val propertyPathToItem: List = pathToItem + propertyName + val schemas: LinkedHashMap, Nothing?>? = pathToSchemas.get(propertyPathToItem) + if (schemas == null) { + throw RuntimeException("Validation result is invalid, schemas must exist for a pathToItem") + } + val propertySchema: JsonSchema<*> = schemas.entries.iterator().next().key + val propertyInstance: Any? = propertySchema.getNewInstance(value, propertyPathToItem, pathToSchemas) + properties[propertyName] = propertyInstance + } + val castProperties: FrozenMap = FrozenMap(properties) + return AdditionalpropertiesAreAllowedByDefaultMap(castProperties) + } + + @Throws(ValidationException::class) + override fun validate(arg: Map<*, *>, configuration: SchemaConfiguration?): AdditionalpropertiesAreAllowedByDefaultMap { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validatedPathToSchemas = PathToSchemasMap() + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, LinkedHashSet()) + val pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet) + return getNewInstance(castArg, validationMetadata.pathToItem, pathToSchemasMap) + } + + @Throws(ValidationException::class) + override fun validate(arg: Any?, configuration: SchemaConfiguration?): Any? { + if (arg == null) { + return validate(null, configuration) + } else if (arg is Boolean) { + return validate(arg, configuration) + } else if (arg is Number) { + return validate(arg, configuration) + } else if (arg is String) { + return validate(arg, configuration) + } else if (arg is List<*>) { + return validate(arg, configuration) + } else if (arg is Map<*, *>) { + return validate(arg, configuration) + } + throw ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema") + } + override fun getNewInstance(arg: Any?, pathToItem: List, pathToSchemas: PathToSchemasMap): Any? { + if (arg == null) { + return getNewInstance( null, pathToItem, pathToSchemas) + } else if (arg is Boolean) { + return getNewInstance(arg, pathToItem, pathToSchemas) + } else if (arg is Number) { + return getNewInstance(arg, pathToItem, pathToSchemas) + } else if (arg is String) { + return getNewInstance(arg, pathToItem, pathToSchemas) + } else if (arg is List<*>) { + return getNewInstance(arg, pathToItem, pathToSchemas) + } else if (arg is Map<*, *>) { + return getNewInstance(arg, pathToItem, pathToSchemas) + } + throw RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema") + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: Nothing?, configuration: SchemaConfiguration?): AdditionalpropertiesAreAllowedByDefault1BoxedVoid { + return AdditionalpropertiesAreAllowedByDefault1BoxedVoid(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: Boolean, configuration: SchemaConfiguration?): AdditionalpropertiesAreAllowedByDefault1BoxedBoolean { + return AdditionalpropertiesAreAllowedByDefault1BoxedBoolean(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: Number, configuration: SchemaConfiguration?): AdditionalpropertiesAreAllowedByDefault1BoxedNumber { + return AdditionalpropertiesAreAllowedByDefault1BoxedNumber(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: String, configuration: SchemaConfiguration?): AdditionalpropertiesAreAllowedByDefault1BoxedString { + return AdditionalpropertiesAreAllowedByDefault1BoxedString(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: List<*>, configuration: SchemaConfiguration?): AdditionalpropertiesAreAllowedByDefault1BoxedList { + return AdditionalpropertiesAreAllowedByDefault1BoxedList(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: Map<*, *>, configuration: SchemaConfiguration?): AdditionalpropertiesAreAllowedByDefault1BoxedMap { + return AdditionalpropertiesAreAllowedByDefault1BoxedMap(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: Any?, configuration: SchemaConfiguration?): AdditionalpropertiesAreAllowedByDefault1Boxed { + if (arg == null) { + return validateAndBox(null, configuration) + } else if (arg is Boolean) { + return validateAndBox(arg, configuration) + } else if (arg is String) { + return validateAndBox(arg, configuration) + } else if (arg is Number) { + return validateAndBox(arg, configuration) + } else if (arg is List<*>) { + return validateAndBox(arg, configuration) + } else if (arg is Map<*, *>) { + return validateAndBox(arg, configuration) + } + throw ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema") + } + } +} diff --git a/samples/client/3_0_3_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/schemas/AdditionalpropertiesCanExistByItself.kt b/samples/client/3_0_3_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/schemas/AdditionalpropertiesCanExistByItself.kt new file mode 100644 index 00000000000..ee604cec42a --- /dev/null +++ b/samples/client/3_0_3_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/schemas/AdditionalpropertiesCanExistByItself.kt @@ -0,0 +1,183 @@ +package org.openapijsonschematools.client.components.schemas +import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags +import org.openapijsonschematools.client.configurations.SchemaConfiguration +import org.openapijsonschematools.client.exceptions.InvalidAdditionalPropertyException +import org.openapijsonschematools.client.exceptions.UnsetPropertyException +import org.openapijsonschematools.client.exceptions.ValidationException +import org.openapijsonschematools.client.schemas.BooleanJsonSchema +import org.openapijsonschematools.client.schemas.GenericBuilder +import org.openapijsonschematools.client.schemas.validation.FrozenMap +import org.openapijsonschematools.client.schemas.validation.JsonSchema +import org.openapijsonschematools.client.schemas.validation.JsonSchemaInfo +import org.openapijsonschematools.client.schemas.validation.MapSchemaValidator +import org.openapijsonschematools.client.schemas.validation.MapUtils +import org.openapijsonschematools.client.schemas.validation.PathToSchemasMap +import org.openapijsonschematools.client.schemas.validation.ValidationMetadata + +class AdditionalpropertiesCanExistByItself { + // nest classes so all schemas and input/output classes can be public + + + class AdditionalProperties : BooleanJsonSchema.BooleanJsonSchema1() { + companion object { + @Volatile + private var instance: AdditionalProperties? = null + + fun getInstance() = + instance ?: synchronized(this) { + instance ?: AdditionalProperties().also { instance = it } + } + } + } + + + class AdditionalpropertiesCanExistByItselfMap(m: FrozenMap) : FrozenMap(m) { + companion object { + val requiredKeys: Set = setOf() + val optionalKeys: Set = setOf() + @Throws(ValidationException::class) + fun of(arg: Map, configuration: SchemaConfiguration): AdditionalpropertiesCanExistByItselfMap { + return AdditionalpropertiesCanExistByItself1.getInstance().validate(arg, configuration) + } + } + + @Throws(UnsetPropertyException::class) + fun getAdditionalProperty(name: String): Boolean { + throwIfKeyNotPresent(name) + val value: Boolean? = get(name) + if (value == null) { + throw RuntimeException("Value may not be null") + } + return value + } + } + + interface SetterForAdditionalProperties { + fun getKnownKeys(): Set + fun getInstance(): MutableMap + fun getBuilderAfterAdditionalProperty(instance: MutableMap): T + + @Throws(InvalidAdditionalPropertyException::class) + fun additionalProperty(key: String, value: Boolean): T { + MapUtils.throwIfKeyKnown(key, getKnownKeys(), true) + val instance = getInstance() + instance[key] = value + return getBuilderAfterAdditionalProperty(instance) + } + } + + class AdditionalpropertiesCanExistByItselfMapBuilder: GenericBuilder>, SetterForAdditionalProperties { + private val knownKeys: Set = setOf() + override fun getKnownKeys(): Set { + return knownKeys + } + private val instance: MutableMap + init { + this.instance = LinkedHashMap() + } + override fun build(): Map { + return instance + } + override fun getInstance(): MutableMap { + return instance + } + override fun getBuilderAfterAdditionalProperty(instance: MutableMap): AdditionalpropertiesCanExistByItselfMapBuilder { + return this + } + } + + + sealed interface AdditionalpropertiesCanExistByItself1Boxed { + fun getData(): Any? + } + + data class AdditionalpropertiesCanExistByItself1BoxedMap(val data: AdditionalpropertiesCanExistByItselfMap) : AdditionalpropertiesCanExistByItself1Boxed { + override fun getData(): Any? { + return data + } + } + + + class AdditionalpropertiesCanExistByItself1 private constructor(): JsonSchema( + JsonSchemaInfo() + .type(setOf(Map::class.java)) + .additionalProperties(AdditionalProperties::class.java) + ), MapSchemaValidator { + /* + NOTE: This class is auto generated by OpenAPI JSON Schema Generator. + Ref: https://github.com/openapi-json-schema-tools/openapi-json-schema-generator + + Do not edit the class manually. + */ + + companion object { + @Volatile + private var instance: AdditionalpropertiesCanExistByItself1? = null + + fun getInstance() = + instance ?: synchronized(this) { + instance ?: AdditionalpropertiesCanExistByItself1().also { instance = it } + } + } + + override fun getNewInstance(arg: Map<*, *>, pathToItem: List, pathToSchemas: PathToSchemasMap): AdditionalpropertiesCanExistByItselfMap { + val properties: LinkedHashMap = LinkedHashMap() + for((entryKey, value) in arg) { + if (!(entryKey is String)) { + throw RuntimeException("Invalid non-string key value") + } + val propertyPathToItem: List = pathToItem + entryKey + val schemas: LinkedHashMap, Nothing?>? = pathToSchemas.get(propertyPathToItem) + if (schemas == null) { + throw RuntimeException("Validation result is invalid, schemas must exist for a pathToItem") + } + val propertySchema: JsonSchema<*> = schemas.entries.iterator().next().key + val propertyInstance: Any? = propertySchema.getNewInstance(value, propertyPathToItem, pathToSchemas) + if (!(propertyInstance is Boolean)) { + throw RuntimeException("Invalid instantiated value") + } + properties[entryKey] = propertyInstance + } + val castProperties: FrozenMap = FrozenMap(properties) + return AdditionalpropertiesCanExistByItselfMap(castProperties) + } + + @Throws(ValidationException::class) + override fun validate(arg: Map<*, *>, configuration: SchemaConfiguration?): AdditionalpropertiesCanExistByItselfMap { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, PathToSchemasMap(), LinkedHashSet()) + val pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet) + return getNewInstance(castArg, validationMetadata.pathToItem, pathToSchemasMap) + } + + + @Throws(ValidationException::class) + override fun validate(arg: Any?, configuration: SchemaConfiguration?): Any? { + if (arg is Map<*, *>) { + return validate(arg, configuration) + } + throw ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema") + } + override fun getNewInstance(arg: Any?, pathToItem: List, pathToSchemas: PathToSchemasMap): Any? { + if (arg is Map<*, *>) { + return getNewInstance(arg, pathToItem, pathToSchemas) + } + throw RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema") + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: Map<*, *>, configuration: SchemaConfiguration?): AdditionalpropertiesCanExistByItself1BoxedMap { + return AdditionalpropertiesCanExistByItself1BoxedMap(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: Any?, configuration: SchemaConfiguration?): AdditionalpropertiesCanExistByItself1Boxed { + if (arg is Map<*, *>) { + return validateAndBox(arg, configuration) + } + throw ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema") + } + } + +} diff --git a/samples/client/3_0_3_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/schemas/AdditionalpropertiesShouldNotLookInApplicators.kt b/samples/client/3_0_3_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/schemas/AdditionalpropertiesShouldNotLookInApplicators.kt new file mode 100644 index 00000000000..9b2caf72cfb --- /dev/null +++ b/samples/client/3_0_3_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/schemas/AdditionalpropertiesShouldNotLookInApplicators.kt @@ -0,0 +1,787 @@ +package org.openapijsonschematools.client.components.schemas +import java.time.LocalDate +import java.time.ZonedDateTime +import java.util.UUID +import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags +import org.openapijsonschematools.client.configurations.SchemaConfiguration +import org.openapijsonschematools.client.exceptions.InvalidAdditionalPropertyException +import org.openapijsonschematools.client.exceptions.UnsetPropertyException +import org.openapijsonschematools.client.exceptions.ValidationException +import org.openapijsonschematools.client.schemas.AnyTypeJsonSchema +import org.openapijsonschematools.client.schemas.BooleanJsonSchema +import org.openapijsonschematools.client.schemas.GenericBuilder +import org.openapijsonschematools.client.schemas.UnsetAddPropsSetter +import org.openapijsonschematools.client.schemas.validation.BooleanSchemaValidator +import org.openapijsonschematools.client.schemas.validation.FrozenList +import org.openapijsonschematools.client.schemas.validation.FrozenMap +import org.openapijsonschematools.client.schemas.validation.JsonSchema +import org.openapijsonschematools.client.schemas.validation.JsonSchemaInfo +import org.openapijsonschematools.client.schemas.validation.ListSchemaValidator +import org.openapijsonschematools.client.schemas.validation.MapSchemaValidator +import org.openapijsonschematools.client.schemas.validation.MapUtils +import org.openapijsonschematools.client.schemas.validation.NullSchemaValidator +import org.openapijsonschematools.client.schemas.validation.NumberSchemaValidator +import org.openapijsonschematools.client.schemas.validation.PathToSchemasMap +import org.openapijsonschematools.client.schemas.validation.StringSchemaValidator +import org.openapijsonschematools.client.schemas.validation.ValidationMetadata + +class AdditionalpropertiesShouldNotLookInApplicators { + // nest classes so all schemas and input/output classes can be public + + + class AdditionalProperties : BooleanJsonSchema.BooleanJsonSchema1() { + companion object { + @Volatile + private var instance: AdditionalProperties? = null + + fun getInstance() = + instance ?: synchronized(this) { + instance ?: AdditionalProperties().also { instance = it } + } + } + } + + + class Foo : AnyTypeJsonSchema.AnyTypeJsonSchema1() { + companion object { + @Volatile + private var instance: Foo? = null + + fun getInstance() = + instance ?: synchronized(this) { + instance ?: Foo().also { instance = it } + } + } + } + + + class Schema0Map(m: FrozenMap) : FrozenMap(m) { + companion object { + val requiredKeys: Set = setOf() + val optionalKeys: Set = setOf( + "foo" + ) + @Throws(ValidationException::class) + fun of(arg: Map, configuration: SchemaConfiguration): Schema0Map { + return Schema0.getInstance().validate(arg, configuration) + } + } + + @Throws(UnsetPropertyException::class) + fun foo(): Any? { + return getOrThrow("foo") + } + + @Throws(UnsetPropertyException::class, InvalidAdditionalPropertyException::class) + fun getAdditionalProperty(name: String): Any? { + throwIfKeyKnown(name, requiredKeys, optionalKeys) + throwIfKeyNotPresent(name) + return get(name) + } + } + + interface SetterForFoo { + fun getInstance(): MutableMap + fun getBuilderAfterFoo(instance: MutableMap): T + + fun foo(value: Nothing?): T { + val instance = getInstance() + instance["foo"] = null + return getBuilderAfterFoo(instance) + } + + fun foo(value: Boolean): T { + val instance = getInstance() + instance["foo"] = value + return getBuilderAfterFoo(instance) + } + + fun foo(value: String): T { + val instance = getInstance() + instance["foo"] = value + return getBuilderAfterFoo(instance) + } + + fun foo(value: Int): T { + val instance = getInstance() + instance["foo"] = value + return getBuilderAfterFoo(instance) + } + + fun foo(value: Float): T { + val instance = getInstance() + instance["foo"] = value + return getBuilderAfterFoo(instance) + } + + fun foo(value: Long): T { + val instance = getInstance() + instance["foo"] = value + return getBuilderAfterFoo(instance) + } + + fun foo(value: Double): T { + val instance = getInstance() + instance["foo"] = value + return getBuilderAfterFoo(instance) + } + + fun foo(value: List): T { + val instance = getInstance() + instance["foo"] = value + return getBuilderAfterFoo(instance) + } + + fun foo(value: Map): T { + val instance = getInstance() + instance["foo"] = value + return getBuilderAfterFoo(instance) + } + } + + class Schema0MapBuilder: UnsetAddPropsSetter, GenericBuilder>, SetterForFoo { + private val knownKeys: Set = setOf( + "foo" + ) + override fun getKnownKeys(): Set { + return knownKeys + } + private val instance: MutableMap + init { + this.instance = LinkedHashMap() + } + override fun build(): Map { + return instance + } + override fun getInstance(): MutableMap { + return instance + } + override fun getBuilderAfterFoo(instance: MutableMap): Schema0MapBuilder { + return this + } + override fun getBuilderAfterAdditionalProperty(instance: MutableMap): Schema0MapBuilder { + return this + } + } + + + sealed interface Schema0Boxed { + fun getData(): Any? + } + + data class Schema0BoxedVoid(val data: Nothing?) : Schema0Boxed { + override fun getData(): Any? { + return data + } + } + + data class Schema0BoxedBoolean(val data: Boolean): Schema0Boxed { + override fun getData(): Any? { + return data + } + } + + data class Schema0BoxedNumber(val data: Number) : Schema0Boxed { + override fun getData(): Any? { + return data + } + } + + data class Schema0BoxedString(val data: String) : Schema0Boxed { + override fun getData(): Any? { + return data + } + } + + data class Schema0BoxedList(val data: FrozenList) : Schema0Boxed { + override fun getData(): Any? { + return data + } + } + + data class Schema0BoxedMap(val data: Schema0Map) : Schema0Boxed { + override fun getData(): Any? { + return data + } + } + + + class Schema0 private constructor(): JsonSchema( + JsonSchemaInfo() + .properties(mapOf( + "foo" to Foo::class.java + )) + ), NullSchemaValidator, BooleanSchemaValidator, NumberSchemaValidator, StringSchemaValidator, ListSchemaValidator, Schema0BoxedList>, MapSchemaValidator { + + companion object { + @Volatile + private var instance: Schema0? = null + + fun getInstance() = + instance ?: synchronized(this) { + instance ?: Schema0().also { instance = it } + } + } + + @Throws(ValidationException::class) + override fun validate(arg: Nothing?, configuration: SchemaConfiguration?): Nothing? { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validatedPathToSchemas = PathToSchemasMap() + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, LinkedHashSet()) + getPathToSchemas(this, castArg, validationMetadata, pathSet) + return castArg + } + + @Throws(ValidationException::class) + override fun validate(arg: Boolean, configuration: SchemaConfiguration?): Boolean { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validatedPathToSchemas = PathToSchemasMap() + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, LinkedHashSet()) + getPathToSchemas(this, castArg, validationMetadata, pathSet) + return castArg + } + + @Throws(ValidationException::class) + override fun validate(arg: Number, configuration: SchemaConfiguration?): Number { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validatedPathToSchemas = PathToSchemasMap() + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, LinkedHashSet()) + getPathToSchemas(this, castArg, validationMetadata, pathSet) + return castArg + } + + @Throws(ValidationException::class) + fun validate(arg: Int, configuration: SchemaConfiguration?): Int { + return validate(arg as Number, configuration) as Int + } + + @Throws(ValidationException::class) + fun validate(arg: Long, configuration: SchemaConfiguration?): Long { + return validate(arg as Number, configuration) as Long + } + + @Throws(ValidationException::class) + fun validate(arg: Float, configuration: SchemaConfiguration?): Float { + return validate(arg as Number, configuration) as Float + } + + @Throws(ValidationException::class) + fun validate(arg: Double, configuration: SchemaConfiguration?): Double { + return validate(arg as Number, configuration) as Double + } + + @Throws(ValidationException::class) + override fun validate(arg: String, configuration: SchemaConfiguration?): String { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validatedPathToSchemas = PathToSchemasMap() + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, LinkedHashSet()) + getPathToSchemas(this, castArg, validationMetadata, pathSet) + return castArg + } + + @Throws(ValidationException::class) + fun validate(arg: LocalDate, configuration: SchemaConfiguration?): String { + return validate(arg.toString(), configuration) + } + + @Throws(ValidationException::class) + fun validate(arg: ZonedDateTime, configuration: SchemaConfiguration?): String { + return validate(arg.toString(), configuration) + } + + @Throws(ValidationException::class) + fun validate(arg: UUID, configuration: SchemaConfiguration?): String { + return validate(arg.toString(), configuration) + } + + override fun getNewInstance(arg: List<*>, pathToItem: List, pathToSchemas: PathToSchemasMap): FrozenList { + val items: MutableList = ArrayList() + var i: Int = 0 + for (item: Any? in arg) { + val itemPathToItem = pathToItem + i + val schemas: LinkedHashMap, Nothing?>? = pathToSchemas.get(itemPathToItem) + if (schemas == null) { + throw RuntimeException("Validation result is invalid, schemas must exist for a pathToItem") + } + val itemSchema: JsonSchema<*> = schemas.entries.iterator().next().key + val itemInstance: Any? = itemSchema.getNewInstance(item, itemPathToItem, pathToSchemas) + items.add(itemInstance) + i += 1 + } + val newInstanceItems: FrozenList = FrozenList(items) + return newInstanceItems + } + + @Throws(ValidationException::class) + override fun validate(arg: List<*>, configuration: SchemaConfiguration?): FrozenList { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, PathToSchemasMap(), LinkedHashSet()) + val pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet) + return getNewInstance(castArg, validationMetadata.pathToItem, pathToSchemasMap) + } + + override fun getNewInstance(arg: Map<*, *>, pathToItem: List, pathToSchemas: PathToSchemasMap): Schema0Map { + val properties: LinkedHashMap = LinkedHashMap() + for((propertyName, value) in arg) { + if (!(propertyName is String)) { + throw RuntimeException("Invalid non-string key value") + } + val propertyPathToItem: List = pathToItem + propertyName + val schemas: LinkedHashMap, Nothing?>? = pathToSchemas.get(propertyPathToItem) + if (schemas == null) { + throw RuntimeException("Validation result is invalid, schemas must exist for a pathToItem") + } + val propertySchema: JsonSchema<*> = schemas.entries.iterator().next().key + val propertyInstance: Any? = propertySchema.getNewInstance(value, propertyPathToItem, pathToSchemas) + properties[propertyName] = propertyInstance + } + val castProperties: FrozenMap = FrozenMap(properties) + return Schema0Map(castProperties) + } + + @Throws(ValidationException::class) + override fun validate(arg: Map<*, *>, configuration: SchemaConfiguration?): Schema0Map { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validatedPathToSchemas = PathToSchemasMap() + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, LinkedHashSet()) + val pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet) + return getNewInstance(castArg, validationMetadata.pathToItem, pathToSchemasMap) + } + + @Throws(ValidationException::class) + override fun validate(arg: Any?, configuration: SchemaConfiguration?): Any? { + if (arg == null) { + return validate(null, configuration) + } else if (arg is Boolean) { + return validate(arg, configuration) + } else if (arg is Number) { + return validate(arg, configuration) + } else if (arg is String) { + return validate(arg, configuration) + } else if (arg is List<*>) { + return validate(arg, configuration) + } else if (arg is Map<*, *>) { + return validate(arg, configuration) + } + throw ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema") + } + override fun getNewInstance(arg: Any?, pathToItem: List, pathToSchemas: PathToSchemasMap): Any? { + if (arg == null) { + return getNewInstance( null, pathToItem, pathToSchemas) + } else if (arg is Boolean) { + return getNewInstance(arg, pathToItem, pathToSchemas) + } else if (arg is Number) { + return getNewInstance(arg, pathToItem, pathToSchemas) + } else if (arg is String) { + return getNewInstance(arg, pathToItem, pathToSchemas) + } else if (arg is List<*>) { + return getNewInstance(arg, pathToItem, pathToSchemas) + } else if (arg is Map<*, *>) { + return getNewInstance(arg, pathToItem, pathToSchemas) + } + throw RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema") + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: Nothing?, configuration: SchemaConfiguration?): Schema0BoxedVoid { + return Schema0BoxedVoid(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: Boolean, configuration: SchemaConfiguration?): Schema0BoxedBoolean { + return Schema0BoxedBoolean(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: Number, configuration: SchemaConfiguration?): Schema0BoxedNumber { + return Schema0BoxedNumber(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: String, configuration: SchemaConfiguration?): Schema0BoxedString { + return Schema0BoxedString(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: List<*>, configuration: SchemaConfiguration?): Schema0BoxedList { + return Schema0BoxedList(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: Map<*, *>, configuration: SchemaConfiguration?): Schema0BoxedMap { + return Schema0BoxedMap(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: Any?, configuration: SchemaConfiguration?): Schema0Boxed { + if (arg == null) { + return validateAndBox(null, configuration) + } else if (arg is Boolean) { + return validateAndBox(arg, configuration) + } else if (arg is String) { + return validateAndBox(arg, configuration) + } else if (arg is Number) { + return validateAndBox(arg, configuration) + } else if (arg is List<*>) { + return validateAndBox(arg, configuration) + } else if (arg is Map<*, *>) { + return validateAndBox(arg, configuration) + } + throw ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema") + } + } + + class AdditionalpropertiesShouldNotLookInApplicatorsMap(m: FrozenMap) : FrozenMap(m) { + companion object { + val requiredKeys: Set = setOf() + val optionalKeys: Set = setOf() + @Throws(ValidationException::class) + fun of(arg: Map, configuration: SchemaConfiguration): AdditionalpropertiesShouldNotLookInApplicatorsMap { + return AdditionalpropertiesShouldNotLookInApplicators1.getInstance().validate(arg, configuration) + } + } + + @Throws(UnsetPropertyException::class) + fun getAdditionalProperty(name: String): Boolean { + throwIfKeyNotPresent(name) + val value: Boolean? = get(name) + if (value == null) { + throw RuntimeException("Value may not be null") + } + return value + } + } + + interface SetterForAdditionalProperties { + fun getKnownKeys(): Set + fun getInstance(): MutableMap + fun getBuilderAfterAdditionalProperty(instance: MutableMap): T + + @Throws(InvalidAdditionalPropertyException::class) + fun additionalProperty(key: String, value: Boolean): T { + MapUtils.throwIfKeyKnown(key, getKnownKeys(), true) + val instance = getInstance() + instance[key] = value + return getBuilderAfterAdditionalProperty(instance) + } + } + + class AdditionalpropertiesShouldNotLookInApplicatorsMapBuilder: GenericBuilder>, SetterForAdditionalProperties { + private val knownKeys: Set = setOf() + override fun getKnownKeys(): Set { + return knownKeys + } + private val instance: MutableMap + init { + this.instance = LinkedHashMap() + } + override fun build(): Map { + return instance + } + override fun getInstance(): MutableMap { + return instance + } + override fun getBuilderAfterAdditionalProperty(instance: MutableMap): AdditionalpropertiesShouldNotLookInApplicatorsMapBuilder { + return this + } + } + + + sealed interface AdditionalpropertiesShouldNotLookInApplicators1Boxed { + fun getData(): Any? + } + + data class AdditionalpropertiesShouldNotLookInApplicators1BoxedVoid(val data: Nothing?) : AdditionalpropertiesShouldNotLookInApplicators1Boxed { + override fun getData(): Any? { + return data + } + } + + data class AdditionalpropertiesShouldNotLookInApplicators1BoxedBoolean(val data: Boolean): AdditionalpropertiesShouldNotLookInApplicators1Boxed { + override fun getData(): Any? { + return data + } + } + + data class AdditionalpropertiesShouldNotLookInApplicators1BoxedNumber(val data: Number) : AdditionalpropertiesShouldNotLookInApplicators1Boxed { + override fun getData(): Any? { + return data + } + } + + data class AdditionalpropertiesShouldNotLookInApplicators1BoxedString(val data: String) : AdditionalpropertiesShouldNotLookInApplicators1Boxed { + override fun getData(): Any? { + return data + } + } + + data class AdditionalpropertiesShouldNotLookInApplicators1BoxedList(val data: FrozenList) : AdditionalpropertiesShouldNotLookInApplicators1Boxed { + override fun getData(): Any? { + return data + } + } + + data class AdditionalpropertiesShouldNotLookInApplicators1BoxedMap(val data: AdditionalpropertiesShouldNotLookInApplicatorsMap) : AdditionalpropertiesShouldNotLookInApplicators1Boxed { + override fun getData(): Any? { + return data + } + } + + + class AdditionalpropertiesShouldNotLookInApplicators1 private constructor(): JsonSchema( + JsonSchemaInfo() + .additionalProperties(AdditionalProperties::class.java) + .allOf(listOf( + Schema0::class.java + )) + ), NullSchemaValidator, BooleanSchemaValidator, NumberSchemaValidator, StringSchemaValidator, ListSchemaValidator, AdditionalpropertiesShouldNotLookInApplicators1BoxedList>, MapSchemaValidator { + /* + NOTE: This class is auto generated by OpenAPI JSON Schema Generator. + Ref: https://github.com/openapi-json-schema-tools/openapi-json-schema-generator + + Do not edit the class manually. + */ + + companion object { + @Volatile + private var instance: AdditionalpropertiesShouldNotLookInApplicators1? = null + + fun getInstance() = + instance ?: synchronized(this) { + instance ?: AdditionalpropertiesShouldNotLookInApplicators1().also { instance = it } + } + } + + @Throws(ValidationException::class) + override fun validate(arg: Nothing?, configuration: SchemaConfiguration?): Nothing? { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validatedPathToSchemas = PathToSchemasMap() + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, LinkedHashSet()) + getPathToSchemas(this, castArg, validationMetadata, pathSet) + return castArg + } + + @Throws(ValidationException::class) + override fun validate(arg: Boolean, configuration: SchemaConfiguration?): Boolean { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validatedPathToSchemas = PathToSchemasMap() + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, LinkedHashSet()) + getPathToSchemas(this, castArg, validationMetadata, pathSet) + return castArg + } + + @Throws(ValidationException::class) + override fun validate(arg: Number, configuration: SchemaConfiguration?): Number { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validatedPathToSchemas = PathToSchemasMap() + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, LinkedHashSet()) + getPathToSchemas(this, castArg, validationMetadata, pathSet) + return castArg + } + + @Throws(ValidationException::class) + fun validate(arg: Int, configuration: SchemaConfiguration?): Int { + return validate(arg as Number, configuration) as Int + } + + @Throws(ValidationException::class) + fun validate(arg: Long, configuration: SchemaConfiguration?): Long { + return validate(arg as Number, configuration) as Long + } + + @Throws(ValidationException::class) + fun validate(arg: Float, configuration: SchemaConfiguration?): Float { + return validate(arg as Number, configuration) as Float + } + + @Throws(ValidationException::class) + fun validate(arg: Double, configuration: SchemaConfiguration?): Double { + return validate(arg as Number, configuration) as Double + } + + @Throws(ValidationException::class) + override fun validate(arg: String, configuration: SchemaConfiguration?): String { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validatedPathToSchemas = PathToSchemasMap() + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, LinkedHashSet()) + getPathToSchemas(this, castArg, validationMetadata, pathSet) + return castArg + } + + @Throws(ValidationException::class) + fun validate(arg: LocalDate, configuration: SchemaConfiguration?): String { + return validate(arg.toString(), configuration) + } + + @Throws(ValidationException::class) + fun validate(arg: ZonedDateTime, configuration: SchemaConfiguration?): String { + return validate(arg.toString(), configuration) + } + + @Throws(ValidationException::class) + fun validate(arg: UUID, configuration: SchemaConfiguration?): String { + return validate(arg.toString(), configuration) + } + + override fun getNewInstance(arg: List<*>, pathToItem: List, pathToSchemas: PathToSchemasMap): FrozenList { + val items: MutableList = ArrayList() + var i: Int = 0 + for (item: Any? in arg) { + val itemPathToItem = pathToItem + i + val schemas: LinkedHashMap, Nothing?>? = pathToSchemas.get(itemPathToItem) + if (schemas == null) { + throw RuntimeException("Validation result is invalid, schemas must exist for a pathToItem") + } + val itemSchema: JsonSchema<*> = schemas.entries.iterator().next().key + val itemInstance: Any? = itemSchema.getNewInstance(item, itemPathToItem, pathToSchemas) + items.add(itemInstance) + i += 1 + } + val newInstanceItems: FrozenList = FrozenList(items) + return newInstanceItems + } + + @Throws(ValidationException::class) + override fun validate(arg: List<*>, configuration: SchemaConfiguration?): FrozenList { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, PathToSchemasMap(), LinkedHashSet()) + val pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet) + return getNewInstance(castArg, validationMetadata.pathToItem, pathToSchemasMap) + } + + override fun getNewInstance(arg: Map<*, *>, pathToItem: List, pathToSchemas: PathToSchemasMap): AdditionalpropertiesShouldNotLookInApplicatorsMap { + val properties: LinkedHashMap = LinkedHashMap() + for((propertyName, value) in arg) { + if (!(propertyName is String)) { + throw RuntimeException("Invalid non-string key value") + } + val propertyPathToItem: List = pathToItem + propertyName + val schemas: LinkedHashMap, Nothing?>? = pathToSchemas.get(propertyPathToItem) + if (schemas == null) { + throw RuntimeException("Validation result is invalid, schemas must exist for a pathToItem") + } + val propertySchema: JsonSchema<*> = schemas.entries.iterator().next().key + val propertyInstance: Any? = propertySchema.getNewInstance(value, propertyPathToItem, pathToSchemas) + if (!(propertyInstance is Boolean)) { + throw RuntimeException("Invalid instantiated value") + } + properties[propertyName] = propertyInstance + } + val castProperties: FrozenMap = FrozenMap(properties) + return AdditionalpropertiesShouldNotLookInApplicatorsMap(castProperties) + } + + @Throws(ValidationException::class) + override fun validate(arg: Map<*, *>, configuration: SchemaConfiguration?): AdditionalpropertiesShouldNotLookInApplicatorsMap { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validatedPathToSchemas = PathToSchemasMap() + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, LinkedHashSet()) + val pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet) + return getNewInstance(castArg, validationMetadata.pathToItem, pathToSchemasMap) + } + + @Throws(ValidationException::class) + override fun validate(arg: Any?, configuration: SchemaConfiguration?): Any? { + if (arg == null) { + return validate(null, configuration) + } else if (arg is Boolean) { + return validate(arg, configuration) + } else if (arg is Number) { + return validate(arg, configuration) + } else if (arg is String) { + return validate(arg, configuration) + } else if (arg is List<*>) { + return validate(arg, configuration) + } else if (arg is Map<*, *>) { + return validate(arg, configuration) + } + throw ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema") + } + override fun getNewInstance(arg: Any?, pathToItem: List, pathToSchemas: PathToSchemasMap): Any? { + if (arg == null) { + return getNewInstance( null, pathToItem, pathToSchemas) + } else if (arg is Boolean) { + return getNewInstance(arg, pathToItem, pathToSchemas) + } else if (arg is Number) { + return getNewInstance(arg, pathToItem, pathToSchemas) + } else if (arg is String) { + return getNewInstance(arg, pathToItem, pathToSchemas) + } else if (arg is List<*>) { + return getNewInstance(arg, pathToItem, pathToSchemas) + } else if (arg is Map<*, *>) { + return getNewInstance(arg, pathToItem, pathToSchemas) + } + throw RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema") + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: Nothing?, configuration: SchemaConfiguration?): AdditionalpropertiesShouldNotLookInApplicators1BoxedVoid { + return AdditionalpropertiesShouldNotLookInApplicators1BoxedVoid(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: Boolean, configuration: SchemaConfiguration?): AdditionalpropertiesShouldNotLookInApplicators1BoxedBoolean { + return AdditionalpropertiesShouldNotLookInApplicators1BoxedBoolean(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: Number, configuration: SchemaConfiguration?): AdditionalpropertiesShouldNotLookInApplicators1BoxedNumber { + return AdditionalpropertiesShouldNotLookInApplicators1BoxedNumber(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: String, configuration: SchemaConfiguration?): AdditionalpropertiesShouldNotLookInApplicators1BoxedString { + return AdditionalpropertiesShouldNotLookInApplicators1BoxedString(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: List<*>, configuration: SchemaConfiguration?): AdditionalpropertiesShouldNotLookInApplicators1BoxedList { + return AdditionalpropertiesShouldNotLookInApplicators1BoxedList(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: Map<*, *>, configuration: SchemaConfiguration?): AdditionalpropertiesShouldNotLookInApplicators1BoxedMap { + return AdditionalpropertiesShouldNotLookInApplicators1BoxedMap(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: Any?, configuration: SchemaConfiguration?): AdditionalpropertiesShouldNotLookInApplicators1Boxed { + if (arg == null) { + return validateAndBox(null, configuration) + } else if (arg is Boolean) { + return validateAndBox(arg, configuration) + } else if (arg is String) { + return validateAndBox(arg, configuration) + } else if (arg is Number) { + return validateAndBox(arg, configuration) + } else if (arg is List<*>) { + return validateAndBox(arg, configuration) + } else if (arg is Map<*, *>) { + return validateAndBox(arg, configuration) + } + throw ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema") + } + } +} diff --git a/samples/client/3_0_3_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/schemas/Allof.kt b/samples/client/3_0_3_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/schemas/Allof.kt new file mode 100644 index 00000000000..4d04ec0291e --- /dev/null +++ b/samples/client/3_0_3_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/schemas/Allof.kt @@ -0,0 +1,1060 @@ +package org.openapijsonschematools.client.components.schemas +import java.time.LocalDate +import java.time.ZonedDateTime +import java.util.UUID +import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags +import org.openapijsonschematools.client.configurations.SchemaConfiguration +import org.openapijsonschematools.client.exceptions.InvalidAdditionalPropertyException +import org.openapijsonschematools.client.exceptions.UnsetPropertyException +import org.openapijsonschematools.client.exceptions.ValidationException +import org.openapijsonschematools.client.schemas.GenericBuilder +import org.openapijsonschematools.client.schemas.IntJsonSchema +import org.openapijsonschematools.client.schemas.StringJsonSchema +import org.openapijsonschematools.client.schemas.UnsetAddPropsSetter +import org.openapijsonschematools.client.schemas.validation.BooleanSchemaValidator +import org.openapijsonschematools.client.schemas.validation.FrozenList +import org.openapijsonschematools.client.schemas.validation.FrozenMap +import org.openapijsonschematools.client.schemas.validation.JsonSchema +import org.openapijsonschematools.client.schemas.validation.JsonSchemaInfo +import org.openapijsonschematools.client.schemas.validation.ListSchemaValidator +import org.openapijsonschematools.client.schemas.validation.MapSchemaValidator +import org.openapijsonschematools.client.schemas.validation.NullSchemaValidator +import org.openapijsonschematools.client.schemas.validation.NumberSchemaValidator +import org.openapijsonschematools.client.schemas.validation.PathToSchemasMap +import org.openapijsonschematools.client.schemas.validation.StringSchemaValidator +import org.openapijsonschematools.client.schemas.validation.ValidationMetadata + +class Allof { + // nest classes so all schemas and input/output classes can be public + + + class Bar : IntJsonSchema.IntJsonSchema1() { + companion object { + @Volatile + private var instance: Bar? = null + + fun getInstance() = + instance ?: synchronized(this) { + instance ?: Bar().also { instance = it } + } + } + } + + + class Schema0Map(m: FrozenMap) : FrozenMap(m) { + companion object { + val requiredKeys: Set = setOf( + "bar" + ) + val optionalKeys: Set = setOf() + @Throws(ValidationException::class) + fun of(arg: Map, configuration: SchemaConfiguration): Schema0Map { + return Schema0.getInstance().validate(arg, configuration) + } + } + + fun bar(): Number { + val value: Any? = get("bar") + if (!(value is Number)) { + throw RuntimeException("Invalid value stored for bar") + } + return value + } + + @Throws(UnsetPropertyException::class, InvalidAdditionalPropertyException::class) + fun getAdditionalProperty(name: String): Any? { + throwIfKeyKnown(name, requiredKeys, optionalKeys) + throwIfKeyNotPresent(name) + return get(name) + } + } + + interface SetterForBar { + fun getInstance(): MutableMap + fun getBuilderAfterBar(instance: MutableMap): T + + fun bar(value: Int): T { + val instance = getInstance() + instance["bar"] = value + return getBuilderAfterBar(instance) + } + + fun bar(value: Float): T { + val instance = getInstance() + instance["bar"] = value + return getBuilderAfterBar(instance) + } + + fun bar(value: Long): T { + val instance = getInstance() + instance["bar"] = value + return getBuilderAfterBar(instance) + } + + fun bar(value: Double): T { + val instance = getInstance() + instance["bar"] = value + return getBuilderAfterBar(instance) + } + } + + class Schema0Map0Builder(private val instance: MutableMap): UnsetAddPropsSetter, GenericBuilder> { + private val knownKeys: Set = setOf( + "bar" + ) + override fun getKnownKeys(): Set { + return knownKeys + } + override fun build(): Map { + return instance + } + override fun getInstance(): MutableMap { + return instance + } + override fun getBuilderAfterAdditionalProperty(instance: MutableMap): Schema0Map0Builder { + return this + } + } + + class Schema0MapBuilder: SetterForBar { + private val instance: MutableMap + init { + this.instance = LinkedHashMap() + } + override fun getInstance(): MutableMap { + return instance + } + override fun getBuilderAfterBar(instance: MutableMap): Schema0Map0Builder { + return Schema0Map0Builder(instance) + } + } + + + sealed interface Schema0Boxed { + fun getData(): Any? + } + + data class Schema0BoxedVoid(val data: Nothing?) : Schema0Boxed { + override fun getData(): Any? { + return data + } + } + + data class Schema0BoxedBoolean(val data: Boolean): Schema0Boxed { + override fun getData(): Any? { + return data + } + } + + data class Schema0BoxedNumber(val data: Number) : Schema0Boxed { + override fun getData(): Any? { + return data + } + } + + data class Schema0BoxedString(val data: String) : Schema0Boxed { + override fun getData(): Any? { + return data + } + } + + data class Schema0BoxedList(val data: FrozenList) : Schema0Boxed { + override fun getData(): Any? { + return data + } + } + + data class Schema0BoxedMap(val data: Schema0Map) : Schema0Boxed { + override fun getData(): Any? { + return data + } + } + + + class Schema0 private constructor(): JsonSchema( + JsonSchemaInfo() + .properties(mapOf( + "bar" to Bar::class.java + )) + .required(setOf( + "bar" + )) + ), NullSchemaValidator, BooleanSchemaValidator, NumberSchemaValidator, StringSchemaValidator, ListSchemaValidator, Schema0BoxedList>, MapSchemaValidator { + + companion object { + @Volatile + private var instance: Schema0? = null + + fun getInstance() = + instance ?: synchronized(this) { + instance ?: Schema0().also { instance = it } + } + } + + @Throws(ValidationException::class) + override fun validate(arg: Nothing?, configuration: SchemaConfiguration?): Nothing? { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validatedPathToSchemas = PathToSchemasMap() + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, LinkedHashSet()) + getPathToSchemas(this, castArg, validationMetadata, pathSet) + return castArg + } + + @Throws(ValidationException::class) + override fun validate(arg: Boolean, configuration: SchemaConfiguration?): Boolean { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validatedPathToSchemas = PathToSchemasMap() + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, LinkedHashSet()) + getPathToSchemas(this, castArg, validationMetadata, pathSet) + return castArg + } + + @Throws(ValidationException::class) + override fun validate(arg: Number, configuration: SchemaConfiguration?): Number { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validatedPathToSchemas = PathToSchemasMap() + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, LinkedHashSet()) + getPathToSchemas(this, castArg, validationMetadata, pathSet) + return castArg + } + + @Throws(ValidationException::class) + fun validate(arg: Int, configuration: SchemaConfiguration?): Int { + return validate(arg as Number, configuration) as Int + } + + @Throws(ValidationException::class) + fun validate(arg: Long, configuration: SchemaConfiguration?): Long { + return validate(arg as Number, configuration) as Long + } + + @Throws(ValidationException::class) + fun validate(arg: Float, configuration: SchemaConfiguration?): Float { + return validate(arg as Number, configuration) as Float + } + + @Throws(ValidationException::class) + fun validate(arg: Double, configuration: SchemaConfiguration?): Double { + return validate(arg as Number, configuration) as Double + } + + @Throws(ValidationException::class) + override fun validate(arg: String, configuration: SchemaConfiguration?): String { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validatedPathToSchemas = PathToSchemasMap() + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, LinkedHashSet()) + getPathToSchemas(this, castArg, validationMetadata, pathSet) + return castArg + } + + @Throws(ValidationException::class) + fun validate(arg: LocalDate, configuration: SchemaConfiguration?): String { + return validate(arg.toString(), configuration) + } + + @Throws(ValidationException::class) + fun validate(arg: ZonedDateTime, configuration: SchemaConfiguration?): String { + return validate(arg.toString(), configuration) + } + + @Throws(ValidationException::class) + fun validate(arg: UUID, configuration: SchemaConfiguration?): String { + return validate(arg.toString(), configuration) + } + + override fun getNewInstance(arg: List<*>, pathToItem: List, pathToSchemas: PathToSchemasMap): FrozenList { + val items: MutableList = ArrayList() + var i: Int = 0 + for (item: Any? in arg) { + val itemPathToItem = pathToItem + i + val schemas: LinkedHashMap, Nothing?>? = pathToSchemas.get(itemPathToItem) + if (schemas == null) { + throw RuntimeException("Validation result is invalid, schemas must exist for a pathToItem") + } + val itemSchema: JsonSchema<*> = schemas.entries.iterator().next().key + val itemInstance: Any? = itemSchema.getNewInstance(item, itemPathToItem, pathToSchemas) + items.add(itemInstance) + i += 1 + } + val newInstanceItems: FrozenList = FrozenList(items) + return newInstanceItems + } + + @Throws(ValidationException::class) + override fun validate(arg: List<*>, configuration: SchemaConfiguration?): FrozenList { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, PathToSchemasMap(), LinkedHashSet()) + val pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet) + return getNewInstance(castArg, validationMetadata.pathToItem, pathToSchemasMap) + } + + override fun getNewInstance(arg: Map<*, *>, pathToItem: List, pathToSchemas: PathToSchemasMap): Schema0Map { + val properties: LinkedHashMap = LinkedHashMap() + for((propertyName, value) in arg) { + if (!(propertyName is String)) { + throw RuntimeException("Invalid non-string key value") + } + val propertyPathToItem: List = pathToItem + propertyName + val schemas: LinkedHashMap, Nothing?>? = pathToSchemas.get(propertyPathToItem) + if (schemas == null) { + throw RuntimeException("Validation result is invalid, schemas must exist for a pathToItem") + } + val propertySchema: JsonSchema<*> = schemas.entries.iterator().next().key + val propertyInstance: Any? = propertySchema.getNewInstance(value, propertyPathToItem, pathToSchemas) + properties[propertyName] = propertyInstance + } + val castProperties: FrozenMap = FrozenMap(properties) + return Schema0Map(castProperties) + } + + @Throws(ValidationException::class) + override fun validate(arg: Map<*, *>, configuration: SchemaConfiguration?): Schema0Map { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validatedPathToSchemas = PathToSchemasMap() + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, LinkedHashSet()) + val pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet) + return getNewInstance(castArg, validationMetadata.pathToItem, pathToSchemasMap) + } + + @Throws(ValidationException::class) + override fun validate(arg: Any?, configuration: SchemaConfiguration?): Any? { + if (arg == null) { + return validate(null, configuration) + } else if (arg is Boolean) { + return validate(arg, configuration) + } else if (arg is Number) { + return validate(arg, configuration) + } else if (arg is String) { + return validate(arg, configuration) + } else if (arg is List<*>) { + return validate(arg, configuration) + } else if (arg is Map<*, *>) { + return validate(arg, configuration) + } + throw ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema") + } + override fun getNewInstance(arg: Any?, pathToItem: List, pathToSchemas: PathToSchemasMap): Any? { + if (arg == null) { + return getNewInstance( null, pathToItem, pathToSchemas) + } else if (arg is Boolean) { + return getNewInstance(arg, pathToItem, pathToSchemas) + } else if (arg is Number) { + return getNewInstance(arg, pathToItem, pathToSchemas) + } else if (arg is String) { + return getNewInstance(arg, pathToItem, pathToSchemas) + } else if (arg is List<*>) { + return getNewInstance(arg, pathToItem, pathToSchemas) + } else if (arg is Map<*, *>) { + return getNewInstance(arg, pathToItem, pathToSchemas) + } + throw RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema") + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: Nothing?, configuration: SchemaConfiguration?): Schema0BoxedVoid { + return Schema0BoxedVoid(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: Boolean, configuration: SchemaConfiguration?): Schema0BoxedBoolean { + return Schema0BoxedBoolean(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: Number, configuration: SchemaConfiguration?): Schema0BoxedNumber { + return Schema0BoxedNumber(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: String, configuration: SchemaConfiguration?): Schema0BoxedString { + return Schema0BoxedString(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: List<*>, configuration: SchemaConfiguration?): Schema0BoxedList { + return Schema0BoxedList(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: Map<*, *>, configuration: SchemaConfiguration?): Schema0BoxedMap { + return Schema0BoxedMap(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: Any?, configuration: SchemaConfiguration?): Schema0Boxed { + if (arg == null) { + return validateAndBox(null, configuration) + } else if (arg is Boolean) { + return validateAndBox(arg, configuration) + } else if (arg is String) { + return validateAndBox(arg, configuration) + } else if (arg is Number) { + return validateAndBox(arg, configuration) + } else if (arg is List<*>) { + return validateAndBox(arg, configuration) + } else if (arg is Map<*, *>) { + return validateAndBox(arg, configuration) + } + throw ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema") + } + } + + class Foo : StringJsonSchema.StringJsonSchema1() { + companion object { + @Volatile + private var instance: Foo? = null + + fun getInstance() = + instance ?: synchronized(this) { + instance ?: Foo().also { instance = it } + } + } + } + + + class Schema1Map(m: FrozenMap) : FrozenMap(m) { + companion object { + val requiredKeys: Set = setOf( + "foo" + ) + val optionalKeys: Set = setOf() + @Throws(ValidationException::class) + fun of(arg: Map, configuration: SchemaConfiguration): Schema1Map { + return Schema1.getInstance().validate(arg, configuration) + } + } + + fun foo(): String { + val value: Any? = get("foo") + if (!(value is String)) { + throw RuntimeException("Invalid value stored for foo") + } + return value + } + + @Throws(UnsetPropertyException::class, InvalidAdditionalPropertyException::class) + fun getAdditionalProperty(name: String): Any? { + throwIfKeyKnown(name, requiredKeys, optionalKeys) + throwIfKeyNotPresent(name) + return get(name) + } + } + + interface SetterForFoo { + fun getInstance(): MutableMap + fun getBuilderAfterFoo(instance: MutableMap): T + + fun foo(value: String): T { + val instance = getInstance() + instance["foo"] = value + return getBuilderAfterFoo(instance) + } + } + + class Schema1Map0Builder(private val instance: MutableMap): UnsetAddPropsSetter, GenericBuilder> { + private val knownKeys: Set = setOf( + "foo" + ) + override fun getKnownKeys(): Set { + return knownKeys + } + override fun build(): Map { + return instance + } + override fun getInstance(): MutableMap { + return instance + } + override fun getBuilderAfterAdditionalProperty(instance: MutableMap): Schema1Map0Builder { + return this + } + } + + class Schema1MapBuilder: SetterForFoo { + private val instance: MutableMap + init { + this.instance = LinkedHashMap() + } + override fun getInstance(): MutableMap { + return instance + } + override fun getBuilderAfterFoo(instance: MutableMap): Schema1Map0Builder { + return Schema1Map0Builder(instance) + } + } + + + sealed interface Schema1Boxed { + fun getData(): Any? + } + + data class Schema1BoxedVoid(val data: Nothing?) : Schema1Boxed { + override fun getData(): Any? { + return data + } + } + + data class Schema1BoxedBoolean(val data: Boolean): Schema1Boxed { + override fun getData(): Any? { + return data + } + } + + data class Schema1BoxedNumber(val data: Number) : Schema1Boxed { + override fun getData(): Any? { + return data + } + } + + data class Schema1BoxedString(val data: String) : Schema1Boxed { + override fun getData(): Any? { + return data + } + } + + data class Schema1BoxedList(val data: FrozenList) : Schema1Boxed { + override fun getData(): Any? { + return data + } + } + + data class Schema1BoxedMap(val data: Schema1Map) : Schema1Boxed { + override fun getData(): Any? { + return data + } + } + + + class Schema1 private constructor(): JsonSchema( + JsonSchemaInfo() + .properties(mapOf( + "foo" to Foo::class.java + )) + .required(setOf( + "foo" + )) + ), NullSchemaValidator, BooleanSchemaValidator, NumberSchemaValidator, StringSchemaValidator, ListSchemaValidator, Schema1BoxedList>, MapSchemaValidator { + + companion object { + @Volatile + private var instance: Schema1? = null + + fun getInstance() = + instance ?: synchronized(this) { + instance ?: Schema1().also { instance = it } + } + } + + @Throws(ValidationException::class) + override fun validate(arg: Nothing?, configuration: SchemaConfiguration?): Nothing? { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validatedPathToSchemas = PathToSchemasMap() + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, LinkedHashSet()) + getPathToSchemas(this, castArg, validationMetadata, pathSet) + return castArg + } + + @Throws(ValidationException::class) + override fun validate(arg: Boolean, configuration: SchemaConfiguration?): Boolean { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validatedPathToSchemas = PathToSchemasMap() + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, LinkedHashSet()) + getPathToSchemas(this, castArg, validationMetadata, pathSet) + return castArg + } + + @Throws(ValidationException::class) + override fun validate(arg: Number, configuration: SchemaConfiguration?): Number { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validatedPathToSchemas = PathToSchemasMap() + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, LinkedHashSet()) + getPathToSchemas(this, castArg, validationMetadata, pathSet) + return castArg + } + + @Throws(ValidationException::class) + fun validate(arg: Int, configuration: SchemaConfiguration?): Int { + return validate(arg as Number, configuration) as Int + } + + @Throws(ValidationException::class) + fun validate(arg: Long, configuration: SchemaConfiguration?): Long { + return validate(arg as Number, configuration) as Long + } + + @Throws(ValidationException::class) + fun validate(arg: Float, configuration: SchemaConfiguration?): Float { + return validate(arg as Number, configuration) as Float + } + + @Throws(ValidationException::class) + fun validate(arg: Double, configuration: SchemaConfiguration?): Double { + return validate(arg as Number, configuration) as Double + } + + @Throws(ValidationException::class) + override fun validate(arg: String, configuration: SchemaConfiguration?): String { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validatedPathToSchemas = PathToSchemasMap() + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, LinkedHashSet()) + getPathToSchemas(this, castArg, validationMetadata, pathSet) + return castArg + } + + @Throws(ValidationException::class) + fun validate(arg: LocalDate, configuration: SchemaConfiguration?): String { + return validate(arg.toString(), configuration) + } + + @Throws(ValidationException::class) + fun validate(arg: ZonedDateTime, configuration: SchemaConfiguration?): String { + return validate(arg.toString(), configuration) + } + + @Throws(ValidationException::class) + fun validate(arg: UUID, configuration: SchemaConfiguration?): String { + return validate(arg.toString(), configuration) + } + + override fun getNewInstance(arg: List<*>, pathToItem: List, pathToSchemas: PathToSchemasMap): FrozenList { + val items: MutableList = ArrayList() + var i: Int = 0 + for (item: Any? in arg) { + val itemPathToItem = pathToItem + i + val schemas: LinkedHashMap, Nothing?>? = pathToSchemas.get(itemPathToItem) + if (schemas == null) { + throw RuntimeException("Validation result is invalid, schemas must exist for a pathToItem") + } + val itemSchema: JsonSchema<*> = schemas.entries.iterator().next().key + val itemInstance: Any? = itemSchema.getNewInstance(item, itemPathToItem, pathToSchemas) + items.add(itemInstance) + i += 1 + } + val newInstanceItems: FrozenList = FrozenList(items) + return newInstanceItems + } + + @Throws(ValidationException::class) + override fun validate(arg: List<*>, configuration: SchemaConfiguration?): FrozenList { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, PathToSchemasMap(), LinkedHashSet()) + val pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet) + return getNewInstance(castArg, validationMetadata.pathToItem, pathToSchemasMap) + } + + override fun getNewInstance(arg: Map<*, *>, pathToItem: List, pathToSchemas: PathToSchemasMap): Schema1Map { + val properties: LinkedHashMap = LinkedHashMap() + for((propertyName, value) in arg) { + if (!(propertyName is String)) { + throw RuntimeException("Invalid non-string key value") + } + val propertyPathToItem: List = pathToItem + propertyName + val schemas: LinkedHashMap, Nothing?>? = pathToSchemas.get(propertyPathToItem) + if (schemas == null) { + throw RuntimeException("Validation result is invalid, schemas must exist for a pathToItem") + } + val propertySchema: JsonSchema<*> = schemas.entries.iterator().next().key + val propertyInstance: Any? = propertySchema.getNewInstance(value, propertyPathToItem, pathToSchemas) + properties[propertyName] = propertyInstance + } + val castProperties: FrozenMap = FrozenMap(properties) + return Schema1Map(castProperties) + } + + @Throws(ValidationException::class) + override fun validate(arg: Map<*, *>, configuration: SchemaConfiguration?): Schema1Map { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validatedPathToSchemas = PathToSchemasMap() + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, LinkedHashSet()) + val pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet) + return getNewInstance(castArg, validationMetadata.pathToItem, pathToSchemasMap) + } + + @Throws(ValidationException::class) + override fun validate(arg: Any?, configuration: SchemaConfiguration?): Any? { + if (arg == null) { + return validate(null, configuration) + } else if (arg is Boolean) { + return validate(arg, configuration) + } else if (arg is Number) { + return validate(arg, configuration) + } else if (arg is String) { + return validate(arg, configuration) + } else if (arg is List<*>) { + return validate(arg, configuration) + } else if (arg is Map<*, *>) { + return validate(arg, configuration) + } + throw ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema") + } + override fun getNewInstance(arg: Any?, pathToItem: List, pathToSchemas: PathToSchemasMap): Any? { + if (arg == null) { + return getNewInstance( null, pathToItem, pathToSchemas) + } else if (arg is Boolean) { + return getNewInstance(arg, pathToItem, pathToSchemas) + } else if (arg is Number) { + return getNewInstance(arg, pathToItem, pathToSchemas) + } else if (arg is String) { + return getNewInstance(arg, pathToItem, pathToSchemas) + } else if (arg is List<*>) { + return getNewInstance(arg, pathToItem, pathToSchemas) + } else if (arg is Map<*, *>) { + return getNewInstance(arg, pathToItem, pathToSchemas) + } + throw RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema") + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: Nothing?, configuration: SchemaConfiguration?): Schema1BoxedVoid { + return Schema1BoxedVoid(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: Boolean, configuration: SchemaConfiguration?): Schema1BoxedBoolean { + return Schema1BoxedBoolean(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: Number, configuration: SchemaConfiguration?): Schema1BoxedNumber { + return Schema1BoxedNumber(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: String, configuration: SchemaConfiguration?): Schema1BoxedString { + return Schema1BoxedString(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: List<*>, configuration: SchemaConfiguration?): Schema1BoxedList { + return Schema1BoxedList(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: Map<*, *>, configuration: SchemaConfiguration?): Schema1BoxedMap { + return Schema1BoxedMap(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: Any?, configuration: SchemaConfiguration?): Schema1Boxed { + if (arg == null) { + return validateAndBox(null, configuration) + } else if (arg is Boolean) { + return validateAndBox(arg, configuration) + } else if (arg is String) { + return validateAndBox(arg, configuration) + } else if (arg is Number) { + return validateAndBox(arg, configuration) + } else if (arg is List<*>) { + return validateAndBox(arg, configuration) + } else if (arg is Map<*, *>) { + return validateAndBox(arg, configuration) + } + throw ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema") + } + } + + sealed interface Allof1Boxed { + fun getData(): Any? + } + + data class Allof1BoxedVoid(val data: Nothing?) : Allof1Boxed { + override fun getData(): Any? { + return data + } + } + + data class Allof1BoxedBoolean(val data: Boolean): Allof1Boxed { + override fun getData(): Any? { + return data + } + } + + data class Allof1BoxedNumber(val data: Number) : Allof1Boxed { + override fun getData(): Any? { + return data + } + } + + data class Allof1BoxedString(val data: String) : Allof1Boxed { + override fun getData(): Any? { + return data + } + } + + data class Allof1BoxedList(val data: FrozenList) : Allof1Boxed { + override fun getData(): Any? { + return data + } + } + + data class Allof1BoxedMap(val data: FrozenMap) : Allof1Boxed { + override fun getData(): Any? { + return data + } + } + + + class Allof1 private constructor(): JsonSchema( + JsonSchemaInfo() + .allOf(listOf( + Schema0::class.java, + Schema1::class.java + )) + ), NullSchemaValidator, BooleanSchemaValidator, NumberSchemaValidator, StringSchemaValidator, ListSchemaValidator, Allof1BoxedList>, MapSchemaValidator, Allof1BoxedMap> { + /* + NOTE: This class is auto generated by OpenAPI JSON Schema Generator. + Ref: https://github.com/openapi-json-schema-tools/openapi-json-schema-generator + + Do not edit the class manually. + */ + + companion object { + @Volatile + private var instance: Allof1? = null + + fun getInstance() = + instance ?: synchronized(this) { + instance ?: Allof1().also { instance = it } + } + } + + @Throws(ValidationException::class) + override fun validate(arg: Nothing?, configuration: SchemaConfiguration?): Nothing? { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validatedPathToSchemas = PathToSchemasMap() + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, LinkedHashSet()) + getPathToSchemas(this, castArg, validationMetadata, pathSet) + return castArg + } + + @Throws(ValidationException::class) + override fun validate(arg: Boolean, configuration: SchemaConfiguration?): Boolean { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validatedPathToSchemas = PathToSchemasMap() + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, LinkedHashSet()) + getPathToSchemas(this, castArg, validationMetadata, pathSet) + return castArg + } + + @Throws(ValidationException::class) + override fun validate(arg: Number, configuration: SchemaConfiguration?): Number { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validatedPathToSchemas = PathToSchemasMap() + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, LinkedHashSet()) + getPathToSchemas(this, castArg, validationMetadata, pathSet) + return castArg + } + + @Throws(ValidationException::class) + fun validate(arg: Int, configuration: SchemaConfiguration?): Int { + return validate(arg as Number, configuration) as Int + } + + @Throws(ValidationException::class) + fun validate(arg: Long, configuration: SchemaConfiguration?): Long { + return validate(arg as Number, configuration) as Long + } + + @Throws(ValidationException::class) + fun validate(arg: Float, configuration: SchemaConfiguration?): Float { + return validate(arg as Number, configuration) as Float + } + + @Throws(ValidationException::class) + fun validate(arg: Double, configuration: SchemaConfiguration?): Double { + return validate(arg as Number, configuration) as Double + } + + @Throws(ValidationException::class) + override fun validate(arg: String, configuration: SchemaConfiguration?): String { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validatedPathToSchemas = PathToSchemasMap() + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, LinkedHashSet()) + getPathToSchemas(this, castArg, validationMetadata, pathSet) + return castArg + } + + @Throws(ValidationException::class) + fun validate(arg: LocalDate, configuration: SchemaConfiguration?): String { + return validate(arg.toString(), configuration) + } + + @Throws(ValidationException::class) + fun validate(arg: ZonedDateTime, configuration: SchemaConfiguration?): String { + return validate(arg.toString(), configuration) + } + + @Throws(ValidationException::class) + fun validate(arg: UUID, configuration: SchemaConfiguration?): String { + return validate(arg.toString(), configuration) + } + + override fun getNewInstance(arg: List<*>, pathToItem: List, pathToSchemas: PathToSchemasMap): FrozenList { + val items: MutableList = ArrayList() + var i: Int = 0 + for (item: Any? in arg) { + val itemPathToItem = pathToItem + i + val schemas: LinkedHashMap, Nothing?>? = pathToSchemas.get(itemPathToItem) + if (schemas == null) { + throw RuntimeException("Validation result is invalid, schemas must exist for a pathToItem") + } + val itemSchema: JsonSchema<*> = schemas.entries.iterator().next().key + val itemInstance: Any? = itemSchema.getNewInstance(item, itemPathToItem, pathToSchemas) + items.add(itemInstance) + i += 1 + } + val newInstanceItems: FrozenList = FrozenList(items) + return newInstanceItems + } + + @Throws(ValidationException::class) + override fun validate(arg: List<*>, configuration: SchemaConfiguration?): FrozenList { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, PathToSchemasMap(), LinkedHashSet()) + val pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet) + return getNewInstance(castArg, validationMetadata.pathToItem, pathToSchemasMap) + } + + override fun getNewInstance(arg: Map<*, *>, pathToItem: List, pathToSchemas: PathToSchemasMap): FrozenMap { + val properties: LinkedHashMap = LinkedHashMap() + for((propertyName, value) in arg) { + if (!(propertyName is String)) { + throw RuntimeException("Invalid non-string key value") + } + val propertyPathToItem: List = pathToItem + propertyName + val schemas: LinkedHashMap, Nothing?>? = pathToSchemas.get(propertyPathToItem) + if (schemas == null) { + throw RuntimeException("Validation result is invalid, schemas must exist for a pathToItem") + } + val propertySchema: JsonSchema<*> = schemas.entries.iterator().next().key + val propertyInstance: Any? = propertySchema.getNewInstance(value, propertyPathToItem, pathToSchemas) + properties[propertyName] = propertyInstance + } + val castProperties: FrozenMap = FrozenMap(properties) + return castProperties + } + + @Throws(ValidationException::class) + override fun validate(arg: Map<*, *>, configuration: SchemaConfiguration?): FrozenMap { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validatedPathToSchemas = PathToSchemasMap() + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, LinkedHashSet()) + val pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet) + return getNewInstance(castArg, validationMetadata.pathToItem, pathToSchemasMap) + } + + @Throws(ValidationException::class) + override fun validate(arg: Any?, configuration: SchemaConfiguration?): Any? { + if (arg == null) { + return validate(null, configuration) + } else if (arg is Boolean) { + return validate(arg, configuration) + } else if (arg is Number) { + return validate(arg, configuration) + } else if (arg is String) { + return validate(arg, configuration) + } else if (arg is List<*>) { + return validate(arg, configuration) + } else if (arg is Map<*, *>) { + return validate(arg, configuration) + } + throw ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema") + } + override fun getNewInstance(arg: Any?, pathToItem: List, pathToSchemas: PathToSchemasMap): Any? { + if (arg == null) { + return getNewInstance( null, pathToItem, pathToSchemas) + } else if (arg is Boolean) { + return getNewInstance(arg, pathToItem, pathToSchemas) + } else if (arg is Number) { + return getNewInstance(arg, pathToItem, pathToSchemas) + } else if (arg is String) { + return getNewInstance(arg, pathToItem, pathToSchemas) + } else if (arg is List<*>) { + return getNewInstance(arg, pathToItem, pathToSchemas) + } else if (arg is Map<*, *>) { + return getNewInstance(arg, pathToItem, pathToSchemas) + } + throw RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema") + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: Nothing?, configuration: SchemaConfiguration?): Allof1BoxedVoid { + return Allof1BoxedVoid(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: Boolean, configuration: SchemaConfiguration?): Allof1BoxedBoolean { + return Allof1BoxedBoolean(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: Number, configuration: SchemaConfiguration?): Allof1BoxedNumber { + return Allof1BoxedNumber(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: String, configuration: SchemaConfiguration?): Allof1BoxedString { + return Allof1BoxedString(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: List<*>, configuration: SchemaConfiguration?): Allof1BoxedList { + return Allof1BoxedList(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: Map<*, *>, configuration: SchemaConfiguration?): Allof1BoxedMap { + return Allof1BoxedMap(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: Any?, configuration: SchemaConfiguration?): Allof1Boxed { + if (arg == null) { + return validateAndBox(null, configuration) + } else if (arg is Boolean) { + return validateAndBox(arg, configuration) + } else if (arg is String) { + return validateAndBox(arg, configuration) + } else if (arg is Number) { + return validateAndBox(arg, configuration) + } else if (arg is List<*>) { + return validateAndBox(arg, configuration) + } else if (arg is Map<*, *>) { + return validateAndBox(arg, configuration) + } + throw ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema") + } + } +} diff --git a/samples/client/3_0_3_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/schemas/AllofCombinedWithAnyofOneof.kt b/samples/client/3_0_3_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/schemas/AllofCombinedWithAnyofOneof.kt new file mode 100644 index 00000000000..22448768881 --- /dev/null +++ b/samples/client/3_0_3_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/schemas/AllofCombinedWithAnyofOneof.kt @@ -0,0 +1,1142 @@ +package org.openapijsonschematools.client.components.schemas +import java.math.BigDecimal +import java.time.LocalDate +import java.time.ZonedDateTime +import java.util.UUID +import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags +import org.openapijsonschematools.client.configurations.SchemaConfiguration +import org.openapijsonschematools.client.exceptions.InvalidAdditionalPropertyException +import org.openapijsonschematools.client.exceptions.UnsetPropertyException +import org.openapijsonschematools.client.exceptions.ValidationException +import org.openapijsonschematools.client.schemas.UnsetAddPropsSetter +import org.openapijsonschematools.client.schemas.validation.BooleanSchemaValidator +import org.openapijsonschematools.client.schemas.validation.FrozenList +import org.openapijsonschematools.client.schemas.validation.FrozenMap +import org.openapijsonschematools.client.schemas.validation.JsonSchema +import org.openapijsonschematools.client.schemas.validation.JsonSchemaInfo +import org.openapijsonschematools.client.schemas.validation.ListSchemaValidator +import org.openapijsonschematools.client.schemas.validation.MapSchemaValidator +import org.openapijsonschematools.client.schemas.validation.NullSchemaValidator +import org.openapijsonschematools.client.schemas.validation.NumberSchemaValidator +import org.openapijsonschematools.client.schemas.validation.PathToSchemasMap +import org.openapijsonschematools.client.schemas.validation.StringSchemaValidator +import org.openapijsonschematools.client.schemas.validation.ValidationMetadata + +class AllofCombinedWithAnyofOneof { + // nest classes so all schemas and input/output classes can be public + + + sealed interface Schema02Boxed { + fun getData(): Any? + } + + data class Schema02BoxedVoid(val data: Nothing?) : Schema02Boxed { + override fun getData(): Any? { + return data + } + } + + data class Schema02BoxedBoolean(val data: Boolean): Schema02Boxed { + override fun getData(): Any? { + return data + } + } + + data class Schema02BoxedNumber(val data: Number) : Schema02Boxed { + override fun getData(): Any? { + return data + } + } + + data class Schema02BoxedString(val data: String) : Schema02Boxed { + override fun getData(): Any? { + return data + } + } + + data class Schema02BoxedList(val data: FrozenList) : Schema02Boxed { + override fun getData(): Any? { + return data + } + } + + data class Schema02BoxedMap(val data: FrozenMap) : Schema02Boxed { + override fun getData(): Any? { + return data + } + } + + + class Schema02 private constructor(): JsonSchema( + JsonSchemaInfo() + .multipleOf(BigDecimal("2")) + ), NullSchemaValidator, BooleanSchemaValidator, NumberSchemaValidator, StringSchemaValidator, ListSchemaValidator, Schema02BoxedList>, MapSchemaValidator, Schema02BoxedMap> { + + companion object { + @Volatile + private var instance: Schema02? = null + + fun getInstance() = + instance ?: synchronized(this) { + instance ?: Schema02().also { instance = it } + } + } + + @Throws(ValidationException::class) + override fun validate(arg: Nothing?, configuration: SchemaConfiguration?): Nothing? { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validatedPathToSchemas = PathToSchemasMap() + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, LinkedHashSet()) + getPathToSchemas(this, castArg, validationMetadata, pathSet) + return castArg + } + + @Throws(ValidationException::class) + override fun validate(arg: Boolean, configuration: SchemaConfiguration?): Boolean { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validatedPathToSchemas = PathToSchemasMap() + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, LinkedHashSet()) + getPathToSchemas(this, castArg, validationMetadata, pathSet) + return castArg + } + + @Throws(ValidationException::class) + override fun validate(arg: Number, configuration: SchemaConfiguration?): Number { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validatedPathToSchemas = PathToSchemasMap() + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, LinkedHashSet()) + getPathToSchemas(this, castArg, validationMetadata, pathSet) + return castArg + } + + @Throws(ValidationException::class) + fun validate(arg: Int, configuration: SchemaConfiguration?): Int { + return validate(arg as Number, configuration) as Int + } + + @Throws(ValidationException::class) + fun validate(arg: Long, configuration: SchemaConfiguration?): Long { + return validate(arg as Number, configuration) as Long + } + + @Throws(ValidationException::class) + fun validate(arg: Float, configuration: SchemaConfiguration?): Float { + return validate(arg as Number, configuration) as Float + } + + @Throws(ValidationException::class) + fun validate(arg: Double, configuration: SchemaConfiguration?): Double { + return validate(arg as Number, configuration) as Double + } + + @Throws(ValidationException::class) + override fun validate(arg: String, configuration: SchemaConfiguration?): String { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validatedPathToSchemas = PathToSchemasMap() + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, LinkedHashSet()) + getPathToSchemas(this, castArg, validationMetadata, pathSet) + return castArg + } + + @Throws(ValidationException::class) + fun validate(arg: LocalDate, configuration: SchemaConfiguration?): String { + return validate(arg.toString(), configuration) + } + + @Throws(ValidationException::class) + fun validate(arg: ZonedDateTime, configuration: SchemaConfiguration?): String { + return validate(arg.toString(), configuration) + } + + @Throws(ValidationException::class) + fun validate(arg: UUID, configuration: SchemaConfiguration?): String { + return validate(arg.toString(), configuration) + } + + override fun getNewInstance(arg: List<*>, pathToItem: List, pathToSchemas: PathToSchemasMap): FrozenList { + val items: MutableList = ArrayList() + var i: Int = 0 + for (item: Any? in arg) { + val itemPathToItem = pathToItem + i + val schemas: LinkedHashMap, Nothing?>? = pathToSchemas.get(itemPathToItem) + if (schemas == null) { + throw RuntimeException("Validation result is invalid, schemas must exist for a pathToItem") + } + val itemSchema: JsonSchema<*> = schemas.entries.iterator().next().key + val itemInstance: Any? = itemSchema.getNewInstance(item, itemPathToItem, pathToSchemas) + items.add(itemInstance) + i += 1 + } + val newInstanceItems: FrozenList = FrozenList(items) + return newInstanceItems + } + + @Throws(ValidationException::class) + override fun validate(arg: List<*>, configuration: SchemaConfiguration?): FrozenList { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, PathToSchemasMap(), LinkedHashSet()) + val pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet) + return getNewInstance(castArg, validationMetadata.pathToItem, pathToSchemasMap) + } + + override fun getNewInstance(arg: Map<*, *>, pathToItem: List, pathToSchemas: PathToSchemasMap): FrozenMap { + val properties: LinkedHashMap = LinkedHashMap() + for((propertyName, value) in arg) { + if (!(propertyName is String)) { + throw RuntimeException("Invalid non-string key value") + } + val propertyPathToItem: List = pathToItem + propertyName + val schemas: LinkedHashMap, Nothing?>? = pathToSchemas.get(propertyPathToItem) + if (schemas == null) { + throw RuntimeException("Validation result is invalid, schemas must exist for a pathToItem") + } + val propertySchema: JsonSchema<*> = schemas.entries.iterator().next().key + val propertyInstance: Any? = propertySchema.getNewInstance(value, propertyPathToItem, pathToSchemas) + properties[propertyName] = propertyInstance + } + val castProperties: FrozenMap = FrozenMap(properties) + return castProperties + } + + @Throws(ValidationException::class) + override fun validate(arg: Map<*, *>, configuration: SchemaConfiguration?): FrozenMap { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validatedPathToSchemas = PathToSchemasMap() + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, LinkedHashSet()) + val pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet) + return getNewInstance(castArg, validationMetadata.pathToItem, pathToSchemasMap) + } + + @Throws(ValidationException::class) + override fun validate(arg: Any?, configuration: SchemaConfiguration?): Any? { + if (arg == null) { + return validate(null, configuration) + } else if (arg is Boolean) { + return validate(arg, configuration) + } else if (arg is Number) { + return validate(arg, configuration) + } else if (arg is String) { + return validate(arg, configuration) + } else if (arg is List<*>) { + return validate(arg, configuration) + } else if (arg is Map<*, *>) { + return validate(arg, configuration) + } + throw ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema") + } + override fun getNewInstance(arg: Any?, pathToItem: List, pathToSchemas: PathToSchemasMap): Any? { + if (arg == null) { + return getNewInstance( null, pathToItem, pathToSchemas) + } else if (arg is Boolean) { + return getNewInstance(arg, pathToItem, pathToSchemas) + } else if (arg is Number) { + return getNewInstance(arg, pathToItem, pathToSchemas) + } else if (arg is String) { + return getNewInstance(arg, pathToItem, pathToSchemas) + } else if (arg is List<*>) { + return getNewInstance(arg, pathToItem, pathToSchemas) + } else if (arg is Map<*, *>) { + return getNewInstance(arg, pathToItem, pathToSchemas) + } + throw RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema") + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: Nothing?, configuration: SchemaConfiguration?): Schema02BoxedVoid { + return Schema02BoxedVoid(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: Boolean, configuration: SchemaConfiguration?): Schema02BoxedBoolean { + return Schema02BoxedBoolean(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: Number, configuration: SchemaConfiguration?): Schema02BoxedNumber { + return Schema02BoxedNumber(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: String, configuration: SchemaConfiguration?): Schema02BoxedString { + return Schema02BoxedString(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: List<*>, configuration: SchemaConfiguration?): Schema02BoxedList { + return Schema02BoxedList(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: Map<*, *>, configuration: SchemaConfiguration?): Schema02BoxedMap { + return Schema02BoxedMap(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: Any?, configuration: SchemaConfiguration?): Schema02Boxed { + if (arg == null) { + return validateAndBox(null, configuration) + } else if (arg is Boolean) { + return validateAndBox(arg, configuration) + } else if (arg is String) { + return validateAndBox(arg, configuration) + } else if (arg is Number) { + return validateAndBox(arg, configuration) + } else if (arg is List<*>) { + return validateAndBox(arg, configuration) + } else if (arg is Map<*, *>) { + return validateAndBox(arg, configuration) + } + throw ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema") + } + } + + sealed interface Schema01Boxed { + fun getData(): Any? + } + + data class Schema01BoxedVoid(val data: Nothing?) : Schema01Boxed { + override fun getData(): Any? { + return data + } + } + + data class Schema01BoxedBoolean(val data: Boolean): Schema01Boxed { + override fun getData(): Any? { + return data + } + } + + data class Schema01BoxedNumber(val data: Number) : Schema01Boxed { + override fun getData(): Any? { + return data + } + } + + data class Schema01BoxedString(val data: String) : Schema01Boxed { + override fun getData(): Any? { + return data + } + } + + data class Schema01BoxedList(val data: FrozenList) : Schema01Boxed { + override fun getData(): Any? { + return data + } + } + + data class Schema01BoxedMap(val data: FrozenMap) : Schema01Boxed { + override fun getData(): Any? { + return data + } + } + + + class Schema01 private constructor(): JsonSchema( + JsonSchemaInfo() + .multipleOf(BigDecimal("3")) + ), NullSchemaValidator, BooleanSchemaValidator, NumberSchemaValidator, StringSchemaValidator, ListSchemaValidator, Schema01BoxedList>, MapSchemaValidator, Schema01BoxedMap> { + + companion object { + @Volatile + private var instance: Schema01? = null + + fun getInstance() = + instance ?: synchronized(this) { + instance ?: Schema01().also { instance = it } + } + } + + @Throws(ValidationException::class) + override fun validate(arg: Nothing?, configuration: SchemaConfiguration?): Nothing? { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validatedPathToSchemas = PathToSchemasMap() + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, LinkedHashSet()) + getPathToSchemas(this, castArg, validationMetadata, pathSet) + return castArg + } + + @Throws(ValidationException::class) + override fun validate(arg: Boolean, configuration: SchemaConfiguration?): Boolean { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validatedPathToSchemas = PathToSchemasMap() + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, LinkedHashSet()) + getPathToSchemas(this, castArg, validationMetadata, pathSet) + return castArg + } + + @Throws(ValidationException::class) + override fun validate(arg: Number, configuration: SchemaConfiguration?): Number { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validatedPathToSchemas = PathToSchemasMap() + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, LinkedHashSet()) + getPathToSchemas(this, castArg, validationMetadata, pathSet) + return castArg + } + + @Throws(ValidationException::class) + fun validate(arg: Int, configuration: SchemaConfiguration?): Int { + return validate(arg as Number, configuration) as Int + } + + @Throws(ValidationException::class) + fun validate(arg: Long, configuration: SchemaConfiguration?): Long { + return validate(arg as Number, configuration) as Long + } + + @Throws(ValidationException::class) + fun validate(arg: Float, configuration: SchemaConfiguration?): Float { + return validate(arg as Number, configuration) as Float + } + + @Throws(ValidationException::class) + fun validate(arg: Double, configuration: SchemaConfiguration?): Double { + return validate(arg as Number, configuration) as Double + } + + @Throws(ValidationException::class) + override fun validate(arg: String, configuration: SchemaConfiguration?): String { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validatedPathToSchemas = PathToSchemasMap() + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, LinkedHashSet()) + getPathToSchemas(this, castArg, validationMetadata, pathSet) + return castArg + } + + @Throws(ValidationException::class) + fun validate(arg: LocalDate, configuration: SchemaConfiguration?): String { + return validate(arg.toString(), configuration) + } + + @Throws(ValidationException::class) + fun validate(arg: ZonedDateTime, configuration: SchemaConfiguration?): String { + return validate(arg.toString(), configuration) + } + + @Throws(ValidationException::class) + fun validate(arg: UUID, configuration: SchemaConfiguration?): String { + return validate(arg.toString(), configuration) + } + + override fun getNewInstance(arg: List<*>, pathToItem: List, pathToSchemas: PathToSchemasMap): FrozenList { + val items: MutableList = ArrayList() + var i: Int = 0 + for (item: Any? in arg) { + val itemPathToItem = pathToItem + i + val schemas: LinkedHashMap, Nothing?>? = pathToSchemas.get(itemPathToItem) + if (schemas == null) { + throw RuntimeException("Validation result is invalid, schemas must exist for a pathToItem") + } + val itemSchema: JsonSchema<*> = schemas.entries.iterator().next().key + val itemInstance: Any? = itemSchema.getNewInstance(item, itemPathToItem, pathToSchemas) + items.add(itemInstance) + i += 1 + } + val newInstanceItems: FrozenList = FrozenList(items) + return newInstanceItems + } + + @Throws(ValidationException::class) + override fun validate(arg: List<*>, configuration: SchemaConfiguration?): FrozenList { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, PathToSchemasMap(), LinkedHashSet()) + val pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet) + return getNewInstance(castArg, validationMetadata.pathToItem, pathToSchemasMap) + } + + override fun getNewInstance(arg: Map<*, *>, pathToItem: List, pathToSchemas: PathToSchemasMap): FrozenMap { + val properties: LinkedHashMap = LinkedHashMap() + for((propertyName, value) in arg) { + if (!(propertyName is String)) { + throw RuntimeException("Invalid non-string key value") + } + val propertyPathToItem: List = pathToItem + propertyName + val schemas: LinkedHashMap, Nothing?>? = pathToSchemas.get(propertyPathToItem) + if (schemas == null) { + throw RuntimeException("Validation result is invalid, schemas must exist for a pathToItem") + } + val propertySchema: JsonSchema<*> = schemas.entries.iterator().next().key + val propertyInstance: Any? = propertySchema.getNewInstance(value, propertyPathToItem, pathToSchemas) + properties[propertyName] = propertyInstance + } + val castProperties: FrozenMap = FrozenMap(properties) + return castProperties + } + + @Throws(ValidationException::class) + override fun validate(arg: Map<*, *>, configuration: SchemaConfiguration?): FrozenMap { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validatedPathToSchemas = PathToSchemasMap() + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, LinkedHashSet()) + val pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet) + return getNewInstance(castArg, validationMetadata.pathToItem, pathToSchemasMap) + } + + @Throws(ValidationException::class) + override fun validate(arg: Any?, configuration: SchemaConfiguration?): Any? { + if (arg == null) { + return validate(null, configuration) + } else if (arg is Boolean) { + return validate(arg, configuration) + } else if (arg is Number) { + return validate(arg, configuration) + } else if (arg is String) { + return validate(arg, configuration) + } else if (arg is List<*>) { + return validate(arg, configuration) + } else if (arg is Map<*, *>) { + return validate(arg, configuration) + } + throw ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema") + } + override fun getNewInstance(arg: Any?, pathToItem: List, pathToSchemas: PathToSchemasMap): Any? { + if (arg == null) { + return getNewInstance( null, pathToItem, pathToSchemas) + } else if (arg is Boolean) { + return getNewInstance(arg, pathToItem, pathToSchemas) + } else if (arg is Number) { + return getNewInstance(arg, pathToItem, pathToSchemas) + } else if (arg is String) { + return getNewInstance(arg, pathToItem, pathToSchemas) + } else if (arg is List<*>) { + return getNewInstance(arg, pathToItem, pathToSchemas) + } else if (arg is Map<*, *>) { + return getNewInstance(arg, pathToItem, pathToSchemas) + } + throw RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema") + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: Nothing?, configuration: SchemaConfiguration?): Schema01BoxedVoid { + return Schema01BoxedVoid(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: Boolean, configuration: SchemaConfiguration?): Schema01BoxedBoolean { + return Schema01BoxedBoolean(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: Number, configuration: SchemaConfiguration?): Schema01BoxedNumber { + return Schema01BoxedNumber(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: String, configuration: SchemaConfiguration?): Schema01BoxedString { + return Schema01BoxedString(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: List<*>, configuration: SchemaConfiguration?): Schema01BoxedList { + return Schema01BoxedList(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: Map<*, *>, configuration: SchemaConfiguration?): Schema01BoxedMap { + return Schema01BoxedMap(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: Any?, configuration: SchemaConfiguration?): Schema01Boxed { + if (arg == null) { + return validateAndBox(null, configuration) + } else if (arg is Boolean) { + return validateAndBox(arg, configuration) + } else if (arg is String) { + return validateAndBox(arg, configuration) + } else if (arg is Number) { + return validateAndBox(arg, configuration) + } else if (arg is List<*>) { + return validateAndBox(arg, configuration) + } else if (arg is Map<*, *>) { + return validateAndBox(arg, configuration) + } + throw ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema") + } + } + + sealed interface Schema0Boxed { + fun getData(): Any? + } + + data class Schema0BoxedVoid(val data: Nothing?) : Schema0Boxed { + override fun getData(): Any? { + return data + } + } + + data class Schema0BoxedBoolean(val data: Boolean): Schema0Boxed { + override fun getData(): Any? { + return data + } + } + + data class Schema0BoxedNumber(val data: Number) : Schema0Boxed { + override fun getData(): Any? { + return data + } + } + + data class Schema0BoxedString(val data: String) : Schema0Boxed { + override fun getData(): Any? { + return data + } + } + + data class Schema0BoxedList(val data: FrozenList) : Schema0Boxed { + override fun getData(): Any? { + return data + } + } + + data class Schema0BoxedMap(val data: FrozenMap) : Schema0Boxed { + override fun getData(): Any? { + return data + } + } + + + class Schema0 private constructor(): JsonSchema( + JsonSchemaInfo() + .multipleOf(BigDecimal("5")) + ), NullSchemaValidator, BooleanSchemaValidator, NumberSchemaValidator, StringSchemaValidator, ListSchemaValidator, Schema0BoxedList>, MapSchemaValidator, Schema0BoxedMap> { + + companion object { + @Volatile + private var instance: Schema0? = null + + fun getInstance() = + instance ?: synchronized(this) { + instance ?: Schema0().also { instance = it } + } + } + + @Throws(ValidationException::class) + override fun validate(arg: Nothing?, configuration: SchemaConfiguration?): Nothing? { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validatedPathToSchemas = PathToSchemasMap() + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, LinkedHashSet()) + getPathToSchemas(this, castArg, validationMetadata, pathSet) + return castArg + } + + @Throws(ValidationException::class) + override fun validate(arg: Boolean, configuration: SchemaConfiguration?): Boolean { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validatedPathToSchemas = PathToSchemasMap() + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, LinkedHashSet()) + getPathToSchemas(this, castArg, validationMetadata, pathSet) + return castArg + } + + @Throws(ValidationException::class) + override fun validate(arg: Number, configuration: SchemaConfiguration?): Number { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validatedPathToSchemas = PathToSchemasMap() + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, LinkedHashSet()) + getPathToSchemas(this, castArg, validationMetadata, pathSet) + return castArg + } + + @Throws(ValidationException::class) + fun validate(arg: Int, configuration: SchemaConfiguration?): Int { + return validate(arg as Number, configuration) as Int + } + + @Throws(ValidationException::class) + fun validate(arg: Long, configuration: SchemaConfiguration?): Long { + return validate(arg as Number, configuration) as Long + } + + @Throws(ValidationException::class) + fun validate(arg: Float, configuration: SchemaConfiguration?): Float { + return validate(arg as Number, configuration) as Float + } + + @Throws(ValidationException::class) + fun validate(arg: Double, configuration: SchemaConfiguration?): Double { + return validate(arg as Number, configuration) as Double + } + + @Throws(ValidationException::class) + override fun validate(arg: String, configuration: SchemaConfiguration?): String { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validatedPathToSchemas = PathToSchemasMap() + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, LinkedHashSet()) + getPathToSchemas(this, castArg, validationMetadata, pathSet) + return castArg + } + + @Throws(ValidationException::class) + fun validate(arg: LocalDate, configuration: SchemaConfiguration?): String { + return validate(arg.toString(), configuration) + } + + @Throws(ValidationException::class) + fun validate(arg: ZonedDateTime, configuration: SchemaConfiguration?): String { + return validate(arg.toString(), configuration) + } + + @Throws(ValidationException::class) + fun validate(arg: UUID, configuration: SchemaConfiguration?): String { + return validate(arg.toString(), configuration) + } + + override fun getNewInstance(arg: List<*>, pathToItem: List, pathToSchemas: PathToSchemasMap): FrozenList { + val items: MutableList = ArrayList() + var i: Int = 0 + for (item: Any? in arg) { + val itemPathToItem = pathToItem + i + val schemas: LinkedHashMap, Nothing?>? = pathToSchemas.get(itemPathToItem) + if (schemas == null) { + throw RuntimeException("Validation result is invalid, schemas must exist for a pathToItem") + } + val itemSchema: JsonSchema<*> = schemas.entries.iterator().next().key + val itemInstance: Any? = itemSchema.getNewInstance(item, itemPathToItem, pathToSchemas) + items.add(itemInstance) + i += 1 + } + val newInstanceItems: FrozenList = FrozenList(items) + return newInstanceItems + } + + @Throws(ValidationException::class) + override fun validate(arg: List<*>, configuration: SchemaConfiguration?): FrozenList { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, PathToSchemasMap(), LinkedHashSet()) + val pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet) + return getNewInstance(castArg, validationMetadata.pathToItem, pathToSchemasMap) + } + + override fun getNewInstance(arg: Map<*, *>, pathToItem: List, pathToSchemas: PathToSchemasMap): FrozenMap { + val properties: LinkedHashMap = LinkedHashMap() + for((propertyName, value) in arg) { + if (!(propertyName is String)) { + throw RuntimeException("Invalid non-string key value") + } + val propertyPathToItem: List = pathToItem + propertyName + val schemas: LinkedHashMap, Nothing?>? = pathToSchemas.get(propertyPathToItem) + if (schemas == null) { + throw RuntimeException("Validation result is invalid, schemas must exist for a pathToItem") + } + val propertySchema: JsonSchema<*> = schemas.entries.iterator().next().key + val propertyInstance: Any? = propertySchema.getNewInstance(value, propertyPathToItem, pathToSchemas) + properties[propertyName] = propertyInstance + } + val castProperties: FrozenMap = FrozenMap(properties) + return castProperties + } + + @Throws(ValidationException::class) + override fun validate(arg: Map<*, *>, configuration: SchemaConfiguration?): FrozenMap { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validatedPathToSchemas = PathToSchemasMap() + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, LinkedHashSet()) + val pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet) + return getNewInstance(castArg, validationMetadata.pathToItem, pathToSchemasMap) + } + + @Throws(ValidationException::class) + override fun validate(arg: Any?, configuration: SchemaConfiguration?): Any? { + if (arg == null) { + return validate(null, configuration) + } else if (arg is Boolean) { + return validate(arg, configuration) + } else if (arg is Number) { + return validate(arg, configuration) + } else if (arg is String) { + return validate(arg, configuration) + } else if (arg is List<*>) { + return validate(arg, configuration) + } else if (arg is Map<*, *>) { + return validate(arg, configuration) + } + throw ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema") + } + override fun getNewInstance(arg: Any?, pathToItem: List, pathToSchemas: PathToSchemasMap): Any? { + if (arg == null) { + return getNewInstance( null, pathToItem, pathToSchemas) + } else if (arg is Boolean) { + return getNewInstance(arg, pathToItem, pathToSchemas) + } else if (arg is Number) { + return getNewInstance(arg, pathToItem, pathToSchemas) + } else if (arg is String) { + return getNewInstance(arg, pathToItem, pathToSchemas) + } else if (arg is List<*>) { + return getNewInstance(arg, pathToItem, pathToSchemas) + } else if (arg is Map<*, *>) { + return getNewInstance(arg, pathToItem, pathToSchemas) + } + throw RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema") + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: Nothing?, configuration: SchemaConfiguration?): Schema0BoxedVoid { + return Schema0BoxedVoid(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: Boolean, configuration: SchemaConfiguration?): Schema0BoxedBoolean { + return Schema0BoxedBoolean(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: Number, configuration: SchemaConfiguration?): Schema0BoxedNumber { + return Schema0BoxedNumber(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: String, configuration: SchemaConfiguration?): Schema0BoxedString { + return Schema0BoxedString(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: List<*>, configuration: SchemaConfiguration?): Schema0BoxedList { + return Schema0BoxedList(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: Map<*, *>, configuration: SchemaConfiguration?): Schema0BoxedMap { + return Schema0BoxedMap(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: Any?, configuration: SchemaConfiguration?): Schema0Boxed { + if (arg == null) { + return validateAndBox(null, configuration) + } else if (arg is Boolean) { + return validateAndBox(arg, configuration) + } else if (arg is String) { + return validateAndBox(arg, configuration) + } else if (arg is Number) { + return validateAndBox(arg, configuration) + } else if (arg is List<*>) { + return validateAndBox(arg, configuration) + } else if (arg is Map<*, *>) { + return validateAndBox(arg, configuration) + } + throw ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema") + } + } + + sealed interface AllofCombinedWithAnyofOneof1Boxed { + fun getData(): Any? + } + + data class AllofCombinedWithAnyofOneof1BoxedVoid(val data: Nothing?) : AllofCombinedWithAnyofOneof1Boxed { + override fun getData(): Any? { + return data + } + } + + data class AllofCombinedWithAnyofOneof1BoxedBoolean(val data: Boolean): AllofCombinedWithAnyofOneof1Boxed { + override fun getData(): Any? { + return data + } + } + + data class AllofCombinedWithAnyofOneof1BoxedNumber(val data: Number) : AllofCombinedWithAnyofOneof1Boxed { + override fun getData(): Any? { + return data + } + } + + data class AllofCombinedWithAnyofOneof1BoxedString(val data: String) : AllofCombinedWithAnyofOneof1Boxed { + override fun getData(): Any? { + return data + } + } + + data class AllofCombinedWithAnyofOneof1BoxedList(val data: FrozenList) : AllofCombinedWithAnyofOneof1Boxed { + override fun getData(): Any? { + return data + } + } + + data class AllofCombinedWithAnyofOneof1BoxedMap(val data: FrozenMap) : AllofCombinedWithAnyofOneof1Boxed { + override fun getData(): Any? { + return data + } + } + + + class AllofCombinedWithAnyofOneof1 private constructor(): JsonSchema( + JsonSchemaInfo() + .allOf(listOf( + Schema02::class.java + )) + .anyOf(listOf( + Schema01::class.java + )) + .oneOf(listOf( + Schema0::class.java + )) + ), NullSchemaValidator, BooleanSchemaValidator, NumberSchemaValidator, StringSchemaValidator, ListSchemaValidator, AllofCombinedWithAnyofOneof1BoxedList>, MapSchemaValidator, AllofCombinedWithAnyofOneof1BoxedMap> { + /* + NOTE: This class is auto generated by OpenAPI JSON Schema Generator. + Ref: https://github.com/openapi-json-schema-tools/openapi-json-schema-generator + + Do not edit the class manually. + */ + + companion object { + @Volatile + private var instance: AllofCombinedWithAnyofOneof1? = null + + fun getInstance() = + instance ?: synchronized(this) { + instance ?: AllofCombinedWithAnyofOneof1().also { instance = it } + } + } + + @Throws(ValidationException::class) + override fun validate(arg: Nothing?, configuration: SchemaConfiguration?): Nothing? { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validatedPathToSchemas = PathToSchemasMap() + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, LinkedHashSet()) + getPathToSchemas(this, castArg, validationMetadata, pathSet) + return castArg + } + + @Throws(ValidationException::class) + override fun validate(arg: Boolean, configuration: SchemaConfiguration?): Boolean { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validatedPathToSchemas = PathToSchemasMap() + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, LinkedHashSet()) + getPathToSchemas(this, castArg, validationMetadata, pathSet) + return castArg + } + + @Throws(ValidationException::class) + override fun validate(arg: Number, configuration: SchemaConfiguration?): Number { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validatedPathToSchemas = PathToSchemasMap() + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, LinkedHashSet()) + getPathToSchemas(this, castArg, validationMetadata, pathSet) + return castArg + } + + @Throws(ValidationException::class) + fun validate(arg: Int, configuration: SchemaConfiguration?): Int { + return validate(arg as Number, configuration) as Int + } + + @Throws(ValidationException::class) + fun validate(arg: Long, configuration: SchemaConfiguration?): Long { + return validate(arg as Number, configuration) as Long + } + + @Throws(ValidationException::class) + fun validate(arg: Float, configuration: SchemaConfiguration?): Float { + return validate(arg as Number, configuration) as Float + } + + @Throws(ValidationException::class) + fun validate(arg: Double, configuration: SchemaConfiguration?): Double { + return validate(arg as Number, configuration) as Double + } + + @Throws(ValidationException::class) + override fun validate(arg: String, configuration: SchemaConfiguration?): String { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validatedPathToSchemas = PathToSchemasMap() + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, LinkedHashSet()) + getPathToSchemas(this, castArg, validationMetadata, pathSet) + return castArg + } + + @Throws(ValidationException::class) + fun validate(arg: LocalDate, configuration: SchemaConfiguration?): String { + return validate(arg.toString(), configuration) + } + + @Throws(ValidationException::class) + fun validate(arg: ZonedDateTime, configuration: SchemaConfiguration?): String { + return validate(arg.toString(), configuration) + } + + @Throws(ValidationException::class) + fun validate(arg: UUID, configuration: SchemaConfiguration?): String { + return validate(arg.toString(), configuration) + } + + override fun getNewInstance(arg: List<*>, pathToItem: List, pathToSchemas: PathToSchemasMap): FrozenList { + val items: MutableList = ArrayList() + var i: Int = 0 + for (item: Any? in arg) { + val itemPathToItem = pathToItem + i + val schemas: LinkedHashMap, Nothing?>? = pathToSchemas.get(itemPathToItem) + if (schemas == null) { + throw RuntimeException("Validation result is invalid, schemas must exist for a pathToItem") + } + val itemSchema: JsonSchema<*> = schemas.entries.iterator().next().key + val itemInstance: Any? = itemSchema.getNewInstance(item, itemPathToItem, pathToSchemas) + items.add(itemInstance) + i += 1 + } + val newInstanceItems: FrozenList = FrozenList(items) + return newInstanceItems + } + + @Throws(ValidationException::class) + override fun validate(arg: List<*>, configuration: SchemaConfiguration?): FrozenList { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, PathToSchemasMap(), LinkedHashSet()) + val pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet) + return getNewInstance(castArg, validationMetadata.pathToItem, pathToSchemasMap) + } + + override fun getNewInstance(arg: Map<*, *>, pathToItem: List, pathToSchemas: PathToSchemasMap): FrozenMap { + val properties: LinkedHashMap = LinkedHashMap() + for((propertyName, value) in arg) { + if (!(propertyName is String)) { + throw RuntimeException("Invalid non-string key value") + } + val propertyPathToItem: List = pathToItem + propertyName + val schemas: LinkedHashMap, Nothing?>? = pathToSchemas.get(propertyPathToItem) + if (schemas == null) { + throw RuntimeException("Validation result is invalid, schemas must exist for a pathToItem") + } + val propertySchema: JsonSchema<*> = schemas.entries.iterator().next().key + val propertyInstance: Any? = propertySchema.getNewInstance(value, propertyPathToItem, pathToSchemas) + properties[propertyName] = propertyInstance + } + val castProperties: FrozenMap = FrozenMap(properties) + return castProperties + } + + @Throws(ValidationException::class) + override fun validate(arg: Map<*, *>, configuration: SchemaConfiguration?): FrozenMap { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validatedPathToSchemas = PathToSchemasMap() + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, LinkedHashSet()) + val pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet) + return getNewInstance(castArg, validationMetadata.pathToItem, pathToSchemasMap) + } + + @Throws(ValidationException::class) + override fun validate(arg: Any?, configuration: SchemaConfiguration?): Any? { + if (arg == null) { + return validate(null, configuration) + } else if (arg is Boolean) { + return validate(arg, configuration) + } else if (arg is Number) { + return validate(arg, configuration) + } else if (arg is String) { + return validate(arg, configuration) + } else if (arg is List<*>) { + return validate(arg, configuration) + } else if (arg is Map<*, *>) { + return validate(arg, configuration) + } + throw ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema") + } + override fun getNewInstance(arg: Any?, pathToItem: List, pathToSchemas: PathToSchemasMap): Any? { + if (arg == null) { + return getNewInstance( null, pathToItem, pathToSchemas) + } else if (arg is Boolean) { + return getNewInstance(arg, pathToItem, pathToSchemas) + } else if (arg is Number) { + return getNewInstance(arg, pathToItem, pathToSchemas) + } else if (arg is String) { + return getNewInstance(arg, pathToItem, pathToSchemas) + } else if (arg is List<*>) { + return getNewInstance(arg, pathToItem, pathToSchemas) + } else if (arg is Map<*, *>) { + return getNewInstance(arg, pathToItem, pathToSchemas) + } + throw RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema") + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: Nothing?, configuration: SchemaConfiguration?): AllofCombinedWithAnyofOneof1BoxedVoid { + return AllofCombinedWithAnyofOneof1BoxedVoid(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: Boolean, configuration: SchemaConfiguration?): AllofCombinedWithAnyofOneof1BoxedBoolean { + return AllofCombinedWithAnyofOneof1BoxedBoolean(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: Number, configuration: SchemaConfiguration?): AllofCombinedWithAnyofOneof1BoxedNumber { + return AllofCombinedWithAnyofOneof1BoxedNumber(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: String, configuration: SchemaConfiguration?): AllofCombinedWithAnyofOneof1BoxedString { + return AllofCombinedWithAnyofOneof1BoxedString(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: List<*>, configuration: SchemaConfiguration?): AllofCombinedWithAnyofOneof1BoxedList { + return AllofCombinedWithAnyofOneof1BoxedList(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: Map<*, *>, configuration: SchemaConfiguration?): AllofCombinedWithAnyofOneof1BoxedMap { + return AllofCombinedWithAnyofOneof1BoxedMap(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: Any?, configuration: SchemaConfiguration?): AllofCombinedWithAnyofOneof1Boxed { + if (arg == null) { + return validateAndBox(null, configuration) + } else if (arg is Boolean) { + return validateAndBox(arg, configuration) + } else if (arg is String) { + return validateAndBox(arg, configuration) + } else if (arg is Number) { + return validateAndBox(arg, configuration) + } else if (arg is List<*>) { + return validateAndBox(arg, configuration) + } else if (arg is Map<*, *>) { + return validateAndBox(arg, configuration) + } + throw ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema") + } + } +} diff --git a/samples/client/3_0_3_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/schemas/AllofSimpleTypes.kt b/samples/client/3_0_3_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/schemas/AllofSimpleTypes.kt new file mode 100644 index 00000000000..1311748cc47 --- /dev/null +++ b/samples/client/3_0_3_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/schemas/AllofSimpleTypes.kt @@ -0,0 +1,861 @@ +package org.openapijsonschematools.client.components.schemas +import java.time.LocalDate +import java.time.ZonedDateTime +import java.util.UUID +import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags +import org.openapijsonschematools.client.configurations.SchemaConfiguration +import org.openapijsonschematools.client.exceptions.InvalidAdditionalPropertyException +import org.openapijsonschematools.client.exceptions.UnsetPropertyException +import org.openapijsonschematools.client.exceptions.ValidationException +import org.openapijsonschematools.client.schemas.UnsetAddPropsSetter +import org.openapijsonschematools.client.schemas.validation.BooleanSchemaValidator +import org.openapijsonschematools.client.schemas.validation.FrozenList +import org.openapijsonschematools.client.schemas.validation.FrozenMap +import org.openapijsonschematools.client.schemas.validation.JsonSchema +import org.openapijsonschematools.client.schemas.validation.JsonSchemaInfo +import org.openapijsonschematools.client.schemas.validation.ListSchemaValidator +import org.openapijsonschematools.client.schemas.validation.MapSchemaValidator +import org.openapijsonschematools.client.schemas.validation.NullSchemaValidator +import org.openapijsonschematools.client.schemas.validation.NumberSchemaValidator +import org.openapijsonschematools.client.schemas.validation.PathToSchemasMap +import org.openapijsonschematools.client.schemas.validation.StringSchemaValidator +import org.openapijsonschematools.client.schemas.validation.ValidationMetadata + +class AllofSimpleTypes { + // nest classes so all schemas and input/output classes can be public + + + sealed interface Schema0Boxed { + fun getData(): Any? + } + + data class Schema0BoxedVoid(val data: Nothing?) : Schema0Boxed { + override fun getData(): Any? { + return data + } + } + + data class Schema0BoxedBoolean(val data: Boolean): Schema0Boxed { + override fun getData(): Any? { + return data + } + } + + data class Schema0BoxedNumber(val data: Number) : Schema0Boxed { + override fun getData(): Any? { + return data + } + } + + data class Schema0BoxedString(val data: String) : Schema0Boxed { + override fun getData(): Any? { + return data + } + } + + data class Schema0BoxedList(val data: FrozenList) : Schema0Boxed { + override fun getData(): Any? { + return data + } + } + + data class Schema0BoxedMap(val data: FrozenMap) : Schema0Boxed { + override fun getData(): Any? { + return data + } + } + + + class Schema0 private constructor(): JsonSchema( + JsonSchemaInfo() + .maximum(30) + ), NullSchemaValidator, BooleanSchemaValidator, NumberSchemaValidator, StringSchemaValidator, ListSchemaValidator, Schema0BoxedList>, MapSchemaValidator, Schema0BoxedMap> { + + companion object { + @Volatile + private var instance: Schema0? = null + + fun getInstance() = + instance ?: synchronized(this) { + instance ?: Schema0().also { instance = it } + } + } + + @Throws(ValidationException::class) + override fun validate(arg: Nothing?, configuration: SchemaConfiguration?): Nothing? { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validatedPathToSchemas = PathToSchemasMap() + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, LinkedHashSet()) + getPathToSchemas(this, castArg, validationMetadata, pathSet) + return castArg + } + + @Throws(ValidationException::class) + override fun validate(arg: Boolean, configuration: SchemaConfiguration?): Boolean { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validatedPathToSchemas = PathToSchemasMap() + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, LinkedHashSet()) + getPathToSchemas(this, castArg, validationMetadata, pathSet) + return castArg + } + + @Throws(ValidationException::class) + override fun validate(arg: Number, configuration: SchemaConfiguration?): Number { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validatedPathToSchemas = PathToSchemasMap() + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, LinkedHashSet()) + getPathToSchemas(this, castArg, validationMetadata, pathSet) + return castArg + } + + @Throws(ValidationException::class) + fun validate(arg: Int, configuration: SchemaConfiguration?): Int { + return validate(arg as Number, configuration) as Int + } + + @Throws(ValidationException::class) + fun validate(arg: Long, configuration: SchemaConfiguration?): Long { + return validate(arg as Number, configuration) as Long + } + + @Throws(ValidationException::class) + fun validate(arg: Float, configuration: SchemaConfiguration?): Float { + return validate(arg as Number, configuration) as Float + } + + @Throws(ValidationException::class) + fun validate(arg: Double, configuration: SchemaConfiguration?): Double { + return validate(arg as Number, configuration) as Double + } + + @Throws(ValidationException::class) + override fun validate(arg: String, configuration: SchemaConfiguration?): String { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validatedPathToSchemas = PathToSchemasMap() + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, LinkedHashSet()) + getPathToSchemas(this, castArg, validationMetadata, pathSet) + return castArg + } + + @Throws(ValidationException::class) + fun validate(arg: LocalDate, configuration: SchemaConfiguration?): String { + return validate(arg.toString(), configuration) + } + + @Throws(ValidationException::class) + fun validate(arg: ZonedDateTime, configuration: SchemaConfiguration?): String { + return validate(arg.toString(), configuration) + } + + @Throws(ValidationException::class) + fun validate(arg: UUID, configuration: SchemaConfiguration?): String { + return validate(arg.toString(), configuration) + } + + override fun getNewInstance(arg: List<*>, pathToItem: List, pathToSchemas: PathToSchemasMap): FrozenList { + val items: MutableList = ArrayList() + var i: Int = 0 + for (item: Any? in arg) { + val itemPathToItem = pathToItem + i + val schemas: LinkedHashMap, Nothing?>? = pathToSchemas.get(itemPathToItem) + if (schemas == null) { + throw RuntimeException("Validation result is invalid, schemas must exist for a pathToItem") + } + val itemSchema: JsonSchema<*> = schemas.entries.iterator().next().key + val itemInstance: Any? = itemSchema.getNewInstance(item, itemPathToItem, pathToSchemas) + items.add(itemInstance) + i += 1 + } + val newInstanceItems: FrozenList = FrozenList(items) + return newInstanceItems + } + + @Throws(ValidationException::class) + override fun validate(arg: List<*>, configuration: SchemaConfiguration?): FrozenList { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, PathToSchemasMap(), LinkedHashSet()) + val pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet) + return getNewInstance(castArg, validationMetadata.pathToItem, pathToSchemasMap) + } + + override fun getNewInstance(arg: Map<*, *>, pathToItem: List, pathToSchemas: PathToSchemasMap): FrozenMap { + val properties: LinkedHashMap = LinkedHashMap() + for((propertyName, value) in arg) { + if (!(propertyName is String)) { + throw RuntimeException("Invalid non-string key value") + } + val propertyPathToItem: List = pathToItem + propertyName + val schemas: LinkedHashMap, Nothing?>? = pathToSchemas.get(propertyPathToItem) + if (schemas == null) { + throw RuntimeException("Validation result is invalid, schemas must exist for a pathToItem") + } + val propertySchema: JsonSchema<*> = schemas.entries.iterator().next().key + val propertyInstance: Any? = propertySchema.getNewInstance(value, propertyPathToItem, pathToSchemas) + properties[propertyName] = propertyInstance + } + val castProperties: FrozenMap = FrozenMap(properties) + return castProperties + } + + @Throws(ValidationException::class) + override fun validate(arg: Map<*, *>, configuration: SchemaConfiguration?): FrozenMap { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validatedPathToSchemas = PathToSchemasMap() + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, LinkedHashSet()) + val pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet) + return getNewInstance(castArg, validationMetadata.pathToItem, pathToSchemasMap) + } + + @Throws(ValidationException::class) + override fun validate(arg: Any?, configuration: SchemaConfiguration?): Any? { + if (arg == null) { + return validate(null, configuration) + } else if (arg is Boolean) { + return validate(arg, configuration) + } else if (arg is Number) { + return validate(arg, configuration) + } else if (arg is String) { + return validate(arg, configuration) + } else if (arg is List<*>) { + return validate(arg, configuration) + } else if (arg is Map<*, *>) { + return validate(arg, configuration) + } + throw ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema") + } + override fun getNewInstance(arg: Any?, pathToItem: List, pathToSchemas: PathToSchemasMap): Any? { + if (arg == null) { + return getNewInstance( null, pathToItem, pathToSchemas) + } else if (arg is Boolean) { + return getNewInstance(arg, pathToItem, pathToSchemas) + } else if (arg is Number) { + return getNewInstance(arg, pathToItem, pathToSchemas) + } else if (arg is String) { + return getNewInstance(arg, pathToItem, pathToSchemas) + } else if (arg is List<*>) { + return getNewInstance(arg, pathToItem, pathToSchemas) + } else if (arg is Map<*, *>) { + return getNewInstance(arg, pathToItem, pathToSchemas) + } + throw RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema") + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: Nothing?, configuration: SchemaConfiguration?): Schema0BoxedVoid { + return Schema0BoxedVoid(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: Boolean, configuration: SchemaConfiguration?): Schema0BoxedBoolean { + return Schema0BoxedBoolean(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: Number, configuration: SchemaConfiguration?): Schema0BoxedNumber { + return Schema0BoxedNumber(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: String, configuration: SchemaConfiguration?): Schema0BoxedString { + return Schema0BoxedString(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: List<*>, configuration: SchemaConfiguration?): Schema0BoxedList { + return Schema0BoxedList(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: Map<*, *>, configuration: SchemaConfiguration?): Schema0BoxedMap { + return Schema0BoxedMap(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: Any?, configuration: SchemaConfiguration?): Schema0Boxed { + if (arg == null) { + return validateAndBox(null, configuration) + } else if (arg is Boolean) { + return validateAndBox(arg, configuration) + } else if (arg is String) { + return validateAndBox(arg, configuration) + } else if (arg is Number) { + return validateAndBox(arg, configuration) + } else if (arg is List<*>) { + return validateAndBox(arg, configuration) + } else if (arg is Map<*, *>) { + return validateAndBox(arg, configuration) + } + throw ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema") + } + } + + sealed interface Schema1Boxed { + fun getData(): Any? + } + + data class Schema1BoxedVoid(val data: Nothing?) : Schema1Boxed { + override fun getData(): Any? { + return data + } + } + + data class Schema1BoxedBoolean(val data: Boolean): Schema1Boxed { + override fun getData(): Any? { + return data + } + } + + data class Schema1BoxedNumber(val data: Number) : Schema1Boxed { + override fun getData(): Any? { + return data + } + } + + data class Schema1BoxedString(val data: String) : Schema1Boxed { + override fun getData(): Any? { + return data + } + } + + data class Schema1BoxedList(val data: FrozenList) : Schema1Boxed { + override fun getData(): Any? { + return data + } + } + + data class Schema1BoxedMap(val data: FrozenMap) : Schema1Boxed { + override fun getData(): Any? { + return data + } + } + + + class Schema1 private constructor(): JsonSchema( + JsonSchemaInfo() + .minimum(20) + ), NullSchemaValidator, BooleanSchemaValidator, NumberSchemaValidator, StringSchemaValidator, ListSchemaValidator, Schema1BoxedList>, MapSchemaValidator, Schema1BoxedMap> { + + companion object { + @Volatile + private var instance: Schema1? = null + + fun getInstance() = + instance ?: synchronized(this) { + instance ?: Schema1().also { instance = it } + } + } + + @Throws(ValidationException::class) + override fun validate(arg: Nothing?, configuration: SchemaConfiguration?): Nothing? { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validatedPathToSchemas = PathToSchemasMap() + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, LinkedHashSet()) + getPathToSchemas(this, castArg, validationMetadata, pathSet) + return castArg + } + + @Throws(ValidationException::class) + override fun validate(arg: Boolean, configuration: SchemaConfiguration?): Boolean { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validatedPathToSchemas = PathToSchemasMap() + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, LinkedHashSet()) + getPathToSchemas(this, castArg, validationMetadata, pathSet) + return castArg + } + + @Throws(ValidationException::class) + override fun validate(arg: Number, configuration: SchemaConfiguration?): Number { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validatedPathToSchemas = PathToSchemasMap() + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, LinkedHashSet()) + getPathToSchemas(this, castArg, validationMetadata, pathSet) + return castArg + } + + @Throws(ValidationException::class) + fun validate(arg: Int, configuration: SchemaConfiguration?): Int { + return validate(arg as Number, configuration) as Int + } + + @Throws(ValidationException::class) + fun validate(arg: Long, configuration: SchemaConfiguration?): Long { + return validate(arg as Number, configuration) as Long + } + + @Throws(ValidationException::class) + fun validate(arg: Float, configuration: SchemaConfiguration?): Float { + return validate(arg as Number, configuration) as Float + } + + @Throws(ValidationException::class) + fun validate(arg: Double, configuration: SchemaConfiguration?): Double { + return validate(arg as Number, configuration) as Double + } + + @Throws(ValidationException::class) + override fun validate(arg: String, configuration: SchemaConfiguration?): String { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validatedPathToSchemas = PathToSchemasMap() + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, LinkedHashSet()) + getPathToSchemas(this, castArg, validationMetadata, pathSet) + return castArg + } + + @Throws(ValidationException::class) + fun validate(arg: LocalDate, configuration: SchemaConfiguration?): String { + return validate(arg.toString(), configuration) + } + + @Throws(ValidationException::class) + fun validate(arg: ZonedDateTime, configuration: SchemaConfiguration?): String { + return validate(arg.toString(), configuration) + } + + @Throws(ValidationException::class) + fun validate(arg: UUID, configuration: SchemaConfiguration?): String { + return validate(arg.toString(), configuration) + } + + override fun getNewInstance(arg: List<*>, pathToItem: List, pathToSchemas: PathToSchemasMap): FrozenList { + val items: MutableList = ArrayList() + var i: Int = 0 + for (item: Any? in arg) { + val itemPathToItem = pathToItem + i + val schemas: LinkedHashMap, Nothing?>? = pathToSchemas.get(itemPathToItem) + if (schemas == null) { + throw RuntimeException("Validation result is invalid, schemas must exist for a pathToItem") + } + val itemSchema: JsonSchema<*> = schemas.entries.iterator().next().key + val itemInstance: Any? = itemSchema.getNewInstance(item, itemPathToItem, pathToSchemas) + items.add(itemInstance) + i += 1 + } + val newInstanceItems: FrozenList = FrozenList(items) + return newInstanceItems + } + + @Throws(ValidationException::class) + override fun validate(arg: List<*>, configuration: SchemaConfiguration?): FrozenList { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, PathToSchemasMap(), LinkedHashSet()) + val pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet) + return getNewInstance(castArg, validationMetadata.pathToItem, pathToSchemasMap) + } + + override fun getNewInstance(arg: Map<*, *>, pathToItem: List, pathToSchemas: PathToSchemasMap): FrozenMap { + val properties: LinkedHashMap = LinkedHashMap() + for((propertyName, value) in arg) { + if (!(propertyName is String)) { + throw RuntimeException("Invalid non-string key value") + } + val propertyPathToItem: List = pathToItem + propertyName + val schemas: LinkedHashMap, Nothing?>? = pathToSchemas.get(propertyPathToItem) + if (schemas == null) { + throw RuntimeException("Validation result is invalid, schemas must exist for a pathToItem") + } + val propertySchema: JsonSchema<*> = schemas.entries.iterator().next().key + val propertyInstance: Any? = propertySchema.getNewInstance(value, propertyPathToItem, pathToSchemas) + properties[propertyName] = propertyInstance + } + val castProperties: FrozenMap = FrozenMap(properties) + return castProperties + } + + @Throws(ValidationException::class) + override fun validate(arg: Map<*, *>, configuration: SchemaConfiguration?): FrozenMap { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validatedPathToSchemas = PathToSchemasMap() + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, LinkedHashSet()) + val pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet) + return getNewInstance(castArg, validationMetadata.pathToItem, pathToSchemasMap) + } + + @Throws(ValidationException::class) + override fun validate(arg: Any?, configuration: SchemaConfiguration?): Any? { + if (arg == null) { + return validate(null, configuration) + } else if (arg is Boolean) { + return validate(arg, configuration) + } else if (arg is Number) { + return validate(arg, configuration) + } else if (arg is String) { + return validate(arg, configuration) + } else if (arg is List<*>) { + return validate(arg, configuration) + } else if (arg is Map<*, *>) { + return validate(arg, configuration) + } + throw ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema") + } + override fun getNewInstance(arg: Any?, pathToItem: List, pathToSchemas: PathToSchemasMap): Any? { + if (arg == null) { + return getNewInstance( null, pathToItem, pathToSchemas) + } else if (arg is Boolean) { + return getNewInstance(arg, pathToItem, pathToSchemas) + } else if (arg is Number) { + return getNewInstance(arg, pathToItem, pathToSchemas) + } else if (arg is String) { + return getNewInstance(arg, pathToItem, pathToSchemas) + } else if (arg is List<*>) { + return getNewInstance(arg, pathToItem, pathToSchemas) + } else if (arg is Map<*, *>) { + return getNewInstance(arg, pathToItem, pathToSchemas) + } + throw RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema") + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: Nothing?, configuration: SchemaConfiguration?): Schema1BoxedVoid { + return Schema1BoxedVoid(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: Boolean, configuration: SchemaConfiguration?): Schema1BoxedBoolean { + return Schema1BoxedBoolean(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: Number, configuration: SchemaConfiguration?): Schema1BoxedNumber { + return Schema1BoxedNumber(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: String, configuration: SchemaConfiguration?): Schema1BoxedString { + return Schema1BoxedString(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: List<*>, configuration: SchemaConfiguration?): Schema1BoxedList { + return Schema1BoxedList(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: Map<*, *>, configuration: SchemaConfiguration?): Schema1BoxedMap { + return Schema1BoxedMap(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: Any?, configuration: SchemaConfiguration?): Schema1Boxed { + if (arg == null) { + return validateAndBox(null, configuration) + } else if (arg is Boolean) { + return validateAndBox(arg, configuration) + } else if (arg is String) { + return validateAndBox(arg, configuration) + } else if (arg is Number) { + return validateAndBox(arg, configuration) + } else if (arg is List<*>) { + return validateAndBox(arg, configuration) + } else if (arg is Map<*, *>) { + return validateAndBox(arg, configuration) + } + throw ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema") + } + } + + sealed interface AllofSimpleTypes1Boxed { + fun getData(): Any? + } + + data class AllofSimpleTypes1BoxedVoid(val data: Nothing?) : AllofSimpleTypes1Boxed { + override fun getData(): Any? { + return data + } + } + + data class AllofSimpleTypes1BoxedBoolean(val data: Boolean): AllofSimpleTypes1Boxed { + override fun getData(): Any? { + return data + } + } + + data class AllofSimpleTypes1BoxedNumber(val data: Number) : AllofSimpleTypes1Boxed { + override fun getData(): Any? { + return data + } + } + + data class AllofSimpleTypes1BoxedString(val data: String) : AllofSimpleTypes1Boxed { + override fun getData(): Any? { + return data + } + } + + data class AllofSimpleTypes1BoxedList(val data: FrozenList) : AllofSimpleTypes1Boxed { + override fun getData(): Any? { + return data + } + } + + data class AllofSimpleTypes1BoxedMap(val data: FrozenMap) : AllofSimpleTypes1Boxed { + override fun getData(): Any? { + return data + } + } + + + class AllofSimpleTypes1 private constructor(): JsonSchema( + JsonSchemaInfo() + .allOf(listOf( + Schema0::class.java, + Schema1::class.java + )) + ), NullSchemaValidator, BooleanSchemaValidator, NumberSchemaValidator, StringSchemaValidator, ListSchemaValidator, AllofSimpleTypes1BoxedList>, MapSchemaValidator, AllofSimpleTypes1BoxedMap> { + /* + NOTE: This class is auto generated by OpenAPI JSON Schema Generator. + Ref: https://github.com/openapi-json-schema-tools/openapi-json-schema-generator + + Do not edit the class manually. + */ + + companion object { + @Volatile + private var instance: AllofSimpleTypes1? = null + + fun getInstance() = + instance ?: synchronized(this) { + instance ?: AllofSimpleTypes1().also { instance = it } + } + } + + @Throws(ValidationException::class) + override fun validate(arg: Nothing?, configuration: SchemaConfiguration?): Nothing? { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validatedPathToSchemas = PathToSchemasMap() + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, LinkedHashSet()) + getPathToSchemas(this, castArg, validationMetadata, pathSet) + return castArg + } + + @Throws(ValidationException::class) + override fun validate(arg: Boolean, configuration: SchemaConfiguration?): Boolean { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validatedPathToSchemas = PathToSchemasMap() + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, LinkedHashSet()) + getPathToSchemas(this, castArg, validationMetadata, pathSet) + return castArg + } + + @Throws(ValidationException::class) + override fun validate(arg: Number, configuration: SchemaConfiguration?): Number { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validatedPathToSchemas = PathToSchemasMap() + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, LinkedHashSet()) + getPathToSchemas(this, castArg, validationMetadata, pathSet) + return castArg + } + + @Throws(ValidationException::class) + fun validate(arg: Int, configuration: SchemaConfiguration?): Int { + return validate(arg as Number, configuration) as Int + } + + @Throws(ValidationException::class) + fun validate(arg: Long, configuration: SchemaConfiguration?): Long { + return validate(arg as Number, configuration) as Long + } + + @Throws(ValidationException::class) + fun validate(arg: Float, configuration: SchemaConfiguration?): Float { + return validate(arg as Number, configuration) as Float + } + + @Throws(ValidationException::class) + fun validate(arg: Double, configuration: SchemaConfiguration?): Double { + return validate(arg as Number, configuration) as Double + } + + @Throws(ValidationException::class) + override fun validate(arg: String, configuration: SchemaConfiguration?): String { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validatedPathToSchemas = PathToSchemasMap() + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, LinkedHashSet()) + getPathToSchemas(this, castArg, validationMetadata, pathSet) + return castArg + } + + @Throws(ValidationException::class) + fun validate(arg: LocalDate, configuration: SchemaConfiguration?): String { + return validate(arg.toString(), configuration) + } + + @Throws(ValidationException::class) + fun validate(arg: ZonedDateTime, configuration: SchemaConfiguration?): String { + return validate(arg.toString(), configuration) + } + + @Throws(ValidationException::class) + fun validate(arg: UUID, configuration: SchemaConfiguration?): String { + return validate(arg.toString(), configuration) + } + + override fun getNewInstance(arg: List<*>, pathToItem: List, pathToSchemas: PathToSchemasMap): FrozenList { + val items: MutableList = ArrayList() + var i: Int = 0 + for (item: Any? in arg) { + val itemPathToItem = pathToItem + i + val schemas: LinkedHashMap, Nothing?>? = pathToSchemas.get(itemPathToItem) + if (schemas == null) { + throw RuntimeException("Validation result is invalid, schemas must exist for a pathToItem") + } + val itemSchema: JsonSchema<*> = schemas.entries.iterator().next().key + val itemInstance: Any? = itemSchema.getNewInstance(item, itemPathToItem, pathToSchemas) + items.add(itemInstance) + i += 1 + } + val newInstanceItems: FrozenList = FrozenList(items) + return newInstanceItems + } + + @Throws(ValidationException::class) + override fun validate(arg: List<*>, configuration: SchemaConfiguration?): FrozenList { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, PathToSchemasMap(), LinkedHashSet()) + val pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet) + return getNewInstance(castArg, validationMetadata.pathToItem, pathToSchemasMap) + } + + override fun getNewInstance(arg: Map<*, *>, pathToItem: List, pathToSchemas: PathToSchemasMap): FrozenMap { + val properties: LinkedHashMap = LinkedHashMap() + for((propertyName, value) in arg) { + if (!(propertyName is String)) { + throw RuntimeException("Invalid non-string key value") + } + val propertyPathToItem: List = pathToItem + propertyName + val schemas: LinkedHashMap, Nothing?>? = pathToSchemas.get(propertyPathToItem) + if (schemas == null) { + throw RuntimeException("Validation result is invalid, schemas must exist for a pathToItem") + } + val propertySchema: JsonSchema<*> = schemas.entries.iterator().next().key + val propertyInstance: Any? = propertySchema.getNewInstance(value, propertyPathToItem, pathToSchemas) + properties[propertyName] = propertyInstance + } + val castProperties: FrozenMap = FrozenMap(properties) + return castProperties + } + + @Throws(ValidationException::class) + override fun validate(arg: Map<*, *>, configuration: SchemaConfiguration?): FrozenMap { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validatedPathToSchemas = PathToSchemasMap() + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, LinkedHashSet()) + val pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet) + return getNewInstance(castArg, validationMetadata.pathToItem, pathToSchemasMap) + } + + @Throws(ValidationException::class) + override fun validate(arg: Any?, configuration: SchemaConfiguration?): Any? { + if (arg == null) { + return validate(null, configuration) + } else if (arg is Boolean) { + return validate(arg, configuration) + } else if (arg is Number) { + return validate(arg, configuration) + } else if (arg is String) { + return validate(arg, configuration) + } else if (arg is List<*>) { + return validate(arg, configuration) + } else if (arg is Map<*, *>) { + return validate(arg, configuration) + } + throw ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema") + } + override fun getNewInstance(arg: Any?, pathToItem: List, pathToSchemas: PathToSchemasMap): Any? { + if (arg == null) { + return getNewInstance( null, pathToItem, pathToSchemas) + } else if (arg is Boolean) { + return getNewInstance(arg, pathToItem, pathToSchemas) + } else if (arg is Number) { + return getNewInstance(arg, pathToItem, pathToSchemas) + } else if (arg is String) { + return getNewInstance(arg, pathToItem, pathToSchemas) + } else if (arg is List<*>) { + return getNewInstance(arg, pathToItem, pathToSchemas) + } else if (arg is Map<*, *>) { + return getNewInstance(arg, pathToItem, pathToSchemas) + } + throw RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema") + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: Nothing?, configuration: SchemaConfiguration?): AllofSimpleTypes1BoxedVoid { + return AllofSimpleTypes1BoxedVoid(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: Boolean, configuration: SchemaConfiguration?): AllofSimpleTypes1BoxedBoolean { + return AllofSimpleTypes1BoxedBoolean(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: Number, configuration: SchemaConfiguration?): AllofSimpleTypes1BoxedNumber { + return AllofSimpleTypes1BoxedNumber(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: String, configuration: SchemaConfiguration?): AllofSimpleTypes1BoxedString { + return AllofSimpleTypes1BoxedString(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: List<*>, configuration: SchemaConfiguration?): AllofSimpleTypes1BoxedList { + return AllofSimpleTypes1BoxedList(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: Map<*, *>, configuration: SchemaConfiguration?): AllofSimpleTypes1BoxedMap { + return AllofSimpleTypes1BoxedMap(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: Any?, configuration: SchemaConfiguration?): AllofSimpleTypes1Boxed { + if (arg == null) { + return validateAndBox(null, configuration) + } else if (arg is Boolean) { + return validateAndBox(arg, configuration) + } else if (arg is String) { + return validateAndBox(arg, configuration) + } else if (arg is Number) { + return validateAndBox(arg, configuration) + } else if (arg is List<*>) { + return validateAndBox(arg, configuration) + } else if (arg is Map<*, *>) { + return validateAndBox(arg, configuration) + } + throw ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema") + } + } +} diff --git a/samples/client/3_0_3_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/schemas/AllofWithBaseSchema.kt b/samples/client/3_0_3_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/schemas/AllofWithBaseSchema.kt new file mode 100644 index 00000000000..434a6b3cac3 --- /dev/null +++ b/samples/client/3_0_3_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/schemas/AllofWithBaseSchema.kt @@ -0,0 +1,1151 @@ +package org.openapijsonschematools.client.components.schemas +import java.time.LocalDate +import java.time.ZonedDateTime +import java.util.UUID +import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags +import org.openapijsonschematools.client.configurations.SchemaConfiguration +import org.openapijsonschematools.client.exceptions.InvalidAdditionalPropertyException +import org.openapijsonschematools.client.exceptions.UnsetPropertyException +import org.openapijsonschematools.client.exceptions.ValidationException +import org.openapijsonschematools.client.schemas.GenericBuilder +import org.openapijsonschematools.client.schemas.IntJsonSchema +import org.openapijsonschematools.client.schemas.NullJsonSchema +import org.openapijsonschematools.client.schemas.StringJsonSchema +import org.openapijsonschematools.client.schemas.UnsetAddPropsSetter +import org.openapijsonschematools.client.schemas.validation.BooleanSchemaValidator +import org.openapijsonschematools.client.schemas.validation.FrozenList +import org.openapijsonschematools.client.schemas.validation.FrozenMap +import org.openapijsonschematools.client.schemas.validation.JsonSchema +import org.openapijsonschematools.client.schemas.validation.JsonSchemaInfo +import org.openapijsonschematools.client.schemas.validation.ListSchemaValidator +import org.openapijsonschematools.client.schemas.validation.MapSchemaValidator +import org.openapijsonschematools.client.schemas.validation.NullSchemaValidator +import org.openapijsonschematools.client.schemas.validation.NumberSchemaValidator +import org.openapijsonschematools.client.schemas.validation.PathToSchemasMap +import org.openapijsonschematools.client.schemas.validation.StringSchemaValidator +import org.openapijsonschematools.client.schemas.validation.ValidationMetadata + +class AllofWithBaseSchema { + // nest classes so all schemas and input/output classes can be public + + + class Foo : StringJsonSchema.StringJsonSchema1() { + companion object { + @Volatile + private var instance: Foo? = null + + fun getInstance() = + instance ?: synchronized(this) { + instance ?: Foo().also { instance = it } + } + } + } + + + class Schema0Map(m: FrozenMap) : FrozenMap(m) { + companion object { + val requiredKeys: Set = setOf( + "foo" + ) + val optionalKeys: Set = setOf() + @Throws(ValidationException::class) + fun of(arg: Map, configuration: SchemaConfiguration): Schema0Map { + return Schema0.getInstance().validate(arg, configuration) + } + } + + fun foo(): String { + val value: Any? = get("foo") + if (!(value is String)) { + throw RuntimeException("Invalid value stored for foo") + } + return value + } + + @Throws(UnsetPropertyException::class, InvalidAdditionalPropertyException::class) + fun getAdditionalProperty(name: String): Any? { + throwIfKeyKnown(name, requiredKeys, optionalKeys) + throwIfKeyNotPresent(name) + return get(name) + } + } + + interface SetterForFoo { + fun getInstance(): MutableMap + fun getBuilderAfterFoo(instance: MutableMap): T + + fun foo(value: String): T { + val instance = getInstance() + instance["foo"] = value + return getBuilderAfterFoo(instance) + } + } + + class Schema0Map0Builder(private val instance: MutableMap): UnsetAddPropsSetter, GenericBuilder> { + private val knownKeys: Set = setOf( + "foo" + ) + override fun getKnownKeys(): Set { + return knownKeys + } + override fun build(): Map { + return instance + } + override fun getInstance(): MutableMap { + return instance + } + override fun getBuilderAfterAdditionalProperty(instance: MutableMap): Schema0Map0Builder { + return this + } + } + + class Schema0MapBuilder: SetterForFoo { + private val instance: MutableMap + init { + this.instance = LinkedHashMap() + } + override fun getInstance(): MutableMap { + return instance + } + override fun getBuilderAfterFoo(instance: MutableMap): Schema0Map0Builder { + return Schema0Map0Builder(instance) + } + } + + + sealed interface Schema0Boxed { + fun getData(): Any? + } + + data class Schema0BoxedVoid(val data: Nothing?) : Schema0Boxed { + override fun getData(): Any? { + return data + } + } + + data class Schema0BoxedBoolean(val data: Boolean): Schema0Boxed { + override fun getData(): Any? { + return data + } + } + + data class Schema0BoxedNumber(val data: Number) : Schema0Boxed { + override fun getData(): Any? { + return data + } + } + + data class Schema0BoxedString(val data: String) : Schema0Boxed { + override fun getData(): Any? { + return data + } + } + + data class Schema0BoxedList(val data: FrozenList) : Schema0Boxed { + override fun getData(): Any? { + return data + } + } + + data class Schema0BoxedMap(val data: Schema0Map) : Schema0Boxed { + override fun getData(): Any? { + return data + } + } + + + class Schema0 private constructor(): JsonSchema( + JsonSchemaInfo() + .properties(mapOf( + "foo" to Foo::class.java + )) + .required(setOf( + "foo" + )) + ), NullSchemaValidator, BooleanSchemaValidator, NumberSchemaValidator, StringSchemaValidator, ListSchemaValidator, Schema0BoxedList>, MapSchemaValidator { + + companion object { + @Volatile + private var instance: Schema0? = null + + fun getInstance() = + instance ?: synchronized(this) { + instance ?: Schema0().also { instance = it } + } + } + + @Throws(ValidationException::class) + override fun validate(arg: Nothing?, configuration: SchemaConfiguration?): Nothing? { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validatedPathToSchemas = PathToSchemasMap() + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, LinkedHashSet()) + getPathToSchemas(this, castArg, validationMetadata, pathSet) + return castArg + } + + @Throws(ValidationException::class) + override fun validate(arg: Boolean, configuration: SchemaConfiguration?): Boolean { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validatedPathToSchemas = PathToSchemasMap() + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, LinkedHashSet()) + getPathToSchemas(this, castArg, validationMetadata, pathSet) + return castArg + } + + @Throws(ValidationException::class) + override fun validate(arg: Number, configuration: SchemaConfiguration?): Number { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validatedPathToSchemas = PathToSchemasMap() + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, LinkedHashSet()) + getPathToSchemas(this, castArg, validationMetadata, pathSet) + return castArg + } + + @Throws(ValidationException::class) + fun validate(arg: Int, configuration: SchemaConfiguration?): Int { + return validate(arg as Number, configuration) as Int + } + + @Throws(ValidationException::class) + fun validate(arg: Long, configuration: SchemaConfiguration?): Long { + return validate(arg as Number, configuration) as Long + } + + @Throws(ValidationException::class) + fun validate(arg: Float, configuration: SchemaConfiguration?): Float { + return validate(arg as Number, configuration) as Float + } + + @Throws(ValidationException::class) + fun validate(arg: Double, configuration: SchemaConfiguration?): Double { + return validate(arg as Number, configuration) as Double + } + + @Throws(ValidationException::class) + override fun validate(arg: String, configuration: SchemaConfiguration?): String { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validatedPathToSchemas = PathToSchemasMap() + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, LinkedHashSet()) + getPathToSchemas(this, castArg, validationMetadata, pathSet) + return castArg + } + + @Throws(ValidationException::class) + fun validate(arg: LocalDate, configuration: SchemaConfiguration?): String { + return validate(arg.toString(), configuration) + } + + @Throws(ValidationException::class) + fun validate(arg: ZonedDateTime, configuration: SchemaConfiguration?): String { + return validate(arg.toString(), configuration) + } + + @Throws(ValidationException::class) + fun validate(arg: UUID, configuration: SchemaConfiguration?): String { + return validate(arg.toString(), configuration) + } + + override fun getNewInstance(arg: List<*>, pathToItem: List, pathToSchemas: PathToSchemasMap): FrozenList { + val items: MutableList = ArrayList() + var i: Int = 0 + for (item: Any? in arg) { + val itemPathToItem = pathToItem + i + val schemas: LinkedHashMap, Nothing?>? = pathToSchemas.get(itemPathToItem) + if (schemas == null) { + throw RuntimeException("Validation result is invalid, schemas must exist for a pathToItem") + } + val itemSchema: JsonSchema<*> = schemas.entries.iterator().next().key + val itemInstance: Any? = itemSchema.getNewInstance(item, itemPathToItem, pathToSchemas) + items.add(itemInstance) + i += 1 + } + val newInstanceItems: FrozenList = FrozenList(items) + return newInstanceItems + } + + @Throws(ValidationException::class) + override fun validate(arg: List<*>, configuration: SchemaConfiguration?): FrozenList { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, PathToSchemasMap(), LinkedHashSet()) + val pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet) + return getNewInstance(castArg, validationMetadata.pathToItem, pathToSchemasMap) + } + + override fun getNewInstance(arg: Map<*, *>, pathToItem: List, pathToSchemas: PathToSchemasMap): Schema0Map { + val properties: LinkedHashMap = LinkedHashMap() + for((propertyName, value) in arg) { + if (!(propertyName is String)) { + throw RuntimeException("Invalid non-string key value") + } + val propertyPathToItem: List = pathToItem + propertyName + val schemas: LinkedHashMap, Nothing?>? = pathToSchemas.get(propertyPathToItem) + if (schemas == null) { + throw RuntimeException("Validation result is invalid, schemas must exist for a pathToItem") + } + val propertySchema: JsonSchema<*> = schemas.entries.iterator().next().key + val propertyInstance: Any? = propertySchema.getNewInstance(value, propertyPathToItem, pathToSchemas) + properties[propertyName] = propertyInstance + } + val castProperties: FrozenMap = FrozenMap(properties) + return Schema0Map(castProperties) + } + + @Throws(ValidationException::class) + override fun validate(arg: Map<*, *>, configuration: SchemaConfiguration?): Schema0Map { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validatedPathToSchemas = PathToSchemasMap() + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, LinkedHashSet()) + val pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet) + return getNewInstance(castArg, validationMetadata.pathToItem, pathToSchemasMap) + } + + @Throws(ValidationException::class) + override fun validate(arg: Any?, configuration: SchemaConfiguration?): Any? { + if (arg == null) { + return validate(null, configuration) + } else if (arg is Boolean) { + return validate(arg, configuration) + } else if (arg is Number) { + return validate(arg, configuration) + } else if (arg is String) { + return validate(arg, configuration) + } else if (arg is List<*>) { + return validate(arg, configuration) + } else if (arg is Map<*, *>) { + return validate(arg, configuration) + } + throw ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema") + } + override fun getNewInstance(arg: Any?, pathToItem: List, pathToSchemas: PathToSchemasMap): Any? { + if (arg == null) { + return getNewInstance( null, pathToItem, pathToSchemas) + } else if (arg is Boolean) { + return getNewInstance(arg, pathToItem, pathToSchemas) + } else if (arg is Number) { + return getNewInstance(arg, pathToItem, pathToSchemas) + } else if (arg is String) { + return getNewInstance(arg, pathToItem, pathToSchemas) + } else if (arg is List<*>) { + return getNewInstance(arg, pathToItem, pathToSchemas) + } else if (arg is Map<*, *>) { + return getNewInstance(arg, pathToItem, pathToSchemas) + } + throw RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema") + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: Nothing?, configuration: SchemaConfiguration?): Schema0BoxedVoid { + return Schema0BoxedVoid(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: Boolean, configuration: SchemaConfiguration?): Schema0BoxedBoolean { + return Schema0BoxedBoolean(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: Number, configuration: SchemaConfiguration?): Schema0BoxedNumber { + return Schema0BoxedNumber(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: String, configuration: SchemaConfiguration?): Schema0BoxedString { + return Schema0BoxedString(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: List<*>, configuration: SchemaConfiguration?): Schema0BoxedList { + return Schema0BoxedList(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: Map<*, *>, configuration: SchemaConfiguration?): Schema0BoxedMap { + return Schema0BoxedMap(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: Any?, configuration: SchemaConfiguration?): Schema0Boxed { + if (arg == null) { + return validateAndBox(null, configuration) + } else if (arg is Boolean) { + return validateAndBox(arg, configuration) + } else if (arg is String) { + return validateAndBox(arg, configuration) + } else if (arg is Number) { + return validateAndBox(arg, configuration) + } else if (arg is List<*>) { + return validateAndBox(arg, configuration) + } else if (arg is Map<*, *>) { + return validateAndBox(arg, configuration) + } + throw ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema") + } + } + + class Baz : NullJsonSchema.NullJsonSchema1() { + companion object { + @Volatile + private var instance: Baz? = null + + fun getInstance() = + instance ?: synchronized(this) { + instance ?: Baz().also { instance = it } + } + } + } + + + class Schema1Map(m: FrozenMap) : FrozenMap(m) { + companion object { + val requiredKeys: Set = setOf( + "baz" + ) + val optionalKeys: Set = setOf() + @Throws(ValidationException::class) + fun of(arg: Map, configuration: SchemaConfiguration): Schema1Map { + return Schema1.getInstance().validate(arg, configuration) + } + } + + fun baz(): Nothing? { + val value: Any? = get("baz") + if (!(value == null || value is Nothing?)) { + throw RuntimeException("Invalid value stored for baz") + } + return value + } + + @Throws(UnsetPropertyException::class, InvalidAdditionalPropertyException::class) + fun getAdditionalProperty(name: String): Any? { + throwIfKeyKnown(name, requiredKeys, optionalKeys) + throwIfKeyNotPresent(name) + return get(name) + } + } + + interface SetterForBaz { + fun getInstance(): MutableMap + fun getBuilderAfterBaz(instance: MutableMap): T + + fun baz(value: Nothing?): T { + val instance = getInstance() + instance["baz"] = null + return getBuilderAfterBaz(instance) + } + } + + class Schema1Map0Builder(private val instance: MutableMap): UnsetAddPropsSetter, GenericBuilder> { + private val knownKeys: Set = setOf( + "baz" + ) + override fun getKnownKeys(): Set { + return knownKeys + } + override fun build(): Map { + return instance + } + override fun getInstance(): MutableMap { + return instance + } + override fun getBuilderAfterAdditionalProperty(instance: MutableMap): Schema1Map0Builder { + return this + } + } + + class Schema1MapBuilder: SetterForBaz { + private val instance: MutableMap + init { + this.instance = LinkedHashMap() + } + override fun getInstance(): MutableMap { + return instance + } + override fun getBuilderAfterBaz(instance: MutableMap): Schema1Map0Builder { + return Schema1Map0Builder(instance) + } + } + + + sealed interface Schema1Boxed { + fun getData(): Any? + } + + data class Schema1BoxedVoid(val data: Nothing?) : Schema1Boxed { + override fun getData(): Any? { + return data + } + } + + data class Schema1BoxedBoolean(val data: Boolean): Schema1Boxed { + override fun getData(): Any? { + return data + } + } + + data class Schema1BoxedNumber(val data: Number) : Schema1Boxed { + override fun getData(): Any? { + return data + } + } + + data class Schema1BoxedString(val data: String) : Schema1Boxed { + override fun getData(): Any? { + return data + } + } + + data class Schema1BoxedList(val data: FrozenList) : Schema1Boxed { + override fun getData(): Any? { + return data + } + } + + data class Schema1BoxedMap(val data: Schema1Map) : Schema1Boxed { + override fun getData(): Any? { + return data + } + } + + + class Schema1 private constructor(): JsonSchema( + JsonSchemaInfo() + .properties(mapOf( + "baz" to Baz::class.java + )) + .required(setOf( + "baz" + )) + ), NullSchemaValidator, BooleanSchemaValidator, NumberSchemaValidator, StringSchemaValidator, ListSchemaValidator, Schema1BoxedList>, MapSchemaValidator { + + companion object { + @Volatile + private var instance: Schema1? = null + + fun getInstance() = + instance ?: synchronized(this) { + instance ?: Schema1().also { instance = it } + } + } + + @Throws(ValidationException::class) + override fun validate(arg: Nothing?, configuration: SchemaConfiguration?): Nothing? { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validatedPathToSchemas = PathToSchemasMap() + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, LinkedHashSet()) + getPathToSchemas(this, castArg, validationMetadata, pathSet) + return castArg + } + + @Throws(ValidationException::class) + override fun validate(arg: Boolean, configuration: SchemaConfiguration?): Boolean { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validatedPathToSchemas = PathToSchemasMap() + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, LinkedHashSet()) + getPathToSchemas(this, castArg, validationMetadata, pathSet) + return castArg + } + + @Throws(ValidationException::class) + override fun validate(arg: Number, configuration: SchemaConfiguration?): Number { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validatedPathToSchemas = PathToSchemasMap() + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, LinkedHashSet()) + getPathToSchemas(this, castArg, validationMetadata, pathSet) + return castArg + } + + @Throws(ValidationException::class) + fun validate(arg: Int, configuration: SchemaConfiguration?): Int { + return validate(arg as Number, configuration) as Int + } + + @Throws(ValidationException::class) + fun validate(arg: Long, configuration: SchemaConfiguration?): Long { + return validate(arg as Number, configuration) as Long + } + + @Throws(ValidationException::class) + fun validate(arg: Float, configuration: SchemaConfiguration?): Float { + return validate(arg as Number, configuration) as Float + } + + @Throws(ValidationException::class) + fun validate(arg: Double, configuration: SchemaConfiguration?): Double { + return validate(arg as Number, configuration) as Double + } + + @Throws(ValidationException::class) + override fun validate(arg: String, configuration: SchemaConfiguration?): String { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validatedPathToSchemas = PathToSchemasMap() + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, LinkedHashSet()) + getPathToSchemas(this, castArg, validationMetadata, pathSet) + return castArg + } + + @Throws(ValidationException::class) + fun validate(arg: LocalDate, configuration: SchemaConfiguration?): String { + return validate(arg.toString(), configuration) + } + + @Throws(ValidationException::class) + fun validate(arg: ZonedDateTime, configuration: SchemaConfiguration?): String { + return validate(arg.toString(), configuration) + } + + @Throws(ValidationException::class) + fun validate(arg: UUID, configuration: SchemaConfiguration?): String { + return validate(arg.toString(), configuration) + } + + override fun getNewInstance(arg: List<*>, pathToItem: List, pathToSchemas: PathToSchemasMap): FrozenList { + val items: MutableList = ArrayList() + var i: Int = 0 + for (item: Any? in arg) { + val itemPathToItem = pathToItem + i + val schemas: LinkedHashMap, Nothing?>? = pathToSchemas.get(itemPathToItem) + if (schemas == null) { + throw RuntimeException("Validation result is invalid, schemas must exist for a pathToItem") + } + val itemSchema: JsonSchema<*> = schemas.entries.iterator().next().key + val itemInstance: Any? = itemSchema.getNewInstance(item, itemPathToItem, pathToSchemas) + items.add(itemInstance) + i += 1 + } + val newInstanceItems: FrozenList = FrozenList(items) + return newInstanceItems + } + + @Throws(ValidationException::class) + override fun validate(arg: List<*>, configuration: SchemaConfiguration?): FrozenList { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, PathToSchemasMap(), LinkedHashSet()) + val pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet) + return getNewInstance(castArg, validationMetadata.pathToItem, pathToSchemasMap) + } + + override fun getNewInstance(arg: Map<*, *>, pathToItem: List, pathToSchemas: PathToSchemasMap): Schema1Map { + val properties: LinkedHashMap = LinkedHashMap() + for((propertyName, value) in arg) { + if (!(propertyName is String)) { + throw RuntimeException("Invalid non-string key value") + } + val propertyPathToItem: List = pathToItem + propertyName + val schemas: LinkedHashMap, Nothing?>? = pathToSchemas.get(propertyPathToItem) + if (schemas == null) { + throw RuntimeException("Validation result is invalid, schemas must exist for a pathToItem") + } + val propertySchema: JsonSchema<*> = schemas.entries.iterator().next().key + val propertyInstance: Any? = propertySchema.getNewInstance(value, propertyPathToItem, pathToSchemas) + properties[propertyName] = propertyInstance + } + val castProperties: FrozenMap = FrozenMap(properties) + return Schema1Map(castProperties) + } + + @Throws(ValidationException::class) + override fun validate(arg: Map<*, *>, configuration: SchemaConfiguration?): Schema1Map { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validatedPathToSchemas = PathToSchemasMap() + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, LinkedHashSet()) + val pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet) + return getNewInstance(castArg, validationMetadata.pathToItem, pathToSchemasMap) + } + + @Throws(ValidationException::class) + override fun validate(arg: Any?, configuration: SchemaConfiguration?): Any? { + if (arg == null) { + return validate(null, configuration) + } else if (arg is Boolean) { + return validate(arg, configuration) + } else if (arg is Number) { + return validate(arg, configuration) + } else if (arg is String) { + return validate(arg, configuration) + } else if (arg is List<*>) { + return validate(arg, configuration) + } else if (arg is Map<*, *>) { + return validate(arg, configuration) + } + throw ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema") + } + override fun getNewInstance(arg: Any?, pathToItem: List, pathToSchemas: PathToSchemasMap): Any? { + if (arg == null) { + return getNewInstance( null, pathToItem, pathToSchemas) + } else if (arg is Boolean) { + return getNewInstance(arg, pathToItem, pathToSchemas) + } else if (arg is Number) { + return getNewInstance(arg, pathToItem, pathToSchemas) + } else if (arg is String) { + return getNewInstance(arg, pathToItem, pathToSchemas) + } else if (arg is List<*>) { + return getNewInstance(arg, pathToItem, pathToSchemas) + } else if (arg is Map<*, *>) { + return getNewInstance(arg, pathToItem, pathToSchemas) + } + throw RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema") + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: Nothing?, configuration: SchemaConfiguration?): Schema1BoxedVoid { + return Schema1BoxedVoid(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: Boolean, configuration: SchemaConfiguration?): Schema1BoxedBoolean { + return Schema1BoxedBoolean(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: Number, configuration: SchemaConfiguration?): Schema1BoxedNumber { + return Schema1BoxedNumber(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: String, configuration: SchemaConfiguration?): Schema1BoxedString { + return Schema1BoxedString(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: List<*>, configuration: SchemaConfiguration?): Schema1BoxedList { + return Schema1BoxedList(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: Map<*, *>, configuration: SchemaConfiguration?): Schema1BoxedMap { + return Schema1BoxedMap(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: Any?, configuration: SchemaConfiguration?): Schema1Boxed { + if (arg == null) { + return validateAndBox(null, configuration) + } else if (arg is Boolean) { + return validateAndBox(arg, configuration) + } else if (arg is String) { + return validateAndBox(arg, configuration) + } else if (arg is Number) { + return validateAndBox(arg, configuration) + } else if (arg is List<*>) { + return validateAndBox(arg, configuration) + } else if (arg is Map<*, *>) { + return validateAndBox(arg, configuration) + } + throw ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema") + } + } + + class Bar : IntJsonSchema.IntJsonSchema1() { + companion object { + @Volatile + private var instance: Bar? = null + + fun getInstance() = + instance ?: synchronized(this) { + instance ?: Bar().also { instance = it } + } + } + } + + + class AllofWithBaseSchemaMap(m: FrozenMap) : FrozenMap(m) { + companion object { + val requiredKeys: Set = setOf( + "bar" + ) + val optionalKeys: Set = setOf() + @Throws(ValidationException::class) + fun of(arg: Map, configuration: SchemaConfiguration): AllofWithBaseSchemaMap { + return AllofWithBaseSchema1.getInstance().validate(arg, configuration) + } + } + + fun bar(): Number { + val value: Any? = get("bar") + if (!(value is Number)) { + throw RuntimeException("Invalid value stored for bar") + } + return value + } + + @Throws(UnsetPropertyException::class, InvalidAdditionalPropertyException::class) + fun getAdditionalProperty(name: String): Any? { + throwIfKeyKnown(name, requiredKeys, optionalKeys) + throwIfKeyNotPresent(name) + return get(name) + } + } + + interface SetterForBar { + fun getInstance(): MutableMap + fun getBuilderAfterBar(instance: MutableMap): T + + fun bar(value: Int): T { + val instance = getInstance() + instance["bar"] = value + return getBuilderAfterBar(instance) + } + + fun bar(value: Float): T { + val instance = getInstance() + instance["bar"] = value + return getBuilderAfterBar(instance) + } + + fun bar(value: Long): T { + val instance = getInstance() + instance["bar"] = value + return getBuilderAfterBar(instance) + } + + fun bar(value: Double): T { + val instance = getInstance() + instance["bar"] = value + return getBuilderAfterBar(instance) + } + } + + class AllofWithBaseSchemaMap0Builder(private val instance: MutableMap): UnsetAddPropsSetter, GenericBuilder> { + private val knownKeys: Set = setOf( + "bar" + ) + override fun getKnownKeys(): Set { + return knownKeys + } + override fun build(): Map { + return instance + } + override fun getInstance(): MutableMap { + return instance + } + override fun getBuilderAfterAdditionalProperty(instance: MutableMap): AllofWithBaseSchemaMap0Builder { + return this + } + } + + class AllofWithBaseSchemaMapBuilder: SetterForBar { + private val instance: MutableMap + init { + this.instance = LinkedHashMap() + } + override fun getInstance(): MutableMap { + return instance + } + override fun getBuilderAfterBar(instance: MutableMap): AllofWithBaseSchemaMap0Builder { + return AllofWithBaseSchemaMap0Builder(instance) + } + } + + + sealed interface AllofWithBaseSchema1Boxed { + fun getData(): Any? + } + + data class AllofWithBaseSchema1BoxedVoid(val data: Nothing?) : AllofWithBaseSchema1Boxed { + override fun getData(): Any? { + return data + } + } + + data class AllofWithBaseSchema1BoxedBoolean(val data: Boolean): AllofWithBaseSchema1Boxed { + override fun getData(): Any? { + return data + } + } + + data class AllofWithBaseSchema1BoxedNumber(val data: Number) : AllofWithBaseSchema1Boxed { + override fun getData(): Any? { + return data + } + } + + data class AllofWithBaseSchema1BoxedString(val data: String) : AllofWithBaseSchema1Boxed { + override fun getData(): Any? { + return data + } + } + + data class AllofWithBaseSchema1BoxedList(val data: FrozenList) : AllofWithBaseSchema1Boxed { + override fun getData(): Any? { + return data + } + } + + data class AllofWithBaseSchema1BoxedMap(val data: AllofWithBaseSchemaMap) : AllofWithBaseSchema1Boxed { + override fun getData(): Any? { + return data + } + } + + + class AllofWithBaseSchema1 private constructor(): JsonSchema( + JsonSchemaInfo() + .properties(mapOf( + "bar" to Bar::class.java + )) + .required(setOf( + "bar" + )) + .allOf(listOf( + Schema0::class.java, + Schema1::class.java + )) + ), NullSchemaValidator, BooleanSchemaValidator, NumberSchemaValidator, StringSchemaValidator, ListSchemaValidator, AllofWithBaseSchema1BoxedList>, MapSchemaValidator { + /* + NOTE: This class is auto generated by OpenAPI JSON Schema Generator. + Ref: https://github.com/openapi-json-schema-tools/openapi-json-schema-generator + + Do not edit the class manually. + */ + + companion object { + @Volatile + private var instance: AllofWithBaseSchema1? = null + + fun getInstance() = + instance ?: synchronized(this) { + instance ?: AllofWithBaseSchema1().also { instance = it } + } + } + + @Throws(ValidationException::class) + override fun validate(arg: Nothing?, configuration: SchemaConfiguration?): Nothing? { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validatedPathToSchemas = PathToSchemasMap() + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, LinkedHashSet()) + getPathToSchemas(this, castArg, validationMetadata, pathSet) + return castArg + } + + @Throws(ValidationException::class) + override fun validate(arg: Boolean, configuration: SchemaConfiguration?): Boolean { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validatedPathToSchemas = PathToSchemasMap() + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, LinkedHashSet()) + getPathToSchemas(this, castArg, validationMetadata, pathSet) + return castArg + } + + @Throws(ValidationException::class) + override fun validate(arg: Number, configuration: SchemaConfiguration?): Number { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validatedPathToSchemas = PathToSchemasMap() + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, LinkedHashSet()) + getPathToSchemas(this, castArg, validationMetadata, pathSet) + return castArg + } + + @Throws(ValidationException::class) + fun validate(arg: Int, configuration: SchemaConfiguration?): Int { + return validate(arg as Number, configuration) as Int + } + + @Throws(ValidationException::class) + fun validate(arg: Long, configuration: SchemaConfiguration?): Long { + return validate(arg as Number, configuration) as Long + } + + @Throws(ValidationException::class) + fun validate(arg: Float, configuration: SchemaConfiguration?): Float { + return validate(arg as Number, configuration) as Float + } + + @Throws(ValidationException::class) + fun validate(arg: Double, configuration: SchemaConfiguration?): Double { + return validate(arg as Number, configuration) as Double + } + + @Throws(ValidationException::class) + override fun validate(arg: String, configuration: SchemaConfiguration?): String { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validatedPathToSchemas = PathToSchemasMap() + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, LinkedHashSet()) + getPathToSchemas(this, castArg, validationMetadata, pathSet) + return castArg + } + + @Throws(ValidationException::class) + fun validate(arg: LocalDate, configuration: SchemaConfiguration?): String { + return validate(arg.toString(), configuration) + } + + @Throws(ValidationException::class) + fun validate(arg: ZonedDateTime, configuration: SchemaConfiguration?): String { + return validate(arg.toString(), configuration) + } + + @Throws(ValidationException::class) + fun validate(arg: UUID, configuration: SchemaConfiguration?): String { + return validate(arg.toString(), configuration) + } + + override fun getNewInstance(arg: List<*>, pathToItem: List, pathToSchemas: PathToSchemasMap): FrozenList { + val items: MutableList = ArrayList() + var i: Int = 0 + for (item: Any? in arg) { + val itemPathToItem = pathToItem + i + val schemas: LinkedHashMap, Nothing?>? = pathToSchemas.get(itemPathToItem) + if (schemas == null) { + throw RuntimeException("Validation result is invalid, schemas must exist for a pathToItem") + } + val itemSchema: JsonSchema<*> = schemas.entries.iterator().next().key + val itemInstance: Any? = itemSchema.getNewInstance(item, itemPathToItem, pathToSchemas) + items.add(itemInstance) + i += 1 + } + val newInstanceItems: FrozenList = FrozenList(items) + return newInstanceItems + } + + @Throws(ValidationException::class) + override fun validate(arg: List<*>, configuration: SchemaConfiguration?): FrozenList { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, PathToSchemasMap(), LinkedHashSet()) + val pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet) + return getNewInstance(castArg, validationMetadata.pathToItem, pathToSchemasMap) + } + + override fun getNewInstance(arg: Map<*, *>, pathToItem: List, pathToSchemas: PathToSchemasMap): AllofWithBaseSchemaMap { + val properties: LinkedHashMap = LinkedHashMap() + for((propertyName, value) in arg) { + if (!(propertyName is String)) { + throw RuntimeException("Invalid non-string key value") + } + val propertyPathToItem: List = pathToItem + propertyName + val schemas: LinkedHashMap, Nothing?>? = pathToSchemas.get(propertyPathToItem) + if (schemas == null) { + throw RuntimeException("Validation result is invalid, schemas must exist for a pathToItem") + } + val propertySchema: JsonSchema<*> = schemas.entries.iterator().next().key + val propertyInstance: Any? = propertySchema.getNewInstance(value, propertyPathToItem, pathToSchemas) + properties[propertyName] = propertyInstance + } + val castProperties: FrozenMap = FrozenMap(properties) + return AllofWithBaseSchemaMap(castProperties) + } + + @Throws(ValidationException::class) + override fun validate(arg: Map<*, *>, configuration: SchemaConfiguration?): AllofWithBaseSchemaMap { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validatedPathToSchemas = PathToSchemasMap() + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, LinkedHashSet()) + val pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet) + return getNewInstance(castArg, validationMetadata.pathToItem, pathToSchemasMap) + } + + @Throws(ValidationException::class) + override fun validate(arg: Any?, configuration: SchemaConfiguration?): Any? { + if (arg == null) { + return validate(null, configuration) + } else if (arg is Boolean) { + return validate(arg, configuration) + } else if (arg is Number) { + return validate(arg, configuration) + } else if (arg is String) { + return validate(arg, configuration) + } else if (arg is List<*>) { + return validate(arg, configuration) + } else if (arg is Map<*, *>) { + return validate(arg, configuration) + } + throw ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema") + } + override fun getNewInstance(arg: Any?, pathToItem: List, pathToSchemas: PathToSchemasMap): Any? { + if (arg == null) { + return getNewInstance( null, pathToItem, pathToSchemas) + } else if (arg is Boolean) { + return getNewInstance(arg, pathToItem, pathToSchemas) + } else if (arg is Number) { + return getNewInstance(arg, pathToItem, pathToSchemas) + } else if (arg is String) { + return getNewInstance(arg, pathToItem, pathToSchemas) + } else if (arg is List<*>) { + return getNewInstance(arg, pathToItem, pathToSchemas) + } else if (arg is Map<*, *>) { + return getNewInstance(arg, pathToItem, pathToSchemas) + } + throw RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema") + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: Nothing?, configuration: SchemaConfiguration?): AllofWithBaseSchema1BoxedVoid { + return AllofWithBaseSchema1BoxedVoid(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: Boolean, configuration: SchemaConfiguration?): AllofWithBaseSchema1BoxedBoolean { + return AllofWithBaseSchema1BoxedBoolean(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: Number, configuration: SchemaConfiguration?): AllofWithBaseSchema1BoxedNumber { + return AllofWithBaseSchema1BoxedNumber(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: String, configuration: SchemaConfiguration?): AllofWithBaseSchema1BoxedString { + return AllofWithBaseSchema1BoxedString(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: List<*>, configuration: SchemaConfiguration?): AllofWithBaseSchema1BoxedList { + return AllofWithBaseSchema1BoxedList(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: Map<*, *>, configuration: SchemaConfiguration?): AllofWithBaseSchema1BoxedMap { + return AllofWithBaseSchema1BoxedMap(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: Any?, configuration: SchemaConfiguration?): AllofWithBaseSchema1Boxed { + if (arg == null) { + return validateAndBox(null, configuration) + } else if (arg is Boolean) { + return validateAndBox(arg, configuration) + } else if (arg is String) { + return validateAndBox(arg, configuration) + } else if (arg is Number) { + return validateAndBox(arg, configuration) + } else if (arg is List<*>) { + return validateAndBox(arg, configuration) + } else if (arg is Map<*, *>) { + return validateAndBox(arg, configuration) + } + throw ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema") + } + } +} diff --git a/samples/client/3_0_3_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/schemas/AllofWithOneEmptySchema.kt b/samples/client/3_0_3_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/schemas/AllofWithOneEmptySchema.kt new file mode 100644 index 00000000000..d52dc7697e6 --- /dev/null +++ b/samples/client/3_0_3_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/schemas/AllofWithOneEmptySchema.kt @@ -0,0 +1,324 @@ +package org.openapijsonschematools.client.components.schemas +import java.time.LocalDate +import java.time.ZonedDateTime +import java.util.UUID +import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags +import org.openapijsonschematools.client.configurations.SchemaConfiguration +import org.openapijsonschematools.client.exceptions.InvalidAdditionalPropertyException +import org.openapijsonschematools.client.exceptions.UnsetPropertyException +import org.openapijsonschematools.client.exceptions.ValidationException +import org.openapijsonschematools.client.schemas.AnyTypeJsonSchema +import org.openapijsonschematools.client.schemas.UnsetAddPropsSetter +import org.openapijsonschematools.client.schemas.validation.BooleanSchemaValidator +import org.openapijsonschematools.client.schemas.validation.FrozenList +import org.openapijsonschematools.client.schemas.validation.FrozenMap +import org.openapijsonschematools.client.schemas.validation.JsonSchema +import org.openapijsonschematools.client.schemas.validation.JsonSchemaInfo +import org.openapijsonschematools.client.schemas.validation.ListSchemaValidator +import org.openapijsonschematools.client.schemas.validation.MapSchemaValidator +import org.openapijsonschematools.client.schemas.validation.NullSchemaValidator +import org.openapijsonschematools.client.schemas.validation.NumberSchemaValidator +import org.openapijsonschematools.client.schemas.validation.PathToSchemasMap +import org.openapijsonschematools.client.schemas.validation.StringSchemaValidator +import org.openapijsonschematools.client.schemas.validation.ValidationMetadata + +class AllofWithOneEmptySchema { + // nest classes so all schemas and input/output classes can be public + + + class Schema0 : AnyTypeJsonSchema.AnyTypeJsonSchema1() { + companion object { + @Volatile + private var instance: Schema0? = null + + fun getInstance() = + instance ?: synchronized(this) { + instance ?: Schema0().also { instance = it } + } + } + } + + + sealed interface AllofWithOneEmptySchema1Boxed { + fun getData(): Any? + } + + data class AllofWithOneEmptySchema1BoxedVoid(val data: Nothing?) : AllofWithOneEmptySchema1Boxed { + override fun getData(): Any? { + return data + } + } + + data class AllofWithOneEmptySchema1BoxedBoolean(val data: Boolean): AllofWithOneEmptySchema1Boxed { + override fun getData(): Any? { + return data + } + } + + data class AllofWithOneEmptySchema1BoxedNumber(val data: Number) : AllofWithOneEmptySchema1Boxed { + override fun getData(): Any? { + return data + } + } + + data class AllofWithOneEmptySchema1BoxedString(val data: String) : AllofWithOneEmptySchema1Boxed { + override fun getData(): Any? { + return data + } + } + + data class AllofWithOneEmptySchema1BoxedList(val data: FrozenList) : AllofWithOneEmptySchema1Boxed { + override fun getData(): Any? { + return data + } + } + + data class AllofWithOneEmptySchema1BoxedMap(val data: FrozenMap) : AllofWithOneEmptySchema1Boxed { + override fun getData(): Any? { + return data + } + } + + + class AllofWithOneEmptySchema1 private constructor(): JsonSchema( + JsonSchemaInfo() + .allOf(listOf( + Schema0::class.java + )) + ), NullSchemaValidator, BooleanSchemaValidator, NumberSchemaValidator, StringSchemaValidator, ListSchemaValidator, AllofWithOneEmptySchema1BoxedList>, MapSchemaValidator, AllofWithOneEmptySchema1BoxedMap> { + /* + NOTE: This class is auto generated by OpenAPI JSON Schema Generator. + Ref: https://github.com/openapi-json-schema-tools/openapi-json-schema-generator + + Do not edit the class manually. + */ + + companion object { + @Volatile + private var instance: AllofWithOneEmptySchema1? = null + + fun getInstance() = + instance ?: synchronized(this) { + instance ?: AllofWithOneEmptySchema1().also { instance = it } + } + } + + @Throws(ValidationException::class) + override fun validate(arg: Nothing?, configuration: SchemaConfiguration?): Nothing? { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validatedPathToSchemas = PathToSchemasMap() + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, LinkedHashSet()) + getPathToSchemas(this, castArg, validationMetadata, pathSet) + return castArg + } + + @Throws(ValidationException::class) + override fun validate(arg: Boolean, configuration: SchemaConfiguration?): Boolean { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validatedPathToSchemas = PathToSchemasMap() + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, LinkedHashSet()) + getPathToSchemas(this, castArg, validationMetadata, pathSet) + return castArg + } + + @Throws(ValidationException::class) + override fun validate(arg: Number, configuration: SchemaConfiguration?): Number { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validatedPathToSchemas = PathToSchemasMap() + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, LinkedHashSet()) + getPathToSchemas(this, castArg, validationMetadata, pathSet) + return castArg + } + + @Throws(ValidationException::class) + fun validate(arg: Int, configuration: SchemaConfiguration?): Int { + return validate(arg as Number, configuration) as Int + } + + @Throws(ValidationException::class) + fun validate(arg: Long, configuration: SchemaConfiguration?): Long { + return validate(arg as Number, configuration) as Long + } + + @Throws(ValidationException::class) + fun validate(arg: Float, configuration: SchemaConfiguration?): Float { + return validate(arg as Number, configuration) as Float + } + + @Throws(ValidationException::class) + fun validate(arg: Double, configuration: SchemaConfiguration?): Double { + return validate(arg as Number, configuration) as Double + } + + @Throws(ValidationException::class) + override fun validate(arg: String, configuration: SchemaConfiguration?): String { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validatedPathToSchemas = PathToSchemasMap() + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, LinkedHashSet()) + getPathToSchemas(this, castArg, validationMetadata, pathSet) + return castArg + } + + @Throws(ValidationException::class) + fun validate(arg: LocalDate, configuration: SchemaConfiguration?): String { + return validate(arg.toString(), configuration) + } + + @Throws(ValidationException::class) + fun validate(arg: ZonedDateTime, configuration: SchemaConfiguration?): String { + return validate(arg.toString(), configuration) + } + + @Throws(ValidationException::class) + fun validate(arg: UUID, configuration: SchemaConfiguration?): String { + return validate(arg.toString(), configuration) + } + + override fun getNewInstance(arg: List<*>, pathToItem: List, pathToSchemas: PathToSchemasMap): FrozenList { + val items: MutableList = ArrayList() + var i: Int = 0 + for (item: Any? in arg) { + val itemPathToItem = pathToItem + i + val schemas: LinkedHashMap, Nothing?>? = pathToSchemas.get(itemPathToItem) + if (schemas == null) { + throw RuntimeException("Validation result is invalid, schemas must exist for a pathToItem") + } + val itemSchema: JsonSchema<*> = schemas.entries.iterator().next().key + val itemInstance: Any? = itemSchema.getNewInstance(item, itemPathToItem, pathToSchemas) + items.add(itemInstance) + i += 1 + } + val newInstanceItems: FrozenList = FrozenList(items) + return newInstanceItems + } + + @Throws(ValidationException::class) + override fun validate(arg: List<*>, configuration: SchemaConfiguration?): FrozenList { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, PathToSchemasMap(), LinkedHashSet()) + val pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet) + return getNewInstance(castArg, validationMetadata.pathToItem, pathToSchemasMap) + } + + override fun getNewInstance(arg: Map<*, *>, pathToItem: List, pathToSchemas: PathToSchemasMap): FrozenMap { + val properties: LinkedHashMap = LinkedHashMap() + for((propertyName, value) in arg) { + if (!(propertyName is String)) { + throw RuntimeException("Invalid non-string key value") + } + val propertyPathToItem: List = pathToItem + propertyName + val schemas: LinkedHashMap, Nothing?>? = pathToSchemas.get(propertyPathToItem) + if (schemas == null) { + throw RuntimeException("Validation result is invalid, schemas must exist for a pathToItem") + } + val propertySchema: JsonSchema<*> = schemas.entries.iterator().next().key + val propertyInstance: Any? = propertySchema.getNewInstance(value, propertyPathToItem, pathToSchemas) + properties[propertyName] = propertyInstance + } + val castProperties: FrozenMap = FrozenMap(properties) + return castProperties + } + + @Throws(ValidationException::class) + override fun validate(arg: Map<*, *>, configuration: SchemaConfiguration?): FrozenMap { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validatedPathToSchemas = PathToSchemasMap() + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, LinkedHashSet()) + val pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet) + return getNewInstance(castArg, validationMetadata.pathToItem, pathToSchemasMap) + } + + @Throws(ValidationException::class) + override fun validate(arg: Any?, configuration: SchemaConfiguration?): Any? { + if (arg == null) { + return validate(null, configuration) + } else if (arg is Boolean) { + return validate(arg, configuration) + } else if (arg is Number) { + return validate(arg, configuration) + } else if (arg is String) { + return validate(arg, configuration) + } else if (arg is List<*>) { + return validate(arg, configuration) + } else if (arg is Map<*, *>) { + return validate(arg, configuration) + } + throw ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema") + } + override fun getNewInstance(arg: Any?, pathToItem: List, pathToSchemas: PathToSchemasMap): Any? { + if (arg == null) { + return getNewInstance( null, pathToItem, pathToSchemas) + } else if (arg is Boolean) { + return getNewInstance(arg, pathToItem, pathToSchemas) + } else if (arg is Number) { + return getNewInstance(arg, pathToItem, pathToSchemas) + } else if (arg is String) { + return getNewInstance(arg, pathToItem, pathToSchemas) + } else if (arg is List<*>) { + return getNewInstance(arg, pathToItem, pathToSchemas) + } else if (arg is Map<*, *>) { + return getNewInstance(arg, pathToItem, pathToSchemas) + } + throw RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema") + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: Nothing?, configuration: SchemaConfiguration?): AllofWithOneEmptySchema1BoxedVoid { + return AllofWithOneEmptySchema1BoxedVoid(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: Boolean, configuration: SchemaConfiguration?): AllofWithOneEmptySchema1BoxedBoolean { + return AllofWithOneEmptySchema1BoxedBoolean(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: Number, configuration: SchemaConfiguration?): AllofWithOneEmptySchema1BoxedNumber { + return AllofWithOneEmptySchema1BoxedNumber(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: String, configuration: SchemaConfiguration?): AllofWithOneEmptySchema1BoxedString { + return AllofWithOneEmptySchema1BoxedString(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: List<*>, configuration: SchemaConfiguration?): AllofWithOneEmptySchema1BoxedList { + return AllofWithOneEmptySchema1BoxedList(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: Map<*, *>, configuration: SchemaConfiguration?): AllofWithOneEmptySchema1BoxedMap { + return AllofWithOneEmptySchema1BoxedMap(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: Any?, configuration: SchemaConfiguration?): AllofWithOneEmptySchema1Boxed { + if (arg == null) { + return validateAndBox(null, configuration) + } else if (arg is Boolean) { + return validateAndBox(arg, configuration) + } else if (arg is String) { + return validateAndBox(arg, configuration) + } else if (arg is Number) { + return validateAndBox(arg, configuration) + } else if (arg is List<*>) { + return validateAndBox(arg, configuration) + } else if (arg is Map<*, *>) { + return validateAndBox(arg, configuration) + } + throw ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema") + } + } +} diff --git a/samples/client/3_0_3_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/schemas/AllofWithTheFirstEmptySchema.kt b/samples/client/3_0_3_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/schemas/AllofWithTheFirstEmptySchema.kt new file mode 100644 index 00000000000..05bc227949a --- /dev/null +++ b/samples/client/3_0_3_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/schemas/AllofWithTheFirstEmptySchema.kt @@ -0,0 +1,339 @@ +package org.openapijsonschematools.client.components.schemas +import java.time.LocalDate +import java.time.ZonedDateTime +import java.util.UUID +import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags +import org.openapijsonschematools.client.configurations.SchemaConfiguration +import org.openapijsonschematools.client.exceptions.InvalidAdditionalPropertyException +import org.openapijsonschematools.client.exceptions.UnsetPropertyException +import org.openapijsonschematools.client.exceptions.ValidationException +import org.openapijsonschematools.client.schemas.AnyTypeJsonSchema +import org.openapijsonschematools.client.schemas.NumberJsonSchema +import org.openapijsonschematools.client.schemas.UnsetAddPropsSetter +import org.openapijsonschematools.client.schemas.validation.BooleanSchemaValidator +import org.openapijsonschematools.client.schemas.validation.FrozenList +import org.openapijsonschematools.client.schemas.validation.FrozenMap +import org.openapijsonschematools.client.schemas.validation.JsonSchema +import org.openapijsonschematools.client.schemas.validation.JsonSchemaInfo +import org.openapijsonschematools.client.schemas.validation.ListSchemaValidator +import org.openapijsonschematools.client.schemas.validation.MapSchemaValidator +import org.openapijsonschematools.client.schemas.validation.NullSchemaValidator +import org.openapijsonschematools.client.schemas.validation.NumberSchemaValidator +import org.openapijsonschematools.client.schemas.validation.PathToSchemasMap +import org.openapijsonschematools.client.schemas.validation.StringSchemaValidator +import org.openapijsonschematools.client.schemas.validation.ValidationMetadata + +class AllofWithTheFirstEmptySchema { + // nest classes so all schemas and input/output classes can be public + + + class Schema0 : AnyTypeJsonSchema.AnyTypeJsonSchema1() { + companion object { + @Volatile + private var instance: Schema0? = null + + fun getInstance() = + instance ?: synchronized(this) { + instance ?: Schema0().also { instance = it } + } + } + } + + + class Schema1 : NumberJsonSchema.NumberJsonSchema1() { + companion object { + @Volatile + private var instance: Schema1? = null + + fun getInstance() = + instance ?: synchronized(this) { + instance ?: Schema1().also { instance = it } + } + } + } + + + sealed interface AllofWithTheFirstEmptySchema1Boxed { + fun getData(): Any? + } + + data class AllofWithTheFirstEmptySchema1BoxedVoid(val data: Nothing?) : AllofWithTheFirstEmptySchema1Boxed { + override fun getData(): Any? { + return data + } + } + + data class AllofWithTheFirstEmptySchema1BoxedBoolean(val data: Boolean): AllofWithTheFirstEmptySchema1Boxed { + override fun getData(): Any? { + return data + } + } + + data class AllofWithTheFirstEmptySchema1BoxedNumber(val data: Number) : AllofWithTheFirstEmptySchema1Boxed { + override fun getData(): Any? { + return data + } + } + + data class AllofWithTheFirstEmptySchema1BoxedString(val data: String) : AllofWithTheFirstEmptySchema1Boxed { + override fun getData(): Any? { + return data + } + } + + data class AllofWithTheFirstEmptySchema1BoxedList(val data: FrozenList) : AllofWithTheFirstEmptySchema1Boxed { + override fun getData(): Any? { + return data + } + } + + data class AllofWithTheFirstEmptySchema1BoxedMap(val data: FrozenMap) : AllofWithTheFirstEmptySchema1Boxed { + override fun getData(): Any? { + return data + } + } + + + class AllofWithTheFirstEmptySchema1 private constructor(): JsonSchema( + JsonSchemaInfo() + .allOf(listOf( + Schema0::class.java, + Schema1::class.java + )) + ), NullSchemaValidator, BooleanSchemaValidator, NumberSchemaValidator, StringSchemaValidator, ListSchemaValidator, AllofWithTheFirstEmptySchema1BoxedList>, MapSchemaValidator, AllofWithTheFirstEmptySchema1BoxedMap> { + /* + NOTE: This class is auto generated by OpenAPI JSON Schema Generator. + Ref: https://github.com/openapi-json-schema-tools/openapi-json-schema-generator + + Do not edit the class manually. + */ + + companion object { + @Volatile + private var instance: AllofWithTheFirstEmptySchema1? = null + + fun getInstance() = + instance ?: synchronized(this) { + instance ?: AllofWithTheFirstEmptySchema1().also { instance = it } + } + } + + @Throws(ValidationException::class) + override fun validate(arg: Nothing?, configuration: SchemaConfiguration?): Nothing? { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validatedPathToSchemas = PathToSchemasMap() + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, LinkedHashSet()) + getPathToSchemas(this, castArg, validationMetadata, pathSet) + return castArg + } + + @Throws(ValidationException::class) + override fun validate(arg: Boolean, configuration: SchemaConfiguration?): Boolean { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validatedPathToSchemas = PathToSchemasMap() + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, LinkedHashSet()) + getPathToSchemas(this, castArg, validationMetadata, pathSet) + return castArg + } + + @Throws(ValidationException::class) + override fun validate(arg: Number, configuration: SchemaConfiguration?): Number { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validatedPathToSchemas = PathToSchemasMap() + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, LinkedHashSet()) + getPathToSchemas(this, castArg, validationMetadata, pathSet) + return castArg + } + + @Throws(ValidationException::class) + fun validate(arg: Int, configuration: SchemaConfiguration?): Int { + return validate(arg as Number, configuration) as Int + } + + @Throws(ValidationException::class) + fun validate(arg: Long, configuration: SchemaConfiguration?): Long { + return validate(arg as Number, configuration) as Long + } + + @Throws(ValidationException::class) + fun validate(arg: Float, configuration: SchemaConfiguration?): Float { + return validate(arg as Number, configuration) as Float + } + + @Throws(ValidationException::class) + fun validate(arg: Double, configuration: SchemaConfiguration?): Double { + return validate(arg as Number, configuration) as Double + } + + @Throws(ValidationException::class) + override fun validate(arg: String, configuration: SchemaConfiguration?): String { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validatedPathToSchemas = PathToSchemasMap() + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, LinkedHashSet()) + getPathToSchemas(this, castArg, validationMetadata, pathSet) + return castArg + } + + @Throws(ValidationException::class) + fun validate(arg: LocalDate, configuration: SchemaConfiguration?): String { + return validate(arg.toString(), configuration) + } + + @Throws(ValidationException::class) + fun validate(arg: ZonedDateTime, configuration: SchemaConfiguration?): String { + return validate(arg.toString(), configuration) + } + + @Throws(ValidationException::class) + fun validate(arg: UUID, configuration: SchemaConfiguration?): String { + return validate(arg.toString(), configuration) + } + + override fun getNewInstance(arg: List<*>, pathToItem: List, pathToSchemas: PathToSchemasMap): FrozenList { + val items: MutableList = ArrayList() + var i: Int = 0 + for (item: Any? in arg) { + val itemPathToItem = pathToItem + i + val schemas: LinkedHashMap, Nothing?>? = pathToSchemas.get(itemPathToItem) + if (schemas == null) { + throw RuntimeException("Validation result is invalid, schemas must exist for a pathToItem") + } + val itemSchema: JsonSchema<*> = schemas.entries.iterator().next().key + val itemInstance: Any? = itemSchema.getNewInstance(item, itemPathToItem, pathToSchemas) + items.add(itemInstance) + i += 1 + } + val newInstanceItems: FrozenList = FrozenList(items) + return newInstanceItems + } + + @Throws(ValidationException::class) + override fun validate(arg: List<*>, configuration: SchemaConfiguration?): FrozenList { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, PathToSchemasMap(), LinkedHashSet()) + val pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet) + return getNewInstance(castArg, validationMetadata.pathToItem, pathToSchemasMap) + } + + override fun getNewInstance(arg: Map<*, *>, pathToItem: List, pathToSchemas: PathToSchemasMap): FrozenMap { + val properties: LinkedHashMap = LinkedHashMap() + for((propertyName, value) in arg) { + if (!(propertyName is String)) { + throw RuntimeException("Invalid non-string key value") + } + val propertyPathToItem: List = pathToItem + propertyName + val schemas: LinkedHashMap, Nothing?>? = pathToSchemas.get(propertyPathToItem) + if (schemas == null) { + throw RuntimeException("Validation result is invalid, schemas must exist for a pathToItem") + } + val propertySchema: JsonSchema<*> = schemas.entries.iterator().next().key + val propertyInstance: Any? = propertySchema.getNewInstance(value, propertyPathToItem, pathToSchemas) + properties[propertyName] = propertyInstance + } + val castProperties: FrozenMap = FrozenMap(properties) + return castProperties + } + + @Throws(ValidationException::class) + override fun validate(arg: Map<*, *>, configuration: SchemaConfiguration?): FrozenMap { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validatedPathToSchemas = PathToSchemasMap() + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, LinkedHashSet()) + val pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet) + return getNewInstance(castArg, validationMetadata.pathToItem, pathToSchemasMap) + } + + @Throws(ValidationException::class) + override fun validate(arg: Any?, configuration: SchemaConfiguration?): Any? { + if (arg == null) { + return validate(null, configuration) + } else if (arg is Boolean) { + return validate(arg, configuration) + } else if (arg is Number) { + return validate(arg, configuration) + } else if (arg is String) { + return validate(arg, configuration) + } else if (arg is List<*>) { + return validate(arg, configuration) + } else if (arg is Map<*, *>) { + return validate(arg, configuration) + } + throw ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema") + } + override fun getNewInstance(arg: Any?, pathToItem: List, pathToSchemas: PathToSchemasMap): Any? { + if (arg == null) { + return getNewInstance( null, pathToItem, pathToSchemas) + } else if (arg is Boolean) { + return getNewInstance(arg, pathToItem, pathToSchemas) + } else if (arg is Number) { + return getNewInstance(arg, pathToItem, pathToSchemas) + } else if (arg is String) { + return getNewInstance(arg, pathToItem, pathToSchemas) + } else if (arg is List<*>) { + return getNewInstance(arg, pathToItem, pathToSchemas) + } else if (arg is Map<*, *>) { + return getNewInstance(arg, pathToItem, pathToSchemas) + } + throw RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema") + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: Nothing?, configuration: SchemaConfiguration?): AllofWithTheFirstEmptySchema1BoxedVoid { + return AllofWithTheFirstEmptySchema1BoxedVoid(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: Boolean, configuration: SchemaConfiguration?): AllofWithTheFirstEmptySchema1BoxedBoolean { + return AllofWithTheFirstEmptySchema1BoxedBoolean(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: Number, configuration: SchemaConfiguration?): AllofWithTheFirstEmptySchema1BoxedNumber { + return AllofWithTheFirstEmptySchema1BoxedNumber(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: String, configuration: SchemaConfiguration?): AllofWithTheFirstEmptySchema1BoxedString { + return AllofWithTheFirstEmptySchema1BoxedString(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: List<*>, configuration: SchemaConfiguration?): AllofWithTheFirstEmptySchema1BoxedList { + return AllofWithTheFirstEmptySchema1BoxedList(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: Map<*, *>, configuration: SchemaConfiguration?): AllofWithTheFirstEmptySchema1BoxedMap { + return AllofWithTheFirstEmptySchema1BoxedMap(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: Any?, configuration: SchemaConfiguration?): AllofWithTheFirstEmptySchema1Boxed { + if (arg == null) { + return validateAndBox(null, configuration) + } else if (arg is Boolean) { + return validateAndBox(arg, configuration) + } else if (arg is String) { + return validateAndBox(arg, configuration) + } else if (arg is Number) { + return validateAndBox(arg, configuration) + } else if (arg is List<*>) { + return validateAndBox(arg, configuration) + } else if (arg is Map<*, *>) { + return validateAndBox(arg, configuration) + } + throw ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema") + } + } +} diff --git a/samples/client/3_0_3_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/schemas/AllofWithTheLastEmptySchema.kt b/samples/client/3_0_3_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/schemas/AllofWithTheLastEmptySchema.kt new file mode 100644 index 00000000000..fa3b00d842e --- /dev/null +++ b/samples/client/3_0_3_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/schemas/AllofWithTheLastEmptySchema.kt @@ -0,0 +1,339 @@ +package org.openapijsonschematools.client.components.schemas +import java.time.LocalDate +import java.time.ZonedDateTime +import java.util.UUID +import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags +import org.openapijsonschematools.client.configurations.SchemaConfiguration +import org.openapijsonschematools.client.exceptions.InvalidAdditionalPropertyException +import org.openapijsonschematools.client.exceptions.UnsetPropertyException +import org.openapijsonschematools.client.exceptions.ValidationException +import org.openapijsonschematools.client.schemas.AnyTypeJsonSchema +import org.openapijsonschematools.client.schemas.NumberJsonSchema +import org.openapijsonschematools.client.schemas.UnsetAddPropsSetter +import org.openapijsonschematools.client.schemas.validation.BooleanSchemaValidator +import org.openapijsonschematools.client.schemas.validation.FrozenList +import org.openapijsonschematools.client.schemas.validation.FrozenMap +import org.openapijsonschematools.client.schemas.validation.JsonSchema +import org.openapijsonschematools.client.schemas.validation.JsonSchemaInfo +import org.openapijsonschematools.client.schemas.validation.ListSchemaValidator +import org.openapijsonschematools.client.schemas.validation.MapSchemaValidator +import org.openapijsonschematools.client.schemas.validation.NullSchemaValidator +import org.openapijsonschematools.client.schemas.validation.NumberSchemaValidator +import org.openapijsonschematools.client.schemas.validation.PathToSchemasMap +import org.openapijsonschematools.client.schemas.validation.StringSchemaValidator +import org.openapijsonschematools.client.schemas.validation.ValidationMetadata + +class AllofWithTheLastEmptySchema { + // nest classes so all schemas and input/output classes can be public + + + class Schema0 : NumberJsonSchema.NumberJsonSchema1() { + companion object { + @Volatile + private var instance: Schema0? = null + + fun getInstance() = + instance ?: synchronized(this) { + instance ?: Schema0().also { instance = it } + } + } + } + + + class Schema1 : AnyTypeJsonSchema.AnyTypeJsonSchema1() { + companion object { + @Volatile + private var instance: Schema1? = null + + fun getInstance() = + instance ?: synchronized(this) { + instance ?: Schema1().also { instance = it } + } + } + } + + + sealed interface AllofWithTheLastEmptySchema1Boxed { + fun getData(): Any? + } + + data class AllofWithTheLastEmptySchema1BoxedVoid(val data: Nothing?) : AllofWithTheLastEmptySchema1Boxed { + override fun getData(): Any? { + return data + } + } + + data class AllofWithTheLastEmptySchema1BoxedBoolean(val data: Boolean): AllofWithTheLastEmptySchema1Boxed { + override fun getData(): Any? { + return data + } + } + + data class AllofWithTheLastEmptySchema1BoxedNumber(val data: Number) : AllofWithTheLastEmptySchema1Boxed { + override fun getData(): Any? { + return data + } + } + + data class AllofWithTheLastEmptySchema1BoxedString(val data: String) : AllofWithTheLastEmptySchema1Boxed { + override fun getData(): Any? { + return data + } + } + + data class AllofWithTheLastEmptySchema1BoxedList(val data: FrozenList) : AllofWithTheLastEmptySchema1Boxed { + override fun getData(): Any? { + return data + } + } + + data class AllofWithTheLastEmptySchema1BoxedMap(val data: FrozenMap) : AllofWithTheLastEmptySchema1Boxed { + override fun getData(): Any? { + return data + } + } + + + class AllofWithTheLastEmptySchema1 private constructor(): JsonSchema( + JsonSchemaInfo() + .allOf(listOf( + Schema0::class.java, + Schema1::class.java + )) + ), NullSchemaValidator, BooleanSchemaValidator, NumberSchemaValidator, StringSchemaValidator, ListSchemaValidator, AllofWithTheLastEmptySchema1BoxedList>, MapSchemaValidator, AllofWithTheLastEmptySchema1BoxedMap> { + /* + NOTE: This class is auto generated by OpenAPI JSON Schema Generator. + Ref: https://github.com/openapi-json-schema-tools/openapi-json-schema-generator + + Do not edit the class manually. + */ + + companion object { + @Volatile + private var instance: AllofWithTheLastEmptySchema1? = null + + fun getInstance() = + instance ?: synchronized(this) { + instance ?: AllofWithTheLastEmptySchema1().also { instance = it } + } + } + + @Throws(ValidationException::class) + override fun validate(arg: Nothing?, configuration: SchemaConfiguration?): Nothing? { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validatedPathToSchemas = PathToSchemasMap() + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, LinkedHashSet()) + getPathToSchemas(this, castArg, validationMetadata, pathSet) + return castArg + } + + @Throws(ValidationException::class) + override fun validate(arg: Boolean, configuration: SchemaConfiguration?): Boolean { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validatedPathToSchemas = PathToSchemasMap() + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, LinkedHashSet()) + getPathToSchemas(this, castArg, validationMetadata, pathSet) + return castArg + } + + @Throws(ValidationException::class) + override fun validate(arg: Number, configuration: SchemaConfiguration?): Number { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validatedPathToSchemas = PathToSchemasMap() + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, LinkedHashSet()) + getPathToSchemas(this, castArg, validationMetadata, pathSet) + return castArg + } + + @Throws(ValidationException::class) + fun validate(arg: Int, configuration: SchemaConfiguration?): Int { + return validate(arg as Number, configuration) as Int + } + + @Throws(ValidationException::class) + fun validate(arg: Long, configuration: SchemaConfiguration?): Long { + return validate(arg as Number, configuration) as Long + } + + @Throws(ValidationException::class) + fun validate(arg: Float, configuration: SchemaConfiguration?): Float { + return validate(arg as Number, configuration) as Float + } + + @Throws(ValidationException::class) + fun validate(arg: Double, configuration: SchemaConfiguration?): Double { + return validate(arg as Number, configuration) as Double + } + + @Throws(ValidationException::class) + override fun validate(arg: String, configuration: SchemaConfiguration?): String { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validatedPathToSchemas = PathToSchemasMap() + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, LinkedHashSet()) + getPathToSchemas(this, castArg, validationMetadata, pathSet) + return castArg + } + + @Throws(ValidationException::class) + fun validate(arg: LocalDate, configuration: SchemaConfiguration?): String { + return validate(arg.toString(), configuration) + } + + @Throws(ValidationException::class) + fun validate(arg: ZonedDateTime, configuration: SchemaConfiguration?): String { + return validate(arg.toString(), configuration) + } + + @Throws(ValidationException::class) + fun validate(arg: UUID, configuration: SchemaConfiguration?): String { + return validate(arg.toString(), configuration) + } + + override fun getNewInstance(arg: List<*>, pathToItem: List, pathToSchemas: PathToSchemasMap): FrozenList { + val items: MutableList = ArrayList() + var i: Int = 0 + for (item: Any? in arg) { + val itemPathToItem = pathToItem + i + val schemas: LinkedHashMap, Nothing?>? = pathToSchemas.get(itemPathToItem) + if (schemas == null) { + throw RuntimeException("Validation result is invalid, schemas must exist for a pathToItem") + } + val itemSchema: JsonSchema<*> = schemas.entries.iterator().next().key + val itemInstance: Any? = itemSchema.getNewInstance(item, itemPathToItem, pathToSchemas) + items.add(itemInstance) + i += 1 + } + val newInstanceItems: FrozenList = FrozenList(items) + return newInstanceItems + } + + @Throws(ValidationException::class) + override fun validate(arg: List<*>, configuration: SchemaConfiguration?): FrozenList { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, PathToSchemasMap(), LinkedHashSet()) + val pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet) + return getNewInstance(castArg, validationMetadata.pathToItem, pathToSchemasMap) + } + + override fun getNewInstance(arg: Map<*, *>, pathToItem: List, pathToSchemas: PathToSchemasMap): FrozenMap { + val properties: LinkedHashMap = LinkedHashMap() + for((propertyName, value) in arg) { + if (!(propertyName is String)) { + throw RuntimeException("Invalid non-string key value") + } + val propertyPathToItem: List = pathToItem + propertyName + val schemas: LinkedHashMap, Nothing?>? = pathToSchemas.get(propertyPathToItem) + if (schemas == null) { + throw RuntimeException("Validation result is invalid, schemas must exist for a pathToItem") + } + val propertySchema: JsonSchema<*> = schemas.entries.iterator().next().key + val propertyInstance: Any? = propertySchema.getNewInstance(value, propertyPathToItem, pathToSchemas) + properties[propertyName] = propertyInstance + } + val castProperties: FrozenMap = FrozenMap(properties) + return castProperties + } + + @Throws(ValidationException::class) + override fun validate(arg: Map<*, *>, configuration: SchemaConfiguration?): FrozenMap { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validatedPathToSchemas = PathToSchemasMap() + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, LinkedHashSet()) + val pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet) + return getNewInstance(castArg, validationMetadata.pathToItem, pathToSchemasMap) + } + + @Throws(ValidationException::class) + override fun validate(arg: Any?, configuration: SchemaConfiguration?): Any? { + if (arg == null) { + return validate(null, configuration) + } else if (arg is Boolean) { + return validate(arg, configuration) + } else if (arg is Number) { + return validate(arg, configuration) + } else if (arg is String) { + return validate(arg, configuration) + } else if (arg is List<*>) { + return validate(arg, configuration) + } else if (arg is Map<*, *>) { + return validate(arg, configuration) + } + throw ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema") + } + override fun getNewInstance(arg: Any?, pathToItem: List, pathToSchemas: PathToSchemasMap): Any? { + if (arg == null) { + return getNewInstance( null, pathToItem, pathToSchemas) + } else if (arg is Boolean) { + return getNewInstance(arg, pathToItem, pathToSchemas) + } else if (arg is Number) { + return getNewInstance(arg, pathToItem, pathToSchemas) + } else if (arg is String) { + return getNewInstance(arg, pathToItem, pathToSchemas) + } else if (arg is List<*>) { + return getNewInstance(arg, pathToItem, pathToSchemas) + } else if (arg is Map<*, *>) { + return getNewInstance(arg, pathToItem, pathToSchemas) + } + throw RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema") + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: Nothing?, configuration: SchemaConfiguration?): AllofWithTheLastEmptySchema1BoxedVoid { + return AllofWithTheLastEmptySchema1BoxedVoid(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: Boolean, configuration: SchemaConfiguration?): AllofWithTheLastEmptySchema1BoxedBoolean { + return AllofWithTheLastEmptySchema1BoxedBoolean(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: Number, configuration: SchemaConfiguration?): AllofWithTheLastEmptySchema1BoxedNumber { + return AllofWithTheLastEmptySchema1BoxedNumber(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: String, configuration: SchemaConfiguration?): AllofWithTheLastEmptySchema1BoxedString { + return AllofWithTheLastEmptySchema1BoxedString(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: List<*>, configuration: SchemaConfiguration?): AllofWithTheLastEmptySchema1BoxedList { + return AllofWithTheLastEmptySchema1BoxedList(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: Map<*, *>, configuration: SchemaConfiguration?): AllofWithTheLastEmptySchema1BoxedMap { + return AllofWithTheLastEmptySchema1BoxedMap(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: Any?, configuration: SchemaConfiguration?): AllofWithTheLastEmptySchema1Boxed { + if (arg == null) { + return validateAndBox(null, configuration) + } else if (arg is Boolean) { + return validateAndBox(arg, configuration) + } else if (arg is String) { + return validateAndBox(arg, configuration) + } else if (arg is Number) { + return validateAndBox(arg, configuration) + } else if (arg is List<*>) { + return validateAndBox(arg, configuration) + } else if (arg is Map<*, *>) { + return validateAndBox(arg, configuration) + } + throw ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema") + } + } +} diff --git a/samples/client/3_0_3_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/schemas/AllofWithTwoEmptySchemas.kt b/samples/client/3_0_3_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/schemas/AllofWithTwoEmptySchemas.kt new file mode 100644 index 00000000000..6ac254eada1 --- /dev/null +++ b/samples/client/3_0_3_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/schemas/AllofWithTwoEmptySchemas.kt @@ -0,0 +1,338 @@ +package org.openapijsonschematools.client.components.schemas +import java.time.LocalDate +import java.time.ZonedDateTime +import java.util.UUID +import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags +import org.openapijsonschematools.client.configurations.SchemaConfiguration +import org.openapijsonschematools.client.exceptions.InvalidAdditionalPropertyException +import org.openapijsonschematools.client.exceptions.UnsetPropertyException +import org.openapijsonschematools.client.exceptions.ValidationException +import org.openapijsonschematools.client.schemas.AnyTypeJsonSchema +import org.openapijsonschematools.client.schemas.UnsetAddPropsSetter +import org.openapijsonschematools.client.schemas.validation.BooleanSchemaValidator +import org.openapijsonschematools.client.schemas.validation.FrozenList +import org.openapijsonschematools.client.schemas.validation.FrozenMap +import org.openapijsonschematools.client.schemas.validation.JsonSchema +import org.openapijsonschematools.client.schemas.validation.JsonSchemaInfo +import org.openapijsonschematools.client.schemas.validation.ListSchemaValidator +import org.openapijsonschematools.client.schemas.validation.MapSchemaValidator +import org.openapijsonschematools.client.schemas.validation.NullSchemaValidator +import org.openapijsonschematools.client.schemas.validation.NumberSchemaValidator +import org.openapijsonschematools.client.schemas.validation.PathToSchemasMap +import org.openapijsonschematools.client.schemas.validation.StringSchemaValidator +import org.openapijsonschematools.client.schemas.validation.ValidationMetadata + +class AllofWithTwoEmptySchemas { + // nest classes so all schemas and input/output classes can be public + + + class Schema0 : AnyTypeJsonSchema.AnyTypeJsonSchema1() { + companion object { + @Volatile + private var instance: Schema0? = null + + fun getInstance() = + instance ?: synchronized(this) { + instance ?: Schema0().also { instance = it } + } + } + } + + + class Schema1 : AnyTypeJsonSchema.AnyTypeJsonSchema1() { + companion object { + @Volatile + private var instance: Schema1? = null + + fun getInstance() = + instance ?: synchronized(this) { + instance ?: Schema1().also { instance = it } + } + } + } + + + sealed interface AllofWithTwoEmptySchemas1Boxed { + fun getData(): Any? + } + + data class AllofWithTwoEmptySchemas1BoxedVoid(val data: Nothing?) : AllofWithTwoEmptySchemas1Boxed { + override fun getData(): Any? { + return data + } + } + + data class AllofWithTwoEmptySchemas1BoxedBoolean(val data: Boolean): AllofWithTwoEmptySchemas1Boxed { + override fun getData(): Any? { + return data + } + } + + data class AllofWithTwoEmptySchemas1BoxedNumber(val data: Number) : AllofWithTwoEmptySchemas1Boxed { + override fun getData(): Any? { + return data + } + } + + data class AllofWithTwoEmptySchemas1BoxedString(val data: String) : AllofWithTwoEmptySchemas1Boxed { + override fun getData(): Any? { + return data + } + } + + data class AllofWithTwoEmptySchemas1BoxedList(val data: FrozenList) : AllofWithTwoEmptySchemas1Boxed { + override fun getData(): Any? { + return data + } + } + + data class AllofWithTwoEmptySchemas1BoxedMap(val data: FrozenMap) : AllofWithTwoEmptySchemas1Boxed { + override fun getData(): Any? { + return data + } + } + + + class AllofWithTwoEmptySchemas1 private constructor(): JsonSchema( + JsonSchemaInfo() + .allOf(listOf( + Schema0::class.java, + Schema1::class.java + )) + ), NullSchemaValidator, BooleanSchemaValidator, NumberSchemaValidator, StringSchemaValidator, ListSchemaValidator, AllofWithTwoEmptySchemas1BoxedList>, MapSchemaValidator, AllofWithTwoEmptySchemas1BoxedMap> { + /* + NOTE: This class is auto generated by OpenAPI JSON Schema Generator. + Ref: https://github.com/openapi-json-schema-tools/openapi-json-schema-generator + + Do not edit the class manually. + */ + + companion object { + @Volatile + private var instance: AllofWithTwoEmptySchemas1? = null + + fun getInstance() = + instance ?: synchronized(this) { + instance ?: AllofWithTwoEmptySchemas1().also { instance = it } + } + } + + @Throws(ValidationException::class) + override fun validate(arg: Nothing?, configuration: SchemaConfiguration?): Nothing? { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validatedPathToSchemas = PathToSchemasMap() + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, LinkedHashSet()) + getPathToSchemas(this, castArg, validationMetadata, pathSet) + return castArg + } + + @Throws(ValidationException::class) + override fun validate(arg: Boolean, configuration: SchemaConfiguration?): Boolean { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validatedPathToSchemas = PathToSchemasMap() + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, LinkedHashSet()) + getPathToSchemas(this, castArg, validationMetadata, pathSet) + return castArg + } + + @Throws(ValidationException::class) + override fun validate(arg: Number, configuration: SchemaConfiguration?): Number { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validatedPathToSchemas = PathToSchemasMap() + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, LinkedHashSet()) + getPathToSchemas(this, castArg, validationMetadata, pathSet) + return castArg + } + + @Throws(ValidationException::class) + fun validate(arg: Int, configuration: SchemaConfiguration?): Int { + return validate(arg as Number, configuration) as Int + } + + @Throws(ValidationException::class) + fun validate(arg: Long, configuration: SchemaConfiguration?): Long { + return validate(arg as Number, configuration) as Long + } + + @Throws(ValidationException::class) + fun validate(arg: Float, configuration: SchemaConfiguration?): Float { + return validate(arg as Number, configuration) as Float + } + + @Throws(ValidationException::class) + fun validate(arg: Double, configuration: SchemaConfiguration?): Double { + return validate(arg as Number, configuration) as Double + } + + @Throws(ValidationException::class) + override fun validate(arg: String, configuration: SchemaConfiguration?): String { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validatedPathToSchemas = PathToSchemasMap() + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, LinkedHashSet()) + getPathToSchemas(this, castArg, validationMetadata, pathSet) + return castArg + } + + @Throws(ValidationException::class) + fun validate(arg: LocalDate, configuration: SchemaConfiguration?): String { + return validate(arg.toString(), configuration) + } + + @Throws(ValidationException::class) + fun validate(arg: ZonedDateTime, configuration: SchemaConfiguration?): String { + return validate(arg.toString(), configuration) + } + + @Throws(ValidationException::class) + fun validate(arg: UUID, configuration: SchemaConfiguration?): String { + return validate(arg.toString(), configuration) + } + + override fun getNewInstance(arg: List<*>, pathToItem: List, pathToSchemas: PathToSchemasMap): FrozenList { + val items: MutableList = ArrayList() + var i: Int = 0 + for (item: Any? in arg) { + val itemPathToItem = pathToItem + i + val schemas: LinkedHashMap, Nothing?>? = pathToSchemas.get(itemPathToItem) + if (schemas == null) { + throw RuntimeException("Validation result is invalid, schemas must exist for a pathToItem") + } + val itemSchema: JsonSchema<*> = schemas.entries.iterator().next().key + val itemInstance: Any? = itemSchema.getNewInstance(item, itemPathToItem, pathToSchemas) + items.add(itemInstance) + i += 1 + } + val newInstanceItems: FrozenList = FrozenList(items) + return newInstanceItems + } + + @Throws(ValidationException::class) + override fun validate(arg: List<*>, configuration: SchemaConfiguration?): FrozenList { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, PathToSchemasMap(), LinkedHashSet()) + val pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet) + return getNewInstance(castArg, validationMetadata.pathToItem, pathToSchemasMap) + } + + override fun getNewInstance(arg: Map<*, *>, pathToItem: List, pathToSchemas: PathToSchemasMap): FrozenMap { + val properties: LinkedHashMap = LinkedHashMap() + for((propertyName, value) in arg) { + if (!(propertyName is String)) { + throw RuntimeException("Invalid non-string key value") + } + val propertyPathToItem: List = pathToItem + propertyName + val schemas: LinkedHashMap, Nothing?>? = pathToSchemas.get(propertyPathToItem) + if (schemas == null) { + throw RuntimeException("Validation result is invalid, schemas must exist for a pathToItem") + } + val propertySchema: JsonSchema<*> = schemas.entries.iterator().next().key + val propertyInstance: Any? = propertySchema.getNewInstance(value, propertyPathToItem, pathToSchemas) + properties[propertyName] = propertyInstance + } + val castProperties: FrozenMap = FrozenMap(properties) + return castProperties + } + + @Throws(ValidationException::class) + override fun validate(arg: Map<*, *>, configuration: SchemaConfiguration?): FrozenMap { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validatedPathToSchemas = PathToSchemasMap() + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, LinkedHashSet()) + val pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet) + return getNewInstance(castArg, validationMetadata.pathToItem, pathToSchemasMap) + } + + @Throws(ValidationException::class) + override fun validate(arg: Any?, configuration: SchemaConfiguration?): Any? { + if (arg == null) { + return validate(null, configuration) + } else if (arg is Boolean) { + return validate(arg, configuration) + } else if (arg is Number) { + return validate(arg, configuration) + } else if (arg is String) { + return validate(arg, configuration) + } else if (arg is List<*>) { + return validate(arg, configuration) + } else if (arg is Map<*, *>) { + return validate(arg, configuration) + } + throw ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema") + } + override fun getNewInstance(arg: Any?, pathToItem: List, pathToSchemas: PathToSchemasMap): Any? { + if (arg == null) { + return getNewInstance( null, pathToItem, pathToSchemas) + } else if (arg is Boolean) { + return getNewInstance(arg, pathToItem, pathToSchemas) + } else if (arg is Number) { + return getNewInstance(arg, pathToItem, pathToSchemas) + } else if (arg is String) { + return getNewInstance(arg, pathToItem, pathToSchemas) + } else if (arg is List<*>) { + return getNewInstance(arg, pathToItem, pathToSchemas) + } else if (arg is Map<*, *>) { + return getNewInstance(arg, pathToItem, pathToSchemas) + } + throw RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema") + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: Nothing?, configuration: SchemaConfiguration?): AllofWithTwoEmptySchemas1BoxedVoid { + return AllofWithTwoEmptySchemas1BoxedVoid(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: Boolean, configuration: SchemaConfiguration?): AllofWithTwoEmptySchemas1BoxedBoolean { + return AllofWithTwoEmptySchemas1BoxedBoolean(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: Number, configuration: SchemaConfiguration?): AllofWithTwoEmptySchemas1BoxedNumber { + return AllofWithTwoEmptySchemas1BoxedNumber(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: String, configuration: SchemaConfiguration?): AllofWithTwoEmptySchemas1BoxedString { + return AllofWithTwoEmptySchemas1BoxedString(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: List<*>, configuration: SchemaConfiguration?): AllofWithTwoEmptySchemas1BoxedList { + return AllofWithTwoEmptySchemas1BoxedList(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: Map<*, *>, configuration: SchemaConfiguration?): AllofWithTwoEmptySchemas1BoxedMap { + return AllofWithTwoEmptySchemas1BoxedMap(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: Any?, configuration: SchemaConfiguration?): AllofWithTwoEmptySchemas1Boxed { + if (arg == null) { + return validateAndBox(null, configuration) + } else if (arg is Boolean) { + return validateAndBox(arg, configuration) + } else if (arg is String) { + return validateAndBox(arg, configuration) + } else if (arg is Number) { + return validateAndBox(arg, configuration) + } else if (arg is List<*>) { + return validateAndBox(arg, configuration) + } else if (arg is Map<*, *>) { + return validateAndBox(arg, configuration) + } + throw ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema") + } + } +} diff --git a/samples/client/3_0_3_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/schemas/Anyof.kt b/samples/client/3_0_3_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/schemas/Anyof.kt new file mode 100644 index 00000000000..c71b31c6ce0 --- /dev/null +++ b/samples/client/3_0_3_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/schemas/Anyof.kt @@ -0,0 +1,600 @@ +package org.openapijsonschematools.client.components.schemas +import java.time.LocalDate +import java.time.ZonedDateTime +import java.util.UUID +import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags +import org.openapijsonschematools.client.configurations.SchemaConfiguration +import org.openapijsonschematools.client.exceptions.InvalidAdditionalPropertyException +import org.openapijsonschematools.client.exceptions.UnsetPropertyException +import org.openapijsonschematools.client.exceptions.ValidationException +import org.openapijsonschematools.client.schemas.IntJsonSchema +import org.openapijsonschematools.client.schemas.UnsetAddPropsSetter +import org.openapijsonschematools.client.schemas.validation.BooleanSchemaValidator +import org.openapijsonschematools.client.schemas.validation.FrozenList +import org.openapijsonschematools.client.schemas.validation.FrozenMap +import org.openapijsonschematools.client.schemas.validation.JsonSchema +import org.openapijsonschematools.client.schemas.validation.JsonSchemaInfo +import org.openapijsonschematools.client.schemas.validation.ListSchemaValidator +import org.openapijsonschematools.client.schemas.validation.MapSchemaValidator +import org.openapijsonschematools.client.schemas.validation.NullSchemaValidator +import org.openapijsonschematools.client.schemas.validation.NumberSchemaValidator +import org.openapijsonschematools.client.schemas.validation.PathToSchemasMap +import org.openapijsonschematools.client.schemas.validation.StringSchemaValidator +import org.openapijsonschematools.client.schemas.validation.ValidationMetadata + +class Anyof { + // nest classes so all schemas and input/output classes can be public + + + class Schema0 : IntJsonSchema.IntJsonSchema1() { + companion object { + @Volatile + private var instance: Schema0? = null + + fun getInstance() = + instance ?: synchronized(this) { + instance ?: Schema0().also { instance = it } + } + } + } + + + sealed interface Schema1Boxed { + fun getData(): Any? + } + + data class Schema1BoxedVoid(val data: Nothing?) : Schema1Boxed { + override fun getData(): Any? { + return data + } + } + + data class Schema1BoxedBoolean(val data: Boolean): Schema1Boxed { + override fun getData(): Any? { + return data + } + } + + data class Schema1BoxedNumber(val data: Number) : Schema1Boxed { + override fun getData(): Any? { + return data + } + } + + data class Schema1BoxedString(val data: String) : Schema1Boxed { + override fun getData(): Any? { + return data + } + } + + data class Schema1BoxedList(val data: FrozenList) : Schema1Boxed { + override fun getData(): Any? { + return data + } + } + + data class Schema1BoxedMap(val data: FrozenMap) : Schema1Boxed { + override fun getData(): Any? { + return data + } + } + + + class Schema1 private constructor(): JsonSchema( + JsonSchemaInfo() + .minimum(2) + ), NullSchemaValidator, BooleanSchemaValidator, NumberSchemaValidator, StringSchemaValidator, ListSchemaValidator, Schema1BoxedList>, MapSchemaValidator, Schema1BoxedMap> { + + companion object { + @Volatile + private var instance: Schema1? = null + + fun getInstance() = + instance ?: synchronized(this) { + instance ?: Schema1().also { instance = it } + } + } + + @Throws(ValidationException::class) + override fun validate(arg: Nothing?, configuration: SchemaConfiguration?): Nothing? { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validatedPathToSchemas = PathToSchemasMap() + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, LinkedHashSet()) + getPathToSchemas(this, castArg, validationMetadata, pathSet) + return castArg + } + + @Throws(ValidationException::class) + override fun validate(arg: Boolean, configuration: SchemaConfiguration?): Boolean { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validatedPathToSchemas = PathToSchemasMap() + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, LinkedHashSet()) + getPathToSchemas(this, castArg, validationMetadata, pathSet) + return castArg + } + + @Throws(ValidationException::class) + override fun validate(arg: Number, configuration: SchemaConfiguration?): Number { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validatedPathToSchemas = PathToSchemasMap() + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, LinkedHashSet()) + getPathToSchemas(this, castArg, validationMetadata, pathSet) + return castArg + } + + @Throws(ValidationException::class) + fun validate(arg: Int, configuration: SchemaConfiguration?): Int { + return validate(arg as Number, configuration) as Int + } + + @Throws(ValidationException::class) + fun validate(arg: Long, configuration: SchemaConfiguration?): Long { + return validate(arg as Number, configuration) as Long + } + + @Throws(ValidationException::class) + fun validate(arg: Float, configuration: SchemaConfiguration?): Float { + return validate(arg as Number, configuration) as Float + } + + @Throws(ValidationException::class) + fun validate(arg: Double, configuration: SchemaConfiguration?): Double { + return validate(arg as Number, configuration) as Double + } + + @Throws(ValidationException::class) + override fun validate(arg: String, configuration: SchemaConfiguration?): String { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validatedPathToSchemas = PathToSchemasMap() + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, LinkedHashSet()) + getPathToSchemas(this, castArg, validationMetadata, pathSet) + return castArg + } + + @Throws(ValidationException::class) + fun validate(arg: LocalDate, configuration: SchemaConfiguration?): String { + return validate(arg.toString(), configuration) + } + + @Throws(ValidationException::class) + fun validate(arg: ZonedDateTime, configuration: SchemaConfiguration?): String { + return validate(arg.toString(), configuration) + } + + @Throws(ValidationException::class) + fun validate(arg: UUID, configuration: SchemaConfiguration?): String { + return validate(arg.toString(), configuration) + } + + override fun getNewInstance(arg: List<*>, pathToItem: List, pathToSchemas: PathToSchemasMap): FrozenList { + val items: MutableList = ArrayList() + var i: Int = 0 + for (item: Any? in arg) { + val itemPathToItem = pathToItem + i + val schemas: LinkedHashMap, Nothing?>? = pathToSchemas.get(itemPathToItem) + if (schemas == null) { + throw RuntimeException("Validation result is invalid, schemas must exist for a pathToItem") + } + val itemSchema: JsonSchema<*> = schemas.entries.iterator().next().key + val itemInstance: Any? = itemSchema.getNewInstance(item, itemPathToItem, pathToSchemas) + items.add(itemInstance) + i += 1 + } + val newInstanceItems: FrozenList = FrozenList(items) + return newInstanceItems + } + + @Throws(ValidationException::class) + override fun validate(arg: List<*>, configuration: SchemaConfiguration?): FrozenList { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, PathToSchemasMap(), LinkedHashSet()) + val pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet) + return getNewInstance(castArg, validationMetadata.pathToItem, pathToSchemasMap) + } + + override fun getNewInstance(arg: Map<*, *>, pathToItem: List, pathToSchemas: PathToSchemasMap): FrozenMap { + val properties: LinkedHashMap = LinkedHashMap() + for((propertyName, value) in arg) { + if (!(propertyName is String)) { + throw RuntimeException("Invalid non-string key value") + } + val propertyPathToItem: List = pathToItem + propertyName + val schemas: LinkedHashMap, Nothing?>? = pathToSchemas.get(propertyPathToItem) + if (schemas == null) { + throw RuntimeException("Validation result is invalid, schemas must exist for a pathToItem") + } + val propertySchema: JsonSchema<*> = schemas.entries.iterator().next().key + val propertyInstance: Any? = propertySchema.getNewInstance(value, propertyPathToItem, pathToSchemas) + properties[propertyName] = propertyInstance + } + val castProperties: FrozenMap = FrozenMap(properties) + return castProperties + } + + @Throws(ValidationException::class) + override fun validate(arg: Map<*, *>, configuration: SchemaConfiguration?): FrozenMap { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validatedPathToSchemas = PathToSchemasMap() + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, LinkedHashSet()) + val pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet) + return getNewInstance(castArg, validationMetadata.pathToItem, pathToSchemasMap) + } + + @Throws(ValidationException::class) + override fun validate(arg: Any?, configuration: SchemaConfiguration?): Any? { + if (arg == null) { + return validate(null, configuration) + } else if (arg is Boolean) { + return validate(arg, configuration) + } else if (arg is Number) { + return validate(arg, configuration) + } else if (arg is String) { + return validate(arg, configuration) + } else if (arg is List<*>) { + return validate(arg, configuration) + } else if (arg is Map<*, *>) { + return validate(arg, configuration) + } + throw ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema") + } + override fun getNewInstance(arg: Any?, pathToItem: List, pathToSchemas: PathToSchemasMap): Any? { + if (arg == null) { + return getNewInstance( null, pathToItem, pathToSchemas) + } else if (arg is Boolean) { + return getNewInstance(arg, pathToItem, pathToSchemas) + } else if (arg is Number) { + return getNewInstance(arg, pathToItem, pathToSchemas) + } else if (arg is String) { + return getNewInstance(arg, pathToItem, pathToSchemas) + } else if (arg is List<*>) { + return getNewInstance(arg, pathToItem, pathToSchemas) + } else if (arg is Map<*, *>) { + return getNewInstance(arg, pathToItem, pathToSchemas) + } + throw RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema") + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: Nothing?, configuration: SchemaConfiguration?): Schema1BoxedVoid { + return Schema1BoxedVoid(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: Boolean, configuration: SchemaConfiguration?): Schema1BoxedBoolean { + return Schema1BoxedBoolean(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: Number, configuration: SchemaConfiguration?): Schema1BoxedNumber { + return Schema1BoxedNumber(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: String, configuration: SchemaConfiguration?): Schema1BoxedString { + return Schema1BoxedString(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: List<*>, configuration: SchemaConfiguration?): Schema1BoxedList { + return Schema1BoxedList(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: Map<*, *>, configuration: SchemaConfiguration?): Schema1BoxedMap { + return Schema1BoxedMap(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: Any?, configuration: SchemaConfiguration?): Schema1Boxed { + if (arg == null) { + return validateAndBox(null, configuration) + } else if (arg is Boolean) { + return validateAndBox(arg, configuration) + } else if (arg is String) { + return validateAndBox(arg, configuration) + } else if (arg is Number) { + return validateAndBox(arg, configuration) + } else if (arg is List<*>) { + return validateAndBox(arg, configuration) + } else if (arg is Map<*, *>) { + return validateAndBox(arg, configuration) + } + throw ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema") + } + } + + sealed interface Anyof1Boxed { + fun getData(): Any? + } + + data class Anyof1BoxedVoid(val data: Nothing?) : Anyof1Boxed { + override fun getData(): Any? { + return data + } + } + + data class Anyof1BoxedBoolean(val data: Boolean): Anyof1Boxed { + override fun getData(): Any? { + return data + } + } + + data class Anyof1BoxedNumber(val data: Number) : Anyof1Boxed { + override fun getData(): Any? { + return data + } + } + + data class Anyof1BoxedString(val data: String) : Anyof1Boxed { + override fun getData(): Any? { + return data + } + } + + data class Anyof1BoxedList(val data: FrozenList) : Anyof1Boxed { + override fun getData(): Any? { + return data + } + } + + data class Anyof1BoxedMap(val data: FrozenMap) : Anyof1Boxed { + override fun getData(): Any? { + return data + } + } + + + class Anyof1 private constructor(): JsonSchema( + JsonSchemaInfo() + .anyOf(listOf( + Schema0::class.java, + Schema1::class.java + )) + ), NullSchemaValidator, BooleanSchemaValidator, NumberSchemaValidator, StringSchemaValidator, ListSchemaValidator, Anyof1BoxedList>, MapSchemaValidator, Anyof1BoxedMap> { + /* + NOTE: This class is auto generated by OpenAPI JSON Schema Generator. + Ref: https://github.com/openapi-json-schema-tools/openapi-json-schema-generator + + Do not edit the class manually. + */ + + companion object { + @Volatile + private var instance: Anyof1? = null + + fun getInstance() = + instance ?: synchronized(this) { + instance ?: Anyof1().also { instance = it } + } + } + + @Throws(ValidationException::class) + override fun validate(arg: Nothing?, configuration: SchemaConfiguration?): Nothing? { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validatedPathToSchemas = PathToSchemasMap() + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, LinkedHashSet()) + getPathToSchemas(this, castArg, validationMetadata, pathSet) + return castArg + } + + @Throws(ValidationException::class) + override fun validate(arg: Boolean, configuration: SchemaConfiguration?): Boolean { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validatedPathToSchemas = PathToSchemasMap() + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, LinkedHashSet()) + getPathToSchemas(this, castArg, validationMetadata, pathSet) + return castArg + } + + @Throws(ValidationException::class) + override fun validate(arg: Number, configuration: SchemaConfiguration?): Number { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validatedPathToSchemas = PathToSchemasMap() + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, LinkedHashSet()) + getPathToSchemas(this, castArg, validationMetadata, pathSet) + return castArg + } + + @Throws(ValidationException::class) + fun validate(arg: Int, configuration: SchemaConfiguration?): Int { + return validate(arg as Number, configuration) as Int + } + + @Throws(ValidationException::class) + fun validate(arg: Long, configuration: SchemaConfiguration?): Long { + return validate(arg as Number, configuration) as Long + } + + @Throws(ValidationException::class) + fun validate(arg: Float, configuration: SchemaConfiguration?): Float { + return validate(arg as Number, configuration) as Float + } + + @Throws(ValidationException::class) + fun validate(arg: Double, configuration: SchemaConfiguration?): Double { + return validate(arg as Number, configuration) as Double + } + + @Throws(ValidationException::class) + override fun validate(arg: String, configuration: SchemaConfiguration?): String { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validatedPathToSchemas = PathToSchemasMap() + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, LinkedHashSet()) + getPathToSchemas(this, castArg, validationMetadata, pathSet) + return castArg + } + + @Throws(ValidationException::class) + fun validate(arg: LocalDate, configuration: SchemaConfiguration?): String { + return validate(arg.toString(), configuration) + } + + @Throws(ValidationException::class) + fun validate(arg: ZonedDateTime, configuration: SchemaConfiguration?): String { + return validate(arg.toString(), configuration) + } + + @Throws(ValidationException::class) + fun validate(arg: UUID, configuration: SchemaConfiguration?): String { + return validate(arg.toString(), configuration) + } + + override fun getNewInstance(arg: List<*>, pathToItem: List, pathToSchemas: PathToSchemasMap): FrozenList { + val items: MutableList = ArrayList() + var i: Int = 0 + for (item: Any? in arg) { + val itemPathToItem = pathToItem + i + val schemas: LinkedHashMap, Nothing?>? = pathToSchemas.get(itemPathToItem) + if (schemas == null) { + throw RuntimeException("Validation result is invalid, schemas must exist for a pathToItem") + } + val itemSchema: JsonSchema<*> = schemas.entries.iterator().next().key + val itemInstance: Any? = itemSchema.getNewInstance(item, itemPathToItem, pathToSchemas) + items.add(itemInstance) + i += 1 + } + val newInstanceItems: FrozenList = FrozenList(items) + return newInstanceItems + } + + @Throws(ValidationException::class) + override fun validate(arg: List<*>, configuration: SchemaConfiguration?): FrozenList { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, PathToSchemasMap(), LinkedHashSet()) + val pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet) + return getNewInstance(castArg, validationMetadata.pathToItem, pathToSchemasMap) + } + + override fun getNewInstance(arg: Map<*, *>, pathToItem: List, pathToSchemas: PathToSchemasMap): FrozenMap { + val properties: LinkedHashMap = LinkedHashMap() + for((propertyName, value) in arg) { + if (!(propertyName is String)) { + throw RuntimeException("Invalid non-string key value") + } + val propertyPathToItem: List = pathToItem + propertyName + val schemas: LinkedHashMap, Nothing?>? = pathToSchemas.get(propertyPathToItem) + if (schemas == null) { + throw RuntimeException("Validation result is invalid, schemas must exist for a pathToItem") + } + val propertySchema: JsonSchema<*> = schemas.entries.iterator().next().key + val propertyInstance: Any? = propertySchema.getNewInstance(value, propertyPathToItem, pathToSchemas) + properties[propertyName] = propertyInstance + } + val castProperties: FrozenMap = FrozenMap(properties) + return castProperties + } + + @Throws(ValidationException::class) + override fun validate(arg: Map<*, *>, configuration: SchemaConfiguration?): FrozenMap { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validatedPathToSchemas = PathToSchemasMap() + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, LinkedHashSet()) + val pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet) + return getNewInstance(castArg, validationMetadata.pathToItem, pathToSchemasMap) + } + + @Throws(ValidationException::class) + override fun validate(arg: Any?, configuration: SchemaConfiguration?): Any? { + if (arg == null) { + return validate(null, configuration) + } else if (arg is Boolean) { + return validate(arg, configuration) + } else if (arg is Number) { + return validate(arg, configuration) + } else if (arg is String) { + return validate(arg, configuration) + } else if (arg is List<*>) { + return validate(arg, configuration) + } else if (arg is Map<*, *>) { + return validate(arg, configuration) + } + throw ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema") + } + override fun getNewInstance(arg: Any?, pathToItem: List, pathToSchemas: PathToSchemasMap): Any? { + if (arg == null) { + return getNewInstance( null, pathToItem, pathToSchemas) + } else if (arg is Boolean) { + return getNewInstance(arg, pathToItem, pathToSchemas) + } else if (arg is Number) { + return getNewInstance(arg, pathToItem, pathToSchemas) + } else if (arg is String) { + return getNewInstance(arg, pathToItem, pathToSchemas) + } else if (arg is List<*>) { + return getNewInstance(arg, pathToItem, pathToSchemas) + } else if (arg is Map<*, *>) { + return getNewInstance(arg, pathToItem, pathToSchemas) + } + throw RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema") + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: Nothing?, configuration: SchemaConfiguration?): Anyof1BoxedVoid { + return Anyof1BoxedVoid(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: Boolean, configuration: SchemaConfiguration?): Anyof1BoxedBoolean { + return Anyof1BoxedBoolean(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: Number, configuration: SchemaConfiguration?): Anyof1BoxedNumber { + return Anyof1BoxedNumber(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: String, configuration: SchemaConfiguration?): Anyof1BoxedString { + return Anyof1BoxedString(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: List<*>, configuration: SchemaConfiguration?): Anyof1BoxedList { + return Anyof1BoxedList(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: Map<*, *>, configuration: SchemaConfiguration?): Anyof1BoxedMap { + return Anyof1BoxedMap(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: Any?, configuration: SchemaConfiguration?): Anyof1Boxed { + if (arg == null) { + return validateAndBox(null, configuration) + } else if (arg is Boolean) { + return validateAndBox(arg, configuration) + } else if (arg is String) { + return validateAndBox(arg, configuration) + } else if (arg is Number) { + return validateAndBox(arg, configuration) + } else if (arg is List<*>) { + return validateAndBox(arg, configuration) + } else if (arg is Map<*, *>) { + return validateAndBox(arg, configuration) + } + throw ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema") + } + } +} diff --git a/samples/client/3_0_3_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/schemas/AnyofComplexTypes.kt b/samples/client/3_0_3_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/schemas/AnyofComplexTypes.kt new file mode 100644 index 00000000000..8abf0c0c3cb --- /dev/null +++ b/samples/client/3_0_3_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/schemas/AnyofComplexTypes.kt @@ -0,0 +1,1060 @@ +package org.openapijsonschematools.client.components.schemas +import java.time.LocalDate +import java.time.ZonedDateTime +import java.util.UUID +import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags +import org.openapijsonschematools.client.configurations.SchemaConfiguration +import org.openapijsonschematools.client.exceptions.InvalidAdditionalPropertyException +import org.openapijsonschematools.client.exceptions.UnsetPropertyException +import org.openapijsonschematools.client.exceptions.ValidationException +import org.openapijsonschematools.client.schemas.GenericBuilder +import org.openapijsonschematools.client.schemas.IntJsonSchema +import org.openapijsonschematools.client.schemas.StringJsonSchema +import org.openapijsonschematools.client.schemas.UnsetAddPropsSetter +import org.openapijsonschematools.client.schemas.validation.BooleanSchemaValidator +import org.openapijsonschematools.client.schemas.validation.FrozenList +import org.openapijsonschematools.client.schemas.validation.FrozenMap +import org.openapijsonschematools.client.schemas.validation.JsonSchema +import org.openapijsonschematools.client.schemas.validation.JsonSchemaInfo +import org.openapijsonschematools.client.schemas.validation.ListSchemaValidator +import org.openapijsonschematools.client.schemas.validation.MapSchemaValidator +import org.openapijsonschematools.client.schemas.validation.NullSchemaValidator +import org.openapijsonschematools.client.schemas.validation.NumberSchemaValidator +import org.openapijsonschematools.client.schemas.validation.PathToSchemasMap +import org.openapijsonschematools.client.schemas.validation.StringSchemaValidator +import org.openapijsonschematools.client.schemas.validation.ValidationMetadata + +class AnyofComplexTypes { + // nest classes so all schemas and input/output classes can be public + + + class Bar : IntJsonSchema.IntJsonSchema1() { + companion object { + @Volatile + private var instance: Bar? = null + + fun getInstance() = + instance ?: synchronized(this) { + instance ?: Bar().also { instance = it } + } + } + } + + + class Schema0Map(m: FrozenMap) : FrozenMap(m) { + companion object { + val requiredKeys: Set = setOf( + "bar" + ) + val optionalKeys: Set = setOf() + @Throws(ValidationException::class) + fun of(arg: Map, configuration: SchemaConfiguration): Schema0Map { + return Schema0.getInstance().validate(arg, configuration) + } + } + + fun bar(): Number { + val value: Any? = get("bar") + if (!(value is Number)) { + throw RuntimeException("Invalid value stored for bar") + } + return value + } + + @Throws(UnsetPropertyException::class, InvalidAdditionalPropertyException::class) + fun getAdditionalProperty(name: String): Any? { + throwIfKeyKnown(name, requiredKeys, optionalKeys) + throwIfKeyNotPresent(name) + return get(name) + } + } + + interface SetterForBar { + fun getInstance(): MutableMap + fun getBuilderAfterBar(instance: MutableMap): T + + fun bar(value: Int): T { + val instance = getInstance() + instance["bar"] = value + return getBuilderAfterBar(instance) + } + + fun bar(value: Float): T { + val instance = getInstance() + instance["bar"] = value + return getBuilderAfterBar(instance) + } + + fun bar(value: Long): T { + val instance = getInstance() + instance["bar"] = value + return getBuilderAfterBar(instance) + } + + fun bar(value: Double): T { + val instance = getInstance() + instance["bar"] = value + return getBuilderAfterBar(instance) + } + } + + class Schema0Map0Builder(private val instance: MutableMap): UnsetAddPropsSetter, GenericBuilder> { + private val knownKeys: Set = setOf( + "bar" + ) + override fun getKnownKeys(): Set { + return knownKeys + } + override fun build(): Map { + return instance + } + override fun getInstance(): MutableMap { + return instance + } + override fun getBuilderAfterAdditionalProperty(instance: MutableMap): Schema0Map0Builder { + return this + } + } + + class Schema0MapBuilder: SetterForBar { + private val instance: MutableMap + init { + this.instance = LinkedHashMap() + } + override fun getInstance(): MutableMap { + return instance + } + override fun getBuilderAfterBar(instance: MutableMap): Schema0Map0Builder { + return Schema0Map0Builder(instance) + } + } + + + sealed interface Schema0Boxed { + fun getData(): Any? + } + + data class Schema0BoxedVoid(val data: Nothing?) : Schema0Boxed { + override fun getData(): Any? { + return data + } + } + + data class Schema0BoxedBoolean(val data: Boolean): Schema0Boxed { + override fun getData(): Any? { + return data + } + } + + data class Schema0BoxedNumber(val data: Number) : Schema0Boxed { + override fun getData(): Any? { + return data + } + } + + data class Schema0BoxedString(val data: String) : Schema0Boxed { + override fun getData(): Any? { + return data + } + } + + data class Schema0BoxedList(val data: FrozenList) : Schema0Boxed { + override fun getData(): Any? { + return data + } + } + + data class Schema0BoxedMap(val data: Schema0Map) : Schema0Boxed { + override fun getData(): Any? { + return data + } + } + + + class Schema0 private constructor(): JsonSchema( + JsonSchemaInfo() + .properties(mapOf( + "bar" to Bar::class.java + )) + .required(setOf( + "bar" + )) + ), NullSchemaValidator, BooleanSchemaValidator, NumberSchemaValidator, StringSchemaValidator, ListSchemaValidator, Schema0BoxedList>, MapSchemaValidator { + + companion object { + @Volatile + private var instance: Schema0? = null + + fun getInstance() = + instance ?: synchronized(this) { + instance ?: Schema0().also { instance = it } + } + } + + @Throws(ValidationException::class) + override fun validate(arg: Nothing?, configuration: SchemaConfiguration?): Nothing? { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validatedPathToSchemas = PathToSchemasMap() + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, LinkedHashSet()) + getPathToSchemas(this, castArg, validationMetadata, pathSet) + return castArg + } + + @Throws(ValidationException::class) + override fun validate(arg: Boolean, configuration: SchemaConfiguration?): Boolean { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validatedPathToSchemas = PathToSchemasMap() + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, LinkedHashSet()) + getPathToSchemas(this, castArg, validationMetadata, pathSet) + return castArg + } + + @Throws(ValidationException::class) + override fun validate(arg: Number, configuration: SchemaConfiguration?): Number { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validatedPathToSchemas = PathToSchemasMap() + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, LinkedHashSet()) + getPathToSchemas(this, castArg, validationMetadata, pathSet) + return castArg + } + + @Throws(ValidationException::class) + fun validate(arg: Int, configuration: SchemaConfiguration?): Int { + return validate(arg as Number, configuration) as Int + } + + @Throws(ValidationException::class) + fun validate(arg: Long, configuration: SchemaConfiguration?): Long { + return validate(arg as Number, configuration) as Long + } + + @Throws(ValidationException::class) + fun validate(arg: Float, configuration: SchemaConfiguration?): Float { + return validate(arg as Number, configuration) as Float + } + + @Throws(ValidationException::class) + fun validate(arg: Double, configuration: SchemaConfiguration?): Double { + return validate(arg as Number, configuration) as Double + } + + @Throws(ValidationException::class) + override fun validate(arg: String, configuration: SchemaConfiguration?): String { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validatedPathToSchemas = PathToSchemasMap() + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, LinkedHashSet()) + getPathToSchemas(this, castArg, validationMetadata, pathSet) + return castArg + } + + @Throws(ValidationException::class) + fun validate(arg: LocalDate, configuration: SchemaConfiguration?): String { + return validate(arg.toString(), configuration) + } + + @Throws(ValidationException::class) + fun validate(arg: ZonedDateTime, configuration: SchemaConfiguration?): String { + return validate(arg.toString(), configuration) + } + + @Throws(ValidationException::class) + fun validate(arg: UUID, configuration: SchemaConfiguration?): String { + return validate(arg.toString(), configuration) + } + + override fun getNewInstance(arg: List<*>, pathToItem: List, pathToSchemas: PathToSchemasMap): FrozenList { + val items: MutableList = ArrayList() + var i: Int = 0 + for (item: Any? in arg) { + val itemPathToItem = pathToItem + i + val schemas: LinkedHashMap, Nothing?>? = pathToSchemas.get(itemPathToItem) + if (schemas == null) { + throw RuntimeException("Validation result is invalid, schemas must exist for a pathToItem") + } + val itemSchema: JsonSchema<*> = schemas.entries.iterator().next().key + val itemInstance: Any? = itemSchema.getNewInstance(item, itemPathToItem, pathToSchemas) + items.add(itemInstance) + i += 1 + } + val newInstanceItems: FrozenList = FrozenList(items) + return newInstanceItems + } + + @Throws(ValidationException::class) + override fun validate(arg: List<*>, configuration: SchemaConfiguration?): FrozenList { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, PathToSchemasMap(), LinkedHashSet()) + val pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet) + return getNewInstance(castArg, validationMetadata.pathToItem, pathToSchemasMap) + } + + override fun getNewInstance(arg: Map<*, *>, pathToItem: List, pathToSchemas: PathToSchemasMap): Schema0Map { + val properties: LinkedHashMap = LinkedHashMap() + for((propertyName, value) in arg) { + if (!(propertyName is String)) { + throw RuntimeException("Invalid non-string key value") + } + val propertyPathToItem: List = pathToItem + propertyName + val schemas: LinkedHashMap, Nothing?>? = pathToSchemas.get(propertyPathToItem) + if (schemas == null) { + throw RuntimeException("Validation result is invalid, schemas must exist for a pathToItem") + } + val propertySchema: JsonSchema<*> = schemas.entries.iterator().next().key + val propertyInstance: Any? = propertySchema.getNewInstance(value, propertyPathToItem, pathToSchemas) + properties[propertyName] = propertyInstance + } + val castProperties: FrozenMap = FrozenMap(properties) + return Schema0Map(castProperties) + } + + @Throws(ValidationException::class) + override fun validate(arg: Map<*, *>, configuration: SchemaConfiguration?): Schema0Map { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validatedPathToSchemas = PathToSchemasMap() + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, LinkedHashSet()) + val pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet) + return getNewInstance(castArg, validationMetadata.pathToItem, pathToSchemasMap) + } + + @Throws(ValidationException::class) + override fun validate(arg: Any?, configuration: SchemaConfiguration?): Any? { + if (arg == null) { + return validate(null, configuration) + } else if (arg is Boolean) { + return validate(arg, configuration) + } else if (arg is Number) { + return validate(arg, configuration) + } else if (arg is String) { + return validate(arg, configuration) + } else if (arg is List<*>) { + return validate(arg, configuration) + } else if (arg is Map<*, *>) { + return validate(arg, configuration) + } + throw ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema") + } + override fun getNewInstance(arg: Any?, pathToItem: List, pathToSchemas: PathToSchemasMap): Any? { + if (arg == null) { + return getNewInstance( null, pathToItem, pathToSchemas) + } else if (arg is Boolean) { + return getNewInstance(arg, pathToItem, pathToSchemas) + } else if (arg is Number) { + return getNewInstance(arg, pathToItem, pathToSchemas) + } else if (arg is String) { + return getNewInstance(arg, pathToItem, pathToSchemas) + } else if (arg is List<*>) { + return getNewInstance(arg, pathToItem, pathToSchemas) + } else if (arg is Map<*, *>) { + return getNewInstance(arg, pathToItem, pathToSchemas) + } + throw RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema") + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: Nothing?, configuration: SchemaConfiguration?): Schema0BoxedVoid { + return Schema0BoxedVoid(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: Boolean, configuration: SchemaConfiguration?): Schema0BoxedBoolean { + return Schema0BoxedBoolean(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: Number, configuration: SchemaConfiguration?): Schema0BoxedNumber { + return Schema0BoxedNumber(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: String, configuration: SchemaConfiguration?): Schema0BoxedString { + return Schema0BoxedString(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: List<*>, configuration: SchemaConfiguration?): Schema0BoxedList { + return Schema0BoxedList(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: Map<*, *>, configuration: SchemaConfiguration?): Schema0BoxedMap { + return Schema0BoxedMap(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: Any?, configuration: SchemaConfiguration?): Schema0Boxed { + if (arg == null) { + return validateAndBox(null, configuration) + } else if (arg is Boolean) { + return validateAndBox(arg, configuration) + } else if (arg is String) { + return validateAndBox(arg, configuration) + } else if (arg is Number) { + return validateAndBox(arg, configuration) + } else if (arg is List<*>) { + return validateAndBox(arg, configuration) + } else if (arg is Map<*, *>) { + return validateAndBox(arg, configuration) + } + throw ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema") + } + } + + class Foo : StringJsonSchema.StringJsonSchema1() { + companion object { + @Volatile + private var instance: Foo? = null + + fun getInstance() = + instance ?: synchronized(this) { + instance ?: Foo().also { instance = it } + } + } + } + + + class Schema1Map(m: FrozenMap) : FrozenMap(m) { + companion object { + val requiredKeys: Set = setOf( + "foo" + ) + val optionalKeys: Set = setOf() + @Throws(ValidationException::class) + fun of(arg: Map, configuration: SchemaConfiguration): Schema1Map { + return Schema1.getInstance().validate(arg, configuration) + } + } + + fun foo(): String { + val value: Any? = get("foo") + if (!(value is String)) { + throw RuntimeException("Invalid value stored for foo") + } + return value + } + + @Throws(UnsetPropertyException::class, InvalidAdditionalPropertyException::class) + fun getAdditionalProperty(name: String): Any? { + throwIfKeyKnown(name, requiredKeys, optionalKeys) + throwIfKeyNotPresent(name) + return get(name) + } + } + + interface SetterForFoo { + fun getInstance(): MutableMap + fun getBuilderAfterFoo(instance: MutableMap): T + + fun foo(value: String): T { + val instance = getInstance() + instance["foo"] = value + return getBuilderAfterFoo(instance) + } + } + + class Schema1Map0Builder(private val instance: MutableMap): UnsetAddPropsSetter, GenericBuilder> { + private val knownKeys: Set = setOf( + "foo" + ) + override fun getKnownKeys(): Set { + return knownKeys + } + override fun build(): Map { + return instance + } + override fun getInstance(): MutableMap { + return instance + } + override fun getBuilderAfterAdditionalProperty(instance: MutableMap): Schema1Map0Builder { + return this + } + } + + class Schema1MapBuilder: SetterForFoo { + private val instance: MutableMap + init { + this.instance = LinkedHashMap() + } + override fun getInstance(): MutableMap { + return instance + } + override fun getBuilderAfterFoo(instance: MutableMap): Schema1Map0Builder { + return Schema1Map0Builder(instance) + } + } + + + sealed interface Schema1Boxed { + fun getData(): Any? + } + + data class Schema1BoxedVoid(val data: Nothing?) : Schema1Boxed { + override fun getData(): Any? { + return data + } + } + + data class Schema1BoxedBoolean(val data: Boolean): Schema1Boxed { + override fun getData(): Any? { + return data + } + } + + data class Schema1BoxedNumber(val data: Number) : Schema1Boxed { + override fun getData(): Any? { + return data + } + } + + data class Schema1BoxedString(val data: String) : Schema1Boxed { + override fun getData(): Any? { + return data + } + } + + data class Schema1BoxedList(val data: FrozenList) : Schema1Boxed { + override fun getData(): Any? { + return data + } + } + + data class Schema1BoxedMap(val data: Schema1Map) : Schema1Boxed { + override fun getData(): Any? { + return data + } + } + + + class Schema1 private constructor(): JsonSchema( + JsonSchemaInfo() + .properties(mapOf( + "foo" to Foo::class.java + )) + .required(setOf( + "foo" + )) + ), NullSchemaValidator, BooleanSchemaValidator, NumberSchemaValidator, StringSchemaValidator, ListSchemaValidator, Schema1BoxedList>, MapSchemaValidator { + + companion object { + @Volatile + private var instance: Schema1? = null + + fun getInstance() = + instance ?: synchronized(this) { + instance ?: Schema1().also { instance = it } + } + } + + @Throws(ValidationException::class) + override fun validate(arg: Nothing?, configuration: SchemaConfiguration?): Nothing? { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validatedPathToSchemas = PathToSchemasMap() + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, LinkedHashSet()) + getPathToSchemas(this, castArg, validationMetadata, pathSet) + return castArg + } + + @Throws(ValidationException::class) + override fun validate(arg: Boolean, configuration: SchemaConfiguration?): Boolean { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validatedPathToSchemas = PathToSchemasMap() + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, LinkedHashSet()) + getPathToSchemas(this, castArg, validationMetadata, pathSet) + return castArg + } + + @Throws(ValidationException::class) + override fun validate(arg: Number, configuration: SchemaConfiguration?): Number { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validatedPathToSchemas = PathToSchemasMap() + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, LinkedHashSet()) + getPathToSchemas(this, castArg, validationMetadata, pathSet) + return castArg + } + + @Throws(ValidationException::class) + fun validate(arg: Int, configuration: SchemaConfiguration?): Int { + return validate(arg as Number, configuration) as Int + } + + @Throws(ValidationException::class) + fun validate(arg: Long, configuration: SchemaConfiguration?): Long { + return validate(arg as Number, configuration) as Long + } + + @Throws(ValidationException::class) + fun validate(arg: Float, configuration: SchemaConfiguration?): Float { + return validate(arg as Number, configuration) as Float + } + + @Throws(ValidationException::class) + fun validate(arg: Double, configuration: SchemaConfiguration?): Double { + return validate(arg as Number, configuration) as Double + } + + @Throws(ValidationException::class) + override fun validate(arg: String, configuration: SchemaConfiguration?): String { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validatedPathToSchemas = PathToSchemasMap() + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, LinkedHashSet()) + getPathToSchemas(this, castArg, validationMetadata, pathSet) + return castArg + } + + @Throws(ValidationException::class) + fun validate(arg: LocalDate, configuration: SchemaConfiguration?): String { + return validate(arg.toString(), configuration) + } + + @Throws(ValidationException::class) + fun validate(arg: ZonedDateTime, configuration: SchemaConfiguration?): String { + return validate(arg.toString(), configuration) + } + + @Throws(ValidationException::class) + fun validate(arg: UUID, configuration: SchemaConfiguration?): String { + return validate(arg.toString(), configuration) + } + + override fun getNewInstance(arg: List<*>, pathToItem: List, pathToSchemas: PathToSchemasMap): FrozenList { + val items: MutableList = ArrayList() + var i: Int = 0 + for (item: Any? in arg) { + val itemPathToItem = pathToItem + i + val schemas: LinkedHashMap, Nothing?>? = pathToSchemas.get(itemPathToItem) + if (schemas == null) { + throw RuntimeException("Validation result is invalid, schemas must exist for a pathToItem") + } + val itemSchema: JsonSchema<*> = schemas.entries.iterator().next().key + val itemInstance: Any? = itemSchema.getNewInstance(item, itemPathToItem, pathToSchemas) + items.add(itemInstance) + i += 1 + } + val newInstanceItems: FrozenList = FrozenList(items) + return newInstanceItems + } + + @Throws(ValidationException::class) + override fun validate(arg: List<*>, configuration: SchemaConfiguration?): FrozenList { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, PathToSchemasMap(), LinkedHashSet()) + val pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet) + return getNewInstance(castArg, validationMetadata.pathToItem, pathToSchemasMap) + } + + override fun getNewInstance(arg: Map<*, *>, pathToItem: List, pathToSchemas: PathToSchemasMap): Schema1Map { + val properties: LinkedHashMap = LinkedHashMap() + for((propertyName, value) in arg) { + if (!(propertyName is String)) { + throw RuntimeException("Invalid non-string key value") + } + val propertyPathToItem: List = pathToItem + propertyName + val schemas: LinkedHashMap, Nothing?>? = pathToSchemas.get(propertyPathToItem) + if (schemas == null) { + throw RuntimeException("Validation result is invalid, schemas must exist for a pathToItem") + } + val propertySchema: JsonSchema<*> = schemas.entries.iterator().next().key + val propertyInstance: Any? = propertySchema.getNewInstance(value, propertyPathToItem, pathToSchemas) + properties[propertyName] = propertyInstance + } + val castProperties: FrozenMap = FrozenMap(properties) + return Schema1Map(castProperties) + } + + @Throws(ValidationException::class) + override fun validate(arg: Map<*, *>, configuration: SchemaConfiguration?): Schema1Map { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validatedPathToSchemas = PathToSchemasMap() + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, LinkedHashSet()) + val pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet) + return getNewInstance(castArg, validationMetadata.pathToItem, pathToSchemasMap) + } + + @Throws(ValidationException::class) + override fun validate(arg: Any?, configuration: SchemaConfiguration?): Any? { + if (arg == null) { + return validate(null, configuration) + } else if (arg is Boolean) { + return validate(arg, configuration) + } else if (arg is Number) { + return validate(arg, configuration) + } else if (arg is String) { + return validate(arg, configuration) + } else if (arg is List<*>) { + return validate(arg, configuration) + } else if (arg is Map<*, *>) { + return validate(arg, configuration) + } + throw ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema") + } + override fun getNewInstance(arg: Any?, pathToItem: List, pathToSchemas: PathToSchemasMap): Any? { + if (arg == null) { + return getNewInstance( null, pathToItem, pathToSchemas) + } else if (arg is Boolean) { + return getNewInstance(arg, pathToItem, pathToSchemas) + } else if (arg is Number) { + return getNewInstance(arg, pathToItem, pathToSchemas) + } else if (arg is String) { + return getNewInstance(arg, pathToItem, pathToSchemas) + } else if (arg is List<*>) { + return getNewInstance(arg, pathToItem, pathToSchemas) + } else if (arg is Map<*, *>) { + return getNewInstance(arg, pathToItem, pathToSchemas) + } + throw RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema") + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: Nothing?, configuration: SchemaConfiguration?): Schema1BoxedVoid { + return Schema1BoxedVoid(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: Boolean, configuration: SchemaConfiguration?): Schema1BoxedBoolean { + return Schema1BoxedBoolean(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: Number, configuration: SchemaConfiguration?): Schema1BoxedNumber { + return Schema1BoxedNumber(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: String, configuration: SchemaConfiguration?): Schema1BoxedString { + return Schema1BoxedString(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: List<*>, configuration: SchemaConfiguration?): Schema1BoxedList { + return Schema1BoxedList(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: Map<*, *>, configuration: SchemaConfiguration?): Schema1BoxedMap { + return Schema1BoxedMap(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: Any?, configuration: SchemaConfiguration?): Schema1Boxed { + if (arg == null) { + return validateAndBox(null, configuration) + } else if (arg is Boolean) { + return validateAndBox(arg, configuration) + } else if (arg is String) { + return validateAndBox(arg, configuration) + } else if (arg is Number) { + return validateAndBox(arg, configuration) + } else if (arg is List<*>) { + return validateAndBox(arg, configuration) + } else if (arg is Map<*, *>) { + return validateAndBox(arg, configuration) + } + throw ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema") + } + } + + sealed interface AnyofComplexTypes1Boxed { + fun getData(): Any? + } + + data class AnyofComplexTypes1BoxedVoid(val data: Nothing?) : AnyofComplexTypes1Boxed { + override fun getData(): Any? { + return data + } + } + + data class AnyofComplexTypes1BoxedBoolean(val data: Boolean): AnyofComplexTypes1Boxed { + override fun getData(): Any? { + return data + } + } + + data class AnyofComplexTypes1BoxedNumber(val data: Number) : AnyofComplexTypes1Boxed { + override fun getData(): Any? { + return data + } + } + + data class AnyofComplexTypes1BoxedString(val data: String) : AnyofComplexTypes1Boxed { + override fun getData(): Any? { + return data + } + } + + data class AnyofComplexTypes1BoxedList(val data: FrozenList) : AnyofComplexTypes1Boxed { + override fun getData(): Any? { + return data + } + } + + data class AnyofComplexTypes1BoxedMap(val data: FrozenMap) : AnyofComplexTypes1Boxed { + override fun getData(): Any? { + return data + } + } + + + class AnyofComplexTypes1 private constructor(): JsonSchema( + JsonSchemaInfo() + .anyOf(listOf( + Schema0::class.java, + Schema1::class.java + )) + ), NullSchemaValidator, BooleanSchemaValidator, NumberSchemaValidator, StringSchemaValidator, ListSchemaValidator, AnyofComplexTypes1BoxedList>, MapSchemaValidator, AnyofComplexTypes1BoxedMap> { + /* + NOTE: This class is auto generated by OpenAPI JSON Schema Generator. + Ref: https://github.com/openapi-json-schema-tools/openapi-json-schema-generator + + Do not edit the class manually. + */ + + companion object { + @Volatile + private var instance: AnyofComplexTypes1? = null + + fun getInstance() = + instance ?: synchronized(this) { + instance ?: AnyofComplexTypes1().also { instance = it } + } + } + + @Throws(ValidationException::class) + override fun validate(arg: Nothing?, configuration: SchemaConfiguration?): Nothing? { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validatedPathToSchemas = PathToSchemasMap() + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, LinkedHashSet()) + getPathToSchemas(this, castArg, validationMetadata, pathSet) + return castArg + } + + @Throws(ValidationException::class) + override fun validate(arg: Boolean, configuration: SchemaConfiguration?): Boolean { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validatedPathToSchemas = PathToSchemasMap() + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, LinkedHashSet()) + getPathToSchemas(this, castArg, validationMetadata, pathSet) + return castArg + } + + @Throws(ValidationException::class) + override fun validate(arg: Number, configuration: SchemaConfiguration?): Number { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validatedPathToSchemas = PathToSchemasMap() + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, LinkedHashSet()) + getPathToSchemas(this, castArg, validationMetadata, pathSet) + return castArg + } + + @Throws(ValidationException::class) + fun validate(arg: Int, configuration: SchemaConfiguration?): Int { + return validate(arg as Number, configuration) as Int + } + + @Throws(ValidationException::class) + fun validate(arg: Long, configuration: SchemaConfiguration?): Long { + return validate(arg as Number, configuration) as Long + } + + @Throws(ValidationException::class) + fun validate(arg: Float, configuration: SchemaConfiguration?): Float { + return validate(arg as Number, configuration) as Float + } + + @Throws(ValidationException::class) + fun validate(arg: Double, configuration: SchemaConfiguration?): Double { + return validate(arg as Number, configuration) as Double + } + + @Throws(ValidationException::class) + override fun validate(arg: String, configuration: SchemaConfiguration?): String { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validatedPathToSchemas = PathToSchemasMap() + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, LinkedHashSet()) + getPathToSchemas(this, castArg, validationMetadata, pathSet) + return castArg + } + + @Throws(ValidationException::class) + fun validate(arg: LocalDate, configuration: SchemaConfiguration?): String { + return validate(arg.toString(), configuration) + } + + @Throws(ValidationException::class) + fun validate(arg: ZonedDateTime, configuration: SchemaConfiguration?): String { + return validate(arg.toString(), configuration) + } + + @Throws(ValidationException::class) + fun validate(arg: UUID, configuration: SchemaConfiguration?): String { + return validate(arg.toString(), configuration) + } + + override fun getNewInstance(arg: List<*>, pathToItem: List, pathToSchemas: PathToSchemasMap): FrozenList { + val items: MutableList = ArrayList() + var i: Int = 0 + for (item: Any? in arg) { + val itemPathToItem = pathToItem + i + val schemas: LinkedHashMap, Nothing?>? = pathToSchemas.get(itemPathToItem) + if (schemas == null) { + throw RuntimeException("Validation result is invalid, schemas must exist for a pathToItem") + } + val itemSchema: JsonSchema<*> = schemas.entries.iterator().next().key + val itemInstance: Any? = itemSchema.getNewInstance(item, itemPathToItem, pathToSchemas) + items.add(itemInstance) + i += 1 + } + val newInstanceItems: FrozenList = FrozenList(items) + return newInstanceItems + } + + @Throws(ValidationException::class) + override fun validate(arg: List<*>, configuration: SchemaConfiguration?): FrozenList { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, PathToSchemasMap(), LinkedHashSet()) + val pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet) + return getNewInstance(castArg, validationMetadata.pathToItem, pathToSchemasMap) + } + + override fun getNewInstance(arg: Map<*, *>, pathToItem: List, pathToSchemas: PathToSchemasMap): FrozenMap { + val properties: LinkedHashMap = LinkedHashMap() + for((propertyName, value) in arg) { + if (!(propertyName is String)) { + throw RuntimeException("Invalid non-string key value") + } + val propertyPathToItem: List = pathToItem + propertyName + val schemas: LinkedHashMap, Nothing?>? = pathToSchemas.get(propertyPathToItem) + if (schemas == null) { + throw RuntimeException("Validation result is invalid, schemas must exist for a pathToItem") + } + val propertySchema: JsonSchema<*> = schemas.entries.iterator().next().key + val propertyInstance: Any? = propertySchema.getNewInstance(value, propertyPathToItem, pathToSchemas) + properties[propertyName] = propertyInstance + } + val castProperties: FrozenMap = FrozenMap(properties) + return castProperties + } + + @Throws(ValidationException::class) + override fun validate(arg: Map<*, *>, configuration: SchemaConfiguration?): FrozenMap { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validatedPathToSchemas = PathToSchemasMap() + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, LinkedHashSet()) + val pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet) + return getNewInstance(castArg, validationMetadata.pathToItem, pathToSchemasMap) + } + + @Throws(ValidationException::class) + override fun validate(arg: Any?, configuration: SchemaConfiguration?): Any? { + if (arg == null) { + return validate(null, configuration) + } else if (arg is Boolean) { + return validate(arg, configuration) + } else if (arg is Number) { + return validate(arg, configuration) + } else if (arg is String) { + return validate(arg, configuration) + } else if (arg is List<*>) { + return validate(arg, configuration) + } else if (arg is Map<*, *>) { + return validate(arg, configuration) + } + throw ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema") + } + override fun getNewInstance(arg: Any?, pathToItem: List, pathToSchemas: PathToSchemasMap): Any? { + if (arg == null) { + return getNewInstance( null, pathToItem, pathToSchemas) + } else if (arg is Boolean) { + return getNewInstance(arg, pathToItem, pathToSchemas) + } else if (arg is Number) { + return getNewInstance(arg, pathToItem, pathToSchemas) + } else if (arg is String) { + return getNewInstance(arg, pathToItem, pathToSchemas) + } else if (arg is List<*>) { + return getNewInstance(arg, pathToItem, pathToSchemas) + } else if (arg is Map<*, *>) { + return getNewInstance(arg, pathToItem, pathToSchemas) + } + throw RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema") + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: Nothing?, configuration: SchemaConfiguration?): AnyofComplexTypes1BoxedVoid { + return AnyofComplexTypes1BoxedVoid(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: Boolean, configuration: SchemaConfiguration?): AnyofComplexTypes1BoxedBoolean { + return AnyofComplexTypes1BoxedBoolean(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: Number, configuration: SchemaConfiguration?): AnyofComplexTypes1BoxedNumber { + return AnyofComplexTypes1BoxedNumber(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: String, configuration: SchemaConfiguration?): AnyofComplexTypes1BoxedString { + return AnyofComplexTypes1BoxedString(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: List<*>, configuration: SchemaConfiguration?): AnyofComplexTypes1BoxedList { + return AnyofComplexTypes1BoxedList(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: Map<*, *>, configuration: SchemaConfiguration?): AnyofComplexTypes1BoxedMap { + return AnyofComplexTypes1BoxedMap(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: Any?, configuration: SchemaConfiguration?): AnyofComplexTypes1Boxed { + if (arg == null) { + return validateAndBox(null, configuration) + } else if (arg is Boolean) { + return validateAndBox(arg, configuration) + } else if (arg is String) { + return validateAndBox(arg, configuration) + } else if (arg is Number) { + return validateAndBox(arg, configuration) + } else if (arg is List<*>) { + return validateAndBox(arg, configuration) + } else if (arg is Map<*, *>) { + return validateAndBox(arg, configuration) + } + throw ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema") + } + } +} diff --git a/samples/client/3_0_3_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/schemas/AnyofWithBaseSchema.kt b/samples/client/3_0_3_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/schemas/AnyofWithBaseSchema.kt new file mode 100644 index 00000000000..c6c6cd7ba74 --- /dev/null +++ b/samples/client/3_0_3_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/schemas/AnyofWithBaseSchema.kt @@ -0,0 +1,653 @@ +package org.openapijsonschematools.client.components.schemas +import java.time.LocalDate +import java.time.ZonedDateTime +import java.util.UUID +import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags +import org.openapijsonschematools.client.configurations.SchemaConfiguration +import org.openapijsonschematools.client.exceptions.InvalidAdditionalPropertyException +import org.openapijsonschematools.client.exceptions.UnsetPropertyException +import org.openapijsonschematools.client.exceptions.ValidationException +import org.openapijsonschematools.client.schemas.UnsetAddPropsSetter +import org.openapijsonschematools.client.schemas.validation.BooleanSchemaValidator +import org.openapijsonschematools.client.schemas.validation.FrozenList +import org.openapijsonschematools.client.schemas.validation.FrozenMap +import org.openapijsonschematools.client.schemas.validation.JsonSchema +import org.openapijsonschematools.client.schemas.validation.JsonSchemaInfo +import org.openapijsonschematools.client.schemas.validation.ListSchemaValidator +import org.openapijsonschematools.client.schemas.validation.MapSchemaValidator +import org.openapijsonschematools.client.schemas.validation.NullSchemaValidator +import org.openapijsonschematools.client.schemas.validation.NumberSchemaValidator +import org.openapijsonschematools.client.schemas.validation.PathToSchemasMap +import org.openapijsonschematools.client.schemas.validation.StringSchemaValidator +import org.openapijsonschematools.client.schemas.validation.ValidationMetadata + +class AnyofWithBaseSchema { + // nest classes so all schemas and input/output classes can be public + + + sealed interface Schema0Boxed { + fun getData(): Any? + } + + data class Schema0BoxedVoid(val data: Nothing?) : Schema0Boxed { + override fun getData(): Any? { + return data + } + } + + data class Schema0BoxedBoolean(val data: Boolean): Schema0Boxed { + override fun getData(): Any? { + return data + } + } + + data class Schema0BoxedNumber(val data: Number) : Schema0Boxed { + override fun getData(): Any? { + return data + } + } + + data class Schema0BoxedString(val data: String) : Schema0Boxed { + override fun getData(): Any? { + return data + } + } + + data class Schema0BoxedList(val data: FrozenList) : Schema0Boxed { + override fun getData(): Any? { + return data + } + } + + data class Schema0BoxedMap(val data: FrozenMap) : Schema0Boxed { + override fun getData(): Any? { + return data + } + } + + + class Schema0 private constructor(): JsonSchema( + JsonSchemaInfo() + .maxLength(2) + ), NullSchemaValidator, BooleanSchemaValidator, NumberSchemaValidator, StringSchemaValidator, ListSchemaValidator, Schema0BoxedList>, MapSchemaValidator, Schema0BoxedMap> { + + companion object { + @Volatile + private var instance: Schema0? = null + + fun getInstance() = + instance ?: synchronized(this) { + instance ?: Schema0().also { instance = it } + } + } + + @Throws(ValidationException::class) + override fun validate(arg: Nothing?, configuration: SchemaConfiguration?): Nothing? { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validatedPathToSchemas = PathToSchemasMap() + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, LinkedHashSet()) + getPathToSchemas(this, castArg, validationMetadata, pathSet) + return castArg + } + + @Throws(ValidationException::class) + override fun validate(arg: Boolean, configuration: SchemaConfiguration?): Boolean { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validatedPathToSchemas = PathToSchemasMap() + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, LinkedHashSet()) + getPathToSchemas(this, castArg, validationMetadata, pathSet) + return castArg + } + + @Throws(ValidationException::class) + override fun validate(arg: Number, configuration: SchemaConfiguration?): Number { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validatedPathToSchemas = PathToSchemasMap() + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, LinkedHashSet()) + getPathToSchemas(this, castArg, validationMetadata, pathSet) + return castArg + } + + @Throws(ValidationException::class) + fun validate(arg: Int, configuration: SchemaConfiguration?): Int { + return validate(arg as Number, configuration) as Int + } + + @Throws(ValidationException::class) + fun validate(arg: Long, configuration: SchemaConfiguration?): Long { + return validate(arg as Number, configuration) as Long + } + + @Throws(ValidationException::class) + fun validate(arg: Float, configuration: SchemaConfiguration?): Float { + return validate(arg as Number, configuration) as Float + } + + @Throws(ValidationException::class) + fun validate(arg: Double, configuration: SchemaConfiguration?): Double { + return validate(arg as Number, configuration) as Double + } + + @Throws(ValidationException::class) + override fun validate(arg: String, configuration: SchemaConfiguration?): String { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validatedPathToSchemas = PathToSchemasMap() + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, LinkedHashSet()) + getPathToSchemas(this, castArg, validationMetadata, pathSet) + return castArg + } + + @Throws(ValidationException::class) + fun validate(arg: LocalDate, configuration: SchemaConfiguration?): String { + return validate(arg.toString(), configuration) + } + + @Throws(ValidationException::class) + fun validate(arg: ZonedDateTime, configuration: SchemaConfiguration?): String { + return validate(arg.toString(), configuration) + } + + @Throws(ValidationException::class) + fun validate(arg: UUID, configuration: SchemaConfiguration?): String { + return validate(arg.toString(), configuration) + } + + override fun getNewInstance(arg: List<*>, pathToItem: List, pathToSchemas: PathToSchemasMap): FrozenList { + val items: MutableList = ArrayList() + var i: Int = 0 + for (item: Any? in arg) { + val itemPathToItem = pathToItem + i + val schemas: LinkedHashMap, Nothing?>? = pathToSchemas.get(itemPathToItem) + if (schemas == null) { + throw RuntimeException("Validation result is invalid, schemas must exist for a pathToItem") + } + val itemSchema: JsonSchema<*> = schemas.entries.iterator().next().key + val itemInstance: Any? = itemSchema.getNewInstance(item, itemPathToItem, pathToSchemas) + items.add(itemInstance) + i += 1 + } + val newInstanceItems: FrozenList = FrozenList(items) + return newInstanceItems + } + + @Throws(ValidationException::class) + override fun validate(arg: List<*>, configuration: SchemaConfiguration?): FrozenList { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, PathToSchemasMap(), LinkedHashSet()) + val pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet) + return getNewInstance(castArg, validationMetadata.pathToItem, pathToSchemasMap) + } + + override fun getNewInstance(arg: Map<*, *>, pathToItem: List, pathToSchemas: PathToSchemasMap): FrozenMap { + val properties: LinkedHashMap = LinkedHashMap() + for((propertyName, value) in arg) { + if (!(propertyName is String)) { + throw RuntimeException("Invalid non-string key value") + } + val propertyPathToItem: List = pathToItem + propertyName + val schemas: LinkedHashMap, Nothing?>? = pathToSchemas.get(propertyPathToItem) + if (schemas == null) { + throw RuntimeException("Validation result is invalid, schemas must exist for a pathToItem") + } + val propertySchema: JsonSchema<*> = schemas.entries.iterator().next().key + val propertyInstance: Any? = propertySchema.getNewInstance(value, propertyPathToItem, pathToSchemas) + properties[propertyName] = propertyInstance + } + val castProperties: FrozenMap = FrozenMap(properties) + return castProperties + } + + @Throws(ValidationException::class) + override fun validate(arg: Map<*, *>, configuration: SchemaConfiguration?): FrozenMap { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validatedPathToSchemas = PathToSchemasMap() + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, LinkedHashSet()) + val pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet) + return getNewInstance(castArg, validationMetadata.pathToItem, pathToSchemasMap) + } + + @Throws(ValidationException::class) + override fun validate(arg: Any?, configuration: SchemaConfiguration?): Any? { + if (arg == null) { + return validate(null, configuration) + } else if (arg is Boolean) { + return validate(arg, configuration) + } else if (arg is Number) { + return validate(arg, configuration) + } else if (arg is String) { + return validate(arg, configuration) + } else if (arg is List<*>) { + return validate(arg, configuration) + } else if (arg is Map<*, *>) { + return validate(arg, configuration) + } + throw ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema") + } + override fun getNewInstance(arg: Any?, pathToItem: List, pathToSchemas: PathToSchemasMap): Any? { + if (arg == null) { + return getNewInstance( null, pathToItem, pathToSchemas) + } else if (arg is Boolean) { + return getNewInstance(arg, pathToItem, pathToSchemas) + } else if (arg is Number) { + return getNewInstance(arg, pathToItem, pathToSchemas) + } else if (arg is String) { + return getNewInstance(arg, pathToItem, pathToSchemas) + } else if (arg is List<*>) { + return getNewInstance(arg, pathToItem, pathToSchemas) + } else if (arg is Map<*, *>) { + return getNewInstance(arg, pathToItem, pathToSchemas) + } + throw RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema") + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: Nothing?, configuration: SchemaConfiguration?): Schema0BoxedVoid { + return Schema0BoxedVoid(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: Boolean, configuration: SchemaConfiguration?): Schema0BoxedBoolean { + return Schema0BoxedBoolean(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: Number, configuration: SchemaConfiguration?): Schema0BoxedNumber { + return Schema0BoxedNumber(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: String, configuration: SchemaConfiguration?): Schema0BoxedString { + return Schema0BoxedString(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: List<*>, configuration: SchemaConfiguration?): Schema0BoxedList { + return Schema0BoxedList(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: Map<*, *>, configuration: SchemaConfiguration?): Schema0BoxedMap { + return Schema0BoxedMap(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: Any?, configuration: SchemaConfiguration?): Schema0Boxed { + if (arg == null) { + return validateAndBox(null, configuration) + } else if (arg is Boolean) { + return validateAndBox(arg, configuration) + } else if (arg is String) { + return validateAndBox(arg, configuration) + } else if (arg is Number) { + return validateAndBox(arg, configuration) + } else if (arg is List<*>) { + return validateAndBox(arg, configuration) + } else if (arg is Map<*, *>) { + return validateAndBox(arg, configuration) + } + throw ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema") + } + } + + sealed interface Schema1Boxed { + fun getData(): Any? + } + + data class Schema1BoxedVoid(val data: Nothing?) : Schema1Boxed { + override fun getData(): Any? { + return data + } + } + + data class Schema1BoxedBoolean(val data: Boolean): Schema1Boxed { + override fun getData(): Any? { + return data + } + } + + data class Schema1BoxedNumber(val data: Number) : Schema1Boxed { + override fun getData(): Any? { + return data + } + } + + data class Schema1BoxedString(val data: String) : Schema1Boxed { + override fun getData(): Any? { + return data + } + } + + data class Schema1BoxedList(val data: FrozenList) : Schema1Boxed { + override fun getData(): Any? { + return data + } + } + + data class Schema1BoxedMap(val data: FrozenMap) : Schema1Boxed { + override fun getData(): Any? { + return data + } + } + + + class Schema1 private constructor(): JsonSchema( + JsonSchemaInfo() + .minLength(4) + ), NullSchemaValidator, BooleanSchemaValidator, NumberSchemaValidator, StringSchemaValidator, ListSchemaValidator, Schema1BoxedList>, MapSchemaValidator, Schema1BoxedMap> { + + companion object { + @Volatile + private var instance: Schema1? = null + + fun getInstance() = + instance ?: synchronized(this) { + instance ?: Schema1().also { instance = it } + } + } + + @Throws(ValidationException::class) + override fun validate(arg: Nothing?, configuration: SchemaConfiguration?): Nothing? { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validatedPathToSchemas = PathToSchemasMap() + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, LinkedHashSet()) + getPathToSchemas(this, castArg, validationMetadata, pathSet) + return castArg + } + + @Throws(ValidationException::class) + override fun validate(arg: Boolean, configuration: SchemaConfiguration?): Boolean { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validatedPathToSchemas = PathToSchemasMap() + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, LinkedHashSet()) + getPathToSchemas(this, castArg, validationMetadata, pathSet) + return castArg + } + + @Throws(ValidationException::class) + override fun validate(arg: Number, configuration: SchemaConfiguration?): Number { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validatedPathToSchemas = PathToSchemasMap() + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, LinkedHashSet()) + getPathToSchemas(this, castArg, validationMetadata, pathSet) + return castArg + } + + @Throws(ValidationException::class) + fun validate(arg: Int, configuration: SchemaConfiguration?): Int { + return validate(arg as Number, configuration) as Int + } + + @Throws(ValidationException::class) + fun validate(arg: Long, configuration: SchemaConfiguration?): Long { + return validate(arg as Number, configuration) as Long + } + + @Throws(ValidationException::class) + fun validate(arg: Float, configuration: SchemaConfiguration?): Float { + return validate(arg as Number, configuration) as Float + } + + @Throws(ValidationException::class) + fun validate(arg: Double, configuration: SchemaConfiguration?): Double { + return validate(arg as Number, configuration) as Double + } + + @Throws(ValidationException::class) + override fun validate(arg: String, configuration: SchemaConfiguration?): String { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validatedPathToSchemas = PathToSchemasMap() + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, LinkedHashSet()) + getPathToSchemas(this, castArg, validationMetadata, pathSet) + return castArg + } + + @Throws(ValidationException::class) + fun validate(arg: LocalDate, configuration: SchemaConfiguration?): String { + return validate(arg.toString(), configuration) + } + + @Throws(ValidationException::class) + fun validate(arg: ZonedDateTime, configuration: SchemaConfiguration?): String { + return validate(arg.toString(), configuration) + } + + @Throws(ValidationException::class) + fun validate(arg: UUID, configuration: SchemaConfiguration?): String { + return validate(arg.toString(), configuration) + } + + override fun getNewInstance(arg: List<*>, pathToItem: List, pathToSchemas: PathToSchemasMap): FrozenList { + val items: MutableList = ArrayList() + var i: Int = 0 + for (item: Any? in arg) { + val itemPathToItem = pathToItem + i + val schemas: LinkedHashMap, Nothing?>? = pathToSchemas.get(itemPathToItem) + if (schemas == null) { + throw RuntimeException("Validation result is invalid, schemas must exist for a pathToItem") + } + val itemSchema: JsonSchema<*> = schemas.entries.iterator().next().key + val itemInstance: Any? = itemSchema.getNewInstance(item, itemPathToItem, pathToSchemas) + items.add(itemInstance) + i += 1 + } + val newInstanceItems: FrozenList = FrozenList(items) + return newInstanceItems + } + + @Throws(ValidationException::class) + override fun validate(arg: List<*>, configuration: SchemaConfiguration?): FrozenList { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, PathToSchemasMap(), LinkedHashSet()) + val pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet) + return getNewInstance(castArg, validationMetadata.pathToItem, pathToSchemasMap) + } + + override fun getNewInstance(arg: Map<*, *>, pathToItem: List, pathToSchemas: PathToSchemasMap): FrozenMap { + val properties: LinkedHashMap = LinkedHashMap() + for((propertyName, value) in arg) { + if (!(propertyName is String)) { + throw RuntimeException("Invalid non-string key value") + } + val propertyPathToItem: List = pathToItem + propertyName + val schemas: LinkedHashMap, Nothing?>? = pathToSchemas.get(propertyPathToItem) + if (schemas == null) { + throw RuntimeException("Validation result is invalid, schemas must exist for a pathToItem") + } + val propertySchema: JsonSchema<*> = schemas.entries.iterator().next().key + val propertyInstance: Any? = propertySchema.getNewInstance(value, propertyPathToItem, pathToSchemas) + properties[propertyName] = propertyInstance + } + val castProperties: FrozenMap = FrozenMap(properties) + return castProperties + } + + @Throws(ValidationException::class) + override fun validate(arg: Map<*, *>, configuration: SchemaConfiguration?): FrozenMap { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validatedPathToSchemas = PathToSchemasMap() + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, LinkedHashSet()) + val pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet) + return getNewInstance(castArg, validationMetadata.pathToItem, pathToSchemasMap) + } + + @Throws(ValidationException::class) + override fun validate(arg: Any?, configuration: SchemaConfiguration?): Any? { + if (arg == null) { + return validate(null, configuration) + } else if (arg is Boolean) { + return validate(arg, configuration) + } else if (arg is Number) { + return validate(arg, configuration) + } else if (arg is String) { + return validate(arg, configuration) + } else if (arg is List<*>) { + return validate(arg, configuration) + } else if (arg is Map<*, *>) { + return validate(arg, configuration) + } + throw ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema") + } + override fun getNewInstance(arg: Any?, pathToItem: List, pathToSchemas: PathToSchemasMap): Any? { + if (arg == null) { + return getNewInstance( null, pathToItem, pathToSchemas) + } else if (arg is Boolean) { + return getNewInstance(arg, pathToItem, pathToSchemas) + } else if (arg is Number) { + return getNewInstance(arg, pathToItem, pathToSchemas) + } else if (arg is String) { + return getNewInstance(arg, pathToItem, pathToSchemas) + } else if (arg is List<*>) { + return getNewInstance(arg, pathToItem, pathToSchemas) + } else if (arg is Map<*, *>) { + return getNewInstance(arg, pathToItem, pathToSchemas) + } + throw RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema") + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: Nothing?, configuration: SchemaConfiguration?): Schema1BoxedVoid { + return Schema1BoxedVoid(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: Boolean, configuration: SchemaConfiguration?): Schema1BoxedBoolean { + return Schema1BoxedBoolean(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: Number, configuration: SchemaConfiguration?): Schema1BoxedNumber { + return Schema1BoxedNumber(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: String, configuration: SchemaConfiguration?): Schema1BoxedString { + return Schema1BoxedString(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: List<*>, configuration: SchemaConfiguration?): Schema1BoxedList { + return Schema1BoxedList(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: Map<*, *>, configuration: SchemaConfiguration?): Schema1BoxedMap { + return Schema1BoxedMap(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: Any?, configuration: SchemaConfiguration?): Schema1Boxed { + if (arg == null) { + return validateAndBox(null, configuration) + } else if (arg is Boolean) { + return validateAndBox(arg, configuration) + } else if (arg is String) { + return validateAndBox(arg, configuration) + } else if (arg is Number) { + return validateAndBox(arg, configuration) + } else if (arg is List<*>) { + return validateAndBox(arg, configuration) + } else if (arg is Map<*, *>) { + return validateAndBox(arg, configuration) + } + throw ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema") + } + } + + sealed interface AnyofWithBaseSchema1Boxed { + fun getData(): Any? + } + + data class AnyofWithBaseSchema1BoxedString(val data: String) : AnyofWithBaseSchema1Boxed { + override fun getData(): Any? { + return data + } + } + + + + class AnyofWithBaseSchema1 private constructor(): JsonSchema( + JsonSchemaInfo() + .type(setOf( + String::class.java + )) + .anyOf(listOf( + Schema0::class.java, + Schema1::class.java + )) + ), StringSchemaValidator { + /* + NOTE: This class is auto generated by OpenAPI JSON Schema Generator. + Ref: https://github.com/openapi-json-schema-tools/openapi-json-schema-generator + + Do not edit the class manually. + */ + + companion object { + @Volatile + private var instance: AnyofWithBaseSchema1? = null + + fun getInstance() = + instance ?: synchronized(this) { + instance ?: AnyofWithBaseSchema1().also { instance = it } + } + } + + @Throws(ValidationException::class) + override fun validate(arg: String, configuration: SchemaConfiguration?): String { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, PathToSchemasMap(), LinkedHashSet()) + getPathToSchemas(this, castArg, validationMetadata, pathSet) + return castArg + } + + @Throws(ValidationException::class) + override fun validate(arg: Any?, configuration: SchemaConfiguration?): Any? { + if (arg is String) { + return validate(arg, configuration) + } + throw ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema") + } + override fun getNewInstance(arg: Any?, pathToItem: List, pathToSchemas: PathToSchemasMap): Any? { + if (arg is String) { + return getNewInstance(arg, pathToItem, pathToSchemas) + } + throw RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema") + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: String, configuration: SchemaConfiguration?): AnyofWithBaseSchema1BoxedString { + return AnyofWithBaseSchema1BoxedString(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: Any?, configuration: SchemaConfiguration?): AnyofWithBaseSchema1Boxed { + if (arg is String) { + return validateAndBox(arg, configuration) + } + throw ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema") + } + } +} diff --git a/samples/client/3_0_3_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/schemas/AnyofWithOneEmptySchema.kt b/samples/client/3_0_3_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/schemas/AnyofWithOneEmptySchema.kt new file mode 100644 index 00000000000..6bd29945cdc --- /dev/null +++ b/samples/client/3_0_3_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/schemas/AnyofWithOneEmptySchema.kt @@ -0,0 +1,339 @@ +package org.openapijsonschematools.client.components.schemas +import java.time.LocalDate +import java.time.ZonedDateTime +import java.util.UUID +import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags +import org.openapijsonschematools.client.configurations.SchemaConfiguration +import org.openapijsonschematools.client.exceptions.InvalidAdditionalPropertyException +import org.openapijsonschematools.client.exceptions.UnsetPropertyException +import org.openapijsonschematools.client.exceptions.ValidationException +import org.openapijsonschematools.client.schemas.AnyTypeJsonSchema +import org.openapijsonschematools.client.schemas.NumberJsonSchema +import org.openapijsonschematools.client.schemas.UnsetAddPropsSetter +import org.openapijsonschematools.client.schemas.validation.BooleanSchemaValidator +import org.openapijsonschematools.client.schemas.validation.FrozenList +import org.openapijsonschematools.client.schemas.validation.FrozenMap +import org.openapijsonschematools.client.schemas.validation.JsonSchema +import org.openapijsonschematools.client.schemas.validation.JsonSchemaInfo +import org.openapijsonschematools.client.schemas.validation.ListSchemaValidator +import org.openapijsonschematools.client.schemas.validation.MapSchemaValidator +import org.openapijsonschematools.client.schemas.validation.NullSchemaValidator +import org.openapijsonschematools.client.schemas.validation.NumberSchemaValidator +import org.openapijsonschematools.client.schemas.validation.PathToSchemasMap +import org.openapijsonschematools.client.schemas.validation.StringSchemaValidator +import org.openapijsonschematools.client.schemas.validation.ValidationMetadata + +class AnyofWithOneEmptySchema { + // nest classes so all schemas and input/output classes can be public + + + class Schema0 : NumberJsonSchema.NumberJsonSchema1() { + companion object { + @Volatile + private var instance: Schema0? = null + + fun getInstance() = + instance ?: synchronized(this) { + instance ?: Schema0().also { instance = it } + } + } + } + + + class Schema1 : AnyTypeJsonSchema.AnyTypeJsonSchema1() { + companion object { + @Volatile + private var instance: Schema1? = null + + fun getInstance() = + instance ?: synchronized(this) { + instance ?: Schema1().also { instance = it } + } + } + } + + + sealed interface AnyofWithOneEmptySchema1Boxed { + fun getData(): Any? + } + + data class AnyofWithOneEmptySchema1BoxedVoid(val data: Nothing?) : AnyofWithOneEmptySchema1Boxed { + override fun getData(): Any? { + return data + } + } + + data class AnyofWithOneEmptySchema1BoxedBoolean(val data: Boolean): AnyofWithOneEmptySchema1Boxed { + override fun getData(): Any? { + return data + } + } + + data class AnyofWithOneEmptySchema1BoxedNumber(val data: Number) : AnyofWithOneEmptySchema1Boxed { + override fun getData(): Any? { + return data + } + } + + data class AnyofWithOneEmptySchema1BoxedString(val data: String) : AnyofWithOneEmptySchema1Boxed { + override fun getData(): Any? { + return data + } + } + + data class AnyofWithOneEmptySchema1BoxedList(val data: FrozenList) : AnyofWithOneEmptySchema1Boxed { + override fun getData(): Any? { + return data + } + } + + data class AnyofWithOneEmptySchema1BoxedMap(val data: FrozenMap) : AnyofWithOneEmptySchema1Boxed { + override fun getData(): Any? { + return data + } + } + + + class AnyofWithOneEmptySchema1 private constructor(): JsonSchema( + JsonSchemaInfo() + .anyOf(listOf( + Schema0::class.java, + Schema1::class.java + )) + ), NullSchemaValidator, BooleanSchemaValidator, NumberSchemaValidator, StringSchemaValidator, ListSchemaValidator, AnyofWithOneEmptySchema1BoxedList>, MapSchemaValidator, AnyofWithOneEmptySchema1BoxedMap> { + /* + NOTE: This class is auto generated by OpenAPI JSON Schema Generator. + Ref: https://github.com/openapi-json-schema-tools/openapi-json-schema-generator + + Do not edit the class manually. + */ + + companion object { + @Volatile + private var instance: AnyofWithOneEmptySchema1? = null + + fun getInstance() = + instance ?: synchronized(this) { + instance ?: AnyofWithOneEmptySchema1().also { instance = it } + } + } + + @Throws(ValidationException::class) + override fun validate(arg: Nothing?, configuration: SchemaConfiguration?): Nothing? { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validatedPathToSchemas = PathToSchemasMap() + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, LinkedHashSet()) + getPathToSchemas(this, castArg, validationMetadata, pathSet) + return castArg + } + + @Throws(ValidationException::class) + override fun validate(arg: Boolean, configuration: SchemaConfiguration?): Boolean { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validatedPathToSchemas = PathToSchemasMap() + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, LinkedHashSet()) + getPathToSchemas(this, castArg, validationMetadata, pathSet) + return castArg + } + + @Throws(ValidationException::class) + override fun validate(arg: Number, configuration: SchemaConfiguration?): Number { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validatedPathToSchemas = PathToSchemasMap() + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, LinkedHashSet()) + getPathToSchemas(this, castArg, validationMetadata, pathSet) + return castArg + } + + @Throws(ValidationException::class) + fun validate(arg: Int, configuration: SchemaConfiguration?): Int { + return validate(arg as Number, configuration) as Int + } + + @Throws(ValidationException::class) + fun validate(arg: Long, configuration: SchemaConfiguration?): Long { + return validate(arg as Number, configuration) as Long + } + + @Throws(ValidationException::class) + fun validate(arg: Float, configuration: SchemaConfiguration?): Float { + return validate(arg as Number, configuration) as Float + } + + @Throws(ValidationException::class) + fun validate(arg: Double, configuration: SchemaConfiguration?): Double { + return validate(arg as Number, configuration) as Double + } + + @Throws(ValidationException::class) + override fun validate(arg: String, configuration: SchemaConfiguration?): String { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validatedPathToSchemas = PathToSchemasMap() + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, LinkedHashSet()) + getPathToSchemas(this, castArg, validationMetadata, pathSet) + return castArg + } + + @Throws(ValidationException::class) + fun validate(arg: LocalDate, configuration: SchemaConfiguration?): String { + return validate(arg.toString(), configuration) + } + + @Throws(ValidationException::class) + fun validate(arg: ZonedDateTime, configuration: SchemaConfiguration?): String { + return validate(arg.toString(), configuration) + } + + @Throws(ValidationException::class) + fun validate(arg: UUID, configuration: SchemaConfiguration?): String { + return validate(arg.toString(), configuration) + } + + override fun getNewInstance(arg: List<*>, pathToItem: List, pathToSchemas: PathToSchemasMap): FrozenList { + val items: MutableList = ArrayList() + var i: Int = 0 + for (item: Any? in arg) { + val itemPathToItem = pathToItem + i + val schemas: LinkedHashMap, Nothing?>? = pathToSchemas.get(itemPathToItem) + if (schemas == null) { + throw RuntimeException("Validation result is invalid, schemas must exist for a pathToItem") + } + val itemSchema: JsonSchema<*> = schemas.entries.iterator().next().key + val itemInstance: Any? = itemSchema.getNewInstance(item, itemPathToItem, pathToSchemas) + items.add(itemInstance) + i += 1 + } + val newInstanceItems: FrozenList = FrozenList(items) + return newInstanceItems + } + + @Throws(ValidationException::class) + override fun validate(arg: List<*>, configuration: SchemaConfiguration?): FrozenList { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, PathToSchemasMap(), LinkedHashSet()) + val pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet) + return getNewInstance(castArg, validationMetadata.pathToItem, pathToSchemasMap) + } + + override fun getNewInstance(arg: Map<*, *>, pathToItem: List, pathToSchemas: PathToSchemasMap): FrozenMap { + val properties: LinkedHashMap = LinkedHashMap() + for((propertyName, value) in arg) { + if (!(propertyName is String)) { + throw RuntimeException("Invalid non-string key value") + } + val propertyPathToItem: List = pathToItem + propertyName + val schemas: LinkedHashMap, Nothing?>? = pathToSchemas.get(propertyPathToItem) + if (schemas == null) { + throw RuntimeException("Validation result is invalid, schemas must exist for a pathToItem") + } + val propertySchema: JsonSchema<*> = schemas.entries.iterator().next().key + val propertyInstance: Any? = propertySchema.getNewInstance(value, propertyPathToItem, pathToSchemas) + properties[propertyName] = propertyInstance + } + val castProperties: FrozenMap = FrozenMap(properties) + return castProperties + } + + @Throws(ValidationException::class) + override fun validate(arg: Map<*, *>, configuration: SchemaConfiguration?): FrozenMap { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validatedPathToSchemas = PathToSchemasMap() + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, LinkedHashSet()) + val pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet) + return getNewInstance(castArg, validationMetadata.pathToItem, pathToSchemasMap) + } + + @Throws(ValidationException::class) + override fun validate(arg: Any?, configuration: SchemaConfiguration?): Any? { + if (arg == null) { + return validate(null, configuration) + } else if (arg is Boolean) { + return validate(arg, configuration) + } else if (arg is Number) { + return validate(arg, configuration) + } else if (arg is String) { + return validate(arg, configuration) + } else if (arg is List<*>) { + return validate(arg, configuration) + } else if (arg is Map<*, *>) { + return validate(arg, configuration) + } + throw ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema") + } + override fun getNewInstance(arg: Any?, pathToItem: List, pathToSchemas: PathToSchemasMap): Any? { + if (arg == null) { + return getNewInstance( null, pathToItem, pathToSchemas) + } else if (arg is Boolean) { + return getNewInstance(arg, pathToItem, pathToSchemas) + } else if (arg is Number) { + return getNewInstance(arg, pathToItem, pathToSchemas) + } else if (arg is String) { + return getNewInstance(arg, pathToItem, pathToSchemas) + } else if (arg is List<*>) { + return getNewInstance(arg, pathToItem, pathToSchemas) + } else if (arg is Map<*, *>) { + return getNewInstance(arg, pathToItem, pathToSchemas) + } + throw RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema") + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: Nothing?, configuration: SchemaConfiguration?): AnyofWithOneEmptySchema1BoxedVoid { + return AnyofWithOneEmptySchema1BoxedVoid(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: Boolean, configuration: SchemaConfiguration?): AnyofWithOneEmptySchema1BoxedBoolean { + return AnyofWithOneEmptySchema1BoxedBoolean(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: Number, configuration: SchemaConfiguration?): AnyofWithOneEmptySchema1BoxedNumber { + return AnyofWithOneEmptySchema1BoxedNumber(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: String, configuration: SchemaConfiguration?): AnyofWithOneEmptySchema1BoxedString { + return AnyofWithOneEmptySchema1BoxedString(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: List<*>, configuration: SchemaConfiguration?): AnyofWithOneEmptySchema1BoxedList { + return AnyofWithOneEmptySchema1BoxedList(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: Map<*, *>, configuration: SchemaConfiguration?): AnyofWithOneEmptySchema1BoxedMap { + return AnyofWithOneEmptySchema1BoxedMap(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: Any?, configuration: SchemaConfiguration?): AnyofWithOneEmptySchema1Boxed { + if (arg == null) { + return validateAndBox(null, configuration) + } else if (arg is Boolean) { + return validateAndBox(arg, configuration) + } else if (arg is String) { + return validateAndBox(arg, configuration) + } else if (arg is Number) { + return validateAndBox(arg, configuration) + } else if (arg is List<*>) { + return validateAndBox(arg, configuration) + } else if (arg is Map<*, *>) { + return validateAndBox(arg, configuration) + } + throw ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema") + } + } +} diff --git a/samples/client/3_0_3_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/schemas/ArrayTypeMatchesArrays.kt b/samples/client/3_0_3_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/schemas/ArrayTypeMatchesArrays.kt new file mode 100644 index 00000000000..2493505f33d --- /dev/null +++ b/samples/client/3_0_3_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/schemas/ArrayTypeMatchesArrays.kt @@ -0,0 +1,187 @@ +package org.openapijsonschematools.client.components.schemas +import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags +import org.openapijsonschematools.client.configurations.SchemaConfiguration +import org.openapijsonschematools.client.exceptions.ValidationException +import org.openapijsonschematools.client.schemas.AnyTypeJsonSchema +import org.openapijsonschematools.client.schemas.validation.FrozenList +import org.openapijsonschematools.client.schemas.validation.JsonSchema +import org.openapijsonschematools.client.schemas.validation.JsonSchemaInfo +import org.openapijsonschematools.client.schemas.validation.ListSchemaValidator +import org.openapijsonschematools.client.schemas.validation.PathToSchemasMap +import org.openapijsonschematools.client.schemas.validation.ValidationMetadata + +class ArrayTypeMatchesArrays { + // nest classes so all schemas and input/output classes can be public + + + class Items : AnyTypeJsonSchema.AnyTypeJsonSchema1() { + companion object { + @Volatile + private var instance: Items? = null + + fun getInstance() = + instance ?: synchronized(this) { + instance ?: Items().also { instance = it } + } + } + } + + + class ArrayTypeMatchesArraysList(m: FrozenList) : FrozenList(m) { + companion object { + @Throws(ValidationException::class) + fun of(arg: List, configuration: SchemaConfiguration?): ArrayTypeMatchesArraysList { + return ArrayTypeMatchesArrays1.getInstance().validate(arg, configuration) + } + } + } + + class ArrayTypeMatchesArraysListBuilder { + // class to build List + private val list: MutableList + + init { + this.list = ArrayList() + } + + + fun add(item: Nothing?): ArrayTypeMatchesArraysListBuilder { + list.add(null) + return this + } + + fun add(item: Boolean): ArrayTypeMatchesArraysListBuilder { + list.add(item) + return this + } + + fun add(item: String): ArrayTypeMatchesArraysListBuilder { + list.add(item) + return this + } + + fun add(item: Int): ArrayTypeMatchesArraysListBuilder { + list.add(item) + return this + } + + fun add(item: Float): ArrayTypeMatchesArraysListBuilder { + list.add(item) + return this + } + + fun add(item: Long): ArrayTypeMatchesArraysListBuilder { + list.add(item) + return this + } + + fun add(item: Double): ArrayTypeMatchesArraysListBuilder { + list.add(item) + return this + } + + fun add(item: List<*>): ArrayTypeMatchesArraysListBuilder { + list.add(item) + return this + } + + fun add(item: Map): ArrayTypeMatchesArraysListBuilder { + list.add(item) + return this + } + + fun build(): List { + return list + } + } + + + sealed interface ArrayTypeMatchesArrays1Boxed { + fun getData(): Any? + } + + data class ArrayTypeMatchesArrays1BoxedList(val data: ArrayTypeMatchesArraysList) : ArrayTypeMatchesArrays1Boxed { + override fun getData(): Any? { + return data + } + } + + + + class ArrayTypeMatchesArrays1 private constructor(): JsonSchema( + JsonSchemaInfo() + .type(setOf(List::class.java)) + .items(Items::class.java) + ), ListSchemaValidator { + /* + NOTE: This class is auto generated by OpenAPI JSON Schema Generator. + Ref: https://github.com/openapi-json-schema-tools/openapi-json-schema-generator + + Do not edit the class manually. + */ + + companion object { + @Volatile + private var instance: ArrayTypeMatchesArrays1? = null + + fun getInstance() = + instance ?: synchronized(this) { + instance ?: ArrayTypeMatchesArrays1().also { instance = it } + } + } + + override fun getNewInstance(arg: List<*>, pathToItem: List, pathToSchemas: PathToSchemasMap): ArrayTypeMatchesArraysList { + val items: MutableList = ArrayList() + var i: Int = 0 + for (item: Any? in arg) { + val itemPathToItem: List = pathToItem + i + val schemas: LinkedHashMap, Nothing?>? = pathToSchemas.get(itemPathToItem) + if (schemas == null) { + throw RuntimeException("Validation result is invalid, schemas must exist for a pathToItem") + } + val itemSchema: JsonSchema<*> = schemas.entries.iterator().next().key + val itemInstance: Any? = itemSchema.getNewInstance(item, itemPathToItem, pathToSchemas) + items.add(itemInstance) + i += 1 + } + val newInstanceItems: FrozenList = FrozenList(items) + return ArrayTypeMatchesArraysList(newInstanceItems) + } + + @Throws(ValidationException::class) + override fun validate(arg: List<*>, configuration: SchemaConfiguration?): ArrayTypeMatchesArraysList { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, PathToSchemasMap(), LinkedHashSet()) + val pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet) + return getNewInstance(castArg, validationMetadata.pathToItem, pathToSchemasMap) + } + + @Throws(ValidationException::class) + override fun validate(arg: Any?, configuration: SchemaConfiguration?): Any? { + if (arg is List<*>) { + return validate(arg, configuration) + } + throw ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema") + } + override fun getNewInstance(arg: Any?, pathToItem: List, pathToSchemas: PathToSchemasMap): Any? { + if (arg is List<*>) { + return getNewInstance(arg, pathToItem, pathToSchemas) + } + throw RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema") + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: List<*>, configuration: SchemaConfiguration?): ArrayTypeMatchesArrays1BoxedList { + return ArrayTypeMatchesArrays1BoxedList(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: Any?, configuration: SchemaConfiguration?): ArrayTypeMatchesArrays1Boxed { + if (arg is List<*>) { + return validateAndBox(arg, configuration) + } + throw ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema") + } + } +} diff --git a/samples/client/3_0_3_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/schemas/BooleanTypeMatchesBooleans.kt b/samples/client/3_0_3_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/schemas/BooleanTypeMatchesBooleans.kt new file mode 100644 index 00000000000..f557463b4d8 --- /dev/null +++ b/samples/client/3_0_3_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/schemas/BooleanTypeMatchesBooleans.kt @@ -0,0 +1,20 @@ +package org.openapijsonschematools.client.components.schemas +import org.openapijsonschematools.client.schemas.BooleanJsonSchema + +class BooleanTypeMatchesBooleans: BooleanJsonSchema() { + // nest classes so all schemas and input/output classes can be public + + + class BooleanTypeMatchesBooleans1 : BooleanJsonSchema.BooleanJsonSchema1() { + companion object { + @Volatile + private var instance: BooleanTypeMatchesBooleans1? = null + + fun getInstance() = + instance ?: synchronized(this) { + instance ?: BooleanTypeMatchesBooleans1().also { instance = it } + } + } + } + +} diff --git a/samples/client/3_0_3_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/schemas/ByInt.kt b/samples/client/3_0_3_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/schemas/ByInt.kt new file mode 100644 index 00000000000..e02942f3d65 --- /dev/null +++ b/samples/client/3_0_3_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/schemas/ByInt.kt @@ -0,0 +1,309 @@ +package org.openapijsonschematools.client.components.schemas +import java.math.BigDecimal +import java.time.LocalDate +import java.time.ZonedDateTime +import java.util.UUID +import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags +import org.openapijsonschematools.client.configurations.SchemaConfiguration +import org.openapijsonschematools.client.exceptions.InvalidAdditionalPropertyException +import org.openapijsonschematools.client.exceptions.UnsetPropertyException +import org.openapijsonschematools.client.exceptions.ValidationException +import org.openapijsonschematools.client.schemas.UnsetAddPropsSetter +import org.openapijsonschematools.client.schemas.validation.BooleanSchemaValidator +import org.openapijsonschematools.client.schemas.validation.FrozenList +import org.openapijsonschematools.client.schemas.validation.FrozenMap +import org.openapijsonschematools.client.schemas.validation.JsonSchema +import org.openapijsonschematools.client.schemas.validation.JsonSchemaInfo +import org.openapijsonschematools.client.schemas.validation.ListSchemaValidator +import org.openapijsonschematools.client.schemas.validation.MapSchemaValidator +import org.openapijsonschematools.client.schemas.validation.NullSchemaValidator +import org.openapijsonschematools.client.schemas.validation.NumberSchemaValidator +import org.openapijsonschematools.client.schemas.validation.PathToSchemasMap +import org.openapijsonschematools.client.schemas.validation.StringSchemaValidator +import org.openapijsonschematools.client.schemas.validation.ValidationMetadata + +class ByInt { + // nest classes so all schemas and input/output classes can be public + + + sealed interface ByInt1Boxed { + fun getData(): Any? + } + + data class ByInt1BoxedVoid(val data: Nothing?) : ByInt1Boxed { + override fun getData(): Any? { + return data + } + } + + data class ByInt1BoxedBoolean(val data: Boolean): ByInt1Boxed { + override fun getData(): Any? { + return data + } + } + + data class ByInt1BoxedNumber(val data: Number) : ByInt1Boxed { + override fun getData(): Any? { + return data + } + } + + data class ByInt1BoxedString(val data: String) : ByInt1Boxed { + override fun getData(): Any? { + return data + } + } + + data class ByInt1BoxedList(val data: FrozenList) : ByInt1Boxed { + override fun getData(): Any? { + return data + } + } + + data class ByInt1BoxedMap(val data: FrozenMap) : ByInt1Boxed { + override fun getData(): Any? { + return data + } + } + + + class ByInt1 private constructor(): JsonSchema( + JsonSchemaInfo() + .multipleOf(BigDecimal("2")) + ), NullSchemaValidator, BooleanSchemaValidator, NumberSchemaValidator, StringSchemaValidator, ListSchemaValidator, ByInt1BoxedList>, MapSchemaValidator, ByInt1BoxedMap> { + /* + NOTE: This class is auto generated by OpenAPI JSON Schema Generator. + Ref: https://github.com/openapi-json-schema-tools/openapi-json-schema-generator + + Do not edit the class manually. + */ + + companion object { + @Volatile + private var instance: ByInt1? = null + + fun getInstance() = + instance ?: synchronized(this) { + instance ?: ByInt1().also { instance = it } + } + } + + @Throws(ValidationException::class) + override fun validate(arg: Nothing?, configuration: SchemaConfiguration?): Nothing? { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validatedPathToSchemas = PathToSchemasMap() + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, LinkedHashSet()) + getPathToSchemas(this, castArg, validationMetadata, pathSet) + return castArg + } + + @Throws(ValidationException::class) + override fun validate(arg: Boolean, configuration: SchemaConfiguration?): Boolean { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validatedPathToSchemas = PathToSchemasMap() + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, LinkedHashSet()) + getPathToSchemas(this, castArg, validationMetadata, pathSet) + return castArg + } + + @Throws(ValidationException::class) + override fun validate(arg: Number, configuration: SchemaConfiguration?): Number { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validatedPathToSchemas = PathToSchemasMap() + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, LinkedHashSet()) + getPathToSchemas(this, castArg, validationMetadata, pathSet) + return castArg + } + + @Throws(ValidationException::class) + fun validate(arg: Int, configuration: SchemaConfiguration?): Int { + return validate(arg as Number, configuration) as Int + } + + @Throws(ValidationException::class) + fun validate(arg: Long, configuration: SchemaConfiguration?): Long { + return validate(arg as Number, configuration) as Long + } + + @Throws(ValidationException::class) + fun validate(arg: Float, configuration: SchemaConfiguration?): Float { + return validate(arg as Number, configuration) as Float + } + + @Throws(ValidationException::class) + fun validate(arg: Double, configuration: SchemaConfiguration?): Double { + return validate(arg as Number, configuration) as Double + } + + @Throws(ValidationException::class) + override fun validate(arg: String, configuration: SchemaConfiguration?): String { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validatedPathToSchemas = PathToSchemasMap() + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, LinkedHashSet()) + getPathToSchemas(this, castArg, validationMetadata, pathSet) + return castArg + } + + @Throws(ValidationException::class) + fun validate(arg: LocalDate, configuration: SchemaConfiguration?): String { + return validate(arg.toString(), configuration) + } + + @Throws(ValidationException::class) + fun validate(arg: ZonedDateTime, configuration: SchemaConfiguration?): String { + return validate(arg.toString(), configuration) + } + + @Throws(ValidationException::class) + fun validate(arg: UUID, configuration: SchemaConfiguration?): String { + return validate(arg.toString(), configuration) + } + + override fun getNewInstance(arg: List<*>, pathToItem: List, pathToSchemas: PathToSchemasMap): FrozenList { + val items: MutableList = ArrayList() + var i: Int = 0 + for (item: Any? in arg) { + val itemPathToItem = pathToItem + i + val schemas: LinkedHashMap, Nothing?>? = pathToSchemas.get(itemPathToItem) + if (schemas == null) { + throw RuntimeException("Validation result is invalid, schemas must exist for a pathToItem") + } + val itemSchema: JsonSchema<*> = schemas.entries.iterator().next().key + val itemInstance: Any? = itemSchema.getNewInstance(item, itemPathToItem, pathToSchemas) + items.add(itemInstance) + i += 1 + } + val newInstanceItems: FrozenList = FrozenList(items) + return newInstanceItems + } + + @Throws(ValidationException::class) + override fun validate(arg: List<*>, configuration: SchemaConfiguration?): FrozenList { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, PathToSchemasMap(), LinkedHashSet()) + val pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet) + return getNewInstance(castArg, validationMetadata.pathToItem, pathToSchemasMap) + } + + override fun getNewInstance(arg: Map<*, *>, pathToItem: List, pathToSchemas: PathToSchemasMap): FrozenMap { + val properties: LinkedHashMap = LinkedHashMap() + for((propertyName, value) in arg) { + if (!(propertyName is String)) { + throw RuntimeException("Invalid non-string key value") + } + val propertyPathToItem: List = pathToItem + propertyName + val schemas: LinkedHashMap, Nothing?>? = pathToSchemas.get(propertyPathToItem) + if (schemas == null) { + throw RuntimeException("Validation result is invalid, schemas must exist for a pathToItem") + } + val propertySchema: JsonSchema<*> = schemas.entries.iterator().next().key + val propertyInstance: Any? = propertySchema.getNewInstance(value, propertyPathToItem, pathToSchemas) + properties[propertyName] = propertyInstance + } + val castProperties: FrozenMap = FrozenMap(properties) + return castProperties + } + + @Throws(ValidationException::class) + override fun validate(arg: Map<*, *>, configuration: SchemaConfiguration?): FrozenMap { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validatedPathToSchemas = PathToSchemasMap() + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, LinkedHashSet()) + val pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet) + return getNewInstance(castArg, validationMetadata.pathToItem, pathToSchemasMap) + } + + @Throws(ValidationException::class) + override fun validate(arg: Any?, configuration: SchemaConfiguration?): Any? { + if (arg == null) { + return validate(null, configuration) + } else if (arg is Boolean) { + return validate(arg, configuration) + } else if (arg is Number) { + return validate(arg, configuration) + } else if (arg is String) { + return validate(arg, configuration) + } else if (arg is List<*>) { + return validate(arg, configuration) + } else if (arg is Map<*, *>) { + return validate(arg, configuration) + } + throw ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema") + } + override fun getNewInstance(arg: Any?, pathToItem: List, pathToSchemas: PathToSchemasMap): Any? { + if (arg == null) { + return getNewInstance( null, pathToItem, pathToSchemas) + } else if (arg is Boolean) { + return getNewInstance(arg, pathToItem, pathToSchemas) + } else if (arg is Number) { + return getNewInstance(arg, pathToItem, pathToSchemas) + } else if (arg is String) { + return getNewInstance(arg, pathToItem, pathToSchemas) + } else if (arg is List<*>) { + return getNewInstance(arg, pathToItem, pathToSchemas) + } else if (arg is Map<*, *>) { + return getNewInstance(arg, pathToItem, pathToSchemas) + } + throw RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema") + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: Nothing?, configuration: SchemaConfiguration?): ByInt1BoxedVoid { + return ByInt1BoxedVoid(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: Boolean, configuration: SchemaConfiguration?): ByInt1BoxedBoolean { + return ByInt1BoxedBoolean(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: Number, configuration: SchemaConfiguration?): ByInt1BoxedNumber { + return ByInt1BoxedNumber(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: String, configuration: SchemaConfiguration?): ByInt1BoxedString { + return ByInt1BoxedString(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: List<*>, configuration: SchemaConfiguration?): ByInt1BoxedList { + return ByInt1BoxedList(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: Map<*, *>, configuration: SchemaConfiguration?): ByInt1BoxedMap { + return ByInt1BoxedMap(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: Any?, configuration: SchemaConfiguration?): ByInt1Boxed { + if (arg == null) { + return validateAndBox(null, configuration) + } else if (arg is Boolean) { + return validateAndBox(arg, configuration) + } else if (arg is String) { + return validateAndBox(arg, configuration) + } else if (arg is Number) { + return validateAndBox(arg, configuration) + } else if (arg is List<*>) { + return validateAndBox(arg, configuration) + } else if (arg is Map<*, *>) { + return validateAndBox(arg, configuration) + } + throw ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema") + } + } +} diff --git a/samples/client/3_0_3_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/schemas/ByNumber.kt b/samples/client/3_0_3_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/schemas/ByNumber.kt new file mode 100644 index 00000000000..92ab5a5ee41 --- /dev/null +++ b/samples/client/3_0_3_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/schemas/ByNumber.kt @@ -0,0 +1,309 @@ +package org.openapijsonschematools.client.components.schemas +import java.math.BigDecimal +import java.time.LocalDate +import java.time.ZonedDateTime +import java.util.UUID +import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags +import org.openapijsonschematools.client.configurations.SchemaConfiguration +import org.openapijsonschematools.client.exceptions.InvalidAdditionalPropertyException +import org.openapijsonschematools.client.exceptions.UnsetPropertyException +import org.openapijsonschematools.client.exceptions.ValidationException +import org.openapijsonschematools.client.schemas.UnsetAddPropsSetter +import org.openapijsonschematools.client.schemas.validation.BooleanSchemaValidator +import org.openapijsonschematools.client.schemas.validation.FrozenList +import org.openapijsonschematools.client.schemas.validation.FrozenMap +import org.openapijsonschematools.client.schemas.validation.JsonSchema +import org.openapijsonschematools.client.schemas.validation.JsonSchemaInfo +import org.openapijsonschematools.client.schemas.validation.ListSchemaValidator +import org.openapijsonschematools.client.schemas.validation.MapSchemaValidator +import org.openapijsonschematools.client.schemas.validation.NullSchemaValidator +import org.openapijsonschematools.client.schemas.validation.NumberSchemaValidator +import org.openapijsonschematools.client.schemas.validation.PathToSchemasMap +import org.openapijsonschematools.client.schemas.validation.StringSchemaValidator +import org.openapijsonschematools.client.schemas.validation.ValidationMetadata + +class ByNumber { + // nest classes so all schemas and input/output classes can be public + + + sealed interface ByNumber1Boxed { + fun getData(): Any? + } + + data class ByNumber1BoxedVoid(val data: Nothing?) : ByNumber1Boxed { + override fun getData(): Any? { + return data + } + } + + data class ByNumber1BoxedBoolean(val data: Boolean): ByNumber1Boxed { + override fun getData(): Any? { + return data + } + } + + data class ByNumber1BoxedNumber(val data: Number) : ByNumber1Boxed { + override fun getData(): Any? { + return data + } + } + + data class ByNumber1BoxedString(val data: String) : ByNumber1Boxed { + override fun getData(): Any? { + return data + } + } + + data class ByNumber1BoxedList(val data: FrozenList) : ByNumber1Boxed { + override fun getData(): Any? { + return data + } + } + + data class ByNumber1BoxedMap(val data: FrozenMap) : ByNumber1Boxed { + override fun getData(): Any? { + return data + } + } + + + class ByNumber1 private constructor(): JsonSchema( + JsonSchemaInfo() + .multipleOf(BigDecimal("1.5")) + ), NullSchemaValidator, BooleanSchemaValidator, NumberSchemaValidator, StringSchemaValidator, ListSchemaValidator, ByNumber1BoxedList>, MapSchemaValidator, ByNumber1BoxedMap> { + /* + NOTE: This class is auto generated by OpenAPI JSON Schema Generator. + Ref: https://github.com/openapi-json-schema-tools/openapi-json-schema-generator + + Do not edit the class manually. + */ + + companion object { + @Volatile + private var instance: ByNumber1? = null + + fun getInstance() = + instance ?: synchronized(this) { + instance ?: ByNumber1().also { instance = it } + } + } + + @Throws(ValidationException::class) + override fun validate(arg: Nothing?, configuration: SchemaConfiguration?): Nothing? { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validatedPathToSchemas = PathToSchemasMap() + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, LinkedHashSet()) + getPathToSchemas(this, castArg, validationMetadata, pathSet) + return castArg + } + + @Throws(ValidationException::class) + override fun validate(arg: Boolean, configuration: SchemaConfiguration?): Boolean { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validatedPathToSchemas = PathToSchemasMap() + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, LinkedHashSet()) + getPathToSchemas(this, castArg, validationMetadata, pathSet) + return castArg + } + + @Throws(ValidationException::class) + override fun validate(arg: Number, configuration: SchemaConfiguration?): Number { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validatedPathToSchemas = PathToSchemasMap() + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, LinkedHashSet()) + getPathToSchemas(this, castArg, validationMetadata, pathSet) + return castArg + } + + @Throws(ValidationException::class) + fun validate(arg: Int, configuration: SchemaConfiguration?): Int { + return validate(arg as Number, configuration) as Int + } + + @Throws(ValidationException::class) + fun validate(arg: Long, configuration: SchemaConfiguration?): Long { + return validate(arg as Number, configuration) as Long + } + + @Throws(ValidationException::class) + fun validate(arg: Float, configuration: SchemaConfiguration?): Float { + return validate(arg as Number, configuration) as Float + } + + @Throws(ValidationException::class) + fun validate(arg: Double, configuration: SchemaConfiguration?): Double { + return validate(arg as Number, configuration) as Double + } + + @Throws(ValidationException::class) + override fun validate(arg: String, configuration: SchemaConfiguration?): String { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validatedPathToSchemas = PathToSchemasMap() + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, LinkedHashSet()) + getPathToSchemas(this, castArg, validationMetadata, pathSet) + return castArg + } + + @Throws(ValidationException::class) + fun validate(arg: LocalDate, configuration: SchemaConfiguration?): String { + return validate(arg.toString(), configuration) + } + + @Throws(ValidationException::class) + fun validate(arg: ZonedDateTime, configuration: SchemaConfiguration?): String { + return validate(arg.toString(), configuration) + } + + @Throws(ValidationException::class) + fun validate(arg: UUID, configuration: SchemaConfiguration?): String { + return validate(arg.toString(), configuration) + } + + override fun getNewInstance(arg: List<*>, pathToItem: List, pathToSchemas: PathToSchemasMap): FrozenList { + val items: MutableList = ArrayList() + var i: Int = 0 + for (item: Any? in arg) { + val itemPathToItem = pathToItem + i + val schemas: LinkedHashMap, Nothing?>? = pathToSchemas.get(itemPathToItem) + if (schemas == null) { + throw RuntimeException("Validation result is invalid, schemas must exist for a pathToItem") + } + val itemSchema: JsonSchema<*> = schemas.entries.iterator().next().key + val itemInstance: Any? = itemSchema.getNewInstance(item, itemPathToItem, pathToSchemas) + items.add(itemInstance) + i += 1 + } + val newInstanceItems: FrozenList = FrozenList(items) + return newInstanceItems + } + + @Throws(ValidationException::class) + override fun validate(arg: List<*>, configuration: SchemaConfiguration?): FrozenList { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, PathToSchemasMap(), LinkedHashSet()) + val pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet) + return getNewInstance(castArg, validationMetadata.pathToItem, pathToSchemasMap) + } + + override fun getNewInstance(arg: Map<*, *>, pathToItem: List, pathToSchemas: PathToSchemasMap): FrozenMap { + val properties: LinkedHashMap = LinkedHashMap() + for((propertyName, value) in arg) { + if (!(propertyName is String)) { + throw RuntimeException("Invalid non-string key value") + } + val propertyPathToItem: List = pathToItem + propertyName + val schemas: LinkedHashMap, Nothing?>? = pathToSchemas.get(propertyPathToItem) + if (schemas == null) { + throw RuntimeException("Validation result is invalid, schemas must exist for a pathToItem") + } + val propertySchema: JsonSchema<*> = schemas.entries.iterator().next().key + val propertyInstance: Any? = propertySchema.getNewInstance(value, propertyPathToItem, pathToSchemas) + properties[propertyName] = propertyInstance + } + val castProperties: FrozenMap = FrozenMap(properties) + return castProperties + } + + @Throws(ValidationException::class) + override fun validate(arg: Map<*, *>, configuration: SchemaConfiguration?): FrozenMap { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validatedPathToSchemas = PathToSchemasMap() + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, LinkedHashSet()) + val pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet) + return getNewInstance(castArg, validationMetadata.pathToItem, pathToSchemasMap) + } + + @Throws(ValidationException::class) + override fun validate(arg: Any?, configuration: SchemaConfiguration?): Any? { + if (arg == null) { + return validate(null, configuration) + } else if (arg is Boolean) { + return validate(arg, configuration) + } else if (arg is Number) { + return validate(arg, configuration) + } else if (arg is String) { + return validate(arg, configuration) + } else if (arg is List<*>) { + return validate(arg, configuration) + } else if (arg is Map<*, *>) { + return validate(arg, configuration) + } + throw ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema") + } + override fun getNewInstance(arg: Any?, pathToItem: List, pathToSchemas: PathToSchemasMap): Any? { + if (arg == null) { + return getNewInstance( null, pathToItem, pathToSchemas) + } else if (arg is Boolean) { + return getNewInstance(arg, pathToItem, pathToSchemas) + } else if (arg is Number) { + return getNewInstance(arg, pathToItem, pathToSchemas) + } else if (arg is String) { + return getNewInstance(arg, pathToItem, pathToSchemas) + } else if (arg is List<*>) { + return getNewInstance(arg, pathToItem, pathToSchemas) + } else if (arg is Map<*, *>) { + return getNewInstance(arg, pathToItem, pathToSchemas) + } + throw RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema") + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: Nothing?, configuration: SchemaConfiguration?): ByNumber1BoxedVoid { + return ByNumber1BoxedVoid(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: Boolean, configuration: SchemaConfiguration?): ByNumber1BoxedBoolean { + return ByNumber1BoxedBoolean(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: Number, configuration: SchemaConfiguration?): ByNumber1BoxedNumber { + return ByNumber1BoxedNumber(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: String, configuration: SchemaConfiguration?): ByNumber1BoxedString { + return ByNumber1BoxedString(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: List<*>, configuration: SchemaConfiguration?): ByNumber1BoxedList { + return ByNumber1BoxedList(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: Map<*, *>, configuration: SchemaConfiguration?): ByNumber1BoxedMap { + return ByNumber1BoxedMap(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: Any?, configuration: SchemaConfiguration?): ByNumber1Boxed { + if (arg == null) { + return validateAndBox(null, configuration) + } else if (arg is Boolean) { + return validateAndBox(arg, configuration) + } else if (arg is String) { + return validateAndBox(arg, configuration) + } else if (arg is Number) { + return validateAndBox(arg, configuration) + } else if (arg is List<*>) { + return validateAndBox(arg, configuration) + } else if (arg is Map<*, *>) { + return validateAndBox(arg, configuration) + } + throw ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema") + } + } +} diff --git a/samples/client/3_0_3_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/schemas/BySmallNumber.kt b/samples/client/3_0_3_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/schemas/BySmallNumber.kt new file mode 100644 index 00000000000..3f9c9b3ffe9 --- /dev/null +++ b/samples/client/3_0_3_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/schemas/BySmallNumber.kt @@ -0,0 +1,309 @@ +package org.openapijsonschematools.client.components.schemas +import java.math.BigDecimal +import java.time.LocalDate +import java.time.ZonedDateTime +import java.util.UUID +import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags +import org.openapijsonschematools.client.configurations.SchemaConfiguration +import org.openapijsonschematools.client.exceptions.InvalidAdditionalPropertyException +import org.openapijsonschematools.client.exceptions.UnsetPropertyException +import org.openapijsonschematools.client.exceptions.ValidationException +import org.openapijsonschematools.client.schemas.UnsetAddPropsSetter +import org.openapijsonschematools.client.schemas.validation.BooleanSchemaValidator +import org.openapijsonschematools.client.schemas.validation.FrozenList +import org.openapijsonschematools.client.schemas.validation.FrozenMap +import org.openapijsonschematools.client.schemas.validation.JsonSchema +import org.openapijsonschematools.client.schemas.validation.JsonSchemaInfo +import org.openapijsonschematools.client.schemas.validation.ListSchemaValidator +import org.openapijsonschematools.client.schemas.validation.MapSchemaValidator +import org.openapijsonschematools.client.schemas.validation.NullSchemaValidator +import org.openapijsonschematools.client.schemas.validation.NumberSchemaValidator +import org.openapijsonschematools.client.schemas.validation.PathToSchemasMap +import org.openapijsonschematools.client.schemas.validation.StringSchemaValidator +import org.openapijsonschematools.client.schemas.validation.ValidationMetadata + +class BySmallNumber { + // nest classes so all schemas and input/output classes can be public + + + sealed interface BySmallNumber1Boxed { + fun getData(): Any? + } + + data class BySmallNumber1BoxedVoid(val data: Nothing?) : BySmallNumber1Boxed { + override fun getData(): Any? { + return data + } + } + + data class BySmallNumber1BoxedBoolean(val data: Boolean): BySmallNumber1Boxed { + override fun getData(): Any? { + return data + } + } + + data class BySmallNumber1BoxedNumber(val data: Number) : BySmallNumber1Boxed { + override fun getData(): Any? { + return data + } + } + + data class BySmallNumber1BoxedString(val data: String) : BySmallNumber1Boxed { + override fun getData(): Any? { + return data + } + } + + data class BySmallNumber1BoxedList(val data: FrozenList) : BySmallNumber1Boxed { + override fun getData(): Any? { + return data + } + } + + data class BySmallNumber1BoxedMap(val data: FrozenMap) : BySmallNumber1Boxed { + override fun getData(): Any? { + return data + } + } + + + class BySmallNumber1 private constructor(): JsonSchema( + JsonSchemaInfo() + .multipleOf(BigDecimal("0.00010")) + ), NullSchemaValidator, BooleanSchemaValidator, NumberSchemaValidator, StringSchemaValidator, ListSchemaValidator, BySmallNumber1BoxedList>, MapSchemaValidator, BySmallNumber1BoxedMap> { + /* + NOTE: This class is auto generated by OpenAPI JSON Schema Generator. + Ref: https://github.com/openapi-json-schema-tools/openapi-json-schema-generator + + Do not edit the class manually. + */ + + companion object { + @Volatile + private var instance: BySmallNumber1? = null + + fun getInstance() = + instance ?: synchronized(this) { + instance ?: BySmallNumber1().also { instance = it } + } + } + + @Throws(ValidationException::class) + override fun validate(arg: Nothing?, configuration: SchemaConfiguration?): Nothing? { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validatedPathToSchemas = PathToSchemasMap() + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, LinkedHashSet()) + getPathToSchemas(this, castArg, validationMetadata, pathSet) + return castArg + } + + @Throws(ValidationException::class) + override fun validate(arg: Boolean, configuration: SchemaConfiguration?): Boolean { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validatedPathToSchemas = PathToSchemasMap() + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, LinkedHashSet()) + getPathToSchemas(this, castArg, validationMetadata, pathSet) + return castArg + } + + @Throws(ValidationException::class) + override fun validate(arg: Number, configuration: SchemaConfiguration?): Number { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validatedPathToSchemas = PathToSchemasMap() + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, LinkedHashSet()) + getPathToSchemas(this, castArg, validationMetadata, pathSet) + return castArg + } + + @Throws(ValidationException::class) + fun validate(arg: Int, configuration: SchemaConfiguration?): Int { + return validate(arg as Number, configuration) as Int + } + + @Throws(ValidationException::class) + fun validate(arg: Long, configuration: SchemaConfiguration?): Long { + return validate(arg as Number, configuration) as Long + } + + @Throws(ValidationException::class) + fun validate(arg: Float, configuration: SchemaConfiguration?): Float { + return validate(arg as Number, configuration) as Float + } + + @Throws(ValidationException::class) + fun validate(arg: Double, configuration: SchemaConfiguration?): Double { + return validate(arg as Number, configuration) as Double + } + + @Throws(ValidationException::class) + override fun validate(arg: String, configuration: SchemaConfiguration?): String { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validatedPathToSchemas = PathToSchemasMap() + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, LinkedHashSet()) + getPathToSchemas(this, castArg, validationMetadata, pathSet) + return castArg + } + + @Throws(ValidationException::class) + fun validate(arg: LocalDate, configuration: SchemaConfiguration?): String { + return validate(arg.toString(), configuration) + } + + @Throws(ValidationException::class) + fun validate(arg: ZonedDateTime, configuration: SchemaConfiguration?): String { + return validate(arg.toString(), configuration) + } + + @Throws(ValidationException::class) + fun validate(arg: UUID, configuration: SchemaConfiguration?): String { + return validate(arg.toString(), configuration) + } + + override fun getNewInstance(arg: List<*>, pathToItem: List, pathToSchemas: PathToSchemasMap): FrozenList { + val items: MutableList = ArrayList() + var i: Int = 0 + for (item: Any? in arg) { + val itemPathToItem = pathToItem + i + val schemas: LinkedHashMap, Nothing?>? = pathToSchemas.get(itemPathToItem) + if (schemas == null) { + throw RuntimeException("Validation result is invalid, schemas must exist for a pathToItem") + } + val itemSchema: JsonSchema<*> = schemas.entries.iterator().next().key + val itemInstance: Any? = itemSchema.getNewInstance(item, itemPathToItem, pathToSchemas) + items.add(itemInstance) + i += 1 + } + val newInstanceItems: FrozenList = FrozenList(items) + return newInstanceItems + } + + @Throws(ValidationException::class) + override fun validate(arg: List<*>, configuration: SchemaConfiguration?): FrozenList { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, PathToSchemasMap(), LinkedHashSet()) + val pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet) + return getNewInstance(castArg, validationMetadata.pathToItem, pathToSchemasMap) + } + + override fun getNewInstance(arg: Map<*, *>, pathToItem: List, pathToSchemas: PathToSchemasMap): FrozenMap { + val properties: LinkedHashMap = LinkedHashMap() + for((propertyName, value) in arg) { + if (!(propertyName is String)) { + throw RuntimeException("Invalid non-string key value") + } + val propertyPathToItem: List = pathToItem + propertyName + val schemas: LinkedHashMap, Nothing?>? = pathToSchemas.get(propertyPathToItem) + if (schemas == null) { + throw RuntimeException("Validation result is invalid, schemas must exist for a pathToItem") + } + val propertySchema: JsonSchema<*> = schemas.entries.iterator().next().key + val propertyInstance: Any? = propertySchema.getNewInstance(value, propertyPathToItem, pathToSchemas) + properties[propertyName] = propertyInstance + } + val castProperties: FrozenMap = FrozenMap(properties) + return castProperties + } + + @Throws(ValidationException::class) + override fun validate(arg: Map<*, *>, configuration: SchemaConfiguration?): FrozenMap { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validatedPathToSchemas = PathToSchemasMap() + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, LinkedHashSet()) + val pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet) + return getNewInstance(castArg, validationMetadata.pathToItem, pathToSchemasMap) + } + + @Throws(ValidationException::class) + override fun validate(arg: Any?, configuration: SchemaConfiguration?): Any? { + if (arg == null) { + return validate(null, configuration) + } else if (arg is Boolean) { + return validate(arg, configuration) + } else if (arg is Number) { + return validate(arg, configuration) + } else if (arg is String) { + return validate(arg, configuration) + } else if (arg is List<*>) { + return validate(arg, configuration) + } else if (arg is Map<*, *>) { + return validate(arg, configuration) + } + throw ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema") + } + override fun getNewInstance(arg: Any?, pathToItem: List, pathToSchemas: PathToSchemasMap): Any? { + if (arg == null) { + return getNewInstance( null, pathToItem, pathToSchemas) + } else if (arg is Boolean) { + return getNewInstance(arg, pathToItem, pathToSchemas) + } else if (arg is Number) { + return getNewInstance(arg, pathToItem, pathToSchemas) + } else if (arg is String) { + return getNewInstance(arg, pathToItem, pathToSchemas) + } else if (arg is List<*>) { + return getNewInstance(arg, pathToItem, pathToSchemas) + } else if (arg is Map<*, *>) { + return getNewInstance(arg, pathToItem, pathToSchemas) + } + throw RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema") + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: Nothing?, configuration: SchemaConfiguration?): BySmallNumber1BoxedVoid { + return BySmallNumber1BoxedVoid(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: Boolean, configuration: SchemaConfiguration?): BySmallNumber1BoxedBoolean { + return BySmallNumber1BoxedBoolean(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: Number, configuration: SchemaConfiguration?): BySmallNumber1BoxedNumber { + return BySmallNumber1BoxedNumber(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: String, configuration: SchemaConfiguration?): BySmallNumber1BoxedString { + return BySmallNumber1BoxedString(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: List<*>, configuration: SchemaConfiguration?): BySmallNumber1BoxedList { + return BySmallNumber1BoxedList(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: Map<*, *>, configuration: SchemaConfiguration?): BySmallNumber1BoxedMap { + return BySmallNumber1BoxedMap(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: Any?, configuration: SchemaConfiguration?): BySmallNumber1Boxed { + if (arg == null) { + return validateAndBox(null, configuration) + } else if (arg is Boolean) { + return validateAndBox(arg, configuration) + } else if (arg is String) { + return validateAndBox(arg, configuration) + } else if (arg is Number) { + return validateAndBox(arg, configuration) + } else if (arg is List<*>) { + return validateAndBox(arg, configuration) + } else if (arg is Map<*, *>) { + return validateAndBox(arg, configuration) + } + throw ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema") + } + } +} diff --git a/samples/client/3_0_3_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/schemas/DateTimeFormat.kt b/samples/client/3_0_3_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/schemas/DateTimeFormat.kt new file mode 100644 index 00000000000..034656f3583 --- /dev/null +++ b/samples/client/3_0_3_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/schemas/DateTimeFormat.kt @@ -0,0 +1,308 @@ +package org.openapijsonschematools.client.components.schemas +import java.time.LocalDate +import java.time.ZonedDateTime +import java.util.UUID +import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags +import org.openapijsonschematools.client.configurations.SchemaConfiguration +import org.openapijsonschematools.client.exceptions.InvalidAdditionalPropertyException +import org.openapijsonschematools.client.exceptions.UnsetPropertyException +import org.openapijsonschematools.client.exceptions.ValidationException +import org.openapijsonschematools.client.schemas.UnsetAddPropsSetter +import org.openapijsonschematools.client.schemas.validation.BooleanSchemaValidator +import org.openapijsonschematools.client.schemas.validation.FrozenList +import org.openapijsonschematools.client.schemas.validation.FrozenMap +import org.openapijsonschematools.client.schemas.validation.JsonSchema +import org.openapijsonschematools.client.schemas.validation.JsonSchemaInfo +import org.openapijsonschematools.client.schemas.validation.ListSchemaValidator +import org.openapijsonschematools.client.schemas.validation.MapSchemaValidator +import org.openapijsonschematools.client.schemas.validation.NullSchemaValidator +import org.openapijsonschematools.client.schemas.validation.NumberSchemaValidator +import org.openapijsonschematools.client.schemas.validation.PathToSchemasMap +import org.openapijsonschematools.client.schemas.validation.StringSchemaValidator +import org.openapijsonschematools.client.schemas.validation.ValidationMetadata + +class DateTimeFormat { + // nest classes so all schemas and input/output classes can be public + + + sealed interface DateTimeFormat1Boxed { + fun getData(): Any? + } + + data class DateTimeFormat1BoxedVoid(val data: Nothing?) : DateTimeFormat1Boxed { + override fun getData(): Any? { + return data + } + } + + data class DateTimeFormat1BoxedBoolean(val data: Boolean): DateTimeFormat1Boxed { + override fun getData(): Any? { + return data + } + } + + data class DateTimeFormat1BoxedNumber(val data: Number) : DateTimeFormat1Boxed { + override fun getData(): Any? { + return data + } + } + + data class DateTimeFormat1BoxedString(val data: String) : DateTimeFormat1Boxed { + override fun getData(): Any? { + return data + } + } + + data class DateTimeFormat1BoxedList(val data: FrozenList) : DateTimeFormat1Boxed { + override fun getData(): Any? { + return data + } + } + + data class DateTimeFormat1BoxedMap(val data: FrozenMap) : DateTimeFormat1Boxed { + override fun getData(): Any? { + return data + } + } + + + class DateTimeFormat1 private constructor(): JsonSchema( + JsonSchemaInfo() + .format("date-time") + ), NullSchemaValidator, BooleanSchemaValidator, NumberSchemaValidator, StringSchemaValidator, ListSchemaValidator, DateTimeFormat1BoxedList>, MapSchemaValidator, DateTimeFormat1BoxedMap> { + /* + NOTE: This class is auto generated by OpenAPI JSON Schema Generator. + Ref: https://github.com/openapi-json-schema-tools/openapi-json-schema-generator + + Do not edit the class manually. + */ + + companion object { + @Volatile + private var instance: DateTimeFormat1? = null + + fun getInstance() = + instance ?: synchronized(this) { + instance ?: DateTimeFormat1().also { instance = it } + } + } + + @Throws(ValidationException::class) + override fun validate(arg: Nothing?, configuration: SchemaConfiguration?): Nothing? { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validatedPathToSchemas = PathToSchemasMap() + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, LinkedHashSet()) + getPathToSchemas(this, castArg, validationMetadata, pathSet) + return castArg + } + + @Throws(ValidationException::class) + override fun validate(arg: Boolean, configuration: SchemaConfiguration?): Boolean { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validatedPathToSchemas = PathToSchemasMap() + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, LinkedHashSet()) + getPathToSchemas(this, castArg, validationMetadata, pathSet) + return castArg + } + + @Throws(ValidationException::class) + override fun validate(arg: Number, configuration: SchemaConfiguration?): Number { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validatedPathToSchemas = PathToSchemasMap() + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, LinkedHashSet()) + getPathToSchemas(this, castArg, validationMetadata, pathSet) + return castArg + } + + @Throws(ValidationException::class) + fun validate(arg: Int, configuration: SchemaConfiguration?): Int { + return validate(arg as Number, configuration) as Int + } + + @Throws(ValidationException::class) + fun validate(arg: Long, configuration: SchemaConfiguration?): Long { + return validate(arg as Number, configuration) as Long + } + + @Throws(ValidationException::class) + fun validate(arg: Float, configuration: SchemaConfiguration?): Float { + return validate(arg as Number, configuration) as Float + } + + @Throws(ValidationException::class) + fun validate(arg: Double, configuration: SchemaConfiguration?): Double { + return validate(arg as Number, configuration) as Double + } + + @Throws(ValidationException::class) + override fun validate(arg: String, configuration: SchemaConfiguration?): String { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validatedPathToSchemas = PathToSchemasMap() + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, LinkedHashSet()) + getPathToSchemas(this, castArg, validationMetadata, pathSet) + return castArg + } + + @Throws(ValidationException::class) + fun validate(arg: LocalDate, configuration: SchemaConfiguration?): String { + return validate(arg.toString(), configuration) + } + + @Throws(ValidationException::class) + fun validate(arg: ZonedDateTime, configuration: SchemaConfiguration?): String { + return validate(arg.toString(), configuration) + } + + @Throws(ValidationException::class) + fun validate(arg: UUID, configuration: SchemaConfiguration?): String { + return validate(arg.toString(), configuration) + } + + override fun getNewInstance(arg: List<*>, pathToItem: List, pathToSchemas: PathToSchemasMap): FrozenList { + val items: MutableList = ArrayList() + var i: Int = 0 + for (item: Any? in arg) { + val itemPathToItem = pathToItem + i + val schemas: LinkedHashMap, Nothing?>? = pathToSchemas.get(itemPathToItem) + if (schemas == null) { + throw RuntimeException("Validation result is invalid, schemas must exist for a pathToItem") + } + val itemSchema: JsonSchema<*> = schemas.entries.iterator().next().key + val itemInstance: Any? = itemSchema.getNewInstance(item, itemPathToItem, pathToSchemas) + items.add(itemInstance) + i += 1 + } + val newInstanceItems: FrozenList = FrozenList(items) + return newInstanceItems + } + + @Throws(ValidationException::class) + override fun validate(arg: List<*>, configuration: SchemaConfiguration?): FrozenList { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, PathToSchemasMap(), LinkedHashSet()) + val pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet) + return getNewInstance(castArg, validationMetadata.pathToItem, pathToSchemasMap) + } + + override fun getNewInstance(arg: Map<*, *>, pathToItem: List, pathToSchemas: PathToSchemasMap): FrozenMap { + val properties: LinkedHashMap = LinkedHashMap() + for((propertyName, value) in arg) { + if (!(propertyName is String)) { + throw RuntimeException("Invalid non-string key value") + } + val propertyPathToItem: List = pathToItem + propertyName + val schemas: LinkedHashMap, Nothing?>? = pathToSchemas.get(propertyPathToItem) + if (schemas == null) { + throw RuntimeException("Validation result is invalid, schemas must exist for a pathToItem") + } + val propertySchema: JsonSchema<*> = schemas.entries.iterator().next().key + val propertyInstance: Any? = propertySchema.getNewInstance(value, propertyPathToItem, pathToSchemas) + properties[propertyName] = propertyInstance + } + val castProperties: FrozenMap = FrozenMap(properties) + return castProperties + } + + @Throws(ValidationException::class) + override fun validate(arg: Map<*, *>, configuration: SchemaConfiguration?): FrozenMap { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validatedPathToSchemas = PathToSchemasMap() + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, LinkedHashSet()) + val pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet) + return getNewInstance(castArg, validationMetadata.pathToItem, pathToSchemasMap) + } + + @Throws(ValidationException::class) + override fun validate(arg: Any?, configuration: SchemaConfiguration?): Any? { + if (arg == null) { + return validate(null, configuration) + } else if (arg is Boolean) { + return validate(arg, configuration) + } else if (arg is Number) { + return validate(arg, configuration) + } else if (arg is String) { + return validate(arg, configuration) + } else if (arg is List<*>) { + return validate(arg, configuration) + } else if (arg is Map<*, *>) { + return validate(arg, configuration) + } + throw ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema") + } + override fun getNewInstance(arg: Any?, pathToItem: List, pathToSchemas: PathToSchemasMap): Any? { + if (arg == null) { + return getNewInstance( null, pathToItem, pathToSchemas) + } else if (arg is Boolean) { + return getNewInstance(arg, pathToItem, pathToSchemas) + } else if (arg is Number) { + return getNewInstance(arg, pathToItem, pathToSchemas) + } else if (arg is String) { + return getNewInstance(arg, pathToItem, pathToSchemas) + } else if (arg is List<*>) { + return getNewInstance(arg, pathToItem, pathToSchemas) + } else if (arg is Map<*, *>) { + return getNewInstance(arg, pathToItem, pathToSchemas) + } + throw RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema") + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: Nothing?, configuration: SchemaConfiguration?): DateTimeFormat1BoxedVoid { + return DateTimeFormat1BoxedVoid(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: Boolean, configuration: SchemaConfiguration?): DateTimeFormat1BoxedBoolean { + return DateTimeFormat1BoxedBoolean(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: Number, configuration: SchemaConfiguration?): DateTimeFormat1BoxedNumber { + return DateTimeFormat1BoxedNumber(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: String, configuration: SchemaConfiguration?): DateTimeFormat1BoxedString { + return DateTimeFormat1BoxedString(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: List<*>, configuration: SchemaConfiguration?): DateTimeFormat1BoxedList { + return DateTimeFormat1BoxedList(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: Map<*, *>, configuration: SchemaConfiguration?): DateTimeFormat1BoxedMap { + return DateTimeFormat1BoxedMap(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: Any?, configuration: SchemaConfiguration?): DateTimeFormat1Boxed { + if (arg == null) { + return validateAndBox(null, configuration) + } else if (arg is Boolean) { + return validateAndBox(arg, configuration) + } else if (arg is String) { + return validateAndBox(arg, configuration) + } else if (arg is Number) { + return validateAndBox(arg, configuration) + } else if (arg is List<*>) { + return validateAndBox(arg, configuration) + } else if (arg is Map<*, *>) { + return validateAndBox(arg, configuration) + } + throw ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema") + } + } +} diff --git a/samples/client/3_0_3_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/schemas/EmailFormat.kt b/samples/client/3_0_3_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/schemas/EmailFormat.kt new file mode 100644 index 00000000000..ed88a6dc0c5 --- /dev/null +++ b/samples/client/3_0_3_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/schemas/EmailFormat.kt @@ -0,0 +1,308 @@ +package org.openapijsonschematools.client.components.schemas +import java.time.LocalDate +import java.time.ZonedDateTime +import java.util.UUID +import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags +import org.openapijsonschematools.client.configurations.SchemaConfiguration +import org.openapijsonschematools.client.exceptions.InvalidAdditionalPropertyException +import org.openapijsonschematools.client.exceptions.UnsetPropertyException +import org.openapijsonschematools.client.exceptions.ValidationException +import org.openapijsonschematools.client.schemas.UnsetAddPropsSetter +import org.openapijsonschematools.client.schemas.validation.BooleanSchemaValidator +import org.openapijsonschematools.client.schemas.validation.FrozenList +import org.openapijsonschematools.client.schemas.validation.FrozenMap +import org.openapijsonschematools.client.schemas.validation.JsonSchema +import org.openapijsonschematools.client.schemas.validation.JsonSchemaInfo +import org.openapijsonschematools.client.schemas.validation.ListSchemaValidator +import org.openapijsonschematools.client.schemas.validation.MapSchemaValidator +import org.openapijsonschematools.client.schemas.validation.NullSchemaValidator +import org.openapijsonschematools.client.schemas.validation.NumberSchemaValidator +import org.openapijsonschematools.client.schemas.validation.PathToSchemasMap +import org.openapijsonschematools.client.schemas.validation.StringSchemaValidator +import org.openapijsonschematools.client.schemas.validation.ValidationMetadata + +class EmailFormat { + // nest classes so all schemas and input/output classes can be public + + + sealed interface EmailFormat1Boxed { + fun getData(): Any? + } + + data class EmailFormat1BoxedVoid(val data: Nothing?) : EmailFormat1Boxed { + override fun getData(): Any? { + return data + } + } + + data class EmailFormat1BoxedBoolean(val data: Boolean): EmailFormat1Boxed { + override fun getData(): Any? { + return data + } + } + + data class EmailFormat1BoxedNumber(val data: Number) : EmailFormat1Boxed { + override fun getData(): Any? { + return data + } + } + + data class EmailFormat1BoxedString(val data: String) : EmailFormat1Boxed { + override fun getData(): Any? { + return data + } + } + + data class EmailFormat1BoxedList(val data: FrozenList) : EmailFormat1Boxed { + override fun getData(): Any? { + return data + } + } + + data class EmailFormat1BoxedMap(val data: FrozenMap) : EmailFormat1Boxed { + override fun getData(): Any? { + return data + } + } + + + class EmailFormat1 private constructor(): JsonSchema( + JsonSchemaInfo() + .format("email") + ), NullSchemaValidator, BooleanSchemaValidator, NumberSchemaValidator, StringSchemaValidator, ListSchemaValidator, EmailFormat1BoxedList>, MapSchemaValidator, EmailFormat1BoxedMap> { + /* + NOTE: This class is auto generated by OpenAPI JSON Schema Generator. + Ref: https://github.com/openapi-json-schema-tools/openapi-json-schema-generator + + Do not edit the class manually. + */ + + companion object { + @Volatile + private var instance: EmailFormat1? = null + + fun getInstance() = + instance ?: synchronized(this) { + instance ?: EmailFormat1().also { instance = it } + } + } + + @Throws(ValidationException::class) + override fun validate(arg: Nothing?, configuration: SchemaConfiguration?): Nothing? { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validatedPathToSchemas = PathToSchemasMap() + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, LinkedHashSet()) + getPathToSchemas(this, castArg, validationMetadata, pathSet) + return castArg + } + + @Throws(ValidationException::class) + override fun validate(arg: Boolean, configuration: SchemaConfiguration?): Boolean { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validatedPathToSchemas = PathToSchemasMap() + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, LinkedHashSet()) + getPathToSchemas(this, castArg, validationMetadata, pathSet) + return castArg + } + + @Throws(ValidationException::class) + override fun validate(arg: Number, configuration: SchemaConfiguration?): Number { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validatedPathToSchemas = PathToSchemasMap() + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, LinkedHashSet()) + getPathToSchemas(this, castArg, validationMetadata, pathSet) + return castArg + } + + @Throws(ValidationException::class) + fun validate(arg: Int, configuration: SchemaConfiguration?): Int { + return validate(arg as Number, configuration) as Int + } + + @Throws(ValidationException::class) + fun validate(arg: Long, configuration: SchemaConfiguration?): Long { + return validate(arg as Number, configuration) as Long + } + + @Throws(ValidationException::class) + fun validate(arg: Float, configuration: SchemaConfiguration?): Float { + return validate(arg as Number, configuration) as Float + } + + @Throws(ValidationException::class) + fun validate(arg: Double, configuration: SchemaConfiguration?): Double { + return validate(arg as Number, configuration) as Double + } + + @Throws(ValidationException::class) + override fun validate(arg: String, configuration: SchemaConfiguration?): String { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validatedPathToSchemas = PathToSchemasMap() + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, LinkedHashSet()) + getPathToSchemas(this, castArg, validationMetadata, pathSet) + return castArg + } + + @Throws(ValidationException::class) + fun validate(arg: LocalDate, configuration: SchemaConfiguration?): String { + return validate(arg.toString(), configuration) + } + + @Throws(ValidationException::class) + fun validate(arg: ZonedDateTime, configuration: SchemaConfiguration?): String { + return validate(arg.toString(), configuration) + } + + @Throws(ValidationException::class) + fun validate(arg: UUID, configuration: SchemaConfiguration?): String { + return validate(arg.toString(), configuration) + } + + override fun getNewInstance(arg: List<*>, pathToItem: List, pathToSchemas: PathToSchemasMap): FrozenList { + val items: MutableList = ArrayList() + var i: Int = 0 + for (item: Any? in arg) { + val itemPathToItem = pathToItem + i + val schemas: LinkedHashMap, Nothing?>? = pathToSchemas.get(itemPathToItem) + if (schemas == null) { + throw RuntimeException("Validation result is invalid, schemas must exist for a pathToItem") + } + val itemSchema: JsonSchema<*> = schemas.entries.iterator().next().key + val itemInstance: Any? = itemSchema.getNewInstance(item, itemPathToItem, pathToSchemas) + items.add(itemInstance) + i += 1 + } + val newInstanceItems: FrozenList = FrozenList(items) + return newInstanceItems + } + + @Throws(ValidationException::class) + override fun validate(arg: List<*>, configuration: SchemaConfiguration?): FrozenList { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, PathToSchemasMap(), LinkedHashSet()) + val pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet) + return getNewInstance(castArg, validationMetadata.pathToItem, pathToSchemasMap) + } + + override fun getNewInstance(arg: Map<*, *>, pathToItem: List, pathToSchemas: PathToSchemasMap): FrozenMap { + val properties: LinkedHashMap = LinkedHashMap() + for((propertyName, value) in arg) { + if (!(propertyName is String)) { + throw RuntimeException("Invalid non-string key value") + } + val propertyPathToItem: List = pathToItem + propertyName + val schemas: LinkedHashMap, Nothing?>? = pathToSchemas.get(propertyPathToItem) + if (schemas == null) { + throw RuntimeException("Validation result is invalid, schemas must exist for a pathToItem") + } + val propertySchema: JsonSchema<*> = schemas.entries.iterator().next().key + val propertyInstance: Any? = propertySchema.getNewInstance(value, propertyPathToItem, pathToSchemas) + properties[propertyName] = propertyInstance + } + val castProperties: FrozenMap = FrozenMap(properties) + return castProperties + } + + @Throws(ValidationException::class) + override fun validate(arg: Map<*, *>, configuration: SchemaConfiguration?): FrozenMap { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validatedPathToSchemas = PathToSchemasMap() + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, LinkedHashSet()) + val pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet) + return getNewInstance(castArg, validationMetadata.pathToItem, pathToSchemasMap) + } + + @Throws(ValidationException::class) + override fun validate(arg: Any?, configuration: SchemaConfiguration?): Any? { + if (arg == null) { + return validate(null, configuration) + } else if (arg is Boolean) { + return validate(arg, configuration) + } else if (arg is Number) { + return validate(arg, configuration) + } else if (arg is String) { + return validate(arg, configuration) + } else if (arg is List<*>) { + return validate(arg, configuration) + } else if (arg is Map<*, *>) { + return validate(arg, configuration) + } + throw ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema") + } + override fun getNewInstance(arg: Any?, pathToItem: List, pathToSchemas: PathToSchemasMap): Any? { + if (arg == null) { + return getNewInstance( null, pathToItem, pathToSchemas) + } else if (arg is Boolean) { + return getNewInstance(arg, pathToItem, pathToSchemas) + } else if (arg is Number) { + return getNewInstance(arg, pathToItem, pathToSchemas) + } else if (arg is String) { + return getNewInstance(arg, pathToItem, pathToSchemas) + } else if (arg is List<*>) { + return getNewInstance(arg, pathToItem, pathToSchemas) + } else if (arg is Map<*, *>) { + return getNewInstance(arg, pathToItem, pathToSchemas) + } + throw RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema") + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: Nothing?, configuration: SchemaConfiguration?): EmailFormat1BoxedVoid { + return EmailFormat1BoxedVoid(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: Boolean, configuration: SchemaConfiguration?): EmailFormat1BoxedBoolean { + return EmailFormat1BoxedBoolean(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: Number, configuration: SchemaConfiguration?): EmailFormat1BoxedNumber { + return EmailFormat1BoxedNumber(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: String, configuration: SchemaConfiguration?): EmailFormat1BoxedString { + return EmailFormat1BoxedString(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: List<*>, configuration: SchemaConfiguration?): EmailFormat1BoxedList { + return EmailFormat1BoxedList(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: Map<*, *>, configuration: SchemaConfiguration?): EmailFormat1BoxedMap { + return EmailFormat1BoxedMap(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: Any?, configuration: SchemaConfiguration?): EmailFormat1Boxed { + if (arg == null) { + return validateAndBox(null, configuration) + } else if (arg is Boolean) { + return validateAndBox(arg, configuration) + } else if (arg is String) { + return validateAndBox(arg, configuration) + } else if (arg is Number) { + return validateAndBox(arg, configuration) + } else if (arg is List<*>) { + return validateAndBox(arg, configuration) + } else if (arg is Map<*, *>) { + return validateAndBox(arg, configuration) + } + throw ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema") + } + } +} diff --git a/samples/client/3_0_3_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/schemas/EnumWith0DoesNotMatchFalse.kt b/samples/client/3_0_3_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/schemas/EnumWith0DoesNotMatchFalse.kt new file mode 100644 index 00000000000..5d94f419354 --- /dev/null +++ b/samples/client/3_0_3_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/schemas/EnumWith0DoesNotMatchFalse.kt @@ -0,0 +1,173 @@ +package org.openapijsonschematools.client.components.schemas +import java.math.BigDecimal +import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags +import org.openapijsonschematools.client.configurations.SchemaConfiguration +import org.openapijsonschematools.client.exceptions.ValidationException +import org.openapijsonschematools.client.schemas.validation.DoubleEnumValidator +import org.openapijsonschematools.client.schemas.validation.DoubleValueMethod +import org.openapijsonschematools.client.schemas.validation.FloatEnumValidator +import org.openapijsonschematools.client.schemas.validation.FloatValueMethod +import org.openapijsonschematools.client.schemas.validation.IntegerEnumValidator +import org.openapijsonschematools.client.schemas.validation.IntegerValueMethod +import org.openapijsonschematools.client.schemas.validation.JsonSchema +import org.openapijsonschematools.client.schemas.validation.JsonSchemaInfo +import org.openapijsonschematools.client.schemas.validation.LongEnumValidator +import org.openapijsonschematools.client.schemas.validation.LongValueMethod +import org.openapijsonschematools.client.schemas.validation.NumberSchemaValidator +import org.openapijsonschematools.client.schemas.validation.PathToSchemasMap +import org.openapijsonschematools.client.schemas.validation.ValidationMetadata + +class EnumWith0DoesNotMatchFalse { + // nest classes so all schemas and input/output classes can be public + + enum class IntegerEnumWith0DoesNotMatchFalseEnums(private val value: Int): IntegerValueMethod { + POSITIVE_0(0); + + override fun value(): Int { + return this.value + } + } + + enum class LongEnumWith0DoesNotMatchFalseEnums(private val value: Long): LongValueMethod { + POSITIVE_0(0L); + + override fun value(): Long { + return this.value + } + } + + enum class FloatEnumWith0DoesNotMatchFalseEnums(private val value: Float): FloatValueMethod { + POSITIVE_0(0.0f); + + override fun value(): Float { + return this.value + } + } + + enum class DoubleEnumWith0DoesNotMatchFalseEnums(private val value: Double): DoubleValueMethod { + POSITIVE_0(0.0); + + override fun value(): Double { + return this.value + } + } + + + sealed interface EnumWith0DoesNotMatchFalse1Boxed { + fun getData(): Any? + } + + data class EnumWith0DoesNotMatchFalse1BoxedNumber(val data: Number) : EnumWith0DoesNotMatchFalse1Boxed { + override fun getData(): Any? { + return data + } + } + + + + class EnumWith0DoesNotMatchFalse1 private constructor(): JsonSchema( + JsonSchemaInfo() + .type(setOf( + Int::class.java, + Long::class.java, + Float::class.java, + Double::class.java + )) + .enumValues(setOf( + BigDecimal("0") + )) + ), IntegerEnumValidator, LongEnumValidator, FloatEnumValidator, DoubleEnumValidator, NumberSchemaValidator { + /* + NOTE: This class is auto generated by OpenAPI JSON Schema Generator. + Ref: https://github.com/openapi-json-schema-tools/openapi-json-schema-generator + + Do not edit the class manually. + */ + + companion object { + @Volatile + private var instance: EnumWith0DoesNotMatchFalse1? = null + + fun getInstance() = + instance ?: synchronized(this) { + instance ?: EnumWith0DoesNotMatchFalse1().also { instance = it } + } + } + + @Throws(ValidationException::class) + override fun validate(arg: Number, configuration: SchemaConfiguration?): Number { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, PathToSchemasMap(), LinkedHashSet()) + val pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet) + return castArg + } + + @Throws(ValidationException::class) + fun validate(arg: Int, configuration: SchemaConfiguration?): Int { + return validate(arg as Number, configuration) as Int + } + + @Throws(ValidationException::class) + fun validate(arg: Long, configuration: SchemaConfiguration?): Long { + return validate(arg as Number, configuration) as Long + } + + @Throws(ValidationException::class) + fun validate(arg: Float, configuration: SchemaConfiguration?): Float { + return validate(arg as Number, configuration) as Float + } + + @Throws(ValidationException::class) + fun validate(arg: Double, configuration: SchemaConfiguration?): Double { + return validate(arg as Number, configuration) as Double + } + + @Throws(ValidationException::class) + override fun validate(arg: IntegerEnumWith0DoesNotMatchFalseEnums, configuration: SchemaConfiguration?): Int { + return validate(arg.value() as Number, configuration) as Int + } + + @Throws(ValidationException::class) + override fun validate(arg: LongEnumWith0DoesNotMatchFalseEnums, configuration: SchemaConfiguration?): Long { + return validate(arg.value() as Number, configuration) as Long + } + + @Throws(ValidationException::class) + override fun validate(arg: FloatEnumWith0DoesNotMatchFalseEnums, configuration: SchemaConfiguration?): Float { + return validate(arg.value() as Number, configuration) as Float + } + + @Throws(ValidationException::class) + override fun validate(arg: DoubleEnumWith0DoesNotMatchFalseEnums, configuration: SchemaConfiguration?): Double { + return validate(arg.value() as Number, configuration) as Double + } + + @Throws(ValidationException::class) + override fun validate(arg: Any?, configuration: SchemaConfiguration?): Any? { + if (arg is Number) { + return validate(arg, configuration) + } + throw ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema") + } + override fun getNewInstance(arg: Any?, pathToItem: List, pathToSchemas: PathToSchemasMap): Any? { + if (arg is Number) { + return getNewInstance(arg, pathToItem, pathToSchemas) + } + throw RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema") + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: Number, configuration: SchemaConfiguration?): EnumWith0DoesNotMatchFalse1BoxedNumber { + return EnumWith0DoesNotMatchFalse1BoxedNumber(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: Any?, configuration: SchemaConfiguration?): EnumWith0DoesNotMatchFalse1Boxed { + if (arg is Number) { + return validateAndBox(arg, configuration) + } + throw ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema") + } + } +} diff --git a/samples/client/3_0_3_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/schemas/EnumWith1DoesNotMatchTrue.kt b/samples/client/3_0_3_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/schemas/EnumWith1DoesNotMatchTrue.kt new file mode 100644 index 00000000000..7397d4f728e --- /dev/null +++ b/samples/client/3_0_3_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/schemas/EnumWith1DoesNotMatchTrue.kt @@ -0,0 +1,173 @@ +package org.openapijsonschematools.client.components.schemas +import java.math.BigDecimal +import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags +import org.openapijsonschematools.client.configurations.SchemaConfiguration +import org.openapijsonschematools.client.exceptions.ValidationException +import org.openapijsonschematools.client.schemas.validation.DoubleEnumValidator +import org.openapijsonschematools.client.schemas.validation.DoubleValueMethod +import org.openapijsonschematools.client.schemas.validation.FloatEnumValidator +import org.openapijsonschematools.client.schemas.validation.FloatValueMethod +import org.openapijsonschematools.client.schemas.validation.IntegerEnumValidator +import org.openapijsonschematools.client.schemas.validation.IntegerValueMethod +import org.openapijsonschematools.client.schemas.validation.JsonSchema +import org.openapijsonschematools.client.schemas.validation.JsonSchemaInfo +import org.openapijsonschematools.client.schemas.validation.LongEnumValidator +import org.openapijsonschematools.client.schemas.validation.LongValueMethod +import org.openapijsonschematools.client.schemas.validation.NumberSchemaValidator +import org.openapijsonschematools.client.schemas.validation.PathToSchemasMap +import org.openapijsonschematools.client.schemas.validation.ValidationMetadata + +class EnumWith1DoesNotMatchTrue { + // nest classes so all schemas and input/output classes can be public + + enum class IntegerEnumWith1DoesNotMatchTrueEnums(private val value: Int): IntegerValueMethod { + POSITIVE_1(1); + + override fun value(): Int { + return this.value + } + } + + enum class LongEnumWith1DoesNotMatchTrueEnums(private val value: Long): LongValueMethod { + POSITIVE_1(1L); + + override fun value(): Long { + return this.value + } + } + + enum class FloatEnumWith1DoesNotMatchTrueEnums(private val value: Float): FloatValueMethod { + POSITIVE_1(1.0f); + + override fun value(): Float { + return this.value + } + } + + enum class DoubleEnumWith1DoesNotMatchTrueEnums(private val value: Double): DoubleValueMethod { + POSITIVE_1(1.0); + + override fun value(): Double { + return this.value + } + } + + + sealed interface EnumWith1DoesNotMatchTrue1Boxed { + fun getData(): Any? + } + + data class EnumWith1DoesNotMatchTrue1BoxedNumber(val data: Number) : EnumWith1DoesNotMatchTrue1Boxed { + override fun getData(): Any? { + return data + } + } + + + + class EnumWith1DoesNotMatchTrue1 private constructor(): JsonSchema( + JsonSchemaInfo() + .type(setOf( + Int::class.java, + Long::class.java, + Float::class.java, + Double::class.java + )) + .enumValues(setOf( + BigDecimal("1") + )) + ), IntegerEnumValidator, LongEnumValidator, FloatEnumValidator, DoubleEnumValidator, NumberSchemaValidator { + /* + NOTE: This class is auto generated by OpenAPI JSON Schema Generator. + Ref: https://github.com/openapi-json-schema-tools/openapi-json-schema-generator + + Do not edit the class manually. + */ + + companion object { + @Volatile + private var instance: EnumWith1DoesNotMatchTrue1? = null + + fun getInstance() = + instance ?: synchronized(this) { + instance ?: EnumWith1DoesNotMatchTrue1().also { instance = it } + } + } + + @Throws(ValidationException::class) + override fun validate(arg: Number, configuration: SchemaConfiguration?): Number { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, PathToSchemasMap(), LinkedHashSet()) + val pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet) + return castArg + } + + @Throws(ValidationException::class) + fun validate(arg: Int, configuration: SchemaConfiguration?): Int { + return validate(arg as Number, configuration) as Int + } + + @Throws(ValidationException::class) + fun validate(arg: Long, configuration: SchemaConfiguration?): Long { + return validate(arg as Number, configuration) as Long + } + + @Throws(ValidationException::class) + fun validate(arg: Float, configuration: SchemaConfiguration?): Float { + return validate(arg as Number, configuration) as Float + } + + @Throws(ValidationException::class) + fun validate(arg: Double, configuration: SchemaConfiguration?): Double { + return validate(arg as Number, configuration) as Double + } + + @Throws(ValidationException::class) + override fun validate(arg: IntegerEnumWith1DoesNotMatchTrueEnums, configuration: SchemaConfiguration?): Int { + return validate(arg.value() as Number, configuration) as Int + } + + @Throws(ValidationException::class) + override fun validate(arg: LongEnumWith1DoesNotMatchTrueEnums, configuration: SchemaConfiguration?): Long { + return validate(arg.value() as Number, configuration) as Long + } + + @Throws(ValidationException::class) + override fun validate(arg: FloatEnumWith1DoesNotMatchTrueEnums, configuration: SchemaConfiguration?): Float { + return validate(arg.value() as Number, configuration) as Float + } + + @Throws(ValidationException::class) + override fun validate(arg: DoubleEnumWith1DoesNotMatchTrueEnums, configuration: SchemaConfiguration?): Double { + return validate(arg.value() as Number, configuration) as Double + } + + @Throws(ValidationException::class) + override fun validate(arg: Any?, configuration: SchemaConfiguration?): Any? { + if (arg is Number) { + return validate(arg, configuration) + } + throw ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema") + } + override fun getNewInstance(arg: Any?, pathToItem: List, pathToSchemas: PathToSchemasMap): Any? { + if (arg is Number) { + return getNewInstance(arg, pathToItem, pathToSchemas) + } + throw RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema") + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: Number, configuration: SchemaConfiguration?): EnumWith1DoesNotMatchTrue1BoxedNumber { + return EnumWith1DoesNotMatchTrue1BoxedNumber(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: Any?, configuration: SchemaConfiguration?): EnumWith1DoesNotMatchTrue1Boxed { + if (arg is Number) { + return validateAndBox(arg, configuration) + } + throw ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema") + } + } +} diff --git a/samples/client/3_0_3_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/schemas/EnumWithEscapedCharacters.kt b/samples/client/3_0_3_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/schemas/EnumWithEscapedCharacters.kt new file mode 100644 index 00000000000..4624e048623 --- /dev/null +++ b/samples/client/3_0_3_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/schemas/EnumWithEscapedCharacters.kt @@ -0,0 +1,106 @@ +package org.openapijsonschematools.client.components.schemas +import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags +import org.openapijsonschematools.client.configurations.SchemaConfiguration +import org.openapijsonschematools.client.exceptions.ValidationException +import org.openapijsonschematools.client.schemas.validation.JsonSchema +import org.openapijsonschematools.client.schemas.validation.JsonSchemaInfo +import org.openapijsonschematools.client.schemas.validation.PathToSchemasMap +import org.openapijsonschematools.client.schemas.validation.StringEnumValidator +import org.openapijsonschematools.client.schemas.validation.StringSchemaValidator +import org.openapijsonschematools.client.schemas.validation.StringValueMethod +import org.openapijsonschematools.client.schemas.validation.ValidationMetadata + +class EnumWithEscapedCharacters { + // nest classes so all schemas and input/output classes can be public + + enum class StringEnumWithEscapedCharactersEnums(private val value: String): StringValueMethod { + FOO_LINE_FEED_LF_BAR("foo\nbar"), + FOO_CARRIAGE_RETURN_CR_BAR("foo\rbar"); + + override fun value(): String { + return this.value + } + } + + + sealed interface EnumWithEscapedCharacters1Boxed { + fun getData(): Any? + } + + data class EnumWithEscapedCharacters1BoxedString(val data: String) : EnumWithEscapedCharacters1Boxed { + override fun getData(): Any? { + return data + } + } + + + + class EnumWithEscapedCharacters1 private constructor(): JsonSchema( + JsonSchemaInfo() + .type(setOf( + String::class.java + )) + .enumValues(setOf( + "foo\nbar", + "foo\rbar" + )) + ), StringSchemaValidator, StringEnumValidator { + /* + NOTE: This class is auto generated by OpenAPI JSON Schema Generator. + Ref: https://github.com/openapi-json-schema-tools/openapi-json-schema-generator + + Do not edit the class manually. + */ + + companion object { + @Volatile + private var instance: EnumWithEscapedCharacters1? = null + + fun getInstance() = + instance ?: synchronized(this) { + instance ?: EnumWithEscapedCharacters1().also { instance = it } + } + } + + @Throws(ValidationException::class) + override fun validate(arg: String, configuration: SchemaConfiguration?): String { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, PathToSchemasMap(), LinkedHashSet()) + getPathToSchemas(this, castArg, validationMetadata, pathSet) + return castArg + } + + @Throws(ValidationException::class) + override fun validate(arg: StringEnumWithEscapedCharactersEnums, configuration: SchemaConfiguration?): String { + return validate(arg.value(), configuration) + } + + @Throws(ValidationException::class) + override fun validate(arg: Any?, configuration: SchemaConfiguration?): Any? { + if (arg is String) { + return validate(arg, configuration) + } + throw ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema") + } + override fun getNewInstance(arg: Any?, pathToItem: List, pathToSchemas: PathToSchemasMap): Any? { + if (arg is String) { + return getNewInstance(arg, pathToItem, pathToSchemas) + } + throw RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema") + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: String, configuration: SchemaConfiguration?): EnumWithEscapedCharacters1BoxedString { + return EnumWithEscapedCharacters1BoxedString(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: Any?, configuration: SchemaConfiguration?): EnumWithEscapedCharacters1Boxed { + if (arg is String) { + return validateAndBox(arg, configuration) + } + throw ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema") + } + } +} diff --git a/samples/client/3_0_3_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/schemas/EnumWithFalseDoesNotMatch0.kt b/samples/client/3_0_3_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/schemas/EnumWithFalseDoesNotMatch0.kt new file mode 100644 index 00000000000..bfc0dd03800 --- /dev/null +++ b/samples/client/3_0_3_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/schemas/EnumWithFalseDoesNotMatch0.kt @@ -0,0 +1,102 @@ +package org.openapijsonschematools.client.components.schemas +import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags +import org.openapijsonschematools.client.configurations.SchemaConfiguration +import org.openapijsonschematools.client.exceptions.ValidationException +import org.openapijsonschematools.client.schemas.validation.BooleanEnumValidator +import org.openapijsonschematools.client.schemas.validation.BooleanSchemaValidator +import org.openapijsonschematools.client.schemas.validation.BooleanValueMethod +import org.openapijsonschematools.client.schemas.validation.JsonSchema +import org.openapijsonschematools.client.schemas.validation.JsonSchemaInfo +import org.openapijsonschematools.client.schemas.validation.PathToSchemasMap +import org.openapijsonschematools.client.schemas.validation.ValidationMetadata + +class EnumWithFalseDoesNotMatch0 { + // nest classes so all schemas and input/output classes can be public + + enum class BooleanEnumWithFalseDoesNotMatch0Enums(private val value: Boolean): BooleanValueMethod { + FALSE(false); + + override fun value(): Boolean { + return this.value + } + } + + + sealed interface EnumWithFalseDoesNotMatch01Boxed { + fun getData(): Any? + } + + data class EnumWithFalseDoesNotMatch01BoxedBoolean(val data: Boolean): EnumWithFalseDoesNotMatch01Boxed { + override fun getData(): Any? { + return data + } + } + + + + class EnumWithFalseDoesNotMatch01 private constructor(): JsonSchema( + JsonSchemaInfo() + .type(setOf(Boolean::class.java)) + .enumValues(setOf( + false + )) + ), BooleanSchemaValidator, BooleanEnumValidator { + /* + NOTE: This class is auto generated by OpenAPI JSON Schema Generator. + Ref: https://github.com/openapi-json-schema-tools/openapi-json-schema-generator + + Do not edit the class manually. + */ + + companion object { + @Volatile + private var instance: EnumWithFalseDoesNotMatch01? = null + + fun getInstance() = + instance ?: synchronized(this) { + instance ?: EnumWithFalseDoesNotMatch01().also { instance = it } + } + } + + @Throws(ValidationException::class) + override fun validate(arg: Boolean, configuration: SchemaConfiguration?): Boolean { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, PathToSchemasMap(), LinkedHashSet()) + getPathToSchemas(this, castArg, validationMetadata, pathSet) + return castArg + } + + @Throws(ValidationException::class) + override fun validate(arg: BooleanEnumWithFalseDoesNotMatch0Enums, configuration: SchemaConfiguration?): Boolean { + return validate(arg.value(), configuration) + } + + @Throws(ValidationException::class) + override fun validate(arg: Any?, configuration: SchemaConfiguration?): Any? { + if (arg is Boolean) { + return validate(arg, configuration) + } + throw ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema") + } + override fun getNewInstance(arg: Any?, pathToItem: List, pathToSchemas: PathToSchemasMap): Any? { + if (arg is Boolean) { + return getNewInstance(arg, pathToItem, pathToSchemas) + } + throw RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema") + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: Boolean, configuration: SchemaConfiguration?): EnumWithFalseDoesNotMatch01BoxedBoolean { + return EnumWithFalseDoesNotMatch01BoxedBoolean(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: Any?, configuration: SchemaConfiguration?): EnumWithFalseDoesNotMatch01Boxed { + if (arg is Boolean) { + return validateAndBox(arg, configuration) + } + throw ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema") + } + } +} diff --git a/samples/client/3_0_3_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/schemas/EnumWithTrueDoesNotMatch1.kt b/samples/client/3_0_3_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/schemas/EnumWithTrueDoesNotMatch1.kt new file mode 100644 index 00000000000..2df59f8e594 --- /dev/null +++ b/samples/client/3_0_3_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/schemas/EnumWithTrueDoesNotMatch1.kt @@ -0,0 +1,102 @@ +package org.openapijsonschematools.client.components.schemas +import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags +import org.openapijsonschematools.client.configurations.SchemaConfiguration +import org.openapijsonschematools.client.exceptions.ValidationException +import org.openapijsonschematools.client.schemas.validation.BooleanEnumValidator +import org.openapijsonschematools.client.schemas.validation.BooleanSchemaValidator +import org.openapijsonschematools.client.schemas.validation.BooleanValueMethod +import org.openapijsonschematools.client.schemas.validation.JsonSchema +import org.openapijsonschematools.client.schemas.validation.JsonSchemaInfo +import org.openapijsonschematools.client.schemas.validation.PathToSchemasMap +import org.openapijsonschematools.client.schemas.validation.ValidationMetadata + +class EnumWithTrueDoesNotMatch1 { + // nest classes so all schemas and input/output classes can be public + + enum class BooleanEnumWithTrueDoesNotMatch1Enums(private val value: Boolean): BooleanValueMethod { + TRUE(true); + + override fun value(): Boolean { + return this.value + } + } + + + sealed interface EnumWithTrueDoesNotMatch11Boxed { + fun getData(): Any? + } + + data class EnumWithTrueDoesNotMatch11BoxedBoolean(val data: Boolean): EnumWithTrueDoesNotMatch11Boxed { + override fun getData(): Any? { + return data + } + } + + + + class EnumWithTrueDoesNotMatch11 private constructor(): JsonSchema( + JsonSchemaInfo() + .type(setOf(Boolean::class.java)) + .enumValues(setOf( + true + )) + ), BooleanSchemaValidator, BooleanEnumValidator { + /* + NOTE: This class is auto generated by OpenAPI JSON Schema Generator. + Ref: https://github.com/openapi-json-schema-tools/openapi-json-schema-generator + + Do not edit the class manually. + */ + + companion object { + @Volatile + private var instance: EnumWithTrueDoesNotMatch11? = null + + fun getInstance() = + instance ?: synchronized(this) { + instance ?: EnumWithTrueDoesNotMatch11().also { instance = it } + } + } + + @Throws(ValidationException::class) + override fun validate(arg: Boolean, configuration: SchemaConfiguration?): Boolean { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, PathToSchemasMap(), LinkedHashSet()) + getPathToSchemas(this, castArg, validationMetadata, pathSet) + return castArg + } + + @Throws(ValidationException::class) + override fun validate(arg: BooleanEnumWithTrueDoesNotMatch1Enums, configuration: SchemaConfiguration?): Boolean { + return validate(arg.value(), configuration) + } + + @Throws(ValidationException::class) + override fun validate(arg: Any?, configuration: SchemaConfiguration?): Any? { + if (arg is Boolean) { + return validate(arg, configuration) + } + throw ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema") + } + override fun getNewInstance(arg: Any?, pathToItem: List, pathToSchemas: PathToSchemasMap): Any? { + if (arg is Boolean) { + return getNewInstance(arg, pathToItem, pathToSchemas) + } + throw RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema") + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: Boolean, configuration: SchemaConfiguration?): EnumWithTrueDoesNotMatch11BoxedBoolean { + return EnumWithTrueDoesNotMatch11BoxedBoolean(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: Any?, configuration: SchemaConfiguration?): EnumWithTrueDoesNotMatch11Boxed { + if (arg is Boolean) { + return validateAndBox(arg, configuration) + } + throw ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema") + } + } +} diff --git a/samples/client/3_0_3_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/schemas/EnumsInProperties.kt b/samples/client/3_0_3_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/schemas/EnumsInProperties.kt new file mode 100644 index 00000000000..50712e368ae --- /dev/null +++ b/samples/client/3_0_3_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/schemas/EnumsInProperties.kt @@ -0,0 +1,394 @@ +package org.openapijsonschematools.client.components.schemas +import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags +import org.openapijsonschematools.client.configurations.SchemaConfiguration +import org.openapijsonschematools.client.exceptions.InvalidAdditionalPropertyException +import org.openapijsonschematools.client.exceptions.UnsetPropertyException +import org.openapijsonschematools.client.exceptions.ValidationException +import org.openapijsonschematools.client.schemas.GenericBuilder +import org.openapijsonschematools.client.schemas.UnsetAddPropsSetter +import org.openapijsonschematools.client.schemas.validation.FrozenMap +import org.openapijsonschematools.client.schemas.validation.JsonSchema +import org.openapijsonschematools.client.schemas.validation.JsonSchemaInfo +import org.openapijsonschematools.client.schemas.validation.MapSchemaValidator +import org.openapijsonschematools.client.schemas.validation.PathToSchemasMap +import org.openapijsonschematools.client.schemas.validation.StringEnumValidator +import org.openapijsonschematools.client.schemas.validation.StringSchemaValidator +import org.openapijsonschematools.client.schemas.validation.StringValueMethod +import org.openapijsonschematools.client.schemas.validation.ValidationMetadata + +class EnumsInProperties { + // nest classes so all schemas and input/output classes can be public + + enum class StringFooEnums(private val value: String): StringValueMethod { + FOO("foo"); + + override fun value(): String { + return this.value + } + } + + + sealed interface FooBoxed { + fun getData(): Any? + } + + data class FooBoxedString(val data: String) : FooBoxed { + override fun getData(): Any? { + return data + } + } + + + + class Foo private constructor(): JsonSchema( + JsonSchemaInfo() + .type(setOf( + String::class.java + )) + .enumValues(setOf( + "foo" + )) + ), StringSchemaValidator, StringEnumValidator { + + companion object { + @Volatile + private var instance: Foo? = null + + fun getInstance() = + instance ?: synchronized(this) { + instance ?: Foo().also { instance = it } + } + } + + @Throws(ValidationException::class) + override fun validate(arg: String, configuration: SchemaConfiguration?): String { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, PathToSchemasMap(), LinkedHashSet()) + getPathToSchemas(this, castArg, validationMetadata, pathSet) + return castArg + } + + @Throws(ValidationException::class) + override fun validate(arg: StringFooEnums, configuration: SchemaConfiguration?): String { + return validate(arg.value(), configuration) + } + + @Throws(ValidationException::class) + override fun validate(arg: Any?, configuration: SchemaConfiguration?): Any? { + if (arg is String) { + return validate(arg, configuration) + } + throw ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema") + } + override fun getNewInstance(arg: Any?, pathToItem: List, pathToSchemas: PathToSchemasMap): Any? { + if (arg is String) { + return getNewInstance(arg, pathToItem, pathToSchemas) + } + throw RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema") + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: String, configuration: SchemaConfiguration?): FooBoxedString { + return FooBoxedString(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: Any?, configuration: SchemaConfiguration?): FooBoxed { + if (arg is String) { + return validateAndBox(arg, configuration) + } + throw ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema") + } + } + enum class StringBarEnums(private val value: String): StringValueMethod { + BAR("bar"); + + override fun value(): String { + return this.value + } + } + + + sealed interface BarBoxed { + fun getData(): Any? + } + + data class BarBoxedString(val data: String) : BarBoxed { + override fun getData(): Any? { + return data + } + } + + + + class Bar private constructor(): JsonSchema( + JsonSchemaInfo() + .type(setOf( + String::class.java + )) + .enumValues(setOf( + "bar" + )) + ), StringSchemaValidator, StringEnumValidator { + + companion object { + @Volatile + private var instance: Bar? = null + + fun getInstance() = + instance ?: synchronized(this) { + instance ?: Bar().also { instance = it } + } + } + + @Throws(ValidationException::class) + override fun validate(arg: String, configuration: SchemaConfiguration?): String { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, PathToSchemasMap(), LinkedHashSet()) + getPathToSchemas(this, castArg, validationMetadata, pathSet) + return castArg + } + + @Throws(ValidationException::class) + override fun validate(arg: StringBarEnums, configuration: SchemaConfiguration?): String { + return validate(arg.value(), configuration) + } + + @Throws(ValidationException::class) + override fun validate(arg: Any?, configuration: SchemaConfiguration?): Any? { + if (arg is String) { + return validate(arg, configuration) + } + throw ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema") + } + override fun getNewInstance(arg: Any?, pathToItem: List, pathToSchemas: PathToSchemasMap): Any? { + if (arg is String) { + return getNewInstance(arg, pathToItem, pathToSchemas) + } + throw RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema") + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: String, configuration: SchemaConfiguration?): BarBoxedString { + return BarBoxedString(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: Any?, configuration: SchemaConfiguration?): BarBoxed { + if (arg is String) { + return validateAndBox(arg, configuration) + } + throw ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema") + } + } + + class EnumsInPropertiesMap(m: FrozenMap) : FrozenMap(m) { + companion object { + val requiredKeys: Set = setOf( + "bar" + ) + val optionalKeys: Set = setOf( + "foo" + ) + @Throws(ValidationException::class) + fun of(arg: Map, configuration: SchemaConfiguration): EnumsInPropertiesMap { + return EnumsInProperties1.getInstance().validate(arg, configuration) + } + } + + fun bar(): String { + val value: Any? = get("bar") + if (!(value is String)) { + throw RuntimeException("Invalid value stored for bar") + } + return value + } + + @Throws(UnsetPropertyException::class) + fun foo(): String { + val key = "foo" + throwIfKeyNotPresent(key) + val value: Any? = get(key) + if (!(value is String)) { + throw RuntimeException("Invalid value stored for foo") + } + return value + } + + @Throws(UnsetPropertyException::class, InvalidAdditionalPropertyException::class) + fun getAdditionalProperty(name: String): Any? { + throwIfKeyKnown(name, requiredKeys, optionalKeys) + throwIfKeyNotPresent(name) + return get(name) + } + } + + interface SetterForBar { + fun getInstance(): MutableMap + fun getBuilderAfterBar(instance: MutableMap): T + + fun bar(value: String): T { + val instance = getInstance() + instance["bar"] = value + return getBuilderAfterBar(instance) + } + + fun bar(value: StringBarEnums): T { + val instance = getInstance() + instance["bar"] = value.value() + return getBuilderAfterBar(instance) + } + } + + interface SetterForFoo { + fun getInstance(): MutableMap + fun getBuilderAfterFoo(instance: MutableMap): T + + fun foo(value: String): T { + val instance = getInstance() + instance["foo"] = value + return getBuilderAfterFoo(instance) + } + + fun foo(value: StringFooEnums): T { + val instance = getInstance() + instance["foo"] = value.value() + return getBuilderAfterFoo(instance) + } + } + + class EnumsInPropertiesMap0Builder(private val instance: MutableMap): UnsetAddPropsSetter, GenericBuilder>, SetterForFoo { + private val knownKeys: Set = setOf( + "bar", + "foo" + ) + override fun getKnownKeys(): Set { + return knownKeys + } + override fun build(): Map { + return instance + } + override fun getInstance(): MutableMap { + return instance + } + override fun getBuilderAfterFoo(instance: MutableMap): EnumsInPropertiesMap0Builder { + return this + } + override fun getBuilderAfterAdditionalProperty(instance: MutableMap): EnumsInPropertiesMap0Builder { + return this + } + } + + class EnumsInPropertiesMapBuilder: SetterForBar { + private val instance: MutableMap + init { + this.instance = LinkedHashMap() + } + override fun getInstance(): MutableMap { + return instance + } + override fun getBuilderAfterBar(instance: MutableMap): EnumsInPropertiesMap0Builder { + return EnumsInPropertiesMap0Builder(instance) + } + } + + + sealed interface EnumsInProperties1Boxed { + fun getData(): Any? + } + + data class EnumsInProperties1BoxedMap(val data: EnumsInPropertiesMap) : EnumsInProperties1Boxed { + override fun getData(): Any? { + return data + } + } + + + class EnumsInProperties1 private constructor(): JsonSchema( + JsonSchemaInfo() + .type(setOf(Map::class.java)) + .properties(mapOf( + "foo" to Foo::class.java, + "bar" to Bar::class.java + )) + .required(setOf( + "bar" + )) + ), MapSchemaValidator { + /* + NOTE: This class is auto generated by OpenAPI JSON Schema Generator. + Ref: https://github.com/openapi-json-schema-tools/openapi-json-schema-generator + + Do not edit the class manually. + */ + + companion object { + @Volatile + private var instance: EnumsInProperties1? = null + + fun getInstance() = + instance ?: synchronized(this) { + instance ?: EnumsInProperties1().also { instance = it } + } + } + + override fun getNewInstance(arg: Map<*, *>, pathToItem: List, pathToSchemas: PathToSchemasMap): EnumsInPropertiesMap { + val properties: LinkedHashMap = LinkedHashMap() + for((entryKey, value) in arg) { + if (!(entryKey is String)) { + throw RuntimeException("Invalid non-string key value") + } + val propertyPathToItem: List = pathToItem + entryKey + val schemas: LinkedHashMap, Nothing?>? = pathToSchemas.get(propertyPathToItem) + if (schemas == null) { + throw RuntimeException("Validation result is invalid, schemas must exist for a pathToItem") + } + val propertySchema: JsonSchema<*> = schemas.entries.iterator().next().key + val propertyInstance: Any? = propertySchema.getNewInstance(value, propertyPathToItem, pathToSchemas) + properties[entryKey] = propertyInstance + } + val castProperties: FrozenMap = FrozenMap(properties) + return EnumsInPropertiesMap(castProperties) + } + + @Throws(ValidationException::class) + override fun validate(arg: Map<*, *>, configuration: SchemaConfiguration?): EnumsInPropertiesMap { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, PathToSchemasMap(), LinkedHashSet()) + val pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet) + return getNewInstance(castArg, validationMetadata.pathToItem, pathToSchemasMap) + } + + + @Throws(ValidationException::class) + override fun validate(arg: Any?, configuration: SchemaConfiguration?): Any? { + if (arg is Map<*, *>) { + return validate(arg, configuration) + } + throw ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema") + } + override fun getNewInstance(arg: Any?, pathToItem: List, pathToSchemas: PathToSchemasMap): Any? { + if (arg is Map<*, *>) { + return getNewInstance(arg, pathToItem, pathToSchemas) + } + throw RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema") + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: Map<*, *>, configuration: SchemaConfiguration?): EnumsInProperties1BoxedMap { + return EnumsInProperties1BoxedMap(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: Any?, configuration: SchemaConfiguration?): EnumsInProperties1Boxed { + if (arg is Map<*, *>) { + return validateAndBox(arg, configuration) + } + throw ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema") + } + } + +} diff --git a/samples/client/3_0_3_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/schemas/ForbiddenProperty.kt b/samples/client/3_0_3_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/schemas/ForbiddenProperty.kt new file mode 100644 index 00000000000..8f716213d8c --- /dev/null +++ b/samples/client/3_0_3_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/schemas/ForbiddenProperty.kt @@ -0,0 +1,437 @@ +package org.openapijsonschematools.client.components.schemas +import java.time.LocalDate +import java.time.ZonedDateTime +import java.util.UUID +import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags +import org.openapijsonschematools.client.configurations.SchemaConfiguration +import org.openapijsonschematools.client.exceptions.InvalidAdditionalPropertyException +import org.openapijsonschematools.client.exceptions.UnsetPropertyException +import org.openapijsonschematools.client.exceptions.ValidationException +import org.openapijsonschematools.client.schemas.AnyTypeJsonSchema +import org.openapijsonschematools.client.schemas.GenericBuilder +import org.openapijsonschematools.client.schemas.NotAnyTypeJsonSchema +import org.openapijsonschematools.client.schemas.UnsetAddPropsSetter +import org.openapijsonschematools.client.schemas.validation.BooleanSchemaValidator +import org.openapijsonschematools.client.schemas.validation.FrozenList +import org.openapijsonschematools.client.schemas.validation.FrozenMap +import org.openapijsonschematools.client.schemas.validation.JsonSchema +import org.openapijsonschematools.client.schemas.validation.JsonSchemaInfo +import org.openapijsonschematools.client.schemas.validation.ListSchemaValidator +import org.openapijsonschematools.client.schemas.validation.MapSchemaValidator +import org.openapijsonschematools.client.schemas.validation.NullSchemaValidator +import org.openapijsonschematools.client.schemas.validation.NumberSchemaValidator +import org.openapijsonschematools.client.schemas.validation.PathToSchemasMap +import org.openapijsonschematools.client.schemas.validation.StringSchemaValidator +import org.openapijsonschematools.client.schemas.validation.ValidationMetadata + +class ForbiddenProperty { + // nest classes so all schemas and input/output classes can be public + + + class Foo : NotAnyTypeJsonSchema.NotAnyTypeJsonSchema1() { + // NotAnyTypeSchema + companion object { + @Volatile + private var instance: Foo? = null + + fun getInstance() = + instance ?: synchronized(this) { + instance ?: Foo().also { instance = it } + } + } + } + + + class ForbiddenPropertyMap(m: FrozenMap) : FrozenMap(m) { + companion object { + val requiredKeys: Set = setOf() + val optionalKeys: Set = setOf( + "foo" + ) + @Throws(ValidationException::class) + fun of(arg: Map, configuration: SchemaConfiguration): ForbiddenPropertyMap { + return ForbiddenProperty1.getInstance().validate(arg, configuration) + } + } + + @Throws(UnsetPropertyException::class) + fun foo(): Any? { + return getOrThrow("foo") + } + + @Throws(UnsetPropertyException::class, InvalidAdditionalPropertyException::class) + fun getAdditionalProperty(name: String): Any? { + throwIfKeyKnown(name, requiredKeys, optionalKeys) + throwIfKeyNotPresent(name) + return get(name) + } + } + + interface SetterForFoo { + fun getInstance(): MutableMap + fun getBuilderAfterFoo(instance: MutableMap): T + + fun foo(value: Nothing?): T { + val instance = getInstance() + instance["foo"] = null + return getBuilderAfterFoo(instance) + } + + fun foo(value: Boolean): T { + val instance = getInstance() + instance["foo"] = value + return getBuilderAfterFoo(instance) + } + + fun foo(value: String): T { + val instance = getInstance() + instance["foo"] = value + return getBuilderAfterFoo(instance) + } + + fun foo(value: Int): T { + val instance = getInstance() + instance["foo"] = value + return getBuilderAfterFoo(instance) + } + + fun foo(value: Float): T { + val instance = getInstance() + instance["foo"] = value + return getBuilderAfterFoo(instance) + } + + fun foo(value: Long): T { + val instance = getInstance() + instance["foo"] = value + return getBuilderAfterFoo(instance) + } + + fun foo(value: Double): T { + val instance = getInstance() + instance["foo"] = value + return getBuilderAfterFoo(instance) + } + + fun foo(value: List): T { + val instance = getInstance() + instance["foo"] = value + return getBuilderAfterFoo(instance) + } + + fun foo(value: Map): T { + val instance = getInstance() + instance["foo"] = value + return getBuilderAfterFoo(instance) + } + } + + class ForbiddenPropertyMapBuilder: UnsetAddPropsSetter, GenericBuilder>, SetterForFoo { + private val knownKeys: Set = setOf( + "foo" + ) + override fun getKnownKeys(): Set { + return knownKeys + } + private val instance: MutableMap + init { + this.instance = LinkedHashMap() + } + override fun build(): Map { + return instance + } + override fun getInstance(): MutableMap { + return instance + } + override fun getBuilderAfterFoo(instance: MutableMap): ForbiddenPropertyMapBuilder { + return this + } + override fun getBuilderAfterAdditionalProperty(instance: MutableMap): ForbiddenPropertyMapBuilder { + return this + } + } + + + sealed interface ForbiddenProperty1Boxed { + fun getData(): Any? + } + + data class ForbiddenProperty1BoxedVoid(val data: Nothing?) : ForbiddenProperty1Boxed { + override fun getData(): Any? { + return data + } + } + + data class ForbiddenProperty1BoxedBoolean(val data: Boolean): ForbiddenProperty1Boxed { + override fun getData(): Any? { + return data + } + } + + data class ForbiddenProperty1BoxedNumber(val data: Number) : ForbiddenProperty1Boxed { + override fun getData(): Any? { + return data + } + } + + data class ForbiddenProperty1BoxedString(val data: String) : ForbiddenProperty1Boxed { + override fun getData(): Any? { + return data + } + } + + data class ForbiddenProperty1BoxedList(val data: FrozenList) : ForbiddenProperty1Boxed { + override fun getData(): Any? { + return data + } + } + + data class ForbiddenProperty1BoxedMap(val data: ForbiddenPropertyMap) : ForbiddenProperty1Boxed { + override fun getData(): Any? { + return data + } + } + + + class ForbiddenProperty1 private constructor(): JsonSchema( + JsonSchemaInfo() + .properties(mapOf( + "foo" to Foo::class.java + )) + ), NullSchemaValidator, BooleanSchemaValidator, NumberSchemaValidator, StringSchemaValidator, ListSchemaValidator, ForbiddenProperty1BoxedList>, MapSchemaValidator { + /* + NOTE: This class is auto generated by OpenAPI JSON Schema Generator. + Ref: https://github.com/openapi-json-schema-tools/openapi-json-schema-generator + + Do not edit the class manually. + */ + + companion object { + @Volatile + private var instance: ForbiddenProperty1? = null + + fun getInstance() = + instance ?: synchronized(this) { + instance ?: ForbiddenProperty1().also { instance = it } + } + } + + @Throws(ValidationException::class) + override fun validate(arg: Nothing?, configuration: SchemaConfiguration?): Nothing? { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validatedPathToSchemas = PathToSchemasMap() + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, LinkedHashSet()) + getPathToSchemas(this, castArg, validationMetadata, pathSet) + return castArg + } + + @Throws(ValidationException::class) + override fun validate(arg: Boolean, configuration: SchemaConfiguration?): Boolean { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validatedPathToSchemas = PathToSchemasMap() + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, LinkedHashSet()) + getPathToSchemas(this, castArg, validationMetadata, pathSet) + return castArg + } + + @Throws(ValidationException::class) + override fun validate(arg: Number, configuration: SchemaConfiguration?): Number { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validatedPathToSchemas = PathToSchemasMap() + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, LinkedHashSet()) + getPathToSchemas(this, castArg, validationMetadata, pathSet) + return castArg + } + + @Throws(ValidationException::class) + fun validate(arg: Int, configuration: SchemaConfiguration?): Int { + return validate(arg as Number, configuration) as Int + } + + @Throws(ValidationException::class) + fun validate(arg: Long, configuration: SchemaConfiguration?): Long { + return validate(arg as Number, configuration) as Long + } + + @Throws(ValidationException::class) + fun validate(arg: Float, configuration: SchemaConfiguration?): Float { + return validate(arg as Number, configuration) as Float + } + + @Throws(ValidationException::class) + fun validate(arg: Double, configuration: SchemaConfiguration?): Double { + return validate(arg as Number, configuration) as Double + } + + @Throws(ValidationException::class) + override fun validate(arg: String, configuration: SchemaConfiguration?): String { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validatedPathToSchemas = PathToSchemasMap() + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, LinkedHashSet()) + getPathToSchemas(this, castArg, validationMetadata, pathSet) + return castArg + } + + @Throws(ValidationException::class) + fun validate(arg: LocalDate, configuration: SchemaConfiguration?): String { + return validate(arg.toString(), configuration) + } + + @Throws(ValidationException::class) + fun validate(arg: ZonedDateTime, configuration: SchemaConfiguration?): String { + return validate(arg.toString(), configuration) + } + + @Throws(ValidationException::class) + fun validate(arg: UUID, configuration: SchemaConfiguration?): String { + return validate(arg.toString(), configuration) + } + + override fun getNewInstance(arg: List<*>, pathToItem: List, pathToSchemas: PathToSchemasMap): FrozenList { + val items: MutableList = ArrayList() + var i: Int = 0 + for (item: Any? in arg) { + val itemPathToItem = pathToItem + i + val schemas: LinkedHashMap, Nothing?>? = pathToSchemas.get(itemPathToItem) + if (schemas == null) { + throw RuntimeException("Validation result is invalid, schemas must exist for a pathToItem") + } + val itemSchema: JsonSchema<*> = schemas.entries.iterator().next().key + val itemInstance: Any? = itemSchema.getNewInstance(item, itemPathToItem, pathToSchemas) + items.add(itemInstance) + i += 1 + } + val newInstanceItems: FrozenList = FrozenList(items) + return newInstanceItems + } + + @Throws(ValidationException::class) + override fun validate(arg: List<*>, configuration: SchemaConfiguration?): FrozenList { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, PathToSchemasMap(), LinkedHashSet()) + val pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet) + return getNewInstance(castArg, validationMetadata.pathToItem, pathToSchemasMap) + } + + override fun getNewInstance(arg: Map<*, *>, pathToItem: List, pathToSchemas: PathToSchemasMap): ForbiddenPropertyMap { + val properties: LinkedHashMap = LinkedHashMap() + for((propertyName, value) in arg) { + if (!(propertyName is String)) { + throw RuntimeException("Invalid non-string key value") + } + val propertyPathToItem: List = pathToItem + propertyName + val schemas: LinkedHashMap, Nothing?>? = pathToSchemas.get(propertyPathToItem) + if (schemas == null) { + throw RuntimeException("Validation result is invalid, schemas must exist for a pathToItem") + } + val propertySchema: JsonSchema<*> = schemas.entries.iterator().next().key + val propertyInstance: Any? = propertySchema.getNewInstance(value, propertyPathToItem, pathToSchemas) + properties[propertyName] = propertyInstance + } + val castProperties: FrozenMap = FrozenMap(properties) + return ForbiddenPropertyMap(castProperties) + } + + @Throws(ValidationException::class) + override fun validate(arg: Map<*, *>, configuration: SchemaConfiguration?): ForbiddenPropertyMap { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validatedPathToSchemas = PathToSchemasMap() + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, LinkedHashSet()) + val pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet) + return getNewInstance(castArg, validationMetadata.pathToItem, pathToSchemasMap) + } + + @Throws(ValidationException::class) + override fun validate(arg: Any?, configuration: SchemaConfiguration?): Any? { + if (arg == null) { + return validate(null, configuration) + } else if (arg is Boolean) { + return validate(arg, configuration) + } else if (arg is Number) { + return validate(arg, configuration) + } else if (arg is String) { + return validate(arg, configuration) + } else if (arg is List<*>) { + return validate(arg, configuration) + } else if (arg is Map<*, *>) { + return validate(arg, configuration) + } + throw ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema") + } + override fun getNewInstance(arg: Any?, pathToItem: List, pathToSchemas: PathToSchemasMap): Any? { + if (arg == null) { + return getNewInstance( null, pathToItem, pathToSchemas) + } else if (arg is Boolean) { + return getNewInstance(arg, pathToItem, pathToSchemas) + } else if (arg is Number) { + return getNewInstance(arg, pathToItem, pathToSchemas) + } else if (arg is String) { + return getNewInstance(arg, pathToItem, pathToSchemas) + } else if (arg is List<*>) { + return getNewInstance(arg, pathToItem, pathToSchemas) + } else if (arg is Map<*, *>) { + return getNewInstance(arg, pathToItem, pathToSchemas) + } + throw RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema") + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: Nothing?, configuration: SchemaConfiguration?): ForbiddenProperty1BoxedVoid { + return ForbiddenProperty1BoxedVoid(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: Boolean, configuration: SchemaConfiguration?): ForbiddenProperty1BoxedBoolean { + return ForbiddenProperty1BoxedBoolean(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: Number, configuration: SchemaConfiguration?): ForbiddenProperty1BoxedNumber { + return ForbiddenProperty1BoxedNumber(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: String, configuration: SchemaConfiguration?): ForbiddenProperty1BoxedString { + return ForbiddenProperty1BoxedString(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: List<*>, configuration: SchemaConfiguration?): ForbiddenProperty1BoxedList { + return ForbiddenProperty1BoxedList(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: Map<*, *>, configuration: SchemaConfiguration?): ForbiddenProperty1BoxedMap { + return ForbiddenProperty1BoxedMap(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: Any?, configuration: SchemaConfiguration?): ForbiddenProperty1Boxed { + if (arg == null) { + return validateAndBox(null, configuration) + } else if (arg is Boolean) { + return validateAndBox(arg, configuration) + } else if (arg is String) { + return validateAndBox(arg, configuration) + } else if (arg is Number) { + return validateAndBox(arg, configuration) + } else if (arg is List<*>) { + return validateAndBox(arg, configuration) + } else if (arg is Map<*, *>) { + return validateAndBox(arg, configuration) + } + throw ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema") + } + } +} diff --git a/samples/client/3_0_3_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/schemas/HostnameFormat.kt b/samples/client/3_0_3_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/schemas/HostnameFormat.kt new file mode 100644 index 00000000000..63cefc4f9fb --- /dev/null +++ b/samples/client/3_0_3_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/schemas/HostnameFormat.kt @@ -0,0 +1,308 @@ +package org.openapijsonschematools.client.components.schemas +import java.time.LocalDate +import java.time.ZonedDateTime +import java.util.UUID +import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags +import org.openapijsonschematools.client.configurations.SchemaConfiguration +import org.openapijsonschematools.client.exceptions.InvalidAdditionalPropertyException +import org.openapijsonschematools.client.exceptions.UnsetPropertyException +import org.openapijsonschematools.client.exceptions.ValidationException +import org.openapijsonschematools.client.schemas.UnsetAddPropsSetter +import org.openapijsonschematools.client.schemas.validation.BooleanSchemaValidator +import org.openapijsonschematools.client.schemas.validation.FrozenList +import org.openapijsonschematools.client.schemas.validation.FrozenMap +import org.openapijsonschematools.client.schemas.validation.JsonSchema +import org.openapijsonschematools.client.schemas.validation.JsonSchemaInfo +import org.openapijsonschematools.client.schemas.validation.ListSchemaValidator +import org.openapijsonschematools.client.schemas.validation.MapSchemaValidator +import org.openapijsonschematools.client.schemas.validation.NullSchemaValidator +import org.openapijsonschematools.client.schemas.validation.NumberSchemaValidator +import org.openapijsonschematools.client.schemas.validation.PathToSchemasMap +import org.openapijsonschematools.client.schemas.validation.StringSchemaValidator +import org.openapijsonschematools.client.schemas.validation.ValidationMetadata + +class HostnameFormat { + // nest classes so all schemas and input/output classes can be public + + + sealed interface HostnameFormat1Boxed { + fun getData(): Any? + } + + data class HostnameFormat1BoxedVoid(val data: Nothing?) : HostnameFormat1Boxed { + override fun getData(): Any? { + return data + } + } + + data class HostnameFormat1BoxedBoolean(val data: Boolean): HostnameFormat1Boxed { + override fun getData(): Any? { + return data + } + } + + data class HostnameFormat1BoxedNumber(val data: Number) : HostnameFormat1Boxed { + override fun getData(): Any? { + return data + } + } + + data class HostnameFormat1BoxedString(val data: String) : HostnameFormat1Boxed { + override fun getData(): Any? { + return data + } + } + + data class HostnameFormat1BoxedList(val data: FrozenList) : HostnameFormat1Boxed { + override fun getData(): Any? { + return data + } + } + + data class HostnameFormat1BoxedMap(val data: FrozenMap) : HostnameFormat1Boxed { + override fun getData(): Any? { + return data + } + } + + + class HostnameFormat1 private constructor(): JsonSchema( + JsonSchemaInfo() + .format("hostname") + ), NullSchemaValidator, BooleanSchemaValidator, NumberSchemaValidator, StringSchemaValidator, ListSchemaValidator, HostnameFormat1BoxedList>, MapSchemaValidator, HostnameFormat1BoxedMap> { + /* + NOTE: This class is auto generated by OpenAPI JSON Schema Generator. + Ref: https://github.com/openapi-json-schema-tools/openapi-json-schema-generator + + Do not edit the class manually. + */ + + companion object { + @Volatile + private var instance: HostnameFormat1? = null + + fun getInstance() = + instance ?: synchronized(this) { + instance ?: HostnameFormat1().also { instance = it } + } + } + + @Throws(ValidationException::class) + override fun validate(arg: Nothing?, configuration: SchemaConfiguration?): Nothing? { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validatedPathToSchemas = PathToSchemasMap() + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, LinkedHashSet()) + getPathToSchemas(this, castArg, validationMetadata, pathSet) + return castArg + } + + @Throws(ValidationException::class) + override fun validate(arg: Boolean, configuration: SchemaConfiguration?): Boolean { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validatedPathToSchemas = PathToSchemasMap() + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, LinkedHashSet()) + getPathToSchemas(this, castArg, validationMetadata, pathSet) + return castArg + } + + @Throws(ValidationException::class) + override fun validate(arg: Number, configuration: SchemaConfiguration?): Number { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validatedPathToSchemas = PathToSchemasMap() + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, LinkedHashSet()) + getPathToSchemas(this, castArg, validationMetadata, pathSet) + return castArg + } + + @Throws(ValidationException::class) + fun validate(arg: Int, configuration: SchemaConfiguration?): Int { + return validate(arg as Number, configuration) as Int + } + + @Throws(ValidationException::class) + fun validate(arg: Long, configuration: SchemaConfiguration?): Long { + return validate(arg as Number, configuration) as Long + } + + @Throws(ValidationException::class) + fun validate(arg: Float, configuration: SchemaConfiguration?): Float { + return validate(arg as Number, configuration) as Float + } + + @Throws(ValidationException::class) + fun validate(arg: Double, configuration: SchemaConfiguration?): Double { + return validate(arg as Number, configuration) as Double + } + + @Throws(ValidationException::class) + override fun validate(arg: String, configuration: SchemaConfiguration?): String { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validatedPathToSchemas = PathToSchemasMap() + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, LinkedHashSet()) + getPathToSchemas(this, castArg, validationMetadata, pathSet) + return castArg + } + + @Throws(ValidationException::class) + fun validate(arg: LocalDate, configuration: SchemaConfiguration?): String { + return validate(arg.toString(), configuration) + } + + @Throws(ValidationException::class) + fun validate(arg: ZonedDateTime, configuration: SchemaConfiguration?): String { + return validate(arg.toString(), configuration) + } + + @Throws(ValidationException::class) + fun validate(arg: UUID, configuration: SchemaConfiguration?): String { + return validate(arg.toString(), configuration) + } + + override fun getNewInstance(arg: List<*>, pathToItem: List, pathToSchemas: PathToSchemasMap): FrozenList { + val items: MutableList = ArrayList() + var i: Int = 0 + for (item: Any? in arg) { + val itemPathToItem = pathToItem + i + val schemas: LinkedHashMap, Nothing?>? = pathToSchemas.get(itemPathToItem) + if (schemas == null) { + throw RuntimeException("Validation result is invalid, schemas must exist for a pathToItem") + } + val itemSchema: JsonSchema<*> = schemas.entries.iterator().next().key + val itemInstance: Any? = itemSchema.getNewInstance(item, itemPathToItem, pathToSchemas) + items.add(itemInstance) + i += 1 + } + val newInstanceItems: FrozenList = FrozenList(items) + return newInstanceItems + } + + @Throws(ValidationException::class) + override fun validate(arg: List<*>, configuration: SchemaConfiguration?): FrozenList { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, PathToSchemasMap(), LinkedHashSet()) + val pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet) + return getNewInstance(castArg, validationMetadata.pathToItem, pathToSchemasMap) + } + + override fun getNewInstance(arg: Map<*, *>, pathToItem: List, pathToSchemas: PathToSchemasMap): FrozenMap { + val properties: LinkedHashMap = LinkedHashMap() + for((propertyName, value) in arg) { + if (!(propertyName is String)) { + throw RuntimeException("Invalid non-string key value") + } + val propertyPathToItem: List = pathToItem + propertyName + val schemas: LinkedHashMap, Nothing?>? = pathToSchemas.get(propertyPathToItem) + if (schemas == null) { + throw RuntimeException("Validation result is invalid, schemas must exist for a pathToItem") + } + val propertySchema: JsonSchema<*> = schemas.entries.iterator().next().key + val propertyInstance: Any? = propertySchema.getNewInstance(value, propertyPathToItem, pathToSchemas) + properties[propertyName] = propertyInstance + } + val castProperties: FrozenMap = FrozenMap(properties) + return castProperties + } + + @Throws(ValidationException::class) + override fun validate(arg: Map<*, *>, configuration: SchemaConfiguration?): FrozenMap { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validatedPathToSchemas = PathToSchemasMap() + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, LinkedHashSet()) + val pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet) + return getNewInstance(castArg, validationMetadata.pathToItem, pathToSchemasMap) + } + + @Throws(ValidationException::class) + override fun validate(arg: Any?, configuration: SchemaConfiguration?): Any? { + if (arg == null) { + return validate(null, configuration) + } else if (arg is Boolean) { + return validate(arg, configuration) + } else if (arg is Number) { + return validate(arg, configuration) + } else if (arg is String) { + return validate(arg, configuration) + } else if (arg is List<*>) { + return validate(arg, configuration) + } else if (arg is Map<*, *>) { + return validate(arg, configuration) + } + throw ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema") + } + override fun getNewInstance(arg: Any?, pathToItem: List, pathToSchemas: PathToSchemasMap): Any? { + if (arg == null) { + return getNewInstance( null, pathToItem, pathToSchemas) + } else if (arg is Boolean) { + return getNewInstance(arg, pathToItem, pathToSchemas) + } else if (arg is Number) { + return getNewInstance(arg, pathToItem, pathToSchemas) + } else if (arg is String) { + return getNewInstance(arg, pathToItem, pathToSchemas) + } else if (arg is List<*>) { + return getNewInstance(arg, pathToItem, pathToSchemas) + } else if (arg is Map<*, *>) { + return getNewInstance(arg, pathToItem, pathToSchemas) + } + throw RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema") + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: Nothing?, configuration: SchemaConfiguration?): HostnameFormat1BoxedVoid { + return HostnameFormat1BoxedVoid(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: Boolean, configuration: SchemaConfiguration?): HostnameFormat1BoxedBoolean { + return HostnameFormat1BoxedBoolean(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: Number, configuration: SchemaConfiguration?): HostnameFormat1BoxedNumber { + return HostnameFormat1BoxedNumber(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: String, configuration: SchemaConfiguration?): HostnameFormat1BoxedString { + return HostnameFormat1BoxedString(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: List<*>, configuration: SchemaConfiguration?): HostnameFormat1BoxedList { + return HostnameFormat1BoxedList(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: Map<*, *>, configuration: SchemaConfiguration?): HostnameFormat1BoxedMap { + return HostnameFormat1BoxedMap(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: Any?, configuration: SchemaConfiguration?): HostnameFormat1Boxed { + if (arg == null) { + return validateAndBox(null, configuration) + } else if (arg is Boolean) { + return validateAndBox(arg, configuration) + } else if (arg is String) { + return validateAndBox(arg, configuration) + } else if (arg is Number) { + return validateAndBox(arg, configuration) + } else if (arg is List<*>) { + return validateAndBox(arg, configuration) + } else if (arg is Map<*, *>) { + return validateAndBox(arg, configuration) + } + throw ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema") + } + } +} diff --git a/samples/client/3_0_3_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/schemas/IntegerTypeMatchesIntegers.kt b/samples/client/3_0_3_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/schemas/IntegerTypeMatchesIntegers.kt new file mode 100644 index 00000000000..fef4eb00f39 --- /dev/null +++ b/samples/client/3_0_3_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/schemas/IntegerTypeMatchesIntegers.kt @@ -0,0 +1,20 @@ +package org.openapijsonschematools.client.components.schemas +import org.openapijsonschematools.client.schemas.IntJsonSchema + +class IntegerTypeMatchesIntegers: IntJsonSchema() { + // nest classes so all schemas and input/output classes can be public + + + class IntegerTypeMatchesIntegers1 : IntJsonSchema.IntJsonSchema1() { + companion object { + @Volatile + private var instance: IntegerTypeMatchesIntegers1? = null + + fun getInstance() = + instance ?: synchronized(this) { + instance ?: IntegerTypeMatchesIntegers1().also { instance = it } + } + } + } + +} diff --git a/samples/client/3_0_3_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/schemas/InvalidInstanceShouldNotRaiseErrorWhenFloatDivisionInf.kt b/samples/client/3_0_3_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/schemas/InvalidInstanceShouldNotRaiseErrorWhenFloatDivisionInf.kt new file mode 100644 index 00000000000..37f1f34db0e --- /dev/null +++ b/samples/client/3_0_3_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/schemas/InvalidInstanceShouldNotRaiseErrorWhenFloatDivisionInf.kt @@ -0,0 +1,112 @@ +package org.openapijsonschematools.client.components.schemas +import java.math.BigDecimal +import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags +import org.openapijsonschematools.client.configurations.SchemaConfiguration +import org.openapijsonschematools.client.exceptions.ValidationException +import org.openapijsonschematools.client.schemas.validation.JsonSchema +import org.openapijsonschematools.client.schemas.validation.JsonSchemaInfo +import org.openapijsonschematools.client.schemas.validation.NumberSchemaValidator +import org.openapijsonschematools.client.schemas.validation.PathToSchemasMap +import org.openapijsonschematools.client.schemas.validation.ValidationMetadata + +class InvalidInstanceShouldNotRaiseErrorWhenFloatDivisionInf { + // nest classes so all schemas and input/output classes can be public + + + sealed interface InvalidInstanceShouldNotRaiseErrorWhenFloatDivisionInf1Boxed { + fun getData(): Any? + } + + data class InvalidInstanceShouldNotRaiseErrorWhenFloatDivisionInf1BoxedNumber(val data: Number) : InvalidInstanceShouldNotRaiseErrorWhenFloatDivisionInf1Boxed { + override fun getData(): Any? { + return data + } + } + + + + class InvalidInstanceShouldNotRaiseErrorWhenFloatDivisionInf1 private constructor(): JsonSchema( + JsonSchemaInfo() + .type(setOf( + Int::class.java, + Long::class.java, + Float::class.java, + Double::class.java + )) + .format("int") + .multipleOf(BigDecimal("0.123456789")) + ), NumberSchemaValidator { + /* + NOTE: This class is auto generated by OpenAPI JSON Schema Generator. + Ref: https://github.com/openapi-json-schema-tools/openapi-json-schema-generator + + Do not edit the class manually. + */ + + companion object { + @Volatile + private var instance: InvalidInstanceShouldNotRaiseErrorWhenFloatDivisionInf1? = null + + fun getInstance() = + instance ?: synchronized(this) { + instance ?: InvalidInstanceShouldNotRaiseErrorWhenFloatDivisionInf1().also { instance = it } + } + } + + @Throws(ValidationException::class) + override fun validate(arg: Number, configuration: SchemaConfiguration?): Number { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, PathToSchemasMap(), LinkedHashSet()) + getPathToSchemas(this, castArg, validationMetadata, pathSet) + return castArg + } + + @Throws(ValidationException::class) + fun validate(arg: Int, configuration: SchemaConfiguration?): Int { + return validate(arg as Number, configuration) as Int + } + + @Throws(ValidationException::class) + fun validate(arg: Float, configuration: SchemaConfiguration?): Float { + return validate(arg as Number, configuration) as Float + } + + @Throws(ValidationException::class) + fun validate(arg: Long, configuration: SchemaConfiguration?): Long { + return validate(arg as Number, configuration) as Long + } + + @Throws(ValidationException::class) + fun validate(arg: Double, configuration: SchemaConfiguration?): Double { + return validate(arg as Number, configuration) as Double + } + + @Throws(ValidationException::class) + override fun validate(arg: Any?, configuration: SchemaConfiguration?): Any? { + if (arg is Number) { + return validate(arg, configuration) + } + throw ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema") + } + override fun getNewInstance(arg: Any?, pathToItem: List, pathToSchemas: PathToSchemasMap): Any? { + if (arg is Number) { + return getNewInstance(arg, pathToItem, pathToSchemas) + } + throw RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema") + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: Number, configuration: SchemaConfiguration?): InvalidInstanceShouldNotRaiseErrorWhenFloatDivisionInf1BoxedNumber { + return InvalidInstanceShouldNotRaiseErrorWhenFloatDivisionInf1BoxedNumber(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: Any?, configuration: SchemaConfiguration?): InvalidInstanceShouldNotRaiseErrorWhenFloatDivisionInf1Boxed { + if (arg is Number) { + return validateAndBox(arg, configuration) + } + throw ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema") + } + } +} diff --git a/samples/client/3_0_3_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/schemas/InvalidStringValueForDefault.kt b/samples/client/3_0_3_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/schemas/InvalidStringValueForDefault.kt new file mode 100644 index 00000000000..568b9d73278 --- /dev/null +++ b/samples/client/3_0_3_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/schemas/InvalidStringValueForDefault.kt @@ -0,0 +1,455 @@ +package org.openapijsonschematools.client.components.schemas +import java.time.LocalDate +import java.time.ZonedDateTime +import java.util.UUID +import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags +import org.openapijsonschematools.client.configurations.SchemaConfiguration +import org.openapijsonschematools.client.exceptions.InvalidAdditionalPropertyException +import org.openapijsonschematools.client.exceptions.UnsetPropertyException +import org.openapijsonschematools.client.exceptions.ValidationException +import org.openapijsonschematools.client.schemas.GenericBuilder +import org.openapijsonschematools.client.schemas.UnsetAddPropsSetter +import org.openapijsonschematools.client.schemas.validation.BooleanSchemaValidator +import org.openapijsonschematools.client.schemas.validation.DefaultValueMethod +import org.openapijsonschematools.client.schemas.validation.FrozenList +import org.openapijsonschematools.client.schemas.validation.FrozenMap +import org.openapijsonschematools.client.schemas.validation.JsonSchema +import org.openapijsonschematools.client.schemas.validation.JsonSchemaInfo +import org.openapijsonschematools.client.schemas.validation.ListSchemaValidator +import org.openapijsonschematools.client.schemas.validation.MapSchemaValidator +import org.openapijsonschematools.client.schemas.validation.NullSchemaValidator +import org.openapijsonschematools.client.schemas.validation.NumberSchemaValidator +import org.openapijsonschematools.client.schemas.validation.PathToSchemasMap +import org.openapijsonschematools.client.schemas.validation.StringSchemaValidator +import org.openapijsonschematools.client.schemas.validation.ValidationMetadata + +class InvalidStringValueForDefault { + // nest classes so all schemas and input/output classes can be public + + + sealed interface BarBoxed { + fun getData(): Any? + } + + data class BarBoxedString(val data: String) : BarBoxed { + override fun getData(): Any? { + return data + } + } + + + + class Bar private constructor(): JsonSchema( + JsonSchemaInfo() + .type(setOf( + String::class.java + )) + .minLength(4) + .defaultValue("bad") + ), StringSchemaValidator, DefaultValueMethod { + + companion object { + @Volatile + private var instance: Bar? = null + + fun getInstance() = + instance ?: synchronized(this) { + instance ?: Bar().also { instance = it } + } + } + + @Throws(ValidationException::class) + override fun validate(arg: String, configuration: SchemaConfiguration?): String { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, PathToSchemasMap(), LinkedHashSet()) + getPathToSchemas(this, castArg, validationMetadata, pathSet) + return castArg + } + + @Throws(ValidationException::class) + override fun validate(arg: Any?, configuration: SchemaConfiguration?): Any? { + if (arg is String) { + return validate(arg, configuration) + } + throw ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema") + } + override fun getNewInstance(arg: Any?, pathToItem: List, pathToSchemas: PathToSchemasMap): Any? { + if (arg is String) { + return getNewInstance(arg, pathToItem, pathToSchemas) + } + throw RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema") + } + @Throws(ValidationException::class) + override fun defaultValue(): String { + if (defaultValue is String) { + return defaultValue + } + throw ValidationException("Invalid type stored in defaultValue") + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: String, configuration: SchemaConfiguration?): BarBoxedString { + return BarBoxedString(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: Any?, configuration: SchemaConfiguration?): BarBoxed { + if (arg is String) { + return validateAndBox(arg, configuration) + } + throw ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema") + } + } + + class InvalidStringValueForDefaultMap(m: FrozenMap) : FrozenMap(m) { + companion object { + val requiredKeys: Set = setOf() + val optionalKeys: Set = setOf( + "bar" + ) + @Throws(ValidationException::class) + fun of(arg: Map, configuration: SchemaConfiguration): InvalidStringValueForDefaultMap { + return InvalidStringValueForDefault1.getInstance().validate(arg, configuration) + } + } + + @Throws(UnsetPropertyException::class) + fun bar(): String { + val key = "bar" + throwIfKeyNotPresent(key) + val value: Any? = get(key) + if (!(value is String)) { + throw RuntimeException("Invalid value stored for bar") + } + return value + } + + @Throws(UnsetPropertyException::class, InvalidAdditionalPropertyException::class) + fun getAdditionalProperty(name: String): Any? { + throwIfKeyKnown(name, requiredKeys, optionalKeys) + throwIfKeyNotPresent(name) + return get(name) + } + } + + interface SetterForBar { + fun getInstance(): MutableMap + fun getBuilderAfterBar(instance: MutableMap): T + + fun bar(value: String): T { + val instance = getInstance() + instance["bar"] = value + return getBuilderAfterBar(instance) + } + } + + class InvalidStringValueForDefaultMapBuilder: UnsetAddPropsSetter, GenericBuilder>, SetterForBar { + private val knownKeys: Set = setOf( + "bar" + ) + override fun getKnownKeys(): Set { + return knownKeys + } + private val instance: MutableMap + init { + this.instance = LinkedHashMap() + } + override fun build(): Map { + return instance + } + override fun getInstance(): MutableMap { + return instance + } + override fun getBuilderAfterBar(instance: MutableMap): InvalidStringValueForDefaultMapBuilder { + return this + } + override fun getBuilderAfterAdditionalProperty(instance: MutableMap): InvalidStringValueForDefaultMapBuilder { + return this + } + } + + + sealed interface InvalidStringValueForDefault1Boxed { + fun getData(): Any? + } + + data class InvalidStringValueForDefault1BoxedVoid(val data: Nothing?) : InvalidStringValueForDefault1Boxed { + override fun getData(): Any? { + return data + } + } + + data class InvalidStringValueForDefault1BoxedBoolean(val data: Boolean): InvalidStringValueForDefault1Boxed { + override fun getData(): Any? { + return data + } + } + + data class InvalidStringValueForDefault1BoxedNumber(val data: Number) : InvalidStringValueForDefault1Boxed { + override fun getData(): Any? { + return data + } + } + + data class InvalidStringValueForDefault1BoxedString(val data: String) : InvalidStringValueForDefault1Boxed { + override fun getData(): Any? { + return data + } + } + + data class InvalidStringValueForDefault1BoxedList(val data: FrozenList) : InvalidStringValueForDefault1Boxed { + override fun getData(): Any? { + return data + } + } + + data class InvalidStringValueForDefault1BoxedMap(val data: InvalidStringValueForDefaultMap) : InvalidStringValueForDefault1Boxed { + override fun getData(): Any? { + return data + } + } + + + class InvalidStringValueForDefault1 private constructor(): JsonSchema( + JsonSchemaInfo() + .properties(mapOf( + "bar" to Bar::class.java + )) + ), NullSchemaValidator, BooleanSchemaValidator, NumberSchemaValidator, StringSchemaValidator, ListSchemaValidator, InvalidStringValueForDefault1BoxedList>, MapSchemaValidator { + /* + NOTE: This class is auto generated by OpenAPI JSON Schema Generator. + Ref: https://github.com/openapi-json-schema-tools/openapi-json-schema-generator + + Do not edit the class manually. + */ + + companion object { + @Volatile + private var instance: InvalidStringValueForDefault1? = null + + fun getInstance() = + instance ?: synchronized(this) { + instance ?: InvalidStringValueForDefault1().also { instance = it } + } + } + + @Throws(ValidationException::class) + override fun validate(arg: Nothing?, configuration: SchemaConfiguration?): Nothing? { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validatedPathToSchemas = PathToSchemasMap() + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, LinkedHashSet()) + getPathToSchemas(this, castArg, validationMetadata, pathSet) + return castArg + } + + @Throws(ValidationException::class) + override fun validate(arg: Boolean, configuration: SchemaConfiguration?): Boolean { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validatedPathToSchemas = PathToSchemasMap() + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, LinkedHashSet()) + getPathToSchemas(this, castArg, validationMetadata, pathSet) + return castArg + } + + @Throws(ValidationException::class) + override fun validate(arg: Number, configuration: SchemaConfiguration?): Number { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validatedPathToSchemas = PathToSchemasMap() + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, LinkedHashSet()) + getPathToSchemas(this, castArg, validationMetadata, pathSet) + return castArg + } + + @Throws(ValidationException::class) + fun validate(arg: Int, configuration: SchemaConfiguration?): Int { + return validate(arg as Number, configuration) as Int + } + + @Throws(ValidationException::class) + fun validate(arg: Long, configuration: SchemaConfiguration?): Long { + return validate(arg as Number, configuration) as Long + } + + @Throws(ValidationException::class) + fun validate(arg: Float, configuration: SchemaConfiguration?): Float { + return validate(arg as Number, configuration) as Float + } + + @Throws(ValidationException::class) + fun validate(arg: Double, configuration: SchemaConfiguration?): Double { + return validate(arg as Number, configuration) as Double + } + + @Throws(ValidationException::class) + override fun validate(arg: String, configuration: SchemaConfiguration?): String { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validatedPathToSchemas = PathToSchemasMap() + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, LinkedHashSet()) + getPathToSchemas(this, castArg, validationMetadata, pathSet) + return castArg + } + + @Throws(ValidationException::class) + fun validate(arg: LocalDate, configuration: SchemaConfiguration?): String { + return validate(arg.toString(), configuration) + } + + @Throws(ValidationException::class) + fun validate(arg: ZonedDateTime, configuration: SchemaConfiguration?): String { + return validate(arg.toString(), configuration) + } + + @Throws(ValidationException::class) + fun validate(arg: UUID, configuration: SchemaConfiguration?): String { + return validate(arg.toString(), configuration) + } + + override fun getNewInstance(arg: List<*>, pathToItem: List, pathToSchemas: PathToSchemasMap): FrozenList { + val items: MutableList = ArrayList() + var i: Int = 0 + for (item: Any? in arg) { + val itemPathToItem = pathToItem + i + val schemas: LinkedHashMap, Nothing?>? = pathToSchemas.get(itemPathToItem) + if (schemas == null) { + throw RuntimeException("Validation result is invalid, schemas must exist for a pathToItem") + } + val itemSchema: JsonSchema<*> = schemas.entries.iterator().next().key + val itemInstance: Any? = itemSchema.getNewInstance(item, itemPathToItem, pathToSchemas) + items.add(itemInstance) + i += 1 + } + val newInstanceItems: FrozenList = FrozenList(items) + return newInstanceItems + } + + @Throws(ValidationException::class) + override fun validate(arg: List<*>, configuration: SchemaConfiguration?): FrozenList { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, PathToSchemasMap(), LinkedHashSet()) + val pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet) + return getNewInstance(castArg, validationMetadata.pathToItem, pathToSchemasMap) + } + + override fun getNewInstance(arg: Map<*, *>, pathToItem: List, pathToSchemas: PathToSchemasMap): InvalidStringValueForDefaultMap { + val properties: LinkedHashMap = LinkedHashMap() + for((propertyName, value) in arg) { + if (!(propertyName is String)) { + throw RuntimeException("Invalid non-string key value") + } + val propertyPathToItem: List = pathToItem + propertyName + val schemas: LinkedHashMap, Nothing?>? = pathToSchemas.get(propertyPathToItem) + if (schemas == null) { + throw RuntimeException("Validation result is invalid, schemas must exist for a pathToItem") + } + val propertySchema: JsonSchema<*> = schemas.entries.iterator().next().key + val propertyInstance: Any? = propertySchema.getNewInstance(value, propertyPathToItem, pathToSchemas) + properties[propertyName] = propertyInstance + } + val castProperties: FrozenMap = FrozenMap(properties) + return InvalidStringValueForDefaultMap(castProperties) + } + + @Throws(ValidationException::class) + override fun validate(arg: Map<*, *>, configuration: SchemaConfiguration?): InvalidStringValueForDefaultMap { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validatedPathToSchemas = PathToSchemasMap() + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, LinkedHashSet()) + val pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet) + return getNewInstance(castArg, validationMetadata.pathToItem, pathToSchemasMap) + } + + @Throws(ValidationException::class) + override fun validate(arg: Any?, configuration: SchemaConfiguration?): Any? { + if (arg == null) { + return validate(null, configuration) + } else if (arg is Boolean) { + return validate(arg, configuration) + } else if (arg is Number) { + return validate(arg, configuration) + } else if (arg is String) { + return validate(arg, configuration) + } else if (arg is List<*>) { + return validate(arg, configuration) + } else if (arg is Map<*, *>) { + return validate(arg, configuration) + } + throw ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema") + } + override fun getNewInstance(arg: Any?, pathToItem: List, pathToSchemas: PathToSchemasMap): Any? { + if (arg == null) { + return getNewInstance( null, pathToItem, pathToSchemas) + } else if (arg is Boolean) { + return getNewInstance(arg, pathToItem, pathToSchemas) + } else if (arg is Number) { + return getNewInstance(arg, pathToItem, pathToSchemas) + } else if (arg is String) { + return getNewInstance(arg, pathToItem, pathToSchemas) + } else if (arg is List<*>) { + return getNewInstance(arg, pathToItem, pathToSchemas) + } else if (arg is Map<*, *>) { + return getNewInstance(arg, pathToItem, pathToSchemas) + } + throw RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema") + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: Nothing?, configuration: SchemaConfiguration?): InvalidStringValueForDefault1BoxedVoid { + return InvalidStringValueForDefault1BoxedVoid(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: Boolean, configuration: SchemaConfiguration?): InvalidStringValueForDefault1BoxedBoolean { + return InvalidStringValueForDefault1BoxedBoolean(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: Number, configuration: SchemaConfiguration?): InvalidStringValueForDefault1BoxedNumber { + return InvalidStringValueForDefault1BoxedNumber(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: String, configuration: SchemaConfiguration?): InvalidStringValueForDefault1BoxedString { + return InvalidStringValueForDefault1BoxedString(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: List<*>, configuration: SchemaConfiguration?): InvalidStringValueForDefault1BoxedList { + return InvalidStringValueForDefault1BoxedList(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: Map<*, *>, configuration: SchemaConfiguration?): InvalidStringValueForDefault1BoxedMap { + return InvalidStringValueForDefault1BoxedMap(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: Any?, configuration: SchemaConfiguration?): InvalidStringValueForDefault1Boxed { + if (arg == null) { + return validateAndBox(null, configuration) + } else if (arg is Boolean) { + return validateAndBox(arg, configuration) + } else if (arg is String) { + return validateAndBox(arg, configuration) + } else if (arg is Number) { + return validateAndBox(arg, configuration) + } else if (arg is List<*>) { + return validateAndBox(arg, configuration) + } else if (arg is Map<*, *>) { + return validateAndBox(arg, configuration) + } + throw ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema") + } + } +} diff --git a/samples/client/3_0_3_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/schemas/Ipv4Format.kt b/samples/client/3_0_3_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/schemas/Ipv4Format.kt new file mode 100644 index 00000000000..6daf2520bd4 --- /dev/null +++ b/samples/client/3_0_3_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/schemas/Ipv4Format.kt @@ -0,0 +1,308 @@ +package org.openapijsonschematools.client.components.schemas +import java.time.LocalDate +import java.time.ZonedDateTime +import java.util.UUID +import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags +import org.openapijsonschematools.client.configurations.SchemaConfiguration +import org.openapijsonschematools.client.exceptions.InvalidAdditionalPropertyException +import org.openapijsonschematools.client.exceptions.UnsetPropertyException +import org.openapijsonschematools.client.exceptions.ValidationException +import org.openapijsonschematools.client.schemas.UnsetAddPropsSetter +import org.openapijsonschematools.client.schemas.validation.BooleanSchemaValidator +import org.openapijsonschematools.client.schemas.validation.FrozenList +import org.openapijsonschematools.client.schemas.validation.FrozenMap +import org.openapijsonschematools.client.schemas.validation.JsonSchema +import org.openapijsonschematools.client.schemas.validation.JsonSchemaInfo +import org.openapijsonschematools.client.schemas.validation.ListSchemaValidator +import org.openapijsonschematools.client.schemas.validation.MapSchemaValidator +import org.openapijsonschematools.client.schemas.validation.NullSchemaValidator +import org.openapijsonschematools.client.schemas.validation.NumberSchemaValidator +import org.openapijsonschematools.client.schemas.validation.PathToSchemasMap +import org.openapijsonschematools.client.schemas.validation.StringSchemaValidator +import org.openapijsonschematools.client.schemas.validation.ValidationMetadata + +class Ipv4Format { + // nest classes so all schemas and input/output classes can be public + + + sealed interface Ipv4Format1Boxed { + fun getData(): Any? + } + + data class Ipv4Format1BoxedVoid(val data: Nothing?) : Ipv4Format1Boxed { + override fun getData(): Any? { + return data + } + } + + data class Ipv4Format1BoxedBoolean(val data: Boolean): Ipv4Format1Boxed { + override fun getData(): Any? { + return data + } + } + + data class Ipv4Format1BoxedNumber(val data: Number) : Ipv4Format1Boxed { + override fun getData(): Any? { + return data + } + } + + data class Ipv4Format1BoxedString(val data: String) : Ipv4Format1Boxed { + override fun getData(): Any? { + return data + } + } + + data class Ipv4Format1BoxedList(val data: FrozenList) : Ipv4Format1Boxed { + override fun getData(): Any? { + return data + } + } + + data class Ipv4Format1BoxedMap(val data: FrozenMap) : Ipv4Format1Boxed { + override fun getData(): Any? { + return data + } + } + + + class Ipv4Format1 private constructor(): JsonSchema( + JsonSchemaInfo() + .format("ipv4") + ), NullSchemaValidator, BooleanSchemaValidator, NumberSchemaValidator, StringSchemaValidator, ListSchemaValidator, Ipv4Format1BoxedList>, MapSchemaValidator, Ipv4Format1BoxedMap> { + /* + NOTE: This class is auto generated by OpenAPI JSON Schema Generator. + Ref: https://github.com/openapi-json-schema-tools/openapi-json-schema-generator + + Do not edit the class manually. + */ + + companion object { + @Volatile + private var instance: Ipv4Format1? = null + + fun getInstance() = + instance ?: synchronized(this) { + instance ?: Ipv4Format1().also { instance = it } + } + } + + @Throws(ValidationException::class) + override fun validate(arg: Nothing?, configuration: SchemaConfiguration?): Nothing? { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validatedPathToSchemas = PathToSchemasMap() + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, LinkedHashSet()) + getPathToSchemas(this, castArg, validationMetadata, pathSet) + return castArg + } + + @Throws(ValidationException::class) + override fun validate(arg: Boolean, configuration: SchemaConfiguration?): Boolean { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validatedPathToSchemas = PathToSchemasMap() + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, LinkedHashSet()) + getPathToSchemas(this, castArg, validationMetadata, pathSet) + return castArg + } + + @Throws(ValidationException::class) + override fun validate(arg: Number, configuration: SchemaConfiguration?): Number { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validatedPathToSchemas = PathToSchemasMap() + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, LinkedHashSet()) + getPathToSchemas(this, castArg, validationMetadata, pathSet) + return castArg + } + + @Throws(ValidationException::class) + fun validate(arg: Int, configuration: SchemaConfiguration?): Int { + return validate(arg as Number, configuration) as Int + } + + @Throws(ValidationException::class) + fun validate(arg: Long, configuration: SchemaConfiguration?): Long { + return validate(arg as Number, configuration) as Long + } + + @Throws(ValidationException::class) + fun validate(arg: Float, configuration: SchemaConfiguration?): Float { + return validate(arg as Number, configuration) as Float + } + + @Throws(ValidationException::class) + fun validate(arg: Double, configuration: SchemaConfiguration?): Double { + return validate(arg as Number, configuration) as Double + } + + @Throws(ValidationException::class) + override fun validate(arg: String, configuration: SchemaConfiguration?): String { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validatedPathToSchemas = PathToSchemasMap() + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, LinkedHashSet()) + getPathToSchemas(this, castArg, validationMetadata, pathSet) + return castArg + } + + @Throws(ValidationException::class) + fun validate(arg: LocalDate, configuration: SchemaConfiguration?): String { + return validate(arg.toString(), configuration) + } + + @Throws(ValidationException::class) + fun validate(arg: ZonedDateTime, configuration: SchemaConfiguration?): String { + return validate(arg.toString(), configuration) + } + + @Throws(ValidationException::class) + fun validate(arg: UUID, configuration: SchemaConfiguration?): String { + return validate(arg.toString(), configuration) + } + + override fun getNewInstance(arg: List<*>, pathToItem: List, pathToSchemas: PathToSchemasMap): FrozenList { + val items: MutableList = ArrayList() + var i: Int = 0 + for (item: Any? in arg) { + val itemPathToItem = pathToItem + i + val schemas: LinkedHashMap, Nothing?>? = pathToSchemas.get(itemPathToItem) + if (schemas == null) { + throw RuntimeException("Validation result is invalid, schemas must exist for a pathToItem") + } + val itemSchema: JsonSchema<*> = schemas.entries.iterator().next().key + val itemInstance: Any? = itemSchema.getNewInstance(item, itemPathToItem, pathToSchemas) + items.add(itemInstance) + i += 1 + } + val newInstanceItems: FrozenList = FrozenList(items) + return newInstanceItems + } + + @Throws(ValidationException::class) + override fun validate(arg: List<*>, configuration: SchemaConfiguration?): FrozenList { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, PathToSchemasMap(), LinkedHashSet()) + val pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet) + return getNewInstance(castArg, validationMetadata.pathToItem, pathToSchemasMap) + } + + override fun getNewInstance(arg: Map<*, *>, pathToItem: List, pathToSchemas: PathToSchemasMap): FrozenMap { + val properties: LinkedHashMap = LinkedHashMap() + for((propertyName, value) in arg) { + if (!(propertyName is String)) { + throw RuntimeException("Invalid non-string key value") + } + val propertyPathToItem: List = pathToItem + propertyName + val schemas: LinkedHashMap, Nothing?>? = pathToSchemas.get(propertyPathToItem) + if (schemas == null) { + throw RuntimeException("Validation result is invalid, schemas must exist for a pathToItem") + } + val propertySchema: JsonSchema<*> = schemas.entries.iterator().next().key + val propertyInstance: Any? = propertySchema.getNewInstance(value, propertyPathToItem, pathToSchemas) + properties[propertyName] = propertyInstance + } + val castProperties: FrozenMap = FrozenMap(properties) + return castProperties + } + + @Throws(ValidationException::class) + override fun validate(arg: Map<*, *>, configuration: SchemaConfiguration?): FrozenMap { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validatedPathToSchemas = PathToSchemasMap() + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, LinkedHashSet()) + val pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet) + return getNewInstance(castArg, validationMetadata.pathToItem, pathToSchemasMap) + } + + @Throws(ValidationException::class) + override fun validate(arg: Any?, configuration: SchemaConfiguration?): Any? { + if (arg == null) { + return validate(null, configuration) + } else if (arg is Boolean) { + return validate(arg, configuration) + } else if (arg is Number) { + return validate(arg, configuration) + } else if (arg is String) { + return validate(arg, configuration) + } else if (arg is List<*>) { + return validate(arg, configuration) + } else if (arg is Map<*, *>) { + return validate(arg, configuration) + } + throw ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema") + } + override fun getNewInstance(arg: Any?, pathToItem: List, pathToSchemas: PathToSchemasMap): Any? { + if (arg == null) { + return getNewInstance( null, pathToItem, pathToSchemas) + } else if (arg is Boolean) { + return getNewInstance(arg, pathToItem, pathToSchemas) + } else if (arg is Number) { + return getNewInstance(arg, pathToItem, pathToSchemas) + } else if (arg is String) { + return getNewInstance(arg, pathToItem, pathToSchemas) + } else if (arg is List<*>) { + return getNewInstance(arg, pathToItem, pathToSchemas) + } else if (arg is Map<*, *>) { + return getNewInstance(arg, pathToItem, pathToSchemas) + } + throw RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema") + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: Nothing?, configuration: SchemaConfiguration?): Ipv4Format1BoxedVoid { + return Ipv4Format1BoxedVoid(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: Boolean, configuration: SchemaConfiguration?): Ipv4Format1BoxedBoolean { + return Ipv4Format1BoxedBoolean(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: Number, configuration: SchemaConfiguration?): Ipv4Format1BoxedNumber { + return Ipv4Format1BoxedNumber(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: String, configuration: SchemaConfiguration?): Ipv4Format1BoxedString { + return Ipv4Format1BoxedString(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: List<*>, configuration: SchemaConfiguration?): Ipv4Format1BoxedList { + return Ipv4Format1BoxedList(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: Map<*, *>, configuration: SchemaConfiguration?): Ipv4Format1BoxedMap { + return Ipv4Format1BoxedMap(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: Any?, configuration: SchemaConfiguration?): Ipv4Format1Boxed { + if (arg == null) { + return validateAndBox(null, configuration) + } else if (arg is Boolean) { + return validateAndBox(arg, configuration) + } else if (arg is String) { + return validateAndBox(arg, configuration) + } else if (arg is Number) { + return validateAndBox(arg, configuration) + } else if (arg is List<*>) { + return validateAndBox(arg, configuration) + } else if (arg is Map<*, *>) { + return validateAndBox(arg, configuration) + } + throw ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema") + } + } +} diff --git a/samples/client/3_0_3_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/schemas/Ipv6Format.kt b/samples/client/3_0_3_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/schemas/Ipv6Format.kt new file mode 100644 index 00000000000..e08e410e9ea --- /dev/null +++ b/samples/client/3_0_3_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/schemas/Ipv6Format.kt @@ -0,0 +1,308 @@ +package org.openapijsonschematools.client.components.schemas +import java.time.LocalDate +import java.time.ZonedDateTime +import java.util.UUID +import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags +import org.openapijsonschematools.client.configurations.SchemaConfiguration +import org.openapijsonschematools.client.exceptions.InvalidAdditionalPropertyException +import org.openapijsonschematools.client.exceptions.UnsetPropertyException +import org.openapijsonschematools.client.exceptions.ValidationException +import org.openapijsonschematools.client.schemas.UnsetAddPropsSetter +import org.openapijsonschematools.client.schemas.validation.BooleanSchemaValidator +import org.openapijsonschematools.client.schemas.validation.FrozenList +import org.openapijsonschematools.client.schemas.validation.FrozenMap +import org.openapijsonschematools.client.schemas.validation.JsonSchema +import org.openapijsonschematools.client.schemas.validation.JsonSchemaInfo +import org.openapijsonschematools.client.schemas.validation.ListSchemaValidator +import org.openapijsonschematools.client.schemas.validation.MapSchemaValidator +import org.openapijsonschematools.client.schemas.validation.NullSchemaValidator +import org.openapijsonschematools.client.schemas.validation.NumberSchemaValidator +import org.openapijsonschematools.client.schemas.validation.PathToSchemasMap +import org.openapijsonschematools.client.schemas.validation.StringSchemaValidator +import org.openapijsonschematools.client.schemas.validation.ValidationMetadata + +class Ipv6Format { + // nest classes so all schemas and input/output classes can be public + + + sealed interface Ipv6Format1Boxed { + fun getData(): Any? + } + + data class Ipv6Format1BoxedVoid(val data: Nothing?) : Ipv6Format1Boxed { + override fun getData(): Any? { + return data + } + } + + data class Ipv6Format1BoxedBoolean(val data: Boolean): Ipv6Format1Boxed { + override fun getData(): Any? { + return data + } + } + + data class Ipv6Format1BoxedNumber(val data: Number) : Ipv6Format1Boxed { + override fun getData(): Any? { + return data + } + } + + data class Ipv6Format1BoxedString(val data: String) : Ipv6Format1Boxed { + override fun getData(): Any? { + return data + } + } + + data class Ipv6Format1BoxedList(val data: FrozenList) : Ipv6Format1Boxed { + override fun getData(): Any? { + return data + } + } + + data class Ipv6Format1BoxedMap(val data: FrozenMap) : Ipv6Format1Boxed { + override fun getData(): Any? { + return data + } + } + + + class Ipv6Format1 private constructor(): JsonSchema( + JsonSchemaInfo() + .format("ipv6") + ), NullSchemaValidator, BooleanSchemaValidator, NumberSchemaValidator, StringSchemaValidator, ListSchemaValidator, Ipv6Format1BoxedList>, MapSchemaValidator, Ipv6Format1BoxedMap> { + /* + NOTE: This class is auto generated by OpenAPI JSON Schema Generator. + Ref: https://github.com/openapi-json-schema-tools/openapi-json-schema-generator + + Do not edit the class manually. + */ + + companion object { + @Volatile + private var instance: Ipv6Format1? = null + + fun getInstance() = + instance ?: synchronized(this) { + instance ?: Ipv6Format1().also { instance = it } + } + } + + @Throws(ValidationException::class) + override fun validate(arg: Nothing?, configuration: SchemaConfiguration?): Nothing? { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validatedPathToSchemas = PathToSchemasMap() + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, LinkedHashSet()) + getPathToSchemas(this, castArg, validationMetadata, pathSet) + return castArg + } + + @Throws(ValidationException::class) + override fun validate(arg: Boolean, configuration: SchemaConfiguration?): Boolean { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validatedPathToSchemas = PathToSchemasMap() + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, LinkedHashSet()) + getPathToSchemas(this, castArg, validationMetadata, pathSet) + return castArg + } + + @Throws(ValidationException::class) + override fun validate(arg: Number, configuration: SchemaConfiguration?): Number { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validatedPathToSchemas = PathToSchemasMap() + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, LinkedHashSet()) + getPathToSchemas(this, castArg, validationMetadata, pathSet) + return castArg + } + + @Throws(ValidationException::class) + fun validate(arg: Int, configuration: SchemaConfiguration?): Int { + return validate(arg as Number, configuration) as Int + } + + @Throws(ValidationException::class) + fun validate(arg: Long, configuration: SchemaConfiguration?): Long { + return validate(arg as Number, configuration) as Long + } + + @Throws(ValidationException::class) + fun validate(arg: Float, configuration: SchemaConfiguration?): Float { + return validate(arg as Number, configuration) as Float + } + + @Throws(ValidationException::class) + fun validate(arg: Double, configuration: SchemaConfiguration?): Double { + return validate(arg as Number, configuration) as Double + } + + @Throws(ValidationException::class) + override fun validate(arg: String, configuration: SchemaConfiguration?): String { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validatedPathToSchemas = PathToSchemasMap() + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, LinkedHashSet()) + getPathToSchemas(this, castArg, validationMetadata, pathSet) + return castArg + } + + @Throws(ValidationException::class) + fun validate(arg: LocalDate, configuration: SchemaConfiguration?): String { + return validate(arg.toString(), configuration) + } + + @Throws(ValidationException::class) + fun validate(arg: ZonedDateTime, configuration: SchemaConfiguration?): String { + return validate(arg.toString(), configuration) + } + + @Throws(ValidationException::class) + fun validate(arg: UUID, configuration: SchemaConfiguration?): String { + return validate(arg.toString(), configuration) + } + + override fun getNewInstance(arg: List<*>, pathToItem: List, pathToSchemas: PathToSchemasMap): FrozenList { + val items: MutableList = ArrayList() + var i: Int = 0 + for (item: Any? in arg) { + val itemPathToItem = pathToItem + i + val schemas: LinkedHashMap, Nothing?>? = pathToSchemas.get(itemPathToItem) + if (schemas == null) { + throw RuntimeException("Validation result is invalid, schemas must exist for a pathToItem") + } + val itemSchema: JsonSchema<*> = schemas.entries.iterator().next().key + val itemInstance: Any? = itemSchema.getNewInstance(item, itemPathToItem, pathToSchemas) + items.add(itemInstance) + i += 1 + } + val newInstanceItems: FrozenList = FrozenList(items) + return newInstanceItems + } + + @Throws(ValidationException::class) + override fun validate(arg: List<*>, configuration: SchemaConfiguration?): FrozenList { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, PathToSchemasMap(), LinkedHashSet()) + val pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet) + return getNewInstance(castArg, validationMetadata.pathToItem, pathToSchemasMap) + } + + override fun getNewInstance(arg: Map<*, *>, pathToItem: List, pathToSchemas: PathToSchemasMap): FrozenMap { + val properties: LinkedHashMap = LinkedHashMap() + for((propertyName, value) in arg) { + if (!(propertyName is String)) { + throw RuntimeException("Invalid non-string key value") + } + val propertyPathToItem: List = pathToItem + propertyName + val schemas: LinkedHashMap, Nothing?>? = pathToSchemas.get(propertyPathToItem) + if (schemas == null) { + throw RuntimeException("Validation result is invalid, schemas must exist for a pathToItem") + } + val propertySchema: JsonSchema<*> = schemas.entries.iterator().next().key + val propertyInstance: Any? = propertySchema.getNewInstance(value, propertyPathToItem, pathToSchemas) + properties[propertyName] = propertyInstance + } + val castProperties: FrozenMap = FrozenMap(properties) + return castProperties + } + + @Throws(ValidationException::class) + override fun validate(arg: Map<*, *>, configuration: SchemaConfiguration?): FrozenMap { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validatedPathToSchemas = PathToSchemasMap() + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, LinkedHashSet()) + val pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet) + return getNewInstance(castArg, validationMetadata.pathToItem, pathToSchemasMap) + } + + @Throws(ValidationException::class) + override fun validate(arg: Any?, configuration: SchemaConfiguration?): Any? { + if (arg == null) { + return validate(null, configuration) + } else if (arg is Boolean) { + return validate(arg, configuration) + } else if (arg is Number) { + return validate(arg, configuration) + } else if (arg is String) { + return validate(arg, configuration) + } else if (arg is List<*>) { + return validate(arg, configuration) + } else if (arg is Map<*, *>) { + return validate(arg, configuration) + } + throw ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema") + } + override fun getNewInstance(arg: Any?, pathToItem: List, pathToSchemas: PathToSchemasMap): Any? { + if (arg == null) { + return getNewInstance( null, pathToItem, pathToSchemas) + } else if (arg is Boolean) { + return getNewInstance(arg, pathToItem, pathToSchemas) + } else if (arg is Number) { + return getNewInstance(arg, pathToItem, pathToSchemas) + } else if (arg is String) { + return getNewInstance(arg, pathToItem, pathToSchemas) + } else if (arg is List<*>) { + return getNewInstance(arg, pathToItem, pathToSchemas) + } else if (arg is Map<*, *>) { + return getNewInstance(arg, pathToItem, pathToSchemas) + } + throw RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema") + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: Nothing?, configuration: SchemaConfiguration?): Ipv6Format1BoxedVoid { + return Ipv6Format1BoxedVoid(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: Boolean, configuration: SchemaConfiguration?): Ipv6Format1BoxedBoolean { + return Ipv6Format1BoxedBoolean(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: Number, configuration: SchemaConfiguration?): Ipv6Format1BoxedNumber { + return Ipv6Format1BoxedNumber(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: String, configuration: SchemaConfiguration?): Ipv6Format1BoxedString { + return Ipv6Format1BoxedString(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: List<*>, configuration: SchemaConfiguration?): Ipv6Format1BoxedList { + return Ipv6Format1BoxedList(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: Map<*, *>, configuration: SchemaConfiguration?): Ipv6Format1BoxedMap { + return Ipv6Format1BoxedMap(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: Any?, configuration: SchemaConfiguration?): Ipv6Format1Boxed { + if (arg == null) { + return validateAndBox(null, configuration) + } else if (arg is Boolean) { + return validateAndBox(arg, configuration) + } else if (arg is String) { + return validateAndBox(arg, configuration) + } else if (arg is Number) { + return validateAndBox(arg, configuration) + } else if (arg is List<*>) { + return validateAndBox(arg, configuration) + } else if (arg is Map<*, *>) { + return validateAndBox(arg, configuration) + } + throw ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema") + } + } +} diff --git a/samples/client/3_0_3_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/schemas/JsonPointerFormat.kt b/samples/client/3_0_3_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/schemas/JsonPointerFormat.kt new file mode 100644 index 00000000000..b45b9ad16a2 --- /dev/null +++ b/samples/client/3_0_3_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/schemas/JsonPointerFormat.kt @@ -0,0 +1,308 @@ +package org.openapijsonschematools.client.components.schemas +import java.time.LocalDate +import java.time.ZonedDateTime +import java.util.UUID +import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags +import org.openapijsonschematools.client.configurations.SchemaConfiguration +import org.openapijsonschematools.client.exceptions.InvalidAdditionalPropertyException +import org.openapijsonschematools.client.exceptions.UnsetPropertyException +import org.openapijsonschematools.client.exceptions.ValidationException +import org.openapijsonschematools.client.schemas.UnsetAddPropsSetter +import org.openapijsonschematools.client.schemas.validation.BooleanSchemaValidator +import org.openapijsonschematools.client.schemas.validation.FrozenList +import org.openapijsonschematools.client.schemas.validation.FrozenMap +import org.openapijsonschematools.client.schemas.validation.JsonSchema +import org.openapijsonschematools.client.schemas.validation.JsonSchemaInfo +import org.openapijsonschematools.client.schemas.validation.ListSchemaValidator +import org.openapijsonschematools.client.schemas.validation.MapSchemaValidator +import org.openapijsonschematools.client.schemas.validation.NullSchemaValidator +import org.openapijsonschematools.client.schemas.validation.NumberSchemaValidator +import org.openapijsonschematools.client.schemas.validation.PathToSchemasMap +import org.openapijsonschematools.client.schemas.validation.StringSchemaValidator +import org.openapijsonschematools.client.schemas.validation.ValidationMetadata + +class JsonPointerFormat { + // nest classes so all schemas and input/output classes can be public + + + sealed interface JsonPointerFormat1Boxed { + fun getData(): Any? + } + + data class JsonPointerFormat1BoxedVoid(val data: Nothing?) : JsonPointerFormat1Boxed { + override fun getData(): Any? { + return data + } + } + + data class JsonPointerFormat1BoxedBoolean(val data: Boolean): JsonPointerFormat1Boxed { + override fun getData(): Any? { + return data + } + } + + data class JsonPointerFormat1BoxedNumber(val data: Number) : JsonPointerFormat1Boxed { + override fun getData(): Any? { + return data + } + } + + data class JsonPointerFormat1BoxedString(val data: String) : JsonPointerFormat1Boxed { + override fun getData(): Any? { + return data + } + } + + data class JsonPointerFormat1BoxedList(val data: FrozenList) : JsonPointerFormat1Boxed { + override fun getData(): Any? { + return data + } + } + + data class JsonPointerFormat1BoxedMap(val data: FrozenMap) : JsonPointerFormat1Boxed { + override fun getData(): Any? { + return data + } + } + + + class JsonPointerFormat1 private constructor(): JsonSchema( + JsonSchemaInfo() + .format("json-pointer") + ), NullSchemaValidator, BooleanSchemaValidator, NumberSchemaValidator, StringSchemaValidator, ListSchemaValidator, JsonPointerFormat1BoxedList>, MapSchemaValidator, JsonPointerFormat1BoxedMap> { + /* + NOTE: This class is auto generated by OpenAPI JSON Schema Generator. + Ref: https://github.com/openapi-json-schema-tools/openapi-json-schema-generator + + Do not edit the class manually. + */ + + companion object { + @Volatile + private var instance: JsonPointerFormat1? = null + + fun getInstance() = + instance ?: synchronized(this) { + instance ?: JsonPointerFormat1().also { instance = it } + } + } + + @Throws(ValidationException::class) + override fun validate(arg: Nothing?, configuration: SchemaConfiguration?): Nothing? { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validatedPathToSchemas = PathToSchemasMap() + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, LinkedHashSet()) + getPathToSchemas(this, castArg, validationMetadata, pathSet) + return castArg + } + + @Throws(ValidationException::class) + override fun validate(arg: Boolean, configuration: SchemaConfiguration?): Boolean { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validatedPathToSchemas = PathToSchemasMap() + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, LinkedHashSet()) + getPathToSchemas(this, castArg, validationMetadata, pathSet) + return castArg + } + + @Throws(ValidationException::class) + override fun validate(arg: Number, configuration: SchemaConfiguration?): Number { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validatedPathToSchemas = PathToSchemasMap() + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, LinkedHashSet()) + getPathToSchemas(this, castArg, validationMetadata, pathSet) + return castArg + } + + @Throws(ValidationException::class) + fun validate(arg: Int, configuration: SchemaConfiguration?): Int { + return validate(arg as Number, configuration) as Int + } + + @Throws(ValidationException::class) + fun validate(arg: Long, configuration: SchemaConfiguration?): Long { + return validate(arg as Number, configuration) as Long + } + + @Throws(ValidationException::class) + fun validate(arg: Float, configuration: SchemaConfiguration?): Float { + return validate(arg as Number, configuration) as Float + } + + @Throws(ValidationException::class) + fun validate(arg: Double, configuration: SchemaConfiguration?): Double { + return validate(arg as Number, configuration) as Double + } + + @Throws(ValidationException::class) + override fun validate(arg: String, configuration: SchemaConfiguration?): String { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validatedPathToSchemas = PathToSchemasMap() + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, LinkedHashSet()) + getPathToSchemas(this, castArg, validationMetadata, pathSet) + return castArg + } + + @Throws(ValidationException::class) + fun validate(arg: LocalDate, configuration: SchemaConfiguration?): String { + return validate(arg.toString(), configuration) + } + + @Throws(ValidationException::class) + fun validate(arg: ZonedDateTime, configuration: SchemaConfiguration?): String { + return validate(arg.toString(), configuration) + } + + @Throws(ValidationException::class) + fun validate(arg: UUID, configuration: SchemaConfiguration?): String { + return validate(arg.toString(), configuration) + } + + override fun getNewInstance(arg: List<*>, pathToItem: List, pathToSchemas: PathToSchemasMap): FrozenList { + val items: MutableList = ArrayList() + var i: Int = 0 + for (item: Any? in arg) { + val itemPathToItem = pathToItem + i + val schemas: LinkedHashMap, Nothing?>? = pathToSchemas.get(itemPathToItem) + if (schemas == null) { + throw RuntimeException("Validation result is invalid, schemas must exist for a pathToItem") + } + val itemSchema: JsonSchema<*> = schemas.entries.iterator().next().key + val itemInstance: Any? = itemSchema.getNewInstance(item, itemPathToItem, pathToSchemas) + items.add(itemInstance) + i += 1 + } + val newInstanceItems: FrozenList = FrozenList(items) + return newInstanceItems + } + + @Throws(ValidationException::class) + override fun validate(arg: List<*>, configuration: SchemaConfiguration?): FrozenList { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, PathToSchemasMap(), LinkedHashSet()) + val pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet) + return getNewInstance(castArg, validationMetadata.pathToItem, pathToSchemasMap) + } + + override fun getNewInstance(arg: Map<*, *>, pathToItem: List, pathToSchemas: PathToSchemasMap): FrozenMap { + val properties: LinkedHashMap = LinkedHashMap() + for((propertyName, value) in arg) { + if (!(propertyName is String)) { + throw RuntimeException("Invalid non-string key value") + } + val propertyPathToItem: List = pathToItem + propertyName + val schemas: LinkedHashMap, Nothing?>? = pathToSchemas.get(propertyPathToItem) + if (schemas == null) { + throw RuntimeException("Validation result is invalid, schemas must exist for a pathToItem") + } + val propertySchema: JsonSchema<*> = schemas.entries.iterator().next().key + val propertyInstance: Any? = propertySchema.getNewInstance(value, propertyPathToItem, pathToSchemas) + properties[propertyName] = propertyInstance + } + val castProperties: FrozenMap = FrozenMap(properties) + return castProperties + } + + @Throws(ValidationException::class) + override fun validate(arg: Map<*, *>, configuration: SchemaConfiguration?): FrozenMap { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validatedPathToSchemas = PathToSchemasMap() + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, LinkedHashSet()) + val pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet) + return getNewInstance(castArg, validationMetadata.pathToItem, pathToSchemasMap) + } + + @Throws(ValidationException::class) + override fun validate(arg: Any?, configuration: SchemaConfiguration?): Any? { + if (arg == null) { + return validate(null, configuration) + } else if (arg is Boolean) { + return validate(arg, configuration) + } else if (arg is Number) { + return validate(arg, configuration) + } else if (arg is String) { + return validate(arg, configuration) + } else if (arg is List<*>) { + return validate(arg, configuration) + } else if (arg is Map<*, *>) { + return validate(arg, configuration) + } + throw ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema") + } + override fun getNewInstance(arg: Any?, pathToItem: List, pathToSchemas: PathToSchemasMap): Any? { + if (arg == null) { + return getNewInstance( null, pathToItem, pathToSchemas) + } else if (arg is Boolean) { + return getNewInstance(arg, pathToItem, pathToSchemas) + } else if (arg is Number) { + return getNewInstance(arg, pathToItem, pathToSchemas) + } else if (arg is String) { + return getNewInstance(arg, pathToItem, pathToSchemas) + } else if (arg is List<*>) { + return getNewInstance(arg, pathToItem, pathToSchemas) + } else if (arg is Map<*, *>) { + return getNewInstance(arg, pathToItem, pathToSchemas) + } + throw RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema") + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: Nothing?, configuration: SchemaConfiguration?): JsonPointerFormat1BoxedVoid { + return JsonPointerFormat1BoxedVoid(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: Boolean, configuration: SchemaConfiguration?): JsonPointerFormat1BoxedBoolean { + return JsonPointerFormat1BoxedBoolean(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: Number, configuration: SchemaConfiguration?): JsonPointerFormat1BoxedNumber { + return JsonPointerFormat1BoxedNumber(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: String, configuration: SchemaConfiguration?): JsonPointerFormat1BoxedString { + return JsonPointerFormat1BoxedString(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: List<*>, configuration: SchemaConfiguration?): JsonPointerFormat1BoxedList { + return JsonPointerFormat1BoxedList(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: Map<*, *>, configuration: SchemaConfiguration?): JsonPointerFormat1BoxedMap { + return JsonPointerFormat1BoxedMap(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: Any?, configuration: SchemaConfiguration?): JsonPointerFormat1Boxed { + if (arg == null) { + return validateAndBox(null, configuration) + } else if (arg is Boolean) { + return validateAndBox(arg, configuration) + } else if (arg is String) { + return validateAndBox(arg, configuration) + } else if (arg is Number) { + return validateAndBox(arg, configuration) + } else if (arg is List<*>) { + return validateAndBox(arg, configuration) + } else if (arg is Map<*, *>) { + return validateAndBox(arg, configuration) + } + throw ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema") + } + } +} diff --git a/samples/client/3_0_3_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/schemas/MaximumValidation.kt b/samples/client/3_0_3_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/schemas/MaximumValidation.kt new file mode 100644 index 00000000000..46d8b221c64 --- /dev/null +++ b/samples/client/3_0_3_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/schemas/MaximumValidation.kt @@ -0,0 +1,308 @@ +package org.openapijsonschematools.client.components.schemas +import java.time.LocalDate +import java.time.ZonedDateTime +import java.util.UUID +import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags +import org.openapijsonschematools.client.configurations.SchemaConfiguration +import org.openapijsonschematools.client.exceptions.InvalidAdditionalPropertyException +import org.openapijsonschematools.client.exceptions.UnsetPropertyException +import org.openapijsonschematools.client.exceptions.ValidationException +import org.openapijsonschematools.client.schemas.UnsetAddPropsSetter +import org.openapijsonschematools.client.schemas.validation.BooleanSchemaValidator +import org.openapijsonschematools.client.schemas.validation.FrozenList +import org.openapijsonschematools.client.schemas.validation.FrozenMap +import org.openapijsonschematools.client.schemas.validation.JsonSchema +import org.openapijsonschematools.client.schemas.validation.JsonSchemaInfo +import org.openapijsonschematools.client.schemas.validation.ListSchemaValidator +import org.openapijsonschematools.client.schemas.validation.MapSchemaValidator +import org.openapijsonschematools.client.schemas.validation.NullSchemaValidator +import org.openapijsonschematools.client.schemas.validation.NumberSchemaValidator +import org.openapijsonschematools.client.schemas.validation.PathToSchemasMap +import org.openapijsonschematools.client.schemas.validation.StringSchemaValidator +import org.openapijsonschematools.client.schemas.validation.ValidationMetadata + +class MaximumValidation { + // nest classes so all schemas and input/output classes can be public + + + sealed interface MaximumValidation1Boxed { + fun getData(): Any? + } + + data class MaximumValidation1BoxedVoid(val data: Nothing?) : MaximumValidation1Boxed { + override fun getData(): Any? { + return data + } + } + + data class MaximumValidation1BoxedBoolean(val data: Boolean): MaximumValidation1Boxed { + override fun getData(): Any? { + return data + } + } + + data class MaximumValidation1BoxedNumber(val data: Number) : MaximumValidation1Boxed { + override fun getData(): Any? { + return data + } + } + + data class MaximumValidation1BoxedString(val data: String) : MaximumValidation1Boxed { + override fun getData(): Any? { + return data + } + } + + data class MaximumValidation1BoxedList(val data: FrozenList) : MaximumValidation1Boxed { + override fun getData(): Any? { + return data + } + } + + data class MaximumValidation1BoxedMap(val data: FrozenMap) : MaximumValidation1Boxed { + override fun getData(): Any? { + return data + } + } + + + class MaximumValidation1 private constructor(): JsonSchema( + JsonSchemaInfo() + .maximum(3.0) + ), NullSchemaValidator, BooleanSchemaValidator, NumberSchemaValidator, StringSchemaValidator, ListSchemaValidator, MaximumValidation1BoxedList>, MapSchemaValidator, MaximumValidation1BoxedMap> { + /* + NOTE: This class is auto generated by OpenAPI JSON Schema Generator. + Ref: https://github.com/openapi-json-schema-tools/openapi-json-schema-generator + + Do not edit the class manually. + */ + + companion object { + @Volatile + private var instance: MaximumValidation1? = null + + fun getInstance() = + instance ?: synchronized(this) { + instance ?: MaximumValidation1().also { instance = it } + } + } + + @Throws(ValidationException::class) + override fun validate(arg: Nothing?, configuration: SchemaConfiguration?): Nothing? { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validatedPathToSchemas = PathToSchemasMap() + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, LinkedHashSet()) + getPathToSchemas(this, castArg, validationMetadata, pathSet) + return castArg + } + + @Throws(ValidationException::class) + override fun validate(arg: Boolean, configuration: SchemaConfiguration?): Boolean { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validatedPathToSchemas = PathToSchemasMap() + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, LinkedHashSet()) + getPathToSchemas(this, castArg, validationMetadata, pathSet) + return castArg + } + + @Throws(ValidationException::class) + override fun validate(arg: Number, configuration: SchemaConfiguration?): Number { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validatedPathToSchemas = PathToSchemasMap() + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, LinkedHashSet()) + getPathToSchemas(this, castArg, validationMetadata, pathSet) + return castArg + } + + @Throws(ValidationException::class) + fun validate(arg: Int, configuration: SchemaConfiguration?): Int { + return validate(arg as Number, configuration) as Int + } + + @Throws(ValidationException::class) + fun validate(arg: Long, configuration: SchemaConfiguration?): Long { + return validate(arg as Number, configuration) as Long + } + + @Throws(ValidationException::class) + fun validate(arg: Float, configuration: SchemaConfiguration?): Float { + return validate(arg as Number, configuration) as Float + } + + @Throws(ValidationException::class) + fun validate(arg: Double, configuration: SchemaConfiguration?): Double { + return validate(arg as Number, configuration) as Double + } + + @Throws(ValidationException::class) + override fun validate(arg: String, configuration: SchemaConfiguration?): String { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validatedPathToSchemas = PathToSchemasMap() + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, LinkedHashSet()) + getPathToSchemas(this, castArg, validationMetadata, pathSet) + return castArg + } + + @Throws(ValidationException::class) + fun validate(arg: LocalDate, configuration: SchemaConfiguration?): String { + return validate(arg.toString(), configuration) + } + + @Throws(ValidationException::class) + fun validate(arg: ZonedDateTime, configuration: SchemaConfiguration?): String { + return validate(arg.toString(), configuration) + } + + @Throws(ValidationException::class) + fun validate(arg: UUID, configuration: SchemaConfiguration?): String { + return validate(arg.toString(), configuration) + } + + override fun getNewInstance(arg: List<*>, pathToItem: List, pathToSchemas: PathToSchemasMap): FrozenList { + val items: MutableList = ArrayList() + var i: Int = 0 + for (item: Any? in arg) { + val itemPathToItem = pathToItem + i + val schemas: LinkedHashMap, Nothing?>? = pathToSchemas.get(itemPathToItem) + if (schemas == null) { + throw RuntimeException("Validation result is invalid, schemas must exist for a pathToItem") + } + val itemSchema: JsonSchema<*> = schemas.entries.iterator().next().key + val itemInstance: Any? = itemSchema.getNewInstance(item, itemPathToItem, pathToSchemas) + items.add(itemInstance) + i += 1 + } + val newInstanceItems: FrozenList = FrozenList(items) + return newInstanceItems + } + + @Throws(ValidationException::class) + override fun validate(arg: List<*>, configuration: SchemaConfiguration?): FrozenList { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, PathToSchemasMap(), LinkedHashSet()) + val pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet) + return getNewInstance(castArg, validationMetadata.pathToItem, pathToSchemasMap) + } + + override fun getNewInstance(arg: Map<*, *>, pathToItem: List, pathToSchemas: PathToSchemasMap): FrozenMap { + val properties: LinkedHashMap = LinkedHashMap() + for((propertyName, value) in arg) { + if (!(propertyName is String)) { + throw RuntimeException("Invalid non-string key value") + } + val propertyPathToItem: List = pathToItem + propertyName + val schemas: LinkedHashMap, Nothing?>? = pathToSchemas.get(propertyPathToItem) + if (schemas == null) { + throw RuntimeException("Validation result is invalid, schemas must exist for a pathToItem") + } + val propertySchema: JsonSchema<*> = schemas.entries.iterator().next().key + val propertyInstance: Any? = propertySchema.getNewInstance(value, propertyPathToItem, pathToSchemas) + properties[propertyName] = propertyInstance + } + val castProperties: FrozenMap = FrozenMap(properties) + return castProperties + } + + @Throws(ValidationException::class) + override fun validate(arg: Map<*, *>, configuration: SchemaConfiguration?): FrozenMap { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validatedPathToSchemas = PathToSchemasMap() + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, LinkedHashSet()) + val pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet) + return getNewInstance(castArg, validationMetadata.pathToItem, pathToSchemasMap) + } + + @Throws(ValidationException::class) + override fun validate(arg: Any?, configuration: SchemaConfiguration?): Any? { + if (arg == null) { + return validate(null, configuration) + } else if (arg is Boolean) { + return validate(arg, configuration) + } else if (arg is Number) { + return validate(arg, configuration) + } else if (arg is String) { + return validate(arg, configuration) + } else if (arg is List<*>) { + return validate(arg, configuration) + } else if (arg is Map<*, *>) { + return validate(arg, configuration) + } + throw ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema") + } + override fun getNewInstance(arg: Any?, pathToItem: List, pathToSchemas: PathToSchemasMap): Any? { + if (arg == null) { + return getNewInstance( null, pathToItem, pathToSchemas) + } else if (arg is Boolean) { + return getNewInstance(arg, pathToItem, pathToSchemas) + } else if (arg is Number) { + return getNewInstance(arg, pathToItem, pathToSchemas) + } else if (arg is String) { + return getNewInstance(arg, pathToItem, pathToSchemas) + } else if (arg is List<*>) { + return getNewInstance(arg, pathToItem, pathToSchemas) + } else if (arg is Map<*, *>) { + return getNewInstance(arg, pathToItem, pathToSchemas) + } + throw RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema") + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: Nothing?, configuration: SchemaConfiguration?): MaximumValidation1BoxedVoid { + return MaximumValidation1BoxedVoid(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: Boolean, configuration: SchemaConfiguration?): MaximumValidation1BoxedBoolean { + return MaximumValidation1BoxedBoolean(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: Number, configuration: SchemaConfiguration?): MaximumValidation1BoxedNumber { + return MaximumValidation1BoxedNumber(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: String, configuration: SchemaConfiguration?): MaximumValidation1BoxedString { + return MaximumValidation1BoxedString(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: List<*>, configuration: SchemaConfiguration?): MaximumValidation1BoxedList { + return MaximumValidation1BoxedList(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: Map<*, *>, configuration: SchemaConfiguration?): MaximumValidation1BoxedMap { + return MaximumValidation1BoxedMap(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: Any?, configuration: SchemaConfiguration?): MaximumValidation1Boxed { + if (arg == null) { + return validateAndBox(null, configuration) + } else if (arg is Boolean) { + return validateAndBox(arg, configuration) + } else if (arg is String) { + return validateAndBox(arg, configuration) + } else if (arg is Number) { + return validateAndBox(arg, configuration) + } else if (arg is List<*>) { + return validateAndBox(arg, configuration) + } else if (arg is Map<*, *>) { + return validateAndBox(arg, configuration) + } + throw ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema") + } + } +} diff --git a/samples/client/3_0_3_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/schemas/MaximumValidationWithUnsignedInteger.kt b/samples/client/3_0_3_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/schemas/MaximumValidationWithUnsignedInteger.kt new file mode 100644 index 00000000000..49da0ee99a0 --- /dev/null +++ b/samples/client/3_0_3_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/schemas/MaximumValidationWithUnsignedInteger.kt @@ -0,0 +1,308 @@ +package org.openapijsonschematools.client.components.schemas +import java.time.LocalDate +import java.time.ZonedDateTime +import java.util.UUID +import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags +import org.openapijsonschematools.client.configurations.SchemaConfiguration +import org.openapijsonschematools.client.exceptions.InvalidAdditionalPropertyException +import org.openapijsonschematools.client.exceptions.UnsetPropertyException +import org.openapijsonschematools.client.exceptions.ValidationException +import org.openapijsonschematools.client.schemas.UnsetAddPropsSetter +import org.openapijsonschematools.client.schemas.validation.BooleanSchemaValidator +import org.openapijsonschematools.client.schemas.validation.FrozenList +import org.openapijsonschematools.client.schemas.validation.FrozenMap +import org.openapijsonschematools.client.schemas.validation.JsonSchema +import org.openapijsonschematools.client.schemas.validation.JsonSchemaInfo +import org.openapijsonschematools.client.schemas.validation.ListSchemaValidator +import org.openapijsonschematools.client.schemas.validation.MapSchemaValidator +import org.openapijsonschematools.client.schemas.validation.NullSchemaValidator +import org.openapijsonschematools.client.schemas.validation.NumberSchemaValidator +import org.openapijsonschematools.client.schemas.validation.PathToSchemasMap +import org.openapijsonschematools.client.schemas.validation.StringSchemaValidator +import org.openapijsonschematools.client.schemas.validation.ValidationMetadata + +class MaximumValidationWithUnsignedInteger { + // nest classes so all schemas and input/output classes can be public + + + sealed interface MaximumValidationWithUnsignedInteger1Boxed { + fun getData(): Any? + } + + data class MaximumValidationWithUnsignedInteger1BoxedVoid(val data: Nothing?) : MaximumValidationWithUnsignedInteger1Boxed { + override fun getData(): Any? { + return data + } + } + + data class MaximumValidationWithUnsignedInteger1BoxedBoolean(val data: Boolean): MaximumValidationWithUnsignedInteger1Boxed { + override fun getData(): Any? { + return data + } + } + + data class MaximumValidationWithUnsignedInteger1BoxedNumber(val data: Number) : MaximumValidationWithUnsignedInteger1Boxed { + override fun getData(): Any? { + return data + } + } + + data class MaximumValidationWithUnsignedInteger1BoxedString(val data: String) : MaximumValidationWithUnsignedInteger1Boxed { + override fun getData(): Any? { + return data + } + } + + data class MaximumValidationWithUnsignedInteger1BoxedList(val data: FrozenList) : MaximumValidationWithUnsignedInteger1Boxed { + override fun getData(): Any? { + return data + } + } + + data class MaximumValidationWithUnsignedInteger1BoxedMap(val data: FrozenMap) : MaximumValidationWithUnsignedInteger1Boxed { + override fun getData(): Any? { + return data + } + } + + + class MaximumValidationWithUnsignedInteger1 private constructor(): JsonSchema( + JsonSchemaInfo() + .maximum(300) + ), NullSchemaValidator, BooleanSchemaValidator, NumberSchemaValidator, StringSchemaValidator, ListSchemaValidator, MaximumValidationWithUnsignedInteger1BoxedList>, MapSchemaValidator, MaximumValidationWithUnsignedInteger1BoxedMap> { + /* + NOTE: This class is auto generated by OpenAPI JSON Schema Generator. + Ref: https://github.com/openapi-json-schema-tools/openapi-json-schema-generator + + Do not edit the class manually. + */ + + companion object { + @Volatile + private var instance: MaximumValidationWithUnsignedInteger1? = null + + fun getInstance() = + instance ?: synchronized(this) { + instance ?: MaximumValidationWithUnsignedInteger1().also { instance = it } + } + } + + @Throws(ValidationException::class) + override fun validate(arg: Nothing?, configuration: SchemaConfiguration?): Nothing? { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validatedPathToSchemas = PathToSchemasMap() + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, LinkedHashSet()) + getPathToSchemas(this, castArg, validationMetadata, pathSet) + return castArg + } + + @Throws(ValidationException::class) + override fun validate(arg: Boolean, configuration: SchemaConfiguration?): Boolean { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validatedPathToSchemas = PathToSchemasMap() + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, LinkedHashSet()) + getPathToSchemas(this, castArg, validationMetadata, pathSet) + return castArg + } + + @Throws(ValidationException::class) + override fun validate(arg: Number, configuration: SchemaConfiguration?): Number { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validatedPathToSchemas = PathToSchemasMap() + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, LinkedHashSet()) + getPathToSchemas(this, castArg, validationMetadata, pathSet) + return castArg + } + + @Throws(ValidationException::class) + fun validate(arg: Int, configuration: SchemaConfiguration?): Int { + return validate(arg as Number, configuration) as Int + } + + @Throws(ValidationException::class) + fun validate(arg: Long, configuration: SchemaConfiguration?): Long { + return validate(arg as Number, configuration) as Long + } + + @Throws(ValidationException::class) + fun validate(arg: Float, configuration: SchemaConfiguration?): Float { + return validate(arg as Number, configuration) as Float + } + + @Throws(ValidationException::class) + fun validate(arg: Double, configuration: SchemaConfiguration?): Double { + return validate(arg as Number, configuration) as Double + } + + @Throws(ValidationException::class) + override fun validate(arg: String, configuration: SchemaConfiguration?): String { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validatedPathToSchemas = PathToSchemasMap() + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, LinkedHashSet()) + getPathToSchemas(this, castArg, validationMetadata, pathSet) + return castArg + } + + @Throws(ValidationException::class) + fun validate(arg: LocalDate, configuration: SchemaConfiguration?): String { + return validate(arg.toString(), configuration) + } + + @Throws(ValidationException::class) + fun validate(arg: ZonedDateTime, configuration: SchemaConfiguration?): String { + return validate(arg.toString(), configuration) + } + + @Throws(ValidationException::class) + fun validate(arg: UUID, configuration: SchemaConfiguration?): String { + return validate(arg.toString(), configuration) + } + + override fun getNewInstance(arg: List<*>, pathToItem: List, pathToSchemas: PathToSchemasMap): FrozenList { + val items: MutableList = ArrayList() + var i: Int = 0 + for (item: Any? in arg) { + val itemPathToItem = pathToItem + i + val schemas: LinkedHashMap, Nothing?>? = pathToSchemas.get(itemPathToItem) + if (schemas == null) { + throw RuntimeException("Validation result is invalid, schemas must exist for a pathToItem") + } + val itemSchema: JsonSchema<*> = schemas.entries.iterator().next().key + val itemInstance: Any? = itemSchema.getNewInstance(item, itemPathToItem, pathToSchemas) + items.add(itemInstance) + i += 1 + } + val newInstanceItems: FrozenList = FrozenList(items) + return newInstanceItems + } + + @Throws(ValidationException::class) + override fun validate(arg: List<*>, configuration: SchemaConfiguration?): FrozenList { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, PathToSchemasMap(), LinkedHashSet()) + val pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet) + return getNewInstance(castArg, validationMetadata.pathToItem, pathToSchemasMap) + } + + override fun getNewInstance(arg: Map<*, *>, pathToItem: List, pathToSchemas: PathToSchemasMap): FrozenMap { + val properties: LinkedHashMap = LinkedHashMap() + for((propertyName, value) in arg) { + if (!(propertyName is String)) { + throw RuntimeException("Invalid non-string key value") + } + val propertyPathToItem: List = pathToItem + propertyName + val schemas: LinkedHashMap, Nothing?>? = pathToSchemas.get(propertyPathToItem) + if (schemas == null) { + throw RuntimeException("Validation result is invalid, schemas must exist for a pathToItem") + } + val propertySchema: JsonSchema<*> = schemas.entries.iterator().next().key + val propertyInstance: Any? = propertySchema.getNewInstance(value, propertyPathToItem, pathToSchemas) + properties[propertyName] = propertyInstance + } + val castProperties: FrozenMap = FrozenMap(properties) + return castProperties + } + + @Throws(ValidationException::class) + override fun validate(arg: Map<*, *>, configuration: SchemaConfiguration?): FrozenMap { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validatedPathToSchemas = PathToSchemasMap() + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, LinkedHashSet()) + val pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet) + return getNewInstance(castArg, validationMetadata.pathToItem, pathToSchemasMap) + } + + @Throws(ValidationException::class) + override fun validate(arg: Any?, configuration: SchemaConfiguration?): Any? { + if (arg == null) { + return validate(null, configuration) + } else if (arg is Boolean) { + return validate(arg, configuration) + } else if (arg is Number) { + return validate(arg, configuration) + } else if (arg is String) { + return validate(arg, configuration) + } else if (arg is List<*>) { + return validate(arg, configuration) + } else if (arg is Map<*, *>) { + return validate(arg, configuration) + } + throw ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema") + } + override fun getNewInstance(arg: Any?, pathToItem: List, pathToSchemas: PathToSchemasMap): Any? { + if (arg == null) { + return getNewInstance( null, pathToItem, pathToSchemas) + } else if (arg is Boolean) { + return getNewInstance(arg, pathToItem, pathToSchemas) + } else if (arg is Number) { + return getNewInstance(arg, pathToItem, pathToSchemas) + } else if (arg is String) { + return getNewInstance(arg, pathToItem, pathToSchemas) + } else if (arg is List<*>) { + return getNewInstance(arg, pathToItem, pathToSchemas) + } else if (arg is Map<*, *>) { + return getNewInstance(arg, pathToItem, pathToSchemas) + } + throw RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema") + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: Nothing?, configuration: SchemaConfiguration?): MaximumValidationWithUnsignedInteger1BoxedVoid { + return MaximumValidationWithUnsignedInteger1BoxedVoid(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: Boolean, configuration: SchemaConfiguration?): MaximumValidationWithUnsignedInteger1BoxedBoolean { + return MaximumValidationWithUnsignedInteger1BoxedBoolean(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: Number, configuration: SchemaConfiguration?): MaximumValidationWithUnsignedInteger1BoxedNumber { + return MaximumValidationWithUnsignedInteger1BoxedNumber(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: String, configuration: SchemaConfiguration?): MaximumValidationWithUnsignedInteger1BoxedString { + return MaximumValidationWithUnsignedInteger1BoxedString(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: List<*>, configuration: SchemaConfiguration?): MaximumValidationWithUnsignedInteger1BoxedList { + return MaximumValidationWithUnsignedInteger1BoxedList(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: Map<*, *>, configuration: SchemaConfiguration?): MaximumValidationWithUnsignedInteger1BoxedMap { + return MaximumValidationWithUnsignedInteger1BoxedMap(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: Any?, configuration: SchemaConfiguration?): MaximumValidationWithUnsignedInteger1Boxed { + if (arg == null) { + return validateAndBox(null, configuration) + } else if (arg is Boolean) { + return validateAndBox(arg, configuration) + } else if (arg is String) { + return validateAndBox(arg, configuration) + } else if (arg is Number) { + return validateAndBox(arg, configuration) + } else if (arg is List<*>) { + return validateAndBox(arg, configuration) + } else if (arg is Map<*, *>) { + return validateAndBox(arg, configuration) + } + throw ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema") + } + } +} diff --git a/samples/client/3_0_3_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/schemas/MaxitemsValidation.kt b/samples/client/3_0_3_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/schemas/MaxitemsValidation.kt new file mode 100644 index 00000000000..1f763f7719f --- /dev/null +++ b/samples/client/3_0_3_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/schemas/MaxitemsValidation.kt @@ -0,0 +1,308 @@ +package org.openapijsonschematools.client.components.schemas +import java.time.LocalDate +import java.time.ZonedDateTime +import java.util.UUID +import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags +import org.openapijsonschematools.client.configurations.SchemaConfiguration +import org.openapijsonschematools.client.exceptions.InvalidAdditionalPropertyException +import org.openapijsonschematools.client.exceptions.UnsetPropertyException +import org.openapijsonschematools.client.exceptions.ValidationException +import org.openapijsonschematools.client.schemas.UnsetAddPropsSetter +import org.openapijsonschematools.client.schemas.validation.BooleanSchemaValidator +import org.openapijsonschematools.client.schemas.validation.FrozenList +import org.openapijsonschematools.client.schemas.validation.FrozenMap +import org.openapijsonschematools.client.schemas.validation.JsonSchema +import org.openapijsonschematools.client.schemas.validation.JsonSchemaInfo +import org.openapijsonschematools.client.schemas.validation.ListSchemaValidator +import org.openapijsonschematools.client.schemas.validation.MapSchemaValidator +import org.openapijsonschematools.client.schemas.validation.NullSchemaValidator +import org.openapijsonschematools.client.schemas.validation.NumberSchemaValidator +import org.openapijsonschematools.client.schemas.validation.PathToSchemasMap +import org.openapijsonschematools.client.schemas.validation.StringSchemaValidator +import org.openapijsonschematools.client.schemas.validation.ValidationMetadata + +class MaxitemsValidation { + // nest classes so all schemas and input/output classes can be public + + + sealed interface MaxitemsValidation1Boxed { + fun getData(): Any? + } + + data class MaxitemsValidation1BoxedVoid(val data: Nothing?) : MaxitemsValidation1Boxed { + override fun getData(): Any? { + return data + } + } + + data class MaxitemsValidation1BoxedBoolean(val data: Boolean): MaxitemsValidation1Boxed { + override fun getData(): Any? { + return data + } + } + + data class MaxitemsValidation1BoxedNumber(val data: Number) : MaxitemsValidation1Boxed { + override fun getData(): Any? { + return data + } + } + + data class MaxitemsValidation1BoxedString(val data: String) : MaxitemsValidation1Boxed { + override fun getData(): Any? { + return data + } + } + + data class MaxitemsValidation1BoxedList(val data: FrozenList) : MaxitemsValidation1Boxed { + override fun getData(): Any? { + return data + } + } + + data class MaxitemsValidation1BoxedMap(val data: FrozenMap) : MaxitemsValidation1Boxed { + override fun getData(): Any? { + return data + } + } + + + class MaxitemsValidation1 private constructor(): JsonSchema( + JsonSchemaInfo() + .maxItems(2) + ), NullSchemaValidator, BooleanSchemaValidator, NumberSchemaValidator, StringSchemaValidator, ListSchemaValidator, MaxitemsValidation1BoxedList>, MapSchemaValidator, MaxitemsValidation1BoxedMap> { + /* + NOTE: This class is auto generated by OpenAPI JSON Schema Generator. + Ref: https://github.com/openapi-json-schema-tools/openapi-json-schema-generator + + Do not edit the class manually. + */ + + companion object { + @Volatile + private var instance: MaxitemsValidation1? = null + + fun getInstance() = + instance ?: synchronized(this) { + instance ?: MaxitemsValidation1().also { instance = it } + } + } + + @Throws(ValidationException::class) + override fun validate(arg: Nothing?, configuration: SchemaConfiguration?): Nothing? { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validatedPathToSchemas = PathToSchemasMap() + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, LinkedHashSet()) + getPathToSchemas(this, castArg, validationMetadata, pathSet) + return castArg + } + + @Throws(ValidationException::class) + override fun validate(arg: Boolean, configuration: SchemaConfiguration?): Boolean { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validatedPathToSchemas = PathToSchemasMap() + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, LinkedHashSet()) + getPathToSchemas(this, castArg, validationMetadata, pathSet) + return castArg + } + + @Throws(ValidationException::class) + override fun validate(arg: Number, configuration: SchemaConfiguration?): Number { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validatedPathToSchemas = PathToSchemasMap() + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, LinkedHashSet()) + getPathToSchemas(this, castArg, validationMetadata, pathSet) + return castArg + } + + @Throws(ValidationException::class) + fun validate(arg: Int, configuration: SchemaConfiguration?): Int { + return validate(arg as Number, configuration) as Int + } + + @Throws(ValidationException::class) + fun validate(arg: Long, configuration: SchemaConfiguration?): Long { + return validate(arg as Number, configuration) as Long + } + + @Throws(ValidationException::class) + fun validate(arg: Float, configuration: SchemaConfiguration?): Float { + return validate(arg as Number, configuration) as Float + } + + @Throws(ValidationException::class) + fun validate(arg: Double, configuration: SchemaConfiguration?): Double { + return validate(arg as Number, configuration) as Double + } + + @Throws(ValidationException::class) + override fun validate(arg: String, configuration: SchemaConfiguration?): String { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validatedPathToSchemas = PathToSchemasMap() + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, LinkedHashSet()) + getPathToSchemas(this, castArg, validationMetadata, pathSet) + return castArg + } + + @Throws(ValidationException::class) + fun validate(arg: LocalDate, configuration: SchemaConfiguration?): String { + return validate(arg.toString(), configuration) + } + + @Throws(ValidationException::class) + fun validate(arg: ZonedDateTime, configuration: SchemaConfiguration?): String { + return validate(arg.toString(), configuration) + } + + @Throws(ValidationException::class) + fun validate(arg: UUID, configuration: SchemaConfiguration?): String { + return validate(arg.toString(), configuration) + } + + override fun getNewInstance(arg: List<*>, pathToItem: List, pathToSchemas: PathToSchemasMap): FrozenList { + val items: MutableList = ArrayList() + var i: Int = 0 + for (item: Any? in arg) { + val itemPathToItem = pathToItem + i + val schemas: LinkedHashMap, Nothing?>? = pathToSchemas.get(itemPathToItem) + if (schemas == null) { + throw RuntimeException("Validation result is invalid, schemas must exist for a pathToItem") + } + val itemSchema: JsonSchema<*> = schemas.entries.iterator().next().key + val itemInstance: Any? = itemSchema.getNewInstance(item, itemPathToItem, pathToSchemas) + items.add(itemInstance) + i += 1 + } + val newInstanceItems: FrozenList = FrozenList(items) + return newInstanceItems + } + + @Throws(ValidationException::class) + override fun validate(arg: List<*>, configuration: SchemaConfiguration?): FrozenList { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, PathToSchemasMap(), LinkedHashSet()) + val pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet) + return getNewInstance(castArg, validationMetadata.pathToItem, pathToSchemasMap) + } + + override fun getNewInstance(arg: Map<*, *>, pathToItem: List, pathToSchemas: PathToSchemasMap): FrozenMap { + val properties: LinkedHashMap = LinkedHashMap() + for((propertyName, value) in arg) { + if (!(propertyName is String)) { + throw RuntimeException("Invalid non-string key value") + } + val propertyPathToItem: List = pathToItem + propertyName + val schemas: LinkedHashMap, Nothing?>? = pathToSchemas.get(propertyPathToItem) + if (schemas == null) { + throw RuntimeException("Validation result is invalid, schemas must exist for a pathToItem") + } + val propertySchema: JsonSchema<*> = schemas.entries.iterator().next().key + val propertyInstance: Any? = propertySchema.getNewInstance(value, propertyPathToItem, pathToSchemas) + properties[propertyName] = propertyInstance + } + val castProperties: FrozenMap = FrozenMap(properties) + return castProperties + } + + @Throws(ValidationException::class) + override fun validate(arg: Map<*, *>, configuration: SchemaConfiguration?): FrozenMap { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validatedPathToSchemas = PathToSchemasMap() + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, LinkedHashSet()) + val pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet) + return getNewInstance(castArg, validationMetadata.pathToItem, pathToSchemasMap) + } + + @Throws(ValidationException::class) + override fun validate(arg: Any?, configuration: SchemaConfiguration?): Any? { + if (arg == null) { + return validate(null, configuration) + } else if (arg is Boolean) { + return validate(arg, configuration) + } else if (arg is Number) { + return validate(arg, configuration) + } else if (arg is String) { + return validate(arg, configuration) + } else if (arg is List<*>) { + return validate(arg, configuration) + } else if (arg is Map<*, *>) { + return validate(arg, configuration) + } + throw ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema") + } + override fun getNewInstance(arg: Any?, pathToItem: List, pathToSchemas: PathToSchemasMap): Any? { + if (arg == null) { + return getNewInstance( null, pathToItem, pathToSchemas) + } else if (arg is Boolean) { + return getNewInstance(arg, pathToItem, pathToSchemas) + } else if (arg is Number) { + return getNewInstance(arg, pathToItem, pathToSchemas) + } else if (arg is String) { + return getNewInstance(arg, pathToItem, pathToSchemas) + } else if (arg is List<*>) { + return getNewInstance(arg, pathToItem, pathToSchemas) + } else if (arg is Map<*, *>) { + return getNewInstance(arg, pathToItem, pathToSchemas) + } + throw RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema") + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: Nothing?, configuration: SchemaConfiguration?): MaxitemsValidation1BoxedVoid { + return MaxitemsValidation1BoxedVoid(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: Boolean, configuration: SchemaConfiguration?): MaxitemsValidation1BoxedBoolean { + return MaxitemsValidation1BoxedBoolean(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: Number, configuration: SchemaConfiguration?): MaxitemsValidation1BoxedNumber { + return MaxitemsValidation1BoxedNumber(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: String, configuration: SchemaConfiguration?): MaxitemsValidation1BoxedString { + return MaxitemsValidation1BoxedString(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: List<*>, configuration: SchemaConfiguration?): MaxitemsValidation1BoxedList { + return MaxitemsValidation1BoxedList(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: Map<*, *>, configuration: SchemaConfiguration?): MaxitemsValidation1BoxedMap { + return MaxitemsValidation1BoxedMap(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: Any?, configuration: SchemaConfiguration?): MaxitemsValidation1Boxed { + if (arg == null) { + return validateAndBox(null, configuration) + } else if (arg is Boolean) { + return validateAndBox(arg, configuration) + } else if (arg is String) { + return validateAndBox(arg, configuration) + } else if (arg is Number) { + return validateAndBox(arg, configuration) + } else if (arg is List<*>) { + return validateAndBox(arg, configuration) + } else if (arg is Map<*, *>) { + return validateAndBox(arg, configuration) + } + throw ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema") + } + } +} diff --git a/samples/client/3_0_3_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/schemas/MaxlengthValidation.kt b/samples/client/3_0_3_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/schemas/MaxlengthValidation.kt new file mode 100644 index 00000000000..ba1e070bc6f --- /dev/null +++ b/samples/client/3_0_3_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/schemas/MaxlengthValidation.kt @@ -0,0 +1,308 @@ +package org.openapijsonschematools.client.components.schemas +import java.time.LocalDate +import java.time.ZonedDateTime +import java.util.UUID +import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags +import org.openapijsonschematools.client.configurations.SchemaConfiguration +import org.openapijsonschematools.client.exceptions.InvalidAdditionalPropertyException +import org.openapijsonschematools.client.exceptions.UnsetPropertyException +import org.openapijsonschematools.client.exceptions.ValidationException +import org.openapijsonschematools.client.schemas.UnsetAddPropsSetter +import org.openapijsonschematools.client.schemas.validation.BooleanSchemaValidator +import org.openapijsonschematools.client.schemas.validation.FrozenList +import org.openapijsonschematools.client.schemas.validation.FrozenMap +import org.openapijsonschematools.client.schemas.validation.JsonSchema +import org.openapijsonschematools.client.schemas.validation.JsonSchemaInfo +import org.openapijsonschematools.client.schemas.validation.ListSchemaValidator +import org.openapijsonschematools.client.schemas.validation.MapSchemaValidator +import org.openapijsonschematools.client.schemas.validation.NullSchemaValidator +import org.openapijsonschematools.client.schemas.validation.NumberSchemaValidator +import org.openapijsonschematools.client.schemas.validation.PathToSchemasMap +import org.openapijsonschematools.client.schemas.validation.StringSchemaValidator +import org.openapijsonschematools.client.schemas.validation.ValidationMetadata + +class MaxlengthValidation { + // nest classes so all schemas and input/output classes can be public + + + sealed interface MaxlengthValidation1Boxed { + fun getData(): Any? + } + + data class MaxlengthValidation1BoxedVoid(val data: Nothing?) : MaxlengthValidation1Boxed { + override fun getData(): Any? { + return data + } + } + + data class MaxlengthValidation1BoxedBoolean(val data: Boolean): MaxlengthValidation1Boxed { + override fun getData(): Any? { + return data + } + } + + data class MaxlengthValidation1BoxedNumber(val data: Number) : MaxlengthValidation1Boxed { + override fun getData(): Any? { + return data + } + } + + data class MaxlengthValidation1BoxedString(val data: String) : MaxlengthValidation1Boxed { + override fun getData(): Any? { + return data + } + } + + data class MaxlengthValidation1BoxedList(val data: FrozenList) : MaxlengthValidation1Boxed { + override fun getData(): Any? { + return data + } + } + + data class MaxlengthValidation1BoxedMap(val data: FrozenMap) : MaxlengthValidation1Boxed { + override fun getData(): Any? { + return data + } + } + + + class MaxlengthValidation1 private constructor(): JsonSchema( + JsonSchemaInfo() + .maxLength(2) + ), NullSchemaValidator, BooleanSchemaValidator, NumberSchemaValidator, StringSchemaValidator, ListSchemaValidator, MaxlengthValidation1BoxedList>, MapSchemaValidator, MaxlengthValidation1BoxedMap> { + /* + NOTE: This class is auto generated by OpenAPI JSON Schema Generator. + Ref: https://github.com/openapi-json-schema-tools/openapi-json-schema-generator + + Do not edit the class manually. + */ + + companion object { + @Volatile + private var instance: MaxlengthValidation1? = null + + fun getInstance() = + instance ?: synchronized(this) { + instance ?: MaxlengthValidation1().also { instance = it } + } + } + + @Throws(ValidationException::class) + override fun validate(arg: Nothing?, configuration: SchemaConfiguration?): Nothing? { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validatedPathToSchemas = PathToSchemasMap() + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, LinkedHashSet()) + getPathToSchemas(this, castArg, validationMetadata, pathSet) + return castArg + } + + @Throws(ValidationException::class) + override fun validate(arg: Boolean, configuration: SchemaConfiguration?): Boolean { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validatedPathToSchemas = PathToSchemasMap() + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, LinkedHashSet()) + getPathToSchemas(this, castArg, validationMetadata, pathSet) + return castArg + } + + @Throws(ValidationException::class) + override fun validate(arg: Number, configuration: SchemaConfiguration?): Number { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validatedPathToSchemas = PathToSchemasMap() + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, LinkedHashSet()) + getPathToSchemas(this, castArg, validationMetadata, pathSet) + return castArg + } + + @Throws(ValidationException::class) + fun validate(arg: Int, configuration: SchemaConfiguration?): Int { + return validate(arg as Number, configuration) as Int + } + + @Throws(ValidationException::class) + fun validate(arg: Long, configuration: SchemaConfiguration?): Long { + return validate(arg as Number, configuration) as Long + } + + @Throws(ValidationException::class) + fun validate(arg: Float, configuration: SchemaConfiguration?): Float { + return validate(arg as Number, configuration) as Float + } + + @Throws(ValidationException::class) + fun validate(arg: Double, configuration: SchemaConfiguration?): Double { + return validate(arg as Number, configuration) as Double + } + + @Throws(ValidationException::class) + override fun validate(arg: String, configuration: SchemaConfiguration?): String { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validatedPathToSchemas = PathToSchemasMap() + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, LinkedHashSet()) + getPathToSchemas(this, castArg, validationMetadata, pathSet) + return castArg + } + + @Throws(ValidationException::class) + fun validate(arg: LocalDate, configuration: SchemaConfiguration?): String { + return validate(arg.toString(), configuration) + } + + @Throws(ValidationException::class) + fun validate(arg: ZonedDateTime, configuration: SchemaConfiguration?): String { + return validate(arg.toString(), configuration) + } + + @Throws(ValidationException::class) + fun validate(arg: UUID, configuration: SchemaConfiguration?): String { + return validate(arg.toString(), configuration) + } + + override fun getNewInstance(arg: List<*>, pathToItem: List, pathToSchemas: PathToSchemasMap): FrozenList { + val items: MutableList = ArrayList() + var i: Int = 0 + for (item: Any? in arg) { + val itemPathToItem = pathToItem + i + val schemas: LinkedHashMap, Nothing?>? = pathToSchemas.get(itemPathToItem) + if (schemas == null) { + throw RuntimeException("Validation result is invalid, schemas must exist for a pathToItem") + } + val itemSchema: JsonSchema<*> = schemas.entries.iterator().next().key + val itemInstance: Any? = itemSchema.getNewInstance(item, itemPathToItem, pathToSchemas) + items.add(itemInstance) + i += 1 + } + val newInstanceItems: FrozenList = FrozenList(items) + return newInstanceItems + } + + @Throws(ValidationException::class) + override fun validate(arg: List<*>, configuration: SchemaConfiguration?): FrozenList { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, PathToSchemasMap(), LinkedHashSet()) + val pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet) + return getNewInstance(castArg, validationMetadata.pathToItem, pathToSchemasMap) + } + + override fun getNewInstance(arg: Map<*, *>, pathToItem: List, pathToSchemas: PathToSchemasMap): FrozenMap { + val properties: LinkedHashMap = LinkedHashMap() + for((propertyName, value) in arg) { + if (!(propertyName is String)) { + throw RuntimeException("Invalid non-string key value") + } + val propertyPathToItem: List = pathToItem + propertyName + val schemas: LinkedHashMap, Nothing?>? = pathToSchemas.get(propertyPathToItem) + if (schemas == null) { + throw RuntimeException("Validation result is invalid, schemas must exist for a pathToItem") + } + val propertySchema: JsonSchema<*> = schemas.entries.iterator().next().key + val propertyInstance: Any? = propertySchema.getNewInstance(value, propertyPathToItem, pathToSchemas) + properties[propertyName] = propertyInstance + } + val castProperties: FrozenMap = FrozenMap(properties) + return castProperties + } + + @Throws(ValidationException::class) + override fun validate(arg: Map<*, *>, configuration: SchemaConfiguration?): FrozenMap { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validatedPathToSchemas = PathToSchemasMap() + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, LinkedHashSet()) + val pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet) + return getNewInstance(castArg, validationMetadata.pathToItem, pathToSchemasMap) + } + + @Throws(ValidationException::class) + override fun validate(arg: Any?, configuration: SchemaConfiguration?): Any? { + if (arg == null) { + return validate(null, configuration) + } else if (arg is Boolean) { + return validate(arg, configuration) + } else if (arg is Number) { + return validate(arg, configuration) + } else if (arg is String) { + return validate(arg, configuration) + } else if (arg is List<*>) { + return validate(arg, configuration) + } else if (arg is Map<*, *>) { + return validate(arg, configuration) + } + throw ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema") + } + override fun getNewInstance(arg: Any?, pathToItem: List, pathToSchemas: PathToSchemasMap): Any? { + if (arg == null) { + return getNewInstance( null, pathToItem, pathToSchemas) + } else if (arg is Boolean) { + return getNewInstance(arg, pathToItem, pathToSchemas) + } else if (arg is Number) { + return getNewInstance(arg, pathToItem, pathToSchemas) + } else if (arg is String) { + return getNewInstance(arg, pathToItem, pathToSchemas) + } else if (arg is List<*>) { + return getNewInstance(arg, pathToItem, pathToSchemas) + } else if (arg is Map<*, *>) { + return getNewInstance(arg, pathToItem, pathToSchemas) + } + throw RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema") + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: Nothing?, configuration: SchemaConfiguration?): MaxlengthValidation1BoxedVoid { + return MaxlengthValidation1BoxedVoid(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: Boolean, configuration: SchemaConfiguration?): MaxlengthValidation1BoxedBoolean { + return MaxlengthValidation1BoxedBoolean(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: Number, configuration: SchemaConfiguration?): MaxlengthValidation1BoxedNumber { + return MaxlengthValidation1BoxedNumber(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: String, configuration: SchemaConfiguration?): MaxlengthValidation1BoxedString { + return MaxlengthValidation1BoxedString(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: List<*>, configuration: SchemaConfiguration?): MaxlengthValidation1BoxedList { + return MaxlengthValidation1BoxedList(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: Map<*, *>, configuration: SchemaConfiguration?): MaxlengthValidation1BoxedMap { + return MaxlengthValidation1BoxedMap(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: Any?, configuration: SchemaConfiguration?): MaxlengthValidation1Boxed { + if (arg == null) { + return validateAndBox(null, configuration) + } else if (arg is Boolean) { + return validateAndBox(arg, configuration) + } else if (arg is String) { + return validateAndBox(arg, configuration) + } else if (arg is Number) { + return validateAndBox(arg, configuration) + } else if (arg is List<*>) { + return validateAndBox(arg, configuration) + } else if (arg is Map<*, *>) { + return validateAndBox(arg, configuration) + } + throw ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema") + } + } +} diff --git a/samples/client/3_0_3_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/schemas/Maxproperties0MeansTheObjectIsEmpty.kt b/samples/client/3_0_3_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/schemas/Maxproperties0MeansTheObjectIsEmpty.kt new file mode 100644 index 00000000000..62b6deb1e2e --- /dev/null +++ b/samples/client/3_0_3_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/schemas/Maxproperties0MeansTheObjectIsEmpty.kt @@ -0,0 +1,308 @@ +package org.openapijsonschematools.client.components.schemas +import java.time.LocalDate +import java.time.ZonedDateTime +import java.util.UUID +import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags +import org.openapijsonschematools.client.configurations.SchemaConfiguration +import org.openapijsonschematools.client.exceptions.InvalidAdditionalPropertyException +import org.openapijsonschematools.client.exceptions.UnsetPropertyException +import org.openapijsonschematools.client.exceptions.ValidationException +import org.openapijsonschematools.client.schemas.UnsetAddPropsSetter +import org.openapijsonschematools.client.schemas.validation.BooleanSchemaValidator +import org.openapijsonschematools.client.schemas.validation.FrozenList +import org.openapijsonschematools.client.schemas.validation.FrozenMap +import org.openapijsonschematools.client.schemas.validation.JsonSchema +import org.openapijsonschematools.client.schemas.validation.JsonSchemaInfo +import org.openapijsonschematools.client.schemas.validation.ListSchemaValidator +import org.openapijsonschematools.client.schemas.validation.MapSchemaValidator +import org.openapijsonschematools.client.schemas.validation.NullSchemaValidator +import org.openapijsonschematools.client.schemas.validation.NumberSchemaValidator +import org.openapijsonschematools.client.schemas.validation.PathToSchemasMap +import org.openapijsonschematools.client.schemas.validation.StringSchemaValidator +import org.openapijsonschematools.client.schemas.validation.ValidationMetadata + +class Maxproperties0MeansTheObjectIsEmpty { + // nest classes so all schemas and input/output classes can be public + + + sealed interface Maxproperties0MeansTheObjectIsEmpty1Boxed { + fun getData(): Any? + } + + data class Maxproperties0MeansTheObjectIsEmpty1BoxedVoid(val data: Nothing?) : Maxproperties0MeansTheObjectIsEmpty1Boxed { + override fun getData(): Any? { + return data + } + } + + data class Maxproperties0MeansTheObjectIsEmpty1BoxedBoolean(val data: Boolean): Maxproperties0MeansTheObjectIsEmpty1Boxed { + override fun getData(): Any? { + return data + } + } + + data class Maxproperties0MeansTheObjectIsEmpty1BoxedNumber(val data: Number) : Maxproperties0MeansTheObjectIsEmpty1Boxed { + override fun getData(): Any? { + return data + } + } + + data class Maxproperties0MeansTheObjectIsEmpty1BoxedString(val data: String) : Maxproperties0MeansTheObjectIsEmpty1Boxed { + override fun getData(): Any? { + return data + } + } + + data class Maxproperties0MeansTheObjectIsEmpty1BoxedList(val data: FrozenList) : Maxproperties0MeansTheObjectIsEmpty1Boxed { + override fun getData(): Any? { + return data + } + } + + data class Maxproperties0MeansTheObjectIsEmpty1BoxedMap(val data: FrozenMap) : Maxproperties0MeansTheObjectIsEmpty1Boxed { + override fun getData(): Any? { + return data + } + } + + + class Maxproperties0MeansTheObjectIsEmpty1 private constructor(): JsonSchema( + JsonSchemaInfo() + .maxProperties(0) + ), NullSchemaValidator, BooleanSchemaValidator, NumberSchemaValidator, StringSchemaValidator, ListSchemaValidator, Maxproperties0MeansTheObjectIsEmpty1BoxedList>, MapSchemaValidator, Maxproperties0MeansTheObjectIsEmpty1BoxedMap> { + /* + NOTE: This class is auto generated by OpenAPI JSON Schema Generator. + Ref: https://github.com/openapi-json-schema-tools/openapi-json-schema-generator + + Do not edit the class manually. + */ + + companion object { + @Volatile + private var instance: Maxproperties0MeansTheObjectIsEmpty1? = null + + fun getInstance() = + instance ?: synchronized(this) { + instance ?: Maxproperties0MeansTheObjectIsEmpty1().also { instance = it } + } + } + + @Throws(ValidationException::class) + override fun validate(arg: Nothing?, configuration: SchemaConfiguration?): Nothing? { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validatedPathToSchemas = PathToSchemasMap() + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, LinkedHashSet()) + getPathToSchemas(this, castArg, validationMetadata, pathSet) + return castArg + } + + @Throws(ValidationException::class) + override fun validate(arg: Boolean, configuration: SchemaConfiguration?): Boolean { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validatedPathToSchemas = PathToSchemasMap() + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, LinkedHashSet()) + getPathToSchemas(this, castArg, validationMetadata, pathSet) + return castArg + } + + @Throws(ValidationException::class) + override fun validate(arg: Number, configuration: SchemaConfiguration?): Number { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validatedPathToSchemas = PathToSchemasMap() + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, LinkedHashSet()) + getPathToSchemas(this, castArg, validationMetadata, pathSet) + return castArg + } + + @Throws(ValidationException::class) + fun validate(arg: Int, configuration: SchemaConfiguration?): Int { + return validate(arg as Number, configuration) as Int + } + + @Throws(ValidationException::class) + fun validate(arg: Long, configuration: SchemaConfiguration?): Long { + return validate(arg as Number, configuration) as Long + } + + @Throws(ValidationException::class) + fun validate(arg: Float, configuration: SchemaConfiguration?): Float { + return validate(arg as Number, configuration) as Float + } + + @Throws(ValidationException::class) + fun validate(arg: Double, configuration: SchemaConfiguration?): Double { + return validate(arg as Number, configuration) as Double + } + + @Throws(ValidationException::class) + override fun validate(arg: String, configuration: SchemaConfiguration?): String { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validatedPathToSchemas = PathToSchemasMap() + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, LinkedHashSet()) + getPathToSchemas(this, castArg, validationMetadata, pathSet) + return castArg + } + + @Throws(ValidationException::class) + fun validate(arg: LocalDate, configuration: SchemaConfiguration?): String { + return validate(arg.toString(), configuration) + } + + @Throws(ValidationException::class) + fun validate(arg: ZonedDateTime, configuration: SchemaConfiguration?): String { + return validate(arg.toString(), configuration) + } + + @Throws(ValidationException::class) + fun validate(arg: UUID, configuration: SchemaConfiguration?): String { + return validate(arg.toString(), configuration) + } + + override fun getNewInstance(arg: List<*>, pathToItem: List, pathToSchemas: PathToSchemasMap): FrozenList { + val items: MutableList = ArrayList() + var i: Int = 0 + for (item: Any? in arg) { + val itemPathToItem = pathToItem + i + val schemas: LinkedHashMap, Nothing?>? = pathToSchemas.get(itemPathToItem) + if (schemas == null) { + throw RuntimeException("Validation result is invalid, schemas must exist for a pathToItem") + } + val itemSchema: JsonSchema<*> = schemas.entries.iterator().next().key + val itemInstance: Any? = itemSchema.getNewInstance(item, itemPathToItem, pathToSchemas) + items.add(itemInstance) + i += 1 + } + val newInstanceItems: FrozenList = FrozenList(items) + return newInstanceItems + } + + @Throws(ValidationException::class) + override fun validate(arg: List<*>, configuration: SchemaConfiguration?): FrozenList { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, PathToSchemasMap(), LinkedHashSet()) + val pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet) + return getNewInstance(castArg, validationMetadata.pathToItem, pathToSchemasMap) + } + + override fun getNewInstance(arg: Map<*, *>, pathToItem: List, pathToSchemas: PathToSchemasMap): FrozenMap { + val properties: LinkedHashMap = LinkedHashMap() + for((propertyName, value) in arg) { + if (!(propertyName is String)) { + throw RuntimeException("Invalid non-string key value") + } + val propertyPathToItem: List = pathToItem + propertyName + val schemas: LinkedHashMap, Nothing?>? = pathToSchemas.get(propertyPathToItem) + if (schemas == null) { + throw RuntimeException("Validation result is invalid, schemas must exist for a pathToItem") + } + val propertySchema: JsonSchema<*> = schemas.entries.iterator().next().key + val propertyInstance: Any? = propertySchema.getNewInstance(value, propertyPathToItem, pathToSchemas) + properties[propertyName] = propertyInstance + } + val castProperties: FrozenMap = FrozenMap(properties) + return castProperties + } + + @Throws(ValidationException::class) + override fun validate(arg: Map<*, *>, configuration: SchemaConfiguration?): FrozenMap { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validatedPathToSchemas = PathToSchemasMap() + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, LinkedHashSet()) + val pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet) + return getNewInstance(castArg, validationMetadata.pathToItem, pathToSchemasMap) + } + + @Throws(ValidationException::class) + override fun validate(arg: Any?, configuration: SchemaConfiguration?): Any? { + if (arg == null) { + return validate(null, configuration) + } else if (arg is Boolean) { + return validate(arg, configuration) + } else if (arg is Number) { + return validate(arg, configuration) + } else if (arg is String) { + return validate(arg, configuration) + } else if (arg is List<*>) { + return validate(arg, configuration) + } else if (arg is Map<*, *>) { + return validate(arg, configuration) + } + throw ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema") + } + override fun getNewInstance(arg: Any?, pathToItem: List, pathToSchemas: PathToSchemasMap): Any? { + if (arg == null) { + return getNewInstance( null, pathToItem, pathToSchemas) + } else if (arg is Boolean) { + return getNewInstance(arg, pathToItem, pathToSchemas) + } else if (arg is Number) { + return getNewInstance(arg, pathToItem, pathToSchemas) + } else if (arg is String) { + return getNewInstance(arg, pathToItem, pathToSchemas) + } else if (arg is List<*>) { + return getNewInstance(arg, pathToItem, pathToSchemas) + } else if (arg is Map<*, *>) { + return getNewInstance(arg, pathToItem, pathToSchemas) + } + throw RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema") + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: Nothing?, configuration: SchemaConfiguration?): Maxproperties0MeansTheObjectIsEmpty1BoxedVoid { + return Maxproperties0MeansTheObjectIsEmpty1BoxedVoid(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: Boolean, configuration: SchemaConfiguration?): Maxproperties0MeansTheObjectIsEmpty1BoxedBoolean { + return Maxproperties0MeansTheObjectIsEmpty1BoxedBoolean(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: Number, configuration: SchemaConfiguration?): Maxproperties0MeansTheObjectIsEmpty1BoxedNumber { + return Maxproperties0MeansTheObjectIsEmpty1BoxedNumber(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: String, configuration: SchemaConfiguration?): Maxproperties0MeansTheObjectIsEmpty1BoxedString { + return Maxproperties0MeansTheObjectIsEmpty1BoxedString(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: List<*>, configuration: SchemaConfiguration?): Maxproperties0MeansTheObjectIsEmpty1BoxedList { + return Maxproperties0MeansTheObjectIsEmpty1BoxedList(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: Map<*, *>, configuration: SchemaConfiguration?): Maxproperties0MeansTheObjectIsEmpty1BoxedMap { + return Maxproperties0MeansTheObjectIsEmpty1BoxedMap(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: Any?, configuration: SchemaConfiguration?): Maxproperties0MeansTheObjectIsEmpty1Boxed { + if (arg == null) { + return validateAndBox(null, configuration) + } else if (arg is Boolean) { + return validateAndBox(arg, configuration) + } else if (arg is String) { + return validateAndBox(arg, configuration) + } else if (arg is Number) { + return validateAndBox(arg, configuration) + } else if (arg is List<*>) { + return validateAndBox(arg, configuration) + } else if (arg is Map<*, *>) { + return validateAndBox(arg, configuration) + } + throw ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema") + } + } +} diff --git a/samples/client/3_0_3_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/schemas/MaxpropertiesValidation.kt b/samples/client/3_0_3_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/schemas/MaxpropertiesValidation.kt new file mode 100644 index 00000000000..4605f17fd0e --- /dev/null +++ b/samples/client/3_0_3_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/schemas/MaxpropertiesValidation.kt @@ -0,0 +1,308 @@ +package org.openapijsonschematools.client.components.schemas +import java.time.LocalDate +import java.time.ZonedDateTime +import java.util.UUID +import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags +import org.openapijsonschematools.client.configurations.SchemaConfiguration +import org.openapijsonschematools.client.exceptions.InvalidAdditionalPropertyException +import org.openapijsonschematools.client.exceptions.UnsetPropertyException +import org.openapijsonschematools.client.exceptions.ValidationException +import org.openapijsonschematools.client.schemas.UnsetAddPropsSetter +import org.openapijsonschematools.client.schemas.validation.BooleanSchemaValidator +import org.openapijsonschematools.client.schemas.validation.FrozenList +import org.openapijsonschematools.client.schemas.validation.FrozenMap +import org.openapijsonschematools.client.schemas.validation.JsonSchema +import org.openapijsonschematools.client.schemas.validation.JsonSchemaInfo +import org.openapijsonschematools.client.schemas.validation.ListSchemaValidator +import org.openapijsonschematools.client.schemas.validation.MapSchemaValidator +import org.openapijsonschematools.client.schemas.validation.NullSchemaValidator +import org.openapijsonschematools.client.schemas.validation.NumberSchemaValidator +import org.openapijsonschematools.client.schemas.validation.PathToSchemasMap +import org.openapijsonschematools.client.schemas.validation.StringSchemaValidator +import org.openapijsonschematools.client.schemas.validation.ValidationMetadata + +class MaxpropertiesValidation { + // nest classes so all schemas and input/output classes can be public + + + sealed interface MaxpropertiesValidation1Boxed { + fun getData(): Any? + } + + data class MaxpropertiesValidation1BoxedVoid(val data: Nothing?) : MaxpropertiesValidation1Boxed { + override fun getData(): Any? { + return data + } + } + + data class MaxpropertiesValidation1BoxedBoolean(val data: Boolean): MaxpropertiesValidation1Boxed { + override fun getData(): Any? { + return data + } + } + + data class MaxpropertiesValidation1BoxedNumber(val data: Number) : MaxpropertiesValidation1Boxed { + override fun getData(): Any? { + return data + } + } + + data class MaxpropertiesValidation1BoxedString(val data: String) : MaxpropertiesValidation1Boxed { + override fun getData(): Any? { + return data + } + } + + data class MaxpropertiesValidation1BoxedList(val data: FrozenList) : MaxpropertiesValidation1Boxed { + override fun getData(): Any? { + return data + } + } + + data class MaxpropertiesValidation1BoxedMap(val data: FrozenMap) : MaxpropertiesValidation1Boxed { + override fun getData(): Any? { + return data + } + } + + + class MaxpropertiesValidation1 private constructor(): JsonSchema( + JsonSchemaInfo() + .maxProperties(2) + ), NullSchemaValidator, BooleanSchemaValidator, NumberSchemaValidator, StringSchemaValidator, ListSchemaValidator, MaxpropertiesValidation1BoxedList>, MapSchemaValidator, MaxpropertiesValidation1BoxedMap> { + /* + NOTE: This class is auto generated by OpenAPI JSON Schema Generator. + Ref: https://github.com/openapi-json-schema-tools/openapi-json-schema-generator + + Do not edit the class manually. + */ + + companion object { + @Volatile + private var instance: MaxpropertiesValidation1? = null + + fun getInstance() = + instance ?: synchronized(this) { + instance ?: MaxpropertiesValidation1().also { instance = it } + } + } + + @Throws(ValidationException::class) + override fun validate(arg: Nothing?, configuration: SchemaConfiguration?): Nothing? { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validatedPathToSchemas = PathToSchemasMap() + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, LinkedHashSet()) + getPathToSchemas(this, castArg, validationMetadata, pathSet) + return castArg + } + + @Throws(ValidationException::class) + override fun validate(arg: Boolean, configuration: SchemaConfiguration?): Boolean { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validatedPathToSchemas = PathToSchemasMap() + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, LinkedHashSet()) + getPathToSchemas(this, castArg, validationMetadata, pathSet) + return castArg + } + + @Throws(ValidationException::class) + override fun validate(arg: Number, configuration: SchemaConfiguration?): Number { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validatedPathToSchemas = PathToSchemasMap() + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, LinkedHashSet()) + getPathToSchemas(this, castArg, validationMetadata, pathSet) + return castArg + } + + @Throws(ValidationException::class) + fun validate(arg: Int, configuration: SchemaConfiguration?): Int { + return validate(arg as Number, configuration) as Int + } + + @Throws(ValidationException::class) + fun validate(arg: Long, configuration: SchemaConfiguration?): Long { + return validate(arg as Number, configuration) as Long + } + + @Throws(ValidationException::class) + fun validate(arg: Float, configuration: SchemaConfiguration?): Float { + return validate(arg as Number, configuration) as Float + } + + @Throws(ValidationException::class) + fun validate(arg: Double, configuration: SchemaConfiguration?): Double { + return validate(arg as Number, configuration) as Double + } + + @Throws(ValidationException::class) + override fun validate(arg: String, configuration: SchemaConfiguration?): String { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validatedPathToSchemas = PathToSchemasMap() + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, LinkedHashSet()) + getPathToSchemas(this, castArg, validationMetadata, pathSet) + return castArg + } + + @Throws(ValidationException::class) + fun validate(arg: LocalDate, configuration: SchemaConfiguration?): String { + return validate(arg.toString(), configuration) + } + + @Throws(ValidationException::class) + fun validate(arg: ZonedDateTime, configuration: SchemaConfiguration?): String { + return validate(arg.toString(), configuration) + } + + @Throws(ValidationException::class) + fun validate(arg: UUID, configuration: SchemaConfiguration?): String { + return validate(arg.toString(), configuration) + } + + override fun getNewInstance(arg: List<*>, pathToItem: List, pathToSchemas: PathToSchemasMap): FrozenList { + val items: MutableList = ArrayList() + var i: Int = 0 + for (item: Any? in arg) { + val itemPathToItem = pathToItem + i + val schemas: LinkedHashMap, Nothing?>? = pathToSchemas.get(itemPathToItem) + if (schemas == null) { + throw RuntimeException("Validation result is invalid, schemas must exist for a pathToItem") + } + val itemSchema: JsonSchema<*> = schemas.entries.iterator().next().key + val itemInstance: Any? = itemSchema.getNewInstance(item, itemPathToItem, pathToSchemas) + items.add(itemInstance) + i += 1 + } + val newInstanceItems: FrozenList = FrozenList(items) + return newInstanceItems + } + + @Throws(ValidationException::class) + override fun validate(arg: List<*>, configuration: SchemaConfiguration?): FrozenList { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, PathToSchemasMap(), LinkedHashSet()) + val pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet) + return getNewInstance(castArg, validationMetadata.pathToItem, pathToSchemasMap) + } + + override fun getNewInstance(arg: Map<*, *>, pathToItem: List, pathToSchemas: PathToSchemasMap): FrozenMap { + val properties: LinkedHashMap = LinkedHashMap() + for((propertyName, value) in arg) { + if (!(propertyName is String)) { + throw RuntimeException("Invalid non-string key value") + } + val propertyPathToItem: List = pathToItem + propertyName + val schemas: LinkedHashMap, Nothing?>? = pathToSchemas.get(propertyPathToItem) + if (schemas == null) { + throw RuntimeException("Validation result is invalid, schemas must exist for a pathToItem") + } + val propertySchema: JsonSchema<*> = schemas.entries.iterator().next().key + val propertyInstance: Any? = propertySchema.getNewInstance(value, propertyPathToItem, pathToSchemas) + properties[propertyName] = propertyInstance + } + val castProperties: FrozenMap = FrozenMap(properties) + return castProperties + } + + @Throws(ValidationException::class) + override fun validate(arg: Map<*, *>, configuration: SchemaConfiguration?): FrozenMap { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validatedPathToSchemas = PathToSchemasMap() + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, LinkedHashSet()) + val pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet) + return getNewInstance(castArg, validationMetadata.pathToItem, pathToSchemasMap) + } + + @Throws(ValidationException::class) + override fun validate(arg: Any?, configuration: SchemaConfiguration?): Any? { + if (arg == null) { + return validate(null, configuration) + } else if (arg is Boolean) { + return validate(arg, configuration) + } else if (arg is Number) { + return validate(arg, configuration) + } else if (arg is String) { + return validate(arg, configuration) + } else if (arg is List<*>) { + return validate(arg, configuration) + } else if (arg is Map<*, *>) { + return validate(arg, configuration) + } + throw ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema") + } + override fun getNewInstance(arg: Any?, pathToItem: List, pathToSchemas: PathToSchemasMap): Any? { + if (arg == null) { + return getNewInstance( null, pathToItem, pathToSchemas) + } else if (arg is Boolean) { + return getNewInstance(arg, pathToItem, pathToSchemas) + } else if (arg is Number) { + return getNewInstance(arg, pathToItem, pathToSchemas) + } else if (arg is String) { + return getNewInstance(arg, pathToItem, pathToSchemas) + } else if (arg is List<*>) { + return getNewInstance(arg, pathToItem, pathToSchemas) + } else if (arg is Map<*, *>) { + return getNewInstance(arg, pathToItem, pathToSchemas) + } + throw RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema") + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: Nothing?, configuration: SchemaConfiguration?): MaxpropertiesValidation1BoxedVoid { + return MaxpropertiesValidation1BoxedVoid(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: Boolean, configuration: SchemaConfiguration?): MaxpropertiesValidation1BoxedBoolean { + return MaxpropertiesValidation1BoxedBoolean(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: Number, configuration: SchemaConfiguration?): MaxpropertiesValidation1BoxedNumber { + return MaxpropertiesValidation1BoxedNumber(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: String, configuration: SchemaConfiguration?): MaxpropertiesValidation1BoxedString { + return MaxpropertiesValidation1BoxedString(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: List<*>, configuration: SchemaConfiguration?): MaxpropertiesValidation1BoxedList { + return MaxpropertiesValidation1BoxedList(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: Map<*, *>, configuration: SchemaConfiguration?): MaxpropertiesValidation1BoxedMap { + return MaxpropertiesValidation1BoxedMap(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: Any?, configuration: SchemaConfiguration?): MaxpropertiesValidation1Boxed { + if (arg == null) { + return validateAndBox(null, configuration) + } else if (arg is Boolean) { + return validateAndBox(arg, configuration) + } else if (arg is String) { + return validateAndBox(arg, configuration) + } else if (arg is Number) { + return validateAndBox(arg, configuration) + } else if (arg is List<*>) { + return validateAndBox(arg, configuration) + } else if (arg is Map<*, *>) { + return validateAndBox(arg, configuration) + } + throw ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema") + } + } +} diff --git a/samples/client/3_0_3_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/schemas/MinimumValidation.kt b/samples/client/3_0_3_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/schemas/MinimumValidation.kt new file mode 100644 index 00000000000..93c46043a0f --- /dev/null +++ b/samples/client/3_0_3_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/schemas/MinimumValidation.kt @@ -0,0 +1,308 @@ +package org.openapijsonschematools.client.components.schemas +import java.time.LocalDate +import java.time.ZonedDateTime +import java.util.UUID +import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags +import org.openapijsonschematools.client.configurations.SchemaConfiguration +import org.openapijsonschematools.client.exceptions.InvalidAdditionalPropertyException +import org.openapijsonschematools.client.exceptions.UnsetPropertyException +import org.openapijsonschematools.client.exceptions.ValidationException +import org.openapijsonschematools.client.schemas.UnsetAddPropsSetter +import org.openapijsonschematools.client.schemas.validation.BooleanSchemaValidator +import org.openapijsonschematools.client.schemas.validation.FrozenList +import org.openapijsonschematools.client.schemas.validation.FrozenMap +import org.openapijsonschematools.client.schemas.validation.JsonSchema +import org.openapijsonschematools.client.schemas.validation.JsonSchemaInfo +import org.openapijsonschematools.client.schemas.validation.ListSchemaValidator +import org.openapijsonschematools.client.schemas.validation.MapSchemaValidator +import org.openapijsonschematools.client.schemas.validation.NullSchemaValidator +import org.openapijsonschematools.client.schemas.validation.NumberSchemaValidator +import org.openapijsonschematools.client.schemas.validation.PathToSchemasMap +import org.openapijsonschematools.client.schemas.validation.StringSchemaValidator +import org.openapijsonschematools.client.schemas.validation.ValidationMetadata + +class MinimumValidation { + // nest classes so all schemas and input/output classes can be public + + + sealed interface MinimumValidation1Boxed { + fun getData(): Any? + } + + data class MinimumValidation1BoxedVoid(val data: Nothing?) : MinimumValidation1Boxed { + override fun getData(): Any? { + return data + } + } + + data class MinimumValidation1BoxedBoolean(val data: Boolean): MinimumValidation1Boxed { + override fun getData(): Any? { + return data + } + } + + data class MinimumValidation1BoxedNumber(val data: Number) : MinimumValidation1Boxed { + override fun getData(): Any? { + return data + } + } + + data class MinimumValidation1BoxedString(val data: String) : MinimumValidation1Boxed { + override fun getData(): Any? { + return data + } + } + + data class MinimumValidation1BoxedList(val data: FrozenList) : MinimumValidation1Boxed { + override fun getData(): Any? { + return data + } + } + + data class MinimumValidation1BoxedMap(val data: FrozenMap) : MinimumValidation1Boxed { + override fun getData(): Any? { + return data + } + } + + + class MinimumValidation1 private constructor(): JsonSchema( + JsonSchemaInfo() + .minimum(1.1) + ), NullSchemaValidator, BooleanSchemaValidator, NumberSchemaValidator, StringSchemaValidator, ListSchemaValidator, MinimumValidation1BoxedList>, MapSchemaValidator, MinimumValidation1BoxedMap> { + /* + NOTE: This class is auto generated by OpenAPI JSON Schema Generator. + Ref: https://github.com/openapi-json-schema-tools/openapi-json-schema-generator + + Do not edit the class manually. + */ + + companion object { + @Volatile + private var instance: MinimumValidation1? = null + + fun getInstance() = + instance ?: synchronized(this) { + instance ?: MinimumValidation1().also { instance = it } + } + } + + @Throws(ValidationException::class) + override fun validate(arg: Nothing?, configuration: SchemaConfiguration?): Nothing? { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validatedPathToSchemas = PathToSchemasMap() + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, LinkedHashSet()) + getPathToSchemas(this, castArg, validationMetadata, pathSet) + return castArg + } + + @Throws(ValidationException::class) + override fun validate(arg: Boolean, configuration: SchemaConfiguration?): Boolean { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validatedPathToSchemas = PathToSchemasMap() + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, LinkedHashSet()) + getPathToSchemas(this, castArg, validationMetadata, pathSet) + return castArg + } + + @Throws(ValidationException::class) + override fun validate(arg: Number, configuration: SchemaConfiguration?): Number { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validatedPathToSchemas = PathToSchemasMap() + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, LinkedHashSet()) + getPathToSchemas(this, castArg, validationMetadata, pathSet) + return castArg + } + + @Throws(ValidationException::class) + fun validate(arg: Int, configuration: SchemaConfiguration?): Int { + return validate(arg as Number, configuration) as Int + } + + @Throws(ValidationException::class) + fun validate(arg: Long, configuration: SchemaConfiguration?): Long { + return validate(arg as Number, configuration) as Long + } + + @Throws(ValidationException::class) + fun validate(arg: Float, configuration: SchemaConfiguration?): Float { + return validate(arg as Number, configuration) as Float + } + + @Throws(ValidationException::class) + fun validate(arg: Double, configuration: SchemaConfiguration?): Double { + return validate(arg as Number, configuration) as Double + } + + @Throws(ValidationException::class) + override fun validate(arg: String, configuration: SchemaConfiguration?): String { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validatedPathToSchemas = PathToSchemasMap() + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, LinkedHashSet()) + getPathToSchemas(this, castArg, validationMetadata, pathSet) + return castArg + } + + @Throws(ValidationException::class) + fun validate(arg: LocalDate, configuration: SchemaConfiguration?): String { + return validate(arg.toString(), configuration) + } + + @Throws(ValidationException::class) + fun validate(arg: ZonedDateTime, configuration: SchemaConfiguration?): String { + return validate(arg.toString(), configuration) + } + + @Throws(ValidationException::class) + fun validate(arg: UUID, configuration: SchemaConfiguration?): String { + return validate(arg.toString(), configuration) + } + + override fun getNewInstance(arg: List<*>, pathToItem: List, pathToSchemas: PathToSchemasMap): FrozenList { + val items: MutableList = ArrayList() + var i: Int = 0 + for (item: Any? in arg) { + val itemPathToItem = pathToItem + i + val schemas: LinkedHashMap, Nothing?>? = pathToSchemas.get(itemPathToItem) + if (schemas == null) { + throw RuntimeException("Validation result is invalid, schemas must exist for a pathToItem") + } + val itemSchema: JsonSchema<*> = schemas.entries.iterator().next().key + val itemInstance: Any? = itemSchema.getNewInstance(item, itemPathToItem, pathToSchemas) + items.add(itemInstance) + i += 1 + } + val newInstanceItems: FrozenList = FrozenList(items) + return newInstanceItems + } + + @Throws(ValidationException::class) + override fun validate(arg: List<*>, configuration: SchemaConfiguration?): FrozenList { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, PathToSchemasMap(), LinkedHashSet()) + val pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet) + return getNewInstance(castArg, validationMetadata.pathToItem, pathToSchemasMap) + } + + override fun getNewInstance(arg: Map<*, *>, pathToItem: List, pathToSchemas: PathToSchemasMap): FrozenMap { + val properties: LinkedHashMap = LinkedHashMap() + for((propertyName, value) in arg) { + if (!(propertyName is String)) { + throw RuntimeException("Invalid non-string key value") + } + val propertyPathToItem: List = pathToItem + propertyName + val schemas: LinkedHashMap, Nothing?>? = pathToSchemas.get(propertyPathToItem) + if (schemas == null) { + throw RuntimeException("Validation result is invalid, schemas must exist for a pathToItem") + } + val propertySchema: JsonSchema<*> = schemas.entries.iterator().next().key + val propertyInstance: Any? = propertySchema.getNewInstance(value, propertyPathToItem, pathToSchemas) + properties[propertyName] = propertyInstance + } + val castProperties: FrozenMap = FrozenMap(properties) + return castProperties + } + + @Throws(ValidationException::class) + override fun validate(arg: Map<*, *>, configuration: SchemaConfiguration?): FrozenMap { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validatedPathToSchemas = PathToSchemasMap() + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, LinkedHashSet()) + val pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet) + return getNewInstance(castArg, validationMetadata.pathToItem, pathToSchemasMap) + } + + @Throws(ValidationException::class) + override fun validate(arg: Any?, configuration: SchemaConfiguration?): Any? { + if (arg == null) { + return validate(null, configuration) + } else if (arg is Boolean) { + return validate(arg, configuration) + } else if (arg is Number) { + return validate(arg, configuration) + } else if (arg is String) { + return validate(arg, configuration) + } else if (arg is List<*>) { + return validate(arg, configuration) + } else if (arg is Map<*, *>) { + return validate(arg, configuration) + } + throw ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema") + } + override fun getNewInstance(arg: Any?, pathToItem: List, pathToSchemas: PathToSchemasMap): Any? { + if (arg == null) { + return getNewInstance( null, pathToItem, pathToSchemas) + } else if (arg is Boolean) { + return getNewInstance(arg, pathToItem, pathToSchemas) + } else if (arg is Number) { + return getNewInstance(arg, pathToItem, pathToSchemas) + } else if (arg is String) { + return getNewInstance(arg, pathToItem, pathToSchemas) + } else if (arg is List<*>) { + return getNewInstance(arg, pathToItem, pathToSchemas) + } else if (arg is Map<*, *>) { + return getNewInstance(arg, pathToItem, pathToSchemas) + } + throw RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema") + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: Nothing?, configuration: SchemaConfiguration?): MinimumValidation1BoxedVoid { + return MinimumValidation1BoxedVoid(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: Boolean, configuration: SchemaConfiguration?): MinimumValidation1BoxedBoolean { + return MinimumValidation1BoxedBoolean(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: Number, configuration: SchemaConfiguration?): MinimumValidation1BoxedNumber { + return MinimumValidation1BoxedNumber(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: String, configuration: SchemaConfiguration?): MinimumValidation1BoxedString { + return MinimumValidation1BoxedString(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: List<*>, configuration: SchemaConfiguration?): MinimumValidation1BoxedList { + return MinimumValidation1BoxedList(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: Map<*, *>, configuration: SchemaConfiguration?): MinimumValidation1BoxedMap { + return MinimumValidation1BoxedMap(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: Any?, configuration: SchemaConfiguration?): MinimumValidation1Boxed { + if (arg == null) { + return validateAndBox(null, configuration) + } else if (arg is Boolean) { + return validateAndBox(arg, configuration) + } else if (arg is String) { + return validateAndBox(arg, configuration) + } else if (arg is Number) { + return validateAndBox(arg, configuration) + } else if (arg is List<*>) { + return validateAndBox(arg, configuration) + } else if (arg is Map<*, *>) { + return validateAndBox(arg, configuration) + } + throw ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema") + } + } +} diff --git a/samples/client/3_0_3_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/schemas/MinimumValidationWithSignedInteger.kt b/samples/client/3_0_3_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/schemas/MinimumValidationWithSignedInteger.kt new file mode 100644 index 00000000000..d6d1593b716 --- /dev/null +++ b/samples/client/3_0_3_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/schemas/MinimumValidationWithSignedInteger.kt @@ -0,0 +1,308 @@ +package org.openapijsonschematools.client.components.schemas +import java.time.LocalDate +import java.time.ZonedDateTime +import java.util.UUID +import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags +import org.openapijsonschematools.client.configurations.SchemaConfiguration +import org.openapijsonschematools.client.exceptions.InvalidAdditionalPropertyException +import org.openapijsonschematools.client.exceptions.UnsetPropertyException +import org.openapijsonschematools.client.exceptions.ValidationException +import org.openapijsonschematools.client.schemas.UnsetAddPropsSetter +import org.openapijsonschematools.client.schemas.validation.BooleanSchemaValidator +import org.openapijsonschematools.client.schemas.validation.FrozenList +import org.openapijsonschematools.client.schemas.validation.FrozenMap +import org.openapijsonschematools.client.schemas.validation.JsonSchema +import org.openapijsonschematools.client.schemas.validation.JsonSchemaInfo +import org.openapijsonschematools.client.schemas.validation.ListSchemaValidator +import org.openapijsonschematools.client.schemas.validation.MapSchemaValidator +import org.openapijsonschematools.client.schemas.validation.NullSchemaValidator +import org.openapijsonschematools.client.schemas.validation.NumberSchemaValidator +import org.openapijsonschematools.client.schemas.validation.PathToSchemasMap +import org.openapijsonschematools.client.schemas.validation.StringSchemaValidator +import org.openapijsonschematools.client.schemas.validation.ValidationMetadata + +class MinimumValidationWithSignedInteger { + // nest classes so all schemas and input/output classes can be public + + + sealed interface MinimumValidationWithSignedInteger1Boxed { + fun getData(): Any? + } + + data class MinimumValidationWithSignedInteger1BoxedVoid(val data: Nothing?) : MinimumValidationWithSignedInteger1Boxed { + override fun getData(): Any? { + return data + } + } + + data class MinimumValidationWithSignedInteger1BoxedBoolean(val data: Boolean): MinimumValidationWithSignedInteger1Boxed { + override fun getData(): Any? { + return data + } + } + + data class MinimumValidationWithSignedInteger1BoxedNumber(val data: Number) : MinimumValidationWithSignedInteger1Boxed { + override fun getData(): Any? { + return data + } + } + + data class MinimumValidationWithSignedInteger1BoxedString(val data: String) : MinimumValidationWithSignedInteger1Boxed { + override fun getData(): Any? { + return data + } + } + + data class MinimumValidationWithSignedInteger1BoxedList(val data: FrozenList) : MinimumValidationWithSignedInteger1Boxed { + override fun getData(): Any? { + return data + } + } + + data class MinimumValidationWithSignedInteger1BoxedMap(val data: FrozenMap) : MinimumValidationWithSignedInteger1Boxed { + override fun getData(): Any? { + return data + } + } + + + class MinimumValidationWithSignedInteger1 private constructor(): JsonSchema( + JsonSchemaInfo() + .minimum(-2) + ), NullSchemaValidator, BooleanSchemaValidator, NumberSchemaValidator, StringSchemaValidator, ListSchemaValidator, MinimumValidationWithSignedInteger1BoxedList>, MapSchemaValidator, MinimumValidationWithSignedInteger1BoxedMap> { + /* + NOTE: This class is auto generated by OpenAPI JSON Schema Generator. + Ref: https://github.com/openapi-json-schema-tools/openapi-json-schema-generator + + Do not edit the class manually. + */ + + companion object { + @Volatile + private var instance: MinimumValidationWithSignedInteger1? = null + + fun getInstance() = + instance ?: synchronized(this) { + instance ?: MinimumValidationWithSignedInteger1().also { instance = it } + } + } + + @Throws(ValidationException::class) + override fun validate(arg: Nothing?, configuration: SchemaConfiguration?): Nothing? { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validatedPathToSchemas = PathToSchemasMap() + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, LinkedHashSet()) + getPathToSchemas(this, castArg, validationMetadata, pathSet) + return castArg + } + + @Throws(ValidationException::class) + override fun validate(arg: Boolean, configuration: SchemaConfiguration?): Boolean { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validatedPathToSchemas = PathToSchemasMap() + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, LinkedHashSet()) + getPathToSchemas(this, castArg, validationMetadata, pathSet) + return castArg + } + + @Throws(ValidationException::class) + override fun validate(arg: Number, configuration: SchemaConfiguration?): Number { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validatedPathToSchemas = PathToSchemasMap() + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, LinkedHashSet()) + getPathToSchemas(this, castArg, validationMetadata, pathSet) + return castArg + } + + @Throws(ValidationException::class) + fun validate(arg: Int, configuration: SchemaConfiguration?): Int { + return validate(arg as Number, configuration) as Int + } + + @Throws(ValidationException::class) + fun validate(arg: Long, configuration: SchemaConfiguration?): Long { + return validate(arg as Number, configuration) as Long + } + + @Throws(ValidationException::class) + fun validate(arg: Float, configuration: SchemaConfiguration?): Float { + return validate(arg as Number, configuration) as Float + } + + @Throws(ValidationException::class) + fun validate(arg: Double, configuration: SchemaConfiguration?): Double { + return validate(arg as Number, configuration) as Double + } + + @Throws(ValidationException::class) + override fun validate(arg: String, configuration: SchemaConfiguration?): String { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validatedPathToSchemas = PathToSchemasMap() + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, LinkedHashSet()) + getPathToSchemas(this, castArg, validationMetadata, pathSet) + return castArg + } + + @Throws(ValidationException::class) + fun validate(arg: LocalDate, configuration: SchemaConfiguration?): String { + return validate(arg.toString(), configuration) + } + + @Throws(ValidationException::class) + fun validate(arg: ZonedDateTime, configuration: SchemaConfiguration?): String { + return validate(arg.toString(), configuration) + } + + @Throws(ValidationException::class) + fun validate(arg: UUID, configuration: SchemaConfiguration?): String { + return validate(arg.toString(), configuration) + } + + override fun getNewInstance(arg: List<*>, pathToItem: List, pathToSchemas: PathToSchemasMap): FrozenList { + val items: MutableList = ArrayList() + var i: Int = 0 + for (item: Any? in arg) { + val itemPathToItem = pathToItem + i + val schemas: LinkedHashMap, Nothing?>? = pathToSchemas.get(itemPathToItem) + if (schemas == null) { + throw RuntimeException("Validation result is invalid, schemas must exist for a pathToItem") + } + val itemSchema: JsonSchema<*> = schemas.entries.iterator().next().key + val itemInstance: Any? = itemSchema.getNewInstance(item, itemPathToItem, pathToSchemas) + items.add(itemInstance) + i += 1 + } + val newInstanceItems: FrozenList = FrozenList(items) + return newInstanceItems + } + + @Throws(ValidationException::class) + override fun validate(arg: List<*>, configuration: SchemaConfiguration?): FrozenList { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, PathToSchemasMap(), LinkedHashSet()) + val pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet) + return getNewInstance(castArg, validationMetadata.pathToItem, pathToSchemasMap) + } + + override fun getNewInstance(arg: Map<*, *>, pathToItem: List, pathToSchemas: PathToSchemasMap): FrozenMap { + val properties: LinkedHashMap = LinkedHashMap() + for((propertyName, value) in arg) { + if (!(propertyName is String)) { + throw RuntimeException("Invalid non-string key value") + } + val propertyPathToItem: List = pathToItem + propertyName + val schemas: LinkedHashMap, Nothing?>? = pathToSchemas.get(propertyPathToItem) + if (schemas == null) { + throw RuntimeException("Validation result is invalid, schemas must exist for a pathToItem") + } + val propertySchema: JsonSchema<*> = schemas.entries.iterator().next().key + val propertyInstance: Any? = propertySchema.getNewInstance(value, propertyPathToItem, pathToSchemas) + properties[propertyName] = propertyInstance + } + val castProperties: FrozenMap = FrozenMap(properties) + return castProperties + } + + @Throws(ValidationException::class) + override fun validate(arg: Map<*, *>, configuration: SchemaConfiguration?): FrozenMap { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validatedPathToSchemas = PathToSchemasMap() + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, LinkedHashSet()) + val pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet) + return getNewInstance(castArg, validationMetadata.pathToItem, pathToSchemasMap) + } + + @Throws(ValidationException::class) + override fun validate(arg: Any?, configuration: SchemaConfiguration?): Any? { + if (arg == null) { + return validate(null, configuration) + } else if (arg is Boolean) { + return validate(arg, configuration) + } else if (arg is Number) { + return validate(arg, configuration) + } else if (arg is String) { + return validate(arg, configuration) + } else if (arg is List<*>) { + return validate(arg, configuration) + } else if (arg is Map<*, *>) { + return validate(arg, configuration) + } + throw ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema") + } + override fun getNewInstance(arg: Any?, pathToItem: List, pathToSchemas: PathToSchemasMap): Any? { + if (arg == null) { + return getNewInstance( null, pathToItem, pathToSchemas) + } else if (arg is Boolean) { + return getNewInstance(arg, pathToItem, pathToSchemas) + } else if (arg is Number) { + return getNewInstance(arg, pathToItem, pathToSchemas) + } else if (arg is String) { + return getNewInstance(arg, pathToItem, pathToSchemas) + } else if (arg is List<*>) { + return getNewInstance(arg, pathToItem, pathToSchemas) + } else if (arg is Map<*, *>) { + return getNewInstance(arg, pathToItem, pathToSchemas) + } + throw RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema") + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: Nothing?, configuration: SchemaConfiguration?): MinimumValidationWithSignedInteger1BoxedVoid { + return MinimumValidationWithSignedInteger1BoxedVoid(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: Boolean, configuration: SchemaConfiguration?): MinimumValidationWithSignedInteger1BoxedBoolean { + return MinimumValidationWithSignedInteger1BoxedBoolean(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: Number, configuration: SchemaConfiguration?): MinimumValidationWithSignedInteger1BoxedNumber { + return MinimumValidationWithSignedInteger1BoxedNumber(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: String, configuration: SchemaConfiguration?): MinimumValidationWithSignedInteger1BoxedString { + return MinimumValidationWithSignedInteger1BoxedString(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: List<*>, configuration: SchemaConfiguration?): MinimumValidationWithSignedInteger1BoxedList { + return MinimumValidationWithSignedInteger1BoxedList(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: Map<*, *>, configuration: SchemaConfiguration?): MinimumValidationWithSignedInteger1BoxedMap { + return MinimumValidationWithSignedInteger1BoxedMap(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: Any?, configuration: SchemaConfiguration?): MinimumValidationWithSignedInteger1Boxed { + if (arg == null) { + return validateAndBox(null, configuration) + } else if (arg is Boolean) { + return validateAndBox(arg, configuration) + } else if (arg is String) { + return validateAndBox(arg, configuration) + } else if (arg is Number) { + return validateAndBox(arg, configuration) + } else if (arg is List<*>) { + return validateAndBox(arg, configuration) + } else if (arg is Map<*, *>) { + return validateAndBox(arg, configuration) + } + throw ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema") + } + } +} diff --git a/samples/client/3_0_3_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/schemas/MinitemsValidation.kt b/samples/client/3_0_3_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/schemas/MinitemsValidation.kt new file mode 100644 index 00000000000..bc2ce6d4c65 --- /dev/null +++ b/samples/client/3_0_3_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/schemas/MinitemsValidation.kt @@ -0,0 +1,308 @@ +package org.openapijsonschematools.client.components.schemas +import java.time.LocalDate +import java.time.ZonedDateTime +import java.util.UUID +import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags +import org.openapijsonschematools.client.configurations.SchemaConfiguration +import org.openapijsonschematools.client.exceptions.InvalidAdditionalPropertyException +import org.openapijsonschematools.client.exceptions.UnsetPropertyException +import org.openapijsonschematools.client.exceptions.ValidationException +import org.openapijsonschematools.client.schemas.UnsetAddPropsSetter +import org.openapijsonschematools.client.schemas.validation.BooleanSchemaValidator +import org.openapijsonschematools.client.schemas.validation.FrozenList +import org.openapijsonschematools.client.schemas.validation.FrozenMap +import org.openapijsonschematools.client.schemas.validation.JsonSchema +import org.openapijsonschematools.client.schemas.validation.JsonSchemaInfo +import org.openapijsonschematools.client.schemas.validation.ListSchemaValidator +import org.openapijsonschematools.client.schemas.validation.MapSchemaValidator +import org.openapijsonschematools.client.schemas.validation.NullSchemaValidator +import org.openapijsonschematools.client.schemas.validation.NumberSchemaValidator +import org.openapijsonschematools.client.schemas.validation.PathToSchemasMap +import org.openapijsonschematools.client.schemas.validation.StringSchemaValidator +import org.openapijsonschematools.client.schemas.validation.ValidationMetadata + +class MinitemsValidation { + // nest classes so all schemas and input/output classes can be public + + + sealed interface MinitemsValidation1Boxed { + fun getData(): Any? + } + + data class MinitemsValidation1BoxedVoid(val data: Nothing?) : MinitemsValidation1Boxed { + override fun getData(): Any? { + return data + } + } + + data class MinitemsValidation1BoxedBoolean(val data: Boolean): MinitemsValidation1Boxed { + override fun getData(): Any? { + return data + } + } + + data class MinitemsValidation1BoxedNumber(val data: Number) : MinitemsValidation1Boxed { + override fun getData(): Any? { + return data + } + } + + data class MinitemsValidation1BoxedString(val data: String) : MinitemsValidation1Boxed { + override fun getData(): Any? { + return data + } + } + + data class MinitemsValidation1BoxedList(val data: FrozenList) : MinitemsValidation1Boxed { + override fun getData(): Any? { + return data + } + } + + data class MinitemsValidation1BoxedMap(val data: FrozenMap) : MinitemsValidation1Boxed { + override fun getData(): Any? { + return data + } + } + + + class MinitemsValidation1 private constructor(): JsonSchema( + JsonSchemaInfo() + .minItems(1) + ), NullSchemaValidator, BooleanSchemaValidator, NumberSchemaValidator, StringSchemaValidator, ListSchemaValidator, MinitemsValidation1BoxedList>, MapSchemaValidator, MinitemsValidation1BoxedMap> { + /* + NOTE: This class is auto generated by OpenAPI JSON Schema Generator. + Ref: https://github.com/openapi-json-schema-tools/openapi-json-schema-generator + + Do not edit the class manually. + */ + + companion object { + @Volatile + private var instance: MinitemsValidation1? = null + + fun getInstance() = + instance ?: synchronized(this) { + instance ?: MinitemsValidation1().also { instance = it } + } + } + + @Throws(ValidationException::class) + override fun validate(arg: Nothing?, configuration: SchemaConfiguration?): Nothing? { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validatedPathToSchemas = PathToSchemasMap() + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, LinkedHashSet()) + getPathToSchemas(this, castArg, validationMetadata, pathSet) + return castArg + } + + @Throws(ValidationException::class) + override fun validate(arg: Boolean, configuration: SchemaConfiguration?): Boolean { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validatedPathToSchemas = PathToSchemasMap() + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, LinkedHashSet()) + getPathToSchemas(this, castArg, validationMetadata, pathSet) + return castArg + } + + @Throws(ValidationException::class) + override fun validate(arg: Number, configuration: SchemaConfiguration?): Number { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validatedPathToSchemas = PathToSchemasMap() + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, LinkedHashSet()) + getPathToSchemas(this, castArg, validationMetadata, pathSet) + return castArg + } + + @Throws(ValidationException::class) + fun validate(arg: Int, configuration: SchemaConfiguration?): Int { + return validate(arg as Number, configuration) as Int + } + + @Throws(ValidationException::class) + fun validate(arg: Long, configuration: SchemaConfiguration?): Long { + return validate(arg as Number, configuration) as Long + } + + @Throws(ValidationException::class) + fun validate(arg: Float, configuration: SchemaConfiguration?): Float { + return validate(arg as Number, configuration) as Float + } + + @Throws(ValidationException::class) + fun validate(arg: Double, configuration: SchemaConfiguration?): Double { + return validate(arg as Number, configuration) as Double + } + + @Throws(ValidationException::class) + override fun validate(arg: String, configuration: SchemaConfiguration?): String { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validatedPathToSchemas = PathToSchemasMap() + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, LinkedHashSet()) + getPathToSchemas(this, castArg, validationMetadata, pathSet) + return castArg + } + + @Throws(ValidationException::class) + fun validate(arg: LocalDate, configuration: SchemaConfiguration?): String { + return validate(arg.toString(), configuration) + } + + @Throws(ValidationException::class) + fun validate(arg: ZonedDateTime, configuration: SchemaConfiguration?): String { + return validate(arg.toString(), configuration) + } + + @Throws(ValidationException::class) + fun validate(arg: UUID, configuration: SchemaConfiguration?): String { + return validate(arg.toString(), configuration) + } + + override fun getNewInstance(arg: List<*>, pathToItem: List, pathToSchemas: PathToSchemasMap): FrozenList { + val items: MutableList = ArrayList() + var i: Int = 0 + for (item: Any? in arg) { + val itemPathToItem = pathToItem + i + val schemas: LinkedHashMap, Nothing?>? = pathToSchemas.get(itemPathToItem) + if (schemas == null) { + throw RuntimeException("Validation result is invalid, schemas must exist for a pathToItem") + } + val itemSchema: JsonSchema<*> = schemas.entries.iterator().next().key + val itemInstance: Any? = itemSchema.getNewInstance(item, itemPathToItem, pathToSchemas) + items.add(itemInstance) + i += 1 + } + val newInstanceItems: FrozenList = FrozenList(items) + return newInstanceItems + } + + @Throws(ValidationException::class) + override fun validate(arg: List<*>, configuration: SchemaConfiguration?): FrozenList { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, PathToSchemasMap(), LinkedHashSet()) + val pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet) + return getNewInstance(castArg, validationMetadata.pathToItem, pathToSchemasMap) + } + + override fun getNewInstance(arg: Map<*, *>, pathToItem: List, pathToSchemas: PathToSchemasMap): FrozenMap { + val properties: LinkedHashMap = LinkedHashMap() + for((propertyName, value) in arg) { + if (!(propertyName is String)) { + throw RuntimeException("Invalid non-string key value") + } + val propertyPathToItem: List = pathToItem + propertyName + val schemas: LinkedHashMap, Nothing?>? = pathToSchemas.get(propertyPathToItem) + if (schemas == null) { + throw RuntimeException("Validation result is invalid, schemas must exist for a pathToItem") + } + val propertySchema: JsonSchema<*> = schemas.entries.iterator().next().key + val propertyInstance: Any? = propertySchema.getNewInstance(value, propertyPathToItem, pathToSchemas) + properties[propertyName] = propertyInstance + } + val castProperties: FrozenMap = FrozenMap(properties) + return castProperties + } + + @Throws(ValidationException::class) + override fun validate(arg: Map<*, *>, configuration: SchemaConfiguration?): FrozenMap { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validatedPathToSchemas = PathToSchemasMap() + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, LinkedHashSet()) + val pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet) + return getNewInstance(castArg, validationMetadata.pathToItem, pathToSchemasMap) + } + + @Throws(ValidationException::class) + override fun validate(arg: Any?, configuration: SchemaConfiguration?): Any? { + if (arg == null) { + return validate(null, configuration) + } else if (arg is Boolean) { + return validate(arg, configuration) + } else if (arg is Number) { + return validate(arg, configuration) + } else if (arg is String) { + return validate(arg, configuration) + } else if (arg is List<*>) { + return validate(arg, configuration) + } else if (arg is Map<*, *>) { + return validate(arg, configuration) + } + throw ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema") + } + override fun getNewInstance(arg: Any?, pathToItem: List, pathToSchemas: PathToSchemasMap): Any? { + if (arg == null) { + return getNewInstance( null, pathToItem, pathToSchemas) + } else if (arg is Boolean) { + return getNewInstance(arg, pathToItem, pathToSchemas) + } else if (arg is Number) { + return getNewInstance(arg, pathToItem, pathToSchemas) + } else if (arg is String) { + return getNewInstance(arg, pathToItem, pathToSchemas) + } else if (arg is List<*>) { + return getNewInstance(arg, pathToItem, pathToSchemas) + } else if (arg is Map<*, *>) { + return getNewInstance(arg, pathToItem, pathToSchemas) + } + throw RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema") + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: Nothing?, configuration: SchemaConfiguration?): MinitemsValidation1BoxedVoid { + return MinitemsValidation1BoxedVoid(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: Boolean, configuration: SchemaConfiguration?): MinitemsValidation1BoxedBoolean { + return MinitemsValidation1BoxedBoolean(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: Number, configuration: SchemaConfiguration?): MinitemsValidation1BoxedNumber { + return MinitemsValidation1BoxedNumber(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: String, configuration: SchemaConfiguration?): MinitemsValidation1BoxedString { + return MinitemsValidation1BoxedString(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: List<*>, configuration: SchemaConfiguration?): MinitemsValidation1BoxedList { + return MinitemsValidation1BoxedList(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: Map<*, *>, configuration: SchemaConfiguration?): MinitemsValidation1BoxedMap { + return MinitemsValidation1BoxedMap(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: Any?, configuration: SchemaConfiguration?): MinitemsValidation1Boxed { + if (arg == null) { + return validateAndBox(null, configuration) + } else if (arg is Boolean) { + return validateAndBox(arg, configuration) + } else if (arg is String) { + return validateAndBox(arg, configuration) + } else if (arg is Number) { + return validateAndBox(arg, configuration) + } else if (arg is List<*>) { + return validateAndBox(arg, configuration) + } else if (arg is Map<*, *>) { + return validateAndBox(arg, configuration) + } + throw ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema") + } + } +} diff --git a/samples/client/3_0_3_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/schemas/MinlengthValidation.kt b/samples/client/3_0_3_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/schemas/MinlengthValidation.kt new file mode 100644 index 00000000000..2e7b4c422ee --- /dev/null +++ b/samples/client/3_0_3_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/schemas/MinlengthValidation.kt @@ -0,0 +1,308 @@ +package org.openapijsonschematools.client.components.schemas +import java.time.LocalDate +import java.time.ZonedDateTime +import java.util.UUID +import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags +import org.openapijsonschematools.client.configurations.SchemaConfiguration +import org.openapijsonschematools.client.exceptions.InvalidAdditionalPropertyException +import org.openapijsonschematools.client.exceptions.UnsetPropertyException +import org.openapijsonschematools.client.exceptions.ValidationException +import org.openapijsonschematools.client.schemas.UnsetAddPropsSetter +import org.openapijsonschematools.client.schemas.validation.BooleanSchemaValidator +import org.openapijsonschematools.client.schemas.validation.FrozenList +import org.openapijsonschematools.client.schemas.validation.FrozenMap +import org.openapijsonschematools.client.schemas.validation.JsonSchema +import org.openapijsonschematools.client.schemas.validation.JsonSchemaInfo +import org.openapijsonschematools.client.schemas.validation.ListSchemaValidator +import org.openapijsonschematools.client.schemas.validation.MapSchemaValidator +import org.openapijsonschematools.client.schemas.validation.NullSchemaValidator +import org.openapijsonschematools.client.schemas.validation.NumberSchemaValidator +import org.openapijsonschematools.client.schemas.validation.PathToSchemasMap +import org.openapijsonschematools.client.schemas.validation.StringSchemaValidator +import org.openapijsonschematools.client.schemas.validation.ValidationMetadata + +class MinlengthValidation { + // nest classes so all schemas and input/output classes can be public + + + sealed interface MinlengthValidation1Boxed { + fun getData(): Any? + } + + data class MinlengthValidation1BoxedVoid(val data: Nothing?) : MinlengthValidation1Boxed { + override fun getData(): Any? { + return data + } + } + + data class MinlengthValidation1BoxedBoolean(val data: Boolean): MinlengthValidation1Boxed { + override fun getData(): Any? { + return data + } + } + + data class MinlengthValidation1BoxedNumber(val data: Number) : MinlengthValidation1Boxed { + override fun getData(): Any? { + return data + } + } + + data class MinlengthValidation1BoxedString(val data: String) : MinlengthValidation1Boxed { + override fun getData(): Any? { + return data + } + } + + data class MinlengthValidation1BoxedList(val data: FrozenList) : MinlengthValidation1Boxed { + override fun getData(): Any? { + return data + } + } + + data class MinlengthValidation1BoxedMap(val data: FrozenMap) : MinlengthValidation1Boxed { + override fun getData(): Any? { + return data + } + } + + + class MinlengthValidation1 private constructor(): JsonSchema( + JsonSchemaInfo() + .minLength(2) + ), NullSchemaValidator, BooleanSchemaValidator, NumberSchemaValidator, StringSchemaValidator, ListSchemaValidator, MinlengthValidation1BoxedList>, MapSchemaValidator, MinlengthValidation1BoxedMap> { + /* + NOTE: This class is auto generated by OpenAPI JSON Schema Generator. + Ref: https://github.com/openapi-json-schema-tools/openapi-json-schema-generator + + Do not edit the class manually. + */ + + companion object { + @Volatile + private var instance: MinlengthValidation1? = null + + fun getInstance() = + instance ?: synchronized(this) { + instance ?: MinlengthValidation1().also { instance = it } + } + } + + @Throws(ValidationException::class) + override fun validate(arg: Nothing?, configuration: SchemaConfiguration?): Nothing? { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validatedPathToSchemas = PathToSchemasMap() + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, LinkedHashSet()) + getPathToSchemas(this, castArg, validationMetadata, pathSet) + return castArg + } + + @Throws(ValidationException::class) + override fun validate(arg: Boolean, configuration: SchemaConfiguration?): Boolean { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validatedPathToSchemas = PathToSchemasMap() + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, LinkedHashSet()) + getPathToSchemas(this, castArg, validationMetadata, pathSet) + return castArg + } + + @Throws(ValidationException::class) + override fun validate(arg: Number, configuration: SchemaConfiguration?): Number { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validatedPathToSchemas = PathToSchemasMap() + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, LinkedHashSet()) + getPathToSchemas(this, castArg, validationMetadata, pathSet) + return castArg + } + + @Throws(ValidationException::class) + fun validate(arg: Int, configuration: SchemaConfiguration?): Int { + return validate(arg as Number, configuration) as Int + } + + @Throws(ValidationException::class) + fun validate(arg: Long, configuration: SchemaConfiguration?): Long { + return validate(arg as Number, configuration) as Long + } + + @Throws(ValidationException::class) + fun validate(arg: Float, configuration: SchemaConfiguration?): Float { + return validate(arg as Number, configuration) as Float + } + + @Throws(ValidationException::class) + fun validate(arg: Double, configuration: SchemaConfiguration?): Double { + return validate(arg as Number, configuration) as Double + } + + @Throws(ValidationException::class) + override fun validate(arg: String, configuration: SchemaConfiguration?): String { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validatedPathToSchemas = PathToSchemasMap() + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, LinkedHashSet()) + getPathToSchemas(this, castArg, validationMetadata, pathSet) + return castArg + } + + @Throws(ValidationException::class) + fun validate(arg: LocalDate, configuration: SchemaConfiguration?): String { + return validate(arg.toString(), configuration) + } + + @Throws(ValidationException::class) + fun validate(arg: ZonedDateTime, configuration: SchemaConfiguration?): String { + return validate(arg.toString(), configuration) + } + + @Throws(ValidationException::class) + fun validate(arg: UUID, configuration: SchemaConfiguration?): String { + return validate(arg.toString(), configuration) + } + + override fun getNewInstance(arg: List<*>, pathToItem: List, pathToSchemas: PathToSchemasMap): FrozenList { + val items: MutableList = ArrayList() + var i: Int = 0 + for (item: Any? in arg) { + val itemPathToItem = pathToItem + i + val schemas: LinkedHashMap, Nothing?>? = pathToSchemas.get(itemPathToItem) + if (schemas == null) { + throw RuntimeException("Validation result is invalid, schemas must exist for a pathToItem") + } + val itemSchema: JsonSchema<*> = schemas.entries.iterator().next().key + val itemInstance: Any? = itemSchema.getNewInstance(item, itemPathToItem, pathToSchemas) + items.add(itemInstance) + i += 1 + } + val newInstanceItems: FrozenList = FrozenList(items) + return newInstanceItems + } + + @Throws(ValidationException::class) + override fun validate(arg: List<*>, configuration: SchemaConfiguration?): FrozenList { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, PathToSchemasMap(), LinkedHashSet()) + val pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet) + return getNewInstance(castArg, validationMetadata.pathToItem, pathToSchemasMap) + } + + override fun getNewInstance(arg: Map<*, *>, pathToItem: List, pathToSchemas: PathToSchemasMap): FrozenMap { + val properties: LinkedHashMap = LinkedHashMap() + for((propertyName, value) in arg) { + if (!(propertyName is String)) { + throw RuntimeException("Invalid non-string key value") + } + val propertyPathToItem: List = pathToItem + propertyName + val schemas: LinkedHashMap, Nothing?>? = pathToSchemas.get(propertyPathToItem) + if (schemas == null) { + throw RuntimeException("Validation result is invalid, schemas must exist for a pathToItem") + } + val propertySchema: JsonSchema<*> = schemas.entries.iterator().next().key + val propertyInstance: Any? = propertySchema.getNewInstance(value, propertyPathToItem, pathToSchemas) + properties[propertyName] = propertyInstance + } + val castProperties: FrozenMap = FrozenMap(properties) + return castProperties + } + + @Throws(ValidationException::class) + override fun validate(arg: Map<*, *>, configuration: SchemaConfiguration?): FrozenMap { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validatedPathToSchemas = PathToSchemasMap() + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, LinkedHashSet()) + val pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet) + return getNewInstance(castArg, validationMetadata.pathToItem, pathToSchemasMap) + } + + @Throws(ValidationException::class) + override fun validate(arg: Any?, configuration: SchemaConfiguration?): Any? { + if (arg == null) { + return validate(null, configuration) + } else if (arg is Boolean) { + return validate(arg, configuration) + } else if (arg is Number) { + return validate(arg, configuration) + } else if (arg is String) { + return validate(arg, configuration) + } else if (arg is List<*>) { + return validate(arg, configuration) + } else if (arg is Map<*, *>) { + return validate(arg, configuration) + } + throw ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema") + } + override fun getNewInstance(arg: Any?, pathToItem: List, pathToSchemas: PathToSchemasMap): Any? { + if (arg == null) { + return getNewInstance( null, pathToItem, pathToSchemas) + } else if (arg is Boolean) { + return getNewInstance(arg, pathToItem, pathToSchemas) + } else if (arg is Number) { + return getNewInstance(arg, pathToItem, pathToSchemas) + } else if (arg is String) { + return getNewInstance(arg, pathToItem, pathToSchemas) + } else if (arg is List<*>) { + return getNewInstance(arg, pathToItem, pathToSchemas) + } else if (arg is Map<*, *>) { + return getNewInstance(arg, pathToItem, pathToSchemas) + } + throw RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema") + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: Nothing?, configuration: SchemaConfiguration?): MinlengthValidation1BoxedVoid { + return MinlengthValidation1BoxedVoid(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: Boolean, configuration: SchemaConfiguration?): MinlengthValidation1BoxedBoolean { + return MinlengthValidation1BoxedBoolean(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: Number, configuration: SchemaConfiguration?): MinlengthValidation1BoxedNumber { + return MinlengthValidation1BoxedNumber(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: String, configuration: SchemaConfiguration?): MinlengthValidation1BoxedString { + return MinlengthValidation1BoxedString(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: List<*>, configuration: SchemaConfiguration?): MinlengthValidation1BoxedList { + return MinlengthValidation1BoxedList(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: Map<*, *>, configuration: SchemaConfiguration?): MinlengthValidation1BoxedMap { + return MinlengthValidation1BoxedMap(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: Any?, configuration: SchemaConfiguration?): MinlengthValidation1Boxed { + if (arg == null) { + return validateAndBox(null, configuration) + } else if (arg is Boolean) { + return validateAndBox(arg, configuration) + } else if (arg is String) { + return validateAndBox(arg, configuration) + } else if (arg is Number) { + return validateAndBox(arg, configuration) + } else if (arg is List<*>) { + return validateAndBox(arg, configuration) + } else if (arg is Map<*, *>) { + return validateAndBox(arg, configuration) + } + throw ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema") + } + } +} diff --git a/samples/client/3_0_3_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/schemas/MinpropertiesValidation.kt b/samples/client/3_0_3_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/schemas/MinpropertiesValidation.kt new file mode 100644 index 00000000000..bb29435be31 --- /dev/null +++ b/samples/client/3_0_3_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/schemas/MinpropertiesValidation.kt @@ -0,0 +1,308 @@ +package org.openapijsonschematools.client.components.schemas +import java.time.LocalDate +import java.time.ZonedDateTime +import java.util.UUID +import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags +import org.openapijsonschematools.client.configurations.SchemaConfiguration +import org.openapijsonschematools.client.exceptions.InvalidAdditionalPropertyException +import org.openapijsonschematools.client.exceptions.UnsetPropertyException +import org.openapijsonschematools.client.exceptions.ValidationException +import org.openapijsonschematools.client.schemas.UnsetAddPropsSetter +import org.openapijsonschematools.client.schemas.validation.BooleanSchemaValidator +import org.openapijsonschematools.client.schemas.validation.FrozenList +import org.openapijsonschematools.client.schemas.validation.FrozenMap +import org.openapijsonschematools.client.schemas.validation.JsonSchema +import org.openapijsonschematools.client.schemas.validation.JsonSchemaInfo +import org.openapijsonschematools.client.schemas.validation.ListSchemaValidator +import org.openapijsonschematools.client.schemas.validation.MapSchemaValidator +import org.openapijsonschematools.client.schemas.validation.NullSchemaValidator +import org.openapijsonschematools.client.schemas.validation.NumberSchemaValidator +import org.openapijsonschematools.client.schemas.validation.PathToSchemasMap +import org.openapijsonschematools.client.schemas.validation.StringSchemaValidator +import org.openapijsonschematools.client.schemas.validation.ValidationMetadata + +class MinpropertiesValidation { + // nest classes so all schemas and input/output classes can be public + + + sealed interface MinpropertiesValidation1Boxed { + fun getData(): Any? + } + + data class MinpropertiesValidation1BoxedVoid(val data: Nothing?) : MinpropertiesValidation1Boxed { + override fun getData(): Any? { + return data + } + } + + data class MinpropertiesValidation1BoxedBoolean(val data: Boolean): MinpropertiesValidation1Boxed { + override fun getData(): Any? { + return data + } + } + + data class MinpropertiesValidation1BoxedNumber(val data: Number) : MinpropertiesValidation1Boxed { + override fun getData(): Any? { + return data + } + } + + data class MinpropertiesValidation1BoxedString(val data: String) : MinpropertiesValidation1Boxed { + override fun getData(): Any? { + return data + } + } + + data class MinpropertiesValidation1BoxedList(val data: FrozenList) : MinpropertiesValidation1Boxed { + override fun getData(): Any? { + return data + } + } + + data class MinpropertiesValidation1BoxedMap(val data: FrozenMap) : MinpropertiesValidation1Boxed { + override fun getData(): Any? { + return data + } + } + + + class MinpropertiesValidation1 private constructor(): JsonSchema( + JsonSchemaInfo() + .minProperties(1) + ), NullSchemaValidator, BooleanSchemaValidator, NumberSchemaValidator, StringSchemaValidator, ListSchemaValidator, MinpropertiesValidation1BoxedList>, MapSchemaValidator, MinpropertiesValidation1BoxedMap> { + /* + NOTE: This class is auto generated by OpenAPI JSON Schema Generator. + Ref: https://github.com/openapi-json-schema-tools/openapi-json-schema-generator + + Do not edit the class manually. + */ + + companion object { + @Volatile + private var instance: MinpropertiesValidation1? = null + + fun getInstance() = + instance ?: synchronized(this) { + instance ?: MinpropertiesValidation1().also { instance = it } + } + } + + @Throws(ValidationException::class) + override fun validate(arg: Nothing?, configuration: SchemaConfiguration?): Nothing? { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validatedPathToSchemas = PathToSchemasMap() + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, LinkedHashSet()) + getPathToSchemas(this, castArg, validationMetadata, pathSet) + return castArg + } + + @Throws(ValidationException::class) + override fun validate(arg: Boolean, configuration: SchemaConfiguration?): Boolean { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validatedPathToSchemas = PathToSchemasMap() + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, LinkedHashSet()) + getPathToSchemas(this, castArg, validationMetadata, pathSet) + return castArg + } + + @Throws(ValidationException::class) + override fun validate(arg: Number, configuration: SchemaConfiguration?): Number { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validatedPathToSchemas = PathToSchemasMap() + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, LinkedHashSet()) + getPathToSchemas(this, castArg, validationMetadata, pathSet) + return castArg + } + + @Throws(ValidationException::class) + fun validate(arg: Int, configuration: SchemaConfiguration?): Int { + return validate(arg as Number, configuration) as Int + } + + @Throws(ValidationException::class) + fun validate(arg: Long, configuration: SchemaConfiguration?): Long { + return validate(arg as Number, configuration) as Long + } + + @Throws(ValidationException::class) + fun validate(arg: Float, configuration: SchemaConfiguration?): Float { + return validate(arg as Number, configuration) as Float + } + + @Throws(ValidationException::class) + fun validate(arg: Double, configuration: SchemaConfiguration?): Double { + return validate(arg as Number, configuration) as Double + } + + @Throws(ValidationException::class) + override fun validate(arg: String, configuration: SchemaConfiguration?): String { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validatedPathToSchemas = PathToSchemasMap() + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, LinkedHashSet()) + getPathToSchemas(this, castArg, validationMetadata, pathSet) + return castArg + } + + @Throws(ValidationException::class) + fun validate(arg: LocalDate, configuration: SchemaConfiguration?): String { + return validate(arg.toString(), configuration) + } + + @Throws(ValidationException::class) + fun validate(arg: ZonedDateTime, configuration: SchemaConfiguration?): String { + return validate(arg.toString(), configuration) + } + + @Throws(ValidationException::class) + fun validate(arg: UUID, configuration: SchemaConfiguration?): String { + return validate(arg.toString(), configuration) + } + + override fun getNewInstance(arg: List<*>, pathToItem: List, pathToSchemas: PathToSchemasMap): FrozenList { + val items: MutableList = ArrayList() + var i: Int = 0 + for (item: Any? in arg) { + val itemPathToItem = pathToItem + i + val schemas: LinkedHashMap, Nothing?>? = pathToSchemas.get(itemPathToItem) + if (schemas == null) { + throw RuntimeException("Validation result is invalid, schemas must exist for a pathToItem") + } + val itemSchema: JsonSchema<*> = schemas.entries.iterator().next().key + val itemInstance: Any? = itemSchema.getNewInstance(item, itemPathToItem, pathToSchemas) + items.add(itemInstance) + i += 1 + } + val newInstanceItems: FrozenList = FrozenList(items) + return newInstanceItems + } + + @Throws(ValidationException::class) + override fun validate(arg: List<*>, configuration: SchemaConfiguration?): FrozenList { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, PathToSchemasMap(), LinkedHashSet()) + val pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet) + return getNewInstance(castArg, validationMetadata.pathToItem, pathToSchemasMap) + } + + override fun getNewInstance(arg: Map<*, *>, pathToItem: List, pathToSchemas: PathToSchemasMap): FrozenMap { + val properties: LinkedHashMap = LinkedHashMap() + for((propertyName, value) in arg) { + if (!(propertyName is String)) { + throw RuntimeException("Invalid non-string key value") + } + val propertyPathToItem: List = pathToItem + propertyName + val schemas: LinkedHashMap, Nothing?>? = pathToSchemas.get(propertyPathToItem) + if (schemas == null) { + throw RuntimeException("Validation result is invalid, schemas must exist for a pathToItem") + } + val propertySchema: JsonSchema<*> = schemas.entries.iterator().next().key + val propertyInstance: Any? = propertySchema.getNewInstance(value, propertyPathToItem, pathToSchemas) + properties[propertyName] = propertyInstance + } + val castProperties: FrozenMap = FrozenMap(properties) + return castProperties + } + + @Throws(ValidationException::class) + override fun validate(arg: Map<*, *>, configuration: SchemaConfiguration?): FrozenMap { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validatedPathToSchemas = PathToSchemasMap() + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, LinkedHashSet()) + val pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet) + return getNewInstance(castArg, validationMetadata.pathToItem, pathToSchemasMap) + } + + @Throws(ValidationException::class) + override fun validate(arg: Any?, configuration: SchemaConfiguration?): Any? { + if (arg == null) { + return validate(null, configuration) + } else if (arg is Boolean) { + return validate(arg, configuration) + } else if (arg is Number) { + return validate(arg, configuration) + } else if (arg is String) { + return validate(arg, configuration) + } else if (arg is List<*>) { + return validate(arg, configuration) + } else if (arg is Map<*, *>) { + return validate(arg, configuration) + } + throw ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema") + } + override fun getNewInstance(arg: Any?, pathToItem: List, pathToSchemas: PathToSchemasMap): Any? { + if (arg == null) { + return getNewInstance( null, pathToItem, pathToSchemas) + } else if (arg is Boolean) { + return getNewInstance(arg, pathToItem, pathToSchemas) + } else if (arg is Number) { + return getNewInstance(arg, pathToItem, pathToSchemas) + } else if (arg is String) { + return getNewInstance(arg, pathToItem, pathToSchemas) + } else if (arg is List<*>) { + return getNewInstance(arg, pathToItem, pathToSchemas) + } else if (arg is Map<*, *>) { + return getNewInstance(arg, pathToItem, pathToSchemas) + } + throw RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema") + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: Nothing?, configuration: SchemaConfiguration?): MinpropertiesValidation1BoxedVoid { + return MinpropertiesValidation1BoxedVoid(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: Boolean, configuration: SchemaConfiguration?): MinpropertiesValidation1BoxedBoolean { + return MinpropertiesValidation1BoxedBoolean(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: Number, configuration: SchemaConfiguration?): MinpropertiesValidation1BoxedNumber { + return MinpropertiesValidation1BoxedNumber(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: String, configuration: SchemaConfiguration?): MinpropertiesValidation1BoxedString { + return MinpropertiesValidation1BoxedString(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: List<*>, configuration: SchemaConfiguration?): MinpropertiesValidation1BoxedList { + return MinpropertiesValidation1BoxedList(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: Map<*, *>, configuration: SchemaConfiguration?): MinpropertiesValidation1BoxedMap { + return MinpropertiesValidation1BoxedMap(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: Any?, configuration: SchemaConfiguration?): MinpropertiesValidation1Boxed { + if (arg == null) { + return validateAndBox(null, configuration) + } else if (arg is Boolean) { + return validateAndBox(arg, configuration) + } else if (arg is String) { + return validateAndBox(arg, configuration) + } else if (arg is Number) { + return validateAndBox(arg, configuration) + } else if (arg is List<*>) { + return validateAndBox(arg, configuration) + } else if (arg is Map<*, *>) { + return validateAndBox(arg, configuration) + } + throw ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema") + } + } +} diff --git a/samples/client/3_0_3_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/schemas/NestedAllofToCheckValidationSemantics.kt b/samples/client/3_0_3_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/schemas/NestedAllofToCheckValidationSemantics.kt new file mode 100644 index 00000000000..d2e2c14ae94 --- /dev/null +++ b/samples/client/3_0_3_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/schemas/NestedAllofToCheckValidationSemantics.kt @@ -0,0 +1,601 @@ +package org.openapijsonschematools.client.components.schemas +import java.time.LocalDate +import java.time.ZonedDateTime +import java.util.UUID +import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags +import org.openapijsonschematools.client.configurations.SchemaConfiguration +import org.openapijsonschematools.client.exceptions.InvalidAdditionalPropertyException +import org.openapijsonschematools.client.exceptions.UnsetPropertyException +import org.openapijsonschematools.client.exceptions.ValidationException +import org.openapijsonschematools.client.schemas.NullJsonSchema +import org.openapijsonschematools.client.schemas.UnsetAddPropsSetter +import org.openapijsonschematools.client.schemas.validation.BooleanSchemaValidator +import org.openapijsonschematools.client.schemas.validation.FrozenList +import org.openapijsonschematools.client.schemas.validation.FrozenMap +import org.openapijsonschematools.client.schemas.validation.JsonSchema +import org.openapijsonschematools.client.schemas.validation.JsonSchemaInfo +import org.openapijsonschematools.client.schemas.validation.ListSchemaValidator +import org.openapijsonschematools.client.schemas.validation.MapSchemaValidator +import org.openapijsonschematools.client.schemas.validation.NullSchemaValidator +import org.openapijsonschematools.client.schemas.validation.NumberSchemaValidator +import org.openapijsonschematools.client.schemas.validation.PathToSchemasMap +import org.openapijsonschematools.client.schemas.validation.StringSchemaValidator +import org.openapijsonschematools.client.schemas.validation.ValidationMetadata + +class NestedAllofToCheckValidationSemantics { + // nest classes so all schemas and input/output classes can be public + + + class Schema01 : NullJsonSchema.NullJsonSchema1() { + companion object { + @Volatile + private var instance: Schema01? = null + + fun getInstance() = + instance ?: synchronized(this) { + instance ?: Schema01().also { instance = it } + } + } + } + + + sealed interface Schema0Boxed { + fun getData(): Any? + } + + data class Schema0BoxedVoid(val data: Nothing?) : Schema0Boxed { + override fun getData(): Any? { + return data + } + } + + data class Schema0BoxedBoolean(val data: Boolean): Schema0Boxed { + override fun getData(): Any? { + return data + } + } + + data class Schema0BoxedNumber(val data: Number) : Schema0Boxed { + override fun getData(): Any? { + return data + } + } + + data class Schema0BoxedString(val data: String) : Schema0Boxed { + override fun getData(): Any? { + return data + } + } + + data class Schema0BoxedList(val data: FrozenList) : Schema0Boxed { + override fun getData(): Any? { + return data + } + } + + data class Schema0BoxedMap(val data: FrozenMap) : Schema0Boxed { + override fun getData(): Any? { + return data + } + } + + + class Schema0 private constructor(): JsonSchema( + JsonSchemaInfo() + .allOf(listOf( + Schema01::class.java + )) + ), NullSchemaValidator, BooleanSchemaValidator, NumberSchemaValidator, StringSchemaValidator, ListSchemaValidator, Schema0BoxedList>, MapSchemaValidator, Schema0BoxedMap> { + + companion object { + @Volatile + private var instance: Schema0? = null + + fun getInstance() = + instance ?: synchronized(this) { + instance ?: Schema0().also { instance = it } + } + } + + @Throws(ValidationException::class) + override fun validate(arg: Nothing?, configuration: SchemaConfiguration?): Nothing? { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validatedPathToSchemas = PathToSchemasMap() + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, LinkedHashSet()) + getPathToSchemas(this, castArg, validationMetadata, pathSet) + return castArg + } + + @Throws(ValidationException::class) + override fun validate(arg: Boolean, configuration: SchemaConfiguration?): Boolean { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validatedPathToSchemas = PathToSchemasMap() + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, LinkedHashSet()) + getPathToSchemas(this, castArg, validationMetadata, pathSet) + return castArg + } + + @Throws(ValidationException::class) + override fun validate(arg: Number, configuration: SchemaConfiguration?): Number { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validatedPathToSchemas = PathToSchemasMap() + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, LinkedHashSet()) + getPathToSchemas(this, castArg, validationMetadata, pathSet) + return castArg + } + + @Throws(ValidationException::class) + fun validate(arg: Int, configuration: SchemaConfiguration?): Int { + return validate(arg as Number, configuration) as Int + } + + @Throws(ValidationException::class) + fun validate(arg: Long, configuration: SchemaConfiguration?): Long { + return validate(arg as Number, configuration) as Long + } + + @Throws(ValidationException::class) + fun validate(arg: Float, configuration: SchemaConfiguration?): Float { + return validate(arg as Number, configuration) as Float + } + + @Throws(ValidationException::class) + fun validate(arg: Double, configuration: SchemaConfiguration?): Double { + return validate(arg as Number, configuration) as Double + } + + @Throws(ValidationException::class) + override fun validate(arg: String, configuration: SchemaConfiguration?): String { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validatedPathToSchemas = PathToSchemasMap() + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, LinkedHashSet()) + getPathToSchemas(this, castArg, validationMetadata, pathSet) + return castArg + } + + @Throws(ValidationException::class) + fun validate(arg: LocalDate, configuration: SchemaConfiguration?): String { + return validate(arg.toString(), configuration) + } + + @Throws(ValidationException::class) + fun validate(arg: ZonedDateTime, configuration: SchemaConfiguration?): String { + return validate(arg.toString(), configuration) + } + + @Throws(ValidationException::class) + fun validate(arg: UUID, configuration: SchemaConfiguration?): String { + return validate(arg.toString(), configuration) + } + + override fun getNewInstance(arg: List<*>, pathToItem: List, pathToSchemas: PathToSchemasMap): FrozenList { + val items: MutableList = ArrayList() + var i: Int = 0 + for (item: Any? in arg) { + val itemPathToItem = pathToItem + i + val schemas: LinkedHashMap, Nothing?>? = pathToSchemas.get(itemPathToItem) + if (schemas == null) { + throw RuntimeException("Validation result is invalid, schemas must exist for a pathToItem") + } + val itemSchema: JsonSchema<*> = schemas.entries.iterator().next().key + val itemInstance: Any? = itemSchema.getNewInstance(item, itemPathToItem, pathToSchemas) + items.add(itemInstance) + i += 1 + } + val newInstanceItems: FrozenList = FrozenList(items) + return newInstanceItems + } + + @Throws(ValidationException::class) + override fun validate(arg: List<*>, configuration: SchemaConfiguration?): FrozenList { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, PathToSchemasMap(), LinkedHashSet()) + val pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet) + return getNewInstance(castArg, validationMetadata.pathToItem, pathToSchemasMap) + } + + override fun getNewInstance(arg: Map<*, *>, pathToItem: List, pathToSchemas: PathToSchemasMap): FrozenMap { + val properties: LinkedHashMap = LinkedHashMap() + for((propertyName, value) in arg) { + if (!(propertyName is String)) { + throw RuntimeException("Invalid non-string key value") + } + val propertyPathToItem: List = pathToItem + propertyName + val schemas: LinkedHashMap, Nothing?>? = pathToSchemas.get(propertyPathToItem) + if (schemas == null) { + throw RuntimeException("Validation result is invalid, schemas must exist for a pathToItem") + } + val propertySchema: JsonSchema<*> = schemas.entries.iterator().next().key + val propertyInstance: Any? = propertySchema.getNewInstance(value, propertyPathToItem, pathToSchemas) + properties[propertyName] = propertyInstance + } + val castProperties: FrozenMap = FrozenMap(properties) + return castProperties + } + + @Throws(ValidationException::class) + override fun validate(arg: Map<*, *>, configuration: SchemaConfiguration?): FrozenMap { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validatedPathToSchemas = PathToSchemasMap() + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, LinkedHashSet()) + val pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet) + return getNewInstance(castArg, validationMetadata.pathToItem, pathToSchemasMap) + } + + @Throws(ValidationException::class) + override fun validate(arg: Any?, configuration: SchemaConfiguration?): Any? { + if (arg == null) { + return validate(null, configuration) + } else if (arg is Boolean) { + return validate(arg, configuration) + } else if (arg is Number) { + return validate(arg, configuration) + } else if (arg is String) { + return validate(arg, configuration) + } else if (arg is List<*>) { + return validate(arg, configuration) + } else if (arg is Map<*, *>) { + return validate(arg, configuration) + } + throw ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema") + } + override fun getNewInstance(arg: Any?, pathToItem: List, pathToSchemas: PathToSchemasMap): Any? { + if (arg == null) { + return getNewInstance( null, pathToItem, pathToSchemas) + } else if (arg is Boolean) { + return getNewInstance(arg, pathToItem, pathToSchemas) + } else if (arg is Number) { + return getNewInstance(arg, pathToItem, pathToSchemas) + } else if (arg is String) { + return getNewInstance(arg, pathToItem, pathToSchemas) + } else if (arg is List<*>) { + return getNewInstance(arg, pathToItem, pathToSchemas) + } else if (arg is Map<*, *>) { + return getNewInstance(arg, pathToItem, pathToSchemas) + } + throw RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema") + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: Nothing?, configuration: SchemaConfiguration?): Schema0BoxedVoid { + return Schema0BoxedVoid(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: Boolean, configuration: SchemaConfiguration?): Schema0BoxedBoolean { + return Schema0BoxedBoolean(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: Number, configuration: SchemaConfiguration?): Schema0BoxedNumber { + return Schema0BoxedNumber(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: String, configuration: SchemaConfiguration?): Schema0BoxedString { + return Schema0BoxedString(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: List<*>, configuration: SchemaConfiguration?): Schema0BoxedList { + return Schema0BoxedList(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: Map<*, *>, configuration: SchemaConfiguration?): Schema0BoxedMap { + return Schema0BoxedMap(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: Any?, configuration: SchemaConfiguration?): Schema0Boxed { + if (arg == null) { + return validateAndBox(null, configuration) + } else if (arg is Boolean) { + return validateAndBox(arg, configuration) + } else if (arg is String) { + return validateAndBox(arg, configuration) + } else if (arg is Number) { + return validateAndBox(arg, configuration) + } else if (arg is List<*>) { + return validateAndBox(arg, configuration) + } else if (arg is Map<*, *>) { + return validateAndBox(arg, configuration) + } + throw ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema") + } + } + + sealed interface NestedAllofToCheckValidationSemantics1Boxed { + fun getData(): Any? + } + + data class NestedAllofToCheckValidationSemantics1BoxedVoid(val data: Nothing?) : NestedAllofToCheckValidationSemantics1Boxed { + override fun getData(): Any? { + return data + } + } + + data class NestedAllofToCheckValidationSemantics1BoxedBoolean(val data: Boolean): NestedAllofToCheckValidationSemantics1Boxed { + override fun getData(): Any? { + return data + } + } + + data class NestedAllofToCheckValidationSemantics1BoxedNumber(val data: Number) : NestedAllofToCheckValidationSemantics1Boxed { + override fun getData(): Any? { + return data + } + } + + data class NestedAllofToCheckValidationSemantics1BoxedString(val data: String) : NestedAllofToCheckValidationSemantics1Boxed { + override fun getData(): Any? { + return data + } + } + + data class NestedAllofToCheckValidationSemantics1BoxedList(val data: FrozenList) : NestedAllofToCheckValidationSemantics1Boxed { + override fun getData(): Any? { + return data + } + } + + data class NestedAllofToCheckValidationSemantics1BoxedMap(val data: FrozenMap) : NestedAllofToCheckValidationSemantics1Boxed { + override fun getData(): Any? { + return data + } + } + + + class NestedAllofToCheckValidationSemantics1 private constructor(): JsonSchema( + JsonSchemaInfo() + .allOf(listOf( + Schema0::class.java + )) + ), NullSchemaValidator, BooleanSchemaValidator, NumberSchemaValidator, StringSchemaValidator, ListSchemaValidator, NestedAllofToCheckValidationSemantics1BoxedList>, MapSchemaValidator, NestedAllofToCheckValidationSemantics1BoxedMap> { + /* + NOTE: This class is auto generated by OpenAPI JSON Schema Generator. + Ref: https://github.com/openapi-json-schema-tools/openapi-json-schema-generator + + Do not edit the class manually. + */ + + companion object { + @Volatile + private var instance: NestedAllofToCheckValidationSemantics1? = null + + fun getInstance() = + instance ?: synchronized(this) { + instance ?: NestedAllofToCheckValidationSemantics1().also { instance = it } + } + } + + @Throws(ValidationException::class) + override fun validate(arg: Nothing?, configuration: SchemaConfiguration?): Nothing? { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validatedPathToSchemas = PathToSchemasMap() + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, LinkedHashSet()) + getPathToSchemas(this, castArg, validationMetadata, pathSet) + return castArg + } + + @Throws(ValidationException::class) + override fun validate(arg: Boolean, configuration: SchemaConfiguration?): Boolean { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validatedPathToSchemas = PathToSchemasMap() + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, LinkedHashSet()) + getPathToSchemas(this, castArg, validationMetadata, pathSet) + return castArg + } + + @Throws(ValidationException::class) + override fun validate(arg: Number, configuration: SchemaConfiguration?): Number { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validatedPathToSchemas = PathToSchemasMap() + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, LinkedHashSet()) + getPathToSchemas(this, castArg, validationMetadata, pathSet) + return castArg + } + + @Throws(ValidationException::class) + fun validate(arg: Int, configuration: SchemaConfiguration?): Int { + return validate(arg as Number, configuration) as Int + } + + @Throws(ValidationException::class) + fun validate(arg: Long, configuration: SchemaConfiguration?): Long { + return validate(arg as Number, configuration) as Long + } + + @Throws(ValidationException::class) + fun validate(arg: Float, configuration: SchemaConfiguration?): Float { + return validate(arg as Number, configuration) as Float + } + + @Throws(ValidationException::class) + fun validate(arg: Double, configuration: SchemaConfiguration?): Double { + return validate(arg as Number, configuration) as Double + } + + @Throws(ValidationException::class) + override fun validate(arg: String, configuration: SchemaConfiguration?): String { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validatedPathToSchemas = PathToSchemasMap() + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, LinkedHashSet()) + getPathToSchemas(this, castArg, validationMetadata, pathSet) + return castArg + } + + @Throws(ValidationException::class) + fun validate(arg: LocalDate, configuration: SchemaConfiguration?): String { + return validate(arg.toString(), configuration) + } + + @Throws(ValidationException::class) + fun validate(arg: ZonedDateTime, configuration: SchemaConfiguration?): String { + return validate(arg.toString(), configuration) + } + + @Throws(ValidationException::class) + fun validate(arg: UUID, configuration: SchemaConfiguration?): String { + return validate(arg.toString(), configuration) + } + + override fun getNewInstance(arg: List<*>, pathToItem: List, pathToSchemas: PathToSchemasMap): FrozenList { + val items: MutableList = ArrayList() + var i: Int = 0 + for (item: Any? in arg) { + val itemPathToItem = pathToItem + i + val schemas: LinkedHashMap, Nothing?>? = pathToSchemas.get(itemPathToItem) + if (schemas == null) { + throw RuntimeException("Validation result is invalid, schemas must exist for a pathToItem") + } + val itemSchema: JsonSchema<*> = schemas.entries.iterator().next().key + val itemInstance: Any? = itemSchema.getNewInstance(item, itemPathToItem, pathToSchemas) + items.add(itemInstance) + i += 1 + } + val newInstanceItems: FrozenList = FrozenList(items) + return newInstanceItems + } + + @Throws(ValidationException::class) + override fun validate(arg: List<*>, configuration: SchemaConfiguration?): FrozenList { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, PathToSchemasMap(), LinkedHashSet()) + val pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet) + return getNewInstance(castArg, validationMetadata.pathToItem, pathToSchemasMap) + } + + override fun getNewInstance(arg: Map<*, *>, pathToItem: List, pathToSchemas: PathToSchemasMap): FrozenMap { + val properties: LinkedHashMap = LinkedHashMap() + for((propertyName, value) in arg) { + if (!(propertyName is String)) { + throw RuntimeException("Invalid non-string key value") + } + val propertyPathToItem: List = pathToItem + propertyName + val schemas: LinkedHashMap, Nothing?>? = pathToSchemas.get(propertyPathToItem) + if (schemas == null) { + throw RuntimeException("Validation result is invalid, schemas must exist for a pathToItem") + } + val propertySchema: JsonSchema<*> = schemas.entries.iterator().next().key + val propertyInstance: Any? = propertySchema.getNewInstance(value, propertyPathToItem, pathToSchemas) + properties[propertyName] = propertyInstance + } + val castProperties: FrozenMap = FrozenMap(properties) + return castProperties + } + + @Throws(ValidationException::class) + override fun validate(arg: Map<*, *>, configuration: SchemaConfiguration?): FrozenMap { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validatedPathToSchemas = PathToSchemasMap() + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, LinkedHashSet()) + val pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet) + return getNewInstance(castArg, validationMetadata.pathToItem, pathToSchemasMap) + } + + @Throws(ValidationException::class) + override fun validate(arg: Any?, configuration: SchemaConfiguration?): Any? { + if (arg == null) { + return validate(null, configuration) + } else if (arg is Boolean) { + return validate(arg, configuration) + } else if (arg is Number) { + return validate(arg, configuration) + } else if (arg is String) { + return validate(arg, configuration) + } else if (arg is List<*>) { + return validate(arg, configuration) + } else if (arg is Map<*, *>) { + return validate(arg, configuration) + } + throw ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema") + } + override fun getNewInstance(arg: Any?, pathToItem: List, pathToSchemas: PathToSchemasMap): Any? { + if (arg == null) { + return getNewInstance( null, pathToItem, pathToSchemas) + } else if (arg is Boolean) { + return getNewInstance(arg, pathToItem, pathToSchemas) + } else if (arg is Number) { + return getNewInstance(arg, pathToItem, pathToSchemas) + } else if (arg is String) { + return getNewInstance(arg, pathToItem, pathToSchemas) + } else if (arg is List<*>) { + return getNewInstance(arg, pathToItem, pathToSchemas) + } else if (arg is Map<*, *>) { + return getNewInstance(arg, pathToItem, pathToSchemas) + } + throw RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema") + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: Nothing?, configuration: SchemaConfiguration?): NestedAllofToCheckValidationSemantics1BoxedVoid { + return NestedAllofToCheckValidationSemantics1BoxedVoid(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: Boolean, configuration: SchemaConfiguration?): NestedAllofToCheckValidationSemantics1BoxedBoolean { + return NestedAllofToCheckValidationSemantics1BoxedBoolean(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: Number, configuration: SchemaConfiguration?): NestedAllofToCheckValidationSemantics1BoxedNumber { + return NestedAllofToCheckValidationSemantics1BoxedNumber(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: String, configuration: SchemaConfiguration?): NestedAllofToCheckValidationSemantics1BoxedString { + return NestedAllofToCheckValidationSemantics1BoxedString(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: List<*>, configuration: SchemaConfiguration?): NestedAllofToCheckValidationSemantics1BoxedList { + return NestedAllofToCheckValidationSemantics1BoxedList(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: Map<*, *>, configuration: SchemaConfiguration?): NestedAllofToCheckValidationSemantics1BoxedMap { + return NestedAllofToCheckValidationSemantics1BoxedMap(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: Any?, configuration: SchemaConfiguration?): NestedAllofToCheckValidationSemantics1Boxed { + if (arg == null) { + return validateAndBox(null, configuration) + } else if (arg is Boolean) { + return validateAndBox(arg, configuration) + } else if (arg is String) { + return validateAndBox(arg, configuration) + } else if (arg is Number) { + return validateAndBox(arg, configuration) + } else if (arg is List<*>) { + return validateAndBox(arg, configuration) + } else if (arg is Map<*, *>) { + return validateAndBox(arg, configuration) + } + throw ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema") + } + } +} diff --git a/samples/client/3_0_3_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/schemas/NestedAnyofToCheckValidationSemantics.kt b/samples/client/3_0_3_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/schemas/NestedAnyofToCheckValidationSemantics.kt new file mode 100644 index 00000000000..df6ba63b7b6 --- /dev/null +++ b/samples/client/3_0_3_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/schemas/NestedAnyofToCheckValidationSemantics.kt @@ -0,0 +1,601 @@ +package org.openapijsonschematools.client.components.schemas +import java.time.LocalDate +import java.time.ZonedDateTime +import java.util.UUID +import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags +import org.openapijsonschematools.client.configurations.SchemaConfiguration +import org.openapijsonschematools.client.exceptions.InvalidAdditionalPropertyException +import org.openapijsonschematools.client.exceptions.UnsetPropertyException +import org.openapijsonschematools.client.exceptions.ValidationException +import org.openapijsonschematools.client.schemas.NullJsonSchema +import org.openapijsonschematools.client.schemas.UnsetAddPropsSetter +import org.openapijsonschematools.client.schemas.validation.BooleanSchemaValidator +import org.openapijsonschematools.client.schemas.validation.FrozenList +import org.openapijsonschematools.client.schemas.validation.FrozenMap +import org.openapijsonschematools.client.schemas.validation.JsonSchema +import org.openapijsonschematools.client.schemas.validation.JsonSchemaInfo +import org.openapijsonschematools.client.schemas.validation.ListSchemaValidator +import org.openapijsonschematools.client.schemas.validation.MapSchemaValidator +import org.openapijsonschematools.client.schemas.validation.NullSchemaValidator +import org.openapijsonschematools.client.schemas.validation.NumberSchemaValidator +import org.openapijsonschematools.client.schemas.validation.PathToSchemasMap +import org.openapijsonschematools.client.schemas.validation.StringSchemaValidator +import org.openapijsonschematools.client.schemas.validation.ValidationMetadata + +class NestedAnyofToCheckValidationSemantics { + // nest classes so all schemas and input/output classes can be public + + + class Schema01 : NullJsonSchema.NullJsonSchema1() { + companion object { + @Volatile + private var instance: Schema01? = null + + fun getInstance() = + instance ?: synchronized(this) { + instance ?: Schema01().also { instance = it } + } + } + } + + + sealed interface Schema0Boxed { + fun getData(): Any? + } + + data class Schema0BoxedVoid(val data: Nothing?) : Schema0Boxed { + override fun getData(): Any? { + return data + } + } + + data class Schema0BoxedBoolean(val data: Boolean): Schema0Boxed { + override fun getData(): Any? { + return data + } + } + + data class Schema0BoxedNumber(val data: Number) : Schema0Boxed { + override fun getData(): Any? { + return data + } + } + + data class Schema0BoxedString(val data: String) : Schema0Boxed { + override fun getData(): Any? { + return data + } + } + + data class Schema0BoxedList(val data: FrozenList) : Schema0Boxed { + override fun getData(): Any? { + return data + } + } + + data class Schema0BoxedMap(val data: FrozenMap) : Schema0Boxed { + override fun getData(): Any? { + return data + } + } + + + class Schema0 private constructor(): JsonSchema( + JsonSchemaInfo() + .anyOf(listOf( + Schema01::class.java + )) + ), NullSchemaValidator, BooleanSchemaValidator, NumberSchemaValidator, StringSchemaValidator, ListSchemaValidator, Schema0BoxedList>, MapSchemaValidator, Schema0BoxedMap> { + + companion object { + @Volatile + private var instance: Schema0? = null + + fun getInstance() = + instance ?: synchronized(this) { + instance ?: Schema0().also { instance = it } + } + } + + @Throws(ValidationException::class) + override fun validate(arg: Nothing?, configuration: SchemaConfiguration?): Nothing? { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validatedPathToSchemas = PathToSchemasMap() + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, LinkedHashSet()) + getPathToSchemas(this, castArg, validationMetadata, pathSet) + return castArg + } + + @Throws(ValidationException::class) + override fun validate(arg: Boolean, configuration: SchemaConfiguration?): Boolean { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validatedPathToSchemas = PathToSchemasMap() + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, LinkedHashSet()) + getPathToSchemas(this, castArg, validationMetadata, pathSet) + return castArg + } + + @Throws(ValidationException::class) + override fun validate(arg: Number, configuration: SchemaConfiguration?): Number { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validatedPathToSchemas = PathToSchemasMap() + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, LinkedHashSet()) + getPathToSchemas(this, castArg, validationMetadata, pathSet) + return castArg + } + + @Throws(ValidationException::class) + fun validate(arg: Int, configuration: SchemaConfiguration?): Int { + return validate(arg as Number, configuration) as Int + } + + @Throws(ValidationException::class) + fun validate(arg: Long, configuration: SchemaConfiguration?): Long { + return validate(arg as Number, configuration) as Long + } + + @Throws(ValidationException::class) + fun validate(arg: Float, configuration: SchemaConfiguration?): Float { + return validate(arg as Number, configuration) as Float + } + + @Throws(ValidationException::class) + fun validate(arg: Double, configuration: SchemaConfiguration?): Double { + return validate(arg as Number, configuration) as Double + } + + @Throws(ValidationException::class) + override fun validate(arg: String, configuration: SchemaConfiguration?): String { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validatedPathToSchemas = PathToSchemasMap() + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, LinkedHashSet()) + getPathToSchemas(this, castArg, validationMetadata, pathSet) + return castArg + } + + @Throws(ValidationException::class) + fun validate(arg: LocalDate, configuration: SchemaConfiguration?): String { + return validate(arg.toString(), configuration) + } + + @Throws(ValidationException::class) + fun validate(arg: ZonedDateTime, configuration: SchemaConfiguration?): String { + return validate(arg.toString(), configuration) + } + + @Throws(ValidationException::class) + fun validate(arg: UUID, configuration: SchemaConfiguration?): String { + return validate(arg.toString(), configuration) + } + + override fun getNewInstance(arg: List<*>, pathToItem: List, pathToSchemas: PathToSchemasMap): FrozenList { + val items: MutableList = ArrayList() + var i: Int = 0 + for (item: Any? in arg) { + val itemPathToItem = pathToItem + i + val schemas: LinkedHashMap, Nothing?>? = pathToSchemas.get(itemPathToItem) + if (schemas == null) { + throw RuntimeException("Validation result is invalid, schemas must exist for a pathToItem") + } + val itemSchema: JsonSchema<*> = schemas.entries.iterator().next().key + val itemInstance: Any? = itemSchema.getNewInstance(item, itemPathToItem, pathToSchemas) + items.add(itemInstance) + i += 1 + } + val newInstanceItems: FrozenList = FrozenList(items) + return newInstanceItems + } + + @Throws(ValidationException::class) + override fun validate(arg: List<*>, configuration: SchemaConfiguration?): FrozenList { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, PathToSchemasMap(), LinkedHashSet()) + val pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet) + return getNewInstance(castArg, validationMetadata.pathToItem, pathToSchemasMap) + } + + override fun getNewInstance(arg: Map<*, *>, pathToItem: List, pathToSchemas: PathToSchemasMap): FrozenMap { + val properties: LinkedHashMap = LinkedHashMap() + for((propertyName, value) in arg) { + if (!(propertyName is String)) { + throw RuntimeException("Invalid non-string key value") + } + val propertyPathToItem: List = pathToItem + propertyName + val schemas: LinkedHashMap, Nothing?>? = pathToSchemas.get(propertyPathToItem) + if (schemas == null) { + throw RuntimeException("Validation result is invalid, schemas must exist for a pathToItem") + } + val propertySchema: JsonSchema<*> = schemas.entries.iterator().next().key + val propertyInstance: Any? = propertySchema.getNewInstance(value, propertyPathToItem, pathToSchemas) + properties[propertyName] = propertyInstance + } + val castProperties: FrozenMap = FrozenMap(properties) + return castProperties + } + + @Throws(ValidationException::class) + override fun validate(arg: Map<*, *>, configuration: SchemaConfiguration?): FrozenMap { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validatedPathToSchemas = PathToSchemasMap() + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, LinkedHashSet()) + val pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet) + return getNewInstance(castArg, validationMetadata.pathToItem, pathToSchemasMap) + } + + @Throws(ValidationException::class) + override fun validate(arg: Any?, configuration: SchemaConfiguration?): Any? { + if (arg == null) { + return validate(null, configuration) + } else if (arg is Boolean) { + return validate(arg, configuration) + } else if (arg is Number) { + return validate(arg, configuration) + } else if (arg is String) { + return validate(arg, configuration) + } else if (arg is List<*>) { + return validate(arg, configuration) + } else if (arg is Map<*, *>) { + return validate(arg, configuration) + } + throw ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema") + } + override fun getNewInstance(arg: Any?, pathToItem: List, pathToSchemas: PathToSchemasMap): Any? { + if (arg == null) { + return getNewInstance( null, pathToItem, pathToSchemas) + } else if (arg is Boolean) { + return getNewInstance(arg, pathToItem, pathToSchemas) + } else if (arg is Number) { + return getNewInstance(arg, pathToItem, pathToSchemas) + } else if (arg is String) { + return getNewInstance(arg, pathToItem, pathToSchemas) + } else if (arg is List<*>) { + return getNewInstance(arg, pathToItem, pathToSchemas) + } else if (arg is Map<*, *>) { + return getNewInstance(arg, pathToItem, pathToSchemas) + } + throw RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema") + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: Nothing?, configuration: SchemaConfiguration?): Schema0BoxedVoid { + return Schema0BoxedVoid(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: Boolean, configuration: SchemaConfiguration?): Schema0BoxedBoolean { + return Schema0BoxedBoolean(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: Number, configuration: SchemaConfiguration?): Schema0BoxedNumber { + return Schema0BoxedNumber(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: String, configuration: SchemaConfiguration?): Schema0BoxedString { + return Schema0BoxedString(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: List<*>, configuration: SchemaConfiguration?): Schema0BoxedList { + return Schema0BoxedList(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: Map<*, *>, configuration: SchemaConfiguration?): Schema0BoxedMap { + return Schema0BoxedMap(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: Any?, configuration: SchemaConfiguration?): Schema0Boxed { + if (arg == null) { + return validateAndBox(null, configuration) + } else if (arg is Boolean) { + return validateAndBox(arg, configuration) + } else if (arg is String) { + return validateAndBox(arg, configuration) + } else if (arg is Number) { + return validateAndBox(arg, configuration) + } else if (arg is List<*>) { + return validateAndBox(arg, configuration) + } else if (arg is Map<*, *>) { + return validateAndBox(arg, configuration) + } + throw ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema") + } + } + + sealed interface NestedAnyofToCheckValidationSemantics1Boxed { + fun getData(): Any? + } + + data class NestedAnyofToCheckValidationSemantics1BoxedVoid(val data: Nothing?) : NestedAnyofToCheckValidationSemantics1Boxed { + override fun getData(): Any? { + return data + } + } + + data class NestedAnyofToCheckValidationSemantics1BoxedBoolean(val data: Boolean): NestedAnyofToCheckValidationSemantics1Boxed { + override fun getData(): Any? { + return data + } + } + + data class NestedAnyofToCheckValidationSemantics1BoxedNumber(val data: Number) : NestedAnyofToCheckValidationSemantics1Boxed { + override fun getData(): Any? { + return data + } + } + + data class NestedAnyofToCheckValidationSemantics1BoxedString(val data: String) : NestedAnyofToCheckValidationSemantics1Boxed { + override fun getData(): Any? { + return data + } + } + + data class NestedAnyofToCheckValidationSemantics1BoxedList(val data: FrozenList) : NestedAnyofToCheckValidationSemantics1Boxed { + override fun getData(): Any? { + return data + } + } + + data class NestedAnyofToCheckValidationSemantics1BoxedMap(val data: FrozenMap) : NestedAnyofToCheckValidationSemantics1Boxed { + override fun getData(): Any? { + return data + } + } + + + class NestedAnyofToCheckValidationSemantics1 private constructor(): JsonSchema( + JsonSchemaInfo() + .anyOf(listOf( + Schema0::class.java + )) + ), NullSchemaValidator, BooleanSchemaValidator, NumberSchemaValidator, StringSchemaValidator, ListSchemaValidator, NestedAnyofToCheckValidationSemantics1BoxedList>, MapSchemaValidator, NestedAnyofToCheckValidationSemantics1BoxedMap> { + /* + NOTE: This class is auto generated by OpenAPI JSON Schema Generator. + Ref: https://github.com/openapi-json-schema-tools/openapi-json-schema-generator + + Do not edit the class manually. + */ + + companion object { + @Volatile + private var instance: NestedAnyofToCheckValidationSemantics1? = null + + fun getInstance() = + instance ?: synchronized(this) { + instance ?: NestedAnyofToCheckValidationSemantics1().also { instance = it } + } + } + + @Throws(ValidationException::class) + override fun validate(arg: Nothing?, configuration: SchemaConfiguration?): Nothing? { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validatedPathToSchemas = PathToSchemasMap() + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, LinkedHashSet()) + getPathToSchemas(this, castArg, validationMetadata, pathSet) + return castArg + } + + @Throws(ValidationException::class) + override fun validate(arg: Boolean, configuration: SchemaConfiguration?): Boolean { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validatedPathToSchemas = PathToSchemasMap() + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, LinkedHashSet()) + getPathToSchemas(this, castArg, validationMetadata, pathSet) + return castArg + } + + @Throws(ValidationException::class) + override fun validate(arg: Number, configuration: SchemaConfiguration?): Number { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validatedPathToSchemas = PathToSchemasMap() + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, LinkedHashSet()) + getPathToSchemas(this, castArg, validationMetadata, pathSet) + return castArg + } + + @Throws(ValidationException::class) + fun validate(arg: Int, configuration: SchemaConfiguration?): Int { + return validate(arg as Number, configuration) as Int + } + + @Throws(ValidationException::class) + fun validate(arg: Long, configuration: SchemaConfiguration?): Long { + return validate(arg as Number, configuration) as Long + } + + @Throws(ValidationException::class) + fun validate(arg: Float, configuration: SchemaConfiguration?): Float { + return validate(arg as Number, configuration) as Float + } + + @Throws(ValidationException::class) + fun validate(arg: Double, configuration: SchemaConfiguration?): Double { + return validate(arg as Number, configuration) as Double + } + + @Throws(ValidationException::class) + override fun validate(arg: String, configuration: SchemaConfiguration?): String { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validatedPathToSchemas = PathToSchemasMap() + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, LinkedHashSet()) + getPathToSchemas(this, castArg, validationMetadata, pathSet) + return castArg + } + + @Throws(ValidationException::class) + fun validate(arg: LocalDate, configuration: SchemaConfiguration?): String { + return validate(arg.toString(), configuration) + } + + @Throws(ValidationException::class) + fun validate(arg: ZonedDateTime, configuration: SchemaConfiguration?): String { + return validate(arg.toString(), configuration) + } + + @Throws(ValidationException::class) + fun validate(arg: UUID, configuration: SchemaConfiguration?): String { + return validate(arg.toString(), configuration) + } + + override fun getNewInstance(arg: List<*>, pathToItem: List, pathToSchemas: PathToSchemasMap): FrozenList { + val items: MutableList = ArrayList() + var i: Int = 0 + for (item: Any? in arg) { + val itemPathToItem = pathToItem + i + val schemas: LinkedHashMap, Nothing?>? = pathToSchemas.get(itemPathToItem) + if (schemas == null) { + throw RuntimeException("Validation result is invalid, schemas must exist for a pathToItem") + } + val itemSchema: JsonSchema<*> = schemas.entries.iterator().next().key + val itemInstance: Any? = itemSchema.getNewInstance(item, itemPathToItem, pathToSchemas) + items.add(itemInstance) + i += 1 + } + val newInstanceItems: FrozenList = FrozenList(items) + return newInstanceItems + } + + @Throws(ValidationException::class) + override fun validate(arg: List<*>, configuration: SchemaConfiguration?): FrozenList { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, PathToSchemasMap(), LinkedHashSet()) + val pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet) + return getNewInstance(castArg, validationMetadata.pathToItem, pathToSchemasMap) + } + + override fun getNewInstance(arg: Map<*, *>, pathToItem: List, pathToSchemas: PathToSchemasMap): FrozenMap { + val properties: LinkedHashMap = LinkedHashMap() + for((propertyName, value) in arg) { + if (!(propertyName is String)) { + throw RuntimeException("Invalid non-string key value") + } + val propertyPathToItem: List = pathToItem + propertyName + val schemas: LinkedHashMap, Nothing?>? = pathToSchemas.get(propertyPathToItem) + if (schemas == null) { + throw RuntimeException("Validation result is invalid, schemas must exist for a pathToItem") + } + val propertySchema: JsonSchema<*> = schemas.entries.iterator().next().key + val propertyInstance: Any? = propertySchema.getNewInstance(value, propertyPathToItem, pathToSchemas) + properties[propertyName] = propertyInstance + } + val castProperties: FrozenMap = FrozenMap(properties) + return castProperties + } + + @Throws(ValidationException::class) + override fun validate(arg: Map<*, *>, configuration: SchemaConfiguration?): FrozenMap { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validatedPathToSchemas = PathToSchemasMap() + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, LinkedHashSet()) + val pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet) + return getNewInstance(castArg, validationMetadata.pathToItem, pathToSchemasMap) + } + + @Throws(ValidationException::class) + override fun validate(arg: Any?, configuration: SchemaConfiguration?): Any? { + if (arg == null) { + return validate(null, configuration) + } else if (arg is Boolean) { + return validate(arg, configuration) + } else if (arg is Number) { + return validate(arg, configuration) + } else if (arg is String) { + return validate(arg, configuration) + } else if (arg is List<*>) { + return validate(arg, configuration) + } else if (arg is Map<*, *>) { + return validate(arg, configuration) + } + throw ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema") + } + override fun getNewInstance(arg: Any?, pathToItem: List, pathToSchemas: PathToSchemasMap): Any? { + if (arg == null) { + return getNewInstance( null, pathToItem, pathToSchemas) + } else if (arg is Boolean) { + return getNewInstance(arg, pathToItem, pathToSchemas) + } else if (arg is Number) { + return getNewInstance(arg, pathToItem, pathToSchemas) + } else if (arg is String) { + return getNewInstance(arg, pathToItem, pathToSchemas) + } else if (arg is List<*>) { + return getNewInstance(arg, pathToItem, pathToSchemas) + } else if (arg is Map<*, *>) { + return getNewInstance(arg, pathToItem, pathToSchemas) + } + throw RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema") + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: Nothing?, configuration: SchemaConfiguration?): NestedAnyofToCheckValidationSemantics1BoxedVoid { + return NestedAnyofToCheckValidationSemantics1BoxedVoid(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: Boolean, configuration: SchemaConfiguration?): NestedAnyofToCheckValidationSemantics1BoxedBoolean { + return NestedAnyofToCheckValidationSemantics1BoxedBoolean(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: Number, configuration: SchemaConfiguration?): NestedAnyofToCheckValidationSemantics1BoxedNumber { + return NestedAnyofToCheckValidationSemantics1BoxedNumber(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: String, configuration: SchemaConfiguration?): NestedAnyofToCheckValidationSemantics1BoxedString { + return NestedAnyofToCheckValidationSemantics1BoxedString(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: List<*>, configuration: SchemaConfiguration?): NestedAnyofToCheckValidationSemantics1BoxedList { + return NestedAnyofToCheckValidationSemantics1BoxedList(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: Map<*, *>, configuration: SchemaConfiguration?): NestedAnyofToCheckValidationSemantics1BoxedMap { + return NestedAnyofToCheckValidationSemantics1BoxedMap(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: Any?, configuration: SchemaConfiguration?): NestedAnyofToCheckValidationSemantics1Boxed { + if (arg == null) { + return validateAndBox(null, configuration) + } else if (arg is Boolean) { + return validateAndBox(arg, configuration) + } else if (arg is String) { + return validateAndBox(arg, configuration) + } else if (arg is Number) { + return validateAndBox(arg, configuration) + } else if (arg is List<*>) { + return validateAndBox(arg, configuration) + } else if (arg is Map<*, *>) { + return validateAndBox(arg, configuration) + } + throw ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema") + } + } +} diff --git a/samples/client/3_0_3_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/schemas/NestedItems.kt b/samples/client/3_0_3_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/schemas/NestedItems.kt new file mode 100644 index 00000000000..27acba2e66d --- /dev/null +++ b/samples/client/3_0_3_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/schemas/NestedItems.kt @@ -0,0 +1,510 @@ +package org.openapijsonschematools.client.components.schemas +import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags +import org.openapijsonschematools.client.configurations.SchemaConfiguration +import org.openapijsonschematools.client.exceptions.ValidationException +import org.openapijsonschematools.client.schemas.NumberJsonSchema +import org.openapijsonschematools.client.schemas.validation.FrozenList +import org.openapijsonschematools.client.schemas.validation.JsonSchema +import org.openapijsonschematools.client.schemas.validation.JsonSchemaInfo +import org.openapijsonschematools.client.schemas.validation.ListSchemaValidator +import org.openapijsonschematools.client.schemas.validation.PathToSchemasMap +import org.openapijsonschematools.client.schemas.validation.ValidationMetadata + +class NestedItems { + // nest classes so all schemas and input/output classes can be public + + + class Items3 : NumberJsonSchema.NumberJsonSchema1() { + companion object { + @Volatile + private var instance: Items3? = null + + fun getInstance() = + instance ?: synchronized(this) { + instance ?: Items3().also { instance = it } + } + } + } + + + class ItemsList(m: FrozenList) : FrozenList(m) { + companion object { + @Throws(ValidationException::class) + fun of(arg: List, configuration: SchemaConfiguration?): ItemsList { + return Items2.getInstance().validate(arg, configuration) + } + } + } + + class ItemsListBuilder { + // class to build List + private val list: MutableList + + init { + this.list = ArrayList() + } + + + fun add(item: Int): ItemsListBuilder { + list.add(item) + return this + } + + fun add(item: Float): ItemsListBuilder { + list.add(item) + return this + } + + fun add(item: Long): ItemsListBuilder { + list.add(item) + return this + } + + fun add(item: Double): ItemsListBuilder { + list.add(item) + return this + } + + fun build(): List { + return list + } + } + + + sealed interface Items2Boxed { + fun getData(): Any? + } + + data class Items2BoxedList(val data: ItemsList) : Items2Boxed { + override fun getData(): Any? { + return data + } + } + + + + class Items2 private constructor(): JsonSchema( + JsonSchemaInfo() + .type(setOf(List::class.java)) + .items(Items3::class.java) + ), ListSchemaValidator { + + companion object { + @Volatile + private var instance: Items2? = null + + fun getInstance() = + instance ?: synchronized(this) { + instance ?: Items2().also { instance = it } + } + } + + override fun getNewInstance(arg: List<*>, pathToItem: List, pathToSchemas: PathToSchemasMap): ItemsList { + val items: MutableList = ArrayList() + var i: Int = 0 + for (item: Any? in arg) { + val itemPathToItem: List = pathToItem + i + val schemas: LinkedHashMap, Nothing?>? = pathToSchemas.get(itemPathToItem) + if (schemas == null) { + throw RuntimeException("Validation result is invalid, schemas must exist for a pathToItem") + } + val itemSchema: JsonSchema<*> = schemas.entries.iterator().next().key + val itemInstance: Any? = itemSchema.getNewInstance(item, itemPathToItem, pathToSchemas) + if (!(itemInstance is Number)) { + throw RuntimeException("Invalid instantiated value") + } + items.add(itemInstance) + i += 1 + } + val newInstanceItems: FrozenList = FrozenList(items) + return ItemsList(newInstanceItems) + } + + @Throws(ValidationException::class) + override fun validate(arg: List<*>, configuration: SchemaConfiguration?): ItemsList { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, PathToSchemasMap(), LinkedHashSet()) + val pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet) + return getNewInstance(castArg, validationMetadata.pathToItem, pathToSchemasMap) + } + + @Throws(ValidationException::class) + override fun validate(arg: Any?, configuration: SchemaConfiguration?): Any? { + if (arg is List<*>) { + return validate(arg, configuration) + } + throw ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema") + } + override fun getNewInstance(arg: Any?, pathToItem: List, pathToSchemas: PathToSchemasMap): Any? { + if (arg is List<*>) { + return getNewInstance(arg, pathToItem, pathToSchemas) + } + throw RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema") + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: List<*>, configuration: SchemaConfiguration?): Items2BoxedList { + return Items2BoxedList(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: Any?, configuration: SchemaConfiguration?): Items2Boxed { + if (arg is List<*>) { + return validateAndBox(arg, configuration) + } + throw ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema") + } + } + + class ItemsList1(m: FrozenList) : FrozenList(m) { + companion object { + @Throws(ValidationException::class) + fun of(arg: List>, configuration: SchemaConfiguration?): ItemsList1 { + return Items1.getInstance().validate(arg, configuration) + } + } + } + + class ItemsListBuilder1 { + // class to build List> + private val list: MutableList> + + init { + this.list = ArrayList() + } + + + fun add(item: List): ItemsListBuilder1 { + list.add(item) + return this + } + + fun build(): List> { + return list + } + } + + + sealed interface Items1Boxed { + fun getData(): Any? + } + + data class Items1BoxedList(val data: ItemsList1) : Items1Boxed { + override fun getData(): Any? { + return data + } + } + + + + class Items1 private constructor(): JsonSchema( + JsonSchemaInfo() + .type(setOf(List::class.java)) + .items(Items2::class.java) + ), ListSchemaValidator { + + companion object { + @Volatile + private var instance: Items1? = null + + fun getInstance() = + instance ?: synchronized(this) { + instance ?: Items1().also { instance = it } + } + } + + override fun getNewInstance(arg: List<*>, pathToItem: List, pathToSchemas: PathToSchemasMap): ItemsList1 { + val items: MutableList = ArrayList() + var i: Int = 0 + for (item: Any? in arg) { + val itemPathToItem: List = pathToItem + i + val schemas: LinkedHashMap, Nothing?>? = pathToSchemas.get(itemPathToItem) + if (schemas == null) { + throw RuntimeException("Validation result is invalid, schemas must exist for a pathToItem") + } + val itemSchema: JsonSchema<*> = schemas.entries.iterator().next().key + val itemInstance: Any? = itemSchema.getNewInstance(item, itemPathToItem, pathToSchemas) + if (!(itemInstance is ItemsList)) { + throw RuntimeException("Invalid instantiated value") + } + items.add(itemInstance) + i += 1 + } + val newInstanceItems: FrozenList = FrozenList(items) + return ItemsList1(newInstanceItems) + } + + @Throws(ValidationException::class) + override fun validate(arg: List<*>, configuration: SchemaConfiguration?): ItemsList1 { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, PathToSchemasMap(), LinkedHashSet()) + val pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet) + return getNewInstance(castArg, validationMetadata.pathToItem, pathToSchemasMap) + } + + @Throws(ValidationException::class) + override fun validate(arg: Any?, configuration: SchemaConfiguration?): Any? { + if (arg is List<*>) { + return validate(arg, configuration) + } + throw ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema") + } + override fun getNewInstance(arg: Any?, pathToItem: List, pathToSchemas: PathToSchemasMap): Any? { + if (arg is List<*>) { + return getNewInstance(arg, pathToItem, pathToSchemas) + } + throw RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema") + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: List<*>, configuration: SchemaConfiguration?): Items1BoxedList { + return Items1BoxedList(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: Any?, configuration: SchemaConfiguration?): Items1Boxed { + if (arg is List<*>) { + return validateAndBox(arg, configuration) + } + throw ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema") + } + } + + class ItemsList2(m: FrozenList) : FrozenList(m) { + companion object { + @Throws(ValidationException::class) + fun of(arg: List>>, configuration: SchemaConfiguration?): ItemsList2 { + return Items.getInstance().validate(arg, configuration) + } + } + } + + class ItemsListBuilder2 { + // class to build List>> + private val list: MutableList>> + + init { + this.list = ArrayList() + } + + + fun add(item: List>): ItemsListBuilder2 { + list.add(item) + return this + } + + fun build(): List>> { + return list + } + } + + + sealed interface ItemsBoxed { + fun getData(): Any? + } + + data class ItemsBoxedList(val data: ItemsList2) : ItemsBoxed { + override fun getData(): Any? { + return data + } + } + + + + class Items private constructor(): JsonSchema( + JsonSchemaInfo() + .type(setOf(List::class.java)) + .items(Items1::class.java) + ), ListSchemaValidator { + + companion object { + @Volatile + private var instance: Items? = null + + fun getInstance() = + instance ?: synchronized(this) { + instance ?: Items().also { instance = it } + } + } + + override fun getNewInstance(arg: List<*>, pathToItem: List, pathToSchemas: PathToSchemasMap): ItemsList2 { + val items: MutableList = ArrayList() + var i: Int = 0 + for (item: Any? in arg) { + val itemPathToItem: List = pathToItem + i + val schemas: LinkedHashMap, Nothing?>? = pathToSchemas.get(itemPathToItem) + if (schemas == null) { + throw RuntimeException("Validation result is invalid, schemas must exist for a pathToItem") + } + val itemSchema: JsonSchema<*> = schemas.entries.iterator().next().key + val itemInstance: Any? = itemSchema.getNewInstance(item, itemPathToItem, pathToSchemas) + if (!(itemInstance is ItemsList1)) { + throw RuntimeException("Invalid instantiated value") + } + items.add(itemInstance) + i += 1 + } + val newInstanceItems: FrozenList = FrozenList(items) + return ItemsList2(newInstanceItems) + } + + @Throws(ValidationException::class) + override fun validate(arg: List<*>, configuration: SchemaConfiguration?): ItemsList2 { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, PathToSchemasMap(), LinkedHashSet()) + val pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet) + return getNewInstance(castArg, validationMetadata.pathToItem, pathToSchemasMap) + } + + @Throws(ValidationException::class) + override fun validate(arg: Any?, configuration: SchemaConfiguration?): Any? { + if (arg is List<*>) { + return validate(arg, configuration) + } + throw ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema") + } + override fun getNewInstance(arg: Any?, pathToItem: List, pathToSchemas: PathToSchemasMap): Any? { + if (arg is List<*>) { + return getNewInstance(arg, pathToItem, pathToSchemas) + } + throw RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema") + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: List<*>, configuration: SchemaConfiguration?): ItemsBoxedList { + return ItemsBoxedList(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: Any?, configuration: SchemaConfiguration?): ItemsBoxed { + if (arg is List<*>) { + return validateAndBox(arg, configuration) + } + throw ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema") + } + } + + class NestedItemsList(m: FrozenList) : FrozenList(m) { + companion object { + @Throws(ValidationException::class) + fun of(arg: List>>>, configuration: SchemaConfiguration?): NestedItemsList { + return NestedItems1.getInstance().validate(arg, configuration) + } + } + } + + class NestedItemsListBuilder { + // class to build List>>> + private val list: MutableList>>> + + init { + this.list = ArrayList() + } + + + fun add(item: List>>): NestedItemsListBuilder { + list.add(item) + return this + } + + fun build(): List>>> { + return list + } + } + + + sealed interface NestedItems1Boxed { + fun getData(): Any? + } + + data class NestedItems1BoxedList(val data: NestedItemsList) : NestedItems1Boxed { + override fun getData(): Any? { + return data + } + } + + + + class NestedItems1 private constructor(): JsonSchema( + JsonSchemaInfo() + .type(setOf(List::class.java)) + .items(Items::class.java) + ), ListSchemaValidator { + /* + NOTE: This class is auto generated by OpenAPI JSON Schema Generator. + Ref: https://github.com/openapi-json-schema-tools/openapi-json-schema-generator + + Do not edit the class manually. + */ + + companion object { + @Volatile + private var instance: NestedItems1? = null + + fun getInstance() = + instance ?: synchronized(this) { + instance ?: NestedItems1().also { instance = it } + } + } + + override fun getNewInstance(arg: List<*>, pathToItem: List, pathToSchemas: PathToSchemasMap): NestedItemsList { + val items: MutableList = ArrayList() + var i: Int = 0 + for (item: Any? in arg) { + val itemPathToItem: List = pathToItem + i + val schemas: LinkedHashMap, Nothing?>? = pathToSchemas.get(itemPathToItem) + if (schemas == null) { + throw RuntimeException("Validation result is invalid, schemas must exist for a pathToItem") + } + val itemSchema: JsonSchema<*> = schemas.entries.iterator().next().key + val itemInstance: Any? = itemSchema.getNewInstance(item, itemPathToItem, pathToSchemas) + if (!(itemInstance is ItemsList2)) { + throw RuntimeException("Invalid instantiated value") + } + items.add(itemInstance) + i += 1 + } + val newInstanceItems: FrozenList = FrozenList(items) + return NestedItemsList(newInstanceItems) + } + + @Throws(ValidationException::class) + override fun validate(arg: List<*>, configuration: SchemaConfiguration?): NestedItemsList { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, PathToSchemasMap(), LinkedHashSet()) + val pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet) + return getNewInstance(castArg, validationMetadata.pathToItem, pathToSchemasMap) + } + + @Throws(ValidationException::class) + override fun validate(arg: Any?, configuration: SchemaConfiguration?): Any? { + if (arg is List<*>) { + return validate(arg, configuration) + } + throw ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema") + } + override fun getNewInstance(arg: Any?, pathToItem: List, pathToSchemas: PathToSchemasMap): Any? { + if (arg is List<*>) { + return getNewInstance(arg, pathToItem, pathToSchemas) + } + throw RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema") + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: List<*>, configuration: SchemaConfiguration?): NestedItems1BoxedList { + return NestedItems1BoxedList(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: Any?, configuration: SchemaConfiguration?): NestedItems1Boxed { + if (arg is List<*>) { + return validateAndBox(arg, configuration) + } + throw ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema") + } + } +} diff --git a/samples/client/3_0_3_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/schemas/NestedOneofToCheckValidationSemantics.kt b/samples/client/3_0_3_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/schemas/NestedOneofToCheckValidationSemantics.kt new file mode 100644 index 00000000000..eaaadf832d1 --- /dev/null +++ b/samples/client/3_0_3_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/schemas/NestedOneofToCheckValidationSemantics.kt @@ -0,0 +1,601 @@ +package org.openapijsonschematools.client.components.schemas +import java.time.LocalDate +import java.time.ZonedDateTime +import java.util.UUID +import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags +import org.openapijsonschematools.client.configurations.SchemaConfiguration +import org.openapijsonschematools.client.exceptions.InvalidAdditionalPropertyException +import org.openapijsonschematools.client.exceptions.UnsetPropertyException +import org.openapijsonschematools.client.exceptions.ValidationException +import org.openapijsonschematools.client.schemas.NullJsonSchema +import org.openapijsonschematools.client.schemas.UnsetAddPropsSetter +import org.openapijsonschematools.client.schemas.validation.BooleanSchemaValidator +import org.openapijsonschematools.client.schemas.validation.FrozenList +import org.openapijsonschematools.client.schemas.validation.FrozenMap +import org.openapijsonschematools.client.schemas.validation.JsonSchema +import org.openapijsonschematools.client.schemas.validation.JsonSchemaInfo +import org.openapijsonschematools.client.schemas.validation.ListSchemaValidator +import org.openapijsonschematools.client.schemas.validation.MapSchemaValidator +import org.openapijsonschematools.client.schemas.validation.NullSchemaValidator +import org.openapijsonschematools.client.schemas.validation.NumberSchemaValidator +import org.openapijsonschematools.client.schemas.validation.PathToSchemasMap +import org.openapijsonschematools.client.schemas.validation.StringSchemaValidator +import org.openapijsonschematools.client.schemas.validation.ValidationMetadata + +class NestedOneofToCheckValidationSemantics { + // nest classes so all schemas and input/output classes can be public + + + class Schema01 : NullJsonSchema.NullJsonSchema1() { + companion object { + @Volatile + private var instance: Schema01? = null + + fun getInstance() = + instance ?: synchronized(this) { + instance ?: Schema01().also { instance = it } + } + } + } + + + sealed interface Schema0Boxed { + fun getData(): Any? + } + + data class Schema0BoxedVoid(val data: Nothing?) : Schema0Boxed { + override fun getData(): Any? { + return data + } + } + + data class Schema0BoxedBoolean(val data: Boolean): Schema0Boxed { + override fun getData(): Any? { + return data + } + } + + data class Schema0BoxedNumber(val data: Number) : Schema0Boxed { + override fun getData(): Any? { + return data + } + } + + data class Schema0BoxedString(val data: String) : Schema0Boxed { + override fun getData(): Any? { + return data + } + } + + data class Schema0BoxedList(val data: FrozenList) : Schema0Boxed { + override fun getData(): Any? { + return data + } + } + + data class Schema0BoxedMap(val data: FrozenMap) : Schema0Boxed { + override fun getData(): Any? { + return data + } + } + + + class Schema0 private constructor(): JsonSchema( + JsonSchemaInfo() + .oneOf(listOf( + Schema01::class.java + )) + ), NullSchemaValidator, BooleanSchemaValidator, NumberSchemaValidator, StringSchemaValidator, ListSchemaValidator, Schema0BoxedList>, MapSchemaValidator, Schema0BoxedMap> { + + companion object { + @Volatile + private var instance: Schema0? = null + + fun getInstance() = + instance ?: synchronized(this) { + instance ?: Schema0().also { instance = it } + } + } + + @Throws(ValidationException::class) + override fun validate(arg: Nothing?, configuration: SchemaConfiguration?): Nothing? { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validatedPathToSchemas = PathToSchemasMap() + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, LinkedHashSet()) + getPathToSchemas(this, castArg, validationMetadata, pathSet) + return castArg + } + + @Throws(ValidationException::class) + override fun validate(arg: Boolean, configuration: SchemaConfiguration?): Boolean { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validatedPathToSchemas = PathToSchemasMap() + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, LinkedHashSet()) + getPathToSchemas(this, castArg, validationMetadata, pathSet) + return castArg + } + + @Throws(ValidationException::class) + override fun validate(arg: Number, configuration: SchemaConfiguration?): Number { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validatedPathToSchemas = PathToSchemasMap() + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, LinkedHashSet()) + getPathToSchemas(this, castArg, validationMetadata, pathSet) + return castArg + } + + @Throws(ValidationException::class) + fun validate(arg: Int, configuration: SchemaConfiguration?): Int { + return validate(arg as Number, configuration) as Int + } + + @Throws(ValidationException::class) + fun validate(arg: Long, configuration: SchemaConfiguration?): Long { + return validate(arg as Number, configuration) as Long + } + + @Throws(ValidationException::class) + fun validate(arg: Float, configuration: SchemaConfiguration?): Float { + return validate(arg as Number, configuration) as Float + } + + @Throws(ValidationException::class) + fun validate(arg: Double, configuration: SchemaConfiguration?): Double { + return validate(arg as Number, configuration) as Double + } + + @Throws(ValidationException::class) + override fun validate(arg: String, configuration: SchemaConfiguration?): String { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validatedPathToSchemas = PathToSchemasMap() + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, LinkedHashSet()) + getPathToSchemas(this, castArg, validationMetadata, pathSet) + return castArg + } + + @Throws(ValidationException::class) + fun validate(arg: LocalDate, configuration: SchemaConfiguration?): String { + return validate(arg.toString(), configuration) + } + + @Throws(ValidationException::class) + fun validate(arg: ZonedDateTime, configuration: SchemaConfiguration?): String { + return validate(arg.toString(), configuration) + } + + @Throws(ValidationException::class) + fun validate(arg: UUID, configuration: SchemaConfiguration?): String { + return validate(arg.toString(), configuration) + } + + override fun getNewInstance(arg: List<*>, pathToItem: List, pathToSchemas: PathToSchemasMap): FrozenList { + val items: MutableList = ArrayList() + var i: Int = 0 + for (item: Any? in arg) { + val itemPathToItem = pathToItem + i + val schemas: LinkedHashMap, Nothing?>? = pathToSchemas.get(itemPathToItem) + if (schemas == null) { + throw RuntimeException("Validation result is invalid, schemas must exist for a pathToItem") + } + val itemSchema: JsonSchema<*> = schemas.entries.iterator().next().key + val itemInstance: Any? = itemSchema.getNewInstance(item, itemPathToItem, pathToSchemas) + items.add(itemInstance) + i += 1 + } + val newInstanceItems: FrozenList = FrozenList(items) + return newInstanceItems + } + + @Throws(ValidationException::class) + override fun validate(arg: List<*>, configuration: SchemaConfiguration?): FrozenList { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, PathToSchemasMap(), LinkedHashSet()) + val pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet) + return getNewInstance(castArg, validationMetadata.pathToItem, pathToSchemasMap) + } + + override fun getNewInstance(arg: Map<*, *>, pathToItem: List, pathToSchemas: PathToSchemasMap): FrozenMap { + val properties: LinkedHashMap = LinkedHashMap() + for((propertyName, value) in arg) { + if (!(propertyName is String)) { + throw RuntimeException("Invalid non-string key value") + } + val propertyPathToItem: List = pathToItem + propertyName + val schemas: LinkedHashMap, Nothing?>? = pathToSchemas.get(propertyPathToItem) + if (schemas == null) { + throw RuntimeException("Validation result is invalid, schemas must exist for a pathToItem") + } + val propertySchema: JsonSchema<*> = schemas.entries.iterator().next().key + val propertyInstance: Any? = propertySchema.getNewInstance(value, propertyPathToItem, pathToSchemas) + properties[propertyName] = propertyInstance + } + val castProperties: FrozenMap = FrozenMap(properties) + return castProperties + } + + @Throws(ValidationException::class) + override fun validate(arg: Map<*, *>, configuration: SchemaConfiguration?): FrozenMap { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validatedPathToSchemas = PathToSchemasMap() + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, LinkedHashSet()) + val pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet) + return getNewInstance(castArg, validationMetadata.pathToItem, pathToSchemasMap) + } + + @Throws(ValidationException::class) + override fun validate(arg: Any?, configuration: SchemaConfiguration?): Any? { + if (arg == null) { + return validate(null, configuration) + } else if (arg is Boolean) { + return validate(arg, configuration) + } else if (arg is Number) { + return validate(arg, configuration) + } else if (arg is String) { + return validate(arg, configuration) + } else if (arg is List<*>) { + return validate(arg, configuration) + } else if (arg is Map<*, *>) { + return validate(arg, configuration) + } + throw ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema") + } + override fun getNewInstance(arg: Any?, pathToItem: List, pathToSchemas: PathToSchemasMap): Any? { + if (arg == null) { + return getNewInstance( null, pathToItem, pathToSchemas) + } else if (arg is Boolean) { + return getNewInstance(arg, pathToItem, pathToSchemas) + } else if (arg is Number) { + return getNewInstance(arg, pathToItem, pathToSchemas) + } else if (arg is String) { + return getNewInstance(arg, pathToItem, pathToSchemas) + } else if (arg is List<*>) { + return getNewInstance(arg, pathToItem, pathToSchemas) + } else if (arg is Map<*, *>) { + return getNewInstance(arg, pathToItem, pathToSchemas) + } + throw RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema") + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: Nothing?, configuration: SchemaConfiguration?): Schema0BoxedVoid { + return Schema0BoxedVoid(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: Boolean, configuration: SchemaConfiguration?): Schema0BoxedBoolean { + return Schema0BoxedBoolean(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: Number, configuration: SchemaConfiguration?): Schema0BoxedNumber { + return Schema0BoxedNumber(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: String, configuration: SchemaConfiguration?): Schema0BoxedString { + return Schema0BoxedString(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: List<*>, configuration: SchemaConfiguration?): Schema0BoxedList { + return Schema0BoxedList(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: Map<*, *>, configuration: SchemaConfiguration?): Schema0BoxedMap { + return Schema0BoxedMap(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: Any?, configuration: SchemaConfiguration?): Schema0Boxed { + if (arg == null) { + return validateAndBox(null, configuration) + } else if (arg is Boolean) { + return validateAndBox(arg, configuration) + } else if (arg is String) { + return validateAndBox(arg, configuration) + } else if (arg is Number) { + return validateAndBox(arg, configuration) + } else if (arg is List<*>) { + return validateAndBox(arg, configuration) + } else if (arg is Map<*, *>) { + return validateAndBox(arg, configuration) + } + throw ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema") + } + } + + sealed interface NestedOneofToCheckValidationSemantics1Boxed { + fun getData(): Any? + } + + data class NestedOneofToCheckValidationSemantics1BoxedVoid(val data: Nothing?) : NestedOneofToCheckValidationSemantics1Boxed { + override fun getData(): Any? { + return data + } + } + + data class NestedOneofToCheckValidationSemantics1BoxedBoolean(val data: Boolean): NestedOneofToCheckValidationSemantics1Boxed { + override fun getData(): Any? { + return data + } + } + + data class NestedOneofToCheckValidationSemantics1BoxedNumber(val data: Number) : NestedOneofToCheckValidationSemantics1Boxed { + override fun getData(): Any? { + return data + } + } + + data class NestedOneofToCheckValidationSemantics1BoxedString(val data: String) : NestedOneofToCheckValidationSemantics1Boxed { + override fun getData(): Any? { + return data + } + } + + data class NestedOneofToCheckValidationSemantics1BoxedList(val data: FrozenList) : NestedOneofToCheckValidationSemantics1Boxed { + override fun getData(): Any? { + return data + } + } + + data class NestedOneofToCheckValidationSemantics1BoxedMap(val data: FrozenMap) : NestedOneofToCheckValidationSemantics1Boxed { + override fun getData(): Any? { + return data + } + } + + + class NestedOneofToCheckValidationSemantics1 private constructor(): JsonSchema( + JsonSchemaInfo() + .oneOf(listOf( + Schema0::class.java + )) + ), NullSchemaValidator, BooleanSchemaValidator, NumberSchemaValidator, StringSchemaValidator, ListSchemaValidator, NestedOneofToCheckValidationSemantics1BoxedList>, MapSchemaValidator, NestedOneofToCheckValidationSemantics1BoxedMap> { + /* + NOTE: This class is auto generated by OpenAPI JSON Schema Generator. + Ref: https://github.com/openapi-json-schema-tools/openapi-json-schema-generator + + Do not edit the class manually. + */ + + companion object { + @Volatile + private var instance: NestedOneofToCheckValidationSemantics1? = null + + fun getInstance() = + instance ?: synchronized(this) { + instance ?: NestedOneofToCheckValidationSemantics1().also { instance = it } + } + } + + @Throws(ValidationException::class) + override fun validate(arg: Nothing?, configuration: SchemaConfiguration?): Nothing? { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validatedPathToSchemas = PathToSchemasMap() + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, LinkedHashSet()) + getPathToSchemas(this, castArg, validationMetadata, pathSet) + return castArg + } + + @Throws(ValidationException::class) + override fun validate(arg: Boolean, configuration: SchemaConfiguration?): Boolean { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validatedPathToSchemas = PathToSchemasMap() + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, LinkedHashSet()) + getPathToSchemas(this, castArg, validationMetadata, pathSet) + return castArg + } + + @Throws(ValidationException::class) + override fun validate(arg: Number, configuration: SchemaConfiguration?): Number { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validatedPathToSchemas = PathToSchemasMap() + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, LinkedHashSet()) + getPathToSchemas(this, castArg, validationMetadata, pathSet) + return castArg + } + + @Throws(ValidationException::class) + fun validate(arg: Int, configuration: SchemaConfiguration?): Int { + return validate(arg as Number, configuration) as Int + } + + @Throws(ValidationException::class) + fun validate(arg: Long, configuration: SchemaConfiguration?): Long { + return validate(arg as Number, configuration) as Long + } + + @Throws(ValidationException::class) + fun validate(arg: Float, configuration: SchemaConfiguration?): Float { + return validate(arg as Number, configuration) as Float + } + + @Throws(ValidationException::class) + fun validate(arg: Double, configuration: SchemaConfiguration?): Double { + return validate(arg as Number, configuration) as Double + } + + @Throws(ValidationException::class) + override fun validate(arg: String, configuration: SchemaConfiguration?): String { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validatedPathToSchemas = PathToSchemasMap() + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, LinkedHashSet()) + getPathToSchemas(this, castArg, validationMetadata, pathSet) + return castArg + } + + @Throws(ValidationException::class) + fun validate(arg: LocalDate, configuration: SchemaConfiguration?): String { + return validate(arg.toString(), configuration) + } + + @Throws(ValidationException::class) + fun validate(arg: ZonedDateTime, configuration: SchemaConfiguration?): String { + return validate(arg.toString(), configuration) + } + + @Throws(ValidationException::class) + fun validate(arg: UUID, configuration: SchemaConfiguration?): String { + return validate(arg.toString(), configuration) + } + + override fun getNewInstance(arg: List<*>, pathToItem: List, pathToSchemas: PathToSchemasMap): FrozenList { + val items: MutableList = ArrayList() + var i: Int = 0 + for (item: Any? in arg) { + val itemPathToItem = pathToItem + i + val schemas: LinkedHashMap, Nothing?>? = pathToSchemas.get(itemPathToItem) + if (schemas == null) { + throw RuntimeException("Validation result is invalid, schemas must exist for a pathToItem") + } + val itemSchema: JsonSchema<*> = schemas.entries.iterator().next().key + val itemInstance: Any? = itemSchema.getNewInstance(item, itemPathToItem, pathToSchemas) + items.add(itemInstance) + i += 1 + } + val newInstanceItems: FrozenList = FrozenList(items) + return newInstanceItems + } + + @Throws(ValidationException::class) + override fun validate(arg: List<*>, configuration: SchemaConfiguration?): FrozenList { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, PathToSchemasMap(), LinkedHashSet()) + val pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet) + return getNewInstance(castArg, validationMetadata.pathToItem, pathToSchemasMap) + } + + override fun getNewInstance(arg: Map<*, *>, pathToItem: List, pathToSchemas: PathToSchemasMap): FrozenMap { + val properties: LinkedHashMap = LinkedHashMap() + for((propertyName, value) in arg) { + if (!(propertyName is String)) { + throw RuntimeException("Invalid non-string key value") + } + val propertyPathToItem: List = pathToItem + propertyName + val schemas: LinkedHashMap, Nothing?>? = pathToSchemas.get(propertyPathToItem) + if (schemas == null) { + throw RuntimeException("Validation result is invalid, schemas must exist for a pathToItem") + } + val propertySchema: JsonSchema<*> = schemas.entries.iterator().next().key + val propertyInstance: Any? = propertySchema.getNewInstance(value, propertyPathToItem, pathToSchemas) + properties[propertyName] = propertyInstance + } + val castProperties: FrozenMap = FrozenMap(properties) + return castProperties + } + + @Throws(ValidationException::class) + override fun validate(arg: Map<*, *>, configuration: SchemaConfiguration?): FrozenMap { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validatedPathToSchemas = PathToSchemasMap() + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, LinkedHashSet()) + val pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet) + return getNewInstance(castArg, validationMetadata.pathToItem, pathToSchemasMap) + } + + @Throws(ValidationException::class) + override fun validate(arg: Any?, configuration: SchemaConfiguration?): Any? { + if (arg == null) { + return validate(null, configuration) + } else if (arg is Boolean) { + return validate(arg, configuration) + } else if (arg is Number) { + return validate(arg, configuration) + } else if (arg is String) { + return validate(arg, configuration) + } else if (arg is List<*>) { + return validate(arg, configuration) + } else if (arg is Map<*, *>) { + return validate(arg, configuration) + } + throw ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema") + } + override fun getNewInstance(arg: Any?, pathToItem: List, pathToSchemas: PathToSchemasMap): Any? { + if (arg == null) { + return getNewInstance( null, pathToItem, pathToSchemas) + } else if (arg is Boolean) { + return getNewInstance(arg, pathToItem, pathToSchemas) + } else if (arg is Number) { + return getNewInstance(arg, pathToItem, pathToSchemas) + } else if (arg is String) { + return getNewInstance(arg, pathToItem, pathToSchemas) + } else if (arg is List<*>) { + return getNewInstance(arg, pathToItem, pathToSchemas) + } else if (arg is Map<*, *>) { + return getNewInstance(arg, pathToItem, pathToSchemas) + } + throw RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema") + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: Nothing?, configuration: SchemaConfiguration?): NestedOneofToCheckValidationSemantics1BoxedVoid { + return NestedOneofToCheckValidationSemantics1BoxedVoid(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: Boolean, configuration: SchemaConfiguration?): NestedOneofToCheckValidationSemantics1BoxedBoolean { + return NestedOneofToCheckValidationSemantics1BoxedBoolean(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: Number, configuration: SchemaConfiguration?): NestedOneofToCheckValidationSemantics1BoxedNumber { + return NestedOneofToCheckValidationSemantics1BoxedNumber(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: String, configuration: SchemaConfiguration?): NestedOneofToCheckValidationSemantics1BoxedString { + return NestedOneofToCheckValidationSemantics1BoxedString(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: List<*>, configuration: SchemaConfiguration?): NestedOneofToCheckValidationSemantics1BoxedList { + return NestedOneofToCheckValidationSemantics1BoxedList(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: Map<*, *>, configuration: SchemaConfiguration?): NestedOneofToCheckValidationSemantics1BoxedMap { + return NestedOneofToCheckValidationSemantics1BoxedMap(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: Any?, configuration: SchemaConfiguration?): NestedOneofToCheckValidationSemantics1Boxed { + if (arg == null) { + return validateAndBox(null, configuration) + } else if (arg is Boolean) { + return validateAndBox(arg, configuration) + } else if (arg is String) { + return validateAndBox(arg, configuration) + } else if (arg is Number) { + return validateAndBox(arg, configuration) + } else if (arg is List<*>) { + return validateAndBox(arg, configuration) + } else if (arg is Map<*, *>) { + return validateAndBox(arg, configuration) + } + throw ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema") + } + } +} diff --git a/samples/client/3_0_3_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/schemas/Not.kt b/samples/client/3_0_3_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/schemas/Not.kt new file mode 100644 index 00000000000..96a1a64a1be --- /dev/null +++ b/samples/client/3_0_3_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/schemas/Not.kt @@ -0,0 +1,322 @@ +package org.openapijsonschematools.client.components.schemas +import java.time.LocalDate +import java.time.ZonedDateTime +import java.util.UUID +import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags +import org.openapijsonschematools.client.configurations.SchemaConfiguration +import org.openapijsonschematools.client.exceptions.InvalidAdditionalPropertyException +import org.openapijsonschematools.client.exceptions.UnsetPropertyException +import org.openapijsonschematools.client.exceptions.ValidationException +import org.openapijsonschematools.client.schemas.IntJsonSchema +import org.openapijsonschematools.client.schemas.UnsetAddPropsSetter +import org.openapijsonschematools.client.schemas.validation.BooleanSchemaValidator +import org.openapijsonschematools.client.schemas.validation.FrozenList +import org.openapijsonschematools.client.schemas.validation.FrozenMap +import org.openapijsonschematools.client.schemas.validation.JsonSchema +import org.openapijsonschematools.client.schemas.validation.JsonSchemaInfo +import org.openapijsonschematools.client.schemas.validation.ListSchemaValidator +import org.openapijsonschematools.client.schemas.validation.MapSchemaValidator +import org.openapijsonschematools.client.schemas.validation.NullSchemaValidator +import org.openapijsonschematools.client.schemas.validation.NumberSchemaValidator +import org.openapijsonschematools.client.schemas.validation.PathToSchemasMap +import org.openapijsonschematools.client.schemas.validation.StringSchemaValidator +import org.openapijsonschematools.client.schemas.validation.ValidationMetadata + +class Not { + // nest classes so all schemas and input/output classes can be public + + + class Not2 : IntJsonSchema.IntJsonSchema1() { + companion object { + @Volatile + private var instance: Not2? = null + + fun getInstance() = + instance ?: synchronized(this) { + instance ?: Not2().also { instance = it } + } + } + } + + + sealed interface Not1Boxed { + fun getData(): Any? + } + + data class Not1BoxedVoid(val data: Nothing?) : Not1Boxed { + override fun getData(): Any? { + return data + } + } + + data class Not1BoxedBoolean(val data: Boolean): Not1Boxed { + override fun getData(): Any? { + return data + } + } + + data class Not1BoxedNumber(val data: Number) : Not1Boxed { + override fun getData(): Any? { + return data + } + } + + data class Not1BoxedString(val data: String) : Not1Boxed { + override fun getData(): Any? { + return data + } + } + + data class Not1BoxedList(val data: FrozenList) : Not1Boxed { + override fun getData(): Any? { + return data + } + } + + data class Not1BoxedMap(val data: FrozenMap) : Not1Boxed { + override fun getData(): Any? { + return data + } + } + + + class Not1 private constructor(): JsonSchema( + JsonSchemaInfo() + .not(Not2::class.java) + ), NullSchemaValidator, BooleanSchemaValidator, NumberSchemaValidator, StringSchemaValidator, ListSchemaValidator, Not1BoxedList>, MapSchemaValidator, Not1BoxedMap> { + /* + NOTE: This class is auto generated by OpenAPI JSON Schema Generator. + Ref: https://github.com/openapi-json-schema-tools/openapi-json-schema-generator + + Do not edit the class manually. + */ + + companion object { + @Volatile + private var instance: Not1? = null + + fun getInstance() = + instance ?: synchronized(this) { + instance ?: Not1().also { instance = it } + } + } + + @Throws(ValidationException::class) + override fun validate(arg: Nothing?, configuration: SchemaConfiguration?): Nothing? { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validatedPathToSchemas = PathToSchemasMap() + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, LinkedHashSet()) + getPathToSchemas(this, castArg, validationMetadata, pathSet) + return castArg + } + + @Throws(ValidationException::class) + override fun validate(arg: Boolean, configuration: SchemaConfiguration?): Boolean { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validatedPathToSchemas = PathToSchemasMap() + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, LinkedHashSet()) + getPathToSchemas(this, castArg, validationMetadata, pathSet) + return castArg + } + + @Throws(ValidationException::class) + override fun validate(arg: Number, configuration: SchemaConfiguration?): Number { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validatedPathToSchemas = PathToSchemasMap() + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, LinkedHashSet()) + getPathToSchemas(this, castArg, validationMetadata, pathSet) + return castArg + } + + @Throws(ValidationException::class) + fun validate(arg: Int, configuration: SchemaConfiguration?): Int { + return validate(arg as Number, configuration) as Int + } + + @Throws(ValidationException::class) + fun validate(arg: Long, configuration: SchemaConfiguration?): Long { + return validate(arg as Number, configuration) as Long + } + + @Throws(ValidationException::class) + fun validate(arg: Float, configuration: SchemaConfiguration?): Float { + return validate(arg as Number, configuration) as Float + } + + @Throws(ValidationException::class) + fun validate(arg: Double, configuration: SchemaConfiguration?): Double { + return validate(arg as Number, configuration) as Double + } + + @Throws(ValidationException::class) + override fun validate(arg: String, configuration: SchemaConfiguration?): String { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validatedPathToSchemas = PathToSchemasMap() + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, LinkedHashSet()) + getPathToSchemas(this, castArg, validationMetadata, pathSet) + return castArg + } + + @Throws(ValidationException::class) + fun validate(arg: LocalDate, configuration: SchemaConfiguration?): String { + return validate(arg.toString(), configuration) + } + + @Throws(ValidationException::class) + fun validate(arg: ZonedDateTime, configuration: SchemaConfiguration?): String { + return validate(arg.toString(), configuration) + } + + @Throws(ValidationException::class) + fun validate(arg: UUID, configuration: SchemaConfiguration?): String { + return validate(arg.toString(), configuration) + } + + override fun getNewInstance(arg: List<*>, pathToItem: List, pathToSchemas: PathToSchemasMap): FrozenList { + val items: MutableList = ArrayList() + var i: Int = 0 + for (item: Any? in arg) { + val itemPathToItem = pathToItem + i + val schemas: LinkedHashMap, Nothing?>? = pathToSchemas.get(itemPathToItem) + if (schemas == null) { + throw RuntimeException("Validation result is invalid, schemas must exist for a pathToItem") + } + val itemSchema: JsonSchema<*> = schemas.entries.iterator().next().key + val itemInstance: Any? = itemSchema.getNewInstance(item, itemPathToItem, pathToSchemas) + items.add(itemInstance) + i += 1 + } + val newInstanceItems: FrozenList = FrozenList(items) + return newInstanceItems + } + + @Throws(ValidationException::class) + override fun validate(arg: List<*>, configuration: SchemaConfiguration?): FrozenList { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, PathToSchemasMap(), LinkedHashSet()) + val pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet) + return getNewInstance(castArg, validationMetadata.pathToItem, pathToSchemasMap) + } + + override fun getNewInstance(arg: Map<*, *>, pathToItem: List, pathToSchemas: PathToSchemasMap): FrozenMap { + val properties: LinkedHashMap = LinkedHashMap() + for((propertyName, value) in arg) { + if (!(propertyName is String)) { + throw RuntimeException("Invalid non-string key value") + } + val propertyPathToItem: List = pathToItem + propertyName + val schemas: LinkedHashMap, Nothing?>? = pathToSchemas.get(propertyPathToItem) + if (schemas == null) { + throw RuntimeException("Validation result is invalid, schemas must exist for a pathToItem") + } + val propertySchema: JsonSchema<*> = schemas.entries.iterator().next().key + val propertyInstance: Any? = propertySchema.getNewInstance(value, propertyPathToItem, pathToSchemas) + properties[propertyName] = propertyInstance + } + val castProperties: FrozenMap = FrozenMap(properties) + return castProperties + } + + @Throws(ValidationException::class) + override fun validate(arg: Map<*, *>, configuration: SchemaConfiguration?): FrozenMap { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validatedPathToSchemas = PathToSchemasMap() + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, LinkedHashSet()) + val pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet) + return getNewInstance(castArg, validationMetadata.pathToItem, pathToSchemasMap) + } + + @Throws(ValidationException::class) + override fun validate(arg: Any?, configuration: SchemaConfiguration?): Any? { + if (arg == null) { + return validate(null, configuration) + } else if (arg is Boolean) { + return validate(arg, configuration) + } else if (arg is Number) { + return validate(arg, configuration) + } else if (arg is String) { + return validate(arg, configuration) + } else if (arg is List<*>) { + return validate(arg, configuration) + } else if (arg is Map<*, *>) { + return validate(arg, configuration) + } + throw ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema") + } + override fun getNewInstance(arg: Any?, pathToItem: List, pathToSchemas: PathToSchemasMap): Any? { + if (arg == null) { + return getNewInstance( null, pathToItem, pathToSchemas) + } else if (arg is Boolean) { + return getNewInstance(arg, pathToItem, pathToSchemas) + } else if (arg is Number) { + return getNewInstance(arg, pathToItem, pathToSchemas) + } else if (arg is String) { + return getNewInstance(arg, pathToItem, pathToSchemas) + } else if (arg is List<*>) { + return getNewInstance(arg, pathToItem, pathToSchemas) + } else if (arg is Map<*, *>) { + return getNewInstance(arg, pathToItem, pathToSchemas) + } + throw RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema") + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: Nothing?, configuration: SchemaConfiguration?): Not1BoxedVoid { + return Not1BoxedVoid(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: Boolean, configuration: SchemaConfiguration?): Not1BoxedBoolean { + return Not1BoxedBoolean(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: Number, configuration: SchemaConfiguration?): Not1BoxedNumber { + return Not1BoxedNumber(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: String, configuration: SchemaConfiguration?): Not1BoxedString { + return Not1BoxedString(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: List<*>, configuration: SchemaConfiguration?): Not1BoxedList { + return Not1BoxedList(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: Map<*, *>, configuration: SchemaConfiguration?): Not1BoxedMap { + return Not1BoxedMap(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: Any?, configuration: SchemaConfiguration?): Not1Boxed { + if (arg == null) { + return validateAndBox(null, configuration) + } else if (arg is Boolean) { + return validateAndBox(arg, configuration) + } else if (arg is String) { + return validateAndBox(arg, configuration) + } else if (arg is Number) { + return validateAndBox(arg, configuration) + } else if (arg is List<*>) { + return validateAndBox(arg, configuration) + } else if (arg is Map<*, *>) { + return validateAndBox(arg, configuration) + } + throw ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema") + } + } +} diff --git a/samples/client/3_0_3_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/schemas/NotMoreComplexSchema.kt b/samples/client/3_0_3_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/schemas/NotMoreComplexSchema.kt new file mode 100644 index 00000000000..70fae92a396 --- /dev/null +++ b/samples/client/3_0_3_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/schemas/NotMoreComplexSchema.kt @@ -0,0 +1,478 @@ +package org.openapijsonschematools.client.components.schemas +import java.time.LocalDate +import java.time.ZonedDateTime +import java.util.UUID +import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags +import org.openapijsonschematools.client.configurations.SchemaConfiguration +import org.openapijsonschematools.client.exceptions.InvalidAdditionalPropertyException +import org.openapijsonschematools.client.exceptions.UnsetPropertyException +import org.openapijsonschematools.client.exceptions.ValidationException +import org.openapijsonschematools.client.schemas.GenericBuilder +import org.openapijsonschematools.client.schemas.StringJsonSchema +import org.openapijsonschematools.client.schemas.UnsetAddPropsSetter +import org.openapijsonschematools.client.schemas.validation.BooleanSchemaValidator +import org.openapijsonschematools.client.schemas.validation.FrozenList +import org.openapijsonschematools.client.schemas.validation.FrozenMap +import org.openapijsonschematools.client.schemas.validation.JsonSchema +import org.openapijsonschematools.client.schemas.validation.JsonSchemaInfo +import org.openapijsonschematools.client.schemas.validation.ListSchemaValidator +import org.openapijsonschematools.client.schemas.validation.MapSchemaValidator +import org.openapijsonschematools.client.schemas.validation.NullSchemaValidator +import org.openapijsonschematools.client.schemas.validation.NumberSchemaValidator +import org.openapijsonschematools.client.schemas.validation.PathToSchemasMap +import org.openapijsonschematools.client.schemas.validation.StringSchemaValidator +import org.openapijsonschematools.client.schemas.validation.ValidationMetadata + +class NotMoreComplexSchema { + // nest classes so all schemas and input/output classes can be public + + + class Foo : StringJsonSchema.StringJsonSchema1() { + companion object { + @Volatile + private var instance: Foo? = null + + fun getInstance() = + instance ?: synchronized(this) { + instance ?: Foo().also { instance = it } + } + } + } + + + class NotMap(m: FrozenMap) : FrozenMap(m) { + companion object { + val requiredKeys: Set = setOf() + val optionalKeys: Set = setOf( + "foo" + ) + @Throws(ValidationException::class) + fun of(arg: Map, configuration: SchemaConfiguration): NotMap { + return Not.getInstance().validate(arg, configuration) + } + } + + @Throws(UnsetPropertyException::class) + fun foo(): String { + val key = "foo" + throwIfKeyNotPresent(key) + val value: Any? = get(key) + if (!(value is String)) { + throw RuntimeException("Invalid value stored for foo") + } + return value + } + + @Throws(UnsetPropertyException::class, InvalidAdditionalPropertyException::class) + fun getAdditionalProperty(name: String): Any? { + throwIfKeyKnown(name, requiredKeys, optionalKeys) + throwIfKeyNotPresent(name) + return get(name) + } + } + + interface SetterForFoo { + fun getInstance(): MutableMap + fun getBuilderAfterFoo(instance: MutableMap): T + + fun foo(value: String): T { + val instance = getInstance() + instance["foo"] = value + return getBuilderAfterFoo(instance) + } + } + + class NotMapBuilder: UnsetAddPropsSetter, GenericBuilder>, SetterForFoo { + private val knownKeys: Set = setOf( + "foo" + ) + override fun getKnownKeys(): Set { + return knownKeys + } + private val instance: MutableMap + init { + this.instance = LinkedHashMap() + } + override fun build(): Map { + return instance + } + override fun getInstance(): MutableMap { + return instance + } + override fun getBuilderAfterFoo(instance: MutableMap): NotMapBuilder { + return this + } + override fun getBuilderAfterAdditionalProperty(instance: MutableMap): NotMapBuilder { + return this + } + } + + + sealed interface NotBoxed { + fun getData(): Any? + } + + data class NotBoxedMap(val data: NotMap) : NotBoxed { + override fun getData(): Any? { + return data + } + } + + + class Not private constructor(): JsonSchema( + JsonSchemaInfo() + .type(setOf(Map::class.java)) + .properties(mapOf( + "foo" to Foo::class.java + )) + ), MapSchemaValidator { + + companion object { + @Volatile + private var instance: Not? = null + + fun getInstance() = + instance ?: synchronized(this) { + instance ?: Not().also { instance = it } + } + } + + override fun getNewInstance(arg: Map<*, *>, pathToItem: List, pathToSchemas: PathToSchemasMap): NotMap { + val properties: LinkedHashMap = LinkedHashMap() + for((entryKey, value) in arg) { + if (!(entryKey is String)) { + throw RuntimeException("Invalid non-string key value") + } + val propertyPathToItem: List = pathToItem + entryKey + val schemas: LinkedHashMap, Nothing?>? = pathToSchemas.get(propertyPathToItem) + if (schemas == null) { + throw RuntimeException("Validation result is invalid, schemas must exist for a pathToItem") + } + val propertySchema: JsonSchema<*> = schemas.entries.iterator().next().key + val propertyInstance: Any? = propertySchema.getNewInstance(value, propertyPathToItem, pathToSchemas) + properties[entryKey] = propertyInstance + } + val castProperties: FrozenMap = FrozenMap(properties) + return NotMap(castProperties) + } + + @Throws(ValidationException::class) + override fun validate(arg: Map<*, *>, configuration: SchemaConfiguration?): NotMap { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, PathToSchemasMap(), LinkedHashSet()) + val pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet) + return getNewInstance(castArg, validationMetadata.pathToItem, pathToSchemasMap) + } + + + @Throws(ValidationException::class) + override fun validate(arg: Any?, configuration: SchemaConfiguration?): Any? { + if (arg is Map<*, *>) { + return validate(arg, configuration) + } + throw ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema") + } + override fun getNewInstance(arg: Any?, pathToItem: List, pathToSchemas: PathToSchemasMap): Any? { + if (arg is Map<*, *>) { + return getNewInstance(arg, pathToItem, pathToSchemas) + } + throw RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema") + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: Map<*, *>, configuration: SchemaConfiguration?): NotBoxedMap { + return NotBoxedMap(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: Any?, configuration: SchemaConfiguration?): NotBoxed { + if (arg is Map<*, *>) { + return validateAndBox(arg, configuration) + } + throw ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema") + } + } + + + sealed interface NotMoreComplexSchema1Boxed { + fun getData(): Any? + } + + data class NotMoreComplexSchema1BoxedVoid(val data: Nothing?) : NotMoreComplexSchema1Boxed { + override fun getData(): Any? { + return data + } + } + + data class NotMoreComplexSchema1BoxedBoolean(val data: Boolean): NotMoreComplexSchema1Boxed { + override fun getData(): Any? { + return data + } + } + + data class NotMoreComplexSchema1BoxedNumber(val data: Number) : NotMoreComplexSchema1Boxed { + override fun getData(): Any? { + return data + } + } + + data class NotMoreComplexSchema1BoxedString(val data: String) : NotMoreComplexSchema1Boxed { + override fun getData(): Any? { + return data + } + } + + data class NotMoreComplexSchema1BoxedList(val data: FrozenList) : NotMoreComplexSchema1Boxed { + override fun getData(): Any? { + return data + } + } + + data class NotMoreComplexSchema1BoxedMap(val data: FrozenMap) : NotMoreComplexSchema1Boxed { + override fun getData(): Any? { + return data + } + } + + + class NotMoreComplexSchema1 private constructor(): JsonSchema( + JsonSchemaInfo() + .not(Not::class.java) + ), NullSchemaValidator, BooleanSchemaValidator, NumberSchemaValidator, StringSchemaValidator, ListSchemaValidator, NotMoreComplexSchema1BoxedList>, MapSchemaValidator, NotMoreComplexSchema1BoxedMap> { + /* + NOTE: This class is auto generated by OpenAPI JSON Schema Generator. + Ref: https://github.com/openapi-json-schema-tools/openapi-json-schema-generator + + Do not edit the class manually. + */ + + companion object { + @Volatile + private var instance: NotMoreComplexSchema1? = null + + fun getInstance() = + instance ?: synchronized(this) { + instance ?: NotMoreComplexSchema1().also { instance = it } + } + } + + @Throws(ValidationException::class) + override fun validate(arg: Nothing?, configuration: SchemaConfiguration?): Nothing? { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validatedPathToSchemas = PathToSchemasMap() + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, LinkedHashSet()) + getPathToSchemas(this, castArg, validationMetadata, pathSet) + return castArg + } + + @Throws(ValidationException::class) + override fun validate(arg: Boolean, configuration: SchemaConfiguration?): Boolean { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validatedPathToSchemas = PathToSchemasMap() + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, LinkedHashSet()) + getPathToSchemas(this, castArg, validationMetadata, pathSet) + return castArg + } + + @Throws(ValidationException::class) + override fun validate(arg: Number, configuration: SchemaConfiguration?): Number { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validatedPathToSchemas = PathToSchemasMap() + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, LinkedHashSet()) + getPathToSchemas(this, castArg, validationMetadata, pathSet) + return castArg + } + + @Throws(ValidationException::class) + fun validate(arg: Int, configuration: SchemaConfiguration?): Int { + return validate(arg as Number, configuration) as Int + } + + @Throws(ValidationException::class) + fun validate(arg: Long, configuration: SchemaConfiguration?): Long { + return validate(arg as Number, configuration) as Long + } + + @Throws(ValidationException::class) + fun validate(arg: Float, configuration: SchemaConfiguration?): Float { + return validate(arg as Number, configuration) as Float + } + + @Throws(ValidationException::class) + fun validate(arg: Double, configuration: SchemaConfiguration?): Double { + return validate(arg as Number, configuration) as Double + } + + @Throws(ValidationException::class) + override fun validate(arg: String, configuration: SchemaConfiguration?): String { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validatedPathToSchemas = PathToSchemasMap() + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, LinkedHashSet()) + getPathToSchemas(this, castArg, validationMetadata, pathSet) + return castArg + } + + @Throws(ValidationException::class) + fun validate(arg: LocalDate, configuration: SchemaConfiguration?): String { + return validate(arg.toString(), configuration) + } + + @Throws(ValidationException::class) + fun validate(arg: ZonedDateTime, configuration: SchemaConfiguration?): String { + return validate(arg.toString(), configuration) + } + + @Throws(ValidationException::class) + fun validate(arg: UUID, configuration: SchemaConfiguration?): String { + return validate(arg.toString(), configuration) + } + + override fun getNewInstance(arg: List<*>, pathToItem: List, pathToSchemas: PathToSchemasMap): FrozenList { + val items: MutableList = ArrayList() + var i: Int = 0 + for (item: Any? in arg) { + val itemPathToItem = pathToItem + i + val schemas: LinkedHashMap, Nothing?>? = pathToSchemas.get(itemPathToItem) + if (schemas == null) { + throw RuntimeException("Validation result is invalid, schemas must exist for a pathToItem") + } + val itemSchema: JsonSchema<*> = schemas.entries.iterator().next().key + val itemInstance: Any? = itemSchema.getNewInstance(item, itemPathToItem, pathToSchemas) + items.add(itemInstance) + i += 1 + } + val newInstanceItems: FrozenList = FrozenList(items) + return newInstanceItems + } + + @Throws(ValidationException::class) + override fun validate(arg: List<*>, configuration: SchemaConfiguration?): FrozenList { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, PathToSchemasMap(), LinkedHashSet()) + val pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet) + return getNewInstance(castArg, validationMetadata.pathToItem, pathToSchemasMap) + } + + override fun getNewInstance(arg: Map<*, *>, pathToItem: List, pathToSchemas: PathToSchemasMap): FrozenMap { + val properties: LinkedHashMap = LinkedHashMap() + for((propertyName, value) in arg) { + if (!(propertyName is String)) { + throw RuntimeException("Invalid non-string key value") + } + val propertyPathToItem: List = pathToItem + propertyName + val schemas: LinkedHashMap, Nothing?>? = pathToSchemas.get(propertyPathToItem) + if (schemas == null) { + throw RuntimeException("Validation result is invalid, schemas must exist for a pathToItem") + } + val propertySchema: JsonSchema<*> = schemas.entries.iterator().next().key + val propertyInstance: Any? = propertySchema.getNewInstance(value, propertyPathToItem, pathToSchemas) + properties[propertyName] = propertyInstance + } + val castProperties: FrozenMap = FrozenMap(properties) + return castProperties + } + + @Throws(ValidationException::class) + override fun validate(arg: Map<*, *>, configuration: SchemaConfiguration?): FrozenMap { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validatedPathToSchemas = PathToSchemasMap() + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, LinkedHashSet()) + val pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet) + return getNewInstance(castArg, validationMetadata.pathToItem, pathToSchemasMap) + } + + @Throws(ValidationException::class) + override fun validate(arg: Any?, configuration: SchemaConfiguration?): Any? { + if (arg == null) { + return validate(null, configuration) + } else if (arg is Boolean) { + return validate(arg, configuration) + } else if (arg is Number) { + return validate(arg, configuration) + } else if (arg is String) { + return validate(arg, configuration) + } else if (arg is List<*>) { + return validate(arg, configuration) + } else if (arg is Map<*, *>) { + return validate(arg, configuration) + } + throw ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema") + } + override fun getNewInstance(arg: Any?, pathToItem: List, pathToSchemas: PathToSchemasMap): Any? { + if (arg == null) { + return getNewInstance( null, pathToItem, pathToSchemas) + } else if (arg is Boolean) { + return getNewInstance(arg, pathToItem, pathToSchemas) + } else if (arg is Number) { + return getNewInstance(arg, pathToItem, pathToSchemas) + } else if (arg is String) { + return getNewInstance(arg, pathToItem, pathToSchemas) + } else if (arg is List<*>) { + return getNewInstance(arg, pathToItem, pathToSchemas) + } else if (arg is Map<*, *>) { + return getNewInstance(arg, pathToItem, pathToSchemas) + } + throw RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema") + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: Nothing?, configuration: SchemaConfiguration?): NotMoreComplexSchema1BoxedVoid { + return NotMoreComplexSchema1BoxedVoid(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: Boolean, configuration: SchemaConfiguration?): NotMoreComplexSchema1BoxedBoolean { + return NotMoreComplexSchema1BoxedBoolean(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: Number, configuration: SchemaConfiguration?): NotMoreComplexSchema1BoxedNumber { + return NotMoreComplexSchema1BoxedNumber(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: String, configuration: SchemaConfiguration?): NotMoreComplexSchema1BoxedString { + return NotMoreComplexSchema1BoxedString(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: List<*>, configuration: SchemaConfiguration?): NotMoreComplexSchema1BoxedList { + return NotMoreComplexSchema1BoxedList(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: Map<*, *>, configuration: SchemaConfiguration?): NotMoreComplexSchema1BoxedMap { + return NotMoreComplexSchema1BoxedMap(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: Any?, configuration: SchemaConfiguration?): NotMoreComplexSchema1Boxed { + if (arg == null) { + return validateAndBox(null, configuration) + } else if (arg is Boolean) { + return validateAndBox(arg, configuration) + } else if (arg is String) { + return validateAndBox(arg, configuration) + } else if (arg is Number) { + return validateAndBox(arg, configuration) + } else if (arg is List<*>) { + return validateAndBox(arg, configuration) + } else if (arg is Map<*, *>) { + return validateAndBox(arg, configuration) + } + throw ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema") + } + } +} diff --git a/samples/client/3_0_3_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/schemas/NulCharactersInStrings.kt b/samples/client/3_0_3_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/schemas/NulCharactersInStrings.kt new file mode 100644 index 00000000000..4117850d7fd --- /dev/null +++ b/samples/client/3_0_3_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/schemas/NulCharactersInStrings.kt @@ -0,0 +1,104 @@ +package org.openapijsonschematools.client.components.schemas +import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags +import org.openapijsonschematools.client.configurations.SchemaConfiguration +import org.openapijsonschematools.client.exceptions.ValidationException +import org.openapijsonschematools.client.schemas.validation.JsonSchema +import org.openapijsonschematools.client.schemas.validation.JsonSchemaInfo +import org.openapijsonschematools.client.schemas.validation.PathToSchemasMap +import org.openapijsonschematools.client.schemas.validation.StringEnumValidator +import org.openapijsonschematools.client.schemas.validation.StringSchemaValidator +import org.openapijsonschematools.client.schemas.validation.StringValueMethod +import org.openapijsonschematools.client.schemas.validation.ValidationMetadata + +class NulCharactersInStrings { + // nest classes so all schemas and input/output classes can be public + + enum class StringNulCharactersInStringsEnums(private val value: String): StringValueMethod { + HELLO_NULL_THERE("hello\u0000there"); + + override fun value(): String { + return this.value + } + } + + + sealed interface NulCharactersInStrings1Boxed { + fun getData(): Any? + } + + data class NulCharactersInStrings1BoxedString(val data: String) : NulCharactersInStrings1Boxed { + override fun getData(): Any? { + return data + } + } + + + + class NulCharactersInStrings1 private constructor(): JsonSchema( + JsonSchemaInfo() + .type(setOf( + String::class.java + )) + .enumValues(setOf( + "hello\u0000there" + )) + ), StringSchemaValidator, StringEnumValidator { + /* + NOTE: This class is auto generated by OpenAPI JSON Schema Generator. + Ref: https://github.com/openapi-json-schema-tools/openapi-json-schema-generator + + Do not edit the class manually. + */ + + companion object { + @Volatile + private var instance: NulCharactersInStrings1? = null + + fun getInstance() = + instance ?: synchronized(this) { + instance ?: NulCharactersInStrings1().also { instance = it } + } + } + + @Throws(ValidationException::class) + override fun validate(arg: String, configuration: SchemaConfiguration?): String { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, PathToSchemasMap(), LinkedHashSet()) + getPathToSchemas(this, castArg, validationMetadata, pathSet) + return castArg + } + + @Throws(ValidationException::class) + override fun validate(arg: StringNulCharactersInStringsEnums, configuration: SchemaConfiguration?): String { + return validate(arg.value(), configuration) + } + + @Throws(ValidationException::class) + override fun validate(arg: Any?, configuration: SchemaConfiguration?): Any? { + if (arg is String) { + return validate(arg, configuration) + } + throw ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema") + } + override fun getNewInstance(arg: Any?, pathToItem: List, pathToSchemas: PathToSchemasMap): Any? { + if (arg is String) { + return getNewInstance(arg, pathToItem, pathToSchemas) + } + throw RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema") + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: String, configuration: SchemaConfiguration?): NulCharactersInStrings1BoxedString { + return NulCharactersInStrings1BoxedString(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: Any?, configuration: SchemaConfiguration?): NulCharactersInStrings1Boxed { + if (arg is String) { + return validateAndBox(arg, configuration) + } + throw ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema") + } + } +} diff --git a/samples/client/3_0_3_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/schemas/NullTypeMatchesOnlyTheNullObject.kt b/samples/client/3_0_3_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/schemas/NullTypeMatchesOnlyTheNullObject.kt new file mode 100644 index 00000000000..d4dfe771cb3 --- /dev/null +++ b/samples/client/3_0_3_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/schemas/NullTypeMatchesOnlyTheNullObject.kt @@ -0,0 +1,20 @@ +package org.openapijsonschematools.client.components.schemas +import org.openapijsonschematools.client.schemas.NullJsonSchema + +class NullTypeMatchesOnlyTheNullObject: NullJsonSchema() { + // nest classes so all schemas and input/output classes can be public + + + class NullTypeMatchesOnlyTheNullObject1 : NullJsonSchema.NullJsonSchema1() { + companion object { + @Volatile + private var instance: NullTypeMatchesOnlyTheNullObject1? = null + + fun getInstance() = + instance ?: synchronized(this) { + instance ?: NullTypeMatchesOnlyTheNullObject1().also { instance = it } + } + } + } + +} diff --git a/samples/client/3_0_3_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/schemas/NumberTypeMatchesNumbers.kt b/samples/client/3_0_3_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/schemas/NumberTypeMatchesNumbers.kt new file mode 100644 index 00000000000..6cd4a213c71 --- /dev/null +++ b/samples/client/3_0_3_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/schemas/NumberTypeMatchesNumbers.kt @@ -0,0 +1,20 @@ +package org.openapijsonschematools.client.components.schemas +import org.openapijsonschematools.client.schemas.NumberJsonSchema + +class NumberTypeMatchesNumbers: NumberJsonSchema() { + // nest classes so all schemas and input/output classes can be public + + + class NumberTypeMatchesNumbers1 : NumberJsonSchema.NumberJsonSchema1() { + companion object { + @Volatile + private var instance: NumberTypeMatchesNumbers1? = null + + fun getInstance() = + instance ?: synchronized(this) { + instance ?: NumberTypeMatchesNumbers1().also { instance = it } + } + } + } + +} diff --git a/samples/client/3_0_3_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/schemas/ObjectPropertiesValidation.kt b/samples/client/3_0_3_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/schemas/ObjectPropertiesValidation.kt new file mode 100644 index 00000000000..9eaf12687f3 --- /dev/null +++ b/samples/client/3_0_3_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/schemas/ObjectPropertiesValidation.kt @@ -0,0 +1,453 @@ +package org.openapijsonschematools.client.components.schemas +import java.time.LocalDate +import java.time.ZonedDateTime +import java.util.UUID +import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags +import org.openapijsonschematools.client.configurations.SchemaConfiguration +import org.openapijsonschematools.client.exceptions.InvalidAdditionalPropertyException +import org.openapijsonschematools.client.exceptions.UnsetPropertyException +import org.openapijsonschematools.client.exceptions.ValidationException +import org.openapijsonschematools.client.schemas.GenericBuilder +import org.openapijsonschematools.client.schemas.IntJsonSchema +import org.openapijsonschematools.client.schemas.StringJsonSchema +import org.openapijsonschematools.client.schemas.UnsetAddPropsSetter +import org.openapijsonschematools.client.schemas.validation.BooleanSchemaValidator +import org.openapijsonschematools.client.schemas.validation.FrozenList +import org.openapijsonschematools.client.schemas.validation.FrozenMap +import org.openapijsonschematools.client.schemas.validation.JsonSchema +import org.openapijsonschematools.client.schemas.validation.JsonSchemaInfo +import org.openapijsonschematools.client.schemas.validation.ListSchemaValidator +import org.openapijsonschematools.client.schemas.validation.MapSchemaValidator +import org.openapijsonschematools.client.schemas.validation.NullSchemaValidator +import org.openapijsonschematools.client.schemas.validation.NumberSchemaValidator +import org.openapijsonschematools.client.schemas.validation.PathToSchemasMap +import org.openapijsonschematools.client.schemas.validation.StringSchemaValidator +import org.openapijsonschematools.client.schemas.validation.ValidationMetadata + +class ObjectPropertiesValidation { + // nest classes so all schemas and input/output classes can be public + + + class Foo : IntJsonSchema.IntJsonSchema1() { + companion object { + @Volatile + private var instance: Foo? = null + + fun getInstance() = + instance ?: synchronized(this) { + instance ?: Foo().also { instance = it } + } + } + } + + + class Bar : StringJsonSchema.StringJsonSchema1() { + companion object { + @Volatile + private var instance: Bar? = null + + fun getInstance() = + instance ?: synchronized(this) { + instance ?: Bar().also { instance = it } + } + } + } + + + class ObjectPropertiesValidationMap(m: FrozenMap) : FrozenMap(m) { + companion object { + val requiredKeys: Set = setOf() + val optionalKeys: Set = setOf( + "foo", + "bar" + ) + @Throws(ValidationException::class) + fun of(arg: Map, configuration: SchemaConfiguration): ObjectPropertiesValidationMap { + return ObjectPropertiesValidation1.getInstance().validate(arg, configuration) + } + } + + @Throws(UnsetPropertyException::class) + fun foo(): Number { + val key = "foo" + throwIfKeyNotPresent(key) + val value: Any? = get(key) + if (!(value is Number)) { + throw RuntimeException("Invalid value stored for foo") + } + return value + } + + @Throws(UnsetPropertyException::class) + fun bar(): String { + val key = "bar" + throwIfKeyNotPresent(key) + val value: Any? = get(key) + if (!(value is String)) { + throw RuntimeException("Invalid value stored for bar") + } + return value + } + + @Throws(UnsetPropertyException::class, InvalidAdditionalPropertyException::class) + fun getAdditionalProperty(name: String): Any? { + throwIfKeyKnown(name, requiredKeys, optionalKeys) + throwIfKeyNotPresent(name) + return get(name) + } + } + + interface SetterForFoo { + fun getInstance(): MutableMap + fun getBuilderAfterFoo(instance: MutableMap): T + + fun foo(value: Int): T { + val instance = getInstance() + instance["foo"] = value + return getBuilderAfterFoo(instance) + } + + fun foo(value: Float): T { + val instance = getInstance() + instance["foo"] = value + return getBuilderAfterFoo(instance) + } + + fun foo(value: Long): T { + val instance = getInstance() + instance["foo"] = value + return getBuilderAfterFoo(instance) + } + + fun foo(value: Double): T { + val instance = getInstance() + instance["foo"] = value + return getBuilderAfterFoo(instance) + } + } + + interface SetterForBar { + fun getInstance(): MutableMap + fun getBuilderAfterBar(instance: MutableMap): T + + fun bar(value: String): T { + val instance = getInstance() + instance["bar"] = value + return getBuilderAfterBar(instance) + } + } + + class ObjectPropertiesValidationMapBuilder: UnsetAddPropsSetter, GenericBuilder>, SetterForFoo, SetterForBar { + private val knownKeys: Set = setOf( + "foo", + "bar" + ) + override fun getKnownKeys(): Set { + return knownKeys + } + private val instance: MutableMap + init { + this.instance = LinkedHashMap() + } + override fun build(): Map { + return instance + } + override fun getInstance(): MutableMap { + return instance + } + override fun getBuilderAfterFoo(instance: MutableMap): ObjectPropertiesValidationMapBuilder { + return this + } + override fun getBuilderAfterBar(instance: MutableMap): ObjectPropertiesValidationMapBuilder { + return this + } + override fun getBuilderAfterAdditionalProperty(instance: MutableMap): ObjectPropertiesValidationMapBuilder { + return this + } + } + + + sealed interface ObjectPropertiesValidation1Boxed { + fun getData(): Any? + } + + data class ObjectPropertiesValidation1BoxedVoid(val data: Nothing?) : ObjectPropertiesValidation1Boxed { + override fun getData(): Any? { + return data + } + } + + data class ObjectPropertiesValidation1BoxedBoolean(val data: Boolean): ObjectPropertiesValidation1Boxed { + override fun getData(): Any? { + return data + } + } + + data class ObjectPropertiesValidation1BoxedNumber(val data: Number) : ObjectPropertiesValidation1Boxed { + override fun getData(): Any? { + return data + } + } + + data class ObjectPropertiesValidation1BoxedString(val data: String) : ObjectPropertiesValidation1Boxed { + override fun getData(): Any? { + return data + } + } + + data class ObjectPropertiesValidation1BoxedList(val data: FrozenList) : ObjectPropertiesValidation1Boxed { + override fun getData(): Any? { + return data + } + } + + data class ObjectPropertiesValidation1BoxedMap(val data: ObjectPropertiesValidationMap) : ObjectPropertiesValidation1Boxed { + override fun getData(): Any? { + return data + } + } + + + class ObjectPropertiesValidation1 private constructor(): JsonSchema( + JsonSchemaInfo() + .properties(mapOf( + "foo" to Foo::class.java, + "bar" to Bar::class.java + )) + ), NullSchemaValidator, BooleanSchemaValidator, NumberSchemaValidator, StringSchemaValidator, ListSchemaValidator, ObjectPropertiesValidation1BoxedList>, MapSchemaValidator { + /* + NOTE: This class is auto generated by OpenAPI JSON Schema Generator. + Ref: https://github.com/openapi-json-schema-tools/openapi-json-schema-generator + + Do not edit the class manually. + */ + + companion object { + @Volatile + private var instance: ObjectPropertiesValidation1? = null + + fun getInstance() = + instance ?: synchronized(this) { + instance ?: ObjectPropertiesValidation1().also { instance = it } + } + } + + @Throws(ValidationException::class) + override fun validate(arg: Nothing?, configuration: SchemaConfiguration?): Nothing? { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validatedPathToSchemas = PathToSchemasMap() + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, LinkedHashSet()) + getPathToSchemas(this, castArg, validationMetadata, pathSet) + return castArg + } + + @Throws(ValidationException::class) + override fun validate(arg: Boolean, configuration: SchemaConfiguration?): Boolean { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validatedPathToSchemas = PathToSchemasMap() + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, LinkedHashSet()) + getPathToSchemas(this, castArg, validationMetadata, pathSet) + return castArg + } + + @Throws(ValidationException::class) + override fun validate(arg: Number, configuration: SchemaConfiguration?): Number { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validatedPathToSchemas = PathToSchemasMap() + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, LinkedHashSet()) + getPathToSchemas(this, castArg, validationMetadata, pathSet) + return castArg + } + + @Throws(ValidationException::class) + fun validate(arg: Int, configuration: SchemaConfiguration?): Int { + return validate(arg as Number, configuration) as Int + } + + @Throws(ValidationException::class) + fun validate(arg: Long, configuration: SchemaConfiguration?): Long { + return validate(arg as Number, configuration) as Long + } + + @Throws(ValidationException::class) + fun validate(arg: Float, configuration: SchemaConfiguration?): Float { + return validate(arg as Number, configuration) as Float + } + + @Throws(ValidationException::class) + fun validate(arg: Double, configuration: SchemaConfiguration?): Double { + return validate(arg as Number, configuration) as Double + } + + @Throws(ValidationException::class) + override fun validate(arg: String, configuration: SchemaConfiguration?): String { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validatedPathToSchemas = PathToSchemasMap() + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, LinkedHashSet()) + getPathToSchemas(this, castArg, validationMetadata, pathSet) + return castArg + } + + @Throws(ValidationException::class) + fun validate(arg: LocalDate, configuration: SchemaConfiguration?): String { + return validate(arg.toString(), configuration) + } + + @Throws(ValidationException::class) + fun validate(arg: ZonedDateTime, configuration: SchemaConfiguration?): String { + return validate(arg.toString(), configuration) + } + + @Throws(ValidationException::class) + fun validate(arg: UUID, configuration: SchemaConfiguration?): String { + return validate(arg.toString(), configuration) + } + + override fun getNewInstance(arg: List<*>, pathToItem: List, pathToSchemas: PathToSchemasMap): FrozenList { + val items: MutableList = ArrayList() + var i: Int = 0 + for (item: Any? in arg) { + val itemPathToItem = pathToItem + i + val schemas: LinkedHashMap, Nothing?>? = pathToSchemas.get(itemPathToItem) + if (schemas == null) { + throw RuntimeException("Validation result is invalid, schemas must exist for a pathToItem") + } + val itemSchema: JsonSchema<*> = schemas.entries.iterator().next().key + val itemInstance: Any? = itemSchema.getNewInstance(item, itemPathToItem, pathToSchemas) + items.add(itemInstance) + i += 1 + } + val newInstanceItems: FrozenList = FrozenList(items) + return newInstanceItems + } + + @Throws(ValidationException::class) + override fun validate(arg: List<*>, configuration: SchemaConfiguration?): FrozenList { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, PathToSchemasMap(), LinkedHashSet()) + val pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet) + return getNewInstance(castArg, validationMetadata.pathToItem, pathToSchemasMap) + } + + override fun getNewInstance(arg: Map<*, *>, pathToItem: List, pathToSchemas: PathToSchemasMap): ObjectPropertiesValidationMap { + val properties: LinkedHashMap = LinkedHashMap() + for((propertyName, value) in arg) { + if (!(propertyName is String)) { + throw RuntimeException("Invalid non-string key value") + } + val propertyPathToItem: List = pathToItem + propertyName + val schemas: LinkedHashMap, Nothing?>? = pathToSchemas.get(propertyPathToItem) + if (schemas == null) { + throw RuntimeException("Validation result is invalid, schemas must exist for a pathToItem") + } + val propertySchema: JsonSchema<*> = schemas.entries.iterator().next().key + val propertyInstance: Any? = propertySchema.getNewInstance(value, propertyPathToItem, pathToSchemas) + properties[propertyName] = propertyInstance + } + val castProperties: FrozenMap = FrozenMap(properties) + return ObjectPropertiesValidationMap(castProperties) + } + + @Throws(ValidationException::class) + override fun validate(arg: Map<*, *>, configuration: SchemaConfiguration?): ObjectPropertiesValidationMap { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validatedPathToSchemas = PathToSchemasMap() + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, LinkedHashSet()) + val pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet) + return getNewInstance(castArg, validationMetadata.pathToItem, pathToSchemasMap) + } + + @Throws(ValidationException::class) + override fun validate(arg: Any?, configuration: SchemaConfiguration?): Any? { + if (arg == null) { + return validate(null, configuration) + } else if (arg is Boolean) { + return validate(arg, configuration) + } else if (arg is Number) { + return validate(arg, configuration) + } else if (arg is String) { + return validate(arg, configuration) + } else if (arg is List<*>) { + return validate(arg, configuration) + } else if (arg is Map<*, *>) { + return validate(arg, configuration) + } + throw ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema") + } + override fun getNewInstance(arg: Any?, pathToItem: List, pathToSchemas: PathToSchemasMap): Any? { + if (arg == null) { + return getNewInstance( null, pathToItem, pathToSchemas) + } else if (arg is Boolean) { + return getNewInstance(arg, pathToItem, pathToSchemas) + } else if (arg is Number) { + return getNewInstance(arg, pathToItem, pathToSchemas) + } else if (arg is String) { + return getNewInstance(arg, pathToItem, pathToSchemas) + } else if (arg is List<*>) { + return getNewInstance(arg, pathToItem, pathToSchemas) + } else if (arg is Map<*, *>) { + return getNewInstance(arg, pathToItem, pathToSchemas) + } + throw RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema") + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: Nothing?, configuration: SchemaConfiguration?): ObjectPropertiesValidation1BoxedVoid { + return ObjectPropertiesValidation1BoxedVoid(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: Boolean, configuration: SchemaConfiguration?): ObjectPropertiesValidation1BoxedBoolean { + return ObjectPropertiesValidation1BoxedBoolean(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: Number, configuration: SchemaConfiguration?): ObjectPropertiesValidation1BoxedNumber { + return ObjectPropertiesValidation1BoxedNumber(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: String, configuration: SchemaConfiguration?): ObjectPropertiesValidation1BoxedString { + return ObjectPropertiesValidation1BoxedString(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: List<*>, configuration: SchemaConfiguration?): ObjectPropertiesValidation1BoxedList { + return ObjectPropertiesValidation1BoxedList(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: Map<*, *>, configuration: SchemaConfiguration?): ObjectPropertiesValidation1BoxedMap { + return ObjectPropertiesValidation1BoxedMap(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: Any?, configuration: SchemaConfiguration?): ObjectPropertiesValidation1Boxed { + if (arg == null) { + return validateAndBox(null, configuration) + } else if (arg is Boolean) { + return validateAndBox(arg, configuration) + } else if (arg is String) { + return validateAndBox(arg, configuration) + } else if (arg is Number) { + return validateAndBox(arg, configuration) + } else if (arg is List<*>) { + return validateAndBox(arg, configuration) + } else if (arg is Map<*, *>) { + return validateAndBox(arg, configuration) + } + throw ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema") + } + } +} diff --git a/samples/client/3_0_3_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/schemas/ObjectTypeMatchesObjects.kt b/samples/client/3_0_3_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/schemas/ObjectTypeMatchesObjects.kt new file mode 100644 index 00000000000..0cb08cb0b8f --- /dev/null +++ b/samples/client/3_0_3_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/schemas/ObjectTypeMatchesObjects.kt @@ -0,0 +1,21 @@ +package org.openapijsonschematools.client.components.schemas +import org.openapijsonschematools.client.schemas.MapJsonSchema +import org.openapijsonschematools.client.schemas.validation.FrozenMap + +class ObjectTypeMatchesObjects: MapJsonSchema() { + // nest classes so all schemas and input/output classes can be public + + + class ObjectTypeMatchesObjects1 : MapJsonSchema.MapJsonSchema1() { + companion object { + @Volatile + private var instance: ObjectTypeMatchesObjects1? = null + + fun getInstance() = + instance ?: synchronized(this) { + instance ?: ObjectTypeMatchesObjects1().also { instance = it } + } + } + } + +} diff --git a/samples/client/3_0_3_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/schemas/Oneof.kt b/samples/client/3_0_3_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/schemas/Oneof.kt new file mode 100644 index 00000000000..a3ca5e860ba --- /dev/null +++ b/samples/client/3_0_3_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/schemas/Oneof.kt @@ -0,0 +1,600 @@ +package org.openapijsonschematools.client.components.schemas +import java.time.LocalDate +import java.time.ZonedDateTime +import java.util.UUID +import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags +import org.openapijsonschematools.client.configurations.SchemaConfiguration +import org.openapijsonschematools.client.exceptions.InvalidAdditionalPropertyException +import org.openapijsonschematools.client.exceptions.UnsetPropertyException +import org.openapijsonschematools.client.exceptions.ValidationException +import org.openapijsonschematools.client.schemas.IntJsonSchema +import org.openapijsonschematools.client.schemas.UnsetAddPropsSetter +import org.openapijsonschematools.client.schemas.validation.BooleanSchemaValidator +import org.openapijsonschematools.client.schemas.validation.FrozenList +import org.openapijsonschematools.client.schemas.validation.FrozenMap +import org.openapijsonschematools.client.schemas.validation.JsonSchema +import org.openapijsonschematools.client.schemas.validation.JsonSchemaInfo +import org.openapijsonschematools.client.schemas.validation.ListSchemaValidator +import org.openapijsonschematools.client.schemas.validation.MapSchemaValidator +import org.openapijsonschematools.client.schemas.validation.NullSchemaValidator +import org.openapijsonschematools.client.schemas.validation.NumberSchemaValidator +import org.openapijsonschematools.client.schemas.validation.PathToSchemasMap +import org.openapijsonschematools.client.schemas.validation.StringSchemaValidator +import org.openapijsonschematools.client.schemas.validation.ValidationMetadata + +class Oneof { + // nest classes so all schemas and input/output classes can be public + + + class Schema0 : IntJsonSchema.IntJsonSchema1() { + companion object { + @Volatile + private var instance: Schema0? = null + + fun getInstance() = + instance ?: synchronized(this) { + instance ?: Schema0().also { instance = it } + } + } + } + + + sealed interface Schema1Boxed { + fun getData(): Any? + } + + data class Schema1BoxedVoid(val data: Nothing?) : Schema1Boxed { + override fun getData(): Any? { + return data + } + } + + data class Schema1BoxedBoolean(val data: Boolean): Schema1Boxed { + override fun getData(): Any? { + return data + } + } + + data class Schema1BoxedNumber(val data: Number) : Schema1Boxed { + override fun getData(): Any? { + return data + } + } + + data class Schema1BoxedString(val data: String) : Schema1Boxed { + override fun getData(): Any? { + return data + } + } + + data class Schema1BoxedList(val data: FrozenList) : Schema1Boxed { + override fun getData(): Any? { + return data + } + } + + data class Schema1BoxedMap(val data: FrozenMap) : Schema1Boxed { + override fun getData(): Any? { + return data + } + } + + + class Schema1 private constructor(): JsonSchema( + JsonSchemaInfo() + .minimum(2) + ), NullSchemaValidator, BooleanSchemaValidator, NumberSchemaValidator, StringSchemaValidator, ListSchemaValidator, Schema1BoxedList>, MapSchemaValidator, Schema1BoxedMap> { + + companion object { + @Volatile + private var instance: Schema1? = null + + fun getInstance() = + instance ?: synchronized(this) { + instance ?: Schema1().also { instance = it } + } + } + + @Throws(ValidationException::class) + override fun validate(arg: Nothing?, configuration: SchemaConfiguration?): Nothing? { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validatedPathToSchemas = PathToSchemasMap() + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, LinkedHashSet()) + getPathToSchemas(this, castArg, validationMetadata, pathSet) + return castArg + } + + @Throws(ValidationException::class) + override fun validate(arg: Boolean, configuration: SchemaConfiguration?): Boolean { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validatedPathToSchemas = PathToSchemasMap() + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, LinkedHashSet()) + getPathToSchemas(this, castArg, validationMetadata, pathSet) + return castArg + } + + @Throws(ValidationException::class) + override fun validate(arg: Number, configuration: SchemaConfiguration?): Number { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validatedPathToSchemas = PathToSchemasMap() + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, LinkedHashSet()) + getPathToSchemas(this, castArg, validationMetadata, pathSet) + return castArg + } + + @Throws(ValidationException::class) + fun validate(arg: Int, configuration: SchemaConfiguration?): Int { + return validate(arg as Number, configuration) as Int + } + + @Throws(ValidationException::class) + fun validate(arg: Long, configuration: SchemaConfiguration?): Long { + return validate(arg as Number, configuration) as Long + } + + @Throws(ValidationException::class) + fun validate(arg: Float, configuration: SchemaConfiguration?): Float { + return validate(arg as Number, configuration) as Float + } + + @Throws(ValidationException::class) + fun validate(arg: Double, configuration: SchemaConfiguration?): Double { + return validate(arg as Number, configuration) as Double + } + + @Throws(ValidationException::class) + override fun validate(arg: String, configuration: SchemaConfiguration?): String { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validatedPathToSchemas = PathToSchemasMap() + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, LinkedHashSet()) + getPathToSchemas(this, castArg, validationMetadata, pathSet) + return castArg + } + + @Throws(ValidationException::class) + fun validate(arg: LocalDate, configuration: SchemaConfiguration?): String { + return validate(arg.toString(), configuration) + } + + @Throws(ValidationException::class) + fun validate(arg: ZonedDateTime, configuration: SchemaConfiguration?): String { + return validate(arg.toString(), configuration) + } + + @Throws(ValidationException::class) + fun validate(arg: UUID, configuration: SchemaConfiguration?): String { + return validate(arg.toString(), configuration) + } + + override fun getNewInstance(arg: List<*>, pathToItem: List, pathToSchemas: PathToSchemasMap): FrozenList { + val items: MutableList = ArrayList() + var i: Int = 0 + for (item: Any? in arg) { + val itemPathToItem = pathToItem + i + val schemas: LinkedHashMap, Nothing?>? = pathToSchemas.get(itemPathToItem) + if (schemas == null) { + throw RuntimeException("Validation result is invalid, schemas must exist for a pathToItem") + } + val itemSchema: JsonSchema<*> = schemas.entries.iterator().next().key + val itemInstance: Any? = itemSchema.getNewInstance(item, itemPathToItem, pathToSchemas) + items.add(itemInstance) + i += 1 + } + val newInstanceItems: FrozenList = FrozenList(items) + return newInstanceItems + } + + @Throws(ValidationException::class) + override fun validate(arg: List<*>, configuration: SchemaConfiguration?): FrozenList { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, PathToSchemasMap(), LinkedHashSet()) + val pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet) + return getNewInstance(castArg, validationMetadata.pathToItem, pathToSchemasMap) + } + + override fun getNewInstance(arg: Map<*, *>, pathToItem: List, pathToSchemas: PathToSchemasMap): FrozenMap { + val properties: LinkedHashMap = LinkedHashMap() + for((propertyName, value) in arg) { + if (!(propertyName is String)) { + throw RuntimeException("Invalid non-string key value") + } + val propertyPathToItem: List = pathToItem + propertyName + val schemas: LinkedHashMap, Nothing?>? = pathToSchemas.get(propertyPathToItem) + if (schemas == null) { + throw RuntimeException("Validation result is invalid, schemas must exist for a pathToItem") + } + val propertySchema: JsonSchema<*> = schemas.entries.iterator().next().key + val propertyInstance: Any? = propertySchema.getNewInstance(value, propertyPathToItem, pathToSchemas) + properties[propertyName] = propertyInstance + } + val castProperties: FrozenMap = FrozenMap(properties) + return castProperties + } + + @Throws(ValidationException::class) + override fun validate(arg: Map<*, *>, configuration: SchemaConfiguration?): FrozenMap { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validatedPathToSchemas = PathToSchemasMap() + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, LinkedHashSet()) + val pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet) + return getNewInstance(castArg, validationMetadata.pathToItem, pathToSchemasMap) + } + + @Throws(ValidationException::class) + override fun validate(arg: Any?, configuration: SchemaConfiguration?): Any? { + if (arg == null) { + return validate(null, configuration) + } else if (arg is Boolean) { + return validate(arg, configuration) + } else if (arg is Number) { + return validate(arg, configuration) + } else if (arg is String) { + return validate(arg, configuration) + } else if (arg is List<*>) { + return validate(arg, configuration) + } else if (arg is Map<*, *>) { + return validate(arg, configuration) + } + throw ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema") + } + override fun getNewInstance(arg: Any?, pathToItem: List, pathToSchemas: PathToSchemasMap): Any? { + if (arg == null) { + return getNewInstance( null, pathToItem, pathToSchemas) + } else if (arg is Boolean) { + return getNewInstance(arg, pathToItem, pathToSchemas) + } else if (arg is Number) { + return getNewInstance(arg, pathToItem, pathToSchemas) + } else if (arg is String) { + return getNewInstance(arg, pathToItem, pathToSchemas) + } else if (arg is List<*>) { + return getNewInstance(arg, pathToItem, pathToSchemas) + } else if (arg is Map<*, *>) { + return getNewInstance(arg, pathToItem, pathToSchemas) + } + throw RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema") + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: Nothing?, configuration: SchemaConfiguration?): Schema1BoxedVoid { + return Schema1BoxedVoid(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: Boolean, configuration: SchemaConfiguration?): Schema1BoxedBoolean { + return Schema1BoxedBoolean(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: Number, configuration: SchemaConfiguration?): Schema1BoxedNumber { + return Schema1BoxedNumber(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: String, configuration: SchemaConfiguration?): Schema1BoxedString { + return Schema1BoxedString(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: List<*>, configuration: SchemaConfiguration?): Schema1BoxedList { + return Schema1BoxedList(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: Map<*, *>, configuration: SchemaConfiguration?): Schema1BoxedMap { + return Schema1BoxedMap(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: Any?, configuration: SchemaConfiguration?): Schema1Boxed { + if (arg == null) { + return validateAndBox(null, configuration) + } else if (arg is Boolean) { + return validateAndBox(arg, configuration) + } else if (arg is String) { + return validateAndBox(arg, configuration) + } else if (arg is Number) { + return validateAndBox(arg, configuration) + } else if (arg is List<*>) { + return validateAndBox(arg, configuration) + } else if (arg is Map<*, *>) { + return validateAndBox(arg, configuration) + } + throw ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema") + } + } + + sealed interface Oneof1Boxed { + fun getData(): Any? + } + + data class Oneof1BoxedVoid(val data: Nothing?) : Oneof1Boxed { + override fun getData(): Any? { + return data + } + } + + data class Oneof1BoxedBoolean(val data: Boolean): Oneof1Boxed { + override fun getData(): Any? { + return data + } + } + + data class Oneof1BoxedNumber(val data: Number) : Oneof1Boxed { + override fun getData(): Any? { + return data + } + } + + data class Oneof1BoxedString(val data: String) : Oneof1Boxed { + override fun getData(): Any? { + return data + } + } + + data class Oneof1BoxedList(val data: FrozenList) : Oneof1Boxed { + override fun getData(): Any? { + return data + } + } + + data class Oneof1BoxedMap(val data: FrozenMap) : Oneof1Boxed { + override fun getData(): Any? { + return data + } + } + + + class Oneof1 private constructor(): JsonSchema( + JsonSchemaInfo() + .oneOf(listOf( + Schema0::class.java, + Schema1::class.java + )) + ), NullSchemaValidator, BooleanSchemaValidator, NumberSchemaValidator, StringSchemaValidator, ListSchemaValidator, Oneof1BoxedList>, MapSchemaValidator, Oneof1BoxedMap> { + /* + NOTE: This class is auto generated by OpenAPI JSON Schema Generator. + Ref: https://github.com/openapi-json-schema-tools/openapi-json-schema-generator + + Do not edit the class manually. + */ + + companion object { + @Volatile + private var instance: Oneof1? = null + + fun getInstance() = + instance ?: synchronized(this) { + instance ?: Oneof1().also { instance = it } + } + } + + @Throws(ValidationException::class) + override fun validate(arg: Nothing?, configuration: SchemaConfiguration?): Nothing? { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validatedPathToSchemas = PathToSchemasMap() + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, LinkedHashSet()) + getPathToSchemas(this, castArg, validationMetadata, pathSet) + return castArg + } + + @Throws(ValidationException::class) + override fun validate(arg: Boolean, configuration: SchemaConfiguration?): Boolean { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validatedPathToSchemas = PathToSchemasMap() + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, LinkedHashSet()) + getPathToSchemas(this, castArg, validationMetadata, pathSet) + return castArg + } + + @Throws(ValidationException::class) + override fun validate(arg: Number, configuration: SchemaConfiguration?): Number { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validatedPathToSchemas = PathToSchemasMap() + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, LinkedHashSet()) + getPathToSchemas(this, castArg, validationMetadata, pathSet) + return castArg + } + + @Throws(ValidationException::class) + fun validate(arg: Int, configuration: SchemaConfiguration?): Int { + return validate(arg as Number, configuration) as Int + } + + @Throws(ValidationException::class) + fun validate(arg: Long, configuration: SchemaConfiguration?): Long { + return validate(arg as Number, configuration) as Long + } + + @Throws(ValidationException::class) + fun validate(arg: Float, configuration: SchemaConfiguration?): Float { + return validate(arg as Number, configuration) as Float + } + + @Throws(ValidationException::class) + fun validate(arg: Double, configuration: SchemaConfiguration?): Double { + return validate(arg as Number, configuration) as Double + } + + @Throws(ValidationException::class) + override fun validate(arg: String, configuration: SchemaConfiguration?): String { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validatedPathToSchemas = PathToSchemasMap() + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, LinkedHashSet()) + getPathToSchemas(this, castArg, validationMetadata, pathSet) + return castArg + } + + @Throws(ValidationException::class) + fun validate(arg: LocalDate, configuration: SchemaConfiguration?): String { + return validate(arg.toString(), configuration) + } + + @Throws(ValidationException::class) + fun validate(arg: ZonedDateTime, configuration: SchemaConfiguration?): String { + return validate(arg.toString(), configuration) + } + + @Throws(ValidationException::class) + fun validate(arg: UUID, configuration: SchemaConfiguration?): String { + return validate(arg.toString(), configuration) + } + + override fun getNewInstance(arg: List<*>, pathToItem: List, pathToSchemas: PathToSchemasMap): FrozenList { + val items: MutableList = ArrayList() + var i: Int = 0 + for (item: Any? in arg) { + val itemPathToItem = pathToItem + i + val schemas: LinkedHashMap, Nothing?>? = pathToSchemas.get(itemPathToItem) + if (schemas == null) { + throw RuntimeException("Validation result is invalid, schemas must exist for a pathToItem") + } + val itemSchema: JsonSchema<*> = schemas.entries.iterator().next().key + val itemInstance: Any? = itemSchema.getNewInstance(item, itemPathToItem, pathToSchemas) + items.add(itemInstance) + i += 1 + } + val newInstanceItems: FrozenList = FrozenList(items) + return newInstanceItems + } + + @Throws(ValidationException::class) + override fun validate(arg: List<*>, configuration: SchemaConfiguration?): FrozenList { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, PathToSchemasMap(), LinkedHashSet()) + val pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet) + return getNewInstance(castArg, validationMetadata.pathToItem, pathToSchemasMap) + } + + override fun getNewInstance(arg: Map<*, *>, pathToItem: List, pathToSchemas: PathToSchemasMap): FrozenMap { + val properties: LinkedHashMap = LinkedHashMap() + for((propertyName, value) in arg) { + if (!(propertyName is String)) { + throw RuntimeException("Invalid non-string key value") + } + val propertyPathToItem: List = pathToItem + propertyName + val schemas: LinkedHashMap, Nothing?>? = pathToSchemas.get(propertyPathToItem) + if (schemas == null) { + throw RuntimeException("Validation result is invalid, schemas must exist for a pathToItem") + } + val propertySchema: JsonSchema<*> = schemas.entries.iterator().next().key + val propertyInstance: Any? = propertySchema.getNewInstance(value, propertyPathToItem, pathToSchemas) + properties[propertyName] = propertyInstance + } + val castProperties: FrozenMap = FrozenMap(properties) + return castProperties + } + + @Throws(ValidationException::class) + override fun validate(arg: Map<*, *>, configuration: SchemaConfiguration?): FrozenMap { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validatedPathToSchemas = PathToSchemasMap() + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, LinkedHashSet()) + val pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet) + return getNewInstance(castArg, validationMetadata.pathToItem, pathToSchemasMap) + } + + @Throws(ValidationException::class) + override fun validate(arg: Any?, configuration: SchemaConfiguration?): Any? { + if (arg == null) { + return validate(null, configuration) + } else if (arg is Boolean) { + return validate(arg, configuration) + } else if (arg is Number) { + return validate(arg, configuration) + } else if (arg is String) { + return validate(arg, configuration) + } else if (arg is List<*>) { + return validate(arg, configuration) + } else if (arg is Map<*, *>) { + return validate(arg, configuration) + } + throw ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema") + } + override fun getNewInstance(arg: Any?, pathToItem: List, pathToSchemas: PathToSchemasMap): Any? { + if (arg == null) { + return getNewInstance( null, pathToItem, pathToSchemas) + } else if (arg is Boolean) { + return getNewInstance(arg, pathToItem, pathToSchemas) + } else if (arg is Number) { + return getNewInstance(arg, pathToItem, pathToSchemas) + } else if (arg is String) { + return getNewInstance(arg, pathToItem, pathToSchemas) + } else if (arg is List<*>) { + return getNewInstance(arg, pathToItem, pathToSchemas) + } else if (arg is Map<*, *>) { + return getNewInstance(arg, pathToItem, pathToSchemas) + } + throw RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema") + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: Nothing?, configuration: SchemaConfiguration?): Oneof1BoxedVoid { + return Oneof1BoxedVoid(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: Boolean, configuration: SchemaConfiguration?): Oneof1BoxedBoolean { + return Oneof1BoxedBoolean(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: Number, configuration: SchemaConfiguration?): Oneof1BoxedNumber { + return Oneof1BoxedNumber(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: String, configuration: SchemaConfiguration?): Oneof1BoxedString { + return Oneof1BoxedString(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: List<*>, configuration: SchemaConfiguration?): Oneof1BoxedList { + return Oneof1BoxedList(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: Map<*, *>, configuration: SchemaConfiguration?): Oneof1BoxedMap { + return Oneof1BoxedMap(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: Any?, configuration: SchemaConfiguration?): Oneof1Boxed { + if (arg == null) { + return validateAndBox(null, configuration) + } else if (arg is Boolean) { + return validateAndBox(arg, configuration) + } else if (arg is String) { + return validateAndBox(arg, configuration) + } else if (arg is Number) { + return validateAndBox(arg, configuration) + } else if (arg is List<*>) { + return validateAndBox(arg, configuration) + } else if (arg is Map<*, *>) { + return validateAndBox(arg, configuration) + } + throw ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema") + } + } +} diff --git a/samples/client/3_0_3_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/schemas/OneofComplexTypes.kt b/samples/client/3_0_3_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/schemas/OneofComplexTypes.kt new file mode 100644 index 00000000000..0810d902fbb --- /dev/null +++ b/samples/client/3_0_3_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/schemas/OneofComplexTypes.kt @@ -0,0 +1,1060 @@ +package org.openapijsonschematools.client.components.schemas +import java.time.LocalDate +import java.time.ZonedDateTime +import java.util.UUID +import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags +import org.openapijsonschematools.client.configurations.SchemaConfiguration +import org.openapijsonschematools.client.exceptions.InvalidAdditionalPropertyException +import org.openapijsonschematools.client.exceptions.UnsetPropertyException +import org.openapijsonschematools.client.exceptions.ValidationException +import org.openapijsonschematools.client.schemas.GenericBuilder +import org.openapijsonschematools.client.schemas.IntJsonSchema +import org.openapijsonschematools.client.schemas.StringJsonSchema +import org.openapijsonschematools.client.schemas.UnsetAddPropsSetter +import org.openapijsonschematools.client.schemas.validation.BooleanSchemaValidator +import org.openapijsonschematools.client.schemas.validation.FrozenList +import org.openapijsonschematools.client.schemas.validation.FrozenMap +import org.openapijsonschematools.client.schemas.validation.JsonSchema +import org.openapijsonschematools.client.schemas.validation.JsonSchemaInfo +import org.openapijsonschematools.client.schemas.validation.ListSchemaValidator +import org.openapijsonschematools.client.schemas.validation.MapSchemaValidator +import org.openapijsonschematools.client.schemas.validation.NullSchemaValidator +import org.openapijsonschematools.client.schemas.validation.NumberSchemaValidator +import org.openapijsonschematools.client.schemas.validation.PathToSchemasMap +import org.openapijsonschematools.client.schemas.validation.StringSchemaValidator +import org.openapijsonschematools.client.schemas.validation.ValidationMetadata + +class OneofComplexTypes { + // nest classes so all schemas and input/output classes can be public + + + class Bar : IntJsonSchema.IntJsonSchema1() { + companion object { + @Volatile + private var instance: Bar? = null + + fun getInstance() = + instance ?: synchronized(this) { + instance ?: Bar().also { instance = it } + } + } + } + + + class Schema0Map(m: FrozenMap) : FrozenMap(m) { + companion object { + val requiredKeys: Set = setOf( + "bar" + ) + val optionalKeys: Set = setOf() + @Throws(ValidationException::class) + fun of(arg: Map, configuration: SchemaConfiguration): Schema0Map { + return Schema0.getInstance().validate(arg, configuration) + } + } + + fun bar(): Number { + val value: Any? = get("bar") + if (!(value is Number)) { + throw RuntimeException("Invalid value stored for bar") + } + return value + } + + @Throws(UnsetPropertyException::class, InvalidAdditionalPropertyException::class) + fun getAdditionalProperty(name: String): Any? { + throwIfKeyKnown(name, requiredKeys, optionalKeys) + throwIfKeyNotPresent(name) + return get(name) + } + } + + interface SetterForBar { + fun getInstance(): MutableMap + fun getBuilderAfterBar(instance: MutableMap): T + + fun bar(value: Int): T { + val instance = getInstance() + instance["bar"] = value + return getBuilderAfterBar(instance) + } + + fun bar(value: Float): T { + val instance = getInstance() + instance["bar"] = value + return getBuilderAfterBar(instance) + } + + fun bar(value: Long): T { + val instance = getInstance() + instance["bar"] = value + return getBuilderAfterBar(instance) + } + + fun bar(value: Double): T { + val instance = getInstance() + instance["bar"] = value + return getBuilderAfterBar(instance) + } + } + + class Schema0Map0Builder(private val instance: MutableMap): UnsetAddPropsSetter, GenericBuilder> { + private val knownKeys: Set = setOf( + "bar" + ) + override fun getKnownKeys(): Set { + return knownKeys + } + override fun build(): Map { + return instance + } + override fun getInstance(): MutableMap { + return instance + } + override fun getBuilderAfterAdditionalProperty(instance: MutableMap): Schema0Map0Builder { + return this + } + } + + class Schema0MapBuilder: SetterForBar { + private val instance: MutableMap + init { + this.instance = LinkedHashMap() + } + override fun getInstance(): MutableMap { + return instance + } + override fun getBuilderAfterBar(instance: MutableMap): Schema0Map0Builder { + return Schema0Map0Builder(instance) + } + } + + + sealed interface Schema0Boxed { + fun getData(): Any? + } + + data class Schema0BoxedVoid(val data: Nothing?) : Schema0Boxed { + override fun getData(): Any? { + return data + } + } + + data class Schema0BoxedBoolean(val data: Boolean): Schema0Boxed { + override fun getData(): Any? { + return data + } + } + + data class Schema0BoxedNumber(val data: Number) : Schema0Boxed { + override fun getData(): Any? { + return data + } + } + + data class Schema0BoxedString(val data: String) : Schema0Boxed { + override fun getData(): Any? { + return data + } + } + + data class Schema0BoxedList(val data: FrozenList) : Schema0Boxed { + override fun getData(): Any? { + return data + } + } + + data class Schema0BoxedMap(val data: Schema0Map) : Schema0Boxed { + override fun getData(): Any? { + return data + } + } + + + class Schema0 private constructor(): JsonSchema( + JsonSchemaInfo() + .properties(mapOf( + "bar" to Bar::class.java + )) + .required(setOf( + "bar" + )) + ), NullSchemaValidator, BooleanSchemaValidator, NumberSchemaValidator, StringSchemaValidator, ListSchemaValidator, Schema0BoxedList>, MapSchemaValidator { + + companion object { + @Volatile + private var instance: Schema0? = null + + fun getInstance() = + instance ?: synchronized(this) { + instance ?: Schema0().also { instance = it } + } + } + + @Throws(ValidationException::class) + override fun validate(arg: Nothing?, configuration: SchemaConfiguration?): Nothing? { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validatedPathToSchemas = PathToSchemasMap() + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, LinkedHashSet()) + getPathToSchemas(this, castArg, validationMetadata, pathSet) + return castArg + } + + @Throws(ValidationException::class) + override fun validate(arg: Boolean, configuration: SchemaConfiguration?): Boolean { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validatedPathToSchemas = PathToSchemasMap() + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, LinkedHashSet()) + getPathToSchemas(this, castArg, validationMetadata, pathSet) + return castArg + } + + @Throws(ValidationException::class) + override fun validate(arg: Number, configuration: SchemaConfiguration?): Number { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validatedPathToSchemas = PathToSchemasMap() + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, LinkedHashSet()) + getPathToSchemas(this, castArg, validationMetadata, pathSet) + return castArg + } + + @Throws(ValidationException::class) + fun validate(arg: Int, configuration: SchemaConfiguration?): Int { + return validate(arg as Number, configuration) as Int + } + + @Throws(ValidationException::class) + fun validate(arg: Long, configuration: SchemaConfiguration?): Long { + return validate(arg as Number, configuration) as Long + } + + @Throws(ValidationException::class) + fun validate(arg: Float, configuration: SchemaConfiguration?): Float { + return validate(arg as Number, configuration) as Float + } + + @Throws(ValidationException::class) + fun validate(arg: Double, configuration: SchemaConfiguration?): Double { + return validate(arg as Number, configuration) as Double + } + + @Throws(ValidationException::class) + override fun validate(arg: String, configuration: SchemaConfiguration?): String { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validatedPathToSchemas = PathToSchemasMap() + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, LinkedHashSet()) + getPathToSchemas(this, castArg, validationMetadata, pathSet) + return castArg + } + + @Throws(ValidationException::class) + fun validate(arg: LocalDate, configuration: SchemaConfiguration?): String { + return validate(arg.toString(), configuration) + } + + @Throws(ValidationException::class) + fun validate(arg: ZonedDateTime, configuration: SchemaConfiguration?): String { + return validate(arg.toString(), configuration) + } + + @Throws(ValidationException::class) + fun validate(arg: UUID, configuration: SchemaConfiguration?): String { + return validate(arg.toString(), configuration) + } + + override fun getNewInstance(arg: List<*>, pathToItem: List, pathToSchemas: PathToSchemasMap): FrozenList { + val items: MutableList = ArrayList() + var i: Int = 0 + for (item: Any? in arg) { + val itemPathToItem = pathToItem + i + val schemas: LinkedHashMap, Nothing?>? = pathToSchemas.get(itemPathToItem) + if (schemas == null) { + throw RuntimeException("Validation result is invalid, schemas must exist for a pathToItem") + } + val itemSchema: JsonSchema<*> = schemas.entries.iterator().next().key + val itemInstance: Any? = itemSchema.getNewInstance(item, itemPathToItem, pathToSchemas) + items.add(itemInstance) + i += 1 + } + val newInstanceItems: FrozenList = FrozenList(items) + return newInstanceItems + } + + @Throws(ValidationException::class) + override fun validate(arg: List<*>, configuration: SchemaConfiguration?): FrozenList { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, PathToSchemasMap(), LinkedHashSet()) + val pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet) + return getNewInstance(castArg, validationMetadata.pathToItem, pathToSchemasMap) + } + + override fun getNewInstance(arg: Map<*, *>, pathToItem: List, pathToSchemas: PathToSchemasMap): Schema0Map { + val properties: LinkedHashMap = LinkedHashMap() + for((propertyName, value) in arg) { + if (!(propertyName is String)) { + throw RuntimeException("Invalid non-string key value") + } + val propertyPathToItem: List = pathToItem + propertyName + val schemas: LinkedHashMap, Nothing?>? = pathToSchemas.get(propertyPathToItem) + if (schemas == null) { + throw RuntimeException("Validation result is invalid, schemas must exist for a pathToItem") + } + val propertySchema: JsonSchema<*> = schemas.entries.iterator().next().key + val propertyInstance: Any? = propertySchema.getNewInstance(value, propertyPathToItem, pathToSchemas) + properties[propertyName] = propertyInstance + } + val castProperties: FrozenMap = FrozenMap(properties) + return Schema0Map(castProperties) + } + + @Throws(ValidationException::class) + override fun validate(arg: Map<*, *>, configuration: SchemaConfiguration?): Schema0Map { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validatedPathToSchemas = PathToSchemasMap() + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, LinkedHashSet()) + val pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet) + return getNewInstance(castArg, validationMetadata.pathToItem, pathToSchemasMap) + } + + @Throws(ValidationException::class) + override fun validate(arg: Any?, configuration: SchemaConfiguration?): Any? { + if (arg == null) { + return validate(null, configuration) + } else if (arg is Boolean) { + return validate(arg, configuration) + } else if (arg is Number) { + return validate(arg, configuration) + } else if (arg is String) { + return validate(arg, configuration) + } else if (arg is List<*>) { + return validate(arg, configuration) + } else if (arg is Map<*, *>) { + return validate(arg, configuration) + } + throw ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema") + } + override fun getNewInstance(arg: Any?, pathToItem: List, pathToSchemas: PathToSchemasMap): Any? { + if (arg == null) { + return getNewInstance( null, pathToItem, pathToSchemas) + } else if (arg is Boolean) { + return getNewInstance(arg, pathToItem, pathToSchemas) + } else if (arg is Number) { + return getNewInstance(arg, pathToItem, pathToSchemas) + } else if (arg is String) { + return getNewInstance(arg, pathToItem, pathToSchemas) + } else if (arg is List<*>) { + return getNewInstance(arg, pathToItem, pathToSchemas) + } else if (arg is Map<*, *>) { + return getNewInstance(arg, pathToItem, pathToSchemas) + } + throw RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema") + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: Nothing?, configuration: SchemaConfiguration?): Schema0BoxedVoid { + return Schema0BoxedVoid(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: Boolean, configuration: SchemaConfiguration?): Schema0BoxedBoolean { + return Schema0BoxedBoolean(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: Number, configuration: SchemaConfiguration?): Schema0BoxedNumber { + return Schema0BoxedNumber(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: String, configuration: SchemaConfiguration?): Schema0BoxedString { + return Schema0BoxedString(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: List<*>, configuration: SchemaConfiguration?): Schema0BoxedList { + return Schema0BoxedList(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: Map<*, *>, configuration: SchemaConfiguration?): Schema0BoxedMap { + return Schema0BoxedMap(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: Any?, configuration: SchemaConfiguration?): Schema0Boxed { + if (arg == null) { + return validateAndBox(null, configuration) + } else if (arg is Boolean) { + return validateAndBox(arg, configuration) + } else if (arg is String) { + return validateAndBox(arg, configuration) + } else if (arg is Number) { + return validateAndBox(arg, configuration) + } else if (arg is List<*>) { + return validateAndBox(arg, configuration) + } else if (arg is Map<*, *>) { + return validateAndBox(arg, configuration) + } + throw ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema") + } + } + + class Foo : StringJsonSchema.StringJsonSchema1() { + companion object { + @Volatile + private var instance: Foo? = null + + fun getInstance() = + instance ?: synchronized(this) { + instance ?: Foo().also { instance = it } + } + } + } + + + class Schema1Map(m: FrozenMap) : FrozenMap(m) { + companion object { + val requiredKeys: Set = setOf( + "foo" + ) + val optionalKeys: Set = setOf() + @Throws(ValidationException::class) + fun of(arg: Map, configuration: SchemaConfiguration): Schema1Map { + return Schema1.getInstance().validate(arg, configuration) + } + } + + fun foo(): String { + val value: Any? = get("foo") + if (!(value is String)) { + throw RuntimeException("Invalid value stored for foo") + } + return value + } + + @Throws(UnsetPropertyException::class, InvalidAdditionalPropertyException::class) + fun getAdditionalProperty(name: String): Any? { + throwIfKeyKnown(name, requiredKeys, optionalKeys) + throwIfKeyNotPresent(name) + return get(name) + } + } + + interface SetterForFoo { + fun getInstance(): MutableMap + fun getBuilderAfterFoo(instance: MutableMap): T + + fun foo(value: String): T { + val instance = getInstance() + instance["foo"] = value + return getBuilderAfterFoo(instance) + } + } + + class Schema1Map0Builder(private val instance: MutableMap): UnsetAddPropsSetter, GenericBuilder> { + private val knownKeys: Set = setOf( + "foo" + ) + override fun getKnownKeys(): Set { + return knownKeys + } + override fun build(): Map { + return instance + } + override fun getInstance(): MutableMap { + return instance + } + override fun getBuilderAfterAdditionalProperty(instance: MutableMap): Schema1Map0Builder { + return this + } + } + + class Schema1MapBuilder: SetterForFoo { + private val instance: MutableMap + init { + this.instance = LinkedHashMap() + } + override fun getInstance(): MutableMap { + return instance + } + override fun getBuilderAfterFoo(instance: MutableMap): Schema1Map0Builder { + return Schema1Map0Builder(instance) + } + } + + + sealed interface Schema1Boxed { + fun getData(): Any? + } + + data class Schema1BoxedVoid(val data: Nothing?) : Schema1Boxed { + override fun getData(): Any? { + return data + } + } + + data class Schema1BoxedBoolean(val data: Boolean): Schema1Boxed { + override fun getData(): Any? { + return data + } + } + + data class Schema1BoxedNumber(val data: Number) : Schema1Boxed { + override fun getData(): Any? { + return data + } + } + + data class Schema1BoxedString(val data: String) : Schema1Boxed { + override fun getData(): Any? { + return data + } + } + + data class Schema1BoxedList(val data: FrozenList) : Schema1Boxed { + override fun getData(): Any? { + return data + } + } + + data class Schema1BoxedMap(val data: Schema1Map) : Schema1Boxed { + override fun getData(): Any? { + return data + } + } + + + class Schema1 private constructor(): JsonSchema( + JsonSchemaInfo() + .properties(mapOf( + "foo" to Foo::class.java + )) + .required(setOf( + "foo" + )) + ), NullSchemaValidator, BooleanSchemaValidator, NumberSchemaValidator, StringSchemaValidator, ListSchemaValidator, Schema1BoxedList>, MapSchemaValidator { + + companion object { + @Volatile + private var instance: Schema1? = null + + fun getInstance() = + instance ?: synchronized(this) { + instance ?: Schema1().also { instance = it } + } + } + + @Throws(ValidationException::class) + override fun validate(arg: Nothing?, configuration: SchemaConfiguration?): Nothing? { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validatedPathToSchemas = PathToSchemasMap() + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, LinkedHashSet()) + getPathToSchemas(this, castArg, validationMetadata, pathSet) + return castArg + } + + @Throws(ValidationException::class) + override fun validate(arg: Boolean, configuration: SchemaConfiguration?): Boolean { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validatedPathToSchemas = PathToSchemasMap() + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, LinkedHashSet()) + getPathToSchemas(this, castArg, validationMetadata, pathSet) + return castArg + } + + @Throws(ValidationException::class) + override fun validate(arg: Number, configuration: SchemaConfiguration?): Number { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validatedPathToSchemas = PathToSchemasMap() + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, LinkedHashSet()) + getPathToSchemas(this, castArg, validationMetadata, pathSet) + return castArg + } + + @Throws(ValidationException::class) + fun validate(arg: Int, configuration: SchemaConfiguration?): Int { + return validate(arg as Number, configuration) as Int + } + + @Throws(ValidationException::class) + fun validate(arg: Long, configuration: SchemaConfiguration?): Long { + return validate(arg as Number, configuration) as Long + } + + @Throws(ValidationException::class) + fun validate(arg: Float, configuration: SchemaConfiguration?): Float { + return validate(arg as Number, configuration) as Float + } + + @Throws(ValidationException::class) + fun validate(arg: Double, configuration: SchemaConfiguration?): Double { + return validate(arg as Number, configuration) as Double + } + + @Throws(ValidationException::class) + override fun validate(arg: String, configuration: SchemaConfiguration?): String { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validatedPathToSchemas = PathToSchemasMap() + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, LinkedHashSet()) + getPathToSchemas(this, castArg, validationMetadata, pathSet) + return castArg + } + + @Throws(ValidationException::class) + fun validate(arg: LocalDate, configuration: SchemaConfiguration?): String { + return validate(arg.toString(), configuration) + } + + @Throws(ValidationException::class) + fun validate(arg: ZonedDateTime, configuration: SchemaConfiguration?): String { + return validate(arg.toString(), configuration) + } + + @Throws(ValidationException::class) + fun validate(arg: UUID, configuration: SchemaConfiguration?): String { + return validate(arg.toString(), configuration) + } + + override fun getNewInstance(arg: List<*>, pathToItem: List, pathToSchemas: PathToSchemasMap): FrozenList { + val items: MutableList = ArrayList() + var i: Int = 0 + for (item: Any? in arg) { + val itemPathToItem = pathToItem + i + val schemas: LinkedHashMap, Nothing?>? = pathToSchemas.get(itemPathToItem) + if (schemas == null) { + throw RuntimeException("Validation result is invalid, schemas must exist for a pathToItem") + } + val itemSchema: JsonSchema<*> = schemas.entries.iterator().next().key + val itemInstance: Any? = itemSchema.getNewInstance(item, itemPathToItem, pathToSchemas) + items.add(itemInstance) + i += 1 + } + val newInstanceItems: FrozenList = FrozenList(items) + return newInstanceItems + } + + @Throws(ValidationException::class) + override fun validate(arg: List<*>, configuration: SchemaConfiguration?): FrozenList { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, PathToSchemasMap(), LinkedHashSet()) + val pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet) + return getNewInstance(castArg, validationMetadata.pathToItem, pathToSchemasMap) + } + + override fun getNewInstance(arg: Map<*, *>, pathToItem: List, pathToSchemas: PathToSchemasMap): Schema1Map { + val properties: LinkedHashMap = LinkedHashMap() + for((propertyName, value) in arg) { + if (!(propertyName is String)) { + throw RuntimeException("Invalid non-string key value") + } + val propertyPathToItem: List = pathToItem + propertyName + val schemas: LinkedHashMap, Nothing?>? = pathToSchemas.get(propertyPathToItem) + if (schemas == null) { + throw RuntimeException("Validation result is invalid, schemas must exist for a pathToItem") + } + val propertySchema: JsonSchema<*> = schemas.entries.iterator().next().key + val propertyInstance: Any? = propertySchema.getNewInstance(value, propertyPathToItem, pathToSchemas) + properties[propertyName] = propertyInstance + } + val castProperties: FrozenMap = FrozenMap(properties) + return Schema1Map(castProperties) + } + + @Throws(ValidationException::class) + override fun validate(arg: Map<*, *>, configuration: SchemaConfiguration?): Schema1Map { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validatedPathToSchemas = PathToSchemasMap() + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, LinkedHashSet()) + val pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet) + return getNewInstance(castArg, validationMetadata.pathToItem, pathToSchemasMap) + } + + @Throws(ValidationException::class) + override fun validate(arg: Any?, configuration: SchemaConfiguration?): Any? { + if (arg == null) { + return validate(null, configuration) + } else if (arg is Boolean) { + return validate(arg, configuration) + } else if (arg is Number) { + return validate(arg, configuration) + } else if (arg is String) { + return validate(arg, configuration) + } else if (arg is List<*>) { + return validate(arg, configuration) + } else if (arg is Map<*, *>) { + return validate(arg, configuration) + } + throw ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema") + } + override fun getNewInstance(arg: Any?, pathToItem: List, pathToSchemas: PathToSchemasMap): Any? { + if (arg == null) { + return getNewInstance( null, pathToItem, pathToSchemas) + } else if (arg is Boolean) { + return getNewInstance(arg, pathToItem, pathToSchemas) + } else if (arg is Number) { + return getNewInstance(arg, pathToItem, pathToSchemas) + } else if (arg is String) { + return getNewInstance(arg, pathToItem, pathToSchemas) + } else if (arg is List<*>) { + return getNewInstance(arg, pathToItem, pathToSchemas) + } else if (arg is Map<*, *>) { + return getNewInstance(arg, pathToItem, pathToSchemas) + } + throw RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema") + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: Nothing?, configuration: SchemaConfiguration?): Schema1BoxedVoid { + return Schema1BoxedVoid(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: Boolean, configuration: SchemaConfiguration?): Schema1BoxedBoolean { + return Schema1BoxedBoolean(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: Number, configuration: SchemaConfiguration?): Schema1BoxedNumber { + return Schema1BoxedNumber(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: String, configuration: SchemaConfiguration?): Schema1BoxedString { + return Schema1BoxedString(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: List<*>, configuration: SchemaConfiguration?): Schema1BoxedList { + return Schema1BoxedList(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: Map<*, *>, configuration: SchemaConfiguration?): Schema1BoxedMap { + return Schema1BoxedMap(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: Any?, configuration: SchemaConfiguration?): Schema1Boxed { + if (arg == null) { + return validateAndBox(null, configuration) + } else if (arg is Boolean) { + return validateAndBox(arg, configuration) + } else if (arg is String) { + return validateAndBox(arg, configuration) + } else if (arg is Number) { + return validateAndBox(arg, configuration) + } else if (arg is List<*>) { + return validateAndBox(arg, configuration) + } else if (arg is Map<*, *>) { + return validateAndBox(arg, configuration) + } + throw ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema") + } + } + + sealed interface OneofComplexTypes1Boxed { + fun getData(): Any? + } + + data class OneofComplexTypes1BoxedVoid(val data: Nothing?) : OneofComplexTypes1Boxed { + override fun getData(): Any? { + return data + } + } + + data class OneofComplexTypes1BoxedBoolean(val data: Boolean): OneofComplexTypes1Boxed { + override fun getData(): Any? { + return data + } + } + + data class OneofComplexTypes1BoxedNumber(val data: Number) : OneofComplexTypes1Boxed { + override fun getData(): Any? { + return data + } + } + + data class OneofComplexTypes1BoxedString(val data: String) : OneofComplexTypes1Boxed { + override fun getData(): Any? { + return data + } + } + + data class OneofComplexTypes1BoxedList(val data: FrozenList) : OneofComplexTypes1Boxed { + override fun getData(): Any? { + return data + } + } + + data class OneofComplexTypes1BoxedMap(val data: FrozenMap) : OneofComplexTypes1Boxed { + override fun getData(): Any? { + return data + } + } + + + class OneofComplexTypes1 private constructor(): JsonSchema( + JsonSchemaInfo() + .oneOf(listOf( + Schema0::class.java, + Schema1::class.java + )) + ), NullSchemaValidator, BooleanSchemaValidator, NumberSchemaValidator, StringSchemaValidator, ListSchemaValidator, OneofComplexTypes1BoxedList>, MapSchemaValidator, OneofComplexTypes1BoxedMap> { + /* + NOTE: This class is auto generated by OpenAPI JSON Schema Generator. + Ref: https://github.com/openapi-json-schema-tools/openapi-json-schema-generator + + Do not edit the class manually. + */ + + companion object { + @Volatile + private var instance: OneofComplexTypes1? = null + + fun getInstance() = + instance ?: synchronized(this) { + instance ?: OneofComplexTypes1().also { instance = it } + } + } + + @Throws(ValidationException::class) + override fun validate(arg: Nothing?, configuration: SchemaConfiguration?): Nothing? { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validatedPathToSchemas = PathToSchemasMap() + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, LinkedHashSet()) + getPathToSchemas(this, castArg, validationMetadata, pathSet) + return castArg + } + + @Throws(ValidationException::class) + override fun validate(arg: Boolean, configuration: SchemaConfiguration?): Boolean { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validatedPathToSchemas = PathToSchemasMap() + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, LinkedHashSet()) + getPathToSchemas(this, castArg, validationMetadata, pathSet) + return castArg + } + + @Throws(ValidationException::class) + override fun validate(arg: Number, configuration: SchemaConfiguration?): Number { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validatedPathToSchemas = PathToSchemasMap() + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, LinkedHashSet()) + getPathToSchemas(this, castArg, validationMetadata, pathSet) + return castArg + } + + @Throws(ValidationException::class) + fun validate(arg: Int, configuration: SchemaConfiguration?): Int { + return validate(arg as Number, configuration) as Int + } + + @Throws(ValidationException::class) + fun validate(arg: Long, configuration: SchemaConfiguration?): Long { + return validate(arg as Number, configuration) as Long + } + + @Throws(ValidationException::class) + fun validate(arg: Float, configuration: SchemaConfiguration?): Float { + return validate(arg as Number, configuration) as Float + } + + @Throws(ValidationException::class) + fun validate(arg: Double, configuration: SchemaConfiguration?): Double { + return validate(arg as Number, configuration) as Double + } + + @Throws(ValidationException::class) + override fun validate(arg: String, configuration: SchemaConfiguration?): String { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validatedPathToSchemas = PathToSchemasMap() + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, LinkedHashSet()) + getPathToSchemas(this, castArg, validationMetadata, pathSet) + return castArg + } + + @Throws(ValidationException::class) + fun validate(arg: LocalDate, configuration: SchemaConfiguration?): String { + return validate(arg.toString(), configuration) + } + + @Throws(ValidationException::class) + fun validate(arg: ZonedDateTime, configuration: SchemaConfiguration?): String { + return validate(arg.toString(), configuration) + } + + @Throws(ValidationException::class) + fun validate(arg: UUID, configuration: SchemaConfiguration?): String { + return validate(arg.toString(), configuration) + } + + override fun getNewInstance(arg: List<*>, pathToItem: List, pathToSchemas: PathToSchemasMap): FrozenList { + val items: MutableList = ArrayList() + var i: Int = 0 + for (item: Any? in arg) { + val itemPathToItem = pathToItem + i + val schemas: LinkedHashMap, Nothing?>? = pathToSchemas.get(itemPathToItem) + if (schemas == null) { + throw RuntimeException("Validation result is invalid, schemas must exist for a pathToItem") + } + val itemSchema: JsonSchema<*> = schemas.entries.iterator().next().key + val itemInstance: Any? = itemSchema.getNewInstance(item, itemPathToItem, pathToSchemas) + items.add(itemInstance) + i += 1 + } + val newInstanceItems: FrozenList = FrozenList(items) + return newInstanceItems + } + + @Throws(ValidationException::class) + override fun validate(arg: List<*>, configuration: SchemaConfiguration?): FrozenList { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, PathToSchemasMap(), LinkedHashSet()) + val pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet) + return getNewInstance(castArg, validationMetadata.pathToItem, pathToSchemasMap) + } + + override fun getNewInstance(arg: Map<*, *>, pathToItem: List, pathToSchemas: PathToSchemasMap): FrozenMap { + val properties: LinkedHashMap = LinkedHashMap() + for((propertyName, value) in arg) { + if (!(propertyName is String)) { + throw RuntimeException("Invalid non-string key value") + } + val propertyPathToItem: List = pathToItem + propertyName + val schemas: LinkedHashMap, Nothing?>? = pathToSchemas.get(propertyPathToItem) + if (schemas == null) { + throw RuntimeException("Validation result is invalid, schemas must exist for a pathToItem") + } + val propertySchema: JsonSchema<*> = schemas.entries.iterator().next().key + val propertyInstance: Any? = propertySchema.getNewInstance(value, propertyPathToItem, pathToSchemas) + properties[propertyName] = propertyInstance + } + val castProperties: FrozenMap = FrozenMap(properties) + return castProperties + } + + @Throws(ValidationException::class) + override fun validate(arg: Map<*, *>, configuration: SchemaConfiguration?): FrozenMap { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validatedPathToSchemas = PathToSchemasMap() + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, LinkedHashSet()) + val pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet) + return getNewInstance(castArg, validationMetadata.pathToItem, pathToSchemasMap) + } + + @Throws(ValidationException::class) + override fun validate(arg: Any?, configuration: SchemaConfiguration?): Any? { + if (arg == null) { + return validate(null, configuration) + } else if (arg is Boolean) { + return validate(arg, configuration) + } else if (arg is Number) { + return validate(arg, configuration) + } else if (arg is String) { + return validate(arg, configuration) + } else if (arg is List<*>) { + return validate(arg, configuration) + } else if (arg is Map<*, *>) { + return validate(arg, configuration) + } + throw ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema") + } + override fun getNewInstance(arg: Any?, pathToItem: List, pathToSchemas: PathToSchemasMap): Any? { + if (arg == null) { + return getNewInstance( null, pathToItem, pathToSchemas) + } else if (arg is Boolean) { + return getNewInstance(arg, pathToItem, pathToSchemas) + } else if (arg is Number) { + return getNewInstance(arg, pathToItem, pathToSchemas) + } else if (arg is String) { + return getNewInstance(arg, pathToItem, pathToSchemas) + } else if (arg is List<*>) { + return getNewInstance(arg, pathToItem, pathToSchemas) + } else if (arg is Map<*, *>) { + return getNewInstance(arg, pathToItem, pathToSchemas) + } + throw RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema") + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: Nothing?, configuration: SchemaConfiguration?): OneofComplexTypes1BoxedVoid { + return OneofComplexTypes1BoxedVoid(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: Boolean, configuration: SchemaConfiguration?): OneofComplexTypes1BoxedBoolean { + return OneofComplexTypes1BoxedBoolean(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: Number, configuration: SchemaConfiguration?): OneofComplexTypes1BoxedNumber { + return OneofComplexTypes1BoxedNumber(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: String, configuration: SchemaConfiguration?): OneofComplexTypes1BoxedString { + return OneofComplexTypes1BoxedString(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: List<*>, configuration: SchemaConfiguration?): OneofComplexTypes1BoxedList { + return OneofComplexTypes1BoxedList(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: Map<*, *>, configuration: SchemaConfiguration?): OneofComplexTypes1BoxedMap { + return OneofComplexTypes1BoxedMap(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: Any?, configuration: SchemaConfiguration?): OneofComplexTypes1Boxed { + if (arg == null) { + return validateAndBox(null, configuration) + } else if (arg is Boolean) { + return validateAndBox(arg, configuration) + } else if (arg is String) { + return validateAndBox(arg, configuration) + } else if (arg is Number) { + return validateAndBox(arg, configuration) + } else if (arg is List<*>) { + return validateAndBox(arg, configuration) + } else if (arg is Map<*, *>) { + return validateAndBox(arg, configuration) + } + throw ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema") + } + } +} diff --git a/samples/client/3_0_3_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/schemas/OneofWithBaseSchema.kt b/samples/client/3_0_3_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/schemas/OneofWithBaseSchema.kt new file mode 100644 index 00000000000..d82112c6547 --- /dev/null +++ b/samples/client/3_0_3_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/schemas/OneofWithBaseSchema.kt @@ -0,0 +1,653 @@ +package org.openapijsonschematools.client.components.schemas +import java.time.LocalDate +import java.time.ZonedDateTime +import java.util.UUID +import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags +import org.openapijsonschematools.client.configurations.SchemaConfiguration +import org.openapijsonschematools.client.exceptions.InvalidAdditionalPropertyException +import org.openapijsonschematools.client.exceptions.UnsetPropertyException +import org.openapijsonschematools.client.exceptions.ValidationException +import org.openapijsonschematools.client.schemas.UnsetAddPropsSetter +import org.openapijsonschematools.client.schemas.validation.BooleanSchemaValidator +import org.openapijsonschematools.client.schemas.validation.FrozenList +import org.openapijsonschematools.client.schemas.validation.FrozenMap +import org.openapijsonschematools.client.schemas.validation.JsonSchema +import org.openapijsonschematools.client.schemas.validation.JsonSchemaInfo +import org.openapijsonschematools.client.schemas.validation.ListSchemaValidator +import org.openapijsonschematools.client.schemas.validation.MapSchemaValidator +import org.openapijsonschematools.client.schemas.validation.NullSchemaValidator +import org.openapijsonschematools.client.schemas.validation.NumberSchemaValidator +import org.openapijsonschematools.client.schemas.validation.PathToSchemasMap +import org.openapijsonschematools.client.schemas.validation.StringSchemaValidator +import org.openapijsonschematools.client.schemas.validation.ValidationMetadata + +class OneofWithBaseSchema { + // nest classes so all schemas and input/output classes can be public + + + sealed interface Schema0Boxed { + fun getData(): Any? + } + + data class Schema0BoxedVoid(val data: Nothing?) : Schema0Boxed { + override fun getData(): Any? { + return data + } + } + + data class Schema0BoxedBoolean(val data: Boolean): Schema0Boxed { + override fun getData(): Any? { + return data + } + } + + data class Schema0BoxedNumber(val data: Number) : Schema0Boxed { + override fun getData(): Any? { + return data + } + } + + data class Schema0BoxedString(val data: String) : Schema0Boxed { + override fun getData(): Any? { + return data + } + } + + data class Schema0BoxedList(val data: FrozenList) : Schema0Boxed { + override fun getData(): Any? { + return data + } + } + + data class Schema0BoxedMap(val data: FrozenMap) : Schema0Boxed { + override fun getData(): Any? { + return data + } + } + + + class Schema0 private constructor(): JsonSchema( + JsonSchemaInfo() + .minLength(2) + ), NullSchemaValidator, BooleanSchemaValidator, NumberSchemaValidator, StringSchemaValidator, ListSchemaValidator, Schema0BoxedList>, MapSchemaValidator, Schema0BoxedMap> { + + companion object { + @Volatile + private var instance: Schema0? = null + + fun getInstance() = + instance ?: synchronized(this) { + instance ?: Schema0().also { instance = it } + } + } + + @Throws(ValidationException::class) + override fun validate(arg: Nothing?, configuration: SchemaConfiguration?): Nothing? { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validatedPathToSchemas = PathToSchemasMap() + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, LinkedHashSet()) + getPathToSchemas(this, castArg, validationMetadata, pathSet) + return castArg + } + + @Throws(ValidationException::class) + override fun validate(arg: Boolean, configuration: SchemaConfiguration?): Boolean { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validatedPathToSchemas = PathToSchemasMap() + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, LinkedHashSet()) + getPathToSchemas(this, castArg, validationMetadata, pathSet) + return castArg + } + + @Throws(ValidationException::class) + override fun validate(arg: Number, configuration: SchemaConfiguration?): Number { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validatedPathToSchemas = PathToSchemasMap() + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, LinkedHashSet()) + getPathToSchemas(this, castArg, validationMetadata, pathSet) + return castArg + } + + @Throws(ValidationException::class) + fun validate(arg: Int, configuration: SchemaConfiguration?): Int { + return validate(arg as Number, configuration) as Int + } + + @Throws(ValidationException::class) + fun validate(arg: Long, configuration: SchemaConfiguration?): Long { + return validate(arg as Number, configuration) as Long + } + + @Throws(ValidationException::class) + fun validate(arg: Float, configuration: SchemaConfiguration?): Float { + return validate(arg as Number, configuration) as Float + } + + @Throws(ValidationException::class) + fun validate(arg: Double, configuration: SchemaConfiguration?): Double { + return validate(arg as Number, configuration) as Double + } + + @Throws(ValidationException::class) + override fun validate(arg: String, configuration: SchemaConfiguration?): String { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validatedPathToSchemas = PathToSchemasMap() + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, LinkedHashSet()) + getPathToSchemas(this, castArg, validationMetadata, pathSet) + return castArg + } + + @Throws(ValidationException::class) + fun validate(arg: LocalDate, configuration: SchemaConfiguration?): String { + return validate(arg.toString(), configuration) + } + + @Throws(ValidationException::class) + fun validate(arg: ZonedDateTime, configuration: SchemaConfiguration?): String { + return validate(arg.toString(), configuration) + } + + @Throws(ValidationException::class) + fun validate(arg: UUID, configuration: SchemaConfiguration?): String { + return validate(arg.toString(), configuration) + } + + override fun getNewInstance(arg: List<*>, pathToItem: List, pathToSchemas: PathToSchemasMap): FrozenList { + val items: MutableList = ArrayList() + var i: Int = 0 + for (item: Any? in arg) { + val itemPathToItem = pathToItem + i + val schemas: LinkedHashMap, Nothing?>? = pathToSchemas.get(itemPathToItem) + if (schemas == null) { + throw RuntimeException("Validation result is invalid, schemas must exist for a pathToItem") + } + val itemSchema: JsonSchema<*> = schemas.entries.iterator().next().key + val itemInstance: Any? = itemSchema.getNewInstance(item, itemPathToItem, pathToSchemas) + items.add(itemInstance) + i += 1 + } + val newInstanceItems: FrozenList = FrozenList(items) + return newInstanceItems + } + + @Throws(ValidationException::class) + override fun validate(arg: List<*>, configuration: SchemaConfiguration?): FrozenList { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, PathToSchemasMap(), LinkedHashSet()) + val pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet) + return getNewInstance(castArg, validationMetadata.pathToItem, pathToSchemasMap) + } + + override fun getNewInstance(arg: Map<*, *>, pathToItem: List, pathToSchemas: PathToSchemasMap): FrozenMap { + val properties: LinkedHashMap = LinkedHashMap() + for((propertyName, value) in arg) { + if (!(propertyName is String)) { + throw RuntimeException("Invalid non-string key value") + } + val propertyPathToItem: List = pathToItem + propertyName + val schemas: LinkedHashMap, Nothing?>? = pathToSchemas.get(propertyPathToItem) + if (schemas == null) { + throw RuntimeException("Validation result is invalid, schemas must exist for a pathToItem") + } + val propertySchema: JsonSchema<*> = schemas.entries.iterator().next().key + val propertyInstance: Any? = propertySchema.getNewInstance(value, propertyPathToItem, pathToSchemas) + properties[propertyName] = propertyInstance + } + val castProperties: FrozenMap = FrozenMap(properties) + return castProperties + } + + @Throws(ValidationException::class) + override fun validate(arg: Map<*, *>, configuration: SchemaConfiguration?): FrozenMap { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validatedPathToSchemas = PathToSchemasMap() + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, LinkedHashSet()) + val pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet) + return getNewInstance(castArg, validationMetadata.pathToItem, pathToSchemasMap) + } + + @Throws(ValidationException::class) + override fun validate(arg: Any?, configuration: SchemaConfiguration?): Any? { + if (arg == null) { + return validate(null, configuration) + } else if (arg is Boolean) { + return validate(arg, configuration) + } else if (arg is Number) { + return validate(arg, configuration) + } else if (arg is String) { + return validate(arg, configuration) + } else if (arg is List<*>) { + return validate(arg, configuration) + } else if (arg is Map<*, *>) { + return validate(arg, configuration) + } + throw ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema") + } + override fun getNewInstance(arg: Any?, pathToItem: List, pathToSchemas: PathToSchemasMap): Any? { + if (arg == null) { + return getNewInstance( null, pathToItem, pathToSchemas) + } else if (arg is Boolean) { + return getNewInstance(arg, pathToItem, pathToSchemas) + } else if (arg is Number) { + return getNewInstance(arg, pathToItem, pathToSchemas) + } else if (arg is String) { + return getNewInstance(arg, pathToItem, pathToSchemas) + } else if (arg is List<*>) { + return getNewInstance(arg, pathToItem, pathToSchemas) + } else if (arg is Map<*, *>) { + return getNewInstance(arg, pathToItem, pathToSchemas) + } + throw RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema") + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: Nothing?, configuration: SchemaConfiguration?): Schema0BoxedVoid { + return Schema0BoxedVoid(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: Boolean, configuration: SchemaConfiguration?): Schema0BoxedBoolean { + return Schema0BoxedBoolean(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: Number, configuration: SchemaConfiguration?): Schema0BoxedNumber { + return Schema0BoxedNumber(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: String, configuration: SchemaConfiguration?): Schema0BoxedString { + return Schema0BoxedString(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: List<*>, configuration: SchemaConfiguration?): Schema0BoxedList { + return Schema0BoxedList(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: Map<*, *>, configuration: SchemaConfiguration?): Schema0BoxedMap { + return Schema0BoxedMap(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: Any?, configuration: SchemaConfiguration?): Schema0Boxed { + if (arg == null) { + return validateAndBox(null, configuration) + } else if (arg is Boolean) { + return validateAndBox(arg, configuration) + } else if (arg is String) { + return validateAndBox(arg, configuration) + } else if (arg is Number) { + return validateAndBox(arg, configuration) + } else if (arg is List<*>) { + return validateAndBox(arg, configuration) + } else if (arg is Map<*, *>) { + return validateAndBox(arg, configuration) + } + throw ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema") + } + } + + sealed interface Schema1Boxed { + fun getData(): Any? + } + + data class Schema1BoxedVoid(val data: Nothing?) : Schema1Boxed { + override fun getData(): Any? { + return data + } + } + + data class Schema1BoxedBoolean(val data: Boolean): Schema1Boxed { + override fun getData(): Any? { + return data + } + } + + data class Schema1BoxedNumber(val data: Number) : Schema1Boxed { + override fun getData(): Any? { + return data + } + } + + data class Schema1BoxedString(val data: String) : Schema1Boxed { + override fun getData(): Any? { + return data + } + } + + data class Schema1BoxedList(val data: FrozenList) : Schema1Boxed { + override fun getData(): Any? { + return data + } + } + + data class Schema1BoxedMap(val data: FrozenMap) : Schema1Boxed { + override fun getData(): Any? { + return data + } + } + + + class Schema1 private constructor(): JsonSchema( + JsonSchemaInfo() + .maxLength(4) + ), NullSchemaValidator, BooleanSchemaValidator, NumberSchemaValidator, StringSchemaValidator, ListSchemaValidator, Schema1BoxedList>, MapSchemaValidator, Schema1BoxedMap> { + + companion object { + @Volatile + private var instance: Schema1? = null + + fun getInstance() = + instance ?: synchronized(this) { + instance ?: Schema1().also { instance = it } + } + } + + @Throws(ValidationException::class) + override fun validate(arg: Nothing?, configuration: SchemaConfiguration?): Nothing? { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validatedPathToSchemas = PathToSchemasMap() + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, LinkedHashSet()) + getPathToSchemas(this, castArg, validationMetadata, pathSet) + return castArg + } + + @Throws(ValidationException::class) + override fun validate(arg: Boolean, configuration: SchemaConfiguration?): Boolean { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validatedPathToSchemas = PathToSchemasMap() + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, LinkedHashSet()) + getPathToSchemas(this, castArg, validationMetadata, pathSet) + return castArg + } + + @Throws(ValidationException::class) + override fun validate(arg: Number, configuration: SchemaConfiguration?): Number { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validatedPathToSchemas = PathToSchemasMap() + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, LinkedHashSet()) + getPathToSchemas(this, castArg, validationMetadata, pathSet) + return castArg + } + + @Throws(ValidationException::class) + fun validate(arg: Int, configuration: SchemaConfiguration?): Int { + return validate(arg as Number, configuration) as Int + } + + @Throws(ValidationException::class) + fun validate(arg: Long, configuration: SchemaConfiguration?): Long { + return validate(arg as Number, configuration) as Long + } + + @Throws(ValidationException::class) + fun validate(arg: Float, configuration: SchemaConfiguration?): Float { + return validate(arg as Number, configuration) as Float + } + + @Throws(ValidationException::class) + fun validate(arg: Double, configuration: SchemaConfiguration?): Double { + return validate(arg as Number, configuration) as Double + } + + @Throws(ValidationException::class) + override fun validate(arg: String, configuration: SchemaConfiguration?): String { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validatedPathToSchemas = PathToSchemasMap() + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, LinkedHashSet()) + getPathToSchemas(this, castArg, validationMetadata, pathSet) + return castArg + } + + @Throws(ValidationException::class) + fun validate(arg: LocalDate, configuration: SchemaConfiguration?): String { + return validate(arg.toString(), configuration) + } + + @Throws(ValidationException::class) + fun validate(arg: ZonedDateTime, configuration: SchemaConfiguration?): String { + return validate(arg.toString(), configuration) + } + + @Throws(ValidationException::class) + fun validate(arg: UUID, configuration: SchemaConfiguration?): String { + return validate(arg.toString(), configuration) + } + + override fun getNewInstance(arg: List<*>, pathToItem: List, pathToSchemas: PathToSchemasMap): FrozenList { + val items: MutableList = ArrayList() + var i: Int = 0 + for (item: Any? in arg) { + val itemPathToItem = pathToItem + i + val schemas: LinkedHashMap, Nothing?>? = pathToSchemas.get(itemPathToItem) + if (schemas == null) { + throw RuntimeException("Validation result is invalid, schemas must exist for a pathToItem") + } + val itemSchema: JsonSchema<*> = schemas.entries.iterator().next().key + val itemInstance: Any? = itemSchema.getNewInstance(item, itemPathToItem, pathToSchemas) + items.add(itemInstance) + i += 1 + } + val newInstanceItems: FrozenList = FrozenList(items) + return newInstanceItems + } + + @Throws(ValidationException::class) + override fun validate(arg: List<*>, configuration: SchemaConfiguration?): FrozenList { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, PathToSchemasMap(), LinkedHashSet()) + val pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet) + return getNewInstance(castArg, validationMetadata.pathToItem, pathToSchemasMap) + } + + override fun getNewInstance(arg: Map<*, *>, pathToItem: List, pathToSchemas: PathToSchemasMap): FrozenMap { + val properties: LinkedHashMap = LinkedHashMap() + for((propertyName, value) in arg) { + if (!(propertyName is String)) { + throw RuntimeException("Invalid non-string key value") + } + val propertyPathToItem: List = pathToItem + propertyName + val schemas: LinkedHashMap, Nothing?>? = pathToSchemas.get(propertyPathToItem) + if (schemas == null) { + throw RuntimeException("Validation result is invalid, schemas must exist for a pathToItem") + } + val propertySchema: JsonSchema<*> = schemas.entries.iterator().next().key + val propertyInstance: Any? = propertySchema.getNewInstance(value, propertyPathToItem, pathToSchemas) + properties[propertyName] = propertyInstance + } + val castProperties: FrozenMap = FrozenMap(properties) + return castProperties + } + + @Throws(ValidationException::class) + override fun validate(arg: Map<*, *>, configuration: SchemaConfiguration?): FrozenMap { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validatedPathToSchemas = PathToSchemasMap() + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, LinkedHashSet()) + val pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet) + return getNewInstance(castArg, validationMetadata.pathToItem, pathToSchemasMap) + } + + @Throws(ValidationException::class) + override fun validate(arg: Any?, configuration: SchemaConfiguration?): Any? { + if (arg == null) { + return validate(null, configuration) + } else if (arg is Boolean) { + return validate(arg, configuration) + } else if (arg is Number) { + return validate(arg, configuration) + } else if (arg is String) { + return validate(arg, configuration) + } else if (arg is List<*>) { + return validate(arg, configuration) + } else if (arg is Map<*, *>) { + return validate(arg, configuration) + } + throw ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema") + } + override fun getNewInstance(arg: Any?, pathToItem: List, pathToSchemas: PathToSchemasMap): Any? { + if (arg == null) { + return getNewInstance( null, pathToItem, pathToSchemas) + } else if (arg is Boolean) { + return getNewInstance(arg, pathToItem, pathToSchemas) + } else if (arg is Number) { + return getNewInstance(arg, pathToItem, pathToSchemas) + } else if (arg is String) { + return getNewInstance(arg, pathToItem, pathToSchemas) + } else if (arg is List<*>) { + return getNewInstance(arg, pathToItem, pathToSchemas) + } else if (arg is Map<*, *>) { + return getNewInstance(arg, pathToItem, pathToSchemas) + } + throw RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema") + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: Nothing?, configuration: SchemaConfiguration?): Schema1BoxedVoid { + return Schema1BoxedVoid(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: Boolean, configuration: SchemaConfiguration?): Schema1BoxedBoolean { + return Schema1BoxedBoolean(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: Number, configuration: SchemaConfiguration?): Schema1BoxedNumber { + return Schema1BoxedNumber(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: String, configuration: SchemaConfiguration?): Schema1BoxedString { + return Schema1BoxedString(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: List<*>, configuration: SchemaConfiguration?): Schema1BoxedList { + return Schema1BoxedList(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: Map<*, *>, configuration: SchemaConfiguration?): Schema1BoxedMap { + return Schema1BoxedMap(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: Any?, configuration: SchemaConfiguration?): Schema1Boxed { + if (arg == null) { + return validateAndBox(null, configuration) + } else if (arg is Boolean) { + return validateAndBox(arg, configuration) + } else if (arg is String) { + return validateAndBox(arg, configuration) + } else if (arg is Number) { + return validateAndBox(arg, configuration) + } else if (arg is List<*>) { + return validateAndBox(arg, configuration) + } else if (arg is Map<*, *>) { + return validateAndBox(arg, configuration) + } + throw ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema") + } + } + + sealed interface OneofWithBaseSchema1Boxed { + fun getData(): Any? + } + + data class OneofWithBaseSchema1BoxedString(val data: String) : OneofWithBaseSchema1Boxed { + override fun getData(): Any? { + return data + } + } + + + + class OneofWithBaseSchema1 private constructor(): JsonSchema( + JsonSchemaInfo() + .type(setOf( + String::class.java + )) + .oneOf(listOf( + Schema0::class.java, + Schema1::class.java + )) + ), StringSchemaValidator { + /* + NOTE: This class is auto generated by OpenAPI JSON Schema Generator. + Ref: https://github.com/openapi-json-schema-tools/openapi-json-schema-generator + + Do not edit the class manually. + */ + + companion object { + @Volatile + private var instance: OneofWithBaseSchema1? = null + + fun getInstance() = + instance ?: synchronized(this) { + instance ?: OneofWithBaseSchema1().also { instance = it } + } + } + + @Throws(ValidationException::class) + override fun validate(arg: String, configuration: SchemaConfiguration?): String { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, PathToSchemasMap(), LinkedHashSet()) + getPathToSchemas(this, castArg, validationMetadata, pathSet) + return castArg + } + + @Throws(ValidationException::class) + override fun validate(arg: Any?, configuration: SchemaConfiguration?): Any? { + if (arg is String) { + return validate(arg, configuration) + } + throw ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema") + } + override fun getNewInstance(arg: Any?, pathToItem: List, pathToSchemas: PathToSchemasMap): Any? { + if (arg is String) { + return getNewInstance(arg, pathToItem, pathToSchemas) + } + throw RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema") + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: String, configuration: SchemaConfiguration?): OneofWithBaseSchema1BoxedString { + return OneofWithBaseSchema1BoxedString(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: Any?, configuration: SchemaConfiguration?): OneofWithBaseSchema1Boxed { + if (arg is String) { + return validateAndBox(arg, configuration) + } + throw ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema") + } + } +} diff --git a/samples/client/3_0_3_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/schemas/OneofWithEmptySchema.kt b/samples/client/3_0_3_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/schemas/OneofWithEmptySchema.kt new file mode 100644 index 00000000000..06241abdcdd --- /dev/null +++ b/samples/client/3_0_3_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/schemas/OneofWithEmptySchema.kt @@ -0,0 +1,339 @@ +package org.openapijsonschematools.client.components.schemas +import java.time.LocalDate +import java.time.ZonedDateTime +import java.util.UUID +import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags +import org.openapijsonschematools.client.configurations.SchemaConfiguration +import org.openapijsonschematools.client.exceptions.InvalidAdditionalPropertyException +import org.openapijsonschematools.client.exceptions.UnsetPropertyException +import org.openapijsonschematools.client.exceptions.ValidationException +import org.openapijsonschematools.client.schemas.AnyTypeJsonSchema +import org.openapijsonschematools.client.schemas.NumberJsonSchema +import org.openapijsonschematools.client.schemas.UnsetAddPropsSetter +import org.openapijsonschematools.client.schemas.validation.BooleanSchemaValidator +import org.openapijsonschematools.client.schemas.validation.FrozenList +import org.openapijsonschematools.client.schemas.validation.FrozenMap +import org.openapijsonschematools.client.schemas.validation.JsonSchema +import org.openapijsonschematools.client.schemas.validation.JsonSchemaInfo +import org.openapijsonschematools.client.schemas.validation.ListSchemaValidator +import org.openapijsonschematools.client.schemas.validation.MapSchemaValidator +import org.openapijsonschematools.client.schemas.validation.NullSchemaValidator +import org.openapijsonschematools.client.schemas.validation.NumberSchemaValidator +import org.openapijsonschematools.client.schemas.validation.PathToSchemasMap +import org.openapijsonschematools.client.schemas.validation.StringSchemaValidator +import org.openapijsonschematools.client.schemas.validation.ValidationMetadata + +class OneofWithEmptySchema { + // nest classes so all schemas and input/output classes can be public + + + class Schema0 : NumberJsonSchema.NumberJsonSchema1() { + companion object { + @Volatile + private var instance: Schema0? = null + + fun getInstance() = + instance ?: synchronized(this) { + instance ?: Schema0().also { instance = it } + } + } + } + + + class Schema1 : AnyTypeJsonSchema.AnyTypeJsonSchema1() { + companion object { + @Volatile + private var instance: Schema1? = null + + fun getInstance() = + instance ?: synchronized(this) { + instance ?: Schema1().also { instance = it } + } + } + } + + + sealed interface OneofWithEmptySchema1Boxed { + fun getData(): Any? + } + + data class OneofWithEmptySchema1BoxedVoid(val data: Nothing?) : OneofWithEmptySchema1Boxed { + override fun getData(): Any? { + return data + } + } + + data class OneofWithEmptySchema1BoxedBoolean(val data: Boolean): OneofWithEmptySchema1Boxed { + override fun getData(): Any? { + return data + } + } + + data class OneofWithEmptySchema1BoxedNumber(val data: Number) : OneofWithEmptySchema1Boxed { + override fun getData(): Any? { + return data + } + } + + data class OneofWithEmptySchema1BoxedString(val data: String) : OneofWithEmptySchema1Boxed { + override fun getData(): Any? { + return data + } + } + + data class OneofWithEmptySchema1BoxedList(val data: FrozenList) : OneofWithEmptySchema1Boxed { + override fun getData(): Any? { + return data + } + } + + data class OneofWithEmptySchema1BoxedMap(val data: FrozenMap) : OneofWithEmptySchema1Boxed { + override fun getData(): Any? { + return data + } + } + + + class OneofWithEmptySchema1 private constructor(): JsonSchema( + JsonSchemaInfo() + .oneOf(listOf( + Schema0::class.java, + Schema1::class.java + )) + ), NullSchemaValidator, BooleanSchemaValidator, NumberSchemaValidator, StringSchemaValidator, ListSchemaValidator, OneofWithEmptySchema1BoxedList>, MapSchemaValidator, OneofWithEmptySchema1BoxedMap> { + /* + NOTE: This class is auto generated by OpenAPI JSON Schema Generator. + Ref: https://github.com/openapi-json-schema-tools/openapi-json-schema-generator + + Do not edit the class manually. + */ + + companion object { + @Volatile + private var instance: OneofWithEmptySchema1? = null + + fun getInstance() = + instance ?: synchronized(this) { + instance ?: OneofWithEmptySchema1().also { instance = it } + } + } + + @Throws(ValidationException::class) + override fun validate(arg: Nothing?, configuration: SchemaConfiguration?): Nothing? { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validatedPathToSchemas = PathToSchemasMap() + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, LinkedHashSet()) + getPathToSchemas(this, castArg, validationMetadata, pathSet) + return castArg + } + + @Throws(ValidationException::class) + override fun validate(arg: Boolean, configuration: SchemaConfiguration?): Boolean { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validatedPathToSchemas = PathToSchemasMap() + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, LinkedHashSet()) + getPathToSchemas(this, castArg, validationMetadata, pathSet) + return castArg + } + + @Throws(ValidationException::class) + override fun validate(arg: Number, configuration: SchemaConfiguration?): Number { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validatedPathToSchemas = PathToSchemasMap() + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, LinkedHashSet()) + getPathToSchemas(this, castArg, validationMetadata, pathSet) + return castArg + } + + @Throws(ValidationException::class) + fun validate(arg: Int, configuration: SchemaConfiguration?): Int { + return validate(arg as Number, configuration) as Int + } + + @Throws(ValidationException::class) + fun validate(arg: Long, configuration: SchemaConfiguration?): Long { + return validate(arg as Number, configuration) as Long + } + + @Throws(ValidationException::class) + fun validate(arg: Float, configuration: SchemaConfiguration?): Float { + return validate(arg as Number, configuration) as Float + } + + @Throws(ValidationException::class) + fun validate(arg: Double, configuration: SchemaConfiguration?): Double { + return validate(arg as Number, configuration) as Double + } + + @Throws(ValidationException::class) + override fun validate(arg: String, configuration: SchemaConfiguration?): String { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validatedPathToSchemas = PathToSchemasMap() + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, LinkedHashSet()) + getPathToSchemas(this, castArg, validationMetadata, pathSet) + return castArg + } + + @Throws(ValidationException::class) + fun validate(arg: LocalDate, configuration: SchemaConfiguration?): String { + return validate(arg.toString(), configuration) + } + + @Throws(ValidationException::class) + fun validate(arg: ZonedDateTime, configuration: SchemaConfiguration?): String { + return validate(arg.toString(), configuration) + } + + @Throws(ValidationException::class) + fun validate(arg: UUID, configuration: SchemaConfiguration?): String { + return validate(arg.toString(), configuration) + } + + override fun getNewInstance(arg: List<*>, pathToItem: List, pathToSchemas: PathToSchemasMap): FrozenList { + val items: MutableList = ArrayList() + var i: Int = 0 + for (item: Any? in arg) { + val itemPathToItem = pathToItem + i + val schemas: LinkedHashMap, Nothing?>? = pathToSchemas.get(itemPathToItem) + if (schemas == null) { + throw RuntimeException("Validation result is invalid, schemas must exist for a pathToItem") + } + val itemSchema: JsonSchema<*> = schemas.entries.iterator().next().key + val itemInstance: Any? = itemSchema.getNewInstance(item, itemPathToItem, pathToSchemas) + items.add(itemInstance) + i += 1 + } + val newInstanceItems: FrozenList = FrozenList(items) + return newInstanceItems + } + + @Throws(ValidationException::class) + override fun validate(arg: List<*>, configuration: SchemaConfiguration?): FrozenList { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, PathToSchemasMap(), LinkedHashSet()) + val pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet) + return getNewInstance(castArg, validationMetadata.pathToItem, pathToSchemasMap) + } + + override fun getNewInstance(arg: Map<*, *>, pathToItem: List, pathToSchemas: PathToSchemasMap): FrozenMap { + val properties: LinkedHashMap = LinkedHashMap() + for((propertyName, value) in arg) { + if (!(propertyName is String)) { + throw RuntimeException("Invalid non-string key value") + } + val propertyPathToItem: List = pathToItem + propertyName + val schemas: LinkedHashMap, Nothing?>? = pathToSchemas.get(propertyPathToItem) + if (schemas == null) { + throw RuntimeException("Validation result is invalid, schemas must exist for a pathToItem") + } + val propertySchema: JsonSchema<*> = schemas.entries.iterator().next().key + val propertyInstance: Any? = propertySchema.getNewInstance(value, propertyPathToItem, pathToSchemas) + properties[propertyName] = propertyInstance + } + val castProperties: FrozenMap = FrozenMap(properties) + return castProperties + } + + @Throws(ValidationException::class) + override fun validate(arg: Map<*, *>, configuration: SchemaConfiguration?): FrozenMap { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validatedPathToSchemas = PathToSchemasMap() + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, LinkedHashSet()) + val pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet) + return getNewInstance(castArg, validationMetadata.pathToItem, pathToSchemasMap) + } + + @Throws(ValidationException::class) + override fun validate(arg: Any?, configuration: SchemaConfiguration?): Any? { + if (arg == null) { + return validate(null, configuration) + } else if (arg is Boolean) { + return validate(arg, configuration) + } else if (arg is Number) { + return validate(arg, configuration) + } else if (arg is String) { + return validate(arg, configuration) + } else if (arg is List<*>) { + return validate(arg, configuration) + } else if (arg is Map<*, *>) { + return validate(arg, configuration) + } + throw ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema") + } + override fun getNewInstance(arg: Any?, pathToItem: List, pathToSchemas: PathToSchemasMap): Any? { + if (arg == null) { + return getNewInstance( null, pathToItem, pathToSchemas) + } else if (arg is Boolean) { + return getNewInstance(arg, pathToItem, pathToSchemas) + } else if (arg is Number) { + return getNewInstance(arg, pathToItem, pathToSchemas) + } else if (arg is String) { + return getNewInstance(arg, pathToItem, pathToSchemas) + } else if (arg is List<*>) { + return getNewInstance(arg, pathToItem, pathToSchemas) + } else if (arg is Map<*, *>) { + return getNewInstance(arg, pathToItem, pathToSchemas) + } + throw RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema") + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: Nothing?, configuration: SchemaConfiguration?): OneofWithEmptySchema1BoxedVoid { + return OneofWithEmptySchema1BoxedVoid(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: Boolean, configuration: SchemaConfiguration?): OneofWithEmptySchema1BoxedBoolean { + return OneofWithEmptySchema1BoxedBoolean(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: Number, configuration: SchemaConfiguration?): OneofWithEmptySchema1BoxedNumber { + return OneofWithEmptySchema1BoxedNumber(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: String, configuration: SchemaConfiguration?): OneofWithEmptySchema1BoxedString { + return OneofWithEmptySchema1BoxedString(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: List<*>, configuration: SchemaConfiguration?): OneofWithEmptySchema1BoxedList { + return OneofWithEmptySchema1BoxedList(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: Map<*, *>, configuration: SchemaConfiguration?): OneofWithEmptySchema1BoxedMap { + return OneofWithEmptySchema1BoxedMap(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: Any?, configuration: SchemaConfiguration?): OneofWithEmptySchema1Boxed { + if (arg == null) { + return validateAndBox(null, configuration) + } else if (arg is Boolean) { + return validateAndBox(arg, configuration) + } else if (arg is String) { + return validateAndBox(arg, configuration) + } else if (arg is Number) { + return validateAndBox(arg, configuration) + } else if (arg is List<*>) { + return validateAndBox(arg, configuration) + } else if (arg is Map<*, *>) { + return validateAndBox(arg, configuration) + } + throw ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema") + } + } +} diff --git a/samples/client/3_0_3_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/schemas/OneofWithRequired.kt b/samples/client/3_0_3_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/schemas/OneofWithRequired.kt new file mode 100644 index 00000000000..163cebccec9 --- /dev/null +++ b/samples/client/3_0_3_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/schemas/OneofWithRequired.kt @@ -0,0 +1,1096 @@ +package org.openapijsonschematools.client.components.schemas +import java.time.LocalDate +import java.time.ZonedDateTime +import java.util.UUID +import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags +import org.openapijsonschematools.client.configurations.SchemaConfiguration +import org.openapijsonschematools.client.exceptions.InvalidAdditionalPropertyException +import org.openapijsonschematools.client.exceptions.UnsetPropertyException +import org.openapijsonschematools.client.exceptions.ValidationException +import org.openapijsonschematools.client.schemas.GenericBuilder +import org.openapijsonschematools.client.schemas.UnsetAddPropsSetter +import org.openapijsonschematools.client.schemas.validation.BooleanSchemaValidator +import org.openapijsonschematools.client.schemas.validation.FrozenList +import org.openapijsonschematools.client.schemas.validation.FrozenMap +import org.openapijsonschematools.client.schemas.validation.JsonSchema +import org.openapijsonschematools.client.schemas.validation.JsonSchemaInfo +import org.openapijsonschematools.client.schemas.validation.ListSchemaValidator +import org.openapijsonschematools.client.schemas.validation.MapSchemaValidator +import org.openapijsonschematools.client.schemas.validation.NullSchemaValidator +import org.openapijsonschematools.client.schemas.validation.NumberSchemaValidator +import org.openapijsonschematools.client.schemas.validation.PathToSchemasMap +import org.openapijsonschematools.client.schemas.validation.StringSchemaValidator +import org.openapijsonschematools.client.schemas.validation.ValidationMetadata + +class OneofWithRequired { + // nest classes so all schemas and input/output classes can be public + + + class Schema0Map(m: FrozenMap) : FrozenMap(m) { + companion object { + val requiredKeys: Set = setOf( + "bar", + "foo" + ) + val optionalKeys: Set = setOf() + @Throws(ValidationException::class) + fun of(arg: Map, configuration: SchemaConfiguration): Schema0Map { + return Schema0.getInstance().validate(arg, configuration) + } + } + + fun bar(): Any? { + try { + return getOrThrow("version") + } catch (e: UnsetPropertyException) { + throw RuntimeException(e) + } + } + + fun foo(): Any? { + try { + return getOrThrow("version") + } catch (e: UnsetPropertyException) { + throw RuntimeException(e) + } + } + + @Throws(UnsetPropertyException::class, InvalidAdditionalPropertyException::class) + fun getAdditionalProperty(name: String): Any? { + throwIfKeyKnown(name, requiredKeys, optionalKeys) + throwIfKeyNotPresent(name) + return get(name) + } + } + + interface SetterForBar { + fun getInstance(): MutableMap + fun getBuilderAfterBar(instance: MutableMap): T + + fun bar(value: Nothing?): T { + val instance = getInstance() + instance["bar"] = null + return getBuilderAfterBar(instance) + } + + fun bar(value: Boolean): T { + val instance = getInstance() + instance["bar"] = value + return getBuilderAfterBar(instance) + } + + fun bar(value: String): T { + val instance = getInstance() + instance["bar"] = value + return getBuilderAfterBar(instance) + } + + fun bar(value: Int): T { + val instance = getInstance() + instance["bar"] = value + return getBuilderAfterBar(instance) + } + + fun bar(value: Float): T { + val instance = getInstance() + instance["bar"] = value + return getBuilderAfterBar(instance) + } + + fun bar(value: Long): T { + val instance = getInstance() + instance["bar"] = value + return getBuilderAfterBar(instance) + } + + fun bar(value: Double): T { + val instance = getInstance() + instance["bar"] = value + return getBuilderAfterBar(instance) + } + + fun bar(value: List): T { + val instance = getInstance() + instance["bar"] = value + return getBuilderAfterBar(instance) + } + + fun bar(value: Map): T { + val instance = getInstance() + instance["bar"] = value + return getBuilderAfterBar(instance) + } + } + + interface SetterForFoo { + fun getInstance(): MutableMap + fun getBuilderAfterFoo(instance: MutableMap): T + + fun foo(value: Nothing?): T { + val instance = getInstance() + instance["foo"] = null + return getBuilderAfterFoo(instance) + } + + fun foo(value: Boolean): T { + val instance = getInstance() + instance["foo"] = value + return getBuilderAfterFoo(instance) + } + + fun foo(value: String): T { + val instance = getInstance() + instance["foo"] = value + return getBuilderAfterFoo(instance) + } + + fun foo(value: Int): T { + val instance = getInstance() + instance["foo"] = value + return getBuilderAfterFoo(instance) + } + + fun foo(value: Float): T { + val instance = getInstance() + instance["foo"] = value + return getBuilderAfterFoo(instance) + } + + fun foo(value: Long): T { + val instance = getInstance() + instance["foo"] = value + return getBuilderAfterFoo(instance) + } + + fun foo(value: Double): T { + val instance = getInstance() + instance["foo"] = value + return getBuilderAfterFoo(instance) + } + + fun foo(value: List): T { + val instance = getInstance() + instance["foo"] = value + return getBuilderAfterFoo(instance) + } + + fun foo(value: Map): T { + val instance = getInstance() + instance["foo"] = value + return getBuilderAfterFoo(instance) + } + } + + class Schema0Map00Builder(private val instance: MutableMap): UnsetAddPropsSetter, GenericBuilder> { + private val knownKeys: Set = setOf( + "bar", + "foo" + ) + override fun getKnownKeys(): Set { + return knownKeys + } + override fun build(): Map { + return instance + } + override fun getInstance(): MutableMap { + return instance + } + override fun getBuilderAfterAdditionalProperty(instance: MutableMap): Schema0Map00Builder { + return this + } + } + + class Schema0Map01Builder(private val instance: MutableMap): SetterForFoo { + override fun getInstance(): MutableMap { + return instance + } + override fun getBuilderAfterFoo(instance: MutableMap): Schema0Map00Builder { + return Schema0Map00Builder(instance) + } + } + + class Schema0Map10Builder(private val instance: MutableMap): SetterForBar { + override fun getInstance(): MutableMap { + return instance + } + override fun getBuilderAfterBar(instance: MutableMap): Schema0Map00Builder { + return Schema0Map00Builder(instance) + } + } + + class Schema0MapBuilder: SetterForBar, SetterForFoo { + private val instance: MutableMap + init { + this.instance = LinkedHashMap() + } + override fun getInstance(): MutableMap { + return instance + } + override fun getBuilderAfterBar(instance: MutableMap): Schema0Map01Builder { + return Schema0Map01Builder(instance) + } + override fun getBuilderAfterFoo(instance: MutableMap): Schema0Map10Builder { + return Schema0Map10Builder(instance) + } + } + + + sealed interface Schema0Boxed { + fun getData(): Any? + } + + data class Schema0BoxedVoid(val data: Nothing?) : Schema0Boxed { + override fun getData(): Any? { + return data + } + } + + data class Schema0BoxedBoolean(val data: Boolean): Schema0Boxed { + override fun getData(): Any? { + return data + } + } + + data class Schema0BoxedNumber(val data: Number) : Schema0Boxed { + override fun getData(): Any? { + return data + } + } + + data class Schema0BoxedString(val data: String) : Schema0Boxed { + override fun getData(): Any? { + return data + } + } + + data class Schema0BoxedList(val data: FrozenList) : Schema0Boxed { + override fun getData(): Any? { + return data + } + } + + data class Schema0BoxedMap(val data: Schema0Map) : Schema0Boxed { + override fun getData(): Any? { + return data + } + } + + + class Schema0 private constructor(): JsonSchema( + JsonSchemaInfo() + .required(setOf( + "bar", + "foo" + )) + ), NullSchemaValidator, BooleanSchemaValidator, NumberSchemaValidator, StringSchemaValidator, ListSchemaValidator, Schema0BoxedList>, MapSchemaValidator { + + companion object { + @Volatile + private var instance: Schema0? = null + + fun getInstance() = + instance ?: synchronized(this) { + instance ?: Schema0().also { instance = it } + } + } + + @Throws(ValidationException::class) + override fun validate(arg: Nothing?, configuration: SchemaConfiguration?): Nothing? { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validatedPathToSchemas = PathToSchemasMap() + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, LinkedHashSet()) + getPathToSchemas(this, castArg, validationMetadata, pathSet) + return castArg + } + + @Throws(ValidationException::class) + override fun validate(arg: Boolean, configuration: SchemaConfiguration?): Boolean { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validatedPathToSchemas = PathToSchemasMap() + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, LinkedHashSet()) + getPathToSchemas(this, castArg, validationMetadata, pathSet) + return castArg + } + + @Throws(ValidationException::class) + override fun validate(arg: Number, configuration: SchemaConfiguration?): Number { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validatedPathToSchemas = PathToSchemasMap() + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, LinkedHashSet()) + getPathToSchemas(this, castArg, validationMetadata, pathSet) + return castArg + } + + @Throws(ValidationException::class) + fun validate(arg: Int, configuration: SchemaConfiguration?): Int { + return validate(arg as Number, configuration) as Int + } + + @Throws(ValidationException::class) + fun validate(arg: Long, configuration: SchemaConfiguration?): Long { + return validate(arg as Number, configuration) as Long + } + + @Throws(ValidationException::class) + fun validate(arg: Float, configuration: SchemaConfiguration?): Float { + return validate(arg as Number, configuration) as Float + } + + @Throws(ValidationException::class) + fun validate(arg: Double, configuration: SchemaConfiguration?): Double { + return validate(arg as Number, configuration) as Double + } + + @Throws(ValidationException::class) + override fun validate(arg: String, configuration: SchemaConfiguration?): String { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validatedPathToSchemas = PathToSchemasMap() + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, LinkedHashSet()) + getPathToSchemas(this, castArg, validationMetadata, pathSet) + return castArg + } + + @Throws(ValidationException::class) + fun validate(arg: LocalDate, configuration: SchemaConfiguration?): String { + return validate(arg.toString(), configuration) + } + + @Throws(ValidationException::class) + fun validate(arg: ZonedDateTime, configuration: SchemaConfiguration?): String { + return validate(arg.toString(), configuration) + } + + @Throws(ValidationException::class) + fun validate(arg: UUID, configuration: SchemaConfiguration?): String { + return validate(arg.toString(), configuration) + } + + override fun getNewInstance(arg: List<*>, pathToItem: List, pathToSchemas: PathToSchemasMap): FrozenList { + val items: MutableList = ArrayList() + var i: Int = 0 + for (item: Any? in arg) { + val itemPathToItem = pathToItem + i + val schemas: LinkedHashMap, Nothing?>? = pathToSchemas.get(itemPathToItem) + if (schemas == null) { + throw RuntimeException("Validation result is invalid, schemas must exist for a pathToItem") + } + val itemSchema: JsonSchema<*> = schemas.entries.iterator().next().key + val itemInstance: Any? = itemSchema.getNewInstance(item, itemPathToItem, pathToSchemas) + items.add(itemInstance) + i += 1 + } + val newInstanceItems: FrozenList = FrozenList(items) + return newInstanceItems + } + + @Throws(ValidationException::class) + override fun validate(arg: List<*>, configuration: SchemaConfiguration?): FrozenList { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, PathToSchemasMap(), LinkedHashSet()) + val pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet) + return getNewInstance(castArg, validationMetadata.pathToItem, pathToSchemasMap) + } + + override fun getNewInstance(arg: Map<*, *>, pathToItem: List, pathToSchemas: PathToSchemasMap): Schema0Map { + val properties: LinkedHashMap = LinkedHashMap() + for((propertyName, value) in arg) { + if (!(propertyName is String)) { + throw RuntimeException("Invalid non-string key value") + } + val propertyPathToItem: List = pathToItem + propertyName + val schemas: LinkedHashMap, Nothing?>? = pathToSchemas.get(propertyPathToItem) + if (schemas == null) { + throw RuntimeException("Validation result is invalid, schemas must exist for a pathToItem") + } + val propertySchema: JsonSchema<*> = schemas.entries.iterator().next().key + val propertyInstance: Any? = propertySchema.getNewInstance(value, propertyPathToItem, pathToSchemas) + properties[propertyName] = propertyInstance + } + val castProperties: FrozenMap = FrozenMap(properties) + return Schema0Map(castProperties) + } + + @Throws(ValidationException::class) + override fun validate(arg: Map<*, *>, configuration: SchemaConfiguration?): Schema0Map { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validatedPathToSchemas = PathToSchemasMap() + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, LinkedHashSet()) + val pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet) + return getNewInstance(castArg, validationMetadata.pathToItem, pathToSchemasMap) + } + + @Throws(ValidationException::class) + override fun validate(arg: Any?, configuration: SchemaConfiguration?): Any? { + if (arg == null) { + return validate(null, configuration) + } else if (arg is Boolean) { + return validate(arg, configuration) + } else if (arg is Number) { + return validate(arg, configuration) + } else if (arg is String) { + return validate(arg, configuration) + } else if (arg is List<*>) { + return validate(arg, configuration) + } else if (arg is Map<*, *>) { + return validate(arg, configuration) + } + throw ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema") + } + override fun getNewInstance(arg: Any?, pathToItem: List, pathToSchemas: PathToSchemasMap): Any? { + if (arg == null) { + return getNewInstance( null, pathToItem, pathToSchemas) + } else if (arg is Boolean) { + return getNewInstance(arg, pathToItem, pathToSchemas) + } else if (arg is Number) { + return getNewInstance(arg, pathToItem, pathToSchemas) + } else if (arg is String) { + return getNewInstance(arg, pathToItem, pathToSchemas) + } else if (arg is List<*>) { + return getNewInstance(arg, pathToItem, pathToSchemas) + } else if (arg is Map<*, *>) { + return getNewInstance(arg, pathToItem, pathToSchemas) + } + throw RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema") + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: Nothing?, configuration: SchemaConfiguration?): Schema0BoxedVoid { + return Schema0BoxedVoid(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: Boolean, configuration: SchemaConfiguration?): Schema0BoxedBoolean { + return Schema0BoxedBoolean(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: Number, configuration: SchemaConfiguration?): Schema0BoxedNumber { + return Schema0BoxedNumber(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: String, configuration: SchemaConfiguration?): Schema0BoxedString { + return Schema0BoxedString(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: List<*>, configuration: SchemaConfiguration?): Schema0BoxedList { + return Schema0BoxedList(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: Map<*, *>, configuration: SchemaConfiguration?): Schema0BoxedMap { + return Schema0BoxedMap(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: Any?, configuration: SchemaConfiguration?): Schema0Boxed { + if (arg == null) { + return validateAndBox(null, configuration) + } else if (arg is Boolean) { + return validateAndBox(arg, configuration) + } else if (arg is String) { + return validateAndBox(arg, configuration) + } else if (arg is Number) { + return validateAndBox(arg, configuration) + } else if (arg is List<*>) { + return validateAndBox(arg, configuration) + } else if (arg is Map<*, *>) { + return validateAndBox(arg, configuration) + } + throw ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema") + } + } + + class Schema1Map(m: FrozenMap) : FrozenMap(m) { + companion object { + val requiredKeys: Set = setOf( + "baz", + "foo" + ) + val optionalKeys: Set = setOf() + @Throws(ValidationException::class) + fun of(arg: Map, configuration: SchemaConfiguration): Schema1Map { + return Schema1.getInstance().validate(arg, configuration) + } + } + + fun baz(): Any? { + try { + return getOrThrow("version") + } catch (e: UnsetPropertyException) { + throw RuntimeException(e) + } + } + + fun foo(): Any? { + try { + return getOrThrow("version") + } catch (e: UnsetPropertyException) { + throw RuntimeException(e) + } + } + + @Throws(UnsetPropertyException::class, InvalidAdditionalPropertyException::class) + fun getAdditionalProperty(name: String): Any? { + throwIfKeyKnown(name, requiredKeys, optionalKeys) + throwIfKeyNotPresent(name) + return get(name) + } + } + + interface SetterForBaz { + fun getInstance(): MutableMap + fun getBuilderAfterBaz(instance: MutableMap): T + + fun baz(value: Nothing?): T { + val instance = getInstance() + instance["baz"] = null + return getBuilderAfterBaz(instance) + } + + fun baz(value: Boolean): T { + val instance = getInstance() + instance["baz"] = value + return getBuilderAfterBaz(instance) + } + + fun baz(value: String): T { + val instance = getInstance() + instance["baz"] = value + return getBuilderAfterBaz(instance) + } + + fun baz(value: Int): T { + val instance = getInstance() + instance["baz"] = value + return getBuilderAfterBaz(instance) + } + + fun baz(value: Float): T { + val instance = getInstance() + instance["baz"] = value + return getBuilderAfterBaz(instance) + } + + fun baz(value: Long): T { + val instance = getInstance() + instance["baz"] = value + return getBuilderAfterBaz(instance) + } + + fun baz(value: Double): T { + val instance = getInstance() + instance["baz"] = value + return getBuilderAfterBaz(instance) + } + + fun baz(value: List): T { + val instance = getInstance() + instance["baz"] = value + return getBuilderAfterBaz(instance) + } + + fun baz(value: Map): T { + val instance = getInstance() + instance["baz"] = value + return getBuilderAfterBaz(instance) + } + } + + interface SetterForFoo1 { + fun getInstance(): MutableMap + fun getBuilderAfterFoo1(instance: MutableMap): T + + fun foo(value: Nothing?): T { + val instance = getInstance() + instance["foo"] = null + return getBuilderAfterFoo1(instance) + } + + fun foo(value: Boolean): T { + val instance = getInstance() + instance["foo"] = value + return getBuilderAfterFoo1(instance) + } + + fun foo(value: String): T { + val instance = getInstance() + instance["foo"] = value + return getBuilderAfterFoo1(instance) + } + + fun foo(value: Int): T { + val instance = getInstance() + instance["foo"] = value + return getBuilderAfterFoo1(instance) + } + + fun foo(value: Float): T { + val instance = getInstance() + instance["foo"] = value + return getBuilderAfterFoo1(instance) + } + + fun foo(value: Long): T { + val instance = getInstance() + instance["foo"] = value + return getBuilderAfterFoo1(instance) + } + + fun foo(value: Double): T { + val instance = getInstance() + instance["foo"] = value + return getBuilderAfterFoo1(instance) + } + + fun foo(value: List): T { + val instance = getInstance() + instance["foo"] = value + return getBuilderAfterFoo1(instance) + } + + fun foo(value: Map): T { + val instance = getInstance() + instance["foo"] = value + return getBuilderAfterFoo1(instance) + } + } + + class Schema1Map00Builder(private val instance: MutableMap): UnsetAddPropsSetter, GenericBuilder> { + private val knownKeys: Set = setOf( + "baz", + "foo" + ) + override fun getKnownKeys(): Set { + return knownKeys + } + override fun build(): Map { + return instance + } + override fun getInstance(): MutableMap { + return instance + } + override fun getBuilderAfterAdditionalProperty(instance: MutableMap): Schema1Map00Builder { + return this + } + } + + class Schema1Map01Builder(private val instance: MutableMap): SetterForFoo1 { + override fun getInstance(): MutableMap { + return instance + } + override fun getBuilderAfterFoo1(instance: MutableMap): Schema1Map00Builder { + return Schema1Map00Builder(instance) + } + } + + class Schema1Map10Builder(private val instance: MutableMap): SetterForBaz { + override fun getInstance(): MutableMap { + return instance + } + override fun getBuilderAfterBaz(instance: MutableMap): Schema1Map00Builder { + return Schema1Map00Builder(instance) + } + } + + class Schema1MapBuilder: SetterForBaz, SetterForFoo1 { + private val instance: MutableMap + init { + this.instance = LinkedHashMap() + } + override fun getInstance(): MutableMap { + return instance + } + override fun getBuilderAfterBaz(instance: MutableMap): Schema1Map01Builder { + return Schema1Map01Builder(instance) + } + override fun getBuilderAfterFoo1(instance: MutableMap): Schema1Map10Builder { + return Schema1Map10Builder(instance) + } + } + + + sealed interface Schema1Boxed { + fun getData(): Any? + } + + data class Schema1BoxedVoid(val data: Nothing?) : Schema1Boxed { + override fun getData(): Any? { + return data + } + } + + data class Schema1BoxedBoolean(val data: Boolean): Schema1Boxed { + override fun getData(): Any? { + return data + } + } + + data class Schema1BoxedNumber(val data: Number) : Schema1Boxed { + override fun getData(): Any? { + return data + } + } + + data class Schema1BoxedString(val data: String) : Schema1Boxed { + override fun getData(): Any? { + return data + } + } + + data class Schema1BoxedList(val data: FrozenList) : Schema1Boxed { + override fun getData(): Any? { + return data + } + } + + data class Schema1BoxedMap(val data: Schema1Map) : Schema1Boxed { + override fun getData(): Any? { + return data + } + } + + + class Schema1 private constructor(): JsonSchema( + JsonSchemaInfo() + .required(setOf( + "baz", + "foo" + )) + ), NullSchemaValidator, BooleanSchemaValidator, NumberSchemaValidator, StringSchemaValidator, ListSchemaValidator, Schema1BoxedList>, MapSchemaValidator { + + companion object { + @Volatile + private var instance: Schema1? = null + + fun getInstance() = + instance ?: synchronized(this) { + instance ?: Schema1().also { instance = it } + } + } + + @Throws(ValidationException::class) + override fun validate(arg: Nothing?, configuration: SchemaConfiguration?): Nothing? { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validatedPathToSchemas = PathToSchemasMap() + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, LinkedHashSet()) + getPathToSchemas(this, castArg, validationMetadata, pathSet) + return castArg + } + + @Throws(ValidationException::class) + override fun validate(arg: Boolean, configuration: SchemaConfiguration?): Boolean { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validatedPathToSchemas = PathToSchemasMap() + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, LinkedHashSet()) + getPathToSchemas(this, castArg, validationMetadata, pathSet) + return castArg + } + + @Throws(ValidationException::class) + override fun validate(arg: Number, configuration: SchemaConfiguration?): Number { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validatedPathToSchemas = PathToSchemasMap() + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, LinkedHashSet()) + getPathToSchemas(this, castArg, validationMetadata, pathSet) + return castArg + } + + @Throws(ValidationException::class) + fun validate(arg: Int, configuration: SchemaConfiguration?): Int { + return validate(arg as Number, configuration) as Int + } + + @Throws(ValidationException::class) + fun validate(arg: Long, configuration: SchemaConfiguration?): Long { + return validate(arg as Number, configuration) as Long + } + + @Throws(ValidationException::class) + fun validate(arg: Float, configuration: SchemaConfiguration?): Float { + return validate(arg as Number, configuration) as Float + } + + @Throws(ValidationException::class) + fun validate(arg: Double, configuration: SchemaConfiguration?): Double { + return validate(arg as Number, configuration) as Double + } + + @Throws(ValidationException::class) + override fun validate(arg: String, configuration: SchemaConfiguration?): String { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validatedPathToSchemas = PathToSchemasMap() + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, LinkedHashSet()) + getPathToSchemas(this, castArg, validationMetadata, pathSet) + return castArg + } + + @Throws(ValidationException::class) + fun validate(arg: LocalDate, configuration: SchemaConfiguration?): String { + return validate(arg.toString(), configuration) + } + + @Throws(ValidationException::class) + fun validate(arg: ZonedDateTime, configuration: SchemaConfiguration?): String { + return validate(arg.toString(), configuration) + } + + @Throws(ValidationException::class) + fun validate(arg: UUID, configuration: SchemaConfiguration?): String { + return validate(arg.toString(), configuration) + } + + override fun getNewInstance(arg: List<*>, pathToItem: List, pathToSchemas: PathToSchemasMap): FrozenList { + val items: MutableList = ArrayList() + var i: Int = 0 + for (item: Any? in arg) { + val itemPathToItem = pathToItem + i + val schemas: LinkedHashMap, Nothing?>? = pathToSchemas.get(itemPathToItem) + if (schemas == null) { + throw RuntimeException("Validation result is invalid, schemas must exist for a pathToItem") + } + val itemSchema: JsonSchema<*> = schemas.entries.iterator().next().key + val itemInstance: Any? = itemSchema.getNewInstance(item, itemPathToItem, pathToSchemas) + items.add(itemInstance) + i += 1 + } + val newInstanceItems: FrozenList = FrozenList(items) + return newInstanceItems + } + + @Throws(ValidationException::class) + override fun validate(arg: List<*>, configuration: SchemaConfiguration?): FrozenList { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, PathToSchemasMap(), LinkedHashSet()) + val pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet) + return getNewInstance(castArg, validationMetadata.pathToItem, pathToSchemasMap) + } + + override fun getNewInstance(arg: Map<*, *>, pathToItem: List, pathToSchemas: PathToSchemasMap): Schema1Map { + val properties: LinkedHashMap = LinkedHashMap() + for((propertyName, value) in arg) { + if (!(propertyName is String)) { + throw RuntimeException("Invalid non-string key value") + } + val propertyPathToItem: List = pathToItem + propertyName + val schemas: LinkedHashMap, Nothing?>? = pathToSchemas.get(propertyPathToItem) + if (schemas == null) { + throw RuntimeException("Validation result is invalid, schemas must exist for a pathToItem") + } + val propertySchema: JsonSchema<*> = schemas.entries.iterator().next().key + val propertyInstance: Any? = propertySchema.getNewInstance(value, propertyPathToItem, pathToSchemas) + properties[propertyName] = propertyInstance + } + val castProperties: FrozenMap = FrozenMap(properties) + return Schema1Map(castProperties) + } + + @Throws(ValidationException::class) + override fun validate(arg: Map<*, *>, configuration: SchemaConfiguration?): Schema1Map { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validatedPathToSchemas = PathToSchemasMap() + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, LinkedHashSet()) + val pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet) + return getNewInstance(castArg, validationMetadata.pathToItem, pathToSchemasMap) + } + + @Throws(ValidationException::class) + override fun validate(arg: Any?, configuration: SchemaConfiguration?): Any? { + if (arg == null) { + return validate(null, configuration) + } else if (arg is Boolean) { + return validate(arg, configuration) + } else if (arg is Number) { + return validate(arg, configuration) + } else if (arg is String) { + return validate(arg, configuration) + } else if (arg is List<*>) { + return validate(arg, configuration) + } else if (arg is Map<*, *>) { + return validate(arg, configuration) + } + throw ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema") + } + override fun getNewInstance(arg: Any?, pathToItem: List, pathToSchemas: PathToSchemasMap): Any? { + if (arg == null) { + return getNewInstance( null, pathToItem, pathToSchemas) + } else if (arg is Boolean) { + return getNewInstance(arg, pathToItem, pathToSchemas) + } else if (arg is Number) { + return getNewInstance(arg, pathToItem, pathToSchemas) + } else if (arg is String) { + return getNewInstance(arg, pathToItem, pathToSchemas) + } else if (arg is List<*>) { + return getNewInstance(arg, pathToItem, pathToSchemas) + } else if (arg is Map<*, *>) { + return getNewInstance(arg, pathToItem, pathToSchemas) + } + throw RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema") + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: Nothing?, configuration: SchemaConfiguration?): Schema1BoxedVoid { + return Schema1BoxedVoid(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: Boolean, configuration: SchemaConfiguration?): Schema1BoxedBoolean { + return Schema1BoxedBoolean(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: Number, configuration: SchemaConfiguration?): Schema1BoxedNumber { + return Schema1BoxedNumber(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: String, configuration: SchemaConfiguration?): Schema1BoxedString { + return Schema1BoxedString(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: List<*>, configuration: SchemaConfiguration?): Schema1BoxedList { + return Schema1BoxedList(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: Map<*, *>, configuration: SchemaConfiguration?): Schema1BoxedMap { + return Schema1BoxedMap(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: Any?, configuration: SchemaConfiguration?): Schema1Boxed { + if (arg == null) { + return validateAndBox(null, configuration) + } else if (arg is Boolean) { + return validateAndBox(arg, configuration) + } else if (arg is String) { + return validateAndBox(arg, configuration) + } else if (arg is Number) { + return validateAndBox(arg, configuration) + } else if (arg is List<*>) { + return validateAndBox(arg, configuration) + } else if (arg is Map<*, *>) { + return validateAndBox(arg, configuration) + } + throw ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema") + } + } + + sealed interface OneofWithRequired1Boxed { + fun getData(): Any? + } + + data class OneofWithRequired1BoxedMap(val data: FrozenMap) : OneofWithRequired1Boxed { + override fun getData(): Any? { + return data + } + } + + + class OneofWithRequired1 private constructor(): JsonSchema( + JsonSchemaInfo() + .type(setOf(Map::class.java)) + .oneOf(listOf( + Schema0::class.java, + Schema1::class.java + )) + ), MapSchemaValidator, OneofWithRequired1BoxedMap> { + /* + NOTE: This class is auto generated by OpenAPI JSON Schema Generator. + Ref: https://github.com/openapi-json-schema-tools/openapi-json-schema-generator + + Do not edit the class manually. + */ + + companion object { + @Volatile + private var instance: OneofWithRequired1? = null + + fun getInstance() = + instance ?: synchronized(this) { + instance ?: OneofWithRequired1().also { instance = it } + } + } + + override fun getNewInstance(arg: Map<*, *>, pathToItem: List, pathToSchemas: PathToSchemasMap): FrozenMap { + val properties: LinkedHashMap = LinkedHashMap() + for((entryKey, value) in arg) { + if (!(entryKey is String)) { + throw RuntimeException("Invalid non-string key value") + } + val propertyPathToItem: List = pathToItem + entryKey + val schemas: LinkedHashMap, Nothing?>? = pathToSchemas.get(propertyPathToItem) + if (schemas == null) { + throw RuntimeException("Validation result is invalid, schemas must exist for a pathToItem") + } + val propertySchema: JsonSchema<*> = schemas.entries.iterator().next().key + val propertyInstance: Any? = propertySchema.getNewInstance(value, propertyPathToItem, pathToSchemas) + properties[entryKey] = propertyInstance + } + val castProperties: FrozenMap = FrozenMap(properties) + return castProperties + } + + @Throws(ValidationException::class) + override fun validate(arg: Map<*, *>, configuration: SchemaConfiguration?): FrozenMap { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, PathToSchemasMap(), LinkedHashSet()) + val pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet) + return getNewInstance(castArg, validationMetadata.pathToItem, pathToSchemasMap) + } + + + @Throws(ValidationException::class) + override fun validate(arg: Any?, configuration: SchemaConfiguration?): Any? { + if (arg is Map<*, *>) { + return validate(arg, configuration) + } + throw ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema") + } + override fun getNewInstance(arg: Any?, pathToItem: List, pathToSchemas: PathToSchemasMap): Any? { + if (arg is Map<*, *>) { + return getNewInstance(arg, pathToItem, pathToSchemas) + } + throw RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema") + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: Map<*, *>, configuration: SchemaConfiguration?): OneofWithRequired1BoxedMap { + return OneofWithRequired1BoxedMap(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: Any?, configuration: SchemaConfiguration?): OneofWithRequired1Boxed { + if (arg is Map<*, *>) { + return validateAndBox(arg, configuration) + } + throw ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema") + } + } + +} diff --git a/samples/client/3_0_3_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/schemas/PatternIsNotAnchored.kt b/samples/client/3_0_3_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/schemas/PatternIsNotAnchored.kt new file mode 100644 index 00000000000..187e8f7823f --- /dev/null +++ b/samples/client/3_0_3_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/schemas/PatternIsNotAnchored.kt @@ -0,0 +1,311 @@ +package org.openapijsonschematools.client.components.schemas +import java.time.LocalDate +import java.time.ZonedDateTime +import java.util.UUID +import java.util.regex.Pattern +import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags +import org.openapijsonschematools.client.configurations.SchemaConfiguration +import org.openapijsonschematools.client.exceptions.InvalidAdditionalPropertyException +import org.openapijsonschematools.client.exceptions.UnsetPropertyException +import org.openapijsonschematools.client.exceptions.ValidationException +import org.openapijsonschematools.client.schemas.UnsetAddPropsSetter +import org.openapijsonschematools.client.schemas.validation.BooleanSchemaValidator +import org.openapijsonschematools.client.schemas.validation.FrozenList +import org.openapijsonschematools.client.schemas.validation.FrozenMap +import org.openapijsonschematools.client.schemas.validation.JsonSchema +import org.openapijsonschematools.client.schemas.validation.JsonSchemaInfo +import org.openapijsonschematools.client.schemas.validation.ListSchemaValidator +import org.openapijsonschematools.client.schemas.validation.MapSchemaValidator +import org.openapijsonschematools.client.schemas.validation.NullSchemaValidator +import org.openapijsonschematools.client.schemas.validation.NumberSchemaValidator +import org.openapijsonschematools.client.schemas.validation.PathToSchemasMap +import org.openapijsonschematools.client.schemas.validation.StringSchemaValidator +import org.openapijsonschematools.client.schemas.validation.ValidationMetadata + +class PatternIsNotAnchored { + // nest classes so all schemas and input/output classes can be public + + + sealed interface PatternIsNotAnchored1Boxed { + fun getData(): Any? + } + + data class PatternIsNotAnchored1BoxedVoid(val data: Nothing?) : PatternIsNotAnchored1Boxed { + override fun getData(): Any? { + return data + } + } + + data class PatternIsNotAnchored1BoxedBoolean(val data: Boolean): PatternIsNotAnchored1Boxed { + override fun getData(): Any? { + return data + } + } + + data class PatternIsNotAnchored1BoxedNumber(val data: Number) : PatternIsNotAnchored1Boxed { + override fun getData(): Any? { + return data + } + } + + data class PatternIsNotAnchored1BoxedString(val data: String) : PatternIsNotAnchored1Boxed { + override fun getData(): Any? { + return data + } + } + + data class PatternIsNotAnchored1BoxedList(val data: FrozenList) : PatternIsNotAnchored1Boxed { + override fun getData(): Any? { + return data + } + } + + data class PatternIsNotAnchored1BoxedMap(val data: FrozenMap) : PatternIsNotAnchored1Boxed { + override fun getData(): Any? { + return data + } + } + + + class PatternIsNotAnchored1 private constructor(): JsonSchema( + JsonSchemaInfo() + .pattern(Pattern.compile( + "a+" + )) + ), NullSchemaValidator, BooleanSchemaValidator, NumberSchemaValidator, StringSchemaValidator, ListSchemaValidator, PatternIsNotAnchored1BoxedList>, MapSchemaValidator, PatternIsNotAnchored1BoxedMap> { + /* + NOTE: This class is auto generated by OpenAPI JSON Schema Generator. + Ref: https://github.com/openapi-json-schema-tools/openapi-json-schema-generator + + Do not edit the class manually. + */ + + companion object { + @Volatile + private var instance: PatternIsNotAnchored1? = null + + fun getInstance() = + instance ?: synchronized(this) { + instance ?: PatternIsNotAnchored1().also { instance = it } + } + } + + @Throws(ValidationException::class) + override fun validate(arg: Nothing?, configuration: SchemaConfiguration?): Nothing? { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validatedPathToSchemas = PathToSchemasMap() + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, LinkedHashSet()) + getPathToSchemas(this, castArg, validationMetadata, pathSet) + return castArg + } + + @Throws(ValidationException::class) + override fun validate(arg: Boolean, configuration: SchemaConfiguration?): Boolean { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validatedPathToSchemas = PathToSchemasMap() + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, LinkedHashSet()) + getPathToSchemas(this, castArg, validationMetadata, pathSet) + return castArg + } + + @Throws(ValidationException::class) + override fun validate(arg: Number, configuration: SchemaConfiguration?): Number { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validatedPathToSchemas = PathToSchemasMap() + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, LinkedHashSet()) + getPathToSchemas(this, castArg, validationMetadata, pathSet) + return castArg + } + + @Throws(ValidationException::class) + fun validate(arg: Int, configuration: SchemaConfiguration?): Int { + return validate(arg as Number, configuration) as Int + } + + @Throws(ValidationException::class) + fun validate(arg: Long, configuration: SchemaConfiguration?): Long { + return validate(arg as Number, configuration) as Long + } + + @Throws(ValidationException::class) + fun validate(arg: Float, configuration: SchemaConfiguration?): Float { + return validate(arg as Number, configuration) as Float + } + + @Throws(ValidationException::class) + fun validate(arg: Double, configuration: SchemaConfiguration?): Double { + return validate(arg as Number, configuration) as Double + } + + @Throws(ValidationException::class) + override fun validate(arg: String, configuration: SchemaConfiguration?): String { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validatedPathToSchemas = PathToSchemasMap() + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, LinkedHashSet()) + getPathToSchemas(this, castArg, validationMetadata, pathSet) + return castArg + } + + @Throws(ValidationException::class) + fun validate(arg: LocalDate, configuration: SchemaConfiguration?): String { + return validate(arg.toString(), configuration) + } + + @Throws(ValidationException::class) + fun validate(arg: ZonedDateTime, configuration: SchemaConfiguration?): String { + return validate(arg.toString(), configuration) + } + + @Throws(ValidationException::class) + fun validate(arg: UUID, configuration: SchemaConfiguration?): String { + return validate(arg.toString(), configuration) + } + + override fun getNewInstance(arg: List<*>, pathToItem: List, pathToSchemas: PathToSchemasMap): FrozenList { + val items: MutableList = ArrayList() + var i: Int = 0 + for (item: Any? in arg) { + val itemPathToItem = pathToItem + i + val schemas: LinkedHashMap, Nothing?>? = pathToSchemas.get(itemPathToItem) + if (schemas == null) { + throw RuntimeException("Validation result is invalid, schemas must exist for a pathToItem") + } + val itemSchema: JsonSchema<*> = schemas.entries.iterator().next().key + val itemInstance: Any? = itemSchema.getNewInstance(item, itemPathToItem, pathToSchemas) + items.add(itemInstance) + i += 1 + } + val newInstanceItems: FrozenList = FrozenList(items) + return newInstanceItems + } + + @Throws(ValidationException::class) + override fun validate(arg: List<*>, configuration: SchemaConfiguration?): FrozenList { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, PathToSchemasMap(), LinkedHashSet()) + val pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet) + return getNewInstance(castArg, validationMetadata.pathToItem, pathToSchemasMap) + } + + override fun getNewInstance(arg: Map<*, *>, pathToItem: List, pathToSchemas: PathToSchemasMap): FrozenMap { + val properties: LinkedHashMap = LinkedHashMap() + for((propertyName, value) in arg) { + if (!(propertyName is String)) { + throw RuntimeException("Invalid non-string key value") + } + val propertyPathToItem: List = pathToItem + propertyName + val schemas: LinkedHashMap, Nothing?>? = pathToSchemas.get(propertyPathToItem) + if (schemas == null) { + throw RuntimeException("Validation result is invalid, schemas must exist for a pathToItem") + } + val propertySchema: JsonSchema<*> = schemas.entries.iterator().next().key + val propertyInstance: Any? = propertySchema.getNewInstance(value, propertyPathToItem, pathToSchemas) + properties[propertyName] = propertyInstance + } + val castProperties: FrozenMap = FrozenMap(properties) + return castProperties + } + + @Throws(ValidationException::class) + override fun validate(arg: Map<*, *>, configuration: SchemaConfiguration?): FrozenMap { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validatedPathToSchemas = PathToSchemasMap() + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, LinkedHashSet()) + val pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet) + return getNewInstance(castArg, validationMetadata.pathToItem, pathToSchemasMap) + } + + @Throws(ValidationException::class) + override fun validate(arg: Any?, configuration: SchemaConfiguration?): Any? { + if (arg == null) { + return validate(null, configuration) + } else if (arg is Boolean) { + return validate(arg, configuration) + } else if (arg is Number) { + return validate(arg, configuration) + } else if (arg is String) { + return validate(arg, configuration) + } else if (arg is List<*>) { + return validate(arg, configuration) + } else if (arg is Map<*, *>) { + return validate(arg, configuration) + } + throw ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema") + } + override fun getNewInstance(arg: Any?, pathToItem: List, pathToSchemas: PathToSchemasMap): Any? { + if (arg == null) { + return getNewInstance( null, pathToItem, pathToSchemas) + } else if (arg is Boolean) { + return getNewInstance(arg, pathToItem, pathToSchemas) + } else if (arg is Number) { + return getNewInstance(arg, pathToItem, pathToSchemas) + } else if (arg is String) { + return getNewInstance(arg, pathToItem, pathToSchemas) + } else if (arg is List<*>) { + return getNewInstance(arg, pathToItem, pathToSchemas) + } else if (arg is Map<*, *>) { + return getNewInstance(arg, pathToItem, pathToSchemas) + } + throw RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema") + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: Nothing?, configuration: SchemaConfiguration?): PatternIsNotAnchored1BoxedVoid { + return PatternIsNotAnchored1BoxedVoid(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: Boolean, configuration: SchemaConfiguration?): PatternIsNotAnchored1BoxedBoolean { + return PatternIsNotAnchored1BoxedBoolean(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: Number, configuration: SchemaConfiguration?): PatternIsNotAnchored1BoxedNumber { + return PatternIsNotAnchored1BoxedNumber(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: String, configuration: SchemaConfiguration?): PatternIsNotAnchored1BoxedString { + return PatternIsNotAnchored1BoxedString(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: List<*>, configuration: SchemaConfiguration?): PatternIsNotAnchored1BoxedList { + return PatternIsNotAnchored1BoxedList(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: Map<*, *>, configuration: SchemaConfiguration?): PatternIsNotAnchored1BoxedMap { + return PatternIsNotAnchored1BoxedMap(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: Any?, configuration: SchemaConfiguration?): PatternIsNotAnchored1Boxed { + if (arg == null) { + return validateAndBox(null, configuration) + } else if (arg is Boolean) { + return validateAndBox(arg, configuration) + } else if (arg is String) { + return validateAndBox(arg, configuration) + } else if (arg is Number) { + return validateAndBox(arg, configuration) + } else if (arg is List<*>) { + return validateAndBox(arg, configuration) + } else if (arg is Map<*, *>) { + return validateAndBox(arg, configuration) + } + throw ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema") + } + } +} diff --git a/samples/client/3_0_3_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/schemas/PatternValidation.kt b/samples/client/3_0_3_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/schemas/PatternValidation.kt new file mode 100644 index 00000000000..3d58fd45c4a --- /dev/null +++ b/samples/client/3_0_3_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/schemas/PatternValidation.kt @@ -0,0 +1,311 @@ +package org.openapijsonschematools.client.components.schemas +import java.time.LocalDate +import java.time.ZonedDateTime +import java.util.UUID +import java.util.regex.Pattern +import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags +import org.openapijsonschematools.client.configurations.SchemaConfiguration +import org.openapijsonschematools.client.exceptions.InvalidAdditionalPropertyException +import org.openapijsonschematools.client.exceptions.UnsetPropertyException +import org.openapijsonschematools.client.exceptions.ValidationException +import org.openapijsonschematools.client.schemas.UnsetAddPropsSetter +import org.openapijsonschematools.client.schemas.validation.BooleanSchemaValidator +import org.openapijsonschematools.client.schemas.validation.FrozenList +import org.openapijsonschematools.client.schemas.validation.FrozenMap +import org.openapijsonschematools.client.schemas.validation.JsonSchema +import org.openapijsonschematools.client.schemas.validation.JsonSchemaInfo +import org.openapijsonschematools.client.schemas.validation.ListSchemaValidator +import org.openapijsonschematools.client.schemas.validation.MapSchemaValidator +import org.openapijsonschematools.client.schemas.validation.NullSchemaValidator +import org.openapijsonschematools.client.schemas.validation.NumberSchemaValidator +import org.openapijsonschematools.client.schemas.validation.PathToSchemasMap +import org.openapijsonschematools.client.schemas.validation.StringSchemaValidator +import org.openapijsonschematools.client.schemas.validation.ValidationMetadata + +class PatternValidation { + // nest classes so all schemas and input/output classes can be public + + + sealed interface PatternValidation1Boxed { + fun getData(): Any? + } + + data class PatternValidation1BoxedVoid(val data: Nothing?) : PatternValidation1Boxed { + override fun getData(): Any? { + return data + } + } + + data class PatternValidation1BoxedBoolean(val data: Boolean): PatternValidation1Boxed { + override fun getData(): Any? { + return data + } + } + + data class PatternValidation1BoxedNumber(val data: Number) : PatternValidation1Boxed { + override fun getData(): Any? { + return data + } + } + + data class PatternValidation1BoxedString(val data: String) : PatternValidation1Boxed { + override fun getData(): Any? { + return data + } + } + + data class PatternValidation1BoxedList(val data: FrozenList) : PatternValidation1Boxed { + override fun getData(): Any? { + return data + } + } + + data class PatternValidation1BoxedMap(val data: FrozenMap) : PatternValidation1Boxed { + override fun getData(): Any? { + return data + } + } + + + class PatternValidation1 private constructor(): JsonSchema( + JsonSchemaInfo() + .pattern(Pattern.compile( + "^a*\$" + )) + ), NullSchemaValidator, BooleanSchemaValidator, NumberSchemaValidator, StringSchemaValidator, ListSchemaValidator, PatternValidation1BoxedList>, MapSchemaValidator, PatternValidation1BoxedMap> { + /* + NOTE: This class is auto generated by OpenAPI JSON Schema Generator. + Ref: https://github.com/openapi-json-schema-tools/openapi-json-schema-generator + + Do not edit the class manually. + */ + + companion object { + @Volatile + private var instance: PatternValidation1? = null + + fun getInstance() = + instance ?: synchronized(this) { + instance ?: PatternValidation1().also { instance = it } + } + } + + @Throws(ValidationException::class) + override fun validate(arg: Nothing?, configuration: SchemaConfiguration?): Nothing? { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validatedPathToSchemas = PathToSchemasMap() + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, LinkedHashSet()) + getPathToSchemas(this, castArg, validationMetadata, pathSet) + return castArg + } + + @Throws(ValidationException::class) + override fun validate(arg: Boolean, configuration: SchemaConfiguration?): Boolean { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validatedPathToSchemas = PathToSchemasMap() + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, LinkedHashSet()) + getPathToSchemas(this, castArg, validationMetadata, pathSet) + return castArg + } + + @Throws(ValidationException::class) + override fun validate(arg: Number, configuration: SchemaConfiguration?): Number { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validatedPathToSchemas = PathToSchemasMap() + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, LinkedHashSet()) + getPathToSchemas(this, castArg, validationMetadata, pathSet) + return castArg + } + + @Throws(ValidationException::class) + fun validate(arg: Int, configuration: SchemaConfiguration?): Int { + return validate(arg as Number, configuration) as Int + } + + @Throws(ValidationException::class) + fun validate(arg: Long, configuration: SchemaConfiguration?): Long { + return validate(arg as Number, configuration) as Long + } + + @Throws(ValidationException::class) + fun validate(arg: Float, configuration: SchemaConfiguration?): Float { + return validate(arg as Number, configuration) as Float + } + + @Throws(ValidationException::class) + fun validate(arg: Double, configuration: SchemaConfiguration?): Double { + return validate(arg as Number, configuration) as Double + } + + @Throws(ValidationException::class) + override fun validate(arg: String, configuration: SchemaConfiguration?): String { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validatedPathToSchemas = PathToSchemasMap() + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, LinkedHashSet()) + getPathToSchemas(this, castArg, validationMetadata, pathSet) + return castArg + } + + @Throws(ValidationException::class) + fun validate(arg: LocalDate, configuration: SchemaConfiguration?): String { + return validate(arg.toString(), configuration) + } + + @Throws(ValidationException::class) + fun validate(arg: ZonedDateTime, configuration: SchemaConfiguration?): String { + return validate(arg.toString(), configuration) + } + + @Throws(ValidationException::class) + fun validate(arg: UUID, configuration: SchemaConfiguration?): String { + return validate(arg.toString(), configuration) + } + + override fun getNewInstance(arg: List<*>, pathToItem: List, pathToSchemas: PathToSchemasMap): FrozenList { + val items: MutableList = ArrayList() + var i: Int = 0 + for (item: Any? in arg) { + val itemPathToItem = pathToItem + i + val schemas: LinkedHashMap, Nothing?>? = pathToSchemas.get(itemPathToItem) + if (schemas == null) { + throw RuntimeException("Validation result is invalid, schemas must exist for a pathToItem") + } + val itemSchema: JsonSchema<*> = schemas.entries.iterator().next().key + val itemInstance: Any? = itemSchema.getNewInstance(item, itemPathToItem, pathToSchemas) + items.add(itemInstance) + i += 1 + } + val newInstanceItems: FrozenList = FrozenList(items) + return newInstanceItems + } + + @Throws(ValidationException::class) + override fun validate(arg: List<*>, configuration: SchemaConfiguration?): FrozenList { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, PathToSchemasMap(), LinkedHashSet()) + val pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet) + return getNewInstance(castArg, validationMetadata.pathToItem, pathToSchemasMap) + } + + override fun getNewInstance(arg: Map<*, *>, pathToItem: List, pathToSchemas: PathToSchemasMap): FrozenMap { + val properties: LinkedHashMap = LinkedHashMap() + for((propertyName, value) in arg) { + if (!(propertyName is String)) { + throw RuntimeException("Invalid non-string key value") + } + val propertyPathToItem: List = pathToItem + propertyName + val schemas: LinkedHashMap, Nothing?>? = pathToSchemas.get(propertyPathToItem) + if (schemas == null) { + throw RuntimeException("Validation result is invalid, schemas must exist for a pathToItem") + } + val propertySchema: JsonSchema<*> = schemas.entries.iterator().next().key + val propertyInstance: Any? = propertySchema.getNewInstance(value, propertyPathToItem, pathToSchemas) + properties[propertyName] = propertyInstance + } + val castProperties: FrozenMap = FrozenMap(properties) + return castProperties + } + + @Throws(ValidationException::class) + override fun validate(arg: Map<*, *>, configuration: SchemaConfiguration?): FrozenMap { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validatedPathToSchemas = PathToSchemasMap() + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, LinkedHashSet()) + val pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet) + return getNewInstance(castArg, validationMetadata.pathToItem, pathToSchemasMap) + } + + @Throws(ValidationException::class) + override fun validate(arg: Any?, configuration: SchemaConfiguration?): Any? { + if (arg == null) { + return validate(null, configuration) + } else if (arg is Boolean) { + return validate(arg, configuration) + } else if (arg is Number) { + return validate(arg, configuration) + } else if (arg is String) { + return validate(arg, configuration) + } else if (arg is List<*>) { + return validate(arg, configuration) + } else if (arg is Map<*, *>) { + return validate(arg, configuration) + } + throw ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema") + } + override fun getNewInstance(arg: Any?, pathToItem: List, pathToSchemas: PathToSchemasMap): Any? { + if (arg == null) { + return getNewInstance( null, pathToItem, pathToSchemas) + } else if (arg is Boolean) { + return getNewInstance(arg, pathToItem, pathToSchemas) + } else if (arg is Number) { + return getNewInstance(arg, pathToItem, pathToSchemas) + } else if (arg is String) { + return getNewInstance(arg, pathToItem, pathToSchemas) + } else if (arg is List<*>) { + return getNewInstance(arg, pathToItem, pathToSchemas) + } else if (arg is Map<*, *>) { + return getNewInstance(arg, pathToItem, pathToSchemas) + } + throw RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema") + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: Nothing?, configuration: SchemaConfiguration?): PatternValidation1BoxedVoid { + return PatternValidation1BoxedVoid(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: Boolean, configuration: SchemaConfiguration?): PatternValidation1BoxedBoolean { + return PatternValidation1BoxedBoolean(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: Number, configuration: SchemaConfiguration?): PatternValidation1BoxedNumber { + return PatternValidation1BoxedNumber(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: String, configuration: SchemaConfiguration?): PatternValidation1BoxedString { + return PatternValidation1BoxedString(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: List<*>, configuration: SchemaConfiguration?): PatternValidation1BoxedList { + return PatternValidation1BoxedList(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: Map<*, *>, configuration: SchemaConfiguration?): PatternValidation1BoxedMap { + return PatternValidation1BoxedMap(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: Any?, configuration: SchemaConfiguration?): PatternValidation1Boxed { + if (arg == null) { + return validateAndBox(null, configuration) + } else if (arg is Boolean) { + return validateAndBox(arg, configuration) + } else if (arg is String) { + return validateAndBox(arg, configuration) + } else if (arg is Number) { + return validateAndBox(arg, configuration) + } else if (arg is List<*>) { + return validateAndBox(arg, configuration) + } else if (arg is Map<*, *>) { + return validateAndBox(arg, configuration) + } + throw ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema") + } + } +} diff --git a/samples/client/3_0_3_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/schemas/PropertiesWithEscapedCharacters.kt b/samples/client/3_0_3_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/schemas/PropertiesWithEscapedCharacters.kt new file mode 100644 index 00000000000..14863b15c8a --- /dev/null +++ b/samples/client/3_0_3_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/schemas/PropertiesWithEscapedCharacters.kt @@ -0,0 +1,640 @@ +package org.openapijsonschematools.client.components.schemas +import java.time.LocalDate +import java.time.ZonedDateTime +import java.util.UUID +import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags +import org.openapijsonschematools.client.configurations.SchemaConfiguration +import org.openapijsonschematools.client.exceptions.InvalidAdditionalPropertyException +import org.openapijsonschematools.client.exceptions.UnsetPropertyException +import org.openapijsonschematools.client.exceptions.ValidationException +import org.openapijsonschematools.client.schemas.GenericBuilder +import org.openapijsonschematools.client.schemas.NumberJsonSchema +import org.openapijsonschematools.client.schemas.UnsetAddPropsSetter +import org.openapijsonschematools.client.schemas.validation.BooleanSchemaValidator +import org.openapijsonschematools.client.schemas.validation.FrozenList +import org.openapijsonschematools.client.schemas.validation.FrozenMap +import org.openapijsonschematools.client.schemas.validation.JsonSchema +import org.openapijsonschematools.client.schemas.validation.JsonSchemaInfo +import org.openapijsonschematools.client.schemas.validation.ListSchemaValidator +import org.openapijsonschematools.client.schemas.validation.MapSchemaValidator +import org.openapijsonschematools.client.schemas.validation.NullSchemaValidator +import org.openapijsonschematools.client.schemas.validation.NumberSchemaValidator +import org.openapijsonschematools.client.schemas.validation.PathToSchemasMap +import org.openapijsonschematools.client.schemas.validation.StringSchemaValidator +import org.openapijsonschematools.client.schemas.validation.ValidationMetadata + +class PropertiesWithEscapedCharacters { + // nest classes so all schemas and input/output classes can be public + + + class Foonbar : NumberJsonSchema.NumberJsonSchema1() { + companion object { + @Volatile + private var instance: Foonbar? = null + + fun getInstance() = + instance ?: synchronized(this) { + instance ?: Foonbar().also { instance = it } + } + } + } + + + class Foobar : NumberJsonSchema.NumberJsonSchema1() { + companion object { + @Volatile + private var instance: Foobar? = null + + fun getInstance() = + instance ?: synchronized(this) { + instance ?: Foobar().also { instance = it } + } + } + } + + + class Foobar1 : NumberJsonSchema.NumberJsonSchema1() { + companion object { + @Volatile + private var instance: Foobar1? = null + + fun getInstance() = + instance ?: synchronized(this) { + instance ?: Foobar1().also { instance = it } + } + } + } + + + class Foorbar : NumberJsonSchema.NumberJsonSchema1() { + companion object { + @Volatile + private var instance: Foorbar? = null + + fun getInstance() = + instance ?: synchronized(this) { + instance ?: Foorbar().also { instance = it } + } + } + } + + + class Footbar : NumberJsonSchema.NumberJsonSchema1() { + companion object { + @Volatile + private var instance: Footbar? = null + + fun getInstance() = + instance ?: synchronized(this) { + instance ?: Footbar().also { instance = it } + } + } + } + + + class Foou000Cbar : NumberJsonSchema.NumberJsonSchema1() { + companion object { + @Volatile + private var instance: Foou000Cbar? = null + + fun getInstance() = + instance ?: synchronized(this) { + instance ?: Foou000Cbar().also { instance = it } + } + } + } + + + class PropertiesWithEscapedCharactersMap(m: FrozenMap) : FrozenMap(m) { + companion object { + val requiredKeys: Set = setOf() + val optionalKeys: Set = setOf( + "foo\nbar", + "foo\"bar", + "foo\\bar", + "foo\rbar", + "foo\tbar", + "foo\u000Cbar" + ) + @Throws(ValidationException::class) + fun of(arg: Map, configuration: SchemaConfiguration): PropertiesWithEscapedCharactersMap { + return PropertiesWithEscapedCharacters1.getInstance().validate(arg, configuration) + } + } + + @Throws(UnsetPropertyException::class, InvalidAdditionalPropertyException::class) + fun getAdditionalProperty(name: String): Any? { + throwIfKeyKnown(name, requiredKeys, optionalKeys) + throwIfKeyNotPresent(name) + return get(name) + } + } + + interface SetterForFoonbar { + fun getInstance(): MutableMap + fun getBuilderAfterFoonbar(instance: MutableMap): T + + fun fooReverseSolidusNbar(value: Int): T { + val instance = getInstance() + instance["foo\nbar"] = value + return getBuilderAfterFoonbar(instance) + } + + fun fooReverseSolidusNbar(value: Float): T { + val instance = getInstance() + instance["foo\nbar"] = value + return getBuilderAfterFoonbar(instance) + } + + fun fooReverseSolidusNbar(value: Long): T { + val instance = getInstance() + instance["foo\nbar"] = value + return getBuilderAfterFoonbar(instance) + } + + fun fooReverseSolidusNbar(value: Double): T { + val instance = getInstance() + instance["foo\nbar"] = value + return getBuilderAfterFoonbar(instance) + } + } + + interface SetterForFoobar { + fun getInstance(): MutableMap + fun getBuilderAfterFoobar(instance: MutableMap): T + + fun fooReverseSolidusQuotationMarkBar(value: Int): T { + val instance = getInstance() + instance["foo\"bar"] = value + return getBuilderAfterFoobar(instance) + } + + fun fooReverseSolidusQuotationMarkBar(value: Float): T { + val instance = getInstance() + instance["foo\"bar"] = value + return getBuilderAfterFoobar(instance) + } + + fun fooReverseSolidusQuotationMarkBar(value: Long): T { + val instance = getInstance() + instance["foo\"bar"] = value + return getBuilderAfterFoobar(instance) + } + + fun fooReverseSolidusQuotationMarkBar(value: Double): T { + val instance = getInstance() + instance["foo\"bar"] = value + return getBuilderAfterFoobar(instance) + } + } + + interface SetterForFoobar1 { + fun getInstance(): MutableMap + fun getBuilderAfterFoobar1(instance: MutableMap): T + + fun fooReverseSolidusReverseSolidusBar(value: Int): T { + val instance = getInstance() + instance["foo\\bar"] = value + return getBuilderAfterFoobar1(instance) + } + + fun fooReverseSolidusReverseSolidusBar(value: Float): T { + val instance = getInstance() + instance["foo\\bar"] = value + return getBuilderAfterFoobar1(instance) + } + + fun fooReverseSolidusReverseSolidusBar(value: Long): T { + val instance = getInstance() + instance["foo\\bar"] = value + return getBuilderAfterFoobar1(instance) + } + + fun fooReverseSolidusReverseSolidusBar(value: Double): T { + val instance = getInstance() + instance["foo\\bar"] = value + return getBuilderAfterFoobar1(instance) + } + } + + interface SetterForFoorbar { + fun getInstance(): MutableMap + fun getBuilderAfterFoorbar(instance: MutableMap): T + + fun fooReverseSolidusRbar(value: Int): T { + val instance = getInstance() + instance["foo\rbar"] = value + return getBuilderAfterFoorbar(instance) + } + + fun fooReverseSolidusRbar(value: Float): T { + val instance = getInstance() + instance["foo\rbar"] = value + return getBuilderAfterFoorbar(instance) + } + + fun fooReverseSolidusRbar(value: Long): T { + val instance = getInstance() + instance["foo\rbar"] = value + return getBuilderAfterFoorbar(instance) + } + + fun fooReverseSolidusRbar(value: Double): T { + val instance = getInstance() + instance["foo\rbar"] = value + return getBuilderAfterFoorbar(instance) + } + } + + interface SetterForFootbar { + fun getInstance(): MutableMap + fun getBuilderAfterFootbar(instance: MutableMap): T + + fun fooReverseSolidusTbar(value: Int): T { + val instance = getInstance() + instance["foo\tbar"] = value + return getBuilderAfterFootbar(instance) + } + + fun fooReverseSolidusTbar(value: Float): T { + val instance = getInstance() + instance["foo\tbar"] = value + return getBuilderAfterFootbar(instance) + } + + fun fooReverseSolidusTbar(value: Long): T { + val instance = getInstance() + instance["foo\tbar"] = value + return getBuilderAfterFootbar(instance) + } + + fun fooReverseSolidusTbar(value: Double): T { + val instance = getInstance() + instance["foo\tbar"] = value + return getBuilderAfterFootbar(instance) + } + } + + interface SetterForFoou000Cbar { + fun getInstance(): MutableMap + fun getBuilderAfterFoou000Cbar(instance: MutableMap): T + + fun fooReverseSolidusU000cbar(value: Int): T { + val instance = getInstance() + instance["foo\u000Cbar"] = value + return getBuilderAfterFoou000Cbar(instance) + } + + fun fooReverseSolidusU000cbar(value: Float): T { + val instance = getInstance() + instance["foo\u000Cbar"] = value + return getBuilderAfterFoou000Cbar(instance) + } + + fun fooReverseSolidusU000cbar(value: Long): T { + val instance = getInstance() + instance["foo\u000Cbar"] = value + return getBuilderAfterFoou000Cbar(instance) + } + + fun fooReverseSolidusU000cbar(value: Double): T { + val instance = getInstance() + instance["foo\u000Cbar"] = value + return getBuilderAfterFoou000Cbar(instance) + } + } + + class PropertiesWithEscapedCharactersMapBuilder: UnsetAddPropsSetter, GenericBuilder>, SetterForFoonbar, SetterForFoobar, SetterForFoobar1, SetterForFoorbar, SetterForFootbar, SetterForFoou000Cbar { + private val knownKeys: Set = setOf( + "foo\nbar", + "foo\"bar", + "foo\\bar", + "foo\rbar", + "foo\tbar", + "foo\u000Cbar" + ) + override fun getKnownKeys(): Set { + return knownKeys + } + private val instance: MutableMap + init { + this.instance = LinkedHashMap() + } + override fun build(): Map { + return instance + } + override fun getInstance(): MutableMap { + return instance + } + override fun getBuilderAfterFoonbar(instance: MutableMap): PropertiesWithEscapedCharactersMapBuilder { + return this + } + override fun getBuilderAfterFoobar(instance: MutableMap): PropertiesWithEscapedCharactersMapBuilder { + return this + } + override fun getBuilderAfterFoobar1(instance: MutableMap): PropertiesWithEscapedCharactersMapBuilder { + return this + } + override fun getBuilderAfterFoorbar(instance: MutableMap): PropertiesWithEscapedCharactersMapBuilder { + return this + } + override fun getBuilderAfterFootbar(instance: MutableMap): PropertiesWithEscapedCharactersMapBuilder { + return this + } + override fun getBuilderAfterFoou000Cbar(instance: MutableMap): PropertiesWithEscapedCharactersMapBuilder { + return this + } + override fun getBuilderAfterAdditionalProperty(instance: MutableMap): PropertiesWithEscapedCharactersMapBuilder { + return this + } + } + + + sealed interface PropertiesWithEscapedCharacters1Boxed { + fun getData(): Any? + } + + data class PropertiesWithEscapedCharacters1BoxedVoid(val data: Nothing?) : PropertiesWithEscapedCharacters1Boxed { + override fun getData(): Any? { + return data + } + } + + data class PropertiesWithEscapedCharacters1BoxedBoolean(val data: Boolean): PropertiesWithEscapedCharacters1Boxed { + override fun getData(): Any? { + return data + } + } + + data class PropertiesWithEscapedCharacters1BoxedNumber(val data: Number) : PropertiesWithEscapedCharacters1Boxed { + override fun getData(): Any? { + return data + } + } + + data class PropertiesWithEscapedCharacters1BoxedString(val data: String) : PropertiesWithEscapedCharacters1Boxed { + override fun getData(): Any? { + return data + } + } + + data class PropertiesWithEscapedCharacters1BoxedList(val data: FrozenList) : PropertiesWithEscapedCharacters1Boxed { + override fun getData(): Any? { + return data + } + } + + data class PropertiesWithEscapedCharacters1BoxedMap(val data: PropertiesWithEscapedCharactersMap) : PropertiesWithEscapedCharacters1Boxed { + override fun getData(): Any? { + return data + } + } + + + class PropertiesWithEscapedCharacters1 private constructor(): JsonSchema( + JsonSchemaInfo() + .properties(mapOf( + "foo\nbar" to Foonbar::class.java, + "foo\"bar" to Foobar::class.java, + "foo\\bar" to Foobar1::class.java, + "foo\rbar" to Foorbar::class.java, + "foo\tbar" to Footbar::class.java, + "foo\u000Cbar" to Foou000Cbar::class.java + )) + ), NullSchemaValidator, BooleanSchemaValidator, NumberSchemaValidator, StringSchemaValidator, ListSchemaValidator, PropertiesWithEscapedCharacters1BoxedList>, MapSchemaValidator { + /* + NOTE: This class is auto generated by OpenAPI JSON Schema Generator. + Ref: https://github.com/openapi-json-schema-tools/openapi-json-schema-generator + + Do not edit the class manually. + */ + + companion object { + @Volatile + private var instance: PropertiesWithEscapedCharacters1? = null + + fun getInstance() = + instance ?: synchronized(this) { + instance ?: PropertiesWithEscapedCharacters1().also { instance = it } + } + } + + @Throws(ValidationException::class) + override fun validate(arg: Nothing?, configuration: SchemaConfiguration?): Nothing? { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validatedPathToSchemas = PathToSchemasMap() + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, LinkedHashSet()) + getPathToSchemas(this, castArg, validationMetadata, pathSet) + return castArg + } + + @Throws(ValidationException::class) + override fun validate(arg: Boolean, configuration: SchemaConfiguration?): Boolean { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validatedPathToSchemas = PathToSchemasMap() + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, LinkedHashSet()) + getPathToSchemas(this, castArg, validationMetadata, pathSet) + return castArg + } + + @Throws(ValidationException::class) + override fun validate(arg: Number, configuration: SchemaConfiguration?): Number { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validatedPathToSchemas = PathToSchemasMap() + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, LinkedHashSet()) + getPathToSchemas(this, castArg, validationMetadata, pathSet) + return castArg + } + + @Throws(ValidationException::class) + fun validate(arg: Int, configuration: SchemaConfiguration?): Int { + return validate(arg as Number, configuration) as Int + } + + @Throws(ValidationException::class) + fun validate(arg: Long, configuration: SchemaConfiguration?): Long { + return validate(arg as Number, configuration) as Long + } + + @Throws(ValidationException::class) + fun validate(arg: Float, configuration: SchemaConfiguration?): Float { + return validate(arg as Number, configuration) as Float + } + + @Throws(ValidationException::class) + fun validate(arg: Double, configuration: SchemaConfiguration?): Double { + return validate(arg as Number, configuration) as Double + } + + @Throws(ValidationException::class) + override fun validate(arg: String, configuration: SchemaConfiguration?): String { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validatedPathToSchemas = PathToSchemasMap() + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, LinkedHashSet()) + getPathToSchemas(this, castArg, validationMetadata, pathSet) + return castArg + } + + @Throws(ValidationException::class) + fun validate(arg: LocalDate, configuration: SchemaConfiguration?): String { + return validate(arg.toString(), configuration) + } + + @Throws(ValidationException::class) + fun validate(arg: ZonedDateTime, configuration: SchemaConfiguration?): String { + return validate(arg.toString(), configuration) + } + + @Throws(ValidationException::class) + fun validate(arg: UUID, configuration: SchemaConfiguration?): String { + return validate(arg.toString(), configuration) + } + + override fun getNewInstance(arg: List<*>, pathToItem: List, pathToSchemas: PathToSchemasMap): FrozenList { + val items: MutableList = ArrayList() + var i: Int = 0 + for (item: Any? in arg) { + val itemPathToItem = pathToItem + i + val schemas: LinkedHashMap, Nothing?>? = pathToSchemas.get(itemPathToItem) + if (schemas == null) { + throw RuntimeException("Validation result is invalid, schemas must exist for a pathToItem") + } + val itemSchema: JsonSchema<*> = schemas.entries.iterator().next().key + val itemInstance: Any? = itemSchema.getNewInstance(item, itemPathToItem, pathToSchemas) + items.add(itemInstance) + i += 1 + } + val newInstanceItems: FrozenList = FrozenList(items) + return newInstanceItems + } + + @Throws(ValidationException::class) + override fun validate(arg: List<*>, configuration: SchemaConfiguration?): FrozenList { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, PathToSchemasMap(), LinkedHashSet()) + val pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet) + return getNewInstance(castArg, validationMetadata.pathToItem, pathToSchemasMap) + } + + override fun getNewInstance(arg: Map<*, *>, pathToItem: List, pathToSchemas: PathToSchemasMap): PropertiesWithEscapedCharactersMap { + val properties: LinkedHashMap = LinkedHashMap() + for((propertyName, value) in arg) { + if (!(propertyName is String)) { + throw RuntimeException("Invalid non-string key value") + } + val propertyPathToItem: List = pathToItem + propertyName + val schemas: LinkedHashMap, Nothing?>? = pathToSchemas.get(propertyPathToItem) + if (schemas == null) { + throw RuntimeException("Validation result is invalid, schemas must exist for a pathToItem") + } + val propertySchema: JsonSchema<*> = schemas.entries.iterator().next().key + val propertyInstance: Any? = propertySchema.getNewInstance(value, propertyPathToItem, pathToSchemas) + properties[propertyName] = propertyInstance + } + val castProperties: FrozenMap = FrozenMap(properties) + return PropertiesWithEscapedCharactersMap(castProperties) + } + + @Throws(ValidationException::class) + override fun validate(arg: Map<*, *>, configuration: SchemaConfiguration?): PropertiesWithEscapedCharactersMap { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validatedPathToSchemas = PathToSchemasMap() + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, LinkedHashSet()) + val pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet) + return getNewInstance(castArg, validationMetadata.pathToItem, pathToSchemasMap) + } + + @Throws(ValidationException::class) + override fun validate(arg: Any?, configuration: SchemaConfiguration?): Any? { + if (arg == null) { + return validate(null, configuration) + } else if (arg is Boolean) { + return validate(arg, configuration) + } else if (arg is Number) { + return validate(arg, configuration) + } else if (arg is String) { + return validate(arg, configuration) + } else if (arg is List<*>) { + return validate(arg, configuration) + } else if (arg is Map<*, *>) { + return validate(arg, configuration) + } + throw ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema") + } + override fun getNewInstance(arg: Any?, pathToItem: List, pathToSchemas: PathToSchemasMap): Any? { + if (arg == null) { + return getNewInstance( null, pathToItem, pathToSchemas) + } else if (arg is Boolean) { + return getNewInstance(arg, pathToItem, pathToSchemas) + } else if (arg is Number) { + return getNewInstance(arg, pathToItem, pathToSchemas) + } else if (arg is String) { + return getNewInstance(arg, pathToItem, pathToSchemas) + } else if (arg is List<*>) { + return getNewInstance(arg, pathToItem, pathToSchemas) + } else if (arg is Map<*, *>) { + return getNewInstance(arg, pathToItem, pathToSchemas) + } + throw RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema") + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: Nothing?, configuration: SchemaConfiguration?): PropertiesWithEscapedCharacters1BoxedVoid { + return PropertiesWithEscapedCharacters1BoxedVoid(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: Boolean, configuration: SchemaConfiguration?): PropertiesWithEscapedCharacters1BoxedBoolean { + return PropertiesWithEscapedCharacters1BoxedBoolean(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: Number, configuration: SchemaConfiguration?): PropertiesWithEscapedCharacters1BoxedNumber { + return PropertiesWithEscapedCharacters1BoxedNumber(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: String, configuration: SchemaConfiguration?): PropertiesWithEscapedCharacters1BoxedString { + return PropertiesWithEscapedCharacters1BoxedString(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: List<*>, configuration: SchemaConfiguration?): PropertiesWithEscapedCharacters1BoxedList { + return PropertiesWithEscapedCharacters1BoxedList(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: Map<*, *>, configuration: SchemaConfiguration?): PropertiesWithEscapedCharacters1BoxedMap { + return PropertiesWithEscapedCharacters1BoxedMap(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: Any?, configuration: SchemaConfiguration?): PropertiesWithEscapedCharacters1Boxed { + if (arg == null) { + return validateAndBox(null, configuration) + } else if (arg is Boolean) { + return validateAndBox(arg, configuration) + } else if (arg is String) { + return validateAndBox(arg, configuration) + } else if (arg is Number) { + return validateAndBox(arg, configuration) + } else if (arg is List<*>) { + return validateAndBox(arg, configuration) + } else if (arg is Map<*, *>) { + return validateAndBox(arg, configuration) + } + throw ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema") + } + } +} diff --git a/samples/client/3_0_3_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/schemas/PropertyNamedRefThatIsNotAReference.kt b/samples/client/3_0_3_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/schemas/PropertyNamedRefThatIsNotAReference.kt new file mode 100644 index 00000000000..7517a23585e --- /dev/null +++ b/samples/client/3_0_3_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/schemas/PropertyNamedRefThatIsNotAReference.kt @@ -0,0 +1,382 @@ +package org.openapijsonschematools.client.components.schemas +import java.time.LocalDate +import java.time.ZonedDateTime +import java.util.UUID +import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags +import org.openapijsonschematools.client.configurations.SchemaConfiguration +import org.openapijsonschematools.client.exceptions.InvalidAdditionalPropertyException +import org.openapijsonschematools.client.exceptions.UnsetPropertyException +import org.openapijsonschematools.client.exceptions.ValidationException +import org.openapijsonschematools.client.schemas.GenericBuilder +import org.openapijsonschematools.client.schemas.StringJsonSchema +import org.openapijsonschematools.client.schemas.UnsetAddPropsSetter +import org.openapijsonschematools.client.schemas.validation.BooleanSchemaValidator +import org.openapijsonschematools.client.schemas.validation.FrozenList +import org.openapijsonschematools.client.schemas.validation.FrozenMap +import org.openapijsonschematools.client.schemas.validation.JsonSchema +import org.openapijsonschematools.client.schemas.validation.JsonSchemaInfo +import org.openapijsonschematools.client.schemas.validation.ListSchemaValidator +import org.openapijsonschematools.client.schemas.validation.MapSchemaValidator +import org.openapijsonschematools.client.schemas.validation.NullSchemaValidator +import org.openapijsonschematools.client.schemas.validation.NumberSchemaValidator +import org.openapijsonschematools.client.schemas.validation.PathToSchemasMap +import org.openapijsonschematools.client.schemas.validation.StringSchemaValidator +import org.openapijsonschematools.client.schemas.validation.ValidationMetadata + +class PropertyNamedRefThatIsNotAReference { + // nest classes so all schemas and input/output classes can be public + + + class Ref : StringJsonSchema.StringJsonSchema1() { + companion object { + @Volatile + private var instance: Ref? = null + + fun getInstance() = + instance ?: synchronized(this) { + instance ?: Ref().also { instance = it } + } + } + } + + + class PropertyNamedRefThatIsNotAReferenceMap(m: FrozenMap) : FrozenMap(m) { + companion object { + val requiredKeys: Set = setOf() + val optionalKeys: Set = setOf( + "\$ref" + ) + @Throws(ValidationException::class) + fun of(arg: Map, configuration: SchemaConfiguration): PropertyNamedRefThatIsNotAReferenceMap { + return PropertyNamedRefThatIsNotAReference1.getInstance().validate(arg, configuration) + } + } + + @Throws(UnsetPropertyException::class, InvalidAdditionalPropertyException::class) + fun getAdditionalProperty(name: String): Any? { + throwIfKeyKnown(name, requiredKeys, optionalKeys) + throwIfKeyNotPresent(name) + return get(name) + } + } + + interface SetterForRef { + fun getInstance(): MutableMap + fun getBuilderAfterRef(instance: MutableMap): T + + fun reverseSolidusDollarSignRef(value: String): T { + val instance = getInstance() + instance["\$ref"] = value + return getBuilderAfterRef(instance) + } + } + + class PropertyNamedRefThatIsNotAReferenceMapBuilder: UnsetAddPropsSetter, GenericBuilder>, SetterForRef { + private val knownKeys: Set = setOf( + "\$ref" + ) + override fun getKnownKeys(): Set { + return knownKeys + } + private val instance: MutableMap + init { + this.instance = LinkedHashMap() + } + override fun build(): Map { + return instance + } + override fun getInstance(): MutableMap { + return instance + } + override fun getBuilderAfterRef(instance: MutableMap): PropertyNamedRefThatIsNotAReferenceMapBuilder { + return this + } + override fun getBuilderAfterAdditionalProperty(instance: MutableMap): PropertyNamedRefThatIsNotAReferenceMapBuilder { + return this + } + } + + + sealed interface PropertyNamedRefThatIsNotAReference1Boxed { + fun getData(): Any? + } + + data class PropertyNamedRefThatIsNotAReference1BoxedVoid(val data: Nothing?) : PropertyNamedRefThatIsNotAReference1Boxed { + override fun getData(): Any? { + return data + } + } + + data class PropertyNamedRefThatIsNotAReference1BoxedBoolean(val data: Boolean): PropertyNamedRefThatIsNotAReference1Boxed { + override fun getData(): Any? { + return data + } + } + + data class PropertyNamedRefThatIsNotAReference1BoxedNumber(val data: Number) : PropertyNamedRefThatIsNotAReference1Boxed { + override fun getData(): Any? { + return data + } + } + + data class PropertyNamedRefThatIsNotAReference1BoxedString(val data: String) : PropertyNamedRefThatIsNotAReference1Boxed { + override fun getData(): Any? { + return data + } + } + + data class PropertyNamedRefThatIsNotAReference1BoxedList(val data: FrozenList) : PropertyNamedRefThatIsNotAReference1Boxed { + override fun getData(): Any? { + return data + } + } + + data class PropertyNamedRefThatIsNotAReference1BoxedMap(val data: PropertyNamedRefThatIsNotAReferenceMap) : PropertyNamedRefThatIsNotAReference1Boxed { + override fun getData(): Any? { + return data + } + } + + + class PropertyNamedRefThatIsNotAReference1 private constructor(): JsonSchema( + JsonSchemaInfo() + .properties(mapOf( + "\$ref" to Ref::class.java + )) + ), NullSchemaValidator, BooleanSchemaValidator, NumberSchemaValidator, StringSchemaValidator, ListSchemaValidator, PropertyNamedRefThatIsNotAReference1BoxedList>, MapSchemaValidator { + /* + NOTE: This class is auto generated by OpenAPI JSON Schema Generator. + Ref: https://github.com/openapi-json-schema-tools/openapi-json-schema-generator + + Do not edit the class manually. + */ + + companion object { + @Volatile + private var instance: PropertyNamedRefThatIsNotAReference1? = null + + fun getInstance() = + instance ?: synchronized(this) { + instance ?: PropertyNamedRefThatIsNotAReference1().also { instance = it } + } + } + + @Throws(ValidationException::class) + override fun validate(arg: Nothing?, configuration: SchemaConfiguration?): Nothing? { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validatedPathToSchemas = PathToSchemasMap() + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, LinkedHashSet()) + getPathToSchemas(this, castArg, validationMetadata, pathSet) + return castArg + } + + @Throws(ValidationException::class) + override fun validate(arg: Boolean, configuration: SchemaConfiguration?): Boolean { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validatedPathToSchemas = PathToSchemasMap() + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, LinkedHashSet()) + getPathToSchemas(this, castArg, validationMetadata, pathSet) + return castArg + } + + @Throws(ValidationException::class) + override fun validate(arg: Number, configuration: SchemaConfiguration?): Number { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validatedPathToSchemas = PathToSchemasMap() + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, LinkedHashSet()) + getPathToSchemas(this, castArg, validationMetadata, pathSet) + return castArg + } + + @Throws(ValidationException::class) + fun validate(arg: Int, configuration: SchemaConfiguration?): Int { + return validate(arg as Number, configuration) as Int + } + + @Throws(ValidationException::class) + fun validate(arg: Long, configuration: SchemaConfiguration?): Long { + return validate(arg as Number, configuration) as Long + } + + @Throws(ValidationException::class) + fun validate(arg: Float, configuration: SchemaConfiguration?): Float { + return validate(arg as Number, configuration) as Float + } + + @Throws(ValidationException::class) + fun validate(arg: Double, configuration: SchemaConfiguration?): Double { + return validate(arg as Number, configuration) as Double + } + + @Throws(ValidationException::class) + override fun validate(arg: String, configuration: SchemaConfiguration?): String { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validatedPathToSchemas = PathToSchemasMap() + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, LinkedHashSet()) + getPathToSchemas(this, castArg, validationMetadata, pathSet) + return castArg + } + + @Throws(ValidationException::class) + fun validate(arg: LocalDate, configuration: SchemaConfiguration?): String { + return validate(arg.toString(), configuration) + } + + @Throws(ValidationException::class) + fun validate(arg: ZonedDateTime, configuration: SchemaConfiguration?): String { + return validate(arg.toString(), configuration) + } + + @Throws(ValidationException::class) + fun validate(arg: UUID, configuration: SchemaConfiguration?): String { + return validate(arg.toString(), configuration) + } + + override fun getNewInstance(arg: List<*>, pathToItem: List, pathToSchemas: PathToSchemasMap): FrozenList { + val items: MutableList = ArrayList() + var i: Int = 0 + for (item: Any? in arg) { + val itemPathToItem = pathToItem + i + val schemas: LinkedHashMap, Nothing?>? = pathToSchemas.get(itemPathToItem) + if (schemas == null) { + throw RuntimeException("Validation result is invalid, schemas must exist for a pathToItem") + } + val itemSchema: JsonSchema<*> = schemas.entries.iterator().next().key + val itemInstance: Any? = itemSchema.getNewInstance(item, itemPathToItem, pathToSchemas) + items.add(itemInstance) + i += 1 + } + val newInstanceItems: FrozenList = FrozenList(items) + return newInstanceItems + } + + @Throws(ValidationException::class) + override fun validate(arg: List<*>, configuration: SchemaConfiguration?): FrozenList { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, PathToSchemasMap(), LinkedHashSet()) + val pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet) + return getNewInstance(castArg, validationMetadata.pathToItem, pathToSchemasMap) + } + + override fun getNewInstance(arg: Map<*, *>, pathToItem: List, pathToSchemas: PathToSchemasMap): PropertyNamedRefThatIsNotAReferenceMap { + val properties: LinkedHashMap = LinkedHashMap() + for((propertyName, value) in arg) { + if (!(propertyName is String)) { + throw RuntimeException("Invalid non-string key value") + } + val propertyPathToItem: List = pathToItem + propertyName + val schemas: LinkedHashMap, Nothing?>? = pathToSchemas.get(propertyPathToItem) + if (schemas == null) { + throw RuntimeException("Validation result is invalid, schemas must exist for a pathToItem") + } + val propertySchema: JsonSchema<*> = schemas.entries.iterator().next().key + val propertyInstance: Any? = propertySchema.getNewInstance(value, propertyPathToItem, pathToSchemas) + properties[propertyName] = propertyInstance + } + val castProperties: FrozenMap = FrozenMap(properties) + return PropertyNamedRefThatIsNotAReferenceMap(castProperties) + } + + @Throws(ValidationException::class) + override fun validate(arg: Map<*, *>, configuration: SchemaConfiguration?): PropertyNamedRefThatIsNotAReferenceMap { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validatedPathToSchemas = PathToSchemasMap() + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, LinkedHashSet()) + val pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet) + return getNewInstance(castArg, validationMetadata.pathToItem, pathToSchemasMap) + } + + @Throws(ValidationException::class) + override fun validate(arg: Any?, configuration: SchemaConfiguration?): Any? { + if (arg == null) { + return validate(null, configuration) + } else if (arg is Boolean) { + return validate(arg, configuration) + } else if (arg is Number) { + return validate(arg, configuration) + } else if (arg is String) { + return validate(arg, configuration) + } else if (arg is List<*>) { + return validate(arg, configuration) + } else if (arg is Map<*, *>) { + return validate(arg, configuration) + } + throw ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema") + } + override fun getNewInstance(arg: Any?, pathToItem: List, pathToSchemas: PathToSchemasMap): Any? { + if (arg == null) { + return getNewInstance( null, pathToItem, pathToSchemas) + } else if (arg is Boolean) { + return getNewInstance(arg, pathToItem, pathToSchemas) + } else if (arg is Number) { + return getNewInstance(arg, pathToItem, pathToSchemas) + } else if (arg is String) { + return getNewInstance(arg, pathToItem, pathToSchemas) + } else if (arg is List<*>) { + return getNewInstance(arg, pathToItem, pathToSchemas) + } else if (arg is Map<*, *>) { + return getNewInstance(arg, pathToItem, pathToSchemas) + } + throw RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema") + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: Nothing?, configuration: SchemaConfiguration?): PropertyNamedRefThatIsNotAReference1BoxedVoid { + return PropertyNamedRefThatIsNotAReference1BoxedVoid(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: Boolean, configuration: SchemaConfiguration?): PropertyNamedRefThatIsNotAReference1BoxedBoolean { + return PropertyNamedRefThatIsNotAReference1BoxedBoolean(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: Number, configuration: SchemaConfiguration?): PropertyNamedRefThatIsNotAReference1BoxedNumber { + return PropertyNamedRefThatIsNotAReference1BoxedNumber(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: String, configuration: SchemaConfiguration?): PropertyNamedRefThatIsNotAReference1BoxedString { + return PropertyNamedRefThatIsNotAReference1BoxedString(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: List<*>, configuration: SchemaConfiguration?): PropertyNamedRefThatIsNotAReference1BoxedList { + return PropertyNamedRefThatIsNotAReference1BoxedList(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: Map<*, *>, configuration: SchemaConfiguration?): PropertyNamedRefThatIsNotAReference1BoxedMap { + return PropertyNamedRefThatIsNotAReference1BoxedMap(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: Any?, configuration: SchemaConfiguration?): PropertyNamedRefThatIsNotAReference1Boxed { + if (arg == null) { + return validateAndBox(null, configuration) + } else if (arg is Boolean) { + return validateAndBox(arg, configuration) + } else if (arg is String) { + return validateAndBox(arg, configuration) + } else if (arg is Number) { + return validateAndBox(arg, configuration) + } else if (arg is List<*>) { + return validateAndBox(arg, configuration) + } else if (arg is Map<*, *>) { + return validateAndBox(arg, configuration) + } + throw ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema") + } + } +} diff --git a/samples/client/3_0_3_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/schemas/RefInAdditionalproperties.kt b/samples/client/3_0_3_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/schemas/RefInAdditionalproperties.kt new file mode 100644 index 00000000000..7783daeab08 --- /dev/null +++ b/samples/client/3_0_3_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/schemas/RefInAdditionalproperties.kt @@ -0,0 +1,228 @@ +package org.openapijsonschematools.client.components.schemas +import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags +import org.openapijsonschematools.client.configurations.SchemaConfiguration +import org.openapijsonschematools.client.exceptions.InvalidAdditionalPropertyException +import org.openapijsonschematools.client.exceptions.UnsetPropertyException +import org.openapijsonschematools.client.exceptions.ValidationException +import org.openapijsonschematools.client.schemas.GenericBuilder +import org.openapijsonschematools.client.schemas.validation.FrozenMap +import org.openapijsonschematools.client.schemas.validation.JsonSchema +import org.openapijsonschematools.client.schemas.validation.JsonSchemaInfo +import org.openapijsonschematools.client.schemas.validation.MapSchemaValidator +import org.openapijsonschematools.client.schemas.validation.MapUtils +import org.openapijsonschematools.client.schemas.validation.PathToSchemasMap +import org.openapijsonschematools.client.schemas.validation.ValidationMetadata + +class RefInAdditionalproperties { + // nest classes so all schemas and input/output classes can be public + + + class RefInAdditionalpropertiesMap(m: FrozenMap) : FrozenMap(m) { + companion object { + val requiredKeys: Set = setOf() + val optionalKeys: Set = setOf() + @Throws(ValidationException::class) + fun of(arg: Map, configuration: SchemaConfiguration): RefInAdditionalpropertiesMap { + return RefInAdditionalproperties1.getInstance().validate(arg, configuration) + } + } + + @Throws(UnsetPropertyException::class) + fun getAdditionalProperty(name: String): Any? { + return getOrThrow(name) + } + } + + interface SetterForAdditionalProperties { + fun getKnownKeys(): Set + fun getInstance(): MutableMap + fun getBuilderAfterAdditionalProperty(instance: MutableMap): T + + @Throws(InvalidAdditionalPropertyException::class) + fun additionalProperty(key: String, value: Nothing?): T { + MapUtils.throwIfKeyKnown(key, getKnownKeys(), true) + val instance = getInstance() + instance[key] = null + return getBuilderAfterAdditionalProperty(instance) + } + + @Throws(InvalidAdditionalPropertyException::class) + fun additionalProperty(key: String, value: Boolean): T { + MapUtils.throwIfKeyKnown(key, getKnownKeys(), true) + val instance = getInstance() + instance[key] = value + return getBuilderAfterAdditionalProperty(instance) + } + + @Throws(InvalidAdditionalPropertyException::class) + fun additionalProperty(key: String, value: String): T { + MapUtils.throwIfKeyKnown(key, getKnownKeys(), true) + val instance = getInstance() + instance[key] = value + return getBuilderAfterAdditionalProperty(instance) + } + + @Throws(InvalidAdditionalPropertyException::class) + fun additionalProperty(key: String, value: Int): T { + MapUtils.throwIfKeyKnown(key, getKnownKeys(), true) + val instance = getInstance() + instance[key] = value + return getBuilderAfterAdditionalProperty(instance) + } + + @Throws(InvalidAdditionalPropertyException::class) + fun additionalProperty(key: String, value: Float): T { + MapUtils.throwIfKeyKnown(key, getKnownKeys(), true) + val instance = getInstance() + instance[key] = value + return getBuilderAfterAdditionalProperty(instance) + } + + @Throws(InvalidAdditionalPropertyException::class) + fun additionalProperty(key: String, value: Long): T { + MapUtils.throwIfKeyKnown(key, getKnownKeys(), true) + val instance = getInstance() + instance[key] = value + return getBuilderAfterAdditionalProperty(instance) + } + + @Throws(InvalidAdditionalPropertyException::class) + fun additionalProperty(key: String, value: Double): T { + MapUtils.throwIfKeyKnown(key, getKnownKeys(), true) + val instance = getInstance() + instance[key] = value + return getBuilderAfterAdditionalProperty(instance) + } + + @Throws(InvalidAdditionalPropertyException::class) + fun additionalProperty(key: String, value: List): T { + MapUtils.throwIfKeyKnown(key, getKnownKeys(), true) + val instance = getInstance() + instance[key] = value + return getBuilderAfterAdditionalProperty(instance) + } + + @Throws(InvalidAdditionalPropertyException::class) + fun additionalProperty(key: String, value: Map): T { + MapUtils.throwIfKeyKnown(key, getKnownKeys(), true) + val instance = getInstance() + instance[key] = value + return getBuilderAfterAdditionalProperty(instance) + } + } + + class RefInAdditionalpropertiesMapBuilder: GenericBuilder>, SetterForAdditionalProperties { + private val knownKeys: Set = setOf() + override fun getKnownKeys(): Set { + return knownKeys + } + private val instance: MutableMap + init { + this.instance = LinkedHashMap() + } + override fun build(): Map { + return instance + } + override fun getInstance(): MutableMap { + return instance + } + override fun getBuilderAfterAdditionalProperty(instance: MutableMap): RefInAdditionalpropertiesMapBuilder { + return this + } + } + + + sealed interface RefInAdditionalproperties1Boxed { + fun getData(): Any? + } + + data class RefInAdditionalproperties1BoxedMap(val data: RefInAdditionalpropertiesMap) : RefInAdditionalproperties1Boxed { + override fun getData(): Any? { + return data + } + } + + + class RefInAdditionalproperties1 private constructor(): JsonSchema( + JsonSchemaInfo() + .type(setOf(Map::class.java)) + .additionalProperties(PropertyNamedRefThatIsNotAReference.PropertyNamedRefThatIsNotAReference1::class.java) + ), MapSchemaValidator { + /* + NOTE: This class is auto generated by OpenAPI JSON Schema Generator. + Ref: https://github.com/openapi-json-schema-tools/openapi-json-schema-generator + + Do not edit the class manually. + */ + + companion object { + @Volatile + private var instance: RefInAdditionalproperties1? = null + + fun getInstance() = + instance ?: synchronized(this) { + instance ?: RefInAdditionalproperties1().also { instance = it } + } + } + + override fun getNewInstance(arg: Map<*, *>, pathToItem: List, pathToSchemas: PathToSchemasMap): RefInAdditionalpropertiesMap { + val properties: LinkedHashMap = LinkedHashMap() + for((entryKey, value) in arg) { + if (!(entryKey is String)) { + throw RuntimeException("Invalid non-string key value") + } + val propertyPathToItem: List = pathToItem + entryKey + val schemas: LinkedHashMap, Nothing?>? = pathToSchemas.get(propertyPathToItem) + if (schemas == null) { + throw RuntimeException("Validation result is invalid, schemas must exist for a pathToItem") + } + val propertySchema: JsonSchema<*> = schemas.entries.iterator().next().key + val propertyInstance: Any? = propertySchema.getNewInstance(value, propertyPathToItem, pathToSchemas) + if (!(propertyInstance is Any)) { + throw RuntimeException("Invalid instantiated value") + } + properties[entryKey] = propertyInstance + } + val castProperties: FrozenMap = FrozenMap(properties) + return RefInAdditionalpropertiesMap(castProperties) + } + + @Throws(ValidationException::class) + override fun validate(arg: Map<*, *>, configuration: SchemaConfiguration?): RefInAdditionalpropertiesMap { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, PathToSchemasMap(), LinkedHashSet()) + val pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet) + return getNewInstance(castArg, validationMetadata.pathToItem, pathToSchemasMap) + } + + + @Throws(ValidationException::class) + override fun validate(arg: Any?, configuration: SchemaConfiguration?): Any? { + if (arg is Map<*, *>) { + return validate(arg, configuration) + } + throw ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema") + } + override fun getNewInstance(arg: Any?, pathToItem: List, pathToSchemas: PathToSchemasMap): Any? { + if (arg is Map<*, *>) { + return getNewInstance(arg, pathToItem, pathToSchemas) + } + throw RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema") + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: Map<*, *>, configuration: SchemaConfiguration?): RefInAdditionalproperties1BoxedMap { + return RefInAdditionalproperties1BoxedMap(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: Any?, configuration: SchemaConfiguration?): RefInAdditionalproperties1Boxed { + if (arg is Map<*, *>) { + return validateAndBox(arg, configuration) + } + throw ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema") + } + } + +} diff --git a/samples/client/3_0_3_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/schemas/RefInAllof.kt b/samples/client/3_0_3_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/schemas/RefInAllof.kt new file mode 100644 index 00000000000..74d68db3075 --- /dev/null +++ b/samples/client/3_0_3_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/schemas/RefInAllof.kt @@ -0,0 +1,310 @@ +package org.openapijsonschematools.client.components.schemas +import java.time.LocalDate +import java.time.ZonedDateTime +import java.util.UUID +import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags +import org.openapijsonschematools.client.configurations.SchemaConfiguration +import org.openapijsonschematools.client.exceptions.InvalidAdditionalPropertyException +import org.openapijsonschematools.client.exceptions.UnsetPropertyException +import org.openapijsonschematools.client.exceptions.ValidationException +import org.openapijsonschematools.client.schemas.UnsetAddPropsSetter +import org.openapijsonschematools.client.schemas.validation.BooleanSchemaValidator +import org.openapijsonschematools.client.schemas.validation.FrozenList +import org.openapijsonschematools.client.schemas.validation.FrozenMap +import org.openapijsonschematools.client.schemas.validation.JsonSchema +import org.openapijsonschematools.client.schemas.validation.JsonSchemaInfo +import org.openapijsonschematools.client.schemas.validation.ListSchemaValidator +import org.openapijsonschematools.client.schemas.validation.MapSchemaValidator +import org.openapijsonschematools.client.schemas.validation.NullSchemaValidator +import org.openapijsonschematools.client.schemas.validation.NumberSchemaValidator +import org.openapijsonschematools.client.schemas.validation.PathToSchemasMap +import org.openapijsonschematools.client.schemas.validation.StringSchemaValidator +import org.openapijsonschematools.client.schemas.validation.ValidationMetadata + +class RefInAllof { + // nest classes so all schemas and input/output classes can be public + + + sealed interface RefInAllof1Boxed { + fun getData(): Any? + } + + data class RefInAllof1BoxedVoid(val data: Nothing?) : RefInAllof1Boxed { + override fun getData(): Any? { + return data + } + } + + data class RefInAllof1BoxedBoolean(val data: Boolean): RefInAllof1Boxed { + override fun getData(): Any? { + return data + } + } + + data class RefInAllof1BoxedNumber(val data: Number) : RefInAllof1Boxed { + override fun getData(): Any? { + return data + } + } + + data class RefInAllof1BoxedString(val data: String) : RefInAllof1Boxed { + override fun getData(): Any? { + return data + } + } + + data class RefInAllof1BoxedList(val data: FrozenList) : RefInAllof1Boxed { + override fun getData(): Any? { + return data + } + } + + data class RefInAllof1BoxedMap(val data: FrozenMap) : RefInAllof1Boxed { + override fun getData(): Any? { + return data + } + } + + + class RefInAllof1 private constructor(): JsonSchema( + JsonSchemaInfo() + .allOf(listOf( + PropertyNamedRefThatIsNotAReference.PropertyNamedRefThatIsNotAReference1::class.java + )) + ), NullSchemaValidator, BooleanSchemaValidator, NumberSchemaValidator, StringSchemaValidator, ListSchemaValidator, RefInAllof1BoxedList>, MapSchemaValidator, RefInAllof1BoxedMap> { + /* + NOTE: This class is auto generated by OpenAPI JSON Schema Generator. + Ref: https://github.com/openapi-json-schema-tools/openapi-json-schema-generator + + Do not edit the class manually. + */ + + companion object { + @Volatile + private var instance: RefInAllof1? = null + + fun getInstance() = + instance ?: synchronized(this) { + instance ?: RefInAllof1().also { instance = it } + } + } + + @Throws(ValidationException::class) + override fun validate(arg: Nothing?, configuration: SchemaConfiguration?): Nothing? { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validatedPathToSchemas = PathToSchemasMap() + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, LinkedHashSet()) + getPathToSchemas(this, castArg, validationMetadata, pathSet) + return castArg + } + + @Throws(ValidationException::class) + override fun validate(arg: Boolean, configuration: SchemaConfiguration?): Boolean { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validatedPathToSchemas = PathToSchemasMap() + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, LinkedHashSet()) + getPathToSchemas(this, castArg, validationMetadata, pathSet) + return castArg + } + + @Throws(ValidationException::class) + override fun validate(arg: Number, configuration: SchemaConfiguration?): Number { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validatedPathToSchemas = PathToSchemasMap() + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, LinkedHashSet()) + getPathToSchemas(this, castArg, validationMetadata, pathSet) + return castArg + } + + @Throws(ValidationException::class) + fun validate(arg: Int, configuration: SchemaConfiguration?): Int { + return validate(arg as Number, configuration) as Int + } + + @Throws(ValidationException::class) + fun validate(arg: Long, configuration: SchemaConfiguration?): Long { + return validate(arg as Number, configuration) as Long + } + + @Throws(ValidationException::class) + fun validate(arg: Float, configuration: SchemaConfiguration?): Float { + return validate(arg as Number, configuration) as Float + } + + @Throws(ValidationException::class) + fun validate(arg: Double, configuration: SchemaConfiguration?): Double { + return validate(arg as Number, configuration) as Double + } + + @Throws(ValidationException::class) + override fun validate(arg: String, configuration: SchemaConfiguration?): String { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validatedPathToSchemas = PathToSchemasMap() + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, LinkedHashSet()) + getPathToSchemas(this, castArg, validationMetadata, pathSet) + return castArg + } + + @Throws(ValidationException::class) + fun validate(arg: LocalDate, configuration: SchemaConfiguration?): String { + return validate(arg.toString(), configuration) + } + + @Throws(ValidationException::class) + fun validate(arg: ZonedDateTime, configuration: SchemaConfiguration?): String { + return validate(arg.toString(), configuration) + } + + @Throws(ValidationException::class) + fun validate(arg: UUID, configuration: SchemaConfiguration?): String { + return validate(arg.toString(), configuration) + } + + override fun getNewInstance(arg: List<*>, pathToItem: List, pathToSchemas: PathToSchemasMap): FrozenList { + val items: MutableList = ArrayList() + var i: Int = 0 + for (item: Any? in arg) { + val itemPathToItem = pathToItem + i + val schemas: LinkedHashMap, Nothing?>? = pathToSchemas.get(itemPathToItem) + if (schemas == null) { + throw RuntimeException("Validation result is invalid, schemas must exist for a pathToItem") + } + val itemSchema: JsonSchema<*> = schemas.entries.iterator().next().key + val itemInstance: Any? = itemSchema.getNewInstance(item, itemPathToItem, pathToSchemas) + items.add(itemInstance) + i += 1 + } + val newInstanceItems: FrozenList = FrozenList(items) + return newInstanceItems + } + + @Throws(ValidationException::class) + override fun validate(arg: List<*>, configuration: SchemaConfiguration?): FrozenList { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, PathToSchemasMap(), LinkedHashSet()) + val pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet) + return getNewInstance(castArg, validationMetadata.pathToItem, pathToSchemasMap) + } + + override fun getNewInstance(arg: Map<*, *>, pathToItem: List, pathToSchemas: PathToSchemasMap): FrozenMap { + val properties: LinkedHashMap = LinkedHashMap() + for((propertyName, value) in arg) { + if (!(propertyName is String)) { + throw RuntimeException("Invalid non-string key value") + } + val propertyPathToItem: List = pathToItem + propertyName + val schemas: LinkedHashMap, Nothing?>? = pathToSchemas.get(propertyPathToItem) + if (schemas == null) { + throw RuntimeException("Validation result is invalid, schemas must exist for a pathToItem") + } + val propertySchema: JsonSchema<*> = schemas.entries.iterator().next().key + val propertyInstance: Any? = propertySchema.getNewInstance(value, propertyPathToItem, pathToSchemas) + properties[propertyName] = propertyInstance + } + val castProperties: FrozenMap = FrozenMap(properties) + return castProperties + } + + @Throws(ValidationException::class) + override fun validate(arg: Map<*, *>, configuration: SchemaConfiguration?): FrozenMap { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validatedPathToSchemas = PathToSchemasMap() + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, LinkedHashSet()) + val pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet) + return getNewInstance(castArg, validationMetadata.pathToItem, pathToSchemasMap) + } + + @Throws(ValidationException::class) + override fun validate(arg: Any?, configuration: SchemaConfiguration?): Any? { + if (arg == null) { + return validate(null, configuration) + } else if (arg is Boolean) { + return validate(arg, configuration) + } else if (arg is Number) { + return validate(arg, configuration) + } else if (arg is String) { + return validate(arg, configuration) + } else if (arg is List<*>) { + return validate(arg, configuration) + } else if (arg is Map<*, *>) { + return validate(arg, configuration) + } + throw ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema") + } + override fun getNewInstance(arg: Any?, pathToItem: List, pathToSchemas: PathToSchemasMap): Any? { + if (arg == null) { + return getNewInstance( null, pathToItem, pathToSchemas) + } else if (arg is Boolean) { + return getNewInstance(arg, pathToItem, pathToSchemas) + } else if (arg is Number) { + return getNewInstance(arg, pathToItem, pathToSchemas) + } else if (arg is String) { + return getNewInstance(arg, pathToItem, pathToSchemas) + } else if (arg is List<*>) { + return getNewInstance(arg, pathToItem, pathToSchemas) + } else if (arg is Map<*, *>) { + return getNewInstance(arg, pathToItem, pathToSchemas) + } + throw RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema") + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: Nothing?, configuration: SchemaConfiguration?): RefInAllof1BoxedVoid { + return RefInAllof1BoxedVoid(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: Boolean, configuration: SchemaConfiguration?): RefInAllof1BoxedBoolean { + return RefInAllof1BoxedBoolean(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: Number, configuration: SchemaConfiguration?): RefInAllof1BoxedNumber { + return RefInAllof1BoxedNumber(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: String, configuration: SchemaConfiguration?): RefInAllof1BoxedString { + return RefInAllof1BoxedString(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: List<*>, configuration: SchemaConfiguration?): RefInAllof1BoxedList { + return RefInAllof1BoxedList(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: Map<*, *>, configuration: SchemaConfiguration?): RefInAllof1BoxedMap { + return RefInAllof1BoxedMap(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: Any?, configuration: SchemaConfiguration?): RefInAllof1Boxed { + if (arg == null) { + return validateAndBox(null, configuration) + } else if (arg is Boolean) { + return validateAndBox(arg, configuration) + } else if (arg is String) { + return validateAndBox(arg, configuration) + } else if (arg is Number) { + return validateAndBox(arg, configuration) + } else if (arg is List<*>) { + return validateAndBox(arg, configuration) + } else if (arg is Map<*, *>) { + return validateAndBox(arg, configuration) + } + throw ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema") + } + } +} diff --git a/samples/client/3_0_3_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/schemas/RefInAnyof.kt b/samples/client/3_0_3_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/schemas/RefInAnyof.kt new file mode 100644 index 00000000000..bdd6d0a4e7b --- /dev/null +++ b/samples/client/3_0_3_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/schemas/RefInAnyof.kt @@ -0,0 +1,310 @@ +package org.openapijsonschematools.client.components.schemas +import java.time.LocalDate +import java.time.ZonedDateTime +import java.util.UUID +import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags +import org.openapijsonschematools.client.configurations.SchemaConfiguration +import org.openapijsonschematools.client.exceptions.InvalidAdditionalPropertyException +import org.openapijsonschematools.client.exceptions.UnsetPropertyException +import org.openapijsonschematools.client.exceptions.ValidationException +import org.openapijsonschematools.client.schemas.UnsetAddPropsSetter +import org.openapijsonschematools.client.schemas.validation.BooleanSchemaValidator +import org.openapijsonschematools.client.schemas.validation.FrozenList +import org.openapijsonschematools.client.schemas.validation.FrozenMap +import org.openapijsonschematools.client.schemas.validation.JsonSchema +import org.openapijsonschematools.client.schemas.validation.JsonSchemaInfo +import org.openapijsonschematools.client.schemas.validation.ListSchemaValidator +import org.openapijsonschematools.client.schemas.validation.MapSchemaValidator +import org.openapijsonschematools.client.schemas.validation.NullSchemaValidator +import org.openapijsonschematools.client.schemas.validation.NumberSchemaValidator +import org.openapijsonschematools.client.schemas.validation.PathToSchemasMap +import org.openapijsonschematools.client.schemas.validation.StringSchemaValidator +import org.openapijsonschematools.client.schemas.validation.ValidationMetadata + +class RefInAnyof { + // nest classes so all schemas and input/output classes can be public + + + sealed interface RefInAnyof1Boxed { + fun getData(): Any? + } + + data class RefInAnyof1BoxedVoid(val data: Nothing?) : RefInAnyof1Boxed { + override fun getData(): Any? { + return data + } + } + + data class RefInAnyof1BoxedBoolean(val data: Boolean): RefInAnyof1Boxed { + override fun getData(): Any? { + return data + } + } + + data class RefInAnyof1BoxedNumber(val data: Number) : RefInAnyof1Boxed { + override fun getData(): Any? { + return data + } + } + + data class RefInAnyof1BoxedString(val data: String) : RefInAnyof1Boxed { + override fun getData(): Any? { + return data + } + } + + data class RefInAnyof1BoxedList(val data: FrozenList) : RefInAnyof1Boxed { + override fun getData(): Any? { + return data + } + } + + data class RefInAnyof1BoxedMap(val data: FrozenMap) : RefInAnyof1Boxed { + override fun getData(): Any? { + return data + } + } + + + class RefInAnyof1 private constructor(): JsonSchema( + JsonSchemaInfo() + .anyOf(listOf( + PropertyNamedRefThatIsNotAReference.PropertyNamedRefThatIsNotAReference1::class.java + )) + ), NullSchemaValidator, BooleanSchemaValidator, NumberSchemaValidator, StringSchemaValidator, ListSchemaValidator, RefInAnyof1BoxedList>, MapSchemaValidator, RefInAnyof1BoxedMap> { + /* + NOTE: This class is auto generated by OpenAPI JSON Schema Generator. + Ref: https://github.com/openapi-json-schema-tools/openapi-json-schema-generator + + Do not edit the class manually. + */ + + companion object { + @Volatile + private var instance: RefInAnyof1? = null + + fun getInstance() = + instance ?: synchronized(this) { + instance ?: RefInAnyof1().also { instance = it } + } + } + + @Throws(ValidationException::class) + override fun validate(arg: Nothing?, configuration: SchemaConfiguration?): Nothing? { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validatedPathToSchemas = PathToSchemasMap() + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, LinkedHashSet()) + getPathToSchemas(this, castArg, validationMetadata, pathSet) + return castArg + } + + @Throws(ValidationException::class) + override fun validate(arg: Boolean, configuration: SchemaConfiguration?): Boolean { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validatedPathToSchemas = PathToSchemasMap() + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, LinkedHashSet()) + getPathToSchemas(this, castArg, validationMetadata, pathSet) + return castArg + } + + @Throws(ValidationException::class) + override fun validate(arg: Number, configuration: SchemaConfiguration?): Number { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validatedPathToSchemas = PathToSchemasMap() + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, LinkedHashSet()) + getPathToSchemas(this, castArg, validationMetadata, pathSet) + return castArg + } + + @Throws(ValidationException::class) + fun validate(arg: Int, configuration: SchemaConfiguration?): Int { + return validate(arg as Number, configuration) as Int + } + + @Throws(ValidationException::class) + fun validate(arg: Long, configuration: SchemaConfiguration?): Long { + return validate(arg as Number, configuration) as Long + } + + @Throws(ValidationException::class) + fun validate(arg: Float, configuration: SchemaConfiguration?): Float { + return validate(arg as Number, configuration) as Float + } + + @Throws(ValidationException::class) + fun validate(arg: Double, configuration: SchemaConfiguration?): Double { + return validate(arg as Number, configuration) as Double + } + + @Throws(ValidationException::class) + override fun validate(arg: String, configuration: SchemaConfiguration?): String { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validatedPathToSchemas = PathToSchemasMap() + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, LinkedHashSet()) + getPathToSchemas(this, castArg, validationMetadata, pathSet) + return castArg + } + + @Throws(ValidationException::class) + fun validate(arg: LocalDate, configuration: SchemaConfiguration?): String { + return validate(arg.toString(), configuration) + } + + @Throws(ValidationException::class) + fun validate(arg: ZonedDateTime, configuration: SchemaConfiguration?): String { + return validate(arg.toString(), configuration) + } + + @Throws(ValidationException::class) + fun validate(arg: UUID, configuration: SchemaConfiguration?): String { + return validate(arg.toString(), configuration) + } + + override fun getNewInstance(arg: List<*>, pathToItem: List, pathToSchemas: PathToSchemasMap): FrozenList { + val items: MutableList = ArrayList() + var i: Int = 0 + for (item: Any? in arg) { + val itemPathToItem = pathToItem + i + val schemas: LinkedHashMap, Nothing?>? = pathToSchemas.get(itemPathToItem) + if (schemas == null) { + throw RuntimeException("Validation result is invalid, schemas must exist for a pathToItem") + } + val itemSchema: JsonSchema<*> = schemas.entries.iterator().next().key + val itemInstance: Any? = itemSchema.getNewInstance(item, itemPathToItem, pathToSchemas) + items.add(itemInstance) + i += 1 + } + val newInstanceItems: FrozenList = FrozenList(items) + return newInstanceItems + } + + @Throws(ValidationException::class) + override fun validate(arg: List<*>, configuration: SchemaConfiguration?): FrozenList { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, PathToSchemasMap(), LinkedHashSet()) + val pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet) + return getNewInstance(castArg, validationMetadata.pathToItem, pathToSchemasMap) + } + + override fun getNewInstance(arg: Map<*, *>, pathToItem: List, pathToSchemas: PathToSchemasMap): FrozenMap { + val properties: LinkedHashMap = LinkedHashMap() + for((propertyName, value) in arg) { + if (!(propertyName is String)) { + throw RuntimeException("Invalid non-string key value") + } + val propertyPathToItem: List = pathToItem + propertyName + val schemas: LinkedHashMap, Nothing?>? = pathToSchemas.get(propertyPathToItem) + if (schemas == null) { + throw RuntimeException("Validation result is invalid, schemas must exist for a pathToItem") + } + val propertySchema: JsonSchema<*> = schemas.entries.iterator().next().key + val propertyInstance: Any? = propertySchema.getNewInstance(value, propertyPathToItem, pathToSchemas) + properties[propertyName] = propertyInstance + } + val castProperties: FrozenMap = FrozenMap(properties) + return castProperties + } + + @Throws(ValidationException::class) + override fun validate(arg: Map<*, *>, configuration: SchemaConfiguration?): FrozenMap { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validatedPathToSchemas = PathToSchemasMap() + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, LinkedHashSet()) + val pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet) + return getNewInstance(castArg, validationMetadata.pathToItem, pathToSchemasMap) + } + + @Throws(ValidationException::class) + override fun validate(arg: Any?, configuration: SchemaConfiguration?): Any? { + if (arg == null) { + return validate(null, configuration) + } else if (arg is Boolean) { + return validate(arg, configuration) + } else if (arg is Number) { + return validate(arg, configuration) + } else if (arg is String) { + return validate(arg, configuration) + } else if (arg is List<*>) { + return validate(arg, configuration) + } else if (arg is Map<*, *>) { + return validate(arg, configuration) + } + throw ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema") + } + override fun getNewInstance(arg: Any?, pathToItem: List, pathToSchemas: PathToSchemasMap): Any? { + if (arg == null) { + return getNewInstance( null, pathToItem, pathToSchemas) + } else if (arg is Boolean) { + return getNewInstance(arg, pathToItem, pathToSchemas) + } else if (arg is Number) { + return getNewInstance(arg, pathToItem, pathToSchemas) + } else if (arg is String) { + return getNewInstance(arg, pathToItem, pathToSchemas) + } else if (arg is List<*>) { + return getNewInstance(arg, pathToItem, pathToSchemas) + } else if (arg is Map<*, *>) { + return getNewInstance(arg, pathToItem, pathToSchemas) + } + throw RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema") + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: Nothing?, configuration: SchemaConfiguration?): RefInAnyof1BoxedVoid { + return RefInAnyof1BoxedVoid(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: Boolean, configuration: SchemaConfiguration?): RefInAnyof1BoxedBoolean { + return RefInAnyof1BoxedBoolean(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: Number, configuration: SchemaConfiguration?): RefInAnyof1BoxedNumber { + return RefInAnyof1BoxedNumber(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: String, configuration: SchemaConfiguration?): RefInAnyof1BoxedString { + return RefInAnyof1BoxedString(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: List<*>, configuration: SchemaConfiguration?): RefInAnyof1BoxedList { + return RefInAnyof1BoxedList(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: Map<*, *>, configuration: SchemaConfiguration?): RefInAnyof1BoxedMap { + return RefInAnyof1BoxedMap(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: Any?, configuration: SchemaConfiguration?): RefInAnyof1Boxed { + if (arg == null) { + return validateAndBox(null, configuration) + } else if (arg is Boolean) { + return validateAndBox(arg, configuration) + } else if (arg is String) { + return validateAndBox(arg, configuration) + } else if (arg is Number) { + return validateAndBox(arg, configuration) + } else if (arg is List<*>) { + return validateAndBox(arg, configuration) + } else if (arg is Map<*, *>) { + return validateAndBox(arg, configuration) + } + throw ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema") + } + } +} diff --git a/samples/client/3_0_3_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/schemas/RefInItems.kt b/samples/client/3_0_3_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/schemas/RefInItems.kt new file mode 100644 index 00000000000..bfcdf273f6a --- /dev/null +++ b/samples/client/3_0_3_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/schemas/RefInItems.kt @@ -0,0 +1,176 @@ +package org.openapijsonschematools.client.components.schemas +import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags +import org.openapijsonschematools.client.configurations.SchemaConfiguration +import org.openapijsonschematools.client.exceptions.ValidationException +import org.openapijsonschematools.client.schemas.validation.FrozenList +import org.openapijsonschematools.client.schemas.validation.JsonSchema +import org.openapijsonschematools.client.schemas.validation.JsonSchemaInfo +import org.openapijsonschematools.client.schemas.validation.ListSchemaValidator +import org.openapijsonschematools.client.schemas.validation.PathToSchemasMap +import org.openapijsonschematools.client.schemas.validation.ValidationMetadata + +class RefInItems { + // nest classes so all schemas and input/output classes can be public + + + class RefInItemsList(m: FrozenList) : FrozenList(m) { + companion object { + @Throws(ValidationException::class) + fun of(arg: List, configuration: SchemaConfiguration?): RefInItemsList { + return RefInItems1.getInstance().validate(arg, configuration) + } + } + } + + class RefInItemsListBuilder { + // class to build List + private val list: MutableList + + init { + this.list = ArrayList() + } + + + fun add(item: Nothing?): RefInItemsListBuilder { + list.add(null) + return this + } + + fun add(item: Boolean): RefInItemsListBuilder { + list.add(item) + return this + } + + fun add(item: String): RefInItemsListBuilder { + list.add(item) + return this + } + + fun add(item: Int): RefInItemsListBuilder { + list.add(item) + return this + } + + fun add(item: Float): RefInItemsListBuilder { + list.add(item) + return this + } + + fun add(item: Long): RefInItemsListBuilder { + list.add(item) + return this + } + + fun add(item: Double): RefInItemsListBuilder { + list.add(item) + return this + } + + fun add(item: List<*>): RefInItemsListBuilder { + list.add(item) + return this + } + + fun add(item: Map): RefInItemsListBuilder { + list.add(item) + return this + } + + fun build(): List { + return list + } + } + + + sealed interface RefInItems1Boxed { + fun getData(): Any? + } + + data class RefInItems1BoxedList(val data: RefInItemsList) : RefInItems1Boxed { + override fun getData(): Any? { + return data + } + } + + + + class RefInItems1 private constructor(): JsonSchema( + JsonSchemaInfo() + .type(setOf(List::class.java)) + .items(PropertyNamedRefThatIsNotAReference.PropertyNamedRefThatIsNotAReference1::class.java) + ), ListSchemaValidator { + /* + NOTE: This class is auto generated by OpenAPI JSON Schema Generator. + Ref: https://github.com/openapi-json-schema-tools/openapi-json-schema-generator + + Do not edit the class manually. + */ + + companion object { + @Volatile + private var instance: RefInItems1? = null + + fun getInstance() = + instance ?: synchronized(this) { + instance ?: RefInItems1().also { instance = it } + } + } + + override fun getNewInstance(arg: List<*>, pathToItem: List, pathToSchemas: PathToSchemasMap): RefInItemsList { + val items: MutableList = ArrayList() + var i: Int = 0 + for (item: Any? in arg) { + val itemPathToItem: List = pathToItem + i + val schemas: LinkedHashMap, Nothing?>? = pathToSchemas.get(itemPathToItem) + if (schemas == null) { + throw RuntimeException("Validation result is invalid, schemas must exist for a pathToItem") + } + val itemSchema: JsonSchema<*> = schemas.entries.iterator().next().key + val itemInstance: Any? = itemSchema.getNewInstance(item, itemPathToItem, pathToSchemas) + if (!(itemInstance is Any)) { + throw RuntimeException("Invalid instantiated value") + } + items.add(itemInstance) + i += 1 + } + val newInstanceItems: FrozenList = FrozenList(items) + return RefInItemsList(newInstanceItems) + } + + @Throws(ValidationException::class) + override fun validate(arg: List<*>, configuration: SchemaConfiguration?): RefInItemsList { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, PathToSchemasMap(), LinkedHashSet()) + val pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet) + return getNewInstance(castArg, validationMetadata.pathToItem, pathToSchemasMap) + } + + @Throws(ValidationException::class) + override fun validate(arg: Any?, configuration: SchemaConfiguration?): Any? { + if (arg is List<*>) { + return validate(arg, configuration) + } + throw ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema") + } + override fun getNewInstance(arg: Any?, pathToItem: List, pathToSchemas: PathToSchemasMap): Any? { + if (arg is List<*>) { + return getNewInstance(arg, pathToItem, pathToSchemas) + } + throw RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema") + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: List<*>, configuration: SchemaConfiguration?): RefInItems1BoxedList { + return RefInItems1BoxedList(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: Any?, configuration: SchemaConfiguration?): RefInItems1Boxed { + if (arg is List<*>) { + return validateAndBox(arg, configuration) + } + throw ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema") + } + } +} diff --git a/samples/client/3_0_3_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/schemas/RefInNot.kt b/samples/client/3_0_3_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/schemas/RefInNot.kt new file mode 100644 index 00000000000..29756f7c1e4 --- /dev/null +++ b/samples/client/3_0_3_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/schemas/RefInNot.kt @@ -0,0 +1,308 @@ +package org.openapijsonschematools.client.components.schemas +import java.time.LocalDate +import java.time.ZonedDateTime +import java.util.UUID +import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags +import org.openapijsonschematools.client.configurations.SchemaConfiguration +import org.openapijsonschematools.client.exceptions.InvalidAdditionalPropertyException +import org.openapijsonschematools.client.exceptions.UnsetPropertyException +import org.openapijsonschematools.client.exceptions.ValidationException +import org.openapijsonschematools.client.schemas.UnsetAddPropsSetter +import org.openapijsonschematools.client.schemas.validation.BooleanSchemaValidator +import org.openapijsonschematools.client.schemas.validation.FrozenList +import org.openapijsonschematools.client.schemas.validation.FrozenMap +import org.openapijsonschematools.client.schemas.validation.JsonSchema +import org.openapijsonschematools.client.schemas.validation.JsonSchemaInfo +import org.openapijsonschematools.client.schemas.validation.ListSchemaValidator +import org.openapijsonschematools.client.schemas.validation.MapSchemaValidator +import org.openapijsonschematools.client.schemas.validation.NullSchemaValidator +import org.openapijsonschematools.client.schemas.validation.NumberSchemaValidator +import org.openapijsonschematools.client.schemas.validation.PathToSchemasMap +import org.openapijsonschematools.client.schemas.validation.StringSchemaValidator +import org.openapijsonschematools.client.schemas.validation.ValidationMetadata + +class RefInNot { + // nest classes so all schemas and input/output classes can be public + + + sealed interface RefInNot1Boxed { + fun getData(): Any? + } + + data class RefInNot1BoxedVoid(val data: Nothing?) : RefInNot1Boxed { + override fun getData(): Any? { + return data + } + } + + data class RefInNot1BoxedBoolean(val data: Boolean): RefInNot1Boxed { + override fun getData(): Any? { + return data + } + } + + data class RefInNot1BoxedNumber(val data: Number) : RefInNot1Boxed { + override fun getData(): Any? { + return data + } + } + + data class RefInNot1BoxedString(val data: String) : RefInNot1Boxed { + override fun getData(): Any? { + return data + } + } + + data class RefInNot1BoxedList(val data: FrozenList) : RefInNot1Boxed { + override fun getData(): Any? { + return data + } + } + + data class RefInNot1BoxedMap(val data: FrozenMap) : RefInNot1Boxed { + override fun getData(): Any? { + return data + } + } + + + class RefInNot1 private constructor(): JsonSchema( + JsonSchemaInfo() + .not(PropertyNamedRefThatIsNotAReference.PropertyNamedRefThatIsNotAReference1::class.java) + ), NullSchemaValidator, BooleanSchemaValidator, NumberSchemaValidator, StringSchemaValidator, ListSchemaValidator, RefInNot1BoxedList>, MapSchemaValidator, RefInNot1BoxedMap> { + /* + NOTE: This class is auto generated by OpenAPI JSON Schema Generator. + Ref: https://github.com/openapi-json-schema-tools/openapi-json-schema-generator + + Do not edit the class manually. + */ + + companion object { + @Volatile + private var instance: RefInNot1? = null + + fun getInstance() = + instance ?: synchronized(this) { + instance ?: RefInNot1().also { instance = it } + } + } + + @Throws(ValidationException::class) + override fun validate(arg: Nothing?, configuration: SchemaConfiguration?): Nothing? { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validatedPathToSchemas = PathToSchemasMap() + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, LinkedHashSet()) + getPathToSchemas(this, castArg, validationMetadata, pathSet) + return castArg + } + + @Throws(ValidationException::class) + override fun validate(arg: Boolean, configuration: SchemaConfiguration?): Boolean { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validatedPathToSchemas = PathToSchemasMap() + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, LinkedHashSet()) + getPathToSchemas(this, castArg, validationMetadata, pathSet) + return castArg + } + + @Throws(ValidationException::class) + override fun validate(arg: Number, configuration: SchemaConfiguration?): Number { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validatedPathToSchemas = PathToSchemasMap() + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, LinkedHashSet()) + getPathToSchemas(this, castArg, validationMetadata, pathSet) + return castArg + } + + @Throws(ValidationException::class) + fun validate(arg: Int, configuration: SchemaConfiguration?): Int { + return validate(arg as Number, configuration) as Int + } + + @Throws(ValidationException::class) + fun validate(arg: Long, configuration: SchemaConfiguration?): Long { + return validate(arg as Number, configuration) as Long + } + + @Throws(ValidationException::class) + fun validate(arg: Float, configuration: SchemaConfiguration?): Float { + return validate(arg as Number, configuration) as Float + } + + @Throws(ValidationException::class) + fun validate(arg: Double, configuration: SchemaConfiguration?): Double { + return validate(arg as Number, configuration) as Double + } + + @Throws(ValidationException::class) + override fun validate(arg: String, configuration: SchemaConfiguration?): String { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validatedPathToSchemas = PathToSchemasMap() + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, LinkedHashSet()) + getPathToSchemas(this, castArg, validationMetadata, pathSet) + return castArg + } + + @Throws(ValidationException::class) + fun validate(arg: LocalDate, configuration: SchemaConfiguration?): String { + return validate(arg.toString(), configuration) + } + + @Throws(ValidationException::class) + fun validate(arg: ZonedDateTime, configuration: SchemaConfiguration?): String { + return validate(arg.toString(), configuration) + } + + @Throws(ValidationException::class) + fun validate(arg: UUID, configuration: SchemaConfiguration?): String { + return validate(arg.toString(), configuration) + } + + override fun getNewInstance(arg: List<*>, pathToItem: List, pathToSchemas: PathToSchemasMap): FrozenList { + val items: MutableList = ArrayList() + var i: Int = 0 + for (item: Any? in arg) { + val itemPathToItem = pathToItem + i + val schemas: LinkedHashMap, Nothing?>? = pathToSchemas.get(itemPathToItem) + if (schemas == null) { + throw RuntimeException("Validation result is invalid, schemas must exist for a pathToItem") + } + val itemSchema: JsonSchema<*> = schemas.entries.iterator().next().key + val itemInstance: Any? = itemSchema.getNewInstance(item, itemPathToItem, pathToSchemas) + items.add(itemInstance) + i += 1 + } + val newInstanceItems: FrozenList = FrozenList(items) + return newInstanceItems + } + + @Throws(ValidationException::class) + override fun validate(arg: List<*>, configuration: SchemaConfiguration?): FrozenList { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, PathToSchemasMap(), LinkedHashSet()) + val pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet) + return getNewInstance(castArg, validationMetadata.pathToItem, pathToSchemasMap) + } + + override fun getNewInstance(arg: Map<*, *>, pathToItem: List, pathToSchemas: PathToSchemasMap): FrozenMap { + val properties: LinkedHashMap = LinkedHashMap() + for((propertyName, value) in arg) { + if (!(propertyName is String)) { + throw RuntimeException("Invalid non-string key value") + } + val propertyPathToItem: List = pathToItem + propertyName + val schemas: LinkedHashMap, Nothing?>? = pathToSchemas.get(propertyPathToItem) + if (schemas == null) { + throw RuntimeException("Validation result is invalid, schemas must exist for a pathToItem") + } + val propertySchema: JsonSchema<*> = schemas.entries.iterator().next().key + val propertyInstance: Any? = propertySchema.getNewInstance(value, propertyPathToItem, pathToSchemas) + properties[propertyName] = propertyInstance + } + val castProperties: FrozenMap = FrozenMap(properties) + return castProperties + } + + @Throws(ValidationException::class) + override fun validate(arg: Map<*, *>, configuration: SchemaConfiguration?): FrozenMap { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validatedPathToSchemas = PathToSchemasMap() + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, LinkedHashSet()) + val pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet) + return getNewInstance(castArg, validationMetadata.pathToItem, pathToSchemasMap) + } + + @Throws(ValidationException::class) + override fun validate(arg: Any?, configuration: SchemaConfiguration?): Any? { + if (arg == null) { + return validate(null, configuration) + } else if (arg is Boolean) { + return validate(arg, configuration) + } else if (arg is Number) { + return validate(arg, configuration) + } else if (arg is String) { + return validate(arg, configuration) + } else if (arg is List<*>) { + return validate(arg, configuration) + } else if (arg is Map<*, *>) { + return validate(arg, configuration) + } + throw ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema") + } + override fun getNewInstance(arg: Any?, pathToItem: List, pathToSchemas: PathToSchemasMap): Any? { + if (arg == null) { + return getNewInstance( null, pathToItem, pathToSchemas) + } else if (arg is Boolean) { + return getNewInstance(arg, pathToItem, pathToSchemas) + } else if (arg is Number) { + return getNewInstance(arg, pathToItem, pathToSchemas) + } else if (arg is String) { + return getNewInstance(arg, pathToItem, pathToSchemas) + } else if (arg is List<*>) { + return getNewInstance(arg, pathToItem, pathToSchemas) + } else if (arg is Map<*, *>) { + return getNewInstance(arg, pathToItem, pathToSchemas) + } + throw RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema") + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: Nothing?, configuration: SchemaConfiguration?): RefInNot1BoxedVoid { + return RefInNot1BoxedVoid(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: Boolean, configuration: SchemaConfiguration?): RefInNot1BoxedBoolean { + return RefInNot1BoxedBoolean(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: Number, configuration: SchemaConfiguration?): RefInNot1BoxedNumber { + return RefInNot1BoxedNumber(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: String, configuration: SchemaConfiguration?): RefInNot1BoxedString { + return RefInNot1BoxedString(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: List<*>, configuration: SchemaConfiguration?): RefInNot1BoxedList { + return RefInNot1BoxedList(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: Map<*, *>, configuration: SchemaConfiguration?): RefInNot1BoxedMap { + return RefInNot1BoxedMap(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: Any?, configuration: SchemaConfiguration?): RefInNot1Boxed { + if (arg == null) { + return validateAndBox(null, configuration) + } else if (arg is Boolean) { + return validateAndBox(arg, configuration) + } else if (arg is String) { + return validateAndBox(arg, configuration) + } else if (arg is Number) { + return validateAndBox(arg, configuration) + } else if (arg is List<*>) { + return validateAndBox(arg, configuration) + } else if (arg is Map<*, *>) { + return validateAndBox(arg, configuration) + } + throw ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema") + } + } +} diff --git a/samples/client/3_0_3_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/schemas/RefInOneof.kt b/samples/client/3_0_3_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/schemas/RefInOneof.kt new file mode 100644 index 00000000000..cdb1ab0443f --- /dev/null +++ b/samples/client/3_0_3_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/schemas/RefInOneof.kt @@ -0,0 +1,310 @@ +package org.openapijsonschematools.client.components.schemas +import java.time.LocalDate +import java.time.ZonedDateTime +import java.util.UUID +import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags +import org.openapijsonschematools.client.configurations.SchemaConfiguration +import org.openapijsonschematools.client.exceptions.InvalidAdditionalPropertyException +import org.openapijsonschematools.client.exceptions.UnsetPropertyException +import org.openapijsonschematools.client.exceptions.ValidationException +import org.openapijsonschematools.client.schemas.UnsetAddPropsSetter +import org.openapijsonschematools.client.schemas.validation.BooleanSchemaValidator +import org.openapijsonschematools.client.schemas.validation.FrozenList +import org.openapijsonschematools.client.schemas.validation.FrozenMap +import org.openapijsonschematools.client.schemas.validation.JsonSchema +import org.openapijsonschematools.client.schemas.validation.JsonSchemaInfo +import org.openapijsonschematools.client.schemas.validation.ListSchemaValidator +import org.openapijsonschematools.client.schemas.validation.MapSchemaValidator +import org.openapijsonschematools.client.schemas.validation.NullSchemaValidator +import org.openapijsonschematools.client.schemas.validation.NumberSchemaValidator +import org.openapijsonschematools.client.schemas.validation.PathToSchemasMap +import org.openapijsonschematools.client.schemas.validation.StringSchemaValidator +import org.openapijsonschematools.client.schemas.validation.ValidationMetadata + +class RefInOneof { + // nest classes so all schemas and input/output classes can be public + + + sealed interface RefInOneof1Boxed { + fun getData(): Any? + } + + data class RefInOneof1BoxedVoid(val data: Nothing?) : RefInOneof1Boxed { + override fun getData(): Any? { + return data + } + } + + data class RefInOneof1BoxedBoolean(val data: Boolean): RefInOneof1Boxed { + override fun getData(): Any? { + return data + } + } + + data class RefInOneof1BoxedNumber(val data: Number) : RefInOneof1Boxed { + override fun getData(): Any? { + return data + } + } + + data class RefInOneof1BoxedString(val data: String) : RefInOneof1Boxed { + override fun getData(): Any? { + return data + } + } + + data class RefInOneof1BoxedList(val data: FrozenList) : RefInOneof1Boxed { + override fun getData(): Any? { + return data + } + } + + data class RefInOneof1BoxedMap(val data: FrozenMap) : RefInOneof1Boxed { + override fun getData(): Any? { + return data + } + } + + + class RefInOneof1 private constructor(): JsonSchema( + JsonSchemaInfo() + .oneOf(listOf( + PropertyNamedRefThatIsNotAReference.PropertyNamedRefThatIsNotAReference1::class.java + )) + ), NullSchemaValidator, BooleanSchemaValidator, NumberSchemaValidator, StringSchemaValidator, ListSchemaValidator, RefInOneof1BoxedList>, MapSchemaValidator, RefInOneof1BoxedMap> { + /* + NOTE: This class is auto generated by OpenAPI JSON Schema Generator. + Ref: https://github.com/openapi-json-schema-tools/openapi-json-schema-generator + + Do not edit the class manually. + */ + + companion object { + @Volatile + private var instance: RefInOneof1? = null + + fun getInstance() = + instance ?: synchronized(this) { + instance ?: RefInOneof1().also { instance = it } + } + } + + @Throws(ValidationException::class) + override fun validate(arg: Nothing?, configuration: SchemaConfiguration?): Nothing? { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validatedPathToSchemas = PathToSchemasMap() + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, LinkedHashSet()) + getPathToSchemas(this, castArg, validationMetadata, pathSet) + return castArg + } + + @Throws(ValidationException::class) + override fun validate(arg: Boolean, configuration: SchemaConfiguration?): Boolean { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validatedPathToSchemas = PathToSchemasMap() + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, LinkedHashSet()) + getPathToSchemas(this, castArg, validationMetadata, pathSet) + return castArg + } + + @Throws(ValidationException::class) + override fun validate(arg: Number, configuration: SchemaConfiguration?): Number { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validatedPathToSchemas = PathToSchemasMap() + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, LinkedHashSet()) + getPathToSchemas(this, castArg, validationMetadata, pathSet) + return castArg + } + + @Throws(ValidationException::class) + fun validate(arg: Int, configuration: SchemaConfiguration?): Int { + return validate(arg as Number, configuration) as Int + } + + @Throws(ValidationException::class) + fun validate(arg: Long, configuration: SchemaConfiguration?): Long { + return validate(arg as Number, configuration) as Long + } + + @Throws(ValidationException::class) + fun validate(arg: Float, configuration: SchemaConfiguration?): Float { + return validate(arg as Number, configuration) as Float + } + + @Throws(ValidationException::class) + fun validate(arg: Double, configuration: SchemaConfiguration?): Double { + return validate(arg as Number, configuration) as Double + } + + @Throws(ValidationException::class) + override fun validate(arg: String, configuration: SchemaConfiguration?): String { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validatedPathToSchemas = PathToSchemasMap() + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, LinkedHashSet()) + getPathToSchemas(this, castArg, validationMetadata, pathSet) + return castArg + } + + @Throws(ValidationException::class) + fun validate(arg: LocalDate, configuration: SchemaConfiguration?): String { + return validate(arg.toString(), configuration) + } + + @Throws(ValidationException::class) + fun validate(arg: ZonedDateTime, configuration: SchemaConfiguration?): String { + return validate(arg.toString(), configuration) + } + + @Throws(ValidationException::class) + fun validate(arg: UUID, configuration: SchemaConfiguration?): String { + return validate(arg.toString(), configuration) + } + + override fun getNewInstance(arg: List<*>, pathToItem: List, pathToSchemas: PathToSchemasMap): FrozenList { + val items: MutableList = ArrayList() + var i: Int = 0 + for (item: Any? in arg) { + val itemPathToItem = pathToItem + i + val schemas: LinkedHashMap, Nothing?>? = pathToSchemas.get(itemPathToItem) + if (schemas == null) { + throw RuntimeException("Validation result is invalid, schemas must exist for a pathToItem") + } + val itemSchema: JsonSchema<*> = schemas.entries.iterator().next().key + val itemInstance: Any? = itemSchema.getNewInstance(item, itemPathToItem, pathToSchemas) + items.add(itemInstance) + i += 1 + } + val newInstanceItems: FrozenList = FrozenList(items) + return newInstanceItems + } + + @Throws(ValidationException::class) + override fun validate(arg: List<*>, configuration: SchemaConfiguration?): FrozenList { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, PathToSchemasMap(), LinkedHashSet()) + val pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet) + return getNewInstance(castArg, validationMetadata.pathToItem, pathToSchemasMap) + } + + override fun getNewInstance(arg: Map<*, *>, pathToItem: List, pathToSchemas: PathToSchemasMap): FrozenMap { + val properties: LinkedHashMap = LinkedHashMap() + for((propertyName, value) in arg) { + if (!(propertyName is String)) { + throw RuntimeException("Invalid non-string key value") + } + val propertyPathToItem: List = pathToItem + propertyName + val schemas: LinkedHashMap, Nothing?>? = pathToSchemas.get(propertyPathToItem) + if (schemas == null) { + throw RuntimeException("Validation result is invalid, schemas must exist for a pathToItem") + } + val propertySchema: JsonSchema<*> = schemas.entries.iterator().next().key + val propertyInstance: Any? = propertySchema.getNewInstance(value, propertyPathToItem, pathToSchemas) + properties[propertyName] = propertyInstance + } + val castProperties: FrozenMap = FrozenMap(properties) + return castProperties + } + + @Throws(ValidationException::class) + override fun validate(arg: Map<*, *>, configuration: SchemaConfiguration?): FrozenMap { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validatedPathToSchemas = PathToSchemasMap() + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, LinkedHashSet()) + val pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet) + return getNewInstance(castArg, validationMetadata.pathToItem, pathToSchemasMap) + } + + @Throws(ValidationException::class) + override fun validate(arg: Any?, configuration: SchemaConfiguration?): Any? { + if (arg == null) { + return validate(null, configuration) + } else if (arg is Boolean) { + return validate(arg, configuration) + } else if (arg is Number) { + return validate(arg, configuration) + } else if (arg is String) { + return validate(arg, configuration) + } else if (arg is List<*>) { + return validate(arg, configuration) + } else if (arg is Map<*, *>) { + return validate(arg, configuration) + } + throw ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema") + } + override fun getNewInstance(arg: Any?, pathToItem: List, pathToSchemas: PathToSchemasMap): Any? { + if (arg == null) { + return getNewInstance( null, pathToItem, pathToSchemas) + } else if (arg is Boolean) { + return getNewInstance(arg, pathToItem, pathToSchemas) + } else if (arg is Number) { + return getNewInstance(arg, pathToItem, pathToSchemas) + } else if (arg is String) { + return getNewInstance(arg, pathToItem, pathToSchemas) + } else if (arg is List<*>) { + return getNewInstance(arg, pathToItem, pathToSchemas) + } else if (arg is Map<*, *>) { + return getNewInstance(arg, pathToItem, pathToSchemas) + } + throw RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema") + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: Nothing?, configuration: SchemaConfiguration?): RefInOneof1BoxedVoid { + return RefInOneof1BoxedVoid(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: Boolean, configuration: SchemaConfiguration?): RefInOneof1BoxedBoolean { + return RefInOneof1BoxedBoolean(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: Number, configuration: SchemaConfiguration?): RefInOneof1BoxedNumber { + return RefInOneof1BoxedNumber(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: String, configuration: SchemaConfiguration?): RefInOneof1BoxedString { + return RefInOneof1BoxedString(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: List<*>, configuration: SchemaConfiguration?): RefInOneof1BoxedList { + return RefInOneof1BoxedList(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: Map<*, *>, configuration: SchemaConfiguration?): RefInOneof1BoxedMap { + return RefInOneof1BoxedMap(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: Any?, configuration: SchemaConfiguration?): RefInOneof1Boxed { + if (arg == null) { + return validateAndBox(null, configuration) + } else if (arg is Boolean) { + return validateAndBox(arg, configuration) + } else if (arg is String) { + return validateAndBox(arg, configuration) + } else if (arg is Number) { + return validateAndBox(arg, configuration) + } else if (arg is List<*>) { + return validateAndBox(arg, configuration) + } else if (arg is Map<*, *>) { + return validateAndBox(arg, configuration) + } + throw ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema") + } + } +} diff --git a/samples/client/3_0_3_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/schemas/RefInProperty.kt b/samples/client/3_0_3_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/schemas/RefInProperty.kt new file mode 100644 index 00000000000..e0988c5f58f --- /dev/null +++ b/samples/client/3_0_3_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/schemas/RefInProperty.kt @@ -0,0 +1,427 @@ +package org.openapijsonschematools.client.components.schemas +import java.time.LocalDate +import java.time.ZonedDateTime +import java.util.UUID +import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags +import org.openapijsonschematools.client.configurations.SchemaConfiguration +import org.openapijsonschematools.client.exceptions.InvalidAdditionalPropertyException +import org.openapijsonschematools.client.exceptions.UnsetPropertyException +import org.openapijsonschematools.client.exceptions.ValidationException +import org.openapijsonschematools.client.schemas.GenericBuilder +import org.openapijsonschematools.client.schemas.UnsetAddPropsSetter +import org.openapijsonschematools.client.schemas.validation.BooleanSchemaValidator +import org.openapijsonschematools.client.schemas.validation.FrozenList +import org.openapijsonschematools.client.schemas.validation.FrozenMap +import org.openapijsonschematools.client.schemas.validation.JsonSchema +import org.openapijsonschematools.client.schemas.validation.JsonSchemaInfo +import org.openapijsonschematools.client.schemas.validation.ListSchemaValidator +import org.openapijsonschematools.client.schemas.validation.MapSchemaValidator +import org.openapijsonschematools.client.schemas.validation.NullSchemaValidator +import org.openapijsonschematools.client.schemas.validation.NumberSchemaValidator +import org.openapijsonschematools.client.schemas.validation.PathToSchemasMap +import org.openapijsonschematools.client.schemas.validation.StringSchemaValidator +import org.openapijsonschematools.client.schemas.validation.ValidationMetadata + +class RefInProperty { + // nest classes so all schemas and input/output classes can be public + + + class RefInPropertyMap(m: FrozenMap) : FrozenMap(m) { + companion object { + val requiredKeys: Set = setOf() + val optionalKeys: Set = setOf( + "a" + ) + @Throws(ValidationException::class) + fun of(arg: Map, configuration: SchemaConfiguration): RefInPropertyMap { + return RefInProperty1.getInstance().validate(arg, configuration) + } + } + + @Throws(UnsetPropertyException::class) + fun a(): Any? { + val key = "a" + throwIfKeyNotPresent(key) + val value: Any? = get(key) + if (!(value is Any)) { + throw RuntimeException("Invalid value stored for a") + } + return value + } + + @Throws(UnsetPropertyException::class, InvalidAdditionalPropertyException::class) + fun getAdditionalProperty(name: String): Any? { + throwIfKeyKnown(name, requiredKeys, optionalKeys) + throwIfKeyNotPresent(name) + return get(name) + } + } + + interface SetterForA { + fun getInstance(): MutableMap + fun getBuilderAfterA(instance: MutableMap): T + + fun a(value: Nothing?): T { + val instance = getInstance() + instance["a"] = null + return getBuilderAfterA(instance) + } + + fun a(value: Boolean): T { + val instance = getInstance() + instance["a"] = value + return getBuilderAfterA(instance) + } + + fun a(value: String): T { + val instance = getInstance() + instance["a"] = value + return getBuilderAfterA(instance) + } + + fun a(value: Int): T { + val instance = getInstance() + instance["a"] = value + return getBuilderAfterA(instance) + } + + fun a(value: Float): T { + val instance = getInstance() + instance["a"] = value + return getBuilderAfterA(instance) + } + + fun a(value: Long): T { + val instance = getInstance() + instance["a"] = value + return getBuilderAfterA(instance) + } + + fun a(value: Double): T { + val instance = getInstance() + instance["a"] = value + return getBuilderAfterA(instance) + } + + fun a(value: List): T { + val instance = getInstance() + instance["a"] = value + return getBuilderAfterA(instance) + } + + fun a(value: Map): T { + val instance = getInstance() + instance["a"] = value + return getBuilderAfterA(instance) + } + } + + class RefInPropertyMapBuilder: UnsetAddPropsSetter, GenericBuilder>, SetterForA { + private val knownKeys: Set = setOf( + "a" + ) + override fun getKnownKeys(): Set { + return knownKeys + } + private val instance: MutableMap + init { + this.instance = LinkedHashMap() + } + override fun build(): Map { + return instance + } + override fun getInstance(): MutableMap { + return instance + } + override fun getBuilderAfterA(instance: MutableMap): RefInPropertyMapBuilder { + return this + } + override fun getBuilderAfterAdditionalProperty(instance: MutableMap): RefInPropertyMapBuilder { + return this + } + } + + + sealed interface RefInProperty1Boxed { + fun getData(): Any? + } + + data class RefInProperty1BoxedVoid(val data: Nothing?) : RefInProperty1Boxed { + override fun getData(): Any? { + return data + } + } + + data class RefInProperty1BoxedBoolean(val data: Boolean): RefInProperty1Boxed { + override fun getData(): Any? { + return data + } + } + + data class RefInProperty1BoxedNumber(val data: Number) : RefInProperty1Boxed { + override fun getData(): Any? { + return data + } + } + + data class RefInProperty1BoxedString(val data: String) : RefInProperty1Boxed { + override fun getData(): Any? { + return data + } + } + + data class RefInProperty1BoxedList(val data: FrozenList) : RefInProperty1Boxed { + override fun getData(): Any? { + return data + } + } + + data class RefInProperty1BoxedMap(val data: RefInPropertyMap) : RefInProperty1Boxed { + override fun getData(): Any? { + return data + } + } + + + class RefInProperty1 private constructor(): JsonSchema( + JsonSchemaInfo() + .properties(mapOf( + "a" to PropertyNamedRefThatIsNotAReference.PropertyNamedRefThatIsNotAReference1::class.java + )) + ), NullSchemaValidator, BooleanSchemaValidator, NumberSchemaValidator, StringSchemaValidator, ListSchemaValidator, RefInProperty1BoxedList>, MapSchemaValidator { + /* + NOTE: This class is auto generated by OpenAPI JSON Schema Generator. + Ref: https://github.com/openapi-json-schema-tools/openapi-json-schema-generator + + Do not edit the class manually. + */ + + companion object { + @Volatile + private var instance: RefInProperty1? = null + + fun getInstance() = + instance ?: synchronized(this) { + instance ?: RefInProperty1().also { instance = it } + } + } + + @Throws(ValidationException::class) + override fun validate(arg: Nothing?, configuration: SchemaConfiguration?): Nothing? { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validatedPathToSchemas = PathToSchemasMap() + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, LinkedHashSet()) + getPathToSchemas(this, castArg, validationMetadata, pathSet) + return castArg + } + + @Throws(ValidationException::class) + override fun validate(arg: Boolean, configuration: SchemaConfiguration?): Boolean { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validatedPathToSchemas = PathToSchemasMap() + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, LinkedHashSet()) + getPathToSchemas(this, castArg, validationMetadata, pathSet) + return castArg + } + + @Throws(ValidationException::class) + override fun validate(arg: Number, configuration: SchemaConfiguration?): Number { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validatedPathToSchemas = PathToSchemasMap() + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, LinkedHashSet()) + getPathToSchemas(this, castArg, validationMetadata, pathSet) + return castArg + } + + @Throws(ValidationException::class) + fun validate(arg: Int, configuration: SchemaConfiguration?): Int { + return validate(arg as Number, configuration) as Int + } + + @Throws(ValidationException::class) + fun validate(arg: Long, configuration: SchemaConfiguration?): Long { + return validate(arg as Number, configuration) as Long + } + + @Throws(ValidationException::class) + fun validate(arg: Float, configuration: SchemaConfiguration?): Float { + return validate(arg as Number, configuration) as Float + } + + @Throws(ValidationException::class) + fun validate(arg: Double, configuration: SchemaConfiguration?): Double { + return validate(arg as Number, configuration) as Double + } + + @Throws(ValidationException::class) + override fun validate(arg: String, configuration: SchemaConfiguration?): String { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validatedPathToSchemas = PathToSchemasMap() + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, LinkedHashSet()) + getPathToSchemas(this, castArg, validationMetadata, pathSet) + return castArg + } + + @Throws(ValidationException::class) + fun validate(arg: LocalDate, configuration: SchemaConfiguration?): String { + return validate(arg.toString(), configuration) + } + + @Throws(ValidationException::class) + fun validate(arg: ZonedDateTime, configuration: SchemaConfiguration?): String { + return validate(arg.toString(), configuration) + } + + @Throws(ValidationException::class) + fun validate(arg: UUID, configuration: SchemaConfiguration?): String { + return validate(arg.toString(), configuration) + } + + override fun getNewInstance(arg: List<*>, pathToItem: List, pathToSchemas: PathToSchemasMap): FrozenList { + val items: MutableList = ArrayList() + var i: Int = 0 + for (item: Any? in arg) { + val itemPathToItem = pathToItem + i + val schemas: LinkedHashMap, Nothing?>? = pathToSchemas.get(itemPathToItem) + if (schemas == null) { + throw RuntimeException("Validation result is invalid, schemas must exist for a pathToItem") + } + val itemSchema: JsonSchema<*> = schemas.entries.iterator().next().key + val itemInstance: Any? = itemSchema.getNewInstance(item, itemPathToItem, pathToSchemas) + items.add(itemInstance) + i += 1 + } + val newInstanceItems: FrozenList = FrozenList(items) + return newInstanceItems + } + + @Throws(ValidationException::class) + override fun validate(arg: List<*>, configuration: SchemaConfiguration?): FrozenList { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, PathToSchemasMap(), LinkedHashSet()) + val pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet) + return getNewInstance(castArg, validationMetadata.pathToItem, pathToSchemasMap) + } + + override fun getNewInstance(arg: Map<*, *>, pathToItem: List, pathToSchemas: PathToSchemasMap): RefInPropertyMap { + val properties: LinkedHashMap = LinkedHashMap() + for((propertyName, value) in arg) { + if (!(propertyName is String)) { + throw RuntimeException("Invalid non-string key value") + } + val propertyPathToItem: List = pathToItem + propertyName + val schemas: LinkedHashMap, Nothing?>? = pathToSchemas.get(propertyPathToItem) + if (schemas == null) { + throw RuntimeException("Validation result is invalid, schemas must exist for a pathToItem") + } + val propertySchema: JsonSchema<*> = schemas.entries.iterator().next().key + val propertyInstance: Any? = propertySchema.getNewInstance(value, propertyPathToItem, pathToSchemas) + properties[propertyName] = propertyInstance + } + val castProperties: FrozenMap = FrozenMap(properties) + return RefInPropertyMap(castProperties) + } + + @Throws(ValidationException::class) + override fun validate(arg: Map<*, *>, configuration: SchemaConfiguration?): RefInPropertyMap { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validatedPathToSchemas = PathToSchemasMap() + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, LinkedHashSet()) + val pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet) + return getNewInstance(castArg, validationMetadata.pathToItem, pathToSchemasMap) + } + + @Throws(ValidationException::class) + override fun validate(arg: Any?, configuration: SchemaConfiguration?): Any? { + if (arg == null) { + return validate(null, configuration) + } else if (arg is Boolean) { + return validate(arg, configuration) + } else if (arg is Number) { + return validate(arg, configuration) + } else if (arg is String) { + return validate(arg, configuration) + } else if (arg is List<*>) { + return validate(arg, configuration) + } else if (arg is Map<*, *>) { + return validate(arg, configuration) + } + throw ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema") + } + override fun getNewInstance(arg: Any?, pathToItem: List, pathToSchemas: PathToSchemasMap): Any? { + if (arg == null) { + return getNewInstance( null, pathToItem, pathToSchemas) + } else if (arg is Boolean) { + return getNewInstance(arg, pathToItem, pathToSchemas) + } else if (arg is Number) { + return getNewInstance(arg, pathToItem, pathToSchemas) + } else if (arg is String) { + return getNewInstance(arg, pathToItem, pathToSchemas) + } else if (arg is List<*>) { + return getNewInstance(arg, pathToItem, pathToSchemas) + } else if (arg is Map<*, *>) { + return getNewInstance(arg, pathToItem, pathToSchemas) + } + throw RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema") + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: Nothing?, configuration: SchemaConfiguration?): RefInProperty1BoxedVoid { + return RefInProperty1BoxedVoid(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: Boolean, configuration: SchemaConfiguration?): RefInProperty1BoxedBoolean { + return RefInProperty1BoxedBoolean(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: Number, configuration: SchemaConfiguration?): RefInProperty1BoxedNumber { + return RefInProperty1BoxedNumber(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: String, configuration: SchemaConfiguration?): RefInProperty1BoxedString { + return RefInProperty1BoxedString(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: List<*>, configuration: SchemaConfiguration?): RefInProperty1BoxedList { + return RefInProperty1BoxedList(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: Map<*, *>, configuration: SchemaConfiguration?): RefInProperty1BoxedMap { + return RefInProperty1BoxedMap(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: Any?, configuration: SchemaConfiguration?): RefInProperty1Boxed { + if (arg == null) { + return validateAndBox(null, configuration) + } else if (arg is Boolean) { + return validateAndBox(arg, configuration) + } else if (arg is String) { + return validateAndBox(arg, configuration) + } else if (arg is Number) { + return validateAndBox(arg, configuration) + } else if (arg is List<*>) { + return validateAndBox(arg, configuration) + } else if (arg is Map<*, *>) { + return validateAndBox(arg, configuration) + } + throw ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema") + } + } +} diff --git a/samples/client/3_0_3_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/schemas/RequiredDefaultValidation.kt b/samples/client/3_0_3_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/schemas/RequiredDefaultValidation.kt new file mode 100644 index 00000000000..5774da81ccc --- /dev/null +++ b/samples/client/3_0_3_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/schemas/RequiredDefaultValidation.kt @@ -0,0 +1,435 @@ +package org.openapijsonschematools.client.components.schemas +import java.time.LocalDate +import java.time.ZonedDateTime +import java.util.UUID +import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags +import org.openapijsonschematools.client.configurations.SchemaConfiguration +import org.openapijsonschematools.client.exceptions.InvalidAdditionalPropertyException +import org.openapijsonschematools.client.exceptions.UnsetPropertyException +import org.openapijsonschematools.client.exceptions.ValidationException +import org.openapijsonschematools.client.schemas.AnyTypeJsonSchema +import org.openapijsonschematools.client.schemas.GenericBuilder +import org.openapijsonschematools.client.schemas.UnsetAddPropsSetter +import org.openapijsonschematools.client.schemas.validation.BooleanSchemaValidator +import org.openapijsonschematools.client.schemas.validation.FrozenList +import org.openapijsonschematools.client.schemas.validation.FrozenMap +import org.openapijsonschematools.client.schemas.validation.JsonSchema +import org.openapijsonschematools.client.schemas.validation.JsonSchemaInfo +import org.openapijsonschematools.client.schemas.validation.ListSchemaValidator +import org.openapijsonschematools.client.schemas.validation.MapSchemaValidator +import org.openapijsonschematools.client.schemas.validation.NullSchemaValidator +import org.openapijsonschematools.client.schemas.validation.NumberSchemaValidator +import org.openapijsonschematools.client.schemas.validation.PathToSchemasMap +import org.openapijsonschematools.client.schemas.validation.StringSchemaValidator +import org.openapijsonschematools.client.schemas.validation.ValidationMetadata + +class RequiredDefaultValidation { + // nest classes so all schemas and input/output classes can be public + + + class Foo : AnyTypeJsonSchema.AnyTypeJsonSchema1() { + companion object { + @Volatile + private var instance: Foo? = null + + fun getInstance() = + instance ?: synchronized(this) { + instance ?: Foo().also { instance = it } + } + } + } + + + class RequiredDefaultValidationMap(m: FrozenMap) : FrozenMap(m) { + companion object { + val requiredKeys: Set = setOf() + val optionalKeys: Set = setOf( + "foo" + ) + @Throws(ValidationException::class) + fun of(arg: Map, configuration: SchemaConfiguration): RequiredDefaultValidationMap { + return RequiredDefaultValidation1.getInstance().validate(arg, configuration) + } + } + + @Throws(UnsetPropertyException::class) + fun foo(): Any? { + return getOrThrow("foo") + } + + @Throws(UnsetPropertyException::class, InvalidAdditionalPropertyException::class) + fun getAdditionalProperty(name: String): Any? { + throwIfKeyKnown(name, requiredKeys, optionalKeys) + throwIfKeyNotPresent(name) + return get(name) + } + } + + interface SetterForFoo { + fun getInstance(): MutableMap + fun getBuilderAfterFoo(instance: MutableMap): T + + fun foo(value: Nothing?): T { + val instance = getInstance() + instance["foo"] = null + return getBuilderAfterFoo(instance) + } + + fun foo(value: Boolean): T { + val instance = getInstance() + instance["foo"] = value + return getBuilderAfterFoo(instance) + } + + fun foo(value: String): T { + val instance = getInstance() + instance["foo"] = value + return getBuilderAfterFoo(instance) + } + + fun foo(value: Int): T { + val instance = getInstance() + instance["foo"] = value + return getBuilderAfterFoo(instance) + } + + fun foo(value: Float): T { + val instance = getInstance() + instance["foo"] = value + return getBuilderAfterFoo(instance) + } + + fun foo(value: Long): T { + val instance = getInstance() + instance["foo"] = value + return getBuilderAfterFoo(instance) + } + + fun foo(value: Double): T { + val instance = getInstance() + instance["foo"] = value + return getBuilderAfterFoo(instance) + } + + fun foo(value: List): T { + val instance = getInstance() + instance["foo"] = value + return getBuilderAfterFoo(instance) + } + + fun foo(value: Map): T { + val instance = getInstance() + instance["foo"] = value + return getBuilderAfterFoo(instance) + } + } + + class RequiredDefaultValidationMapBuilder: UnsetAddPropsSetter, GenericBuilder>, SetterForFoo { + private val knownKeys: Set = setOf( + "foo" + ) + override fun getKnownKeys(): Set { + return knownKeys + } + private val instance: MutableMap + init { + this.instance = LinkedHashMap() + } + override fun build(): Map { + return instance + } + override fun getInstance(): MutableMap { + return instance + } + override fun getBuilderAfterFoo(instance: MutableMap): RequiredDefaultValidationMapBuilder { + return this + } + override fun getBuilderAfterAdditionalProperty(instance: MutableMap): RequiredDefaultValidationMapBuilder { + return this + } + } + + + sealed interface RequiredDefaultValidation1Boxed { + fun getData(): Any? + } + + data class RequiredDefaultValidation1BoxedVoid(val data: Nothing?) : RequiredDefaultValidation1Boxed { + override fun getData(): Any? { + return data + } + } + + data class RequiredDefaultValidation1BoxedBoolean(val data: Boolean): RequiredDefaultValidation1Boxed { + override fun getData(): Any? { + return data + } + } + + data class RequiredDefaultValidation1BoxedNumber(val data: Number) : RequiredDefaultValidation1Boxed { + override fun getData(): Any? { + return data + } + } + + data class RequiredDefaultValidation1BoxedString(val data: String) : RequiredDefaultValidation1Boxed { + override fun getData(): Any? { + return data + } + } + + data class RequiredDefaultValidation1BoxedList(val data: FrozenList) : RequiredDefaultValidation1Boxed { + override fun getData(): Any? { + return data + } + } + + data class RequiredDefaultValidation1BoxedMap(val data: RequiredDefaultValidationMap) : RequiredDefaultValidation1Boxed { + override fun getData(): Any? { + return data + } + } + + + class RequiredDefaultValidation1 private constructor(): JsonSchema( + JsonSchemaInfo() + .properties(mapOf( + "foo" to Foo::class.java + )) + ), NullSchemaValidator, BooleanSchemaValidator, NumberSchemaValidator, StringSchemaValidator, ListSchemaValidator, RequiredDefaultValidation1BoxedList>, MapSchemaValidator { + /* + NOTE: This class is auto generated by OpenAPI JSON Schema Generator. + Ref: https://github.com/openapi-json-schema-tools/openapi-json-schema-generator + + Do not edit the class manually. + */ + + companion object { + @Volatile + private var instance: RequiredDefaultValidation1? = null + + fun getInstance() = + instance ?: synchronized(this) { + instance ?: RequiredDefaultValidation1().also { instance = it } + } + } + + @Throws(ValidationException::class) + override fun validate(arg: Nothing?, configuration: SchemaConfiguration?): Nothing? { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validatedPathToSchemas = PathToSchemasMap() + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, LinkedHashSet()) + getPathToSchemas(this, castArg, validationMetadata, pathSet) + return castArg + } + + @Throws(ValidationException::class) + override fun validate(arg: Boolean, configuration: SchemaConfiguration?): Boolean { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validatedPathToSchemas = PathToSchemasMap() + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, LinkedHashSet()) + getPathToSchemas(this, castArg, validationMetadata, pathSet) + return castArg + } + + @Throws(ValidationException::class) + override fun validate(arg: Number, configuration: SchemaConfiguration?): Number { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validatedPathToSchemas = PathToSchemasMap() + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, LinkedHashSet()) + getPathToSchemas(this, castArg, validationMetadata, pathSet) + return castArg + } + + @Throws(ValidationException::class) + fun validate(arg: Int, configuration: SchemaConfiguration?): Int { + return validate(arg as Number, configuration) as Int + } + + @Throws(ValidationException::class) + fun validate(arg: Long, configuration: SchemaConfiguration?): Long { + return validate(arg as Number, configuration) as Long + } + + @Throws(ValidationException::class) + fun validate(arg: Float, configuration: SchemaConfiguration?): Float { + return validate(arg as Number, configuration) as Float + } + + @Throws(ValidationException::class) + fun validate(arg: Double, configuration: SchemaConfiguration?): Double { + return validate(arg as Number, configuration) as Double + } + + @Throws(ValidationException::class) + override fun validate(arg: String, configuration: SchemaConfiguration?): String { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validatedPathToSchemas = PathToSchemasMap() + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, LinkedHashSet()) + getPathToSchemas(this, castArg, validationMetadata, pathSet) + return castArg + } + + @Throws(ValidationException::class) + fun validate(arg: LocalDate, configuration: SchemaConfiguration?): String { + return validate(arg.toString(), configuration) + } + + @Throws(ValidationException::class) + fun validate(arg: ZonedDateTime, configuration: SchemaConfiguration?): String { + return validate(arg.toString(), configuration) + } + + @Throws(ValidationException::class) + fun validate(arg: UUID, configuration: SchemaConfiguration?): String { + return validate(arg.toString(), configuration) + } + + override fun getNewInstance(arg: List<*>, pathToItem: List, pathToSchemas: PathToSchemasMap): FrozenList { + val items: MutableList = ArrayList() + var i: Int = 0 + for (item: Any? in arg) { + val itemPathToItem = pathToItem + i + val schemas: LinkedHashMap, Nothing?>? = pathToSchemas.get(itemPathToItem) + if (schemas == null) { + throw RuntimeException("Validation result is invalid, schemas must exist for a pathToItem") + } + val itemSchema: JsonSchema<*> = schemas.entries.iterator().next().key + val itemInstance: Any? = itemSchema.getNewInstance(item, itemPathToItem, pathToSchemas) + items.add(itemInstance) + i += 1 + } + val newInstanceItems: FrozenList = FrozenList(items) + return newInstanceItems + } + + @Throws(ValidationException::class) + override fun validate(arg: List<*>, configuration: SchemaConfiguration?): FrozenList { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, PathToSchemasMap(), LinkedHashSet()) + val pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet) + return getNewInstance(castArg, validationMetadata.pathToItem, pathToSchemasMap) + } + + override fun getNewInstance(arg: Map<*, *>, pathToItem: List, pathToSchemas: PathToSchemasMap): RequiredDefaultValidationMap { + val properties: LinkedHashMap = LinkedHashMap() + for((propertyName, value) in arg) { + if (!(propertyName is String)) { + throw RuntimeException("Invalid non-string key value") + } + val propertyPathToItem: List = pathToItem + propertyName + val schemas: LinkedHashMap, Nothing?>? = pathToSchemas.get(propertyPathToItem) + if (schemas == null) { + throw RuntimeException("Validation result is invalid, schemas must exist for a pathToItem") + } + val propertySchema: JsonSchema<*> = schemas.entries.iterator().next().key + val propertyInstance: Any? = propertySchema.getNewInstance(value, propertyPathToItem, pathToSchemas) + properties[propertyName] = propertyInstance + } + val castProperties: FrozenMap = FrozenMap(properties) + return RequiredDefaultValidationMap(castProperties) + } + + @Throws(ValidationException::class) + override fun validate(arg: Map<*, *>, configuration: SchemaConfiguration?): RequiredDefaultValidationMap { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validatedPathToSchemas = PathToSchemasMap() + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, LinkedHashSet()) + val pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet) + return getNewInstance(castArg, validationMetadata.pathToItem, pathToSchemasMap) + } + + @Throws(ValidationException::class) + override fun validate(arg: Any?, configuration: SchemaConfiguration?): Any? { + if (arg == null) { + return validate(null, configuration) + } else if (arg is Boolean) { + return validate(arg, configuration) + } else if (arg is Number) { + return validate(arg, configuration) + } else if (arg is String) { + return validate(arg, configuration) + } else if (arg is List<*>) { + return validate(arg, configuration) + } else if (arg is Map<*, *>) { + return validate(arg, configuration) + } + throw ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema") + } + override fun getNewInstance(arg: Any?, pathToItem: List, pathToSchemas: PathToSchemasMap): Any? { + if (arg == null) { + return getNewInstance( null, pathToItem, pathToSchemas) + } else if (arg is Boolean) { + return getNewInstance(arg, pathToItem, pathToSchemas) + } else if (arg is Number) { + return getNewInstance(arg, pathToItem, pathToSchemas) + } else if (arg is String) { + return getNewInstance(arg, pathToItem, pathToSchemas) + } else if (arg is List<*>) { + return getNewInstance(arg, pathToItem, pathToSchemas) + } else if (arg is Map<*, *>) { + return getNewInstance(arg, pathToItem, pathToSchemas) + } + throw RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema") + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: Nothing?, configuration: SchemaConfiguration?): RequiredDefaultValidation1BoxedVoid { + return RequiredDefaultValidation1BoxedVoid(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: Boolean, configuration: SchemaConfiguration?): RequiredDefaultValidation1BoxedBoolean { + return RequiredDefaultValidation1BoxedBoolean(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: Number, configuration: SchemaConfiguration?): RequiredDefaultValidation1BoxedNumber { + return RequiredDefaultValidation1BoxedNumber(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: String, configuration: SchemaConfiguration?): RequiredDefaultValidation1BoxedString { + return RequiredDefaultValidation1BoxedString(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: List<*>, configuration: SchemaConfiguration?): RequiredDefaultValidation1BoxedList { + return RequiredDefaultValidation1BoxedList(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: Map<*, *>, configuration: SchemaConfiguration?): RequiredDefaultValidation1BoxedMap { + return RequiredDefaultValidation1BoxedMap(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: Any?, configuration: SchemaConfiguration?): RequiredDefaultValidation1Boxed { + if (arg == null) { + return validateAndBox(null, configuration) + } else if (arg is Boolean) { + return validateAndBox(arg, configuration) + } else if (arg is String) { + return validateAndBox(arg, configuration) + } else if (arg is Number) { + return validateAndBox(arg, configuration) + } else if (arg is List<*>) { + return validateAndBox(arg, configuration) + } else if (arg is Map<*, *>) { + return validateAndBox(arg, configuration) + } + throw ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema") + } + } +} diff --git a/samples/client/3_0_3_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/schemas/RequiredValidation.kt b/samples/client/3_0_3_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/schemas/RequiredValidation.kt new file mode 100644 index 00000000000..1ff4bb0d707 --- /dev/null +++ b/samples/client/3_0_3_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/schemas/RequiredValidation.kt @@ -0,0 +1,531 @@ +package org.openapijsonschematools.client.components.schemas +import java.time.LocalDate +import java.time.ZonedDateTime +import java.util.UUID +import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags +import org.openapijsonschematools.client.configurations.SchemaConfiguration +import org.openapijsonschematools.client.exceptions.InvalidAdditionalPropertyException +import org.openapijsonschematools.client.exceptions.UnsetPropertyException +import org.openapijsonschematools.client.exceptions.ValidationException +import org.openapijsonschematools.client.schemas.AnyTypeJsonSchema +import org.openapijsonschematools.client.schemas.GenericBuilder +import org.openapijsonschematools.client.schemas.UnsetAddPropsSetter +import org.openapijsonschematools.client.schemas.validation.BooleanSchemaValidator +import org.openapijsonschematools.client.schemas.validation.FrozenList +import org.openapijsonschematools.client.schemas.validation.FrozenMap +import org.openapijsonschematools.client.schemas.validation.JsonSchema +import org.openapijsonschematools.client.schemas.validation.JsonSchemaInfo +import org.openapijsonschematools.client.schemas.validation.ListSchemaValidator +import org.openapijsonschematools.client.schemas.validation.MapSchemaValidator +import org.openapijsonschematools.client.schemas.validation.NullSchemaValidator +import org.openapijsonschematools.client.schemas.validation.NumberSchemaValidator +import org.openapijsonschematools.client.schemas.validation.PathToSchemasMap +import org.openapijsonschematools.client.schemas.validation.StringSchemaValidator +import org.openapijsonschematools.client.schemas.validation.ValidationMetadata + +class RequiredValidation { + // nest classes so all schemas and input/output classes can be public + + + class Foo : AnyTypeJsonSchema.AnyTypeJsonSchema1() { + companion object { + @Volatile + private var instance: Foo? = null + + fun getInstance() = + instance ?: synchronized(this) { + instance ?: Foo().also { instance = it } + } + } + } + + + class Bar : AnyTypeJsonSchema.AnyTypeJsonSchema1() { + companion object { + @Volatile + private var instance: Bar? = null + + fun getInstance() = + instance ?: synchronized(this) { + instance ?: Bar().also { instance = it } + } + } + } + + + class RequiredValidationMap(m: FrozenMap) : FrozenMap(m) { + companion object { + val requiredKeys: Set = setOf( + "foo" + ) + val optionalKeys: Set = setOf( + "bar" + ) + @Throws(ValidationException::class) + fun of(arg: Map, configuration: SchemaConfiguration): RequiredValidationMap { + return RequiredValidation1.getInstance().validate(arg, configuration) + } + } + + fun foo(): Any? { + try { + return getOrThrow("version") + } catch (e: UnsetPropertyException) { + throw RuntimeException(e) + } + } + + @Throws(UnsetPropertyException::class) + fun bar(): Any? { + return getOrThrow("bar") + } + + @Throws(UnsetPropertyException::class, InvalidAdditionalPropertyException::class) + fun getAdditionalProperty(name: String): Any? { + throwIfKeyKnown(name, requiredKeys, optionalKeys) + throwIfKeyNotPresent(name) + return get(name) + } + } + + interface SetterForFoo { + fun getInstance(): MutableMap + fun getBuilderAfterFoo(instance: MutableMap): T + + fun foo(value: Nothing?): T { + val instance = getInstance() + instance["foo"] = null + return getBuilderAfterFoo(instance) + } + + fun foo(value: Boolean): T { + val instance = getInstance() + instance["foo"] = value + return getBuilderAfterFoo(instance) + } + + fun foo(value: String): T { + val instance = getInstance() + instance["foo"] = value + return getBuilderAfterFoo(instance) + } + + fun foo(value: Int): T { + val instance = getInstance() + instance["foo"] = value + return getBuilderAfterFoo(instance) + } + + fun foo(value: Float): T { + val instance = getInstance() + instance["foo"] = value + return getBuilderAfterFoo(instance) + } + + fun foo(value: Long): T { + val instance = getInstance() + instance["foo"] = value + return getBuilderAfterFoo(instance) + } + + fun foo(value: Double): T { + val instance = getInstance() + instance["foo"] = value + return getBuilderAfterFoo(instance) + } + + fun foo(value: List): T { + val instance = getInstance() + instance["foo"] = value + return getBuilderAfterFoo(instance) + } + + fun foo(value: Map): T { + val instance = getInstance() + instance["foo"] = value + return getBuilderAfterFoo(instance) + } + } + + interface SetterForBar { + fun getInstance(): MutableMap + fun getBuilderAfterBar(instance: MutableMap): T + + fun bar(value: Nothing?): T { + val instance = getInstance() + instance["bar"] = null + return getBuilderAfterBar(instance) + } + + fun bar(value: Boolean): T { + val instance = getInstance() + instance["bar"] = value + return getBuilderAfterBar(instance) + } + + fun bar(value: String): T { + val instance = getInstance() + instance["bar"] = value + return getBuilderAfterBar(instance) + } + + fun bar(value: Int): T { + val instance = getInstance() + instance["bar"] = value + return getBuilderAfterBar(instance) + } + + fun bar(value: Float): T { + val instance = getInstance() + instance["bar"] = value + return getBuilderAfterBar(instance) + } + + fun bar(value: Long): T { + val instance = getInstance() + instance["bar"] = value + return getBuilderAfterBar(instance) + } + + fun bar(value: Double): T { + val instance = getInstance() + instance["bar"] = value + return getBuilderAfterBar(instance) + } + + fun bar(value: List): T { + val instance = getInstance() + instance["bar"] = value + return getBuilderAfterBar(instance) + } + + fun bar(value: Map): T { + val instance = getInstance() + instance["bar"] = value + return getBuilderAfterBar(instance) + } + } + + class RequiredValidationMap0Builder(private val instance: MutableMap): UnsetAddPropsSetter, GenericBuilder>, SetterForBar { + private val knownKeys: Set = setOf( + "foo", + "bar" + ) + override fun getKnownKeys(): Set { + return knownKeys + } + override fun build(): Map { + return instance + } + override fun getInstance(): MutableMap { + return instance + } + override fun getBuilderAfterBar(instance: MutableMap): RequiredValidationMap0Builder { + return this + } + override fun getBuilderAfterAdditionalProperty(instance: MutableMap): RequiredValidationMap0Builder { + return this + } + } + + class RequiredValidationMapBuilder: SetterForFoo { + private val instance: MutableMap + init { + this.instance = LinkedHashMap() + } + override fun getInstance(): MutableMap { + return instance + } + override fun getBuilderAfterFoo(instance: MutableMap): RequiredValidationMap0Builder { + return RequiredValidationMap0Builder(instance) + } + } + + + sealed interface RequiredValidation1Boxed { + fun getData(): Any? + } + + data class RequiredValidation1BoxedVoid(val data: Nothing?) : RequiredValidation1Boxed { + override fun getData(): Any? { + return data + } + } + + data class RequiredValidation1BoxedBoolean(val data: Boolean): RequiredValidation1Boxed { + override fun getData(): Any? { + return data + } + } + + data class RequiredValidation1BoxedNumber(val data: Number) : RequiredValidation1Boxed { + override fun getData(): Any? { + return data + } + } + + data class RequiredValidation1BoxedString(val data: String) : RequiredValidation1Boxed { + override fun getData(): Any? { + return data + } + } + + data class RequiredValidation1BoxedList(val data: FrozenList) : RequiredValidation1Boxed { + override fun getData(): Any? { + return data + } + } + + data class RequiredValidation1BoxedMap(val data: RequiredValidationMap) : RequiredValidation1Boxed { + override fun getData(): Any? { + return data + } + } + + + class RequiredValidation1 private constructor(): JsonSchema( + JsonSchemaInfo() + .properties(mapOf( + "foo" to Foo::class.java, + "bar" to Bar::class.java + )) + .required(setOf( + "foo" + )) + ), NullSchemaValidator, BooleanSchemaValidator, NumberSchemaValidator, StringSchemaValidator, ListSchemaValidator, RequiredValidation1BoxedList>, MapSchemaValidator { + /* + NOTE: This class is auto generated by OpenAPI JSON Schema Generator. + Ref: https://github.com/openapi-json-schema-tools/openapi-json-schema-generator + + Do not edit the class manually. + */ + + companion object { + @Volatile + private var instance: RequiredValidation1? = null + + fun getInstance() = + instance ?: synchronized(this) { + instance ?: RequiredValidation1().also { instance = it } + } + } + + @Throws(ValidationException::class) + override fun validate(arg: Nothing?, configuration: SchemaConfiguration?): Nothing? { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validatedPathToSchemas = PathToSchemasMap() + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, LinkedHashSet()) + getPathToSchemas(this, castArg, validationMetadata, pathSet) + return castArg + } + + @Throws(ValidationException::class) + override fun validate(arg: Boolean, configuration: SchemaConfiguration?): Boolean { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validatedPathToSchemas = PathToSchemasMap() + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, LinkedHashSet()) + getPathToSchemas(this, castArg, validationMetadata, pathSet) + return castArg + } + + @Throws(ValidationException::class) + override fun validate(arg: Number, configuration: SchemaConfiguration?): Number { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validatedPathToSchemas = PathToSchemasMap() + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, LinkedHashSet()) + getPathToSchemas(this, castArg, validationMetadata, pathSet) + return castArg + } + + @Throws(ValidationException::class) + fun validate(arg: Int, configuration: SchemaConfiguration?): Int { + return validate(arg as Number, configuration) as Int + } + + @Throws(ValidationException::class) + fun validate(arg: Long, configuration: SchemaConfiguration?): Long { + return validate(arg as Number, configuration) as Long + } + + @Throws(ValidationException::class) + fun validate(arg: Float, configuration: SchemaConfiguration?): Float { + return validate(arg as Number, configuration) as Float + } + + @Throws(ValidationException::class) + fun validate(arg: Double, configuration: SchemaConfiguration?): Double { + return validate(arg as Number, configuration) as Double + } + + @Throws(ValidationException::class) + override fun validate(arg: String, configuration: SchemaConfiguration?): String { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validatedPathToSchemas = PathToSchemasMap() + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, LinkedHashSet()) + getPathToSchemas(this, castArg, validationMetadata, pathSet) + return castArg + } + + @Throws(ValidationException::class) + fun validate(arg: LocalDate, configuration: SchemaConfiguration?): String { + return validate(arg.toString(), configuration) + } + + @Throws(ValidationException::class) + fun validate(arg: ZonedDateTime, configuration: SchemaConfiguration?): String { + return validate(arg.toString(), configuration) + } + + @Throws(ValidationException::class) + fun validate(arg: UUID, configuration: SchemaConfiguration?): String { + return validate(arg.toString(), configuration) + } + + override fun getNewInstance(arg: List<*>, pathToItem: List, pathToSchemas: PathToSchemasMap): FrozenList { + val items: MutableList = ArrayList() + var i: Int = 0 + for (item: Any? in arg) { + val itemPathToItem = pathToItem + i + val schemas: LinkedHashMap, Nothing?>? = pathToSchemas.get(itemPathToItem) + if (schemas == null) { + throw RuntimeException("Validation result is invalid, schemas must exist for a pathToItem") + } + val itemSchema: JsonSchema<*> = schemas.entries.iterator().next().key + val itemInstance: Any? = itemSchema.getNewInstance(item, itemPathToItem, pathToSchemas) + items.add(itemInstance) + i += 1 + } + val newInstanceItems: FrozenList = FrozenList(items) + return newInstanceItems + } + + @Throws(ValidationException::class) + override fun validate(arg: List<*>, configuration: SchemaConfiguration?): FrozenList { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, PathToSchemasMap(), LinkedHashSet()) + val pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet) + return getNewInstance(castArg, validationMetadata.pathToItem, pathToSchemasMap) + } + + override fun getNewInstance(arg: Map<*, *>, pathToItem: List, pathToSchemas: PathToSchemasMap): RequiredValidationMap { + val properties: LinkedHashMap = LinkedHashMap() + for((propertyName, value) in arg) { + if (!(propertyName is String)) { + throw RuntimeException("Invalid non-string key value") + } + val propertyPathToItem: List = pathToItem + propertyName + val schemas: LinkedHashMap, Nothing?>? = pathToSchemas.get(propertyPathToItem) + if (schemas == null) { + throw RuntimeException("Validation result is invalid, schemas must exist for a pathToItem") + } + val propertySchema: JsonSchema<*> = schemas.entries.iterator().next().key + val propertyInstance: Any? = propertySchema.getNewInstance(value, propertyPathToItem, pathToSchemas) + properties[propertyName] = propertyInstance + } + val castProperties: FrozenMap = FrozenMap(properties) + return RequiredValidationMap(castProperties) + } + + @Throws(ValidationException::class) + override fun validate(arg: Map<*, *>, configuration: SchemaConfiguration?): RequiredValidationMap { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validatedPathToSchemas = PathToSchemasMap() + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, LinkedHashSet()) + val pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet) + return getNewInstance(castArg, validationMetadata.pathToItem, pathToSchemasMap) + } + + @Throws(ValidationException::class) + override fun validate(arg: Any?, configuration: SchemaConfiguration?): Any? { + if (arg == null) { + return validate(null, configuration) + } else if (arg is Boolean) { + return validate(arg, configuration) + } else if (arg is Number) { + return validate(arg, configuration) + } else if (arg is String) { + return validate(arg, configuration) + } else if (arg is List<*>) { + return validate(arg, configuration) + } else if (arg is Map<*, *>) { + return validate(arg, configuration) + } + throw ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema") + } + override fun getNewInstance(arg: Any?, pathToItem: List, pathToSchemas: PathToSchemasMap): Any? { + if (arg == null) { + return getNewInstance( null, pathToItem, pathToSchemas) + } else if (arg is Boolean) { + return getNewInstance(arg, pathToItem, pathToSchemas) + } else if (arg is Number) { + return getNewInstance(arg, pathToItem, pathToSchemas) + } else if (arg is String) { + return getNewInstance(arg, pathToItem, pathToSchemas) + } else if (arg is List<*>) { + return getNewInstance(arg, pathToItem, pathToSchemas) + } else if (arg is Map<*, *>) { + return getNewInstance(arg, pathToItem, pathToSchemas) + } + throw RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema") + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: Nothing?, configuration: SchemaConfiguration?): RequiredValidation1BoxedVoid { + return RequiredValidation1BoxedVoid(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: Boolean, configuration: SchemaConfiguration?): RequiredValidation1BoxedBoolean { + return RequiredValidation1BoxedBoolean(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: Number, configuration: SchemaConfiguration?): RequiredValidation1BoxedNumber { + return RequiredValidation1BoxedNumber(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: String, configuration: SchemaConfiguration?): RequiredValidation1BoxedString { + return RequiredValidation1BoxedString(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: List<*>, configuration: SchemaConfiguration?): RequiredValidation1BoxedList { + return RequiredValidation1BoxedList(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: Map<*, *>, configuration: SchemaConfiguration?): RequiredValidation1BoxedMap { + return RequiredValidation1BoxedMap(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: Any?, configuration: SchemaConfiguration?): RequiredValidation1Boxed { + if (arg == null) { + return validateAndBox(null, configuration) + } else if (arg is Boolean) { + return validateAndBox(arg, configuration) + } else if (arg is String) { + return validateAndBox(arg, configuration) + } else if (arg is Number) { + return validateAndBox(arg, configuration) + } else if (arg is List<*>) { + return validateAndBox(arg, configuration) + } else if (arg is Map<*, *>) { + return validateAndBox(arg, configuration) + } + throw ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema") + } + } +} diff --git a/samples/client/3_0_3_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/schemas/RequiredWithEmptyArray.kt b/samples/client/3_0_3_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/schemas/RequiredWithEmptyArray.kt new file mode 100644 index 00000000000..d8eaca1b1e1 --- /dev/null +++ b/samples/client/3_0_3_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/schemas/RequiredWithEmptyArray.kt @@ -0,0 +1,435 @@ +package org.openapijsonschematools.client.components.schemas +import java.time.LocalDate +import java.time.ZonedDateTime +import java.util.UUID +import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags +import org.openapijsonschematools.client.configurations.SchemaConfiguration +import org.openapijsonschematools.client.exceptions.InvalidAdditionalPropertyException +import org.openapijsonschematools.client.exceptions.UnsetPropertyException +import org.openapijsonschematools.client.exceptions.ValidationException +import org.openapijsonschematools.client.schemas.AnyTypeJsonSchema +import org.openapijsonschematools.client.schemas.GenericBuilder +import org.openapijsonschematools.client.schemas.UnsetAddPropsSetter +import org.openapijsonschematools.client.schemas.validation.BooleanSchemaValidator +import org.openapijsonschematools.client.schemas.validation.FrozenList +import org.openapijsonschematools.client.schemas.validation.FrozenMap +import org.openapijsonschematools.client.schemas.validation.JsonSchema +import org.openapijsonschematools.client.schemas.validation.JsonSchemaInfo +import org.openapijsonschematools.client.schemas.validation.ListSchemaValidator +import org.openapijsonschematools.client.schemas.validation.MapSchemaValidator +import org.openapijsonschematools.client.schemas.validation.NullSchemaValidator +import org.openapijsonschematools.client.schemas.validation.NumberSchemaValidator +import org.openapijsonschematools.client.schemas.validation.PathToSchemasMap +import org.openapijsonschematools.client.schemas.validation.StringSchemaValidator +import org.openapijsonschematools.client.schemas.validation.ValidationMetadata + +class RequiredWithEmptyArray { + // nest classes so all schemas and input/output classes can be public + + + class Foo : AnyTypeJsonSchema.AnyTypeJsonSchema1() { + companion object { + @Volatile + private var instance: Foo? = null + + fun getInstance() = + instance ?: synchronized(this) { + instance ?: Foo().also { instance = it } + } + } + } + + + class RequiredWithEmptyArrayMap(m: FrozenMap) : FrozenMap(m) { + companion object { + val requiredKeys: Set = setOf() + val optionalKeys: Set = setOf( + "foo" + ) + @Throws(ValidationException::class) + fun of(arg: Map, configuration: SchemaConfiguration): RequiredWithEmptyArrayMap { + return RequiredWithEmptyArray1.getInstance().validate(arg, configuration) + } + } + + @Throws(UnsetPropertyException::class) + fun foo(): Any? { + return getOrThrow("foo") + } + + @Throws(UnsetPropertyException::class, InvalidAdditionalPropertyException::class) + fun getAdditionalProperty(name: String): Any? { + throwIfKeyKnown(name, requiredKeys, optionalKeys) + throwIfKeyNotPresent(name) + return get(name) + } + } + + interface SetterForFoo { + fun getInstance(): MutableMap + fun getBuilderAfterFoo(instance: MutableMap): T + + fun foo(value: Nothing?): T { + val instance = getInstance() + instance["foo"] = null + return getBuilderAfterFoo(instance) + } + + fun foo(value: Boolean): T { + val instance = getInstance() + instance["foo"] = value + return getBuilderAfterFoo(instance) + } + + fun foo(value: String): T { + val instance = getInstance() + instance["foo"] = value + return getBuilderAfterFoo(instance) + } + + fun foo(value: Int): T { + val instance = getInstance() + instance["foo"] = value + return getBuilderAfterFoo(instance) + } + + fun foo(value: Float): T { + val instance = getInstance() + instance["foo"] = value + return getBuilderAfterFoo(instance) + } + + fun foo(value: Long): T { + val instance = getInstance() + instance["foo"] = value + return getBuilderAfterFoo(instance) + } + + fun foo(value: Double): T { + val instance = getInstance() + instance["foo"] = value + return getBuilderAfterFoo(instance) + } + + fun foo(value: List): T { + val instance = getInstance() + instance["foo"] = value + return getBuilderAfterFoo(instance) + } + + fun foo(value: Map): T { + val instance = getInstance() + instance["foo"] = value + return getBuilderAfterFoo(instance) + } + } + + class RequiredWithEmptyArrayMapBuilder: UnsetAddPropsSetter, GenericBuilder>, SetterForFoo { + private val knownKeys: Set = setOf( + "foo" + ) + override fun getKnownKeys(): Set { + return knownKeys + } + private val instance: MutableMap + init { + this.instance = LinkedHashMap() + } + override fun build(): Map { + return instance + } + override fun getInstance(): MutableMap { + return instance + } + override fun getBuilderAfterFoo(instance: MutableMap): RequiredWithEmptyArrayMapBuilder { + return this + } + override fun getBuilderAfterAdditionalProperty(instance: MutableMap): RequiredWithEmptyArrayMapBuilder { + return this + } + } + + + sealed interface RequiredWithEmptyArray1Boxed { + fun getData(): Any? + } + + data class RequiredWithEmptyArray1BoxedVoid(val data: Nothing?) : RequiredWithEmptyArray1Boxed { + override fun getData(): Any? { + return data + } + } + + data class RequiredWithEmptyArray1BoxedBoolean(val data: Boolean): RequiredWithEmptyArray1Boxed { + override fun getData(): Any? { + return data + } + } + + data class RequiredWithEmptyArray1BoxedNumber(val data: Number) : RequiredWithEmptyArray1Boxed { + override fun getData(): Any? { + return data + } + } + + data class RequiredWithEmptyArray1BoxedString(val data: String) : RequiredWithEmptyArray1Boxed { + override fun getData(): Any? { + return data + } + } + + data class RequiredWithEmptyArray1BoxedList(val data: FrozenList) : RequiredWithEmptyArray1Boxed { + override fun getData(): Any? { + return data + } + } + + data class RequiredWithEmptyArray1BoxedMap(val data: RequiredWithEmptyArrayMap) : RequiredWithEmptyArray1Boxed { + override fun getData(): Any? { + return data + } + } + + + class RequiredWithEmptyArray1 private constructor(): JsonSchema( + JsonSchemaInfo() + .properties(mapOf( + "foo" to Foo::class.java + )) + ), NullSchemaValidator, BooleanSchemaValidator, NumberSchemaValidator, StringSchemaValidator, ListSchemaValidator, RequiredWithEmptyArray1BoxedList>, MapSchemaValidator { + /* + NOTE: This class is auto generated by OpenAPI JSON Schema Generator. + Ref: https://github.com/openapi-json-schema-tools/openapi-json-schema-generator + + Do not edit the class manually. + */ + + companion object { + @Volatile + private var instance: RequiredWithEmptyArray1? = null + + fun getInstance() = + instance ?: synchronized(this) { + instance ?: RequiredWithEmptyArray1().also { instance = it } + } + } + + @Throws(ValidationException::class) + override fun validate(arg: Nothing?, configuration: SchemaConfiguration?): Nothing? { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validatedPathToSchemas = PathToSchemasMap() + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, LinkedHashSet()) + getPathToSchemas(this, castArg, validationMetadata, pathSet) + return castArg + } + + @Throws(ValidationException::class) + override fun validate(arg: Boolean, configuration: SchemaConfiguration?): Boolean { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validatedPathToSchemas = PathToSchemasMap() + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, LinkedHashSet()) + getPathToSchemas(this, castArg, validationMetadata, pathSet) + return castArg + } + + @Throws(ValidationException::class) + override fun validate(arg: Number, configuration: SchemaConfiguration?): Number { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validatedPathToSchemas = PathToSchemasMap() + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, LinkedHashSet()) + getPathToSchemas(this, castArg, validationMetadata, pathSet) + return castArg + } + + @Throws(ValidationException::class) + fun validate(arg: Int, configuration: SchemaConfiguration?): Int { + return validate(arg as Number, configuration) as Int + } + + @Throws(ValidationException::class) + fun validate(arg: Long, configuration: SchemaConfiguration?): Long { + return validate(arg as Number, configuration) as Long + } + + @Throws(ValidationException::class) + fun validate(arg: Float, configuration: SchemaConfiguration?): Float { + return validate(arg as Number, configuration) as Float + } + + @Throws(ValidationException::class) + fun validate(arg: Double, configuration: SchemaConfiguration?): Double { + return validate(arg as Number, configuration) as Double + } + + @Throws(ValidationException::class) + override fun validate(arg: String, configuration: SchemaConfiguration?): String { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validatedPathToSchemas = PathToSchemasMap() + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, LinkedHashSet()) + getPathToSchemas(this, castArg, validationMetadata, pathSet) + return castArg + } + + @Throws(ValidationException::class) + fun validate(arg: LocalDate, configuration: SchemaConfiguration?): String { + return validate(arg.toString(), configuration) + } + + @Throws(ValidationException::class) + fun validate(arg: ZonedDateTime, configuration: SchemaConfiguration?): String { + return validate(arg.toString(), configuration) + } + + @Throws(ValidationException::class) + fun validate(arg: UUID, configuration: SchemaConfiguration?): String { + return validate(arg.toString(), configuration) + } + + override fun getNewInstance(arg: List<*>, pathToItem: List, pathToSchemas: PathToSchemasMap): FrozenList { + val items: MutableList = ArrayList() + var i: Int = 0 + for (item: Any? in arg) { + val itemPathToItem = pathToItem + i + val schemas: LinkedHashMap, Nothing?>? = pathToSchemas.get(itemPathToItem) + if (schemas == null) { + throw RuntimeException("Validation result is invalid, schemas must exist for a pathToItem") + } + val itemSchema: JsonSchema<*> = schemas.entries.iterator().next().key + val itemInstance: Any? = itemSchema.getNewInstance(item, itemPathToItem, pathToSchemas) + items.add(itemInstance) + i += 1 + } + val newInstanceItems: FrozenList = FrozenList(items) + return newInstanceItems + } + + @Throws(ValidationException::class) + override fun validate(arg: List<*>, configuration: SchemaConfiguration?): FrozenList { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, PathToSchemasMap(), LinkedHashSet()) + val pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet) + return getNewInstance(castArg, validationMetadata.pathToItem, pathToSchemasMap) + } + + override fun getNewInstance(arg: Map<*, *>, pathToItem: List, pathToSchemas: PathToSchemasMap): RequiredWithEmptyArrayMap { + val properties: LinkedHashMap = LinkedHashMap() + for((propertyName, value) in arg) { + if (!(propertyName is String)) { + throw RuntimeException("Invalid non-string key value") + } + val propertyPathToItem: List = pathToItem + propertyName + val schemas: LinkedHashMap, Nothing?>? = pathToSchemas.get(propertyPathToItem) + if (schemas == null) { + throw RuntimeException("Validation result is invalid, schemas must exist for a pathToItem") + } + val propertySchema: JsonSchema<*> = schemas.entries.iterator().next().key + val propertyInstance: Any? = propertySchema.getNewInstance(value, propertyPathToItem, pathToSchemas) + properties[propertyName] = propertyInstance + } + val castProperties: FrozenMap = FrozenMap(properties) + return RequiredWithEmptyArrayMap(castProperties) + } + + @Throws(ValidationException::class) + override fun validate(arg: Map<*, *>, configuration: SchemaConfiguration?): RequiredWithEmptyArrayMap { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validatedPathToSchemas = PathToSchemasMap() + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, LinkedHashSet()) + val pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet) + return getNewInstance(castArg, validationMetadata.pathToItem, pathToSchemasMap) + } + + @Throws(ValidationException::class) + override fun validate(arg: Any?, configuration: SchemaConfiguration?): Any? { + if (arg == null) { + return validate(null, configuration) + } else if (arg is Boolean) { + return validate(arg, configuration) + } else if (arg is Number) { + return validate(arg, configuration) + } else if (arg is String) { + return validate(arg, configuration) + } else if (arg is List<*>) { + return validate(arg, configuration) + } else if (arg is Map<*, *>) { + return validate(arg, configuration) + } + throw ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema") + } + override fun getNewInstance(arg: Any?, pathToItem: List, pathToSchemas: PathToSchemasMap): Any? { + if (arg == null) { + return getNewInstance( null, pathToItem, pathToSchemas) + } else if (arg is Boolean) { + return getNewInstance(arg, pathToItem, pathToSchemas) + } else if (arg is Number) { + return getNewInstance(arg, pathToItem, pathToSchemas) + } else if (arg is String) { + return getNewInstance(arg, pathToItem, pathToSchemas) + } else if (arg is List<*>) { + return getNewInstance(arg, pathToItem, pathToSchemas) + } else if (arg is Map<*, *>) { + return getNewInstance(arg, pathToItem, pathToSchemas) + } + throw RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema") + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: Nothing?, configuration: SchemaConfiguration?): RequiredWithEmptyArray1BoxedVoid { + return RequiredWithEmptyArray1BoxedVoid(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: Boolean, configuration: SchemaConfiguration?): RequiredWithEmptyArray1BoxedBoolean { + return RequiredWithEmptyArray1BoxedBoolean(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: Number, configuration: SchemaConfiguration?): RequiredWithEmptyArray1BoxedNumber { + return RequiredWithEmptyArray1BoxedNumber(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: String, configuration: SchemaConfiguration?): RequiredWithEmptyArray1BoxedString { + return RequiredWithEmptyArray1BoxedString(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: List<*>, configuration: SchemaConfiguration?): RequiredWithEmptyArray1BoxedList { + return RequiredWithEmptyArray1BoxedList(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: Map<*, *>, configuration: SchemaConfiguration?): RequiredWithEmptyArray1BoxedMap { + return RequiredWithEmptyArray1BoxedMap(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: Any?, configuration: SchemaConfiguration?): RequiredWithEmptyArray1Boxed { + if (arg == null) { + return validateAndBox(null, configuration) + } else if (arg is Boolean) { + return validateAndBox(arg, configuration) + } else if (arg is String) { + return validateAndBox(arg, configuration) + } else if (arg is Number) { + return validateAndBox(arg, configuration) + } else if (arg is List<*>) { + return validateAndBox(arg, configuration) + } else if (arg is Map<*, *>) { + return validateAndBox(arg, configuration) + } + throw ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema") + } + } +} diff --git a/samples/client/3_0_3_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/schemas/RequiredWithEscapedCharacters.kt b/samples/client/3_0_3_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/schemas/RequiredWithEscapedCharacters.kt new file mode 100644 index 00000000000..872c5f93243 --- /dev/null +++ b/samples/client/3_0_3_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/schemas/RequiredWithEscapedCharacters.kt @@ -0,0 +1,1677 @@ +package org.openapijsonschematools.client.components.schemas +import java.time.LocalDate +import java.time.ZonedDateTime +import java.util.UUID +import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags +import org.openapijsonschematools.client.configurations.SchemaConfiguration +import org.openapijsonschematools.client.exceptions.InvalidAdditionalPropertyException +import org.openapijsonschematools.client.exceptions.UnsetPropertyException +import org.openapijsonschematools.client.exceptions.ValidationException +import org.openapijsonschematools.client.schemas.GenericBuilder +import org.openapijsonschematools.client.schemas.UnsetAddPropsSetter +import org.openapijsonschematools.client.schemas.validation.BooleanSchemaValidator +import org.openapijsonschematools.client.schemas.validation.FrozenList +import org.openapijsonschematools.client.schemas.validation.FrozenMap +import org.openapijsonschematools.client.schemas.validation.JsonSchema +import org.openapijsonschematools.client.schemas.validation.JsonSchemaInfo +import org.openapijsonschematools.client.schemas.validation.ListSchemaValidator +import org.openapijsonschematools.client.schemas.validation.MapSchemaValidator +import org.openapijsonschematools.client.schemas.validation.NullSchemaValidator +import org.openapijsonschematools.client.schemas.validation.NumberSchemaValidator +import org.openapijsonschematools.client.schemas.validation.PathToSchemasMap +import org.openapijsonschematools.client.schemas.validation.StringSchemaValidator +import org.openapijsonschematools.client.schemas.validation.ValidationMetadata + +class RequiredWithEscapedCharacters { + // nest classes so all schemas and input/output classes can be public + + + class RequiredWithEscapedCharactersMap(m: FrozenMap) : FrozenMap(m) { + companion object { + val requiredKeys: Set = setOf( + "foo\tbar", + "foo\nbar", + "foo\u000Cbar", + "foo\rbar", + "foo\"bar", + "foo\\bar" + ) + val optionalKeys: Set = setOf() + @Throws(ValidationException::class) + fun of(arg: Map, configuration: SchemaConfiguration): RequiredWithEscapedCharactersMap { + return RequiredWithEscapedCharacters1.getInstance().validate(arg, configuration) + } + } + + @Throws(UnsetPropertyException::class, InvalidAdditionalPropertyException::class) + fun getAdditionalProperty(name: String): Any? { + throwIfKeyKnown(name, requiredKeys, optionalKeys) + throwIfKeyNotPresent(name) + return get(name) + } + } + + interface SetterForFootbar { + fun getInstance(): MutableMap + fun getBuilderAfterFootbar(instance: MutableMap): T + + fun fooReverseSolidusTbar(value: Nothing?): T { + val instance = getInstance() + instance["foo\tbar"] = null + return getBuilderAfterFootbar(instance) + } + + fun fooReverseSolidusTbar(value: Boolean): T { + val instance = getInstance() + instance["foo\tbar"] = value + return getBuilderAfterFootbar(instance) + } + + fun fooReverseSolidusTbar(value: String): T { + val instance = getInstance() + instance["foo\tbar"] = value + return getBuilderAfterFootbar(instance) + } + + fun fooReverseSolidusTbar(value: Int): T { + val instance = getInstance() + instance["foo\tbar"] = value + return getBuilderAfterFootbar(instance) + } + + fun fooReverseSolidusTbar(value: Float): T { + val instance = getInstance() + instance["foo\tbar"] = value + return getBuilderAfterFootbar(instance) + } + + fun fooReverseSolidusTbar(value: Long): T { + val instance = getInstance() + instance["foo\tbar"] = value + return getBuilderAfterFootbar(instance) + } + + fun fooReverseSolidusTbar(value: Double): T { + val instance = getInstance() + instance["foo\tbar"] = value + return getBuilderAfterFootbar(instance) + } + + fun fooReverseSolidusTbar(value: List): T { + val instance = getInstance() + instance["foo\tbar"] = value + return getBuilderAfterFootbar(instance) + } + + fun fooReverseSolidusTbar(value: Map): T { + val instance = getInstance() + instance["foo\tbar"] = value + return getBuilderAfterFootbar(instance) + } + } + + interface SetterForFoonbar { + fun getInstance(): MutableMap + fun getBuilderAfterFoonbar(instance: MutableMap): T + + fun fooReverseSolidusNbar(value: Nothing?): T { + val instance = getInstance() + instance["foo\nbar"] = null + return getBuilderAfterFoonbar(instance) + } + + fun fooReverseSolidusNbar(value: Boolean): T { + val instance = getInstance() + instance["foo\nbar"] = value + return getBuilderAfterFoonbar(instance) + } + + fun fooReverseSolidusNbar(value: String): T { + val instance = getInstance() + instance["foo\nbar"] = value + return getBuilderAfterFoonbar(instance) + } + + fun fooReverseSolidusNbar(value: Int): T { + val instance = getInstance() + instance["foo\nbar"] = value + return getBuilderAfterFoonbar(instance) + } + + fun fooReverseSolidusNbar(value: Float): T { + val instance = getInstance() + instance["foo\nbar"] = value + return getBuilderAfterFoonbar(instance) + } + + fun fooReverseSolidusNbar(value: Long): T { + val instance = getInstance() + instance["foo\nbar"] = value + return getBuilderAfterFoonbar(instance) + } + + fun fooReverseSolidusNbar(value: Double): T { + val instance = getInstance() + instance["foo\nbar"] = value + return getBuilderAfterFoonbar(instance) + } + + fun fooReverseSolidusNbar(value: List): T { + val instance = getInstance() + instance["foo\nbar"] = value + return getBuilderAfterFoonbar(instance) + } + + fun fooReverseSolidusNbar(value: Map): T { + val instance = getInstance() + instance["foo\nbar"] = value + return getBuilderAfterFoonbar(instance) + } + } + + interface SetterForFoou000Cbar { + fun getInstance(): MutableMap + fun getBuilderAfterFoou000Cbar(instance: MutableMap): T + + fun fooReverseSolidusU000cbar(value: Nothing?): T { + val instance = getInstance() + instance["foo\u000Cbar"] = null + return getBuilderAfterFoou000Cbar(instance) + } + + fun fooReverseSolidusU000cbar(value: Boolean): T { + val instance = getInstance() + instance["foo\u000Cbar"] = value + return getBuilderAfterFoou000Cbar(instance) + } + + fun fooReverseSolidusU000cbar(value: String): T { + val instance = getInstance() + instance["foo\u000Cbar"] = value + return getBuilderAfterFoou000Cbar(instance) + } + + fun fooReverseSolidusU000cbar(value: Int): T { + val instance = getInstance() + instance["foo\u000Cbar"] = value + return getBuilderAfterFoou000Cbar(instance) + } + + fun fooReverseSolidusU000cbar(value: Float): T { + val instance = getInstance() + instance["foo\u000Cbar"] = value + return getBuilderAfterFoou000Cbar(instance) + } + + fun fooReverseSolidusU000cbar(value: Long): T { + val instance = getInstance() + instance["foo\u000Cbar"] = value + return getBuilderAfterFoou000Cbar(instance) + } + + fun fooReverseSolidusU000cbar(value: Double): T { + val instance = getInstance() + instance["foo\u000Cbar"] = value + return getBuilderAfterFoou000Cbar(instance) + } + + fun fooReverseSolidusU000cbar(value: List): T { + val instance = getInstance() + instance["foo\u000Cbar"] = value + return getBuilderAfterFoou000Cbar(instance) + } + + fun fooReverseSolidusU000cbar(value: Map): T { + val instance = getInstance() + instance["foo\u000Cbar"] = value + return getBuilderAfterFoou000Cbar(instance) + } + } + + interface SetterForFoorbar { + fun getInstance(): MutableMap + fun getBuilderAfterFoorbar(instance: MutableMap): T + + fun fooReverseSolidusRbar(value: Nothing?): T { + val instance = getInstance() + instance["foo\rbar"] = null + return getBuilderAfterFoorbar(instance) + } + + fun fooReverseSolidusRbar(value: Boolean): T { + val instance = getInstance() + instance["foo\rbar"] = value + return getBuilderAfterFoorbar(instance) + } + + fun fooReverseSolidusRbar(value: String): T { + val instance = getInstance() + instance["foo\rbar"] = value + return getBuilderAfterFoorbar(instance) + } + + fun fooReverseSolidusRbar(value: Int): T { + val instance = getInstance() + instance["foo\rbar"] = value + return getBuilderAfterFoorbar(instance) + } + + fun fooReverseSolidusRbar(value: Float): T { + val instance = getInstance() + instance["foo\rbar"] = value + return getBuilderAfterFoorbar(instance) + } + + fun fooReverseSolidusRbar(value: Long): T { + val instance = getInstance() + instance["foo\rbar"] = value + return getBuilderAfterFoorbar(instance) + } + + fun fooReverseSolidusRbar(value: Double): T { + val instance = getInstance() + instance["foo\rbar"] = value + return getBuilderAfterFoorbar(instance) + } + + fun fooReverseSolidusRbar(value: List): T { + val instance = getInstance() + instance["foo\rbar"] = value + return getBuilderAfterFoorbar(instance) + } + + fun fooReverseSolidusRbar(value: Map): T { + val instance = getInstance() + instance["foo\rbar"] = value + return getBuilderAfterFoorbar(instance) + } + } + + interface SetterForFoobar { + fun getInstance(): MutableMap + fun getBuilderAfterFoobar(instance: MutableMap): T + + fun fooReverseSolidusQuotationMarkBar(value: Nothing?): T { + val instance = getInstance() + instance["foo\"bar"] = null + return getBuilderAfterFoobar(instance) + } + + fun fooReverseSolidusQuotationMarkBar(value: Boolean): T { + val instance = getInstance() + instance["foo\"bar"] = value + return getBuilderAfterFoobar(instance) + } + + fun fooReverseSolidusQuotationMarkBar(value: String): T { + val instance = getInstance() + instance["foo\"bar"] = value + return getBuilderAfterFoobar(instance) + } + + fun fooReverseSolidusQuotationMarkBar(value: Int): T { + val instance = getInstance() + instance["foo\"bar"] = value + return getBuilderAfterFoobar(instance) + } + + fun fooReverseSolidusQuotationMarkBar(value: Float): T { + val instance = getInstance() + instance["foo\"bar"] = value + return getBuilderAfterFoobar(instance) + } + + fun fooReverseSolidusQuotationMarkBar(value: Long): T { + val instance = getInstance() + instance["foo\"bar"] = value + return getBuilderAfterFoobar(instance) + } + + fun fooReverseSolidusQuotationMarkBar(value: Double): T { + val instance = getInstance() + instance["foo\"bar"] = value + return getBuilderAfterFoobar(instance) + } + + fun fooReverseSolidusQuotationMarkBar(value: List): T { + val instance = getInstance() + instance["foo\"bar"] = value + return getBuilderAfterFoobar(instance) + } + + fun fooReverseSolidusQuotationMarkBar(value: Map): T { + val instance = getInstance() + instance["foo\"bar"] = value + return getBuilderAfterFoobar(instance) + } + } + + interface SetterForFoobar1 { + fun getInstance(): MutableMap + fun getBuilderAfterFoobar1(instance: MutableMap): T + + fun fooReverseSolidusReverseSolidusBar(value: Nothing?): T { + val instance = getInstance() + instance["foo\\bar"] = null + return getBuilderAfterFoobar1(instance) + } + + fun fooReverseSolidusReverseSolidusBar(value: Boolean): T { + val instance = getInstance() + instance["foo\\bar"] = value + return getBuilderAfterFoobar1(instance) + } + + fun fooReverseSolidusReverseSolidusBar(value: String): T { + val instance = getInstance() + instance["foo\\bar"] = value + return getBuilderAfterFoobar1(instance) + } + + fun fooReverseSolidusReverseSolidusBar(value: Int): T { + val instance = getInstance() + instance["foo\\bar"] = value + return getBuilderAfterFoobar1(instance) + } + + fun fooReverseSolidusReverseSolidusBar(value: Float): T { + val instance = getInstance() + instance["foo\\bar"] = value + return getBuilderAfterFoobar1(instance) + } + + fun fooReverseSolidusReverseSolidusBar(value: Long): T { + val instance = getInstance() + instance["foo\\bar"] = value + return getBuilderAfterFoobar1(instance) + } + + fun fooReverseSolidusReverseSolidusBar(value: Double): T { + val instance = getInstance() + instance["foo\\bar"] = value + return getBuilderAfterFoobar1(instance) + } + + fun fooReverseSolidusReverseSolidusBar(value: List): T { + val instance = getInstance() + instance["foo\\bar"] = value + return getBuilderAfterFoobar1(instance) + } + + fun fooReverseSolidusReverseSolidusBar(value: Map): T { + val instance = getInstance() + instance["foo\\bar"] = value + return getBuilderAfterFoobar1(instance) + } + } + + class RequiredWithEscapedCharactersMap000000Builder(private val instance: MutableMap): UnsetAddPropsSetter, GenericBuilder> { + private val knownKeys: Set = setOf( + "foo\tbar", + "foo\nbar", + "foo\u000Cbar", + "foo\rbar", + "foo\"bar", + "foo\\bar" + ) + override fun getKnownKeys(): Set { + return knownKeys + } + override fun build(): Map { + return instance + } + override fun getInstance(): MutableMap { + return instance + } + override fun getBuilderAfterAdditionalProperty(instance: MutableMap): RequiredWithEscapedCharactersMap000000Builder { + return this + } + } + + class RequiredWithEscapedCharactersMap000001Builder(private val instance: MutableMap): SetterForFoobar1 { + override fun getInstance(): MutableMap { + return instance + } + override fun getBuilderAfterFoobar1(instance: MutableMap): RequiredWithEscapedCharactersMap000000Builder { + return RequiredWithEscapedCharactersMap000000Builder(instance) + } + } + + class RequiredWithEscapedCharactersMap000010Builder(private val instance: MutableMap): SetterForFoobar { + override fun getInstance(): MutableMap { + return instance + } + override fun getBuilderAfterFoobar(instance: MutableMap): RequiredWithEscapedCharactersMap000000Builder { + return RequiredWithEscapedCharactersMap000000Builder(instance) + } + } + + class RequiredWithEscapedCharactersMap000011Builder(private val instance: MutableMap): SetterForFoobar, SetterForFoobar1 { + override fun getInstance(): MutableMap { + return instance + } + override fun getBuilderAfterFoobar(instance: MutableMap): RequiredWithEscapedCharactersMap000001Builder { + return RequiredWithEscapedCharactersMap000001Builder(instance) + } + override fun getBuilderAfterFoobar1(instance: MutableMap): RequiredWithEscapedCharactersMap000010Builder { + return RequiredWithEscapedCharactersMap000010Builder(instance) + } + } + + class RequiredWithEscapedCharactersMap000100Builder(private val instance: MutableMap): SetterForFoorbar { + override fun getInstance(): MutableMap { + return instance + } + override fun getBuilderAfterFoorbar(instance: MutableMap): RequiredWithEscapedCharactersMap000000Builder { + return RequiredWithEscapedCharactersMap000000Builder(instance) + } + } + + class RequiredWithEscapedCharactersMap000101Builder(private val instance: MutableMap): SetterForFoorbar, SetterForFoobar1 { + override fun getInstance(): MutableMap { + return instance + } + override fun getBuilderAfterFoorbar(instance: MutableMap): RequiredWithEscapedCharactersMap000001Builder { + return RequiredWithEscapedCharactersMap000001Builder(instance) + } + override fun getBuilderAfterFoobar1(instance: MutableMap): RequiredWithEscapedCharactersMap000100Builder { + return RequiredWithEscapedCharactersMap000100Builder(instance) + } + } + + class RequiredWithEscapedCharactersMap000110Builder(private val instance: MutableMap): SetterForFoorbar, SetterForFoobar { + override fun getInstance(): MutableMap { + return instance + } + override fun getBuilderAfterFoorbar(instance: MutableMap): RequiredWithEscapedCharactersMap000010Builder { + return RequiredWithEscapedCharactersMap000010Builder(instance) + } + override fun getBuilderAfterFoobar(instance: MutableMap): RequiredWithEscapedCharactersMap000100Builder { + return RequiredWithEscapedCharactersMap000100Builder(instance) + } + } + + class RequiredWithEscapedCharactersMap000111Builder(private val instance: MutableMap): SetterForFoorbar, SetterForFoobar, SetterForFoobar1 { + override fun getInstance(): MutableMap { + return instance + } + override fun getBuilderAfterFoorbar(instance: MutableMap): RequiredWithEscapedCharactersMap000011Builder { + return RequiredWithEscapedCharactersMap000011Builder(instance) + } + override fun getBuilderAfterFoobar(instance: MutableMap): RequiredWithEscapedCharactersMap000101Builder { + return RequiredWithEscapedCharactersMap000101Builder(instance) + } + override fun getBuilderAfterFoobar1(instance: MutableMap): RequiredWithEscapedCharactersMap000110Builder { + return RequiredWithEscapedCharactersMap000110Builder(instance) + } + } + + class RequiredWithEscapedCharactersMap001000Builder(private val instance: MutableMap): SetterForFoou000Cbar { + override fun getInstance(): MutableMap { + return instance + } + override fun getBuilderAfterFoou000Cbar(instance: MutableMap): RequiredWithEscapedCharactersMap000000Builder { + return RequiredWithEscapedCharactersMap000000Builder(instance) + } + } + + class RequiredWithEscapedCharactersMap001001Builder(private val instance: MutableMap): SetterForFoou000Cbar, SetterForFoobar1 { + override fun getInstance(): MutableMap { + return instance + } + override fun getBuilderAfterFoou000Cbar(instance: MutableMap): RequiredWithEscapedCharactersMap000001Builder { + return RequiredWithEscapedCharactersMap000001Builder(instance) + } + override fun getBuilderAfterFoobar1(instance: MutableMap): RequiredWithEscapedCharactersMap001000Builder { + return RequiredWithEscapedCharactersMap001000Builder(instance) + } + } + + class RequiredWithEscapedCharactersMap001010Builder(private val instance: MutableMap): SetterForFoou000Cbar, SetterForFoobar { + override fun getInstance(): MutableMap { + return instance + } + override fun getBuilderAfterFoou000Cbar(instance: MutableMap): RequiredWithEscapedCharactersMap000010Builder { + return RequiredWithEscapedCharactersMap000010Builder(instance) + } + override fun getBuilderAfterFoobar(instance: MutableMap): RequiredWithEscapedCharactersMap001000Builder { + return RequiredWithEscapedCharactersMap001000Builder(instance) + } + } + + class RequiredWithEscapedCharactersMap001011Builder(private val instance: MutableMap): SetterForFoou000Cbar, SetterForFoobar, SetterForFoobar1 { + override fun getInstance(): MutableMap { + return instance + } + override fun getBuilderAfterFoou000Cbar(instance: MutableMap): RequiredWithEscapedCharactersMap000011Builder { + return RequiredWithEscapedCharactersMap000011Builder(instance) + } + override fun getBuilderAfterFoobar(instance: MutableMap): RequiredWithEscapedCharactersMap001001Builder { + return RequiredWithEscapedCharactersMap001001Builder(instance) + } + override fun getBuilderAfterFoobar1(instance: MutableMap): RequiredWithEscapedCharactersMap001010Builder { + return RequiredWithEscapedCharactersMap001010Builder(instance) + } + } + + class RequiredWithEscapedCharactersMap001100Builder(private val instance: MutableMap): SetterForFoou000Cbar, SetterForFoorbar { + override fun getInstance(): MutableMap { + return instance + } + override fun getBuilderAfterFoou000Cbar(instance: MutableMap): RequiredWithEscapedCharactersMap000100Builder { + return RequiredWithEscapedCharactersMap000100Builder(instance) + } + override fun getBuilderAfterFoorbar(instance: MutableMap): RequiredWithEscapedCharactersMap001000Builder { + return RequiredWithEscapedCharactersMap001000Builder(instance) + } + } + + class RequiredWithEscapedCharactersMap001101Builder(private val instance: MutableMap): SetterForFoou000Cbar, SetterForFoorbar, SetterForFoobar1 { + override fun getInstance(): MutableMap { + return instance + } + override fun getBuilderAfterFoou000Cbar(instance: MutableMap): RequiredWithEscapedCharactersMap000101Builder { + return RequiredWithEscapedCharactersMap000101Builder(instance) + } + override fun getBuilderAfterFoorbar(instance: MutableMap): RequiredWithEscapedCharactersMap001001Builder { + return RequiredWithEscapedCharactersMap001001Builder(instance) + } + override fun getBuilderAfterFoobar1(instance: MutableMap): RequiredWithEscapedCharactersMap001100Builder { + return RequiredWithEscapedCharactersMap001100Builder(instance) + } + } + + class RequiredWithEscapedCharactersMap001110Builder(private val instance: MutableMap): SetterForFoou000Cbar, SetterForFoorbar, SetterForFoobar { + override fun getInstance(): MutableMap { + return instance + } + override fun getBuilderAfterFoou000Cbar(instance: MutableMap): RequiredWithEscapedCharactersMap000110Builder { + return RequiredWithEscapedCharactersMap000110Builder(instance) + } + override fun getBuilderAfterFoorbar(instance: MutableMap): RequiredWithEscapedCharactersMap001010Builder { + return RequiredWithEscapedCharactersMap001010Builder(instance) + } + override fun getBuilderAfterFoobar(instance: MutableMap): RequiredWithEscapedCharactersMap001100Builder { + return RequiredWithEscapedCharactersMap001100Builder(instance) + } + } + + class RequiredWithEscapedCharactersMap001111Builder(private val instance: MutableMap): SetterForFoou000Cbar, SetterForFoorbar, SetterForFoobar, SetterForFoobar1 { + override fun getInstance(): MutableMap { + return instance + } + override fun getBuilderAfterFoou000Cbar(instance: MutableMap): RequiredWithEscapedCharactersMap000111Builder { + return RequiredWithEscapedCharactersMap000111Builder(instance) + } + override fun getBuilderAfterFoorbar(instance: MutableMap): RequiredWithEscapedCharactersMap001011Builder { + return RequiredWithEscapedCharactersMap001011Builder(instance) + } + override fun getBuilderAfterFoobar(instance: MutableMap): RequiredWithEscapedCharactersMap001101Builder { + return RequiredWithEscapedCharactersMap001101Builder(instance) + } + override fun getBuilderAfterFoobar1(instance: MutableMap): RequiredWithEscapedCharactersMap001110Builder { + return RequiredWithEscapedCharactersMap001110Builder(instance) + } + } + + class RequiredWithEscapedCharactersMap010000Builder(private val instance: MutableMap): SetterForFoonbar { + override fun getInstance(): MutableMap { + return instance + } + override fun getBuilderAfterFoonbar(instance: MutableMap): RequiredWithEscapedCharactersMap000000Builder { + return RequiredWithEscapedCharactersMap000000Builder(instance) + } + } + + class RequiredWithEscapedCharactersMap010001Builder(private val instance: MutableMap): SetterForFoonbar, SetterForFoobar1 { + override fun getInstance(): MutableMap { + return instance + } + override fun getBuilderAfterFoonbar(instance: MutableMap): RequiredWithEscapedCharactersMap000001Builder { + return RequiredWithEscapedCharactersMap000001Builder(instance) + } + override fun getBuilderAfterFoobar1(instance: MutableMap): RequiredWithEscapedCharactersMap010000Builder { + return RequiredWithEscapedCharactersMap010000Builder(instance) + } + } + + class RequiredWithEscapedCharactersMap010010Builder(private val instance: MutableMap): SetterForFoonbar, SetterForFoobar { + override fun getInstance(): MutableMap { + return instance + } + override fun getBuilderAfterFoonbar(instance: MutableMap): RequiredWithEscapedCharactersMap000010Builder { + return RequiredWithEscapedCharactersMap000010Builder(instance) + } + override fun getBuilderAfterFoobar(instance: MutableMap): RequiredWithEscapedCharactersMap010000Builder { + return RequiredWithEscapedCharactersMap010000Builder(instance) + } + } + + class RequiredWithEscapedCharactersMap010011Builder(private val instance: MutableMap): SetterForFoonbar, SetterForFoobar, SetterForFoobar1 { + override fun getInstance(): MutableMap { + return instance + } + override fun getBuilderAfterFoonbar(instance: MutableMap): RequiredWithEscapedCharactersMap000011Builder { + return RequiredWithEscapedCharactersMap000011Builder(instance) + } + override fun getBuilderAfterFoobar(instance: MutableMap): RequiredWithEscapedCharactersMap010001Builder { + return RequiredWithEscapedCharactersMap010001Builder(instance) + } + override fun getBuilderAfterFoobar1(instance: MutableMap): RequiredWithEscapedCharactersMap010010Builder { + return RequiredWithEscapedCharactersMap010010Builder(instance) + } + } + + class RequiredWithEscapedCharactersMap010100Builder(private val instance: MutableMap): SetterForFoonbar, SetterForFoorbar { + override fun getInstance(): MutableMap { + return instance + } + override fun getBuilderAfterFoonbar(instance: MutableMap): RequiredWithEscapedCharactersMap000100Builder { + return RequiredWithEscapedCharactersMap000100Builder(instance) + } + override fun getBuilderAfterFoorbar(instance: MutableMap): RequiredWithEscapedCharactersMap010000Builder { + return RequiredWithEscapedCharactersMap010000Builder(instance) + } + } + + class RequiredWithEscapedCharactersMap010101Builder(private val instance: MutableMap): SetterForFoonbar, SetterForFoorbar, SetterForFoobar1 { + override fun getInstance(): MutableMap { + return instance + } + override fun getBuilderAfterFoonbar(instance: MutableMap): RequiredWithEscapedCharactersMap000101Builder { + return RequiredWithEscapedCharactersMap000101Builder(instance) + } + override fun getBuilderAfterFoorbar(instance: MutableMap): RequiredWithEscapedCharactersMap010001Builder { + return RequiredWithEscapedCharactersMap010001Builder(instance) + } + override fun getBuilderAfterFoobar1(instance: MutableMap): RequiredWithEscapedCharactersMap010100Builder { + return RequiredWithEscapedCharactersMap010100Builder(instance) + } + } + + class RequiredWithEscapedCharactersMap010110Builder(private val instance: MutableMap): SetterForFoonbar, SetterForFoorbar, SetterForFoobar { + override fun getInstance(): MutableMap { + return instance + } + override fun getBuilderAfterFoonbar(instance: MutableMap): RequiredWithEscapedCharactersMap000110Builder { + return RequiredWithEscapedCharactersMap000110Builder(instance) + } + override fun getBuilderAfterFoorbar(instance: MutableMap): RequiredWithEscapedCharactersMap010010Builder { + return RequiredWithEscapedCharactersMap010010Builder(instance) + } + override fun getBuilderAfterFoobar(instance: MutableMap): RequiredWithEscapedCharactersMap010100Builder { + return RequiredWithEscapedCharactersMap010100Builder(instance) + } + } + + class RequiredWithEscapedCharactersMap010111Builder(private val instance: MutableMap): SetterForFoonbar, SetterForFoorbar, SetterForFoobar, SetterForFoobar1 { + override fun getInstance(): MutableMap { + return instance + } + override fun getBuilderAfterFoonbar(instance: MutableMap): RequiredWithEscapedCharactersMap000111Builder { + return RequiredWithEscapedCharactersMap000111Builder(instance) + } + override fun getBuilderAfterFoorbar(instance: MutableMap): RequiredWithEscapedCharactersMap010011Builder { + return RequiredWithEscapedCharactersMap010011Builder(instance) + } + override fun getBuilderAfterFoobar(instance: MutableMap): RequiredWithEscapedCharactersMap010101Builder { + return RequiredWithEscapedCharactersMap010101Builder(instance) + } + override fun getBuilderAfterFoobar1(instance: MutableMap): RequiredWithEscapedCharactersMap010110Builder { + return RequiredWithEscapedCharactersMap010110Builder(instance) + } + } + + class RequiredWithEscapedCharactersMap011000Builder(private val instance: MutableMap): SetterForFoonbar, SetterForFoou000Cbar { + override fun getInstance(): MutableMap { + return instance + } + override fun getBuilderAfterFoonbar(instance: MutableMap): RequiredWithEscapedCharactersMap001000Builder { + return RequiredWithEscapedCharactersMap001000Builder(instance) + } + override fun getBuilderAfterFoou000Cbar(instance: MutableMap): RequiredWithEscapedCharactersMap010000Builder { + return RequiredWithEscapedCharactersMap010000Builder(instance) + } + } + + class RequiredWithEscapedCharactersMap011001Builder(private val instance: MutableMap): SetterForFoonbar, SetterForFoou000Cbar, SetterForFoobar1 { + override fun getInstance(): MutableMap { + return instance + } + override fun getBuilderAfterFoonbar(instance: MutableMap): RequiredWithEscapedCharactersMap001001Builder { + return RequiredWithEscapedCharactersMap001001Builder(instance) + } + override fun getBuilderAfterFoou000Cbar(instance: MutableMap): RequiredWithEscapedCharactersMap010001Builder { + return RequiredWithEscapedCharactersMap010001Builder(instance) + } + override fun getBuilderAfterFoobar1(instance: MutableMap): RequiredWithEscapedCharactersMap011000Builder { + return RequiredWithEscapedCharactersMap011000Builder(instance) + } + } + + class RequiredWithEscapedCharactersMap011010Builder(private val instance: MutableMap): SetterForFoonbar, SetterForFoou000Cbar, SetterForFoobar { + override fun getInstance(): MutableMap { + return instance + } + override fun getBuilderAfterFoonbar(instance: MutableMap): RequiredWithEscapedCharactersMap001010Builder { + return RequiredWithEscapedCharactersMap001010Builder(instance) + } + override fun getBuilderAfterFoou000Cbar(instance: MutableMap): RequiredWithEscapedCharactersMap010010Builder { + return RequiredWithEscapedCharactersMap010010Builder(instance) + } + override fun getBuilderAfterFoobar(instance: MutableMap): RequiredWithEscapedCharactersMap011000Builder { + return RequiredWithEscapedCharactersMap011000Builder(instance) + } + } + + class RequiredWithEscapedCharactersMap011011Builder(private val instance: MutableMap): SetterForFoonbar, SetterForFoou000Cbar, SetterForFoobar, SetterForFoobar1 { + override fun getInstance(): MutableMap { + return instance + } + override fun getBuilderAfterFoonbar(instance: MutableMap): RequiredWithEscapedCharactersMap001011Builder { + return RequiredWithEscapedCharactersMap001011Builder(instance) + } + override fun getBuilderAfterFoou000Cbar(instance: MutableMap): RequiredWithEscapedCharactersMap010011Builder { + return RequiredWithEscapedCharactersMap010011Builder(instance) + } + override fun getBuilderAfterFoobar(instance: MutableMap): RequiredWithEscapedCharactersMap011001Builder { + return RequiredWithEscapedCharactersMap011001Builder(instance) + } + override fun getBuilderAfterFoobar1(instance: MutableMap): RequiredWithEscapedCharactersMap011010Builder { + return RequiredWithEscapedCharactersMap011010Builder(instance) + } + } + + class RequiredWithEscapedCharactersMap011100Builder(private val instance: MutableMap): SetterForFoonbar, SetterForFoou000Cbar, SetterForFoorbar { + override fun getInstance(): MutableMap { + return instance + } + override fun getBuilderAfterFoonbar(instance: MutableMap): RequiredWithEscapedCharactersMap001100Builder { + return RequiredWithEscapedCharactersMap001100Builder(instance) + } + override fun getBuilderAfterFoou000Cbar(instance: MutableMap): RequiredWithEscapedCharactersMap010100Builder { + return RequiredWithEscapedCharactersMap010100Builder(instance) + } + override fun getBuilderAfterFoorbar(instance: MutableMap): RequiredWithEscapedCharactersMap011000Builder { + return RequiredWithEscapedCharactersMap011000Builder(instance) + } + } + + class RequiredWithEscapedCharactersMap011101Builder(private val instance: MutableMap): SetterForFoonbar, SetterForFoou000Cbar, SetterForFoorbar, SetterForFoobar1 { + override fun getInstance(): MutableMap { + return instance + } + override fun getBuilderAfterFoonbar(instance: MutableMap): RequiredWithEscapedCharactersMap001101Builder { + return RequiredWithEscapedCharactersMap001101Builder(instance) + } + override fun getBuilderAfterFoou000Cbar(instance: MutableMap): RequiredWithEscapedCharactersMap010101Builder { + return RequiredWithEscapedCharactersMap010101Builder(instance) + } + override fun getBuilderAfterFoorbar(instance: MutableMap): RequiredWithEscapedCharactersMap011001Builder { + return RequiredWithEscapedCharactersMap011001Builder(instance) + } + override fun getBuilderAfterFoobar1(instance: MutableMap): RequiredWithEscapedCharactersMap011100Builder { + return RequiredWithEscapedCharactersMap011100Builder(instance) + } + } + + class RequiredWithEscapedCharactersMap011110Builder(private val instance: MutableMap): SetterForFoonbar, SetterForFoou000Cbar, SetterForFoorbar, SetterForFoobar { + override fun getInstance(): MutableMap { + return instance + } + override fun getBuilderAfterFoonbar(instance: MutableMap): RequiredWithEscapedCharactersMap001110Builder { + return RequiredWithEscapedCharactersMap001110Builder(instance) + } + override fun getBuilderAfterFoou000Cbar(instance: MutableMap): RequiredWithEscapedCharactersMap010110Builder { + return RequiredWithEscapedCharactersMap010110Builder(instance) + } + override fun getBuilderAfterFoorbar(instance: MutableMap): RequiredWithEscapedCharactersMap011010Builder { + return RequiredWithEscapedCharactersMap011010Builder(instance) + } + override fun getBuilderAfterFoobar(instance: MutableMap): RequiredWithEscapedCharactersMap011100Builder { + return RequiredWithEscapedCharactersMap011100Builder(instance) + } + } + + class RequiredWithEscapedCharactersMap011111Builder(private val instance: MutableMap): SetterForFoonbar, SetterForFoou000Cbar, SetterForFoorbar, SetterForFoobar, SetterForFoobar1 { + override fun getInstance(): MutableMap { + return instance + } + override fun getBuilderAfterFoonbar(instance: MutableMap): RequiredWithEscapedCharactersMap001111Builder { + return RequiredWithEscapedCharactersMap001111Builder(instance) + } + override fun getBuilderAfterFoou000Cbar(instance: MutableMap): RequiredWithEscapedCharactersMap010111Builder { + return RequiredWithEscapedCharactersMap010111Builder(instance) + } + override fun getBuilderAfterFoorbar(instance: MutableMap): RequiredWithEscapedCharactersMap011011Builder { + return RequiredWithEscapedCharactersMap011011Builder(instance) + } + override fun getBuilderAfterFoobar(instance: MutableMap): RequiredWithEscapedCharactersMap011101Builder { + return RequiredWithEscapedCharactersMap011101Builder(instance) + } + override fun getBuilderAfterFoobar1(instance: MutableMap): RequiredWithEscapedCharactersMap011110Builder { + return RequiredWithEscapedCharactersMap011110Builder(instance) + } + } + + class RequiredWithEscapedCharactersMap100000Builder(private val instance: MutableMap): SetterForFootbar { + override fun getInstance(): MutableMap { + return instance + } + override fun getBuilderAfterFootbar(instance: MutableMap): RequiredWithEscapedCharactersMap000000Builder { + return RequiredWithEscapedCharactersMap000000Builder(instance) + } + } + + class RequiredWithEscapedCharactersMap100001Builder(private val instance: MutableMap): SetterForFootbar, SetterForFoobar1 { + override fun getInstance(): MutableMap { + return instance + } + override fun getBuilderAfterFootbar(instance: MutableMap): RequiredWithEscapedCharactersMap000001Builder { + return RequiredWithEscapedCharactersMap000001Builder(instance) + } + override fun getBuilderAfterFoobar1(instance: MutableMap): RequiredWithEscapedCharactersMap100000Builder { + return RequiredWithEscapedCharactersMap100000Builder(instance) + } + } + + class RequiredWithEscapedCharactersMap100010Builder(private val instance: MutableMap): SetterForFootbar, SetterForFoobar { + override fun getInstance(): MutableMap { + return instance + } + override fun getBuilderAfterFootbar(instance: MutableMap): RequiredWithEscapedCharactersMap000010Builder { + return RequiredWithEscapedCharactersMap000010Builder(instance) + } + override fun getBuilderAfterFoobar(instance: MutableMap): RequiredWithEscapedCharactersMap100000Builder { + return RequiredWithEscapedCharactersMap100000Builder(instance) + } + } + + class RequiredWithEscapedCharactersMap100011Builder(private val instance: MutableMap): SetterForFootbar, SetterForFoobar, SetterForFoobar1 { + override fun getInstance(): MutableMap { + return instance + } + override fun getBuilderAfterFootbar(instance: MutableMap): RequiredWithEscapedCharactersMap000011Builder { + return RequiredWithEscapedCharactersMap000011Builder(instance) + } + override fun getBuilderAfterFoobar(instance: MutableMap): RequiredWithEscapedCharactersMap100001Builder { + return RequiredWithEscapedCharactersMap100001Builder(instance) + } + override fun getBuilderAfterFoobar1(instance: MutableMap): RequiredWithEscapedCharactersMap100010Builder { + return RequiredWithEscapedCharactersMap100010Builder(instance) + } + } + + class RequiredWithEscapedCharactersMap100100Builder(private val instance: MutableMap): SetterForFootbar, SetterForFoorbar { + override fun getInstance(): MutableMap { + return instance + } + override fun getBuilderAfterFootbar(instance: MutableMap): RequiredWithEscapedCharactersMap000100Builder { + return RequiredWithEscapedCharactersMap000100Builder(instance) + } + override fun getBuilderAfterFoorbar(instance: MutableMap): RequiredWithEscapedCharactersMap100000Builder { + return RequiredWithEscapedCharactersMap100000Builder(instance) + } + } + + class RequiredWithEscapedCharactersMap100101Builder(private val instance: MutableMap): SetterForFootbar, SetterForFoorbar, SetterForFoobar1 { + override fun getInstance(): MutableMap { + return instance + } + override fun getBuilderAfterFootbar(instance: MutableMap): RequiredWithEscapedCharactersMap000101Builder { + return RequiredWithEscapedCharactersMap000101Builder(instance) + } + override fun getBuilderAfterFoorbar(instance: MutableMap): RequiredWithEscapedCharactersMap100001Builder { + return RequiredWithEscapedCharactersMap100001Builder(instance) + } + override fun getBuilderAfterFoobar1(instance: MutableMap): RequiredWithEscapedCharactersMap100100Builder { + return RequiredWithEscapedCharactersMap100100Builder(instance) + } + } + + class RequiredWithEscapedCharactersMap100110Builder(private val instance: MutableMap): SetterForFootbar, SetterForFoorbar, SetterForFoobar { + override fun getInstance(): MutableMap { + return instance + } + override fun getBuilderAfterFootbar(instance: MutableMap): RequiredWithEscapedCharactersMap000110Builder { + return RequiredWithEscapedCharactersMap000110Builder(instance) + } + override fun getBuilderAfterFoorbar(instance: MutableMap): RequiredWithEscapedCharactersMap100010Builder { + return RequiredWithEscapedCharactersMap100010Builder(instance) + } + override fun getBuilderAfterFoobar(instance: MutableMap): RequiredWithEscapedCharactersMap100100Builder { + return RequiredWithEscapedCharactersMap100100Builder(instance) + } + } + + class RequiredWithEscapedCharactersMap100111Builder(private val instance: MutableMap): SetterForFootbar, SetterForFoorbar, SetterForFoobar, SetterForFoobar1 { + override fun getInstance(): MutableMap { + return instance + } + override fun getBuilderAfterFootbar(instance: MutableMap): RequiredWithEscapedCharactersMap000111Builder { + return RequiredWithEscapedCharactersMap000111Builder(instance) + } + override fun getBuilderAfterFoorbar(instance: MutableMap): RequiredWithEscapedCharactersMap100011Builder { + return RequiredWithEscapedCharactersMap100011Builder(instance) + } + override fun getBuilderAfterFoobar(instance: MutableMap): RequiredWithEscapedCharactersMap100101Builder { + return RequiredWithEscapedCharactersMap100101Builder(instance) + } + override fun getBuilderAfterFoobar1(instance: MutableMap): RequiredWithEscapedCharactersMap100110Builder { + return RequiredWithEscapedCharactersMap100110Builder(instance) + } + } + + class RequiredWithEscapedCharactersMap101000Builder(private val instance: MutableMap): SetterForFootbar, SetterForFoou000Cbar { + override fun getInstance(): MutableMap { + return instance + } + override fun getBuilderAfterFootbar(instance: MutableMap): RequiredWithEscapedCharactersMap001000Builder { + return RequiredWithEscapedCharactersMap001000Builder(instance) + } + override fun getBuilderAfterFoou000Cbar(instance: MutableMap): RequiredWithEscapedCharactersMap100000Builder { + return RequiredWithEscapedCharactersMap100000Builder(instance) + } + } + + class RequiredWithEscapedCharactersMap101001Builder(private val instance: MutableMap): SetterForFootbar, SetterForFoou000Cbar, SetterForFoobar1 { + override fun getInstance(): MutableMap { + return instance + } + override fun getBuilderAfterFootbar(instance: MutableMap): RequiredWithEscapedCharactersMap001001Builder { + return RequiredWithEscapedCharactersMap001001Builder(instance) + } + override fun getBuilderAfterFoou000Cbar(instance: MutableMap): RequiredWithEscapedCharactersMap100001Builder { + return RequiredWithEscapedCharactersMap100001Builder(instance) + } + override fun getBuilderAfterFoobar1(instance: MutableMap): RequiredWithEscapedCharactersMap101000Builder { + return RequiredWithEscapedCharactersMap101000Builder(instance) + } + } + + class RequiredWithEscapedCharactersMap101010Builder(private val instance: MutableMap): SetterForFootbar, SetterForFoou000Cbar, SetterForFoobar { + override fun getInstance(): MutableMap { + return instance + } + override fun getBuilderAfterFootbar(instance: MutableMap): RequiredWithEscapedCharactersMap001010Builder { + return RequiredWithEscapedCharactersMap001010Builder(instance) + } + override fun getBuilderAfterFoou000Cbar(instance: MutableMap): RequiredWithEscapedCharactersMap100010Builder { + return RequiredWithEscapedCharactersMap100010Builder(instance) + } + override fun getBuilderAfterFoobar(instance: MutableMap): RequiredWithEscapedCharactersMap101000Builder { + return RequiredWithEscapedCharactersMap101000Builder(instance) + } + } + + class RequiredWithEscapedCharactersMap101011Builder(private val instance: MutableMap): SetterForFootbar, SetterForFoou000Cbar, SetterForFoobar, SetterForFoobar1 { + override fun getInstance(): MutableMap { + return instance + } + override fun getBuilderAfterFootbar(instance: MutableMap): RequiredWithEscapedCharactersMap001011Builder { + return RequiredWithEscapedCharactersMap001011Builder(instance) + } + override fun getBuilderAfterFoou000Cbar(instance: MutableMap): RequiredWithEscapedCharactersMap100011Builder { + return RequiredWithEscapedCharactersMap100011Builder(instance) + } + override fun getBuilderAfterFoobar(instance: MutableMap): RequiredWithEscapedCharactersMap101001Builder { + return RequiredWithEscapedCharactersMap101001Builder(instance) + } + override fun getBuilderAfterFoobar1(instance: MutableMap): RequiredWithEscapedCharactersMap101010Builder { + return RequiredWithEscapedCharactersMap101010Builder(instance) + } + } + + class RequiredWithEscapedCharactersMap101100Builder(private val instance: MutableMap): SetterForFootbar, SetterForFoou000Cbar, SetterForFoorbar { + override fun getInstance(): MutableMap { + return instance + } + override fun getBuilderAfterFootbar(instance: MutableMap): RequiredWithEscapedCharactersMap001100Builder { + return RequiredWithEscapedCharactersMap001100Builder(instance) + } + override fun getBuilderAfterFoou000Cbar(instance: MutableMap): RequiredWithEscapedCharactersMap100100Builder { + return RequiredWithEscapedCharactersMap100100Builder(instance) + } + override fun getBuilderAfterFoorbar(instance: MutableMap): RequiredWithEscapedCharactersMap101000Builder { + return RequiredWithEscapedCharactersMap101000Builder(instance) + } + } + + class RequiredWithEscapedCharactersMap101101Builder(private val instance: MutableMap): SetterForFootbar, SetterForFoou000Cbar, SetterForFoorbar, SetterForFoobar1 { + override fun getInstance(): MutableMap { + return instance + } + override fun getBuilderAfterFootbar(instance: MutableMap): RequiredWithEscapedCharactersMap001101Builder { + return RequiredWithEscapedCharactersMap001101Builder(instance) + } + override fun getBuilderAfterFoou000Cbar(instance: MutableMap): RequiredWithEscapedCharactersMap100101Builder { + return RequiredWithEscapedCharactersMap100101Builder(instance) + } + override fun getBuilderAfterFoorbar(instance: MutableMap): RequiredWithEscapedCharactersMap101001Builder { + return RequiredWithEscapedCharactersMap101001Builder(instance) + } + override fun getBuilderAfterFoobar1(instance: MutableMap): RequiredWithEscapedCharactersMap101100Builder { + return RequiredWithEscapedCharactersMap101100Builder(instance) + } + } + + class RequiredWithEscapedCharactersMap101110Builder(private val instance: MutableMap): SetterForFootbar, SetterForFoou000Cbar, SetterForFoorbar, SetterForFoobar { + override fun getInstance(): MutableMap { + return instance + } + override fun getBuilderAfterFootbar(instance: MutableMap): RequiredWithEscapedCharactersMap001110Builder { + return RequiredWithEscapedCharactersMap001110Builder(instance) + } + override fun getBuilderAfterFoou000Cbar(instance: MutableMap): RequiredWithEscapedCharactersMap100110Builder { + return RequiredWithEscapedCharactersMap100110Builder(instance) + } + override fun getBuilderAfterFoorbar(instance: MutableMap): RequiredWithEscapedCharactersMap101010Builder { + return RequiredWithEscapedCharactersMap101010Builder(instance) + } + override fun getBuilderAfterFoobar(instance: MutableMap): RequiredWithEscapedCharactersMap101100Builder { + return RequiredWithEscapedCharactersMap101100Builder(instance) + } + } + + class RequiredWithEscapedCharactersMap101111Builder(private val instance: MutableMap): SetterForFootbar, SetterForFoou000Cbar, SetterForFoorbar, SetterForFoobar, SetterForFoobar1 { + override fun getInstance(): MutableMap { + return instance + } + override fun getBuilderAfterFootbar(instance: MutableMap): RequiredWithEscapedCharactersMap001111Builder { + return RequiredWithEscapedCharactersMap001111Builder(instance) + } + override fun getBuilderAfterFoou000Cbar(instance: MutableMap): RequiredWithEscapedCharactersMap100111Builder { + return RequiredWithEscapedCharactersMap100111Builder(instance) + } + override fun getBuilderAfterFoorbar(instance: MutableMap): RequiredWithEscapedCharactersMap101011Builder { + return RequiredWithEscapedCharactersMap101011Builder(instance) + } + override fun getBuilderAfterFoobar(instance: MutableMap): RequiredWithEscapedCharactersMap101101Builder { + return RequiredWithEscapedCharactersMap101101Builder(instance) + } + override fun getBuilderAfterFoobar1(instance: MutableMap): RequiredWithEscapedCharactersMap101110Builder { + return RequiredWithEscapedCharactersMap101110Builder(instance) + } + } + + class RequiredWithEscapedCharactersMap110000Builder(private val instance: MutableMap): SetterForFootbar, SetterForFoonbar { + override fun getInstance(): MutableMap { + return instance + } + override fun getBuilderAfterFootbar(instance: MutableMap): RequiredWithEscapedCharactersMap010000Builder { + return RequiredWithEscapedCharactersMap010000Builder(instance) + } + override fun getBuilderAfterFoonbar(instance: MutableMap): RequiredWithEscapedCharactersMap100000Builder { + return RequiredWithEscapedCharactersMap100000Builder(instance) + } + } + + class RequiredWithEscapedCharactersMap110001Builder(private val instance: MutableMap): SetterForFootbar, SetterForFoonbar, SetterForFoobar1 { + override fun getInstance(): MutableMap { + return instance + } + override fun getBuilderAfterFootbar(instance: MutableMap): RequiredWithEscapedCharactersMap010001Builder { + return RequiredWithEscapedCharactersMap010001Builder(instance) + } + override fun getBuilderAfterFoonbar(instance: MutableMap): RequiredWithEscapedCharactersMap100001Builder { + return RequiredWithEscapedCharactersMap100001Builder(instance) + } + override fun getBuilderAfterFoobar1(instance: MutableMap): RequiredWithEscapedCharactersMap110000Builder { + return RequiredWithEscapedCharactersMap110000Builder(instance) + } + } + + class RequiredWithEscapedCharactersMap110010Builder(private val instance: MutableMap): SetterForFootbar, SetterForFoonbar, SetterForFoobar { + override fun getInstance(): MutableMap { + return instance + } + override fun getBuilderAfterFootbar(instance: MutableMap): RequiredWithEscapedCharactersMap010010Builder { + return RequiredWithEscapedCharactersMap010010Builder(instance) + } + override fun getBuilderAfterFoonbar(instance: MutableMap): RequiredWithEscapedCharactersMap100010Builder { + return RequiredWithEscapedCharactersMap100010Builder(instance) + } + override fun getBuilderAfterFoobar(instance: MutableMap): RequiredWithEscapedCharactersMap110000Builder { + return RequiredWithEscapedCharactersMap110000Builder(instance) + } + } + + class RequiredWithEscapedCharactersMap110011Builder(private val instance: MutableMap): SetterForFootbar, SetterForFoonbar, SetterForFoobar, SetterForFoobar1 { + override fun getInstance(): MutableMap { + return instance + } + override fun getBuilderAfterFootbar(instance: MutableMap): RequiredWithEscapedCharactersMap010011Builder { + return RequiredWithEscapedCharactersMap010011Builder(instance) + } + override fun getBuilderAfterFoonbar(instance: MutableMap): RequiredWithEscapedCharactersMap100011Builder { + return RequiredWithEscapedCharactersMap100011Builder(instance) + } + override fun getBuilderAfterFoobar(instance: MutableMap): RequiredWithEscapedCharactersMap110001Builder { + return RequiredWithEscapedCharactersMap110001Builder(instance) + } + override fun getBuilderAfterFoobar1(instance: MutableMap): RequiredWithEscapedCharactersMap110010Builder { + return RequiredWithEscapedCharactersMap110010Builder(instance) + } + } + + class RequiredWithEscapedCharactersMap110100Builder(private val instance: MutableMap): SetterForFootbar, SetterForFoonbar, SetterForFoorbar { + override fun getInstance(): MutableMap { + return instance + } + override fun getBuilderAfterFootbar(instance: MutableMap): RequiredWithEscapedCharactersMap010100Builder { + return RequiredWithEscapedCharactersMap010100Builder(instance) + } + override fun getBuilderAfterFoonbar(instance: MutableMap): RequiredWithEscapedCharactersMap100100Builder { + return RequiredWithEscapedCharactersMap100100Builder(instance) + } + override fun getBuilderAfterFoorbar(instance: MutableMap): RequiredWithEscapedCharactersMap110000Builder { + return RequiredWithEscapedCharactersMap110000Builder(instance) + } + } + + class RequiredWithEscapedCharactersMap110101Builder(private val instance: MutableMap): SetterForFootbar, SetterForFoonbar, SetterForFoorbar, SetterForFoobar1 { + override fun getInstance(): MutableMap { + return instance + } + override fun getBuilderAfterFootbar(instance: MutableMap): RequiredWithEscapedCharactersMap010101Builder { + return RequiredWithEscapedCharactersMap010101Builder(instance) + } + override fun getBuilderAfterFoonbar(instance: MutableMap): RequiredWithEscapedCharactersMap100101Builder { + return RequiredWithEscapedCharactersMap100101Builder(instance) + } + override fun getBuilderAfterFoorbar(instance: MutableMap): RequiredWithEscapedCharactersMap110001Builder { + return RequiredWithEscapedCharactersMap110001Builder(instance) + } + override fun getBuilderAfterFoobar1(instance: MutableMap): RequiredWithEscapedCharactersMap110100Builder { + return RequiredWithEscapedCharactersMap110100Builder(instance) + } + } + + class RequiredWithEscapedCharactersMap110110Builder(private val instance: MutableMap): SetterForFootbar, SetterForFoonbar, SetterForFoorbar, SetterForFoobar { + override fun getInstance(): MutableMap { + return instance + } + override fun getBuilderAfterFootbar(instance: MutableMap): RequiredWithEscapedCharactersMap010110Builder { + return RequiredWithEscapedCharactersMap010110Builder(instance) + } + override fun getBuilderAfterFoonbar(instance: MutableMap): RequiredWithEscapedCharactersMap100110Builder { + return RequiredWithEscapedCharactersMap100110Builder(instance) + } + override fun getBuilderAfterFoorbar(instance: MutableMap): RequiredWithEscapedCharactersMap110010Builder { + return RequiredWithEscapedCharactersMap110010Builder(instance) + } + override fun getBuilderAfterFoobar(instance: MutableMap): RequiredWithEscapedCharactersMap110100Builder { + return RequiredWithEscapedCharactersMap110100Builder(instance) + } + } + + class RequiredWithEscapedCharactersMap110111Builder(private val instance: MutableMap): SetterForFootbar, SetterForFoonbar, SetterForFoorbar, SetterForFoobar, SetterForFoobar1 { + override fun getInstance(): MutableMap { + return instance + } + override fun getBuilderAfterFootbar(instance: MutableMap): RequiredWithEscapedCharactersMap010111Builder { + return RequiredWithEscapedCharactersMap010111Builder(instance) + } + override fun getBuilderAfterFoonbar(instance: MutableMap): RequiredWithEscapedCharactersMap100111Builder { + return RequiredWithEscapedCharactersMap100111Builder(instance) + } + override fun getBuilderAfterFoorbar(instance: MutableMap): RequiredWithEscapedCharactersMap110011Builder { + return RequiredWithEscapedCharactersMap110011Builder(instance) + } + override fun getBuilderAfterFoobar(instance: MutableMap): RequiredWithEscapedCharactersMap110101Builder { + return RequiredWithEscapedCharactersMap110101Builder(instance) + } + override fun getBuilderAfterFoobar1(instance: MutableMap): RequiredWithEscapedCharactersMap110110Builder { + return RequiredWithEscapedCharactersMap110110Builder(instance) + } + } + + class RequiredWithEscapedCharactersMap111000Builder(private val instance: MutableMap): SetterForFootbar, SetterForFoonbar, SetterForFoou000Cbar { + override fun getInstance(): MutableMap { + return instance + } + override fun getBuilderAfterFootbar(instance: MutableMap): RequiredWithEscapedCharactersMap011000Builder { + return RequiredWithEscapedCharactersMap011000Builder(instance) + } + override fun getBuilderAfterFoonbar(instance: MutableMap): RequiredWithEscapedCharactersMap101000Builder { + return RequiredWithEscapedCharactersMap101000Builder(instance) + } + override fun getBuilderAfterFoou000Cbar(instance: MutableMap): RequiredWithEscapedCharactersMap110000Builder { + return RequiredWithEscapedCharactersMap110000Builder(instance) + } + } + + class RequiredWithEscapedCharactersMap111001Builder(private val instance: MutableMap): SetterForFootbar, SetterForFoonbar, SetterForFoou000Cbar, SetterForFoobar1 { + override fun getInstance(): MutableMap { + return instance + } + override fun getBuilderAfterFootbar(instance: MutableMap): RequiredWithEscapedCharactersMap011001Builder { + return RequiredWithEscapedCharactersMap011001Builder(instance) + } + override fun getBuilderAfterFoonbar(instance: MutableMap): RequiredWithEscapedCharactersMap101001Builder { + return RequiredWithEscapedCharactersMap101001Builder(instance) + } + override fun getBuilderAfterFoou000Cbar(instance: MutableMap): RequiredWithEscapedCharactersMap110001Builder { + return RequiredWithEscapedCharactersMap110001Builder(instance) + } + override fun getBuilderAfterFoobar1(instance: MutableMap): RequiredWithEscapedCharactersMap111000Builder { + return RequiredWithEscapedCharactersMap111000Builder(instance) + } + } + + class RequiredWithEscapedCharactersMap111010Builder(private val instance: MutableMap): SetterForFootbar, SetterForFoonbar, SetterForFoou000Cbar, SetterForFoobar { + override fun getInstance(): MutableMap { + return instance + } + override fun getBuilderAfterFootbar(instance: MutableMap): RequiredWithEscapedCharactersMap011010Builder { + return RequiredWithEscapedCharactersMap011010Builder(instance) + } + override fun getBuilderAfterFoonbar(instance: MutableMap): RequiredWithEscapedCharactersMap101010Builder { + return RequiredWithEscapedCharactersMap101010Builder(instance) + } + override fun getBuilderAfterFoou000Cbar(instance: MutableMap): RequiredWithEscapedCharactersMap110010Builder { + return RequiredWithEscapedCharactersMap110010Builder(instance) + } + override fun getBuilderAfterFoobar(instance: MutableMap): RequiredWithEscapedCharactersMap111000Builder { + return RequiredWithEscapedCharactersMap111000Builder(instance) + } + } + + class RequiredWithEscapedCharactersMap111011Builder(private val instance: MutableMap): SetterForFootbar, SetterForFoonbar, SetterForFoou000Cbar, SetterForFoobar, SetterForFoobar1 { + override fun getInstance(): MutableMap { + return instance + } + override fun getBuilderAfterFootbar(instance: MutableMap): RequiredWithEscapedCharactersMap011011Builder { + return RequiredWithEscapedCharactersMap011011Builder(instance) + } + override fun getBuilderAfterFoonbar(instance: MutableMap): RequiredWithEscapedCharactersMap101011Builder { + return RequiredWithEscapedCharactersMap101011Builder(instance) + } + override fun getBuilderAfterFoou000Cbar(instance: MutableMap): RequiredWithEscapedCharactersMap110011Builder { + return RequiredWithEscapedCharactersMap110011Builder(instance) + } + override fun getBuilderAfterFoobar(instance: MutableMap): RequiredWithEscapedCharactersMap111001Builder { + return RequiredWithEscapedCharactersMap111001Builder(instance) + } + override fun getBuilderAfterFoobar1(instance: MutableMap): RequiredWithEscapedCharactersMap111010Builder { + return RequiredWithEscapedCharactersMap111010Builder(instance) + } + } + + class RequiredWithEscapedCharactersMap111100Builder(private val instance: MutableMap): SetterForFootbar, SetterForFoonbar, SetterForFoou000Cbar, SetterForFoorbar { + override fun getInstance(): MutableMap { + return instance + } + override fun getBuilderAfterFootbar(instance: MutableMap): RequiredWithEscapedCharactersMap011100Builder { + return RequiredWithEscapedCharactersMap011100Builder(instance) + } + override fun getBuilderAfterFoonbar(instance: MutableMap): RequiredWithEscapedCharactersMap101100Builder { + return RequiredWithEscapedCharactersMap101100Builder(instance) + } + override fun getBuilderAfterFoou000Cbar(instance: MutableMap): RequiredWithEscapedCharactersMap110100Builder { + return RequiredWithEscapedCharactersMap110100Builder(instance) + } + override fun getBuilderAfterFoorbar(instance: MutableMap): RequiredWithEscapedCharactersMap111000Builder { + return RequiredWithEscapedCharactersMap111000Builder(instance) + } + } + + class RequiredWithEscapedCharactersMap111101Builder(private val instance: MutableMap): SetterForFootbar, SetterForFoonbar, SetterForFoou000Cbar, SetterForFoorbar, SetterForFoobar1 { + override fun getInstance(): MutableMap { + return instance + } + override fun getBuilderAfterFootbar(instance: MutableMap): RequiredWithEscapedCharactersMap011101Builder { + return RequiredWithEscapedCharactersMap011101Builder(instance) + } + override fun getBuilderAfterFoonbar(instance: MutableMap): RequiredWithEscapedCharactersMap101101Builder { + return RequiredWithEscapedCharactersMap101101Builder(instance) + } + override fun getBuilderAfterFoou000Cbar(instance: MutableMap): RequiredWithEscapedCharactersMap110101Builder { + return RequiredWithEscapedCharactersMap110101Builder(instance) + } + override fun getBuilderAfterFoorbar(instance: MutableMap): RequiredWithEscapedCharactersMap111001Builder { + return RequiredWithEscapedCharactersMap111001Builder(instance) + } + override fun getBuilderAfterFoobar1(instance: MutableMap): RequiredWithEscapedCharactersMap111100Builder { + return RequiredWithEscapedCharactersMap111100Builder(instance) + } + } + + class RequiredWithEscapedCharactersMap111110Builder(private val instance: MutableMap): SetterForFootbar, SetterForFoonbar, SetterForFoou000Cbar, SetterForFoorbar, SetterForFoobar { + override fun getInstance(): MutableMap { + return instance + } + override fun getBuilderAfterFootbar(instance: MutableMap): RequiredWithEscapedCharactersMap011110Builder { + return RequiredWithEscapedCharactersMap011110Builder(instance) + } + override fun getBuilderAfterFoonbar(instance: MutableMap): RequiredWithEscapedCharactersMap101110Builder { + return RequiredWithEscapedCharactersMap101110Builder(instance) + } + override fun getBuilderAfterFoou000Cbar(instance: MutableMap): RequiredWithEscapedCharactersMap110110Builder { + return RequiredWithEscapedCharactersMap110110Builder(instance) + } + override fun getBuilderAfterFoorbar(instance: MutableMap): RequiredWithEscapedCharactersMap111010Builder { + return RequiredWithEscapedCharactersMap111010Builder(instance) + } + override fun getBuilderAfterFoobar(instance: MutableMap): RequiredWithEscapedCharactersMap111100Builder { + return RequiredWithEscapedCharactersMap111100Builder(instance) + } + } + + class RequiredWithEscapedCharactersMapBuilder: SetterForFootbar, SetterForFoonbar, SetterForFoou000Cbar, SetterForFoorbar, SetterForFoobar, SetterForFoobar1 { + private val instance: MutableMap + init { + this.instance = LinkedHashMap() + } + override fun getInstance(): MutableMap { + return instance + } + override fun getBuilderAfterFootbar(instance: MutableMap): RequiredWithEscapedCharactersMap011111Builder { + return RequiredWithEscapedCharactersMap011111Builder(instance) + } + override fun getBuilderAfterFoonbar(instance: MutableMap): RequiredWithEscapedCharactersMap101111Builder { + return RequiredWithEscapedCharactersMap101111Builder(instance) + } + override fun getBuilderAfterFoou000Cbar(instance: MutableMap): RequiredWithEscapedCharactersMap110111Builder { + return RequiredWithEscapedCharactersMap110111Builder(instance) + } + override fun getBuilderAfterFoorbar(instance: MutableMap): RequiredWithEscapedCharactersMap111011Builder { + return RequiredWithEscapedCharactersMap111011Builder(instance) + } + override fun getBuilderAfterFoobar(instance: MutableMap): RequiredWithEscapedCharactersMap111101Builder { + return RequiredWithEscapedCharactersMap111101Builder(instance) + } + override fun getBuilderAfterFoobar1(instance: MutableMap): RequiredWithEscapedCharactersMap111110Builder { + return RequiredWithEscapedCharactersMap111110Builder(instance) + } + } + + + sealed interface RequiredWithEscapedCharacters1Boxed { + fun getData(): Any? + } + + data class RequiredWithEscapedCharacters1BoxedVoid(val data: Nothing?) : RequiredWithEscapedCharacters1Boxed { + override fun getData(): Any? { + return data + } + } + + data class RequiredWithEscapedCharacters1BoxedBoolean(val data: Boolean): RequiredWithEscapedCharacters1Boxed { + override fun getData(): Any? { + return data + } + } + + data class RequiredWithEscapedCharacters1BoxedNumber(val data: Number) : RequiredWithEscapedCharacters1Boxed { + override fun getData(): Any? { + return data + } + } + + data class RequiredWithEscapedCharacters1BoxedString(val data: String) : RequiredWithEscapedCharacters1Boxed { + override fun getData(): Any? { + return data + } + } + + data class RequiredWithEscapedCharacters1BoxedList(val data: FrozenList) : RequiredWithEscapedCharacters1Boxed { + override fun getData(): Any? { + return data + } + } + + data class RequiredWithEscapedCharacters1BoxedMap(val data: RequiredWithEscapedCharactersMap) : RequiredWithEscapedCharacters1Boxed { + override fun getData(): Any? { + return data + } + } + + + class RequiredWithEscapedCharacters1 private constructor(): JsonSchema( + JsonSchemaInfo() + .required(setOf( + "foo\tbar", + "foo\nbar", + "foo\u000Cbar", + "foo\rbar", + "foo\"bar", + "foo\\bar" + )) + ), NullSchemaValidator, BooleanSchemaValidator, NumberSchemaValidator, StringSchemaValidator, ListSchemaValidator, RequiredWithEscapedCharacters1BoxedList>, MapSchemaValidator { + /* + NOTE: This class is auto generated by OpenAPI JSON Schema Generator. + Ref: https://github.com/openapi-json-schema-tools/openapi-json-schema-generator + + Do not edit the class manually. + */ + + companion object { + @Volatile + private var instance: RequiredWithEscapedCharacters1? = null + + fun getInstance() = + instance ?: synchronized(this) { + instance ?: RequiredWithEscapedCharacters1().also { instance = it } + } + } + + @Throws(ValidationException::class) + override fun validate(arg: Nothing?, configuration: SchemaConfiguration?): Nothing? { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validatedPathToSchemas = PathToSchemasMap() + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, LinkedHashSet()) + getPathToSchemas(this, castArg, validationMetadata, pathSet) + return castArg + } + + @Throws(ValidationException::class) + override fun validate(arg: Boolean, configuration: SchemaConfiguration?): Boolean { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validatedPathToSchemas = PathToSchemasMap() + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, LinkedHashSet()) + getPathToSchemas(this, castArg, validationMetadata, pathSet) + return castArg + } + + @Throws(ValidationException::class) + override fun validate(arg: Number, configuration: SchemaConfiguration?): Number { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validatedPathToSchemas = PathToSchemasMap() + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, LinkedHashSet()) + getPathToSchemas(this, castArg, validationMetadata, pathSet) + return castArg + } + + @Throws(ValidationException::class) + fun validate(arg: Int, configuration: SchemaConfiguration?): Int { + return validate(arg as Number, configuration) as Int + } + + @Throws(ValidationException::class) + fun validate(arg: Long, configuration: SchemaConfiguration?): Long { + return validate(arg as Number, configuration) as Long + } + + @Throws(ValidationException::class) + fun validate(arg: Float, configuration: SchemaConfiguration?): Float { + return validate(arg as Number, configuration) as Float + } + + @Throws(ValidationException::class) + fun validate(arg: Double, configuration: SchemaConfiguration?): Double { + return validate(arg as Number, configuration) as Double + } + + @Throws(ValidationException::class) + override fun validate(arg: String, configuration: SchemaConfiguration?): String { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validatedPathToSchemas = PathToSchemasMap() + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, LinkedHashSet()) + getPathToSchemas(this, castArg, validationMetadata, pathSet) + return castArg + } + + @Throws(ValidationException::class) + fun validate(arg: LocalDate, configuration: SchemaConfiguration?): String { + return validate(arg.toString(), configuration) + } + + @Throws(ValidationException::class) + fun validate(arg: ZonedDateTime, configuration: SchemaConfiguration?): String { + return validate(arg.toString(), configuration) + } + + @Throws(ValidationException::class) + fun validate(arg: UUID, configuration: SchemaConfiguration?): String { + return validate(arg.toString(), configuration) + } + + override fun getNewInstance(arg: List<*>, pathToItem: List, pathToSchemas: PathToSchemasMap): FrozenList { + val items: MutableList = ArrayList() + var i: Int = 0 + for (item: Any? in arg) { + val itemPathToItem = pathToItem + i + val schemas: LinkedHashMap, Nothing?>? = pathToSchemas.get(itemPathToItem) + if (schemas == null) { + throw RuntimeException("Validation result is invalid, schemas must exist for a pathToItem") + } + val itemSchema: JsonSchema<*> = schemas.entries.iterator().next().key + val itemInstance: Any? = itemSchema.getNewInstance(item, itemPathToItem, pathToSchemas) + items.add(itemInstance) + i += 1 + } + val newInstanceItems: FrozenList = FrozenList(items) + return newInstanceItems + } + + @Throws(ValidationException::class) + override fun validate(arg: List<*>, configuration: SchemaConfiguration?): FrozenList { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, PathToSchemasMap(), LinkedHashSet()) + val pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet) + return getNewInstance(castArg, validationMetadata.pathToItem, pathToSchemasMap) + } + + override fun getNewInstance(arg: Map<*, *>, pathToItem: List, pathToSchemas: PathToSchemasMap): RequiredWithEscapedCharactersMap { + val properties: LinkedHashMap = LinkedHashMap() + for((propertyName, value) in arg) { + if (!(propertyName is String)) { + throw RuntimeException("Invalid non-string key value") + } + val propertyPathToItem: List = pathToItem + propertyName + val schemas: LinkedHashMap, Nothing?>? = pathToSchemas.get(propertyPathToItem) + if (schemas == null) { + throw RuntimeException("Validation result is invalid, schemas must exist for a pathToItem") + } + val propertySchema: JsonSchema<*> = schemas.entries.iterator().next().key + val propertyInstance: Any? = propertySchema.getNewInstance(value, propertyPathToItem, pathToSchemas) + properties[propertyName] = propertyInstance + } + val castProperties: FrozenMap = FrozenMap(properties) + return RequiredWithEscapedCharactersMap(castProperties) + } + + @Throws(ValidationException::class) + override fun validate(arg: Map<*, *>, configuration: SchemaConfiguration?): RequiredWithEscapedCharactersMap { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validatedPathToSchemas = PathToSchemasMap() + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, LinkedHashSet()) + val pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet) + return getNewInstance(castArg, validationMetadata.pathToItem, pathToSchemasMap) + } + + @Throws(ValidationException::class) + override fun validate(arg: Any?, configuration: SchemaConfiguration?): Any? { + if (arg == null) { + return validate(null, configuration) + } else if (arg is Boolean) { + return validate(arg, configuration) + } else if (arg is Number) { + return validate(arg, configuration) + } else if (arg is String) { + return validate(arg, configuration) + } else if (arg is List<*>) { + return validate(arg, configuration) + } else if (arg is Map<*, *>) { + return validate(arg, configuration) + } + throw ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema") + } + override fun getNewInstance(arg: Any?, pathToItem: List, pathToSchemas: PathToSchemasMap): Any? { + if (arg == null) { + return getNewInstance( null, pathToItem, pathToSchemas) + } else if (arg is Boolean) { + return getNewInstance(arg, pathToItem, pathToSchemas) + } else if (arg is Number) { + return getNewInstance(arg, pathToItem, pathToSchemas) + } else if (arg is String) { + return getNewInstance(arg, pathToItem, pathToSchemas) + } else if (arg is List<*>) { + return getNewInstance(arg, pathToItem, pathToSchemas) + } else if (arg is Map<*, *>) { + return getNewInstance(arg, pathToItem, pathToSchemas) + } + throw RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema") + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: Nothing?, configuration: SchemaConfiguration?): RequiredWithEscapedCharacters1BoxedVoid { + return RequiredWithEscapedCharacters1BoxedVoid(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: Boolean, configuration: SchemaConfiguration?): RequiredWithEscapedCharacters1BoxedBoolean { + return RequiredWithEscapedCharacters1BoxedBoolean(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: Number, configuration: SchemaConfiguration?): RequiredWithEscapedCharacters1BoxedNumber { + return RequiredWithEscapedCharacters1BoxedNumber(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: String, configuration: SchemaConfiguration?): RequiredWithEscapedCharacters1BoxedString { + return RequiredWithEscapedCharacters1BoxedString(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: List<*>, configuration: SchemaConfiguration?): RequiredWithEscapedCharacters1BoxedList { + return RequiredWithEscapedCharacters1BoxedList(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: Map<*, *>, configuration: SchemaConfiguration?): RequiredWithEscapedCharacters1BoxedMap { + return RequiredWithEscapedCharacters1BoxedMap(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: Any?, configuration: SchemaConfiguration?): RequiredWithEscapedCharacters1Boxed { + if (arg == null) { + return validateAndBox(null, configuration) + } else if (arg is Boolean) { + return validateAndBox(arg, configuration) + } else if (arg is String) { + return validateAndBox(arg, configuration) + } else if (arg is Number) { + return validateAndBox(arg, configuration) + } else if (arg is List<*>) { + return validateAndBox(arg, configuration) + } else if (arg is Map<*, *>) { + return validateAndBox(arg, configuration) + } + throw ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema") + } + } +} diff --git a/samples/client/3_0_3_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/schemas/SimpleEnumValidation.kt b/samples/client/3_0_3_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/schemas/SimpleEnumValidation.kt new file mode 100644 index 00000000000..6a6008202bc --- /dev/null +++ b/samples/client/3_0_3_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/schemas/SimpleEnumValidation.kt @@ -0,0 +1,183 @@ +package org.openapijsonschematools.client.components.schemas +import java.math.BigDecimal +import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags +import org.openapijsonschematools.client.configurations.SchemaConfiguration +import org.openapijsonschematools.client.exceptions.ValidationException +import org.openapijsonschematools.client.schemas.validation.DoubleEnumValidator +import org.openapijsonschematools.client.schemas.validation.DoubleValueMethod +import org.openapijsonschematools.client.schemas.validation.FloatEnumValidator +import org.openapijsonschematools.client.schemas.validation.FloatValueMethod +import org.openapijsonschematools.client.schemas.validation.IntegerEnumValidator +import org.openapijsonschematools.client.schemas.validation.IntegerValueMethod +import org.openapijsonschematools.client.schemas.validation.JsonSchema +import org.openapijsonschematools.client.schemas.validation.JsonSchemaInfo +import org.openapijsonschematools.client.schemas.validation.LongEnumValidator +import org.openapijsonschematools.client.schemas.validation.LongValueMethod +import org.openapijsonschematools.client.schemas.validation.NumberSchemaValidator +import org.openapijsonschematools.client.schemas.validation.PathToSchemasMap +import org.openapijsonschematools.client.schemas.validation.ValidationMetadata + +class SimpleEnumValidation { + // nest classes so all schemas and input/output classes can be public + + enum class IntegerSimpleEnumValidationEnums(private val value: Int): IntegerValueMethod { + POSITIVE_1(1), + POSITIVE_2(2), + POSITIVE_3(3); + + override fun value(): Int { + return this.value + } + } + + enum class LongSimpleEnumValidationEnums(private val value: Long): LongValueMethod { + POSITIVE_1(1L), + POSITIVE_2(2L), + POSITIVE_3(3L); + + override fun value(): Long { + return this.value + } + } + + enum class FloatSimpleEnumValidationEnums(private val value: Float): FloatValueMethod { + POSITIVE_1(1.0f), + POSITIVE_2(2.0f), + POSITIVE_3(3.0f); + + override fun value(): Float { + return this.value + } + } + + enum class DoubleSimpleEnumValidationEnums(private val value: Double): DoubleValueMethod { + POSITIVE_1(1.0), + POSITIVE_2(2.0), + POSITIVE_3(3.0); + + override fun value(): Double { + return this.value + } + } + + + sealed interface SimpleEnumValidation1Boxed { + fun getData(): Any? + } + + data class SimpleEnumValidation1BoxedNumber(val data: Number) : SimpleEnumValidation1Boxed { + override fun getData(): Any? { + return data + } + } + + + + class SimpleEnumValidation1 private constructor(): JsonSchema( + JsonSchemaInfo() + .type(setOf( + Int::class.java, + Long::class.java, + Float::class.java, + Double::class.java + )) + .enumValues(setOf( + BigDecimal("1"), + BigDecimal("2"), + BigDecimal("3") + )) + ), IntegerEnumValidator, LongEnumValidator, FloatEnumValidator, DoubleEnumValidator, NumberSchemaValidator { + /* + NOTE: This class is auto generated by OpenAPI JSON Schema Generator. + Ref: https://github.com/openapi-json-schema-tools/openapi-json-schema-generator + + Do not edit the class manually. + */ + + companion object { + @Volatile + private var instance: SimpleEnumValidation1? = null + + fun getInstance() = + instance ?: synchronized(this) { + instance ?: SimpleEnumValidation1().also { instance = it } + } + } + + @Throws(ValidationException::class) + override fun validate(arg: Number, configuration: SchemaConfiguration?): Number { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, PathToSchemasMap(), LinkedHashSet()) + val pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet) + return castArg + } + + @Throws(ValidationException::class) + fun validate(arg: Int, configuration: SchemaConfiguration?): Int { + return validate(arg as Number, configuration) as Int + } + + @Throws(ValidationException::class) + fun validate(arg: Long, configuration: SchemaConfiguration?): Long { + return validate(arg as Number, configuration) as Long + } + + @Throws(ValidationException::class) + fun validate(arg: Float, configuration: SchemaConfiguration?): Float { + return validate(arg as Number, configuration) as Float + } + + @Throws(ValidationException::class) + fun validate(arg: Double, configuration: SchemaConfiguration?): Double { + return validate(arg as Number, configuration) as Double + } + + @Throws(ValidationException::class) + override fun validate(arg: IntegerSimpleEnumValidationEnums, configuration: SchemaConfiguration?): Int { + return validate(arg.value() as Number, configuration) as Int + } + + @Throws(ValidationException::class) + override fun validate(arg: LongSimpleEnumValidationEnums, configuration: SchemaConfiguration?): Long { + return validate(arg.value() as Number, configuration) as Long + } + + @Throws(ValidationException::class) + override fun validate(arg: FloatSimpleEnumValidationEnums, configuration: SchemaConfiguration?): Float { + return validate(arg.value() as Number, configuration) as Float + } + + @Throws(ValidationException::class) + override fun validate(arg: DoubleSimpleEnumValidationEnums, configuration: SchemaConfiguration?): Double { + return validate(arg.value() as Number, configuration) as Double + } + + @Throws(ValidationException::class) + override fun validate(arg: Any?, configuration: SchemaConfiguration?): Any? { + if (arg is Number) { + return validate(arg, configuration) + } + throw ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema") + } + override fun getNewInstance(arg: Any?, pathToItem: List, pathToSchemas: PathToSchemasMap): Any? { + if (arg is Number) { + return getNewInstance(arg, pathToItem, pathToSchemas) + } + throw RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema") + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: Number, configuration: SchemaConfiguration?): SimpleEnumValidation1BoxedNumber { + return SimpleEnumValidation1BoxedNumber(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: Any?, configuration: SchemaConfiguration?): SimpleEnumValidation1Boxed { + if (arg is Number) { + return validateAndBox(arg, configuration) + } + throw ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema") + } + } +} diff --git a/samples/client/3_0_3_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/schemas/StringTypeMatchesStrings.kt b/samples/client/3_0_3_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/schemas/StringTypeMatchesStrings.kt new file mode 100644 index 00000000000..029fbdd5f39 --- /dev/null +++ b/samples/client/3_0_3_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/schemas/StringTypeMatchesStrings.kt @@ -0,0 +1,20 @@ +package org.openapijsonschematools.client.components.schemas +import org.openapijsonschematools.client.schemas.StringJsonSchema + +class StringTypeMatchesStrings: StringJsonSchema() { + // nest classes so all schemas and input/output classes can be public + + + class StringTypeMatchesStrings1 : StringJsonSchema.StringJsonSchema1() { + companion object { + @Volatile + private var instance: StringTypeMatchesStrings1? = null + + fun getInstance() = + instance ?: synchronized(this) { + instance ?: StringTypeMatchesStrings1().also { instance = it } + } + } + } + +} diff --git a/samples/client/3_0_3_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/schemas/TheDefaultKeywordDoesNotDoAnythingIfThePropertyIsMissing.kt b/samples/client/3_0_3_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/schemas/TheDefaultKeywordDoesNotDoAnythingIfThePropertyIsMissing.kt new file mode 100644 index 00000000000..299d099fc0b --- /dev/null +++ b/samples/client/3_0_3_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/schemas/TheDefaultKeywordDoesNotDoAnythingIfThePropertyIsMissing.kt @@ -0,0 +1,291 @@ +package org.openapijsonschematools.client.components.schemas +import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags +import org.openapijsonschematools.client.configurations.SchemaConfiguration +import org.openapijsonschematools.client.exceptions.InvalidAdditionalPropertyException +import org.openapijsonschematools.client.exceptions.UnsetPropertyException +import org.openapijsonschematools.client.exceptions.ValidationException +import org.openapijsonschematools.client.schemas.GenericBuilder +import org.openapijsonschematools.client.schemas.UnsetAddPropsSetter +import org.openapijsonschematools.client.schemas.validation.DefaultValueMethod +import org.openapijsonschematools.client.schemas.validation.FrozenMap +import org.openapijsonschematools.client.schemas.validation.JsonSchema +import org.openapijsonschematools.client.schemas.validation.JsonSchemaInfo +import org.openapijsonschematools.client.schemas.validation.MapSchemaValidator +import org.openapijsonschematools.client.schemas.validation.NumberSchemaValidator +import org.openapijsonschematools.client.schemas.validation.PathToSchemasMap +import org.openapijsonschematools.client.schemas.validation.ValidationMetadata + +class TheDefaultKeywordDoesNotDoAnythingIfThePropertyIsMissing { + // nest classes so all schemas and input/output classes can be public + + + sealed interface AlphaBoxed { + fun getData(): Any? + } + + data class AlphaBoxedNumber(val data: Number) : AlphaBoxed { + override fun getData(): Any? { + return data + } + } + + + + class Alpha private constructor(): JsonSchema( + JsonSchemaInfo() + .type(setOf( + Int::class.java, + Long::class.java, + Float::class.java, + Double::class.java + )) + .maximum(3) + .defaultValue(5.0) + ), NumberSchemaValidator { + + companion object { + @Volatile + private var instance: Alpha? = null + + fun getInstance() = + instance ?: synchronized(this) { + instance ?: Alpha().also { instance = it } + } + } + + @Throws(ValidationException::class) + override fun validate(arg: Number, configuration: SchemaConfiguration?): Number { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, PathToSchemasMap(), LinkedHashSet()) + val pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet) + return castArg + } + + @Throws(ValidationException::class) + fun validate(arg: Int, configuration: SchemaConfiguration?): Int { + return validate(arg as Number, configuration) as Int + } + + @Throws(ValidationException::class) + fun validate(arg: Long, configuration: SchemaConfiguration?): Long { + return validate(arg as Number, configuration) as Long + } + + @Throws(ValidationException::class) + fun validate(arg: Float, configuration: SchemaConfiguration?): Float { + return validate(arg as Number, configuration) as Float + } + + @Throws(ValidationException::class) + fun validate(arg: Double, configuration: SchemaConfiguration?): Double { + return validate(arg as Number, configuration) as Double + } + + @Throws(ValidationException::class) + override fun validate(arg: Any?, configuration: SchemaConfiguration?): Any? { + if (arg is Number) { + return validate(arg, configuration) + } + throw ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema") + } + override fun getNewInstance(arg: Any?, pathToItem: List, pathToSchemas: PathToSchemasMap): Any? { + if (arg is Number) { + return getNewInstance(arg, pathToItem, pathToSchemas) + } + throw RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema") + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: Number, configuration: SchemaConfiguration?): AlphaBoxedNumber { + return AlphaBoxedNumber(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: Any?, configuration: SchemaConfiguration?): AlphaBoxed { + if (arg is Number) { + return validateAndBox(arg, configuration) + } + throw ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema") + } + } + + class TheDefaultKeywordDoesNotDoAnythingIfThePropertyIsMissingMap(m: FrozenMap) : FrozenMap(m) { + companion object { + val requiredKeys: Set = setOf() + val optionalKeys: Set = setOf( + "alpha" + ) + @Throws(ValidationException::class) + fun of(arg: Map, configuration: SchemaConfiguration): TheDefaultKeywordDoesNotDoAnythingIfThePropertyIsMissingMap { + return TheDefaultKeywordDoesNotDoAnythingIfThePropertyIsMissing1.getInstance().validate(arg, configuration) + } + } + + @Throws(UnsetPropertyException::class) + fun alpha(): Number { + val key = "alpha" + throwIfKeyNotPresent(key) + val value: Any? = get(key) + if (!(value is Number)) { + throw RuntimeException("Invalid value stored for alpha") + } + return value + } + + @Throws(UnsetPropertyException::class, InvalidAdditionalPropertyException::class) + fun getAdditionalProperty(name: String): Any? { + throwIfKeyKnown(name, requiredKeys, optionalKeys) + throwIfKeyNotPresent(name) + return get(name) + } + } + + interface SetterForAlpha { + fun getInstance(): MutableMap + fun getBuilderAfterAlpha(instance: MutableMap): T + + fun alpha(value: Int): T { + val instance = getInstance() + instance["alpha"] = value + return getBuilderAfterAlpha(instance) + } + + fun alpha(value: Float): T { + val instance = getInstance() + instance["alpha"] = value + return getBuilderAfterAlpha(instance) + } + + fun alpha(value: Long): T { + val instance = getInstance() + instance["alpha"] = value + return getBuilderAfterAlpha(instance) + } + + fun alpha(value: Double): T { + val instance = getInstance() + instance["alpha"] = value + return getBuilderAfterAlpha(instance) + } + } + + class TheDefaultKeywordDoesNotDoAnythingIfThePropertyIsMissingMapBuilder: UnsetAddPropsSetter, GenericBuilder>, SetterForAlpha { + private val knownKeys: Set = setOf( + "alpha" + ) + override fun getKnownKeys(): Set { + return knownKeys + } + private val instance: MutableMap + init { + this.instance = LinkedHashMap() + } + override fun build(): Map { + return instance + } + override fun getInstance(): MutableMap { + return instance + } + override fun getBuilderAfterAlpha(instance: MutableMap): TheDefaultKeywordDoesNotDoAnythingIfThePropertyIsMissingMapBuilder { + return this + } + override fun getBuilderAfterAdditionalProperty(instance: MutableMap): TheDefaultKeywordDoesNotDoAnythingIfThePropertyIsMissingMapBuilder { + return this + } + } + + + sealed interface TheDefaultKeywordDoesNotDoAnythingIfThePropertyIsMissing1Boxed { + fun getData(): Any? + } + + data class TheDefaultKeywordDoesNotDoAnythingIfThePropertyIsMissing1BoxedMap(val data: TheDefaultKeywordDoesNotDoAnythingIfThePropertyIsMissingMap) : TheDefaultKeywordDoesNotDoAnythingIfThePropertyIsMissing1Boxed { + override fun getData(): Any? { + return data + } + } + + + class TheDefaultKeywordDoesNotDoAnythingIfThePropertyIsMissing1 private constructor(): JsonSchema( + JsonSchemaInfo() + .type(setOf(Map::class.java)) + .properties(mapOf( + "alpha" to Alpha::class.java + )) + ), MapSchemaValidator { + /* + NOTE: This class is auto generated by OpenAPI JSON Schema Generator. + Ref: https://github.com/openapi-json-schema-tools/openapi-json-schema-generator + + Do not edit the class manually. + */ + + companion object { + @Volatile + private var instance: TheDefaultKeywordDoesNotDoAnythingIfThePropertyIsMissing1? = null + + fun getInstance() = + instance ?: synchronized(this) { + instance ?: TheDefaultKeywordDoesNotDoAnythingIfThePropertyIsMissing1().also { instance = it } + } + } + + override fun getNewInstance(arg: Map<*, *>, pathToItem: List, pathToSchemas: PathToSchemasMap): TheDefaultKeywordDoesNotDoAnythingIfThePropertyIsMissingMap { + val properties: LinkedHashMap = LinkedHashMap() + for((entryKey, value) in arg) { + if (!(entryKey is String)) { + throw RuntimeException("Invalid non-string key value") + } + val propertyPathToItem: List = pathToItem + entryKey + val schemas: LinkedHashMap, Nothing?>? = pathToSchemas.get(propertyPathToItem) + if (schemas == null) { + throw RuntimeException("Validation result is invalid, schemas must exist for a pathToItem") + } + val propertySchema: JsonSchema<*> = schemas.entries.iterator().next().key + val propertyInstance: Any? = propertySchema.getNewInstance(value, propertyPathToItem, pathToSchemas) + properties[entryKey] = propertyInstance + } + val castProperties: FrozenMap = FrozenMap(properties) + return TheDefaultKeywordDoesNotDoAnythingIfThePropertyIsMissingMap(castProperties) + } + + @Throws(ValidationException::class) + override fun validate(arg: Map<*, *>, configuration: SchemaConfiguration?): TheDefaultKeywordDoesNotDoAnythingIfThePropertyIsMissingMap { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, PathToSchemasMap(), LinkedHashSet()) + val pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet) + return getNewInstance(castArg, validationMetadata.pathToItem, pathToSchemasMap) + } + + + @Throws(ValidationException::class) + override fun validate(arg: Any?, configuration: SchemaConfiguration?): Any? { + if (arg is Map<*, *>) { + return validate(arg, configuration) + } + throw ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema") + } + override fun getNewInstance(arg: Any?, pathToItem: List, pathToSchemas: PathToSchemasMap): Any? { + if (arg is Map<*, *>) { + return getNewInstance(arg, pathToItem, pathToSchemas) + } + throw RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema") + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: Map<*, *>, configuration: SchemaConfiguration?): TheDefaultKeywordDoesNotDoAnythingIfThePropertyIsMissing1BoxedMap { + return TheDefaultKeywordDoesNotDoAnythingIfThePropertyIsMissing1BoxedMap(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: Any?, configuration: SchemaConfiguration?): TheDefaultKeywordDoesNotDoAnythingIfThePropertyIsMissing1Boxed { + if (arg is Map<*, *>) { + return validateAndBox(arg, configuration) + } + throw ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema") + } + } + +} diff --git a/samples/client/3_0_3_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/schemas/UniqueitemsFalseValidation.kt b/samples/client/3_0_3_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/schemas/UniqueitemsFalseValidation.kt new file mode 100644 index 00000000000..525bbb087f7 --- /dev/null +++ b/samples/client/3_0_3_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/schemas/UniqueitemsFalseValidation.kt @@ -0,0 +1,308 @@ +package org.openapijsonschematools.client.components.schemas +import java.time.LocalDate +import java.time.ZonedDateTime +import java.util.UUID +import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags +import org.openapijsonschematools.client.configurations.SchemaConfiguration +import org.openapijsonschematools.client.exceptions.InvalidAdditionalPropertyException +import org.openapijsonschematools.client.exceptions.UnsetPropertyException +import org.openapijsonschematools.client.exceptions.ValidationException +import org.openapijsonschematools.client.schemas.UnsetAddPropsSetter +import org.openapijsonschematools.client.schemas.validation.BooleanSchemaValidator +import org.openapijsonschematools.client.schemas.validation.FrozenList +import org.openapijsonschematools.client.schemas.validation.FrozenMap +import org.openapijsonschematools.client.schemas.validation.JsonSchema +import org.openapijsonschematools.client.schemas.validation.JsonSchemaInfo +import org.openapijsonschematools.client.schemas.validation.ListSchemaValidator +import org.openapijsonschematools.client.schemas.validation.MapSchemaValidator +import org.openapijsonschematools.client.schemas.validation.NullSchemaValidator +import org.openapijsonschematools.client.schemas.validation.NumberSchemaValidator +import org.openapijsonschematools.client.schemas.validation.PathToSchemasMap +import org.openapijsonschematools.client.schemas.validation.StringSchemaValidator +import org.openapijsonschematools.client.schemas.validation.ValidationMetadata + +class UniqueitemsFalseValidation { + // nest classes so all schemas and input/output classes can be public + + + sealed interface UniqueitemsFalseValidation1Boxed { + fun getData(): Any? + } + + data class UniqueitemsFalseValidation1BoxedVoid(val data: Nothing?) : UniqueitemsFalseValidation1Boxed { + override fun getData(): Any? { + return data + } + } + + data class UniqueitemsFalseValidation1BoxedBoolean(val data: Boolean): UniqueitemsFalseValidation1Boxed { + override fun getData(): Any? { + return data + } + } + + data class UniqueitemsFalseValidation1BoxedNumber(val data: Number) : UniqueitemsFalseValidation1Boxed { + override fun getData(): Any? { + return data + } + } + + data class UniqueitemsFalseValidation1BoxedString(val data: String) : UniqueitemsFalseValidation1Boxed { + override fun getData(): Any? { + return data + } + } + + data class UniqueitemsFalseValidation1BoxedList(val data: FrozenList) : UniqueitemsFalseValidation1Boxed { + override fun getData(): Any? { + return data + } + } + + data class UniqueitemsFalseValidation1BoxedMap(val data: FrozenMap) : UniqueitemsFalseValidation1Boxed { + override fun getData(): Any? { + return data + } + } + + + class UniqueitemsFalseValidation1 private constructor(): JsonSchema( + JsonSchemaInfo() + .uniqueItems(false) + ), NullSchemaValidator, BooleanSchemaValidator, NumberSchemaValidator, StringSchemaValidator, ListSchemaValidator, UniqueitemsFalseValidation1BoxedList>, MapSchemaValidator, UniqueitemsFalseValidation1BoxedMap> { + /* + NOTE: This class is auto generated by OpenAPI JSON Schema Generator. + Ref: https://github.com/openapi-json-schema-tools/openapi-json-schema-generator + + Do not edit the class manually. + */ + + companion object { + @Volatile + private var instance: UniqueitemsFalseValidation1? = null + + fun getInstance() = + instance ?: synchronized(this) { + instance ?: UniqueitemsFalseValidation1().also { instance = it } + } + } + + @Throws(ValidationException::class) + override fun validate(arg: Nothing?, configuration: SchemaConfiguration?): Nothing? { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validatedPathToSchemas = PathToSchemasMap() + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, LinkedHashSet()) + getPathToSchemas(this, castArg, validationMetadata, pathSet) + return castArg + } + + @Throws(ValidationException::class) + override fun validate(arg: Boolean, configuration: SchemaConfiguration?): Boolean { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validatedPathToSchemas = PathToSchemasMap() + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, LinkedHashSet()) + getPathToSchemas(this, castArg, validationMetadata, pathSet) + return castArg + } + + @Throws(ValidationException::class) + override fun validate(arg: Number, configuration: SchemaConfiguration?): Number { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validatedPathToSchemas = PathToSchemasMap() + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, LinkedHashSet()) + getPathToSchemas(this, castArg, validationMetadata, pathSet) + return castArg + } + + @Throws(ValidationException::class) + fun validate(arg: Int, configuration: SchemaConfiguration?): Int { + return validate(arg as Number, configuration) as Int + } + + @Throws(ValidationException::class) + fun validate(arg: Long, configuration: SchemaConfiguration?): Long { + return validate(arg as Number, configuration) as Long + } + + @Throws(ValidationException::class) + fun validate(arg: Float, configuration: SchemaConfiguration?): Float { + return validate(arg as Number, configuration) as Float + } + + @Throws(ValidationException::class) + fun validate(arg: Double, configuration: SchemaConfiguration?): Double { + return validate(arg as Number, configuration) as Double + } + + @Throws(ValidationException::class) + override fun validate(arg: String, configuration: SchemaConfiguration?): String { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validatedPathToSchemas = PathToSchemasMap() + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, LinkedHashSet()) + getPathToSchemas(this, castArg, validationMetadata, pathSet) + return castArg + } + + @Throws(ValidationException::class) + fun validate(arg: LocalDate, configuration: SchemaConfiguration?): String { + return validate(arg.toString(), configuration) + } + + @Throws(ValidationException::class) + fun validate(arg: ZonedDateTime, configuration: SchemaConfiguration?): String { + return validate(arg.toString(), configuration) + } + + @Throws(ValidationException::class) + fun validate(arg: UUID, configuration: SchemaConfiguration?): String { + return validate(arg.toString(), configuration) + } + + override fun getNewInstance(arg: List<*>, pathToItem: List, pathToSchemas: PathToSchemasMap): FrozenList { + val items: MutableList = ArrayList() + var i: Int = 0 + for (item: Any? in arg) { + val itemPathToItem = pathToItem + i + val schemas: LinkedHashMap, Nothing?>? = pathToSchemas.get(itemPathToItem) + if (schemas == null) { + throw RuntimeException("Validation result is invalid, schemas must exist for a pathToItem") + } + val itemSchema: JsonSchema<*> = schemas.entries.iterator().next().key + val itemInstance: Any? = itemSchema.getNewInstance(item, itemPathToItem, pathToSchemas) + items.add(itemInstance) + i += 1 + } + val newInstanceItems: FrozenList = FrozenList(items) + return newInstanceItems + } + + @Throws(ValidationException::class) + override fun validate(arg: List<*>, configuration: SchemaConfiguration?): FrozenList { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, PathToSchemasMap(), LinkedHashSet()) + val pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet) + return getNewInstance(castArg, validationMetadata.pathToItem, pathToSchemasMap) + } + + override fun getNewInstance(arg: Map<*, *>, pathToItem: List, pathToSchemas: PathToSchemasMap): FrozenMap { + val properties: LinkedHashMap = LinkedHashMap() + for((propertyName, value) in arg) { + if (!(propertyName is String)) { + throw RuntimeException("Invalid non-string key value") + } + val propertyPathToItem: List = pathToItem + propertyName + val schemas: LinkedHashMap, Nothing?>? = pathToSchemas.get(propertyPathToItem) + if (schemas == null) { + throw RuntimeException("Validation result is invalid, schemas must exist for a pathToItem") + } + val propertySchema: JsonSchema<*> = schemas.entries.iterator().next().key + val propertyInstance: Any? = propertySchema.getNewInstance(value, propertyPathToItem, pathToSchemas) + properties[propertyName] = propertyInstance + } + val castProperties: FrozenMap = FrozenMap(properties) + return castProperties + } + + @Throws(ValidationException::class) + override fun validate(arg: Map<*, *>, configuration: SchemaConfiguration?): FrozenMap { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validatedPathToSchemas = PathToSchemasMap() + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, LinkedHashSet()) + val pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet) + return getNewInstance(castArg, validationMetadata.pathToItem, pathToSchemasMap) + } + + @Throws(ValidationException::class) + override fun validate(arg: Any?, configuration: SchemaConfiguration?): Any? { + if (arg == null) { + return validate(null, configuration) + } else if (arg is Boolean) { + return validate(arg, configuration) + } else if (arg is Number) { + return validate(arg, configuration) + } else if (arg is String) { + return validate(arg, configuration) + } else if (arg is List<*>) { + return validate(arg, configuration) + } else if (arg is Map<*, *>) { + return validate(arg, configuration) + } + throw ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema") + } + override fun getNewInstance(arg: Any?, pathToItem: List, pathToSchemas: PathToSchemasMap): Any? { + if (arg == null) { + return getNewInstance( null, pathToItem, pathToSchemas) + } else if (arg is Boolean) { + return getNewInstance(arg, pathToItem, pathToSchemas) + } else if (arg is Number) { + return getNewInstance(arg, pathToItem, pathToSchemas) + } else if (arg is String) { + return getNewInstance(arg, pathToItem, pathToSchemas) + } else if (arg is List<*>) { + return getNewInstance(arg, pathToItem, pathToSchemas) + } else if (arg is Map<*, *>) { + return getNewInstance(arg, pathToItem, pathToSchemas) + } + throw RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema") + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: Nothing?, configuration: SchemaConfiguration?): UniqueitemsFalseValidation1BoxedVoid { + return UniqueitemsFalseValidation1BoxedVoid(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: Boolean, configuration: SchemaConfiguration?): UniqueitemsFalseValidation1BoxedBoolean { + return UniqueitemsFalseValidation1BoxedBoolean(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: Number, configuration: SchemaConfiguration?): UniqueitemsFalseValidation1BoxedNumber { + return UniqueitemsFalseValidation1BoxedNumber(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: String, configuration: SchemaConfiguration?): UniqueitemsFalseValidation1BoxedString { + return UniqueitemsFalseValidation1BoxedString(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: List<*>, configuration: SchemaConfiguration?): UniqueitemsFalseValidation1BoxedList { + return UniqueitemsFalseValidation1BoxedList(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: Map<*, *>, configuration: SchemaConfiguration?): UniqueitemsFalseValidation1BoxedMap { + return UniqueitemsFalseValidation1BoxedMap(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: Any?, configuration: SchemaConfiguration?): UniqueitemsFalseValidation1Boxed { + if (arg == null) { + return validateAndBox(null, configuration) + } else if (arg is Boolean) { + return validateAndBox(arg, configuration) + } else if (arg is String) { + return validateAndBox(arg, configuration) + } else if (arg is Number) { + return validateAndBox(arg, configuration) + } else if (arg is List<*>) { + return validateAndBox(arg, configuration) + } else if (arg is Map<*, *>) { + return validateAndBox(arg, configuration) + } + throw ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema") + } + } +} diff --git a/samples/client/3_0_3_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/schemas/UniqueitemsValidation.kt b/samples/client/3_0_3_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/schemas/UniqueitemsValidation.kt new file mode 100644 index 00000000000..181ba3a42b5 --- /dev/null +++ b/samples/client/3_0_3_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/schemas/UniqueitemsValidation.kt @@ -0,0 +1,308 @@ +package org.openapijsonschematools.client.components.schemas +import java.time.LocalDate +import java.time.ZonedDateTime +import java.util.UUID +import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags +import org.openapijsonschematools.client.configurations.SchemaConfiguration +import org.openapijsonschematools.client.exceptions.InvalidAdditionalPropertyException +import org.openapijsonschematools.client.exceptions.UnsetPropertyException +import org.openapijsonschematools.client.exceptions.ValidationException +import org.openapijsonschematools.client.schemas.UnsetAddPropsSetter +import org.openapijsonschematools.client.schemas.validation.BooleanSchemaValidator +import org.openapijsonschematools.client.schemas.validation.FrozenList +import org.openapijsonschematools.client.schemas.validation.FrozenMap +import org.openapijsonschematools.client.schemas.validation.JsonSchema +import org.openapijsonschematools.client.schemas.validation.JsonSchemaInfo +import org.openapijsonschematools.client.schemas.validation.ListSchemaValidator +import org.openapijsonschematools.client.schemas.validation.MapSchemaValidator +import org.openapijsonschematools.client.schemas.validation.NullSchemaValidator +import org.openapijsonschematools.client.schemas.validation.NumberSchemaValidator +import org.openapijsonschematools.client.schemas.validation.PathToSchemasMap +import org.openapijsonschematools.client.schemas.validation.StringSchemaValidator +import org.openapijsonschematools.client.schemas.validation.ValidationMetadata + +class UniqueitemsValidation { + // nest classes so all schemas and input/output classes can be public + + + sealed interface UniqueitemsValidation1Boxed { + fun getData(): Any? + } + + data class UniqueitemsValidation1BoxedVoid(val data: Nothing?) : UniqueitemsValidation1Boxed { + override fun getData(): Any? { + return data + } + } + + data class UniqueitemsValidation1BoxedBoolean(val data: Boolean): UniqueitemsValidation1Boxed { + override fun getData(): Any? { + return data + } + } + + data class UniqueitemsValidation1BoxedNumber(val data: Number) : UniqueitemsValidation1Boxed { + override fun getData(): Any? { + return data + } + } + + data class UniqueitemsValidation1BoxedString(val data: String) : UniqueitemsValidation1Boxed { + override fun getData(): Any? { + return data + } + } + + data class UniqueitemsValidation1BoxedList(val data: FrozenList) : UniqueitemsValidation1Boxed { + override fun getData(): Any? { + return data + } + } + + data class UniqueitemsValidation1BoxedMap(val data: FrozenMap) : UniqueitemsValidation1Boxed { + override fun getData(): Any? { + return data + } + } + + + class UniqueitemsValidation1 private constructor(): JsonSchema( + JsonSchemaInfo() + .uniqueItems(true) + ), NullSchemaValidator, BooleanSchemaValidator, NumberSchemaValidator, StringSchemaValidator, ListSchemaValidator, UniqueitemsValidation1BoxedList>, MapSchemaValidator, UniqueitemsValidation1BoxedMap> { + /* + NOTE: This class is auto generated by OpenAPI JSON Schema Generator. + Ref: https://github.com/openapi-json-schema-tools/openapi-json-schema-generator + + Do not edit the class manually. + */ + + companion object { + @Volatile + private var instance: UniqueitemsValidation1? = null + + fun getInstance() = + instance ?: synchronized(this) { + instance ?: UniqueitemsValidation1().also { instance = it } + } + } + + @Throws(ValidationException::class) + override fun validate(arg: Nothing?, configuration: SchemaConfiguration?): Nothing? { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validatedPathToSchemas = PathToSchemasMap() + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, LinkedHashSet()) + getPathToSchemas(this, castArg, validationMetadata, pathSet) + return castArg + } + + @Throws(ValidationException::class) + override fun validate(arg: Boolean, configuration: SchemaConfiguration?): Boolean { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validatedPathToSchemas = PathToSchemasMap() + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, LinkedHashSet()) + getPathToSchemas(this, castArg, validationMetadata, pathSet) + return castArg + } + + @Throws(ValidationException::class) + override fun validate(arg: Number, configuration: SchemaConfiguration?): Number { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validatedPathToSchemas = PathToSchemasMap() + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, LinkedHashSet()) + getPathToSchemas(this, castArg, validationMetadata, pathSet) + return castArg + } + + @Throws(ValidationException::class) + fun validate(arg: Int, configuration: SchemaConfiguration?): Int { + return validate(arg as Number, configuration) as Int + } + + @Throws(ValidationException::class) + fun validate(arg: Long, configuration: SchemaConfiguration?): Long { + return validate(arg as Number, configuration) as Long + } + + @Throws(ValidationException::class) + fun validate(arg: Float, configuration: SchemaConfiguration?): Float { + return validate(arg as Number, configuration) as Float + } + + @Throws(ValidationException::class) + fun validate(arg: Double, configuration: SchemaConfiguration?): Double { + return validate(arg as Number, configuration) as Double + } + + @Throws(ValidationException::class) + override fun validate(arg: String, configuration: SchemaConfiguration?): String { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validatedPathToSchemas = PathToSchemasMap() + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, LinkedHashSet()) + getPathToSchemas(this, castArg, validationMetadata, pathSet) + return castArg + } + + @Throws(ValidationException::class) + fun validate(arg: LocalDate, configuration: SchemaConfiguration?): String { + return validate(arg.toString(), configuration) + } + + @Throws(ValidationException::class) + fun validate(arg: ZonedDateTime, configuration: SchemaConfiguration?): String { + return validate(arg.toString(), configuration) + } + + @Throws(ValidationException::class) + fun validate(arg: UUID, configuration: SchemaConfiguration?): String { + return validate(arg.toString(), configuration) + } + + override fun getNewInstance(arg: List<*>, pathToItem: List, pathToSchemas: PathToSchemasMap): FrozenList { + val items: MutableList = ArrayList() + var i: Int = 0 + for (item: Any? in arg) { + val itemPathToItem = pathToItem + i + val schemas: LinkedHashMap, Nothing?>? = pathToSchemas.get(itemPathToItem) + if (schemas == null) { + throw RuntimeException("Validation result is invalid, schemas must exist for a pathToItem") + } + val itemSchema: JsonSchema<*> = schemas.entries.iterator().next().key + val itemInstance: Any? = itemSchema.getNewInstance(item, itemPathToItem, pathToSchemas) + items.add(itemInstance) + i += 1 + } + val newInstanceItems: FrozenList = FrozenList(items) + return newInstanceItems + } + + @Throws(ValidationException::class) + override fun validate(arg: List<*>, configuration: SchemaConfiguration?): FrozenList { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, PathToSchemasMap(), LinkedHashSet()) + val pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet) + return getNewInstance(castArg, validationMetadata.pathToItem, pathToSchemasMap) + } + + override fun getNewInstance(arg: Map<*, *>, pathToItem: List, pathToSchemas: PathToSchemasMap): FrozenMap { + val properties: LinkedHashMap = LinkedHashMap() + for((propertyName, value) in arg) { + if (!(propertyName is String)) { + throw RuntimeException("Invalid non-string key value") + } + val propertyPathToItem: List = pathToItem + propertyName + val schemas: LinkedHashMap, Nothing?>? = pathToSchemas.get(propertyPathToItem) + if (schemas == null) { + throw RuntimeException("Validation result is invalid, schemas must exist for a pathToItem") + } + val propertySchema: JsonSchema<*> = schemas.entries.iterator().next().key + val propertyInstance: Any? = propertySchema.getNewInstance(value, propertyPathToItem, pathToSchemas) + properties[propertyName] = propertyInstance + } + val castProperties: FrozenMap = FrozenMap(properties) + return castProperties + } + + @Throws(ValidationException::class) + override fun validate(arg: Map<*, *>, configuration: SchemaConfiguration?): FrozenMap { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validatedPathToSchemas = PathToSchemasMap() + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, LinkedHashSet()) + val pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet) + return getNewInstance(castArg, validationMetadata.pathToItem, pathToSchemasMap) + } + + @Throws(ValidationException::class) + override fun validate(arg: Any?, configuration: SchemaConfiguration?): Any? { + if (arg == null) { + return validate(null, configuration) + } else if (arg is Boolean) { + return validate(arg, configuration) + } else if (arg is Number) { + return validate(arg, configuration) + } else if (arg is String) { + return validate(arg, configuration) + } else if (arg is List<*>) { + return validate(arg, configuration) + } else if (arg is Map<*, *>) { + return validate(arg, configuration) + } + throw ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema") + } + override fun getNewInstance(arg: Any?, pathToItem: List, pathToSchemas: PathToSchemasMap): Any? { + if (arg == null) { + return getNewInstance( null, pathToItem, pathToSchemas) + } else if (arg is Boolean) { + return getNewInstance(arg, pathToItem, pathToSchemas) + } else if (arg is Number) { + return getNewInstance(arg, pathToItem, pathToSchemas) + } else if (arg is String) { + return getNewInstance(arg, pathToItem, pathToSchemas) + } else if (arg is List<*>) { + return getNewInstance(arg, pathToItem, pathToSchemas) + } else if (arg is Map<*, *>) { + return getNewInstance(arg, pathToItem, pathToSchemas) + } + throw RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema") + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: Nothing?, configuration: SchemaConfiguration?): UniqueitemsValidation1BoxedVoid { + return UniqueitemsValidation1BoxedVoid(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: Boolean, configuration: SchemaConfiguration?): UniqueitemsValidation1BoxedBoolean { + return UniqueitemsValidation1BoxedBoolean(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: Number, configuration: SchemaConfiguration?): UniqueitemsValidation1BoxedNumber { + return UniqueitemsValidation1BoxedNumber(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: String, configuration: SchemaConfiguration?): UniqueitemsValidation1BoxedString { + return UniqueitemsValidation1BoxedString(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: List<*>, configuration: SchemaConfiguration?): UniqueitemsValidation1BoxedList { + return UniqueitemsValidation1BoxedList(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: Map<*, *>, configuration: SchemaConfiguration?): UniqueitemsValidation1BoxedMap { + return UniqueitemsValidation1BoxedMap(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: Any?, configuration: SchemaConfiguration?): UniqueitemsValidation1Boxed { + if (arg == null) { + return validateAndBox(null, configuration) + } else if (arg is Boolean) { + return validateAndBox(arg, configuration) + } else if (arg is String) { + return validateAndBox(arg, configuration) + } else if (arg is Number) { + return validateAndBox(arg, configuration) + } else if (arg is List<*>) { + return validateAndBox(arg, configuration) + } else if (arg is Map<*, *>) { + return validateAndBox(arg, configuration) + } + throw ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema") + } + } +} diff --git a/samples/client/3_0_3_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/schemas/UriFormat.kt b/samples/client/3_0_3_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/schemas/UriFormat.kt new file mode 100644 index 00000000000..46a606e7c80 --- /dev/null +++ b/samples/client/3_0_3_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/schemas/UriFormat.kt @@ -0,0 +1,308 @@ +package org.openapijsonschematools.client.components.schemas +import java.time.LocalDate +import java.time.ZonedDateTime +import java.util.UUID +import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags +import org.openapijsonschematools.client.configurations.SchemaConfiguration +import org.openapijsonschematools.client.exceptions.InvalidAdditionalPropertyException +import org.openapijsonschematools.client.exceptions.UnsetPropertyException +import org.openapijsonschematools.client.exceptions.ValidationException +import org.openapijsonschematools.client.schemas.UnsetAddPropsSetter +import org.openapijsonschematools.client.schemas.validation.BooleanSchemaValidator +import org.openapijsonschematools.client.schemas.validation.FrozenList +import org.openapijsonschematools.client.schemas.validation.FrozenMap +import org.openapijsonschematools.client.schemas.validation.JsonSchema +import org.openapijsonschematools.client.schemas.validation.JsonSchemaInfo +import org.openapijsonschematools.client.schemas.validation.ListSchemaValidator +import org.openapijsonschematools.client.schemas.validation.MapSchemaValidator +import org.openapijsonschematools.client.schemas.validation.NullSchemaValidator +import org.openapijsonschematools.client.schemas.validation.NumberSchemaValidator +import org.openapijsonschematools.client.schemas.validation.PathToSchemasMap +import org.openapijsonschematools.client.schemas.validation.StringSchemaValidator +import org.openapijsonschematools.client.schemas.validation.ValidationMetadata + +class UriFormat { + // nest classes so all schemas and input/output classes can be public + + + sealed interface UriFormat1Boxed { + fun getData(): Any? + } + + data class UriFormat1BoxedVoid(val data: Nothing?) : UriFormat1Boxed { + override fun getData(): Any? { + return data + } + } + + data class UriFormat1BoxedBoolean(val data: Boolean): UriFormat1Boxed { + override fun getData(): Any? { + return data + } + } + + data class UriFormat1BoxedNumber(val data: Number) : UriFormat1Boxed { + override fun getData(): Any? { + return data + } + } + + data class UriFormat1BoxedString(val data: String) : UriFormat1Boxed { + override fun getData(): Any? { + return data + } + } + + data class UriFormat1BoxedList(val data: FrozenList) : UriFormat1Boxed { + override fun getData(): Any? { + return data + } + } + + data class UriFormat1BoxedMap(val data: FrozenMap) : UriFormat1Boxed { + override fun getData(): Any? { + return data + } + } + + + class UriFormat1 private constructor(): JsonSchema( + JsonSchemaInfo() + .format("uri") + ), NullSchemaValidator, BooleanSchemaValidator, NumberSchemaValidator, StringSchemaValidator, ListSchemaValidator, UriFormat1BoxedList>, MapSchemaValidator, UriFormat1BoxedMap> { + /* + NOTE: This class is auto generated by OpenAPI JSON Schema Generator. + Ref: https://github.com/openapi-json-schema-tools/openapi-json-schema-generator + + Do not edit the class manually. + */ + + companion object { + @Volatile + private var instance: UriFormat1? = null + + fun getInstance() = + instance ?: synchronized(this) { + instance ?: UriFormat1().also { instance = it } + } + } + + @Throws(ValidationException::class) + override fun validate(arg: Nothing?, configuration: SchemaConfiguration?): Nothing? { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validatedPathToSchemas = PathToSchemasMap() + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, LinkedHashSet()) + getPathToSchemas(this, castArg, validationMetadata, pathSet) + return castArg + } + + @Throws(ValidationException::class) + override fun validate(arg: Boolean, configuration: SchemaConfiguration?): Boolean { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validatedPathToSchemas = PathToSchemasMap() + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, LinkedHashSet()) + getPathToSchemas(this, castArg, validationMetadata, pathSet) + return castArg + } + + @Throws(ValidationException::class) + override fun validate(arg: Number, configuration: SchemaConfiguration?): Number { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validatedPathToSchemas = PathToSchemasMap() + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, LinkedHashSet()) + getPathToSchemas(this, castArg, validationMetadata, pathSet) + return castArg + } + + @Throws(ValidationException::class) + fun validate(arg: Int, configuration: SchemaConfiguration?): Int { + return validate(arg as Number, configuration) as Int + } + + @Throws(ValidationException::class) + fun validate(arg: Long, configuration: SchemaConfiguration?): Long { + return validate(arg as Number, configuration) as Long + } + + @Throws(ValidationException::class) + fun validate(arg: Float, configuration: SchemaConfiguration?): Float { + return validate(arg as Number, configuration) as Float + } + + @Throws(ValidationException::class) + fun validate(arg: Double, configuration: SchemaConfiguration?): Double { + return validate(arg as Number, configuration) as Double + } + + @Throws(ValidationException::class) + override fun validate(arg: String, configuration: SchemaConfiguration?): String { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validatedPathToSchemas = PathToSchemasMap() + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, LinkedHashSet()) + getPathToSchemas(this, castArg, validationMetadata, pathSet) + return castArg + } + + @Throws(ValidationException::class) + fun validate(arg: LocalDate, configuration: SchemaConfiguration?): String { + return validate(arg.toString(), configuration) + } + + @Throws(ValidationException::class) + fun validate(arg: ZonedDateTime, configuration: SchemaConfiguration?): String { + return validate(arg.toString(), configuration) + } + + @Throws(ValidationException::class) + fun validate(arg: UUID, configuration: SchemaConfiguration?): String { + return validate(arg.toString(), configuration) + } + + override fun getNewInstance(arg: List<*>, pathToItem: List, pathToSchemas: PathToSchemasMap): FrozenList { + val items: MutableList = ArrayList() + var i: Int = 0 + for (item: Any? in arg) { + val itemPathToItem = pathToItem + i + val schemas: LinkedHashMap, Nothing?>? = pathToSchemas.get(itemPathToItem) + if (schemas == null) { + throw RuntimeException("Validation result is invalid, schemas must exist for a pathToItem") + } + val itemSchema: JsonSchema<*> = schemas.entries.iterator().next().key + val itemInstance: Any? = itemSchema.getNewInstance(item, itemPathToItem, pathToSchemas) + items.add(itemInstance) + i += 1 + } + val newInstanceItems: FrozenList = FrozenList(items) + return newInstanceItems + } + + @Throws(ValidationException::class) + override fun validate(arg: List<*>, configuration: SchemaConfiguration?): FrozenList { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, PathToSchemasMap(), LinkedHashSet()) + val pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet) + return getNewInstance(castArg, validationMetadata.pathToItem, pathToSchemasMap) + } + + override fun getNewInstance(arg: Map<*, *>, pathToItem: List, pathToSchemas: PathToSchemasMap): FrozenMap { + val properties: LinkedHashMap = LinkedHashMap() + for((propertyName, value) in arg) { + if (!(propertyName is String)) { + throw RuntimeException("Invalid non-string key value") + } + val propertyPathToItem: List = pathToItem + propertyName + val schemas: LinkedHashMap, Nothing?>? = pathToSchemas.get(propertyPathToItem) + if (schemas == null) { + throw RuntimeException("Validation result is invalid, schemas must exist for a pathToItem") + } + val propertySchema: JsonSchema<*> = schemas.entries.iterator().next().key + val propertyInstance: Any? = propertySchema.getNewInstance(value, propertyPathToItem, pathToSchemas) + properties[propertyName] = propertyInstance + } + val castProperties: FrozenMap = FrozenMap(properties) + return castProperties + } + + @Throws(ValidationException::class) + override fun validate(arg: Map<*, *>, configuration: SchemaConfiguration?): FrozenMap { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validatedPathToSchemas = PathToSchemasMap() + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, LinkedHashSet()) + val pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet) + return getNewInstance(castArg, validationMetadata.pathToItem, pathToSchemasMap) + } + + @Throws(ValidationException::class) + override fun validate(arg: Any?, configuration: SchemaConfiguration?): Any? { + if (arg == null) { + return validate(null, configuration) + } else if (arg is Boolean) { + return validate(arg, configuration) + } else if (arg is Number) { + return validate(arg, configuration) + } else if (arg is String) { + return validate(arg, configuration) + } else if (arg is List<*>) { + return validate(arg, configuration) + } else if (arg is Map<*, *>) { + return validate(arg, configuration) + } + throw ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema") + } + override fun getNewInstance(arg: Any?, pathToItem: List, pathToSchemas: PathToSchemasMap): Any? { + if (arg == null) { + return getNewInstance( null, pathToItem, pathToSchemas) + } else if (arg is Boolean) { + return getNewInstance(arg, pathToItem, pathToSchemas) + } else if (arg is Number) { + return getNewInstance(arg, pathToItem, pathToSchemas) + } else if (arg is String) { + return getNewInstance(arg, pathToItem, pathToSchemas) + } else if (arg is List<*>) { + return getNewInstance(arg, pathToItem, pathToSchemas) + } else if (arg is Map<*, *>) { + return getNewInstance(arg, pathToItem, pathToSchemas) + } + throw RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema") + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: Nothing?, configuration: SchemaConfiguration?): UriFormat1BoxedVoid { + return UriFormat1BoxedVoid(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: Boolean, configuration: SchemaConfiguration?): UriFormat1BoxedBoolean { + return UriFormat1BoxedBoolean(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: Number, configuration: SchemaConfiguration?): UriFormat1BoxedNumber { + return UriFormat1BoxedNumber(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: String, configuration: SchemaConfiguration?): UriFormat1BoxedString { + return UriFormat1BoxedString(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: List<*>, configuration: SchemaConfiguration?): UriFormat1BoxedList { + return UriFormat1BoxedList(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: Map<*, *>, configuration: SchemaConfiguration?): UriFormat1BoxedMap { + return UriFormat1BoxedMap(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: Any?, configuration: SchemaConfiguration?): UriFormat1Boxed { + if (arg == null) { + return validateAndBox(null, configuration) + } else if (arg is Boolean) { + return validateAndBox(arg, configuration) + } else if (arg is String) { + return validateAndBox(arg, configuration) + } else if (arg is Number) { + return validateAndBox(arg, configuration) + } else if (arg is List<*>) { + return validateAndBox(arg, configuration) + } else if (arg is Map<*, *>) { + return validateAndBox(arg, configuration) + } + throw ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema") + } + } +} diff --git a/samples/client/3_0_3_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/schemas/UriReferenceFormat.kt b/samples/client/3_0_3_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/schemas/UriReferenceFormat.kt new file mode 100644 index 00000000000..7bdbafd17e5 --- /dev/null +++ b/samples/client/3_0_3_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/schemas/UriReferenceFormat.kt @@ -0,0 +1,308 @@ +package org.openapijsonschematools.client.components.schemas +import java.time.LocalDate +import java.time.ZonedDateTime +import java.util.UUID +import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags +import org.openapijsonschematools.client.configurations.SchemaConfiguration +import org.openapijsonschematools.client.exceptions.InvalidAdditionalPropertyException +import org.openapijsonschematools.client.exceptions.UnsetPropertyException +import org.openapijsonschematools.client.exceptions.ValidationException +import org.openapijsonschematools.client.schemas.UnsetAddPropsSetter +import org.openapijsonschematools.client.schemas.validation.BooleanSchemaValidator +import org.openapijsonschematools.client.schemas.validation.FrozenList +import org.openapijsonschematools.client.schemas.validation.FrozenMap +import org.openapijsonschematools.client.schemas.validation.JsonSchema +import org.openapijsonschematools.client.schemas.validation.JsonSchemaInfo +import org.openapijsonschematools.client.schemas.validation.ListSchemaValidator +import org.openapijsonschematools.client.schemas.validation.MapSchemaValidator +import org.openapijsonschematools.client.schemas.validation.NullSchemaValidator +import org.openapijsonschematools.client.schemas.validation.NumberSchemaValidator +import org.openapijsonschematools.client.schemas.validation.PathToSchemasMap +import org.openapijsonschematools.client.schemas.validation.StringSchemaValidator +import org.openapijsonschematools.client.schemas.validation.ValidationMetadata + +class UriReferenceFormat { + // nest classes so all schemas and input/output classes can be public + + + sealed interface UriReferenceFormat1Boxed { + fun getData(): Any? + } + + data class UriReferenceFormat1BoxedVoid(val data: Nothing?) : UriReferenceFormat1Boxed { + override fun getData(): Any? { + return data + } + } + + data class UriReferenceFormat1BoxedBoolean(val data: Boolean): UriReferenceFormat1Boxed { + override fun getData(): Any? { + return data + } + } + + data class UriReferenceFormat1BoxedNumber(val data: Number) : UriReferenceFormat1Boxed { + override fun getData(): Any? { + return data + } + } + + data class UriReferenceFormat1BoxedString(val data: String) : UriReferenceFormat1Boxed { + override fun getData(): Any? { + return data + } + } + + data class UriReferenceFormat1BoxedList(val data: FrozenList) : UriReferenceFormat1Boxed { + override fun getData(): Any? { + return data + } + } + + data class UriReferenceFormat1BoxedMap(val data: FrozenMap) : UriReferenceFormat1Boxed { + override fun getData(): Any? { + return data + } + } + + + class UriReferenceFormat1 private constructor(): JsonSchema( + JsonSchemaInfo() + .format("uri-reference") + ), NullSchemaValidator, BooleanSchemaValidator, NumberSchemaValidator, StringSchemaValidator, ListSchemaValidator, UriReferenceFormat1BoxedList>, MapSchemaValidator, UriReferenceFormat1BoxedMap> { + /* + NOTE: This class is auto generated by OpenAPI JSON Schema Generator. + Ref: https://github.com/openapi-json-schema-tools/openapi-json-schema-generator + + Do not edit the class manually. + */ + + companion object { + @Volatile + private var instance: UriReferenceFormat1? = null + + fun getInstance() = + instance ?: synchronized(this) { + instance ?: UriReferenceFormat1().also { instance = it } + } + } + + @Throws(ValidationException::class) + override fun validate(arg: Nothing?, configuration: SchemaConfiguration?): Nothing? { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validatedPathToSchemas = PathToSchemasMap() + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, LinkedHashSet()) + getPathToSchemas(this, castArg, validationMetadata, pathSet) + return castArg + } + + @Throws(ValidationException::class) + override fun validate(arg: Boolean, configuration: SchemaConfiguration?): Boolean { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validatedPathToSchemas = PathToSchemasMap() + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, LinkedHashSet()) + getPathToSchemas(this, castArg, validationMetadata, pathSet) + return castArg + } + + @Throws(ValidationException::class) + override fun validate(arg: Number, configuration: SchemaConfiguration?): Number { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validatedPathToSchemas = PathToSchemasMap() + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, LinkedHashSet()) + getPathToSchemas(this, castArg, validationMetadata, pathSet) + return castArg + } + + @Throws(ValidationException::class) + fun validate(arg: Int, configuration: SchemaConfiguration?): Int { + return validate(arg as Number, configuration) as Int + } + + @Throws(ValidationException::class) + fun validate(arg: Long, configuration: SchemaConfiguration?): Long { + return validate(arg as Number, configuration) as Long + } + + @Throws(ValidationException::class) + fun validate(arg: Float, configuration: SchemaConfiguration?): Float { + return validate(arg as Number, configuration) as Float + } + + @Throws(ValidationException::class) + fun validate(arg: Double, configuration: SchemaConfiguration?): Double { + return validate(arg as Number, configuration) as Double + } + + @Throws(ValidationException::class) + override fun validate(arg: String, configuration: SchemaConfiguration?): String { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validatedPathToSchemas = PathToSchemasMap() + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, LinkedHashSet()) + getPathToSchemas(this, castArg, validationMetadata, pathSet) + return castArg + } + + @Throws(ValidationException::class) + fun validate(arg: LocalDate, configuration: SchemaConfiguration?): String { + return validate(arg.toString(), configuration) + } + + @Throws(ValidationException::class) + fun validate(arg: ZonedDateTime, configuration: SchemaConfiguration?): String { + return validate(arg.toString(), configuration) + } + + @Throws(ValidationException::class) + fun validate(arg: UUID, configuration: SchemaConfiguration?): String { + return validate(arg.toString(), configuration) + } + + override fun getNewInstance(arg: List<*>, pathToItem: List, pathToSchemas: PathToSchemasMap): FrozenList { + val items: MutableList = ArrayList() + var i: Int = 0 + for (item: Any? in arg) { + val itemPathToItem = pathToItem + i + val schemas: LinkedHashMap, Nothing?>? = pathToSchemas.get(itemPathToItem) + if (schemas == null) { + throw RuntimeException("Validation result is invalid, schemas must exist for a pathToItem") + } + val itemSchema: JsonSchema<*> = schemas.entries.iterator().next().key + val itemInstance: Any? = itemSchema.getNewInstance(item, itemPathToItem, pathToSchemas) + items.add(itemInstance) + i += 1 + } + val newInstanceItems: FrozenList = FrozenList(items) + return newInstanceItems + } + + @Throws(ValidationException::class) + override fun validate(arg: List<*>, configuration: SchemaConfiguration?): FrozenList { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, PathToSchemasMap(), LinkedHashSet()) + val pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet) + return getNewInstance(castArg, validationMetadata.pathToItem, pathToSchemasMap) + } + + override fun getNewInstance(arg: Map<*, *>, pathToItem: List, pathToSchemas: PathToSchemasMap): FrozenMap { + val properties: LinkedHashMap = LinkedHashMap() + for((propertyName, value) in arg) { + if (!(propertyName is String)) { + throw RuntimeException("Invalid non-string key value") + } + val propertyPathToItem: List = pathToItem + propertyName + val schemas: LinkedHashMap, Nothing?>? = pathToSchemas.get(propertyPathToItem) + if (schemas == null) { + throw RuntimeException("Validation result is invalid, schemas must exist for a pathToItem") + } + val propertySchema: JsonSchema<*> = schemas.entries.iterator().next().key + val propertyInstance: Any? = propertySchema.getNewInstance(value, propertyPathToItem, pathToSchemas) + properties[propertyName] = propertyInstance + } + val castProperties: FrozenMap = FrozenMap(properties) + return castProperties + } + + @Throws(ValidationException::class) + override fun validate(arg: Map<*, *>, configuration: SchemaConfiguration?): FrozenMap { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validatedPathToSchemas = PathToSchemasMap() + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, LinkedHashSet()) + val pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet) + return getNewInstance(castArg, validationMetadata.pathToItem, pathToSchemasMap) + } + + @Throws(ValidationException::class) + override fun validate(arg: Any?, configuration: SchemaConfiguration?): Any? { + if (arg == null) { + return validate(null, configuration) + } else if (arg is Boolean) { + return validate(arg, configuration) + } else if (arg is Number) { + return validate(arg, configuration) + } else if (arg is String) { + return validate(arg, configuration) + } else if (arg is List<*>) { + return validate(arg, configuration) + } else if (arg is Map<*, *>) { + return validate(arg, configuration) + } + throw ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema") + } + override fun getNewInstance(arg: Any?, pathToItem: List, pathToSchemas: PathToSchemasMap): Any? { + if (arg == null) { + return getNewInstance( null, pathToItem, pathToSchemas) + } else if (arg is Boolean) { + return getNewInstance(arg, pathToItem, pathToSchemas) + } else if (arg is Number) { + return getNewInstance(arg, pathToItem, pathToSchemas) + } else if (arg is String) { + return getNewInstance(arg, pathToItem, pathToSchemas) + } else if (arg is List<*>) { + return getNewInstance(arg, pathToItem, pathToSchemas) + } else if (arg is Map<*, *>) { + return getNewInstance(arg, pathToItem, pathToSchemas) + } + throw RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema") + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: Nothing?, configuration: SchemaConfiguration?): UriReferenceFormat1BoxedVoid { + return UriReferenceFormat1BoxedVoid(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: Boolean, configuration: SchemaConfiguration?): UriReferenceFormat1BoxedBoolean { + return UriReferenceFormat1BoxedBoolean(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: Number, configuration: SchemaConfiguration?): UriReferenceFormat1BoxedNumber { + return UriReferenceFormat1BoxedNumber(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: String, configuration: SchemaConfiguration?): UriReferenceFormat1BoxedString { + return UriReferenceFormat1BoxedString(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: List<*>, configuration: SchemaConfiguration?): UriReferenceFormat1BoxedList { + return UriReferenceFormat1BoxedList(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: Map<*, *>, configuration: SchemaConfiguration?): UriReferenceFormat1BoxedMap { + return UriReferenceFormat1BoxedMap(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: Any?, configuration: SchemaConfiguration?): UriReferenceFormat1Boxed { + if (arg == null) { + return validateAndBox(null, configuration) + } else if (arg is Boolean) { + return validateAndBox(arg, configuration) + } else if (arg is String) { + return validateAndBox(arg, configuration) + } else if (arg is Number) { + return validateAndBox(arg, configuration) + } else if (arg is List<*>) { + return validateAndBox(arg, configuration) + } else if (arg is Map<*, *>) { + return validateAndBox(arg, configuration) + } + throw ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema") + } + } +} diff --git a/samples/client/3_0_3_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/schemas/UriTemplateFormat.kt b/samples/client/3_0_3_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/schemas/UriTemplateFormat.kt new file mode 100644 index 00000000000..6bfbac6b213 --- /dev/null +++ b/samples/client/3_0_3_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/schemas/UriTemplateFormat.kt @@ -0,0 +1,308 @@ +package org.openapijsonschematools.client.components.schemas +import java.time.LocalDate +import java.time.ZonedDateTime +import java.util.UUID +import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags +import org.openapijsonschematools.client.configurations.SchemaConfiguration +import org.openapijsonschematools.client.exceptions.InvalidAdditionalPropertyException +import org.openapijsonschematools.client.exceptions.UnsetPropertyException +import org.openapijsonschematools.client.exceptions.ValidationException +import org.openapijsonschematools.client.schemas.UnsetAddPropsSetter +import org.openapijsonschematools.client.schemas.validation.BooleanSchemaValidator +import org.openapijsonschematools.client.schemas.validation.FrozenList +import org.openapijsonschematools.client.schemas.validation.FrozenMap +import org.openapijsonschematools.client.schemas.validation.JsonSchema +import org.openapijsonschematools.client.schemas.validation.JsonSchemaInfo +import org.openapijsonschematools.client.schemas.validation.ListSchemaValidator +import org.openapijsonschematools.client.schemas.validation.MapSchemaValidator +import org.openapijsonschematools.client.schemas.validation.NullSchemaValidator +import org.openapijsonschematools.client.schemas.validation.NumberSchemaValidator +import org.openapijsonschematools.client.schemas.validation.PathToSchemasMap +import org.openapijsonschematools.client.schemas.validation.StringSchemaValidator +import org.openapijsonschematools.client.schemas.validation.ValidationMetadata + +class UriTemplateFormat { + // nest classes so all schemas and input/output classes can be public + + + sealed interface UriTemplateFormat1Boxed { + fun getData(): Any? + } + + data class UriTemplateFormat1BoxedVoid(val data: Nothing?) : UriTemplateFormat1Boxed { + override fun getData(): Any? { + return data + } + } + + data class UriTemplateFormat1BoxedBoolean(val data: Boolean): UriTemplateFormat1Boxed { + override fun getData(): Any? { + return data + } + } + + data class UriTemplateFormat1BoxedNumber(val data: Number) : UriTemplateFormat1Boxed { + override fun getData(): Any? { + return data + } + } + + data class UriTemplateFormat1BoxedString(val data: String) : UriTemplateFormat1Boxed { + override fun getData(): Any? { + return data + } + } + + data class UriTemplateFormat1BoxedList(val data: FrozenList) : UriTemplateFormat1Boxed { + override fun getData(): Any? { + return data + } + } + + data class UriTemplateFormat1BoxedMap(val data: FrozenMap) : UriTemplateFormat1Boxed { + override fun getData(): Any? { + return data + } + } + + + class UriTemplateFormat1 private constructor(): JsonSchema( + JsonSchemaInfo() + .format("uri-template") + ), NullSchemaValidator, BooleanSchemaValidator, NumberSchemaValidator, StringSchemaValidator, ListSchemaValidator, UriTemplateFormat1BoxedList>, MapSchemaValidator, UriTemplateFormat1BoxedMap> { + /* + NOTE: This class is auto generated by OpenAPI JSON Schema Generator. + Ref: https://github.com/openapi-json-schema-tools/openapi-json-schema-generator + + Do not edit the class manually. + */ + + companion object { + @Volatile + private var instance: UriTemplateFormat1? = null + + fun getInstance() = + instance ?: synchronized(this) { + instance ?: UriTemplateFormat1().also { instance = it } + } + } + + @Throws(ValidationException::class) + override fun validate(arg: Nothing?, configuration: SchemaConfiguration?): Nothing? { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validatedPathToSchemas = PathToSchemasMap() + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, LinkedHashSet()) + getPathToSchemas(this, castArg, validationMetadata, pathSet) + return castArg + } + + @Throws(ValidationException::class) + override fun validate(arg: Boolean, configuration: SchemaConfiguration?): Boolean { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validatedPathToSchemas = PathToSchemasMap() + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, LinkedHashSet()) + getPathToSchemas(this, castArg, validationMetadata, pathSet) + return castArg + } + + @Throws(ValidationException::class) + override fun validate(arg: Number, configuration: SchemaConfiguration?): Number { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validatedPathToSchemas = PathToSchemasMap() + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, LinkedHashSet()) + getPathToSchemas(this, castArg, validationMetadata, pathSet) + return castArg + } + + @Throws(ValidationException::class) + fun validate(arg: Int, configuration: SchemaConfiguration?): Int { + return validate(arg as Number, configuration) as Int + } + + @Throws(ValidationException::class) + fun validate(arg: Long, configuration: SchemaConfiguration?): Long { + return validate(arg as Number, configuration) as Long + } + + @Throws(ValidationException::class) + fun validate(arg: Float, configuration: SchemaConfiguration?): Float { + return validate(arg as Number, configuration) as Float + } + + @Throws(ValidationException::class) + fun validate(arg: Double, configuration: SchemaConfiguration?): Double { + return validate(arg as Number, configuration) as Double + } + + @Throws(ValidationException::class) + override fun validate(arg: String, configuration: SchemaConfiguration?): String { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validatedPathToSchemas = PathToSchemasMap() + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, LinkedHashSet()) + getPathToSchemas(this, castArg, validationMetadata, pathSet) + return castArg + } + + @Throws(ValidationException::class) + fun validate(arg: LocalDate, configuration: SchemaConfiguration?): String { + return validate(arg.toString(), configuration) + } + + @Throws(ValidationException::class) + fun validate(arg: ZonedDateTime, configuration: SchemaConfiguration?): String { + return validate(arg.toString(), configuration) + } + + @Throws(ValidationException::class) + fun validate(arg: UUID, configuration: SchemaConfiguration?): String { + return validate(arg.toString(), configuration) + } + + override fun getNewInstance(arg: List<*>, pathToItem: List, pathToSchemas: PathToSchemasMap): FrozenList { + val items: MutableList = ArrayList() + var i: Int = 0 + for (item: Any? in arg) { + val itemPathToItem = pathToItem + i + val schemas: LinkedHashMap, Nothing?>? = pathToSchemas.get(itemPathToItem) + if (schemas == null) { + throw RuntimeException("Validation result is invalid, schemas must exist for a pathToItem") + } + val itemSchema: JsonSchema<*> = schemas.entries.iterator().next().key + val itemInstance: Any? = itemSchema.getNewInstance(item, itemPathToItem, pathToSchemas) + items.add(itemInstance) + i += 1 + } + val newInstanceItems: FrozenList = FrozenList(items) + return newInstanceItems + } + + @Throws(ValidationException::class) + override fun validate(arg: List<*>, configuration: SchemaConfiguration?): FrozenList { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, PathToSchemasMap(), LinkedHashSet()) + val pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet) + return getNewInstance(castArg, validationMetadata.pathToItem, pathToSchemasMap) + } + + override fun getNewInstance(arg: Map<*, *>, pathToItem: List, pathToSchemas: PathToSchemasMap): FrozenMap { + val properties: LinkedHashMap = LinkedHashMap() + for((propertyName, value) in arg) { + if (!(propertyName is String)) { + throw RuntimeException("Invalid non-string key value") + } + val propertyPathToItem: List = pathToItem + propertyName + val schemas: LinkedHashMap, Nothing?>? = pathToSchemas.get(propertyPathToItem) + if (schemas == null) { + throw RuntimeException("Validation result is invalid, schemas must exist for a pathToItem") + } + val propertySchema: JsonSchema<*> = schemas.entries.iterator().next().key + val propertyInstance: Any? = propertySchema.getNewInstance(value, propertyPathToItem, pathToSchemas) + properties[propertyName] = propertyInstance + } + val castProperties: FrozenMap = FrozenMap(properties) + return castProperties + } + + @Throws(ValidationException::class) + override fun validate(arg: Map<*, *>, configuration: SchemaConfiguration?): FrozenMap { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validatedPathToSchemas = PathToSchemasMap() + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, LinkedHashSet()) + val pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet) + return getNewInstance(castArg, validationMetadata.pathToItem, pathToSchemasMap) + } + + @Throws(ValidationException::class) + override fun validate(arg: Any?, configuration: SchemaConfiguration?): Any? { + if (arg == null) { + return validate(null, configuration) + } else if (arg is Boolean) { + return validate(arg, configuration) + } else if (arg is Number) { + return validate(arg, configuration) + } else if (arg is String) { + return validate(arg, configuration) + } else if (arg is List<*>) { + return validate(arg, configuration) + } else if (arg is Map<*, *>) { + return validate(arg, configuration) + } + throw ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema") + } + override fun getNewInstance(arg: Any?, pathToItem: List, pathToSchemas: PathToSchemasMap): Any? { + if (arg == null) { + return getNewInstance( null, pathToItem, pathToSchemas) + } else if (arg is Boolean) { + return getNewInstance(arg, pathToItem, pathToSchemas) + } else if (arg is Number) { + return getNewInstance(arg, pathToItem, pathToSchemas) + } else if (arg is String) { + return getNewInstance(arg, pathToItem, pathToSchemas) + } else if (arg is List<*>) { + return getNewInstance(arg, pathToItem, pathToSchemas) + } else if (arg is Map<*, *>) { + return getNewInstance(arg, pathToItem, pathToSchemas) + } + throw RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema") + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: Nothing?, configuration: SchemaConfiguration?): UriTemplateFormat1BoxedVoid { + return UriTemplateFormat1BoxedVoid(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: Boolean, configuration: SchemaConfiguration?): UriTemplateFormat1BoxedBoolean { + return UriTemplateFormat1BoxedBoolean(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: Number, configuration: SchemaConfiguration?): UriTemplateFormat1BoxedNumber { + return UriTemplateFormat1BoxedNumber(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: String, configuration: SchemaConfiguration?): UriTemplateFormat1BoxedString { + return UriTemplateFormat1BoxedString(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: List<*>, configuration: SchemaConfiguration?): UriTemplateFormat1BoxedList { + return UriTemplateFormat1BoxedList(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: Map<*, *>, configuration: SchemaConfiguration?): UriTemplateFormat1BoxedMap { + return UriTemplateFormat1BoxedMap(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: Any?, configuration: SchemaConfiguration?): UriTemplateFormat1Boxed { + if (arg == null) { + return validateAndBox(null, configuration) + } else if (arg is Boolean) { + return validateAndBox(arg, configuration) + } else if (arg is String) { + return validateAndBox(arg, configuration) + } else if (arg is Number) { + return validateAndBox(arg, configuration) + } else if (arg is List<*>) { + return validateAndBox(arg, configuration) + } else if (arg is Map<*, *>) { + return validateAndBox(arg, configuration) + } + throw ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema") + } + } +} diff --git a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/configurations/JsonSchemaKeywordFlags.kt b/samples/client/3_0_3_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/configurations/JsonSchemaKeywordFlags.kt similarity index 99% rename from samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/configurations/JsonSchemaKeywordFlags.kt rename to samples/client/3_0_3_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/configurations/JsonSchemaKeywordFlags.kt index f939b8dda4e..93aa9a04917 100644 --- a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/configurations/JsonSchemaKeywordFlags.kt +++ b/samples/client/3_0_3_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/configurations/JsonSchemaKeywordFlags.kt @@ -1,4 +1,4 @@ -package org.openapijsonschematools.client.configurations +package org.openapijsonschematools.client.configurations; data class JsonSchemaKeywordFlags( val additionalProperties: Boolean, diff --git a/samples/client/3_0_3_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/configurations/SchemaConfiguration.kt b/samples/client/3_0_3_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/configurations/SchemaConfiguration.kt new file mode 100644 index 00000000000..39a58bba52f --- /dev/null +++ b/samples/client/3_0_3_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/configurations/SchemaConfiguration.kt @@ -0,0 +1,3 @@ +package org.openapijsonschematools.client.configurations; + +data class SchemaConfiguration(val disabledKeywordFlags: JsonSchemaKeywordFlags) \ No newline at end of file diff --git a/samples/client/3_0_3_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/exceptions/BaseException.kt b/samples/client/3_0_3_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/exceptions/BaseException.kt new file mode 100644 index 00000000000..90fd1cd37f1 --- /dev/null +++ b/samples/client/3_0_3_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/exceptions/BaseException.kt @@ -0,0 +1,3 @@ +package org.openapijsonschematools.client.exceptions; + +open class BaseException(s: String?) : Exception(s) \ No newline at end of file diff --git a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/exceptions/InvalidAdditionalPropertyException.kt b/samples/client/3_0_3_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/exceptions/InvalidAdditionalPropertyException.kt similarity index 51% rename from samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/exceptions/InvalidAdditionalPropertyException.kt rename to samples/client/3_0_3_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/exceptions/InvalidAdditionalPropertyException.kt index 8f652edb49e..ad5b703ba4e 100644 --- a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/exceptions/InvalidAdditionalPropertyException.kt +++ b/samples/client/3_0_3_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/exceptions/InvalidAdditionalPropertyException.kt @@ -1,3 +1,3 @@ -package org.openapijsonschematools.client.exceptions +package org.openapijsonschematools.client.exceptions; -class InvalidAdditionalPropertyException(s: String?) : BaseException(s) \ No newline at end of file +class InvalidAdditionalPropertyException(s: String?) : BaseException(s) diff --git a/samples/client/3_0_3_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/exceptions/UnsetPropertyException.kt b/samples/client/3_0_3_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/exceptions/UnsetPropertyException.kt new file mode 100644 index 00000000000..6bff93968fb --- /dev/null +++ b/samples/client/3_0_3_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/exceptions/UnsetPropertyException.kt @@ -0,0 +1,3 @@ +package org.openapijsonschematools.client.exceptions; + +class UnsetPropertyException(s: String?) : BaseException(s) \ No newline at end of file diff --git a/samples/client/3_0_3_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/exceptions/ValidationException.kt b/samples/client/3_0_3_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/exceptions/ValidationException.kt new file mode 100644 index 00000000000..f9ea00d0821 --- /dev/null +++ b/samples/client/3_0_3_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/exceptions/ValidationException.kt @@ -0,0 +1,3 @@ +package org.openapijsonschematools.client.exceptions; + +class ValidationException(s: String?) : BaseException(s) \ No newline at end of file diff --git a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/schemas/AnyTypeJsonSchema.kt b/samples/client/3_0_3_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/schemas/AnyTypeJsonSchema.kt similarity index 95% rename from samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/schemas/AnyTypeJsonSchema.kt rename to samples/client/3_0_3_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/schemas/AnyTypeJsonSchema.kt index 1c74c52cf44..816976afa8f 100644 --- a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/schemas/AnyTypeJsonSchema.kt +++ b/samples/client/3_0_3_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/schemas/AnyTypeJsonSchema.kt @@ -3,71 +3,72 @@ package org.openapijsonschematools.client.schemas import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags import org.openapijsonschematools.client.configurations.SchemaConfiguration import org.openapijsonschematools.client.exceptions.ValidationException -import org.openapijsonschematools.client.schemas.validation.BooleanSchemaValidator import org.openapijsonschematools.client.schemas.validation.FrozenList import org.openapijsonschematools.client.schemas.validation.FrozenMap import org.openapijsonschematools.client.schemas.validation.JsonSchema import org.openapijsonschematools.client.schemas.validation.JsonSchemaInfo -import org.openapijsonschematools.client.schemas.validation.ListSchemaValidator -import org.openapijsonschematools.client.schemas.validation.MapSchemaValidator +import org.openapijsonschematools.client.schemas.validation.PathToSchemasMap import org.openapijsonschematools.client.schemas.validation.NullSchemaValidator +import org.openapijsonschematools.client.schemas.validation.BooleanSchemaValidator import org.openapijsonschematools.client.schemas.validation.NumberSchemaValidator -import org.openapijsonschematools.client.schemas.validation.PathToSchemasMap import org.openapijsonschematools.client.schemas.validation.StringSchemaValidator +import org.openapijsonschematools.client.schemas.validation.ListSchemaValidator +import org.openapijsonschematools.client.schemas.validation.MapSchemaValidator import org.openapijsonschematools.client.schemas.validation.ValidationMetadata + import java.time.LocalDate import java.time.ZonedDateTime import java.util.UUID -class AnyTypeJsonSchema { +open class AnyTypeJsonSchema { sealed interface AnyTypeJsonSchema1Boxed { fun getData(): Any? } - + data class AnyTypeJsonSchema1BoxedVoid(val data: Nothing?) : AnyTypeJsonSchema1Boxed { override fun getData(): Any? { return data } } - + data class AnyTypeJsonSchema1BoxedBoolean(val data: Boolean) : AnyTypeJsonSchema1Boxed { - override fun getData(): Boolean { + override fun getData(): Any? { return data } } - + data class AnyTypeJsonSchema1BoxedNumber(val data: Number) : AnyTypeJsonSchema1Boxed { - override fun getData(): Number { + override fun getData(): Any? { return data } } - + data class AnyTypeJsonSchema1BoxedString(val data: String) : AnyTypeJsonSchema1Boxed { - override fun getData(): String { + override fun getData(): Any? { return data } } - + data class AnyTypeJsonSchema1BoxedList(val data: FrozenList) : AnyTypeJsonSchema1Boxed { - override fun getData(): FrozenList { + override fun getData(): Any? { return data } } - + data class AnyTypeJsonSchema1BoxedMap(val data: FrozenMap) : AnyTypeJsonSchema1Boxed { - override fun getData(): FrozenMap { + override fun getData(): Any? { return data } } - class AnyTypeJsonSchema1 private constructor() : JsonSchema(JsonSchemaInfo()), + open class AnyTypeJsonSchema1 protected constructor() : JsonSchema(JsonSchemaInfo()), NullSchemaValidator, BooleanSchemaValidator, NumberSchemaValidator, StringSchemaValidator, ListSchemaValidator, AnyTypeJsonSchema1BoxedList>, @@ -234,11 +235,11 @@ class AnyTypeJsonSchema { } is Number -> { - return getNewInstance(arg as Number?, pathToItem, pathToSchemas) + return getNewInstance(arg, pathToItem, pathToSchemas) } is String -> { - return getNewInstance(arg as String?, pathToItem, pathToSchemas) + return getNewInstance(arg, pathToItem, pathToSchemas) } is List<*> -> { @@ -272,11 +273,11 @@ class AnyTypeJsonSchema { } is List<*> -> { - return validate(arg as List<*>?, configuration) + return validate(arg, configuration) } is Map<*, *> -> { - return validate(arg as Map<*, *>?, configuration) + return validate(arg, configuration) } else -> throw ValidationException("Invalid input type=$javaClass. It can't be validated by this schema") diff --git a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/schemas/BooleanJsonSchema.kt b/samples/client/3_0_3_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/schemas/BooleanJsonSchema.kt similarity index 95% rename from samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/schemas/BooleanJsonSchema.kt rename to samples/client/3_0_3_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/schemas/BooleanJsonSchema.kt index dfc7dbd0de2..ec466c5b84e 100644 --- a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/schemas/BooleanJsonSchema.kt +++ b/samples/client/3_0_3_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/schemas/BooleanJsonSchema.kt @@ -3,24 +3,24 @@ package org.openapijsonschematools.client.schemas import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags import org.openapijsonschematools.client.configurations.SchemaConfiguration import org.openapijsonschematools.client.exceptions.ValidationException -import org.openapijsonschematools.client.schemas.validation.BooleanSchemaValidator import org.openapijsonschematools.client.schemas.validation.JsonSchema import org.openapijsonschematools.client.schemas.validation.JsonSchemaInfo import org.openapijsonschematools.client.schemas.validation.PathToSchemasMap +import org.openapijsonschematools.client.schemas.validation.BooleanSchemaValidator import org.openapijsonschematools.client.schemas.validation.ValidationMetadata -class BooleanJsonSchema { +open class BooleanJsonSchema { sealed interface BooleanJsonSchema1Boxed { fun getData(): Any? } data class BooleanJsonSchema1BoxedBoolean(val data: Boolean) : BooleanJsonSchema1Boxed { - override fun getData(): Boolean { + override fun getData(): Any? { return data } } - class BooleanJsonSchema1 private constructor() : JsonSchema( + open class BooleanJsonSchema1 protected constructor() : JsonSchema( JsonSchemaInfo() .type(setOf(Boolean::class.java)) ), BooleanSchemaValidator { diff --git a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/schemas/DateJsonSchema.kt b/samples/client/3_0_3_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/schemas/DateJsonSchema.kt similarity index 85% rename from samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/schemas/DateJsonSchema.kt rename to samples/client/3_0_3_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/schemas/DateJsonSchema.kt index 57bd17ea4e6..ff7a15d365a 100644 --- a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/schemas/DateJsonSchema.kt +++ b/samples/client/3_0_3_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/schemas/DateJsonSchema.kt @@ -8,38 +8,35 @@ import org.openapijsonschematools.client.schemas.validation.JsonSchemaInfo import org.openapijsonschematools.client.schemas.validation.PathToSchemasMap import org.openapijsonschematools.client.schemas.validation.StringSchemaValidator import org.openapijsonschematools.client.schemas.validation.ValidationMetadata + import java.time.LocalDate -class DateJsonSchema { +open class DateJsonSchema { sealed interface DateJsonSchema1Boxed { fun getData(): Any? } data class DateJsonSchema1BoxedString(val data: String) : DateJsonSchema1Boxed { - override fun getData(): String { + override fun getData(): Any? { return data } } - class DateJsonSchema1 private constructor() : JsonSchema( + open class DateJsonSchema1 protected constructor() : JsonSchema( JsonSchemaInfo() .type(setOf(String::class.java)) .format("date") ), StringSchemaValidator { @Throws(ValidationException::class) override fun validate(arg: String, configuration: SchemaConfiguration?): String { - val pathSet: Set> = HashSet() + val pathSet: MutableSet> = HashSet() val pathToItem = listOf("args[0") val castArg: String = castToAllowedTypes(arg, pathToItem, pathSet) - val usedConfiguration = Objects.requireNonNullElseGet(configuration) { - SchemaConfiguration( - JsonSchemaKeywordFlags.Builder().build() - ) - } + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) val validationMetadata = - ValidationMetadata(pathToItem, usedConfiguration!!, PathToSchemasMap(), LinkedHashSet()) + ValidationMetadata(pathToItem, usedConfiguration, PathToSchemasMap(), LinkedHashSet()) val pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet) - return getNewInstance(castArg, validationMetadata.pathToItem(), pathToSchemasMap) + return getNewInstance(castArg, validationMetadata.pathToItem, pathToSchemasMap) } @Throws(ValidationException::class) @@ -49,7 +46,7 @@ class DateJsonSchema { override fun getNewInstance(arg: Any?, pathToItem: List, pathToSchemas: PathToSchemasMap): Any? { if (arg is String) { - return getNewInstance(arg as String?, pathToItem, pathToSchemas) + return getNewInstance(arg, pathToItem, pathToSchemas) } throw RuntimeException("Invalid input type=$javaClass. It can't be instantiated by this schema") } diff --git a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/schemas/DateTimeJsonSchema.kt b/samples/client/3_0_3_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/schemas/DateTimeJsonSchema.kt similarity index 93% rename from samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/schemas/DateTimeJsonSchema.kt rename to samples/client/3_0_3_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/schemas/DateTimeJsonSchema.kt index 836a128d9a5..4da3ee275fe 100644 --- a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/schemas/DateTimeJsonSchema.kt +++ b/samples/client/3_0_3_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/schemas/DateTimeJsonSchema.kt @@ -11,18 +11,18 @@ import org.openapijsonschematools.client.schemas.validation.ValidationMetadata import java.time.ZonedDateTime -class DateTimeJsonSchema { +open class DateTimeJsonSchema { sealed interface DateTimeJsonSchema1Boxed { fun getData(): Any? } data class DateTimeJsonSchema1BoxedString(val data: String) : DateTimeJsonSchema1Boxed { - override fun getData(): String { + override fun getData(): Any? { return data } } - class DateTimeJsonSchema1 private constructor() : JsonSchema( + open class DateTimeJsonSchema1 protected constructor() : JsonSchema( JsonSchemaInfo() .type(setOf(String::class.java)) .format("date-time") @@ -46,7 +46,7 @@ class DateTimeJsonSchema { override fun getNewInstance(arg: Any?, pathToItem: List, pathToSchemas: PathToSchemasMap): Any? { if (arg is String) { - return getNewInstance(arg as String?, pathToItem, pathToSchemas) + return getNewInstance(arg, pathToItem, pathToSchemas) } throw RuntimeException("Invalid input type=$javaClass. It can't be instantiated by this schema") } diff --git a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/schemas/DecimalJsonSchema.kt b/samples/client/3_0_3_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/schemas/DecimalJsonSchema.kt similarity index 93% rename from samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/schemas/DecimalJsonSchema.kt rename to samples/client/3_0_3_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/schemas/DecimalJsonSchema.kt index 3d03d10ba29..f327b015a82 100644 --- a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/schemas/DecimalJsonSchema.kt +++ b/samples/client/3_0_3_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/schemas/DecimalJsonSchema.kt @@ -9,18 +9,18 @@ import org.openapijsonschematools.client.schemas.validation.PathToSchemasMap import org.openapijsonschematools.client.schemas.validation.StringSchemaValidator import org.openapijsonschematools.client.schemas.validation.ValidationMetadata -class DecimalJsonSchema { +open class DecimalJsonSchema { sealed interface DecimalJsonSchema1Boxed { fun getData(): Any? } data class DecimalJsonSchema1BoxedString(val data: String) : DecimalJsonSchema1Boxed { - override fun getData(): String { + override fun getData(): Any? { return data } } - class DecimalJsonSchema1 private constructor() : JsonSchema( + open class DecimalJsonSchema1 protected constructor() : JsonSchema( JsonSchemaInfo() .type(setOf(String::class.java)) .format("number") @@ -39,7 +39,7 @@ class DecimalJsonSchema { override fun getNewInstance(arg: Any?, pathToItem: List, pathToSchemas: PathToSchemasMap): Any? { if (arg is String) { - return getNewInstance(arg as String?, pathToItem, pathToSchemas) + return getNewInstance(arg, pathToItem, pathToSchemas) } throw RuntimeException("Invalid input type=$javaClass. It can't be instantiated by this schema") } diff --git a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/schemas/DoubleJsonSchema.kt b/samples/client/3_0_3_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/schemas/DoubleJsonSchema.kt similarity index 89% rename from samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/schemas/DoubleJsonSchema.kt rename to samples/client/3_0_3_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/schemas/DoubleJsonSchema.kt index 28603219fff..ac9981b8d46 100644 --- a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/schemas/DoubleJsonSchema.kt +++ b/samples/client/3_0_3_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/schemas/DoubleJsonSchema.kt @@ -5,24 +5,29 @@ import org.openapijsonschematools.client.configurations.SchemaConfiguration import org.openapijsonschematools.client.exceptions.ValidationException import org.openapijsonschematools.client.schemas.validation.JsonSchema import org.openapijsonschematools.client.schemas.validation.JsonSchemaInfo -import org.openapijsonschematools.client.schemas.validation.NumberSchemaValidator import org.openapijsonschematools.client.schemas.validation.PathToSchemasMap +import org.openapijsonschematools.client.schemas.validation.NumberSchemaValidator import org.openapijsonschematools.client.schemas.validation.ValidationMetadata -class DoubleJsonSchema { +open class DoubleJsonSchema { sealed interface DoubleJsonSchema1Boxed { fun getData(): Any? } data class DoubleJsonSchema1BoxedNumber(val data: Number) : DoubleJsonSchema1Boxed { - override fun getData(): Number { + override fun getData(): Any? { return data } } - class DoubleJsonSchema1 private constructor() : JsonSchema( + open class DoubleJsonSchema1 protected constructor() : JsonSchema( JsonSchemaInfo() - .type(setOf(Double::class.java)) + .type(setOf( + Int::class.java, + Long::class.java, + Float::class.java, + Double::class.java + )) .format("double") ), NumberSchemaValidator { @Throws(ValidationException::class) @@ -44,7 +49,7 @@ class DoubleJsonSchema { override fun getNewInstance(arg: Any?, pathToItem: List, pathToSchemas: PathToSchemasMap): Any? { if (arg is Number) { - return getNewInstance(arg as Number?, pathToItem, pathToSchemas) + return getNewInstance(arg, pathToItem, pathToSchemas) } throw RuntimeException("Invalid input type=$javaClass. It can't be instantiated by this schema") } diff --git a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/schemas/FloatJsonSchema.kt b/samples/client/3_0_3_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/schemas/FloatJsonSchema.kt similarity index 91% rename from samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/schemas/FloatJsonSchema.kt rename to samples/client/3_0_3_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/schemas/FloatJsonSchema.kt index 4c5e59a6753..016d1ef2e43 100644 --- a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/schemas/FloatJsonSchema.kt +++ b/samples/client/3_0_3_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/schemas/FloatJsonSchema.kt @@ -5,24 +5,27 @@ import org.openapijsonschematools.client.configurations.SchemaConfiguration import org.openapijsonschematools.client.exceptions.ValidationException import org.openapijsonschematools.client.schemas.validation.JsonSchema import org.openapijsonschematools.client.schemas.validation.JsonSchemaInfo -import org.openapijsonschematools.client.schemas.validation.NumberSchemaValidator import org.openapijsonschematools.client.schemas.validation.PathToSchemasMap +import org.openapijsonschematools.client.schemas.validation.NumberSchemaValidator import org.openapijsonschematools.client.schemas.validation.ValidationMetadata -class FloatJsonSchema { +open class FloatJsonSchema { sealed interface FloatJsonSchema1Boxed { fun getData(): Any? } data class FloatJsonSchema1BoxedNumber(val data: Number) : FloatJsonSchema1Boxed { - override fun getData(): Number { + override fun getData(): Any? { return data } } - class FloatJsonSchema1 private constructor() : JsonSchema( + open class FloatJsonSchema1 protected constructor() : JsonSchema( JsonSchemaInfo() - .type(setOf(Float::class.java)) + .type(setOf( + Int::class.java, + Float::class.java + )) .format("float") ), NumberSchemaValidator { @Throws(ValidationException::class) @@ -44,7 +47,7 @@ class FloatJsonSchema { override fun getNewInstance(arg: Any?, pathToItem: List, pathToSchemas: PathToSchemasMap): Any? { if (arg is Number) { - return getNewInstance(arg as Number?, pathToItem, pathToSchemas) + return getNewInstance(arg, pathToItem, pathToSchemas) } throw RuntimeException("Invalid input type=$javaClass. It can't be instantiated by this schema") } @@ -80,4 +83,4 @@ class FloatJsonSchema { } } } -} +} \ No newline at end of file diff --git a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/schemas/GenericBuilder.kt b/samples/client/3_0_3_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/schemas/GenericBuilder.kt similarity index 99% rename from samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/schemas/GenericBuilder.kt rename to samples/client/3_0_3_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/schemas/GenericBuilder.kt index 433966f49bf..f96e858458c 100644 --- a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/schemas/GenericBuilder.kt +++ b/samples/client/3_0_3_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/schemas/GenericBuilder.kt @@ -6,4 +6,4 @@ package org.openapijsonschematools.client.schemas */ interface GenericBuilder { fun build(): T -} +} \ No newline at end of file diff --git a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/schemas/Int32JsonSchema.kt b/samples/client/3_0_3_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/schemas/Int32JsonSchema.kt similarity index 94% rename from samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/schemas/Int32JsonSchema.kt rename to samples/client/3_0_3_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/schemas/Int32JsonSchema.kt index 3f7786bda2b..fba8ab8762a 100644 --- a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/schemas/Int32JsonSchema.kt +++ b/samples/client/3_0_3_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/schemas/Int32JsonSchema.kt @@ -1,26 +1,26 @@ package org.openapijsonschematools.client.schemas import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags -import org.openapijsonschematools.client.configurations.SchemaConfiguration import org.openapijsonschematools.client.exceptions.ValidationException import org.openapijsonschematools.client.schemas.validation.JsonSchema import org.openapijsonschematools.client.schemas.validation.JsonSchemaInfo -import org.openapijsonschematools.client.schemas.validation.NumberSchemaValidator +import org.openapijsonschematools.client.configurations.SchemaConfiguration import org.openapijsonschematools.client.schemas.validation.PathToSchemasMap +import org.openapijsonschematools.client.schemas.validation.NumberSchemaValidator import org.openapijsonschematools.client.schemas.validation.ValidationMetadata -class Int32JsonSchema { +open class Int32JsonSchema { sealed interface Int32JsonSchema1Boxed { fun getData(): Any? } data class Int32JsonSchema1BoxedNumber(val data: Number) : Int32JsonSchema1Boxed { - override fun getData(): Number { + override fun getData(): Any? { return data } } - class Int32JsonSchema1 private constructor() : JsonSchema( + open class Int32JsonSchema1 protected constructor() : JsonSchema( JsonSchemaInfo() .type( setOf( @@ -54,7 +54,7 @@ class Int32JsonSchema { override fun getNewInstance(arg: Any?, pathToItem: List, pathToSchemas: PathToSchemasMap): Any? { if (arg is Number) { - return getNewInstance(arg as Number?, pathToItem, pathToSchemas) + return getNewInstance(arg, pathToItem, pathToSchemas) } throw RuntimeException("Invalid input type=$javaClass. It can't be instantiated by this schema") } diff --git a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/schemas/Int64JsonSchema.kt b/samples/client/3_0_3_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/schemas/Int64JsonSchema.kt similarity index 94% rename from samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/schemas/Int64JsonSchema.kt rename to samples/client/3_0_3_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/schemas/Int64JsonSchema.kt index 92e893b1ab9..8feda5d3694 100644 --- a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/schemas/Int64JsonSchema.kt +++ b/samples/client/3_0_3_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/schemas/Int64JsonSchema.kt @@ -1,26 +1,26 @@ package org.openapijsonschematools.client.schemas import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags -import org.openapijsonschematools.client.configurations.SchemaConfiguration import org.openapijsonschematools.client.exceptions.ValidationException import org.openapijsonschematools.client.schemas.validation.JsonSchema import org.openapijsonschematools.client.schemas.validation.JsonSchemaInfo -import org.openapijsonschematools.client.schemas.validation.NumberSchemaValidator +import org.openapijsonschematools.client.configurations.SchemaConfiguration import org.openapijsonschematools.client.schemas.validation.PathToSchemasMap +import org.openapijsonschematools.client.schemas.validation.NumberSchemaValidator import org.openapijsonschematools.client.schemas.validation.ValidationMetadata -class Int64JsonSchema { +open class Int64JsonSchema { sealed interface Int64JsonSchema1Boxed { fun getData(): Any? } data class Int64JsonSchema1BoxedNumber(val data: Number) : Int64JsonSchema1Boxed { - override fun getData(): Number { + override fun getData(): Any? { return data } } - class Int64JsonSchema1 private constructor() : JsonSchema( + open class Int64JsonSchema1 protected constructor() : JsonSchema( JsonSchemaInfo() .type( setOf( @@ -66,7 +66,7 @@ class Int64JsonSchema { override fun getNewInstance(arg: Any?, pathToItem: List, pathToSchemas: PathToSchemasMap): Any? { if (arg is Number) { - return getNewInstance(arg as Number?, pathToItem, pathToSchemas) + return getNewInstance(arg, pathToItem, pathToSchemas) } throw RuntimeException("Invalid input type=$javaClass. It can't be instantiated by this schema") } diff --git a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/schemas/IntJsonSchema.kt b/samples/client/3_0_3_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/schemas/IntJsonSchema.kt similarity index 95% rename from samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/schemas/IntJsonSchema.kt rename to samples/client/3_0_3_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/schemas/IntJsonSchema.kt index f69bb5eca59..0a0043e7335 100644 --- a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/schemas/IntJsonSchema.kt +++ b/samples/client/3_0_3_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/schemas/IntJsonSchema.kt @@ -1,26 +1,26 @@ package org.openapijsonschematools.client.schemas import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags -import org.openapijsonschematools.client.configurations.SchemaConfiguration import org.openapijsonschematools.client.exceptions.ValidationException import org.openapijsonschematools.client.schemas.validation.JsonSchema import org.openapijsonschematools.client.schemas.validation.JsonSchemaInfo -import org.openapijsonschematools.client.schemas.validation.NumberSchemaValidator +import org.openapijsonschematools.client.configurations.SchemaConfiguration import org.openapijsonschematools.client.schemas.validation.PathToSchemasMap +import org.openapijsonschematools.client.schemas.validation.NumberSchemaValidator import org.openapijsonschematools.client.schemas.validation.ValidationMetadata -class IntJsonSchema { +open class IntJsonSchema { sealed interface IntJsonSchema1Boxed { fun getData(): Any? } data class IntJsonSchema1BoxedNumber(val data: Number) : IntJsonSchema1Boxed { - override fun getData(): Number { + override fun getData(): Any? { return data } } - class IntJsonSchema1 private constructor() : JsonSchema( + open class IntJsonSchema1 protected constructor() : JsonSchema( JsonSchemaInfo() .type( setOf( @@ -66,7 +66,7 @@ class IntJsonSchema { override fun getNewInstance(arg: Any?, pathToItem: List, pathToSchemas: PathToSchemasMap): Any? { if (arg is Number) { - return getNewInstance(arg as Number?, pathToItem, pathToSchemas) + return getNewInstance(arg, pathToItem, pathToSchemas) } throw RuntimeException("Invalid input type=$javaClass. It can't be instantiated by this schema") } diff --git a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/schemas/ListJsonSchema.kt b/samples/client/3_0_3_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/schemas/ListJsonSchema.kt similarity index 95% rename from samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/schemas/ListJsonSchema.kt rename to samples/client/3_0_3_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/schemas/ListJsonSchema.kt index c84f7c3deb0..eff37e367ff 100644 --- a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/schemas/ListJsonSchema.kt +++ b/samples/client/3_0_3_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/schemas/ListJsonSchema.kt @@ -1,27 +1,27 @@ package org.openapijsonschematools.client.schemas import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags -import org.openapijsonschematools.client.configurations.SchemaConfiguration import org.openapijsonschematools.client.exceptions.ValidationException import org.openapijsonschematools.client.schemas.validation.FrozenList import org.openapijsonschematools.client.schemas.validation.JsonSchema import org.openapijsonschematools.client.schemas.validation.JsonSchemaInfo -import org.openapijsonschematools.client.schemas.validation.ListSchemaValidator +import org.openapijsonschematools.client.configurations.SchemaConfiguration import org.openapijsonschematools.client.schemas.validation.PathToSchemasMap +import org.openapijsonschematools.client.schemas.validation.ListSchemaValidator import org.openapijsonschematools.client.schemas.validation.ValidationMetadata -class ListJsonSchema { +open class ListJsonSchema { sealed interface ListJsonSchema1Boxed { fun getData(): Any? } data class ListJsonSchema1BoxedList(val data: FrozenList) : ListJsonSchema1Boxed { - override fun getData(): FrozenList { + override fun getData(): Any? { return data } } - class ListJsonSchema1 private constructor() : JsonSchema( + open class ListJsonSchema1 protected constructor() : JsonSchema( JsonSchemaInfo() .type(setOf(List::class.java)) ), ListSchemaValidator, ListJsonSchema1BoxedList> { @@ -67,7 +67,7 @@ class ListJsonSchema { @Throws(ValidationException::class) override fun validate(arg: Any?, configuration: SchemaConfiguration?): Any? { if (arg is List<*>) { - return validate(arg as List<*>?, configuration) + return validate(arg, configuration) } throw ValidationException("Invalid input type=$javaClass. It can't be instantiated by this schema") } @@ -95,4 +95,4 @@ class ListJsonSchema { } } } -} +} \ No newline at end of file diff --git a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/schemas/MapJsonSchema.kt b/samples/client/3_0_3_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/schemas/MapJsonSchema.kt similarity index 92% rename from samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/schemas/MapJsonSchema.kt rename to samples/client/3_0_3_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/schemas/MapJsonSchema.kt index 3db88f6bf52..a1e0ecc6842 100644 --- a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/schemas/MapJsonSchema.kt +++ b/samples/client/3_0_3_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/schemas/MapJsonSchema.kt @@ -1,27 +1,27 @@ package org.openapijsonschematools.client.schemas import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags -import org.openapijsonschematools.client.configurations.SchemaConfiguration import org.openapijsonschematools.client.exceptions.ValidationException import org.openapijsonschematools.client.schemas.validation.FrozenMap import org.openapijsonschematools.client.schemas.validation.JsonSchema import org.openapijsonschematools.client.schemas.validation.JsonSchemaInfo -import org.openapijsonschematools.client.schemas.validation.MapSchemaValidator +import org.openapijsonschematools.client.configurations.SchemaConfiguration import org.openapijsonschematools.client.schemas.validation.PathToSchemasMap +import org.openapijsonschematools.client.schemas.validation.MapSchemaValidator import org.openapijsonschematools.client.schemas.validation.ValidationMetadata -class MapJsonSchema { +open class MapJsonSchema { sealed interface MapJsonSchema1Boxed { fun getData(): Any? } data class MapJsonSchema1BoxedMap(val data: FrozenMap) : MapJsonSchema1Boxed { - override fun getData(): FrozenMap { + override fun getData(): Any? { return data } } - class MapJsonSchema1 private constructor() : JsonSchema( + open class MapJsonSchema1 protected constructor() : JsonSchema( JsonSchemaInfo() .type(setOf(Map::class.java)) ), MapSchemaValidator, MapJsonSchema1BoxedMap> { @@ -58,8 +58,8 @@ class MapJsonSchema { } override fun getNewInstance(arg: Any?, pathToItem: List, pathToSchemas: PathToSchemasMap): FrozenMap { - if (arg is FrozenMap<*>) { - return getNewInstance(arg as Map<*, *>, pathToItem, pathToSchemas) + if (arg is Map<*, *>) { + return getNewInstance(arg, pathToItem, pathToSchemas) } throw RuntimeException("Invalid input type=$javaClass. It can't be instantiated by this schema") } @@ -67,7 +67,7 @@ class MapJsonSchema { @Throws(ValidationException::class) override fun validate(arg: Any?, configuration: SchemaConfiguration?): Any? { if (arg is Map<*, *>) { - return validate(arg as Map<*, *>?, configuration) + return validate(arg, configuration) } throw ValidationException("Invalid input type=$javaClass. It can't be validated by this schema") } @@ -95,4 +95,4 @@ class MapJsonSchema { } } } -} +} \ No newline at end of file diff --git a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/schemas/NotAnyTypeJsonSchema.kt b/samples/client/3_0_3_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/schemas/NotAnyTypeJsonSchema.kt similarity index 92% rename from samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/schemas/NotAnyTypeJsonSchema.kt rename to samples/client/3_0_3_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/schemas/NotAnyTypeJsonSchema.kt index 7a893519d45..f0992da3100 100644 --- a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/schemas/NotAnyTypeJsonSchema.kt +++ b/samples/client/3_0_3_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/schemas/NotAnyTypeJsonSchema.kt @@ -3,79 +3,79 @@ package org.openapijsonschematools.client.schemas import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags import org.openapijsonschematools.client.configurations.SchemaConfiguration import org.openapijsonschematools.client.exceptions.ValidationException -import org.openapijsonschematools.client.schemas.AnyTypeJsonSchema.AnyTypeJsonSchema1 -import org.openapijsonschematools.client.schemas.validation.BooleanSchemaValidator import org.openapijsonschematools.client.schemas.validation.FrozenList import org.openapijsonschematools.client.schemas.validation.FrozenMap import org.openapijsonschematools.client.schemas.validation.JsonSchema import org.openapijsonschematools.client.schemas.validation.JsonSchemaInfo -import org.openapijsonschematools.client.schemas.validation.ListSchemaValidator -import org.openapijsonschematools.client.schemas.validation.MapSchemaValidator +import org.openapijsonschematools.client.schemas.validation.PathToSchemasMap import org.openapijsonschematools.client.schemas.validation.NullSchemaValidator +import org.openapijsonschematools.client.schemas.validation.BooleanSchemaValidator import org.openapijsonschematools.client.schemas.validation.NumberSchemaValidator -import org.openapijsonschematools.client.schemas.validation.PathToSchemasMap import org.openapijsonschematools.client.schemas.validation.StringSchemaValidator +import org.openapijsonschematools.client.schemas.validation.ListSchemaValidator +import org.openapijsonschematools.client.schemas.validation.MapSchemaValidator import org.openapijsonschematools.client.schemas.validation.ValidationMetadata + import java.time.LocalDate import java.time.ZonedDateTime import java.util.UUID -class NotAnyTypeJsonSchema { +open class NotAnyTypeJsonSchema { sealed interface NotAnyTypeJsonSchema1Boxed { fun getData(): Any? } - + data class NotAnyTypeJsonSchema1BoxedVoid(val data: Void?) : NotAnyTypeJsonSchema1Boxed { override fun getData(): Any? { return data } } - + data class NotAnyTypeJsonSchema1BoxedBoolean(val data: Boolean) : NotAnyTypeJsonSchema1Boxed { - override fun getData(): Boolean { + override fun getData(): Any? { return data } } - + data class NotAnyTypeJsonSchema1BoxedNumber(val data: Number) : NotAnyTypeJsonSchema1Boxed { - override fun getData(): Number { + override fun getData(): Any? { return data } } - + data class NotAnyTypeJsonSchema1BoxedString(val data: String) : NotAnyTypeJsonSchema1Boxed { - override fun getData(): String { + override fun getData(): Any? { return data } } - + data class NotAnyTypeJsonSchema1BoxedList(val data: FrozenList) : NotAnyTypeJsonSchema1Boxed { - override fun getData(): FrozenList { + override fun getData(): Any? { return data } } - + data class NotAnyTypeJsonSchema1BoxedMap(val data: FrozenMap) : NotAnyTypeJsonSchema1Boxed { - override fun getData(): FrozenMap { + override fun getData(): Any? { return data } } - class NotAnyTypeJsonSchema1 private constructor() : JsonSchema( + open class NotAnyTypeJsonSchema1 protected constructor() : JsonSchema( JsonSchemaInfo() - .not(AnyTypeJsonSchema1::class.java) - ), NullSchemaValidator, BooleanSchemaValidator, - NumberSchemaValidator, - StringSchemaValidator, - ListSchemaValidator?, NotAnyTypeJsonSchema1BoxedList?>, - MapSchemaValidator?, NotAnyTypeJsonSchema1BoxedMap?> { + .not(AnyTypeJsonSchema.AnyTypeJsonSchema1::class.java) + ), NullSchemaValidator, BooleanSchemaValidator, + NumberSchemaValidator, + StringSchemaValidator, + ListSchemaValidator, NotAnyTypeJsonSchema1BoxedList>, + MapSchemaValidator, NotAnyTypeJsonSchema1BoxedMap> { @Throws(ValidationException::class) override fun validate(arg: Nothing?, configuration: SchemaConfiguration?): Nothing? { val pathSet: MutableSet> = HashSet() @@ -240,11 +240,11 @@ class NotAnyTypeJsonSchema { } is Number -> { - return getNewInstance(arg as Number?, pathToItem, pathToSchemas) + return getNewInstance(arg, pathToItem, pathToSchemas) } is String -> { - return getNewInstance(arg as String?, pathToItem, pathToSchemas) + return getNewInstance(arg, pathToItem, pathToSchemas) } is List<*> -> { @@ -278,11 +278,11 @@ class NotAnyTypeJsonSchema { } is List<*> -> { - return validate(arg as List<*>?, configuration) + return validate(arg, configuration) } is Map<*, *> -> { - return validate(arg as Map<*, *>?, configuration) + return validate(arg, configuration) } else -> throw ValidationException("Invalid input type=$javaClass. It can't be validated by this schema") diff --git a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/schemas/NullJsonSchema.kt b/samples/client/3_0_3_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/schemas/NullJsonSchema.kt similarity index 96% rename from samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/schemas/NullJsonSchema.kt rename to samples/client/3_0_3_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/schemas/NullJsonSchema.kt index 39cb7099ca7..b926c2cdb7c 100644 --- a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/schemas/NullJsonSchema.kt +++ b/samples/client/3_0_3_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/schemas/NullJsonSchema.kt @@ -5,11 +5,11 @@ import org.openapijsonschematools.client.configurations.SchemaConfiguration import org.openapijsonschematools.client.exceptions.ValidationException import org.openapijsonschematools.client.schemas.validation.JsonSchema import org.openapijsonschematools.client.schemas.validation.JsonSchemaInfo -import org.openapijsonschematools.client.schemas.validation.NullSchemaValidator import org.openapijsonschematools.client.schemas.validation.PathToSchemasMap +import org.openapijsonschematools.client.schemas.validation.NullSchemaValidator import org.openapijsonschematools.client.schemas.validation.ValidationMetadata -class NullJsonSchema { +open class NullJsonSchema { sealed interface NullJsonSchema1Boxed { fun getData(): Any? } @@ -20,7 +20,7 @@ class NullJsonSchema { } } - class NullJsonSchema1 private constructor() : JsonSchema( + open class NullJsonSchema1 protected constructor() : JsonSchema( JsonSchemaInfo() .type(setOf(Void::class.java)) ), NullSchemaValidator { diff --git a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/schemas/NumberJsonSchema.kt b/samples/client/3_0_3_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/schemas/NumberJsonSchema.kt similarity index 94% rename from samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/schemas/NumberJsonSchema.kt rename to samples/client/3_0_3_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/schemas/NumberJsonSchema.kt index 657f349e763..7f29d2a96a9 100644 --- a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/schemas/NumberJsonSchema.kt +++ b/samples/client/3_0_3_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/schemas/NumberJsonSchema.kt @@ -1,26 +1,26 @@ package org.openapijsonschematools.client.schemas import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags -import org.openapijsonschematools.client.configurations.SchemaConfiguration import org.openapijsonschematools.client.exceptions.ValidationException import org.openapijsonschematools.client.schemas.validation.JsonSchema import org.openapijsonschematools.client.schemas.validation.JsonSchemaInfo -import org.openapijsonschematools.client.schemas.validation.NumberSchemaValidator +import org.openapijsonschematools.client.configurations.SchemaConfiguration import org.openapijsonschematools.client.schemas.validation.PathToSchemasMap +import org.openapijsonschematools.client.schemas.validation.NumberSchemaValidator import org.openapijsonschematools.client.schemas.validation.ValidationMetadata -class NumberJsonSchema { +open class NumberJsonSchema { sealed interface NumberJsonSchema1Boxed { fun getData(): Any? } data class NumberJsonSchema1BoxedNumber(val data: Number) : NumberJsonSchema1Boxed { - override fun getData(): Number { + override fun getData(): Any? { return data } } - class NumberJsonSchema1 private constructor() : JsonSchema( + open class NumberJsonSchema1 protected constructor() : JsonSchema( JsonSchemaInfo() .type( setOf( @@ -65,7 +65,7 @@ class NumberJsonSchema { override fun getNewInstance(arg: Any?, pathToItem: List, pathToSchemas: PathToSchemasMap): Any? { if (arg is Number) { - return getNewInstance(arg as Number?, pathToItem, pathToSchemas) + return getNewInstance(arg, pathToItem, pathToSchemas) } throw RuntimeException("Invalid input type=$javaClass. It can't be instantiated by this schema") } diff --git a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/schemas/StringJsonSchema.kt b/samples/client/3_0_3_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/schemas/StringJsonSchema.kt similarity index 94% rename from samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/schemas/StringJsonSchema.kt rename to samples/client/3_0_3_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/schemas/StringJsonSchema.kt index 60ff4558af6..29f8b0f77f3 100644 --- a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/schemas/StringJsonSchema.kt +++ b/samples/client/3_0_3_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/schemas/StringJsonSchema.kt @@ -8,22 +8,23 @@ import org.openapijsonschematools.client.schemas.validation.JsonSchemaInfo import org.openapijsonschematools.client.schemas.validation.PathToSchemasMap import org.openapijsonschematools.client.schemas.validation.StringSchemaValidator import org.openapijsonschematools.client.schemas.validation.ValidationMetadata + import java.time.LocalDate import java.time.ZonedDateTime import java.util.UUID -class StringJsonSchema { +open class StringJsonSchema { interface StringJsonSchema1Boxed { fun getData(): Any? } data class StringJsonSchema1BoxedString(val data: String) : StringJsonSchema1Boxed { - override fun getData(): String { + override fun getData(): Any? { return data } } - class StringJsonSchema1 private constructor() : JsonSchema( + open class StringJsonSchema1 protected constructor() : JsonSchema( JsonSchemaInfo() .type(setOf(String::class.java)) ), StringSchemaValidator { @@ -56,7 +57,7 @@ class StringJsonSchema { override fun getNewInstance(arg: Any?, pathToItem: List, pathToSchemas: PathToSchemasMap): Any? { if (arg is String) { - return getNewInstance(arg as String?, pathToItem, pathToSchemas) + return getNewInstance(arg, pathToItem, pathToSchemas) } throw RuntimeException("Invalid input type=$javaClass. It can't be instantiated by this schema") } diff --git a/samples/client/3_0_3_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/schemas/UnsetAddPropsSetter.kt b/samples/client/3_0_3_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/schemas/UnsetAddPropsSetter.kt new file mode 100644 index 00000000000..320112a061d --- /dev/null +++ b/samples/client/3_0_3_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/schemas/UnsetAddPropsSetter.kt @@ -0,0 +1,81 @@ +package org.openapijsonschematools.client.schemas + +import org.openapijsonschematools.client.exceptions.InvalidAdditionalPropertyException +import org.openapijsonschematools.client.schemas.validation.MapUtils + +interface UnsetAddPropsSetter { + fun getInstance(): MutableMap + fun getKnownKeys(): Set + fun getBuilderAfterAdditionalProperty(instance: MutableMap): T + @Throws(InvalidAdditionalPropertyException::class) + fun additionalProperty(key: String, value: Void): T { + MapUtils.throwIfKeyKnown(key, getKnownKeys(), true) + val instance = getInstance() + instance[key] = value + return getBuilderAfterAdditionalProperty(instance) + } + + @Throws(InvalidAdditionalPropertyException::class) + fun additionalProperty(key: String, value: Boolean): T { + MapUtils.throwIfKeyKnown(key, getKnownKeys(), true) + val instance = getInstance() + instance[key] = value + return getBuilderAfterAdditionalProperty(instance) + } + + @Throws(InvalidAdditionalPropertyException::class) + fun additionalProperty(key: String, value: String): T { + MapUtils.throwIfKeyKnown(key, getKnownKeys(), true) + val instance = getInstance() + instance[key] = value + return getBuilderAfterAdditionalProperty(instance) + } + + @Throws(InvalidAdditionalPropertyException::class) + fun additionalProperty(key: String, value: Int): T { + MapUtils.throwIfKeyKnown(key, getKnownKeys(), true) + val instance = getInstance() + instance[key] = value + return getBuilderAfterAdditionalProperty(instance) + } + + @Throws(InvalidAdditionalPropertyException::class) + fun additionalProperty(key: String, value: Float): T { + MapUtils.throwIfKeyKnown(key, getKnownKeys(), true) + val instance = getInstance() + instance[key] = value + return getBuilderAfterAdditionalProperty(instance) + } + + @Throws(InvalidAdditionalPropertyException::class) + fun additionalProperty(key: String, value: Long): T { + MapUtils.throwIfKeyKnown(key, getKnownKeys(), true) + val instance = getInstance() + instance[key] = value + return getBuilderAfterAdditionalProperty(instance) + } + + @Throws(InvalidAdditionalPropertyException::class) + fun additionalProperty(key: String, value: Double): T { + MapUtils.throwIfKeyKnown(key, getKnownKeys(), true) + val instance = getInstance() + instance[key] = value + return getBuilderAfterAdditionalProperty(instance) + } + + @Throws(InvalidAdditionalPropertyException::class) + fun additionalProperty(key: String, value: List<*>): T { + MapUtils.throwIfKeyKnown(key, getKnownKeys(), true) + val instance = getInstance() + instance[key] = value + return getBuilderAfterAdditionalProperty(instance) + } + + @Throws(InvalidAdditionalPropertyException::class) + fun additionalProperty(key: String, value: Map): T { + MapUtils.throwIfKeyKnown(key, getKnownKeys(), true) + val instance = getInstance() + instance[key] = value + return getBuilderAfterAdditionalProperty(instance) + } +} \ No newline at end of file diff --git a/samples/client/3_0_3_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/schemas/UuidJsonSchema.kt b/samples/client/3_0_3_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/schemas/UuidJsonSchema.kt new file mode 100644 index 00000000000..5586af2b501 --- /dev/null +++ b/samples/client/3_0_3_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/schemas/UuidJsonSchema.kt @@ -0,0 +1,87 @@ +package org.openapijsonschematools.client.schemas + +import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags +import org.openapijsonschematools.client.exceptions.ValidationException +import org.openapijsonschematools.client.schemas.validation.JsonSchema +import org.openapijsonschematools.client.schemas.validation.JsonSchemaInfo +import org.openapijsonschematools.client.configurations.SchemaConfiguration +import org.openapijsonschematools.client.schemas.validation.PathToSchemasMap +import org.openapijsonschematools.client.schemas.validation.StringSchemaValidator +import org.openapijsonschematools.client.schemas.validation.ValidationMetadata + +import java.util.UUID + +open class UuidJsonSchema { + sealed interface UuidJsonSchema1Boxed { + fun getData(): Any? + } + + data class UuidJsonSchema1BoxedString(val data: String) : UuidJsonSchema1Boxed { + override fun getData(): Any? { + return data + } + } + + open class UuidJsonSchema1 protected constructor() : JsonSchema( + JsonSchemaInfo() + .type(setOf(String::class.java)) + .format("uuid") + ), StringSchemaValidator { + @Throws(ValidationException::class) + override fun validate(arg: String, configuration: SchemaConfiguration?): String { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg: String = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validationMetadata = + ValidationMetadata(pathToItem, usedConfiguration, PathToSchemasMap(), LinkedHashSet()) + val pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet) + return getNewInstance(castArg, validationMetadata.pathToItem, pathToSchemasMap) + } + + @Throws(ValidationException::class) + fun validate(arg: UUID, configuration: SchemaConfiguration?): String { + return validate(arg.toString(), configuration) + } + + override fun getNewInstance(arg: Any?, pathToItem: List, pathToSchemas: PathToSchemasMap): String { + if (arg is String) { + return getNewInstance(arg, pathToItem, pathToSchemas) + } + throw RuntimeException("Invalid input type=$javaClass. It can't be instantiated by this schema") + } + + @Throws(ValidationException::class) + override fun validate(arg: Any?, configuration: SchemaConfiguration?): String { + if (arg is UUID) { + return validate(arg, configuration) + } else if (arg is String) { + return validate(arg, configuration) + } + throw ValidationException("Invalid input type=$javaClass. It can't be validated by this schema") + } + + @Throws(ValidationException::class) + override fun validateAndBox(arg: String, configuration: SchemaConfiguration?): UuidJsonSchema1BoxedString { + return UuidJsonSchema1BoxedString(validate(arg, configuration)) + } + + @Throws(ValidationException::class) + override fun validateAndBox(arg: Any?, configuration: SchemaConfiguration?): UuidJsonSchema1Boxed { + if (arg is String) { + return validateAndBox(arg, configuration) + } + throw ValidationException("Invalid input type=$javaClass. It can't be validated by this schema") + } + + companion object { + @Volatile + private var instance: UuidJsonSchema1? = null + + fun getInstance() = + instance ?: synchronized(this) { + instance ?: UuidJsonSchema1().also { instance = it } + } + } + } +} \ No newline at end of file diff --git a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/schemas/validation/AdditionalPropertiesValidator.kt b/samples/client/3_0_3_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/schemas/validation/AdditionalPropertiesValidator.kt similarity index 100% rename from samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/schemas/validation/AdditionalPropertiesValidator.kt rename to samples/client/3_0_3_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/schemas/validation/AdditionalPropertiesValidator.kt diff --git a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/schemas/validation/AllOfValidator.kt b/samples/client/3_0_3_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/schemas/validation/AllOfValidator.kt similarity index 99% rename from samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/schemas/validation/AllOfValidator.kt rename to samples/client/3_0_3_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/schemas/validation/AllOfValidator.kt index f4c9c9f099f..e81a1aebfa6 100644 --- a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/schemas/validation/AllOfValidator.kt +++ b/samples/client/3_0_3_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/schemas/validation/AllOfValidator.kt @@ -16,4 +16,4 @@ class AllOfValidator : KeywordValidator { } return pathToSchemas } -} +} \ No newline at end of file diff --git a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/schemas/validation/AnyOfValidator.kt b/samples/client/3_0_3_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/schemas/validation/AnyOfValidator.kt similarity index 99% rename from samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/schemas/validation/AnyOfValidator.kt rename to samples/client/3_0_3_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/schemas/validation/AnyOfValidator.kt index 31dd5ce3041..b264835903b 100644 --- a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/schemas/validation/AnyOfValidator.kt +++ b/samples/client/3_0_3_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/schemas/validation/AnyOfValidator.kt @@ -36,4 +36,4 @@ class AnyOfValidator : KeywordValidator { } return pathToSchemas } -} +} \ No newline at end of file diff --git a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/schemas/validation/BigDecimalValidator.kt b/samples/client/3_0_3_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/schemas/validation/BigDecimalValidator.kt similarity index 99% rename from samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/schemas/validation/BigDecimalValidator.kt rename to samples/client/3_0_3_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/schemas/validation/BigDecimalValidator.kt index ea662867a25..7d9535004a2 100644 --- a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/schemas/validation/BigDecimalValidator.kt +++ b/samples/client/3_0_3_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/schemas/validation/BigDecimalValidator.kt @@ -1,6 +1,7 @@ package org.openapijsonschematools.client.schemas.validation import org.openapijsonschematools.client.exceptions.ValidationException + import java.math.BigDecimal abstract class BigDecimalValidator { diff --git a/samples/client/3_0_3_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/schemas/validation/BooleanEnumValidator.kt b/samples/client/3_0_3_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/schemas/validation/BooleanEnumValidator.kt new file mode 100644 index 00000000000..a6a943fd3b3 --- /dev/null +++ b/samples/client/3_0_3_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/schemas/validation/BooleanEnumValidator.kt @@ -0,0 +1,9 @@ +package org.openapijsonschematools.client.schemas.validation + +import org.openapijsonschematools.client.configurations.SchemaConfiguration +import org.openapijsonschematools.client.exceptions.ValidationException + +interface BooleanEnumValidator { + @Throws(ValidationException::class) + fun validate(arg: EnumType, configuration: SchemaConfiguration?): Boolean +} \ No newline at end of file diff --git a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/schemas/validation/BooleanSchemaValidator.kt b/samples/client/3_0_3_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/schemas/validation/BooleanSchemaValidator.kt similarity index 100% rename from samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/schemas/validation/BooleanSchemaValidator.kt rename to samples/client/3_0_3_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/schemas/validation/BooleanSchemaValidator.kt diff --git a/samples/client/3_0_3_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/schemas/validation/BooleanValueMethod.kt b/samples/client/3_0_3_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/schemas/validation/BooleanValueMethod.kt new file mode 100644 index 00000000000..1843f88eae3 --- /dev/null +++ b/samples/client/3_0_3_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/schemas/validation/BooleanValueMethod.kt @@ -0,0 +1,5 @@ +package org.openapijsonschematools.client.schemas.validation + +interface BooleanValueMethod { + fun value(): Boolean +} \ No newline at end of file diff --git a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/schemas/validation/ConstValidator.kt b/samples/client/3_0_3_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/schemas/validation/ConstValidator.kt similarity index 99% rename from samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/schemas/validation/ConstValidator.kt rename to samples/client/3_0_3_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/schemas/validation/ConstValidator.kt index 7abc259d734..9ecd5a5534f 100644 --- a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/schemas/validation/ConstValidator.kt +++ b/samples/client/3_0_3_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/schemas/validation/ConstValidator.kt @@ -1,6 +1,7 @@ package org.openapijsonschematools.client.schemas.validation import org.openapijsonschematools.client.exceptions.ValidationException + import java.math.BigDecimal class ConstValidator : BigDecimalValidator(), KeywordValidator { diff --git a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/schemas/validation/ContainsValidator.kt b/samples/client/3_0_3_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/schemas/validation/ContainsValidator.kt similarity index 100% rename from samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/schemas/validation/ContainsValidator.kt rename to samples/client/3_0_3_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/schemas/validation/ContainsValidator.kt diff --git a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/schemas/validation/CustomIsoparser.kt b/samples/client/3_0_3_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/schemas/validation/CustomIsoparser.kt similarity index 100% rename from samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/schemas/validation/CustomIsoparser.kt rename to samples/client/3_0_3_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/schemas/validation/CustomIsoparser.kt index 0728ffd7151..65afa14827f 100644 --- a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/schemas/validation/CustomIsoparser.kt +++ b/samples/client/3_0_3_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/schemas/validation/CustomIsoparser.kt @@ -1,7 +1,7 @@ package org.openapijsonschematools.client.schemas.validation -import java.time.LocalDate import java.time.ZonedDateTime +import java.time.LocalDate class CustomIsoparser { companion object { diff --git a/samples/client/3_0_3_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/schemas/validation/DefaultValueMethod.kt b/samples/client/3_0_3_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/schemas/validation/DefaultValueMethod.kt new file mode 100644 index 00000000000..7f8a8cbfddd --- /dev/null +++ b/samples/client/3_0_3_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/schemas/validation/DefaultValueMethod.kt @@ -0,0 +1,8 @@ +package org.openapijsonschematools.client.schemas.validation + +import org.openapijsonschematools.client.exceptions.ValidationException + +interface DefaultValueMethod { + @Throws(ValidationException::class) + fun defaultValue(): T +} \ No newline at end of file diff --git a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/schemas/validation/DependentRequiredValidator.kt b/samples/client/3_0_3_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/schemas/validation/DependentRequiredValidator.kt similarity index 99% rename from samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/schemas/validation/DependentRequiredValidator.kt rename to samples/client/3_0_3_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/schemas/validation/DependentRequiredValidator.kt index d475c422292..d968b55d980 100644 --- a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/schemas/validation/DependentRequiredValidator.kt +++ b/samples/client/3_0_3_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/schemas/validation/DependentRequiredValidator.kt @@ -33,4 +33,4 @@ class DependentRequiredValidator : KeywordValidator { } return null } -} +} \ No newline at end of file diff --git a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/schemas/validation/DependentSchemasValidator.kt b/samples/client/3_0_3_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/schemas/validation/DependentSchemasValidator.kt similarity index 87% rename from samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/schemas/validation/DependentSchemasValidator.kt rename to samples/client/3_0_3_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/schemas/validation/DependentSchemasValidator.kt index 83f8f6de5c4..889ede258bc 100644 --- a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/schemas/validation/DependentSchemasValidator.kt +++ b/samples/client/3_0_3_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/schemas/validation/DependentSchemasValidator.kt @@ -1,7 +1,6 @@ package org.openapijsonschematools.client.schemas.validation import org.openapijsonschematools.client.exceptions.ValidationException -import org.openapijsonschematools.client.schemas.validation.JsonSchemaFactory.getInstance class DependentSchemasValidator : KeywordValidator { @Throws(ValidationException::class) @@ -23,7 +22,7 @@ class DependentSchemasValidator : KeywordValidator { if (!presentProperties.contains(propName)) { continue } - val dependentSchema = getInstance(dependentSchemaClass) + val dependentSchema = JsonSchemaFactory.getInstance(dependentSchemaClass) val otherPathToSchemas = JsonSchema.validate(dependentSchema, data.arg, data.validationMetadata) pathToSchemas.update(otherPathToSchemas) } diff --git a/samples/client/3_0_3_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/schemas/validation/DoubleEnumValidator.kt b/samples/client/3_0_3_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/schemas/validation/DoubleEnumValidator.kt new file mode 100644 index 00000000000..d2f2abe26bb --- /dev/null +++ b/samples/client/3_0_3_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/schemas/validation/DoubleEnumValidator.kt @@ -0,0 +1,9 @@ +package org.openapijsonschematools.client.schemas.validation + +import org.openapijsonschematools.client.configurations.SchemaConfiguration +import org.openapijsonschematools.client.exceptions.ValidationException + +interface DoubleEnumValidator { + @Throws(ValidationException::class) + fun validate(arg: EnumType, configuration: SchemaConfiguration?): Double +} \ No newline at end of file diff --git a/samples/client/3_0_3_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/schemas/validation/DoubleValueMethod.kt b/samples/client/3_0_3_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/schemas/validation/DoubleValueMethod.kt new file mode 100644 index 00000000000..72223e0152a --- /dev/null +++ b/samples/client/3_0_3_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/schemas/validation/DoubleValueMethod.kt @@ -0,0 +1,5 @@ +package org.openapijsonschematools.client.schemas.validation + +interface DoubleValueMethod { + fun value(): Double +} \ No newline at end of file diff --git a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/schemas/validation/ElseValidator.kt b/samples/client/3_0_3_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/schemas/validation/ElseValidator.kt similarity index 99% rename from samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/schemas/validation/ElseValidator.kt rename to samples/client/3_0_3_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/schemas/validation/ElseValidator.kt index f6e367b3bd9..9cf161f6255 100644 --- a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/schemas/validation/ElseValidator.kt +++ b/samples/client/3_0_3_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/schemas/validation/ElseValidator.kt @@ -22,4 +22,4 @@ class ElseValidator : KeywordValidator { pathToSchemas.update(elsePathToSchemas) return pathToSchemas } -} +} \ No newline at end of file diff --git a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/schemas/validation/EnumValidator.kt b/samples/client/3_0_3_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/schemas/validation/EnumValidator.kt similarity index 99% rename from samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/schemas/validation/EnumValidator.kt rename to samples/client/3_0_3_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/schemas/validation/EnumValidator.kt index a7435100340..f07075606ac 100644 --- a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/schemas/validation/EnumValidator.kt +++ b/samples/client/3_0_3_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/schemas/validation/EnumValidator.kt @@ -1,6 +1,7 @@ package org.openapijsonschematools.client.schemas.validation import org.openapijsonschematools.client.exceptions.ValidationException + import java.math.BigDecimal class EnumValidator : BigDecimalValidator(), KeywordValidator { @@ -35,4 +36,4 @@ class EnumValidator : BigDecimalValidator(), KeywordValidator { return enumValues.contains(arg) } } -} +} \ No newline at end of file diff --git a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/schemas/validation/ExclusiveMaximumValidator.kt b/samples/client/3_0_3_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/schemas/validation/ExclusiveMaximumValidator.kt similarity index 100% rename from samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/schemas/validation/ExclusiveMaximumValidator.kt rename to samples/client/3_0_3_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/schemas/validation/ExclusiveMaximumValidator.kt diff --git a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/schemas/validation/ExclusiveMinimumValidator.kt b/samples/client/3_0_3_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/schemas/validation/ExclusiveMinimumValidator.kt similarity index 100% rename from samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/schemas/validation/ExclusiveMinimumValidator.kt rename to samples/client/3_0_3_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/schemas/validation/ExclusiveMinimumValidator.kt diff --git a/samples/client/3_0_3_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/schemas/validation/FloatEnumValidator.kt b/samples/client/3_0_3_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/schemas/validation/FloatEnumValidator.kt new file mode 100644 index 00000000000..9603f2a6468 --- /dev/null +++ b/samples/client/3_0_3_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/schemas/validation/FloatEnumValidator.kt @@ -0,0 +1,9 @@ +package org.openapijsonschematools.client.schemas.validation + +import org.openapijsonschematools.client.configurations.SchemaConfiguration +import org.openapijsonschematools.client.exceptions.ValidationException + +interface FloatEnumValidator { + @Throws(ValidationException::class) + fun validate(arg: EnumType, configuration: SchemaConfiguration?): Float +} \ No newline at end of file diff --git a/samples/client/3_0_3_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/schemas/validation/FloatValueMethod.kt b/samples/client/3_0_3_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/schemas/validation/FloatValueMethod.kt new file mode 100644 index 00000000000..23a2817fc0e --- /dev/null +++ b/samples/client/3_0_3_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/schemas/validation/FloatValueMethod.kt @@ -0,0 +1,5 @@ +package org.openapijsonschematools.client.schemas.validation + +interface FloatValueMethod { + fun value(): Float +} \ No newline at end of file diff --git a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/schemas/validation/FormatValidator.kt b/samples/client/3_0_3_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/schemas/validation/FormatValidator.kt similarity index 99% rename from samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/schemas/validation/FormatValidator.kt rename to samples/client/3_0_3_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/schemas/validation/FormatValidator.kt index a9b86d4e635..47673b8c868 100644 --- a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/schemas/validation/FormatValidator.kt +++ b/samples/client/3_0_3_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/schemas/validation/FormatValidator.kt @@ -165,4 +165,4 @@ class FormatValidator : KeywordValidator { } } } -} +} \ No newline at end of file diff --git a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/schemas/validation/FrozenList.kt b/samples/client/3_0_3_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/schemas/validation/FrozenList.kt similarity index 99% rename from samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/schemas/validation/FrozenList.kt rename to samples/client/3_0_3_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/schemas/validation/FrozenList.kt index 5aa24bf1b9b..94451c44c38 100644 --- a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/schemas/validation/FrozenList.kt +++ b/samples/client/3_0_3_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/schemas/validation/FrozenList.kt @@ -19,3 +19,4 @@ open class FrozenList(m: Collection) : AbstractList() { return list[index] } } + diff --git a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/schemas/validation/FrozenMap.kt b/samples/client/3_0_3_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/schemas/validation/FrozenMap.kt similarity index 99% rename from samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/schemas/validation/FrozenMap.kt rename to samples/client/3_0_3_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/schemas/validation/FrozenMap.kt index def24dec10e..cce76fb8bad 100644 --- a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/schemas/validation/FrozenMap.kt +++ b/samples/client/3_0_3_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/schemas/validation/FrozenMap.kt @@ -1,7 +1,7 @@ package org.openapijsonschematools.client.schemas.validation -import org.openapijsonschematools.client.exceptions.InvalidAdditionalPropertyException import org.openapijsonschematools.client.exceptions.UnsetPropertyException +import org.openapijsonschematools.client.exceptions.InvalidAdditionalPropertyException open class FrozenMap(m: Map) : AbstractMap() { /* @@ -41,3 +41,4 @@ open class FrozenMap(m: Map) : AbstractMap() { override val entries: Set> get() = map.entries } + diff --git a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/schemas/validation/IfValidator.kt b/samples/client/3_0_3_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/schemas/validation/IfValidator.kt similarity index 99% rename from samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/schemas/validation/IfValidator.kt rename to samples/client/3_0_3_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/schemas/validation/IfValidator.kt index 5e4e086bfe5..2a55d6b3528 100644 --- a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/schemas/validation/IfValidator.kt +++ b/samples/client/3_0_3_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/schemas/validation/IfValidator.kt @@ -23,4 +23,4 @@ class IfValidator : KeywordValidator { */ return null } -} +} \ No newline at end of file diff --git a/samples/client/3_0_3_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/schemas/validation/IntegerEnumValidator.kt b/samples/client/3_0_3_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/schemas/validation/IntegerEnumValidator.kt new file mode 100644 index 00000000000..210f0e4dea7 --- /dev/null +++ b/samples/client/3_0_3_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/schemas/validation/IntegerEnumValidator.kt @@ -0,0 +1,9 @@ +package org.openapijsonschematools.client.schemas.validation + +import org.openapijsonschematools.client.configurations.SchemaConfiguration +import org.openapijsonschematools.client.exceptions.ValidationException + +interface IntegerEnumValidator { + @Throws(ValidationException::class) + fun validate(arg: EnumType, configuration: SchemaConfiguration?): Int +} \ No newline at end of file diff --git a/samples/client/3_0_3_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/schemas/validation/IntegerValueMethod.kt b/samples/client/3_0_3_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/schemas/validation/IntegerValueMethod.kt new file mode 100644 index 00000000000..84961e6aa44 --- /dev/null +++ b/samples/client/3_0_3_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/schemas/validation/IntegerValueMethod.kt @@ -0,0 +1,5 @@ +package org.openapijsonschematools.client.schemas.validation + +interface IntegerValueMethod { + fun value(): Int +} \ No newline at end of file diff --git a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/schemas/validation/ItemsValidator.kt b/samples/client/3_0_3_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/schemas/validation/ItemsValidator.kt similarity index 100% rename from samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/schemas/validation/ItemsValidator.kt rename to samples/client/3_0_3_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/schemas/validation/ItemsValidator.kt diff --git a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/schemas/validation/JsonSchema.kt b/samples/client/3_0_3_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/schemas/validation/JsonSchema.kt similarity index 97% rename from samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/schemas/validation/JsonSchema.kt rename to samples/client/3_0_3_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/schemas/validation/JsonSchema.kt index 3af35c88274..a4e79ca4c1a 100644 --- a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/schemas/validation/JsonSchema.kt +++ b/samples/client/3_0_3_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/schemas/validation/JsonSchema.kt @@ -399,19 +399,19 @@ abstract class JsonSchema protected constructor(jsonSchemaInfo: JsonSchemaInf } } - fun getNewInstance(arg: Nothing?, pathToItem: List, pathToSchemas: PathToSchemasMap): Nothing? { + protected fun getNewInstance(arg: Nothing?, pathToItem: List, pathToSchemas: PathToSchemasMap): Nothing? { return arg } - fun getNewInstance(arg: Boolean, pathToItem: List, pathToSchemas: PathToSchemasMap): Boolean { + protected fun getNewInstance(arg: Boolean, pathToItem: List, pathToSchemas: PathToSchemasMap): Boolean { return arg } - fun getNewInstance(arg: Number, pathToItem: List, pathToSchemas: PathToSchemasMap): Number { + protected fun getNewInstance(arg: Number, pathToItem: List, pathToSchemas: PathToSchemasMap): Number { return arg } - fun getNewInstance(arg: String, pathToItem: List, pathToSchemas: PathToSchemasMap): String { + protected fun getNewInstance(arg: String, pathToItem: List, pathToSchemas: PathToSchemasMap): String { return arg } diff --git a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/schemas/validation/JsonSchemaFactory.kt b/samples/client/3_0_3_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/schemas/validation/JsonSchemaFactory.kt similarity index 83% rename from samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/schemas/validation/JsonSchemaFactory.kt rename to samples/client/3_0_3_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/schemas/validation/JsonSchemaFactory.kt index d50c630a275..3de64242080 100644 --- a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/schemas/validation/JsonSchemaFactory.kt +++ b/samples/client/3_0_3_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/schemas/validation/JsonSchemaFactory.kt @@ -12,8 +12,9 @@ object JsonSchemaFactory { return schemaCls.cast(it) } try { - val method = schemaCls.getMethod("getInstance") - val obj = method.invoke(null) + val companion = schemaCls.declaredClasses[0] + val method = companion.getMethod("getInstance") + val obj = method.invoke(companion.kotlin.objectInstance) assert(schemaCls.isInstance(obj)) val inst = schemaCls.cast(obj) classToInstance[schemaCls] = inst diff --git a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/schemas/validation/JsonSchemaInfo.kt b/samples/client/3_0_3_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/schemas/validation/JsonSchemaInfo.kt similarity index 57% rename from samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/schemas/validation/JsonSchemaInfo.kt rename to samples/client/3_0_3_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/schemas/validation/JsonSchemaInfo.kt index 865401ff096..b36f28c46a4 100644 --- a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/schemas/validation/JsonSchemaInfo.kt +++ b/samples/client/3_0_3_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/schemas/validation/JsonSchemaInfo.kt @@ -5,145 +5,145 @@ import java.util.regex.Pattern class JsonSchemaInfo { var type: Set>? = null - fun type(type: Set>?): JsonSchemaInfo { + fun type(type: Set>): JsonSchemaInfo { this.type = type return this } var format: String? = null - fun format(format: String?): JsonSchemaInfo { + fun format(format: String): JsonSchemaInfo { this.format = format return this } - var items: Class?>? = null - fun items(items: Class?>?): JsonSchemaInfo { + var items: Class>? = null + fun items(items: Class>): JsonSchemaInfo { this.items = items return this } - var properties: Map?>>? = null - fun properties(properties: Map?>>?): JsonSchemaInfo { + var properties: Map>>? = null + fun properties(properties: Map>>): JsonSchemaInfo { this.properties = properties return this } var required: Set? = null - fun required(required: Set?): JsonSchemaInfo { + fun required(required: Set): JsonSchemaInfo { this.required = required return this } var exclusiveMaximum: Number? = null - fun exclusiveMaximum(exclusiveMaximum: Number?): JsonSchemaInfo { + fun exclusiveMaximum(exclusiveMaximum: Number): JsonSchemaInfo { this.exclusiveMaximum = exclusiveMaximum return this } var exclusiveMinimum: Number? = null - fun exclusiveMinimum(exclusiveMinimum: Number?): JsonSchemaInfo { + fun exclusiveMinimum(exclusiveMinimum: Number): JsonSchemaInfo { this.exclusiveMinimum = exclusiveMinimum return this } var maxItems: Int? = null - fun maxItems(maxItems: Int?): JsonSchemaInfo { + fun maxItems(maxItems: Int): JsonSchemaInfo { this.maxItems = maxItems return this } var minItems: Int? = null - fun minItems(minItems: Int?): JsonSchemaInfo { + fun minItems(minItems: Int): JsonSchemaInfo { this.minItems = minItems return this } var maxLength: Int? = null - fun maxLength(maxLength: Int?): JsonSchemaInfo { + fun maxLength(maxLength: Int): JsonSchemaInfo { this.maxLength = maxLength return this } var minLength: Int? = null - fun minLength(minLength: Int?): JsonSchemaInfo { + fun minLength(minLength: Int): JsonSchemaInfo { this.minLength = minLength return this } var maxProperties: Int? = null - fun maxProperties(maxProperties: Int?): JsonSchemaInfo { + fun maxProperties(maxProperties: Int): JsonSchemaInfo { this.maxProperties = maxProperties return this } var minProperties: Int? = null - fun minProperties(minProperties: Int?): JsonSchemaInfo { + fun minProperties(minProperties: Int): JsonSchemaInfo { this.minProperties = minProperties return this } var maximum: Number? = null - fun maximum(maximum: Number?): JsonSchemaInfo { + fun maximum(maximum: Number): JsonSchemaInfo { this.maximum = maximum return this } var minimum: Number? = null - fun minimum(minimum: Number?): JsonSchemaInfo { + fun minimum(minimum: Number): JsonSchemaInfo { this.minimum = minimum return this } var multipleOf: BigDecimal? = null - fun multipleOf(multipleOf: BigDecimal?): JsonSchemaInfo { + fun multipleOf(multipleOf: BigDecimal): JsonSchemaInfo { this.multipleOf = multipleOf return this } - var additionalProperties: Class?>? = null - fun additionalProperties(additionalProperties: Class?>?): JsonSchemaInfo { + var additionalProperties: Class>? = null + fun additionalProperties(additionalProperties: Class>): JsonSchemaInfo { this.additionalProperties = additionalProperties return this } - var allOf: List?>>? = null - fun allOf(allOf: List?>>?): JsonSchemaInfo { + var allOf: List>>? = null + fun allOf(allOf: List>>): JsonSchemaInfo { this.allOf = allOf return this } - var anyOf: List?>>? = null - fun anyOf(anyOf: List?>>?): JsonSchemaInfo { + var anyOf: List>>? = null + fun anyOf(anyOf: List>>): JsonSchemaInfo { this.anyOf = anyOf return this } - var oneOf: List?>>? = null - fun oneOf(oneOf: List?>>?): JsonSchemaInfo { + var oneOf: List>>? = null + fun oneOf(oneOf: List>>): JsonSchemaInfo { this.oneOf = oneOf return this } - var not: Class?>? = null - fun not(not: Class?>?): JsonSchemaInfo { + var not: Class>? = null + fun not(not: Class>): JsonSchemaInfo { this.not = not return this } var uniqueItems: Boolean? = null - fun uniqueItems(uniqueItems: Boolean?): JsonSchemaInfo { + fun uniqueItems(uniqueItems: Boolean): JsonSchemaInfo { this.uniqueItems = uniqueItems return this } var enumValues: Set? = null - fun enumValues(enumValues: Set?): JsonSchemaInfo { + fun enumValues(enumValues: Set): JsonSchemaInfo { this.enumValues = enumValues return this } var pattern: Pattern? = null - fun pattern(pattern: Pattern?): JsonSchemaInfo { + fun pattern(pattern: Pattern): JsonSchemaInfo { this.pattern = pattern return this } @@ -164,80 +164,80 @@ class JsonSchemaInfo { return this } - var contains: Class?>? = null - fun contains(contains: Class?>?): JsonSchemaInfo { + var contains: Class>? = null + fun contains(contains: Class>): JsonSchemaInfo { this.contains = contains return this } var maxContains: Int? = null - fun maxContains(maxContains: Int?): JsonSchemaInfo { + fun maxContains(maxContains: Int): JsonSchemaInfo { this.maxContains = maxContains return this } var minContains: Int? = null - fun minContains(minContains: Int?): JsonSchemaInfo { + fun minContains(minContains: Int): JsonSchemaInfo { this.minContains = minContains return this } - var propertyNames: Class?>? = null - fun propertyNames(propertyNames: Class?>?): JsonSchemaInfo { + var propertyNames: Class>? = null + fun propertyNames(propertyNames: Class>): JsonSchemaInfo { this.propertyNames = propertyNames return this } var dependentRequired: Map>? = null - fun dependentRequired(dependentRequired: Map>?): JsonSchemaInfo { + fun dependentRequired(dependentRequired: Map>): JsonSchemaInfo { this.dependentRequired = dependentRequired return this } - var dependentSchemas: Map?>>? = null - fun dependentSchemas(dependentSchemas: Map?>>?): JsonSchemaInfo { + var dependentSchemas: Map>>? = null + fun dependentSchemas(dependentSchemas: Map>>): JsonSchemaInfo { this.dependentSchemas = dependentSchemas return this } - var patternProperties: Map?>>? = null - fun patternProperties(patternProperties: Map?>>?): JsonSchemaInfo { + var patternProperties: Map>>? = null + fun patternProperties(patternProperties: Map>>): JsonSchemaInfo { this.patternProperties = patternProperties return this } - var prefixItems: List?>>? = null - fun prefixItems(prefixItems: List?>>?): JsonSchemaInfo { + var prefixItems: List>>? = null + fun prefixItems(prefixItems: List>>): JsonSchemaInfo { this.prefixItems = prefixItems return this } - var ifSchema: Class?>? = null - fun ifSchema(ifSchema: Class?>?): JsonSchemaInfo { + var ifSchema: Class>? = null + fun ifSchema(ifSchema: Class>): JsonSchemaInfo { this.ifSchema = ifSchema return this } - var then: Class?>? = null - fun then(then: Class?>?): JsonSchemaInfo { + var then: Class>? = null + fun then(then: Class>): JsonSchemaInfo { this.then = then return this } - var elseSchema: Class?>? = null - fun elseSchema(elseSchema: Class?>?): JsonSchemaInfo { + var elseSchema: Class>? = null + fun elseSchema(elseSchema: Class>): JsonSchemaInfo { this.elseSchema = elseSchema return this } - var unevaluatedItems: Class?>? = null - fun unevaluatedItems(unevaluatedItems: Class?>?): JsonSchemaInfo { + var unevaluatedItems: Class>? = null + fun unevaluatedItems(unevaluatedItems: Class>): JsonSchemaInfo { this.unevaluatedItems = unevaluatedItems return this } - var unevaluatedProperties: Class?>? = null - fun unevaluatedProperties(unevaluatedProperties: Class?>?): JsonSchemaInfo { + var unevaluatedProperties: Class>? = null + fun unevaluatedProperties(unevaluatedProperties: Class>): JsonSchemaInfo { this.unevaluatedProperties = unevaluatedProperties return this } diff --git a/samples/client/3_0_3_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/schemas/validation/KeywordEntry.kt b/samples/client/3_0_3_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/schemas/validation/KeywordEntry.kt new file mode 100644 index 00000000000..59e9d5bec4f --- /dev/null +++ b/samples/client/3_0_3_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/schemas/validation/KeywordEntry.kt @@ -0,0 +1,6 @@ +package org.openapijsonschematools.client.schemas.validation + +import java.util.AbstractMap + +class KeywordEntry(key: String, value: KeywordValidator) : + AbstractMap.SimpleEntry(key, value) diff --git a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/schemas/validation/KeywordValidator.kt b/samples/client/3_0_3_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/schemas/validation/KeywordValidator.kt similarity index 100% rename from samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/schemas/validation/KeywordValidator.kt rename to samples/client/3_0_3_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/schemas/validation/KeywordValidator.kt diff --git a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/schemas/validation/LengthValidator.kt b/samples/client/3_0_3_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/schemas/validation/LengthValidator.kt similarity index 100% rename from samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/schemas/validation/LengthValidator.kt rename to samples/client/3_0_3_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/schemas/validation/LengthValidator.kt diff --git a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/schemas/validation/ListSchemaValidator.kt b/samples/client/3_0_3_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/schemas/validation/ListSchemaValidator.kt similarity index 100% rename from samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/schemas/validation/ListSchemaValidator.kt rename to samples/client/3_0_3_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/schemas/validation/ListSchemaValidator.kt diff --git a/samples/client/3_0_3_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/schemas/validation/LongEnumValidator.kt b/samples/client/3_0_3_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/schemas/validation/LongEnumValidator.kt new file mode 100644 index 00000000000..c8fc6db061f --- /dev/null +++ b/samples/client/3_0_3_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/schemas/validation/LongEnumValidator.kt @@ -0,0 +1,9 @@ +package org.openapijsonschematools.client.schemas.validation + +import org.openapijsonschematools.client.configurations.SchemaConfiguration +import org.openapijsonschematools.client.exceptions.ValidationException + +interface LongEnumValidator { + @Throws(ValidationException::class) + fun validate(arg: EnumType, configuration: SchemaConfiguration?): Long +} \ No newline at end of file diff --git a/samples/client/3_0_3_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/schemas/validation/LongValueMethod.kt b/samples/client/3_0_3_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/schemas/validation/LongValueMethod.kt new file mode 100644 index 00000000000..8d1f0ddc419 --- /dev/null +++ b/samples/client/3_0_3_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/schemas/validation/LongValueMethod.kt @@ -0,0 +1,5 @@ +package org.openapijsonschematools.client.schemas.validation + +interface LongValueMethod { + fun value(): Long +} \ No newline at end of file diff --git a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/schemas/validation/MapSchemaValidator.kt b/samples/client/3_0_3_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/schemas/validation/MapSchemaValidator.kt similarity index 100% rename from samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/schemas/validation/MapSchemaValidator.kt rename to samples/client/3_0_3_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/schemas/validation/MapSchemaValidator.kt diff --git a/samples/client/3_0_3_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/schemas/validation/MapUtils.kt b/samples/client/3_0_3_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/schemas/validation/MapUtils.kt new file mode 100644 index 00000000000..5e6a8383648 --- /dev/null +++ b/samples/client/3_0_3_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/schemas/validation/MapUtils.kt @@ -0,0 +1,35 @@ +package org.openapijsonschematools.client.schemas.validation + +import org.openapijsonschematools.client.exceptions.InvalidAdditionalPropertyException + +class MapUtils { + companion object { + /** + * A builder for maps that allows in null values + * Schema tests + doc code samples need it + * @param entries items to add + * @return the output map + * @param key type + * @param value type + */ + @SafeVarargs + fun makeMap(vararg entries: Map.Entry): Map { + val map: MutableMap = HashMap() + for ((key, value) in entries) { + map[key] = value + } + return map + } + + @Throws(InvalidAdditionalPropertyException::class) + fun throwIfKeyKnown(key: String, knownKeys: Set, setting: Boolean) { + if (knownKeys.contains(key)) { + var verb = "getting" + if (setting) { + verb = "setting" + } + throw InvalidAdditionalPropertyException("The known key $key may not be passed in when $verb an additional property") + } + } + } +} \ No newline at end of file diff --git a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/schemas/validation/MaxContainsValidator.kt b/samples/client/3_0_3_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/schemas/validation/MaxContainsValidator.kt similarity index 100% rename from samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/schemas/validation/MaxContainsValidator.kt rename to samples/client/3_0_3_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/schemas/validation/MaxContainsValidator.kt diff --git a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/schemas/validation/MaxItemsValidator.kt b/samples/client/3_0_3_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/schemas/validation/MaxItemsValidator.kt similarity index 100% rename from samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/schemas/validation/MaxItemsValidator.kt rename to samples/client/3_0_3_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/schemas/validation/MaxItemsValidator.kt diff --git a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/schemas/validation/MaxLengthValidator.kt b/samples/client/3_0_3_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/schemas/validation/MaxLengthValidator.kt similarity index 100% rename from samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/schemas/validation/MaxLengthValidator.kt rename to samples/client/3_0_3_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/schemas/validation/MaxLengthValidator.kt diff --git a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/schemas/validation/MaxPropertiesValidator.kt b/samples/client/3_0_3_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/schemas/validation/MaxPropertiesValidator.kt similarity index 99% rename from samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/schemas/validation/MaxPropertiesValidator.kt rename to samples/client/3_0_3_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/schemas/validation/MaxPropertiesValidator.kt index 44b5a773ad9..1287a6b789f 100644 --- a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/schemas/validation/MaxPropertiesValidator.kt +++ b/samples/client/3_0_3_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/schemas/validation/MaxPropertiesValidator.kt @@ -16,4 +16,4 @@ class MaxPropertiesValidator : KeywordValidator { } return null } -} +} \ No newline at end of file diff --git a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/schemas/validation/MaximumValidator.kt b/samples/client/3_0_3_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/schemas/validation/MaximumValidator.kt similarity index 100% rename from samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/schemas/validation/MaximumValidator.kt rename to samples/client/3_0_3_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/schemas/validation/MaximumValidator.kt diff --git a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/schemas/validation/MinContainsValidator.kt b/samples/client/3_0_3_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/schemas/validation/MinContainsValidator.kt similarity index 100% rename from samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/schemas/validation/MinContainsValidator.kt rename to samples/client/3_0_3_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/schemas/validation/MinContainsValidator.kt diff --git a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/schemas/validation/MinItemsValidator.kt b/samples/client/3_0_3_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/schemas/validation/MinItemsValidator.kt similarity index 99% rename from samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/schemas/validation/MinItemsValidator.kt rename to samples/client/3_0_3_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/schemas/validation/MinItemsValidator.kt index 26d4e218e0e..0f92b86cdc8 100644 --- a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/schemas/validation/MinItemsValidator.kt +++ b/samples/client/3_0_3_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/schemas/validation/MinItemsValidator.kt @@ -16,4 +16,4 @@ class MinItemsValidator : KeywordValidator { } return null } -} +} \ No newline at end of file diff --git a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/schemas/validation/MinLengthValidator.kt b/samples/client/3_0_3_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/schemas/validation/MinLengthValidator.kt similarity index 100% rename from samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/schemas/validation/MinLengthValidator.kt rename to samples/client/3_0_3_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/schemas/validation/MinLengthValidator.kt diff --git a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/schemas/validation/MinPropertiesValidator.kt b/samples/client/3_0_3_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/schemas/validation/MinPropertiesValidator.kt similarity index 99% rename from samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/schemas/validation/MinPropertiesValidator.kt rename to samples/client/3_0_3_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/schemas/validation/MinPropertiesValidator.kt index a28e4137356..01a2828c523 100644 --- a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/schemas/validation/MinPropertiesValidator.kt +++ b/samples/client/3_0_3_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/schemas/validation/MinPropertiesValidator.kt @@ -16,4 +16,4 @@ class MinPropertiesValidator : KeywordValidator { } return null } -} +} \ No newline at end of file diff --git a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/schemas/validation/MinimumValidator.kt b/samples/client/3_0_3_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/schemas/validation/MinimumValidator.kt similarity index 99% rename from samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/schemas/validation/MinimumValidator.kt rename to samples/client/3_0_3_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/schemas/validation/MinimumValidator.kt index 65c7323f362..89cfc38f73a 100644 --- a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/schemas/validation/MinimumValidator.kt +++ b/samples/client/3_0_3_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/schemas/validation/MinimumValidator.kt @@ -39,4 +39,4 @@ class MinimumValidator : KeywordValidator { } return null } -} +} \ No newline at end of file diff --git a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/schemas/validation/MultipleOfValidator.kt b/samples/client/3_0_3_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/schemas/validation/MultipleOfValidator.kt similarity index 99% rename from samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/schemas/validation/MultipleOfValidator.kt rename to samples/client/3_0_3_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/schemas/validation/MultipleOfValidator.kt index 8af9262ff80..a1bf8794ae3 100644 --- a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/schemas/validation/MultipleOfValidator.kt +++ b/samples/client/3_0_3_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/schemas/validation/MultipleOfValidator.kt @@ -1,6 +1,7 @@ package org.openapijsonschematools.client.schemas.validation import org.openapijsonschematools.client.exceptions.ValidationException + import java.math.BigDecimal class MultipleOfValidator : BigDecimalValidator(), KeywordValidator { diff --git a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/schemas/validation/NotValidator.kt b/samples/client/3_0_3_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/schemas/validation/NotValidator.kt similarity index 100% rename from samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/schemas/validation/NotValidator.kt rename to samples/client/3_0_3_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/schemas/validation/NotValidator.kt diff --git a/samples/client/3_0_3_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/schemas/validation/NullEnumValidator.kt b/samples/client/3_0_3_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/schemas/validation/NullEnumValidator.kt new file mode 100644 index 00000000000..7f3f09ebd70 --- /dev/null +++ b/samples/client/3_0_3_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/schemas/validation/NullEnumValidator.kt @@ -0,0 +1,9 @@ +package org.openapijsonschematools.client.schemas.validation + +import org.openapijsonschematools.client.configurations.SchemaConfiguration +import org.openapijsonschematools.client.exceptions.ValidationException + +interface NullEnumValidator { + @Throws(ValidationException::class) + fun validate(arg: EnumType, configuration: SchemaConfiguration?): Nothing? +} \ No newline at end of file diff --git a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/schemas/validation/NullSchemaValidator.kt b/samples/client/3_0_3_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/schemas/validation/NullSchemaValidator.kt similarity index 100% rename from samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/schemas/validation/NullSchemaValidator.kt rename to samples/client/3_0_3_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/schemas/validation/NullSchemaValidator.kt diff --git a/samples/client/3_0_3_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/schemas/validation/NullValueMethod.kt b/samples/client/3_0_3_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/schemas/validation/NullValueMethod.kt new file mode 100644 index 00000000000..291eac2a663 --- /dev/null +++ b/samples/client/3_0_3_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/schemas/validation/NullValueMethod.kt @@ -0,0 +1,5 @@ +package org.openapijsonschematools.client.schemas.validation + +interface NullValueMethod { + fun value(): Nothing? +} \ No newline at end of file diff --git a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/schemas/validation/NumberSchemaValidator.kt b/samples/client/3_0_3_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/schemas/validation/NumberSchemaValidator.kt similarity index 100% rename from samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/schemas/validation/NumberSchemaValidator.kt rename to samples/client/3_0_3_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/schemas/validation/NumberSchemaValidator.kt diff --git a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/schemas/validation/OneOfValidator.kt b/samples/client/3_0_3_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/schemas/validation/OneOfValidator.kt similarity index 99% rename from samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/schemas/validation/OneOfValidator.kt rename to samples/client/3_0_3_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/schemas/validation/OneOfValidator.kt index 53be8889574..b11ae07f2c5 100644 --- a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/schemas/validation/OneOfValidator.kt +++ b/samples/client/3_0_3_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/schemas/validation/OneOfValidator.kt @@ -42,4 +42,4 @@ class OneOfValidator : KeywordValidator { } return pathToSchemas } -} +} \ No newline at end of file diff --git a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/schemas/validation/PathToSchemasMap.kt b/samples/client/3_0_3_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/schemas/validation/PathToSchemasMap.kt similarity index 100% rename from samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/schemas/validation/PathToSchemasMap.kt rename to samples/client/3_0_3_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/schemas/validation/PathToSchemasMap.kt diff --git a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/schemas/validation/PatternPropertiesValidator.kt b/samples/client/3_0_3_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/schemas/validation/PatternPropertiesValidator.kt similarity index 100% rename from samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/schemas/validation/PatternPropertiesValidator.kt rename to samples/client/3_0_3_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/schemas/validation/PatternPropertiesValidator.kt diff --git a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/schemas/validation/PatternValidator.kt b/samples/client/3_0_3_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/schemas/validation/PatternValidator.kt similarity index 99% rename from samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/schemas/validation/PatternValidator.kt rename to samples/client/3_0_3_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/schemas/validation/PatternValidator.kt index 1f9010a65a9..085c21a2943 100644 --- a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/schemas/validation/PatternValidator.kt +++ b/samples/client/3_0_3_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/schemas/validation/PatternValidator.kt @@ -1,6 +1,7 @@ package org.openapijsonschematools.client.schemas.validation import org.openapijsonschematools.client.exceptions.ValidationException + import java.util.regex.Pattern class PatternValidator : KeywordValidator { diff --git a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/schemas/validation/PrefixItemsValidator.kt b/samples/client/3_0_3_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/schemas/validation/PrefixItemsValidator.kt similarity index 99% rename from samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/schemas/validation/PrefixItemsValidator.kt rename to samples/client/3_0_3_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/schemas/validation/PrefixItemsValidator.kt index d79d74d14c2..6435a86bfe1 100644 --- a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/schemas/validation/PrefixItemsValidator.kt +++ b/samples/client/3_0_3_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/schemas/validation/PrefixItemsValidator.kt @@ -1,6 +1,7 @@ package org.openapijsonschematools.client.schemas.validation import org.openapijsonschematools.client.exceptions.ValidationException + import kotlin.math.min class PrefixItemsValidator : KeywordValidator { @@ -31,4 +32,4 @@ class PrefixItemsValidator : KeywordValidator { } return pathToSchemas } -} +} \ No newline at end of file diff --git a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/schemas/validation/PropertiesValidator.kt b/samples/client/3_0_3_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/schemas/validation/PropertiesValidator.kt similarity index 100% rename from samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/schemas/validation/PropertiesValidator.kt rename to samples/client/3_0_3_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/schemas/validation/PropertiesValidator.kt diff --git a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/schemas/validation/PropertyNamesValidator.kt b/samples/client/3_0_3_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/schemas/validation/PropertyNamesValidator.kt similarity index 100% rename from samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/schemas/validation/PropertyNamesValidator.kt rename to samples/client/3_0_3_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/schemas/validation/PropertyNamesValidator.kt diff --git a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/schemas/validation/RequiredValidator.kt b/samples/client/3_0_3_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/schemas/validation/RequiredValidator.kt similarity index 100% rename from samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/schemas/validation/RequiredValidator.kt rename to samples/client/3_0_3_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/schemas/validation/RequiredValidator.kt diff --git a/samples/client/3_0_3_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/schemas/validation/StringEnumValidator.kt b/samples/client/3_0_3_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/schemas/validation/StringEnumValidator.kt new file mode 100644 index 00000000000..c23532466f2 --- /dev/null +++ b/samples/client/3_0_3_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/schemas/validation/StringEnumValidator.kt @@ -0,0 +1,9 @@ +package org.openapijsonschematools.client.schemas.validation + +import org.openapijsonschematools.client.configurations.SchemaConfiguration +import org.openapijsonschematools.client.exceptions.ValidationException + +interface StringEnumValidator { + @Throws(ValidationException::class) + fun validate(arg: EnumType, configuration: SchemaConfiguration?): String +} \ No newline at end of file diff --git a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/schemas/validation/StringSchemaValidator.kt b/samples/client/3_0_3_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/schemas/validation/StringSchemaValidator.kt similarity index 100% rename from samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/schemas/validation/StringSchemaValidator.kt rename to samples/client/3_0_3_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/schemas/validation/StringSchemaValidator.kt diff --git a/samples/client/3_0_3_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/schemas/validation/StringValueMethod.kt b/samples/client/3_0_3_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/schemas/validation/StringValueMethod.kt new file mode 100644 index 00000000000..4e2ddeaf4e0 --- /dev/null +++ b/samples/client/3_0_3_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/schemas/validation/StringValueMethod.kt @@ -0,0 +1,5 @@ +package org.openapijsonschematools.client.schemas.validation + +interface StringValueMethod { + fun value(): String +} \ No newline at end of file diff --git a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/schemas/validation/ThenValidator.kt b/samples/client/3_0_3_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/schemas/validation/ThenValidator.kt similarity index 99% rename from samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/schemas/validation/ThenValidator.kt rename to samples/client/3_0_3_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/schemas/validation/ThenValidator.kt index 22221d1e40a..d63a1a36d18 100644 --- a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/schemas/validation/ThenValidator.kt +++ b/samples/client/3_0_3_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/schemas/validation/ThenValidator.kt @@ -23,4 +23,4 @@ class ThenValidator : KeywordValidator { pathToSchemas.update(thenPathToSchemas) return pathToSchemas } -} +} \ No newline at end of file diff --git a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/schemas/validation/TypeValidator.kt b/samples/client/3_0_3_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/schemas/validation/TypeValidator.kt similarity index 64% rename from samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/schemas/validation/TypeValidator.kt rename to samples/client/3_0_3_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/schemas/validation/TypeValidator.kt index ab39b361b91..635d85eb28c 100644 --- a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/schemas/validation/TypeValidator.kt +++ b/samples/client/3_0_3_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/schemas/validation/TypeValidator.kt @@ -15,11 +15,28 @@ class TypeValidator : KeywordValidator { Void::class.java } is List<*> -> { - MutableList::class.java + List::class.java } is Map<*, *> -> { - MutableMap::class.java + Map::class.java + } + + is Boolean -> { + Boolean::class.java + } + + is Int -> { + Int::class.java + } + is Long -> { + Long::class.java + } + is Double -> { + Double::class.java + } + is Float -> { + Float::class.java } else -> { @@ -31,4 +48,4 @@ class TypeValidator : KeywordValidator { } return null } -} +} \ No newline at end of file diff --git a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/schemas/validation/UnevaluatedItemsValidator.kt b/samples/client/3_0_3_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/schemas/validation/UnevaluatedItemsValidator.kt similarity index 99% rename from samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/schemas/validation/UnevaluatedItemsValidator.kt rename to samples/client/3_0_3_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/schemas/validation/UnevaluatedItemsValidator.kt index c640d0485ad..4ac1a823821 100644 --- a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/schemas/validation/UnevaluatedItemsValidator.kt +++ b/samples/client/3_0_3_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/schemas/validation/UnevaluatedItemsValidator.kt @@ -38,4 +38,4 @@ class UnevaluatedItemsValidator : KeywordValidator { } return pathToSchemas } -} +} \ No newline at end of file diff --git a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/schemas/validation/UnevaluatedPropertiesValidator.kt b/samples/client/3_0_3_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/schemas/validation/UnevaluatedPropertiesValidator.kt similarity index 100% rename from samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/schemas/validation/UnevaluatedPropertiesValidator.kt rename to samples/client/3_0_3_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/schemas/validation/UnevaluatedPropertiesValidator.kt diff --git a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/schemas/validation/UniqueItemsValidator.kt b/samples/client/3_0_3_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/schemas/validation/UniqueItemsValidator.kt similarity index 100% rename from samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/schemas/validation/UniqueItemsValidator.kt rename to samples/client/3_0_3_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/schemas/validation/UniqueItemsValidator.kt diff --git a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/schemas/validation/UnsetAnyTypeJsonSchema.kt b/samples/client/3_0_3_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/schemas/validation/UnsetAnyTypeJsonSchema.kt similarity index 98% rename from samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/schemas/validation/UnsetAnyTypeJsonSchema.kt rename to samples/client/3_0_3_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/schemas/validation/UnsetAnyTypeJsonSchema.kt index 8be46ceedc6..3797fa632b2 100644 --- a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/schemas/validation/UnsetAnyTypeJsonSchema.kt +++ b/samples/client/3_0_3_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/schemas/validation/UnsetAnyTypeJsonSchema.kt @@ -20,31 +20,31 @@ class UnsetAnyTypeJsonSchema { } data class UnsetAnyTypeJsonSchema1BoxedBoolean(val data: Boolean) : UnsetAnyTypeJsonSchema1Boxed { - override fun getData(): Boolean { + override fun getData(): Any? { return data } } data class UnsetAnyTypeJsonSchema1BoxedNumber(val data: Number) : UnsetAnyTypeJsonSchema1Boxed { - override fun getData(): Number { + override fun getData(): Any? { return data } } data class UnsetAnyTypeJsonSchema1BoxedString(val data: String) : UnsetAnyTypeJsonSchema1Boxed { - override fun getData(): String { + override fun getData(): Any? { return data } } data class UnsetAnyTypeJsonSchema1BoxedList(val data: FrozenList) : UnsetAnyTypeJsonSchema1Boxed { - override fun getData(): FrozenList { + override fun getData(): Any? { return data } } data class UnsetAnyTypeJsonSchema1BoxedMap(val data: FrozenMap) : UnsetAnyTypeJsonSchema1Boxed { - override fun getData(): FrozenMap { + override fun getData(): Any? { return data } } diff --git a/samples/client/3_0_3_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/schemas/validation/ValidationData.kt b/samples/client/3_0_3_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/schemas/validation/ValidationData.kt new file mode 100644 index 00000000000..4629847ee87 --- /dev/null +++ b/samples/client/3_0_3_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/schemas/validation/ValidationData.kt @@ -0,0 +1,11 @@ +package org.openapijsonschematools.client.schemas.validation + +data class ValidationData( + val schema: JsonSchema<*>, + val arg: Any?, + val validationMetadata: ValidationMetadata, + val containsPathToSchemas: List? = null, + val patternPropertiesPathToSchemas: PathToSchemasMap? = null, + val ifPathToSchemas: PathToSchemasMap? = null, + val knownPathToSchemas: PathToSchemasMap? = null +) \ No newline at end of file diff --git a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/schemas/validation/ValidationMetadata.kt b/samples/client/3_0_3_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/schemas/validation/ValidationMetadata.kt similarity index 85% rename from samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/schemas/validation/ValidationMetadata.kt rename to samples/client/3_0_3_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/schemas/validation/ValidationMetadata.kt index 6b7ab45ebf9..39ccadbdde6 100644 --- a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/schemas/validation/ValidationMetadata.kt +++ b/samples/client/3_0_3_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/schemas/validation/ValidationMetadata.kt @@ -9,7 +9,7 @@ data class ValidationMetadata( val seenClasses: Set> ) { fun validationRanEarlier(schema: JsonSchema<*>): Boolean { - val validatedSchemas: Map?, Nothing?>? = validatedPathToSchemas[pathToItem] + val validatedSchemas: Map, Nothing?>? = validatedPathToSchemas[pathToItem] if (validatedSchemas != null && validatedSchemas.containsKey(schema)) { return true } diff --git a/samples/client/3_0_3_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/servers/RootServer0.kt b/samples/client/3_0_3_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/servers/RootServer0.kt new file mode 100644 index 00000000000..6b3d3c867c2 --- /dev/null +++ b/samples/client/3_0_3_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/servers/RootServer0.kt @@ -0,0 +1,6 @@ +package org.openapijsonschematools.client.servers; + +import org.openapijsonschematools.client.servers.ServerWithoutVariables; + +class RootServer0 : ServerWithoutVariables("https://someserver.com/v1") { +} diff --git a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/servers/Server.kt b/samples/client/3_0_3_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/servers/Server.kt similarity index 54% rename from samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/servers/Server.kt rename to samples/client/3_0_3_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/servers/Server.kt index f5159644ccc..916d6a489bf 100644 --- a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/servers/Server.kt +++ b/samples/client/3_0_3_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/servers/Server.kt @@ -1,6 +1,5 @@ package org.openapijsonschematools.client.servers; -public interface Server { - String url(); +interface Server { + fun url(): String } - diff --git a/samples/client/3_0_3_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/servers/ServerProvider.kt b/samples/client/3_0_3_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/servers/ServerProvider.kt new file mode 100644 index 00000000000..65dcd7942f5 --- /dev/null +++ b/samples/client/3_0_3_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/servers/ServerProvider.kt @@ -0,0 +1,6 @@ +package org.openapijsonschematools.client.servers; + +interface ServerProvider { + fun getServer(serverIndex: T): Server +} + diff --git a/samples/client/3_0_3_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/servers/ServerWithVariables.kt b/samples/client/3_0_3_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/servers/ServerWithVariables.kt new file mode 100644 index 00000000000..7cf85cd8ccf --- /dev/null +++ b/samples/client/3_0_3_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/servers/ServerWithVariables.kt @@ -0,0 +1,20 @@ +package org.openapijsonschematools.client.servers + +abstract class ServerWithVariables> protected constructor(url: String, variables: T) : + Server { + val url: String + val variables: T + + init { + var url = url + this.variables = variables + for ((key, value) in variables) { + url = url.replace("{$key}", value) + } + this.url = url + } + + override fun url(): String { + return url + } +} diff --git a/samples/client/3_0_3_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/servers/ServerWithoutVariables.kt b/samples/client/3_0_3_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/servers/ServerWithoutVariables.kt new file mode 100644 index 00000000000..6267cc468f5 --- /dev/null +++ b/samples/client/3_0_3_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/servers/ServerWithoutVariables.kt @@ -0,0 +1,8 @@ +package org.openapijsonschematools.client.servers; + +abstract class ServerWithoutVariables protected constructor(val url: String) : Server { + override fun url(): String { + return url + } +} + diff --git a/samples/client/3_0_3_unit_test/kotlin/src/test/kotlin/org/openapijsonschematools/client/components/schemas/AdditionalpropertiesAllowsASchemaWhichShouldValidateTest.kt b/samples/client/3_0_3_unit_test/kotlin/src/test/kotlin/org/openapijsonschematools/client/components/schemas/AdditionalpropertiesAllowsASchemaWhichShouldValidateTest.kt new file mode 100644 index 00000000000..cd3dd2caabd --- /dev/null +++ b/samples/client/3_0_3_unit_test/kotlin/src/test/kotlin/org/openapijsonschematools/client/components/schemas/AdditionalpropertiesAllowsASchemaWhichShouldValidateTest.kt @@ -0,0 +1,79 @@ +package org.openapijsonschematools.client.components.schemas + +import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags +import org.openapijsonschematools.client.configurations.SchemaConfiguration +import org.openapijsonschematools.client.exceptions.ValidationException + +import kotlin.test.Test +import kotlin.test.assertFailsWith + +class AdditionalpropertiesAllowsASchemaWhichShouldValidateTest { + companion object { + val configuration = SchemaConfiguration(JsonSchemaKeywordFlags.Builder().format().build()) + } + + @Test + fun testNoAdditionalPropertiesIsValidPasses() { + // no additional properties is valid + val schema = AdditionalpropertiesAllowsASchemaWhichShouldValidate.AdditionalpropertiesAllowsASchemaWhichShouldValidate1.getInstance() + schema.validate( + mapOf( + Pair( + "foo", + 1 + ) + ), + configuration + ) + } + + @Test + fun testAnAdditionalValidPropertyIsValidPasses() { + // an additional valid property is valid + val schema = AdditionalpropertiesAllowsASchemaWhichShouldValidate.AdditionalpropertiesAllowsASchemaWhichShouldValidate1.getInstance() + schema.validate( + mapOf( + Pair( + "foo", + 1 + ), + Pair( + "bar", + 2 + ), + Pair( + "quux", + true + ) + ), + configuration + ) + } + + @Test + fun testAnAdditionalInvalidPropertyIsInvalidFails() { + // an additional invalid property is invalid + val schema = AdditionalpropertiesAllowsASchemaWhichShouldValidate.AdditionalpropertiesAllowsASchemaWhichShouldValidate1.getInstance() + assertFailsWith( + block = { + schema.validate( + mapOf( + Pair( + "foo", + 1 + ), + Pair( + "bar", + 2 + ), + Pair( + "quux", + 12 + ) + ), + configuration + ) + } + ) + } +} diff --git a/samples/client/3_0_3_unit_test/kotlin/src/test/kotlin/org/openapijsonschematools/client/components/schemas/AdditionalpropertiesAreAllowedByDefaultTest.kt b/samples/client/3_0_3_unit_test/kotlin/src/test/kotlin/org/openapijsonschematools/client/components/schemas/AdditionalpropertiesAreAllowedByDefaultTest.kt new file mode 100644 index 00000000000..0a6f7f758b3 --- /dev/null +++ b/samples/client/3_0_3_unit_test/kotlin/src/test/kotlin/org/openapijsonschematools/client/components/schemas/AdditionalpropertiesAreAllowedByDefaultTest.kt @@ -0,0 +1,37 @@ +package org.openapijsonschematools.client.components.schemas + +import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags +import org.openapijsonschematools.client.configurations.SchemaConfiguration +import org.openapijsonschematools.client.exceptions.ValidationException + +import kotlin.test.Test +import kotlin.test.assertFailsWith + +class AdditionalpropertiesAreAllowedByDefaultTest { + companion object { + val configuration = SchemaConfiguration(JsonSchemaKeywordFlags.Builder().format().build()) + } + + @Test + fun testAdditionalPropertiesAreAllowedPasses() { + // additional properties are allowed + val schema = AdditionalpropertiesAreAllowedByDefault.AdditionalpropertiesAreAllowedByDefault1.getInstance() + schema.validate( + mapOf( + Pair( + "foo", + 1 + ), + Pair( + "bar", + 2 + ), + Pair( + "quux", + true + ) + ), + configuration + ) + } +} diff --git a/samples/client/3_0_3_unit_test/kotlin/src/test/kotlin/org/openapijsonschematools/client/components/schemas/AdditionalpropertiesCanExistByItselfTest.kt b/samples/client/3_0_3_unit_test/kotlin/src/test/kotlin/org/openapijsonschematools/client/components/schemas/AdditionalpropertiesCanExistByItselfTest.kt new file mode 100644 index 00000000000..e4b32602f7e --- /dev/null +++ b/samples/client/3_0_3_unit_test/kotlin/src/test/kotlin/org/openapijsonschematools/client/components/schemas/AdditionalpropertiesCanExistByItselfTest.kt @@ -0,0 +1,48 @@ +package org.openapijsonschematools.client.components.schemas + +import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags +import org.openapijsonschematools.client.configurations.SchemaConfiguration +import org.openapijsonschematools.client.exceptions.ValidationException + +import kotlin.test.Test +import kotlin.test.assertFailsWith + +class AdditionalpropertiesCanExistByItselfTest { + companion object { + val configuration = SchemaConfiguration(JsonSchemaKeywordFlags.Builder().format().build()) + } + + @Test + fun testAnAdditionalValidPropertyIsValidPasses() { + // an additional valid property is valid + val schema = AdditionalpropertiesCanExistByItself.AdditionalpropertiesCanExistByItself1.getInstance() + schema.validate( + mapOf( + Pair( + "foo", + true + ) + ), + configuration + ) + } + + @Test + fun testAnAdditionalInvalidPropertyIsInvalidFails() { + // an additional invalid property is invalid + val schema = AdditionalpropertiesCanExistByItself.AdditionalpropertiesCanExistByItself1.getInstance() + assertFailsWith( + block = { + schema.validate( + mapOf( + Pair( + "foo", + 1 + ) + ), + configuration + ) + } + ) + } +} diff --git a/samples/client/3_0_3_unit_test/kotlin/src/test/kotlin/org/openapijsonschematools/client/components/schemas/AdditionalpropertiesShouldNotLookInApplicatorsTest.kt b/samples/client/3_0_3_unit_test/kotlin/src/test/kotlin/org/openapijsonschematools/client/components/schemas/AdditionalpropertiesShouldNotLookInApplicatorsTest.kt new file mode 100644 index 00000000000..cc3c64c1cfc --- /dev/null +++ b/samples/client/3_0_3_unit_test/kotlin/src/test/kotlin/org/openapijsonschematools/client/components/schemas/AdditionalpropertiesShouldNotLookInApplicatorsTest.kt @@ -0,0 +1,56 @@ +package org.openapijsonschematools.client.components.schemas + +import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags +import org.openapijsonschematools.client.configurations.SchemaConfiguration +import org.openapijsonschematools.client.exceptions.ValidationException + +import kotlin.test.Test +import kotlin.test.assertFailsWith + +class AdditionalpropertiesShouldNotLookInApplicatorsTest { + companion object { + val configuration = SchemaConfiguration(JsonSchemaKeywordFlags.Builder().format().build()) + } + + @Test + fun testPropertiesDefinedInAllofAreNotExaminedFails() { + // properties defined in allOf are not examined + val schema = AdditionalpropertiesShouldNotLookInApplicators.AdditionalpropertiesShouldNotLookInApplicators1.getInstance() + assertFailsWith( + block = { + schema.validate( + mapOf( + Pair( + "foo", + 1 + ), + Pair( + "bar", + true + ) + ), + configuration + ) + } + ) + } + + @Test + fun testValidTestCasePasses() { + // valid test case + val schema = AdditionalpropertiesShouldNotLookInApplicators.AdditionalpropertiesShouldNotLookInApplicators1.getInstance() + schema.validate( + mapOf( + Pair( + "foo", + false + ), + Pair( + "bar", + true + ) + ), + configuration + ) + } +} diff --git a/samples/client/3_0_3_unit_test/kotlin/src/test/kotlin/org/openapijsonschematools/client/components/schemas/AllofCombinedWithAnyofOneofTest.kt b/samples/client/3_0_3_unit_test/kotlin/src/test/kotlin/org/openapijsonschematools/client/components/schemas/AllofCombinedWithAnyofOneofTest.kt new file mode 100644 index 00000000000..5703d263e49 --- /dev/null +++ b/samples/client/3_0_3_unit_test/kotlin/src/test/kotlin/org/openapijsonschematools/client/components/schemas/AllofCombinedWithAnyofOneofTest.kt @@ -0,0 +1,122 @@ +package org.openapijsonschematools.client.components.schemas + +import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags +import org.openapijsonschematools.client.configurations.SchemaConfiguration +import org.openapijsonschematools.client.exceptions.ValidationException + +import kotlin.test.Test +import kotlin.test.assertFailsWith + +class AllofCombinedWithAnyofOneofTest { + companion object { + val configuration = SchemaConfiguration(JsonSchemaKeywordFlags.Builder().format().build()) + } + + @Test + fun testAllofFalseAnyofFalseOneofTrueFails() { + // allOf: false, anyOf: false, oneOf: true + val schema = AllofCombinedWithAnyofOneof.AllofCombinedWithAnyofOneof1.getInstance() + assertFailsWith( + block = { + schema.validate( + 5, + configuration + ) + } + ) + } + + @Test + fun testAllofFalseAnyofTrueOneofFalseFails() { + // allOf: false, anyOf: true, oneOf: false + val schema = AllofCombinedWithAnyofOneof.AllofCombinedWithAnyofOneof1.getInstance() + assertFailsWith( + block = { + schema.validate( + 3, + configuration + ) + } + ) + } + + @Test + fun testAllofFalseAnyofTrueOneofTrueFails() { + // allOf: false, anyOf: true, oneOf: true + val schema = AllofCombinedWithAnyofOneof.AllofCombinedWithAnyofOneof1.getInstance() + assertFailsWith( + block = { + schema.validate( + 15, + configuration + ) + } + ) + } + + @Test + fun testAllofTrueAnyofFalseOneofFalseFails() { + // allOf: true, anyOf: false, oneOf: false + val schema = AllofCombinedWithAnyofOneof.AllofCombinedWithAnyofOneof1.getInstance() + assertFailsWith( + block = { + schema.validate( + 2, + configuration + ) + } + ) + } + + @Test + fun testAllofTrueAnyofTrueOneofTruePasses() { + // allOf: true, anyOf: true, oneOf: true + val schema = AllofCombinedWithAnyofOneof.AllofCombinedWithAnyofOneof1.getInstance() + schema.validate( + 30, + configuration + ) + } + + @Test + fun testAllofFalseAnyofFalseOneofFalseFails() { + // allOf: false, anyOf: false, oneOf: false + val schema = AllofCombinedWithAnyofOneof.AllofCombinedWithAnyofOneof1.getInstance() + assertFailsWith( + block = { + schema.validate( + 1, + configuration + ) + } + ) + } + + @Test + fun testAllofTrueAnyofFalseOneofTrueFails() { + // allOf: true, anyOf: false, oneOf: true + val schema = AllofCombinedWithAnyofOneof.AllofCombinedWithAnyofOneof1.getInstance() + assertFailsWith( + block = { + schema.validate( + 10, + configuration + ) + } + ) + } + + @Test + fun testAllofTrueAnyofTrueOneofFalseFails() { + // allOf: true, anyOf: true, oneOf: false + val schema = AllofCombinedWithAnyofOneof.AllofCombinedWithAnyofOneof1.getInstance() + assertFailsWith( + block = { + schema.validate( + 6, + configuration + ) + } + ) + } +} diff --git a/samples/client/3_0_3_unit_test/kotlin/src/test/kotlin/org/openapijsonschematools/client/components/schemas/AllofSimpleTypesTest.kt b/samples/client/3_0_3_unit_test/kotlin/src/test/kotlin/org/openapijsonschematools/client/components/schemas/AllofSimpleTypesTest.kt new file mode 100644 index 00000000000..ff6e7d933dd --- /dev/null +++ b/samples/client/3_0_3_unit_test/kotlin/src/test/kotlin/org/openapijsonschematools/client/components/schemas/AllofSimpleTypesTest.kt @@ -0,0 +1,38 @@ +package org.openapijsonschematools.client.components.schemas + +import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags +import org.openapijsonschematools.client.configurations.SchemaConfiguration +import org.openapijsonschematools.client.exceptions.ValidationException + +import kotlin.test.Test +import kotlin.test.assertFailsWith + +class AllofSimpleTypesTest { + companion object { + val configuration = SchemaConfiguration(JsonSchemaKeywordFlags.Builder().format().build()) + } + + @Test + fun testMismatchOneFails() { + // mismatch one + val schema = AllofSimpleTypes.AllofSimpleTypes1.getInstance() + assertFailsWith( + block = { + schema.validate( + 35, + configuration + ) + } + ) + } + + @Test + fun testValidPasses() { + // valid + val schema = AllofSimpleTypes.AllofSimpleTypes1.getInstance() + schema.validate( + 25, + configuration + ) + } +} diff --git a/samples/client/3_0_3_unit_test/kotlin/src/test/kotlin/org/openapijsonschematools/client/components/schemas/AllofTest.kt b/samples/client/3_0_3_unit_test/kotlin/src/test/kotlin/org/openapijsonschematools/client/components/schemas/AllofTest.kt new file mode 100644 index 00000000000..c2af359082b --- /dev/null +++ b/samples/client/3_0_3_unit_test/kotlin/src/test/kotlin/org/openapijsonschematools/client/components/schemas/AllofTest.kt @@ -0,0 +1,94 @@ +package org.openapijsonschematools.client.components.schemas + +import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags +import org.openapijsonschematools.client.configurations.SchemaConfiguration +import org.openapijsonschematools.client.exceptions.ValidationException + +import kotlin.test.Test +import kotlin.test.assertFailsWith + +class AllofTest { + companion object { + val configuration = SchemaConfiguration(JsonSchemaKeywordFlags.Builder().format().build()) + } + + @Test + fun testMismatchSecondFails() { + // mismatch second + val schema = Allof.Allof1.getInstance() + assertFailsWith( + block = { + schema.validate( + mapOf( + Pair( + "foo", + "baz" + ) + ), + configuration + ) + } + ) + } + + @Test + fun testWrongTypeFails() { + // wrong type + val schema = Allof.Allof1.getInstance() + assertFailsWith( + block = { + schema.validate( + mapOf( + Pair( + "foo", + "baz" + ), + Pair( + "bar", + "quux" + ) + ), + configuration + ) + } + ) + } + + @Test + fun testMismatchFirstFails() { + // mismatch first + val schema = Allof.Allof1.getInstance() + assertFailsWith( + block = { + schema.validate( + mapOf( + Pair( + "bar", + 2 + ) + ), + configuration + ) + } + ) + } + + @Test + fun testAllofPasses() { + // allOf + val schema = Allof.Allof1.getInstance() + schema.validate( + mapOf( + Pair( + "foo", + "baz" + ), + Pair( + "bar", + 2 + ) + ), + configuration + ) + } +} diff --git a/samples/client/3_0_3_unit_test/kotlin/src/test/kotlin/org/openapijsonschematools/client/components/schemas/AllofWithBaseSchemaTest.kt b/samples/client/3_0_3_unit_test/kotlin/src/test/kotlin/org/openapijsonschematools/client/components/schemas/AllofWithBaseSchemaTest.kt new file mode 100644 index 00000000000..f4b4b2af3fb --- /dev/null +++ b/samples/client/3_0_3_unit_test/kotlin/src/test/kotlin/org/openapijsonschematools/client/components/schemas/AllofWithBaseSchemaTest.kt @@ -0,0 +1,125 @@ +package org.openapijsonschematools.client.components.schemas + +import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags +import org.openapijsonschematools.client.configurations.SchemaConfiguration +import org.openapijsonschematools.client.exceptions.ValidationException + +import kotlin.test.Test +import kotlin.test.assertFailsWith + +class AllofWithBaseSchemaTest { + companion object { + val configuration = SchemaConfiguration(JsonSchemaKeywordFlags.Builder().format().build()) + } + + @Test + fun testMismatchBaseSchemaFails() { + // mismatch base schema + val schema = AllofWithBaseSchema.AllofWithBaseSchema1.getInstance() + assertFailsWith( + block = { + schema.validate( + mapOf( + Pair( + "foo", + "quux" + ), + Pair( + "baz", + null + ) + ), + configuration + ) + } + ) + } + + @Test + fun testMismatchFirstAllofFails() { + // mismatch first allOf + val schema = AllofWithBaseSchema.AllofWithBaseSchema1.getInstance() + assertFailsWith( + block = { + schema.validate( + mapOf( + Pair( + "bar", + 2 + ), + Pair( + "baz", + null + ) + ), + configuration + ) + } + ) + } + + @Test + fun testValidPasses() { + // valid + val schema = AllofWithBaseSchema.AllofWithBaseSchema1.getInstance() + schema.validate( + mapOf( + Pair( + "foo", + "quux" + ), + Pair( + "bar", + 2 + ), + Pair( + "baz", + null + ) + ), + configuration + ) + } + + @Test + fun testMismatchBothFails() { + // mismatch both + val schema = AllofWithBaseSchema.AllofWithBaseSchema1.getInstance() + assertFailsWith( + block = { + schema.validate( + mapOf( + Pair( + "bar", + 2 + ) + ), + configuration + ) + } + ) + } + + @Test + fun testMismatchSecondAllofFails() { + // mismatch second allOf + val schema = AllofWithBaseSchema.AllofWithBaseSchema1.getInstance() + assertFailsWith( + block = { + schema.validate( + mapOf( + Pair( + "foo", + "quux" + ), + Pair( + "bar", + 2 + ) + ), + configuration + ) + } + ) + } +} diff --git a/samples/client/3_0_3_unit_test/kotlin/src/test/kotlin/org/openapijsonschematools/client/components/schemas/AllofWithOneEmptySchemaTest.kt b/samples/client/3_0_3_unit_test/kotlin/src/test/kotlin/org/openapijsonschematools/client/components/schemas/AllofWithOneEmptySchemaTest.kt new file mode 100644 index 00000000000..081371231ec --- /dev/null +++ b/samples/client/3_0_3_unit_test/kotlin/src/test/kotlin/org/openapijsonschematools/client/components/schemas/AllofWithOneEmptySchemaTest.kt @@ -0,0 +1,24 @@ +package org.openapijsonschematools.client.components.schemas + +import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags +import org.openapijsonschematools.client.configurations.SchemaConfiguration +import org.openapijsonschematools.client.exceptions.ValidationException + +import kotlin.test.Test +import kotlin.test.assertFailsWith + +class AllofWithOneEmptySchemaTest { + companion object { + val configuration = SchemaConfiguration(JsonSchemaKeywordFlags.Builder().format().build()) + } + + @Test + fun testAnyDataIsValidPasses() { + // any data is valid + val schema = AllofWithOneEmptySchema.AllofWithOneEmptySchema1.getInstance() + schema.validate( + 1, + configuration + ) + } +} diff --git a/samples/client/3_0_3_unit_test/kotlin/src/test/kotlin/org/openapijsonschematools/client/components/schemas/AllofWithTheFirstEmptySchemaTest.kt b/samples/client/3_0_3_unit_test/kotlin/src/test/kotlin/org/openapijsonschematools/client/components/schemas/AllofWithTheFirstEmptySchemaTest.kt new file mode 100644 index 00000000000..5f40ab6e1ce --- /dev/null +++ b/samples/client/3_0_3_unit_test/kotlin/src/test/kotlin/org/openapijsonschematools/client/components/schemas/AllofWithTheFirstEmptySchemaTest.kt @@ -0,0 +1,38 @@ +package org.openapijsonschematools.client.components.schemas + +import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags +import org.openapijsonschematools.client.configurations.SchemaConfiguration +import org.openapijsonschematools.client.exceptions.ValidationException + +import kotlin.test.Test +import kotlin.test.assertFailsWith + +class AllofWithTheFirstEmptySchemaTest { + companion object { + val configuration = SchemaConfiguration(JsonSchemaKeywordFlags.Builder().format().build()) + } + + @Test + fun testStringIsInvalidFails() { + // string is invalid + val schema = AllofWithTheFirstEmptySchema.AllofWithTheFirstEmptySchema1.getInstance() + assertFailsWith( + block = { + schema.validate( + "foo", + configuration + ) + } + ) + } + + @Test + fun testNumberIsValidPasses() { + // number is valid + val schema = AllofWithTheFirstEmptySchema.AllofWithTheFirstEmptySchema1.getInstance() + schema.validate( + 1, + configuration + ) + } +} diff --git a/samples/client/3_0_3_unit_test/kotlin/src/test/kotlin/org/openapijsonschematools/client/components/schemas/AllofWithTheLastEmptySchemaTest.kt b/samples/client/3_0_3_unit_test/kotlin/src/test/kotlin/org/openapijsonschematools/client/components/schemas/AllofWithTheLastEmptySchemaTest.kt new file mode 100644 index 00000000000..1669c0495aa --- /dev/null +++ b/samples/client/3_0_3_unit_test/kotlin/src/test/kotlin/org/openapijsonschematools/client/components/schemas/AllofWithTheLastEmptySchemaTest.kt @@ -0,0 +1,38 @@ +package org.openapijsonschematools.client.components.schemas + +import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags +import org.openapijsonschematools.client.configurations.SchemaConfiguration +import org.openapijsonschematools.client.exceptions.ValidationException + +import kotlin.test.Test +import kotlin.test.assertFailsWith + +class AllofWithTheLastEmptySchemaTest { + companion object { + val configuration = SchemaConfiguration(JsonSchemaKeywordFlags.Builder().format().build()) + } + + @Test + fun testStringIsInvalidFails() { + // string is invalid + val schema = AllofWithTheLastEmptySchema.AllofWithTheLastEmptySchema1.getInstance() + assertFailsWith( + block = { + schema.validate( + "foo", + configuration + ) + } + ) + } + + @Test + fun testNumberIsValidPasses() { + // number is valid + val schema = AllofWithTheLastEmptySchema.AllofWithTheLastEmptySchema1.getInstance() + schema.validate( + 1, + configuration + ) + } +} diff --git a/samples/client/3_0_3_unit_test/kotlin/src/test/kotlin/org/openapijsonschematools/client/components/schemas/AllofWithTwoEmptySchemasTest.kt b/samples/client/3_0_3_unit_test/kotlin/src/test/kotlin/org/openapijsonschematools/client/components/schemas/AllofWithTwoEmptySchemasTest.kt new file mode 100644 index 00000000000..e9e9a86e68e --- /dev/null +++ b/samples/client/3_0_3_unit_test/kotlin/src/test/kotlin/org/openapijsonschematools/client/components/schemas/AllofWithTwoEmptySchemasTest.kt @@ -0,0 +1,24 @@ +package org.openapijsonschematools.client.components.schemas + +import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags +import org.openapijsonschematools.client.configurations.SchemaConfiguration +import org.openapijsonschematools.client.exceptions.ValidationException + +import kotlin.test.Test +import kotlin.test.assertFailsWith + +class AllofWithTwoEmptySchemasTest { + companion object { + val configuration = SchemaConfiguration(JsonSchemaKeywordFlags.Builder().format().build()) + } + + @Test + fun testAnyDataIsValidPasses() { + // any data is valid + val schema = AllofWithTwoEmptySchemas.AllofWithTwoEmptySchemas1.getInstance() + schema.validate( + 1, + configuration + ) + } +} diff --git a/samples/client/3_0_3_unit_test/kotlin/src/test/kotlin/org/openapijsonschematools/client/components/schemas/AnyofComplexTypesTest.kt b/samples/client/3_0_3_unit_test/kotlin/src/test/kotlin/org/openapijsonschematools/client/components/schemas/AnyofComplexTypesTest.kt new file mode 100644 index 00000000000..997c742aa1f --- /dev/null +++ b/samples/client/3_0_3_unit_test/kotlin/src/test/kotlin/org/openapijsonschematools/client/components/schemas/AnyofComplexTypesTest.kt @@ -0,0 +1,86 @@ +package org.openapijsonschematools.client.components.schemas + +import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags +import org.openapijsonschematools.client.configurations.SchemaConfiguration +import org.openapijsonschematools.client.exceptions.ValidationException + +import kotlin.test.Test +import kotlin.test.assertFailsWith + +class AnyofComplexTypesTest { + companion object { + val configuration = SchemaConfiguration(JsonSchemaKeywordFlags.Builder().format().build()) + } + + @Test + fun testSecondAnyofValidComplexPasses() { + // second anyOf valid (complex) + val schema = AnyofComplexTypes.AnyofComplexTypes1.getInstance() + schema.validate( + mapOf( + Pair( + "foo", + "baz" + ) + ), + configuration + ) + } + + @Test + fun testBothAnyofValidComplexPasses() { + // both anyOf valid (complex) + val schema = AnyofComplexTypes.AnyofComplexTypes1.getInstance() + schema.validate( + mapOf( + Pair( + "foo", + "baz" + ), + Pair( + "bar", + 2 + ) + ), + configuration + ) + } + + @Test + fun testFirstAnyofValidComplexPasses() { + // first anyOf valid (complex) + val schema = AnyofComplexTypes.AnyofComplexTypes1.getInstance() + schema.validate( + mapOf( + Pair( + "bar", + 2 + ) + ), + configuration + ) + } + + @Test + fun testNeitherAnyofValidComplexFails() { + // neither anyOf valid (complex) + val schema = AnyofComplexTypes.AnyofComplexTypes1.getInstance() + assertFailsWith( + block = { + schema.validate( + mapOf( + Pair( + "foo", + 2 + ), + Pair( + "bar", + "quux" + ) + ), + configuration + ) + } + ) + } +} diff --git a/samples/client/3_0_3_unit_test/kotlin/src/test/kotlin/org/openapijsonschematools/client/components/schemas/AnyofTest.kt b/samples/client/3_0_3_unit_test/kotlin/src/test/kotlin/org/openapijsonschematools/client/components/schemas/AnyofTest.kt new file mode 100644 index 00000000000..a525d7d0312 --- /dev/null +++ b/samples/client/3_0_3_unit_test/kotlin/src/test/kotlin/org/openapijsonschematools/client/components/schemas/AnyofTest.kt @@ -0,0 +1,58 @@ +package org.openapijsonschematools.client.components.schemas + +import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags +import org.openapijsonschematools.client.configurations.SchemaConfiguration +import org.openapijsonschematools.client.exceptions.ValidationException + +import kotlin.test.Test +import kotlin.test.assertFailsWith + +class AnyofTest { + companion object { + val configuration = SchemaConfiguration(JsonSchemaKeywordFlags.Builder().format().build()) + } + + @Test + fun testBothAnyofValidPasses() { + // both anyOf valid + val schema = Anyof.Anyof1.getInstance() + schema.validate( + 3, + configuration + ) + } + + @Test + fun testNeitherAnyofValidFails() { + // neither anyOf valid + val schema = Anyof.Anyof1.getInstance() + assertFailsWith( + block = { + schema.validate( + 1.5, + configuration + ) + } + ) + } + + @Test + fun testFirstAnyofValidPasses() { + // first anyOf valid + val schema = Anyof.Anyof1.getInstance() + schema.validate( + 1, + configuration + ) + } + + @Test + fun testSecondAnyofValidPasses() { + // second anyOf valid + val schema = Anyof.Anyof1.getInstance() + schema.validate( + 2.5, + configuration + ) + } +} diff --git a/samples/client/3_0_3_unit_test/kotlin/src/test/kotlin/org/openapijsonschematools/client/components/schemas/AnyofWithBaseSchemaTest.kt b/samples/client/3_0_3_unit_test/kotlin/src/test/kotlin/org/openapijsonschematools/client/components/schemas/AnyofWithBaseSchemaTest.kt new file mode 100644 index 00000000000..76ed26e5272 --- /dev/null +++ b/samples/client/3_0_3_unit_test/kotlin/src/test/kotlin/org/openapijsonschematools/client/components/schemas/AnyofWithBaseSchemaTest.kt @@ -0,0 +1,52 @@ +package org.openapijsonschematools.client.components.schemas + +import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags +import org.openapijsonschematools.client.configurations.SchemaConfiguration +import org.openapijsonschematools.client.exceptions.ValidationException + +import kotlin.test.Test +import kotlin.test.assertFailsWith + +class AnyofWithBaseSchemaTest { + companion object { + val configuration = SchemaConfiguration(JsonSchemaKeywordFlags.Builder().format().build()) + } + + @Test + fun testMismatchBaseSchemaFails() { + // mismatch base schema + val schema = AnyofWithBaseSchema.AnyofWithBaseSchema1.getInstance() + assertFailsWith( + block = { + schema.validate( + 3, + configuration + ) + } + ) + } + + @Test + fun testOneAnyofValidPasses() { + // one anyOf valid + val schema = AnyofWithBaseSchema.AnyofWithBaseSchema1.getInstance() + schema.validate( + "foobar", + configuration + ) + } + + @Test + fun testBothAnyofInvalidFails() { + // both anyOf invalid + val schema = AnyofWithBaseSchema.AnyofWithBaseSchema1.getInstance() + assertFailsWith( + block = { + schema.validate( + "foo", + configuration + ) + } + ) + } +} diff --git a/samples/client/3_0_3_unit_test/kotlin/src/test/kotlin/org/openapijsonschematools/client/components/schemas/AnyofWithOneEmptySchemaTest.kt b/samples/client/3_0_3_unit_test/kotlin/src/test/kotlin/org/openapijsonschematools/client/components/schemas/AnyofWithOneEmptySchemaTest.kt new file mode 100644 index 00000000000..9a0ca10b5cd --- /dev/null +++ b/samples/client/3_0_3_unit_test/kotlin/src/test/kotlin/org/openapijsonschematools/client/components/schemas/AnyofWithOneEmptySchemaTest.kt @@ -0,0 +1,34 @@ +package org.openapijsonschematools.client.components.schemas + +import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags +import org.openapijsonschematools.client.configurations.SchemaConfiguration +import org.openapijsonschematools.client.exceptions.ValidationException + +import kotlin.test.Test +import kotlin.test.assertFailsWith + +class AnyofWithOneEmptySchemaTest { + companion object { + val configuration = SchemaConfiguration(JsonSchemaKeywordFlags.Builder().format().build()) + } + + @Test + fun testNumberIsValidPasses() { + // number is valid + val schema = AnyofWithOneEmptySchema.AnyofWithOneEmptySchema1.getInstance() + schema.validate( + 123, + configuration + ) + } + + @Test + fun testStringIsValidPasses() { + // string is valid + val schema = AnyofWithOneEmptySchema.AnyofWithOneEmptySchema1.getInstance() + schema.validate( + "foo", + configuration + ) + } +} diff --git a/samples/client/3_0_3_unit_test/kotlin/src/test/kotlin/org/openapijsonschematools/client/components/schemas/ArrayTypeMatchesArraysTest.kt b/samples/client/3_0_3_unit_test/kotlin/src/test/kotlin/org/openapijsonschematools/client/components/schemas/ArrayTypeMatchesArraysTest.kt new file mode 100644 index 00000000000..22b7c3e8cce --- /dev/null +++ b/samples/client/3_0_3_unit_test/kotlin/src/test/kotlin/org/openapijsonschematools/client/components/schemas/ArrayTypeMatchesArraysTest.kt @@ -0,0 +1,110 @@ +package org.openapijsonschematools.client.components.schemas + +import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags +import org.openapijsonschematools.client.configurations.SchemaConfiguration +import org.openapijsonschematools.client.exceptions.ValidationException + +import kotlin.test.Test +import kotlin.test.assertFailsWith + +class ArrayTypeMatchesArraysTest { + companion object { + val configuration = SchemaConfiguration(JsonSchemaKeywordFlags.Builder().format().build()) + } + + @Test + fun testABooleanIsNotAnArrayFails() { + // a boolean is not an array + val schema = ArrayTypeMatchesArrays.ArrayTypeMatchesArrays1.getInstance() + assertFailsWith( + block = { + schema.validate( + true, + configuration + ) + } + ) + } + + @Test + fun testAFloatIsNotAnArrayFails() { + // a float is not an array + val schema = ArrayTypeMatchesArrays.ArrayTypeMatchesArrays1.getInstance() + assertFailsWith( + block = { + schema.validate( + 1.1, + configuration + ) + } + ) + } + + @Test + fun testAnArrayIsAnArrayPasses() { + // an array is an array + val schema = ArrayTypeMatchesArrays.ArrayTypeMatchesArrays1.getInstance() + schema.validate( + ArrayTypeMatchesArrays.ArrayTypeMatchesArraysListBuilder() + .build(), + configuration + ) + } + + @Test + fun testNullIsNotAnArrayFails() { + // null is not an array + val schema = ArrayTypeMatchesArrays.ArrayTypeMatchesArrays1.getInstance() + assertFailsWith( + block = { + schema.validate( + null, + configuration + ) + } + ) + } + + @Test + fun testAStringIsNotAnArrayFails() { + // a string is not an array + val schema = ArrayTypeMatchesArrays.ArrayTypeMatchesArrays1.getInstance() + assertFailsWith( + block = { + schema.validate( + "foo", + configuration + ) + } + ) + } + + @Test + fun testAnIntegerIsNotAnArrayFails() { + // an integer is not an array + val schema = ArrayTypeMatchesArrays.ArrayTypeMatchesArrays1.getInstance() + assertFailsWith( + block = { + schema.validate( + 1, + configuration + ) + } + ) + } + + @Test + fun testAnObjectIsNotAnArrayFails() { + // an object is not an array + val schema = ArrayTypeMatchesArrays.ArrayTypeMatchesArrays1.getInstance() + assertFailsWith( + block = { + schema.validate( + mapOf( + ), + configuration + ) + } + ) + } +} diff --git a/samples/client/3_0_3_unit_test/kotlin/src/test/kotlin/org/openapijsonschematools/client/components/schemas/BooleanTypeMatchesBooleansTest.kt b/samples/client/3_0_3_unit_test/kotlin/src/test/kotlin/org/openapijsonschematools/client/components/schemas/BooleanTypeMatchesBooleansTest.kt new file mode 100644 index 00000000000..c9fb755da34 --- /dev/null +++ b/samples/client/3_0_3_unit_test/kotlin/src/test/kotlin/org/openapijsonschematools/client/components/schemas/BooleanTypeMatchesBooleansTest.kt @@ -0,0 +1,148 @@ +package org.openapijsonschematools.client.components.schemas + +import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags +import org.openapijsonschematools.client.configurations.SchemaConfiguration +import org.openapijsonschematools.client.exceptions.ValidationException + +import kotlin.test.Test +import kotlin.test.assertFailsWith + +class BooleanTypeMatchesBooleansTest { + companion object { + val configuration = SchemaConfiguration(JsonSchemaKeywordFlags.Builder().format().build()) + } + + @Test + fun testAFloatIsNotABooleanFails() { + // a float is not a boolean + val schema = BooleanTypeMatchesBooleans.BooleanTypeMatchesBooleans1.getInstance() + assertFailsWith( + block = { + schema.validate( + 1.1, + configuration + ) + } + ) + } + + @Test + fun testAStringIsNotABooleanFails() { + // a string is not a boolean + val schema = BooleanTypeMatchesBooleans.BooleanTypeMatchesBooleans1.getInstance() + assertFailsWith( + block = { + schema.validate( + "foo", + configuration + ) + } + ) + } + + @Test + fun testFalseIsABooleanPasses() { + // false is a boolean + val schema = BooleanTypeMatchesBooleans.BooleanTypeMatchesBooleans1.getInstance() + schema.validate( + false, + configuration + ) + } + + @Test + fun testTrueIsABooleanPasses() { + // true is a boolean + val schema = BooleanTypeMatchesBooleans.BooleanTypeMatchesBooleans1.getInstance() + schema.validate( + true, + configuration + ) + } + + @Test + fun testAnObjectIsNotABooleanFails() { + // an object is not a boolean + val schema = BooleanTypeMatchesBooleans.BooleanTypeMatchesBooleans1.getInstance() + assertFailsWith( + block = { + schema.validate( + mapOf( + ), + configuration + ) + } + ) + } + + @Test + fun testAnArrayIsNotABooleanFails() { + // an array is not a boolean + val schema = BooleanTypeMatchesBooleans.BooleanTypeMatchesBooleans1.getInstance() + assertFailsWith( + block = { + schema.validate( + listOf( + ), + configuration + ) + } + ) + } + + @Test + fun testNullIsNotABooleanFails() { + // null is not a boolean + val schema = BooleanTypeMatchesBooleans.BooleanTypeMatchesBooleans1.getInstance() + assertFailsWith( + block = { + schema.validate( + null, + configuration + ) + } + ) + } + + @Test + fun testAnIntegerIsNotABooleanFails() { + // an integer is not a boolean + val schema = BooleanTypeMatchesBooleans.BooleanTypeMatchesBooleans1.getInstance() + assertFailsWith( + block = { + schema.validate( + 1, + configuration + ) + } + ) + } + + @Test + fun testZeroIsNotABooleanFails() { + // zero is not a boolean + val schema = BooleanTypeMatchesBooleans.BooleanTypeMatchesBooleans1.getInstance() + assertFailsWith( + block = { + schema.validate( + 0, + configuration + ) + } + ) + } + + @Test + fun testAnEmptyStringIsNotABooleanFails() { + // an empty string is not a boolean + val schema = BooleanTypeMatchesBooleans.BooleanTypeMatchesBooleans1.getInstance() + assertFailsWith( + block = { + schema.validate( + "", + configuration + ) + } + ) + } +} diff --git a/samples/client/3_0_3_unit_test/kotlin/src/test/kotlin/org/openapijsonschematools/client/components/schemas/ByIntTest.kt b/samples/client/3_0_3_unit_test/kotlin/src/test/kotlin/org/openapijsonschematools/client/components/schemas/ByIntTest.kt new file mode 100644 index 00000000000..89bd4860dd8 --- /dev/null +++ b/samples/client/3_0_3_unit_test/kotlin/src/test/kotlin/org/openapijsonschematools/client/components/schemas/ByIntTest.kt @@ -0,0 +1,48 @@ +package org.openapijsonschematools.client.components.schemas + +import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags +import org.openapijsonschematools.client.configurations.SchemaConfiguration +import org.openapijsonschematools.client.exceptions.ValidationException + +import kotlin.test.Test +import kotlin.test.assertFailsWith + +class ByIntTest { + companion object { + val configuration = SchemaConfiguration(JsonSchemaKeywordFlags.Builder().format().build()) + } + + @Test + fun testIntByIntFailFails() { + // int by int fail + val schema = ByInt.ByInt1.getInstance() + assertFailsWith( + block = { + schema.validate( + 7, + configuration + ) + } + ) + } + + @Test + fun testIntByIntPasses() { + // int by int + val schema = ByInt.ByInt1.getInstance() + schema.validate( + 10, + configuration + ) + } + + @Test + fun testIgnoresNonNumbersPasses() { + // ignores non-numbers + val schema = ByInt.ByInt1.getInstance() + schema.validate( + "foo", + configuration + ) + } +} diff --git a/samples/client/3_0_3_unit_test/kotlin/src/test/kotlin/org/openapijsonschematools/client/components/schemas/ByNumberTest.kt b/samples/client/3_0_3_unit_test/kotlin/src/test/kotlin/org/openapijsonschematools/client/components/schemas/ByNumberTest.kt new file mode 100644 index 00000000000..a6fd5fe3f47 --- /dev/null +++ b/samples/client/3_0_3_unit_test/kotlin/src/test/kotlin/org/openapijsonschematools/client/components/schemas/ByNumberTest.kt @@ -0,0 +1,48 @@ +package org.openapijsonschematools.client.components.schemas + +import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags +import org.openapijsonschematools.client.configurations.SchemaConfiguration +import org.openapijsonschematools.client.exceptions.ValidationException + +import kotlin.test.Test +import kotlin.test.assertFailsWith + +class ByNumberTest { + companion object { + val configuration = SchemaConfiguration(JsonSchemaKeywordFlags.Builder().format().build()) + } + + @Test + fun test35IsNotMultipleOf15Fails() { + // 35 is not multiple of 1.5 + val schema = ByNumber.ByNumber1.getInstance() + assertFailsWith( + block = { + schema.validate( + 35, + configuration + ) + } + ) + } + + @Test + fun test45IsMultipleOf15Passes() { + // 4.5 is multiple of 1.5 + val schema = ByNumber.ByNumber1.getInstance() + schema.validate( + 4.5, + configuration + ) + } + + @Test + fun testZeroIsMultipleOfAnythingPasses() { + // zero is multiple of anything + val schema = ByNumber.ByNumber1.getInstance() + schema.validate( + 0, + configuration + ) + } +} diff --git a/samples/client/3_0_3_unit_test/kotlin/src/test/kotlin/org/openapijsonschematools/client/components/schemas/BySmallNumberTest.kt b/samples/client/3_0_3_unit_test/kotlin/src/test/kotlin/org/openapijsonschematools/client/components/schemas/BySmallNumberTest.kt new file mode 100644 index 00000000000..f6fc84b9514 --- /dev/null +++ b/samples/client/3_0_3_unit_test/kotlin/src/test/kotlin/org/openapijsonschematools/client/components/schemas/BySmallNumberTest.kt @@ -0,0 +1,38 @@ +package org.openapijsonschematools.client.components.schemas + +import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags +import org.openapijsonschematools.client.configurations.SchemaConfiguration +import org.openapijsonschematools.client.exceptions.ValidationException + +import kotlin.test.Test +import kotlin.test.assertFailsWith + +class BySmallNumberTest { + companion object { + val configuration = SchemaConfiguration(JsonSchemaKeywordFlags.Builder().format().build()) + } + + @Test + fun test000751IsNotMultipleOf00001Fails() { + // 0.00751 is not multiple of 0.0001 + val schema = BySmallNumber.BySmallNumber1.getInstance() + assertFailsWith( + block = { + schema.validate( + 0.00751, + configuration + ) + } + ) + } + + @Test + fun test00075IsMultipleOf00001Passes() { + // 0.0075 is multiple of 0.0001 + val schema = BySmallNumber.BySmallNumber1.getInstance() + schema.validate( + 0.0075, + configuration + ) + } +} diff --git a/samples/client/3_0_3_unit_test/kotlin/src/test/kotlin/org/openapijsonschematools/client/components/schemas/DateTimeFormatTest.kt b/samples/client/3_0_3_unit_test/kotlin/src/test/kotlin/org/openapijsonschematools/client/components/schemas/DateTimeFormatTest.kt new file mode 100644 index 00000000000..7e1b2ddd554 --- /dev/null +++ b/samples/client/3_0_3_unit_test/kotlin/src/test/kotlin/org/openapijsonschematools/client/components/schemas/DateTimeFormatTest.kt @@ -0,0 +1,76 @@ +package org.openapijsonschematools.client.components.schemas + +import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags +import org.openapijsonschematools.client.configurations.SchemaConfiguration +import org.openapijsonschematools.client.exceptions.ValidationException + +import kotlin.test.Test +import kotlin.test.assertFailsWith + +class DateTimeFormatTest { + companion object { + val configuration = SchemaConfiguration(JsonSchemaKeywordFlags.Builder().format().build()) + } + + @Test + fun testAllStringFormatsIgnoreIntegersPasses() { + // all string formats ignore integers + val schema = DateTimeFormat.DateTimeFormat1.getInstance() + schema.validate( + 12, + configuration + ) + } + + @Test + fun testAllStringFormatsIgnoreNullsPasses() { + // all string formats ignore nulls + val schema = DateTimeFormat.DateTimeFormat1.getInstance() + schema.validate( + null, + configuration + ) + } + + @Test + fun testAllStringFormatsIgnoreObjectsPasses() { + // all string formats ignore objects + val schema = DateTimeFormat.DateTimeFormat1.getInstance() + schema.validate( + mapOf( + ), + configuration + ) + } + + @Test + fun testAllStringFormatsIgnoreFloatsPasses() { + // all string formats ignore floats + val schema = DateTimeFormat.DateTimeFormat1.getInstance() + schema.validate( + 13.7, + configuration + ) + } + + @Test + fun testAllStringFormatsIgnoreArraysPasses() { + // all string formats ignore arrays + val schema = DateTimeFormat.DateTimeFormat1.getInstance() + schema.validate( + listOf( + ), + configuration + ) + } + + @Test + fun testAllStringFormatsIgnoreBooleansPasses() { + // all string formats ignore booleans + val schema = DateTimeFormat.DateTimeFormat1.getInstance() + schema.validate( + false, + configuration + ) + } +} diff --git a/samples/client/3_0_3_unit_test/kotlin/src/test/kotlin/org/openapijsonschematools/client/components/schemas/EmailFormatTest.kt b/samples/client/3_0_3_unit_test/kotlin/src/test/kotlin/org/openapijsonschematools/client/components/schemas/EmailFormatTest.kt new file mode 100644 index 00000000000..ac03907d1c0 --- /dev/null +++ b/samples/client/3_0_3_unit_test/kotlin/src/test/kotlin/org/openapijsonschematools/client/components/schemas/EmailFormatTest.kt @@ -0,0 +1,76 @@ +package org.openapijsonschematools.client.components.schemas + +import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags +import org.openapijsonschematools.client.configurations.SchemaConfiguration +import org.openapijsonschematools.client.exceptions.ValidationException + +import kotlin.test.Test +import kotlin.test.assertFailsWith + +class EmailFormatTest { + companion object { + val configuration = SchemaConfiguration(JsonSchemaKeywordFlags.Builder().format().build()) + } + + @Test + fun testAllStringFormatsIgnoreIntegersPasses() { + // all string formats ignore integers + val schema = EmailFormat.EmailFormat1.getInstance() + schema.validate( + 12, + configuration + ) + } + + @Test + fun testAllStringFormatsIgnoreNullsPasses() { + // all string formats ignore nulls + val schema = EmailFormat.EmailFormat1.getInstance() + schema.validate( + null, + configuration + ) + } + + @Test + fun testAllStringFormatsIgnoreObjectsPasses() { + // all string formats ignore objects + val schema = EmailFormat.EmailFormat1.getInstance() + schema.validate( + mapOf( + ), + configuration + ) + } + + @Test + fun testAllStringFormatsIgnoreFloatsPasses() { + // all string formats ignore floats + val schema = EmailFormat.EmailFormat1.getInstance() + schema.validate( + 13.7, + configuration + ) + } + + @Test + fun testAllStringFormatsIgnoreArraysPasses() { + // all string formats ignore arrays + val schema = EmailFormat.EmailFormat1.getInstance() + schema.validate( + listOf( + ), + configuration + ) + } + + @Test + fun testAllStringFormatsIgnoreBooleansPasses() { + // all string formats ignore booleans + val schema = EmailFormat.EmailFormat1.getInstance() + schema.validate( + false, + configuration + ) + } +} diff --git a/samples/client/3_0_3_unit_test/kotlin/src/test/kotlin/org/openapijsonschematools/client/components/schemas/EnumWith0DoesNotMatchFalseTest.kt b/samples/client/3_0_3_unit_test/kotlin/src/test/kotlin/org/openapijsonschematools/client/components/schemas/EnumWith0DoesNotMatchFalseTest.kt new file mode 100644 index 00000000000..c398f777e9a --- /dev/null +++ b/samples/client/3_0_3_unit_test/kotlin/src/test/kotlin/org/openapijsonschematools/client/components/schemas/EnumWith0DoesNotMatchFalseTest.kt @@ -0,0 +1,48 @@ +package org.openapijsonschematools.client.components.schemas + +import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags +import org.openapijsonschematools.client.configurations.SchemaConfiguration +import org.openapijsonschematools.client.exceptions.ValidationException + +import kotlin.test.Test +import kotlin.test.assertFailsWith + +class EnumWith0DoesNotMatchFalseTest { + companion object { + val configuration = SchemaConfiguration(JsonSchemaKeywordFlags.Builder().format().build()) + } + + @Test + fun testFloatZeroIsValidPasses() { + // float zero is valid + val schema = EnumWith0DoesNotMatchFalse.EnumWith0DoesNotMatchFalse1.getInstance() + schema.validate( + 0.0, + configuration + ) + } + + @Test + fun testFalseIsInvalidFails() { + // false is invalid + val schema = EnumWith0DoesNotMatchFalse.EnumWith0DoesNotMatchFalse1.getInstance() + assertFailsWith( + block = { + schema.validate( + false, + configuration + ) + } + ) + } + + @Test + fun testIntegerZeroIsValidPasses() { + // integer zero is valid + val schema = EnumWith0DoesNotMatchFalse.EnumWith0DoesNotMatchFalse1.getInstance() + schema.validate( + 0, + configuration + ) + } +} diff --git a/samples/client/3_0_3_unit_test/kotlin/src/test/kotlin/org/openapijsonschematools/client/components/schemas/EnumWith1DoesNotMatchTrueTest.kt b/samples/client/3_0_3_unit_test/kotlin/src/test/kotlin/org/openapijsonschematools/client/components/schemas/EnumWith1DoesNotMatchTrueTest.kt new file mode 100644 index 00000000000..8ff4f796ea8 --- /dev/null +++ b/samples/client/3_0_3_unit_test/kotlin/src/test/kotlin/org/openapijsonschematools/client/components/schemas/EnumWith1DoesNotMatchTrueTest.kt @@ -0,0 +1,48 @@ +package org.openapijsonschematools.client.components.schemas + +import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags +import org.openapijsonschematools.client.configurations.SchemaConfiguration +import org.openapijsonschematools.client.exceptions.ValidationException + +import kotlin.test.Test +import kotlin.test.assertFailsWith + +class EnumWith1DoesNotMatchTrueTest { + companion object { + val configuration = SchemaConfiguration(JsonSchemaKeywordFlags.Builder().format().build()) + } + + @Test + fun testTrueIsInvalidFails() { + // true is invalid + val schema = EnumWith1DoesNotMatchTrue.EnumWith1DoesNotMatchTrue1.getInstance() + assertFailsWith( + block = { + schema.validate( + true, + configuration + ) + } + ) + } + + @Test + fun testFloatOneIsValidPasses() { + // float one is valid + val schema = EnumWith1DoesNotMatchTrue.EnumWith1DoesNotMatchTrue1.getInstance() + schema.validate( + 1.0, + configuration + ) + } + + @Test + fun testIntegerOneIsValidPasses() { + // integer one is valid + val schema = EnumWith1DoesNotMatchTrue.EnumWith1DoesNotMatchTrue1.getInstance() + schema.validate( + 1, + configuration + ) + } +} diff --git a/samples/client/3_0_3_unit_test/kotlin/src/test/kotlin/org/openapijsonschematools/client/components/schemas/EnumWithEscapedCharactersTest.kt b/samples/client/3_0_3_unit_test/kotlin/src/test/kotlin/org/openapijsonschematools/client/components/schemas/EnumWithEscapedCharactersTest.kt new file mode 100644 index 00000000000..66bd002ada2 --- /dev/null +++ b/samples/client/3_0_3_unit_test/kotlin/src/test/kotlin/org/openapijsonschematools/client/components/schemas/EnumWithEscapedCharactersTest.kt @@ -0,0 +1,48 @@ +package org.openapijsonschematools.client.components.schemas + +import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags +import org.openapijsonschematools.client.configurations.SchemaConfiguration +import org.openapijsonschematools.client.exceptions.ValidationException + +import kotlin.test.Test +import kotlin.test.assertFailsWith + +class EnumWithEscapedCharactersTest { + companion object { + val configuration = SchemaConfiguration(JsonSchemaKeywordFlags.Builder().format().build()) + } + + @Test + fun testAnotherStringIsInvalidFails() { + // another string is invalid + val schema = EnumWithEscapedCharacters.EnumWithEscapedCharacters1.getInstance() + assertFailsWith( + block = { + schema.validate( + "abc", + configuration + ) + } + ) + } + + @Test + fun testMember2IsValidPasses() { + // member 2 is valid + val schema = EnumWithEscapedCharacters.EnumWithEscapedCharacters1.getInstance() + schema.validate( + "foo\rbar", + configuration + ) + } + + @Test + fun testMember1IsValidPasses() { + // member 1 is valid + val schema = EnumWithEscapedCharacters.EnumWithEscapedCharacters1.getInstance() + schema.validate( + "foo\nbar", + configuration + ) + } +} diff --git a/samples/client/3_0_3_unit_test/kotlin/src/test/kotlin/org/openapijsonschematools/client/components/schemas/EnumWithFalseDoesNotMatch0Test.kt b/samples/client/3_0_3_unit_test/kotlin/src/test/kotlin/org/openapijsonschematools/client/components/schemas/EnumWithFalseDoesNotMatch0Test.kt new file mode 100644 index 00000000000..540c60f5577 --- /dev/null +++ b/samples/client/3_0_3_unit_test/kotlin/src/test/kotlin/org/openapijsonschematools/client/components/schemas/EnumWithFalseDoesNotMatch0Test.kt @@ -0,0 +1,52 @@ +package org.openapijsonschematools.client.components.schemas + +import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags +import org.openapijsonschematools.client.configurations.SchemaConfiguration +import org.openapijsonschematools.client.exceptions.ValidationException + +import kotlin.test.Test +import kotlin.test.assertFailsWith + +class EnumWithFalseDoesNotMatch0Test { + companion object { + val configuration = SchemaConfiguration(JsonSchemaKeywordFlags.Builder().format().build()) + } + + @Test + fun testFloatZeroIsInvalidFails() { + // float zero is invalid + val schema = EnumWithFalseDoesNotMatch0.EnumWithFalseDoesNotMatch01.getInstance() + assertFailsWith( + block = { + schema.validate( + 0.0, + configuration + ) + } + ) + } + + @Test + fun testFalseIsValidPasses() { + // false is valid + val schema = EnumWithFalseDoesNotMatch0.EnumWithFalseDoesNotMatch01.getInstance() + schema.validate( + false, + configuration + ) + } + + @Test + fun testIntegerZeroIsInvalidFails() { + // integer zero is invalid + val schema = EnumWithFalseDoesNotMatch0.EnumWithFalseDoesNotMatch01.getInstance() + assertFailsWith( + block = { + schema.validate( + 0, + configuration + ) + } + ) + } +} diff --git a/samples/client/3_0_3_unit_test/kotlin/src/test/kotlin/org/openapijsonschematools/client/components/schemas/EnumWithTrueDoesNotMatch1Test.kt b/samples/client/3_0_3_unit_test/kotlin/src/test/kotlin/org/openapijsonschematools/client/components/schemas/EnumWithTrueDoesNotMatch1Test.kt new file mode 100644 index 00000000000..4f5ca3b42fb --- /dev/null +++ b/samples/client/3_0_3_unit_test/kotlin/src/test/kotlin/org/openapijsonschematools/client/components/schemas/EnumWithTrueDoesNotMatch1Test.kt @@ -0,0 +1,52 @@ +package org.openapijsonschematools.client.components.schemas + +import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags +import org.openapijsonschematools.client.configurations.SchemaConfiguration +import org.openapijsonschematools.client.exceptions.ValidationException + +import kotlin.test.Test +import kotlin.test.assertFailsWith + +class EnumWithTrueDoesNotMatch1Test { + companion object { + val configuration = SchemaConfiguration(JsonSchemaKeywordFlags.Builder().format().build()) + } + + @Test + fun testFloatOneIsInvalidFails() { + // float one is invalid + val schema = EnumWithTrueDoesNotMatch1.EnumWithTrueDoesNotMatch11.getInstance() + assertFailsWith( + block = { + schema.validate( + 1.0, + configuration + ) + } + ) + } + + @Test + fun testIntegerOneIsInvalidFails() { + // integer one is invalid + val schema = EnumWithTrueDoesNotMatch1.EnumWithTrueDoesNotMatch11.getInstance() + assertFailsWith( + block = { + schema.validate( + 1, + configuration + ) + } + ) + } + + @Test + fun testTrueIsValidPasses() { + // true is valid + val schema = EnumWithTrueDoesNotMatch1.EnumWithTrueDoesNotMatch11.getInstance() + schema.validate( + true, + configuration + ) + } +} diff --git a/samples/client/3_0_3_unit_test/kotlin/src/test/kotlin/org/openapijsonschematools/client/components/schemas/EnumsInPropertiesTest.kt b/samples/client/3_0_3_unit_test/kotlin/src/test/kotlin/org/openapijsonschematools/client/components/schemas/EnumsInPropertiesTest.kt new file mode 100644 index 00000000000..d98a079ce00 --- /dev/null +++ b/samples/client/3_0_3_unit_test/kotlin/src/test/kotlin/org/openapijsonschematools/client/components/schemas/EnumsInPropertiesTest.kt @@ -0,0 +1,128 @@ +package org.openapijsonschematools.client.components.schemas + +import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags +import org.openapijsonschematools.client.configurations.SchemaConfiguration +import org.openapijsonschematools.client.exceptions.ValidationException + +import kotlin.test.Test +import kotlin.test.assertFailsWith + +class EnumsInPropertiesTest { + companion object { + val configuration = SchemaConfiguration(JsonSchemaKeywordFlags.Builder().format().build()) + } + + @Test + fun testWrongBarValueFails() { + // wrong bar value + val schema = EnumsInProperties.EnumsInProperties1.getInstance() + assertFailsWith( + block = { + schema.validate( + mapOf( + Pair( + "foo", + "foo" + ), + Pair( + "bar", + "bart" + ) + ), + configuration + ) + } + ) + } + + @Test + fun testWrongFooValueFails() { + // wrong foo value + val schema = EnumsInProperties.EnumsInProperties1.getInstance() + assertFailsWith( + block = { + schema.validate( + mapOf( + Pair( + "foo", + "foot" + ), + Pair( + "bar", + "bar" + ) + ), + configuration + ) + } + ) + } + + @Test + fun testMissingAllPropertiesIsInvalidFails() { + // missing all properties is invalid + val schema = EnumsInProperties.EnumsInProperties1.getInstance() + assertFailsWith( + block = { + schema.validate( + mapOf( + ), + configuration + ) + } + ) + } + + @Test + fun testBothPropertiesAreValidPasses() { + // both properties are valid + val schema = EnumsInProperties.EnumsInProperties1.getInstance() + schema.validate( + mapOf( + Pair( + "foo", + "foo" + ), + Pair( + "bar", + "bar" + ) + ), + configuration + ) + } + + @Test + fun testMissingOptionalPropertyIsValidPasses() { + // missing optional property is valid + val schema = EnumsInProperties.EnumsInProperties1.getInstance() + schema.validate( + mapOf( + Pair( + "bar", + "bar" + ) + ), + configuration + ) + } + + @Test + fun testMissingRequiredPropertyIsInvalidFails() { + // missing required property is invalid + val schema = EnumsInProperties.EnumsInProperties1.getInstance() + assertFailsWith( + block = { + schema.validate( + mapOf( + Pair( + "foo", + "foo" + ) + ), + configuration + ) + } + ) + } +} diff --git a/samples/client/3_0_3_unit_test/kotlin/src/test/kotlin/org/openapijsonschematools/client/components/schemas/ForbiddenPropertyTest.kt b/samples/client/3_0_3_unit_test/kotlin/src/test/kotlin/org/openapijsonschematools/client/components/schemas/ForbiddenPropertyTest.kt new file mode 100644 index 00000000000..79c52a38bb6 --- /dev/null +++ b/samples/client/3_0_3_unit_test/kotlin/src/test/kotlin/org/openapijsonschematools/client/components/schemas/ForbiddenPropertyTest.kt @@ -0,0 +1,56 @@ +package org.openapijsonschematools.client.components.schemas + +import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags +import org.openapijsonschematools.client.configurations.SchemaConfiguration +import org.openapijsonschematools.client.exceptions.ValidationException + +import kotlin.test.Test +import kotlin.test.assertFailsWith + +class ForbiddenPropertyTest { + companion object { + val configuration = SchemaConfiguration(JsonSchemaKeywordFlags.Builder().format().build()) + } + + @Test + fun testPropertyPresentFails() { + // property present + val schema = ForbiddenProperty.ForbiddenProperty1.getInstance() + assertFailsWith( + block = { + schema.validate( + mapOf( + Pair( + "foo", + 1 + ), + Pair( + "bar", + 2 + ) + ), + configuration + ) + } + ) + } + + @Test + fun testPropertyAbsentPasses() { + // property absent + val schema = ForbiddenProperty.ForbiddenProperty1.getInstance() + schema.validate( + mapOf( + Pair( + "bar", + 1 + ), + Pair( + "baz", + 2 + ) + ), + configuration + ) + } +} diff --git a/samples/client/3_0_3_unit_test/kotlin/src/test/kotlin/org/openapijsonschematools/client/components/schemas/HostnameFormatTest.kt b/samples/client/3_0_3_unit_test/kotlin/src/test/kotlin/org/openapijsonschematools/client/components/schemas/HostnameFormatTest.kt new file mode 100644 index 00000000000..40fb2cc72e4 --- /dev/null +++ b/samples/client/3_0_3_unit_test/kotlin/src/test/kotlin/org/openapijsonschematools/client/components/schemas/HostnameFormatTest.kt @@ -0,0 +1,76 @@ +package org.openapijsonschematools.client.components.schemas + +import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags +import org.openapijsonschematools.client.configurations.SchemaConfiguration +import org.openapijsonschematools.client.exceptions.ValidationException + +import kotlin.test.Test +import kotlin.test.assertFailsWith + +class HostnameFormatTest { + companion object { + val configuration = SchemaConfiguration(JsonSchemaKeywordFlags.Builder().format().build()) + } + + @Test + fun testAllStringFormatsIgnoreIntegersPasses() { + // all string formats ignore integers + val schema = HostnameFormat.HostnameFormat1.getInstance() + schema.validate( + 12, + configuration + ) + } + + @Test + fun testAllStringFormatsIgnoreNullsPasses() { + // all string formats ignore nulls + val schema = HostnameFormat.HostnameFormat1.getInstance() + schema.validate( + null, + configuration + ) + } + + @Test + fun testAllStringFormatsIgnoreObjectsPasses() { + // all string formats ignore objects + val schema = HostnameFormat.HostnameFormat1.getInstance() + schema.validate( + mapOf( + ), + configuration + ) + } + + @Test + fun testAllStringFormatsIgnoreFloatsPasses() { + // all string formats ignore floats + val schema = HostnameFormat.HostnameFormat1.getInstance() + schema.validate( + 13.7, + configuration + ) + } + + @Test + fun testAllStringFormatsIgnoreArraysPasses() { + // all string formats ignore arrays + val schema = HostnameFormat.HostnameFormat1.getInstance() + schema.validate( + listOf( + ), + configuration + ) + } + + @Test + fun testAllStringFormatsIgnoreBooleansPasses() { + // all string formats ignore booleans + val schema = HostnameFormat.HostnameFormat1.getInstance() + schema.validate( + false, + configuration + ) + } +} diff --git a/samples/client/3_0_3_unit_test/kotlin/src/test/kotlin/org/openapijsonschematools/client/components/schemas/IntegerTypeMatchesIntegersTest.kt b/samples/client/3_0_3_unit_test/kotlin/src/test/kotlin/org/openapijsonschematools/client/components/schemas/IntegerTypeMatchesIntegersTest.kt new file mode 100644 index 00000000000..5acb5daa6ce --- /dev/null +++ b/samples/client/3_0_3_unit_test/kotlin/src/test/kotlin/org/openapijsonschematools/client/components/schemas/IntegerTypeMatchesIntegersTest.kt @@ -0,0 +1,134 @@ +package org.openapijsonschematools.client.components.schemas + +import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags +import org.openapijsonschematools.client.configurations.SchemaConfiguration +import org.openapijsonschematools.client.exceptions.ValidationException + +import kotlin.test.Test +import kotlin.test.assertFailsWith + +class IntegerTypeMatchesIntegersTest { + companion object { + val configuration = SchemaConfiguration(JsonSchemaKeywordFlags.Builder().format().build()) + } + + @Test + fun testAnObjectIsNotAnIntegerFails() { + // an object is not an integer + val schema = IntegerTypeMatchesIntegers.IntegerTypeMatchesIntegers1.getInstance() + assertFailsWith( + block = { + schema.validate( + mapOf( + ), + configuration + ) + } + ) + } + + @Test + fun testAnArrayIsNotAnIntegerFails() { + // an array is not an integer + val schema = IntegerTypeMatchesIntegers.IntegerTypeMatchesIntegers1.getInstance() + assertFailsWith( + block = { + schema.validate( + listOf( + ), + configuration + ) + } + ) + } + + @Test + fun testNullIsNotAnIntegerFails() { + // null is not an integer + val schema = IntegerTypeMatchesIntegers.IntegerTypeMatchesIntegers1.getInstance() + assertFailsWith( + block = { + schema.validate( + null, + configuration + ) + } + ) + } + + @Test + fun testAFloatWithZeroFractionalPartIsAnIntegerPasses() { + // a float with zero fractional part is an integer + val schema = IntegerTypeMatchesIntegers.IntegerTypeMatchesIntegers1.getInstance() + schema.validate( + 1.0, + configuration + ) + } + + @Test + fun testABooleanIsNotAnIntegerFails() { + // a boolean is not an integer + val schema = IntegerTypeMatchesIntegers.IntegerTypeMatchesIntegers1.getInstance() + assertFailsWith( + block = { + schema.validate( + true, + configuration + ) + } + ) + } + + @Test + fun testAStringIsStillNotAnIntegerEvenIfItLooksLikeOneFails() { + // a string is still not an integer, even if it looks like one + val schema = IntegerTypeMatchesIntegers.IntegerTypeMatchesIntegers1.getInstance() + assertFailsWith( + block = { + schema.validate( + "1", + configuration + ) + } + ) + } + + @Test + fun testAStringIsNotAnIntegerFails() { + // a string is not an integer + val schema = IntegerTypeMatchesIntegers.IntegerTypeMatchesIntegers1.getInstance() + assertFailsWith( + block = { + schema.validate( + "foo", + configuration + ) + } + ) + } + + @Test + fun testAnIntegerIsAnIntegerPasses() { + // an integer is an integer + val schema = IntegerTypeMatchesIntegers.IntegerTypeMatchesIntegers1.getInstance() + schema.validate( + 1, + configuration + ) + } + + @Test + fun testAFloatIsNotAnIntegerFails() { + // a float is not an integer + val schema = IntegerTypeMatchesIntegers.IntegerTypeMatchesIntegers1.getInstance() + assertFailsWith( + block = { + schema.validate( + 1.1, + configuration + ) + } + ) + } +} diff --git a/samples/client/3_0_3_unit_test/kotlin/src/test/kotlin/org/openapijsonschematools/client/components/schemas/InvalidInstanceShouldNotRaiseErrorWhenFloatDivisionInfTest.kt b/samples/client/3_0_3_unit_test/kotlin/src/test/kotlin/org/openapijsonschematools/client/components/schemas/InvalidInstanceShouldNotRaiseErrorWhenFloatDivisionInfTest.kt new file mode 100644 index 00000000000..66695338367 --- /dev/null +++ b/samples/client/3_0_3_unit_test/kotlin/src/test/kotlin/org/openapijsonschematools/client/components/schemas/InvalidInstanceShouldNotRaiseErrorWhenFloatDivisionInfTest.kt @@ -0,0 +1,38 @@ +package org.openapijsonschematools.client.components.schemas + +import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags +import org.openapijsonschematools.client.configurations.SchemaConfiguration +import org.openapijsonschematools.client.exceptions.ValidationException + +import kotlin.test.Test +import kotlin.test.assertFailsWith + +class InvalidInstanceShouldNotRaiseErrorWhenFloatDivisionInfTest { + companion object { + val configuration = SchemaConfiguration(JsonSchemaKeywordFlags.Builder().format().build()) + } + + @Test + fun testAlwaysInvalidButNaiveImplementationsMayRaiseAnOverflowErrorFails() { + // always invalid, but naive implementations may raise an overflow error + val schema = InvalidInstanceShouldNotRaiseErrorWhenFloatDivisionInf.InvalidInstanceShouldNotRaiseErrorWhenFloatDivisionInf1.getInstance() + assertFailsWith( + block = { + schema.validate( + 1.0E308, + configuration + ) + } + ) + } + + @Test + fun testValidIntegerWithMultipleofFloatPasses() { + // valid integer with multipleOf float + val schema = InvalidInstanceShouldNotRaiseErrorWhenFloatDivisionInf.InvalidInstanceShouldNotRaiseErrorWhenFloatDivisionInf1.getInstance() + schema.validate( + 123456789, + configuration + ) + } +} diff --git a/samples/client/3_0_3_unit_test/kotlin/src/test/kotlin/org/openapijsonschematools/client/components/schemas/InvalidStringValueForDefaultTest.kt b/samples/client/3_0_3_unit_test/kotlin/src/test/kotlin/org/openapijsonschematools/client/components/schemas/InvalidStringValueForDefaultTest.kt new file mode 100644 index 00000000000..e7883b92b4b --- /dev/null +++ b/samples/client/3_0_3_unit_test/kotlin/src/test/kotlin/org/openapijsonschematools/client/components/schemas/InvalidStringValueForDefaultTest.kt @@ -0,0 +1,40 @@ +package org.openapijsonschematools.client.components.schemas + +import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags +import org.openapijsonschematools.client.configurations.SchemaConfiguration +import org.openapijsonschematools.client.exceptions.ValidationException + +import kotlin.test.Test +import kotlin.test.assertFailsWith + +class InvalidStringValueForDefaultTest { + companion object { + val configuration = SchemaConfiguration(JsonSchemaKeywordFlags.Builder().format().build()) + } + + @Test + fun testValidWhenPropertyIsSpecifiedPasses() { + // valid when property is specified + val schema = InvalidStringValueForDefault.InvalidStringValueForDefault1.getInstance() + schema.validate( + mapOf( + Pair( + "bar", + "good" + ) + ), + configuration + ) + } + + @Test + fun testStillValidWhenTheInvalidDefaultIsUsedPasses() { + // still valid when the invalid default is used + val schema = InvalidStringValueForDefault.InvalidStringValueForDefault1.getInstance() + schema.validate( + mapOf( + ), + configuration + ) + } +} diff --git a/samples/client/3_0_3_unit_test/kotlin/src/test/kotlin/org/openapijsonschematools/client/components/schemas/Ipv4FormatTest.kt b/samples/client/3_0_3_unit_test/kotlin/src/test/kotlin/org/openapijsonschematools/client/components/schemas/Ipv4FormatTest.kt new file mode 100644 index 00000000000..e99e0e709fb --- /dev/null +++ b/samples/client/3_0_3_unit_test/kotlin/src/test/kotlin/org/openapijsonschematools/client/components/schemas/Ipv4FormatTest.kt @@ -0,0 +1,76 @@ +package org.openapijsonschematools.client.components.schemas + +import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags +import org.openapijsonschematools.client.configurations.SchemaConfiguration +import org.openapijsonschematools.client.exceptions.ValidationException + +import kotlin.test.Test +import kotlin.test.assertFailsWith + +class Ipv4FormatTest { + companion object { + val configuration = SchemaConfiguration(JsonSchemaKeywordFlags.Builder().format().build()) + } + + @Test + fun testAllStringFormatsIgnoreIntegersPasses() { + // all string formats ignore integers + val schema = Ipv4Format.Ipv4Format1.getInstance() + schema.validate( + 12, + configuration + ) + } + + @Test + fun testAllStringFormatsIgnoreNullsPasses() { + // all string formats ignore nulls + val schema = Ipv4Format.Ipv4Format1.getInstance() + schema.validate( + null, + configuration + ) + } + + @Test + fun testAllStringFormatsIgnoreObjectsPasses() { + // all string formats ignore objects + val schema = Ipv4Format.Ipv4Format1.getInstance() + schema.validate( + mapOf( + ), + configuration + ) + } + + @Test + fun testAllStringFormatsIgnoreFloatsPasses() { + // all string formats ignore floats + val schema = Ipv4Format.Ipv4Format1.getInstance() + schema.validate( + 13.7, + configuration + ) + } + + @Test + fun testAllStringFormatsIgnoreArraysPasses() { + // all string formats ignore arrays + val schema = Ipv4Format.Ipv4Format1.getInstance() + schema.validate( + listOf( + ), + configuration + ) + } + + @Test + fun testAllStringFormatsIgnoreBooleansPasses() { + // all string formats ignore booleans + val schema = Ipv4Format.Ipv4Format1.getInstance() + schema.validate( + false, + configuration + ) + } +} diff --git a/samples/client/3_0_3_unit_test/kotlin/src/test/kotlin/org/openapijsonschematools/client/components/schemas/Ipv6FormatTest.kt b/samples/client/3_0_3_unit_test/kotlin/src/test/kotlin/org/openapijsonschematools/client/components/schemas/Ipv6FormatTest.kt new file mode 100644 index 00000000000..d80303dcdea --- /dev/null +++ b/samples/client/3_0_3_unit_test/kotlin/src/test/kotlin/org/openapijsonschematools/client/components/schemas/Ipv6FormatTest.kt @@ -0,0 +1,76 @@ +package org.openapijsonschematools.client.components.schemas + +import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags +import org.openapijsonschematools.client.configurations.SchemaConfiguration +import org.openapijsonschematools.client.exceptions.ValidationException + +import kotlin.test.Test +import kotlin.test.assertFailsWith + +class Ipv6FormatTest { + companion object { + val configuration = SchemaConfiguration(JsonSchemaKeywordFlags.Builder().format().build()) + } + + @Test + fun testAllStringFormatsIgnoreIntegersPasses() { + // all string formats ignore integers + val schema = Ipv6Format.Ipv6Format1.getInstance() + schema.validate( + 12, + configuration + ) + } + + @Test + fun testAllStringFormatsIgnoreNullsPasses() { + // all string formats ignore nulls + val schema = Ipv6Format.Ipv6Format1.getInstance() + schema.validate( + null, + configuration + ) + } + + @Test + fun testAllStringFormatsIgnoreObjectsPasses() { + // all string formats ignore objects + val schema = Ipv6Format.Ipv6Format1.getInstance() + schema.validate( + mapOf( + ), + configuration + ) + } + + @Test + fun testAllStringFormatsIgnoreFloatsPasses() { + // all string formats ignore floats + val schema = Ipv6Format.Ipv6Format1.getInstance() + schema.validate( + 13.7, + configuration + ) + } + + @Test + fun testAllStringFormatsIgnoreArraysPasses() { + // all string formats ignore arrays + val schema = Ipv6Format.Ipv6Format1.getInstance() + schema.validate( + listOf( + ), + configuration + ) + } + + @Test + fun testAllStringFormatsIgnoreBooleansPasses() { + // all string formats ignore booleans + val schema = Ipv6Format.Ipv6Format1.getInstance() + schema.validate( + false, + configuration + ) + } +} diff --git a/samples/client/3_0_3_unit_test/kotlin/src/test/kotlin/org/openapijsonschematools/client/components/schemas/JsonPointerFormatTest.kt b/samples/client/3_0_3_unit_test/kotlin/src/test/kotlin/org/openapijsonschematools/client/components/schemas/JsonPointerFormatTest.kt new file mode 100644 index 00000000000..63ed82e2b97 --- /dev/null +++ b/samples/client/3_0_3_unit_test/kotlin/src/test/kotlin/org/openapijsonschematools/client/components/schemas/JsonPointerFormatTest.kt @@ -0,0 +1,76 @@ +package org.openapijsonschematools.client.components.schemas + +import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags +import org.openapijsonschematools.client.configurations.SchemaConfiguration +import org.openapijsonschematools.client.exceptions.ValidationException + +import kotlin.test.Test +import kotlin.test.assertFailsWith + +class JsonPointerFormatTest { + companion object { + val configuration = SchemaConfiguration(JsonSchemaKeywordFlags.Builder().format().build()) + } + + @Test + fun testAllStringFormatsIgnoreIntegersPasses() { + // all string formats ignore integers + val schema = JsonPointerFormat.JsonPointerFormat1.getInstance() + schema.validate( + 12, + configuration + ) + } + + @Test + fun testAllStringFormatsIgnoreNullsPasses() { + // all string formats ignore nulls + val schema = JsonPointerFormat.JsonPointerFormat1.getInstance() + schema.validate( + null, + configuration + ) + } + + @Test + fun testAllStringFormatsIgnoreObjectsPasses() { + // all string formats ignore objects + val schema = JsonPointerFormat.JsonPointerFormat1.getInstance() + schema.validate( + mapOf( + ), + configuration + ) + } + + @Test + fun testAllStringFormatsIgnoreFloatsPasses() { + // all string formats ignore floats + val schema = JsonPointerFormat.JsonPointerFormat1.getInstance() + schema.validate( + 13.7, + configuration + ) + } + + @Test + fun testAllStringFormatsIgnoreArraysPasses() { + // all string formats ignore arrays + val schema = JsonPointerFormat.JsonPointerFormat1.getInstance() + schema.validate( + listOf( + ), + configuration + ) + } + + @Test + fun testAllStringFormatsIgnoreBooleansPasses() { + // all string formats ignore booleans + val schema = JsonPointerFormat.JsonPointerFormat1.getInstance() + schema.validate( + false, + configuration + ) + } +} diff --git a/samples/client/3_0_3_unit_test/kotlin/src/test/kotlin/org/openapijsonschematools/client/components/schemas/MaximumValidationTest.kt b/samples/client/3_0_3_unit_test/kotlin/src/test/kotlin/org/openapijsonschematools/client/components/schemas/MaximumValidationTest.kt new file mode 100644 index 00000000000..d6e53bea2b0 --- /dev/null +++ b/samples/client/3_0_3_unit_test/kotlin/src/test/kotlin/org/openapijsonschematools/client/components/schemas/MaximumValidationTest.kt @@ -0,0 +1,58 @@ +package org.openapijsonschematools.client.components.schemas + +import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags +import org.openapijsonschematools.client.configurations.SchemaConfiguration +import org.openapijsonschematools.client.exceptions.ValidationException + +import kotlin.test.Test +import kotlin.test.assertFailsWith + +class MaximumValidationTest { + companion object { + val configuration = SchemaConfiguration(JsonSchemaKeywordFlags.Builder().format().build()) + } + + @Test + fun testAboveTheMaximumIsInvalidFails() { + // above the maximum is invalid + val schema = MaximumValidation.MaximumValidation1.getInstance() + assertFailsWith( + block = { + schema.validate( + 3.5, + configuration + ) + } + ) + } + + @Test + fun testBoundaryPointIsValidPasses() { + // boundary point is valid + val schema = MaximumValidation.MaximumValidation1.getInstance() + schema.validate( + 3.0, + configuration + ) + } + + @Test + fun testBelowTheMaximumIsValidPasses() { + // below the maximum is valid + val schema = MaximumValidation.MaximumValidation1.getInstance() + schema.validate( + 2.6, + configuration + ) + } + + @Test + fun testIgnoresNonNumbersPasses() { + // ignores non-numbers + val schema = MaximumValidation.MaximumValidation1.getInstance() + schema.validate( + "x", + configuration + ) + } +} diff --git a/samples/client/3_0_3_unit_test/kotlin/src/test/kotlin/org/openapijsonschematools/client/components/schemas/MaximumValidationWithUnsignedIntegerTest.kt b/samples/client/3_0_3_unit_test/kotlin/src/test/kotlin/org/openapijsonschematools/client/components/schemas/MaximumValidationWithUnsignedIntegerTest.kt new file mode 100644 index 00000000000..f486b09d617 --- /dev/null +++ b/samples/client/3_0_3_unit_test/kotlin/src/test/kotlin/org/openapijsonschematools/client/components/schemas/MaximumValidationWithUnsignedIntegerTest.kt @@ -0,0 +1,58 @@ +package org.openapijsonschematools.client.components.schemas + +import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags +import org.openapijsonschematools.client.configurations.SchemaConfiguration +import org.openapijsonschematools.client.exceptions.ValidationException + +import kotlin.test.Test +import kotlin.test.assertFailsWith + +class MaximumValidationWithUnsignedIntegerTest { + companion object { + val configuration = SchemaConfiguration(JsonSchemaKeywordFlags.Builder().format().build()) + } + + @Test + fun testAboveTheMaximumIsInvalidFails() { + // above the maximum is invalid + val schema = MaximumValidationWithUnsignedInteger.MaximumValidationWithUnsignedInteger1.getInstance() + assertFailsWith( + block = { + schema.validate( + 300.5, + configuration + ) + } + ) + } + + @Test + fun testBelowTheMaximumIsInvalidPasses() { + // below the maximum is invalid + val schema = MaximumValidationWithUnsignedInteger.MaximumValidationWithUnsignedInteger1.getInstance() + schema.validate( + 299.97, + configuration + ) + } + + @Test + fun testBoundaryPointIntegerIsValidPasses() { + // boundary point integer is valid + val schema = MaximumValidationWithUnsignedInteger.MaximumValidationWithUnsignedInteger1.getInstance() + schema.validate( + 300, + configuration + ) + } + + @Test + fun testBoundaryPointFloatIsValidPasses() { + // boundary point float is valid + val schema = MaximumValidationWithUnsignedInteger.MaximumValidationWithUnsignedInteger1.getInstance() + schema.validate( + 300.0, + configuration + ) + } +} diff --git a/samples/client/3_0_3_unit_test/kotlin/src/test/kotlin/org/openapijsonschematools/client/components/schemas/MaxitemsValidationTest.kt b/samples/client/3_0_3_unit_test/kotlin/src/test/kotlin/org/openapijsonschematools/client/components/schemas/MaxitemsValidationTest.kt new file mode 100644 index 00000000000..01c61a00377 --- /dev/null +++ b/samples/client/3_0_3_unit_test/kotlin/src/test/kotlin/org/openapijsonschematools/client/components/schemas/MaxitemsValidationTest.kt @@ -0,0 +1,67 @@ +package org.openapijsonschematools.client.components.schemas + +import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags +import org.openapijsonschematools.client.configurations.SchemaConfiguration +import org.openapijsonschematools.client.exceptions.ValidationException + +import kotlin.test.Test +import kotlin.test.assertFailsWith + +class MaxitemsValidationTest { + companion object { + val configuration = SchemaConfiguration(JsonSchemaKeywordFlags.Builder().format().build()) + } + + @Test + fun testShorterIsValidPasses() { + // shorter is valid + val schema = MaxitemsValidation.MaxitemsValidation1.getInstance() + schema.validate( + listOf( + 1 + ), + configuration + ) + } + + @Test + fun testExactLengthIsValidPasses() { + // exact length is valid + val schema = MaxitemsValidation.MaxitemsValidation1.getInstance() + schema.validate( + listOf( + 1, + 2 + ), + configuration + ) + } + + @Test + fun testTooLongIsInvalidFails() { + // too long is invalid + val schema = MaxitemsValidation.MaxitemsValidation1.getInstance() + assertFailsWith( + block = { + schema.validate( + listOf( + 1, + 2, + 3 + ), + configuration + ) + } + ) + } + + @Test + fun testIgnoresNonArraysPasses() { + // ignores non-arrays + val schema = MaxitemsValidation.MaxitemsValidation1.getInstance() + schema.validate( + "foobar", + configuration + ) + } +} diff --git a/samples/client/3_0_3_unit_test/kotlin/src/test/kotlin/org/openapijsonschematools/client/components/schemas/MaxlengthValidationTest.kt b/samples/client/3_0_3_unit_test/kotlin/src/test/kotlin/org/openapijsonschematools/client/components/schemas/MaxlengthValidationTest.kt new file mode 100644 index 00000000000..dba10dc74cc --- /dev/null +++ b/samples/client/3_0_3_unit_test/kotlin/src/test/kotlin/org/openapijsonschematools/client/components/schemas/MaxlengthValidationTest.kt @@ -0,0 +1,68 @@ +package org.openapijsonschematools.client.components.schemas + +import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags +import org.openapijsonschematools.client.configurations.SchemaConfiguration +import org.openapijsonschematools.client.exceptions.ValidationException + +import kotlin.test.Test +import kotlin.test.assertFailsWith + +class MaxlengthValidationTest { + companion object { + val configuration = SchemaConfiguration(JsonSchemaKeywordFlags.Builder().format().build()) + } + + @Test + fun testShorterIsValidPasses() { + // shorter is valid + val schema = MaxlengthValidation.MaxlengthValidation1.getInstance() + schema.validate( + "f", + configuration + ) + } + + @Test + fun testExactLengthIsValidPasses() { + // exact length is valid + val schema = MaxlengthValidation.MaxlengthValidation1.getInstance() + schema.validate( + "fo", + configuration + ) + } + + @Test + fun testTooLongIsInvalidFails() { + // too long is invalid + val schema = MaxlengthValidation.MaxlengthValidation1.getInstance() + assertFailsWith( + block = { + schema.validate( + "foo", + configuration + ) + } + ) + } + + @Test + fun testIgnoresNonStringsPasses() { + // ignores non-strings + val schema = MaxlengthValidation.MaxlengthValidation1.getInstance() + schema.validate( + 100, + configuration + ) + } + + @Test + fun testTwoSupplementaryUnicodeCodePointsIsLongEnoughPasses() { + // two supplementary Unicode code points is long enough + val schema = MaxlengthValidation.MaxlengthValidation1.getInstance() + schema.validate( + "💩💩", + configuration + ) + } +} diff --git a/samples/client/3_0_3_unit_test/kotlin/src/test/kotlin/org/openapijsonschematools/client/components/schemas/Maxproperties0MeansTheObjectIsEmptyTest.kt b/samples/client/3_0_3_unit_test/kotlin/src/test/kotlin/org/openapijsonschematools/client/components/schemas/Maxproperties0MeansTheObjectIsEmptyTest.kt new file mode 100644 index 00000000000..8c397df7deb --- /dev/null +++ b/samples/client/3_0_3_unit_test/kotlin/src/test/kotlin/org/openapijsonschematools/client/components/schemas/Maxproperties0MeansTheObjectIsEmptyTest.kt @@ -0,0 +1,44 @@ +package org.openapijsonschematools.client.components.schemas + +import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags +import org.openapijsonschematools.client.configurations.SchemaConfiguration +import org.openapijsonschematools.client.exceptions.ValidationException + +import kotlin.test.Test +import kotlin.test.assertFailsWith + +class Maxproperties0MeansTheObjectIsEmptyTest { + companion object { + val configuration = SchemaConfiguration(JsonSchemaKeywordFlags.Builder().format().build()) + } + + @Test + fun testOnePropertyIsInvalidFails() { + // one property is invalid + val schema = Maxproperties0MeansTheObjectIsEmpty.Maxproperties0MeansTheObjectIsEmpty1.getInstance() + assertFailsWith( + block = { + schema.validate( + mapOf( + Pair( + "foo", + 1 + ) + ), + configuration + ) + } + ) + } + + @Test + fun testNoPropertiesIsValidPasses() { + // no properties is valid + val schema = Maxproperties0MeansTheObjectIsEmpty.Maxproperties0MeansTheObjectIsEmpty1.getInstance() + schema.validate( + mapOf( + ), + configuration + ) + } +} diff --git a/samples/client/3_0_3_unit_test/kotlin/src/test/kotlin/org/openapijsonschematools/client/components/schemas/MaxpropertiesValidationTest.kt b/samples/client/3_0_3_unit_test/kotlin/src/test/kotlin/org/openapijsonschematools/client/components/schemas/MaxpropertiesValidationTest.kt new file mode 100644 index 00000000000..25fe6859ed0 --- /dev/null +++ b/samples/client/3_0_3_unit_test/kotlin/src/test/kotlin/org/openapijsonschematools/client/components/schemas/MaxpropertiesValidationTest.kt @@ -0,0 +1,109 @@ +package org.openapijsonschematools.client.components.schemas + +import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags +import org.openapijsonschematools.client.configurations.SchemaConfiguration +import org.openapijsonschematools.client.exceptions.ValidationException + +import kotlin.test.Test +import kotlin.test.assertFailsWith + +class MaxpropertiesValidationTest { + companion object { + val configuration = SchemaConfiguration(JsonSchemaKeywordFlags.Builder().format().build()) + } + + @Test + fun testShorterIsValidPasses() { + // shorter is valid + val schema = MaxpropertiesValidation.MaxpropertiesValidation1.getInstance() + schema.validate( + mapOf( + Pair( + "foo", + 1 + ) + ), + configuration + ) + } + + @Test + fun testExactLengthIsValidPasses() { + // exact length is valid + val schema = MaxpropertiesValidation.MaxpropertiesValidation1.getInstance() + schema.validate( + mapOf( + Pair( + "foo", + 1 + ), + Pair( + "bar", + 2 + ) + ), + configuration + ) + } + + @Test + fun testTooLongIsInvalidFails() { + // too long is invalid + val schema = MaxpropertiesValidation.MaxpropertiesValidation1.getInstance() + assertFailsWith( + block = { + schema.validate( + mapOf( + Pair( + "foo", + 1 + ), + Pair( + "bar", + 2 + ), + Pair( + "baz", + 3 + ) + ), + configuration + ) + } + ) + } + + @Test + fun testIgnoresOtherNonObjectsPasses() { + // ignores other non-objects + val schema = MaxpropertiesValidation.MaxpropertiesValidation1.getInstance() + schema.validate( + 12, + configuration + ) + } + + @Test + fun testIgnoresArraysPasses() { + // ignores arrays + val schema = MaxpropertiesValidation.MaxpropertiesValidation1.getInstance() + schema.validate( + listOf( + 1, + 2, + 3 + ), + configuration + ) + } + + @Test + fun testIgnoresStringsPasses() { + // ignores strings + val schema = MaxpropertiesValidation.MaxpropertiesValidation1.getInstance() + schema.validate( + "foobar", + configuration + ) + } +} diff --git a/samples/client/3_0_3_unit_test/kotlin/src/test/kotlin/org/openapijsonschematools/client/components/schemas/MinimumValidationTest.kt b/samples/client/3_0_3_unit_test/kotlin/src/test/kotlin/org/openapijsonschematools/client/components/schemas/MinimumValidationTest.kt new file mode 100644 index 00000000000..3424b61c67d --- /dev/null +++ b/samples/client/3_0_3_unit_test/kotlin/src/test/kotlin/org/openapijsonschematools/client/components/schemas/MinimumValidationTest.kt @@ -0,0 +1,58 @@ +package org.openapijsonschematools.client.components.schemas + +import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags +import org.openapijsonschematools.client.configurations.SchemaConfiguration +import org.openapijsonschematools.client.exceptions.ValidationException + +import kotlin.test.Test +import kotlin.test.assertFailsWith + +class MinimumValidationTest { + companion object { + val configuration = SchemaConfiguration(JsonSchemaKeywordFlags.Builder().format().build()) + } + + @Test + fun testBoundaryPointIsValidPasses() { + // boundary point is valid + val schema = MinimumValidation.MinimumValidation1.getInstance() + schema.validate( + 1.1, + configuration + ) + } + + @Test + fun testBelowTheMinimumIsInvalidFails() { + // below the minimum is invalid + val schema = MinimumValidation.MinimumValidation1.getInstance() + assertFailsWith( + block = { + schema.validate( + 0.6, + configuration + ) + } + ) + } + + @Test + fun testIgnoresNonNumbersPasses() { + // ignores non-numbers + val schema = MinimumValidation.MinimumValidation1.getInstance() + schema.validate( + "x", + configuration + ) + } + + @Test + fun testAboveTheMinimumIsValidPasses() { + // above the minimum is valid + val schema = MinimumValidation.MinimumValidation1.getInstance() + schema.validate( + 2.6, + configuration + ) + } +} diff --git a/samples/client/3_0_3_unit_test/kotlin/src/test/kotlin/org/openapijsonschematools/client/components/schemas/MinimumValidationWithSignedIntegerTest.kt b/samples/client/3_0_3_unit_test/kotlin/src/test/kotlin/org/openapijsonschematools/client/components/schemas/MinimumValidationWithSignedIntegerTest.kt new file mode 100644 index 00000000000..a137255840d --- /dev/null +++ b/samples/client/3_0_3_unit_test/kotlin/src/test/kotlin/org/openapijsonschematools/client/components/schemas/MinimumValidationWithSignedIntegerTest.kt @@ -0,0 +1,92 @@ +package org.openapijsonschematools.client.components.schemas + +import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags +import org.openapijsonschematools.client.configurations.SchemaConfiguration +import org.openapijsonschematools.client.exceptions.ValidationException + +import kotlin.test.Test +import kotlin.test.assertFailsWith + +class MinimumValidationWithSignedIntegerTest { + companion object { + val configuration = SchemaConfiguration(JsonSchemaKeywordFlags.Builder().format().build()) + } + + @Test + fun testBoundaryPointWithFloatIsValidPasses() { + // boundary point with float is valid + val schema = MinimumValidationWithSignedInteger.MinimumValidationWithSignedInteger1.getInstance() + schema.validate( + -2.0, + configuration + ) + } + + @Test + fun testBoundaryPointIsValidPasses() { + // boundary point is valid + val schema = MinimumValidationWithSignedInteger.MinimumValidationWithSignedInteger1.getInstance() + schema.validate( + -2, + configuration + ) + } + + @Test + fun testIntBelowTheMinimumIsInvalidFails() { + // int below the minimum is invalid + val schema = MinimumValidationWithSignedInteger.MinimumValidationWithSignedInteger1.getInstance() + assertFailsWith( + block = { + schema.validate( + -3, + configuration + ) + } + ) + } + + @Test + fun testPositiveAboveTheMinimumIsValidPasses() { + // positive above the minimum is valid + val schema = MinimumValidationWithSignedInteger.MinimumValidationWithSignedInteger1.getInstance() + schema.validate( + 0, + configuration + ) + } + + @Test + fun testNegativeAboveTheMinimumIsValidPasses() { + // negative above the minimum is valid + val schema = MinimumValidationWithSignedInteger.MinimumValidationWithSignedInteger1.getInstance() + schema.validate( + -1, + configuration + ) + } + + @Test + fun testIgnoresNonNumbersPasses() { + // ignores non-numbers + val schema = MinimumValidationWithSignedInteger.MinimumValidationWithSignedInteger1.getInstance() + schema.validate( + "x", + configuration + ) + } + + @Test + fun testFloatBelowTheMinimumIsInvalidFails() { + // float below the minimum is invalid + val schema = MinimumValidationWithSignedInteger.MinimumValidationWithSignedInteger1.getInstance() + assertFailsWith( + block = { + schema.validate( + -2.0001, + configuration + ) + } + ) + } +} diff --git a/samples/client/3_0_3_unit_test/kotlin/src/test/kotlin/org/openapijsonschematools/client/components/schemas/MinitemsValidationTest.kt b/samples/client/3_0_3_unit_test/kotlin/src/test/kotlin/org/openapijsonschematools/client/components/schemas/MinitemsValidationTest.kt new file mode 100644 index 00000000000..f6dc4758197 --- /dev/null +++ b/samples/client/3_0_3_unit_test/kotlin/src/test/kotlin/org/openapijsonschematools/client/components/schemas/MinitemsValidationTest.kt @@ -0,0 +1,64 @@ +package org.openapijsonschematools.client.components.schemas + +import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags +import org.openapijsonschematools.client.configurations.SchemaConfiguration +import org.openapijsonschematools.client.exceptions.ValidationException + +import kotlin.test.Test +import kotlin.test.assertFailsWith + +class MinitemsValidationTest { + companion object { + val configuration = SchemaConfiguration(JsonSchemaKeywordFlags.Builder().format().build()) + } + + @Test + fun testExactLengthIsValidPasses() { + // exact length is valid + val schema = MinitemsValidation.MinitemsValidation1.getInstance() + schema.validate( + listOf( + 1 + ), + configuration + ) + } + + @Test + fun testIgnoresNonArraysPasses() { + // ignores non-arrays + val schema = MinitemsValidation.MinitemsValidation1.getInstance() + schema.validate( + "", + configuration + ) + } + + @Test + fun testLongerIsValidPasses() { + // longer is valid + val schema = MinitemsValidation.MinitemsValidation1.getInstance() + schema.validate( + listOf( + 1, + 2 + ), + configuration + ) + } + + @Test + fun testTooShortIsInvalidFails() { + // too short is invalid + val schema = MinitemsValidation.MinitemsValidation1.getInstance() + assertFailsWith( + block = { + schema.validate( + listOf( + ), + configuration + ) + } + ) + } +} diff --git a/samples/client/3_0_3_unit_test/kotlin/src/test/kotlin/org/openapijsonschematools/client/components/schemas/MinlengthValidationTest.kt b/samples/client/3_0_3_unit_test/kotlin/src/test/kotlin/org/openapijsonschematools/client/components/schemas/MinlengthValidationTest.kt new file mode 100644 index 00000000000..f8976f274c1 --- /dev/null +++ b/samples/client/3_0_3_unit_test/kotlin/src/test/kotlin/org/openapijsonschematools/client/components/schemas/MinlengthValidationTest.kt @@ -0,0 +1,72 @@ +package org.openapijsonschematools.client.components.schemas + +import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags +import org.openapijsonschematools.client.configurations.SchemaConfiguration +import org.openapijsonschematools.client.exceptions.ValidationException + +import kotlin.test.Test +import kotlin.test.assertFailsWith + +class MinlengthValidationTest { + companion object { + val configuration = SchemaConfiguration(JsonSchemaKeywordFlags.Builder().format().build()) + } + + @Test + fun testExactLengthIsValidPasses() { + // exact length is valid + val schema = MinlengthValidation.MinlengthValidation1.getInstance() + schema.validate( + "fo", + configuration + ) + } + + @Test + fun testLongerIsValidPasses() { + // longer is valid + val schema = MinlengthValidation.MinlengthValidation1.getInstance() + schema.validate( + "foo", + configuration + ) + } + + @Test + fun testIgnoresNonStringsPasses() { + // ignores non-strings + val schema = MinlengthValidation.MinlengthValidation1.getInstance() + schema.validate( + 1, + configuration + ) + } + + @Test + fun testTooShortIsInvalidFails() { + // too short is invalid + val schema = MinlengthValidation.MinlengthValidation1.getInstance() + assertFailsWith( + block = { + schema.validate( + "f", + configuration + ) + } + ) + } + + @Test + fun testOneSupplementaryUnicodeCodePointIsNotLongEnoughFails() { + // one supplementary Unicode code point is not long enough + val schema = MinlengthValidation.MinlengthValidation1.getInstance() + assertFailsWith( + block = { + schema.validate( + "💩", + configuration + ) + } + ) + } +} diff --git a/samples/client/3_0_3_unit_test/kotlin/src/test/kotlin/org/openapijsonschematools/client/components/schemas/MinpropertiesValidationTest.kt b/samples/client/3_0_3_unit_test/kotlin/src/test/kotlin/org/openapijsonschematools/client/components/schemas/MinpropertiesValidationTest.kt new file mode 100644 index 00000000000..3c6cd9d15ab --- /dev/null +++ b/samples/client/3_0_3_unit_test/kotlin/src/test/kotlin/org/openapijsonschematools/client/components/schemas/MinpropertiesValidationTest.kt @@ -0,0 +1,94 @@ +package org.openapijsonschematools.client.components.schemas + +import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags +import org.openapijsonschematools.client.configurations.SchemaConfiguration +import org.openapijsonschematools.client.exceptions.ValidationException + +import kotlin.test.Test +import kotlin.test.assertFailsWith + +class MinpropertiesValidationTest { + companion object { + val configuration = SchemaConfiguration(JsonSchemaKeywordFlags.Builder().format().build()) + } + + @Test + fun testExactLengthIsValidPasses() { + // exact length is valid + val schema = MinpropertiesValidation.MinpropertiesValidation1.getInstance() + schema.validate( + mapOf( + Pair( + "foo", + 1 + ) + ), + configuration + ) + } + + @Test + fun testIgnoresOtherNonObjectsPasses() { + // ignores other non-objects + val schema = MinpropertiesValidation.MinpropertiesValidation1.getInstance() + schema.validate( + 12, + configuration + ) + } + + @Test + fun testLongerIsValidPasses() { + // longer is valid + val schema = MinpropertiesValidation.MinpropertiesValidation1.getInstance() + schema.validate( + mapOf( + Pair( + "foo", + 1 + ), + Pair( + "bar", + 2 + ) + ), + configuration + ) + } + + @Test + fun testIgnoresArraysPasses() { + // ignores arrays + val schema = MinpropertiesValidation.MinpropertiesValidation1.getInstance() + schema.validate( + listOf( + ), + configuration + ) + } + + @Test + fun testTooShortIsInvalidFails() { + // too short is invalid + val schema = MinpropertiesValidation.MinpropertiesValidation1.getInstance() + assertFailsWith( + block = { + schema.validate( + mapOf( + ), + configuration + ) + } + ) + } + + @Test + fun testIgnoresStringsPasses() { + // ignores strings + val schema = MinpropertiesValidation.MinpropertiesValidation1.getInstance() + schema.validate( + "", + configuration + ) + } +} diff --git a/samples/client/3_0_3_unit_test/kotlin/src/test/kotlin/org/openapijsonschematools/client/components/schemas/NestedAllofToCheckValidationSemanticsTest.kt b/samples/client/3_0_3_unit_test/kotlin/src/test/kotlin/org/openapijsonschematools/client/components/schemas/NestedAllofToCheckValidationSemanticsTest.kt new file mode 100644 index 00000000000..8639f84f58d --- /dev/null +++ b/samples/client/3_0_3_unit_test/kotlin/src/test/kotlin/org/openapijsonschematools/client/components/schemas/NestedAllofToCheckValidationSemanticsTest.kt @@ -0,0 +1,38 @@ +package org.openapijsonschematools.client.components.schemas + +import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags +import org.openapijsonschematools.client.configurations.SchemaConfiguration +import org.openapijsonschematools.client.exceptions.ValidationException + +import kotlin.test.Test +import kotlin.test.assertFailsWith + +class NestedAllofToCheckValidationSemanticsTest { + companion object { + val configuration = SchemaConfiguration(JsonSchemaKeywordFlags.Builder().format().build()) + } + + @Test + fun testNullIsValidPasses() { + // null is valid + val schema = NestedAllofToCheckValidationSemantics.NestedAllofToCheckValidationSemantics1.getInstance() + schema.validate( + null, + configuration + ) + } + + @Test + fun testAnythingNonNullIsInvalidFails() { + // anything non-null is invalid + val schema = NestedAllofToCheckValidationSemantics.NestedAllofToCheckValidationSemantics1.getInstance() + assertFailsWith( + block = { + schema.validate( + 123, + configuration + ) + } + ) + } +} diff --git a/samples/client/3_0_3_unit_test/kotlin/src/test/kotlin/org/openapijsonschematools/client/components/schemas/NestedAnyofToCheckValidationSemanticsTest.kt b/samples/client/3_0_3_unit_test/kotlin/src/test/kotlin/org/openapijsonschematools/client/components/schemas/NestedAnyofToCheckValidationSemanticsTest.kt new file mode 100644 index 00000000000..76f934637ab --- /dev/null +++ b/samples/client/3_0_3_unit_test/kotlin/src/test/kotlin/org/openapijsonschematools/client/components/schemas/NestedAnyofToCheckValidationSemanticsTest.kt @@ -0,0 +1,38 @@ +package org.openapijsonschematools.client.components.schemas + +import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags +import org.openapijsonschematools.client.configurations.SchemaConfiguration +import org.openapijsonschematools.client.exceptions.ValidationException + +import kotlin.test.Test +import kotlin.test.assertFailsWith + +class NestedAnyofToCheckValidationSemanticsTest { + companion object { + val configuration = SchemaConfiguration(JsonSchemaKeywordFlags.Builder().format().build()) + } + + @Test + fun testNullIsValidPasses() { + // null is valid + val schema = NestedAnyofToCheckValidationSemantics.NestedAnyofToCheckValidationSemantics1.getInstance() + schema.validate( + null, + configuration + ) + } + + @Test + fun testAnythingNonNullIsInvalidFails() { + // anything non-null is invalid + val schema = NestedAnyofToCheckValidationSemantics.NestedAnyofToCheckValidationSemantics1.getInstance() + assertFailsWith( + block = { + schema.validate( + 123, + configuration + ) + } + ) + } +} diff --git a/samples/client/3_0_3_unit_test/kotlin/src/test/kotlin/org/openapijsonschematools/client/components/schemas/NestedItemsTest.kt b/samples/client/3_0_3_unit_test/kotlin/src/test/kotlin/org/openapijsonschematools/client/components/schemas/NestedItemsTest.kt new file mode 100644 index 00000000000..7d7ab246886 --- /dev/null +++ b/samples/client/3_0_3_unit_test/kotlin/src/test/kotlin/org/openapijsonschematools/client/components/schemas/NestedItemsTest.kt @@ -0,0 +1,137 @@ +package org.openapijsonschematools.client.components.schemas + +import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags +import org.openapijsonschematools.client.configurations.SchemaConfiguration +import org.openapijsonschematools.client.exceptions.ValidationException + +import kotlin.test.Test +import kotlin.test.assertFailsWith + +class NestedItemsTest { + companion object { + val configuration = SchemaConfiguration(JsonSchemaKeywordFlags.Builder().format().build()) + } + + @Test + fun testNestedArrayWithInvalidTypeFails() { + // nested array with invalid type + val schema = NestedItems.NestedItems1.getInstance() + assertFailsWith( + block = { + schema.validate( + listOf( + listOf( + listOf( + listOf( + "1" + ) + ), + listOf( + listOf( + 2 + ), + listOf( + 3 + ) + ) + ), + listOf( + listOf( + listOf( + 4 + ), + listOf( + 5 + ), + listOf( + 6 + ) + ) + ) + ), + configuration + ) + } + ) + } + + @Test + fun testNotDeepEnoughFails() { + // not deep enough + val schema = NestedItems.NestedItems1.getInstance() + assertFailsWith( + block = { + schema.validate( + listOf( + listOf( + listOf( + 1 + ), + listOf( + 2 + ), + listOf( + 3 + ) + ), + listOf( + listOf( + 4 + ), + listOf( + 5 + ), + listOf( + 6 + ) + ) + ), + configuration + ) + } + ) + } + + @Test + fun testValidNestedArrayPasses() { + // valid nested array + val schema = NestedItems.NestedItems1.getInstance() + schema.validate( + NestedItems.NestedItemsListBuilder() + .add( + listOf( + listOf( + listOf( + 1 + ) + ), + listOf( + listOf( + 2 + ), + listOf( + 3 + ) + ) + ) + ) + .add( + listOf( + listOf( + listOf( + 4 + ), + listOf( + 5 + ), + listOf( + 6 + ) + ) + ) + ) + .build(), + configuration + ) + } +} diff --git a/samples/client/3_0_3_unit_test/kotlin/src/test/kotlin/org/openapijsonschematools/client/components/schemas/NestedOneofToCheckValidationSemanticsTest.kt b/samples/client/3_0_3_unit_test/kotlin/src/test/kotlin/org/openapijsonschematools/client/components/schemas/NestedOneofToCheckValidationSemanticsTest.kt new file mode 100644 index 00000000000..32e8f394a41 --- /dev/null +++ b/samples/client/3_0_3_unit_test/kotlin/src/test/kotlin/org/openapijsonschematools/client/components/schemas/NestedOneofToCheckValidationSemanticsTest.kt @@ -0,0 +1,38 @@ +package org.openapijsonschematools.client.components.schemas + +import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags +import org.openapijsonschematools.client.configurations.SchemaConfiguration +import org.openapijsonschematools.client.exceptions.ValidationException + +import kotlin.test.Test +import kotlin.test.assertFailsWith + +class NestedOneofToCheckValidationSemanticsTest { + companion object { + val configuration = SchemaConfiguration(JsonSchemaKeywordFlags.Builder().format().build()) + } + + @Test + fun testNullIsValidPasses() { + // null is valid + val schema = NestedOneofToCheckValidationSemantics.NestedOneofToCheckValidationSemantics1.getInstance() + schema.validate( + null, + configuration + ) + } + + @Test + fun testAnythingNonNullIsInvalidFails() { + // anything non-null is invalid + val schema = NestedOneofToCheckValidationSemantics.NestedOneofToCheckValidationSemantics1.getInstance() + assertFailsWith( + block = { + schema.validate( + 123, + configuration + ) + } + ) + } +} diff --git a/samples/client/3_0_3_unit_test/kotlin/src/test/kotlin/org/openapijsonschematools/client/components/schemas/NotMoreComplexSchemaTest.kt b/samples/client/3_0_3_unit_test/kotlin/src/test/kotlin/org/openapijsonschematools/client/components/schemas/NotMoreComplexSchemaTest.kt new file mode 100644 index 00000000000..071a71852c6 --- /dev/null +++ b/samples/client/3_0_3_unit_test/kotlin/src/test/kotlin/org/openapijsonschematools/client/components/schemas/NotMoreComplexSchemaTest.kt @@ -0,0 +1,58 @@ +package org.openapijsonschematools.client.components.schemas + +import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags +import org.openapijsonschematools.client.configurations.SchemaConfiguration +import org.openapijsonschematools.client.exceptions.ValidationException + +import kotlin.test.Test +import kotlin.test.assertFailsWith + +class NotMoreComplexSchemaTest { + companion object { + val configuration = SchemaConfiguration(JsonSchemaKeywordFlags.Builder().format().build()) + } + + @Test + fun testOtherMatchPasses() { + // other match + val schema = NotMoreComplexSchema.NotMoreComplexSchema1.getInstance() + schema.validate( + mapOf( + Pair( + "foo", + 1 + ) + ), + configuration + ) + } + + @Test + fun testMismatchFails() { + // mismatch + val schema = NotMoreComplexSchema.NotMoreComplexSchema1.getInstance() + assertFailsWith( + block = { + schema.validate( + mapOf( + Pair( + "foo", + "bar" + ) + ), + configuration + ) + } + ) + } + + @Test + fun testMatchPasses() { + // match + val schema = NotMoreComplexSchema.NotMoreComplexSchema1.getInstance() + schema.validate( + 1, + configuration + ) + } +} diff --git a/samples/client/3_0_3_unit_test/kotlin/src/test/kotlin/org/openapijsonschematools/client/components/schemas/NotTest.kt b/samples/client/3_0_3_unit_test/kotlin/src/test/kotlin/org/openapijsonschematools/client/components/schemas/NotTest.kt new file mode 100644 index 00000000000..5b208bae6d7 --- /dev/null +++ b/samples/client/3_0_3_unit_test/kotlin/src/test/kotlin/org/openapijsonschematools/client/components/schemas/NotTest.kt @@ -0,0 +1,38 @@ +package org.openapijsonschematools.client.components.schemas + +import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags +import org.openapijsonschematools.client.configurations.SchemaConfiguration +import org.openapijsonschematools.client.exceptions.ValidationException + +import kotlin.test.Test +import kotlin.test.assertFailsWith + +class NotTest { + companion object { + val configuration = SchemaConfiguration(JsonSchemaKeywordFlags.Builder().format().build()) + } + + @Test + fun testDisallowedFails() { + // disallowed + val schema = Not.Not1.getInstance() + assertFailsWith( + block = { + schema.validate( + 1, + configuration + ) + } + ) + } + + @Test + fun testAllowedPasses() { + // allowed + val schema = Not.Not1.getInstance() + schema.validate( + "foo", + configuration + ) + } +} diff --git a/samples/client/3_0_3_unit_test/kotlin/src/test/kotlin/org/openapijsonschematools/client/components/schemas/NulCharactersInStringsTest.kt b/samples/client/3_0_3_unit_test/kotlin/src/test/kotlin/org/openapijsonschematools/client/components/schemas/NulCharactersInStringsTest.kt new file mode 100644 index 00000000000..4aab8da29af --- /dev/null +++ b/samples/client/3_0_3_unit_test/kotlin/src/test/kotlin/org/openapijsonschematools/client/components/schemas/NulCharactersInStringsTest.kt @@ -0,0 +1,38 @@ +package org.openapijsonschematools.client.components.schemas + +import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags +import org.openapijsonschematools.client.configurations.SchemaConfiguration +import org.openapijsonschematools.client.exceptions.ValidationException + +import kotlin.test.Test +import kotlin.test.assertFailsWith + +class NulCharactersInStringsTest { + companion object { + val configuration = SchemaConfiguration(JsonSchemaKeywordFlags.Builder().format().build()) + } + + @Test + fun testMatchStringWithNulPasses() { + // match string with nul + val schema = NulCharactersInStrings.NulCharactersInStrings1.getInstance() + schema.validate( + "hello\u0000there", + configuration + ) + } + + @Test + fun testDoNotMatchStringLackingNulFails() { + // do not match string lacking nul + val schema = NulCharactersInStrings.NulCharactersInStrings1.getInstance() + assertFailsWith( + block = { + schema.validate( + "hellothere", + configuration + ) + } + ) + } +} diff --git a/samples/client/3_0_3_unit_test/kotlin/src/test/kotlin/org/openapijsonschematools/client/components/schemas/NullTypeMatchesOnlyTheNullObjectTest.kt b/samples/client/3_0_3_unit_test/kotlin/src/test/kotlin/org/openapijsonschematools/client/components/schemas/NullTypeMatchesOnlyTheNullObjectTest.kt new file mode 100644 index 00000000000..12779200f9c --- /dev/null +++ b/samples/client/3_0_3_unit_test/kotlin/src/test/kotlin/org/openapijsonschematools/client/components/schemas/NullTypeMatchesOnlyTheNullObjectTest.kt @@ -0,0 +1,152 @@ +package org.openapijsonschematools.client.components.schemas + +import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags +import org.openapijsonschematools.client.configurations.SchemaConfiguration +import org.openapijsonschematools.client.exceptions.ValidationException + +import kotlin.test.Test +import kotlin.test.assertFailsWith + +class NullTypeMatchesOnlyTheNullObjectTest { + companion object { + val configuration = SchemaConfiguration(JsonSchemaKeywordFlags.Builder().format().build()) + } + + @Test + fun testZeroIsNotNullFails() { + // zero is not null + val schema = NullTypeMatchesOnlyTheNullObject.NullTypeMatchesOnlyTheNullObject1.getInstance() + assertFailsWith( + block = { + schema.validate( + 0, + configuration + ) + } + ) + } + + @Test + fun testAnArrayIsNotNullFails() { + // an array is not null + val schema = NullTypeMatchesOnlyTheNullObject.NullTypeMatchesOnlyTheNullObject1.getInstance() + assertFailsWith( + block = { + schema.validate( + listOf( + ), + configuration + ) + } + ) + } + + @Test + fun testAnObjectIsNotNullFails() { + // an object is not null + val schema = NullTypeMatchesOnlyTheNullObject.NullTypeMatchesOnlyTheNullObject1.getInstance() + assertFailsWith( + block = { + schema.validate( + mapOf( + ), + configuration + ) + } + ) + } + + @Test + fun testTrueIsNotNullFails() { + // true is not null + val schema = NullTypeMatchesOnlyTheNullObject.NullTypeMatchesOnlyTheNullObject1.getInstance() + assertFailsWith( + block = { + schema.validate( + true, + configuration + ) + } + ) + } + + @Test + fun testFalseIsNotNullFails() { + // false is not null + val schema = NullTypeMatchesOnlyTheNullObject.NullTypeMatchesOnlyTheNullObject1.getInstance() + assertFailsWith( + block = { + schema.validate( + false, + configuration + ) + } + ) + } + + @Test + fun testNullIsNullPasses() { + // null is null + val schema = NullTypeMatchesOnlyTheNullObject.NullTypeMatchesOnlyTheNullObject1.getInstance() + schema.validate( + null, + configuration + ) + } + + @Test + fun testAStringIsNotNullFails() { + // a string is not null + val schema = NullTypeMatchesOnlyTheNullObject.NullTypeMatchesOnlyTheNullObject1.getInstance() + assertFailsWith( + block = { + schema.validate( + "foo", + configuration + ) + } + ) + } + + @Test + fun testAnIntegerIsNotNullFails() { + // an integer is not null + val schema = NullTypeMatchesOnlyTheNullObject.NullTypeMatchesOnlyTheNullObject1.getInstance() + assertFailsWith( + block = { + schema.validate( + 1, + configuration + ) + } + ) + } + + @Test + fun testAnEmptyStringIsNotNullFails() { + // an empty string is not null + val schema = NullTypeMatchesOnlyTheNullObject.NullTypeMatchesOnlyTheNullObject1.getInstance() + assertFailsWith( + block = { + schema.validate( + "", + configuration + ) + } + ) + } + + @Test + fun testAFloatIsNotNullFails() { + // a float is not null + val schema = NullTypeMatchesOnlyTheNullObject.NullTypeMatchesOnlyTheNullObject1.getInstance() + assertFailsWith( + block = { + schema.validate( + 1.1, + configuration + ) + } + ) + } +} diff --git a/samples/client/3_0_3_unit_test/kotlin/src/test/kotlin/org/openapijsonschematools/client/components/schemas/NumberTypeMatchesNumbersTest.kt b/samples/client/3_0_3_unit_test/kotlin/src/test/kotlin/org/openapijsonschematools/client/components/schemas/NumberTypeMatchesNumbersTest.kt new file mode 100644 index 00000000000..1ba574586e4 --- /dev/null +++ b/samples/client/3_0_3_unit_test/kotlin/src/test/kotlin/org/openapijsonschematools/client/components/schemas/NumberTypeMatchesNumbersTest.kt @@ -0,0 +1,130 @@ +package org.openapijsonschematools.client.components.schemas + +import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags +import org.openapijsonschematools.client.configurations.SchemaConfiguration +import org.openapijsonschematools.client.exceptions.ValidationException + +import kotlin.test.Test +import kotlin.test.assertFailsWith + +class NumberTypeMatchesNumbersTest { + companion object { + val configuration = SchemaConfiguration(JsonSchemaKeywordFlags.Builder().format().build()) + } + + @Test + fun testAFloatIsANumberPasses() { + // a float is a number + val schema = NumberTypeMatchesNumbers.NumberTypeMatchesNumbers1.getInstance() + schema.validate( + 1.1, + configuration + ) + } + + @Test + fun testAnIntegerIsANumberPasses() { + // an integer is a number + val schema = NumberTypeMatchesNumbers.NumberTypeMatchesNumbers1.getInstance() + schema.validate( + 1, + configuration + ) + } + + @Test + fun testAStringIsStillNotANumberEvenIfItLooksLikeOneFails() { + // a string is still not a number, even if it looks like one + val schema = NumberTypeMatchesNumbers.NumberTypeMatchesNumbers1.getInstance() + assertFailsWith( + block = { + schema.validate( + "1", + configuration + ) + } + ) + } + + @Test + fun testABooleanIsNotANumberFails() { + // a boolean is not a number + val schema = NumberTypeMatchesNumbers.NumberTypeMatchesNumbers1.getInstance() + assertFailsWith( + block = { + schema.validate( + true, + configuration + ) + } + ) + } + + @Test + fun testAFloatWithZeroFractionalPartIsANumberAndAnIntegerPasses() { + // a float with zero fractional part is a number (and an integer) + val schema = NumberTypeMatchesNumbers.NumberTypeMatchesNumbers1.getInstance() + schema.validate( + 1.0, + configuration + ) + } + + @Test + fun testNullIsNotANumberFails() { + // null is not a number + val schema = NumberTypeMatchesNumbers.NumberTypeMatchesNumbers1.getInstance() + assertFailsWith( + block = { + schema.validate( + null, + configuration + ) + } + ) + } + + @Test + fun testAStringIsNotANumberFails() { + // a string is not a number + val schema = NumberTypeMatchesNumbers.NumberTypeMatchesNumbers1.getInstance() + assertFailsWith( + block = { + schema.validate( + "foo", + configuration + ) + } + ) + } + + @Test + fun testAnArrayIsNotANumberFails() { + // an array is not a number + val schema = NumberTypeMatchesNumbers.NumberTypeMatchesNumbers1.getInstance() + assertFailsWith( + block = { + schema.validate( + listOf( + ), + configuration + ) + } + ) + } + + @Test + fun testAnObjectIsNotANumberFails() { + // an object is not a number + val schema = NumberTypeMatchesNumbers.NumberTypeMatchesNumbers1.getInstance() + assertFailsWith( + block = { + schema.validate( + mapOf( + ), + configuration + ) + } + ) + } +} diff --git a/samples/client/3_0_3_unit_test/kotlin/src/test/kotlin/org/openapijsonschematools/client/components/schemas/ObjectPropertiesValidationTest.kt b/samples/client/3_0_3_unit_test/kotlin/src/test/kotlin/org/openapijsonschematools/client/components/schemas/ObjectPropertiesValidationTest.kt new file mode 100644 index 00000000000..aab7819536b --- /dev/null +++ b/samples/client/3_0_3_unit_test/kotlin/src/test/kotlin/org/openapijsonschematools/client/components/schemas/ObjectPropertiesValidationTest.kt @@ -0,0 +1,119 @@ +package org.openapijsonschematools.client.components.schemas + +import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags +import org.openapijsonschematools.client.configurations.SchemaConfiguration +import org.openapijsonschematools.client.exceptions.ValidationException + +import kotlin.test.Test +import kotlin.test.assertFailsWith + +class ObjectPropertiesValidationTest { + companion object { + val configuration = SchemaConfiguration(JsonSchemaKeywordFlags.Builder().format().build()) + } + + @Test + fun testBothPropertiesPresentAndValidIsValidPasses() { + // both properties present and valid is valid + val schema = ObjectPropertiesValidation.ObjectPropertiesValidation1.getInstance() + schema.validate( + mapOf( + Pair( + "foo", + 1 + ), + Pair( + "bar", + "baz" + ) + ), + configuration + ) + } + + @Test + fun testDoesnTInvalidateOtherPropertiesPasses() { + // doesn't invalidate other properties + val schema = ObjectPropertiesValidation.ObjectPropertiesValidation1.getInstance() + schema.validate( + mapOf( + Pair( + "quux", + listOf( + ) + ) + ), + configuration + ) + } + + @Test + fun testIgnoresOtherNonObjectsPasses() { + // ignores other non-objects + val schema = ObjectPropertiesValidation.ObjectPropertiesValidation1.getInstance() + schema.validate( + 12, + configuration + ) + } + + @Test + fun testBothPropertiesInvalidIsInvalidFails() { + // both properties invalid is invalid + val schema = ObjectPropertiesValidation.ObjectPropertiesValidation1.getInstance() + assertFailsWith( + block = { + schema.validate( + mapOf( + Pair( + "foo", + listOf( + ) + ), + Pair( + "bar", + mapOf( + ) + ) + ), + configuration + ) + } + ) + } + + @Test + fun testIgnoresArraysPasses() { + // ignores arrays + val schema = ObjectPropertiesValidation.ObjectPropertiesValidation1.getInstance() + schema.validate( + listOf( + ), + configuration + ) + } + + @Test + fun testOnePropertyInvalidIsInvalidFails() { + // one property invalid is invalid + val schema = ObjectPropertiesValidation.ObjectPropertiesValidation1.getInstance() + assertFailsWith( + block = { + schema.validate( + mapOf( + Pair( + "foo", + 1 + ), + Pair( + "bar", + mapOf( + ) + ) + ), + configuration + ) + } + ) + } +} diff --git a/samples/client/3_0_3_unit_test/kotlin/src/test/kotlin/org/openapijsonschematools/client/components/schemas/ObjectTypeMatchesObjectsTest.kt b/samples/client/3_0_3_unit_test/kotlin/src/test/kotlin/org/openapijsonschematools/client/components/schemas/ObjectTypeMatchesObjectsTest.kt new file mode 100644 index 00000000000..16082afdb8d --- /dev/null +++ b/samples/client/3_0_3_unit_test/kotlin/src/test/kotlin/org/openapijsonschematools/client/components/schemas/ObjectTypeMatchesObjectsTest.kt @@ -0,0 +1,110 @@ +package org.openapijsonschematools.client.components.schemas + +import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags +import org.openapijsonschematools.client.configurations.SchemaConfiguration +import org.openapijsonschematools.client.exceptions.ValidationException + +import kotlin.test.Test +import kotlin.test.assertFailsWith + +class ObjectTypeMatchesObjectsTest { + companion object { + val configuration = SchemaConfiguration(JsonSchemaKeywordFlags.Builder().format().build()) + } + + @Test + fun testAnObjectIsAnObjectPasses() { + // an object is an object + val schema = ObjectTypeMatchesObjects.ObjectTypeMatchesObjects1.getInstance() + schema.validate( + mapOf( + ), + configuration + ) + } + + @Test + fun testAnArrayIsNotAnObjectFails() { + // an array is not an object + val schema = ObjectTypeMatchesObjects.ObjectTypeMatchesObjects1.getInstance() + assertFailsWith( + block = { + schema.validate( + listOf( + ), + configuration + ) + } + ) + } + + @Test + fun testAnIntegerIsNotAnObjectFails() { + // an integer is not an object + val schema = ObjectTypeMatchesObjects.ObjectTypeMatchesObjects1.getInstance() + assertFailsWith( + block = { + schema.validate( + 1, + configuration + ) + } + ) + } + + @Test + fun testABooleanIsNotAnObjectFails() { + // a boolean is not an object + val schema = ObjectTypeMatchesObjects.ObjectTypeMatchesObjects1.getInstance() + assertFailsWith( + block = { + schema.validate( + true, + configuration + ) + } + ) + } + + @Test + fun testAStringIsNotAnObjectFails() { + // a string is not an object + val schema = ObjectTypeMatchesObjects.ObjectTypeMatchesObjects1.getInstance() + assertFailsWith( + block = { + schema.validate( + "foo", + configuration + ) + } + ) + } + + @Test + fun testAFloatIsNotAnObjectFails() { + // a float is not an object + val schema = ObjectTypeMatchesObjects.ObjectTypeMatchesObjects1.getInstance() + assertFailsWith( + block = { + schema.validate( + 1.1, + configuration + ) + } + ) + } + + @Test + fun testNullIsNotAnObjectFails() { + // null is not an object + val schema = ObjectTypeMatchesObjects.ObjectTypeMatchesObjects1.getInstance() + assertFailsWith( + block = { + schema.validate( + null, + configuration + ) + } + ) + } +} diff --git a/samples/client/3_0_3_unit_test/kotlin/src/test/kotlin/org/openapijsonschematools/client/components/schemas/OneofComplexTypesTest.kt b/samples/client/3_0_3_unit_test/kotlin/src/test/kotlin/org/openapijsonschematools/client/components/schemas/OneofComplexTypesTest.kt new file mode 100644 index 00000000000..8f9fb57ea7b --- /dev/null +++ b/samples/client/3_0_3_unit_test/kotlin/src/test/kotlin/org/openapijsonschematools/client/components/schemas/OneofComplexTypesTest.kt @@ -0,0 +1,90 @@ +package org.openapijsonschematools.client.components.schemas + +import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags +import org.openapijsonschematools.client.configurations.SchemaConfiguration +import org.openapijsonschematools.client.exceptions.ValidationException + +import kotlin.test.Test +import kotlin.test.assertFailsWith + +class OneofComplexTypesTest { + companion object { + val configuration = SchemaConfiguration(JsonSchemaKeywordFlags.Builder().format().build()) + } + + @Test + fun testSecondOneofValidComplexPasses() { + // second oneOf valid (complex) + val schema = OneofComplexTypes.OneofComplexTypes1.getInstance() + schema.validate( + mapOf( + Pair( + "foo", + "baz" + ) + ), + configuration + ) + } + + @Test + fun testBothOneofValidComplexFails() { + // both oneOf valid (complex) + val schema = OneofComplexTypes.OneofComplexTypes1.getInstance() + assertFailsWith( + block = { + schema.validate( + mapOf( + Pair( + "foo", + "baz" + ), + Pair( + "bar", + 2 + ) + ), + configuration + ) + } + ) + } + + @Test + fun testFirstOneofValidComplexPasses() { + // first oneOf valid (complex) + val schema = OneofComplexTypes.OneofComplexTypes1.getInstance() + schema.validate( + mapOf( + Pair( + "bar", + 2 + ) + ), + configuration + ) + } + + @Test + fun testNeitherOneofValidComplexFails() { + // neither oneOf valid (complex) + val schema = OneofComplexTypes.OneofComplexTypes1.getInstance() + assertFailsWith( + block = { + schema.validate( + mapOf( + Pair( + "foo", + 2 + ), + Pair( + "bar", + "quux" + ) + ), + configuration + ) + } + ) + } +} diff --git a/samples/client/3_0_3_unit_test/kotlin/src/test/kotlin/org/openapijsonschematools/client/components/schemas/OneofTest.kt b/samples/client/3_0_3_unit_test/kotlin/src/test/kotlin/org/openapijsonschematools/client/components/schemas/OneofTest.kt new file mode 100644 index 00000000000..012d577b9ec --- /dev/null +++ b/samples/client/3_0_3_unit_test/kotlin/src/test/kotlin/org/openapijsonschematools/client/components/schemas/OneofTest.kt @@ -0,0 +1,62 @@ +package org.openapijsonschematools.client.components.schemas + +import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags +import org.openapijsonschematools.client.configurations.SchemaConfiguration +import org.openapijsonschematools.client.exceptions.ValidationException + +import kotlin.test.Test +import kotlin.test.assertFailsWith + +class OneofTest { + companion object { + val configuration = SchemaConfiguration(JsonSchemaKeywordFlags.Builder().format().build()) + } + + @Test + fun testBothOneofValidFails() { + // both oneOf valid + val schema = Oneof.Oneof1.getInstance() + assertFailsWith( + block = { + schema.validate( + 3, + configuration + ) + } + ) + } + + @Test + fun testNeitherOneofValidFails() { + // neither oneOf valid + val schema = Oneof.Oneof1.getInstance() + assertFailsWith( + block = { + schema.validate( + 1.5, + configuration + ) + } + ) + } + + @Test + fun testSecondOneofValidPasses() { + // second oneOf valid + val schema = Oneof.Oneof1.getInstance() + schema.validate( + 2.5, + configuration + ) + } + + @Test + fun testFirstOneofValidPasses() { + // first oneOf valid + val schema = Oneof.Oneof1.getInstance() + schema.validate( + 1, + configuration + ) + } +} diff --git a/samples/client/3_0_3_unit_test/kotlin/src/test/kotlin/org/openapijsonschematools/client/components/schemas/OneofWithBaseSchemaTest.kt b/samples/client/3_0_3_unit_test/kotlin/src/test/kotlin/org/openapijsonschematools/client/components/schemas/OneofWithBaseSchemaTest.kt new file mode 100644 index 00000000000..e5ec716ea82 --- /dev/null +++ b/samples/client/3_0_3_unit_test/kotlin/src/test/kotlin/org/openapijsonschematools/client/components/schemas/OneofWithBaseSchemaTest.kt @@ -0,0 +1,52 @@ +package org.openapijsonschematools.client.components.schemas + +import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags +import org.openapijsonschematools.client.configurations.SchemaConfiguration +import org.openapijsonschematools.client.exceptions.ValidationException + +import kotlin.test.Test +import kotlin.test.assertFailsWith + +class OneofWithBaseSchemaTest { + companion object { + val configuration = SchemaConfiguration(JsonSchemaKeywordFlags.Builder().format().build()) + } + + @Test + fun testMismatchBaseSchemaFails() { + // mismatch base schema + val schema = OneofWithBaseSchema.OneofWithBaseSchema1.getInstance() + assertFailsWith( + block = { + schema.validate( + 3, + configuration + ) + } + ) + } + + @Test + fun testOneOneofValidPasses() { + // one oneOf valid + val schema = OneofWithBaseSchema.OneofWithBaseSchema1.getInstance() + schema.validate( + "foobar", + configuration + ) + } + + @Test + fun testBothOneofValidFails() { + // both oneOf valid + val schema = OneofWithBaseSchema.OneofWithBaseSchema1.getInstance() + assertFailsWith( + block = { + schema.validate( + "foo", + configuration + ) + } + ) + } +} diff --git a/samples/client/3_0_3_unit_test/kotlin/src/test/kotlin/org/openapijsonschematools/client/components/schemas/OneofWithEmptySchemaTest.kt b/samples/client/3_0_3_unit_test/kotlin/src/test/kotlin/org/openapijsonschematools/client/components/schemas/OneofWithEmptySchemaTest.kt new file mode 100644 index 00000000000..844584e08c3 --- /dev/null +++ b/samples/client/3_0_3_unit_test/kotlin/src/test/kotlin/org/openapijsonschematools/client/components/schemas/OneofWithEmptySchemaTest.kt @@ -0,0 +1,38 @@ +package org.openapijsonschematools.client.components.schemas + +import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags +import org.openapijsonschematools.client.configurations.SchemaConfiguration +import org.openapijsonschematools.client.exceptions.ValidationException + +import kotlin.test.Test +import kotlin.test.assertFailsWith + +class OneofWithEmptySchemaTest { + companion object { + val configuration = SchemaConfiguration(JsonSchemaKeywordFlags.Builder().format().build()) + } + + @Test + fun testOneValidValidPasses() { + // one valid - valid + val schema = OneofWithEmptySchema.OneofWithEmptySchema1.getInstance() + schema.validate( + "foo", + configuration + ) + } + + @Test + fun testBothValidInvalidFails() { + // both valid - invalid + val schema = OneofWithEmptySchema.OneofWithEmptySchema1.getInstance() + assertFailsWith( + block = { + schema.validate( + 123, + configuration + ) + } + ) + } +} diff --git a/samples/client/3_0_3_unit_test/kotlin/src/test/kotlin/org/openapijsonschematools/client/components/schemas/OneofWithRequiredTest.kt b/samples/client/3_0_3_unit_test/kotlin/src/test/kotlin/org/openapijsonschematools/client/components/schemas/OneofWithRequiredTest.kt new file mode 100644 index 00000000000..da6b03e6370 --- /dev/null +++ b/samples/client/3_0_3_unit_test/kotlin/src/test/kotlin/org/openapijsonschematools/client/components/schemas/OneofWithRequiredTest.kt @@ -0,0 +1,98 @@ +package org.openapijsonschematools.client.components.schemas + +import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags +import org.openapijsonschematools.client.configurations.SchemaConfiguration +import org.openapijsonschematools.client.exceptions.ValidationException + +import kotlin.test.Test +import kotlin.test.assertFailsWith + +class OneofWithRequiredTest { + companion object { + val configuration = SchemaConfiguration(JsonSchemaKeywordFlags.Builder().format().build()) + } + + @Test + fun testFirstValidValidPasses() { + // first valid - valid + val schema = OneofWithRequired.OneofWithRequired1.getInstance() + schema.validate( + mapOf( + Pair( + "foo", + 1 + ), + Pair( + "bar", + 2 + ) + ), + configuration + ) + } + + @Test + fun testBothValidInvalidFails() { + // both valid - invalid + val schema = OneofWithRequired.OneofWithRequired1.getInstance() + assertFailsWith( + block = { + schema.validate( + mapOf( + Pair( + "foo", + 1 + ), + Pair( + "bar", + 2 + ), + Pair( + "baz", + 3 + ) + ), + configuration + ) + } + ) + } + + @Test + fun testSecondValidValidPasses() { + // second valid - valid + val schema = OneofWithRequired.OneofWithRequired1.getInstance() + schema.validate( + mapOf( + Pair( + "foo", + 1 + ), + Pair( + "baz", + 3 + ) + ), + configuration + ) + } + + @Test + fun testBothInvalidInvalidFails() { + // both invalid - invalid + val schema = OneofWithRequired.OneofWithRequired1.getInstance() + assertFailsWith( + block = { + schema.validate( + mapOf( + Pair( + "bar", + 2 + ) + ), + configuration + ) + } + ) + } +} diff --git a/samples/client/3_0_3_unit_test/kotlin/src/test/kotlin/org/openapijsonschematools/client/components/schemas/PatternIsNotAnchoredTest.kt b/samples/client/3_0_3_unit_test/kotlin/src/test/kotlin/org/openapijsonschematools/client/components/schemas/PatternIsNotAnchoredTest.kt new file mode 100644 index 00000000000..3e54785ff69 --- /dev/null +++ b/samples/client/3_0_3_unit_test/kotlin/src/test/kotlin/org/openapijsonschematools/client/components/schemas/PatternIsNotAnchoredTest.kt @@ -0,0 +1,24 @@ +package org.openapijsonschematools.client.components.schemas + +import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags +import org.openapijsonschematools.client.configurations.SchemaConfiguration +import org.openapijsonschematools.client.exceptions.ValidationException + +import kotlin.test.Test +import kotlin.test.assertFailsWith + +class PatternIsNotAnchoredTest { + companion object { + val configuration = SchemaConfiguration(JsonSchemaKeywordFlags.Builder().format().build()) + } + + @Test + fun testMatchesASubstringPasses() { + // matches a substring + val schema = PatternIsNotAnchored.PatternIsNotAnchored1.getInstance() + schema.validate( + "xxaayy", + configuration + ) + } +} diff --git a/samples/client/3_0_3_unit_test/kotlin/src/test/kotlin/org/openapijsonschematools/client/components/schemas/PatternValidationTest.kt b/samples/client/3_0_3_unit_test/kotlin/src/test/kotlin/org/openapijsonschematools/client/components/schemas/PatternValidationTest.kt new file mode 100644 index 00000000000..0a4d35fd533 --- /dev/null +++ b/samples/client/3_0_3_unit_test/kotlin/src/test/kotlin/org/openapijsonschematools/client/components/schemas/PatternValidationTest.kt @@ -0,0 +1,100 @@ +package org.openapijsonschematools.client.components.schemas + +import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags +import org.openapijsonschematools.client.configurations.SchemaConfiguration +import org.openapijsonschematools.client.exceptions.ValidationException + +import kotlin.test.Test +import kotlin.test.assertFailsWith + +class PatternValidationTest { + companion object { + val configuration = SchemaConfiguration(JsonSchemaKeywordFlags.Builder().format().build()) + } + + @Test + fun testIgnoresBooleansPasses() { + // ignores booleans + val schema = PatternValidation.PatternValidation1.getInstance() + schema.validate( + true, + configuration + ) + } + + @Test + fun testIgnoresFloatsPasses() { + // ignores floats + val schema = PatternValidation.PatternValidation1.getInstance() + schema.validate( + 1.0, + configuration + ) + } + + @Test + fun testANonMatchingPatternIsInvalidFails() { + // a non-matching pattern is invalid + val schema = PatternValidation.PatternValidation1.getInstance() + assertFailsWith( + block = { + schema.validate( + "abc", + configuration + ) + } + ) + } + + @Test + fun testIgnoresIntegersPasses() { + // ignores integers + val schema = PatternValidation.PatternValidation1.getInstance() + schema.validate( + 123, + configuration + ) + } + + @Test + fun testAMatchingPatternIsValidPasses() { + // a matching pattern is valid + val schema = PatternValidation.PatternValidation1.getInstance() + schema.validate( + "aaa", + configuration + ) + } + + @Test + fun testIgnoresArraysPasses() { + // ignores arrays + val schema = PatternValidation.PatternValidation1.getInstance() + schema.validate( + listOf( + ), + configuration + ) + } + + @Test + fun testIgnoresObjectsPasses() { + // ignores objects + val schema = PatternValidation.PatternValidation1.getInstance() + schema.validate( + mapOf( + ), + configuration + ) + } + + @Test + fun testIgnoresNullPasses() { + // ignores null + val schema = PatternValidation.PatternValidation1.getInstance() + schema.validate( + null, + configuration + ) + } +} diff --git a/samples/client/3_0_3_unit_test/kotlin/src/test/kotlin/org/openapijsonschematools/client/components/schemas/PropertiesWithEscapedCharactersTest.kt b/samples/client/3_0_3_unit_test/kotlin/src/test/kotlin/org/openapijsonschematools/client/components/schemas/PropertiesWithEscapedCharactersTest.kt new file mode 100644 index 00000000000..b65f4a4fbd2 --- /dev/null +++ b/samples/client/3_0_3_unit_test/kotlin/src/test/kotlin/org/openapijsonschematools/client/components/schemas/PropertiesWithEscapedCharactersTest.kt @@ -0,0 +1,88 @@ +package org.openapijsonschematools.client.components.schemas + +import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags +import org.openapijsonschematools.client.configurations.SchemaConfiguration +import org.openapijsonschematools.client.exceptions.ValidationException + +import kotlin.test.Test +import kotlin.test.assertFailsWith + +class PropertiesWithEscapedCharactersTest { + companion object { + val configuration = SchemaConfiguration(JsonSchemaKeywordFlags.Builder().format().build()) + } + + @Test + fun testObjectWithAllNumbersIsValidPasses() { + // object with all numbers is valid + val schema = PropertiesWithEscapedCharacters.PropertiesWithEscapedCharacters1.getInstance() + schema.validate( + mapOf( + Pair( + "foo\nbar", + 1 + ), + Pair( + "foo\"bar", + 1 + ), + Pair( + "foo\\bar", + 1 + ), + Pair( + "foo\rbar", + 1 + ), + Pair( + "foo\tbar", + 1 + ), + Pair( + "foo\u000Cbar", + 1 + ) + ), + configuration + ) + } + + @Test + fun testObjectWithStringsIsInvalidFails() { + // object with strings is invalid + val schema = PropertiesWithEscapedCharacters.PropertiesWithEscapedCharacters1.getInstance() + assertFailsWith( + block = { + schema.validate( + mapOf( + Pair( + "foo\nbar", + "1" + ), + Pair( + "foo\"bar", + "1" + ), + Pair( + "foo\\bar", + "1" + ), + Pair( + "foo\rbar", + "1" + ), + Pair( + "foo\tbar", + "1" + ), + Pair( + "foo\u000Cbar", + "1" + ) + ), + configuration + ) + } + ) + } +} diff --git a/samples/client/3_0_3_unit_test/kotlin/src/test/kotlin/org/openapijsonschematools/client/components/schemas/PropertyNamedRefThatIsNotAReferenceTest.kt b/samples/client/3_0_3_unit_test/kotlin/src/test/kotlin/org/openapijsonschematools/client/components/schemas/PropertyNamedRefThatIsNotAReferenceTest.kt new file mode 100644 index 00000000000..297e5ed5792 --- /dev/null +++ b/samples/client/3_0_3_unit_test/kotlin/src/test/kotlin/org/openapijsonschematools/client/components/schemas/PropertyNamedRefThatIsNotAReferenceTest.kt @@ -0,0 +1,48 @@ +package org.openapijsonschematools.client.components.schemas + +import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags +import org.openapijsonschematools.client.configurations.SchemaConfiguration +import org.openapijsonschematools.client.exceptions.ValidationException + +import kotlin.test.Test +import kotlin.test.assertFailsWith + +class PropertyNamedRefThatIsNotAReferenceTest { + companion object { + val configuration = SchemaConfiguration(JsonSchemaKeywordFlags.Builder().format().build()) + } + + @Test + fun testPropertyNamedRefValidPasses() { + // property named \$ref valid + val schema = PropertyNamedRefThatIsNotAReference.PropertyNamedRefThatIsNotAReference1.getInstance() + schema.validate( + mapOf( + Pair( + "\$ref", + "a" + ) + ), + configuration + ) + } + + @Test + fun testPropertyNamedRefInvalidFails() { + // property named \$ref invalid + val schema = PropertyNamedRefThatIsNotAReference.PropertyNamedRefThatIsNotAReference1.getInstance() + assertFailsWith( + block = { + schema.validate( + mapOf( + Pair( + "\$ref", + 2 + ) + ), + configuration + ) + } + ) + } +} diff --git a/samples/client/3_0_3_unit_test/kotlin/src/test/kotlin/org/openapijsonschematools/client/components/schemas/RefInAdditionalpropertiesTest.kt b/samples/client/3_0_3_unit_test/kotlin/src/test/kotlin/org/openapijsonschematools/client/components/schemas/RefInAdditionalpropertiesTest.kt new file mode 100644 index 00000000000..458bb0997f3 --- /dev/null +++ b/samples/client/3_0_3_unit_test/kotlin/src/test/kotlin/org/openapijsonschematools/client/components/schemas/RefInAdditionalpropertiesTest.kt @@ -0,0 +1,58 @@ +package org.openapijsonschematools.client.components.schemas + +import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags +import org.openapijsonschematools.client.configurations.SchemaConfiguration +import org.openapijsonschematools.client.exceptions.ValidationException + +import kotlin.test.Test +import kotlin.test.assertFailsWith + +class RefInAdditionalpropertiesTest { + companion object { + val configuration = SchemaConfiguration(JsonSchemaKeywordFlags.Builder().format().build()) + } + + @Test + fun testPropertyNamedRefValidPasses() { + // property named \$ref valid + val schema = RefInAdditionalproperties.RefInAdditionalproperties1.getInstance() + schema.validate( + mapOf( + Pair( + "someProp", + mapOf( + Pair( + "\$ref", + "a" + ) + ) + ) + ), + configuration + ) + } + + @Test + fun testPropertyNamedRefInvalidFails() { + // property named \$ref invalid + val schema = RefInAdditionalproperties.RefInAdditionalproperties1.getInstance() + assertFailsWith( + block = { + schema.validate( + mapOf( + Pair( + "someProp", + mapOf( + Pair( + "\$ref", + 2 + ) + ) + ) + ), + configuration + ) + } + ) + } +} diff --git a/samples/client/3_0_3_unit_test/kotlin/src/test/kotlin/org/openapijsonschematools/client/components/schemas/RefInAllofTest.kt b/samples/client/3_0_3_unit_test/kotlin/src/test/kotlin/org/openapijsonschematools/client/components/schemas/RefInAllofTest.kt new file mode 100644 index 00000000000..8d4a5e2b8f5 --- /dev/null +++ b/samples/client/3_0_3_unit_test/kotlin/src/test/kotlin/org/openapijsonschematools/client/components/schemas/RefInAllofTest.kt @@ -0,0 +1,48 @@ +package org.openapijsonschematools.client.components.schemas + +import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags +import org.openapijsonschematools.client.configurations.SchemaConfiguration +import org.openapijsonschematools.client.exceptions.ValidationException + +import kotlin.test.Test +import kotlin.test.assertFailsWith + +class RefInAllofTest { + companion object { + val configuration = SchemaConfiguration(JsonSchemaKeywordFlags.Builder().format().build()) + } + + @Test + fun testPropertyNamedRefValidPasses() { + // property named \$ref valid + val schema = RefInAllof.RefInAllof1.getInstance() + schema.validate( + mapOf( + Pair( + "\$ref", + "a" + ) + ), + configuration + ) + } + + @Test + fun testPropertyNamedRefInvalidFails() { + // property named \$ref invalid + val schema = RefInAllof.RefInAllof1.getInstance() + assertFailsWith( + block = { + schema.validate( + mapOf( + Pair( + "\$ref", + 2 + ) + ), + configuration + ) + } + ) + } +} diff --git a/samples/client/3_0_3_unit_test/kotlin/src/test/kotlin/org/openapijsonschematools/client/components/schemas/RefInAnyofTest.kt b/samples/client/3_0_3_unit_test/kotlin/src/test/kotlin/org/openapijsonschematools/client/components/schemas/RefInAnyofTest.kt new file mode 100644 index 00000000000..953bfe69e37 --- /dev/null +++ b/samples/client/3_0_3_unit_test/kotlin/src/test/kotlin/org/openapijsonschematools/client/components/schemas/RefInAnyofTest.kt @@ -0,0 +1,48 @@ +package org.openapijsonschematools.client.components.schemas + +import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags +import org.openapijsonschematools.client.configurations.SchemaConfiguration +import org.openapijsonschematools.client.exceptions.ValidationException + +import kotlin.test.Test +import kotlin.test.assertFailsWith + +class RefInAnyofTest { + companion object { + val configuration = SchemaConfiguration(JsonSchemaKeywordFlags.Builder().format().build()) + } + + @Test + fun testPropertyNamedRefValidPasses() { + // property named \$ref valid + val schema = RefInAnyof.RefInAnyof1.getInstance() + schema.validate( + mapOf( + Pair( + "\$ref", + "a" + ) + ), + configuration + ) + } + + @Test + fun testPropertyNamedRefInvalidFails() { + // property named \$ref invalid + val schema = RefInAnyof.RefInAnyof1.getInstance() + assertFailsWith( + block = { + schema.validate( + mapOf( + Pair( + "\$ref", + 2 + ) + ), + configuration + ) + } + ) + } +} diff --git a/samples/client/3_0_3_unit_test/kotlin/src/test/kotlin/org/openapijsonschematools/client/components/schemas/RefInItemsTest.kt b/samples/client/3_0_3_unit_test/kotlin/src/test/kotlin/org/openapijsonschematools/client/components/schemas/RefInItemsTest.kt new file mode 100644 index 00000000000..e90b797223d --- /dev/null +++ b/samples/client/3_0_3_unit_test/kotlin/src/test/kotlin/org/openapijsonschematools/client/components/schemas/RefInItemsTest.kt @@ -0,0 +1,54 @@ +package org.openapijsonschematools.client.components.schemas + +import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags +import org.openapijsonschematools.client.configurations.SchemaConfiguration +import org.openapijsonschematools.client.exceptions.ValidationException + +import kotlin.test.Test +import kotlin.test.assertFailsWith + +class RefInItemsTest { + companion object { + val configuration = SchemaConfiguration(JsonSchemaKeywordFlags.Builder().format().build()) + } + + @Test + fun testPropertyNamedRefValidPasses() { + // property named \$ref valid + val schema = RefInItems.RefInItems1.getInstance() + schema.validate( + RefInItems.RefInItemsListBuilder() + .add( + mapOf( + Pair( + "\$ref", + "a" + ) + ) + ) + .build(), + configuration + ) + } + + @Test + fun testPropertyNamedRefInvalidFails() { + // property named \$ref invalid + val schema = RefInItems.RefInItems1.getInstance() + assertFailsWith( + block = { + schema.validate( + listOf( + mapOf( + Pair( + "\$ref", + 2 + ) + ) + ), + configuration + ) + } + ) + } +} diff --git a/samples/client/3_0_3_unit_test/kotlin/src/test/kotlin/org/openapijsonschematools/client/components/schemas/RefInNotTest.kt b/samples/client/3_0_3_unit_test/kotlin/src/test/kotlin/org/openapijsonschematools/client/components/schemas/RefInNotTest.kt new file mode 100644 index 00000000000..83eaae28ac7 --- /dev/null +++ b/samples/client/3_0_3_unit_test/kotlin/src/test/kotlin/org/openapijsonschematools/client/components/schemas/RefInNotTest.kt @@ -0,0 +1,48 @@ +package org.openapijsonschematools.client.components.schemas + +import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags +import org.openapijsonschematools.client.configurations.SchemaConfiguration +import org.openapijsonschematools.client.exceptions.ValidationException + +import kotlin.test.Test +import kotlin.test.assertFailsWith + +class RefInNotTest { + companion object { + val configuration = SchemaConfiguration(JsonSchemaKeywordFlags.Builder().format().build()) + } + + @Test + fun testPropertyNamedRefValidPasses() { + // property named \$ref valid + val schema = RefInNot.RefInNot1.getInstance() + schema.validate( + mapOf( + Pair( + "\$ref", + 2 + ) + ), + configuration + ) + } + + @Test + fun testPropertyNamedRefInvalidFails() { + // property named \$ref invalid + val schema = RefInNot.RefInNot1.getInstance() + assertFailsWith( + block = { + schema.validate( + mapOf( + Pair( + "\$ref", + "a" + ) + ), + configuration + ) + } + ) + } +} diff --git a/samples/client/3_0_3_unit_test/kotlin/src/test/kotlin/org/openapijsonschematools/client/components/schemas/RefInOneofTest.kt b/samples/client/3_0_3_unit_test/kotlin/src/test/kotlin/org/openapijsonschematools/client/components/schemas/RefInOneofTest.kt new file mode 100644 index 00000000000..87372d74e73 --- /dev/null +++ b/samples/client/3_0_3_unit_test/kotlin/src/test/kotlin/org/openapijsonschematools/client/components/schemas/RefInOneofTest.kt @@ -0,0 +1,48 @@ +package org.openapijsonschematools.client.components.schemas + +import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags +import org.openapijsonschematools.client.configurations.SchemaConfiguration +import org.openapijsonschematools.client.exceptions.ValidationException + +import kotlin.test.Test +import kotlin.test.assertFailsWith + +class RefInOneofTest { + companion object { + val configuration = SchemaConfiguration(JsonSchemaKeywordFlags.Builder().format().build()) + } + + @Test + fun testPropertyNamedRefValidPasses() { + // property named \$ref valid + val schema = RefInOneof.RefInOneof1.getInstance() + schema.validate( + mapOf( + Pair( + "\$ref", + "a" + ) + ), + configuration + ) + } + + @Test + fun testPropertyNamedRefInvalidFails() { + // property named \$ref invalid + val schema = RefInOneof.RefInOneof1.getInstance() + assertFailsWith( + block = { + schema.validate( + mapOf( + Pair( + "\$ref", + 2 + ) + ), + configuration + ) + } + ) + } +} diff --git a/samples/client/3_0_3_unit_test/kotlin/src/test/kotlin/org/openapijsonschematools/client/components/schemas/RefInPropertyTest.kt b/samples/client/3_0_3_unit_test/kotlin/src/test/kotlin/org/openapijsonschematools/client/components/schemas/RefInPropertyTest.kt new file mode 100644 index 00000000000..e93ab768d2a --- /dev/null +++ b/samples/client/3_0_3_unit_test/kotlin/src/test/kotlin/org/openapijsonschematools/client/components/schemas/RefInPropertyTest.kt @@ -0,0 +1,58 @@ +package org.openapijsonschematools.client.components.schemas + +import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags +import org.openapijsonschematools.client.configurations.SchemaConfiguration +import org.openapijsonschematools.client.exceptions.ValidationException + +import kotlin.test.Test +import kotlin.test.assertFailsWith + +class RefInPropertyTest { + companion object { + val configuration = SchemaConfiguration(JsonSchemaKeywordFlags.Builder().format().build()) + } + + @Test + fun testPropertyNamedRefValidPasses() { + // property named \$ref valid + val schema = RefInProperty.RefInProperty1.getInstance() + schema.validate( + mapOf( + Pair( + "a", + mapOf( + Pair( + "\$ref", + "a" + ) + ) + ) + ), + configuration + ) + } + + @Test + fun testPropertyNamedRefInvalidFails() { + // property named \$ref invalid + val schema = RefInProperty.RefInProperty1.getInstance() + assertFailsWith( + block = { + schema.validate( + mapOf( + Pair( + "a", + mapOf( + Pair( + "\$ref", + 2 + ) + ) + ) + ), + configuration + ) + } + ) + } +} diff --git a/samples/client/3_0_3_unit_test/kotlin/src/test/kotlin/org/openapijsonschematools/client/components/schemas/RequiredDefaultValidationTest.kt b/samples/client/3_0_3_unit_test/kotlin/src/test/kotlin/org/openapijsonschematools/client/components/schemas/RequiredDefaultValidationTest.kt new file mode 100644 index 00000000000..8512a0f489f --- /dev/null +++ b/samples/client/3_0_3_unit_test/kotlin/src/test/kotlin/org/openapijsonschematools/client/components/schemas/RequiredDefaultValidationTest.kt @@ -0,0 +1,25 @@ +package org.openapijsonschematools.client.components.schemas + +import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags +import org.openapijsonschematools.client.configurations.SchemaConfiguration +import org.openapijsonschematools.client.exceptions.ValidationException + +import kotlin.test.Test +import kotlin.test.assertFailsWith + +class RequiredDefaultValidationTest { + companion object { + val configuration = SchemaConfiguration(JsonSchemaKeywordFlags.Builder().format().build()) + } + + @Test + fun testNotRequiredByDefaultPasses() { + // not required by default + val schema = RequiredDefaultValidation.RequiredDefaultValidation1.getInstance() + schema.validate( + mapOf( + ), + configuration + ) + } +} diff --git a/samples/client/3_0_3_unit_test/kotlin/src/test/kotlin/org/openapijsonschematools/client/components/schemas/RequiredValidationTest.kt b/samples/client/3_0_3_unit_test/kotlin/src/test/kotlin/org/openapijsonschematools/client/components/schemas/RequiredValidationTest.kt new file mode 100644 index 00000000000..c5815409b38 --- /dev/null +++ b/samples/client/3_0_3_unit_test/kotlin/src/test/kotlin/org/openapijsonschematools/client/components/schemas/RequiredValidationTest.kt @@ -0,0 +1,79 @@ +package org.openapijsonschematools.client.components.schemas + +import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags +import org.openapijsonschematools.client.configurations.SchemaConfiguration +import org.openapijsonschematools.client.exceptions.ValidationException + +import kotlin.test.Test +import kotlin.test.assertFailsWith + +class RequiredValidationTest { + companion object { + val configuration = SchemaConfiguration(JsonSchemaKeywordFlags.Builder().format().build()) + } + + @Test + fun testPresentRequiredPropertyIsValidPasses() { + // present required property is valid + val schema = RequiredValidation.RequiredValidation1.getInstance() + schema.validate( + mapOf( + Pair( + "foo", + 1 + ) + ), + configuration + ) + } + + @Test + fun testIgnoresOtherNonObjectsPasses() { + // ignores other non-objects + val schema = RequiredValidation.RequiredValidation1.getInstance() + schema.validate( + 12, + configuration + ) + } + + @Test + fun testIgnoresArraysPasses() { + // ignores arrays + val schema = RequiredValidation.RequiredValidation1.getInstance() + schema.validate( + listOf( + ), + configuration + ) + } + + @Test + fun testIgnoresStringsPasses() { + // ignores strings + val schema = RequiredValidation.RequiredValidation1.getInstance() + schema.validate( + "", + configuration + ) + } + + @Test + fun testNonPresentRequiredPropertyIsInvalidFails() { + // non-present required property is invalid + val schema = RequiredValidation.RequiredValidation1.getInstance() + assertFailsWith( + block = { + schema.validate( + mapOf( + Pair( + "bar", + 1 + ) + ), + configuration + ) + } + ) + } +} diff --git a/samples/client/3_0_3_unit_test/kotlin/src/test/kotlin/org/openapijsonschematools/client/components/schemas/RequiredWithEmptyArrayTest.kt b/samples/client/3_0_3_unit_test/kotlin/src/test/kotlin/org/openapijsonschematools/client/components/schemas/RequiredWithEmptyArrayTest.kt new file mode 100644 index 00000000000..4f5162d7519 --- /dev/null +++ b/samples/client/3_0_3_unit_test/kotlin/src/test/kotlin/org/openapijsonschematools/client/components/schemas/RequiredWithEmptyArrayTest.kt @@ -0,0 +1,25 @@ +package org.openapijsonschematools.client.components.schemas + +import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags +import org.openapijsonschematools.client.configurations.SchemaConfiguration +import org.openapijsonschematools.client.exceptions.ValidationException + +import kotlin.test.Test +import kotlin.test.assertFailsWith + +class RequiredWithEmptyArrayTest { + companion object { + val configuration = SchemaConfiguration(JsonSchemaKeywordFlags.Builder().format().build()) + } + + @Test + fun testPropertyNotRequiredPasses() { + // property not required + val schema = RequiredWithEmptyArray.RequiredWithEmptyArray1.getInstance() + schema.validate( + mapOf( + ), + configuration + ) + } +} diff --git a/samples/client/3_0_3_unit_test/kotlin/src/test/kotlin/org/openapijsonschematools/client/components/schemas/RequiredWithEscapedCharactersTest.kt b/samples/client/3_0_3_unit_test/kotlin/src/test/kotlin/org/openapijsonschematools/client/components/schemas/RequiredWithEscapedCharactersTest.kt new file mode 100644 index 00000000000..b3b2e3a223f --- /dev/null +++ b/samples/client/3_0_3_unit_test/kotlin/src/test/kotlin/org/openapijsonschematools/client/components/schemas/RequiredWithEscapedCharactersTest.kt @@ -0,0 +1,72 @@ +package org.openapijsonschematools.client.components.schemas + +import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags +import org.openapijsonschematools.client.configurations.SchemaConfiguration +import org.openapijsonschematools.client.exceptions.ValidationException + +import kotlin.test.Test +import kotlin.test.assertFailsWith + +class RequiredWithEscapedCharactersTest { + companion object { + val configuration = SchemaConfiguration(JsonSchemaKeywordFlags.Builder().format().build()) + } + + @Test + fun testObjectWithSomePropertiesMissingIsInvalidFails() { + // object with some properties missing is invalid + val schema = RequiredWithEscapedCharacters.RequiredWithEscapedCharacters1.getInstance() + assertFailsWith( + block = { + schema.validate( + mapOf( + Pair( + "foo\nbar", + "1" + ), + Pair( + "foo\"bar", + "1" + ) + ), + configuration + ) + } + ) + } + + @Test + fun testObjectWithAllPropertiesPresentIsValidPasses() { + // object with all properties present is valid + val schema = RequiredWithEscapedCharacters.RequiredWithEscapedCharacters1.getInstance() + schema.validate( + mapOf( + Pair( + "foo\nbar", + 1 + ), + Pair( + "foo\"bar", + 1 + ), + Pair( + "foo\\bar", + 1 + ), + Pair( + "foo\rbar", + 1 + ), + Pair( + "foo\tbar", + 1 + ), + Pair( + "foo\u000Cbar", + 1 + ) + ), + configuration + ) + } +} diff --git a/samples/client/3_0_3_unit_test/kotlin/src/test/kotlin/org/openapijsonschematools/client/components/schemas/SimpleEnumValidationTest.kt b/samples/client/3_0_3_unit_test/kotlin/src/test/kotlin/org/openapijsonschematools/client/components/schemas/SimpleEnumValidationTest.kt new file mode 100644 index 00000000000..88f0fb9321f --- /dev/null +++ b/samples/client/3_0_3_unit_test/kotlin/src/test/kotlin/org/openapijsonschematools/client/components/schemas/SimpleEnumValidationTest.kt @@ -0,0 +1,38 @@ +package org.openapijsonschematools.client.components.schemas + +import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags +import org.openapijsonschematools.client.configurations.SchemaConfiguration +import org.openapijsonschematools.client.exceptions.ValidationException + +import kotlin.test.Test +import kotlin.test.assertFailsWith + +class SimpleEnumValidationTest { + companion object { + val configuration = SchemaConfiguration(JsonSchemaKeywordFlags.Builder().format().build()) + } + + @Test + fun testSomethingElseIsInvalidFails() { + // something else is invalid + val schema = SimpleEnumValidation.SimpleEnumValidation1.getInstance() + assertFailsWith( + block = { + schema.validate( + 4, + configuration + ) + } + ) + } + + @Test + fun testOneOfTheEnumIsValidPasses() { + // one of the enum is valid + val schema = SimpleEnumValidation.SimpleEnumValidation1.getInstance() + schema.validate( + 1, + configuration + ) + } +} diff --git a/samples/client/3_0_3_unit_test/kotlin/src/test/kotlin/org/openapijsonschematools/client/components/schemas/StringTypeMatchesStringsTest.kt b/samples/client/3_0_3_unit_test/kotlin/src/test/kotlin/org/openapijsonschematools/client/components/schemas/StringTypeMatchesStringsTest.kt new file mode 100644 index 00000000000..4c9aafdb869 --- /dev/null +++ b/samples/client/3_0_3_unit_test/kotlin/src/test/kotlin/org/openapijsonschematools/client/components/schemas/StringTypeMatchesStringsTest.kt @@ -0,0 +1,130 @@ +package org.openapijsonschematools.client.components.schemas + +import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags +import org.openapijsonschematools.client.configurations.SchemaConfiguration +import org.openapijsonschematools.client.exceptions.ValidationException + +import kotlin.test.Test +import kotlin.test.assertFailsWith + +class StringTypeMatchesStringsTest { + companion object { + val configuration = SchemaConfiguration(JsonSchemaKeywordFlags.Builder().format().build()) + } + + @Test + fun testAStringIsStillAStringEvenIfItLooksLikeANumberPasses() { + // a string is still a string, even if it looks like a number + val schema = StringTypeMatchesStrings.StringTypeMatchesStrings1.getInstance() + schema.validate( + "1", + configuration + ) + } + + @Test + fun test1IsNotAStringFails() { + // 1 is not a string + val schema = StringTypeMatchesStrings.StringTypeMatchesStrings1.getInstance() + assertFailsWith( + block = { + schema.validate( + 1, + configuration + ) + } + ) + } + + @Test + fun testABooleanIsNotAStringFails() { + // a boolean is not a string + val schema = StringTypeMatchesStrings.StringTypeMatchesStrings1.getInstance() + assertFailsWith( + block = { + schema.validate( + true, + configuration + ) + } + ) + } + + @Test + fun testAnEmptyStringIsStillAStringPasses() { + // an empty string is still a string + val schema = StringTypeMatchesStrings.StringTypeMatchesStrings1.getInstance() + schema.validate( + "", + configuration + ) + } + + @Test + fun testAnArrayIsNotAStringFails() { + // an array is not a string + val schema = StringTypeMatchesStrings.StringTypeMatchesStrings1.getInstance() + assertFailsWith( + block = { + schema.validate( + listOf( + ), + configuration + ) + } + ) + } + + @Test + fun testAnObjectIsNotAStringFails() { + // an object is not a string + val schema = StringTypeMatchesStrings.StringTypeMatchesStrings1.getInstance() + assertFailsWith( + block = { + schema.validate( + mapOf( + ), + configuration + ) + } + ) + } + + @Test + fun testNullIsNotAStringFails() { + // null is not a string + val schema = StringTypeMatchesStrings.StringTypeMatchesStrings1.getInstance() + assertFailsWith( + block = { + schema.validate( + null, + configuration + ) + } + ) + } + + @Test + fun testAStringIsAStringPasses() { + // a string is a string + val schema = StringTypeMatchesStrings.StringTypeMatchesStrings1.getInstance() + schema.validate( + "foo", + configuration + ) + } + + @Test + fun testAFloatIsNotAStringFails() { + // a float is not a string + val schema = StringTypeMatchesStrings.StringTypeMatchesStrings1.getInstance() + assertFailsWith( + block = { + schema.validate( + 1.1, + configuration + ) + } + ) + } +} diff --git a/samples/client/3_0_3_unit_test/kotlin/src/test/kotlin/org/openapijsonschematools/client/components/schemas/TheDefaultKeywordDoesNotDoAnythingIfThePropertyIsMissingTest.kt b/samples/client/3_0_3_unit_test/kotlin/src/test/kotlin/org/openapijsonschematools/client/components/schemas/TheDefaultKeywordDoesNotDoAnythingIfThePropertyIsMissingTest.kt new file mode 100644 index 00000000000..245ef6aad3f --- /dev/null +++ b/samples/client/3_0_3_unit_test/kotlin/src/test/kotlin/org/openapijsonschematools/client/components/schemas/TheDefaultKeywordDoesNotDoAnythingIfThePropertyIsMissingTest.kt @@ -0,0 +1,59 @@ +package org.openapijsonschematools.client.components.schemas + +import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags +import org.openapijsonschematools.client.configurations.SchemaConfiguration +import org.openapijsonschematools.client.exceptions.ValidationException + +import kotlin.test.Test +import kotlin.test.assertFailsWith + +class TheDefaultKeywordDoesNotDoAnythingIfThePropertyIsMissingTest { + companion object { + val configuration = SchemaConfiguration(JsonSchemaKeywordFlags.Builder().format().build()) + } + + @Test + fun testMissingPropertiesAreNotFilledInWithTheDefaultPasses() { + // missing properties are not filled in with the default + val schema = TheDefaultKeywordDoesNotDoAnythingIfThePropertyIsMissing.TheDefaultKeywordDoesNotDoAnythingIfThePropertyIsMissing1.getInstance() + schema.validate( + mapOf( + ), + configuration + ) + } + + @Test + fun testAnExplicitPropertyValueIsCheckedAgainstMaximumPassingPasses() { + // an explicit property value is checked against maximum (passing) + val schema = TheDefaultKeywordDoesNotDoAnythingIfThePropertyIsMissing.TheDefaultKeywordDoesNotDoAnythingIfThePropertyIsMissing1.getInstance() + schema.validate( + mapOf( + Pair( + "alpha", + 1 + ) + ), + configuration + ) + } + + @Test + fun testAnExplicitPropertyValueIsCheckedAgainstMaximumFailingFails() { + // an explicit property value is checked against maximum (failing) + val schema = TheDefaultKeywordDoesNotDoAnythingIfThePropertyIsMissing.TheDefaultKeywordDoesNotDoAnythingIfThePropertyIsMissing1.getInstance() + assertFailsWith( + block = { + schema.validate( + mapOf( + Pair( + "alpha", + 5 + ) + ), + configuration + ) + } + ) + } +} diff --git a/samples/client/3_0_3_unit_test/kotlin/src/test/kotlin/org/openapijsonschematools/client/components/schemas/UniqueitemsFalseValidationTest.kt b/samples/client/3_0_3_unit_test/kotlin/src/test/kotlin/org/openapijsonschematools/client/components/schemas/UniqueitemsFalseValidationTest.kt new file mode 100644 index 00000000000..4c5cff32904 --- /dev/null +++ b/samples/client/3_0_3_unit_test/kotlin/src/test/kotlin/org/openapijsonschematools/client/components/schemas/UniqueitemsFalseValidationTest.kt @@ -0,0 +1,312 @@ +package org.openapijsonschematools.client.components.schemas + +import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags +import org.openapijsonschematools.client.configurations.SchemaConfiguration +import org.openapijsonschematools.client.exceptions.ValidationException + +import kotlin.test.Test +import kotlin.test.assertFailsWith + +class UniqueitemsFalseValidationTest { + companion object { + val configuration = SchemaConfiguration(JsonSchemaKeywordFlags.Builder().format().build()) + } + + @Test + fun testNumbersAreUniqueIfMathematicallyUnequalPasses() { + // numbers are unique if mathematically unequal + val schema = UniqueitemsFalseValidation.UniqueitemsFalseValidation1.getInstance() + schema.validate( + listOf( + 1.0, + 1.0, + 1 + ), + configuration + ) + } + + @Test + fun testNonUniqueArrayOfIntegersIsValidPasses() { + // non-unique array of integers is valid + val schema = UniqueitemsFalseValidation.UniqueitemsFalseValidation1.getInstance() + schema.validate( + listOf( + 1, + 1 + ), + configuration + ) + } + + @Test + fun testNonUniqueArrayOfObjectsIsValidPasses() { + // non-unique array of objects is valid + val schema = UniqueitemsFalseValidation.UniqueitemsFalseValidation1.getInstance() + schema.validate( + listOf( + mapOf( + Pair( + "foo", + "bar" + ) + ), + mapOf( + Pair( + "foo", + "bar" + ) + ) + ), + configuration + ) + } + + @Test + fun testNonUniqueArrayOfArraysIsValidPasses() { + // non-unique array of arrays is valid + val schema = UniqueitemsFalseValidation.UniqueitemsFalseValidation1.getInstance() + schema.validate( + listOf( + listOf( + "foo" + ), + listOf( + "foo" + ) + ), + configuration + ) + } + + @Test + fun test1AndTrueAreUniquePasses() { + // 1 and true are unique + val schema = UniqueitemsFalseValidation.UniqueitemsFalseValidation1.getInstance() + schema.validate( + listOf( + 1, + true + ), + configuration + ) + } + + @Test + fun testUniqueArrayOfNestedObjectsIsValidPasses() { + // unique array of nested objects is valid + val schema = UniqueitemsFalseValidation.UniqueitemsFalseValidation1.getInstance() + schema.validate( + listOf( + mapOf( + Pair( + "foo", + mapOf( + Pair( + "bar", + mapOf( + Pair( + "baz", + true + ) + ) + ) + ) + ) + ), + mapOf( + Pair( + "foo", + mapOf( + Pair( + "bar", + mapOf( + Pair( + "baz", + false + ) + ) + ) + ) + ) + ) + ), + configuration + ) + } + + @Test + fun testUniqueArrayOfArraysIsValidPasses() { + // unique array of arrays is valid + val schema = UniqueitemsFalseValidation.UniqueitemsFalseValidation1.getInstance() + schema.validate( + listOf( + listOf( + "foo" + ), + listOf( + "bar" + ) + ), + configuration + ) + } + + @Test + fun testTrueIsNotEqualToOnePasses() { + // true is not equal to one + val schema = UniqueitemsFalseValidation.UniqueitemsFalseValidation1.getInstance() + schema.validate( + listOf( + 1, + true + ), + configuration + ) + } + + @Test + fun testNonUniqueHeterogeneousTypesAreValidPasses() { + // non-unique heterogeneous types are valid + val schema = UniqueitemsFalseValidation.UniqueitemsFalseValidation1.getInstance() + schema.validate( + listOf( + mapOf( + ), + listOf( + 1 + ), + true, + null, + mapOf( + ), + 1 + ), + configuration + ) + } + + @Test + fun testFalseIsNotEqualToZeroPasses() { + // false is not equal to zero + val schema = UniqueitemsFalseValidation.UniqueitemsFalseValidation1.getInstance() + schema.validate( + listOf( + 0, + false + ), + configuration + ) + } + + @Test + fun testUniqueArrayOfIntegersIsValidPasses() { + // unique array of integers is valid + val schema = UniqueitemsFalseValidation.UniqueitemsFalseValidation1.getInstance() + schema.validate( + listOf( + 1, + 2 + ), + configuration + ) + } + + @Test + fun test0AndFalseAreUniquePasses() { + // 0 and false are unique + val schema = UniqueitemsFalseValidation.UniqueitemsFalseValidation1.getInstance() + schema.validate( + listOf( + 0, + false + ), + configuration + ) + } + + @Test + fun testUniqueHeterogeneousTypesAreValidPasses() { + // unique heterogeneous types are valid + val schema = UniqueitemsFalseValidation.UniqueitemsFalseValidation1.getInstance() + schema.validate( + listOf( + mapOf( + ), + listOf( + 1 + ), + true, + null, + 1 + ), + configuration + ) + } + + @Test + fun testUniqueArrayOfObjectsIsValidPasses() { + // unique array of objects is valid + val schema = UniqueitemsFalseValidation.UniqueitemsFalseValidation1.getInstance() + schema.validate( + listOf( + mapOf( + Pair( + "foo", + "bar" + ) + ), + mapOf( + Pair( + "foo", + "baz" + ) + ) + ), + configuration + ) + } + + @Test + fun testNonUniqueArrayOfNestedObjectsIsValidPasses() { + // non-unique array of nested objects is valid + val schema = UniqueitemsFalseValidation.UniqueitemsFalseValidation1.getInstance() + schema.validate( + listOf( + mapOf( + Pair( + "foo", + mapOf( + Pair( + "bar", + mapOf( + Pair( + "baz", + true + ) + ) + ) + ) + ) + ), + mapOf( + Pair( + "foo", + mapOf( + Pair( + "bar", + mapOf( + Pair( + "baz", + true + ) + ) + ) + ) + ) + ) + ), + configuration + ) + } +} diff --git a/samples/client/3_0_3_unit_test/kotlin/src/test/kotlin/org/openapijsonschematools/client/components/schemas/UniqueitemsValidationTest.kt b/samples/client/3_0_3_unit_test/kotlin/src/test/kotlin/org/openapijsonschematools/client/components/schemas/UniqueitemsValidationTest.kt new file mode 100644 index 00000000000..6073b139769 --- /dev/null +++ b/samples/client/3_0_3_unit_test/kotlin/src/test/kotlin/org/openapijsonschematools/client/components/schemas/UniqueitemsValidationTest.kt @@ -0,0 +1,577 @@ +package org.openapijsonschematools.client.components.schemas + +import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags +import org.openapijsonschematools.client.configurations.SchemaConfiguration +import org.openapijsonschematools.client.exceptions.ValidationException + +import kotlin.test.Test +import kotlin.test.assertFailsWith + +class UniqueitemsValidationTest { + companion object { + val configuration = SchemaConfiguration(JsonSchemaKeywordFlags.Builder().format().build()) + } + + @Test + fun testNonUniqueArrayOfMoreThanTwoIntegersIsInvalidFails() { + // non-unique array of more than two integers is invalid + val schema = UniqueitemsValidation.UniqueitemsValidation1.getInstance() + assertFailsWith( + block = { + schema.validate( + listOf( + 1, + 2, + 1 + ), + configuration + ) + } + ) + } + + @Test + fun testNonUniqueArrayOfObjectsIsInvalidFails() { + // non-unique array of objects is invalid + val schema = UniqueitemsValidation.UniqueitemsValidation1.getInstance() + assertFailsWith( + block = { + schema.validate( + listOf( + mapOf( + Pair( + "foo", + "bar" + ) + ), + mapOf( + Pair( + "foo", + "bar" + ) + ) + ), + configuration + ) + } + ) + } + + @Test + fun testATrueAndA1AreUniquePasses() { + // {\\\"a\\\": true} and {\\\"a\\\": 1} are unique + val schema = UniqueitemsValidation.UniqueitemsValidation1.getInstance() + schema.validate( + listOf( + mapOf( + Pair( + "a", + true + ) + ), + mapOf( + Pair( + "a", + 1 + ) + ) + ), + configuration + ) + } + + @Test + fun test1AndTrueAreUniquePasses() { + // [1] and [true] are unique + val schema = UniqueitemsValidation.UniqueitemsValidation1.getInstance() + schema.validate( + listOf( + listOf( + 1 + ), + listOf( + true + ) + ), + configuration + ) + } + + @Test + fun testNonUniqueArrayOfIntegersIsInvalidFails() { + // non-unique array of integers is invalid + val schema = UniqueitemsValidation.UniqueitemsValidation1.getInstance() + assertFailsWith( + block = { + schema.validate( + listOf( + 1, + 1 + ), + configuration + ) + } + ) + } + + @Test + fun testNested0AndFalseAreUniquePasses() { + // nested [0] and [false] are unique + val schema = UniqueitemsValidation.UniqueitemsValidation1.getInstance() + schema.validate( + listOf( + listOf( + listOf( + 0 + ), + "foo" + ), + listOf( + listOf( + false + ), + "foo" + ) + ), + configuration + ) + } + + @Test + fun testObjectsAreNonUniqueDespiteKeyOrderFails() { + // objects are non-unique despite key order + val schema = UniqueitemsValidation.UniqueitemsValidation1.getInstance() + assertFailsWith( + block = { + schema.validate( + listOf( + mapOf( + Pair( + "a", + 1 + ), + Pair( + "b", + 2 + ) + ), + mapOf( + Pair( + "b", + 2 + ), + Pair( + "a", + 1 + ) + ) + ), + configuration + ) + } + ) + } + + @Test + fun testNonUniqueArrayOfArraysIsInvalidFails() { + // non-unique array of arrays is invalid + val schema = UniqueitemsValidation.UniqueitemsValidation1.getInstance() + assertFailsWith( + block = { + schema.validate( + listOf( + listOf( + "foo" + ), + listOf( + "foo" + ) + ), + configuration + ) + } + ) + } + + @Test + fun testAFalseAndA0AreUniquePasses() { + // {\\\"a\\\": false} and {\\\"a\\\": 0} are unique + val schema = UniqueitemsValidation.UniqueitemsValidation1.getInstance() + schema.validate( + listOf( + mapOf( + Pair( + "a", + false + ) + ), + mapOf( + Pair( + "a", + 0 + ) + ) + ), + configuration + ) + } + + @Test + fun testNonUniqueArrayOfMoreThanTwoArraysIsInvalidFails() { + // non-unique array of more than two arrays is invalid + val schema = UniqueitemsValidation.UniqueitemsValidation1.getInstance() + assertFailsWith( + block = { + schema.validate( + listOf( + listOf( + "foo" + ), + listOf( + "bar" + ), + listOf( + "foo" + ) + ), + configuration + ) + } + ) + } + + @Test + fun test0AndFalseAreUniquePasses() { + // [0] and [false] are unique + val schema = UniqueitemsValidation.UniqueitemsValidation1.getInstance() + schema.validate( + listOf( + listOf( + 0 + ), + listOf( + false + ) + ), + configuration + ) + } + + @Test + fun testNonUniqueArrayOfNestedObjectsIsInvalidFails() { + // non-unique array of nested objects is invalid + val schema = UniqueitemsValidation.UniqueitemsValidation1.getInstance() + assertFailsWith( + block = { + schema.validate( + listOf( + mapOf( + Pair( + "foo", + mapOf( + Pair( + "bar", + mapOf( + Pair( + "baz", + true + ) + ) + ) + ) + ) + ), + mapOf( + Pair( + "foo", + mapOf( + Pair( + "bar", + mapOf( + Pair( + "baz", + true + ) + ) + ) + ) + ) + ) + ), + configuration + ) + } + ) + } + + @Test + fun testNumbersAreUniqueIfMathematicallyUnequalFails() { + // numbers are unique if mathematically unequal + val schema = UniqueitemsValidation.UniqueitemsValidation1.getInstance() + assertFailsWith( + block = { + schema.validate( + listOf( + 1.0, + 1.0, + 1 + ), + configuration + ) + } + ) + } + + @Test + fun testNonUniqueArrayOfStringsIsInvalidFails() { + // non-unique array of strings is invalid + val schema = UniqueitemsValidation.UniqueitemsValidation1.getInstance() + assertFailsWith( + block = { + schema.validate( + listOf( + "foo", + "bar", + "foo" + ), + configuration + ) + } + ) + } + + @Test + fun testUniqueArrayOfNestedObjectsIsValidPasses() { + // unique array of nested objects is valid + val schema = UniqueitemsValidation.UniqueitemsValidation1.getInstance() + schema.validate( + listOf( + mapOf( + Pair( + "foo", + mapOf( + Pair( + "bar", + mapOf( + Pair( + "baz", + true + ) + ) + ) + ) + ) + ), + mapOf( + Pair( + "foo", + mapOf( + Pair( + "bar", + mapOf( + Pair( + "baz", + false + ) + ) + ) + ) + ) + ) + ), + configuration + ) + } + + @Test + fun testUniqueArrayOfArraysIsValidPasses() { + // unique array of arrays is valid + val schema = UniqueitemsValidation.UniqueitemsValidation1.getInstance() + schema.validate( + listOf( + listOf( + "foo" + ), + listOf( + "bar" + ) + ), + configuration + ) + } + + @Test + fun testTrueIsNotEqualToOnePasses() { + // true is not equal to one + val schema = UniqueitemsValidation.UniqueitemsValidation1.getInstance() + schema.validate( + listOf( + 1, + true + ), + configuration + ) + } + + @Test + fun testNested1AndTrueAreUniquePasses() { + // nested [1] and [true] are unique + val schema = UniqueitemsValidation.UniqueitemsValidation1.getInstance() + schema.validate( + listOf( + listOf( + listOf( + 1 + ), + "foo" + ), + listOf( + listOf( + true + ), + "foo" + ) + ), + configuration + ) + } + + @Test + fun testUniqueArrayOfStringsIsValidPasses() { + // unique array of strings is valid + val schema = UniqueitemsValidation.UniqueitemsValidation1.getInstance() + schema.validate( + listOf( + "foo", + "bar", + "baz" + ), + configuration + ) + } + + @Test + fun testFalseIsNotEqualToZeroPasses() { + // false is not equal to zero + val schema = UniqueitemsValidation.UniqueitemsValidation1.getInstance() + schema.validate( + listOf( + 0, + false + ), + configuration + ) + } + + @Test + fun testUniqueArrayOfIntegersIsValidPasses() { + // unique array of integers is valid + val schema = UniqueitemsValidation.UniqueitemsValidation1.getInstance() + schema.validate( + listOf( + 1, + 2 + ), + configuration + ) + } + + @Test + fun testDifferentObjectsAreUniquePasses() { + // different objects are unique + val schema = UniqueitemsValidation.UniqueitemsValidation1.getInstance() + schema.validate( + listOf( + mapOf( + Pair( + "a", + 1 + ), + Pair( + "b", + 2 + ) + ), + mapOf( + Pair( + "a", + 2 + ), + Pair( + "b", + 1 + ) + ) + ), + configuration + ) + } + + @Test + fun testUniqueHeterogeneousTypesAreValidPasses() { + // unique heterogeneous types are valid + val schema = UniqueitemsValidation.UniqueitemsValidation1.getInstance() + schema.validate( + listOf( + mapOf( + ), + listOf( + 1 + ), + true, + null, + 1, + "{}" + ), + configuration + ) + } + + @Test + fun testUniqueArrayOfObjectsIsValidPasses() { + // unique array of objects is valid + val schema = UniqueitemsValidation.UniqueitemsValidation1.getInstance() + schema.validate( + listOf( + mapOf( + Pair( + "foo", + "bar" + ) + ), + mapOf( + Pair( + "foo", + "baz" + ) + ) + ), + configuration + ) + } + + @Test + fun testNonUniqueHeterogeneousTypesAreInvalidFails() { + // non-unique heterogeneous types are invalid + val schema = UniqueitemsValidation.UniqueitemsValidation1.getInstance() + assertFailsWith( + block = { + schema.validate( + listOf( + mapOf( + ), + listOf( + 1 + ), + true, + null, + mapOf( + ), + 1 + ), + configuration + ) + } + ) + } +} diff --git a/samples/client/3_0_3_unit_test/kotlin/src/test/kotlin/org/openapijsonschematools/client/components/schemas/UriFormatTest.kt b/samples/client/3_0_3_unit_test/kotlin/src/test/kotlin/org/openapijsonschematools/client/components/schemas/UriFormatTest.kt new file mode 100644 index 00000000000..8ca87fa4aa6 --- /dev/null +++ b/samples/client/3_0_3_unit_test/kotlin/src/test/kotlin/org/openapijsonschematools/client/components/schemas/UriFormatTest.kt @@ -0,0 +1,76 @@ +package org.openapijsonschematools.client.components.schemas + +import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags +import org.openapijsonschematools.client.configurations.SchemaConfiguration +import org.openapijsonschematools.client.exceptions.ValidationException + +import kotlin.test.Test +import kotlin.test.assertFailsWith + +class UriFormatTest { + companion object { + val configuration = SchemaConfiguration(JsonSchemaKeywordFlags.Builder().format().build()) + } + + @Test + fun testAllStringFormatsIgnoreIntegersPasses() { + // all string formats ignore integers + val schema = UriFormat.UriFormat1.getInstance() + schema.validate( + 12, + configuration + ) + } + + @Test + fun testAllStringFormatsIgnoreNullsPasses() { + // all string formats ignore nulls + val schema = UriFormat.UriFormat1.getInstance() + schema.validate( + null, + configuration + ) + } + + @Test + fun testAllStringFormatsIgnoreObjectsPasses() { + // all string formats ignore objects + val schema = UriFormat.UriFormat1.getInstance() + schema.validate( + mapOf( + ), + configuration + ) + } + + @Test + fun testAllStringFormatsIgnoreFloatsPasses() { + // all string formats ignore floats + val schema = UriFormat.UriFormat1.getInstance() + schema.validate( + 13.7, + configuration + ) + } + + @Test + fun testAllStringFormatsIgnoreArraysPasses() { + // all string formats ignore arrays + val schema = UriFormat.UriFormat1.getInstance() + schema.validate( + listOf( + ), + configuration + ) + } + + @Test + fun testAllStringFormatsIgnoreBooleansPasses() { + // all string formats ignore booleans + val schema = UriFormat.UriFormat1.getInstance() + schema.validate( + false, + configuration + ) + } +} diff --git a/samples/client/3_0_3_unit_test/kotlin/src/test/kotlin/org/openapijsonschematools/client/components/schemas/UriReferenceFormatTest.kt b/samples/client/3_0_3_unit_test/kotlin/src/test/kotlin/org/openapijsonschematools/client/components/schemas/UriReferenceFormatTest.kt new file mode 100644 index 00000000000..2eb308a891a --- /dev/null +++ b/samples/client/3_0_3_unit_test/kotlin/src/test/kotlin/org/openapijsonschematools/client/components/schemas/UriReferenceFormatTest.kt @@ -0,0 +1,76 @@ +package org.openapijsonschematools.client.components.schemas + +import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags +import org.openapijsonschematools.client.configurations.SchemaConfiguration +import org.openapijsonschematools.client.exceptions.ValidationException + +import kotlin.test.Test +import kotlin.test.assertFailsWith + +class UriReferenceFormatTest { + companion object { + val configuration = SchemaConfiguration(JsonSchemaKeywordFlags.Builder().format().build()) + } + + @Test + fun testAllStringFormatsIgnoreIntegersPasses() { + // all string formats ignore integers + val schema = UriReferenceFormat.UriReferenceFormat1.getInstance() + schema.validate( + 12, + configuration + ) + } + + @Test + fun testAllStringFormatsIgnoreNullsPasses() { + // all string formats ignore nulls + val schema = UriReferenceFormat.UriReferenceFormat1.getInstance() + schema.validate( + null, + configuration + ) + } + + @Test + fun testAllStringFormatsIgnoreObjectsPasses() { + // all string formats ignore objects + val schema = UriReferenceFormat.UriReferenceFormat1.getInstance() + schema.validate( + mapOf( + ), + configuration + ) + } + + @Test + fun testAllStringFormatsIgnoreFloatsPasses() { + // all string formats ignore floats + val schema = UriReferenceFormat.UriReferenceFormat1.getInstance() + schema.validate( + 13.7, + configuration + ) + } + + @Test + fun testAllStringFormatsIgnoreArraysPasses() { + // all string formats ignore arrays + val schema = UriReferenceFormat.UriReferenceFormat1.getInstance() + schema.validate( + listOf( + ), + configuration + ) + } + + @Test + fun testAllStringFormatsIgnoreBooleansPasses() { + // all string formats ignore booleans + val schema = UriReferenceFormat.UriReferenceFormat1.getInstance() + schema.validate( + false, + configuration + ) + } +} diff --git a/samples/client/3_0_3_unit_test/kotlin/src/test/kotlin/org/openapijsonschematools/client/components/schemas/UriTemplateFormatTest.kt b/samples/client/3_0_3_unit_test/kotlin/src/test/kotlin/org/openapijsonschematools/client/components/schemas/UriTemplateFormatTest.kt new file mode 100644 index 00000000000..b593a7b2009 --- /dev/null +++ b/samples/client/3_0_3_unit_test/kotlin/src/test/kotlin/org/openapijsonschematools/client/components/schemas/UriTemplateFormatTest.kt @@ -0,0 +1,76 @@ +package org.openapijsonschematools.client.components.schemas + +import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags +import org.openapijsonschematools.client.configurations.SchemaConfiguration +import org.openapijsonschematools.client.exceptions.ValidationException + +import kotlin.test.Test +import kotlin.test.assertFailsWith + +class UriTemplateFormatTest { + companion object { + val configuration = SchemaConfiguration(JsonSchemaKeywordFlags.Builder().format().build()) + } + + @Test + fun testAllStringFormatsIgnoreIntegersPasses() { + // all string formats ignore integers + val schema = UriTemplateFormat.UriTemplateFormat1.getInstance() + schema.validate( + 12, + configuration + ) + } + + @Test + fun testAllStringFormatsIgnoreNullsPasses() { + // all string formats ignore nulls + val schema = UriTemplateFormat.UriTemplateFormat1.getInstance() + schema.validate( + null, + configuration + ) + } + + @Test + fun testAllStringFormatsIgnoreObjectsPasses() { + // all string formats ignore objects + val schema = UriTemplateFormat.UriTemplateFormat1.getInstance() + schema.validate( + mapOf( + ), + configuration + ) + } + + @Test + fun testAllStringFormatsIgnoreFloatsPasses() { + // all string formats ignore floats + val schema = UriTemplateFormat.UriTemplateFormat1.getInstance() + schema.validate( + 13.7, + configuration + ) + } + + @Test + fun testAllStringFormatsIgnoreArraysPasses() { + // all string formats ignore arrays + val schema = UriTemplateFormat.UriTemplateFormat1.getInstance() + schema.validate( + listOf( + ), + configuration + ) + } + + @Test + fun testAllStringFormatsIgnoreBooleansPasses() { + // all string formats ignore booleans + val schema = UriTemplateFormat.UriTemplateFormat1.getInstance() + schema.validate( + false, + configuration + ) + } +} diff --git a/samples/client/3_0_3_unit_test/kotlin/src/test/kotlin/org/openapijsonschematools/client/configurations/JsonSchemaKeywordFlagsTest.kt b/samples/client/3_0_3_unit_test/kotlin/src/test/kotlin/org/openapijsonschematools/client/configurations/JsonSchemaKeywordFlagsTest.kt new file mode 100644 index 00000000000..cab27673567 --- /dev/null +++ b/samples/client/3_0_3_unit_test/kotlin/src/test/kotlin/org/openapijsonschematools/client/configurations/JsonSchemaKeywordFlagsTest.kt @@ -0,0 +1,141 @@ +package org.openapijsonschematools.client.configurations; + +import kotlin.test.Test +import kotlin.test.assertEquals + +class JsonSchemaKeywordFlagsTest { + @Test + fun testGetEnabledKeywords() { + val jsonSchemaKeywordFlags = JsonSchemaKeywordFlags( + true, + true, + true, + true, + true, + true, + true, + true, + true, + true, + true, + true, + true, + true, + true, + true, + true, + true, + true, + true, + true, + true, + true, + true, + true, + true, + true, + true, + true, + true, + true, + true, + true, + true, + true, + true, + true, + true, + true + ) + val enabledKeywords = jsonSchemaKeywordFlags.keywords + val expectedEnabledKeywords = LinkedHashSet() + expectedEnabledKeywords.add("additionalProperties") + expectedEnabledKeywords.add("allOf") + expectedEnabledKeywords.add("anyOf") + expectedEnabledKeywords.add("const") + expectedEnabledKeywords.add("contains") + expectedEnabledKeywords.add("dependentRequired") + expectedEnabledKeywords.add("dependentSchemas") + expectedEnabledKeywords.add("discriminator") + expectedEnabledKeywords.add("else_") + expectedEnabledKeywords.add("enum_") + expectedEnabledKeywords.add("exclusiveMaximum") + expectedEnabledKeywords.add("exclusiveMinimum") + expectedEnabledKeywords.add("format") + expectedEnabledKeywords.add("if_") + expectedEnabledKeywords.add("maximum") + expectedEnabledKeywords.add("minimum") + expectedEnabledKeywords.add("items") + expectedEnabledKeywords.add("maxContains") + expectedEnabledKeywords.add("maxItems") + expectedEnabledKeywords.add("maxLength") + expectedEnabledKeywords.add("maxProperties") + expectedEnabledKeywords.add("minContains") + expectedEnabledKeywords.add("minItems") + expectedEnabledKeywords.add("minLength") + expectedEnabledKeywords.add("minProperties") + expectedEnabledKeywords.add("multipleOf") + expectedEnabledKeywords.add("not") + expectedEnabledKeywords.add("oneOf") + expectedEnabledKeywords.add("pattern") + expectedEnabledKeywords.add("patternProperties") + expectedEnabledKeywords.add("prefixItems") + expectedEnabledKeywords.add("properties") + expectedEnabledKeywords.add("propertyNames") + expectedEnabledKeywords.add("required") + expectedEnabledKeywords.add("then") + expectedEnabledKeywords.add("type") + expectedEnabledKeywords.add("uniqueItems") + expectedEnabledKeywords.add("unevaluatedItems") + expectedEnabledKeywords.add("unevaluatedProperties") + assertEquals(enabledKeywords, expectedEnabledKeywords) + } + + @Test + fun testGetNoEnabledKeywords() { + val jsonSchemaKeywordFlags = JsonSchemaKeywordFlags( + false, + false, + false, + false, + false, + false, + false, + false, + false, + false, + false, + false, + false, + false, + false, + false, + false, + false, + false, + false, + false, + false, + false, + false, + false, + false, + false, + false, + false, + false, + false, + false, + false, + false, + false, + false, + false, + false, + false + ) + val enabledKeywords = jsonSchemaKeywordFlags.keywords + val expectedEnabledKeywords = LinkedHashSet() + assertEquals(enabledKeywords, expectedEnabledKeywords) + } +} \ No newline at end of file diff --git a/samples/client/3_0_3_unit_test/kotlin/src/test/kotlin/org/openapijsonschematools/client/schemas/AnyTypeSchemaTest.kt b/samples/client/3_0_3_unit_test/kotlin/src/test/kotlin/org/openapijsonschematools/client/schemas/AnyTypeSchemaTest.kt new file mode 100644 index 00000000000..74571be8bc2 --- /dev/null +++ b/samples/client/3_0_3_unit_test/kotlin/src/test/kotlin/org/openapijsonschematools/client/schemas/AnyTypeSchemaTest.kt @@ -0,0 +1,113 @@ +package org.openapijsonschematools.client.schemas + +import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags +import org.openapijsonschematools.client.configurations.SchemaConfiguration +import org.openapijsonschematools.client.exceptions.ValidationException +import org.openapijsonschematools.client.schemas.validation.FrozenList +import org.openapijsonschematools.client.schemas.validation.FrozenMap + +import java.time.LocalDate +import java.time.ZoneId +import java.time.ZonedDateTime +import kotlin.test.Test +import kotlin.test.assertEquals +import kotlin.test.assertFalse +import kotlin.test.assertNull +import kotlin.test.assertTrue + +class AnyTypeSchemaTest { + @Test + @Throws(ValidationException::class) + fun testValidateNull() { + val validatedValue: Nothing? = schema.validate(null, configuration) + assertNull(validatedValue) + } + + @Test + @Throws(ValidationException::class) + fun testValidateBoolean() { + val trueValue = schema.validate(true, configuration) + assertTrue(trueValue) + val falseValue = schema.validate(false, configuration) + assertFalse(falseValue) + } + + @Test + @Throws(ValidationException::class) + fun testValidateInteger() { + val validatedValue = schema.validate(1, configuration) + assertEquals(validatedValue.toLong(), 1) + } + + @Test + @Throws(ValidationException::class) + fun testValidateLong() { + val validatedValue = schema.validate(1L, configuration) + assertEquals(validatedValue, 1L) + } + + @Test + @Throws(ValidationException::class) + fun testValidateFloat() { + val validatedValue = schema.validate(3.14f, configuration) + assertEquals(validatedValue.compareTo(3.14f).toLong(), 0) + } + + @Test + @Throws(ValidationException::class) + fun testValidateDouble() { + val validatedValue = schema.validate(70.6458763, configuration) + assertEquals(validatedValue.compareTo(70.6458763).toLong(), 0) + } + + @Test + @Throws(ValidationException::class) + fun testValidateString() { + val validatedValue = schema.validate("a", configuration) + assertEquals(validatedValue, "a") + } + + @Test + @Throws(ValidationException::class) + fun testValidateZonedDateTime() { + val validatedValue = + schema.validate(ZonedDateTime.of(2017, 7, 21, 17, 32, 28, 0, ZoneId.of("Z")), configuration) + assertEquals(validatedValue, "2017-07-21T17:32:28Z") + } + + @Test + @Throws(ValidationException::class) + fun testValidateLocalDate() { + val validatedValue = schema.validate(LocalDate.of(2017, 7, 21), configuration) + assertEquals(validatedValue, "2017-07-21") + } + + @Test + @Throws(ValidationException::class) + fun testValidateMap() { + val inMap = mapOf( + "today" to LocalDate.of(2017, 7, 21) + ) + val validatedValue: FrozenMap<*> = schema.validate(inMap, configuration) + val outMap: Map = mapOf( + "today" to "2017-07-21" + ) + assertEquals(validatedValue, outMap) + } + + @Test + @Throws(ValidationException::class) + fun testValidateList() { + val inList = listOf( + LocalDate.of(2017, 7, 21) + ) + val validatedValue: FrozenList<*> = schema.validate(inList, configuration) + val outList: List = listOf("2017-07-21") + assertEquals(validatedValue, outList) + } + + companion object { + val schema = AnyTypeJsonSchema.AnyTypeJsonSchema1.getInstance() + val configuration = SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + } +} \ No newline at end of file diff --git a/samples/client/3_0_3_unit_test/kotlin/src/test/kotlin/org/openapijsonschematools/client/schemas/ArrayTypeSchemaTest.kt b/samples/client/3_0_3_unit_test/kotlin/src/test/kotlin/org/openapijsonschematools/client/schemas/ArrayTypeSchemaTest.kt new file mode 100644 index 00000000000..79c24c6cb44 --- /dev/null +++ b/samples/client/3_0_3_unit_test/kotlin/src/test/kotlin/org/openapijsonschematools/client/schemas/ArrayTypeSchemaTest.kt @@ -0,0 +1,251 @@ +package org.openapijsonschematools.client.schemas + +import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags +import org.openapijsonschematools.client.configurations.SchemaConfiguration +import org.openapijsonschematools.client.exceptions.ValidationException +import org.openapijsonschematools.client.schemas.validation.JsonSchema +import org.openapijsonschematools.client.schemas.validation.JsonSchemaInfo +import org.openapijsonschematools.client.schemas.validation.FrozenList +import org.openapijsonschematools.client.schemas.validation.PathToSchemasMap +import org.openapijsonschematools.client.schemas.validation.ListSchemaValidator +import org.openapijsonschematools.client.schemas.validation.ValidationMetadata + +import kotlin.test.Test +import kotlin.test.assertEquals +import kotlin.test.assertFailsWith + +class ArrayTypeSchemaTest { + sealed interface ArrayWithItemsSchemaBoxed + + data class ArrayWithItemsSchemaBoxedList(val data: FrozenList) : ArrayWithItemsSchemaBoxed + class ArrayWithItemsSchema : JsonSchema( + JsonSchemaInfo() + .type(setOf(List::class.java)) + .items(StringJsonSchema.StringJsonSchema1::class.java) + ), ListSchemaValidator, ArrayWithItemsSchemaBoxedList> { + override fun getNewInstance( + arg: List<*>, + pathToItem: List, + pathToSchemas: PathToSchemasMap + ): FrozenList { + val items: MutableList = ArrayList() + var i = 0 + for (item in arg) { + val itemPathToItem: MutableList = ArrayList(pathToItem) + itemPathToItem.add(i) + val schemas = pathToSchemas[itemPathToItem] + ?: throw RuntimeException("Validation result is invalid, schemas must exist for a pathToItem") + val itemSchema = schemas.entries.iterator().next().key + val castItem = itemSchema.getNewInstance(item, itemPathToItem, pathToSchemas) as? String + ?: throw RuntimeException("Instantiated type of item is invalid") + items.add(castItem) + i += 1 + } + return FrozenList(items) + } + + @Throws(ValidationException::class) + override fun validate(arg: List<*>, configuration: SchemaConfiguration?): FrozenList { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg: List<*> = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validationMetadata = + ValidationMetadata(pathToItem, usedConfiguration, PathToSchemasMap(), LinkedHashSet()) + val pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet) + return getNewInstance(castArg, validationMetadata.pathToItem, pathToSchemasMap) + } + + @Throws(ValidationException::class) + override fun validateAndBox(arg: List<*>, configuration: SchemaConfiguration?): ArrayWithItemsSchemaBoxedList { + return ArrayWithItemsSchemaBoxedList(validate(arg, configuration)) + } + + override fun getNewInstance(arg: Any?, pathToItem: List, pathToSchemas: PathToSchemasMap): Any? { + if (arg is List<*>) { + return getNewInstance(arg, pathToItem, pathToSchemas) + } + throw RuntimeException("Invalid input type=$javaClass. It can't be instantiated by this schema") + } + + @Throws(ValidationException::class) + override fun validate(arg: Any?, configuration: SchemaConfiguration?): Any? { + if (arg is List<*>) { + return validate(arg as List<*>?, configuration) + } + throw ValidationException("Invalid input type=$javaClass. It can't be validated by this schema") + } + + @Throws(ValidationException::class) + override fun validateAndBox(arg: Any?, configuration: SchemaConfiguration?): ArrayWithItemsSchemaBoxed { + if (arg is List<*>) { + return ArrayWithItemsSchemaBoxedList(validate(arg, configuration)) + } + throw ValidationException("Invalid input type=$javaClass. It can't be validated by this schema") + } + } + + class ArrayWithOutputClsSchemaList(m: FrozenList) : FrozenList(m) { + companion object { + @Throws(ValidationException::class) + fun of(arg: List, configuration: SchemaConfiguration?): ArrayWithOutputClsSchemaList { + return ArrayWithOutputClsSchema().validate(arg, configuration) + } + } + } + + interface ArrayWithOutputClsSchemaBoxed + + data class ArrayWithOutputClsSchemaBoxedList(val data: ArrayWithOutputClsSchemaList) : + ArrayWithOutputClsSchemaBoxed + + class ArrayWithOutputClsSchema : JsonSchema( + JsonSchemaInfo() + .type(setOf(List::class.java)) + .items(StringJsonSchema.StringJsonSchema1::class.java) + ), ListSchemaValidator { + override fun getNewInstance( + arg: List<*>, + pathToItem: List, + pathToSchemas: PathToSchemasMap + ): ArrayWithOutputClsSchemaList { + val items: MutableList = ArrayList() + var i = 0 + for (item in arg) { + val itemPathToItem: MutableList = ArrayList(pathToItem) + itemPathToItem.add(i) + val schemas = pathToSchemas[itemPathToItem] + ?: throw RuntimeException("Validation result is invalid, schemas must exist for a pathToItem") + val itemSchema = schemas.entries.iterator().next().key + val castItem = itemSchema.getNewInstance(item, itemPathToItem, pathToSchemas) as? String + ?: throw RuntimeException("Instantiated type of item is invalid") + items.add(castItem) + i += 1 + } + val newInstanceItems = FrozenList(items) + return ArrayWithOutputClsSchemaList(newInstanceItems) + } + + @Throws(ValidationException::class) + override fun validate(arg: List<*>, configuration: SchemaConfiguration?): ArrayWithOutputClsSchemaList { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg: List<*> = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validationMetadata = + ValidationMetadata(pathToItem, usedConfiguration, PathToSchemasMap(), LinkedHashSet()) + val pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet) + return getNewInstance(castArg, validationMetadata.pathToItem, pathToSchemasMap) + } + + @Throws(ValidationException::class) + override fun validateAndBox( + arg: List<*>, + configuration: SchemaConfiguration? + ): ArrayWithOutputClsSchemaBoxedList { + return ArrayWithOutputClsSchemaBoxedList(validate(arg, configuration)) + } + + override fun getNewInstance(arg: Any?, pathToItem: List, pathToSchemas: PathToSchemasMap): Any? { + if (arg is List<*>) { + return getNewInstance(arg, pathToItem, pathToSchemas) + } + throw RuntimeException("Invalid input type=$javaClass. It can't be instantiated by this schema") + } + + @Throws(ValidationException::class) + override fun validate(arg: Any?, configuration: SchemaConfiguration?): Any? { + if (arg is List<*>) { + return validate(arg as List<*>?, configuration) + } + throw ValidationException("Invalid input type=$javaClass. It can't be validated by this schema") + } + + @Throws(ValidationException::class) + override fun validateAndBox(arg: Any?, configuration: SchemaConfiguration?): ArrayWithOutputClsSchemaBoxed { + if (arg is List<*>) { + return ArrayWithOutputClsSchemaBoxedList(validate(arg, configuration)) + } + throw ValidationException("Invalid input type=$javaClass. It can't be validated by this schema") + } + } + + @Test + fun testExceptionThrownForInvalidType() { + assertFailsWith( + block = { + JsonSchema.validate( + ArrayWithItemsSchema(), + null, + validationMetadata + ) + } + ) + } + + @Test + @Throws(ValidationException::class) + fun testValidateArrayWithItemsSchema() { + // list with only item works + var inList: List = listOf("abc") + var validatedValue: FrozenList = ArrayWithItemsSchema().validate(inList, configuration) + var outList: List = listOf("abc") + assertEquals(validatedValue, outList) + + // list with no items works + inList = listOf() + validatedValue = ArrayWithItemsSchema().validate(inList, configuration) + outList = listOf() + assertEquals(validatedValue, outList) + + // invalid item type fails + val intList = listOf(1) + assertFailsWith( + block = { + JsonSchema.validate( + ArrayWithItemsSchema(), + intList, + validationMetadata + ) + } + ) + } + + @Test + @Throws(ValidationException::class) + fun testValidateArrayWithOutputClsSchema() { + // list with only item works + var inList: List = listOf("abc") + var validatedValue = ArrayWithOutputClsSchema().validate(inList, configuration) + var outList: List = listOf("abc") + assertEquals(validatedValue, outList) + + // list with no items works + inList = listOf() + validatedValue = ArrayWithOutputClsSchema().validate(inList, configuration) + outList = listOf() + assertEquals(validatedValue, outList) + + // invalid item type fails + val intList = listOf(1) + assertFailsWith( + block = { + JsonSchema.validate( + ArrayWithOutputClsSchema(), + intList, + validationMetadata + ) + } + ) + } + + companion object { + val configuration = SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validationMetadata = ValidationMetadata( + listOf("args[0"), + configuration, + PathToSchemasMap(), + LinkedHashSet() + ) + } +} \ No newline at end of file diff --git a/samples/client/3_0_3_unit_test/kotlin/src/test/kotlin/org/openapijsonschematools/client/schemas/BooleanSchemaTest.kt b/samples/client/3_0_3_unit_test/kotlin/src/test/kotlin/org/openapijsonschematools/client/schemas/BooleanSchemaTest.kt new file mode 100644 index 00000000000..4afe62df020 --- /dev/null +++ b/samples/client/3_0_3_unit_test/kotlin/src/test/kotlin/org/openapijsonschematools/client/schemas/BooleanSchemaTest.kt @@ -0,0 +1,53 @@ +package org.openapijsonschematools.client.schemas + +import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags +import org.openapijsonschematools.client.configurations.SchemaConfiguration +import org.openapijsonschematools.client.exceptions.ValidationException +import org.openapijsonschematools.client.schemas.validation.JsonSchema +import org.openapijsonschematools.client.schemas.validation.PathToSchemasMap +import org.openapijsonschematools.client.schemas.validation.ValidationMetadata + +import kotlin.test.Test +import kotlin.test.assertFailsWith +import kotlin.test.assertFalse +import kotlin.test.assertTrue + +class BooleanSchemaTest { + @Test + @Throws(ValidationException::class) + fun testValidateTrue() { + val validatedValue = booleanJsonSchema.validate(true, configuration) + assertTrue(validatedValue) + } + + @Test + @Throws(ValidationException::class) + fun testValidateFalse() { + val validatedValue = booleanJsonSchema.validate(false, configuration) + assertFalse(validatedValue) + } + + @Test + fun testExceptionThrownForInvalidType() { + assertFailsWith( + block = { + JsonSchema.validate( + booleanJsonSchema, + null, + validationMetadata + ) + } + ) + } + + companion object { + val configuration = SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val booleanJsonSchema = BooleanJsonSchema.BooleanJsonSchema1.getInstance() + val validationMetadata = ValidationMetadata( + listOf("args[0"), + configuration, + PathToSchemasMap(), + LinkedHashSet() + ) + } +} \ No newline at end of file diff --git a/samples/client/3_0_3_unit_test/kotlin/src/test/kotlin/org/openapijsonschematools/client/schemas/ListBuilderTest.kt b/samples/client/3_0_3_unit_test/kotlin/src/test/kotlin/org/openapijsonschematools/client/schemas/ListBuilderTest.kt new file mode 100644 index 00000000000..6aa74e7b8dc --- /dev/null +++ b/samples/client/3_0_3_unit_test/kotlin/src/test/kotlin/org/openapijsonschematools/client/schemas/ListBuilderTest.kt @@ -0,0 +1,55 @@ +package org.openapijsonschematools.client.schemas + +import kotlin.test.Test +import kotlin.test.assertEquals + +class ListBuilderTest { + class NullableListWithNullableItemsListBuilder { + // class to build List<@Nullable List> + private val list: MutableList?> + + constructor() { + list = ArrayList() + } + + constructor(list: MutableList?>) { + this.list = list + } + + fun add(item: Nothing?): NullableListWithNullableItemsListBuilder { + list.add(item) + return this + } + + fun add(item: List): NullableListWithNullableItemsListBuilder { + list.add(item) + return this + } + + fun build(): List?> { + return list + } + } + + @Test + fun testSucceedsWithNullInput() { + val inList: MutableList?> = ArrayList() + inList.add(null) + var builder = NullableListWithNullableItemsListBuilder(inList) + assertEquals(inList, builder.build()) + builder = NullableListWithNullableItemsListBuilder() + builder.add(null) + assertEquals(inList, builder.build()) + } + + @Test + fun testSucceedsWithNonNullInput() { + val inList: MutableList?> = ArrayList() + inList.add(listOf(1)) + var builder = NullableListWithNullableItemsListBuilder(inList) + assertEquals(inList, builder.build()) + builder = NullableListWithNullableItemsListBuilder() + builder.add(listOf(1)) + assertEquals(inList, builder.build()) + } +} \ No newline at end of file diff --git a/samples/client/3_0_3_unit_test/kotlin/src/test/kotlin/org/openapijsonschematools/client/schemas/ListSchemaTest.kt b/samples/client/3_0_3_unit_test/kotlin/src/test/kotlin/org/openapijsonschematools/client/schemas/ListSchemaTest.kt new file mode 100644 index 00000000000..494fd110f59 --- /dev/null +++ b/samples/client/3_0_3_unit_test/kotlin/src/test/kotlin/org/openapijsonschematools/client/schemas/ListSchemaTest.kt @@ -0,0 +1,49 @@ +package org.openapijsonschematools.client.schemas + +import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags +import org.openapijsonschematools.client.configurations.SchemaConfiguration +import org.openapijsonschematools.client.exceptions.ValidationException +import org.openapijsonschematools.client.schemas.validation.JsonSchema +import org.openapijsonschematools.client.schemas.validation.FrozenList +import org.openapijsonschematools.client.schemas.validation.PathToSchemasMap +import org.openapijsonschematools.client.schemas.validation.ValidationMetadata + +import kotlin.test.Test +import kotlin.test.assertEquals +import kotlin.test.assertFailsWith + +class ListSchemaTest { + @Test + fun testExceptionThrownForInvalidType() { + assertFailsWith( + block = { + JsonSchema.validate( + listJsonSchema, + null, + validationMetadata + ) + } + ) + } + + @Test + @Throws(ValidationException::class) + fun testValidateList() { + val inList: MutableList = ArrayList() + inList.add("today") + val validatedValue = listJsonSchema.validate(inList, configuration) + val outList: List = listOf("today") + assertEquals(validatedValue, outList) + } + + companion object { + val configuration = SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val listJsonSchema = ListJsonSchema.ListJsonSchema1.getInstance() + val validationMetadata = ValidationMetadata( + listOf("args[0"), + configuration, + PathToSchemasMap(), + LinkedHashSet() + ) + } +} \ No newline at end of file diff --git a/samples/client/3_0_3_unit_test/kotlin/src/test/kotlin/org/openapijsonschematools/client/schemas/MapSchemaTest.kt b/samples/client/3_0_3_unit_test/kotlin/src/test/kotlin/org/openapijsonschematools/client/schemas/MapSchemaTest.kt new file mode 100644 index 00000000000..bfcd692cb86 --- /dev/null +++ b/samples/client/3_0_3_unit_test/kotlin/src/test/kotlin/org/openapijsonschematools/client/schemas/MapSchemaTest.kt @@ -0,0 +1,50 @@ +package org.openapijsonschematools.client.schemas + +import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags +import org.openapijsonschematools.client.configurations.SchemaConfiguration +import org.openapijsonschematools.client.exceptions.ValidationException +import org.openapijsonschematools.client.schemas.validation.JsonSchema +import org.openapijsonschematools.client.schemas.validation.FrozenMap +import org.openapijsonschematools.client.schemas.validation.PathToSchemasMap +import org.openapijsonschematools.client.schemas.validation.ValidationMetadata + +import java.time.LocalDate +import kotlin.test.Test +import kotlin.test.assertEquals +import kotlin.test.assertFailsWith + +class MapSchemaTest { + @Test + fun testExceptionThrownForInvalidType() { + assertFailsWith( + block = { + JsonSchema.validate( + mapJsonSchema, + null, + validationMetadata + ) + } + ) + } + + @Test + @Throws(ValidationException::class) + fun testValidateMap() { + val inMap: MutableMap = LinkedHashMap() + inMap["today"] = LocalDate.of(2017, 7, 21) + val validatedValue = mapJsonSchema.validate(inMap, configuration) + val outMap: Map = mapOf("today" to "2017-07-21") + assertEquals(validatedValue, outMap) + } + + companion object { + val configuration = SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val mapJsonSchema = MapJsonSchema.MapJsonSchema1.getInstance() + val validationMetadata = ValidationMetadata( + listOf("args[0"), + configuration, + PathToSchemasMap(), + LinkedHashSet() + ) + } +} \ No newline at end of file diff --git a/samples/client/3_0_3_unit_test/kotlin/src/test/kotlin/org/openapijsonschematools/client/schemas/NullSchemaTest.kt b/samples/client/3_0_3_unit_test/kotlin/src/test/kotlin/org/openapijsonschematools/client/schemas/NullSchemaTest.kt new file mode 100644 index 00000000000..a096b91adf2 --- /dev/null +++ b/samples/client/3_0_3_unit_test/kotlin/src/test/kotlin/org/openapijsonschematools/client/schemas/NullSchemaTest.kt @@ -0,0 +1,46 @@ +package org.openapijsonschematools.client.schemas + +import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags +import org.openapijsonschematools.client.configurations.SchemaConfiguration +import org.openapijsonschematools.client.exceptions.ValidationException +import org.openapijsonschematools.client.schemas.validation.JsonSchema +import org.openapijsonschematools.client.schemas.validation.PathToSchemasMap +import org.openapijsonschematools.client.schemas.validation.ValidationMetadata + +import kotlin.Throws +import kotlin.test.Test +import kotlin.test.assertFailsWith +import kotlin.test.assertNull + +class NullSchemaTest { + @Test + @Throws(ValidationException::class) + fun testValidateNull() { + val validatedValue: Nothing? = nullJsonSchema.validate(null, configuration) + assertNull(validatedValue) + } + + @Test + fun testExceptionThrownForInvalidType() { + assertFailsWith( + block = { + JsonSchema.validate( + nullJsonSchema, + true, + validationMetadata + ) + } + ) + } + + companion object { + val configuration = SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val nullJsonSchema = NullJsonSchema.NullJsonSchema1.getInstance() + val validationMetadata = ValidationMetadata( + listOf("args[0"), + configuration, + PathToSchemasMap(), + LinkedHashSet() + ) + } +} \ No newline at end of file diff --git a/samples/client/3_0_3_unit_test/kotlin/src/test/kotlin/org/openapijsonschematools/client/schemas/NumberSchemaTest.kt b/samples/client/3_0_3_unit_test/kotlin/src/test/kotlin/org/openapijsonschematools/client/schemas/NumberSchemaTest.kt new file mode 100644 index 00000000000..db8bd160ce2 --- /dev/null +++ b/samples/client/3_0_3_unit_test/kotlin/src/test/kotlin/org/openapijsonschematools/client/schemas/NumberSchemaTest.kt @@ -0,0 +1,66 @@ +package org.openapijsonschematools.client.schemas + +import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags +import org.openapijsonschematools.client.configurations.SchemaConfiguration +import org.openapijsonschematools.client.exceptions.ValidationException +import org.openapijsonschematools.client.schemas.validation.JsonSchema +import org.openapijsonschematools.client.schemas.validation.PathToSchemasMap +import org.openapijsonschematools.client.schemas.validation.ValidationMetadata + +import kotlin.test.Test +import kotlin.test.assertEquals +import kotlin.test.assertFailsWith + +class NumberSchemaTest { + @Test + @Throws(ValidationException::class) + fun testValidateInteger() { + val validatedValue = numberJsonSchema.validate(1, configuration) + assertEquals(validatedValue.toLong(), 1) + } + + @Test + @Throws(ValidationException::class) + fun testValidateLong() { + val validatedValue = numberJsonSchema.validate(1L, configuration) + assertEquals(validatedValue, 1L) + } + + @Test + @Throws(ValidationException::class) + fun testValidateFloat() { + val validatedValue = numberJsonSchema.validate(3.14f, configuration) + assertEquals(validatedValue.compareTo(3.14f).toLong(), 0) + } + + @Test + @Throws(ValidationException::class) + fun testValidateDouble() { + val validatedValue = numberJsonSchema.validate(3.14, configuration) + assertEquals(validatedValue.compareTo(3.14).toLong(), 0) + } + + @Test + fun testExceptionThrownForInvalidType() { + assertFailsWith( + block = { + JsonSchema.validate( + numberJsonSchema, + null, + validationMetadata + ) + } + ) + } + + companion object { + val configuration = SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val numberJsonSchema = NumberJsonSchema.NumberJsonSchema1.getInstance() + val validationMetadata = ValidationMetadata( + listOf("args[0"), + configuration, + PathToSchemasMap(), + LinkedHashSet() + ) + } +} \ No newline at end of file diff --git a/samples/client/3_0_3_unit_test/kotlin/src/test/kotlin/org/openapijsonschematools/client/schemas/ObjectTypeSchemaTest.kt b/samples/client/3_0_3_unit_test/kotlin/src/test/kotlin/org/openapijsonschematools/client/schemas/ObjectTypeSchemaTest.kt new file mode 100644 index 00000000000..a87586e8b15 --- /dev/null +++ b/samples/client/3_0_3_unit_test/kotlin/src/test/kotlin/org/openapijsonschematools/client/schemas/ObjectTypeSchemaTest.kt @@ -0,0 +1,569 @@ +package org.openapijsonschematools.client.schemas + +import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags +import org.openapijsonschematools.client.configurations.SchemaConfiguration +import org.openapijsonschematools.client.exceptions.ValidationException +import org.openapijsonschematools.client.schemas.validation.JsonSchema +import org.openapijsonschematools.client.schemas.validation.JsonSchemaInfo +import org.openapijsonschematools.client.schemas.validation.FrozenMap +import org.openapijsonschematools.client.schemas.validation.PathToSchemasMap +import org.openapijsonschematools.client.schemas.validation.MapSchemaValidator +import org.openapijsonschematools.client.schemas.validation.ValidationMetadata + +import kotlin.test.Test +import kotlin.test.assertEquals +import kotlin.test.assertFailsWith + +class ObjectTypeSchemaTest { + interface ObjectWithPropsSchemaBoxed + + data class ObjectWithPropsSchemaBoxedMap(val data: FrozenMap) : ObjectWithPropsSchemaBoxed + class ObjectWithPropsSchema private constructor() : JsonSchema( + JsonSchemaInfo() + .type(setOf(Map::class.java)) + .properties( + mapOf( + "someString" to StringJsonSchema.StringJsonSchema1::class.java + ) + ) + ), MapSchemaValidator, ObjectWithPropsSchemaBoxedMap> { + override fun getNewInstance( + arg: Map<*, *>, + pathToItem: List, + pathToSchemas: PathToSchemasMap + ): FrozenMap { + val properties = LinkedHashMap() + for ((entryKey, value1) in arg) { + if (entryKey !is String) { + throw RuntimeException("Invalid non-string key value") + } + val propertyPathToItem: MutableList = ArrayList(pathToItem) + propertyPathToItem.add(entryKey) + val value = value1!! + val schemas = pathToSchemas[propertyPathToItem] + ?: throw RuntimeException("Validation result is invalid, schemas must exist for a pathToItem") + val propertySchema = schemas.entries.iterator().next().key + val castValue = propertySchema.getNewInstance(value, propertyPathToItem, pathToSchemas) + properties[entryKey] = castValue + } + return FrozenMap(properties) + } + + @Throws(ValidationException::class) + override fun validate(arg: Map<*, *>, configuration: SchemaConfiguration?): FrozenMap { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg: Map<*, *> = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validationMetadata = + ValidationMetadata(pathToItem, usedConfiguration, PathToSchemasMap(), LinkedHashSet()) + val pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet) + return getNewInstance(castArg, validationMetadata.pathToItem, pathToSchemasMap) + } + + @Throws(ValidationException::class) + override fun validateAndBox( + arg: Map<*, *>, + configuration: SchemaConfiguration? + ): ObjectWithPropsSchemaBoxedMap { + return ObjectWithPropsSchemaBoxedMap(validate(arg, configuration)) + } + + override fun getNewInstance(arg: Any?, pathToItem: List, pathToSchemas: PathToSchemasMap): Any? { + if (arg is Map<*, *>) { + return getNewInstance(arg, pathToItem, pathToSchemas) + } + throw RuntimeException("Invalid input type=$javaClass. It can't be instantiated by this schema") + } + + @Throws(ValidationException::class) + override fun validate(arg: Any?, configuration: SchemaConfiguration?): Any? { + if (arg is Map<*, *>) { + return validate(arg, configuration) + } + throw ValidationException("Invalid input type=$javaClass. It can't be validated by this schema") + } + + @Throws(ValidationException::class) + override fun validateAndBox(arg: Any?, configuration: SchemaConfiguration?): ObjectWithPropsSchemaBoxed { + if (arg is Map<*, *>) { + return ObjectWithPropsSchemaBoxedMap( + validate(arg, configuration) + ) + } + throw ValidationException("Invalid input type=$javaClass. It can't be validated by this schema") + } + + companion object { + @Volatile + private var instance: ObjectWithPropsSchema? = null + + fun getInstance() = + instance ?: synchronized(this) { + instance ?: ObjectWithPropsSchema().also { instance = it } + } + } + } + + interface ObjectWithAddpropsSchemaBoxed + + data class ObjectWithAddpropsSchemaBoxedMap(val data: FrozenMap) : ObjectWithAddpropsSchemaBoxed {} + + class ObjectWithAddpropsSchema private constructor() : JsonSchema( + JsonSchemaInfo() + .type(setOf(Map::class.java)) + .additionalProperties(StringJsonSchema.StringJsonSchema1::class.java) + ), MapSchemaValidator, ObjectWithAddpropsSchemaBoxedMap> { + override fun getNewInstance( + arg: Map<*, *>, + pathToItem: List, + pathToSchemas: PathToSchemasMap + ): FrozenMap { + val properties = LinkedHashMap() + for ((entryKey, value1) in arg) { + if (entryKey !is String) { + throw RuntimeException("Invalid non-string key value") + } + val propertyPathToItem: MutableList = ArrayList(pathToItem) + propertyPathToItem.add(entryKey) + val value = value1!! + val schemas = pathToSchemas[propertyPathToItem] + ?: throw RuntimeException("Validation result is invalid, schemas must exist for a pathToItem") + val propertySchema = schemas.entries.iterator().next().key + val castValue = propertySchema.getNewInstance(value, propertyPathToItem, pathToSchemas) as? String + ?: throw RuntimeException("Invalid type for property value") + properties[entryKey] = castValue + } + return FrozenMap(properties) + } + + @Throws(ValidationException::class) + override fun validate(arg: Map<*, *>, configuration: SchemaConfiguration?): FrozenMap { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg: Map<*, *> = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validationMetadata = + ValidationMetadata(pathToItem, usedConfiguration, PathToSchemasMap(), LinkedHashSet()) + val pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet) + return getNewInstance(castArg, validationMetadata.pathToItem, pathToSchemasMap) + } + + @Throws(ValidationException::class) + override fun validateAndBox( + arg: Map<*, *>, + configuration: SchemaConfiguration? + ): ObjectWithAddpropsSchemaBoxedMap { + return ObjectWithAddpropsSchemaBoxedMap(validate(arg, configuration)) + } + + @Throws(ValidationException::class) + override fun validate(arg: Any?, configuration: SchemaConfiguration?): Any? { + if (arg is Map<*, *>) { + return validate(arg, configuration) + } + throw ValidationException("Invalid input type=$javaClass. It can't be validated by this schema") + } + + @Throws(ValidationException::class) + override fun validateAndBox(arg: Any?, configuration: SchemaConfiguration?): ObjectWithAddpropsSchemaBoxed { + if (arg is Map<*, *>) { + return ObjectWithAddpropsSchemaBoxedMap(validate(arg, configuration)) + } + throw ValidationException("Invalid input type=$javaClass. It can't be validated by this schema") + } + + override fun getNewInstance(arg: Any?, pathToItem: List, pathToSchemas: PathToSchemasMap): Any? { + if (arg is Map<*, *>) { + return getNewInstance(arg, pathToItem, pathToSchemas) + } + throw RuntimeException("Invalid input type=$javaClass. It can't be instantiated by this schema") + } + + companion object { + @Volatile + private var instance: ObjectWithAddpropsSchema? = null + + fun getInstance() = + instance ?: synchronized(this) { + instance ?: ObjectWithAddpropsSchema().also { instance = it } + } + } + } + + interface ObjectWithPropsAndAddpropsSchemaBoxed + + data class ObjectWithPropsAndAddpropsSchemaBoxedMap(val data: FrozenMap) : + ObjectWithPropsAndAddpropsSchemaBoxed { + } + + class ObjectWithPropsAndAddpropsSchema private constructor() : JsonSchema( + JsonSchemaInfo() + .type(setOf(Map::class.java)) + .properties( + mapOf( + "someString" to StringJsonSchema.StringJsonSchema1::class.java + ) + ) + .additionalProperties(BooleanJsonSchema.BooleanJsonSchema1::class.java) + ), MapSchemaValidator, ObjectWithPropsAndAddpropsSchemaBoxedMap> { + override fun getNewInstance( + arg: Map<*, *>, + pathToItem: List, + pathToSchemas: PathToSchemasMap + ): FrozenMap { + val properties = LinkedHashMap() + for ((entryKey, value1) in arg) { + if (entryKey !is String) { + throw RuntimeException("Invalid non-string key value") + } + val propertyPathToItem: MutableList = ArrayList(pathToItem) + propertyPathToItem.add(entryKey) + val value = value1!! + val schemas = pathToSchemas[propertyPathToItem] + ?: throw RuntimeException("Validation result is invalid, schemas must exist for a pathToItem") + val propertySchema = schemas.entries.iterator().next().key + val castValue = propertySchema.getNewInstance(value, propertyPathToItem, pathToSchemas) + properties[entryKey] = castValue + } + return FrozenMap(properties) + } + + @Throws(ValidationException::class) + override fun validate(arg: Map<*, *>, configuration: SchemaConfiguration?): FrozenMap { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg: Map<*, *> = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validationMetadata = + ValidationMetadata(pathToItem, usedConfiguration, PathToSchemasMap(), LinkedHashSet()) + val pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet) + return getNewInstance(castArg, validationMetadata.pathToItem, pathToSchemasMap) + } + + @Throws(ValidationException::class) + override fun validateAndBox( + arg: Map<*, *>, + configuration: SchemaConfiguration? + ): ObjectWithPropsAndAddpropsSchemaBoxedMap { + return ObjectWithPropsAndAddpropsSchemaBoxedMap(validate(arg, configuration)) + } + + @Throws(ValidationException::class) + override fun validate(arg: Any?, configuration: SchemaConfiguration?): Any? { + if (arg is Map<*, *>) { + return validate(arg, configuration) + } + throw ValidationException("Invalid input type=$javaClass. It can't be validated by this schema") + } + + @Throws(ValidationException::class) + override fun validateAndBox( + arg: Any?, + configuration: SchemaConfiguration? + ): ObjectWithPropsAndAddpropsSchemaBoxed { + if (arg is Map<*, *>) { + return ObjectWithPropsAndAddpropsSchemaBoxedMap(validate(arg, configuration)) + } + throw ValidationException("Invalid input type=$javaClass. It can't be validated by this schema") + } + + override fun getNewInstance(arg: Any?, pathToItem: List, pathToSchemas: PathToSchemasMap): Any? { + if (arg is Map<*, *>) { + return getNewInstance(arg, pathToItem, pathToSchemas) + } + throw RuntimeException("Invalid input type=$javaClass. It can't be instantiated by this schema") + } + + companion object { + @Volatile + private var instance: ObjectWithPropsAndAddpropsSchema? = null + + fun getInstance() = + instance ?: synchronized(this) { + instance ?: ObjectWithPropsAndAddpropsSchema().also { instance = it } + } + } + } + + class ObjectWithOutputTypeSchemaMap(m: FrozenMap) : FrozenMap(m) { + companion object { + @Throws(ValidationException::class) + fun of(arg: Map, configuration: SchemaConfiguration?): ObjectWithOutputTypeSchemaMap { + return ObjectWithOutputTypeSchema.getInstance().validate(arg, configuration) + } + } + } + + interface ObjectWithOutputTypeSchemaBoxed + + data class ObjectWithOutputTypeSchemaBoxedMap(val data: ObjectWithOutputTypeSchemaMap) : + ObjectWithOutputTypeSchemaBoxed { + } + + class ObjectWithOutputTypeSchema : JsonSchema( + JsonSchemaInfo() + .type(setOf(Map::class.java)) + .properties( + mapOf( + "someString" to StringJsonSchema.StringJsonSchema1::class.java + ) + ) + ), MapSchemaValidator { + override fun getNewInstance( + arg: Map<*, *>, + pathToItem: List, + pathToSchemas: PathToSchemasMap + ): ObjectWithOutputTypeSchemaMap { + val properties = LinkedHashMap() + for ((entryKey, value1) in arg) { + if (entryKey !is String) { + throw RuntimeException("Invalid non-string key value") + } + val propertyPathToItem: MutableList = ArrayList(pathToItem) + propertyPathToItem.add(entryKey) + val value = value1!! + val schemas = pathToSchemas[propertyPathToItem] + ?: throw RuntimeException("Validation result is invalid, schemas must exist for a pathToItem") + val propertySchema = schemas.entries.iterator().next().key + val castValue = propertySchema.getNewInstance(value, propertyPathToItem, pathToSchemas) + properties[entryKey] = castValue + } + return ObjectWithOutputTypeSchemaMap(FrozenMap(properties)) + } + + @Throws(ValidationException::class) + override fun validate(arg: Map<*, *>, configuration: SchemaConfiguration?): ObjectWithOutputTypeSchemaMap { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg: Map<*, *> = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validationMetadata = + ValidationMetadata(pathToItem, usedConfiguration, PathToSchemasMap(), LinkedHashSet()) + val pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet) + return getNewInstance(castArg, validationMetadata.pathToItem, pathToSchemasMap) + } + + @Throws(ValidationException::class) + override fun validateAndBox( + arg: Map<*, *>, + configuration: SchemaConfiguration? + ): ObjectWithOutputTypeSchemaBoxedMap { + return ObjectWithOutputTypeSchemaBoxedMap(validate(arg, configuration)) + } + + @Throws(ValidationException::class) + override fun validate(arg: Any?, configuration: SchemaConfiguration?): Any? { + if (arg is Map<*, *>) { + return validate(arg, configuration) + } + throw ValidationException("Invalid input type=$javaClass. It can't be validated by this schema") + } + + @Throws(ValidationException::class) + override fun validateAndBox(arg: Any?, configuration: SchemaConfiguration?): ObjectWithOutputTypeSchemaBoxed { + if (arg is Map<*, *>) { + return ObjectWithOutputTypeSchemaBoxedMap(validate(arg, configuration)) + } + throw ValidationException("Invalid input type=$javaClass. It can't be validated by this schema") + } + + override fun getNewInstance(arg: Any?, pathToItem: List, pathToSchemas: PathToSchemasMap): Any? { + if (arg is FrozenMap<*>) { + return getNewInstance(arg, pathToItem, pathToSchemas) + } + throw RuntimeException("Invalid input type=$javaClass. It can't be instantiated by this schema") + } + + companion object { + @Volatile + private var instance: ObjectWithOutputTypeSchema? = null + + fun getInstance() = + instance ?: synchronized(this) { + instance ?: ObjectWithOutputTypeSchema().also { instance = it } + } + } + } + + @Test + fun testExceptionThrownForInvalidType() { + val schema = ObjectWithPropsSchema.getInstance() + assertFailsWith( + block = { + JsonSchema.validate( + schema, + null, + validationMetadata + ) + } + ) + } + + @Test + @Throws(ValidationException::class) + fun testValidateObjectWithPropsSchema() { + val schema = ObjectWithPropsSchema.getInstance() + + // map with only property works + var inMap: Map = mapOf("someString" to "abc") + var validatedValue = schema.validate(inMap, configuration) + var outMap: Map = mapOf("someString" to "abc") + assertEquals(validatedValue, outMap) + + // map with additional unvalidated property works + inMap = mapOf( + "someString" to "abc", + "someOtherString" to "def" + ) + validatedValue = schema.validate(inMap, configuration) + val outMap1: Map = mapOf( + "someString" to "abc", + "someOtherString" to "def" + ) + assertEquals(validatedValue, outMap1) + + // invalid prop type fails + val invalidMap = mapOf("someString" to 1) + assertFailsWith( + block = { + schema.validate( + invalidMap, configuration + ) + } + ) + } + + @Test + @Throws(ValidationException::class) + fun testValidateObjectWithAddpropsSchema() { + val schema = ObjectWithAddpropsSchema.getInstance() + + // map with only property works + var inMap: MutableMap = LinkedHashMap() + inMap["someString"] = "abc" + var validatedValue = schema.validate(inMap, configuration) + var outMap: Map = mapOf("someString" to "abc") + assertEquals(validatedValue, outMap) + + // map with additional properties works + inMap = LinkedHashMap() + inMap["someString"] = "abc" + inMap["someOtherString"] = "def" + validatedValue = schema.validate(inMap, configuration) + outMap = mapOf( + "someString" to "abc", + "someOtherString" to "def" + ) + assertEquals(validatedValue, outMap) + + // invalid addProp type fails + val invalidInput = java.util.Map.of("someString", 1) + assertFailsWith( + block = { + JsonSchema.validate( + schema, + invalidInput, + validationMetadata + ) + } + ) + } + + @Test + @Throws(ValidationException::class) + fun testValidateObjectWithPropsAndAddpropsSchema() { + val schema = ObjectWithPropsAndAddpropsSchema.getInstance() + + // map with only property works + var inMap: Map = mapOf("someString" to "abc") + var validatedValue: Map = schema.validate(inMap, configuration) + var outMap: Map = mapOf("someString" to "abc") + assertEquals(validatedValue, outMap) + + // map with additional properties works + inMap = mapOf( + "someString" to "abc", + "someAddProp" to true + ) + validatedValue = schema.validate(inMap, configuration) + val outMap1: Map = mapOf( + "someString" to "abc", + "someAddProp" to true + ) + assertEquals(validatedValue, outMap1) + + // invalid prop type fails + inMap = mapOf("someString" to 1) + val invalidPropMap: Map = inMap + assertFailsWith( + block = { + schema.validate( + invalidPropMap, configuration + ) + } + ) + + // invalid addProp type fails + inMap = LinkedHashMap() + inMap["someAddProp"] = 1 + val invalidAddpropMap: Map = inMap + assertFailsWith( + block = { + schema.validate( + invalidAddpropMap, configuration + ) + } + ) + } + + @Test + @Throws(ValidationException::class) + fun testValidateObjectWithOutputTypeSchema() { + val schema = ObjectWithOutputTypeSchema.getInstance() + + // map with only property works + var inMap: Map = mapOf("someString" to "abc") + var validatedValue = schema.validate(inMap, configuration) + var outMap: Map = mapOf("someString" to "abc") + assertEquals(validatedValue, outMap) + + // map with additional unvalidated property works + inMap = mapOf( + "someString" to "abc", + "someOtherString" to "def", + ) + validatedValue = schema.validate(inMap, configuration) + val outMap1: Map = mapOf( + "someString" to "abc", + "someOtherString" to "def", + ) + assertEquals(validatedValue, outMap1) + + // invalid prop type fails + val invalidInMap = mapOf("someString" to 1) + assertFailsWith( + block = { + schema.validate( + invalidInMap, configuration + ) + } + ) + + // using output class directly works + inMap = mapOf("someString" to "abc") + validatedValue = ObjectWithOutputTypeSchemaMap.of(inMap, configuration) + val outMap2: Map = mapOf("someString" to "abc") + assertEquals(validatedValue, outMap2) + } + + companion object { + val configuration = SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validationMetadata = ValidationMetadata( + listOf("args[0"), + configuration, + PathToSchemasMap(), + LinkedHashSet() + ) + } +} \ No newline at end of file diff --git a/samples/client/3_0_3_unit_test/kotlin/src/test/kotlin/org/openapijsonschematools/client/schemas/RefBooleanSchemaTest.kt b/samples/client/3_0_3_unit_test/kotlin/src/test/kotlin/org/openapijsonschematools/client/schemas/RefBooleanSchemaTest.kt new file mode 100644 index 00000000000..651d570e7fb --- /dev/null +++ b/samples/client/3_0_3_unit_test/kotlin/src/test/kotlin/org/openapijsonschematools/client/schemas/RefBooleanSchemaTest.kt @@ -0,0 +1,67 @@ +package org.openapijsonschematools.client.schemas + +import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags +import org.openapijsonschematools.client.configurations.SchemaConfiguration +import org.openapijsonschematools.client.exceptions.ValidationException +import org.openapijsonschematools.client.schemas.validation.JsonSchema +import org.openapijsonschematools.client.schemas.validation.PathToSchemasMap +import org.openapijsonschematools.client.schemas.validation.ValidationMetadata +import org.openapijsonschematools.client.schemas.validation.JsonSchemaFactory + +import kotlin.test.Test +import kotlin.test.assertEquals +import kotlin.test.assertFailsWith + +class RefBooleanSchemaTest { + class RefBooleanSchema { + class RefBooleanSchema1 : BooleanJsonSchema.BooleanJsonSchema1() { + companion object { + @Volatile + private var instance: RefBooleanSchema1? = null + + fun getInstance() = + instance ?: synchronized(this) { + instance ?: RefBooleanSchema1().also { instance = it } + } + } + } + } + + @Test + @Throws(ValidationException::class) + fun testValidateTrue() { + val validatedValue = refBooleanJsonSchema.validate(true, configuration) + assertEquals(validatedValue, true) + } + + @Test + @Throws(ValidationException::class) + fun testValidateFalse() { + val validatedValue = refBooleanJsonSchema.validate(false, configuration) + assertEquals(validatedValue, false) + } + + @Test + fun testExceptionThrownForInvalidType() { + assertFailsWith( + block = { + JsonSchema.validate( + refBooleanJsonSchema, + null, + validationMetadata + ) + } + ) + } + + companion object { + val configuration = SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val refBooleanJsonSchema = JsonSchemaFactory.getInstance(RefBooleanSchema.RefBooleanSchema1::class.java) + val validationMetadata = ValidationMetadata( + listOf("args[0"), + configuration, + PathToSchemasMap(), + LinkedHashSet() + ) + } +} \ No newline at end of file diff --git a/samples/client/3_0_3_unit_test/kotlin/src/test/kotlin/org/openapijsonschematools/client/schemas/validation/AdditionalPropertiesValidatorTest.kt b/samples/client/3_0_3_unit_test/kotlin/src/test/kotlin/org/openapijsonschematools/client/schemas/validation/AdditionalPropertiesValidatorTest.kt new file mode 100644 index 00000000000..c0add8f2b58 --- /dev/null +++ b/samples/client/3_0_3_unit_test/kotlin/src/test/kotlin/org/openapijsonschematools/client/schemas/validation/AdditionalPropertiesValidatorTest.kt @@ -0,0 +1,140 @@ +package org.openapijsonschematools.client.schemas.validation + +import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags +import org.openapijsonschematools.client.configurations.SchemaConfiguration +import org.openapijsonschematools.client.schemas.MapJsonSchema +import org.openapijsonschematools.client.schemas.StringJsonSchema +import org.openapijsonschematools.client.exceptions.ValidationException + +import kotlin.test.Test +import kotlin.test.assertEquals +import kotlin.test.assertNull +import kotlin.test.assertFailsWith + + +class AdditionalPropertiesValidatorTest { + sealed interface ObjectWithPropsSchemaBoxed + class ObjectWithPropsSchemaBoxedMap : ObjectWithPropsSchemaBoxed + class ObjectWithPropsSchema private constructor() : JsonSchema( + JsonSchemaInfo() + .type(setOf(Map::class.java)) + .properties( + mapOf( + "someString" to StringJsonSchema.StringJsonSchema1::class.java + ) + ) + .additionalProperties(StringJsonSchema.StringJsonSchema1::class.java) + ) { + override fun getNewInstance(arg: Any?, pathToItem: List, pathToSchemas: PathToSchemasMap): Map<*, *> { + if (arg is Map<*, *>) { + return arg + } + throw RuntimeException("Invalid input type=$javaClass. It can't be instantiated by this schema") + } + + @Throws(ValidationException::class) + override fun validate(arg: Any?, configuration: SchemaConfiguration?): Map<*, *> { + if (arg is Map<*, *>) { + return arg + } + throw ValidationException("Invalid input type=$javaClass. It can't be validated by this schema") + } + + @Throws(ValidationException::class) + override fun validateAndBox(arg: Any?, configuration: SchemaConfiguration?): ObjectWithPropsSchemaBoxed { + return ObjectWithPropsSchemaBoxedMap() + } + + companion object { + @Volatile + private var instance: ObjectWithPropsSchema? = null + + fun getInstance() = + instance ?: synchronized(this) { + instance ?: ObjectWithPropsSchema().also { instance = it } + } + } + } + + @Test + @Throws(ValidationException::class) + fun testCorrectPropertySucceeds() { + val pathToItem = listOf("args[0]") + val validationMetadata = ValidationMetadata( + pathToItem, + SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()), + PathToSchemasMap(), + LinkedHashSet() + ) + val mutableMap = java.util.LinkedHashMap() + mutableMap["someString"] = "abc" + mutableMap["someAddProp"] = "def" + val arg = FrozenMap(mutableMap) + val validator = AdditionalPropertiesValidator() + val pathToSchemas = validator.validate( + ValidationData( + ObjectWithPropsSchema.getInstance(), + arg, + validationMetadata + ) + ) ?: throw RuntimeException("Invalid null value for pathToSchemas for this test case") + val expectedPathToItem: MutableList = ArrayList() + expectedPathToItem.add("args[0]") + expectedPathToItem.add("someAddProp") + + val expectedClasses: LinkedHashMap, Nothing?> = LinkedHashMap() + val schema = JsonSchemaFactory.getInstance(StringJsonSchema.StringJsonSchema1::class.java) + expectedClasses[schema] = null + val expectedPathToSchemas = PathToSchemasMap() + expectedPathToSchemas[expectedPathToItem] = expectedClasses + assertEquals(pathToSchemas, expectedPathToSchemas) + } + + @Test + @Throws(ValidationException::class) + fun testNotApplicableTypeReturnsNull() { + val pathToItem = listOf("args[0]") + val validationMetadata = ValidationMetadata( + pathToItem, + SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()), + PathToSchemasMap(), + LinkedHashSet() + ) + val validator = AdditionalPropertiesValidator() + val pathToSchemas = validator.validate( + ValidationData( + MapJsonSchema.MapJsonSchema1.getInstance(), + 1, + validationMetadata + ) + ) + assertNull(pathToSchemas) + } + + @Test + fun testIncorrectPropertyValueFails() { + val pathToItem = listOf("args[0]") + val validationMetadata = ValidationMetadata( + pathToItem, + SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()), + PathToSchemasMap(), + LinkedHashSet() + ) + val mutableMap = java.util.LinkedHashMap() + mutableMap["someString"] = "abc" + mutableMap["someAddProp"] = 1 + val arg = FrozenMap(mutableMap) + val validator = AdditionalPropertiesValidator() + assertFailsWith( + block = { + validator.validate( + ValidationData( + ObjectWithPropsSchema.getInstance(), + arg, + validationMetadata + ) + ) + } + ) + } +} \ No newline at end of file diff --git a/samples/client/3_0_3_unit_test/kotlin/src/test/kotlin/org/openapijsonschematools/client/schemas/validation/CustomIsoparserTest.kt b/samples/client/3_0_3_unit_test/kotlin/src/test/kotlin/org/openapijsonschematools/client/schemas/validation/CustomIsoparserTest.kt new file mode 100644 index 00000000000..89993c589f4 --- /dev/null +++ b/samples/client/3_0_3_unit_test/kotlin/src/test/kotlin/org/openapijsonschematools/client/schemas/validation/CustomIsoparserTest.kt @@ -0,0 +1,25 @@ +package org.openapijsonschematools.client.schemas.validation + +import java.time.LocalDate +import java.time.ZoneId +import java.time.ZonedDateTime + +import kotlin.test.Test +import kotlin.test.assertEquals + +class CustomIsoparserTest { + @Test + fun testParseIsodatetime() { + val dateTime: ZonedDateTime = CustomIsoparser.parseIsodatetime("2017-07-21T17:32:28Z") + val zone = ZoneId.of("Z") + val expectedDateTime = ZonedDateTime.of(2017, 7, 21, 17, 32, 28, 0, zone) + assertEquals(dateTime, expectedDateTime) + } + + @Test + fun testParseIsodate() { + val date: LocalDate = CustomIsoparser.parseIsodate("2017-07-21") + val expectedDate = LocalDate.of(2017, 7, 21) + assertEquals(date, expectedDate) + } +} \ No newline at end of file diff --git a/samples/client/3_0_3_unit_test/kotlin/src/test/kotlin/org/openapijsonschematools/client/schemas/validation/FormatValidatorTest.kt b/samples/client/3_0_3_unit_test/kotlin/src/test/kotlin/org/openapijsonschematools/client/schemas/validation/FormatValidatorTest.kt new file mode 100644 index 00000000000..be917b8337c --- /dev/null +++ b/samples/client/3_0_3_unit_test/kotlin/src/test/kotlin/org/openapijsonschematools/client/schemas/validation/FormatValidatorTest.kt @@ -0,0 +1,418 @@ +package org.openapijsonschematools.client.schemas.validation + +import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags +import org.openapijsonschematools.client.configurations.SchemaConfiguration +import org.openapijsonschematools.client.exceptions.ValidationException +import org.openapijsonschematools.client.schemas.IntJsonSchema +import org.openapijsonschematools.client.schemas.Int32JsonSchema +import org.openapijsonschematools.client.schemas.Int64JsonSchema +import org.openapijsonschematools.client.schemas.FloatJsonSchema +import org.openapijsonschematools.client.schemas.DoubleJsonSchema +import org.openapijsonschematools.client.schemas.DecimalJsonSchema +import org.openapijsonschematools.client.schemas.DateJsonSchema +import org.openapijsonschematools.client.schemas.DateTimeJsonSchema + +import java.math.BigDecimal +import java.math.BigInteger +import kotlin.test.Test +import kotlin.test.assertFailsWith +import kotlin.test.assertNull + +class FormatValidatorTest { + @Test + @Throws(ValidationException::class) + fun testIntFormatSucceedsWithFloat() { + val validator = FormatValidator() + val pathToSchemasMap = validator.validate( + ValidationData( + IntJsonSchema.IntJsonSchema1.getInstance(), + 1.0f, + validationMetadata + ) + ) + assertNull(pathToSchemasMap) + } + + @Test + fun testIntFormatFailsWithFloat() { + val validator = FormatValidator() + assertFailsWith( + block = { + validator.validate( + ValidationData( + IntJsonSchema.IntJsonSchema1.getInstance(), + 3.14f, + validationMetadata + ) + ) + } + ) + } + + @Test + @Throws(ValidationException::class) + fun testIntFormatSucceedsWithInt() { + val validator = FormatValidator() + val pathToSchemasMap = validator.validate( + ValidationData( + IntJsonSchema.IntJsonSchema1.getInstance(), + 1, + validationMetadata + ) + ) + assertNull(pathToSchemasMap) + } + + @Test + fun testInt32UnderMinFails() { + val validator = FormatValidator() + assertFailsWith( + block = { + validator.validate( + ValidationData( + Int32JsonSchema.Int32JsonSchema1.getInstance(), + -2147483649L, + validationMetadata + ) + ) + } + ) + } + + @Test + @Throws(ValidationException::class) + fun testInt32InclusiveMinSucceeds() { + val validator = FormatValidator() + val pathToSchemasMap = validator.validate( + ValidationData( + Int32JsonSchema.Int32JsonSchema1.getInstance(), + -2147483648, + validationMetadata + ) + ) + assertNull(pathToSchemasMap) + } + + @Test + @Throws(ValidationException::class) + fun testInt32InclusiveMaxSucceeds() { + val validator = FormatValidator() + val pathToSchemasMap = validator.validate( + ValidationData( + Int32JsonSchema.Int32JsonSchema1.getInstance(), + 2147483647, + validationMetadata + ) + ) + assertNull(pathToSchemasMap) + } + + @Test + fun testInt32OverMaxFails() { + val validator = FormatValidator() + assertFailsWith( + block = { + validator.validate( + ValidationData( + Int32JsonSchema.Int32JsonSchema1.getInstance(), + 2147483648L, + validationMetadata + ) + ) + } + ) + } + + @Test + fun testInt64UnderMinFails() { + val validator = FormatValidator() + assertFailsWith( + block = { + validator.validate( + ValidationData( + Int64JsonSchema.Int64JsonSchema1.getInstance(), + BigInteger("-9223372036854775809"), + validationMetadata + ) + ) + } + ) + } + + @Test + @Throws(ValidationException::class) + fun testInt64InclusiveMinSucceeds() { + val validator = FormatValidator() + val pathToSchemasMap = validator.validate( + ValidationData( + Int64JsonSchema.Int64JsonSchema1.getInstance(), + Long.MIN_VALUE, + validationMetadata + ) + ) + assertNull(pathToSchemasMap) + } + + @Test + @Throws(ValidationException::class) + fun testInt64InclusiveMaxSucceeds() { + val validator = FormatValidator() + val pathToSchemasMap = validator.validate( + ValidationData( + Int64JsonSchema.Int64JsonSchema1.getInstance(), + 9223372036854775807L, + validationMetadata + ) + ) + assertNull(pathToSchemasMap) + } + + @Test + fun testInt64OverMaxFails() { + val validator = FormatValidator() + assertFailsWith( + block = { + validator.validate( + ValidationData( + Int64JsonSchema.Int64JsonSchema1.getInstance(), + BigInteger("9223372036854775808"), + validationMetadata + ) + ) + } + ) + } + + @Test + fun testFloatUnderMinFails() { + val validator = FormatValidator() + assertFailsWith( + block = { + validator.validate( + ValidationData( + FloatJsonSchema.FloatJsonSchema1.getInstance(), + -3.402823466385289e+38, + validationMetadata + ) + ) + } + ) + } + + @Test + @Throws(ValidationException::class) + fun testFloatInclusiveMinSucceeds() { + val validator = FormatValidator() + val pathToSchemasMap = validator.validate( + ValidationData( + FloatJsonSchema.FloatJsonSchema1.getInstance(), + Float.MIN_VALUE, + validationMetadata + ) + ) + assertNull(pathToSchemasMap) + } + + @Test + @Throws(ValidationException::class) + fun testFloatInclusiveMaxSucceeds() { + val validator = FormatValidator() + val pathToSchemasMap = validator.validate( + ValidationData( + FloatJsonSchema.FloatJsonSchema1.getInstance(), + Float.MAX_VALUE, + validationMetadata + ) + ) + assertNull(pathToSchemasMap) + } + + @Test + fun testFloatOverMaxFails() { + val validator = FormatValidator() + assertFailsWith( + block = { + validator.validate( + ValidationData( + FloatJsonSchema.FloatJsonSchema1.getInstance(), + 3.402823466385289e+38, + validationMetadata + ) + ) + } + ) + } + + @Test + fun testDoubleUnderMinFails() { + val validator = FormatValidator() + assertFailsWith( + block = { + validator.validate( + ValidationData( + DoubleJsonSchema.DoubleJsonSchema1.getInstance(), + BigDecimal("-1.7976931348623157082e+308"), + validationMetadata + ) + ) + } + ) + } + + @Test + @Throws(ValidationException::class) + fun testDoubleInclusiveMinSucceeds() { + val validator = FormatValidator() + val pathToSchemasMap = validator.validate( + ValidationData( + DoubleJsonSchema.DoubleJsonSchema1.getInstance(), + -1.7976931348623157E+308, + validationMetadata + ) + ) + assertNull(pathToSchemasMap) + } + + @Test + @Throws(ValidationException::class) + fun testDoubleInclusiveMaxSucceeds() { + val validator = FormatValidator() + val pathToSchemasMap = validator.validate( + ValidationData( + DoubleJsonSchema.DoubleJsonSchema1.getInstance(), + 1.7976931348623157E+308, + validationMetadata + ) + ) + assertNull(pathToSchemasMap) + } + + @Test + fun testDoubleOverMaxFails() { + val validator = FormatValidator() + assertFailsWith( + block = { + validator.validate( + ValidationData( + DoubleJsonSchema.DoubleJsonSchema1.getInstance(), + BigDecimal("1.7976931348623157082e+308"), + validationMetadata + ) + ) + } + ) + } + + @Test + fun testInvalidNumberStringFails() { + val validator = FormatValidator() + assertFailsWith( + block = { + validator.validate( + ValidationData( + DecimalJsonSchema.DecimalJsonSchema1.getInstance(), + "abc", + validationMetadata + ) + ) + } + ) + } + + @Test + @Throws(ValidationException::class) + fun testValidFloatNumberStringSucceeds() { + val validator = FormatValidator() + val pathToSchemasMap = validator.validate( + ValidationData( + DecimalJsonSchema.DecimalJsonSchema1.getInstance(), + "3.14", + validationMetadata + ) + ) + assertNull(pathToSchemasMap) + } + + @Test + @Throws(ValidationException::class) + fun testValidIntNumberStringSucceeds() { + val validator = FormatValidator() + val pathToSchemasMap = validator.validate( + ValidationData( + DecimalJsonSchema.DecimalJsonSchema1.getInstance(), + "1", + validationMetadata + ) + ) + assertNull(pathToSchemasMap) + } + + @Test + fun testInvalidDateStringFails() { + val validator = FormatValidator() + assertFailsWith( + block = { + validator.validate( + ValidationData( + DateJsonSchema.DateJsonSchema1.getInstance(), + "abc", + validationMetadata + ) + ) + } + ) + } + + @Test + @Throws(ValidationException::class) + fun testValidDateStringSucceeds() { + val validator = FormatValidator() + val pathToSchemasMap = validator.validate( + ValidationData( + DateJsonSchema.DateJsonSchema1.getInstance(), + "2017-01-20", + validationMetadata + ) + ) + assertNull(pathToSchemasMap) + } + + @Test + fun testInvalidDateTimeStringFails() { + val validator = FormatValidator() + assertFailsWith( + block = { + validator.validate( + ValidationData( + DateTimeJsonSchema.DateTimeJsonSchema1.getInstance(), + "abc", + validationMetadata + ) + ) + } + ) + } + + @Test + @Throws(ValidationException::class) + fun testValidDateTimeStringSucceeds() { + val validator = FormatValidator() + val pathToSchemasMap = validator.validate( + ValidationData( + DateTimeJsonSchema.DateTimeJsonSchema1.getInstance(), + "2017-07-21T17:32:28Z", + validationMetadata + ) + ) + assertNull(pathToSchemasMap) + } + + companion object { + val validationMetadata = ValidationMetadata( + ArrayList(), + SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()), + PathToSchemasMap(), + LinkedHashSet() + ) + } +} \ No newline at end of file diff --git a/samples/client/3_0_3_unit_test/kotlin/src/test/kotlin/org/openapijsonschematools/client/schemas/validation/ItemsValidatorTest.kt b/samples/client/3_0_3_unit_test/kotlin/src/test/kotlin/org/openapijsonschematools/client/schemas/validation/ItemsValidatorTest.kt new file mode 100644 index 00000000000..a6fd41ebbd8 --- /dev/null +++ b/samples/client/3_0_3_unit_test/kotlin/src/test/kotlin/org/openapijsonschematools/client/schemas/validation/ItemsValidatorTest.kt @@ -0,0 +1,120 @@ +package org.openapijsonschematools.client.schemas.validation + +import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags +import org.openapijsonschematools.client.configurations.SchemaConfiguration +import org.openapijsonschematools.client.schemas.StringJsonSchema +import org.openapijsonschematools.client.exceptions.ValidationException + +import kotlin.test.Test +import kotlin.test.assertEquals +import kotlin.test.assertFailsWith +import kotlin.test.assertNull + +class ItemsValidatorTest { + interface ArrayWithItemsSchemaBoxed + class ArrayWithItemsSchemaBoxedList : ArrayWithItemsSchemaBoxed + class ArrayWithItemsSchema : JsonSchema( + JsonSchemaInfo() + .type(setOf(List::class.java)) + .items(StringJsonSchema.StringJsonSchema1::class.java) + ) { + override fun getNewInstance(arg: Any?, pathToItem: List, pathToSchemas: PathToSchemasMap): Any? { + if (arg is List<*>) { + return getNewInstance(arg, pathToItem, pathToSchemas) + } + throw RuntimeException("Invalid input type=$javaClass. It can't be instantiated by this schema") + } + + @Throws(ValidationException::class) + override fun validate(arg: Any?, configuration: SchemaConfiguration?): Any? { + if (arg is List<*>) { + return validate(arg, configuration) + } + throw ValidationException("Invalid input type=$javaClass. It can't be validated by this schema") + } + + @Throws(ValidationException::class) + override fun validateAndBox(arg: Any?, configuration: SchemaConfiguration?): ArrayWithItemsSchemaBoxed { + return ArrayWithItemsSchemaBoxedList() + } + } + + @Test + @Throws(ValidationException::class) + fun testCorrectItemsSucceeds() { + val pathToItem = listOf("args[0]") + val validationMetadata = ValidationMetadata( + pathToItem, + SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()), + PathToSchemasMap(), + LinkedHashSet() + ) + val mutableList: MutableList = ArrayList() + mutableList.add("a") + val arg = FrozenList(mutableList) + val validator = ItemsValidator() + val pathToSchemas = validator.validate( + ValidationData( + ArrayWithItemsSchema(), + arg, + validationMetadata + ) + ) ?: throw RuntimeException("Invalid null value in pathToSchemas for this test case") + val expectedPathToItem: MutableList = ArrayList() + expectedPathToItem.add("args[0]") + expectedPathToItem.add(0) + val expectedClasses = LinkedHashMap, Nothing?>() + val schema = JsonSchemaFactory.getInstance(StringJsonSchema.StringJsonSchema1::class.java) + expectedClasses[schema] = null + val expectedPathToSchemas = PathToSchemasMap() + expectedPathToSchemas[expectedPathToItem] = expectedClasses + assertEquals(pathToSchemas, expectedPathToSchemas) + } + + @Test + @Throws(ValidationException::class) + fun testNotApplicableTypeReturnsNull() { + val pathToItem = listOf("args[0]") + val validationMetadata = ValidationMetadata( + pathToItem, + SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()), + PathToSchemasMap(), + LinkedHashSet() + ) + val validator = ItemsValidator() + val pathToSchemas = validator.validate( + ValidationData( + ArrayWithItemsSchema(), + 1, + validationMetadata + ) + ) + assertNull(pathToSchemas) + } + + @Test + fun testIncorrectItemFails() { + val pathToItem = listOf("args[0]") + val validationMetadata = ValidationMetadata( + pathToItem, + SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()), + PathToSchemasMap(), + LinkedHashSet() + ) + val mutableList: MutableList = ArrayList() + mutableList.add(1) + val arg = FrozenList(mutableList) + val validator = ItemsValidator() + assertFailsWith( + block = { + validator.validate( + ValidationData( + ArrayWithItemsSchema(), + arg, + validationMetadata + ) + ) + } + ) + } +} \ No newline at end of file diff --git a/samples/client/3_0_3_unit_test/kotlin/src/test/kotlin/org/openapijsonschematools/client/schemas/validation/JsonSchemaTest.kt b/samples/client/3_0_3_unit_test/kotlin/src/test/kotlin/org/openapijsonschematools/client/schemas/validation/JsonSchemaTest.kt new file mode 100644 index 00000000000..bad1daff26c --- /dev/null +++ b/samples/client/3_0_3_unit_test/kotlin/src/test/kotlin/org/openapijsonschematools/client/schemas/validation/JsonSchemaTest.kt @@ -0,0 +1,71 @@ +package org.openapijsonschematools.client.schemas.validation + +import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags +import org.openapijsonschematools.client.configurations.SchemaConfiguration +import org.openapijsonschematools.client.exceptions.ValidationException + +import kotlin.test.Test +import kotlin.test.assertEquals + +class JsonSchemaTest { + internal sealed interface SomeSchemaBoxed + internal class SomeSchemaBoxedString : SomeSchemaBoxed + internal class SomeSchema private constructor() : JsonSchema( + JsonSchemaInfo() + .type(setOf(String::class.java)) + ) { + override fun getNewInstance(arg: Any?, pathToItem: List, pathToSchemas: PathToSchemasMap): Any? { + if (arg is String) { + return arg + } + throw RuntimeException("Invalid input type=$javaClass. It can't be instantiated by this schema") + } + + @Throws(ValidationException::class) + override fun validate(arg: Any?, configuration: SchemaConfiguration?): Any? { + if (arg is String) { + return arg + } + throw ValidationException("Invalid input type=$javaClass. It can't be validated by this schema") + } + + @Throws(ValidationException::class) + override fun validateAndBox(arg: Any?, configuration: SchemaConfiguration?): SomeSchemaBoxed { + return SomeSchemaBoxedString() + } + + companion object { + var instance: SomeSchema? = null + get() { + if (field == null) { + field = SomeSchema() + } + return field + } + private set + } + } + + @Test + @Throws(ValidationException::class) + fun testValidateSucceeds() { + val pathToItem = listOf("args[0]") + val validationMetadata = ValidationMetadata( + pathToItem, + SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()), + PathToSchemasMap(), + LinkedHashSet() + ) + val schema = JsonSchemaFactory.getInstance(SomeSchema::class.java) + val pathToSchemas = JsonSchema.validate( + schema, + "hi", + validationMetadata + ) + val expectedPathToSchemas = PathToSchemasMap() + val validatedClasses = LinkedHashMap, Nothing?>() + validatedClasses[schema] = null + expectedPathToSchemas[pathToItem] = validatedClasses + assertEquals(pathToSchemas, expectedPathToSchemas) + } +} \ No newline at end of file diff --git a/samples/client/3_0_3_unit_test/kotlin/src/test/kotlin/org/openapijsonschematools/client/schemas/validation/PropertiesValidatorTest.kt b/samples/client/3_0_3_unit_test/kotlin/src/test/kotlin/org/openapijsonschematools/client/schemas/validation/PropertiesValidatorTest.kt new file mode 100644 index 00000000000..086c96448e6 --- /dev/null +++ b/samples/client/3_0_3_unit_test/kotlin/src/test/kotlin/org/openapijsonschematools/client/schemas/validation/PropertiesValidatorTest.kt @@ -0,0 +1,123 @@ +package org.openapijsonschematools.client.schemas.validation + +import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags +import org.openapijsonschematools.client.configurations.SchemaConfiguration +import org.openapijsonschematools.client.exceptions.ValidationException +import org.openapijsonschematools.client.schemas.StringJsonSchema + +import kotlin.test.Test +import kotlin.test.assertEquals +import kotlin.test.assertNull +import kotlin.test.assertFailsWith + +class PropertiesValidatorTest { + interface ObjectWithPropsSchemaBoxed + class ObjectWithPropsSchemaBoxedMap : ObjectWithPropsSchemaBoxed + class ObjectWithPropsSchema : JsonSchema( + JsonSchemaInfo() + .type(setOf(MutableMap::class.java)) + .properties( + mapOf( + "someString" to StringJsonSchema.StringJsonSchema1::class.java + ) + ) + ) { + override fun getNewInstance(arg: Any?, pathToItem: List, pathToSchemas: PathToSchemasMap): Any? { + if (arg is Map<*, *>) { + return getNewInstance(arg, pathToItem, pathToSchemas) + } + throw RuntimeException("Invalid input type=$javaClass. It can't be instantiated by this schema") + } + + @Throws(ValidationException::class) + override fun validate(arg: Any?, configuration: SchemaConfiguration?): Any? { + if (arg is Map<*, *>) { + return validate(arg, configuration) + } + throw ValidationException("Invalid input type=$javaClass. It can't be validated by this schema") + } + + @Throws(ValidationException::class) + override fun validateAndBox(arg: Any?, configuration: SchemaConfiguration?): ObjectWithPropsSchemaBoxed { + return ObjectWithPropsSchemaBoxedMap() + } + } + + @Test + @Throws(ValidationException::class) + fun testCorrectPropertySucceeds() { + val validator = PropertiesValidator() + val pathToItem = listOf("args[0]") + val validationMetadata = ValidationMetadata( + pathToItem, + SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()), + PathToSchemasMap(), + LinkedHashSet() + ) + val mutableMap = LinkedHashMap() + mutableMap["someString"] = "abc" + val arg = FrozenMap(mutableMap) + val pathToSchemas = validator.validate( + ValidationData( + ObjectWithPropsSchema(), + arg, + validationMetadata + ) + ) ?: throw RuntimeException("Invalid null value for pathToSchemas for this test case") + val expectedPathToItem: MutableList = ArrayList() + expectedPathToItem.add("args[0]") + expectedPathToItem.add("someString") + val expectedClasses = LinkedHashMap, Nothing?>() + expectedClasses[JsonSchemaFactory.getInstance(StringJsonSchema.StringJsonSchema1::class.java)] = null + val expectedPathToSchemas = PathToSchemasMap() + expectedPathToSchemas[expectedPathToItem] = expectedClasses + assertEquals(pathToSchemas, expectedPathToSchemas) + } + + @Test + @Throws(ValidationException::class) + fun testNotApplicableTypeReturnsNull() { + val validator = PropertiesValidator() + val pathToItem = listOf("args[0]") + val validationMetadata = ValidationMetadata( + pathToItem, + SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()), + PathToSchemasMap(), + LinkedHashSet() + ) + val pathToSchemas = validator.validate( + ValidationData( + ObjectWithPropsSchema(), + 1, + validationMetadata + ) + ) + assertNull(pathToSchemas) + } + + @Test + fun testIncorrectPropertyValueFails() { + val validator = PropertiesValidator() + val pathToItem = listOf("args[0]") + val validationMetadata = ValidationMetadata( + pathToItem, + SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()), + PathToSchemasMap(), + LinkedHashSet() + ) + val mutableMap = LinkedHashMap() + mutableMap["someString"] = 1 + val arg = FrozenMap(mutableMap) + assertFailsWith( + block = { + validator.validate( + ValidationData( + ObjectWithPropsSchema(), + arg, + validationMetadata + ) + ) + } + ) + } +} \ No newline at end of file diff --git a/samples/client/3_0_3_unit_test/kotlin/src/test/kotlin/org/openapijsonschematools/client/schemas/validation/RequiredValidatorTest.kt b/samples/client/3_0_3_unit_test/kotlin/src/test/kotlin/org/openapijsonschematools/client/schemas/validation/RequiredValidatorTest.kt new file mode 100644 index 00000000000..ba7af366540 --- /dev/null +++ b/samples/client/3_0_3_unit_test/kotlin/src/test/kotlin/org/openapijsonschematools/client/schemas/validation/RequiredValidatorTest.kt @@ -0,0 +1,110 @@ +package org.openapijsonschematools.client.schemas.validation + +import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags +import org.openapijsonschematools.client.configurations.SchemaConfiguration +import org.openapijsonschematools.client.exceptions.ValidationException + +import kotlin.test.Test +import kotlin.test.assertFailsWith +import kotlin.test.assertNull + +class RequiredValidatorTest { + interface ObjectWithRequiredSchemaBoxed + class ObjectWithRequiredSchemaBoxedMap : ObjectWithRequiredSchemaBoxed + class ObjectWithRequiredSchema : JsonSchema( + JsonSchemaInfo() + .type(setOf(Map::class.java)) + .required(setOf("someString")) + ) { + override fun getNewInstance(arg: Any?, pathToItem: List, pathToSchemas: PathToSchemasMap): Any? { + if (arg is Map<*, *>) { + return getNewInstance(arg, pathToItem, pathToSchemas) + } + throw RuntimeException("Invalid input type=$javaClass. It can't be instantiated by this schema") + } + + @Throws(ValidationException::class) + override fun validate(arg: Any?, configuration: SchemaConfiguration?): Any? { + if (arg is Map<*, *>) { + return validate(arg, configuration) + } + throw ValidationException("Invalid input type=$javaClass. It can't be validated by this schema") + } + + @Throws(ValidationException::class) + override fun validateAndBox(arg: Any?, configuration: SchemaConfiguration?): ObjectWithRequiredSchemaBoxed { + return ObjectWithRequiredSchemaBoxedMap() + } + } + + @Test + @Throws(ValidationException::class) + fun testCorrectPropertySucceeds() { + val pathToItem = listOf("args[0]") + val validationMetadata = ValidationMetadata( + pathToItem, + SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()), + PathToSchemasMap(), + LinkedHashSet() + ) + val mutableMap = LinkedHashMap() + mutableMap["someString"] = "abc" + val arg = FrozenMap(mutableMap) + val validator = RequiredValidator() + val pathToSchemas = validator.validate( + ValidationData( + ObjectWithRequiredSchema(), + arg, + validationMetadata + ) + ) + assertNull(pathToSchemas) + } + + @Test + @Throws(ValidationException::class) + fun testNotApplicableTypeReturnsNull() { + val pathToItem = listOf("args[0]") + val validationMetadata = ValidationMetadata( + pathToItem, + SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()), + PathToSchemasMap(), + LinkedHashSet() + ) + val validator = RequiredValidator() + val pathToSchemas = validator.validate( + ValidationData( + ObjectWithRequiredSchema(), + 1, + validationMetadata + ) + ) + assertNull(pathToSchemas) + } + + @Test + fun testIncorrectPropertyFails() { + val pathToItem = listOf("args[0]") + val validationMetadata = ValidationMetadata( + pathToItem, + SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()), + PathToSchemasMap(), + LinkedHashSet() + ) + val mutableMap = LinkedHashMap() + mutableMap["aDifferentProp"] = 1 + val arg = FrozenMap(mutableMap) + val validator = RequiredValidator() + assertFailsWith( + block = { + validator.validate( + ValidationData( + ObjectWithRequiredSchema(), + arg, + validationMetadata + ) + ) + } + ) + } +} \ No newline at end of file diff --git a/samples/client/3_0_3_unit_test/kotlin/src/test/kotlin/org/openapijsonschematools/client/schemas/validation/TypeValidatorTest.kt b/samples/client/3_0_3_unit_test/kotlin/src/test/kotlin/org/openapijsonschematools/client/schemas/validation/TypeValidatorTest.kt new file mode 100644 index 00000000000..c8049c76683 --- /dev/null +++ b/samples/client/3_0_3_unit_test/kotlin/src/test/kotlin/org/openapijsonschematools/client/schemas/validation/TypeValidatorTest.kt @@ -0,0 +1,54 @@ +package org.openapijsonschematools.client.schemas.validation + +import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags +import org.openapijsonschematools.client.configurations.SchemaConfiguration +import org.openapijsonschematools.client.exceptions.ValidationException +import org.openapijsonschematools.client.schemas.StringJsonSchema + +import kotlin.test.Test +import kotlin.test.assertFailsWith +import kotlin.test.assertNull + +class TypeValidatorTest { + @Test + @Throws(ValidationException::class) + fun testValidateSucceeds() { + val validator = TypeValidator() + val validationMetadata = ValidationMetadata( + ArrayList(), + SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()), + PathToSchemasMap(), + LinkedHashSet() + ) + val pathToSchemasMap = validator.validate( + ValidationData( + StringJsonSchema.StringJsonSchema1.getInstance(), + "hi", + validationMetadata + ) + ) + assertNull(pathToSchemasMap) + } + + @Test + fun testValidateFailsIntIsNotString() { + val validator = TypeValidator() + val validationMetadata = ValidationMetadata( + ArrayList(), + SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()), + PathToSchemasMap(), + LinkedHashSet() + ) + assertFailsWith( + block = { + validator.validate( + ValidationData( + StringJsonSchema.StringJsonSchema1.getInstance(), + 1, + validationMetadata + ) + ) + } + ) + } +} \ No newline at end of file diff --git a/samples/client/petstore/kotlin/.openapi-generator/FILES b/samples/client/petstore/kotlin/.openapi-generator/FILES deleted file mode 100644 index d5b741b2d06..00000000000 --- a/samples/client/petstore/kotlin/.openapi-generator/FILES +++ /dev/null @@ -1,2000 +0,0 @@ -.gitignore -.openapi-generator-ignore -README.md -build.gradle.kts -docs/RootServerInfo.md -docs/apis/paths/Anotherfakedummy.md -docs/apis/paths/Commonparamsubdir.md -docs/apis/paths/Fake.md -docs/apis/paths/Fakeadditionalpropertieswitharrayofenums.md -docs/apis/paths/Fakebodywithfileschema.md -docs/apis/paths/Fakebodywithqueryparams.md -docs/apis/paths/Fakecasesensitiveparams.md -docs/apis/paths/Fakeclassnametest.md -docs/apis/paths/Fakedeletecoffeeid.md -docs/apis/paths/Fakehealth.md -docs/apis/paths/Fakeinlineadditionalproperties.md -docs/apis/paths/Fakeinlinecomposition.md -docs/apis/paths/Fakejsonformdata.md -docs/apis/paths/Fakejsonpatch.md -docs/apis/paths/Fakejsonwithcharset.md -docs/apis/paths/Fakemultiplerequestbodycontenttypes.md -docs/apis/paths/Fakemultipleresponsebodies.md -docs/apis/paths/Fakemultiplesecurities.md -docs/apis/paths/Fakeobjinquery.md -docs/apis/paths/Fakeparametercollisions1ababselfab.md -docs/apis/paths/Fakepemcontenttype.md -docs/apis/paths/Fakepetiduploadimagewithrequiredfile.md -docs/apis/paths/Fakequeryparamwithjsoncontenttype.md -docs/apis/paths/Fakeredirection.md -docs/apis/paths/Fakerefobjinquery.md -docs/apis/paths/Fakerefsarraymodel.md -docs/apis/paths/Fakerefsarrayofenums.md -docs/apis/paths/Fakerefsboolean.md -docs/apis/paths/Fakerefscomposedoneofnumberwithvalidations.md -docs/apis/paths/Fakerefsenum.md -docs/apis/paths/Fakerefsmammal.md -docs/apis/paths/Fakerefsnumber.md -docs/apis/paths/Fakerefsobjectmodelwithrefprops.md -docs/apis/paths/Fakerefsstring.md -docs/apis/paths/Fakeresponsewithoutschema.md -docs/apis/paths/Faketestqueryparamters.md -docs/apis/paths/Fakeuploaddownloadfile.md -docs/apis/paths/Fakeuploadfile.md -docs/apis/paths/Fakeuploadfiles.md -docs/apis/paths/Fakewildcardresponses.md -docs/apis/paths/Foo.md -docs/apis/paths/Pet.md -docs/apis/paths/Petfindbystatus.md -docs/apis/paths/Petfindbytags.md -docs/apis/paths/Petpetid.md -docs/apis/paths/Petpetiduploadimage.md -docs/apis/paths/Solidus.md -docs/apis/paths/Storeinventory.md -docs/apis/paths/Storeorder.md -docs/apis/paths/Storeorderorderid.md -docs/apis/paths/User.md -docs/apis/paths/Usercreatewitharray.md -docs/apis/paths/Usercreatewithlist.md -docs/apis/paths/Userlogin.md -docs/apis/paths/Userlogout.md -docs/apis/paths/Userusername.md -docs/apis/tags/Anotherfake.md -docs/apis/tags/Default.md -docs/apis/tags/Fake.md -docs/apis/tags/Fakeclassnametags123.md -docs/apis/tags/Pet.md -docs/apis/tags/Store.md -docs/apis/tags/User.md -docs/components/headers/Int32JsonContentTypeHeader.md -docs/components/headers/NumberHeader.md -docs/components/headers/RefContentSchemaHeader.md -docs/components/headers/RefSchemaHeader.md -docs/components/headers/RefStringHeader.md -docs/components/headers/StringHeader.md -docs/components/headers/int32jsoncontenttypeheader/content/applicationjson/Int32JsonContentTypeHeaderSchema.md -docs/components/headers/numberheader/NumberHeaderSchema.md -docs/components/headers/refcontentschemaheader/content/applicationjson/RefContentSchemaHeaderSchema.md -docs/components/headers/refschemaheader/RefSchemaHeaderSchema.md -docs/components/headers/stringheader/StringHeaderSchema.md -docs/components/parameters/ComponentRefSchemaStringWithValidation.md -docs/components/parameters/PathUserName.md -docs/components/parameters/RefPathUserName.md -docs/components/parameters/RefSchemaStringWithValidation.md -docs/components/parameters/componentrefschemastringwithvalidation/content/applicationjson/ApplicationjsonSchema.md -docs/components/parameters/pathusername/Schema.md -docs/components/parameters/refschemastringwithvalidation/Schema.md -docs/components/requestbodies/Client.md -docs/components/requestbodies/Pet.md -docs/components/requestbodies/RefUserArray.md -docs/components/requestbodies/UserArray.md -docs/components/requestbodies/client/content/applicationjson/ApplicationjsonSchema.md -docs/components/requestbodies/pet/content/applicationjson/ApplicationjsonSchema.md -docs/components/requestbodies/pet/content/applicationxml/ApplicationxmlSchema.md -docs/components/requestbodies/userarray/content/applicationjson/ApplicationjsonSchema.md -docs/components/responses/HeadersWithNoBody.md -docs/components/responses/RefSuccessDescriptionOnly.md -docs/components/responses/RefSuccessfulXmlAndJsonArrayOfPet.md -docs/components/responses/SuccessDescriptionOnly.md -docs/components/responses/SuccessInlineContentAndHeader.md -docs/components/responses/SuccessWithJsonApiResponse.md -docs/components/responses/SuccessfulXmlAndJsonArrayOfPet.md -docs/components/responses/headerswithnobody/HeadersWithNoBodyHeadersSchema.md -docs/components/responses/headerswithnobody/headers/location/LocationSchema.md -docs/components/responses/successfulxmlandjsonarrayofpet/content/applicationjson/ApplicationjsonSchema.md -docs/components/responses/successfulxmlandjsonarrayofpet/content/applicationxml/ApplicationxmlSchema.md -docs/components/responses/successinlinecontentandheader/SuccessInlineContentAndHeaderHeadersSchema.md -docs/components/responses/successinlinecontentandheader/content/applicationjson/ApplicationjsonSchema.md -docs/components/responses/successinlinecontentandheader/headers/someheader/SomeHeaderSchema.md -docs/components/responses/successwithjsonapiresponse/SuccessWithJsonApiResponseHeadersSchema.md -docs/components/responses/successwithjsonapiresponse/content/applicationjson/ApplicationjsonSchema.md -docs/components/schemas/AbstractStepMessage.md -docs/components/schemas/AdditionalPropertiesClass.md -docs/components/schemas/AdditionalPropertiesSchema.md -docs/components/schemas/AdditionalPropertiesWithArrayOfEnums.md -docs/components/schemas/Address.md -docs/components/schemas/Animal.md -docs/components/schemas/AnimalFarm.md -docs/components/schemas/AnyTypeAndFormat.md -docs/components/schemas/AnyTypeNotString.md -docs/components/schemas/ApiResponseSchema.md -docs/components/schemas/Apple.md -docs/components/schemas/AppleReq.md -docs/components/schemas/ArrayHoldingAnyType.md -docs/components/schemas/ArrayOfArrayOfNumberOnly.md -docs/components/schemas/ArrayOfEnums.md -docs/components/schemas/ArrayOfNumberOnly.md -docs/components/schemas/ArrayTest.md -docs/components/schemas/ArrayWithValidationsInItems.md -docs/components/schemas/Banana.md -docs/components/schemas/BananaReq.md -docs/components/schemas/Bar.md -docs/components/schemas/BasquePig.md -docs/components/schemas/BooleanEnum.md -docs/components/schemas/BooleanSchema.md -docs/components/schemas/Capitalization.md -docs/components/schemas/Cat.md -docs/components/schemas/Category.md -docs/components/schemas/ChildCat.md -docs/components/schemas/ClassModel.md -docs/components/schemas/Client.md -docs/components/schemas/ComplexQuadrilateral.md -docs/components/schemas/ComposedAnyOfDifferentTypesNoValidations.md -docs/components/schemas/ComposedArray.md -docs/components/schemas/ComposedBool.md -docs/components/schemas/ComposedNone.md -docs/components/schemas/ComposedNumber.md -docs/components/schemas/ComposedObject.md -docs/components/schemas/ComposedOneOfDifferentTypes.md -docs/components/schemas/ComposedString.md -docs/components/schemas/Currency.md -docs/components/schemas/DanishPig.md -docs/components/schemas/DateTimeTest.md -docs/components/schemas/DateTimeWithValidations.md -docs/components/schemas/DateWithValidations.md -docs/components/schemas/DecimalPayload.md -docs/components/schemas/Dog.md -docs/components/schemas/Drawing.md -docs/components/schemas/EnumArrays.md -docs/components/schemas/EnumClass.md -docs/components/schemas/EnumTest.md -docs/components/schemas/EquilateralTriangle.md -docs/components/schemas/File.md -docs/components/schemas/FileSchemaTestClass.md -docs/components/schemas/Foo.md -docs/components/schemas/FormatTest.md -docs/components/schemas/FromSchema.md -docs/components/schemas/Fruit.md -docs/components/schemas/FruitReq.md -docs/components/schemas/GmFruit.md -docs/components/schemas/GrandparentAnimal.md -docs/components/schemas/HasOnlyReadOnly.md -docs/components/schemas/HealthCheckResult.md -docs/components/schemas/IntegerEnum.md -docs/components/schemas/IntegerEnumBig.md -docs/components/schemas/IntegerEnumOneValue.md -docs/components/schemas/IntegerEnumWithDefaultValue.md -docs/components/schemas/IntegerMax10.md -docs/components/schemas/IntegerMin15.md -docs/components/schemas/IsoscelesTriangle.md -docs/components/schemas/Items.md -docs/components/schemas/ItemsSchema.md -docs/components/schemas/JSONPatchRequest.md -docs/components/schemas/JSONPatchRequestAddReplaceTest.md -docs/components/schemas/JSONPatchRequestMoveCopy.md -docs/components/schemas/JSONPatchRequestRemove.md -docs/components/schemas/Mammal.md -docs/components/schemas/MapTest.md -docs/components/schemas/MixedPropertiesAndAdditionalPropertiesClass.md -docs/components/schemas/Money.md -docs/components/schemas/MultiPropertiesSchema.md -docs/components/schemas/MyObjectDto.md -docs/components/schemas/Name.md -docs/components/schemas/NoAdditionalProperties.md -docs/components/schemas/NullableClass.md -docs/components/schemas/NullableShape.md -docs/components/schemas/NullableString.md -docs/components/schemas/NumberOnly.md -docs/components/schemas/NumberSchema.md -docs/components/schemas/NumberWithExclusiveMinMax.md -docs/components/schemas/NumberWithValidations.md -docs/components/schemas/ObjWithRequiredProps.md -docs/components/schemas/ObjWithRequiredPropsBase.md -docs/components/schemas/ObjectInterface.md -docs/components/schemas/ObjectModelWithArgAndArgsProperties.md -docs/components/schemas/ObjectModelWithRefProps.md -docs/components/schemas/ObjectWithAllOfWithReqTestPropFromUnsetAddProp.md -docs/components/schemas/ObjectWithCollidingProperties.md -docs/components/schemas/ObjectWithDecimalProperties.md -docs/components/schemas/ObjectWithDifficultlyNamedProps.md -docs/components/schemas/ObjectWithInlineCompositionProperty.md -docs/components/schemas/ObjectWithInvalidNamedRefedProperties.md -docs/components/schemas/ObjectWithNonIntersectingValues.md -docs/components/schemas/ObjectWithOnlyOptionalProps.md -docs/components/schemas/ObjectWithOptionalTestProp.md -docs/components/schemas/ObjectWithValidations.md -docs/components/schemas/Order.md -docs/components/schemas/PaginatedResultMyObjectDto.md -docs/components/schemas/ParentPet.md -docs/components/schemas/Pet.md -docs/components/schemas/Pig.md -docs/components/schemas/Player.md -docs/components/schemas/PublicKey.md -docs/components/schemas/Quadrilateral.md -docs/components/schemas/QuadrilateralInterface.md -docs/components/schemas/ReadOnlyFirst.md -docs/components/schemas/RefPet.md -docs/components/schemas/ReqPropsFromExplicitAddProps.md -docs/components/schemas/ReqPropsFromTrueAddProps.md -docs/components/schemas/ReqPropsFromUnsetAddProps.md -docs/components/schemas/ReturnSchema.md -docs/components/schemas/ScaleneTriangle.md -docs/components/schemas/Schema200Response.md -docs/components/schemas/SelfReferencingArrayModel.md -docs/components/schemas/SelfReferencingObjectModel.md -docs/components/schemas/Shape.md -docs/components/schemas/ShapeOrNull.md -docs/components/schemas/SimpleQuadrilateral.md -docs/components/schemas/SomeObject.md -docs/components/schemas/SpecialModelname.md -docs/components/schemas/StringBooleanMap.md -docs/components/schemas/StringEnum.md -docs/components/schemas/StringEnumWithDefaultValue.md -docs/components/schemas/StringSchema.md -docs/components/schemas/StringWithValidation.md -docs/components/schemas/Tag.md -docs/components/schemas/Triangle.md -docs/components/schemas/TriangleInterface.md -docs/components/schemas/UUIDString.md -docs/components/schemas/User.md -docs/components/schemas/Whale.md -docs/components/schemas/Zebra.md -docs/components/securityschemes/ApiKey.md -docs/components/securityschemes/ApiKeyQuery.md -docs/components/securityschemes/BearerTest.md -docs/components/securityschemes/HttpBasicTest.md -docs/components/securityschemes/HttpSignatureTest.md -docs/components/securityschemes/OpenIdConnectTest.md -docs/components/securityschemes/PetstoreAuth.md -docs/paths/anotherfakedummy/AnotherfakedummyPatch.md -docs/paths/anotherfakedummy/patch/AnotherfakedummyPatchRequestBody.md -docs/paths/anotherfakedummy/patch/AnotherfakedummyPatchResponses.md -docs/paths/anotherfakedummy/patch/responses/AnotherfakedummyPatchCode200Response.md -docs/paths/anotherfakedummy/patch/responses/code200response/content/applicationjson/ApplicationjsonSchema.md -docs/paths/commonparamsubdir/CommonparamsubdirDelete.md -docs/paths/commonparamsubdir/CommonparamsubdirGet.md -docs/paths/commonparamsubdir/CommonparamsubdirPost.md -docs/paths/commonparamsubdir/delete/CommonparamsubdirDeleteHeaderParameters.md -docs/paths/commonparamsubdir/delete/CommonparamsubdirDeletePathParameters.md -docs/paths/commonparamsubdir/delete/CommonparamsubdirDeleteResponses.md -docs/paths/commonparamsubdir/delete/parameters/parameter0/Schema0.md -docs/paths/commonparamsubdir/delete/parameters/parameter1/Schema1.md -docs/paths/commonparamsubdir/delete/responses/CommonparamsubdirDeleteCode200Response.md -docs/paths/commonparamsubdir/get/CommonparamsubdirGetPathParameters.md -docs/paths/commonparamsubdir/get/CommonparamsubdirGetQueryParameters.md -docs/paths/commonparamsubdir/get/CommonparamsubdirGetResponses.md -docs/paths/commonparamsubdir/get/parameters/parameter0/Schema0.md -docs/paths/commonparamsubdir/get/responses/CommonparamsubdirGetCode200Response.md -docs/paths/commonparamsubdir/parameters/routeparameter0/RouteParamSchema0.md -docs/paths/commonparamsubdir/post/CommonparamsubdirPostHeaderParameters.md -docs/paths/commonparamsubdir/post/CommonparamsubdirPostPathParameters.md -docs/paths/commonparamsubdir/post/CommonparamsubdirPostResponses.md -docs/paths/commonparamsubdir/post/parameters/parameter0/Schema0.md -docs/paths/commonparamsubdir/post/responses/CommonparamsubdirPostCode200Response.md -docs/paths/fake/FakeDelete.md -docs/paths/fake/FakeGet.md -docs/paths/fake/FakePatch.md -docs/paths/fake/FakePost.md -docs/paths/fake/delete/FakeDeleteHeaderParameters.md -docs/paths/fake/delete/FakeDeleteQueryParameters.md -docs/paths/fake/delete/FakeDeleteResponses.md -docs/paths/fake/delete/FakeDeleteSecurityInfo.md -docs/paths/fake/delete/parameters/parameter0/Schema0.md -docs/paths/fake/delete/parameters/parameter1/Schema1.md -docs/paths/fake/delete/parameters/parameter2/Schema2.md -docs/paths/fake/delete/parameters/parameter3/Schema3.md -docs/paths/fake/delete/parameters/parameter4/Schema4.md -docs/paths/fake/delete/parameters/parameter5/Schema5.md -docs/paths/fake/delete/responses/FakeDeleteCode200Response.md -docs/paths/fake/delete/security/FakeDeleteSecurityRequirementObject0.md -docs/paths/fake/get/FakeGetHeaderParameters.md -docs/paths/fake/get/FakeGetQueryParameters.md -docs/paths/fake/get/FakeGetRequestBody.md -docs/paths/fake/get/FakeGetResponses.md -docs/paths/fake/get/parameters/parameter0/Schema0.md -docs/paths/fake/get/parameters/parameter1/Schema1.md -docs/paths/fake/get/parameters/parameter2/Schema2.md -docs/paths/fake/get/parameters/parameter3/Schema3.md -docs/paths/fake/get/parameters/parameter4/Schema4.md -docs/paths/fake/get/parameters/parameter5/Schema5.md -docs/paths/fake/get/requestbody/content/applicationxwwwformurlencoded/ApplicationxwwwformurlencodedSchema.md -docs/paths/fake/get/responses/FakeGetCode200Response.md -docs/paths/fake/get/responses/FakeGetCode404Response.md -docs/paths/fake/get/responses/code404response/content/applicationjson/ApplicationjsonSchema.md -docs/paths/fake/patch/FakePatchRequestBody.md -docs/paths/fake/patch/FakePatchResponses.md -docs/paths/fake/patch/responses/FakePatchCode200Response.md -docs/paths/fake/patch/responses/code200response/content/applicationjson/ApplicationjsonSchema.md -docs/paths/fake/post/FakePostRequestBody.md -docs/paths/fake/post/FakePostResponses.md -docs/paths/fake/post/FakePostSecurityInfo.md -docs/paths/fake/post/requestbody/content/applicationxwwwformurlencoded/ApplicationxwwwformurlencodedSchema.md -docs/paths/fake/post/responses/FakePostCode200Response.md -docs/paths/fake/post/responses/FakePostCode404Response.md -docs/paths/fake/post/security/FakePostSecurityRequirementObject0.md -docs/paths/fakeadditionalpropertieswitharrayofenums/FakeadditionalpropertieswitharrayofenumsGet.md -docs/paths/fakeadditionalpropertieswitharrayofenums/get/FakeadditionalpropertieswitharrayofenumsGetRequestBody.md -docs/paths/fakeadditionalpropertieswitharrayofenums/get/FakeadditionalpropertieswitharrayofenumsGetResponses.md -docs/paths/fakeadditionalpropertieswitharrayofenums/get/requestbody/content/applicationjson/ApplicationjsonSchema.md -docs/paths/fakeadditionalpropertieswitharrayofenums/get/responses/FakeadditionalpropertieswitharrayofenumsGetCode200Response.md -docs/paths/fakeadditionalpropertieswitharrayofenums/get/responses/code200response/content/applicationjson/ApplicationjsonSchema.md -docs/paths/fakebodywithfileschema/FakebodywithfileschemaPut.md -docs/paths/fakebodywithfileschema/put/FakebodywithfileschemaPutRequestBody.md -docs/paths/fakebodywithfileschema/put/FakebodywithfileschemaPutResponses.md -docs/paths/fakebodywithfileschema/put/requestbody/content/applicationjson/ApplicationjsonSchema.md -docs/paths/fakebodywithfileschema/put/responses/FakebodywithfileschemaPutCode200Response.md -docs/paths/fakebodywithqueryparams/FakebodywithqueryparamsPut.md -docs/paths/fakebodywithqueryparams/put/FakebodywithqueryparamsPutQueryParameters.md -docs/paths/fakebodywithqueryparams/put/FakebodywithqueryparamsPutRequestBody.md -docs/paths/fakebodywithqueryparams/put/FakebodywithqueryparamsPutResponses.md -docs/paths/fakebodywithqueryparams/put/parameters/parameter0/Schema0.md -docs/paths/fakebodywithqueryparams/put/requestbody/content/applicationjson/ApplicationjsonSchema.md -docs/paths/fakebodywithqueryparams/put/responses/FakebodywithqueryparamsPutCode200Response.md -docs/paths/fakecasesensitiveparams/FakecasesensitiveparamsPut.md -docs/paths/fakecasesensitiveparams/put/FakecasesensitiveparamsPutQueryParameters.md -docs/paths/fakecasesensitiveparams/put/FakecasesensitiveparamsPutResponses.md -docs/paths/fakecasesensitiveparams/put/parameters/parameter0/Schema0.md -docs/paths/fakecasesensitiveparams/put/parameters/parameter1/Schema1.md -docs/paths/fakecasesensitiveparams/put/parameters/parameter2/Schema2.md -docs/paths/fakecasesensitiveparams/put/responses/FakecasesensitiveparamsPutCode200Response.md -docs/paths/fakeclassnametest/FakeclassnametestPatch.md -docs/paths/fakeclassnametest/patch/FakeclassnametestPatchRequestBody.md -docs/paths/fakeclassnametest/patch/FakeclassnametestPatchResponses.md -docs/paths/fakeclassnametest/patch/FakeclassnametestPatchSecurityInfo.md -docs/paths/fakeclassnametest/patch/responses/FakeclassnametestPatchCode200Response.md -docs/paths/fakeclassnametest/patch/responses/code200response/content/applicationjson/ApplicationjsonSchema.md -docs/paths/fakeclassnametest/patch/security/FakeclassnametestPatchSecurityRequirementObject0.md -docs/paths/fakedeletecoffeeid/FakedeletecoffeeidDelete.md -docs/paths/fakedeletecoffeeid/delete/FakedeletecoffeeidDeletePathParameters.md -docs/paths/fakedeletecoffeeid/delete/FakedeletecoffeeidDeleteResponses.md -docs/paths/fakedeletecoffeeid/delete/parameters/parameter0/Schema0.md -docs/paths/fakedeletecoffeeid/delete/responses/FakedeletecoffeeidDeleteCode200Response.md -docs/paths/fakedeletecoffeeid/delete/responses/FakedeletecoffeeidDeleteCodedefaultResponse.md -docs/paths/fakehealth/FakehealthGet.md -docs/paths/fakehealth/get/FakehealthGetResponses.md -docs/paths/fakehealth/get/responses/FakehealthGetCode200Response.md -docs/paths/fakehealth/get/responses/code200response/content/applicationjson/ApplicationjsonSchema.md -docs/paths/fakeinlineadditionalproperties/FakeinlineadditionalpropertiesPost.md -docs/paths/fakeinlineadditionalproperties/post/FakeinlineadditionalpropertiesPostRequestBody.md -docs/paths/fakeinlineadditionalproperties/post/FakeinlineadditionalpropertiesPostResponses.md -docs/paths/fakeinlineadditionalproperties/post/requestbody/content/applicationjson/ApplicationjsonSchema.md -docs/paths/fakeinlineadditionalproperties/post/responses/FakeinlineadditionalpropertiesPostCode200Response.md -docs/paths/fakeinlinecomposition/FakeinlinecompositionPost.md -docs/paths/fakeinlinecomposition/post/FakeinlinecompositionPostQueryParameters.md -docs/paths/fakeinlinecomposition/post/FakeinlinecompositionPostRequestBody.md -docs/paths/fakeinlinecomposition/post/FakeinlinecompositionPostResponses.md -docs/paths/fakeinlinecomposition/post/parameters/parameter0/Schema0.md -docs/paths/fakeinlinecomposition/post/parameters/parameter1/Schema1.md -docs/paths/fakeinlinecomposition/post/requestbody/content/applicationjson/ApplicationjsonSchema.md -docs/paths/fakeinlinecomposition/post/requestbody/content/multipartformdata/MultipartformdataSchema.md -docs/paths/fakeinlinecomposition/post/responses/FakeinlinecompositionPostCode200Response.md -docs/paths/fakeinlinecomposition/post/responses/code200response/content/applicationjson/ApplicationjsonSchema.md -docs/paths/fakeinlinecomposition/post/responses/code200response/content/multipartformdata/MultipartformdataSchema.md -docs/paths/fakejsonformdata/FakejsonformdataGet.md -docs/paths/fakejsonformdata/get/FakejsonformdataGetRequestBody.md -docs/paths/fakejsonformdata/get/FakejsonformdataGetResponses.md -docs/paths/fakejsonformdata/get/requestbody/content/applicationxwwwformurlencoded/ApplicationxwwwformurlencodedSchema.md -docs/paths/fakejsonformdata/get/responses/FakejsonformdataGetCode200Response.md -docs/paths/fakejsonpatch/FakejsonpatchPatch.md -docs/paths/fakejsonpatch/patch/FakejsonpatchPatchRequestBody.md -docs/paths/fakejsonpatch/patch/FakejsonpatchPatchResponses.md -docs/paths/fakejsonpatch/patch/requestbody/content/applicationjsonpatchjson/ApplicationjsonpatchjsonSchema.md -docs/paths/fakejsonpatch/patch/responses/FakejsonpatchPatchCode200Response.md -docs/paths/fakejsonwithcharset/FakejsonwithcharsetPost.md -docs/paths/fakejsonwithcharset/post/FakejsonwithcharsetPostRequestBody.md -docs/paths/fakejsonwithcharset/post/FakejsonwithcharsetPostResponses.md -docs/paths/fakejsonwithcharset/post/requestbody/content/applicationjsoncharsetutf8/Applicationjsoncharsetutf8Schema.md -docs/paths/fakejsonwithcharset/post/responses/FakejsonwithcharsetPostCode200Response.md -docs/paths/fakejsonwithcharset/post/responses/code200response/content/applicationjsoncharsetutf8/Applicationjsoncharsetutf8Schema.md -docs/paths/fakemultiplerequestbodycontenttypes/FakemultiplerequestbodycontenttypesPost.md -docs/paths/fakemultiplerequestbodycontenttypes/post/FakemultiplerequestbodycontenttypesPostRequestBody.md -docs/paths/fakemultiplerequestbodycontenttypes/post/FakemultiplerequestbodycontenttypesPostResponses.md -docs/paths/fakemultiplerequestbodycontenttypes/post/requestbody/content/applicationjson/ApplicationjsonSchema.md -docs/paths/fakemultiplerequestbodycontenttypes/post/requestbody/content/multipartformdata/MultipartformdataSchema.md -docs/paths/fakemultiplerequestbodycontenttypes/post/responses/FakemultiplerequestbodycontenttypesPostCode200Response.md -docs/paths/fakemultiplerequestbodycontenttypes/post/responses/code200response/content/applicationjson/ApplicationjsonSchema.md -docs/paths/fakemultipleresponsebodies/FakemultipleresponsebodiesGet.md -docs/paths/fakemultipleresponsebodies/get/FakemultipleresponsebodiesGetResponses.md -docs/paths/fakemultipleresponsebodies/get/responses/FakemultipleresponsebodiesGetCode200Response.md -docs/paths/fakemultipleresponsebodies/get/responses/FakemultipleresponsebodiesGetCode202Response.md -docs/paths/fakemultipleresponsebodies/get/responses/code200response/content/applicationjson/ApplicationjsonSchema.md -docs/paths/fakemultipleresponsebodies/get/responses/code202response/content/applicationjson/ApplicationjsonSchema.md -docs/paths/fakemultiplesecurities/FakemultiplesecuritiesGet.md -docs/paths/fakemultiplesecurities/get/FakemultiplesecuritiesGetResponses.md -docs/paths/fakemultiplesecurities/get/FakemultiplesecuritiesGetSecurityInfo.md -docs/paths/fakemultiplesecurities/get/responses/FakemultiplesecuritiesGetCode200Response.md -docs/paths/fakemultiplesecurities/get/responses/code200response/content/applicationjson/ApplicationjsonSchema.md -docs/paths/fakemultiplesecurities/get/security/FakemultiplesecuritiesGetSecurityRequirementObject0.md -docs/paths/fakemultiplesecurities/get/security/FakemultiplesecuritiesGetSecurityRequirementObject1.md -docs/paths/fakemultiplesecurities/get/security/FakemultiplesecuritiesGetSecurityRequirementObject2.md -docs/paths/fakeobjinquery/FakeobjinqueryGet.md -docs/paths/fakeobjinquery/get/FakeobjinqueryGetQueryParameters.md -docs/paths/fakeobjinquery/get/FakeobjinqueryGetResponses.md -docs/paths/fakeobjinquery/get/parameters/parameter0/Schema0.md -docs/paths/fakeobjinquery/get/responses/FakeobjinqueryGetCode200Response.md -docs/paths/fakeparametercollisions1ababselfab/Fakeparametercollisions1ababselfabPost.md -docs/paths/fakeparametercollisions1ababselfab/post/Fakeparametercollisions1ababselfabPostCookieParameters.md -docs/paths/fakeparametercollisions1ababselfab/post/Fakeparametercollisions1ababselfabPostHeaderParameters.md -docs/paths/fakeparametercollisions1ababselfab/post/Fakeparametercollisions1ababselfabPostPathParameters.md -docs/paths/fakeparametercollisions1ababselfab/post/Fakeparametercollisions1ababselfabPostQueryParameters.md -docs/paths/fakeparametercollisions1ababselfab/post/Fakeparametercollisions1ababselfabPostRequestBody.md -docs/paths/fakeparametercollisions1ababselfab/post/Fakeparametercollisions1ababselfabPostResponses.md -docs/paths/fakeparametercollisions1ababselfab/post/parameters/parameter0/Schema0.md -docs/paths/fakeparametercollisions1ababselfab/post/parameters/parameter1/Schema1.md -docs/paths/fakeparametercollisions1ababselfab/post/parameters/parameter10/Schema10.md -docs/paths/fakeparametercollisions1ababselfab/post/parameters/parameter11/Schema11.md -docs/paths/fakeparametercollisions1ababselfab/post/parameters/parameter12/Schema12.md -docs/paths/fakeparametercollisions1ababselfab/post/parameters/parameter13/Schema13.md -docs/paths/fakeparametercollisions1ababselfab/post/parameters/parameter14/Schema14.md -docs/paths/fakeparametercollisions1ababselfab/post/parameters/parameter15/Schema15.md -docs/paths/fakeparametercollisions1ababselfab/post/parameters/parameter16/Schema16.md -docs/paths/fakeparametercollisions1ababselfab/post/parameters/parameter17/Schema17.md -docs/paths/fakeparametercollisions1ababselfab/post/parameters/parameter18/Schema18.md -docs/paths/fakeparametercollisions1ababselfab/post/parameters/parameter2/Schema2.md -docs/paths/fakeparametercollisions1ababselfab/post/parameters/parameter3/Schema3.md -docs/paths/fakeparametercollisions1ababselfab/post/parameters/parameter4/Schema4.md -docs/paths/fakeparametercollisions1ababselfab/post/parameters/parameter5/Schema5.md -docs/paths/fakeparametercollisions1ababselfab/post/parameters/parameter6/Schema6.md -docs/paths/fakeparametercollisions1ababselfab/post/parameters/parameter7/Schema7.md -docs/paths/fakeparametercollisions1ababselfab/post/parameters/parameter8/Schema8.md -docs/paths/fakeparametercollisions1ababselfab/post/parameters/parameter9/Schema9.md -docs/paths/fakeparametercollisions1ababselfab/post/requestbody/content/applicationjson/ApplicationjsonSchema.md -docs/paths/fakeparametercollisions1ababselfab/post/responses/Fakeparametercollisions1ababselfabPostCode200Response.md -docs/paths/fakeparametercollisions1ababselfab/post/responses/code200response/content/applicationjson/ApplicationjsonSchema.md -docs/paths/fakepemcontenttype/FakepemcontenttypeGet.md -docs/paths/fakepemcontenttype/get/FakepemcontenttypeGetRequestBody.md -docs/paths/fakepemcontenttype/get/FakepemcontenttypeGetResponses.md -docs/paths/fakepemcontenttype/get/requestbody/content/applicationxpemfile/ApplicationxpemfileSchema.md -docs/paths/fakepemcontenttype/get/responses/FakepemcontenttypeGetCode200Response.md -docs/paths/fakepemcontenttype/get/responses/code200response/content/applicationxpemfile/ApplicationxpemfileSchema.md -docs/paths/fakepetiduploadimagewithrequiredfile/FakepetiduploadimagewithrequiredfilePost.md -docs/paths/fakepetiduploadimagewithrequiredfile/post/FakepetiduploadimagewithrequiredfilePostPathParameters.md -docs/paths/fakepetiduploadimagewithrequiredfile/post/FakepetiduploadimagewithrequiredfilePostRequestBody.md -docs/paths/fakepetiduploadimagewithrequiredfile/post/FakepetiduploadimagewithrequiredfilePostResponses.md -docs/paths/fakepetiduploadimagewithrequiredfile/post/FakepetiduploadimagewithrequiredfilePostSecurityInfo.md -docs/paths/fakepetiduploadimagewithrequiredfile/post/parameters/parameter0/Schema0.md -docs/paths/fakepetiduploadimagewithrequiredfile/post/requestbody/content/multipartformdata/MultipartformdataSchema.md -docs/paths/fakepetiduploadimagewithrequiredfile/post/responses/FakepetiduploadimagewithrequiredfilePostCode200Response.md -docs/paths/fakepetiduploadimagewithrequiredfile/post/responses/code200response/content/applicationjson/ApplicationjsonSchema.md -docs/paths/fakepetiduploadimagewithrequiredfile/post/security/FakepetiduploadimagewithrequiredfilePostSecurityRequirementObject0.md -docs/paths/fakequeryparamwithjsoncontenttype/FakequeryparamwithjsoncontenttypeGet.md -docs/paths/fakequeryparamwithjsoncontenttype/get/FakequeryparamwithjsoncontenttypeGetQueryParameters.md -docs/paths/fakequeryparamwithjsoncontenttype/get/FakequeryparamwithjsoncontenttypeGetResponses.md -docs/paths/fakequeryparamwithjsoncontenttype/get/parameters/parameter0/content/applicationjson/Schema0.md -docs/paths/fakequeryparamwithjsoncontenttype/get/responses/FakequeryparamwithjsoncontenttypeGetCode200Response.md -docs/paths/fakequeryparamwithjsoncontenttype/get/responses/code200response/content/applicationjson/ApplicationjsonSchema.md -docs/paths/fakeredirection/FakeredirectionGet.md -docs/paths/fakeredirection/get/FakeredirectionGetResponses.md -docs/paths/fakeredirection/get/responses/FakeredirectionGetCode303Response.md -docs/paths/fakeredirection/get/responses/FakeredirectionGetCode3XXResponse.md -docs/paths/fakerefobjinquery/FakerefobjinqueryGet.md -docs/paths/fakerefobjinquery/get/FakerefobjinqueryGetQueryParameters.md -docs/paths/fakerefobjinquery/get/FakerefobjinqueryGetResponses.md -docs/paths/fakerefobjinquery/get/parameters/parameter0/Schema0.md -docs/paths/fakerefobjinquery/get/responses/FakerefobjinqueryGetCode200Response.md -docs/paths/fakerefsarraymodel/FakerefsarraymodelPost.md -docs/paths/fakerefsarraymodel/post/FakerefsarraymodelPostRequestBody.md -docs/paths/fakerefsarraymodel/post/FakerefsarraymodelPostResponses.md -docs/paths/fakerefsarraymodel/post/requestbody/content/applicationjson/ApplicationjsonSchema.md -docs/paths/fakerefsarraymodel/post/responses/FakerefsarraymodelPostCode200Response.md -docs/paths/fakerefsarraymodel/post/responses/code200response/content/applicationjson/ApplicationjsonSchema.md -docs/paths/fakerefsarrayofenums/FakerefsarrayofenumsPost.md -docs/paths/fakerefsarrayofenums/post/FakerefsarrayofenumsPostRequestBody.md -docs/paths/fakerefsarrayofenums/post/FakerefsarrayofenumsPostResponses.md -docs/paths/fakerefsarrayofenums/post/requestbody/content/applicationjson/ApplicationjsonSchema.md -docs/paths/fakerefsarrayofenums/post/responses/FakerefsarrayofenumsPostCode200Response.md -docs/paths/fakerefsarrayofenums/post/responses/code200response/content/applicationjson/ApplicationjsonSchema.md -docs/paths/fakerefsboolean/FakerefsbooleanPost.md -docs/paths/fakerefsboolean/post/FakerefsbooleanPostRequestBody.md -docs/paths/fakerefsboolean/post/FakerefsbooleanPostResponses.md -docs/paths/fakerefsboolean/post/requestbody/content/applicationjson/ApplicationjsonSchema.md -docs/paths/fakerefsboolean/post/responses/FakerefsbooleanPostCode200Response.md -docs/paths/fakerefsboolean/post/responses/code200response/content/applicationjson/ApplicationjsonSchema.md -docs/paths/fakerefscomposedoneofnumberwithvalidations/FakerefscomposedoneofnumberwithvalidationsPost.md -docs/paths/fakerefscomposedoneofnumberwithvalidations/post/FakerefscomposedoneofnumberwithvalidationsPostRequestBody.md -docs/paths/fakerefscomposedoneofnumberwithvalidations/post/FakerefscomposedoneofnumberwithvalidationsPostResponses.md -docs/paths/fakerefscomposedoneofnumberwithvalidations/post/requestbody/content/applicationjson/ApplicationjsonSchema.md -docs/paths/fakerefscomposedoneofnumberwithvalidations/post/responses/FakerefscomposedoneofnumberwithvalidationsPostCode200Response.md -docs/paths/fakerefscomposedoneofnumberwithvalidations/post/responses/code200response/content/applicationjson/ApplicationjsonSchema.md -docs/paths/fakerefsenum/FakerefsenumPost.md -docs/paths/fakerefsenum/post/FakerefsenumPostRequestBody.md -docs/paths/fakerefsenum/post/FakerefsenumPostResponses.md -docs/paths/fakerefsenum/post/requestbody/content/applicationjson/ApplicationjsonSchema.md -docs/paths/fakerefsenum/post/responses/FakerefsenumPostCode200Response.md -docs/paths/fakerefsenum/post/responses/code200response/content/applicationjson/ApplicationjsonSchema.md -docs/paths/fakerefsmammal/FakerefsmammalPost.md -docs/paths/fakerefsmammal/post/FakerefsmammalPostRequestBody.md -docs/paths/fakerefsmammal/post/FakerefsmammalPostResponses.md -docs/paths/fakerefsmammal/post/requestbody/content/applicationjson/ApplicationjsonSchema.md -docs/paths/fakerefsmammal/post/responses/FakerefsmammalPostCode200Response.md -docs/paths/fakerefsmammal/post/responses/code200response/content/applicationjson/ApplicationjsonSchema.md -docs/paths/fakerefsnumber/FakerefsnumberPost.md -docs/paths/fakerefsnumber/post/FakerefsnumberPostRequestBody.md -docs/paths/fakerefsnumber/post/FakerefsnumberPostResponses.md -docs/paths/fakerefsnumber/post/requestbody/content/applicationjson/ApplicationjsonSchema.md -docs/paths/fakerefsnumber/post/responses/FakerefsnumberPostCode200Response.md -docs/paths/fakerefsnumber/post/responses/code200response/content/applicationjson/ApplicationjsonSchema.md -docs/paths/fakerefsobjectmodelwithrefprops/FakerefsobjectmodelwithrefpropsPost.md -docs/paths/fakerefsobjectmodelwithrefprops/post/FakerefsobjectmodelwithrefpropsPostRequestBody.md -docs/paths/fakerefsobjectmodelwithrefprops/post/FakerefsobjectmodelwithrefpropsPostResponses.md -docs/paths/fakerefsobjectmodelwithrefprops/post/requestbody/content/applicationjson/ApplicationjsonSchema.md -docs/paths/fakerefsobjectmodelwithrefprops/post/responses/FakerefsobjectmodelwithrefpropsPostCode200Response.md -docs/paths/fakerefsobjectmodelwithrefprops/post/responses/code200response/content/applicationjson/ApplicationjsonSchema.md -docs/paths/fakerefsstring/FakerefsstringPost.md -docs/paths/fakerefsstring/post/FakerefsstringPostRequestBody.md -docs/paths/fakerefsstring/post/FakerefsstringPostResponses.md -docs/paths/fakerefsstring/post/requestbody/content/applicationjson/ApplicationjsonSchema.md -docs/paths/fakerefsstring/post/responses/FakerefsstringPostCode200Response.md -docs/paths/fakerefsstring/post/responses/code200response/content/applicationjson/ApplicationjsonSchema.md -docs/paths/fakeresponsewithoutschema/FakeresponsewithoutschemaGet.md -docs/paths/fakeresponsewithoutschema/get/FakeresponsewithoutschemaGetResponses.md -docs/paths/fakeresponsewithoutschema/get/responses/FakeresponsewithoutschemaGetCode200Response.md -docs/paths/faketestqueryparamters/FaketestqueryparamtersPut.md -docs/paths/faketestqueryparamters/put/FaketestqueryparamtersPutQueryParameters.md -docs/paths/faketestqueryparamters/put/FaketestqueryparamtersPutResponses.md -docs/paths/faketestqueryparamters/put/parameters/parameter0/Schema0.md -docs/paths/faketestqueryparamters/put/parameters/parameter1/Schema1.md -docs/paths/faketestqueryparamters/put/parameters/parameter2/Schema2.md -docs/paths/faketestqueryparamters/put/parameters/parameter3/Schema3.md -docs/paths/faketestqueryparamters/put/parameters/parameter4/Schema4.md -docs/paths/faketestqueryparamters/put/parameters/parameter5/Schema5.md -docs/paths/faketestqueryparamters/put/responses/FaketestqueryparamtersPutCode200Response.md -docs/paths/fakeuploaddownloadfile/FakeuploaddownloadfilePost.md -docs/paths/fakeuploaddownloadfile/post/FakeuploaddownloadfilePostRequestBody.md -docs/paths/fakeuploaddownloadfile/post/FakeuploaddownloadfilePostResponses.md -docs/paths/fakeuploaddownloadfile/post/requestbody/content/applicationoctetstream/ApplicationoctetstreamSchema.md -docs/paths/fakeuploaddownloadfile/post/responses/FakeuploaddownloadfilePostCode200Response.md -docs/paths/fakeuploaddownloadfile/post/responses/code200response/content/applicationoctetstream/ApplicationoctetstreamSchema.md -docs/paths/fakeuploadfile/FakeuploadfilePost.md -docs/paths/fakeuploadfile/post/FakeuploadfilePostRequestBody.md -docs/paths/fakeuploadfile/post/FakeuploadfilePostResponses.md -docs/paths/fakeuploadfile/post/requestbody/content/multipartformdata/MultipartformdataSchema.md -docs/paths/fakeuploadfile/post/responses/FakeuploadfilePostCode200Response.md -docs/paths/fakeuploadfile/post/responses/code200response/content/applicationjson/ApplicationjsonSchema.md -docs/paths/fakeuploadfiles/FakeuploadfilesPost.md -docs/paths/fakeuploadfiles/post/FakeuploadfilesPostRequestBody.md -docs/paths/fakeuploadfiles/post/FakeuploadfilesPostResponses.md -docs/paths/fakeuploadfiles/post/requestbody/content/multipartformdata/MultipartformdataSchema.md -docs/paths/fakeuploadfiles/post/responses/FakeuploadfilesPostCode200Response.md -docs/paths/fakeuploadfiles/post/responses/code200response/content/applicationjson/ApplicationjsonSchema.md -docs/paths/fakewildcardresponses/FakewildcardresponsesGet.md -docs/paths/fakewildcardresponses/get/FakewildcardresponsesGetResponses.md -docs/paths/fakewildcardresponses/get/responses/FakewildcardresponsesGetCode1XXResponse.md -docs/paths/fakewildcardresponses/get/responses/FakewildcardresponsesGetCode200Response.md -docs/paths/fakewildcardresponses/get/responses/FakewildcardresponsesGetCode2XXResponse.md -docs/paths/fakewildcardresponses/get/responses/FakewildcardresponsesGetCode3XXResponse.md -docs/paths/fakewildcardresponses/get/responses/FakewildcardresponsesGetCode4XXResponse.md -docs/paths/fakewildcardresponses/get/responses/FakewildcardresponsesGetCode5XXResponse.md -docs/paths/fakewildcardresponses/get/responses/code1xxresponse/content/applicationjson/ApplicationjsonSchema.md -docs/paths/fakewildcardresponses/get/responses/code200response/content/applicationjson/ApplicationjsonSchema.md -docs/paths/fakewildcardresponses/get/responses/code2xxresponse/content/applicationjson/ApplicationjsonSchema.md -docs/paths/fakewildcardresponses/get/responses/code3xxresponse/content/applicationjson/ApplicationjsonSchema.md -docs/paths/fakewildcardresponses/get/responses/code4xxresponse/content/applicationjson/ApplicationjsonSchema.md -docs/paths/fakewildcardresponses/get/responses/code5xxresponse/content/applicationjson/ApplicationjsonSchema.md -docs/paths/foo/FooGet.md -docs/paths/foo/get/FooGetResponses.md -docs/paths/foo/get/FooGetServerInfo.md -docs/paths/foo/get/responses/FooGetCodedefaultResponse.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/FooGetServer1Variables.md -docs/paths/pet/PetPost.md -docs/paths/pet/PetPut.md -docs/paths/pet/post/PetPostRequestBody.md -docs/paths/pet/post/PetPostResponses.md -docs/paths/pet/post/PetPostSecurityInfo.md -docs/paths/pet/post/responses/PetPostCode200Response.md -docs/paths/pet/post/responses/PetPostCode405Response.md -docs/paths/pet/post/security/PetPostSecurityRequirementObject0.md -docs/paths/pet/post/security/PetPostSecurityRequirementObject1.md -docs/paths/pet/post/security/PetPostSecurityRequirementObject2.md -docs/paths/pet/put/PetPutRequestBody.md -docs/paths/pet/put/PetPutResponses.md -docs/paths/pet/put/PetPutSecurityInfo.md -docs/paths/pet/put/responses/PetPutCode400Response.md -docs/paths/pet/put/responses/PetPutCode404Response.md -docs/paths/pet/put/responses/PetPutCode405Response.md -docs/paths/pet/put/security/PetPutSecurityRequirementObject0.md -docs/paths/pet/put/security/PetPutSecurityRequirementObject1.md -docs/paths/petfindbystatus/PetfindbystatusGet.md -docs/paths/petfindbystatus/PetfindbystatusServerInfo.md -docs/paths/petfindbystatus/get/PetfindbystatusGetQueryParameters.md -docs/paths/petfindbystatus/get/PetfindbystatusGetResponses.md -docs/paths/petfindbystatus/get/PetfindbystatusGetSecurityInfo.md -docs/paths/petfindbystatus/get/parameters/parameter0/Schema0.md -docs/paths/petfindbystatus/get/responses/PetfindbystatusGetCode200Response.md -docs/paths/petfindbystatus/get/responses/PetfindbystatusGetCode400Response.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/PetfindbystatusServer1Variables.md -docs/paths/petfindbytags/PetfindbytagsGet.md -docs/paths/petfindbytags/get/PetfindbytagsGetQueryParameters.md -docs/paths/petfindbytags/get/PetfindbytagsGetResponses.md -docs/paths/petfindbytags/get/PetfindbytagsGetSecurityInfo.md -docs/paths/petfindbytags/get/parameters/parameter0/Schema0.md -docs/paths/petfindbytags/get/responses/PetfindbytagsGetCode200Response.md -docs/paths/petfindbytags/get/responses/PetfindbytagsGetCode400Response.md -docs/paths/petfindbytags/get/security/PetfindbytagsGetSecurityRequirementObject0.md -docs/paths/petfindbytags/get/security/PetfindbytagsGetSecurityRequirementObject1.md -docs/paths/petpetid/PetpetidDelete.md -docs/paths/petpetid/PetpetidGet.md -docs/paths/petpetid/PetpetidPost.md -docs/paths/petpetid/delete/PetpetidDeleteHeaderParameters.md -docs/paths/petpetid/delete/PetpetidDeletePathParameters.md -docs/paths/petpetid/delete/PetpetidDeleteResponses.md -docs/paths/petpetid/delete/PetpetidDeleteSecurityInfo.md -docs/paths/petpetid/delete/parameters/parameter0/Schema0.md -docs/paths/petpetid/delete/parameters/parameter1/Schema1.md -docs/paths/petpetid/delete/responses/PetpetidDeleteCode400Response.md -docs/paths/petpetid/delete/security/PetpetidDeleteSecurityRequirementObject0.md -docs/paths/petpetid/delete/security/PetpetidDeleteSecurityRequirementObject1.md -docs/paths/petpetid/get/PetpetidGetPathParameters.md -docs/paths/petpetid/get/PetpetidGetResponses.md -docs/paths/petpetid/get/PetpetidGetSecurityInfo.md -docs/paths/petpetid/get/parameters/parameter0/Schema0.md -docs/paths/petpetid/get/responses/PetpetidGetCode200Response.md -docs/paths/petpetid/get/responses/PetpetidGetCode400Response.md -docs/paths/petpetid/get/responses/PetpetidGetCode404Response.md -docs/paths/petpetid/get/responses/code200response/content/applicationjson/ApplicationjsonSchema.md -docs/paths/petpetid/get/responses/code200response/content/applicationxml/ApplicationxmlSchema.md -docs/paths/petpetid/get/security/PetpetidGetSecurityRequirementObject0.md -docs/paths/petpetid/post/PetpetidPostPathParameters.md -docs/paths/petpetid/post/PetpetidPostRequestBody.md -docs/paths/petpetid/post/PetpetidPostResponses.md -docs/paths/petpetid/post/PetpetidPostSecurityInfo.md -docs/paths/petpetid/post/parameters/parameter0/Schema0.md -docs/paths/petpetid/post/requestbody/content/applicationxwwwformurlencoded/ApplicationxwwwformurlencodedSchema.md -docs/paths/petpetid/post/responses/PetpetidPostCode405Response.md -docs/paths/petpetid/post/security/PetpetidPostSecurityRequirementObject0.md -docs/paths/petpetid/post/security/PetpetidPostSecurityRequirementObject1.md -docs/paths/petpetiduploadimage/PetpetiduploadimagePost.md -docs/paths/petpetiduploadimage/post/PetpetiduploadimagePostPathParameters.md -docs/paths/petpetiduploadimage/post/PetpetiduploadimagePostRequestBody.md -docs/paths/petpetiduploadimage/post/PetpetiduploadimagePostResponses.md -docs/paths/petpetiduploadimage/post/PetpetiduploadimagePostSecurityInfo.md -docs/paths/petpetiduploadimage/post/parameters/parameter0/Schema0.md -docs/paths/petpetiduploadimage/post/requestbody/content/multipartformdata/MultipartformdataSchema.md -docs/paths/petpetiduploadimage/post/responses/PetpetiduploadimagePostCode200Response.md -docs/paths/petpetiduploadimage/post/security/PetpetiduploadimagePostSecurityRequirementObject0.md -docs/paths/solidus/SolidusGet.md -docs/paths/solidus/get/SolidusGetResponses.md -docs/paths/solidus/get/responses/SolidusGetCode200Response.md -docs/paths/storeinventory/StoreinventoryGet.md -docs/paths/storeinventory/get/StoreinventoryGetResponses.md -docs/paths/storeinventory/get/StoreinventoryGetSecurityInfo.md -docs/paths/storeinventory/get/responses/StoreinventoryGetCode200Response.md -docs/paths/storeinventory/get/security/StoreinventoryGetSecurityRequirementObject0.md -docs/paths/storeorder/StoreorderPost.md -docs/paths/storeorder/post/StoreorderPostRequestBody.md -docs/paths/storeorder/post/StoreorderPostResponses.md -docs/paths/storeorder/post/requestbody/content/applicationjson/ApplicationjsonSchema.md -docs/paths/storeorder/post/responses/StoreorderPostCode200Response.md -docs/paths/storeorder/post/responses/StoreorderPostCode400Response.md -docs/paths/storeorder/post/responses/code200response/content/applicationjson/ApplicationjsonSchema.md -docs/paths/storeorder/post/responses/code200response/content/applicationxml/ApplicationxmlSchema.md -docs/paths/storeorderorderid/StoreorderorderidDelete.md -docs/paths/storeorderorderid/StoreorderorderidGet.md -docs/paths/storeorderorderid/delete/StoreorderorderidDeletePathParameters.md -docs/paths/storeorderorderid/delete/StoreorderorderidDeleteResponses.md -docs/paths/storeorderorderid/delete/parameters/parameter0/Schema0.md -docs/paths/storeorderorderid/delete/responses/StoreorderorderidDeleteCode400Response.md -docs/paths/storeorderorderid/delete/responses/StoreorderorderidDeleteCode404Response.md -docs/paths/storeorderorderid/get/StoreorderorderidGetPathParameters.md -docs/paths/storeorderorderid/get/StoreorderorderidGetResponses.md -docs/paths/storeorderorderid/get/parameters/parameter0/Schema0.md -docs/paths/storeorderorderid/get/responses/StoreorderorderidGetCode200Response.md -docs/paths/storeorderorderid/get/responses/StoreorderorderidGetCode400Response.md -docs/paths/storeorderorderid/get/responses/StoreorderorderidGetCode404Response.md -docs/paths/storeorderorderid/get/responses/code200response/content/applicationjson/ApplicationjsonSchema.md -docs/paths/storeorderorderid/get/responses/code200response/content/applicationxml/ApplicationxmlSchema.md -docs/paths/user/UserPost.md -docs/paths/user/post/UserPostRequestBody.md -docs/paths/user/post/UserPostResponses.md -docs/paths/user/post/requestbody/content/applicationjson/ApplicationjsonSchema.md -docs/paths/user/post/responses/UserPostCodedefaultResponse.md -docs/paths/usercreatewitharray/UsercreatewitharrayPost.md -docs/paths/usercreatewitharray/post/UsercreatewitharrayPostRequestBody.md -docs/paths/usercreatewitharray/post/UsercreatewitharrayPostResponses.md -docs/paths/usercreatewitharray/post/responses/UsercreatewitharrayPostCodedefaultResponse.md -docs/paths/usercreatewithlist/UsercreatewithlistPost.md -docs/paths/usercreatewithlist/post/UsercreatewithlistPostRequestBody.md -docs/paths/usercreatewithlist/post/UsercreatewithlistPostResponses.md -docs/paths/usercreatewithlist/post/responses/UsercreatewithlistPostCodedefaultResponse.md -docs/paths/userlogin/UserloginGet.md -docs/paths/userlogin/get/UserloginGetQueryParameters.md -docs/paths/userlogin/get/UserloginGetResponses.md -docs/paths/userlogin/get/parameters/parameter0/Schema0.md -docs/paths/userlogin/get/parameters/parameter1/Schema1.md -docs/paths/userlogin/get/responses/UserloginGetCode200Response.md -docs/paths/userlogin/get/responses/UserloginGetCode400Response.md -docs/paths/userlogin/get/responses/code200response/UserloginGetCode200ResponseHeadersSchema.md -docs/paths/userlogin/get/responses/code200response/content/applicationjson/ApplicationjsonSchema.md -docs/paths/userlogin/get/responses/code200response/content/applicationxml/ApplicationxmlSchema.md -docs/paths/userlogin/get/responses/code200response/headers/xexpiresafter/XExpiresAfterSchema.md -docs/paths/userlogin/get/responses/code200response/headers/xratelimit/content/applicationjson/XRateLimitSchema.md -docs/paths/userlogout/UserlogoutGet.md -docs/paths/userlogout/get/UserlogoutGetResponses.md -docs/paths/userlogout/get/responses/UserlogoutGetCodedefaultResponse.md -docs/paths/userusername/UserusernameDelete.md -docs/paths/userusername/UserusernameGet.md -docs/paths/userusername/UserusernamePut.md -docs/paths/userusername/delete/UserusernameDeletePathParameters.md -docs/paths/userusername/delete/UserusernameDeleteResponses.md -docs/paths/userusername/delete/responses/UserusernameDeleteCode200Response.md -docs/paths/userusername/delete/responses/UserusernameDeleteCode404Response.md -docs/paths/userusername/get/UserusernameGetPathParameters.md -docs/paths/userusername/get/UserusernameGetResponses.md -docs/paths/userusername/get/responses/UserusernameGetCode200Response.md -docs/paths/userusername/get/responses/UserusernameGetCode400Response.md -docs/paths/userusername/get/responses/UserusernameGetCode404Response.md -docs/paths/userusername/get/responses/code200response/content/applicationjson/ApplicationjsonSchema.md -docs/paths/userusername/get/responses/code200response/content/applicationxml/ApplicationxmlSchema.md -docs/paths/userusername/put/UserusernamePutPathParameters.md -docs/paths/userusername/put/UserusernamePutRequestBody.md -docs/paths/userusername/put/UserusernamePutResponses.md -docs/paths/userusername/put/requestbody/content/applicationjson/ApplicationjsonSchema.md -docs/paths/userusername/put/responses/UserusernamePutCode400Response.md -docs/paths/userusername/put/responses/UserusernamePutCode404Response.md -docs/servers/RootServer0.md -docs/servers/RootServer1.md -docs/servers/RootServer2.md -docs/servers/rootserver0/RootServer0Variables.md -docs/servers/rootserver1/RootServer1Variables.md -settings.gradle.kts -src/main/kotlin/org/openapijsonschematools/client/RootServerInfo.kt -src/main/kotlin/org/openapijsonschematools/client/apiclient/ApiClient.kt -src/main/kotlin/org/openapijsonschematools/client/apis/paths/Anotherfakedummy.kt -src/main/kotlin/org/openapijsonschematools/client/apis/paths/Commonparamsubdir.kt -src/main/kotlin/org/openapijsonschematools/client/apis/paths/Fake.kt -src/main/kotlin/org/openapijsonschematools/client/apis/paths/Fakeadditionalpropertieswitharrayofenums.kt -src/main/kotlin/org/openapijsonschematools/client/apis/paths/Fakebodywithfileschema.kt -src/main/kotlin/org/openapijsonschematools/client/apis/paths/Fakebodywithqueryparams.kt -src/main/kotlin/org/openapijsonschematools/client/apis/paths/Fakecasesensitiveparams.kt -src/main/kotlin/org/openapijsonschematools/client/apis/paths/Fakeclassnametest.kt -src/main/kotlin/org/openapijsonschematools/client/apis/paths/Fakedeletecoffeeid.kt -src/main/kotlin/org/openapijsonschematools/client/apis/paths/Fakehealth.kt -src/main/kotlin/org/openapijsonschematools/client/apis/paths/Fakeinlineadditionalproperties.kt -src/main/kotlin/org/openapijsonschematools/client/apis/paths/Fakeinlinecomposition.kt -src/main/kotlin/org/openapijsonschematools/client/apis/paths/Fakejsonformdata.kt -src/main/kotlin/org/openapijsonschematools/client/apis/paths/Fakejsonpatch.kt -src/main/kotlin/org/openapijsonschematools/client/apis/paths/Fakejsonwithcharset.kt -src/main/kotlin/org/openapijsonschematools/client/apis/paths/Fakemultiplerequestbodycontenttypes.kt -src/main/kotlin/org/openapijsonschematools/client/apis/paths/Fakemultipleresponsebodies.kt -src/main/kotlin/org/openapijsonschematools/client/apis/paths/Fakemultiplesecurities.kt -src/main/kotlin/org/openapijsonschematools/client/apis/paths/Fakeobjinquery.kt -src/main/kotlin/org/openapijsonschematools/client/apis/paths/Fakeparametercollisions1ababselfab.kt -src/main/kotlin/org/openapijsonschematools/client/apis/paths/Fakepemcontenttype.kt -src/main/kotlin/org/openapijsonschematools/client/apis/paths/Fakepetiduploadimagewithrequiredfile.kt -src/main/kotlin/org/openapijsonschematools/client/apis/paths/Fakequeryparamwithjsoncontenttype.kt -src/main/kotlin/org/openapijsonschematools/client/apis/paths/Fakeredirection.kt -src/main/kotlin/org/openapijsonschematools/client/apis/paths/Fakerefobjinquery.kt -src/main/kotlin/org/openapijsonschematools/client/apis/paths/Fakerefsarraymodel.kt -src/main/kotlin/org/openapijsonschematools/client/apis/paths/Fakerefsarrayofenums.kt -src/main/kotlin/org/openapijsonschematools/client/apis/paths/Fakerefsboolean.kt -src/main/kotlin/org/openapijsonschematools/client/apis/paths/Fakerefscomposedoneofnumberwithvalidations.kt -src/main/kotlin/org/openapijsonschematools/client/apis/paths/Fakerefsenum.kt -src/main/kotlin/org/openapijsonschematools/client/apis/paths/Fakerefsmammal.kt -src/main/kotlin/org/openapijsonschematools/client/apis/paths/Fakerefsnumber.kt -src/main/kotlin/org/openapijsonschematools/client/apis/paths/Fakerefsobjectmodelwithrefprops.kt -src/main/kotlin/org/openapijsonschematools/client/apis/paths/Fakerefsstring.kt -src/main/kotlin/org/openapijsonschematools/client/apis/paths/Fakeresponsewithoutschema.kt -src/main/kotlin/org/openapijsonschematools/client/apis/paths/Faketestqueryparamters.kt -src/main/kotlin/org/openapijsonschematools/client/apis/paths/Fakeuploaddownloadfile.kt -src/main/kotlin/org/openapijsonschematools/client/apis/paths/Fakeuploadfile.kt -src/main/kotlin/org/openapijsonschematools/client/apis/paths/Fakeuploadfiles.kt -src/main/kotlin/org/openapijsonschematools/client/apis/paths/Fakewildcardresponses.kt -src/main/kotlin/org/openapijsonschematools/client/apis/paths/Foo.kt -src/main/kotlin/org/openapijsonschematools/client/apis/paths/Pet.kt -src/main/kotlin/org/openapijsonschematools/client/apis/paths/Petfindbystatus.kt -src/main/kotlin/org/openapijsonschematools/client/apis/paths/Petfindbytags.kt -src/main/kotlin/org/openapijsonschematools/client/apis/paths/Petpetid.kt -src/main/kotlin/org/openapijsonschematools/client/apis/paths/Petpetiduploadimage.kt -src/main/kotlin/org/openapijsonschematools/client/apis/paths/Solidus.kt -src/main/kotlin/org/openapijsonschematools/client/apis/paths/Storeinventory.kt -src/main/kotlin/org/openapijsonschematools/client/apis/paths/Storeorder.kt -src/main/kotlin/org/openapijsonschematools/client/apis/paths/Storeorderorderid.kt -src/main/kotlin/org/openapijsonschematools/client/apis/paths/User.kt -src/main/kotlin/org/openapijsonschematools/client/apis/paths/Usercreatewitharray.kt -src/main/kotlin/org/openapijsonschematools/client/apis/paths/Usercreatewithlist.kt -src/main/kotlin/org/openapijsonschematools/client/apis/paths/Userlogin.kt -src/main/kotlin/org/openapijsonschematools/client/apis/paths/Userlogout.kt -src/main/kotlin/org/openapijsonschematools/client/apis/paths/Userusername.kt -src/main/kotlin/org/openapijsonschematools/client/apis/tags/Anotherfake.kt -src/main/kotlin/org/openapijsonschematools/client/apis/tags/Default.kt -src/main/kotlin/org/openapijsonschematools/client/apis/tags/Fake.kt -src/main/kotlin/org/openapijsonschematools/client/apis/tags/Fakeclassnametags123.kt -src/main/kotlin/org/openapijsonschematools/client/apis/tags/Pet.kt -src/main/kotlin/org/openapijsonschematools/client/apis/tags/Store.kt -src/main/kotlin/org/openapijsonschematools/client/apis/tags/User.kt -src/main/kotlin/org/openapijsonschematools/client/components/headers/Int32JsonContentTypeHeader.kt -src/main/kotlin/org/openapijsonschematools/client/components/headers/NumberHeader.kt -src/main/kotlin/org/openapijsonschematools/client/components/headers/RefContentSchemaHeader.kt -src/main/kotlin/org/openapijsonschematools/client/components/headers/RefSchemaHeader.kt -src/main/kotlin/org/openapijsonschematools/client/components/headers/RefStringHeader.kt -src/main/kotlin/org/openapijsonschematools/client/components/headers/StringHeader.kt -src/main/kotlin/org/openapijsonschematools/client/components/headers/int32jsoncontenttypeheader/content/applicationjson/Int32JsonContentTypeHeaderSchema.kt -src/main/kotlin/org/openapijsonschematools/client/components/headers/numberheader/NumberHeaderSchema.kt -src/main/kotlin/org/openapijsonschematools/client/components/headers/refcontentschemaheader/content/applicationjson/RefContentSchemaHeaderSchema.kt -src/main/kotlin/org/openapijsonschematools/client/components/headers/refschemaheader/RefSchemaHeaderSchema.kt -src/main/kotlin/org/openapijsonschematools/client/components/headers/stringheader/StringHeaderSchema.kt -src/main/kotlin/org/openapijsonschematools/client/components/parameters/ComponentRefSchemaStringWithValidation.kt -src/main/kotlin/org/openapijsonschematools/client/components/parameters/PathUserName.kt -src/main/kotlin/org/openapijsonschematools/client/components/parameters/RefPathUserName.kt -src/main/kotlin/org/openapijsonschematools/client/components/parameters/RefSchemaStringWithValidation.kt -src/main/kotlin/org/openapijsonschematools/client/components/parameters/componentrefschemastringwithvalidation/content/applicationjson/ApplicationjsonSchema.kt -src/main/kotlin/org/openapijsonschematools/client/components/parameters/pathusername/Schema.kt -src/main/kotlin/org/openapijsonschematools/client/components/parameters/refschemastringwithvalidation/Schema.kt -src/main/kotlin/org/openapijsonschematools/client/components/requestbodies/Client.kt -src/main/kotlin/org/openapijsonschematools/client/components/requestbodies/Pet.kt -src/main/kotlin/org/openapijsonschematools/client/components/requestbodies/RefUserArray.kt -src/main/kotlin/org/openapijsonschematools/client/components/requestbodies/UserArray.kt -src/main/kotlin/org/openapijsonschematools/client/components/requestbodies/client/content/applicationjson/ApplicationjsonSchema.kt -src/main/kotlin/org/openapijsonschematools/client/components/requestbodies/pet/content/applicationjson/ApplicationjsonSchema.kt -src/main/kotlin/org/openapijsonschematools/client/components/requestbodies/pet/content/applicationxml/ApplicationxmlSchema.kt -src/main/kotlin/org/openapijsonschematools/client/components/requestbodies/userarray/content/applicationjson/ApplicationjsonSchema.kt -src/main/kotlin/org/openapijsonschematools/client/components/responses/HeadersWithNoBody.kt -src/main/kotlin/org/openapijsonschematools/client/components/responses/RefSuccessDescriptionOnly.kt -src/main/kotlin/org/openapijsonschematools/client/components/responses/RefSuccessfulXmlAndJsonArrayOfPet.kt -src/main/kotlin/org/openapijsonschematools/client/components/responses/SuccessDescriptionOnly.kt -src/main/kotlin/org/openapijsonschematools/client/components/responses/SuccessInlineContentAndHeader.kt -src/main/kotlin/org/openapijsonschematools/client/components/responses/SuccessWithJsonApiResponse.kt -src/main/kotlin/org/openapijsonschematools/client/components/responses/SuccessfulXmlAndJsonArrayOfPet.kt -src/main/kotlin/org/openapijsonschematools/client/components/responses/headerswithnobody/Headers.kt -src/main/kotlin/org/openapijsonschematools/client/components/responses/headerswithnobody/HeadersWithNoBodyHeadersSchema.kt -src/main/kotlin/org/openapijsonschematools/client/components/responses/headerswithnobody/headers/Location.kt -src/main/kotlin/org/openapijsonschematools/client/components/responses/headerswithnobody/headers/location/LocationSchema.kt -src/main/kotlin/org/openapijsonschematools/client/components/responses/successfulxmlandjsonarrayofpet/content/applicationjson/ApplicationjsonSchema.kt -src/main/kotlin/org/openapijsonschematools/client/components/responses/successfulxmlandjsonarrayofpet/content/applicationxml/ApplicationxmlSchema.kt -src/main/kotlin/org/openapijsonschematools/client/components/responses/successinlinecontentandheader/Headers.kt -src/main/kotlin/org/openapijsonschematools/client/components/responses/successinlinecontentandheader/SuccessInlineContentAndHeaderHeadersSchema.kt -src/main/kotlin/org/openapijsonschematools/client/components/responses/successinlinecontentandheader/content/applicationjson/ApplicationjsonSchema.kt -src/main/kotlin/org/openapijsonschematools/client/components/responses/successinlinecontentandheader/headers/SomeHeader.kt -src/main/kotlin/org/openapijsonschematools/client/components/responses/successinlinecontentandheader/headers/someheader/SomeHeaderSchema.kt -src/main/kotlin/org/openapijsonschematools/client/components/responses/successwithjsonapiresponse/Headers.kt -src/main/kotlin/org/openapijsonschematools/client/components/responses/successwithjsonapiresponse/SuccessWithJsonApiResponseHeadersSchema.kt -src/main/kotlin/org/openapijsonschematools/client/components/responses/successwithjsonapiresponse/content/applicationjson/ApplicationjsonSchema.kt -src/main/kotlin/org/openapijsonschematools/client/components/responses/successwithjsonapiresponse/headers/Int32.kt -src/main/kotlin/org/openapijsonschematools/client/components/responses/successwithjsonapiresponse/headers/NumberHeader.kt -src/main/kotlin/org/openapijsonschematools/client/components/responses/successwithjsonapiresponse/headers/Refcontentschemaheader.kt -src/main/kotlin/org/openapijsonschematools/client/components/responses/successwithjsonapiresponse/headers/Refschemaheader.kt -src/main/kotlin/org/openapijsonschematools/client/components/responses/successwithjsonapiresponse/headers/StringHeader.kt -src/main/kotlin/org/openapijsonschematools/client/components/schemas/AbstractStepMessage.kt -src/main/kotlin/org/openapijsonschematools/client/components/schemas/AdditionalPropertiesClass.kt -src/main/kotlin/org/openapijsonschematools/client/components/schemas/AdditionalPropertiesSchema.kt -src/main/kotlin/org/openapijsonschematools/client/components/schemas/AdditionalPropertiesWithArrayOfEnums.kt -src/main/kotlin/org/openapijsonschematools/client/components/schemas/Address.kt -src/main/kotlin/org/openapijsonschematools/client/components/schemas/Animal.kt -src/main/kotlin/org/openapijsonschematools/client/components/schemas/AnimalFarm.kt -src/main/kotlin/org/openapijsonschematools/client/components/schemas/AnyTypeAndFormat.kt -src/main/kotlin/org/openapijsonschematools/client/components/schemas/AnyTypeNotString.kt -src/main/kotlin/org/openapijsonschematools/client/components/schemas/ApiResponseSchema.kt -src/main/kotlin/org/openapijsonschematools/client/components/schemas/Apple.kt -src/main/kotlin/org/openapijsonschematools/client/components/schemas/AppleReq.kt -src/main/kotlin/org/openapijsonschematools/client/components/schemas/ArrayHoldingAnyType.kt -src/main/kotlin/org/openapijsonschematools/client/components/schemas/ArrayOfArrayOfNumberOnly.kt -src/main/kotlin/org/openapijsonschematools/client/components/schemas/ArrayOfEnums.kt -src/main/kotlin/org/openapijsonschematools/client/components/schemas/ArrayOfNumberOnly.kt -src/main/kotlin/org/openapijsonschematools/client/components/schemas/ArrayTest.kt -src/main/kotlin/org/openapijsonschematools/client/components/schemas/ArrayWithValidationsInItems.kt -src/main/kotlin/org/openapijsonschematools/client/components/schemas/Banana.kt -src/main/kotlin/org/openapijsonschematools/client/components/schemas/BananaReq.kt -src/main/kotlin/org/openapijsonschematools/client/components/schemas/Bar.kt -src/main/kotlin/org/openapijsonschematools/client/components/schemas/BasquePig.kt -src/main/kotlin/org/openapijsonschematools/client/components/schemas/BooleanEnum.kt -src/main/kotlin/org/openapijsonschematools/client/components/schemas/BooleanSchema.kt -src/main/kotlin/org/openapijsonschematools/client/components/schemas/Capitalization.kt -src/main/kotlin/org/openapijsonschematools/client/components/schemas/Cat.kt -src/main/kotlin/org/openapijsonschematools/client/components/schemas/Category.kt -src/main/kotlin/org/openapijsonschematools/client/components/schemas/ChildCat.kt -src/main/kotlin/org/openapijsonschematools/client/components/schemas/ClassModel.kt -src/main/kotlin/org/openapijsonschematools/client/components/schemas/Client.kt -src/main/kotlin/org/openapijsonschematools/client/components/schemas/ComplexQuadrilateral.kt -src/main/kotlin/org/openapijsonschematools/client/components/schemas/ComposedAnyOfDifferentTypesNoValidations.kt -src/main/kotlin/org/openapijsonschematools/client/components/schemas/ComposedArray.kt -src/main/kotlin/org/openapijsonschematools/client/components/schemas/ComposedBool.kt -src/main/kotlin/org/openapijsonschematools/client/components/schemas/ComposedNone.kt -src/main/kotlin/org/openapijsonschematools/client/components/schemas/ComposedNumber.kt -src/main/kotlin/org/openapijsonschematools/client/components/schemas/ComposedObject.kt -src/main/kotlin/org/openapijsonschematools/client/components/schemas/ComposedOneOfDifferentTypes.kt -src/main/kotlin/org/openapijsonschematools/client/components/schemas/ComposedString.kt -src/main/kotlin/org/openapijsonschematools/client/components/schemas/Currency.kt -src/main/kotlin/org/openapijsonschematools/client/components/schemas/DanishPig.kt -src/main/kotlin/org/openapijsonschematools/client/components/schemas/DateTimeTest.kt -src/main/kotlin/org/openapijsonschematools/client/components/schemas/DateTimeWithValidations.kt -src/main/kotlin/org/openapijsonschematools/client/components/schemas/DateWithValidations.kt -src/main/kotlin/org/openapijsonschematools/client/components/schemas/DecimalPayload.kt -src/main/kotlin/org/openapijsonschematools/client/components/schemas/Dog.kt -src/main/kotlin/org/openapijsonschematools/client/components/schemas/Drawing.kt -src/main/kotlin/org/openapijsonschematools/client/components/schemas/EnumArrays.kt -src/main/kotlin/org/openapijsonschematools/client/components/schemas/EnumClass.kt -src/main/kotlin/org/openapijsonschematools/client/components/schemas/EnumTest.kt -src/main/kotlin/org/openapijsonschematools/client/components/schemas/EquilateralTriangle.kt -src/main/kotlin/org/openapijsonschematools/client/components/schemas/File.kt -src/main/kotlin/org/openapijsonschematools/client/components/schemas/FileSchemaTestClass.kt -src/main/kotlin/org/openapijsonschematools/client/components/schemas/Foo.kt -src/main/kotlin/org/openapijsonschematools/client/components/schemas/FormatTest.kt -src/main/kotlin/org/openapijsonschematools/client/components/schemas/FromSchema.kt -src/main/kotlin/org/openapijsonschematools/client/components/schemas/Fruit.kt -src/main/kotlin/org/openapijsonschematools/client/components/schemas/FruitReq.kt -src/main/kotlin/org/openapijsonschematools/client/components/schemas/GmFruit.kt -src/main/kotlin/org/openapijsonschematools/client/components/schemas/GrandparentAnimal.kt -src/main/kotlin/org/openapijsonschematools/client/components/schemas/HasOnlyReadOnly.kt -src/main/kotlin/org/openapijsonschematools/client/components/schemas/HealthCheckResult.kt -src/main/kotlin/org/openapijsonschematools/client/components/schemas/IntegerEnum.kt -src/main/kotlin/org/openapijsonschematools/client/components/schemas/IntegerEnumBig.kt -src/main/kotlin/org/openapijsonschematools/client/components/schemas/IntegerEnumOneValue.kt -src/main/kotlin/org/openapijsonschematools/client/components/schemas/IntegerEnumWithDefaultValue.kt -src/main/kotlin/org/openapijsonschematools/client/components/schemas/IntegerMax10.kt -src/main/kotlin/org/openapijsonschematools/client/components/schemas/IntegerMin15.kt -src/main/kotlin/org/openapijsonschematools/client/components/schemas/IsoscelesTriangle.kt -src/main/kotlin/org/openapijsonschematools/client/components/schemas/Items.kt -src/main/kotlin/org/openapijsonschematools/client/components/schemas/ItemsSchema.kt -src/main/kotlin/org/openapijsonschematools/client/components/schemas/JSONPatchRequest.kt -src/main/kotlin/org/openapijsonschematools/client/components/schemas/JSONPatchRequestAddReplaceTest.kt -src/main/kotlin/org/openapijsonschematools/client/components/schemas/JSONPatchRequestMoveCopy.kt -src/main/kotlin/org/openapijsonschematools/client/components/schemas/JSONPatchRequestRemove.kt -src/main/kotlin/org/openapijsonschematools/client/components/schemas/Mammal.kt -src/main/kotlin/org/openapijsonschematools/client/components/schemas/MapTest.kt -src/main/kotlin/org/openapijsonschematools/client/components/schemas/MixedPropertiesAndAdditionalPropertiesClass.kt -src/main/kotlin/org/openapijsonschematools/client/components/schemas/Money.kt -src/main/kotlin/org/openapijsonschematools/client/components/schemas/MultiPropertiesSchema.kt -src/main/kotlin/org/openapijsonschematools/client/components/schemas/MyObjectDto.kt -src/main/kotlin/org/openapijsonschematools/client/components/schemas/Name.kt -src/main/kotlin/org/openapijsonschematools/client/components/schemas/NoAdditionalProperties.kt -src/main/kotlin/org/openapijsonschematools/client/components/schemas/NullableClass.kt -src/main/kotlin/org/openapijsonschematools/client/components/schemas/NullableShape.kt -src/main/kotlin/org/openapijsonschematools/client/components/schemas/NullableString.kt -src/main/kotlin/org/openapijsonschematools/client/components/schemas/NumberOnly.kt -src/main/kotlin/org/openapijsonschematools/client/components/schemas/NumberSchema.kt -src/main/kotlin/org/openapijsonschematools/client/components/schemas/NumberWithExclusiveMinMax.kt -src/main/kotlin/org/openapijsonschematools/client/components/schemas/NumberWithValidations.kt -src/main/kotlin/org/openapijsonschematools/client/components/schemas/ObjWithRequiredProps.kt -src/main/kotlin/org/openapijsonschematools/client/components/schemas/ObjWithRequiredPropsBase.kt -src/main/kotlin/org/openapijsonschematools/client/components/schemas/ObjectInterface.kt -src/main/kotlin/org/openapijsonschematools/client/components/schemas/ObjectModelWithArgAndArgsProperties.kt -src/main/kotlin/org/openapijsonschematools/client/components/schemas/ObjectModelWithRefProps.kt -src/main/kotlin/org/openapijsonschematools/client/components/schemas/ObjectWithAllOfWithReqTestPropFromUnsetAddProp.kt -src/main/kotlin/org/openapijsonschematools/client/components/schemas/ObjectWithCollidingProperties.kt -src/main/kotlin/org/openapijsonschematools/client/components/schemas/ObjectWithDecimalProperties.kt -src/main/kotlin/org/openapijsonschematools/client/components/schemas/ObjectWithDifficultlyNamedProps.kt -src/main/kotlin/org/openapijsonschematools/client/components/schemas/ObjectWithInlineCompositionProperty.kt -src/main/kotlin/org/openapijsonschematools/client/components/schemas/ObjectWithInvalidNamedRefedProperties.kt -src/main/kotlin/org/openapijsonschematools/client/components/schemas/ObjectWithNonIntersectingValues.kt -src/main/kotlin/org/openapijsonschematools/client/components/schemas/ObjectWithOnlyOptionalProps.kt -src/main/kotlin/org/openapijsonschematools/client/components/schemas/ObjectWithOptionalTestProp.kt -src/main/kotlin/org/openapijsonschematools/client/components/schemas/ObjectWithValidations.kt -src/main/kotlin/org/openapijsonschematools/client/components/schemas/Order.kt -src/main/kotlin/org/openapijsonschematools/client/components/schemas/PaginatedResultMyObjectDto.kt -src/main/kotlin/org/openapijsonschematools/client/components/schemas/ParentPet.kt -src/main/kotlin/org/openapijsonschematools/client/components/schemas/Pet.kt -src/main/kotlin/org/openapijsonschematools/client/components/schemas/Pig.kt -src/main/kotlin/org/openapijsonschematools/client/components/schemas/Player.kt -src/main/kotlin/org/openapijsonschematools/client/components/schemas/PublicKey.kt -src/main/kotlin/org/openapijsonschematools/client/components/schemas/Quadrilateral.kt -src/main/kotlin/org/openapijsonschematools/client/components/schemas/QuadrilateralInterface.kt -src/main/kotlin/org/openapijsonschematools/client/components/schemas/ReadOnlyFirst.kt -src/main/kotlin/org/openapijsonschematools/client/components/schemas/RefPet.kt -src/main/kotlin/org/openapijsonschematools/client/components/schemas/ReqPropsFromExplicitAddProps.kt -src/main/kotlin/org/openapijsonschematools/client/components/schemas/ReqPropsFromTrueAddProps.kt -src/main/kotlin/org/openapijsonschematools/client/components/schemas/ReqPropsFromUnsetAddProps.kt -src/main/kotlin/org/openapijsonschematools/client/components/schemas/ReturnSchema.kt -src/main/kotlin/org/openapijsonschematools/client/components/schemas/ScaleneTriangle.kt -src/main/kotlin/org/openapijsonschematools/client/components/schemas/Schema200Response.kt -src/main/kotlin/org/openapijsonschematools/client/components/schemas/SelfReferencingArrayModel.kt -src/main/kotlin/org/openapijsonschematools/client/components/schemas/SelfReferencingObjectModel.kt -src/main/kotlin/org/openapijsonschematools/client/components/schemas/Shape.kt -src/main/kotlin/org/openapijsonschematools/client/components/schemas/ShapeOrNull.kt -src/main/kotlin/org/openapijsonschematools/client/components/schemas/SimpleQuadrilateral.kt -src/main/kotlin/org/openapijsonschematools/client/components/schemas/SomeObject.kt -src/main/kotlin/org/openapijsonschematools/client/components/schemas/SpecialModelname.kt -src/main/kotlin/org/openapijsonschematools/client/components/schemas/StringBooleanMap.kt -src/main/kotlin/org/openapijsonschematools/client/components/schemas/StringEnum.kt -src/main/kotlin/org/openapijsonschematools/client/components/schemas/StringEnumWithDefaultValue.kt -src/main/kotlin/org/openapijsonschematools/client/components/schemas/StringSchema.kt -src/main/kotlin/org/openapijsonschematools/client/components/schemas/StringWithValidation.kt -src/main/kotlin/org/openapijsonschematools/client/components/schemas/Tag.kt -src/main/kotlin/org/openapijsonschematools/client/components/schemas/Triangle.kt -src/main/kotlin/org/openapijsonschematools/client/components/schemas/TriangleInterface.kt -src/main/kotlin/org/openapijsonschematools/client/components/schemas/UUIDString.kt -src/main/kotlin/org/openapijsonschematools/client/components/schemas/User.kt -src/main/kotlin/org/openapijsonschematools/client/components/schemas/Whale.kt -src/main/kotlin/org/openapijsonschematools/client/components/schemas/Zebra.kt -src/main/kotlin/org/openapijsonschematools/client/components/securityschemes/ApiKey.kt -src/main/kotlin/org/openapijsonschematools/client/components/securityschemes/ApiKeyQuery.kt -src/main/kotlin/org/openapijsonschematools/client/components/securityschemes/BearerTest.kt -src/main/kotlin/org/openapijsonschematools/client/components/securityschemes/HttpBasicTest.kt -src/main/kotlin/org/openapijsonschematools/client/components/securityschemes/HttpSignatureTest.kt -src/main/kotlin/org/openapijsonschematools/client/components/securityschemes/OpenIdConnectTest.kt -src/main/kotlin/org/openapijsonschematools/client/components/securityschemes/PetstoreAuth.kt -src/main/kotlin/org/openapijsonschematools/client/configurations/ApiConfiguration.kt -src/main/kotlin/org/openapijsonschematools/client/configurations/JsonSchemaKeywordFlags.kt -src/main/kotlin/org/openapijsonschematools/client/configurations/SchemaConfiguration.kt -src/main/kotlin/org/openapijsonschematools/client/contenttype/ContentTypeDeserializer.kt -src/main/kotlin/org/openapijsonschematools/client/contenttype/ContentTypeDetector.kt -src/main/kotlin/org/openapijsonschematools/client/contenttype/ContentTypeSerializer.kt -src/main/kotlin/org/openapijsonschematools/client/exceptions/ApiException.kt -src/main/kotlin/org/openapijsonschematools/client/exceptions/BaseException.kt -src/main/kotlin/org/openapijsonschematools/client/exceptions/InvalidAdditionalPropertyException.kt -src/main/kotlin/org/openapijsonschematools/client/exceptions/NotImplementedException.kt -src/main/kotlin/org/openapijsonschematools/client/exceptions/UnsetPropertyException.kt -src/main/kotlin/org/openapijsonschematools/client/exceptions/ValidationException.kt -src/main/kotlin/org/openapijsonschematools/client/header/ContentHeader.kt -src/main/kotlin/org/openapijsonschematools/client/header/Header.kt -src/main/kotlin/org/openapijsonschematools/client/header/HeaderBase.kt -src/main/kotlin/org/openapijsonschematools/client/header/PrefixSeparatorIterator.kt -src/main/kotlin/org/openapijsonschematools/client/header/Rfc6570Serializer.kt -src/main/kotlin/org/openapijsonschematools/client/header/SchemaHeader.kt -src/main/kotlin/org/openapijsonschematools/client/header/StyleSerializer.kt -src/main/kotlin/org/openapijsonschematools/client/mediatype/Encoding.kt -src/main/kotlin/org/openapijsonschematools/client/mediatype/MediaType.kt -src/main/kotlin/org/openapijsonschematools/client/parameter/ContentParameter.kt -src/main/kotlin/org/openapijsonschematools/client/parameter/CookieSerializer.kt -src/main/kotlin/org/openapijsonschematools/client/parameter/HeadersSerializer.kt -src/main/kotlin/org/openapijsonschematools/client/parameter/Parameter.kt -src/main/kotlin/org/openapijsonschematools/client/parameter/ParameterBase.kt -src/main/kotlin/org/openapijsonschematools/client/parameter/ParameterInType.kt -src/main/kotlin/org/openapijsonschematools/client/parameter/ParameterStyle.kt -src/main/kotlin/org/openapijsonschematools/client/parameter/PathSerializer.kt -src/main/kotlin/org/openapijsonschematools/client/parameter/QuerySerializer.kt -src/main/kotlin/org/openapijsonschematools/client/parameter/SchemaParameter.kt -src/main/kotlin/org/openapijsonschematools/client/paths/Anotherfakedummy.kt -src/main/kotlin/org/openapijsonschematools/client/paths/Commonparamsubdir.kt -src/main/kotlin/org/openapijsonschematools/client/paths/Fake.kt -src/main/kotlin/org/openapijsonschematools/client/paths/Fakeadditionalpropertieswitharrayofenums.kt -src/main/kotlin/org/openapijsonschematools/client/paths/Fakebodywithfileschema.kt -src/main/kotlin/org/openapijsonschematools/client/paths/Fakebodywithqueryparams.kt -src/main/kotlin/org/openapijsonschematools/client/paths/Fakecasesensitiveparams.kt -src/main/kotlin/org/openapijsonschematools/client/paths/Fakeclassnametest.kt -src/main/kotlin/org/openapijsonschematools/client/paths/Fakedeletecoffeeid.kt -src/main/kotlin/org/openapijsonschematools/client/paths/Fakehealth.kt -src/main/kotlin/org/openapijsonschematools/client/paths/Fakeinlineadditionalproperties.kt -src/main/kotlin/org/openapijsonschematools/client/paths/Fakeinlinecomposition.kt -src/main/kotlin/org/openapijsonschematools/client/paths/Fakejsonformdata.kt -src/main/kotlin/org/openapijsonschematools/client/paths/Fakejsonpatch.kt -src/main/kotlin/org/openapijsonschematools/client/paths/Fakejsonwithcharset.kt -src/main/kotlin/org/openapijsonschematools/client/paths/Fakemultiplerequestbodycontenttypes.kt -src/main/kotlin/org/openapijsonschematools/client/paths/Fakemultipleresponsebodies.kt -src/main/kotlin/org/openapijsonschematools/client/paths/Fakemultiplesecurities.kt -src/main/kotlin/org/openapijsonschematools/client/paths/Fakeobjinquery.kt -src/main/kotlin/org/openapijsonschematools/client/paths/Fakeparametercollisions1ababselfab.kt -src/main/kotlin/org/openapijsonschematools/client/paths/Fakepemcontenttype.kt -src/main/kotlin/org/openapijsonschematools/client/paths/Fakepetiduploadimagewithrequiredfile.kt -src/main/kotlin/org/openapijsonschematools/client/paths/Fakequeryparamwithjsoncontenttype.kt -src/main/kotlin/org/openapijsonschematools/client/paths/Fakeredirection.kt -src/main/kotlin/org/openapijsonschematools/client/paths/Fakerefobjinquery.kt -src/main/kotlin/org/openapijsonschematools/client/paths/Fakerefsarraymodel.kt -src/main/kotlin/org/openapijsonschematools/client/paths/Fakerefsarrayofenums.kt -src/main/kotlin/org/openapijsonschematools/client/paths/Fakerefsboolean.kt -src/main/kotlin/org/openapijsonschematools/client/paths/Fakerefscomposedoneofnumberwithvalidations.kt -src/main/kotlin/org/openapijsonschematools/client/paths/Fakerefsenum.kt -src/main/kotlin/org/openapijsonschematools/client/paths/Fakerefsmammal.kt -src/main/kotlin/org/openapijsonschematools/client/paths/Fakerefsnumber.kt -src/main/kotlin/org/openapijsonschematools/client/paths/Fakerefsobjectmodelwithrefprops.kt -src/main/kotlin/org/openapijsonschematools/client/paths/Fakerefsstring.kt -src/main/kotlin/org/openapijsonschematools/client/paths/Fakeresponsewithoutschema.kt -src/main/kotlin/org/openapijsonschematools/client/paths/Faketestqueryparamters.kt -src/main/kotlin/org/openapijsonschematools/client/paths/Fakeuploaddownloadfile.kt -src/main/kotlin/org/openapijsonschematools/client/paths/Fakeuploadfile.kt -src/main/kotlin/org/openapijsonschematools/client/paths/Fakeuploadfiles.kt -src/main/kotlin/org/openapijsonschematools/client/paths/Fakewildcardresponses.kt -src/main/kotlin/org/openapijsonschematools/client/paths/Foo.kt -src/main/kotlin/org/openapijsonschematools/client/paths/Pet.kt -src/main/kotlin/org/openapijsonschematools/client/paths/Petfindbystatus.kt -src/main/kotlin/org/openapijsonschematools/client/paths/Petfindbytags.kt -src/main/kotlin/org/openapijsonschematools/client/paths/Petpetid.kt -src/main/kotlin/org/openapijsonschematools/client/paths/Petpetiduploadimage.kt -src/main/kotlin/org/openapijsonschematools/client/paths/Solidus.kt -src/main/kotlin/org/openapijsonschematools/client/paths/Storeinventory.kt -src/main/kotlin/org/openapijsonschematools/client/paths/Storeorder.kt -src/main/kotlin/org/openapijsonschematools/client/paths/Storeorderorderid.kt -src/main/kotlin/org/openapijsonschematools/client/paths/User.kt -src/main/kotlin/org/openapijsonschematools/client/paths/Usercreatewitharray.kt -src/main/kotlin/org/openapijsonschematools/client/paths/Usercreatewithlist.kt -src/main/kotlin/org/openapijsonschematools/client/paths/Userlogin.kt -src/main/kotlin/org/openapijsonschematools/client/paths/Userlogout.kt -src/main/kotlin/org/openapijsonschematools/client/paths/Userusername.kt -src/main/kotlin/org/openapijsonschematools/client/paths/anotherfakedummy/AnotherfakedummyPatch.kt -src/main/kotlin/org/openapijsonschematools/client/paths/anotherfakedummy/patch/AnotherfakedummyPatchRequestBody.kt -src/main/kotlin/org/openapijsonschematools/client/paths/anotherfakedummy/patch/AnotherfakedummyPatchResponses.kt -src/main/kotlin/org/openapijsonschematools/client/paths/anotherfakedummy/patch/responses/AnotherfakedummyPatchCode200Response.kt -src/main/kotlin/org/openapijsonschematools/client/paths/anotherfakedummy/patch/responses/code200response/content/applicationjson/ApplicationjsonSchema.kt -src/main/kotlin/org/openapijsonschematools/client/paths/commonparamsubdir/CommonparamsubdirDelete.kt -src/main/kotlin/org/openapijsonschematools/client/paths/commonparamsubdir/CommonparamsubdirGet.kt -src/main/kotlin/org/openapijsonschematools/client/paths/commonparamsubdir/CommonparamsubdirPost.kt -src/main/kotlin/org/openapijsonschematools/client/paths/commonparamsubdir/delete/CommonparamsubdirDeleteHeaderParameters.kt -src/main/kotlin/org/openapijsonschematools/client/paths/commonparamsubdir/delete/CommonparamsubdirDeletePathParameters.kt -src/main/kotlin/org/openapijsonschematools/client/paths/commonparamsubdir/delete/CommonparamsubdirDeleteResponses.kt -src/main/kotlin/org/openapijsonschematools/client/paths/commonparamsubdir/delete/Parameters.kt -src/main/kotlin/org/openapijsonschematools/client/paths/commonparamsubdir/delete/parameters/Parameter0.kt -src/main/kotlin/org/openapijsonschematools/client/paths/commonparamsubdir/delete/parameters/Parameter1.kt -src/main/kotlin/org/openapijsonschematools/client/paths/commonparamsubdir/delete/parameters/parameter0/Schema0.kt -src/main/kotlin/org/openapijsonschematools/client/paths/commonparamsubdir/delete/parameters/parameter1/Schema1.kt -src/main/kotlin/org/openapijsonschematools/client/paths/commonparamsubdir/delete/responses/CommonparamsubdirDeleteCode200Response.kt -src/main/kotlin/org/openapijsonschematools/client/paths/commonparamsubdir/get/CommonparamsubdirGetPathParameters.kt -src/main/kotlin/org/openapijsonschematools/client/paths/commonparamsubdir/get/CommonparamsubdirGetQueryParameters.kt -src/main/kotlin/org/openapijsonschematools/client/paths/commonparamsubdir/get/CommonparamsubdirGetResponses.kt -src/main/kotlin/org/openapijsonschematools/client/paths/commonparamsubdir/get/Parameters.kt -src/main/kotlin/org/openapijsonschematools/client/paths/commonparamsubdir/get/parameters/Parameter0.kt -src/main/kotlin/org/openapijsonschematools/client/paths/commonparamsubdir/get/parameters/parameter0/Schema0.kt -src/main/kotlin/org/openapijsonschematools/client/paths/commonparamsubdir/get/responses/CommonparamsubdirGetCode200Response.kt -src/main/kotlin/org/openapijsonschematools/client/paths/commonparamsubdir/parameters/RouteParameter0.kt -src/main/kotlin/org/openapijsonschematools/client/paths/commonparamsubdir/parameters/routeparameter0/RouteParamSchema0.kt -src/main/kotlin/org/openapijsonschematools/client/paths/commonparamsubdir/post/CommonparamsubdirPostHeaderParameters.kt -src/main/kotlin/org/openapijsonschematools/client/paths/commonparamsubdir/post/CommonparamsubdirPostPathParameters.kt -src/main/kotlin/org/openapijsonschematools/client/paths/commonparamsubdir/post/CommonparamsubdirPostResponses.kt -src/main/kotlin/org/openapijsonschematools/client/paths/commonparamsubdir/post/Parameters.kt -src/main/kotlin/org/openapijsonschematools/client/paths/commonparamsubdir/post/parameters/Parameter0.kt -src/main/kotlin/org/openapijsonschematools/client/paths/commonparamsubdir/post/parameters/parameter0/Schema0.kt -src/main/kotlin/org/openapijsonschematools/client/paths/commonparamsubdir/post/responses/CommonparamsubdirPostCode200Response.kt -src/main/kotlin/org/openapijsonschematools/client/paths/fake/FakeDelete.kt -src/main/kotlin/org/openapijsonschematools/client/paths/fake/FakeGet.kt -src/main/kotlin/org/openapijsonschematools/client/paths/fake/FakePatch.kt -src/main/kotlin/org/openapijsonschematools/client/paths/fake/FakePost.kt -src/main/kotlin/org/openapijsonschematools/client/paths/fake/delete/FakeDeleteHeaderParameters.kt -src/main/kotlin/org/openapijsonschematools/client/paths/fake/delete/FakeDeleteQueryParameters.kt -src/main/kotlin/org/openapijsonschematools/client/paths/fake/delete/FakeDeleteResponses.kt -src/main/kotlin/org/openapijsonschematools/client/paths/fake/delete/FakeDeleteSecurityInfo.kt -src/main/kotlin/org/openapijsonschematools/client/paths/fake/delete/Parameters.kt -src/main/kotlin/org/openapijsonschematools/client/paths/fake/delete/parameters/Parameter0.kt -src/main/kotlin/org/openapijsonschematools/client/paths/fake/delete/parameters/Parameter1.kt -src/main/kotlin/org/openapijsonschematools/client/paths/fake/delete/parameters/Parameter2.kt -src/main/kotlin/org/openapijsonschematools/client/paths/fake/delete/parameters/Parameter3.kt -src/main/kotlin/org/openapijsonschematools/client/paths/fake/delete/parameters/Parameter4.kt -src/main/kotlin/org/openapijsonschematools/client/paths/fake/delete/parameters/Parameter5.kt -src/main/kotlin/org/openapijsonschematools/client/paths/fake/delete/parameters/parameter0/Schema0.kt -src/main/kotlin/org/openapijsonschematools/client/paths/fake/delete/parameters/parameter1/Schema1.kt -src/main/kotlin/org/openapijsonschematools/client/paths/fake/delete/parameters/parameter2/Schema2.kt -src/main/kotlin/org/openapijsonschematools/client/paths/fake/delete/parameters/parameter3/Schema3.kt -src/main/kotlin/org/openapijsonschematools/client/paths/fake/delete/parameters/parameter4/Schema4.kt -src/main/kotlin/org/openapijsonschematools/client/paths/fake/delete/parameters/parameter5/Schema5.kt -src/main/kotlin/org/openapijsonschematools/client/paths/fake/delete/responses/FakeDeleteCode200Response.kt -src/main/kotlin/org/openapijsonschematools/client/paths/fake/delete/security/FakeDeleteSecurityRequirementObject0.kt -src/main/kotlin/org/openapijsonschematools/client/paths/fake/get/FakeGetHeaderParameters.kt -src/main/kotlin/org/openapijsonschematools/client/paths/fake/get/FakeGetQueryParameters.kt -src/main/kotlin/org/openapijsonschematools/client/paths/fake/get/FakeGetRequestBody.kt -src/main/kotlin/org/openapijsonschematools/client/paths/fake/get/FakeGetResponses.kt -src/main/kotlin/org/openapijsonschematools/client/paths/fake/get/Parameters.kt -src/main/kotlin/org/openapijsonschematools/client/paths/fake/get/parameters/Parameter0.kt -src/main/kotlin/org/openapijsonschematools/client/paths/fake/get/parameters/Parameter1.kt -src/main/kotlin/org/openapijsonschematools/client/paths/fake/get/parameters/Parameter2.kt -src/main/kotlin/org/openapijsonschematools/client/paths/fake/get/parameters/Parameter3.kt -src/main/kotlin/org/openapijsonschematools/client/paths/fake/get/parameters/Parameter4.kt -src/main/kotlin/org/openapijsonschematools/client/paths/fake/get/parameters/Parameter5.kt -src/main/kotlin/org/openapijsonschematools/client/paths/fake/get/parameters/parameter0/Schema0.kt -src/main/kotlin/org/openapijsonschematools/client/paths/fake/get/parameters/parameter1/Schema1.kt -src/main/kotlin/org/openapijsonschematools/client/paths/fake/get/parameters/parameter2/Schema2.kt -src/main/kotlin/org/openapijsonschematools/client/paths/fake/get/parameters/parameter3/Schema3.kt -src/main/kotlin/org/openapijsonschematools/client/paths/fake/get/parameters/parameter4/Schema4.kt -src/main/kotlin/org/openapijsonschematools/client/paths/fake/get/parameters/parameter5/Schema5.kt -src/main/kotlin/org/openapijsonschematools/client/paths/fake/get/requestbody/content/applicationxwwwformurlencoded/ApplicationxwwwformurlencodedSchema.kt -src/main/kotlin/org/openapijsonschematools/client/paths/fake/get/responses/FakeGetCode200Response.kt -src/main/kotlin/org/openapijsonschematools/client/paths/fake/get/responses/FakeGetCode404Response.kt -src/main/kotlin/org/openapijsonschematools/client/paths/fake/get/responses/code404response/content/applicationjson/ApplicationjsonSchema.kt -src/main/kotlin/org/openapijsonschematools/client/paths/fake/patch/FakePatchRequestBody.kt -src/main/kotlin/org/openapijsonschematools/client/paths/fake/patch/FakePatchResponses.kt -src/main/kotlin/org/openapijsonschematools/client/paths/fake/patch/responses/FakePatchCode200Response.kt -src/main/kotlin/org/openapijsonschematools/client/paths/fake/patch/responses/code200response/content/applicationjson/ApplicationjsonSchema.kt -src/main/kotlin/org/openapijsonschematools/client/paths/fake/post/FakePostRequestBody.kt -src/main/kotlin/org/openapijsonschematools/client/paths/fake/post/FakePostResponses.kt -src/main/kotlin/org/openapijsonschematools/client/paths/fake/post/FakePostSecurityInfo.kt -src/main/kotlin/org/openapijsonschematools/client/paths/fake/post/requestbody/content/applicationxwwwformurlencoded/ApplicationxwwwformurlencodedSchema.kt -src/main/kotlin/org/openapijsonschematools/client/paths/fake/post/responses/FakePostCode200Response.kt -src/main/kotlin/org/openapijsonschematools/client/paths/fake/post/responses/FakePostCode404Response.kt -src/main/kotlin/org/openapijsonschematools/client/paths/fake/post/security/FakePostSecurityRequirementObject0.kt -src/main/kotlin/org/openapijsonschematools/client/paths/fakeadditionalpropertieswitharrayofenums/FakeadditionalpropertieswitharrayofenumsGet.kt -src/main/kotlin/org/openapijsonschematools/client/paths/fakeadditionalpropertieswitharrayofenums/get/FakeadditionalpropertieswitharrayofenumsGetRequestBody.kt -src/main/kotlin/org/openapijsonschematools/client/paths/fakeadditionalpropertieswitharrayofenums/get/FakeadditionalpropertieswitharrayofenumsGetResponses.kt -src/main/kotlin/org/openapijsonschematools/client/paths/fakeadditionalpropertieswitharrayofenums/get/requestbody/content/applicationjson/ApplicationjsonSchema.kt -src/main/kotlin/org/openapijsonschematools/client/paths/fakeadditionalpropertieswitharrayofenums/get/responses/FakeadditionalpropertieswitharrayofenumsGetCode200Response.kt -src/main/kotlin/org/openapijsonschematools/client/paths/fakeadditionalpropertieswitharrayofenums/get/responses/code200response/content/applicationjson/ApplicationjsonSchema.kt -src/main/kotlin/org/openapijsonschematools/client/paths/fakebodywithfileschema/FakebodywithfileschemaPut.kt -src/main/kotlin/org/openapijsonschematools/client/paths/fakebodywithfileschema/put/FakebodywithfileschemaPutRequestBody.kt -src/main/kotlin/org/openapijsonschematools/client/paths/fakebodywithfileschema/put/FakebodywithfileschemaPutResponses.kt -src/main/kotlin/org/openapijsonschematools/client/paths/fakebodywithfileschema/put/requestbody/content/applicationjson/ApplicationjsonSchema.kt -src/main/kotlin/org/openapijsonschematools/client/paths/fakebodywithfileschema/put/responses/FakebodywithfileschemaPutCode200Response.kt -src/main/kotlin/org/openapijsonschematools/client/paths/fakebodywithqueryparams/FakebodywithqueryparamsPut.kt -src/main/kotlin/org/openapijsonschematools/client/paths/fakebodywithqueryparams/put/FakebodywithqueryparamsPutQueryParameters.kt -src/main/kotlin/org/openapijsonschematools/client/paths/fakebodywithqueryparams/put/FakebodywithqueryparamsPutRequestBody.kt -src/main/kotlin/org/openapijsonschematools/client/paths/fakebodywithqueryparams/put/FakebodywithqueryparamsPutResponses.kt -src/main/kotlin/org/openapijsonschematools/client/paths/fakebodywithqueryparams/put/Parameters.kt -src/main/kotlin/org/openapijsonschematools/client/paths/fakebodywithqueryparams/put/parameters/Parameter0.kt -src/main/kotlin/org/openapijsonschematools/client/paths/fakebodywithqueryparams/put/parameters/parameter0/Schema0.kt -src/main/kotlin/org/openapijsonschematools/client/paths/fakebodywithqueryparams/put/requestbody/content/applicationjson/ApplicationjsonSchema.kt -src/main/kotlin/org/openapijsonschematools/client/paths/fakebodywithqueryparams/put/responses/FakebodywithqueryparamsPutCode200Response.kt -src/main/kotlin/org/openapijsonschematools/client/paths/fakecasesensitiveparams/FakecasesensitiveparamsPut.kt -src/main/kotlin/org/openapijsonschematools/client/paths/fakecasesensitiveparams/put/FakecasesensitiveparamsPutQueryParameters.kt -src/main/kotlin/org/openapijsonschematools/client/paths/fakecasesensitiveparams/put/FakecasesensitiveparamsPutResponses.kt -src/main/kotlin/org/openapijsonschematools/client/paths/fakecasesensitiveparams/put/Parameters.kt -src/main/kotlin/org/openapijsonschematools/client/paths/fakecasesensitiveparams/put/parameters/Parameter0.kt -src/main/kotlin/org/openapijsonschematools/client/paths/fakecasesensitiveparams/put/parameters/Parameter1.kt -src/main/kotlin/org/openapijsonschematools/client/paths/fakecasesensitiveparams/put/parameters/Parameter2.kt -src/main/kotlin/org/openapijsonschematools/client/paths/fakecasesensitiveparams/put/parameters/parameter0/Schema0.kt -src/main/kotlin/org/openapijsonschematools/client/paths/fakecasesensitiveparams/put/parameters/parameter1/Schema1.kt -src/main/kotlin/org/openapijsonschematools/client/paths/fakecasesensitiveparams/put/parameters/parameter2/Schema2.kt -src/main/kotlin/org/openapijsonschematools/client/paths/fakecasesensitiveparams/put/responses/FakecasesensitiveparamsPutCode200Response.kt -src/main/kotlin/org/openapijsonschematools/client/paths/fakeclassnametest/FakeclassnametestPatch.kt -src/main/kotlin/org/openapijsonschematools/client/paths/fakeclassnametest/patch/FakeclassnametestPatchRequestBody.kt -src/main/kotlin/org/openapijsonschematools/client/paths/fakeclassnametest/patch/FakeclassnametestPatchResponses.kt -src/main/kotlin/org/openapijsonschematools/client/paths/fakeclassnametest/patch/FakeclassnametestPatchSecurityInfo.kt -src/main/kotlin/org/openapijsonschematools/client/paths/fakeclassnametest/patch/responses/FakeclassnametestPatchCode200Response.kt -src/main/kotlin/org/openapijsonschematools/client/paths/fakeclassnametest/patch/responses/code200response/content/applicationjson/ApplicationjsonSchema.kt -src/main/kotlin/org/openapijsonschematools/client/paths/fakeclassnametest/patch/security/FakeclassnametestPatchSecurityRequirementObject0.kt -src/main/kotlin/org/openapijsonschematools/client/paths/fakedeletecoffeeid/FakedeletecoffeeidDelete.kt -src/main/kotlin/org/openapijsonschematools/client/paths/fakedeletecoffeeid/delete/FakedeletecoffeeidDeletePathParameters.kt -src/main/kotlin/org/openapijsonschematools/client/paths/fakedeletecoffeeid/delete/FakedeletecoffeeidDeleteResponses.kt -src/main/kotlin/org/openapijsonschematools/client/paths/fakedeletecoffeeid/delete/Parameters.kt -src/main/kotlin/org/openapijsonschematools/client/paths/fakedeletecoffeeid/delete/parameters/Parameter0.kt -src/main/kotlin/org/openapijsonschematools/client/paths/fakedeletecoffeeid/delete/parameters/parameter0/Schema0.kt -src/main/kotlin/org/openapijsonschematools/client/paths/fakedeletecoffeeid/delete/responses/FakedeletecoffeeidDeleteCode200Response.kt -src/main/kotlin/org/openapijsonschematools/client/paths/fakedeletecoffeeid/delete/responses/FakedeletecoffeeidDeleteCodedefaultResponse.kt -src/main/kotlin/org/openapijsonschematools/client/paths/fakehealth/FakehealthGet.kt -src/main/kotlin/org/openapijsonschematools/client/paths/fakehealth/get/FakehealthGetResponses.kt -src/main/kotlin/org/openapijsonschematools/client/paths/fakehealth/get/responses/FakehealthGetCode200Response.kt -src/main/kotlin/org/openapijsonschematools/client/paths/fakehealth/get/responses/code200response/content/applicationjson/ApplicationjsonSchema.kt -src/main/kotlin/org/openapijsonschematools/client/paths/fakeinlineadditionalproperties/FakeinlineadditionalpropertiesPost.kt -src/main/kotlin/org/openapijsonschematools/client/paths/fakeinlineadditionalproperties/post/FakeinlineadditionalpropertiesPostRequestBody.kt -src/main/kotlin/org/openapijsonschematools/client/paths/fakeinlineadditionalproperties/post/FakeinlineadditionalpropertiesPostResponses.kt -src/main/kotlin/org/openapijsonschematools/client/paths/fakeinlineadditionalproperties/post/requestbody/content/applicationjson/ApplicationjsonSchema.kt -src/main/kotlin/org/openapijsonschematools/client/paths/fakeinlineadditionalproperties/post/responses/FakeinlineadditionalpropertiesPostCode200Response.kt -src/main/kotlin/org/openapijsonschematools/client/paths/fakeinlinecomposition/FakeinlinecompositionPost.kt -src/main/kotlin/org/openapijsonschematools/client/paths/fakeinlinecomposition/post/FakeinlinecompositionPostQueryParameters.kt -src/main/kotlin/org/openapijsonschematools/client/paths/fakeinlinecomposition/post/FakeinlinecompositionPostRequestBody.kt -src/main/kotlin/org/openapijsonschematools/client/paths/fakeinlinecomposition/post/FakeinlinecompositionPostResponses.kt -src/main/kotlin/org/openapijsonschematools/client/paths/fakeinlinecomposition/post/Parameters.kt -src/main/kotlin/org/openapijsonschematools/client/paths/fakeinlinecomposition/post/parameters/Parameter0.kt -src/main/kotlin/org/openapijsonschematools/client/paths/fakeinlinecomposition/post/parameters/Parameter1.kt -src/main/kotlin/org/openapijsonschematools/client/paths/fakeinlinecomposition/post/parameters/parameter0/Schema0.kt -src/main/kotlin/org/openapijsonschematools/client/paths/fakeinlinecomposition/post/parameters/parameter1/Schema1.kt -src/main/kotlin/org/openapijsonschematools/client/paths/fakeinlinecomposition/post/requestbody/content/applicationjson/ApplicationjsonSchema.kt -src/main/kotlin/org/openapijsonschematools/client/paths/fakeinlinecomposition/post/requestbody/content/multipartformdata/MultipartformdataSchema.kt -src/main/kotlin/org/openapijsonschematools/client/paths/fakeinlinecomposition/post/responses/FakeinlinecompositionPostCode200Response.kt -src/main/kotlin/org/openapijsonschematools/client/paths/fakeinlinecomposition/post/responses/code200response/content/applicationjson/ApplicationjsonSchema.kt -src/main/kotlin/org/openapijsonschematools/client/paths/fakeinlinecomposition/post/responses/code200response/content/multipartformdata/MultipartformdataSchema.kt -src/main/kotlin/org/openapijsonschematools/client/paths/fakejsonformdata/FakejsonformdataGet.kt -src/main/kotlin/org/openapijsonschematools/client/paths/fakejsonformdata/get/FakejsonformdataGetRequestBody.kt -src/main/kotlin/org/openapijsonschematools/client/paths/fakejsonformdata/get/FakejsonformdataGetResponses.kt -src/main/kotlin/org/openapijsonschematools/client/paths/fakejsonformdata/get/requestbody/content/applicationxwwwformurlencoded/ApplicationxwwwformurlencodedSchema.kt -src/main/kotlin/org/openapijsonschematools/client/paths/fakejsonformdata/get/responses/FakejsonformdataGetCode200Response.kt -src/main/kotlin/org/openapijsonschematools/client/paths/fakejsonpatch/FakejsonpatchPatch.kt -src/main/kotlin/org/openapijsonschematools/client/paths/fakejsonpatch/patch/FakejsonpatchPatchRequestBody.kt -src/main/kotlin/org/openapijsonschematools/client/paths/fakejsonpatch/patch/FakejsonpatchPatchResponses.kt -src/main/kotlin/org/openapijsonschematools/client/paths/fakejsonpatch/patch/requestbody/content/applicationjsonpatchjson/ApplicationjsonpatchjsonSchema.kt -src/main/kotlin/org/openapijsonschematools/client/paths/fakejsonpatch/patch/responses/FakejsonpatchPatchCode200Response.kt -src/main/kotlin/org/openapijsonschematools/client/paths/fakejsonwithcharset/FakejsonwithcharsetPost.kt -src/main/kotlin/org/openapijsonschematools/client/paths/fakejsonwithcharset/post/FakejsonwithcharsetPostRequestBody.kt -src/main/kotlin/org/openapijsonschematools/client/paths/fakejsonwithcharset/post/FakejsonwithcharsetPostResponses.kt -src/main/kotlin/org/openapijsonschematools/client/paths/fakejsonwithcharset/post/requestbody/content/applicationjsoncharsetutf8/Applicationjsoncharsetutf8Schema.kt -src/main/kotlin/org/openapijsonschematools/client/paths/fakejsonwithcharset/post/responses/FakejsonwithcharsetPostCode200Response.kt -src/main/kotlin/org/openapijsonschematools/client/paths/fakejsonwithcharset/post/responses/code200response/content/applicationjsoncharsetutf8/Applicationjsoncharsetutf8Schema.kt -src/main/kotlin/org/openapijsonschematools/client/paths/fakemultiplerequestbodycontenttypes/FakemultiplerequestbodycontenttypesPost.kt -src/main/kotlin/org/openapijsonschematools/client/paths/fakemultiplerequestbodycontenttypes/post/FakemultiplerequestbodycontenttypesPostRequestBody.kt -src/main/kotlin/org/openapijsonschematools/client/paths/fakemultiplerequestbodycontenttypes/post/FakemultiplerequestbodycontenttypesPostResponses.kt -src/main/kotlin/org/openapijsonschematools/client/paths/fakemultiplerequestbodycontenttypes/post/requestbody/content/applicationjson/ApplicationjsonSchema.kt -src/main/kotlin/org/openapijsonschematools/client/paths/fakemultiplerequestbodycontenttypes/post/requestbody/content/multipartformdata/MultipartformdataSchema.kt -src/main/kotlin/org/openapijsonschematools/client/paths/fakemultiplerequestbodycontenttypes/post/responses/FakemultiplerequestbodycontenttypesPostCode200Response.kt -src/main/kotlin/org/openapijsonschematools/client/paths/fakemultiplerequestbodycontenttypes/post/responses/code200response/content/applicationjson/ApplicationjsonSchema.kt -src/main/kotlin/org/openapijsonschematools/client/paths/fakemultipleresponsebodies/FakemultipleresponsebodiesGet.kt -src/main/kotlin/org/openapijsonschematools/client/paths/fakemultipleresponsebodies/get/FakemultipleresponsebodiesGetResponses.kt -src/main/kotlin/org/openapijsonschematools/client/paths/fakemultipleresponsebodies/get/responses/FakemultipleresponsebodiesGetCode200Response.kt -src/main/kotlin/org/openapijsonschematools/client/paths/fakemultipleresponsebodies/get/responses/FakemultipleresponsebodiesGetCode202Response.kt -src/main/kotlin/org/openapijsonschematools/client/paths/fakemultipleresponsebodies/get/responses/code200response/content/applicationjson/ApplicationjsonSchema.kt -src/main/kotlin/org/openapijsonschematools/client/paths/fakemultipleresponsebodies/get/responses/code202response/content/applicationjson/ApplicationjsonSchema.kt -src/main/kotlin/org/openapijsonschematools/client/paths/fakemultiplesecurities/FakemultiplesecuritiesGet.kt -src/main/kotlin/org/openapijsonschematools/client/paths/fakemultiplesecurities/get/FakemultiplesecuritiesGetResponses.kt -src/main/kotlin/org/openapijsonschematools/client/paths/fakemultiplesecurities/get/FakemultiplesecuritiesGetSecurityInfo.kt -src/main/kotlin/org/openapijsonschematools/client/paths/fakemultiplesecurities/get/responses/FakemultiplesecuritiesGetCode200Response.kt -src/main/kotlin/org/openapijsonschematools/client/paths/fakemultiplesecurities/get/responses/code200response/content/applicationjson/ApplicationjsonSchema.kt -src/main/kotlin/org/openapijsonschematools/client/paths/fakemultiplesecurities/get/security/FakemultiplesecuritiesGetSecurityRequirementObject0.kt -src/main/kotlin/org/openapijsonschematools/client/paths/fakemultiplesecurities/get/security/FakemultiplesecuritiesGetSecurityRequirementObject1.kt -src/main/kotlin/org/openapijsonschematools/client/paths/fakemultiplesecurities/get/security/FakemultiplesecuritiesGetSecurityRequirementObject2.kt -src/main/kotlin/org/openapijsonschematools/client/paths/fakeobjinquery/FakeobjinqueryGet.kt -src/main/kotlin/org/openapijsonschematools/client/paths/fakeobjinquery/get/FakeobjinqueryGetQueryParameters.kt -src/main/kotlin/org/openapijsonschematools/client/paths/fakeobjinquery/get/FakeobjinqueryGetResponses.kt -src/main/kotlin/org/openapijsonschematools/client/paths/fakeobjinquery/get/Parameters.kt -src/main/kotlin/org/openapijsonschematools/client/paths/fakeobjinquery/get/parameters/Parameter0.kt -src/main/kotlin/org/openapijsonschematools/client/paths/fakeobjinquery/get/parameters/parameter0/Schema0.kt -src/main/kotlin/org/openapijsonschematools/client/paths/fakeobjinquery/get/responses/FakeobjinqueryGetCode200Response.kt -src/main/kotlin/org/openapijsonschematools/client/paths/fakeparametercollisions1ababselfab/Fakeparametercollisions1ababselfabPost.kt -src/main/kotlin/org/openapijsonschematools/client/paths/fakeparametercollisions1ababselfab/post/Fakeparametercollisions1ababselfabPostCookieParameters.kt -src/main/kotlin/org/openapijsonschematools/client/paths/fakeparametercollisions1ababselfab/post/Fakeparametercollisions1ababselfabPostHeaderParameters.kt -src/main/kotlin/org/openapijsonschematools/client/paths/fakeparametercollisions1ababselfab/post/Fakeparametercollisions1ababselfabPostPathParameters.kt -src/main/kotlin/org/openapijsonschematools/client/paths/fakeparametercollisions1ababselfab/post/Fakeparametercollisions1ababselfabPostQueryParameters.kt -src/main/kotlin/org/openapijsonschematools/client/paths/fakeparametercollisions1ababselfab/post/Fakeparametercollisions1ababselfabPostRequestBody.kt -src/main/kotlin/org/openapijsonschematools/client/paths/fakeparametercollisions1ababselfab/post/Fakeparametercollisions1ababselfabPostResponses.kt -src/main/kotlin/org/openapijsonschematools/client/paths/fakeparametercollisions1ababselfab/post/Parameters.kt -src/main/kotlin/org/openapijsonschematools/client/paths/fakeparametercollisions1ababselfab/post/parameters/Parameter0.kt -src/main/kotlin/org/openapijsonschematools/client/paths/fakeparametercollisions1ababselfab/post/parameters/Parameter1.kt -src/main/kotlin/org/openapijsonschematools/client/paths/fakeparametercollisions1ababselfab/post/parameters/Parameter10.kt -src/main/kotlin/org/openapijsonschematools/client/paths/fakeparametercollisions1ababselfab/post/parameters/Parameter11.kt -src/main/kotlin/org/openapijsonschematools/client/paths/fakeparametercollisions1ababselfab/post/parameters/Parameter12.kt -src/main/kotlin/org/openapijsonschematools/client/paths/fakeparametercollisions1ababselfab/post/parameters/Parameter13.kt -src/main/kotlin/org/openapijsonschematools/client/paths/fakeparametercollisions1ababselfab/post/parameters/Parameter14.kt -src/main/kotlin/org/openapijsonschematools/client/paths/fakeparametercollisions1ababselfab/post/parameters/Parameter15.kt -src/main/kotlin/org/openapijsonschematools/client/paths/fakeparametercollisions1ababselfab/post/parameters/Parameter16.kt -src/main/kotlin/org/openapijsonschematools/client/paths/fakeparametercollisions1ababselfab/post/parameters/Parameter17.kt -src/main/kotlin/org/openapijsonschematools/client/paths/fakeparametercollisions1ababselfab/post/parameters/Parameter18.kt -src/main/kotlin/org/openapijsonschematools/client/paths/fakeparametercollisions1ababselfab/post/parameters/Parameter2.kt -src/main/kotlin/org/openapijsonschematools/client/paths/fakeparametercollisions1ababselfab/post/parameters/Parameter3.kt -src/main/kotlin/org/openapijsonschematools/client/paths/fakeparametercollisions1ababselfab/post/parameters/Parameter4.kt -src/main/kotlin/org/openapijsonschematools/client/paths/fakeparametercollisions1ababselfab/post/parameters/Parameter5.kt -src/main/kotlin/org/openapijsonschematools/client/paths/fakeparametercollisions1ababselfab/post/parameters/Parameter6.kt -src/main/kotlin/org/openapijsonschematools/client/paths/fakeparametercollisions1ababselfab/post/parameters/Parameter7.kt -src/main/kotlin/org/openapijsonschematools/client/paths/fakeparametercollisions1ababselfab/post/parameters/Parameter8.kt -src/main/kotlin/org/openapijsonschematools/client/paths/fakeparametercollisions1ababselfab/post/parameters/Parameter9.kt -src/main/kotlin/org/openapijsonschematools/client/paths/fakeparametercollisions1ababselfab/post/parameters/parameter0/Schema0.kt -src/main/kotlin/org/openapijsonschematools/client/paths/fakeparametercollisions1ababselfab/post/parameters/parameter1/Schema1.kt -src/main/kotlin/org/openapijsonschematools/client/paths/fakeparametercollisions1ababselfab/post/parameters/parameter10/Schema10.kt -src/main/kotlin/org/openapijsonschematools/client/paths/fakeparametercollisions1ababselfab/post/parameters/parameter11/Schema11.kt -src/main/kotlin/org/openapijsonschematools/client/paths/fakeparametercollisions1ababselfab/post/parameters/parameter12/Schema12.kt -src/main/kotlin/org/openapijsonschematools/client/paths/fakeparametercollisions1ababselfab/post/parameters/parameter13/Schema13.kt -src/main/kotlin/org/openapijsonschematools/client/paths/fakeparametercollisions1ababselfab/post/parameters/parameter14/Schema14.kt -src/main/kotlin/org/openapijsonschematools/client/paths/fakeparametercollisions1ababselfab/post/parameters/parameter15/Schema15.kt -src/main/kotlin/org/openapijsonschematools/client/paths/fakeparametercollisions1ababselfab/post/parameters/parameter16/Schema16.kt -src/main/kotlin/org/openapijsonschematools/client/paths/fakeparametercollisions1ababselfab/post/parameters/parameter17/Schema17.kt -src/main/kotlin/org/openapijsonschematools/client/paths/fakeparametercollisions1ababselfab/post/parameters/parameter18/Schema18.kt -src/main/kotlin/org/openapijsonschematools/client/paths/fakeparametercollisions1ababselfab/post/parameters/parameter2/Schema2.kt -src/main/kotlin/org/openapijsonschematools/client/paths/fakeparametercollisions1ababselfab/post/parameters/parameter3/Schema3.kt -src/main/kotlin/org/openapijsonschematools/client/paths/fakeparametercollisions1ababselfab/post/parameters/parameter4/Schema4.kt -src/main/kotlin/org/openapijsonschematools/client/paths/fakeparametercollisions1ababselfab/post/parameters/parameter5/Schema5.kt -src/main/kotlin/org/openapijsonschematools/client/paths/fakeparametercollisions1ababselfab/post/parameters/parameter6/Schema6.kt -src/main/kotlin/org/openapijsonschematools/client/paths/fakeparametercollisions1ababselfab/post/parameters/parameter7/Schema7.kt -src/main/kotlin/org/openapijsonschematools/client/paths/fakeparametercollisions1ababselfab/post/parameters/parameter8/Schema8.kt -src/main/kotlin/org/openapijsonschematools/client/paths/fakeparametercollisions1ababselfab/post/parameters/parameter9/Schema9.kt -src/main/kotlin/org/openapijsonschematools/client/paths/fakeparametercollisions1ababselfab/post/requestbody/content/applicationjson/ApplicationjsonSchema.kt -src/main/kotlin/org/openapijsonschematools/client/paths/fakeparametercollisions1ababselfab/post/responses/Fakeparametercollisions1ababselfabPostCode200Response.kt -src/main/kotlin/org/openapijsonschematools/client/paths/fakeparametercollisions1ababselfab/post/responses/code200response/content/applicationjson/ApplicationjsonSchema.kt -src/main/kotlin/org/openapijsonschematools/client/paths/fakepemcontenttype/FakepemcontenttypeGet.kt -src/main/kotlin/org/openapijsonschematools/client/paths/fakepemcontenttype/get/FakepemcontenttypeGetRequestBody.kt -src/main/kotlin/org/openapijsonschematools/client/paths/fakepemcontenttype/get/FakepemcontenttypeGetResponses.kt -src/main/kotlin/org/openapijsonschematools/client/paths/fakepemcontenttype/get/requestbody/content/applicationxpemfile/ApplicationxpemfileSchema.kt -src/main/kotlin/org/openapijsonschematools/client/paths/fakepemcontenttype/get/responses/FakepemcontenttypeGetCode200Response.kt -src/main/kotlin/org/openapijsonschematools/client/paths/fakepemcontenttype/get/responses/code200response/content/applicationxpemfile/ApplicationxpemfileSchema.kt -src/main/kotlin/org/openapijsonschematools/client/paths/fakepetiduploadimagewithrequiredfile/FakepetiduploadimagewithrequiredfilePost.kt -src/main/kotlin/org/openapijsonschematools/client/paths/fakepetiduploadimagewithrequiredfile/post/FakepetiduploadimagewithrequiredfilePostPathParameters.kt -src/main/kotlin/org/openapijsonschematools/client/paths/fakepetiduploadimagewithrequiredfile/post/FakepetiduploadimagewithrequiredfilePostRequestBody.kt -src/main/kotlin/org/openapijsonschematools/client/paths/fakepetiduploadimagewithrequiredfile/post/FakepetiduploadimagewithrequiredfilePostResponses.kt -src/main/kotlin/org/openapijsonschematools/client/paths/fakepetiduploadimagewithrequiredfile/post/FakepetiduploadimagewithrequiredfilePostSecurityInfo.kt -src/main/kotlin/org/openapijsonschematools/client/paths/fakepetiduploadimagewithrequiredfile/post/Parameters.kt -src/main/kotlin/org/openapijsonschematools/client/paths/fakepetiduploadimagewithrequiredfile/post/parameters/Parameter0.kt -src/main/kotlin/org/openapijsonschematools/client/paths/fakepetiduploadimagewithrequiredfile/post/parameters/parameter0/Schema0.kt -src/main/kotlin/org/openapijsonschematools/client/paths/fakepetiduploadimagewithrequiredfile/post/requestbody/content/multipartformdata/MultipartformdataSchema.kt -src/main/kotlin/org/openapijsonschematools/client/paths/fakepetiduploadimagewithrequiredfile/post/responses/FakepetiduploadimagewithrequiredfilePostCode200Response.kt -src/main/kotlin/org/openapijsonschematools/client/paths/fakepetiduploadimagewithrequiredfile/post/responses/code200response/content/applicationjson/ApplicationjsonSchema.kt -src/main/kotlin/org/openapijsonschematools/client/paths/fakepetiduploadimagewithrequiredfile/post/security/FakepetiduploadimagewithrequiredfilePostSecurityRequirementObject0.kt -src/main/kotlin/org/openapijsonschematools/client/paths/fakequeryparamwithjsoncontenttype/FakequeryparamwithjsoncontenttypeGet.kt -src/main/kotlin/org/openapijsonschematools/client/paths/fakequeryparamwithjsoncontenttype/get/FakequeryparamwithjsoncontenttypeGetQueryParameters.kt -src/main/kotlin/org/openapijsonschematools/client/paths/fakequeryparamwithjsoncontenttype/get/FakequeryparamwithjsoncontenttypeGetResponses.kt -src/main/kotlin/org/openapijsonschematools/client/paths/fakequeryparamwithjsoncontenttype/get/Parameters.kt -src/main/kotlin/org/openapijsonschematools/client/paths/fakequeryparamwithjsoncontenttype/get/parameters/Parameter0.kt -src/main/kotlin/org/openapijsonschematools/client/paths/fakequeryparamwithjsoncontenttype/get/parameters/parameter0/content/applicationjson/Schema0.kt -src/main/kotlin/org/openapijsonschematools/client/paths/fakequeryparamwithjsoncontenttype/get/responses/FakequeryparamwithjsoncontenttypeGetCode200Response.kt -src/main/kotlin/org/openapijsonschematools/client/paths/fakequeryparamwithjsoncontenttype/get/responses/code200response/content/applicationjson/ApplicationjsonSchema.kt -src/main/kotlin/org/openapijsonschematools/client/paths/fakeredirection/FakeredirectionGet.kt -src/main/kotlin/org/openapijsonschematools/client/paths/fakeredirection/get/FakeredirectionGetResponses.kt -src/main/kotlin/org/openapijsonschematools/client/paths/fakeredirection/get/responses/FakeredirectionGetCode303Response.kt -src/main/kotlin/org/openapijsonschematools/client/paths/fakeredirection/get/responses/FakeredirectionGetCode3XXResponse.kt -src/main/kotlin/org/openapijsonschematools/client/paths/fakerefobjinquery/FakerefobjinqueryGet.kt -src/main/kotlin/org/openapijsonschematools/client/paths/fakerefobjinquery/get/FakerefobjinqueryGetQueryParameters.kt -src/main/kotlin/org/openapijsonschematools/client/paths/fakerefobjinquery/get/FakerefobjinqueryGetResponses.kt -src/main/kotlin/org/openapijsonschematools/client/paths/fakerefobjinquery/get/Parameters.kt -src/main/kotlin/org/openapijsonschematools/client/paths/fakerefobjinquery/get/parameters/Parameter0.kt -src/main/kotlin/org/openapijsonschematools/client/paths/fakerefobjinquery/get/parameters/parameter0/Schema0.kt -src/main/kotlin/org/openapijsonschematools/client/paths/fakerefobjinquery/get/responses/FakerefobjinqueryGetCode200Response.kt -src/main/kotlin/org/openapijsonschematools/client/paths/fakerefsarraymodel/FakerefsarraymodelPost.kt -src/main/kotlin/org/openapijsonschematools/client/paths/fakerefsarraymodel/post/FakerefsarraymodelPostRequestBody.kt -src/main/kotlin/org/openapijsonschematools/client/paths/fakerefsarraymodel/post/FakerefsarraymodelPostResponses.kt -src/main/kotlin/org/openapijsonschematools/client/paths/fakerefsarraymodel/post/requestbody/content/applicationjson/ApplicationjsonSchema.kt -src/main/kotlin/org/openapijsonschematools/client/paths/fakerefsarraymodel/post/responses/FakerefsarraymodelPostCode200Response.kt -src/main/kotlin/org/openapijsonschematools/client/paths/fakerefsarraymodel/post/responses/code200response/content/applicationjson/ApplicationjsonSchema.kt -src/main/kotlin/org/openapijsonschematools/client/paths/fakerefsarrayofenums/FakerefsarrayofenumsPost.kt -src/main/kotlin/org/openapijsonschematools/client/paths/fakerefsarrayofenums/post/FakerefsarrayofenumsPostRequestBody.kt -src/main/kotlin/org/openapijsonschematools/client/paths/fakerefsarrayofenums/post/FakerefsarrayofenumsPostResponses.kt -src/main/kotlin/org/openapijsonschematools/client/paths/fakerefsarrayofenums/post/requestbody/content/applicationjson/ApplicationjsonSchema.kt -src/main/kotlin/org/openapijsonschematools/client/paths/fakerefsarrayofenums/post/responses/FakerefsarrayofenumsPostCode200Response.kt -src/main/kotlin/org/openapijsonschematools/client/paths/fakerefsarrayofenums/post/responses/code200response/content/applicationjson/ApplicationjsonSchema.kt -src/main/kotlin/org/openapijsonschematools/client/paths/fakerefsboolean/FakerefsbooleanPost.kt -src/main/kotlin/org/openapijsonschematools/client/paths/fakerefsboolean/post/FakerefsbooleanPostRequestBody.kt -src/main/kotlin/org/openapijsonschematools/client/paths/fakerefsboolean/post/FakerefsbooleanPostResponses.kt -src/main/kotlin/org/openapijsonschematools/client/paths/fakerefsboolean/post/requestbody/content/applicationjson/ApplicationjsonSchema.kt -src/main/kotlin/org/openapijsonschematools/client/paths/fakerefsboolean/post/responses/FakerefsbooleanPostCode200Response.kt -src/main/kotlin/org/openapijsonschematools/client/paths/fakerefsboolean/post/responses/code200response/content/applicationjson/ApplicationjsonSchema.kt -src/main/kotlin/org/openapijsonschematools/client/paths/fakerefscomposedoneofnumberwithvalidations/FakerefscomposedoneofnumberwithvalidationsPost.kt -src/main/kotlin/org/openapijsonschematools/client/paths/fakerefscomposedoneofnumberwithvalidations/post/FakerefscomposedoneofnumberwithvalidationsPostRequestBody.kt -src/main/kotlin/org/openapijsonschematools/client/paths/fakerefscomposedoneofnumberwithvalidations/post/FakerefscomposedoneofnumberwithvalidationsPostResponses.kt -src/main/kotlin/org/openapijsonschematools/client/paths/fakerefscomposedoneofnumberwithvalidations/post/requestbody/content/applicationjson/ApplicationjsonSchema.kt -src/main/kotlin/org/openapijsonschematools/client/paths/fakerefscomposedoneofnumberwithvalidations/post/responses/FakerefscomposedoneofnumberwithvalidationsPostCode200Response.kt -src/main/kotlin/org/openapijsonschematools/client/paths/fakerefscomposedoneofnumberwithvalidations/post/responses/code200response/content/applicationjson/ApplicationjsonSchema.kt -src/main/kotlin/org/openapijsonschematools/client/paths/fakerefsenum/FakerefsenumPost.kt -src/main/kotlin/org/openapijsonschematools/client/paths/fakerefsenum/post/FakerefsenumPostRequestBody.kt -src/main/kotlin/org/openapijsonschematools/client/paths/fakerefsenum/post/FakerefsenumPostResponses.kt -src/main/kotlin/org/openapijsonschematools/client/paths/fakerefsenum/post/requestbody/content/applicationjson/ApplicationjsonSchema.kt -src/main/kotlin/org/openapijsonschematools/client/paths/fakerefsenum/post/responses/FakerefsenumPostCode200Response.kt -src/main/kotlin/org/openapijsonschematools/client/paths/fakerefsenum/post/responses/code200response/content/applicationjson/ApplicationjsonSchema.kt -src/main/kotlin/org/openapijsonschematools/client/paths/fakerefsmammal/FakerefsmammalPost.kt -src/main/kotlin/org/openapijsonschematools/client/paths/fakerefsmammal/post/FakerefsmammalPostRequestBody.kt -src/main/kotlin/org/openapijsonschematools/client/paths/fakerefsmammal/post/FakerefsmammalPostResponses.kt -src/main/kotlin/org/openapijsonschematools/client/paths/fakerefsmammal/post/requestbody/content/applicationjson/ApplicationjsonSchema.kt -src/main/kotlin/org/openapijsonschematools/client/paths/fakerefsmammal/post/responses/FakerefsmammalPostCode200Response.kt -src/main/kotlin/org/openapijsonschematools/client/paths/fakerefsmammal/post/responses/code200response/content/applicationjson/ApplicationjsonSchema.kt -src/main/kotlin/org/openapijsonschematools/client/paths/fakerefsnumber/FakerefsnumberPost.kt -src/main/kotlin/org/openapijsonschematools/client/paths/fakerefsnumber/post/FakerefsnumberPostRequestBody.kt -src/main/kotlin/org/openapijsonschematools/client/paths/fakerefsnumber/post/FakerefsnumberPostResponses.kt -src/main/kotlin/org/openapijsonschematools/client/paths/fakerefsnumber/post/requestbody/content/applicationjson/ApplicationjsonSchema.kt -src/main/kotlin/org/openapijsonschematools/client/paths/fakerefsnumber/post/responses/FakerefsnumberPostCode200Response.kt -src/main/kotlin/org/openapijsonschematools/client/paths/fakerefsnumber/post/responses/code200response/content/applicationjson/ApplicationjsonSchema.kt -src/main/kotlin/org/openapijsonschematools/client/paths/fakerefsobjectmodelwithrefprops/FakerefsobjectmodelwithrefpropsPost.kt -src/main/kotlin/org/openapijsonschematools/client/paths/fakerefsobjectmodelwithrefprops/post/FakerefsobjectmodelwithrefpropsPostRequestBody.kt -src/main/kotlin/org/openapijsonschematools/client/paths/fakerefsobjectmodelwithrefprops/post/FakerefsobjectmodelwithrefpropsPostResponses.kt -src/main/kotlin/org/openapijsonschematools/client/paths/fakerefsobjectmodelwithrefprops/post/requestbody/content/applicationjson/ApplicationjsonSchema.kt -src/main/kotlin/org/openapijsonschematools/client/paths/fakerefsobjectmodelwithrefprops/post/responses/FakerefsobjectmodelwithrefpropsPostCode200Response.kt -src/main/kotlin/org/openapijsonschematools/client/paths/fakerefsobjectmodelwithrefprops/post/responses/code200response/content/applicationjson/ApplicationjsonSchema.kt -src/main/kotlin/org/openapijsonschematools/client/paths/fakerefsstring/FakerefsstringPost.kt -src/main/kotlin/org/openapijsonschematools/client/paths/fakerefsstring/post/FakerefsstringPostRequestBody.kt -src/main/kotlin/org/openapijsonschematools/client/paths/fakerefsstring/post/FakerefsstringPostResponses.kt -src/main/kotlin/org/openapijsonschematools/client/paths/fakerefsstring/post/requestbody/content/applicationjson/ApplicationjsonSchema.kt -src/main/kotlin/org/openapijsonschematools/client/paths/fakerefsstring/post/responses/FakerefsstringPostCode200Response.kt -src/main/kotlin/org/openapijsonschematools/client/paths/fakerefsstring/post/responses/code200response/content/applicationjson/ApplicationjsonSchema.kt -src/main/kotlin/org/openapijsonschematools/client/paths/fakeresponsewithoutschema/FakeresponsewithoutschemaGet.kt -src/main/kotlin/org/openapijsonschematools/client/paths/fakeresponsewithoutschema/get/FakeresponsewithoutschemaGetResponses.kt -src/main/kotlin/org/openapijsonschematools/client/paths/fakeresponsewithoutschema/get/responses/FakeresponsewithoutschemaGetCode200Response.kt -src/main/kotlin/org/openapijsonschematools/client/paths/faketestqueryparamters/FaketestqueryparamtersPut.kt -src/main/kotlin/org/openapijsonschematools/client/paths/faketestqueryparamters/put/FaketestqueryparamtersPutQueryParameters.kt -src/main/kotlin/org/openapijsonschematools/client/paths/faketestqueryparamters/put/FaketestqueryparamtersPutResponses.kt -src/main/kotlin/org/openapijsonschematools/client/paths/faketestqueryparamters/put/Parameters.kt -src/main/kotlin/org/openapijsonschematools/client/paths/faketestqueryparamters/put/parameters/Parameter0.kt -src/main/kotlin/org/openapijsonschematools/client/paths/faketestqueryparamters/put/parameters/Parameter1.kt -src/main/kotlin/org/openapijsonschematools/client/paths/faketestqueryparamters/put/parameters/Parameter2.kt -src/main/kotlin/org/openapijsonschematools/client/paths/faketestqueryparamters/put/parameters/Parameter3.kt -src/main/kotlin/org/openapijsonschematools/client/paths/faketestqueryparamters/put/parameters/Parameter4.kt -src/main/kotlin/org/openapijsonschematools/client/paths/faketestqueryparamters/put/parameters/Parameter5.kt -src/main/kotlin/org/openapijsonschematools/client/paths/faketestqueryparamters/put/parameters/parameter0/Schema0.kt -src/main/kotlin/org/openapijsonschematools/client/paths/faketestqueryparamters/put/parameters/parameter1/Schema1.kt -src/main/kotlin/org/openapijsonschematools/client/paths/faketestqueryparamters/put/parameters/parameter2/Schema2.kt -src/main/kotlin/org/openapijsonschematools/client/paths/faketestqueryparamters/put/parameters/parameter3/Schema3.kt -src/main/kotlin/org/openapijsonschematools/client/paths/faketestqueryparamters/put/parameters/parameter4/Schema4.kt -src/main/kotlin/org/openapijsonschematools/client/paths/faketestqueryparamters/put/parameters/parameter5/Schema5.kt -src/main/kotlin/org/openapijsonschematools/client/paths/faketestqueryparamters/put/responses/FaketestqueryparamtersPutCode200Response.kt -src/main/kotlin/org/openapijsonschematools/client/paths/fakeuploaddownloadfile/FakeuploaddownloadfilePost.kt -src/main/kotlin/org/openapijsonschematools/client/paths/fakeuploaddownloadfile/post/FakeuploaddownloadfilePostRequestBody.kt -src/main/kotlin/org/openapijsonschematools/client/paths/fakeuploaddownloadfile/post/FakeuploaddownloadfilePostResponses.kt -src/main/kotlin/org/openapijsonschematools/client/paths/fakeuploaddownloadfile/post/requestbody/content/applicationoctetstream/ApplicationoctetstreamSchema.kt -src/main/kotlin/org/openapijsonschematools/client/paths/fakeuploaddownloadfile/post/responses/FakeuploaddownloadfilePostCode200Response.kt -src/main/kotlin/org/openapijsonschematools/client/paths/fakeuploaddownloadfile/post/responses/code200response/content/applicationoctetstream/ApplicationoctetstreamSchema.kt -src/main/kotlin/org/openapijsonschematools/client/paths/fakeuploadfile/FakeuploadfilePost.kt -src/main/kotlin/org/openapijsonschematools/client/paths/fakeuploadfile/post/FakeuploadfilePostRequestBody.kt -src/main/kotlin/org/openapijsonschematools/client/paths/fakeuploadfile/post/FakeuploadfilePostResponses.kt -src/main/kotlin/org/openapijsonschematools/client/paths/fakeuploadfile/post/requestbody/content/multipartformdata/MultipartformdataSchema.kt -src/main/kotlin/org/openapijsonschematools/client/paths/fakeuploadfile/post/responses/FakeuploadfilePostCode200Response.kt -src/main/kotlin/org/openapijsonschematools/client/paths/fakeuploadfile/post/responses/code200response/content/applicationjson/ApplicationjsonSchema.kt -src/main/kotlin/org/openapijsonschematools/client/paths/fakeuploadfiles/FakeuploadfilesPost.kt -src/main/kotlin/org/openapijsonschematools/client/paths/fakeuploadfiles/post/FakeuploadfilesPostRequestBody.kt -src/main/kotlin/org/openapijsonschematools/client/paths/fakeuploadfiles/post/FakeuploadfilesPostResponses.kt -src/main/kotlin/org/openapijsonschematools/client/paths/fakeuploadfiles/post/requestbody/content/multipartformdata/MultipartformdataSchema.kt -src/main/kotlin/org/openapijsonschematools/client/paths/fakeuploadfiles/post/responses/FakeuploadfilesPostCode200Response.kt -src/main/kotlin/org/openapijsonschematools/client/paths/fakeuploadfiles/post/responses/code200response/content/applicationjson/ApplicationjsonSchema.kt -src/main/kotlin/org/openapijsonschematools/client/paths/fakewildcardresponses/FakewildcardresponsesGet.kt -src/main/kotlin/org/openapijsonschematools/client/paths/fakewildcardresponses/get/FakewildcardresponsesGetResponses.kt -src/main/kotlin/org/openapijsonschematools/client/paths/fakewildcardresponses/get/responses/FakewildcardresponsesGetCode1XXResponse.kt -src/main/kotlin/org/openapijsonschematools/client/paths/fakewildcardresponses/get/responses/FakewildcardresponsesGetCode200Response.kt -src/main/kotlin/org/openapijsonschematools/client/paths/fakewildcardresponses/get/responses/FakewildcardresponsesGetCode2XXResponse.kt -src/main/kotlin/org/openapijsonschematools/client/paths/fakewildcardresponses/get/responses/FakewildcardresponsesGetCode3XXResponse.kt -src/main/kotlin/org/openapijsonschematools/client/paths/fakewildcardresponses/get/responses/FakewildcardresponsesGetCode4XXResponse.kt -src/main/kotlin/org/openapijsonschematools/client/paths/fakewildcardresponses/get/responses/FakewildcardresponsesGetCode5XXResponse.kt -src/main/kotlin/org/openapijsonschematools/client/paths/fakewildcardresponses/get/responses/code1xxresponse/content/applicationjson/ApplicationjsonSchema.kt -src/main/kotlin/org/openapijsonschematools/client/paths/fakewildcardresponses/get/responses/code200response/content/applicationjson/ApplicationjsonSchema.kt -src/main/kotlin/org/openapijsonschematools/client/paths/fakewildcardresponses/get/responses/code2xxresponse/content/applicationjson/ApplicationjsonSchema.kt -src/main/kotlin/org/openapijsonschematools/client/paths/fakewildcardresponses/get/responses/code3xxresponse/content/applicationjson/ApplicationjsonSchema.kt -src/main/kotlin/org/openapijsonschematools/client/paths/fakewildcardresponses/get/responses/code4xxresponse/content/applicationjson/ApplicationjsonSchema.kt -src/main/kotlin/org/openapijsonschematools/client/paths/fakewildcardresponses/get/responses/code5xxresponse/content/applicationjson/ApplicationjsonSchema.kt -src/main/kotlin/org/openapijsonschematools/client/paths/foo/FooGet.kt -src/main/kotlin/org/openapijsonschematools/client/paths/foo/get/FooGetResponses.kt -src/main/kotlin/org/openapijsonschematools/client/paths/foo/get/FooGetServerInfo.kt -src/main/kotlin/org/openapijsonschematools/client/paths/foo/get/responses/FooGetCodedefaultResponse.kt -src/main/kotlin/org/openapijsonschematools/client/paths/foo/get/responses/codedefaultresponse/content/applicationjson/ApplicationjsonSchema.kt -src/main/kotlin/org/openapijsonschematools/client/paths/foo/get/servers/FooGetServer0.kt -src/main/kotlin/org/openapijsonschematools/client/paths/foo/get/servers/FooGetServer1.kt -src/main/kotlin/org/openapijsonschematools/client/paths/foo/get/servers/server1/FooGetServer1Variables.kt -src/main/kotlin/org/openapijsonschematools/client/paths/pet/PetPost.kt -src/main/kotlin/org/openapijsonschematools/client/paths/pet/PetPut.kt -src/main/kotlin/org/openapijsonschematools/client/paths/pet/post/PetPostRequestBody.kt -src/main/kotlin/org/openapijsonschematools/client/paths/pet/post/PetPostResponses.kt -src/main/kotlin/org/openapijsonschematools/client/paths/pet/post/PetPostSecurityInfo.kt -src/main/kotlin/org/openapijsonschematools/client/paths/pet/post/responses/PetPostCode200Response.kt -src/main/kotlin/org/openapijsonschematools/client/paths/pet/post/responses/PetPostCode405Response.kt -src/main/kotlin/org/openapijsonschematools/client/paths/pet/post/security/PetPostSecurityRequirementObject0.kt -src/main/kotlin/org/openapijsonschematools/client/paths/pet/post/security/PetPostSecurityRequirementObject1.kt -src/main/kotlin/org/openapijsonschematools/client/paths/pet/post/security/PetPostSecurityRequirementObject2.kt -src/main/kotlin/org/openapijsonschematools/client/paths/pet/put/PetPutRequestBody.kt -src/main/kotlin/org/openapijsonschematools/client/paths/pet/put/PetPutResponses.kt -src/main/kotlin/org/openapijsonschematools/client/paths/pet/put/PetPutSecurityInfo.kt -src/main/kotlin/org/openapijsonschematools/client/paths/pet/put/responses/PetPutCode400Response.kt -src/main/kotlin/org/openapijsonschematools/client/paths/pet/put/responses/PetPutCode404Response.kt -src/main/kotlin/org/openapijsonschematools/client/paths/pet/put/responses/PetPutCode405Response.kt -src/main/kotlin/org/openapijsonschematools/client/paths/pet/put/security/PetPutSecurityRequirementObject0.kt -src/main/kotlin/org/openapijsonschematools/client/paths/pet/put/security/PetPutSecurityRequirementObject1.kt -src/main/kotlin/org/openapijsonschematools/client/paths/petfindbystatus/PetfindbystatusGet.kt -src/main/kotlin/org/openapijsonschematools/client/paths/petfindbystatus/PetfindbystatusServerInfo.kt -src/main/kotlin/org/openapijsonschematools/client/paths/petfindbystatus/get/Parameters.kt -src/main/kotlin/org/openapijsonschematools/client/paths/petfindbystatus/get/PetfindbystatusGetQueryParameters.kt -src/main/kotlin/org/openapijsonschematools/client/paths/petfindbystatus/get/PetfindbystatusGetResponses.kt -src/main/kotlin/org/openapijsonschematools/client/paths/petfindbystatus/get/PetfindbystatusGetSecurityInfo.kt -src/main/kotlin/org/openapijsonschematools/client/paths/petfindbystatus/get/parameters/Parameter0.kt -src/main/kotlin/org/openapijsonschematools/client/paths/petfindbystatus/get/parameters/parameter0/Schema0.kt -src/main/kotlin/org/openapijsonschematools/client/paths/petfindbystatus/get/responses/PetfindbystatusGetCode200Response.kt -src/main/kotlin/org/openapijsonschematools/client/paths/petfindbystatus/get/responses/PetfindbystatusGetCode400Response.kt -src/main/kotlin/org/openapijsonschematools/client/paths/petfindbystatus/get/security/PetfindbystatusGetSecurityRequirementObject0.kt -src/main/kotlin/org/openapijsonschematools/client/paths/petfindbystatus/get/security/PetfindbystatusGetSecurityRequirementObject1.kt -src/main/kotlin/org/openapijsonschematools/client/paths/petfindbystatus/get/security/PetfindbystatusGetSecurityRequirementObject2.kt -src/main/kotlin/org/openapijsonschematools/client/paths/petfindbystatus/servers/PetfindbystatusServer0.kt -src/main/kotlin/org/openapijsonschematools/client/paths/petfindbystatus/servers/PetfindbystatusServer1.kt -src/main/kotlin/org/openapijsonschematools/client/paths/petfindbystatus/servers/server1/PetfindbystatusServer1Variables.kt -src/main/kotlin/org/openapijsonschematools/client/paths/petfindbytags/PetfindbytagsGet.kt -src/main/kotlin/org/openapijsonschematools/client/paths/petfindbytags/get/Parameters.kt -src/main/kotlin/org/openapijsonschematools/client/paths/petfindbytags/get/PetfindbytagsGetQueryParameters.kt -src/main/kotlin/org/openapijsonschematools/client/paths/petfindbytags/get/PetfindbytagsGetResponses.kt -src/main/kotlin/org/openapijsonschematools/client/paths/petfindbytags/get/PetfindbytagsGetSecurityInfo.kt -src/main/kotlin/org/openapijsonschematools/client/paths/petfindbytags/get/parameters/Parameter0.kt -src/main/kotlin/org/openapijsonschematools/client/paths/petfindbytags/get/parameters/parameter0/Schema0.kt -src/main/kotlin/org/openapijsonschematools/client/paths/petfindbytags/get/responses/PetfindbytagsGetCode200Response.kt -src/main/kotlin/org/openapijsonschematools/client/paths/petfindbytags/get/responses/PetfindbytagsGetCode400Response.kt -src/main/kotlin/org/openapijsonschematools/client/paths/petfindbytags/get/security/PetfindbytagsGetSecurityRequirementObject0.kt -src/main/kotlin/org/openapijsonschematools/client/paths/petfindbytags/get/security/PetfindbytagsGetSecurityRequirementObject1.kt -src/main/kotlin/org/openapijsonschematools/client/paths/petpetid/PetpetidDelete.kt -src/main/kotlin/org/openapijsonschematools/client/paths/petpetid/PetpetidGet.kt -src/main/kotlin/org/openapijsonschematools/client/paths/petpetid/PetpetidPost.kt -src/main/kotlin/org/openapijsonschematools/client/paths/petpetid/delete/Parameters.kt -src/main/kotlin/org/openapijsonschematools/client/paths/petpetid/delete/PetpetidDeleteHeaderParameters.kt -src/main/kotlin/org/openapijsonschematools/client/paths/petpetid/delete/PetpetidDeletePathParameters.kt -src/main/kotlin/org/openapijsonschematools/client/paths/petpetid/delete/PetpetidDeleteResponses.kt -src/main/kotlin/org/openapijsonschematools/client/paths/petpetid/delete/PetpetidDeleteSecurityInfo.kt -src/main/kotlin/org/openapijsonschematools/client/paths/petpetid/delete/parameters/Parameter0.kt -src/main/kotlin/org/openapijsonschematools/client/paths/petpetid/delete/parameters/Parameter1.kt -src/main/kotlin/org/openapijsonschematools/client/paths/petpetid/delete/parameters/parameter0/Schema0.kt -src/main/kotlin/org/openapijsonschematools/client/paths/petpetid/delete/parameters/parameter1/Schema1.kt -src/main/kotlin/org/openapijsonschematools/client/paths/petpetid/delete/responses/PetpetidDeleteCode400Response.kt -src/main/kotlin/org/openapijsonschematools/client/paths/petpetid/delete/security/PetpetidDeleteSecurityRequirementObject0.kt -src/main/kotlin/org/openapijsonschematools/client/paths/petpetid/delete/security/PetpetidDeleteSecurityRequirementObject1.kt -src/main/kotlin/org/openapijsonschematools/client/paths/petpetid/get/Parameters.kt -src/main/kotlin/org/openapijsonschematools/client/paths/petpetid/get/PetpetidGetPathParameters.kt -src/main/kotlin/org/openapijsonschematools/client/paths/petpetid/get/PetpetidGetResponses.kt -src/main/kotlin/org/openapijsonschematools/client/paths/petpetid/get/PetpetidGetSecurityInfo.kt -src/main/kotlin/org/openapijsonschematools/client/paths/petpetid/get/parameters/Parameter0.kt -src/main/kotlin/org/openapijsonschematools/client/paths/petpetid/get/parameters/parameter0/Schema0.kt -src/main/kotlin/org/openapijsonschematools/client/paths/petpetid/get/responses/PetpetidGetCode200Response.kt -src/main/kotlin/org/openapijsonschematools/client/paths/petpetid/get/responses/PetpetidGetCode400Response.kt -src/main/kotlin/org/openapijsonschematools/client/paths/petpetid/get/responses/PetpetidGetCode404Response.kt -src/main/kotlin/org/openapijsonschematools/client/paths/petpetid/get/responses/code200response/content/applicationjson/ApplicationjsonSchema.kt -src/main/kotlin/org/openapijsonschematools/client/paths/petpetid/get/responses/code200response/content/applicationxml/ApplicationxmlSchema.kt -src/main/kotlin/org/openapijsonschematools/client/paths/petpetid/get/security/PetpetidGetSecurityRequirementObject0.kt -src/main/kotlin/org/openapijsonschematools/client/paths/petpetid/post/Parameters.kt -src/main/kotlin/org/openapijsonschematools/client/paths/petpetid/post/PetpetidPostPathParameters.kt -src/main/kotlin/org/openapijsonschematools/client/paths/petpetid/post/PetpetidPostRequestBody.kt -src/main/kotlin/org/openapijsonschematools/client/paths/petpetid/post/PetpetidPostResponses.kt -src/main/kotlin/org/openapijsonschematools/client/paths/petpetid/post/PetpetidPostSecurityInfo.kt -src/main/kotlin/org/openapijsonschematools/client/paths/petpetid/post/parameters/Parameter0.kt -src/main/kotlin/org/openapijsonschematools/client/paths/petpetid/post/parameters/parameter0/Schema0.kt -src/main/kotlin/org/openapijsonschematools/client/paths/petpetid/post/requestbody/content/applicationxwwwformurlencoded/ApplicationxwwwformurlencodedSchema.kt -src/main/kotlin/org/openapijsonschematools/client/paths/petpetid/post/responses/PetpetidPostCode405Response.kt -src/main/kotlin/org/openapijsonschematools/client/paths/petpetid/post/security/PetpetidPostSecurityRequirementObject0.kt -src/main/kotlin/org/openapijsonschematools/client/paths/petpetid/post/security/PetpetidPostSecurityRequirementObject1.kt -src/main/kotlin/org/openapijsonschematools/client/paths/petpetiduploadimage/PetpetiduploadimagePost.kt -src/main/kotlin/org/openapijsonschematools/client/paths/petpetiduploadimage/post/Parameters.kt -src/main/kotlin/org/openapijsonschematools/client/paths/petpetiduploadimage/post/PetpetiduploadimagePostPathParameters.kt -src/main/kotlin/org/openapijsonschematools/client/paths/petpetiduploadimage/post/PetpetiduploadimagePostRequestBody.kt -src/main/kotlin/org/openapijsonschematools/client/paths/petpetiduploadimage/post/PetpetiduploadimagePostResponses.kt -src/main/kotlin/org/openapijsonschematools/client/paths/petpetiduploadimage/post/PetpetiduploadimagePostSecurityInfo.kt -src/main/kotlin/org/openapijsonschematools/client/paths/petpetiduploadimage/post/parameters/Parameter0.kt -src/main/kotlin/org/openapijsonschematools/client/paths/petpetiduploadimage/post/parameters/parameter0/Schema0.kt -src/main/kotlin/org/openapijsonschematools/client/paths/petpetiduploadimage/post/requestbody/content/multipartformdata/MultipartformdataSchema.kt -src/main/kotlin/org/openapijsonschematools/client/paths/petpetiduploadimage/post/responses/PetpetiduploadimagePostCode200Response.kt -src/main/kotlin/org/openapijsonschematools/client/paths/petpetiduploadimage/post/security/PetpetiduploadimagePostSecurityRequirementObject0.kt -src/main/kotlin/org/openapijsonschematools/client/paths/solidus/SolidusGet.kt -src/main/kotlin/org/openapijsonschematools/client/paths/solidus/get/SolidusGetResponses.kt -src/main/kotlin/org/openapijsonschematools/client/paths/solidus/get/responses/SolidusGetCode200Response.kt -src/main/kotlin/org/openapijsonschematools/client/paths/storeinventory/StoreinventoryGet.kt -src/main/kotlin/org/openapijsonschematools/client/paths/storeinventory/get/StoreinventoryGetResponses.kt -src/main/kotlin/org/openapijsonschematools/client/paths/storeinventory/get/StoreinventoryGetSecurityInfo.kt -src/main/kotlin/org/openapijsonschematools/client/paths/storeinventory/get/responses/StoreinventoryGetCode200Response.kt -src/main/kotlin/org/openapijsonschematools/client/paths/storeinventory/get/security/StoreinventoryGetSecurityRequirementObject0.kt -src/main/kotlin/org/openapijsonschematools/client/paths/storeorder/StoreorderPost.kt -src/main/kotlin/org/openapijsonschematools/client/paths/storeorder/post/StoreorderPostRequestBody.kt -src/main/kotlin/org/openapijsonschematools/client/paths/storeorder/post/StoreorderPostResponses.kt -src/main/kotlin/org/openapijsonschematools/client/paths/storeorder/post/requestbody/content/applicationjson/ApplicationjsonSchema.kt -src/main/kotlin/org/openapijsonschematools/client/paths/storeorder/post/responses/StoreorderPostCode200Response.kt -src/main/kotlin/org/openapijsonschematools/client/paths/storeorder/post/responses/StoreorderPostCode400Response.kt -src/main/kotlin/org/openapijsonschematools/client/paths/storeorder/post/responses/code200response/content/applicationjson/ApplicationjsonSchema.kt -src/main/kotlin/org/openapijsonschematools/client/paths/storeorder/post/responses/code200response/content/applicationxml/ApplicationxmlSchema.kt -src/main/kotlin/org/openapijsonschematools/client/paths/storeorderorderid/StoreorderorderidDelete.kt -src/main/kotlin/org/openapijsonschematools/client/paths/storeorderorderid/StoreorderorderidGet.kt -src/main/kotlin/org/openapijsonschematools/client/paths/storeorderorderid/delete/Parameters.kt -src/main/kotlin/org/openapijsonschematools/client/paths/storeorderorderid/delete/StoreorderorderidDeletePathParameters.kt -src/main/kotlin/org/openapijsonschematools/client/paths/storeorderorderid/delete/StoreorderorderidDeleteResponses.kt -src/main/kotlin/org/openapijsonschematools/client/paths/storeorderorderid/delete/parameters/Parameter0.kt -src/main/kotlin/org/openapijsonschematools/client/paths/storeorderorderid/delete/parameters/parameter0/Schema0.kt -src/main/kotlin/org/openapijsonschematools/client/paths/storeorderorderid/delete/responses/StoreorderorderidDeleteCode400Response.kt -src/main/kotlin/org/openapijsonschematools/client/paths/storeorderorderid/delete/responses/StoreorderorderidDeleteCode404Response.kt -src/main/kotlin/org/openapijsonschematools/client/paths/storeorderorderid/get/Parameters.kt -src/main/kotlin/org/openapijsonschematools/client/paths/storeorderorderid/get/StoreorderorderidGetPathParameters.kt -src/main/kotlin/org/openapijsonschematools/client/paths/storeorderorderid/get/StoreorderorderidGetResponses.kt -src/main/kotlin/org/openapijsonschematools/client/paths/storeorderorderid/get/parameters/Parameter0.kt -src/main/kotlin/org/openapijsonschematools/client/paths/storeorderorderid/get/parameters/parameter0/Schema0.kt -src/main/kotlin/org/openapijsonschematools/client/paths/storeorderorderid/get/responses/StoreorderorderidGetCode200Response.kt -src/main/kotlin/org/openapijsonschematools/client/paths/storeorderorderid/get/responses/StoreorderorderidGetCode400Response.kt -src/main/kotlin/org/openapijsonschematools/client/paths/storeorderorderid/get/responses/StoreorderorderidGetCode404Response.kt -src/main/kotlin/org/openapijsonschematools/client/paths/storeorderorderid/get/responses/code200response/content/applicationjson/ApplicationjsonSchema.kt -src/main/kotlin/org/openapijsonschematools/client/paths/storeorderorderid/get/responses/code200response/content/applicationxml/ApplicationxmlSchema.kt -src/main/kotlin/org/openapijsonschematools/client/paths/user/UserPost.kt -src/main/kotlin/org/openapijsonschematools/client/paths/user/post/UserPostRequestBody.kt -src/main/kotlin/org/openapijsonschematools/client/paths/user/post/UserPostResponses.kt -src/main/kotlin/org/openapijsonschematools/client/paths/user/post/requestbody/content/applicationjson/ApplicationjsonSchema.kt -src/main/kotlin/org/openapijsonschematools/client/paths/user/post/responses/UserPostCodedefaultResponse.kt -src/main/kotlin/org/openapijsonschematools/client/paths/usercreatewitharray/UsercreatewitharrayPost.kt -src/main/kotlin/org/openapijsonschematools/client/paths/usercreatewitharray/post/UsercreatewitharrayPostRequestBody.kt -src/main/kotlin/org/openapijsonschematools/client/paths/usercreatewitharray/post/UsercreatewitharrayPostResponses.kt -src/main/kotlin/org/openapijsonschematools/client/paths/usercreatewitharray/post/responses/UsercreatewitharrayPostCodedefaultResponse.kt -src/main/kotlin/org/openapijsonschematools/client/paths/usercreatewithlist/UsercreatewithlistPost.kt -src/main/kotlin/org/openapijsonschematools/client/paths/usercreatewithlist/post/UsercreatewithlistPostRequestBody.kt -src/main/kotlin/org/openapijsonschematools/client/paths/usercreatewithlist/post/UsercreatewithlistPostResponses.kt -src/main/kotlin/org/openapijsonschematools/client/paths/usercreatewithlist/post/responses/UsercreatewithlistPostCodedefaultResponse.kt -src/main/kotlin/org/openapijsonschematools/client/paths/userlogin/UserloginGet.kt -src/main/kotlin/org/openapijsonschematools/client/paths/userlogin/get/Parameters.kt -src/main/kotlin/org/openapijsonschematools/client/paths/userlogin/get/UserloginGetQueryParameters.kt -src/main/kotlin/org/openapijsonschematools/client/paths/userlogin/get/UserloginGetResponses.kt -src/main/kotlin/org/openapijsonschematools/client/paths/userlogin/get/parameters/Parameter0.kt -src/main/kotlin/org/openapijsonschematools/client/paths/userlogin/get/parameters/Parameter1.kt -src/main/kotlin/org/openapijsonschematools/client/paths/userlogin/get/parameters/parameter0/Schema0.kt -src/main/kotlin/org/openapijsonschematools/client/paths/userlogin/get/parameters/parameter1/Schema1.kt -src/main/kotlin/org/openapijsonschematools/client/paths/userlogin/get/responses/UserloginGetCode200Response.kt -src/main/kotlin/org/openapijsonschematools/client/paths/userlogin/get/responses/UserloginGetCode400Response.kt -src/main/kotlin/org/openapijsonschematools/client/paths/userlogin/get/responses/code200response/Headers.kt -src/main/kotlin/org/openapijsonschematools/client/paths/userlogin/get/responses/code200response/UserloginGetCode200ResponseHeadersSchema.kt -src/main/kotlin/org/openapijsonschematools/client/paths/userlogin/get/responses/code200response/content/applicationjson/ApplicationjsonSchema.kt -src/main/kotlin/org/openapijsonschematools/client/paths/userlogin/get/responses/code200response/content/applicationxml/ApplicationxmlSchema.kt -src/main/kotlin/org/openapijsonschematools/client/paths/userlogin/get/responses/code200response/headers/Int32.kt -src/main/kotlin/org/openapijsonschematools/client/paths/userlogin/get/responses/code200response/headers/NumberHeader.kt -src/main/kotlin/org/openapijsonschematools/client/paths/userlogin/get/responses/code200response/headers/Refcontentschemaheader.kt -src/main/kotlin/org/openapijsonschematools/client/paths/userlogin/get/responses/code200response/headers/XExpiresAfter.kt -src/main/kotlin/org/openapijsonschematools/client/paths/userlogin/get/responses/code200response/headers/XRateLimit.kt -src/main/kotlin/org/openapijsonschematools/client/paths/userlogin/get/responses/code200response/headers/xexpiresafter/XExpiresAfterSchema.kt -src/main/kotlin/org/openapijsonschematools/client/paths/userlogin/get/responses/code200response/headers/xratelimit/content/applicationjson/XRateLimitSchema.kt -src/main/kotlin/org/openapijsonschematools/client/paths/userlogout/UserlogoutGet.kt -src/main/kotlin/org/openapijsonschematools/client/paths/userlogout/get/UserlogoutGetResponses.kt -src/main/kotlin/org/openapijsonschematools/client/paths/userlogout/get/responses/UserlogoutGetCodedefaultResponse.kt -src/main/kotlin/org/openapijsonschematools/client/paths/userusername/UserusernameDelete.kt -src/main/kotlin/org/openapijsonschematools/client/paths/userusername/UserusernameGet.kt -src/main/kotlin/org/openapijsonschematools/client/paths/userusername/UserusernamePut.kt -src/main/kotlin/org/openapijsonschematools/client/paths/userusername/delete/Parameters.kt -src/main/kotlin/org/openapijsonschematools/client/paths/userusername/delete/UserusernameDeletePathParameters.kt -src/main/kotlin/org/openapijsonschematools/client/paths/userusername/delete/UserusernameDeleteResponses.kt -src/main/kotlin/org/openapijsonschematools/client/paths/userusername/delete/parameters/Parameter0.kt -src/main/kotlin/org/openapijsonschematools/client/paths/userusername/delete/responses/UserusernameDeleteCode200Response.kt -src/main/kotlin/org/openapijsonschematools/client/paths/userusername/delete/responses/UserusernameDeleteCode404Response.kt -src/main/kotlin/org/openapijsonschematools/client/paths/userusername/get/Parameters.kt -src/main/kotlin/org/openapijsonschematools/client/paths/userusername/get/UserusernameGetPathParameters.kt -src/main/kotlin/org/openapijsonschematools/client/paths/userusername/get/UserusernameGetResponses.kt -src/main/kotlin/org/openapijsonschematools/client/paths/userusername/get/parameters/Parameter0.kt -src/main/kotlin/org/openapijsonschematools/client/paths/userusername/get/responses/UserusernameGetCode200Response.kt -src/main/kotlin/org/openapijsonschematools/client/paths/userusername/get/responses/UserusernameGetCode400Response.kt -src/main/kotlin/org/openapijsonschematools/client/paths/userusername/get/responses/UserusernameGetCode404Response.kt -src/main/kotlin/org/openapijsonschematools/client/paths/userusername/get/responses/code200response/content/applicationjson/ApplicationjsonSchema.kt -src/main/kotlin/org/openapijsonschematools/client/paths/userusername/get/responses/code200response/content/applicationxml/ApplicationxmlSchema.kt -src/main/kotlin/org/openapijsonschematools/client/paths/userusername/put/Parameters.kt -src/main/kotlin/org/openapijsonschematools/client/paths/userusername/put/UserusernamePutPathParameters.kt -src/main/kotlin/org/openapijsonschematools/client/paths/userusername/put/UserusernamePutRequestBody.kt -src/main/kotlin/org/openapijsonschematools/client/paths/userusername/put/UserusernamePutResponses.kt -src/main/kotlin/org/openapijsonschematools/client/paths/userusername/put/parameters/Parameter0.kt -src/main/kotlin/org/openapijsonschematools/client/paths/userusername/put/requestbody/content/applicationjson/ApplicationjsonSchema.kt -src/main/kotlin/org/openapijsonschematools/client/paths/userusername/put/responses/UserusernamePutCode400Response.kt -src/main/kotlin/org/openapijsonschematools/client/paths/userusername/put/responses/UserusernamePutCode404Response.kt -src/main/kotlin/org/openapijsonschematools/client/requestbody/GenericRequestBody.kt -src/main/kotlin/org/openapijsonschematools/client/requestbody/RequestBodySerializer.kt -src/main/kotlin/org/openapijsonschematools/client/requestbody/SerializedRequestBody.kt -src/main/kotlin/org/openapijsonschematools/client/response/ApiResponse.kt -src/main/kotlin/org/openapijsonschematools/client/response/DeserializedHttpResponse.kt -src/main/kotlin/org/openapijsonschematools/client/response/HeadersDeserializer.kt -src/main/kotlin/org/openapijsonschematools/client/response/ResponseDeserializer.kt -src/main/kotlin/org/openapijsonschematools/client/response/ResponsesDeserializer.kt -src/main/kotlin/org/openapijsonschematools/client/restclient/RestClient.kt -src/main/kotlin/org/openapijsonschematools/client/schemas/AnyTypeJsonSchema.kt -src/main/kotlin/org/openapijsonschematools/client/schemas/BooleanJsonSchema.kt -src/main/kotlin/org/openapijsonschematools/client/schemas/DateJsonSchema.kt -src/main/kotlin/org/openapijsonschematools/client/schemas/DateTimeJsonSchema.kt -src/main/kotlin/org/openapijsonschematools/client/schemas/DecimalJsonSchema.kt -src/main/kotlin/org/openapijsonschematools/client/schemas/DoubleJsonSchema.kt -src/main/kotlin/org/openapijsonschematools/client/schemas/FloatJsonSchema.kt -src/main/kotlin/org/openapijsonschematools/client/schemas/GenericBuilder.kt -src/main/kotlin/org/openapijsonschematools/client/schemas/Int32JsonSchema.kt -src/main/kotlin/org/openapijsonschematools/client/schemas/Int64JsonSchema.kt -src/main/kotlin/org/openapijsonschematools/client/schemas/IntJsonSchema.kt -src/main/kotlin/org/openapijsonschematools/client/schemas/ListJsonSchema.kt -src/main/kotlin/org/openapijsonschematools/client/schemas/MapJsonSchema.kt -src/main/kotlin/org/openapijsonschematools/client/schemas/NotAnyTypeJsonSchema.kt -src/main/kotlin/org/openapijsonschematools/client/schemas/NullJsonSchema.kt -src/main/kotlin/org/openapijsonschematools/client/schemas/NumberJsonSchema.kt -src/main/kotlin/org/openapijsonschematools/client/schemas/SetMaker.kt -src/main/kotlin/org/openapijsonschematools/client/schemas/StringJsonSchema.kt -src/main/kotlin/org/openapijsonschematools/client/schemas/UnsetAddPropsSetter.kt -src/main/kotlin/org/openapijsonschematools/client/schemas/UuidJsonSchema.kt -src/main/kotlin/org/openapijsonschematools/client/schemas/validation/AdditionalPropertiesValidator.kt -src/main/kotlin/org/openapijsonschematools/client/schemas/validation/AllOfValidator.kt -src/main/kotlin/org/openapijsonschematools/client/schemas/validation/AnyOfValidator.kt -src/main/kotlin/org/openapijsonschematools/client/schemas/validation/BigDecimalValidator.kt -src/main/kotlin/org/openapijsonschematools/client/schemas/validation/BooleanEnumValidator.kt -src/main/kotlin/org/openapijsonschematools/client/schemas/validation/BooleanSchemaValidator.kt -src/main/kotlin/org/openapijsonschematools/client/schemas/validation/BooleanValueMethod.kt -src/main/kotlin/org/openapijsonschematools/client/schemas/validation/ConstValidator.kt -src/main/kotlin/org/openapijsonschematools/client/schemas/validation/ContainsValidator.kt -src/main/kotlin/org/openapijsonschematools/client/schemas/validation/CustomIsoparser.kt -src/main/kotlin/org/openapijsonschematools/client/schemas/validation/DefaultValueMethod.kt -src/main/kotlin/org/openapijsonschematools/client/schemas/validation/DependentRequiredValidator.kt -src/main/kotlin/org/openapijsonschematools/client/schemas/validation/DependentSchemasValidator.kt -src/main/kotlin/org/openapijsonschematools/client/schemas/validation/DoubleEnumValidator.kt -src/main/kotlin/org/openapijsonschematools/client/schemas/validation/DoubleValueMethod.kt -src/main/kotlin/org/openapijsonschematools/client/schemas/validation/ElseValidator.kt -src/main/kotlin/org/openapijsonschematools/client/schemas/validation/EnumValidator.kt -src/main/kotlin/org/openapijsonschematools/client/schemas/validation/ExclusiveMaximumValidator.kt -src/main/kotlin/org/openapijsonschematools/client/schemas/validation/ExclusiveMinimumValidator.kt -src/main/kotlin/org/openapijsonschematools/client/schemas/validation/FloatEnumValidator.kt -src/main/kotlin/org/openapijsonschematools/client/schemas/validation/FloatValueMethod.kt -src/main/kotlin/org/openapijsonschematools/client/schemas/validation/FormatValidator.kt -src/main/kotlin/org/openapijsonschematools/client/schemas/validation/FrozenList.kt -src/main/kotlin/org/openapijsonschematools/client/schemas/validation/FrozenMap.kt -src/main/kotlin/org/openapijsonschematools/client/schemas/validation/IfValidator.kt -src/main/kotlin/org/openapijsonschematools/client/schemas/validation/IntegerEnumValidator.kt -src/main/kotlin/org/openapijsonschematools/client/schemas/validation/IntegerValueMethod.kt -src/main/kotlin/org/openapijsonschematools/client/schemas/validation/ItemsValidator.kt -src/main/kotlin/org/openapijsonschematools/client/schemas/validation/JsonSchema.kt -src/main/kotlin/org/openapijsonschematools/client/schemas/validation/JsonSchemaFactory.kt -src/main/kotlin/org/openapijsonschematools/client/schemas/validation/JsonSchemaInfo.kt -src/main/kotlin/org/openapijsonschematools/client/schemas/validation/KeywordEntry.kt -src/main/kotlin/org/openapijsonschematools/client/schemas/validation/KeywordValidator.kt -src/main/kotlin/org/openapijsonschematools/client/schemas/validation/LengthValidator.kt -src/main/kotlin/org/openapijsonschematools/client/schemas/validation/ListSchemaValidator.kt -src/main/kotlin/org/openapijsonschematools/client/schemas/validation/LongEnumValidator.kt -src/main/kotlin/org/openapijsonschematools/client/schemas/validation/LongValueMethod.kt -src/main/kotlin/org/openapijsonschematools/client/schemas/validation/MapSchemaValidator.kt -src/main/kotlin/org/openapijsonschematools/client/schemas/validation/MapUtils.kt -src/main/kotlin/org/openapijsonschematools/client/schemas/validation/MaxContainsValidator.kt -src/main/kotlin/org/openapijsonschematools/client/schemas/validation/MaxItemsValidator.kt -src/main/kotlin/org/openapijsonschematools/client/schemas/validation/MaxLengthValidator.kt -src/main/kotlin/org/openapijsonschematools/client/schemas/validation/MaxPropertiesValidator.kt -src/main/kotlin/org/openapijsonschematools/client/schemas/validation/MaximumValidator.kt -src/main/kotlin/org/openapijsonschematools/client/schemas/validation/MinContainsValidator.kt -src/main/kotlin/org/openapijsonschematools/client/schemas/validation/MinItemsValidator.kt -src/main/kotlin/org/openapijsonschematools/client/schemas/validation/MinLengthValidator.kt -src/main/kotlin/org/openapijsonschematools/client/schemas/validation/MinPropertiesValidator.kt -src/main/kotlin/org/openapijsonschematools/client/schemas/validation/MinimumValidator.kt -src/main/kotlin/org/openapijsonschematools/client/schemas/validation/MultipleOfValidator.kt -src/main/kotlin/org/openapijsonschematools/client/schemas/validation/NotValidator.kt -src/main/kotlin/org/openapijsonschematools/client/schemas/validation/NullEnumValidator.kt -src/main/kotlin/org/openapijsonschematools/client/schemas/validation/NullSchemaValidator.kt -src/main/kotlin/org/openapijsonschematools/client/schemas/validation/NullValueMethod.kt -src/main/kotlin/org/openapijsonschematools/client/schemas/validation/NumberSchemaValidator.kt -src/main/kotlin/org/openapijsonschematools/client/schemas/validation/OneOfValidator.kt -src/main/kotlin/org/openapijsonschematools/client/schemas/validation/PathToSchemasMap.kt -src/main/kotlin/org/openapijsonschematools/client/schemas/validation/PatternPropertiesValidator.kt -src/main/kotlin/org/openapijsonschematools/client/schemas/validation/PatternValidator.kt -src/main/kotlin/org/openapijsonschematools/client/schemas/validation/PrefixItemsValidator.kt -src/main/kotlin/org/openapijsonschematools/client/schemas/validation/PropertiesValidator.kt -src/main/kotlin/org/openapijsonschematools/client/schemas/validation/PropertyEntry.kt -src/main/kotlin/org/openapijsonschematools/client/schemas/validation/PropertyNamesValidator.kt -src/main/kotlin/org/openapijsonschematools/client/schemas/validation/RequiredValidator.kt -src/main/kotlin/org/openapijsonschematools/client/schemas/validation/StringEnumValidator.kt -src/main/kotlin/org/openapijsonschematools/client/schemas/validation/StringSchemaValidator.kt -src/main/kotlin/org/openapijsonschematools/client/schemas/validation/StringValueMethod.kt -src/main/kotlin/org/openapijsonschematools/client/schemas/validation/ThenValidator.kt -src/main/kotlin/org/openapijsonschematools/client/schemas/validation/TypeValidator.kt -src/main/kotlin/org/openapijsonschematools/client/schemas/validation/UnevaluatedItemsValidator.kt -src/main/kotlin/org/openapijsonschematools/client/schemas/validation/UnevaluatedPropertiesValidator.kt -src/main/kotlin/org/openapijsonschematools/client/schemas/validation/UniqueItemsValidator.kt -src/main/kotlin/org/openapijsonschematools/client/schemas/validation/UnsetAnyTypeJsonSchema.kt -src/main/kotlin/org/openapijsonschematools/client/schemas/validation/ValidationData.kt -src/main/kotlin/org/openapijsonschematools/client/schemas/validation/ValidationMetadata.kt -src/main/kotlin/org/openapijsonschematools/client/securityrequirementobjects/AuthApplier.kt -src/main/kotlin/org/openapijsonschematools/client/securityrequirementobjects/EmptySecurityRequirementObject.kt -src/main/kotlin/org/openapijsonschematools/client/securityrequirementobjects/SecurityRequirementObject.kt -src/main/kotlin/org/openapijsonschematools/client/securityrequirementobjects/SecurityRequirementObjectProvider.kt -src/main/kotlin/org/openapijsonschematools/client/securityschemes/ApiKeyCookieSecurityScheme.kt -src/main/kotlin/org/openapijsonschematools/client/securityschemes/ApiKeyHeaderSecurityScheme.kt -src/main/kotlin/org/openapijsonschematools/client/securityschemes/ApiKeyQuerySecurityScheme.kt -src/main/kotlin/org/openapijsonschematools/client/securityschemes/HttpBasicSecurityScheme.kt -src/main/kotlin/org/openapijsonschematools/client/securityschemes/HttpBearerSecurityScheme.kt -src/main/kotlin/org/openapijsonschematools/client/securityschemes/HttpDigestSecurityScheme.kt -src/main/kotlin/org/openapijsonschematools/client/securityschemes/HttpSignatureSecurityScheme.kt -src/main/kotlin/org/openapijsonschematools/client/securityschemes/MutualTlsSecurityScheme.kt -src/main/kotlin/org/openapijsonschematools/client/securityschemes/OAuth2SecurityScheme.kt -src/main/kotlin/org/openapijsonschematools/client/securityschemes/OpenIdConnectSecurityScheme.kt -src/main/kotlin/org/openapijsonschematools/client/securityschemes/SecurityScheme.kt -src/main/kotlin/org/openapijsonschematools/client/servers/RootServer0.kt -src/main/kotlin/org/openapijsonschematools/client/servers/RootServer1.kt -src/main/kotlin/org/openapijsonschematools/client/servers/RootServer2.kt -src/main/kotlin/org/openapijsonschematools/client/servers/Server.kt -src/main/kotlin/org/openapijsonschematools/client/servers/ServerProvider.kt -src/main/kotlin/org/openapijsonschematools/client/servers/ServerWithVariables.kt -src/main/kotlin/org/openapijsonschematools/client/servers/ServerWithoutVariables.kt -src/main/kotlin/org/openapijsonschematools/client/servers/rootserver0/RootServer0Variables.kt -src/main/kotlin/org/openapijsonschematools/client/servers/rootserver1/RootServer1Variables.kt -src/test/kotlin/org/openapijsonschematools/client/components/schemas/AbstractStepMessageTest.kt -src/test/kotlin/org/openapijsonschematools/client/components/schemas/AdditionalPropertiesClassTest.kt -src/test/kotlin/org/openapijsonschematools/client/components/schemas/AdditionalPropertiesSchemaTest.kt -src/test/kotlin/org/openapijsonschematools/client/components/schemas/AdditionalPropertiesWithArrayOfEnumsTest.kt -src/test/kotlin/org/openapijsonschematools/client/components/schemas/AddressTest.kt -src/test/kotlin/org/openapijsonschematools/client/components/schemas/AnimalFarmTest.kt -src/test/kotlin/org/openapijsonschematools/client/components/schemas/AnimalTest.kt -src/test/kotlin/org/openapijsonschematools/client/components/schemas/AnyTypeAndFormatTest.kt -src/test/kotlin/org/openapijsonschematools/client/components/schemas/AnyTypeNotStringTest.kt -src/test/kotlin/org/openapijsonschematools/client/components/schemas/ApiResponseSchemaTest.kt -src/test/kotlin/org/openapijsonschematools/client/components/schemas/AppleReqTest.kt -src/test/kotlin/org/openapijsonschematools/client/components/schemas/AppleTest.kt -src/test/kotlin/org/openapijsonschematools/client/components/schemas/ArrayHoldingAnyTypeTest.kt -src/test/kotlin/org/openapijsonschematools/client/components/schemas/ArrayOfArrayOfNumberOnlyTest.kt -src/test/kotlin/org/openapijsonschematools/client/components/schemas/ArrayOfEnumsTest.kt -src/test/kotlin/org/openapijsonschematools/client/components/schemas/ArrayOfNumberOnlyTest.kt -src/test/kotlin/org/openapijsonschematools/client/components/schemas/ArrayTestTest.kt -src/test/kotlin/org/openapijsonschematools/client/components/schemas/ArrayWithValidationsInItemsTest.kt -src/test/kotlin/org/openapijsonschematools/client/components/schemas/BananaReqTest.kt -src/test/kotlin/org/openapijsonschematools/client/components/schemas/BananaTest.kt -src/test/kotlin/org/openapijsonschematools/client/components/schemas/BarTest.kt -src/test/kotlin/org/openapijsonschematools/client/components/schemas/BasquePigTest.kt -src/test/kotlin/org/openapijsonschematools/client/components/schemas/BooleanEnumTest.kt -src/test/kotlin/org/openapijsonschematools/client/components/schemas/BooleanSchemaTest.kt -src/test/kotlin/org/openapijsonschematools/client/components/schemas/CapitalizationTest.kt -src/test/kotlin/org/openapijsonschematools/client/components/schemas/CatTest.kt -src/test/kotlin/org/openapijsonschematools/client/components/schemas/CategoryTest.kt -src/test/kotlin/org/openapijsonschematools/client/components/schemas/ChildCatTest.kt -src/test/kotlin/org/openapijsonschematools/client/components/schemas/ClassModelTest.kt -src/test/kotlin/org/openapijsonschematools/client/components/schemas/ClientTest.kt -src/test/kotlin/org/openapijsonschematools/client/components/schemas/ComplexQuadrilateralTest.kt -src/test/kotlin/org/openapijsonschematools/client/components/schemas/ComposedAnyOfDifferentTypesNoValidationsTest.kt -src/test/kotlin/org/openapijsonschematools/client/components/schemas/ComposedArrayTest.kt -src/test/kotlin/org/openapijsonschematools/client/components/schemas/ComposedBoolTest.kt -src/test/kotlin/org/openapijsonschematools/client/components/schemas/ComposedNoneTest.kt -src/test/kotlin/org/openapijsonschematools/client/components/schemas/ComposedNumberTest.kt -src/test/kotlin/org/openapijsonschematools/client/components/schemas/ComposedObjectTest.kt -src/test/kotlin/org/openapijsonschematools/client/components/schemas/ComposedOneOfDifferentTypesTest.kt -src/test/kotlin/org/openapijsonschematools/client/components/schemas/ComposedStringTest.kt -src/test/kotlin/org/openapijsonschematools/client/components/schemas/CurrencyTest.kt -src/test/kotlin/org/openapijsonschematools/client/components/schemas/DanishPigTest.kt -src/test/kotlin/org/openapijsonschematools/client/components/schemas/DateTimeTestTest.kt -src/test/kotlin/org/openapijsonschematools/client/components/schemas/DateTimeWithValidationsTest.kt -src/test/kotlin/org/openapijsonschematools/client/components/schemas/DateWithValidationsTest.kt -src/test/kotlin/org/openapijsonschematools/client/components/schemas/DecimalPayloadTest.kt -src/test/kotlin/org/openapijsonschematools/client/components/schemas/DogTest.kt -src/test/kotlin/org/openapijsonschematools/client/components/schemas/DrawingTest.kt -src/test/kotlin/org/openapijsonschematools/client/components/schemas/EnumArraysTest.kt -src/test/kotlin/org/openapijsonschematools/client/components/schemas/EnumClassTest.kt -src/test/kotlin/org/openapijsonschematools/client/components/schemas/EnumTestTest.kt -src/test/kotlin/org/openapijsonschematools/client/components/schemas/EquilateralTriangleTest.kt -src/test/kotlin/org/openapijsonschematools/client/components/schemas/FileSchemaTestClassTest.kt -src/test/kotlin/org/openapijsonschematools/client/components/schemas/FileTest.kt -src/test/kotlin/org/openapijsonschematools/client/components/schemas/FooTest.kt -src/test/kotlin/org/openapijsonschematools/client/components/schemas/FormatTestTest.kt -src/test/kotlin/org/openapijsonschematools/client/components/schemas/FromSchemaTest.kt -src/test/kotlin/org/openapijsonschematools/client/components/schemas/FruitReqTest.kt -src/test/kotlin/org/openapijsonschematools/client/components/schemas/FruitTest.kt -src/test/kotlin/org/openapijsonschematools/client/components/schemas/GmFruitTest.kt -src/test/kotlin/org/openapijsonschematools/client/components/schemas/GrandparentAnimalTest.kt -src/test/kotlin/org/openapijsonschematools/client/components/schemas/HasOnlyReadOnlyTest.kt -src/test/kotlin/org/openapijsonschematools/client/components/schemas/HealthCheckResultTest.kt -src/test/kotlin/org/openapijsonschematools/client/components/schemas/IntegerEnumBigTest.kt -src/test/kotlin/org/openapijsonschematools/client/components/schemas/IntegerEnumOneValueTest.kt -src/test/kotlin/org/openapijsonschematools/client/components/schemas/IntegerEnumTest.kt -src/test/kotlin/org/openapijsonschematools/client/components/schemas/IntegerEnumWithDefaultValueTest.kt -src/test/kotlin/org/openapijsonschematools/client/components/schemas/IntegerMax10Test.kt -src/test/kotlin/org/openapijsonschematools/client/components/schemas/IntegerMin15Test.kt -src/test/kotlin/org/openapijsonschematools/client/components/schemas/IsoscelesTriangleTest.kt -src/test/kotlin/org/openapijsonschematools/client/components/schemas/ItemsSchemaTest.kt -src/test/kotlin/org/openapijsonschematools/client/components/schemas/ItemsTest.kt -src/test/kotlin/org/openapijsonschematools/client/components/schemas/JSONPatchRequestAddReplaceTestTest.kt -src/test/kotlin/org/openapijsonschematools/client/components/schemas/JSONPatchRequestMoveCopyTest.kt -src/test/kotlin/org/openapijsonschematools/client/components/schemas/JSONPatchRequestRemoveTest.kt -src/test/kotlin/org/openapijsonschematools/client/components/schemas/JSONPatchRequestTest.kt -src/test/kotlin/org/openapijsonschematools/client/components/schemas/MammalTest.kt -src/test/kotlin/org/openapijsonschematools/client/components/schemas/MapTestTest.kt -src/test/kotlin/org/openapijsonschematools/client/components/schemas/MixedPropertiesAndAdditionalPropertiesClassTest.kt -src/test/kotlin/org/openapijsonschematools/client/components/schemas/MoneyTest.kt -src/test/kotlin/org/openapijsonschematools/client/components/schemas/MultiPropertiesSchemaTest.kt -src/test/kotlin/org/openapijsonschematools/client/components/schemas/MyObjectDtoTest.kt -src/test/kotlin/org/openapijsonschematools/client/components/schemas/NameTest.kt -src/test/kotlin/org/openapijsonschematools/client/components/schemas/NoAdditionalPropertiesTest.kt -src/test/kotlin/org/openapijsonschematools/client/components/schemas/NullableClassTest.kt -src/test/kotlin/org/openapijsonschematools/client/components/schemas/NullableShapeTest.kt -src/test/kotlin/org/openapijsonschematools/client/components/schemas/NullableStringTest.kt -src/test/kotlin/org/openapijsonschematools/client/components/schemas/NumberOnlyTest.kt -src/test/kotlin/org/openapijsonschematools/client/components/schemas/NumberSchemaTest.kt -src/test/kotlin/org/openapijsonschematools/client/components/schemas/NumberWithExclusiveMinMaxTest.kt -src/test/kotlin/org/openapijsonschematools/client/components/schemas/NumberWithValidationsTest.kt -src/test/kotlin/org/openapijsonschematools/client/components/schemas/ObjWithRequiredPropsBaseTest.kt -src/test/kotlin/org/openapijsonschematools/client/components/schemas/ObjWithRequiredPropsTest.kt -src/test/kotlin/org/openapijsonschematools/client/components/schemas/ObjectInterfaceTest.kt -src/test/kotlin/org/openapijsonschematools/client/components/schemas/ObjectModelWithArgAndArgsPropertiesTest.kt -src/test/kotlin/org/openapijsonschematools/client/components/schemas/ObjectModelWithRefPropsTest.kt -src/test/kotlin/org/openapijsonschematools/client/components/schemas/ObjectWithAllOfWithReqTestPropFromUnsetAddPropTest.kt -src/test/kotlin/org/openapijsonschematools/client/components/schemas/ObjectWithCollidingPropertiesTest.kt -src/test/kotlin/org/openapijsonschematools/client/components/schemas/ObjectWithDecimalPropertiesTest.kt -src/test/kotlin/org/openapijsonschematools/client/components/schemas/ObjectWithDifficultlyNamedPropsTest.kt -src/test/kotlin/org/openapijsonschematools/client/components/schemas/ObjectWithInlineCompositionPropertyTest.kt -src/test/kotlin/org/openapijsonschematools/client/components/schemas/ObjectWithInvalidNamedRefedPropertiesTest.kt -src/test/kotlin/org/openapijsonschematools/client/components/schemas/ObjectWithNonIntersectingValuesTest.kt -src/test/kotlin/org/openapijsonschematools/client/components/schemas/ObjectWithOnlyOptionalPropsTest.kt -src/test/kotlin/org/openapijsonschematools/client/components/schemas/ObjectWithOptionalTestPropTest.kt -src/test/kotlin/org/openapijsonschematools/client/components/schemas/ObjectWithValidationsTest.kt -src/test/kotlin/org/openapijsonschematools/client/components/schemas/OrderTest.kt -src/test/kotlin/org/openapijsonschematools/client/components/schemas/PaginatedResultMyObjectDtoTest.kt -src/test/kotlin/org/openapijsonschematools/client/components/schemas/ParentPetTest.kt -src/test/kotlin/org/openapijsonschematools/client/components/schemas/PetTest.kt -src/test/kotlin/org/openapijsonschematools/client/components/schemas/PigTest.kt -src/test/kotlin/org/openapijsonschematools/client/components/schemas/PlayerTest.kt -src/test/kotlin/org/openapijsonschematools/client/components/schemas/PublicKeyTest.kt -src/test/kotlin/org/openapijsonschematools/client/components/schemas/QuadrilateralInterfaceTest.kt -src/test/kotlin/org/openapijsonschematools/client/components/schemas/QuadrilateralTest.kt -src/test/kotlin/org/openapijsonschematools/client/components/schemas/ReadOnlyFirstTest.kt -src/test/kotlin/org/openapijsonschematools/client/components/schemas/RefPetTest.kt -src/test/kotlin/org/openapijsonschematools/client/components/schemas/ReqPropsFromExplicitAddPropsTest.kt -src/test/kotlin/org/openapijsonschematools/client/components/schemas/ReqPropsFromTrueAddPropsTest.kt -src/test/kotlin/org/openapijsonschematools/client/components/schemas/ReqPropsFromUnsetAddPropsTest.kt -src/test/kotlin/org/openapijsonschematools/client/components/schemas/ReturnSchemaTest.kt -src/test/kotlin/org/openapijsonschematools/client/components/schemas/ScaleneTriangleTest.kt -src/test/kotlin/org/openapijsonschematools/client/components/schemas/Schema200ResponseTest.kt -src/test/kotlin/org/openapijsonschematools/client/components/schemas/SelfReferencingArrayModelTest.kt -src/test/kotlin/org/openapijsonschematools/client/components/schemas/SelfReferencingObjectModelTest.kt -src/test/kotlin/org/openapijsonschematools/client/components/schemas/ShapeOrNullTest.kt -src/test/kotlin/org/openapijsonschematools/client/components/schemas/ShapeTest.kt -src/test/kotlin/org/openapijsonschematools/client/components/schemas/SimpleQuadrilateralTest.kt -src/test/kotlin/org/openapijsonschematools/client/components/schemas/SomeObjectTest.kt -src/test/kotlin/org/openapijsonschematools/client/components/schemas/SpecialModelnameTest.kt -src/test/kotlin/org/openapijsonschematools/client/components/schemas/StringBooleanMapTest.kt -src/test/kotlin/org/openapijsonschematools/client/components/schemas/StringEnumTest.kt -src/test/kotlin/org/openapijsonschematools/client/components/schemas/StringEnumWithDefaultValueTest.kt -src/test/kotlin/org/openapijsonschematools/client/components/schemas/StringSchemaTest.kt -src/test/kotlin/org/openapijsonschematools/client/components/schemas/StringWithValidationTest.kt -src/test/kotlin/org/openapijsonschematools/client/components/schemas/TagTest.kt -src/test/kotlin/org/openapijsonschematools/client/components/schemas/TriangleInterfaceTest.kt -src/test/kotlin/org/openapijsonschematools/client/components/schemas/TriangleTest.kt -src/test/kotlin/org/openapijsonschematools/client/components/schemas/UUIDStringTest.kt -src/test/kotlin/org/openapijsonschematools/client/components/schemas/UserTest.kt -src/test/kotlin/org/openapijsonschematools/client/components/schemas/WhaleTest.kt -src/test/kotlin/org/openapijsonschematools/client/components/schemas/ZebraTest.kt -src/test/kotlin/org/openapijsonschematools/client/configurations/JsonSchemaKeywordFlagsTest.kt -src/test/kotlin/org/openapijsonschematools/client/header/ContentHeaderTest.kt -src/test/kotlin/org/openapijsonschematools/client/header/SchemaHeaderTest.kt -src/test/kotlin/org/openapijsonschematools/client/parameter/CookieSerializerTest.kt -src/test/kotlin/org/openapijsonschematools/client/parameter/HeadersSerializerTest.kt -src/test/kotlin/org/openapijsonschematools/client/parameter/PathSerializerTest.kt -src/test/kotlin/org/openapijsonschematools/client/parameter/QuerySerializerTest.kt -src/test/kotlin/org/openapijsonschematools/client/parameter/SchemaNonQueryParameterTest.kt -src/test/kotlin/org/openapijsonschematools/client/parameter/SchemaQueryParameterTest.kt -src/test/kotlin/org/openapijsonschematools/client/requestbody/RequestBodySerializerTest.kt -src/test/kotlin/org/openapijsonschematools/client/response/ResponseDeserializerTest.kt -src/test/kotlin/org/openapijsonschematools/client/schemas/AnyTypeSchemaTest.kt -src/test/kotlin/org/openapijsonschematools/client/schemas/ArrayTypeSchemaTest.kt -src/test/kotlin/org/openapijsonschematools/client/schemas/BooleanSchemaTest.kt -src/test/kotlin/org/openapijsonschematools/client/schemas/ListBuilderTest.kt -src/test/kotlin/org/openapijsonschematools/client/schemas/ListSchemaTest.kt -src/test/kotlin/org/openapijsonschematools/client/schemas/MapSchemaTest.kt -src/test/kotlin/org/openapijsonschematools/client/schemas/NullSchemaTest.kt -src/test/kotlin/org/openapijsonschematools/client/schemas/NumberSchemaTest.kt -src/test/kotlin/org/openapijsonschematools/client/schemas/ObjectTypeSchemaTest.kt -src/test/kotlin/org/openapijsonschematools/client/schemas/RefBooleanSchemaTest.kt -src/test/kotlin/org/openapijsonschematools/client/schemas/validation/AdditionalPropertiesValidatorTest.kt -src/test/kotlin/org/openapijsonschematools/client/schemas/validation/CustomIsoparserTest.kt -src/test/kotlin/org/openapijsonschematools/client/schemas/validation/FormatValidatorTest.kt -src/test/kotlin/org/openapijsonschematools/client/schemas/validation/ItemsValidatorTest.kt -src/test/kotlin/org/openapijsonschematools/client/schemas/validation/JsonSchemaTest.kt -src/test/kotlin/org/openapijsonschematools/client/schemas/validation/PropertiesValidatorTest.kt -src/test/kotlin/org/openapijsonschematools/client/schemas/validation/RequiredValidatorTest.kt -src/test/kotlin/org/openapijsonschematools/client/schemas/validation/TypeValidatorTest.kt diff --git a/samples/client/petstore/kotlin/README.md b/samples/client/petstore/kotlin/README.md deleted file mode 100644 index f52d1625b5c..00000000000 --- a/samples/client/petstore/kotlin/README.md +++ /dev/null @@ -1,474 +0,0 @@ -# petstore -This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. - -This Kotlin package is automatically generated by the [OpenAPI JSON Schema Generator](https://github.com/openapi-json-schema-tools/openapi-json-schema-generator) project: - -- OpenAPI document version: 1.0.0 -- Kotlin Package version: 1.0.0 -- OpenAPI JSON Schema Generator, Generator: KotlinClientGenerator - -## Requirements - -1. Kotlin 17 -2. Gradle - -## Installation - -To install the API client library to your local Maven repository, simply execute: - -```shell -gradle wrapper -gradlew clean build -``` - -### Gradle users - -Add this dependency to your project's build file: - -``` -repositories { - mavenCentral() // Needed if the 'petstore' jar has been published to maven centra - mavenLocal() // Needed if the 'petstore' jar has been published to the local maven repo -} - -dependencies { - implementation "org.openapijsonschematools:petstore:1.0.0" -} -``` - -## Usage Notes -### Validation, Immutability, and Data Type -This Kotlin code validates data to schema classes and return back an immutable instance containing the data. This ensure that -- valid data cannot be mutated and become invalid to a set of schemas - - the one exception is that files are not immutable, so schema instances storing/sending/receiving files are not immutable - -Here is the mapping from json schema types to Kotlin types: - -| Json Schema Type | Kotlin Base Class | -| ---------------- | --------------- | -| object | FrozenMap (Map) | -| array | FrozenList (List) | -| string | String | -| number | Number (int, long, float, double) | -| integer | int, long, float, double (with values equal to integers) | -| boolean | boolean | -| null | Nothing? (null) | -| AnyType (unset) | Object? | - -### Storage of Json Schema Definition in Kotlin JsonSchema Classes -In openapi v3.0.3 there are ~ 28 json schema keywords. Almost all of them can apply if -type is unset. I have chosen to separate the storage of -- json schema definition info -- output classes for validated Map (json schema type object) payloads -- output classes for validated List (json schema type array) payloads - -
- Reason - -This json schema data is stored in each class that is written for a schema, in a component or -other openapi document location. This class is only responsible for storing schema info. -Output classes like those that store map payloads are written separately and are -returned by the JsonSchema.validate method when that method is passed in Map input. -This prevents payload property access methods from -colliding with json schema definition. -
- -### Json Schema Type Object -Most component schemas (models) are probably of type object. Which is a map data structure. -Json schema allows string keys in this map, which means schema properties can have key names that are -invalid Kotlin variable names. Names like: -- "hi-there" -- "1variable" -- "@now" -- " " -- "from" - -To allow these use cases to work, FrozenMap (which extends AbstractMap) is used as the base class of type object schemas. -This means that one can use normal Map methods on instances of these classes. - -
- Other Details - -- getters are written for validly named required and optional properties -- null is only allowed in as a value if type: "null" was included or nullable: true was set - - because null is an allowed property value, it is not used to represent an unset property state -- if an optional property is requested and it does not exist in the Map, an UnsetPropertyException is thrown -
- -### Json Schema Type + Format, Validated Data Storage -N schemas can be validated on the same payload. -To allow multiple schemas to validate, the data must be stored using one base class whether or not -a json schema format constraint exists in the schema. - -In json schema, type: number with no format validates both integers and floats, -so int and float values are stored for type number. - -
- String + Date Example - -For example the string payload '2023-12-20' is validates to both of these schemas: -1. string only -``` -- type: string -``` -2. string and date format -``` -- type: string - format: date -``` -Because of use cases like this, a LocalDate is allowed as an input to this schema, but the data -is stored as a string. -
- -## Getting Started - -Please follow the [installation procedure](#installation) and then use the JsonSchema classes in -org.openapijsonschematools.client.components.schemas to validate input payloads and instances of validated Map and List -output classes. Json schemas allow multiple types for one schema, so a schema's validate method can have -allowed input and output types. - -## 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.servers.RootServer0; -import org.openapijsonschematools.client.servers.RootServer1; -import org.openapijsonschematools.client.servers.RootServer2; -import org.openapijsonschematools.client.paths.solidus.get.responses.SolidusGetCode200Response; -import org.openapijsonschematools.client.servers.RootServerInfo; -import org.openapijsonschematools.client.apis.tags.Fake; -import org.openapijsonschematools.client.paths.solidus.get.SolidusGetResponses; - -import java.io.IOException; -import java.util.Arrays; -import java.util.List; -import java.util.Map; -import java.util.AbstractMap; - -// if you want to use a server that is not SERVER_0 pass it in here and change the ServerIndex input below -ApiConfiguration.ServerInfo serverInfo = new ApiConfiguration.ServerInfoBuilder() - .rootServerInfo( - new RootServerInfo.RootServerInfoBuilder() - .rootServer0(new RootServer0()) - .build() - ) - .build(); -ApiConfiguration.ServerIndexInfo serverIndexInfo = new ApiConfiguration.ServerIndexInfoBuilder() - .rootServerInfoServerIndex(RootServerInfo.ServerIndex.SERVER_0) - .build(); -Duration timeout = Duration.ofSeconds(1L); -Map> defaultHeaders = Map.of("User-Agent", List.of("OpenAPI-JSON-Schema-Generator/1.0.0/java")); -ApiConfiguration apiConfiguration = new ApiConfiguration( - serverInfo - serverIndexInfo, - timeout, - defaultHeaders -); -SchemaConfiguration schemaConfiguration = new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().build()); -Fake apiClient = new Fake(apiConfiguration, schemaConfiguration); - - -var request = new SolidusGet.GetRequestBuilder().build(); - -SolidusGetResponses.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; -} -SolidusGetResponses.EndpointSolidusGetCode200Response castResponse = (SolidusGetResponses.EndpointSolidusGetCode200Response) response; -``` -## Servers -| server_index | Class | Description | -| ------------ | ----- | ----------- | -| 0 | [RootServer0](docs/servers/RootServer0.md) | petstore server | -| 1 | [RootServer1](docs/servers/RootServer1.md) | The local server | -| 2 | [RootServer2](docs/servers/RootServer2.md) | staging server with no variables | - -## Component SecuritySchemes -| Class | Description | -| ----- | ----------- | -| [ApiKey](docs/components/securityschemes/ApiKey.md) | apiKey in header | -| [ApiKeyQuery](docs/components/securityschemes/ApiKeyQuery.md) | apiKey in query | -| [BearerTest](docs/components/securityschemes/BearerTest.md) | http bearer with JWT bearer format | -| [HttpBasicTest](docs/components/securityschemes/HttpBasicTest.md) | http basic | -| [HttpSignatureTest](docs/components/securityschemes/HttpSignatureTest.md) | http + signature | -| [OpenIdConnectTest](docs/components/securityschemes/OpenIdConnectTest.md) | openIdConnect | -| [PetstoreAuth](docs/components/securityschemes/PetstoreAuth.md) | oauth2 implicit flow with two scopes | - -## Endpoints -All URIs are relative to the selected server -- The server is selected by passing in serverInfo + serverIndexInfo into configurations.ApiConfiguration -- The security info is selected by passing in securityInfo + securityIndexInfo into configurations.ApiConfiguration -- serverIndex + securityIndex can also be passed in to endpoint calls, see endpoint documentation - -| HTTP request | Methods | Description | -| ------------ | ------- | ----------- | -| / **get** | [Fake.slashRoute](docs/apis/tags/Fake.md#slashroute) [Solidus.get](docs/apis/paths/Solidus.md#get) [SolidusGet.Get.get](docs/paths/solidus/SolidusGet.md#get) | slash route | -| /another-fake/dummy **patch** | [Anotherfake.model123TestSpecialTags](docs/apis/tags/Anotherfake.md#model123testspecialtags) [Anotherfakedummy.patch](docs/apis/paths/Anotherfakedummy.md#patch) [AnotherfakedummyPatch.Patch.patch](docs/paths/anotherfakedummy/AnotherfakedummyPatch.md#patch) | To test special tags | -| /commonParam/{subDir}/ **delete** | [Fake.deleteCommonParam](docs/apis/tags/Fake.md#deletecommonparam) [Commonparamsubdir.delete](docs/apis/paths/Commonparamsubdir.md#delete) [CommonparamsubdirDelete.Delete.delete](docs/paths/commonparamsubdir/CommonparamsubdirDelete.md#delete) | | -| /commonParam/{subDir}/ **get** | [Fake.getCommonParam](docs/apis/tags/Fake.md#getcommonparam) [Commonparamsubdir.get](docs/apis/paths/Commonparamsubdir.md#get) [CommonparamsubdirGet.Get.get](docs/paths/commonparamsubdir/CommonparamsubdirGet.md#get) | | -| /commonParam/{subDir}/ **post** | [Fake.postCommonParam](docs/apis/tags/Fake.md#postcommonparam) [Commonparamsubdir.post](docs/apis/paths/Commonparamsubdir.md#post) [CommonparamsubdirPost.Post.post](docs/paths/commonparamsubdir/CommonparamsubdirPost.md#post) | | -| /fake **delete** | [Fake.groupParameters](docs/apis/tags/Fake.md#groupparameters) [Fake.delete](docs/apis/paths/Fake.md#delete) [FakeDelete.Delete.delete](docs/paths/fake/FakeDelete.md#delete) | Fake endpoint to test group parameters (optional) | -| /fake **get** | [Fake.enumParameters](docs/apis/tags/Fake.md#enumparameters) [Fake.get](docs/apis/paths/Fake.md#get) [FakeGet.Get.get](docs/paths/fake/FakeGet.md#get) | To test enum parameters | -| /fake **patch** | [Fake.clientModel](docs/apis/tags/Fake.md#clientmodel) [Fake.patch](docs/apis/paths/Fake.md#patch) [FakePatch.Patch.patch](docs/paths/fake/FakePatch.md#patch) | To test "client" model | -| /fake **post** | [Fake.endpointParameters](docs/apis/tags/Fake.md#endpointparameters) [Fake.post](docs/apis/paths/Fake.md#post) [FakePost.Post.post](docs/paths/fake/FakePost.md#post) | Fake endpoint for testing various parameters
假端點
偽のエンドポイント
가짜 엔드 포인트
| -| /fake/additional-properties-with-array-of-enums **get** | [Fake.additionalPropertiesWithArrayOfEnums](docs/apis/tags/Fake.md#additionalpropertieswitharrayofenums) [Fakeadditionalpropertieswitharrayofenums.get](docs/apis/paths/Fakeadditionalpropertieswitharrayofenums.md#get) [FakeadditionalpropertieswitharrayofenumsGet.Get.get](docs/paths/fakeadditionalpropertieswitharrayofenums/FakeadditionalpropertieswitharrayofenumsGet.md#get) | Additional Properties with Array of Enums | -| /fake/body-with-file-schema **put** | [Fake.bodyWithFileSchema](docs/apis/tags/Fake.md#bodywithfileschema) [Fakebodywithfileschema.put](docs/apis/paths/Fakebodywithfileschema.md#put) [FakebodywithfileschemaPut.Put.put](docs/paths/fakebodywithfileschema/FakebodywithfileschemaPut.md#put) | | -| /fake/body-with-query-params **put** | [Fake.bodyWithQueryParams](docs/apis/tags/Fake.md#bodywithqueryparams) [Fakebodywithqueryparams.put](docs/apis/paths/Fakebodywithqueryparams.md#put) [FakebodywithqueryparamsPut.Put.put](docs/paths/fakebodywithqueryparams/FakebodywithqueryparamsPut.md#put) | | -| /fake/case-sensitive-params **put** | [Fake.caseSensitiveParams](docs/apis/tags/Fake.md#casesensitiveparams) [Fakecasesensitiveparams.put](docs/apis/paths/Fakecasesensitiveparams.md#put) [FakecasesensitiveparamsPut.Put.put](docs/paths/fakecasesensitiveparams/FakecasesensitiveparamsPut.md#put) | | -| /fake/deleteCoffee/{id} **delete** | [Fake.deleteCoffee](docs/apis/tags/Fake.md#deletecoffee) [Fakedeletecoffeeid.delete](docs/apis/paths/Fakedeletecoffeeid.md#delete) [FakedeletecoffeeidDelete.Delete.delete](docs/paths/fakedeletecoffeeid/FakedeletecoffeeidDelete.md#delete) | Delete coffee | -| /fake/health **get** | [Fake.fakeHealthGet](docs/apis/tags/Fake.md#fakehealthget) [Fakehealth.get](docs/apis/paths/Fakehealth.md#get) [FakehealthGet.Get.get](docs/paths/fakehealth/FakehealthGet.md#get) | Health check endpoint | -| /fake/inline-additionalProperties **post** | [Fake.inlineAdditionalProperties](docs/apis/tags/Fake.md#inlineadditionalproperties) [Fakeinlineadditionalproperties.post](docs/apis/paths/Fakeinlineadditionalproperties.md#post) [FakeinlineadditionalpropertiesPost.Post.post](docs/paths/fakeinlineadditionalproperties/FakeinlineadditionalpropertiesPost.md#post) | test inline additionalProperties | -| /fake/inlineComposition/ **post** | [Fake.inlineComposition](docs/apis/tags/Fake.md#inlinecomposition) [Fakeinlinecomposition.post](docs/apis/paths/Fakeinlinecomposition.md#post) [FakeinlinecompositionPost.Post.post](docs/paths/fakeinlinecomposition/FakeinlinecompositionPost.md#post) | testing composed schemas at inline locations | -| /fake/jsonFormData **get** | [Fake.jsonFormData](docs/apis/tags/Fake.md#jsonformdata) [Fakejsonformdata.get](docs/apis/paths/Fakejsonformdata.md#get) [FakejsonformdataGet.Get.get](docs/paths/fakejsonformdata/FakejsonformdataGet.md#get) | test json serialization of form data | -| /fake/jsonPatch **patch** | [Fake.jsonPatch](docs/apis/tags/Fake.md#jsonpatch) [Fakejsonpatch.patch](docs/apis/paths/Fakejsonpatch.md#patch) [FakejsonpatchPatch.Patch.patch](docs/paths/fakejsonpatch/FakejsonpatchPatch.md#patch) | json patch | -| /fake/jsonWithCharset **post** | [Fake.jsonWithCharset](docs/apis/tags/Fake.md#jsonwithcharset) [Fakejsonwithcharset.post](docs/apis/paths/Fakejsonwithcharset.md#post) [FakejsonwithcharsetPost.Post.post](docs/paths/fakejsonwithcharset/FakejsonwithcharsetPost.md#post) | json with charset tx and rx | -| /fake/multipleRequestBodyContentTypes/ **post** | [Fake.multipleRequestBodyContentTypes](docs/apis/tags/Fake.md#multiplerequestbodycontenttypes) [Fakemultiplerequestbodycontenttypes.post](docs/apis/paths/Fakemultiplerequestbodycontenttypes.md#post) [FakemultiplerequestbodycontenttypesPost.Post.post](docs/paths/fakemultiplerequestbodycontenttypes/FakemultiplerequestbodycontenttypesPost.md#post) | testing composed schemas at inline locations | -| /fake/multipleResponseBodies **get** | [Fake.multipleResponseBodies](docs/apis/tags/Fake.md#multipleresponsebodies) [Fakemultipleresponsebodies.get](docs/apis/paths/Fakemultipleresponsebodies.md#get) [FakemultipleresponsebodiesGet.Get.get](docs/paths/fakemultipleresponsebodies/FakemultipleresponsebodiesGet.md#get) | multiple responses have response bodies | -| /fake/multipleSecurities **get** | [Fake.multipleSecurities](docs/apis/tags/Fake.md#multiplesecurities) [Fakemultiplesecurities.get](docs/apis/paths/Fakemultiplesecurities.md#get) [FakemultiplesecuritiesGet.Get.get](docs/paths/fakemultiplesecurities/FakemultiplesecuritiesGet.md#get) | multiple security requirements | -| /fake/objInQuery **get** | [Fake.objectInQuery](docs/apis/tags/Fake.md#objectinquery) [Fakeobjinquery.get](docs/apis/paths/Fakeobjinquery.md#get) [FakeobjinqueryGet.Get.get](docs/paths/fakeobjinquery/FakeobjinqueryGet.md#get) | user list | -| /fake/parameterCollisions/{1}/{aB}/{Ab}/{self}/{A-B}/ **post** | [Fake.parameterCollisions](docs/apis/tags/Fake.md#parametercollisions) [Fakeparametercollisions1ababselfab.post](docs/apis/paths/Fakeparametercollisions1ababselfab.md#post) [Fakeparametercollisions1ababselfabPost.Post.post](docs/paths/fakeparametercollisions1ababselfab/Fakeparametercollisions1ababselfabPost.md#post) | parameter collision case | -| /fake/pemContentType **get** | [Fake.pemContentType](docs/apis/tags/Fake.md#pemcontenttype) [Fakepemcontenttype.get](docs/apis/paths/Fakepemcontenttype.md#get) [FakepemcontenttypeGet.Get.get](docs/paths/fakepemcontenttype/FakepemcontenttypeGet.md#get) | route with tx and rx pem content type | -| /fake/queryParamWithJsonContentType **get** | [Fake.queryParamWithJsonContentType](docs/apis/tags/Fake.md#queryparamwithjsoncontenttype) [Fakequeryparamwithjsoncontenttype.get](docs/apis/paths/Fakequeryparamwithjsoncontenttype.md#get) [FakequeryparamwithjsoncontenttypeGet.Get.get](docs/paths/fakequeryparamwithjsoncontenttype/FakequeryparamwithjsoncontenttypeGet.md#get) | query param with json content-type | -| /fake/redirection **get** | [Fake.redirection](docs/apis/tags/Fake.md#redirection) [Fakeredirection.get](docs/apis/paths/Fakeredirection.md#get) [FakeredirectionGet.Get.get](docs/paths/fakeredirection/FakeredirectionGet.md#get) | operation with redirection responses | -| /fake/refObjInQuery **get** | [Fake.refObjectInQuery](docs/apis/tags/Fake.md#refobjectinquery) [Fakerefobjinquery.get](docs/apis/paths/Fakerefobjinquery.md#get) [FakerefobjinqueryGet.Get.get](docs/paths/fakerefobjinquery/FakerefobjinqueryGet.md#get) | user list | -| /fake/refs/array-of-enums **post** | [Fake.arrayOfEnums](docs/apis/tags/Fake.md#arrayofenums) [Fakerefsarrayofenums.post](docs/apis/paths/Fakerefsarrayofenums.md#post) [FakerefsarrayofenumsPost.Post.post](docs/paths/fakerefsarrayofenums/FakerefsarrayofenumsPost.md#post) | Array of Enums | -| /fake/refs/arraymodel **post** | [Fake.arrayModel](docs/apis/tags/Fake.md#arraymodel) [Fakerefsarraymodel.post](docs/apis/paths/Fakerefsarraymodel.md#post) [FakerefsarraymodelPost.Post.post](docs/paths/fakerefsarraymodel/FakerefsarraymodelPost.md#post) | | -| /fake/refs/boolean **post** | [Fake.modelBoolean](docs/apis/tags/Fake.md#modelboolean) [Fakerefsboolean.post](docs/apis/paths/Fakerefsboolean.md#post) [FakerefsbooleanPost.Post.post](docs/paths/fakerefsboolean/FakerefsbooleanPost.md#post) | | -| /fake/refs/composed_one_of_number_with_validations **post** | [Fake.composedOneOfDifferentTypes](docs/apis/tags/Fake.md#composedoneofdifferenttypes) [Fakerefscomposedoneofnumberwithvalidations.post](docs/apis/paths/Fakerefscomposedoneofnumberwithvalidations.md#post) [FakerefscomposedoneofnumberwithvalidationsPost.Post.post](docs/paths/fakerefscomposedoneofnumberwithvalidations/FakerefscomposedoneofnumberwithvalidationsPost.md#post) | | -| /fake/refs/enum **post** | [Fake.stringEnum](docs/apis/tags/Fake.md#stringenum) [Fakerefsenum.post](docs/apis/paths/Fakerefsenum.md#post) [FakerefsenumPost.Post.post](docs/paths/fakerefsenum/FakerefsenumPost.md#post) | | -| /fake/refs/mammal **post** | [Fake.mammal](docs/apis/tags/Fake.md#mammal) [Fakerefsmammal.post](docs/apis/paths/Fakerefsmammal.md#post) [FakerefsmammalPost.Post.post](docs/paths/fakerefsmammal/FakerefsmammalPost.md#post) | | -| /fake/refs/number **post** | [Fake.numberWithValidations](docs/apis/tags/Fake.md#numberwithvalidations) [Fakerefsnumber.post](docs/apis/paths/Fakerefsnumber.md#post) [FakerefsnumberPost.Post.post](docs/paths/fakerefsnumber/FakerefsnumberPost.md#post) | | -| /fake/refs/object_model_with_ref_props **post** | [Fake.objectModelWithRefProps](docs/apis/tags/Fake.md#objectmodelwithrefprops) [Fakerefsobjectmodelwithrefprops.post](docs/apis/paths/Fakerefsobjectmodelwithrefprops.md#post) [FakerefsobjectmodelwithrefpropsPost.Post.post](docs/paths/fakerefsobjectmodelwithrefprops/FakerefsobjectmodelwithrefpropsPost.md#post) | | -| /fake/refs/string **post** | [Fake.modelString](docs/apis/tags/Fake.md#modelstring) [Fakerefsstring.post](docs/apis/paths/Fakerefsstring.md#post) [FakerefsstringPost.Post.post](docs/paths/fakerefsstring/FakerefsstringPost.md#post) | | -| /fake/responseWithoutSchema **get** | [Fake.responseWithoutSchema](docs/apis/tags/Fake.md#responsewithoutschema) [Fakeresponsewithoutschema.get](docs/apis/paths/Fakeresponsewithoutschema.md#get) [FakeresponsewithoutschemaGet.Get.get](docs/paths/fakeresponsewithoutschema/FakeresponsewithoutschemaGet.md#get) | receives a response without schema | -| /fake/test-query-paramters **put** | [Fake.queryParameterCollectionFormat](docs/apis/tags/Fake.md#queryparametercollectionformat) [Faketestqueryparamters.put](docs/apis/paths/Faketestqueryparamters.md#put) [FaketestqueryparamtersPut.Put.put](docs/paths/faketestqueryparamters/FaketestqueryparamtersPut.md#put) | | -| /fake/uploadDownloadFile **post** | [Fake.uploadDownloadFile](docs/apis/tags/Fake.md#uploaddownloadfile) [Fakeuploaddownloadfile.post](docs/apis/paths/Fakeuploaddownloadfile.md#post) [FakeuploaddownloadfilePost.Post.post](docs/paths/fakeuploaddownloadfile/FakeuploaddownloadfilePost.md#post) | uploads a file and downloads a file using application/octet-stream | -| /fake/uploadFile **post** | [Fake.uploadFile](docs/apis/tags/Fake.md#uploadfile) [Fakeuploadfile.post](docs/apis/paths/Fakeuploadfile.md#post) [FakeuploadfilePost.Post.post](docs/paths/fakeuploadfile/FakeuploadfilePost.md#post) | uploads a file using multipart/form-data | -| /fake/uploadFiles **post** | [Fake.uploadFiles](docs/apis/tags/Fake.md#uploadfiles) [Fakeuploadfiles.post](docs/apis/paths/Fakeuploadfiles.md#post) [FakeuploadfilesPost.Post.post](docs/paths/fakeuploadfiles/FakeuploadfilesPost.md#post) | uploads files using multipart/form-data | -| /fake/wildCardResponses **get** | [Fake.wildCardResponses](docs/apis/tags/Fake.md#wildcardresponses) [Fakewildcardresponses.get](docs/apis/paths/Fakewildcardresponses.md#get) [FakewildcardresponsesGet.Get.get](docs/paths/fakewildcardresponses/FakewildcardresponsesGet.md#get) | operation with wildcard responses | -| /fake/{petId}/uploadImageWithRequiredFile **post** | [Pet.uploadFileWithRequiredFile](docs/apis/tags/Pet.md#uploadfilewithrequiredfile) [Fakepetiduploadimagewithrequiredfile.post](docs/apis/paths/Fakepetiduploadimagewithrequiredfile.md#post) [FakepetiduploadimagewithrequiredfilePost.Post.post](docs/paths/fakepetiduploadimagewithrequiredfile/FakepetiduploadimagewithrequiredfilePost.md#post) | uploads an image (required) | -| /fake_classname_test **patch** | [Fakeclassnametags123.classname](docs/apis/tags/Fakeclassnametags123.md#classname) [Fakeclassnametest.patch](docs/apis/paths/Fakeclassnametest.md#patch) [FakeclassnametestPatch.Patch.patch](docs/paths/fakeclassnametest/FakeclassnametestPatch.md#patch) | To test class name in snake case | -| /foo **get** | [Default.fooGet](docs/apis/tags/Default.md#fooget) [Foo.get](docs/apis/paths/Foo.md#get) [FooGet.Get.get](docs/paths/foo/FooGet.md#get) | | -| /pet **post** | [Pet.addPet](docs/apis/tags/Pet.md#addpet) [Pet.post](docs/apis/paths/Pet.md#post) [PetPost.Post.post](docs/paths/pet/PetPost.md#post) | Add a new pet to the store | -| /pet **put** | [Pet.updatePet](docs/apis/tags/Pet.md#updatepet) [Pet.put](docs/apis/paths/Pet.md#put) [PetPut.Put.put](docs/paths/pet/PetPut.md#put) | Update an existing pet | -| /pet/findByStatus **get** | [Pet.findPetsByStatus](docs/apis/tags/Pet.md#findpetsbystatus) [Petfindbystatus.get](docs/apis/paths/Petfindbystatus.md#get) [PetfindbystatusGet.Get.get](docs/paths/petfindbystatus/PetfindbystatusGet.md#get) | Finds Pets by status | -| /pet/findByTags **get** | [Pet.findPetsByTags](docs/apis/tags/Pet.md#findpetsbytags) [Petfindbytags.get](docs/apis/paths/Petfindbytags.md#get) [PetfindbytagsGet.Get.get](docs/paths/petfindbytags/PetfindbytagsGet.md#get) | Finds Pets by tags | -| /pet/{petId} **delete** | [Pet.deletePet](docs/apis/tags/Pet.md#deletepet) [Petpetid.delete](docs/apis/paths/Petpetid.md#delete) [PetpetidDelete.Delete.delete](docs/paths/petpetid/PetpetidDelete.md#delete) | Deletes a pet | -| /pet/{petId} **get** | [Pet.getPetById](docs/apis/tags/Pet.md#getpetbyid) [Petpetid.get](docs/apis/paths/Petpetid.md#get) [PetpetidGet.Get.get](docs/paths/petpetid/PetpetidGet.md#get) | Find pet by ID | -| /pet/{petId} **post** | [Pet.updatePetWithForm](docs/apis/tags/Pet.md#updatepetwithform) [Petpetid.post](docs/apis/paths/Petpetid.md#post) [PetpetidPost.Post.post](docs/paths/petpetid/PetpetidPost.md#post) | Updates a pet in the store with form data | -| /pet/{petId}/uploadImage **post** | [Pet.uploadImage](docs/apis/tags/Pet.md#uploadimage) [Petpetiduploadimage.post](docs/apis/paths/Petpetiduploadimage.md#post) [PetpetiduploadimagePost.Post.post](docs/paths/petpetiduploadimage/PetpetiduploadimagePost.md#post) | uploads an image | -| /store/inventory **get** | [Store.getInventory](docs/apis/tags/Store.md#getinventory) [Storeinventory.get](docs/apis/paths/Storeinventory.md#get) [StoreinventoryGet.Get.get](docs/paths/storeinventory/StoreinventoryGet.md#get) | Returns pet inventories by status | -| /store/order **post** | [Store.placeOrder](docs/apis/tags/Store.md#placeorder) [Storeorder.post](docs/apis/paths/Storeorder.md#post) [StoreorderPost.Post.post](docs/paths/storeorder/StoreorderPost.md#post) | Place an order for a pet | -| /store/order/{order_id} **delete** | [Store.deleteOrder](docs/apis/tags/Store.md#deleteorder) [Storeorderorderid.delete](docs/apis/paths/Storeorderorderid.md#delete) [StoreorderorderidDelete.Delete.delete](docs/paths/storeorderorderid/StoreorderorderidDelete.md#delete) | Delete purchase order by ID | -| /store/order/{order_id} **get** | [Store.getOrderById](docs/apis/tags/Store.md#getorderbyid) [Storeorderorderid.get](docs/apis/paths/Storeorderorderid.md#get) [StoreorderorderidGet.Get.get](docs/paths/storeorderorderid/StoreorderorderidGet.md#get) | Find purchase order by ID | -| /user **post** | [User.createUser](docs/apis/tags/User.md#createuser) [User.post](docs/apis/paths/User.md#post) [UserPost.Post.post](docs/paths/user/UserPost.md#post) | Create user | -| /user/createWithArray **post** | [User.createUsersWithArrayInput](docs/apis/tags/User.md#createuserswitharrayinput) [Usercreatewitharray.post](docs/apis/paths/Usercreatewitharray.md#post) [UsercreatewitharrayPost.Post.post](docs/paths/usercreatewitharray/UsercreatewitharrayPost.md#post) | Creates list of users with given input array | -| /user/createWithList **post** | [User.createUsersWithListInput](docs/apis/tags/User.md#createuserswithlistinput) [Usercreatewithlist.post](docs/apis/paths/Usercreatewithlist.md#post) [UsercreatewithlistPost.Post.post](docs/paths/usercreatewithlist/UsercreatewithlistPost.md#post) | Creates list of users with given input array | -| /user/login **get** | [User.loginUser](docs/apis/tags/User.md#loginuser) [Userlogin.get](docs/apis/paths/Userlogin.md#get) [UserloginGet.Get.get](docs/paths/userlogin/UserloginGet.md#get) | Logs user into the system | -| /user/logout **get** | [User.logoutUser](docs/apis/tags/User.md#logoutuser) [Userlogout.get](docs/apis/paths/Userlogout.md#get) [UserlogoutGet.Get.get](docs/paths/userlogout/UserlogoutGet.md#get) | Logs out current logged in user session | -| /user/{username} **delete** | [User.deleteUser](docs/apis/tags/User.md#deleteuser) [Userusername.delete](docs/apis/paths/Userusername.md#delete) [UserusernameDelete.Delete.delete](docs/paths/userusername/UserusernameDelete.md#delete) | Delete user | -| /user/{username} **get** | [User.getUserByName](docs/apis/tags/User.md#getuserbyname) [Userusername.get](docs/apis/paths/Userusername.md#get) [UserusernameGet.Get.get](docs/paths/userusername/UserusernameGet.md#get) | Get user by user name | -| /user/{username} **put** | [User.updateUser](docs/apis/tags/User.md#updateuser) [Userusername.put](docs/apis/paths/Userusername.md#put) [UserusernamePut.Put.put](docs/paths/userusername/UserusernamePut.md#put) | Updated user | - -## Component Schemas -| Class | Description | -| ----- | ----------- | -| [Schema200Response.Schema200Response1](docs/components/schemas/Schema200Response.md#schema200response1) | model with an invalid class name for python, starts with a number | -| [AbstractStepMessage.AbstractStepMessage1](docs/components/schemas/AbstractStepMessage.md#abstractstepmessage1) | Abstract Step | -| [AdditionalPropertiesClass.AdditionalPropertiesClass1](docs/components/schemas/AdditionalPropertiesClass.md#additionalpropertiesclass1) | | -| [AdditionalPropertiesSchema.AdditionalPropertiesSchema1](docs/components/schemas/AdditionalPropertiesSchema.md#additionalpropertiesschema1) | | -| [AdditionalPropertiesWithArrayOfEnums.AdditionalPropertiesWithArrayOfEnums1](docs/components/schemas/AdditionalPropertiesWithArrayOfEnums.md#additionalpropertieswitharrayofenums1) | | -| [Address.Address1](docs/components/schemas/Address.md#address1) | | -| [Animal.Animal1](docs/components/schemas/Animal.md#animal1) | | -| [AnimalFarm.AnimalFarm1](docs/components/schemas/AnimalFarm.md#animalfarm1) | | -| [AnyTypeAndFormat.AnyTypeAndFormat1](docs/components/schemas/AnyTypeAndFormat.md#anytypeandformat1) | | -| [AnyTypeNotString.AnyTypeNotString1](docs/components/schemas/AnyTypeNotString.md#anytypenotstring1) | | -| [ApiResponseSchema.ApiResponseSchema1](docs/components/schemas/ApiResponseSchema.md#apiresponseschema1) | | -| [ArrayHoldingAnyType.ArrayHoldingAnyType1](docs/components/schemas/ArrayHoldingAnyType.md#arrayholdinganytype1) | | -| [ArrayOfArrayOfNumberOnly.ArrayOfArrayOfNumberOnly1](docs/components/schemas/ArrayOfArrayOfNumberOnly.md#arrayofarrayofnumberonly1) | | -| [ArrayOfEnums.ArrayOfEnums1](docs/components/schemas/ArrayOfEnums.md#arrayofenums1) | | -| [ArrayOfNumberOnly.ArrayOfNumberOnly1](docs/components/schemas/ArrayOfNumberOnly.md#arrayofnumberonly1) | | -| [ArrayTest.ArrayTest1](docs/components/schemas/ArrayTest.md#arraytest1) | | -| [ArrayWithValidationsInItems.ArrayWithValidationsInItems1](docs/components/schemas/ArrayWithValidationsInItems.md#arraywithvalidationsinitems1) | | -| [Bar.Bar1](docs/components/schemas/Bar.md#bar1) | | -| [BasquePig.BasquePig1](docs/components/schemas/BasquePig.md#basquepig1) | | -| [BooleanSchema.BooleanSchema1](docs/components/schemas/BooleanSchema.md#booleanschema1) | | -| [BooleanEnum.BooleanEnum1](docs/components/schemas/BooleanEnum.md#booleanenum1) | | -| [Capitalization.Capitalization1](docs/components/schemas/Capitalization.md#capitalization1) | | -| [Cat.Cat1](docs/components/schemas/Cat.md#cat1) | | -| [Category.Category1](docs/components/schemas/Category.md#category1) | | -| [ChildCat.ChildCat1](docs/components/schemas/ChildCat.md#childcat1) | | -| [ClassModel.ClassModel1](docs/components/schemas/ClassModel.md#classmodel1) | Model for testing model with "_class" property | -| [Client.Client1](docs/components/schemas/Client.md#client1) | | -| [ComplexQuadrilateral.ComplexQuadrilateral1](docs/components/schemas/ComplexQuadrilateral.md#complexquadrilateral1) | | -| [ComposedAnyOfDifferentTypesNoValidations.ComposedAnyOfDifferentTypesNoValidations1](docs/components/schemas/ComposedAnyOfDifferentTypesNoValidations.md#composedanyofdifferenttypesnovalidations1) | | -| [ComposedArray.ComposedArray1](docs/components/schemas/ComposedArray.md#composedarray1) | | -| [ComposedBool.ComposedBool1](docs/components/schemas/ComposedBool.md#composedbool1) | | -| [ComposedNone.ComposedNone1](docs/components/schemas/ComposedNone.md#composednone1) | | -| [ComposedNumber.ComposedNumber1](docs/components/schemas/ComposedNumber.md#composednumber1) | | -| [ComposedObject.ComposedObject1](docs/components/schemas/ComposedObject.md#composedobject1) | | -| [ComposedOneOfDifferentTypes.ComposedOneOfDifferentTypes1](docs/components/schemas/ComposedOneOfDifferentTypes.md#composedoneofdifferenttypes1) | this is a model that allows payloads of type object or number | -| [ComposedString.ComposedString1](docs/components/schemas/ComposedString.md#composedstring1) | | -| [Currency.Currency1](docs/components/schemas/Currency.md#currency1) | | -| [DanishPig.DanishPig1](docs/components/schemas/DanishPig.md#danishpig1) | | -| [DateTimeTest.DateTimeTest1](docs/components/schemas/DateTimeTest.md#datetimetest1) | | -| [DateTimeWithValidations.DateTimeWithValidations1](docs/components/schemas/DateTimeWithValidations.md#datetimewithvalidations1) | | -| [DateWithValidations.DateWithValidations1](docs/components/schemas/DateWithValidations.md#datewithvalidations1) | | -| [DecimalPayload.DecimalPayload1](docs/components/schemas/DecimalPayload.md#decimalpayload1) | | -| [Dog.Dog1](docs/components/schemas/Dog.md#dog1) | | -| [Drawing.Drawing1](docs/components/schemas/Drawing.md#drawing1) | | -| [EnumArrays.EnumArrays1](docs/components/schemas/EnumArrays.md#enumarrays1) | | -| [EnumClass.EnumClass1](docs/components/schemas/EnumClass.md#enumclass1) | | -| [EnumTest.EnumTest1](docs/components/schemas/EnumTest.md#enumtest1) | | -| [EquilateralTriangle.EquilateralTriangle1](docs/components/schemas/EquilateralTriangle.md#equilateraltriangle1) | | -| [File.File1](docs/components/schemas/File.md#file1) | Must be named `File` for test. | -| [FileSchemaTestClass.FileSchemaTestClass1](docs/components/schemas/FileSchemaTestClass.md#fileschematestclass1) | | -| [Foo.Foo1](docs/components/schemas/Foo.md#foo1) | | -| [FormatTest.FormatTest1](docs/components/schemas/FormatTest.md#formattest1) | | -| [FromSchema.FromSchema1](docs/components/schemas/FromSchema.md#fromschema1) | | -| [GrandparentAnimal.GrandparentAnimal1](docs/components/schemas/GrandparentAnimal.md#grandparentanimal1) | | -| [HealthCheckResult.HealthCheckResult1](docs/components/schemas/HealthCheckResult.md#healthcheckresult1) | Just a string to inform instance is up and running. Make it nullable in hope to get it as pointer in generated model. | -| [IntegerEnum.IntegerEnum1](docs/components/schemas/IntegerEnum.md#integerenum1) | | -| [IntegerEnumBig.IntegerEnumBig1](docs/components/schemas/IntegerEnumBig.md#integerenumbig1) | | -| [IntegerEnumOneValue.IntegerEnumOneValue1](docs/components/schemas/IntegerEnumOneValue.md#integerenumonevalue1) | | -| [IntegerEnumWithDefaultValue.IntegerEnumWithDefaultValue1](docs/components/schemas/IntegerEnumWithDefaultValue.md#integerenumwithdefaultvalue1) | | -| [IntegerMax10.IntegerMax101](docs/components/schemas/IntegerMax10.md#integermax101) | | -| [IntegerMin15.IntegerMin151](docs/components/schemas/IntegerMin15.md#integermin151) | | -| [IsoscelesTriangle.IsoscelesTriangle1](docs/components/schemas/IsoscelesTriangle.md#isoscelestriangle1) | | -| [Items.Items1](docs/components/schemas/Items.md#items1) | component's name collides with the inner schema name | -| [ItemsSchema.ItemsSchema1](docs/components/schemas/ItemsSchema.md#itemsschema1) | | -| [JSONPatchRequest.JSONPatchRequest1](docs/components/schemas/JSONPatchRequest.md#jsonpatchrequest1) | | -| [JSONPatchRequestAddReplaceTest.JSONPatchRequestAddReplaceTest1](docs/components/schemas/JSONPatchRequestAddReplaceTest.md#jsonpatchrequestaddreplacetest1) | | -| [JSONPatchRequestMoveCopy.JSONPatchRequestMoveCopy1](docs/components/schemas/JSONPatchRequestMoveCopy.md#jsonpatchrequestmovecopy1) | | -| [JSONPatchRequestRemove.JSONPatchRequestRemove1](docs/components/schemas/JSONPatchRequestRemove.md#jsonpatchrequestremove1) | | -| [MapTest.MapTest1](docs/components/schemas/MapTest.md#maptest1) | | -| [MixedPropertiesAndAdditionalPropertiesClass.MixedPropertiesAndAdditionalPropertiesClass1](docs/components/schemas/MixedPropertiesAndAdditionalPropertiesClass.md#mixedpropertiesandadditionalpropertiesclass1) | | -| [Money.Money1](docs/components/schemas/Money.md#money1) | | -| [MultiPropertiesSchema.MultiPropertiesSchema1](docs/components/schemas/MultiPropertiesSchema.md#multipropertiesschema1) | | -| [MyObjectDto.MyObjectDto1](docs/components/schemas/MyObjectDto.md#myobjectdto1) | | -| [Name.Name1](docs/components/schemas/Name.md#name1) | Model for testing model name same as property name | -| [NoAdditionalProperties.NoAdditionalProperties1](docs/components/schemas/NoAdditionalProperties.md#noadditionalproperties1) | | -| [NullableClass.NullableClass1](docs/components/schemas/NullableClass.md#nullableclass1) | | -| [NullableShape.NullableShape1](docs/components/schemas/NullableShape.md#nullableshape1) | The value may be a shape or the 'null' value. For a composed schema to validate a null payload, one of its chosen oneOf schemas must be type null or nullable (introduced in OAS schema >= 3.0) | -| [NullableString.NullableString1](docs/components/schemas/NullableString.md#nullablestring1) | | -| [NumberSchema.NumberSchema1](docs/components/schemas/NumberSchema.md#numberschema1) | | -| [NumberOnly.NumberOnly1](docs/components/schemas/NumberOnly.md#numberonly1) | | -| [NumberWithExclusiveMinMax.NumberWithExclusiveMinMax1](docs/components/schemas/NumberWithExclusiveMinMax.md#numberwithexclusiveminmax1) | | -| [NumberWithValidations.NumberWithValidations1](docs/components/schemas/NumberWithValidations.md#numberwithvalidations1) | | -| [ObjWithRequiredProps.ObjWithRequiredProps1](docs/components/schemas/ObjWithRequiredProps.md#objwithrequiredprops1) | | -| [ObjWithRequiredPropsBase.ObjWithRequiredPropsBase1](docs/components/schemas/ObjWithRequiredPropsBase.md#objwithrequiredpropsbase1) | | -| [ObjectInterface.ObjectInterface1](docs/components/schemas/ObjectInterface.md#objectinterface1) | | -| [ObjectModelWithArgAndArgsProperties.ObjectModelWithArgAndArgsProperties1](docs/components/schemas/ObjectModelWithArgAndArgsProperties.md#objectmodelwithargandargsproperties1) | | -| [ObjectModelWithRefProps.ObjectModelWithRefProps1](docs/components/schemas/ObjectModelWithRefProps.md#objectmodelwithrefprops1) | a model that includes properties which should stay primitive (String + Boolean) and one which is defined as a class, NumberWithValidations | -| [ObjectWithAllOfWithReqTestPropFromUnsetAddProp.ObjectWithAllOfWithReqTestPropFromUnsetAddProp1](docs/components/schemas/ObjectWithAllOfWithReqTestPropFromUnsetAddProp.md#objectwithallofwithreqtestpropfromunsetaddprop1) | | -| [ObjectWithCollidingProperties.ObjectWithCollidingProperties1](docs/components/schemas/ObjectWithCollidingProperties.md#objectwithcollidingproperties1) | component with properties that have name collisions | -| [ObjectWithDecimalProperties.ObjectWithDecimalProperties1](docs/components/schemas/ObjectWithDecimalProperties.md#objectwithdecimalproperties1) | | -| [ObjectWithDifficultlyNamedProps.ObjectWithDifficultlyNamedProps1](docs/components/schemas/ObjectWithDifficultlyNamedProps.md#objectwithdifficultlynamedprops1) | model with properties that have invalid names for python | -| [ObjectWithInlineCompositionProperty.ObjectWithInlineCompositionProperty1](docs/components/schemas/ObjectWithInlineCompositionProperty.md#objectwithinlinecompositionproperty1) | | -| [ObjectWithInvalidNamedRefedProperties.ObjectWithInvalidNamedRefedProperties1](docs/components/schemas/ObjectWithInvalidNamedRefedProperties.md#objectwithinvalidnamedrefedproperties1) | | -| [ObjectWithNonIntersectingValues.ObjectWithNonIntersectingValues1](docs/components/schemas/ObjectWithNonIntersectingValues.md#objectwithnonintersectingvalues1) | | -| [ObjectWithOnlyOptionalProps.ObjectWithOnlyOptionalProps1](docs/components/schemas/ObjectWithOnlyOptionalProps.md#objectwithonlyoptionalprops1) | | -| [ObjectWithOptionalTestProp.ObjectWithOptionalTestProp1](docs/components/schemas/ObjectWithOptionalTestProp.md#objectwithoptionaltestprop1) | | -| [ObjectWithValidations.ObjectWithValidations1](docs/components/schemas/ObjectWithValidations.md#objectwithvalidations1) | | -| [Order.Order1](docs/components/schemas/Order.md#order1) | | -| [PaginatedResultMyObjectDto.PaginatedResultMyObjectDto1](docs/components/schemas/PaginatedResultMyObjectDto.md#paginatedresultmyobjectdto1) | | -| [ParentPet.ParentPet1](docs/components/schemas/ParentPet.md#parentpet1) | | -| [Pet.Pet1](docs/components/schemas/Pet.md#pet1) | Pet object that needs to be added to the store | -| [Pig.Pig1](docs/components/schemas/Pig.md#pig1) | | -| [Player.Player1](docs/components/schemas/Player.md#player1) | a model that includes a self reference this forces properties and additionalProperties to be lazy loaded in python models because the Player class has not fully loaded when defining properties | -| [PublicKey.PublicKey1](docs/components/schemas/PublicKey.md#publickey1) | schema that contains a property named key | -| [Quadrilateral.Quadrilateral1](docs/components/schemas/Quadrilateral.md#quadrilateral1) | | -| [QuadrilateralInterface.QuadrilateralInterface1](docs/components/schemas/QuadrilateralInterface.md#quadrilateralinterface1) | | -| [ReadOnlyFirst.ReadOnlyFirst1](docs/components/schemas/ReadOnlyFirst.md#readonlyfirst1) | | -| [RefPet.RefPet1](docs/components/schemas/RefPet.md#refpet1) | | -| [ReqPropsFromExplicitAddProps.ReqPropsFromExplicitAddProps1](docs/components/schemas/ReqPropsFromExplicitAddProps.md#reqpropsfromexplicitaddprops1) | | -| [ReqPropsFromTrueAddProps.ReqPropsFromTrueAddProps1](docs/components/schemas/ReqPropsFromTrueAddProps.md#reqpropsfromtrueaddprops1) | | -| [ReqPropsFromUnsetAddProps.ReqPropsFromUnsetAddProps1](docs/components/schemas/ReqPropsFromUnsetAddProps.md#reqpropsfromunsetaddprops1) | | -| [ReturnSchema.ReturnSchema1](docs/components/schemas/ReturnSchema.md#returnschema1) | Model for testing reserved words | -| [ScaleneTriangle.ScaleneTriangle1](docs/components/schemas/ScaleneTriangle.md#scalenetriangle1) | | -| [SelfReferencingArrayModel.SelfReferencingArrayModel1](docs/components/schemas/SelfReferencingArrayModel.md#selfreferencingarraymodel1) | | -| [SelfReferencingObjectModel.SelfReferencingObjectModel1](docs/components/schemas/SelfReferencingObjectModel.md#selfreferencingobjectmodel1) | | -| [Shape.Shape1](docs/components/schemas/Shape.md#shape1) | | -| [ShapeOrNull.ShapeOrNull1](docs/components/schemas/ShapeOrNull.md#shapeornull1) | The value may be a shape or the 'null' value. This is introduced in OAS schema >= 3.1. | -| [SimpleQuadrilateral.SimpleQuadrilateral1](docs/components/schemas/SimpleQuadrilateral.md#simplequadrilateral1) | | -| [SomeObject.SomeObject1](docs/components/schemas/SomeObject.md#someobject1) | | -| [StringSchema.StringSchema1](docs/components/schemas/StringSchema.md#stringschema1) | | -| [StringBooleanMap.StringBooleanMap1](docs/components/schemas/StringBooleanMap.md#stringbooleanmap1) | | -| [StringEnum.StringEnum1](docs/components/schemas/StringEnum.md#stringenum1) | | -| [StringEnumWithDefaultValue.StringEnumWithDefaultValue1](docs/components/schemas/StringEnumWithDefaultValue.md#stringenumwithdefaultvalue1) | | -| [StringWithValidation.StringWithValidation1](docs/components/schemas/StringWithValidation.md#stringwithvalidation1) | | -| [Tag.Tag1](docs/components/schemas/Tag.md#tag1) | | -| [Triangle.Triangle1](docs/components/schemas/Triangle.md#triangle1) | | -| [TriangleInterface.TriangleInterface1](docs/components/schemas/TriangleInterface.md#triangleinterface1) | | -| [UUIDString.UUIDString1](docs/components/schemas/UUIDString.md#uuidstring1) | | -| [User.User1](docs/components/schemas/User.md#user1) | | -| [SpecialModelname.SpecialModelname1](docs/components/schemas/SpecialModelname.md#specialmodelname1) | model with an invalid class name for python | -| [Apple.Apple1](docs/components/schemas/Apple.md#apple1) | | -| [AppleReq.AppleReq1](docs/components/schemas/AppleReq.md#applereq1) | | -| [Banana.Banana1](docs/components/schemas/Banana.md#banana1) | | -| [BananaReq.BananaReq1](docs/components/schemas/BananaReq.md#bananareq1) | | -| [Fruit.Fruit1](docs/components/schemas/Fruit.md#fruit1) | | -| [FruitReq.FruitReq1](docs/components/schemas/FruitReq.md#fruitreq1) | | -| [GmFruit.GmFruit1](docs/components/schemas/GmFruit.md#gmfruit1) | | -| [HasOnlyReadOnly.HasOnlyReadOnly1](docs/components/schemas/HasOnlyReadOnly.md#hasonlyreadonly1) | | -| [Mammal.Mammal1](docs/components/schemas/Mammal.md#mammal1) | | -| [Whale.Whale1](docs/components/schemas/Whale.md#whale1) | | -| [Zebra.Zebra1](docs/components/schemas/Zebra.md#zebra1) | | - -## Component RequestBodies -| Class | Description | -| ----- | ----------- | -| [Client.Client1](docs/components/requestbodies/Client.md#client1) | client model | -| [Pet.Pet1](docs/components/requestbodies/Pet.md#pet1) | Pet object that needs to be added to the store, multiple content types | -| [RefUserArray.RefUserArray1](docs/components/requestbodies/RefUserArray.md#refuserarray1) | | -| [UserArray.UserArray1](docs/components/requestbodies/UserArray.md#userarray1) | List of user object | - -## Component Responses -| Class | Description | -| ----- | ----------- | -| [HeadersWithNoBody.HeadersWithNoBody1](docs/components/responses/HeadersWithNoBody.md#headerswithnobody1) | A response that contains headers but no body
| -| [RefSuccessDescriptionOnly.RefSuccessDescriptionOnly1](docs/components/responses/RefSuccessDescriptionOnly.md#refsuccessdescriptiononly1) || -| [RefSuccessfulXmlAndJsonArrayOfPet.RefSuccessfulXmlAndJsonArrayOfPet1](docs/components/responses/RefSuccessfulXmlAndJsonArrayOfPet.md#refsuccessfulxmlandjsonarrayofpet1) || -| [SuccessDescriptionOnly.SuccessDescriptionOnly1](docs/components/responses/SuccessDescriptionOnly.md#successdescriptiononly1) | Success| -| [SuccessInlineContentAndHeader.SuccessInlineContentAndHeader1](docs/components/responses/SuccessInlineContentAndHeader.md#successinlinecontentandheader1) | successful operation| -| [SuccessWithJsonApiResponse.SuccessWithJsonApiResponse1](docs/components/responses/SuccessWithJsonApiResponse.md#successwithjsonapiresponse1) | successful operation| -| [SuccessfulXmlAndJsonArrayOfPet.SuccessfulXmlAndJsonArrayOfPet1](docs/components/responses/SuccessfulXmlAndJsonArrayOfPet.md#successfulxmlandjsonarrayofpet1) | successful operation, multiple content types| - -## Component Headers -| Class | Description | -| ----- | ----------- | -| [Int32JsonContentTypeHeader.Int32JsonContentTypeHeader1](docs/components/headers/Int32JsonContentTypeHeader.md#int32jsoncontenttypeheader1) | int32 JSON content-type header | -| [NumberHeader.NumberHeader1](docs/components/headers/NumberHeader.md#numberheader1) | number header description | -| [RefContentSchemaHeader.RefContentSchemaHeader1](docs/components/headers/RefContentSchemaHeader.md#refcontentschemaheader1) | int32 JSON content-type header | -| [RefSchemaHeader.RefSchemaHeader1](docs/components/headers/RefSchemaHeader.md#refschemaheader1) | header that has a ref in the schema | -| [RefStringHeader.RefStringHeader1](docs/components/headers/RefStringHeader.md#refstringheader1) | | -| [StringHeader.StringHeader1](docs/components/headers/StringHeader.md#stringheader1) | string header description | - -## Component Parameters -| Class | Description | -| ----- | ----------- | -| [ComponentRefSchemaStringWithValidation.ComponentRefSchemaStringWithValidation1](docs/components/parameters/ComponentRefSchemaStringWithValidation.md#componentrefschemastringwithvalidation1) | a path string with validation | -| [PathUserName.PathUserName1](docs/components/parameters/PathUserName.md#pathusername1) | the use name to use | -| [RefPathUserName.RefPathUserName1](docs/components/parameters/RefPathUserName.md#refpathusername1) | | -| [RefSchemaStringWithValidation.RefSchemaStringWithValidation1](docs/components/parameters/RefSchemaStringWithValidation.md#refschemastringwithvalidation1) | a path string with validation | diff --git a/samples/client/petstore/kotlin/docs/apis/paths/Anotherfakedummy.md b/samples/client/petstore/kotlin/docs/apis/paths/Anotherfakedummy.md deleted file mode 100644 index dd44aeae181..00000000000 --- a/samples/client/petstore/kotlin/docs/apis/paths/Anotherfakedummy.md +++ /dev/null @@ -1,119 +0,0 @@ -# Anotherfakedummy - -public class Anotherfakedummy extends extends ApiClient implements -[AnotherfakedummyPatch.PatchOperation](../../paths/anotherfakedummy/AnotherfakedummyPatch.md#patchoperation) - -an api client class which contains all the routes for path="/another-fake/dummy" - -## Method Summary -| Modifier and Type | Method and Description | -| ----------------- | ---------------------- | -| [AnotherfakedummyPatchResponses.EndpointResponse](../../paths/anotherfakedummy/patch/AnotherfakedummyPatchResponses.md#endpointresponse) | [patch](#patch)([AnotherfakedummyPatch.PatchRequest](../../paths/anotherfakedummy/AnotherfakedummyPatch.md#patchrequest) request)
To test special tags and operation ID starting with number | - -## Method Detail - -### patch -public [AnotherfakedummyPatchResponses.EndpointResponse](../../paths/anotherfakedummy/patch/AnotherfakedummyPatchResponses.md#endpointresponse) patch([AnotherfakedummyPatch.PatchRequest](../../paths/anotherfakedummy/AnotherfakedummyPatch.md#patchrequest) request) - -To test special tags and operation ID starting with number - -**Parameters:**
-request - the input request - -**Returns:**
-the deserialized response - -**Throws:**
-IOException, InterruptedException - an exception happened when making the request
-ValidationException - the returned response body or header values do not conform the the schema validation requirements
-NotImplementedException - the request body serialization or deserialization has not yet been implemented
- or the header content type deserialization has not yet been implemented for this contentType
-ApiException - server returned a response/contentType not defined in the openapi document
- -#### 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.AnotherfakedummyPatchRequestBody; -import org.openapijsonschematools.client.components.schemas.Client; -import org.openapijsonschematools.client.servers.RootServer0; -import org.openapijsonschematools.client.servers.RootServer1; -import org.openapijsonschematools.client.servers.RootServer2; -import org.openapijsonschematools.client.paths.anotherfakedummy.patch.responses.AnotherfakedummyPatchCode200Response; -import org.openapijsonschematools.client.servers.RootServerInfo; -import org.openapijsonschematools.client.apis.paths.Anotherfakedummy; -import org.openapijsonschematools.client.paths.anotherfakedummy.patch.AnotherfakedummyPatchResponses; - -import java.io.IOException; -import java.util.Arrays; -import java.util.List; -import java.util.Map; -import java.util.AbstractMap; - -// if you want to use a server that is not SERVER_0 pass it in here and change the ServerIndex input below -ApiConfiguration.ServerInfo serverInfo = new ApiConfiguration.ServerInfoBuilder() - .rootServerInfo( - new RootServerInfo.RootServerInfoBuilder() - .rootServer0(new RootServer0()) - .build() - ) - .build(); -ApiConfiguration.ServerIndexInfo serverIndexInfo = new ApiConfiguration.ServerIndexInfoBuilder() - .rootServerInfoServerIndex(RootServerInfo.ServerIndex.SERVER_0) - .build(); -Duration timeout = Duration.ofSeconds(1L); -Map> defaultHeaders = Map.of("User-Agent", List.of("OpenAPI-JSON-Schema-Generator/1.0.0/java")); -ApiConfiguration apiConfiguration = new ApiConfiguration( - serverInfo - serverIndexInfo, - timeout, - defaultHeaders -); -SchemaConfiguration schemaConfiguration = new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().build()); -Anotherfakedummy apiClient = new Anotherfakedummy(apiConfiguration, schemaConfiguration); - - -Client1BoxedMap requestBodyPayload = - Client.Client1.validateAndBox( - new Client.ClientMapBuilder1() - .client("a") - - .build(), - schemaConfiguration -); -AnotherfakedummyPatchRequestBody.SealedRequestBody requestBody = new AnotherfakedummyPatchRequestBody.ApplicationjsonRequestBody(requestBodyPayload); - -var request = new AnotherfakedummyPatch.PatchRequestBuilder() - .requestBody(requestBody) - .build(); - -AnotherfakedummyPatchResponses.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; -} -AnotherfakedummyPatchResponses.EndpointAnotherfakedummyPatchCode200Response castResponse = (AnotherfakedummyPatchResponses.EndpointAnotherfakedummyPatchCode200Response) response; -AnotherfakedummyPatchCode200Response.ApplicationjsonResponseBody deserializedBody = (AnotherfakedummyPatchCode200Response.ApplicationjsonResponseBody) castResponse.body; -// handle deserialized body here -``` -[[Back to top]](#top) [[Back to README]](../../../README.md) diff --git a/samples/client/petstore/kotlin/docs/apis/paths/Commonparamsubdir.md b/samples/client/petstore/kotlin/docs/apis/paths/Commonparamsubdir.md deleted file mode 100644 index 1d778b34d13..00000000000 --- a/samples/client/petstore/kotlin/docs/apis/paths/Commonparamsubdir.md +++ /dev/null @@ -1,321 +0,0 @@ -# Commonparamsubdir - -public class Commonparamsubdir extends extends ApiClient implements -[CommonparamsubdirDelete.DeleteOperation](../../paths/commonparamsubdir/CommonparamsubdirDelete.md#deleteoperation), -[CommonparamsubdirGet.GetOperation](../../paths/commonparamsubdir/CommonparamsubdirGet.md#getoperation), -[CommonparamsubdirPost.PostOperation](../../paths/commonparamsubdir/CommonparamsubdirPost.md#postoperation) - -an api client class which contains all the routes for path="/commonParam/{subDir}/" - -## Method Summary -| Modifier and Type | Method and Description | -| ----------------- | ---------------------- | -| [CommonparamsubdirDeleteResponses.EndpointResponse](../../paths/commonparamsubdir/delete/CommonparamsubdirDeleteResponses.md#endpointresponse) | [delete](#delete)([CommonparamsubdirDelete.DeleteRequest](../../paths/commonparamsubdir/CommonparamsubdirDelete.md#deleterequest) request)
common param is overwritten | -| [CommonparamsubdirGetResponses.EndpointResponse](../../paths/commonparamsubdir/get/CommonparamsubdirGetResponses.md#endpointresponse) | [get](#get)([CommonparamsubdirGet.GetRequest](../../paths/commonparamsubdir/CommonparamsubdirGet.md#getrequest) request) | -| [CommonparamsubdirPostResponses.EndpointResponse](../../paths/commonparamsubdir/post/CommonparamsubdirPostResponses.md#endpointresponse) | [post](#post)([CommonparamsubdirPost.PostRequest](../../paths/commonparamsubdir/CommonparamsubdirPost.md#postrequest) request) | - -## Method Detail - -### delete -public [CommonparamsubdirDeleteResponses.EndpointResponse](../../paths/commonparamsubdir/delete/CommonparamsubdirDeleteResponses.md#endpointresponse) delete([CommonparamsubdirDelete.DeleteRequest](../../paths/commonparamsubdir/CommonparamsubdirDelete.md#deleterequest) request) - -common param is overwritten - -**Parameters:**
-request - the input request - -**Returns:**
-the deserialized response - -**Throws:**
-IOException, InterruptedException - an exception happened when making the request
-ValidationException - the returned response body or header values do not conform the the schema validation requirements
-NotImplementedException - the request body serialization or deserialization has not yet been implemented
- or the header content type deserialization has not yet been implemented for this contentType
-ApiException - server returned a response/contentType not defined in the openapi document
- -#### 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.CommonparamsubdirDeleteHeaderParameters; -import org.openapijsonschematools.client.RootServerInfo; -import org.openapijsonschematools.client.paths.commonparamsubdir.delete.CommonparamsubdirDeletePathParameters; -import org.openapijsonschematools.client.servers.RootServer0; -import org.openapijsonschematools.client.servers.RootServer1; -import org.openapijsonschematools.client.servers.RootServer2; -import org.openapijsonschematools.client.paths.commonparamsubdir.delete.responses.CommonparamsubdirDeleteCode200Response; -import org.openapijsonschematools.client.servers.RootServerInfo; -import org.openapijsonschematools.client.apis.paths.Commonparamsubdir; -import org.openapijsonschematools.client.paths.commonparamsubdir.delete.CommonparamsubdirDeleteResponses; - -import java.io.IOException; -import java.util.Arrays; -import java.util.List; -import java.util.Map; -import java.util.AbstractMap; - -// if you want to use a server that is not SERVER_0 pass it in here and change the ServerIndex input below -ApiConfiguration.ServerInfo serverInfo = new ApiConfiguration.ServerInfoBuilder() - .rootServerInfo( - new RootServerInfo.RootServerInfoBuilder() - .rootServer0(new RootServer0()) - .build() - ) - .build(); -ApiConfiguration.ServerIndexInfo serverIndexInfo = new ApiConfiguration.ServerIndexInfoBuilder() - .rootServerInfoServerIndex(RootServerInfo.ServerIndex.SERVER_0) - .build(); -Duration timeout = Duration.ofSeconds(1L); -Map> defaultHeaders = Map.of("User-Agent", List.of("OpenAPI-JSON-Schema-Generator/1.0.0/java")); -ApiConfiguration apiConfiguration = new ApiConfiguration( - serverInfo - serverIndexInfo, - timeout, - defaultHeaders -); -SchemaConfiguration schemaConfiguration = new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().build()); -Commonparamsubdir apiClient = new Commonparamsubdir(apiConfiguration, schemaConfiguration); - - -// Map validation -CommonparamsubdirDeletePathParameters.PathParametersMap pathParameters = - CommonparamsubdirDeletePathParameters.CommonparamsubdirDeletePathParameters1.validate( - new CommonparamsubdirDeletePathParameters.PathParametersMapBuilder() - .subDir("c") - - .build(), - schemaConfiguration -); - -var request = new CommonparamsubdirDelete.DeleteRequestBuilder() - .pathParameters(pathParameters) - .build(); - -CommonparamsubdirDeleteResponses.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; -} -CommonparamsubdirDeleteResponses.EndpointCommonparamsubdirDeleteCode200Response castResponse = (CommonparamsubdirDeleteResponses.EndpointCommonparamsubdirDeleteCode200Response) response; -``` -### get -public [CommonparamsubdirGetResponses.EndpointResponse](../../paths/commonparamsubdir/get/CommonparamsubdirGetResponses.md#endpointresponse) get([CommonparamsubdirGet.GetRequest](../../paths/commonparamsubdir/CommonparamsubdirGet.md#getrequest) request) - -**Parameters:**
-request - the input request - -**Returns:**
-the deserialized response - -**Throws:**
-IOException, InterruptedException - an exception happened when making the request
-ValidationException - the returned response body or header values do not conform the the schema validation requirements
-NotImplementedException - the request body serialization or deserialization has not yet been implemented
- or the header content type deserialization has not yet been implemented for this contentType
-ApiException - server returned a response/contentType not defined in the openapi document
- -#### 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.get.CommonparamsubdirGetQueryParameters; -import org.openapijsonschematools.client.RootServerInfo; -import org.openapijsonschematools.client.paths.commonparamsubdir.get.CommonparamsubdirGetPathParameters; -import org.openapijsonschematools.client.servers.RootServer0; -import org.openapijsonschematools.client.servers.RootServer1; -import org.openapijsonschematools.client.servers.RootServer2; -import org.openapijsonschematools.client.paths.commonparamsubdir.get.responses.CommonparamsubdirGetCode200Response; -import org.openapijsonschematools.client.servers.RootServerInfo; -import org.openapijsonschematools.client.apis.paths.Commonparamsubdir; -import org.openapijsonschematools.client.paths.commonparamsubdir.get.CommonparamsubdirGetResponses; - -import java.io.IOException; -import java.util.Arrays; -import java.util.List; -import java.util.Map; -import java.util.AbstractMap; - -// if you want to use a server that is not SERVER_0 pass it in here and change the ServerIndex input below -ApiConfiguration.ServerInfo serverInfo = new ApiConfiguration.ServerInfoBuilder() - .rootServerInfo( - new RootServerInfo.RootServerInfoBuilder() - .rootServer0(new RootServer0()) - .build() - ) - .build(); -ApiConfiguration.ServerIndexInfo serverIndexInfo = new ApiConfiguration.ServerIndexInfoBuilder() - .rootServerInfoServerIndex(RootServerInfo.ServerIndex.SERVER_0) - .build(); -Duration timeout = Duration.ofSeconds(1L); -Map> defaultHeaders = Map.of("User-Agent", List.of("OpenAPI-JSON-Schema-Generator/1.0.0/java")); -ApiConfiguration apiConfiguration = new ApiConfiguration( - serverInfo - serverIndexInfo, - timeout, - defaultHeaders -); -SchemaConfiguration schemaConfiguration = new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().build()); -Commonparamsubdir apiClient = new Commonparamsubdir(apiConfiguration, schemaConfiguration); - - -// Map validation -CommonparamsubdirGetPathParameters.PathParametersMap pathParameters = - CommonparamsubdirGetPathParameters.CommonparamsubdirGetPathParameters1.validate( - new CommonparamsubdirGetPathParameters.PathParametersMapBuilder() - .subDir("a") - - .build(), - schemaConfiguration -); - -var request = new CommonparamsubdirGet.GetRequestBuilder() - .pathParameters(pathParameters) - .build(); - -CommonparamsubdirGetResponses.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; -} -CommonparamsubdirGetResponses.EndpointCommonparamsubdirGetCode200Response castResponse = (CommonparamsubdirGetResponses.EndpointCommonparamsubdirGetCode200Response) response; -``` -### post -public [CommonparamsubdirPostResponses.EndpointResponse](../../paths/commonparamsubdir/post/CommonparamsubdirPostResponses.md#endpointresponse) post([CommonparamsubdirPost.PostRequest](../../paths/commonparamsubdir/CommonparamsubdirPost.md#postrequest) request) - -**Parameters:**
-request - the input request - -**Returns:**
-the deserialized response - -**Throws:**
-IOException, InterruptedException - an exception happened when making the request
-ValidationException - the returned response body or header values do not conform the the schema validation requirements
-NotImplementedException - the request body serialization or deserialization has not yet been implemented
- or the header content type deserialization has not yet been implemented for this contentType
-ApiException - server returned a response/contentType not defined in the openapi document
- -#### 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.post.CommonparamsubdirPostHeaderParameters; -import org.openapijsonschematools.client.RootServerInfo; -import org.openapijsonschematools.client.paths.commonparamsubdir.post.CommonparamsubdirPostPathParameters; -import org.openapijsonschematools.client.servers.RootServer0; -import org.openapijsonschematools.client.servers.RootServer1; -import org.openapijsonschematools.client.servers.RootServer2; -import org.openapijsonschematools.client.paths.commonparamsubdir.post.responses.CommonparamsubdirPostCode200Response; -import org.openapijsonschematools.client.servers.RootServerInfo; -import org.openapijsonschematools.client.apis.paths.Commonparamsubdir; -import org.openapijsonschematools.client.paths.commonparamsubdir.post.CommonparamsubdirPostResponses; - -import java.io.IOException; -import java.util.Arrays; -import java.util.List; -import java.util.Map; -import java.util.AbstractMap; - -// if you want to use a server that is not SERVER_0 pass it in here and change the ServerIndex input below -ApiConfiguration.ServerInfo serverInfo = new ApiConfiguration.ServerInfoBuilder() - .rootServerInfo( - new RootServerInfo.RootServerInfoBuilder() - .rootServer0(new RootServer0()) - .build() - ) - .build(); -ApiConfiguration.ServerIndexInfo serverIndexInfo = new ApiConfiguration.ServerIndexInfoBuilder() - .rootServerInfoServerIndex(RootServerInfo.ServerIndex.SERVER_0) - .build(); -Duration timeout = Duration.ofSeconds(1L); -Map> defaultHeaders = Map.of("User-Agent", List.of("OpenAPI-JSON-Schema-Generator/1.0.0/java")); -ApiConfiguration apiConfiguration = new ApiConfiguration( - serverInfo - serverIndexInfo, - timeout, - defaultHeaders -); -SchemaConfiguration schemaConfiguration = new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().build()); -Commonparamsubdir apiClient = new Commonparamsubdir(apiConfiguration, schemaConfiguration); - - -// Map validation -CommonparamsubdirPostPathParameters.PathParametersMap pathParameters = - CommonparamsubdirPostPathParameters.CommonparamsubdirPostPathParameters1.validate( - new CommonparamsubdirPostPathParameters.PathParametersMapBuilder() - .subDir("a") - - .build(), - schemaConfiguration -); - -var request = new CommonparamsubdirPost.PostRequestBuilder() - .pathParameters(pathParameters) - .build(); - -CommonparamsubdirPostResponses.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; -} -CommonparamsubdirPostResponses.EndpointCommonparamsubdirPostCode200Response castResponse = (CommonparamsubdirPostResponses.EndpointCommonparamsubdirPostCode200Response) response; -``` -[[Back to top]](#top) [[Back to README]](../../../README.md) diff --git a/samples/client/petstore/kotlin/docs/apis/paths/Fake.md b/samples/client/petstore/kotlin/docs/apis/paths/Fake.md deleted file mode 100644 index 2f0f6492dd4..00000000000 --- a/samples/client/petstore/kotlin/docs/apis/paths/Fake.md +++ /dev/null @@ -1,460 +0,0 @@ -# Fake - -public class Fake extends extends ApiClient implements -[FakeDelete.DeleteOperation](../../paths/fake/FakeDelete.md#deleteoperation), -[FakeGet.GetOperation](../../paths/fake/FakeGet.md#getoperation), -[FakePatch.PatchOperation](../../paths/fake/FakePatch.md#patchoperation), -[FakePost.PostOperation](../../paths/fake/FakePost.md#postoperation) - -an api client class which contains all the routes for path="/fake" - -## Method Summary -| Modifier and Type | Method and Description | -| ----------------- | ---------------------- | -| [FakeDeleteResponses.EndpointResponse](../../paths/fake/delete/FakeDeleteResponses.md#endpointresponse) | [delete](#delete)([FakeDelete.DeleteRequest](../../paths/fake/FakeDelete.md#deleterequest) request)
Fake endpoint to test group parameters (optional) | -| [FakeGetResponses.EndpointResponse](../../paths/fake/get/FakeGetResponses.md#endpointresponse) | [get](#get)([FakeGet.GetRequest](../../paths/fake/FakeGet.md#getrequest) request)
To test enum parameters | -| [FakePatchResponses.EndpointResponse](../../paths/fake/patch/FakePatchResponses.md#endpointresponse) | [patch](#patch)([FakePatch.PatchRequest](../../paths/fake/FakePatch.md#patchrequest) request)
To test "client" model | -| [FakePostResponses.EndpointResponse](../../paths/fake/post/FakePostResponses.md#endpointresponse) | [post](#post)([FakePost.PostRequest](../../paths/fake/FakePost.md#postrequest) request)
Fake endpoint for testing various parameters
假端點
偽のエンドポイント
가짜 엔드 포인트
| - -## Method Detail - -### delete -public [FakeDeleteResponses.EndpointResponse](../../paths/fake/delete/FakeDeleteResponses.md#endpointresponse) delete([FakeDelete.DeleteRequest](../../paths/fake/FakeDelete.md#deleterequest) request) - -Fake endpoint to test group parameters (optional) - -**Parameters:**
-request - the input request - -**Returns:**
-the deserialized response - -**Throws:**
-IOException, InterruptedException - an exception happened when making the request
-ValidationException - the returned response body or header values do not conform the the schema validation requirements
-NotImplementedException - the request body serialization or deserialization has not yet been implemented
- or the header content type deserialization has not yet been implemented for this contentType
-ApiException - server returned a response/contentType not defined in the openapi document
- -#### 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.fake.delete.FakeDeleteSecurityInfo; -import org.openapijsonschematools.client.paths.fake.delete.FakeDeleteHeaderParameters; -import org.openapijsonschematools.client.paths.fake.delete.FakeDeleteQueryParameters; -import org.openapijsonschematools.client.servers.RootServer0; -import org.openapijsonschematools.client.servers.RootServer1; -import org.openapijsonschematools.client.servers.RootServer2; -import org.openapijsonschematools.client.securityschemes.SecurityScheme; -import org.openapijsonschematools.client.components.securityschemes.BearerTest; -import org.openapijsonschematools.client.paths.fake.delete.responses.FakeDeleteCode200Response; -import org.openapijsonschematools.client.servers.RootServerInfo; -import org.openapijsonschematools.client.apis.paths.Fake; -import org.openapijsonschematools.client.paths.fake.delete.FakeDeleteResponses; - -import java.io.IOException; -import java.util.Arrays; -import java.util.List; -import java.util.Map; -import java.util.AbstractMap; - -// if you want to use a server that is not SERVER_0 pass it in here and change the ServerIndex input below -ApiConfiguration.ServerInfo serverInfo = new ApiConfiguration.ServerInfoBuilder() - .rootServerInfo( - new RootServerInfo.RootServerInfoBuilder() - .rootServer0(new RootServer0()) - .build() - ) - .build(); -ApiConfiguration.ServerIndexInfo serverIndexInfo = new ApiConfiguration.ServerIndexInfoBuilder() - .rootServerInfoServerIndex(RootServerInfo.ServerIndex.SERVER_0) - .build(); -List securitySchemes = new ArrayList(); -securitySchemes.add( - new BearerTest("someAccessToken"); -); -ApiConfiguration.SecurityIndexInfo securityIndexInfo = new ApiConfiguration.SecurityIndexInfoBuilder() - .fakeDeleteSecurityRequirementObject0SecurityIndex(FakeDeleteSecurityRequirementObject0.SecurityIndex.SECURITY_0) - .build(); -Duration timeout = Duration.ofSeconds(1L); -Map> defaultHeaders = Map.of("User-Agent", List.of("OpenAPI-JSON-Schema-Generator/1.0.0/java")); -ApiConfiguration apiConfiguration = new ApiConfiguration( - serverInfo - serverIndexInfo, - securitySchemes, - securityIndexInfo, - timeout, - defaultHeaders -); -SchemaConfiguration schemaConfiguration = new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().build()); -Fake apiClient = new Fake(apiConfiguration, schemaConfiguration); - - -// Map validation -FakeDeleteHeaderParameters.HeaderParametersMap headerParameters = - FakeDeleteHeaderParameters.FakeDeleteHeaderParameters1.validate( - new FakeDeleteHeaderParameters.HeaderParametersMapBuilder() - .required_boolean_group("true") - - .boolean_group("true") - - .build(), - schemaConfiguration -); - -// Map validation -FakeDeleteQueryParameters.QueryParametersMap queryParameters = - FakeDeleteQueryParameters.FakeDeleteQueryParameters1.validate( - new FakeDeleteQueryParameters.QueryParametersMapBuilder() - .required_int64_group(1L) - - .required_string_group("a") - - .int64_group(1L) - - .string_group("a") - - .build(), - schemaConfiguration -); - -var request = new FakeDelete.DeleteRequestBuilder() - .headerParameters(headerParameters) - .queryParameters(queryParameters) - .build(); - -FakeDeleteResponses.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; -} -FakeDeleteResponses.EndpointFakeDeleteCode200Response castResponse = (FakeDeleteResponses.EndpointFakeDeleteCode200Response) response; -``` -### get -public [FakeGetResponses.EndpointResponse](../../paths/fake/get/FakeGetResponses.md#endpointresponse) get([FakeGet.GetRequest](../../paths/fake/FakeGet.md#getrequest) request) - -To test enum parameters - -**Parameters:**
-request - the input request - -**Returns:**
-the deserialized response - -**Throws:**
-IOException, InterruptedException - an exception happened when making the request
-ValidationException - the returned response body or header values do not conform the the schema validation requirements
-NotImplementedException - the request body serialization or deserialization has not yet been implemented
- or the header content type deserialization has not yet been implemented for this contentType
-ApiException - server returned a response/contentType not defined in the openapi document
- -#### 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.fake.get.FakeGetRequestBody; -import org.openapijsonschematools.client.paths.fake.get.requestbody.content.applicationxwwwformurlencoded.ApplicationxwwwformurlencodedSchema; -import org.openapijsonschematools.client.paths.fake.get.FakeGetHeaderParameters; -import org.openapijsonschematools.client.paths.fake.get.FakeGetQueryParameters; -import org.openapijsonschematools.client.RootServerInfo; -import org.openapijsonschematools.client.servers.RootServer0; -import org.openapijsonschematools.client.servers.RootServer1; -import org.openapijsonschematools.client.servers.RootServer2; -import org.openapijsonschematools.client.paths.fake.get.responses.FakeGetCode200Response; -import org.openapijsonschematools.client.paths.fake.get.responses.FakeGetCode404Response; -import org.openapijsonschematools.client.servers.RootServerInfo; -import org.openapijsonschematools.client.apis.paths.Fake; -import org.openapijsonschematools.client.paths.fake.get.FakeGetResponses; - -import java.io.IOException; -import java.util.Arrays; -import java.util.List; -import java.util.Map; -import java.util.AbstractMap; - -// if you want to use a server that is not SERVER_0 pass it in here and change the ServerIndex input below -ApiConfiguration.ServerInfo serverInfo = new ApiConfiguration.ServerInfoBuilder() - .rootServerInfo( - new RootServerInfo.RootServerInfoBuilder() - .rootServer0(new RootServer0()) - .build() - ) - .build(); -ApiConfiguration.ServerIndexInfo serverIndexInfo = new ApiConfiguration.ServerIndexInfoBuilder() - .rootServerInfoServerIndex(RootServerInfo.ServerIndex.SERVER_0) - .build(); -Duration timeout = Duration.ofSeconds(1L); -Map> defaultHeaders = Map.of("User-Agent", List.of("OpenAPI-JSON-Schema-Generator/1.0.0/java")); -ApiConfiguration apiConfiguration = new ApiConfiguration( - serverInfo - serverIndexInfo, - timeout, - defaultHeaders -); -SchemaConfiguration schemaConfiguration = new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().build()); -Fake apiClient = new Fake(apiConfiguration, schemaConfiguration); - - -var request = new FakeGet.GetRequestBuilder().build(); - -FakeGetResponses.EndpointResponse response; -try { - response = apiClient.get(request); -} catch (FakeGetCode404Response.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; -} -FakeGetResponses.EndpointFakeGetCode200Response castResponse = (FakeGetResponses.EndpointFakeGetCode200Response) response; -``` -### patch -public [FakePatchResponses.EndpointResponse](../../paths/fake/patch/FakePatchResponses.md#endpointresponse) patch([FakePatch.PatchRequest](../../paths/fake/FakePatch.md#patchrequest) request) - -To test "client" model - -**Parameters:**
-request - the input request - -**Returns:**
-the deserialized response - -**Throws:**
-IOException, InterruptedException - an exception happened when making the request
-ValidationException - the returned response body or header values do not conform the the schema validation requirements
-NotImplementedException - the request body serialization or deserialization has not yet been implemented
- or the header content type deserialization has not yet been implemented for this contentType
-ApiException - server returned a response/contentType not defined in the openapi document
- -#### 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.fake.patch.FakePatchRequestBody; -import org.openapijsonschematools.client.components.schemas.Client; -import org.openapijsonschematools.client.servers.RootServer0; -import org.openapijsonschematools.client.servers.RootServer1; -import org.openapijsonschematools.client.servers.RootServer2; -import org.openapijsonschematools.client.paths.fake.patch.responses.FakePatchCode200Response; -import org.openapijsonschematools.client.servers.RootServerInfo; -import org.openapijsonschematools.client.apis.paths.Fake; -import org.openapijsonschematools.client.paths.fake.patch.FakePatchResponses; - -import java.io.IOException; -import java.util.Arrays; -import java.util.List; -import java.util.Map; -import java.util.AbstractMap; - -// if you want to use a server that is not SERVER_0 pass it in here and change the ServerIndex input below -ApiConfiguration.ServerInfo serverInfo = new ApiConfiguration.ServerInfoBuilder() - .rootServerInfo( - new RootServerInfo.RootServerInfoBuilder() - .rootServer0(new RootServer0()) - .build() - ) - .build(); -ApiConfiguration.ServerIndexInfo serverIndexInfo = new ApiConfiguration.ServerIndexInfoBuilder() - .rootServerInfoServerIndex(RootServerInfo.ServerIndex.SERVER_0) - .build(); -Duration timeout = Duration.ofSeconds(1L); -Map> defaultHeaders = Map.of("User-Agent", List.of("OpenAPI-JSON-Schema-Generator/1.0.0/java")); -ApiConfiguration apiConfiguration = new ApiConfiguration( - serverInfo - serverIndexInfo, - timeout, - defaultHeaders -); -SchemaConfiguration schemaConfiguration = new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().build()); -Fake apiClient = new Fake(apiConfiguration, schemaConfiguration); - - -Client1BoxedMap requestBodyPayload = - Client.Client1.validateAndBox( - new Client.ClientMapBuilder1() - .client("a") - - .build(), - schemaConfiguration -); -FakePatchRequestBody.SealedRequestBody requestBody = new FakePatchRequestBody.ApplicationjsonRequestBody(requestBodyPayload); - -var request = new FakePatch.PatchRequestBuilder() - .requestBody(requestBody) - .build(); - -FakePatchResponses.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; -} -FakePatchResponses.EndpointFakePatchCode200Response castResponse = (FakePatchResponses.EndpointFakePatchCode200Response) response; -FakePatchCode200Response.ApplicationjsonResponseBody deserializedBody = (FakePatchCode200Response.ApplicationjsonResponseBody) castResponse.body; -// handle deserialized body here -``` -### post -public [FakePostResponses.EndpointResponse](../../paths/fake/post/FakePostResponses.md#endpointresponse) post([FakePost.PostRequest](../../paths/fake/FakePost.md#postrequest) request) - -Fake endpoint for testing various parameters
假端點
偽のエンドポイント
가짜 엔드 포인트
- -**Parameters:**
-request - the input request - -**Returns:**
-the deserialized response - -**Throws:**
-IOException, InterruptedException - an exception happened when making the request
-ValidationException - the returned response body or header values do not conform the the schema validation requirements
-NotImplementedException - the request body serialization or deserialization has not yet been implemented
- or the header content type deserialization has not yet been implemented for this contentType
-ApiException - server returned a response/contentType not defined in the openapi document
- -#### 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.fake.post.FakePostRequestBody; -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.RootServer0; -import org.openapijsonschematools.client.servers.RootServer1; -import org.openapijsonschematools.client.servers.RootServer2; -import org.openapijsonschematools.client.securityschemes.SecurityScheme; -import org.openapijsonschematools.client.components.securityschemes.HttpBasicTest; -import org.openapijsonschematools.client.paths.fake.post.responses.FakePostCode200Response; -import org.openapijsonschematools.client.paths.fake.post.responses.FakePostCode404Response; -import org.openapijsonschematools.client.servers.RootServerInfo; -import org.openapijsonschematools.client.apis.paths.Fake; -import org.openapijsonschematools.client.paths.fake.post.FakePostResponses; - -import java.io.IOException; -import java.util.Arrays; -import java.util.List; -import java.util.Map; -import java.util.AbstractMap; - -// if you want to use a server that is not SERVER_0 pass it in here and change the ServerIndex input below -ApiConfiguration.ServerInfo serverInfo = new ApiConfiguration.ServerInfoBuilder() - .rootServerInfo( - new RootServerInfo.RootServerInfoBuilder() - .rootServer0(new RootServer0()) - .build() - ) - .build(); -ApiConfiguration.ServerIndexInfo serverIndexInfo = new ApiConfiguration.ServerIndexInfoBuilder() - .rootServerInfoServerIndex(RootServerInfo.ServerIndex.SERVER_0) - .build(); -List securitySchemes = new ArrayList(); -securitySchemes.add( - new HttpBasicTest("someUserId", "somePassword"); -); -ApiConfiguration.SecurityIndexInfo securityIndexInfo = new ApiConfiguration.SecurityIndexInfoBuilder() - .fakePostSecurityRequirementObject0SecurityIndex(FakePostSecurityRequirementObject0.SecurityIndex.SECURITY_0) - .build(); -Duration timeout = Duration.ofSeconds(1L); -Map> defaultHeaders = Map.of("User-Agent", List.of("OpenAPI-JSON-Schema-Generator/1.0.0/java")); -ApiConfiguration apiConfiguration = new ApiConfiguration( - serverInfo - serverIndexInfo, - securitySchemes, - securityIndexInfo, - timeout, - defaultHeaders -); -SchemaConfiguration schemaConfiguration = new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().build()); -Fake apiClient = new Fake(apiConfiguration, schemaConfiguration); - - -var request = new FakePost.PostRequestBuilder().build(); - -FakePostResponses.EndpointResponse response; -try { - response = apiClient.post(request); -} catch (FakePostCode404Response.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; -} -FakePostResponses.EndpointFakePostCode200Response castResponse = (FakePostResponses.EndpointFakePostCode200Response) response; -``` -[[Back to top]](#top) [[Back to README]](../../../README.md) diff --git a/samples/client/petstore/kotlin/docs/apis/paths/Fakeadditionalpropertieswitharrayofenums.md b/samples/client/petstore/kotlin/docs/apis/paths/Fakeadditionalpropertieswitharrayofenums.md deleted file mode 100644 index b79b67276cb..00000000000 --- a/samples/client/petstore/kotlin/docs/apis/paths/Fakeadditionalpropertieswitharrayofenums.md +++ /dev/null @@ -1,105 +0,0 @@ -# Fakeadditionalpropertieswitharrayofenums - -public class Fakeadditionalpropertieswitharrayofenums extends extends ApiClient implements -[FakeadditionalpropertieswitharrayofenumsGet.GetOperation](../../paths/fakeadditionalpropertieswitharrayofenums/FakeadditionalpropertieswitharrayofenumsGet.md#getoperation) - -an api client class which contains all the routes for path="/fake/additional-properties-with-array-of-enums" - -## Method Summary -| Modifier and Type | Method and Description | -| ----------------- | ---------------------- | -| [FakeadditionalpropertieswitharrayofenumsGetResponses.EndpointResponse](../../paths/fakeadditionalpropertieswitharrayofenums/get/FakeadditionalpropertieswitharrayofenumsGetResponses.md#endpointresponse) | [get](#get)([FakeadditionalpropertieswitharrayofenumsGet.GetRequest](../../paths/fakeadditionalpropertieswitharrayofenums/FakeadditionalpropertieswitharrayofenumsGet.md#getrequest) request) | - -## Method Detail - -### get -public [FakeadditionalpropertieswitharrayofenumsGetResponses.EndpointResponse](../../paths/fakeadditionalpropertieswitharrayofenums/get/FakeadditionalpropertieswitharrayofenumsGetResponses.md#endpointresponse) get([FakeadditionalpropertieswitharrayofenumsGet.GetRequest](../../paths/fakeadditionalpropertieswitharrayofenums/FakeadditionalpropertieswitharrayofenumsGet.md#getrequest) request) - -**Parameters:**
-request - the input request - -**Returns:**
-the deserialized response - -**Throws:**
-IOException, InterruptedException - an exception happened when making the request
-ValidationException - the returned response body or header values do not conform the the schema validation requirements
-NotImplementedException - the request body serialization or deserialization has not yet been implemented
- or the header content type deserialization has not yet been implemented for this contentType
-ApiException - server returned a response/contentType not defined in the openapi document
- -#### 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.fakeadditionalpropertieswitharrayofenums.get.FakeadditionalpropertieswitharrayofenumsGetRequestBody; -import org.openapijsonschematools.client.components.schemas.AdditionalPropertiesWithArrayOfEnums; -import org.openapijsonschematools.client.RootServerInfo; -import org.openapijsonschematools.client.servers.RootServer0; -import org.openapijsonschematools.client.servers.RootServer1; -import org.openapijsonschematools.client.servers.RootServer2; -import org.openapijsonschematools.client.paths.fakeadditionalpropertieswitharrayofenums.get.responses.FakeadditionalpropertieswitharrayofenumsGetCode200Response; -import org.openapijsonschematools.client.servers.RootServerInfo; -import org.openapijsonschematools.client.apis.paths.Fakeadditionalpropertieswitharrayofenums; -import org.openapijsonschematools.client.paths.fakeadditionalpropertieswitharrayofenums.get.FakeadditionalpropertieswitharrayofenumsGetResponses; - -import java.io.IOException; -import java.util.Arrays; -import java.util.List; -import java.util.Map; -import java.util.AbstractMap; - -// if you want to use a server that is not SERVER_0 pass it in here and change the ServerIndex input below -ApiConfiguration.ServerInfo serverInfo = new ApiConfiguration.ServerInfoBuilder() - .rootServerInfo( - new RootServerInfo.RootServerInfoBuilder() - .rootServer0(new RootServer0()) - .build() - ) - .build(); -ApiConfiguration.ServerIndexInfo serverIndexInfo = new ApiConfiguration.ServerIndexInfoBuilder() - .rootServerInfoServerIndex(RootServerInfo.ServerIndex.SERVER_0) - .build(); -Duration timeout = Duration.ofSeconds(1L); -Map> defaultHeaders = Map.of("User-Agent", List.of("OpenAPI-JSON-Schema-Generator/1.0.0/java")); -ApiConfiguration apiConfiguration = new ApiConfiguration( - serverInfo - serverIndexInfo, - timeout, - defaultHeaders -); -SchemaConfiguration schemaConfiguration = new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().build()); -Fakeadditionalpropertieswitharrayofenums apiClient = new Fakeadditionalpropertieswitharrayofenums(apiConfiguration, schemaConfiguration); - - -var request = new FakeadditionalpropertieswitharrayofenumsGet.GetRequestBuilder().build(); - -FakeadditionalpropertieswitharrayofenumsGetResponses.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; -} -FakeadditionalpropertieswitharrayofenumsGetResponses.EndpointFakeadditionalpropertieswitharrayofenumsGetCode200Response castResponse = (FakeadditionalpropertieswitharrayofenumsGetResponses.EndpointFakeadditionalpropertieswitharrayofenumsGetCode200Response) response; -FakeadditionalpropertieswitharrayofenumsGetCode200Response.ApplicationjsonResponseBody deserializedBody = (FakeadditionalpropertieswitharrayofenumsGetCode200Response.ApplicationjsonResponseBody) castResponse.body; -// handle deserialized body here -``` -[[Back to top]](#top) [[Back to README]](../../../README.md) diff --git a/samples/client/petstore/kotlin/docs/apis/paths/Fakebodywithfileschema.md b/samples/client/petstore/kotlin/docs/apis/paths/Fakebodywithfileschema.md deleted file mode 100644 index 531b96a5ee1..00000000000 --- a/samples/client/petstore/kotlin/docs/apis/paths/Fakebodywithfileschema.md +++ /dev/null @@ -1,119 +0,0 @@ -# Fakebodywithfileschema - -public class Fakebodywithfileschema extends extends ApiClient implements -[FakebodywithfileschemaPut.PutOperation](../../paths/fakebodywithfileschema/FakebodywithfileschemaPut.md#putoperation) - -an api client class which contains all the routes for path="/fake/body-with-file-schema" - -## Method Summary -| Modifier and Type | Method and Description | -| ----------------- | ---------------------- | -| [FakebodywithfileschemaPutResponses.EndpointResponse](../../paths/fakebodywithfileschema/put/FakebodywithfileschemaPutResponses.md#endpointresponse) | [put](#put)([FakebodywithfileschemaPut.PutRequest](../../paths/fakebodywithfileschema/FakebodywithfileschemaPut.md#putrequest) request)
For this test, the body for this request much reference a schema named `File`. | - -## Method Detail - -### put -public [FakebodywithfileschemaPutResponses.EndpointResponse](../../paths/fakebodywithfileschema/put/FakebodywithfileschemaPutResponses.md#endpointresponse) put([FakebodywithfileschemaPut.PutRequest](../../paths/fakebodywithfileschema/FakebodywithfileschemaPut.md#putrequest) request) - -For this test, the body for this request much reference a schema named `File`. - -**Parameters:**
-request - the input request - -**Returns:**
-the deserialized response - -**Throws:**
-IOException, InterruptedException - an exception happened when making the request
-ValidationException - the returned response body or header values do not conform the the schema validation requirements
-NotImplementedException - the request body serialization or deserialization has not yet been implemented
- or the header content type deserialization has not yet been implemented for this contentType
-ApiException - server returned a response/contentType not defined in the openapi document
- -#### 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.fakebodywithfileschema.put.FakebodywithfileschemaPutRequestBody; -import org.openapijsonschematools.client.components.schemas.FileSchemaTestClass; -import org.openapijsonschematools.client.servers.RootServer0; -import org.openapijsonschematools.client.servers.RootServer1; -import org.openapijsonschematools.client.servers.RootServer2; -import org.openapijsonschematools.client.paths.fakebodywithfileschema.put.responses.FakebodywithfileschemaPutCode200Response; -import org.openapijsonschematools.client.servers.RootServerInfo; -import org.openapijsonschematools.client.apis.paths.Fakebodywithfileschema; -import org.openapijsonschematools.client.paths.fakebodywithfileschema.put.FakebodywithfileschemaPutResponses; - -import java.io.IOException; -import java.util.Arrays; -import java.util.List; -import java.util.Map; -import java.util.AbstractMap; - -// if you want to use a server that is not SERVER_0 pass it in here and change the ServerIndex input below -ApiConfiguration.ServerInfo serverInfo = new ApiConfiguration.ServerInfoBuilder() - .rootServerInfo( - new RootServerInfo.RootServerInfoBuilder() - .rootServer0(new RootServer0()) - .build() - ) - .build(); -ApiConfiguration.ServerIndexInfo serverIndexInfo = new ApiConfiguration.ServerIndexInfoBuilder() - .rootServerInfoServerIndex(RootServerInfo.ServerIndex.SERVER_0) - .build(); -Duration timeout = Duration.ofSeconds(1L); -Map> defaultHeaders = Map.of("User-Agent", List.of("OpenAPI-JSON-Schema-Generator/1.0.0/java")); -ApiConfiguration apiConfiguration = new ApiConfiguration( - serverInfo - serverIndexInfo, - timeout, - defaultHeaders -); -SchemaConfiguration schemaConfiguration = new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().build()); -Fakebodywithfileschema apiClient = new Fakebodywithfileschema(apiConfiguration, schemaConfiguration); - - -FileSchemaTestClass1BoxedMap requestBodyPayload = - FileSchemaTestClass.FileSchemaTestClass1.validateAndBox( - new FileSchemaTestClass.FileSchemaTestClassMapBuilder() - .files( - Arrays.asList( - ) - ) - .build(), - schemaConfiguration -); -FakebodywithfileschemaPut.SealedRequestBody requestBody = new FakebodywithfileschemaPut.ApplicationjsonRequestBody(requestBodyPayload); - -var request = new FakebodywithfileschemaPut.PutRequestBuilder() - .requestBody(requestBody) - .build(); - -FakebodywithfileschemaPutResponses.EndpointResponse response; -try { - response = apiClient.put(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; -} -FakebodywithfileschemaPutResponses.EndpointFakebodywithfileschemaPutCode200Response castResponse = (FakebodywithfileschemaPutResponses.EndpointFakebodywithfileschemaPutCode200Response) response; -``` -[[Back to top]](#top) [[Back to README]](../../../README.md) diff --git a/samples/client/petstore/kotlin/docs/apis/paths/Fakebodywithqueryparams.md b/samples/client/petstore/kotlin/docs/apis/paths/Fakebodywithqueryparams.md deleted file mode 100644 index 62ce5e81352..00000000000 --- a/samples/client/petstore/kotlin/docs/apis/paths/Fakebodywithqueryparams.md +++ /dev/null @@ -1,143 +0,0 @@ -# Fakebodywithqueryparams - -public class Fakebodywithqueryparams extends extends ApiClient implements -[FakebodywithqueryparamsPut.PutOperation](../../paths/fakebodywithqueryparams/FakebodywithqueryparamsPut.md#putoperation) - -an api client class which contains all the routes for path="/fake/body-with-query-params" - -## Method Summary -| Modifier and Type | Method and Description | -| ----------------- | ---------------------- | -| [FakebodywithqueryparamsPutResponses.EndpointResponse](../../paths/fakebodywithqueryparams/put/FakebodywithqueryparamsPutResponses.md#endpointresponse) | [put](#put)([FakebodywithqueryparamsPut.PutRequest](../../paths/fakebodywithqueryparams/FakebodywithqueryparamsPut.md#putrequest) request) | - -## Method Detail - -### put -public [FakebodywithqueryparamsPutResponses.EndpointResponse](../../paths/fakebodywithqueryparams/put/FakebodywithqueryparamsPutResponses.md#endpointresponse) put([FakebodywithqueryparamsPut.PutRequest](../../paths/fakebodywithqueryparams/FakebodywithqueryparamsPut.md#putrequest) request) - -**Parameters:**
-request - the input request - -**Returns:**
-the deserialized response - -**Throws:**
-IOException, InterruptedException - an exception happened when making the request
-ValidationException - the returned response body or header values do not conform the the schema validation requirements
-NotImplementedException - the request body serialization or deserialization has not yet been implemented
- or the header content type deserialization has not yet been implemented for this contentType
-ApiException - server returned a response/contentType not defined in the openapi document
- -#### 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.fakebodywithqueryparams.put.FakebodywithqueryparamsPutRequestBody; -import org.openapijsonschematools.client.components.schemas.User; -import org.openapijsonschematools.client.paths.fakebodywithqueryparams.put.FakebodywithqueryparamsPutQueryParameters; -import org.openapijsonschematools.client.servers.RootServer0; -import org.openapijsonschematools.client.servers.RootServer1; -import org.openapijsonschematools.client.servers.RootServer2; -import org.openapijsonschematools.client.paths.fakebodywithqueryparams.put.responses.FakebodywithqueryparamsPutCode200Response; -import org.openapijsonschematools.client.servers.RootServerInfo; -import org.openapijsonschematools.client.apis.paths.Fakebodywithqueryparams; -import org.openapijsonschematools.client.paths.fakebodywithqueryparams.put.FakebodywithqueryparamsPutResponses; - -import java.io.IOException; -import java.util.Arrays; -import java.util.List; -import java.util.Map; -import java.util.AbstractMap; - -// if you want to use a server that is not SERVER_0 pass it in here and change the ServerIndex input below -ApiConfiguration.ServerInfo serverInfo = new ApiConfiguration.ServerInfoBuilder() - .rootServerInfo( - new RootServerInfo.RootServerInfoBuilder() - .rootServer0(new RootServer0()) - .build() - ) - .build(); -ApiConfiguration.ServerIndexInfo serverIndexInfo = new ApiConfiguration.ServerIndexInfoBuilder() - .rootServerInfoServerIndex(RootServerInfo.ServerIndex.SERVER_0) - .build(); -Duration timeout = Duration.ofSeconds(1L); -Map> defaultHeaders = Map.of("User-Agent", List.of("OpenAPI-JSON-Schema-Generator/1.0.0/java")); -ApiConfiguration apiConfiguration = new ApiConfiguration( - serverInfo - serverIndexInfo, - timeout, - defaultHeaders -); -SchemaConfiguration schemaConfiguration = new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().build()); -Fakebodywithqueryparams apiClient = new Fakebodywithqueryparams(apiConfiguration, schemaConfiguration); - - -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 -); -FakebodywithqueryparamsPut.SealedRequestBody requestBody = new FakebodywithqueryparamsPut.ApplicationjsonRequestBody(requestBodyPayload); - -// Map validation -FakebodywithqueryparamsPutQueryParameters.QueryParametersMap queryParameters = - FakebodywithqueryparamsPutQueryParameters.FakebodywithqueryparamsPutQueryParameters1.validate( - new FakebodywithqueryparamsPutQueryParameters.QueryParametersMapBuilder() - .query("a") - - .build(), - schemaConfiguration -); - -var request = new FakebodywithqueryparamsPut.PutRequestBuilder() - .requestBody(requestBody) - .queryParameters(queryParameters) - .build(); - -FakebodywithqueryparamsPutResponses.EndpointResponse response; -try { - response = apiClient.put(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; -} -FakebodywithqueryparamsPutResponses.EndpointFakebodywithqueryparamsPutCode200Response castResponse = (FakebodywithqueryparamsPutResponses.EndpointFakebodywithqueryparamsPutCode200Response) response; -``` -[[Back to top]](#top) [[Back to README]](../../../README.md) diff --git a/samples/client/petstore/kotlin/docs/apis/paths/Fakecasesensitiveparams.md b/samples/client/petstore/kotlin/docs/apis/paths/Fakecasesensitiveparams.md deleted file mode 100644 index 81d60e9c5d1..00000000000 --- a/samples/client/petstore/kotlin/docs/apis/paths/Fakecasesensitiveparams.md +++ /dev/null @@ -1,120 +0,0 @@ -# Fakecasesensitiveparams - -public class Fakecasesensitiveparams extends extends ApiClient implements -[FakecasesensitiveparamsPut.PutOperation](../../paths/fakecasesensitiveparams/FakecasesensitiveparamsPut.md#putoperation) - -an api client class which contains all the routes for path="/fake/case-sensitive-params" - -## Method Summary -| Modifier and Type | Method and Description | -| ----------------- | ---------------------- | -| [FakecasesensitiveparamsPutResponses.EndpointResponse](../../paths/fakecasesensitiveparams/put/FakecasesensitiveparamsPutResponses.md#endpointresponse) | [put](#put)([FakecasesensitiveparamsPut.PutRequest](../../paths/fakecasesensitiveparams/FakecasesensitiveparamsPut.md#putrequest) request)
Ensures that original naming is used in endpoint params, that way we don't have collisions | - -## Method Detail - -### put -public [FakecasesensitiveparamsPutResponses.EndpointResponse](../../paths/fakecasesensitiveparams/put/FakecasesensitiveparamsPutResponses.md#endpointresponse) put([FakecasesensitiveparamsPut.PutRequest](../../paths/fakecasesensitiveparams/FakecasesensitiveparamsPut.md#putrequest) request) - -Ensures that original naming is used in endpoint params, that way we don't have collisions - -**Parameters:**
-request - the input request - -**Returns:**
-the deserialized response - -**Throws:**
-IOException, InterruptedException - an exception happened when making the request
-ValidationException - the returned response body or header values do not conform the the schema validation requirements
-NotImplementedException - the request body serialization or deserialization has not yet been implemented
- or the header content type deserialization has not yet been implemented for this contentType
-ApiException - server returned a response/contentType not defined in the openapi document
- -#### 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.fakecasesensitiveparams.put.FakecasesensitiveparamsPutQueryParameters; -import org.openapijsonschematools.client.servers.RootServer0; -import org.openapijsonschematools.client.servers.RootServer1; -import org.openapijsonschematools.client.servers.RootServer2; -import org.openapijsonschematools.client.paths.fakecasesensitiveparams.put.responses.FakecasesensitiveparamsPutCode200Response; -import org.openapijsonschematools.client.servers.RootServerInfo; -import org.openapijsonschematools.client.apis.paths.Fakecasesensitiveparams; -import org.openapijsonschematools.client.paths.fakecasesensitiveparams.put.FakecasesensitiveparamsPutResponses; - -import java.io.IOException; -import java.util.Arrays; -import java.util.List; -import java.util.Map; -import java.util.AbstractMap; - -// if you want to use a server that is not SERVER_0 pass it in here and change the ServerIndex input below -ApiConfiguration.ServerInfo serverInfo = new ApiConfiguration.ServerInfoBuilder() - .rootServerInfo( - new RootServerInfo.RootServerInfoBuilder() - .rootServer0(new RootServer0()) - .build() - ) - .build(); -ApiConfiguration.ServerIndexInfo serverIndexInfo = new ApiConfiguration.ServerIndexInfoBuilder() - .rootServerInfoServerIndex(RootServerInfo.ServerIndex.SERVER_0) - .build(); -Duration timeout = Duration.ofSeconds(1L); -Map> defaultHeaders = Map.of("User-Agent", List.of("OpenAPI-JSON-Schema-Generator/1.0.0/java")); -ApiConfiguration apiConfiguration = new ApiConfiguration( - serverInfo - serverIndexInfo, - timeout, - defaultHeaders -); -SchemaConfiguration schemaConfiguration = new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().build()); -Fakecasesensitiveparams apiClient = new Fakecasesensitiveparams(apiConfiguration, schemaConfiguration); - - -// Map validation -FakecasesensitiveparamsPutQueryParameters.QueryParametersMap queryParameters = - FakecasesensitiveparamsPutQueryParameters.FakecasesensitiveparamsPutQueryParameters1.validate( - new FakecasesensitiveparamsPutQueryParameters.QueryParametersMapBuilder() - .SomeVar("a") - - .someVar("a") - - .some_var("a") - - .build(), - schemaConfiguration -); - -var request = new FakecasesensitiveparamsPut.PutRequestBuilder() - .queryParameters(queryParameters) - .build(); - -FakecasesensitiveparamsPutResponses.EndpointResponse response; -try { - response = apiClient.put(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; -} -FakecasesensitiveparamsPutResponses.EndpointFakecasesensitiveparamsPutCode200Response castResponse = (FakecasesensitiveparamsPutResponses.EndpointFakecasesensitiveparamsPutCode200Response) response; -``` -[[Back to top]](#top) [[Back to README]](../../../README.md) diff --git a/samples/client/petstore/kotlin/docs/apis/paths/Fakeclassnametest.md b/samples/client/petstore/kotlin/docs/apis/paths/Fakeclassnametest.md deleted file mode 100644 index cc6495fc943..00000000000 --- a/samples/client/petstore/kotlin/docs/apis/paths/Fakeclassnametest.md +++ /dev/null @@ -1,131 +0,0 @@ -# Fakeclassnametest - -public class Fakeclassnametest extends extends ApiClient implements -[FakeclassnametestPatch.PatchOperation](../../paths/fakeclassnametest/FakeclassnametestPatch.md#patchoperation) - -an api client class which contains all the routes for path="/fake_classname_test" - -## Method Summary -| Modifier and Type | Method and Description | -| ----------------- | ---------------------- | -| [FakeclassnametestPatchResponses.EndpointResponse](../../paths/fakeclassnametest/patch/FakeclassnametestPatchResponses.md#endpointresponse) | [patch](#patch)([FakeclassnametestPatch.PatchRequest](../../paths/fakeclassnametest/FakeclassnametestPatch.md#patchrequest) request)
To test class name in snake case | - -## Method Detail - -### patch -public [FakeclassnametestPatchResponses.EndpointResponse](../../paths/fakeclassnametest/patch/FakeclassnametestPatchResponses.md#endpointresponse) patch([FakeclassnametestPatch.PatchRequest](../../paths/fakeclassnametest/FakeclassnametestPatch.md#patchrequest) request) - -To test class name in snake case - -**Parameters:**
-request - the input request - -**Returns:**
-the deserialized response - -**Throws:**
-IOException, InterruptedException - an exception happened when making the request
-ValidationException - the returned response body or header values do not conform the the schema validation requirements
-NotImplementedException - the request body serialization or deserialization has not yet been implemented
- or the header content type deserialization has not yet been implemented for this contentType
-ApiException - server returned a response/contentType not defined in the openapi document
- -#### 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.fakeclassnametest.patch.FakeclassnametestPatchSecurityInfo; -import org.openapijsonschematools.client.paths.fakeclassnametest.patch.FakeclassnametestPatchRequestBody; -import org.openapijsonschematools.client.components.schemas.Client; -import org.openapijsonschematools.client.servers.RootServer0; -import org.openapijsonschematools.client.servers.RootServer1; -import org.openapijsonschematools.client.servers.RootServer2; -import org.openapijsonschematools.client.securityschemes.SecurityScheme; -import org.openapijsonschematools.client.components.securityschemes.ApiKeyQuery; -import org.openapijsonschematools.client.paths.fakeclassnametest.patch.responses.FakeclassnametestPatchCode200Response; -import org.openapijsonschematools.client.servers.RootServerInfo; -import org.openapijsonschematools.client.apis.paths.Fakeclassnametest; -import org.openapijsonschematools.client.paths.fakeclassnametest.patch.FakeclassnametestPatchResponses; - -import java.io.IOException; -import java.util.Arrays; -import java.util.List; -import java.util.Map; -import java.util.AbstractMap; - -// if you want to use a server that is not SERVER_0 pass it in here and change the ServerIndex input below -ApiConfiguration.ServerInfo serverInfo = new ApiConfiguration.ServerInfoBuilder() - .rootServerInfo( - new RootServerInfo.RootServerInfoBuilder() - .rootServer0(new RootServer0()) - .build() - ) - .build(); -ApiConfiguration.ServerIndexInfo serverIndexInfo = new ApiConfiguration.ServerIndexInfoBuilder() - .rootServerInfoServerIndex(RootServerInfo.ServerIndex.SERVER_0) - .build(); -List securitySchemes = new ArrayList(); -securitySchemes.add( - new ApiKeyQuery("someApiKey"); -); -ApiConfiguration.SecurityIndexInfo securityIndexInfo = new ApiConfiguration.SecurityIndexInfoBuilder() - .fakeclassnametestPatchSecurityRequirementObject0SecurityIndex(FakeclassnametestPatchSecurityRequirementObject0.SecurityIndex.SECURITY_0) - .build(); -Duration timeout = Duration.ofSeconds(1L); -Map> defaultHeaders = Map.of("User-Agent", List.of("OpenAPI-JSON-Schema-Generator/1.0.0/java")); -ApiConfiguration apiConfiguration = new ApiConfiguration( - serverInfo - serverIndexInfo, - securitySchemes, - securityIndexInfo, - timeout, - defaultHeaders -); -SchemaConfiguration schemaConfiguration = new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().build()); -Fakeclassnametest apiClient = new Fakeclassnametest(apiConfiguration, schemaConfiguration); - - -Client1BoxedMap requestBodyPayload = - Client.Client1.validateAndBox( - new Client.ClientMapBuilder1() - .client("a") - - .build(), - schemaConfiguration -); -FakeclassnametestPatchRequestBody.SealedRequestBody requestBody = new FakeclassnametestPatchRequestBody.ApplicationjsonRequestBody(requestBodyPayload); - -var request = new FakeclassnametestPatch.PatchRequestBuilder() - .requestBody(requestBody) - .build(); - -FakeclassnametestPatchResponses.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; -} -FakeclassnametestPatchResponses.EndpointFakeclassnametestPatchCode200Response castResponse = (FakeclassnametestPatchResponses.EndpointFakeclassnametestPatchCode200Response) response; -FakeclassnametestPatchCode200Response.ApplicationjsonResponseBody deserializedBody = (FakeclassnametestPatchCode200Response.ApplicationjsonResponseBody) castResponse.body; -// handle deserialized body here -``` -[[Back to top]](#top) [[Back to README]](../../../README.md) diff --git a/samples/client/petstore/kotlin/docs/apis/paths/Fakedeletecoffeeid.md b/samples/client/petstore/kotlin/docs/apis/paths/Fakedeletecoffeeid.md deleted file mode 100644 index 4e01b0caf73..00000000000 --- a/samples/client/petstore/kotlin/docs/apis/paths/Fakedeletecoffeeid.md +++ /dev/null @@ -1,120 +0,0 @@ -# Fakedeletecoffeeid - -public class Fakedeletecoffeeid extends extends ApiClient implements -[FakedeletecoffeeidDelete.DeleteOperation](../../paths/fakedeletecoffeeid/FakedeletecoffeeidDelete.md#deleteoperation) - -an api client class which contains all the routes for path="/fake/deleteCoffee/{id}" - -## Method Summary -| Modifier and Type | Method and Description | -| ----------------- | ---------------------- | -| [FakedeletecoffeeidDeleteResponses.EndpointResponse](../../paths/fakedeletecoffeeid/delete/FakedeletecoffeeidDeleteResponses.md#endpointresponse) | [delete](#delete)([FakedeletecoffeeidDelete.DeleteRequest](../../paths/fakedeletecoffeeid/FakedeletecoffeeidDelete.md#deleterequest) request)
Delete the coffee identified by the given id, (delete without request body) | - -## Method Detail - -### delete -public [FakedeletecoffeeidDeleteResponses.EndpointResponse](../../paths/fakedeletecoffeeid/delete/FakedeletecoffeeidDeleteResponses.md#endpointresponse) delete([FakedeletecoffeeidDelete.DeleteRequest](../../paths/fakedeletecoffeeid/FakedeletecoffeeidDelete.md#deleterequest) request) - -Delete the coffee identified by the given id, (delete without request body) - -**Parameters:**
-request - the input request - -**Returns:**
-the deserialized response - -**Throws:**
-IOException, InterruptedException - an exception happened when making the request
-ValidationException - the returned response body or header values do not conform the the schema validation requirements
-NotImplementedException - the request body serialization or deserialization has not yet been implemented
- or the header content type deserialization has not yet been implemented for this contentType
-ApiException - server returned a response/contentType not defined in the openapi document
- -#### 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.FakedeletecoffeeidDeletePathParameters; -import org.openapijsonschematools.client.servers.RootServer0; -import org.openapijsonschematools.client.servers.RootServer1; -import org.openapijsonschematools.client.servers.RootServer2; -import org.openapijsonschematools.client.paths.fakedeletecoffeeid.delete.responses.FakedeletecoffeeidDeleteCode200Response; -import org.openapijsonschematools.client.paths.fakedeletecoffeeid.delete.responses.FakedeletecoffeeidDeleteCodedefaultResponse; -import org.openapijsonschematools.client.servers.RootServerInfo; -import org.openapijsonschematools.client.apis.paths.Fakedeletecoffeeid; -import org.openapijsonschematools.client.paths.fakedeletecoffeeid.delete.FakedeletecoffeeidDeleteResponses; - -import java.io.IOException; -import java.util.Arrays; -import java.util.List; -import java.util.Map; -import java.util.AbstractMap; - -// if you want to use a server that is not SERVER_0 pass it in here and change the ServerIndex input below -ApiConfiguration.ServerInfo serverInfo = new ApiConfiguration.ServerInfoBuilder() - .rootServerInfo( - new RootServerInfo.RootServerInfoBuilder() - .rootServer0(new RootServer0()) - .build() - ) - .build(); -ApiConfiguration.ServerIndexInfo serverIndexInfo = new ApiConfiguration.ServerIndexInfoBuilder() - .rootServerInfoServerIndex(RootServerInfo.ServerIndex.SERVER_0) - .build(); -Duration timeout = Duration.ofSeconds(1L); -Map> defaultHeaders = Map.of("User-Agent", List.of("OpenAPI-JSON-Schema-Generator/1.0.0/java")); -ApiConfiguration apiConfiguration = new ApiConfiguration( - serverInfo - serverIndexInfo, - timeout, - defaultHeaders -); -SchemaConfiguration schemaConfiguration = new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().build()); -Fakedeletecoffeeid apiClient = new Fakedeletecoffeeid(apiConfiguration, schemaConfiguration); - - -// Map validation -FakedeletecoffeeidDeletePathParameters.PathParametersMap pathParameters = - FakedeletecoffeeidDeletePathParameters.FakedeletecoffeeidDeletePathParameters1.validate( - new FakedeletecoffeeidDeletePathParameters.PathParametersMapBuilder() - .id("a") - - .build(), - schemaConfiguration -); - -var request = new FakedeletecoffeeidDelete.DeleteRequestBuilder() - .pathParameters(pathParameters) - .build(); - -FakedeletecoffeeidDeleteResponses.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 FakedeletecoffeeidDeleteResponses.EndpointFakedeletecoffeeidDeleteCode200Response castResponse) { -} else { - FakedeletecoffeeidDeleteResponses.EndpointFakedeletecoffeeidDeleteCodedefaultResponse castResponse = (FakedeletecoffeeidDeleteResponses.EndpointFakedeletecoffeeidDeleteCodedefaultResponse) response; -} -``` -[[Back to top]](#top) [[Back to README]](../../../README.md) diff --git a/samples/client/petstore/kotlin/docs/apis/paths/Fakehealth.md b/samples/client/petstore/kotlin/docs/apis/paths/Fakehealth.md deleted file mode 100644 index c477de9e166..00000000000 --- a/samples/client/petstore/kotlin/docs/apis/paths/Fakehealth.md +++ /dev/null @@ -1,103 +0,0 @@ -# Fakehealth - -public class Fakehealth extends extends ApiClient implements -[FakehealthGet.GetOperation](../../paths/fakehealth/FakehealthGet.md#getoperation) - -an api client class which contains all the routes for path="/fake/health" - -## Method Summary -| Modifier and Type | Method and Description | -| ----------------- | ---------------------- | -| [FakehealthGetResponses.EndpointResponse](../../paths/fakehealth/get/FakehealthGetResponses.md#endpointresponse) | [get](#get)([FakehealthGet.GetRequest](../../paths/fakehealth/FakehealthGet.md#getrequest) request) | - -## Method Detail - -### get -public [FakehealthGetResponses.EndpointResponse](../../paths/fakehealth/get/FakehealthGetResponses.md#endpointresponse) get([FakehealthGet.GetRequest](../../paths/fakehealth/FakehealthGet.md#getrequest) request) - -**Parameters:**
-request - the input request - -**Returns:**
-the deserialized response - -**Throws:**
-IOException, InterruptedException - an exception happened when making the request
-ValidationException - the returned response body or header values do not conform the the schema validation requirements
-NotImplementedException - the request body serialization or deserialization has not yet been implemented
- or the header content type deserialization has not yet been implemented for this contentType
-ApiException - server returned a response/contentType not defined in the openapi document
- -#### 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.servers.RootServer0; -import org.openapijsonschematools.client.servers.RootServer1; -import org.openapijsonschematools.client.servers.RootServer2; -import org.openapijsonschematools.client.paths.fakehealth.get.responses.FakehealthGetCode200Response; -import org.openapijsonschematools.client.servers.RootServerInfo; -import org.openapijsonschematools.client.apis.paths.Fakehealth; -import org.openapijsonschematools.client.paths.fakehealth.get.FakehealthGetResponses; - -import java.io.IOException; -import java.util.Arrays; -import java.util.List; -import java.util.Map; -import java.util.AbstractMap; - -// if you want to use a server that is not SERVER_0 pass it in here and change the ServerIndex input below -ApiConfiguration.ServerInfo serverInfo = new ApiConfiguration.ServerInfoBuilder() - .rootServerInfo( - new RootServerInfo.RootServerInfoBuilder() - .rootServer0(new RootServer0()) - .build() - ) - .build(); -ApiConfiguration.ServerIndexInfo serverIndexInfo = new ApiConfiguration.ServerIndexInfoBuilder() - .rootServerInfoServerIndex(RootServerInfo.ServerIndex.SERVER_0) - .build(); -Duration timeout = Duration.ofSeconds(1L); -Map> defaultHeaders = Map.of("User-Agent", List.of("OpenAPI-JSON-Schema-Generator/1.0.0/java")); -ApiConfiguration apiConfiguration = new ApiConfiguration( - serverInfo - serverIndexInfo, - timeout, - defaultHeaders -); -SchemaConfiguration schemaConfiguration = new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().build()); -Fakehealth apiClient = new Fakehealth(apiConfiguration, schemaConfiguration); - - -var request = new FakehealthGet.GetRequestBuilder().build(); - -FakehealthGetResponses.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; -} -FakehealthGetResponses.EndpointFakehealthGetCode200Response castResponse = (FakehealthGetResponses.EndpointFakehealthGetCode200Response) response; -FakehealthGetCode200Response.ApplicationjsonResponseBody deserializedBody = (FakehealthGetCode200Response.ApplicationjsonResponseBody) castResponse.body; -// handle deserialized body here -``` -[[Back to top]](#top) [[Back to README]](../../../README.md) diff --git a/samples/client/petstore/kotlin/docs/apis/paths/Fakeinlineadditionalproperties.md b/samples/client/petstore/kotlin/docs/apis/paths/Fakeinlineadditionalproperties.md deleted file mode 100644 index 4cbe6ceeb28..00000000000 --- a/samples/client/petstore/kotlin/docs/apis/paths/Fakeinlineadditionalproperties.md +++ /dev/null @@ -1,117 +0,0 @@ -# Fakeinlineadditionalproperties - -public class Fakeinlineadditionalproperties extends extends ApiClient implements -[FakeinlineadditionalpropertiesPost.PostOperation](../../paths/fakeinlineadditionalproperties/FakeinlineadditionalpropertiesPost.md#postoperation) - -an api client class which contains all the routes for path="/fake/inline-additionalProperties" - -## Method Summary -| Modifier and Type | Method and Description | -| ----------------- | ---------------------- | -| [FakeinlineadditionalpropertiesPostResponses.EndpointResponse](../../paths/fakeinlineadditionalproperties/post/FakeinlineadditionalpropertiesPostResponses.md#endpointresponse) | [post](#post)([FakeinlineadditionalpropertiesPost.PostRequest](../../paths/fakeinlineadditionalproperties/FakeinlineadditionalpropertiesPost.md#postrequest) request)
| - -## Method Detail - -### post -public [FakeinlineadditionalpropertiesPostResponses.EndpointResponse](../../paths/fakeinlineadditionalproperties/post/FakeinlineadditionalpropertiesPostResponses.md#endpointresponse) post([FakeinlineadditionalpropertiesPost.PostRequest](../../paths/fakeinlineadditionalproperties/FakeinlineadditionalpropertiesPost.md#postrequest) request) - - - -**Parameters:**
-request - the input request - -**Returns:**
-the deserialized response - -**Throws:**
-IOException, InterruptedException - an exception happened when making the request
-ValidationException - the returned response body or header values do not conform the the schema validation requirements
-NotImplementedException - the request body serialization or deserialization has not yet been implemented
- or the header content type deserialization has not yet been implemented for this contentType
-ApiException - server returned a response/contentType not defined in the openapi document
- -#### 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.fakeinlineadditionalproperties.post.FakeinlineadditionalpropertiesPostRequestBody; -import org.openapijsonschematools.client.paths.fakeinlineadditionalproperties.post.requestbody.content.applicationjson.ApplicationjsonSchema; -import org.openapijsonschematools.client.servers.RootServer0; -import org.openapijsonschematools.client.servers.RootServer1; -import org.openapijsonschematools.client.servers.RootServer2; -import org.openapijsonschematools.client.paths.fakeinlineadditionalproperties.post.responses.FakeinlineadditionalpropertiesPostCode200Response; -import org.openapijsonschematools.client.servers.RootServerInfo; -import org.openapijsonschematools.client.apis.paths.Fakeinlineadditionalproperties; -import org.openapijsonschematools.client.paths.fakeinlineadditionalproperties.post.FakeinlineadditionalpropertiesPostResponses; - -import java.io.IOException; -import java.util.Arrays; -import java.util.List; -import java.util.Map; -import java.util.AbstractMap; - -// if you want to use a server that is not SERVER_0 pass it in here and change the ServerIndex input below -ApiConfiguration.ServerInfo serverInfo = new ApiConfiguration.ServerInfoBuilder() - .rootServerInfo( - new RootServerInfo.RootServerInfoBuilder() - .rootServer0(new RootServer0()) - .build() - ) - .build(); -ApiConfiguration.ServerIndexInfo serverIndexInfo = new ApiConfiguration.ServerIndexInfoBuilder() - .rootServerInfoServerIndex(RootServerInfo.ServerIndex.SERVER_0) - .build(); -Duration timeout = Duration.ofSeconds(1L); -Map> defaultHeaders = Map.of("User-Agent", List.of("OpenAPI-JSON-Schema-Generator/1.0.0/java")); -ApiConfiguration apiConfiguration = new ApiConfiguration( - serverInfo - serverIndexInfo, - timeout, - defaultHeaders -); -SchemaConfiguration schemaConfiguration = new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().build()); -Fakeinlineadditionalproperties apiClient = new Fakeinlineadditionalproperties(apiConfiguration, schemaConfiguration); - - -ApplicationjsonSchema1BoxedMap requestBodyPayload = - ApplicationjsonSchema.ApplicationjsonSchema1.validateAndBox( - new ApplicationjsonSchema.ApplicationjsonSchemaMapBuilder() - .additionalProperty("someAdditionalProperty", "a") - - .build(), - schemaConfiguration -); -FakeinlineadditionalpropertiesPost.SealedRequestBody requestBody = new FakeinlineadditionalpropertiesPost.ApplicationjsonRequestBody(requestBodyPayload); - -var request = new FakeinlineadditionalpropertiesPost.PostRequestBuilder() - .requestBody(requestBody) - .build(); - -FakeinlineadditionalpropertiesPostResponses.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; -} -FakeinlineadditionalpropertiesPostResponses.EndpointFakeinlineadditionalpropertiesPostCode200Response castResponse = (FakeinlineadditionalpropertiesPostResponses.EndpointFakeinlineadditionalpropertiesPostCode200Response) response; -``` -[[Back to top]](#top) [[Back to README]](../../../README.md) diff --git a/samples/client/petstore/kotlin/docs/apis/paths/Fakeinlinecomposition.md b/samples/client/petstore/kotlin/docs/apis/paths/Fakeinlinecomposition.md deleted file mode 100644 index fe11f7b38aa..00000000000 --- a/samples/client/petstore/kotlin/docs/apis/paths/Fakeinlinecomposition.md +++ /dev/null @@ -1,112 +0,0 @@ -# Fakeinlinecomposition - -public class Fakeinlinecomposition extends extends ApiClient implements -[FakeinlinecompositionPost.PostOperation](../../paths/fakeinlinecomposition/FakeinlinecompositionPost.md#postoperation) - -an api client class which contains all the routes for path="/fake/inlineComposition/" - -## Method Summary -| Modifier and Type | Method and Description | -| ----------------- | ---------------------- | -| [FakeinlinecompositionPostResponses.EndpointResponse](../../paths/fakeinlinecomposition/post/FakeinlinecompositionPostResponses.md#endpointresponse) | [post](#post)([FakeinlinecompositionPost.PostRequest](../../paths/fakeinlinecomposition/FakeinlinecompositionPost.md#postrequest) request)
composed schemas at inline locations + multiple requestBody content types | - -## Method Detail - -### post -public [FakeinlinecompositionPostResponses.EndpointResponse](../../paths/fakeinlinecomposition/post/FakeinlinecompositionPostResponses.md#endpointresponse) post([FakeinlinecompositionPost.PostRequest](../../paths/fakeinlinecomposition/FakeinlinecompositionPost.md#postrequest) request) - -composed schemas at inline locations + multiple requestBody content types - -**Parameters:**
-request - the input request - -**Returns:**
-the deserialized response - -**Throws:**
-IOException, InterruptedException - an exception happened when making the request
-ValidationException - the returned response body or header values do not conform the the schema validation requirements
-NotImplementedException - the request body serialization or deserialization has not yet been implemented
- or the header content type deserialization has not yet been implemented for this contentType
-ApiException - server returned a response/contentType not defined in the openapi document
- -#### 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.FakeinlinecompositionPostRequestBody; -import org.openapijsonschematools.client.paths.fakeinlinecomposition.post.requestbody.content.applicationjson.ApplicationjsonSchema; -import org.openapijsonschematools.client.paths.fakeinlinecomposition.post.FakeinlinecompositionPostQueryParameters; -import org.openapijsonschematools.client.RootServerInfo; -import org.openapijsonschematools.client.servers.RootServer0; -import org.openapijsonschematools.client.servers.RootServer1; -import org.openapijsonschematools.client.servers.RootServer2; -import org.openapijsonschematools.client.paths.fakeinlinecomposition.post.responses.FakeinlinecompositionPostCode200Response; -import org.openapijsonschematools.client.servers.RootServerInfo; -import org.openapijsonschematools.client.apis.paths.Fakeinlinecomposition; -import org.openapijsonschematools.client.paths.fakeinlinecomposition.post.FakeinlinecompositionPostResponses; - -import java.io.IOException; -import java.util.Arrays; -import java.util.List; -import java.util.Map; -import java.util.AbstractMap; - -// if you want to use a server that is not SERVER_0 pass it in here and change the ServerIndex input below -ApiConfiguration.ServerInfo serverInfo = new ApiConfiguration.ServerInfoBuilder() - .rootServerInfo( - new RootServerInfo.RootServerInfoBuilder() - .rootServer0(new RootServer0()) - .build() - ) - .build(); -ApiConfiguration.ServerIndexInfo serverIndexInfo = new ApiConfiguration.ServerIndexInfoBuilder() - .rootServerInfoServerIndex(RootServerInfo.ServerIndex.SERVER_0) - .build(); -Duration timeout = Duration.ofSeconds(1L); -Map> defaultHeaders = Map.of("User-Agent", List.of("OpenAPI-JSON-Schema-Generator/1.0.0/java")); -ApiConfiguration apiConfiguration = new ApiConfiguration( - serverInfo - serverIndexInfo, - timeout, - defaultHeaders -); -SchemaConfiguration schemaConfiguration = new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().build()); -Fakeinlinecomposition apiClient = new Fakeinlinecomposition(apiConfiguration, schemaConfiguration); - - -var request = new FakeinlinecompositionPost.PostRequestBuilder().build(); - -FakeinlinecompositionPostResponses.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; -} -FakeinlinecompositionPostResponses.EndpointFakeinlinecompositionPostCode200Response castResponse = (FakeinlinecompositionPostResponses.EndpointFakeinlinecompositionPostCode200Response) response; -if (castResponse.body instanceof FakeinlinecompositionPostCode200Response.ApplicationjsonResponseBody deserializedBody) { - // handle deserialized body here -} else { - FakeinlinecompositionPostCode200Response.MultipartformdataResponseBody deserializedBody = (FakeinlinecompositionPostCode200Response.MultipartformdataResponseBody) castResponse.body; - // handle deserialized body here -} -``` -[[Back to top]](#top) [[Back to README]](../../../README.md) diff --git a/samples/client/petstore/kotlin/docs/apis/paths/Fakejsonformdata.md b/samples/client/petstore/kotlin/docs/apis/paths/Fakejsonformdata.md deleted file mode 100644 index d39ea3d3fdb..00000000000 --- a/samples/client/petstore/kotlin/docs/apis/paths/Fakejsonformdata.md +++ /dev/null @@ -1,105 +0,0 @@ -# Fakejsonformdata - -public class Fakejsonformdata extends extends ApiClient implements -[FakejsonformdataGet.GetOperation](../../paths/fakejsonformdata/FakejsonformdataGet.md#getoperation) - -an api client class which contains all the routes for path="/fake/jsonFormData" - -## Method Summary -| Modifier and Type | Method and Description | -| ----------------- | ---------------------- | -| [FakejsonformdataGetResponses.EndpointResponse](../../paths/fakejsonformdata/get/FakejsonformdataGetResponses.md#endpointresponse) | [get](#get)([FakejsonformdataGet.GetRequest](../../paths/fakejsonformdata/FakejsonformdataGet.md#getrequest) request)
| - -## Method Detail - -### get -public [FakejsonformdataGetResponses.EndpointResponse](../../paths/fakejsonformdata/get/FakejsonformdataGetResponses.md#endpointresponse) get([FakejsonformdataGet.GetRequest](../../paths/fakejsonformdata/FakejsonformdataGet.md#getrequest) request) - - - -**Parameters:**
-request - the input request - -**Returns:**
-the deserialized response - -**Throws:**
-IOException, InterruptedException - an exception happened when making the request
-ValidationException - the returned response body or header values do not conform the the schema validation requirements
-NotImplementedException - the request body serialization or deserialization has not yet been implemented
- or the header content type deserialization has not yet been implemented for this contentType
-ApiException - server returned a response/contentType not defined in the openapi document
- -#### 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.fakejsonformdata.get.FakejsonformdataGetRequestBody; -import org.openapijsonschematools.client.paths.fakejsonformdata.get.requestbody.content.applicationxwwwformurlencoded.ApplicationxwwwformurlencodedSchema; -import org.openapijsonschematools.client.RootServerInfo; -import org.openapijsonschematools.client.servers.RootServer0; -import org.openapijsonschematools.client.servers.RootServer1; -import org.openapijsonschematools.client.servers.RootServer2; -import org.openapijsonschematools.client.paths.fakejsonformdata.get.responses.FakejsonformdataGetCode200Response; -import org.openapijsonschematools.client.servers.RootServerInfo; -import org.openapijsonschematools.client.apis.paths.Fakejsonformdata; -import org.openapijsonschematools.client.paths.fakejsonformdata.get.FakejsonformdataGetResponses; - -import java.io.IOException; -import java.util.Arrays; -import java.util.List; -import java.util.Map; -import java.util.AbstractMap; - -// if you want to use a server that is not SERVER_0 pass it in here and change the ServerIndex input below -ApiConfiguration.ServerInfo serverInfo = new ApiConfiguration.ServerInfoBuilder() - .rootServerInfo( - new RootServerInfo.RootServerInfoBuilder() - .rootServer0(new RootServer0()) - .build() - ) - .build(); -ApiConfiguration.ServerIndexInfo serverIndexInfo = new ApiConfiguration.ServerIndexInfoBuilder() - .rootServerInfoServerIndex(RootServerInfo.ServerIndex.SERVER_0) - .build(); -Duration timeout = Duration.ofSeconds(1L); -Map> defaultHeaders = Map.of("User-Agent", List.of("OpenAPI-JSON-Schema-Generator/1.0.0/java")); -ApiConfiguration apiConfiguration = new ApiConfiguration( - serverInfo - serverIndexInfo, - timeout, - defaultHeaders -); -SchemaConfiguration schemaConfiguration = new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().build()); -Fakejsonformdata apiClient = new Fakejsonformdata(apiConfiguration, schemaConfiguration); - - -var request = new FakejsonformdataGet.GetRequestBuilder().build(); - -FakejsonformdataGetResponses.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; -} -FakejsonformdataGetResponses.EndpointFakejsonformdataGetCode200Response castResponse = (FakejsonformdataGetResponses.EndpointFakejsonformdataGetCode200Response) response; -``` -[[Back to top]](#top) [[Back to README]](../../../README.md) diff --git a/samples/client/petstore/kotlin/docs/apis/paths/Fakejsonpatch.md b/samples/client/petstore/kotlin/docs/apis/paths/Fakejsonpatch.md deleted file mode 100644 index 11c9c8955d8..00000000000 --- a/samples/client/petstore/kotlin/docs/apis/paths/Fakejsonpatch.md +++ /dev/null @@ -1,105 +0,0 @@ -# Fakejsonpatch - -public class Fakejsonpatch extends extends ApiClient implements -[FakejsonpatchPatch.PatchOperation](../../paths/fakejsonpatch/FakejsonpatchPatch.md#patchoperation) - -an api client class which contains all the routes for path="/fake/jsonPatch" - -## Method Summary -| Modifier and Type | Method and Description | -| ----------------- | ---------------------- | -| [FakejsonpatchPatchResponses.EndpointResponse](../../paths/fakejsonpatch/patch/FakejsonpatchPatchResponses.md#endpointresponse) | [patch](#patch)([FakejsonpatchPatch.PatchRequest](../../paths/fakejsonpatch/FakejsonpatchPatch.md#patchrequest) request)
json patch route with a requestBody | - -## Method Detail - -### patch -public [FakejsonpatchPatchResponses.EndpointResponse](../../paths/fakejsonpatch/patch/FakejsonpatchPatchResponses.md#endpointresponse) patch([FakejsonpatchPatch.PatchRequest](../../paths/fakejsonpatch/FakejsonpatchPatch.md#patchrequest) request) - -json patch route with a requestBody - -**Parameters:**
-request - the input request - -**Returns:**
-the deserialized response - -**Throws:**
-IOException, InterruptedException - an exception happened when making the request
-ValidationException - the returned response body or header values do not conform the the schema validation requirements
-NotImplementedException - the request body serialization or deserialization has not yet been implemented
- or the header content type deserialization has not yet been implemented for this contentType
-ApiException - server returned a response/contentType not defined in the openapi document
- -#### 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.FakejsonpatchPatchRequestBody; -import org.openapijsonschematools.client.components.schemas.JSONPatchRequest; -import org.openapijsonschematools.client.RootServerInfo; -import org.openapijsonschematools.client.servers.RootServer0; -import org.openapijsonschematools.client.servers.RootServer1; -import org.openapijsonschematools.client.servers.RootServer2; -import org.openapijsonschematools.client.paths.fakejsonpatch.patch.responses.FakejsonpatchPatchCode200Response; -import org.openapijsonschematools.client.servers.RootServerInfo; -import org.openapijsonschematools.client.apis.paths.Fakejsonpatch; -import org.openapijsonschematools.client.paths.fakejsonpatch.patch.FakejsonpatchPatchResponses; - -import java.io.IOException; -import java.util.Arrays; -import java.util.List; -import java.util.Map; -import java.util.AbstractMap; - -// if you want to use a server that is not SERVER_0 pass it in here and change the ServerIndex input below -ApiConfiguration.ServerInfo serverInfo = new ApiConfiguration.ServerInfoBuilder() - .rootServerInfo( - new RootServerInfo.RootServerInfoBuilder() - .rootServer0(new RootServer0()) - .build() - ) - .build(); -ApiConfiguration.ServerIndexInfo serverIndexInfo = new ApiConfiguration.ServerIndexInfoBuilder() - .rootServerInfoServerIndex(RootServerInfo.ServerIndex.SERVER_0) - .build(); -Duration timeout = Duration.ofSeconds(1L); -Map> defaultHeaders = Map.of("User-Agent", List.of("OpenAPI-JSON-Schema-Generator/1.0.0/java")); -ApiConfiguration apiConfiguration = new ApiConfiguration( - serverInfo - serverIndexInfo, - timeout, - defaultHeaders -); -SchemaConfiguration schemaConfiguration = new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().build()); -Fakejsonpatch apiClient = new Fakejsonpatch(apiConfiguration, schemaConfiguration); - - -var request = new FakejsonpatchPatch.PatchRequestBuilder().build(); - -FakejsonpatchPatchResponses.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; -} -FakejsonpatchPatchResponses.EndpointFakejsonpatchPatchCode200Response castResponse = (FakejsonpatchPatchResponses.EndpointFakejsonpatchPatchCode200Response) response; -``` -[[Back to top]](#top) [[Back to README]](../../../README.md) diff --git a/samples/client/petstore/kotlin/docs/apis/paths/Fakejsonwithcharset.md b/samples/client/petstore/kotlin/docs/apis/paths/Fakejsonwithcharset.md deleted file mode 100644 index 077bfa360b1..00000000000 --- a/samples/client/petstore/kotlin/docs/apis/paths/Fakejsonwithcharset.md +++ /dev/null @@ -1,105 +0,0 @@ -# Fakejsonwithcharset - -public class Fakejsonwithcharset extends extends ApiClient implements -[FakejsonwithcharsetPost.PostOperation](../../paths/fakejsonwithcharset/FakejsonwithcharsetPost.md#postoperation) - -an api client class which contains all the routes for path="/fake/jsonWithCharset" - -## Method Summary -| Modifier and Type | Method and Description | -| ----------------- | ---------------------- | -| [FakejsonwithcharsetPostResponses.EndpointResponse](../../paths/fakejsonwithcharset/post/FakejsonwithcharsetPostResponses.md#endpointresponse) | [post](#post)([FakejsonwithcharsetPost.PostRequest](../../paths/fakejsonwithcharset/FakejsonwithcharsetPost.md#postrequest) request) | - -## Method Detail - -### post -public [FakejsonwithcharsetPostResponses.EndpointResponse](../../paths/fakejsonwithcharset/post/FakejsonwithcharsetPostResponses.md#endpointresponse) post([FakejsonwithcharsetPost.PostRequest](../../paths/fakejsonwithcharset/FakejsonwithcharsetPost.md#postrequest) request) - -**Parameters:**
-request - the input request - -**Returns:**
-the deserialized response - -**Throws:**
-IOException, InterruptedException - an exception happened when making the request
-ValidationException - the returned response body or header values do not conform the the schema validation requirements
-NotImplementedException - the request body serialization or deserialization has not yet been implemented
- or the header content type deserialization has not yet been implemented for this contentType
-ApiException - server returned a response/contentType not defined in the openapi document
- -#### 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.FakejsonwithcharsetPostRequestBody; -import org.openapijsonschematools.client.paths.fakejsonwithcharset.post.requestbody.content.applicationjsoncharsetutf8.Applicationjsoncharsetutf8Schema; -import org.openapijsonschematools.client.RootServerInfo; -import org.openapijsonschematools.client.servers.RootServer0; -import org.openapijsonschematools.client.servers.RootServer1; -import org.openapijsonschematools.client.servers.RootServer2; -import org.openapijsonschematools.client.paths.fakejsonwithcharset.post.responses.FakejsonwithcharsetPostCode200Response; -import org.openapijsonschematools.client.servers.RootServerInfo; -import org.openapijsonschematools.client.apis.paths.Fakejsonwithcharset; -import org.openapijsonschematools.client.paths.fakejsonwithcharset.post.FakejsonwithcharsetPostResponses; - -import java.io.IOException; -import java.util.Arrays; -import java.util.List; -import java.util.Map; -import java.util.AbstractMap; - -// if you want to use a server that is not SERVER_0 pass it in here and change the ServerIndex input below -ApiConfiguration.ServerInfo serverInfo = new ApiConfiguration.ServerInfoBuilder() - .rootServerInfo( - new RootServerInfo.RootServerInfoBuilder() - .rootServer0(new RootServer0()) - .build() - ) - .build(); -ApiConfiguration.ServerIndexInfo serverIndexInfo = new ApiConfiguration.ServerIndexInfoBuilder() - .rootServerInfoServerIndex(RootServerInfo.ServerIndex.SERVER_0) - .build(); -Duration timeout = Duration.ofSeconds(1L); -Map> defaultHeaders = Map.of("User-Agent", List.of("OpenAPI-JSON-Schema-Generator/1.0.0/java")); -ApiConfiguration apiConfiguration = new ApiConfiguration( - serverInfo - serverIndexInfo, - timeout, - defaultHeaders -); -SchemaConfiguration schemaConfiguration = new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().build()); -Fakejsonwithcharset apiClient = new Fakejsonwithcharset(apiConfiguration, schemaConfiguration); - - -var request = new FakejsonwithcharsetPost.PostRequestBuilder().build(); - -FakejsonwithcharsetPostResponses.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; -} -FakejsonwithcharsetPostResponses.EndpointFakejsonwithcharsetPostCode200Response castResponse = (FakejsonwithcharsetPostResponses.EndpointFakejsonwithcharsetPostCode200Response) response; -FakejsonwithcharsetPostCode200Response.Applicationjsoncharsetutf8ResponseBody deserializedBody = (FakejsonwithcharsetPostCode200Response.Applicationjsoncharsetutf8ResponseBody) castResponse.body; -// handle deserialized body here -``` -[[Back to top]](#top) [[Back to README]](../../../README.md) diff --git a/samples/client/petstore/kotlin/docs/apis/paths/Fakemultiplerequestbodycontenttypes.md b/samples/client/petstore/kotlin/docs/apis/paths/Fakemultiplerequestbodycontenttypes.md deleted file mode 100644 index f2345495f5a..00000000000 --- a/samples/client/petstore/kotlin/docs/apis/paths/Fakemultiplerequestbodycontenttypes.md +++ /dev/null @@ -1,107 +0,0 @@ -# Fakemultiplerequestbodycontenttypes - -public class Fakemultiplerequestbodycontenttypes extends extends ApiClient implements -[FakemultiplerequestbodycontenttypesPost.PostOperation](../../paths/fakemultiplerequestbodycontenttypes/FakemultiplerequestbodycontenttypesPost.md#postoperation) - -an api client class which contains all the routes for path="/fake/multipleRequestBodyContentTypes/" - -## Method Summary -| Modifier and Type | Method and Description | -| ----------------- | ---------------------- | -| [FakemultiplerequestbodycontenttypesPostResponses.EndpointResponse](../../paths/fakemultiplerequestbodycontenttypes/post/FakemultiplerequestbodycontenttypesPostResponses.md#endpointresponse) | [post](#post)([FakemultiplerequestbodycontenttypesPost.PostRequest](../../paths/fakemultiplerequestbodycontenttypes/FakemultiplerequestbodycontenttypesPost.md#postrequest) request)
composed schemas at inline locations + multiple requestBody content types | - -## Method Detail - -### post -public [FakemultiplerequestbodycontenttypesPostResponses.EndpointResponse](../../paths/fakemultiplerequestbodycontenttypes/post/FakemultiplerequestbodycontenttypesPostResponses.md#endpointresponse) post([FakemultiplerequestbodycontenttypesPost.PostRequest](../../paths/fakemultiplerequestbodycontenttypes/FakemultiplerequestbodycontenttypesPost.md#postrequest) request) - -composed schemas at inline locations + multiple requestBody content types - -**Parameters:**
-request - the input request - -**Returns:**
-the deserialized response - -**Throws:**
-IOException, InterruptedException - an exception happened when making the request
-ValidationException - the returned response body or header values do not conform the the schema validation requirements
-NotImplementedException - the request body serialization or deserialization has not yet been implemented
- or the header content type deserialization has not yet been implemented for this contentType
-ApiException - server returned a response/contentType not defined in the openapi document
- -#### 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.FakemultiplerequestbodycontenttypesPostRequestBody; -import org.openapijsonschematools.client.paths.fakemultiplerequestbodycontenttypes.post.requestbody.content.applicationjson.ApplicationjsonSchema; -import org.openapijsonschematools.client.RootServerInfo; -import org.openapijsonschematools.client.servers.RootServer0; -import org.openapijsonschematools.client.servers.RootServer1; -import org.openapijsonschematools.client.servers.RootServer2; -import org.openapijsonschematools.client.paths.fakemultiplerequestbodycontenttypes.post.responses.FakemultiplerequestbodycontenttypesPostCode200Response; -import org.openapijsonschematools.client.servers.RootServerInfo; -import org.openapijsonschematools.client.apis.paths.Fakemultiplerequestbodycontenttypes; -import org.openapijsonschematools.client.paths.fakemultiplerequestbodycontenttypes.post.FakemultiplerequestbodycontenttypesPostResponses; - -import java.io.IOException; -import java.util.Arrays; -import java.util.List; -import java.util.Map; -import java.util.AbstractMap; - -// if you want to use a server that is not SERVER_0 pass it in here and change the ServerIndex input below -ApiConfiguration.ServerInfo serverInfo = new ApiConfiguration.ServerInfoBuilder() - .rootServerInfo( - new RootServerInfo.RootServerInfoBuilder() - .rootServer0(new RootServer0()) - .build() - ) - .build(); -ApiConfiguration.ServerIndexInfo serverIndexInfo = new ApiConfiguration.ServerIndexInfoBuilder() - .rootServerInfoServerIndex(RootServerInfo.ServerIndex.SERVER_0) - .build(); -Duration timeout = Duration.ofSeconds(1L); -Map> defaultHeaders = Map.of("User-Agent", List.of("OpenAPI-JSON-Schema-Generator/1.0.0/java")); -ApiConfiguration apiConfiguration = new ApiConfiguration( - serverInfo - serverIndexInfo, - timeout, - defaultHeaders -); -SchemaConfiguration schemaConfiguration = new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().build()); -Fakemultiplerequestbodycontenttypes apiClient = new Fakemultiplerequestbodycontenttypes(apiConfiguration, schemaConfiguration); - - -var request = new FakemultiplerequestbodycontenttypesPost.PostRequestBuilder().build(); - -FakemultiplerequestbodycontenttypesPostResponses.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; -} -FakemultiplerequestbodycontenttypesPostResponses.EndpointFakemultiplerequestbodycontenttypesPostCode200Response castResponse = (FakemultiplerequestbodycontenttypesPostResponses.EndpointFakemultiplerequestbodycontenttypesPostCode200Response) response; -FakemultiplerequestbodycontenttypesPostCode200Response.ApplicationjsonResponseBody deserializedBody = (FakemultiplerequestbodycontenttypesPostCode200Response.ApplicationjsonResponseBody) castResponse.body; -// handle deserialized body here -``` -[[Back to top]](#top) [[Back to README]](../../../README.md) diff --git a/samples/client/petstore/kotlin/docs/apis/paths/Fakemultipleresponsebodies.md b/samples/client/petstore/kotlin/docs/apis/paths/Fakemultipleresponsebodies.md deleted file mode 100644 index 8b1bd750cd5..00000000000 --- a/samples/client/petstore/kotlin/docs/apis/paths/Fakemultipleresponsebodies.md +++ /dev/null @@ -1,109 +0,0 @@ -# Fakemultipleresponsebodies - -public class Fakemultipleresponsebodies extends extends ApiClient implements -[FakemultipleresponsebodiesGet.GetOperation](../../paths/fakemultipleresponsebodies/FakemultipleresponsebodiesGet.md#getoperation) - -an api client class which contains all the routes for path="/fake/multipleResponseBodies" - -## Method Summary -| Modifier and Type | Method and Description | -| ----------------- | ---------------------- | -| [FakemultipleresponsebodiesGetResponses.EndpointResponse](../../paths/fakemultipleresponsebodies/get/FakemultipleresponsebodiesGetResponses.md#endpointresponse) | [get](#get)([FakemultipleresponsebodiesGet.GetRequest](../../paths/fakemultipleresponsebodies/FakemultipleresponsebodiesGet.md#getrequest) request) | - -## Method Detail - -### get -public [FakemultipleresponsebodiesGetResponses.EndpointResponse](../../paths/fakemultipleresponsebodies/get/FakemultipleresponsebodiesGetResponses.md#endpointresponse) get([FakemultipleresponsebodiesGet.GetRequest](../../paths/fakemultipleresponsebodies/FakemultipleresponsebodiesGet.md#getrequest) request) - -**Parameters:**
-request - the input request - -**Returns:**
-the deserialized response - -**Throws:**
-IOException, InterruptedException - an exception happened when making the request
-ValidationException - the returned response body or header values do not conform the the schema validation requirements
-NotImplementedException - the request body serialization or deserialization has not yet been implemented
- or the header content type deserialization has not yet been implemented for this contentType
-ApiException - server returned a response/contentType not defined in the openapi document
- -#### 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.servers.RootServer0; -import org.openapijsonschematools.client.servers.RootServer1; -import org.openapijsonschematools.client.servers.RootServer2; -import org.openapijsonschematools.client.paths.fakemultipleresponsebodies.get.responses.FakemultipleresponsebodiesGetCode200Response; -import org.openapijsonschematools.client.paths.fakemultipleresponsebodies.get.responses.FakemultipleresponsebodiesGetCode202Response; -import org.openapijsonschematools.client.servers.RootServerInfo; -import org.openapijsonschematools.client.apis.paths.Fakemultipleresponsebodies; -import org.openapijsonschematools.client.paths.fakemultipleresponsebodies.get.FakemultipleresponsebodiesGetResponses; - -import java.io.IOException; -import java.util.Arrays; -import java.util.List; -import java.util.Map; -import java.util.AbstractMap; - -// if you want to use a server that is not SERVER_0 pass it in here and change the ServerIndex input below -ApiConfiguration.ServerInfo serverInfo = new ApiConfiguration.ServerInfoBuilder() - .rootServerInfo( - new RootServerInfo.RootServerInfoBuilder() - .rootServer0(new RootServer0()) - .build() - ) - .build(); -ApiConfiguration.ServerIndexInfo serverIndexInfo = new ApiConfiguration.ServerIndexInfoBuilder() - .rootServerInfoServerIndex(RootServerInfo.ServerIndex.SERVER_0) - .build(); -Duration timeout = Duration.ofSeconds(1L); -Map> defaultHeaders = Map.of("User-Agent", List.of("OpenAPI-JSON-Schema-Generator/1.0.0/java")); -ApiConfiguration apiConfiguration = new ApiConfiguration( - serverInfo - serverIndexInfo, - timeout, - defaultHeaders -); -SchemaConfiguration schemaConfiguration = new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().build()); -Fakemultipleresponsebodies apiClient = new Fakemultipleresponsebodies(apiConfiguration, schemaConfiguration); - - -var request = new FakemultipleresponsebodiesGet.GetRequestBuilder().build(); - -FakemultipleresponsebodiesGetResponses.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; -} -if (response instanceof FakemultipleresponsebodiesGetResponses.EndpointFakemultipleresponsebodiesGetCode200Response castResponse) { - FakemultipleresponsebodiesGetCode200Response.ApplicationjsonResponseBody deserializedBody = (FakemultipleresponsebodiesGetCode200Response.ApplicationjsonResponseBody) castResponse.body; - // handle deserialized body here -} else { - FakemultipleresponsebodiesGetResponses.EndpointFakemultipleresponsebodiesGetCode202Response castResponse = (FakemultipleresponsebodiesGetResponses.EndpointFakemultipleresponsebodiesGetCode202Response) response; - FakemultipleresponsebodiesGetCode202Response.ApplicationjsonResponseBody deserializedBody = (FakemultipleresponsebodiesGetCode202Response.ApplicationjsonResponseBody) castResponse.body; - // handle deserialized body here -} -``` -[[Back to top]](#top) [[Back to README]](../../../README.md) diff --git a/samples/client/petstore/kotlin/docs/apis/paths/Fakemultiplesecurities.md b/samples/client/petstore/kotlin/docs/apis/paths/Fakemultiplesecurities.md deleted file mode 100644 index 18d875440b9..00000000000 --- a/samples/client/petstore/kotlin/docs/apis/paths/Fakemultiplesecurities.md +++ /dev/null @@ -1,120 +0,0 @@ -# Fakemultiplesecurities - -public class Fakemultiplesecurities extends extends ApiClient implements -[FakemultiplesecuritiesGet.GetOperation](../../paths/fakemultiplesecurities/FakemultiplesecuritiesGet.md#getoperation) - -an api client class which contains all the routes for path="/fake/multipleSecurities" - -## Method Summary -| Modifier and Type | Method and Description | -| ----------------- | ---------------------- | -| [FakemultiplesecuritiesGetResponses.EndpointResponse](../../paths/fakemultiplesecurities/get/FakemultiplesecuritiesGetResponses.md#endpointresponse) | [get](#get)([FakemultiplesecuritiesGet.GetRequest](../../paths/fakemultiplesecurities/FakemultiplesecuritiesGet.md#getrequest) request) | - -## Method Detail - -### get -public [FakemultiplesecuritiesGetResponses.EndpointResponse](../../paths/fakemultiplesecurities/get/FakemultiplesecuritiesGetResponses.md#endpointresponse) get([FakemultiplesecuritiesGet.GetRequest](../../paths/fakemultiplesecurities/FakemultiplesecuritiesGet.md#getrequest) request) - -**Parameters:**
-request - the input request - -**Returns:**
-the deserialized response - -**Throws:**
-IOException, InterruptedException - an exception happened when making the request
-ValidationException - the returned response body or header values do not conform the the schema validation requirements
-NotImplementedException - the request body serialization or deserialization has not yet been implemented
- or the header content type deserialization has not yet been implemented for this contentType
-ApiException - server returned a response/contentType not defined in the openapi document
- -#### 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.fakemultiplesecurities.get.FakemultiplesecuritiesGetSecurityInfo; -import org.openapijsonschematools.client.servers.RootServer0; -import org.openapijsonschematools.client.servers.RootServer1; -import org.openapijsonschematools.client.servers.RootServer2; -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.FakemultiplesecuritiesGetCode200Response; -import org.openapijsonschematools.client.servers.RootServerInfo; -import org.openapijsonschematools.client.apis.paths.Fakemultiplesecurities; -import org.openapijsonschematools.client.paths.fakemultiplesecurities.get.FakemultiplesecuritiesGetResponses; - -import java.io.IOException; -import java.util.Arrays; -import java.util.List; -import java.util.Map; -import java.util.AbstractMap; - -// if you want to use a server that is not SERVER_0 pass it in here and change the ServerIndex input below -ApiConfiguration.ServerInfo serverInfo = new ApiConfiguration.ServerInfoBuilder() - .rootServerInfo( - new RootServerInfo.RootServerInfoBuilder() - .rootServer0(new RootServer0()) - .build() - ) - .build(); -ApiConfiguration.ServerIndexInfo serverIndexInfo = new ApiConfiguration.ServerIndexInfoBuilder() - .rootServerInfoServerIndex(RootServerInfo.ServerIndex.SERVER_0) - .build(); -List securitySchemes = new ArrayList(); -securitySchemes.add( - new HttpBasicTest("someUserId", "somePassword"); -); -securitySchemes.add( - new ApiKey("someApiKey"); -); -ApiConfiguration.SecurityIndexInfo securityIndexInfo = new ApiConfiguration.SecurityIndexInfoBuilder() - .fakemultiplesecuritiesGetSecurityRequirementObject0SecurityIndex(FakemultiplesecuritiesGetSecurityRequirementObject0.SecurityIndex.SECURITY_0) - .build(); -Duration timeout = Duration.ofSeconds(1L); -Map> defaultHeaders = Map.of("User-Agent", List.of("OpenAPI-JSON-Schema-Generator/1.0.0/java")); -ApiConfiguration apiConfiguration = new ApiConfiguration( - serverInfo - serverIndexInfo, - securitySchemes, - securityIndexInfo, - timeout, - defaultHeaders -); -SchemaConfiguration schemaConfiguration = new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().build()); -Fakemultiplesecurities apiClient = new Fakemultiplesecurities(apiConfiguration, schemaConfiguration); - - -var request = new FakemultiplesecuritiesGet.GetRequestBuilder().build(); - -FakemultiplesecuritiesGetResponses.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; -} -FakemultiplesecuritiesGetResponses.EndpointFakemultiplesecuritiesGetCode200Response castResponse = (FakemultiplesecuritiesGetResponses.EndpointFakemultiplesecuritiesGetCode200Response) response; -FakemultiplesecuritiesGetCode200Response.ApplicationjsonResponseBody deserializedBody = (FakemultiplesecuritiesGetCode200Response.ApplicationjsonResponseBody) castResponse.body; -// handle deserialized body here -``` -[[Back to top]](#top) [[Back to README]](../../../README.md) diff --git a/samples/client/petstore/kotlin/docs/apis/paths/Fakeobjinquery.md b/samples/client/petstore/kotlin/docs/apis/paths/Fakeobjinquery.md deleted file mode 100644 index f7af00866a0..00000000000 --- a/samples/client/petstore/kotlin/docs/apis/paths/Fakeobjinquery.md +++ /dev/null @@ -1,102 +0,0 @@ -# Fakeobjinquery - -public class Fakeobjinquery extends extends ApiClient implements -[FakeobjinqueryGet.GetOperation](../../paths/fakeobjinquery/FakeobjinqueryGet.md#getoperation) - -an api client class which contains all the routes for path="/fake/objInQuery" - -## Method Summary -| Modifier and Type | Method and Description | -| ----------------- | ---------------------- | -| [FakeobjinqueryGetResponses.EndpointResponse](../../paths/fakeobjinquery/get/FakeobjinqueryGetResponses.md#endpointresponse) | [get](#get)([FakeobjinqueryGet.GetRequest](../../paths/fakeobjinquery/FakeobjinqueryGet.md#getrequest) request) | - -## Method Detail - -### get -public [FakeobjinqueryGetResponses.EndpointResponse](../../paths/fakeobjinquery/get/FakeobjinqueryGetResponses.md#endpointresponse) get([FakeobjinqueryGet.GetRequest](../../paths/fakeobjinquery/FakeobjinqueryGet.md#getrequest) request) - -**Parameters:**
-request - the input request - -**Returns:**
-the deserialized response - -**Throws:**
-IOException, InterruptedException - an exception happened when making the request
-ValidationException - the returned response body or header values do not conform the the schema validation requirements
-NotImplementedException - the request body serialization or deserialization has not yet been implemented
- or the header content type deserialization has not yet been implemented for this contentType
-ApiException - server returned a response/contentType not defined in the openapi document
- -#### 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.fakeobjinquery.get.FakeobjinqueryGetQueryParameters; -import org.openapijsonschematools.client.RootServerInfo; -import org.openapijsonschematools.client.servers.RootServer0; -import org.openapijsonschematools.client.servers.RootServer1; -import org.openapijsonschematools.client.servers.RootServer2; -import org.openapijsonschematools.client.paths.fakeobjinquery.get.responses.FakeobjinqueryGetCode200Response; -import org.openapijsonschematools.client.servers.RootServerInfo; -import org.openapijsonschematools.client.apis.paths.Fakeobjinquery; -import org.openapijsonschematools.client.paths.fakeobjinquery.get.FakeobjinqueryGetResponses; - -import java.io.IOException; -import java.util.Arrays; -import java.util.List; -import java.util.Map; -import java.util.AbstractMap; - -// if you want to use a server that is not SERVER_0 pass it in here and change the ServerIndex input below -ApiConfiguration.ServerInfo serverInfo = new ApiConfiguration.ServerInfoBuilder() - .rootServerInfo( - new RootServerInfo.RootServerInfoBuilder() - .rootServer0(new RootServer0()) - .build() - ) - .build(); -ApiConfiguration.ServerIndexInfo serverIndexInfo = new ApiConfiguration.ServerIndexInfoBuilder() - .rootServerInfoServerIndex(RootServerInfo.ServerIndex.SERVER_0) - .build(); -Duration timeout = Duration.ofSeconds(1L); -Map> defaultHeaders = Map.of("User-Agent", List.of("OpenAPI-JSON-Schema-Generator/1.0.0/java")); -ApiConfiguration apiConfiguration = new ApiConfiguration( - serverInfo - serverIndexInfo, - timeout, - defaultHeaders -); -SchemaConfiguration schemaConfiguration = new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().build()); -Fakeobjinquery apiClient = new Fakeobjinquery(apiConfiguration, schemaConfiguration); - - -var request = new FakeobjinqueryGet.GetRequestBuilder().build(); - -FakeobjinqueryGetResponses.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; -} -FakeobjinqueryGetResponses.EndpointFakeobjinqueryGetCode200Response castResponse = (FakeobjinqueryGetResponses.EndpointFakeobjinqueryGetCode200Response) response; -``` -[[Back to top]](#top) [[Back to README]](../../../README.md) diff --git a/samples/client/petstore/kotlin/docs/apis/paths/Fakeparametercollisions1ababselfab.md b/samples/client/petstore/kotlin/docs/apis/paths/Fakeparametercollisions1ababselfab.md deleted file mode 100644 index bc2267b7934..00000000000 --- a/samples/client/petstore/kotlin/docs/apis/paths/Fakeparametercollisions1ababselfab.md +++ /dev/null @@ -1,128 +0,0 @@ -# Fakeparametercollisions1ababselfab - -public class Fakeparametercollisions1ababselfab extends extends ApiClient implements -[Fakeparametercollisions1ababselfabPost.PostOperation](../../paths/fakeparametercollisions1ababselfab/Fakeparametercollisions1ababselfabPost.md#postoperation) - -an api client class which contains all the routes for path="/fake/parameterCollisions/{1}/{aB}/{Ab}/{self}/{A-B}/" - -## Method Summary -| Modifier and Type | Method and Description | -| ----------------- | ---------------------- | -| [Fakeparametercollisions1ababselfabPostResponses.EndpointResponse](../../paths/fakeparametercollisions1ababselfab/post/Fakeparametercollisions1ababselfabPostResponses.md#endpointresponse) | [post](#post)([Fakeparametercollisions1ababselfabPost.PostRequest](../../paths/fakeparametercollisions1ababselfab/Fakeparametercollisions1ababselfabPost.md#postrequest) request) | - -## Method Detail - -### post -public [Fakeparametercollisions1ababselfabPostResponses.EndpointResponse](../../paths/fakeparametercollisions1ababselfab/post/Fakeparametercollisions1ababselfabPostResponses.md#endpointresponse) post([Fakeparametercollisions1ababselfabPost.PostRequest](../../paths/fakeparametercollisions1ababselfab/Fakeparametercollisions1ababselfabPost.md#postrequest) request) - -**Parameters:**
-request - the input request - -**Returns:**
-the deserialized response - -**Throws:**
-IOException, InterruptedException - an exception happened when making the request
-ValidationException - the returned response body or header values do not conform the the schema validation requirements
-NotImplementedException - the request body serialization or deserialization has not yet been implemented
- or the header content type deserialization has not yet been implemented for this contentType
-ApiException - server returned a response/contentType not defined in the openapi document
- -#### 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.fakeparametercollisions1ababselfab.post.Fakeparametercollisions1ababselfabPostRequestBody; -import org.openapijsonschematools.client.paths.fakeparametercollisions1ababselfab.post.Fakeparametercollisions1ababselfabPostHeaderParameters; -import org.openapijsonschematools.client.paths.fakeparametercollisions1ababselfab.post.Fakeparametercollisions1ababselfabPostQueryParameters; -import org.openapijsonschematools.client.paths.fakeparametercollisions1ababselfab.post.Fakeparametercollisions1ababselfabPostCookieParameters; -import org.openapijsonschematools.client.RootServerInfo; -import org.openapijsonschematools.client.paths.fakeparametercollisions1ababselfab.post.Fakeparametercollisions1ababselfabPostPathParameters; -import org.openapijsonschematools.client.servers.RootServer0; -import org.openapijsonschematools.client.servers.RootServer1; -import org.openapijsonschematools.client.servers.RootServer2; -import org.openapijsonschematools.client.paths.fakeparametercollisions1ababselfab.post.responses.Fakeparametercollisions1ababselfabPostCode200Response; -import org.openapijsonschematools.client.servers.RootServerInfo; -import org.openapijsonschematools.client.apis.paths.Fakeparametercollisions1ababselfab; -import org.openapijsonschematools.client.paths.fakeparametercollisions1ababselfab.post.Fakeparametercollisions1ababselfabPostResponses; - -import java.io.IOException; -import java.util.Arrays; -import java.util.List; -import java.util.Map; -import java.util.AbstractMap; - -// if you want to use a server that is not SERVER_0 pass it in here and change the ServerIndex input below -ApiConfiguration.ServerInfo serverInfo = new ApiConfiguration.ServerInfoBuilder() - .rootServerInfo( - new RootServerInfo.RootServerInfoBuilder() - .rootServer0(new RootServer0()) - .build() - ) - .build(); -ApiConfiguration.ServerIndexInfo serverIndexInfo = new ApiConfiguration.ServerIndexInfoBuilder() - .rootServerInfoServerIndex(RootServerInfo.ServerIndex.SERVER_0) - .build(); -Duration timeout = Duration.ofSeconds(1L); -Map> defaultHeaders = Map.of("User-Agent", List.of("OpenAPI-JSON-Schema-Generator/1.0.0/java")); -ApiConfiguration apiConfiguration = new ApiConfiguration( - serverInfo - serverIndexInfo, - timeout, - defaultHeaders -); -SchemaConfiguration schemaConfiguration = new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().build()); -Fakeparametercollisions1ababselfab apiClient = new Fakeparametercollisions1ababselfab(apiConfiguration, schemaConfiguration); - - -// Map validation -Fakeparametercollisions1ababselfabPostPathParameters.PathParametersMap pathParameters = - Fakeparametercollisions1ababselfabPostPathParameters.Fakeparametercollisions1ababselfabPostPathParameters1.validate( - new Fakeparametercollisions1ababselfabPostPathParameters.PathParametersMapBuilder() - .positive1("a") - - .aHyphenMinusB("a") - - .Ab("a") - - .aB("a") - - .self("a") - - .build(), - schemaConfiguration -); - -var request = new Fakeparametercollisions1ababselfabPost.PostRequestBuilder() - .pathParameters(pathParameters) - .build(); - -Fakeparametercollisions1ababselfabPostResponses.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; -} -Fakeparametercollisions1ababselfabPostResponses.EndpointFakeparametercollisions1ababselfabPostCode200Response castResponse = (Fakeparametercollisions1ababselfabPostResponses.EndpointFakeparametercollisions1ababselfabPostCode200Response) response; -Fakeparametercollisions1ababselfabPostCode200Response.ApplicationjsonResponseBody deserializedBody = (Fakeparametercollisions1ababselfabPostCode200Response.ApplicationjsonResponseBody) castResponse.body; -// handle deserialized body here -``` -[[Back to top]](#top) [[Back to README]](../../../README.md) diff --git a/samples/client/petstore/kotlin/docs/apis/paths/Fakepemcontenttype.md b/samples/client/petstore/kotlin/docs/apis/paths/Fakepemcontenttype.md deleted file mode 100644 index b71cd83b0f0..00000000000 --- a/samples/client/petstore/kotlin/docs/apis/paths/Fakepemcontenttype.md +++ /dev/null @@ -1,105 +0,0 @@ -# Fakepemcontenttype - -public class Fakepemcontenttype extends extends ApiClient implements -[FakepemcontenttypeGet.GetOperation](../../paths/fakepemcontenttype/FakepemcontenttypeGet.md#getoperation) - -an api client class which contains all the routes for path="/fake/pemContentType" - -## Method Summary -| Modifier and Type | Method and Description | -| ----------------- | ---------------------- | -| [FakepemcontenttypeGetResponses.EndpointResponse](../../paths/fakepemcontenttype/get/FakepemcontenttypeGetResponses.md#endpointresponse) | [get](#get)([FakepemcontenttypeGet.GetRequest](../../paths/fakepemcontenttype/FakepemcontenttypeGet.md#getrequest) request) | - -## Method Detail - -### get -public [FakepemcontenttypeGetResponses.EndpointResponse](../../paths/fakepemcontenttype/get/FakepemcontenttypeGetResponses.md#endpointresponse) get([FakepemcontenttypeGet.GetRequest](../../paths/fakepemcontenttype/FakepemcontenttypeGet.md#getrequest) request) - -**Parameters:**
-request - the input request - -**Returns:**
-the deserialized response - -**Throws:**
-IOException, InterruptedException - an exception happened when making the request
-ValidationException - the returned response body or header values do not conform the the schema validation requirements
-NotImplementedException - the request body serialization or deserialization has not yet been implemented
- or the header content type deserialization has not yet been implemented for this contentType
-ApiException - server returned a response/contentType not defined in the openapi document
- -#### 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.fakepemcontenttype.get.FakepemcontenttypeGetRequestBody; -import org.openapijsonschematools.client.paths.fakepemcontenttype.get.requestbody.content.applicationxpemfile.ApplicationxpemfileSchema; -import org.openapijsonschematools.client.RootServerInfo; -import org.openapijsonschematools.client.servers.RootServer0; -import org.openapijsonschematools.client.servers.RootServer1; -import org.openapijsonschematools.client.servers.RootServer2; -import org.openapijsonschematools.client.paths.fakepemcontenttype.get.responses.FakepemcontenttypeGetCode200Response; -import org.openapijsonschematools.client.servers.RootServerInfo; -import org.openapijsonschematools.client.apis.paths.Fakepemcontenttype; -import org.openapijsonschematools.client.paths.fakepemcontenttype.get.FakepemcontenttypeGetResponses; - -import java.io.IOException; -import java.util.Arrays; -import java.util.List; -import java.util.Map; -import java.util.AbstractMap; - -// if you want to use a server that is not SERVER_0 pass it in here and change the ServerIndex input below -ApiConfiguration.ServerInfo serverInfo = new ApiConfiguration.ServerInfoBuilder() - .rootServerInfo( - new RootServerInfo.RootServerInfoBuilder() - .rootServer0(new RootServer0()) - .build() - ) - .build(); -ApiConfiguration.ServerIndexInfo serverIndexInfo = new ApiConfiguration.ServerIndexInfoBuilder() - .rootServerInfoServerIndex(RootServerInfo.ServerIndex.SERVER_0) - .build(); -Duration timeout = Duration.ofSeconds(1L); -Map> defaultHeaders = Map.of("User-Agent", List.of("OpenAPI-JSON-Schema-Generator/1.0.0/java")); -ApiConfiguration apiConfiguration = new ApiConfiguration( - serverInfo - serverIndexInfo, - timeout, - defaultHeaders -); -SchemaConfiguration schemaConfiguration = new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().build()); -Fakepemcontenttype apiClient = new Fakepemcontenttype(apiConfiguration, schemaConfiguration); - - -var request = new FakepemcontenttypeGet.GetRequestBuilder().build(); - -FakepemcontenttypeGetResponses.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; -} -FakepemcontenttypeGetResponses.EndpointFakepemcontenttypeGetCode200Response castResponse = (FakepemcontenttypeGetResponses.EndpointFakepemcontenttypeGetCode200Response) response; -FakepemcontenttypeGetCode200Response.ApplicationxpemfileResponseBody deserializedBody = (FakepemcontenttypeGetCode200Response.ApplicationxpemfileResponseBody) castResponse.body; -// handle deserialized body here -``` -[[Back to top]](#top) [[Back to README]](../../../README.md) diff --git a/samples/client/petstore/kotlin/docs/apis/paths/Fakepetiduploadimagewithrequiredfile.md b/samples/client/petstore/kotlin/docs/apis/paths/Fakepetiduploadimagewithrequiredfile.md deleted file mode 100644 index 371650850c3..00000000000 --- a/samples/client/petstore/kotlin/docs/apis/paths/Fakepetiduploadimagewithrequiredfile.md +++ /dev/null @@ -1,128 +0,0 @@ -# Fakepetiduploadimagewithrequiredfile - -public class Fakepetiduploadimagewithrequiredfile extends extends ApiClient implements -[FakepetiduploadimagewithrequiredfilePost.PostOperation](../../paths/fakepetiduploadimagewithrequiredfile/FakepetiduploadimagewithrequiredfilePost.md#postoperation) - -an api client class which contains all the routes for path="/fake/{petId}/uploadImageWithRequiredFile" - -## Method Summary -| Modifier and Type | Method and Description | -| ----------------- | ---------------------- | -| [FakepetiduploadimagewithrequiredfilePostResponses.EndpointResponse](../../paths/fakepetiduploadimagewithrequiredfile/post/FakepetiduploadimagewithrequiredfilePostResponses.md#endpointresponse) | [post](#post)([FakepetiduploadimagewithrequiredfilePost.PostRequest](../../paths/fakepetiduploadimagewithrequiredfile/FakepetiduploadimagewithrequiredfilePost.md#postrequest) request)
| - -## Method Detail - -### post -public [FakepetiduploadimagewithrequiredfilePostResponses.EndpointResponse](../../paths/fakepetiduploadimagewithrequiredfile/post/FakepetiduploadimagewithrequiredfilePostResponses.md#endpointresponse) post([FakepetiduploadimagewithrequiredfilePost.PostRequest](../../paths/fakepetiduploadimagewithrequiredfile/FakepetiduploadimagewithrequiredfilePost.md#postrequest) request) - - - -**Parameters:**
-request - the input request - -**Returns:**
-the deserialized response - -**Throws:**
-IOException, InterruptedException - an exception happened when making the request
-ValidationException - the returned response body or header values do not conform the the schema validation requirements
-NotImplementedException - the request body serialization or deserialization has not yet been implemented
- or the header content type deserialization has not yet been implemented for this contentType
-ApiException - server returned a response/contentType not defined in the openapi document
- -#### 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.FakepetiduploadimagewithrequiredfilePostRequestBody; -import org.openapijsonschematools.client.RootServerInfo; -import org.openapijsonschematools.client.paths.fakepetiduploadimagewithrequiredfile.post.FakepetiduploadimagewithrequiredfilePostSecurityInfo; -import org.openapijsonschematools.client.paths.fakepetiduploadimagewithrequiredfile.post.FakepetiduploadimagewithrequiredfilePostPathParameters; -import org.openapijsonschematools.client.servers.RootServer0; -import org.openapijsonschematools.client.servers.RootServer1; -import org.openapijsonschematools.client.servers.RootServer2; -import org.openapijsonschematools.client.securityschemes.SecurityScheme; -import org.openapijsonschematools.client.components.securityschemes.PetstoreAuth; -import org.openapijsonschematools.client.paths.fakepetiduploadimagewithrequiredfile.post.responses.FakepetiduploadimagewithrequiredfilePostCode200Response; -import org.openapijsonschematools.client.servers.RootServerInfo; -import org.openapijsonschematools.client.apis.paths.Fakepetiduploadimagewithrequiredfile; -import org.openapijsonschematools.client.paths.fakepetiduploadimagewithrequiredfile.post.FakepetiduploadimagewithrequiredfilePostResponses; - -import java.io.IOException; -import java.util.Arrays; -import java.util.List; -import java.util.Map; -import java.util.AbstractMap; - -// if you want to use a server that is not SERVER_0 pass it in here and change the ServerIndex input below -ApiConfiguration.ServerInfo serverInfo = new ApiConfiguration.ServerInfoBuilder() - .rootServerInfo( - new RootServerInfo.RootServerInfoBuilder() - .rootServer0(new RootServer0()) - .build() - ) - .build(); -ApiConfiguration.ServerIndexInfo serverIndexInfo = new ApiConfiguration.ServerIndexInfoBuilder() - .rootServerInfoServerIndex(RootServerInfo.ServerIndex.SERVER_0) - .build(); -List securitySchemes = new ArrayList(); -ApiConfiguration.SecurityIndexInfo securityIndexInfo = new ApiConfiguration.SecurityIndexInfoBuilder() - .fakepetiduploadimagewithrequiredfilePostSecurityRequirementObject0SecurityIndex(FakepetiduploadimagewithrequiredfilePostSecurityRequirementObject0.SecurityIndex.SECURITY_0) - .build(); -Duration timeout = Duration.ofSeconds(1L); -Map> defaultHeaders = Map.of("User-Agent", List.of("OpenAPI-JSON-Schema-Generator/1.0.0/java")); -ApiConfiguration apiConfiguration = new ApiConfiguration( - serverInfo - serverIndexInfo, - securitySchemes, - securityIndexInfo, - timeout, - defaultHeaders -); -SchemaConfiguration schemaConfiguration = new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().build()); -Fakepetiduploadimagewithrequiredfile apiClient = new Fakepetiduploadimagewithrequiredfile(apiConfiguration, schemaConfiguration); - - -// Map validation -FakepetiduploadimagewithrequiredfilePostPathParameters.PathParametersMap pathParameters = - FakepetiduploadimagewithrequiredfilePostPathParameters.FakepetiduploadimagewithrequiredfilePostPathParameters1.validate( - new FakepetiduploadimagewithrequiredfilePostPathParameters.PathParametersMapBuilder() - .petId(1L) - - .build(), - schemaConfiguration -); - -var request = new FakepetiduploadimagewithrequiredfilePost.PostRequestBuilder() - .pathParameters(pathParameters) - .build(); - -FakepetiduploadimagewithrequiredfilePostResponses.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; -} -FakepetiduploadimagewithrequiredfilePostResponses.EndpointFakepetiduploadimagewithrequiredfilePostCode200Response castResponse = (FakepetiduploadimagewithrequiredfilePostResponses.EndpointFakepetiduploadimagewithrequiredfilePostCode200Response) response; -FakepetiduploadimagewithrequiredfilePostCode200Response.ApplicationjsonResponseBody deserializedBody = (FakepetiduploadimagewithrequiredfilePostCode200Response.ApplicationjsonResponseBody) castResponse.body; -// handle deserialized body here -``` -[[Back to top]](#top) [[Back to README]](../../../README.md) diff --git a/samples/client/petstore/kotlin/docs/apis/paths/Fakequeryparamwithjsoncontenttype.md b/samples/client/petstore/kotlin/docs/apis/paths/Fakequeryparamwithjsoncontenttype.md deleted file mode 100644 index 58ad6cb5fd2..00000000000 --- a/samples/client/petstore/kotlin/docs/apis/paths/Fakequeryparamwithjsoncontenttype.md +++ /dev/null @@ -1,114 +0,0 @@ -# Fakequeryparamwithjsoncontenttype - -public class Fakequeryparamwithjsoncontenttype extends extends ApiClient implements -[FakequeryparamwithjsoncontenttypeGet.GetOperation](../../paths/fakequeryparamwithjsoncontenttype/FakequeryparamwithjsoncontenttypeGet.md#getoperation) - -an api client class which contains all the routes for path="/fake/queryParamWithJsonContentType" - -## Method Summary -| Modifier and Type | Method and Description | -| ----------------- | ---------------------- | -| [FakequeryparamwithjsoncontenttypeGetResponses.EndpointResponse](../../paths/fakequeryparamwithjsoncontenttype/get/FakequeryparamwithjsoncontenttypeGetResponses.md#endpointresponse) | [get](#get)([FakequeryparamwithjsoncontenttypeGet.GetRequest](../../paths/fakequeryparamwithjsoncontenttype/FakequeryparamwithjsoncontenttypeGet.md#getrequest) request) | - -## Method Detail - -### get -public [FakequeryparamwithjsoncontenttypeGetResponses.EndpointResponse](../../paths/fakequeryparamwithjsoncontenttype/get/FakequeryparamwithjsoncontenttypeGetResponses.md#endpointresponse) get([FakequeryparamwithjsoncontenttypeGet.GetRequest](../../paths/fakequeryparamwithjsoncontenttype/FakequeryparamwithjsoncontenttypeGet.md#getrequest) request) - -**Parameters:**
-request - the input request - -**Returns:**
-the deserialized response - -**Throws:**
-IOException, InterruptedException - an exception happened when making the request
-ValidationException - the returned response body or header values do not conform the the schema validation requirements
-NotImplementedException - the request body serialization or deserialization has not yet been implemented
- or the header content type deserialization has not yet been implemented for this contentType
-ApiException - server returned a response/contentType not defined in the openapi document
- -#### 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.fakequeryparamwithjsoncontenttype.get.FakequeryparamwithjsoncontenttypeGetQueryParameters; -import org.openapijsonschematools.client.servers.RootServer0; -import org.openapijsonschematools.client.servers.RootServer1; -import org.openapijsonschematools.client.servers.RootServer2; -import org.openapijsonschematools.client.paths.fakequeryparamwithjsoncontenttype.get.responses.FakequeryparamwithjsoncontenttypeGetCode200Response; -import org.openapijsonschematools.client.servers.RootServerInfo; -import org.openapijsonschematools.client.apis.paths.Fakequeryparamwithjsoncontenttype; -import org.openapijsonschematools.client.paths.fakequeryparamwithjsoncontenttype.get.FakequeryparamwithjsoncontenttypeGetResponses; - -import java.io.IOException; -import java.util.Arrays; -import java.util.List; -import java.util.Map; -import java.util.AbstractMap; - -// if you want to use a server that is not SERVER_0 pass it in here and change the ServerIndex input below -ApiConfiguration.ServerInfo serverInfo = new ApiConfiguration.ServerInfoBuilder() - .rootServerInfo( - new RootServerInfo.RootServerInfoBuilder() - .rootServer0(new RootServer0()) - .build() - ) - .build(); -ApiConfiguration.ServerIndexInfo serverIndexInfo = new ApiConfiguration.ServerIndexInfoBuilder() - .rootServerInfoServerIndex(RootServerInfo.ServerIndex.SERVER_0) - .build(); -Duration timeout = Duration.ofSeconds(1L); -Map> defaultHeaders = Map.of("User-Agent", List.of("OpenAPI-JSON-Schema-Generator/1.0.0/java")); -ApiConfiguration apiConfiguration = new ApiConfiguration( - serverInfo - serverIndexInfo, - timeout, - defaultHeaders -); -SchemaConfiguration schemaConfiguration = new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().build()); -Fakequeryparamwithjsoncontenttype apiClient = new Fakequeryparamwithjsoncontenttype(apiConfiguration, schemaConfiguration); - - -// Map validation -FakequeryparamwithjsoncontenttypeGetQueryParameters.QueryParametersMap queryParameters = - FakequeryparamwithjsoncontenttypeGetQueryParameters.FakequeryparamwithjsoncontenttypeGetQueryParameters1.validate( - new FakequeryparamwithjsoncontenttypeGetQueryParameters.QueryParametersMapBuilder() - .build(), - schemaConfiguration -); - -var request = new FakequeryparamwithjsoncontenttypeGet.GetRequestBuilder() - .queryParameters(queryParameters) - .build(); - -FakequeryparamwithjsoncontenttypeGetResponses.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; -} -FakequeryparamwithjsoncontenttypeGetResponses.EndpointFakequeryparamwithjsoncontenttypeGetCode200Response castResponse = (FakequeryparamwithjsoncontenttypeGetResponses.EndpointFakequeryparamwithjsoncontenttypeGetCode200Response) response; -FakequeryparamwithjsoncontenttypeGetCode200Response.ApplicationjsonResponseBody deserializedBody = (FakequeryparamwithjsoncontenttypeGetCode200Response.ApplicationjsonResponseBody) castResponse.body; -// handle deserialized body here -``` -[[Back to top]](#top) [[Back to README]](../../../README.md) diff --git a/samples/client/petstore/kotlin/docs/apis/paths/Fakeredirection.md b/samples/client/petstore/kotlin/docs/apis/paths/Fakeredirection.md deleted file mode 100644 index 0d2adfb058b..00000000000 --- a/samples/client/petstore/kotlin/docs/apis/paths/Fakeredirection.md +++ /dev/null @@ -1,105 +0,0 @@ -# Fakeredirection - -public class Fakeredirection extends extends ApiClient implements -[FakeredirectionGet.GetOperation](../../paths/fakeredirection/FakeredirectionGet.md#getoperation) - -an api client class which contains all the routes for path="/fake/redirection" - -## Method Summary -| Modifier and Type | Method and Description | -| ----------------- | ---------------------- | -| [FakeredirectionGetResponses.EndpointResponse](../../paths/fakeredirection/get/FakeredirectionGetResponses.md#endpointresponse) | [get](#get)([FakeredirectionGet.GetRequest](../../paths/fakeredirection/FakeredirectionGet.md#getrequest) request) | - -## Method Detail - -### get -public [FakeredirectionGetResponses.EndpointResponse](../../paths/fakeredirection/get/FakeredirectionGetResponses.md#endpointresponse) get([FakeredirectionGet.GetRequest](../../paths/fakeredirection/FakeredirectionGet.md#getrequest) request) - -**Parameters:**
-request - the input request - -**Returns:**
-the deserialized response - -**Throws:**
-IOException, InterruptedException - an exception happened when making the request
-ValidationException - the returned response body or header values do not conform the the schema validation requirements
-NotImplementedException - the request body serialization or deserialization has not yet been implemented
- or the header content type deserialization has not yet been implemented for this contentType
-ApiException - server returned a response/contentType not defined in the openapi document
- -#### 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.servers.RootServer0; -import org.openapijsonschematools.client.servers.RootServer1; -import org.openapijsonschematools.client.servers.RootServer2; -import org.openapijsonschematools.client.paths.fakeredirection.get.responses.FakeredirectionGetCode303Response; -import org.openapijsonschematools.client.paths.fakeredirection.get.responses.FakeredirectionGetCode3XXResponse; -import org.openapijsonschematools.client.servers.RootServerInfo; -import org.openapijsonschematools.client.apis.paths.Fakeredirection; -import org.openapijsonschematools.client.paths.fakeredirection.get.FakeredirectionGetResponses; - -import java.io.IOException; -import java.util.Arrays; -import java.util.List; -import java.util.Map; -import java.util.AbstractMap; - -// if you want to use a server that is not SERVER_0 pass it in here and change the ServerIndex input below -ApiConfiguration.ServerInfo serverInfo = new ApiConfiguration.ServerInfoBuilder() - .rootServerInfo( - new RootServerInfo.RootServerInfoBuilder() - .rootServer0(new RootServer0()) - .build() - ) - .build(); -ApiConfiguration.ServerIndexInfo serverIndexInfo = new ApiConfiguration.ServerIndexInfoBuilder() - .rootServerInfoServerIndex(RootServerInfo.ServerIndex.SERVER_0) - .build(); -Duration timeout = Duration.ofSeconds(1L); -Map> defaultHeaders = Map.of("User-Agent", List.of("OpenAPI-JSON-Schema-Generator/1.0.0/java")); -ApiConfiguration apiConfiguration = new ApiConfiguration( - serverInfo - serverIndexInfo, - timeout, - defaultHeaders -); -SchemaConfiguration schemaConfiguration = new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().build()); -Fakeredirection apiClient = new Fakeredirection(apiConfiguration, schemaConfiguration); - - -var request = new FakeredirectionGet.GetRequestBuilder().build(); - -FakeredirectionGetResponses.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; -} -if (response instanceof FakeredirectionGetResponses.EndpointFakeredirectionGetCode3XXResponse castResponse) { -} else { - FakeredirectionGetResponses.EndpointFakeredirectionGetCode303Response castResponse = (FakeredirectionGetResponses.EndpointFakeredirectionGetCode303Response) response; -} -``` -[[Back to top]](#top) [[Back to README]](../../../README.md) diff --git a/samples/client/petstore/kotlin/docs/apis/paths/Fakerefobjinquery.md b/samples/client/petstore/kotlin/docs/apis/paths/Fakerefobjinquery.md deleted file mode 100644 index 242cd1710c3..00000000000 --- a/samples/client/petstore/kotlin/docs/apis/paths/Fakerefobjinquery.md +++ /dev/null @@ -1,102 +0,0 @@ -# Fakerefobjinquery - -public class Fakerefobjinquery extends extends ApiClient implements -[FakerefobjinqueryGet.GetOperation](../../paths/fakerefobjinquery/FakerefobjinqueryGet.md#getoperation) - -an api client class which contains all the routes for path="/fake/refObjInQuery" - -## Method Summary -| Modifier and Type | Method and Description | -| ----------------- | ---------------------- | -| [FakerefobjinqueryGetResponses.EndpointResponse](../../paths/fakerefobjinquery/get/FakerefobjinqueryGetResponses.md#endpointresponse) | [get](#get)([FakerefobjinqueryGet.GetRequest](../../paths/fakerefobjinquery/FakerefobjinqueryGet.md#getrequest) request) | - -## Method Detail - -### get -public [FakerefobjinqueryGetResponses.EndpointResponse](../../paths/fakerefobjinquery/get/FakerefobjinqueryGetResponses.md#endpointresponse) get([FakerefobjinqueryGet.GetRequest](../../paths/fakerefobjinquery/FakerefobjinqueryGet.md#getrequest) request) - -**Parameters:**
-request - the input request - -**Returns:**
-the deserialized response - -**Throws:**
-IOException, InterruptedException - an exception happened when making the request
-ValidationException - the returned response body or header values do not conform the the schema validation requirements
-NotImplementedException - the request body serialization or deserialization has not yet been implemented
- or the header content type deserialization has not yet been implemented for this contentType
-ApiException - server returned a response/contentType not defined in the openapi document
- -#### 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.fakerefobjinquery.get.FakerefobjinqueryGetQueryParameters; -import org.openapijsonschematools.client.RootServerInfo; -import org.openapijsonschematools.client.servers.RootServer0; -import org.openapijsonschematools.client.servers.RootServer1; -import org.openapijsonschematools.client.servers.RootServer2; -import org.openapijsonschematools.client.paths.fakerefobjinquery.get.responses.FakerefobjinqueryGetCode200Response; -import org.openapijsonschematools.client.servers.RootServerInfo; -import org.openapijsonschematools.client.apis.paths.Fakerefobjinquery; -import org.openapijsonschematools.client.paths.fakerefobjinquery.get.FakerefobjinqueryGetResponses; - -import java.io.IOException; -import java.util.Arrays; -import java.util.List; -import java.util.Map; -import java.util.AbstractMap; - -// if you want to use a server that is not SERVER_0 pass it in here and change the ServerIndex input below -ApiConfiguration.ServerInfo serverInfo = new ApiConfiguration.ServerInfoBuilder() - .rootServerInfo( - new RootServerInfo.RootServerInfoBuilder() - .rootServer0(new RootServer0()) - .build() - ) - .build(); -ApiConfiguration.ServerIndexInfo serverIndexInfo = new ApiConfiguration.ServerIndexInfoBuilder() - .rootServerInfoServerIndex(RootServerInfo.ServerIndex.SERVER_0) - .build(); -Duration timeout = Duration.ofSeconds(1L); -Map> defaultHeaders = Map.of("User-Agent", List.of("OpenAPI-JSON-Schema-Generator/1.0.0/java")); -ApiConfiguration apiConfiguration = new ApiConfiguration( - serverInfo - serverIndexInfo, - timeout, - defaultHeaders -); -SchemaConfiguration schemaConfiguration = new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().build()); -Fakerefobjinquery apiClient = new Fakerefobjinquery(apiConfiguration, schemaConfiguration); - - -var request = new FakerefobjinqueryGet.GetRequestBuilder().build(); - -FakerefobjinqueryGetResponses.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; -} -FakerefobjinqueryGetResponses.EndpointFakerefobjinqueryGetCode200Response castResponse = (FakerefobjinqueryGetResponses.EndpointFakerefobjinqueryGetCode200Response) response; -``` -[[Back to top]](#top) [[Back to README]](../../../README.md) diff --git a/samples/client/petstore/kotlin/docs/apis/paths/Fakerefsarraymodel.md b/samples/client/petstore/kotlin/docs/apis/paths/Fakerefsarraymodel.md deleted file mode 100644 index 57d5832ebc0..00000000000 --- a/samples/client/petstore/kotlin/docs/apis/paths/Fakerefsarraymodel.md +++ /dev/null @@ -1,107 +0,0 @@ -# Fakerefsarraymodel - -public class Fakerefsarraymodel extends extends ApiClient implements -[FakerefsarraymodelPost.PostOperation](../../paths/fakerefsarraymodel/FakerefsarraymodelPost.md#postoperation) - -an api client class which contains all the routes for path="/fake/refs/arraymodel" - -## Method Summary -| Modifier and Type | Method and Description | -| ----------------- | ---------------------- | -| [FakerefsarraymodelPostResponses.EndpointResponse](../../paths/fakerefsarraymodel/post/FakerefsarraymodelPostResponses.md#endpointresponse) | [post](#post)([FakerefsarraymodelPost.PostRequest](../../paths/fakerefsarraymodel/FakerefsarraymodelPost.md#postrequest) request)
Test serialization of ArrayModel | - -## Method Detail - -### post -public [FakerefsarraymodelPostResponses.EndpointResponse](../../paths/fakerefsarraymodel/post/FakerefsarraymodelPostResponses.md#endpointresponse) post([FakerefsarraymodelPost.PostRequest](../../paths/fakerefsarraymodel/FakerefsarraymodelPost.md#postrequest) request) - -Test serialization of ArrayModel - -**Parameters:**
-request - the input request - -**Returns:**
-the deserialized response - -**Throws:**
-IOException, InterruptedException - an exception happened when making the request
-ValidationException - the returned response body or header values do not conform the the schema validation requirements
-NotImplementedException - the request body serialization or deserialization has not yet been implemented
- or the header content type deserialization has not yet been implemented for this contentType
-ApiException - server returned a response/contentType not defined in the openapi document
- -#### 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.fakerefsarraymodel.post.FakerefsarraymodelPostRequestBody; -import org.openapijsonschematools.client.components.schemas.AnimalFarm; -import org.openapijsonschematools.client.RootServerInfo; -import org.openapijsonschematools.client.servers.RootServer0; -import org.openapijsonschematools.client.servers.RootServer1; -import org.openapijsonschematools.client.servers.RootServer2; -import org.openapijsonschematools.client.paths.fakerefsarraymodel.post.responses.FakerefsarraymodelPostCode200Response; -import org.openapijsonschematools.client.servers.RootServerInfo; -import org.openapijsonschematools.client.apis.paths.Fakerefsarraymodel; -import org.openapijsonschematools.client.paths.fakerefsarraymodel.post.FakerefsarraymodelPostResponses; - -import java.io.IOException; -import java.util.Arrays; -import java.util.List; -import java.util.Map; -import java.util.AbstractMap; - -// if you want to use a server that is not SERVER_0 pass it in here and change the ServerIndex input below -ApiConfiguration.ServerInfo serverInfo = new ApiConfiguration.ServerInfoBuilder() - .rootServerInfo( - new RootServerInfo.RootServerInfoBuilder() - .rootServer0(new RootServer0()) - .build() - ) - .build(); -ApiConfiguration.ServerIndexInfo serverIndexInfo = new ApiConfiguration.ServerIndexInfoBuilder() - .rootServerInfoServerIndex(RootServerInfo.ServerIndex.SERVER_0) - .build(); -Duration timeout = Duration.ofSeconds(1L); -Map> defaultHeaders = Map.of("User-Agent", List.of("OpenAPI-JSON-Schema-Generator/1.0.0/java")); -ApiConfiguration apiConfiguration = new ApiConfiguration( - serverInfo - serverIndexInfo, - timeout, - defaultHeaders -); -SchemaConfiguration schemaConfiguration = new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().build()); -Fakerefsarraymodel apiClient = new Fakerefsarraymodel(apiConfiguration, schemaConfiguration); - - -var request = new FakerefsarraymodelPost.PostRequestBuilder().build(); - -FakerefsarraymodelPostResponses.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; -} -FakerefsarraymodelPostResponses.EndpointFakerefsarraymodelPostCode200Response castResponse = (FakerefsarraymodelPostResponses.EndpointFakerefsarraymodelPostCode200Response) response; -FakerefsarraymodelPostCode200Response.ApplicationjsonResponseBody deserializedBody = (FakerefsarraymodelPostCode200Response.ApplicationjsonResponseBody) castResponse.body; -// handle deserialized body here -``` -[[Back to top]](#top) [[Back to README]](../../../README.md) diff --git a/samples/client/petstore/kotlin/docs/apis/paths/Fakerefsarrayofenums.md b/samples/client/petstore/kotlin/docs/apis/paths/Fakerefsarrayofenums.md deleted file mode 100644 index c4f5e5dda18..00000000000 --- a/samples/client/petstore/kotlin/docs/apis/paths/Fakerefsarrayofenums.md +++ /dev/null @@ -1,105 +0,0 @@ -# Fakerefsarrayofenums - -public class Fakerefsarrayofenums extends extends ApiClient implements -[FakerefsarrayofenumsPost.PostOperation](../../paths/fakerefsarrayofenums/FakerefsarrayofenumsPost.md#postoperation) - -an api client class which contains all the routes for path="/fake/refs/array-of-enums" - -## Method Summary -| Modifier and Type | Method and Description | -| ----------------- | ---------------------- | -| [FakerefsarrayofenumsPostResponses.EndpointResponse](../../paths/fakerefsarrayofenums/post/FakerefsarrayofenumsPostResponses.md#endpointresponse) | [post](#post)([FakerefsarrayofenumsPost.PostRequest](../../paths/fakerefsarrayofenums/FakerefsarrayofenumsPost.md#postrequest) request) | - -## Method Detail - -### post -public [FakerefsarrayofenumsPostResponses.EndpointResponse](../../paths/fakerefsarrayofenums/post/FakerefsarrayofenumsPostResponses.md#endpointresponse) post([FakerefsarrayofenumsPost.PostRequest](../../paths/fakerefsarrayofenums/FakerefsarrayofenumsPost.md#postrequest) request) - -**Parameters:**
-request - the input request - -**Returns:**
-the deserialized response - -**Throws:**
-IOException, InterruptedException - an exception happened when making the request
-ValidationException - the returned response body or header values do not conform the the schema validation requirements
-NotImplementedException - the request body serialization or deserialization has not yet been implemented
- or the header content type deserialization has not yet been implemented for this contentType
-ApiException - server returned a response/contentType not defined in the openapi document
- -#### 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.FakerefsarrayofenumsPostRequestBody; -import org.openapijsonschematools.client.components.schemas.ArrayOfEnums; -import org.openapijsonschematools.client.RootServerInfo; -import org.openapijsonschematools.client.servers.RootServer0; -import org.openapijsonschematools.client.servers.RootServer1; -import org.openapijsonschematools.client.servers.RootServer2; -import org.openapijsonschematools.client.paths.fakerefsarrayofenums.post.responses.FakerefsarrayofenumsPostCode200Response; -import org.openapijsonschematools.client.servers.RootServerInfo; -import org.openapijsonschematools.client.apis.paths.Fakerefsarrayofenums; -import org.openapijsonschematools.client.paths.fakerefsarrayofenums.post.FakerefsarrayofenumsPostResponses; - -import java.io.IOException; -import java.util.Arrays; -import java.util.List; -import java.util.Map; -import java.util.AbstractMap; - -// if you want to use a server that is not SERVER_0 pass it in here and change the ServerIndex input below -ApiConfiguration.ServerInfo serverInfo = new ApiConfiguration.ServerInfoBuilder() - .rootServerInfo( - new RootServerInfo.RootServerInfoBuilder() - .rootServer0(new RootServer0()) - .build() - ) - .build(); -ApiConfiguration.ServerIndexInfo serverIndexInfo = new ApiConfiguration.ServerIndexInfoBuilder() - .rootServerInfoServerIndex(RootServerInfo.ServerIndex.SERVER_0) - .build(); -Duration timeout = Duration.ofSeconds(1L); -Map> defaultHeaders = Map.of("User-Agent", List.of("OpenAPI-JSON-Schema-Generator/1.0.0/java")); -ApiConfiguration apiConfiguration = new ApiConfiguration( - serverInfo - serverIndexInfo, - timeout, - defaultHeaders -); -SchemaConfiguration schemaConfiguration = new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().build()); -Fakerefsarrayofenums apiClient = new Fakerefsarrayofenums(apiConfiguration, schemaConfiguration); - - -var request = new FakerefsarrayofenumsPost.PostRequestBuilder().build(); - -FakerefsarrayofenumsPostResponses.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; -} -FakerefsarrayofenumsPostResponses.EndpointFakerefsarrayofenumsPostCode200Response castResponse = (FakerefsarrayofenumsPostResponses.EndpointFakerefsarrayofenumsPostCode200Response) response; -FakerefsarrayofenumsPostCode200Response.ApplicationjsonResponseBody deserializedBody = (FakerefsarrayofenumsPostCode200Response.ApplicationjsonResponseBody) castResponse.body; -// handle deserialized body here -``` -[[Back to top]](#top) [[Back to README]](../../../README.md) diff --git a/samples/client/petstore/kotlin/docs/apis/paths/Fakerefsboolean.md b/samples/client/petstore/kotlin/docs/apis/paths/Fakerefsboolean.md deleted file mode 100644 index 08d970ada80..00000000000 --- a/samples/client/petstore/kotlin/docs/apis/paths/Fakerefsboolean.md +++ /dev/null @@ -1,107 +0,0 @@ -# Fakerefsboolean - -public class Fakerefsboolean extends extends ApiClient implements -[FakerefsbooleanPost.PostOperation](../../paths/fakerefsboolean/FakerefsbooleanPost.md#postoperation) - -an api client class which contains all the routes for path="/fake/refs/boolean" - -## Method Summary -| Modifier and Type | Method and Description | -| ----------------- | ---------------------- | -| [FakerefsbooleanPostResponses.EndpointResponse](../../paths/fakerefsboolean/post/FakerefsbooleanPostResponses.md#endpointresponse) | [post](#post)([FakerefsbooleanPost.PostRequest](../../paths/fakerefsboolean/FakerefsbooleanPost.md#postrequest) request)
Test serialization of outer boolean types | - -## Method Detail - -### post -public [FakerefsbooleanPostResponses.EndpointResponse](../../paths/fakerefsboolean/post/FakerefsbooleanPostResponses.md#endpointresponse) post([FakerefsbooleanPost.PostRequest](../../paths/fakerefsboolean/FakerefsbooleanPost.md#postrequest) request) - -Test serialization of outer boolean types - -**Parameters:**
-request - the input request - -**Returns:**
-the deserialized response - -**Throws:**
-IOException, InterruptedException - an exception happened when making the request
-ValidationException - the returned response body or header values do not conform the the schema validation requirements
-NotImplementedException - the request body serialization or deserialization has not yet been implemented
- or the header content type deserialization has not yet been implemented for this contentType
-ApiException - server returned a response/contentType not defined in the openapi document
- -#### 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.FakerefsbooleanPostRequestBody; -import org.openapijsonschematools.client.components.schemas.BooleanSchema; -import org.openapijsonschematools.client.RootServerInfo; -import org.openapijsonschematools.client.servers.RootServer0; -import org.openapijsonschematools.client.servers.RootServer1; -import org.openapijsonschematools.client.servers.RootServer2; -import org.openapijsonschematools.client.paths.fakerefsboolean.post.responses.FakerefsbooleanPostCode200Response; -import org.openapijsonschematools.client.servers.RootServerInfo; -import org.openapijsonschematools.client.apis.paths.Fakerefsboolean; -import org.openapijsonschematools.client.paths.fakerefsboolean.post.FakerefsbooleanPostResponses; - -import java.io.IOException; -import java.util.Arrays; -import java.util.List; -import java.util.Map; -import java.util.AbstractMap; - -// if you want to use a server that is not SERVER_0 pass it in here and change the ServerIndex input below -ApiConfiguration.ServerInfo serverInfo = new ApiConfiguration.ServerInfoBuilder() - .rootServerInfo( - new RootServerInfo.RootServerInfoBuilder() - .rootServer0(new RootServer0()) - .build() - ) - .build(); -ApiConfiguration.ServerIndexInfo serverIndexInfo = new ApiConfiguration.ServerIndexInfoBuilder() - .rootServerInfoServerIndex(RootServerInfo.ServerIndex.SERVER_0) - .build(); -Duration timeout = Duration.ofSeconds(1L); -Map> defaultHeaders = Map.of("User-Agent", List.of("OpenAPI-JSON-Schema-Generator/1.0.0/java")); -ApiConfiguration apiConfiguration = new ApiConfiguration( - serverInfo - serverIndexInfo, - timeout, - defaultHeaders -); -SchemaConfiguration schemaConfiguration = new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().build()); -Fakerefsboolean apiClient = new Fakerefsboolean(apiConfiguration, schemaConfiguration); - - -var request = new FakerefsbooleanPost.PostRequestBuilder().build(); - -FakerefsbooleanPostResponses.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; -} -FakerefsbooleanPostResponses.EndpointFakerefsbooleanPostCode200Response castResponse = (FakerefsbooleanPostResponses.EndpointFakerefsbooleanPostCode200Response) response; -FakerefsbooleanPostCode200Response.ApplicationjsonResponseBody deserializedBody = (FakerefsbooleanPostCode200Response.ApplicationjsonResponseBody) castResponse.body; -// handle deserialized body here -``` -[[Back to top]](#top) [[Back to README]](../../../README.md) diff --git a/samples/client/petstore/kotlin/docs/apis/paths/Fakerefscomposedoneofnumberwithvalidations.md b/samples/client/petstore/kotlin/docs/apis/paths/Fakerefscomposedoneofnumberwithvalidations.md deleted file mode 100644 index 56fc7d18035..00000000000 --- a/samples/client/petstore/kotlin/docs/apis/paths/Fakerefscomposedoneofnumberwithvalidations.md +++ /dev/null @@ -1,107 +0,0 @@ -# Fakerefscomposedoneofnumberwithvalidations - -public class Fakerefscomposedoneofnumberwithvalidations extends extends ApiClient implements -[FakerefscomposedoneofnumberwithvalidationsPost.PostOperation](../../paths/fakerefscomposedoneofnumberwithvalidations/FakerefscomposedoneofnumberwithvalidationsPost.md#postoperation) - -an api client class which contains all the routes for path="/fake/refs/composed_one_of_number_with_validations" - -## Method Summary -| Modifier and Type | Method and Description | -| ----------------- | ---------------------- | -| [FakerefscomposedoneofnumberwithvalidationsPostResponses.EndpointResponse](../../paths/fakerefscomposedoneofnumberwithvalidations/post/FakerefscomposedoneofnumberwithvalidationsPostResponses.md#endpointresponse) | [post](#post)([FakerefscomposedoneofnumberwithvalidationsPost.PostRequest](../../paths/fakerefscomposedoneofnumberwithvalidations/FakerefscomposedoneofnumberwithvalidationsPost.md#postrequest) request)
Test serialization of object with $refed properties | - -## Method Detail - -### post -public [FakerefscomposedoneofnumberwithvalidationsPostResponses.EndpointResponse](../../paths/fakerefscomposedoneofnumberwithvalidations/post/FakerefscomposedoneofnumberwithvalidationsPostResponses.md#endpointresponse) post([FakerefscomposedoneofnumberwithvalidationsPost.PostRequest](../../paths/fakerefscomposedoneofnumberwithvalidations/FakerefscomposedoneofnumberwithvalidationsPost.md#postrequest) request) - -Test serialization of object with $refed properties - -**Parameters:**
-request - the input request - -**Returns:**
-the deserialized response - -**Throws:**
-IOException, InterruptedException - an exception happened when making the request
-ValidationException - the returned response body or header values do not conform the the schema validation requirements
-NotImplementedException - the request body serialization or deserialization has not yet been implemented
- or the header content type deserialization has not yet been implemented for this contentType
-ApiException - server returned a response/contentType not defined in the openapi document
- -#### 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.FakerefscomposedoneofnumberwithvalidationsPostRequestBody; -import org.openapijsonschematools.client.components.schemas.ComposedOneOfDifferentTypes; -import org.openapijsonschematools.client.RootServerInfo; -import org.openapijsonschematools.client.servers.RootServer0; -import org.openapijsonschematools.client.servers.RootServer1; -import org.openapijsonschematools.client.servers.RootServer2; -import org.openapijsonschematools.client.paths.fakerefscomposedoneofnumberwithvalidations.post.responses.FakerefscomposedoneofnumberwithvalidationsPostCode200Response; -import org.openapijsonschematools.client.servers.RootServerInfo; -import org.openapijsonschematools.client.apis.paths.Fakerefscomposedoneofnumberwithvalidations; -import org.openapijsonschematools.client.paths.fakerefscomposedoneofnumberwithvalidations.post.FakerefscomposedoneofnumberwithvalidationsPostResponses; - -import java.io.IOException; -import java.util.Arrays; -import java.util.List; -import java.util.Map; -import java.util.AbstractMap; - -// if you want to use a server that is not SERVER_0 pass it in here and change the ServerIndex input below -ApiConfiguration.ServerInfo serverInfo = new ApiConfiguration.ServerInfoBuilder() - .rootServerInfo( - new RootServerInfo.RootServerInfoBuilder() - .rootServer0(new RootServer0()) - .build() - ) - .build(); -ApiConfiguration.ServerIndexInfo serverIndexInfo = new ApiConfiguration.ServerIndexInfoBuilder() - .rootServerInfoServerIndex(RootServerInfo.ServerIndex.SERVER_0) - .build(); -Duration timeout = Duration.ofSeconds(1L); -Map> defaultHeaders = Map.of("User-Agent", List.of("OpenAPI-JSON-Schema-Generator/1.0.0/java")); -ApiConfiguration apiConfiguration = new ApiConfiguration( - serverInfo - serverIndexInfo, - timeout, - defaultHeaders -); -SchemaConfiguration schemaConfiguration = new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().build()); -Fakerefscomposedoneofnumberwithvalidations apiClient = new Fakerefscomposedoneofnumberwithvalidations(apiConfiguration, schemaConfiguration); - - -var request = new FakerefscomposedoneofnumberwithvalidationsPost.PostRequestBuilder().build(); - -FakerefscomposedoneofnumberwithvalidationsPostResponses.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; -} -FakerefscomposedoneofnumberwithvalidationsPostResponses.EndpointFakerefscomposedoneofnumberwithvalidationsPostCode200Response castResponse = (FakerefscomposedoneofnumberwithvalidationsPostResponses.EndpointFakerefscomposedoneofnumberwithvalidationsPostCode200Response) response; -FakerefscomposedoneofnumberwithvalidationsPostCode200Response.ApplicationjsonResponseBody deserializedBody = (FakerefscomposedoneofnumberwithvalidationsPostCode200Response.ApplicationjsonResponseBody) castResponse.body; -// handle deserialized body here -``` -[[Back to top]](#top) [[Back to README]](../../../README.md) diff --git a/samples/client/petstore/kotlin/docs/apis/paths/Fakerefsenum.md b/samples/client/petstore/kotlin/docs/apis/paths/Fakerefsenum.md deleted file mode 100644 index 2b6519d22b7..00000000000 --- a/samples/client/petstore/kotlin/docs/apis/paths/Fakerefsenum.md +++ /dev/null @@ -1,107 +0,0 @@ -# Fakerefsenum - -public class Fakerefsenum extends extends ApiClient implements -[FakerefsenumPost.PostOperation](../../paths/fakerefsenum/FakerefsenumPost.md#postoperation) - -an api client class which contains all the routes for path="/fake/refs/enum" - -## Method Summary -| Modifier and Type | Method and Description | -| ----------------- | ---------------------- | -| [FakerefsenumPostResponses.EndpointResponse](../../paths/fakerefsenum/post/FakerefsenumPostResponses.md#endpointresponse) | [post](#post)([FakerefsenumPost.PostRequest](../../paths/fakerefsenum/FakerefsenumPost.md#postrequest) request)
Test serialization of outer enum | - -## Method Detail - -### post -public [FakerefsenumPostResponses.EndpointResponse](../../paths/fakerefsenum/post/FakerefsenumPostResponses.md#endpointresponse) post([FakerefsenumPost.PostRequest](../../paths/fakerefsenum/FakerefsenumPost.md#postrequest) request) - -Test serialization of outer enum - -**Parameters:**
-request - the input request - -**Returns:**
-the deserialized response - -**Throws:**
-IOException, InterruptedException - an exception happened when making the request
-ValidationException - the returned response body or header values do not conform the the schema validation requirements
-NotImplementedException - the request body serialization or deserialization has not yet been implemented
- or the header content type deserialization has not yet been implemented for this contentType
-ApiException - server returned a response/contentType not defined in the openapi document
- -#### 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.FakerefsenumPostRequestBody; -import org.openapijsonschematools.client.components.schemas.StringEnum; -import org.openapijsonschematools.client.RootServerInfo; -import org.openapijsonschematools.client.servers.RootServer0; -import org.openapijsonschematools.client.servers.RootServer1; -import org.openapijsonschematools.client.servers.RootServer2; -import org.openapijsonschematools.client.paths.fakerefsenum.post.responses.FakerefsenumPostCode200Response; -import org.openapijsonschematools.client.servers.RootServerInfo; -import org.openapijsonschematools.client.apis.paths.Fakerefsenum; -import org.openapijsonschematools.client.paths.fakerefsenum.post.FakerefsenumPostResponses; - -import java.io.IOException; -import java.util.Arrays; -import java.util.List; -import java.util.Map; -import java.util.AbstractMap; - -// if you want to use a server that is not SERVER_0 pass it in here and change the ServerIndex input below -ApiConfiguration.ServerInfo serverInfo = new ApiConfiguration.ServerInfoBuilder() - .rootServerInfo( - new RootServerInfo.RootServerInfoBuilder() - .rootServer0(new RootServer0()) - .build() - ) - .build(); -ApiConfiguration.ServerIndexInfo serverIndexInfo = new ApiConfiguration.ServerIndexInfoBuilder() - .rootServerInfoServerIndex(RootServerInfo.ServerIndex.SERVER_0) - .build(); -Duration timeout = Duration.ofSeconds(1L); -Map> defaultHeaders = Map.of("User-Agent", List.of("OpenAPI-JSON-Schema-Generator/1.0.0/java")); -ApiConfiguration apiConfiguration = new ApiConfiguration( - serverInfo - serverIndexInfo, - timeout, - defaultHeaders -); -SchemaConfiguration schemaConfiguration = new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().build()); -Fakerefsenum apiClient = new Fakerefsenum(apiConfiguration, schemaConfiguration); - - -var request = new FakerefsenumPost.PostRequestBuilder().build(); - -FakerefsenumPostResponses.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; -} -FakerefsenumPostResponses.EndpointFakerefsenumPostCode200Response castResponse = (FakerefsenumPostResponses.EndpointFakerefsenumPostCode200Response) response; -FakerefsenumPostCode200Response.ApplicationjsonResponseBody deserializedBody = (FakerefsenumPostCode200Response.ApplicationjsonResponseBody) castResponse.body; -// handle deserialized body here -``` -[[Back to top]](#top) [[Back to README]](../../../README.md) diff --git a/samples/client/petstore/kotlin/docs/apis/paths/Fakerefsmammal.md b/samples/client/petstore/kotlin/docs/apis/paths/Fakerefsmammal.md deleted file mode 100644 index 5c5dbc63e7c..00000000000 --- a/samples/client/petstore/kotlin/docs/apis/paths/Fakerefsmammal.md +++ /dev/null @@ -1,110 +0,0 @@ -# Fakerefsmammal - -public class Fakerefsmammal extends extends ApiClient implements -[FakerefsmammalPost.PostOperation](../../paths/fakerefsmammal/FakerefsmammalPost.md#postoperation) - -an api client class which contains all the routes for path="/fake/refs/mammal" - -## Method Summary -| Modifier and Type | Method and Description | -| ----------------- | ---------------------- | -| [FakerefsmammalPostResponses.EndpointResponse](../../paths/fakerefsmammal/post/FakerefsmammalPostResponses.md#endpointresponse) | [post](#post)([FakerefsmammalPost.PostRequest](../../paths/fakerefsmammal/FakerefsmammalPost.md#postrequest) request)
Test serialization of mammals | - -## Method Detail - -### post -public [FakerefsmammalPostResponses.EndpointResponse](../../paths/fakerefsmammal/post/FakerefsmammalPostResponses.md#endpointresponse) post([FakerefsmammalPost.PostRequest](../../paths/fakerefsmammal/FakerefsmammalPost.md#postrequest) request) - -Test serialization of mammals - -**Parameters:**
-request - the input request - -**Returns:**
-the deserialized response - -**Throws:**
-IOException, InterruptedException - an exception happened when making the request
-ValidationException - the returned response body or header values do not conform the the schema validation requirements
-NotImplementedException - the request body serialization or deserialization has not yet been implemented
- or the header content type deserialization has not yet been implemented for this contentType
-ApiException - server returned a response/contentType not defined in the openapi document
- -#### 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.FakerefsmammalPostRequestBody; -import org.openapijsonschematools.client.components.schemas.Mammal; -import org.openapijsonschematools.client.servers.RootServer0; -import org.openapijsonschematools.client.servers.RootServer1; -import org.openapijsonschematools.client.servers.RootServer2; -import org.openapijsonschematools.client.paths.fakerefsmammal.post.responses.FakerefsmammalPostCode200Response; -import org.openapijsonschematools.client.servers.RootServerInfo; -import org.openapijsonschematools.client.apis.paths.Fakerefsmammal; -import org.openapijsonschematools.client.paths.fakerefsmammal.post.FakerefsmammalPostResponses; - -import java.io.IOException; -import java.util.Arrays; -import java.util.List; -import java.util.Map; -import java.util.AbstractMap; - -// if you want to use a server that is not SERVER_0 pass it in here and change the ServerIndex input below -ApiConfiguration.ServerInfo serverInfo = new ApiConfiguration.ServerInfoBuilder() - .rootServerInfo( - new RootServerInfo.RootServerInfoBuilder() - .rootServer0(new RootServer0()) - .build() - ) - .build(); -ApiConfiguration.ServerIndexInfo serverIndexInfo = new ApiConfiguration.ServerIndexInfoBuilder() - .rootServerInfoServerIndex(RootServerInfo.ServerIndex.SERVER_0) - .build(); -Duration timeout = Duration.ofSeconds(1L); -Map> defaultHeaders = Map.of("User-Agent", List.of("OpenAPI-JSON-Schema-Generator/1.0.0/java")); -ApiConfiguration apiConfiguration = new ApiConfiguration( - serverInfo - serverIndexInfo, - timeout, - defaultHeaders -); -SchemaConfiguration schemaConfiguration = new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().build()); -Fakerefsmammal apiClient = new Fakerefsmammal(apiConfiguration, schemaConfiguration); - -FakerefsmammalPost.SealedRequestBody requestBody = new FakerefsmammalPost.ApplicationjsonRequestBody(requestBodyPayload); - -var request = new FakerefsmammalPost.PostRequestBuilder() - .requestBody(requestBody) - .build(); - -FakerefsmammalPostResponses.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; -} -FakerefsmammalPostResponses.EndpointFakerefsmammalPostCode200Response castResponse = (FakerefsmammalPostResponses.EndpointFakerefsmammalPostCode200Response) response; -FakerefsmammalPostCode200Response.ApplicationjsonResponseBody deserializedBody = (FakerefsmammalPostCode200Response.ApplicationjsonResponseBody) castResponse.body; -// handle deserialized body here -``` -[[Back to top]](#top) [[Back to README]](../../../README.md) diff --git a/samples/client/petstore/kotlin/docs/apis/paths/Fakerefsnumber.md b/samples/client/petstore/kotlin/docs/apis/paths/Fakerefsnumber.md deleted file mode 100644 index c3269287ddb..00000000000 --- a/samples/client/petstore/kotlin/docs/apis/paths/Fakerefsnumber.md +++ /dev/null @@ -1,107 +0,0 @@ -# Fakerefsnumber - -public class Fakerefsnumber extends extends ApiClient implements -[FakerefsnumberPost.PostOperation](../../paths/fakerefsnumber/FakerefsnumberPost.md#postoperation) - -an api client class which contains all the routes for path="/fake/refs/number" - -## Method Summary -| Modifier and Type | Method and Description | -| ----------------- | ---------------------- | -| [FakerefsnumberPostResponses.EndpointResponse](../../paths/fakerefsnumber/post/FakerefsnumberPostResponses.md#endpointresponse) | [post](#post)([FakerefsnumberPost.PostRequest](../../paths/fakerefsnumber/FakerefsnumberPost.md#postrequest) request)
Test serialization of outer number types | - -## Method Detail - -### post -public [FakerefsnumberPostResponses.EndpointResponse](../../paths/fakerefsnumber/post/FakerefsnumberPostResponses.md#endpointresponse) post([FakerefsnumberPost.PostRequest](../../paths/fakerefsnumber/FakerefsnumberPost.md#postrequest) request) - -Test serialization of outer number types - -**Parameters:**
-request - the input request - -**Returns:**
-the deserialized response - -**Throws:**
-IOException, InterruptedException - an exception happened when making the request
-ValidationException - the returned response body or header values do not conform the the schema validation requirements
-NotImplementedException - the request body serialization or deserialization has not yet been implemented
- or the header content type deserialization has not yet been implemented for this contentType
-ApiException - server returned a response/contentType not defined in the openapi document
- -#### 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.FakerefsnumberPostRequestBody; -import org.openapijsonschematools.client.components.schemas.NumberWithValidations; -import org.openapijsonschematools.client.RootServerInfo; -import org.openapijsonschematools.client.servers.RootServer0; -import org.openapijsonschematools.client.servers.RootServer1; -import org.openapijsonschematools.client.servers.RootServer2; -import org.openapijsonschematools.client.paths.fakerefsnumber.post.responses.FakerefsnumberPostCode200Response; -import org.openapijsonschematools.client.servers.RootServerInfo; -import org.openapijsonschematools.client.apis.paths.Fakerefsnumber; -import org.openapijsonschematools.client.paths.fakerefsnumber.post.FakerefsnumberPostResponses; - -import java.io.IOException; -import java.util.Arrays; -import java.util.List; -import java.util.Map; -import java.util.AbstractMap; - -// if you want to use a server that is not SERVER_0 pass it in here and change the ServerIndex input below -ApiConfiguration.ServerInfo serverInfo = new ApiConfiguration.ServerInfoBuilder() - .rootServerInfo( - new RootServerInfo.RootServerInfoBuilder() - .rootServer0(new RootServer0()) - .build() - ) - .build(); -ApiConfiguration.ServerIndexInfo serverIndexInfo = new ApiConfiguration.ServerIndexInfoBuilder() - .rootServerInfoServerIndex(RootServerInfo.ServerIndex.SERVER_0) - .build(); -Duration timeout = Duration.ofSeconds(1L); -Map> defaultHeaders = Map.of("User-Agent", List.of("OpenAPI-JSON-Schema-Generator/1.0.0/java")); -ApiConfiguration apiConfiguration = new ApiConfiguration( - serverInfo - serverIndexInfo, - timeout, - defaultHeaders -); -SchemaConfiguration schemaConfiguration = new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().build()); -Fakerefsnumber apiClient = new Fakerefsnumber(apiConfiguration, schemaConfiguration); - - -var request = new FakerefsnumberPost.PostRequestBuilder().build(); - -FakerefsnumberPostResponses.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; -} -FakerefsnumberPostResponses.EndpointFakerefsnumberPostCode200Response castResponse = (FakerefsnumberPostResponses.EndpointFakerefsnumberPostCode200Response) response; -FakerefsnumberPostCode200Response.ApplicationjsonResponseBody deserializedBody = (FakerefsnumberPostCode200Response.ApplicationjsonResponseBody) castResponse.body; -// handle deserialized body here -``` -[[Back to top]](#top) [[Back to README]](../../../README.md) diff --git a/samples/client/petstore/kotlin/docs/apis/paths/Fakerefsobjectmodelwithrefprops.md b/samples/client/petstore/kotlin/docs/apis/paths/Fakerefsobjectmodelwithrefprops.md deleted file mode 100644 index fc8472f4837..00000000000 --- a/samples/client/petstore/kotlin/docs/apis/paths/Fakerefsobjectmodelwithrefprops.md +++ /dev/null @@ -1,107 +0,0 @@ -# Fakerefsobjectmodelwithrefprops - -public class Fakerefsobjectmodelwithrefprops extends extends ApiClient implements -[FakerefsobjectmodelwithrefpropsPost.PostOperation](../../paths/fakerefsobjectmodelwithrefprops/FakerefsobjectmodelwithrefpropsPost.md#postoperation) - -an api client class which contains all the routes for path="/fake/refs/object_model_with_ref_props" - -## Method Summary -| Modifier and Type | Method and Description | -| ----------------- | ---------------------- | -| [FakerefsobjectmodelwithrefpropsPostResponses.EndpointResponse](../../paths/fakerefsobjectmodelwithrefprops/post/FakerefsobjectmodelwithrefpropsPostResponses.md#endpointresponse) | [post](#post)([FakerefsobjectmodelwithrefpropsPost.PostRequest](../../paths/fakerefsobjectmodelwithrefprops/FakerefsobjectmodelwithrefpropsPost.md#postrequest) request)
Test serialization of object with $refed properties | - -## Method Detail - -### post -public [FakerefsobjectmodelwithrefpropsPostResponses.EndpointResponse](../../paths/fakerefsobjectmodelwithrefprops/post/FakerefsobjectmodelwithrefpropsPostResponses.md#endpointresponse) post([FakerefsobjectmodelwithrefpropsPost.PostRequest](../../paths/fakerefsobjectmodelwithrefprops/FakerefsobjectmodelwithrefpropsPost.md#postrequest) request) - -Test serialization of object with $refed properties - -**Parameters:**
-request - the input request - -**Returns:**
-the deserialized response - -**Throws:**
-IOException, InterruptedException - an exception happened when making the request
-ValidationException - the returned response body or header values do not conform the the schema validation requirements
-NotImplementedException - the request body serialization or deserialization has not yet been implemented
- or the header content type deserialization has not yet been implemented for this contentType
-ApiException - server returned a response/contentType not defined in the openapi document
- -#### 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.FakerefsobjectmodelwithrefpropsPostRequestBody; -import org.openapijsonschematools.client.components.schemas.ObjectModelWithRefProps; -import org.openapijsonschematools.client.RootServerInfo; -import org.openapijsonschematools.client.servers.RootServer0; -import org.openapijsonschematools.client.servers.RootServer1; -import org.openapijsonschematools.client.servers.RootServer2; -import org.openapijsonschematools.client.paths.fakerefsobjectmodelwithrefprops.post.responses.FakerefsobjectmodelwithrefpropsPostCode200Response; -import org.openapijsonschematools.client.servers.RootServerInfo; -import org.openapijsonschematools.client.apis.paths.Fakerefsobjectmodelwithrefprops; -import org.openapijsonschematools.client.paths.fakerefsobjectmodelwithrefprops.post.FakerefsobjectmodelwithrefpropsPostResponses; - -import java.io.IOException; -import java.util.Arrays; -import java.util.List; -import java.util.Map; -import java.util.AbstractMap; - -// if you want to use a server that is not SERVER_0 pass it in here and change the ServerIndex input below -ApiConfiguration.ServerInfo serverInfo = new ApiConfiguration.ServerInfoBuilder() - .rootServerInfo( - new RootServerInfo.RootServerInfoBuilder() - .rootServer0(new RootServer0()) - .build() - ) - .build(); -ApiConfiguration.ServerIndexInfo serverIndexInfo = new ApiConfiguration.ServerIndexInfoBuilder() - .rootServerInfoServerIndex(RootServerInfo.ServerIndex.SERVER_0) - .build(); -Duration timeout = Duration.ofSeconds(1L); -Map> defaultHeaders = Map.of("User-Agent", List.of("OpenAPI-JSON-Schema-Generator/1.0.0/java")); -ApiConfiguration apiConfiguration = new ApiConfiguration( - serverInfo - serverIndexInfo, - timeout, - defaultHeaders -); -SchemaConfiguration schemaConfiguration = new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().build()); -Fakerefsobjectmodelwithrefprops apiClient = new Fakerefsobjectmodelwithrefprops(apiConfiguration, schemaConfiguration); - - -var request = new FakerefsobjectmodelwithrefpropsPost.PostRequestBuilder().build(); - -FakerefsobjectmodelwithrefpropsPostResponses.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; -} -FakerefsobjectmodelwithrefpropsPostResponses.EndpointFakerefsobjectmodelwithrefpropsPostCode200Response castResponse = (FakerefsobjectmodelwithrefpropsPostResponses.EndpointFakerefsobjectmodelwithrefpropsPostCode200Response) response; -FakerefsobjectmodelwithrefpropsPostCode200Response.ApplicationjsonResponseBody deserializedBody = (FakerefsobjectmodelwithrefpropsPostCode200Response.ApplicationjsonResponseBody) castResponse.body; -// handle deserialized body here -``` -[[Back to top]](#top) [[Back to README]](../../../README.md) diff --git a/samples/client/petstore/kotlin/docs/apis/paths/Fakerefsstring.md b/samples/client/petstore/kotlin/docs/apis/paths/Fakerefsstring.md deleted file mode 100644 index c7875ab8678..00000000000 --- a/samples/client/petstore/kotlin/docs/apis/paths/Fakerefsstring.md +++ /dev/null @@ -1,107 +0,0 @@ -# Fakerefsstring - -public class Fakerefsstring extends extends ApiClient implements -[FakerefsstringPost.PostOperation](../../paths/fakerefsstring/FakerefsstringPost.md#postoperation) - -an api client class which contains all the routes for path="/fake/refs/string" - -## Method Summary -| Modifier and Type | Method and Description | -| ----------------- | ---------------------- | -| [FakerefsstringPostResponses.EndpointResponse](../../paths/fakerefsstring/post/FakerefsstringPostResponses.md#endpointresponse) | [post](#post)([FakerefsstringPost.PostRequest](../../paths/fakerefsstring/FakerefsstringPost.md#postrequest) request)
Test serialization of outer string types | - -## Method Detail - -### post -public [FakerefsstringPostResponses.EndpointResponse](../../paths/fakerefsstring/post/FakerefsstringPostResponses.md#endpointresponse) post([FakerefsstringPost.PostRequest](../../paths/fakerefsstring/FakerefsstringPost.md#postrequest) request) - -Test serialization of outer string types - -**Parameters:**
-request - the input request - -**Returns:**
-the deserialized response - -**Throws:**
-IOException, InterruptedException - an exception happened when making the request
-ValidationException - the returned response body or header values do not conform the the schema validation requirements
-NotImplementedException - the request body serialization or deserialization has not yet been implemented
- or the header content type deserialization has not yet been implemented for this contentType
-ApiException - server returned a response/contentType not defined in the openapi document
- -#### 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.FakerefsstringPostRequestBody; -import org.openapijsonschematools.client.components.schemas.StringSchema; -import org.openapijsonschematools.client.RootServerInfo; -import org.openapijsonschematools.client.servers.RootServer0; -import org.openapijsonschematools.client.servers.RootServer1; -import org.openapijsonschematools.client.servers.RootServer2; -import org.openapijsonschematools.client.paths.fakerefsstring.post.responses.FakerefsstringPostCode200Response; -import org.openapijsonschematools.client.servers.RootServerInfo; -import org.openapijsonschematools.client.apis.paths.Fakerefsstring; -import org.openapijsonschematools.client.paths.fakerefsstring.post.FakerefsstringPostResponses; - -import java.io.IOException; -import java.util.Arrays; -import java.util.List; -import java.util.Map; -import java.util.AbstractMap; - -// if you want to use a server that is not SERVER_0 pass it in here and change the ServerIndex input below -ApiConfiguration.ServerInfo serverInfo = new ApiConfiguration.ServerInfoBuilder() - .rootServerInfo( - new RootServerInfo.RootServerInfoBuilder() - .rootServer0(new RootServer0()) - .build() - ) - .build(); -ApiConfiguration.ServerIndexInfo serverIndexInfo = new ApiConfiguration.ServerIndexInfoBuilder() - .rootServerInfoServerIndex(RootServerInfo.ServerIndex.SERVER_0) - .build(); -Duration timeout = Duration.ofSeconds(1L); -Map> defaultHeaders = Map.of("User-Agent", List.of("OpenAPI-JSON-Schema-Generator/1.0.0/java")); -ApiConfiguration apiConfiguration = new ApiConfiguration( - serverInfo - serverIndexInfo, - timeout, - defaultHeaders -); -SchemaConfiguration schemaConfiguration = new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().build()); -Fakerefsstring apiClient = new Fakerefsstring(apiConfiguration, schemaConfiguration); - - -var request = new FakerefsstringPost.PostRequestBuilder().build(); - -FakerefsstringPostResponses.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; -} -FakerefsstringPostResponses.EndpointFakerefsstringPostCode200Response castResponse = (FakerefsstringPostResponses.EndpointFakerefsstringPostCode200Response) response; -FakerefsstringPostCode200Response.ApplicationjsonResponseBody deserializedBody = (FakerefsstringPostCode200Response.ApplicationjsonResponseBody) castResponse.body; -// handle deserialized body here -``` -[[Back to top]](#top) [[Back to README]](../../../README.md) diff --git a/samples/client/petstore/kotlin/docs/apis/paths/Fakeresponsewithoutschema.md b/samples/client/petstore/kotlin/docs/apis/paths/Fakeresponsewithoutschema.md deleted file mode 100644 index c2d5cfb56bc..00000000000 --- a/samples/client/petstore/kotlin/docs/apis/paths/Fakeresponsewithoutschema.md +++ /dev/null @@ -1,101 +0,0 @@ -# Fakeresponsewithoutschema - -public class Fakeresponsewithoutschema extends extends ApiClient implements -[FakeresponsewithoutschemaGet.GetOperation](../../paths/fakeresponsewithoutschema/FakeresponsewithoutschemaGet.md#getoperation) - -an api client class which contains all the routes for path="/fake/responseWithoutSchema" - -## Method Summary -| Modifier and Type | Method and Description | -| ----------------- | ---------------------- | -| [FakeresponsewithoutschemaGetResponses.EndpointResponse](../../paths/fakeresponsewithoutschema/get/FakeresponsewithoutschemaGetResponses.md#endpointresponse) | [get](#get)([FakeresponsewithoutschemaGet.GetRequest](../../paths/fakeresponsewithoutschema/FakeresponsewithoutschemaGet.md#getrequest) request) | - -## Method Detail - -### get -public [FakeresponsewithoutschemaGetResponses.EndpointResponse](../../paths/fakeresponsewithoutschema/get/FakeresponsewithoutschemaGetResponses.md#endpointresponse) get([FakeresponsewithoutschemaGet.GetRequest](../../paths/fakeresponsewithoutschema/FakeresponsewithoutschemaGet.md#getrequest) request) - -**Parameters:**
-request - the input request - -**Returns:**
-the deserialized response - -**Throws:**
-IOException, InterruptedException - an exception happened when making the request
-ValidationException - the returned response body or header values do not conform the the schema validation requirements
-NotImplementedException - the request body serialization or deserialization has not yet been implemented
- or the header content type deserialization has not yet been implemented for this contentType
-ApiException - server returned a response/contentType not defined in the openapi document
- -#### 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.servers.RootServer0; -import org.openapijsonschematools.client.servers.RootServer1; -import org.openapijsonschematools.client.servers.RootServer2; -import org.openapijsonschematools.client.paths.fakeresponsewithoutschema.get.responses.FakeresponsewithoutschemaGetCode200Response; -import org.openapijsonschematools.client.servers.RootServerInfo; -import org.openapijsonschematools.client.apis.paths.Fakeresponsewithoutschema; -import org.openapijsonschematools.client.paths.fakeresponsewithoutschema.get.FakeresponsewithoutschemaGetResponses; - -import java.io.IOException; -import java.util.Arrays; -import java.util.List; -import java.util.Map; -import java.util.AbstractMap; - -// if you want to use a server that is not SERVER_0 pass it in here and change the ServerIndex input below -ApiConfiguration.ServerInfo serverInfo = new ApiConfiguration.ServerInfoBuilder() - .rootServerInfo( - new RootServerInfo.RootServerInfoBuilder() - .rootServer0(new RootServer0()) - .build() - ) - .build(); -ApiConfiguration.ServerIndexInfo serverIndexInfo = new ApiConfiguration.ServerIndexInfoBuilder() - .rootServerInfoServerIndex(RootServerInfo.ServerIndex.SERVER_0) - .build(); -Duration timeout = Duration.ofSeconds(1L); -Map> defaultHeaders = Map.of("User-Agent", List.of("OpenAPI-JSON-Schema-Generator/1.0.0/java")); -ApiConfiguration apiConfiguration = new ApiConfiguration( - serverInfo - serverIndexInfo, - timeout, - defaultHeaders -); -SchemaConfiguration schemaConfiguration = new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().build()); -Fakeresponsewithoutschema apiClient = new Fakeresponsewithoutschema(apiConfiguration, schemaConfiguration); - - -var request = new FakeresponsewithoutschemaGet.GetRequestBuilder().build(); - -FakeresponsewithoutschemaGetResponses.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; -} -FakeresponsewithoutschemaGetResponses.EndpointFakeresponsewithoutschemaGetCode200Response castResponse = (FakeresponsewithoutschemaGetResponses.EndpointFakeresponsewithoutschemaGetCode200Response) response; -``` -[[Back to top]](#top) [[Back to README]](../../../README.md) diff --git a/samples/client/petstore/kotlin/docs/apis/paths/Faketestqueryparamters.md b/samples/client/petstore/kotlin/docs/apis/paths/Faketestqueryparamters.md deleted file mode 100644 index bf56283e144..00000000000 --- a/samples/client/petstore/kotlin/docs/apis/paths/Faketestqueryparamters.md +++ /dev/null @@ -1,141 +0,0 @@ -# Faketestqueryparamters - -public class Faketestqueryparamters extends extends ApiClient implements -[FaketestqueryparamtersPut.PutOperation](../../paths/faketestqueryparamters/FaketestqueryparamtersPut.md#putoperation) - -an api client class which contains all the routes for path="/fake/test-query-paramters" - -## Method Summary -| Modifier and Type | Method and Description | -| ----------------- | ---------------------- | -| [FaketestqueryparamtersPutResponses.EndpointResponse](../../paths/faketestqueryparamters/put/FaketestqueryparamtersPutResponses.md#endpointresponse) | [put](#put)([FaketestqueryparamtersPut.PutRequest](../../paths/faketestqueryparamters/FaketestqueryparamtersPut.md#putrequest) request)
To test the collection format in query parameters | - -## Method Detail - -### put -public [FaketestqueryparamtersPutResponses.EndpointResponse](../../paths/faketestqueryparamters/put/FaketestqueryparamtersPutResponses.md#endpointresponse) put([FaketestqueryparamtersPut.PutRequest](../../paths/faketestqueryparamters/FaketestqueryparamtersPut.md#putrequest) request) - -To test the collection format in query parameters - -**Parameters:**
-request - the input request - -**Returns:**
-the deserialized response - -**Throws:**
-IOException, InterruptedException - an exception happened when making the request
-ValidationException - the returned response body or header values do not conform the the schema validation requirements
-NotImplementedException - the request body serialization or deserialization has not yet been implemented
- or the header content type deserialization has not yet been implemented for this contentType
-ApiException - server returned a response/contentType not defined in the openapi document
- -#### 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.faketestqueryparamters.put.FaketestqueryparamtersPutQueryParameters; -import org.openapijsonschematools.client.servers.RootServer0; -import org.openapijsonschematools.client.servers.RootServer1; -import org.openapijsonschematools.client.servers.RootServer2; -import org.openapijsonschematools.client.paths.faketestqueryparamters.put.responses.FaketestqueryparamtersPutCode200Response; -import org.openapijsonschematools.client.servers.RootServerInfo; -import org.openapijsonschematools.client.apis.paths.Faketestqueryparamters; -import org.openapijsonschematools.client.paths.faketestqueryparamters.put.FaketestqueryparamtersPutResponses; - -import java.io.IOException; -import java.util.Arrays; -import java.util.List; -import java.util.Map; -import java.util.AbstractMap; - -// if you want to use a server that is not SERVER_0 pass it in here and change the ServerIndex input below -ApiConfiguration.ServerInfo serverInfo = new ApiConfiguration.ServerInfoBuilder() - .rootServerInfo( - new RootServerInfo.RootServerInfoBuilder() - .rootServer0(new RootServer0()) - .build() - ) - .build(); -ApiConfiguration.ServerIndexInfo serverIndexInfo = new ApiConfiguration.ServerIndexInfoBuilder() - .rootServerInfoServerIndex(RootServerInfo.ServerIndex.SERVER_0) - .build(); -Duration timeout = Duration.ofSeconds(1L); -Map> defaultHeaders = Map.of("User-Agent", List.of("OpenAPI-JSON-Schema-Generator/1.0.0/java")); -ApiConfiguration apiConfiguration = new ApiConfiguration( - serverInfo - serverIndexInfo, - timeout, - defaultHeaders -); -SchemaConfiguration schemaConfiguration = new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().build()); -Faketestqueryparamters apiClient = new Faketestqueryparamters(apiConfiguration, schemaConfiguration); - - -// Map validation -FaketestqueryparamtersPutQueryParameters.QueryParametersMap queryParameters = - FaketestqueryparamtersPutQueryParameters.FaketestqueryparamtersPutQueryParameters1.validate( - new FaketestqueryparamtersPutQueryParameters.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 -); - -var request = new FaketestqueryparamtersPut.PutRequestBuilder() - .queryParameters(queryParameters) - .build(); - -FaketestqueryparamtersPutResponses.EndpointResponse response; -try { - response = apiClient.put(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; -} -FaketestqueryparamtersPutResponses.EndpointFaketestqueryparamtersPutCode200Response castResponse = (FaketestqueryparamtersPutResponses.EndpointFaketestqueryparamtersPutCode200Response) response; -``` -[[Back to top]](#top) [[Back to README]](../../../README.md) diff --git a/samples/client/petstore/kotlin/docs/apis/paths/Fakeuploaddownloadfile.md b/samples/client/petstore/kotlin/docs/apis/paths/Fakeuploaddownloadfile.md deleted file mode 100644 index edb77f20fa0..00000000000 --- a/samples/client/petstore/kotlin/docs/apis/paths/Fakeuploaddownloadfile.md +++ /dev/null @@ -1,115 +0,0 @@ -# Fakeuploaddownloadfile - -public class Fakeuploaddownloadfile extends extends ApiClient implements -[FakeuploaddownloadfilePost.PostOperation](../../paths/fakeuploaddownloadfile/FakeuploaddownloadfilePost.md#postoperation) - -an api client class which contains all the routes for path="/fake/uploadDownloadFile" - -## Method Summary -| Modifier and Type | Method and Description | -| ----------------- | ---------------------- | -| [FakeuploaddownloadfilePostResponses.EndpointResponse](../../paths/fakeuploaddownloadfile/post/FakeuploaddownloadfilePostResponses.md#endpointresponse) | [post](#post)([FakeuploaddownloadfilePost.PostRequest](../../paths/fakeuploaddownloadfile/FakeuploaddownloadfilePost.md#postrequest) request)
| - -## Method Detail - -### post -public [FakeuploaddownloadfilePostResponses.EndpointResponse](../../paths/fakeuploaddownloadfile/post/FakeuploaddownloadfilePostResponses.md#endpointresponse) post([FakeuploaddownloadfilePost.PostRequest](../../paths/fakeuploaddownloadfile/FakeuploaddownloadfilePost.md#postrequest) request) - - - -**Parameters:**
-request - the input request - -**Returns:**
-the deserialized response - -**Throws:**
-IOException, InterruptedException - an exception happened when making the request
-ValidationException - the returned response body or header values do not conform the the schema validation requirements
-NotImplementedException - the request body serialization or deserialization has not yet been implemented
- or the header content type deserialization has not yet been implemented for this contentType
-ApiException - server returned a response/contentType not defined in the openapi document
- -#### 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.fakeuploaddownloadfile.post.FakeuploaddownloadfilePostRequestBody; -import org.openapijsonschematools.client.paths.fakeuploaddownloadfile.post.requestbody.content.applicationoctetstream.ApplicationoctetstreamSchema; -import org.openapijsonschematools.client.servers.RootServer0; -import org.openapijsonschematools.client.servers.RootServer1; -import org.openapijsonschematools.client.servers.RootServer2; -import org.openapijsonschematools.client.paths.fakeuploaddownloadfile.post.responses.FakeuploaddownloadfilePostCode200Response; -import org.openapijsonschematools.client.servers.RootServerInfo; -import org.openapijsonschematools.client.apis.paths.Fakeuploaddownloadfile; -import org.openapijsonschematools.client.paths.fakeuploaddownloadfile.post.FakeuploaddownloadfilePostResponses; - -import java.io.IOException; -import java.util.Arrays; -import java.util.List; -import java.util.Map; -import java.util.AbstractMap; - -// if you want to use a server that is not SERVER_0 pass it in here and change the ServerIndex input below -ApiConfiguration.ServerInfo serverInfo = new ApiConfiguration.ServerInfoBuilder() - .rootServerInfo( - new RootServerInfo.RootServerInfoBuilder() - .rootServer0(new RootServer0()) - .build() - ) - .build(); -ApiConfiguration.ServerIndexInfo serverIndexInfo = new ApiConfiguration.ServerIndexInfoBuilder() - .rootServerInfoServerIndex(RootServerInfo.ServerIndex.SERVER_0) - .build(); -Duration timeout = Duration.ofSeconds(1L); -Map> defaultHeaders = Map.of("User-Agent", List.of("OpenAPI-JSON-Schema-Generator/1.0.0/java")); -ApiConfiguration apiConfiguration = new ApiConfiguration( - serverInfo - serverIndexInfo, - timeout, - defaultHeaders -); -SchemaConfiguration schemaConfiguration = new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().build()); -Fakeuploaddownloadfile apiClient = new Fakeuploaddownloadfile(apiConfiguration, schemaConfiguration); - - -ApplicationoctetstreamSchema1BoxedString requestBodyPayload = ApplicationoctetstreamSchema.ApplicationoctetstreamSchema1.validateAndBox( - "a", - schemaConfiguration -); -FakeuploaddownloadfilePost.SealedRequestBody requestBody = new FakeuploaddownloadfilePost.ApplicationoctetstreamRequestBody(requestBodyPayload); - -var request = new FakeuploaddownloadfilePost.PostRequestBuilder() - .requestBody(requestBody) - .build(); - -FakeuploaddownloadfilePostResponses.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; -} -FakeuploaddownloadfilePostResponses.EndpointFakeuploaddownloadfilePostCode200Response castResponse = (FakeuploaddownloadfilePostResponses.EndpointFakeuploaddownloadfilePostCode200Response) response; -FakeuploaddownloadfilePostCode200Response.ApplicationoctetstreamResponseBody deserializedBody = (FakeuploaddownloadfilePostCode200Response.ApplicationoctetstreamResponseBody) castResponse.body; -// handle deserialized body here -``` -[[Back to top]](#top) [[Back to README]](../../../README.md) diff --git a/samples/client/petstore/kotlin/docs/apis/paths/Fakeuploadfile.md b/samples/client/petstore/kotlin/docs/apis/paths/Fakeuploadfile.md deleted file mode 100644 index 4df05ea0937..00000000000 --- a/samples/client/petstore/kotlin/docs/apis/paths/Fakeuploadfile.md +++ /dev/null @@ -1,107 +0,0 @@ -# Fakeuploadfile - -public class Fakeuploadfile extends extends ApiClient implements -[FakeuploadfilePost.PostOperation](../../paths/fakeuploadfile/FakeuploadfilePost.md#postoperation) - -an api client class which contains all the routes for path="/fake/uploadFile" - -## Method Summary -| Modifier and Type | Method and Description | -| ----------------- | ---------------------- | -| [FakeuploadfilePostResponses.EndpointResponse](../../paths/fakeuploadfile/post/FakeuploadfilePostResponses.md#endpointresponse) | [post](#post)([FakeuploadfilePost.PostRequest](../../paths/fakeuploadfile/FakeuploadfilePost.md#postrequest) request)
| - -## Method Detail - -### post -public [FakeuploadfilePostResponses.EndpointResponse](../../paths/fakeuploadfile/post/FakeuploadfilePostResponses.md#endpointresponse) post([FakeuploadfilePost.PostRequest](../../paths/fakeuploadfile/FakeuploadfilePost.md#postrequest) request) - - - -**Parameters:**
-request - the input request - -**Returns:**
-the deserialized response - -**Throws:**
-IOException, InterruptedException - an exception happened when making the request
-ValidationException - the returned response body or header values do not conform the the schema validation requirements
-NotImplementedException - the request body serialization or deserialization has not yet been implemented
- or the header content type deserialization has not yet been implemented for this contentType
-ApiException - server returned a response/contentType not defined in the openapi document
- -#### 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.FakeuploadfilePostRequestBody; -import org.openapijsonschematools.client.paths.fakeuploadfile.post.requestbody.content.multipartformdata.MultipartformdataSchema; -import org.openapijsonschematools.client.RootServerInfo; -import org.openapijsonschematools.client.servers.RootServer0; -import org.openapijsonschematools.client.servers.RootServer1; -import org.openapijsonschematools.client.servers.RootServer2; -import org.openapijsonschematools.client.paths.fakeuploadfile.post.responses.FakeuploadfilePostCode200Response; -import org.openapijsonschematools.client.servers.RootServerInfo; -import org.openapijsonschematools.client.apis.paths.Fakeuploadfile; -import org.openapijsonschematools.client.paths.fakeuploadfile.post.FakeuploadfilePostResponses; - -import java.io.IOException; -import java.util.Arrays; -import java.util.List; -import java.util.Map; -import java.util.AbstractMap; - -// if you want to use a server that is not SERVER_0 pass it in here and change the ServerIndex input below -ApiConfiguration.ServerInfo serverInfo = new ApiConfiguration.ServerInfoBuilder() - .rootServerInfo( - new RootServerInfo.RootServerInfoBuilder() - .rootServer0(new RootServer0()) - .build() - ) - .build(); -ApiConfiguration.ServerIndexInfo serverIndexInfo = new ApiConfiguration.ServerIndexInfoBuilder() - .rootServerInfoServerIndex(RootServerInfo.ServerIndex.SERVER_0) - .build(); -Duration timeout = Duration.ofSeconds(1L); -Map> defaultHeaders = Map.of("User-Agent", List.of("OpenAPI-JSON-Schema-Generator/1.0.0/java")); -ApiConfiguration apiConfiguration = new ApiConfiguration( - serverInfo - serverIndexInfo, - timeout, - defaultHeaders -); -SchemaConfiguration schemaConfiguration = new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().build()); -Fakeuploadfile apiClient = new Fakeuploadfile(apiConfiguration, schemaConfiguration); - - -var request = new FakeuploadfilePost.PostRequestBuilder().build(); - -FakeuploadfilePostResponses.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; -} -FakeuploadfilePostResponses.EndpointFakeuploadfilePostCode200Response castResponse = (FakeuploadfilePostResponses.EndpointFakeuploadfilePostCode200Response) response; -FakeuploadfilePostCode200Response.ApplicationjsonResponseBody deserializedBody = (FakeuploadfilePostCode200Response.ApplicationjsonResponseBody) castResponse.body; -// handle deserialized body here -``` -[[Back to top]](#top) [[Back to README]](../../../README.md) diff --git a/samples/client/petstore/kotlin/docs/apis/paths/Fakeuploadfiles.md b/samples/client/petstore/kotlin/docs/apis/paths/Fakeuploadfiles.md deleted file mode 100644 index 3727c05c983..00000000000 --- a/samples/client/petstore/kotlin/docs/apis/paths/Fakeuploadfiles.md +++ /dev/null @@ -1,107 +0,0 @@ -# Fakeuploadfiles - -public class Fakeuploadfiles extends extends ApiClient implements -[FakeuploadfilesPost.PostOperation](../../paths/fakeuploadfiles/FakeuploadfilesPost.md#postoperation) - -an api client class which contains all the routes for path="/fake/uploadFiles" - -## Method Summary -| Modifier and Type | Method and Description | -| ----------------- | ---------------------- | -| [FakeuploadfilesPostResponses.EndpointResponse](../../paths/fakeuploadfiles/post/FakeuploadfilesPostResponses.md#endpointresponse) | [post](#post)([FakeuploadfilesPost.PostRequest](../../paths/fakeuploadfiles/FakeuploadfilesPost.md#postrequest) request)
| - -## Method Detail - -### post -public [FakeuploadfilesPostResponses.EndpointResponse](../../paths/fakeuploadfiles/post/FakeuploadfilesPostResponses.md#endpointresponse) post([FakeuploadfilesPost.PostRequest](../../paths/fakeuploadfiles/FakeuploadfilesPost.md#postrequest) request) - - - -**Parameters:**
-request - the input request - -**Returns:**
-the deserialized response - -**Throws:**
-IOException, InterruptedException - an exception happened when making the request
-ValidationException - the returned response body or header values do not conform the the schema validation requirements
-NotImplementedException - the request body serialization or deserialization has not yet been implemented
- or the header content type deserialization has not yet been implemented for this contentType
-ApiException - server returned a response/contentType not defined in the openapi document
- -#### 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.FakeuploadfilesPostRequestBody; -import org.openapijsonschematools.client.paths.fakeuploadfiles.post.requestbody.content.multipartformdata.MultipartformdataSchema; -import org.openapijsonschematools.client.RootServerInfo; -import org.openapijsonschematools.client.servers.RootServer0; -import org.openapijsonschematools.client.servers.RootServer1; -import org.openapijsonschematools.client.servers.RootServer2; -import org.openapijsonschematools.client.paths.fakeuploadfiles.post.responses.FakeuploadfilesPostCode200Response; -import org.openapijsonschematools.client.servers.RootServerInfo; -import org.openapijsonschematools.client.apis.paths.Fakeuploadfiles; -import org.openapijsonschematools.client.paths.fakeuploadfiles.post.FakeuploadfilesPostResponses; - -import java.io.IOException; -import java.util.Arrays; -import java.util.List; -import java.util.Map; -import java.util.AbstractMap; - -// if you want to use a server that is not SERVER_0 pass it in here and change the ServerIndex input below -ApiConfiguration.ServerInfo serverInfo = new ApiConfiguration.ServerInfoBuilder() - .rootServerInfo( - new RootServerInfo.RootServerInfoBuilder() - .rootServer0(new RootServer0()) - .build() - ) - .build(); -ApiConfiguration.ServerIndexInfo serverIndexInfo = new ApiConfiguration.ServerIndexInfoBuilder() - .rootServerInfoServerIndex(RootServerInfo.ServerIndex.SERVER_0) - .build(); -Duration timeout = Duration.ofSeconds(1L); -Map> defaultHeaders = Map.of("User-Agent", List.of("OpenAPI-JSON-Schema-Generator/1.0.0/java")); -ApiConfiguration apiConfiguration = new ApiConfiguration( - serverInfo - serverIndexInfo, - timeout, - defaultHeaders -); -SchemaConfiguration schemaConfiguration = new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().build()); -Fakeuploadfiles apiClient = new Fakeuploadfiles(apiConfiguration, schemaConfiguration); - - -var request = new FakeuploadfilesPost.PostRequestBuilder().build(); - -FakeuploadfilesPostResponses.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; -} -FakeuploadfilesPostResponses.EndpointFakeuploadfilesPostCode200Response castResponse = (FakeuploadfilesPostResponses.EndpointFakeuploadfilesPostCode200Response) response; -FakeuploadfilesPostCode200Response.ApplicationjsonResponseBody deserializedBody = (FakeuploadfilesPostCode200Response.ApplicationjsonResponseBody) castResponse.body; -// handle deserialized body here -``` -[[Back to top]](#top) [[Back to README]](../../../README.md) diff --git a/samples/client/petstore/kotlin/docs/apis/paths/Fakewildcardresponses.md b/samples/client/petstore/kotlin/docs/apis/paths/Fakewildcardresponses.md deleted file mode 100644 index 63b99413ddb..00000000000 --- a/samples/client/petstore/kotlin/docs/apis/paths/Fakewildcardresponses.md +++ /dev/null @@ -1,122 +0,0 @@ -# Fakewildcardresponses - -public class Fakewildcardresponses extends extends ApiClient implements -[FakewildcardresponsesGet.GetOperation](../../paths/fakewildcardresponses/FakewildcardresponsesGet.md#getoperation) - -an api client class which contains all the routes for path="/fake/wildCardResponses" - -## Method Summary -| Modifier and Type | Method and Description | -| ----------------- | ---------------------- | -| [FakewildcardresponsesGetResponses.EndpointResponse](../../paths/fakewildcardresponses/get/FakewildcardresponsesGetResponses.md#endpointresponse) | [get](#get)([FakewildcardresponsesGet.GetRequest](../../paths/fakewildcardresponses/FakewildcardresponsesGet.md#getrequest) request) | - -## Method Detail - -### get -public [FakewildcardresponsesGetResponses.EndpointResponse](../../paths/fakewildcardresponses/get/FakewildcardresponsesGetResponses.md#endpointresponse) get([FakewildcardresponsesGet.GetRequest](../../paths/fakewildcardresponses/FakewildcardresponsesGet.md#getrequest) request) - -**Parameters:**
-request - the input request - -**Returns:**
-the deserialized response - -**Throws:**
-IOException, InterruptedException - an exception happened when making the request
-ValidationException - the returned response body or header values do not conform the the schema validation requirements
-NotImplementedException - the request body serialization or deserialization has not yet been implemented
- or the header content type deserialization has not yet been implemented for this contentType
-ApiException - server returned a response/contentType not defined in the openapi document
- -#### 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.servers.RootServer0; -import org.openapijsonschematools.client.servers.RootServer1; -import org.openapijsonschematools.client.servers.RootServer2; -import org.openapijsonschematools.client.paths.fakewildcardresponses.get.responses.FakewildcardresponsesGetCode1XXResponse; -import org.openapijsonschematools.client.paths.fakewildcardresponses.get.responses.FakewildcardresponsesGetCode200Response; -import org.openapijsonschematools.client.paths.fakewildcardresponses.get.responses.FakewildcardresponsesGetCode2XXResponse; -import org.openapijsonschematools.client.paths.fakewildcardresponses.get.responses.FakewildcardresponsesGetCode3XXResponse; -import org.openapijsonschematools.client.paths.fakewildcardresponses.get.responses.FakewildcardresponsesGetCode4XXResponse; -import org.openapijsonschematools.client.paths.fakewildcardresponses.get.responses.FakewildcardresponsesGetCode5XXResponse; -import org.openapijsonschematools.client.servers.RootServerInfo; -import org.openapijsonschematools.client.apis.paths.Fakewildcardresponses; -import org.openapijsonschematools.client.paths.fakewildcardresponses.get.FakewildcardresponsesGetResponses; - -import java.io.IOException; -import java.util.Arrays; -import java.util.List; -import java.util.Map; -import java.util.AbstractMap; - -// if you want to use a server that is not SERVER_0 pass it in here and change the ServerIndex input below -ApiConfiguration.ServerInfo serverInfo = new ApiConfiguration.ServerInfoBuilder() - .rootServerInfo( - new RootServerInfo.RootServerInfoBuilder() - .rootServer0(new RootServer0()) - .build() - ) - .build(); -ApiConfiguration.ServerIndexInfo serverIndexInfo = new ApiConfiguration.ServerIndexInfoBuilder() - .rootServerInfoServerIndex(RootServerInfo.ServerIndex.SERVER_0) - .build(); -Duration timeout = Duration.ofSeconds(1L); -Map> defaultHeaders = Map.of("User-Agent", List.of("OpenAPI-JSON-Schema-Generator/1.0.0/java")); -ApiConfiguration apiConfiguration = new ApiConfiguration( - serverInfo - serverIndexInfo, - timeout, - defaultHeaders -); -SchemaConfiguration schemaConfiguration = new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().build()); -Fakewildcardresponses apiClient = new Fakewildcardresponses(apiConfiguration, schemaConfiguration); - - -var request = new FakewildcardresponsesGet.GetRequestBuilder().build(); - -FakewildcardresponsesGetResponses.EndpointResponse response; -try { - response = apiClient.get(request); -} catch (FakewildcardresponsesGetCode4XXResponse.ResponseApiException | FakewildcardresponsesGetCode5XXResponse.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; -} -if (response instanceof FakewildcardresponsesGetResponses.EndpointFakewildcardresponsesGetCode1XXResponse castResponse) { - FakewildcardresponsesGetCode1XXResponse.ApplicationjsonResponseBody deserializedBody = (FakewildcardresponsesGetCode1XXResponse.ApplicationjsonResponseBody) castResponse.body; - // handle deserialized body here -} else if (response instanceof FakewildcardresponsesGetResponses.EndpointFakewildcardresponsesGetCode2XXResponse castResponse) { - FakewildcardresponsesGetCode2XXResponse.ApplicationjsonResponseBody deserializedBody = (FakewildcardresponsesGetCode2XXResponse.ApplicationjsonResponseBody) castResponse.body; - // handle deserialized body here -} else if (response instanceof FakewildcardresponsesGetResponses.EndpointFakewildcardresponsesGetCode200Response castResponse) { - FakewildcardresponsesGetCode200Response.ApplicationjsonResponseBody deserializedBody = (FakewildcardresponsesGetCode200Response.ApplicationjsonResponseBody) castResponse.body; - // handle deserialized body here -} else { - FakewildcardresponsesGetResponses.EndpointFakewildcardresponsesGetCode3XXResponse castResponse = (FakewildcardresponsesGetResponses.EndpointFakewildcardresponsesGetCode3XXResponse) response; - FakewildcardresponsesGetCode3XXResponse.ApplicationjsonResponseBody deserializedBody = (FakewildcardresponsesGetCode3XXResponse.ApplicationjsonResponseBody) castResponse.body; - // handle deserialized body here -} -``` -[[Back to top]](#top) [[Back to README]](../../../README.md) diff --git a/samples/client/petstore/kotlin/docs/apis/paths/Foo.md b/samples/client/petstore/kotlin/docs/apis/paths/Foo.md deleted file mode 100644 index 17405cb7e38..00000000000 --- a/samples/client/petstore/kotlin/docs/apis/paths/Foo.md +++ /dev/null @@ -1,102 +0,0 @@ -# Foo - -public class Foo extends extends ApiClient implements -[FooGet.GetOperation](../../paths/foo/FooGet.md#getoperation) - -an api client class which contains all the routes for path="/foo" - -## Method Summary -| Modifier and Type | Method and Description | -| ----------------- | ---------------------- | -| [FooGetResponses.EndpointResponse](../../paths/foo/get/FooGetResponses.md#endpointresponse) | [get](#get)([FooGet.GetRequest](../../paths/foo/FooGet.md#getrequest) request) | - -## Method Detail - -### get -public [FooGetResponses.EndpointResponse](../../paths/foo/get/FooGetResponses.md#endpointresponse) get([FooGet.GetRequest](../../paths/foo/FooGet.md#getrequest) request) - -**Parameters:**
-request - the input request - -**Returns:**
-the deserialized response - -**Throws:**
-IOException, InterruptedException - an exception happened when making the request
-ValidationException - the returned response body or header values do not conform the the schema validation requirements
-NotImplementedException - the request body serialization or deserialization has not yet been implemented
- or the header content type deserialization has not yet been implemented for this contentType
-ApiException - server returned a response/contentType not defined in the openapi document
- -#### 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.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.FooGetCodedefaultResponse; -import org.openapijsonschematools.client.paths.foo.get.FooGetServerInfo; -import org.openapijsonschematools.client.apis.paths.Foo; -import org.openapijsonschematools.client.paths.foo.get.FooGetResponses; - -import java.io.IOException; -import java.util.Arrays; -import java.util.List; -import java.util.Map; -import java.util.AbstractMap; - -// if you want to use a server that is not SERVER_0 pass it in here and change the ServerIndex input below -ApiConfiguration.ServerInfo serverInfo = new ApiConfiguration.ServerInfoBuilder() - .fooGetServerInfo( - new FooGetServerInfo.FooGetServerInfoBuilder() - .fooGetServer0(new FooGetServer0()) - .build() - ) - .build(); -ApiConfiguration.ServerIndexInfo serverIndexInfo = new ApiConfiguration.ServerIndexInfoBuilder() - .fooGetServerInfoServerIndex(FooGetServerInfo.ServerIndex.SERVER_0) - .build(); -Duration timeout = Duration.ofSeconds(1L); -Map> defaultHeaders = Map.of("User-Agent", List.of("OpenAPI-JSON-Schema-Generator/1.0.0/java")); -ApiConfiguration apiConfiguration = new ApiConfiguration( - serverInfo - serverIndexInfo, - timeout, - defaultHeaders -); -SchemaConfiguration schemaConfiguration = new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().build()); -Foo apiClient = new Foo(apiConfiguration, schemaConfiguration); - - -var request = new FooGet.GetRequestBuilder().build(); - -FooGetResponses.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; -} -FooGetResponses.EndpointFooGetCodedefaultResponse castResponse = (FooGetResponses.EndpointFooGetCodedefaultResponse) response; -FooGetCodedefaultResponse.ApplicationjsonResponseBody deserializedBody = (FooGetCodedefaultResponse.ApplicationjsonResponseBody) castResponse.body; -// handle deserialized body here -``` -[[Back to top]](#top) [[Back to README]](../../../README.md) diff --git a/samples/client/petstore/kotlin/docs/apis/paths/Pet.md b/samples/client/petstore/kotlin/docs/apis/paths/Pet.md deleted file mode 100644 index fc0900e10c6..00000000000 --- a/samples/client/petstore/kotlin/docs/apis/paths/Pet.md +++ /dev/null @@ -1,315 +0,0 @@ -# Pet - -public class Pet extends extends ApiClient implements -[PetPost.PostOperation](../../paths/pet/PetPost.md#postoperation), -[PetPut.PutOperation](../../paths/pet/PetPut.md#putoperation) - -an api client class which contains all the routes for path="/pet" - -## Method Summary -| Modifier and Type | Method and Description | -| ----------------- | ---------------------- | -| [PetPostResponses.EndpointResponse](../../paths/pet/post/PetPostResponses.md#endpointresponse) | [post](#post)([PetPost.PostRequest](../../paths/pet/PetPost.md#postrequest) request)
Add a new pet to the store | -| Nothing? | [put](#put)([PetPut.PutRequest](../../paths/pet/PetPut.md#putrequest) request)
| - -## Method Detail - -### post -public [PetPostResponses.EndpointResponse](../../paths/pet/post/PetPostResponses.md#endpointresponse) post([PetPost.PostRequest](../../paths/pet/PetPost.md#postrequest) request) - -Add a new pet to the store - -**Parameters:**
-request - the input request - -**Returns:**
-the deserialized response - -**Throws:**
-IOException, InterruptedException - an exception happened when making the request
-ValidationException - the returned response body or header values do not conform the the schema validation requirements
-NotImplementedException - the request body serialization or deserialization has not yet been implemented
- or the header content type deserialization has not yet been implemented for this contentType
-ApiException - server returned a response/contentType not defined in the openapi document
- -#### 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.PetPostRequestBody; -import org.openapijsonschematools.client.components.schemas.Pet; -import org.openapijsonschematools.client.servers.RootServer0; -import org.openapijsonschematools.client.servers.RootServer1; -import org.openapijsonschematools.client.servers.RootServer2; -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.PetPostCode200Response; -import org.openapijsonschematools.client.paths.pet.post.responses.PetPostCode405Response; -import org.openapijsonschematools.client.servers.RootServerInfo; -import org.openapijsonschematools.client.apis.paths.Pet; -import org.openapijsonschematools.client.paths.pet.post.PetPostResponses; - -import java.io.IOException; -import java.util.Arrays; -import java.util.List; -import java.util.Map; -import java.util.AbstractMap; - -// if you want to use a server that is not SERVER_0 pass it in here and change the ServerIndex input below -ApiConfiguration.ServerInfo serverInfo = new ApiConfiguration.ServerInfoBuilder() - .rootServerInfo( - new RootServerInfo.RootServerInfoBuilder() - .rootServer0(new RootServer0()) - .build() - ) - .build(); -ApiConfiguration.ServerIndexInfo serverIndexInfo = new ApiConfiguration.ServerIndexInfoBuilder() - .rootServerInfoServerIndex(RootServerInfo.ServerIndex.SERVER_0) - .build(); -List securitySchemes = new ArrayList(); -securitySchemes.add( - new ApiKey("someApiKey"); -); -ApiConfiguration.SecurityIndexInfo securityIndexInfo = new ApiConfiguration.SecurityIndexInfoBuilder() - .petPostSecurityRequirementObject0SecurityIndex(PetPostSecurityRequirementObject0.SecurityIndex.SECURITY_0) - .build(); -Duration timeout = Duration.ofSeconds(1L); -Map> defaultHeaders = Map.of("User-Agent", List.of("OpenAPI-JSON-Schema-Generator/1.0.0/java")); -ApiConfiguration apiConfiguration = new ApiConfiguration( - serverInfo - serverIndexInfo, - securitySchemes, - securityIndexInfo, - timeout, - defaultHeaders -); -SchemaConfiguration schemaConfiguration = new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().build()); -Pet apiClient = new Pet(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 -); -PetPostRequestBody.SealedRequestBody requestBody = new PetPostRequestBody.ApplicationjsonRequestBody(requestBodyPayload); - -var request = new PetPost.PostRequestBuilder() - .requestBody(requestBody) - .build(); - -PetPostResponses.EndpointResponse response; -try { - response = apiClient.post(request); -} catch (PetPostCode405Response.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; -} -PetPostResponses.EndpointPetPostCode200Response castResponse = (PetPostResponses.EndpointPetPostCode200Response) response; -``` -### put -public Nothing? put([PetPut.PutRequest](../../paths/pet/PetPut.md#putrequest) request) - - - -**Parameters:**
-request - the input request - -**Returns:**
-nothing (Nothing?) - -**Throws:**
-IOException, InterruptedException - an exception happened when making the request
-ValidationException - the returned response body or header values do not conform the the schema validation requirements
-NotImplementedException - the request body serialization or deserialization has not yet been implemented
- or the header content type deserialization has not yet been implemented for this contentType
-ApiException - server returned a response/contentType not defined in the openapi document
- -#### 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.PetPutRequestBody; -import org.openapijsonschematools.client.components.schemas.Pet; -import org.openapijsonschematools.client.servers.RootServer0; -import org.openapijsonschematools.client.servers.RootServer1; -import org.openapijsonschematools.client.servers.RootServer2; -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.pet.put.responses.PetPutCode400Response; -import org.openapijsonschematools.client.paths.pet.put.responses.PetPutCode404Response; -import org.openapijsonschematools.client.paths.pet.put.responses.PetPutCode405Response; -import org.openapijsonschematools.client.servers.RootServerInfo; -import org.openapijsonschematools.client.apis.paths.Pet; -import org.openapijsonschematools.client.paths.pet.put.PetPutResponses; - -import java.io.IOException; -import java.util.Arrays; -import java.util.List; -import java.util.Map; -import java.util.AbstractMap; - -// if you want to use a server that is not SERVER_0 pass it in here and change the ServerIndex input below -ApiConfiguration.ServerInfo serverInfo = new ApiConfiguration.ServerInfoBuilder() - .rootServerInfo( - new RootServerInfo.RootServerInfoBuilder() - .rootServer0(new RootServer0()) - .build() - ) - .build(); -ApiConfiguration.ServerIndexInfo serverIndexInfo = new ApiConfiguration.ServerIndexInfoBuilder() - .rootServerInfoServerIndex(RootServerInfo.ServerIndex.SERVER_0) - .build(); -List securitySchemes = new ArrayList(); -ApiConfiguration.SecurityIndexInfo securityIndexInfo = new ApiConfiguration.SecurityIndexInfoBuilder() - .petPutSecurityRequirementObject0SecurityIndex(PetPutSecurityRequirementObject0.SecurityIndex.SECURITY_0) - .build(); -Duration timeout = Duration.ofSeconds(1L); -Map> defaultHeaders = Map.of("User-Agent", List.of("OpenAPI-JSON-Schema-Generator/1.0.0/java")); -ApiConfiguration apiConfiguration = new ApiConfiguration( - serverInfo - serverIndexInfo, - securitySchemes, - securityIndexInfo, - timeout, - defaultHeaders -); -SchemaConfiguration schemaConfiguration = new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().build()); -Pet apiClient = new Pet(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 -); -PetPutRequestBody.SealedRequestBody requestBody = new PetPutRequestBody.ApplicationjsonRequestBody(requestBodyPayload); - -var request = new PetPut.PutRequestBuilder() - .requestBody(requestBody) - .build(); - -Nothing? response; -try { - response = apiClient.put(request); -} catch (PetPutCode400Response.ResponseApiException | PetPutCode404Response.ResponseApiException | PetPutCode405Response.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; -} -``` -[[Back to top]](#top) [[Back to README]](../../../README.md) diff --git a/samples/client/petstore/kotlin/docs/apis/paths/Petfindbystatus.md b/samples/client/petstore/kotlin/docs/apis/paths/Petfindbystatus.md deleted file mode 100644 index 475c6b547b9..00000000000 --- a/samples/client/petstore/kotlin/docs/apis/paths/Petfindbystatus.md +++ /dev/null @@ -1,137 +0,0 @@ -# Petfindbystatus - -public class Petfindbystatus extends extends ApiClient implements -[PetfindbystatusGet.GetOperation](../../paths/petfindbystatus/PetfindbystatusGet.md#getoperation) - -an api client class which contains all the routes for path="/pet/findByStatus" - -## Method Summary -| Modifier and Type | Method and Description | -| ----------------- | ---------------------- | -| [PetfindbystatusGetResponses.EndpointResponse](../../paths/petfindbystatus/get/PetfindbystatusGetResponses.md#endpointresponse) | [get](#get)([PetfindbystatusGet.GetRequest](../../paths/petfindbystatus/PetfindbystatusGet.md#getrequest) request)
Multiple status values can be provided with comma separated strings | - -## Method Detail - -### get -public [PetfindbystatusGetResponses.EndpointResponse](../../paths/petfindbystatus/get/PetfindbystatusGetResponses.md#endpointresponse) get([PetfindbystatusGet.GetRequest](../../paths/petfindbystatus/PetfindbystatusGet.md#getrequest) request) - -Multiple status values can be provided with comma separated strings - -**Parameters:**
-request - the input request - -**Returns:**
-the deserialized response - -**Throws:**
-IOException, InterruptedException - an exception happened when making the request
-ValidationException - the returned response body or header values do not conform the the schema validation requirements
-NotImplementedException - the request body serialization or deserialization has not yet been implemented
- or the header content type deserialization has not yet been implemented for this contentType
-ApiException - server returned a response/contentType not defined in the openapi document
- -#### 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.petfindbystatus.PetfindbystatusServerInfo; -import org.openapijsonschematools.client.paths.petfindbystatus.get.PetfindbystatusGetSecurityInfo; -import org.openapijsonschematools.client.paths.petfindbystatus.get.PetfindbystatusGetQueryParameters; -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.PetfindbystatusGetCode200Response; -import org.openapijsonschematools.client.paths.petfindbystatus.get.responses.PetfindbystatusGetCode400Response; -import org.openapijsonschematools.client.paths.petfindbystatus.PetfindbystatusServerInfo; -import org.openapijsonschematools.client.apis.paths.Petfindbystatus; -import org.openapijsonschematools.client.paths.petfindbystatus.get.PetfindbystatusGetResponses; - -import java.io.IOException; -import java.util.Arrays; -import java.util.List; -import java.util.Map; -import java.util.AbstractMap; - -// if you want to use a server that is not SERVER_0 pass it in here and change the ServerIndex input below -ApiConfiguration.ServerInfo serverInfo = new ApiConfiguration.ServerInfoBuilder() - .petfindbystatusServerInfo( - new PetfindbystatusServerInfo.PetfindbystatusServerInfoBuilder() - .petfindbystatusServer0(new PetfindbystatusServer0()) - .build() - ) - .build(); -ApiConfiguration.ServerIndexInfo serverIndexInfo = new ApiConfiguration.ServerIndexInfoBuilder() - .petfindbystatusServerInfoServerIndex(PetfindbystatusServerInfo.ServerIndex.SERVER_0) - .build(); -List securitySchemes = new ArrayList(); -securitySchemes.add( - new ApiKey("someApiKey"); -); -ApiConfiguration.SecurityIndexInfo securityIndexInfo = new ApiConfiguration.SecurityIndexInfoBuilder() - .petfindbystatusGetSecurityRequirementObject0SecurityIndex(PetfindbystatusGetSecurityRequirementObject0.SecurityIndex.SECURITY_0) - .build(); -Duration timeout = Duration.ofSeconds(1L); -Map> defaultHeaders = Map.of("User-Agent", List.of("OpenAPI-JSON-Schema-Generator/1.0.0/java")); -ApiConfiguration apiConfiguration = new ApiConfiguration( - serverInfo - serverIndexInfo, - securitySchemes, - securityIndexInfo, - timeout, - defaultHeaders -); -SchemaConfiguration schemaConfiguration = new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().build()); -Petfindbystatus apiClient = new Petfindbystatus(apiConfiguration, schemaConfiguration); - - -// Map validation -PetfindbystatusGetQueryParameters.QueryParametersMap queryParameters = - PetfindbystatusGetQueryParameters.PetfindbystatusGetQueryParameters1.validate( - new PetfindbystatusGetQueryParameters.QueryParametersMapBuilder() - .status( - Arrays.asList( - "available" - ) - ) - .build(), - schemaConfiguration -); - -var request = new PetfindbystatusGet.GetRequestBuilder() - .queryParameters(queryParameters) - .build(); - -PetfindbystatusGetResponses.EndpointResponse response; -try { - response = apiClient.get(request); -} catch (PetfindbystatusGetCode400Response.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; -} -PetfindbystatusGetResponses.EndpointPetfindbystatusGetCode200Response castResponse = (PetfindbystatusGetResponses.EndpointPetfindbystatusGetCode200Response) response; -} -``` -[[Back to top]](#top) [[Back to README]](../../../README.md) diff --git a/samples/client/petstore/kotlin/docs/apis/paths/Petfindbytags.md b/samples/client/petstore/kotlin/docs/apis/paths/Petfindbytags.md deleted file mode 100644 index b3273aa91ce..00000000000 --- a/samples/client/petstore/kotlin/docs/apis/paths/Petfindbytags.md +++ /dev/null @@ -1,134 +0,0 @@ -# Petfindbytags - -public class Petfindbytags extends extends ApiClient implements -[PetfindbytagsGet.GetOperation](../../paths/petfindbytags/PetfindbytagsGet.md#getoperation) - -an api client class which contains all the routes for path="/pet/findByTags" - -## Method Summary -| Modifier and Type | Method and Description | -| ----------------- | ---------------------- | -| [PetfindbytagsGetResponses.EndpointResponse](../../paths/petfindbytags/get/PetfindbytagsGetResponses.md#endpointresponse) | [get](#get)([PetfindbytagsGet.GetRequest](../../paths/petfindbytags/PetfindbytagsGet.md#getrequest) request)
Multiple tags can be provided with comma separated strings. Use tag1, tag2, tag3 for testing. | - -## Method Detail - -### get -public [PetfindbytagsGetResponses.EndpointResponse](../../paths/petfindbytags/get/PetfindbytagsGetResponses.md#endpointresponse) get([PetfindbytagsGet.GetRequest](../../paths/petfindbytags/PetfindbytagsGet.md#getrequest) request) - -Multiple tags can be provided with comma separated strings. Use tag1, tag2, tag3 for testing. - -**Parameters:**
-request - the input request - -**Returns:**
-the deserialized response - -**Throws:**
-IOException, InterruptedException - an exception happened when making the request
-ValidationException - the returned response body or header values do not conform the the schema validation requirements
-NotImplementedException - the request body serialization or deserialization has not yet been implemented
- or the header content type deserialization has not yet been implemented for this contentType
-ApiException - server returned a response/contentType not defined in the openapi document
- -#### 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.petfindbytags.get.PetfindbytagsGetSecurityInfo; -import org.openapijsonschematools.client.paths.petfindbytags.get.PetfindbytagsGetQueryParameters; -import org.openapijsonschematools.client.servers.RootServer0; -import org.openapijsonschematools.client.servers.RootServer1; -import org.openapijsonschematools.client.servers.RootServer2; -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.PetfindbytagsGetCode200Response; -import org.openapijsonschematools.client.paths.petfindbytags.get.responses.PetfindbytagsGetCode400Response; -import org.openapijsonschematools.client.servers.RootServerInfo; -import org.openapijsonschematools.client.apis.paths.Petfindbytags; -import org.openapijsonschematools.client.paths.petfindbytags.get.PetfindbytagsGetResponses; - -import java.io.IOException; -import java.util.Arrays; -import java.util.List; -import java.util.Map; -import java.util.AbstractMap; - -// if you want to use a server that is not SERVER_0 pass it in here and change the ServerIndex input below -ApiConfiguration.ServerInfo serverInfo = new ApiConfiguration.ServerInfoBuilder() - .rootServerInfo( - new RootServerInfo.RootServerInfoBuilder() - .rootServer0(new RootServer0()) - .build() - ) - .build(); -ApiConfiguration.ServerIndexInfo serverIndexInfo = new ApiConfiguration.ServerIndexInfoBuilder() - .rootServerInfoServerIndex(RootServerInfo.ServerIndex.SERVER_0) - .build(); -List securitySchemes = new ArrayList(); -ApiConfiguration.SecurityIndexInfo securityIndexInfo = new ApiConfiguration.SecurityIndexInfoBuilder() - .petfindbytagsGetSecurityRequirementObject0SecurityIndex(PetfindbytagsGetSecurityRequirementObject0.SecurityIndex.SECURITY_0) - .build(); -Duration timeout = Duration.ofSeconds(1L); -Map> defaultHeaders = Map.of("User-Agent", List.of("OpenAPI-JSON-Schema-Generator/1.0.0/java")); -ApiConfiguration apiConfiguration = new ApiConfiguration( - serverInfo - serverIndexInfo, - securitySchemes, - securityIndexInfo, - timeout, - defaultHeaders -); -SchemaConfiguration schemaConfiguration = new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().build()); -Petfindbytags apiClient = new Petfindbytags(apiConfiguration, schemaConfiguration); - - -// Map validation -PetfindbytagsGetQueryParameters.QueryParametersMap queryParameters = - PetfindbytagsGetQueryParameters.PetfindbytagsGetQueryParameters1.validate( - new PetfindbytagsGetQueryParameters.QueryParametersMapBuilder() - .tags( - Arrays.asList( - "a" - ) - ) - .build(), - schemaConfiguration -); - -var request = new PetfindbytagsGet.GetRequestBuilder() - .queryParameters(queryParameters) - .build(); - -PetfindbytagsGetResponses.EndpointResponse response; -try { - response = apiClient.get(request); -} catch (PetfindbytagsGetCode400Response.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; -} -PetfindbytagsGetResponses.EndpointPetfindbytagsGetCode200Response castResponse = (PetfindbytagsGetResponses.EndpointPetfindbytagsGetCode200Response) response; -} -``` -[[Back to top]](#top) [[Back to README]](../../../README.md) diff --git a/samples/client/petstore/kotlin/docs/apis/paths/Petpetid.md b/samples/client/petstore/kotlin/docs/apis/paths/Petpetid.md deleted file mode 100644 index a7e43426511..00000000000 --- a/samples/client/petstore/kotlin/docs/apis/paths/Petpetid.md +++ /dev/null @@ -1,377 +0,0 @@ -# Petpetid - -public class Petpetid extends extends ApiClient implements -[PetpetidDelete.DeleteOperation](../../paths/petpetid/PetpetidDelete.md#deleteoperation), -[PetpetidGet.GetOperation](../../paths/petpetid/PetpetidGet.md#getoperation), -[PetpetidPost.PostOperation](../../paths/petpetid/PetpetidPost.md#postoperation) - -an api client class which contains all the routes for path="/pet/{petId}" - -## Method Summary -| Modifier and Type | Method and Description | -| ----------------- | ---------------------- | -| Nothing? | [delete](#delete)([PetpetidDelete.DeleteRequest](../../paths/petpetid/PetpetidDelete.md#deleterequest) request)
| -| [PetpetidGetResponses.EndpointResponse](../../paths/petpetid/get/PetpetidGetResponses.md#endpointresponse) | [get](#get)([PetpetidGet.GetRequest](../../paths/petpetid/PetpetidGet.md#getrequest) request)
Returns a single pet | -| Nothing? | [post](#post)([PetpetidPost.PostRequest](../../paths/petpetid/PetpetidPost.md#postrequest) request)
| - -## Method Detail - -### delete -public Nothing? delete([PetpetidDelete.DeleteRequest](../../paths/petpetid/PetpetidDelete.md#deleterequest) request) - - - -**Parameters:**
-request - the input request - -**Returns:**
-nothing (Nothing?) - -**Throws:**
-IOException, InterruptedException - an exception happened when making the request
-ValidationException - the returned response body or header values do not conform the the schema validation requirements
-NotImplementedException - the request body serialization or deserialization has not yet been implemented
- or the header content type deserialization has not yet been implemented for this contentType
-ApiException - server returned a response/contentType not defined in the openapi document
- -#### 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.PetpetidDeleteHeaderParameters; -import org.openapijsonschematools.client.RootServerInfo; -import org.openapijsonschematools.client.paths.petpetid.delete.PetpetidDeleteSecurityInfo; -import org.openapijsonschematools.client.paths.petpetid.delete.PetpetidDeletePathParameters; -import org.openapijsonschematools.client.servers.RootServer0; -import org.openapijsonschematools.client.servers.RootServer1; -import org.openapijsonschematools.client.servers.RootServer2; -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.PetpetidDeleteCode400Response; -import org.openapijsonschematools.client.servers.RootServerInfo; -import org.openapijsonschematools.client.apis.paths.Petpetid; -import org.openapijsonschematools.client.paths.petpetid.delete.PetpetidDeleteResponses; - -import java.io.IOException; -import java.util.Arrays; -import java.util.List; -import java.util.Map; -import java.util.AbstractMap; - -// if you want to use a server that is not SERVER_0 pass it in here and change the ServerIndex input below -ApiConfiguration.ServerInfo serverInfo = new ApiConfiguration.ServerInfoBuilder() - .rootServerInfo( - new RootServerInfo.RootServerInfoBuilder() - .rootServer0(new RootServer0()) - .build() - ) - .build(); -ApiConfiguration.ServerIndexInfo serverIndexInfo = new ApiConfiguration.ServerIndexInfoBuilder() - .rootServerInfoServerIndex(RootServerInfo.ServerIndex.SERVER_0) - .build(); -List securitySchemes = new ArrayList(); -securitySchemes.add( - new ApiKey("someApiKey"); -); -ApiConfiguration.SecurityIndexInfo securityIndexInfo = new ApiConfiguration.SecurityIndexInfoBuilder() - .petpetidDeleteSecurityRequirementObject0SecurityIndex(PetpetidDeleteSecurityRequirementObject0.SecurityIndex.SECURITY_0) - .build(); -Duration timeout = Duration.ofSeconds(1L); -Map> defaultHeaders = Map.of("User-Agent", List.of("OpenAPI-JSON-Schema-Generator/1.0.0/java")); -ApiConfiguration apiConfiguration = new ApiConfiguration( - serverInfo - serverIndexInfo, - securitySchemes, - securityIndexInfo, - timeout, - defaultHeaders -); -SchemaConfiguration schemaConfiguration = new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().build()); -Petpetid apiClient = new Petpetid(apiConfiguration, schemaConfiguration); - - -// Map validation -PetpetidDeletePathParameters.PathParametersMap pathParameters = - PetpetidDeletePathParameters.PetpetidDeletePathParameters1.validate( - new PetpetidDeletePathParameters.PathParametersMapBuilder() - .petId(1L) - - .build(), - schemaConfiguration -); - -var request = new PetpetidDelete.DeleteRequestBuilder() - .pathParameters(pathParameters) - .build(); - -Nothing? response; -try { - response = apiClient.delete(request); -} catch (PetpetidDeleteCode400Response.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; -} -``` -### get -public [PetpetidGetResponses.EndpointResponse](../../paths/petpetid/get/PetpetidGetResponses.md#endpointresponse) get([PetpetidGet.GetRequest](../../paths/petpetid/PetpetidGet.md#getrequest) request) - -Returns a single pet - -**Parameters:**
-request - the input request - -**Returns:**
-the deserialized response - -**Throws:**
-IOException, InterruptedException - an exception happened when making the request
-ValidationException - the returned response body or header values do not conform the the schema validation requirements
-NotImplementedException - the request body serialization or deserialization has not yet been implemented
- or the header content type deserialization has not yet been implemented for this contentType
-ApiException - server returned a response/contentType not defined in the openapi document
- -#### 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.petpetid.get.PetpetidGetSecurityInfo; -import org.openapijsonschematools.client.paths.petpetid.get.PetpetidGetPathParameters; -import org.openapijsonschematools.client.servers.RootServer0; -import org.openapijsonschematools.client.servers.RootServer1; -import org.openapijsonschematools.client.servers.RootServer2; -import org.openapijsonschematools.client.securityschemes.SecurityScheme; -import org.openapijsonschematools.client.components.securityschemes.ApiKey; -import org.openapijsonschematools.client.paths.petpetid.get.responses.PetpetidGetCode200Response; -import org.openapijsonschematools.client.paths.petpetid.get.responses.PetpetidGetCode400Response; -import org.openapijsonschematools.client.paths.petpetid.get.responses.PetpetidGetCode404Response; -import org.openapijsonschematools.client.servers.RootServerInfo; -import org.openapijsonschematools.client.apis.paths.Petpetid; -import org.openapijsonschematools.client.paths.petpetid.get.PetpetidGetResponses; - -import java.io.IOException; -import java.util.Arrays; -import java.util.List; -import java.util.Map; -import java.util.AbstractMap; - -// if you want to use a server that is not SERVER_0 pass it in here and change the ServerIndex input below -ApiConfiguration.ServerInfo serverInfo = new ApiConfiguration.ServerInfoBuilder() - .rootServerInfo( - new RootServerInfo.RootServerInfoBuilder() - .rootServer0(new RootServer0()) - .build() - ) - .build(); -ApiConfiguration.ServerIndexInfo serverIndexInfo = new ApiConfiguration.ServerIndexInfoBuilder() - .rootServerInfoServerIndex(RootServerInfo.ServerIndex.SERVER_0) - .build(); -List securitySchemes = new ArrayList(); -securitySchemes.add( - new ApiKey("someApiKey"); -); -ApiConfiguration.SecurityIndexInfo securityIndexInfo = new ApiConfiguration.SecurityIndexInfoBuilder() - .petpetidGetSecurityRequirementObject0SecurityIndex(PetpetidGetSecurityRequirementObject0.SecurityIndex.SECURITY_0) - .build(); -Duration timeout = Duration.ofSeconds(1L); -Map> defaultHeaders = Map.of("User-Agent", List.of("OpenAPI-JSON-Schema-Generator/1.0.0/java")); -ApiConfiguration apiConfiguration = new ApiConfiguration( - serverInfo - serverIndexInfo, - securitySchemes, - securityIndexInfo, - timeout, - defaultHeaders -); -SchemaConfiguration schemaConfiguration = new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().build()); -Petpetid apiClient = new Petpetid(apiConfiguration, schemaConfiguration); - - -// Map validation -PetpetidGetPathParameters.PathParametersMap pathParameters = - PetpetidGetPathParameters.PetpetidGetPathParameters1.validate( - new PetpetidGetPathParameters.PathParametersMapBuilder() - .petId(1L) - - .build(), - schemaConfiguration -); - -var request = new PetpetidGet.GetRequestBuilder() - .pathParameters(pathParameters) - .build(); - -PetpetidGetResponses.EndpointResponse response; -try { - response = apiClient.get(request); -} catch (PetpetidGetCode400Response.ResponseApiException | PetpetidGetCode404Response.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; -} -PetpetidGetResponses.EndpointPetpetidGetCode200Response castResponse = (PetpetidGetResponses.EndpointPetpetidGetCode200Response) response; -if (castResponse.body instanceof PetpetidGetCode200Response.ApplicationxmlResponseBody deserializedBody) { - // handle deserialized body here -} else { - PetpetidGetCode200Response.ApplicationjsonResponseBody deserializedBody = (PetpetidGetCode200Response.ApplicationjsonResponseBody) castResponse.body; - // handle deserialized body here -} -``` -### post -public Nothing? post([PetpetidPost.PostRequest](../../paths/petpetid/PetpetidPost.md#postrequest) request) - - - -**Parameters:**
-request - the input request - -**Returns:**
-nothing (Nothing?) - -**Throws:**
-IOException, InterruptedException - an exception happened when making the request
-ValidationException - the returned response body or header values do not conform the the schema validation requirements
-NotImplementedException - the request body serialization or deserialization has not yet been implemented
- or the header content type deserialization has not yet been implemented for this contentType
-ApiException - server returned a response/contentType not defined in the openapi document
- -#### 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.PetpetidPostRequestBody; -import org.openapijsonschematools.client.RootServerInfo; -import org.openapijsonschematools.client.paths.petpetid.post.PetpetidPostSecurityInfo; -import org.openapijsonschematools.client.paths.petpetid.post.PetpetidPostPathParameters; -import org.openapijsonschematools.client.servers.RootServer0; -import org.openapijsonschematools.client.servers.RootServer1; -import org.openapijsonschematools.client.servers.RootServer2; -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.PetpetidPostCode405Response; -import org.openapijsonschematools.client.servers.RootServerInfo; -import org.openapijsonschematools.client.apis.paths.Petpetid; -import org.openapijsonschematools.client.paths.petpetid.post.PetpetidPostResponses; - -import java.io.IOException; -import java.util.Arrays; -import java.util.List; -import java.util.Map; -import java.util.AbstractMap; - -// if you want to use a server that is not SERVER_0 pass it in here and change the ServerIndex input below -ApiConfiguration.ServerInfo serverInfo = new ApiConfiguration.ServerInfoBuilder() - .rootServerInfo( - new RootServerInfo.RootServerInfoBuilder() - .rootServer0(new RootServer0()) - .build() - ) - .build(); -ApiConfiguration.ServerIndexInfo serverIndexInfo = new ApiConfiguration.ServerIndexInfoBuilder() - .rootServerInfoServerIndex(RootServerInfo.ServerIndex.SERVER_0) - .build(); -List securitySchemes = new ArrayList(); -securitySchemes.add( - new ApiKey("someApiKey"); -); -ApiConfiguration.SecurityIndexInfo securityIndexInfo = new ApiConfiguration.SecurityIndexInfoBuilder() - .petpetidPostSecurityRequirementObject0SecurityIndex(PetpetidPostSecurityRequirementObject0.SecurityIndex.SECURITY_0) - .build(); -Duration timeout = Duration.ofSeconds(1L); -Map> defaultHeaders = Map.of("User-Agent", List.of("OpenAPI-JSON-Schema-Generator/1.0.0/java")); -ApiConfiguration apiConfiguration = new ApiConfiguration( - serverInfo - serverIndexInfo, - securitySchemes, - securityIndexInfo, - timeout, - defaultHeaders -); -SchemaConfiguration schemaConfiguration = new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().build()); -Petpetid apiClient = new Petpetid(apiConfiguration, schemaConfiguration); - - -// Map validation -PetpetidPostPathParameters.PathParametersMap pathParameters = - PetpetidPostPathParameters.PetpetidPostPathParameters1.validate( - new PetpetidPostPathParameters.PathParametersMapBuilder() - .petId(1L) - - .build(), - schemaConfiguration -); - -var request = new PetpetidPost.PostRequestBuilder() - .pathParameters(pathParameters) - .build(); - -Nothing? response; -try { - response = apiClient.post(request); -} catch (PetpetidPostCode405Response.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; -} -``` -[[Back to top]](#top) [[Back to README]](../../../README.md) diff --git a/samples/client/petstore/kotlin/docs/apis/paths/Petpetiduploadimage.md b/samples/client/petstore/kotlin/docs/apis/paths/Petpetiduploadimage.md deleted file mode 100644 index 67614ba784c..00000000000 --- a/samples/client/petstore/kotlin/docs/apis/paths/Petpetiduploadimage.md +++ /dev/null @@ -1,128 +0,0 @@ -# Petpetiduploadimage - -public class Petpetiduploadimage extends extends ApiClient implements -[PetpetiduploadimagePost.PostOperation](../../paths/petpetiduploadimage/PetpetiduploadimagePost.md#postoperation) - -an api client class which contains all the routes for path="/pet/{petId}/uploadImage" - -## Method Summary -| Modifier and Type | Method and Description | -| ----------------- | ---------------------- | -| [PetpetiduploadimagePostResponses.EndpointResponse](../../paths/petpetiduploadimage/post/PetpetiduploadimagePostResponses.md#endpointresponse) | [post](#post)([PetpetiduploadimagePost.PostRequest](../../paths/petpetiduploadimage/PetpetiduploadimagePost.md#postrequest) request)
| - -## Method Detail - -### post -public [PetpetiduploadimagePostResponses.EndpointResponse](../../paths/petpetiduploadimage/post/PetpetiduploadimagePostResponses.md#endpointresponse) post([PetpetiduploadimagePost.PostRequest](../../paths/petpetiduploadimage/PetpetiduploadimagePost.md#postrequest) request) - - - -**Parameters:**
-request - the input request - -**Returns:**
-the deserialized response - -**Throws:**
-IOException, InterruptedException - an exception happened when making the request
-ValidationException - the returned response body or header values do not conform the the schema validation requirements
-NotImplementedException - the request body serialization or deserialization has not yet been implemented
- or the header content type deserialization has not yet been implemented for this contentType
-ApiException - server returned a response/contentType not defined in the openapi document
- -#### 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.PetpetiduploadimagePostRequestBody; -import org.openapijsonschematools.client.RootServerInfo; -import org.openapijsonschematools.client.paths.petpetiduploadimage.post.PetpetiduploadimagePostSecurityInfo; -import org.openapijsonschematools.client.paths.petpetiduploadimage.post.PetpetiduploadimagePostPathParameters; -import org.openapijsonschematools.client.servers.RootServer0; -import org.openapijsonschematools.client.servers.RootServer1; -import org.openapijsonschematools.client.servers.RootServer2; -import org.openapijsonschematools.client.securityschemes.SecurityScheme; -import org.openapijsonschematools.client.components.securityschemes.PetstoreAuth; -import org.openapijsonschematools.client.paths.petpetiduploadimage.post.responses.PetpetiduploadimagePostCode200Response; -import org.openapijsonschematools.client.components.responses.successwithjsonapiresponse.SuccessWithJsonApiResponseHeadersSchema; -import org.openapijsonschematools.client.servers.RootServerInfo; -import org.openapijsonschematools.client.apis.paths.Petpetiduploadimage; -import org.openapijsonschematools.client.paths.petpetiduploadimage.post.PetpetiduploadimagePostResponses; - -import java.io.IOException; -import java.util.Arrays; -import java.util.List; -import java.util.Map; -import java.util.AbstractMap; - -// if you want to use a server that is not SERVER_0 pass it in here and change the ServerIndex input below -ApiConfiguration.ServerInfo serverInfo = new ApiConfiguration.ServerInfoBuilder() - .rootServerInfo( - new RootServerInfo.RootServerInfoBuilder() - .rootServer0(new RootServer0()) - .build() - ) - .build(); -ApiConfiguration.ServerIndexInfo serverIndexInfo = new ApiConfiguration.ServerIndexInfoBuilder() - .rootServerInfoServerIndex(RootServerInfo.ServerIndex.SERVER_0) - .build(); -List securitySchemes = new ArrayList(); -ApiConfiguration.SecurityIndexInfo securityIndexInfo = new ApiConfiguration.SecurityIndexInfoBuilder() - .petpetiduploadimagePostSecurityRequirementObject0SecurityIndex(PetpetiduploadimagePostSecurityRequirementObject0.SecurityIndex.SECURITY_0) - .build(); -Duration timeout = Duration.ofSeconds(1L); -Map> defaultHeaders = Map.of("User-Agent", List.of("OpenAPI-JSON-Schema-Generator/1.0.0/java")); -ApiConfiguration apiConfiguration = new ApiConfiguration( - serverInfo - serverIndexInfo, - securitySchemes, - securityIndexInfo, - timeout, - defaultHeaders -); -SchemaConfiguration schemaConfiguration = new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().build()); -Petpetiduploadimage apiClient = new Petpetiduploadimage(apiConfiguration, schemaConfiguration); - - -// Map validation -PetpetiduploadimagePostPathParameters.PathParametersMap pathParameters = - PetpetiduploadimagePostPathParameters.PetpetiduploadimagePostPathParameters1.validate( - new PetpetiduploadimagePostPathParameters.PathParametersMapBuilder() - .petId(1L) - - .build(), - schemaConfiguration -); - -var request = new PetpetiduploadimagePost.PostRequestBuilder() - .pathParameters(pathParameters) - .build(); - -PetpetiduploadimagePostResponses.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; -} -PetpetiduploadimagePostResponses.EndpointPetpetiduploadimagePostCode200Response castResponse = (PetpetiduploadimagePostResponses.EndpointPetpetiduploadimagePostCode200Response) response; -} -``` -[[Back to top]](#top) [[Back to README]](../../../README.md) diff --git a/samples/client/petstore/kotlin/docs/apis/paths/Solidus.md b/samples/client/petstore/kotlin/docs/apis/paths/Solidus.md deleted file mode 100644 index 4a157001b35..00000000000 --- a/samples/client/petstore/kotlin/docs/apis/paths/Solidus.md +++ /dev/null @@ -1,101 +0,0 @@ -# Solidus - -public class Solidus extends extends ApiClient implements -[SolidusGet.GetOperation](../../paths/solidus/SolidusGet.md#getoperation) - -an api client class which contains all the routes for path="/" - -## Method Summary -| Modifier and Type | Method and Description | -| ----------------- | ---------------------- | -| [SolidusGetResponses.EndpointResponse](../../paths/solidus/get/SolidusGetResponses.md#endpointresponse) | [get](#get)([SolidusGet.GetRequest](../../paths/solidus/SolidusGet.md#getrequest) request) | - -## Method Detail - -### get -public [SolidusGetResponses.EndpointResponse](../../paths/solidus/get/SolidusGetResponses.md#endpointresponse) get([SolidusGet.GetRequest](../../paths/solidus/SolidusGet.md#getrequest) request) - -**Parameters:**
-request - the input request - -**Returns:**
-the deserialized response - -**Throws:**
-IOException, InterruptedException - an exception happened when making the request
-ValidationException - the returned response body or header values do not conform the the schema validation requirements
-NotImplementedException - the request body serialization or deserialization has not yet been implemented
- or the header content type deserialization has not yet been implemented for this contentType
-ApiException - server returned a response/contentType not defined in the openapi document
- -#### 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.servers.RootServer0; -import org.openapijsonschematools.client.servers.RootServer1; -import org.openapijsonschematools.client.servers.RootServer2; -import org.openapijsonschematools.client.paths.solidus.get.responses.SolidusGetCode200Response; -import org.openapijsonschematools.client.servers.RootServerInfo; -import org.openapijsonschematools.client.apis.paths.Solidus; -import org.openapijsonschematools.client.paths.solidus.get.SolidusGetResponses; - -import java.io.IOException; -import java.util.Arrays; -import java.util.List; -import java.util.Map; -import java.util.AbstractMap; - -// if you want to use a server that is not SERVER_0 pass it in here and change the ServerIndex input below -ApiConfiguration.ServerInfo serverInfo = new ApiConfiguration.ServerInfoBuilder() - .rootServerInfo( - new RootServerInfo.RootServerInfoBuilder() - .rootServer0(new RootServer0()) - .build() - ) - .build(); -ApiConfiguration.ServerIndexInfo serverIndexInfo = new ApiConfiguration.ServerIndexInfoBuilder() - .rootServerInfoServerIndex(RootServerInfo.ServerIndex.SERVER_0) - .build(); -Duration timeout = Duration.ofSeconds(1L); -Map> defaultHeaders = Map.of("User-Agent", List.of("OpenAPI-JSON-Schema-Generator/1.0.0/java")); -ApiConfiguration apiConfiguration = new ApiConfiguration( - serverInfo - serverIndexInfo, - timeout, - defaultHeaders -); -SchemaConfiguration schemaConfiguration = new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().build()); -Solidus apiClient = new Solidus(apiConfiguration, schemaConfiguration); - - -var request = new SolidusGet.GetRequestBuilder().build(); - -SolidusGetResponses.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; -} -SolidusGetResponses.EndpointSolidusGetCode200Response castResponse = (SolidusGetResponses.EndpointSolidusGetCode200Response) response; -``` -[[Back to top]](#top) [[Back to README]](../../../README.md) diff --git a/samples/client/petstore/kotlin/docs/apis/paths/Storeinventory.md b/samples/client/petstore/kotlin/docs/apis/paths/Storeinventory.md deleted file mode 100644 index c22c9ecc957..00000000000 --- a/samples/client/petstore/kotlin/docs/apis/paths/Storeinventory.md +++ /dev/null @@ -1,117 +0,0 @@ -# Storeinventory - -public class Storeinventory extends extends ApiClient implements -[StoreinventoryGet.GetOperation](../../paths/storeinventory/StoreinventoryGet.md#getoperation) - -an api client class which contains all the routes for path="/store/inventory" - -## Method Summary -| Modifier and Type | Method and Description | -| ----------------- | ---------------------- | -| [StoreinventoryGetResponses.EndpointResponse](../../paths/storeinventory/get/StoreinventoryGetResponses.md#endpointresponse) | [get](#get)([StoreinventoryGet.GetRequest](../../paths/storeinventory/StoreinventoryGet.md#getrequest) request)
Returns a map of status codes to quantities | - -## Method Detail - -### get -public [StoreinventoryGetResponses.EndpointResponse](../../paths/storeinventory/get/StoreinventoryGetResponses.md#endpointresponse) get([StoreinventoryGet.GetRequest](../../paths/storeinventory/StoreinventoryGet.md#getrequest) request) - -Returns a map of status codes to quantities - -**Parameters:**
-request - the input request - -**Returns:**
-the deserialized response - -**Throws:**
-IOException, InterruptedException - an exception happened when making the request
-ValidationException - the returned response body or header values do not conform the the schema validation requirements
-NotImplementedException - the request body serialization or deserialization has not yet been implemented
- or the header content type deserialization has not yet been implemented for this contentType
-ApiException - server returned a response/contentType not defined in the openapi document
- -#### 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.storeinventory.get.StoreinventoryGetSecurityInfo; -import org.openapijsonschematools.client.servers.RootServer0; -import org.openapijsonschematools.client.servers.RootServer1; -import org.openapijsonschematools.client.servers.RootServer2; -import org.openapijsonschematools.client.securityschemes.SecurityScheme; -import org.openapijsonschematools.client.components.securityschemes.ApiKey; -import org.openapijsonschematools.client.paths.storeinventory.get.responses.StoreinventoryGetCode200Response; -import org.openapijsonschematools.client.components.responses.successinlinecontentandheader.SuccessInlineContentAndHeaderHeadersSchema; -import org.openapijsonschematools.client.servers.RootServerInfo; -import org.openapijsonschematools.client.apis.paths.Storeinventory; -import org.openapijsonschematools.client.paths.storeinventory.get.StoreinventoryGetResponses; - -import java.io.IOException; -import java.util.Arrays; -import java.util.List; -import java.util.Map; -import java.util.AbstractMap; - -// if you want to use a server that is not SERVER_0 pass it in here and change the ServerIndex input below -ApiConfiguration.ServerInfo serverInfo = new ApiConfiguration.ServerInfoBuilder() - .rootServerInfo( - new RootServerInfo.RootServerInfoBuilder() - .rootServer0(new RootServer0()) - .build() - ) - .build(); -ApiConfiguration.ServerIndexInfo serverIndexInfo = new ApiConfiguration.ServerIndexInfoBuilder() - .rootServerInfoServerIndex(RootServerInfo.ServerIndex.SERVER_0) - .build(); -List securitySchemes = new ArrayList(); -securitySchemes.add( - new ApiKey("someApiKey"); -); -ApiConfiguration.SecurityIndexInfo securityIndexInfo = new ApiConfiguration.SecurityIndexInfoBuilder() - .storeinventoryGetSecurityRequirementObject0SecurityIndex(StoreinventoryGetSecurityRequirementObject0.SecurityIndex.SECURITY_0) - .build(); -Duration timeout = Duration.ofSeconds(1L); -Map> defaultHeaders = Map.of("User-Agent", List.of("OpenAPI-JSON-Schema-Generator/1.0.0/java")); -ApiConfiguration apiConfiguration = new ApiConfiguration( - serverInfo - serverIndexInfo, - securitySchemes, - securityIndexInfo, - timeout, - defaultHeaders -); -SchemaConfiguration schemaConfiguration = new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().build()); -Storeinventory apiClient = new Storeinventory(apiConfiguration, schemaConfiguration); - - -var request = new StoreinventoryGet.GetRequestBuilder().build(); - -StoreinventoryGetResponses.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; -} -StoreinventoryGetResponses.EndpointStoreinventoryGetCode200Response castResponse = (StoreinventoryGetResponses.EndpointStoreinventoryGetCode200Response) response; -} -``` -[[Back to top]](#top) [[Back to README]](../../../README.md) diff --git a/samples/client/petstore/kotlin/docs/apis/paths/Storeorder.md b/samples/client/petstore/kotlin/docs/apis/paths/Storeorder.md deleted file mode 100644 index 90478bd1169..00000000000 --- a/samples/client/petstore/kotlin/docs/apis/paths/Storeorder.md +++ /dev/null @@ -1,137 +0,0 @@ -# Storeorder - -public class Storeorder extends extends ApiClient implements -[StoreorderPost.PostOperation](../../paths/storeorder/StoreorderPost.md#postoperation) - -an api client class which contains all the routes for path="/store/order" - -## Method Summary -| Modifier and Type | Method and Description | -| ----------------- | ---------------------- | -| [StoreorderPostResponses.EndpointResponse](../../paths/storeorder/post/StoreorderPostResponses.md#endpointresponse) | [post](#post)([StoreorderPost.PostRequest](../../paths/storeorder/StoreorderPost.md#postrequest) request)
| - -## Method Detail - -### post -public [StoreorderPostResponses.EndpointResponse](../../paths/storeorder/post/StoreorderPostResponses.md#endpointresponse) post([StoreorderPost.PostRequest](../../paths/storeorder/StoreorderPost.md#postrequest) request) - - - -**Parameters:**
-request - the input request - -**Returns:**
-the deserialized response - -**Throws:**
-IOException, InterruptedException - an exception happened when making the request
-ValidationException - the returned response body or header values do not conform the the schema validation requirements
-NotImplementedException - the request body serialization or deserialization has not yet been implemented
- or the header content type deserialization has not yet been implemented for this contentType
-ApiException - server returned a response/contentType not defined in the openapi document
- -#### 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.StoreorderPostRequestBody; -import org.openapijsonschematools.client.components.schemas.Order; -import org.openapijsonschematools.client.servers.RootServer0; -import org.openapijsonschematools.client.servers.RootServer1; -import org.openapijsonschematools.client.servers.RootServer2; -import org.openapijsonschematools.client.paths.storeorder.post.responses.StoreorderPostCode200Response; -import org.openapijsonschematools.client.paths.storeorder.post.responses.StoreorderPostCode400Response; -import org.openapijsonschematools.client.servers.RootServerInfo; -import org.openapijsonschematools.client.apis.paths.Storeorder; -import org.openapijsonschematools.client.paths.storeorder.post.StoreorderPostResponses; - -import java.io.IOException; -import java.util.Arrays; -import java.util.List; -import java.util.Map; -import java.util.AbstractMap; - -// if you want to use a server that is not SERVER_0 pass it in here and change the ServerIndex input below -ApiConfiguration.ServerInfo serverInfo = new ApiConfiguration.ServerInfoBuilder() - .rootServerInfo( - new RootServerInfo.RootServerInfoBuilder() - .rootServer0(new RootServer0()) - .build() - ) - .build(); -ApiConfiguration.ServerIndexInfo serverIndexInfo = new ApiConfiguration.ServerIndexInfoBuilder() - .rootServerInfoServerIndex(RootServerInfo.ServerIndex.SERVER_0) - .build(); -Duration timeout = Duration.ofSeconds(1L); -Map> defaultHeaders = Map.of("User-Agent", List.of("OpenAPI-JSON-Schema-Generator/1.0.0/java")); -ApiConfiguration apiConfiguration = new ApiConfiguration( - serverInfo - serverIndexInfo, - timeout, - defaultHeaders -); -SchemaConfiguration schemaConfiguration = new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().build()); -Storeorder apiClient = new Storeorder(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 -); -StoreorderPost.SealedRequestBody requestBody = new StoreorderPost.ApplicationjsonRequestBody(requestBodyPayload); - -var request = new StoreorderPost.PostRequestBuilder() - .requestBody(requestBody) - .build(); - -StoreorderPostResponses.EndpointResponse response; -try { - response = apiClient.post(request); -} catch (StoreorderPostCode400Response.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; -} -StoreorderPostResponses.EndpointStoreorderPostCode200Response castResponse = (StoreorderPostResponses.EndpointStoreorderPostCode200Response) response; -if (castResponse.body instanceof StoreorderPostCode200Response.ApplicationxmlResponseBody deserializedBody) { - // handle deserialized body here -} else { - StoreorderPostCode200Response.ApplicationjsonResponseBody deserializedBody = (StoreorderPostCode200Response.ApplicationjsonResponseBody) castResponse.body; - // handle deserialized body here -} -``` -[[Back to top]](#top) [[Back to README]](../../../README.md) diff --git a/samples/client/petstore/kotlin/docs/apis/paths/Storeorderorderid.md b/samples/client/petstore/kotlin/docs/apis/paths/Storeorderorderid.md deleted file mode 100644 index ae48b8fcea4..00000000000 --- a/samples/client/petstore/kotlin/docs/apis/paths/Storeorderorderid.md +++ /dev/null @@ -1,233 +0,0 @@ -# Storeorderorderid - -public class Storeorderorderid extends extends ApiClient implements -[StoreorderorderidDelete.DeleteOperation](../../paths/storeorderorderid/StoreorderorderidDelete.md#deleteoperation), -[StoreorderorderidGet.GetOperation](../../paths/storeorderorderid/StoreorderorderidGet.md#getoperation) - -an api client class which contains all the routes for path="/store/order/{order_id}" - -## Method Summary -| Modifier and Type | Method and Description | -| ----------------- | ---------------------- | -| Nothing? | [delete](#delete)([StoreorderorderidDelete.DeleteRequest](../../paths/storeorderorderid/StoreorderorderidDelete.md#deleterequest) request)
For valid response try integer IDs with value < 1000. Anything above 1000 or nonintegers will generate API errors | -| [StoreorderorderidGetResponses.EndpointResponse](../../paths/storeorderorderid/get/StoreorderorderidGetResponses.md#endpointresponse) | [get](#get)([StoreorderorderidGet.GetRequest](../../paths/storeorderorderid/StoreorderorderidGet.md#getrequest) request)
For valid response try integer IDs with value <= 5 or > 10. Other values will generated exceptions | - -## Method Detail - -### delete -public Nothing? delete([StoreorderorderidDelete.DeleteRequest](../../paths/storeorderorderid/StoreorderorderidDelete.md#deleterequest) request) - -For valid response try integer IDs with value < 1000. Anything above 1000 or nonintegers will generate API errors - -**Parameters:**
-request - the input request - -**Returns:**
-nothing (Nothing?) - -**Throws:**
-IOException, InterruptedException - an exception happened when making the request
-ValidationException - the returned response body or header values do not conform the the schema validation requirements
-NotImplementedException - the request body serialization or deserialization has not yet been implemented
- or the header content type deserialization has not yet been implemented for this contentType
-ApiException - server returned a response/contentType not defined in the openapi document
- -#### 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.StoreorderorderidDeletePathParameters; -import org.openapijsonschematools.client.servers.RootServer0; -import org.openapijsonschematools.client.servers.RootServer1; -import org.openapijsonschematools.client.servers.RootServer2; -import org.openapijsonschematools.client.paths.storeorderorderid.delete.responses.StoreorderorderidDeleteCode400Response; -import org.openapijsonschematools.client.paths.storeorderorderid.delete.responses.StoreorderorderidDeleteCode404Response; -import org.openapijsonschematools.client.servers.RootServerInfo; -import org.openapijsonschematools.client.apis.paths.Storeorderorderid; -import org.openapijsonschematools.client.paths.storeorderorderid.delete.StoreorderorderidDeleteResponses; - -import java.io.IOException; -import java.util.Arrays; -import java.util.List; -import java.util.Map; -import java.util.AbstractMap; - -// if you want to use a server that is not SERVER_0 pass it in here and change the ServerIndex input below -ApiConfiguration.ServerInfo serverInfo = new ApiConfiguration.ServerInfoBuilder() - .rootServerInfo( - new RootServerInfo.RootServerInfoBuilder() - .rootServer0(new RootServer0()) - .build() - ) - .build(); -ApiConfiguration.ServerIndexInfo serverIndexInfo = new ApiConfiguration.ServerIndexInfoBuilder() - .rootServerInfoServerIndex(RootServerInfo.ServerIndex.SERVER_0) - .build(); -Duration timeout = Duration.ofSeconds(1L); -Map> defaultHeaders = Map.of("User-Agent", List.of("OpenAPI-JSON-Schema-Generator/1.0.0/java")); -ApiConfiguration apiConfiguration = new ApiConfiguration( - serverInfo - serverIndexInfo, - timeout, - defaultHeaders -); -SchemaConfiguration schemaConfiguration = new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().build()); -Storeorderorderid apiClient = new Storeorderorderid(apiConfiguration, schemaConfiguration); - - -// Map validation -StoreorderorderidDeletePathParameters.PathParametersMap pathParameters = - StoreorderorderidDeletePathParameters.StoreorderorderidDeletePathParameters1.validate( - new StoreorderorderidDeletePathParameters.PathParametersMapBuilder() - .order_id("a") - - .build(), - schemaConfiguration -); - -var request = new StoreorderorderidDelete.DeleteRequestBuilder() - .pathParameters(pathParameters) - .build(); - -Nothing? response; -try { - response = apiClient.delete(request); -} catch (StoreorderorderidDeleteCode400Response.ResponseApiException | StoreorderorderidDeleteCode404Response.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; -} -``` -### get -public [StoreorderorderidGetResponses.EndpointResponse](../../paths/storeorderorderid/get/StoreorderorderidGetResponses.md#endpointresponse) get([StoreorderorderidGet.GetRequest](../../paths/storeorderorderid/StoreorderorderidGet.md#getrequest) request) - -For valid response try integer IDs with value <= 5 or > 10. Other values will generated exceptions - -**Parameters:**
-request - the input request - -**Returns:**
-the deserialized response - -**Throws:**
-IOException, InterruptedException - an exception happened when making the request
-ValidationException - the returned response body or header values do not conform the the schema validation requirements
-NotImplementedException - the request body serialization or deserialization has not yet been implemented
- or the header content type deserialization has not yet been implemented for this contentType
-ApiException - server returned a response/contentType not defined in the openapi document
- -#### 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.get.StoreorderorderidGetPathParameters; -import org.openapijsonschematools.client.servers.RootServer0; -import org.openapijsonschematools.client.servers.RootServer1; -import org.openapijsonschematools.client.servers.RootServer2; -import org.openapijsonschematools.client.paths.storeorderorderid.get.responses.StoreorderorderidGetCode200Response; -import org.openapijsonschematools.client.paths.storeorderorderid.get.responses.StoreorderorderidGetCode400Response; -import org.openapijsonschematools.client.paths.storeorderorderid.get.responses.StoreorderorderidGetCode404Response; -import org.openapijsonschematools.client.servers.RootServerInfo; -import org.openapijsonschematools.client.apis.paths.Storeorderorderid; -import org.openapijsonschematools.client.paths.storeorderorderid.get.StoreorderorderidGetResponses; - -import java.io.IOException; -import java.util.Arrays; -import java.util.List; -import java.util.Map; -import java.util.AbstractMap; - -// if you want to use a server that is not SERVER_0 pass it in here and change the ServerIndex input below -ApiConfiguration.ServerInfo serverInfo = new ApiConfiguration.ServerInfoBuilder() - .rootServerInfo( - new RootServerInfo.RootServerInfoBuilder() - .rootServer0(new RootServer0()) - .build() - ) - .build(); -ApiConfiguration.ServerIndexInfo serverIndexInfo = new ApiConfiguration.ServerIndexInfoBuilder() - .rootServerInfoServerIndex(RootServerInfo.ServerIndex.SERVER_0) - .build(); -Duration timeout = Duration.ofSeconds(1L); -Map> defaultHeaders = Map.of("User-Agent", List.of("OpenAPI-JSON-Schema-Generator/1.0.0/java")); -ApiConfiguration apiConfiguration = new ApiConfiguration( - serverInfo - serverIndexInfo, - timeout, - defaultHeaders -); -SchemaConfiguration schemaConfiguration = new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().build()); -Storeorderorderid apiClient = new Storeorderorderid(apiConfiguration, schemaConfiguration); - - -// Map validation -StoreorderorderidGetPathParameters.PathParametersMap pathParameters = - StoreorderorderidGetPathParameters.StoreorderorderidGetPathParameters1.validate( - new StoreorderorderidGetPathParameters.PathParametersMapBuilder() - .order_id(1L) - - .build(), - schemaConfiguration -); - -var request = new StoreorderorderidGet.GetRequestBuilder() - .pathParameters(pathParameters) - .build(); - -StoreorderorderidGetResponses.EndpointResponse response; -try { - response = apiClient.get(request); -} catch (StoreorderorderidGetCode400Response.ResponseApiException | StoreorderorderidGetCode404Response.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; -} -StoreorderorderidGetResponses.EndpointStoreorderorderidGetCode200Response castResponse = (StoreorderorderidGetResponses.EndpointStoreorderorderidGetCode200Response) response; -if (castResponse.body instanceof StoreorderorderidGetCode200Response.ApplicationxmlResponseBody deserializedBody) { - // handle deserialized body here -} else { - StoreorderorderidGetCode200Response.ApplicationjsonResponseBody deserializedBody = (StoreorderorderidGetCode200Response.ApplicationjsonResponseBody) castResponse.body; - // handle deserialized body here -} -``` -[[Back to top]](#top) [[Back to README]](../../../README.md) diff --git a/samples/client/petstore/kotlin/docs/apis/paths/User.md b/samples/client/petstore/kotlin/docs/apis/paths/User.md deleted file mode 100644 index 3dd6a3600f9..00000000000 --- a/samples/client/petstore/kotlin/docs/apis/paths/User.md +++ /dev/null @@ -1,133 +0,0 @@ -# User - -public class User extends extends ApiClient implements -[UserPost.PostOperation](../../paths/user/UserPost.md#postoperation) - -an api client class which contains all the routes for path="/user" - -## Method Summary -| Modifier and Type | Method and Description | -| ----------------- | ---------------------- | -| [UserPostResponses.EndpointResponse](../../paths/user/post/UserPostResponses.md#endpointresponse) | [post](#post)([UserPost.PostRequest](../../paths/user/UserPost.md#postrequest) request)
This can only be done by the logged in user. | - -## Method Detail - -### post -public [UserPostResponses.EndpointResponse](../../paths/user/post/UserPostResponses.md#endpointresponse) post([UserPost.PostRequest](../../paths/user/UserPost.md#postrequest) request) - -This can only be done by the logged in user. - -**Parameters:**
-request - the input request - -**Returns:**
-the deserialized response - -**Throws:**
-IOException, InterruptedException - an exception happened when making the request
-ValidationException - the returned response body or header values do not conform the the schema validation requirements
-NotImplementedException - the request body serialization or deserialization has not yet been implemented
- or the header content type deserialization has not yet been implemented for this contentType
-ApiException - server returned a response/contentType not defined in the openapi document
- -#### 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.user.post.UserPostRequestBody; -import org.openapijsonschematools.client.components.schemas.User; -import org.openapijsonschematools.client.servers.RootServer0; -import org.openapijsonschematools.client.servers.RootServer1; -import org.openapijsonschematools.client.servers.RootServer2; -import org.openapijsonschematools.client.paths.user.post.responses.UserPostCodedefaultResponse; -import org.openapijsonschematools.client.servers.RootServerInfo; -import org.openapijsonschematools.client.apis.paths.User; -import org.openapijsonschematools.client.paths.user.post.UserPostResponses; - -import java.io.IOException; -import java.util.Arrays; -import java.util.List; -import java.util.Map; -import java.util.AbstractMap; - -// if you want to use a server that is not SERVER_0 pass it in here and change the ServerIndex input below -ApiConfiguration.ServerInfo serverInfo = new ApiConfiguration.ServerInfoBuilder() - .rootServerInfo( - new RootServerInfo.RootServerInfoBuilder() - .rootServer0(new RootServer0()) - .build() - ) - .build(); -ApiConfiguration.ServerIndexInfo serverIndexInfo = new ApiConfiguration.ServerIndexInfoBuilder() - .rootServerInfoServerIndex(RootServerInfo.ServerIndex.SERVER_0) - .build(); -Duration timeout = Duration.ofSeconds(1L); -Map> defaultHeaders = Map.of("User-Agent", List.of("OpenAPI-JSON-Schema-Generator/1.0.0/java")); -ApiConfiguration apiConfiguration = new ApiConfiguration( - serverInfo - serverIndexInfo, - timeout, - defaultHeaders -); -SchemaConfiguration schemaConfiguration = new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().build()); -User apiClient = new User(apiConfiguration, schemaConfiguration); - - -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 -); -UserPost.SealedRequestBody requestBody = new UserPost.ApplicationjsonRequestBody(requestBodyPayload); - -var request = new UserPost.PostRequestBuilder() - .requestBody(requestBody) - .build(); - -UserPostResponses.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; -} -UserPostResponses.EndpointUserPostCodedefaultResponse castResponse = (UserPostResponses.EndpointUserPostCodedefaultResponse) response; -``` -[[Back to top]](#top) [[Back to README]](../../../README.md) diff --git a/samples/client/petstore/kotlin/docs/apis/paths/Usercreatewitharray.md b/samples/client/petstore/kotlin/docs/apis/paths/Usercreatewitharray.md deleted file mode 100644 index a60a10c723e..00000000000 --- a/samples/client/petstore/kotlin/docs/apis/paths/Usercreatewitharray.md +++ /dev/null @@ -1,155 +0,0 @@ -# Usercreatewitharray - -public class Usercreatewitharray extends extends ApiClient implements -[UsercreatewitharrayPost.PostOperation](../../paths/usercreatewitharray/UsercreatewitharrayPost.md#postoperation) - -an api client class which contains all the routes for path="/user/createWithArray" - -## Method Summary -| Modifier and Type | Method and Description | -| ----------------- | ---------------------- | -| [UsercreatewitharrayPostResponses.EndpointResponse](../../paths/usercreatewitharray/post/UsercreatewitharrayPostResponses.md#endpointresponse) | [post](#post)([UsercreatewitharrayPost.PostRequest](../../paths/usercreatewitharray/UsercreatewitharrayPost.md#postrequest) request)
| - -## Method Detail - -### post -public [UsercreatewitharrayPostResponses.EndpointResponse](../../paths/usercreatewitharray/post/UsercreatewitharrayPostResponses.md#endpointresponse) post([UsercreatewitharrayPost.PostRequest](../../paths/usercreatewitharray/UsercreatewitharrayPost.md#postrequest) request) - - - -**Parameters:**
-request - the input request - -**Returns:**
-the deserialized response - -**Throws:**
-IOException, InterruptedException - an exception happened when making the request
-ValidationException - the returned response body or header values do not conform the the schema validation requirements
-NotImplementedException - the request body serialization or deserialization has not yet been implemented
- or the header content type deserialization has not yet been implemented for this contentType
-ApiException - server returned a response/contentType not defined in the openapi document
- -#### 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.UsercreatewitharrayPostRequestBody; -import org.openapijsonschematools.client.components.requestbodies.userarray.content.applicationjson.ApplicationjsonSchema; -import org.openapijsonschematools.client.servers.RootServer0; -import org.openapijsonschematools.client.servers.RootServer1; -import org.openapijsonschematools.client.servers.RootServer2; -import org.openapijsonschematools.client.paths.usercreatewitharray.post.responses.UsercreatewitharrayPostCodedefaultResponse; -import org.openapijsonschematools.client.servers.RootServerInfo; -import org.openapijsonschematools.client.apis.paths.Usercreatewitharray; -import org.openapijsonschematools.client.paths.usercreatewitharray.post.UsercreatewitharrayPostResponses; - -import java.io.IOException; -import java.util.Arrays; -import java.util.List; -import java.util.Map; -import java.util.AbstractMap; - -// if you want to use a server that is not SERVER_0 pass it in here and change the ServerIndex input below -ApiConfiguration.ServerInfo serverInfo = new ApiConfiguration.ServerInfoBuilder() - .rootServerInfo( - new RootServerInfo.RootServerInfoBuilder() - .rootServer0(new RootServer0()) - .build() - ) - .build(); -ApiConfiguration.ServerIndexInfo serverIndexInfo = new ApiConfiguration.ServerIndexInfoBuilder() - .rootServerInfoServerIndex(RootServerInfo.ServerIndex.SERVER_0) - .build(); -Duration timeout = Duration.ofSeconds(1L); -Map> defaultHeaders = Map.of("User-Agent", List.of("OpenAPI-JSON-Schema-Generator/1.0.0/java")); -ApiConfiguration apiConfiguration = new ApiConfiguration( - serverInfo - serverIndexInfo, - timeout, - defaultHeaders -); -SchemaConfiguration schemaConfiguration = new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().build()); -Usercreatewitharray apiClient = new Usercreatewitharray(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 -); -UsercreatewitharrayPostRequestBody.SealedRequestBody requestBody = new UsercreatewitharrayPostRequestBody.ApplicationjsonRequestBody(requestBodyPayload); - -var request = new UsercreatewitharrayPost.PostRequestBuilder() - .requestBody(requestBody) - .build(); - -UsercreatewitharrayPostResponses.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; -} -UsercreatewitharrayPostResponses.EndpointUsercreatewitharrayPostCodedefaultResponse castResponse = (UsercreatewitharrayPostResponses.EndpointUsercreatewitharrayPostCodedefaultResponse) response; -``` -[[Back to top]](#top) [[Back to README]](../../../README.md) diff --git a/samples/client/petstore/kotlin/docs/apis/paths/Usercreatewithlist.md b/samples/client/petstore/kotlin/docs/apis/paths/Usercreatewithlist.md deleted file mode 100644 index e46aba02776..00000000000 --- a/samples/client/petstore/kotlin/docs/apis/paths/Usercreatewithlist.md +++ /dev/null @@ -1,155 +0,0 @@ -# Usercreatewithlist - -public class Usercreatewithlist extends extends ApiClient implements -[UsercreatewithlistPost.PostOperation](../../paths/usercreatewithlist/UsercreatewithlistPost.md#postoperation) - -an api client class which contains all the routes for path="/user/createWithList" - -## Method Summary -| Modifier and Type | Method and Description | -| ----------------- | ---------------------- | -| [UsercreatewithlistPostResponses.EndpointResponse](../../paths/usercreatewithlist/post/UsercreatewithlistPostResponses.md#endpointresponse) | [post](#post)([UsercreatewithlistPost.PostRequest](../../paths/usercreatewithlist/UsercreatewithlistPost.md#postrequest) request)
| - -## Method Detail - -### post -public [UsercreatewithlistPostResponses.EndpointResponse](../../paths/usercreatewithlist/post/UsercreatewithlistPostResponses.md#endpointresponse) post([UsercreatewithlistPost.PostRequest](../../paths/usercreatewithlist/UsercreatewithlistPost.md#postrequest) request) - - - -**Parameters:**
-request - the input request - -**Returns:**
-the deserialized response - -**Throws:**
-IOException, InterruptedException - an exception happened when making the request
-ValidationException - the returned response body or header values do not conform the the schema validation requirements
-NotImplementedException - the request body serialization or deserialization has not yet been implemented
- or the header content type deserialization has not yet been implemented for this contentType
-ApiException - server returned a response/contentType not defined in the openapi document
- -#### 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.UsercreatewithlistPostRequestBody; -import org.openapijsonschematools.client.components.requestbodies.userarray.content.applicationjson.ApplicationjsonSchema; -import org.openapijsonschematools.client.servers.RootServer0; -import org.openapijsonschematools.client.servers.RootServer1; -import org.openapijsonschematools.client.servers.RootServer2; -import org.openapijsonschematools.client.paths.usercreatewithlist.post.responses.UsercreatewithlistPostCodedefaultResponse; -import org.openapijsonschematools.client.servers.RootServerInfo; -import org.openapijsonschematools.client.apis.paths.Usercreatewithlist; -import org.openapijsonschematools.client.paths.usercreatewithlist.post.UsercreatewithlistPostResponses; - -import java.io.IOException; -import java.util.Arrays; -import java.util.List; -import java.util.Map; -import java.util.AbstractMap; - -// if you want to use a server that is not SERVER_0 pass it in here and change the ServerIndex input below -ApiConfiguration.ServerInfo serverInfo = new ApiConfiguration.ServerInfoBuilder() - .rootServerInfo( - new RootServerInfo.RootServerInfoBuilder() - .rootServer0(new RootServer0()) - .build() - ) - .build(); -ApiConfiguration.ServerIndexInfo serverIndexInfo = new ApiConfiguration.ServerIndexInfoBuilder() - .rootServerInfoServerIndex(RootServerInfo.ServerIndex.SERVER_0) - .build(); -Duration timeout = Duration.ofSeconds(1L); -Map> defaultHeaders = Map.of("User-Agent", List.of("OpenAPI-JSON-Schema-Generator/1.0.0/java")); -ApiConfiguration apiConfiguration = new ApiConfiguration( - serverInfo - serverIndexInfo, - timeout, - defaultHeaders -); -SchemaConfiguration schemaConfiguration = new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().build()); -Usercreatewithlist apiClient = new Usercreatewithlist(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 -); -UsercreatewithlistPostRequestBody.SealedRequestBody requestBody = new UsercreatewithlistPostRequestBody.ApplicationjsonRequestBody(requestBodyPayload); - -var request = new UsercreatewithlistPost.PostRequestBuilder() - .requestBody(requestBody) - .build(); - -UsercreatewithlistPostResponses.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; -} -UsercreatewithlistPostResponses.EndpointUsercreatewithlistPostCodedefaultResponse castResponse = (UsercreatewithlistPostResponses.EndpointUsercreatewithlistPostCodedefaultResponse) response; -``` -[[Back to top]](#top) [[Back to README]](../../../README.md) diff --git a/samples/client/petstore/kotlin/docs/apis/paths/Userlogin.md b/samples/client/petstore/kotlin/docs/apis/paths/Userlogin.md deleted file mode 100644 index ea65ab6d1d8..00000000000 --- a/samples/client/petstore/kotlin/docs/apis/paths/Userlogin.md +++ /dev/null @@ -1,129 +0,0 @@ -# Userlogin - -public class Userlogin extends extends ApiClient implements -[UserloginGet.GetOperation](../../paths/userlogin/UserloginGet.md#getoperation) - -an api client class which contains all the routes for path="/user/login" - -## Method Summary -| Modifier and Type | Method and Description | -| ----------------- | ---------------------- | -| [UserloginGetResponses.EndpointResponse](../../paths/userlogin/get/UserloginGetResponses.md#endpointresponse) | [get](#get)([UserloginGet.GetRequest](../../paths/userlogin/UserloginGet.md#getrequest) request)
| - -## Method Detail - -### get -public [UserloginGetResponses.EndpointResponse](../../paths/userlogin/get/UserloginGetResponses.md#endpointresponse) get([UserloginGet.GetRequest](../../paths/userlogin/UserloginGet.md#getrequest) request) - - - -**Parameters:**
-request - the input request - -**Returns:**
-the deserialized response - -**Throws:**
-IOException, InterruptedException - an exception happened when making the request
-ValidationException - the returned response body or header values do not conform the the schema validation requirements
-NotImplementedException - the request body serialization or deserialization has not yet been implemented
- or the header content type deserialization has not yet been implemented for this contentType
-ApiException - server returned a response/contentType not defined in the openapi document
- -#### 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.userlogin.get.UserloginGetQueryParameters; -import org.openapijsonschematools.client.servers.RootServer0; -import org.openapijsonschematools.client.servers.RootServer1; -import org.openapijsonschematools.client.servers.RootServer2; -import org.openapijsonschematools.client.paths.userlogin.get.responses.UserloginGetCode200Response; -import org.openapijsonschematools.client.paths.userlogin.get.responses.code200response.UserloginGetCode200ResponseHeadersSchema; -import org.openapijsonschematools.client.paths.userlogin.get.responses.UserloginGetCode400Response; -import org.openapijsonschematools.client.servers.RootServerInfo; -import org.openapijsonschematools.client.apis.paths.Userlogin; -import org.openapijsonschematools.client.paths.userlogin.get.UserloginGetResponses; - -import java.io.IOException; -import java.util.Arrays; -import java.util.List; -import java.util.Map; -import java.util.AbstractMap; - -// if you want to use a server that is not SERVER_0 pass it in here and change the ServerIndex input below -ApiConfiguration.ServerInfo serverInfo = new ApiConfiguration.ServerInfoBuilder() - .rootServerInfo( - new RootServerInfo.RootServerInfoBuilder() - .rootServer0(new RootServer0()) - .build() - ) - .build(); -ApiConfiguration.ServerIndexInfo serverIndexInfo = new ApiConfiguration.ServerIndexInfoBuilder() - .rootServerInfoServerIndex(RootServerInfo.ServerIndex.SERVER_0) - .build(); -Duration timeout = Duration.ofSeconds(1L); -Map> defaultHeaders = Map.of("User-Agent", List.of("OpenAPI-JSON-Schema-Generator/1.0.0/java")); -ApiConfiguration apiConfiguration = new ApiConfiguration( - serverInfo - serverIndexInfo, - timeout, - defaultHeaders -); -SchemaConfiguration schemaConfiguration = new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().build()); -Userlogin apiClient = new Userlogin(apiConfiguration, schemaConfiguration); - - -// Map validation -UserloginGetQueryParameters.QueryParametersMap queryParameters = - UserloginGetQueryParameters.UserloginGetQueryParameters1.validate( - new UserloginGetQueryParameters.QueryParametersMapBuilder() - .password("a") - - .username("a") - - .build(), - schemaConfiguration -); - -var request = new UserloginGet.GetRequestBuilder() - .queryParameters(queryParameters) - .build(); - -UserloginGetResponses.EndpointResponse response; -try { - response = apiClient.get(request); -} catch (UserloginGetCode400Response.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; -} -UserloginGetResponses.EndpointUserloginGetCode200Response castResponse = (UserloginGetResponses.EndpointUserloginGetCode200Response) response; -if (castResponse.body instanceof UserloginGetCode200Response.ApplicationxmlResponseBody deserializedBody) { - // handle deserialized body here -} else { - UserloginGetCode200Response.ApplicationjsonResponseBody deserializedBody = (UserloginGetCode200Response.ApplicationjsonResponseBody) castResponse.body; - // handle deserialized body here -} -``` -[[Back to top]](#top) [[Back to README]](../../../README.md) diff --git a/samples/client/petstore/kotlin/docs/apis/paths/Userlogout.md b/samples/client/petstore/kotlin/docs/apis/paths/Userlogout.md deleted file mode 100644 index a75e1f211ae..00000000000 --- a/samples/client/petstore/kotlin/docs/apis/paths/Userlogout.md +++ /dev/null @@ -1,103 +0,0 @@ -# Userlogout - -public class Userlogout extends extends ApiClient implements -[UserlogoutGet.GetOperation](../../paths/userlogout/UserlogoutGet.md#getoperation) - -an api client class which contains all the routes for path="/user/logout" - -## Method Summary -| Modifier and Type | Method and Description | -| ----------------- | ---------------------- | -| [UserlogoutGetResponses.EndpointResponse](../../paths/userlogout/get/UserlogoutGetResponses.md#endpointresponse) | [get](#get)([UserlogoutGet.GetRequest](../../paths/userlogout/UserlogoutGet.md#getrequest) request)
| - -## Method Detail - -### get -public [UserlogoutGetResponses.EndpointResponse](../../paths/userlogout/get/UserlogoutGetResponses.md#endpointresponse) get([UserlogoutGet.GetRequest](../../paths/userlogout/UserlogoutGet.md#getrequest) request) - - - -**Parameters:**
-request - the input request - -**Returns:**
-the deserialized response - -**Throws:**
-IOException, InterruptedException - an exception happened when making the request
-ValidationException - the returned response body or header values do not conform the the schema validation requirements
-NotImplementedException - the request body serialization or deserialization has not yet been implemented
- or the header content type deserialization has not yet been implemented for this contentType
-ApiException - server returned a response/contentType not defined in the openapi document
- -#### 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.servers.RootServer0; -import org.openapijsonschematools.client.servers.RootServer1; -import org.openapijsonschematools.client.servers.RootServer2; -import org.openapijsonschematools.client.paths.userlogout.get.responses.UserlogoutGetCodedefaultResponse; -import org.openapijsonschematools.client.servers.RootServerInfo; -import org.openapijsonschematools.client.apis.paths.Userlogout; -import org.openapijsonschematools.client.paths.userlogout.get.UserlogoutGetResponses; - -import java.io.IOException; -import java.util.Arrays; -import java.util.List; -import java.util.Map; -import java.util.AbstractMap; - -// if you want to use a server that is not SERVER_0 pass it in here and change the ServerIndex input below -ApiConfiguration.ServerInfo serverInfo = new ApiConfiguration.ServerInfoBuilder() - .rootServerInfo( - new RootServerInfo.RootServerInfoBuilder() - .rootServer0(new RootServer0()) - .build() - ) - .build(); -ApiConfiguration.ServerIndexInfo serverIndexInfo = new ApiConfiguration.ServerIndexInfoBuilder() - .rootServerInfoServerIndex(RootServerInfo.ServerIndex.SERVER_0) - .build(); -Duration timeout = Duration.ofSeconds(1L); -Map> defaultHeaders = Map.of("User-Agent", List.of("OpenAPI-JSON-Schema-Generator/1.0.0/java")); -ApiConfiguration apiConfiguration = new ApiConfiguration( - serverInfo - serverIndexInfo, - timeout, - defaultHeaders -); -SchemaConfiguration schemaConfiguration = new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().build()); -Userlogout apiClient = new Userlogout(apiConfiguration, schemaConfiguration); - - -var request = new UserlogoutGet.GetRequestBuilder().build(); - -UserlogoutGetResponses.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; -} -UserlogoutGetResponses.EndpointUserlogoutGetCodedefaultResponse castResponse = (UserlogoutGetResponses.EndpointUserlogoutGetCodedefaultResponse) response; -``` -[[Back to top]](#top) [[Back to README]](../../../README.md) diff --git a/samples/client/petstore/kotlin/docs/apis/paths/Userusername.md b/samples/client/petstore/kotlin/docs/apis/paths/Userusername.md deleted file mode 100644 index 6b2e46dbfd0..00000000000 --- a/samples/client/petstore/kotlin/docs/apis/paths/Userusername.md +++ /dev/null @@ -1,369 +0,0 @@ -# Userusername - -public class Userusername extends extends ApiClient implements -[UserusernameDelete.DeleteOperation](../../paths/userusername/UserusernameDelete.md#deleteoperation), -[UserusernameGet.GetOperation](../../paths/userusername/UserusernameGet.md#getoperation), -[UserusernamePut.PutOperation](../../paths/userusername/UserusernamePut.md#putoperation) - -an api client class which contains all the routes for path="/user/{username}" - -## Method Summary -| Modifier and Type | Method and Description | -| ----------------- | ---------------------- | -| [UserusernameDeleteResponses.EndpointResponse](../../paths/userusername/delete/UserusernameDeleteResponses.md#endpointresponse) | [delete](#delete)([UserusernameDelete.DeleteRequest](../../paths/userusername/UserusernameDelete.md#deleterequest) request)
This can only be done by the logged in user. | -| [UserusernameGetResponses.EndpointResponse](../../paths/userusername/get/UserusernameGetResponses.md#endpointresponse) | [get](#get)([UserusernameGet.GetRequest](../../paths/userusername/UserusernameGet.md#getrequest) request)
| -| Nothing? | [put](#put)([UserusernamePut.PutRequest](../../paths/userusername/UserusernamePut.md#putrequest) request)
This can only be done by the logged in user. | - -## Method Detail - -### delete -public [UserusernameDeleteResponses.EndpointResponse](../../paths/userusername/delete/UserusernameDeleteResponses.md#endpointresponse) delete([UserusernameDelete.DeleteRequest](../../paths/userusername/UserusernameDelete.md#deleterequest) request) - -This can only be done by the logged in user. - -**Parameters:**
-request - the input request - -**Returns:**
-the deserialized response - -**Throws:**
-IOException, InterruptedException - an exception happened when making the request
-ValidationException - the returned response body or header values do not conform the the schema validation requirements
-NotImplementedException - the request body serialization or deserialization has not yet been implemented
- or the header content type deserialization has not yet been implemented for this contentType
-ApiException - server returned a response/contentType not defined in the openapi document
- -#### 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.userusername.delete.UserusernameDeletePathParameters; -import org.openapijsonschematools.client.servers.RootServer0; -import org.openapijsonschematools.client.servers.RootServer1; -import org.openapijsonschematools.client.servers.RootServer2; -import org.openapijsonschematools.client.paths.userusername.delete.responses.UserusernameDeleteCode200Response; -import org.openapijsonschematools.client.paths.userusername.delete.responses.UserusernameDeleteCode404Response; -import org.openapijsonschematools.client.servers.RootServerInfo; -import org.openapijsonschematools.client.apis.paths.Userusername; -import org.openapijsonschematools.client.paths.userusername.delete.UserusernameDeleteResponses; - -import java.io.IOException; -import java.util.Arrays; -import java.util.List; -import java.util.Map; -import java.util.AbstractMap; - -// if you want to use a server that is not SERVER_0 pass it in here and change the ServerIndex input below -ApiConfiguration.ServerInfo serverInfo = new ApiConfiguration.ServerInfoBuilder() - .rootServerInfo( - new RootServerInfo.RootServerInfoBuilder() - .rootServer0(new RootServer0()) - .build() - ) - .build(); -ApiConfiguration.ServerIndexInfo serverIndexInfo = new ApiConfiguration.ServerIndexInfoBuilder() - .rootServerInfoServerIndex(RootServerInfo.ServerIndex.SERVER_0) - .build(); -Duration timeout = Duration.ofSeconds(1L); -Map> defaultHeaders = Map.of("User-Agent", List.of("OpenAPI-JSON-Schema-Generator/1.0.0/java")); -ApiConfiguration apiConfiguration = new ApiConfiguration( - serverInfo - serverIndexInfo, - timeout, - defaultHeaders -); -SchemaConfiguration schemaConfiguration = new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().build()); -Userusername apiClient = new Userusername(apiConfiguration, schemaConfiguration); - - -// Map validation -UserusernameDeletePathParameters.PathParametersMap pathParameters = - UserusernameDeletePathParameters.UserusernameDeletePathParameters1.validate( - new UserusernameDeletePathParameters.PathParametersMapBuilder() - .username("a") - - .build(), - schemaConfiguration -); - -var request = new UserusernameDelete.DeleteRequestBuilder() - .pathParameters(pathParameters) - .build(); - -UserusernameDeleteResponses.EndpointResponse response; -try { - response = apiClient.delete(request); -} catch (UserusernameDeleteCode404Response.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; -} -UserusernameDeleteResponses.EndpointUserusernameDeleteCode200Response castResponse = (UserusernameDeleteResponses.EndpointUserusernameDeleteCode200Response) response; -``` -### get -public [UserusernameGetResponses.EndpointResponse](../../paths/userusername/get/UserusernameGetResponses.md#endpointresponse) get([UserusernameGet.GetRequest](../../paths/userusername/UserusernameGet.md#getrequest) request) - - - -**Parameters:**
-request - the input request - -**Returns:**
-the deserialized response - -**Throws:**
-IOException, InterruptedException - an exception happened when making the request
-ValidationException - the returned response body or header values do not conform the the schema validation requirements
-NotImplementedException - the request body serialization or deserialization has not yet been implemented
- or the header content type deserialization has not yet been implemented for this contentType
-ApiException - server returned a response/contentType not defined in the openapi document
- -#### 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.userusername.get.UserusernameGetPathParameters; -import org.openapijsonschematools.client.servers.RootServer0; -import org.openapijsonschematools.client.servers.RootServer1; -import org.openapijsonschematools.client.servers.RootServer2; -import org.openapijsonschematools.client.paths.userusername.get.responses.UserusernameGetCode200Response; -import org.openapijsonschematools.client.paths.userusername.get.responses.UserusernameGetCode400Response; -import org.openapijsonschematools.client.paths.userusername.get.responses.UserusernameGetCode404Response; -import org.openapijsonschematools.client.servers.RootServerInfo; -import org.openapijsonschematools.client.apis.paths.Userusername; -import org.openapijsonschematools.client.paths.userusername.get.UserusernameGetResponses; - -import java.io.IOException; -import java.util.Arrays; -import java.util.List; -import java.util.Map; -import java.util.AbstractMap; - -// if you want to use a server that is not SERVER_0 pass it in here and change the ServerIndex input below -ApiConfiguration.ServerInfo serverInfo = new ApiConfiguration.ServerInfoBuilder() - .rootServerInfo( - new RootServerInfo.RootServerInfoBuilder() - .rootServer0(new RootServer0()) - .build() - ) - .build(); -ApiConfiguration.ServerIndexInfo serverIndexInfo = new ApiConfiguration.ServerIndexInfoBuilder() - .rootServerInfoServerIndex(RootServerInfo.ServerIndex.SERVER_0) - .build(); -Duration timeout = Duration.ofSeconds(1L); -Map> defaultHeaders = Map.of("User-Agent", List.of("OpenAPI-JSON-Schema-Generator/1.0.0/java")); -ApiConfiguration apiConfiguration = new ApiConfiguration( - serverInfo - serverIndexInfo, - timeout, - defaultHeaders -); -SchemaConfiguration schemaConfiguration = new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().build()); -Userusername apiClient = new Userusername(apiConfiguration, schemaConfiguration); - - -// Map validation -UserusernameGetPathParameters.PathParametersMap pathParameters = - UserusernameGetPathParameters.UserusernameGetPathParameters1.validate( - new UserusernameGetPathParameters.PathParametersMapBuilder() - .username("a") - - .build(), - schemaConfiguration -); - -var request = new UserusernameGet.GetRequestBuilder() - .pathParameters(pathParameters) - .build(); - -UserusernameGetResponses.EndpointResponse response; -try { - response = apiClient.get(request); -} catch (UserusernameGetCode400Response.ResponseApiException | UserusernameGetCode404Response.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; -} -UserusernameGetResponses.EndpointUserusernameGetCode200Response castResponse = (UserusernameGetResponses.EndpointUserusernameGetCode200Response) response; -if (castResponse.body instanceof UserusernameGetCode200Response.ApplicationxmlResponseBody deserializedBody) { - // handle deserialized body here -} else { - UserusernameGetCode200Response.ApplicationjsonResponseBody deserializedBody = (UserusernameGetCode200Response.ApplicationjsonResponseBody) castResponse.body; - // handle deserialized body here -} -``` -### put -public Nothing? put([UserusernamePut.PutRequest](../../paths/userusername/UserusernamePut.md#putrequest) request) - -This can only be done by the logged in user. - -**Parameters:**
-request - the input request - -**Returns:**
-nothing (Nothing?) - -**Throws:**
-IOException, InterruptedException - an exception happened when making the request
-ValidationException - the returned response body or header values do not conform the the schema validation requirements
-NotImplementedException - the request body serialization or deserialization has not yet been implemented
- or the header content type deserialization has not yet been implemented for this contentType
-ApiException - server returned a response/contentType not defined in the openapi document
- -#### 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.userusername.put.UserusernamePutRequestBody; -import org.openapijsonschematools.client.components.schemas.User; -import org.openapijsonschematools.client.paths.userusername.put.UserusernamePutPathParameters; -import org.openapijsonschematools.client.servers.RootServer0; -import org.openapijsonschematools.client.servers.RootServer1; -import org.openapijsonschematools.client.servers.RootServer2; -import org.openapijsonschematools.client.paths.userusername.put.responses.UserusernamePutCode400Response; -import org.openapijsonschematools.client.paths.userusername.put.responses.UserusernamePutCode404Response; -import org.openapijsonschematools.client.servers.RootServerInfo; -import org.openapijsonschematools.client.apis.paths.Userusername; -import org.openapijsonschematools.client.paths.userusername.put.UserusernamePutResponses; - -import java.io.IOException; -import java.util.Arrays; -import java.util.List; -import java.util.Map; -import java.util.AbstractMap; - -// if you want to use a server that is not SERVER_0 pass it in here and change the ServerIndex input below -ApiConfiguration.ServerInfo serverInfo = new ApiConfiguration.ServerInfoBuilder() - .rootServerInfo( - new RootServerInfo.RootServerInfoBuilder() - .rootServer0(new RootServer0()) - .build() - ) - .build(); -ApiConfiguration.ServerIndexInfo serverIndexInfo = new ApiConfiguration.ServerIndexInfoBuilder() - .rootServerInfoServerIndex(RootServerInfo.ServerIndex.SERVER_0) - .build(); -Duration timeout = Duration.ofSeconds(1L); -Map> defaultHeaders = Map.of("User-Agent", List.of("OpenAPI-JSON-Schema-Generator/1.0.0/java")); -ApiConfiguration apiConfiguration = new ApiConfiguration( - serverInfo - serverIndexInfo, - timeout, - defaultHeaders -); -SchemaConfiguration schemaConfiguration = new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().build()); -Userusername apiClient = new Userusername(apiConfiguration, schemaConfiguration); - - -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 -); -UserusernamePut.SealedRequestBody requestBody = new UserusernamePut.ApplicationjsonRequestBody(requestBodyPayload); - -// Map validation -UserusernamePutPathParameters.PathParametersMap pathParameters = - UserusernamePutPathParameters.UserusernamePutPathParameters1.validate( - new UserusernamePutPathParameters.PathParametersMapBuilder() - .username("a") - - .build(), - schemaConfiguration -); - -var request = new UserusernamePut.PutRequestBuilder() - .requestBody(requestBody) - .pathParameters(pathParameters) - .build(); - -Nothing? response; -try { - response = apiClient.put(request); -} catch (UserusernamePutCode400Response.ResponseApiException | UserusernamePutCode404Response.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; -} -``` -[[Back to top]](#top) [[Back to README]](../../../README.md) diff --git a/samples/client/petstore/kotlin/docs/apis/tags/Anotherfake.md b/samples/client/petstore/kotlin/docs/apis/tags/Anotherfake.md deleted file mode 100644 index b6f57d843bf..00000000000 --- a/samples/client/petstore/kotlin/docs/apis/tags/Anotherfake.md +++ /dev/null @@ -1,119 +0,0 @@ -# Anotherfake - -public class Anotherfake extends extends ApiClient implements -[AnotherfakedummyPatch.Model123TestSpecialTagsOperation](../../paths/anotherfakedummy/AnotherfakedummyPatch.md#model123testspecialtagsoperation) - -an api client class which contains all the routes for tag="$another-fake?" - -## Method Summary -| Modifier and Type | Method and Description | -| ----------------- | ---------------------- | -| [AnotherfakedummyPatchResponses.EndpointResponse](../../paths/anotherfakedummy/patch/AnotherfakedummyPatchResponses.md#endpointresponse) | [model123TestSpecialTags](#model123testspecialtags)([AnotherfakedummyPatch.PatchRequest](../../paths/anotherfakedummy/AnotherfakedummyPatch.md#patchrequest) request)
To test special tags and operation ID starting with number | - -## Method Detail - -### model123TestSpecialTags -public [AnotherfakedummyPatchResponses.EndpointResponse](../../paths/anotherfakedummy/patch/AnotherfakedummyPatchResponses.md#endpointresponse) model123TestSpecialTags([AnotherfakedummyPatch.PatchRequest](../../paths/anotherfakedummy/AnotherfakedummyPatch.md#patchrequest) request) - -To test special tags and operation ID starting with number - -**Parameters:**
-request - the input request - -**Returns:**
-the deserialized response - -**Throws:**
-IOException, InterruptedException - an exception happened when making the request
-ValidationException - the returned response body or header values do not conform the the schema validation requirements
-NotImplementedException - the request body serialization or deserialization has not yet been implemented
- or the header content type deserialization has not yet been implemented for this contentType
-ApiException - server returned a response/contentType not defined in the openapi document
- -#### 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.AnotherfakedummyPatchRequestBody; -import org.openapijsonschematools.client.components.schemas.Client; -import org.openapijsonschematools.client.servers.RootServer0; -import org.openapijsonschematools.client.servers.RootServer1; -import org.openapijsonschematools.client.servers.RootServer2; -import org.openapijsonschematools.client.paths.anotherfakedummy.patch.responses.AnotherfakedummyPatchCode200Response; -import org.openapijsonschematools.client.servers.RootServerInfo; -import org.openapijsonschematools.client.apis.tags.Anotherfake; -import org.openapijsonschematools.client.paths.anotherfakedummy.patch.AnotherfakedummyPatchResponses; - -import java.io.IOException; -import java.util.Arrays; -import java.util.List; -import java.util.Map; -import java.util.AbstractMap; - -// if you want to use a server that is not SERVER_0 pass it in here and change the ServerIndex input below -ApiConfiguration.ServerInfo serverInfo = new ApiConfiguration.ServerInfoBuilder() - .rootServerInfo( - new RootServerInfo.RootServerInfoBuilder() - .rootServer0(new RootServer0()) - .build() - ) - .build(); -ApiConfiguration.ServerIndexInfo serverIndexInfo = new ApiConfiguration.ServerIndexInfoBuilder() - .rootServerInfoServerIndex(RootServerInfo.ServerIndex.SERVER_0) - .build(); -Duration timeout = Duration.ofSeconds(1L); -Map> defaultHeaders = Map.of("User-Agent", List.of("OpenAPI-JSON-Schema-Generator/1.0.0/java")); -ApiConfiguration apiConfiguration = new ApiConfiguration( - serverInfo - serverIndexInfo, - timeout, - defaultHeaders -); -SchemaConfiguration schemaConfiguration = new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().build()); -Anotherfake apiClient = new Anotherfake(apiConfiguration, schemaConfiguration); - - -Client1BoxedMap requestBodyPayload = - Client.Client1.validateAndBox( - new Client.ClientMapBuilder1() - .client("a") - - .build(), - schemaConfiguration -); -AnotherfakedummyPatchRequestBody.SealedRequestBody requestBody = new AnotherfakedummyPatchRequestBody.ApplicationjsonRequestBody(requestBodyPayload); - -var request = new AnotherfakedummyPatch.PatchRequestBuilder() - .requestBody(requestBody) - .build(); - -AnotherfakedummyPatchResponses.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; -} -AnotherfakedummyPatchResponses.EndpointAnotherfakedummyPatchCode200Response castResponse = (AnotherfakedummyPatchResponses.EndpointAnotherfakedummyPatchCode200Response) response; -AnotherfakedummyPatchCode200Response.ApplicationjsonResponseBody deserializedBody = (AnotherfakedummyPatchCode200Response.ApplicationjsonResponseBody) castResponse.body; -// handle deserialized body here -``` -[[Back to top]](#top) [[Back to README]](../../../README.md) diff --git a/samples/client/petstore/kotlin/docs/apis/tags/Default.md b/samples/client/petstore/kotlin/docs/apis/tags/Default.md deleted file mode 100644 index 716930384b1..00000000000 --- a/samples/client/petstore/kotlin/docs/apis/tags/Default.md +++ /dev/null @@ -1,103 +0,0 @@ -# Default - -public class Default extends extends ApiClient implements -[FooGet.FooGetOperation](../../paths/foo/FooGet.md#foogetoperation) - -an api client class which contains all the routes for tag="default" -operations that lack tags are assigned this default tag - -## Method Summary -| Modifier and Type | Method and Description | -| ----------------- | ---------------------- | -| [FooGetResponses.EndpointResponse](../../paths/foo/get/FooGetResponses.md#endpointresponse) | [fooGet](#fooget)([FooGet.GetRequest](../../paths/foo/FooGet.md#getrequest) request) | - -## Method Detail - -### fooGet -public [FooGetResponses.EndpointResponse](../../paths/foo/get/FooGetResponses.md#endpointresponse) fooGet([FooGet.GetRequest](../../paths/foo/FooGet.md#getrequest) request) - -**Parameters:**
-request - the input request - -**Returns:**
-the deserialized response - -**Throws:**
-IOException, InterruptedException - an exception happened when making the request
-ValidationException - the returned response body or header values do not conform the the schema validation requirements
-NotImplementedException - the request body serialization or deserialization has not yet been implemented
- or the header content type deserialization has not yet been implemented for this contentType
-ApiException - server returned a response/contentType not defined in the openapi document
- -#### 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.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.FooGetCodedefaultResponse; -import org.openapijsonschematools.client.paths.foo.get.FooGetServerInfo; -import org.openapijsonschematools.client.apis.tags.Default; -import org.openapijsonschematools.client.paths.foo.get.FooGetResponses; - -import java.io.IOException; -import java.util.Arrays; -import java.util.List; -import java.util.Map; -import java.util.AbstractMap; - -// if you want to use a server that is not SERVER_0 pass it in here and change the ServerIndex input below -ApiConfiguration.ServerInfo serverInfo = new ApiConfiguration.ServerInfoBuilder() - .fooGetServerInfo( - new FooGetServerInfo.FooGetServerInfoBuilder() - .fooGetServer0(new FooGetServer0()) - .build() - ) - .build(); -ApiConfiguration.ServerIndexInfo serverIndexInfo = new ApiConfiguration.ServerIndexInfoBuilder() - .fooGetServerInfoServerIndex(FooGetServerInfo.ServerIndex.SERVER_0) - .build(); -Duration timeout = Duration.ofSeconds(1L); -Map> defaultHeaders = Map.of("User-Agent", List.of("OpenAPI-JSON-Schema-Generator/1.0.0/java")); -ApiConfiguration apiConfiguration = new ApiConfiguration( - serverInfo - serverIndexInfo, - timeout, - defaultHeaders -); -SchemaConfiguration schemaConfiguration = new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().build()); -Default apiClient = new Default(apiConfiguration, schemaConfiguration); - - -var request = new FooGet.GetRequestBuilder().build(); - -FooGetResponses.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; -} -FooGetResponses.EndpointFooGetCodedefaultResponse castResponse = (FooGetResponses.EndpointFooGetCodedefaultResponse) response; -FooGetCodedefaultResponse.ApplicationjsonResponseBody deserializedBody = (FooGetCodedefaultResponse.ApplicationjsonResponseBody) castResponse.body; -// handle deserialized body here -``` -[[Back to top]](#top) [[Back to README]](../../../README.md) diff --git a/samples/client/petstore/kotlin/docs/apis/tags/Fake.md b/samples/client/petstore/kotlin/docs/apis/tags/Fake.md deleted file mode 100644 index 69b4c83b6d9..00000000000 --- a/samples/client/petstore/kotlin/docs/apis/tags/Fake.md +++ /dev/null @@ -1,4304 +0,0 @@ -# Fake - -public class Fake extends extends ApiClient implements -[FakejsonpatchPatch.JsonPatchOperation](../../paths/fakejsonpatch/FakejsonpatchPatch.md#jsonpatchoperation), -[FakerefsarrayofenumsPost.ArrayOfEnumsOperation](../../paths/fakerefsarrayofenums/FakerefsarrayofenumsPost.md#arrayofenumsoperation), -[CommonparamsubdirDelete.DeleteCommonParamOperation](../../paths/commonparamsubdir/CommonparamsubdirDelete.md#deletecommonparamoperation), -[CommonparamsubdirGet.GetCommonParamOperation](../../paths/commonparamsubdir/CommonparamsubdirGet.md#getcommonparamoperation), -[CommonparamsubdirPost.PostCommonParamOperation](../../paths/commonparamsubdir/CommonparamsubdirPost.md#postcommonparamoperation), -[FakecasesensitiveparamsPut.CaseSensitiveParamsOperation](../../paths/fakecasesensitiveparams/FakecasesensitiveparamsPut.md#casesensitiveparamsoperation), -[FakewildcardresponsesGet.WildCardResponsesOperation](../../paths/fakewildcardresponses/FakewildcardresponsesGet.md#wildcardresponsesoperation), -[FakebodywithqueryparamsPut.BodyWithQueryParamsOperation](../../paths/fakebodywithqueryparams/FakebodywithqueryparamsPut.md#bodywithqueryparamsoperation), -[FakejsonwithcharsetPost.JsonWithCharsetOperation](../../paths/fakejsonwithcharset/FakejsonwithcharsetPost.md#jsonwithcharsetoperation), -[FakerefsarraymodelPost.ArrayModelOperation](../../paths/fakerefsarraymodel/FakerefsarraymodelPost.md#arraymodeloperation), -[FakehealthGet.FakeHealthGetOperation](../../paths/fakehealth/FakehealthGet.md#fakehealthgetoperation), -[FakerefscomposedoneofnumberwithvalidationsPost.ComposedOneOfDifferentTypesOperation](../../paths/fakerefscomposedoneofnumberwithvalidations/FakerefscomposedoneofnumberwithvalidationsPost.md#composedoneofdifferenttypesoperation), -[FakerefobjinqueryGet.RefObjectInQueryOperation](../../paths/fakerefobjinquery/FakerefobjinqueryGet.md#refobjectinqueryoperation), -[FakebodywithfileschemaPut.BodyWithFileSchemaOperation](../../paths/fakebodywithfileschema/FakebodywithfileschemaPut.md#bodywithfileschemaoperation), -[FakerefsenumPost.StringEnumOperation](../../paths/fakerefsenum/FakerefsenumPost.md#stringenumoperation), -[FakeredirectionGet.RedirectionOperation](../../paths/fakeredirection/FakeredirectionGet.md#redirectionoperation), -[FakeuploadfilePost.UploadFileOperation](../../paths/fakeuploadfile/FakeuploadfilePost.md#uploadfileoperation), -[FakeinlinecompositionPost.InlineCompositionOperation](../../paths/fakeinlinecomposition/FakeinlinecompositionPost.md#inlinecompositionoperation), -[FakeDelete.GroupParametersOperation](../../paths/fake/FakeDelete.md#groupparametersoperation), -[FakeGet.EnumParametersOperation](../../paths/fake/FakeGet.md#enumparametersoperation), -[FakePatch.ClientModelOperation](../../paths/fake/FakePatch.md#clientmodeloperation), -[FakePost.EndpointParametersOperation](../../paths/fake/FakePost.md#endpointparametersoperation), -[FakerefsobjectmodelwithrefpropsPost.ObjectModelWithRefPropsOperation](../../paths/fakerefsobjectmodelwithrefprops/FakerefsobjectmodelwithrefpropsPost.md#objectmodelwithrefpropsoperation), -[FakepemcontenttypeGet.PemContentTypeOperation](../../paths/fakepemcontenttype/FakepemcontenttypeGet.md#pemcontenttypeoperation), -[FakerefsnumberPost.NumberWithValidationsOperation](../../paths/fakerefsnumber/FakerefsnumberPost.md#numberwithvalidationsoperation), -[FakerefsstringPost.ModelStringOperation](../../paths/fakerefsstring/FakerefsstringPost.md#modelstringoperation), -[FakeinlineadditionalpropertiesPost.InlineAdditionalPropertiesOperation](../../paths/fakeinlineadditionalproperties/FakeinlineadditionalpropertiesPost.md#inlineadditionalpropertiesoperation), -[FakerefsmammalPost.MammalOperation](../../paths/fakerefsmammal/FakerefsmammalPost.md#mammaloperation), -[SolidusGet.SlashRouteOperation](../../paths/solidus/SolidusGet.md#slashrouteoperation), -[FakerefsbooleanPost.ModelBooleanOperation](../../paths/fakerefsboolean/FakerefsbooleanPost.md#modelbooleanoperation), -[FakejsonformdataGet.JsonFormDataOperation](../../paths/fakejsonformdata/FakejsonformdataGet.md#jsonformdataoperation), -[Fakeparametercollisions1ababselfabPost.ParameterCollisionsOperation](../../paths/fakeparametercollisions1ababselfab/Fakeparametercollisions1ababselfabPost.md#parametercollisionsoperation), -[FakequeryparamwithjsoncontenttypeGet.QueryParamWithJsonContentTypeOperation](../../paths/fakequeryparamwithjsoncontenttype/FakequeryparamwithjsoncontenttypeGet.md#queryparamwithjsoncontenttypeoperation), -[FakeobjinqueryGet.ObjectInQueryOperation](../../paths/fakeobjinquery/FakeobjinqueryGet.md#objectinqueryoperation), -[FakemultiplesecuritiesGet.MultipleSecuritiesOperation](../../paths/fakemultiplesecurities/FakemultiplesecuritiesGet.md#multiplesecuritiesoperation), -[FaketestqueryparamtersPut.QueryParameterCollectionFormatOperation](../../paths/faketestqueryparamters/FaketestqueryparamtersPut.md#queryparametercollectionformatoperation), -[FakemultipleresponsebodiesGet.MultipleResponseBodiesOperation](../../paths/fakemultipleresponsebodies/FakemultipleresponsebodiesGet.md#multipleresponsebodiesoperation), -[FakeresponsewithoutschemaGet.ResponseWithoutSchemaOperation](../../paths/fakeresponsewithoutschema/FakeresponsewithoutschemaGet.md#responsewithoutschemaoperation), -[FakemultiplerequestbodycontenttypesPost.MultipleRequestBodyContentTypesOperation](../../paths/fakemultiplerequestbodycontenttypes/FakemultiplerequestbodycontenttypesPost.md#multiplerequestbodycontenttypesoperation), -[FakeuploaddownloadfilePost.UploadDownloadFileOperation](../../paths/fakeuploaddownloadfile/FakeuploaddownloadfilePost.md#uploaddownloadfileoperation), -[FakeuploadfilesPost.UploadFilesOperation](../../paths/fakeuploadfiles/FakeuploadfilesPost.md#uploadfilesoperation), -[FakeadditionalpropertieswitharrayofenumsGet.AdditionalPropertiesWithArrayOfEnumsOperation](../../paths/fakeadditionalpropertieswitharrayofenums/FakeadditionalpropertieswitharrayofenumsGet.md#additionalpropertieswitharrayofenumsoperation), -[FakedeletecoffeeidDelete.DeleteCoffeeOperation](../../paths/fakedeletecoffeeid/FakedeletecoffeeidDelete.md#deletecoffeeoperation) - -an api client class which contains all the routes for tag="fake" - -## Method Summary -| Modifier and Type | Method and Description | -| ----------------- | ---------------------- | -| [FakejsonpatchPatchResponses.EndpointResponse](../../paths/fakejsonpatch/patch/FakejsonpatchPatchResponses.md#endpointresponse) | [jsonPatch](#jsonpatch)([FakejsonpatchPatch.PatchRequest](../../paths/fakejsonpatch/FakejsonpatchPatch.md#patchrequest) request)
json patch route with a requestBody | -| [FakerefsarrayofenumsPostResponses.EndpointResponse](../../paths/fakerefsarrayofenums/post/FakerefsarrayofenumsPostResponses.md#endpointresponse) | [arrayOfEnums](#arrayofenums)([FakerefsarrayofenumsPost.PostRequest](../../paths/fakerefsarrayofenums/FakerefsarrayofenumsPost.md#postrequest) request) | -| [CommonparamsubdirDeleteResponses.EndpointResponse](../../paths/commonparamsubdir/delete/CommonparamsubdirDeleteResponses.md#endpointresponse) | [deleteCommonParam](#deletecommonparam)([CommonparamsubdirDelete.DeleteRequest](../../paths/commonparamsubdir/CommonparamsubdirDelete.md#deleterequest) request)
common param is overwritten | -| [CommonparamsubdirGetResponses.EndpointResponse](../../paths/commonparamsubdir/get/CommonparamsubdirGetResponses.md#endpointresponse) | [getCommonParam](#getcommonparam)([CommonparamsubdirGet.GetRequest](../../paths/commonparamsubdir/CommonparamsubdirGet.md#getrequest) request) | -| [CommonparamsubdirPostResponses.EndpointResponse](../../paths/commonparamsubdir/post/CommonparamsubdirPostResponses.md#endpointresponse) | [postCommonParam](#postcommonparam)([CommonparamsubdirPost.PostRequest](../../paths/commonparamsubdir/CommonparamsubdirPost.md#postrequest) request) | -| [FakecasesensitiveparamsPutResponses.EndpointResponse](../../paths/fakecasesensitiveparams/put/FakecasesensitiveparamsPutResponses.md#endpointresponse) | [caseSensitiveParams](#casesensitiveparams)([FakecasesensitiveparamsPut.PutRequest](../../paths/fakecasesensitiveparams/FakecasesensitiveparamsPut.md#putrequest) request)
Ensures that original naming is used in endpoint params, that way we don't have collisions | -| [FakewildcardresponsesGetResponses.EndpointResponse](../../paths/fakewildcardresponses/get/FakewildcardresponsesGetResponses.md#endpointresponse) | [wildCardResponses](#wildcardresponses)([FakewildcardresponsesGet.GetRequest](../../paths/fakewildcardresponses/FakewildcardresponsesGet.md#getrequest) request) | -| [FakebodywithqueryparamsPutResponses.EndpointResponse](../../paths/fakebodywithqueryparams/put/FakebodywithqueryparamsPutResponses.md#endpointresponse) | [bodyWithQueryParams](#bodywithqueryparams)([FakebodywithqueryparamsPut.PutRequest](../../paths/fakebodywithqueryparams/FakebodywithqueryparamsPut.md#putrequest) request) | -| [FakejsonwithcharsetPostResponses.EndpointResponse](../../paths/fakejsonwithcharset/post/FakejsonwithcharsetPostResponses.md#endpointresponse) | [jsonWithCharset](#jsonwithcharset)([FakejsonwithcharsetPost.PostRequest](../../paths/fakejsonwithcharset/FakejsonwithcharsetPost.md#postrequest) request) | -| [FakerefsarraymodelPostResponses.EndpointResponse](../../paths/fakerefsarraymodel/post/FakerefsarraymodelPostResponses.md#endpointresponse) | [arrayModel](#arraymodel)([FakerefsarraymodelPost.PostRequest](../../paths/fakerefsarraymodel/FakerefsarraymodelPost.md#postrequest) request)
Test serialization of ArrayModel | -| [FakehealthGetResponses.EndpointResponse](../../paths/fakehealth/get/FakehealthGetResponses.md#endpointresponse) | [fakeHealthGet](#fakehealthget)([FakehealthGet.GetRequest](../../paths/fakehealth/FakehealthGet.md#getrequest) request) | -| [FakerefscomposedoneofnumberwithvalidationsPostResponses.EndpointResponse](../../paths/fakerefscomposedoneofnumberwithvalidations/post/FakerefscomposedoneofnumberwithvalidationsPostResponses.md#endpointresponse) | [composedOneOfDifferentTypes](#composedoneofdifferenttypes)([FakerefscomposedoneofnumberwithvalidationsPost.PostRequest](../../paths/fakerefscomposedoneofnumberwithvalidations/FakerefscomposedoneofnumberwithvalidationsPost.md#postrequest) request)
Test serialization of object with $refed properties | -| [FakerefobjinqueryGetResponses.EndpointResponse](../../paths/fakerefobjinquery/get/FakerefobjinqueryGetResponses.md#endpointresponse) | [refObjectInQuery](#refobjectinquery)([FakerefobjinqueryGet.GetRequest](../../paths/fakerefobjinquery/FakerefobjinqueryGet.md#getrequest) request) | -| [FakebodywithfileschemaPutResponses.EndpointResponse](../../paths/fakebodywithfileschema/put/FakebodywithfileschemaPutResponses.md#endpointresponse) | [bodyWithFileSchema](#bodywithfileschema)([FakebodywithfileschemaPut.PutRequest](../../paths/fakebodywithfileschema/FakebodywithfileschemaPut.md#putrequest) request)
For this test, the body for this request much reference a schema named `File`. | -| [FakerefsenumPostResponses.EndpointResponse](../../paths/fakerefsenum/post/FakerefsenumPostResponses.md#endpointresponse) | [stringEnum](#stringenum)([FakerefsenumPost.PostRequest](../../paths/fakerefsenum/FakerefsenumPost.md#postrequest) request)
Test serialization of outer enum | -| [FakeredirectionGetResponses.EndpointResponse](../../paths/fakeredirection/get/FakeredirectionGetResponses.md#endpointresponse) | [redirection](#redirection)([FakeredirectionGet.GetRequest](../../paths/fakeredirection/FakeredirectionGet.md#getrequest) request) | -| [FakeuploadfilePostResponses.EndpointResponse](../../paths/fakeuploadfile/post/FakeuploadfilePostResponses.md#endpointresponse) | [uploadFile](#uploadfile)([FakeuploadfilePost.PostRequest](../../paths/fakeuploadfile/FakeuploadfilePost.md#postrequest) request)
| -| [FakeinlinecompositionPostResponses.EndpointResponse](../../paths/fakeinlinecomposition/post/FakeinlinecompositionPostResponses.md#endpointresponse) | [inlineComposition](#inlinecomposition)([FakeinlinecompositionPost.PostRequest](../../paths/fakeinlinecomposition/FakeinlinecompositionPost.md#postrequest) request)
composed schemas at inline locations + multiple requestBody content types | -| [FakeDeleteResponses.EndpointResponse](../../paths/fake/delete/FakeDeleteResponses.md#endpointresponse) | [groupParameters](#groupparameters)([FakeDelete.DeleteRequest](../../paths/fake/FakeDelete.md#deleterequest) request)
Fake endpoint to test group parameters (optional) | -| [FakeGetResponses.EndpointResponse](../../paths/fake/get/FakeGetResponses.md#endpointresponse) | [enumParameters](#enumparameters)([FakeGet.GetRequest](../../paths/fake/FakeGet.md#getrequest) request)
To test enum parameters | -| [FakePatchResponses.EndpointResponse](../../paths/fake/patch/FakePatchResponses.md#endpointresponse) | [clientModel](#clientmodel)([FakePatch.PatchRequest](../../paths/fake/FakePatch.md#patchrequest) request)
To test "client" model | -| [FakePostResponses.EndpointResponse](../../paths/fake/post/FakePostResponses.md#endpointresponse) | [endpointParameters](#endpointparameters)([FakePost.PostRequest](../../paths/fake/FakePost.md#postrequest) request)
Fake endpoint for testing various parameters
假端點
偽のエンドポイント
가짜 엔드 포인트
| -| [FakerefsobjectmodelwithrefpropsPostResponses.EndpointResponse](../../paths/fakerefsobjectmodelwithrefprops/post/FakerefsobjectmodelwithrefpropsPostResponses.md#endpointresponse) | [objectModelWithRefProps](#objectmodelwithrefprops)([FakerefsobjectmodelwithrefpropsPost.PostRequest](../../paths/fakerefsobjectmodelwithrefprops/FakerefsobjectmodelwithrefpropsPost.md#postrequest) request)
Test serialization of object with $refed properties | -| [FakepemcontenttypeGetResponses.EndpointResponse](../../paths/fakepemcontenttype/get/FakepemcontenttypeGetResponses.md#endpointresponse) | [pemContentType](#pemcontenttype)([FakepemcontenttypeGet.GetRequest](../../paths/fakepemcontenttype/FakepemcontenttypeGet.md#getrequest) request) | -| [FakerefsnumberPostResponses.EndpointResponse](../../paths/fakerefsnumber/post/FakerefsnumberPostResponses.md#endpointresponse) | [numberWithValidations](#numberwithvalidations)([FakerefsnumberPost.PostRequest](../../paths/fakerefsnumber/FakerefsnumberPost.md#postrequest) request)
Test serialization of outer number types | -| [FakerefsstringPostResponses.EndpointResponse](../../paths/fakerefsstring/post/FakerefsstringPostResponses.md#endpointresponse) | [modelString](#modelstring)([FakerefsstringPost.PostRequest](../../paths/fakerefsstring/FakerefsstringPost.md#postrequest) request)
Test serialization of outer string types | -| [FakeinlineadditionalpropertiesPostResponses.EndpointResponse](../../paths/fakeinlineadditionalproperties/post/FakeinlineadditionalpropertiesPostResponses.md#endpointresponse) | [inlineAdditionalProperties](#inlineadditionalproperties)([FakeinlineadditionalpropertiesPost.PostRequest](../../paths/fakeinlineadditionalproperties/FakeinlineadditionalpropertiesPost.md#postrequest) request)
| -| [FakerefsmammalPostResponses.EndpointResponse](../../paths/fakerefsmammal/post/FakerefsmammalPostResponses.md#endpointresponse) | [mammal](#mammal)([FakerefsmammalPost.PostRequest](../../paths/fakerefsmammal/FakerefsmammalPost.md#postrequest) request)
Test serialization of mammals | -| [SolidusGetResponses.EndpointResponse](../../paths/solidus/get/SolidusGetResponses.md#endpointresponse) | [slashRoute](#slashroute)([SolidusGet.GetRequest](../../paths/solidus/SolidusGet.md#getrequest) request) | -| [FakerefsbooleanPostResponses.EndpointResponse](../../paths/fakerefsboolean/post/FakerefsbooleanPostResponses.md#endpointresponse) | [modelBoolean](#modelboolean)([FakerefsbooleanPost.PostRequest](../../paths/fakerefsboolean/FakerefsbooleanPost.md#postrequest) request)
Test serialization of outer boolean types | -| [FakejsonformdataGetResponses.EndpointResponse](../../paths/fakejsonformdata/get/FakejsonformdataGetResponses.md#endpointresponse) | [jsonFormData](#jsonformdata)([FakejsonformdataGet.GetRequest](../../paths/fakejsonformdata/FakejsonformdataGet.md#getrequest) request)
| -| [Fakeparametercollisions1ababselfabPostResponses.EndpointResponse](../../paths/fakeparametercollisions1ababselfab/post/Fakeparametercollisions1ababselfabPostResponses.md#endpointresponse) | [parameterCollisions](#parametercollisions)([Fakeparametercollisions1ababselfabPost.PostRequest](../../paths/fakeparametercollisions1ababselfab/Fakeparametercollisions1ababselfabPost.md#postrequest) request) | -| [FakequeryparamwithjsoncontenttypeGetResponses.EndpointResponse](../../paths/fakequeryparamwithjsoncontenttype/get/FakequeryparamwithjsoncontenttypeGetResponses.md#endpointresponse) | [queryParamWithJsonContentType](#queryparamwithjsoncontenttype)([FakequeryparamwithjsoncontenttypeGet.GetRequest](../../paths/fakequeryparamwithjsoncontenttype/FakequeryparamwithjsoncontenttypeGet.md#getrequest) request) | -| [FakeobjinqueryGetResponses.EndpointResponse](../../paths/fakeobjinquery/get/FakeobjinqueryGetResponses.md#endpointresponse) | [objectInQuery](#objectinquery)([FakeobjinqueryGet.GetRequest](../../paths/fakeobjinquery/FakeobjinqueryGet.md#getrequest) request) | -| [FakemultiplesecuritiesGetResponses.EndpointResponse](../../paths/fakemultiplesecurities/get/FakemultiplesecuritiesGetResponses.md#endpointresponse) | [multipleSecurities](#multiplesecurities)([FakemultiplesecuritiesGet.GetRequest](../../paths/fakemultiplesecurities/FakemultiplesecuritiesGet.md#getrequest) request) | -| [FaketestqueryparamtersPutResponses.EndpointResponse](../../paths/faketestqueryparamters/put/FaketestqueryparamtersPutResponses.md#endpointresponse) | [queryParameterCollectionFormat](#queryparametercollectionformat)([FaketestqueryparamtersPut.PutRequest](../../paths/faketestqueryparamters/FaketestqueryparamtersPut.md#putrequest) request)
To test the collection format in query parameters | -| [FakemultipleresponsebodiesGetResponses.EndpointResponse](../../paths/fakemultipleresponsebodies/get/FakemultipleresponsebodiesGetResponses.md#endpointresponse) | [multipleResponseBodies](#multipleresponsebodies)([FakemultipleresponsebodiesGet.GetRequest](../../paths/fakemultipleresponsebodies/FakemultipleresponsebodiesGet.md#getrequest) request) | -| [FakeresponsewithoutschemaGetResponses.EndpointResponse](../../paths/fakeresponsewithoutschema/get/FakeresponsewithoutschemaGetResponses.md#endpointresponse) | [responseWithoutSchema](#responsewithoutschema)([FakeresponsewithoutschemaGet.GetRequest](../../paths/fakeresponsewithoutschema/FakeresponsewithoutschemaGet.md#getrequest) request) | -| [FakemultiplerequestbodycontenttypesPostResponses.EndpointResponse](../../paths/fakemultiplerequestbodycontenttypes/post/FakemultiplerequestbodycontenttypesPostResponses.md#endpointresponse) | [multipleRequestBodyContentTypes](#multiplerequestbodycontenttypes)([FakemultiplerequestbodycontenttypesPost.PostRequest](../../paths/fakemultiplerequestbodycontenttypes/FakemultiplerequestbodycontenttypesPost.md#postrequest) request)
composed schemas at inline locations + multiple requestBody content types | -| [FakeuploaddownloadfilePostResponses.EndpointResponse](../../paths/fakeuploaddownloadfile/post/FakeuploaddownloadfilePostResponses.md#endpointresponse) | [uploadDownloadFile](#uploaddownloadfile)([FakeuploaddownloadfilePost.PostRequest](../../paths/fakeuploaddownloadfile/FakeuploaddownloadfilePost.md#postrequest) request)
| -| [FakeuploadfilesPostResponses.EndpointResponse](../../paths/fakeuploadfiles/post/FakeuploadfilesPostResponses.md#endpointresponse) | [uploadFiles](#uploadfiles)([FakeuploadfilesPost.PostRequest](../../paths/fakeuploadfiles/FakeuploadfilesPost.md#postrequest) request)
| -| [FakeadditionalpropertieswitharrayofenumsGetResponses.EndpointResponse](../../paths/fakeadditionalpropertieswitharrayofenums/get/FakeadditionalpropertieswitharrayofenumsGetResponses.md#endpointresponse) | [additionalPropertiesWithArrayOfEnums](#additionalpropertieswitharrayofenums)([FakeadditionalpropertieswitharrayofenumsGet.GetRequest](../../paths/fakeadditionalpropertieswitharrayofenums/FakeadditionalpropertieswitharrayofenumsGet.md#getrequest) request) | -| [FakedeletecoffeeidDeleteResponses.EndpointResponse](../../paths/fakedeletecoffeeid/delete/FakedeletecoffeeidDeleteResponses.md#endpointresponse) | [deleteCoffee](#deletecoffee)([FakedeletecoffeeidDelete.DeleteRequest](../../paths/fakedeletecoffeeid/FakedeletecoffeeidDelete.md#deleterequest) request)
Delete the coffee identified by the given id, (delete without request body) | - -## Method Detail - -### jsonPatch -public [FakejsonpatchPatchResponses.EndpointResponse](../../paths/fakejsonpatch/patch/FakejsonpatchPatchResponses.md#endpointresponse) jsonPatch([FakejsonpatchPatch.PatchRequest](../../paths/fakejsonpatch/FakejsonpatchPatch.md#patchrequest) request) - -json patch route with a requestBody - -**Parameters:**
-request - the input request - -**Returns:**
-the deserialized response - -**Throws:**
-IOException, InterruptedException - an exception happened when making the request
-ValidationException - the returned response body or header values do not conform the the schema validation requirements
-NotImplementedException - the request body serialization or deserialization has not yet been implemented
- or the header content type deserialization has not yet been implemented for this contentType
-ApiException - server returned a response/contentType not defined in the openapi document
- -#### 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.FakejsonpatchPatchRequestBody; -import org.openapijsonschematools.client.components.schemas.JSONPatchRequest; -import org.openapijsonschematools.client.RootServerInfo; -import org.openapijsonschematools.client.servers.RootServer0; -import org.openapijsonschematools.client.servers.RootServer1; -import org.openapijsonschematools.client.servers.RootServer2; -import org.openapijsonschematools.client.paths.fakejsonpatch.patch.responses.FakejsonpatchPatchCode200Response; -import org.openapijsonschematools.client.servers.RootServerInfo; -import org.openapijsonschematools.client.apis.tags.Fake; -import org.openapijsonschematools.client.paths.fakejsonpatch.patch.FakejsonpatchPatchResponses; - -import java.io.IOException; -import java.util.Arrays; -import java.util.List; -import java.util.Map; -import java.util.AbstractMap; - -// if you want to use a server that is not SERVER_0 pass it in here and change the ServerIndex input below -ApiConfiguration.ServerInfo serverInfo = new ApiConfiguration.ServerInfoBuilder() - .rootServerInfo( - new RootServerInfo.RootServerInfoBuilder() - .rootServer0(new RootServer0()) - .build() - ) - .build(); -ApiConfiguration.ServerIndexInfo serverIndexInfo = new ApiConfiguration.ServerIndexInfoBuilder() - .rootServerInfoServerIndex(RootServerInfo.ServerIndex.SERVER_0) - .build(); -Duration timeout = Duration.ofSeconds(1L); -Map> defaultHeaders = Map.of("User-Agent", List.of("OpenAPI-JSON-Schema-Generator/1.0.0/java")); -ApiConfiguration apiConfiguration = new ApiConfiguration( - serverInfo - serverIndexInfo, - timeout, - defaultHeaders -); -SchemaConfiguration schemaConfiguration = new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().build()); -Fake apiClient = new Fake(apiConfiguration, schemaConfiguration); - - -var request = new FakejsonpatchPatch.PatchRequestBuilder().build(); - -FakejsonpatchPatchResponses.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; -} -FakejsonpatchPatchResponses.EndpointFakejsonpatchPatchCode200Response castResponse = (FakejsonpatchPatchResponses.EndpointFakejsonpatchPatchCode200Response) response; -``` -### arrayOfEnums -public [FakerefsarrayofenumsPostResponses.EndpointResponse](../../paths/fakerefsarrayofenums/post/FakerefsarrayofenumsPostResponses.md#endpointresponse) arrayOfEnums([FakerefsarrayofenumsPost.PostRequest](../../paths/fakerefsarrayofenums/FakerefsarrayofenumsPost.md#postrequest) request) - -**Parameters:**
-request - the input request - -**Returns:**
-the deserialized response - -**Throws:**
-IOException, InterruptedException - an exception happened when making the request
-ValidationException - the returned response body or header values do not conform the the schema validation requirements
-NotImplementedException - the request body serialization or deserialization has not yet been implemented
- or the header content type deserialization has not yet been implemented for this contentType
-ApiException - server returned a response/contentType not defined in the openapi document
- -#### 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.FakerefsarrayofenumsPostRequestBody; -import org.openapijsonschematools.client.components.schemas.ArrayOfEnums; -import org.openapijsonschematools.client.RootServerInfo; -import org.openapijsonschematools.client.servers.RootServer0; -import org.openapijsonschematools.client.servers.RootServer1; -import org.openapijsonschematools.client.servers.RootServer2; -import org.openapijsonschematools.client.paths.fakerefsarrayofenums.post.responses.FakerefsarrayofenumsPostCode200Response; -import org.openapijsonschematools.client.servers.RootServerInfo; -import org.openapijsonschematools.client.apis.tags.Fake; -import org.openapijsonschematools.client.paths.fakerefsarrayofenums.post.FakerefsarrayofenumsPostResponses; - -import java.io.IOException; -import java.util.Arrays; -import java.util.List; -import java.util.Map; -import java.util.AbstractMap; - -// if you want to use a server that is not SERVER_0 pass it in here and change the ServerIndex input below -ApiConfiguration.ServerInfo serverInfo = new ApiConfiguration.ServerInfoBuilder() - .rootServerInfo( - new RootServerInfo.RootServerInfoBuilder() - .rootServer0(new RootServer0()) - .build() - ) - .build(); -ApiConfiguration.ServerIndexInfo serverIndexInfo = new ApiConfiguration.ServerIndexInfoBuilder() - .rootServerInfoServerIndex(RootServerInfo.ServerIndex.SERVER_0) - .build(); -Duration timeout = Duration.ofSeconds(1L); -Map> defaultHeaders = Map.of("User-Agent", List.of("OpenAPI-JSON-Schema-Generator/1.0.0/java")); -ApiConfiguration apiConfiguration = new ApiConfiguration( - serverInfo - serverIndexInfo, - timeout, - defaultHeaders -); -SchemaConfiguration schemaConfiguration = new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().build()); -Fake apiClient = new Fake(apiConfiguration, schemaConfiguration); - - -var request = new FakerefsarrayofenumsPost.PostRequestBuilder().build(); - -FakerefsarrayofenumsPostResponses.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; -} -FakerefsarrayofenumsPostResponses.EndpointFakerefsarrayofenumsPostCode200Response castResponse = (FakerefsarrayofenumsPostResponses.EndpointFakerefsarrayofenumsPostCode200Response) response; -FakerefsarrayofenumsPostCode200Response.ApplicationjsonResponseBody deserializedBody = (FakerefsarrayofenumsPostCode200Response.ApplicationjsonResponseBody) castResponse.body; -// handle deserialized body here -``` -### deleteCommonParam -public [CommonparamsubdirDeleteResponses.EndpointResponse](../../paths/commonparamsubdir/delete/CommonparamsubdirDeleteResponses.md#endpointresponse) deleteCommonParam([CommonparamsubdirDelete.DeleteRequest](../../paths/commonparamsubdir/CommonparamsubdirDelete.md#deleterequest) request) - -common param is overwritten - -**Parameters:**
-request - the input request - -**Returns:**
-the deserialized response - -**Throws:**
-IOException, InterruptedException - an exception happened when making the request
-ValidationException - the returned response body or header values do not conform the the schema validation requirements
-NotImplementedException - the request body serialization or deserialization has not yet been implemented
- or the header content type deserialization has not yet been implemented for this contentType
-ApiException - server returned a response/contentType not defined in the openapi document
- -#### 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.CommonparamsubdirDeleteHeaderParameters; -import org.openapijsonschematools.client.RootServerInfo; -import org.openapijsonschematools.client.paths.commonparamsubdir.delete.CommonparamsubdirDeletePathParameters; -import org.openapijsonschematools.client.servers.RootServer0; -import org.openapijsonschematools.client.servers.RootServer1; -import org.openapijsonschematools.client.servers.RootServer2; -import org.openapijsonschematools.client.paths.commonparamsubdir.delete.responses.CommonparamsubdirDeleteCode200Response; -import org.openapijsonschematools.client.servers.RootServerInfo; -import org.openapijsonschematools.client.apis.tags.Fake; -import org.openapijsonschematools.client.paths.commonparamsubdir.delete.CommonparamsubdirDeleteResponses; - -import java.io.IOException; -import java.util.Arrays; -import java.util.List; -import java.util.Map; -import java.util.AbstractMap; - -// if you want to use a server that is not SERVER_0 pass it in here and change the ServerIndex input below -ApiConfiguration.ServerInfo serverInfo = new ApiConfiguration.ServerInfoBuilder() - .rootServerInfo( - new RootServerInfo.RootServerInfoBuilder() - .rootServer0(new RootServer0()) - .build() - ) - .build(); -ApiConfiguration.ServerIndexInfo serverIndexInfo = new ApiConfiguration.ServerIndexInfoBuilder() - .rootServerInfoServerIndex(RootServerInfo.ServerIndex.SERVER_0) - .build(); -Duration timeout = Duration.ofSeconds(1L); -Map> defaultHeaders = Map.of("User-Agent", List.of("OpenAPI-JSON-Schema-Generator/1.0.0/java")); -ApiConfiguration apiConfiguration = new ApiConfiguration( - serverInfo - serverIndexInfo, - timeout, - defaultHeaders -); -SchemaConfiguration schemaConfiguration = new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().build()); -Fake apiClient = new Fake(apiConfiguration, schemaConfiguration); - - -// Map validation -CommonparamsubdirDeletePathParameters.PathParametersMap pathParameters = - CommonparamsubdirDeletePathParameters.CommonparamsubdirDeletePathParameters1.validate( - new CommonparamsubdirDeletePathParameters.PathParametersMapBuilder() - .subDir("c") - - .build(), - schemaConfiguration -); - -var request = new CommonparamsubdirDelete.DeleteRequestBuilder() - .pathParameters(pathParameters) - .build(); - -CommonparamsubdirDeleteResponses.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; -} -CommonparamsubdirDeleteResponses.EndpointCommonparamsubdirDeleteCode200Response castResponse = (CommonparamsubdirDeleteResponses.EndpointCommonparamsubdirDeleteCode200Response) response; -``` -### getCommonParam -public [CommonparamsubdirGetResponses.EndpointResponse](../../paths/commonparamsubdir/get/CommonparamsubdirGetResponses.md#endpointresponse) getCommonParam([CommonparamsubdirGet.GetRequest](../../paths/commonparamsubdir/CommonparamsubdirGet.md#getrequest) request) - -**Parameters:**
-request - the input request - -**Returns:**
-the deserialized response - -**Throws:**
-IOException, InterruptedException - an exception happened when making the request
-ValidationException - the returned response body or header values do not conform the the schema validation requirements
-NotImplementedException - the request body serialization or deserialization has not yet been implemented
- or the header content type deserialization has not yet been implemented for this contentType
-ApiException - server returned a response/contentType not defined in the openapi document
- -#### 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.get.CommonparamsubdirGetQueryParameters; -import org.openapijsonschematools.client.RootServerInfo; -import org.openapijsonschematools.client.paths.commonparamsubdir.get.CommonparamsubdirGetPathParameters; -import org.openapijsonschematools.client.servers.RootServer0; -import org.openapijsonschematools.client.servers.RootServer1; -import org.openapijsonschematools.client.servers.RootServer2; -import org.openapijsonschematools.client.paths.commonparamsubdir.get.responses.CommonparamsubdirGetCode200Response; -import org.openapijsonschematools.client.servers.RootServerInfo; -import org.openapijsonschematools.client.apis.tags.Fake; -import org.openapijsonschematools.client.paths.commonparamsubdir.get.CommonparamsubdirGetResponses; - -import java.io.IOException; -import java.util.Arrays; -import java.util.List; -import java.util.Map; -import java.util.AbstractMap; - -// if you want to use a server that is not SERVER_0 pass it in here and change the ServerIndex input below -ApiConfiguration.ServerInfo serverInfo = new ApiConfiguration.ServerInfoBuilder() - .rootServerInfo( - new RootServerInfo.RootServerInfoBuilder() - .rootServer0(new RootServer0()) - .build() - ) - .build(); -ApiConfiguration.ServerIndexInfo serverIndexInfo = new ApiConfiguration.ServerIndexInfoBuilder() - .rootServerInfoServerIndex(RootServerInfo.ServerIndex.SERVER_0) - .build(); -Duration timeout = Duration.ofSeconds(1L); -Map> defaultHeaders = Map.of("User-Agent", List.of("OpenAPI-JSON-Schema-Generator/1.0.0/java")); -ApiConfiguration apiConfiguration = new ApiConfiguration( - serverInfo - serverIndexInfo, - timeout, - defaultHeaders -); -SchemaConfiguration schemaConfiguration = new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().build()); -Fake apiClient = new Fake(apiConfiguration, schemaConfiguration); - - -// Map validation -CommonparamsubdirGetPathParameters.PathParametersMap pathParameters = - CommonparamsubdirGetPathParameters.CommonparamsubdirGetPathParameters1.validate( - new CommonparamsubdirGetPathParameters.PathParametersMapBuilder() - .subDir("a") - - .build(), - schemaConfiguration -); - -var request = new CommonparamsubdirGet.GetRequestBuilder() - .pathParameters(pathParameters) - .build(); - -CommonparamsubdirGetResponses.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; -} -CommonparamsubdirGetResponses.EndpointCommonparamsubdirGetCode200Response castResponse = (CommonparamsubdirGetResponses.EndpointCommonparamsubdirGetCode200Response) response; -``` -### postCommonParam -public [CommonparamsubdirPostResponses.EndpointResponse](../../paths/commonparamsubdir/post/CommonparamsubdirPostResponses.md#endpointresponse) postCommonParam([CommonparamsubdirPost.PostRequest](../../paths/commonparamsubdir/CommonparamsubdirPost.md#postrequest) request) - -**Parameters:**
-request - the input request - -**Returns:**
-the deserialized response - -**Throws:**
-IOException, InterruptedException - an exception happened when making the request
-ValidationException - the returned response body or header values do not conform the the schema validation requirements
-NotImplementedException - the request body serialization or deserialization has not yet been implemented
- or the header content type deserialization has not yet been implemented for this contentType
-ApiException - server returned a response/contentType not defined in the openapi document
- -#### 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.post.CommonparamsubdirPostHeaderParameters; -import org.openapijsonschematools.client.RootServerInfo; -import org.openapijsonschematools.client.paths.commonparamsubdir.post.CommonparamsubdirPostPathParameters; -import org.openapijsonschematools.client.servers.RootServer0; -import org.openapijsonschematools.client.servers.RootServer1; -import org.openapijsonschematools.client.servers.RootServer2; -import org.openapijsonschematools.client.paths.commonparamsubdir.post.responses.CommonparamsubdirPostCode200Response; -import org.openapijsonschematools.client.servers.RootServerInfo; -import org.openapijsonschematools.client.apis.tags.Fake; -import org.openapijsonschematools.client.paths.commonparamsubdir.post.CommonparamsubdirPostResponses; - -import java.io.IOException; -import java.util.Arrays; -import java.util.List; -import java.util.Map; -import java.util.AbstractMap; - -// if you want to use a server that is not SERVER_0 pass it in here and change the ServerIndex input below -ApiConfiguration.ServerInfo serverInfo = new ApiConfiguration.ServerInfoBuilder() - .rootServerInfo( - new RootServerInfo.RootServerInfoBuilder() - .rootServer0(new RootServer0()) - .build() - ) - .build(); -ApiConfiguration.ServerIndexInfo serverIndexInfo = new ApiConfiguration.ServerIndexInfoBuilder() - .rootServerInfoServerIndex(RootServerInfo.ServerIndex.SERVER_0) - .build(); -Duration timeout = Duration.ofSeconds(1L); -Map> defaultHeaders = Map.of("User-Agent", List.of("OpenAPI-JSON-Schema-Generator/1.0.0/java")); -ApiConfiguration apiConfiguration = new ApiConfiguration( - serverInfo - serverIndexInfo, - timeout, - defaultHeaders -); -SchemaConfiguration schemaConfiguration = new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().build()); -Fake apiClient = new Fake(apiConfiguration, schemaConfiguration); - - -// Map validation -CommonparamsubdirPostPathParameters.PathParametersMap pathParameters = - CommonparamsubdirPostPathParameters.CommonparamsubdirPostPathParameters1.validate( - new CommonparamsubdirPostPathParameters.PathParametersMapBuilder() - .subDir("a") - - .build(), - schemaConfiguration -); - -var request = new CommonparamsubdirPost.PostRequestBuilder() - .pathParameters(pathParameters) - .build(); - -CommonparamsubdirPostResponses.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; -} -CommonparamsubdirPostResponses.EndpointCommonparamsubdirPostCode200Response castResponse = (CommonparamsubdirPostResponses.EndpointCommonparamsubdirPostCode200Response) response; -``` -### caseSensitiveParams -public [FakecasesensitiveparamsPutResponses.EndpointResponse](../../paths/fakecasesensitiveparams/put/FakecasesensitiveparamsPutResponses.md#endpointresponse) caseSensitiveParams([FakecasesensitiveparamsPut.PutRequest](../../paths/fakecasesensitiveparams/FakecasesensitiveparamsPut.md#putrequest) request) - -Ensures that original naming is used in endpoint params, that way we don't have collisions - -**Parameters:**
-request - the input request - -**Returns:**
-the deserialized response - -**Throws:**
-IOException, InterruptedException - an exception happened when making the request
-ValidationException - the returned response body or header values do not conform the the schema validation requirements
-NotImplementedException - the request body serialization or deserialization has not yet been implemented
- or the header content type deserialization has not yet been implemented for this contentType
-ApiException - server returned a response/contentType not defined in the openapi document
- -#### 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.fakecasesensitiveparams.put.FakecasesensitiveparamsPutQueryParameters; -import org.openapijsonschematools.client.servers.RootServer0; -import org.openapijsonschematools.client.servers.RootServer1; -import org.openapijsonschematools.client.servers.RootServer2; -import org.openapijsonschematools.client.paths.fakecasesensitiveparams.put.responses.FakecasesensitiveparamsPutCode200Response; -import org.openapijsonschematools.client.servers.RootServerInfo; -import org.openapijsonschematools.client.apis.tags.Fake; -import org.openapijsonschematools.client.paths.fakecasesensitiveparams.put.FakecasesensitiveparamsPutResponses; - -import java.io.IOException; -import java.util.Arrays; -import java.util.List; -import java.util.Map; -import java.util.AbstractMap; - -// if you want to use a server that is not SERVER_0 pass it in here and change the ServerIndex input below -ApiConfiguration.ServerInfo serverInfo = new ApiConfiguration.ServerInfoBuilder() - .rootServerInfo( - new RootServerInfo.RootServerInfoBuilder() - .rootServer0(new RootServer0()) - .build() - ) - .build(); -ApiConfiguration.ServerIndexInfo serverIndexInfo = new ApiConfiguration.ServerIndexInfoBuilder() - .rootServerInfoServerIndex(RootServerInfo.ServerIndex.SERVER_0) - .build(); -Duration timeout = Duration.ofSeconds(1L); -Map> defaultHeaders = Map.of("User-Agent", List.of("OpenAPI-JSON-Schema-Generator/1.0.0/java")); -ApiConfiguration apiConfiguration = new ApiConfiguration( - serverInfo - serverIndexInfo, - timeout, - defaultHeaders -); -SchemaConfiguration schemaConfiguration = new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().build()); -Fake apiClient = new Fake(apiConfiguration, schemaConfiguration); - - -// Map validation -FakecasesensitiveparamsPutQueryParameters.QueryParametersMap queryParameters = - FakecasesensitiveparamsPutQueryParameters.FakecasesensitiveparamsPutQueryParameters1.validate( - new FakecasesensitiveparamsPutQueryParameters.QueryParametersMapBuilder() - .SomeVar("a") - - .someVar("a") - - .some_var("a") - - .build(), - schemaConfiguration -); - -var request = new FakecasesensitiveparamsPut.PutRequestBuilder() - .queryParameters(queryParameters) - .build(); - -FakecasesensitiveparamsPutResponses.EndpointResponse response; -try { - response = apiClient.put(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; -} -FakecasesensitiveparamsPutResponses.EndpointFakecasesensitiveparamsPutCode200Response castResponse = (FakecasesensitiveparamsPutResponses.EndpointFakecasesensitiveparamsPutCode200Response) response; -``` -### wildCardResponses -public [FakewildcardresponsesGetResponses.EndpointResponse](../../paths/fakewildcardresponses/get/FakewildcardresponsesGetResponses.md#endpointresponse) wildCardResponses([FakewildcardresponsesGet.GetRequest](../../paths/fakewildcardresponses/FakewildcardresponsesGet.md#getrequest) request) - -**Parameters:**
-request - the input request - -**Returns:**
-the deserialized response - -**Throws:**
-IOException, InterruptedException - an exception happened when making the request
-ValidationException - the returned response body or header values do not conform the the schema validation requirements
-NotImplementedException - the request body serialization or deserialization has not yet been implemented
- or the header content type deserialization has not yet been implemented for this contentType
-ApiException - server returned a response/contentType not defined in the openapi document
- -#### 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.servers.RootServer0; -import org.openapijsonschematools.client.servers.RootServer1; -import org.openapijsonschematools.client.servers.RootServer2; -import org.openapijsonschematools.client.paths.fakewildcardresponses.get.responses.FakewildcardresponsesGetCode1XXResponse; -import org.openapijsonschematools.client.paths.fakewildcardresponses.get.responses.FakewildcardresponsesGetCode200Response; -import org.openapijsonschematools.client.paths.fakewildcardresponses.get.responses.FakewildcardresponsesGetCode2XXResponse; -import org.openapijsonschematools.client.paths.fakewildcardresponses.get.responses.FakewildcardresponsesGetCode3XXResponse; -import org.openapijsonschematools.client.paths.fakewildcardresponses.get.responses.FakewildcardresponsesGetCode4XXResponse; -import org.openapijsonschematools.client.paths.fakewildcardresponses.get.responses.FakewildcardresponsesGetCode5XXResponse; -import org.openapijsonschematools.client.servers.RootServerInfo; -import org.openapijsonschematools.client.apis.tags.Fake; -import org.openapijsonschematools.client.paths.fakewildcardresponses.get.FakewildcardresponsesGetResponses; - -import java.io.IOException; -import java.util.Arrays; -import java.util.List; -import java.util.Map; -import java.util.AbstractMap; - -// if you want to use a server that is not SERVER_0 pass it in here and change the ServerIndex input below -ApiConfiguration.ServerInfo serverInfo = new ApiConfiguration.ServerInfoBuilder() - .rootServerInfo( - new RootServerInfo.RootServerInfoBuilder() - .rootServer0(new RootServer0()) - .build() - ) - .build(); -ApiConfiguration.ServerIndexInfo serverIndexInfo = new ApiConfiguration.ServerIndexInfoBuilder() - .rootServerInfoServerIndex(RootServerInfo.ServerIndex.SERVER_0) - .build(); -Duration timeout = Duration.ofSeconds(1L); -Map> defaultHeaders = Map.of("User-Agent", List.of("OpenAPI-JSON-Schema-Generator/1.0.0/java")); -ApiConfiguration apiConfiguration = new ApiConfiguration( - serverInfo - serverIndexInfo, - timeout, - defaultHeaders -); -SchemaConfiguration schemaConfiguration = new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().build()); -Fake apiClient = new Fake(apiConfiguration, schemaConfiguration); - - -var request = new FakewildcardresponsesGet.GetRequestBuilder().build(); - -FakewildcardresponsesGetResponses.EndpointResponse response; -try { - response = apiClient.get(request); -} catch (FakewildcardresponsesGetCode4XXResponse.ResponseApiException | FakewildcardresponsesGetCode5XXResponse.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; -} -if (response instanceof FakewildcardresponsesGetResponses.EndpointFakewildcardresponsesGetCode1XXResponse castResponse) { - FakewildcardresponsesGetCode1XXResponse.ApplicationjsonResponseBody deserializedBody = (FakewildcardresponsesGetCode1XXResponse.ApplicationjsonResponseBody) castResponse.body; - // handle deserialized body here -} else if (response instanceof FakewildcardresponsesGetResponses.EndpointFakewildcardresponsesGetCode2XXResponse castResponse) { - FakewildcardresponsesGetCode2XXResponse.ApplicationjsonResponseBody deserializedBody = (FakewildcardresponsesGetCode2XXResponse.ApplicationjsonResponseBody) castResponse.body; - // handle deserialized body here -} else if (response instanceof FakewildcardresponsesGetResponses.EndpointFakewildcardresponsesGetCode200Response castResponse) { - FakewildcardresponsesGetCode200Response.ApplicationjsonResponseBody deserializedBody = (FakewildcardresponsesGetCode200Response.ApplicationjsonResponseBody) castResponse.body; - // handle deserialized body here -} else { - FakewildcardresponsesGetResponses.EndpointFakewildcardresponsesGetCode3XXResponse castResponse = (FakewildcardresponsesGetResponses.EndpointFakewildcardresponsesGetCode3XXResponse) response; - FakewildcardresponsesGetCode3XXResponse.ApplicationjsonResponseBody deserializedBody = (FakewildcardresponsesGetCode3XXResponse.ApplicationjsonResponseBody) castResponse.body; - // handle deserialized body here -} -``` -### bodyWithQueryParams -public [FakebodywithqueryparamsPutResponses.EndpointResponse](../../paths/fakebodywithqueryparams/put/FakebodywithqueryparamsPutResponses.md#endpointresponse) bodyWithQueryParams([FakebodywithqueryparamsPut.PutRequest](../../paths/fakebodywithqueryparams/FakebodywithqueryparamsPut.md#putrequest) request) - -**Parameters:**
-request - the input request - -**Returns:**
-the deserialized response - -**Throws:**
-IOException, InterruptedException - an exception happened when making the request
-ValidationException - the returned response body or header values do not conform the the schema validation requirements
-NotImplementedException - the request body serialization or deserialization has not yet been implemented
- or the header content type deserialization has not yet been implemented for this contentType
-ApiException - server returned a response/contentType not defined in the openapi document
- -#### 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.fakebodywithqueryparams.put.FakebodywithqueryparamsPutRequestBody; -import org.openapijsonschematools.client.components.schemas.User; -import org.openapijsonschematools.client.paths.fakebodywithqueryparams.put.FakebodywithqueryparamsPutQueryParameters; -import org.openapijsonschematools.client.servers.RootServer0; -import org.openapijsonschematools.client.servers.RootServer1; -import org.openapijsonschematools.client.servers.RootServer2; -import org.openapijsonschematools.client.paths.fakebodywithqueryparams.put.responses.FakebodywithqueryparamsPutCode200Response; -import org.openapijsonschematools.client.servers.RootServerInfo; -import org.openapijsonschematools.client.apis.tags.Fake; -import org.openapijsonschematools.client.paths.fakebodywithqueryparams.put.FakebodywithqueryparamsPutResponses; - -import java.io.IOException; -import java.util.Arrays; -import java.util.List; -import java.util.Map; -import java.util.AbstractMap; - -// if you want to use a server that is not SERVER_0 pass it in here and change the ServerIndex input below -ApiConfiguration.ServerInfo serverInfo = new ApiConfiguration.ServerInfoBuilder() - .rootServerInfo( - new RootServerInfo.RootServerInfoBuilder() - .rootServer0(new RootServer0()) - .build() - ) - .build(); -ApiConfiguration.ServerIndexInfo serverIndexInfo = new ApiConfiguration.ServerIndexInfoBuilder() - .rootServerInfoServerIndex(RootServerInfo.ServerIndex.SERVER_0) - .build(); -Duration timeout = Duration.ofSeconds(1L); -Map> defaultHeaders = Map.of("User-Agent", List.of("OpenAPI-JSON-Schema-Generator/1.0.0/java")); -ApiConfiguration apiConfiguration = new ApiConfiguration( - serverInfo - serverIndexInfo, - timeout, - defaultHeaders -); -SchemaConfiguration schemaConfiguration = new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().build()); -Fake apiClient = new Fake(apiConfiguration, schemaConfiguration); - - -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 -); -FakebodywithqueryparamsPut.SealedRequestBody requestBody = new FakebodywithqueryparamsPut.ApplicationjsonRequestBody(requestBodyPayload); - -// Map validation -FakebodywithqueryparamsPutQueryParameters.QueryParametersMap queryParameters = - FakebodywithqueryparamsPutQueryParameters.FakebodywithqueryparamsPutQueryParameters1.validate( - new FakebodywithqueryparamsPutQueryParameters.QueryParametersMapBuilder() - .query("a") - - .build(), - schemaConfiguration -); - -var request = new FakebodywithqueryparamsPut.PutRequestBuilder() - .requestBody(requestBody) - .queryParameters(queryParameters) - .build(); - -FakebodywithqueryparamsPutResponses.EndpointResponse response; -try { - response = apiClient.put(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; -} -FakebodywithqueryparamsPutResponses.EndpointFakebodywithqueryparamsPutCode200Response castResponse = (FakebodywithqueryparamsPutResponses.EndpointFakebodywithqueryparamsPutCode200Response) response; -``` -### jsonWithCharset -public [FakejsonwithcharsetPostResponses.EndpointResponse](../../paths/fakejsonwithcharset/post/FakejsonwithcharsetPostResponses.md#endpointresponse) jsonWithCharset([FakejsonwithcharsetPost.PostRequest](../../paths/fakejsonwithcharset/FakejsonwithcharsetPost.md#postrequest) request) - -**Parameters:**
-request - the input request - -**Returns:**
-the deserialized response - -**Throws:**
-IOException, InterruptedException - an exception happened when making the request
-ValidationException - the returned response body or header values do not conform the the schema validation requirements
-NotImplementedException - the request body serialization or deserialization has not yet been implemented
- or the header content type deserialization has not yet been implemented for this contentType
-ApiException - server returned a response/contentType not defined in the openapi document
- -#### 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.FakejsonwithcharsetPostRequestBody; -import org.openapijsonschematools.client.paths.fakejsonwithcharset.post.requestbody.content.applicationjsoncharsetutf8.Applicationjsoncharsetutf8Schema; -import org.openapijsonschematools.client.RootServerInfo; -import org.openapijsonschematools.client.servers.RootServer0; -import org.openapijsonschematools.client.servers.RootServer1; -import org.openapijsonschematools.client.servers.RootServer2; -import org.openapijsonschematools.client.paths.fakejsonwithcharset.post.responses.FakejsonwithcharsetPostCode200Response; -import org.openapijsonschematools.client.servers.RootServerInfo; -import org.openapijsonschematools.client.apis.tags.Fake; -import org.openapijsonschematools.client.paths.fakejsonwithcharset.post.FakejsonwithcharsetPostResponses; - -import java.io.IOException; -import java.util.Arrays; -import java.util.List; -import java.util.Map; -import java.util.AbstractMap; - -// if you want to use a server that is not SERVER_0 pass it in here and change the ServerIndex input below -ApiConfiguration.ServerInfo serverInfo = new ApiConfiguration.ServerInfoBuilder() - .rootServerInfo( - new RootServerInfo.RootServerInfoBuilder() - .rootServer0(new RootServer0()) - .build() - ) - .build(); -ApiConfiguration.ServerIndexInfo serverIndexInfo = new ApiConfiguration.ServerIndexInfoBuilder() - .rootServerInfoServerIndex(RootServerInfo.ServerIndex.SERVER_0) - .build(); -Duration timeout = Duration.ofSeconds(1L); -Map> defaultHeaders = Map.of("User-Agent", List.of("OpenAPI-JSON-Schema-Generator/1.0.0/java")); -ApiConfiguration apiConfiguration = new ApiConfiguration( - serverInfo - serverIndexInfo, - timeout, - defaultHeaders -); -SchemaConfiguration schemaConfiguration = new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().build()); -Fake apiClient = new Fake(apiConfiguration, schemaConfiguration); - - -var request = new FakejsonwithcharsetPost.PostRequestBuilder().build(); - -FakejsonwithcharsetPostResponses.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; -} -FakejsonwithcharsetPostResponses.EndpointFakejsonwithcharsetPostCode200Response castResponse = (FakejsonwithcharsetPostResponses.EndpointFakejsonwithcharsetPostCode200Response) response; -FakejsonwithcharsetPostCode200Response.Applicationjsoncharsetutf8ResponseBody deserializedBody = (FakejsonwithcharsetPostCode200Response.Applicationjsoncharsetutf8ResponseBody) castResponse.body; -// handle deserialized body here -``` -### arrayModel -public [FakerefsarraymodelPostResponses.EndpointResponse](../../paths/fakerefsarraymodel/post/FakerefsarraymodelPostResponses.md#endpointresponse) arrayModel([FakerefsarraymodelPost.PostRequest](../../paths/fakerefsarraymodel/FakerefsarraymodelPost.md#postrequest) request) - -Test serialization of ArrayModel - -**Parameters:**
-request - the input request - -**Returns:**
-the deserialized response - -**Throws:**
-IOException, InterruptedException - an exception happened when making the request
-ValidationException - the returned response body or header values do not conform the the schema validation requirements
-NotImplementedException - the request body serialization or deserialization has not yet been implemented
- or the header content type deserialization has not yet been implemented for this contentType
-ApiException - server returned a response/contentType not defined in the openapi document
- -#### 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.fakerefsarraymodel.post.FakerefsarraymodelPostRequestBody; -import org.openapijsonschematools.client.components.schemas.AnimalFarm; -import org.openapijsonschematools.client.RootServerInfo; -import org.openapijsonschematools.client.servers.RootServer0; -import org.openapijsonschematools.client.servers.RootServer1; -import org.openapijsonschematools.client.servers.RootServer2; -import org.openapijsonschematools.client.paths.fakerefsarraymodel.post.responses.FakerefsarraymodelPostCode200Response; -import org.openapijsonschematools.client.servers.RootServerInfo; -import org.openapijsonschematools.client.apis.tags.Fake; -import org.openapijsonschematools.client.paths.fakerefsarraymodel.post.FakerefsarraymodelPostResponses; - -import java.io.IOException; -import java.util.Arrays; -import java.util.List; -import java.util.Map; -import java.util.AbstractMap; - -// if you want to use a server that is not SERVER_0 pass it in here and change the ServerIndex input below -ApiConfiguration.ServerInfo serverInfo = new ApiConfiguration.ServerInfoBuilder() - .rootServerInfo( - new RootServerInfo.RootServerInfoBuilder() - .rootServer0(new RootServer0()) - .build() - ) - .build(); -ApiConfiguration.ServerIndexInfo serverIndexInfo = new ApiConfiguration.ServerIndexInfoBuilder() - .rootServerInfoServerIndex(RootServerInfo.ServerIndex.SERVER_0) - .build(); -Duration timeout = Duration.ofSeconds(1L); -Map> defaultHeaders = Map.of("User-Agent", List.of("OpenAPI-JSON-Schema-Generator/1.0.0/java")); -ApiConfiguration apiConfiguration = new ApiConfiguration( - serverInfo - serverIndexInfo, - timeout, - defaultHeaders -); -SchemaConfiguration schemaConfiguration = new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().build()); -Fake apiClient = new Fake(apiConfiguration, schemaConfiguration); - - -var request = new FakerefsarraymodelPost.PostRequestBuilder().build(); - -FakerefsarraymodelPostResponses.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; -} -FakerefsarraymodelPostResponses.EndpointFakerefsarraymodelPostCode200Response castResponse = (FakerefsarraymodelPostResponses.EndpointFakerefsarraymodelPostCode200Response) response; -FakerefsarraymodelPostCode200Response.ApplicationjsonResponseBody deserializedBody = (FakerefsarraymodelPostCode200Response.ApplicationjsonResponseBody) castResponse.body; -// handle deserialized body here -``` -### fakeHealthGet -public [FakehealthGetResponses.EndpointResponse](../../paths/fakehealth/get/FakehealthGetResponses.md#endpointresponse) fakeHealthGet([FakehealthGet.GetRequest](../../paths/fakehealth/FakehealthGet.md#getrequest) request) - -**Parameters:**
-request - the input request - -**Returns:**
-the deserialized response - -**Throws:**
-IOException, InterruptedException - an exception happened when making the request
-ValidationException - the returned response body or header values do not conform the the schema validation requirements
-NotImplementedException - the request body serialization or deserialization has not yet been implemented
- or the header content type deserialization has not yet been implemented for this contentType
-ApiException - server returned a response/contentType not defined in the openapi document
- -#### 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.servers.RootServer0; -import org.openapijsonschematools.client.servers.RootServer1; -import org.openapijsonschematools.client.servers.RootServer2; -import org.openapijsonschematools.client.paths.fakehealth.get.responses.FakehealthGetCode200Response; -import org.openapijsonschematools.client.servers.RootServerInfo; -import org.openapijsonschematools.client.apis.tags.Fake; -import org.openapijsonschematools.client.paths.fakehealth.get.FakehealthGetResponses; - -import java.io.IOException; -import java.util.Arrays; -import java.util.List; -import java.util.Map; -import java.util.AbstractMap; - -// if you want to use a server that is not SERVER_0 pass it in here and change the ServerIndex input below -ApiConfiguration.ServerInfo serverInfo = new ApiConfiguration.ServerInfoBuilder() - .rootServerInfo( - new RootServerInfo.RootServerInfoBuilder() - .rootServer0(new RootServer0()) - .build() - ) - .build(); -ApiConfiguration.ServerIndexInfo serverIndexInfo = new ApiConfiguration.ServerIndexInfoBuilder() - .rootServerInfoServerIndex(RootServerInfo.ServerIndex.SERVER_0) - .build(); -Duration timeout = Duration.ofSeconds(1L); -Map> defaultHeaders = Map.of("User-Agent", List.of("OpenAPI-JSON-Schema-Generator/1.0.0/java")); -ApiConfiguration apiConfiguration = new ApiConfiguration( - serverInfo - serverIndexInfo, - timeout, - defaultHeaders -); -SchemaConfiguration schemaConfiguration = new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().build()); -Fake apiClient = new Fake(apiConfiguration, schemaConfiguration); - - -var request = new FakehealthGet.GetRequestBuilder().build(); - -FakehealthGetResponses.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; -} -FakehealthGetResponses.EndpointFakehealthGetCode200Response castResponse = (FakehealthGetResponses.EndpointFakehealthGetCode200Response) response; -FakehealthGetCode200Response.ApplicationjsonResponseBody deserializedBody = (FakehealthGetCode200Response.ApplicationjsonResponseBody) castResponse.body; -// handle deserialized body here -``` -### composedOneOfDifferentTypes -public [FakerefscomposedoneofnumberwithvalidationsPostResponses.EndpointResponse](../../paths/fakerefscomposedoneofnumberwithvalidations/post/FakerefscomposedoneofnumberwithvalidationsPostResponses.md#endpointresponse) composedOneOfDifferentTypes([FakerefscomposedoneofnumberwithvalidationsPost.PostRequest](../../paths/fakerefscomposedoneofnumberwithvalidations/FakerefscomposedoneofnumberwithvalidationsPost.md#postrequest) request) - -Test serialization of object with $refed properties - -**Parameters:**
-request - the input request - -**Returns:**
-the deserialized response - -**Throws:**
-IOException, InterruptedException - an exception happened when making the request
-ValidationException - the returned response body or header values do not conform the the schema validation requirements
-NotImplementedException - the request body serialization or deserialization has not yet been implemented
- or the header content type deserialization has not yet been implemented for this contentType
-ApiException - server returned a response/contentType not defined in the openapi document
- -#### 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.FakerefscomposedoneofnumberwithvalidationsPostRequestBody; -import org.openapijsonschematools.client.components.schemas.ComposedOneOfDifferentTypes; -import org.openapijsonschematools.client.RootServerInfo; -import org.openapijsonschematools.client.servers.RootServer0; -import org.openapijsonschematools.client.servers.RootServer1; -import org.openapijsonschematools.client.servers.RootServer2; -import org.openapijsonschematools.client.paths.fakerefscomposedoneofnumberwithvalidations.post.responses.FakerefscomposedoneofnumberwithvalidationsPostCode200Response; -import org.openapijsonschematools.client.servers.RootServerInfo; -import org.openapijsonschematools.client.apis.tags.Fake; -import org.openapijsonschematools.client.paths.fakerefscomposedoneofnumberwithvalidations.post.FakerefscomposedoneofnumberwithvalidationsPostResponses; - -import java.io.IOException; -import java.util.Arrays; -import java.util.List; -import java.util.Map; -import java.util.AbstractMap; - -// if you want to use a server that is not SERVER_0 pass it in here and change the ServerIndex input below -ApiConfiguration.ServerInfo serverInfo = new ApiConfiguration.ServerInfoBuilder() - .rootServerInfo( - new RootServerInfo.RootServerInfoBuilder() - .rootServer0(new RootServer0()) - .build() - ) - .build(); -ApiConfiguration.ServerIndexInfo serverIndexInfo = new ApiConfiguration.ServerIndexInfoBuilder() - .rootServerInfoServerIndex(RootServerInfo.ServerIndex.SERVER_0) - .build(); -Duration timeout = Duration.ofSeconds(1L); -Map> defaultHeaders = Map.of("User-Agent", List.of("OpenAPI-JSON-Schema-Generator/1.0.0/java")); -ApiConfiguration apiConfiguration = new ApiConfiguration( - serverInfo - serverIndexInfo, - timeout, - defaultHeaders -); -SchemaConfiguration schemaConfiguration = new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().build()); -Fake apiClient = new Fake(apiConfiguration, schemaConfiguration); - - -var request = new FakerefscomposedoneofnumberwithvalidationsPost.PostRequestBuilder().build(); - -FakerefscomposedoneofnumberwithvalidationsPostResponses.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; -} -FakerefscomposedoneofnumberwithvalidationsPostResponses.EndpointFakerefscomposedoneofnumberwithvalidationsPostCode200Response castResponse = (FakerefscomposedoneofnumberwithvalidationsPostResponses.EndpointFakerefscomposedoneofnumberwithvalidationsPostCode200Response) response; -FakerefscomposedoneofnumberwithvalidationsPostCode200Response.ApplicationjsonResponseBody deserializedBody = (FakerefscomposedoneofnumberwithvalidationsPostCode200Response.ApplicationjsonResponseBody) castResponse.body; -// handle deserialized body here -``` -### refObjectInQuery -public [FakerefobjinqueryGetResponses.EndpointResponse](../../paths/fakerefobjinquery/get/FakerefobjinqueryGetResponses.md#endpointresponse) refObjectInQuery([FakerefobjinqueryGet.GetRequest](../../paths/fakerefobjinquery/FakerefobjinqueryGet.md#getrequest) request) - -**Parameters:**
-request - the input request - -**Returns:**
-the deserialized response - -**Throws:**
-IOException, InterruptedException - an exception happened when making the request
-ValidationException - the returned response body or header values do not conform the the schema validation requirements
-NotImplementedException - the request body serialization or deserialization has not yet been implemented
- or the header content type deserialization has not yet been implemented for this contentType
-ApiException - server returned a response/contentType not defined in the openapi document
- -#### 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.fakerefobjinquery.get.FakerefobjinqueryGetQueryParameters; -import org.openapijsonschematools.client.RootServerInfo; -import org.openapijsonschematools.client.servers.RootServer0; -import org.openapijsonschematools.client.servers.RootServer1; -import org.openapijsonschematools.client.servers.RootServer2; -import org.openapijsonschematools.client.paths.fakerefobjinquery.get.responses.FakerefobjinqueryGetCode200Response; -import org.openapijsonschematools.client.servers.RootServerInfo; -import org.openapijsonschematools.client.apis.tags.Fake; -import org.openapijsonschematools.client.paths.fakerefobjinquery.get.FakerefobjinqueryGetResponses; - -import java.io.IOException; -import java.util.Arrays; -import java.util.List; -import java.util.Map; -import java.util.AbstractMap; - -// if you want to use a server that is not SERVER_0 pass it in here and change the ServerIndex input below -ApiConfiguration.ServerInfo serverInfo = new ApiConfiguration.ServerInfoBuilder() - .rootServerInfo( - new RootServerInfo.RootServerInfoBuilder() - .rootServer0(new RootServer0()) - .build() - ) - .build(); -ApiConfiguration.ServerIndexInfo serverIndexInfo = new ApiConfiguration.ServerIndexInfoBuilder() - .rootServerInfoServerIndex(RootServerInfo.ServerIndex.SERVER_0) - .build(); -Duration timeout = Duration.ofSeconds(1L); -Map> defaultHeaders = Map.of("User-Agent", List.of("OpenAPI-JSON-Schema-Generator/1.0.0/java")); -ApiConfiguration apiConfiguration = new ApiConfiguration( - serverInfo - serverIndexInfo, - timeout, - defaultHeaders -); -SchemaConfiguration schemaConfiguration = new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().build()); -Fake apiClient = new Fake(apiConfiguration, schemaConfiguration); - - -var request = new FakerefobjinqueryGet.GetRequestBuilder().build(); - -FakerefobjinqueryGetResponses.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; -} -FakerefobjinqueryGetResponses.EndpointFakerefobjinqueryGetCode200Response castResponse = (FakerefobjinqueryGetResponses.EndpointFakerefobjinqueryGetCode200Response) response; -``` -### bodyWithFileSchema -public [FakebodywithfileschemaPutResponses.EndpointResponse](../../paths/fakebodywithfileschema/put/FakebodywithfileschemaPutResponses.md#endpointresponse) bodyWithFileSchema([FakebodywithfileschemaPut.PutRequest](../../paths/fakebodywithfileschema/FakebodywithfileschemaPut.md#putrequest) request) - -For this test, the body for this request much reference a schema named `File`. - -**Parameters:**
-request - the input request - -**Returns:**
-the deserialized response - -**Throws:**
-IOException, InterruptedException - an exception happened when making the request
-ValidationException - the returned response body or header values do not conform the the schema validation requirements
-NotImplementedException - the request body serialization or deserialization has not yet been implemented
- or the header content type deserialization has not yet been implemented for this contentType
-ApiException - server returned a response/contentType not defined in the openapi document
- -#### 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.fakebodywithfileschema.put.FakebodywithfileschemaPutRequestBody; -import org.openapijsonschematools.client.components.schemas.FileSchemaTestClass; -import org.openapijsonschematools.client.servers.RootServer0; -import org.openapijsonschematools.client.servers.RootServer1; -import org.openapijsonschematools.client.servers.RootServer2; -import org.openapijsonschematools.client.paths.fakebodywithfileschema.put.responses.FakebodywithfileschemaPutCode200Response; -import org.openapijsonschematools.client.servers.RootServerInfo; -import org.openapijsonschematools.client.apis.tags.Fake; -import org.openapijsonschematools.client.paths.fakebodywithfileschema.put.FakebodywithfileschemaPutResponses; - -import java.io.IOException; -import java.util.Arrays; -import java.util.List; -import java.util.Map; -import java.util.AbstractMap; - -// if you want to use a server that is not SERVER_0 pass it in here and change the ServerIndex input below -ApiConfiguration.ServerInfo serverInfo = new ApiConfiguration.ServerInfoBuilder() - .rootServerInfo( - new RootServerInfo.RootServerInfoBuilder() - .rootServer0(new RootServer0()) - .build() - ) - .build(); -ApiConfiguration.ServerIndexInfo serverIndexInfo = new ApiConfiguration.ServerIndexInfoBuilder() - .rootServerInfoServerIndex(RootServerInfo.ServerIndex.SERVER_0) - .build(); -Duration timeout = Duration.ofSeconds(1L); -Map> defaultHeaders = Map.of("User-Agent", List.of("OpenAPI-JSON-Schema-Generator/1.0.0/java")); -ApiConfiguration apiConfiguration = new ApiConfiguration( - serverInfo - serverIndexInfo, - timeout, - defaultHeaders -); -SchemaConfiguration schemaConfiguration = new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().build()); -Fake apiClient = new Fake(apiConfiguration, schemaConfiguration); - - -FileSchemaTestClass1BoxedMap requestBodyPayload = - FileSchemaTestClass.FileSchemaTestClass1.validateAndBox( - new FileSchemaTestClass.FileSchemaTestClassMapBuilder() - .files( - Arrays.asList( - ) - ) - .build(), - schemaConfiguration -); -FakebodywithfileschemaPut.SealedRequestBody requestBody = new FakebodywithfileschemaPut.ApplicationjsonRequestBody(requestBodyPayload); - -var request = new FakebodywithfileschemaPut.PutRequestBuilder() - .requestBody(requestBody) - .build(); - -FakebodywithfileschemaPutResponses.EndpointResponse response; -try { - response = apiClient.put(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; -} -FakebodywithfileschemaPutResponses.EndpointFakebodywithfileschemaPutCode200Response castResponse = (FakebodywithfileschemaPutResponses.EndpointFakebodywithfileschemaPutCode200Response) response; -``` -### stringEnum -public [FakerefsenumPostResponses.EndpointResponse](../../paths/fakerefsenum/post/FakerefsenumPostResponses.md#endpointresponse) stringEnum([FakerefsenumPost.PostRequest](../../paths/fakerefsenum/FakerefsenumPost.md#postrequest) request) - -Test serialization of outer enum - -**Parameters:**
-request - the input request - -**Returns:**
-the deserialized response - -**Throws:**
-IOException, InterruptedException - an exception happened when making the request
-ValidationException - the returned response body or header values do not conform the the schema validation requirements
-NotImplementedException - the request body serialization or deserialization has not yet been implemented
- or the header content type deserialization has not yet been implemented for this contentType
-ApiException - server returned a response/contentType not defined in the openapi document
- -#### 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.FakerefsenumPostRequestBody; -import org.openapijsonschematools.client.components.schemas.StringEnum; -import org.openapijsonschematools.client.RootServerInfo; -import org.openapijsonschematools.client.servers.RootServer0; -import org.openapijsonschematools.client.servers.RootServer1; -import org.openapijsonschematools.client.servers.RootServer2; -import org.openapijsonschematools.client.paths.fakerefsenum.post.responses.FakerefsenumPostCode200Response; -import org.openapijsonschematools.client.servers.RootServerInfo; -import org.openapijsonschematools.client.apis.tags.Fake; -import org.openapijsonschematools.client.paths.fakerefsenum.post.FakerefsenumPostResponses; - -import java.io.IOException; -import java.util.Arrays; -import java.util.List; -import java.util.Map; -import java.util.AbstractMap; - -// if you want to use a server that is not SERVER_0 pass it in here and change the ServerIndex input below -ApiConfiguration.ServerInfo serverInfo = new ApiConfiguration.ServerInfoBuilder() - .rootServerInfo( - new RootServerInfo.RootServerInfoBuilder() - .rootServer0(new RootServer0()) - .build() - ) - .build(); -ApiConfiguration.ServerIndexInfo serverIndexInfo = new ApiConfiguration.ServerIndexInfoBuilder() - .rootServerInfoServerIndex(RootServerInfo.ServerIndex.SERVER_0) - .build(); -Duration timeout = Duration.ofSeconds(1L); -Map> defaultHeaders = Map.of("User-Agent", List.of("OpenAPI-JSON-Schema-Generator/1.0.0/java")); -ApiConfiguration apiConfiguration = new ApiConfiguration( - serverInfo - serverIndexInfo, - timeout, - defaultHeaders -); -SchemaConfiguration schemaConfiguration = new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().build()); -Fake apiClient = new Fake(apiConfiguration, schemaConfiguration); - - -var request = new FakerefsenumPost.PostRequestBuilder().build(); - -FakerefsenumPostResponses.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; -} -FakerefsenumPostResponses.EndpointFakerefsenumPostCode200Response castResponse = (FakerefsenumPostResponses.EndpointFakerefsenumPostCode200Response) response; -FakerefsenumPostCode200Response.ApplicationjsonResponseBody deserializedBody = (FakerefsenumPostCode200Response.ApplicationjsonResponseBody) castResponse.body; -// handle deserialized body here -``` -### redirection -public [FakeredirectionGetResponses.EndpointResponse](../../paths/fakeredirection/get/FakeredirectionGetResponses.md#endpointresponse) redirection([FakeredirectionGet.GetRequest](../../paths/fakeredirection/FakeredirectionGet.md#getrequest) request) - -**Parameters:**
-request - the input request - -**Returns:**
-the deserialized response - -**Throws:**
-IOException, InterruptedException - an exception happened when making the request
-ValidationException - the returned response body or header values do not conform the the schema validation requirements
-NotImplementedException - the request body serialization or deserialization has not yet been implemented
- or the header content type deserialization has not yet been implemented for this contentType
-ApiException - server returned a response/contentType not defined in the openapi document
- -#### 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.servers.RootServer0; -import org.openapijsonschematools.client.servers.RootServer1; -import org.openapijsonschematools.client.servers.RootServer2; -import org.openapijsonschematools.client.paths.fakeredirection.get.responses.FakeredirectionGetCode303Response; -import org.openapijsonschematools.client.paths.fakeredirection.get.responses.FakeredirectionGetCode3XXResponse; -import org.openapijsonschematools.client.servers.RootServerInfo; -import org.openapijsonschematools.client.apis.tags.Fake; -import org.openapijsonschematools.client.paths.fakeredirection.get.FakeredirectionGetResponses; - -import java.io.IOException; -import java.util.Arrays; -import java.util.List; -import java.util.Map; -import java.util.AbstractMap; - -// if you want to use a server that is not SERVER_0 pass it in here and change the ServerIndex input below -ApiConfiguration.ServerInfo serverInfo = new ApiConfiguration.ServerInfoBuilder() - .rootServerInfo( - new RootServerInfo.RootServerInfoBuilder() - .rootServer0(new RootServer0()) - .build() - ) - .build(); -ApiConfiguration.ServerIndexInfo serverIndexInfo = new ApiConfiguration.ServerIndexInfoBuilder() - .rootServerInfoServerIndex(RootServerInfo.ServerIndex.SERVER_0) - .build(); -Duration timeout = Duration.ofSeconds(1L); -Map> defaultHeaders = Map.of("User-Agent", List.of("OpenAPI-JSON-Schema-Generator/1.0.0/java")); -ApiConfiguration apiConfiguration = new ApiConfiguration( - serverInfo - serverIndexInfo, - timeout, - defaultHeaders -); -SchemaConfiguration schemaConfiguration = new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().build()); -Fake apiClient = new Fake(apiConfiguration, schemaConfiguration); - - -var request = new FakeredirectionGet.GetRequestBuilder().build(); - -FakeredirectionGetResponses.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; -} -if (response instanceof FakeredirectionGetResponses.EndpointFakeredirectionGetCode3XXResponse castResponse) { -} else { - FakeredirectionGetResponses.EndpointFakeredirectionGetCode303Response castResponse = (FakeredirectionGetResponses.EndpointFakeredirectionGetCode303Response) response; -} -``` -### uploadFile -public [FakeuploadfilePostResponses.EndpointResponse](../../paths/fakeuploadfile/post/FakeuploadfilePostResponses.md#endpointresponse) uploadFile([FakeuploadfilePost.PostRequest](../../paths/fakeuploadfile/FakeuploadfilePost.md#postrequest) request) - - - -**Parameters:**
-request - the input request - -**Returns:**
-the deserialized response - -**Throws:**
-IOException, InterruptedException - an exception happened when making the request
-ValidationException - the returned response body or header values do not conform the the schema validation requirements
-NotImplementedException - the request body serialization or deserialization has not yet been implemented
- or the header content type deserialization has not yet been implemented for this contentType
-ApiException - server returned a response/contentType not defined in the openapi document
- -#### 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.FakeuploadfilePostRequestBody; -import org.openapijsonschematools.client.paths.fakeuploadfile.post.requestbody.content.multipartformdata.MultipartformdataSchema; -import org.openapijsonschematools.client.RootServerInfo; -import org.openapijsonschematools.client.servers.RootServer0; -import org.openapijsonschematools.client.servers.RootServer1; -import org.openapijsonschematools.client.servers.RootServer2; -import org.openapijsonschematools.client.paths.fakeuploadfile.post.responses.FakeuploadfilePostCode200Response; -import org.openapijsonschematools.client.servers.RootServerInfo; -import org.openapijsonschematools.client.apis.tags.Fake; -import org.openapijsonschematools.client.paths.fakeuploadfile.post.FakeuploadfilePostResponses; - -import java.io.IOException; -import java.util.Arrays; -import java.util.List; -import java.util.Map; -import java.util.AbstractMap; - -// if you want to use a server that is not SERVER_0 pass it in here and change the ServerIndex input below -ApiConfiguration.ServerInfo serverInfo = new ApiConfiguration.ServerInfoBuilder() - .rootServerInfo( - new RootServerInfo.RootServerInfoBuilder() - .rootServer0(new RootServer0()) - .build() - ) - .build(); -ApiConfiguration.ServerIndexInfo serverIndexInfo = new ApiConfiguration.ServerIndexInfoBuilder() - .rootServerInfoServerIndex(RootServerInfo.ServerIndex.SERVER_0) - .build(); -Duration timeout = Duration.ofSeconds(1L); -Map> defaultHeaders = Map.of("User-Agent", List.of("OpenAPI-JSON-Schema-Generator/1.0.0/java")); -ApiConfiguration apiConfiguration = new ApiConfiguration( - serverInfo - serverIndexInfo, - timeout, - defaultHeaders -); -SchemaConfiguration schemaConfiguration = new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().build()); -Fake apiClient = new Fake(apiConfiguration, schemaConfiguration); - - -var request = new FakeuploadfilePost.PostRequestBuilder().build(); - -FakeuploadfilePostResponses.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; -} -FakeuploadfilePostResponses.EndpointFakeuploadfilePostCode200Response castResponse = (FakeuploadfilePostResponses.EndpointFakeuploadfilePostCode200Response) response; -FakeuploadfilePostCode200Response.ApplicationjsonResponseBody deserializedBody = (FakeuploadfilePostCode200Response.ApplicationjsonResponseBody) castResponse.body; -// handle deserialized body here -``` -### inlineComposition -public [FakeinlinecompositionPostResponses.EndpointResponse](../../paths/fakeinlinecomposition/post/FakeinlinecompositionPostResponses.md#endpointresponse) inlineComposition([FakeinlinecompositionPost.PostRequest](../../paths/fakeinlinecomposition/FakeinlinecompositionPost.md#postrequest) request) - -composed schemas at inline locations + multiple requestBody content types - -**Parameters:**
-request - the input request - -**Returns:**
-the deserialized response - -**Throws:**
-IOException, InterruptedException - an exception happened when making the request
-ValidationException - the returned response body or header values do not conform the the schema validation requirements
-NotImplementedException - the request body serialization or deserialization has not yet been implemented
- or the header content type deserialization has not yet been implemented for this contentType
-ApiException - server returned a response/contentType not defined in the openapi document
- -#### 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.FakeinlinecompositionPostRequestBody; -import org.openapijsonschematools.client.paths.fakeinlinecomposition.post.requestbody.content.applicationjson.ApplicationjsonSchema; -import org.openapijsonschematools.client.paths.fakeinlinecomposition.post.FakeinlinecompositionPostQueryParameters; -import org.openapijsonschematools.client.RootServerInfo; -import org.openapijsonschematools.client.servers.RootServer0; -import org.openapijsonschematools.client.servers.RootServer1; -import org.openapijsonschematools.client.servers.RootServer2; -import org.openapijsonschematools.client.paths.fakeinlinecomposition.post.responses.FakeinlinecompositionPostCode200Response; -import org.openapijsonschematools.client.servers.RootServerInfo; -import org.openapijsonschematools.client.apis.tags.Fake; -import org.openapijsonschematools.client.paths.fakeinlinecomposition.post.FakeinlinecompositionPostResponses; - -import java.io.IOException; -import java.util.Arrays; -import java.util.List; -import java.util.Map; -import java.util.AbstractMap; - -// if you want to use a server that is not SERVER_0 pass it in here and change the ServerIndex input below -ApiConfiguration.ServerInfo serverInfo = new ApiConfiguration.ServerInfoBuilder() - .rootServerInfo( - new RootServerInfo.RootServerInfoBuilder() - .rootServer0(new RootServer0()) - .build() - ) - .build(); -ApiConfiguration.ServerIndexInfo serverIndexInfo = new ApiConfiguration.ServerIndexInfoBuilder() - .rootServerInfoServerIndex(RootServerInfo.ServerIndex.SERVER_0) - .build(); -Duration timeout = Duration.ofSeconds(1L); -Map> defaultHeaders = Map.of("User-Agent", List.of("OpenAPI-JSON-Schema-Generator/1.0.0/java")); -ApiConfiguration apiConfiguration = new ApiConfiguration( - serverInfo - serverIndexInfo, - timeout, - defaultHeaders -); -SchemaConfiguration schemaConfiguration = new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().build()); -Fake apiClient = new Fake(apiConfiguration, schemaConfiguration); - - -var request = new FakeinlinecompositionPost.PostRequestBuilder().build(); - -FakeinlinecompositionPostResponses.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; -} -FakeinlinecompositionPostResponses.EndpointFakeinlinecompositionPostCode200Response castResponse = (FakeinlinecompositionPostResponses.EndpointFakeinlinecompositionPostCode200Response) response; -if (castResponse.body instanceof FakeinlinecompositionPostCode200Response.ApplicationjsonResponseBody deserializedBody) { - // handle deserialized body here -} else { - FakeinlinecompositionPostCode200Response.MultipartformdataResponseBody deserializedBody = (FakeinlinecompositionPostCode200Response.MultipartformdataResponseBody) castResponse.body; - // handle deserialized body here -} -``` -### groupParameters -public [FakeDeleteResponses.EndpointResponse](../../paths/fake/delete/FakeDeleteResponses.md#endpointresponse) groupParameters([FakeDelete.DeleteRequest](../../paths/fake/FakeDelete.md#deleterequest) request) - -Fake endpoint to test group parameters (optional) - -**Parameters:**
-request - the input request - -**Returns:**
-the deserialized response - -**Throws:**
-IOException, InterruptedException - an exception happened when making the request
-ValidationException - the returned response body or header values do not conform the the schema validation requirements
-NotImplementedException - the request body serialization or deserialization has not yet been implemented
- or the header content type deserialization has not yet been implemented for this contentType
-ApiException - server returned a response/contentType not defined in the openapi document
- -#### 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.fake.delete.FakeDeleteSecurityInfo; -import org.openapijsonschematools.client.paths.fake.delete.FakeDeleteHeaderParameters; -import org.openapijsonschematools.client.paths.fake.delete.FakeDeleteQueryParameters; -import org.openapijsonschematools.client.servers.RootServer0; -import org.openapijsonschematools.client.servers.RootServer1; -import org.openapijsonschematools.client.servers.RootServer2; -import org.openapijsonschematools.client.securityschemes.SecurityScheme; -import org.openapijsonschematools.client.components.securityschemes.BearerTest; -import org.openapijsonschematools.client.paths.fake.delete.responses.FakeDeleteCode200Response; -import org.openapijsonschematools.client.servers.RootServerInfo; -import org.openapijsonschematools.client.apis.tags.Fake; -import org.openapijsonschematools.client.paths.fake.delete.FakeDeleteResponses; - -import java.io.IOException; -import java.util.Arrays; -import java.util.List; -import java.util.Map; -import java.util.AbstractMap; - -// if you want to use a server that is not SERVER_0 pass it in here and change the ServerIndex input below -ApiConfiguration.ServerInfo serverInfo = new ApiConfiguration.ServerInfoBuilder() - .rootServerInfo( - new RootServerInfo.RootServerInfoBuilder() - .rootServer0(new RootServer0()) - .build() - ) - .build(); -ApiConfiguration.ServerIndexInfo serverIndexInfo = new ApiConfiguration.ServerIndexInfoBuilder() - .rootServerInfoServerIndex(RootServerInfo.ServerIndex.SERVER_0) - .build(); -List securitySchemes = new ArrayList(); -securitySchemes.add( - new BearerTest("someAccessToken"); -); -ApiConfiguration.SecurityIndexInfo securityIndexInfo = new ApiConfiguration.SecurityIndexInfoBuilder() - .fakeDeleteSecurityRequirementObject0SecurityIndex(FakeDeleteSecurityRequirementObject0.SecurityIndex.SECURITY_0) - .build(); -Duration timeout = Duration.ofSeconds(1L); -Map> defaultHeaders = Map.of("User-Agent", List.of("OpenAPI-JSON-Schema-Generator/1.0.0/java")); -ApiConfiguration apiConfiguration = new ApiConfiguration( - serverInfo - serverIndexInfo, - securitySchemes, - securityIndexInfo, - timeout, - defaultHeaders -); -SchemaConfiguration schemaConfiguration = new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().build()); -Fake apiClient = new Fake(apiConfiguration, schemaConfiguration); - - -// Map validation -FakeDeleteHeaderParameters.HeaderParametersMap headerParameters = - FakeDeleteHeaderParameters.FakeDeleteHeaderParameters1.validate( - new FakeDeleteHeaderParameters.HeaderParametersMapBuilder() - .required_boolean_group("true") - - .boolean_group("true") - - .build(), - schemaConfiguration -); - -// Map validation -FakeDeleteQueryParameters.QueryParametersMap queryParameters = - FakeDeleteQueryParameters.FakeDeleteQueryParameters1.validate( - new FakeDeleteQueryParameters.QueryParametersMapBuilder() - .required_int64_group(1L) - - .required_string_group("a") - - .int64_group(1L) - - .string_group("a") - - .build(), - schemaConfiguration -); - -var request = new FakeDelete.DeleteRequestBuilder() - .headerParameters(headerParameters) - .queryParameters(queryParameters) - .build(); - -FakeDeleteResponses.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; -} -FakeDeleteResponses.EndpointFakeDeleteCode200Response castResponse = (FakeDeleteResponses.EndpointFakeDeleteCode200Response) response; -``` -### enumParameters -public [FakeGetResponses.EndpointResponse](../../paths/fake/get/FakeGetResponses.md#endpointresponse) enumParameters([FakeGet.GetRequest](../../paths/fake/FakeGet.md#getrequest) request) - -To test enum parameters - -**Parameters:**
-request - the input request - -**Returns:**
-the deserialized response - -**Throws:**
-IOException, InterruptedException - an exception happened when making the request
-ValidationException - the returned response body or header values do not conform the the schema validation requirements
-NotImplementedException - the request body serialization or deserialization has not yet been implemented
- or the header content type deserialization has not yet been implemented for this contentType
-ApiException - server returned a response/contentType not defined in the openapi document
- -#### 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.fake.get.FakeGetRequestBody; -import org.openapijsonschematools.client.paths.fake.get.requestbody.content.applicationxwwwformurlencoded.ApplicationxwwwformurlencodedSchema; -import org.openapijsonschematools.client.paths.fake.get.FakeGetHeaderParameters; -import org.openapijsonschematools.client.paths.fake.get.FakeGetQueryParameters; -import org.openapijsonschematools.client.RootServerInfo; -import org.openapijsonschematools.client.servers.RootServer0; -import org.openapijsonschematools.client.servers.RootServer1; -import org.openapijsonschematools.client.servers.RootServer2; -import org.openapijsonschematools.client.paths.fake.get.responses.FakeGetCode200Response; -import org.openapijsonschematools.client.paths.fake.get.responses.FakeGetCode404Response; -import org.openapijsonschematools.client.servers.RootServerInfo; -import org.openapijsonschematools.client.apis.tags.Fake; -import org.openapijsonschematools.client.paths.fake.get.FakeGetResponses; - -import java.io.IOException; -import java.util.Arrays; -import java.util.List; -import java.util.Map; -import java.util.AbstractMap; - -// if you want to use a server that is not SERVER_0 pass it in here and change the ServerIndex input below -ApiConfiguration.ServerInfo serverInfo = new ApiConfiguration.ServerInfoBuilder() - .rootServerInfo( - new RootServerInfo.RootServerInfoBuilder() - .rootServer0(new RootServer0()) - .build() - ) - .build(); -ApiConfiguration.ServerIndexInfo serverIndexInfo = new ApiConfiguration.ServerIndexInfoBuilder() - .rootServerInfoServerIndex(RootServerInfo.ServerIndex.SERVER_0) - .build(); -Duration timeout = Duration.ofSeconds(1L); -Map> defaultHeaders = Map.of("User-Agent", List.of("OpenAPI-JSON-Schema-Generator/1.0.0/java")); -ApiConfiguration apiConfiguration = new ApiConfiguration( - serverInfo - serverIndexInfo, - timeout, - defaultHeaders -); -SchemaConfiguration schemaConfiguration = new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().build()); -Fake apiClient = new Fake(apiConfiguration, schemaConfiguration); - - -var request = new FakeGet.GetRequestBuilder().build(); - -FakeGetResponses.EndpointResponse response; -try { - response = apiClient.get(request); -} catch (FakeGetCode404Response.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; -} -FakeGetResponses.EndpointFakeGetCode200Response castResponse = (FakeGetResponses.EndpointFakeGetCode200Response) response; -``` -### clientModel -public [FakePatchResponses.EndpointResponse](../../paths/fake/patch/FakePatchResponses.md#endpointresponse) clientModel([FakePatch.PatchRequest](../../paths/fake/FakePatch.md#patchrequest) request) - -To test "client" model - -**Parameters:**
-request - the input request - -**Returns:**
-the deserialized response - -**Throws:**
-IOException, InterruptedException - an exception happened when making the request
-ValidationException - the returned response body or header values do not conform the the schema validation requirements
-NotImplementedException - the request body serialization or deserialization has not yet been implemented
- or the header content type deserialization has not yet been implemented for this contentType
-ApiException - server returned a response/contentType not defined in the openapi document
- -#### 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.fake.patch.FakePatchRequestBody; -import org.openapijsonschematools.client.components.schemas.Client; -import org.openapijsonschematools.client.servers.RootServer0; -import org.openapijsonschematools.client.servers.RootServer1; -import org.openapijsonschematools.client.servers.RootServer2; -import org.openapijsonschematools.client.paths.fake.patch.responses.FakePatchCode200Response; -import org.openapijsonschematools.client.servers.RootServerInfo; -import org.openapijsonschematools.client.apis.tags.Fake; -import org.openapijsonschematools.client.paths.fake.patch.FakePatchResponses; - -import java.io.IOException; -import java.util.Arrays; -import java.util.List; -import java.util.Map; -import java.util.AbstractMap; - -// if you want to use a server that is not SERVER_0 pass it in here and change the ServerIndex input below -ApiConfiguration.ServerInfo serverInfo = new ApiConfiguration.ServerInfoBuilder() - .rootServerInfo( - new RootServerInfo.RootServerInfoBuilder() - .rootServer0(new RootServer0()) - .build() - ) - .build(); -ApiConfiguration.ServerIndexInfo serverIndexInfo = new ApiConfiguration.ServerIndexInfoBuilder() - .rootServerInfoServerIndex(RootServerInfo.ServerIndex.SERVER_0) - .build(); -Duration timeout = Duration.ofSeconds(1L); -Map> defaultHeaders = Map.of("User-Agent", List.of("OpenAPI-JSON-Schema-Generator/1.0.0/java")); -ApiConfiguration apiConfiguration = new ApiConfiguration( - serverInfo - serverIndexInfo, - timeout, - defaultHeaders -); -SchemaConfiguration schemaConfiguration = new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().build()); -Fake apiClient = new Fake(apiConfiguration, schemaConfiguration); - - -Client1BoxedMap requestBodyPayload = - Client.Client1.validateAndBox( - new Client.ClientMapBuilder1() - .client("a") - - .build(), - schemaConfiguration -); -FakePatchRequestBody.SealedRequestBody requestBody = new FakePatchRequestBody.ApplicationjsonRequestBody(requestBodyPayload); - -var request = new FakePatch.PatchRequestBuilder() - .requestBody(requestBody) - .build(); - -FakePatchResponses.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; -} -FakePatchResponses.EndpointFakePatchCode200Response castResponse = (FakePatchResponses.EndpointFakePatchCode200Response) response; -FakePatchCode200Response.ApplicationjsonResponseBody deserializedBody = (FakePatchCode200Response.ApplicationjsonResponseBody) castResponse.body; -// handle deserialized body here -``` -### endpointParameters -public [FakePostResponses.EndpointResponse](../../paths/fake/post/FakePostResponses.md#endpointresponse) endpointParameters([FakePost.PostRequest](../../paths/fake/FakePost.md#postrequest) request) - -Fake endpoint for testing various parameters
假端點
偽のエンドポイント
가짜 엔드 포인트
- -**Parameters:**
-request - the input request - -**Returns:**
-the deserialized response - -**Throws:**
-IOException, InterruptedException - an exception happened when making the request
-ValidationException - the returned response body or header values do not conform the the schema validation requirements
-NotImplementedException - the request body serialization or deserialization has not yet been implemented
- or the header content type deserialization has not yet been implemented for this contentType
-ApiException - server returned a response/contentType not defined in the openapi document
- -#### 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.fake.post.FakePostRequestBody; -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.RootServer0; -import org.openapijsonschematools.client.servers.RootServer1; -import org.openapijsonschematools.client.servers.RootServer2; -import org.openapijsonschematools.client.securityschemes.SecurityScheme; -import org.openapijsonschematools.client.components.securityschemes.HttpBasicTest; -import org.openapijsonschematools.client.paths.fake.post.responses.FakePostCode200Response; -import org.openapijsonschematools.client.paths.fake.post.responses.FakePostCode404Response; -import org.openapijsonschematools.client.servers.RootServerInfo; -import org.openapijsonschematools.client.apis.tags.Fake; -import org.openapijsonschematools.client.paths.fake.post.FakePostResponses; - -import java.io.IOException; -import java.util.Arrays; -import java.util.List; -import java.util.Map; -import java.util.AbstractMap; - -// if you want to use a server that is not SERVER_0 pass it in here and change the ServerIndex input below -ApiConfiguration.ServerInfo serverInfo = new ApiConfiguration.ServerInfoBuilder() - .rootServerInfo( - new RootServerInfo.RootServerInfoBuilder() - .rootServer0(new RootServer0()) - .build() - ) - .build(); -ApiConfiguration.ServerIndexInfo serverIndexInfo = new ApiConfiguration.ServerIndexInfoBuilder() - .rootServerInfoServerIndex(RootServerInfo.ServerIndex.SERVER_0) - .build(); -List securitySchemes = new ArrayList(); -securitySchemes.add( - new HttpBasicTest("someUserId", "somePassword"); -); -ApiConfiguration.SecurityIndexInfo securityIndexInfo = new ApiConfiguration.SecurityIndexInfoBuilder() - .fakePostSecurityRequirementObject0SecurityIndex(FakePostSecurityRequirementObject0.SecurityIndex.SECURITY_0) - .build(); -Duration timeout = Duration.ofSeconds(1L); -Map> defaultHeaders = Map.of("User-Agent", List.of("OpenAPI-JSON-Schema-Generator/1.0.0/java")); -ApiConfiguration apiConfiguration = new ApiConfiguration( - serverInfo - serverIndexInfo, - securitySchemes, - securityIndexInfo, - timeout, - defaultHeaders -); -SchemaConfiguration schemaConfiguration = new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().build()); -Fake apiClient = new Fake(apiConfiguration, schemaConfiguration); - - -var request = new FakePost.PostRequestBuilder().build(); - -FakePostResponses.EndpointResponse response; -try { - response = apiClient.post(request); -} catch (FakePostCode404Response.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; -} -FakePostResponses.EndpointFakePostCode200Response castResponse = (FakePostResponses.EndpointFakePostCode200Response) response; -``` -### objectModelWithRefProps -public [FakerefsobjectmodelwithrefpropsPostResponses.EndpointResponse](../../paths/fakerefsobjectmodelwithrefprops/post/FakerefsobjectmodelwithrefpropsPostResponses.md#endpointresponse) objectModelWithRefProps([FakerefsobjectmodelwithrefpropsPost.PostRequest](../../paths/fakerefsobjectmodelwithrefprops/FakerefsobjectmodelwithrefpropsPost.md#postrequest) request) - -Test serialization of object with $refed properties - -**Parameters:**
-request - the input request - -**Returns:**
-the deserialized response - -**Throws:**
-IOException, InterruptedException - an exception happened when making the request
-ValidationException - the returned response body or header values do not conform the the schema validation requirements
-NotImplementedException - the request body serialization or deserialization has not yet been implemented
- or the header content type deserialization has not yet been implemented for this contentType
-ApiException - server returned a response/contentType not defined in the openapi document
- -#### 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.FakerefsobjectmodelwithrefpropsPostRequestBody; -import org.openapijsonschematools.client.components.schemas.ObjectModelWithRefProps; -import org.openapijsonschematools.client.RootServerInfo; -import org.openapijsonschematools.client.servers.RootServer0; -import org.openapijsonschematools.client.servers.RootServer1; -import org.openapijsonschematools.client.servers.RootServer2; -import org.openapijsonschematools.client.paths.fakerefsobjectmodelwithrefprops.post.responses.FakerefsobjectmodelwithrefpropsPostCode200Response; -import org.openapijsonschematools.client.servers.RootServerInfo; -import org.openapijsonschematools.client.apis.tags.Fake; -import org.openapijsonschematools.client.paths.fakerefsobjectmodelwithrefprops.post.FakerefsobjectmodelwithrefpropsPostResponses; - -import java.io.IOException; -import java.util.Arrays; -import java.util.List; -import java.util.Map; -import java.util.AbstractMap; - -// if you want to use a server that is not SERVER_0 pass it in here and change the ServerIndex input below -ApiConfiguration.ServerInfo serverInfo = new ApiConfiguration.ServerInfoBuilder() - .rootServerInfo( - new RootServerInfo.RootServerInfoBuilder() - .rootServer0(new RootServer0()) - .build() - ) - .build(); -ApiConfiguration.ServerIndexInfo serverIndexInfo = new ApiConfiguration.ServerIndexInfoBuilder() - .rootServerInfoServerIndex(RootServerInfo.ServerIndex.SERVER_0) - .build(); -Duration timeout = Duration.ofSeconds(1L); -Map> defaultHeaders = Map.of("User-Agent", List.of("OpenAPI-JSON-Schema-Generator/1.0.0/java")); -ApiConfiguration apiConfiguration = new ApiConfiguration( - serverInfo - serverIndexInfo, - timeout, - defaultHeaders -); -SchemaConfiguration schemaConfiguration = new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().build()); -Fake apiClient = new Fake(apiConfiguration, schemaConfiguration); - - -var request = new FakerefsobjectmodelwithrefpropsPost.PostRequestBuilder().build(); - -FakerefsobjectmodelwithrefpropsPostResponses.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; -} -FakerefsobjectmodelwithrefpropsPostResponses.EndpointFakerefsobjectmodelwithrefpropsPostCode200Response castResponse = (FakerefsobjectmodelwithrefpropsPostResponses.EndpointFakerefsobjectmodelwithrefpropsPostCode200Response) response; -FakerefsobjectmodelwithrefpropsPostCode200Response.ApplicationjsonResponseBody deserializedBody = (FakerefsobjectmodelwithrefpropsPostCode200Response.ApplicationjsonResponseBody) castResponse.body; -// handle deserialized body here -``` -### pemContentType -public [FakepemcontenttypeGetResponses.EndpointResponse](../../paths/fakepemcontenttype/get/FakepemcontenttypeGetResponses.md#endpointresponse) pemContentType([FakepemcontenttypeGet.GetRequest](../../paths/fakepemcontenttype/FakepemcontenttypeGet.md#getrequest) request) - -**Parameters:**
-request - the input request - -**Returns:**
-the deserialized response - -**Throws:**
-IOException, InterruptedException - an exception happened when making the request
-ValidationException - the returned response body or header values do not conform the the schema validation requirements
-NotImplementedException - the request body serialization or deserialization has not yet been implemented
- or the header content type deserialization has not yet been implemented for this contentType
-ApiException - server returned a response/contentType not defined in the openapi document
- -#### 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.fakepemcontenttype.get.FakepemcontenttypeGetRequestBody; -import org.openapijsonschematools.client.paths.fakepemcontenttype.get.requestbody.content.applicationxpemfile.ApplicationxpemfileSchema; -import org.openapijsonschematools.client.RootServerInfo; -import org.openapijsonschematools.client.servers.RootServer0; -import org.openapijsonschematools.client.servers.RootServer1; -import org.openapijsonschematools.client.servers.RootServer2; -import org.openapijsonschematools.client.paths.fakepemcontenttype.get.responses.FakepemcontenttypeGetCode200Response; -import org.openapijsonschematools.client.servers.RootServerInfo; -import org.openapijsonschematools.client.apis.tags.Fake; -import org.openapijsonschematools.client.paths.fakepemcontenttype.get.FakepemcontenttypeGetResponses; - -import java.io.IOException; -import java.util.Arrays; -import java.util.List; -import java.util.Map; -import java.util.AbstractMap; - -// if you want to use a server that is not SERVER_0 pass it in here and change the ServerIndex input below -ApiConfiguration.ServerInfo serverInfo = new ApiConfiguration.ServerInfoBuilder() - .rootServerInfo( - new RootServerInfo.RootServerInfoBuilder() - .rootServer0(new RootServer0()) - .build() - ) - .build(); -ApiConfiguration.ServerIndexInfo serverIndexInfo = new ApiConfiguration.ServerIndexInfoBuilder() - .rootServerInfoServerIndex(RootServerInfo.ServerIndex.SERVER_0) - .build(); -Duration timeout = Duration.ofSeconds(1L); -Map> defaultHeaders = Map.of("User-Agent", List.of("OpenAPI-JSON-Schema-Generator/1.0.0/java")); -ApiConfiguration apiConfiguration = new ApiConfiguration( - serverInfo - serverIndexInfo, - timeout, - defaultHeaders -); -SchemaConfiguration schemaConfiguration = new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().build()); -Fake apiClient = new Fake(apiConfiguration, schemaConfiguration); - - -var request = new FakepemcontenttypeGet.GetRequestBuilder().build(); - -FakepemcontenttypeGetResponses.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; -} -FakepemcontenttypeGetResponses.EndpointFakepemcontenttypeGetCode200Response castResponse = (FakepemcontenttypeGetResponses.EndpointFakepemcontenttypeGetCode200Response) response; -FakepemcontenttypeGetCode200Response.ApplicationxpemfileResponseBody deserializedBody = (FakepemcontenttypeGetCode200Response.ApplicationxpemfileResponseBody) castResponse.body; -// handle deserialized body here -``` -### numberWithValidations -public [FakerefsnumberPostResponses.EndpointResponse](../../paths/fakerefsnumber/post/FakerefsnumberPostResponses.md#endpointresponse) numberWithValidations([FakerefsnumberPost.PostRequest](../../paths/fakerefsnumber/FakerefsnumberPost.md#postrequest) request) - -Test serialization of outer number types - -**Parameters:**
-request - the input request - -**Returns:**
-the deserialized response - -**Throws:**
-IOException, InterruptedException - an exception happened when making the request
-ValidationException - the returned response body or header values do not conform the the schema validation requirements
-NotImplementedException - the request body serialization or deserialization has not yet been implemented
- or the header content type deserialization has not yet been implemented for this contentType
-ApiException - server returned a response/contentType not defined in the openapi document
- -#### 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.FakerefsnumberPostRequestBody; -import org.openapijsonschematools.client.components.schemas.NumberWithValidations; -import org.openapijsonschematools.client.RootServerInfo; -import org.openapijsonschematools.client.servers.RootServer0; -import org.openapijsonschematools.client.servers.RootServer1; -import org.openapijsonschematools.client.servers.RootServer2; -import org.openapijsonschematools.client.paths.fakerefsnumber.post.responses.FakerefsnumberPostCode200Response; -import org.openapijsonschematools.client.servers.RootServerInfo; -import org.openapijsonschematools.client.apis.tags.Fake; -import org.openapijsonschematools.client.paths.fakerefsnumber.post.FakerefsnumberPostResponses; - -import java.io.IOException; -import java.util.Arrays; -import java.util.List; -import java.util.Map; -import java.util.AbstractMap; - -// if you want to use a server that is not SERVER_0 pass it in here and change the ServerIndex input below -ApiConfiguration.ServerInfo serverInfo = new ApiConfiguration.ServerInfoBuilder() - .rootServerInfo( - new RootServerInfo.RootServerInfoBuilder() - .rootServer0(new RootServer0()) - .build() - ) - .build(); -ApiConfiguration.ServerIndexInfo serverIndexInfo = new ApiConfiguration.ServerIndexInfoBuilder() - .rootServerInfoServerIndex(RootServerInfo.ServerIndex.SERVER_0) - .build(); -Duration timeout = Duration.ofSeconds(1L); -Map> defaultHeaders = Map.of("User-Agent", List.of("OpenAPI-JSON-Schema-Generator/1.0.0/java")); -ApiConfiguration apiConfiguration = new ApiConfiguration( - serverInfo - serverIndexInfo, - timeout, - defaultHeaders -); -SchemaConfiguration schemaConfiguration = new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().build()); -Fake apiClient = new Fake(apiConfiguration, schemaConfiguration); - - -var request = new FakerefsnumberPost.PostRequestBuilder().build(); - -FakerefsnumberPostResponses.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; -} -FakerefsnumberPostResponses.EndpointFakerefsnumberPostCode200Response castResponse = (FakerefsnumberPostResponses.EndpointFakerefsnumberPostCode200Response) response; -FakerefsnumberPostCode200Response.ApplicationjsonResponseBody deserializedBody = (FakerefsnumberPostCode200Response.ApplicationjsonResponseBody) castResponse.body; -// handle deserialized body here -``` -### modelString -public [FakerefsstringPostResponses.EndpointResponse](../../paths/fakerefsstring/post/FakerefsstringPostResponses.md#endpointresponse) modelString([FakerefsstringPost.PostRequest](../../paths/fakerefsstring/FakerefsstringPost.md#postrequest) request) - -Test serialization of outer string types - -**Parameters:**
-request - the input request - -**Returns:**
-the deserialized response - -**Throws:**
-IOException, InterruptedException - an exception happened when making the request
-ValidationException - the returned response body or header values do not conform the the schema validation requirements
-NotImplementedException - the request body serialization or deserialization has not yet been implemented
- or the header content type deserialization has not yet been implemented for this contentType
-ApiException - server returned a response/contentType not defined in the openapi document
- -#### 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.FakerefsstringPostRequestBody; -import org.openapijsonschematools.client.components.schemas.StringSchema; -import org.openapijsonschematools.client.RootServerInfo; -import org.openapijsonschematools.client.servers.RootServer0; -import org.openapijsonschematools.client.servers.RootServer1; -import org.openapijsonschematools.client.servers.RootServer2; -import org.openapijsonschematools.client.paths.fakerefsstring.post.responses.FakerefsstringPostCode200Response; -import org.openapijsonschematools.client.servers.RootServerInfo; -import org.openapijsonschematools.client.apis.tags.Fake; -import org.openapijsonschematools.client.paths.fakerefsstring.post.FakerefsstringPostResponses; - -import java.io.IOException; -import java.util.Arrays; -import java.util.List; -import java.util.Map; -import java.util.AbstractMap; - -// if you want to use a server that is not SERVER_0 pass it in here and change the ServerIndex input below -ApiConfiguration.ServerInfo serverInfo = new ApiConfiguration.ServerInfoBuilder() - .rootServerInfo( - new RootServerInfo.RootServerInfoBuilder() - .rootServer0(new RootServer0()) - .build() - ) - .build(); -ApiConfiguration.ServerIndexInfo serverIndexInfo = new ApiConfiguration.ServerIndexInfoBuilder() - .rootServerInfoServerIndex(RootServerInfo.ServerIndex.SERVER_0) - .build(); -Duration timeout = Duration.ofSeconds(1L); -Map> defaultHeaders = Map.of("User-Agent", List.of("OpenAPI-JSON-Schema-Generator/1.0.0/java")); -ApiConfiguration apiConfiguration = new ApiConfiguration( - serverInfo - serverIndexInfo, - timeout, - defaultHeaders -); -SchemaConfiguration schemaConfiguration = new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().build()); -Fake apiClient = new Fake(apiConfiguration, schemaConfiguration); - - -var request = new FakerefsstringPost.PostRequestBuilder().build(); - -FakerefsstringPostResponses.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; -} -FakerefsstringPostResponses.EndpointFakerefsstringPostCode200Response castResponse = (FakerefsstringPostResponses.EndpointFakerefsstringPostCode200Response) response; -FakerefsstringPostCode200Response.ApplicationjsonResponseBody deserializedBody = (FakerefsstringPostCode200Response.ApplicationjsonResponseBody) castResponse.body; -// handle deserialized body here -``` -### inlineAdditionalProperties -public [FakeinlineadditionalpropertiesPostResponses.EndpointResponse](../../paths/fakeinlineadditionalproperties/post/FakeinlineadditionalpropertiesPostResponses.md#endpointresponse) inlineAdditionalProperties([FakeinlineadditionalpropertiesPost.PostRequest](../../paths/fakeinlineadditionalproperties/FakeinlineadditionalpropertiesPost.md#postrequest) request) - - - -**Parameters:**
-request - the input request - -**Returns:**
-the deserialized response - -**Throws:**
-IOException, InterruptedException - an exception happened when making the request
-ValidationException - the returned response body or header values do not conform the the schema validation requirements
-NotImplementedException - the request body serialization or deserialization has not yet been implemented
- or the header content type deserialization has not yet been implemented for this contentType
-ApiException - server returned a response/contentType not defined in the openapi document
- -#### 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.fakeinlineadditionalproperties.post.FakeinlineadditionalpropertiesPostRequestBody; -import org.openapijsonschematools.client.paths.fakeinlineadditionalproperties.post.requestbody.content.applicationjson.ApplicationjsonSchema; -import org.openapijsonschematools.client.servers.RootServer0; -import org.openapijsonschematools.client.servers.RootServer1; -import org.openapijsonschematools.client.servers.RootServer2; -import org.openapijsonschematools.client.paths.fakeinlineadditionalproperties.post.responses.FakeinlineadditionalpropertiesPostCode200Response; -import org.openapijsonschematools.client.servers.RootServerInfo; -import org.openapijsonschematools.client.apis.tags.Fake; -import org.openapijsonschematools.client.paths.fakeinlineadditionalproperties.post.FakeinlineadditionalpropertiesPostResponses; - -import java.io.IOException; -import java.util.Arrays; -import java.util.List; -import java.util.Map; -import java.util.AbstractMap; - -// if you want to use a server that is not SERVER_0 pass it in here and change the ServerIndex input below -ApiConfiguration.ServerInfo serverInfo = new ApiConfiguration.ServerInfoBuilder() - .rootServerInfo( - new RootServerInfo.RootServerInfoBuilder() - .rootServer0(new RootServer0()) - .build() - ) - .build(); -ApiConfiguration.ServerIndexInfo serverIndexInfo = new ApiConfiguration.ServerIndexInfoBuilder() - .rootServerInfoServerIndex(RootServerInfo.ServerIndex.SERVER_0) - .build(); -Duration timeout = Duration.ofSeconds(1L); -Map> defaultHeaders = Map.of("User-Agent", List.of("OpenAPI-JSON-Schema-Generator/1.0.0/java")); -ApiConfiguration apiConfiguration = new ApiConfiguration( - serverInfo - serverIndexInfo, - timeout, - defaultHeaders -); -SchemaConfiguration schemaConfiguration = new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().build()); -Fake apiClient = new Fake(apiConfiguration, schemaConfiguration); - - -ApplicationjsonSchema1BoxedMap requestBodyPayload = - ApplicationjsonSchema.ApplicationjsonSchema1.validateAndBox( - new ApplicationjsonSchema.ApplicationjsonSchemaMapBuilder() - .additionalProperty("someAdditionalProperty", "a") - - .build(), - schemaConfiguration -); -FakeinlineadditionalpropertiesPost.SealedRequestBody requestBody = new FakeinlineadditionalpropertiesPost.ApplicationjsonRequestBody(requestBodyPayload); - -var request = new FakeinlineadditionalpropertiesPost.PostRequestBuilder() - .requestBody(requestBody) - .build(); - -FakeinlineadditionalpropertiesPostResponses.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; -} -FakeinlineadditionalpropertiesPostResponses.EndpointFakeinlineadditionalpropertiesPostCode200Response castResponse = (FakeinlineadditionalpropertiesPostResponses.EndpointFakeinlineadditionalpropertiesPostCode200Response) response; -``` -### mammal -public [FakerefsmammalPostResponses.EndpointResponse](../../paths/fakerefsmammal/post/FakerefsmammalPostResponses.md#endpointresponse) mammal([FakerefsmammalPost.PostRequest](../../paths/fakerefsmammal/FakerefsmammalPost.md#postrequest) request) - -Test serialization of mammals - -**Parameters:**
-request - the input request - -**Returns:**
-the deserialized response - -**Throws:**
-IOException, InterruptedException - an exception happened when making the request
-ValidationException - the returned response body or header values do not conform the the schema validation requirements
-NotImplementedException - the request body serialization or deserialization has not yet been implemented
- or the header content type deserialization has not yet been implemented for this contentType
-ApiException - server returned a response/contentType not defined in the openapi document
- -#### 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.FakerefsmammalPostRequestBody; -import org.openapijsonschematools.client.components.schemas.Mammal; -import org.openapijsonschematools.client.servers.RootServer0; -import org.openapijsonschematools.client.servers.RootServer1; -import org.openapijsonschematools.client.servers.RootServer2; -import org.openapijsonschematools.client.paths.fakerefsmammal.post.responses.FakerefsmammalPostCode200Response; -import org.openapijsonschematools.client.servers.RootServerInfo; -import org.openapijsonschematools.client.apis.tags.Fake; -import org.openapijsonschematools.client.paths.fakerefsmammal.post.FakerefsmammalPostResponses; - -import java.io.IOException; -import java.util.Arrays; -import java.util.List; -import java.util.Map; -import java.util.AbstractMap; - -// if you want to use a server that is not SERVER_0 pass it in here and change the ServerIndex input below -ApiConfiguration.ServerInfo serverInfo = new ApiConfiguration.ServerInfoBuilder() - .rootServerInfo( - new RootServerInfo.RootServerInfoBuilder() - .rootServer0(new RootServer0()) - .build() - ) - .build(); -ApiConfiguration.ServerIndexInfo serverIndexInfo = new ApiConfiguration.ServerIndexInfoBuilder() - .rootServerInfoServerIndex(RootServerInfo.ServerIndex.SERVER_0) - .build(); -Duration timeout = Duration.ofSeconds(1L); -Map> defaultHeaders = Map.of("User-Agent", List.of("OpenAPI-JSON-Schema-Generator/1.0.0/java")); -ApiConfiguration apiConfiguration = new ApiConfiguration( - serverInfo - serverIndexInfo, - timeout, - defaultHeaders -); -SchemaConfiguration schemaConfiguration = new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().build()); -Fake apiClient = new Fake(apiConfiguration, schemaConfiguration); - -FakerefsmammalPost.SealedRequestBody requestBody = new FakerefsmammalPost.ApplicationjsonRequestBody(requestBodyPayload); - -var request = new FakerefsmammalPost.PostRequestBuilder() - .requestBody(requestBody) - .build(); - -FakerefsmammalPostResponses.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; -} -FakerefsmammalPostResponses.EndpointFakerefsmammalPostCode200Response castResponse = (FakerefsmammalPostResponses.EndpointFakerefsmammalPostCode200Response) response; -FakerefsmammalPostCode200Response.ApplicationjsonResponseBody deserializedBody = (FakerefsmammalPostCode200Response.ApplicationjsonResponseBody) castResponse.body; -// handle deserialized body here -``` -### slashRoute -public [SolidusGetResponses.EndpointResponse](../../paths/solidus/get/SolidusGetResponses.md#endpointresponse) slashRoute([SolidusGet.GetRequest](../../paths/solidus/SolidusGet.md#getrequest) request) - -**Parameters:**
-request - the input request - -**Returns:**
-the deserialized response - -**Throws:**
-IOException, InterruptedException - an exception happened when making the request
-ValidationException - the returned response body or header values do not conform the the schema validation requirements
-NotImplementedException - the request body serialization or deserialization has not yet been implemented
- or the header content type deserialization has not yet been implemented for this contentType
-ApiException - server returned a response/contentType not defined in the openapi document
- -#### 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.servers.RootServer0; -import org.openapijsonschematools.client.servers.RootServer1; -import org.openapijsonschematools.client.servers.RootServer2; -import org.openapijsonschematools.client.paths.solidus.get.responses.SolidusGetCode200Response; -import org.openapijsonschematools.client.servers.RootServerInfo; -import org.openapijsonschematools.client.apis.tags.Fake; -import org.openapijsonschematools.client.paths.solidus.get.SolidusGetResponses; - -import java.io.IOException; -import java.util.Arrays; -import java.util.List; -import java.util.Map; -import java.util.AbstractMap; - -// if you want to use a server that is not SERVER_0 pass it in here and change the ServerIndex input below -ApiConfiguration.ServerInfo serverInfo = new ApiConfiguration.ServerInfoBuilder() - .rootServerInfo( - new RootServerInfo.RootServerInfoBuilder() - .rootServer0(new RootServer0()) - .build() - ) - .build(); -ApiConfiguration.ServerIndexInfo serverIndexInfo = new ApiConfiguration.ServerIndexInfoBuilder() - .rootServerInfoServerIndex(RootServerInfo.ServerIndex.SERVER_0) - .build(); -Duration timeout = Duration.ofSeconds(1L); -Map> defaultHeaders = Map.of("User-Agent", List.of("OpenAPI-JSON-Schema-Generator/1.0.0/java")); -ApiConfiguration apiConfiguration = new ApiConfiguration( - serverInfo - serverIndexInfo, - timeout, - defaultHeaders -); -SchemaConfiguration schemaConfiguration = new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().build()); -Fake apiClient = new Fake(apiConfiguration, schemaConfiguration); - - -var request = new SolidusGet.GetRequestBuilder().build(); - -SolidusGetResponses.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; -} -SolidusGetResponses.EndpointSolidusGetCode200Response castResponse = (SolidusGetResponses.EndpointSolidusGetCode200Response) response; -``` -### modelBoolean -public [FakerefsbooleanPostResponses.EndpointResponse](../../paths/fakerefsboolean/post/FakerefsbooleanPostResponses.md#endpointresponse) modelBoolean([FakerefsbooleanPost.PostRequest](../../paths/fakerefsboolean/FakerefsbooleanPost.md#postrequest) request) - -Test serialization of outer boolean types - -**Parameters:**
-request - the input request - -**Returns:**
-the deserialized response - -**Throws:**
-IOException, InterruptedException - an exception happened when making the request
-ValidationException - the returned response body or header values do not conform the the schema validation requirements
-NotImplementedException - the request body serialization or deserialization has not yet been implemented
- or the header content type deserialization has not yet been implemented for this contentType
-ApiException - server returned a response/contentType not defined in the openapi document
- -#### 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.FakerefsbooleanPostRequestBody; -import org.openapijsonschematools.client.components.schemas.BooleanSchema; -import org.openapijsonschematools.client.RootServerInfo; -import org.openapijsonschematools.client.servers.RootServer0; -import org.openapijsonschematools.client.servers.RootServer1; -import org.openapijsonschematools.client.servers.RootServer2; -import org.openapijsonschematools.client.paths.fakerefsboolean.post.responses.FakerefsbooleanPostCode200Response; -import org.openapijsonschematools.client.servers.RootServerInfo; -import org.openapijsonschematools.client.apis.tags.Fake; -import org.openapijsonschematools.client.paths.fakerefsboolean.post.FakerefsbooleanPostResponses; - -import java.io.IOException; -import java.util.Arrays; -import java.util.List; -import java.util.Map; -import java.util.AbstractMap; - -// if you want to use a server that is not SERVER_0 pass it in here and change the ServerIndex input below -ApiConfiguration.ServerInfo serverInfo = new ApiConfiguration.ServerInfoBuilder() - .rootServerInfo( - new RootServerInfo.RootServerInfoBuilder() - .rootServer0(new RootServer0()) - .build() - ) - .build(); -ApiConfiguration.ServerIndexInfo serverIndexInfo = new ApiConfiguration.ServerIndexInfoBuilder() - .rootServerInfoServerIndex(RootServerInfo.ServerIndex.SERVER_0) - .build(); -Duration timeout = Duration.ofSeconds(1L); -Map> defaultHeaders = Map.of("User-Agent", List.of("OpenAPI-JSON-Schema-Generator/1.0.0/java")); -ApiConfiguration apiConfiguration = new ApiConfiguration( - serverInfo - serverIndexInfo, - timeout, - defaultHeaders -); -SchemaConfiguration schemaConfiguration = new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().build()); -Fake apiClient = new Fake(apiConfiguration, schemaConfiguration); - - -var request = new FakerefsbooleanPost.PostRequestBuilder().build(); - -FakerefsbooleanPostResponses.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; -} -FakerefsbooleanPostResponses.EndpointFakerefsbooleanPostCode200Response castResponse = (FakerefsbooleanPostResponses.EndpointFakerefsbooleanPostCode200Response) response; -FakerefsbooleanPostCode200Response.ApplicationjsonResponseBody deserializedBody = (FakerefsbooleanPostCode200Response.ApplicationjsonResponseBody) castResponse.body; -// handle deserialized body here -``` -### jsonFormData -public [FakejsonformdataGetResponses.EndpointResponse](../../paths/fakejsonformdata/get/FakejsonformdataGetResponses.md#endpointresponse) jsonFormData([FakejsonformdataGet.GetRequest](../../paths/fakejsonformdata/FakejsonformdataGet.md#getrequest) request) - - - -**Parameters:**
-request - the input request - -**Returns:**
-the deserialized response - -**Throws:**
-IOException, InterruptedException - an exception happened when making the request
-ValidationException - the returned response body or header values do not conform the the schema validation requirements
-NotImplementedException - the request body serialization or deserialization has not yet been implemented
- or the header content type deserialization has not yet been implemented for this contentType
-ApiException - server returned a response/contentType not defined in the openapi document
- -#### 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.fakejsonformdata.get.FakejsonformdataGetRequestBody; -import org.openapijsonschematools.client.paths.fakejsonformdata.get.requestbody.content.applicationxwwwformurlencoded.ApplicationxwwwformurlencodedSchema; -import org.openapijsonschematools.client.RootServerInfo; -import org.openapijsonschematools.client.servers.RootServer0; -import org.openapijsonschematools.client.servers.RootServer1; -import org.openapijsonschematools.client.servers.RootServer2; -import org.openapijsonschematools.client.paths.fakejsonformdata.get.responses.FakejsonformdataGetCode200Response; -import org.openapijsonschematools.client.servers.RootServerInfo; -import org.openapijsonschematools.client.apis.tags.Fake; -import org.openapijsonschematools.client.paths.fakejsonformdata.get.FakejsonformdataGetResponses; - -import java.io.IOException; -import java.util.Arrays; -import java.util.List; -import java.util.Map; -import java.util.AbstractMap; - -// if you want to use a server that is not SERVER_0 pass it in here and change the ServerIndex input below -ApiConfiguration.ServerInfo serverInfo = new ApiConfiguration.ServerInfoBuilder() - .rootServerInfo( - new RootServerInfo.RootServerInfoBuilder() - .rootServer0(new RootServer0()) - .build() - ) - .build(); -ApiConfiguration.ServerIndexInfo serverIndexInfo = new ApiConfiguration.ServerIndexInfoBuilder() - .rootServerInfoServerIndex(RootServerInfo.ServerIndex.SERVER_0) - .build(); -Duration timeout = Duration.ofSeconds(1L); -Map> defaultHeaders = Map.of("User-Agent", List.of("OpenAPI-JSON-Schema-Generator/1.0.0/java")); -ApiConfiguration apiConfiguration = new ApiConfiguration( - serverInfo - serverIndexInfo, - timeout, - defaultHeaders -); -SchemaConfiguration schemaConfiguration = new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().build()); -Fake apiClient = new Fake(apiConfiguration, schemaConfiguration); - - -var request = new FakejsonformdataGet.GetRequestBuilder().build(); - -FakejsonformdataGetResponses.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; -} -FakejsonformdataGetResponses.EndpointFakejsonformdataGetCode200Response castResponse = (FakejsonformdataGetResponses.EndpointFakejsonformdataGetCode200Response) response; -``` -### parameterCollisions -public [Fakeparametercollisions1ababselfabPostResponses.EndpointResponse](../../paths/fakeparametercollisions1ababselfab/post/Fakeparametercollisions1ababselfabPostResponses.md#endpointresponse) parameterCollisions([Fakeparametercollisions1ababselfabPost.PostRequest](../../paths/fakeparametercollisions1ababselfab/Fakeparametercollisions1ababselfabPost.md#postrequest) request) - -**Parameters:**
-request - the input request - -**Returns:**
-the deserialized response - -**Throws:**
-IOException, InterruptedException - an exception happened when making the request
-ValidationException - the returned response body or header values do not conform the the schema validation requirements
-NotImplementedException - the request body serialization or deserialization has not yet been implemented
- or the header content type deserialization has not yet been implemented for this contentType
-ApiException - server returned a response/contentType not defined in the openapi document
- -#### 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.fakeparametercollisions1ababselfab.post.Fakeparametercollisions1ababselfabPostRequestBody; -import org.openapijsonschematools.client.paths.fakeparametercollisions1ababselfab.post.Fakeparametercollisions1ababselfabPostHeaderParameters; -import org.openapijsonschematools.client.paths.fakeparametercollisions1ababselfab.post.Fakeparametercollisions1ababselfabPostQueryParameters; -import org.openapijsonschematools.client.paths.fakeparametercollisions1ababselfab.post.Fakeparametercollisions1ababselfabPostCookieParameters; -import org.openapijsonschematools.client.RootServerInfo; -import org.openapijsonschematools.client.paths.fakeparametercollisions1ababselfab.post.Fakeparametercollisions1ababselfabPostPathParameters; -import org.openapijsonschematools.client.servers.RootServer0; -import org.openapijsonschematools.client.servers.RootServer1; -import org.openapijsonschematools.client.servers.RootServer2; -import org.openapijsonschematools.client.paths.fakeparametercollisions1ababselfab.post.responses.Fakeparametercollisions1ababselfabPostCode200Response; -import org.openapijsonschematools.client.servers.RootServerInfo; -import org.openapijsonschematools.client.apis.tags.Fake; -import org.openapijsonschematools.client.paths.fakeparametercollisions1ababselfab.post.Fakeparametercollisions1ababselfabPostResponses; - -import java.io.IOException; -import java.util.Arrays; -import java.util.List; -import java.util.Map; -import java.util.AbstractMap; - -// if you want to use a server that is not SERVER_0 pass it in here and change the ServerIndex input below -ApiConfiguration.ServerInfo serverInfo = new ApiConfiguration.ServerInfoBuilder() - .rootServerInfo( - new RootServerInfo.RootServerInfoBuilder() - .rootServer0(new RootServer0()) - .build() - ) - .build(); -ApiConfiguration.ServerIndexInfo serverIndexInfo = new ApiConfiguration.ServerIndexInfoBuilder() - .rootServerInfoServerIndex(RootServerInfo.ServerIndex.SERVER_0) - .build(); -Duration timeout = Duration.ofSeconds(1L); -Map> defaultHeaders = Map.of("User-Agent", List.of("OpenAPI-JSON-Schema-Generator/1.0.0/java")); -ApiConfiguration apiConfiguration = new ApiConfiguration( - serverInfo - serverIndexInfo, - timeout, - defaultHeaders -); -SchemaConfiguration schemaConfiguration = new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().build()); -Fake apiClient = new Fake(apiConfiguration, schemaConfiguration); - - -// Map validation -Fakeparametercollisions1ababselfabPostPathParameters.PathParametersMap pathParameters = - Fakeparametercollisions1ababselfabPostPathParameters.Fakeparametercollisions1ababselfabPostPathParameters1.validate( - new Fakeparametercollisions1ababselfabPostPathParameters.PathParametersMapBuilder() - .positive1("a") - - .aHyphenMinusB("a") - - .Ab("a") - - .aB("a") - - .self("a") - - .build(), - schemaConfiguration -); - -var request = new Fakeparametercollisions1ababselfabPost.PostRequestBuilder() - .pathParameters(pathParameters) - .build(); - -Fakeparametercollisions1ababselfabPostResponses.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; -} -Fakeparametercollisions1ababselfabPostResponses.EndpointFakeparametercollisions1ababselfabPostCode200Response castResponse = (Fakeparametercollisions1ababselfabPostResponses.EndpointFakeparametercollisions1ababselfabPostCode200Response) response; -Fakeparametercollisions1ababselfabPostCode200Response.ApplicationjsonResponseBody deserializedBody = (Fakeparametercollisions1ababselfabPostCode200Response.ApplicationjsonResponseBody) castResponse.body; -// handle deserialized body here -``` -### queryParamWithJsonContentType -public [FakequeryparamwithjsoncontenttypeGetResponses.EndpointResponse](../../paths/fakequeryparamwithjsoncontenttype/get/FakequeryparamwithjsoncontenttypeGetResponses.md#endpointresponse) queryParamWithJsonContentType([FakequeryparamwithjsoncontenttypeGet.GetRequest](../../paths/fakequeryparamwithjsoncontenttype/FakequeryparamwithjsoncontenttypeGet.md#getrequest) request) - -**Parameters:**
-request - the input request - -**Returns:**
-the deserialized response - -**Throws:**
-IOException, InterruptedException - an exception happened when making the request
-ValidationException - the returned response body or header values do not conform the the schema validation requirements
-NotImplementedException - the request body serialization or deserialization has not yet been implemented
- or the header content type deserialization has not yet been implemented for this contentType
-ApiException - server returned a response/contentType not defined in the openapi document
- -#### 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.fakequeryparamwithjsoncontenttype.get.FakequeryparamwithjsoncontenttypeGetQueryParameters; -import org.openapijsonschematools.client.servers.RootServer0; -import org.openapijsonschematools.client.servers.RootServer1; -import org.openapijsonschematools.client.servers.RootServer2; -import org.openapijsonschematools.client.paths.fakequeryparamwithjsoncontenttype.get.responses.FakequeryparamwithjsoncontenttypeGetCode200Response; -import org.openapijsonschematools.client.servers.RootServerInfo; -import org.openapijsonschematools.client.apis.tags.Fake; -import org.openapijsonschematools.client.paths.fakequeryparamwithjsoncontenttype.get.FakequeryparamwithjsoncontenttypeGetResponses; - -import java.io.IOException; -import java.util.Arrays; -import java.util.List; -import java.util.Map; -import java.util.AbstractMap; - -// if you want to use a server that is not SERVER_0 pass it in here and change the ServerIndex input below -ApiConfiguration.ServerInfo serverInfo = new ApiConfiguration.ServerInfoBuilder() - .rootServerInfo( - new RootServerInfo.RootServerInfoBuilder() - .rootServer0(new RootServer0()) - .build() - ) - .build(); -ApiConfiguration.ServerIndexInfo serverIndexInfo = new ApiConfiguration.ServerIndexInfoBuilder() - .rootServerInfoServerIndex(RootServerInfo.ServerIndex.SERVER_0) - .build(); -Duration timeout = Duration.ofSeconds(1L); -Map> defaultHeaders = Map.of("User-Agent", List.of("OpenAPI-JSON-Schema-Generator/1.0.0/java")); -ApiConfiguration apiConfiguration = new ApiConfiguration( - serverInfo - serverIndexInfo, - timeout, - defaultHeaders -); -SchemaConfiguration schemaConfiguration = new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().build()); -Fake apiClient = new Fake(apiConfiguration, schemaConfiguration); - - -// Map validation -FakequeryparamwithjsoncontenttypeGetQueryParameters.QueryParametersMap queryParameters = - FakequeryparamwithjsoncontenttypeGetQueryParameters.FakequeryparamwithjsoncontenttypeGetQueryParameters1.validate( - new FakequeryparamwithjsoncontenttypeGetQueryParameters.QueryParametersMapBuilder() - .build(), - schemaConfiguration -); - -var request = new FakequeryparamwithjsoncontenttypeGet.GetRequestBuilder() - .queryParameters(queryParameters) - .build(); - -FakequeryparamwithjsoncontenttypeGetResponses.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; -} -FakequeryparamwithjsoncontenttypeGetResponses.EndpointFakequeryparamwithjsoncontenttypeGetCode200Response castResponse = (FakequeryparamwithjsoncontenttypeGetResponses.EndpointFakequeryparamwithjsoncontenttypeGetCode200Response) response; -FakequeryparamwithjsoncontenttypeGetCode200Response.ApplicationjsonResponseBody deserializedBody = (FakequeryparamwithjsoncontenttypeGetCode200Response.ApplicationjsonResponseBody) castResponse.body; -// handle deserialized body here -``` -### objectInQuery -public [FakeobjinqueryGetResponses.EndpointResponse](../../paths/fakeobjinquery/get/FakeobjinqueryGetResponses.md#endpointresponse) objectInQuery([FakeobjinqueryGet.GetRequest](../../paths/fakeobjinquery/FakeobjinqueryGet.md#getrequest) request) - -**Parameters:**
-request - the input request - -**Returns:**
-the deserialized response - -**Throws:**
-IOException, InterruptedException - an exception happened when making the request
-ValidationException - the returned response body or header values do not conform the the schema validation requirements
-NotImplementedException - the request body serialization or deserialization has not yet been implemented
- or the header content type deserialization has not yet been implemented for this contentType
-ApiException - server returned a response/contentType not defined in the openapi document
- -#### 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.fakeobjinquery.get.FakeobjinqueryGetQueryParameters; -import org.openapijsonschematools.client.RootServerInfo; -import org.openapijsonschematools.client.servers.RootServer0; -import org.openapijsonschematools.client.servers.RootServer1; -import org.openapijsonschematools.client.servers.RootServer2; -import org.openapijsonschematools.client.paths.fakeobjinquery.get.responses.FakeobjinqueryGetCode200Response; -import org.openapijsonschematools.client.servers.RootServerInfo; -import org.openapijsonschematools.client.apis.tags.Fake; -import org.openapijsonschematools.client.paths.fakeobjinquery.get.FakeobjinqueryGetResponses; - -import java.io.IOException; -import java.util.Arrays; -import java.util.List; -import java.util.Map; -import java.util.AbstractMap; - -// if you want to use a server that is not SERVER_0 pass it in here and change the ServerIndex input below -ApiConfiguration.ServerInfo serverInfo = new ApiConfiguration.ServerInfoBuilder() - .rootServerInfo( - new RootServerInfo.RootServerInfoBuilder() - .rootServer0(new RootServer0()) - .build() - ) - .build(); -ApiConfiguration.ServerIndexInfo serverIndexInfo = new ApiConfiguration.ServerIndexInfoBuilder() - .rootServerInfoServerIndex(RootServerInfo.ServerIndex.SERVER_0) - .build(); -Duration timeout = Duration.ofSeconds(1L); -Map> defaultHeaders = Map.of("User-Agent", List.of("OpenAPI-JSON-Schema-Generator/1.0.0/java")); -ApiConfiguration apiConfiguration = new ApiConfiguration( - serverInfo - serverIndexInfo, - timeout, - defaultHeaders -); -SchemaConfiguration schemaConfiguration = new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().build()); -Fake apiClient = new Fake(apiConfiguration, schemaConfiguration); - - -var request = new FakeobjinqueryGet.GetRequestBuilder().build(); - -FakeobjinqueryGetResponses.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; -} -FakeobjinqueryGetResponses.EndpointFakeobjinqueryGetCode200Response castResponse = (FakeobjinqueryGetResponses.EndpointFakeobjinqueryGetCode200Response) response; -``` -### multipleSecurities -public [FakemultiplesecuritiesGetResponses.EndpointResponse](../../paths/fakemultiplesecurities/get/FakemultiplesecuritiesGetResponses.md#endpointresponse) multipleSecurities([FakemultiplesecuritiesGet.GetRequest](../../paths/fakemultiplesecurities/FakemultiplesecuritiesGet.md#getrequest) request) - -**Parameters:**
-request - the input request - -**Returns:**
-the deserialized response - -**Throws:**
-IOException, InterruptedException - an exception happened when making the request
-ValidationException - the returned response body or header values do not conform the the schema validation requirements
-NotImplementedException - the request body serialization or deserialization has not yet been implemented
- or the header content type deserialization has not yet been implemented for this contentType
-ApiException - server returned a response/contentType not defined in the openapi document
- -#### 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.fakemultiplesecurities.get.FakemultiplesecuritiesGetSecurityInfo; -import org.openapijsonschematools.client.servers.RootServer0; -import org.openapijsonschematools.client.servers.RootServer1; -import org.openapijsonschematools.client.servers.RootServer2; -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.FakemultiplesecuritiesGetCode200Response; -import org.openapijsonschematools.client.servers.RootServerInfo; -import org.openapijsonschematools.client.apis.tags.Fake; -import org.openapijsonschematools.client.paths.fakemultiplesecurities.get.FakemultiplesecuritiesGetResponses; - -import java.io.IOException; -import java.util.Arrays; -import java.util.List; -import java.util.Map; -import java.util.AbstractMap; - -// if you want to use a server that is not SERVER_0 pass it in here and change the ServerIndex input below -ApiConfiguration.ServerInfo serverInfo = new ApiConfiguration.ServerInfoBuilder() - .rootServerInfo( - new RootServerInfo.RootServerInfoBuilder() - .rootServer0(new RootServer0()) - .build() - ) - .build(); -ApiConfiguration.ServerIndexInfo serverIndexInfo = new ApiConfiguration.ServerIndexInfoBuilder() - .rootServerInfoServerIndex(RootServerInfo.ServerIndex.SERVER_0) - .build(); -List securitySchemes = new ArrayList(); -securitySchemes.add( - new HttpBasicTest("someUserId", "somePassword"); -); -securitySchemes.add( - new ApiKey("someApiKey"); -); -ApiConfiguration.SecurityIndexInfo securityIndexInfo = new ApiConfiguration.SecurityIndexInfoBuilder() - .fakemultiplesecuritiesGetSecurityRequirementObject0SecurityIndex(FakemultiplesecuritiesGetSecurityRequirementObject0.SecurityIndex.SECURITY_0) - .build(); -Duration timeout = Duration.ofSeconds(1L); -Map> defaultHeaders = Map.of("User-Agent", List.of("OpenAPI-JSON-Schema-Generator/1.0.0/java")); -ApiConfiguration apiConfiguration = new ApiConfiguration( - serverInfo - serverIndexInfo, - securitySchemes, - securityIndexInfo, - timeout, - defaultHeaders -); -SchemaConfiguration schemaConfiguration = new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().build()); -Fake apiClient = new Fake(apiConfiguration, schemaConfiguration); - - -var request = new FakemultiplesecuritiesGet.GetRequestBuilder().build(); - -FakemultiplesecuritiesGetResponses.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; -} -FakemultiplesecuritiesGetResponses.EndpointFakemultiplesecuritiesGetCode200Response castResponse = (FakemultiplesecuritiesGetResponses.EndpointFakemultiplesecuritiesGetCode200Response) response; -FakemultiplesecuritiesGetCode200Response.ApplicationjsonResponseBody deserializedBody = (FakemultiplesecuritiesGetCode200Response.ApplicationjsonResponseBody) castResponse.body; -// handle deserialized body here -``` -### queryParameterCollectionFormat -public [FaketestqueryparamtersPutResponses.EndpointResponse](../../paths/faketestqueryparamters/put/FaketestqueryparamtersPutResponses.md#endpointresponse) queryParameterCollectionFormat([FaketestqueryparamtersPut.PutRequest](../../paths/faketestqueryparamters/FaketestqueryparamtersPut.md#putrequest) request) - -To test the collection format in query parameters - -**Parameters:**
-request - the input request - -**Returns:**
-the deserialized response - -**Throws:**
-IOException, InterruptedException - an exception happened when making the request
-ValidationException - the returned response body or header values do not conform the the schema validation requirements
-NotImplementedException - the request body serialization or deserialization has not yet been implemented
- or the header content type deserialization has not yet been implemented for this contentType
-ApiException - server returned a response/contentType not defined in the openapi document
- -#### 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.faketestqueryparamters.put.FaketestqueryparamtersPutQueryParameters; -import org.openapijsonschematools.client.servers.RootServer0; -import org.openapijsonschematools.client.servers.RootServer1; -import org.openapijsonschematools.client.servers.RootServer2; -import org.openapijsonschematools.client.paths.faketestqueryparamters.put.responses.FaketestqueryparamtersPutCode200Response; -import org.openapijsonschematools.client.servers.RootServerInfo; -import org.openapijsonschematools.client.apis.tags.Fake; -import org.openapijsonschematools.client.paths.faketestqueryparamters.put.FaketestqueryparamtersPutResponses; - -import java.io.IOException; -import java.util.Arrays; -import java.util.List; -import java.util.Map; -import java.util.AbstractMap; - -// if you want to use a server that is not SERVER_0 pass it in here and change the ServerIndex input below -ApiConfiguration.ServerInfo serverInfo = new ApiConfiguration.ServerInfoBuilder() - .rootServerInfo( - new RootServerInfo.RootServerInfoBuilder() - .rootServer0(new RootServer0()) - .build() - ) - .build(); -ApiConfiguration.ServerIndexInfo serverIndexInfo = new ApiConfiguration.ServerIndexInfoBuilder() - .rootServerInfoServerIndex(RootServerInfo.ServerIndex.SERVER_0) - .build(); -Duration timeout = Duration.ofSeconds(1L); -Map> defaultHeaders = Map.of("User-Agent", List.of("OpenAPI-JSON-Schema-Generator/1.0.0/java")); -ApiConfiguration apiConfiguration = new ApiConfiguration( - serverInfo - serverIndexInfo, - timeout, - defaultHeaders -); -SchemaConfiguration schemaConfiguration = new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().build()); -Fake apiClient = new Fake(apiConfiguration, schemaConfiguration); - - -// Map validation -FaketestqueryparamtersPutQueryParameters.QueryParametersMap queryParameters = - FaketestqueryparamtersPutQueryParameters.FaketestqueryparamtersPutQueryParameters1.validate( - new FaketestqueryparamtersPutQueryParameters.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 -); - -var request = new FaketestqueryparamtersPut.PutRequestBuilder() - .queryParameters(queryParameters) - .build(); - -FaketestqueryparamtersPutResponses.EndpointResponse response; -try { - response = apiClient.put(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; -} -FaketestqueryparamtersPutResponses.EndpointFaketestqueryparamtersPutCode200Response castResponse = (FaketestqueryparamtersPutResponses.EndpointFaketestqueryparamtersPutCode200Response) response; -``` -### multipleResponseBodies -public [FakemultipleresponsebodiesGetResponses.EndpointResponse](../../paths/fakemultipleresponsebodies/get/FakemultipleresponsebodiesGetResponses.md#endpointresponse) multipleResponseBodies([FakemultipleresponsebodiesGet.GetRequest](../../paths/fakemultipleresponsebodies/FakemultipleresponsebodiesGet.md#getrequest) request) - -**Parameters:**
-request - the input request - -**Returns:**
-the deserialized response - -**Throws:**
-IOException, InterruptedException - an exception happened when making the request
-ValidationException - the returned response body or header values do not conform the the schema validation requirements
-NotImplementedException - the request body serialization or deserialization has not yet been implemented
- or the header content type deserialization has not yet been implemented for this contentType
-ApiException - server returned a response/contentType not defined in the openapi document
- -#### 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.servers.RootServer0; -import org.openapijsonschematools.client.servers.RootServer1; -import org.openapijsonschematools.client.servers.RootServer2; -import org.openapijsonschematools.client.paths.fakemultipleresponsebodies.get.responses.FakemultipleresponsebodiesGetCode200Response; -import org.openapijsonschematools.client.paths.fakemultipleresponsebodies.get.responses.FakemultipleresponsebodiesGetCode202Response; -import org.openapijsonschematools.client.servers.RootServerInfo; -import org.openapijsonschematools.client.apis.tags.Fake; -import org.openapijsonschematools.client.paths.fakemultipleresponsebodies.get.FakemultipleresponsebodiesGetResponses; - -import java.io.IOException; -import java.util.Arrays; -import java.util.List; -import java.util.Map; -import java.util.AbstractMap; - -// if you want to use a server that is not SERVER_0 pass it in here and change the ServerIndex input below -ApiConfiguration.ServerInfo serverInfo = new ApiConfiguration.ServerInfoBuilder() - .rootServerInfo( - new RootServerInfo.RootServerInfoBuilder() - .rootServer0(new RootServer0()) - .build() - ) - .build(); -ApiConfiguration.ServerIndexInfo serverIndexInfo = new ApiConfiguration.ServerIndexInfoBuilder() - .rootServerInfoServerIndex(RootServerInfo.ServerIndex.SERVER_0) - .build(); -Duration timeout = Duration.ofSeconds(1L); -Map> defaultHeaders = Map.of("User-Agent", List.of("OpenAPI-JSON-Schema-Generator/1.0.0/java")); -ApiConfiguration apiConfiguration = new ApiConfiguration( - serverInfo - serverIndexInfo, - timeout, - defaultHeaders -); -SchemaConfiguration schemaConfiguration = new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().build()); -Fake apiClient = new Fake(apiConfiguration, schemaConfiguration); - - -var request = new FakemultipleresponsebodiesGet.GetRequestBuilder().build(); - -FakemultipleresponsebodiesGetResponses.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; -} -if (response instanceof FakemultipleresponsebodiesGetResponses.EndpointFakemultipleresponsebodiesGetCode200Response castResponse) { - FakemultipleresponsebodiesGetCode200Response.ApplicationjsonResponseBody deserializedBody = (FakemultipleresponsebodiesGetCode200Response.ApplicationjsonResponseBody) castResponse.body; - // handle deserialized body here -} else { - FakemultipleresponsebodiesGetResponses.EndpointFakemultipleresponsebodiesGetCode202Response castResponse = (FakemultipleresponsebodiesGetResponses.EndpointFakemultipleresponsebodiesGetCode202Response) response; - FakemultipleresponsebodiesGetCode202Response.ApplicationjsonResponseBody deserializedBody = (FakemultipleresponsebodiesGetCode202Response.ApplicationjsonResponseBody) castResponse.body; - // handle deserialized body here -} -``` -### responseWithoutSchema -public [FakeresponsewithoutschemaGetResponses.EndpointResponse](../../paths/fakeresponsewithoutschema/get/FakeresponsewithoutschemaGetResponses.md#endpointresponse) responseWithoutSchema([FakeresponsewithoutschemaGet.GetRequest](../../paths/fakeresponsewithoutschema/FakeresponsewithoutschemaGet.md#getrequest) request) - -**Parameters:**
-request - the input request - -**Returns:**
-the deserialized response - -**Throws:**
-IOException, InterruptedException - an exception happened when making the request
-ValidationException - the returned response body or header values do not conform the the schema validation requirements
-NotImplementedException - the request body serialization or deserialization has not yet been implemented
- or the header content type deserialization has not yet been implemented for this contentType
-ApiException - server returned a response/contentType not defined in the openapi document
- -#### 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.servers.RootServer0; -import org.openapijsonschematools.client.servers.RootServer1; -import org.openapijsonschematools.client.servers.RootServer2; -import org.openapijsonschematools.client.paths.fakeresponsewithoutschema.get.responses.FakeresponsewithoutschemaGetCode200Response; -import org.openapijsonschematools.client.servers.RootServerInfo; -import org.openapijsonschematools.client.apis.tags.Fake; -import org.openapijsonschematools.client.paths.fakeresponsewithoutschema.get.FakeresponsewithoutschemaGetResponses; - -import java.io.IOException; -import java.util.Arrays; -import java.util.List; -import java.util.Map; -import java.util.AbstractMap; - -// if you want to use a server that is not SERVER_0 pass it in here and change the ServerIndex input below -ApiConfiguration.ServerInfo serverInfo = new ApiConfiguration.ServerInfoBuilder() - .rootServerInfo( - new RootServerInfo.RootServerInfoBuilder() - .rootServer0(new RootServer0()) - .build() - ) - .build(); -ApiConfiguration.ServerIndexInfo serverIndexInfo = new ApiConfiguration.ServerIndexInfoBuilder() - .rootServerInfoServerIndex(RootServerInfo.ServerIndex.SERVER_0) - .build(); -Duration timeout = Duration.ofSeconds(1L); -Map> defaultHeaders = Map.of("User-Agent", List.of("OpenAPI-JSON-Schema-Generator/1.0.0/java")); -ApiConfiguration apiConfiguration = new ApiConfiguration( - serverInfo - serverIndexInfo, - timeout, - defaultHeaders -); -SchemaConfiguration schemaConfiguration = new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().build()); -Fake apiClient = new Fake(apiConfiguration, schemaConfiguration); - - -var request = new FakeresponsewithoutschemaGet.GetRequestBuilder().build(); - -FakeresponsewithoutschemaGetResponses.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; -} -FakeresponsewithoutschemaGetResponses.EndpointFakeresponsewithoutschemaGetCode200Response castResponse = (FakeresponsewithoutschemaGetResponses.EndpointFakeresponsewithoutschemaGetCode200Response) response; -``` -### multipleRequestBodyContentTypes -public [FakemultiplerequestbodycontenttypesPostResponses.EndpointResponse](../../paths/fakemultiplerequestbodycontenttypes/post/FakemultiplerequestbodycontenttypesPostResponses.md#endpointresponse) multipleRequestBodyContentTypes([FakemultiplerequestbodycontenttypesPost.PostRequest](../../paths/fakemultiplerequestbodycontenttypes/FakemultiplerequestbodycontenttypesPost.md#postrequest) request) - -composed schemas at inline locations + multiple requestBody content types - -**Parameters:**
-request - the input request - -**Returns:**
-the deserialized response - -**Throws:**
-IOException, InterruptedException - an exception happened when making the request
-ValidationException - the returned response body or header values do not conform the the schema validation requirements
-NotImplementedException - the request body serialization or deserialization has not yet been implemented
- or the header content type deserialization has not yet been implemented for this contentType
-ApiException - server returned a response/contentType not defined in the openapi document
- -#### 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.FakemultiplerequestbodycontenttypesPostRequestBody; -import org.openapijsonschematools.client.paths.fakemultiplerequestbodycontenttypes.post.requestbody.content.applicationjson.ApplicationjsonSchema; -import org.openapijsonschematools.client.RootServerInfo; -import org.openapijsonschematools.client.servers.RootServer0; -import org.openapijsonschematools.client.servers.RootServer1; -import org.openapijsonschematools.client.servers.RootServer2; -import org.openapijsonschematools.client.paths.fakemultiplerequestbodycontenttypes.post.responses.FakemultiplerequestbodycontenttypesPostCode200Response; -import org.openapijsonschematools.client.servers.RootServerInfo; -import org.openapijsonschematools.client.apis.tags.Fake; -import org.openapijsonschematools.client.paths.fakemultiplerequestbodycontenttypes.post.FakemultiplerequestbodycontenttypesPostResponses; - -import java.io.IOException; -import java.util.Arrays; -import java.util.List; -import java.util.Map; -import java.util.AbstractMap; - -// if you want to use a server that is not SERVER_0 pass it in here and change the ServerIndex input below -ApiConfiguration.ServerInfo serverInfo = new ApiConfiguration.ServerInfoBuilder() - .rootServerInfo( - new RootServerInfo.RootServerInfoBuilder() - .rootServer0(new RootServer0()) - .build() - ) - .build(); -ApiConfiguration.ServerIndexInfo serverIndexInfo = new ApiConfiguration.ServerIndexInfoBuilder() - .rootServerInfoServerIndex(RootServerInfo.ServerIndex.SERVER_0) - .build(); -Duration timeout = Duration.ofSeconds(1L); -Map> defaultHeaders = Map.of("User-Agent", List.of("OpenAPI-JSON-Schema-Generator/1.0.0/java")); -ApiConfiguration apiConfiguration = new ApiConfiguration( - serverInfo - serverIndexInfo, - timeout, - defaultHeaders -); -SchemaConfiguration schemaConfiguration = new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().build()); -Fake apiClient = new Fake(apiConfiguration, schemaConfiguration); - - -var request = new FakemultiplerequestbodycontenttypesPost.PostRequestBuilder().build(); - -FakemultiplerequestbodycontenttypesPostResponses.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; -} -FakemultiplerequestbodycontenttypesPostResponses.EndpointFakemultiplerequestbodycontenttypesPostCode200Response castResponse = (FakemultiplerequestbodycontenttypesPostResponses.EndpointFakemultiplerequestbodycontenttypesPostCode200Response) response; -FakemultiplerequestbodycontenttypesPostCode200Response.ApplicationjsonResponseBody deserializedBody = (FakemultiplerequestbodycontenttypesPostCode200Response.ApplicationjsonResponseBody) castResponse.body; -// handle deserialized body here -``` -### uploadDownloadFile -public [FakeuploaddownloadfilePostResponses.EndpointResponse](../../paths/fakeuploaddownloadfile/post/FakeuploaddownloadfilePostResponses.md#endpointresponse) uploadDownloadFile([FakeuploaddownloadfilePost.PostRequest](../../paths/fakeuploaddownloadfile/FakeuploaddownloadfilePost.md#postrequest) request) - - - -**Parameters:**
-request - the input request - -**Returns:**
-the deserialized response - -**Throws:**
-IOException, InterruptedException - an exception happened when making the request
-ValidationException - the returned response body or header values do not conform the the schema validation requirements
-NotImplementedException - the request body serialization or deserialization has not yet been implemented
- or the header content type deserialization has not yet been implemented for this contentType
-ApiException - server returned a response/contentType not defined in the openapi document
- -#### 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.fakeuploaddownloadfile.post.FakeuploaddownloadfilePostRequestBody; -import org.openapijsonschematools.client.paths.fakeuploaddownloadfile.post.requestbody.content.applicationoctetstream.ApplicationoctetstreamSchema; -import org.openapijsonschematools.client.servers.RootServer0; -import org.openapijsonschematools.client.servers.RootServer1; -import org.openapijsonschematools.client.servers.RootServer2; -import org.openapijsonschematools.client.paths.fakeuploaddownloadfile.post.responses.FakeuploaddownloadfilePostCode200Response; -import org.openapijsonschematools.client.servers.RootServerInfo; -import org.openapijsonschematools.client.apis.tags.Fake; -import org.openapijsonschematools.client.paths.fakeuploaddownloadfile.post.FakeuploaddownloadfilePostResponses; - -import java.io.IOException; -import java.util.Arrays; -import java.util.List; -import java.util.Map; -import java.util.AbstractMap; - -// if you want to use a server that is not SERVER_0 pass it in here and change the ServerIndex input below -ApiConfiguration.ServerInfo serverInfo = new ApiConfiguration.ServerInfoBuilder() - .rootServerInfo( - new RootServerInfo.RootServerInfoBuilder() - .rootServer0(new RootServer0()) - .build() - ) - .build(); -ApiConfiguration.ServerIndexInfo serverIndexInfo = new ApiConfiguration.ServerIndexInfoBuilder() - .rootServerInfoServerIndex(RootServerInfo.ServerIndex.SERVER_0) - .build(); -Duration timeout = Duration.ofSeconds(1L); -Map> defaultHeaders = Map.of("User-Agent", List.of("OpenAPI-JSON-Schema-Generator/1.0.0/java")); -ApiConfiguration apiConfiguration = new ApiConfiguration( - serverInfo - serverIndexInfo, - timeout, - defaultHeaders -); -SchemaConfiguration schemaConfiguration = new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().build()); -Fake apiClient = new Fake(apiConfiguration, schemaConfiguration); - - -ApplicationoctetstreamSchema1BoxedString requestBodyPayload = ApplicationoctetstreamSchema.ApplicationoctetstreamSchema1.validateAndBox( - "a", - schemaConfiguration -); -FakeuploaddownloadfilePost.SealedRequestBody requestBody = new FakeuploaddownloadfilePost.ApplicationoctetstreamRequestBody(requestBodyPayload); - -var request = new FakeuploaddownloadfilePost.PostRequestBuilder() - .requestBody(requestBody) - .build(); - -FakeuploaddownloadfilePostResponses.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; -} -FakeuploaddownloadfilePostResponses.EndpointFakeuploaddownloadfilePostCode200Response castResponse = (FakeuploaddownloadfilePostResponses.EndpointFakeuploaddownloadfilePostCode200Response) response; -FakeuploaddownloadfilePostCode200Response.ApplicationoctetstreamResponseBody deserializedBody = (FakeuploaddownloadfilePostCode200Response.ApplicationoctetstreamResponseBody) castResponse.body; -// handle deserialized body here -``` -### uploadFiles -public [FakeuploadfilesPostResponses.EndpointResponse](../../paths/fakeuploadfiles/post/FakeuploadfilesPostResponses.md#endpointresponse) uploadFiles([FakeuploadfilesPost.PostRequest](../../paths/fakeuploadfiles/FakeuploadfilesPost.md#postrequest) request) - - - -**Parameters:**
-request - the input request - -**Returns:**
-the deserialized response - -**Throws:**
-IOException, InterruptedException - an exception happened when making the request
-ValidationException - the returned response body or header values do not conform the the schema validation requirements
-NotImplementedException - the request body serialization or deserialization has not yet been implemented
- or the header content type deserialization has not yet been implemented for this contentType
-ApiException - server returned a response/contentType not defined in the openapi document
- -#### 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.FakeuploadfilesPostRequestBody; -import org.openapijsonschematools.client.paths.fakeuploadfiles.post.requestbody.content.multipartformdata.MultipartformdataSchema; -import org.openapijsonschematools.client.RootServerInfo; -import org.openapijsonschematools.client.servers.RootServer0; -import org.openapijsonschematools.client.servers.RootServer1; -import org.openapijsonschematools.client.servers.RootServer2; -import org.openapijsonschematools.client.paths.fakeuploadfiles.post.responses.FakeuploadfilesPostCode200Response; -import org.openapijsonschematools.client.servers.RootServerInfo; -import org.openapijsonschematools.client.apis.tags.Fake; -import org.openapijsonschematools.client.paths.fakeuploadfiles.post.FakeuploadfilesPostResponses; - -import java.io.IOException; -import java.util.Arrays; -import java.util.List; -import java.util.Map; -import java.util.AbstractMap; - -// if you want to use a server that is not SERVER_0 pass it in here and change the ServerIndex input below -ApiConfiguration.ServerInfo serverInfo = new ApiConfiguration.ServerInfoBuilder() - .rootServerInfo( - new RootServerInfo.RootServerInfoBuilder() - .rootServer0(new RootServer0()) - .build() - ) - .build(); -ApiConfiguration.ServerIndexInfo serverIndexInfo = new ApiConfiguration.ServerIndexInfoBuilder() - .rootServerInfoServerIndex(RootServerInfo.ServerIndex.SERVER_0) - .build(); -Duration timeout = Duration.ofSeconds(1L); -Map> defaultHeaders = Map.of("User-Agent", List.of("OpenAPI-JSON-Schema-Generator/1.0.0/java")); -ApiConfiguration apiConfiguration = new ApiConfiguration( - serverInfo - serverIndexInfo, - timeout, - defaultHeaders -); -SchemaConfiguration schemaConfiguration = new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().build()); -Fake apiClient = new Fake(apiConfiguration, schemaConfiguration); - - -var request = new FakeuploadfilesPost.PostRequestBuilder().build(); - -FakeuploadfilesPostResponses.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; -} -FakeuploadfilesPostResponses.EndpointFakeuploadfilesPostCode200Response castResponse = (FakeuploadfilesPostResponses.EndpointFakeuploadfilesPostCode200Response) response; -FakeuploadfilesPostCode200Response.ApplicationjsonResponseBody deserializedBody = (FakeuploadfilesPostCode200Response.ApplicationjsonResponseBody) castResponse.body; -// handle deserialized body here -``` -### additionalPropertiesWithArrayOfEnums -public [FakeadditionalpropertieswitharrayofenumsGetResponses.EndpointResponse](../../paths/fakeadditionalpropertieswitharrayofenums/get/FakeadditionalpropertieswitharrayofenumsGetResponses.md#endpointresponse) additionalPropertiesWithArrayOfEnums([FakeadditionalpropertieswitharrayofenumsGet.GetRequest](../../paths/fakeadditionalpropertieswitharrayofenums/FakeadditionalpropertieswitharrayofenumsGet.md#getrequest) request) - -**Parameters:**
-request - the input request - -**Returns:**
-the deserialized response - -**Throws:**
-IOException, InterruptedException - an exception happened when making the request
-ValidationException - the returned response body or header values do not conform the the schema validation requirements
-NotImplementedException - the request body serialization or deserialization has not yet been implemented
- or the header content type deserialization has not yet been implemented for this contentType
-ApiException - server returned a response/contentType not defined in the openapi document
- -#### 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.fakeadditionalpropertieswitharrayofenums.get.FakeadditionalpropertieswitharrayofenumsGetRequestBody; -import org.openapijsonschematools.client.components.schemas.AdditionalPropertiesWithArrayOfEnums; -import org.openapijsonschematools.client.RootServerInfo; -import org.openapijsonschematools.client.servers.RootServer0; -import org.openapijsonschematools.client.servers.RootServer1; -import org.openapijsonschematools.client.servers.RootServer2; -import org.openapijsonschematools.client.paths.fakeadditionalpropertieswitharrayofenums.get.responses.FakeadditionalpropertieswitharrayofenumsGetCode200Response; -import org.openapijsonschematools.client.servers.RootServerInfo; -import org.openapijsonschematools.client.apis.tags.Fake; -import org.openapijsonschematools.client.paths.fakeadditionalpropertieswitharrayofenums.get.FakeadditionalpropertieswitharrayofenumsGetResponses; - -import java.io.IOException; -import java.util.Arrays; -import java.util.List; -import java.util.Map; -import java.util.AbstractMap; - -// if you want to use a server that is not SERVER_0 pass it in here and change the ServerIndex input below -ApiConfiguration.ServerInfo serverInfo = new ApiConfiguration.ServerInfoBuilder() - .rootServerInfo( - new RootServerInfo.RootServerInfoBuilder() - .rootServer0(new RootServer0()) - .build() - ) - .build(); -ApiConfiguration.ServerIndexInfo serverIndexInfo = new ApiConfiguration.ServerIndexInfoBuilder() - .rootServerInfoServerIndex(RootServerInfo.ServerIndex.SERVER_0) - .build(); -Duration timeout = Duration.ofSeconds(1L); -Map> defaultHeaders = Map.of("User-Agent", List.of("OpenAPI-JSON-Schema-Generator/1.0.0/java")); -ApiConfiguration apiConfiguration = new ApiConfiguration( - serverInfo - serverIndexInfo, - timeout, - defaultHeaders -); -SchemaConfiguration schemaConfiguration = new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().build()); -Fake apiClient = new Fake(apiConfiguration, schemaConfiguration); - - -var request = new FakeadditionalpropertieswitharrayofenumsGet.GetRequestBuilder().build(); - -FakeadditionalpropertieswitharrayofenumsGetResponses.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; -} -FakeadditionalpropertieswitharrayofenumsGetResponses.EndpointFakeadditionalpropertieswitharrayofenumsGetCode200Response castResponse = (FakeadditionalpropertieswitharrayofenumsGetResponses.EndpointFakeadditionalpropertieswitharrayofenumsGetCode200Response) response; -FakeadditionalpropertieswitharrayofenumsGetCode200Response.ApplicationjsonResponseBody deserializedBody = (FakeadditionalpropertieswitharrayofenumsGetCode200Response.ApplicationjsonResponseBody) castResponse.body; -// handle deserialized body here -``` -### deleteCoffee -public [FakedeletecoffeeidDeleteResponses.EndpointResponse](../../paths/fakedeletecoffeeid/delete/FakedeletecoffeeidDeleteResponses.md#endpointresponse) deleteCoffee([FakedeletecoffeeidDelete.DeleteRequest](../../paths/fakedeletecoffeeid/FakedeletecoffeeidDelete.md#deleterequest) request) - -Delete the coffee identified by the given id, (delete without request body) - -**Parameters:**
-request - the input request - -**Returns:**
-the deserialized response - -**Throws:**
-IOException, InterruptedException - an exception happened when making the request
-ValidationException - the returned response body or header values do not conform the the schema validation requirements
-NotImplementedException - the request body serialization or deserialization has not yet been implemented
- or the header content type deserialization has not yet been implemented for this contentType
-ApiException - server returned a response/contentType not defined in the openapi document
- -#### 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.FakedeletecoffeeidDeletePathParameters; -import org.openapijsonschematools.client.servers.RootServer0; -import org.openapijsonschematools.client.servers.RootServer1; -import org.openapijsonschematools.client.servers.RootServer2; -import org.openapijsonschematools.client.paths.fakedeletecoffeeid.delete.responses.FakedeletecoffeeidDeleteCode200Response; -import org.openapijsonschematools.client.paths.fakedeletecoffeeid.delete.responses.FakedeletecoffeeidDeleteCodedefaultResponse; -import org.openapijsonschematools.client.servers.RootServerInfo; -import org.openapijsonschematools.client.apis.tags.Fake; -import org.openapijsonschematools.client.paths.fakedeletecoffeeid.delete.FakedeletecoffeeidDeleteResponses; - -import java.io.IOException; -import java.util.Arrays; -import java.util.List; -import java.util.Map; -import java.util.AbstractMap; - -// if you want to use a server that is not SERVER_0 pass it in here and change the ServerIndex input below -ApiConfiguration.ServerInfo serverInfo = new ApiConfiguration.ServerInfoBuilder() - .rootServerInfo( - new RootServerInfo.RootServerInfoBuilder() - .rootServer0(new RootServer0()) - .build() - ) - .build(); -ApiConfiguration.ServerIndexInfo serverIndexInfo = new ApiConfiguration.ServerIndexInfoBuilder() - .rootServerInfoServerIndex(RootServerInfo.ServerIndex.SERVER_0) - .build(); -Duration timeout = Duration.ofSeconds(1L); -Map> defaultHeaders = Map.of("User-Agent", List.of("OpenAPI-JSON-Schema-Generator/1.0.0/java")); -ApiConfiguration apiConfiguration = new ApiConfiguration( - serverInfo - serverIndexInfo, - timeout, - defaultHeaders -); -SchemaConfiguration schemaConfiguration = new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().build()); -Fake apiClient = new Fake(apiConfiguration, schemaConfiguration); - - -// Map validation -FakedeletecoffeeidDeletePathParameters.PathParametersMap pathParameters = - FakedeletecoffeeidDeletePathParameters.FakedeletecoffeeidDeletePathParameters1.validate( - new FakedeletecoffeeidDeletePathParameters.PathParametersMapBuilder() - .id("a") - - .build(), - schemaConfiguration -); - -var request = new FakedeletecoffeeidDelete.DeleteRequestBuilder() - .pathParameters(pathParameters) - .build(); - -FakedeletecoffeeidDeleteResponses.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 FakedeletecoffeeidDeleteResponses.EndpointFakedeletecoffeeidDeleteCode200Response castResponse) { -} else { - FakedeletecoffeeidDeleteResponses.EndpointFakedeletecoffeeidDeleteCodedefaultResponse castResponse = (FakedeletecoffeeidDeleteResponses.EndpointFakedeletecoffeeidDeleteCodedefaultResponse) response; -} -``` -[[Back to top]](#top) [[Back to README]](../../../README.md) diff --git a/samples/client/petstore/kotlin/docs/apis/tags/Fakeclassnametags123.md b/samples/client/petstore/kotlin/docs/apis/tags/Fakeclassnametags123.md deleted file mode 100644 index 1fd6a698f2c..00000000000 --- a/samples/client/petstore/kotlin/docs/apis/tags/Fakeclassnametags123.md +++ /dev/null @@ -1,131 +0,0 @@ -# Fakeclassnametags123 - -public class Fakeclassnametags123 extends extends ApiClient implements -[FakeclassnametestPatch.ClassnameOperation](../../paths/fakeclassnametest/FakeclassnametestPatch.md#classnameoperation) - -an api client class which contains all the routes for tag="fake_classname_tags 123#$%^" - -## Method Summary -| Modifier and Type | Method and Description | -| ----------------- | ---------------------- | -| [FakeclassnametestPatchResponses.EndpointResponse](../../paths/fakeclassnametest/patch/FakeclassnametestPatchResponses.md#endpointresponse) | [classname](#classname)([FakeclassnametestPatch.PatchRequest](../../paths/fakeclassnametest/FakeclassnametestPatch.md#patchrequest) request)
To test class name in snake case | - -## Method Detail - -### classname -public [FakeclassnametestPatchResponses.EndpointResponse](../../paths/fakeclassnametest/patch/FakeclassnametestPatchResponses.md#endpointresponse) classname([FakeclassnametestPatch.PatchRequest](../../paths/fakeclassnametest/FakeclassnametestPatch.md#patchrequest) request) - -To test class name in snake case - -**Parameters:**
-request - the input request - -**Returns:**
-the deserialized response - -**Throws:**
-IOException, InterruptedException - an exception happened when making the request
-ValidationException - the returned response body or header values do not conform the the schema validation requirements
-NotImplementedException - the request body serialization or deserialization has not yet been implemented
- or the header content type deserialization has not yet been implemented for this contentType
-ApiException - server returned a response/contentType not defined in the openapi document
- -#### 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.fakeclassnametest.patch.FakeclassnametestPatchSecurityInfo; -import org.openapijsonschematools.client.paths.fakeclassnametest.patch.FakeclassnametestPatchRequestBody; -import org.openapijsonschematools.client.components.schemas.Client; -import org.openapijsonschematools.client.servers.RootServer0; -import org.openapijsonschematools.client.servers.RootServer1; -import org.openapijsonschematools.client.servers.RootServer2; -import org.openapijsonschematools.client.securityschemes.SecurityScheme; -import org.openapijsonschematools.client.components.securityschemes.ApiKeyQuery; -import org.openapijsonschematools.client.paths.fakeclassnametest.patch.responses.FakeclassnametestPatchCode200Response; -import org.openapijsonschematools.client.servers.RootServerInfo; -import org.openapijsonschematools.client.apis.tags.Fakeclassnametags123; -import org.openapijsonschematools.client.paths.fakeclassnametest.patch.FakeclassnametestPatchResponses; - -import java.io.IOException; -import java.util.Arrays; -import java.util.List; -import java.util.Map; -import java.util.AbstractMap; - -// if you want to use a server that is not SERVER_0 pass it in here and change the ServerIndex input below -ApiConfiguration.ServerInfo serverInfo = new ApiConfiguration.ServerInfoBuilder() - .rootServerInfo( - new RootServerInfo.RootServerInfoBuilder() - .rootServer0(new RootServer0()) - .build() - ) - .build(); -ApiConfiguration.ServerIndexInfo serverIndexInfo = new ApiConfiguration.ServerIndexInfoBuilder() - .rootServerInfoServerIndex(RootServerInfo.ServerIndex.SERVER_0) - .build(); -List securitySchemes = new ArrayList(); -securitySchemes.add( - new ApiKeyQuery("someApiKey"); -); -ApiConfiguration.SecurityIndexInfo securityIndexInfo = new ApiConfiguration.SecurityIndexInfoBuilder() - .fakeclassnametestPatchSecurityRequirementObject0SecurityIndex(FakeclassnametestPatchSecurityRequirementObject0.SecurityIndex.SECURITY_0) - .build(); -Duration timeout = Duration.ofSeconds(1L); -Map> defaultHeaders = Map.of("User-Agent", List.of("OpenAPI-JSON-Schema-Generator/1.0.0/java")); -ApiConfiguration apiConfiguration = new ApiConfiguration( - serverInfo - serverIndexInfo, - securitySchemes, - securityIndexInfo, - timeout, - defaultHeaders -); -SchemaConfiguration schemaConfiguration = new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().build()); -Fakeclassnametags123 apiClient = new Fakeclassnametags123(apiConfiguration, schemaConfiguration); - - -Client1BoxedMap requestBodyPayload = - Client.Client1.validateAndBox( - new Client.ClientMapBuilder1() - .client("a") - - .build(), - schemaConfiguration -); -FakeclassnametestPatchRequestBody.SealedRequestBody requestBody = new FakeclassnametestPatchRequestBody.ApplicationjsonRequestBody(requestBodyPayload); - -var request = new FakeclassnametestPatch.PatchRequestBuilder() - .requestBody(requestBody) - .build(); - -FakeclassnametestPatchResponses.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; -} -FakeclassnametestPatchResponses.EndpointFakeclassnametestPatchCode200Response castResponse = (FakeclassnametestPatchResponses.EndpointFakeclassnametestPatchCode200Response) response; -FakeclassnametestPatchCode200Response.ApplicationjsonResponseBody deserializedBody = (FakeclassnametestPatchCode200Response.ApplicationjsonResponseBody) castResponse.body; -// handle deserialized body here -``` -[[Back to top]](#top) [[Back to README]](../../../README.md) diff --git a/samples/client/petstore/kotlin/docs/apis/tags/Pet.md b/samples/client/petstore/kotlin/docs/apis/tags/Pet.md deleted file mode 100644 index f43971759f6..00000000000 --- a/samples/client/petstore/kotlin/docs/apis/tags/Pet.md +++ /dev/null @@ -1,1155 +0,0 @@ -# Pet - -public class Pet extends extends ApiClient implements -[FakepetiduploadimagewithrequiredfilePost.UploadFileWithRequiredFileOperation](../../paths/fakepetiduploadimagewithrequiredfile/FakepetiduploadimagewithrequiredfilePost.md#uploadfilewithrequiredfileoperation), -[PetPost.AddPetOperation](../../paths/pet/PetPost.md#addpetoperation), -[PetPut.UpdatePetOperation](../../paths/pet/PetPut.md#updatepetoperation), -[PetfindbytagsGet.FindPetsByTagsOperation](../../paths/petfindbytags/PetfindbytagsGet.md#findpetsbytagsoperation), -[PetfindbystatusGet.FindPetsByStatusOperation](../../paths/petfindbystatus/PetfindbystatusGet.md#findpetsbystatusoperation), -[PetpetiduploadimagePost.UploadImageOperation](../../paths/petpetiduploadimage/PetpetiduploadimagePost.md#uploadimageoperation), -[PetpetidDelete.DeletePetOperation](../../paths/petpetid/PetpetidDelete.md#deletepetoperation), -[PetpetidGet.GetPetByIdOperation](../../paths/petpetid/PetpetidGet.md#getpetbyidoperation), -[PetpetidPost.UpdatePetWithFormOperation](../../paths/petpetid/PetpetidPost.md#updatepetwithformoperation) - -an api client class which contains all the routes for tag="pet" -Everything about your Pets - -## Method Summary -| Modifier and Type | Method and Description | -| ----------------- | ---------------------- | -| [FakepetiduploadimagewithrequiredfilePostResponses.EndpointResponse](../../paths/fakepetiduploadimagewithrequiredfile/post/FakepetiduploadimagewithrequiredfilePostResponses.md#endpointresponse) | [uploadFileWithRequiredFile](#uploadfilewithrequiredfile)([FakepetiduploadimagewithrequiredfilePost.PostRequest](../../paths/fakepetiduploadimagewithrequiredfile/FakepetiduploadimagewithrequiredfilePost.md#postrequest) request)
| -| [PetPostResponses.EndpointResponse](../../paths/pet/post/PetPostResponses.md#endpointresponse) | [addPet](#addpet)([PetPost.PostRequest](../../paths/pet/PetPost.md#postrequest) request)
Add a new pet to the store | -| Nothing? | [updatePet](#updatepet)([PetPut.PutRequest](../../paths/pet/PetPut.md#putrequest) request)
| -| [PetfindbytagsGetResponses.EndpointResponse](../../paths/petfindbytags/get/PetfindbytagsGetResponses.md#endpointresponse) | [findPetsByTags](#findpetsbytags)([PetfindbytagsGet.GetRequest](../../paths/petfindbytags/PetfindbytagsGet.md#getrequest) request)
Multiple tags can be provided with comma separated strings. Use tag1, tag2, tag3 for testing. | -| [PetfindbystatusGetResponses.EndpointResponse](../../paths/petfindbystatus/get/PetfindbystatusGetResponses.md#endpointresponse) | [findPetsByStatus](#findpetsbystatus)([PetfindbystatusGet.GetRequest](../../paths/petfindbystatus/PetfindbystatusGet.md#getrequest) request)
Multiple status values can be provided with comma separated strings | -| [PetpetiduploadimagePostResponses.EndpointResponse](../../paths/petpetiduploadimage/post/PetpetiduploadimagePostResponses.md#endpointresponse) | [uploadImage](#uploadimage)([PetpetiduploadimagePost.PostRequest](../../paths/petpetiduploadimage/PetpetiduploadimagePost.md#postrequest) request)
| -| Nothing? | [deletePet](#deletepet)([PetpetidDelete.DeleteRequest](../../paths/petpetid/PetpetidDelete.md#deleterequest) request)
| -| [PetpetidGetResponses.EndpointResponse](../../paths/petpetid/get/PetpetidGetResponses.md#endpointresponse) | [getPetById](#getpetbyid)([PetpetidGet.GetRequest](../../paths/petpetid/PetpetidGet.md#getrequest) request)
Returns a single pet | -| Nothing? | [updatePetWithForm](#updatepetwithform)([PetpetidPost.PostRequest](../../paths/petpetid/PetpetidPost.md#postrequest) request)
| - -## Method Detail - -### uploadFileWithRequiredFile -public [FakepetiduploadimagewithrequiredfilePostResponses.EndpointResponse](../../paths/fakepetiduploadimagewithrequiredfile/post/FakepetiduploadimagewithrequiredfilePostResponses.md#endpointresponse) uploadFileWithRequiredFile([FakepetiduploadimagewithrequiredfilePost.PostRequest](../../paths/fakepetiduploadimagewithrequiredfile/FakepetiduploadimagewithrequiredfilePost.md#postrequest) request) - - - -**Parameters:**
-request - the input request - -**Returns:**
-the deserialized response - -**Throws:**
-IOException, InterruptedException - an exception happened when making the request
-ValidationException - the returned response body or header values do not conform the the schema validation requirements
-NotImplementedException - the request body serialization or deserialization has not yet been implemented
- or the header content type deserialization has not yet been implemented for this contentType
-ApiException - server returned a response/contentType not defined in the openapi document
- -#### 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.FakepetiduploadimagewithrequiredfilePostRequestBody; -import org.openapijsonschematools.client.RootServerInfo; -import org.openapijsonschematools.client.paths.fakepetiduploadimagewithrequiredfile.post.FakepetiduploadimagewithrequiredfilePostSecurityInfo; -import org.openapijsonschematools.client.paths.fakepetiduploadimagewithrequiredfile.post.FakepetiduploadimagewithrequiredfilePostPathParameters; -import org.openapijsonschematools.client.servers.RootServer0; -import org.openapijsonschematools.client.servers.RootServer1; -import org.openapijsonschematools.client.servers.RootServer2; -import org.openapijsonschematools.client.securityschemes.SecurityScheme; -import org.openapijsonschematools.client.components.securityschemes.PetstoreAuth; -import org.openapijsonschematools.client.paths.fakepetiduploadimagewithrequiredfile.post.responses.FakepetiduploadimagewithrequiredfilePostCode200Response; -import org.openapijsonschematools.client.servers.RootServerInfo; -import org.openapijsonschematools.client.apis.tags.Pet; -import org.openapijsonschematools.client.paths.fakepetiduploadimagewithrequiredfile.post.FakepetiduploadimagewithrequiredfilePostResponses; - -import java.io.IOException; -import java.util.Arrays; -import java.util.List; -import java.util.Map; -import java.util.AbstractMap; - -// if you want to use a server that is not SERVER_0 pass it in here and change the ServerIndex input below -ApiConfiguration.ServerInfo serverInfo = new ApiConfiguration.ServerInfoBuilder() - .rootServerInfo( - new RootServerInfo.RootServerInfoBuilder() - .rootServer0(new RootServer0()) - .build() - ) - .build(); -ApiConfiguration.ServerIndexInfo serverIndexInfo = new ApiConfiguration.ServerIndexInfoBuilder() - .rootServerInfoServerIndex(RootServerInfo.ServerIndex.SERVER_0) - .build(); -List securitySchemes = new ArrayList(); -ApiConfiguration.SecurityIndexInfo securityIndexInfo = new ApiConfiguration.SecurityIndexInfoBuilder() - .fakepetiduploadimagewithrequiredfilePostSecurityRequirementObject0SecurityIndex(FakepetiduploadimagewithrequiredfilePostSecurityRequirementObject0.SecurityIndex.SECURITY_0) - .build(); -Duration timeout = Duration.ofSeconds(1L); -Map> defaultHeaders = Map.of("User-Agent", List.of("OpenAPI-JSON-Schema-Generator/1.0.0/java")); -ApiConfiguration apiConfiguration = new ApiConfiguration( - serverInfo - serverIndexInfo, - securitySchemes, - securityIndexInfo, - timeout, - defaultHeaders -); -SchemaConfiguration schemaConfiguration = new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().build()); -Pet apiClient = new Pet(apiConfiguration, schemaConfiguration); - - -// Map validation -FakepetiduploadimagewithrequiredfilePostPathParameters.PathParametersMap pathParameters = - FakepetiduploadimagewithrequiredfilePostPathParameters.FakepetiduploadimagewithrequiredfilePostPathParameters1.validate( - new FakepetiduploadimagewithrequiredfilePostPathParameters.PathParametersMapBuilder() - .petId(1L) - - .build(), - schemaConfiguration -); - -var request = new FakepetiduploadimagewithrequiredfilePost.PostRequestBuilder() - .pathParameters(pathParameters) - .build(); - -FakepetiduploadimagewithrequiredfilePostResponses.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; -} -FakepetiduploadimagewithrequiredfilePostResponses.EndpointFakepetiduploadimagewithrequiredfilePostCode200Response castResponse = (FakepetiduploadimagewithrequiredfilePostResponses.EndpointFakepetiduploadimagewithrequiredfilePostCode200Response) response; -FakepetiduploadimagewithrequiredfilePostCode200Response.ApplicationjsonResponseBody deserializedBody = (FakepetiduploadimagewithrequiredfilePostCode200Response.ApplicationjsonResponseBody) castResponse.body; -// handle deserialized body here -``` -### addPet -public [PetPostResponses.EndpointResponse](../../paths/pet/post/PetPostResponses.md#endpointresponse) addPet([PetPost.PostRequest](../../paths/pet/PetPost.md#postrequest) request) - -Add a new pet to the store - -**Parameters:**
-request - the input request - -**Returns:**
-the deserialized response - -**Throws:**
-IOException, InterruptedException - an exception happened when making the request
-ValidationException - the returned response body or header values do not conform the the schema validation requirements
-NotImplementedException - the request body serialization or deserialization has not yet been implemented
- or the header content type deserialization has not yet been implemented for this contentType
-ApiException - server returned a response/contentType not defined in the openapi document
- -#### 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.PetPostRequestBody; -import org.openapijsonschematools.client.components.schemas.Pet; -import org.openapijsonschematools.client.servers.RootServer0; -import org.openapijsonschematools.client.servers.RootServer1; -import org.openapijsonschematools.client.servers.RootServer2; -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.PetPostCode200Response; -import org.openapijsonschematools.client.paths.pet.post.responses.PetPostCode405Response; -import org.openapijsonschematools.client.servers.RootServerInfo; -import org.openapijsonschematools.client.apis.tags.Pet; -import org.openapijsonschematools.client.paths.pet.post.PetPostResponses; - -import java.io.IOException; -import java.util.Arrays; -import java.util.List; -import java.util.Map; -import java.util.AbstractMap; - -// if you want to use a server that is not SERVER_0 pass it in here and change the ServerIndex input below -ApiConfiguration.ServerInfo serverInfo = new ApiConfiguration.ServerInfoBuilder() - .rootServerInfo( - new RootServerInfo.RootServerInfoBuilder() - .rootServer0(new RootServer0()) - .build() - ) - .build(); -ApiConfiguration.ServerIndexInfo serverIndexInfo = new ApiConfiguration.ServerIndexInfoBuilder() - .rootServerInfoServerIndex(RootServerInfo.ServerIndex.SERVER_0) - .build(); -List securitySchemes = new ArrayList(); -securitySchemes.add( - new ApiKey("someApiKey"); -); -ApiConfiguration.SecurityIndexInfo securityIndexInfo = new ApiConfiguration.SecurityIndexInfoBuilder() - .petPostSecurityRequirementObject0SecurityIndex(PetPostSecurityRequirementObject0.SecurityIndex.SECURITY_0) - .build(); -Duration timeout = Duration.ofSeconds(1L); -Map> defaultHeaders = Map.of("User-Agent", List.of("OpenAPI-JSON-Schema-Generator/1.0.0/java")); -ApiConfiguration apiConfiguration = new ApiConfiguration( - serverInfo - serverIndexInfo, - securitySchemes, - securityIndexInfo, - timeout, - defaultHeaders -); -SchemaConfiguration schemaConfiguration = new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().build()); -Pet apiClient = new Pet(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 -); -PetPostRequestBody.SealedRequestBody requestBody = new PetPostRequestBody.ApplicationjsonRequestBody(requestBodyPayload); - -var request = new PetPost.PostRequestBuilder() - .requestBody(requestBody) - .build(); - -PetPostResponses.EndpointResponse response; -try { - response = apiClient.post(request); -} catch (PetPostCode405Response.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; -} -PetPostResponses.EndpointPetPostCode200Response castResponse = (PetPostResponses.EndpointPetPostCode200Response) response; -``` -### updatePet -public Nothing? updatePet([PetPut.PutRequest](../../paths/pet/PetPut.md#putrequest) request) - - - -**Parameters:**
-request - the input request - -**Returns:**
-nothing (Nothing?) - -**Throws:**
-IOException, InterruptedException - an exception happened when making the request
-ValidationException - the returned response body or header values do not conform the the schema validation requirements
-NotImplementedException - the request body serialization or deserialization has not yet been implemented
- or the header content type deserialization has not yet been implemented for this contentType
-ApiException - server returned a response/contentType not defined in the openapi document
- -#### 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.PetPutRequestBody; -import org.openapijsonschematools.client.components.schemas.Pet; -import org.openapijsonschematools.client.servers.RootServer0; -import org.openapijsonschematools.client.servers.RootServer1; -import org.openapijsonschematools.client.servers.RootServer2; -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.pet.put.responses.PetPutCode400Response; -import org.openapijsonschematools.client.paths.pet.put.responses.PetPutCode404Response; -import org.openapijsonschematools.client.paths.pet.put.responses.PetPutCode405Response; -import org.openapijsonschematools.client.servers.RootServerInfo; -import org.openapijsonschematools.client.apis.tags.Pet; -import org.openapijsonschematools.client.paths.pet.put.PetPutResponses; - -import java.io.IOException; -import java.util.Arrays; -import java.util.List; -import java.util.Map; -import java.util.AbstractMap; - -// if you want to use a server that is not SERVER_0 pass it in here and change the ServerIndex input below -ApiConfiguration.ServerInfo serverInfo = new ApiConfiguration.ServerInfoBuilder() - .rootServerInfo( - new RootServerInfo.RootServerInfoBuilder() - .rootServer0(new RootServer0()) - .build() - ) - .build(); -ApiConfiguration.ServerIndexInfo serverIndexInfo = new ApiConfiguration.ServerIndexInfoBuilder() - .rootServerInfoServerIndex(RootServerInfo.ServerIndex.SERVER_0) - .build(); -List securitySchemes = new ArrayList(); -ApiConfiguration.SecurityIndexInfo securityIndexInfo = new ApiConfiguration.SecurityIndexInfoBuilder() - .petPutSecurityRequirementObject0SecurityIndex(PetPutSecurityRequirementObject0.SecurityIndex.SECURITY_0) - .build(); -Duration timeout = Duration.ofSeconds(1L); -Map> defaultHeaders = Map.of("User-Agent", List.of("OpenAPI-JSON-Schema-Generator/1.0.0/java")); -ApiConfiguration apiConfiguration = new ApiConfiguration( - serverInfo - serverIndexInfo, - securitySchemes, - securityIndexInfo, - timeout, - defaultHeaders -); -SchemaConfiguration schemaConfiguration = new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().build()); -Pet apiClient = new Pet(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 -); -PetPutRequestBody.SealedRequestBody requestBody = new PetPutRequestBody.ApplicationjsonRequestBody(requestBodyPayload); - -var request = new PetPut.PutRequestBuilder() - .requestBody(requestBody) - .build(); - -Nothing? response; -try { - response = apiClient.put(request); -} catch (PetPutCode400Response.ResponseApiException | PetPutCode404Response.ResponseApiException | PetPutCode405Response.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; -} -``` -### findPetsByTags -public [PetfindbytagsGetResponses.EndpointResponse](../../paths/petfindbytags/get/PetfindbytagsGetResponses.md#endpointresponse) findPetsByTags([PetfindbytagsGet.GetRequest](../../paths/petfindbytags/PetfindbytagsGet.md#getrequest) request) - -Multiple tags can be provided with comma separated strings. Use tag1, tag2, tag3 for testing. - -**Parameters:**
-request - the input request - -**Returns:**
-the deserialized response - -**Throws:**
-IOException, InterruptedException - an exception happened when making the request
-ValidationException - the returned response body or header values do not conform the the schema validation requirements
-NotImplementedException - the request body serialization or deserialization has not yet been implemented
- or the header content type deserialization has not yet been implemented for this contentType
-ApiException - server returned a response/contentType not defined in the openapi document
- -#### 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.petfindbytags.get.PetfindbytagsGetSecurityInfo; -import org.openapijsonschematools.client.paths.petfindbytags.get.PetfindbytagsGetQueryParameters; -import org.openapijsonschematools.client.servers.RootServer0; -import org.openapijsonschematools.client.servers.RootServer1; -import org.openapijsonschematools.client.servers.RootServer2; -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.PetfindbytagsGetCode200Response; -import org.openapijsonschematools.client.paths.petfindbytags.get.responses.PetfindbytagsGetCode400Response; -import org.openapijsonschematools.client.servers.RootServerInfo; -import org.openapijsonschematools.client.apis.tags.Pet; -import org.openapijsonschematools.client.paths.petfindbytags.get.PetfindbytagsGetResponses; - -import java.io.IOException; -import java.util.Arrays; -import java.util.List; -import java.util.Map; -import java.util.AbstractMap; - -// if you want to use a server that is not SERVER_0 pass it in here and change the ServerIndex input below -ApiConfiguration.ServerInfo serverInfo = new ApiConfiguration.ServerInfoBuilder() - .rootServerInfo( - new RootServerInfo.RootServerInfoBuilder() - .rootServer0(new RootServer0()) - .build() - ) - .build(); -ApiConfiguration.ServerIndexInfo serverIndexInfo = new ApiConfiguration.ServerIndexInfoBuilder() - .rootServerInfoServerIndex(RootServerInfo.ServerIndex.SERVER_0) - .build(); -List securitySchemes = new ArrayList(); -ApiConfiguration.SecurityIndexInfo securityIndexInfo = new ApiConfiguration.SecurityIndexInfoBuilder() - .petfindbytagsGetSecurityRequirementObject0SecurityIndex(PetfindbytagsGetSecurityRequirementObject0.SecurityIndex.SECURITY_0) - .build(); -Duration timeout = Duration.ofSeconds(1L); -Map> defaultHeaders = Map.of("User-Agent", List.of("OpenAPI-JSON-Schema-Generator/1.0.0/java")); -ApiConfiguration apiConfiguration = new ApiConfiguration( - serverInfo - serverIndexInfo, - securitySchemes, - securityIndexInfo, - timeout, - defaultHeaders -); -SchemaConfiguration schemaConfiguration = new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().build()); -Pet apiClient = new Pet(apiConfiguration, schemaConfiguration); - - -// Map validation -PetfindbytagsGetQueryParameters.QueryParametersMap queryParameters = - PetfindbytagsGetQueryParameters.PetfindbytagsGetQueryParameters1.validate( - new PetfindbytagsGetQueryParameters.QueryParametersMapBuilder() - .tags( - Arrays.asList( - "a" - ) - ) - .build(), - schemaConfiguration -); - -var request = new PetfindbytagsGet.GetRequestBuilder() - .queryParameters(queryParameters) - .build(); - -PetfindbytagsGetResponses.EndpointResponse response; -try { - response = apiClient.get(request); -} catch (PetfindbytagsGetCode400Response.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; -} -PetfindbytagsGetResponses.EndpointPetfindbytagsGetCode200Response castResponse = (PetfindbytagsGetResponses.EndpointPetfindbytagsGetCode200Response) response; -} -``` -### findPetsByStatus -public [PetfindbystatusGetResponses.EndpointResponse](../../paths/petfindbystatus/get/PetfindbystatusGetResponses.md#endpointresponse) findPetsByStatus([PetfindbystatusGet.GetRequest](../../paths/petfindbystatus/PetfindbystatusGet.md#getrequest) request) - -Multiple status values can be provided with comma separated strings - -**Parameters:**
-request - the input request - -**Returns:**
-the deserialized response - -**Throws:**
-IOException, InterruptedException - an exception happened when making the request
-ValidationException - the returned response body or header values do not conform the the schema validation requirements
-NotImplementedException - the request body serialization or deserialization has not yet been implemented
- or the header content type deserialization has not yet been implemented for this contentType
-ApiException - server returned a response/contentType not defined in the openapi document
- -#### 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.petfindbystatus.PetfindbystatusServerInfo; -import org.openapijsonschematools.client.paths.petfindbystatus.get.PetfindbystatusGetSecurityInfo; -import org.openapijsonschematools.client.paths.petfindbystatus.get.PetfindbystatusGetQueryParameters; -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.PetfindbystatusGetCode200Response; -import org.openapijsonschematools.client.paths.petfindbystatus.get.responses.PetfindbystatusGetCode400Response; -import org.openapijsonschematools.client.paths.petfindbystatus.PetfindbystatusServerInfo; -import org.openapijsonschematools.client.apis.tags.Pet; -import org.openapijsonschematools.client.paths.petfindbystatus.get.PetfindbystatusGetResponses; - -import java.io.IOException; -import java.util.Arrays; -import java.util.List; -import java.util.Map; -import java.util.AbstractMap; - -// if you want to use a server that is not SERVER_0 pass it in here and change the ServerIndex input below -ApiConfiguration.ServerInfo serverInfo = new ApiConfiguration.ServerInfoBuilder() - .petfindbystatusServerInfo( - new PetfindbystatusServerInfo.PetfindbystatusServerInfoBuilder() - .petfindbystatusServer0(new PetfindbystatusServer0()) - .build() - ) - .build(); -ApiConfiguration.ServerIndexInfo serverIndexInfo = new ApiConfiguration.ServerIndexInfoBuilder() - .petfindbystatusServerInfoServerIndex(PetfindbystatusServerInfo.ServerIndex.SERVER_0) - .build(); -List securitySchemes = new ArrayList(); -securitySchemes.add( - new ApiKey("someApiKey"); -); -ApiConfiguration.SecurityIndexInfo securityIndexInfo = new ApiConfiguration.SecurityIndexInfoBuilder() - .petfindbystatusGetSecurityRequirementObject0SecurityIndex(PetfindbystatusGetSecurityRequirementObject0.SecurityIndex.SECURITY_0) - .build(); -Duration timeout = Duration.ofSeconds(1L); -Map> defaultHeaders = Map.of("User-Agent", List.of("OpenAPI-JSON-Schema-Generator/1.0.0/java")); -ApiConfiguration apiConfiguration = new ApiConfiguration( - serverInfo - serverIndexInfo, - securitySchemes, - securityIndexInfo, - timeout, - defaultHeaders -); -SchemaConfiguration schemaConfiguration = new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().build()); -Pet apiClient = new Pet(apiConfiguration, schemaConfiguration); - - -// Map validation -PetfindbystatusGetQueryParameters.QueryParametersMap queryParameters = - PetfindbystatusGetQueryParameters.PetfindbystatusGetQueryParameters1.validate( - new PetfindbystatusGetQueryParameters.QueryParametersMapBuilder() - .status( - Arrays.asList( - "available" - ) - ) - .build(), - schemaConfiguration -); - -var request = new PetfindbystatusGet.GetRequestBuilder() - .queryParameters(queryParameters) - .build(); - -PetfindbystatusGetResponses.EndpointResponse response; -try { - response = apiClient.get(request); -} catch (PetfindbystatusGetCode400Response.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; -} -PetfindbystatusGetResponses.EndpointPetfindbystatusGetCode200Response castResponse = (PetfindbystatusGetResponses.EndpointPetfindbystatusGetCode200Response) response; -} -``` -### uploadImage -public [PetpetiduploadimagePostResponses.EndpointResponse](../../paths/petpetiduploadimage/post/PetpetiduploadimagePostResponses.md#endpointresponse) uploadImage([PetpetiduploadimagePost.PostRequest](../../paths/petpetiduploadimage/PetpetiduploadimagePost.md#postrequest) request) - - - -**Parameters:**
-request - the input request - -**Returns:**
-the deserialized response - -**Throws:**
-IOException, InterruptedException - an exception happened when making the request
-ValidationException - the returned response body or header values do not conform the the schema validation requirements
-NotImplementedException - the request body serialization or deserialization has not yet been implemented
- or the header content type deserialization has not yet been implemented for this contentType
-ApiException - server returned a response/contentType not defined in the openapi document
- -#### 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.PetpetiduploadimagePostRequestBody; -import org.openapijsonschematools.client.RootServerInfo; -import org.openapijsonschematools.client.paths.petpetiduploadimage.post.PetpetiduploadimagePostSecurityInfo; -import org.openapijsonschematools.client.paths.petpetiduploadimage.post.PetpetiduploadimagePostPathParameters; -import org.openapijsonschematools.client.servers.RootServer0; -import org.openapijsonschematools.client.servers.RootServer1; -import org.openapijsonschematools.client.servers.RootServer2; -import org.openapijsonschematools.client.securityschemes.SecurityScheme; -import org.openapijsonschematools.client.components.securityschemes.PetstoreAuth; -import org.openapijsonschematools.client.paths.petpetiduploadimage.post.responses.PetpetiduploadimagePostCode200Response; -import org.openapijsonschematools.client.components.responses.successwithjsonapiresponse.SuccessWithJsonApiResponseHeadersSchema; -import org.openapijsonschematools.client.servers.RootServerInfo; -import org.openapijsonschematools.client.apis.tags.Pet; -import org.openapijsonschematools.client.paths.petpetiduploadimage.post.PetpetiduploadimagePostResponses; - -import java.io.IOException; -import java.util.Arrays; -import java.util.List; -import java.util.Map; -import java.util.AbstractMap; - -// if you want to use a server that is not SERVER_0 pass it in here and change the ServerIndex input below -ApiConfiguration.ServerInfo serverInfo = new ApiConfiguration.ServerInfoBuilder() - .rootServerInfo( - new RootServerInfo.RootServerInfoBuilder() - .rootServer0(new RootServer0()) - .build() - ) - .build(); -ApiConfiguration.ServerIndexInfo serverIndexInfo = new ApiConfiguration.ServerIndexInfoBuilder() - .rootServerInfoServerIndex(RootServerInfo.ServerIndex.SERVER_0) - .build(); -List securitySchemes = new ArrayList(); -ApiConfiguration.SecurityIndexInfo securityIndexInfo = new ApiConfiguration.SecurityIndexInfoBuilder() - .petpetiduploadimagePostSecurityRequirementObject0SecurityIndex(PetpetiduploadimagePostSecurityRequirementObject0.SecurityIndex.SECURITY_0) - .build(); -Duration timeout = Duration.ofSeconds(1L); -Map> defaultHeaders = Map.of("User-Agent", List.of("OpenAPI-JSON-Schema-Generator/1.0.0/java")); -ApiConfiguration apiConfiguration = new ApiConfiguration( - serverInfo - serverIndexInfo, - securitySchemes, - securityIndexInfo, - timeout, - defaultHeaders -); -SchemaConfiguration schemaConfiguration = new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().build()); -Pet apiClient = new Pet(apiConfiguration, schemaConfiguration); - - -// Map validation -PetpetiduploadimagePostPathParameters.PathParametersMap pathParameters = - PetpetiduploadimagePostPathParameters.PetpetiduploadimagePostPathParameters1.validate( - new PetpetiduploadimagePostPathParameters.PathParametersMapBuilder() - .petId(1L) - - .build(), - schemaConfiguration -); - -var request = new PetpetiduploadimagePost.PostRequestBuilder() - .pathParameters(pathParameters) - .build(); - -PetpetiduploadimagePostResponses.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; -} -PetpetiduploadimagePostResponses.EndpointPetpetiduploadimagePostCode200Response castResponse = (PetpetiduploadimagePostResponses.EndpointPetpetiduploadimagePostCode200Response) response; -} -``` -### deletePet -public Nothing? deletePet([PetpetidDelete.DeleteRequest](../../paths/petpetid/PetpetidDelete.md#deleterequest) request) - - - -**Parameters:**
-request - the input request - -**Returns:**
-nothing (Nothing?) - -**Throws:**
-IOException, InterruptedException - an exception happened when making the request
-ValidationException - the returned response body or header values do not conform the the schema validation requirements
-NotImplementedException - the request body serialization or deserialization has not yet been implemented
- or the header content type deserialization has not yet been implemented for this contentType
-ApiException - server returned a response/contentType not defined in the openapi document
- -#### 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.PetpetidDeleteHeaderParameters; -import org.openapijsonschematools.client.RootServerInfo; -import org.openapijsonschematools.client.paths.petpetid.delete.PetpetidDeleteSecurityInfo; -import org.openapijsonschematools.client.paths.petpetid.delete.PetpetidDeletePathParameters; -import org.openapijsonschematools.client.servers.RootServer0; -import org.openapijsonschematools.client.servers.RootServer1; -import org.openapijsonschematools.client.servers.RootServer2; -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.PetpetidDeleteCode400Response; -import org.openapijsonschematools.client.servers.RootServerInfo; -import org.openapijsonschematools.client.apis.tags.Pet; -import org.openapijsonschematools.client.paths.petpetid.delete.PetpetidDeleteResponses; - -import java.io.IOException; -import java.util.Arrays; -import java.util.List; -import java.util.Map; -import java.util.AbstractMap; - -// if you want to use a server that is not SERVER_0 pass it in here and change the ServerIndex input below -ApiConfiguration.ServerInfo serverInfo = new ApiConfiguration.ServerInfoBuilder() - .rootServerInfo( - new RootServerInfo.RootServerInfoBuilder() - .rootServer0(new RootServer0()) - .build() - ) - .build(); -ApiConfiguration.ServerIndexInfo serverIndexInfo = new ApiConfiguration.ServerIndexInfoBuilder() - .rootServerInfoServerIndex(RootServerInfo.ServerIndex.SERVER_0) - .build(); -List securitySchemes = new ArrayList(); -securitySchemes.add( - new ApiKey("someApiKey"); -); -ApiConfiguration.SecurityIndexInfo securityIndexInfo = new ApiConfiguration.SecurityIndexInfoBuilder() - .petpetidDeleteSecurityRequirementObject0SecurityIndex(PetpetidDeleteSecurityRequirementObject0.SecurityIndex.SECURITY_0) - .build(); -Duration timeout = Duration.ofSeconds(1L); -Map> defaultHeaders = Map.of("User-Agent", List.of("OpenAPI-JSON-Schema-Generator/1.0.0/java")); -ApiConfiguration apiConfiguration = new ApiConfiguration( - serverInfo - serverIndexInfo, - securitySchemes, - securityIndexInfo, - timeout, - defaultHeaders -); -SchemaConfiguration schemaConfiguration = new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().build()); -Pet apiClient = new Pet(apiConfiguration, schemaConfiguration); - - -// Map validation -PetpetidDeletePathParameters.PathParametersMap pathParameters = - PetpetidDeletePathParameters.PetpetidDeletePathParameters1.validate( - new PetpetidDeletePathParameters.PathParametersMapBuilder() - .petId(1L) - - .build(), - schemaConfiguration -); - -var request = new PetpetidDelete.DeleteRequestBuilder() - .pathParameters(pathParameters) - .build(); - -Nothing? response; -try { - response = apiClient.delete(request); -} catch (PetpetidDeleteCode400Response.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; -} -``` -### getPetById -public [PetpetidGetResponses.EndpointResponse](../../paths/petpetid/get/PetpetidGetResponses.md#endpointresponse) getPetById([PetpetidGet.GetRequest](../../paths/petpetid/PetpetidGet.md#getrequest) request) - -Returns a single pet - -**Parameters:**
-request - the input request - -**Returns:**
-the deserialized response - -**Throws:**
-IOException, InterruptedException - an exception happened when making the request
-ValidationException - the returned response body or header values do not conform the the schema validation requirements
-NotImplementedException - the request body serialization or deserialization has not yet been implemented
- or the header content type deserialization has not yet been implemented for this contentType
-ApiException - server returned a response/contentType not defined in the openapi document
- -#### 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.petpetid.get.PetpetidGetSecurityInfo; -import org.openapijsonschematools.client.paths.petpetid.get.PetpetidGetPathParameters; -import org.openapijsonschematools.client.servers.RootServer0; -import org.openapijsonschematools.client.servers.RootServer1; -import org.openapijsonschematools.client.servers.RootServer2; -import org.openapijsonschematools.client.securityschemes.SecurityScheme; -import org.openapijsonschematools.client.components.securityschemes.ApiKey; -import org.openapijsonschematools.client.paths.petpetid.get.responses.PetpetidGetCode200Response; -import org.openapijsonschematools.client.paths.petpetid.get.responses.PetpetidGetCode400Response; -import org.openapijsonschematools.client.paths.petpetid.get.responses.PetpetidGetCode404Response; -import org.openapijsonschematools.client.servers.RootServerInfo; -import org.openapijsonschematools.client.apis.tags.Pet; -import org.openapijsonschematools.client.paths.petpetid.get.PetpetidGetResponses; - -import java.io.IOException; -import java.util.Arrays; -import java.util.List; -import java.util.Map; -import java.util.AbstractMap; - -// if you want to use a server that is not SERVER_0 pass it in here and change the ServerIndex input below -ApiConfiguration.ServerInfo serverInfo = new ApiConfiguration.ServerInfoBuilder() - .rootServerInfo( - new RootServerInfo.RootServerInfoBuilder() - .rootServer0(new RootServer0()) - .build() - ) - .build(); -ApiConfiguration.ServerIndexInfo serverIndexInfo = new ApiConfiguration.ServerIndexInfoBuilder() - .rootServerInfoServerIndex(RootServerInfo.ServerIndex.SERVER_0) - .build(); -List securitySchemes = new ArrayList(); -securitySchemes.add( - new ApiKey("someApiKey"); -); -ApiConfiguration.SecurityIndexInfo securityIndexInfo = new ApiConfiguration.SecurityIndexInfoBuilder() - .petpetidGetSecurityRequirementObject0SecurityIndex(PetpetidGetSecurityRequirementObject0.SecurityIndex.SECURITY_0) - .build(); -Duration timeout = Duration.ofSeconds(1L); -Map> defaultHeaders = Map.of("User-Agent", List.of("OpenAPI-JSON-Schema-Generator/1.0.0/java")); -ApiConfiguration apiConfiguration = new ApiConfiguration( - serverInfo - serverIndexInfo, - securitySchemes, - securityIndexInfo, - timeout, - defaultHeaders -); -SchemaConfiguration schemaConfiguration = new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().build()); -Pet apiClient = new Pet(apiConfiguration, schemaConfiguration); - - -// Map validation -PetpetidGetPathParameters.PathParametersMap pathParameters = - PetpetidGetPathParameters.PetpetidGetPathParameters1.validate( - new PetpetidGetPathParameters.PathParametersMapBuilder() - .petId(1L) - - .build(), - schemaConfiguration -); - -var request = new PetpetidGet.GetRequestBuilder() - .pathParameters(pathParameters) - .build(); - -PetpetidGetResponses.EndpointResponse response; -try { - response = apiClient.get(request); -} catch (PetpetidGetCode400Response.ResponseApiException | PetpetidGetCode404Response.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; -} -PetpetidGetResponses.EndpointPetpetidGetCode200Response castResponse = (PetpetidGetResponses.EndpointPetpetidGetCode200Response) response; -if (castResponse.body instanceof PetpetidGetCode200Response.ApplicationxmlResponseBody deserializedBody) { - // handle deserialized body here -} else { - PetpetidGetCode200Response.ApplicationjsonResponseBody deserializedBody = (PetpetidGetCode200Response.ApplicationjsonResponseBody) castResponse.body; - // handle deserialized body here -} -``` -### updatePetWithForm -public Nothing? updatePetWithForm([PetpetidPost.PostRequest](../../paths/petpetid/PetpetidPost.md#postrequest) request) - - - -**Parameters:**
-request - the input request - -**Returns:**
-nothing (Nothing?) - -**Throws:**
-IOException, InterruptedException - an exception happened when making the request
-ValidationException - the returned response body or header values do not conform the the schema validation requirements
-NotImplementedException - the request body serialization or deserialization has not yet been implemented
- or the header content type deserialization has not yet been implemented for this contentType
-ApiException - server returned a response/contentType not defined in the openapi document
- -#### 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.PetpetidPostRequestBody; -import org.openapijsonschematools.client.RootServerInfo; -import org.openapijsonschematools.client.paths.petpetid.post.PetpetidPostSecurityInfo; -import org.openapijsonschematools.client.paths.petpetid.post.PetpetidPostPathParameters; -import org.openapijsonschematools.client.servers.RootServer0; -import org.openapijsonschematools.client.servers.RootServer1; -import org.openapijsonschematools.client.servers.RootServer2; -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.PetpetidPostCode405Response; -import org.openapijsonschematools.client.servers.RootServerInfo; -import org.openapijsonschematools.client.apis.tags.Pet; -import org.openapijsonschematools.client.paths.petpetid.post.PetpetidPostResponses; - -import java.io.IOException; -import java.util.Arrays; -import java.util.List; -import java.util.Map; -import java.util.AbstractMap; - -// if you want to use a server that is not SERVER_0 pass it in here and change the ServerIndex input below -ApiConfiguration.ServerInfo serverInfo = new ApiConfiguration.ServerInfoBuilder() - .rootServerInfo( - new RootServerInfo.RootServerInfoBuilder() - .rootServer0(new RootServer0()) - .build() - ) - .build(); -ApiConfiguration.ServerIndexInfo serverIndexInfo = new ApiConfiguration.ServerIndexInfoBuilder() - .rootServerInfoServerIndex(RootServerInfo.ServerIndex.SERVER_0) - .build(); -List securitySchemes = new ArrayList(); -securitySchemes.add( - new ApiKey("someApiKey"); -); -ApiConfiguration.SecurityIndexInfo securityIndexInfo = new ApiConfiguration.SecurityIndexInfoBuilder() - .petpetidPostSecurityRequirementObject0SecurityIndex(PetpetidPostSecurityRequirementObject0.SecurityIndex.SECURITY_0) - .build(); -Duration timeout = Duration.ofSeconds(1L); -Map> defaultHeaders = Map.of("User-Agent", List.of("OpenAPI-JSON-Schema-Generator/1.0.0/java")); -ApiConfiguration apiConfiguration = new ApiConfiguration( - serverInfo - serverIndexInfo, - securitySchemes, - securityIndexInfo, - timeout, - defaultHeaders -); -SchemaConfiguration schemaConfiguration = new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().build()); -Pet apiClient = new Pet(apiConfiguration, schemaConfiguration); - - -// Map validation -PetpetidPostPathParameters.PathParametersMap pathParameters = - PetpetidPostPathParameters.PetpetidPostPathParameters1.validate( - new PetpetidPostPathParameters.PathParametersMapBuilder() - .petId(1L) - - .build(), - schemaConfiguration -); - -var request = new PetpetidPost.PostRequestBuilder() - .pathParameters(pathParameters) - .build(); - -Nothing? response; -try { - response = apiClient.post(request); -} catch (PetpetidPostCode405Response.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; -} -``` -[[Back to top]](#top) [[Back to README]](../../../README.md) diff --git a/samples/client/petstore/kotlin/docs/apis/tags/Store.md b/samples/client/petstore/kotlin/docs/apis/tags/Store.md deleted file mode 100644 index 525879f8359..00000000000 --- a/samples/client/petstore/kotlin/docs/apis/tags/Store.md +++ /dev/null @@ -1,462 +0,0 @@ -# Store - -public class Store extends extends ApiClient implements -[StoreinventoryGet.GetInventoryOperation](../../paths/storeinventory/StoreinventoryGet.md#getinventoryoperation), -[StoreorderorderidDelete.DeleteOrderOperation](../../paths/storeorderorderid/StoreorderorderidDelete.md#deleteorderoperation), -[StoreorderorderidGet.GetOrderByIdOperation](../../paths/storeorderorderid/StoreorderorderidGet.md#getorderbyidoperation), -[StoreorderPost.PlaceOrderOperation](../../paths/storeorder/StoreorderPost.md#placeorderoperation) - -an api client class which contains all the routes for tag="store" -Access to Petstore orders - -## Method Summary -| Modifier and Type | Method and Description | -| ----------------- | ---------------------- | -| [StoreinventoryGetResponses.EndpointResponse](../../paths/storeinventory/get/StoreinventoryGetResponses.md#endpointresponse) | [getInventory](#getinventory)([StoreinventoryGet.GetRequest](../../paths/storeinventory/StoreinventoryGet.md#getrequest) request)
Returns a map of status codes to quantities | -| Nothing? | [deleteOrder](#deleteorder)([StoreorderorderidDelete.DeleteRequest](../../paths/storeorderorderid/StoreorderorderidDelete.md#deleterequest) request)
For valid response try integer IDs with value < 1000. Anything above 1000 or nonintegers will generate API errors | -| [StoreorderorderidGetResponses.EndpointResponse](../../paths/storeorderorderid/get/StoreorderorderidGetResponses.md#endpointresponse) | [getOrderById](#getorderbyid)([StoreorderorderidGet.GetRequest](../../paths/storeorderorderid/StoreorderorderidGet.md#getrequest) request)
For valid response try integer IDs with value <= 5 or > 10. Other values will generated exceptions | -| [StoreorderPostResponses.EndpointResponse](../../paths/storeorder/post/StoreorderPostResponses.md#endpointresponse) | [placeOrder](#placeorder)([StoreorderPost.PostRequest](../../paths/storeorder/StoreorderPost.md#postrequest) request)
| - -## Method Detail - -### getInventory -public [StoreinventoryGetResponses.EndpointResponse](../../paths/storeinventory/get/StoreinventoryGetResponses.md#endpointresponse) getInventory([StoreinventoryGet.GetRequest](../../paths/storeinventory/StoreinventoryGet.md#getrequest) request) - -Returns a map of status codes to quantities - -**Parameters:**
-request - the input request - -**Returns:**
-the deserialized response - -**Throws:**
-IOException, InterruptedException - an exception happened when making the request
-ValidationException - the returned response body or header values do not conform the the schema validation requirements
-NotImplementedException - the request body serialization or deserialization has not yet been implemented
- or the header content type deserialization has not yet been implemented for this contentType
-ApiException - server returned a response/contentType not defined in the openapi document
- -#### 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.storeinventory.get.StoreinventoryGetSecurityInfo; -import org.openapijsonschematools.client.servers.RootServer0; -import org.openapijsonschematools.client.servers.RootServer1; -import org.openapijsonschematools.client.servers.RootServer2; -import org.openapijsonschematools.client.securityschemes.SecurityScheme; -import org.openapijsonschematools.client.components.securityschemes.ApiKey; -import org.openapijsonschematools.client.paths.storeinventory.get.responses.StoreinventoryGetCode200Response; -import org.openapijsonschematools.client.components.responses.successinlinecontentandheader.SuccessInlineContentAndHeaderHeadersSchema; -import org.openapijsonschematools.client.servers.RootServerInfo; -import org.openapijsonschematools.client.apis.tags.Store; -import org.openapijsonschematools.client.paths.storeinventory.get.StoreinventoryGetResponses; - -import java.io.IOException; -import java.util.Arrays; -import java.util.List; -import java.util.Map; -import java.util.AbstractMap; - -// if you want to use a server that is not SERVER_0 pass it in here and change the ServerIndex input below -ApiConfiguration.ServerInfo serverInfo = new ApiConfiguration.ServerInfoBuilder() - .rootServerInfo( - new RootServerInfo.RootServerInfoBuilder() - .rootServer0(new RootServer0()) - .build() - ) - .build(); -ApiConfiguration.ServerIndexInfo serverIndexInfo = new ApiConfiguration.ServerIndexInfoBuilder() - .rootServerInfoServerIndex(RootServerInfo.ServerIndex.SERVER_0) - .build(); -List securitySchemes = new ArrayList(); -securitySchemes.add( - new ApiKey("someApiKey"); -); -ApiConfiguration.SecurityIndexInfo securityIndexInfo = new ApiConfiguration.SecurityIndexInfoBuilder() - .storeinventoryGetSecurityRequirementObject0SecurityIndex(StoreinventoryGetSecurityRequirementObject0.SecurityIndex.SECURITY_0) - .build(); -Duration timeout = Duration.ofSeconds(1L); -Map> defaultHeaders = Map.of("User-Agent", List.of("OpenAPI-JSON-Schema-Generator/1.0.0/java")); -ApiConfiguration apiConfiguration = new ApiConfiguration( - serverInfo - serverIndexInfo, - securitySchemes, - securityIndexInfo, - timeout, - defaultHeaders -); -SchemaConfiguration schemaConfiguration = new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().build()); -Store apiClient = new Store(apiConfiguration, schemaConfiguration); - - -var request = new StoreinventoryGet.GetRequestBuilder().build(); - -StoreinventoryGetResponses.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; -} -StoreinventoryGetResponses.EndpointStoreinventoryGetCode200Response castResponse = (StoreinventoryGetResponses.EndpointStoreinventoryGetCode200Response) response; -} -``` -### deleteOrder -public Nothing? deleteOrder([StoreorderorderidDelete.DeleteRequest](../../paths/storeorderorderid/StoreorderorderidDelete.md#deleterequest) request) - -For valid response try integer IDs with value < 1000. Anything above 1000 or nonintegers will generate API errors - -**Parameters:**
-request - the input request - -**Returns:**
-nothing (Nothing?) - -**Throws:**
-IOException, InterruptedException - an exception happened when making the request
-ValidationException - the returned response body or header values do not conform the the schema validation requirements
-NotImplementedException - the request body serialization or deserialization has not yet been implemented
- or the header content type deserialization has not yet been implemented for this contentType
-ApiException - server returned a response/contentType not defined in the openapi document
- -#### 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.StoreorderorderidDeletePathParameters; -import org.openapijsonschematools.client.servers.RootServer0; -import org.openapijsonschematools.client.servers.RootServer1; -import org.openapijsonschematools.client.servers.RootServer2; -import org.openapijsonschematools.client.paths.storeorderorderid.delete.responses.StoreorderorderidDeleteCode400Response; -import org.openapijsonschematools.client.paths.storeorderorderid.delete.responses.StoreorderorderidDeleteCode404Response; -import org.openapijsonschematools.client.servers.RootServerInfo; -import org.openapijsonschematools.client.apis.tags.Store; -import org.openapijsonschematools.client.paths.storeorderorderid.delete.StoreorderorderidDeleteResponses; - -import java.io.IOException; -import java.util.Arrays; -import java.util.List; -import java.util.Map; -import java.util.AbstractMap; - -// if you want to use a server that is not SERVER_0 pass it in here and change the ServerIndex input below -ApiConfiguration.ServerInfo serverInfo = new ApiConfiguration.ServerInfoBuilder() - .rootServerInfo( - new RootServerInfo.RootServerInfoBuilder() - .rootServer0(new RootServer0()) - .build() - ) - .build(); -ApiConfiguration.ServerIndexInfo serverIndexInfo = new ApiConfiguration.ServerIndexInfoBuilder() - .rootServerInfoServerIndex(RootServerInfo.ServerIndex.SERVER_0) - .build(); -Duration timeout = Duration.ofSeconds(1L); -Map> defaultHeaders = Map.of("User-Agent", List.of("OpenAPI-JSON-Schema-Generator/1.0.0/java")); -ApiConfiguration apiConfiguration = new ApiConfiguration( - serverInfo - serverIndexInfo, - timeout, - defaultHeaders -); -SchemaConfiguration schemaConfiguration = new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().build()); -Store apiClient = new Store(apiConfiguration, schemaConfiguration); - - -// Map validation -StoreorderorderidDeletePathParameters.PathParametersMap pathParameters = - StoreorderorderidDeletePathParameters.StoreorderorderidDeletePathParameters1.validate( - new StoreorderorderidDeletePathParameters.PathParametersMapBuilder() - .order_id("a") - - .build(), - schemaConfiguration -); - -var request = new StoreorderorderidDelete.DeleteRequestBuilder() - .pathParameters(pathParameters) - .build(); - -Nothing? response; -try { - response = apiClient.delete(request); -} catch (StoreorderorderidDeleteCode400Response.ResponseApiException | StoreorderorderidDeleteCode404Response.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; -} -``` -### getOrderById -public [StoreorderorderidGetResponses.EndpointResponse](../../paths/storeorderorderid/get/StoreorderorderidGetResponses.md#endpointresponse) getOrderById([StoreorderorderidGet.GetRequest](../../paths/storeorderorderid/StoreorderorderidGet.md#getrequest) request) - -For valid response try integer IDs with value <= 5 or > 10. Other values will generated exceptions - -**Parameters:**
-request - the input request - -**Returns:**
-the deserialized response - -**Throws:**
-IOException, InterruptedException - an exception happened when making the request
-ValidationException - the returned response body or header values do not conform the the schema validation requirements
-NotImplementedException - the request body serialization or deserialization has not yet been implemented
- or the header content type deserialization has not yet been implemented for this contentType
-ApiException - server returned a response/contentType not defined in the openapi document
- -#### 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.get.StoreorderorderidGetPathParameters; -import org.openapijsonschematools.client.servers.RootServer0; -import org.openapijsonschematools.client.servers.RootServer1; -import org.openapijsonschematools.client.servers.RootServer2; -import org.openapijsonschematools.client.paths.storeorderorderid.get.responses.StoreorderorderidGetCode200Response; -import org.openapijsonschematools.client.paths.storeorderorderid.get.responses.StoreorderorderidGetCode400Response; -import org.openapijsonschematools.client.paths.storeorderorderid.get.responses.StoreorderorderidGetCode404Response; -import org.openapijsonschematools.client.servers.RootServerInfo; -import org.openapijsonschematools.client.apis.tags.Store; -import org.openapijsonschematools.client.paths.storeorderorderid.get.StoreorderorderidGetResponses; - -import java.io.IOException; -import java.util.Arrays; -import java.util.List; -import java.util.Map; -import java.util.AbstractMap; - -// if you want to use a server that is not SERVER_0 pass it in here and change the ServerIndex input below -ApiConfiguration.ServerInfo serverInfo = new ApiConfiguration.ServerInfoBuilder() - .rootServerInfo( - new RootServerInfo.RootServerInfoBuilder() - .rootServer0(new RootServer0()) - .build() - ) - .build(); -ApiConfiguration.ServerIndexInfo serverIndexInfo = new ApiConfiguration.ServerIndexInfoBuilder() - .rootServerInfoServerIndex(RootServerInfo.ServerIndex.SERVER_0) - .build(); -Duration timeout = Duration.ofSeconds(1L); -Map> defaultHeaders = Map.of("User-Agent", List.of("OpenAPI-JSON-Schema-Generator/1.0.0/java")); -ApiConfiguration apiConfiguration = new ApiConfiguration( - serverInfo - serverIndexInfo, - timeout, - defaultHeaders -); -SchemaConfiguration schemaConfiguration = new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().build()); -Store apiClient = new Store(apiConfiguration, schemaConfiguration); - - -// Map validation -StoreorderorderidGetPathParameters.PathParametersMap pathParameters = - StoreorderorderidGetPathParameters.StoreorderorderidGetPathParameters1.validate( - new StoreorderorderidGetPathParameters.PathParametersMapBuilder() - .order_id(1L) - - .build(), - schemaConfiguration -); - -var request = new StoreorderorderidGet.GetRequestBuilder() - .pathParameters(pathParameters) - .build(); - -StoreorderorderidGetResponses.EndpointResponse response; -try { - response = apiClient.get(request); -} catch (StoreorderorderidGetCode400Response.ResponseApiException | StoreorderorderidGetCode404Response.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; -} -StoreorderorderidGetResponses.EndpointStoreorderorderidGetCode200Response castResponse = (StoreorderorderidGetResponses.EndpointStoreorderorderidGetCode200Response) response; -if (castResponse.body instanceof StoreorderorderidGetCode200Response.ApplicationxmlResponseBody deserializedBody) { - // handle deserialized body here -} else { - StoreorderorderidGetCode200Response.ApplicationjsonResponseBody deserializedBody = (StoreorderorderidGetCode200Response.ApplicationjsonResponseBody) castResponse.body; - // handle deserialized body here -} -``` -### placeOrder -public [StoreorderPostResponses.EndpointResponse](../../paths/storeorder/post/StoreorderPostResponses.md#endpointresponse) placeOrder([StoreorderPost.PostRequest](../../paths/storeorder/StoreorderPost.md#postrequest) request) - - - -**Parameters:**
-request - the input request - -**Returns:**
-the deserialized response - -**Throws:**
-IOException, InterruptedException - an exception happened when making the request
-ValidationException - the returned response body or header values do not conform the the schema validation requirements
-NotImplementedException - the request body serialization or deserialization has not yet been implemented
- or the header content type deserialization has not yet been implemented for this contentType
-ApiException - server returned a response/contentType not defined in the openapi document
- -#### 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.StoreorderPostRequestBody; -import org.openapijsonschematools.client.components.schemas.Order; -import org.openapijsonschematools.client.servers.RootServer0; -import org.openapijsonschematools.client.servers.RootServer1; -import org.openapijsonschematools.client.servers.RootServer2; -import org.openapijsonschematools.client.paths.storeorder.post.responses.StoreorderPostCode200Response; -import org.openapijsonschematools.client.paths.storeorder.post.responses.StoreorderPostCode400Response; -import org.openapijsonschematools.client.servers.RootServerInfo; -import org.openapijsonschematools.client.apis.tags.Store; -import org.openapijsonschematools.client.paths.storeorder.post.StoreorderPostResponses; - -import java.io.IOException; -import java.util.Arrays; -import java.util.List; -import java.util.Map; -import java.util.AbstractMap; - -// if you want to use a server that is not SERVER_0 pass it in here and change the ServerIndex input below -ApiConfiguration.ServerInfo serverInfo = new ApiConfiguration.ServerInfoBuilder() - .rootServerInfo( - new RootServerInfo.RootServerInfoBuilder() - .rootServer0(new RootServer0()) - .build() - ) - .build(); -ApiConfiguration.ServerIndexInfo serverIndexInfo = new ApiConfiguration.ServerIndexInfoBuilder() - .rootServerInfoServerIndex(RootServerInfo.ServerIndex.SERVER_0) - .build(); -Duration timeout = Duration.ofSeconds(1L); -Map> defaultHeaders = Map.of("User-Agent", List.of("OpenAPI-JSON-Schema-Generator/1.0.0/java")); -ApiConfiguration apiConfiguration = new ApiConfiguration( - serverInfo - serverIndexInfo, - timeout, - defaultHeaders -); -SchemaConfiguration schemaConfiguration = new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().build()); -Store apiClient = new Store(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 -); -StoreorderPost.SealedRequestBody requestBody = new StoreorderPost.ApplicationjsonRequestBody(requestBodyPayload); - -var request = new StoreorderPost.PostRequestBuilder() - .requestBody(requestBody) - .build(); - -StoreorderPostResponses.EndpointResponse response; -try { - response = apiClient.post(request); -} catch (StoreorderPostCode400Response.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; -} -StoreorderPostResponses.EndpointStoreorderPostCode200Response castResponse = (StoreorderPostResponses.EndpointStoreorderPostCode200Response) response; -if (castResponse.body instanceof StoreorderPostCode200Response.ApplicationxmlResponseBody deserializedBody) { - // handle deserialized body here -} else { - StoreorderPostCode200Response.ApplicationjsonResponseBody deserializedBody = (StoreorderPostCode200Response.ApplicationjsonResponseBody) castResponse.body; - // handle deserialized body here -} -``` -[[Back to top]](#top) [[Back to README]](../../../README.md) diff --git a/samples/client/petstore/kotlin/docs/apis/tags/User.md b/samples/client/petstore/kotlin/docs/apis/tags/User.md deleted file mode 100644 index 1d00a835cce..00000000000 --- a/samples/client/petstore/kotlin/docs/apis/tags/User.md +++ /dev/null @@ -1,980 +0,0 @@ -# User - -public class User extends extends ApiClient implements -[UserlogoutGet.LogoutUserOperation](../../paths/userlogout/UserlogoutGet.md#logoutuseroperation), -[UsercreatewitharrayPost.CreateUsersWithArrayInputOperation](../../paths/usercreatewitharray/UsercreatewitharrayPost.md#createuserswitharrayinputoperation), -[UserPost.CreateUserOperation](../../paths/user/UserPost.md#createuseroperation), -[UserloginGet.LoginUserOperation](../../paths/userlogin/UserloginGet.md#loginuseroperation), -[UserusernameDelete.DeleteUserOperation](../../paths/userusername/UserusernameDelete.md#deleteuseroperation), -[UserusernameGet.GetUserByNameOperation](../../paths/userusername/UserusernameGet.md#getuserbynameoperation), -[UserusernamePut.UpdateUserOperation](../../paths/userusername/UserusernamePut.md#updateuseroperation), -[UsercreatewithlistPost.CreateUsersWithListInputOperation](../../paths/usercreatewithlist/UsercreatewithlistPost.md#createuserswithlistinputoperation) - -an api client class which contains all the routes for tag="user" -Operations about user - -## Method Summary -| Modifier and Type | Method and Description | -| ----------------- | ---------------------- | -| [UserlogoutGetResponses.EndpointResponse](../../paths/userlogout/get/UserlogoutGetResponses.md#endpointresponse) | [logoutUser](#logoutuser)([UserlogoutGet.GetRequest](../../paths/userlogout/UserlogoutGet.md#getrequest) request)
| -| [UsercreatewitharrayPostResponses.EndpointResponse](../../paths/usercreatewitharray/post/UsercreatewitharrayPostResponses.md#endpointresponse) | [createUsersWithArrayInput](#createuserswitharrayinput)([UsercreatewitharrayPost.PostRequest](../../paths/usercreatewitharray/UsercreatewitharrayPost.md#postrequest) request)
| -| [UserPostResponses.EndpointResponse](../../paths/user/post/UserPostResponses.md#endpointresponse) | [createUser](#createuser)([UserPost.PostRequest](../../paths/user/UserPost.md#postrequest) request)
This can only be done by the logged in user. | -| [UserloginGetResponses.EndpointResponse](../../paths/userlogin/get/UserloginGetResponses.md#endpointresponse) | [loginUser](#loginuser)([UserloginGet.GetRequest](../../paths/userlogin/UserloginGet.md#getrequest) request)
| -| [UserusernameDeleteResponses.EndpointResponse](../../paths/userusername/delete/UserusernameDeleteResponses.md#endpointresponse) | [deleteUser](#deleteuser)([UserusernameDelete.DeleteRequest](../../paths/userusername/UserusernameDelete.md#deleterequest) request)
This can only be done by the logged in user. | -| [UserusernameGetResponses.EndpointResponse](../../paths/userusername/get/UserusernameGetResponses.md#endpointresponse) | [getUserByName](#getuserbyname)([UserusernameGet.GetRequest](../../paths/userusername/UserusernameGet.md#getrequest) request)
| -| Nothing? | [updateUser](#updateuser)([UserusernamePut.PutRequest](../../paths/userusername/UserusernamePut.md#putrequest) request)
This can only be done by the logged in user. | -| [UsercreatewithlistPostResponses.EndpointResponse](../../paths/usercreatewithlist/post/UsercreatewithlistPostResponses.md#endpointresponse) | [createUsersWithListInput](#createuserswithlistinput)([UsercreatewithlistPost.PostRequest](../../paths/usercreatewithlist/UsercreatewithlistPost.md#postrequest) request)
| - -## Method Detail - -### logoutUser -public [UserlogoutGetResponses.EndpointResponse](../../paths/userlogout/get/UserlogoutGetResponses.md#endpointresponse) logoutUser([UserlogoutGet.GetRequest](../../paths/userlogout/UserlogoutGet.md#getrequest) request) - - - -**Parameters:**
-request - the input request - -**Returns:**
-the deserialized response - -**Throws:**
-IOException, InterruptedException - an exception happened when making the request
-ValidationException - the returned response body or header values do not conform the the schema validation requirements
-NotImplementedException - the request body serialization or deserialization has not yet been implemented
- or the header content type deserialization has not yet been implemented for this contentType
-ApiException - server returned a response/contentType not defined in the openapi document
- -#### 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.servers.RootServer0; -import org.openapijsonschematools.client.servers.RootServer1; -import org.openapijsonschematools.client.servers.RootServer2; -import org.openapijsonschematools.client.paths.userlogout.get.responses.UserlogoutGetCodedefaultResponse; -import org.openapijsonschematools.client.servers.RootServerInfo; -import org.openapijsonschematools.client.apis.tags.User; -import org.openapijsonschematools.client.paths.userlogout.get.UserlogoutGetResponses; - -import java.io.IOException; -import java.util.Arrays; -import java.util.List; -import java.util.Map; -import java.util.AbstractMap; - -// if you want to use a server that is not SERVER_0 pass it in here and change the ServerIndex input below -ApiConfiguration.ServerInfo serverInfo = new ApiConfiguration.ServerInfoBuilder() - .rootServerInfo( - new RootServerInfo.RootServerInfoBuilder() - .rootServer0(new RootServer0()) - .build() - ) - .build(); -ApiConfiguration.ServerIndexInfo serverIndexInfo = new ApiConfiguration.ServerIndexInfoBuilder() - .rootServerInfoServerIndex(RootServerInfo.ServerIndex.SERVER_0) - .build(); -Duration timeout = Duration.ofSeconds(1L); -Map> defaultHeaders = Map.of("User-Agent", List.of("OpenAPI-JSON-Schema-Generator/1.0.0/java")); -ApiConfiguration apiConfiguration = new ApiConfiguration( - serverInfo - serverIndexInfo, - timeout, - defaultHeaders -); -SchemaConfiguration schemaConfiguration = new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().build()); -User apiClient = new User(apiConfiguration, schemaConfiguration); - - -var request = new UserlogoutGet.GetRequestBuilder().build(); - -UserlogoutGetResponses.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; -} -UserlogoutGetResponses.EndpointUserlogoutGetCodedefaultResponse castResponse = (UserlogoutGetResponses.EndpointUserlogoutGetCodedefaultResponse) response; -``` -### createUsersWithArrayInput -public [UsercreatewitharrayPostResponses.EndpointResponse](../../paths/usercreatewitharray/post/UsercreatewitharrayPostResponses.md#endpointresponse) createUsersWithArrayInput([UsercreatewitharrayPost.PostRequest](../../paths/usercreatewitharray/UsercreatewitharrayPost.md#postrequest) request) - - - -**Parameters:**
-request - the input request - -**Returns:**
-the deserialized response - -**Throws:**
-IOException, InterruptedException - an exception happened when making the request
-ValidationException - the returned response body or header values do not conform the the schema validation requirements
-NotImplementedException - the request body serialization or deserialization has not yet been implemented
- or the header content type deserialization has not yet been implemented for this contentType
-ApiException - server returned a response/contentType not defined in the openapi document
- -#### 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.UsercreatewitharrayPostRequestBody; -import org.openapijsonschematools.client.components.requestbodies.userarray.content.applicationjson.ApplicationjsonSchema; -import org.openapijsonschematools.client.servers.RootServer0; -import org.openapijsonschematools.client.servers.RootServer1; -import org.openapijsonschematools.client.servers.RootServer2; -import org.openapijsonschematools.client.paths.usercreatewitharray.post.responses.UsercreatewitharrayPostCodedefaultResponse; -import org.openapijsonschematools.client.servers.RootServerInfo; -import org.openapijsonschematools.client.apis.tags.User; -import org.openapijsonschematools.client.paths.usercreatewitharray.post.UsercreatewitharrayPostResponses; - -import java.io.IOException; -import java.util.Arrays; -import java.util.List; -import java.util.Map; -import java.util.AbstractMap; - -// if you want to use a server that is not SERVER_0 pass it in here and change the ServerIndex input below -ApiConfiguration.ServerInfo serverInfo = new ApiConfiguration.ServerInfoBuilder() - .rootServerInfo( - new RootServerInfo.RootServerInfoBuilder() - .rootServer0(new RootServer0()) - .build() - ) - .build(); -ApiConfiguration.ServerIndexInfo serverIndexInfo = new ApiConfiguration.ServerIndexInfoBuilder() - .rootServerInfoServerIndex(RootServerInfo.ServerIndex.SERVER_0) - .build(); -Duration timeout = Duration.ofSeconds(1L); -Map> defaultHeaders = Map.of("User-Agent", List.of("OpenAPI-JSON-Schema-Generator/1.0.0/java")); -ApiConfiguration apiConfiguration = new ApiConfiguration( - serverInfo - serverIndexInfo, - timeout, - defaultHeaders -); -SchemaConfiguration schemaConfiguration = new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().build()); -User apiClient = new User(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 -); -UsercreatewitharrayPostRequestBody.SealedRequestBody requestBody = new UsercreatewitharrayPostRequestBody.ApplicationjsonRequestBody(requestBodyPayload); - -var request = new UsercreatewitharrayPost.PostRequestBuilder() - .requestBody(requestBody) - .build(); - -UsercreatewitharrayPostResponses.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; -} -UsercreatewitharrayPostResponses.EndpointUsercreatewitharrayPostCodedefaultResponse castResponse = (UsercreatewitharrayPostResponses.EndpointUsercreatewitharrayPostCodedefaultResponse) response; -``` -### createUser -public [UserPostResponses.EndpointResponse](../../paths/user/post/UserPostResponses.md#endpointresponse) createUser([UserPost.PostRequest](../../paths/user/UserPost.md#postrequest) request) - -This can only be done by the logged in user. - -**Parameters:**
-request - the input request - -**Returns:**
-the deserialized response - -**Throws:**
-IOException, InterruptedException - an exception happened when making the request
-ValidationException - the returned response body or header values do not conform the the schema validation requirements
-NotImplementedException - the request body serialization or deserialization has not yet been implemented
- or the header content type deserialization has not yet been implemented for this contentType
-ApiException - server returned a response/contentType not defined in the openapi document
- -#### 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.user.post.UserPostRequestBody; -import org.openapijsonschematools.client.components.schemas.User; -import org.openapijsonschematools.client.servers.RootServer0; -import org.openapijsonschematools.client.servers.RootServer1; -import org.openapijsonschematools.client.servers.RootServer2; -import org.openapijsonschematools.client.paths.user.post.responses.UserPostCodedefaultResponse; -import org.openapijsonschematools.client.servers.RootServerInfo; -import org.openapijsonschematools.client.apis.tags.User; -import org.openapijsonschematools.client.paths.user.post.UserPostResponses; - -import java.io.IOException; -import java.util.Arrays; -import java.util.List; -import java.util.Map; -import java.util.AbstractMap; - -// if you want to use a server that is not SERVER_0 pass it in here and change the ServerIndex input below -ApiConfiguration.ServerInfo serverInfo = new ApiConfiguration.ServerInfoBuilder() - .rootServerInfo( - new RootServerInfo.RootServerInfoBuilder() - .rootServer0(new RootServer0()) - .build() - ) - .build(); -ApiConfiguration.ServerIndexInfo serverIndexInfo = new ApiConfiguration.ServerIndexInfoBuilder() - .rootServerInfoServerIndex(RootServerInfo.ServerIndex.SERVER_0) - .build(); -Duration timeout = Duration.ofSeconds(1L); -Map> defaultHeaders = Map.of("User-Agent", List.of("OpenAPI-JSON-Schema-Generator/1.0.0/java")); -ApiConfiguration apiConfiguration = new ApiConfiguration( - serverInfo - serverIndexInfo, - timeout, - defaultHeaders -); -SchemaConfiguration schemaConfiguration = new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().build()); -User apiClient = new User(apiConfiguration, schemaConfiguration); - - -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 -); -UserPost.SealedRequestBody requestBody = new UserPost.ApplicationjsonRequestBody(requestBodyPayload); - -var request = new UserPost.PostRequestBuilder() - .requestBody(requestBody) - .build(); - -UserPostResponses.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; -} -UserPostResponses.EndpointUserPostCodedefaultResponse castResponse = (UserPostResponses.EndpointUserPostCodedefaultResponse) response; -``` -### loginUser -public [UserloginGetResponses.EndpointResponse](../../paths/userlogin/get/UserloginGetResponses.md#endpointresponse) loginUser([UserloginGet.GetRequest](../../paths/userlogin/UserloginGet.md#getrequest) request) - - - -**Parameters:**
-request - the input request - -**Returns:**
-the deserialized response - -**Throws:**
-IOException, InterruptedException - an exception happened when making the request
-ValidationException - the returned response body or header values do not conform the the schema validation requirements
-NotImplementedException - the request body serialization or deserialization has not yet been implemented
- or the header content type deserialization has not yet been implemented for this contentType
-ApiException - server returned a response/contentType not defined in the openapi document
- -#### 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.userlogin.get.UserloginGetQueryParameters; -import org.openapijsonschematools.client.servers.RootServer0; -import org.openapijsonschematools.client.servers.RootServer1; -import org.openapijsonschematools.client.servers.RootServer2; -import org.openapijsonschematools.client.paths.userlogin.get.responses.UserloginGetCode200Response; -import org.openapijsonschematools.client.paths.userlogin.get.responses.code200response.UserloginGetCode200ResponseHeadersSchema; -import org.openapijsonschematools.client.paths.userlogin.get.responses.UserloginGetCode400Response; -import org.openapijsonschematools.client.servers.RootServerInfo; -import org.openapijsonschematools.client.apis.tags.User; -import org.openapijsonschematools.client.paths.userlogin.get.UserloginGetResponses; - -import java.io.IOException; -import java.util.Arrays; -import java.util.List; -import java.util.Map; -import java.util.AbstractMap; - -// if you want to use a server that is not SERVER_0 pass it in here and change the ServerIndex input below -ApiConfiguration.ServerInfo serverInfo = new ApiConfiguration.ServerInfoBuilder() - .rootServerInfo( - new RootServerInfo.RootServerInfoBuilder() - .rootServer0(new RootServer0()) - .build() - ) - .build(); -ApiConfiguration.ServerIndexInfo serverIndexInfo = new ApiConfiguration.ServerIndexInfoBuilder() - .rootServerInfoServerIndex(RootServerInfo.ServerIndex.SERVER_0) - .build(); -Duration timeout = Duration.ofSeconds(1L); -Map> defaultHeaders = Map.of("User-Agent", List.of("OpenAPI-JSON-Schema-Generator/1.0.0/java")); -ApiConfiguration apiConfiguration = new ApiConfiguration( - serverInfo - serverIndexInfo, - timeout, - defaultHeaders -); -SchemaConfiguration schemaConfiguration = new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().build()); -User apiClient = new User(apiConfiguration, schemaConfiguration); - - -// Map validation -UserloginGetQueryParameters.QueryParametersMap queryParameters = - UserloginGetQueryParameters.UserloginGetQueryParameters1.validate( - new UserloginGetQueryParameters.QueryParametersMapBuilder() - .password("a") - - .username("a") - - .build(), - schemaConfiguration -); - -var request = new UserloginGet.GetRequestBuilder() - .queryParameters(queryParameters) - .build(); - -UserloginGetResponses.EndpointResponse response; -try { - response = apiClient.get(request); -} catch (UserloginGetCode400Response.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; -} -UserloginGetResponses.EndpointUserloginGetCode200Response castResponse = (UserloginGetResponses.EndpointUserloginGetCode200Response) response; -if (castResponse.body instanceof UserloginGetCode200Response.ApplicationxmlResponseBody deserializedBody) { - // handle deserialized body here -} else { - UserloginGetCode200Response.ApplicationjsonResponseBody deserializedBody = (UserloginGetCode200Response.ApplicationjsonResponseBody) castResponse.body; - // handle deserialized body here -} -``` -### deleteUser -public [UserusernameDeleteResponses.EndpointResponse](../../paths/userusername/delete/UserusernameDeleteResponses.md#endpointresponse) deleteUser([UserusernameDelete.DeleteRequest](../../paths/userusername/UserusernameDelete.md#deleterequest) request) - -This can only be done by the logged in user. - -**Parameters:**
-request - the input request - -**Returns:**
-the deserialized response - -**Throws:**
-IOException, InterruptedException - an exception happened when making the request
-ValidationException - the returned response body or header values do not conform the the schema validation requirements
-NotImplementedException - the request body serialization or deserialization has not yet been implemented
- or the header content type deserialization has not yet been implemented for this contentType
-ApiException - server returned a response/contentType not defined in the openapi document
- -#### 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.userusername.delete.UserusernameDeletePathParameters; -import org.openapijsonschematools.client.servers.RootServer0; -import org.openapijsonschematools.client.servers.RootServer1; -import org.openapijsonschematools.client.servers.RootServer2; -import org.openapijsonschematools.client.paths.userusername.delete.responses.UserusernameDeleteCode200Response; -import org.openapijsonschematools.client.paths.userusername.delete.responses.UserusernameDeleteCode404Response; -import org.openapijsonschematools.client.servers.RootServerInfo; -import org.openapijsonschematools.client.apis.tags.User; -import org.openapijsonschematools.client.paths.userusername.delete.UserusernameDeleteResponses; - -import java.io.IOException; -import java.util.Arrays; -import java.util.List; -import java.util.Map; -import java.util.AbstractMap; - -// if you want to use a server that is not SERVER_0 pass it in here and change the ServerIndex input below -ApiConfiguration.ServerInfo serverInfo = new ApiConfiguration.ServerInfoBuilder() - .rootServerInfo( - new RootServerInfo.RootServerInfoBuilder() - .rootServer0(new RootServer0()) - .build() - ) - .build(); -ApiConfiguration.ServerIndexInfo serverIndexInfo = new ApiConfiguration.ServerIndexInfoBuilder() - .rootServerInfoServerIndex(RootServerInfo.ServerIndex.SERVER_0) - .build(); -Duration timeout = Duration.ofSeconds(1L); -Map> defaultHeaders = Map.of("User-Agent", List.of("OpenAPI-JSON-Schema-Generator/1.0.0/java")); -ApiConfiguration apiConfiguration = new ApiConfiguration( - serverInfo - serverIndexInfo, - timeout, - defaultHeaders -); -SchemaConfiguration schemaConfiguration = new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().build()); -User apiClient = new User(apiConfiguration, schemaConfiguration); - - -// Map validation -UserusernameDeletePathParameters.PathParametersMap pathParameters = - UserusernameDeletePathParameters.UserusernameDeletePathParameters1.validate( - new UserusernameDeletePathParameters.PathParametersMapBuilder() - .username("a") - - .build(), - schemaConfiguration -); - -var request = new UserusernameDelete.DeleteRequestBuilder() - .pathParameters(pathParameters) - .build(); - -UserusernameDeleteResponses.EndpointResponse response; -try { - response = apiClient.delete(request); -} catch (UserusernameDeleteCode404Response.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; -} -UserusernameDeleteResponses.EndpointUserusernameDeleteCode200Response castResponse = (UserusernameDeleteResponses.EndpointUserusernameDeleteCode200Response) response; -``` -### getUserByName -public [UserusernameGetResponses.EndpointResponse](../../paths/userusername/get/UserusernameGetResponses.md#endpointresponse) getUserByName([UserusernameGet.GetRequest](../../paths/userusername/UserusernameGet.md#getrequest) request) - - - -**Parameters:**
-request - the input request - -**Returns:**
-the deserialized response - -**Throws:**
-IOException, InterruptedException - an exception happened when making the request
-ValidationException - the returned response body or header values do not conform the the schema validation requirements
-NotImplementedException - the request body serialization or deserialization has not yet been implemented
- or the header content type deserialization has not yet been implemented for this contentType
-ApiException - server returned a response/contentType not defined in the openapi document
- -#### 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.userusername.get.UserusernameGetPathParameters; -import org.openapijsonschematools.client.servers.RootServer0; -import org.openapijsonschematools.client.servers.RootServer1; -import org.openapijsonschematools.client.servers.RootServer2; -import org.openapijsonschematools.client.paths.userusername.get.responses.UserusernameGetCode200Response; -import org.openapijsonschematools.client.paths.userusername.get.responses.UserusernameGetCode400Response; -import org.openapijsonschematools.client.paths.userusername.get.responses.UserusernameGetCode404Response; -import org.openapijsonschematools.client.servers.RootServerInfo; -import org.openapijsonschematools.client.apis.tags.User; -import org.openapijsonschematools.client.paths.userusername.get.UserusernameGetResponses; - -import java.io.IOException; -import java.util.Arrays; -import java.util.List; -import java.util.Map; -import java.util.AbstractMap; - -// if you want to use a server that is not SERVER_0 pass it in here and change the ServerIndex input below -ApiConfiguration.ServerInfo serverInfo = new ApiConfiguration.ServerInfoBuilder() - .rootServerInfo( - new RootServerInfo.RootServerInfoBuilder() - .rootServer0(new RootServer0()) - .build() - ) - .build(); -ApiConfiguration.ServerIndexInfo serverIndexInfo = new ApiConfiguration.ServerIndexInfoBuilder() - .rootServerInfoServerIndex(RootServerInfo.ServerIndex.SERVER_0) - .build(); -Duration timeout = Duration.ofSeconds(1L); -Map> defaultHeaders = Map.of("User-Agent", List.of("OpenAPI-JSON-Schema-Generator/1.0.0/java")); -ApiConfiguration apiConfiguration = new ApiConfiguration( - serverInfo - serverIndexInfo, - timeout, - defaultHeaders -); -SchemaConfiguration schemaConfiguration = new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().build()); -User apiClient = new User(apiConfiguration, schemaConfiguration); - - -// Map validation -UserusernameGetPathParameters.PathParametersMap pathParameters = - UserusernameGetPathParameters.UserusernameGetPathParameters1.validate( - new UserusernameGetPathParameters.PathParametersMapBuilder() - .username("a") - - .build(), - schemaConfiguration -); - -var request = new UserusernameGet.GetRequestBuilder() - .pathParameters(pathParameters) - .build(); - -UserusernameGetResponses.EndpointResponse response; -try { - response = apiClient.get(request); -} catch (UserusernameGetCode400Response.ResponseApiException | UserusernameGetCode404Response.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; -} -UserusernameGetResponses.EndpointUserusernameGetCode200Response castResponse = (UserusernameGetResponses.EndpointUserusernameGetCode200Response) response; -if (castResponse.body instanceof UserusernameGetCode200Response.ApplicationxmlResponseBody deserializedBody) { - // handle deserialized body here -} else { - UserusernameGetCode200Response.ApplicationjsonResponseBody deserializedBody = (UserusernameGetCode200Response.ApplicationjsonResponseBody) castResponse.body; - // handle deserialized body here -} -``` -### updateUser -public Nothing? updateUser([UserusernamePut.PutRequest](../../paths/userusername/UserusernamePut.md#putrequest) request) - -This can only be done by the logged in user. - -**Parameters:**
-request - the input request - -**Returns:**
-nothing (Nothing?) - -**Throws:**
-IOException, InterruptedException - an exception happened when making the request
-ValidationException - the returned response body or header values do not conform the the schema validation requirements
-NotImplementedException - the request body serialization or deserialization has not yet been implemented
- or the header content type deserialization has not yet been implemented for this contentType
-ApiException - server returned a response/contentType not defined in the openapi document
- -#### 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.userusername.put.UserusernamePutRequestBody; -import org.openapijsonschematools.client.components.schemas.User; -import org.openapijsonschematools.client.paths.userusername.put.UserusernamePutPathParameters; -import org.openapijsonschematools.client.servers.RootServer0; -import org.openapijsonschematools.client.servers.RootServer1; -import org.openapijsonschematools.client.servers.RootServer2; -import org.openapijsonschematools.client.paths.userusername.put.responses.UserusernamePutCode400Response; -import org.openapijsonschematools.client.paths.userusername.put.responses.UserusernamePutCode404Response; -import org.openapijsonschematools.client.servers.RootServerInfo; -import org.openapijsonschematools.client.apis.tags.User; -import org.openapijsonschematools.client.paths.userusername.put.UserusernamePutResponses; - -import java.io.IOException; -import java.util.Arrays; -import java.util.List; -import java.util.Map; -import java.util.AbstractMap; - -// if you want to use a server that is not SERVER_0 pass it in here and change the ServerIndex input below -ApiConfiguration.ServerInfo serverInfo = new ApiConfiguration.ServerInfoBuilder() - .rootServerInfo( - new RootServerInfo.RootServerInfoBuilder() - .rootServer0(new RootServer0()) - .build() - ) - .build(); -ApiConfiguration.ServerIndexInfo serverIndexInfo = new ApiConfiguration.ServerIndexInfoBuilder() - .rootServerInfoServerIndex(RootServerInfo.ServerIndex.SERVER_0) - .build(); -Duration timeout = Duration.ofSeconds(1L); -Map> defaultHeaders = Map.of("User-Agent", List.of("OpenAPI-JSON-Schema-Generator/1.0.0/java")); -ApiConfiguration apiConfiguration = new ApiConfiguration( - serverInfo - serverIndexInfo, - timeout, - defaultHeaders -); -SchemaConfiguration schemaConfiguration = new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().build()); -User apiClient = new User(apiConfiguration, schemaConfiguration); - - -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 -); -UserusernamePut.SealedRequestBody requestBody = new UserusernamePut.ApplicationjsonRequestBody(requestBodyPayload); - -// Map validation -UserusernamePutPathParameters.PathParametersMap pathParameters = - UserusernamePutPathParameters.UserusernamePutPathParameters1.validate( - new UserusernamePutPathParameters.PathParametersMapBuilder() - .username("a") - - .build(), - schemaConfiguration -); - -var request = new UserusernamePut.PutRequestBuilder() - .requestBody(requestBody) - .pathParameters(pathParameters) - .build(); - -Nothing? response; -try { - response = apiClient.put(request); -} catch (UserusernamePutCode400Response.ResponseApiException | UserusernamePutCode404Response.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; -} -``` -### createUsersWithListInput -public [UsercreatewithlistPostResponses.EndpointResponse](../../paths/usercreatewithlist/post/UsercreatewithlistPostResponses.md#endpointresponse) createUsersWithListInput([UsercreatewithlistPost.PostRequest](../../paths/usercreatewithlist/UsercreatewithlistPost.md#postrequest) request) - - - -**Parameters:**
-request - the input request - -**Returns:**
-the deserialized response - -**Throws:**
-IOException, InterruptedException - an exception happened when making the request
-ValidationException - the returned response body or header values do not conform the the schema validation requirements
-NotImplementedException - the request body serialization or deserialization has not yet been implemented
- or the header content type deserialization has not yet been implemented for this contentType
-ApiException - server returned a response/contentType not defined in the openapi document
- -#### 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.UsercreatewithlistPostRequestBody; -import org.openapijsonschematools.client.components.requestbodies.userarray.content.applicationjson.ApplicationjsonSchema; -import org.openapijsonschematools.client.servers.RootServer0; -import org.openapijsonschematools.client.servers.RootServer1; -import org.openapijsonschematools.client.servers.RootServer2; -import org.openapijsonschematools.client.paths.usercreatewithlist.post.responses.UsercreatewithlistPostCodedefaultResponse; -import org.openapijsonschematools.client.servers.RootServerInfo; -import org.openapijsonschematools.client.apis.tags.User; -import org.openapijsonschematools.client.paths.usercreatewithlist.post.UsercreatewithlistPostResponses; - -import java.io.IOException; -import java.util.Arrays; -import java.util.List; -import java.util.Map; -import java.util.AbstractMap; - -// if you want to use a server that is not SERVER_0 pass it in here and change the ServerIndex input below -ApiConfiguration.ServerInfo serverInfo = new ApiConfiguration.ServerInfoBuilder() - .rootServerInfo( - new RootServerInfo.RootServerInfoBuilder() - .rootServer0(new RootServer0()) - .build() - ) - .build(); -ApiConfiguration.ServerIndexInfo serverIndexInfo = new ApiConfiguration.ServerIndexInfoBuilder() - .rootServerInfoServerIndex(RootServerInfo.ServerIndex.SERVER_0) - .build(); -Duration timeout = Duration.ofSeconds(1L); -Map> defaultHeaders = Map.of("User-Agent", List.of("OpenAPI-JSON-Schema-Generator/1.0.0/java")); -ApiConfiguration apiConfiguration = new ApiConfiguration( - serverInfo - serverIndexInfo, - timeout, - defaultHeaders -); -SchemaConfiguration schemaConfiguration = new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().build()); -User apiClient = new User(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 -); -UsercreatewithlistPostRequestBody.SealedRequestBody requestBody = new UsercreatewithlistPostRequestBody.ApplicationjsonRequestBody(requestBodyPayload); - -var request = new UsercreatewithlistPost.PostRequestBuilder() - .requestBody(requestBody) - .build(); - -UsercreatewithlistPostResponses.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; -} -UsercreatewithlistPostResponses.EndpointUsercreatewithlistPostCodedefaultResponse castResponse = (UsercreatewithlistPostResponses.EndpointUsercreatewithlistPostCodedefaultResponse) response; -``` -[[Back to top]](#top) [[Back to README]](../../../README.md) diff --git a/samples/client/petstore/kotlin/docs/components/headers/Int32JsonContentTypeHeader.md b/samples/client/petstore/kotlin/docs/components/headers/Int32JsonContentTypeHeader.md deleted file mode 100644 index f6c5519399b..00000000000 --- a/samples/client/petstore/kotlin/docs/components/headers/Int32JsonContentTypeHeader.md +++ /dev/null @@ -1,59 +0,0 @@ -# Int32JsonContentTypeHeader -Int32JsonContentTypeHeader.java - -public class Int32JsonContentTypeHeader - -A class that contains necessary nested header classes -- a class that implements MediaType to store content schema info -- a class that extends SchemaHeader/ContentHeader and is used to deserialize the header value - -## Nested Class Summary -| Modifier and Type | Class and Description | -| ----------------- | --------------------- | -| record | [Int32JsonContentTypeHeader.ApplicationjsonMediaType](#applicationjsonmediatype)
record storing schema + encoding for a specific contentType | -| static class | [Int32JsonContentTypeHeader.Int32JsonContentTypeHeader1](#int32jsoncontenttypeheader1)
class that deserializes a header | - - -## ApplicationjsonMediaType -public record ApplicationjsonMediaType
-implements [MediaType<[Int32JsonContentTypeHeaderSchema.Int32JsonContentTypeHeaderSchema1](../../components/headers/int32jsoncontenttypeheader/content/applicationjson/Int32JsonContentTypeHeaderSchema.md#int32jsoncontenttypeheaderschema1), Nothing?> - -class storing schema info for a specific contentType - -### Constructor Summary -| Constructor and Description | -| --------------------------- | -| ApplicationjsonMediaType()
Creates an instance | - -### Method Summary -| Modifier and Type | Method and Description | -| ----------------- | ---------------------- | -| [Int32JsonContentTypeHeaderSchema.Int32JsonContentTypeHeaderSchema1](../../components/headers/int32jsoncontenttypeheader/content/applicationjson/Int32JsonContentTypeHeaderSchema.md#int32jsoncontenttypeheaderschema1) | schema()
the schema for this MediaType | -| Nothing? | encoding()
the encoding info | - -## Int32JsonContentTypeHeader1 -public static class Int32JsonContentTypeHeader1 implements Header
- -a class that deserializes a header value - -### Constructor Summary -| Constructor and Description | -| --------------------------- | -| Int32JsonContentTypeHeader1()
Creates an instance | - -### Field Summary -| Modifier and Type | Field and Description | -| ----------------- | --------------------- | -| boolean | required = true
whether the header is required | -| @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 | - -### Method Summary -| Modifier and Type | Method and Description | -| ----------------- | ---------------------- | -| HttpHeaders | serialize(@Nullable Object inData, String name, boolean validate, SchemaConfiguration configuration) | -| @Nullable Object | deserialize(List<String> inData, boolean validate, SchemaConfiguration configuration)
deserializes the header value | - -[[Back to top]](#top) [[Back to Component Headers]](../../../README.md#Component-Headers) [[Back to README]](../../../README.md) diff --git a/samples/client/petstore/kotlin/docs/components/headers/NumberHeader.md b/samples/client/petstore/kotlin/docs/components/headers/NumberHeader.md deleted file mode 100644 index 256af35dc9d..00000000000 --- a/samples/client/petstore/kotlin/docs/components/headers/NumberHeader.md +++ /dev/null @@ -1,40 +0,0 @@ -# NumberHeader -NumberHeader.java - -public class NumberHeader - -A class that contains necessary nested header classes -- a class that extends SchemaHeader/ContentHeader and is used to deserialize the header value - -## Nested Class Summary -| Modifier and Type | Class and Description | -| ----------------- | --------------------- | -| static class | [NumberHeader.NumberHeader1](#numberheader1)
class that deserializes a header | - - -## NumberHeader1 -public static class NumberHeader1 implements Header
- -a class that deserializes a header value - -### Constructor Summary -| Constructor and Description | -| --------------------------- | -| NumberHeader1()
Creates an instance | - -### Field Summary -| Modifier and Type | Field and Description | -| ----------------- | --------------------- | -| boolean | required = false
whether the header is required | -| @Nullable ParameterStyle | ParameterStyle.SIMPLE | -| @Nullable Boolean explode | false | -| @Nullable Boolean allowReserved | null | -| JsonSchema | schema = [NumberHeaderSchema.NumberHeaderSchema1](../../components/headers/numberheader/NumberHeaderSchema.md#numberheaderschema1)().getInstance() - -### Method Summary -| Modifier and Type | Method and Description | -| ----------------- | ---------------------- | -| HttpHeaders | serialize(@Nullable Object inData, String name, boolean validate, SchemaConfiguration configuration) | -| @Nullable Object | deserialize(List<String> inData, boolean validate, SchemaConfiguration configuration)
deserializes the header value | - -[[Back to top]](#top) [[Back to Component Headers]](../../../README.md#Component-Headers) [[Back to README]](../../../README.md) diff --git a/samples/client/petstore/kotlin/docs/components/headers/RefContentSchemaHeader.md b/samples/client/petstore/kotlin/docs/components/headers/RefContentSchemaHeader.md deleted file mode 100644 index 9ef5b1476f2..00000000000 --- a/samples/client/petstore/kotlin/docs/components/headers/RefContentSchemaHeader.md +++ /dev/null @@ -1,59 +0,0 @@ -# RefContentSchemaHeader -RefContentSchemaHeader.java - -public class RefContentSchemaHeader - -A class that contains necessary nested header classes -- a class that implements MediaType to store content schema info -- a class that extends SchemaHeader/ContentHeader and is used to deserialize the header value - -## Nested Class Summary -| Modifier and Type | Class and Description | -| ----------------- | --------------------- | -| record | [RefContentSchemaHeader.ApplicationjsonMediaType](#applicationjsonmediatype)
record storing schema + encoding for a specific contentType | -| static class | [RefContentSchemaHeader.RefContentSchemaHeader1](#refcontentschemaheader1)
class that deserializes a header | - - -## ApplicationjsonMediaType -public record ApplicationjsonMediaType
-implements [MediaType<[RefContentSchemaHeaderSchema.RefContentSchemaHeaderSchema1](../../components/headers/refcontentschemaheader/content/applicationjson/RefContentSchemaHeaderSchema.md#refcontentschemaheaderschema1), Nothing?> - -class storing schema info for a specific contentType - -### Constructor Summary -| Constructor and Description | -| --------------------------- | -| ApplicationjsonMediaType()
Creates an instance | - -### Method Summary -| Modifier and Type | Method and Description | -| ----------------- | ---------------------- | -| [RefContentSchemaHeaderSchema.RefContentSchemaHeaderSchema1](../../components/headers/refcontentschemaheader/content/applicationjson/RefContentSchemaHeaderSchema.md#refcontentschemaheaderschema1) | schema()
the schema for this MediaType | -| Nothing? | encoding()
the encoding info | - -## RefContentSchemaHeader1 -public static class RefContentSchemaHeader1 implements Header
- -a class that deserializes a header value - -### Constructor Summary -| Constructor and Description | -| --------------------------- | -| RefContentSchemaHeader1()
Creates an instance | - -### Field Summary -| Modifier and Type | Field and Description | -| ----------------- | --------------------- | -| boolean | required = true
whether the header is required | -| @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 | - -### Method Summary -| Modifier and Type | Method and Description | -| ----------------- | ---------------------- | -| HttpHeaders | serialize(@Nullable Object inData, String name, boolean validate, SchemaConfiguration configuration) | -| @Nullable Object | deserialize(List<String> inData, boolean validate, SchemaConfiguration configuration)
deserializes the header value | - -[[Back to top]](#top) [[Back to Component Headers]](../../../README.md#Component-Headers) [[Back to README]](../../../README.md) diff --git a/samples/client/petstore/kotlin/docs/components/headers/RefSchemaHeader.md b/samples/client/petstore/kotlin/docs/components/headers/RefSchemaHeader.md deleted file mode 100644 index 16ce5cb2b72..00000000000 --- a/samples/client/petstore/kotlin/docs/components/headers/RefSchemaHeader.md +++ /dev/null @@ -1,40 +0,0 @@ -# RefSchemaHeader -RefSchemaHeader.java - -public class RefSchemaHeader - -A class that contains necessary nested header classes -- a class that extends SchemaHeader/ContentHeader and is used to deserialize the header value - -## Nested Class Summary -| Modifier and Type | Class and Description | -| ----------------- | --------------------- | -| static class | [RefSchemaHeader.RefSchemaHeader1](#refschemaheader1)
class that deserializes a header | - - -## RefSchemaHeader1 -public static class RefSchemaHeader1 implements Header
- -a class that deserializes a header value - -### Constructor Summary -| Constructor and Description | -| --------------------------- | -| RefSchemaHeader1()
Creates an instance | - -### Field Summary -| Modifier and Type | Field and Description | -| ----------------- | --------------------- | -| boolean | required = true
whether the header is required | -| @Nullable ParameterStyle | ParameterStyle.SIMPLE | -| @Nullable Boolean explode | false | -| @Nullable Boolean allowReserved | null | -| JsonSchema | schema = [RefSchemaHeaderSchema.RefSchemaHeaderSchema1](../../components/headers/refschemaheader/RefSchemaHeaderSchema.md#refschemaheaderschema1)().getInstance() - -### Method Summary -| Modifier and Type | Method and Description | -| ----------------- | ---------------------- | -| HttpHeaders | serialize(@Nullable Object inData, String name, boolean validate, SchemaConfiguration configuration) | -| @Nullable Object | deserialize(List<String> inData, boolean validate, SchemaConfiguration configuration)
deserializes the header value | - -[[Back to top]](#top) [[Back to Component Headers]](../../../README.md#Component-Headers) [[Back to README]](../../../README.md) diff --git a/samples/client/petstore/kotlin/docs/components/headers/RefStringHeader.md b/samples/client/petstore/kotlin/docs/components/headers/RefStringHeader.md deleted file mode 100644 index 8944cf49914..00000000000 --- a/samples/client/petstore/kotlin/docs/components/headers/RefStringHeader.md +++ /dev/null @@ -1,20 +0,0 @@ -# RefStringHeader -RefStringHeader.java - -public class RefStringHeader extends [StringHeader](../../components/headers/StringHeader.md) - -A class (extended from the $ref class) that contains necessary nested header classes -- a class that extends SchemaHeader/ContentHeader and is used to deserialize header content - -## Nested Class Summary -| Modifier and Type | Class and Description | -| ----------------- | --------------------- | -| static class | [RefStringHeader.RefStringHeader1](#refstringheader1)
class that deserializes header value | - -## RefStringHeader1 -public static class RefStringHeader1 extends [StringHeader](../../components/headers/StringHeader.md#stringheader1)
- -a class that deserializes header, extended from the $ref class - - -[[Back to top]](#top) [[Back to Component Headers]](../../../README.md#Component-Headers) [[Back to README]](../../../README.md) diff --git a/samples/client/petstore/kotlin/docs/components/headers/StringHeader.md b/samples/client/petstore/kotlin/docs/components/headers/StringHeader.md deleted file mode 100644 index f36d77eb648..00000000000 --- a/samples/client/petstore/kotlin/docs/components/headers/StringHeader.md +++ /dev/null @@ -1,40 +0,0 @@ -# StringHeader -StringHeader.java - -public class StringHeader - -A class that contains necessary nested header classes -- a class that extends SchemaHeader/ContentHeader and is used to deserialize the header value - -## Nested Class Summary -| Modifier and Type | Class and Description | -| ----------------- | --------------------- | -| static class | [StringHeader.StringHeader1](#stringheader1)
class that deserializes a header | - - -## StringHeader1 -public static class StringHeader1 implements Header
- -a class that deserializes a header value - -### Constructor Summary -| Constructor and Description | -| --------------------------- | -| StringHeader1()
Creates an instance | - -### Field Summary -| Modifier and Type | Field and Description | -| ----------------- | --------------------- | -| boolean | required = true
whether the header is required | -| @Nullable ParameterStyle | ParameterStyle.SIMPLE | -| @Nullable Boolean explode | false | -| @Nullable Boolean allowReserved | null | -| JsonSchema | schema = [StringHeaderSchema.StringHeaderSchema1](../../components/headers/stringheader/StringHeaderSchema.md#stringheaderschema1)().getInstance() - -### Method Summary -| Modifier and Type | Method and Description | -| ----------------- | ---------------------- | -| HttpHeaders | serialize(@Nullable Object inData, String name, boolean validate, SchemaConfiguration configuration) | -| @Nullable Object | deserialize(List<String> inData, boolean validate, SchemaConfiguration configuration)
deserializes the header value | - -[[Back to top]](#top) [[Back to Component Headers]](../../../README.md#Component-Headers) [[Back to README]](../../../README.md) diff --git a/samples/client/petstore/kotlin/docs/components/headers/int32jsoncontenttypeheader/content/applicationjson/Int32JsonContentTypeHeaderSchema.md b/samples/client/petstore/kotlin/docs/components/headers/int32jsoncontenttypeheader/content/applicationjson/Int32JsonContentTypeHeaderSchema.md deleted file mode 100644 index de1f0ba7c0b..00000000000 --- a/samples/client/petstore/kotlin/docs/components/headers/int32jsoncontenttypeheader/content/applicationjson/Int32JsonContentTypeHeaderSchema.md +++ /dev/null @@ -1,49 +0,0 @@ -# Int32JsonContentTypeHeaderSchema -public class Int32JsonContentTypeHeaderSchema
- -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 - -## Nested Class Summary -| Modifier and Type | Class and Description | -| ----------------- | ---------------------- | -| sealed interface | [Int32JsonContentTypeHeaderSchema.Int32JsonContentTypeHeaderSchema1Boxed](#int32jsoncontenttypeheaderschema1boxed)
sealed interface for validated payloads | -| record | [Int32JsonContentTypeHeaderSchema.Int32JsonContentTypeHeaderSchema1BoxedNumber](#int32jsoncontenttypeheaderschema1boxednumber)
boxed class to store validated Number payloads | -| static class | [Int32JsonContentTypeHeaderSchema.Int32JsonContentTypeHeaderSchema1](#int32jsoncontenttypeheaderschema1)
schema class | - -## Int32JsonContentTypeHeaderSchema1Boxed -public sealed interface Int32JsonContentTypeHeaderSchema1Boxed
-permits
-[Int32JsonContentTypeHeaderSchema1BoxedNumber](#int32jsoncontenttypeheaderschema1boxednumber) - -sealed interface that stores validated payloads using boxed classes - -## Int32JsonContentTypeHeaderSchema1BoxedNumber -public record Int32JsonContentTypeHeaderSchema1BoxedNumber
-implements [Int32JsonContentTypeHeaderSchema1Boxed](#int32jsoncontenttypeheaderschema1boxed) - -record that stores validated Number payloads, sealed permits implementation - -### Constructor Summary -| Constructor and Description | -| --------------------------- | -| Int32JsonContentTypeHeaderSchema1BoxedNumber(Number data)
Creates an instance, private visibility | - -### Method Summary -| Modifier and Type | Method and Description | -| ----------------- | ---------------------- | -| Number | data()
validated payload | -| @Nullable Object | getData()
validated payload | - -## Int32JsonContentTypeHeaderSchema1 -public static class Int32JsonContentTypeHeaderSchema1
-extends Int32JsonSchema.Int32JsonSchema1 - -A schema class that validates payloads - -| Methods Inherited from class org.openapijsonschematools.client.schemas.Int32JsonSchema.Int32JsonSchema1 | -| ------------------------------------------------------------------ | -| validate | -| validateAndBox | diff --git a/samples/client/petstore/kotlin/docs/components/headers/numberheader/NumberHeaderSchema.md b/samples/client/petstore/kotlin/docs/components/headers/numberheader/NumberHeaderSchema.md deleted file mode 100644 index 95b3751f87b..00000000000 --- a/samples/client/petstore/kotlin/docs/components/headers/numberheader/NumberHeaderSchema.md +++ /dev/null @@ -1,49 +0,0 @@ -# NumberHeaderSchema -public class NumberHeaderSchema
- -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 - -## Nested Class Summary -| Modifier and Type | Class and Description | -| ----------------- | ---------------------- | -| sealed interface | [NumberHeaderSchema.NumberHeaderSchema1Boxed](#numberheaderschema1boxed)
sealed interface for validated payloads | -| record | [NumberHeaderSchema.NumberHeaderSchema1BoxedString](#numberheaderschema1boxedstring)
boxed class to store validated String payloads | -| static class | [NumberHeaderSchema.NumberHeaderSchema1](#numberheaderschema1)
schema class | - -## NumberHeaderSchema1Boxed -public sealed interface NumberHeaderSchema1Boxed
-permits
-[NumberHeaderSchema1BoxedString](#numberheaderschema1boxedstring) - -sealed interface that stores validated payloads using boxed classes - -## NumberHeaderSchema1BoxedString -public record NumberHeaderSchema1BoxedString
-implements [NumberHeaderSchema1Boxed](#numberheaderschema1boxed) - -record that stores validated String payloads, sealed permits implementation - -### Constructor Summary -| Constructor and Description | -| --------------------------- | -| NumberHeaderSchema1BoxedString(String data)
Creates an instance, private visibility | - -### Method Summary -| Modifier and Type | Method and Description | -| ----------------- | ---------------------- | -| String | data()
validated payload | -| @Nullable Object | getData()
validated payload | - -## NumberHeaderSchema1 -public static class NumberHeaderSchema1
-extends DecimalJsonSchema.DecimalJsonSchema1 - -A schema class that validates payloads - -| Methods Inherited from class org.openapijsonschematools.client.schemas.DecimalJsonSchema.DecimalJsonSchema1 | -| ------------------------------------------------------------------ | -| validate | -| validateAndBox | diff --git a/samples/client/petstore/kotlin/docs/components/headers/refcontentschemaheader/content/applicationjson/RefContentSchemaHeaderSchema.md b/samples/client/petstore/kotlin/docs/components/headers/refcontentschemaheader/content/applicationjson/RefContentSchemaHeaderSchema.md deleted file mode 100644 index 5453288c047..00000000000 --- a/samples/client/petstore/kotlin/docs/components/headers/refcontentschemaheader/content/applicationjson/RefContentSchemaHeaderSchema.md +++ /dev/null @@ -1,19 +0,0 @@ -# RefContentSchemaHeaderSchema -public class RefContentSchemaHeaderSchema
-extends [StringWithValidation1](../../../../../components/schemas/StringWithValidation.md#stringwithvalidation) - -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 - -## Nested Class Summary -| Modifier and Type | Class and Description | -| ----------------- | ---------------------- | -| static class | [RefContentSchemaHeaderSchema.RefContentSchemaHeaderSchema1](#refcontentschemaheaderschema1)
schema class | - -## RefContentSchemaHeaderSchema1 -public static class RefContentSchemaHeaderSchema1
-extends [StringWithValidation.StringWithValidation1](../../../../../components/schemas/StringWithValidation.md#stringwithvalidation1) - -A schema class that validates payloads diff --git a/samples/client/petstore/kotlin/docs/components/headers/refschemaheader/RefSchemaHeaderSchema.md b/samples/client/petstore/kotlin/docs/components/headers/refschemaheader/RefSchemaHeaderSchema.md deleted file mode 100644 index d73c936d9b6..00000000000 --- a/samples/client/petstore/kotlin/docs/components/headers/refschemaheader/RefSchemaHeaderSchema.md +++ /dev/null @@ -1,19 +0,0 @@ -# RefSchemaHeaderSchema -public class RefSchemaHeaderSchema
-extends [StringWithValidation1](../../../components/schemas/StringWithValidation.md#stringwithvalidation) - -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 - -## Nested Class Summary -| Modifier and Type | Class and Description | -| ----------------- | ---------------------- | -| static class | [RefSchemaHeaderSchema.RefSchemaHeaderSchema1](#refschemaheaderschema1)
schema class | - -## RefSchemaHeaderSchema1 -public static class RefSchemaHeaderSchema1
-extends [StringWithValidation.StringWithValidation1](../../../components/schemas/StringWithValidation.md#stringwithvalidation1) - -A schema class that validates payloads diff --git a/samples/client/petstore/kotlin/docs/components/headers/stringheader/StringHeaderSchema.md b/samples/client/petstore/kotlin/docs/components/headers/stringheader/StringHeaderSchema.md deleted file mode 100644 index a62142869f9..00000000000 --- a/samples/client/petstore/kotlin/docs/components/headers/stringheader/StringHeaderSchema.md +++ /dev/null @@ -1,49 +0,0 @@ -# StringHeaderSchema -public class StringHeaderSchema
- -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 - -## Nested Class Summary -| Modifier and Type | Class and Description | -| ----------------- | ---------------------- | -| sealed interface | [StringHeaderSchema.StringHeaderSchema1Boxed](#stringheaderschema1boxed)
sealed interface for validated payloads | -| record | [StringHeaderSchema.StringHeaderSchema1BoxedString](#stringheaderschema1boxedstring)
boxed class to store validated String payloads | -| static class | [StringHeaderSchema.StringHeaderSchema1](#stringheaderschema1)
schema class | - -## StringHeaderSchema1Boxed -public sealed interface StringHeaderSchema1Boxed
-permits
-[StringHeaderSchema1BoxedString](#stringheaderschema1boxedstring) - -sealed interface that stores validated payloads using boxed classes - -## StringHeaderSchema1BoxedString -public record StringHeaderSchema1BoxedString
-implements [StringHeaderSchema1Boxed](#stringheaderschema1boxed) - -record that stores validated String payloads, sealed permits implementation - -### Constructor Summary -| Constructor and Description | -| --------------------------- | -| StringHeaderSchema1BoxedString(String data)
Creates an instance, private visibility | - -### Method Summary -| Modifier and Type | Method and Description | -| ----------------- | ---------------------- | -| String | data()
validated payload | -| @Nullable Object | getData()
validated payload | - -## StringHeaderSchema1 -public static class StringHeaderSchema1
-extends StringJsonSchema.StringJsonSchema1 - -A schema class that validates payloads - -| Methods Inherited from class org.openapijsonschematools.client.schemas.StringJsonSchema.StringJsonSchema1 | -| ------------------------------------------------------------------ | -| validate | -| validateAndBox | diff --git a/samples/client/petstore/kotlin/docs/components/parameters/ComponentRefSchemaStringWithValidation.md b/samples/client/petstore/kotlin/docs/components/parameters/ComponentRefSchemaStringWithValidation.md deleted file mode 100644 index e94368970ec..00000000000 --- a/samples/client/petstore/kotlin/docs/components/parameters/ComponentRefSchemaStringWithValidation.md +++ /dev/null @@ -1,60 +0,0 @@ -# ComponentRefSchemaStringWithValidation -ComponentRefSchemaStringWithValidation.java - -public class ComponentRefSchemaStringWithValidation - -A class that contains necessary nested parameter classes -- a class that implements MediaType to store content schema info -- a class that extends SchemaHeader/ContentHeader and is used to deserialize the parameter value - -## Nested Class Summary -| Modifier and Type | Class and Description | -| ----------------- | --------------------- | -| record | [ComponentRefSchemaStringWithValidation.ApplicationjsonMediaType](#applicationjsonmediatype)
record storing schema + encoding for a specific contentType | -| static class | [ComponentRefSchemaStringWithValidation.ComponentRefSchemaStringWithValidation1](#componentrefschemastringwithvalidation1)
class that deserializes a parameter | - - -## ApplicationjsonMediaType -public record ApplicationjsonMediaType
-implements [MediaType<[ApplicationjsonSchema.ApplicationjsonSchema1](../../components/parameters/componentrefschemastringwithvalidation/content/applicationjson/ApplicationjsonSchema.md#applicationjsonschema1), Nothing?> - -class storing schema info for a specific contentType - -### Constructor Summary -| Constructor and Description | -| --------------------------- | -| ApplicationjsonMediaType()
Creates an instance | - -### Method Summary -| Modifier and Type | Method and Description | -| ----------------- | ---------------------- | -| [ApplicationjsonSchema.ApplicationjsonSchema1](../../components/parameters/componentrefschemastringwithvalidation/content/applicationjson/ApplicationjsonSchema.md#applicationjsonschema1) | schema()
the schema for this MediaType | -| Nothing? | encoding()
the encoding info | - -## ComponentRefSchemaStringWithValidation1 -public static class ComponentRefSchemaStringWithValidation1 extends ContentParameter
- -a class that deserializes a parameter value - -### Constructor Summary -| Constructor and Description | -| --------------------------- | -| ComponentRefSchemaStringWithValidation1()
Creates an instance | - -### Field Summary -| Modifier and Type | Field and Description | -| ----------------- | --------------------- | -| String | name = "CRSstringWithValidation"
the parameter name | -| ParameterInType | inType = ParameterInType.PATH
the parameter in value | -| boolean | required = true
whether the parameter is required | -| @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 | - -### Method Summary -| Modifier and Type | Method and Description | -| ----------------- | ---------------------- | -| Map | serialize(@Nullable Object inData, boolean validate, SchemaConfiguration configuration)
deserializes the parameter value | - -[[Back to top]](#top) [[Back to Component Parameters]](../../../README.md#Component-Parameters) [[Back to README]](../../../README.md) diff --git a/samples/client/petstore/kotlin/docs/components/parameters/PathUserName.md b/samples/client/petstore/kotlin/docs/components/parameters/PathUserName.md deleted file mode 100644 index 01289864ea2..00000000000 --- a/samples/client/petstore/kotlin/docs/components/parameters/PathUserName.md +++ /dev/null @@ -1,41 +0,0 @@ -# PathUserName -PathUserName.java - -public class PathUserName - -A class that contains necessary nested parameter classes -- a class that extends SchemaHeader/ContentHeader and is used to deserialize the parameter value - -## Nested Class Summary -| Modifier and Type | Class and Description | -| ----------------- | --------------------- | -| static class | [PathUserName.PathUserName1](#pathusername1)
class that deserializes a parameter | - - -## PathUserName1 -public static class PathUserName1 extends SchemaParameter
- -a class that deserializes a parameter value - -### Constructor Summary -| Constructor and Description | -| --------------------------- | -| PathUserName1()
Creates an instance | - -### Field Summary -| Modifier and Type | Field and Description | -| ----------------- | --------------------- | -| String | name = "username"
the parameter name | -| ParameterInType | inType = ParameterInType.PATH
the parameter in value | -| boolean | required = true
whether the parameter is required | -| @Nullable Boolean explode | false | -| @Nullable ParameterStyle | ParameterStyle.SIMPLE | -| @Nullable Boolean allowReserved | false | -| JsonSchema | schema = [Schema.Schema1](../../components/parameters/pathusername/Schema.md#schema1)().getInstance() - -### Method Summary -| Modifier and Type | Method and Description | -| ----------------- | ---------------------- | -| Map | serialize(@Nullable Object inData, boolean validate, SchemaConfiguration configuration)
deserializes the parameter value | - -[[Back to top]](#top) [[Back to Component Parameters]](../../../README.md#Component-Parameters) [[Back to README]](../../../README.md) diff --git a/samples/client/petstore/kotlin/docs/components/parameters/RefPathUserName.md b/samples/client/petstore/kotlin/docs/components/parameters/RefPathUserName.md deleted file mode 100644 index 03c05b8b224..00000000000 --- a/samples/client/petstore/kotlin/docs/components/parameters/RefPathUserName.md +++ /dev/null @@ -1,20 +0,0 @@ -# RefPathUserName -RefPathUserName.java - -public class RefPathUserName extends [PathUserName](../../components/parameters/PathUserName.md) - -A class (extended from the $ref class) that contains necessary nested parameter classes -- a class that extends SchemaHeader/ContentHeader and is used to deserialize parameter content - -## Nested Class Summary -| Modifier and Type | Class and Description | -| ----------------- | --------------------- | -| static class | [RefPathUserName.RefPathUserName1](#refpathusername1)
class that deserializes parameter value | - -## RefPathUserName1 -public static class RefPathUserName1 extends [PathUserName](../../components/parameters/PathUserName.md#pathusername1)
- -a class that deserializes parameter, extended from the $ref class - - -[[Back to top]](#top) [[Back to Component Parameters]](../../../README.md#Component-Parameters) [[Back to README]](../../../README.md) diff --git a/samples/client/petstore/kotlin/docs/components/parameters/RefSchemaStringWithValidation.md b/samples/client/petstore/kotlin/docs/components/parameters/RefSchemaStringWithValidation.md deleted file mode 100644 index bd17acf394a..00000000000 --- a/samples/client/petstore/kotlin/docs/components/parameters/RefSchemaStringWithValidation.md +++ /dev/null @@ -1,41 +0,0 @@ -# RefSchemaStringWithValidation -RefSchemaStringWithValidation.java - -public class RefSchemaStringWithValidation - -A class that contains necessary nested parameter classes -- a class that extends SchemaHeader/ContentHeader and is used to deserialize the parameter value - -## Nested Class Summary -| Modifier and Type | Class and Description | -| ----------------- | --------------------- | -| static class | [RefSchemaStringWithValidation.RefSchemaStringWithValidation1](#refschemastringwithvalidation1)
class that deserializes a parameter | - - -## RefSchemaStringWithValidation1 -public static class RefSchemaStringWithValidation1 extends SchemaParameter
- -a class that deserializes a parameter value - -### Constructor Summary -| Constructor and Description | -| --------------------------- | -| RefSchemaStringWithValidation1()
Creates an instance | - -### Field Summary -| Modifier and Type | Field and Description | -| ----------------- | --------------------- | -| String | name = "RSstringWithValidation"
the parameter name | -| ParameterInType | inType = ParameterInType.PATH
the parameter in value | -| boolean | required = true
whether the parameter is required | -| @Nullable Boolean explode | false | -| @Nullable ParameterStyle | ParameterStyle.SIMPLE | -| @Nullable Boolean allowReserved | false | -| JsonSchema | schema = [Schema.Schema1](../../components/parameters/refschemastringwithvalidation/Schema.md#schema1)().getInstance() - -### Method Summary -| Modifier and Type | Method and Description | -| ----------------- | ---------------------- | -| Map | serialize(@Nullable Object inData, boolean validate, SchemaConfiguration configuration)
deserializes the parameter value | - -[[Back to top]](#top) [[Back to Component Parameters]](../../../README.md#Component-Parameters) [[Back to README]](../../../README.md) diff --git a/samples/client/petstore/kotlin/docs/components/parameters/componentrefschemastringwithvalidation/content/applicationjson/ApplicationjsonSchema.md b/samples/client/petstore/kotlin/docs/components/parameters/componentrefschemastringwithvalidation/content/applicationjson/ApplicationjsonSchema.md deleted file mode 100644 index 174f9e2adf9..00000000000 --- a/samples/client/petstore/kotlin/docs/components/parameters/componentrefschemastringwithvalidation/content/applicationjson/ApplicationjsonSchema.md +++ /dev/null @@ -1,19 +0,0 @@ -# ApplicationjsonSchema -public class ApplicationjsonSchema
-extends [StringWithValidation1](../../../../../components/schemas/StringWithValidation.md#stringwithvalidation) - -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 - -## Nested Class Summary -| Modifier and Type | Class and Description | -| ----------------- | ---------------------- | -| static class | [ApplicationjsonSchema.ApplicationjsonSchema1](#applicationjsonschema1)
schema class | - -## ApplicationjsonSchema1 -public static class ApplicationjsonSchema1
-extends [StringWithValidation.StringWithValidation1](../../../../../components/schemas/StringWithValidation.md#stringwithvalidation1) - -A schema class that validates payloads diff --git a/samples/client/petstore/kotlin/docs/components/parameters/pathusername/Schema.md b/samples/client/petstore/kotlin/docs/components/parameters/pathusername/Schema.md deleted file mode 100644 index 07b8e07c3a7..00000000000 --- a/samples/client/petstore/kotlin/docs/components/parameters/pathusername/Schema.md +++ /dev/null @@ -1,49 +0,0 @@ -# Schema -public class Schema
- -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 - -## Nested Class Summary -| Modifier and Type | Class and Description | -| ----------------- | ---------------------- | -| sealed interface | [Schema.Schema1Boxed](#schema1boxed)
sealed interface for validated payloads | -| record | [Schema.Schema1BoxedString](#schema1boxedstring)
boxed class to store validated String payloads | -| static class | [Schema.Schema1](#schema1)
schema class | - -## Schema1Boxed -public sealed interface Schema1Boxed
-permits
-[Schema1BoxedString](#schema1boxedstring) - -sealed interface that stores validated payloads using boxed classes - -## Schema1BoxedString -public record Schema1BoxedString
-implements [Schema1Boxed](#schema1boxed) - -record that stores validated String payloads, sealed permits implementation - -### Constructor Summary -| Constructor and Description | -| --------------------------- | -| Schema1BoxedString(String data)
Creates an instance, private visibility | - -### Method Summary -| Modifier and Type | Method and Description | -| ----------------- | ---------------------- | -| String | data()
validated payload | -| @Nullable Object | getData()
validated payload | - -## Schema1 -public static class Schema1
-extends StringJsonSchema.StringJsonSchema1 - -A schema class that validates payloads - -| Methods Inherited from class org.openapijsonschematools.client.schemas.StringJsonSchema.StringJsonSchema1 | -| ------------------------------------------------------------------ | -| validate | -| validateAndBox | diff --git a/samples/client/petstore/kotlin/docs/components/parameters/refschemastringwithvalidation/Schema.md b/samples/client/petstore/kotlin/docs/components/parameters/refschemastringwithvalidation/Schema.md deleted file mode 100644 index 29a01b850e9..00000000000 --- a/samples/client/petstore/kotlin/docs/components/parameters/refschemastringwithvalidation/Schema.md +++ /dev/null @@ -1,19 +0,0 @@ -# Schema -public class Schema
-extends [StringWithValidation1](../../../components/schemas/StringWithValidation.md#stringwithvalidation) - -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 - -## Nested Class Summary -| Modifier and Type | Class and Description | -| ----------------- | ---------------------- | -| static class | [Schema.Schema1](#schema1)
schema class | - -## Schema1 -public static class Schema1
-extends [StringWithValidation.StringWithValidation1](../../../components/schemas/StringWithValidation.md#stringwithvalidation1) - -A schema class that validates payloads diff --git a/samples/client/petstore/kotlin/docs/components/requestbodies/Client.md b/samples/client/petstore/kotlin/docs/components/requestbodies/Client.md deleted file mode 100644 index 6be7c0fca7a..00000000000 --- a/samples/client/petstore/kotlin/docs/components/requestbodies/Client.md +++ /dev/null @@ -1,93 +0,0 @@ -# Client -Client.java - -public class Client - -A class that contains necessary nested request body classes -- SealedMediaType, a sealed interface which contains all the schema/encoding info for each contentType -- records which implement SealedMediaType, the concrete media types -- a class that extends RequestBodySerializer and is used to serialize input SealedRequestBody instances -- SealedRequestBody, a sealed interface which contains all the contentType/schema input types -- records which implement SealedRequestBody, the concrete request body types - -## Nested Class Summary -| Modifier and Type | Class and Description | -| ----------------- | --------------------- | -| sealed interface | [Client.SealedMediaType](#sealedmediatype)
media type sealed interface | -| record | [Client.ApplicationjsonMediaType](#applicationjsonmediatype)
record storing schema + encoding for a specific contentType | -| static class | [Client.Client1](#client1)
class that serializes request bodies | -| sealed interface | [Client.SealedRequestBody](#sealedrequestbody)
request body sealed interface | -| record | [Client.ApplicationjsonRequestBody](#applicationjsonrequestbody)
implements sealed interface to store request body input | - -## SealedMediaType -public sealed interface SealedMediaType
-permits
-[ApplicationjsonMediaType](#applicationjsonmediatype) - -sealed interface that stores schema and encoding info - - -## ApplicationjsonMediaType -public record ApplicationjsonMediaType
-implements [SealedMediaType](#sealedmediatype), MediaType<[ApplicationjsonSchema.ApplicationjsonSchema1](../../components/requestbodies/client/content/applicationjson/ApplicationjsonSchema.md#applicationjsonschema1), Nothing?> - -class storing schema info for a specific contentType - -### Constructor Summary -| Constructor and Description | -| --------------------------- | -| ApplicationjsonMediaType()
Creates an instance | - -### Method Summary -| Modifier and Type | Method and Description | -| ----------------- | ---------------------- | -| [ApplicationjsonSchema.ApplicationjsonSchema1](../../components/requestbodies/client/content/applicationjson/ApplicationjsonSchema.md#applicationjsonschema1) | schema()
the schema for this MediaType | -| Nothing? | encoding()
the encoding info | - -## Client1 -public static class Client1
- -a class that serializes SealedRequestBody request bodies - -### Constructor Summary -| Constructor and Description | -| --------------------------- | -| Client1()
Creates an instance | - -### Field Summary -| Modifier and Type | Field and Description | -| ----------------- | --------------------- | -| boolean | required = true
whether the request body is required | -| 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 | -| ----------------- | ---------------------- | -| SerializedRequestBody | serialize([SealedRequestBody](#sealedrequestbody) requestBody)
called by endpoint when creating request body bytes | - -## SealedRequestBody -public sealed interface SealedRequestBody
-permits
-[ApplicationjsonRequestBody](#applicationjsonrequestbody) - -sealed interface that stores request contentType + validated schema data - -## ApplicationjsonRequestBody -public record ApplicationjsonRequestBody
-implements [SealedRequestBody](#sealedrequestbody),
-GenericRequestBody
- -A record class to store request body input for contentType="application/json" - -### Constructor Summary -| Constructor and Description | -| --------------------------- | -| ApplicationjsonRequestBody(ApplicationjsonSchema.[Client1Boxed](../../components/schemas/Client.md#client1boxed) body)
Creates an instance | - -### Method Summary -| Modifier and Type | Method and Description | -| ----------------- | ---------------------- | -| String | contentType()
always returns "application/json" | -| ApplicationjsonSchema.[Client1Boxed](../../components/schemas/Client.md#client1boxed) | body()
returns the body passed in in the constructor | - -[[Back to top]](#top) [[Back to Component RequestBodies]](../../../README.md#Component-RequestBodies) [[Back to README]](../../../README.md) diff --git a/samples/client/petstore/kotlin/docs/components/requestbodies/Pet.md b/samples/client/petstore/kotlin/docs/components/requestbodies/Pet.md deleted file mode 100644 index 307e3ad1c84..00000000000 --- a/samples/client/petstore/kotlin/docs/components/requestbodies/Pet.md +++ /dev/null @@ -1,131 +0,0 @@ -# Pet -Pet.java - -public class Pet - -A class that contains necessary nested request body classes -- SealedMediaType, a sealed interface which contains all the schema/encoding info for each contentType -- records which implement SealedMediaType, the concrete media types -- a class that extends RequestBodySerializer and is used to serialize input SealedRequestBody instances -- SealedRequestBody, a sealed interface which contains all the contentType/schema input types -- records which implement SealedRequestBody, the concrete request body types - -## Nested Class Summary -| Modifier and Type | Class and Description | -| ----------------- | --------------------- | -| sealed interface | [Pet.SealedMediaType](#sealedmediatype)
media type sealed interface | -| record | [Pet.ApplicationjsonMediaType](#applicationjsonmediatype)
record storing schema + encoding for a specific contentType | -| record | [Pet.ApplicationxmlMediaType](#applicationxmlmediatype)
record storing schema + encoding for a specific contentType | -| static class | [Pet.Pet1](#pet1)
class that serializes request bodies | -| sealed interface | [Pet.SealedRequestBody](#sealedrequestbody)
request body sealed interface | -| record | [Pet.ApplicationjsonRequestBody](#applicationjsonrequestbody)
implements sealed interface to store request body input | -| record | [Pet.ApplicationxmlRequestBody](#applicationxmlrequestbody)
implements sealed interface to store request body input | - -## SealedMediaType -public sealed interface SealedMediaType
-permits
-[ApplicationjsonMediaType](#applicationjsonmediatype), -[ApplicationxmlMediaType](#applicationxmlmediatype) - -sealed interface that stores schema and encoding info - - -## ApplicationjsonMediaType -public record ApplicationjsonMediaType
-implements [SealedMediaType](#sealedmediatype), MediaType<[ApplicationjsonSchema.ApplicationjsonSchema1](../../components/requestbodies/pet/content/applicationjson/ApplicationjsonSchema.md#applicationjsonschema1), Nothing?> - -class storing schema info for a specific contentType - -### Constructor Summary -| Constructor and Description | -| --------------------------- | -| ApplicationjsonMediaType()
Creates an instance | - -### Method Summary -| Modifier and Type | Method and Description | -| ----------------- | ---------------------- | -| [ApplicationjsonSchema.ApplicationjsonSchema1](../../components/requestbodies/pet/content/applicationjson/ApplicationjsonSchema.md#applicationjsonschema1) | schema()
the schema for this MediaType | -| Nothing? | encoding()
the encoding info | - -## ApplicationxmlMediaType -public record ApplicationxmlMediaType
-implements [SealedMediaType](#sealedmediatype), MediaType<[ApplicationxmlSchema.ApplicationxmlSchema1](../../components/requestbodies/pet/content/applicationxml/ApplicationxmlSchema.md#applicationxmlschema1), Nothing?> - -class storing schema info for a specific contentType - -### Constructor Summary -| Constructor and Description | -| --------------------------- | -| ApplicationxmlMediaType()
Creates an instance | - -### Method Summary -| Modifier and Type | Method and Description | -| ----------------- | ---------------------- | -| [ApplicationxmlSchema.ApplicationxmlSchema1](../../components/requestbodies/pet/content/applicationxml/ApplicationxmlSchema.md#applicationxmlschema1) | schema()
the schema for this MediaType | -| Nothing? | encoding()
the encoding info | - -## Pet1 -public static class Pet1
- -a class that serializes SealedRequestBody request bodies - -### Constructor Summary -| Constructor and Description | -| --------------------------- | -| Pet1()
Creates an instance | - -### Field Summary -| Modifier and Type | Field and Description | -| ----------------- | --------------------- | -| boolean | required = true
whether the request body is required | -| Map | content = Map.ofEntries(
    new AbstractMap.SimpleEntry<>("application/json", new [ApplicationjsonMediaType](#applicationjsonmediatype)()),
    new AbstractMap.SimpleEntry<>("application/xml", new [ApplicationxmlMediaType](#applicationxmlmediatype)())
)
the contentType to schema info | - -### Method Summary -| Modifier and Type | Method and Description | -| ----------------- | ---------------------- | -| SerializedRequestBody | serialize([SealedRequestBody](#sealedrequestbody) requestBody)
called by endpoint when creating request body bytes | - -## SealedRequestBody -public sealed interface SealedRequestBody
-permits
-[ApplicationjsonRequestBody](#applicationjsonrequestbody), -[ApplicationxmlRequestBody](#applicationxmlrequestbody) - -sealed interface that stores request contentType + validated schema data - -## ApplicationjsonRequestBody -public record ApplicationjsonRequestBody
-implements [SealedRequestBody](#sealedrequestbody),
-GenericRequestBody
- -A record class to store request body input for contentType="application/json" - -### Constructor Summary -| Constructor and Description | -| --------------------------- | -| ApplicationjsonRequestBody(ApplicationjsonSchema.[Pet1Boxed](../../components/schemas/Pet.md#pet1boxed) body)
Creates an instance | - -### Method Summary -| Modifier and Type | Method and Description | -| ----------------- | ---------------------- | -| String | contentType()
always returns "application/json" | -| ApplicationjsonSchema.[Pet1Boxed](../../components/schemas/Pet.md#pet1boxed) | body()
returns the body passed in in the constructor | -## ApplicationxmlRequestBody -public record ApplicationxmlRequestBody
-implements [SealedRequestBody](#sealedrequestbody),
-GenericRequestBody
- -A record class to store request body input for contentType="application/xml" - -### Constructor Summary -| Constructor and Description | -| --------------------------- | -| ApplicationxmlRequestBody(ApplicationxmlSchema.[Pet1Boxed](../../components/schemas/Pet.md#pet1boxed) body)
Creates an instance | - -### Method Summary -| Modifier and Type | Method and Description | -| ----------------- | ---------------------- | -| String | contentType()
always returns "application/xml" | -| ApplicationxmlSchema.[Pet1Boxed](../../components/schemas/Pet.md#pet1boxed) | body()
returns the body passed in in the constructor | - -[[Back to top]](#top) [[Back to Component RequestBodies]](../../../README.md#Component-RequestBodies) [[Back to README]](../../../README.md) diff --git a/samples/client/petstore/kotlin/docs/components/requestbodies/RefUserArray.md b/samples/client/petstore/kotlin/docs/components/requestbodies/RefUserArray.md deleted file mode 100644 index dbe40f61ba7..00000000000 --- a/samples/client/petstore/kotlin/docs/components/requestbodies/RefUserArray.md +++ /dev/null @@ -1,20 +0,0 @@ -# RefUserArray -RefUserArray.java - -public class RefUserArray 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 - -## Nested Class Summary -| Modifier and Type | Class and Description | -| ----------------- | --------------------- | -| static class | [RefUserArray.RefUserArray1](#refuserarray1)
class that serializes request bodies | - -## RefUserArray1 -public static class RefUserArray1 extends [UserArray1](../../components/requestbodies/UserArray.md#userarray1)
- -a class that serializes SealedRequestBody request bodies, extended from the $ref class - - -[[Back to top]](#top) [[Back to Component RequestBodies]](../../../README.md#Component-RequestBodies) [[Back to README]](../../../README.md) diff --git a/samples/client/petstore/kotlin/docs/components/requestbodies/UserArray.md b/samples/client/petstore/kotlin/docs/components/requestbodies/UserArray.md deleted file mode 100644 index 3a401b93f55..00000000000 --- a/samples/client/petstore/kotlin/docs/components/requestbodies/UserArray.md +++ /dev/null @@ -1,93 +0,0 @@ -# UserArray -UserArray.java - -public class UserArray - -A class that contains necessary nested request body classes -- SealedMediaType, a sealed interface which contains all the schema/encoding info for each contentType -- records which implement SealedMediaType, the concrete media types -- a class that extends RequestBodySerializer and is used to serialize input SealedRequestBody instances -- SealedRequestBody, a sealed interface which contains all the contentType/schema input types -- records which implement SealedRequestBody, the concrete request body types - -## Nested Class Summary -| Modifier and Type | Class and Description | -| ----------------- | --------------------- | -| sealed interface | [UserArray.SealedMediaType](#sealedmediatype)
media type sealed interface | -| record | [UserArray.ApplicationjsonMediaType](#applicationjsonmediatype)
record storing schema + encoding for a specific contentType | -| static class | [UserArray.UserArray1](#userarray1)
class that serializes request bodies | -| sealed interface | [UserArray.SealedRequestBody](#sealedrequestbody)
request body sealed interface | -| record | [UserArray.ApplicationjsonRequestBody](#applicationjsonrequestbody)
implements sealed interface to store request body input | - -## SealedMediaType -public sealed interface SealedMediaType
-permits
-[ApplicationjsonMediaType](#applicationjsonmediatype) - -sealed interface that stores schema and encoding info - - -## ApplicationjsonMediaType -public record ApplicationjsonMediaType
-implements [SealedMediaType](#sealedmediatype), MediaType<[ApplicationjsonSchema.ApplicationjsonSchema1](../../components/requestbodies/userarray/content/applicationjson/ApplicationjsonSchema.md#applicationjsonschema1), Nothing?> - -class storing schema info for a specific contentType - -### Constructor Summary -| Constructor and Description | -| --------------------------- | -| ApplicationjsonMediaType()
Creates an instance | - -### Method Summary -| Modifier and Type | Method and Description | -| ----------------- | ---------------------- | -| [ApplicationjsonSchema.ApplicationjsonSchema1](../../components/requestbodies/userarray/content/applicationjson/ApplicationjsonSchema.md#applicationjsonschema1) | schema()
the schema for this MediaType | -| Nothing? | encoding()
the encoding info | - -## UserArray1 -public static class UserArray1
- -a class that serializes SealedRequestBody request bodies - -### Constructor Summary -| Constructor and Description | -| --------------------------- | -| UserArray1()
Creates an instance | - -### Field Summary -| Modifier and Type | Field and Description | -| ----------------- | --------------------- | -| boolean | required = true
whether the request body is required | -| 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 | -| ----------------- | ---------------------- | -| SerializedRequestBody | serialize([SealedRequestBody](#sealedrequestbody) requestBody)
called by endpoint when creating request body bytes | - -## SealedRequestBody -public sealed interface SealedRequestBody
-permits
-[ApplicationjsonRequestBody](#applicationjsonrequestbody) - -sealed interface that stores request contentType + validated schema data - -## ApplicationjsonRequestBody -public record ApplicationjsonRequestBody
-implements [SealedRequestBody](#sealedrequestbody),
-GenericRequestBody
- -A record class to store request body input for contentType="application/json" - -### Constructor Summary -| Constructor and Description | -| --------------------------- | -| ApplicationjsonRequestBody(ApplicationjsonSchema.[ApplicationjsonSchema1Boxed](../../components/requestbodies/userarray/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](../../components/requestbodies/userarray/content/applicationjson/ApplicationjsonSchema.md#applicationjsonschema1boxed) | body()
returns the body passed in in the constructor | - -[[Back to top]](#top) [[Back to Component RequestBodies]](../../../README.md#Component-RequestBodies) [[Back to README]](../../../README.md) diff --git a/samples/client/petstore/kotlin/docs/components/requestbodies/client/content/applicationjson/ApplicationjsonSchema.md b/samples/client/petstore/kotlin/docs/components/requestbodies/client/content/applicationjson/ApplicationjsonSchema.md deleted file mode 100644 index 5a8221e0efb..00000000000 --- a/samples/client/petstore/kotlin/docs/components/requestbodies/client/content/applicationjson/ApplicationjsonSchema.md +++ /dev/null @@ -1,19 +0,0 @@ -# ApplicationjsonSchema -public class ApplicationjsonSchema
-extends [Client1](../../../../../components/schemas/Client.md#client) - -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 - -## Nested Class Summary -| Modifier and Type | Class and Description | -| ----------------- | ---------------------- | -| static class | [ApplicationjsonSchema.ApplicationjsonSchema1](#applicationjsonschema1)
schema class | - -## ApplicationjsonSchema1 -public static class ApplicationjsonSchema1
-extends [Client.Client1](../../../../../components/schemas/Client.md#client1) - -A schema class that validates payloads diff --git a/samples/client/petstore/kotlin/docs/components/requestbodies/pet/content/applicationjson/ApplicationjsonSchema.md b/samples/client/petstore/kotlin/docs/components/requestbodies/pet/content/applicationjson/ApplicationjsonSchema.md deleted file mode 100644 index 33800a35ef7..00000000000 --- a/samples/client/petstore/kotlin/docs/components/requestbodies/pet/content/applicationjson/ApplicationjsonSchema.md +++ /dev/null @@ -1,19 +0,0 @@ -# ApplicationjsonSchema -public class ApplicationjsonSchema
-extends [Pet1](../../../../../components/schemas/Pet.md#pet) - -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 - -## Nested Class Summary -| Modifier and Type | Class and Description | -| ----------------- | ---------------------- | -| static class | [ApplicationjsonSchema.ApplicationjsonSchema1](#applicationjsonschema1)
schema class | - -## ApplicationjsonSchema1 -public static class ApplicationjsonSchema1
-extends [Pet.Pet1](../../../../../components/schemas/Pet.md#pet1) - -A schema class that validates payloads diff --git a/samples/client/petstore/kotlin/docs/components/requestbodies/pet/content/applicationxml/ApplicationxmlSchema.md b/samples/client/petstore/kotlin/docs/components/requestbodies/pet/content/applicationxml/ApplicationxmlSchema.md deleted file mode 100644 index 87b9e69e465..00000000000 --- a/samples/client/petstore/kotlin/docs/components/requestbodies/pet/content/applicationxml/ApplicationxmlSchema.md +++ /dev/null @@ -1,19 +0,0 @@ -# ApplicationxmlSchema -public class ApplicationxmlSchema
-extends [RefPet1](../../../../../components/schemas/RefPet.md#refpet) - -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 - -## Nested Class Summary -| Modifier and Type | Class and Description | -| ----------------- | ---------------------- | -| static class | [ApplicationxmlSchema.ApplicationxmlSchema1](#applicationxmlschema1)
schema class | - -## ApplicationxmlSchema1 -public static class ApplicationxmlSchema1
-extends [RefPet.RefPet1](../../../../../components/schemas/RefPet.md#refpet1) - -A schema class that validates payloads diff --git a/samples/client/petstore/kotlin/docs/components/requestbodies/userarray/content/applicationjson/ApplicationjsonSchema.md b/samples/client/petstore/kotlin/docs/components/requestbodies/userarray/content/applicationjson/ApplicationjsonSchema.md deleted file mode 100644 index 920c9d5f853..00000000000 --- a/samples/client/petstore/kotlin/docs/components/requestbodies/userarray/content/applicationjson/ApplicationjsonSchema.md +++ /dev/null @@ -1,156 +0,0 @@ -# ApplicationjsonSchema -public class ApplicationjsonSchema
- -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 list payloads, extends FrozenList -- classes to build inputs for list payloads - -## Nested Class Summary -| Modifier and Type | Class and Description | -| ----------------- | ---------------------- | -| sealed interface | [ApplicationjsonSchema.ApplicationjsonSchema1Boxed](#applicationjsonschema1boxed)
sealed interface for validated payloads | -| record | [ApplicationjsonSchema.ApplicationjsonSchema1BoxedList](#applicationjsonschema1boxedlist)
boxed class to store validated List payloads | -| static class | [ApplicationjsonSchema.ApplicationjsonSchema1](#applicationjsonschema1)
schema class | -| static class | [ApplicationjsonSchema.ApplicationjsonSchemaListBuilder](#applicationjsonschemalistbuilder)
builder for List payloads | -| static class | [ApplicationjsonSchema.ApplicationjsonSchemaList](#applicationjsonschemalist)
output class for List payloads | - -## ApplicationjsonSchema1Boxed -public sealed interface ApplicationjsonSchema1Boxed
-permits
-[ApplicationjsonSchema1BoxedList](#applicationjsonschema1boxedlist) - -sealed interface that stores validated payloads using boxed classes - -## ApplicationjsonSchema1BoxedList -public record ApplicationjsonSchema1BoxedList
-implements [ApplicationjsonSchema1Boxed](#applicationjsonschema1boxed) - -record that stores validated List payloads, sealed permits implementation - -### Constructor Summary -| Constructor and Description | -| --------------------------- | -| ApplicationjsonSchema1BoxedList([ApplicationjsonSchemaList](#applicationjsonschemalist) data)
Creates an instance, private visibility | - -### Method Summary -| Modifier and Type | Method and Description | -| ----------------- | ---------------------- | -| [ApplicationjsonSchemaList](#applicationjsonschemalist) | data()
validated payload | -| @Nullable Object | getData()
validated payload | - -## ApplicationjsonSchema1 -public static class ApplicationjsonSchema1
-extends JsonSchema - -A schema class that validates payloads - -### Code Sample -``` -import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags; -import org.openapijsonschematools.client.configurations.SchemaConfiguration; -import org.openapijsonschematools.client.exceptions.ValidationException; -import org.openapijsonschematools.client.schemas.validation.MapUtils; -import org.openapijsonschematools.client.schemas.validation.FrozenList; -import org.openapijsonschematools.client.schemas.validation.FrozenMap; -import org.openapijsonschematools.client.components.requestbodies.userarray.content.applicationjson.ApplicationjsonSchema; - -import java.util.Arrays; -import java.util.List; -import java.util.AbstractMap; - -static final SchemaConfiguration configuration = new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().build()); - -// List validation -ApplicationjsonSchema.ApplicationjsonSchemaList validatedPayload = - ApplicationjsonSchema.ApplicationjsonSchema1.validate( - 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(), - configuration -); -``` - -### Field Summary -| Modifier and Type | Field and Description | -| ----------------- | ---------------------- | -| Set> | type = Set.of(List.class) | -| Class | items = [User.User1.class](../../../../../components/schemas/User.md#user1) | - -### Method Summary -| Modifier and Type | Method and Description | -| ----------------- | ---------------------- | -| [ApplicationjsonSchemaList](#applicationjsonschemalist) | validate([List](#applicationjsonschemalistbuilder) arg, SchemaConfiguration configuration) | -| [ApplicationjsonSchema1BoxedList](#applicationjsonschema1boxedlist) | validateAndBox([List](#applicationjsonschemalistbuilder) arg, SchemaConfiguration configuration) | -| [ApplicationjsonSchema1Boxed](#applicationjsonschema1boxed) | validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) | -| @Nullable Object | validate(@Nullable Object arg, SchemaConfiguration configuration) | - -## ApplicationjsonSchemaListBuilder -public class ApplicationjsonSchemaListBuilder
-builder for `List>` - -A class that builds the List input type - -### Constructor Summary -| Constructor and Description | -| --------------------------- | -| ApplicationjsonSchemaListBuilder()
Creates an empty list | -| ApplicationjsonSchemaListBuilder(List> items)
Stores the items in a list | - -### Method Summary -| Modifier and Type | Method and Description | -| ----------------- | ---------------------- | -| ApplicationjsonSchemaListBuilder | add(Map item) | -| List> | build()
Returns list input that should be used with Schema.validate | - -## ApplicationjsonSchemaList -public class ApplicationjsonSchemaList
-extends `FrozenList` - -A class to store validated List payloads - -### Method Summary -| Modifier and Type | Method and Description | -| ----------------- | ---------------------- | -| static [ApplicationjsonSchemaList](#applicationjsonschemalist) | of([List>](#applicationjsonschemalistbuilder) arg, SchemaConfiguration configuration) | diff --git a/samples/client/petstore/kotlin/docs/components/responses/HeadersWithNoBody.md b/samples/client/petstore/kotlin/docs/components/responses/HeadersWithNoBody.md deleted file mode 100644 index a23fd1569ad..00000000000 --- a/samples/client/petstore/kotlin/docs/components/responses/HeadersWithNoBody.md +++ /dev/null @@ -1,35 +0,0 @@ -# HeadersWithNoBody -HeadersWithNoBody.java - -public class HeadersWithNoBody - -A class that contains necessary nested response classes -- a class that extends ResponseDeserializer and is used to deserialize responses - -## Nested Class Summary -| Modifier and Type | Class and Description | -| ----------------- | --------------------- | -| static class | [HeadersWithNoBody.HeadersWithNoBody1](#headerswithnobody1)
class that deserializes responses | - -## HeadersWithNoBody1 -public static class HeadersWithNoBody1
-extends ResponseDeserializer - -a class that deserializes responses - -### Constructor Summary -| Constructor and Description | -| --------------------------- | -| HeadersWithNoBody1()
Creates an instance | - -### Field Summary -| Modifier and Type | Field and Description | -| ----------------- | --------------------- | -| Map | content = MapUtils.makeMap(
)
the contentType to schema info | - -### Method Summary -| Modifier and Type | Method and Description | -| ----------------- | ---------------------- | -| ApiResponse | deserialize(HttpResponse response, SchemaConfiguration configuration)
called by endpoint when deserialize responses | - -[[Back to top]](#top) [[Back to Component Responses]](../../../README.md#Component-Responses) [[Back to README]](../../../README.md) diff --git a/samples/client/petstore/kotlin/docs/components/responses/RefSuccessDescriptionOnly.md b/samples/client/petstore/kotlin/docs/components/responses/RefSuccessDescriptionOnly.md deleted file mode 100644 index f3e5b549571..00000000000 --- a/samples/client/petstore/kotlin/docs/components/responses/RefSuccessDescriptionOnly.md +++ /dev/null @@ -1,20 +0,0 @@ -# RefSuccessDescriptionOnly -RefSuccessDescriptionOnly.java - -public class RefSuccessDescriptionOnly extends [SuccessDescriptionOnly](../../components/responses/SuccessDescriptionOnly.md) - -A class (extended from the $ref class) that contains necessary nested response classes -- a class that extends ResponseDeserializer and is used to deserialize responses - -## Nested Class Summary -| Modifier and Type | Class and Description | -| ----------------- | --------------------- | -| static class | [RefSuccessDescriptionOnly.RefSuccessDescriptionOnly1](#refsuccessdescriptiononly1)
class that deserializes responses | - -## RefSuccessDescriptionOnly1 -public static class RefSuccessDescriptionOnly1 extends [SuccessDescriptionOnly1](../../components/responses/SuccessDescriptionOnly.md#successdescriptiononly1)
- -a class that deserializes responses, extended from the $ref class - - -[[Back to top]](#top) [[Back to Component Responses]](../../../README.md#Component-Responses) [[Back to README]](../../../README.md) diff --git a/samples/client/petstore/kotlin/docs/components/responses/RefSuccessfulXmlAndJsonArrayOfPet.md b/samples/client/petstore/kotlin/docs/components/responses/RefSuccessfulXmlAndJsonArrayOfPet.md deleted file mode 100644 index eea32f8e387..00000000000 --- a/samples/client/petstore/kotlin/docs/components/responses/RefSuccessfulXmlAndJsonArrayOfPet.md +++ /dev/null @@ -1,20 +0,0 @@ -# RefSuccessfulXmlAndJsonArrayOfPet -RefSuccessfulXmlAndJsonArrayOfPet.java - -public class RefSuccessfulXmlAndJsonArrayOfPet extends [SuccessfulXmlAndJsonArrayOfPet](../../components/responses/SuccessfulXmlAndJsonArrayOfPet.md) - -A class (extended from the $ref class) that contains necessary nested response classes -- a class that extends ResponseDeserializer and is used to deserialize responses - -## Nested Class Summary -| Modifier and Type | Class and Description | -| ----------------- | --------------------- | -| static class | [RefSuccessfulXmlAndJsonArrayOfPet.RefSuccessfulXmlAndJsonArrayOfPet1](#refsuccessfulxmlandjsonarrayofpet1)
class that deserializes responses | - -## RefSuccessfulXmlAndJsonArrayOfPet1 -public static class RefSuccessfulXmlAndJsonArrayOfPet1 extends [SuccessfulXmlAndJsonArrayOfPet1](../../components/responses/SuccessfulXmlAndJsonArrayOfPet.md#successfulxmlandjsonarrayofpet1)
- -a class that deserializes responses, extended from the $ref class - - -[[Back to top]](#top) [[Back to Component Responses]](../../../README.md#Component-Responses) [[Back to README]](../../../README.md) diff --git a/samples/client/petstore/kotlin/docs/components/responses/SuccessDescriptionOnly.md b/samples/client/petstore/kotlin/docs/components/responses/SuccessDescriptionOnly.md deleted file mode 100644 index d2e4c226466..00000000000 --- a/samples/client/petstore/kotlin/docs/components/responses/SuccessDescriptionOnly.md +++ /dev/null @@ -1,35 +0,0 @@ -# SuccessDescriptionOnly -SuccessDescriptionOnly.java - -public class SuccessDescriptionOnly - -A class that contains necessary nested response classes -- a class that extends ResponseDeserializer and is used to deserialize responses - -## Nested Class Summary -| Modifier and Type | Class and Description | -| ----------------- | --------------------- | -| static class | [SuccessDescriptionOnly.SuccessDescriptionOnly1](#successdescriptiononly1)
class that deserializes responses | - -## SuccessDescriptionOnly1 -public static class SuccessDescriptionOnly1
-extends ResponseDeserializer - -a class that deserializes responses - -### Constructor Summary -| Constructor and Description | -| --------------------------- | -| SuccessDescriptionOnly1()
Creates an instance | - -### Field Summary -| Modifier and Type | Field and Description | -| ----------------- | --------------------- | -| Map | content = MapUtils.makeMap(
)
the contentType to schema info | - -### Method Summary -| Modifier and Type | Method and Description | -| ----------------- | ---------------------- | -| ApiResponse | deserialize(HttpResponse response, SchemaConfiguration configuration)
called by endpoint when deserialize responses | - -[[Back to top]](#top) [[Back to Component Responses]](../../../README.md#Component-Responses) [[Back to README]](../../../README.md) diff --git a/samples/client/petstore/kotlin/docs/components/responses/SuccessInlineContentAndHeader.md b/samples/client/petstore/kotlin/docs/components/responses/SuccessInlineContentAndHeader.md deleted file mode 100644 index 8fc69a2de87..00000000000 --- a/samples/client/petstore/kotlin/docs/components/responses/SuccessInlineContentAndHeader.md +++ /dev/null @@ -1,90 +0,0 @@ -# SuccessInlineContentAndHeader -SuccessInlineContentAndHeader.java - -public class SuccessInlineContentAndHeader - -A class that contains necessary nested response classes -- SealedMediaType, a sealed interface which contains all the schema/encoding info for each contentType -- records which implement SealedMediaType, the concrete media types -- SealedResponseBody, a sealed interface which contains all the contentType/schema types -- records which implement SealedResponseBody, the concrete response body types -- a class that extends ResponseDeserializer and is used to deserialize responses - -## Nested Class Summary -| Modifier and Type | Class and Description | -| ----------------- | --------------------- | -| sealed interface | [SuccessInlineContentAndHeader.SealedMediaType](#sealedmediatype)
media type sealed interface | -| record | [SuccessInlineContentAndHeader.ApplicationjsonMediaType](#applicationjsonmediatype)
record storing schema + encoding for a specific contentType | -| sealed interface | [SuccessInlineContentAndHeader.SealedResponseBody](#sealedresponsebody)
response body sealed interface | -| record | [SuccessInlineContentAndHeader.ApplicationjsonResponseBody](#applicationjsonresponsebody)
implements sealed interface to store response body | -| static class | [SuccessInlineContentAndHeader.SuccessInlineContentAndHeader1](#successinlinecontentandheader1)
class that deserializes responses | - -## SealedMediaType -public sealed interface SealedMediaType
-permits
-[ApplicationjsonMediaType](#applicationjsonmediatype) - -sealed interface that stores schema and encoding info - -## ApplicationjsonMediaType -public record ApplicationjsonMediaType
-implements [SealedMediaType](#sealedmediatype), MediaType<[ApplicationjsonSchema.ApplicationjsonSchema1](../../components/responses/successinlinecontentandheader/content/applicationjson/ApplicationjsonSchema.md#applicationjsonschema1), Nothing?> - -class storing schema info for a specific contentType - -### Constructor Summary -| Constructor and Description | -| --------------------------- | -| ApplicationjsonMediaType()
Creates an instance | - -### Method Summary -| Modifier and Type | Method and Description | -| ----------------- | ---------------------- | -| [ApplicationjsonSchema.ApplicationjsonSchema1](../../components/responses/successinlinecontentandheader/content/applicationjson/ApplicationjsonSchema.md#applicationjsonschema1) | schema()
the schema for this MediaType | -| Nothing? | encoding()
the encoding info | - -## SealedResponseBody -public sealed interface SealedResponseBody
-permits
-[ApplicationjsonResponseBody](#applicationjsonresponsebody) - -sealed interface that stores response body - -## ApplicationjsonResponseBody -public record ApplicationjsonResponseBody
-implements [SealedResponseBody](#sealedresponsebody) - -A record class to store response body for contentType="application/json" - -### Constructor Summary -| Constructor and Description | -| --------------------------- | -| ApplicationjsonResponseBody(ApplicationjsonSchema.[ApplicationjsonSchema1Boxed](../../components/responses/successinlinecontentandheader/content/applicationjson/ApplicationjsonSchema.md#applicationjsonschema1boxed) body)
Creates an instance | - -### Method Summary -| Modifier and Type | Method and Description | -| ----------------- | ---------------------- | -| ApplicationjsonSchema.[ApplicationjsonSchema1Boxed](../../components/responses/successinlinecontentandheader/content/applicationjson/ApplicationjsonSchema.md#applicationjsonschema1boxed) | body()
returns the body passed in in the constructor | - -## SuccessInlineContentAndHeader1 -public static class SuccessInlineContentAndHeader1
-extends ResponseDeserializer<[SealedResponseBody](#sealedresponsebody), [SuccessInlineContentAndHeaderHeadersSchema.SuccessInlineContentAndHeaderHeadersSchemaMap](../../components/responses/successinlinecontentandheader/SuccessInlineContentAndHeaderHeadersSchema.md#successinlinecontentandheaderheadersschemamap), [SealedMediaType](#sealedmediatype)> - -a class that deserializes responses - -### Constructor Summary -| Constructor and Description | -| --------------------------- | -| SuccessInlineContentAndHeader1()
Creates an instance | - -### Field Summary -| Modifier and Type | Field and Description | -| ----------------- | --------------------- | -| 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 | -| ----------------- | ---------------------- | -| ApiResponse<[SealedResponseBody](#sealedresponsebody), [SuccessInlineContentAndHeaderHeadersSchema.SuccessInlineContentAndHeaderHeadersSchemaMap](../../components/responses/successinlinecontentandheader/SuccessInlineContentAndHeaderHeadersSchema.md#successinlinecontentandheaderheadersschemamap)> | deserialize(HttpResponse response, SchemaConfiguration configuration)
called by endpoint when deserialize responses | - -[[Back to top]](#top) [[Back to Component Responses]](../../../README.md#Component-Responses) [[Back to README]](../../../README.md) diff --git a/samples/client/petstore/kotlin/docs/components/responses/SuccessWithJsonApiResponse.md b/samples/client/petstore/kotlin/docs/components/responses/SuccessWithJsonApiResponse.md deleted file mode 100644 index 70c77499bdc..00000000000 --- a/samples/client/petstore/kotlin/docs/components/responses/SuccessWithJsonApiResponse.md +++ /dev/null @@ -1,90 +0,0 @@ -# SuccessWithJsonApiResponse -SuccessWithJsonApiResponse.java - -public class SuccessWithJsonApiResponse - -A class that contains necessary nested response classes -- SealedMediaType, a sealed interface which contains all the schema/encoding info for each contentType -- records which implement SealedMediaType, the concrete media types -- SealedResponseBody, a sealed interface which contains all the contentType/schema types -- records which implement SealedResponseBody, the concrete response body types -- a class that extends ResponseDeserializer and is used to deserialize responses - -## Nested Class Summary -| Modifier and Type | Class and Description | -| ----------------- | --------------------- | -| sealed interface | [SuccessWithJsonApiResponse.SealedMediaType](#sealedmediatype)
media type sealed interface | -| record | [SuccessWithJsonApiResponse.ApplicationjsonMediaType](#applicationjsonmediatype)
record storing schema + encoding for a specific contentType | -| sealed interface | [SuccessWithJsonApiResponse.SealedResponseBody](#sealedresponsebody)
response body sealed interface | -| record | [SuccessWithJsonApiResponse.ApplicationjsonResponseBody](#applicationjsonresponsebody)
implements sealed interface to store response body | -| static class | [SuccessWithJsonApiResponse.SuccessWithJsonApiResponse1](#successwithjsonapiresponse1)
class that deserializes responses | - -## SealedMediaType -public sealed interface SealedMediaType
-permits
-[ApplicationjsonMediaType](#applicationjsonmediatype) - -sealed interface that stores schema and encoding info - -## ApplicationjsonMediaType -public record ApplicationjsonMediaType
-implements [SealedMediaType](#sealedmediatype), MediaType<[ApplicationjsonSchema.ApplicationjsonSchema1](../../components/responses/successwithjsonapiresponse/content/applicationjson/ApplicationjsonSchema.md#applicationjsonschema1), Nothing?> - -class storing schema info for a specific contentType - -### Constructor Summary -| Constructor and Description | -| --------------------------- | -| ApplicationjsonMediaType()
Creates an instance | - -### Method Summary -| Modifier and Type | Method and Description | -| ----------------- | ---------------------- | -| [ApplicationjsonSchema.ApplicationjsonSchema1](../../components/responses/successwithjsonapiresponse/content/applicationjson/ApplicationjsonSchema.md#applicationjsonschema1) | schema()
the schema for this MediaType | -| Nothing? | encoding()
the encoding info | - -## SealedResponseBody -public sealed interface SealedResponseBody
-permits
-[ApplicationjsonResponseBody](#applicationjsonresponsebody) - -sealed interface that stores response body - -## ApplicationjsonResponseBody -public record ApplicationjsonResponseBody
-implements [SealedResponseBody](#sealedresponsebody) - -A record class to store response body for contentType="application/json" - -### Constructor Summary -| Constructor and Description | -| --------------------------- | -| ApplicationjsonResponseBody(ApplicationjsonSchema.[ApiResponseSchema1Boxed](../../components/schemas/ApiResponseSchema.md#apiresponseschema1boxed) body)
Creates an instance | - -### Method Summary -| Modifier and Type | Method and Description | -| ----------------- | ---------------------- | -| ApplicationjsonSchema.[ApiResponseSchema1Boxed](../../components/schemas/ApiResponseSchema.md#apiresponseschema1boxed) | body()
returns the body passed in in the constructor | - -## SuccessWithJsonApiResponse1 -public static class SuccessWithJsonApiResponse1
-extends ResponseDeserializer<[SealedResponseBody](#sealedresponsebody), [SuccessWithJsonApiResponseHeadersSchema.SuccessWithJsonApiResponseHeadersSchemaMap](../../components/responses/successwithjsonapiresponse/SuccessWithJsonApiResponseHeadersSchema.md#successwithjsonapiresponseheadersschemamap), [SealedMediaType](#sealedmediatype)> - -a class that deserializes responses - -### Constructor Summary -| Constructor and Description | -| --------------------------- | -| SuccessWithJsonApiResponse1()
Creates an instance | - -### Field Summary -| Modifier and Type | Field and Description | -| ----------------- | --------------------- | -| 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 | -| ----------------- | ---------------------- | -| ApiResponse<[SealedResponseBody](#sealedresponsebody), [SuccessWithJsonApiResponseHeadersSchema.SuccessWithJsonApiResponseHeadersSchemaMap](../../components/responses/successwithjsonapiresponse/SuccessWithJsonApiResponseHeadersSchema.md#successwithjsonapiresponseheadersschemamap)> | deserialize(HttpResponse response, SchemaConfiguration configuration)
called by endpoint when deserialize responses | - -[[Back to top]](#top) [[Back to Component Responses]](../../../README.md#Component-Responses) [[Back to README]](../../../README.md) diff --git a/samples/client/petstore/kotlin/docs/components/responses/SuccessfulXmlAndJsonArrayOfPet.md b/samples/client/petstore/kotlin/docs/components/responses/SuccessfulXmlAndJsonArrayOfPet.md deleted file mode 100644 index b808d0a9960..00000000000 --- a/samples/client/petstore/kotlin/docs/components/responses/SuccessfulXmlAndJsonArrayOfPet.md +++ /dev/null @@ -1,126 +0,0 @@ -# SuccessfulXmlAndJsonArrayOfPet -SuccessfulXmlAndJsonArrayOfPet.java - -public class SuccessfulXmlAndJsonArrayOfPet - -A class that contains necessary nested response classes -- SealedMediaType, a sealed interface which contains all the schema/encoding info for each contentType -- records which implement SealedMediaType, the concrete media types -- SealedResponseBody, a sealed interface which contains all the contentType/schema types -- records which implement SealedResponseBody, the concrete response body types -- a class that extends ResponseDeserializer and is used to deserialize responses - -## Nested Class Summary -| Modifier and Type | Class and Description | -| ----------------- | --------------------- | -| sealed interface | [SuccessfulXmlAndJsonArrayOfPet.SealedMediaType](#sealedmediatype)
media type sealed interface | -| record | [SuccessfulXmlAndJsonArrayOfPet.ApplicationxmlMediaType](#applicationxmlmediatype)
record storing schema + encoding for a specific contentType | -| record | [SuccessfulXmlAndJsonArrayOfPet.ApplicationjsonMediaType](#applicationjsonmediatype)
record storing schema + encoding for a specific contentType | -| sealed interface | [SuccessfulXmlAndJsonArrayOfPet.SealedResponseBody](#sealedresponsebody)
response body sealed interface | -| record | [SuccessfulXmlAndJsonArrayOfPet.ApplicationxmlResponseBody](#applicationxmlresponsebody)
implements sealed interface to store response body | -| record | [SuccessfulXmlAndJsonArrayOfPet.ApplicationjsonResponseBody](#applicationjsonresponsebody)
implements sealed interface to store response body | -| static class | [SuccessfulXmlAndJsonArrayOfPet.SuccessfulXmlAndJsonArrayOfPet1](#successfulxmlandjsonarrayofpet1)
class that deserializes responses | - -## SealedMediaType -public sealed interface SealedMediaType
-permits
-[ApplicationxmlMediaType](#applicationxmlmediatype), -[ApplicationjsonMediaType](#applicationjsonmediatype) - -sealed interface that stores schema and encoding info - -## ApplicationxmlMediaType -public record ApplicationxmlMediaType
-implements [SealedMediaType](#sealedmediatype), MediaType<[ApplicationxmlSchema.ApplicationxmlSchema1](../../components/responses/successfulxmlandjsonarrayofpet/content/applicationxml/ApplicationxmlSchema.md#applicationxmlschema1), Nothing?> - -class storing schema info for a specific contentType - -### Constructor Summary -| Constructor and Description | -| --------------------------- | -| ApplicationxmlMediaType()
Creates an instance | - -### Method Summary -| Modifier and Type | Method and Description | -| ----------------- | ---------------------- | -| [ApplicationxmlSchema.ApplicationxmlSchema1](../../components/responses/successfulxmlandjsonarrayofpet/content/applicationxml/ApplicationxmlSchema.md#applicationxmlschema1) | schema()
the schema for this MediaType | -| Nothing? | encoding()
the encoding info | - -## ApplicationjsonMediaType -public record ApplicationjsonMediaType
-implements [SealedMediaType](#sealedmediatype), MediaType<[ApplicationjsonSchema.ApplicationjsonSchema1](../../components/responses/successfulxmlandjsonarrayofpet/content/applicationjson/ApplicationjsonSchema.md#applicationjsonschema1), Nothing?> - -class storing schema info for a specific contentType - -### Constructor Summary -| Constructor and Description | -| --------------------------- | -| ApplicationjsonMediaType()
Creates an instance | - -### Method Summary -| Modifier and Type | Method and Description | -| ----------------- | ---------------------- | -| [ApplicationjsonSchema.ApplicationjsonSchema1](../../components/responses/successfulxmlandjsonarrayofpet/content/applicationjson/ApplicationjsonSchema.md#applicationjsonschema1) | schema()
the schema for this MediaType | -| Nothing? | encoding()
the encoding info | - -## SealedResponseBody -public sealed interface SealedResponseBody
-permits
-[ApplicationxmlResponseBody](#applicationxmlresponsebody), -[ApplicationjsonResponseBody](#applicationjsonresponsebody) - -sealed interface that stores response body - -## ApplicationxmlResponseBody -public record ApplicationxmlResponseBody
-implements [SealedResponseBody](#sealedresponsebody) - -A record class to store response body for contentType="application/xml" - -### Constructor Summary -| Constructor and Description | -| --------------------------- | -| ApplicationxmlResponseBody(ApplicationxmlSchema.[ApplicationxmlSchema1Boxed](../../components/responses/successfulxmlandjsonarrayofpet/content/applicationxml/ApplicationxmlSchema.md#applicationxmlschema1boxed) body)
Creates an instance | - -### Method Summary -| Modifier and Type | Method and Description | -| ----------------- | ---------------------- | -| ApplicationxmlSchema.[ApplicationxmlSchema1Boxed](../../components/responses/successfulxmlandjsonarrayofpet/content/applicationxml/ApplicationxmlSchema.md#applicationxmlschema1boxed) | body()
returns the body passed in in the constructor | -## ApplicationjsonResponseBody -public record ApplicationjsonResponseBody
-implements [SealedResponseBody](#sealedresponsebody) - -A record class to store response body for contentType="application/json" - -### Constructor Summary -| Constructor and Description | -| --------------------------- | -| ApplicationjsonResponseBody(ApplicationjsonSchema.[ApplicationjsonSchema1Boxed](../../components/responses/successfulxmlandjsonarrayofpet/content/applicationjson/ApplicationjsonSchema.md#applicationjsonschema1boxed) body)
Creates an instance | - -### Method Summary -| Modifier and Type | Method and Description | -| ----------------- | ---------------------- | -| ApplicationjsonSchema.[ApplicationjsonSchema1Boxed](../../components/responses/successfulxmlandjsonarrayofpet/content/applicationjson/ApplicationjsonSchema.md#applicationjsonschema1boxed) | body()
returns the body passed in in the constructor | - -## SuccessfulXmlAndJsonArrayOfPet1 -public static class SuccessfulXmlAndJsonArrayOfPet1
-extends ResponseDeserializer<[SealedResponseBody](#sealedresponsebody), Nothing?, [SealedMediaType](#sealedmediatype)> - -a class that deserializes responses - -### Constructor Summary -| Constructor and Description | -| --------------------------- | -| SuccessfulXmlAndJsonArrayOfPet1()
Creates an instance | - -### Field Summary -| Modifier and Type | Field and Description | -| ----------------- | --------------------- | -| Map | content = Map.ofEntries(
    new AbstractMap.SimpleEntry<>("application/xml", new [ApplicationxmlMediaType](#applicationxmlmediatype)()),
    new AbstractMap.SimpleEntry<>("application/json", new [ApplicationjsonMediaType](#applicationjsonmediatype)())
)
the contentType to schema info | - -### Method Summary -| Modifier and Type | Method and Description | -| ----------------- | ---------------------- | -| ApiResponse<[SealedResponseBody](#sealedresponsebody), Nothing?> | deserialize(HttpResponse response, SchemaConfiguration configuration)
called by endpoint when deserialize responses | - -[[Back to top]](#top) [[Back to Component Responses]](../../../README.md#Component-Responses) [[Back to README]](../../../README.md) diff --git a/samples/client/petstore/kotlin/docs/components/responses/headerswithnobody/HeadersWithNoBodyHeadersSchema.md b/samples/client/petstore/kotlin/docs/components/responses/headerswithnobody/HeadersWithNoBodyHeadersSchema.md deleted file mode 100644 index c4a9e2f60a4..00000000000 --- a/samples/client/petstore/kotlin/docs/components/responses/headerswithnobody/HeadersWithNoBodyHeadersSchema.md +++ /dev/null @@ -1,252 +0,0 @@ -# HeadersWithNoBodyHeadersSchema -public class HeadersWithNoBodyHeadersSchema
- -A class that contains necessary nested -- schema classes (which validate payloads), extends JsonSchema -- sealed interfaces which store validated payloads, java version of a sum type -- boxed classes which store validated payloads, sealed permits class implementations -- classes to store validated map payloads, extends FrozenMap -- classes to build inputs for map payloads - -## Nested Class Summary -| Modifier and Type | Class and Description | -| ----------------- | ---------------------- | -| sealed interface | [HeadersWithNoBodyHeadersSchema.HeadersWithNoBodyHeadersSchema1Boxed](#headerswithnobodyheadersschema1boxed)
sealed interface for validated payloads | -| record | [HeadersWithNoBodyHeadersSchema.HeadersWithNoBodyHeadersSchema1BoxedMap](#headerswithnobodyheadersschema1boxedmap)
boxed class to store validated Map payloads | -| static class | [HeadersWithNoBodyHeadersSchema.HeadersWithNoBodyHeadersSchema1](#headerswithnobodyheadersschema1)
schema class | -| static class | [HeadersWithNoBodyHeadersSchema.HeadersWithNoBodyHeadersSchemaMapBuilder](#headerswithnobodyheadersschemamapbuilder)
builder for Map payloads | -| static class | [HeadersWithNoBodyHeadersSchema.HeadersWithNoBodyHeadersSchemaMap](#headerswithnobodyheadersschemamap)
output class for Map payloads | -| sealed interface | [HeadersWithNoBodyHeadersSchema.HeadersWithNoBodyAdditionalPropertiesBoxed](#headerswithnobodyadditionalpropertiesboxed)
sealed interface for validated payloads | -| record | [HeadersWithNoBodyHeadersSchema.HeadersWithNoBodyAdditionalPropertiesBoxedVoid](#headerswithnobodyadditionalpropertiesboxedvoid)
boxed class to store validated null payloads | -| record | [HeadersWithNoBodyHeadersSchema.HeadersWithNoBodyAdditionalPropertiesBoxedBoolean](#headerswithnobodyadditionalpropertiesboxedboolean)
boxed class to store validated boolean payloads | -| record | [HeadersWithNoBodyHeadersSchema.HeadersWithNoBodyAdditionalPropertiesBoxedNumber](#headerswithnobodyadditionalpropertiesboxednumber)
boxed class to store validated Number payloads | -| record | [HeadersWithNoBodyHeadersSchema.HeadersWithNoBodyAdditionalPropertiesBoxedString](#headerswithnobodyadditionalpropertiesboxedstring)
boxed class to store validated String payloads | -| record | [HeadersWithNoBodyHeadersSchema.HeadersWithNoBodyAdditionalPropertiesBoxedList](#headerswithnobodyadditionalpropertiesboxedlist)
boxed class to store validated List payloads | -| record | [HeadersWithNoBodyHeadersSchema.HeadersWithNoBodyAdditionalPropertiesBoxedMap](#headerswithnobodyadditionalpropertiesboxedmap)
boxed class to store validated Map payloads | -| static class | [HeadersWithNoBodyHeadersSchema.HeadersWithNoBodyAdditionalProperties](#headerswithnobodyadditionalproperties)
schema class | - -## HeadersWithNoBodyHeadersSchema1Boxed -public sealed interface HeadersWithNoBodyHeadersSchema1Boxed
-permits
-[HeadersWithNoBodyHeadersSchema1BoxedMap](#headerswithnobodyheadersschema1boxedmap) - -sealed interface that stores validated payloads using boxed classes - -## HeadersWithNoBodyHeadersSchema1BoxedMap -public record HeadersWithNoBodyHeadersSchema1BoxedMap
-implements [HeadersWithNoBodyHeadersSchema1Boxed](#headerswithnobodyheadersschema1boxed) - -record that stores validated Map payloads, sealed permits implementation - -### Constructor Summary -| Constructor and Description | -| --------------------------- | -| HeadersWithNoBodyHeadersSchema1BoxedMap([HeadersWithNoBodyHeadersSchemaMap](#headerswithnobodyheadersschemamap) data)
Creates an instance, private visibility | - -### Method Summary -| Modifier and Type | Method and Description | -| ----------------- | ---------------------- | -| [HeadersWithNoBodyHeadersSchemaMap](#headerswithnobodyheadersschemamap) | data()
validated payload | -| @Nullable Object | getData()
validated payload | - -## HeadersWithNoBodyHeadersSchema1 -public static class HeadersWithNoBodyHeadersSchema1
-extends JsonSchema - -A schema class that validates payloads - -### Code Sample -``` -import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags; -import org.openapijsonschematools.client.configurations.SchemaConfiguration; -import org.openapijsonschematools.client.exceptions.ValidationException; -import org.openapijsonschematools.client.schemas.validation.MapUtils; -import org.openapijsonschematools.client.schemas.validation.FrozenList; -import org.openapijsonschematools.client.schemas.validation.FrozenMap; -import org.openapijsonschematools.client.components.responses.headerswithnobody.HeadersWithNoBodyHeadersSchema; - -import java.util.Arrays; -import java.util.List; -import java.util.AbstractMap; - -static final SchemaConfiguration configuration = new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().build()); - -// Map validation -HeadersWithNoBodyHeadersSchema.HeadersWithNoBodyHeadersSchemaMap validatedPayload = - HeadersWithNoBodyHeadersSchema.HeadersWithNoBodyHeadersSchema1.validate( - new HeadersWithNoBodyHeadersSchema.HeadersWithNoBodyHeadersSchemaMapBuilder() - .location("a") - - .build(), - configuration -); -``` - -### Field Summary -| Modifier and Type | Field and Description | -| ----------------- | ---------------------- | -| Set> | type = Set.of(Map.class) | -| Map> | properties = Map.ofEntries(
    new PropertyEntry("location", [LocationSchema.LocationSchema1.class](../../../components/responses/headerswithnobody/headers/location/LocationSchema.md#locationschema1))
)
| -| Class | additionalProperties = [HeadersWithNoBodyAdditionalProperties.class](#headerswithnobodyadditionalproperties) | - -### Method Summary -| Modifier and Type | Method and Description | -| ----------------- | ---------------------- | -| [HeadersWithNoBodyHeadersSchemaMap](#headerswithnobodyheadersschemamap) | validate([Map<?, ?>](#headerswithnobodyheadersschemamapbuilder) arg, SchemaConfiguration configuration) | -| [HeadersWithNoBodyHeadersSchema1BoxedMap](#headerswithnobodyheadersschema1boxedmap) | validateAndBox([Map<?, ?>](#headerswithnobodyheadersschemamapbuilder) arg, SchemaConfiguration configuration) | -| [HeadersWithNoBodyHeadersSchema1Boxed](#headerswithnobodyheadersschema1boxed) | validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) | -| @Nullable Object | validate(@Nullable Object arg, SchemaConfiguration configuration) | - -## HeadersWithNoBodyHeadersSchemaMapBuilder -public class HeadersWithNoBodyHeadersSchemaMapBuilder
-builder for `Map` - -A class that builds the Map input type - -### Constructor Summary -| Constructor and Description | -| --------------------------- | -| HeadersWithNoBodyHeadersSchemaMapBuilder()
Creates a builder that contains an empty map | - -### Method Summary -| Modifier and Type | Method and Description | -| ----------------- | ---------------------- | -| Map | build()
Returns map input that should be used with Schema.validate | -| [HeadersWithNoBodyHeadersSchemaMapBuilder](#headerswithnobodyheadersschemamapbuilder) | location(String value) | - -## HeadersWithNoBodyHeadersSchemaMap -public static class HeadersWithNoBodyHeadersSchemaMap
-extends FrozenMap - -A class to store validated Map payloads - -### Method Summary -| Modifier and Type | Method and Description | -| ----------------- | ---------------------- | -| static [HeadersWithNoBodyHeadersSchemaMap](#headerswithnobodyheadersschemamap) | of([Map](#headerswithnobodyheadersschemamapbuilder) arg, SchemaConfiguration configuration) | -| String | location()
[optional] | - -## HeadersWithNoBodyAdditionalPropertiesBoxed -public sealed interface HeadersWithNoBodyAdditionalPropertiesBoxed
-permits
-[HeadersWithNoBodyAdditionalPropertiesBoxedVoid](#headerswithnobodyadditionalpropertiesboxedvoid), -[HeadersWithNoBodyAdditionalPropertiesBoxedBoolean](#headerswithnobodyadditionalpropertiesboxedboolean), -[HeadersWithNoBodyAdditionalPropertiesBoxedNumber](#headerswithnobodyadditionalpropertiesboxednumber), -[HeadersWithNoBodyAdditionalPropertiesBoxedString](#headerswithnobodyadditionalpropertiesboxedstring), -[HeadersWithNoBodyAdditionalPropertiesBoxedList](#headerswithnobodyadditionalpropertiesboxedlist), -[HeadersWithNoBodyAdditionalPropertiesBoxedMap](#headerswithnobodyadditionalpropertiesboxedmap) - -sealed interface that stores validated payloads using boxed classes - -## HeadersWithNoBodyAdditionalPropertiesBoxedVoid -public record HeadersWithNoBodyAdditionalPropertiesBoxedVoid
-implements [HeadersWithNoBodyAdditionalPropertiesBoxed](#headerswithnobodyadditionalpropertiesboxed) - -record that stores validated null payloads, sealed permits implementation - -### Constructor Summary -| Constructor and Description | -| --------------------------- | -| HeadersWithNoBodyAdditionalPropertiesBoxedVoid(Nothing? data)
Creates an instance, private visibility | - -### Method Summary -| Modifier and Type | Method and Description | -| ----------------- | ---------------------- | -| Nothing? | data()
validated payload | -| @Nullable Object | getData()
validated payload | - -## HeadersWithNoBodyAdditionalPropertiesBoxedBoolean -public record HeadersWithNoBodyAdditionalPropertiesBoxedBoolean
-implements [HeadersWithNoBodyAdditionalPropertiesBoxed](#headerswithnobodyadditionalpropertiesboxed) - -record that stores validated boolean payloads, sealed permits implementation - -### Constructor Summary -| Constructor and Description | -| --------------------------- | -| HeadersWithNoBodyAdditionalPropertiesBoxedBoolean(boolean data)
Creates an instance, private visibility | - -### Method Summary -| Modifier and Type | Method and Description | -| ----------------- | ---------------------- | -| boolean | data()
validated payload | -| @Nullable Object | getData()
validated payload | - -## HeadersWithNoBodyAdditionalPropertiesBoxedNumber -public record HeadersWithNoBodyAdditionalPropertiesBoxedNumber
-implements [HeadersWithNoBodyAdditionalPropertiesBoxed](#headerswithnobodyadditionalpropertiesboxed) - -record that stores validated Number payloads, sealed permits implementation - -### Constructor Summary -| Constructor and Description | -| --------------------------- | -| HeadersWithNoBodyAdditionalPropertiesBoxedNumber(Number data)
Creates an instance, private visibility | - -### Method Summary -| Modifier and Type | Method and Description | -| ----------------- | ---------------------- | -| Number | data()
validated payload | -| @Nullable Object | getData()
validated payload | - -## HeadersWithNoBodyAdditionalPropertiesBoxedString -public record HeadersWithNoBodyAdditionalPropertiesBoxedString
-implements [HeadersWithNoBodyAdditionalPropertiesBoxed](#headerswithnobodyadditionalpropertiesboxed) - -record that stores validated String payloads, sealed permits implementation - -### Constructor Summary -| Constructor and Description | -| --------------------------- | -| HeadersWithNoBodyAdditionalPropertiesBoxedString(String data)
Creates an instance, private visibility | - -### Method Summary -| Modifier and Type | Method and Description | -| ----------------- | ---------------------- | -| String | data()
validated payload | -| @Nullable Object | getData()
validated payload | - -## HeadersWithNoBodyAdditionalPropertiesBoxedList -public record HeadersWithNoBodyAdditionalPropertiesBoxedList
-implements [HeadersWithNoBodyAdditionalPropertiesBoxed](#headerswithnobodyadditionalpropertiesboxed) - -record that stores validated List payloads, sealed permits implementation - -### Constructor Summary -| Constructor and Description | -| --------------------------- | -| HeadersWithNoBodyAdditionalPropertiesBoxedList(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 | - -## HeadersWithNoBodyAdditionalPropertiesBoxedMap -public record HeadersWithNoBodyAdditionalPropertiesBoxedMap
-implements [HeadersWithNoBodyAdditionalPropertiesBoxed](#headerswithnobodyadditionalpropertiesboxed) - -record that stores validated Map payloads, sealed permits implementation - -### Constructor Summary -| Constructor and Description | -| --------------------------- | -| HeadersWithNoBodyAdditionalPropertiesBoxedMap(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 | - -## HeadersWithNoBodyAdditionalProperties -public static class HeadersWithNoBodyAdditionalProperties
-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/kotlin/docs/components/responses/headerswithnobody/headers/location/LocationSchema.md b/samples/client/petstore/kotlin/docs/components/responses/headerswithnobody/headers/location/LocationSchema.md deleted file mode 100644 index 82bd0c2a14f..00000000000 --- a/samples/client/petstore/kotlin/docs/components/responses/headerswithnobody/headers/location/LocationSchema.md +++ /dev/null @@ -1,49 +0,0 @@ -# LocationSchema -public class LocationSchema
- -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 - -## Nested Class Summary -| Modifier and Type | Class and Description | -| ----------------- | ---------------------- | -| sealed interface | [LocationSchema.LocationSchema1Boxed](#locationschema1boxed)
sealed interface for validated payloads | -| record | [LocationSchema.LocationSchema1BoxedString](#locationschema1boxedstring)
boxed class to store validated String payloads | -| static class | [LocationSchema.LocationSchema1](#locationschema1)
schema class | - -## LocationSchema1Boxed -public sealed interface LocationSchema1Boxed
-permits
-[LocationSchema1BoxedString](#locationschema1boxedstring) - -sealed interface that stores validated payloads using boxed classes - -## LocationSchema1BoxedString -public record LocationSchema1BoxedString
-implements [LocationSchema1Boxed](#locationschema1boxed) - -record that stores validated String payloads, sealed permits implementation - -### Constructor Summary -| Constructor and Description | -| --------------------------- | -| LocationSchema1BoxedString(String data)
Creates an instance, private visibility | - -### Method Summary -| Modifier and Type | Method and Description | -| ----------------- | ---------------------- | -| String | data()
validated payload | -| @Nullable Object | getData()
validated payload | - -## LocationSchema1 -public static class LocationSchema1
-extends StringJsonSchema.StringJsonSchema1 - -A schema class that validates payloads - -| Methods Inherited from class org.openapijsonschematools.client.schemas.StringJsonSchema.StringJsonSchema1 | -| ------------------------------------------------------------------ | -| validate | -| validateAndBox | diff --git a/samples/client/petstore/kotlin/docs/components/responses/successfulxmlandjsonarrayofpet/content/applicationjson/ApplicationjsonSchema.md b/samples/client/petstore/kotlin/docs/components/responses/successfulxmlandjsonarrayofpet/content/applicationjson/ApplicationjsonSchema.md deleted file mode 100644 index 511efbc1c6e..00000000000 --- a/samples/client/petstore/kotlin/docs/components/responses/successfulxmlandjsonarrayofpet/content/applicationjson/ApplicationjsonSchema.md +++ /dev/null @@ -1,162 +0,0 @@ -# ApplicationjsonSchema -public class ApplicationjsonSchema
- -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 list payloads, extends FrozenList -- classes to build inputs for list payloads - -## Nested Class Summary -| Modifier and Type | Class and Description | -| ----------------- | ---------------------- | -| sealed interface | [ApplicationjsonSchema.ApplicationjsonSchema1Boxed](#applicationjsonschema1boxed)
sealed interface for validated payloads | -| record | [ApplicationjsonSchema.ApplicationjsonSchema1BoxedList](#applicationjsonschema1boxedlist)
boxed class to store validated List payloads | -| static class | [ApplicationjsonSchema.ApplicationjsonSchema1](#applicationjsonschema1)
schema class | -| static class | [ApplicationjsonSchema.ApplicationjsonSchemaListBuilder](#applicationjsonschemalistbuilder)
builder for List payloads | -| static class | [ApplicationjsonSchema.ApplicationjsonSchemaList](#applicationjsonschemalist)
output class for List payloads | - -## ApplicationjsonSchema1Boxed -public sealed interface ApplicationjsonSchema1Boxed
-permits
-[ApplicationjsonSchema1BoxedList](#applicationjsonschema1boxedlist) - -sealed interface that stores validated payloads using boxed classes - -## ApplicationjsonSchema1BoxedList -public record ApplicationjsonSchema1BoxedList
-implements [ApplicationjsonSchema1Boxed](#applicationjsonschema1boxed) - -record that stores validated List payloads, sealed permits implementation - -### Constructor Summary -| Constructor and Description | -| --------------------------- | -| ApplicationjsonSchema1BoxedList([ApplicationjsonSchemaList](#applicationjsonschemalist) data)
Creates an instance, private visibility | - -### Method Summary -| Modifier and Type | Method and Description | -| ----------------- | ---------------------- | -| [ApplicationjsonSchemaList](#applicationjsonschemalist) | data()
validated payload | -| @Nullable Object | getData()
validated payload | - -## ApplicationjsonSchema1 -public static class ApplicationjsonSchema1
-extends JsonSchema - -A schema class that validates payloads - -### Code Sample -``` -import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags; -import org.openapijsonschematools.client.configurations.SchemaConfiguration; -import org.openapijsonschematools.client.exceptions.ValidationException; -import org.openapijsonschematools.client.schemas.validation.MapUtils; -import org.openapijsonschematools.client.schemas.validation.FrozenList; -import org.openapijsonschematools.client.schemas.validation.FrozenMap; -import org.openapijsonschematools.client.components.responses.successfulxmlandjsonarrayofpet.content.applicationjson.ApplicationjsonSchema; - -import java.util.Arrays; -import java.util.List; -import java.util.AbstractMap; - -static final SchemaConfiguration configuration = new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().build()); - -// List validation -ApplicationjsonSchema.ApplicationjsonSchemaList validatedPayload = - ApplicationjsonSchema.ApplicationjsonSchema1.validate( - new ApplicationjsonSchema.ApplicationjsonSchemaListBuilder() - .add( - MapUtils.makeMap( - new AbstractMap.SimpleEntry( - "name", - "a" - ), - new AbstractMap.SimpleEntry( - "photoUrls", - Arrays.asList( - "a" - ) - ), - new AbstractMap.SimpleEntry( - "id", - 1L - ), - new AbstractMap.SimpleEntry( - "category", - MapUtils.makeMap( - new AbstractMap.SimpleEntry( - "name", - "a" - ), - new AbstractMap.SimpleEntry( - "id", - 1L - ) - ) - ), - new AbstractMap.SimpleEntry( - "tags", - Arrays.asList( - MapUtils.makeMap( - new AbstractMap.SimpleEntry( - "name", - "a" - ) - ) - ) - ), - new AbstractMap.SimpleEntry( - "status", - "available" - ) - ) - ) - .build(), - configuration -); -``` - -### Field Summary -| Modifier and Type | Field and Description | -| ----------------- | ---------------------- | -| Set> | type = Set.of(List.class) | -| Class | items = [RefPet.RefPet1.class](../../../../../components/schemas/RefPet.md#refpet1) | - -### Method Summary -| Modifier and Type | Method and Description | -| ----------------- | ---------------------- | -| [ApplicationjsonSchemaList](#applicationjsonschemalist) | validate([List](#applicationjsonschemalistbuilder) arg, SchemaConfiguration configuration) | -| [ApplicationjsonSchema1BoxedList](#applicationjsonschema1boxedlist) | validateAndBox([List](#applicationjsonschemalistbuilder) arg, SchemaConfiguration configuration) | -| [ApplicationjsonSchema1Boxed](#applicationjsonschema1boxed) | validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) | -| @Nullable Object | validate(@Nullable Object arg, SchemaConfiguration configuration) | - -## ApplicationjsonSchemaListBuilder -public class ApplicationjsonSchemaListBuilder
-builder for `List>` - -A class that builds the List input type - -### Constructor Summary -| Constructor and Description | -| --------------------------- | -| ApplicationjsonSchemaListBuilder()
Creates an empty list | -| ApplicationjsonSchemaListBuilder(List> items)
Stores the items in a list | - -### Method Summary -| Modifier and Type | Method and Description | -| ----------------- | ---------------------- | -| ApplicationjsonSchemaListBuilder | add(Map item) | -| List> | build()
Returns list input that should be used with Schema.validate | - -## ApplicationjsonSchemaList -public class ApplicationjsonSchemaList
-extends `FrozenList` - -A class to store validated List payloads - -### Method Summary -| Modifier and Type | Method and Description | -| ----------------- | ---------------------- | -| static [ApplicationjsonSchemaList](#applicationjsonschemalist) | of([List>](#applicationjsonschemalistbuilder) arg, SchemaConfiguration configuration) | diff --git a/samples/client/petstore/kotlin/docs/components/responses/successfulxmlandjsonarrayofpet/content/applicationxml/ApplicationxmlSchema.md b/samples/client/petstore/kotlin/docs/components/responses/successfulxmlandjsonarrayofpet/content/applicationxml/ApplicationxmlSchema.md deleted file mode 100644 index cbdc472e51a..00000000000 --- a/samples/client/petstore/kotlin/docs/components/responses/successfulxmlandjsonarrayofpet/content/applicationxml/ApplicationxmlSchema.md +++ /dev/null @@ -1,162 +0,0 @@ -# ApplicationxmlSchema -public class ApplicationxmlSchema
- -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 list payloads, extends FrozenList -- classes to build inputs for list payloads - -## Nested Class Summary -| Modifier and Type | Class and Description | -| ----------------- | ---------------------- | -| sealed interface | [ApplicationxmlSchema.ApplicationxmlSchema1Boxed](#applicationxmlschema1boxed)
sealed interface for validated payloads | -| record | [ApplicationxmlSchema.ApplicationxmlSchema1BoxedList](#applicationxmlschema1boxedlist)
boxed class to store validated List payloads | -| static class | [ApplicationxmlSchema.ApplicationxmlSchema1](#applicationxmlschema1)
schema class | -| static class | [ApplicationxmlSchema.ApplicationxmlSchemaListBuilder](#applicationxmlschemalistbuilder)
builder for List payloads | -| static class | [ApplicationxmlSchema.ApplicationxmlSchemaList](#applicationxmlschemalist)
output class for List payloads | - -## ApplicationxmlSchema1Boxed -public sealed interface ApplicationxmlSchema1Boxed
-permits
-[ApplicationxmlSchema1BoxedList](#applicationxmlschema1boxedlist) - -sealed interface that stores validated payloads using boxed classes - -## ApplicationxmlSchema1BoxedList -public record ApplicationxmlSchema1BoxedList
-implements [ApplicationxmlSchema1Boxed](#applicationxmlschema1boxed) - -record that stores validated List payloads, sealed permits implementation - -### Constructor Summary -| Constructor and Description | -| --------------------------- | -| ApplicationxmlSchema1BoxedList([ApplicationxmlSchemaList](#applicationxmlschemalist) data)
Creates an instance, private visibility | - -### Method Summary -| Modifier and Type | Method and Description | -| ----------------- | ---------------------- | -| [ApplicationxmlSchemaList](#applicationxmlschemalist) | data()
validated payload | -| @Nullable Object | getData()
validated payload | - -## ApplicationxmlSchema1 -public static class ApplicationxmlSchema1
-extends JsonSchema - -A schema class that validates payloads - -### Code Sample -``` -import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags; -import org.openapijsonschematools.client.configurations.SchemaConfiguration; -import org.openapijsonschematools.client.exceptions.ValidationException; -import org.openapijsonschematools.client.schemas.validation.MapUtils; -import org.openapijsonschematools.client.schemas.validation.FrozenList; -import org.openapijsonschematools.client.schemas.validation.FrozenMap; -import org.openapijsonschematools.client.components.responses.successfulxmlandjsonarrayofpet.content.applicationxml.ApplicationxmlSchema; - -import java.util.Arrays; -import java.util.List; -import java.util.AbstractMap; - -static final SchemaConfiguration configuration = new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().build()); - -// List validation -ApplicationxmlSchema.ApplicationxmlSchemaList validatedPayload = - ApplicationxmlSchema.ApplicationxmlSchema1.validate( - new ApplicationxmlSchema.ApplicationxmlSchemaListBuilder() - .add( - MapUtils.makeMap( - new AbstractMap.SimpleEntry( - "name", - "a" - ), - new AbstractMap.SimpleEntry( - "photoUrls", - Arrays.asList( - "a" - ) - ), - new AbstractMap.SimpleEntry( - "id", - 1L - ), - new AbstractMap.SimpleEntry( - "category", - MapUtils.makeMap( - new AbstractMap.SimpleEntry( - "name", - "a" - ), - new AbstractMap.SimpleEntry( - "id", - 1L - ) - ) - ), - new AbstractMap.SimpleEntry( - "tags", - Arrays.asList( - MapUtils.makeMap( - new AbstractMap.SimpleEntry( - "name", - "a" - ) - ) - ) - ), - new AbstractMap.SimpleEntry( - "status", - "available" - ) - ) - ) - .build(), - configuration -); -``` - -### Field Summary -| Modifier and Type | Field and Description | -| ----------------- | ---------------------- | -| Set> | type = Set.of(List.class) | -| Class | items = [Pet.Pet1.class](../../../../../components/schemas/Pet.md#pet1) | - -### Method Summary -| Modifier and Type | Method and Description | -| ----------------- | ---------------------- | -| [ApplicationxmlSchemaList](#applicationxmlschemalist) | validate([List](#applicationxmlschemalistbuilder) arg, SchemaConfiguration configuration) | -| [ApplicationxmlSchema1BoxedList](#applicationxmlschema1boxedlist) | validateAndBox([List](#applicationxmlschemalistbuilder) arg, SchemaConfiguration configuration) | -| [ApplicationxmlSchema1Boxed](#applicationxmlschema1boxed) | validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) | -| @Nullable Object | validate(@Nullable Object arg, SchemaConfiguration configuration) | - -## ApplicationxmlSchemaListBuilder -public class ApplicationxmlSchemaListBuilder
-builder for `List>` - -A class that builds the List input type - -### Constructor Summary -| Constructor and Description | -| --------------------------- | -| ApplicationxmlSchemaListBuilder()
Creates an empty list | -| ApplicationxmlSchemaListBuilder(List> items)
Stores the items in a list | - -### Method Summary -| Modifier and Type | Method and Description | -| ----------------- | ---------------------- | -| ApplicationxmlSchemaListBuilder | add(Map item) | -| List> | build()
Returns list input that should be used with Schema.validate | - -## ApplicationxmlSchemaList -public class ApplicationxmlSchemaList
-extends `FrozenList` - -A class to store validated List payloads - -### Method Summary -| Modifier and Type | Method and Description | -| ----------------- | ---------------------- | -| static [ApplicationxmlSchemaList](#applicationxmlschemalist) | of([List>](#applicationxmlschemalistbuilder) arg, SchemaConfiguration configuration) | diff --git a/samples/client/petstore/kotlin/docs/components/responses/successinlinecontentandheader/SuccessInlineContentAndHeaderHeadersSchema.md b/samples/client/petstore/kotlin/docs/components/responses/successinlinecontentandheader/SuccessInlineContentAndHeaderHeadersSchema.md deleted file mode 100644 index 4bc7610c67a..00000000000 --- a/samples/client/petstore/kotlin/docs/components/responses/successinlinecontentandheader/SuccessInlineContentAndHeaderHeadersSchema.md +++ /dev/null @@ -1,252 +0,0 @@ -# SuccessInlineContentAndHeaderHeadersSchema -public class SuccessInlineContentAndHeaderHeadersSchema
- -A class that contains necessary nested -- schema classes (which validate payloads), extends JsonSchema -- sealed interfaces which store validated payloads, java version of a sum type -- boxed classes which store validated payloads, sealed permits class implementations -- classes to store validated map payloads, extends FrozenMap -- classes to build inputs for map payloads - -## Nested Class Summary -| Modifier and Type | Class and Description | -| ----------------- | ---------------------- | -| sealed interface | [SuccessInlineContentAndHeaderHeadersSchema.SuccessInlineContentAndHeaderHeadersSchema1Boxed](#successinlinecontentandheaderheadersschema1boxed)
sealed interface for validated payloads | -| record | [SuccessInlineContentAndHeaderHeadersSchema.SuccessInlineContentAndHeaderHeadersSchema1BoxedMap](#successinlinecontentandheaderheadersschema1boxedmap)
boxed class to store validated Map payloads | -| static class | [SuccessInlineContentAndHeaderHeadersSchema.SuccessInlineContentAndHeaderHeadersSchema1](#successinlinecontentandheaderheadersschema1)
schema class | -| static class | [SuccessInlineContentAndHeaderHeadersSchema.SuccessInlineContentAndHeaderHeadersSchemaMapBuilder](#successinlinecontentandheaderheadersschemamapbuilder)
builder for Map payloads | -| static class | [SuccessInlineContentAndHeaderHeadersSchema.SuccessInlineContentAndHeaderHeadersSchemaMap](#successinlinecontentandheaderheadersschemamap)
output class for Map payloads | -| sealed interface | [SuccessInlineContentAndHeaderHeadersSchema.SuccessInlineContentAndHeaderAdditionalPropertiesBoxed](#successinlinecontentandheaderadditionalpropertiesboxed)
sealed interface for validated payloads | -| record | [SuccessInlineContentAndHeaderHeadersSchema.SuccessInlineContentAndHeaderAdditionalPropertiesBoxedVoid](#successinlinecontentandheaderadditionalpropertiesboxedvoid)
boxed class to store validated null payloads | -| record | [SuccessInlineContentAndHeaderHeadersSchema.SuccessInlineContentAndHeaderAdditionalPropertiesBoxedBoolean](#successinlinecontentandheaderadditionalpropertiesboxedboolean)
boxed class to store validated boolean payloads | -| record | [SuccessInlineContentAndHeaderHeadersSchema.SuccessInlineContentAndHeaderAdditionalPropertiesBoxedNumber](#successinlinecontentandheaderadditionalpropertiesboxednumber)
boxed class to store validated Number payloads | -| record | [SuccessInlineContentAndHeaderHeadersSchema.SuccessInlineContentAndHeaderAdditionalPropertiesBoxedString](#successinlinecontentandheaderadditionalpropertiesboxedstring)
boxed class to store validated String payloads | -| record | [SuccessInlineContentAndHeaderHeadersSchema.SuccessInlineContentAndHeaderAdditionalPropertiesBoxedList](#successinlinecontentandheaderadditionalpropertiesboxedlist)
boxed class to store validated List payloads | -| record | [SuccessInlineContentAndHeaderHeadersSchema.SuccessInlineContentAndHeaderAdditionalPropertiesBoxedMap](#successinlinecontentandheaderadditionalpropertiesboxedmap)
boxed class to store validated Map payloads | -| static class | [SuccessInlineContentAndHeaderHeadersSchema.SuccessInlineContentAndHeaderAdditionalProperties](#successinlinecontentandheaderadditionalproperties)
schema class | - -## SuccessInlineContentAndHeaderHeadersSchema1Boxed -public sealed interface SuccessInlineContentAndHeaderHeadersSchema1Boxed
-permits
-[SuccessInlineContentAndHeaderHeadersSchema1BoxedMap](#successinlinecontentandheaderheadersschema1boxedmap) - -sealed interface that stores validated payloads using boxed classes - -## SuccessInlineContentAndHeaderHeadersSchema1BoxedMap -public record SuccessInlineContentAndHeaderHeadersSchema1BoxedMap
-implements [SuccessInlineContentAndHeaderHeadersSchema1Boxed](#successinlinecontentandheaderheadersschema1boxed) - -record that stores validated Map payloads, sealed permits implementation - -### Constructor Summary -| Constructor and Description | -| --------------------------- | -| SuccessInlineContentAndHeaderHeadersSchema1BoxedMap([SuccessInlineContentAndHeaderHeadersSchemaMap](#successinlinecontentandheaderheadersschemamap) data)
Creates an instance, private visibility | - -### Method Summary -| Modifier and Type | Method and Description | -| ----------------- | ---------------------- | -| [SuccessInlineContentAndHeaderHeadersSchemaMap](#successinlinecontentandheaderheadersschemamap) | data()
validated payload | -| @Nullable Object | getData()
validated payload | - -## SuccessInlineContentAndHeaderHeadersSchema1 -public static class SuccessInlineContentAndHeaderHeadersSchema1
-extends JsonSchema - -A schema class that validates payloads - -### Code Sample -``` -import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags; -import org.openapijsonschematools.client.configurations.SchemaConfiguration; -import org.openapijsonschematools.client.exceptions.ValidationException; -import org.openapijsonschematools.client.schemas.validation.MapUtils; -import org.openapijsonschematools.client.schemas.validation.FrozenList; -import org.openapijsonschematools.client.schemas.validation.FrozenMap; -import org.openapijsonschematools.client.components.responses.successinlinecontentandheader.SuccessInlineContentAndHeaderHeadersSchema; - -import java.util.Arrays; -import java.util.List; -import java.util.AbstractMap; - -static final SchemaConfiguration configuration = new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().build()); - -// Map validation -SuccessInlineContentAndHeaderHeadersSchema.SuccessInlineContentAndHeaderHeadersSchemaMap validatedPayload = - SuccessInlineContentAndHeaderHeadersSchema.SuccessInlineContentAndHeaderHeadersSchema1.validate( - new SuccessInlineContentAndHeaderHeadersSchema.SuccessInlineContentAndHeaderHeadersSchemaMapBuilder() - .someHeader("a") - - .build(), - configuration -); -``` - -### Field Summary -| Modifier and Type | Field and Description | -| ----------------- | ---------------------- | -| Set> | type = Set.of(Map.class) | -| Map> | properties = Map.ofEntries(
    new PropertyEntry("someHeader", [SomeHeaderSchema.SomeHeaderSchema1.class](../../../components/responses/successinlinecontentandheader/headers/someheader/SomeHeaderSchema.md#someheaderschema1))
)
| -| Class | additionalProperties = [SuccessInlineContentAndHeaderAdditionalProperties.class](#successinlinecontentandheaderadditionalproperties) | - -### Method Summary -| Modifier and Type | Method and Description | -| ----------------- | ---------------------- | -| [SuccessInlineContentAndHeaderHeadersSchemaMap](#successinlinecontentandheaderheadersschemamap) | validate([Map<?, ?>](#successinlinecontentandheaderheadersschemamapbuilder) arg, SchemaConfiguration configuration) | -| [SuccessInlineContentAndHeaderHeadersSchema1BoxedMap](#successinlinecontentandheaderheadersschema1boxedmap) | validateAndBox([Map<?, ?>](#successinlinecontentandheaderheadersschemamapbuilder) arg, SchemaConfiguration configuration) | -| [SuccessInlineContentAndHeaderHeadersSchema1Boxed](#successinlinecontentandheaderheadersschema1boxed) | validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) | -| @Nullable Object | validate(@Nullable Object arg, SchemaConfiguration configuration) | - -## SuccessInlineContentAndHeaderHeadersSchemaMapBuilder -public class SuccessInlineContentAndHeaderHeadersSchemaMapBuilder
-builder for `Map` - -A class that builds the Map input type - -### Constructor Summary -| Constructor and Description | -| --------------------------- | -| SuccessInlineContentAndHeaderHeadersSchemaMapBuilder()
Creates a builder that contains an empty map | - -### Method Summary -| Modifier and Type | Method and Description | -| ----------------- | ---------------------- | -| Map | build()
Returns map input that should be used with Schema.validate | -| [SuccessInlineContentAndHeaderHeadersSchemaMapBuilder](#successinlinecontentandheaderheadersschemamapbuilder) | someHeader(String value) | - -## SuccessInlineContentAndHeaderHeadersSchemaMap -public static class SuccessInlineContentAndHeaderHeadersSchemaMap
-extends FrozenMap - -A class to store validated Map payloads - -### Method Summary -| Modifier and Type | Method and Description | -| ----------------- | ---------------------- | -| static [SuccessInlineContentAndHeaderHeadersSchemaMap](#successinlinecontentandheaderheadersschemamap) | of([Map](#successinlinecontentandheaderheadersschemamapbuilder) arg, SchemaConfiguration configuration) | -| String | someHeader()
[optional] | - -## SuccessInlineContentAndHeaderAdditionalPropertiesBoxed -public sealed interface SuccessInlineContentAndHeaderAdditionalPropertiesBoxed
-permits
-[SuccessInlineContentAndHeaderAdditionalPropertiesBoxedVoid](#successinlinecontentandheaderadditionalpropertiesboxedvoid), -[SuccessInlineContentAndHeaderAdditionalPropertiesBoxedBoolean](#successinlinecontentandheaderadditionalpropertiesboxedboolean), -[SuccessInlineContentAndHeaderAdditionalPropertiesBoxedNumber](#successinlinecontentandheaderadditionalpropertiesboxednumber), -[SuccessInlineContentAndHeaderAdditionalPropertiesBoxedString](#successinlinecontentandheaderadditionalpropertiesboxedstring), -[SuccessInlineContentAndHeaderAdditionalPropertiesBoxedList](#successinlinecontentandheaderadditionalpropertiesboxedlist), -[SuccessInlineContentAndHeaderAdditionalPropertiesBoxedMap](#successinlinecontentandheaderadditionalpropertiesboxedmap) - -sealed interface that stores validated payloads using boxed classes - -## SuccessInlineContentAndHeaderAdditionalPropertiesBoxedVoid -public record SuccessInlineContentAndHeaderAdditionalPropertiesBoxedVoid
-implements [SuccessInlineContentAndHeaderAdditionalPropertiesBoxed](#successinlinecontentandheaderadditionalpropertiesboxed) - -record that stores validated null payloads, sealed permits implementation - -### Constructor Summary -| Constructor and Description | -| --------------------------- | -| SuccessInlineContentAndHeaderAdditionalPropertiesBoxedVoid(Nothing? data)
Creates an instance, private visibility | - -### Method Summary -| Modifier and Type | Method and Description | -| ----------------- | ---------------------- | -| Nothing? | data()
validated payload | -| @Nullable Object | getData()
validated payload | - -## SuccessInlineContentAndHeaderAdditionalPropertiesBoxedBoolean -public record SuccessInlineContentAndHeaderAdditionalPropertiesBoxedBoolean
-implements [SuccessInlineContentAndHeaderAdditionalPropertiesBoxed](#successinlinecontentandheaderadditionalpropertiesboxed) - -record that stores validated boolean payloads, sealed permits implementation - -### Constructor Summary -| Constructor and Description | -| --------------------------- | -| SuccessInlineContentAndHeaderAdditionalPropertiesBoxedBoolean(boolean data)
Creates an instance, private visibility | - -### Method Summary -| Modifier and Type | Method and Description | -| ----------------- | ---------------------- | -| boolean | data()
validated payload | -| @Nullable Object | getData()
validated payload | - -## SuccessInlineContentAndHeaderAdditionalPropertiesBoxedNumber -public record SuccessInlineContentAndHeaderAdditionalPropertiesBoxedNumber
-implements [SuccessInlineContentAndHeaderAdditionalPropertiesBoxed](#successinlinecontentandheaderadditionalpropertiesboxed) - -record that stores validated Number payloads, sealed permits implementation - -### Constructor Summary -| Constructor and Description | -| --------------------------- | -| SuccessInlineContentAndHeaderAdditionalPropertiesBoxedNumber(Number data)
Creates an instance, private visibility | - -### Method Summary -| Modifier and Type | Method and Description | -| ----------------- | ---------------------- | -| Number | data()
validated payload | -| @Nullable Object | getData()
validated payload | - -## SuccessInlineContentAndHeaderAdditionalPropertiesBoxedString -public record SuccessInlineContentAndHeaderAdditionalPropertiesBoxedString
-implements [SuccessInlineContentAndHeaderAdditionalPropertiesBoxed](#successinlinecontentandheaderadditionalpropertiesboxed) - -record that stores validated String payloads, sealed permits implementation - -### Constructor Summary -| Constructor and Description | -| --------------------------- | -| SuccessInlineContentAndHeaderAdditionalPropertiesBoxedString(String data)
Creates an instance, private visibility | - -### Method Summary -| Modifier and Type | Method and Description | -| ----------------- | ---------------------- | -| String | data()
validated payload | -| @Nullable Object | getData()
validated payload | - -## SuccessInlineContentAndHeaderAdditionalPropertiesBoxedList -public record SuccessInlineContentAndHeaderAdditionalPropertiesBoxedList
-implements [SuccessInlineContentAndHeaderAdditionalPropertiesBoxed](#successinlinecontentandheaderadditionalpropertiesboxed) - -record that stores validated List payloads, sealed permits implementation - -### Constructor Summary -| Constructor and Description | -| --------------------------- | -| SuccessInlineContentAndHeaderAdditionalPropertiesBoxedList(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 | - -## SuccessInlineContentAndHeaderAdditionalPropertiesBoxedMap -public record SuccessInlineContentAndHeaderAdditionalPropertiesBoxedMap
-implements [SuccessInlineContentAndHeaderAdditionalPropertiesBoxed](#successinlinecontentandheaderadditionalpropertiesboxed) - -record that stores validated Map payloads, sealed permits implementation - -### Constructor Summary -| Constructor and Description | -| --------------------------- | -| SuccessInlineContentAndHeaderAdditionalPropertiesBoxedMap(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 | - -## SuccessInlineContentAndHeaderAdditionalProperties -public static class SuccessInlineContentAndHeaderAdditionalProperties
-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/kotlin/docs/components/responses/successinlinecontentandheader/content/applicationjson/ApplicationjsonSchema.md b/samples/client/petstore/kotlin/docs/components/responses/successinlinecontentandheader/content/applicationjson/ApplicationjsonSchema.md deleted file mode 100644 index 63e94647f63..00000000000 --- a/samples/client/petstore/kotlin/docs/components/responses/successinlinecontentandheader/content/applicationjson/ApplicationjsonSchema.md +++ /dev/null @@ -1,157 +0,0 @@ -# ApplicationjsonSchema -public class ApplicationjsonSchema
- -A class that contains necessary nested -- schema classes (which validate payloads), extends JsonSchema -- sealed interfaces which store validated payloads, java version of a sum type -- boxed classes which store validated payloads, sealed permits class implementations -- classes to store validated map payloads, extends FrozenMap -- classes to build inputs for map payloads - -## Nested Class Summary -| Modifier and Type | Class and Description | -| ----------------- | ---------------------- | -| sealed interface | [ApplicationjsonSchema.ApplicationjsonSchema1Boxed](#applicationjsonschema1boxed)
sealed interface for validated payloads | -| record | [ApplicationjsonSchema.ApplicationjsonSchema1BoxedMap](#applicationjsonschema1boxedmap)
boxed class to store validated Map payloads | -| static class | [ApplicationjsonSchema.ApplicationjsonSchema1](#applicationjsonschema1)
schema class | -| static class | [ApplicationjsonSchema.ApplicationjsonSchemaMapBuilder](#applicationjsonschemamapbuilder)
builder for Map payloads | -| static class | [ApplicationjsonSchema.ApplicationjsonSchemaMap](#applicationjsonschemamap)
output class for Map payloads | -| sealed interface | [ApplicationjsonSchema.ApplicationjsonAdditionalPropertiesBoxed](#applicationjsonadditionalpropertiesboxed)
sealed interface for validated payloads | -| record | [ApplicationjsonSchema.ApplicationjsonAdditionalPropertiesBoxedNumber](#applicationjsonadditionalpropertiesboxednumber)
boxed class to store validated Number payloads | -| static class | [ApplicationjsonSchema.ApplicationjsonAdditionalProperties](#applicationjsonadditionalproperties)
schema class | - -## ApplicationjsonSchema1Boxed -public sealed interface ApplicationjsonSchema1Boxed
-permits
-[ApplicationjsonSchema1BoxedMap](#applicationjsonschema1boxedmap) - -sealed interface that stores validated payloads using boxed classes - -## ApplicationjsonSchema1BoxedMap -public record ApplicationjsonSchema1BoxedMap
-implements [ApplicationjsonSchema1Boxed](#applicationjsonschema1boxed) - -record that stores validated Map payloads, sealed permits implementation - -### Constructor Summary -| Constructor and Description | -| --------------------------- | -| ApplicationjsonSchema1BoxedMap([ApplicationjsonSchemaMap](#applicationjsonschemamap) data)
Creates an instance, private visibility | - -### Method Summary -| Modifier and Type | Method and Description | -| ----------------- | ---------------------- | -| [ApplicationjsonSchemaMap](#applicationjsonschemamap) | data()
validated payload | -| @Nullable Object | getData()
validated payload | - -## ApplicationjsonSchema1 -public static class ApplicationjsonSchema1
-extends JsonSchema - -A schema class that validates payloads - -### Code Sample -``` -import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags; -import org.openapijsonschematools.client.configurations.SchemaConfiguration; -import org.openapijsonschematools.client.exceptions.ValidationException; -import org.openapijsonschematools.client.schemas.validation.MapUtils; -import org.openapijsonschematools.client.schemas.validation.FrozenList; -import org.openapijsonschematools.client.schemas.validation.FrozenMap; -import org.openapijsonschematools.client.components.responses.successinlinecontentandheader.content.applicationjson.ApplicationjsonSchema; - -import java.util.Arrays; -import java.util.List; -import java.util.AbstractMap; - -static final SchemaConfiguration configuration = new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().build()); - -// Map validation -ApplicationjsonSchema.ApplicationjsonSchemaMap validatedPayload = - ApplicationjsonSchema.ApplicationjsonSchema1.validate( - new ApplicationjsonSchema.ApplicationjsonSchemaMapBuilder() - .additionalProperty("someAdditionalProperty", 1) - - .build(), - configuration -); -``` - -### Field Summary -| Modifier and Type | Field and Description | -| ----------------- | ---------------------- | -| Set> | type = Set.of(Map.class) | -| Class | additionalProperties = [ApplicationjsonAdditionalProperties.class](#applicationjsonadditionalproperties) | - -### Method Summary -| Modifier and Type | Method and Description | -| ----------------- | ---------------------- | -| [ApplicationjsonSchemaMap](#applicationjsonschemamap) | validate([Map<?, ?>](#applicationjsonschemamapbuilder) arg, SchemaConfiguration configuration) | -| [ApplicationjsonSchema1BoxedMap](#applicationjsonschema1boxedmap) | validateAndBox([Map<?, ?>](#applicationjsonschemamapbuilder) arg, SchemaConfiguration configuration) | -| [ApplicationjsonSchema1Boxed](#applicationjsonschema1boxed) | validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) | -| @Nullable Object | validate(@Nullable Object arg, SchemaConfiguration configuration) | - -## ApplicationjsonSchemaMapBuilder -public class ApplicationjsonSchemaMapBuilder
-builder for `Map` - -A class that builds the Map input type - -### Constructor Summary -| Constructor and Description | -| --------------------------- | -| ApplicationjsonSchemaMapBuilder()
Creates a builder that contains an empty map | - -### Method Summary -| Modifier and Type | Method and Description | -| ----------------- | ---------------------- | -| Map | build()
Returns map input that should be used with Schema.validate | -| [ApplicationjsonSchemaMapBuilder](#applicationjsonschemamapbuilder) | additionalProperty(String key, int value) | -| [ApplicationjsonSchemaMapBuilder](#applicationjsonschemamapbuilder) | additionalProperty(String key, float value) | - -## ApplicationjsonSchemaMap -public static class ApplicationjsonSchemaMap
-extends FrozenMap - -A class to store validated Map payloads - -### Method Summary -| Modifier and Type | Method and Description | -| ----------------- | ---------------------- | -| static [ApplicationjsonSchemaMap](#applicationjsonschemamap) | of([Map](#applicationjsonschemamapbuilder) arg, SchemaConfiguration configuration) | -| Number | getAdditionalProperty(String name)
provides type safety for additional properties | - -## ApplicationjsonAdditionalPropertiesBoxed -public sealed interface ApplicationjsonAdditionalPropertiesBoxed
-permits
-[ApplicationjsonAdditionalPropertiesBoxedNumber](#applicationjsonadditionalpropertiesboxednumber) - -sealed interface that stores validated payloads using boxed classes - -## ApplicationjsonAdditionalPropertiesBoxedNumber -public record ApplicationjsonAdditionalPropertiesBoxedNumber
-implements [ApplicationjsonAdditionalPropertiesBoxed](#applicationjsonadditionalpropertiesboxed) - -record that stores validated Number payloads, sealed permits implementation - -### Constructor Summary -| Constructor and Description | -| --------------------------- | -| ApplicationjsonAdditionalPropertiesBoxedNumber(Number data)
Creates an instance, private visibility | - -### Method Summary -| Modifier and Type | Method and Description | -| ----------------- | ---------------------- | -| Number | data()
validated payload | -| @Nullable Object | getData()
validated payload | - -## ApplicationjsonAdditionalProperties -public static class ApplicationjsonAdditionalProperties
-extends Int32JsonSchema.Int32JsonSchema1 - -A schema class that validates payloads - -| Methods Inherited from class org.openapijsonschematools.client.schemas.Int32JsonSchema.Int32JsonSchema1 | -| ------------------------------------------------------------------ | -| validate | -| validateAndBox | diff --git a/samples/client/petstore/kotlin/docs/components/responses/successinlinecontentandheader/headers/someheader/SomeHeaderSchema.md b/samples/client/petstore/kotlin/docs/components/responses/successinlinecontentandheader/headers/someheader/SomeHeaderSchema.md deleted file mode 100644 index 752e31ffc15..00000000000 --- a/samples/client/petstore/kotlin/docs/components/responses/successinlinecontentandheader/headers/someheader/SomeHeaderSchema.md +++ /dev/null @@ -1,49 +0,0 @@ -# SomeHeaderSchema -public class SomeHeaderSchema
- -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 - -## Nested Class Summary -| Modifier and Type | Class and Description | -| ----------------- | ---------------------- | -| sealed interface | [SomeHeaderSchema.SomeHeaderSchema1Boxed](#someheaderschema1boxed)
sealed interface for validated payloads | -| record | [SomeHeaderSchema.SomeHeaderSchema1BoxedString](#someheaderschema1boxedstring)
boxed class to store validated String payloads | -| static class | [SomeHeaderSchema.SomeHeaderSchema1](#someheaderschema1)
schema class | - -## SomeHeaderSchema1Boxed -public sealed interface SomeHeaderSchema1Boxed
-permits
-[SomeHeaderSchema1BoxedString](#someheaderschema1boxedstring) - -sealed interface that stores validated payloads using boxed classes - -## SomeHeaderSchema1BoxedString -public record SomeHeaderSchema1BoxedString
-implements [SomeHeaderSchema1Boxed](#someheaderschema1boxed) - -record that stores validated String payloads, sealed permits implementation - -### Constructor Summary -| Constructor and Description | -| --------------------------- | -| SomeHeaderSchema1BoxedString(String data)
Creates an instance, private visibility | - -### Method Summary -| Modifier and Type | Method and Description | -| ----------------- | ---------------------- | -| String | data()
validated payload | -| @Nullable Object | getData()
validated payload | - -## SomeHeaderSchema1 -public static class SomeHeaderSchema1
-extends StringJsonSchema.StringJsonSchema1 - -A schema class that validates payloads - -| Methods Inherited from class org.openapijsonschematools.client.schemas.StringJsonSchema.StringJsonSchema1 | -| ------------------------------------------------------------------ | -| validate | -| validateAndBox | diff --git a/samples/client/petstore/kotlin/docs/components/responses/successwithjsonapiresponse/SuccessWithJsonApiResponseHeadersSchema.md b/samples/client/petstore/kotlin/docs/components/responses/successwithjsonapiresponse/SuccessWithJsonApiResponseHeadersSchema.md deleted file mode 100644 index 6f0c56b5e25..00000000000 --- a/samples/client/petstore/kotlin/docs/components/responses/successwithjsonapiresponse/SuccessWithJsonApiResponseHeadersSchema.md +++ /dev/null @@ -1,527 +0,0 @@ -# SuccessWithJsonApiResponseHeadersSchema -public class SuccessWithJsonApiResponseHeadersSchema
- -A class that contains necessary nested -- schema classes (which validate payloads), extends JsonSchema -- sealed interfaces which store validated payloads, java version of a sum type -- boxed classes which store validated payloads, sealed permits class implementations -- classes to store validated map payloads, extends FrozenMap -- classes to build inputs for map payloads - -## Nested Class Summary -| Modifier and Type | Class and Description | -| ----------------- | ---------------------- | -| sealed interface | [SuccessWithJsonApiResponseHeadersSchema.SuccessWithJsonApiResponseHeadersSchema1Boxed](#successwithjsonapiresponseheadersschema1boxed)
sealed interface for validated payloads | -| record | [SuccessWithJsonApiResponseHeadersSchema.SuccessWithJsonApiResponseHeadersSchema1BoxedMap](#successwithjsonapiresponseheadersschema1boxedmap)
boxed class to store validated Map payloads | -| static class | [SuccessWithJsonApiResponseHeadersSchema.SuccessWithJsonApiResponseHeadersSchema1](#successwithjsonapiresponseheadersschema1)
schema class | -| static class | [SuccessWithJsonApiResponseHeadersSchema.SuccessWithJsonApiResponseHeadersSchemaMapBuilder](#successwithjsonapiresponseheadersschemamapbuilder)
builder for Map payloads | -| static class | [SuccessWithJsonApiResponseHeadersSchema.SuccessWithJsonApiResponseHeadersSchemaMap](#successwithjsonapiresponseheadersschemamap)
output class for Map payloads | -| sealed interface | [SuccessWithJsonApiResponseHeadersSchema.SuccessWithJsonApiResponseAdditionalPropertiesBoxed](#successwithjsonapiresponseadditionalpropertiesboxed)
sealed interface for validated payloads | -| record | [SuccessWithJsonApiResponseHeadersSchema.SuccessWithJsonApiResponseAdditionalPropertiesBoxedVoid](#successwithjsonapiresponseadditionalpropertiesboxedvoid)
boxed class to store validated null payloads | -| record | [SuccessWithJsonApiResponseHeadersSchema.SuccessWithJsonApiResponseAdditionalPropertiesBoxedBoolean](#successwithjsonapiresponseadditionalpropertiesboxedboolean)
boxed class to store validated boolean payloads | -| record | [SuccessWithJsonApiResponseHeadersSchema.SuccessWithJsonApiResponseAdditionalPropertiesBoxedNumber](#successwithjsonapiresponseadditionalpropertiesboxednumber)
boxed class to store validated Number payloads | -| record | [SuccessWithJsonApiResponseHeadersSchema.SuccessWithJsonApiResponseAdditionalPropertiesBoxedString](#successwithjsonapiresponseadditionalpropertiesboxedstring)
boxed class to store validated String payloads | -| record | [SuccessWithJsonApiResponseHeadersSchema.SuccessWithJsonApiResponseAdditionalPropertiesBoxedList](#successwithjsonapiresponseadditionalpropertiesboxedlist)
boxed class to store validated List payloads | -| record | [SuccessWithJsonApiResponseHeadersSchema.SuccessWithJsonApiResponseAdditionalPropertiesBoxedMap](#successwithjsonapiresponseadditionalpropertiesboxedmap)
boxed class to store validated Map payloads | -| static class | [SuccessWithJsonApiResponseHeadersSchema.SuccessWithJsonApiResponseAdditionalProperties](#successwithjsonapiresponseadditionalproperties)
schema class | - -## SuccessWithJsonApiResponseHeadersSchema1Boxed -public sealed interface SuccessWithJsonApiResponseHeadersSchema1Boxed
-permits
-[SuccessWithJsonApiResponseHeadersSchema1BoxedMap](#successwithjsonapiresponseheadersschema1boxedmap) - -sealed interface that stores validated payloads using boxed classes - -## SuccessWithJsonApiResponseHeadersSchema1BoxedMap -public record SuccessWithJsonApiResponseHeadersSchema1BoxedMap
-implements [SuccessWithJsonApiResponseHeadersSchema1Boxed](#successwithjsonapiresponseheadersschema1boxed) - -record that stores validated Map payloads, sealed permits implementation - -### Constructor Summary -| Constructor and Description | -| --------------------------- | -| SuccessWithJsonApiResponseHeadersSchema1BoxedMap([SuccessWithJsonApiResponseHeadersSchemaMap](#successwithjsonapiresponseheadersschemamap) data)
Creates an instance, private visibility | - -### Method Summary -| Modifier and Type | Method and Description | -| ----------------- | ---------------------- | -| [SuccessWithJsonApiResponseHeadersSchemaMap](#successwithjsonapiresponseheadersschemamap) | data()
validated payload | -| @Nullable Object | getData()
validated payload | - -## SuccessWithJsonApiResponseHeadersSchema1 -public static class SuccessWithJsonApiResponseHeadersSchema1
-extends JsonSchema - -A schema class that validates payloads - -### Code Sample -``` -import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags; -import org.openapijsonschematools.client.configurations.SchemaConfiguration; -import org.openapijsonschematools.client.exceptions.ValidationException; -import org.openapijsonschematools.client.schemas.validation.MapUtils; -import org.openapijsonschematools.client.schemas.validation.FrozenList; -import org.openapijsonschematools.client.schemas.validation.FrozenMap; -import org.openapijsonschematools.client.components.responses.successwithjsonapiresponse.SuccessWithJsonApiResponseHeadersSchema; - -import java.util.Arrays; -import java.util.List; -import java.util.AbstractMap; - -static final SchemaConfiguration configuration = new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().build()); - -// Map validation -SuccessWithJsonApiResponseHeadersSchema.SuccessWithJsonApiResponseHeadersSchemaMap validatedPayload = - SuccessWithJsonApiResponseHeadersSchema.SuccessWithJsonApiResponseHeadersSchema1.validate( - new SuccessWithJsonApiResponseHeadersSchema.SuccessWithJsonApiResponseHeadersSchemaMapBuilder() - .int32(1) - - .refHyphenMinusContentHyphenMinusSchemaHyphenMinusHeader("a") - - .stringHeader("a") - - .numberHeader("3.14") - - .build(), - configuration -); -``` - -### Field Summary -| Modifier and Type | Field and Description | -| ----------------- | ---------------------- | -| Set> | type = Set.of(Map.class) | -| Map> | properties = Map.ofEntries(
    new PropertyEntry("ref-schema-header", [StringWithValidation.StringWithValidation1.class](../../../components/schemas/StringWithValidation.md#stringwithvalidation1)),
    new PropertyEntry("int32", [Int32JsonContentTypeHeaderSchema.Int32JsonContentTypeHeaderSchema1.class](../../../components/headers/int32jsoncontenttypeheader/content/applicationjson/Int32JsonContentTypeHeaderSchema.md#int32jsoncontenttypeheaderschema1)),
    new PropertyEntry("ref-content-schema-header", [StringWithValidation.StringWithValidation1.class](../../../components/schemas/StringWithValidation.md#stringwithvalidation1)),
    new PropertyEntry("stringHeader", [StringHeaderSchema.StringHeaderSchema1.class](../../../components/headers/stringheader/StringHeaderSchema.md#stringheaderschema1)),
    new PropertyEntry("numberHeader", [NumberHeaderSchema.NumberHeaderSchema1.class](../../../components/headers/numberheader/NumberHeaderSchema.md#numberheaderschema1))
)
| -| Set | required = Set.of(
    "int32",
    "ref-content-schema-header",
    "ref-schema-header",
    "stringHeader"
)
| -| Class | additionalProperties = [SuccessWithJsonApiResponseAdditionalProperties.class](#successwithjsonapiresponseadditionalproperties) | - -### Method Summary -| Modifier and Type | Method and Description | -| ----------------- | ---------------------- | -| [SuccessWithJsonApiResponseHeadersSchemaMap](#successwithjsonapiresponseheadersschemamap) | validate([Map<?, ?>](#successwithjsonapiresponseheadersschemamapbuilder) arg, SchemaConfiguration configuration) | -| [SuccessWithJsonApiResponseHeadersSchema1BoxedMap](#successwithjsonapiresponseheadersschema1boxedmap) | validateAndBox([Map<?, ?>](#successwithjsonapiresponseheadersschemamapbuilder) arg, SchemaConfiguration configuration) | -| [SuccessWithJsonApiResponseHeadersSchema1Boxed](#successwithjsonapiresponseheadersschema1boxed) | validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) | -| @Nullable Object | validate(@Nullable Object arg, SchemaConfiguration configuration) | - -## SuccessWithJsonApiResponseHeadersSchemaMap0000Builder -public class SuccessWithJsonApiResponseHeadersSchemaMap0000Builder
-builder for `Map` - -A class that builds the Map input type - -### Constructor Summary -| Constructor and Description | -| --------------------------- | -| SuccessWithJsonApiResponseHeadersSchemaMap0000Builder(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 | -| [SuccessWithJsonApiResponseHeadersSchemaMap0000Builder](#successwithjsonapiresponseheadersschemamap0000builder) | numberHeader(String value) | - -## SuccessWithJsonApiResponseHeadersSchemaMap0001Builder -public class SuccessWithJsonApiResponseHeadersSchemaMap0001Builder
-builder for `Map` - -A class that builds the Map input type - -### Constructor Summary -| Constructor and Description | -| --------------------------- | -| SuccessWithJsonApiResponseHeadersSchemaMap0001Builder(Map instance)
Creates a builder that contains the passed instance | - -### Method Summary -| Modifier and Type | Method and Description | -| ----------------- | ---------------------- | -| [SuccessWithJsonApiResponseHeadersSchemaMap0000Builder](#successwithjsonapiresponseheadersschemamap0000builder) | stringHeader(String value) | - -## SuccessWithJsonApiResponseHeadersSchemaMap0010Builder -public class SuccessWithJsonApiResponseHeadersSchemaMap0010Builder
-builder for `Map` - -A class that builds the Map input type - -### Constructor Summary -| Constructor and Description | -| --------------------------- | -| SuccessWithJsonApiResponseHeadersSchemaMap0010Builder(Map instance)
Creates a builder that contains the passed instance | - -### Method Summary -| Modifier and Type | Method and Description | -| ----------------- | ---------------------- | -| [SuccessWithJsonApiResponseHeadersSchemaMap0000Builder](#successwithjsonapiresponseheadersschemamap0000builder) | refHyphenMinusSchemaHyphenMinusHeader(String value) | - -## SuccessWithJsonApiResponseHeadersSchemaMap0011Builder -public class SuccessWithJsonApiResponseHeadersSchemaMap0011Builder
-builder for `Map` - -A class that builds the Map input type - -### Constructor Summary -| Constructor and Description | -| --------------------------- | -| SuccessWithJsonApiResponseHeadersSchemaMap0011Builder(Map instance)
Creates a builder that contains the passed instance | - -### Method Summary -| Modifier and Type | Method and Description | -| ----------------- | ---------------------- | -| [SuccessWithJsonApiResponseHeadersSchemaMap0001Builder](#successwithjsonapiresponseheadersschemamap0001builder) | refHyphenMinusSchemaHyphenMinusHeader(String value) | -| [SuccessWithJsonApiResponseHeadersSchemaMap0010Builder](#successwithjsonapiresponseheadersschemamap0010builder) | stringHeader(String value) | - -## SuccessWithJsonApiResponseHeadersSchemaMap0100Builder -public class SuccessWithJsonApiResponseHeadersSchemaMap0100Builder
-builder for `Map` - -A class that builds the Map input type - -### Constructor Summary -| Constructor and Description | -| --------------------------- | -| SuccessWithJsonApiResponseHeadersSchemaMap0100Builder(Map instance)
Creates a builder that contains the passed instance | - -### Method Summary -| Modifier and Type | Method and Description | -| ----------------- | ---------------------- | -| [SuccessWithJsonApiResponseHeadersSchemaMap0000Builder](#successwithjsonapiresponseheadersschemamap0000builder) | refHyphenMinusContentHyphenMinusSchemaHyphenMinusHeader(String value) | - -## SuccessWithJsonApiResponseHeadersSchemaMap0101Builder -public class SuccessWithJsonApiResponseHeadersSchemaMap0101Builder
-builder for `Map` - -A class that builds the Map input type - -### Constructor Summary -| Constructor and Description | -| --------------------------- | -| SuccessWithJsonApiResponseHeadersSchemaMap0101Builder(Map instance)
Creates a builder that contains the passed instance | - -### Method Summary -| Modifier and Type | Method and Description | -| ----------------- | ---------------------- | -| [SuccessWithJsonApiResponseHeadersSchemaMap0001Builder](#successwithjsonapiresponseheadersschemamap0001builder) | refHyphenMinusContentHyphenMinusSchemaHyphenMinusHeader(String value) | -| [SuccessWithJsonApiResponseHeadersSchemaMap0100Builder](#successwithjsonapiresponseheadersschemamap0100builder) | stringHeader(String value) | - -## SuccessWithJsonApiResponseHeadersSchemaMap0110Builder -public class SuccessWithJsonApiResponseHeadersSchemaMap0110Builder
-builder for `Map` - -A class that builds the Map input type - -### Constructor Summary -| Constructor and Description | -| --------------------------- | -| SuccessWithJsonApiResponseHeadersSchemaMap0110Builder(Map instance)
Creates a builder that contains the passed instance | - -### Method Summary -| Modifier and Type | Method and Description | -| ----------------- | ---------------------- | -| [SuccessWithJsonApiResponseHeadersSchemaMap0010Builder](#successwithjsonapiresponseheadersschemamap0010builder) | refHyphenMinusContentHyphenMinusSchemaHyphenMinusHeader(String value) | -| [SuccessWithJsonApiResponseHeadersSchemaMap0100Builder](#successwithjsonapiresponseheadersschemamap0100builder) | refHyphenMinusSchemaHyphenMinusHeader(String value) | - -## SuccessWithJsonApiResponseHeadersSchemaMap0111Builder -public class SuccessWithJsonApiResponseHeadersSchemaMap0111Builder
-builder for `Map` - -A class that builds the Map input type - -### Constructor Summary -| Constructor and Description | -| --------------------------- | -| SuccessWithJsonApiResponseHeadersSchemaMap0111Builder(Map instance)
Creates a builder that contains the passed instance | - -### Method Summary -| Modifier and Type | Method and Description | -| ----------------- | ---------------------- | -| [SuccessWithJsonApiResponseHeadersSchemaMap0011Builder](#successwithjsonapiresponseheadersschemamap0011builder) | refHyphenMinusContentHyphenMinusSchemaHyphenMinusHeader(String value) | -| [SuccessWithJsonApiResponseHeadersSchemaMap0101Builder](#successwithjsonapiresponseheadersschemamap0101builder) | refHyphenMinusSchemaHyphenMinusHeader(String value) | -| [SuccessWithJsonApiResponseHeadersSchemaMap0110Builder](#successwithjsonapiresponseheadersschemamap0110builder) | stringHeader(String value) | - -## SuccessWithJsonApiResponseHeadersSchemaMap1000Builder -public class SuccessWithJsonApiResponseHeadersSchemaMap1000Builder
-builder for `Map` - -A class that builds the Map input type - -### Constructor Summary -| Constructor and Description | -| --------------------------- | -| SuccessWithJsonApiResponseHeadersSchemaMap1000Builder(Map instance)
Creates a builder that contains the passed instance | - -### Method Summary -| Modifier and Type | Method and Description | -| ----------------- | ---------------------- | -| [SuccessWithJsonApiResponseHeadersSchemaMap0000Builder](#successwithjsonapiresponseheadersschemamap0000builder) | int32(int value) | -| [SuccessWithJsonApiResponseHeadersSchemaMap0000Builder](#successwithjsonapiresponseheadersschemamap0000builder) | int32(float value) | - -## SuccessWithJsonApiResponseHeadersSchemaMap1001Builder -public class SuccessWithJsonApiResponseHeadersSchemaMap1001Builder
-builder for `Map` - -A class that builds the Map input type - -### Constructor Summary -| Constructor and Description | -| --------------------------- | -| SuccessWithJsonApiResponseHeadersSchemaMap1001Builder(Map instance)
Creates a builder that contains the passed instance | - -### Method Summary -| Modifier and Type | Method and Description | -| ----------------- | ---------------------- | -| [SuccessWithJsonApiResponseHeadersSchemaMap0001Builder](#successwithjsonapiresponseheadersschemamap0001builder) | int32(int value) | -| [SuccessWithJsonApiResponseHeadersSchemaMap0001Builder](#successwithjsonapiresponseheadersschemamap0001builder) | int32(float value) | -| [SuccessWithJsonApiResponseHeadersSchemaMap1000Builder](#successwithjsonapiresponseheadersschemamap1000builder) | stringHeader(String value) | - -## SuccessWithJsonApiResponseHeadersSchemaMap1010Builder -public class SuccessWithJsonApiResponseHeadersSchemaMap1010Builder
-builder for `Map` - -A class that builds the Map input type - -### Constructor Summary -| Constructor and Description | -| --------------------------- | -| SuccessWithJsonApiResponseHeadersSchemaMap1010Builder(Map instance)
Creates a builder that contains the passed instance | - -### Method Summary -| Modifier and Type | Method and Description | -| ----------------- | ---------------------- | -| [SuccessWithJsonApiResponseHeadersSchemaMap0010Builder](#successwithjsonapiresponseheadersschemamap0010builder) | int32(int value) | -| [SuccessWithJsonApiResponseHeadersSchemaMap0010Builder](#successwithjsonapiresponseheadersschemamap0010builder) | int32(float value) | -| [SuccessWithJsonApiResponseHeadersSchemaMap1000Builder](#successwithjsonapiresponseheadersschemamap1000builder) | refHyphenMinusSchemaHyphenMinusHeader(String value) | - -## SuccessWithJsonApiResponseHeadersSchemaMap1011Builder -public class SuccessWithJsonApiResponseHeadersSchemaMap1011Builder
-builder for `Map` - -A class that builds the Map input type - -### Constructor Summary -| Constructor and Description | -| --------------------------- | -| SuccessWithJsonApiResponseHeadersSchemaMap1011Builder(Map instance)
Creates a builder that contains the passed instance | - -### Method Summary -| Modifier and Type | Method and Description | -| ----------------- | ---------------------- | -| [SuccessWithJsonApiResponseHeadersSchemaMap0011Builder](#successwithjsonapiresponseheadersschemamap0011builder) | int32(int value) | -| [SuccessWithJsonApiResponseHeadersSchemaMap0011Builder](#successwithjsonapiresponseheadersschemamap0011builder) | int32(float value) | -| [SuccessWithJsonApiResponseHeadersSchemaMap1001Builder](#successwithjsonapiresponseheadersschemamap1001builder) | refHyphenMinusSchemaHyphenMinusHeader(String value) | -| [SuccessWithJsonApiResponseHeadersSchemaMap1010Builder](#successwithjsonapiresponseheadersschemamap1010builder) | stringHeader(String value) | - -## SuccessWithJsonApiResponseHeadersSchemaMap1100Builder -public class SuccessWithJsonApiResponseHeadersSchemaMap1100Builder
-builder for `Map` - -A class that builds the Map input type - -### Constructor Summary -| Constructor and Description | -| --------------------------- | -| SuccessWithJsonApiResponseHeadersSchemaMap1100Builder(Map instance)
Creates a builder that contains the passed instance | - -### Method Summary -| Modifier and Type | Method and Description | -| ----------------- | ---------------------- | -| [SuccessWithJsonApiResponseHeadersSchemaMap0100Builder](#successwithjsonapiresponseheadersschemamap0100builder) | int32(int value) | -| [SuccessWithJsonApiResponseHeadersSchemaMap0100Builder](#successwithjsonapiresponseheadersschemamap0100builder) | int32(float value) | -| [SuccessWithJsonApiResponseHeadersSchemaMap1000Builder](#successwithjsonapiresponseheadersschemamap1000builder) | refHyphenMinusContentHyphenMinusSchemaHyphenMinusHeader(String value) | - -## SuccessWithJsonApiResponseHeadersSchemaMap1101Builder -public class SuccessWithJsonApiResponseHeadersSchemaMap1101Builder
-builder for `Map` - -A class that builds the Map input type - -### Constructor Summary -| Constructor and Description | -| --------------------------- | -| SuccessWithJsonApiResponseHeadersSchemaMap1101Builder(Map instance)
Creates a builder that contains the passed instance | - -### Method Summary -| Modifier and Type | Method and Description | -| ----------------- | ---------------------- | -| [SuccessWithJsonApiResponseHeadersSchemaMap0101Builder](#successwithjsonapiresponseheadersschemamap0101builder) | int32(int value) | -| [SuccessWithJsonApiResponseHeadersSchemaMap0101Builder](#successwithjsonapiresponseheadersschemamap0101builder) | int32(float value) | -| [SuccessWithJsonApiResponseHeadersSchemaMap1001Builder](#successwithjsonapiresponseheadersschemamap1001builder) | refHyphenMinusContentHyphenMinusSchemaHyphenMinusHeader(String value) | -| [SuccessWithJsonApiResponseHeadersSchemaMap1100Builder](#successwithjsonapiresponseheadersschemamap1100builder) | stringHeader(String value) | - -## SuccessWithJsonApiResponseHeadersSchemaMap1110Builder -public class SuccessWithJsonApiResponseHeadersSchemaMap1110Builder
-builder for `Map` - -A class that builds the Map input type - -### Constructor Summary -| Constructor and Description | -| --------------------------- | -| SuccessWithJsonApiResponseHeadersSchemaMap1110Builder(Map instance)
Creates a builder that contains the passed instance | - -### Method Summary -| Modifier and Type | Method and Description | -| ----------------- | ---------------------- | -| [SuccessWithJsonApiResponseHeadersSchemaMap0110Builder](#successwithjsonapiresponseheadersschemamap0110builder) | int32(int value) | -| [SuccessWithJsonApiResponseHeadersSchemaMap0110Builder](#successwithjsonapiresponseheadersschemamap0110builder) | int32(float value) | -| [SuccessWithJsonApiResponseHeadersSchemaMap1010Builder](#successwithjsonapiresponseheadersschemamap1010builder) | refHyphenMinusContentHyphenMinusSchemaHyphenMinusHeader(String value) | -| [SuccessWithJsonApiResponseHeadersSchemaMap1100Builder](#successwithjsonapiresponseheadersschemamap1100builder) | refHyphenMinusSchemaHyphenMinusHeader(String value) | - -## SuccessWithJsonApiResponseHeadersSchemaMapBuilder -public class SuccessWithJsonApiResponseHeadersSchemaMapBuilder
-builder for `Map` - -A class that builds the Map input type - -### Constructor Summary -| Constructor and Description | -| --------------------------- | -| SuccessWithJsonApiResponseHeadersSchemaMapBuilder()
Creates a builder that contains an empty map | - -### Method Summary -| Modifier and Type | Method and Description | -| ----------------- | ---------------------- | -| [SuccessWithJsonApiResponseHeadersSchemaMap0111Builder](#successwithjsonapiresponseheadersschemamap0111builder) | int32(int value) | -| [SuccessWithJsonApiResponseHeadersSchemaMap0111Builder](#successwithjsonapiresponseheadersschemamap0111builder) | int32(float value) | -| [SuccessWithJsonApiResponseHeadersSchemaMap1011Builder](#successwithjsonapiresponseheadersschemamap1011builder) | refHyphenMinusContentHyphenMinusSchemaHyphenMinusHeader(String value) | -| [SuccessWithJsonApiResponseHeadersSchemaMap1101Builder](#successwithjsonapiresponseheadersschemamap1101builder) | refHyphenMinusSchemaHyphenMinusHeader(String value) | -| [SuccessWithJsonApiResponseHeadersSchemaMap1110Builder](#successwithjsonapiresponseheadersschemamap1110builder) | stringHeader(String value) | - -## SuccessWithJsonApiResponseHeadersSchemaMap -public static class SuccessWithJsonApiResponseHeadersSchemaMap
-extends FrozenMap - -A class to store validated Map payloads - -### Method Summary -| Modifier and Type | Method and Description | -| ----------------- | ---------------------- | -| static [SuccessWithJsonApiResponseHeadersSchemaMap](#successwithjsonapiresponseheadersschemamap) | of([Map](#successwithjsonapiresponseheadersschemamapbuilder) arg, SchemaConfiguration configuration) | -| Number | int32()
| -| String | stringHeader()
| -| String | numberHeader()
[optional] | -| @Nullable Object | get(String key)
This schema has invalid Java names so this method must be used when you access instance["ref-content-schema-header"], instance["ref-schema-header"], | - -## SuccessWithJsonApiResponseAdditionalPropertiesBoxed -public sealed interface SuccessWithJsonApiResponseAdditionalPropertiesBoxed
-permits
-[SuccessWithJsonApiResponseAdditionalPropertiesBoxedVoid](#successwithjsonapiresponseadditionalpropertiesboxedvoid), -[SuccessWithJsonApiResponseAdditionalPropertiesBoxedBoolean](#successwithjsonapiresponseadditionalpropertiesboxedboolean), -[SuccessWithJsonApiResponseAdditionalPropertiesBoxedNumber](#successwithjsonapiresponseadditionalpropertiesboxednumber), -[SuccessWithJsonApiResponseAdditionalPropertiesBoxedString](#successwithjsonapiresponseadditionalpropertiesboxedstring), -[SuccessWithJsonApiResponseAdditionalPropertiesBoxedList](#successwithjsonapiresponseadditionalpropertiesboxedlist), -[SuccessWithJsonApiResponseAdditionalPropertiesBoxedMap](#successwithjsonapiresponseadditionalpropertiesboxedmap) - -sealed interface that stores validated payloads using boxed classes - -## SuccessWithJsonApiResponseAdditionalPropertiesBoxedVoid -public record SuccessWithJsonApiResponseAdditionalPropertiesBoxedVoid
-implements [SuccessWithJsonApiResponseAdditionalPropertiesBoxed](#successwithjsonapiresponseadditionalpropertiesboxed) - -record that stores validated null payloads, sealed permits implementation - -### Constructor Summary -| Constructor and Description | -| --------------------------- | -| SuccessWithJsonApiResponseAdditionalPropertiesBoxedVoid(Nothing? data)
Creates an instance, private visibility | - -### Method Summary -| Modifier and Type | Method and Description | -| ----------------- | ---------------------- | -| Nothing? | data()
validated payload | -| @Nullable Object | getData()
validated payload | - -## SuccessWithJsonApiResponseAdditionalPropertiesBoxedBoolean -public record SuccessWithJsonApiResponseAdditionalPropertiesBoxedBoolean
-implements [SuccessWithJsonApiResponseAdditionalPropertiesBoxed](#successwithjsonapiresponseadditionalpropertiesboxed) - -record that stores validated boolean payloads, sealed permits implementation - -### Constructor Summary -| Constructor and Description | -| --------------------------- | -| SuccessWithJsonApiResponseAdditionalPropertiesBoxedBoolean(boolean data)
Creates an instance, private visibility | - -### Method Summary -| Modifier and Type | Method and Description | -| ----------------- | ---------------------- | -| boolean | data()
validated payload | -| @Nullable Object | getData()
validated payload | - -## SuccessWithJsonApiResponseAdditionalPropertiesBoxedNumber -public record SuccessWithJsonApiResponseAdditionalPropertiesBoxedNumber
-implements [SuccessWithJsonApiResponseAdditionalPropertiesBoxed](#successwithjsonapiresponseadditionalpropertiesboxed) - -record that stores validated Number payloads, sealed permits implementation - -### Constructor Summary -| Constructor and Description | -| --------------------------- | -| SuccessWithJsonApiResponseAdditionalPropertiesBoxedNumber(Number data)
Creates an instance, private visibility | - -### Method Summary -| Modifier and Type | Method and Description | -| ----------------- | ---------------------- | -| Number | data()
validated payload | -| @Nullable Object | getData()
validated payload | - -## SuccessWithJsonApiResponseAdditionalPropertiesBoxedString -public record SuccessWithJsonApiResponseAdditionalPropertiesBoxedString
-implements [SuccessWithJsonApiResponseAdditionalPropertiesBoxed](#successwithjsonapiresponseadditionalpropertiesboxed) - -record that stores validated String payloads, sealed permits implementation - -### Constructor Summary -| Constructor and Description | -| --------------------------- | -| SuccessWithJsonApiResponseAdditionalPropertiesBoxedString(String data)
Creates an instance, private visibility | - -### Method Summary -| Modifier and Type | Method and Description | -| ----------------- | ---------------------- | -| String | data()
validated payload | -| @Nullable Object | getData()
validated payload | - -## SuccessWithJsonApiResponseAdditionalPropertiesBoxedList -public record SuccessWithJsonApiResponseAdditionalPropertiesBoxedList
-implements [SuccessWithJsonApiResponseAdditionalPropertiesBoxed](#successwithjsonapiresponseadditionalpropertiesboxed) - -record that stores validated List payloads, sealed permits implementation - -### Constructor Summary -| Constructor and Description | -| --------------------------- | -| SuccessWithJsonApiResponseAdditionalPropertiesBoxedList(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 | - -## SuccessWithJsonApiResponseAdditionalPropertiesBoxedMap -public record SuccessWithJsonApiResponseAdditionalPropertiesBoxedMap
-implements [SuccessWithJsonApiResponseAdditionalPropertiesBoxed](#successwithjsonapiresponseadditionalpropertiesboxed) - -record that stores validated Map payloads, sealed permits implementation - -### Constructor Summary -| Constructor and Description | -| --------------------------- | -| SuccessWithJsonApiResponseAdditionalPropertiesBoxedMap(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 | - -## SuccessWithJsonApiResponseAdditionalProperties -public static class SuccessWithJsonApiResponseAdditionalProperties
-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/kotlin/docs/components/responses/successwithjsonapiresponse/content/applicationjson/ApplicationjsonSchema.md b/samples/client/petstore/kotlin/docs/components/responses/successwithjsonapiresponse/content/applicationjson/ApplicationjsonSchema.md deleted file mode 100644 index a340ff691f7..00000000000 --- a/samples/client/petstore/kotlin/docs/components/responses/successwithjsonapiresponse/content/applicationjson/ApplicationjsonSchema.md +++ /dev/null @@ -1,19 +0,0 @@ -# ApplicationjsonSchema -public class ApplicationjsonSchema
-extends [ApiResponseSchema1](../../../../../components/schemas/ApiResponseSchema.md#apiresponseschema) - -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 - -## Nested Class Summary -| Modifier and Type | Class and Description | -| ----------------- | ---------------------- | -| static class | [ApplicationjsonSchema.ApplicationjsonSchema1](#applicationjsonschema1)
schema class | - -## ApplicationjsonSchema1 -public static class ApplicationjsonSchema1
-extends [ApiResponseSchema.ApiResponseSchema1](../../../../../components/schemas/ApiResponseSchema.md#apiresponseschema1) - -A schema class that validates payloads diff --git a/samples/client/petstore/kotlin/docs/components/schemas/AbstractStepMessage.md b/samples/client/petstore/kotlin/docs/components/schemas/AbstractStepMessage.md deleted file mode 100644 index f74184b871b..00000000000 --- a/samples/client/petstore/kotlin/docs/components/schemas/AbstractStepMessage.md +++ /dev/null @@ -1,356 +0,0 @@ -# AbstractStepMessage -org.openapijsonschematools.client.components.schemas.AbstractStepMessage.java -public class AbstractStepMessage
- -A class that contains necessary nested -- schema classes (which validate payloads), extends JsonSchema -- sealed interfaces which store validated payloads, java version of a sum type -- boxed classes which store validated payloads, sealed permits class implementations -- classes to store validated map payloads, extends FrozenMap -- classes to build inputs for map payloads - -## Nested Class Summary -| Modifier and Type | Class and Description | -| ----------------- | ---------------------- | -| sealed interface | [AbstractStepMessage.AbstractStepMessage1Boxed](#abstractstepmessage1boxed)
sealed interface for validated payloads | -| record | [AbstractStepMessage.AbstractStepMessage1BoxedMap](#abstractstepmessage1boxedmap)
boxed class to store validated Map payloads | -| static class | [AbstractStepMessage.AbstractStepMessage1](#abstractstepmessage1)
schema class | -| static class | [AbstractStepMessage.AbstractStepMessageMapBuilder](#abstractstepmessagemapbuilder)
builder for Map payloads | -| static class | [AbstractStepMessage.AbstractStepMessageMap](#abstractstepmessagemap)
output class for Map payloads | -| sealed interface | [AbstractStepMessage.DiscriminatorBoxed](#discriminatorboxed)
sealed interface for validated payloads | -| record | [AbstractStepMessage.DiscriminatorBoxedString](#discriminatorboxedstring)
boxed class to store validated String payloads | -| static class | [AbstractStepMessage.Discriminator](#discriminator)
schema class | - -## AbstractStepMessage1Boxed -public sealed interface AbstractStepMessage1Boxed
-permits
-[AbstractStepMessage1BoxedMap](#abstractstepmessage1boxedmap) - -sealed interface that stores validated payloads using boxed classes - -## AbstractStepMessage1BoxedMap -public record AbstractStepMessage1BoxedMap
-implements [AbstractStepMessage1Boxed](#abstractstepmessage1boxed) - -record that stores validated Map payloads, sealed permits implementation - -### Constructor Summary -| Constructor and Description | -| --------------------------- | -| AbstractStepMessage1BoxedMap([AbstractStepMessageMap](#abstractstepmessagemap) data)
Creates an instance, private visibility | - -### Method Summary -| Modifier and Type | Method and Description | -| ----------------- | ---------------------- | -| [AbstractStepMessageMap](#abstractstepmessagemap) | data()
validated payload | -| @Nullable Object | getData()
validated payload | - -## AbstractStepMessage1 -public static class AbstractStepMessage1
-extends JsonSchema - -A schema class that validates payloads - -## Description -Abstract Step - -### Code Sample -``` -import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags; -import org.openapijsonschematools.client.configurations.SchemaConfiguration; -import org.openapijsonschematools.client.exceptions.ValidationException; -import org.openapijsonschematools.client.schemas.validation.MapUtils; -import org.openapijsonschematools.client.schemas.validation.FrozenList; -import org.openapijsonschematools.client.schemas.validation.FrozenMap; -import org.openapijsonschematools.client.components.schemas.AbstractStepMessage; - -import java.util.Arrays; -import java.util.List; -import java.util.AbstractMap; - -static final SchemaConfiguration configuration = new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().build()); - -// Map validation -AbstractStepMessage.AbstractStepMessageMap validatedPayload = - AbstractStepMessage.AbstractStepMessage1.validate( - new AbstractStepMessage.AbstractStepMessageMapBuilder() - .discriminator("a") - - .build(), - configuration -); -``` - -### Field Summary -| Modifier and Type | Field and Description | -| ----------------- | ---------------------- | -| Set> | type = Set.of(Map.class) | -| Map> | properties = Map.ofEntries(
    new PropertyEntry("discriminator", [Discriminator.class](#discriminator)))
)
| -| Set | required = Set.of(
    "description",
    "discriminator",
    "sequenceNumber"
)
| -| List> | anyOf = List.of(
    [AbstractStepMessage1.class](#abstractstepmessage1)
)
| - -### Method Summary -| Modifier and Type | Method and Description | -| ----------------- | ---------------------- | -| [AbstractStepMessageMap](#abstractstepmessagemap) | validate([Map<?, ?>](#abstractstepmessagemapbuilder) arg, SchemaConfiguration configuration) | -| [AbstractStepMessage1BoxedMap](#abstractstepmessage1boxedmap) | validateAndBox([Map<?, ?>](#abstractstepmessagemapbuilder) arg, SchemaConfiguration configuration) | -| [AbstractStepMessage1Boxed](#abstractstepmessage1boxed) | validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) | -| @Nullable Object | validate(@Nullable Object arg, SchemaConfiguration configuration) | - -## AbstractStepMessageMap000Builder -public class AbstractStepMessageMap000Builder
-builder for `Map` - -A class that builds the Map input type - -### Constructor Summary -| Constructor and Description | -| --------------------------- | -| AbstractStepMessageMap000Builder(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 | -| [AbstractStepMessageMap000Builder](#abstractstepmessagemap000builder) | additionalProperty(String key, Nothing? value) | -| [AbstractStepMessageMap000Builder](#abstractstepmessagemap000builder) | additionalProperty(String key, boolean value) | -| [AbstractStepMessageMap000Builder](#abstractstepmessagemap000builder) | additionalProperty(String key, String value) | -| [AbstractStepMessageMap000Builder](#abstractstepmessagemap000builder) | additionalProperty(String key, int value) | -| [AbstractStepMessageMap000Builder](#abstractstepmessagemap000builder) | additionalProperty(String key, float value) | -| [AbstractStepMessageMap000Builder](#abstractstepmessagemap000builder) | additionalProperty(String key, long value) | -| [AbstractStepMessageMap000Builder](#abstractstepmessagemap000builder) | additionalProperty(String key, double value) | -| [AbstractStepMessageMap000Builder](#abstractstepmessagemap000builder) | additionalProperty(String key, List value) | -| [AbstractStepMessageMap000Builder](#abstractstepmessagemap000builder) | additionalProperty(String key, Map value) | - -## AbstractStepMessageMap001Builder -public class AbstractStepMessageMap001Builder
-builder for `Map` - -A class that builds the Map input type - -### Constructor Summary -| Constructor and Description | -| --------------------------- | -| AbstractStepMessageMap001Builder(Map instance)
Creates a builder that contains the passed instance | - -### Method Summary -| Modifier and Type | Method and Description | -| ----------------- | ---------------------- | -| [AbstractStepMessageMap000Builder](#abstractstepmessagemap000builder) | sequenceNumber(Nothing? value) | -| [AbstractStepMessageMap000Builder](#abstractstepmessagemap000builder) | sequenceNumber(boolean value) | -| [AbstractStepMessageMap000Builder](#abstractstepmessagemap000builder) | sequenceNumber(String value) | -| [AbstractStepMessageMap000Builder](#abstractstepmessagemap000builder) | sequenceNumber(int value) | -| [AbstractStepMessageMap000Builder](#abstractstepmessagemap000builder) | sequenceNumber(float value) | -| [AbstractStepMessageMap000Builder](#abstractstepmessagemap000builder) | sequenceNumber(long value) | -| [AbstractStepMessageMap000Builder](#abstractstepmessagemap000builder) | sequenceNumber(double value) | -| [AbstractStepMessageMap000Builder](#abstractstepmessagemap000builder) | sequenceNumber(List value) | -| [AbstractStepMessageMap000Builder](#abstractstepmessagemap000builder) | sequenceNumber(Map value) | - -## AbstractStepMessageMap010Builder -public class AbstractStepMessageMap010Builder
-builder for `Map` - -A class that builds the Map input type - -### Constructor Summary -| Constructor and Description | -| --------------------------- | -| AbstractStepMessageMap010Builder(Map instance)
Creates a builder that contains the passed instance | - -### Method Summary -| Modifier and Type | Method and Description | -| ----------------- | ---------------------- | -| [AbstractStepMessageMap000Builder](#abstractstepmessagemap000builder) | discriminator(String value) | - -## AbstractStepMessageMap011Builder -public class AbstractStepMessageMap011Builder
-builder for `Map` - -A class that builds the Map input type - -### Constructor Summary -| Constructor and Description | -| --------------------------- | -| AbstractStepMessageMap011Builder(Map instance)
Creates a builder that contains the passed instance | - -### Method Summary -| Modifier and Type | Method and Description | -| ----------------- | ---------------------- | -| [AbstractStepMessageMap001Builder](#abstractstepmessagemap001builder) | discriminator(String value) | -| [AbstractStepMessageMap010Builder](#abstractstepmessagemap010builder) | sequenceNumber(Nothing? value) | -| [AbstractStepMessageMap010Builder](#abstractstepmessagemap010builder) | sequenceNumber(boolean value) | -| [AbstractStepMessageMap010Builder](#abstractstepmessagemap010builder) | sequenceNumber(String value) | -| [AbstractStepMessageMap010Builder](#abstractstepmessagemap010builder) | sequenceNumber(int value) | -| [AbstractStepMessageMap010Builder](#abstractstepmessagemap010builder) | sequenceNumber(float value) | -| [AbstractStepMessageMap010Builder](#abstractstepmessagemap010builder) | sequenceNumber(long value) | -| [AbstractStepMessageMap010Builder](#abstractstepmessagemap010builder) | sequenceNumber(double value) | -| [AbstractStepMessageMap010Builder](#abstractstepmessagemap010builder) | sequenceNumber(List value) | -| [AbstractStepMessageMap010Builder](#abstractstepmessagemap010builder) | sequenceNumber(Map value) | - -## AbstractStepMessageMap100Builder -public class AbstractStepMessageMap100Builder
-builder for `Map` - -A class that builds the Map input type - -### Constructor Summary -| Constructor and Description | -| --------------------------- | -| AbstractStepMessageMap100Builder(Map instance)
Creates a builder that contains the passed instance | - -### Method Summary -| Modifier and Type | Method and Description | -| ----------------- | ---------------------- | -| [AbstractStepMessageMap000Builder](#abstractstepmessagemap000builder) | description(Nothing? value) | -| [AbstractStepMessageMap000Builder](#abstractstepmessagemap000builder) | description(boolean value) | -| [AbstractStepMessageMap000Builder](#abstractstepmessagemap000builder) | description(String value) | -| [AbstractStepMessageMap000Builder](#abstractstepmessagemap000builder) | description(int value) | -| [AbstractStepMessageMap000Builder](#abstractstepmessagemap000builder) | description(float value) | -| [AbstractStepMessageMap000Builder](#abstractstepmessagemap000builder) | description(long value) | -| [AbstractStepMessageMap000Builder](#abstractstepmessagemap000builder) | description(double value) | -| [AbstractStepMessageMap000Builder](#abstractstepmessagemap000builder) | description(List value) | -| [AbstractStepMessageMap000Builder](#abstractstepmessagemap000builder) | description(Map value) | - -## AbstractStepMessageMap101Builder -public class AbstractStepMessageMap101Builder
-builder for `Map` - -A class that builds the Map input type - -### Constructor Summary -| Constructor and Description | -| --------------------------- | -| AbstractStepMessageMap101Builder(Map instance)
Creates a builder that contains the passed instance | - -### Method Summary -| Modifier and Type | Method and Description | -| ----------------- | ---------------------- | -| [AbstractStepMessageMap001Builder](#abstractstepmessagemap001builder) | description(Nothing? value) | -| [AbstractStepMessageMap001Builder](#abstractstepmessagemap001builder) | description(boolean value) | -| [AbstractStepMessageMap001Builder](#abstractstepmessagemap001builder) | description(String value) | -| [AbstractStepMessageMap001Builder](#abstractstepmessagemap001builder) | description(int value) | -| [AbstractStepMessageMap001Builder](#abstractstepmessagemap001builder) | description(float value) | -| [AbstractStepMessageMap001Builder](#abstractstepmessagemap001builder) | description(long value) | -| [AbstractStepMessageMap001Builder](#abstractstepmessagemap001builder) | description(double value) | -| [AbstractStepMessageMap001Builder](#abstractstepmessagemap001builder) | description(List value) | -| [AbstractStepMessageMap001Builder](#abstractstepmessagemap001builder) | description(Map value) | -| [AbstractStepMessageMap100Builder](#abstractstepmessagemap100builder) | sequenceNumber(Nothing? value) | -| [AbstractStepMessageMap100Builder](#abstractstepmessagemap100builder) | sequenceNumber(boolean value) | -| [AbstractStepMessageMap100Builder](#abstractstepmessagemap100builder) | sequenceNumber(String value) | -| [AbstractStepMessageMap100Builder](#abstractstepmessagemap100builder) | sequenceNumber(int value) | -| [AbstractStepMessageMap100Builder](#abstractstepmessagemap100builder) | sequenceNumber(float value) | -| [AbstractStepMessageMap100Builder](#abstractstepmessagemap100builder) | sequenceNumber(long value) | -| [AbstractStepMessageMap100Builder](#abstractstepmessagemap100builder) | sequenceNumber(double value) | -| [AbstractStepMessageMap100Builder](#abstractstepmessagemap100builder) | sequenceNumber(List value) | -| [AbstractStepMessageMap100Builder](#abstractstepmessagemap100builder) | sequenceNumber(Map value) | - -## AbstractStepMessageMap110Builder -public class AbstractStepMessageMap110Builder
-builder for `Map` - -A class that builds the Map input type - -### Constructor Summary -| Constructor and Description | -| --------------------------- | -| AbstractStepMessageMap110Builder(Map instance)
Creates a builder that contains the passed instance | - -### Method Summary -| Modifier and Type | Method and Description | -| ----------------- | ---------------------- | -| [AbstractStepMessageMap010Builder](#abstractstepmessagemap010builder) | description(Nothing? value) | -| [AbstractStepMessageMap010Builder](#abstractstepmessagemap010builder) | description(boolean value) | -| [AbstractStepMessageMap010Builder](#abstractstepmessagemap010builder) | description(String value) | -| [AbstractStepMessageMap010Builder](#abstractstepmessagemap010builder) | description(int value) | -| [AbstractStepMessageMap010Builder](#abstractstepmessagemap010builder) | description(float value) | -| [AbstractStepMessageMap010Builder](#abstractstepmessagemap010builder) | description(long value) | -| [AbstractStepMessageMap010Builder](#abstractstepmessagemap010builder) | description(double value) | -| [AbstractStepMessageMap010Builder](#abstractstepmessagemap010builder) | description(List value) | -| [AbstractStepMessageMap010Builder](#abstractstepmessagemap010builder) | description(Map value) | -| [AbstractStepMessageMap100Builder](#abstractstepmessagemap100builder) | discriminator(String value) | - -## AbstractStepMessageMapBuilder -public class AbstractStepMessageMapBuilder
-builder for `Map` - -A class that builds the Map input type - -### Constructor Summary -| Constructor and Description | -| --------------------------- | -| AbstractStepMessageMapBuilder()
Creates a builder that contains an empty map | - -### Method Summary -| Modifier and Type | Method and Description | -| ----------------- | ---------------------- | -| [AbstractStepMessageMap011Builder](#abstractstepmessagemap011builder) | description(Nothing? value) | -| [AbstractStepMessageMap011Builder](#abstractstepmessagemap011builder) | description(boolean value) | -| [AbstractStepMessageMap011Builder](#abstractstepmessagemap011builder) | description(String value) | -| [AbstractStepMessageMap011Builder](#abstractstepmessagemap011builder) | description(int value) | -| [AbstractStepMessageMap011Builder](#abstractstepmessagemap011builder) | description(float value) | -| [AbstractStepMessageMap011Builder](#abstractstepmessagemap011builder) | description(long value) | -| [AbstractStepMessageMap011Builder](#abstractstepmessagemap011builder) | description(double value) | -| [AbstractStepMessageMap011Builder](#abstractstepmessagemap011builder) | description(List value) | -| [AbstractStepMessageMap011Builder](#abstractstepmessagemap011builder) | description(Map value) | -| [AbstractStepMessageMap101Builder](#abstractstepmessagemap101builder) | discriminator(String value) | -| [AbstractStepMessageMap110Builder](#abstractstepmessagemap110builder) | sequenceNumber(Nothing? value) | -| [AbstractStepMessageMap110Builder](#abstractstepmessagemap110builder) | sequenceNumber(boolean value) | -| [AbstractStepMessageMap110Builder](#abstractstepmessagemap110builder) | sequenceNumber(String value) | -| [AbstractStepMessageMap110Builder](#abstractstepmessagemap110builder) | sequenceNumber(int value) | -| [AbstractStepMessageMap110Builder](#abstractstepmessagemap110builder) | sequenceNumber(float value) | -| [AbstractStepMessageMap110Builder](#abstractstepmessagemap110builder) | sequenceNumber(long value) | -| [AbstractStepMessageMap110Builder](#abstractstepmessagemap110builder) | sequenceNumber(double value) | -| [AbstractStepMessageMap110Builder](#abstractstepmessagemap110builder) | sequenceNumber(List value) | -| [AbstractStepMessageMap110Builder](#abstractstepmessagemap110builder) | sequenceNumber(Map value) | - -## AbstractStepMessageMap -public static class AbstractStepMessageMap
-extends FrozenMap - -A class to store validated Map payloads - -### Method Summary -| Modifier and Type | Method and Description | -| ----------------- | ---------------------- | -| static [AbstractStepMessageMap](#abstractstepmessagemap) | of([Map](#abstractstepmessagemapbuilder) arg, SchemaConfiguration configuration) | -| @Nullable Object | description()
| -| String | discriminator()
| -| @Nullable Object | sequenceNumber()
| -| @Nullable Object | getAdditionalProperty(String name)
provides type safety for additional properties | - -## DiscriminatorBoxed -public sealed interface DiscriminatorBoxed
-permits
-[DiscriminatorBoxedString](#discriminatorboxedstring) - -sealed interface that stores validated payloads using boxed classes - -## DiscriminatorBoxedString -public record DiscriminatorBoxedString
-implements [DiscriminatorBoxed](#discriminatorboxed) - -record that stores validated String payloads, sealed permits implementation - -### Constructor Summary -| Constructor and Description | -| --------------------------- | -| DiscriminatorBoxedString(String data)
Creates an instance, private visibility | - -### Method Summary -| Modifier and Type | Method and Description | -| ----------------- | ---------------------- | -| String | data()
validated payload | -| @Nullable Object | getData()
validated payload | - -## Discriminator -public static class Discriminator
-extends StringJsonSchema.StringJsonSchema1 - -A schema class that validates payloads - -| Methods Inherited from class org.openapijsonschematools.client.schemas.StringJsonSchema.StringJsonSchema1 | -| ------------------------------------------------------------------ | -| validate | -| validateAndBox | - -[[Back to top]](#top) [[Back to Component Schemas]](../../../README.md#Component-Schemas) [[Back to README]](../../../README.md) diff --git a/samples/client/petstore/kotlin/docs/components/schemas/AdditionalPropertiesClass.md b/samples/client/petstore/kotlin/docs/components/schemas/AdditionalPropertiesClass.md deleted file mode 100644 index e8854bd5205..00000000000 --- a/samples/client/petstore/kotlin/docs/components/schemas/AdditionalPropertiesClass.md +++ /dev/null @@ -1,1419 +0,0 @@ -# AdditionalPropertiesClass -org.openapijsonschematools.client.components.schemas.AdditionalPropertiesClass.java -public class AdditionalPropertiesClass
- -A class that contains necessary nested -- schema classes (which validate payloads), extends JsonSchema -- sealed interfaces which store validated payloads, java version of a sum type -- boxed classes which store validated payloads, sealed permits class implementations -- classes to store validated map payloads, extends FrozenMap -- classes to build inputs for map payloads - -## Nested Class Summary -| Modifier and Type | Class and Description | -| ----------------- | ---------------------- | -| sealed interface | [AdditionalPropertiesClass.AdditionalPropertiesClass1Boxed](#additionalpropertiesclass1boxed)
sealed interface for validated payloads | -| record | [AdditionalPropertiesClass.AdditionalPropertiesClass1BoxedMap](#additionalpropertiesclass1boxedmap)
boxed class to store validated Map payloads | -| static class | [AdditionalPropertiesClass.AdditionalPropertiesClass1](#additionalpropertiesclass1)
schema class | -| static class | [AdditionalPropertiesClass.AdditionalPropertiesClassMapBuilder](#additionalpropertiesclassmapbuilder)
builder for Map payloads | -| static class | [AdditionalPropertiesClass.AdditionalPropertiesClassMap](#additionalpropertiesclassmap)
output class for Map payloads | -| sealed interface | [AdditionalPropertiesClass.MapWithUndeclaredPropertiesStringBoxed](#mapwithundeclaredpropertiesstringboxed)
sealed interface for validated payloads | -| record | [AdditionalPropertiesClass.MapWithUndeclaredPropertiesStringBoxedMap](#mapwithundeclaredpropertiesstringboxedmap)
boxed class to store validated Map payloads | -| static class | [AdditionalPropertiesClass.MapWithUndeclaredPropertiesString](#mapwithundeclaredpropertiesstring)
schema class | -| static class | [AdditionalPropertiesClass.MapWithUndeclaredPropertiesStringMapBuilder](#mapwithundeclaredpropertiesstringmapbuilder)
builder for Map payloads | -| static class | [AdditionalPropertiesClass.MapWithUndeclaredPropertiesStringMap](#mapwithundeclaredpropertiesstringmap)
output class for Map payloads | -| sealed interface | [AdditionalPropertiesClass.AdditionalProperties5Boxed](#additionalproperties5boxed)
sealed interface for validated payloads | -| record | [AdditionalPropertiesClass.AdditionalProperties5BoxedString](#additionalproperties5boxedstring)
boxed class to store validated String payloads | -| static class | [AdditionalPropertiesClass.AdditionalProperties5](#additionalproperties5)
schema class | -| sealed interface | [AdditionalPropertiesClass.EmptyMapBoxed](#emptymapboxed)
sealed interface for validated payloads | -| record | [AdditionalPropertiesClass.EmptyMapBoxedMap](#emptymapboxedmap)
boxed class to store validated Map payloads | -| static class | [AdditionalPropertiesClass.EmptyMap](#emptymap)
schema class | -| static class | [AdditionalPropertiesClass.EmptyMapMapBuilder](#emptymapmapbuilder)
builder for Map payloads | -| static class | [AdditionalPropertiesClass.EmptyMapMap](#emptymapmap)
output class for Map payloads | -| sealed interface | [AdditionalPropertiesClass.AdditionalProperties4Boxed](#additionalproperties4boxed)
sealed interface for validated payloads | -| record | [AdditionalPropertiesClass.AdditionalProperties4BoxedVoid](#additionalproperties4boxedvoid)
boxed class to store validated null payloads | -| record | [AdditionalPropertiesClass.AdditionalProperties4BoxedBoolean](#additionalproperties4boxedboolean)
boxed class to store validated boolean payloads | -| record | [AdditionalPropertiesClass.AdditionalProperties4BoxedNumber](#additionalproperties4boxednumber)
boxed class to store validated Number payloads | -| record | [AdditionalPropertiesClass.AdditionalProperties4BoxedString](#additionalproperties4boxedstring)
boxed class to store validated String payloads | -| record | [AdditionalPropertiesClass.AdditionalProperties4BoxedList](#additionalproperties4boxedlist)
boxed class to store validated List payloads | -| record | [AdditionalPropertiesClass.AdditionalProperties4BoxedMap](#additionalproperties4boxedmap)
boxed class to store validated Map payloads | -| static class | [AdditionalPropertiesClass.AdditionalProperties4](#additionalproperties4)
schema class | -| sealed interface | [AdditionalPropertiesClass.MapWithUndeclaredPropertiesAnytype3Boxed](#mapwithundeclaredpropertiesanytype3boxed)
sealed interface for validated payloads | -| record | [AdditionalPropertiesClass.MapWithUndeclaredPropertiesAnytype3BoxedMap](#mapwithundeclaredpropertiesanytype3boxedmap)
boxed class to store validated Map payloads | -| static class | [AdditionalPropertiesClass.MapWithUndeclaredPropertiesAnytype3](#mapwithundeclaredpropertiesanytype3)
schema class | -| static class | [AdditionalPropertiesClass.MapWithUndeclaredPropertiesAnytype3MapBuilder](#mapwithundeclaredpropertiesanytype3mapbuilder)
builder for Map payloads | -| static class | [AdditionalPropertiesClass.MapWithUndeclaredPropertiesAnytype3Map](#mapwithundeclaredpropertiesanytype3map)
output class for Map payloads | -| sealed interface | [AdditionalPropertiesClass.AdditionalProperties3Boxed](#additionalproperties3boxed)
sealed interface for validated payloads | -| record | [AdditionalPropertiesClass.AdditionalProperties3BoxedVoid](#additionalproperties3boxedvoid)
boxed class to store validated null payloads | -| record | [AdditionalPropertiesClass.AdditionalProperties3BoxedBoolean](#additionalproperties3boxedboolean)
boxed class to store validated boolean payloads | -| record | [AdditionalPropertiesClass.AdditionalProperties3BoxedNumber](#additionalproperties3boxednumber)
boxed class to store validated Number payloads | -| record | [AdditionalPropertiesClass.AdditionalProperties3BoxedString](#additionalproperties3boxedstring)
boxed class to store validated String payloads | -| record | [AdditionalPropertiesClass.AdditionalProperties3BoxedList](#additionalproperties3boxedlist)
boxed class to store validated List payloads | -| record | [AdditionalPropertiesClass.AdditionalProperties3BoxedMap](#additionalproperties3boxedmap)
boxed class to store validated Map payloads | -| static class | [AdditionalPropertiesClass.AdditionalProperties3](#additionalproperties3)
schema class | -| sealed interface | [AdditionalPropertiesClass.MapWithUndeclaredPropertiesAnytype2Boxed](#mapwithundeclaredpropertiesanytype2boxed)
sealed interface for validated payloads | -| record | [AdditionalPropertiesClass.MapWithUndeclaredPropertiesAnytype2BoxedMap](#mapwithundeclaredpropertiesanytype2boxedmap)
boxed class to store validated Map payloads | -| static class | [AdditionalPropertiesClass.MapWithUndeclaredPropertiesAnytype2](#mapwithundeclaredpropertiesanytype2)
schema class | -| sealed interface | [AdditionalPropertiesClass.MapWithUndeclaredPropertiesAnytype1Boxed](#mapwithundeclaredpropertiesanytype1boxed)
sealed interface for validated payloads | -| record | [AdditionalPropertiesClass.MapWithUndeclaredPropertiesAnytype1BoxedMap](#mapwithundeclaredpropertiesanytype1boxedmap)
boxed class to store validated Map payloads | -| static class | [AdditionalPropertiesClass.MapWithUndeclaredPropertiesAnytype1](#mapwithundeclaredpropertiesanytype1)
schema class | -| sealed interface | [AdditionalPropertiesClass.Anytype1Boxed](#anytype1boxed)
sealed interface for validated payloads | -| record | [AdditionalPropertiesClass.Anytype1BoxedVoid](#anytype1boxedvoid)
boxed class to store validated null payloads | -| record | [AdditionalPropertiesClass.Anytype1BoxedBoolean](#anytype1boxedboolean)
boxed class to store validated boolean payloads | -| record | [AdditionalPropertiesClass.Anytype1BoxedNumber](#anytype1boxednumber)
boxed class to store validated Number payloads | -| record | [AdditionalPropertiesClass.Anytype1BoxedString](#anytype1boxedstring)
boxed class to store validated String payloads | -| record | [AdditionalPropertiesClass.Anytype1BoxedList](#anytype1boxedlist)
boxed class to store validated List payloads | -| record | [AdditionalPropertiesClass.Anytype1BoxedMap](#anytype1boxedmap)
boxed class to store validated Map payloads | -| static class | [AdditionalPropertiesClass.Anytype1](#anytype1)
schema class | -| sealed interface | [AdditionalPropertiesClass.MapOfMapPropertyBoxed](#mapofmappropertyboxed)
sealed interface for validated payloads | -| record | [AdditionalPropertiesClass.MapOfMapPropertyBoxedMap](#mapofmappropertyboxedmap)
boxed class to store validated Map payloads | -| static class | [AdditionalPropertiesClass.MapOfMapProperty](#mapofmapproperty)
schema class | -| static class | [AdditionalPropertiesClass.MapOfMapPropertyMapBuilder](#mapofmappropertymapbuilder)
builder for Map payloads | -| static class | [AdditionalPropertiesClass.MapOfMapPropertyMap](#mapofmappropertymap)
output class for Map payloads | -| sealed interface | [AdditionalPropertiesClass.AdditionalProperties1Boxed](#additionalproperties1boxed)
sealed interface for validated payloads | -| record | [AdditionalPropertiesClass.AdditionalProperties1BoxedMap](#additionalproperties1boxedmap)
boxed class to store validated Map payloads | -| static class | [AdditionalPropertiesClass.AdditionalProperties1](#additionalproperties1)
schema class | -| static class | [AdditionalPropertiesClass.AdditionalPropertiesMapBuilder2](#additionalpropertiesmapbuilder2)
builder for Map payloads | -| static class | [AdditionalPropertiesClass.AdditionalPropertiesMap](#additionalpropertiesmap)
output class for Map payloads | -| sealed interface | [AdditionalPropertiesClass.AdditionalProperties2Boxed](#additionalproperties2boxed)
sealed interface for validated payloads | -| record | [AdditionalPropertiesClass.AdditionalProperties2BoxedString](#additionalproperties2boxedstring)
boxed class to store validated String payloads | -| static class | [AdditionalPropertiesClass.AdditionalProperties2](#additionalproperties2)
schema class | -| sealed interface | [AdditionalPropertiesClass.MapPropertyBoxed](#mappropertyboxed)
sealed interface for validated payloads | -| record | [AdditionalPropertiesClass.MapPropertyBoxedMap](#mappropertyboxedmap)
boxed class to store validated Map payloads | -| static class | [AdditionalPropertiesClass.MapProperty](#mapproperty)
schema class | -| static class | [AdditionalPropertiesClass.MapPropertyMapBuilder](#mappropertymapbuilder)
builder for Map payloads | -| static class | [AdditionalPropertiesClass.MapPropertyMap](#mappropertymap)
output class for Map payloads | -| sealed interface | [AdditionalPropertiesClass.AdditionalPropertiesBoxed](#additionalpropertiesboxed)
sealed interface for validated payloads | -| record | [AdditionalPropertiesClass.AdditionalPropertiesBoxedString](#additionalpropertiesboxedstring)
boxed class to store validated String payloads | -| static class | [AdditionalPropertiesClass.AdditionalProperties](#additionalproperties)
schema class | - -## AdditionalPropertiesClass1Boxed -public sealed interface AdditionalPropertiesClass1Boxed
-permits
-[AdditionalPropertiesClass1BoxedMap](#additionalpropertiesclass1boxedmap) - -sealed interface that stores validated payloads using boxed classes - -## AdditionalPropertiesClass1BoxedMap -public record AdditionalPropertiesClass1BoxedMap
-implements [AdditionalPropertiesClass1Boxed](#additionalpropertiesclass1boxed) - -record that stores validated Map payloads, sealed permits implementation - -### Constructor Summary -| Constructor and Description | -| --------------------------- | -| AdditionalPropertiesClass1BoxedMap([AdditionalPropertiesClassMap](#additionalpropertiesclassmap) data)
Creates an instance, private visibility | - -### Method Summary -| Modifier and Type | Method and Description | -| ----------------- | ---------------------- | -| [AdditionalPropertiesClassMap](#additionalpropertiesclassmap) | data()
validated payload | -| @Nullable Object | getData()
validated payload | - -## AdditionalPropertiesClass1 -public static class AdditionalPropertiesClass1
-extends JsonSchema - -A schema class that validates payloads - -### Code Sample -``` -import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags; -import org.openapijsonschematools.client.configurations.SchemaConfiguration; -import org.openapijsonschematools.client.exceptions.ValidationException; -import org.openapijsonschematools.client.schemas.validation.MapUtils; -import org.openapijsonschematools.client.schemas.validation.FrozenList; -import org.openapijsonschematools.client.schemas.validation.FrozenMap; -import org.openapijsonschematools.client.components.schemas.AdditionalPropertiesClass; - -import java.util.Arrays; -import java.util.List; -import java.util.AbstractMap; - -static final SchemaConfiguration configuration = new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().build()); - -// Map validation -AdditionalPropertiesClass.AdditionalPropertiesClassMap validatedPayload = - AdditionalPropertiesClass.AdditionalPropertiesClass1.validate( - new AdditionalPropertiesClass.AdditionalPropertiesClassMapBuilder() - .map_property( - MapUtils.makeMap( - new AbstractMap.SimpleEntry( - "someAdditionalProperty", - "a" - ) - ) - ) - .map_of_map_property( - MapUtils.makeMap( - new AbstractMap.SimpleEntry>( - "someAdditionalProperty", - MapUtils.makeMap( - new AbstractMap.SimpleEntry( - "someAdditionalProperty", - "a" - ) - ) - ) - ) - ) - .map_with_undeclared_properties_anytype_3( - MapUtils.makeMap( - ) - ) - .empty_map( - MapUtils.makeMap( - ) - ) - .map_with_undeclared_properties_string( - MapUtils.makeMap( - new AbstractMap.SimpleEntry( - "someAdditionalProperty", - "a" - ) - ) - ) - .build(), - configuration -); -``` - -### Field Summary -| Modifier and Type | Field and Description | -| ----------------- | ---------------------- | -| Set> | type = Set.of(Map.class) | -| Map> | properties = Map.ofEntries(
    new PropertyEntry("map_property", [MapProperty.class](#mapproperty))),
    new PropertyEntry("map_of_map_property", [MapOfMapProperty.class](#mapofmapproperty))),
    new PropertyEntry("anytype_1", [Anytype1.class](#anytype1))),
    new PropertyEntry("map_with_undeclared_properties_anytype_1", [MapWithUndeclaredPropertiesAnytype1.class](#mapwithundeclaredpropertiesanytype1))),
    new PropertyEntry("map_with_undeclared_properties_anytype_2", [MapWithUndeclaredPropertiesAnytype2.class](#mapwithundeclaredpropertiesanytype2))),
    new PropertyEntry("map_with_undeclared_properties_anytype_3", [MapWithUndeclaredPropertiesAnytype3.class](#mapwithundeclaredpropertiesanytype3))),
    new PropertyEntry("empty_map", [EmptyMap.class](#emptymap))),
    new PropertyEntry("map_with_undeclared_properties_string", [MapWithUndeclaredPropertiesString.class](#mapwithundeclaredpropertiesstring)))
)
| - -### Method Summary -| Modifier and Type | Method and Description | -| ----------------- | ---------------------- | -| [AdditionalPropertiesClassMap](#additionalpropertiesclassmap) | validate([Map<?, ?>](#additionalpropertiesclassmapbuilder) arg, SchemaConfiguration configuration) | -| [AdditionalPropertiesClass1BoxedMap](#additionalpropertiesclass1boxedmap) | validateAndBox([Map<?, ?>](#additionalpropertiesclassmapbuilder) arg, SchemaConfiguration configuration) | -| [AdditionalPropertiesClass1Boxed](#additionalpropertiesclass1boxed) | validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) | -| @Nullable Object | validate(@Nullable Object arg, SchemaConfiguration configuration) | - -## AdditionalPropertiesClassMapBuilder -public class AdditionalPropertiesClassMapBuilder
-builder for `Map` - -A class that builds the Map input type - -### Constructor Summary -| Constructor and Description | -| --------------------------- | -| AdditionalPropertiesClassMapBuilder()
Creates a builder that contains an empty map | - -### Method Summary -| Modifier and Type | Method and Description | -| ----------------- | ---------------------- | -| Map | build()
Returns map input that should be used with Schema.validate | -| [AdditionalPropertiesClassMapBuilder](#additionalpropertiesclassmapbuilder) | map_property(Map value) | -| [AdditionalPropertiesClassMapBuilder](#additionalpropertiesclassmapbuilder) | map_of_map_property(Map> value) | -| [AdditionalPropertiesClassMapBuilder](#additionalpropertiesclassmapbuilder) | anytype_1(Nothing? value) | -| [AdditionalPropertiesClassMapBuilder](#additionalpropertiesclassmapbuilder) | anytype_1(boolean value) | -| [AdditionalPropertiesClassMapBuilder](#additionalpropertiesclassmapbuilder) | anytype_1(String value) | -| [AdditionalPropertiesClassMapBuilder](#additionalpropertiesclassmapbuilder) | anytype_1(int value) | -| [AdditionalPropertiesClassMapBuilder](#additionalpropertiesclassmapbuilder) | anytype_1(float value) | -| [AdditionalPropertiesClassMapBuilder](#additionalpropertiesclassmapbuilder) | anytype_1(long value) | -| [AdditionalPropertiesClassMapBuilder](#additionalpropertiesclassmapbuilder) | anytype_1(double value) | -| [AdditionalPropertiesClassMapBuilder](#additionalpropertiesclassmapbuilder) | anytype_1(List value) | -| [AdditionalPropertiesClassMapBuilder](#additionalpropertiesclassmapbuilder) | anytype_1(Map value) | -| [AdditionalPropertiesClassMapBuilder](#additionalpropertiesclassmapbuilder) | map_with_undeclared_properties_anytype_1(Map value) | -| [AdditionalPropertiesClassMapBuilder](#additionalpropertiesclassmapbuilder) | map_with_undeclared_properties_anytype_2(Map value) | -| [AdditionalPropertiesClassMapBuilder](#additionalpropertiesclassmapbuilder) | map_with_undeclared_properties_anytype_3(Map value) | -| [AdditionalPropertiesClassMapBuilder](#additionalpropertiesclassmapbuilder) | empty_map(Map value) | -| [AdditionalPropertiesClassMapBuilder](#additionalpropertiesclassmapbuilder) | map_with_undeclared_properties_string(Map value) | -| [AdditionalPropertiesClassMapBuilder](#additionalpropertiesclassmapbuilder) | additionalProperty(String key, Nothing? value) | -| [AdditionalPropertiesClassMapBuilder](#additionalpropertiesclassmapbuilder) | additionalProperty(String key, boolean value) | -| [AdditionalPropertiesClassMapBuilder](#additionalpropertiesclassmapbuilder) | additionalProperty(String key, String value) | -| [AdditionalPropertiesClassMapBuilder](#additionalpropertiesclassmapbuilder) | additionalProperty(String key, int value) | -| [AdditionalPropertiesClassMapBuilder](#additionalpropertiesclassmapbuilder) | additionalProperty(String key, float value) | -| [AdditionalPropertiesClassMapBuilder](#additionalpropertiesclassmapbuilder) | additionalProperty(String key, long value) | -| [AdditionalPropertiesClassMapBuilder](#additionalpropertiesclassmapbuilder) | additionalProperty(String key, double value) | -| [AdditionalPropertiesClassMapBuilder](#additionalpropertiesclassmapbuilder) | additionalProperty(String key, List value) | -| [AdditionalPropertiesClassMapBuilder](#additionalpropertiesclassmapbuilder) | additionalProperty(String key, Map value) | - -## AdditionalPropertiesClassMap -public static class AdditionalPropertiesClassMap
-extends FrozenMap - -A class to store validated Map payloads - -### Method Summary -| Modifier and Type | Method and Description | -| ----------------- | ---------------------- | -| static [AdditionalPropertiesClassMap](#additionalpropertiesclassmap) | of([Map](#additionalpropertiesclassmapbuilder) arg, SchemaConfiguration configuration) | -| [MapPropertyMap](#mappropertymap) | map_property()
[optional] | -| [MapOfMapPropertyMap](#mapofmappropertymap) | map_of_map_property()
[optional] | -| @Nullable Object | anytype_1()
[optional] | -| FrozenMap | map_with_undeclared_properties_anytype_1()
[optional] | -| FrozenMap | map_with_undeclared_properties_anytype_2()
[optional] | -| [MapWithUndeclaredPropertiesAnytype3Map](#mapwithundeclaredpropertiesanytype3map) | map_with_undeclared_properties_anytype_3()
[optional] | -| [EmptyMapMap](#emptymapmap) | empty_map()
[optional] | -| [MapWithUndeclaredPropertiesStringMap](#mapwithundeclaredpropertiesstringmap) | map_with_undeclared_properties_string()
[optional] | -| @Nullable Object | getAdditionalProperty(String name)
provides type safety for additional properties | - -## MapWithUndeclaredPropertiesStringBoxed -public sealed interface MapWithUndeclaredPropertiesStringBoxed
-permits
-[MapWithUndeclaredPropertiesStringBoxedMap](#mapwithundeclaredpropertiesstringboxedmap) - -sealed interface that stores validated payloads using boxed classes - -## MapWithUndeclaredPropertiesStringBoxedMap -public record MapWithUndeclaredPropertiesStringBoxedMap
-implements [MapWithUndeclaredPropertiesStringBoxed](#mapwithundeclaredpropertiesstringboxed) - -record that stores validated Map payloads, sealed permits implementation - -### Constructor Summary -| Constructor and Description | -| --------------------------- | -| MapWithUndeclaredPropertiesStringBoxedMap([MapWithUndeclaredPropertiesStringMap](#mapwithundeclaredpropertiesstringmap) data)
Creates an instance, private visibility | - -### Method Summary -| Modifier and Type | Method and Description | -| ----------------- | ---------------------- | -| [MapWithUndeclaredPropertiesStringMap](#mapwithundeclaredpropertiesstringmap) | data()
validated payload | -| @Nullable Object | getData()
validated payload | - -## MapWithUndeclaredPropertiesString -public static class MapWithUndeclaredPropertiesString
-extends JsonSchema - -A schema class that validates payloads - -### Code Sample -``` -import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags; -import org.openapijsonschematools.client.configurations.SchemaConfiguration; -import org.openapijsonschematools.client.exceptions.ValidationException; -import org.openapijsonschematools.client.schemas.validation.MapUtils; -import org.openapijsonschematools.client.schemas.validation.FrozenList; -import org.openapijsonschematools.client.schemas.validation.FrozenMap; -import org.openapijsonschematools.client.components.schemas.AdditionalPropertiesClass; - -import java.util.Arrays; -import java.util.List; -import java.util.AbstractMap; - -static final SchemaConfiguration configuration = new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().build()); - -// Map validation -AdditionalPropertiesClass.MapWithUndeclaredPropertiesStringMap validatedPayload = - AdditionalPropertiesClass.MapWithUndeclaredPropertiesString.validate( - new AdditionalPropertiesClass.MapWithUndeclaredPropertiesStringMapBuilder() - .additionalProperty("someAdditionalProperty", "a") - - .build(), - configuration -); -``` - -### Field Summary -| Modifier and Type | Field and Description | -| ----------------- | ---------------------- | -| Set> | type = Set.of(Map.class) | -| Class | additionalProperties = [AdditionalProperties5.class](#additionalproperties5) | - -### Method Summary -| Modifier and Type | Method and Description | -| ----------------- | ---------------------- | -| [MapWithUndeclaredPropertiesStringMap](#mapwithundeclaredpropertiesstringmap) | validate([Map<?, ?>](#mapwithundeclaredpropertiesstringmapbuilder) arg, SchemaConfiguration configuration) | -| [MapWithUndeclaredPropertiesStringBoxedMap](#mapwithundeclaredpropertiesstringboxedmap) | validateAndBox([Map<?, ?>](#mapwithundeclaredpropertiesstringmapbuilder) arg, SchemaConfiguration configuration) | -| [MapWithUndeclaredPropertiesStringBoxed](#mapwithundeclaredpropertiesstringboxed) | validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) | -| @Nullable Object | validate(@Nullable Object arg, SchemaConfiguration configuration) | - -## MapWithUndeclaredPropertiesStringMapBuilder -public class MapWithUndeclaredPropertiesStringMapBuilder
-builder for `Map` - -A class that builds the Map input type - -### Constructor Summary -| Constructor and Description | -| --------------------------- | -| MapWithUndeclaredPropertiesStringMapBuilder()
Creates a builder that contains an empty map | - -### Method Summary -| Modifier and Type | Method and Description | -| ----------------- | ---------------------- | -| Map | build()
Returns map input that should be used with Schema.validate | -| [MapWithUndeclaredPropertiesStringMapBuilder](#mapwithundeclaredpropertiesstringmapbuilder) | additionalProperty(String key, String value) | - -## MapWithUndeclaredPropertiesStringMap -public static class MapWithUndeclaredPropertiesStringMap
-extends FrozenMap - -A class to store validated Map payloads - -### Method Summary -| Modifier and Type | Method and Description | -| ----------------- | ---------------------- | -| static [MapWithUndeclaredPropertiesStringMap](#mapwithundeclaredpropertiesstringmap) | of([Map](#mapwithundeclaredpropertiesstringmapbuilder) arg, SchemaConfiguration configuration) | -| String | getAdditionalProperty(String name)
provides type safety for additional properties | - -## AdditionalProperties5Boxed -public sealed interface AdditionalProperties5Boxed
-permits
-[AdditionalProperties5BoxedString](#additionalproperties5boxedstring) - -sealed interface that stores validated payloads using boxed classes - -## AdditionalProperties5BoxedString -public record AdditionalProperties5BoxedString
-implements [AdditionalProperties5Boxed](#additionalproperties5boxed) - -record that stores validated String payloads, sealed permits implementation - -### Constructor Summary -| Constructor and Description | -| --------------------------- | -| AdditionalProperties5BoxedString(String data)
Creates an instance, private visibility | - -### Method Summary -| Modifier and Type | Method and Description | -| ----------------- | ---------------------- | -| String | data()
validated payload | -| @Nullable Object | getData()
validated payload | - -## AdditionalProperties5 -public static class AdditionalProperties5
-extends StringJsonSchema.StringJsonSchema1 - -A schema class that validates payloads - -| Methods Inherited from class org.openapijsonschematools.client.schemas.StringJsonSchema.StringJsonSchema1 | -| ------------------------------------------------------------------ | -| validate | -| validateAndBox | - -## EmptyMapBoxed -public sealed interface EmptyMapBoxed
-permits
-[EmptyMapBoxedMap](#emptymapboxedmap) - -sealed interface that stores validated payloads using boxed classes - -## EmptyMapBoxedMap -public record EmptyMapBoxedMap
-implements [EmptyMapBoxed](#emptymapboxed) - -record that stores validated Map payloads, sealed permits implementation - -### Constructor Summary -| Constructor and Description | -| --------------------------- | -| EmptyMapBoxedMap([EmptyMapMap](#emptymapmap) data)
Creates an instance, private visibility | - -### Method Summary -| Modifier and Type | Method and Description | -| ----------------- | ---------------------- | -| [EmptyMapMap](#emptymapmap) | data()
validated payload | -| @Nullable Object | getData()
validated payload | - -## EmptyMap -public static class EmptyMap
-extends JsonSchema - -A schema class that validates payloads - -## Description -an object with no declared properties and no undeclared properties, hence it's an empty map. - -### Code Sample -``` -import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags; -import org.openapijsonschematools.client.configurations.SchemaConfiguration; -import org.openapijsonschematools.client.exceptions.ValidationException; -import org.openapijsonschematools.client.schemas.validation.MapUtils; -import org.openapijsonschematools.client.schemas.validation.FrozenList; -import org.openapijsonschematools.client.schemas.validation.FrozenMap; -import org.openapijsonschematools.client.components.schemas.AdditionalPropertiesClass; - -import java.util.Arrays; -import java.util.List; -import java.util.AbstractMap; - -static final SchemaConfiguration configuration = new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().build()); - -// Map validation -AdditionalPropertiesClass.EmptyMapMap validatedPayload = - AdditionalPropertiesClass.EmptyMap.validate( - new AdditionalPropertiesClass.EmptyMapMapBuilder() - .build(), - configuration -); -``` - -### Field Summary -| Modifier and Type | Field and Description | -| ----------------- | ---------------------- | -| Set> | type = Set.of(Map.class) | -| Class | additionalProperties = [AdditionalProperties4.class](#additionalproperties4) | - -### Method Summary -| Modifier and Type | Method and Description | -| ----------------- | ---------------------- | -| [EmptyMapMap](#emptymapmap) | validate([Map<?, ?>](#emptymapmapbuilder) arg, SchemaConfiguration configuration) | -| [EmptyMapBoxedMap](#emptymapboxedmap) | validateAndBox([Map<?, ?>](#emptymapmapbuilder) arg, SchemaConfiguration configuration) | -| [EmptyMapBoxed](#emptymapboxed) | validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) | -| @Nullable Object | validate(@Nullable Object arg, SchemaConfiguration configuration) | - -## EmptyMapMapBuilder -public class EmptyMapMapBuilder
-builder for `Map` - -A class that builds the Map input type - -### Constructor Summary -| Constructor and Description | -| --------------------------- | -| EmptyMapMapBuilder()
Creates a builder that contains an empty map | - -### Method Summary -| Modifier and Type | Method and Description | -| ----------------- | ---------------------- | -| Map | build()
Returns map input that should be used with Schema.validate | - -## EmptyMapMap -public static class EmptyMapMap
-extends FrozenMap - -A class to store validated Map payloads - -### Method Summary -| Modifier and Type | Method and Description | -| ----------------- | ---------------------- | -| static [EmptyMapMap](#emptymapmap) | of([Map](#emptymapmapbuilder) arg, SchemaConfiguration configuration) | - -## AdditionalProperties4Boxed -public sealed interface AdditionalProperties4Boxed
-permits
-[AdditionalProperties4BoxedVoid](#additionalproperties4boxedvoid), -[AdditionalProperties4BoxedBoolean](#additionalproperties4boxedboolean), -[AdditionalProperties4BoxedNumber](#additionalproperties4boxednumber), -[AdditionalProperties4BoxedString](#additionalproperties4boxedstring), -[AdditionalProperties4BoxedList](#additionalproperties4boxedlist), -[AdditionalProperties4BoxedMap](#additionalproperties4boxedmap) - -sealed interface that stores validated payloads using boxed classes - -## AdditionalProperties4BoxedVoid -public record AdditionalProperties4BoxedVoid
-implements [AdditionalProperties4Boxed](#additionalproperties4boxed) - -record that stores validated null payloads, sealed permits implementation - -### Constructor Summary -| Constructor and Description | -| --------------------------- | -| AdditionalProperties4BoxedVoid(Nothing? data)
Creates an instance, private visibility | - -### Method Summary -| Modifier and Type | Method and Description | -| ----------------- | ---------------------- | -| Nothing? | data()
validated payload | -| @Nullable Object | getData()
validated payload | - -## AdditionalProperties4BoxedBoolean -public record AdditionalProperties4BoxedBoolean
-implements [AdditionalProperties4Boxed](#additionalproperties4boxed) - -record that stores validated boolean payloads, sealed permits implementation - -### Constructor Summary -| Constructor and Description | -| --------------------------- | -| AdditionalProperties4BoxedBoolean(boolean data)
Creates an instance, private visibility | - -### Method Summary -| Modifier and Type | Method and Description | -| ----------------- | ---------------------- | -| boolean | data()
validated payload | -| @Nullable Object | getData()
validated payload | - -## AdditionalProperties4BoxedNumber -public record AdditionalProperties4BoxedNumber
-implements [AdditionalProperties4Boxed](#additionalproperties4boxed) - -record that stores validated Number payloads, sealed permits implementation - -### Constructor Summary -| Constructor and Description | -| --------------------------- | -| AdditionalProperties4BoxedNumber(Number data)
Creates an instance, private visibility | - -### Method Summary -| Modifier and Type | Method and Description | -| ----------------- | ---------------------- | -| Number | data()
validated payload | -| @Nullable Object | getData()
validated payload | - -## AdditionalProperties4BoxedString -public record AdditionalProperties4BoxedString
-implements [AdditionalProperties4Boxed](#additionalproperties4boxed) - -record that stores validated String payloads, sealed permits implementation - -### Constructor Summary -| Constructor and Description | -| --------------------------- | -| AdditionalProperties4BoxedString(String data)
Creates an instance, private visibility | - -### Method Summary -| Modifier and Type | Method and Description | -| ----------------- | ---------------------- | -| String | data()
validated payload | -| @Nullable Object | getData()
validated payload | - -## AdditionalProperties4BoxedList -public record AdditionalProperties4BoxedList
-implements [AdditionalProperties4Boxed](#additionalproperties4boxed) - -record that stores validated List payloads, sealed permits implementation - -### Constructor Summary -| Constructor and Description | -| --------------------------- | -| AdditionalProperties4BoxedList(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 | - -## AdditionalProperties4BoxedMap -public record AdditionalProperties4BoxedMap
-implements [AdditionalProperties4Boxed](#additionalproperties4boxed) - -record that stores validated Map payloads, sealed permits implementation - -### Constructor Summary -| Constructor and Description | -| --------------------------- | -| AdditionalProperties4BoxedMap(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 | - -## AdditionalProperties4 -public static class AdditionalProperties4
-extends NotAnyTypeJsonSchema.NotAnyTypeJsonSchema1 - -A schema class that validates payloads - -| Methods Inherited from class org.openapijsonschematools.client.schemas.NotAnyTypeJsonSchema.NotAnyTypeJsonSchema1 | -| ------------------------------------------------------------------ | -| validate | -| validateAndBox | - -## MapWithUndeclaredPropertiesAnytype3Boxed -public sealed interface MapWithUndeclaredPropertiesAnytype3Boxed
-permits
-[MapWithUndeclaredPropertiesAnytype3BoxedMap](#mapwithundeclaredpropertiesanytype3boxedmap) - -sealed interface that stores validated payloads using boxed classes - -## MapWithUndeclaredPropertiesAnytype3BoxedMap -public record MapWithUndeclaredPropertiesAnytype3BoxedMap
-implements [MapWithUndeclaredPropertiesAnytype3Boxed](#mapwithundeclaredpropertiesanytype3boxed) - -record that stores validated Map payloads, sealed permits implementation - -### Constructor Summary -| Constructor and Description | -| --------------------------- | -| MapWithUndeclaredPropertiesAnytype3BoxedMap([MapWithUndeclaredPropertiesAnytype3Map](#mapwithundeclaredpropertiesanytype3map) data)
Creates an instance, private visibility | - -### Method Summary -| Modifier and Type | Method and Description | -| ----------------- | ---------------------- | -| [MapWithUndeclaredPropertiesAnytype3Map](#mapwithundeclaredpropertiesanytype3map) | data()
validated payload | -| @Nullable Object | getData()
validated payload | - -## MapWithUndeclaredPropertiesAnytype3 -public static class MapWithUndeclaredPropertiesAnytype3
-extends JsonSchema - -A schema class that validates payloads - -### Code Sample -``` -import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags; -import org.openapijsonschematools.client.configurations.SchemaConfiguration; -import org.openapijsonschematools.client.exceptions.ValidationException; -import org.openapijsonschematools.client.schemas.validation.MapUtils; -import org.openapijsonschematools.client.schemas.validation.FrozenList; -import org.openapijsonschematools.client.schemas.validation.FrozenMap; -import org.openapijsonschematools.client.components.schemas.AdditionalPropertiesClass; - -import java.util.Arrays; -import java.util.List; -import java.util.AbstractMap; - -static final SchemaConfiguration configuration = new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().build()); - -// Map validation -AdditionalPropertiesClass.MapWithUndeclaredPropertiesAnytype3Map validatedPayload = - AdditionalPropertiesClass.MapWithUndeclaredPropertiesAnytype3.validate( - new AdditionalPropertiesClass.MapWithUndeclaredPropertiesAnytype3MapBuilder() - .build(), - configuration -); -``` - -### Field Summary -| Modifier and Type | Field and Description | -| ----------------- | ---------------------- | -| Set> | type = Set.of(Map.class) | -| Class | additionalProperties = [AdditionalProperties3.class](#additionalproperties3) | - -### Method Summary -| Modifier and Type | Method and Description | -| ----------------- | ---------------------- | -| [MapWithUndeclaredPropertiesAnytype3Map](#mapwithundeclaredpropertiesanytype3map) | validate([Map<?, ?>](#mapwithundeclaredpropertiesanytype3mapbuilder) arg, SchemaConfiguration configuration) | -| [MapWithUndeclaredPropertiesAnytype3BoxedMap](#mapwithundeclaredpropertiesanytype3boxedmap) | validateAndBox([Map<?, ?>](#mapwithundeclaredpropertiesanytype3mapbuilder) arg, SchemaConfiguration configuration) | -| [MapWithUndeclaredPropertiesAnytype3Boxed](#mapwithundeclaredpropertiesanytype3boxed) | validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) | -| @Nullable Object | validate(@Nullable Object arg, SchemaConfiguration configuration) | - -## MapWithUndeclaredPropertiesAnytype3MapBuilder -public class MapWithUndeclaredPropertiesAnytype3MapBuilder
-builder for `Map` - -A class that builds the Map input type - -### Constructor Summary -| Constructor and Description | -| --------------------------- | -| MapWithUndeclaredPropertiesAnytype3MapBuilder()
Creates a builder that contains an empty map | - -### Method Summary -| Modifier and Type | Method and Description | -| ----------------- | ---------------------- | -| Map | build()
Returns map input that should be used with Schema.validate | -| [MapWithUndeclaredPropertiesAnytype3MapBuilder](#mapwithundeclaredpropertiesanytype3mapbuilder) | additionalProperty(String key, Nothing? value) | -| [MapWithUndeclaredPropertiesAnytype3MapBuilder](#mapwithundeclaredpropertiesanytype3mapbuilder) | additionalProperty(String key, boolean value) | -| [MapWithUndeclaredPropertiesAnytype3MapBuilder](#mapwithundeclaredpropertiesanytype3mapbuilder) | additionalProperty(String key, String value) | -| [MapWithUndeclaredPropertiesAnytype3MapBuilder](#mapwithundeclaredpropertiesanytype3mapbuilder) | additionalProperty(String key, int value) | -| [MapWithUndeclaredPropertiesAnytype3MapBuilder](#mapwithundeclaredpropertiesanytype3mapbuilder) | additionalProperty(String key, float value) | -| [MapWithUndeclaredPropertiesAnytype3MapBuilder](#mapwithundeclaredpropertiesanytype3mapbuilder) | additionalProperty(String key, long value) | -| [MapWithUndeclaredPropertiesAnytype3MapBuilder](#mapwithundeclaredpropertiesanytype3mapbuilder) | additionalProperty(String key, double value) | -| [MapWithUndeclaredPropertiesAnytype3MapBuilder](#mapwithundeclaredpropertiesanytype3mapbuilder) | additionalProperty(String key, List value) | -| [MapWithUndeclaredPropertiesAnytype3MapBuilder](#mapwithundeclaredpropertiesanytype3mapbuilder) | additionalProperty(String key, Map value) | - -## MapWithUndeclaredPropertiesAnytype3Map -public static class MapWithUndeclaredPropertiesAnytype3Map
-extends FrozenMap - -A class to store validated Map payloads - -### Method Summary -| Modifier and Type | Method and Description | -| ----------------- | ---------------------- | -| static [MapWithUndeclaredPropertiesAnytype3Map](#mapwithundeclaredpropertiesanytype3map) | of([Map](#mapwithundeclaredpropertiesanytype3mapbuilder) arg, SchemaConfiguration configuration) | -| @Nullable Object | getAdditionalProperty(String name)
provides type safety for additional properties | - -## AdditionalProperties3Boxed -public sealed interface AdditionalProperties3Boxed
-permits
-[AdditionalProperties3BoxedVoid](#additionalproperties3boxedvoid), -[AdditionalProperties3BoxedBoolean](#additionalproperties3boxedboolean), -[AdditionalProperties3BoxedNumber](#additionalproperties3boxednumber), -[AdditionalProperties3BoxedString](#additionalproperties3boxedstring), -[AdditionalProperties3BoxedList](#additionalproperties3boxedlist), -[AdditionalProperties3BoxedMap](#additionalproperties3boxedmap) - -sealed interface that stores validated payloads using boxed classes - -## AdditionalProperties3BoxedVoid -public record AdditionalProperties3BoxedVoid
-implements [AdditionalProperties3Boxed](#additionalproperties3boxed) - -record that stores validated null payloads, sealed permits implementation - -### Constructor Summary -| Constructor and Description | -| --------------------------- | -| AdditionalProperties3BoxedVoid(Nothing? data)
Creates an instance, private visibility | - -### Method Summary -| Modifier and Type | Method and Description | -| ----------------- | ---------------------- | -| Nothing? | data()
validated payload | -| @Nullable Object | getData()
validated payload | - -## AdditionalProperties3BoxedBoolean -public record AdditionalProperties3BoxedBoolean
-implements [AdditionalProperties3Boxed](#additionalproperties3boxed) - -record that stores validated boolean payloads, sealed permits implementation - -### Constructor Summary -| Constructor and Description | -| --------------------------- | -| AdditionalProperties3BoxedBoolean(boolean data)
Creates an instance, private visibility | - -### Method Summary -| Modifier and Type | Method and Description | -| ----------------- | ---------------------- | -| boolean | data()
validated payload | -| @Nullable Object | getData()
validated payload | - -## AdditionalProperties3BoxedNumber -public record AdditionalProperties3BoxedNumber
-implements [AdditionalProperties3Boxed](#additionalproperties3boxed) - -record that stores validated Number payloads, sealed permits implementation - -### Constructor Summary -| Constructor and Description | -| --------------------------- | -| AdditionalProperties3BoxedNumber(Number data)
Creates an instance, private visibility | - -### Method Summary -| Modifier and Type | Method and Description | -| ----------------- | ---------------------- | -| Number | data()
validated payload | -| @Nullable Object | getData()
validated payload | - -## AdditionalProperties3BoxedString -public record AdditionalProperties3BoxedString
-implements [AdditionalProperties3Boxed](#additionalproperties3boxed) - -record that stores validated String payloads, sealed permits implementation - -### Constructor Summary -| Constructor and Description | -| --------------------------- | -| AdditionalProperties3BoxedString(String data)
Creates an instance, private visibility | - -### Method Summary -| Modifier and Type | Method and Description | -| ----------------- | ---------------------- | -| String | data()
validated payload | -| @Nullable Object | getData()
validated payload | - -## AdditionalProperties3BoxedList -public record AdditionalProperties3BoxedList
-implements [AdditionalProperties3Boxed](#additionalproperties3boxed) - -record that stores validated List payloads, sealed permits implementation - -### Constructor Summary -| Constructor and Description | -| --------------------------- | -| AdditionalProperties3BoxedList(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 | - -## AdditionalProperties3BoxedMap -public record AdditionalProperties3BoxedMap
-implements [AdditionalProperties3Boxed](#additionalproperties3boxed) - -record that stores validated Map payloads, sealed permits implementation - -### Constructor Summary -| Constructor and Description | -| --------------------------- | -| AdditionalProperties3BoxedMap(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 | - -## AdditionalProperties3 -public static class AdditionalProperties3
-extends AnyTypeJsonSchema.AnyTypeJsonSchema1 - -A schema class that validates payloads - -| Methods Inherited from class org.openapijsonschematools.client.schemas.AnyTypeJsonSchema.AnyTypeJsonSchema1 | -| ------------------------------------------------------------------ | -| validate | -| validateAndBox | - -## MapWithUndeclaredPropertiesAnytype2Boxed -public sealed interface MapWithUndeclaredPropertiesAnytype2Boxed
-permits
-[MapWithUndeclaredPropertiesAnytype2BoxedMap](#mapwithundeclaredpropertiesanytype2boxedmap) - -sealed interface that stores validated payloads using boxed classes - -## MapWithUndeclaredPropertiesAnytype2BoxedMap -public record MapWithUndeclaredPropertiesAnytype2BoxedMap
-implements [MapWithUndeclaredPropertiesAnytype2Boxed](#mapwithundeclaredpropertiesanytype2boxed) - -record that stores validated Map payloads, sealed permits implementation - -### Constructor Summary -| Constructor and Description | -| --------------------------- | -| MapWithUndeclaredPropertiesAnytype2BoxedMap(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 | - -## MapWithUndeclaredPropertiesAnytype2 -public static class MapWithUndeclaredPropertiesAnytype2
-extends MapJsonSchema.MapJsonSchema1 - -A schema class that validates payloads - -| Methods Inherited from class org.openapijsonschematools.client.schemas.MapJsonSchema.MapJsonSchema1 | -| ------------------------------------------------------------------ | -| validate | -| validateAndBox | - -## MapWithUndeclaredPropertiesAnytype1Boxed -public sealed interface MapWithUndeclaredPropertiesAnytype1Boxed
-permits
-[MapWithUndeclaredPropertiesAnytype1BoxedMap](#mapwithundeclaredpropertiesanytype1boxedmap) - -sealed interface that stores validated payloads using boxed classes - -## MapWithUndeclaredPropertiesAnytype1BoxedMap -public record MapWithUndeclaredPropertiesAnytype1BoxedMap
-implements [MapWithUndeclaredPropertiesAnytype1Boxed](#mapwithundeclaredpropertiesanytype1boxed) - -record that stores validated Map payloads, sealed permits implementation - -### Constructor Summary -| Constructor and Description | -| --------------------------- | -| MapWithUndeclaredPropertiesAnytype1BoxedMap(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 | - -## MapWithUndeclaredPropertiesAnytype1 -public static class MapWithUndeclaredPropertiesAnytype1
-extends MapJsonSchema.MapJsonSchema1 - -A schema class that validates payloads - -| Methods Inherited from class org.openapijsonschematools.client.schemas.MapJsonSchema.MapJsonSchema1 | -| ------------------------------------------------------------------ | -| validate | -| validateAndBox | - -## Anytype1Boxed -public sealed interface Anytype1Boxed
-permits
-[Anytype1BoxedVoid](#anytype1boxedvoid), -[Anytype1BoxedBoolean](#anytype1boxedboolean), -[Anytype1BoxedNumber](#anytype1boxednumber), -[Anytype1BoxedString](#anytype1boxedstring), -[Anytype1BoxedList](#anytype1boxedlist), -[Anytype1BoxedMap](#anytype1boxedmap) - -sealed interface that stores validated payloads using boxed classes - -## Anytype1BoxedVoid -public record Anytype1BoxedVoid
-implements [Anytype1Boxed](#anytype1boxed) - -record that stores validated null payloads, sealed permits implementation - -### Constructor Summary -| Constructor and Description | -| --------------------------- | -| Anytype1BoxedVoid(Nothing? data)
Creates an instance, private visibility | - -### Method Summary -| Modifier and Type | Method and Description | -| ----------------- | ---------------------- | -| Nothing? | data()
validated payload | -| @Nullable Object | getData()
validated payload | - -## Anytype1BoxedBoolean -public record Anytype1BoxedBoolean
-implements [Anytype1Boxed](#anytype1boxed) - -record that stores validated boolean payloads, sealed permits implementation - -### Constructor Summary -| Constructor and Description | -| --------------------------- | -| Anytype1BoxedBoolean(boolean data)
Creates an instance, private visibility | - -### Method Summary -| Modifier and Type | Method and Description | -| ----------------- | ---------------------- | -| boolean | data()
validated payload | -| @Nullable Object | getData()
validated payload | - -## Anytype1BoxedNumber -public record Anytype1BoxedNumber
-implements [Anytype1Boxed](#anytype1boxed) - -record that stores validated Number payloads, sealed permits implementation - -### Constructor Summary -| Constructor and Description | -| --------------------------- | -| Anytype1BoxedNumber(Number data)
Creates an instance, private visibility | - -### Method Summary -| Modifier and Type | Method and Description | -| ----------------- | ---------------------- | -| Number | data()
validated payload | -| @Nullable Object | getData()
validated payload | - -## Anytype1BoxedString -public record Anytype1BoxedString
-implements [Anytype1Boxed](#anytype1boxed) - -record that stores validated String payloads, sealed permits implementation - -### Constructor Summary -| Constructor and Description | -| --------------------------- | -| Anytype1BoxedString(String data)
Creates an instance, private visibility | - -### Method Summary -| Modifier and Type | Method and Description | -| ----------------- | ---------------------- | -| String | data()
validated payload | -| @Nullable Object | getData()
validated payload | - -## Anytype1BoxedList -public record Anytype1BoxedList
-implements [Anytype1Boxed](#anytype1boxed) - -record that stores validated List payloads, sealed permits implementation - -### Constructor Summary -| Constructor and Description | -| --------------------------- | -| Anytype1BoxedList(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 | - -## Anytype1BoxedMap -public record Anytype1BoxedMap
-implements [Anytype1Boxed](#anytype1boxed) - -record that stores validated Map payloads, sealed permits implementation - -### Constructor Summary -| Constructor and Description | -| --------------------------- | -| Anytype1BoxedMap(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 | - -## Anytype1 -public static class Anytype1
-extends AnyTypeJsonSchema.AnyTypeJsonSchema1 - -A schema class that validates payloads - -| Methods Inherited from class org.openapijsonschematools.client.schemas.AnyTypeJsonSchema.AnyTypeJsonSchema1 | -| ------------------------------------------------------------------ | -| validate | -| validateAndBox | - -## MapOfMapPropertyBoxed -public sealed interface MapOfMapPropertyBoxed
-permits
-[MapOfMapPropertyBoxedMap](#mapofmappropertyboxedmap) - -sealed interface that stores validated payloads using boxed classes - -## MapOfMapPropertyBoxedMap -public record MapOfMapPropertyBoxedMap
-implements [MapOfMapPropertyBoxed](#mapofmappropertyboxed) - -record that stores validated Map payloads, sealed permits implementation - -### Constructor Summary -| Constructor and Description | -| --------------------------- | -| MapOfMapPropertyBoxedMap([MapOfMapPropertyMap](#mapofmappropertymap) data)
Creates an instance, private visibility | - -### Method Summary -| Modifier and Type | Method and Description | -| ----------------- | ---------------------- | -| [MapOfMapPropertyMap](#mapofmappropertymap) | data()
validated payload | -| @Nullable Object | getData()
validated payload | - -## MapOfMapProperty -public static class MapOfMapProperty
-extends JsonSchema - -A schema class that validates payloads - -### Code Sample -``` -import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags; -import org.openapijsonschematools.client.configurations.SchemaConfiguration; -import org.openapijsonschematools.client.exceptions.ValidationException; -import org.openapijsonschematools.client.schemas.validation.MapUtils; -import org.openapijsonschematools.client.schemas.validation.FrozenList; -import org.openapijsonschematools.client.schemas.validation.FrozenMap; -import org.openapijsonschematools.client.components.schemas.AdditionalPropertiesClass; - -import java.util.Arrays; -import java.util.List; -import java.util.AbstractMap; - -static final SchemaConfiguration configuration = new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().build()); - -// Map validation -AdditionalPropertiesClass.MapOfMapPropertyMap validatedPayload = - AdditionalPropertiesClass.MapOfMapProperty.validate( - new AdditionalPropertiesClass.MapOfMapPropertyMapBuilder() - .additionalProperty( - "someAdditionalProperty", - MapUtils.makeMap( - new AbstractMap.SimpleEntry( - "someAdditionalProperty", - "a" - ) - ) - ) - .build(), - configuration -); -``` - -### Field Summary -| Modifier and Type | Field and Description | -| ----------------- | ---------------------- | -| Set> | type = Set.of(Map.class) | -| Class | additionalProperties = [AdditionalProperties1.class](#additionalproperties1) | - -### Method Summary -| Modifier and Type | Method and Description | -| ----------------- | ---------------------- | -| [MapOfMapPropertyMap](#mapofmappropertymap) | validate([Map<?, ?>](#mapofmappropertymapbuilder) arg, SchemaConfiguration configuration) | -| [MapOfMapPropertyBoxedMap](#mapofmappropertyboxedmap) | validateAndBox([Map<?, ?>](#mapofmappropertymapbuilder) arg, SchemaConfiguration configuration) | -| [MapOfMapPropertyBoxed](#mapofmappropertyboxed) | validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) | -| @Nullable Object | validate(@Nullable Object arg, SchemaConfiguration configuration) | - -## MapOfMapPropertyMapBuilder -public class MapOfMapPropertyMapBuilder
-builder for `Map>` - -A class that builds the Map input type - -### Constructor Summary -| Constructor and Description | -| --------------------------- | -| MapOfMapPropertyMapBuilder()
Creates a builder that contains an empty map | - -### Method Summary -| Modifier and Type | Method and Description | -| ----------------- | ---------------------- | -| Map> | build()
Returns map input that should be used with Schema.validate | -| [MapOfMapPropertyMapBuilder](#mapofmappropertymapbuilder) | additionalProperty(String key, Map value) | - -## MapOfMapPropertyMap -public static class MapOfMapPropertyMap
-extends FrozenMap - -A class to store validated Map payloads - -### Method Summary -| Modifier and Type | Method and Description | -| ----------------- | ---------------------- | -| static [MapOfMapPropertyMap](#mapofmappropertymap) | of([Map>](#mapofmappropertymapbuilder) arg, SchemaConfiguration configuration) | -| [AdditionalPropertiesMap](#additionalpropertiesmap) | getAdditionalProperty(String name)
provides type safety for additional properties | - -## AdditionalProperties1Boxed -public sealed interface AdditionalProperties1Boxed
-permits
-[AdditionalProperties1BoxedMap](#additionalproperties1boxedmap) - -sealed interface that stores validated payloads using boxed classes - -## AdditionalProperties1BoxedMap -public record AdditionalProperties1BoxedMap
-implements [AdditionalProperties1Boxed](#additionalproperties1boxed) - -record that stores validated Map payloads, sealed permits implementation - -### Constructor Summary -| Constructor and Description | -| --------------------------- | -| AdditionalProperties1BoxedMap([AdditionalPropertiesMap](#additionalpropertiesmap) data)
Creates an instance, private visibility | - -### Method Summary -| Modifier and Type | Method and Description | -| ----------------- | ---------------------- | -| [AdditionalPropertiesMap](#additionalpropertiesmap) | data()
validated payload | -| @Nullable Object | getData()
validated payload | - -## AdditionalProperties1 -public static class AdditionalProperties1
-extends JsonSchema - -A schema class that validates payloads - -### Code Sample -``` -import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags; -import org.openapijsonschematools.client.configurations.SchemaConfiguration; -import org.openapijsonschematools.client.exceptions.ValidationException; -import org.openapijsonschematools.client.schemas.validation.MapUtils; -import org.openapijsonschematools.client.schemas.validation.FrozenList; -import org.openapijsonschematools.client.schemas.validation.FrozenMap; -import org.openapijsonschematools.client.components.schemas.AdditionalPropertiesClass; - -import java.util.Arrays; -import java.util.List; -import java.util.AbstractMap; - -static final SchemaConfiguration configuration = new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().build()); - -// Map validation -AdditionalPropertiesClass.AdditionalPropertiesMap validatedPayload = - AdditionalPropertiesClass.AdditionalProperties1.validate( - new AdditionalPropertiesClass.AdditionalPropertiesMapBuilder2() - .additionalProperty("someAdditionalProperty", "a") - - .build(), - configuration -); -``` - -### Field Summary -| Modifier and Type | Field and Description | -| ----------------- | ---------------------- | -| Set> | type = Set.of(Map.class) | -| Class | additionalProperties = [AdditionalProperties2.class](#additionalproperties2) | - -### Method Summary -| Modifier and Type | Method and Description | -| ----------------- | ---------------------- | -| [AdditionalPropertiesMap](#additionalpropertiesmap) | validate([Map<?, ?>](#additionalpropertiesmapbuilder2) arg, SchemaConfiguration configuration) | -| [AdditionalProperties1BoxedMap](#additionalproperties1boxedmap) | validateAndBox([Map<?, ?>](#additionalpropertiesmapbuilder2) arg, SchemaConfiguration configuration) | -| [AdditionalProperties1Boxed](#additionalproperties1boxed) | validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) | -| @Nullable Object | validate(@Nullable Object arg, SchemaConfiguration configuration) | - -## AdditionalPropertiesMapBuilder2 -public class AdditionalPropertiesMapBuilder2
-builder for `Map` - -A class that builds the Map input type - -### Constructor Summary -| Constructor and Description | -| --------------------------- | -| AdditionalPropertiesMapBuilder2()
Creates a builder that contains an empty map | - -### Method Summary -| Modifier and Type | Method and Description | -| ----------------- | ---------------------- | -| Map | build()
Returns map input that should be used with Schema.validate | -| [AdditionalPropertiesMapBuilder2](#additionalpropertiesmapbuilder2) | additionalProperty(String key, String value) | - -## AdditionalPropertiesMap -public static class AdditionalPropertiesMap
-extends FrozenMap - -A class to store validated Map payloads - -### Method Summary -| Modifier and Type | Method and Description | -| ----------------- | ---------------------- | -| static [AdditionalPropertiesMap](#additionalpropertiesmap) | of([Map](#additionalpropertiesmapbuilder2) arg, SchemaConfiguration configuration) | -| String | getAdditionalProperty(String name)
provides type safety for additional properties | - -## AdditionalProperties2Boxed -public sealed interface AdditionalProperties2Boxed
-permits
-[AdditionalProperties2BoxedString](#additionalproperties2boxedstring) - -sealed interface that stores validated payloads using boxed classes - -## AdditionalProperties2BoxedString -public record AdditionalProperties2BoxedString
-implements [AdditionalProperties2Boxed](#additionalproperties2boxed) - -record that stores validated String payloads, sealed permits implementation - -### Constructor Summary -| Constructor and Description | -| --------------------------- | -| AdditionalProperties2BoxedString(String data)
Creates an instance, private visibility | - -### Method Summary -| Modifier and Type | Method and Description | -| ----------------- | ---------------------- | -| String | data()
validated payload | -| @Nullable Object | getData()
validated payload | - -## AdditionalProperties2 -public static class AdditionalProperties2
-extends StringJsonSchema.StringJsonSchema1 - -A schema class that validates payloads - -| Methods Inherited from class org.openapijsonschematools.client.schemas.StringJsonSchema.StringJsonSchema1 | -| ------------------------------------------------------------------ | -| validate | -| validateAndBox | - -## MapPropertyBoxed -public sealed interface MapPropertyBoxed
-permits
-[MapPropertyBoxedMap](#mappropertyboxedmap) - -sealed interface that stores validated payloads using boxed classes - -## MapPropertyBoxedMap -public record MapPropertyBoxedMap
-implements [MapPropertyBoxed](#mappropertyboxed) - -record that stores validated Map payloads, sealed permits implementation - -### Constructor Summary -| Constructor and Description | -| --------------------------- | -| MapPropertyBoxedMap([MapPropertyMap](#mappropertymap) data)
Creates an instance, private visibility | - -### Method Summary -| Modifier and Type | Method and Description | -| ----------------- | ---------------------- | -| [MapPropertyMap](#mappropertymap) | data()
validated payload | -| @Nullable Object | getData()
validated payload | - -## MapProperty -public static class MapProperty
-extends JsonSchema - -A schema class that validates payloads - -### Code Sample -``` -import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags; -import org.openapijsonschematools.client.configurations.SchemaConfiguration; -import org.openapijsonschematools.client.exceptions.ValidationException; -import org.openapijsonschematools.client.schemas.validation.MapUtils; -import org.openapijsonschematools.client.schemas.validation.FrozenList; -import org.openapijsonschematools.client.schemas.validation.FrozenMap; -import org.openapijsonschematools.client.components.schemas.AdditionalPropertiesClass; - -import java.util.Arrays; -import java.util.List; -import java.util.AbstractMap; - -static final SchemaConfiguration configuration = new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().build()); - -// Map validation -AdditionalPropertiesClass.MapPropertyMap validatedPayload = - AdditionalPropertiesClass.MapProperty.validate( - new AdditionalPropertiesClass.MapPropertyMapBuilder() - .additionalProperty("someAdditionalProperty", "a") - - .build(), - configuration -); -``` - -### Field Summary -| Modifier and Type | Field and Description | -| ----------------- | ---------------------- | -| Set> | type = Set.of(Map.class) | -| Class | additionalProperties = [AdditionalProperties.class](#additionalproperties) | - -### Method Summary -| Modifier and Type | Method and Description | -| ----------------- | ---------------------- | -| [MapPropertyMap](#mappropertymap) | validate([Map<?, ?>](#mappropertymapbuilder) arg, SchemaConfiguration configuration) | -| [MapPropertyBoxedMap](#mappropertyboxedmap) | validateAndBox([Map<?, ?>](#mappropertymapbuilder) arg, SchemaConfiguration configuration) | -| [MapPropertyBoxed](#mappropertyboxed) | validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) | -| @Nullable Object | validate(@Nullable Object arg, SchemaConfiguration configuration) | - -## MapPropertyMapBuilder -public class MapPropertyMapBuilder
-builder for `Map` - -A class that builds the Map input type - -### Constructor Summary -| Constructor and Description | -| --------------------------- | -| MapPropertyMapBuilder()
Creates a builder that contains an empty map | - -### Method Summary -| Modifier and Type | Method and Description | -| ----------------- | ---------------------- | -| Map | build()
Returns map input that should be used with Schema.validate | -| [MapPropertyMapBuilder](#mappropertymapbuilder) | additionalProperty(String key, String value) | - -## MapPropertyMap -public static class MapPropertyMap
-extends FrozenMap - -A class to store validated Map payloads - -### Method Summary -| Modifier and Type | Method and Description | -| ----------------- | ---------------------- | -| static [MapPropertyMap](#mappropertymap) | of([Map](#mappropertymapbuilder) arg, SchemaConfiguration configuration) | -| String | getAdditionalProperty(String name)
provides type safety for additional properties | - -## AdditionalPropertiesBoxed -public sealed interface AdditionalPropertiesBoxed
-permits
-[AdditionalPropertiesBoxedString](#additionalpropertiesboxedstring) - -sealed interface that stores validated payloads using boxed classes - -## 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 | - -## AdditionalProperties -public static class AdditionalProperties
-extends StringJsonSchema.StringJsonSchema1 - -A schema class that validates payloads - -| Methods Inherited from class org.openapijsonschematools.client.schemas.StringJsonSchema.StringJsonSchema1 | -| ------------------------------------------------------------------ | -| validate | -| validateAndBox | - -[[Back to top]](#top) [[Back to Component Schemas]](../../../README.md#Component-Schemas) [[Back to README]](../../../README.md) diff --git a/samples/client/petstore/kotlin/docs/components/schemas/AdditionalPropertiesSchema.md b/samples/client/petstore/kotlin/docs/components/schemas/AdditionalPropertiesSchema.md deleted file mode 100644 index 6a2ea7c1614..00000000000 --- a/samples/client/petstore/kotlin/docs/components/schemas/AdditionalPropertiesSchema.md +++ /dev/null @@ -1,839 +0,0 @@ -# AdditionalPropertiesSchema -org.openapijsonschematools.client.components.schemas.AdditionalPropertiesSchema.java -public class AdditionalPropertiesSchema
- -A class that contains necessary nested -- schema classes (which validate payloads), extends JsonSchema -- sealed interfaces which store validated payloads, java version of a sum type -- boxed classes which store validated payloads, sealed permits class implementations -- classes to store validated map payloads, extends FrozenMap -- classes to build inputs for map payloads - -## Nested Class Summary -| Modifier and Type | Class and Description | -| ----------------- | ---------------------- | -| sealed interface | [AdditionalPropertiesSchema.AdditionalPropertiesSchema1Boxed](#additionalpropertiesschema1boxed)
sealed interface for validated payloads | -| record | [AdditionalPropertiesSchema.AdditionalPropertiesSchema1BoxedMap](#additionalpropertiesschema1boxedmap)
boxed class to store validated Map payloads | -| static class | [AdditionalPropertiesSchema.AdditionalPropertiesSchema1](#additionalpropertiesschema1)
schema class | -| sealed interface | [AdditionalPropertiesSchema.Schema2Boxed](#schema2boxed)
sealed interface for validated payloads | -| record | [AdditionalPropertiesSchema.Schema2BoxedMap](#schema2boxedmap)
boxed class to store validated Map payloads | -| static class | [AdditionalPropertiesSchema.Schema2](#schema2)
schema class | -| static class | [AdditionalPropertiesSchema.Schema2MapBuilder](#schema2mapbuilder)
builder for Map payloads | -| static class | [AdditionalPropertiesSchema.Schema2Map](#schema2map)
output class for Map payloads | -| sealed interface | [AdditionalPropertiesSchema.AdditionalProperties2Boxed](#additionalproperties2boxed)
sealed interface for validated payloads | -| record | [AdditionalPropertiesSchema.AdditionalProperties2BoxedVoid](#additionalproperties2boxedvoid)
boxed class to store validated null payloads | -| record | [AdditionalPropertiesSchema.AdditionalProperties2BoxedBoolean](#additionalproperties2boxedboolean)
boxed class to store validated boolean payloads | -| record | [AdditionalPropertiesSchema.AdditionalProperties2BoxedNumber](#additionalproperties2boxednumber)
boxed class to store validated Number payloads | -| record | [AdditionalPropertiesSchema.AdditionalProperties2BoxedString](#additionalproperties2boxedstring)
boxed class to store validated String payloads | -| record | [AdditionalPropertiesSchema.AdditionalProperties2BoxedList](#additionalproperties2boxedlist)
boxed class to store validated List payloads | -| record | [AdditionalPropertiesSchema.AdditionalProperties2BoxedMap](#additionalproperties2boxedmap)
boxed class to store validated Map payloads | -| static class | [AdditionalPropertiesSchema.AdditionalProperties2](#additionalproperties2)
schema class | -| sealed interface | [AdditionalPropertiesSchema.Schema1Boxed](#schema1boxed)
sealed interface for validated payloads | -| record | [AdditionalPropertiesSchema.Schema1BoxedMap](#schema1boxedmap)
boxed class to store validated Map payloads | -| static class | [AdditionalPropertiesSchema.Schema1](#schema1)
schema class | -| static class | [AdditionalPropertiesSchema.Schema1MapBuilder](#schema1mapbuilder)
builder for Map payloads | -| static class | [AdditionalPropertiesSchema.Schema1Map](#schema1map)
output class for Map payloads | -| sealed interface | [AdditionalPropertiesSchema.AdditionalProperties1Boxed](#additionalproperties1boxed)
sealed interface for validated payloads | -| record | [AdditionalPropertiesSchema.AdditionalProperties1BoxedVoid](#additionalproperties1boxedvoid)
boxed class to store validated null payloads | -| record | [AdditionalPropertiesSchema.AdditionalProperties1BoxedBoolean](#additionalproperties1boxedboolean)
boxed class to store validated boolean payloads | -| record | [AdditionalPropertiesSchema.AdditionalProperties1BoxedNumber](#additionalproperties1boxednumber)
boxed class to store validated Number payloads | -| record | [AdditionalPropertiesSchema.AdditionalProperties1BoxedString](#additionalproperties1boxedstring)
boxed class to store validated String payloads | -| record | [AdditionalPropertiesSchema.AdditionalProperties1BoxedList](#additionalproperties1boxedlist)
boxed class to store validated List payloads | -| record | [AdditionalPropertiesSchema.AdditionalProperties1BoxedMap](#additionalproperties1boxedmap)
boxed class to store validated Map payloads | -| static class | [AdditionalPropertiesSchema.AdditionalProperties1](#additionalproperties1)
schema class | -| sealed interface | [AdditionalPropertiesSchema.Schema0Boxed](#schema0boxed)
sealed interface for validated payloads | -| record | [AdditionalPropertiesSchema.Schema0BoxedMap](#schema0boxedmap)
boxed class to store validated Map payloads | -| static class | [AdditionalPropertiesSchema.Schema0](#schema0)
schema class | -| static class | [AdditionalPropertiesSchema.Schema0MapBuilder](#schema0mapbuilder)
builder for Map payloads | -| static class | [AdditionalPropertiesSchema.Schema0Map](#schema0map)
output class for Map payloads | -| sealed interface | [AdditionalPropertiesSchema.AdditionalPropertiesBoxed](#additionalpropertiesboxed)
sealed interface for validated payloads | -| record | [AdditionalPropertiesSchema.AdditionalPropertiesBoxedVoid](#additionalpropertiesboxedvoid)
boxed class to store validated null payloads | -| record | [AdditionalPropertiesSchema.AdditionalPropertiesBoxedBoolean](#additionalpropertiesboxedboolean)
boxed class to store validated boolean payloads | -| record | [AdditionalPropertiesSchema.AdditionalPropertiesBoxedNumber](#additionalpropertiesboxednumber)
boxed class to store validated Number payloads | -| record | [AdditionalPropertiesSchema.AdditionalPropertiesBoxedString](#additionalpropertiesboxedstring)
boxed class to store validated String payloads | -| record | [AdditionalPropertiesSchema.AdditionalPropertiesBoxedList](#additionalpropertiesboxedlist)
boxed class to store validated List payloads | -| record | [AdditionalPropertiesSchema.AdditionalPropertiesBoxedMap](#additionalpropertiesboxedmap)
boxed class to store validated Map payloads | -| static class | [AdditionalPropertiesSchema.AdditionalProperties](#additionalproperties)
schema class | - -## AdditionalPropertiesSchema1Boxed -public sealed interface AdditionalPropertiesSchema1Boxed
-permits
-[AdditionalPropertiesSchema1BoxedMap](#additionalpropertiesschema1boxedmap) - -sealed interface that stores validated payloads using boxed classes - -## AdditionalPropertiesSchema1BoxedMap -public record AdditionalPropertiesSchema1BoxedMap
-implements [AdditionalPropertiesSchema1Boxed](#additionalpropertiesschema1boxed) - -record that stores validated Map payloads, sealed permits implementation - -### Constructor Summary -| Constructor and Description | -| --------------------------- | -| AdditionalPropertiesSchema1BoxedMap(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 | - -## AdditionalPropertiesSchema1 -public static class AdditionalPropertiesSchema1
-extends JsonSchema - -A schema class that validates payloads - -### Field Summary -| Modifier and Type | Field and Description | -| ----------------- | ---------------------- | -| Set> | type = Set.of(Map.class) | -| List> | allOf = List.of(
    [Schema0.class](#schema0),
    [Schema1.class](#schema1),
    [Schema2.class](#schema2)
;)
| - -### Method Summary -| Modifier and Type | Method and Description | -| ----------------- | ---------------------- | -| FrozenMap | validate(Map<?, ?> arg, SchemaConfiguration configuration) | -| [AdditionalPropertiesSchema1BoxedMap](#additionalpropertiesschema1boxedmap) | validateAndBox(Map<?, ?> arg, SchemaConfiguration configuration) | -| [AdditionalPropertiesSchema1Boxed](#additionalpropertiesschema1boxed) | validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) | -| @Nullable Object | validate(@Nullable Object arg, SchemaConfiguration configuration) | - -## Schema2Boxed -public sealed interface Schema2Boxed
-permits
-[Schema2BoxedMap](#schema2boxedmap) - -sealed interface that stores validated payloads using boxed classes - -## Schema2BoxedMap -public record Schema2BoxedMap
-implements [Schema2Boxed](#schema2boxed) - -record that stores validated Map payloads, sealed permits implementation - -### Constructor Summary -| Constructor and Description | -| --------------------------- | -| Schema2BoxedMap([Schema2Map](#schema2map) data)
Creates an instance, private visibility | - -### Method Summary -| Modifier and Type | Method and Description | -| ----------------- | ---------------------- | -| [Schema2Map](#schema2map) | data()
validated payload | -| @Nullable Object | getData()
validated payload | - -## Schema2 -public static class Schema2
-extends JsonSchema - -A schema class that validates payloads - -### Code Sample -``` -import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags; -import org.openapijsonschematools.client.configurations.SchemaConfiguration; -import org.openapijsonschematools.client.exceptions.ValidationException; -import org.openapijsonschematools.client.schemas.validation.MapUtils; -import org.openapijsonschematools.client.schemas.validation.FrozenList; -import org.openapijsonschematools.client.schemas.validation.FrozenMap; -import org.openapijsonschematools.client.components.schemas.AdditionalPropertiesSchema; - -import java.util.Arrays; -import java.util.List; -import java.util.AbstractMap; - -static final SchemaConfiguration configuration = new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().build()); - -// Map validation -AdditionalPropertiesSchema.Schema2Map validatedPayload = - AdditionalPropertiesSchema.Schema2.validate( - new AdditionalPropertiesSchema.Schema2MapBuilder() - .build(), - configuration -); -``` - -### Field Summary -| Modifier and Type | Field and Description | -| ----------------- | ---------------------- | -| Set> | type = Set.of(Map.class) | -| Class | additionalProperties = [AdditionalProperties2.class](#additionalproperties2) | - -### Method Summary -| Modifier and Type | Method and Description | -| ----------------- | ---------------------- | -| [Schema2Map](#schema2map) | validate([Map<?, ?>](#schema2mapbuilder) arg, SchemaConfiguration configuration) | -| [Schema2BoxedMap](#schema2boxedmap) | validateAndBox([Map<?, ?>](#schema2mapbuilder) arg, SchemaConfiguration configuration) | -| [Schema2Boxed](#schema2boxed) | validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) | -| @Nullable Object | validate(@Nullable Object arg, SchemaConfiguration configuration) | - -## Schema2MapBuilder -public class Schema2MapBuilder
-builder for `Map` - -A class that builds the Map input type - -### Constructor Summary -| Constructor and Description | -| --------------------------- | -| Schema2MapBuilder()
Creates a builder that contains an empty map | - -### Method Summary -| Modifier and Type | Method and Description | -| ----------------- | ---------------------- | -| Map | build()
Returns map input that should be used with Schema.validate | -| [Schema2MapBuilder](#schema2mapbuilder) | additionalProperty(String key, Nothing? value) | -| [Schema2MapBuilder](#schema2mapbuilder) | additionalProperty(String key, boolean value) | -| [Schema2MapBuilder](#schema2mapbuilder) | additionalProperty(String key, String value) | -| [Schema2MapBuilder](#schema2mapbuilder) | additionalProperty(String key, int value) | -| [Schema2MapBuilder](#schema2mapbuilder) | additionalProperty(String key, float value) | -| [Schema2MapBuilder](#schema2mapbuilder) | additionalProperty(String key, long value) | -| [Schema2MapBuilder](#schema2mapbuilder) | additionalProperty(String key, double value) | -| [Schema2MapBuilder](#schema2mapbuilder) | additionalProperty(String key, List value) | -| [Schema2MapBuilder](#schema2mapbuilder) | additionalProperty(String key, Map value) | - -## Schema2Map -public static class Schema2Map
-extends FrozenMap - -A class to store validated Map payloads - -### Method Summary -| Modifier and Type | Method and Description | -| ----------------- | ---------------------- | -| static [Schema2Map](#schema2map) | of([Map](#schema2mapbuilder) arg, SchemaConfiguration configuration) | -| @Nullable Object | getAdditionalProperty(String name)
provides type safety for additional properties | - -## AdditionalProperties2Boxed -public sealed interface AdditionalProperties2Boxed
-permits
-[AdditionalProperties2BoxedVoid](#additionalproperties2boxedvoid), -[AdditionalProperties2BoxedBoolean](#additionalproperties2boxedboolean), -[AdditionalProperties2BoxedNumber](#additionalproperties2boxednumber), -[AdditionalProperties2BoxedString](#additionalproperties2boxedstring), -[AdditionalProperties2BoxedList](#additionalproperties2boxedlist), -[AdditionalProperties2BoxedMap](#additionalproperties2boxedmap) - -sealed interface that stores validated payloads using boxed classes - -## AdditionalProperties2BoxedVoid -public record AdditionalProperties2BoxedVoid
-implements [AdditionalProperties2Boxed](#additionalproperties2boxed) - -record that stores validated null payloads, sealed permits implementation - -### Constructor Summary -| Constructor and Description | -| --------------------------- | -| AdditionalProperties2BoxedVoid(Nothing? data)
Creates an instance, private visibility | - -### Method Summary -| Modifier and Type | Method and Description | -| ----------------- | ---------------------- | -| Nothing? | data()
validated payload | -| @Nullable Object | getData()
validated payload | - -## AdditionalProperties2BoxedBoolean -public record AdditionalProperties2BoxedBoolean
-implements [AdditionalProperties2Boxed](#additionalproperties2boxed) - -record that stores validated boolean payloads, sealed permits implementation - -### Constructor Summary -| Constructor and Description | -| --------------------------- | -| AdditionalProperties2BoxedBoolean(boolean data)
Creates an instance, private visibility | - -### Method Summary -| Modifier and Type | Method and Description | -| ----------------- | ---------------------- | -| boolean | data()
validated payload | -| @Nullable Object | getData()
validated payload | - -## AdditionalProperties2BoxedNumber -public record AdditionalProperties2BoxedNumber
-implements [AdditionalProperties2Boxed](#additionalproperties2boxed) - -record that stores validated Number payloads, sealed permits implementation - -### Constructor Summary -| Constructor and Description | -| --------------------------- | -| AdditionalProperties2BoxedNumber(Number data)
Creates an instance, private visibility | - -### Method Summary -| Modifier and Type | Method and Description | -| ----------------- | ---------------------- | -| Number | data()
validated payload | -| @Nullable Object | getData()
validated payload | - -## AdditionalProperties2BoxedString -public record AdditionalProperties2BoxedString
-implements [AdditionalProperties2Boxed](#additionalproperties2boxed) - -record that stores validated String payloads, sealed permits implementation - -### Constructor Summary -| Constructor and Description | -| --------------------------- | -| AdditionalProperties2BoxedString(String data)
Creates an instance, private visibility | - -### Method Summary -| Modifier and Type | Method and Description | -| ----------------- | ---------------------- | -| String | data()
validated payload | -| @Nullable Object | getData()
validated payload | - -## AdditionalProperties2BoxedList -public record AdditionalProperties2BoxedList
-implements [AdditionalProperties2Boxed](#additionalproperties2boxed) - -record that stores validated List payloads, sealed permits implementation - -### Constructor Summary -| Constructor and Description | -| --------------------------- | -| AdditionalProperties2BoxedList(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 | - -## AdditionalProperties2BoxedMap -public record AdditionalProperties2BoxedMap
-implements [AdditionalProperties2Boxed](#additionalproperties2boxed) - -record that stores validated Map payloads, sealed permits implementation - -### Constructor Summary -| Constructor and Description | -| --------------------------- | -| AdditionalProperties2BoxedMap(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 | - -## AdditionalProperties2 -public static class AdditionalProperties2
-extends JsonSchema - -A schema class that validates payloads - -### Field Summary -| Modifier and Type | Field and Description | -| ----------------- | ---------------------- | -| Integer | maxLength = 5 | - -### Method Summary -| Modifier and Type | Method and Description | -| ----------------- | ---------------------- | -| String | validate(String arg, SchemaConfiguration configuration) | -| Nothing? | validate(Nothing? arg, SchemaConfiguration configuration) | -| int | validate(int arg, SchemaConfiguration configuration) | -| long | validate(long arg, SchemaConfiguration configuration) | -| float | validate(float arg, SchemaConfiguration configuration) | -| double | validate(double arg, SchemaConfiguration configuration) | -| Number | validate(Number arg, SchemaConfiguration configuration) | -| boolean | validate(boolean arg, SchemaConfiguration configuration) | -| FrozenMap<@Nullable Object> | validate(Map<?, ?> arg, SchemaConfiguration configuration) | -| FrozenList<@Nullable Object> | validate(List arg, SchemaConfiguration configuration) | -| [AdditionalProperties2BoxedString](#additionalproperties2boxedstring) | validateAndBox(String arg, SchemaConfiguration configuration) | -| [AdditionalProperties2BoxedVoid](#additionalproperties2boxedvoid) | validateAndBox(Nothing? arg, SchemaConfiguration configuration) | -| [AdditionalProperties2BoxedNumber](#additionalproperties2boxednumber) | validateAndBox(Number arg, SchemaConfiguration configuration) | -| [AdditionalProperties2BoxedBoolean](#additionalproperties2boxedboolean) | validateAndBox(boolean arg, SchemaConfiguration configuration) | -| [AdditionalProperties2BoxedMap](#additionalproperties2boxedmap) | validateAndBox(Map<?, ?> arg, SchemaConfiguration configuration) | -| [AdditionalProperties2BoxedList](#additionalproperties2boxedlist) | validateAndBox(List arg, SchemaConfiguration configuration) | -| [AdditionalProperties2Boxed](#additionalproperties2boxed) | validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) | -| @Nullable Object | validate(@Nullable Object arg, SchemaConfiguration configuration) | - -## Schema1Boxed -public sealed interface Schema1Boxed
-permits
-[Schema1BoxedMap](#schema1boxedmap) - -sealed interface that stores validated payloads using boxed classes - -## Schema1BoxedMap -public record Schema1BoxedMap
-implements [Schema1Boxed](#schema1boxed) - -record that stores validated Map payloads, sealed permits implementation - -### Constructor Summary -| Constructor and Description | -| --------------------------- | -| Schema1BoxedMap([Schema1Map](#schema1map) data)
Creates an instance, private visibility | - -### Method Summary -| Modifier and Type | Method and Description | -| ----------------- | ---------------------- | -| [Schema1Map](#schema1map) | data()
validated payload | -| @Nullable Object | getData()
validated payload | - -## Schema1 -public static class Schema1
-extends JsonSchema - -A schema class that validates payloads - -### Code Sample -``` -import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags; -import org.openapijsonschematools.client.configurations.SchemaConfiguration; -import org.openapijsonschematools.client.exceptions.ValidationException; -import org.openapijsonschematools.client.schemas.validation.MapUtils; -import org.openapijsonschematools.client.schemas.validation.FrozenList; -import org.openapijsonschematools.client.schemas.validation.FrozenMap; -import org.openapijsonschematools.client.components.schemas.AdditionalPropertiesSchema; - -import java.util.Arrays; -import java.util.List; -import java.util.AbstractMap; - -static final SchemaConfiguration configuration = new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().build()); - -// Map validation -AdditionalPropertiesSchema.Schema1Map validatedPayload = - AdditionalPropertiesSchema.Schema1.validate( - new AdditionalPropertiesSchema.Schema1MapBuilder() - .build(), - configuration -); -``` - -### Field Summary -| Modifier and Type | Field and Description | -| ----------------- | ---------------------- | -| Set> | type = Set.of(Map.class) | -| Class | additionalProperties = [AdditionalProperties1.class](#additionalproperties1) | - -### Method Summary -| Modifier and Type | Method and Description | -| ----------------- | ---------------------- | -| [Schema1Map](#schema1map) | validate([Map<?, ?>](#schema1mapbuilder) arg, SchemaConfiguration configuration) | -| [Schema1BoxedMap](#schema1boxedmap) | validateAndBox([Map<?, ?>](#schema1mapbuilder) arg, SchemaConfiguration configuration) | -| [Schema1Boxed](#schema1boxed) | validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) | -| @Nullable Object | validate(@Nullable Object arg, SchemaConfiguration configuration) | - -## Schema1MapBuilder -public class Schema1MapBuilder
-builder for `Map` - -A class that builds the Map input type - -### Constructor Summary -| Constructor and Description | -| --------------------------- | -| Schema1MapBuilder()
Creates a builder that contains an empty map | - -### Method Summary -| Modifier and Type | Method and Description | -| ----------------- | ---------------------- | -| Map | build()
Returns map input that should be used with Schema.validate | -| [Schema1MapBuilder](#schema1mapbuilder) | additionalProperty(String key, Nothing? value) | -| [Schema1MapBuilder](#schema1mapbuilder) | additionalProperty(String key, boolean value) | -| [Schema1MapBuilder](#schema1mapbuilder) | additionalProperty(String key, String value) | -| [Schema1MapBuilder](#schema1mapbuilder) | additionalProperty(String key, int value) | -| [Schema1MapBuilder](#schema1mapbuilder) | additionalProperty(String key, float value) | -| [Schema1MapBuilder](#schema1mapbuilder) | additionalProperty(String key, long value) | -| [Schema1MapBuilder](#schema1mapbuilder) | additionalProperty(String key, double value) | -| [Schema1MapBuilder](#schema1mapbuilder) | additionalProperty(String key, List value) | -| [Schema1MapBuilder](#schema1mapbuilder) | additionalProperty(String key, Map value) | - -## Schema1Map -public static class Schema1Map
-extends FrozenMap - -A class to store validated Map payloads - -### Method Summary -| Modifier and Type | Method and Description | -| ----------------- | ---------------------- | -| static [Schema1Map](#schema1map) | of([Map](#schema1mapbuilder) arg, SchemaConfiguration configuration) | -| @Nullable Object | getAdditionalProperty(String name)
provides type safety for additional properties | - -## AdditionalProperties1Boxed -public sealed interface AdditionalProperties1Boxed
-permits
-[AdditionalProperties1BoxedVoid](#additionalproperties1boxedvoid), -[AdditionalProperties1BoxedBoolean](#additionalproperties1boxedboolean), -[AdditionalProperties1BoxedNumber](#additionalproperties1boxednumber), -[AdditionalProperties1BoxedString](#additionalproperties1boxedstring), -[AdditionalProperties1BoxedList](#additionalproperties1boxedlist), -[AdditionalProperties1BoxedMap](#additionalproperties1boxedmap) - -sealed interface that stores validated payloads using boxed classes - -## AdditionalProperties1BoxedVoid -public record AdditionalProperties1BoxedVoid
-implements [AdditionalProperties1Boxed](#additionalproperties1boxed) - -record that stores validated null payloads, sealed permits implementation - -### Constructor Summary -| Constructor and Description | -| --------------------------- | -| AdditionalProperties1BoxedVoid(Nothing? data)
Creates an instance, private visibility | - -### Method Summary -| Modifier and Type | Method and Description | -| ----------------- | ---------------------- | -| Nothing? | data()
validated payload | -| @Nullable Object | getData()
validated payload | - -## AdditionalProperties1BoxedBoolean -public record AdditionalProperties1BoxedBoolean
-implements [AdditionalProperties1Boxed](#additionalproperties1boxed) - -record that stores validated boolean payloads, sealed permits implementation - -### Constructor Summary -| Constructor and Description | -| --------------------------- | -| AdditionalProperties1BoxedBoolean(boolean data)
Creates an instance, private visibility | - -### Method Summary -| Modifier and Type | Method and Description | -| ----------------- | ---------------------- | -| boolean | data()
validated payload | -| @Nullable Object | getData()
validated payload | - -## AdditionalProperties1BoxedNumber -public record AdditionalProperties1BoxedNumber
-implements [AdditionalProperties1Boxed](#additionalproperties1boxed) - -record that stores validated Number payloads, sealed permits implementation - -### Constructor Summary -| Constructor and Description | -| --------------------------- | -| AdditionalProperties1BoxedNumber(Number data)
Creates an instance, private visibility | - -### Method Summary -| Modifier and Type | Method and Description | -| ----------------- | ---------------------- | -| Number | data()
validated payload | -| @Nullable Object | getData()
validated payload | - -## AdditionalProperties1BoxedString -public record AdditionalProperties1BoxedString
-implements [AdditionalProperties1Boxed](#additionalproperties1boxed) - -record that stores validated String payloads, sealed permits implementation - -### Constructor Summary -| Constructor and Description | -| --------------------------- | -| AdditionalProperties1BoxedString(String data)
Creates an instance, private visibility | - -### Method Summary -| Modifier and Type | Method and Description | -| ----------------- | ---------------------- | -| String | data()
validated payload | -| @Nullable Object | getData()
validated payload | - -## AdditionalProperties1BoxedList -public record AdditionalProperties1BoxedList
-implements [AdditionalProperties1Boxed](#additionalproperties1boxed) - -record that stores validated List payloads, sealed permits implementation - -### Constructor Summary -| Constructor and Description | -| --------------------------- | -| AdditionalProperties1BoxedList(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 | - -## AdditionalProperties1BoxedMap -public record AdditionalProperties1BoxedMap
-implements [AdditionalProperties1Boxed](#additionalproperties1boxed) - -record that stores validated Map payloads, sealed permits implementation - -### Constructor Summary -| Constructor and Description | -| --------------------------- | -| AdditionalProperties1BoxedMap(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 | - -## AdditionalProperties1 -public static class AdditionalProperties1
-extends JsonSchema - -A schema class that validates payloads - -### Field Summary -| Modifier and Type | Field and Description | -| ----------------- | ---------------------- | -| Integer | minLength = 3 | - -### Method Summary -| Modifier and Type | Method and Description | -| ----------------- | ---------------------- | -| String | validate(String arg, SchemaConfiguration configuration) | -| Nothing? | validate(Nothing? arg, SchemaConfiguration configuration) | -| int | validate(int arg, SchemaConfiguration configuration) | -| long | validate(long arg, SchemaConfiguration configuration) | -| float | validate(float arg, SchemaConfiguration configuration) | -| double | validate(double arg, SchemaConfiguration configuration) | -| Number | validate(Number arg, SchemaConfiguration configuration) | -| boolean | validate(boolean arg, SchemaConfiguration configuration) | -| FrozenMap<@Nullable Object> | validate(Map<?, ?> arg, SchemaConfiguration configuration) | -| FrozenList<@Nullable Object> | validate(List arg, SchemaConfiguration configuration) | -| [AdditionalProperties1BoxedString](#additionalproperties1boxedstring) | validateAndBox(String arg, SchemaConfiguration configuration) | -| [AdditionalProperties1BoxedVoid](#additionalproperties1boxedvoid) | validateAndBox(Nothing? arg, SchemaConfiguration configuration) | -| [AdditionalProperties1BoxedNumber](#additionalproperties1boxednumber) | validateAndBox(Number arg, SchemaConfiguration configuration) | -| [AdditionalProperties1BoxedBoolean](#additionalproperties1boxedboolean) | validateAndBox(boolean arg, SchemaConfiguration configuration) | -| [AdditionalProperties1BoxedMap](#additionalproperties1boxedmap) | validateAndBox(Map<?, ?> arg, SchemaConfiguration configuration) | -| [AdditionalProperties1BoxedList](#additionalproperties1boxedlist) | validateAndBox(List arg, SchemaConfiguration configuration) | -| [AdditionalProperties1Boxed](#additionalproperties1boxed) | validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) | -| @Nullable Object | validate(@Nullable Object arg, SchemaConfiguration configuration) | - -## Schema0Boxed -public sealed interface Schema0Boxed
-permits
-[Schema0BoxedMap](#schema0boxedmap) - -sealed interface that stores validated payloads using boxed classes - -## Schema0BoxedMap -public record Schema0BoxedMap
-implements [Schema0Boxed](#schema0boxed) - -record that stores validated Map payloads, sealed permits implementation - -### Constructor Summary -| Constructor and Description | -| --------------------------- | -| Schema0BoxedMap([Schema0Map](#schema0map) data)
Creates an instance, private visibility | - -### Method Summary -| Modifier and Type | Method and Description | -| ----------------- | ---------------------- | -| [Schema0Map](#schema0map) | data()
validated payload | -| @Nullable Object | getData()
validated payload | - -## Schema0 -public static class Schema0
-extends JsonSchema - -A schema class that validates payloads - -### Code Sample -``` -import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags; -import org.openapijsonschematools.client.configurations.SchemaConfiguration; -import org.openapijsonschematools.client.exceptions.ValidationException; -import org.openapijsonschematools.client.schemas.validation.MapUtils; -import org.openapijsonschematools.client.schemas.validation.FrozenList; -import org.openapijsonschematools.client.schemas.validation.FrozenMap; -import org.openapijsonschematools.client.components.schemas.AdditionalPropertiesSchema; - -import java.util.Arrays; -import java.util.List; -import java.util.AbstractMap; - -static final SchemaConfiguration configuration = new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().build()); - -// Map validation -AdditionalPropertiesSchema.Schema0Map validatedPayload = - AdditionalPropertiesSchema.Schema0.validate( - new AdditionalPropertiesSchema.Schema0MapBuilder() - .build(), - configuration -); -``` - -### Field Summary -| Modifier and Type | Field and Description | -| ----------------- | ---------------------- | -| Set> | type = Set.of(Map.class) | -| Class | additionalProperties = [AdditionalProperties.class](#additionalproperties) | - -### Method Summary -| Modifier and Type | Method and Description | -| ----------------- | ---------------------- | -| [Schema0Map](#schema0map) | validate([Map<?, ?>](#schema0mapbuilder) arg, SchemaConfiguration configuration) | -| [Schema0BoxedMap](#schema0boxedmap) | validateAndBox([Map<?, ?>](#schema0mapbuilder) arg, SchemaConfiguration configuration) | -| [Schema0Boxed](#schema0boxed) | validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) | -| @Nullable Object | validate(@Nullable Object arg, SchemaConfiguration configuration) | - -## Schema0MapBuilder -public class Schema0MapBuilder
-builder for `Map` - -A class that builds the Map input type - -### Constructor Summary -| Constructor and Description | -| --------------------------- | -| Schema0MapBuilder()
Creates a builder that contains an empty map | - -### Method Summary -| Modifier and Type | Method and Description | -| ----------------- | ---------------------- | -| Map | build()
Returns map input that should be used with Schema.validate | -| [Schema0MapBuilder](#schema0mapbuilder) | additionalProperty(String key, Nothing? value) | -| [Schema0MapBuilder](#schema0mapbuilder) | additionalProperty(String key, boolean value) | -| [Schema0MapBuilder](#schema0mapbuilder) | additionalProperty(String key, String value) | -| [Schema0MapBuilder](#schema0mapbuilder) | additionalProperty(String key, int value) | -| [Schema0MapBuilder](#schema0mapbuilder) | additionalProperty(String key, float value) | -| [Schema0MapBuilder](#schema0mapbuilder) | additionalProperty(String key, long value) | -| [Schema0MapBuilder](#schema0mapbuilder) | additionalProperty(String key, double value) | -| [Schema0MapBuilder](#schema0mapbuilder) | additionalProperty(String key, List value) | -| [Schema0MapBuilder](#schema0mapbuilder) | additionalProperty(String key, Map value) | - -## Schema0Map -public static class Schema0Map
-extends FrozenMap - -A class to store validated Map payloads - -### Method Summary -| Modifier and Type | Method and Description | -| ----------------- | ---------------------- | -| static [Schema0Map](#schema0map) | of([Map](#schema0mapbuilder) arg, SchemaConfiguration configuration) | -| @Nullable Object | getAdditionalProperty(String name)
provides type safety for additional properties | - -## 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(Nothing? data)
Creates an instance, private visibility | - -### Method Summary -| Modifier and Type | Method and Description | -| ----------------- | ---------------------- | -| Nothing? | 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 AnyTypeJsonSchema.AnyTypeJsonSchema1 - -A schema class that validates payloads - -| Methods Inherited from class org.openapijsonschematools.client.schemas.AnyTypeJsonSchema.AnyTypeJsonSchema1 | -| ------------------------------------------------------------------ | -| validate | -| validateAndBox | - -[[Back to top]](#top) [[Back to Component Schemas]](../../../README.md#Component-Schemas) [[Back to README]](../../../README.md) diff --git a/samples/client/petstore/kotlin/docs/components/schemas/AdditionalPropertiesWithArrayOfEnums.md b/samples/client/petstore/kotlin/docs/components/schemas/AdditionalPropertiesWithArrayOfEnums.md deleted file mode 100644 index 436c7eed867..00000000000 --- a/samples/client/petstore/kotlin/docs/components/schemas/AdditionalPropertiesWithArrayOfEnums.md +++ /dev/null @@ -1,233 +0,0 @@ -# AdditionalPropertiesWithArrayOfEnums -org.openapijsonschematools.client.components.schemas.AdditionalPropertiesWithArrayOfEnums.java -public class AdditionalPropertiesWithArrayOfEnums
- -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 list payloads, extends FrozenList -- classes to build inputs for list payloads -- classes to store validated map payloads, extends FrozenMap -- classes to build inputs for map payloads - -## Nested Class Summary -| Modifier and Type | Class and Description | -| ----------------- | ---------------------- | -| sealed interface | [AdditionalPropertiesWithArrayOfEnums.AdditionalPropertiesWithArrayOfEnums1Boxed](#additionalpropertieswitharrayofenums1boxed)
sealed interface for validated payloads | -| record | [AdditionalPropertiesWithArrayOfEnums.AdditionalPropertiesWithArrayOfEnums1BoxedMap](#additionalpropertieswitharrayofenums1boxedmap)
boxed class to store validated Map payloads | -| static class | [AdditionalPropertiesWithArrayOfEnums.AdditionalPropertiesWithArrayOfEnums1](#additionalpropertieswitharrayofenums1)
schema class | -| static class | [AdditionalPropertiesWithArrayOfEnums.AdditionalPropertiesWithArrayOfEnumsMapBuilder](#additionalpropertieswitharrayofenumsmapbuilder)
builder for Map payloads | -| static class | [AdditionalPropertiesWithArrayOfEnums.AdditionalPropertiesWithArrayOfEnumsMap](#additionalpropertieswitharrayofenumsmap)
output class for Map payloads | -| sealed interface | [AdditionalPropertiesWithArrayOfEnums.AdditionalPropertiesBoxed](#additionalpropertiesboxed)
sealed interface for validated payloads | -| record | [AdditionalPropertiesWithArrayOfEnums.AdditionalPropertiesBoxedList](#additionalpropertiesboxedlist)
boxed class to store validated List payloads | -| static class | [AdditionalPropertiesWithArrayOfEnums.AdditionalProperties](#additionalproperties)
schema class | -| static class | [AdditionalPropertiesWithArrayOfEnums.AdditionalPropertiesListBuilder](#additionalpropertieslistbuilder)
builder for List payloads | -| static class | [AdditionalPropertiesWithArrayOfEnums.AdditionalPropertiesList](#additionalpropertieslist)
output class for List payloads | - -## AdditionalPropertiesWithArrayOfEnums1Boxed -public sealed interface AdditionalPropertiesWithArrayOfEnums1Boxed
-permits
-[AdditionalPropertiesWithArrayOfEnums1BoxedMap](#additionalpropertieswitharrayofenums1boxedmap) - -sealed interface that stores validated payloads using boxed classes - -## AdditionalPropertiesWithArrayOfEnums1BoxedMap -public record AdditionalPropertiesWithArrayOfEnums1BoxedMap
-implements [AdditionalPropertiesWithArrayOfEnums1Boxed](#additionalpropertieswitharrayofenums1boxed) - -record that stores validated Map payloads, sealed permits implementation - -### Constructor Summary -| Constructor and Description | -| --------------------------- | -| AdditionalPropertiesWithArrayOfEnums1BoxedMap([AdditionalPropertiesWithArrayOfEnumsMap](#additionalpropertieswitharrayofenumsmap) data)
Creates an instance, private visibility | - -### Method Summary -| Modifier and Type | Method and Description | -| ----------------- | ---------------------- | -| [AdditionalPropertiesWithArrayOfEnumsMap](#additionalpropertieswitharrayofenumsmap) | data()
validated payload | -| @Nullable Object | getData()
validated payload | - -## AdditionalPropertiesWithArrayOfEnums1 -public static class AdditionalPropertiesWithArrayOfEnums1
-extends JsonSchema - -A schema class that validates payloads - -### Code Sample -``` -import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags; -import org.openapijsonschematools.client.configurations.SchemaConfiguration; -import org.openapijsonschematools.client.exceptions.ValidationException; -import org.openapijsonschematools.client.schemas.validation.MapUtils; -import org.openapijsonschematools.client.schemas.validation.FrozenList; -import org.openapijsonschematools.client.schemas.validation.FrozenMap; -import org.openapijsonschematools.client.components.schemas.AdditionalPropertiesWithArrayOfEnums; - -import java.util.Arrays; -import java.util.List; -import java.util.AbstractMap; - -static final SchemaConfiguration configuration = new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().build()); - -// Map validation -AdditionalPropertiesWithArrayOfEnums.AdditionalPropertiesWithArrayOfEnumsMap validatedPayload = - AdditionalPropertiesWithArrayOfEnums.AdditionalPropertiesWithArrayOfEnums1.validate( - new AdditionalPropertiesWithArrayOfEnums.AdditionalPropertiesWithArrayOfEnumsMapBuilder() - .additionalProperty( - "someAdditionalProperty", - Arrays.asList( - "_abc" - ) - ) - .build(), - configuration -); -``` - -### Field Summary -| Modifier and Type | Field and Description | -| ----------------- | ---------------------- | -| Set> | type = Set.of(Map.class) | -| Class | additionalProperties = [AdditionalProperties.class](#additionalproperties) | - -### Method Summary -| Modifier and Type | Method and Description | -| ----------------- | ---------------------- | -| [AdditionalPropertiesWithArrayOfEnumsMap](#additionalpropertieswitharrayofenumsmap) | validate([Map<?, ?>](#additionalpropertieswitharrayofenumsmapbuilder) arg, SchemaConfiguration configuration) | -| [AdditionalPropertiesWithArrayOfEnums1BoxedMap](#additionalpropertieswitharrayofenums1boxedmap) | validateAndBox([Map<?, ?>](#additionalpropertieswitharrayofenumsmapbuilder) arg, SchemaConfiguration configuration) | -| [AdditionalPropertiesWithArrayOfEnums1Boxed](#additionalpropertieswitharrayofenums1boxed) | validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) | -| @Nullable Object | validate(@Nullable Object arg, SchemaConfiguration configuration) | - -## AdditionalPropertiesWithArrayOfEnumsMapBuilder -public class AdditionalPropertiesWithArrayOfEnumsMapBuilder
-builder for `Map>` - -A class that builds the Map input type - -### Constructor Summary -| Constructor and Description | -| --------------------------- | -| AdditionalPropertiesWithArrayOfEnumsMapBuilder()
Creates a builder that contains an empty map | - -### Method Summary -| Modifier and Type | Method and Description | -| ----------------- | ---------------------- | -| Map> | build()
Returns map input that should be used with Schema.validate | -| [AdditionalPropertiesWithArrayOfEnumsMapBuilder](#additionalpropertieswitharrayofenumsmapbuilder) | additionalProperty(String key, List value) | - -## AdditionalPropertiesWithArrayOfEnumsMap -public static class AdditionalPropertiesWithArrayOfEnumsMap
-extends FrozenMap - -A class to store validated Map payloads - -### Method Summary -| Modifier and Type | Method and Description | -| ----------------- | ---------------------- | -| static [AdditionalPropertiesWithArrayOfEnumsMap](#additionalpropertieswitharrayofenumsmap) | of([Map>](#additionalpropertieswitharrayofenumsmapbuilder) arg, SchemaConfiguration configuration) | -| [AdditionalPropertiesList](#additionalpropertieslist) | getAdditionalProperty(String name)
provides type safety for additional properties | - -## AdditionalPropertiesBoxed -public sealed interface AdditionalPropertiesBoxed
-permits
-[AdditionalPropertiesBoxedList](#additionalpropertiesboxedlist) - -sealed interface that stores validated payloads using boxed classes - -## AdditionalPropertiesBoxedList -public record AdditionalPropertiesBoxedList
-implements [AdditionalPropertiesBoxed](#additionalpropertiesboxed) - -record that stores validated List payloads, sealed permits implementation - -### Constructor Summary -| Constructor and Description | -| --------------------------- | -| AdditionalPropertiesBoxedList([AdditionalPropertiesList](#additionalpropertieslist) data)
Creates an instance, private visibility | - -### Method Summary -| Modifier and Type | Method and Description | -| ----------------- | ---------------------- | -| [AdditionalPropertiesList](#additionalpropertieslist) | data()
validated payload | -| @Nullable Object | getData()
validated payload | - -## AdditionalProperties -public static class AdditionalProperties
-extends JsonSchema - -A schema class that validates payloads - -### Code Sample -``` -import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags; -import org.openapijsonschematools.client.configurations.SchemaConfiguration; -import org.openapijsonschematools.client.exceptions.ValidationException; -import org.openapijsonschematools.client.schemas.validation.MapUtils; -import org.openapijsonschematools.client.schemas.validation.FrozenList; -import org.openapijsonschematools.client.schemas.validation.FrozenMap; -import org.openapijsonschematools.client.components.schemas.AdditionalPropertiesWithArrayOfEnums; - -import java.util.Arrays; -import java.util.List; -import java.util.AbstractMap; - -static final SchemaConfiguration configuration = new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().build()); - -// List validation -AdditionalPropertiesWithArrayOfEnums.AdditionalPropertiesList validatedPayload = - AdditionalPropertiesWithArrayOfEnums.AdditionalProperties.validate( - new AdditionalPropertiesWithArrayOfEnums.AdditionalPropertiesListBuilder() - .add("_abc") - - .build(), - configuration -); -``` - -### Field Summary -| Modifier and Type | Field and Description | -| ----------------- | ---------------------- | -| Set> | type = Set.of(List.class) | -| Class | items = [EnumClass.EnumClass1.class](../../components/schemas/EnumClass.md#enumclass1) | - -### Method Summary -| Modifier and Type | Method and Description | -| ----------------- | ---------------------- | -| [AdditionalPropertiesList](#additionalpropertieslist) | validate([List](#additionalpropertieslistbuilder) arg, SchemaConfiguration configuration) | -| [AdditionalPropertiesBoxedList](#additionalpropertiesboxedlist) | validateAndBox([List](#additionalpropertieslistbuilder) arg, SchemaConfiguration configuration) | -| [AdditionalPropertiesBoxed](#additionalpropertiesboxed) | validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) | -| @Nullable Object | validate(@Nullable Object arg, SchemaConfiguration configuration) | - -## AdditionalPropertiesListBuilder -public class AdditionalPropertiesListBuilder
-builder for `List` - -A class that builds the List input type - -### Constructor Summary -| Constructor and Description | -| --------------------------- | -| AdditionalPropertiesListBuilder()
Creates an empty list | -| AdditionalPropertiesListBuilder(List items)
Stores the items in a list | - -### Method Summary -| Modifier and Type | Method and Description | -| ----------------- | ---------------------- | -| AdditionalPropertiesListBuilder | add(String item) | -| AdditionalPropertiesListBuilder | add([EnumClass.StringEnumClassEnums](../../components/schemas/EnumClass.md#stringenumclassenums) item) | -| List | build()
Returns list input that should be used with Schema.validate | - -## AdditionalPropertiesList -public class AdditionalPropertiesList
-extends `FrozenList` - -A class to store validated List payloads - -### Method Summary -| Modifier and Type | Method and Description | -| ----------------- | ---------------------- | -| static [AdditionalPropertiesList](#additionalpropertieslist) | of([List](#additionalpropertieslistbuilder) arg, SchemaConfiguration configuration) | - -[[Back to top]](#top) [[Back to Component Schemas]](../../../README.md#Component-Schemas) [[Back to README]](../../../README.md) diff --git a/samples/client/petstore/kotlin/docs/components/schemas/Address.md b/samples/client/petstore/kotlin/docs/components/schemas/Address.md deleted file mode 100644 index a895ba52bc9..00000000000 --- a/samples/client/petstore/kotlin/docs/components/schemas/Address.md +++ /dev/null @@ -1,162 +0,0 @@ -# Address -org.openapijsonschematools.client.components.schemas.Address.java -public class Address
- -A class that contains necessary nested -- schema classes (which validate payloads), extends JsonSchema -- sealed interfaces which store validated payloads, java version of a sum type -- boxed classes which store validated payloads, sealed permits class implementations -- classes to store validated map payloads, extends FrozenMap -- classes to build inputs for map payloads - -## Nested Class Summary -| Modifier and Type | Class and Description | -| ----------------- | ---------------------- | -| sealed interface | [Address.Address1Boxed](#address1boxed)
sealed interface for validated payloads | -| record | [Address.Address1BoxedMap](#address1boxedmap)
boxed class to store validated Map payloads | -| static class | [Address.Address1](#address1)
schema class | -| static class | [Address.AddressMapBuilder](#addressmapbuilder)
builder for Map payloads | -| static class | [Address.AddressMap](#addressmap)
output class for Map payloads | -| sealed interface | [Address.AdditionalPropertiesBoxed](#additionalpropertiesboxed)
sealed interface for validated payloads | -| record | [Address.AdditionalPropertiesBoxedNumber](#additionalpropertiesboxednumber)
boxed class to store validated Number payloads | -| static class | [Address.AdditionalProperties](#additionalproperties)
schema class | - -## Address1Boxed -public sealed interface Address1Boxed
-permits
-[Address1BoxedMap](#address1boxedmap) - -sealed interface that stores validated payloads using boxed classes - -## Address1BoxedMap -public record Address1BoxedMap
-implements [Address1Boxed](#address1boxed) - -record that stores validated Map payloads, sealed permits implementation - -### Constructor Summary -| Constructor and Description | -| --------------------------- | -| Address1BoxedMap([AddressMap](#addressmap) data)
Creates an instance, private visibility | - -### Method Summary -| Modifier and Type | Method and Description | -| ----------------- | ---------------------- | -| [AddressMap](#addressmap) | data()
validated payload | -| @Nullable Object | getData()
validated payload | - -## Address1 -public static class Address1
-extends JsonSchema - -A schema class that validates payloads - -### Code Sample -``` -import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags; -import org.openapijsonschematools.client.configurations.SchemaConfiguration; -import org.openapijsonschematools.client.exceptions.ValidationException; -import org.openapijsonschematools.client.schemas.validation.MapUtils; -import org.openapijsonschematools.client.schemas.validation.FrozenList; -import org.openapijsonschematools.client.schemas.validation.FrozenMap; -import org.openapijsonschematools.client.components.schemas.Address; - -import java.util.Arrays; -import java.util.List; -import java.util.AbstractMap; - -static final SchemaConfiguration configuration = new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().build()); - -// Map validation -Address.AddressMap validatedPayload = - Address.Address1.validate( - new Address.AddressMapBuilder() - .additionalProperty("someAdditionalProperty", 1) - - .build(), - configuration -); -``` - -### Field Summary -| Modifier and Type | Field and Description | -| ----------------- | ---------------------- | -| Set> | type = Set.of(Map.class) | -| Class | additionalProperties = [AdditionalProperties.class](#additionalproperties) | - -### Method Summary -| Modifier and Type | Method and Description | -| ----------------- | ---------------------- | -| [AddressMap](#addressmap) | validate([Map<?, ?>](#addressmapbuilder) arg, SchemaConfiguration configuration) | -| [Address1BoxedMap](#address1boxedmap) | validateAndBox([Map<?, ?>](#addressmapbuilder) arg, SchemaConfiguration configuration) | -| [Address1Boxed](#address1boxed) | validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) | -| @Nullable Object | validate(@Nullable Object arg, SchemaConfiguration configuration) | - -## AddressMapBuilder -public class AddressMapBuilder
-builder for `Map` - -A class that builds the Map input type - -### Constructor Summary -| Constructor and Description | -| --------------------------- | -| AddressMapBuilder()
Creates a builder that contains an empty map | - -### Method Summary -| Modifier and Type | Method and Description | -| ----------------- | ---------------------- | -| Map | build()
Returns map input that should be used with Schema.validate | -| [AddressMapBuilder](#addressmapbuilder) | additionalProperty(String key, int value) | -| [AddressMapBuilder](#addressmapbuilder) | additionalProperty(String key, float value) | -| [AddressMapBuilder](#addressmapbuilder) | additionalProperty(String key, long value) | -| [AddressMapBuilder](#addressmapbuilder) | additionalProperty(String key, double value) | - -## AddressMap -public static class AddressMap
-extends FrozenMap - -A class to store validated Map payloads - -### Method Summary -| Modifier and Type | Method and Description | -| ----------------- | ---------------------- | -| static [AddressMap](#addressmap) | of([Map](#addressmapbuilder) arg, SchemaConfiguration configuration) | -| Number | getAdditionalProperty(String name)
provides type safety for additional properties | - -## AdditionalPropertiesBoxed -public sealed interface AdditionalPropertiesBoxed
-permits
-[AdditionalPropertiesBoxedNumber](#additionalpropertiesboxednumber) - -sealed interface that stores validated payloads using boxed classes - -## 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 | - -## AdditionalProperties -public static class AdditionalProperties
-extends IntJsonSchema.IntJsonSchema1 - -A schema class that validates payloads - -| Methods Inherited from class org.openapijsonschematools.client.schemas.IntJsonSchema.IntJsonSchema1 | -| ------------------------------------------------------------------ | -| validate | -| validateAndBox | - -[[Back to top]](#top) [[Back to Component Schemas]](../../../README.md#Component-Schemas) [[Back to README]](../../../README.md) diff --git a/samples/client/petstore/kotlin/docs/components/schemas/Animal.md b/samples/client/petstore/kotlin/docs/components/schemas/Animal.md deleted file mode 100644 index c4819208107..00000000000 --- a/samples/client/petstore/kotlin/docs/components/schemas/Animal.md +++ /dev/null @@ -1,259 +0,0 @@ -# Animal -org.openapijsonschematools.client.components.schemas.Animal.java -public class Animal
- -A class that contains necessary nested -- schema classes (which validate payloads), extends JsonSchema -- sealed interfaces which store validated payloads, java version of a sum type -- boxed classes which store validated payloads, sealed permits class implementations -- classes to store validated map payloads, extends FrozenMap -- classes to build inputs for map payloads - -## Nested Class Summary -| Modifier and Type | Class and Description | -| ----------------- | ---------------------- | -| sealed interface | [Animal.Animal1Boxed](#animal1boxed)
sealed interface for validated payloads | -| record | [Animal.Animal1BoxedMap](#animal1boxedmap)
boxed class to store validated Map payloads | -| static class | [Animal.Animal1](#animal1)
schema class | -| static class | [Animal.AnimalMapBuilder](#animalmapbuilder)
builder for Map payloads | -| static class | [Animal.AnimalMap](#animalmap)
output class for Map payloads | -| sealed interface | [Animal.ColorBoxed](#colorboxed)
sealed interface for validated payloads | -| record | [Animal.ColorBoxedString](#colorboxedstring)
boxed class to store validated String payloads | -| static class | [Animal.Color](#color)
schema class | -| sealed interface | [Animal.ClassNameBoxed](#classnameboxed)
sealed interface for validated payloads | -| record | [Animal.ClassNameBoxedString](#classnameboxedstring)
boxed class to store validated String payloads | -| static class | [Animal.ClassName](#classname)
schema class | - -## Animal1Boxed -public sealed interface Animal1Boxed
-permits
-[Animal1BoxedMap](#animal1boxedmap) - -sealed interface that stores validated payloads using boxed classes - -## Animal1BoxedMap -public record Animal1BoxedMap
-implements [Animal1Boxed](#animal1boxed) - -record that stores validated Map payloads, sealed permits implementation - -### Constructor Summary -| Constructor and Description | -| --------------------------- | -| Animal1BoxedMap([AnimalMap](#animalmap) data)
Creates an instance, private visibility | - -### Method Summary -| Modifier and Type | Method and Description | -| ----------------- | ---------------------- | -| [AnimalMap](#animalmap) | data()
validated payload | -| @Nullable Object | getData()
validated payload | - -## Animal1 -public static class Animal1
-extends JsonSchema - -A schema class that validates payloads - -### Code Sample -``` -import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags; -import org.openapijsonschematools.client.configurations.SchemaConfiguration; -import org.openapijsonschematools.client.exceptions.ValidationException; -import org.openapijsonschematools.client.schemas.validation.MapUtils; -import org.openapijsonschematools.client.schemas.validation.FrozenList; -import org.openapijsonschematools.client.schemas.validation.FrozenMap; -import org.openapijsonschematools.client.components.schemas.Animal; - -import java.util.Arrays; -import java.util.List; -import java.util.AbstractMap; - -static final SchemaConfiguration configuration = new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().build()); - -// Map validation -Animal.AnimalMap validatedPayload = - Animal.Animal1.validate( - new Animal.AnimalMapBuilder() - .className("a") - - .color("a") - - .build(), - configuration -); -``` - -### Field Summary -| Modifier and Type | Field and Description | -| ----------------- | ---------------------- | -| Set> | type = Set.of(Map.class) | -| Map> | properties = Map.ofEntries(
    new PropertyEntry("className", [ClassName.class](#classname))),
    new PropertyEntry("color", [Color.class](#color)))
)
| -| Set | required = Set.of(
    "className"
)
| - -### Method Summary -| Modifier and Type | Method and Description | -| ----------------- | ---------------------- | -| [AnimalMap](#animalmap) | validate([Map<?, ?>](#animalmapbuilder) arg, SchemaConfiguration configuration) | -| [Animal1BoxedMap](#animal1boxedmap) | validateAndBox([Map<?, ?>](#animalmapbuilder) arg, SchemaConfiguration configuration) | -| [Animal1Boxed](#animal1boxed) | validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) | -| @Nullable Object | validate(@Nullable Object arg, SchemaConfiguration configuration) | - -## AnimalMap0Builder -public class AnimalMap0Builder
-builder for `Map` - -A class that builds the Map input type - -### Constructor Summary -| Constructor and Description | -| --------------------------- | -| AnimalMap0Builder(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 | -| [AnimalMap0Builder](#animalmap0builder) | color(String value) | -| [AnimalMap0Builder](#animalmap0builder) | additionalProperty(String key, Nothing? value) | -| [AnimalMap0Builder](#animalmap0builder) | additionalProperty(String key, boolean value) | -| [AnimalMap0Builder](#animalmap0builder) | additionalProperty(String key, String value) | -| [AnimalMap0Builder](#animalmap0builder) | additionalProperty(String key, int value) | -| [AnimalMap0Builder](#animalmap0builder) | additionalProperty(String key, float value) | -| [AnimalMap0Builder](#animalmap0builder) | additionalProperty(String key, long value) | -| [AnimalMap0Builder](#animalmap0builder) | additionalProperty(String key, double value) | -| [AnimalMap0Builder](#animalmap0builder) | additionalProperty(String key, List value) | -| [AnimalMap0Builder](#animalmap0builder) | additionalProperty(String key, Map value) | - -## AnimalMapBuilder -public class AnimalMapBuilder
-builder for `Map` - -A class that builds the Map input type - -### Constructor Summary -| Constructor and Description | -| --------------------------- | -| AnimalMapBuilder()
Creates a builder that contains an empty map | - -### Method Summary -| Modifier and Type | Method and Description | -| ----------------- | ---------------------- | -| [AnimalMap0Builder](#animalmap0builder) | className(String value) | - -## AnimalMap -public static class AnimalMap
-extends FrozenMap - -A class to store validated Map payloads - -### Method Summary -| Modifier and Type | Method and Description | -| ----------------- | ---------------------- | -| static [AnimalMap](#animalmap) | of([Map](#animalmapbuilder) arg, SchemaConfiguration configuration) | -| String | className()
| -| String | color()
[optional] if omitted the server will use the default value of red | -| @Nullable Object | getAdditionalProperty(String name)
provides type safety for additional properties | - -## ColorBoxed -public sealed interface ColorBoxed
-permits
-[ColorBoxedString](#colorboxedstring) - -sealed interface that stores validated payloads using boxed classes - -## ColorBoxedString -public record ColorBoxedString
-implements [ColorBoxed](#colorboxed) - -record that stores validated String payloads, sealed permits implementation - -### Constructor Summary -| Constructor and Description | -| --------------------------- | -| ColorBoxedString(String data)
Creates an instance, private visibility | - -### Method Summary -| Modifier and Type | Method and Description | -| ----------------- | ---------------------- | -| String | data()
validated payload | -| @Nullable Object | getData()
validated payload | - -## Color -public static class Color
-extends JsonSchema - -A schema class that validates payloads - -### Code Sample -``` -import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags; -import org.openapijsonschematools.client.configurations.SchemaConfiguration; -import org.openapijsonschematools.client.exceptions.ValidationException; -import org.openapijsonschematools.client.schemas.validation.MapUtils; -import org.openapijsonschematools.client.schemas.validation.FrozenList; -import org.openapijsonschematools.client.schemas.validation.FrozenMap; -import org.openapijsonschematools.client.components.schemas.Animal; - -import java.util.Arrays; -import java.util.List; -import java.util.AbstractMap; - -static final SchemaConfiguration configuration = new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().build()); - -// String validation -String validatedPayload = Animal.Color.validate( - "a", - configuration -); -``` - -### Field Summary -| Modifier and Type | Field and Description | -| ----------------- | ---------------------- | -| Set> | type = Set.of(
    String.class
)
| -| @Nullable Object | defaultValue = "red" | - -### Method Summary -| Modifier and Type | Method and Description | -| ----------------- | ---------------------- | -| String | validate(String arg, SchemaConfiguration configuration) | -| [ColorBoxedString](#colorboxedstring) | validateAndBox(String arg, SchemaConfiguration configuration) | -| [ColorBoxed](#colorboxed) | validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) | -| @Nullable Object | validate(@Nullable Object arg, SchemaConfiguration configuration) | - -## ClassNameBoxed -public sealed interface ClassNameBoxed
-permits
-[ClassNameBoxedString](#classnameboxedstring) - -sealed interface that stores validated payloads using boxed classes - -## ClassNameBoxedString -public record ClassNameBoxedString
-implements [ClassNameBoxed](#classnameboxed) - -record that stores validated String payloads, sealed permits implementation - -### Constructor Summary -| Constructor and Description | -| --------------------------- | -| ClassNameBoxedString(String data)
Creates an instance, private visibility | - -### Method Summary -| Modifier and Type | Method and Description | -| ----------------- | ---------------------- | -| String | data()
validated payload | -| @Nullable Object | getData()
validated payload | - -## ClassName -public static class ClassName
-extends StringJsonSchema.StringJsonSchema1 - -A schema class that validates payloads - -| Methods Inherited from class org.openapijsonschematools.client.schemas.StringJsonSchema.StringJsonSchema1 | -| ------------------------------------------------------------------ | -| validate | -| validateAndBox | - -[[Back to top]](#top) [[Back to Component Schemas]](../../../README.md#Component-Schemas) [[Back to README]](../../../README.md) diff --git a/samples/client/petstore/kotlin/docs/components/schemas/AnimalFarm.md b/samples/client/petstore/kotlin/docs/components/schemas/AnimalFarm.md deleted file mode 100644 index c00c74501b6..00000000000 --- a/samples/client/petstore/kotlin/docs/components/schemas/AnimalFarm.md +++ /dev/null @@ -1,131 +0,0 @@ -# AnimalFarm -org.openapijsonschematools.client.components.schemas.AnimalFarm.java -public class AnimalFarm
- -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 list payloads, extends FrozenList -- classes to build inputs for list payloads - -## Nested Class Summary -| Modifier and Type | Class and Description | -| ----------------- | ---------------------- | -| sealed interface | [AnimalFarm.AnimalFarm1Boxed](#animalfarm1boxed)
sealed interface for validated payloads | -| record | [AnimalFarm.AnimalFarm1BoxedList](#animalfarm1boxedlist)
boxed class to store validated List payloads | -| static class | [AnimalFarm.AnimalFarm1](#animalfarm1)
schema class | -| static class | [AnimalFarm.AnimalFarmListBuilder](#animalfarmlistbuilder)
builder for List payloads | -| static class | [AnimalFarm.AnimalFarmList](#animalfarmlist)
output class for List payloads | - -## AnimalFarm1Boxed -public sealed interface AnimalFarm1Boxed
-permits
-[AnimalFarm1BoxedList](#animalfarm1boxedlist) - -sealed interface that stores validated payloads using boxed classes - -## AnimalFarm1BoxedList -public record AnimalFarm1BoxedList
-implements [AnimalFarm1Boxed](#animalfarm1boxed) - -record that stores validated List payloads, sealed permits implementation - -### Constructor Summary -| Constructor and Description | -| --------------------------- | -| AnimalFarm1BoxedList([AnimalFarmList](#animalfarmlist) data)
Creates an instance, private visibility | - -### Method Summary -| Modifier and Type | Method and Description | -| ----------------- | ---------------------- | -| [AnimalFarmList](#animalfarmlist) | data()
validated payload | -| @Nullable Object | getData()
validated payload | - -## AnimalFarm1 -public static class AnimalFarm1
-extends JsonSchema - -A schema class that validates payloads - -### Code Sample -``` -import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags; -import org.openapijsonschematools.client.configurations.SchemaConfiguration; -import org.openapijsonschematools.client.exceptions.ValidationException; -import org.openapijsonschematools.client.schemas.validation.MapUtils; -import org.openapijsonschematools.client.schemas.validation.FrozenList; -import org.openapijsonschematools.client.schemas.validation.FrozenMap; -import org.openapijsonschematools.client.components.schemas.AnimalFarm; - -import java.util.Arrays; -import java.util.List; -import java.util.AbstractMap; - -static final SchemaConfiguration configuration = new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().build()); - -// List validation -AnimalFarm.AnimalFarmList validatedPayload = - AnimalFarm.AnimalFarm1.validate( - new AnimalFarm.AnimalFarmListBuilder() - .add( - MapUtils.makeMap( - new AbstractMap.SimpleEntry( - "className", - "a" - ), - new AbstractMap.SimpleEntry( - "color", - "a" - ) - ) - ) - .build(), - configuration -); -``` - -### Field Summary -| Modifier and Type | Field and Description | -| ----------------- | ---------------------- | -| Set> | type = Set.of(List.class) | -| Class | items = [Animal.Animal1.class](../../components/schemas/Animal.md#animal1) | - -### Method Summary -| Modifier and Type | Method and Description | -| ----------------- | ---------------------- | -| [AnimalFarmList](#animalfarmlist) | validate([List](#animalfarmlistbuilder) arg, SchemaConfiguration configuration) | -| [AnimalFarm1BoxedList](#animalfarm1boxedlist) | validateAndBox([List](#animalfarmlistbuilder) arg, SchemaConfiguration configuration) | -| [AnimalFarm1Boxed](#animalfarm1boxed) | validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) | -| @Nullable Object | validate(@Nullable Object arg, SchemaConfiguration configuration) | - -## AnimalFarmListBuilder -public class AnimalFarmListBuilder
-builder for `List>` - -A class that builds the List input type - -### Constructor Summary -| Constructor and Description | -| --------------------------- | -| AnimalFarmListBuilder()
Creates an empty list | -| AnimalFarmListBuilder(List> items)
Stores the items in a list | - -### Method Summary -| Modifier and Type | Method and Description | -| ----------------- | ---------------------- | -| AnimalFarmListBuilder | add(Map item) | -| List> | build()
Returns list input that should be used with Schema.validate | - -## AnimalFarmList -public class AnimalFarmList
-extends `FrozenList` - -A class to store validated List payloads - -### Method Summary -| Modifier and Type | Method and Description | -| ----------------- | ---------------------- | -| static [AnimalFarmList](#animalfarmlist) | of([List>](#animalfarmlistbuilder) arg, SchemaConfiguration configuration) | - -[[Back to top]](#top) [[Back to Component Schemas]](../../../README.md#Component-Schemas) [[Back to README]](../../../README.md) diff --git a/samples/client/petstore/kotlin/docs/components/schemas/AnyTypeAndFormat.md b/samples/client/petstore/kotlin/docs/components/schemas/AnyTypeAndFormat.md deleted file mode 100644 index b313ae64ea0..00000000000 --- a/samples/client/petstore/kotlin/docs/components/schemas/AnyTypeAndFormat.md +++ /dev/null @@ -1,1608 +0,0 @@ -# AnyTypeAndFormat -org.openapijsonschematools.client.components.schemas.AnyTypeAndFormat.java -public class AnyTypeAndFormat
- -A class that contains necessary nested -- schema classes (which validate payloads), extends JsonSchema -- sealed interfaces which store validated payloads, java version of a sum type -- boxed classes which store validated payloads, sealed permits class implementations -- classes to store validated map payloads, extends FrozenMap -- classes to build inputs for map payloads - -## Nested Class Summary -| Modifier and Type | Class and Description | -| ----------------- | ---------------------- | -| sealed interface | [AnyTypeAndFormat.AnyTypeAndFormat1Boxed](#anytypeandformat1boxed)
sealed interface for validated payloads | -| record | [AnyTypeAndFormat.AnyTypeAndFormat1BoxedMap](#anytypeandformat1boxedmap)
boxed class to store validated Map payloads | -| static class | [AnyTypeAndFormat.AnyTypeAndFormat1](#anytypeandformat1)
schema class | -| static class | [AnyTypeAndFormat.AnyTypeAndFormatMapBuilder](#anytypeandformatmapbuilder)
builder for Map payloads | -| static class | [AnyTypeAndFormat.AnyTypeAndFormatMap](#anytypeandformatmap)
output class for Map payloads | -| sealed interface | [AnyTypeAndFormat.FloatSchemaBoxed](#floatschemaboxed)
sealed interface for validated payloads | -| record | [AnyTypeAndFormat.FloatSchemaBoxedVoid](#floatschemaboxedvoid)
boxed class to store validated null payloads | -| record | [AnyTypeAndFormat.FloatSchemaBoxedBoolean](#floatschemaboxedboolean)
boxed class to store validated boolean payloads | -| record | [AnyTypeAndFormat.FloatSchemaBoxedNumber](#floatschemaboxednumber)
boxed class to store validated Number payloads | -| record | [AnyTypeAndFormat.FloatSchemaBoxedString](#floatschemaboxedstring)
boxed class to store validated String payloads | -| record | [AnyTypeAndFormat.FloatSchemaBoxedList](#floatschemaboxedlist)
boxed class to store validated List payloads | -| record | [AnyTypeAndFormat.FloatSchemaBoxedMap](#floatschemaboxedmap)
boxed class to store validated Map payloads | -| static class | [AnyTypeAndFormat.FloatSchema](#floatschema)
schema class | -| sealed interface | [AnyTypeAndFormat.DoubleSchemaBoxed](#doubleschemaboxed)
sealed interface for validated payloads | -| record | [AnyTypeAndFormat.DoubleSchemaBoxedVoid](#doubleschemaboxedvoid)
boxed class to store validated null payloads | -| record | [AnyTypeAndFormat.DoubleSchemaBoxedBoolean](#doubleschemaboxedboolean)
boxed class to store validated boolean payloads | -| record | [AnyTypeAndFormat.DoubleSchemaBoxedNumber](#doubleschemaboxednumber)
boxed class to store validated Number payloads | -| record | [AnyTypeAndFormat.DoubleSchemaBoxedString](#doubleschemaboxedstring)
boxed class to store validated String payloads | -| record | [AnyTypeAndFormat.DoubleSchemaBoxedList](#doubleschemaboxedlist)
boxed class to store validated List payloads | -| record | [AnyTypeAndFormat.DoubleSchemaBoxedMap](#doubleschemaboxedmap)
boxed class to store validated Map payloads | -| static class | [AnyTypeAndFormat.DoubleSchema](#doubleschema)
schema class | -| sealed interface | [AnyTypeAndFormat.Int64Boxed](#int64boxed)
sealed interface for validated payloads | -| record | [AnyTypeAndFormat.Int64BoxedVoid](#int64boxedvoid)
boxed class to store validated null payloads | -| record | [AnyTypeAndFormat.Int64BoxedBoolean](#int64boxedboolean)
boxed class to store validated boolean payloads | -| record | [AnyTypeAndFormat.Int64BoxedNumber](#int64boxednumber)
boxed class to store validated Number payloads | -| record | [AnyTypeAndFormat.Int64BoxedString](#int64boxedstring)
boxed class to store validated String payloads | -| record | [AnyTypeAndFormat.Int64BoxedList](#int64boxedlist)
boxed class to store validated List payloads | -| record | [AnyTypeAndFormat.Int64BoxedMap](#int64boxedmap)
boxed class to store validated Map payloads | -| static class | [AnyTypeAndFormat.Int64](#int64)
schema class | -| sealed interface | [AnyTypeAndFormat.Int32Boxed](#int32boxed)
sealed interface for validated payloads | -| record | [AnyTypeAndFormat.Int32BoxedVoid](#int32boxedvoid)
boxed class to store validated null payloads | -| record | [AnyTypeAndFormat.Int32BoxedBoolean](#int32boxedboolean)
boxed class to store validated boolean payloads | -| record | [AnyTypeAndFormat.Int32BoxedNumber](#int32boxednumber)
boxed class to store validated Number payloads | -| record | [AnyTypeAndFormat.Int32BoxedString](#int32boxedstring)
boxed class to store validated String payloads | -| record | [AnyTypeAndFormat.Int32BoxedList](#int32boxedlist)
boxed class to store validated List payloads | -| record | [AnyTypeAndFormat.Int32BoxedMap](#int32boxedmap)
boxed class to store validated Map payloads | -| static class | [AnyTypeAndFormat.Int32](#int32)
schema class | -| sealed interface | [AnyTypeAndFormat.BinaryBoxed](#binaryboxed)
sealed interface for validated payloads | -| record | [AnyTypeAndFormat.BinaryBoxedVoid](#binaryboxedvoid)
boxed class to store validated null payloads | -| record | [AnyTypeAndFormat.BinaryBoxedBoolean](#binaryboxedboolean)
boxed class to store validated boolean payloads | -| record | [AnyTypeAndFormat.BinaryBoxedNumber](#binaryboxednumber)
boxed class to store validated Number payloads | -| record | [AnyTypeAndFormat.BinaryBoxedString](#binaryboxedstring)
boxed class to store validated String payloads | -| record | [AnyTypeAndFormat.BinaryBoxedList](#binaryboxedlist)
boxed class to store validated List payloads | -| record | [AnyTypeAndFormat.BinaryBoxedMap](#binaryboxedmap)
boxed class to store validated Map payloads | -| static class | [AnyTypeAndFormat.Binary](#binary)
schema class | -| sealed interface | [AnyTypeAndFormat.NumberSchemaBoxed](#numberschemaboxed)
sealed interface for validated payloads | -| record | [AnyTypeAndFormat.NumberSchemaBoxedVoid](#numberschemaboxedvoid)
boxed class to store validated null payloads | -| record | [AnyTypeAndFormat.NumberSchemaBoxedBoolean](#numberschemaboxedboolean)
boxed class to store validated boolean payloads | -| record | [AnyTypeAndFormat.NumberSchemaBoxedNumber](#numberschemaboxednumber)
boxed class to store validated Number payloads | -| record | [AnyTypeAndFormat.NumberSchemaBoxedString](#numberschemaboxedstring)
boxed class to store validated String payloads | -| record | [AnyTypeAndFormat.NumberSchemaBoxedList](#numberschemaboxedlist)
boxed class to store validated List payloads | -| record | [AnyTypeAndFormat.NumberSchemaBoxedMap](#numberschemaboxedmap)
boxed class to store validated Map payloads | -| static class | [AnyTypeAndFormat.NumberSchema](#numberschema)
schema class | -| sealed interface | [AnyTypeAndFormat.DatetimeBoxed](#datetimeboxed)
sealed interface for validated payloads | -| record | [AnyTypeAndFormat.DatetimeBoxedVoid](#datetimeboxedvoid)
boxed class to store validated null payloads | -| record | [AnyTypeAndFormat.DatetimeBoxedBoolean](#datetimeboxedboolean)
boxed class to store validated boolean payloads | -| record | [AnyTypeAndFormat.DatetimeBoxedNumber](#datetimeboxednumber)
boxed class to store validated Number payloads | -| record | [AnyTypeAndFormat.DatetimeBoxedString](#datetimeboxedstring)
boxed class to store validated String payloads | -| record | [AnyTypeAndFormat.DatetimeBoxedList](#datetimeboxedlist)
boxed class to store validated List payloads | -| record | [AnyTypeAndFormat.DatetimeBoxedMap](#datetimeboxedmap)
boxed class to store validated Map payloads | -| static class | [AnyTypeAndFormat.Datetime](#datetime)
schema class | -| sealed interface | [AnyTypeAndFormat.DateBoxed](#dateboxed)
sealed interface for validated payloads | -| record | [AnyTypeAndFormat.DateBoxedVoid](#dateboxedvoid)
boxed class to store validated null payloads | -| record | [AnyTypeAndFormat.DateBoxedBoolean](#dateboxedboolean)
boxed class to store validated boolean payloads | -| record | [AnyTypeAndFormat.DateBoxedNumber](#dateboxednumber)
boxed class to store validated Number payloads | -| record | [AnyTypeAndFormat.DateBoxedString](#dateboxedstring)
boxed class to store validated String payloads | -| record | [AnyTypeAndFormat.DateBoxedList](#dateboxedlist)
boxed class to store validated List payloads | -| record | [AnyTypeAndFormat.DateBoxedMap](#dateboxedmap)
boxed class to store validated Map payloads | -| static class | [AnyTypeAndFormat.Date](#date)
schema class | -| sealed interface | [AnyTypeAndFormat.UuidSchemaBoxed](#uuidschemaboxed)
sealed interface for validated payloads | -| record | [AnyTypeAndFormat.UuidSchemaBoxedVoid](#uuidschemaboxedvoid)
boxed class to store validated null payloads | -| record | [AnyTypeAndFormat.UuidSchemaBoxedBoolean](#uuidschemaboxedboolean)
boxed class to store validated boolean payloads | -| record | [AnyTypeAndFormat.UuidSchemaBoxedNumber](#uuidschemaboxednumber)
boxed class to store validated Number payloads | -| record | [AnyTypeAndFormat.UuidSchemaBoxedString](#uuidschemaboxedstring)
boxed class to store validated String payloads | -| record | [AnyTypeAndFormat.UuidSchemaBoxedList](#uuidschemaboxedlist)
boxed class to store validated List payloads | -| record | [AnyTypeAndFormat.UuidSchemaBoxedMap](#uuidschemaboxedmap)
boxed class to store validated Map payloads | -| static class | [AnyTypeAndFormat.UuidSchema](#uuidschema)
schema class | - -## AnyTypeAndFormat1Boxed -public sealed interface AnyTypeAndFormat1Boxed
-permits
-[AnyTypeAndFormat1BoxedMap](#anytypeandformat1boxedmap) - -sealed interface that stores validated payloads using boxed classes - -## AnyTypeAndFormat1BoxedMap -public record AnyTypeAndFormat1BoxedMap
-implements [AnyTypeAndFormat1Boxed](#anytypeandformat1boxed) - -record that stores validated Map payloads, sealed permits implementation - -### Constructor Summary -| Constructor and Description | -| --------------------------- | -| AnyTypeAndFormat1BoxedMap([AnyTypeAndFormatMap](#anytypeandformatmap) data)
Creates an instance, private visibility | - -### Method Summary -| Modifier and Type | Method and Description | -| ----------------- | ---------------------- | -| [AnyTypeAndFormatMap](#anytypeandformatmap) | data()
validated payload | -| @Nullable Object | getData()
validated payload | - -## AnyTypeAndFormat1 -public static class AnyTypeAndFormat1
-extends JsonSchema - -A schema class that validates payloads - -### Code Sample -``` -import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags; -import org.openapijsonschematools.client.configurations.SchemaConfiguration; -import org.openapijsonschematools.client.exceptions.ValidationException; -import org.openapijsonschematools.client.schemas.validation.MapUtils; -import org.openapijsonschematools.client.schemas.validation.FrozenList; -import org.openapijsonschematools.client.schemas.validation.FrozenMap; -import org.openapijsonschematools.client.components.schemas.AnyTypeAndFormat; - -import java.util.Arrays; -import java.util.List; -import java.util.AbstractMap; - -static final SchemaConfiguration configuration = new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().build()); - -// Map validation -AnyTypeAndFormat.AnyTypeAndFormatMap validatedPayload = - AnyTypeAndFormat.AnyTypeAndFormat1.validate( - new AnyTypeAndFormat.AnyTypeAndFormatMapBuilder() - .build(), - configuration -); -``` - -### Field Summary -| Modifier and Type | Field and Description | -| ----------------- | ---------------------- | -| Set> | type = Set.of(Map.class) | -| Map> | properties = Map.ofEntries(
    new PropertyEntry("uuid", [UuidSchema.class](#uuidschema))),
    new PropertyEntry("date", [Date.class](#date))),
    new PropertyEntry("date-time", [Datetime.class](#datetime))),
    new PropertyEntry("number", [NumberSchema.class](#numberschema))),
    new PropertyEntry("binary", [Binary.class](#binary))),
    new PropertyEntry("int32", [Int32.class](#int32))),
    new PropertyEntry("int64", [Int64.class](#int64))),
    new PropertyEntry("double", [DoubleSchema.class](#doubleschema))),
    new PropertyEntry("float", [FloatSchema.class](#floatschema)))
)
| - -### Method Summary -| Modifier and Type | Method and Description | -| ----------------- | ---------------------- | -| [AnyTypeAndFormatMap](#anytypeandformatmap) | validate([Map<?, ?>](#anytypeandformatmapbuilder) arg, SchemaConfiguration configuration) | -| [AnyTypeAndFormat1BoxedMap](#anytypeandformat1boxedmap) | validateAndBox([Map<?, ?>](#anytypeandformatmapbuilder) arg, SchemaConfiguration configuration) | -| [AnyTypeAndFormat1Boxed](#anytypeandformat1boxed) | validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) | -| @Nullable Object | validate(@Nullable Object arg, SchemaConfiguration configuration) | - -## AnyTypeAndFormatMapBuilder -public class AnyTypeAndFormatMapBuilder
-builder for `Map` - -A class that builds the Map input type - -### Constructor Summary -| Constructor and Description | -| --------------------------- | -| AnyTypeAndFormatMapBuilder()
Creates a builder that contains an empty map | - -### Method Summary -| Modifier and Type | Method and Description | -| ----------------- | ---------------------- | -| Map | build()
Returns map input that should be used with Schema.validate | -| [AnyTypeAndFormatMapBuilder](#anytypeandformatmapbuilder) | setUuid(Nothing? value) | -| [AnyTypeAndFormatMapBuilder](#anytypeandformatmapbuilder) | setUuid(boolean value) | -| [AnyTypeAndFormatMapBuilder](#anytypeandformatmapbuilder) | setUuid(String value) | -| [AnyTypeAndFormatMapBuilder](#anytypeandformatmapbuilder) | setUuid(int value) | -| [AnyTypeAndFormatMapBuilder](#anytypeandformatmapbuilder) | setUuid(float value) | -| [AnyTypeAndFormatMapBuilder](#anytypeandformatmapbuilder) | setUuid(long value) | -| [AnyTypeAndFormatMapBuilder](#anytypeandformatmapbuilder) | setUuid(double value) | -| [AnyTypeAndFormatMapBuilder](#anytypeandformatmapbuilder) | setUuid(List value) | -| [AnyTypeAndFormatMapBuilder](#anytypeandformatmapbuilder) | setUuid(Map value) | -| [AnyTypeAndFormatMapBuilder](#anytypeandformatmapbuilder) | date(Nothing? value) | -| [AnyTypeAndFormatMapBuilder](#anytypeandformatmapbuilder) | date(boolean value) | -| [AnyTypeAndFormatMapBuilder](#anytypeandformatmapbuilder) | date(String value) | -| [AnyTypeAndFormatMapBuilder](#anytypeandformatmapbuilder) | date(int value) | -| [AnyTypeAndFormatMapBuilder](#anytypeandformatmapbuilder) | date(float value) | -| [AnyTypeAndFormatMapBuilder](#anytypeandformatmapbuilder) | date(long value) | -| [AnyTypeAndFormatMapBuilder](#anytypeandformatmapbuilder) | date(double value) | -| [AnyTypeAndFormatMapBuilder](#anytypeandformatmapbuilder) | date(List value) | -| [AnyTypeAndFormatMapBuilder](#anytypeandformatmapbuilder) | date(Map value) | -| [AnyTypeAndFormatMapBuilder](#anytypeandformatmapbuilder) | dateHyphenMinusTime(Nothing? value) | -| [AnyTypeAndFormatMapBuilder](#anytypeandformatmapbuilder) | dateHyphenMinusTime(boolean value) | -| [AnyTypeAndFormatMapBuilder](#anytypeandformatmapbuilder) | dateHyphenMinusTime(String value) | -| [AnyTypeAndFormatMapBuilder](#anytypeandformatmapbuilder) | dateHyphenMinusTime(int value) | -| [AnyTypeAndFormatMapBuilder](#anytypeandformatmapbuilder) | dateHyphenMinusTime(float value) | -| [AnyTypeAndFormatMapBuilder](#anytypeandformatmapbuilder) | dateHyphenMinusTime(long value) | -| [AnyTypeAndFormatMapBuilder](#anytypeandformatmapbuilder) | dateHyphenMinusTime(double value) | -| [AnyTypeAndFormatMapBuilder](#anytypeandformatmapbuilder) | dateHyphenMinusTime(List value) | -| [AnyTypeAndFormatMapBuilder](#anytypeandformatmapbuilder) | dateHyphenMinusTime(Map value) | -| [AnyTypeAndFormatMapBuilder](#anytypeandformatmapbuilder) | setNumber(Nothing? value) | -| [AnyTypeAndFormatMapBuilder](#anytypeandformatmapbuilder) | setNumber(boolean value) | -| [AnyTypeAndFormatMapBuilder](#anytypeandformatmapbuilder) | setNumber(String value) | -| [AnyTypeAndFormatMapBuilder](#anytypeandformatmapbuilder) | setNumber(int value) | -| [AnyTypeAndFormatMapBuilder](#anytypeandformatmapbuilder) | setNumber(float value) | -| [AnyTypeAndFormatMapBuilder](#anytypeandformatmapbuilder) | setNumber(long value) | -| [AnyTypeAndFormatMapBuilder](#anytypeandformatmapbuilder) | setNumber(double value) | -| [AnyTypeAndFormatMapBuilder](#anytypeandformatmapbuilder) | setNumber(List value) | -| [AnyTypeAndFormatMapBuilder](#anytypeandformatmapbuilder) | setNumber(Map value) | -| [AnyTypeAndFormatMapBuilder](#anytypeandformatmapbuilder) | binary(Nothing? value) | -| [AnyTypeAndFormatMapBuilder](#anytypeandformatmapbuilder) | binary(boolean value) | -| [AnyTypeAndFormatMapBuilder](#anytypeandformatmapbuilder) | binary(String value) | -| [AnyTypeAndFormatMapBuilder](#anytypeandformatmapbuilder) | binary(int value) | -| [AnyTypeAndFormatMapBuilder](#anytypeandformatmapbuilder) | binary(float value) | -| [AnyTypeAndFormatMapBuilder](#anytypeandformatmapbuilder) | binary(long value) | -| [AnyTypeAndFormatMapBuilder](#anytypeandformatmapbuilder) | binary(double value) | -| [AnyTypeAndFormatMapBuilder](#anytypeandformatmapbuilder) | binary(List value) | -| [AnyTypeAndFormatMapBuilder](#anytypeandformatmapbuilder) | binary(Map value) | -| [AnyTypeAndFormatMapBuilder](#anytypeandformatmapbuilder) | int32(Nothing? value) | -| [AnyTypeAndFormatMapBuilder](#anytypeandformatmapbuilder) | int32(boolean value) | -| [AnyTypeAndFormatMapBuilder](#anytypeandformatmapbuilder) | int32(String value) | -| [AnyTypeAndFormatMapBuilder](#anytypeandformatmapbuilder) | int32(int value) | -| [AnyTypeAndFormatMapBuilder](#anytypeandformatmapbuilder) | int32(float value) | -| [AnyTypeAndFormatMapBuilder](#anytypeandformatmapbuilder) | int32(long value) | -| [AnyTypeAndFormatMapBuilder](#anytypeandformatmapbuilder) | int32(double value) | -| [AnyTypeAndFormatMapBuilder](#anytypeandformatmapbuilder) | int32(List value) | -| [AnyTypeAndFormatMapBuilder](#anytypeandformatmapbuilder) | int32(Map value) | -| [AnyTypeAndFormatMapBuilder](#anytypeandformatmapbuilder) | int64(Nothing? value) | -| [AnyTypeAndFormatMapBuilder](#anytypeandformatmapbuilder) | int64(boolean value) | -| [AnyTypeAndFormatMapBuilder](#anytypeandformatmapbuilder) | int64(String value) | -| [AnyTypeAndFormatMapBuilder](#anytypeandformatmapbuilder) | int64(int value) | -| [AnyTypeAndFormatMapBuilder](#anytypeandformatmapbuilder) | int64(float value) | -| [AnyTypeAndFormatMapBuilder](#anytypeandformatmapbuilder) | int64(long value) | -| [AnyTypeAndFormatMapBuilder](#anytypeandformatmapbuilder) | int64(double value) | -| [AnyTypeAndFormatMapBuilder](#anytypeandformatmapbuilder) | int64(List value) | -| [AnyTypeAndFormatMapBuilder](#anytypeandformatmapbuilder) | int64(Map value) | -| [AnyTypeAndFormatMapBuilder](#anytypeandformatmapbuilder) | setDouble(Nothing? value) | -| [AnyTypeAndFormatMapBuilder](#anytypeandformatmapbuilder) | setDouble(boolean value) | -| [AnyTypeAndFormatMapBuilder](#anytypeandformatmapbuilder) | setDouble(String value) | -| [AnyTypeAndFormatMapBuilder](#anytypeandformatmapbuilder) | setDouble(int value) | -| [AnyTypeAndFormatMapBuilder](#anytypeandformatmapbuilder) | setDouble(float value) | -| [AnyTypeAndFormatMapBuilder](#anytypeandformatmapbuilder) | setDouble(long value) | -| [AnyTypeAndFormatMapBuilder](#anytypeandformatmapbuilder) | setDouble(double value) | -| [AnyTypeAndFormatMapBuilder](#anytypeandformatmapbuilder) | setDouble(List value) | -| [AnyTypeAndFormatMapBuilder](#anytypeandformatmapbuilder) | setDouble(Map value) | -| [AnyTypeAndFormatMapBuilder](#anytypeandformatmapbuilder) | setFloat(Nothing? value) | -| [AnyTypeAndFormatMapBuilder](#anytypeandformatmapbuilder) | setFloat(boolean value) | -| [AnyTypeAndFormatMapBuilder](#anytypeandformatmapbuilder) | setFloat(String value) | -| [AnyTypeAndFormatMapBuilder](#anytypeandformatmapbuilder) | setFloat(int value) | -| [AnyTypeAndFormatMapBuilder](#anytypeandformatmapbuilder) | setFloat(float value) | -| [AnyTypeAndFormatMapBuilder](#anytypeandformatmapbuilder) | setFloat(long value) | -| [AnyTypeAndFormatMapBuilder](#anytypeandformatmapbuilder) | setFloat(double value) | -| [AnyTypeAndFormatMapBuilder](#anytypeandformatmapbuilder) | setFloat(List value) | -| [AnyTypeAndFormatMapBuilder](#anytypeandformatmapbuilder) | setFloat(Map value) | -| [AnyTypeAndFormatMapBuilder](#anytypeandformatmapbuilder) | additionalProperty(String key, Nothing? value) | -| [AnyTypeAndFormatMapBuilder](#anytypeandformatmapbuilder) | additionalProperty(String key, boolean value) | -| [AnyTypeAndFormatMapBuilder](#anytypeandformatmapbuilder) | additionalProperty(String key, String value) | -| [AnyTypeAndFormatMapBuilder](#anytypeandformatmapbuilder) | additionalProperty(String key, int value) | -| [AnyTypeAndFormatMapBuilder](#anytypeandformatmapbuilder) | additionalProperty(String key, float value) | -| [AnyTypeAndFormatMapBuilder](#anytypeandformatmapbuilder) | additionalProperty(String key, long value) | -| [AnyTypeAndFormatMapBuilder](#anytypeandformatmapbuilder) | additionalProperty(String key, double value) | -| [AnyTypeAndFormatMapBuilder](#anytypeandformatmapbuilder) | additionalProperty(String key, List value) | -| [AnyTypeAndFormatMapBuilder](#anytypeandformatmapbuilder) | additionalProperty(String key, Map value) | - -## AnyTypeAndFormatMap -public static class AnyTypeAndFormatMap
-extends FrozenMap - -A class to store validated Map payloads - -### Method Summary -| Modifier and Type | Method and Description | -| ----------------- | ---------------------- | -| static [AnyTypeAndFormatMap](#anytypeandformatmap) | of([Map](#anytypeandformatmapbuilder) arg, SchemaConfiguration configuration) | -| @Nullable Object | date()
[optional] value must conform to RFC-3339 full-date YYYY-MM-DD | -| @Nullable Object | binary()
[optional] | -| @Nullable Object | int32()
[optional] value must be a 32 bit integer | -| @Nullable Object | int64()
[optional] value must be a 64 bit integer | -| @Nullable Object | get(String key)
This schema has invalid Java names so this method must be used when you access instance["uuid"], instance["date-time"], instance["number"], instance["double"], instance["float"], | -| @Nullable Object | getAdditionalProperty(String name)
provides type safety for additional properties | - -## FloatSchemaBoxed -public sealed interface FloatSchemaBoxed
-permits
-[FloatSchemaBoxedVoid](#floatschemaboxedvoid), -[FloatSchemaBoxedBoolean](#floatschemaboxedboolean), -[FloatSchemaBoxedNumber](#floatschemaboxednumber), -[FloatSchemaBoxedString](#floatschemaboxedstring), -[FloatSchemaBoxedList](#floatschemaboxedlist), -[FloatSchemaBoxedMap](#floatschemaboxedmap) - -sealed interface that stores validated payloads using boxed classes - -## FloatSchemaBoxedVoid -public record FloatSchemaBoxedVoid
-implements [FloatSchemaBoxed](#floatschemaboxed) - -record that stores validated null payloads, sealed permits implementation - -### Constructor Summary -| Constructor and Description | -| --------------------------- | -| FloatSchemaBoxedVoid(Nothing? data)
Creates an instance, private visibility | - -### Method Summary -| Modifier and Type | Method and Description | -| ----------------- | ---------------------- | -| Nothing? | data()
validated payload | -| @Nullable Object | getData()
validated payload | - -## FloatSchemaBoxedBoolean -public record FloatSchemaBoxedBoolean
-implements [FloatSchemaBoxed](#floatschemaboxed) - -record that stores validated boolean payloads, sealed permits implementation - -### Constructor Summary -| Constructor and Description | -| --------------------------- | -| FloatSchemaBoxedBoolean(boolean data)
Creates an instance, private visibility | - -### Method Summary -| Modifier and Type | Method and Description | -| ----------------- | ---------------------- | -| boolean | data()
validated payload | -| @Nullable Object | getData()
validated payload | - -## FloatSchemaBoxedNumber -public record FloatSchemaBoxedNumber
-implements [FloatSchemaBoxed](#floatschemaboxed) - -record that stores validated Number payloads, sealed permits implementation - -### Constructor Summary -| Constructor and Description | -| --------------------------- | -| FloatSchemaBoxedNumber(Number data)
Creates an instance, private visibility | - -### Method Summary -| Modifier and Type | Method and Description | -| ----------------- | ---------------------- | -| Number | data()
validated payload | -| @Nullable Object | getData()
validated payload | - -## FloatSchemaBoxedString -public record FloatSchemaBoxedString
-implements [FloatSchemaBoxed](#floatschemaboxed) - -record that stores validated String payloads, sealed permits implementation - -### Constructor Summary -| Constructor and Description | -| --------------------------- | -| FloatSchemaBoxedString(String data)
Creates an instance, private visibility | - -### Method Summary -| Modifier and Type | Method and Description | -| ----------------- | ---------------------- | -| String | data()
validated payload | -| @Nullable Object | getData()
validated payload | - -## FloatSchemaBoxedList -public record FloatSchemaBoxedList
-implements [FloatSchemaBoxed](#floatschemaboxed) - -record that stores validated List payloads, sealed permits implementation - -### Constructor Summary -| Constructor and Description | -| --------------------------- | -| FloatSchemaBoxedList(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 | - -## FloatSchemaBoxedMap -public record FloatSchemaBoxedMap
-implements [FloatSchemaBoxed](#floatschemaboxed) - -record that stores validated Map payloads, sealed permits implementation - -### Constructor Summary -| Constructor and Description | -| --------------------------- | -| FloatSchemaBoxedMap(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 | - -## FloatSchema -public static class FloatSchema
-extends JsonSchema - -A schema class that validates payloads - -### Field Summary -| Modifier and Type | Field and Description | -| ----------------- | ---------------------- | -| String | type = "float"; | - -### Method Summary -| Modifier and Type | Method and Description | -| ----------------- | ---------------------- | -| String | validate(String arg, SchemaConfiguration configuration) | -| Nothing? | validate(Nothing? arg, SchemaConfiguration configuration) | -| int | validate(int arg, SchemaConfiguration configuration) | -| long | validate(long arg, SchemaConfiguration configuration) | -| float | validate(float arg, SchemaConfiguration configuration) | -| double | validate(double arg, SchemaConfiguration configuration) | -| Number | validate(Number arg, SchemaConfiguration configuration) | -| boolean | validate(boolean arg, SchemaConfiguration configuration) | -| FrozenMap<@Nullable Object> | validate(Map<?, ?> arg, SchemaConfiguration configuration) | -| FrozenList<@Nullable Object> | validate(List arg, SchemaConfiguration configuration) | -| [FloatSchemaBoxedString](#floatschemaboxedstring) | validateAndBox(String arg, SchemaConfiguration configuration) | -| [FloatSchemaBoxedVoid](#floatschemaboxedvoid) | validateAndBox(Nothing? arg, SchemaConfiguration configuration) | -| [FloatSchemaBoxedNumber](#floatschemaboxednumber) | validateAndBox(Number arg, SchemaConfiguration configuration) | -| [FloatSchemaBoxedBoolean](#floatschemaboxedboolean) | validateAndBox(boolean arg, SchemaConfiguration configuration) | -| [FloatSchemaBoxedMap](#floatschemaboxedmap) | validateAndBox(Map<?, ?> arg, SchemaConfiguration configuration) | -| [FloatSchemaBoxedList](#floatschemaboxedlist) | validateAndBox(List arg, SchemaConfiguration configuration) | -| [FloatSchemaBoxed](#floatschemaboxed) | validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) | -| @Nullable Object | validate(@Nullable Object arg, SchemaConfiguration configuration) | - -## DoubleSchemaBoxed -public sealed interface DoubleSchemaBoxed
-permits
-[DoubleSchemaBoxedVoid](#doubleschemaboxedvoid), -[DoubleSchemaBoxedBoolean](#doubleschemaboxedboolean), -[DoubleSchemaBoxedNumber](#doubleschemaboxednumber), -[DoubleSchemaBoxedString](#doubleschemaboxedstring), -[DoubleSchemaBoxedList](#doubleschemaboxedlist), -[DoubleSchemaBoxedMap](#doubleschemaboxedmap) - -sealed interface that stores validated payloads using boxed classes - -## DoubleSchemaBoxedVoid -public record DoubleSchemaBoxedVoid
-implements [DoubleSchemaBoxed](#doubleschemaboxed) - -record that stores validated null payloads, sealed permits implementation - -### Constructor Summary -| Constructor and Description | -| --------------------------- | -| DoubleSchemaBoxedVoid(Nothing? data)
Creates an instance, private visibility | - -### Method Summary -| Modifier and Type | Method and Description | -| ----------------- | ---------------------- | -| Nothing? | data()
validated payload | -| @Nullable Object | getData()
validated payload | - -## DoubleSchemaBoxedBoolean -public record DoubleSchemaBoxedBoolean
-implements [DoubleSchemaBoxed](#doubleschemaboxed) - -record that stores validated boolean payloads, sealed permits implementation - -### Constructor Summary -| Constructor and Description | -| --------------------------- | -| DoubleSchemaBoxedBoolean(boolean data)
Creates an instance, private visibility | - -### Method Summary -| Modifier and Type | Method and Description | -| ----------------- | ---------------------- | -| boolean | data()
validated payload | -| @Nullable Object | getData()
validated payload | - -## DoubleSchemaBoxedNumber -public record DoubleSchemaBoxedNumber
-implements [DoubleSchemaBoxed](#doubleschemaboxed) - -record that stores validated Number payloads, sealed permits implementation - -### Constructor Summary -| Constructor and Description | -| --------------------------- | -| DoubleSchemaBoxedNumber(Number data)
Creates an instance, private visibility | - -### Method Summary -| Modifier and Type | Method and Description | -| ----------------- | ---------------------- | -| Number | data()
validated payload | -| @Nullable Object | getData()
validated payload | - -## DoubleSchemaBoxedString -public record DoubleSchemaBoxedString
-implements [DoubleSchemaBoxed](#doubleschemaboxed) - -record that stores validated String payloads, sealed permits implementation - -### Constructor Summary -| Constructor and Description | -| --------------------------- | -| DoubleSchemaBoxedString(String data)
Creates an instance, private visibility | - -### Method Summary -| Modifier and Type | Method and Description | -| ----------------- | ---------------------- | -| String | data()
validated payload | -| @Nullable Object | getData()
validated payload | - -## DoubleSchemaBoxedList -public record DoubleSchemaBoxedList
-implements [DoubleSchemaBoxed](#doubleschemaboxed) - -record that stores validated List payloads, sealed permits implementation - -### Constructor Summary -| Constructor and Description | -| --------------------------- | -| DoubleSchemaBoxedList(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 | - -## DoubleSchemaBoxedMap -public record DoubleSchemaBoxedMap
-implements [DoubleSchemaBoxed](#doubleschemaboxed) - -record that stores validated Map payloads, sealed permits implementation - -### Constructor Summary -| Constructor and Description | -| --------------------------- | -| DoubleSchemaBoxedMap(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 | - -## DoubleSchema -public static class DoubleSchema
-extends JsonSchema - -A schema class that validates payloads - -### Field Summary -| Modifier and Type | Field and Description | -| ----------------- | ---------------------- | -| String | type = "double"; | - -### Method Summary -| Modifier and Type | Method and Description | -| ----------------- | ---------------------- | -| String | validate(String arg, SchemaConfiguration configuration) | -| Nothing? | validate(Nothing? arg, SchemaConfiguration configuration) | -| int | validate(int arg, SchemaConfiguration configuration) | -| long | validate(long arg, SchemaConfiguration configuration) | -| float | validate(float arg, SchemaConfiguration configuration) | -| double | validate(double arg, SchemaConfiguration configuration) | -| Number | validate(Number arg, SchemaConfiguration configuration) | -| boolean | validate(boolean arg, SchemaConfiguration configuration) | -| FrozenMap<@Nullable Object> | validate(Map<?, ?> arg, SchemaConfiguration configuration) | -| FrozenList<@Nullable Object> | validate(List arg, SchemaConfiguration configuration) | -| [DoubleSchemaBoxedString](#doubleschemaboxedstring) | validateAndBox(String arg, SchemaConfiguration configuration) | -| [DoubleSchemaBoxedVoid](#doubleschemaboxedvoid) | validateAndBox(Nothing? arg, SchemaConfiguration configuration) | -| [DoubleSchemaBoxedNumber](#doubleschemaboxednumber) | validateAndBox(Number arg, SchemaConfiguration configuration) | -| [DoubleSchemaBoxedBoolean](#doubleschemaboxedboolean) | validateAndBox(boolean arg, SchemaConfiguration configuration) | -| [DoubleSchemaBoxedMap](#doubleschemaboxedmap) | validateAndBox(Map<?, ?> arg, SchemaConfiguration configuration) | -| [DoubleSchemaBoxedList](#doubleschemaboxedlist) | validateAndBox(List arg, SchemaConfiguration configuration) | -| [DoubleSchemaBoxed](#doubleschemaboxed) | validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) | -| @Nullable Object | validate(@Nullable Object arg, SchemaConfiguration configuration) | - -## Int64Boxed -public sealed interface Int64Boxed
-permits
-[Int64BoxedVoid](#int64boxedvoid), -[Int64BoxedBoolean](#int64boxedboolean), -[Int64BoxedNumber](#int64boxednumber), -[Int64BoxedString](#int64boxedstring), -[Int64BoxedList](#int64boxedlist), -[Int64BoxedMap](#int64boxedmap) - -sealed interface that stores validated payloads using boxed classes - -## Int64BoxedVoid -public record Int64BoxedVoid
-implements [Int64Boxed](#int64boxed) - -record that stores validated null payloads, sealed permits implementation - -### Constructor Summary -| Constructor and Description | -| --------------------------- | -| Int64BoxedVoid(Nothing? data)
Creates an instance, private visibility | - -### Method Summary -| Modifier and Type | Method and Description | -| ----------------- | ---------------------- | -| Nothing? | data()
validated payload | -| @Nullable Object | getData()
validated payload | - -## Int64BoxedBoolean -public record Int64BoxedBoolean
-implements [Int64Boxed](#int64boxed) - -record that stores validated boolean payloads, sealed permits implementation - -### Constructor Summary -| Constructor and Description | -| --------------------------- | -| Int64BoxedBoolean(boolean data)
Creates an instance, private visibility | - -### Method Summary -| Modifier and Type | Method and Description | -| ----------------- | ---------------------- | -| boolean | data()
validated payload | -| @Nullable Object | getData()
validated payload | - -## Int64BoxedNumber -public record Int64BoxedNumber
-implements [Int64Boxed](#int64boxed) - -record that stores validated Number payloads, sealed permits implementation - -### Constructor Summary -| Constructor and Description | -| --------------------------- | -| Int64BoxedNumber(Number data)
Creates an instance, private visibility | - -### Method Summary -| Modifier and Type | Method and Description | -| ----------------- | ---------------------- | -| Number | data()
validated payload | -| @Nullable Object | getData()
validated payload | - -## Int64BoxedString -public record Int64BoxedString
-implements [Int64Boxed](#int64boxed) - -record that stores validated String payloads, sealed permits implementation - -### Constructor Summary -| Constructor and Description | -| --------------------------- | -| Int64BoxedString(String data)
Creates an instance, private visibility | - -### Method Summary -| Modifier and Type | Method and Description | -| ----------------- | ---------------------- | -| String | data()
validated payload | -| @Nullable Object | getData()
validated payload | - -## Int64BoxedList -public record Int64BoxedList
-implements [Int64Boxed](#int64boxed) - -record that stores validated List payloads, sealed permits implementation - -### Constructor Summary -| Constructor and Description | -| --------------------------- | -| Int64BoxedList(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 | - -## Int64BoxedMap -public record Int64BoxedMap
-implements [Int64Boxed](#int64boxed) - -record that stores validated Map payloads, sealed permits implementation - -### Constructor Summary -| Constructor and Description | -| --------------------------- | -| Int64BoxedMap(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 | - -## Int64 -public static class Int64
-extends JsonSchema - -A schema class that validates payloads - -### Field Summary -| Modifier and Type | Field and Description | -| ----------------- | ---------------------- | -| String | type = "int64"; | - -### Method Summary -| Modifier and Type | Method and Description | -| ----------------- | ---------------------- | -| String | validate(String arg, SchemaConfiguration configuration) | -| Nothing? | validate(Nothing? arg, SchemaConfiguration configuration) | -| int | validate(int arg, SchemaConfiguration configuration) | -| long | validate(long arg, SchemaConfiguration configuration) | -| float | validate(float arg, SchemaConfiguration configuration) | -| double | validate(double arg, SchemaConfiguration configuration) | -| Number | validate(Number arg, SchemaConfiguration configuration) | -| boolean | validate(boolean arg, SchemaConfiguration configuration) | -| FrozenMap<@Nullable Object> | validate(Map<?, ?> arg, SchemaConfiguration configuration) | -| FrozenList<@Nullable Object> | validate(List arg, SchemaConfiguration configuration) | -| [Int64BoxedString](#int64boxedstring) | validateAndBox(String arg, SchemaConfiguration configuration) | -| [Int64BoxedVoid](#int64boxedvoid) | validateAndBox(Nothing? arg, SchemaConfiguration configuration) | -| [Int64BoxedNumber](#int64boxednumber) | validateAndBox(Number arg, SchemaConfiguration configuration) | -| [Int64BoxedBoolean](#int64boxedboolean) | validateAndBox(boolean arg, SchemaConfiguration configuration) | -| [Int64BoxedMap](#int64boxedmap) | validateAndBox(Map<?, ?> arg, SchemaConfiguration configuration) | -| [Int64BoxedList](#int64boxedlist) | validateAndBox(List arg, SchemaConfiguration configuration) | -| [Int64Boxed](#int64boxed) | validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) | -| @Nullable Object | validate(@Nullable Object arg, SchemaConfiguration configuration) | - -## Int32Boxed -public sealed interface Int32Boxed
-permits
-[Int32BoxedVoid](#int32boxedvoid), -[Int32BoxedBoolean](#int32boxedboolean), -[Int32BoxedNumber](#int32boxednumber), -[Int32BoxedString](#int32boxedstring), -[Int32BoxedList](#int32boxedlist), -[Int32BoxedMap](#int32boxedmap) - -sealed interface that stores validated payloads using boxed classes - -## Int32BoxedVoid -public record Int32BoxedVoid
-implements [Int32Boxed](#int32boxed) - -record that stores validated null payloads, sealed permits implementation - -### Constructor Summary -| Constructor and Description | -| --------------------------- | -| Int32BoxedVoid(Nothing? data)
Creates an instance, private visibility | - -### Method Summary -| Modifier and Type | Method and Description | -| ----------------- | ---------------------- | -| Nothing? | data()
validated payload | -| @Nullable Object | getData()
validated payload | - -## Int32BoxedBoolean -public record Int32BoxedBoolean
-implements [Int32Boxed](#int32boxed) - -record that stores validated boolean payloads, sealed permits implementation - -### Constructor Summary -| Constructor and Description | -| --------------------------- | -| Int32BoxedBoolean(boolean data)
Creates an instance, private visibility | - -### Method Summary -| Modifier and Type | Method and Description | -| ----------------- | ---------------------- | -| boolean | data()
validated payload | -| @Nullable Object | getData()
validated payload | - -## Int32BoxedNumber -public record Int32BoxedNumber
-implements [Int32Boxed](#int32boxed) - -record that stores validated Number payloads, sealed permits implementation - -### Constructor Summary -| Constructor and Description | -| --------------------------- | -| Int32BoxedNumber(Number data)
Creates an instance, private visibility | - -### Method Summary -| Modifier and Type | Method and Description | -| ----------------- | ---------------------- | -| Number | data()
validated payload | -| @Nullable Object | getData()
validated payload | - -## Int32BoxedString -public record Int32BoxedString
-implements [Int32Boxed](#int32boxed) - -record that stores validated String payloads, sealed permits implementation - -### Constructor Summary -| Constructor and Description | -| --------------------------- | -| Int32BoxedString(String data)
Creates an instance, private visibility | - -### Method Summary -| Modifier and Type | Method and Description | -| ----------------- | ---------------------- | -| String | data()
validated payload | -| @Nullable Object | getData()
validated payload | - -## Int32BoxedList -public record Int32BoxedList
-implements [Int32Boxed](#int32boxed) - -record that stores validated List payloads, sealed permits implementation - -### Constructor Summary -| Constructor and Description | -| --------------------------- | -| Int32BoxedList(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 | - -## Int32BoxedMap -public record Int32BoxedMap
-implements [Int32Boxed](#int32boxed) - -record that stores validated Map payloads, sealed permits implementation - -### Constructor Summary -| Constructor and Description | -| --------------------------- | -| Int32BoxedMap(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 | - -## Int32 -public static class Int32
-extends JsonSchema - -A schema class that validates payloads - -### Field Summary -| Modifier and Type | Field and Description | -| ----------------- | ---------------------- | -| String | type = "int32"; | - -### Method Summary -| Modifier and Type | Method and Description | -| ----------------- | ---------------------- | -| String | validate(String arg, SchemaConfiguration configuration) | -| Nothing? | validate(Nothing? arg, SchemaConfiguration configuration) | -| int | validate(int arg, SchemaConfiguration configuration) | -| long | validate(long arg, SchemaConfiguration configuration) | -| float | validate(float arg, SchemaConfiguration configuration) | -| double | validate(double arg, SchemaConfiguration configuration) | -| Number | validate(Number arg, SchemaConfiguration configuration) | -| boolean | validate(boolean arg, SchemaConfiguration configuration) | -| FrozenMap<@Nullable Object> | validate(Map<?, ?> arg, SchemaConfiguration configuration) | -| FrozenList<@Nullable Object> | validate(List arg, SchemaConfiguration configuration) | -| [Int32BoxedString](#int32boxedstring) | validateAndBox(String arg, SchemaConfiguration configuration) | -| [Int32BoxedVoid](#int32boxedvoid) | validateAndBox(Nothing? arg, SchemaConfiguration configuration) | -| [Int32BoxedNumber](#int32boxednumber) | validateAndBox(Number arg, SchemaConfiguration configuration) | -| [Int32BoxedBoolean](#int32boxedboolean) | validateAndBox(boolean arg, SchemaConfiguration configuration) | -| [Int32BoxedMap](#int32boxedmap) | validateAndBox(Map<?, ?> arg, SchemaConfiguration configuration) | -| [Int32BoxedList](#int32boxedlist) | validateAndBox(List arg, SchemaConfiguration configuration) | -| [Int32Boxed](#int32boxed) | validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) | -| @Nullable Object | validate(@Nullable Object arg, SchemaConfiguration configuration) | - -## BinaryBoxed -public sealed interface BinaryBoxed
-permits
-[BinaryBoxedVoid](#binaryboxedvoid), -[BinaryBoxedBoolean](#binaryboxedboolean), -[BinaryBoxedNumber](#binaryboxednumber), -[BinaryBoxedString](#binaryboxedstring), -[BinaryBoxedList](#binaryboxedlist), -[BinaryBoxedMap](#binaryboxedmap) - -sealed interface that stores validated payloads using boxed classes - -## BinaryBoxedVoid -public record BinaryBoxedVoid
-implements [BinaryBoxed](#binaryboxed) - -record that stores validated null payloads, sealed permits implementation - -### Constructor Summary -| Constructor and Description | -| --------------------------- | -| BinaryBoxedVoid(Nothing? data)
Creates an instance, private visibility | - -### Method Summary -| Modifier and Type | Method and Description | -| ----------------- | ---------------------- | -| Nothing? | data()
validated payload | -| @Nullable Object | getData()
validated payload | - -## BinaryBoxedBoolean -public record BinaryBoxedBoolean
-implements [BinaryBoxed](#binaryboxed) - -record that stores validated boolean payloads, sealed permits implementation - -### Constructor Summary -| Constructor and Description | -| --------------------------- | -| BinaryBoxedBoolean(boolean data)
Creates an instance, private visibility | - -### Method Summary -| Modifier and Type | Method and Description | -| ----------------- | ---------------------- | -| boolean | data()
validated payload | -| @Nullable Object | getData()
validated payload | - -## BinaryBoxedNumber -public record BinaryBoxedNumber
-implements [BinaryBoxed](#binaryboxed) - -record that stores validated Number payloads, sealed permits implementation - -### Constructor Summary -| Constructor and Description | -| --------------------------- | -| BinaryBoxedNumber(Number data)
Creates an instance, private visibility | - -### Method Summary -| Modifier and Type | Method and Description | -| ----------------- | ---------------------- | -| Number | data()
validated payload | -| @Nullable Object | getData()
validated payload | - -## BinaryBoxedString -public record BinaryBoxedString
-implements [BinaryBoxed](#binaryboxed) - -record that stores validated String payloads, sealed permits implementation - -### Constructor Summary -| Constructor and Description | -| --------------------------- | -| BinaryBoxedString(String data)
Creates an instance, private visibility | - -### Method Summary -| Modifier and Type | Method and Description | -| ----------------- | ---------------------- | -| String | data()
validated payload | -| @Nullable Object | getData()
validated payload | - -## BinaryBoxedList -public record BinaryBoxedList
-implements [BinaryBoxed](#binaryboxed) - -record that stores validated List payloads, sealed permits implementation - -### Constructor Summary -| Constructor and Description | -| --------------------------- | -| BinaryBoxedList(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 | - -## BinaryBoxedMap -public record BinaryBoxedMap
-implements [BinaryBoxed](#binaryboxed) - -record that stores validated Map payloads, sealed permits implementation - -### Constructor Summary -| Constructor and Description | -| --------------------------- | -| BinaryBoxedMap(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 | - -## Binary -public static class Binary
-extends JsonSchema - -A schema class that validates payloads - -### Field Summary -| Modifier and Type | Field and Description | -| ----------------- | ---------------------- | -| String | type = "binary"; | - -### Method Summary -| Modifier and Type | Method and Description | -| ----------------- | ---------------------- | -| String | validate(String arg, SchemaConfiguration configuration) | -| Nothing? | validate(Nothing? arg, SchemaConfiguration configuration) | -| int | validate(int arg, SchemaConfiguration configuration) | -| long | validate(long arg, SchemaConfiguration configuration) | -| float | validate(float arg, SchemaConfiguration configuration) | -| double | validate(double arg, SchemaConfiguration configuration) | -| Number | validate(Number arg, SchemaConfiguration configuration) | -| boolean | validate(boolean arg, SchemaConfiguration configuration) | -| FrozenMap<@Nullable Object> | validate(Map<?, ?> arg, SchemaConfiguration configuration) | -| FrozenList<@Nullable Object> | validate(List arg, SchemaConfiguration configuration) | -| [BinaryBoxedString](#binaryboxedstring) | validateAndBox(String arg, SchemaConfiguration configuration) | -| [BinaryBoxedVoid](#binaryboxedvoid) | validateAndBox(Nothing? arg, SchemaConfiguration configuration) | -| [BinaryBoxedNumber](#binaryboxednumber) | validateAndBox(Number arg, SchemaConfiguration configuration) | -| [BinaryBoxedBoolean](#binaryboxedboolean) | validateAndBox(boolean arg, SchemaConfiguration configuration) | -| [BinaryBoxedMap](#binaryboxedmap) | validateAndBox(Map<?, ?> arg, SchemaConfiguration configuration) | -| [BinaryBoxedList](#binaryboxedlist) | validateAndBox(List arg, SchemaConfiguration configuration) | -| [BinaryBoxed](#binaryboxed) | validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) | -| @Nullable Object | validate(@Nullable Object arg, SchemaConfiguration configuration) | - -## NumberSchemaBoxed -public sealed interface NumberSchemaBoxed
-permits
-[NumberSchemaBoxedVoid](#numberschemaboxedvoid), -[NumberSchemaBoxedBoolean](#numberschemaboxedboolean), -[NumberSchemaBoxedNumber](#numberschemaboxednumber), -[NumberSchemaBoxedString](#numberschemaboxedstring), -[NumberSchemaBoxedList](#numberschemaboxedlist), -[NumberSchemaBoxedMap](#numberschemaboxedmap) - -sealed interface that stores validated payloads using boxed classes - -## NumberSchemaBoxedVoid -public record NumberSchemaBoxedVoid
-implements [NumberSchemaBoxed](#numberschemaboxed) - -record that stores validated null payloads, sealed permits implementation - -### Constructor Summary -| Constructor and Description | -| --------------------------- | -| NumberSchemaBoxedVoid(Nothing? data)
Creates an instance, private visibility | - -### Method Summary -| Modifier and Type | Method and Description | -| ----------------- | ---------------------- | -| Nothing? | data()
validated payload | -| @Nullable Object | getData()
validated payload | - -## NumberSchemaBoxedBoolean -public record NumberSchemaBoxedBoolean
-implements [NumberSchemaBoxed](#numberschemaboxed) - -record that stores validated boolean payloads, sealed permits implementation - -### Constructor Summary -| Constructor and Description | -| --------------------------- | -| NumberSchemaBoxedBoolean(boolean data)
Creates an instance, private visibility | - -### Method Summary -| Modifier and Type | Method and Description | -| ----------------- | ---------------------- | -| boolean | data()
validated payload | -| @Nullable Object | getData()
validated payload | - -## NumberSchemaBoxedNumber -public record NumberSchemaBoxedNumber
-implements [NumberSchemaBoxed](#numberschemaboxed) - -record that stores validated Number payloads, sealed permits implementation - -### Constructor Summary -| Constructor and Description | -| --------------------------- | -| NumberSchemaBoxedNumber(Number data)
Creates an instance, private visibility | - -### Method Summary -| Modifier and Type | Method and Description | -| ----------------- | ---------------------- | -| Number | data()
validated payload | -| @Nullable Object | getData()
validated payload | - -## NumberSchemaBoxedString -public record NumberSchemaBoxedString
-implements [NumberSchemaBoxed](#numberschemaboxed) - -record that stores validated String payloads, sealed permits implementation - -### Constructor Summary -| Constructor and Description | -| --------------------------- | -| NumberSchemaBoxedString(String data)
Creates an instance, private visibility | - -### Method Summary -| Modifier and Type | Method and Description | -| ----------------- | ---------------------- | -| String | data()
validated payload | -| @Nullable Object | getData()
validated payload | - -## NumberSchemaBoxedList -public record NumberSchemaBoxedList
-implements [NumberSchemaBoxed](#numberschemaboxed) - -record that stores validated List payloads, sealed permits implementation - -### Constructor Summary -| Constructor and Description | -| --------------------------- | -| NumberSchemaBoxedList(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 | - -## NumberSchemaBoxedMap -public record NumberSchemaBoxedMap
-implements [NumberSchemaBoxed](#numberschemaboxed) - -record that stores validated Map payloads, sealed permits implementation - -### Constructor Summary -| Constructor and Description | -| --------------------------- | -| NumberSchemaBoxedMap(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 | - -## NumberSchema -public static class NumberSchema
-extends JsonSchema - -A schema class that validates payloads - -### Field Summary -| Modifier and Type | Field and Description | -| ----------------- | ---------------------- | -| String | type = "number"; | - -### Method Summary -| Modifier and Type | Method and Description | -| ----------------- | ---------------------- | -| String | validate(String arg, SchemaConfiguration configuration) | -| Nothing? | validate(Nothing? arg, SchemaConfiguration configuration) | -| int | validate(int arg, SchemaConfiguration configuration) | -| long | validate(long arg, SchemaConfiguration configuration) | -| float | validate(float arg, SchemaConfiguration configuration) | -| double | validate(double arg, SchemaConfiguration configuration) | -| Number | validate(Number arg, SchemaConfiguration configuration) | -| boolean | validate(boolean arg, SchemaConfiguration configuration) | -| FrozenMap<@Nullable Object> | validate(Map<?, ?> arg, SchemaConfiguration configuration) | -| FrozenList<@Nullable Object> | validate(List arg, SchemaConfiguration configuration) | -| [NumberSchemaBoxedString](#numberschemaboxedstring) | validateAndBox(String arg, SchemaConfiguration configuration) | -| [NumberSchemaBoxedVoid](#numberschemaboxedvoid) | validateAndBox(Nothing? arg, SchemaConfiguration configuration) | -| [NumberSchemaBoxedNumber](#numberschemaboxednumber) | validateAndBox(Number arg, SchemaConfiguration configuration) | -| [NumberSchemaBoxedBoolean](#numberschemaboxedboolean) | validateAndBox(boolean arg, SchemaConfiguration configuration) | -| [NumberSchemaBoxedMap](#numberschemaboxedmap) | validateAndBox(Map<?, ?> arg, SchemaConfiguration configuration) | -| [NumberSchemaBoxedList](#numberschemaboxedlist) | validateAndBox(List arg, SchemaConfiguration configuration) | -| [NumberSchemaBoxed](#numberschemaboxed) | validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) | -| @Nullable Object | validate(@Nullable Object arg, SchemaConfiguration configuration) | - -## DatetimeBoxed -public sealed interface DatetimeBoxed
-permits
-[DatetimeBoxedVoid](#datetimeboxedvoid), -[DatetimeBoxedBoolean](#datetimeboxedboolean), -[DatetimeBoxedNumber](#datetimeboxednumber), -[DatetimeBoxedString](#datetimeboxedstring), -[DatetimeBoxedList](#datetimeboxedlist), -[DatetimeBoxedMap](#datetimeboxedmap) - -sealed interface that stores validated payloads using boxed classes - -## DatetimeBoxedVoid -public record DatetimeBoxedVoid
-implements [DatetimeBoxed](#datetimeboxed) - -record that stores validated null payloads, sealed permits implementation - -### Constructor Summary -| Constructor and Description | -| --------------------------- | -| DatetimeBoxedVoid(Nothing? data)
Creates an instance, private visibility | - -### Method Summary -| Modifier and Type | Method and Description | -| ----------------- | ---------------------- | -| Nothing? | data()
validated payload | -| @Nullable Object | getData()
validated payload | - -## DatetimeBoxedBoolean -public record DatetimeBoxedBoolean
-implements [DatetimeBoxed](#datetimeboxed) - -record that stores validated boolean payloads, sealed permits implementation - -### Constructor Summary -| Constructor and Description | -| --------------------------- | -| DatetimeBoxedBoolean(boolean data)
Creates an instance, private visibility | - -### Method Summary -| Modifier and Type | Method and Description | -| ----------------- | ---------------------- | -| boolean | data()
validated payload | -| @Nullable Object | getData()
validated payload | - -## DatetimeBoxedNumber -public record DatetimeBoxedNumber
-implements [DatetimeBoxed](#datetimeboxed) - -record that stores validated Number payloads, sealed permits implementation - -### Constructor Summary -| Constructor and Description | -| --------------------------- | -| DatetimeBoxedNumber(Number data)
Creates an instance, private visibility | - -### Method Summary -| Modifier and Type | Method and Description | -| ----------------- | ---------------------- | -| Number | data()
validated payload | -| @Nullable Object | getData()
validated payload | - -## DatetimeBoxedString -public record DatetimeBoxedString
-implements [DatetimeBoxed](#datetimeboxed) - -record that stores validated String payloads, sealed permits implementation - -### Constructor Summary -| Constructor and Description | -| --------------------------- | -| DatetimeBoxedString(String data)
Creates an instance, private visibility | - -### Method Summary -| Modifier and Type | Method and Description | -| ----------------- | ---------------------- | -| String | data()
validated payload | -| @Nullable Object | getData()
validated payload | - -## DatetimeBoxedList -public record DatetimeBoxedList
-implements [DatetimeBoxed](#datetimeboxed) - -record that stores validated List payloads, sealed permits implementation - -### Constructor Summary -| Constructor and Description | -| --------------------------- | -| DatetimeBoxedList(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 | - -## DatetimeBoxedMap -public record DatetimeBoxedMap
-implements [DatetimeBoxed](#datetimeboxed) - -record that stores validated Map payloads, sealed permits implementation - -### Constructor Summary -| Constructor and Description | -| --------------------------- | -| DatetimeBoxedMap(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 | - -## Datetime -public static class Datetime
-extends JsonSchema - -A schema class that validates payloads - -### Field Summary -| Modifier and Type | Field and Description | -| ----------------- | ---------------------- | -| String | type = "date-time"; | - -### Method Summary -| Modifier and Type | Method and Description | -| ----------------- | ---------------------- | -| String | validate(String arg, SchemaConfiguration configuration) | -| Nothing? | validate(Nothing? arg, SchemaConfiguration configuration) | -| int | validate(int arg, SchemaConfiguration configuration) | -| long | validate(long arg, SchemaConfiguration configuration) | -| float | validate(float arg, SchemaConfiguration configuration) | -| double | validate(double arg, SchemaConfiguration configuration) | -| Number | validate(Number arg, SchemaConfiguration configuration) | -| boolean | validate(boolean arg, SchemaConfiguration configuration) | -| FrozenMap<@Nullable Object> | validate(Map<?, ?> arg, SchemaConfiguration configuration) | -| FrozenList<@Nullable Object> | validate(List arg, SchemaConfiguration configuration) | -| [DatetimeBoxedString](#datetimeboxedstring) | validateAndBox(String arg, SchemaConfiguration configuration) | -| [DatetimeBoxedVoid](#datetimeboxedvoid) | validateAndBox(Nothing? arg, SchemaConfiguration configuration) | -| [DatetimeBoxedNumber](#datetimeboxednumber) | validateAndBox(Number arg, SchemaConfiguration configuration) | -| [DatetimeBoxedBoolean](#datetimeboxedboolean) | validateAndBox(boolean arg, SchemaConfiguration configuration) | -| [DatetimeBoxedMap](#datetimeboxedmap) | validateAndBox(Map<?, ?> arg, SchemaConfiguration configuration) | -| [DatetimeBoxedList](#datetimeboxedlist) | validateAndBox(List arg, SchemaConfiguration configuration) | -| [DatetimeBoxed](#datetimeboxed) | validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) | -| @Nullable Object | validate(@Nullable Object arg, SchemaConfiguration configuration) | - -## DateBoxed -public sealed interface DateBoxed
-permits
-[DateBoxedVoid](#dateboxedvoid), -[DateBoxedBoolean](#dateboxedboolean), -[DateBoxedNumber](#dateboxednumber), -[DateBoxedString](#dateboxedstring), -[DateBoxedList](#dateboxedlist), -[DateBoxedMap](#dateboxedmap) - -sealed interface that stores validated payloads using boxed classes - -## DateBoxedVoid -public record DateBoxedVoid
-implements [DateBoxed](#dateboxed) - -record that stores validated null payloads, sealed permits implementation - -### Constructor Summary -| Constructor and Description | -| --------------------------- | -| DateBoxedVoid(Nothing? data)
Creates an instance, private visibility | - -### Method Summary -| Modifier and Type | Method and Description | -| ----------------- | ---------------------- | -| Nothing? | data()
validated payload | -| @Nullable Object | getData()
validated payload | - -## DateBoxedBoolean -public record DateBoxedBoolean
-implements [DateBoxed](#dateboxed) - -record that stores validated boolean payloads, sealed permits implementation - -### Constructor Summary -| Constructor and Description | -| --------------------------- | -| DateBoxedBoolean(boolean data)
Creates an instance, private visibility | - -### Method Summary -| Modifier and Type | Method and Description | -| ----------------- | ---------------------- | -| boolean | data()
validated payload | -| @Nullable Object | getData()
validated payload | - -## DateBoxedNumber -public record DateBoxedNumber
-implements [DateBoxed](#dateboxed) - -record that stores validated Number payloads, sealed permits implementation - -### Constructor Summary -| Constructor and Description | -| --------------------------- | -| DateBoxedNumber(Number data)
Creates an instance, private visibility | - -### Method Summary -| Modifier and Type | Method and Description | -| ----------------- | ---------------------- | -| Number | data()
validated payload | -| @Nullable Object | getData()
validated payload | - -## DateBoxedString -public record DateBoxedString
-implements [DateBoxed](#dateboxed) - -record that stores validated String payloads, sealed permits implementation - -### Constructor Summary -| Constructor and Description | -| --------------------------- | -| DateBoxedString(String data)
Creates an instance, private visibility | - -### Method Summary -| Modifier and Type | Method and Description | -| ----------------- | ---------------------- | -| String | data()
validated payload | -| @Nullable Object | getData()
validated payload | - -## DateBoxedList -public record DateBoxedList
-implements [DateBoxed](#dateboxed) - -record that stores validated List payloads, sealed permits implementation - -### Constructor Summary -| Constructor and Description | -| --------------------------- | -| DateBoxedList(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 | - -## DateBoxedMap -public record DateBoxedMap
-implements [DateBoxed](#dateboxed) - -record that stores validated Map payloads, sealed permits implementation - -### Constructor Summary -| Constructor and Description | -| --------------------------- | -| DateBoxedMap(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 | - -## Date -public static class Date
-extends JsonSchema - -A schema class that validates payloads - -### Field Summary -| Modifier and Type | Field and Description | -| ----------------- | ---------------------- | -| String | type = "date"; | - -### Method Summary -| Modifier and Type | Method and Description | -| ----------------- | ---------------------- | -| String | validate(String arg, SchemaConfiguration configuration) | -| Nothing? | validate(Nothing? arg, SchemaConfiguration configuration) | -| int | validate(int arg, SchemaConfiguration configuration) | -| long | validate(long arg, SchemaConfiguration configuration) | -| float | validate(float arg, SchemaConfiguration configuration) | -| double | validate(double arg, SchemaConfiguration configuration) | -| Number | validate(Number arg, SchemaConfiguration configuration) | -| boolean | validate(boolean arg, SchemaConfiguration configuration) | -| FrozenMap<@Nullable Object> | validate(Map<?, ?> arg, SchemaConfiguration configuration) | -| FrozenList<@Nullable Object> | validate(List arg, SchemaConfiguration configuration) | -| [DateBoxedString](#dateboxedstring) | validateAndBox(String arg, SchemaConfiguration configuration) | -| [DateBoxedVoid](#dateboxedvoid) | validateAndBox(Nothing? arg, SchemaConfiguration configuration) | -| [DateBoxedNumber](#dateboxednumber) | validateAndBox(Number arg, SchemaConfiguration configuration) | -| [DateBoxedBoolean](#dateboxedboolean) | validateAndBox(boolean arg, SchemaConfiguration configuration) | -| [DateBoxedMap](#dateboxedmap) | validateAndBox(Map<?, ?> arg, SchemaConfiguration configuration) | -| [DateBoxedList](#dateboxedlist) | validateAndBox(List arg, SchemaConfiguration configuration) | -| [DateBoxed](#dateboxed) | validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) | -| @Nullable Object | validate(@Nullable Object arg, SchemaConfiguration configuration) | - -## UuidSchemaBoxed -public sealed interface UuidSchemaBoxed
-permits
-[UuidSchemaBoxedVoid](#uuidschemaboxedvoid), -[UuidSchemaBoxedBoolean](#uuidschemaboxedboolean), -[UuidSchemaBoxedNumber](#uuidschemaboxednumber), -[UuidSchemaBoxedString](#uuidschemaboxedstring), -[UuidSchemaBoxedList](#uuidschemaboxedlist), -[UuidSchemaBoxedMap](#uuidschemaboxedmap) - -sealed interface that stores validated payloads using boxed classes - -## UuidSchemaBoxedVoid -public record UuidSchemaBoxedVoid
-implements [UuidSchemaBoxed](#uuidschemaboxed) - -record that stores validated null payloads, sealed permits implementation - -### Constructor Summary -| Constructor and Description | -| --------------------------- | -| UuidSchemaBoxedVoid(Nothing? data)
Creates an instance, private visibility | - -### Method Summary -| Modifier and Type | Method and Description | -| ----------------- | ---------------------- | -| Nothing? | data()
validated payload | -| @Nullable Object | getData()
validated payload | - -## UuidSchemaBoxedBoolean -public record UuidSchemaBoxedBoolean
-implements [UuidSchemaBoxed](#uuidschemaboxed) - -record that stores validated boolean payloads, sealed permits implementation - -### Constructor Summary -| Constructor and Description | -| --------------------------- | -| UuidSchemaBoxedBoolean(boolean data)
Creates an instance, private visibility | - -### Method Summary -| Modifier and Type | Method and Description | -| ----------------- | ---------------------- | -| boolean | data()
validated payload | -| @Nullable Object | getData()
validated payload | - -## UuidSchemaBoxedNumber -public record UuidSchemaBoxedNumber
-implements [UuidSchemaBoxed](#uuidschemaboxed) - -record that stores validated Number payloads, sealed permits implementation - -### Constructor Summary -| Constructor and Description | -| --------------------------- | -| UuidSchemaBoxedNumber(Number data)
Creates an instance, private visibility | - -### Method Summary -| Modifier and Type | Method and Description | -| ----------------- | ---------------------- | -| Number | data()
validated payload | -| @Nullable Object | getData()
validated payload | - -## UuidSchemaBoxedString -public record UuidSchemaBoxedString
-implements [UuidSchemaBoxed](#uuidschemaboxed) - -record that stores validated String payloads, sealed permits implementation - -### Constructor Summary -| Constructor and Description | -| --------------------------- | -| UuidSchemaBoxedString(String data)
Creates an instance, private visibility | - -### Method Summary -| Modifier and Type | Method and Description | -| ----------------- | ---------------------- | -| String | data()
validated payload | -| @Nullable Object | getData()
validated payload | - -## UuidSchemaBoxedList -public record UuidSchemaBoxedList
-implements [UuidSchemaBoxed](#uuidschemaboxed) - -record that stores validated List payloads, sealed permits implementation - -### Constructor Summary -| Constructor and Description | -| --------------------------- | -| UuidSchemaBoxedList(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 | - -## UuidSchemaBoxedMap -public record UuidSchemaBoxedMap
-implements [UuidSchemaBoxed](#uuidschemaboxed) - -record that stores validated Map payloads, sealed permits implementation - -### Constructor Summary -| Constructor and Description | -| --------------------------- | -| UuidSchemaBoxedMap(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 | - -## UuidSchema -public static class UuidSchema
-extends JsonSchema - -A schema class that validates payloads - -### Field Summary -| Modifier and Type | Field and Description | -| ----------------- | ---------------------- | -| String | type = "uuid"; | - -### Method Summary -| Modifier and Type | Method and Description | -| ----------------- | ---------------------- | -| String | validate(String arg, SchemaConfiguration configuration) | -| Nothing? | validate(Nothing? arg, SchemaConfiguration configuration) | -| int | validate(int arg, SchemaConfiguration configuration) | -| long | validate(long arg, SchemaConfiguration configuration) | -| float | validate(float arg, SchemaConfiguration configuration) | -| double | validate(double arg, SchemaConfiguration configuration) | -| Number | validate(Number arg, SchemaConfiguration configuration) | -| boolean | validate(boolean arg, SchemaConfiguration configuration) | -| FrozenMap<@Nullable Object> | validate(Map<?, ?> arg, SchemaConfiguration configuration) | -| FrozenList<@Nullable Object> | validate(List arg, SchemaConfiguration configuration) | -| [UuidSchemaBoxedString](#uuidschemaboxedstring) | validateAndBox(String arg, SchemaConfiguration configuration) | -| [UuidSchemaBoxedVoid](#uuidschemaboxedvoid) | validateAndBox(Nothing? arg, SchemaConfiguration configuration) | -| [UuidSchemaBoxedNumber](#uuidschemaboxednumber) | validateAndBox(Number arg, SchemaConfiguration configuration) | -| [UuidSchemaBoxedBoolean](#uuidschemaboxedboolean) | validateAndBox(boolean arg, SchemaConfiguration configuration) | -| [UuidSchemaBoxedMap](#uuidschemaboxedmap) | validateAndBox(Map<?, ?> arg, SchemaConfiguration configuration) | -| [UuidSchemaBoxedList](#uuidschemaboxedlist) | validateAndBox(List arg, SchemaConfiguration configuration) | -| [UuidSchemaBoxed](#uuidschemaboxed) | validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) | -| @Nullable Object | validate(@Nullable Object arg, SchemaConfiguration configuration) | - -[[Back to top]](#top) [[Back to Component Schemas]](../../../README.md#Component-Schemas) [[Back to README]](../../../README.md) diff --git a/samples/client/petstore/kotlin/docs/components/schemas/AnyTypeNotString.md b/samples/client/petstore/kotlin/docs/components/schemas/AnyTypeNotString.md deleted file mode 100644 index a5280b79840..00000000000 --- a/samples/client/petstore/kotlin/docs/components/schemas/AnyTypeNotString.md +++ /dev/null @@ -1,207 +0,0 @@ -# AnyTypeNotString -org.openapijsonschematools.client.components.schemas.AnyTypeNotString.java -public class AnyTypeNotString
- -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 - -## Nested Class Summary -| Modifier and Type | Class and Description | -| ----------------- | ---------------------- | -| sealed interface | [AnyTypeNotString.AnyTypeNotString1Boxed](#anytypenotstring1boxed)
sealed interface for validated payloads | -| record | [AnyTypeNotString.AnyTypeNotString1BoxedVoid](#anytypenotstring1boxedvoid)
boxed class to store validated null payloads | -| record | [AnyTypeNotString.AnyTypeNotString1BoxedBoolean](#anytypenotstring1boxedboolean)
boxed class to store validated boolean payloads | -| record | [AnyTypeNotString.AnyTypeNotString1BoxedNumber](#anytypenotstring1boxednumber)
boxed class to store validated Number payloads | -| record | [AnyTypeNotString.AnyTypeNotString1BoxedString](#anytypenotstring1boxedstring)
boxed class to store validated String payloads | -| record | [AnyTypeNotString.AnyTypeNotString1BoxedList](#anytypenotstring1boxedlist)
boxed class to store validated List payloads | -| record | [AnyTypeNotString.AnyTypeNotString1BoxedMap](#anytypenotstring1boxedmap)
boxed class to store validated Map payloads | -| static class | [AnyTypeNotString.AnyTypeNotString1](#anytypenotstring1)
schema class | -| sealed interface | [AnyTypeNotString.NotBoxed](#notboxed)
sealed interface for validated payloads | -| record | [AnyTypeNotString.NotBoxedString](#notboxedstring)
boxed class to store validated String payloads | -| static class | [AnyTypeNotString.Not](#not)
schema class | - -## AnyTypeNotString1Boxed -public sealed interface AnyTypeNotString1Boxed
-permits
-[AnyTypeNotString1BoxedVoid](#anytypenotstring1boxedvoid), -[AnyTypeNotString1BoxedBoolean](#anytypenotstring1boxedboolean), -[AnyTypeNotString1BoxedNumber](#anytypenotstring1boxednumber), -[AnyTypeNotString1BoxedString](#anytypenotstring1boxedstring), -[AnyTypeNotString1BoxedList](#anytypenotstring1boxedlist), -[AnyTypeNotString1BoxedMap](#anytypenotstring1boxedmap) - -sealed interface that stores validated payloads using boxed classes - -## AnyTypeNotString1BoxedVoid -public record AnyTypeNotString1BoxedVoid
-implements [AnyTypeNotString1Boxed](#anytypenotstring1boxed) - -record that stores validated null payloads, sealed permits implementation - -### Constructor Summary -| Constructor and Description | -| --------------------------- | -| AnyTypeNotString1BoxedVoid(Nothing? data)
Creates an instance, private visibility | - -### Method Summary -| Modifier and Type | Method and Description | -| ----------------- | ---------------------- | -| Nothing? | data()
validated payload | -| @Nullable Object | getData()
validated payload | - -## AnyTypeNotString1BoxedBoolean -public record AnyTypeNotString1BoxedBoolean
-implements [AnyTypeNotString1Boxed](#anytypenotstring1boxed) - -record that stores validated boolean payloads, sealed permits implementation - -### Constructor Summary -| Constructor and Description | -| --------------------------- | -| AnyTypeNotString1BoxedBoolean(boolean data)
Creates an instance, private visibility | - -### Method Summary -| Modifier and Type | Method and Description | -| ----------------- | ---------------------- | -| boolean | data()
validated payload | -| @Nullable Object | getData()
validated payload | - -## AnyTypeNotString1BoxedNumber -public record AnyTypeNotString1BoxedNumber
-implements [AnyTypeNotString1Boxed](#anytypenotstring1boxed) - -record that stores validated Number payloads, sealed permits implementation - -### Constructor Summary -| Constructor and Description | -| --------------------------- | -| AnyTypeNotString1BoxedNumber(Number data)
Creates an instance, private visibility | - -### Method Summary -| Modifier and Type | Method and Description | -| ----------------- | ---------------------- | -| Number | data()
validated payload | -| @Nullable Object | getData()
validated payload | - -## AnyTypeNotString1BoxedString -public record AnyTypeNotString1BoxedString
-implements [AnyTypeNotString1Boxed](#anytypenotstring1boxed) - -record that stores validated String payloads, sealed permits implementation - -### Constructor Summary -| Constructor and Description | -| --------------------------- | -| AnyTypeNotString1BoxedString(String data)
Creates an instance, private visibility | - -### Method Summary -| Modifier and Type | Method and Description | -| ----------------- | ---------------------- | -| String | data()
validated payload | -| @Nullable Object | getData()
validated payload | - -## AnyTypeNotString1BoxedList -public record AnyTypeNotString1BoxedList
-implements [AnyTypeNotString1Boxed](#anytypenotstring1boxed) - -record that stores validated List payloads, sealed permits implementation - -### Constructor Summary -| Constructor and Description | -| --------------------------- | -| AnyTypeNotString1BoxedList(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 | - -## AnyTypeNotString1BoxedMap -public record AnyTypeNotString1BoxedMap
-implements [AnyTypeNotString1Boxed](#anytypenotstring1boxed) - -record that stores validated Map payloads, sealed permits implementation - -### Constructor Summary -| Constructor and Description | -| --------------------------- | -| AnyTypeNotString1BoxedMap(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 | - -## AnyTypeNotString1 -public static class AnyTypeNotString1
-extends JsonSchema - -A schema class that validates payloads - -### Field Summary -| Modifier and Type | Field and Description | -| ----------------- | ---------------------- | -| Class | not = [Not.class](#not) | - -### Method Summary -| Modifier and Type | Method and Description | -| ----------------- | ---------------------- | -| String | validate(String arg, SchemaConfiguration configuration) | -| Nothing? | validate(Nothing? arg, SchemaConfiguration configuration) | -| int | validate(int arg, SchemaConfiguration configuration) | -| long | validate(long arg, SchemaConfiguration configuration) | -| float | validate(float arg, SchemaConfiguration configuration) | -| double | validate(double arg, SchemaConfiguration configuration) | -| Number | validate(Number arg, SchemaConfiguration configuration) | -| boolean | validate(boolean arg, SchemaConfiguration configuration) | -| FrozenMap<@Nullable Object> | validate(Map<?, ?> arg, SchemaConfiguration configuration) | -| FrozenList<@Nullable Object> | validate(List arg, SchemaConfiguration configuration) | -| [AnyTypeNotString1BoxedString](#anytypenotstring1boxedstring) | validateAndBox(String arg, SchemaConfiguration configuration) | -| [AnyTypeNotString1BoxedVoid](#anytypenotstring1boxedvoid) | validateAndBox(Nothing? arg, SchemaConfiguration configuration) | -| [AnyTypeNotString1BoxedNumber](#anytypenotstring1boxednumber) | validateAndBox(Number arg, SchemaConfiguration configuration) | -| [AnyTypeNotString1BoxedBoolean](#anytypenotstring1boxedboolean) | validateAndBox(boolean arg, SchemaConfiguration configuration) | -| [AnyTypeNotString1BoxedMap](#anytypenotstring1boxedmap) | validateAndBox(Map<?, ?> arg, SchemaConfiguration configuration) | -| [AnyTypeNotString1BoxedList](#anytypenotstring1boxedlist) | validateAndBox(List arg, SchemaConfiguration configuration) | -| [AnyTypeNotString1Boxed](#anytypenotstring1boxed) | validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) | -| @Nullable Object | validate(@Nullable Object arg, SchemaConfiguration configuration) | - -## NotBoxed -public sealed interface NotBoxed
-permits
-[NotBoxedString](#notboxedstring) - -sealed interface that stores validated payloads using boxed classes - -## NotBoxedString -public record NotBoxedString
-implements [NotBoxed](#notboxed) - -record that stores validated String payloads, sealed permits implementation - -### Constructor Summary -| Constructor and Description | -| --------------------------- | -| NotBoxedString(String data)
Creates an instance, private visibility | - -### Method Summary -| Modifier and Type | Method and Description | -| ----------------- | ---------------------- | -| String | data()
validated payload | -| @Nullable Object | getData()
validated payload | - -## Not -public static class Not
-extends StringJsonSchema.StringJsonSchema1 - -A schema class that validates payloads - -| Methods Inherited from class org.openapijsonschematools.client.schemas.StringJsonSchema.StringJsonSchema1 | -| ------------------------------------------------------------------ | -| validate | -| validateAndBox | - -[[Back to top]](#top) [[Back to Component Schemas]](../../../README.md#Component-Schemas) [[Back to README]](../../../README.md) diff --git a/samples/client/petstore/kotlin/docs/components/schemas/ApiResponseSchema.md b/samples/client/petstore/kotlin/docs/components/schemas/ApiResponseSchema.md deleted file mode 100644 index 187e5bb10bd..00000000000 --- a/samples/client/petstore/kotlin/docs/components/schemas/ApiResponseSchema.md +++ /dev/null @@ -1,254 +0,0 @@ -# ApiResponseSchema -org.openapijsonschematools.client.components.schemas.ApiResponseSchema.java -public class ApiResponseSchema
- -A class that contains necessary nested -- schema classes (which validate payloads), extends JsonSchema -- sealed interfaces which store validated payloads, java version of a sum type -- boxed classes which store validated payloads, sealed permits class implementations -- classes to store validated map payloads, extends FrozenMap -- classes to build inputs for map payloads - -## Nested Class Summary -| Modifier and Type | Class and Description | -| ----------------- | ---------------------- | -| sealed interface | [ApiResponseSchema.ApiResponseSchema1Boxed](#apiresponseschema1boxed)
sealed interface for validated payloads | -| record | [ApiResponseSchema.ApiResponseSchema1BoxedMap](#apiresponseschema1boxedmap)
boxed class to store validated Map payloads | -| static class | [ApiResponseSchema.ApiResponseSchema1](#apiresponseschema1)
schema class | -| static class | [ApiResponseSchema.ApiResponseMapBuilder](#apiresponsemapbuilder)
builder for Map payloads | -| static class | [ApiResponseSchema.ApiResponseMap](#apiresponsemap)
output class for Map payloads | -| sealed interface | [ApiResponseSchema.MessageBoxed](#messageboxed)
sealed interface for validated payloads | -| record | [ApiResponseSchema.MessageBoxedString](#messageboxedstring)
boxed class to store validated String payloads | -| static class | [ApiResponseSchema.Message](#message)
schema class | -| sealed interface | [ApiResponseSchema.TypeBoxed](#typeboxed)
sealed interface for validated payloads | -| record | [ApiResponseSchema.TypeBoxedString](#typeboxedstring)
boxed class to store validated String payloads | -| static class | [ApiResponseSchema.Type](#type)
schema class | -| sealed interface | [ApiResponseSchema.CodeBoxed](#codeboxed)
sealed interface for validated payloads | -| record | [ApiResponseSchema.CodeBoxedNumber](#codeboxednumber)
boxed class to store validated Number payloads | -| static class | [ApiResponseSchema.Code](#code)
schema class | - -## ApiResponseSchema1Boxed -public sealed interface ApiResponseSchema1Boxed
-permits
-[ApiResponseSchema1BoxedMap](#apiresponseschema1boxedmap) - -sealed interface that stores validated payloads using boxed classes - -## ApiResponseSchema1BoxedMap -public record ApiResponseSchema1BoxedMap
-implements [ApiResponseSchema1Boxed](#apiresponseschema1boxed) - -record that stores validated Map payloads, sealed permits implementation - -### Constructor Summary -| Constructor and Description | -| --------------------------- | -| ApiResponseSchema1BoxedMap([ApiResponseMap](#apiresponsemap) data)
Creates an instance, private visibility | - -### Method Summary -| Modifier and Type | Method and Description | -| ----------------- | ---------------------- | -| [ApiResponseMap](#apiresponsemap) | data()
validated payload | -| @Nullable Object | getData()
validated payload | - -## ApiResponseSchema1 -public static class ApiResponseSchema1
-extends JsonSchema - -A schema class that validates payloads - -### Code Sample -``` -import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags; -import org.openapijsonschematools.client.configurations.SchemaConfiguration; -import org.openapijsonschematools.client.exceptions.ValidationException; -import org.openapijsonschematools.client.schemas.validation.MapUtils; -import org.openapijsonschematools.client.schemas.validation.FrozenList; -import org.openapijsonschematools.client.schemas.validation.FrozenMap; -import org.openapijsonschematools.client.components.schemas.ApiResponseSchema; - -import java.util.Arrays; -import java.util.List; -import java.util.AbstractMap; - -static final SchemaConfiguration configuration = new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().build()); - -// Map validation -ApiResponseSchema.ApiResponseMap validatedPayload = - ApiResponseSchema.ApiResponseSchema1.validate( - new ApiResponseSchema.ApiResponseMapBuilder() - .code(1) - - .type("a") - - .message("a") - - .build(), - configuration -); -``` - -### Field Summary -| Modifier and Type | Field and Description | -| ----------------- | ---------------------- | -| Set> | type = Set.of(Map.class) | -| Map> | properties = Map.ofEntries(
    new PropertyEntry("code", [Code.class](#code))),
    new PropertyEntry("type", [Type.class](#type))),
    new PropertyEntry("message", [Message.class](#message)))
)
| - -### Method Summary -| Modifier and Type | Method and Description | -| ----------------- | ---------------------- | -| [ApiResponseMap](#apiresponsemap) | validate([Map<?, ?>](#apiresponsemapbuilder) arg, SchemaConfiguration configuration) | -| [ApiResponseSchema1BoxedMap](#apiresponseschema1boxedmap) | validateAndBox([Map<?, ?>](#apiresponsemapbuilder) arg, SchemaConfiguration configuration) | -| [ApiResponseSchema1Boxed](#apiresponseschema1boxed) | validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) | -| @Nullable Object | validate(@Nullable Object arg, SchemaConfiguration configuration) | - -## ApiResponseMapBuilder -public class ApiResponseMapBuilder
-builder for `Map` - -A class that builds the Map input type - -### Constructor Summary -| Constructor and Description | -| --------------------------- | -| ApiResponseMapBuilder()
Creates a builder that contains an empty map | - -### Method Summary -| Modifier and Type | Method and Description | -| ----------------- | ---------------------- | -| Map | build()
Returns map input that should be used with Schema.validate | -| [ApiResponseMapBuilder](#apiresponsemapbuilder) | code(int value) | -| [ApiResponseMapBuilder](#apiresponsemapbuilder) | code(float value) | -| [ApiResponseMapBuilder](#apiresponsemapbuilder) | type(String value) | -| [ApiResponseMapBuilder](#apiresponsemapbuilder) | message(String value) | -| [ApiResponseMapBuilder](#apiresponsemapbuilder) | additionalProperty(String key, Nothing? value) | -| [ApiResponseMapBuilder](#apiresponsemapbuilder) | additionalProperty(String key, boolean value) | -| [ApiResponseMapBuilder](#apiresponsemapbuilder) | additionalProperty(String key, String value) | -| [ApiResponseMapBuilder](#apiresponsemapbuilder) | additionalProperty(String key, int value) | -| [ApiResponseMapBuilder](#apiresponsemapbuilder) | additionalProperty(String key, float value) | -| [ApiResponseMapBuilder](#apiresponsemapbuilder) | additionalProperty(String key, long value) | -| [ApiResponseMapBuilder](#apiresponsemapbuilder) | additionalProperty(String key, double value) | -| [ApiResponseMapBuilder](#apiresponsemapbuilder) | additionalProperty(String key, List value) | -| [ApiResponseMapBuilder](#apiresponsemapbuilder) | additionalProperty(String key, Map value) | - -## ApiResponseMap -public static class ApiResponseMap
-extends FrozenMap - -A class to store validated Map payloads - -### Method Summary -| Modifier and Type | Method and Description | -| ----------------- | ---------------------- | -| static [ApiResponseMap](#apiresponsemap) | of([Map](#apiresponsemapbuilder) arg, SchemaConfiguration configuration) | -| Number | code()
[optional] value must be a 32 bit integer | -| String | type()
[optional] | -| String | message()
[optional] | -| @Nullable Object | getAdditionalProperty(String name)
provides type safety for additional properties | - -## MessageBoxed -public sealed interface MessageBoxed
-permits
-[MessageBoxedString](#messageboxedstring) - -sealed interface that stores validated payloads using boxed classes - -## MessageBoxedString -public record MessageBoxedString
-implements [MessageBoxed](#messageboxed) - -record that stores validated String payloads, sealed permits implementation - -### Constructor Summary -| Constructor and Description | -| --------------------------- | -| MessageBoxedString(String data)
Creates an instance, private visibility | - -### Method Summary -| Modifier and Type | Method and Description | -| ----------------- | ---------------------- | -| String | data()
validated payload | -| @Nullable Object | getData()
validated payload | - -## Message -public static class Message
-extends StringJsonSchema.StringJsonSchema1 - -A schema class that validates payloads - -| Methods Inherited from class org.openapijsonschematools.client.schemas.StringJsonSchema.StringJsonSchema1 | -| ------------------------------------------------------------------ | -| validate | -| validateAndBox | - -## TypeBoxed -public sealed interface TypeBoxed
-permits
-[TypeBoxedString](#typeboxedstring) - -sealed interface that stores validated payloads using boxed classes - -## TypeBoxedString -public record TypeBoxedString
-implements [TypeBoxed](#typeboxed) - -record that stores validated String payloads, sealed permits implementation - -### Constructor Summary -| Constructor and Description | -| --------------------------- | -| TypeBoxedString(String data)
Creates an instance, private visibility | - -### Method Summary -| Modifier and Type | Method and Description | -| ----------------- | ---------------------- | -| String | data()
validated payload | -| @Nullable Object | getData()
validated payload | - -## Type -public static class Type
-extends StringJsonSchema.StringJsonSchema1 - -A schema class that validates payloads - -| Methods Inherited from class org.openapijsonschematools.client.schemas.StringJsonSchema.StringJsonSchema1 | -| ------------------------------------------------------------------ | -| validate | -| validateAndBox | - -## CodeBoxed -public sealed interface CodeBoxed
-permits
-[CodeBoxedNumber](#codeboxednumber) - -sealed interface that stores validated payloads using boxed classes - -## CodeBoxedNumber -public record CodeBoxedNumber
-implements [CodeBoxed](#codeboxed) - -record that stores validated Number payloads, sealed permits implementation - -### Constructor Summary -| Constructor and Description | -| --------------------------- | -| CodeBoxedNumber(Number data)
Creates an instance, private visibility | - -### Method Summary -| Modifier and Type | Method and Description | -| ----------------- | ---------------------- | -| Number | data()
validated payload | -| @Nullable Object | getData()
validated payload | - -## Code -public static class Code
-extends Int32JsonSchema.Int32JsonSchema1 - -A schema class that validates payloads - -| Methods Inherited from class org.openapijsonschematools.client.schemas.Int32JsonSchema.Int32JsonSchema1 | -| ------------------------------------------------------------------ | -| validate | -| validateAndBox | - -[[Back to top]](#top) [[Back to Component Schemas]](../../../README.md#Component-Schemas) [[Back to README]](../../../README.md) diff --git a/samples/client/petstore/kotlin/docs/components/schemas/Apple.md b/samples/client/petstore/kotlin/docs/components/schemas/Apple.md deleted file mode 100644 index d04fad25dd0..00000000000 --- a/samples/client/petstore/kotlin/docs/components/schemas/Apple.md +++ /dev/null @@ -1,318 +0,0 @@ -# Apple -org.openapijsonschematools.client.components.schemas.Apple.java -public class Apple
- -A class that contains necessary nested -- schema classes (which validate payloads), extends JsonSchema -- sealed interfaces which store validated payloads, java version of a sum type -- boxed classes which store validated payloads, sealed permits class implementations -- classes to store validated map payloads, extends FrozenMap -- classes to build inputs for map payloads - -## Nested Class Summary -| Modifier and Type | Class and Description | -| ----------------- | ---------------------- | -| sealed interface | [Apple.Apple1Boxed](#apple1boxed)
sealed interface for validated payloads | -| record | [Apple.Apple1BoxedVoid](#apple1boxedvoid)
boxed class to store validated null payloads | -| record | [Apple.Apple1BoxedMap](#apple1boxedmap)
boxed class to store validated Map payloads | -| static class | [Apple.Apple1](#apple1)
schema class | -| static class | [Apple.AppleMapBuilder](#applemapbuilder)
builder for Map payloads | -| static class | [Apple.AppleMap](#applemap)
output class for Map payloads | -| sealed interface | [Apple.OriginBoxed](#originboxed)
sealed interface for validated payloads | -| record | [Apple.OriginBoxedString](#originboxedstring)
boxed class to store validated String payloads | -| static class | [Apple.Origin](#origin)
schema class | -| sealed interface | [Apple.CultivarBoxed](#cultivarboxed)
sealed interface for validated payloads | -| record | [Apple.CultivarBoxedString](#cultivarboxedstring)
boxed class to store validated String payloads | -| static class | [Apple.Cultivar](#cultivar)
schema class | - -## Apple1Boxed -public sealed interface Apple1Boxed
-permits
-[Apple1BoxedVoid](#apple1boxedvoid), -[Apple1BoxedMap](#apple1boxedmap) - -sealed interface that stores validated payloads using boxed classes - -## Apple1BoxedVoid -public record Apple1BoxedVoid
-implements [Apple1Boxed](#apple1boxed) - -record that stores validated null payloads, sealed permits implementation - -### Constructor Summary -| Constructor and Description | -| --------------------------- | -| Apple1BoxedVoid(Nothing? data)
Creates an instance, private visibility | - -### Method Summary -| Modifier and Type | Method and Description | -| ----------------- | ---------------------- | -| Nothing? | data()
validated payload | -| @Nullable Object | getData()
validated payload | - -## Apple1BoxedMap -public record Apple1BoxedMap
-implements [Apple1Boxed](#apple1boxed) - -record that stores validated Map payloads, sealed permits implementation - -### Constructor Summary -| Constructor and Description | -| --------------------------- | -| Apple1BoxedMap([AppleMap](#applemap) data)
Creates an instance, private visibility | - -### Method Summary -| Modifier and Type | Method and Description | -| ----------------- | ---------------------- | -| [AppleMap](#applemap) | data()
validated payload | -| @Nullable Object | getData()
validated payload | - -## Apple1 -public static class Apple1
-extends JsonSchema - -A schema class that validates payloads - -### Code Sample -``` -import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags; -import org.openapijsonschematools.client.configurations.SchemaConfiguration; -import org.openapijsonschematools.client.exceptions.ValidationException; -import org.openapijsonschematools.client.schemas.validation.MapUtils; -import org.openapijsonschematools.client.schemas.validation.FrozenList; -import org.openapijsonschematools.client.schemas.validation.FrozenMap; -import org.openapijsonschematools.client.components.schemas.Apple; - -import java.util.Arrays; -import java.util.List; -import java.util.AbstractMap; - -static final SchemaConfiguration configuration = new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().build()); - -// null validation -Nothing? validatedPayload = Apple.Apple1.validate( - (Nothing?) null, - configuration -); - -// Map validation -Apple.AppleMap validatedPayload = - Apple.Apple1.validate( - new Apple.AppleMapBuilder() - .cultivar("IaQn EaqioxT oASzjxaSH") - - .origin("IaQn EaqioxT oASzjxaSH") - - .build(), - configuration -); -``` - -### Field Summary -| Modifier and Type | Field and Description | -| ----------------- | ---------------------- | -| Set> | type = Set.of(
    Nothing?.class,
    Map.class
)
| -| Map> | properties = Map.ofEntries(
    new PropertyEntry("cultivar", [Cultivar.class](#cultivar))),
    new PropertyEntry("origin", [Origin.class](#origin)))
)
| -| Set | required = Set.of(
    "cultivar"
)
| - -### Method Summary -| Modifier and Type | Method and Description | -| ----------------- | ---------------------- | -| Nothing? | validate(Nothing? arg, SchemaConfiguration configuration) | -| [Apple1BoxedVoid](#apple1boxedvoid) | validateAndBox(Nothing? arg, SchemaConfiguration configuration) | -| [AppleMap](#applemap) | validate([Map<?, ?>](#applemapbuilder) arg, SchemaConfiguration configuration) | -| [Apple1BoxedMap](#apple1boxedmap) | validateAndBox([Map<?, ?>](#applemapbuilder) arg, SchemaConfiguration configuration) | -| [Apple1Boxed](#apple1boxed) | validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) | -| @Nullable Object | validate(@Nullable Object arg, SchemaConfiguration configuration) | - -## AppleMap0Builder -public class AppleMap0Builder
-builder for `Map` - -A class that builds the Map input type - -### Constructor Summary -| Constructor and Description | -| --------------------------- | -| AppleMap0Builder(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 | -| [AppleMap0Builder](#applemap0builder) | origin(String value) | -| [AppleMap0Builder](#applemap0builder) | additionalProperty(String key, Nothing? value) | -| [AppleMap0Builder](#applemap0builder) | additionalProperty(String key, boolean value) | -| [AppleMap0Builder](#applemap0builder) | additionalProperty(String key, String value) | -| [AppleMap0Builder](#applemap0builder) | additionalProperty(String key, int value) | -| [AppleMap0Builder](#applemap0builder) | additionalProperty(String key, float value) | -| [AppleMap0Builder](#applemap0builder) | additionalProperty(String key, long value) | -| [AppleMap0Builder](#applemap0builder) | additionalProperty(String key, double value) | -| [AppleMap0Builder](#applemap0builder) | additionalProperty(String key, List value) | -| [AppleMap0Builder](#applemap0builder) | additionalProperty(String key, Map value) | - -## AppleMapBuilder -public class AppleMapBuilder
-builder for `Map` - -A class that builds the Map input type - -### Constructor Summary -| Constructor and Description | -| --------------------------- | -| AppleMapBuilder()
Creates a builder that contains an empty map | - -### Method Summary -| Modifier and Type | Method and Description | -| ----------------- | ---------------------- | -| [AppleMap0Builder](#applemap0builder) | cultivar(String value) | - -## AppleMap -public static class AppleMap
-extends FrozenMap - -A class to store validated Map payloads - -### Method Summary -| Modifier and Type | Method and Description | -| ----------------- | ---------------------- | -| static [AppleMap](#applemap) | of([Map](#applemapbuilder) arg, SchemaConfiguration configuration) | -| String | cultivar()
| -| String | origin()
[optional] | -| @Nullable Object | getAdditionalProperty(String name)
provides type safety for additional properties | - -## OriginBoxed -public sealed interface OriginBoxed
-permits
-[OriginBoxedString](#originboxedstring) - -sealed interface that stores validated payloads using boxed classes - -## OriginBoxedString -public record OriginBoxedString
-implements [OriginBoxed](#originboxed) - -record that stores validated String payloads, sealed permits implementation - -### Constructor Summary -| Constructor and Description | -| --------------------------- | -| OriginBoxedString(String data)
Creates an instance, private visibility | - -### Method Summary -| Modifier and Type | Method and Description | -| ----------------- | ---------------------- | -| String | data()
validated payload | -| @Nullable Object | getData()
validated payload | - -## Origin -public static class Origin
-extends JsonSchema - -A schema class that validates payloads - -### Code Sample -``` -import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags; -import org.openapijsonschematools.client.configurations.SchemaConfiguration; -import org.openapijsonschematools.client.exceptions.ValidationException; -import org.openapijsonschematools.client.schemas.validation.MapUtils; -import org.openapijsonschematools.client.schemas.validation.FrozenList; -import org.openapijsonschematools.client.schemas.validation.FrozenMap; -import org.openapijsonschematools.client.components.schemas.Apple; - -import java.util.Arrays; -import java.util.List; -import java.util.AbstractMap; - -static final SchemaConfiguration configuration = new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().build()); - -// String validation -String validatedPayload = Apple.Origin.validate( - "IaQn EaqioxT oASzjxaSH", - configuration -); -``` - -### Field Summary -| Modifier and Type | Field and Description | -| ----------------- | ---------------------- | -| Set> | type = Set.of(
    String.class
)
| -| Pattern | pattern = Pattern.compile(
    "^[A-Z\\s]*$",
    Pattern.CASE_INSENSITIVE
)
| - -### Method Summary -| Modifier and Type | Method and Description | -| ----------------- | ---------------------- | -| String | validate(String arg, SchemaConfiguration configuration) | -| [OriginBoxedString](#originboxedstring) | validateAndBox(String arg, SchemaConfiguration configuration) | -| [OriginBoxed](#originboxed) | validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) | -| @Nullable Object | validate(@Nullable Object arg, SchemaConfiguration configuration) | - -## CultivarBoxed -public sealed interface CultivarBoxed
-permits
-[CultivarBoxedString](#cultivarboxedstring) - -sealed interface that stores validated payloads using boxed classes - -## CultivarBoxedString -public record CultivarBoxedString
-implements [CultivarBoxed](#cultivarboxed) - -record that stores validated String payloads, sealed permits implementation - -### Constructor Summary -| Constructor and Description | -| --------------------------- | -| CultivarBoxedString(String data)
Creates an instance, private visibility | - -### Method Summary -| Modifier and Type | Method and Description | -| ----------------- | ---------------------- | -| String | data()
validated payload | -| @Nullable Object | getData()
validated payload | - -## Cultivar -public static class Cultivar
-extends JsonSchema - -A schema class that validates payloads - -### Code Sample -``` -import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags; -import org.openapijsonschematools.client.configurations.SchemaConfiguration; -import org.openapijsonschematools.client.exceptions.ValidationException; -import org.openapijsonschematools.client.schemas.validation.MapUtils; -import org.openapijsonschematools.client.schemas.validation.FrozenList; -import org.openapijsonschematools.client.schemas.validation.FrozenMap; -import org.openapijsonschematools.client.components.schemas.Apple; - -import java.util.Arrays; -import java.util.List; -import java.util.AbstractMap; - -static final SchemaConfiguration configuration = new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().build()); - -// String validation -String validatedPayload = Apple.Cultivar.validate( - "IaQn EaqioxT oASzjxaSH", - configuration -); -``` - -### Field Summary -| Modifier and Type | Field and Description | -| ----------------- | ---------------------- | -| Set> | type = Set.of(
    String.class
)
| -| Pattern | pattern = Pattern.compile(
    "^[a-zA-Z\\s]*$"
)
| - -### Method Summary -| Modifier and Type | Method and Description | -| ----------------- | ---------------------- | -| String | validate(String arg, SchemaConfiguration configuration) | -| [CultivarBoxedString](#cultivarboxedstring) | validateAndBox(String arg, SchemaConfiguration configuration) | -| [CultivarBoxed](#cultivarboxed) | validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) | -| @Nullable Object | validate(@Nullable Object arg, SchemaConfiguration configuration) | - -[[Back to top]](#top) [[Back to Component Schemas]](../../../README.md#Component-Schemas) [[Back to README]](../../../README.md) diff --git a/samples/client/petstore/kotlin/docs/components/schemas/AppleReq.md b/samples/client/petstore/kotlin/docs/components/schemas/AppleReq.md deleted file mode 100644 index c187b6e9e08..00000000000 --- a/samples/client/petstore/kotlin/docs/components/schemas/AppleReq.md +++ /dev/null @@ -1,351 +0,0 @@ -# AppleReq -org.openapijsonschematools.client.components.schemas.AppleReq.java -public class AppleReq
- -A class that contains necessary nested -- schema classes (which validate payloads), extends JsonSchema -- sealed interfaces which store validated payloads, java version of a sum type -- boxed classes which store validated payloads, sealed permits class implementations -- classes to store validated map payloads, extends FrozenMap -- classes to build inputs for map payloads - -## Nested Class Summary -| Modifier and Type | Class and Description | -| ----------------- | ---------------------- | -| sealed interface | [AppleReq.AppleReq1Boxed](#applereq1boxed)
sealed interface for validated payloads | -| record | [AppleReq.AppleReq1BoxedMap](#applereq1boxedmap)
boxed class to store validated Map payloads | -| static class | [AppleReq.AppleReq1](#applereq1)
schema class | -| static class | [AppleReq.AppleReqMapBuilder](#applereqmapbuilder)
builder for Map payloads | -| static class | [AppleReq.AppleReqMap](#applereqmap)
output class for Map payloads | -| sealed interface | [AppleReq.MealyBoxed](#mealyboxed)
sealed interface for validated payloads | -| record | [AppleReq.MealyBoxedBoolean](#mealyboxedboolean)
boxed class to store validated boolean payloads | -| static class | [AppleReq.Mealy](#mealy)
schema class | -| sealed interface | [AppleReq.CultivarBoxed](#cultivarboxed)
sealed interface for validated payloads | -| record | [AppleReq.CultivarBoxedString](#cultivarboxedstring)
boxed class to store validated String payloads | -| static class | [AppleReq.Cultivar](#cultivar)
schema class | -| sealed interface | [AppleReq.AdditionalPropertiesBoxed](#additionalpropertiesboxed)
sealed interface for validated payloads | -| record | [AppleReq.AdditionalPropertiesBoxedVoid](#additionalpropertiesboxedvoid)
boxed class to store validated null payloads | -| record | [AppleReq.AdditionalPropertiesBoxedBoolean](#additionalpropertiesboxedboolean)
boxed class to store validated boolean payloads | -| record | [AppleReq.AdditionalPropertiesBoxedNumber](#additionalpropertiesboxednumber)
boxed class to store validated Number payloads | -| record | [AppleReq.AdditionalPropertiesBoxedString](#additionalpropertiesboxedstring)
boxed class to store validated String payloads | -| record | [AppleReq.AdditionalPropertiesBoxedList](#additionalpropertiesboxedlist)
boxed class to store validated List payloads | -| record | [AppleReq.AdditionalPropertiesBoxedMap](#additionalpropertiesboxedmap)
boxed class to store validated Map payloads | -| static class | [AppleReq.AdditionalProperties](#additionalproperties)
schema class | - -## AppleReq1Boxed -public sealed interface AppleReq1Boxed
-permits
-[AppleReq1BoxedMap](#applereq1boxedmap) - -sealed interface that stores validated payloads using boxed classes - -## AppleReq1BoxedMap -public record AppleReq1BoxedMap
-implements [AppleReq1Boxed](#applereq1boxed) - -record that stores validated Map payloads, sealed permits implementation - -### Constructor Summary -| Constructor and Description | -| --------------------------- | -| AppleReq1BoxedMap([AppleReqMap](#applereqmap) data)
Creates an instance, private visibility | - -### Method Summary -| Modifier and Type | Method and Description | -| ----------------- | ---------------------- | -| [AppleReqMap](#applereqmap) | data()
validated payload | -| @Nullable Object | getData()
validated payload | - -## AppleReq1 -public static class AppleReq1
-extends JsonSchema - -A schema class that validates payloads - -### Code Sample -``` -import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags; -import org.openapijsonschematools.client.configurations.SchemaConfiguration; -import org.openapijsonschematools.client.exceptions.ValidationException; -import org.openapijsonschematools.client.schemas.validation.MapUtils; -import org.openapijsonschematools.client.schemas.validation.FrozenList; -import org.openapijsonschematools.client.schemas.validation.FrozenMap; -import org.openapijsonschematools.client.components.schemas.AppleReq; - -import java.util.Arrays; -import java.util.List; -import java.util.AbstractMap; - -static final SchemaConfiguration configuration = new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().build()); - -// Map validation -AppleReq.AppleReqMap validatedPayload = - AppleReq.AppleReq1.validate( - new AppleReq.AppleReqMapBuilder() - .cultivar("a") - - .mealy(true) - - .build(), - configuration -); -``` - -### Field Summary -| Modifier and Type | Field and Description | -| ----------------- | ---------------------- | -| Set> | type = Set.of(Map.class) | -| Map> | properties = Map.ofEntries(
    new PropertyEntry("cultivar", [Cultivar.class](#cultivar))),
    new PropertyEntry("mealy", [Mealy.class](#mealy)))
)
| -| Set | required = Set.of(
    "cultivar"
)
| -| Class | additionalProperties = [AdditionalProperties.class](#additionalproperties) | - -### Method Summary -| Modifier and Type | Method and Description | -| ----------------- | ---------------------- | -| [AppleReqMap](#applereqmap) | validate([Map<?, ?>](#applereqmapbuilder) arg, SchemaConfiguration configuration) | -| [AppleReq1BoxedMap](#applereq1boxedmap) | validateAndBox([Map<?, ?>](#applereqmapbuilder) arg, SchemaConfiguration configuration) | -| [AppleReq1Boxed](#applereq1boxed) | validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) | -| @Nullable Object | validate(@Nullable Object arg, SchemaConfiguration configuration) | - -## AppleReqMap0Builder -public class AppleReqMap0Builder
-builder for `Map` - -A class that builds the Map input type - -### Constructor Summary -| Constructor and Description | -| --------------------------- | -| AppleReqMap0Builder(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 | -| [AppleReqMap0Builder](#applereqmap0builder) | mealy(boolean value) | - -## AppleReqMapBuilder -public class AppleReqMapBuilder
-builder for `Map` - -A class that builds the Map input type - -### Constructor Summary -| Constructor and Description | -| --------------------------- | -| AppleReqMapBuilder()
Creates a builder that contains an empty map | - -### Method Summary -| Modifier and Type | Method and Description | -| ----------------- | ---------------------- | -| [AppleReqMap0Builder](#applereqmap0builder) | cultivar(String value) | - -## AppleReqMap -public static class AppleReqMap
-extends FrozenMap - -A class to store validated Map payloads - -### Method Summary -| Modifier and Type | Method and Description | -| ----------------- | ---------------------- | -| static [AppleReqMap](#applereqmap) | of([Map](#applereqmapbuilder) arg, SchemaConfiguration configuration) | -| String | cultivar()
| -| boolean | mealy()
[optional] | - -## MealyBoxed -public sealed interface MealyBoxed
-permits
-[MealyBoxedBoolean](#mealyboxedboolean) - -sealed interface that stores validated payloads using boxed classes - -## MealyBoxedBoolean -public record MealyBoxedBoolean
-implements [MealyBoxed](#mealyboxed) - -record that stores validated boolean payloads, sealed permits implementation - -### Constructor Summary -| Constructor and Description | -| --------------------------- | -| MealyBoxedBoolean(boolean data)
Creates an instance, private visibility | - -### Method Summary -| Modifier and Type | Method and Description | -| ----------------- | ---------------------- | -| boolean | data()
validated payload | -| @Nullable Object | getData()
validated payload | - -## Mealy -public static class Mealy
-extends BooleanJsonSchema.BooleanJsonSchema1 - -A schema class that validates payloads - -| Methods Inherited from class org.openapijsonschematools.client.schemas.BooleanJsonSchema.BooleanJsonSchema1 | -| ------------------------------------------------------------------ | -| validate | -| validateAndBox | - -## CultivarBoxed -public sealed interface CultivarBoxed
-permits
-[CultivarBoxedString](#cultivarboxedstring) - -sealed interface that stores validated payloads using boxed classes - -## CultivarBoxedString -public record CultivarBoxedString
-implements [CultivarBoxed](#cultivarboxed) - -record that stores validated String payloads, sealed permits implementation - -### Constructor Summary -| Constructor and Description | -| --------------------------- | -| CultivarBoxedString(String data)
Creates an instance, private visibility | - -### Method Summary -| Modifier and Type | Method and Description | -| ----------------- | ---------------------- | -| String | data()
validated payload | -| @Nullable Object | getData()
validated payload | - -## Cultivar -public static class Cultivar
-extends StringJsonSchema.StringJsonSchema1 - -A schema class that validates payloads - -| Methods Inherited from class org.openapijsonschematools.client.schemas.StringJsonSchema.StringJsonSchema1 | -| ------------------------------------------------------------------ | -| validate | -| validateAndBox | - -## 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(Nothing? data)
Creates an instance, private visibility | - -### Method Summary -| Modifier and Type | Method and Description | -| ----------------- | ---------------------- | -| Nothing? | 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 Component Schemas]](../../../README.md#Component-Schemas) [[Back to README]](../../../README.md) diff --git a/samples/client/petstore/kotlin/docs/components/schemas/ArrayHoldingAnyType.md b/samples/client/petstore/kotlin/docs/components/schemas/ArrayHoldingAnyType.md deleted file mode 100644 index 27c27fc1930..00000000000 --- a/samples/client/petstore/kotlin/docs/components/schemas/ArrayHoldingAnyType.md +++ /dev/null @@ -1,263 +0,0 @@ -# ArrayHoldingAnyType -org.openapijsonschematools.client.components.schemas.ArrayHoldingAnyType.java -public class ArrayHoldingAnyType
- -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 list payloads, extends FrozenList -- classes to build inputs for list payloads - -## Nested Class Summary -| Modifier and Type | Class and Description | -| ----------------- | ---------------------- | -| sealed interface | [ArrayHoldingAnyType.ArrayHoldingAnyType1Boxed](#arrayholdinganytype1boxed)
sealed interface for validated payloads | -| record | [ArrayHoldingAnyType.ArrayHoldingAnyType1BoxedList](#arrayholdinganytype1boxedlist)
boxed class to store validated List payloads | -| static class | [ArrayHoldingAnyType.ArrayHoldingAnyType1](#arrayholdinganytype1)
schema class | -| static class | [ArrayHoldingAnyType.ArrayHoldingAnyTypeListBuilder](#arrayholdinganytypelistbuilder)
builder for List payloads | -| static class | [ArrayHoldingAnyType.ArrayHoldingAnyTypeList](#arrayholdinganytypelist)
output class for List payloads | -| sealed interface | [ArrayHoldingAnyType.ItemsBoxed](#itemsboxed)
sealed interface for validated payloads | -| record | [ArrayHoldingAnyType.ItemsBoxedVoid](#itemsboxedvoid)
boxed class to store validated null payloads | -| record | [ArrayHoldingAnyType.ItemsBoxedBoolean](#itemsboxedboolean)
boxed class to store validated boolean payloads | -| record | [ArrayHoldingAnyType.ItemsBoxedNumber](#itemsboxednumber)
boxed class to store validated Number payloads | -| record | [ArrayHoldingAnyType.ItemsBoxedString](#itemsboxedstring)
boxed class to store validated String payloads | -| record | [ArrayHoldingAnyType.ItemsBoxedList](#itemsboxedlist)
boxed class to store validated List payloads | -| record | [ArrayHoldingAnyType.ItemsBoxedMap](#itemsboxedmap)
boxed class to store validated Map payloads | -| static class | [ArrayHoldingAnyType.Items](#items)
schema class | - -## ArrayHoldingAnyType1Boxed -public sealed interface ArrayHoldingAnyType1Boxed
-permits
-[ArrayHoldingAnyType1BoxedList](#arrayholdinganytype1boxedlist) - -sealed interface that stores validated payloads using boxed classes - -## ArrayHoldingAnyType1BoxedList -public record ArrayHoldingAnyType1BoxedList
-implements [ArrayHoldingAnyType1Boxed](#arrayholdinganytype1boxed) - -record that stores validated List payloads, sealed permits implementation - -### Constructor Summary -| Constructor and Description | -| --------------------------- | -| ArrayHoldingAnyType1BoxedList([ArrayHoldingAnyTypeList](#arrayholdinganytypelist) data)
Creates an instance, private visibility | - -### Method Summary -| Modifier and Type | Method and Description | -| ----------------- | ---------------------- | -| [ArrayHoldingAnyTypeList](#arrayholdinganytypelist) | data()
validated payload | -| @Nullable Object | getData()
validated payload | - -## ArrayHoldingAnyType1 -public static class ArrayHoldingAnyType1
-extends JsonSchema - -A schema class that validates payloads - -### Code Sample -``` -import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags; -import org.openapijsonschematools.client.configurations.SchemaConfiguration; -import org.openapijsonschematools.client.exceptions.ValidationException; -import org.openapijsonschematools.client.schemas.validation.MapUtils; -import org.openapijsonschematools.client.schemas.validation.FrozenList; -import org.openapijsonschematools.client.schemas.validation.FrozenMap; -import org.openapijsonschematools.client.components.schemas.ArrayHoldingAnyType; - -import java.util.Arrays; -import java.util.List; -import java.util.AbstractMap; - -static final SchemaConfiguration configuration = new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().build()); - -// List validation -ArrayHoldingAnyType.ArrayHoldingAnyTypeList validatedPayload = - ArrayHoldingAnyType.ArrayHoldingAnyType1.validate( - new ArrayHoldingAnyType.ArrayHoldingAnyTypeListBuilder() - .build(), - configuration -); -``` - -### Field Summary -| Modifier and Type | Field and Description | -| ----------------- | ---------------------- | -| Set> | type = Set.of(List.class) | -| Class | items = [Items.class](#items) | - -### Method Summary -| Modifier and Type | Method and Description | -| ----------------- | ---------------------- | -| [ArrayHoldingAnyTypeList](#arrayholdinganytypelist) | validate([List](#arrayholdinganytypelistbuilder) arg, SchemaConfiguration configuration) | -| [ArrayHoldingAnyType1BoxedList](#arrayholdinganytype1boxedlist) | validateAndBox([List](#arrayholdinganytypelistbuilder) arg, SchemaConfiguration configuration) | -| [ArrayHoldingAnyType1Boxed](#arrayholdinganytype1boxed) | validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) | -| @Nullable Object | validate(@Nullable Object arg, SchemaConfiguration configuration) | - -## ArrayHoldingAnyTypeListBuilder -public class ArrayHoldingAnyTypeListBuilder
-builder for `List<@Nullable Object>` - -A class that builds the List input type - -### Constructor Summary -| Constructor and Description | -| --------------------------- | -| ArrayHoldingAnyTypeListBuilder()
Creates an empty list | -| ArrayHoldingAnyTypeListBuilder(List<@Nullable Object> items)
Stores the items in a list | - -### Method Summary -| Modifier and Type | Method and Description | -| ----------------- | ---------------------- | -| ArrayHoldingAnyTypeListBuilder | add(Nothing? item) | -| ArrayHoldingAnyTypeListBuilder | add(boolean item) | -| ArrayHoldingAnyTypeListBuilder | add(String item) | -| ArrayHoldingAnyTypeListBuilder | add(int item) | -| ArrayHoldingAnyTypeListBuilder | add(float item) | -| ArrayHoldingAnyTypeListBuilder | add(long item) | -| ArrayHoldingAnyTypeListBuilder | add(double item) | -| ArrayHoldingAnyTypeListBuilder | add(List item) | -| ArrayHoldingAnyTypeListBuilder | add(Map item) | -| List<@Nullable Object> | build()
Returns list input that should be used with Schema.validate | - -## ArrayHoldingAnyTypeList -public class ArrayHoldingAnyTypeList
-extends `FrozenList<@Nullable Object>` - -A class to store validated List payloads - -### Method Summary -| Modifier and Type | Method and Description | -| ----------------- | ---------------------- | -| static [ArrayHoldingAnyTypeList](#arrayholdinganytypelist) | of([List](#arrayholdinganytypelistbuilder) arg, SchemaConfiguration configuration) | - -## ItemsBoxed -public sealed interface ItemsBoxed
-permits
-[ItemsBoxedVoid](#itemsboxedvoid), -[ItemsBoxedBoolean](#itemsboxedboolean), -[ItemsBoxedNumber](#itemsboxednumber), -[ItemsBoxedString](#itemsboxedstring), -[ItemsBoxedList](#itemsboxedlist), -[ItemsBoxedMap](#itemsboxedmap) - -sealed interface that stores validated payloads using boxed classes - -## ItemsBoxedVoid -public record ItemsBoxedVoid
-implements [ItemsBoxed](#itemsboxed) - -record that stores validated null payloads, sealed permits implementation - -### Constructor Summary -| Constructor and Description | -| --------------------------- | -| ItemsBoxedVoid(Nothing? data)
Creates an instance, private visibility | - -### Method Summary -| Modifier and Type | Method and Description | -| ----------------- | ---------------------- | -| Nothing? | data()
validated payload | -| @Nullable Object | getData()
validated payload | - -## ItemsBoxedBoolean -public record ItemsBoxedBoolean
-implements [ItemsBoxed](#itemsboxed) - -record that stores validated boolean payloads, sealed permits implementation - -### Constructor Summary -| Constructor and Description | -| --------------------------- | -| ItemsBoxedBoolean(boolean data)
Creates an instance, private visibility | - -### Method Summary -| Modifier and Type | Method and Description | -| ----------------- | ---------------------- | -| boolean | data()
validated payload | -| @Nullable Object | getData()
validated payload | - -## ItemsBoxedNumber -public record ItemsBoxedNumber
-implements [ItemsBoxed](#itemsboxed) - -record that stores validated Number payloads, sealed permits implementation - -### Constructor Summary -| Constructor and Description | -| --------------------------- | -| ItemsBoxedNumber(Number data)
Creates an instance, private visibility | - -### Method Summary -| Modifier and Type | Method and Description | -| ----------------- | ---------------------- | -| Number | data()
validated payload | -| @Nullable Object | getData()
validated payload | - -## ItemsBoxedString -public record ItemsBoxedString
-implements [ItemsBoxed](#itemsboxed) - -record that stores validated String payloads, sealed permits implementation - -### Constructor Summary -| Constructor and Description | -| --------------------------- | -| ItemsBoxedString(String data)
Creates an instance, private visibility | - -### Method Summary -| Modifier and Type | Method and Description | -| ----------------- | ---------------------- | -| String | data()
validated payload | -| @Nullable Object | getData()
validated payload | - -## ItemsBoxedList -public record ItemsBoxedList
-implements [ItemsBoxed](#itemsboxed) - -record that stores validated List payloads, sealed permits implementation - -### Constructor Summary -| Constructor and Description | -| --------------------------- | -| ItemsBoxedList(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 | - -## ItemsBoxedMap -public record ItemsBoxedMap
-implements [ItemsBoxed](#itemsboxed) - -record that stores validated Map payloads, sealed permits implementation - -### Constructor Summary -| Constructor and Description | -| --------------------------- | -| ItemsBoxedMap(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 | - -## Items -public static class Items
-extends AnyTypeJsonSchema.AnyTypeJsonSchema1 - -A schema class that validates payloads - -## Description -any type can be stored here - -| Methods Inherited from class org.openapijsonschematools.client.schemas.AnyTypeJsonSchema.AnyTypeJsonSchema1 | -| ------------------------------------------------------------------ | -| validate | -| validateAndBox | - -[[Back to top]](#top) [[Back to Component Schemas]](../../../README.md#Component-Schemas) [[Back to README]](../../../README.md) diff --git a/samples/client/petstore/kotlin/docs/components/schemas/ArrayOfArrayOfNumberOnly.md b/samples/client/petstore/kotlin/docs/components/schemas/ArrayOfArrayOfNumberOnly.md deleted file mode 100644 index 28caa1d772e..00000000000 --- a/samples/client/petstore/kotlin/docs/components/schemas/ArrayOfArrayOfNumberOnly.md +++ /dev/null @@ -1,392 +0,0 @@ -# ArrayOfArrayOfNumberOnly -org.openapijsonschematools.client.components.schemas.ArrayOfArrayOfNumberOnly.java -public class ArrayOfArrayOfNumberOnly
- -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 list payloads, extends FrozenList -- classes to build inputs for list payloads -- classes to store validated map payloads, extends FrozenMap -- classes to build inputs for map payloads - -## Nested Class Summary -| Modifier and Type | Class and Description | -| ----------------- | ---------------------- | -| sealed interface | [ArrayOfArrayOfNumberOnly.ArrayOfArrayOfNumberOnly1Boxed](#arrayofarrayofnumberonly1boxed)
sealed interface for validated payloads | -| record | [ArrayOfArrayOfNumberOnly.ArrayOfArrayOfNumberOnly1BoxedMap](#arrayofarrayofnumberonly1boxedmap)
boxed class to store validated Map payloads | -| static class | [ArrayOfArrayOfNumberOnly.ArrayOfArrayOfNumberOnly1](#arrayofarrayofnumberonly1)
schema class | -| static class | [ArrayOfArrayOfNumberOnly.ArrayOfArrayOfNumberOnlyMapBuilder](#arrayofarrayofnumberonlymapbuilder)
builder for Map payloads | -| static class | [ArrayOfArrayOfNumberOnly.ArrayOfArrayOfNumberOnlyMap](#arrayofarrayofnumberonlymap)
output class for Map payloads | -| sealed interface | [ArrayOfArrayOfNumberOnly.ArrayArrayNumberBoxed](#arrayarraynumberboxed)
sealed interface for validated payloads | -| record | [ArrayOfArrayOfNumberOnly.ArrayArrayNumberBoxedList](#arrayarraynumberboxedlist)
boxed class to store validated List payloads | -| static class | [ArrayOfArrayOfNumberOnly.ArrayArrayNumber](#arrayarraynumber)
schema class | -| static class | [ArrayOfArrayOfNumberOnly.ArrayArrayNumberListBuilder](#arrayarraynumberlistbuilder)
builder for List payloads | -| static class | [ArrayOfArrayOfNumberOnly.ArrayArrayNumberList](#arrayarraynumberlist)
output class for List payloads | -| sealed interface | [ArrayOfArrayOfNumberOnly.ItemsBoxed](#itemsboxed)
sealed interface for validated payloads | -| record | [ArrayOfArrayOfNumberOnly.ItemsBoxedList](#itemsboxedlist)
boxed class to store validated List payloads | -| static class | [ArrayOfArrayOfNumberOnly.Items](#items)
schema class | -| static class | [ArrayOfArrayOfNumberOnly.ItemsListBuilder](#itemslistbuilder)
builder for List payloads | -| static class | [ArrayOfArrayOfNumberOnly.ItemsList](#itemslist)
output class for List payloads | -| sealed interface | [ArrayOfArrayOfNumberOnly.Items1Boxed](#items1boxed)
sealed interface for validated payloads | -| record | [ArrayOfArrayOfNumberOnly.Items1BoxedNumber](#items1boxednumber)
boxed class to store validated Number payloads | -| static class | [ArrayOfArrayOfNumberOnly.Items1](#items1)
schema class | - -## ArrayOfArrayOfNumberOnly1Boxed -public sealed interface ArrayOfArrayOfNumberOnly1Boxed
-permits
-[ArrayOfArrayOfNumberOnly1BoxedMap](#arrayofarrayofnumberonly1boxedmap) - -sealed interface that stores validated payloads using boxed classes - -## ArrayOfArrayOfNumberOnly1BoxedMap -public record ArrayOfArrayOfNumberOnly1BoxedMap
-implements [ArrayOfArrayOfNumberOnly1Boxed](#arrayofarrayofnumberonly1boxed) - -record that stores validated Map payloads, sealed permits implementation - -### Constructor Summary -| Constructor and Description | -| --------------------------- | -| ArrayOfArrayOfNumberOnly1BoxedMap([ArrayOfArrayOfNumberOnlyMap](#arrayofarrayofnumberonlymap) data)
Creates an instance, private visibility | - -### Method Summary -| Modifier and Type | Method and Description | -| ----------------- | ---------------------- | -| [ArrayOfArrayOfNumberOnlyMap](#arrayofarrayofnumberonlymap) | data()
validated payload | -| @Nullable Object | getData()
validated payload | - -## ArrayOfArrayOfNumberOnly1 -public static class ArrayOfArrayOfNumberOnly1
-extends JsonSchema - -A schema class that validates payloads - -### Code Sample -``` -import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags; -import org.openapijsonschematools.client.configurations.SchemaConfiguration; -import org.openapijsonschematools.client.exceptions.ValidationException; -import org.openapijsonschematools.client.schemas.validation.MapUtils; -import org.openapijsonschematools.client.schemas.validation.FrozenList; -import org.openapijsonschematools.client.schemas.validation.FrozenMap; -import org.openapijsonschematools.client.components.schemas.ArrayOfArrayOfNumberOnly; - -import java.util.Arrays; -import java.util.List; -import java.util.AbstractMap; - -static final SchemaConfiguration configuration = new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().build()); - -// Map validation -ArrayOfArrayOfNumberOnly.ArrayOfArrayOfNumberOnlyMap validatedPayload = - ArrayOfArrayOfNumberOnly.ArrayOfArrayOfNumberOnly1.validate( - new ArrayOfArrayOfNumberOnly.ArrayOfArrayOfNumberOnlyMapBuilder() - .ArrayArrayNumber( - Arrays.asList( - Arrays.asList( - 1 - ) - ) - ) - .build(), - configuration -); -``` - -### Field Summary -| Modifier and Type | Field and Description | -| ----------------- | ---------------------- | -| Set> | type = Set.of(Map.class) | -| Map> | properties = Map.ofEntries(
    new PropertyEntry("ArrayArrayNumber", [ArrayArrayNumber.class](#arrayarraynumber)))
)
| - -### Method Summary -| Modifier and Type | Method and Description | -| ----------------- | ---------------------- | -| [ArrayOfArrayOfNumberOnlyMap](#arrayofarrayofnumberonlymap) | validate([Map<?, ?>](#arrayofarrayofnumberonlymapbuilder) arg, SchemaConfiguration configuration) | -| [ArrayOfArrayOfNumberOnly1BoxedMap](#arrayofarrayofnumberonly1boxedmap) | validateAndBox([Map<?, ?>](#arrayofarrayofnumberonlymapbuilder) arg, SchemaConfiguration configuration) | -| [ArrayOfArrayOfNumberOnly1Boxed](#arrayofarrayofnumberonly1boxed) | validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) | -| @Nullable Object | validate(@Nullable Object arg, SchemaConfiguration configuration) | - -## ArrayOfArrayOfNumberOnlyMapBuilder -public class ArrayOfArrayOfNumberOnlyMapBuilder
-builder for `Map` - -A class that builds the Map input type - -### Constructor Summary -| Constructor and Description | -| --------------------------- | -| ArrayOfArrayOfNumberOnlyMapBuilder()
Creates a builder that contains an empty map | - -### Method Summary -| Modifier and Type | Method and Description | -| ----------------- | ---------------------- | -| Map | build()
Returns map input that should be used with Schema.validate | -| [ArrayOfArrayOfNumberOnlyMapBuilder](#arrayofarrayofnumberonlymapbuilder) | ArrayArrayNumber(List> value) | -| [ArrayOfArrayOfNumberOnlyMapBuilder](#arrayofarrayofnumberonlymapbuilder) | additionalProperty(String key, Nothing? value) | -| [ArrayOfArrayOfNumberOnlyMapBuilder](#arrayofarrayofnumberonlymapbuilder) | additionalProperty(String key, boolean value) | -| [ArrayOfArrayOfNumberOnlyMapBuilder](#arrayofarrayofnumberonlymapbuilder) | additionalProperty(String key, String value) | -| [ArrayOfArrayOfNumberOnlyMapBuilder](#arrayofarrayofnumberonlymapbuilder) | additionalProperty(String key, int value) | -| [ArrayOfArrayOfNumberOnlyMapBuilder](#arrayofarrayofnumberonlymapbuilder) | additionalProperty(String key, float value) | -| [ArrayOfArrayOfNumberOnlyMapBuilder](#arrayofarrayofnumberonlymapbuilder) | additionalProperty(String key, long value) | -| [ArrayOfArrayOfNumberOnlyMapBuilder](#arrayofarrayofnumberonlymapbuilder) | additionalProperty(String key, double value) | -| [ArrayOfArrayOfNumberOnlyMapBuilder](#arrayofarrayofnumberonlymapbuilder) | additionalProperty(String key, List value) | -| [ArrayOfArrayOfNumberOnlyMapBuilder](#arrayofarrayofnumberonlymapbuilder) | additionalProperty(String key, Map value) | - -## ArrayOfArrayOfNumberOnlyMap -public static class ArrayOfArrayOfNumberOnlyMap
-extends FrozenMap - -A class to store validated Map payloads - -### Method Summary -| Modifier and Type | Method and Description | -| ----------------- | ---------------------- | -| static [ArrayOfArrayOfNumberOnlyMap](#arrayofarrayofnumberonlymap) | of([Map](#arrayofarrayofnumberonlymapbuilder) arg, SchemaConfiguration configuration) | -| [ArrayArrayNumberList](#arrayarraynumberlist) | ArrayArrayNumber()
[optional] | -| @Nullable Object | getAdditionalProperty(String name)
provides type safety for additional properties | - -## ArrayArrayNumberBoxed -public sealed interface ArrayArrayNumberBoxed
-permits
-[ArrayArrayNumberBoxedList](#arrayarraynumberboxedlist) - -sealed interface that stores validated payloads using boxed classes - -## ArrayArrayNumberBoxedList -public record ArrayArrayNumberBoxedList
-implements [ArrayArrayNumberBoxed](#arrayarraynumberboxed) - -record that stores validated List payloads, sealed permits implementation - -### Constructor Summary -| Constructor and Description | -| --------------------------- | -| ArrayArrayNumberBoxedList([ArrayArrayNumberList](#arrayarraynumberlist) data)
Creates an instance, private visibility | - -### Method Summary -| Modifier and Type | Method and Description | -| ----------------- | ---------------------- | -| [ArrayArrayNumberList](#arrayarraynumberlist) | data()
validated payload | -| @Nullable Object | getData()
validated payload | - -## ArrayArrayNumber -public static class ArrayArrayNumber
-extends JsonSchema - -A schema class that validates payloads - -### Code Sample -``` -import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags; -import org.openapijsonschematools.client.configurations.SchemaConfiguration; -import org.openapijsonschematools.client.exceptions.ValidationException; -import org.openapijsonschematools.client.schemas.validation.MapUtils; -import org.openapijsonschematools.client.schemas.validation.FrozenList; -import org.openapijsonschematools.client.schemas.validation.FrozenMap; -import org.openapijsonschematools.client.components.schemas.ArrayOfArrayOfNumberOnly; - -import java.util.Arrays; -import java.util.List; -import java.util.AbstractMap; - -static final SchemaConfiguration configuration = new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().build()); - -// List validation -ArrayOfArrayOfNumberOnly.ArrayArrayNumberList validatedPayload = - ArrayOfArrayOfNumberOnly.ArrayArrayNumber.validate( - new ArrayOfArrayOfNumberOnly.ArrayArrayNumberListBuilder() - .add( - Arrays.asList( - 1 - ) - ) - .build(), - configuration -); -``` - -### Field Summary -| Modifier and Type | Field and Description | -| ----------------- | ---------------------- | -| Set> | type = Set.of(List.class) | -| Class | items = [Items.class](#items) | - -### Method Summary -| Modifier and Type | Method and Description | -| ----------------- | ---------------------- | -| [ArrayArrayNumberList](#arrayarraynumberlist) | validate([List](#arrayarraynumberlistbuilder) arg, SchemaConfiguration configuration) | -| [ArrayArrayNumberBoxedList](#arrayarraynumberboxedlist) | validateAndBox([List](#arrayarraynumberlistbuilder) arg, SchemaConfiguration configuration) | -| [ArrayArrayNumberBoxed](#arrayarraynumberboxed) | validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) | -| @Nullable Object | validate(@Nullable Object arg, SchemaConfiguration configuration) | - -## ArrayArrayNumberListBuilder -public class ArrayArrayNumberListBuilder
-builder for `List>` - -A class that builds the List input type - -### Constructor Summary -| Constructor and Description | -| --------------------------- | -| ArrayArrayNumberListBuilder()
Creates an empty list | -| ArrayArrayNumberListBuilder(List> items)
Stores the items in a list | - -### Method Summary -| Modifier and Type | Method and Description | -| ----------------- | ---------------------- | -| ArrayArrayNumberListBuilder | add(List item) | -| List> | build()
Returns list input that should be used with Schema.validate | - -## ArrayArrayNumberList -public class ArrayArrayNumberList
-extends `FrozenList` - -A class to store validated List payloads - -### Method Summary -| Modifier and Type | Method and Description | -| ----------------- | ---------------------- | -| static [ArrayArrayNumberList](#arrayarraynumberlist) | of([List>](#arrayarraynumberlistbuilder) arg, SchemaConfiguration configuration) | - -## ItemsBoxed -public sealed interface ItemsBoxed
-permits
-[ItemsBoxedList](#itemsboxedlist) - -sealed interface that stores validated payloads using boxed classes - -## ItemsBoxedList -public record ItemsBoxedList
-implements [ItemsBoxed](#itemsboxed) - -record that stores validated List payloads, sealed permits implementation - -### Constructor Summary -| Constructor and Description | -| --------------------------- | -| ItemsBoxedList([ItemsList](#itemslist) data)
Creates an instance, private visibility | - -### Method Summary -| Modifier and Type | Method and Description | -| ----------------- | ---------------------- | -| [ItemsList](#itemslist) | data()
validated payload | -| @Nullable Object | getData()
validated payload | - -## Items -public static class Items
-extends JsonSchema - -A schema class that validates payloads - -### Code Sample -``` -import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags; -import org.openapijsonschematools.client.configurations.SchemaConfiguration; -import org.openapijsonschematools.client.exceptions.ValidationException; -import org.openapijsonschematools.client.schemas.validation.MapUtils; -import org.openapijsonschematools.client.schemas.validation.FrozenList; -import org.openapijsonschematools.client.schemas.validation.FrozenMap; -import org.openapijsonschematools.client.components.schemas.ArrayOfArrayOfNumberOnly; - -import java.util.Arrays; -import java.util.List; -import java.util.AbstractMap; - -static final SchemaConfiguration configuration = new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().build()); - -// List validation -ArrayOfArrayOfNumberOnly.ItemsList validatedPayload = - ArrayOfArrayOfNumberOnly.Items.validate( - new ArrayOfArrayOfNumberOnly.ItemsListBuilder() - .add(1) - - .build(), - configuration -); -``` - -### Field Summary -| Modifier and Type | Field and Description | -| ----------------- | ---------------------- | -| Set> | type = Set.of(List.class) | -| Class | items = [Items1.class](#items1) | - -### Method Summary -| Modifier and Type | Method and Description | -| ----------------- | ---------------------- | -| [ItemsList](#itemslist) | validate([List](#itemslistbuilder) arg, SchemaConfiguration configuration) | -| [ItemsBoxedList](#itemsboxedlist) | validateAndBox([List](#itemslistbuilder) arg, SchemaConfiguration configuration) | -| [ItemsBoxed](#itemsboxed) | validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) | -| @Nullable Object | validate(@Nullable Object arg, SchemaConfiguration configuration) | - -## ItemsListBuilder -public class ItemsListBuilder
-builder for `List` - -A class that builds the List input type - -### Constructor Summary -| Constructor and Description | -| --------------------------- | -| ItemsListBuilder()
Creates an empty list | -| ItemsListBuilder(List items)
Stores the items in a list | - -### Method Summary -| Modifier and Type | Method and Description | -| ----------------- | ---------------------- | -| ItemsListBuilder | add(int item) | -| ItemsListBuilder | add(float item) | -| ItemsListBuilder | add(long item) | -| ItemsListBuilder | add(double item) | -| List | build()
Returns list input that should be used with Schema.validate | - -## ItemsList -public class ItemsList
-extends `FrozenList` - -A class to store validated List payloads - -### Method Summary -| Modifier and Type | Method and Description | -| ----------------- | ---------------------- | -| static [ItemsList](#itemslist) | of([List](#itemslistbuilder) arg, SchemaConfiguration configuration) | - -## Items1Boxed -public sealed interface Items1Boxed
-permits
-[Items1BoxedNumber](#items1boxednumber) - -sealed interface that stores validated payloads using boxed classes - -## Items1BoxedNumber -public record Items1BoxedNumber
-implements [Items1Boxed](#items1boxed) - -record that stores validated Number payloads, sealed permits implementation - -### Constructor Summary -| Constructor and Description | -| --------------------------- | -| Items1BoxedNumber(Number data)
Creates an instance, private visibility | - -### Method Summary -| Modifier and Type | Method and Description | -| ----------------- | ---------------------- | -| Number | data()
validated payload | -| @Nullable Object | getData()
validated payload | - -## Items1 -public static class Items1
-extends NumberJsonSchema.NumberJsonSchema1 - -A schema class that validates payloads - -| Methods Inherited from class org.openapijsonschematools.client.schemas.NumberJsonSchema.NumberJsonSchema1 | -| ------------------------------------------------------------------ | -| validate | -| validateAndBox | - -[[Back to top]](#top) [[Back to Component Schemas]](../../../README.md#Component-Schemas) [[Back to README]](../../../README.md) diff --git a/samples/client/petstore/kotlin/docs/components/schemas/ArrayOfEnums.md b/samples/client/petstore/kotlin/docs/components/schemas/ArrayOfEnums.md deleted file mode 100644 index 8ed1ba8964c..00000000000 --- a/samples/client/petstore/kotlin/docs/components/schemas/ArrayOfEnums.md +++ /dev/null @@ -1,124 +0,0 @@ -# ArrayOfEnums -org.openapijsonschematools.client.components.schemas.ArrayOfEnums.java -public class ArrayOfEnums
- -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 list payloads, extends FrozenList -- classes to build inputs for list payloads - -## Nested Class Summary -| Modifier and Type | Class and Description | -| ----------------- | ---------------------- | -| sealed interface | [ArrayOfEnums.ArrayOfEnums1Boxed](#arrayofenums1boxed)
sealed interface for validated payloads | -| record | [ArrayOfEnums.ArrayOfEnums1BoxedList](#arrayofenums1boxedlist)
boxed class to store validated List payloads | -| static class | [ArrayOfEnums.ArrayOfEnums1](#arrayofenums1)
schema class | -| static class | [ArrayOfEnums.ArrayOfEnumsListBuilder](#arrayofenumslistbuilder)
builder for List payloads | -| static class | [ArrayOfEnums.ArrayOfEnumsList](#arrayofenumslist)
output class for List payloads | - -## ArrayOfEnums1Boxed -public sealed interface ArrayOfEnums1Boxed
-permits
-[ArrayOfEnums1BoxedList](#arrayofenums1boxedlist) - -sealed interface that stores validated payloads using boxed classes - -## ArrayOfEnums1BoxedList -public record ArrayOfEnums1BoxedList
-implements [ArrayOfEnums1Boxed](#arrayofenums1boxed) - -record that stores validated List payloads, sealed permits implementation - -### Constructor Summary -| Constructor and Description | -| --------------------------- | -| ArrayOfEnums1BoxedList([ArrayOfEnumsList](#arrayofenumslist) data)
Creates an instance, private visibility | - -### Method Summary -| Modifier and Type | Method and Description | -| ----------------- | ---------------------- | -| [ArrayOfEnumsList](#arrayofenumslist) | data()
validated payload | -| @Nullable Object | getData()
validated payload | - -## ArrayOfEnums1 -public static class ArrayOfEnums1
-extends JsonSchema - -A schema class that validates payloads - -### Code Sample -``` -import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags; -import org.openapijsonschematools.client.configurations.SchemaConfiguration; -import org.openapijsonschematools.client.exceptions.ValidationException; -import org.openapijsonschematools.client.schemas.validation.MapUtils; -import org.openapijsonschematools.client.schemas.validation.FrozenList; -import org.openapijsonschematools.client.schemas.validation.FrozenMap; -import org.openapijsonschematools.client.components.schemas.ArrayOfEnums; - -import java.util.Arrays; -import java.util.List; -import java.util.AbstractMap; - -static final SchemaConfiguration configuration = new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().build()); - -// List validation -ArrayOfEnums.ArrayOfEnumsList validatedPayload = - ArrayOfEnums.ArrayOfEnums1.validate( - new ArrayOfEnums.ArrayOfEnumsListBuilder() - .add((Nothing?) null) - - .build(), - configuration -); -``` - -### Field Summary -| Modifier and Type | Field and Description | -| ----------------- | ---------------------- | -| Set> | type = Set.of(List.class) | -| Class | items = [StringEnum.StringEnum1.class](../../components/schemas/StringEnum.md#stringenum1) | - -### Method Summary -| Modifier and Type | Method and Description | -| ----------------- | ---------------------- | -| [ArrayOfEnumsList](#arrayofenumslist) | validate([List](#arrayofenumslistbuilder) arg, SchemaConfiguration configuration) | -| [ArrayOfEnums1BoxedList](#arrayofenums1boxedlist) | validateAndBox([List](#arrayofenumslistbuilder) arg, SchemaConfiguration configuration) | -| [ArrayOfEnums1Boxed](#arrayofenums1boxed) | validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) | -| @Nullable Object | validate(@Nullable Object arg, SchemaConfiguration configuration) | - -## ArrayOfEnumsListBuilder -public class ArrayOfEnumsListBuilder
-builder for `List<@Nullable String>` - -A class that builds the List input type - -### Constructor Summary -| Constructor and Description | -| --------------------------- | -| ArrayOfEnumsListBuilder()
Creates an empty list | -| ArrayOfEnumsListBuilder(List<@Nullable String> items)
Stores the items in a list | - -### Method Summary -| Modifier and Type | Method and Description | -| ----------------- | ---------------------- | -| ArrayOfEnumsListBuilder | add(Nothing? item) | -| ArrayOfEnumsListBuilder | add(String item) | -| ArrayOfEnumsListBuilder | add([StringEnum.StringStringEnumEnums](../../components/schemas/StringEnum.md#stringstringenumenums) item) | -| ArrayOfEnumsListBuilder | add([StringEnum.NullStringEnumEnums](../../components/schemas/StringEnum.md#nullstringenumenums) item) | -| List<@Nullable String> | build()
Returns list input that should be used with Schema.validate | - -## ArrayOfEnumsList -public class ArrayOfEnumsList
-extends `FrozenList<@Nullable String>` - -A class to store validated List payloads - -### Method Summary -| Modifier and Type | Method and Description | -| ----------------- | ---------------------- | -| static [ArrayOfEnumsList](#arrayofenumslist) | of([List](#arrayofenumslistbuilder) arg, SchemaConfiguration configuration) | - -[[Back to top]](#top) [[Back to Component Schemas]](../../../README.md#Component-Schemas) [[Back to README]](../../../README.md) diff --git a/samples/client/petstore/kotlin/docs/components/schemas/ArrayOfNumberOnly.md b/samples/client/petstore/kotlin/docs/components/schemas/ArrayOfNumberOnly.md deleted file mode 100644 index a434e5d291d..00000000000 --- a/samples/client/petstore/kotlin/docs/components/schemas/ArrayOfNumberOnly.md +++ /dev/null @@ -1,282 +0,0 @@ -# ArrayOfNumberOnly -org.openapijsonschematools.client.components.schemas.ArrayOfNumberOnly.java -public class ArrayOfNumberOnly
- -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 list payloads, extends FrozenList -- classes to build inputs for list payloads -- classes to store validated map payloads, extends FrozenMap -- classes to build inputs for map payloads - -## Nested Class Summary -| Modifier and Type | Class and Description | -| ----------------- | ---------------------- | -| sealed interface | [ArrayOfNumberOnly.ArrayOfNumberOnly1Boxed](#arrayofnumberonly1boxed)
sealed interface for validated payloads | -| record | [ArrayOfNumberOnly.ArrayOfNumberOnly1BoxedMap](#arrayofnumberonly1boxedmap)
boxed class to store validated Map payloads | -| static class | [ArrayOfNumberOnly.ArrayOfNumberOnly1](#arrayofnumberonly1)
schema class | -| static class | [ArrayOfNumberOnly.ArrayOfNumberOnlyMapBuilder](#arrayofnumberonlymapbuilder)
builder for Map payloads | -| static class | [ArrayOfNumberOnly.ArrayOfNumberOnlyMap](#arrayofnumberonlymap)
output class for Map payloads | -| sealed interface | [ArrayOfNumberOnly.ArrayNumberBoxed](#arraynumberboxed)
sealed interface for validated payloads | -| record | [ArrayOfNumberOnly.ArrayNumberBoxedList](#arraynumberboxedlist)
boxed class to store validated List payloads | -| static class | [ArrayOfNumberOnly.ArrayNumber](#arraynumber)
schema class | -| static class | [ArrayOfNumberOnly.ArrayNumberListBuilder](#arraynumberlistbuilder)
builder for List payloads | -| static class | [ArrayOfNumberOnly.ArrayNumberList](#arraynumberlist)
output class for List payloads | -| sealed interface | [ArrayOfNumberOnly.ItemsBoxed](#itemsboxed)
sealed interface for validated payloads | -| record | [ArrayOfNumberOnly.ItemsBoxedNumber](#itemsboxednumber)
boxed class to store validated Number payloads | -| static class | [ArrayOfNumberOnly.Items](#items)
schema class | - -## ArrayOfNumberOnly1Boxed -public sealed interface ArrayOfNumberOnly1Boxed
-permits
-[ArrayOfNumberOnly1BoxedMap](#arrayofnumberonly1boxedmap) - -sealed interface that stores validated payloads using boxed classes - -## ArrayOfNumberOnly1BoxedMap -public record ArrayOfNumberOnly1BoxedMap
-implements [ArrayOfNumberOnly1Boxed](#arrayofnumberonly1boxed) - -record that stores validated Map payloads, sealed permits implementation - -### Constructor Summary -| Constructor and Description | -| --------------------------- | -| ArrayOfNumberOnly1BoxedMap([ArrayOfNumberOnlyMap](#arrayofnumberonlymap) data)
Creates an instance, private visibility | - -### Method Summary -| Modifier and Type | Method and Description | -| ----------------- | ---------------------- | -| [ArrayOfNumberOnlyMap](#arrayofnumberonlymap) | data()
validated payload | -| @Nullable Object | getData()
validated payload | - -## ArrayOfNumberOnly1 -public static class ArrayOfNumberOnly1
-extends JsonSchema - -A schema class that validates payloads - -### Code Sample -``` -import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags; -import org.openapijsonschematools.client.configurations.SchemaConfiguration; -import org.openapijsonschematools.client.exceptions.ValidationException; -import org.openapijsonschematools.client.schemas.validation.MapUtils; -import org.openapijsonschematools.client.schemas.validation.FrozenList; -import org.openapijsonschematools.client.schemas.validation.FrozenMap; -import org.openapijsonschematools.client.components.schemas.ArrayOfNumberOnly; - -import java.util.Arrays; -import java.util.List; -import java.util.AbstractMap; - -static final SchemaConfiguration configuration = new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().build()); - -// Map validation -ArrayOfNumberOnly.ArrayOfNumberOnlyMap validatedPayload = - ArrayOfNumberOnly.ArrayOfNumberOnly1.validate( - new ArrayOfNumberOnly.ArrayOfNumberOnlyMapBuilder() - .ArrayNumber( - Arrays.asList( - 1 - ) - ) - .build(), - configuration -); -``` - -### Field Summary -| Modifier and Type | Field and Description | -| ----------------- | ---------------------- | -| Set> | type = Set.of(Map.class) | -| Map> | properties = Map.ofEntries(
    new PropertyEntry("ArrayNumber", [ArrayNumber.class](#arraynumber)))
)
| - -### Method Summary -| Modifier and Type | Method and Description | -| ----------------- | ---------------------- | -| [ArrayOfNumberOnlyMap](#arrayofnumberonlymap) | validate([Map<?, ?>](#arrayofnumberonlymapbuilder) arg, SchemaConfiguration configuration) | -| [ArrayOfNumberOnly1BoxedMap](#arrayofnumberonly1boxedmap) | validateAndBox([Map<?, ?>](#arrayofnumberonlymapbuilder) arg, SchemaConfiguration configuration) | -| [ArrayOfNumberOnly1Boxed](#arrayofnumberonly1boxed) | validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) | -| @Nullable Object | validate(@Nullable Object arg, SchemaConfiguration configuration) | - -## ArrayOfNumberOnlyMapBuilder -public class ArrayOfNumberOnlyMapBuilder
-builder for `Map` - -A class that builds the Map input type - -### Constructor Summary -| Constructor and Description | -| --------------------------- | -| ArrayOfNumberOnlyMapBuilder()
Creates a builder that contains an empty map | - -### Method Summary -| Modifier and Type | Method and Description | -| ----------------- | ---------------------- | -| Map | build()
Returns map input that should be used with Schema.validate | -| [ArrayOfNumberOnlyMapBuilder](#arrayofnumberonlymapbuilder) | ArrayNumber(List value) | -| [ArrayOfNumberOnlyMapBuilder](#arrayofnumberonlymapbuilder) | additionalProperty(String key, Nothing? value) | -| [ArrayOfNumberOnlyMapBuilder](#arrayofnumberonlymapbuilder) | additionalProperty(String key, boolean value) | -| [ArrayOfNumberOnlyMapBuilder](#arrayofnumberonlymapbuilder) | additionalProperty(String key, String value) | -| [ArrayOfNumberOnlyMapBuilder](#arrayofnumberonlymapbuilder) | additionalProperty(String key, int value) | -| [ArrayOfNumberOnlyMapBuilder](#arrayofnumberonlymapbuilder) | additionalProperty(String key, float value) | -| [ArrayOfNumberOnlyMapBuilder](#arrayofnumberonlymapbuilder) | additionalProperty(String key, long value) | -| [ArrayOfNumberOnlyMapBuilder](#arrayofnumberonlymapbuilder) | additionalProperty(String key, double value) | -| [ArrayOfNumberOnlyMapBuilder](#arrayofnumberonlymapbuilder) | additionalProperty(String key, List value) | -| [ArrayOfNumberOnlyMapBuilder](#arrayofnumberonlymapbuilder) | additionalProperty(String key, Map value) | - -## ArrayOfNumberOnlyMap -public static class ArrayOfNumberOnlyMap
-extends FrozenMap - -A class to store validated Map payloads - -### Method Summary -| Modifier and Type | Method and Description | -| ----------------- | ---------------------- | -| static [ArrayOfNumberOnlyMap](#arrayofnumberonlymap) | of([Map](#arrayofnumberonlymapbuilder) arg, SchemaConfiguration configuration) | -| [ArrayNumberList](#arraynumberlist) | ArrayNumber()
[optional] | -| @Nullable Object | getAdditionalProperty(String name)
provides type safety for additional properties | - -## ArrayNumberBoxed -public sealed interface ArrayNumberBoxed
-permits
-[ArrayNumberBoxedList](#arraynumberboxedlist) - -sealed interface that stores validated payloads using boxed classes - -## ArrayNumberBoxedList -public record ArrayNumberBoxedList
-implements [ArrayNumberBoxed](#arraynumberboxed) - -record that stores validated List payloads, sealed permits implementation - -### Constructor Summary -| Constructor and Description | -| --------------------------- | -| ArrayNumberBoxedList([ArrayNumberList](#arraynumberlist) data)
Creates an instance, private visibility | - -### Method Summary -| Modifier and Type | Method and Description | -| ----------------- | ---------------------- | -| [ArrayNumberList](#arraynumberlist) | data()
validated payload | -| @Nullable Object | getData()
validated payload | - -## ArrayNumber -public static class ArrayNumber
-extends JsonSchema - -A schema class that validates payloads - -### Code Sample -``` -import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags; -import org.openapijsonschematools.client.configurations.SchemaConfiguration; -import org.openapijsonschematools.client.exceptions.ValidationException; -import org.openapijsonschematools.client.schemas.validation.MapUtils; -import org.openapijsonschematools.client.schemas.validation.FrozenList; -import org.openapijsonschematools.client.schemas.validation.FrozenMap; -import org.openapijsonschematools.client.components.schemas.ArrayOfNumberOnly; - -import java.util.Arrays; -import java.util.List; -import java.util.AbstractMap; - -static final SchemaConfiguration configuration = new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().build()); - -// List validation -ArrayOfNumberOnly.ArrayNumberList validatedPayload = - ArrayOfNumberOnly.ArrayNumber.validate( - new ArrayOfNumberOnly.ArrayNumberListBuilder() - .add(1) - - .build(), - configuration -); -``` - -### Field Summary -| Modifier and Type | Field and Description | -| ----------------- | ---------------------- | -| Set> | type = Set.of(List.class) | -| Class | items = [Items.class](#items) | - -### Method Summary -| Modifier and Type | Method and Description | -| ----------------- | ---------------------- | -| [ArrayNumberList](#arraynumberlist) | validate([List](#arraynumberlistbuilder) arg, SchemaConfiguration configuration) | -| [ArrayNumberBoxedList](#arraynumberboxedlist) | validateAndBox([List](#arraynumberlistbuilder) arg, SchemaConfiguration configuration) | -| [ArrayNumberBoxed](#arraynumberboxed) | validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) | -| @Nullable Object | validate(@Nullable Object arg, SchemaConfiguration configuration) | - -## ArrayNumberListBuilder -public class ArrayNumberListBuilder
-builder for `List` - -A class that builds the List input type - -### Constructor Summary -| Constructor and Description | -| --------------------------- | -| ArrayNumberListBuilder()
Creates an empty list | -| ArrayNumberListBuilder(List items)
Stores the items in a list | - -### Method Summary -| Modifier and Type | Method and Description | -| ----------------- | ---------------------- | -| ArrayNumberListBuilder | add(int item) | -| ArrayNumberListBuilder | add(float item) | -| ArrayNumberListBuilder | add(long item) | -| ArrayNumberListBuilder | add(double item) | -| List | build()
Returns list input that should be used with Schema.validate | - -## ArrayNumberList -public class ArrayNumberList
-extends `FrozenList` - -A class to store validated List payloads - -### Method Summary -| Modifier and Type | Method and Description | -| ----------------- | ---------------------- | -| static [ArrayNumberList](#arraynumberlist) | of([List](#arraynumberlistbuilder) arg, SchemaConfiguration configuration) | - -## ItemsBoxed -public sealed interface ItemsBoxed
-permits
-[ItemsBoxedNumber](#itemsboxednumber) - -sealed interface that stores validated payloads using boxed classes - -## ItemsBoxedNumber -public record ItemsBoxedNumber
-implements [ItemsBoxed](#itemsboxed) - -record that stores validated Number payloads, sealed permits implementation - -### Constructor Summary -| Constructor and Description | -| --------------------------- | -| ItemsBoxedNumber(Number data)
Creates an instance, private visibility | - -### Method Summary -| Modifier and Type | Method and Description | -| ----------------- | ---------------------- | -| Number | data()
validated payload | -| @Nullable Object | getData()
validated payload | - -## Items -public static class Items
-extends NumberJsonSchema.NumberJsonSchema1 - -A schema class that validates payloads - -| Methods Inherited from class org.openapijsonschematools.client.schemas.NumberJsonSchema.NumberJsonSchema1 | -| ------------------------------------------------------------------ | -| validate | -| validateAndBox | - -[[Back to top]](#top) [[Back to Component Schemas]](../../../README.md#Component-Schemas) [[Back to README]](../../../README.md) diff --git a/samples/client/petstore/kotlin/docs/components/schemas/ArrayTest.md b/samples/client/petstore/kotlin/docs/components/schemas/ArrayTest.md deleted file mode 100644 index 85ebfd0365a..00000000000 --- a/samples/client/petstore/kotlin/docs/components/schemas/ArrayTest.md +++ /dev/null @@ -1,792 +0,0 @@ -# ArrayTest -org.openapijsonschematools.client.components.schemas.ArrayTest.java -public class ArrayTest
- -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 list payloads, extends FrozenList -- classes to build inputs for list payloads -- classes to store validated map payloads, extends FrozenMap -- classes to build inputs for map payloads - -## Nested Class Summary -| Modifier and Type | Class and Description | -| ----------------- | ---------------------- | -| sealed interface | [ArrayTest.ArrayTest1Boxed](#arraytest1boxed)
sealed interface for validated payloads | -| record | [ArrayTest.ArrayTest1BoxedMap](#arraytest1boxedmap)
boxed class to store validated Map payloads | -| static class | [ArrayTest.ArrayTest1](#arraytest1)
schema class | -| static class | [ArrayTest.ArrayTestMapBuilder](#arraytestmapbuilder)
builder for Map payloads | -| static class | [ArrayTest.ArrayTestMap](#arraytestmap)
output class for Map payloads | -| sealed interface | [ArrayTest.ArrayArrayOfModelBoxed](#arrayarrayofmodelboxed)
sealed interface for validated payloads | -| record | [ArrayTest.ArrayArrayOfModelBoxedList](#arrayarrayofmodelboxedlist)
boxed class to store validated List payloads | -| static class | [ArrayTest.ArrayArrayOfModel](#arrayarrayofmodel)
schema class | -| static class | [ArrayTest.ArrayArrayOfModelListBuilder](#arrayarrayofmodellistbuilder)
builder for List payloads | -| static class | [ArrayTest.ArrayArrayOfModelList](#arrayarrayofmodellist)
output class for List payloads | -| sealed interface | [ArrayTest.Items3Boxed](#items3boxed)
sealed interface for validated payloads | -| record | [ArrayTest.Items3BoxedList](#items3boxedlist)
boxed class to store validated List payloads | -| static class | [ArrayTest.Items3](#items3)
schema class | -| static class | [ArrayTest.ItemsListBuilder1](#itemslistbuilder1)
builder for List payloads | -| static class | [ArrayTest.ItemsList1](#itemslist1)
output class for List payloads | -| sealed interface | [ArrayTest.ArrayArrayOfIntegerBoxed](#arrayarrayofintegerboxed)
sealed interface for validated payloads | -| record | [ArrayTest.ArrayArrayOfIntegerBoxedList](#arrayarrayofintegerboxedlist)
boxed class to store validated List payloads | -| static class | [ArrayTest.ArrayArrayOfInteger](#arrayarrayofinteger)
schema class | -| static class | [ArrayTest.ArrayArrayOfIntegerListBuilder](#arrayarrayofintegerlistbuilder)
builder for List payloads | -| static class | [ArrayTest.ArrayArrayOfIntegerList](#arrayarrayofintegerlist)
output class for List payloads | -| sealed interface | [ArrayTest.Items1Boxed](#items1boxed)
sealed interface for validated payloads | -| record | [ArrayTest.Items1BoxedList](#items1boxedlist)
boxed class to store validated List payloads | -| static class | [ArrayTest.Items1](#items1)
schema class | -| static class | [ArrayTest.ItemsListBuilder](#itemslistbuilder)
builder for List payloads | -| static class | [ArrayTest.ItemsList](#itemslist)
output class for List payloads | -| sealed interface | [ArrayTest.Items2Boxed](#items2boxed)
sealed interface for validated payloads | -| record | [ArrayTest.Items2BoxedNumber](#items2boxednumber)
boxed class to store validated Number payloads | -| static class | [ArrayTest.Items2](#items2)
schema class | -| sealed interface | [ArrayTest.ArrayOfStringBoxed](#arrayofstringboxed)
sealed interface for validated payloads | -| record | [ArrayTest.ArrayOfStringBoxedList](#arrayofstringboxedlist)
boxed class to store validated List payloads | -| static class | [ArrayTest.ArrayOfString](#arrayofstring)
schema class | -| static class | [ArrayTest.ArrayOfStringListBuilder](#arrayofstringlistbuilder)
builder for List payloads | -| static class | [ArrayTest.ArrayOfStringList](#arrayofstringlist)
output class for List payloads | -| sealed interface | [ArrayTest.ItemsBoxed](#itemsboxed)
sealed interface for validated payloads | -| record | [ArrayTest.ItemsBoxedString](#itemsboxedstring)
boxed class to store validated String payloads | -| static class | [ArrayTest.Items](#items)
schema class | - -## ArrayTest1Boxed -public sealed interface ArrayTest1Boxed
-permits
-[ArrayTest1BoxedMap](#arraytest1boxedmap) - -sealed interface that stores validated payloads using boxed classes - -## ArrayTest1BoxedMap -public record ArrayTest1BoxedMap
-implements [ArrayTest1Boxed](#arraytest1boxed) - -record that stores validated Map payloads, sealed permits implementation - -### Constructor Summary -| Constructor and Description | -| --------------------------- | -| ArrayTest1BoxedMap([ArrayTestMap](#arraytestmap) data)
Creates an instance, private visibility | - -### Method Summary -| Modifier and Type | Method and Description | -| ----------------- | ---------------------- | -| [ArrayTestMap](#arraytestmap) | data()
validated payload | -| @Nullable Object | getData()
validated payload | - -## ArrayTest1 -public static class ArrayTest1
-extends JsonSchema - -A schema class that validates payloads - -### Code Sample -``` -import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags; -import org.openapijsonschematools.client.configurations.SchemaConfiguration; -import org.openapijsonschematools.client.exceptions.ValidationException; -import org.openapijsonschematools.client.schemas.validation.MapUtils; -import org.openapijsonschematools.client.schemas.validation.FrozenList; -import org.openapijsonschematools.client.schemas.validation.FrozenMap; -import org.openapijsonschematools.client.components.schemas.ArrayTest; - -import java.util.Arrays; -import java.util.List; -import java.util.AbstractMap; - -static final SchemaConfiguration configuration = new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().build()); - -// Map validation -ArrayTest.ArrayTestMap validatedPayload = - ArrayTest.ArrayTest1.validate( - new ArrayTest.ArrayTestMapBuilder() - .array_of_string( - Arrays.asList( - "a" - ) - ) - .array_array_of_integer( - Arrays.asList( - Arrays.asList( - 1L - ) - ) - ) - .array_array_of_model( - Arrays.asList( - Arrays.asList( - MapUtils.makeMap( - new AbstractMap.SimpleEntry( - "bar", - "a" - ), - new AbstractMap.SimpleEntry( - "baz", - "a" - ) - ) - ) - ) - ) - .build(), - configuration -); -``` - -### Field Summary -| Modifier and Type | Field and Description | -| ----------------- | ---------------------- | -| Set> | type = Set.of(Map.class) | -| Map> | properties = Map.ofEntries(
    new PropertyEntry("array_of_string", [ArrayOfString.class](#arrayofstring))),
    new PropertyEntry("array_array_of_integer", [ArrayArrayOfInteger.class](#arrayarrayofinteger))),
    new PropertyEntry("array_array_of_model", [ArrayArrayOfModel.class](#arrayarrayofmodel)))
)
| - -### Method Summary -| Modifier and Type | Method and Description | -| ----------------- | ---------------------- | -| [ArrayTestMap](#arraytestmap) | validate([Map<?, ?>](#arraytestmapbuilder) arg, SchemaConfiguration configuration) | -| [ArrayTest1BoxedMap](#arraytest1boxedmap) | validateAndBox([Map<?, ?>](#arraytestmapbuilder) arg, SchemaConfiguration configuration) | -| [ArrayTest1Boxed](#arraytest1boxed) | validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) | -| @Nullable Object | validate(@Nullable Object arg, SchemaConfiguration configuration) | - -## ArrayTestMapBuilder -public class ArrayTestMapBuilder
-builder for `Map` - -A class that builds the Map input type - -### Constructor Summary -| Constructor and Description | -| --------------------------- | -| ArrayTestMapBuilder()
Creates a builder that contains an empty map | - -### Method Summary -| Modifier and Type | Method and Description | -| ----------------- | ---------------------- | -| Map | build()
Returns map input that should be used with Schema.validate | -| [ArrayTestMapBuilder](#arraytestmapbuilder) | array_of_string(List value) | -| [ArrayTestMapBuilder](#arraytestmapbuilder) | array_array_of_integer(List> value) | -| [ArrayTestMapBuilder](#arraytestmapbuilder) | array_array_of_model(List>> value) | -| [ArrayTestMapBuilder](#arraytestmapbuilder) | additionalProperty(String key, Nothing? value) | -| [ArrayTestMapBuilder](#arraytestmapbuilder) | additionalProperty(String key, boolean value) | -| [ArrayTestMapBuilder](#arraytestmapbuilder) | additionalProperty(String key, String value) | -| [ArrayTestMapBuilder](#arraytestmapbuilder) | additionalProperty(String key, int value) | -| [ArrayTestMapBuilder](#arraytestmapbuilder) | additionalProperty(String key, float value) | -| [ArrayTestMapBuilder](#arraytestmapbuilder) | additionalProperty(String key, long value) | -| [ArrayTestMapBuilder](#arraytestmapbuilder) | additionalProperty(String key, double value) | -| [ArrayTestMapBuilder](#arraytestmapbuilder) | additionalProperty(String key, List value) | -| [ArrayTestMapBuilder](#arraytestmapbuilder) | additionalProperty(String key, Map value) | - -## ArrayTestMap -public static class ArrayTestMap
-extends FrozenMap - -A class to store validated Map payloads - -### Method Summary -| Modifier and Type | Method and Description | -| ----------------- | ---------------------- | -| static [ArrayTestMap](#arraytestmap) | of([Map](#arraytestmapbuilder) arg, SchemaConfiguration configuration) | -| [ArrayOfStringList](#arrayofstringlist) | array_of_string()
[optional] | -| [ArrayArrayOfIntegerList](#arrayarrayofintegerlist) | array_array_of_integer()
[optional] | -| [ArrayArrayOfModelList](#arrayarrayofmodellist) | array_array_of_model()
[optional] | -| @Nullable Object | getAdditionalProperty(String name)
provides type safety for additional properties | - -## ArrayArrayOfModelBoxed -public sealed interface ArrayArrayOfModelBoxed
-permits
-[ArrayArrayOfModelBoxedList](#arrayarrayofmodelboxedlist) - -sealed interface that stores validated payloads using boxed classes - -## ArrayArrayOfModelBoxedList -public record ArrayArrayOfModelBoxedList
-implements [ArrayArrayOfModelBoxed](#arrayarrayofmodelboxed) - -record that stores validated List payloads, sealed permits implementation - -### Constructor Summary -| Constructor and Description | -| --------------------------- | -| ArrayArrayOfModelBoxedList([ArrayArrayOfModelList](#arrayarrayofmodellist) data)
Creates an instance, private visibility | - -### Method Summary -| Modifier and Type | Method and Description | -| ----------------- | ---------------------- | -| [ArrayArrayOfModelList](#arrayarrayofmodellist) | data()
validated payload | -| @Nullable Object | getData()
validated payload | - -## ArrayArrayOfModel -public static class ArrayArrayOfModel
-extends JsonSchema - -A schema class that validates payloads - -### Code Sample -``` -import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags; -import org.openapijsonschematools.client.configurations.SchemaConfiguration; -import org.openapijsonschematools.client.exceptions.ValidationException; -import org.openapijsonschematools.client.schemas.validation.MapUtils; -import org.openapijsonschematools.client.schemas.validation.FrozenList; -import org.openapijsonschematools.client.schemas.validation.FrozenMap; -import org.openapijsonschematools.client.components.schemas.ArrayTest; - -import java.util.Arrays; -import java.util.List; -import java.util.AbstractMap; - -static final SchemaConfiguration configuration = new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().build()); - -// List validation -ArrayTest.ArrayArrayOfModelList validatedPayload = - ArrayTest.ArrayArrayOfModel.validate( - new ArrayTest.ArrayArrayOfModelListBuilder() - .add( - Arrays.asList( - MapUtils.makeMap( - new AbstractMap.SimpleEntry( - "bar", - "a" - ), - new AbstractMap.SimpleEntry( - "baz", - "a" - ) - ) - ) - ) - .build(), - configuration -); -``` - -### Field Summary -| Modifier and Type | Field and Description | -| ----------------- | ---------------------- | -| Set> | type = Set.of(List.class) | -| Class | items = [Items3.class](#items3) | - -### Method Summary -| Modifier and Type | Method and Description | -| ----------------- | ---------------------- | -| [ArrayArrayOfModelList](#arrayarrayofmodellist) | validate([List](#arrayarrayofmodellistbuilder) arg, SchemaConfiguration configuration) | -| [ArrayArrayOfModelBoxedList](#arrayarrayofmodelboxedlist) | validateAndBox([List](#arrayarrayofmodellistbuilder) arg, SchemaConfiguration configuration) | -| [ArrayArrayOfModelBoxed](#arrayarrayofmodelboxed) | validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) | -| @Nullable Object | validate(@Nullable Object arg, SchemaConfiguration configuration) | - -## ArrayArrayOfModelListBuilder -public class ArrayArrayOfModelListBuilder
-builder for `List>>` - -A class that builds the List input type - -### Constructor Summary -| Constructor and Description | -| --------------------------- | -| ArrayArrayOfModelListBuilder()
Creates an empty list | -| ArrayArrayOfModelListBuilder(List>> items)
Stores the items in a list | - -### Method Summary -| Modifier and Type | Method and Description | -| ----------------- | ---------------------- | -| ArrayArrayOfModelListBuilder | add(List> item) | -| List>> | build()
Returns list input that should be used with Schema.validate | - -## ArrayArrayOfModelList -public class ArrayArrayOfModelList
-extends `FrozenList` - -A class to store validated List payloads - -### Method Summary -| Modifier and Type | Method and Description | -| ----------------- | ---------------------- | -| static [ArrayArrayOfModelList](#arrayarrayofmodellist) | of([List>>](#arrayarrayofmodellistbuilder) arg, SchemaConfiguration configuration) | - -## Items3Boxed -public sealed interface Items3Boxed
-permits
-[Items3BoxedList](#items3boxedlist) - -sealed interface that stores validated payloads using boxed classes - -## Items3BoxedList -public record Items3BoxedList
-implements [Items3Boxed](#items3boxed) - -record that stores validated List payloads, sealed permits implementation - -### Constructor Summary -| Constructor and Description | -| --------------------------- | -| Items3BoxedList([ItemsList1](#itemslist1) data)
Creates an instance, private visibility | - -### Method Summary -| Modifier and Type | Method and Description | -| ----------------- | ---------------------- | -| [ItemsList1](#itemslist1) | data()
validated payload | -| @Nullable Object | getData()
validated payload | - -## Items3 -public static class Items3
-extends JsonSchema - -A schema class that validates payloads - -### Code Sample -``` -import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags; -import org.openapijsonschematools.client.configurations.SchemaConfiguration; -import org.openapijsonschematools.client.exceptions.ValidationException; -import org.openapijsonschematools.client.schemas.validation.MapUtils; -import org.openapijsonschematools.client.schemas.validation.FrozenList; -import org.openapijsonschematools.client.schemas.validation.FrozenMap; -import org.openapijsonschematools.client.components.schemas.ArrayTest; - -import java.util.Arrays; -import java.util.List; -import java.util.AbstractMap; - -static final SchemaConfiguration configuration = new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().build()); - -// List validation -ArrayTest.ItemsList1 validatedPayload = - ArrayTest.Items3.validate( - new ArrayTest.ItemsListBuilder1() - .add( - MapUtils.makeMap( - new AbstractMap.SimpleEntry( - "bar", - "a" - ), - new AbstractMap.SimpleEntry( - "baz", - "a" - ) - ) - ) - .build(), - configuration -); -``` - -### Field Summary -| Modifier and Type | Field and Description | -| ----------------- | ---------------------- | -| Set> | type = Set.of(List.class) | -| Class | items = [ReadOnlyFirst.ReadOnlyFirst1.class](../../components/schemas/ReadOnlyFirst.md#readonlyfirst1) | - -### Method Summary -| Modifier and Type | Method and Description | -| ----------------- | ---------------------- | -| [ItemsList1](#itemslist1) | validate([List](#itemslistbuilder1) arg, SchemaConfiguration configuration) | -| [Items3BoxedList](#items3boxedlist) | validateAndBox([List](#itemslistbuilder1) arg, SchemaConfiguration configuration) | -| [Items3Boxed](#items3boxed) | validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) | -| @Nullable Object | validate(@Nullable Object arg, SchemaConfiguration configuration) | - -## ItemsListBuilder1 -public class ItemsListBuilder1
-builder for `List>` - -A class that builds the List input type - -### Constructor Summary -| Constructor and Description | -| --------------------------- | -| ItemsListBuilder1()
Creates an empty list | -| ItemsListBuilder1(List> items)
Stores the items in a list | - -### Method Summary -| Modifier and Type | Method and Description | -| ----------------- | ---------------------- | -| ItemsListBuilder1 | add(Map item) | -| List> | build()
Returns list input that should be used with Schema.validate | - -## ItemsList1 -public class ItemsList1
-extends `FrozenList` - -A class to store validated List payloads - -### Method Summary -| Modifier and Type | Method and Description | -| ----------------- | ---------------------- | -| static [ItemsList1](#itemslist1) | of([List>](#itemslistbuilder1) arg, SchemaConfiguration configuration) | - -## ArrayArrayOfIntegerBoxed -public sealed interface ArrayArrayOfIntegerBoxed
-permits
-[ArrayArrayOfIntegerBoxedList](#arrayarrayofintegerboxedlist) - -sealed interface that stores validated payloads using boxed classes - -## ArrayArrayOfIntegerBoxedList -public record ArrayArrayOfIntegerBoxedList
-implements [ArrayArrayOfIntegerBoxed](#arrayarrayofintegerboxed) - -record that stores validated List payloads, sealed permits implementation - -### Constructor Summary -| Constructor and Description | -| --------------------------- | -| ArrayArrayOfIntegerBoxedList([ArrayArrayOfIntegerList](#arrayarrayofintegerlist) data)
Creates an instance, private visibility | - -### Method Summary -| Modifier and Type | Method and Description | -| ----------------- | ---------------------- | -| [ArrayArrayOfIntegerList](#arrayarrayofintegerlist) | data()
validated payload | -| @Nullable Object | getData()
validated payload | - -## ArrayArrayOfInteger -public static class ArrayArrayOfInteger
-extends JsonSchema - -A schema class that validates payloads - -### Code Sample -``` -import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags; -import org.openapijsonschematools.client.configurations.SchemaConfiguration; -import org.openapijsonschematools.client.exceptions.ValidationException; -import org.openapijsonschematools.client.schemas.validation.MapUtils; -import org.openapijsonschematools.client.schemas.validation.FrozenList; -import org.openapijsonschematools.client.schemas.validation.FrozenMap; -import org.openapijsonschematools.client.components.schemas.ArrayTest; - -import java.util.Arrays; -import java.util.List; -import java.util.AbstractMap; - -static final SchemaConfiguration configuration = new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().build()); - -// List validation -ArrayTest.ArrayArrayOfIntegerList validatedPayload = - ArrayTest.ArrayArrayOfInteger.validate( - new ArrayTest.ArrayArrayOfIntegerListBuilder() - .add( - Arrays.asList( - 1L - ) - ) - .build(), - configuration -); -``` - -### Field Summary -| Modifier and Type | Field and Description | -| ----------------- | ---------------------- | -| Set> | type = Set.of(List.class) | -| Class | items = [Items1.class](#items1) | - -### Method Summary -| Modifier and Type | Method and Description | -| ----------------- | ---------------------- | -| [ArrayArrayOfIntegerList](#arrayarrayofintegerlist) | validate([List](#arrayarrayofintegerlistbuilder) arg, SchemaConfiguration configuration) | -| [ArrayArrayOfIntegerBoxedList](#arrayarrayofintegerboxedlist) | validateAndBox([List](#arrayarrayofintegerlistbuilder) arg, SchemaConfiguration configuration) | -| [ArrayArrayOfIntegerBoxed](#arrayarrayofintegerboxed) | validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) | -| @Nullable Object | validate(@Nullable Object arg, SchemaConfiguration configuration) | - -## ArrayArrayOfIntegerListBuilder -public class ArrayArrayOfIntegerListBuilder
-builder for `List>` - -A class that builds the List input type - -### Constructor Summary -| Constructor and Description | -| --------------------------- | -| ArrayArrayOfIntegerListBuilder()
Creates an empty list | -| ArrayArrayOfIntegerListBuilder(List> items)
Stores the items in a list | - -### Method Summary -| Modifier and Type | Method and Description | -| ----------------- | ---------------------- | -| ArrayArrayOfIntegerListBuilder | add(List item) | -| List> | build()
Returns list input that should be used with Schema.validate | - -## ArrayArrayOfIntegerList -public class ArrayArrayOfIntegerList
-extends `FrozenList` - -A class to store validated List payloads - -### Method Summary -| Modifier and Type | Method and Description | -| ----------------- | ---------------------- | -| static [ArrayArrayOfIntegerList](#arrayarrayofintegerlist) | of([List>](#arrayarrayofintegerlistbuilder) arg, SchemaConfiguration configuration) | - -## Items1Boxed -public sealed interface Items1Boxed
-permits
-[Items1BoxedList](#items1boxedlist) - -sealed interface that stores validated payloads using boxed classes - -## Items1BoxedList -public record Items1BoxedList
-implements [Items1Boxed](#items1boxed) - -record that stores validated List payloads, sealed permits implementation - -### Constructor Summary -| Constructor and Description | -| --------------------------- | -| Items1BoxedList([ItemsList](#itemslist) data)
Creates an instance, private visibility | - -### Method Summary -| Modifier and Type | Method and Description | -| ----------------- | ---------------------- | -| [ItemsList](#itemslist) | data()
validated payload | -| @Nullable Object | getData()
validated payload | - -## Items1 -public static class Items1
-extends JsonSchema - -A schema class that validates payloads - -### Code Sample -``` -import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags; -import org.openapijsonschematools.client.configurations.SchemaConfiguration; -import org.openapijsonschematools.client.exceptions.ValidationException; -import org.openapijsonschematools.client.schemas.validation.MapUtils; -import org.openapijsonschematools.client.schemas.validation.FrozenList; -import org.openapijsonschematools.client.schemas.validation.FrozenMap; -import org.openapijsonschematools.client.components.schemas.ArrayTest; - -import java.util.Arrays; -import java.util.List; -import java.util.AbstractMap; - -static final SchemaConfiguration configuration = new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().build()); - -// List validation -ArrayTest.ItemsList validatedPayload = - ArrayTest.Items1.validate( - new ArrayTest.ItemsListBuilder() - .add(1L) - - .build(), - configuration -); -``` - -### Field Summary -| Modifier and Type | Field and Description | -| ----------------- | ---------------------- | -| Set> | type = Set.of(List.class) | -| Class | items = [Items2.class](#items2) | - -### Method Summary -| Modifier and Type | Method and Description | -| ----------------- | ---------------------- | -| [ItemsList](#itemslist) | validate([List](#itemslistbuilder) arg, SchemaConfiguration configuration) | -| [Items1BoxedList](#items1boxedlist) | validateAndBox([List](#itemslistbuilder) arg, SchemaConfiguration configuration) | -| [Items1Boxed](#items1boxed) | validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) | -| @Nullable Object | validate(@Nullable Object arg, SchemaConfiguration configuration) | - -## ItemsListBuilder -public class ItemsListBuilder
-builder for `List` - -A class that builds the List input type - -### Constructor Summary -| Constructor and Description | -| --------------------------- | -| ItemsListBuilder()
Creates an empty list | -| ItemsListBuilder(List items)
Stores the items in a list | - -### Method Summary -| Modifier and Type | Method and Description | -| ----------------- | ---------------------- | -| ItemsListBuilder | add(int item) | -| ItemsListBuilder | add(float item) | -| ItemsListBuilder | add(long item) | -| ItemsListBuilder | add(double item) | -| List | build()
Returns list input that should be used with Schema.validate | - -## ItemsList -public class ItemsList
-extends `FrozenList` - -A class to store validated List payloads - -### Method Summary -| Modifier and Type | Method and Description | -| ----------------- | ---------------------- | -| static [ItemsList](#itemslist) | of([List](#itemslistbuilder) arg, SchemaConfiguration configuration) | - -## Items2Boxed -public sealed interface Items2Boxed
-permits
-[Items2BoxedNumber](#items2boxednumber) - -sealed interface that stores validated payloads using boxed classes - -## Items2BoxedNumber -public record Items2BoxedNumber
-implements [Items2Boxed](#items2boxed) - -record that stores validated Number payloads, sealed permits implementation - -### Constructor Summary -| Constructor and Description | -| --------------------------- | -| Items2BoxedNumber(Number data)
Creates an instance, private visibility | - -### Method Summary -| Modifier and Type | Method and Description | -| ----------------- | ---------------------- | -| Number | data()
validated payload | -| @Nullable Object | getData()
validated payload | - -## Items2 -public static class Items2
-extends Int64JsonSchema.Int64JsonSchema1 - -A schema class that validates payloads - -| Methods Inherited from class org.openapijsonschematools.client.schemas.Int64JsonSchema.Int64JsonSchema1 | -| ------------------------------------------------------------------ | -| validate | -| validateAndBox | - -## ArrayOfStringBoxed -public sealed interface ArrayOfStringBoxed
-permits
-[ArrayOfStringBoxedList](#arrayofstringboxedlist) - -sealed interface that stores validated payloads using boxed classes - -## ArrayOfStringBoxedList -public record ArrayOfStringBoxedList
-implements [ArrayOfStringBoxed](#arrayofstringboxed) - -record that stores validated List payloads, sealed permits implementation - -### Constructor Summary -| Constructor and Description | -| --------------------------- | -| ArrayOfStringBoxedList([ArrayOfStringList](#arrayofstringlist) data)
Creates an instance, private visibility | - -### Method Summary -| Modifier and Type | Method and Description | -| ----------------- | ---------------------- | -| [ArrayOfStringList](#arrayofstringlist) | data()
validated payload | -| @Nullable Object | getData()
validated payload | - -## ArrayOfString -public static class ArrayOfString
-extends JsonSchema - -A schema class that validates payloads - -### Code Sample -``` -import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags; -import org.openapijsonschematools.client.configurations.SchemaConfiguration; -import org.openapijsonschematools.client.exceptions.ValidationException; -import org.openapijsonschematools.client.schemas.validation.MapUtils; -import org.openapijsonschematools.client.schemas.validation.FrozenList; -import org.openapijsonschematools.client.schemas.validation.FrozenMap; -import org.openapijsonschematools.client.components.schemas.ArrayTest; - -import java.util.Arrays; -import java.util.List; -import java.util.AbstractMap; - -static final SchemaConfiguration configuration = new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().build()); - -// List validation -ArrayTest.ArrayOfStringList validatedPayload = - ArrayTest.ArrayOfString.validate( - new ArrayTest.ArrayOfStringListBuilder() - .add("a") - - .build(), - configuration -); -``` - -### Field Summary -| Modifier and Type | Field and Description | -| ----------------- | ---------------------- | -| Set> | type = Set.of(List.class) | -| Class | items = [Items.class](#items) | - -### Method Summary -| Modifier and Type | Method and Description | -| ----------------- | ---------------------- | -| [ArrayOfStringList](#arrayofstringlist) | validate([List](#arrayofstringlistbuilder) arg, SchemaConfiguration configuration) | -| [ArrayOfStringBoxedList](#arrayofstringboxedlist) | validateAndBox([List](#arrayofstringlistbuilder) arg, SchemaConfiguration configuration) | -| [ArrayOfStringBoxed](#arrayofstringboxed) | validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) | -| @Nullable Object | validate(@Nullable Object arg, SchemaConfiguration configuration) | - -## ArrayOfStringListBuilder -public class ArrayOfStringListBuilder
-builder for `List` - -A class that builds the List input type - -### Constructor Summary -| Constructor and Description | -| --------------------------- | -| ArrayOfStringListBuilder()
Creates an empty list | -| ArrayOfStringListBuilder(List items)
Stores the items in a list | - -### Method Summary -| Modifier and Type | Method and Description | -| ----------------- | ---------------------- | -| ArrayOfStringListBuilder | add(String item) | -| List | build()
Returns list input that should be used with Schema.validate | - -## ArrayOfStringList -public class ArrayOfStringList
-extends `FrozenList` - -A class to store validated List payloads - -### Method Summary -| Modifier and Type | Method and Description | -| ----------------- | ---------------------- | -| static [ArrayOfStringList](#arrayofstringlist) | of([List](#arrayofstringlistbuilder) arg, SchemaConfiguration configuration) | - -## ItemsBoxed -public sealed interface ItemsBoxed
-permits
-[ItemsBoxedString](#itemsboxedstring) - -sealed interface that stores validated payloads using boxed classes - -## ItemsBoxedString -public record ItemsBoxedString
-implements [ItemsBoxed](#itemsboxed) - -record that stores validated String payloads, sealed permits implementation - -### Constructor Summary -| Constructor and Description | -| --------------------------- | -| ItemsBoxedString(String data)
Creates an instance, private visibility | - -### Method Summary -| Modifier and Type | Method and Description | -| ----------------- | ---------------------- | -| String | data()
validated payload | -| @Nullable Object | getData()
validated payload | - -## Items -public static class Items
-extends StringJsonSchema.StringJsonSchema1 - -A schema class that validates payloads - -| Methods Inherited from class org.openapijsonschematools.client.schemas.StringJsonSchema.StringJsonSchema1 | -| ------------------------------------------------------------------ | -| validate | -| validateAndBox | - -[[Back to top]](#top) [[Back to Component Schemas]](../../../README.md#Component-Schemas) [[Back to README]](../../../README.md) diff --git a/samples/client/petstore/kotlin/docs/components/schemas/ArrayWithValidationsInItems.md b/samples/client/petstore/kotlin/docs/components/schemas/ArrayWithValidationsInItems.md deleted file mode 100644 index e2fc8ff7610..00000000000 --- a/samples/client/petstore/kotlin/docs/components/schemas/ArrayWithValidationsInItems.md +++ /dev/null @@ -1,196 +0,0 @@ -# ArrayWithValidationsInItems -org.openapijsonschematools.client.components.schemas.ArrayWithValidationsInItems.java -public class ArrayWithValidationsInItems
- -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 list payloads, extends FrozenList -- classes to build inputs for list payloads - -## Nested Class Summary -| Modifier and Type | Class and Description | -| ----------------- | ---------------------- | -| sealed interface | [ArrayWithValidationsInItems.ArrayWithValidationsInItems1Boxed](#arraywithvalidationsinitems1boxed)
sealed interface for validated payloads | -| record | [ArrayWithValidationsInItems.ArrayWithValidationsInItems1BoxedList](#arraywithvalidationsinitems1boxedlist)
boxed class to store validated List payloads | -| static class | [ArrayWithValidationsInItems.ArrayWithValidationsInItems1](#arraywithvalidationsinitems1)
schema class | -| static class | [ArrayWithValidationsInItems.ArrayWithValidationsInItemsListBuilder](#arraywithvalidationsinitemslistbuilder)
builder for List payloads | -| static class | [ArrayWithValidationsInItems.ArrayWithValidationsInItemsList](#arraywithvalidationsinitemslist)
output class for List payloads | -| sealed interface | [ArrayWithValidationsInItems.ItemsBoxed](#itemsboxed)
sealed interface for validated payloads | -| record | [ArrayWithValidationsInItems.ItemsBoxedNumber](#itemsboxednumber)
boxed class to store validated Number payloads | -| static class | [ArrayWithValidationsInItems.Items](#items)
schema class | - -## ArrayWithValidationsInItems1Boxed -public sealed interface ArrayWithValidationsInItems1Boxed
-permits
-[ArrayWithValidationsInItems1BoxedList](#arraywithvalidationsinitems1boxedlist) - -sealed interface that stores validated payloads using boxed classes - -## ArrayWithValidationsInItems1BoxedList -public record ArrayWithValidationsInItems1BoxedList
-implements [ArrayWithValidationsInItems1Boxed](#arraywithvalidationsinitems1boxed) - -record that stores validated List payloads, sealed permits implementation - -### Constructor Summary -| Constructor and Description | -| --------------------------- | -| ArrayWithValidationsInItems1BoxedList([ArrayWithValidationsInItemsList](#arraywithvalidationsinitemslist) data)
Creates an instance, private visibility | - -### Method Summary -| Modifier and Type | Method and Description | -| ----------------- | ---------------------- | -| [ArrayWithValidationsInItemsList](#arraywithvalidationsinitemslist) | data()
validated payload | -| @Nullable Object | getData()
validated payload | - -## ArrayWithValidationsInItems1 -public static class ArrayWithValidationsInItems1
-extends JsonSchema - -A schema class that validates payloads - -### Code Sample -``` -import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags; -import org.openapijsonschematools.client.configurations.SchemaConfiguration; -import org.openapijsonschematools.client.exceptions.ValidationException; -import org.openapijsonschematools.client.schemas.validation.MapUtils; -import org.openapijsonschematools.client.schemas.validation.FrozenList; -import org.openapijsonschematools.client.schemas.validation.FrozenMap; -import org.openapijsonschematools.client.components.schemas.ArrayWithValidationsInItems; - -import java.util.Arrays; -import java.util.List; -import java.util.AbstractMap; - -static final SchemaConfiguration configuration = new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().build()); - -// List validation -ArrayWithValidationsInItems.ArrayWithValidationsInItemsList validatedPayload = - ArrayWithValidationsInItems.ArrayWithValidationsInItems1.validate( - new ArrayWithValidationsInItems.ArrayWithValidationsInItemsListBuilder() - .add(1L) - - .build(), - configuration -); -``` - -### Field Summary -| Modifier and Type | Field and Description | -| ----------------- | ---------------------- | -| Set> | type = Set.of(List.class) | -| Class | items = [Items.class](#items) | -| Integer | maxItems = 2 | - -### Method Summary -| Modifier and Type | Method and Description | -| ----------------- | ---------------------- | -| [ArrayWithValidationsInItemsList](#arraywithvalidationsinitemslist) | validate([List](#arraywithvalidationsinitemslistbuilder) arg, SchemaConfiguration configuration) | -| [ArrayWithValidationsInItems1BoxedList](#arraywithvalidationsinitems1boxedlist) | validateAndBox([List](#arraywithvalidationsinitemslistbuilder) arg, SchemaConfiguration configuration) | -| [ArrayWithValidationsInItems1Boxed](#arraywithvalidationsinitems1boxed) | validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) | -| @Nullable Object | validate(@Nullable Object arg, SchemaConfiguration configuration) | - -## ArrayWithValidationsInItemsListBuilder -public class ArrayWithValidationsInItemsListBuilder
-builder for `List` - -A class that builds the List input type - -### Constructor Summary -| Constructor and Description | -| --------------------------- | -| ArrayWithValidationsInItemsListBuilder()
Creates an empty list | -| ArrayWithValidationsInItemsListBuilder(List items)
Stores the items in a list | - -### Method Summary -| Modifier and Type | Method and Description | -| ----------------- | ---------------------- | -| ArrayWithValidationsInItemsListBuilder | add(int item) | -| ArrayWithValidationsInItemsListBuilder | add(float item) | -| ArrayWithValidationsInItemsListBuilder | add(long item) | -| ArrayWithValidationsInItemsListBuilder | add(double item) | -| List | build()
Returns list input that should be used with Schema.validate | - -## ArrayWithValidationsInItemsList -public class ArrayWithValidationsInItemsList
-extends `FrozenList` - -A class to store validated List payloads - -### Method Summary -| Modifier and Type | Method and Description | -| ----------------- | ---------------------- | -| static [ArrayWithValidationsInItemsList](#arraywithvalidationsinitemslist) | of([List](#arraywithvalidationsinitemslistbuilder) arg, SchemaConfiguration configuration) | - -## ItemsBoxed -public sealed interface ItemsBoxed
-permits
-[ItemsBoxedNumber](#itemsboxednumber) - -sealed interface that stores validated payloads using boxed classes - -## ItemsBoxedNumber -public record ItemsBoxedNumber
-implements [ItemsBoxed](#itemsboxed) - -record that stores validated Number payloads, sealed permits implementation - -### Constructor Summary -| Constructor and Description | -| --------------------------- | -| ItemsBoxedNumber(Number data)
Creates an instance, private visibility | - -### Method Summary -| Modifier and Type | Method and Description | -| ----------------- | ---------------------- | -| Number | data()
validated payload | -| @Nullable Object | getData()
validated payload | - -## Items -public static class Items
-extends JsonSchema - -A schema class that validates payloads - -### Code Sample -``` -import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags; -import org.openapijsonschematools.client.configurations.SchemaConfiguration; -import org.openapijsonschematools.client.exceptions.ValidationException; -import org.openapijsonschematools.client.schemas.validation.MapUtils; -import org.openapijsonschematools.client.schemas.validation.FrozenList; -import org.openapijsonschematools.client.schemas.validation.FrozenMap; -import org.openapijsonschematools.client.components.schemas.ArrayWithValidationsInItems; - -import java.util.Arrays; -import java.util.List; -import java.util.AbstractMap; - -static final SchemaConfiguration configuration = new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().build()); - -// long validation -long validatedPayload = ArrayWithValidationsInItems.Items.validate( - 1L, - configuration -); -``` - -### Field Summary -| Modifier and Type | Field and Description | -| ----------------- | ---------------------- | -| Set> | type = Set.of(
    Integer.class,
    Long.class,
    Float.class,
    Double.class
)
| -| String | type = "int64"; | -| Number | maximum = 7 | - -### Method Summary -| Modifier and Type | Method and Description | -| ----------------- | ---------------------- | -| long | validate(long arg, SchemaConfiguration configuration) | -| [ItemsBoxedNumber](#itemsboxednumber) | validateAndBox(Number arg, SchemaConfiguration configuration) | -| [ItemsBoxed](#itemsboxed) | validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) | -| @Nullable Object | validate(@Nullable Object arg, SchemaConfiguration configuration) | - -[[Back to top]](#top) [[Back to Component Schemas]](../../../README.md#Component-Schemas) [[Back to README]](../../../README.md) diff --git a/samples/client/petstore/kotlin/docs/components/schemas/Banana.md b/samples/client/petstore/kotlin/docs/components/schemas/Banana.md deleted file mode 100644 index e953bef7d68..00000000000 --- a/samples/client/petstore/kotlin/docs/components/schemas/Banana.md +++ /dev/null @@ -1,188 +0,0 @@ -# Banana -org.openapijsonschematools.client.components.schemas.Banana.java -public class Banana
- -A class that contains necessary nested -- schema classes (which validate payloads), extends JsonSchema -- sealed interfaces which store validated payloads, java version of a sum type -- boxed classes which store validated payloads, sealed permits class implementations -- classes to store validated map payloads, extends FrozenMap -- classes to build inputs for map payloads - -## Nested Class Summary -| Modifier and Type | Class and Description | -| ----------------- | ---------------------- | -| sealed interface | [Banana.Banana1Boxed](#banana1boxed)
sealed interface for validated payloads | -| record | [Banana.Banana1BoxedMap](#banana1boxedmap)
boxed class to store validated Map payloads | -| static class | [Banana.Banana1](#banana1)
schema class | -| static class | [Banana.BananaMapBuilder](#bananamapbuilder)
builder for Map payloads | -| static class | [Banana.BananaMap](#bananamap)
output class for Map payloads | -| sealed interface | [Banana.LengthCmBoxed](#lengthcmboxed)
sealed interface for validated payloads | -| record | [Banana.LengthCmBoxedNumber](#lengthcmboxednumber)
boxed class to store validated Number payloads | -| static class | [Banana.LengthCm](#lengthcm)
schema class | - -## Banana1Boxed -public sealed interface Banana1Boxed
-permits
-[Banana1BoxedMap](#banana1boxedmap) - -sealed interface that stores validated payloads using boxed classes - -## Banana1BoxedMap -public record Banana1BoxedMap
-implements [Banana1Boxed](#banana1boxed) - -record that stores validated Map payloads, sealed permits implementation - -### Constructor Summary -| Constructor and Description | -| --------------------------- | -| Banana1BoxedMap([BananaMap](#bananamap) data)
Creates an instance, private visibility | - -### Method Summary -| Modifier and Type | Method and Description | -| ----------------- | ---------------------- | -| [BananaMap](#bananamap) | data()
validated payload | -| @Nullable Object | getData()
validated payload | - -## Banana1 -public static class Banana1
-extends JsonSchema - -A schema class that validates payloads - -### Code Sample -``` -import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags; -import org.openapijsonschematools.client.configurations.SchemaConfiguration; -import org.openapijsonschematools.client.exceptions.ValidationException; -import org.openapijsonschematools.client.schemas.validation.MapUtils; -import org.openapijsonschematools.client.schemas.validation.FrozenList; -import org.openapijsonschematools.client.schemas.validation.FrozenMap; -import org.openapijsonschematools.client.components.schemas.Banana; - -import java.util.Arrays; -import java.util.List; -import java.util.AbstractMap; - -static final SchemaConfiguration configuration = new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().build()); - -// Map validation -Banana.BananaMap validatedPayload = - Banana.Banana1.validate( - new Banana.BananaMapBuilder() - .lengthCm(1) - - .build(), - configuration -); -``` - -### Field Summary -| Modifier and Type | Field and Description | -| ----------------- | ---------------------- | -| Set> | type = Set.of(Map.class) | -| Map> | properties = Map.ofEntries(
    new PropertyEntry("lengthCm", [LengthCm.class](#lengthcm)))
)
| -| Set | required = Set.of(
    "lengthCm"
)
| - -### Method Summary -| Modifier and Type | Method and Description | -| ----------------- | ---------------------- | -| [BananaMap](#bananamap) | validate([Map<?, ?>](#bananamapbuilder) arg, SchemaConfiguration configuration) | -| [Banana1BoxedMap](#banana1boxedmap) | validateAndBox([Map<?, ?>](#bananamapbuilder) arg, SchemaConfiguration configuration) | -| [Banana1Boxed](#banana1boxed) | validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) | -| @Nullable Object | validate(@Nullable Object arg, SchemaConfiguration configuration) | - -## BananaMap0Builder -public class BananaMap0Builder
-builder for `Map` - -A class that builds the Map input type - -### Constructor Summary -| Constructor and Description | -| --------------------------- | -| BananaMap0Builder(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 | -| [BananaMap0Builder](#bananamap0builder) | additionalProperty(String key, Nothing? value) | -| [BananaMap0Builder](#bananamap0builder) | additionalProperty(String key, boolean value) | -| [BananaMap0Builder](#bananamap0builder) | additionalProperty(String key, String value) | -| [BananaMap0Builder](#bananamap0builder) | additionalProperty(String key, int value) | -| [BananaMap0Builder](#bananamap0builder) | additionalProperty(String key, float value) | -| [BananaMap0Builder](#bananamap0builder) | additionalProperty(String key, long value) | -| [BananaMap0Builder](#bananamap0builder) | additionalProperty(String key, double value) | -| [BananaMap0Builder](#bananamap0builder) | additionalProperty(String key, List value) | -| [BananaMap0Builder](#bananamap0builder) | additionalProperty(String key, Map value) | - -## BananaMapBuilder -public class BananaMapBuilder
-builder for `Map` - -A class that builds the Map input type - -### Constructor Summary -| Constructor and Description | -| --------------------------- | -| BananaMapBuilder()
Creates a builder that contains an empty map | - -### Method Summary -| Modifier and Type | Method and Description | -| ----------------- | ---------------------- | -| [BananaMap0Builder](#bananamap0builder) | lengthCm(int value) | -| [BananaMap0Builder](#bananamap0builder) | lengthCm(float value) | -| [BananaMap0Builder](#bananamap0builder) | lengthCm(long value) | -| [BananaMap0Builder](#bananamap0builder) | lengthCm(double value) | - -## BananaMap -public static class BananaMap
-extends FrozenMap - -A class to store validated Map payloads - -### Method Summary -| Modifier and Type | Method and Description | -| ----------------- | ---------------------- | -| static [BananaMap](#bananamap) | of([Map](#bananamapbuilder) arg, SchemaConfiguration configuration) | -| Number | lengthCm()
| -| @Nullable Object | getAdditionalProperty(String name)
provides type safety for additional properties | - -## LengthCmBoxed -public sealed interface LengthCmBoxed
-permits
-[LengthCmBoxedNumber](#lengthcmboxednumber) - -sealed interface that stores validated payloads using boxed classes - -## LengthCmBoxedNumber -public record LengthCmBoxedNumber
-implements [LengthCmBoxed](#lengthcmboxed) - -record that stores validated Number payloads, sealed permits implementation - -### Constructor Summary -| Constructor and Description | -| --------------------------- | -| LengthCmBoxedNumber(Number data)
Creates an instance, private visibility | - -### Method Summary -| Modifier and Type | Method and Description | -| ----------------- | ---------------------- | -| Number | data()
validated payload | -| @Nullable Object | getData()
validated payload | - -## LengthCm -public static class LengthCm
-extends NumberJsonSchema.NumberJsonSchema1 - -A schema class that validates payloads - -| Methods Inherited from class org.openapijsonschematools.client.schemas.NumberJsonSchema.NumberJsonSchema1 | -| ------------------------------------------------------------------ | -| validate | -| validateAndBox | - -[[Back to top]](#top) [[Back to Component Schemas]](../../../README.md#Component-Schemas) [[Back to README]](../../../README.md) diff --git a/samples/client/petstore/kotlin/docs/components/schemas/BananaReq.md b/samples/client/petstore/kotlin/docs/components/schemas/BananaReq.md deleted file mode 100644 index c4cbe4fc95a..00000000000 --- a/samples/client/petstore/kotlin/docs/components/schemas/BananaReq.md +++ /dev/null @@ -1,354 +0,0 @@ -# BananaReq -org.openapijsonschematools.client.components.schemas.BananaReq.java -public class BananaReq
- -A class that contains necessary nested -- schema classes (which validate payloads), extends JsonSchema -- sealed interfaces which store validated payloads, java version of a sum type -- boxed classes which store validated payloads, sealed permits class implementations -- classes to store validated map payloads, extends FrozenMap -- classes to build inputs for map payloads - -## Nested Class Summary -| Modifier and Type | Class and Description | -| ----------------- | ---------------------- | -| sealed interface | [BananaReq.BananaReq1Boxed](#bananareq1boxed)
sealed interface for validated payloads | -| record | [BananaReq.BananaReq1BoxedMap](#bananareq1boxedmap)
boxed class to store validated Map payloads | -| static class | [BananaReq.BananaReq1](#bananareq1)
schema class | -| static class | [BananaReq.BananaReqMapBuilder](#bananareqmapbuilder)
builder for Map payloads | -| static class | [BananaReq.BananaReqMap](#bananareqmap)
output class for Map payloads | -| sealed interface | [BananaReq.SweetBoxed](#sweetboxed)
sealed interface for validated payloads | -| record | [BananaReq.SweetBoxedBoolean](#sweetboxedboolean)
boxed class to store validated boolean payloads | -| static class | [BananaReq.Sweet](#sweet)
schema class | -| sealed interface | [BananaReq.LengthCmBoxed](#lengthcmboxed)
sealed interface for validated payloads | -| record | [BananaReq.LengthCmBoxedNumber](#lengthcmboxednumber)
boxed class to store validated Number payloads | -| static class | [BananaReq.LengthCm](#lengthcm)
schema class | -| sealed interface | [BananaReq.AdditionalPropertiesBoxed](#additionalpropertiesboxed)
sealed interface for validated payloads | -| record | [BananaReq.AdditionalPropertiesBoxedVoid](#additionalpropertiesboxedvoid)
boxed class to store validated null payloads | -| record | [BananaReq.AdditionalPropertiesBoxedBoolean](#additionalpropertiesboxedboolean)
boxed class to store validated boolean payloads | -| record | [BananaReq.AdditionalPropertiesBoxedNumber](#additionalpropertiesboxednumber)
boxed class to store validated Number payloads | -| record | [BananaReq.AdditionalPropertiesBoxedString](#additionalpropertiesboxedstring)
boxed class to store validated String payloads | -| record | [BananaReq.AdditionalPropertiesBoxedList](#additionalpropertiesboxedlist)
boxed class to store validated List payloads | -| record | [BananaReq.AdditionalPropertiesBoxedMap](#additionalpropertiesboxedmap)
boxed class to store validated Map payloads | -| static class | [BananaReq.AdditionalProperties](#additionalproperties)
schema class | - -## BananaReq1Boxed -public sealed interface BananaReq1Boxed
-permits
-[BananaReq1BoxedMap](#bananareq1boxedmap) - -sealed interface that stores validated payloads using boxed classes - -## BananaReq1BoxedMap -public record BananaReq1BoxedMap
-implements [BananaReq1Boxed](#bananareq1boxed) - -record that stores validated Map payloads, sealed permits implementation - -### Constructor Summary -| Constructor and Description | -| --------------------------- | -| BananaReq1BoxedMap([BananaReqMap](#bananareqmap) data)
Creates an instance, private visibility | - -### Method Summary -| Modifier and Type | Method and Description | -| ----------------- | ---------------------- | -| [BananaReqMap](#bananareqmap) | data()
validated payload | -| @Nullable Object | getData()
validated payload | - -## BananaReq1 -public static class BananaReq1
-extends JsonSchema - -A schema class that validates payloads - -### Code Sample -``` -import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags; -import org.openapijsonschematools.client.configurations.SchemaConfiguration; -import org.openapijsonschematools.client.exceptions.ValidationException; -import org.openapijsonschematools.client.schemas.validation.MapUtils; -import org.openapijsonschematools.client.schemas.validation.FrozenList; -import org.openapijsonschematools.client.schemas.validation.FrozenMap; -import org.openapijsonschematools.client.components.schemas.BananaReq; - -import java.util.Arrays; -import java.util.List; -import java.util.AbstractMap; - -static final SchemaConfiguration configuration = new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().build()); - -// Map validation -BananaReq.BananaReqMap validatedPayload = - BananaReq.BananaReq1.validate( - new BananaReq.BananaReqMapBuilder() - .lengthCm(1) - - .sweet(true) - - .build(), - configuration -); -``` - -### Field Summary -| Modifier and Type | Field and Description | -| ----------------- | ---------------------- | -| Set> | type = Set.of(Map.class) | -| Map> | properties = Map.ofEntries(
    new PropertyEntry("lengthCm", [LengthCm.class](#lengthcm))),
    new PropertyEntry("sweet", [Sweet.class](#sweet)))
)
| -| Set | required = Set.of(
    "lengthCm"
)
| -| Class | additionalProperties = [AdditionalProperties.class](#additionalproperties) | - -### Method Summary -| Modifier and Type | Method and Description | -| ----------------- | ---------------------- | -| [BananaReqMap](#bananareqmap) | validate([Map<?, ?>](#bananareqmapbuilder) arg, SchemaConfiguration configuration) | -| [BananaReq1BoxedMap](#bananareq1boxedmap) | validateAndBox([Map<?, ?>](#bananareqmapbuilder) arg, SchemaConfiguration configuration) | -| [BananaReq1Boxed](#bananareq1boxed) | validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) | -| @Nullable Object | validate(@Nullable Object arg, SchemaConfiguration configuration) | - -## BananaReqMap0Builder -public class BananaReqMap0Builder
-builder for `Map` - -A class that builds the Map input type - -### Constructor Summary -| Constructor and Description | -| --------------------------- | -| BananaReqMap0Builder(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 | -| [BananaReqMap0Builder](#bananareqmap0builder) | sweet(boolean value) | - -## BananaReqMapBuilder -public class BananaReqMapBuilder
-builder for `Map` - -A class that builds the Map input type - -### Constructor Summary -| Constructor and Description | -| --------------------------- | -| BananaReqMapBuilder()
Creates a builder that contains an empty map | - -### Method Summary -| Modifier and Type | Method and Description | -| ----------------- | ---------------------- | -| [BananaReqMap0Builder](#bananareqmap0builder) | lengthCm(int value) | -| [BananaReqMap0Builder](#bananareqmap0builder) | lengthCm(float value) | -| [BananaReqMap0Builder](#bananareqmap0builder) | lengthCm(long value) | -| [BananaReqMap0Builder](#bananareqmap0builder) | lengthCm(double value) | - -## BananaReqMap -public static class BananaReqMap
-extends FrozenMap - -A class to store validated Map payloads - -### Method Summary -| Modifier and Type | Method and Description | -| ----------------- | ---------------------- | -| static [BananaReqMap](#bananareqmap) | of([Map](#bananareqmapbuilder) arg, SchemaConfiguration configuration) | -| Number | lengthCm()
| -| boolean | sweet()
[optional] | - -## SweetBoxed -public sealed interface SweetBoxed
-permits
-[SweetBoxedBoolean](#sweetboxedboolean) - -sealed interface that stores validated payloads using boxed classes - -## SweetBoxedBoolean -public record SweetBoxedBoolean
-implements [SweetBoxed](#sweetboxed) - -record that stores validated boolean payloads, sealed permits implementation - -### Constructor Summary -| Constructor and Description | -| --------------------------- | -| SweetBoxedBoolean(boolean data)
Creates an instance, private visibility | - -### Method Summary -| Modifier and Type | Method and Description | -| ----------------- | ---------------------- | -| boolean | data()
validated payload | -| @Nullable Object | getData()
validated payload | - -## Sweet -public static class Sweet
-extends BooleanJsonSchema.BooleanJsonSchema1 - -A schema class that validates payloads - -| Methods Inherited from class org.openapijsonschematools.client.schemas.BooleanJsonSchema.BooleanJsonSchema1 | -| ------------------------------------------------------------------ | -| validate | -| validateAndBox | - -## LengthCmBoxed -public sealed interface LengthCmBoxed
-permits
-[LengthCmBoxedNumber](#lengthcmboxednumber) - -sealed interface that stores validated payloads using boxed classes - -## LengthCmBoxedNumber -public record LengthCmBoxedNumber
-implements [LengthCmBoxed](#lengthcmboxed) - -record that stores validated Number payloads, sealed permits implementation - -### Constructor Summary -| Constructor and Description | -| --------------------------- | -| LengthCmBoxedNumber(Number data)
Creates an instance, private visibility | - -### Method Summary -| Modifier and Type | Method and Description | -| ----------------- | ---------------------- | -| Number | data()
validated payload | -| @Nullable Object | getData()
validated payload | - -## LengthCm -public static class LengthCm
-extends NumberJsonSchema.NumberJsonSchema1 - -A schema class that validates payloads - -| Methods Inherited from class org.openapijsonschematools.client.schemas.NumberJsonSchema.NumberJsonSchema1 | -| ------------------------------------------------------------------ | -| validate | -| validateAndBox | - -## 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(Nothing? data)
Creates an instance, private visibility | - -### Method Summary -| Modifier and Type | Method and Description | -| ----------------- | ---------------------- | -| Nothing? | 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 Component Schemas]](../../../README.md#Component-Schemas) [[Back to README]](../../../README.md) diff --git a/samples/client/petstore/kotlin/docs/components/schemas/Bar.md b/samples/client/petstore/kotlin/docs/components/schemas/Bar.md deleted file mode 100644 index 5f5758b2eec..00000000000 --- a/samples/client/petstore/kotlin/docs/components/schemas/Bar.md +++ /dev/null @@ -1,84 +0,0 @@ -# Bar -org.openapijsonschematools.client.components.schemas.Bar.java -public class Bar
- -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 - -## Nested Class Summary -| Modifier and Type | Class and Description | -| ----------------- | ---------------------- | -| sealed interface | [Bar.Bar1Boxed](#bar1boxed)
sealed interface for validated payloads | -| record | [Bar.Bar1BoxedString](#bar1boxedstring)
boxed class to store validated String payloads | -| static class | [Bar.Bar1](#bar1)
schema class | - -## Bar1Boxed -public sealed interface Bar1Boxed
-permits
-[Bar1BoxedString](#bar1boxedstring) - -sealed interface that stores validated payloads using boxed classes - -## Bar1BoxedString -public record Bar1BoxedString
-implements [Bar1Boxed](#bar1boxed) - -record that stores validated String payloads, sealed permits implementation - -### Constructor Summary -| Constructor and Description | -| --------------------------- | -| Bar1BoxedString(String data)
Creates an instance, private visibility | - -### Method Summary -| Modifier and Type | Method and Description | -| ----------------- | ---------------------- | -| String | data()
validated payload | -| @Nullable Object | getData()
validated payload | - -## Bar1 -public static class Bar1
-extends JsonSchema - -A schema class that validates payloads - -### Code Sample -``` -import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags; -import org.openapijsonschematools.client.configurations.SchemaConfiguration; -import org.openapijsonschematools.client.exceptions.ValidationException; -import org.openapijsonschematools.client.schemas.validation.MapUtils; -import org.openapijsonschematools.client.schemas.validation.FrozenList; -import org.openapijsonschematools.client.schemas.validation.FrozenMap; -import org.openapijsonschematools.client.components.schemas.Bar; - -import java.util.Arrays; -import java.util.List; -import java.util.AbstractMap; - -static final SchemaConfiguration configuration = new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().build()); - -// String validation -String validatedPayload = Bar.Bar1.validate( - "a", - configuration -); -``` - -### Field Summary -| Modifier and Type | Field and Description | -| ----------------- | ---------------------- | -| Set> | type = Set.of(
    String.class
)
| -| @Nullable Object | defaultValue = "bar" | - -### Method Summary -| Modifier and Type | Method and Description | -| ----------------- | ---------------------- | -| String | validate(String arg, SchemaConfiguration configuration) | -| [Bar1BoxedString](#bar1boxedstring) | validateAndBox(String arg, SchemaConfiguration configuration) | -| [Bar1Boxed](#bar1boxed) | validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) | -| @Nullable Object | validate(@Nullable Object arg, SchemaConfiguration configuration) | - -[[Back to top]](#top) [[Back to Component Schemas]](../../../README.md#Component-Schemas) [[Back to README]](../../../README.md) diff --git a/samples/client/petstore/kotlin/docs/components/schemas/BasquePig.md b/samples/client/petstore/kotlin/docs/components/schemas/BasquePig.md deleted file mode 100644 index f6c38583bea..00000000000 --- a/samples/client/petstore/kotlin/docs/components/schemas/BasquePig.md +++ /dev/null @@ -1,232 +0,0 @@ -# BasquePig -org.openapijsonschematools.client.components.schemas.BasquePig.java -public class BasquePig
- -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 | [BasquePig.BasquePig1Boxed](#basquepig1boxed)
sealed interface for validated payloads | -| record | [BasquePig.BasquePig1BoxedMap](#basquepig1boxedmap)
boxed class to store validated Map payloads | -| static class | [BasquePig.BasquePig1](#basquepig1)
schema class | -| static class | [BasquePig.BasquePigMapBuilder](#basquepigmapbuilder)
builder for Map payloads | -| static class | [BasquePig.BasquePigMap](#basquepigmap)
output class for Map payloads | -| sealed interface | [BasquePig.ClassNameBoxed](#classnameboxed)
sealed interface for validated payloads | -| record | [BasquePig.ClassNameBoxedString](#classnameboxedstring)
boxed class to store validated String payloads | -| static class | [BasquePig.ClassName](#classname)
schema class | -| enum | [BasquePig.StringClassNameEnums](#stringclassnameenums)
String enum | - -## BasquePig1Boxed -public sealed interface BasquePig1Boxed
-permits
-[BasquePig1BoxedMap](#basquepig1boxedmap) - -sealed interface that stores validated payloads using boxed classes - -## BasquePig1BoxedMap -public record BasquePig1BoxedMap
-implements [BasquePig1Boxed](#basquepig1boxed) - -record that stores validated Map payloads, sealed permits implementation - -### Constructor Summary -| Constructor and Description | -| --------------------------- | -| BasquePig1BoxedMap([BasquePigMap](#basquepigmap) data)
Creates an instance, private visibility | - -### Method Summary -| Modifier and Type | Method and Description | -| ----------------- | ---------------------- | -| [BasquePigMap](#basquepigmap) | data()
validated payload | -| @Nullable Object | getData()
validated payload | - -## BasquePig1 -public static class BasquePig1
-extends JsonSchema - -A schema class that validates payloads - -### Code Sample -``` -import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags; -import org.openapijsonschematools.client.configurations.SchemaConfiguration; -import org.openapijsonschematools.client.exceptions.ValidationException; -import org.openapijsonschematools.client.schemas.validation.MapUtils; -import org.openapijsonschematools.client.schemas.validation.FrozenList; -import org.openapijsonschematools.client.schemas.validation.FrozenMap; -import org.openapijsonschematools.client.components.schemas.BasquePig; - -import java.util.Arrays; -import java.util.List; -import java.util.AbstractMap; - -static final SchemaConfiguration configuration = new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().build()); - -// Map validation -BasquePig.BasquePigMap validatedPayload = - BasquePig.BasquePig1.validate( - new BasquePig.BasquePigMapBuilder() - .className("BasquePig") - - .build(), - configuration -); -``` - -### Field Summary -| Modifier and Type | Field and Description | -| ----------------- | ---------------------- | -| Set> | type = Set.of(Map.class) | -| Map> | properties = Map.ofEntries(
    new PropertyEntry("className", [ClassName.class](#classname)))
)
| -| Set | required = Set.of(
    "className"
)
| - -### Method Summary -| Modifier and Type | Method and Description | -| ----------------- | ---------------------- | -| [BasquePigMap](#basquepigmap) | validate([Map<?, ?>](#basquepigmapbuilder) arg, SchemaConfiguration configuration) | -| [BasquePig1BoxedMap](#basquepig1boxedmap) | validateAndBox([Map<?, ?>](#basquepigmapbuilder) arg, SchemaConfiguration configuration) | -| [BasquePig1Boxed](#basquepig1boxed) | validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) | -| @Nullable Object | validate(@Nullable Object arg, SchemaConfiguration configuration) | - -## BasquePigMap0Builder -public class BasquePigMap0Builder
-builder for `Map` - -A class that builds the Map input type - -### Constructor Summary -| Constructor and Description | -| --------------------------- | -| BasquePigMap0Builder(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 | -| [BasquePigMap0Builder](#basquepigmap0builder) | additionalProperty(String key, Nothing? value) | -| [BasquePigMap0Builder](#basquepigmap0builder) | additionalProperty(String key, boolean value) | -| [BasquePigMap0Builder](#basquepigmap0builder) | additionalProperty(String key, String value) | -| [BasquePigMap0Builder](#basquepigmap0builder) | additionalProperty(String key, int value) | -| [BasquePigMap0Builder](#basquepigmap0builder) | additionalProperty(String key, float value) | -| [BasquePigMap0Builder](#basquepigmap0builder) | additionalProperty(String key, long value) | -| [BasquePigMap0Builder](#basquepigmap0builder) | additionalProperty(String key, double value) | -| [BasquePigMap0Builder](#basquepigmap0builder) | additionalProperty(String key, List value) | -| [BasquePigMap0Builder](#basquepigmap0builder) | additionalProperty(String key, Map value) | - -## BasquePigMapBuilder -public class BasquePigMapBuilder
-builder for `Map` - -A class that builds the Map input type - -### Constructor Summary -| Constructor and Description | -| --------------------------- | -| BasquePigMapBuilder()
Creates a builder that contains an empty map | - -### Method Summary -| Modifier and Type | Method and Description | -| ----------------- | ---------------------- | -| [BasquePigMap0Builder](#basquepigmap0builder) | className(String value) | -| [BasquePigMap0Builder](#basquepigmap0builder) | className([StringClassNameEnums](#stringclassnameenums) value) | - -## BasquePigMap -public static class BasquePigMap
-extends FrozenMap - -A class to store validated Map payloads - -### Method Summary -| Modifier and Type | Method and Description | -| ----------------- | ---------------------- | -| static [BasquePigMap](#basquepigmap) | of([Map](#basquepigmapbuilder) arg, SchemaConfiguration configuration) | -| String | className()
must be one of ["BasquePig"] | -| @Nullable Object | getAdditionalProperty(String name)
provides type safety for additional properties | - -## ClassNameBoxed -public sealed interface ClassNameBoxed
-permits
-[ClassNameBoxedString](#classnameboxedstring) - -sealed interface that stores validated payloads using boxed classes - -## ClassNameBoxedString -public record ClassNameBoxedString
-implements [ClassNameBoxed](#classnameboxed) - -record that stores validated String payloads, sealed permits implementation - -### Constructor Summary -| Constructor and Description | -| --------------------------- | -| ClassNameBoxedString(String data)
Creates an instance, private visibility | - -### Method Summary -| Modifier and Type | Method and Description | -| ----------------- | ---------------------- | -| String | data()
validated payload | -| @Nullable Object | getData()
validated payload | - -## ClassName -public static class ClassName
-extends JsonSchema - -A schema class that validates payloads - -### Code Sample -``` -import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags; -import org.openapijsonschematools.client.configurations.SchemaConfiguration; -import org.openapijsonschematools.client.exceptions.ValidationException; -import org.openapijsonschematools.client.schemas.validation.MapUtils; -import org.openapijsonschematools.client.schemas.validation.FrozenList; -import org.openapijsonschematools.client.schemas.validation.FrozenMap; -import org.openapijsonschematools.client.components.schemas.BasquePig; - -import java.util.Arrays; -import java.util.List; -import java.util.AbstractMap; - -static final SchemaConfiguration configuration = new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().build()); - -// String validation -String validatedPayload = BasquePig.ClassName.validate( - "BasquePig", - configuration -); -``` - -### Field Summary -| Modifier and Type | Field and Description | -| ----------------- | ---------------------- | -| Set> | type = Set.of(
    String.class
)
| -| Set | enumValues = SetMaker.makeSet(
    "BasquePig"
)
| - -### Method Summary -| Modifier and Type | Method and Description | -| ----------------- | ---------------------- | -| String | validate(String arg, SchemaConfiguration configuration) | -| String | validate([StringClassNameEnums](#stringclassnameenums) arg, SchemaConfiguration configuration) | -| [ClassNameBoxedString](#classnameboxedstring) | validateAndBox(String arg, SchemaConfiguration configuration) | -| [ClassNameBoxed](#classnameboxed) | validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) | -| @Nullable Object | validate(@Nullable Object arg, SchemaConfiguration configuration) | - -## StringClassNameEnums -public enum StringClassNameEnums
-extends `Enum` - -A class that stores String enum values - -### Enum Constant Summary -| Enum Constant | Description | -| ------------- | ----------- | -| BASQUE_PIG | value = "BasquePig" | - -[[Back to top]](#top) [[Back to Component Schemas]](../../../README.md#Component-Schemas) [[Back to README]](../../../README.md) diff --git a/samples/client/petstore/kotlin/docs/components/schemas/BooleanEnum.md b/samples/client/petstore/kotlin/docs/components/schemas/BooleanEnum.md deleted file mode 100644 index 0817b8f944a..00000000000 --- a/samples/client/petstore/kotlin/docs/components/schemas/BooleanEnum.md +++ /dev/null @@ -1,98 +0,0 @@ -# BooleanEnum -org.openapijsonschematools.client.components.schemas.BooleanEnum.java -public class BooleanEnum
- -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 -- enum classes - -## Nested Class Summary -| Modifier and Type | Class and Description | -| ----------------- | ---------------------- | -| sealed interface | [BooleanEnum.BooleanEnum1Boxed](#booleanenum1boxed)
sealed interface for validated payloads | -| record | [BooleanEnum.BooleanEnum1BoxedBoolean](#booleanenum1boxedboolean)
boxed class to store validated boolean payloads | -| static class | [BooleanEnum.BooleanEnum1](#booleanenum1)
schema class | -| enum | [BooleanEnum.BooleanBooleanEnumEnums](#booleanbooleanenumenums)
boolean enum | - -## BooleanEnum1Boxed -public sealed interface BooleanEnum1Boxed
-permits
-[BooleanEnum1BoxedBoolean](#booleanenum1boxedboolean) - -sealed interface that stores validated payloads using boxed classes - -## BooleanEnum1BoxedBoolean -public record BooleanEnum1BoxedBoolean
-implements [BooleanEnum1Boxed](#booleanenum1boxed) - -record that stores validated boolean payloads, sealed permits implementation - -### Constructor Summary -| Constructor and Description | -| --------------------------- | -| BooleanEnum1BoxedBoolean(boolean data)
Creates an instance, private visibility | - -### Method Summary -| Modifier and Type | Method and Description | -| ----------------- | ---------------------- | -| boolean | data()
validated payload | -| @Nullable Object | getData()
validated payload | - -## BooleanEnum1 -public static class BooleanEnum1
-extends JsonSchema - -A schema class that validates payloads - -### Code Sample -``` -import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags; -import org.openapijsonschematools.client.configurations.SchemaConfiguration; -import org.openapijsonschematools.client.exceptions.ValidationException; -import org.openapijsonschematools.client.schemas.validation.MapUtils; -import org.openapijsonschematools.client.schemas.validation.FrozenList; -import org.openapijsonschematools.client.schemas.validation.FrozenMap; -import org.openapijsonschematools.client.components.schemas.BooleanEnum; - -import java.util.Arrays; -import java.util.List; -import java.util.AbstractMap; - -static final SchemaConfiguration configuration = new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().build()); - -// boolean validation -boolean validatedPayload = BooleanEnum.BooleanEnum1.validate( - true, - configuration -); -``` - -### Field Summary -| Modifier and Type | Field and Description | -| ----------------- | ---------------------- | -| Set> | type = Set.of(Boolean.class) | -| Set | enumValues = SetMaker.makeSet(
    true
)
| - -### Method Summary -| Modifier and Type | Method and Description | -| ----------------- | ---------------------- | -| boolean | validate(boolean arg, SchemaConfiguration configuration) | -| boolean | validate([BooleanBooleanEnumEnums](#booleanbooleanenumenums) arg, SchemaConfiguration configuration) | -| [BooleanEnum1BoxedBoolean](#booleanenum1boxedboolean) | validateAndBox(boolean arg, SchemaConfiguration configuration) | -| [BooleanEnum1Boxed](#booleanenum1boxed) | validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) | -| @Nullable Object | validate(@Nullable Object arg, SchemaConfiguration configuration) | - -## BooleanBooleanEnumEnums -public enum BooleanBooleanEnumEnums
-extends `Enum` - -A class that stores boolean enum values - -### Enum Constant Summary -| Enum Constant | Description | -| ------------- | ----------- | -| TRUE | value = true | - -[[Back to top]](#top) [[Back to Component Schemas]](../../../README.md#Component-Schemas) [[Back to README]](../../../README.md) diff --git a/samples/client/petstore/kotlin/docs/components/schemas/BooleanSchema.md b/samples/client/petstore/kotlin/docs/components/schemas/BooleanSchema.md deleted file mode 100644 index 5f8d3d2fb27..00000000000 --- a/samples/client/petstore/kotlin/docs/components/schemas/BooleanSchema.md +++ /dev/null @@ -1,52 +0,0 @@ -# BooleanSchema -org.openapijsonschematools.client.components.schemas.BooleanSchema.java -public class BooleanSchema
- -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 - -## Nested Class Summary -| Modifier and Type | Class and Description | -| ----------------- | ---------------------- | -| sealed interface | [BooleanSchema.BooleanSchema1Boxed](#booleanschema1boxed)
sealed interface for validated payloads | -| record | [BooleanSchema.BooleanSchema1BoxedBoolean](#booleanschema1boxedboolean)
boxed class to store validated boolean payloads | -| static class | [BooleanSchema.BooleanSchema1](#booleanschema1)
schema class | - -## BooleanSchema1Boxed -public sealed interface BooleanSchema1Boxed
-permits
-[BooleanSchema1BoxedBoolean](#booleanschema1boxedboolean) - -sealed interface that stores validated payloads using boxed classes - -## BooleanSchema1BoxedBoolean -public record BooleanSchema1BoxedBoolean
-implements [BooleanSchema1Boxed](#booleanschema1boxed) - -record that stores validated boolean payloads, sealed permits implementation - -### Constructor Summary -| Constructor and Description | -| --------------------------- | -| BooleanSchema1BoxedBoolean(boolean data)
Creates an instance, private visibility | - -### Method Summary -| Modifier and Type | Method and Description | -| ----------------- | ---------------------- | -| boolean | data()
validated payload | -| @Nullable Object | getData()
validated payload | - -## BooleanSchema1 -public static class BooleanSchema1
-extends BooleanJsonSchema.BooleanJsonSchema1 - -A schema class that validates payloads - -| Methods Inherited from class org.openapijsonschematools.client.schemas.BooleanJsonSchema.BooleanJsonSchema1 | -| ------------------------------------------------------------------ | -| validate | -| validateAndBox | - -[[Back to top]](#top) [[Back to Component Schemas]](../../../README.md#Component-Schemas) [[Back to README]](../../../README.md) diff --git a/samples/client/petstore/kotlin/docs/components/schemas/Capitalization.md b/samples/client/petstore/kotlin/docs/components/schemas/Capitalization.md deleted file mode 100644 index 716e01dcd76..00000000000 --- a/samples/client/petstore/kotlin/docs/components/schemas/Capitalization.md +++ /dev/null @@ -1,382 +0,0 @@ -# Capitalization -org.openapijsonschematools.client.components.schemas.Capitalization.java -public class Capitalization
- -A class that contains necessary nested -- schema classes (which validate payloads), extends JsonSchema -- sealed interfaces which store validated payloads, java version of a sum type -- boxed classes which store validated payloads, sealed permits class implementations -- classes to store validated map payloads, extends FrozenMap -- classes to build inputs for map payloads - -## Nested Class Summary -| Modifier and Type | Class and Description | -| ----------------- | ---------------------- | -| sealed interface | [Capitalization.Capitalization1Boxed](#capitalization1boxed)
sealed interface for validated payloads | -| record | [Capitalization.Capitalization1BoxedMap](#capitalization1boxedmap)
boxed class to store validated Map payloads | -| static class | [Capitalization.Capitalization1](#capitalization1)
schema class | -| static class | [Capitalization.CapitalizationMapBuilder](#capitalizationmapbuilder)
builder for Map payloads | -| static class | [Capitalization.CapitalizationMap](#capitalizationmap)
output class for Map payloads | -| sealed interface | [Capitalization.ATTNAMEBoxed](#attnameboxed)
sealed interface for validated payloads | -| record | [Capitalization.ATTNAMEBoxedString](#attnameboxedstring)
boxed class to store validated String payloads | -| static class | [Capitalization.ATTNAME](#attname)
schema class | -| sealed interface | [Capitalization.SCAETHFlowPointsBoxed](#scaethflowpointsboxed)
sealed interface for validated payloads | -| record | [Capitalization.SCAETHFlowPointsBoxedString](#scaethflowpointsboxedstring)
boxed class to store validated String payloads | -| static class | [Capitalization.SCAETHFlowPoints](#scaethflowpoints)
schema class | -| sealed interface | [Capitalization.CapitalSnakeBoxed](#capitalsnakeboxed)
sealed interface for validated payloads | -| record | [Capitalization.CapitalSnakeBoxedString](#capitalsnakeboxedstring)
boxed class to store validated String payloads | -| static class | [Capitalization.CapitalSnake](#capitalsnake)
schema class | -| sealed interface | [Capitalization.SmallSnakeBoxed](#smallsnakeboxed)
sealed interface for validated payloads | -| record | [Capitalization.SmallSnakeBoxedString](#smallsnakeboxedstring)
boxed class to store validated String payloads | -| static class | [Capitalization.SmallSnake](#smallsnake)
schema class | -| sealed interface | [Capitalization.CapitalCamelBoxed](#capitalcamelboxed)
sealed interface for validated payloads | -| record | [Capitalization.CapitalCamelBoxedString](#capitalcamelboxedstring)
boxed class to store validated String payloads | -| static class | [Capitalization.CapitalCamel](#capitalcamel)
schema class | -| sealed interface | [Capitalization.SmallCamelBoxed](#smallcamelboxed)
sealed interface for validated payloads | -| record | [Capitalization.SmallCamelBoxedString](#smallcamelboxedstring)
boxed class to store validated String payloads | -| static class | [Capitalization.SmallCamel](#smallcamel)
schema class | - -## Capitalization1Boxed -public sealed interface Capitalization1Boxed
-permits
-[Capitalization1BoxedMap](#capitalization1boxedmap) - -sealed interface that stores validated payloads using boxed classes - -## Capitalization1BoxedMap -public record Capitalization1BoxedMap
-implements [Capitalization1Boxed](#capitalization1boxed) - -record that stores validated Map payloads, sealed permits implementation - -### Constructor Summary -| Constructor and Description | -| --------------------------- | -| Capitalization1BoxedMap([CapitalizationMap](#capitalizationmap) data)
Creates an instance, private visibility | - -### Method Summary -| Modifier and Type | Method and Description | -| ----------------- | ---------------------- | -| [CapitalizationMap](#capitalizationmap) | data()
validated payload | -| @Nullable Object | getData()
validated payload | - -## Capitalization1 -public static class Capitalization1
-extends JsonSchema - -A schema class that validates payloads - -### Code Sample -``` -import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags; -import org.openapijsonschematools.client.configurations.SchemaConfiguration; -import org.openapijsonschematools.client.exceptions.ValidationException; -import org.openapijsonschematools.client.schemas.validation.MapUtils; -import org.openapijsonschematools.client.schemas.validation.FrozenList; -import org.openapijsonschematools.client.schemas.validation.FrozenMap; -import org.openapijsonschematools.client.components.schemas.Capitalization; - -import java.util.Arrays; -import java.util.List; -import java.util.AbstractMap; - -static final SchemaConfiguration configuration = new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().build()); - -// Map validation -Capitalization.CapitalizationMap validatedPayload = - Capitalization.Capitalization1.validate( - new Capitalization.CapitalizationMapBuilder() - .smallCamel("a") - - .CapitalCamel("a") - - .small_Snake("a") - - .Capital_Snake("a") - - .SCA_ETH_Flow_Points("a") - - .ATT_NAME("a") - - .build(), - configuration -); -``` - -### Field Summary -| Modifier and Type | Field and Description | -| ----------------- | ---------------------- | -| Set> | type = Set.of(Map.class) | -| Map> | properties = Map.ofEntries(
    new PropertyEntry("smallCamel", [SmallCamel.class](#smallcamel))),
    new PropertyEntry("CapitalCamel", [CapitalCamel.class](#capitalcamel))),
    new PropertyEntry("small_Snake", [SmallSnake.class](#smallsnake))),
    new PropertyEntry("Capital_Snake", [CapitalSnake.class](#capitalsnake))),
    new PropertyEntry("SCA_ETH_Flow_Points", [SCAETHFlowPoints.class](#scaethflowpoints))),
    new PropertyEntry("ATT_NAME", [ATTNAME.class](#attname)))
)
| - -### Method Summary -| Modifier and Type | Method and Description | -| ----------------- | ---------------------- | -| [CapitalizationMap](#capitalizationmap) | validate([Map<?, ?>](#capitalizationmapbuilder) arg, SchemaConfiguration configuration) | -| [Capitalization1BoxedMap](#capitalization1boxedmap) | validateAndBox([Map<?, ?>](#capitalizationmapbuilder) arg, SchemaConfiguration configuration) | -| [Capitalization1Boxed](#capitalization1boxed) | validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) | -| @Nullable Object | validate(@Nullable Object arg, SchemaConfiguration configuration) | - -## CapitalizationMapBuilder -public class CapitalizationMapBuilder
-builder for `Map` - -A class that builds the Map input type - -### Constructor Summary -| Constructor and Description | -| --------------------------- | -| CapitalizationMapBuilder()
Creates a builder that contains an empty map | - -### Method Summary -| Modifier and Type | Method and Description | -| ----------------- | ---------------------- | -| Map | build()
Returns map input that should be used with Schema.validate | -| [CapitalizationMapBuilder](#capitalizationmapbuilder) | smallCamel(String value) | -| [CapitalizationMapBuilder](#capitalizationmapbuilder) | CapitalCamel(String value) | -| [CapitalizationMapBuilder](#capitalizationmapbuilder) | small_Snake(String value) | -| [CapitalizationMapBuilder](#capitalizationmapbuilder) | Capital_Snake(String value) | -| [CapitalizationMapBuilder](#capitalizationmapbuilder) | SCA_ETH_Flow_Points(String value) | -| [CapitalizationMapBuilder](#capitalizationmapbuilder) | ATT_NAME(String value) | -| [CapitalizationMapBuilder](#capitalizationmapbuilder) | additionalProperty(String key, Nothing? value) | -| [CapitalizationMapBuilder](#capitalizationmapbuilder) | additionalProperty(String key, boolean value) | -| [CapitalizationMapBuilder](#capitalizationmapbuilder) | additionalProperty(String key, String value) | -| [CapitalizationMapBuilder](#capitalizationmapbuilder) | additionalProperty(String key, int value) | -| [CapitalizationMapBuilder](#capitalizationmapbuilder) | additionalProperty(String key, float value) | -| [CapitalizationMapBuilder](#capitalizationmapbuilder) | additionalProperty(String key, long value) | -| [CapitalizationMapBuilder](#capitalizationmapbuilder) | additionalProperty(String key, double value) | -| [CapitalizationMapBuilder](#capitalizationmapbuilder) | additionalProperty(String key, List value) | -| [CapitalizationMapBuilder](#capitalizationmapbuilder) | additionalProperty(String key, Map value) | - -## CapitalizationMap -public static class CapitalizationMap
-extends FrozenMap - -A class to store validated Map payloads - -### Method Summary -| Modifier and Type | Method and Description | -| ----------------- | ---------------------- | -| static [CapitalizationMap](#capitalizationmap) | of([Map](#capitalizationmapbuilder) arg, SchemaConfiguration configuration) | -| String | smallCamel()
[optional] | -| String | CapitalCamel()
[optional] | -| String | small_Snake()
[optional] | -| String | Capital_Snake()
[optional] | -| String | SCA_ETH_Flow_Points()
[optional] | -| String | ATT_NAME()
[optional] | -| @Nullable Object | getAdditionalProperty(String name)
provides type safety for additional properties | - -## ATTNAMEBoxed -public sealed interface ATTNAMEBoxed
-permits
-[ATTNAMEBoxedString](#attnameboxedstring) - -sealed interface that stores validated payloads using boxed classes - -## ATTNAMEBoxedString -public record ATTNAMEBoxedString
-implements [ATTNAMEBoxed](#attnameboxed) - -record that stores validated String payloads, sealed permits implementation - -### Constructor Summary -| Constructor and Description | -| --------------------------- | -| ATTNAMEBoxedString(String data)
Creates an instance, private visibility | - -### Method Summary -| Modifier and Type | Method and Description | -| ----------------- | ---------------------- | -| String | data()
validated payload | -| @Nullable Object | getData()
validated payload | - -## ATTNAME -public static class ATTNAME
-extends StringJsonSchema.StringJsonSchema1 - -A schema class that validates payloads - -## Description -Name of the pet
- -| Methods Inherited from class org.openapijsonschematools.client.schemas.StringJsonSchema.StringJsonSchema1 | -| ------------------------------------------------------------------ | -| validate | -| validateAndBox | - -## SCAETHFlowPointsBoxed -public sealed interface SCAETHFlowPointsBoxed
-permits
-[SCAETHFlowPointsBoxedString](#scaethflowpointsboxedstring) - -sealed interface that stores validated payloads using boxed classes - -## SCAETHFlowPointsBoxedString -public record SCAETHFlowPointsBoxedString
-implements [SCAETHFlowPointsBoxed](#scaethflowpointsboxed) - -record that stores validated String payloads, sealed permits implementation - -### Constructor Summary -| Constructor and Description | -| --------------------------- | -| SCAETHFlowPointsBoxedString(String data)
Creates an instance, private visibility | - -### Method Summary -| Modifier and Type | Method and Description | -| ----------------- | ---------------------- | -| String | data()
validated payload | -| @Nullable Object | getData()
validated payload | - -## SCAETHFlowPoints -public static class SCAETHFlowPoints
-extends StringJsonSchema.StringJsonSchema1 - -A schema class that validates payloads - -| Methods Inherited from class org.openapijsonschematools.client.schemas.StringJsonSchema.StringJsonSchema1 | -| ------------------------------------------------------------------ | -| validate | -| validateAndBox | - -## CapitalSnakeBoxed -public sealed interface CapitalSnakeBoxed
-permits
-[CapitalSnakeBoxedString](#capitalsnakeboxedstring) - -sealed interface that stores validated payloads using boxed classes - -## CapitalSnakeBoxedString -public record CapitalSnakeBoxedString
-implements [CapitalSnakeBoxed](#capitalsnakeboxed) - -record that stores validated String payloads, sealed permits implementation - -### Constructor Summary -| Constructor and Description | -| --------------------------- | -| CapitalSnakeBoxedString(String data)
Creates an instance, private visibility | - -### Method Summary -| Modifier and Type | Method and Description | -| ----------------- | ---------------------- | -| String | data()
validated payload | -| @Nullable Object | getData()
validated payload | - -## CapitalSnake -public static class CapitalSnake
-extends StringJsonSchema.StringJsonSchema1 - -A schema class that validates payloads - -| Methods Inherited from class org.openapijsonschematools.client.schemas.StringJsonSchema.StringJsonSchema1 | -| ------------------------------------------------------------------ | -| validate | -| validateAndBox | - -## SmallSnakeBoxed -public sealed interface SmallSnakeBoxed
-permits
-[SmallSnakeBoxedString](#smallsnakeboxedstring) - -sealed interface that stores validated payloads using boxed classes - -## SmallSnakeBoxedString -public record SmallSnakeBoxedString
-implements [SmallSnakeBoxed](#smallsnakeboxed) - -record that stores validated String payloads, sealed permits implementation - -### Constructor Summary -| Constructor and Description | -| --------------------------- | -| SmallSnakeBoxedString(String data)
Creates an instance, private visibility | - -### Method Summary -| Modifier and Type | Method and Description | -| ----------------- | ---------------------- | -| String | data()
validated payload | -| @Nullable Object | getData()
validated payload | - -## SmallSnake -public static class SmallSnake
-extends StringJsonSchema.StringJsonSchema1 - -A schema class that validates payloads - -| Methods Inherited from class org.openapijsonschematools.client.schemas.StringJsonSchema.StringJsonSchema1 | -| ------------------------------------------------------------------ | -| validate | -| validateAndBox | - -## CapitalCamelBoxed -public sealed interface CapitalCamelBoxed
-permits
-[CapitalCamelBoxedString](#capitalcamelboxedstring) - -sealed interface that stores validated payloads using boxed classes - -## CapitalCamelBoxedString -public record CapitalCamelBoxedString
-implements [CapitalCamelBoxed](#capitalcamelboxed) - -record that stores validated String payloads, sealed permits implementation - -### Constructor Summary -| Constructor and Description | -| --------------------------- | -| CapitalCamelBoxedString(String data)
Creates an instance, private visibility | - -### Method Summary -| Modifier and Type | Method and Description | -| ----------------- | ---------------------- | -| String | data()
validated payload | -| @Nullable Object | getData()
validated payload | - -## CapitalCamel -public static class CapitalCamel
-extends StringJsonSchema.StringJsonSchema1 - -A schema class that validates payloads - -| Methods Inherited from class org.openapijsonschematools.client.schemas.StringJsonSchema.StringJsonSchema1 | -| ------------------------------------------------------------------ | -| validate | -| validateAndBox | - -## SmallCamelBoxed -public sealed interface SmallCamelBoxed
-permits
-[SmallCamelBoxedString](#smallcamelboxedstring) - -sealed interface that stores validated payloads using boxed classes - -## SmallCamelBoxedString -public record SmallCamelBoxedString
-implements [SmallCamelBoxed](#smallcamelboxed) - -record that stores validated String payloads, sealed permits implementation - -### Constructor Summary -| Constructor and Description | -| --------------------------- | -| SmallCamelBoxedString(String data)
Creates an instance, private visibility | - -### Method Summary -| Modifier and Type | Method and Description | -| ----------------- | ---------------------- | -| String | data()
validated payload | -| @Nullable Object | getData()
validated payload | - -## SmallCamel -public static class SmallCamel
-extends StringJsonSchema.StringJsonSchema1 - -A schema class that validates payloads - -| Methods Inherited from class org.openapijsonschematools.client.schemas.StringJsonSchema.StringJsonSchema1 | -| ------------------------------------------------------------------ | -| validate | -| validateAndBox | - -[[Back to top]](#top) [[Back to Component Schemas]](../../../README.md#Component-Schemas) [[Back to README]](../../../README.md) diff --git a/samples/client/petstore/kotlin/docs/components/schemas/Cat.md b/samples/client/petstore/kotlin/docs/components/schemas/Cat.md deleted file mode 100644 index d1142f0df49..00000000000 --- a/samples/client/petstore/kotlin/docs/components/schemas/Cat.md +++ /dev/null @@ -1,324 +0,0 @@ -# Cat -org.openapijsonschematools.client.components.schemas.Cat.java -public class Cat
- -A class that contains necessary nested -- schema classes (which validate payloads), extends JsonSchema -- sealed interfaces which store validated payloads, java version of a sum type -- boxed classes which store validated payloads, sealed permits class implementations -- classes to store validated map payloads, extends FrozenMap -- classes to build inputs for map payloads - -## Nested Class Summary -| Modifier and Type | Class and Description | -| ----------------- | ---------------------- | -| sealed interface | [Cat.Cat1Boxed](#cat1boxed)
sealed interface for validated payloads | -| record | [Cat.Cat1BoxedVoid](#cat1boxedvoid)
boxed class to store validated null payloads | -| record | [Cat.Cat1BoxedBoolean](#cat1boxedboolean)
boxed class to store validated boolean payloads | -| record | [Cat.Cat1BoxedNumber](#cat1boxednumber)
boxed class to store validated Number payloads | -| record | [Cat.Cat1BoxedString](#cat1boxedstring)
boxed class to store validated String payloads | -| record | [Cat.Cat1BoxedList](#cat1boxedlist)
boxed class to store validated List payloads | -| record | [Cat.Cat1BoxedMap](#cat1boxedmap)
boxed class to store validated Map payloads | -| static class | [Cat.Cat1](#cat1)
schema class | -| sealed interface | [Cat.Schema1Boxed](#schema1boxed)
sealed interface for validated payloads | -| record | [Cat.Schema1BoxedMap](#schema1boxedmap)
boxed class to store validated Map payloads | -| static class | [Cat.Schema1](#schema1)
schema class | -| static class | [Cat.Schema1MapBuilder](#schema1mapbuilder)
builder for Map payloads | -| static class | [Cat.Schema1Map](#schema1map)
output class for Map payloads | -| sealed interface | [Cat.DeclawedBoxed](#declawedboxed)
sealed interface for validated payloads | -| record | [Cat.DeclawedBoxedBoolean](#declawedboxedboolean)
boxed class to store validated boolean payloads | -| static class | [Cat.Declawed](#declawed)
schema class | - -## Cat1Boxed -public sealed interface Cat1Boxed
-permits
-[Cat1BoxedVoid](#cat1boxedvoid), -[Cat1BoxedBoolean](#cat1boxedboolean), -[Cat1BoxedNumber](#cat1boxednumber), -[Cat1BoxedString](#cat1boxedstring), -[Cat1BoxedList](#cat1boxedlist), -[Cat1BoxedMap](#cat1boxedmap) - -sealed interface that stores validated payloads using boxed classes - -## Cat1BoxedVoid -public record Cat1BoxedVoid
-implements [Cat1Boxed](#cat1boxed) - -record that stores validated null payloads, sealed permits implementation - -### Constructor Summary -| Constructor and Description | -| --------------------------- | -| Cat1BoxedVoid(Nothing? data)
Creates an instance, private visibility | - -### Method Summary -| Modifier and Type | Method and Description | -| ----------------- | ---------------------- | -| Nothing? | data()
validated payload | -| @Nullable Object | getData()
validated payload | - -## Cat1BoxedBoolean -public record Cat1BoxedBoolean
-implements [Cat1Boxed](#cat1boxed) - -record that stores validated boolean payloads, sealed permits implementation - -### Constructor Summary -| Constructor and Description | -| --------------------------- | -| Cat1BoxedBoolean(boolean data)
Creates an instance, private visibility | - -### Method Summary -| Modifier and Type | Method and Description | -| ----------------- | ---------------------- | -| boolean | data()
validated payload | -| @Nullable Object | getData()
validated payload | - -## Cat1BoxedNumber -public record Cat1BoxedNumber
-implements [Cat1Boxed](#cat1boxed) - -record that stores validated Number payloads, sealed permits implementation - -### Constructor Summary -| Constructor and Description | -| --------------------------- | -| Cat1BoxedNumber(Number data)
Creates an instance, private visibility | - -### Method Summary -| Modifier and Type | Method and Description | -| ----------------- | ---------------------- | -| Number | data()
validated payload | -| @Nullable Object | getData()
validated payload | - -## Cat1BoxedString -public record Cat1BoxedString
-implements [Cat1Boxed](#cat1boxed) - -record that stores validated String payloads, sealed permits implementation - -### Constructor Summary -| Constructor and Description | -| --------------------------- | -| Cat1BoxedString(String data)
Creates an instance, private visibility | - -### Method Summary -| Modifier and Type | Method and Description | -| ----------------- | ---------------------- | -| String | data()
validated payload | -| @Nullable Object | getData()
validated payload | - -## Cat1BoxedList -public record Cat1BoxedList
-implements [Cat1Boxed](#cat1boxed) - -record that stores validated List payloads, sealed permits implementation - -### Constructor Summary -| Constructor and Description | -| --------------------------- | -| Cat1BoxedList(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 | - -## Cat1BoxedMap -public record Cat1BoxedMap
-implements [Cat1Boxed](#cat1boxed) - -record that stores validated Map payloads, sealed permits implementation - -### Constructor Summary -| Constructor and Description | -| --------------------------- | -| Cat1BoxedMap(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 | - -## Cat1 -public static class Cat1
-extends JsonSchema - -A schema class that validates payloads - -### Field Summary -| Modifier and Type | Field and Description | -| ----------------- | ---------------------- | -| List> | allOf = List.of(
    [Animal.Animal1.class](../../components/schemas/Animal.md#animal1),
    [Schema1.class](#schema1)
;)
| - -### Method Summary -| Modifier and Type | Method and Description | -| ----------------- | ---------------------- | -| String | validate(String arg, SchemaConfiguration configuration) | -| Nothing? | validate(Nothing? arg, SchemaConfiguration configuration) | -| int | validate(int arg, SchemaConfiguration configuration) | -| long | validate(long arg, SchemaConfiguration configuration) | -| float | validate(float arg, SchemaConfiguration configuration) | -| double | validate(double arg, SchemaConfiguration configuration) | -| Number | validate(Number arg, SchemaConfiguration configuration) | -| boolean | validate(boolean arg, SchemaConfiguration configuration) | -| FrozenMap<@Nullable Object> | validate(Map<?, ?> arg, SchemaConfiguration configuration) | -| FrozenList<@Nullable Object> | validate(List arg, SchemaConfiguration configuration) | -| [Cat1BoxedString](#cat1boxedstring) | validateAndBox(String arg, SchemaConfiguration configuration) | -| [Cat1BoxedVoid](#cat1boxedvoid) | validateAndBox(Nothing? arg, SchemaConfiguration configuration) | -| [Cat1BoxedNumber](#cat1boxednumber) | validateAndBox(Number arg, SchemaConfiguration configuration) | -| [Cat1BoxedBoolean](#cat1boxedboolean) | validateAndBox(boolean arg, SchemaConfiguration configuration) | -| [Cat1BoxedMap](#cat1boxedmap) | validateAndBox(Map<?, ?> arg, SchemaConfiguration configuration) | -| [Cat1BoxedList](#cat1boxedlist) | validateAndBox(List arg, SchemaConfiguration configuration) | -| [Cat1Boxed](#cat1boxed) | validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) | -| @Nullable Object | validate(@Nullable Object arg, SchemaConfiguration configuration) | - -## Schema1Boxed -public sealed interface Schema1Boxed
-permits
-[Schema1BoxedMap](#schema1boxedmap) - -sealed interface that stores validated payloads using boxed classes - -## Schema1BoxedMap -public record Schema1BoxedMap
-implements [Schema1Boxed](#schema1boxed) - -record that stores validated Map payloads, sealed permits implementation - -### Constructor Summary -| Constructor and Description | -| --------------------------- | -| Schema1BoxedMap([Schema1Map](#schema1map) data)
Creates an instance, private visibility | - -### Method Summary -| Modifier and Type | Method and Description | -| ----------------- | ---------------------- | -| [Schema1Map](#schema1map) | data()
validated payload | -| @Nullable Object | getData()
validated payload | - -## Schema1 -public static class Schema1
-extends JsonSchema - -A schema class that validates payloads - -### Code Sample -``` -import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags; -import org.openapijsonschematools.client.configurations.SchemaConfiguration; -import org.openapijsonschematools.client.exceptions.ValidationException; -import org.openapijsonschematools.client.schemas.validation.MapUtils; -import org.openapijsonschematools.client.schemas.validation.FrozenList; -import org.openapijsonschematools.client.schemas.validation.FrozenMap; -import org.openapijsonschematools.client.components.schemas.Cat; - -import java.util.Arrays; -import java.util.List; -import java.util.AbstractMap; - -static final SchemaConfiguration configuration = new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().build()); - -// Map validation -Cat.Schema1Map validatedPayload = - Cat.Schema1.validate( - new Cat.Schema1MapBuilder() - .declawed(true) - - .build(), - configuration -); -``` - -### Field Summary -| Modifier and Type | Field and Description | -| ----------------- | ---------------------- | -| Set> | type = Set.of(Map.class) | -| Map> | properties = Map.ofEntries(
    new PropertyEntry("declawed", [Declawed.class](#declawed)))
)
| - -### Method Summary -| Modifier and Type | Method and Description | -| ----------------- | ---------------------- | -| [Schema1Map](#schema1map) | validate([Map<?, ?>](#schema1mapbuilder) arg, SchemaConfiguration configuration) | -| [Schema1BoxedMap](#schema1boxedmap) | validateAndBox([Map<?, ?>](#schema1mapbuilder) arg, SchemaConfiguration configuration) | -| [Schema1Boxed](#schema1boxed) | validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) | -| @Nullable Object | validate(@Nullable Object arg, SchemaConfiguration configuration) | - -## Schema1MapBuilder -public class Schema1MapBuilder
-builder for `Map` - -A class that builds the Map input type - -### Constructor Summary -| Constructor and Description | -| --------------------------- | -| Schema1MapBuilder()
Creates a builder that contains an empty map | - -### Method Summary -| Modifier and Type | Method and Description | -| ----------------- | ---------------------- | -| Map | build()
Returns map input that should be used with Schema.validate | -| [Schema1MapBuilder](#schema1mapbuilder) | declawed(boolean value) | -| [Schema1MapBuilder](#schema1mapbuilder) | additionalProperty(String key, Nothing? value) | -| [Schema1MapBuilder](#schema1mapbuilder) | additionalProperty(String key, boolean value) | -| [Schema1MapBuilder](#schema1mapbuilder) | additionalProperty(String key, String value) | -| [Schema1MapBuilder](#schema1mapbuilder) | additionalProperty(String key, int value) | -| [Schema1MapBuilder](#schema1mapbuilder) | additionalProperty(String key, float value) | -| [Schema1MapBuilder](#schema1mapbuilder) | additionalProperty(String key, long value) | -| [Schema1MapBuilder](#schema1mapbuilder) | additionalProperty(String key, double value) | -| [Schema1MapBuilder](#schema1mapbuilder) | additionalProperty(String key, List value) | -| [Schema1MapBuilder](#schema1mapbuilder) | additionalProperty(String key, Map value) | - -## Schema1Map -public static class Schema1Map
-extends FrozenMap - -A class to store validated Map payloads - -### Method Summary -| Modifier and Type | Method and Description | -| ----------------- | ---------------------- | -| static [Schema1Map](#schema1map) | of([Map](#schema1mapbuilder) arg, SchemaConfiguration configuration) | -| boolean | declawed()
[optional] | -| @Nullable Object | getAdditionalProperty(String name)
provides type safety for additional properties | - -## DeclawedBoxed -public sealed interface DeclawedBoxed
-permits
-[DeclawedBoxedBoolean](#declawedboxedboolean) - -sealed interface that stores validated payloads using boxed classes - -## DeclawedBoxedBoolean -public record DeclawedBoxedBoolean
-implements [DeclawedBoxed](#declawedboxed) - -record that stores validated boolean payloads, sealed permits implementation - -### Constructor Summary -| Constructor and Description | -| --------------------------- | -| DeclawedBoxedBoolean(boolean data)
Creates an instance, private visibility | - -### Method Summary -| Modifier and Type | Method and Description | -| ----------------- | ---------------------- | -| boolean | data()
validated payload | -| @Nullable Object | getData()
validated payload | - -## Declawed -public static class Declawed
-extends BooleanJsonSchema.BooleanJsonSchema1 - -A schema class that validates payloads - -| Methods Inherited from class org.openapijsonschematools.client.schemas.BooleanJsonSchema.BooleanJsonSchema1 | -| ------------------------------------------------------------------ | -| validate | -| validateAndBox | - -[[Back to top]](#top) [[Back to Component Schemas]](../../../README.md#Component-Schemas) [[Back to README]](../../../README.md) diff --git a/samples/client/petstore/kotlin/docs/components/schemas/Category.md b/samples/client/petstore/kotlin/docs/components/schemas/Category.md deleted file mode 100644 index 64eeb60b4f9..00000000000 --- a/samples/client/petstore/kotlin/docs/components/schemas/Category.md +++ /dev/null @@ -1,262 +0,0 @@ -# Category -org.openapijsonschematools.client.components.schemas.Category.java -public class Category
- -A class that contains necessary nested -- schema classes (which validate payloads), extends JsonSchema -- sealed interfaces which store validated payloads, java version of a sum type -- boxed classes which store validated payloads, sealed permits class implementations -- classes to store validated map payloads, extends FrozenMap -- classes to build inputs for map payloads - -## Nested Class Summary -| Modifier and Type | Class and Description | -| ----------------- | ---------------------- | -| sealed interface | [Category.Category1Boxed](#category1boxed)
sealed interface for validated payloads | -| record | [Category.Category1BoxedMap](#category1boxedmap)
boxed class to store validated Map payloads | -| static class | [Category.Category1](#category1)
schema class | -| static class | [Category.CategoryMapBuilder](#categorymapbuilder)
builder for Map payloads | -| static class | [Category.CategoryMap](#categorymap)
output class for Map payloads | -| sealed interface | [Category.NameBoxed](#nameboxed)
sealed interface for validated payloads | -| record | [Category.NameBoxedString](#nameboxedstring)
boxed class to store validated String payloads | -| static class | [Category.Name](#name)
schema class | -| sealed interface | [Category.IdBoxed](#idboxed)
sealed interface for validated payloads | -| record | [Category.IdBoxedNumber](#idboxednumber)
boxed class to store validated Number payloads | -| static class | [Category.Id](#id)
schema class | - -## Category1Boxed -public sealed interface Category1Boxed
-permits
-[Category1BoxedMap](#category1boxedmap) - -sealed interface that stores validated payloads using boxed classes - -## Category1BoxedMap -public record Category1BoxedMap
-implements [Category1Boxed](#category1boxed) - -record that stores validated Map payloads, sealed permits implementation - -### Constructor Summary -| Constructor and Description | -| --------------------------- | -| Category1BoxedMap([CategoryMap](#categorymap) data)
Creates an instance, private visibility | - -### Method Summary -| Modifier and Type | Method and Description | -| ----------------- | ---------------------- | -| [CategoryMap](#categorymap) | data()
validated payload | -| @Nullable Object | getData()
validated payload | - -## Category1 -public static class Category1
-extends JsonSchema - -A schema class that validates payloads - -### Code Sample -``` -import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags; -import org.openapijsonschematools.client.configurations.SchemaConfiguration; -import org.openapijsonschematools.client.exceptions.ValidationException; -import org.openapijsonschematools.client.schemas.validation.MapUtils; -import org.openapijsonschematools.client.schemas.validation.FrozenList; -import org.openapijsonschematools.client.schemas.validation.FrozenMap; -import org.openapijsonschematools.client.components.schemas.Category; - -import java.util.Arrays; -import java.util.List; -import java.util.AbstractMap; - -static final SchemaConfiguration configuration = new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().build()); - -// Map validation -Category.CategoryMap validatedPayload = - Category.Category1.validate( - new Category.CategoryMapBuilder() - .name("a") - - .id(1L) - - .build(), - configuration -); -``` - -### Field Summary -| Modifier and Type | Field and Description | -| ----------------- | ---------------------- | -| Set> | type = Set.of(Map.class) | -| Map> | properties = Map.ofEntries(
    new PropertyEntry("id", [Id.class](#id))),
    new PropertyEntry("name", [Name.class](#name)))
)
| -| Set | required = Set.of(
    "name"
)
| - -### Method Summary -| Modifier and Type | Method and Description | -| ----------------- | ---------------------- | -| [CategoryMap](#categorymap) | validate([Map<?, ?>](#categorymapbuilder) arg, SchemaConfiguration configuration) | -| [Category1BoxedMap](#category1boxedmap) | validateAndBox([Map<?, ?>](#categorymapbuilder) arg, SchemaConfiguration configuration) | -| [Category1Boxed](#category1boxed) | validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) | -| @Nullable Object | validate(@Nullable Object arg, SchemaConfiguration configuration) | - -## CategoryMap0Builder -public class CategoryMap0Builder
-builder for `Map` - -A class that builds the Map input type - -### Constructor Summary -| Constructor and Description | -| --------------------------- | -| CategoryMap0Builder(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 | -| [CategoryMap0Builder](#categorymap0builder) | id(int value) | -| [CategoryMap0Builder](#categorymap0builder) | id(float value) | -| [CategoryMap0Builder](#categorymap0builder) | id(long value) | -| [CategoryMap0Builder](#categorymap0builder) | id(double value) | -| [CategoryMap0Builder](#categorymap0builder) | additionalProperty(String key, Nothing? value) | -| [CategoryMap0Builder](#categorymap0builder) | additionalProperty(String key, boolean value) | -| [CategoryMap0Builder](#categorymap0builder) | additionalProperty(String key, String value) | -| [CategoryMap0Builder](#categorymap0builder) | additionalProperty(String key, int value) | -| [CategoryMap0Builder](#categorymap0builder) | additionalProperty(String key, float value) | -| [CategoryMap0Builder](#categorymap0builder) | additionalProperty(String key, long value) | -| [CategoryMap0Builder](#categorymap0builder) | additionalProperty(String key, double value) | -| [CategoryMap0Builder](#categorymap0builder) | additionalProperty(String key, List value) | -| [CategoryMap0Builder](#categorymap0builder) | additionalProperty(String key, Map value) | - -## CategoryMapBuilder -public class CategoryMapBuilder
-builder for `Map` - -A class that builds the Map input type - -### Constructor Summary -| Constructor and Description | -| --------------------------- | -| CategoryMapBuilder()
Creates a builder that contains an empty map | - -### Method Summary -| Modifier and Type | Method and Description | -| ----------------- | ---------------------- | -| [CategoryMap0Builder](#categorymap0builder) | name(String value) | - -## CategoryMap -public static class CategoryMap
-extends FrozenMap - -A class to store validated Map payloads - -### Method Summary -| Modifier and Type | Method and Description | -| ----------------- | ---------------------- | -| static [CategoryMap](#categorymap) | of([Map](#categorymapbuilder) arg, SchemaConfiguration configuration) | -| String | name()
if omitted the server will use the default value of default-name | -| Number | id()
[optional] value must be a 64 bit integer | -| @Nullable Object | getAdditionalProperty(String name)
provides type safety for additional properties | - -## NameBoxed -public sealed interface NameBoxed
-permits
-[NameBoxedString](#nameboxedstring) - -sealed interface that stores validated payloads using boxed classes - -## NameBoxedString -public record NameBoxedString
-implements [NameBoxed](#nameboxed) - -record that stores validated String payloads, sealed permits implementation - -### Constructor Summary -| Constructor and Description | -| --------------------------- | -| NameBoxedString(String data)
Creates an instance, private visibility | - -### Method Summary -| Modifier and Type | Method and Description | -| ----------------- | ---------------------- | -| String | data()
validated payload | -| @Nullable Object | getData()
validated payload | - -## Name -public static class Name
-extends JsonSchema - -A schema class that validates payloads - -### Code Sample -``` -import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags; -import org.openapijsonschematools.client.configurations.SchemaConfiguration; -import org.openapijsonschematools.client.exceptions.ValidationException; -import org.openapijsonschematools.client.schemas.validation.MapUtils; -import org.openapijsonschematools.client.schemas.validation.FrozenList; -import org.openapijsonschematools.client.schemas.validation.FrozenMap; -import org.openapijsonschematools.client.components.schemas.Category; - -import java.util.Arrays; -import java.util.List; -import java.util.AbstractMap; - -static final SchemaConfiguration configuration = new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().build()); - -// String validation -String validatedPayload = Category.Name.validate( - "a", - configuration -); -``` - -### Field Summary -| Modifier and Type | Field and Description | -| ----------------- | ---------------------- | -| Set> | type = Set.of(
    String.class
)
| -| @Nullable Object | defaultValue = "default-name" | - -### Method Summary -| Modifier and Type | Method and Description | -| ----------------- | ---------------------- | -| String | validate(String arg, SchemaConfiguration configuration) | -| [NameBoxedString](#nameboxedstring) | validateAndBox(String arg, SchemaConfiguration configuration) | -| [NameBoxed](#nameboxed) | validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) | -| @Nullable Object | validate(@Nullable Object arg, SchemaConfiguration configuration) | - -## IdBoxed -public sealed interface IdBoxed
-permits
-[IdBoxedNumber](#idboxednumber) - -sealed interface that stores validated payloads using boxed classes - -## IdBoxedNumber -public record IdBoxedNumber
-implements [IdBoxed](#idboxed) - -record that stores validated Number payloads, sealed permits implementation - -### Constructor Summary -| Constructor and Description | -| --------------------------- | -| IdBoxedNumber(Number data)
Creates an instance, private visibility | - -### Method Summary -| Modifier and Type | Method and Description | -| ----------------- | ---------------------- | -| Number | data()
validated payload | -| @Nullable Object | getData()
validated payload | - -## Id -public static class Id
-extends Int64JsonSchema.Int64JsonSchema1 - -A schema class that validates payloads - -| Methods Inherited from class org.openapijsonschematools.client.schemas.Int64JsonSchema.Int64JsonSchema1 | -| ------------------------------------------------------------------ | -| validate | -| validateAndBox | - -[[Back to top]](#top) [[Back to Component Schemas]](../../../README.md#Component-Schemas) [[Back to README]](../../../README.md) diff --git a/samples/client/petstore/kotlin/docs/components/schemas/ChildCat.md b/samples/client/petstore/kotlin/docs/components/schemas/ChildCat.md deleted file mode 100644 index 2b44771c4ce..00000000000 --- a/samples/client/petstore/kotlin/docs/components/schemas/ChildCat.md +++ /dev/null @@ -1,324 +0,0 @@ -# ChildCat -org.openapijsonschematools.client.components.schemas.ChildCat.java -public class ChildCat
- -A class that contains necessary nested -- schema classes (which validate payloads), extends JsonSchema -- sealed interfaces which store validated payloads, java version of a sum type -- boxed classes which store validated payloads, sealed permits class implementations -- classes to store validated map payloads, extends FrozenMap -- classes to build inputs for map payloads - -## Nested Class Summary -| Modifier and Type | Class and Description | -| ----------------- | ---------------------- | -| sealed interface | [ChildCat.ChildCat1Boxed](#childcat1boxed)
sealed interface for validated payloads | -| record | [ChildCat.ChildCat1BoxedVoid](#childcat1boxedvoid)
boxed class to store validated null payloads | -| record | [ChildCat.ChildCat1BoxedBoolean](#childcat1boxedboolean)
boxed class to store validated boolean payloads | -| record | [ChildCat.ChildCat1BoxedNumber](#childcat1boxednumber)
boxed class to store validated Number payloads | -| record | [ChildCat.ChildCat1BoxedString](#childcat1boxedstring)
boxed class to store validated String payloads | -| record | [ChildCat.ChildCat1BoxedList](#childcat1boxedlist)
boxed class to store validated List payloads | -| record | [ChildCat.ChildCat1BoxedMap](#childcat1boxedmap)
boxed class to store validated Map payloads | -| static class | [ChildCat.ChildCat1](#childcat1)
schema class | -| sealed interface | [ChildCat.Schema1Boxed](#schema1boxed)
sealed interface for validated payloads | -| record | [ChildCat.Schema1BoxedMap](#schema1boxedmap)
boxed class to store validated Map payloads | -| static class | [ChildCat.Schema1](#schema1)
schema class | -| static class | [ChildCat.Schema1MapBuilder](#schema1mapbuilder)
builder for Map payloads | -| static class | [ChildCat.Schema1Map](#schema1map)
output class for Map payloads | -| sealed interface | [ChildCat.NameBoxed](#nameboxed)
sealed interface for validated payloads | -| record | [ChildCat.NameBoxedString](#nameboxedstring)
boxed class to store validated String payloads | -| static class | [ChildCat.Name](#name)
schema class | - -## ChildCat1Boxed -public sealed interface ChildCat1Boxed
-permits
-[ChildCat1BoxedVoid](#childcat1boxedvoid), -[ChildCat1BoxedBoolean](#childcat1boxedboolean), -[ChildCat1BoxedNumber](#childcat1boxednumber), -[ChildCat1BoxedString](#childcat1boxedstring), -[ChildCat1BoxedList](#childcat1boxedlist), -[ChildCat1BoxedMap](#childcat1boxedmap) - -sealed interface that stores validated payloads using boxed classes - -## ChildCat1BoxedVoid -public record ChildCat1BoxedVoid
-implements [ChildCat1Boxed](#childcat1boxed) - -record that stores validated null payloads, sealed permits implementation - -### Constructor Summary -| Constructor and Description | -| --------------------------- | -| ChildCat1BoxedVoid(Nothing? data)
Creates an instance, private visibility | - -### Method Summary -| Modifier and Type | Method and Description | -| ----------------- | ---------------------- | -| Nothing? | data()
validated payload | -| @Nullable Object | getData()
validated payload | - -## ChildCat1BoxedBoolean -public record ChildCat1BoxedBoolean
-implements [ChildCat1Boxed](#childcat1boxed) - -record that stores validated boolean payloads, sealed permits implementation - -### Constructor Summary -| Constructor and Description | -| --------------------------- | -| ChildCat1BoxedBoolean(boolean data)
Creates an instance, private visibility | - -### Method Summary -| Modifier and Type | Method and Description | -| ----------------- | ---------------------- | -| boolean | data()
validated payload | -| @Nullable Object | getData()
validated payload | - -## ChildCat1BoxedNumber -public record ChildCat1BoxedNumber
-implements [ChildCat1Boxed](#childcat1boxed) - -record that stores validated Number payloads, sealed permits implementation - -### Constructor Summary -| Constructor and Description | -| --------------------------- | -| ChildCat1BoxedNumber(Number data)
Creates an instance, private visibility | - -### Method Summary -| Modifier and Type | Method and Description | -| ----------------- | ---------------------- | -| Number | data()
validated payload | -| @Nullable Object | getData()
validated payload | - -## ChildCat1BoxedString -public record ChildCat1BoxedString
-implements [ChildCat1Boxed](#childcat1boxed) - -record that stores validated String payloads, sealed permits implementation - -### Constructor Summary -| Constructor and Description | -| --------------------------- | -| ChildCat1BoxedString(String data)
Creates an instance, private visibility | - -### Method Summary -| Modifier and Type | Method and Description | -| ----------------- | ---------------------- | -| String | data()
validated payload | -| @Nullable Object | getData()
validated payload | - -## ChildCat1BoxedList -public record ChildCat1BoxedList
-implements [ChildCat1Boxed](#childcat1boxed) - -record that stores validated List payloads, sealed permits implementation - -### Constructor Summary -| Constructor and Description | -| --------------------------- | -| ChildCat1BoxedList(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 | - -## ChildCat1BoxedMap -public record ChildCat1BoxedMap
-implements [ChildCat1Boxed](#childcat1boxed) - -record that stores validated Map payloads, sealed permits implementation - -### Constructor Summary -| Constructor and Description | -| --------------------------- | -| ChildCat1BoxedMap(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 | - -## ChildCat1 -public static class ChildCat1
-extends JsonSchema - -A schema class that validates payloads - -### Field Summary -| Modifier and Type | Field and Description | -| ----------------- | ---------------------- | -| List> | allOf = List.of(
    [ParentPet.ParentPet1.class](../../components/schemas/ParentPet.md#parentpet1),
    [Schema1.class](#schema1)
;)
| - -### Method Summary -| Modifier and Type | Method and Description | -| ----------------- | ---------------------- | -| String | validate(String arg, SchemaConfiguration configuration) | -| Nothing? | validate(Nothing? arg, SchemaConfiguration configuration) | -| int | validate(int arg, SchemaConfiguration configuration) | -| long | validate(long arg, SchemaConfiguration configuration) | -| float | validate(float arg, SchemaConfiguration configuration) | -| double | validate(double arg, SchemaConfiguration configuration) | -| Number | validate(Number arg, SchemaConfiguration configuration) | -| boolean | validate(boolean arg, SchemaConfiguration configuration) | -| FrozenMap<@Nullable Object> | validate(Map<?, ?> arg, SchemaConfiguration configuration) | -| FrozenList<@Nullable Object> | validate(List arg, SchemaConfiguration configuration) | -| [ChildCat1BoxedString](#childcat1boxedstring) | validateAndBox(String arg, SchemaConfiguration configuration) | -| [ChildCat1BoxedVoid](#childcat1boxedvoid) | validateAndBox(Nothing? arg, SchemaConfiguration configuration) | -| [ChildCat1BoxedNumber](#childcat1boxednumber) | validateAndBox(Number arg, SchemaConfiguration configuration) | -| [ChildCat1BoxedBoolean](#childcat1boxedboolean) | validateAndBox(boolean arg, SchemaConfiguration configuration) | -| [ChildCat1BoxedMap](#childcat1boxedmap) | validateAndBox(Map<?, ?> arg, SchemaConfiguration configuration) | -| [ChildCat1BoxedList](#childcat1boxedlist) | validateAndBox(List arg, SchemaConfiguration configuration) | -| [ChildCat1Boxed](#childcat1boxed) | validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) | -| @Nullable Object | validate(@Nullable Object arg, SchemaConfiguration configuration) | - -## Schema1Boxed -public sealed interface Schema1Boxed
-permits
-[Schema1BoxedMap](#schema1boxedmap) - -sealed interface that stores validated payloads using boxed classes - -## Schema1BoxedMap -public record Schema1BoxedMap
-implements [Schema1Boxed](#schema1boxed) - -record that stores validated Map payloads, sealed permits implementation - -### Constructor Summary -| Constructor and Description | -| --------------------------- | -| Schema1BoxedMap([Schema1Map](#schema1map) data)
Creates an instance, private visibility | - -### Method Summary -| Modifier and Type | Method and Description | -| ----------------- | ---------------------- | -| [Schema1Map](#schema1map) | data()
validated payload | -| @Nullable Object | getData()
validated payload | - -## Schema1 -public static class Schema1
-extends JsonSchema - -A schema class that validates payloads - -### Code Sample -``` -import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags; -import org.openapijsonschematools.client.configurations.SchemaConfiguration; -import org.openapijsonschematools.client.exceptions.ValidationException; -import org.openapijsonschematools.client.schemas.validation.MapUtils; -import org.openapijsonschematools.client.schemas.validation.FrozenList; -import org.openapijsonschematools.client.schemas.validation.FrozenMap; -import org.openapijsonschematools.client.components.schemas.ChildCat; - -import java.util.Arrays; -import java.util.List; -import java.util.AbstractMap; - -static final SchemaConfiguration configuration = new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().build()); - -// Map validation -ChildCat.Schema1Map validatedPayload = - ChildCat.Schema1.validate( - new ChildCat.Schema1MapBuilder() - .name("a") - - .build(), - configuration -); -``` - -### Field Summary -| Modifier and Type | Field and Description | -| ----------------- | ---------------------- | -| Set> | type = Set.of(Map.class) | -| Map> | properties = Map.ofEntries(
    new PropertyEntry("name", [Name.class](#name)))
)
| - -### Method Summary -| Modifier and Type | Method and Description | -| ----------------- | ---------------------- | -| [Schema1Map](#schema1map) | validate([Map<?, ?>](#schema1mapbuilder) arg, SchemaConfiguration configuration) | -| [Schema1BoxedMap](#schema1boxedmap) | validateAndBox([Map<?, ?>](#schema1mapbuilder) arg, SchemaConfiguration configuration) | -| [Schema1Boxed](#schema1boxed) | validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) | -| @Nullable Object | validate(@Nullable Object arg, SchemaConfiguration configuration) | - -## Schema1MapBuilder -public class Schema1MapBuilder
-builder for `Map` - -A class that builds the Map input type - -### Constructor Summary -| Constructor and Description | -| --------------------------- | -| Schema1MapBuilder()
Creates a builder that contains an empty map | - -### Method Summary -| Modifier and Type | Method and Description | -| ----------------- | ---------------------- | -| Map | build()
Returns map input that should be used with Schema.validate | -| [Schema1MapBuilder](#schema1mapbuilder) | name(String value) | -| [Schema1MapBuilder](#schema1mapbuilder) | additionalProperty(String key, Nothing? value) | -| [Schema1MapBuilder](#schema1mapbuilder) | additionalProperty(String key, boolean value) | -| [Schema1MapBuilder](#schema1mapbuilder) | additionalProperty(String key, String value) | -| [Schema1MapBuilder](#schema1mapbuilder) | additionalProperty(String key, int value) | -| [Schema1MapBuilder](#schema1mapbuilder) | additionalProperty(String key, float value) | -| [Schema1MapBuilder](#schema1mapbuilder) | additionalProperty(String key, long value) | -| [Schema1MapBuilder](#schema1mapbuilder) | additionalProperty(String key, double value) | -| [Schema1MapBuilder](#schema1mapbuilder) | additionalProperty(String key, List value) | -| [Schema1MapBuilder](#schema1mapbuilder) | additionalProperty(String key, Map value) | - -## Schema1Map -public static class Schema1Map
-extends FrozenMap - -A class to store validated Map payloads - -### Method Summary -| Modifier and Type | Method and Description | -| ----------------- | ---------------------- | -| static [Schema1Map](#schema1map) | of([Map](#schema1mapbuilder) arg, SchemaConfiguration configuration) | -| String | name()
[optional] | -| @Nullable Object | getAdditionalProperty(String name)
provides type safety for additional properties | - -## NameBoxed -public sealed interface NameBoxed
-permits
-[NameBoxedString](#nameboxedstring) - -sealed interface that stores validated payloads using boxed classes - -## NameBoxedString -public record NameBoxedString
-implements [NameBoxed](#nameboxed) - -record that stores validated String payloads, sealed permits implementation - -### Constructor Summary -| Constructor and Description | -| --------------------------- | -| NameBoxedString(String data)
Creates an instance, private visibility | - -### Method Summary -| Modifier and Type | Method and Description | -| ----------------- | ---------------------- | -| String | data()
validated payload | -| @Nullable Object | getData()
validated payload | - -## Name -public static class Name
-extends StringJsonSchema.StringJsonSchema1 - -A schema class that validates payloads - -| Methods Inherited from class org.openapijsonschematools.client.schemas.StringJsonSchema.StringJsonSchema1 | -| ------------------------------------------------------------------ | -| validate | -| validateAndBox | - -[[Back to top]](#top) [[Back to Component Schemas]](../../../README.md#Component-Schemas) [[Back to README]](../../../README.md) diff --git a/samples/client/petstore/kotlin/docs/components/schemas/ClassModel.md b/samples/client/petstore/kotlin/docs/components/schemas/ClassModel.md deleted file mode 100644 index 01df2ad6103..00000000000 --- a/samples/client/petstore/kotlin/docs/components/schemas/ClassModel.md +++ /dev/null @@ -1,253 +0,0 @@ -# ClassModel -org.openapijsonschematools.client.components.schemas.ClassModel.java -public class ClassModel
- -A class that contains necessary nested -- schema classes (which validate payloads), extends JsonSchema -- sealed interfaces which store validated payloads, java version of a sum type -- boxed classes which store validated payloads, sealed permits class implementations -- classes to store validated map payloads, extends FrozenMap -- classes to build inputs for map payloads - -## Nested Class Summary -| Modifier and Type | Class and Description | -| ----------------- | ---------------------- | -| sealed interface | [ClassModel.ClassModel1Boxed](#classmodel1boxed)
sealed interface for validated payloads | -| record | [ClassModel.ClassModel1BoxedVoid](#classmodel1boxedvoid)
boxed class to store validated null payloads | -| record | [ClassModel.ClassModel1BoxedBoolean](#classmodel1boxedboolean)
boxed class to store validated boolean payloads | -| record | [ClassModel.ClassModel1BoxedNumber](#classmodel1boxednumber)
boxed class to store validated Number payloads | -| record | [ClassModel.ClassModel1BoxedString](#classmodel1boxedstring)
boxed class to store validated String payloads | -| record | [ClassModel.ClassModel1BoxedList](#classmodel1boxedlist)
boxed class to store validated List payloads | -| record | [ClassModel.ClassModel1BoxedMap](#classmodel1boxedmap)
boxed class to store validated Map payloads | -| static class | [ClassModel.ClassModel1](#classmodel1)
schema class | -| static class | [ClassModel.ClassModelMapBuilder](#classmodelmapbuilder)
builder for Map payloads | -| static class | [ClassModel.ClassModelMap](#classmodelmap)
output class for Map payloads | -| sealed interface | [ClassModel.ClassSchemaBoxed](#classschemaboxed)
sealed interface for validated payloads | -| record | [ClassModel.ClassSchemaBoxedString](#classschemaboxedstring)
boxed class to store validated String payloads | -| static class | [ClassModel.ClassSchema](#classschema)
schema class | - -## ClassModel1Boxed -public sealed interface ClassModel1Boxed
-permits
-[ClassModel1BoxedVoid](#classmodel1boxedvoid), -[ClassModel1BoxedBoolean](#classmodel1boxedboolean), -[ClassModel1BoxedNumber](#classmodel1boxednumber), -[ClassModel1BoxedString](#classmodel1boxedstring), -[ClassModel1BoxedList](#classmodel1boxedlist), -[ClassModel1BoxedMap](#classmodel1boxedmap) - -sealed interface that stores validated payloads using boxed classes - -## ClassModel1BoxedVoid -public record ClassModel1BoxedVoid
-implements [ClassModel1Boxed](#classmodel1boxed) - -record that stores validated null payloads, sealed permits implementation - -### Constructor Summary -| Constructor and Description | -| --------------------------- | -| ClassModel1BoxedVoid(Nothing? data)
Creates an instance, private visibility | - -### Method Summary -| Modifier and Type | Method and Description | -| ----------------- | ---------------------- | -| Nothing? | data()
validated payload | -| @Nullable Object | getData()
validated payload | - -## ClassModel1BoxedBoolean -public record ClassModel1BoxedBoolean
-implements [ClassModel1Boxed](#classmodel1boxed) - -record that stores validated boolean payloads, sealed permits implementation - -### Constructor Summary -| Constructor and Description | -| --------------------------- | -| ClassModel1BoxedBoolean(boolean data)
Creates an instance, private visibility | - -### Method Summary -| Modifier and Type | Method and Description | -| ----------------- | ---------------------- | -| boolean | data()
validated payload | -| @Nullable Object | getData()
validated payload | - -## ClassModel1BoxedNumber -public record ClassModel1BoxedNumber
-implements [ClassModel1Boxed](#classmodel1boxed) - -record that stores validated Number payloads, sealed permits implementation - -### Constructor Summary -| Constructor and Description | -| --------------------------- | -| ClassModel1BoxedNumber(Number data)
Creates an instance, private visibility | - -### Method Summary -| Modifier and Type | Method and Description | -| ----------------- | ---------------------- | -| Number | data()
validated payload | -| @Nullable Object | getData()
validated payload | - -## ClassModel1BoxedString -public record ClassModel1BoxedString
-implements [ClassModel1Boxed](#classmodel1boxed) - -record that stores validated String payloads, sealed permits implementation - -### Constructor Summary -| Constructor and Description | -| --------------------------- | -| ClassModel1BoxedString(String data)
Creates an instance, private visibility | - -### Method Summary -| Modifier and Type | Method and Description | -| ----------------- | ---------------------- | -| String | data()
validated payload | -| @Nullable Object | getData()
validated payload | - -## ClassModel1BoxedList -public record ClassModel1BoxedList
-implements [ClassModel1Boxed](#classmodel1boxed) - -record that stores validated List payloads, sealed permits implementation - -### Constructor Summary -| Constructor and Description | -| --------------------------- | -| ClassModel1BoxedList(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 | - -## ClassModel1BoxedMap -public record ClassModel1BoxedMap
-implements [ClassModel1Boxed](#classmodel1boxed) - -record that stores validated Map payloads, sealed permits implementation - -### Constructor Summary -| Constructor and Description | -| --------------------------- | -| ClassModel1BoxedMap([ClassModelMap](#classmodelmap) data)
Creates an instance, private visibility | - -### Method Summary -| Modifier and Type | Method and Description | -| ----------------- | ---------------------- | -| [ClassModelMap](#classmodelmap) | data()
validated payload | -| @Nullable Object | getData()
validated payload | - -## ClassModel1 -public static class ClassModel1
-extends JsonSchema - -A schema class that validates payloads - -## Description -Model for testing model with "_class" property - -### Field Summary -| Modifier and Type | Field and Description | -| ----------------- | ---------------------- | -| Map> | properties = Map.ofEntries(
    new PropertyEntry("_class", [ClassSchema.class](#classschema)))
)
| - -### Method Summary -| Modifier and Type | Method and Description | -| ----------------- | ---------------------- | -| String | validate(String arg, SchemaConfiguration configuration) | -| Nothing? | validate(Nothing? arg, SchemaConfiguration configuration) | -| int | validate(int arg, SchemaConfiguration configuration) | -| long | validate(long arg, SchemaConfiguration configuration) | -| float | validate(float arg, SchemaConfiguration configuration) | -| double | validate(double arg, SchemaConfiguration configuration) | -| Number | validate(Number arg, SchemaConfiguration configuration) | -| boolean | validate(boolean arg, SchemaConfiguration configuration) | -| [ClassModelMap](#classmodelmap) | validate([Map<?, ?>](#classmodelmapbuilder) arg, SchemaConfiguration configuration) | -| FrozenList<@Nullable Object> | validate(List arg, SchemaConfiguration configuration) | -| [ClassModel1BoxedString](#classmodel1boxedstring) | validateAndBox(String arg, SchemaConfiguration configuration) | -| [ClassModel1BoxedVoid](#classmodel1boxedvoid) | validateAndBox(Nothing? arg, SchemaConfiguration configuration) | -| [ClassModel1BoxedNumber](#classmodel1boxednumber) | validateAndBox(Number arg, SchemaConfiguration configuration) | -| [ClassModel1BoxedBoolean](#classmodel1boxedboolean) | validateAndBox(boolean arg, SchemaConfiguration configuration) | -| [ClassModel1BoxedMap](#classmodel1boxedmap) | validateAndBox([Map<?, ?>](#classmodelmapbuilder) arg, SchemaConfiguration configuration) | -| [ClassModel1BoxedList](#classmodel1boxedlist) | validateAndBox(List arg, SchemaConfiguration configuration) | -| [ClassModel1Boxed](#classmodel1boxed) | validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) | -| @Nullable Object | validate(@Nullable Object arg, SchemaConfiguration configuration) | - -## ClassModelMapBuilder -public class ClassModelMapBuilder
-builder for `Map` - -A class that builds the Map input type - -### Constructor Summary -| Constructor and Description | -| --------------------------- | -| ClassModelMapBuilder()
Creates a builder that contains an empty map | - -### Method Summary -| Modifier and Type | Method and Description | -| ----------------- | ---------------------- | -| Map | build()
Returns map input that should be used with Schema.validate | -| [ClassModelMapBuilder](#classmodelmapbuilder) | lowLineClass(String value) | -| [ClassModelMapBuilder](#classmodelmapbuilder) | additionalProperty(String key, Nothing? value) | -| [ClassModelMapBuilder](#classmodelmapbuilder) | additionalProperty(String key, boolean value) | -| [ClassModelMapBuilder](#classmodelmapbuilder) | additionalProperty(String key, String value) | -| [ClassModelMapBuilder](#classmodelmapbuilder) | additionalProperty(String key, int value) | -| [ClassModelMapBuilder](#classmodelmapbuilder) | additionalProperty(String key, float value) | -| [ClassModelMapBuilder](#classmodelmapbuilder) | additionalProperty(String key, long value) | -| [ClassModelMapBuilder](#classmodelmapbuilder) | additionalProperty(String key, double value) | -| [ClassModelMapBuilder](#classmodelmapbuilder) | additionalProperty(String key, List value) | -| [ClassModelMapBuilder](#classmodelmapbuilder) | additionalProperty(String key, Map value) | - -## ClassModelMap -public static class ClassModelMap
-extends FrozenMap - -A class to store validated Map payloads - -### Method Summary -| Modifier and Type | Method and Description | -| ----------------- | ---------------------- | -| static [ClassModelMap](#classmodelmap) | of([Map](#classmodelmapbuilder) arg, SchemaConfiguration configuration) | -| @Nullable Object | get(String key)
This schema has invalid Java names so this method must be used when you access instance["_class"], | -| @Nullable Object | getAdditionalProperty(String name)
provides type safety for additional properties | - -## ClassSchemaBoxed -public sealed interface ClassSchemaBoxed
-permits
-[ClassSchemaBoxedString](#classschemaboxedstring) - -sealed interface that stores validated payloads using boxed classes - -## ClassSchemaBoxedString -public record ClassSchemaBoxedString
-implements [ClassSchemaBoxed](#classschemaboxed) - -record that stores validated String payloads, sealed permits implementation - -### Constructor Summary -| Constructor and Description | -| --------------------------- | -| ClassSchemaBoxedString(String data)
Creates an instance, private visibility | - -### Method Summary -| Modifier and Type | Method and Description | -| ----------------- | ---------------------- | -| String | data()
validated payload | -| @Nullable Object | getData()
validated payload | - -## ClassSchema -public static class ClassSchema
-extends StringJsonSchema.StringJsonSchema1 - -A schema class that validates payloads - -| Methods Inherited from class org.openapijsonschematools.client.schemas.StringJsonSchema.StringJsonSchema1 | -| ------------------------------------------------------------------ | -| validate | -| validateAndBox | - -[[Back to top]](#top) [[Back to Component Schemas]](../../../README.md#Component-Schemas) [[Back to README]](../../../README.md) diff --git a/samples/client/petstore/kotlin/docs/components/schemas/Client.md b/samples/client/petstore/kotlin/docs/components/schemas/Client.md deleted file mode 100644 index 41d2ebd6380..00000000000 --- a/samples/client/petstore/kotlin/docs/components/schemas/Client.md +++ /dev/null @@ -1,169 +0,0 @@ -# Client -org.openapijsonschematools.client.components.schemas.Client.java -public class Client
- -A class that contains necessary nested -- schema classes (which validate payloads), extends JsonSchema -- sealed interfaces which store validated payloads, java version of a sum type -- boxed classes which store validated payloads, sealed permits class implementations -- classes to store validated map payloads, extends FrozenMap -- classes to build inputs for map payloads - -## Nested Class Summary -| Modifier and Type | Class and Description | -| ----------------- | ---------------------- | -| sealed interface | [Client.Client1Boxed](#client1boxed)
sealed interface for validated payloads | -| record | [Client.Client1BoxedMap](#client1boxedmap)
boxed class to store validated Map payloads | -| static class | [Client.Client1](#client1)
schema class | -| static class | [Client.ClientMapBuilder1](#clientmapbuilder1)
builder for Map payloads | -| static class | [Client.ClientMap](#clientmap)
output class for Map payloads | -| sealed interface | [Client.Client2Boxed](#client2boxed)
sealed interface for validated payloads | -| record | [Client.Client2BoxedString](#client2boxedstring)
boxed class to store validated String payloads | -| static class | [Client.Client2](#client2)
schema class | - -## Client1Boxed -public sealed interface Client1Boxed
-permits
-[Client1BoxedMap](#client1boxedmap) - -sealed interface that stores validated payloads using boxed classes - -## Client1BoxedMap -public record Client1BoxedMap
-implements [Client1Boxed](#client1boxed) - -record that stores validated Map payloads, sealed permits implementation - -### Constructor Summary -| Constructor and Description | -| --------------------------- | -| Client1BoxedMap([ClientMap](#clientmap) data)
Creates an instance, private visibility | - -### Method Summary -| Modifier and Type | Method and Description | -| ----------------- | ---------------------- | -| [ClientMap](#clientmap) | data()
validated payload | -| @Nullable Object | getData()
validated payload | - -## Client1 -public static class Client1
-extends JsonSchema - -A schema class that validates payloads - -### Code Sample -``` -import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags; -import org.openapijsonschematools.client.configurations.SchemaConfiguration; -import org.openapijsonschematools.client.exceptions.ValidationException; -import org.openapijsonschematools.client.schemas.validation.MapUtils; -import org.openapijsonschematools.client.schemas.validation.FrozenList; -import org.openapijsonschematools.client.schemas.validation.FrozenMap; -import org.openapijsonschematools.client.components.schemas.Client; - -import java.util.Arrays; -import java.util.List; -import java.util.AbstractMap; - -static final SchemaConfiguration configuration = new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().build()); - -// Map validation -Client.ClientMap validatedPayload = - Client.Client1.validate( - new Client.ClientMapBuilder1() - .client("a") - - .build(), - configuration -); -``` - -### Field Summary -| Modifier and Type | Field and Description | -| ----------------- | ---------------------- | -| Set> | type = Set.of(Map.class) | -| Map> | properties = Map.ofEntries(
    new PropertyEntry("client", [Client2.class](#client2)))
)
| - -### Method Summary -| Modifier and Type | Method and Description | -| ----------------- | ---------------------- | -| [ClientMap](#clientmap) | validate([Map<?, ?>](#clientmapbuilder1) arg, SchemaConfiguration configuration) | -| [Client1BoxedMap](#client1boxedmap) | validateAndBox([Map<?, ?>](#clientmapbuilder1) arg, SchemaConfiguration configuration) | -| [Client1Boxed](#client1boxed) | validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) | -| @Nullable Object | validate(@Nullable Object arg, SchemaConfiguration configuration) | - -## ClientMapBuilder1 -public class ClientMapBuilder1
-builder for `Map` - -A class that builds the Map input type - -### Constructor Summary -| Constructor and Description | -| --------------------------- | -| ClientMapBuilder1()
Creates a builder that contains an empty map | - -### Method Summary -| Modifier and Type | Method and Description | -| ----------------- | ---------------------- | -| Map | build()
Returns map input that should be used with Schema.validate | -| [ClientMapBuilder1](#clientmapbuilder1) | client(String value) | -| [ClientMapBuilder1](#clientmapbuilder1) | additionalProperty(String key, Nothing? value) | -| [ClientMapBuilder1](#clientmapbuilder1) | additionalProperty(String key, boolean value) | -| [ClientMapBuilder1](#clientmapbuilder1) | additionalProperty(String key, String value) | -| [ClientMapBuilder1](#clientmapbuilder1) | additionalProperty(String key, int value) | -| [ClientMapBuilder1](#clientmapbuilder1) | additionalProperty(String key, float value) | -| [ClientMapBuilder1](#clientmapbuilder1) | additionalProperty(String key, long value) | -| [ClientMapBuilder1](#clientmapbuilder1) | additionalProperty(String key, double value) | -| [ClientMapBuilder1](#clientmapbuilder1) | additionalProperty(String key, List value) | -| [ClientMapBuilder1](#clientmapbuilder1) | additionalProperty(String key, Map value) | - -## ClientMap -public static class ClientMap
-extends FrozenMap - -A class to store validated Map payloads - -### Method Summary -| Modifier and Type | Method and Description | -| ----------------- | ---------------------- | -| static [ClientMap](#clientmap) | of([Map](#clientmapbuilder1) arg, SchemaConfiguration configuration) | -| String | client()
[optional] | -| @Nullable Object | getAdditionalProperty(String name)
provides type safety for additional properties | - -## Client2Boxed -public sealed interface Client2Boxed
-permits
-[Client2BoxedString](#client2boxedstring) - -sealed interface that stores validated payloads using boxed classes - -## Client2BoxedString -public record Client2BoxedString
-implements [Client2Boxed](#client2boxed) - -record that stores validated String payloads, sealed permits implementation - -### Constructor Summary -| Constructor and Description | -| --------------------------- | -| Client2BoxedString(String data)
Creates an instance, private visibility | - -### Method Summary -| Modifier and Type | Method and Description | -| ----------------- | ---------------------- | -| String | data()
validated payload | -| @Nullable Object | getData()
validated payload | - -## Client2 -public static class Client2
-extends StringJsonSchema.StringJsonSchema1 - -A schema class that validates payloads - -| Methods Inherited from class org.openapijsonschematools.client.schemas.StringJsonSchema.StringJsonSchema1 | -| ------------------------------------------------------------------ | -| validate | -| validateAndBox | - -[[Back to top]](#top) [[Back to Component Schemas]](../../../README.md#Component-Schemas) [[Back to README]](../../../README.md) diff --git a/samples/client/petstore/kotlin/docs/components/schemas/ComplexQuadrilateral.md b/samples/client/petstore/kotlin/docs/components/schemas/ComplexQuadrilateral.md deleted file mode 100644 index 378f2be1679..00000000000 --- a/samples/client/petstore/kotlin/docs/components/schemas/ComplexQuadrilateral.md +++ /dev/null @@ -1,371 +0,0 @@ -# ComplexQuadrilateral -org.openapijsonschematools.client.components.schemas.ComplexQuadrilateral.java -public class ComplexQuadrilateral
- -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 | [ComplexQuadrilateral.ComplexQuadrilateral1Boxed](#complexquadrilateral1boxed)
sealed interface for validated payloads | -| record | [ComplexQuadrilateral.ComplexQuadrilateral1BoxedVoid](#complexquadrilateral1boxedvoid)
boxed class to store validated null payloads | -| record | [ComplexQuadrilateral.ComplexQuadrilateral1BoxedBoolean](#complexquadrilateral1boxedboolean)
boxed class to store validated boolean payloads | -| record | [ComplexQuadrilateral.ComplexQuadrilateral1BoxedNumber](#complexquadrilateral1boxednumber)
boxed class to store validated Number payloads | -| record | [ComplexQuadrilateral.ComplexQuadrilateral1BoxedString](#complexquadrilateral1boxedstring)
boxed class to store validated String payloads | -| record | [ComplexQuadrilateral.ComplexQuadrilateral1BoxedList](#complexquadrilateral1boxedlist)
boxed class to store validated List payloads | -| record | [ComplexQuadrilateral.ComplexQuadrilateral1BoxedMap](#complexquadrilateral1boxedmap)
boxed class to store validated Map payloads | -| static class | [ComplexQuadrilateral.ComplexQuadrilateral1](#complexquadrilateral1)
schema class | -| sealed interface | [ComplexQuadrilateral.Schema1Boxed](#schema1boxed)
sealed interface for validated payloads | -| record | [ComplexQuadrilateral.Schema1BoxedMap](#schema1boxedmap)
boxed class to store validated Map payloads | -| static class | [ComplexQuadrilateral.Schema1](#schema1)
schema class | -| static class | [ComplexQuadrilateral.Schema1MapBuilder](#schema1mapbuilder)
builder for Map payloads | -| static class | [ComplexQuadrilateral.Schema1Map](#schema1map)
output class for Map payloads | -| sealed interface | [ComplexQuadrilateral.QuadrilateralTypeBoxed](#quadrilateraltypeboxed)
sealed interface for validated payloads | -| record | [ComplexQuadrilateral.QuadrilateralTypeBoxedString](#quadrilateraltypeboxedstring)
boxed class to store validated String payloads | -| static class | [ComplexQuadrilateral.QuadrilateralType](#quadrilateraltype)
schema class | -| enum | [ComplexQuadrilateral.StringQuadrilateralTypeEnums](#stringquadrilateraltypeenums)
String enum | - -## ComplexQuadrilateral1Boxed -public sealed interface ComplexQuadrilateral1Boxed
-permits
-[ComplexQuadrilateral1BoxedVoid](#complexquadrilateral1boxedvoid), -[ComplexQuadrilateral1BoxedBoolean](#complexquadrilateral1boxedboolean), -[ComplexQuadrilateral1BoxedNumber](#complexquadrilateral1boxednumber), -[ComplexQuadrilateral1BoxedString](#complexquadrilateral1boxedstring), -[ComplexQuadrilateral1BoxedList](#complexquadrilateral1boxedlist), -[ComplexQuadrilateral1BoxedMap](#complexquadrilateral1boxedmap) - -sealed interface that stores validated payloads using boxed classes - -## ComplexQuadrilateral1BoxedVoid -public record ComplexQuadrilateral1BoxedVoid
-implements [ComplexQuadrilateral1Boxed](#complexquadrilateral1boxed) - -record that stores validated null payloads, sealed permits implementation - -### Constructor Summary -| Constructor and Description | -| --------------------------- | -| ComplexQuadrilateral1BoxedVoid(Nothing? data)
Creates an instance, private visibility | - -### Method Summary -| Modifier and Type | Method and Description | -| ----------------- | ---------------------- | -| Nothing? | data()
validated payload | -| @Nullable Object | getData()
validated payload | - -## ComplexQuadrilateral1BoxedBoolean -public record ComplexQuadrilateral1BoxedBoolean
-implements [ComplexQuadrilateral1Boxed](#complexquadrilateral1boxed) - -record that stores validated boolean payloads, sealed permits implementation - -### Constructor Summary -| Constructor and Description | -| --------------------------- | -| ComplexQuadrilateral1BoxedBoolean(boolean data)
Creates an instance, private visibility | - -### Method Summary -| Modifier and Type | Method and Description | -| ----------------- | ---------------------- | -| boolean | data()
validated payload | -| @Nullable Object | getData()
validated payload | - -## ComplexQuadrilateral1BoxedNumber -public record ComplexQuadrilateral1BoxedNumber
-implements [ComplexQuadrilateral1Boxed](#complexquadrilateral1boxed) - -record that stores validated Number payloads, sealed permits implementation - -### Constructor Summary -| Constructor and Description | -| --------------------------- | -| ComplexQuadrilateral1BoxedNumber(Number data)
Creates an instance, private visibility | - -### Method Summary -| Modifier and Type | Method and Description | -| ----------------- | ---------------------- | -| Number | data()
validated payload | -| @Nullable Object | getData()
validated payload | - -## ComplexQuadrilateral1BoxedString -public record ComplexQuadrilateral1BoxedString
-implements [ComplexQuadrilateral1Boxed](#complexquadrilateral1boxed) - -record that stores validated String payloads, sealed permits implementation - -### Constructor Summary -| Constructor and Description | -| --------------------------- | -| ComplexQuadrilateral1BoxedString(String data)
Creates an instance, private visibility | - -### Method Summary -| Modifier and Type | Method and Description | -| ----------------- | ---------------------- | -| String | data()
validated payload | -| @Nullable Object | getData()
validated payload | - -## ComplexQuadrilateral1BoxedList -public record ComplexQuadrilateral1BoxedList
-implements [ComplexQuadrilateral1Boxed](#complexquadrilateral1boxed) - -record that stores validated List payloads, sealed permits implementation - -### Constructor Summary -| Constructor and Description | -| --------------------------- | -| ComplexQuadrilateral1BoxedList(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 | - -## ComplexQuadrilateral1BoxedMap -public record ComplexQuadrilateral1BoxedMap
-implements [ComplexQuadrilateral1Boxed](#complexquadrilateral1boxed) - -record that stores validated Map payloads, sealed permits implementation - -### Constructor Summary -| Constructor and Description | -| --------------------------- | -| ComplexQuadrilateral1BoxedMap(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 | - -## ComplexQuadrilateral1 -public static class ComplexQuadrilateral1
-extends JsonSchema - -A schema class that validates payloads - -### Field Summary -| Modifier and Type | Field and Description | -| ----------------- | ---------------------- | -| List> | allOf = List.of(
    [QuadrilateralInterface.QuadrilateralInterface1.class](../../components/schemas/QuadrilateralInterface.md#quadrilateralinterface1),
    [Schema1.class](#schema1)
;)
| - -### Method Summary -| Modifier and Type | Method and Description | -| ----------------- | ---------------------- | -| String | validate(String arg, SchemaConfiguration configuration) | -| Nothing? | validate(Nothing? arg, SchemaConfiguration configuration) | -| int | validate(int arg, SchemaConfiguration configuration) | -| long | validate(long arg, SchemaConfiguration configuration) | -| float | validate(float arg, SchemaConfiguration configuration) | -| double | validate(double arg, SchemaConfiguration configuration) | -| Number | validate(Number arg, SchemaConfiguration configuration) | -| boolean | validate(boolean arg, SchemaConfiguration configuration) | -| FrozenMap<@Nullable Object> | validate(Map<?, ?> arg, SchemaConfiguration configuration) | -| FrozenList<@Nullable Object> | validate(List arg, SchemaConfiguration configuration) | -| [ComplexQuadrilateral1BoxedString](#complexquadrilateral1boxedstring) | validateAndBox(String arg, SchemaConfiguration configuration) | -| [ComplexQuadrilateral1BoxedVoid](#complexquadrilateral1boxedvoid) | validateAndBox(Nothing? arg, SchemaConfiguration configuration) | -| [ComplexQuadrilateral1BoxedNumber](#complexquadrilateral1boxednumber) | validateAndBox(Number arg, SchemaConfiguration configuration) | -| [ComplexQuadrilateral1BoxedBoolean](#complexquadrilateral1boxedboolean) | validateAndBox(boolean arg, SchemaConfiguration configuration) | -| [ComplexQuadrilateral1BoxedMap](#complexquadrilateral1boxedmap) | validateAndBox(Map<?, ?> arg, SchemaConfiguration configuration) | -| [ComplexQuadrilateral1BoxedList](#complexquadrilateral1boxedlist) | validateAndBox(List arg, SchemaConfiguration configuration) | -| [ComplexQuadrilateral1Boxed](#complexquadrilateral1boxed) | validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) | -| @Nullable Object | validate(@Nullable Object arg, SchemaConfiguration configuration) | - -## Schema1Boxed -public sealed interface Schema1Boxed
-permits
-[Schema1BoxedMap](#schema1boxedmap) - -sealed interface that stores validated payloads using boxed classes - -## Schema1BoxedMap -public record Schema1BoxedMap
-implements [Schema1Boxed](#schema1boxed) - -record that stores validated Map payloads, sealed permits implementation - -### Constructor Summary -| Constructor and Description | -| --------------------------- | -| Schema1BoxedMap([Schema1Map](#schema1map) data)
Creates an instance, private visibility | - -### Method Summary -| Modifier and Type | Method and Description | -| ----------------- | ---------------------- | -| [Schema1Map](#schema1map) | data()
validated payload | -| @Nullable Object | getData()
validated payload | - -## Schema1 -public static class Schema1
-extends JsonSchema - -A schema class that validates payloads - -### Code Sample -``` -import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags; -import org.openapijsonschematools.client.configurations.SchemaConfiguration; -import org.openapijsonschematools.client.exceptions.ValidationException; -import org.openapijsonschematools.client.schemas.validation.MapUtils; -import org.openapijsonschematools.client.schemas.validation.FrozenList; -import org.openapijsonschematools.client.schemas.validation.FrozenMap; -import org.openapijsonschematools.client.components.schemas.ComplexQuadrilateral; - -import java.util.Arrays; -import java.util.List; -import java.util.AbstractMap; - -static final SchemaConfiguration configuration = new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().build()); - -// Map validation -ComplexQuadrilateral.Schema1Map validatedPayload = - ComplexQuadrilateral.Schema1.validate( - new ComplexQuadrilateral.Schema1MapBuilder() - .quadrilateralType("ComplexQuadrilateral") - - .build(), - configuration -); -``` - -### Field Summary -| Modifier and Type | Field and Description | -| ----------------- | ---------------------- | -| Set> | type = Set.of(Map.class) | -| Map> | properties = Map.ofEntries(
    new PropertyEntry("quadrilateralType", [QuadrilateralType.class](#quadrilateraltype)))
)
| - -### Method Summary -| Modifier and Type | Method and Description | -| ----------------- | ---------------------- | -| [Schema1Map](#schema1map) | validate([Map<?, ?>](#schema1mapbuilder) arg, SchemaConfiguration configuration) | -| [Schema1BoxedMap](#schema1boxedmap) | validateAndBox([Map<?, ?>](#schema1mapbuilder) arg, SchemaConfiguration configuration) | -| [Schema1Boxed](#schema1boxed) | validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) | -| @Nullable Object | validate(@Nullable Object arg, SchemaConfiguration configuration) | - -## Schema1MapBuilder -public class Schema1MapBuilder
-builder for `Map` - -A class that builds the Map input type - -### Constructor Summary -| Constructor and Description | -| --------------------------- | -| Schema1MapBuilder()
Creates a builder that contains an empty map | - -### Method Summary -| Modifier and Type | Method and Description | -| ----------------- | ---------------------- | -| Map | build()
Returns map input that should be used with Schema.validate | -| [Schema1MapBuilder](#schema1mapbuilder) | quadrilateralType(String value) | -| [Schema1MapBuilder](#schema1mapbuilder) | quadrilateralType([StringQuadrilateralTypeEnums](#stringquadrilateraltypeenums) value) | -| [Schema1MapBuilder](#schema1mapbuilder) | additionalProperty(String key, Nothing? value) | -| [Schema1MapBuilder](#schema1mapbuilder) | additionalProperty(String key, boolean value) | -| [Schema1MapBuilder](#schema1mapbuilder) | additionalProperty(String key, String value) | -| [Schema1MapBuilder](#schema1mapbuilder) | additionalProperty(String key, int value) | -| [Schema1MapBuilder](#schema1mapbuilder) | additionalProperty(String key, float value) | -| [Schema1MapBuilder](#schema1mapbuilder) | additionalProperty(String key, long value) | -| [Schema1MapBuilder](#schema1mapbuilder) | additionalProperty(String key, double value) | -| [Schema1MapBuilder](#schema1mapbuilder) | additionalProperty(String key, List value) | -| [Schema1MapBuilder](#schema1mapbuilder) | additionalProperty(String key, Map value) | - -## Schema1Map -public static class Schema1Map
-extends FrozenMap - -A class to store validated Map payloads - -### Method Summary -| Modifier and Type | Method and Description | -| ----------------- | ---------------------- | -| static [Schema1Map](#schema1map) | of([Map](#schema1mapbuilder) arg, SchemaConfiguration configuration) | -| String | quadrilateralType()
[optional] must be one of ["ComplexQuadrilateral"] | -| @Nullable Object | getAdditionalProperty(String name)
provides type safety for additional properties | - -## QuadrilateralTypeBoxed -public sealed interface QuadrilateralTypeBoxed
-permits
-[QuadrilateralTypeBoxedString](#quadrilateraltypeboxedstring) - -sealed interface that stores validated payloads using boxed classes - -## QuadrilateralTypeBoxedString -public record QuadrilateralTypeBoxedString
-implements [QuadrilateralTypeBoxed](#quadrilateraltypeboxed) - -record that stores validated String payloads, sealed permits implementation - -### Constructor Summary -| Constructor and Description | -| --------------------------- | -| QuadrilateralTypeBoxedString(String data)
Creates an instance, private visibility | - -### Method Summary -| Modifier and Type | Method and Description | -| ----------------- | ---------------------- | -| String | data()
validated payload | -| @Nullable Object | getData()
validated payload | - -## QuadrilateralType -public static class QuadrilateralType
-extends JsonSchema - -A schema class that validates payloads - -### Code Sample -``` -import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags; -import org.openapijsonschematools.client.configurations.SchemaConfiguration; -import org.openapijsonschematools.client.exceptions.ValidationException; -import org.openapijsonschematools.client.schemas.validation.MapUtils; -import org.openapijsonschematools.client.schemas.validation.FrozenList; -import org.openapijsonschematools.client.schemas.validation.FrozenMap; -import org.openapijsonschematools.client.components.schemas.ComplexQuadrilateral; - -import java.util.Arrays; -import java.util.List; -import java.util.AbstractMap; - -static final SchemaConfiguration configuration = new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().build()); - -// String validation -String validatedPayload = ComplexQuadrilateral.QuadrilateralType.validate( - "ComplexQuadrilateral", - configuration -); -``` - -### Field Summary -| Modifier and Type | Field and Description | -| ----------------- | ---------------------- | -| Set> | type = Set.of(
    String.class
)
| -| Set | enumValues = SetMaker.makeSet(
    "ComplexQuadrilateral"
)
| - -### Method Summary -| Modifier and Type | Method and Description | -| ----------------- | ---------------------- | -| String | validate(String arg, SchemaConfiguration configuration) | -| String | validate([StringQuadrilateralTypeEnums](#stringquadrilateraltypeenums) arg, SchemaConfiguration configuration) | -| [QuadrilateralTypeBoxedString](#quadrilateraltypeboxedstring) | validateAndBox(String arg, SchemaConfiguration configuration) | -| [QuadrilateralTypeBoxed](#quadrilateraltypeboxed) | validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) | -| @Nullable Object | validate(@Nullable Object arg, SchemaConfiguration configuration) | - -## StringQuadrilateralTypeEnums -public enum StringQuadrilateralTypeEnums
-extends `Enum` - -A class that stores String enum values - -### Enum Constant Summary -| Enum Constant | Description | -| ------------- | ----------- | -| COMPLEX_QUADRILATERAL | value = "ComplexQuadrilateral" | - -[[Back to top]](#top) [[Back to Component Schemas]](../../../README.md#Component-Schemas) [[Back to README]](../../../README.md) diff --git a/samples/client/petstore/kotlin/docs/components/schemas/ComposedAnyOfDifferentTypesNoValidations.md b/samples/client/petstore/kotlin/docs/components/schemas/ComposedAnyOfDifferentTypesNoValidations.md deleted file mode 100644 index 4b7d5f8db06..00000000000 --- a/samples/client/petstore/kotlin/docs/components/schemas/ComposedAnyOfDifferentTypesNoValidations.md +++ /dev/null @@ -1,956 +0,0 @@ -# ComposedAnyOfDifferentTypesNoValidations -org.openapijsonschematools.client.components.schemas.ComposedAnyOfDifferentTypesNoValidations.java -public class ComposedAnyOfDifferentTypesNoValidations
- -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 list payloads, extends FrozenList -- classes to build inputs for list payloads - -## Nested Class Summary -| Modifier and Type | Class and Description | -| ----------------- | ---------------------- | -| sealed interface | [ComposedAnyOfDifferentTypesNoValidations.ComposedAnyOfDifferentTypesNoValidations1Boxed](#composedanyofdifferenttypesnovalidations1boxed)
sealed interface for validated payloads | -| record | [ComposedAnyOfDifferentTypesNoValidations.ComposedAnyOfDifferentTypesNoValidations1BoxedVoid](#composedanyofdifferenttypesnovalidations1boxedvoid)
boxed class to store validated null payloads | -| record | [ComposedAnyOfDifferentTypesNoValidations.ComposedAnyOfDifferentTypesNoValidations1BoxedBoolean](#composedanyofdifferenttypesnovalidations1boxedboolean)
boxed class to store validated boolean payloads | -| record | [ComposedAnyOfDifferentTypesNoValidations.ComposedAnyOfDifferentTypesNoValidations1BoxedNumber](#composedanyofdifferenttypesnovalidations1boxednumber)
boxed class to store validated Number payloads | -| record | [ComposedAnyOfDifferentTypesNoValidations.ComposedAnyOfDifferentTypesNoValidations1BoxedString](#composedanyofdifferenttypesnovalidations1boxedstring)
boxed class to store validated String payloads | -| record | [ComposedAnyOfDifferentTypesNoValidations.ComposedAnyOfDifferentTypesNoValidations1BoxedList](#composedanyofdifferenttypesnovalidations1boxedlist)
boxed class to store validated List payloads | -| record | [ComposedAnyOfDifferentTypesNoValidations.ComposedAnyOfDifferentTypesNoValidations1BoxedMap](#composedanyofdifferenttypesnovalidations1boxedmap)
boxed class to store validated Map payloads | -| static class | [ComposedAnyOfDifferentTypesNoValidations.ComposedAnyOfDifferentTypesNoValidations1](#composedanyofdifferenttypesnovalidations1)
schema class | -| sealed interface | [ComposedAnyOfDifferentTypesNoValidations.Schema15Boxed](#schema15boxed)
sealed interface for validated payloads | -| record | [ComposedAnyOfDifferentTypesNoValidations.Schema15BoxedNumber](#schema15boxednumber)
boxed class to store validated Number payloads | -| static class | [ComposedAnyOfDifferentTypesNoValidations.Schema15](#schema15)
schema class | -| sealed interface | [ComposedAnyOfDifferentTypesNoValidations.Schema14Boxed](#schema14boxed)
sealed interface for validated payloads | -| record | [ComposedAnyOfDifferentTypesNoValidations.Schema14BoxedNumber](#schema14boxednumber)
boxed class to store validated Number payloads | -| static class | [ComposedAnyOfDifferentTypesNoValidations.Schema14](#schema14)
schema class | -| sealed interface | [ComposedAnyOfDifferentTypesNoValidations.Schema13Boxed](#schema13boxed)
sealed interface for validated payloads | -| record | [ComposedAnyOfDifferentTypesNoValidations.Schema13BoxedNumber](#schema13boxednumber)
boxed class to store validated Number payloads | -| static class | [ComposedAnyOfDifferentTypesNoValidations.Schema13](#schema13)
schema class | -| sealed interface | [ComposedAnyOfDifferentTypesNoValidations.Schema12Boxed](#schema12boxed)
sealed interface for validated payloads | -| record | [ComposedAnyOfDifferentTypesNoValidations.Schema12BoxedNumber](#schema12boxednumber)
boxed class to store validated Number payloads | -| static class | [ComposedAnyOfDifferentTypesNoValidations.Schema12](#schema12)
schema class | -| sealed interface | [ComposedAnyOfDifferentTypesNoValidations.Schema11Boxed](#schema11boxed)
sealed interface for validated payloads | -| record | [ComposedAnyOfDifferentTypesNoValidations.Schema11BoxedNumber](#schema11boxednumber)
boxed class to store validated Number payloads | -| static class | [ComposedAnyOfDifferentTypesNoValidations.Schema11](#schema11)
schema class | -| sealed interface | [ComposedAnyOfDifferentTypesNoValidations.Schema10Boxed](#schema10boxed)
sealed interface for validated payloads | -| record | [ComposedAnyOfDifferentTypesNoValidations.Schema10BoxedNumber](#schema10boxednumber)
boxed class to store validated Number payloads | -| static class | [ComposedAnyOfDifferentTypesNoValidations.Schema10](#schema10)
schema class | -| sealed interface | [ComposedAnyOfDifferentTypesNoValidations.Schema9Boxed](#schema9boxed)
sealed interface for validated payloads | -| record | [ComposedAnyOfDifferentTypesNoValidations.Schema9BoxedList](#schema9boxedlist)
boxed class to store validated List payloads | -| static class | [ComposedAnyOfDifferentTypesNoValidations.Schema9](#schema9)
schema class | -| static class | [ComposedAnyOfDifferentTypesNoValidations.Schema9ListBuilder](#schema9listbuilder)
builder for List payloads | -| static class | [ComposedAnyOfDifferentTypesNoValidations.Schema9List](#schema9list)
output class for List payloads | -| sealed interface | [ComposedAnyOfDifferentTypesNoValidations.ItemsBoxed](#itemsboxed)
sealed interface for validated payloads | -| record | [ComposedAnyOfDifferentTypesNoValidations.ItemsBoxedVoid](#itemsboxedvoid)
boxed class to store validated null payloads | -| record | [ComposedAnyOfDifferentTypesNoValidations.ItemsBoxedBoolean](#itemsboxedboolean)
boxed class to store validated boolean payloads | -| record | [ComposedAnyOfDifferentTypesNoValidations.ItemsBoxedNumber](#itemsboxednumber)
boxed class to store validated Number payloads | -| record | [ComposedAnyOfDifferentTypesNoValidations.ItemsBoxedString](#itemsboxedstring)
boxed class to store validated String payloads | -| record | [ComposedAnyOfDifferentTypesNoValidations.ItemsBoxedList](#itemsboxedlist)
boxed class to store validated List payloads | -| record | [ComposedAnyOfDifferentTypesNoValidations.ItemsBoxedMap](#itemsboxedmap)
boxed class to store validated Map payloads | -| static class | [ComposedAnyOfDifferentTypesNoValidations.Items](#items)
schema class | -| sealed interface | [ComposedAnyOfDifferentTypesNoValidations.Schema8Boxed](#schema8boxed)
sealed interface for validated payloads | -| record | [ComposedAnyOfDifferentTypesNoValidations.Schema8BoxedVoid](#schema8boxedvoid)
boxed class to store validated null payloads | -| static class | [ComposedAnyOfDifferentTypesNoValidations.Schema8](#schema8)
schema class | -| sealed interface | [ComposedAnyOfDifferentTypesNoValidations.Schema7Boxed](#schema7boxed)
sealed interface for validated payloads | -| record | [ComposedAnyOfDifferentTypesNoValidations.Schema7BoxedBoolean](#schema7boxedboolean)
boxed class to store validated boolean payloads | -| static class | [ComposedAnyOfDifferentTypesNoValidations.Schema7](#schema7)
schema class | -| sealed interface | [ComposedAnyOfDifferentTypesNoValidations.Schema6Boxed](#schema6boxed)
sealed interface for validated payloads | -| record | [ComposedAnyOfDifferentTypesNoValidations.Schema6BoxedMap](#schema6boxedmap)
boxed class to store validated Map payloads | -| static class | [ComposedAnyOfDifferentTypesNoValidations.Schema6](#schema6)
schema class | -| sealed interface | [ComposedAnyOfDifferentTypesNoValidations.Schema5Boxed](#schema5boxed)
sealed interface for validated payloads | -| record | [ComposedAnyOfDifferentTypesNoValidations.Schema5BoxedString](#schema5boxedstring)
boxed class to store validated String payloads | -| static class | [ComposedAnyOfDifferentTypesNoValidations.Schema5](#schema5)
schema class | -| sealed interface | [ComposedAnyOfDifferentTypesNoValidations.Schema4Boxed](#schema4boxed)
sealed interface for validated payloads | -| record | [ComposedAnyOfDifferentTypesNoValidations.Schema4BoxedString](#schema4boxedstring)
boxed class to store validated String payloads | -| static class | [ComposedAnyOfDifferentTypesNoValidations.Schema4](#schema4)
schema class | -| sealed interface | [ComposedAnyOfDifferentTypesNoValidations.Schema3Boxed](#schema3boxed)
sealed interface for validated payloads | -| static class | [ComposedAnyOfDifferentTypesNoValidations.Schema3](#schema3)
schema class | -| sealed interface | [ComposedAnyOfDifferentTypesNoValidations.Schema2Boxed](#schema2boxed)
sealed interface for validated payloads | -| record | [ComposedAnyOfDifferentTypesNoValidations.Schema2BoxedString](#schema2boxedstring)
boxed class to store validated String payloads | -| static class | [ComposedAnyOfDifferentTypesNoValidations.Schema2](#schema2)
schema class | -| sealed interface | [ComposedAnyOfDifferentTypesNoValidations.Schema1Boxed](#schema1boxed)
sealed interface for validated payloads | -| record | [ComposedAnyOfDifferentTypesNoValidations.Schema1BoxedString](#schema1boxedstring)
boxed class to store validated String payloads | -| static class | [ComposedAnyOfDifferentTypesNoValidations.Schema1](#schema1)
schema class | -| sealed interface | [ComposedAnyOfDifferentTypesNoValidations.Schema0Boxed](#schema0boxed)
sealed interface for validated payloads | -| record | [ComposedAnyOfDifferentTypesNoValidations.Schema0BoxedMap](#schema0boxedmap)
boxed class to store validated Map payloads | -| static class | [ComposedAnyOfDifferentTypesNoValidations.Schema0](#schema0)
schema class | - -## ComposedAnyOfDifferentTypesNoValidations1Boxed -public sealed interface ComposedAnyOfDifferentTypesNoValidations1Boxed
-permits
-[ComposedAnyOfDifferentTypesNoValidations1BoxedVoid](#composedanyofdifferenttypesnovalidations1boxedvoid), -[ComposedAnyOfDifferentTypesNoValidations1BoxedBoolean](#composedanyofdifferenttypesnovalidations1boxedboolean), -[ComposedAnyOfDifferentTypesNoValidations1BoxedNumber](#composedanyofdifferenttypesnovalidations1boxednumber), -[ComposedAnyOfDifferentTypesNoValidations1BoxedString](#composedanyofdifferenttypesnovalidations1boxedstring), -[ComposedAnyOfDifferentTypesNoValidations1BoxedList](#composedanyofdifferenttypesnovalidations1boxedlist), -[ComposedAnyOfDifferentTypesNoValidations1BoxedMap](#composedanyofdifferenttypesnovalidations1boxedmap) - -sealed interface that stores validated payloads using boxed classes - -## ComposedAnyOfDifferentTypesNoValidations1BoxedVoid -public record ComposedAnyOfDifferentTypesNoValidations1BoxedVoid
-implements [ComposedAnyOfDifferentTypesNoValidations1Boxed](#composedanyofdifferenttypesnovalidations1boxed) - -record that stores validated null payloads, sealed permits implementation - -### Constructor Summary -| Constructor and Description | -| --------------------------- | -| ComposedAnyOfDifferentTypesNoValidations1BoxedVoid(Nothing? data)
Creates an instance, private visibility | - -### Method Summary -| Modifier and Type | Method and Description | -| ----------------- | ---------------------- | -| Nothing? | data()
validated payload | -| @Nullable Object | getData()
validated payload | - -## ComposedAnyOfDifferentTypesNoValidations1BoxedBoolean -public record ComposedAnyOfDifferentTypesNoValidations1BoxedBoolean
-implements [ComposedAnyOfDifferentTypesNoValidations1Boxed](#composedanyofdifferenttypesnovalidations1boxed) - -record that stores validated boolean payloads, sealed permits implementation - -### Constructor Summary -| Constructor and Description | -| --------------------------- | -| ComposedAnyOfDifferentTypesNoValidations1BoxedBoolean(boolean data)
Creates an instance, private visibility | - -### Method Summary -| Modifier and Type | Method and Description | -| ----------------- | ---------------------- | -| boolean | data()
validated payload | -| @Nullable Object | getData()
validated payload | - -## ComposedAnyOfDifferentTypesNoValidations1BoxedNumber -public record ComposedAnyOfDifferentTypesNoValidations1BoxedNumber
-implements [ComposedAnyOfDifferentTypesNoValidations1Boxed](#composedanyofdifferenttypesnovalidations1boxed) - -record that stores validated Number payloads, sealed permits implementation - -### Constructor Summary -| Constructor and Description | -| --------------------------- | -| ComposedAnyOfDifferentTypesNoValidations1BoxedNumber(Number data)
Creates an instance, private visibility | - -### Method Summary -| Modifier and Type | Method and Description | -| ----------------- | ---------------------- | -| Number | data()
validated payload | -| @Nullable Object | getData()
validated payload | - -## ComposedAnyOfDifferentTypesNoValidations1BoxedString -public record ComposedAnyOfDifferentTypesNoValidations1BoxedString
-implements [ComposedAnyOfDifferentTypesNoValidations1Boxed](#composedanyofdifferenttypesnovalidations1boxed) - -record that stores validated String payloads, sealed permits implementation - -### Constructor Summary -| Constructor and Description | -| --------------------------- | -| ComposedAnyOfDifferentTypesNoValidations1BoxedString(String data)
Creates an instance, private visibility | - -### Method Summary -| Modifier and Type | Method and Description | -| ----------------- | ---------------------- | -| String | data()
validated payload | -| @Nullable Object | getData()
validated payload | - -## ComposedAnyOfDifferentTypesNoValidations1BoxedList -public record ComposedAnyOfDifferentTypesNoValidations1BoxedList
-implements [ComposedAnyOfDifferentTypesNoValidations1Boxed](#composedanyofdifferenttypesnovalidations1boxed) - -record that stores validated List payloads, sealed permits implementation - -### Constructor Summary -| Constructor and Description | -| --------------------------- | -| ComposedAnyOfDifferentTypesNoValidations1BoxedList(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 | - -## ComposedAnyOfDifferentTypesNoValidations1BoxedMap -public record ComposedAnyOfDifferentTypesNoValidations1BoxedMap
-implements [ComposedAnyOfDifferentTypesNoValidations1Boxed](#composedanyofdifferenttypesnovalidations1boxed) - -record that stores validated Map payloads, sealed permits implementation - -### Constructor Summary -| Constructor and Description | -| --------------------------- | -| ComposedAnyOfDifferentTypesNoValidations1BoxedMap(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 | - -## ComposedAnyOfDifferentTypesNoValidations1 -public static class ComposedAnyOfDifferentTypesNoValidations1
-extends JsonSchema - -A schema class that validates payloads - -### Field Summary -| Modifier and Type | Field and Description | -| ----------------- | ---------------------- | -| List> | anyOf = List.of(
    [Schema0.class](#schema0),
    [Schema1.class](#schema1),
    [Schema2.class](#schema2),
    [Schema3.class](#schema3),
    [Schema4.class](#schema4),
    [Schema5.class](#schema5),
    [Schema6.class](#schema6),
    [Schema7.class](#schema7),
    [Schema8.class](#schema8),
    [Schema9.class](#schema9),
    [Schema10.class](#schema10),
    [Schema11.class](#schema11),
    [Schema12.class](#schema12),
    [Schema13.class](#schema13),
    [Schema14.class](#schema14),
    [Schema15.class](#schema15)
)
| - -### Method Summary -| Modifier and Type | Method and Description | -| ----------------- | ---------------------- | -| String | validate(String arg, SchemaConfiguration configuration) | -| Nothing? | validate(Nothing? arg, SchemaConfiguration configuration) | -| int | validate(int arg, SchemaConfiguration configuration) | -| long | validate(long arg, SchemaConfiguration configuration) | -| float | validate(float arg, SchemaConfiguration configuration) | -| double | validate(double arg, SchemaConfiguration configuration) | -| Number | validate(Number arg, SchemaConfiguration configuration) | -| boolean | validate(boolean arg, SchemaConfiguration configuration) | -| FrozenMap<@Nullable Object> | validate(Map<?, ?> arg, SchemaConfiguration configuration) | -| FrozenList<@Nullable Object> | validate(List arg, SchemaConfiguration configuration) | -| [ComposedAnyOfDifferentTypesNoValidations1BoxedString](#composedanyofdifferenttypesnovalidations1boxedstring) | validateAndBox(String arg, SchemaConfiguration configuration) | -| [ComposedAnyOfDifferentTypesNoValidations1BoxedVoid](#composedanyofdifferenttypesnovalidations1boxedvoid) | validateAndBox(Nothing? arg, SchemaConfiguration configuration) | -| [ComposedAnyOfDifferentTypesNoValidations1BoxedNumber](#composedanyofdifferenttypesnovalidations1boxednumber) | validateAndBox(Number arg, SchemaConfiguration configuration) | -| [ComposedAnyOfDifferentTypesNoValidations1BoxedBoolean](#composedanyofdifferenttypesnovalidations1boxedboolean) | validateAndBox(boolean arg, SchemaConfiguration configuration) | -| [ComposedAnyOfDifferentTypesNoValidations1BoxedMap](#composedanyofdifferenttypesnovalidations1boxedmap) | validateAndBox(Map<?, ?> arg, SchemaConfiguration configuration) | -| [ComposedAnyOfDifferentTypesNoValidations1BoxedList](#composedanyofdifferenttypesnovalidations1boxedlist) | validateAndBox(List arg, SchemaConfiguration configuration) | -| [ComposedAnyOfDifferentTypesNoValidations1Boxed](#composedanyofdifferenttypesnovalidations1boxed) | validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) | -| @Nullable Object | validate(@Nullable Object arg, SchemaConfiguration configuration) | - -## Schema15Boxed -public sealed interface Schema15Boxed
-permits
-[Schema15BoxedNumber](#schema15boxednumber) - -sealed interface that stores validated payloads using boxed classes - -## Schema15BoxedNumber -public record Schema15BoxedNumber
-implements [Schema15Boxed](#schema15boxed) - -record that stores validated Number payloads, sealed permits implementation - -### Constructor Summary -| Constructor and Description | -| --------------------------- | -| Schema15BoxedNumber(Number data)
Creates an instance, private visibility | - -### Method Summary -| Modifier and Type | Method and Description | -| ----------------- | ---------------------- | -| Number | data()
validated payload | -| @Nullable Object | getData()
validated payload | - -## Schema15 -public static class Schema15
-extends Int64JsonSchema.Int64JsonSchema1 - -A schema class that validates payloads - -| Methods Inherited from class org.openapijsonschematools.client.schemas.Int64JsonSchema.Int64JsonSchema1 | -| ------------------------------------------------------------------ | -| validate | -| validateAndBox | - -## Schema14Boxed -public sealed interface Schema14Boxed
-permits
-[Schema14BoxedNumber](#schema14boxednumber) - -sealed interface that stores validated payloads using boxed classes - -## Schema14BoxedNumber -public record Schema14BoxedNumber
-implements [Schema14Boxed](#schema14boxed) - -record that stores validated Number payloads, sealed permits implementation - -### Constructor Summary -| Constructor and Description | -| --------------------------- | -| Schema14BoxedNumber(Number data)
Creates an instance, private visibility | - -### Method Summary -| Modifier and Type | Method and Description | -| ----------------- | ---------------------- | -| Number | data()
validated payload | -| @Nullable Object | getData()
validated payload | - -## Schema14 -public static class Schema14
-extends Int32JsonSchema.Int32JsonSchema1 - -A schema class that validates payloads - -| Methods Inherited from class org.openapijsonschematools.client.schemas.Int32JsonSchema.Int32JsonSchema1 | -| ------------------------------------------------------------------ | -| validate | -| validateAndBox | - -## Schema13Boxed -public sealed interface Schema13Boxed
-permits
-[Schema13BoxedNumber](#schema13boxednumber) - -sealed interface that stores validated payloads using boxed classes - -## Schema13BoxedNumber -public record Schema13BoxedNumber
-implements [Schema13Boxed](#schema13boxed) - -record that stores validated Number payloads, sealed permits implementation - -### Constructor Summary -| Constructor and Description | -| --------------------------- | -| Schema13BoxedNumber(Number data)
Creates an instance, private visibility | - -### Method Summary -| Modifier and Type | Method and Description | -| ----------------- | ---------------------- | -| Number | data()
validated payload | -| @Nullable Object | getData()
validated payload | - -## Schema13 -public static class Schema13
-extends IntJsonSchema.IntJsonSchema1 - -A schema class that validates payloads - -| Methods Inherited from class org.openapijsonschematools.client.schemas.IntJsonSchema.IntJsonSchema1 | -| ------------------------------------------------------------------ | -| validate | -| validateAndBox | - -## Schema12Boxed -public sealed interface Schema12Boxed
-permits
-[Schema12BoxedNumber](#schema12boxednumber) - -sealed interface that stores validated payloads using boxed classes - -## Schema12BoxedNumber -public record Schema12BoxedNumber
-implements [Schema12Boxed](#schema12boxed) - -record that stores validated Number payloads, sealed permits implementation - -### Constructor Summary -| Constructor and Description | -| --------------------------- | -| Schema12BoxedNumber(Number data)
Creates an instance, private visibility | - -### Method Summary -| Modifier and Type | Method and Description | -| ----------------- | ---------------------- | -| Number | data()
validated payload | -| @Nullable Object | getData()
validated payload | - -## Schema12 -public static class Schema12
-extends DoubleJsonSchema.DoubleJsonSchema1 - -A schema class that validates payloads - -| Methods Inherited from class org.openapijsonschematools.client.schemas.DoubleJsonSchema.DoubleJsonSchema1 | -| ------------------------------------------------------------------ | -| validate | -| validateAndBox | - -## Schema11Boxed -public sealed interface Schema11Boxed
-permits
-[Schema11BoxedNumber](#schema11boxednumber) - -sealed interface that stores validated payloads using boxed classes - -## Schema11BoxedNumber -public record Schema11BoxedNumber
-implements [Schema11Boxed](#schema11boxed) - -record that stores validated Number payloads, sealed permits implementation - -### Constructor Summary -| Constructor and Description | -| --------------------------- | -| Schema11BoxedNumber(Number data)
Creates an instance, private visibility | - -### Method Summary -| Modifier and Type | Method and Description | -| ----------------- | ---------------------- | -| Number | data()
validated payload | -| @Nullable Object | getData()
validated payload | - -## Schema11 -public static class Schema11
-extends FloatJsonSchema.FloatJsonSchema1 - -A schema class that validates payloads - -| Methods Inherited from class org.openapijsonschematools.client.schemas.FloatJsonSchema.FloatJsonSchema1 | -| ------------------------------------------------------------------ | -| validate | -| validateAndBox | - -## Schema10Boxed -public sealed interface Schema10Boxed
-permits
-[Schema10BoxedNumber](#schema10boxednumber) - -sealed interface that stores validated payloads using boxed classes - -## Schema10BoxedNumber -public record Schema10BoxedNumber
-implements [Schema10Boxed](#schema10boxed) - -record that stores validated Number payloads, sealed permits implementation - -### Constructor Summary -| Constructor and Description | -| --------------------------- | -| Schema10BoxedNumber(Number data)
Creates an instance, private visibility | - -### Method Summary -| Modifier and Type | Method and Description | -| ----------------- | ---------------------- | -| Number | data()
validated payload | -| @Nullable Object | getData()
validated payload | - -## Schema10 -public static class Schema10
-extends NumberJsonSchema.NumberJsonSchema1 - -A schema class that validates payloads - -| Methods Inherited from class org.openapijsonschematools.client.schemas.NumberJsonSchema.NumberJsonSchema1 | -| ------------------------------------------------------------------ | -| validate | -| validateAndBox | - -## Schema9Boxed -public sealed interface Schema9Boxed
-permits
-[Schema9BoxedList](#schema9boxedlist) - -sealed interface that stores validated payloads using boxed classes - -## Schema9BoxedList -public record Schema9BoxedList
-implements [Schema9Boxed](#schema9boxed) - -record that stores validated List payloads, sealed permits implementation - -### Constructor Summary -| Constructor and Description | -| --------------------------- | -| Schema9BoxedList([Schema9List](#schema9list) data)
Creates an instance, private visibility | - -### Method Summary -| Modifier and Type | Method and Description | -| ----------------- | ---------------------- | -| [Schema9List](#schema9list) | data()
validated payload | -| @Nullable Object | getData()
validated payload | - -## Schema9 -public static class Schema9
-extends JsonSchema - -A schema class that validates payloads - -### Code Sample -``` -import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags; -import org.openapijsonschematools.client.configurations.SchemaConfiguration; -import org.openapijsonschematools.client.exceptions.ValidationException; -import org.openapijsonschematools.client.schemas.validation.MapUtils; -import org.openapijsonschematools.client.schemas.validation.FrozenList; -import org.openapijsonschematools.client.schemas.validation.FrozenMap; -import org.openapijsonschematools.client.components.schemas.ComposedAnyOfDifferentTypesNoValidations; - -import java.util.Arrays; -import java.util.List; -import java.util.AbstractMap; - -static final SchemaConfiguration configuration = new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().build()); - -// List validation -ComposedAnyOfDifferentTypesNoValidations.Schema9List validatedPayload = - ComposedAnyOfDifferentTypesNoValidations.Schema9.validate( - new ComposedAnyOfDifferentTypesNoValidations.Schema9ListBuilder() - .build(), - configuration -); -``` - -### Field Summary -| Modifier and Type | Field and Description | -| ----------------- | ---------------------- | -| Set> | type = Set.of(List.class) | -| Class | items = [Items.class](#items) | - -### Method Summary -| Modifier and Type | Method and Description | -| ----------------- | ---------------------- | -| [Schema9List](#schema9list) | validate([List](#schema9listbuilder) arg, SchemaConfiguration configuration) | -| [Schema9BoxedList](#schema9boxedlist) | validateAndBox([List](#schema9listbuilder) arg, SchemaConfiguration configuration) | -| [Schema9Boxed](#schema9boxed) | validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) | -| @Nullable Object | validate(@Nullable Object arg, SchemaConfiguration configuration) | - -## Schema9ListBuilder -public class Schema9ListBuilder
-builder for `List<@Nullable Object>` - -A class that builds the List input type - -### Constructor Summary -| Constructor and Description | -| --------------------------- | -| Schema9ListBuilder()
Creates an empty list | -| Schema9ListBuilder(List<@Nullable Object> items)
Stores the items in a list | - -### Method Summary -| Modifier and Type | Method and Description | -| ----------------- | ---------------------- | -| Schema9ListBuilder | add(Nothing? item) | -| Schema9ListBuilder | add(boolean item) | -| Schema9ListBuilder | add(String item) | -| Schema9ListBuilder | add(int item) | -| Schema9ListBuilder | add(float item) | -| Schema9ListBuilder | add(long item) | -| Schema9ListBuilder | add(double item) | -| Schema9ListBuilder | add(List item) | -| Schema9ListBuilder | add(Map item) | -| List<@Nullable Object> | build()
Returns list input that should be used with Schema.validate | - -## Schema9List -public class Schema9List
-extends `FrozenList<@Nullable Object>` - -A class to store validated List payloads - -### Method Summary -| Modifier and Type | Method and Description | -| ----------------- | ---------------------- | -| static [Schema9List](#schema9list) | of([List](#schema9listbuilder) arg, SchemaConfiguration configuration) | - -## ItemsBoxed -public sealed interface ItemsBoxed
-permits
-[ItemsBoxedVoid](#itemsboxedvoid), -[ItemsBoxedBoolean](#itemsboxedboolean), -[ItemsBoxedNumber](#itemsboxednumber), -[ItemsBoxedString](#itemsboxedstring), -[ItemsBoxedList](#itemsboxedlist), -[ItemsBoxedMap](#itemsboxedmap) - -sealed interface that stores validated payloads using boxed classes - -## ItemsBoxedVoid -public record ItemsBoxedVoid
-implements [ItemsBoxed](#itemsboxed) - -record that stores validated null payloads, sealed permits implementation - -### Constructor Summary -| Constructor and Description | -| --------------------------- | -| ItemsBoxedVoid(Nothing? data)
Creates an instance, private visibility | - -### Method Summary -| Modifier and Type | Method and Description | -| ----------------- | ---------------------- | -| Nothing? | data()
validated payload | -| @Nullable Object | getData()
validated payload | - -## ItemsBoxedBoolean -public record ItemsBoxedBoolean
-implements [ItemsBoxed](#itemsboxed) - -record that stores validated boolean payloads, sealed permits implementation - -### Constructor Summary -| Constructor and Description | -| --------------------------- | -| ItemsBoxedBoolean(boolean data)
Creates an instance, private visibility | - -### Method Summary -| Modifier and Type | Method and Description | -| ----------------- | ---------------------- | -| boolean | data()
validated payload | -| @Nullable Object | getData()
validated payload | - -## ItemsBoxedNumber -public record ItemsBoxedNumber
-implements [ItemsBoxed](#itemsboxed) - -record that stores validated Number payloads, sealed permits implementation - -### Constructor Summary -| Constructor and Description | -| --------------------------- | -| ItemsBoxedNumber(Number data)
Creates an instance, private visibility | - -### Method Summary -| Modifier and Type | Method and Description | -| ----------------- | ---------------------- | -| Number | data()
validated payload | -| @Nullable Object | getData()
validated payload | - -## ItemsBoxedString -public record ItemsBoxedString
-implements [ItemsBoxed](#itemsboxed) - -record that stores validated String payloads, sealed permits implementation - -### Constructor Summary -| Constructor and Description | -| --------------------------- | -| ItemsBoxedString(String data)
Creates an instance, private visibility | - -### Method Summary -| Modifier and Type | Method and Description | -| ----------------- | ---------------------- | -| String | data()
validated payload | -| @Nullable Object | getData()
validated payload | - -## ItemsBoxedList -public record ItemsBoxedList
-implements [ItemsBoxed](#itemsboxed) - -record that stores validated List payloads, sealed permits implementation - -### Constructor Summary -| Constructor and Description | -| --------------------------- | -| ItemsBoxedList(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 | - -## ItemsBoxedMap -public record ItemsBoxedMap
-implements [ItemsBoxed](#itemsboxed) - -record that stores validated Map payloads, sealed permits implementation - -### Constructor Summary -| Constructor and Description | -| --------------------------- | -| ItemsBoxedMap(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 | - -## Items -public static class Items
-extends AnyTypeJsonSchema.AnyTypeJsonSchema1 - -A schema class that validates payloads - -| Methods Inherited from class org.openapijsonschematools.client.schemas.AnyTypeJsonSchema.AnyTypeJsonSchema1 | -| ------------------------------------------------------------------ | -| validate | -| validateAndBox | - -## Schema8Boxed -public sealed interface Schema8Boxed
-permits
-[Schema8BoxedVoid](#schema8boxedvoid) - -sealed interface that stores validated payloads using boxed classes - -## Schema8BoxedVoid -public record Schema8BoxedVoid
-implements [Schema8Boxed](#schema8boxed) - -record that stores validated null payloads, sealed permits implementation - -### Constructor Summary -| Constructor and Description | -| --------------------------- | -| Schema8BoxedVoid(Nothing? data)
Creates an instance, private visibility | - -### Method Summary -| Modifier and Type | Method and Description | -| ----------------- | ---------------------- | -| Nothing? | data()
validated payload | -| @Nullable Object | getData()
validated payload | - -## Schema8 -public static class Schema8
-extends NullJsonSchema.NullJsonSchema1 - -A schema class that validates payloads - -| Methods Inherited from class org.openapijsonschematools.client.schemas.NullJsonSchema.NullJsonSchema1 | -| ------------------------------------------------------------------ | -| validate | -| validateAndBox | - -## Schema7Boxed -public sealed interface Schema7Boxed
-permits
-[Schema7BoxedBoolean](#schema7boxedboolean) - -sealed interface that stores validated payloads using boxed classes - -## Schema7BoxedBoolean -public record Schema7BoxedBoolean
-implements [Schema7Boxed](#schema7boxed) - -record that stores validated boolean payloads, sealed permits implementation - -### Constructor Summary -| Constructor and Description | -| --------------------------- | -| Schema7BoxedBoolean(boolean data)
Creates an instance, private visibility | - -### Method Summary -| Modifier and Type | Method and Description | -| ----------------- | ---------------------- | -| boolean | data()
validated payload | -| @Nullable Object | getData()
validated payload | - -## Schema7 -public static class Schema7
-extends BooleanJsonSchema.BooleanJsonSchema1 - -A schema class that validates payloads - -| Methods Inherited from class org.openapijsonschematools.client.schemas.BooleanJsonSchema.BooleanJsonSchema1 | -| ------------------------------------------------------------------ | -| validate | -| validateAndBox | - -## Schema6Boxed -public sealed interface Schema6Boxed
-permits
-[Schema6BoxedMap](#schema6boxedmap) - -sealed interface that stores validated payloads using boxed classes - -## Schema6BoxedMap -public record Schema6BoxedMap
-implements [Schema6Boxed](#schema6boxed) - -record that stores validated Map payloads, sealed permits implementation - -### Constructor Summary -| Constructor and Description | -| --------------------------- | -| Schema6BoxedMap(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 | - -## Schema6 -public static class Schema6
-extends MapJsonSchema.MapJsonSchema1 - -A schema class that validates payloads - -| Methods Inherited from class org.openapijsonschematools.client.schemas.MapJsonSchema.MapJsonSchema1 | -| ------------------------------------------------------------------ | -| validate | -| validateAndBox | - -## Schema5Boxed -public sealed interface Schema5Boxed
-permits
-[Schema5BoxedString](#schema5boxedstring) - -sealed interface that stores validated payloads using boxed classes - -## Schema5BoxedString -public record Schema5BoxedString
-implements [Schema5Boxed](#schema5boxed) - -record that stores validated String payloads, sealed permits implementation - -### Constructor Summary -| Constructor and Description | -| --------------------------- | -| Schema5BoxedString(String data)
Creates an instance, private visibility | - -### Method Summary -| Modifier and Type | Method and Description | -| ----------------- | ---------------------- | -| String | data()
validated payload | -| @Nullable Object | getData()
validated payload | - -## Schema5 -public static class Schema5
-extends StringJsonSchema.StringJsonSchema1 - -A schema class that validates payloads - -| Methods Inherited from class org.openapijsonschematools.client.schemas.StringJsonSchema.StringJsonSchema1 | -| ------------------------------------------------------------------ | -| validate | -| validateAndBox | - -## Schema4Boxed -public sealed interface Schema4Boxed
-permits
-[Schema4BoxedString](#schema4boxedstring) - -sealed interface that stores validated payloads using boxed classes - -## Schema4BoxedString -public record Schema4BoxedString
-implements [Schema4Boxed](#schema4boxed) - -record that stores validated String payloads, sealed permits implementation - -### Constructor Summary -| Constructor and Description | -| --------------------------- | -| Schema4BoxedString(String data)
Creates an instance, private visibility | - -### Method Summary -| Modifier and Type | Method and Description | -| ----------------- | ---------------------- | -| String | data()
validated payload | -| @Nullable Object | getData()
validated payload | - -## Schema4 -public static class Schema4
-extends StringJsonSchema.StringJsonSchema1 - -A schema class that validates payloads - -## Schema3Boxed -public sealed interface Schema3Boxed
-permits
- -sealed interface that stores validated payloads using boxed classes - -## Schema3 -public static class Schema3
-extends JsonSchema - -A schema class that validates payloads - -## Schema2Boxed -public sealed interface Schema2Boxed
-permits
-[Schema2BoxedString](#schema2boxedstring) - -sealed interface that stores validated payloads using boxed classes - -## Schema2BoxedString -public record Schema2BoxedString
-implements [Schema2Boxed](#schema2boxed) - -record that stores validated String payloads, sealed permits implementation - -### Constructor Summary -| Constructor and Description | -| --------------------------- | -| Schema2BoxedString(String data)
Creates an instance, private visibility | - -### Method Summary -| Modifier and Type | Method and Description | -| ----------------- | ---------------------- | -| String | data()
validated payload | -| @Nullable Object | getData()
validated payload | - -## Schema2 -public static class Schema2
-extends DateTimeJsonSchema.DateTimeJsonSchema1 - -A schema class that validates payloads - -| Methods Inherited from class org.openapijsonschematools.client.schemas.DateTimeJsonSchema.DateTimeJsonSchema1 | -| ------------------------------------------------------------------ | -| validate | -| validateAndBox | - -## Schema1Boxed -public sealed interface Schema1Boxed
-permits
-[Schema1BoxedString](#schema1boxedstring) - -sealed interface that stores validated payloads using boxed classes - -## Schema1BoxedString -public record Schema1BoxedString
-implements [Schema1Boxed](#schema1boxed) - -record that stores validated String payloads, sealed permits implementation - -### Constructor Summary -| Constructor and Description | -| --------------------------- | -| Schema1BoxedString(String data)
Creates an instance, private visibility | - -### Method Summary -| Modifier and Type | Method and Description | -| ----------------- | ---------------------- | -| String | data()
validated payload | -| @Nullable Object | getData()
validated payload | - -## Schema1 -public static class Schema1
-extends DateJsonSchema.DateJsonSchema1 - -A schema class that validates payloads - -| Methods Inherited from class org.openapijsonschematools.client.schemas.DateJsonSchema.DateJsonSchema1 | -| ------------------------------------------------------------------ | -| validate | -| validateAndBox | - -## Schema0Boxed -public sealed interface Schema0Boxed
-permits
-[Schema0BoxedMap](#schema0boxedmap) - -sealed interface that stores validated payloads using boxed classes - -## Schema0BoxedMap -public record Schema0BoxedMap
-implements [Schema0Boxed](#schema0boxed) - -record that stores validated Map payloads, sealed permits implementation - -### Constructor Summary -| Constructor and Description | -| --------------------------- | -| Schema0BoxedMap(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 | - -## Schema0 -public static class Schema0
-extends MapJsonSchema.MapJsonSchema1 - -A schema class that validates payloads - -| Methods Inherited from class org.openapijsonschematools.client.schemas.MapJsonSchema.MapJsonSchema1 | -| ------------------------------------------------------------------ | -| validate | -| validateAndBox | - -[[Back to top]](#top) [[Back to Component Schemas]](../../../README.md#Component-Schemas) [[Back to README]](../../../README.md) diff --git a/samples/client/petstore/kotlin/docs/components/schemas/ComposedArray.md b/samples/client/petstore/kotlin/docs/components/schemas/ComposedArray.md deleted file mode 100644 index 6b8c830f54a..00000000000 --- a/samples/client/petstore/kotlin/docs/components/schemas/ComposedArray.md +++ /dev/null @@ -1,260 +0,0 @@ -# ComposedArray -org.openapijsonschematools.client.components.schemas.ComposedArray.java -public class ComposedArray
- -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 list payloads, extends FrozenList -- classes to build inputs for list payloads - -## Nested Class Summary -| Modifier and Type | Class and Description | -| ----------------- | ---------------------- | -| sealed interface | [ComposedArray.ComposedArray1Boxed](#composedarray1boxed)
sealed interface for validated payloads | -| record | [ComposedArray.ComposedArray1BoxedList](#composedarray1boxedlist)
boxed class to store validated List payloads | -| static class | [ComposedArray.ComposedArray1](#composedarray1)
schema class | -| static class | [ComposedArray.ComposedArrayListBuilder](#composedarraylistbuilder)
builder for List payloads | -| static class | [ComposedArray.ComposedArrayList](#composedarraylist)
output class for List payloads | -| sealed interface | [ComposedArray.ItemsBoxed](#itemsboxed)
sealed interface for validated payloads | -| record | [ComposedArray.ItemsBoxedVoid](#itemsboxedvoid)
boxed class to store validated null payloads | -| record | [ComposedArray.ItemsBoxedBoolean](#itemsboxedboolean)
boxed class to store validated boolean payloads | -| record | [ComposedArray.ItemsBoxedNumber](#itemsboxednumber)
boxed class to store validated Number payloads | -| record | [ComposedArray.ItemsBoxedString](#itemsboxedstring)
boxed class to store validated String payloads | -| record | [ComposedArray.ItemsBoxedList](#itemsboxedlist)
boxed class to store validated List payloads | -| record | [ComposedArray.ItemsBoxedMap](#itemsboxedmap)
boxed class to store validated Map payloads | -| static class | [ComposedArray.Items](#items)
schema class | - -## ComposedArray1Boxed -public sealed interface ComposedArray1Boxed
-permits
-[ComposedArray1BoxedList](#composedarray1boxedlist) - -sealed interface that stores validated payloads using boxed classes - -## ComposedArray1BoxedList -public record ComposedArray1BoxedList
-implements [ComposedArray1Boxed](#composedarray1boxed) - -record that stores validated List payloads, sealed permits implementation - -### Constructor Summary -| Constructor and Description | -| --------------------------- | -| ComposedArray1BoxedList([ComposedArrayList](#composedarraylist) data)
Creates an instance, private visibility | - -### Method Summary -| Modifier and Type | Method and Description | -| ----------------- | ---------------------- | -| [ComposedArrayList](#composedarraylist) | data()
validated payload | -| @Nullable Object | getData()
validated payload | - -## ComposedArray1 -public static class ComposedArray1
-extends JsonSchema - -A schema class that validates payloads - -### Code Sample -``` -import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags; -import org.openapijsonschematools.client.configurations.SchemaConfiguration; -import org.openapijsonschematools.client.exceptions.ValidationException; -import org.openapijsonschematools.client.schemas.validation.MapUtils; -import org.openapijsonschematools.client.schemas.validation.FrozenList; -import org.openapijsonschematools.client.schemas.validation.FrozenMap; -import org.openapijsonschematools.client.components.schemas.ComposedArray; - -import java.util.Arrays; -import java.util.List; -import java.util.AbstractMap; - -static final SchemaConfiguration configuration = new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().build()); - -// List validation -ComposedArray.ComposedArrayList validatedPayload = - ComposedArray.ComposedArray1.validate( - new ComposedArray.ComposedArrayListBuilder() - .build(), - configuration -); -``` - -### Field Summary -| Modifier and Type | Field and Description | -| ----------------- | ---------------------- | -| Set> | type = Set.of(List.class) | -| Class | items = [Items.class](#items) | - -### Method Summary -| Modifier and Type | Method and Description | -| ----------------- | ---------------------- | -| [ComposedArrayList](#composedarraylist) | validate([List](#composedarraylistbuilder) arg, SchemaConfiguration configuration) | -| [ComposedArray1BoxedList](#composedarray1boxedlist) | validateAndBox([List](#composedarraylistbuilder) arg, SchemaConfiguration configuration) | -| [ComposedArray1Boxed](#composedarray1boxed) | validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) | -| @Nullable Object | validate(@Nullable Object arg, SchemaConfiguration configuration) | - -## ComposedArrayListBuilder -public class ComposedArrayListBuilder
-builder for `List<@Nullable Object>` - -A class that builds the List input type - -### Constructor Summary -| Constructor and Description | -| --------------------------- | -| ComposedArrayListBuilder()
Creates an empty list | -| ComposedArrayListBuilder(List<@Nullable Object> items)
Stores the items in a list | - -### Method Summary -| Modifier and Type | Method and Description | -| ----------------- | ---------------------- | -| ComposedArrayListBuilder | add(Nothing? item) | -| ComposedArrayListBuilder | add(boolean item) | -| ComposedArrayListBuilder | add(String item) | -| ComposedArrayListBuilder | add(int item) | -| ComposedArrayListBuilder | add(float item) | -| ComposedArrayListBuilder | add(long item) | -| ComposedArrayListBuilder | add(double item) | -| ComposedArrayListBuilder | add(List item) | -| ComposedArrayListBuilder | add(Map item) | -| List<@Nullable Object> | build()
Returns list input that should be used with Schema.validate | - -## ComposedArrayList -public class ComposedArrayList
-extends `FrozenList<@Nullable Object>` - -A class to store validated List payloads - -### Method Summary -| Modifier and Type | Method and Description | -| ----------------- | ---------------------- | -| static [ComposedArrayList](#composedarraylist) | of([List](#composedarraylistbuilder) arg, SchemaConfiguration configuration) | - -## ItemsBoxed -public sealed interface ItemsBoxed
-permits
-[ItemsBoxedVoid](#itemsboxedvoid), -[ItemsBoxedBoolean](#itemsboxedboolean), -[ItemsBoxedNumber](#itemsboxednumber), -[ItemsBoxedString](#itemsboxedstring), -[ItemsBoxedList](#itemsboxedlist), -[ItemsBoxedMap](#itemsboxedmap) - -sealed interface that stores validated payloads using boxed classes - -## ItemsBoxedVoid -public record ItemsBoxedVoid
-implements [ItemsBoxed](#itemsboxed) - -record that stores validated null payloads, sealed permits implementation - -### Constructor Summary -| Constructor and Description | -| --------------------------- | -| ItemsBoxedVoid(Nothing? data)
Creates an instance, private visibility | - -### Method Summary -| Modifier and Type | Method and Description | -| ----------------- | ---------------------- | -| Nothing? | data()
validated payload | -| @Nullable Object | getData()
validated payload | - -## ItemsBoxedBoolean -public record ItemsBoxedBoolean
-implements [ItemsBoxed](#itemsboxed) - -record that stores validated boolean payloads, sealed permits implementation - -### Constructor Summary -| Constructor and Description | -| --------------------------- | -| ItemsBoxedBoolean(boolean data)
Creates an instance, private visibility | - -### Method Summary -| Modifier and Type | Method and Description | -| ----------------- | ---------------------- | -| boolean | data()
validated payload | -| @Nullable Object | getData()
validated payload | - -## ItemsBoxedNumber -public record ItemsBoxedNumber
-implements [ItemsBoxed](#itemsboxed) - -record that stores validated Number payloads, sealed permits implementation - -### Constructor Summary -| Constructor and Description | -| --------------------------- | -| ItemsBoxedNumber(Number data)
Creates an instance, private visibility | - -### Method Summary -| Modifier and Type | Method and Description | -| ----------------- | ---------------------- | -| Number | data()
validated payload | -| @Nullable Object | getData()
validated payload | - -## ItemsBoxedString -public record ItemsBoxedString
-implements [ItemsBoxed](#itemsboxed) - -record that stores validated String payloads, sealed permits implementation - -### Constructor Summary -| Constructor and Description | -| --------------------------- | -| ItemsBoxedString(String data)
Creates an instance, private visibility | - -### Method Summary -| Modifier and Type | Method and Description | -| ----------------- | ---------------------- | -| String | data()
validated payload | -| @Nullable Object | getData()
validated payload | - -## ItemsBoxedList -public record ItemsBoxedList
-implements [ItemsBoxed](#itemsboxed) - -record that stores validated List payloads, sealed permits implementation - -### Constructor Summary -| Constructor and Description | -| --------------------------- | -| ItemsBoxedList(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 | - -## ItemsBoxedMap -public record ItemsBoxedMap
-implements [ItemsBoxed](#itemsboxed) - -record that stores validated Map payloads, sealed permits implementation - -### Constructor Summary -| Constructor and Description | -| --------------------------- | -| ItemsBoxedMap(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 | - -## Items -public static class Items
-extends AnyTypeJsonSchema.AnyTypeJsonSchema1 - -A schema class that validates payloads - -| Methods Inherited from class org.openapijsonschematools.client.schemas.AnyTypeJsonSchema.AnyTypeJsonSchema1 | -| ------------------------------------------------------------------ | -| validate | -| validateAndBox | - -[[Back to top]](#top) [[Back to Component Schemas]](../../../README.md#Component-Schemas) [[Back to README]](../../../README.md) diff --git a/samples/client/petstore/kotlin/docs/components/schemas/ComposedBool.md b/samples/client/petstore/kotlin/docs/components/schemas/ComposedBool.md deleted file mode 100644 index 251a502a27e..00000000000 --- a/samples/client/petstore/kotlin/docs/components/schemas/ComposedBool.md +++ /dev/null @@ -1,217 +0,0 @@ -# ComposedBool -org.openapijsonschematools.client.components.schemas.ComposedBool.java -public class ComposedBool
- -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 - -## Nested Class Summary -| Modifier and Type | Class and Description | -| ----------------- | ---------------------- | -| sealed interface | [ComposedBool.ComposedBool1Boxed](#composedbool1boxed)
sealed interface for validated payloads | -| record | [ComposedBool.ComposedBool1BoxedBoolean](#composedbool1boxedboolean)
boxed class to store validated boolean payloads | -| static class | [ComposedBool.ComposedBool1](#composedbool1)
schema class | -| sealed interface | [ComposedBool.Schema0Boxed](#schema0boxed)
sealed interface for validated payloads | -| record | [ComposedBool.Schema0BoxedVoid](#schema0boxedvoid)
boxed class to store validated null payloads | -| record | [ComposedBool.Schema0BoxedBoolean](#schema0boxedboolean)
boxed class to store validated boolean payloads | -| record | [ComposedBool.Schema0BoxedNumber](#schema0boxednumber)
boxed class to store validated Number payloads | -| record | [ComposedBool.Schema0BoxedString](#schema0boxedstring)
boxed class to store validated String payloads | -| record | [ComposedBool.Schema0BoxedList](#schema0boxedlist)
boxed class to store validated List payloads | -| record | [ComposedBool.Schema0BoxedMap](#schema0boxedmap)
boxed class to store validated Map payloads | -| static class | [ComposedBool.Schema0](#schema0)
schema class | - -## ComposedBool1Boxed -public sealed interface ComposedBool1Boxed
-permits
-[ComposedBool1BoxedBoolean](#composedbool1boxedboolean) - -sealed interface that stores validated payloads using boxed classes - -## ComposedBool1BoxedBoolean -public record ComposedBool1BoxedBoolean
-implements [ComposedBool1Boxed](#composedbool1boxed) - -record that stores validated boolean payloads, sealed permits implementation - -### Constructor Summary -| Constructor and Description | -| --------------------------- | -| ComposedBool1BoxedBoolean(boolean data)
Creates an instance, private visibility | - -### Method Summary -| Modifier and Type | Method and Description | -| ----------------- | ---------------------- | -| boolean | data()
validated payload | -| @Nullable Object | getData()
validated payload | - -## ComposedBool1 -public static class ComposedBool1
-extends JsonSchema - -A schema class that validates payloads - -### Code Sample -``` -import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags; -import org.openapijsonschematools.client.configurations.SchemaConfiguration; -import org.openapijsonschematools.client.exceptions.ValidationException; -import org.openapijsonschematools.client.schemas.validation.MapUtils; -import org.openapijsonschematools.client.schemas.validation.FrozenList; -import org.openapijsonschematools.client.schemas.validation.FrozenMap; -import org.openapijsonschematools.client.components.schemas.ComposedBool; - -import java.util.Arrays; -import java.util.List; -import java.util.AbstractMap; - -static final SchemaConfiguration configuration = new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().build()); - -// boolean validation -boolean validatedPayload = ComposedBool.ComposedBool1.validate( - true, - configuration -); -``` - -### Field Summary -| Modifier and Type | Field and Description | -| ----------------- | ---------------------- | -| Set> | type = Set.of(Boolean.class) | -| List> | allOf = List.of(
    [Schema0.class](#schema0)
;)
| - -### Method Summary -| Modifier and Type | Method and Description | -| ----------------- | ---------------------- | -| boolean | validate(boolean arg, SchemaConfiguration configuration) | -| [ComposedBool1BoxedBoolean](#composedbool1boxedboolean) | validateAndBox(boolean arg, SchemaConfiguration configuration) | -| [ComposedBool1Boxed](#composedbool1boxed) | validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) | -| @Nullable Object | validate(@Nullable Object arg, SchemaConfiguration configuration) | - -## Schema0Boxed -public sealed interface Schema0Boxed
-permits
-[Schema0BoxedVoid](#schema0boxedvoid), -[Schema0BoxedBoolean](#schema0boxedboolean), -[Schema0BoxedNumber](#schema0boxednumber), -[Schema0BoxedString](#schema0boxedstring), -[Schema0BoxedList](#schema0boxedlist), -[Schema0BoxedMap](#schema0boxedmap) - -sealed interface that stores validated payloads using boxed classes - -## Schema0BoxedVoid -public record Schema0BoxedVoid
-implements [Schema0Boxed](#schema0boxed) - -record that stores validated null payloads, sealed permits implementation - -### Constructor Summary -| Constructor and Description | -| --------------------------- | -| Schema0BoxedVoid(Nothing? data)
Creates an instance, private visibility | - -### Method Summary -| Modifier and Type | Method and Description | -| ----------------- | ---------------------- | -| Nothing? | data()
validated payload | -| @Nullable Object | getData()
validated payload | - -## Schema0BoxedBoolean -public record Schema0BoxedBoolean
-implements [Schema0Boxed](#schema0boxed) - -record that stores validated boolean payloads, sealed permits implementation - -### Constructor Summary -| Constructor and Description | -| --------------------------- | -| Schema0BoxedBoolean(boolean data)
Creates an instance, private visibility | - -### Method Summary -| Modifier and Type | Method and Description | -| ----------------- | ---------------------- | -| boolean | data()
validated payload | -| @Nullable Object | getData()
validated payload | - -## Schema0BoxedNumber -public record Schema0BoxedNumber
-implements [Schema0Boxed](#schema0boxed) - -record that stores validated Number payloads, sealed permits implementation - -### Constructor Summary -| Constructor and Description | -| --------------------------- | -| Schema0BoxedNumber(Number data)
Creates an instance, private visibility | - -### Method Summary -| Modifier and Type | Method and Description | -| ----------------- | ---------------------- | -| Number | data()
validated payload | -| @Nullable Object | getData()
validated payload | - -## Schema0BoxedString -public record Schema0BoxedString
-implements [Schema0Boxed](#schema0boxed) - -record that stores validated String payloads, sealed permits implementation - -### Constructor Summary -| Constructor and Description | -| --------------------------- | -| Schema0BoxedString(String data)
Creates an instance, private visibility | - -### Method Summary -| Modifier and Type | Method and Description | -| ----------------- | ---------------------- | -| String | data()
validated payload | -| @Nullable Object | getData()
validated payload | - -## Schema0BoxedList -public record Schema0BoxedList
-implements [Schema0Boxed](#schema0boxed) - -record that stores validated List payloads, sealed permits implementation - -### Constructor Summary -| Constructor and Description | -| --------------------------- | -| Schema0BoxedList(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 | - -## Schema0BoxedMap -public record Schema0BoxedMap
-implements [Schema0Boxed](#schema0boxed) - -record that stores validated Map payloads, sealed permits implementation - -### Constructor Summary -| Constructor and Description | -| --------------------------- | -| Schema0BoxedMap(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 | - -## Schema0 -public static class Schema0
-extends AnyTypeJsonSchema.AnyTypeJsonSchema1 - -A schema class that validates payloads - -| Methods Inherited from class org.openapijsonschematools.client.schemas.AnyTypeJsonSchema.AnyTypeJsonSchema1 | -| ------------------------------------------------------------------ | -| validate | -| validateAndBox | - -[[Back to top]](#top) [[Back to Component Schemas]](../../../README.md#Component-Schemas) [[Back to README]](../../../README.md) diff --git a/samples/client/petstore/kotlin/docs/components/schemas/ComposedNone.md b/samples/client/petstore/kotlin/docs/components/schemas/ComposedNone.md deleted file mode 100644 index 06e554db8dc..00000000000 --- a/samples/client/petstore/kotlin/docs/components/schemas/ComposedNone.md +++ /dev/null @@ -1,217 +0,0 @@ -# ComposedNone -org.openapijsonschematools.client.components.schemas.ComposedNone.java -public class ComposedNone
- -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 - -## Nested Class Summary -| Modifier and Type | Class and Description | -| ----------------- | ---------------------- | -| sealed interface | [ComposedNone.ComposedNone1Boxed](#composednone1boxed)
sealed interface for validated payloads | -| record | [ComposedNone.ComposedNone1BoxedVoid](#composednone1boxedvoid)
boxed class to store validated null payloads | -| static class | [ComposedNone.ComposedNone1](#composednone1)
schema class | -| sealed interface | [ComposedNone.Schema0Boxed](#schema0boxed)
sealed interface for validated payloads | -| record | [ComposedNone.Schema0BoxedVoid](#schema0boxedvoid)
boxed class to store validated null payloads | -| record | [ComposedNone.Schema0BoxedBoolean](#schema0boxedboolean)
boxed class to store validated boolean payloads | -| record | [ComposedNone.Schema0BoxedNumber](#schema0boxednumber)
boxed class to store validated Number payloads | -| record | [ComposedNone.Schema0BoxedString](#schema0boxedstring)
boxed class to store validated String payloads | -| record | [ComposedNone.Schema0BoxedList](#schema0boxedlist)
boxed class to store validated List payloads | -| record | [ComposedNone.Schema0BoxedMap](#schema0boxedmap)
boxed class to store validated Map payloads | -| static class | [ComposedNone.Schema0](#schema0)
schema class | - -## ComposedNone1Boxed -public sealed interface ComposedNone1Boxed
-permits
-[ComposedNone1BoxedVoid](#composednone1boxedvoid) - -sealed interface that stores validated payloads using boxed classes - -## ComposedNone1BoxedVoid -public record ComposedNone1BoxedVoid
-implements [ComposedNone1Boxed](#composednone1boxed) - -record that stores validated null payloads, sealed permits implementation - -### Constructor Summary -| Constructor and Description | -| --------------------------- | -| ComposedNone1BoxedVoid(Nothing? data)
Creates an instance, private visibility | - -### Method Summary -| Modifier and Type | Method and Description | -| ----------------- | ---------------------- | -| Nothing? | data()
validated payload | -| @Nullable Object | getData()
validated payload | - -## ComposedNone1 -public static class ComposedNone1
-extends JsonSchema - -A schema class that validates payloads - -### Code Sample -``` -import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags; -import org.openapijsonschematools.client.configurations.SchemaConfiguration; -import org.openapijsonschematools.client.exceptions.ValidationException; -import org.openapijsonschematools.client.schemas.validation.MapUtils; -import org.openapijsonschematools.client.schemas.validation.FrozenList; -import org.openapijsonschematools.client.schemas.validation.FrozenMap; -import org.openapijsonschematools.client.components.schemas.ComposedNone; - -import java.util.Arrays; -import java.util.List; -import java.util.AbstractMap; - -static final SchemaConfiguration configuration = new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().build()); - -// null validation -Nothing? validatedPayload = ComposedNone.ComposedNone1.validate( - (Nothing?) null, - configuration -); -``` - -### Field Summary -| Modifier and Type | Field and Description | -| ----------------- | ---------------------- | -| Set> | type = Set.of(Nothing?.class) | -| List> | allOf = List.of(
    [Schema0.class](#schema0)
;)
| - -### Method Summary -| Modifier and Type | Method and Description | -| ----------------- | ---------------------- | -| Nothing? | validate(Nothing? arg, SchemaConfiguration configuration) | -| [ComposedNone1BoxedVoid](#composednone1boxedvoid) | validateAndBox(Nothing? arg, SchemaConfiguration configuration) | -| [ComposedNone1Boxed](#composednone1boxed) | validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) | -| @Nullable Object | validate(@Nullable Object arg, SchemaConfiguration configuration) | - -## Schema0Boxed -public sealed interface Schema0Boxed
-permits
-[Schema0BoxedVoid](#schema0boxedvoid), -[Schema0BoxedBoolean](#schema0boxedboolean), -[Schema0BoxedNumber](#schema0boxednumber), -[Schema0BoxedString](#schema0boxedstring), -[Schema0BoxedList](#schema0boxedlist), -[Schema0BoxedMap](#schema0boxedmap) - -sealed interface that stores validated payloads using boxed classes - -## Schema0BoxedVoid -public record Schema0BoxedVoid
-implements [Schema0Boxed](#schema0boxed) - -record that stores validated null payloads, sealed permits implementation - -### Constructor Summary -| Constructor and Description | -| --------------------------- | -| Schema0BoxedVoid(Nothing? data)
Creates an instance, private visibility | - -### Method Summary -| Modifier and Type | Method and Description | -| ----------------- | ---------------------- | -| Nothing? | data()
validated payload | -| @Nullable Object | getData()
validated payload | - -## Schema0BoxedBoolean -public record Schema0BoxedBoolean
-implements [Schema0Boxed](#schema0boxed) - -record that stores validated boolean payloads, sealed permits implementation - -### Constructor Summary -| Constructor and Description | -| --------------------------- | -| Schema0BoxedBoolean(boolean data)
Creates an instance, private visibility | - -### Method Summary -| Modifier and Type | Method and Description | -| ----------------- | ---------------------- | -| boolean | data()
validated payload | -| @Nullable Object | getData()
validated payload | - -## Schema0BoxedNumber -public record Schema0BoxedNumber
-implements [Schema0Boxed](#schema0boxed) - -record that stores validated Number payloads, sealed permits implementation - -### Constructor Summary -| Constructor and Description | -| --------------------------- | -| Schema0BoxedNumber(Number data)
Creates an instance, private visibility | - -### Method Summary -| Modifier and Type | Method and Description | -| ----------------- | ---------------------- | -| Number | data()
validated payload | -| @Nullable Object | getData()
validated payload | - -## Schema0BoxedString -public record Schema0BoxedString
-implements [Schema0Boxed](#schema0boxed) - -record that stores validated String payloads, sealed permits implementation - -### Constructor Summary -| Constructor and Description | -| --------------------------- | -| Schema0BoxedString(String data)
Creates an instance, private visibility | - -### Method Summary -| Modifier and Type | Method and Description | -| ----------------- | ---------------------- | -| String | data()
validated payload | -| @Nullable Object | getData()
validated payload | - -## Schema0BoxedList -public record Schema0BoxedList
-implements [Schema0Boxed](#schema0boxed) - -record that stores validated List payloads, sealed permits implementation - -### Constructor Summary -| Constructor and Description | -| --------------------------- | -| Schema0BoxedList(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 | - -## Schema0BoxedMap -public record Schema0BoxedMap
-implements [Schema0Boxed](#schema0boxed) - -record that stores validated Map payloads, sealed permits implementation - -### Constructor Summary -| Constructor and Description | -| --------------------------- | -| Schema0BoxedMap(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 | - -## Schema0 -public static class Schema0
-extends AnyTypeJsonSchema.AnyTypeJsonSchema1 - -A schema class that validates payloads - -| Methods Inherited from class org.openapijsonschematools.client.schemas.AnyTypeJsonSchema.AnyTypeJsonSchema1 | -| ------------------------------------------------------------------ | -| validate | -| validateAndBox | - -[[Back to top]](#top) [[Back to Component Schemas]](../../../README.md#Component-Schemas) [[Back to README]](../../../README.md) diff --git a/samples/client/petstore/kotlin/docs/components/schemas/ComposedNumber.md b/samples/client/petstore/kotlin/docs/components/schemas/ComposedNumber.md deleted file mode 100644 index 64a97f4c0c9..00000000000 --- a/samples/client/petstore/kotlin/docs/components/schemas/ComposedNumber.md +++ /dev/null @@ -1,217 +0,0 @@ -# ComposedNumber -org.openapijsonschematools.client.components.schemas.ComposedNumber.java -public class ComposedNumber
- -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 - -## Nested Class Summary -| Modifier and Type | Class and Description | -| ----------------- | ---------------------- | -| sealed interface | [ComposedNumber.ComposedNumber1Boxed](#composednumber1boxed)
sealed interface for validated payloads | -| record | [ComposedNumber.ComposedNumber1BoxedNumber](#composednumber1boxednumber)
boxed class to store validated Number payloads | -| static class | [ComposedNumber.ComposedNumber1](#composednumber1)
schema class | -| sealed interface | [ComposedNumber.Schema0Boxed](#schema0boxed)
sealed interface for validated payloads | -| record | [ComposedNumber.Schema0BoxedVoid](#schema0boxedvoid)
boxed class to store validated null payloads | -| record | [ComposedNumber.Schema0BoxedBoolean](#schema0boxedboolean)
boxed class to store validated boolean payloads | -| record | [ComposedNumber.Schema0BoxedNumber](#schema0boxednumber)
boxed class to store validated Number payloads | -| record | [ComposedNumber.Schema0BoxedString](#schema0boxedstring)
boxed class to store validated String payloads | -| record | [ComposedNumber.Schema0BoxedList](#schema0boxedlist)
boxed class to store validated List payloads | -| record | [ComposedNumber.Schema0BoxedMap](#schema0boxedmap)
boxed class to store validated Map payloads | -| static class | [ComposedNumber.Schema0](#schema0)
schema class | - -## ComposedNumber1Boxed -public sealed interface ComposedNumber1Boxed
-permits
-[ComposedNumber1BoxedNumber](#composednumber1boxednumber) - -sealed interface that stores validated payloads using boxed classes - -## ComposedNumber1BoxedNumber -public record ComposedNumber1BoxedNumber
-implements [ComposedNumber1Boxed](#composednumber1boxed) - -record that stores validated Number payloads, sealed permits implementation - -### Constructor Summary -| Constructor and Description | -| --------------------------- | -| ComposedNumber1BoxedNumber(Number data)
Creates an instance, private visibility | - -### Method Summary -| Modifier and Type | Method and Description | -| ----------------- | ---------------------- | -| Number | data()
validated payload | -| @Nullable Object | getData()
validated payload | - -## ComposedNumber1 -public static class ComposedNumber1
-extends JsonSchema - -A schema class that validates payloads - -### Code Sample -``` -import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags; -import org.openapijsonschematools.client.configurations.SchemaConfiguration; -import org.openapijsonschematools.client.exceptions.ValidationException; -import org.openapijsonschematools.client.schemas.validation.MapUtils; -import org.openapijsonschematools.client.schemas.validation.FrozenList; -import org.openapijsonschematools.client.schemas.validation.FrozenMap; -import org.openapijsonschematools.client.components.schemas.ComposedNumber; - -import java.util.Arrays; -import java.util.List; -import java.util.AbstractMap; - -static final SchemaConfiguration configuration = new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().build()); - -// int validation -int validatedPayload = ComposedNumber.ComposedNumber1.validate( - 1, - configuration -); -``` - -### Field Summary -| Modifier and Type | Field and Description | -| ----------------- | ---------------------- | -| Set> | type = Set.of(
    Integer.class,
    Long.class,
    Float.class,
    Double.class
)
| -| List> | allOf = List.of(
    [Schema0.class](#schema0)
;)
| - -### Method Summary -| Modifier and Type | Method and Description | -| ----------------- | ---------------------- | -| Number | validate(Number arg, SchemaConfiguration configuration) | -| [ComposedNumber1BoxedNumber](#composednumber1boxednumber) | validateAndBox(Number arg, SchemaConfiguration configuration) | -| [ComposedNumber1Boxed](#composednumber1boxed) | validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) | -| @Nullable Object | validate(@Nullable Object arg, SchemaConfiguration configuration) | - -## Schema0Boxed -public sealed interface Schema0Boxed
-permits
-[Schema0BoxedVoid](#schema0boxedvoid), -[Schema0BoxedBoolean](#schema0boxedboolean), -[Schema0BoxedNumber](#schema0boxednumber), -[Schema0BoxedString](#schema0boxedstring), -[Schema0BoxedList](#schema0boxedlist), -[Schema0BoxedMap](#schema0boxedmap) - -sealed interface that stores validated payloads using boxed classes - -## Schema0BoxedVoid -public record Schema0BoxedVoid
-implements [Schema0Boxed](#schema0boxed) - -record that stores validated null payloads, sealed permits implementation - -### Constructor Summary -| Constructor and Description | -| --------------------------- | -| Schema0BoxedVoid(Nothing? data)
Creates an instance, private visibility | - -### Method Summary -| Modifier and Type | Method and Description | -| ----------------- | ---------------------- | -| Nothing? | data()
validated payload | -| @Nullable Object | getData()
validated payload | - -## Schema0BoxedBoolean -public record Schema0BoxedBoolean
-implements [Schema0Boxed](#schema0boxed) - -record that stores validated boolean payloads, sealed permits implementation - -### Constructor Summary -| Constructor and Description | -| --------------------------- | -| Schema0BoxedBoolean(boolean data)
Creates an instance, private visibility | - -### Method Summary -| Modifier and Type | Method and Description | -| ----------------- | ---------------------- | -| boolean | data()
validated payload | -| @Nullable Object | getData()
validated payload | - -## Schema0BoxedNumber -public record Schema0BoxedNumber
-implements [Schema0Boxed](#schema0boxed) - -record that stores validated Number payloads, sealed permits implementation - -### Constructor Summary -| Constructor and Description | -| --------------------------- | -| Schema0BoxedNumber(Number data)
Creates an instance, private visibility | - -### Method Summary -| Modifier and Type | Method and Description | -| ----------------- | ---------------------- | -| Number | data()
validated payload | -| @Nullable Object | getData()
validated payload | - -## Schema0BoxedString -public record Schema0BoxedString
-implements [Schema0Boxed](#schema0boxed) - -record that stores validated String payloads, sealed permits implementation - -### Constructor Summary -| Constructor and Description | -| --------------------------- | -| Schema0BoxedString(String data)
Creates an instance, private visibility | - -### Method Summary -| Modifier and Type | Method and Description | -| ----------------- | ---------------------- | -| String | data()
validated payload | -| @Nullable Object | getData()
validated payload | - -## Schema0BoxedList -public record Schema0BoxedList
-implements [Schema0Boxed](#schema0boxed) - -record that stores validated List payloads, sealed permits implementation - -### Constructor Summary -| Constructor and Description | -| --------------------------- | -| Schema0BoxedList(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 | - -## Schema0BoxedMap -public record Schema0BoxedMap
-implements [Schema0Boxed](#schema0boxed) - -record that stores validated Map payloads, sealed permits implementation - -### Constructor Summary -| Constructor and Description | -| --------------------------- | -| Schema0BoxedMap(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 | - -## Schema0 -public static class Schema0
-extends AnyTypeJsonSchema.AnyTypeJsonSchema1 - -A schema class that validates payloads - -| Methods Inherited from class org.openapijsonschematools.client.schemas.AnyTypeJsonSchema.AnyTypeJsonSchema1 | -| ------------------------------------------------------------------ | -| validate | -| validateAndBox | - -[[Back to top]](#top) [[Back to Component Schemas]](../../../README.md#Component-Schemas) [[Back to README]](../../../README.md) diff --git a/samples/client/petstore/kotlin/docs/components/schemas/ComposedObject.md b/samples/client/petstore/kotlin/docs/components/schemas/ComposedObject.md deleted file mode 100644 index a37b31f15d5..00000000000 --- a/samples/client/petstore/kotlin/docs/components/schemas/ComposedObject.md +++ /dev/null @@ -1,194 +0,0 @@ -# ComposedObject -org.openapijsonschematools.client.components.schemas.ComposedObject.java -public class ComposedObject
- -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 - -## Nested Class Summary -| Modifier and Type | Class and Description | -| ----------------- | ---------------------- | -| sealed interface | [ComposedObject.ComposedObject1Boxed](#composedobject1boxed)
sealed interface for validated payloads | -| record | [ComposedObject.ComposedObject1BoxedMap](#composedobject1boxedmap)
boxed class to store validated Map payloads | -| static class | [ComposedObject.ComposedObject1](#composedobject1)
schema class | -| sealed interface | [ComposedObject.Schema0Boxed](#schema0boxed)
sealed interface for validated payloads | -| record | [ComposedObject.Schema0BoxedVoid](#schema0boxedvoid)
boxed class to store validated null payloads | -| record | [ComposedObject.Schema0BoxedBoolean](#schema0boxedboolean)
boxed class to store validated boolean payloads | -| record | [ComposedObject.Schema0BoxedNumber](#schema0boxednumber)
boxed class to store validated Number payloads | -| record | [ComposedObject.Schema0BoxedString](#schema0boxedstring)
boxed class to store validated String payloads | -| record | [ComposedObject.Schema0BoxedList](#schema0boxedlist)
boxed class to store validated List payloads | -| record | [ComposedObject.Schema0BoxedMap](#schema0boxedmap)
boxed class to store validated Map payloads | -| static class | [ComposedObject.Schema0](#schema0)
schema class | - -## ComposedObject1Boxed -public sealed interface ComposedObject1Boxed
-permits
-[ComposedObject1BoxedMap](#composedobject1boxedmap) - -sealed interface that stores validated payloads using boxed classes - -## ComposedObject1BoxedMap -public record ComposedObject1BoxedMap
-implements [ComposedObject1Boxed](#composedobject1boxed) - -record that stores validated Map payloads, sealed permits implementation - -### Constructor Summary -| Constructor and Description | -| --------------------------- | -| ComposedObject1BoxedMap(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 | - -## ComposedObject1 -public static class ComposedObject1
-extends JsonSchema - -A schema class that validates payloads - -### Field Summary -| Modifier and Type | Field and Description | -| ----------------- | ---------------------- | -| Set> | type = Set.of(Map.class) | -| List> | allOf = List.of(
    [Schema0.class](#schema0)
;)
| - -### Method Summary -| Modifier and Type | Method and Description | -| ----------------- | ---------------------- | -| FrozenMap | validate(Map<?, ?> arg, SchemaConfiguration configuration) | -| [ComposedObject1BoxedMap](#composedobject1boxedmap) | validateAndBox(Map<?, ?> arg, SchemaConfiguration configuration) | -| [ComposedObject1Boxed](#composedobject1boxed) | validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) | -| @Nullable Object | validate(@Nullable Object arg, SchemaConfiguration configuration) | - -## Schema0Boxed -public sealed interface Schema0Boxed
-permits
-[Schema0BoxedVoid](#schema0boxedvoid), -[Schema0BoxedBoolean](#schema0boxedboolean), -[Schema0BoxedNumber](#schema0boxednumber), -[Schema0BoxedString](#schema0boxedstring), -[Schema0BoxedList](#schema0boxedlist), -[Schema0BoxedMap](#schema0boxedmap) - -sealed interface that stores validated payloads using boxed classes - -## Schema0BoxedVoid -public record Schema0BoxedVoid
-implements [Schema0Boxed](#schema0boxed) - -record that stores validated null payloads, sealed permits implementation - -### Constructor Summary -| Constructor and Description | -| --------------------------- | -| Schema0BoxedVoid(Nothing? data)
Creates an instance, private visibility | - -### Method Summary -| Modifier and Type | Method and Description | -| ----------------- | ---------------------- | -| Nothing? | data()
validated payload | -| @Nullable Object | getData()
validated payload | - -## Schema0BoxedBoolean -public record Schema0BoxedBoolean
-implements [Schema0Boxed](#schema0boxed) - -record that stores validated boolean payloads, sealed permits implementation - -### Constructor Summary -| Constructor and Description | -| --------------------------- | -| Schema0BoxedBoolean(boolean data)
Creates an instance, private visibility | - -### Method Summary -| Modifier and Type | Method and Description | -| ----------------- | ---------------------- | -| boolean | data()
validated payload | -| @Nullable Object | getData()
validated payload | - -## Schema0BoxedNumber -public record Schema0BoxedNumber
-implements [Schema0Boxed](#schema0boxed) - -record that stores validated Number payloads, sealed permits implementation - -### Constructor Summary -| Constructor and Description | -| --------------------------- | -| Schema0BoxedNumber(Number data)
Creates an instance, private visibility | - -### Method Summary -| Modifier and Type | Method and Description | -| ----------------- | ---------------------- | -| Number | data()
validated payload | -| @Nullable Object | getData()
validated payload | - -## Schema0BoxedString -public record Schema0BoxedString
-implements [Schema0Boxed](#schema0boxed) - -record that stores validated String payloads, sealed permits implementation - -### Constructor Summary -| Constructor and Description | -| --------------------------- | -| Schema0BoxedString(String data)
Creates an instance, private visibility | - -### Method Summary -| Modifier and Type | Method and Description | -| ----------------- | ---------------------- | -| String | data()
validated payload | -| @Nullable Object | getData()
validated payload | - -## Schema0BoxedList -public record Schema0BoxedList
-implements [Schema0Boxed](#schema0boxed) - -record that stores validated List payloads, sealed permits implementation - -### Constructor Summary -| Constructor and Description | -| --------------------------- | -| Schema0BoxedList(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 | - -## Schema0BoxedMap -public record Schema0BoxedMap
-implements [Schema0Boxed](#schema0boxed) - -record that stores validated Map payloads, sealed permits implementation - -### Constructor Summary -| Constructor and Description | -| --------------------------- | -| Schema0BoxedMap(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 | - -## Schema0 -public static class Schema0
-extends AnyTypeJsonSchema.AnyTypeJsonSchema1 - -A schema class that validates payloads - -| Methods Inherited from class org.openapijsonschematools.client.schemas.AnyTypeJsonSchema.AnyTypeJsonSchema1 | -| ------------------------------------------------------------------ | -| validate | -| validateAndBox | - -[[Back to top]](#top) [[Back to Component Schemas]](../../../README.md#Component-Schemas) [[Back to README]](../../../README.md) diff --git a/samples/client/petstore/kotlin/docs/components/schemas/ComposedOneOfDifferentTypes.md b/samples/client/petstore/kotlin/docs/components/schemas/ComposedOneOfDifferentTypes.md deleted file mode 100644 index 981677be57f..00000000000 --- a/samples/client/petstore/kotlin/docs/components/schemas/ComposedOneOfDifferentTypes.md +++ /dev/null @@ -1,615 +0,0 @@ -# ComposedOneOfDifferentTypes -org.openapijsonschematools.client.components.schemas.ComposedOneOfDifferentTypes.java -public class ComposedOneOfDifferentTypes
- -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 list payloads, extends FrozenList -- classes to build inputs for list payloads - -## Nested Class Summary -| Modifier and Type | Class and Description | -| ----------------- | ---------------------- | -| sealed interface | [ComposedOneOfDifferentTypes.ComposedOneOfDifferentTypes1Boxed](#composedoneofdifferenttypes1boxed)
sealed interface for validated payloads | -| record | [ComposedOneOfDifferentTypes.ComposedOneOfDifferentTypes1BoxedVoid](#composedoneofdifferenttypes1boxedvoid)
boxed class to store validated null payloads | -| record | [ComposedOneOfDifferentTypes.ComposedOneOfDifferentTypes1BoxedBoolean](#composedoneofdifferenttypes1boxedboolean)
boxed class to store validated boolean payloads | -| record | [ComposedOneOfDifferentTypes.ComposedOneOfDifferentTypes1BoxedNumber](#composedoneofdifferenttypes1boxednumber)
boxed class to store validated Number payloads | -| record | [ComposedOneOfDifferentTypes.ComposedOneOfDifferentTypes1BoxedString](#composedoneofdifferenttypes1boxedstring)
boxed class to store validated String payloads | -| record | [ComposedOneOfDifferentTypes.ComposedOneOfDifferentTypes1BoxedList](#composedoneofdifferenttypes1boxedlist)
boxed class to store validated List payloads | -| record | [ComposedOneOfDifferentTypes.ComposedOneOfDifferentTypes1BoxedMap](#composedoneofdifferenttypes1boxedmap)
boxed class to store validated Map payloads | -| static class | [ComposedOneOfDifferentTypes.ComposedOneOfDifferentTypes1](#composedoneofdifferenttypes1)
schema class | -| sealed interface | [ComposedOneOfDifferentTypes.Schema6Boxed](#schema6boxed)
sealed interface for validated payloads | -| record | [ComposedOneOfDifferentTypes.Schema6BoxedString](#schema6boxedstring)
boxed class to store validated String payloads | -| static class | [ComposedOneOfDifferentTypes.Schema6](#schema6)
schema class | -| sealed interface | [ComposedOneOfDifferentTypes.Schema5Boxed](#schema5boxed)
sealed interface for validated payloads | -| record | [ComposedOneOfDifferentTypes.Schema5BoxedList](#schema5boxedlist)
boxed class to store validated List payloads | -| static class | [ComposedOneOfDifferentTypes.Schema5](#schema5)
schema class | -| static class | [ComposedOneOfDifferentTypes.Schema5ListBuilder](#schema5listbuilder)
builder for List payloads | -| static class | [ComposedOneOfDifferentTypes.Schema5List](#schema5list)
output class for List payloads | -| sealed interface | [ComposedOneOfDifferentTypes.ItemsBoxed](#itemsboxed)
sealed interface for validated payloads | -| record | [ComposedOneOfDifferentTypes.ItemsBoxedVoid](#itemsboxedvoid)
boxed class to store validated null payloads | -| record | [ComposedOneOfDifferentTypes.ItemsBoxedBoolean](#itemsboxedboolean)
boxed class to store validated boolean payloads | -| record | [ComposedOneOfDifferentTypes.ItemsBoxedNumber](#itemsboxednumber)
boxed class to store validated Number payloads | -| record | [ComposedOneOfDifferentTypes.ItemsBoxedString](#itemsboxedstring)
boxed class to store validated String payloads | -| record | [ComposedOneOfDifferentTypes.ItemsBoxedList](#itemsboxedlist)
boxed class to store validated List payloads | -| record | [ComposedOneOfDifferentTypes.ItemsBoxedMap](#itemsboxedmap)
boxed class to store validated Map payloads | -| static class | [ComposedOneOfDifferentTypes.Items](#items)
schema class | -| sealed interface | [ComposedOneOfDifferentTypes.Schema4Boxed](#schema4boxed)
sealed interface for validated payloads | -| record | [ComposedOneOfDifferentTypes.Schema4BoxedMap](#schema4boxedmap)
boxed class to store validated Map payloads | -| static class | [ComposedOneOfDifferentTypes.Schema4](#schema4)
schema class | -| sealed interface | [ComposedOneOfDifferentTypes.Schema3Boxed](#schema3boxed)
sealed interface for validated payloads | -| record | [ComposedOneOfDifferentTypes.Schema3BoxedString](#schema3boxedstring)
boxed class to store validated String payloads | -| static class | [ComposedOneOfDifferentTypes.Schema3](#schema3)
schema class | -| sealed interface | [ComposedOneOfDifferentTypes.Schema2Boxed](#schema2boxed)
sealed interface for validated payloads | -| record | [ComposedOneOfDifferentTypes.Schema2BoxedVoid](#schema2boxedvoid)
boxed class to store validated null payloads | -| static class | [ComposedOneOfDifferentTypes.Schema2](#schema2)
schema class | - -## ComposedOneOfDifferentTypes1Boxed -public sealed interface ComposedOneOfDifferentTypes1Boxed
-permits
-[ComposedOneOfDifferentTypes1BoxedVoid](#composedoneofdifferenttypes1boxedvoid), -[ComposedOneOfDifferentTypes1BoxedBoolean](#composedoneofdifferenttypes1boxedboolean), -[ComposedOneOfDifferentTypes1BoxedNumber](#composedoneofdifferenttypes1boxednumber), -[ComposedOneOfDifferentTypes1BoxedString](#composedoneofdifferenttypes1boxedstring), -[ComposedOneOfDifferentTypes1BoxedList](#composedoneofdifferenttypes1boxedlist), -[ComposedOneOfDifferentTypes1BoxedMap](#composedoneofdifferenttypes1boxedmap) - -sealed interface that stores validated payloads using boxed classes - -## ComposedOneOfDifferentTypes1BoxedVoid -public record ComposedOneOfDifferentTypes1BoxedVoid
-implements [ComposedOneOfDifferentTypes1Boxed](#composedoneofdifferenttypes1boxed) - -record that stores validated null payloads, sealed permits implementation - -### Constructor Summary -| Constructor and Description | -| --------------------------- | -| ComposedOneOfDifferentTypes1BoxedVoid(Nothing? data)
Creates an instance, private visibility | - -### Method Summary -| Modifier and Type | Method and Description | -| ----------------- | ---------------------- | -| Nothing? | data()
validated payload | -| @Nullable Object | getData()
validated payload | - -## ComposedOneOfDifferentTypes1BoxedBoolean -public record ComposedOneOfDifferentTypes1BoxedBoolean
-implements [ComposedOneOfDifferentTypes1Boxed](#composedoneofdifferenttypes1boxed) - -record that stores validated boolean payloads, sealed permits implementation - -### Constructor Summary -| Constructor and Description | -| --------------------------- | -| ComposedOneOfDifferentTypes1BoxedBoolean(boolean data)
Creates an instance, private visibility | - -### Method Summary -| Modifier and Type | Method and Description | -| ----------------- | ---------------------- | -| boolean | data()
validated payload | -| @Nullable Object | getData()
validated payload | - -## ComposedOneOfDifferentTypes1BoxedNumber -public record ComposedOneOfDifferentTypes1BoxedNumber
-implements [ComposedOneOfDifferentTypes1Boxed](#composedoneofdifferenttypes1boxed) - -record that stores validated Number payloads, sealed permits implementation - -### Constructor Summary -| Constructor and Description | -| --------------------------- | -| ComposedOneOfDifferentTypes1BoxedNumber(Number data)
Creates an instance, private visibility | - -### Method Summary -| Modifier and Type | Method and Description | -| ----------------- | ---------------------- | -| Number | data()
validated payload | -| @Nullable Object | getData()
validated payload | - -## ComposedOneOfDifferentTypes1BoxedString -public record ComposedOneOfDifferentTypes1BoxedString
-implements [ComposedOneOfDifferentTypes1Boxed](#composedoneofdifferenttypes1boxed) - -record that stores validated String payloads, sealed permits implementation - -### Constructor Summary -| Constructor and Description | -| --------------------------- | -| ComposedOneOfDifferentTypes1BoxedString(String data)
Creates an instance, private visibility | - -### Method Summary -| Modifier and Type | Method and Description | -| ----------------- | ---------------------- | -| String | data()
validated payload | -| @Nullable Object | getData()
validated payload | - -## ComposedOneOfDifferentTypes1BoxedList -public record ComposedOneOfDifferentTypes1BoxedList
-implements [ComposedOneOfDifferentTypes1Boxed](#composedoneofdifferenttypes1boxed) - -record that stores validated List payloads, sealed permits implementation - -### Constructor Summary -| Constructor and Description | -| --------------------------- | -| ComposedOneOfDifferentTypes1BoxedList(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 | - -## ComposedOneOfDifferentTypes1BoxedMap -public record ComposedOneOfDifferentTypes1BoxedMap
-implements [ComposedOneOfDifferentTypes1Boxed](#composedoneofdifferenttypes1boxed) - -record that stores validated Map payloads, sealed permits implementation - -### Constructor Summary -| Constructor and Description | -| --------------------------- | -| ComposedOneOfDifferentTypes1BoxedMap(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 | - -## ComposedOneOfDifferentTypes1 -public static class ComposedOneOfDifferentTypes1
-extends JsonSchema - -A schema class that validates payloads - -## Description -this is a model that allows payloads of type object or number - -### Field Summary -| Modifier and Type | Field and Description | -| ----------------- | ---------------------- | -| List> | oneOf = List.of(
    [NumberWithValidations.NumberWithValidations1.class](../../components/schemas/NumberWithValidations.md#numberwithvalidations1),
    [Animal.Animal1.class](../../components/schemas/Animal.md#animal1),
    [Schema2.class](#schema2),
    [Schema3.class](#schema3),
    [Schema4.class](#schema4),
    [Schema5.class](#schema5),
    [Schema6.class](#schema6)
))
| - -### Method Summary -| Modifier and Type | Method and Description | -| ----------------- | ---------------------- | -| String | validate(String arg, SchemaConfiguration configuration) | -| Nothing? | validate(Nothing? arg, SchemaConfiguration configuration) | -| int | validate(int arg, SchemaConfiguration configuration) | -| long | validate(long arg, SchemaConfiguration configuration) | -| float | validate(float arg, SchemaConfiguration configuration) | -| double | validate(double arg, SchemaConfiguration configuration) | -| Number | validate(Number arg, SchemaConfiguration configuration) | -| boolean | validate(boolean arg, SchemaConfiguration configuration) | -| FrozenMap<@Nullable Object> | validate(Map<?, ?> arg, SchemaConfiguration configuration) | -| FrozenList<@Nullable Object> | validate(List arg, SchemaConfiguration configuration) | -| [ComposedOneOfDifferentTypes1BoxedString](#composedoneofdifferenttypes1boxedstring) | validateAndBox(String arg, SchemaConfiguration configuration) | -| [ComposedOneOfDifferentTypes1BoxedVoid](#composedoneofdifferenttypes1boxedvoid) | validateAndBox(Nothing? arg, SchemaConfiguration configuration) | -| [ComposedOneOfDifferentTypes1BoxedNumber](#composedoneofdifferenttypes1boxednumber) | validateAndBox(Number arg, SchemaConfiguration configuration) | -| [ComposedOneOfDifferentTypes1BoxedBoolean](#composedoneofdifferenttypes1boxedboolean) | validateAndBox(boolean arg, SchemaConfiguration configuration) | -| [ComposedOneOfDifferentTypes1BoxedMap](#composedoneofdifferenttypes1boxedmap) | validateAndBox(Map<?, ?> arg, SchemaConfiguration configuration) | -| [ComposedOneOfDifferentTypes1BoxedList](#composedoneofdifferenttypes1boxedlist) | validateAndBox(List arg, SchemaConfiguration configuration) | -| [ComposedOneOfDifferentTypes1Boxed](#composedoneofdifferenttypes1boxed) | validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) | -| @Nullable Object | validate(@Nullable Object arg, SchemaConfiguration configuration) | - -## Schema6Boxed -public sealed interface Schema6Boxed
-permits
-[Schema6BoxedString](#schema6boxedstring) - -sealed interface that stores validated payloads using boxed classes - -## Schema6BoxedString -public record Schema6BoxedString
-implements [Schema6Boxed](#schema6boxed) - -record that stores validated String payloads, sealed permits implementation - -### Constructor Summary -| Constructor and Description | -| --------------------------- | -| Schema6BoxedString(String data)
Creates an instance, private visibility | - -### Method Summary -| Modifier and Type | Method and Description | -| ----------------- | ---------------------- | -| String | data()
validated payload | -| @Nullable Object | getData()
validated payload | - -## Schema6 -public static class Schema6
-extends JsonSchema - -A schema class that validates payloads - -### Code Sample -``` -import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags; -import org.openapijsonschematools.client.configurations.SchemaConfiguration; -import org.openapijsonschematools.client.exceptions.ValidationException; -import org.openapijsonschematools.client.schemas.validation.MapUtils; -import org.openapijsonschematools.client.schemas.validation.FrozenList; -import org.openapijsonschematools.client.schemas.validation.FrozenMap; -import org.openapijsonschematools.client.components.schemas.ComposedOneOfDifferentTypes; - -import java.util.Arrays; -import java.util.List; -import java.util.AbstractMap; - -static final SchemaConfiguration configuration = new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().build()); - -// String validation -String validatedPayload = ComposedOneOfDifferentTypes.Schema6.validate( - "2020jUR,rZ#UM/?R,Fp^l6$ARj", - configuration -); -``` - -### Field Summary -| Modifier and Type | Field and Description | -| ----------------- | ---------------------- | -| Set> | type = Set.of(
    String.class
)
| -| String | type = "date-time"; | -| Pattern | pattern = Pattern.compile(
    "^2020.*"
)
| - -### Method Summary -| Modifier and Type | Method and Description | -| ----------------- | ---------------------- | -| String | validate(String arg, SchemaConfiguration configuration) | -| [Schema6BoxedString](#schema6boxedstring) | validateAndBox(String arg, SchemaConfiguration configuration) | -| [Schema6Boxed](#schema6boxed) | validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) | -| @Nullable Object | validate(@Nullable Object arg, SchemaConfiguration configuration) | - -## Schema5Boxed -public sealed interface Schema5Boxed
-permits
-[Schema5BoxedList](#schema5boxedlist) - -sealed interface that stores validated payloads using boxed classes - -## Schema5BoxedList -public record Schema5BoxedList
-implements [Schema5Boxed](#schema5boxed) - -record that stores validated List payloads, sealed permits implementation - -### Constructor Summary -| Constructor and Description | -| --------------------------- | -| Schema5BoxedList([Schema5List](#schema5list) data)
Creates an instance, private visibility | - -### Method Summary -| Modifier and Type | Method and Description | -| ----------------- | ---------------------- | -| [Schema5List](#schema5list) | data()
validated payload | -| @Nullable Object | getData()
validated payload | - -## Schema5 -public static class Schema5
-extends JsonSchema - -A schema class that validates payloads - -### Code Sample -``` -import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags; -import org.openapijsonschematools.client.configurations.SchemaConfiguration; -import org.openapijsonschematools.client.exceptions.ValidationException; -import org.openapijsonschematools.client.schemas.validation.MapUtils; -import org.openapijsonschematools.client.schemas.validation.FrozenList; -import org.openapijsonschematools.client.schemas.validation.FrozenMap; -import org.openapijsonschematools.client.components.schemas.ComposedOneOfDifferentTypes; - -import java.util.Arrays; -import java.util.List; -import java.util.AbstractMap; - -static final SchemaConfiguration configuration = new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().build()); - -// List validation -ComposedOneOfDifferentTypes.Schema5List validatedPayload = - ComposedOneOfDifferentTypes.Schema5.validate( - new ComposedOneOfDifferentTypes.Schema5ListBuilder() - .build(), - configuration -); -``` - -### Field Summary -| Modifier and Type | Field and Description | -| ----------------- | ---------------------- | -| Set> | type = Set.of(List.class) | -| Class | items = [Items.class](#items) | -| Integer | maxItems = 4 | -| Integer | minItems = 4 | - -### Method Summary -| Modifier and Type | Method and Description | -| ----------------- | ---------------------- | -| [Schema5List](#schema5list) | validate([List](#schema5listbuilder) arg, SchemaConfiguration configuration) | -| [Schema5BoxedList](#schema5boxedlist) | validateAndBox([List](#schema5listbuilder) arg, SchemaConfiguration configuration) | -| [Schema5Boxed](#schema5boxed) | validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) | -| @Nullable Object | validate(@Nullable Object arg, SchemaConfiguration configuration) | - -## Schema5ListBuilder -public class Schema5ListBuilder
-builder for `List<@Nullable Object>` - -A class that builds the List input type - -### Constructor Summary -| Constructor and Description | -| --------------------------- | -| Schema5ListBuilder()
Creates an empty list | -| Schema5ListBuilder(List<@Nullable Object> items)
Stores the items in a list | - -### Method Summary -| Modifier and Type | Method and Description | -| ----------------- | ---------------------- | -| Schema5ListBuilder | add(Nothing? item) | -| Schema5ListBuilder | add(boolean item) | -| Schema5ListBuilder | add(String item) | -| Schema5ListBuilder | add(int item) | -| Schema5ListBuilder | add(float item) | -| Schema5ListBuilder | add(long item) | -| Schema5ListBuilder | add(double item) | -| Schema5ListBuilder | add(List item) | -| Schema5ListBuilder | add(Map item) | -| List<@Nullable Object> | build()
Returns list input that should be used with Schema.validate | - -## Schema5List -public class Schema5List
-extends `FrozenList<@Nullable Object>` - -A class to store validated List payloads - -### Method Summary -| Modifier and Type | Method and Description | -| ----------------- | ---------------------- | -| static [Schema5List](#schema5list) | of([List](#schema5listbuilder) arg, SchemaConfiguration configuration) | - -## ItemsBoxed -public sealed interface ItemsBoxed
-permits
-[ItemsBoxedVoid](#itemsboxedvoid), -[ItemsBoxedBoolean](#itemsboxedboolean), -[ItemsBoxedNumber](#itemsboxednumber), -[ItemsBoxedString](#itemsboxedstring), -[ItemsBoxedList](#itemsboxedlist), -[ItemsBoxedMap](#itemsboxedmap) - -sealed interface that stores validated payloads using boxed classes - -## ItemsBoxedVoid -public record ItemsBoxedVoid
-implements [ItemsBoxed](#itemsboxed) - -record that stores validated null payloads, sealed permits implementation - -### Constructor Summary -| Constructor and Description | -| --------------------------- | -| ItemsBoxedVoid(Nothing? data)
Creates an instance, private visibility | - -### Method Summary -| Modifier and Type | Method and Description | -| ----------------- | ---------------------- | -| Nothing? | data()
validated payload | -| @Nullable Object | getData()
validated payload | - -## ItemsBoxedBoolean -public record ItemsBoxedBoolean
-implements [ItemsBoxed](#itemsboxed) - -record that stores validated boolean payloads, sealed permits implementation - -### Constructor Summary -| Constructor and Description | -| --------------------------- | -| ItemsBoxedBoolean(boolean data)
Creates an instance, private visibility | - -### Method Summary -| Modifier and Type | Method and Description | -| ----------------- | ---------------------- | -| boolean | data()
validated payload | -| @Nullable Object | getData()
validated payload | - -## ItemsBoxedNumber -public record ItemsBoxedNumber
-implements [ItemsBoxed](#itemsboxed) - -record that stores validated Number payloads, sealed permits implementation - -### Constructor Summary -| Constructor and Description | -| --------------------------- | -| ItemsBoxedNumber(Number data)
Creates an instance, private visibility | - -### Method Summary -| Modifier and Type | Method and Description | -| ----------------- | ---------------------- | -| Number | data()
validated payload | -| @Nullable Object | getData()
validated payload | - -## ItemsBoxedString -public record ItemsBoxedString
-implements [ItemsBoxed](#itemsboxed) - -record that stores validated String payloads, sealed permits implementation - -### Constructor Summary -| Constructor and Description | -| --------------------------- | -| ItemsBoxedString(String data)
Creates an instance, private visibility | - -### Method Summary -| Modifier and Type | Method and Description | -| ----------------- | ---------------------- | -| String | data()
validated payload | -| @Nullable Object | getData()
validated payload | - -## ItemsBoxedList -public record ItemsBoxedList
-implements [ItemsBoxed](#itemsboxed) - -record that stores validated List payloads, sealed permits implementation - -### Constructor Summary -| Constructor and Description | -| --------------------------- | -| ItemsBoxedList(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 | - -## ItemsBoxedMap -public record ItemsBoxedMap
-implements [ItemsBoxed](#itemsboxed) - -record that stores validated Map payloads, sealed permits implementation - -### Constructor Summary -| Constructor and Description | -| --------------------------- | -| ItemsBoxedMap(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 | - -## Items -public static class Items
-extends AnyTypeJsonSchema.AnyTypeJsonSchema1 - -A schema class that validates payloads - -| Methods Inherited from class org.openapijsonschematools.client.schemas.AnyTypeJsonSchema.AnyTypeJsonSchema1 | -| ------------------------------------------------------------------ | -| validate | -| validateAndBox | - -## Schema4Boxed -public sealed interface Schema4Boxed
-permits
-[Schema4BoxedMap](#schema4boxedmap) - -sealed interface that stores validated payloads using boxed classes - -## Schema4BoxedMap -public record Schema4BoxedMap
-implements [Schema4Boxed](#schema4boxed) - -record that stores validated Map payloads, sealed permits implementation - -### Constructor Summary -| Constructor and Description | -| --------------------------- | -| Schema4BoxedMap(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 | - -## Schema4 -public static class Schema4
-extends JsonSchema - -A schema class that validates payloads - -### Field Summary -| Modifier and Type | Field and Description | -| ----------------- | ---------------------- | -| Set> | type = Set.of(Map.class) | -| Integer | maxProperties = 4 | -| Integer | minProperties = 4 | - -### Method Summary -| Modifier and Type | Method and Description | -| ----------------- | ---------------------- | -| FrozenMap | validate(Map<?, ?> arg, SchemaConfiguration configuration) | -| [Schema4BoxedMap](#schema4boxedmap) | validateAndBox(Map<?, ?> arg, SchemaConfiguration configuration) | -| [Schema4Boxed](#schema4boxed) | validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) | -| @Nullable Object | validate(@Nullable Object arg, SchemaConfiguration configuration) | - -## Schema3Boxed -public sealed interface Schema3Boxed
-permits
-[Schema3BoxedString](#schema3boxedstring) - -sealed interface that stores validated payloads using boxed classes - -## Schema3BoxedString -public record Schema3BoxedString
-implements [Schema3Boxed](#schema3boxed) - -record that stores validated String payloads, sealed permits implementation - -### Constructor Summary -| Constructor and Description | -| --------------------------- | -| Schema3BoxedString(String data)
Creates an instance, private visibility | - -### Method Summary -| Modifier and Type | Method and Description | -| ----------------- | ---------------------- | -| String | data()
validated payload | -| @Nullable Object | getData()
validated payload | - -## Schema3 -public static class Schema3
-extends DateJsonSchema.DateJsonSchema1 - -A schema class that validates payloads - -| Methods Inherited from class org.openapijsonschematools.client.schemas.DateJsonSchema.DateJsonSchema1 | -| ------------------------------------------------------------------ | -| validate | -| validateAndBox | - -## Schema2Boxed -public sealed interface Schema2Boxed
-permits
-[Schema2BoxedVoid](#schema2boxedvoid) - -sealed interface that stores validated payloads using boxed classes - -## Schema2BoxedVoid -public record Schema2BoxedVoid
-implements [Schema2Boxed](#schema2boxed) - -record that stores validated null payloads, sealed permits implementation - -### Constructor Summary -| Constructor and Description | -| --------------------------- | -| Schema2BoxedVoid(Nothing? data)
Creates an instance, private visibility | - -### Method Summary -| Modifier and Type | Method and Description | -| ----------------- | ---------------------- | -| Nothing? | data()
validated payload | -| @Nullable Object | getData()
validated payload | - -## Schema2 -public static class Schema2
-extends NullJsonSchema.NullJsonSchema1 - -A schema class that validates payloads - -| Methods Inherited from class org.openapijsonschematools.client.schemas.NullJsonSchema.NullJsonSchema1 | -| ------------------------------------------------------------------ | -| validate | -| validateAndBox | - -[[Back to top]](#top) [[Back to Component Schemas]](../../../README.md#Component-Schemas) [[Back to README]](../../../README.md) diff --git a/samples/client/petstore/kotlin/docs/components/schemas/ComposedString.md b/samples/client/petstore/kotlin/docs/components/schemas/ComposedString.md deleted file mode 100644 index dc49afc203b..00000000000 --- a/samples/client/petstore/kotlin/docs/components/schemas/ComposedString.md +++ /dev/null @@ -1,217 +0,0 @@ -# ComposedString -org.openapijsonschematools.client.components.schemas.ComposedString.java -public class ComposedString
- -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 - -## Nested Class Summary -| Modifier and Type | Class and Description | -| ----------------- | ---------------------- | -| sealed interface | [ComposedString.ComposedString1Boxed](#composedstring1boxed)
sealed interface for validated payloads | -| record | [ComposedString.ComposedString1BoxedString](#composedstring1boxedstring)
boxed class to store validated String payloads | -| static class | [ComposedString.ComposedString1](#composedstring1)
schema class | -| sealed interface | [ComposedString.Schema0Boxed](#schema0boxed)
sealed interface for validated payloads | -| record | [ComposedString.Schema0BoxedVoid](#schema0boxedvoid)
boxed class to store validated null payloads | -| record | [ComposedString.Schema0BoxedBoolean](#schema0boxedboolean)
boxed class to store validated boolean payloads | -| record | [ComposedString.Schema0BoxedNumber](#schema0boxednumber)
boxed class to store validated Number payloads | -| record | [ComposedString.Schema0BoxedString](#schema0boxedstring)
boxed class to store validated String payloads | -| record | [ComposedString.Schema0BoxedList](#schema0boxedlist)
boxed class to store validated List payloads | -| record | [ComposedString.Schema0BoxedMap](#schema0boxedmap)
boxed class to store validated Map payloads | -| static class | [ComposedString.Schema0](#schema0)
schema class | - -## ComposedString1Boxed -public sealed interface ComposedString1Boxed
-permits
-[ComposedString1BoxedString](#composedstring1boxedstring) - -sealed interface that stores validated payloads using boxed classes - -## ComposedString1BoxedString -public record ComposedString1BoxedString
-implements [ComposedString1Boxed](#composedstring1boxed) - -record that stores validated String payloads, sealed permits implementation - -### Constructor Summary -| Constructor and Description | -| --------------------------- | -| ComposedString1BoxedString(String data)
Creates an instance, private visibility | - -### Method Summary -| Modifier and Type | Method and Description | -| ----------------- | ---------------------- | -| String | data()
validated payload | -| @Nullable Object | getData()
validated payload | - -## ComposedString1 -public static class ComposedString1
-extends JsonSchema - -A schema class that validates payloads - -### Code Sample -``` -import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags; -import org.openapijsonschematools.client.configurations.SchemaConfiguration; -import org.openapijsonschematools.client.exceptions.ValidationException; -import org.openapijsonschematools.client.schemas.validation.MapUtils; -import org.openapijsonschematools.client.schemas.validation.FrozenList; -import org.openapijsonschematools.client.schemas.validation.FrozenMap; -import org.openapijsonschematools.client.components.schemas.ComposedString; - -import java.util.Arrays; -import java.util.List; -import java.util.AbstractMap; - -static final SchemaConfiguration configuration = new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().build()); - -// String validation -String validatedPayload = ComposedString.ComposedString1.validate( - "a", - configuration -); -``` - -### Field Summary -| Modifier and Type | Field and Description | -| ----------------- | ---------------------- | -| Set> | type = Set.of(
    String.class
)
| -| List> | allOf = List.of(
    [Schema0.class](#schema0)
;)
| - -### Method Summary -| Modifier and Type | Method and Description | -| ----------------- | ---------------------- | -| String | validate(String arg, SchemaConfiguration configuration) | -| [ComposedString1BoxedString](#composedstring1boxedstring) | validateAndBox(String arg, SchemaConfiguration configuration) | -| [ComposedString1Boxed](#composedstring1boxed) | validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) | -| @Nullable Object | validate(@Nullable Object arg, SchemaConfiguration configuration) | - -## Schema0Boxed -public sealed interface Schema0Boxed
-permits
-[Schema0BoxedVoid](#schema0boxedvoid), -[Schema0BoxedBoolean](#schema0boxedboolean), -[Schema0BoxedNumber](#schema0boxednumber), -[Schema0BoxedString](#schema0boxedstring), -[Schema0BoxedList](#schema0boxedlist), -[Schema0BoxedMap](#schema0boxedmap) - -sealed interface that stores validated payloads using boxed classes - -## Schema0BoxedVoid -public record Schema0BoxedVoid
-implements [Schema0Boxed](#schema0boxed) - -record that stores validated null payloads, sealed permits implementation - -### Constructor Summary -| Constructor and Description | -| --------------------------- | -| Schema0BoxedVoid(Nothing? data)
Creates an instance, private visibility | - -### Method Summary -| Modifier and Type | Method and Description | -| ----------------- | ---------------------- | -| Nothing? | data()
validated payload | -| @Nullable Object | getData()
validated payload | - -## Schema0BoxedBoolean -public record Schema0BoxedBoolean
-implements [Schema0Boxed](#schema0boxed) - -record that stores validated boolean payloads, sealed permits implementation - -### Constructor Summary -| Constructor and Description | -| --------------------------- | -| Schema0BoxedBoolean(boolean data)
Creates an instance, private visibility | - -### Method Summary -| Modifier and Type | Method and Description | -| ----------------- | ---------------------- | -| boolean | data()
validated payload | -| @Nullable Object | getData()
validated payload | - -## Schema0BoxedNumber -public record Schema0BoxedNumber
-implements [Schema0Boxed](#schema0boxed) - -record that stores validated Number payloads, sealed permits implementation - -### Constructor Summary -| Constructor and Description | -| --------------------------- | -| Schema0BoxedNumber(Number data)
Creates an instance, private visibility | - -### Method Summary -| Modifier and Type | Method and Description | -| ----------------- | ---------------------- | -| Number | data()
validated payload | -| @Nullable Object | getData()
validated payload | - -## Schema0BoxedString -public record Schema0BoxedString
-implements [Schema0Boxed](#schema0boxed) - -record that stores validated String payloads, sealed permits implementation - -### Constructor Summary -| Constructor and Description | -| --------------------------- | -| Schema0BoxedString(String data)
Creates an instance, private visibility | - -### Method Summary -| Modifier and Type | Method and Description | -| ----------------- | ---------------------- | -| String | data()
validated payload | -| @Nullable Object | getData()
validated payload | - -## Schema0BoxedList -public record Schema0BoxedList
-implements [Schema0Boxed](#schema0boxed) - -record that stores validated List payloads, sealed permits implementation - -### Constructor Summary -| Constructor and Description | -| --------------------------- | -| Schema0BoxedList(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 | - -## Schema0BoxedMap -public record Schema0BoxedMap
-implements [Schema0Boxed](#schema0boxed) - -record that stores validated Map payloads, sealed permits implementation - -### Constructor Summary -| Constructor and Description | -| --------------------------- | -| Schema0BoxedMap(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 | - -## Schema0 -public static class Schema0
-extends AnyTypeJsonSchema.AnyTypeJsonSchema1 - -A schema class that validates payloads - -| Methods Inherited from class org.openapijsonschematools.client.schemas.AnyTypeJsonSchema.AnyTypeJsonSchema1 | -| ------------------------------------------------------------------ | -| validate | -| validateAndBox | - -[[Back to top]](#top) [[Back to Component Schemas]](../../../README.md#Component-Schemas) [[Back to README]](../../../README.md) diff --git a/samples/client/petstore/kotlin/docs/components/schemas/Currency.md b/samples/client/petstore/kotlin/docs/components/schemas/Currency.md deleted file mode 100644 index 0823b95de18..00000000000 --- a/samples/client/petstore/kotlin/docs/components/schemas/Currency.md +++ /dev/null @@ -1,99 +0,0 @@ -# Currency -org.openapijsonschematools.client.components.schemas.Currency.java -public class Currency
- -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 -- enum classes - -## Nested Class Summary -| Modifier and Type | Class and Description | -| ----------------- | ---------------------- | -| sealed interface | [Currency.Currency1Boxed](#currency1boxed)
sealed interface for validated payloads | -| record | [Currency.Currency1BoxedString](#currency1boxedstring)
boxed class to store validated String payloads | -| static class | [Currency.Currency1](#currency1)
schema class | -| enum | [Currency.StringCurrencyEnums](#stringcurrencyenums)
String enum | - -## Currency1Boxed -public sealed interface Currency1Boxed
-permits
-[Currency1BoxedString](#currency1boxedstring) - -sealed interface that stores validated payloads using boxed classes - -## Currency1BoxedString -public record Currency1BoxedString
-implements [Currency1Boxed](#currency1boxed) - -record that stores validated String payloads, sealed permits implementation - -### Constructor Summary -| Constructor and Description | -| --------------------------- | -| Currency1BoxedString(String data)
Creates an instance, private visibility | - -### Method Summary -| Modifier and Type | Method and Description | -| ----------------- | ---------------------- | -| String | data()
validated payload | -| @Nullable Object | getData()
validated payload | - -## Currency1 -public static class Currency1
-extends JsonSchema - -A schema class that validates payloads - -### Code Sample -``` -import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags; -import org.openapijsonschematools.client.configurations.SchemaConfiguration; -import org.openapijsonschematools.client.exceptions.ValidationException; -import org.openapijsonschematools.client.schemas.validation.MapUtils; -import org.openapijsonschematools.client.schemas.validation.FrozenList; -import org.openapijsonschematools.client.schemas.validation.FrozenMap; -import org.openapijsonschematools.client.components.schemas.Currency; - -import java.util.Arrays; -import java.util.List; -import java.util.AbstractMap; - -static final SchemaConfiguration configuration = new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().build()); - -// String validation -String validatedPayload = Currency.Currency1.validate( - "eur", - configuration -); -``` - -### Field Summary -| Modifier and Type | Field and Description | -| ----------------- | ---------------------- | -| Set> | type = Set.of(
    String.class
)
| -| Set | enumValues = SetMaker.makeSet(
    "eur",
    "usd"
)
| - -### Method Summary -| Modifier and Type | Method and Description | -| ----------------- | ---------------------- | -| String | validate(String arg, SchemaConfiguration configuration) | -| String | validate([StringCurrencyEnums](#stringcurrencyenums) arg, SchemaConfiguration configuration) | -| [Currency1BoxedString](#currency1boxedstring) | validateAndBox(String arg, SchemaConfiguration configuration) | -| [Currency1Boxed](#currency1boxed) | validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) | -| @Nullable Object | validate(@Nullable Object arg, SchemaConfiguration configuration) | - -## StringCurrencyEnums -public enum StringCurrencyEnums
-extends `Enum` - -A class that stores String enum values - -### Enum Constant Summary -| Enum Constant | Description | -| ------------- | ----------- | -| EUR | value = "eur" | -| USD | value = "usd" | - -[[Back to top]](#top) [[Back to Component Schemas]](../../../README.md#Component-Schemas) [[Back to README]](../../../README.md) diff --git a/samples/client/petstore/kotlin/docs/components/schemas/DanishPig.md b/samples/client/petstore/kotlin/docs/components/schemas/DanishPig.md deleted file mode 100644 index 7515796e1ea..00000000000 --- a/samples/client/petstore/kotlin/docs/components/schemas/DanishPig.md +++ /dev/null @@ -1,232 +0,0 @@ -# DanishPig -org.openapijsonschematools.client.components.schemas.DanishPig.java -public class DanishPig
- -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 | [DanishPig.DanishPig1Boxed](#danishpig1boxed)
sealed interface for validated payloads | -| record | [DanishPig.DanishPig1BoxedMap](#danishpig1boxedmap)
boxed class to store validated Map payloads | -| static class | [DanishPig.DanishPig1](#danishpig1)
schema class | -| static class | [DanishPig.DanishPigMapBuilder](#danishpigmapbuilder)
builder for Map payloads | -| static class | [DanishPig.DanishPigMap](#danishpigmap)
output class for Map payloads | -| sealed interface | [DanishPig.ClassNameBoxed](#classnameboxed)
sealed interface for validated payloads | -| record | [DanishPig.ClassNameBoxedString](#classnameboxedstring)
boxed class to store validated String payloads | -| static class | [DanishPig.ClassName](#classname)
schema class | -| enum | [DanishPig.StringClassNameEnums](#stringclassnameenums)
String enum | - -## DanishPig1Boxed -public sealed interface DanishPig1Boxed
-permits
-[DanishPig1BoxedMap](#danishpig1boxedmap) - -sealed interface that stores validated payloads using boxed classes - -## DanishPig1BoxedMap -public record DanishPig1BoxedMap
-implements [DanishPig1Boxed](#danishpig1boxed) - -record that stores validated Map payloads, sealed permits implementation - -### Constructor Summary -| Constructor and Description | -| --------------------------- | -| DanishPig1BoxedMap([DanishPigMap](#danishpigmap) data)
Creates an instance, private visibility | - -### Method Summary -| Modifier and Type | Method and Description | -| ----------------- | ---------------------- | -| [DanishPigMap](#danishpigmap) | data()
validated payload | -| @Nullable Object | getData()
validated payload | - -## DanishPig1 -public static class DanishPig1
-extends JsonSchema - -A schema class that validates payloads - -### Code Sample -``` -import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags; -import org.openapijsonschematools.client.configurations.SchemaConfiguration; -import org.openapijsonschematools.client.exceptions.ValidationException; -import org.openapijsonschematools.client.schemas.validation.MapUtils; -import org.openapijsonschematools.client.schemas.validation.FrozenList; -import org.openapijsonschematools.client.schemas.validation.FrozenMap; -import org.openapijsonschematools.client.components.schemas.DanishPig; - -import java.util.Arrays; -import java.util.List; -import java.util.AbstractMap; - -static final SchemaConfiguration configuration = new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().build()); - -// Map validation -DanishPig.DanishPigMap validatedPayload = - DanishPig.DanishPig1.validate( - new DanishPig.DanishPigMapBuilder() - .className("DanishPig") - - .build(), - configuration -); -``` - -### Field Summary -| Modifier and Type | Field and Description | -| ----------------- | ---------------------- | -| Set> | type = Set.of(Map.class) | -| Map> | properties = Map.ofEntries(
    new PropertyEntry("className", [ClassName.class](#classname)))
)
| -| Set | required = Set.of(
    "className"
)
| - -### Method Summary -| Modifier and Type | Method and Description | -| ----------------- | ---------------------- | -| [DanishPigMap](#danishpigmap) | validate([Map<?, ?>](#danishpigmapbuilder) arg, SchemaConfiguration configuration) | -| [DanishPig1BoxedMap](#danishpig1boxedmap) | validateAndBox([Map<?, ?>](#danishpigmapbuilder) arg, SchemaConfiguration configuration) | -| [DanishPig1Boxed](#danishpig1boxed) | validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) | -| @Nullable Object | validate(@Nullable Object arg, SchemaConfiguration configuration) | - -## DanishPigMap0Builder -public class DanishPigMap0Builder
-builder for `Map` - -A class that builds the Map input type - -### Constructor Summary -| Constructor and Description | -| --------------------------- | -| DanishPigMap0Builder(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 | -| [DanishPigMap0Builder](#danishpigmap0builder) | additionalProperty(String key, Nothing? value) | -| [DanishPigMap0Builder](#danishpigmap0builder) | additionalProperty(String key, boolean value) | -| [DanishPigMap0Builder](#danishpigmap0builder) | additionalProperty(String key, String value) | -| [DanishPigMap0Builder](#danishpigmap0builder) | additionalProperty(String key, int value) | -| [DanishPigMap0Builder](#danishpigmap0builder) | additionalProperty(String key, float value) | -| [DanishPigMap0Builder](#danishpigmap0builder) | additionalProperty(String key, long value) | -| [DanishPigMap0Builder](#danishpigmap0builder) | additionalProperty(String key, double value) | -| [DanishPigMap0Builder](#danishpigmap0builder) | additionalProperty(String key, List value) | -| [DanishPigMap0Builder](#danishpigmap0builder) | additionalProperty(String key, Map value) | - -## DanishPigMapBuilder -public class DanishPigMapBuilder
-builder for `Map` - -A class that builds the Map input type - -### Constructor Summary -| Constructor and Description | -| --------------------------- | -| DanishPigMapBuilder()
Creates a builder that contains an empty map | - -### Method Summary -| Modifier and Type | Method and Description | -| ----------------- | ---------------------- | -| [DanishPigMap0Builder](#danishpigmap0builder) | className(String value) | -| [DanishPigMap0Builder](#danishpigmap0builder) | className([StringClassNameEnums](#stringclassnameenums) value) | - -## DanishPigMap -public static class DanishPigMap
-extends FrozenMap - -A class to store validated Map payloads - -### Method Summary -| Modifier and Type | Method and Description | -| ----------------- | ---------------------- | -| static [DanishPigMap](#danishpigmap) | of([Map](#danishpigmapbuilder) arg, SchemaConfiguration configuration) | -| String | className()
must be one of ["DanishPig"] | -| @Nullable Object | getAdditionalProperty(String name)
provides type safety for additional properties | - -## ClassNameBoxed -public sealed interface ClassNameBoxed
-permits
-[ClassNameBoxedString](#classnameboxedstring) - -sealed interface that stores validated payloads using boxed classes - -## ClassNameBoxedString -public record ClassNameBoxedString
-implements [ClassNameBoxed](#classnameboxed) - -record that stores validated String payloads, sealed permits implementation - -### Constructor Summary -| Constructor and Description | -| --------------------------- | -| ClassNameBoxedString(String data)
Creates an instance, private visibility | - -### Method Summary -| Modifier and Type | Method and Description | -| ----------------- | ---------------------- | -| String | data()
validated payload | -| @Nullable Object | getData()
validated payload | - -## ClassName -public static class ClassName
-extends JsonSchema - -A schema class that validates payloads - -### Code Sample -``` -import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags; -import org.openapijsonschematools.client.configurations.SchemaConfiguration; -import org.openapijsonschematools.client.exceptions.ValidationException; -import org.openapijsonschematools.client.schemas.validation.MapUtils; -import org.openapijsonschematools.client.schemas.validation.FrozenList; -import org.openapijsonschematools.client.schemas.validation.FrozenMap; -import org.openapijsonschematools.client.components.schemas.DanishPig; - -import java.util.Arrays; -import java.util.List; -import java.util.AbstractMap; - -static final SchemaConfiguration configuration = new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().build()); - -// String validation -String validatedPayload = DanishPig.ClassName.validate( - "DanishPig", - configuration -); -``` - -### Field Summary -| Modifier and Type | Field and Description | -| ----------------- | ---------------------- | -| Set> | type = Set.of(
    String.class
)
| -| Set | enumValues = SetMaker.makeSet(
    "DanishPig"
)
| - -### Method Summary -| Modifier and Type | Method and Description | -| ----------------- | ---------------------- | -| String | validate(String arg, SchemaConfiguration configuration) | -| String | validate([StringClassNameEnums](#stringclassnameenums) arg, SchemaConfiguration configuration) | -| [ClassNameBoxedString](#classnameboxedstring) | validateAndBox(String arg, SchemaConfiguration configuration) | -| [ClassNameBoxed](#classnameboxed) | validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) | -| @Nullable Object | validate(@Nullable Object arg, SchemaConfiguration configuration) | - -## StringClassNameEnums -public enum StringClassNameEnums
-extends `Enum` - -A class that stores String enum values - -### Enum Constant Summary -| Enum Constant | Description | -| ------------- | ----------- | -| DANISH_PIG | value = "DanishPig" | - -[[Back to top]](#top) [[Back to Component Schemas]](../../../README.md#Component-Schemas) [[Back to README]](../../../README.md) diff --git a/samples/client/petstore/kotlin/docs/components/schemas/DateTimeTest.md b/samples/client/petstore/kotlin/docs/components/schemas/DateTimeTest.md deleted file mode 100644 index e6c590b86bf..00000000000 --- a/samples/client/petstore/kotlin/docs/components/schemas/DateTimeTest.md +++ /dev/null @@ -1,85 +0,0 @@ -# DateTimeTest -org.openapijsonschematools.client.components.schemas.DateTimeTest.java -public class DateTimeTest
- -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 - -## Nested Class Summary -| Modifier and Type | Class and Description | -| ----------------- | ---------------------- | -| sealed interface | [DateTimeTest.DateTimeTest1Boxed](#datetimetest1boxed)
sealed interface for validated payloads | -| record | [DateTimeTest.DateTimeTest1BoxedString](#datetimetest1boxedstring)
boxed class to store validated String payloads | -| static class | [DateTimeTest.DateTimeTest1](#datetimetest1)
schema class | - -## DateTimeTest1Boxed -public sealed interface DateTimeTest1Boxed
-permits
-[DateTimeTest1BoxedString](#datetimetest1boxedstring) - -sealed interface that stores validated payloads using boxed classes - -## DateTimeTest1BoxedString -public record DateTimeTest1BoxedString
-implements [DateTimeTest1Boxed](#datetimetest1boxed) - -record that stores validated String payloads, sealed permits implementation - -### Constructor Summary -| Constructor and Description | -| --------------------------- | -| DateTimeTest1BoxedString(String data)
Creates an instance, private visibility | - -### Method Summary -| Modifier and Type | Method and Description | -| ----------------- | ---------------------- | -| String | data()
validated payload | -| @Nullable Object | getData()
validated payload | - -## DateTimeTest1 -public static class DateTimeTest1
-extends JsonSchema - -A schema class that validates payloads - -### Code Sample -``` -import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags; -import org.openapijsonschematools.client.configurations.SchemaConfiguration; -import org.openapijsonschematools.client.exceptions.ValidationException; -import org.openapijsonschematools.client.schemas.validation.MapUtils; -import org.openapijsonschematools.client.schemas.validation.FrozenList; -import org.openapijsonschematools.client.schemas.validation.FrozenMap; -import org.openapijsonschematools.client.components.schemas.DateTimeTest; - -import java.util.Arrays; -import java.util.List; -import java.util.AbstractMap; - -static final SchemaConfiguration configuration = new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().build()); - -// String validation -String validatedPayload = DateTimeTest.DateTimeTest1.validate( - "1970-01-01T00:00:00.00Z", - configuration -); -``` - -### Field Summary -| Modifier and Type | Field and Description | -| ----------------- | ---------------------- | -| Set> | type = Set.of(
    String.class
)
| -| String | type = "date-time"; | -| @Nullable Object | defaultValue = "2010-01-01T10:10:10.000111+01:00" | - -### Method Summary -| Modifier and Type | Method and Description | -| ----------------- | ---------------------- | -| String | validate(String arg, SchemaConfiguration configuration) | -| [DateTimeTest1BoxedString](#datetimetest1boxedstring) | validateAndBox(String arg, SchemaConfiguration configuration) | -| [DateTimeTest1Boxed](#datetimetest1boxed) | validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) | -| @Nullable Object | validate(@Nullable Object arg, SchemaConfiguration configuration) | - -[[Back to top]](#top) [[Back to Component Schemas]](../../../README.md#Component-Schemas) [[Back to README]](../../../README.md) diff --git a/samples/client/petstore/kotlin/docs/components/schemas/DateTimeWithValidations.md b/samples/client/petstore/kotlin/docs/components/schemas/DateTimeWithValidations.md deleted file mode 100644 index ac9b22fe003..00000000000 --- a/samples/client/petstore/kotlin/docs/components/schemas/DateTimeWithValidations.md +++ /dev/null @@ -1,85 +0,0 @@ -# DateTimeWithValidations -org.openapijsonschematools.client.components.schemas.DateTimeWithValidations.java -public class DateTimeWithValidations
- -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 - -## Nested Class Summary -| Modifier and Type | Class and Description | -| ----------------- | ---------------------- | -| sealed interface | [DateTimeWithValidations.DateTimeWithValidations1Boxed](#datetimewithvalidations1boxed)
sealed interface for validated payloads | -| record | [DateTimeWithValidations.DateTimeWithValidations1BoxedString](#datetimewithvalidations1boxedstring)
boxed class to store validated String payloads | -| static class | [DateTimeWithValidations.DateTimeWithValidations1](#datetimewithvalidations1)
schema class | - -## DateTimeWithValidations1Boxed -public sealed interface DateTimeWithValidations1Boxed
-permits
-[DateTimeWithValidations1BoxedString](#datetimewithvalidations1boxedstring) - -sealed interface that stores validated payloads using boxed classes - -## DateTimeWithValidations1BoxedString -public record DateTimeWithValidations1BoxedString
-implements [DateTimeWithValidations1Boxed](#datetimewithvalidations1boxed) - -record that stores validated String payloads, sealed permits implementation - -### Constructor Summary -| Constructor and Description | -| --------------------------- | -| DateTimeWithValidations1BoxedString(String data)
Creates an instance, private visibility | - -### Method Summary -| Modifier and Type | Method and Description | -| ----------------- | ---------------------- | -| String | data()
validated payload | -| @Nullable Object | getData()
validated payload | - -## DateTimeWithValidations1 -public static class DateTimeWithValidations1
-extends JsonSchema - -A schema class that validates payloads - -### Code Sample -``` -import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags; -import org.openapijsonschematools.client.configurations.SchemaConfiguration; -import org.openapijsonschematools.client.exceptions.ValidationException; -import org.openapijsonschematools.client.schemas.validation.MapUtils; -import org.openapijsonschematools.client.schemas.validation.FrozenList; -import org.openapijsonschematools.client.schemas.validation.FrozenMap; -import org.openapijsonschematools.client.components.schemas.DateTimeWithValidations; - -import java.util.Arrays; -import java.util.List; -import java.util.AbstractMap; - -static final SchemaConfiguration configuration = new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().build()); - -// String validation -String validatedPayload = DateTimeWithValidations.DateTimeWithValidations1.validate( - "2020jUR,rZ#UM/?R,Fp^l6$ARj", - configuration -); -``` - -### Field Summary -| Modifier and Type | Field and Description | -| ----------------- | ---------------------- | -| Set> | type = Set.of(
    String.class
)
| -| String | type = "date-time"; | -| Pattern | pattern = Pattern.compile(
    "^2020.*"
)
| - -### Method Summary -| Modifier and Type | Method and Description | -| ----------------- | ---------------------- | -| String | validate(String arg, SchemaConfiguration configuration) | -| [DateTimeWithValidations1BoxedString](#datetimewithvalidations1boxedstring) | validateAndBox(String arg, SchemaConfiguration configuration) | -| [DateTimeWithValidations1Boxed](#datetimewithvalidations1boxed) | validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) | -| @Nullable Object | validate(@Nullable Object arg, SchemaConfiguration configuration) | - -[[Back to top]](#top) [[Back to Component Schemas]](../../../README.md#Component-Schemas) [[Back to README]](../../../README.md) diff --git a/samples/client/petstore/kotlin/docs/components/schemas/DateWithValidations.md b/samples/client/petstore/kotlin/docs/components/schemas/DateWithValidations.md deleted file mode 100644 index 3e3a7e44641..00000000000 --- a/samples/client/petstore/kotlin/docs/components/schemas/DateWithValidations.md +++ /dev/null @@ -1,85 +0,0 @@ -# DateWithValidations -org.openapijsonschematools.client.components.schemas.DateWithValidations.java -public class DateWithValidations
- -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 - -## Nested Class Summary -| Modifier and Type | Class and Description | -| ----------------- | ---------------------- | -| sealed interface | [DateWithValidations.DateWithValidations1Boxed](#datewithvalidations1boxed)
sealed interface for validated payloads | -| record | [DateWithValidations.DateWithValidations1BoxedString](#datewithvalidations1boxedstring)
boxed class to store validated String payloads | -| static class | [DateWithValidations.DateWithValidations1](#datewithvalidations1)
schema class | - -## DateWithValidations1Boxed -public sealed interface DateWithValidations1Boxed
-permits
-[DateWithValidations1BoxedString](#datewithvalidations1boxedstring) - -sealed interface that stores validated payloads using boxed classes - -## DateWithValidations1BoxedString -public record DateWithValidations1BoxedString
-implements [DateWithValidations1Boxed](#datewithvalidations1boxed) - -record that stores validated String payloads, sealed permits implementation - -### Constructor Summary -| Constructor and Description | -| --------------------------- | -| DateWithValidations1BoxedString(String data)
Creates an instance, private visibility | - -### Method Summary -| Modifier and Type | Method and Description | -| ----------------- | ---------------------- | -| String | data()
validated payload | -| @Nullable Object | getData()
validated payload | - -## DateWithValidations1 -public static class DateWithValidations1
-extends JsonSchema - -A schema class that validates payloads - -### Code Sample -``` -import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags; -import org.openapijsonschematools.client.configurations.SchemaConfiguration; -import org.openapijsonschematools.client.exceptions.ValidationException; -import org.openapijsonschematools.client.schemas.validation.MapUtils; -import org.openapijsonschematools.client.schemas.validation.FrozenList; -import org.openapijsonschematools.client.schemas.validation.FrozenMap; -import org.openapijsonschematools.client.components.schemas.DateWithValidations; - -import java.util.Arrays; -import java.util.List; -import java.util.AbstractMap; - -static final SchemaConfiguration configuration = new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().build()); - -// String validation -String validatedPayload = DateWithValidations.DateWithValidations1.validate( - "2020jUR,rZ#UM/?R,Fp^l6$ARj", - configuration -); -``` - -### Field Summary -| Modifier and Type | Field and Description | -| ----------------- | ---------------------- | -| Set> | type = Set.of(
    String.class
)
| -| String | type = "date"; | -| Pattern | pattern = Pattern.compile(
    "^2020.*"
)
| - -### Method Summary -| Modifier and Type | Method and Description | -| ----------------- | ---------------------- | -| String | validate(String arg, SchemaConfiguration configuration) | -| [DateWithValidations1BoxedString](#datewithvalidations1boxedstring) | validateAndBox(String arg, SchemaConfiguration configuration) | -| [DateWithValidations1Boxed](#datewithvalidations1boxed) | validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) | -| @Nullable Object | validate(@Nullable Object arg, SchemaConfiguration configuration) | - -[[Back to top]](#top) [[Back to Component Schemas]](../../../README.md#Component-Schemas) [[Back to README]](../../../README.md) diff --git a/samples/client/petstore/kotlin/docs/components/schemas/DecimalPayload.md b/samples/client/petstore/kotlin/docs/components/schemas/DecimalPayload.md deleted file mode 100644 index d9431cd5451..00000000000 --- a/samples/client/petstore/kotlin/docs/components/schemas/DecimalPayload.md +++ /dev/null @@ -1,52 +0,0 @@ -# DecimalPayload -org.openapijsonschematools.client.components.schemas.DecimalPayload.java -public class DecimalPayload
- -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 - -## Nested Class Summary -| Modifier and Type | Class and Description | -| ----------------- | ---------------------- | -| sealed interface | [DecimalPayload.DecimalPayload1Boxed](#decimalpayload1boxed)
sealed interface for validated payloads | -| record | [DecimalPayload.DecimalPayload1BoxedString](#decimalpayload1boxedstring)
boxed class to store validated String payloads | -| static class | [DecimalPayload.DecimalPayload1](#decimalpayload1)
schema class | - -## DecimalPayload1Boxed -public sealed interface DecimalPayload1Boxed
-permits
-[DecimalPayload1BoxedString](#decimalpayload1boxedstring) - -sealed interface that stores validated payloads using boxed classes - -## DecimalPayload1BoxedString -public record DecimalPayload1BoxedString
-implements [DecimalPayload1Boxed](#decimalpayload1boxed) - -record that stores validated String payloads, sealed permits implementation - -### Constructor Summary -| Constructor and Description | -| --------------------------- | -| DecimalPayload1BoxedString(String data)
Creates an instance, private visibility | - -### Method Summary -| Modifier and Type | Method and Description | -| ----------------- | ---------------------- | -| String | data()
validated payload | -| @Nullable Object | getData()
validated payload | - -## DecimalPayload1 -public static class DecimalPayload1
-extends DecimalJsonSchema.DecimalJsonSchema1 - -A schema class that validates payloads - -| Methods Inherited from class org.openapijsonschematools.client.schemas.DecimalJsonSchema.DecimalJsonSchema1 | -| ------------------------------------------------------------------ | -| validate | -| validateAndBox | - -[[Back to top]](#top) [[Back to Component Schemas]](../../../README.md#Component-Schemas) [[Back to README]](../../../README.md) diff --git a/samples/client/petstore/kotlin/docs/components/schemas/Dog.md b/samples/client/petstore/kotlin/docs/components/schemas/Dog.md deleted file mode 100644 index 2355b75a20a..00000000000 --- a/samples/client/petstore/kotlin/docs/components/schemas/Dog.md +++ /dev/null @@ -1,324 +0,0 @@ -# Dog -org.openapijsonschematools.client.components.schemas.Dog.java -public class Dog
- -A class that contains necessary nested -- schema classes (which validate payloads), extends JsonSchema -- sealed interfaces which store validated payloads, java version of a sum type -- boxed classes which store validated payloads, sealed permits class implementations -- classes to store validated map payloads, extends FrozenMap -- classes to build inputs for map payloads - -## Nested Class Summary -| Modifier and Type | Class and Description | -| ----------------- | ---------------------- | -| sealed interface | [Dog.Dog1Boxed](#dog1boxed)
sealed interface for validated payloads | -| record | [Dog.Dog1BoxedVoid](#dog1boxedvoid)
boxed class to store validated null payloads | -| record | [Dog.Dog1BoxedBoolean](#dog1boxedboolean)
boxed class to store validated boolean payloads | -| record | [Dog.Dog1BoxedNumber](#dog1boxednumber)
boxed class to store validated Number payloads | -| record | [Dog.Dog1BoxedString](#dog1boxedstring)
boxed class to store validated String payloads | -| record | [Dog.Dog1BoxedList](#dog1boxedlist)
boxed class to store validated List payloads | -| record | [Dog.Dog1BoxedMap](#dog1boxedmap)
boxed class to store validated Map payloads | -| static class | [Dog.Dog1](#dog1)
schema class | -| sealed interface | [Dog.Schema1Boxed](#schema1boxed)
sealed interface for validated payloads | -| record | [Dog.Schema1BoxedMap](#schema1boxedmap)
boxed class to store validated Map payloads | -| static class | [Dog.Schema1](#schema1)
schema class | -| static class | [Dog.Schema1MapBuilder](#schema1mapbuilder)
builder for Map payloads | -| static class | [Dog.Schema1Map](#schema1map)
output class for Map payloads | -| sealed interface | [Dog.BreedBoxed](#breedboxed)
sealed interface for validated payloads | -| record | [Dog.BreedBoxedString](#breedboxedstring)
boxed class to store validated String payloads | -| static class | [Dog.Breed](#breed)
schema class | - -## Dog1Boxed -public sealed interface Dog1Boxed
-permits
-[Dog1BoxedVoid](#dog1boxedvoid), -[Dog1BoxedBoolean](#dog1boxedboolean), -[Dog1BoxedNumber](#dog1boxednumber), -[Dog1BoxedString](#dog1boxedstring), -[Dog1BoxedList](#dog1boxedlist), -[Dog1BoxedMap](#dog1boxedmap) - -sealed interface that stores validated payloads using boxed classes - -## Dog1BoxedVoid -public record Dog1BoxedVoid
-implements [Dog1Boxed](#dog1boxed) - -record that stores validated null payloads, sealed permits implementation - -### Constructor Summary -| Constructor and Description | -| --------------------------- | -| Dog1BoxedVoid(Nothing? data)
Creates an instance, private visibility | - -### Method Summary -| Modifier and Type | Method and Description | -| ----------------- | ---------------------- | -| Nothing? | data()
validated payload | -| @Nullable Object | getData()
validated payload | - -## Dog1BoxedBoolean -public record Dog1BoxedBoolean
-implements [Dog1Boxed](#dog1boxed) - -record that stores validated boolean payloads, sealed permits implementation - -### Constructor Summary -| Constructor and Description | -| --------------------------- | -| Dog1BoxedBoolean(boolean data)
Creates an instance, private visibility | - -### Method Summary -| Modifier and Type | Method and Description | -| ----------------- | ---------------------- | -| boolean | data()
validated payload | -| @Nullable Object | getData()
validated payload | - -## Dog1BoxedNumber -public record Dog1BoxedNumber
-implements [Dog1Boxed](#dog1boxed) - -record that stores validated Number payloads, sealed permits implementation - -### Constructor Summary -| Constructor and Description | -| --------------------------- | -| Dog1BoxedNumber(Number data)
Creates an instance, private visibility | - -### Method Summary -| Modifier and Type | Method and Description | -| ----------------- | ---------------------- | -| Number | data()
validated payload | -| @Nullable Object | getData()
validated payload | - -## Dog1BoxedString -public record Dog1BoxedString
-implements [Dog1Boxed](#dog1boxed) - -record that stores validated String payloads, sealed permits implementation - -### Constructor Summary -| Constructor and Description | -| --------------------------- | -| Dog1BoxedString(String data)
Creates an instance, private visibility | - -### Method Summary -| Modifier and Type | Method and Description | -| ----------------- | ---------------------- | -| String | data()
validated payload | -| @Nullable Object | getData()
validated payload | - -## Dog1BoxedList -public record Dog1BoxedList
-implements [Dog1Boxed](#dog1boxed) - -record that stores validated List payloads, sealed permits implementation - -### Constructor Summary -| Constructor and Description | -| --------------------------- | -| Dog1BoxedList(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 | - -## Dog1BoxedMap -public record Dog1BoxedMap
-implements [Dog1Boxed](#dog1boxed) - -record that stores validated Map payloads, sealed permits implementation - -### Constructor Summary -| Constructor and Description | -| --------------------------- | -| Dog1BoxedMap(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 | - -## Dog1 -public static class Dog1
-extends JsonSchema - -A schema class that validates payloads - -### Field Summary -| Modifier and Type | Field and Description | -| ----------------- | ---------------------- | -| List> | allOf = List.of(
    [Animal.Animal1.class](../../components/schemas/Animal.md#animal1),
    [Schema1.class](#schema1)
;)
| - -### Method Summary -| Modifier and Type | Method and Description | -| ----------------- | ---------------------- | -| String | validate(String arg, SchemaConfiguration configuration) | -| Nothing? | validate(Nothing? arg, SchemaConfiguration configuration) | -| int | validate(int arg, SchemaConfiguration configuration) | -| long | validate(long arg, SchemaConfiguration configuration) | -| float | validate(float arg, SchemaConfiguration configuration) | -| double | validate(double arg, SchemaConfiguration configuration) | -| Number | validate(Number arg, SchemaConfiguration configuration) | -| boolean | validate(boolean arg, SchemaConfiguration configuration) | -| FrozenMap<@Nullable Object> | validate(Map<?, ?> arg, SchemaConfiguration configuration) | -| FrozenList<@Nullable Object> | validate(List arg, SchemaConfiguration configuration) | -| [Dog1BoxedString](#dog1boxedstring) | validateAndBox(String arg, SchemaConfiguration configuration) | -| [Dog1BoxedVoid](#dog1boxedvoid) | validateAndBox(Nothing? arg, SchemaConfiguration configuration) | -| [Dog1BoxedNumber](#dog1boxednumber) | validateAndBox(Number arg, SchemaConfiguration configuration) | -| [Dog1BoxedBoolean](#dog1boxedboolean) | validateAndBox(boolean arg, SchemaConfiguration configuration) | -| [Dog1BoxedMap](#dog1boxedmap) | validateAndBox(Map<?, ?> arg, SchemaConfiguration configuration) | -| [Dog1BoxedList](#dog1boxedlist) | validateAndBox(List arg, SchemaConfiguration configuration) | -| [Dog1Boxed](#dog1boxed) | validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) | -| @Nullable Object | validate(@Nullable Object arg, SchemaConfiguration configuration) | - -## Schema1Boxed -public sealed interface Schema1Boxed
-permits
-[Schema1BoxedMap](#schema1boxedmap) - -sealed interface that stores validated payloads using boxed classes - -## Schema1BoxedMap -public record Schema1BoxedMap
-implements [Schema1Boxed](#schema1boxed) - -record that stores validated Map payloads, sealed permits implementation - -### Constructor Summary -| Constructor and Description | -| --------------------------- | -| Schema1BoxedMap([Schema1Map](#schema1map) data)
Creates an instance, private visibility | - -### Method Summary -| Modifier and Type | Method and Description | -| ----------------- | ---------------------- | -| [Schema1Map](#schema1map) | data()
validated payload | -| @Nullable Object | getData()
validated payload | - -## Schema1 -public static class Schema1
-extends JsonSchema - -A schema class that validates payloads - -### Code Sample -``` -import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags; -import org.openapijsonschematools.client.configurations.SchemaConfiguration; -import org.openapijsonschematools.client.exceptions.ValidationException; -import org.openapijsonschematools.client.schemas.validation.MapUtils; -import org.openapijsonschematools.client.schemas.validation.FrozenList; -import org.openapijsonschematools.client.schemas.validation.FrozenMap; -import org.openapijsonschematools.client.components.schemas.Dog; - -import java.util.Arrays; -import java.util.List; -import java.util.AbstractMap; - -static final SchemaConfiguration configuration = new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().build()); - -// Map validation -Dog.Schema1Map validatedPayload = - Dog.Schema1.validate( - new Dog.Schema1MapBuilder() - .breed("a") - - .build(), - configuration -); -``` - -### Field Summary -| Modifier and Type | Field and Description | -| ----------------- | ---------------------- | -| Set> | type = Set.of(Map.class) | -| Map> | properties = Map.ofEntries(
    new PropertyEntry("breed", [Breed.class](#breed)))
)
| - -### Method Summary -| Modifier and Type | Method and Description | -| ----------------- | ---------------------- | -| [Schema1Map](#schema1map) | validate([Map<?, ?>](#schema1mapbuilder) arg, SchemaConfiguration configuration) | -| [Schema1BoxedMap](#schema1boxedmap) | validateAndBox([Map<?, ?>](#schema1mapbuilder) arg, SchemaConfiguration configuration) | -| [Schema1Boxed](#schema1boxed) | validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) | -| @Nullable Object | validate(@Nullable Object arg, SchemaConfiguration configuration) | - -## Schema1MapBuilder -public class Schema1MapBuilder
-builder for `Map` - -A class that builds the Map input type - -### Constructor Summary -| Constructor and Description | -| --------------------------- | -| Schema1MapBuilder()
Creates a builder that contains an empty map | - -### Method Summary -| Modifier and Type | Method and Description | -| ----------------- | ---------------------- | -| Map | build()
Returns map input that should be used with Schema.validate | -| [Schema1MapBuilder](#schema1mapbuilder) | breed(String value) | -| [Schema1MapBuilder](#schema1mapbuilder) | additionalProperty(String key, Nothing? value) | -| [Schema1MapBuilder](#schema1mapbuilder) | additionalProperty(String key, boolean value) | -| [Schema1MapBuilder](#schema1mapbuilder) | additionalProperty(String key, String value) | -| [Schema1MapBuilder](#schema1mapbuilder) | additionalProperty(String key, int value) | -| [Schema1MapBuilder](#schema1mapbuilder) | additionalProperty(String key, float value) | -| [Schema1MapBuilder](#schema1mapbuilder) | additionalProperty(String key, long value) | -| [Schema1MapBuilder](#schema1mapbuilder) | additionalProperty(String key, double value) | -| [Schema1MapBuilder](#schema1mapbuilder) | additionalProperty(String key, List value) | -| [Schema1MapBuilder](#schema1mapbuilder) | additionalProperty(String key, Map value) | - -## Schema1Map -public static class Schema1Map
-extends FrozenMap - -A class to store validated Map payloads - -### Method Summary -| Modifier and Type | Method and Description | -| ----------------- | ---------------------- | -| static [Schema1Map](#schema1map) | of([Map](#schema1mapbuilder) arg, SchemaConfiguration configuration) | -| String | breed()
[optional] | -| @Nullable Object | getAdditionalProperty(String name)
provides type safety for additional properties | - -## BreedBoxed -public sealed interface BreedBoxed
-permits
-[BreedBoxedString](#breedboxedstring) - -sealed interface that stores validated payloads using boxed classes - -## BreedBoxedString -public record BreedBoxedString
-implements [BreedBoxed](#breedboxed) - -record that stores validated String payloads, sealed permits implementation - -### Constructor Summary -| Constructor and Description | -| --------------------------- | -| BreedBoxedString(String data)
Creates an instance, private visibility | - -### Method Summary -| Modifier and Type | Method and Description | -| ----------------- | ---------------------- | -| String | data()
validated payload | -| @Nullable Object | getData()
validated payload | - -## Breed -public static class Breed
-extends StringJsonSchema.StringJsonSchema1 - -A schema class that validates payloads - -| Methods Inherited from class org.openapijsonschematools.client.schemas.StringJsonSchema.StringJsonSchema1 | -| ------------------------------------------------------------------ | -| validate | -| validateAndBox | - -[[Back to top]](#top) [[Back to Component Schemas]](../../../README.md#Component-Schemas) [[Back to README]](../../../README.md) diff --git a/samples/client/petstore/kotlin/docs/components/schemas/Drawing.md b/samples/client/petstore/kotlin/docs/components/schemas/Drawing.md deleted file mode 100644 index 146c8a50f8d..00000000000 --- a/samples/client/petstore/kotlin/docs/components/schemas/Drawing.md +++ /dev/null @@ -1,277 +0,0 @@ -# Drawing -org.openapijsonschematools.client.components.schemas.Drawing.java -public class Drawing
- -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 list payloads, extends FrozenList -- classes to build inputs for list payloads -- classes to store validated map payloads, extends FrozenMap -- classes to build inputs for map payloads - -## Nested Class Summary -| Modifier and Type | Class and Description | -| ----------------- | ---------------------- | -| sealed interface | [Drawing.Drawing1Boxed](#drawing1boxed)
sealed interface for validated payloads | -| record | [Drawing.Drawing1BoxedMap](#drawing1boxedmap)
boxed class to store validated Map payloads | -| static class | [Drawing.Drawing1](#drawing1)
schema class | -| static class | [Drawing.DrawingMapBuilder](#drawingmapbuilder)
builder for Map payloads | -| static class | [Drawing.DrawingMap](#drawingmap)
output class for Map payloads | -| sealed interface | [Drawing.ShapesBoxed](#shapesboxed)
sealed interface for validated payloads | -| record | [Drawing.ShapesBoxedList](#shapesboxedlist)
boxed class to store validated List payloads | -| static class | [Drawing.Shapes](#shapes)
schema class | -| static class | [Drawing.ShapesListBuilder](#shapeslistbuilder)
builder for List payloads | -| static class | [Drawing.ShapesList](#shapeslist)
output class for List payloads | - -## Drawing1Boxed -public sealed interface Drawing1Boxed
-permits
-[Drawing1BoxedMap](#drawing1boxedmap) - -sealed interface that stores validated payloads using boxed classes - -## Drawing1BoxedMap -public record Drawing1BoxedMap
-implements [Drawing1Boxed](#drawing1boxed) - -record that stores validated Map payloads, sealed permits implementation - -### Constructor Summary -| Constructor and Description | -| --------------------------- | -| Drawing1BoxedMap([DrawingMap](#drawingmap) data)
Creates an instance, private visibility | - -### Method Summary -| Modifier and Type | Method and Description | -| ----------------- | ---------------------- | -| [DrawingMap](#drawingmap) | data()
validated payload | -| @Nullable Object | getData()
validated payload | - -## Drawing1 -public static class Drawing1
-extends JsonSchema - -A schema class that validates payloads - -### Code Sample -``` -import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags; -import org.openapijsonschematools.client.configurations.SchemaConfiguration; -import org.openapijsonschematools.client.exceptions.ValidationException; -import org.openapijsonschematools.client.schemas.validation.MapUtils; -import org.openapijsonschematools.client.schemas.validation.FrozenList; -import org.openapijsonschematools.client.schemas.validation.FrozenMap; -import org.openapijsonschematools.client.components.schemas.Drawing; - -import java.util.Arrays; -import java.util.List; -import java.util.AbstractMap; - -static final SchemaConfiguration configuration = new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().build()); - -// Map validation -Drawing.DrawingMap validatedPayload = - Drawing.Drawing1.validate( - new Drawing.DrawingMapBuilder() - .shapes( - Arrays.asList( - ) - ) - .build(), - configuration -); -``` - -### Field Summary -| Modifier and Type | Field and Description | -| ----------------- | ---------------------- | -| Set> | type = Set.of(Map.class) | -| Map> | properties = Map.ofEntries(
    new PropertyEntry("mainShape", [Shape.Shape1.class](../../components/schemas/Shape.md#shape1)),
    new PropertyEntry("shapeOrNull", [ShapeOrNull.ShapeOrNull1.class](../../components/schemas/ShapeOrNull.md#shapeornull1)),
    new PropertyEntry("nullableShape", [NullableShape.NullableShape1.class](../../components/schemas/NullableShape.md#nullableshape1)),
    new PropertyEntry("shapes", [Shapes.class](#shapes)))
)
| -| Class | additionalProperties = [Fruit.Fruit1.class](../../components/schemas/Fruit.md#fruit1) | - -### Method Summary -| Modifier and Type | Method and Description | -| ----------------- | ---------------------- | -| [DrawingMap](#drawingmap) | validate([Map<?, ?>](#drawingmapbuilder) arg, SchemaConfiguration configuration) | -| [Drawing1BoxedMap](#drawing1boxedmap) | validateAndBox([Map<?, ?>](#drawingmapbuilder) arg, SchemaConfiguration configuration) | -| [Drawing1Boxed](#drawing1boxed) | validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) | -| @Nullable Object | validate(@Nullable Object arg, SchemaConfiguration configuration) | - -## DrawingMapBuilder -public class DrawingMapBuilder
-builder for `Map` - -A class that builds the Map input type - -### Constructor Summary -| Constructor and Description | -| --------------------------- | -| DrawingMapBuilder()
Creates a builder that contains an empty map | - -### Method Summary -| Modifier and Type | Method and Description | -| ----------------- | ---------------------- | -| Map | build()
Returns map input that should be used with Schema.validate | -| [DrawingMapBuilder](#drawingmapbuilder) | mainShape(Nothing? value) | -| [DrawingMapBuilder](#drawingmapbuilder) | mainShape(boolean value) | -| [DrawingMapBuilder](#drawingmapbuilder) | mainShape(String value) | -| [DrawingMapBuilder](#drawingmapbuilder) | mainShape(int value) | -| [DrawingMapBuilder](#drawingmapbuilder) | mainShape(float value) | -| [DrawingMapBuilder](#drawingmapbuilder) | mainShape(long value) | -| [DrawingMapBuilder](#drawingmapbuilder) | mainShape(double value) | -| [DrawingMapBuilder](#drawingmapbuilder) | mainShape(List value) | -| [DrawingMapBuilder](#drawingmapbuilder) | mainShape(Map value) | -| [DrawingMapBuilder](#drawingmapbuilder) | shapeOrNull(Nothing? value) | -| [DrawingMapBuilder](#drawingmapbuilder) | shapeOrNull(boolean value) | -| [DrawingMapBuilder](#drawingmapbuilder) | shapeOrNull(String value) | -| [DrawingMapBuilder](#drawingmapbuilder) | shapeOrNull(int value) | -| [DrawingMapBuilder](#drawingmapbuilder) | shapeOrNull(float value) | -| [DrawingMapBuilder](#drawingmapbuilder) | shapeOrNull(long value) | -| [DrawingMapBuilder](#drawingmapbuilder) | shapeOrNull(double value) | -| [DrawingMapBuilder](#drawingmapbuilder) | shapeOrNull(List value) | -| [DrawingMapBuilder](#drawingmapbuilder) | shapeOrNull(Map value) | -| [DrawingMapBuilder](#drawingmapbuilder) | nullableShape(Nothing? value) | -| [DrawingMapBuilder](#drawingmapbuilder) | nullableShape(boolean value) | -| [DrawingMapBuilder](#drawingmapbuilder) | nullableShape(String value) | -| [DrawingMapBuilder](#drawingmapbuilder) | nullableShape(int value) | -| [DrawingMapBuilder](#drawingmapbuilder) | nullableShape(float value) | -| [DrawingMapBuilder](#drawingmapbuilder) | nullableShape(long value) | -| [DrawingMapBuilder](#drawingmapbuilder) | nullableShape(double value) | -| [DrawingMapBuilder](#drawingmapbuilder) | nullableShape(List value) | -| [DrawingMapBuilder](#drawingmapbuilder) | nullableShape(Map value) | -| [DrawingMapBuilder](#drawingmapbuilder) | shapes(List<@Nullable Object> value) | -| [DrawingMapBuilder](#drawingmapbuilder) | additionalProperty(String key, Nothing? value) | -| [DrawingMapBuilder](#drawingmapbuilder) | additionalProperty(String key, boolean value) | -| [DrawingMapBuilder](#drawingmapbuilder) | additionalProperty(String key, String value) | -| [DrawingMapBuilder](#drawingmapbuilder) | additionalProperty(String key, int value) | -| [DrawingMapBuilder](#drawingmapbuilder) | additionalProperty(String key, float value) | -| [DrawingMapBuilder](#drawingmapbuilder) | additionalProperty(String key, long value) | -| [DrawingMapBuilder](#drawingmapbuilder) | additionalProperty(String key, double value) | -| [DrawingMapBuilder](#drawingmapbuilder) | additionalProperty(String key, List value) | -| [DrawingMapBuilder](#drawingmapbuilder) | additionalProperty(String key, Map value) | - -## DrawingMap -public static class DrawingMap
-extends FrozenMap - -A class to store validated Map payloads - -### Method Summary -| Modifier and Type | Method and Description | -| ----------------- | ---------------------- | -| static [DrawingMap](#drawingmap) | of([Map](#drawingmapbuilder) arg, SchemaConfiguration configuration) | -| @Nullable Object | mainShape()
[optional] | -| @Nullable Object | shapeOrNull()
[optional] | -| @Nullable Object | nullableShape()
[optional] | -| [ShapesList](#shapeslist) | shapes()
[optional] | -| @Nullable Object | getAdditionalProperty(String name)
provides type safety for additional properties | - -## ShapesBoxed -public sealed interface ShapesBoxed
-permits
-[ShapesBoxedList](#shapesboxedlist) - -sealed interface that stores validated payloads using boxed classes - -## ShapesBoxedList -public record ShapesBoxedList
-implements [ShapesBoxed](#shapesboxed) - -record that stores validated List payloads, sealed permits implementation - -### Constructor Summary -| Constructor and Description | -| --------------------------- | -| ShapesBoxedList([ShapesList](#shapeslist) data)
Creates an instance, private visibility | - -### Method Summary -| Modifier and Type | Method and Description | -| ----------------- | ---------------------- | -| [ShapesList](#shapeslist) | data()
validated payload | -| @Nullable Object | getData()
validated payload | - -## Shapes -public static class Shapes
-extends JsonSchema - -A schema class that validates payloads - -### Code Sample -``` -import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags; -import org.openapijsonschematools.client.configurations.SchemaConfiguration; -import org.openapijsonschematools.client.exceptions.ValidationException; -import org.openapijsonschematools.client.schemas.validation.MapUtils; -import org.openapijsonschematools.client.schemas.validation.FrozenList; -import org.openapijsonschematools.client.schemas.validation.FrozenMap; -import org.openapijsonschematools.client.components.schemas.Drawing; - -import java.util.Arrays; -import java.util.List; -import java.util.AbstractMap; - -static final SchemaConfiguration configuration = new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().build()); - -// List validation -Drawing.ShapesList validatedPayload = - Drawing.Shapes.validate( - new Drawing.ShapesListBuilder() - .build(), - configuration -); -``` - -### Field Summary -| Modifier and Type | Field and Description | -| ----------------- | ---------------------- | -| Set> | type = Set.of(List.class) | -| Class | items = [Shape.Shape1.class](../../components/schemas/Shape.md#shape1) | - -### Method Summary -| Modifier and Type | Method and Description | -| ----------------- | ---------------------- | -| [ShapesList](#shapeslist) | validate([List](#shapeslistbuilder) arg, SchemaConfiguration configuration) | -| [ShapesBoxedList](#shapesboxedlist) | validateAndBox([List](#shapeslistbuilder) arg, SchemaConfiguration configuration) | -| [ShapesBoxed](#shapesboxed) | validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) | -| @Nullable Object | validate(@Nullable Object arg, SchemaConfiguration configuration) | - -## ShapesListBuilder -public class ShapesListBuilder
-builder for `List<@Nullable Object>` - -A class that builds the List input type - -### Constructor Summary -| Constructor and Description | -| --------------------------- | -| ShapesListBuilder()
Creates an empty list | -| ShapesListBuilder(List<@Nullable Object> items)
Stores the items in a list | - -### Method Summary -| Modifier and Type | Method and Description | -| ----------------- | ---------------------- | -| ShapesListBuilder | add(Nothing? item) | -| ShapesListBuilder | add(boolean item) | -| ShapesListBuilder | add(String item) | -| ShapesListBuilder | add(int item) | -| ShapesListBuilder | add(float item) | -| ShapesListBuilder | add(long item) | -| ShapesListBuilder | add(double item) | -| ShapesListBuilder | add(List item) | -| ShapesListBuilder | add(Map item) | -| List<@Nullable Object> | build()
Returns list input that should be used with Schema.validate | - -## ShapesList -public class ShapesList
-extends `FrozenList<@Nullable Object>` - -A class to store validated List payloads - -### Method Summary -| Modifier and Type | Method and Description | -| ----------------- | ---------------------- | -| static [ShapesList](#shapeslist) | of([List](#shapeslistbuilder) arg, SchemaConfiguration configuration) | - -[[Back to top]](#top) [[Back to Component Schemas]](../../../README.md#Component-Schemas) [[Back to README]](../../../README.md) diff --git a/samples/client/petstore/kotlin/docs/components/schemas/EnumArrays.md b/samples/client/petstore/kotlin/docs/components/schemas/EnumArrays.md deleted file mode 100644 index 3614e3b1869..00000000000 --- a/samples/client/petstore/kotlin/docs/components/schemas/EnumArrays.md +++ /dev/null @@ -1,416 +0,0 @@ -# EnumArrays -org.openapijsonschematools.client.components.schemas.EnumArrays.java -public class EnumArrays
- -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 list payloads, extends FrozenList -- classes to build inputs for list payloads -- 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 | [EnumArrays.EnumArrays1Boxed](#enumarrays1boxed)
sealed interface for validated payloads | -| record | [EnumArrays.EnumArrays1BoxedMap](#enumarrays1boxedmap)
boxed class to store validated Map payloads | -| static class | [EnumArrays.EnumArrays1](#enumarrays1)
schema class | -| static class | [EnumArrays.EnumArraysMapBuilder](#enumarraysmapbuilder)
builder for Map payloads | -| static class | [EnumArrays.EnumArraysMap](#enumarraysmap)
output class for Map payloads | -| sealed interface | [EnumArrays.ArrayEnumBoxed](#arrayenumboxed)
sealed interface for validated payloads | -| record | [EnumArrays.ArrayEnumBoxedList](#arrayenumboxedlist)
boxed class to store validated List payloads | -| static class | [EnumArrays.ArrayEnum](#arrayenum)
schema class | -| static class | [EnumArrays.ArrayEnumListBuilder](#arrayenumlistbuilder)
builder for List payloads | -| static class | [EnumArrays.ArrayEnumList](#arrayenumlist)
output class for List payloads | -| sealed interface | [EnumArrays.ItemsBoxed](#itemsboxed)
sealed interface for validated payloads | -| record | [EnumArrays.ItemsBoxedString](#itemsboxedstring)
boxed class to store validated String payloads | -| static class | [EnumArrays.Items](#items)
schema class | -| enum | [EnumArrays.StringItemsEnums](#stringitemsenums)
String enum | -| sealed interface | [EnumArrays.JustSymbolBoxed](#justsymbolboxed)
sealed interface for validated payloads | -| record | [EnumArrays.JustSymbolBoxedString](#justsymbolboxedstring)
boxed class to store validated String payloads | -| static class | [EnumArrays.JustSymbol](#justsymbol)
schema class | -| enum | [EnumArrays.StringJustSymbolEnums](#stringjustsymbolenums)
String enum | - -## EnumArrays1Boxed -public sealed interface EnumArrays1Boxed
-permits
-[EnumArrays1BoxedMap](#enumarrays1boxedmap) - -sealed interface that stores validated payloads using boxed classes - -## EnumArrays1BoxedMap -public record EnumArrays1BoxedMap
-implements [EnumArrays1Boxed](#enumarrays1boxed) - -record that stores validated Map payloads, sealed permits implementation - -### Constructor Summary -| Constructor and Description | -| --------------------------- | -| EnumArrays1BoxedMap([EnumArraysMap](#enumarraysmap) data)
Creates an instance, private visibility | - -### Method Summary -| Modifier and Type | Method and Description | -| ----------------- | ---------------------- | -| [EnumArraysMap](#enumarraysmap) | data()
validated payload | -| @Nullable Object | getData()
validated payload | - -## EnumArrays1 -public static class EnumArrays1
-extends JsonSchema - -A schema class that validates payloads - -### Code Sample -``` -import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags; -import org.openapijsonschematools.client.configurations.SchemaConfiguration; -import org.openapijsonschematools.client.exceptions.ValidationException; -import org.openapijsonschematools.client.schemas.validation.MapUtils; -import org.openapijsonschematools.client.schemas.validation.FrozenList; -import org.openapijsonschematools.client.schemas.validation.FrozenMap; -import org.openapijsonschematools.client.components.schemas.EnumArrays; - -import java.util.Arrays; -import java.util.List; -import java.util.AbstractMap; - -static final SchemaConfiguration configuration = new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().build()); - -// Map validation -EnumArrays.EnumArraysMap validatedPayload = - EnumArrays.EnumArrays1.validate( - new EnumArrays.EnumArraysMapBuilder() - .just_symbol(">=") - - .array_enum( - Arrays.asList( - "fish" - ) - ) - .build(), - configuration -); -``` - -### Field Summary -| Modifier and Type | Field and Description | -| ----------------- | ---------------------- | -| Set> | type = Set.of(Map.class) | -| Map> | properties = Map.ofEntries(
    new PropertyEntry("just_symbol", [JustSymbol.class](#justsymbol))),
    new PropertyEntry("array_enum", [ArrayEnum.class](#arrayenum)))
)
| - -### Method Summary -| Modifier and Type | Method and Description | -| ----------------- | ---------------------- | -| [EnumArraysMap](#enumarraysmap) | validate([Map<?, ?>](#enumarraysmapbuilder) arg, SchemaConfiguration configuration) | -| [EnumArrays1BoxedMap](#enumarrays1boxedmap) | validateAndBox([Map<?, ?>](#enumarraysmapbuilder) arg, SchemaConfiguration configuration) | -| [EnumArrays1Boxed](#enumarrays1boxed) | validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) | -| @Nullable Object | validate(@Nullable Object arg, SchemaConfiguration configuration) | - -## EnumArraysMapBuilder -public class EnumArraysMapBuilder
-builder for `Map` - -A class that builds the Map input type - -### Constructor Summary -| Constructor and Description | -| --------------------------- | -| EnumArraysMapBuilder()
Creates a builder that contains an empty map | - -### Method Summary -| Modifier and Type | Method and Description | -| ----------------- | ---------------------- | -| Map | build()
Returns map input that should be used with Schema.validate | -| [EnumArraysMapBuilder](#enumarraysmapbuilder) | just_symbol(String value) | -| [EnumArraysMapBuilder](#enumarraysmapbuilder) | just_symbol([StringJustSymbolEnums](#stringjustsymbolenums) value) | -| [EnumArraysMapBuilder](#enumarraysmapbuilder) | array_enum(List value) | -| [EnumArraysMapBuilder](#enumarraysmapbuilder) | additionalProperty(String key, Nothing? value) | -| [EnumArraysMapBuilder](#enumarraysmapbuilder) | additionalProperty(String key, boolean value) | -| [EnumArraysMapBuilder](#enumarraysmapbuilder) | additionalProperty(String key, String value) | -| [EnumArraysMapBuilder](#enumarraysmapbuilder) | additionalProperty(String key, int value) | -| [EnumArraysMapBuilder](#enumarraysmapbuilder) | additionalProperty(String key, float value) | -| [EnumArraysMapBuilder](#enumarraysmapbuilder) | additionalProperty(String key, long value) | -| [EnumArraysMapBuilder](#enumarraysmapbuilder) | additionalProperty(String key, double value) | -| [EnumArraysMapBuilder](#enumarraysmapbuilder) | additionalProperty(String key, List value) | -| [EnumArraysMapBuilder](#enumarraysmapbuilder) | additionalProperty(String key, Map value) | - -## EnumArraysMap -public static class EnumArraysMap
-extends FrozenMap - -A class to store validated Map payloads - -### Method Summary -| Modifier and Type | Method and Description | -| ----------------- | ---------------------- | -| static [EnumArraysMap](#enumarraysmap) | of([Map](#enumarraysmapbuilder) arg, SchemaConfiguration configuration) | -| String | just_symbol()
[optional] must be one of [">=", "$"] | -| [ArrayEnumList](#arrayenumlist) | array_enum()
[optional] | -| @Nullable Object | getAdditionalProperty(String name)
provides type safety for additional properties | - -## ArrayEnumBoxed -public sealed interface ArrayEnumBoxed
-permits
-[ArrayEnumBoxedList](#arrayenumboxedlist) - -sealed interface that stores validated payloads using boxed classes - -## ArrayEnumBoxedList -public record ArrayEnumBoxedList
-implements [ArrayEnumBoxed](#arrayenumboxed) - -record that stores validated List payloads, sealed permits implementation - -### Constructor Summary -| Constructor and Description | -| --------------------------- | -| ArrayEnumBoxedList([ArrayEnumList](#arrayenumlist) data)
Creates an instance, private visibility | - -### Method Summary -| Modifier and Type | Method and Description | -| ----------------- | ---------------------- | -| [ArrayEnumList](#arrayenumlist) | data()
validated payload | -| @Nullable Object | getData()
validated payload | - -## ArrayEnum -public static class ArrayEnum
-extends JsonSchema - -A schema class that validates payloads - -### Code Sample -``` -import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags; -import org.openapijsonschematools.client.configurations.SchemaConfiguration; -import org.openapijsonschematools.client.exceptions.ValidationException; -import org.openapijsonschematools.client.schemas.validation.MapUtils; -import org.openapijsonschematools.client.schemas.validation.FrozenList; -import org.openapijsonschematools.client.schemas.validation.FrozenMap; -import org.openapijsonschematools.client.components.schemas.EnumArrays; - -import java.util.Arrays; -import java.util.List; -import java.util.AbstractMap; - -static final SchemaConfiguration configuration = new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().build()); - -// List validation -EnumArrays.ArrayEnumList validatedPayload = - EnumArrays.ArrayEnum.validate( - new EnumArrays.ArrayEnumListBuilder() - .add("fish") - - .build(), - configuration -); -``` - -### Field Summary -| Modifier and Type | Field and Description | -| ----------------- | ---------------------- | -| Set> | type = Set.of(List.class) | -| Class | items = [Items.class](#items) | - -### Method Summary -| Modifier and Type | Method and Description | -| ----------------- | ---------------------- | -| [ArrayEnumList](#arrayenumlist) | validate([List](#arrayenumlistbuilder) arg, SchemaConfiguration configuration) | -| [ArrayEnumBoxedList](#arrayenumboxedlist) | validateAndBox([List](#arrayenumlistbuilder) arg, SchemaConfiguration configuration) | -| [ArrayEnumBoxed](#arrayenumboxed) | validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) | -| @Nullable Object | validate(@Nullable Object arg, SchemaConfiguration configuration) | - -## ArrayEnumListBuilder -public class ArrayEnumListBuilder
-builder for `List` - -A class that builds the List input type - -### Constructor Summary -| Constructor and Description | -| --------------------------- | -| ArrayEnumListBuilder()
Creates an empty list | -| ArrayEnumListBuilder(List items)
Stores the items in a list | - -### Method Summary -| Modifier and Type | Method and Description | -| ----------------- | ---------------------- | -| ArrayEnumListBuilder | add(String item) | -| ArrayEnumListBuilder | add([StringItemsEnums](#stringitemsenums) item) | -| List | build()
Returns list input that should be used with Schema.validate | - -## ArrayEnumList -public class ArrayEnumList
-extends `FrozenList` - -A class to store validated List payloads - -### Method Summary -| Modifier and Type | Method and Description | -| ----------------- | ---------------------- | -| static [ArrayEnumList](#arrayenumlist) | of([List](#arrayenumlistbuilder) arg, SchemaConfiguration configuration) | - -## ItemsBoxed -public sealed interface ItemsBoxed
-permits
-[ItemsBoxedString](#itemsboxedstring) - -sealed interface that stores validated payloads using boxed classes - -## ItemsBoxedString -public record ItemsBoxedString
-implements [ItemsBoxed](#itemsboxed) - -record that stores validated String payloads, sealed permits implementation - -### Constructor Summary -| Constructor and Description | -| --------------------------- | -| ItemsBoxedString(String data)
Creates an instance, private visibility | - -### Method Summary -| Modifier and Type | Method and Description | -| ----------------- | ---------------------- | -| String | data()
validated payload | -| @Nullable Object | getData()
validated payload | - -## Items -public static class Items
-extends JsonSchema - -A schema class that validates payloads - -### Code Sample -``` -import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags; -import org.openapijsonschematools.client.configurations.SchemaConfiguration; -import org.openapijsonschematools.client.exceptions.ValidationException; -import org.openapijsonschematools.client.schemas.validation.MapUtils; -import org.openapijsonschematools.client.schemas.validation.FrozenList; -import org.openapijsonschematools.client.schemas.validation.FrozenMap; -import org.openapijsonschematools.client.components.schemas.EnumArrays; - -import java.util.Arrays; -import java.util.List; -import java.util.AbstractMap; - -static final SchemaConfiguration configuration = new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().build()); - -// String validation -String validatedPayload = EnumArrays.Items.validate( - "fish", - configuration -); -``` - -### Field Summary -| Modifier and Type | Field and Description | -| ----------------- | ---------------------- | -| Set> | type = Set.of(
    String.class
)
| -| Set | enumValues = SetMaker.makeSet(
    "fish",
    "crab"
)
| - -### Method Summary -| Modifier and Type | Method and Description | -| ----------------- | ---------------------- | -| String | validate(String arg, SchemaConfiguration configuration) | -| String | validate([StringItemsEnums](#stringitemsenums) arg, SchemaConfiguration configuration) | -| [ItemsBoxedString](#itemsboxedstring) | validateAndBox(String arg, SchemaConfiguration configuration) | -| [ItemsBoxed](#itemsboxed) | validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) | -| @Nullable Object | validate(@Nullable Object arg, SchemaConfiguration configuration) | - -## StringItemsEnums -public enum StringItemsEnums
-extends `Enum` - -A class that stores String enum values - -### Enum Constant Summary -| Enum Constant | Description | -| ------------- | ----------- | -| FISH | value = "fish" | -| CRAB | value = "crab" | - -## JustSymbolBoxed -public sealed interface JustSymbolBoxed
-permits
-[JustSymbolBoxedString](#justsymbolboxedstring) - -sealed interface that stores validated payloads using boxed classes - -## JustSymbolBoxedString -public record JustSymbolBoxedString
-implements [JustSymbolBoxed](#justsymbolboxed) - -record that stores validated String payloads, sealed permits implementation - -### Constructor Summary -| Constructor and Description | -| --------------------------- | -| JustSymbolBoxedString(String data)
Creates an instance, private visibility | - -### Method Summary -| Modifier and Type | Method and Description | -| ----------------- | ---------------------- | -| String | data()
validated payload | -| @Nullable Object | getData()
validated payload | - -## JustSymbol -public static class JustSymbol
-extends JsonSchema - -A schema class that validates payloads - -### Code Sample -``` -import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags; -import org.openapijsonschematools.client.configurations.SchemaConfiguration; -import org.openapijsonschematools.client.exceptions.ValidationException; -import org.openapijsonschematools.client.schemas.validation.MapUtils; -import org.openapijsonschematools.client.schemas.validation.FrozenList; -import org.openapijsonschematools.client.schemas.validation.FrozenMap; -import org.openapijsonschematools.client.components.schemas.EnumArrays; - -import java.util.Arrays; -import java.util.List; -import java.util.AbstractMap; - -static final SchemaConfiguration configuration = new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().build()); - -// String validation -String validatedPayload = EnumArrays.JustSymbol.validate( - ">=", - configuration -); -``` - -### Field Summary -| Modifier and Type | Field and Description | -| ----------------- | ---------------------- | -| Set> | type = Set.of(
    String.class
)
| -| Set | enumValues = SetMaker.makeSet(
    ">=",
    "$"
)
| - -### Method Summary -| Modifier and Type | Method and Description | -| ----------------- | ---------------------- | -| String | validate(String arg, SchemaConfiguration configuration) | -| String | validate([StringJustSymbolEnums](#stringjustsymbolenums) arg, SchemaConfiguration configuration) | -| [JustSymbolBoxedString](#justsymbolboxedstring) | validateAndBox(String arg, SchemaConfiguration configuration) | -| [JustSymbolBoxed](#justsymbolboxed) | validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) | -| @Nullable Object | validate(@Nullable Object arg, SchemaConfiguration configuration) | - -## StringJustSymbolEnums -public enum StringJustSymbolEnums
-extends `Enum` - -A class that stores String enum values - -### Enum Constant Summary -| Enum Constant | Description | -| ------------- | ----------- | -| GREATER_THAN_SIGN_EQUALS_SIGN | value = ">=" | -| DOLLAR_SIGN | value = "$" | - -[[Back to top]](#top) [[Back to Component Schemas]](../../../README.md#Component-Schemas) [[Back to README]](../../../README.md) diff --git a/samples/client/petstore/kotlin/docs/components/schemas/EnumClass.md b/samples/client/petstore/kotlin/docs/components/schemas/EnumClass.md deleted file mode 100644 index 4ee8809a9b0..00000000000 --- a/samples/client/petstore/kotlin/docs/components/schemas/EnumClass.md +++ /dev/null @@ -1,103 +0,0 @@ -# EnumClass -org.openapijsonschematools.client.components.schemas.EnumClass.java -public class EnumClass
- -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 -- enum classes - -## Nested Class Summary -| Modifier and Type | Class and Description | -| ----------------- | ---------------------- | -| sealed interface | [EnumClass.EnumClass1Boxed](#enumclass1boxed)
sealed interface for validated payloads | -| record | [EnumClass.EnumClass1BoxedString](#enumclass1boxedstring)
boxed class to store validated String payloads | -| static class | [EnumClass.EnumClass1](#enumclass1)
schema class | -| enum | [EnumClass.StringEnumClassEnums](#stringenumclassenums)
String enum | - -## EnumClass1Boxed -public sealed interface EnumClass1Boxed
-permits
-[EnumClass1BoxedString](#enumclass1boxedstring) - -sealed interface that stores validated payloads using boxed classes - -## EnumClass1BoxedString -public record EnumClass1BoxedString
-implements [EnumClass1Boxed](#enumclass1boxed) - -record that stores validated String payloads, sealed permits implementation - -### Constructor Summary -| Constructor and Description | -| --------------------------- | -| EnumClass1BoxedString(String data)
Creates an instance, private visibility | - -### Method Summary -| Modifier and Type | Method and Description | -| ----------------- | ---------------------- | -| String | data()
validated payload | -| @Nullable Object | getData()
validated payload | - -## EnumClass1 -public static class EnumClass1
-extends JsonSchema - -A schema class that validates payloads - -### Code Sample -``` -import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags; -import org.openapijsonschematools.client.configurations.SchemaConfiguration; -import org.openapijsonschematools.client.exceptions.ValidationException; -import org.openapijsonschematools.client.schemas.validation.MapUtils; -import org.openapijsonschematools.client.schemas.validation.FrozenList; -import org.openapijsonschematools.client.schemas.validation.FrozenMap; -import org.openapijsonschematools.client.components.schemas.EnumClass; - -import java.util.Arrays; -import java.util.List; -import java.util.AbstractMap; - -static final SchemaConfiguration configuration = new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().build()); - -// String validation -String validatedPayload = EnumClass.EnumClass1.validate( - "_abc", - configuration -); -``` - -### Field Summary -| Modifier and Type | Field and Description | -| ----------------- | ---------------------- | -| Set> | type = Set.of(
    String.class
)
| -| Set | enumValues = SetMaker.makeSet(
    "_abc",
    "-efg",
    "(xyz)",
    "COUNT_1M",
    "COUNT_50M"
)
| -| @Nullable Object | defaultValue = "-efg" | - -### Method Summary -| Modifier and Type | Method and Description | -| ----------------- | ---------------------- | -| String | validate(String arg, SchemaConfiguration configuration) | -| String | validate([StringEnumClassEnums](#stringenumclassenums) arg, SchemaConfiguration configuration) | -| [EnumClass1BoxedString](#enumclass1boxedstring) | validateAndBox(String arg, SchemaConfiguration configuration) | -| [EnumClass1Boxed](#enumclass1boxed) | validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) | -| @Nullable Object | validate(@Nullable Object arg, SchemaConfiguration configuration) | - -## StringEnumClassEnums -public enum StringEnumClassEnums
-extends `Enum` - -A class that stores String enum values - -### Enum Constant Summary -| Enum Constant | Description | -| ------------- | ----------- | -| LOW_LINE_ABC | value = "_abc" | -| HYPHEN_MINUS_EFG | value = "-efg" | -| LEFT_PARENTHESIS_XYZ_RIGHT_PARENTHESIS | value = "(xyz)" | -| COUNT_1M | value = "COUNT_1M" | -| COUNT_50M | value = "COUNT_50M" | - -[[Back to top]](#top) [[Back to Component Schemas]](../../../README.md#Component-Schemas) [[Back to README]](../../../README.md) diff --git a/samples/client/petstore/kotlin/docs/components/schemas/EnumTest.md b/samples/client/petstore/kotlin/docs/components/schemas/EnumTest.md deleted file mode 100644 index b1eced4c620..00000000000 --- a/samples/client/petstore/kotlin/docs/components/schemas/EnumTest.md +++ /dev/null @@ -1,597 +0,0 @@ -# EnumTest -org.openapijsonschematools.client.components.schemas.EnumTest.java -public class EnumTest
- -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 | [EnumTest.EnumTest1Boxed](#enumtest1boxed)
sealed interface for validated payloads | -| record | [EnumTest.EnumTest1BoxedMap](#enumtest1boxedmap)
boxed class to store validated Map payloads | -| static class | [EnumTest.EnumTest1](#enumtest1)
schema class | -| static class | [EnumTest.EnumTestMapBuilder](#enumtestmapbuilder)
builder for Map payloads | -| static class | [EnumTest.EnumTestMap](#enumtestmap)
output class for Map payloads | -| sealed interface | [EnumTest.EnumNumberBoxed](#enumnumberboxed)
sealed interface for validated payloads | -| record | [EnumTest.EnumNumberBoxedNumber](#enumnumberboxednumber)
boxed class to store validated Number payloads | -| static class | [EnumTest.EnumNumber](#enumnumber)
schema class | -| enum | [EnumTest.DoubleEnumNumberEnums](#doubleenumnumberenums)
Double enum | -| enum | [EnumTest.FloatEnumNumberEnums](#floatenumnumberenums)
Float enum | -| sealed interface | [EnumTest.EnumIntegerBoxed](#enumintegerboxed)
sealed interface for validated payloads | -| record | [EnumTest.EnumIntegerBoxedNumber](#enumintegerboxednumber)
boxed class to store validated Number payloads | -| static class | [EnumTest.EnumInteger](#enuminteger)
schema class | -| enum | [EnumTest.IntegerEnumIntegerEnums](#integerenumintegerenums)
Integer enum | -| enum | [EnumTest.LongEnumIntegerEnums](#longenumintegerenums)
Long enum | -| enum | [EnumTest.FloatEnumIntegerEnums](#floatenumintegerenums)
Float enum | -| enum | [EnumTest.DoubleEnumIntegerEnums](#doubleenumintegerenums)
Double enum | -| sealed interface | [EnumTest.EnumStringRequiredBoxed](#enumstringrequiredboxed)
sealed interface for validated payloads | -| record | [EnumTest.EnumStringRequiredBoxedString](#enumstringrequiredboxedstring)
boxed class to store validated String payloads | -| static class | [EnumTest.EnumStringRequired](#enumstringrequired)
schema class | -| enum | [EnumTest.StringEnumStringRequiredEnums](#stringenumstringrequiredenums)
String enum | -| sealed interface | [EnumTest.EnumStringBoxed](#enumstringboxed)
sealed interface for validated payloads | -| record | [EnumTest.EnumStringBoxedString](#enumstringboxedstring)
boxed class to store validated String payloads | -| static class | [EnumTest.EnumString](#enumstring)
schema class | -| enum | [EnumTest.StringEnumStringEnums](#stringenumstringenums)
String enum | - -## EnumTest1Boxed -public sealed interface EnumTest1Boxed
-permits
-[EnumTest1BoxedMap](#enumtest1boxedmap) - -sealed interface that stores validated payloads using boxed classes - -## EnumTest1BoxedMap -public record EnumTest1BoxedMap
-implements [EnumTest1Boxed](#enumtest1boxed) - -record that stores validated Map payloads, sealed permits implementation - -### Constructor Summary -| Constructor and Description | -| --------------------------- | -| EnumTest1BoxedMap([EnumTestMap](#enumtestmap) data)
Creates an instance, private visibility | - -### Method Summary -| Modifier and Type | Method and Description | -| ----------------- | ---------------------- | -| [EnumTestMap](#enumtestmap) | data()
validated payload | -| @Nullable Object | getData()
validated payload | - -## EnumTest1 -public static class EnumTest1
-extends JsonSchema - -A schema class that validates payloads - -### Code Sample -``` -import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags; -import org.openapijsonschematools.client.configurations.SchemaConfiguration; -import org.openapijsonschematools.client.exceptions.ValidationException; -import org.openapijsonschematools.client.schemas.validation.MapUtils; -import org.openapijsonschematools.client.schemas.validation.FrozenList; -import org.openapijsonschematools.client.schemas.validation.FrozenMap; -import org.openapijsonschematools.client.components.schemas.EnumTest; - -import java.util.Arrays; -import java.util.List; -import java.util.AbstractMap; - -static final SchemaConfiguration configuration = new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().build()); - -// Map validation -EnumTest.EnumTestMap validatedPayload = - EnumTest.EnumTest1.validate( - new EnumTest.EnumTestMapBuilder() - .enum_string_required("UPPER") - - .enum_string("UPPER") - - .enum_integer(1) - - .enum_number(3.14d) - - .build(), - configuration -); -``` - -### Field Summary -| Modifier and Type | Field and Description | -| ----------------- | ---------------------- | -| Set> | type = Set.of(Map.class) | -| Map> | properties = Map.ofEntries(
    new PropertyEntry("enum_string", [EnumString.class](#enumstring))),
    new PropertyEntry("enum_string_required", [EnumStringRequired.class](#enumstringrequired))),
    new PropertyEntry("enum_integer", [EnumInteger.class](#enuminteger))),
    new PropertyEntry("enum_number", [EnumNumber.class](#enumnumber))),
    new PropertyEntry("stringEnum", [StringEnum.StringEnum1.class](../../components/schemas/StringEnum.md#stringenum1)),
    new PropertyEntry("IntegerEnum", [IntegerEnum.IntegerEnum1.class](../../components/schemas/IntegerEnum.md#integerenum1)),
    new PropertyEntry("StringEnumWithDefaultValue", [StringEnumWithDefaultValue.StringEnumWithDefaultValue1.class](../../components/schemas/StringEnumWithDefaultValue.md#stringenumwithdefaultvalue1)),
    new PropertyEntry("IntegerEnumWithDefaultValue", [IntegerEnumWithDefaultValue.IntegerEnumWithDefaultValue1.class](../../components/schemas/IntegerEnumWithDefaultValue.md#integerenumwithdefaultvalue1)),
    new PropertyEntry("IntegerEnumOneValue", [IntegerEnumOneValue.IntegerEnumOneValue1.class](../../components/schemas/IntegerEnumOneValue.md#integerenumonevalue1))
)
| -| Set | required = Set.of(
    "enum_string_required"
)
| - -### Method Summary -| Modifier and Type | Method and Description | -| ----------------- | ---------------------- | -| [EnumTestMap](#enumtestmap) | validate([Map<?, ?>](#enumtestmapbuilder) arg, SchemaConfiguration configuration) | -| [EnumTest1BoxedMap](#enumtest1boxedmap) | validateAndBox([Map<?, ?>](#enumtestmapbuilder) arg, SchemaConfiguration configuration) | -| [EnumTest1Boxed](#enumtest1boxed) | validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) | -| @Nullable Object | validate(@Nullable Object arg, SchemaConfiguration configuration) | - -## EnumTestMap0Builder -public class EnumTestMap0Builder
-builder for `Map` - -A class that builds the Map input type - -### Constructor Summary -| Constructor and Description | -| --------------------------- | -| EnumTestMap0Builder(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 | -| [EnumTestMap0Builder](#enumtestmap0builder) | enum_string(String value) | -| [EnumTestMap0Builder](#enumtestmap0builder) | enum_string([StringEnumStringEnums](#stringenumstringenums) value) | -| [EnumTestMap0Builder](#enumtestmap0builder) | enum_integer(int value) | -| [EnumTestMap0Builder](#enumtestmap0builder) | enum_integer(float value) | -| [EnumTestMap0Builder](#enumtestmap0builder) | enum_integer([IntegerEnumIntegerEnums](#integerenumintegerenums) value) | -| [EnumTestMap0Builder](#enumtestmap0builder) | enum_integer([LongEnumIntegerEnums](#longenumintegerenums) value) | -| [EnumTestMap0Builder](#enumtestmap0builder) | enum_integer([FloatEnumIntegerEnums](#floatenumintegerenums) value) | -| [EnumTestMap0Builder](#enumtestmap0builder) | enum_integer([DoubleEnumIntegerEnums](#doubleenumintegerenums) value) | -| [EnumTestMap0Builder](#enumtestmap0builder) | enum_number(int value) | -| [EnumTestMap0Builder](#enumtestmap0builder) | enum_number(float value) | -| [EnumTestMap0Builder](#enumtestmap0builder) | enum_number(long value) | -| [EnumTestMap0Builder](#enumtestmap0builder) | enum_number(double value) | -| [EnumTestMap0Builder](#enumtestmap0builder) | enum_number([DoubleEnumNumberEnums](#doubleenumnumberenums) value) | -| [EnumTestMap0Builder](#enumtestmap0builder) | enum_number([FloatEnumNumberEnums](#floatenumnumberenums) value) | -| [EnumTestMap0Builder](#enumtestmap0builder) | stringEnum(Nothing? value) | -| [EnumTestMap0Builder](#enumtestmap0builder) | stringEnum(String value) | -| [EnumTestMap0Builder](#enumtestmap0builder) | stringEnum([StringEnum.StringStringEnumEnums](../../components/schemas/StringEnum.md#stringstringenumenums) value) | -| [EnumTestMap0Builder](#enumtestmap0builder) | stringEnum([StringEnum.NullStringEnumEnums](../../components/schemas/StringEnum.md#nullstringenumenums) value) | -| [EnumTestMap0Builder](#enumtestmap0builder) | IntegerEnum(int value) | -| [EnumTestMap0Builder](#enumtestmap0builder) | IntegerEnum(float value) | -| [EnumTestMap0Builder](#enumtestmap0builder) | IntegerEnum(long value) | -| [EnumTestMap0Builder](#enumtestmap0builder) | IntegerEnum(double value) | -| [EnumTestMap0Builder](#enumtestmap0builder) | IntegerEnum([IntegerEnum.IntegerIntegerEnumEnums](../../components/schemas/IntegerEnum.md#integerintegerenumenums) value) | -| [EnumTestMap0Builder](#enumtestmap0builder) | IntegerEnum([IntegerEnum.LongIntegerEnumEnums](../../components/schemas/IntegerEnum.md#longintegerenumenums) value) | -| [EnumTestMap0Builder](#enumtestmap0builder) | IntegerEnum([IntegerEnum.FloatIntegerEnumEnums](../../components/schemas/IntegerEnum.md#floatintegerenumenums) value) | -| [EnumTestMap0Builder](#enumtestmap0builder) | IntegerEnum([IntegerEnum.DoubleIntegerEnumEnums](../../components/schemas/IntegerEnum.md#doubleintegerenumenums) value) | -| [EnumTestMap0Builder](#enumtestmap0builder) | StringEnumWithDefaultValue(String value) | -| [EnumTestMap0Builder](#enumtestmap0builder) | StringEnumWithDefaultValue([StringEnumWithDefaultValue.StringStringEnumWithDefaultValueEnums](../../components/schemas/StringEnumWithDefaultValue.md#stringstringenumwithdefaultvalueenums) value) | -| [EnumTestMap0Builder](#enumtestmap0builder) | IntegerEnumWithDefaultValue(int value) | -| [EnumTestMap0Builder](#enumtestmap0builder) | IntegerEnumWithDefaultValue(float value) | -| [EnumTestMap0Builder](#enumtestmap0builder) | IntegerEnumWithDefaultValue(long value) | -| [EnumTestMap0Builder](#enumtestmap0builder) | IntegerEnumWithDefaultValue(double value) | -| [EnumTestMap0Builder](#enumtestmap0builder) | IntegerEnumWithDefaultValue([IntegerEnumWithDefaultValue.IntegerIntegerEnumWithDefaultValueEnums](../../components/schemas/IntegerEnumWithDefaultValue.md#integerintegerenumwithdefaultvalueenums) value) | -| [EnumTestMap0Builder](#enumtestmap0builder) | IntegerEnumWithDefaultValue([IntegerEnumWithDefaultValue.LongIntegerEnumWithDefaultValueEnums](../../components/schemas/IntegerEnumWithDefaultValue.md#longintegerenumwithdefaultvalueenums) value) | -| [EnumTestMap0Builder](#enumtestmap0builder) | IntegerEnumWithDefaultValue([IntegerEnumWithDefaultValue.FloatIntegerEnumWithDefaultValueEnums](../../components/schemas/IntegerEnumWithDefaultValue.md#floatintegerenumwithdefaultvalueenums) value) | -| [EnumTestMap0Builder](#enumtestmap0builder) | IntegerEnumWithDefaultValue([IntegerEnumWithDefaultValue.DoubleIntegerEnumWithDefaultValueEnums](../../components/schemas/IntegerEnumWithDefaultValue.md#doubleintegerenumwithdefaultvalueenums) value) | -| [EnumTestMap0Builder](#enumtestmap0builder) | IntegerEnumOneValue(int value) | -| [EnumTestMap0Builder](#enumtestmap0builder) | IntegerEnumOneValue(float value) | -| [EnumTestMap0Builder](#enumtestmap0builder) | IntegerEnumOneValue(long value) | -| [EnumTestMap0Builder](#enumtestmap0builder) | IntegerEnumOneValue(double value) | -| [EnumTestMap0Builder](#enumtestmap0builder) | IntegerEnumOneValue([IntegerEnumOneValue.IntegerIntegerEnumOneValueEnums](../../components/schemas/IntegerEnumOneValue.md#integerintegerenumonevalueenums) value) | -| [EnumTestMap0Builder](#enumtestmap0builder) | IntegerEnumOneValue([IntegerEnumOneValue.LongIntegerEnumOneValueEnums](../../components/schemas/IntegerEnumOneValue.md#longintegerenumonevalueenums) value) | -| [EnumTestMap0Builder](#enumtestmap0builder) | IntegerEnumOneValue([IntegerEnumOneValue.FloatIntegerEnumOneValueEnums](../../components/schemas/IntegerEnumOneValue.md#floatintegerenumonevalueenums) value) | -| [EnumTestMap0Builder](#enumtestmap0builder) | IntegerEnumOneValue([IntegerEnumOneValue.DoubleIntegerEnumOneValueEnums](../../components/schemas/IntegerEnumOneValue.md#doubleintegerenumonevalueenums) value) | -| [EnumTestMap0Builder](#enumtestmap0builder) | additionalProperty(String key, Nothing? value) | -| [EnumTestMap0Builder](#enumtestmap0builder) | additionalProperty(String key, boolean value) | -| [EnumTestMap0Builder](#enumtestmap0builder) | additionalProperty(String key, String value) | -| [EnumTestMap0Builder](#enumtestmap0builder) | additionalProperty(String key, int value) | -| [EnumTestMap0Builder](#enumtestmap0builder) | additionalProperty(String key, float value) | -| [EnumTestMap0Builder](#enumtestmap0builder) | additionalProperty(String key, long value) | -| [EnumTestMap0Builder](#enumtestmap0builder) | additionalProperty(String key, double value) | -| [EnumTestMap0Builder](#enumtestmap0builder) | additionalProperty(String key, List value) | -| [EnumTestMap0Builder](#enumtestmap0builder) | additionalProperty(String key, Map value) | - -## EnumTestMapBuilder -public class EnumTestMapBuilder
-builder for `Map` - -A class that builds the Map input type - -### Constructor Summary -| Constructor and Description | -| --------------------------- | -| EnumTestMapBuilder()
Creates a builder that contains an empty map | - -### Method Summary -| Modifier and Type | Method and Description | -| ----------------- | ---------------------- | -| [EnumTestMap0Builder](#enumtestmap0builder) | enum_string_required(String value) | -| [EnumTestMap0Builder](#enumtestmap0builder) | enum_string_required([StringEnumStringRequiredEnums](#stringenumstringrequiredenums) value) | - -## EnumTestMap -public static class EnumTestMap
-extends FrozenMap - -A class to store validated Map payloads - -### Method Summary -| Modifier and Type | Method and Description | -| ----------------- | ---------------------- | -| static [EnumTestMap](#enumtestmap) | of([Map](#enumtestmapbuilder) arg, SchemaConfiguration configuration) | -| String | enum_string_required()
must be one of ["UPPER", "lower", ""] | -| String | enum_string()
[optional] must be one of ["UPPER", "lower", ""] | -| Number | enum_integer()
[optional] must be one of [1, -1] value must be a 32 bit integer | -| Number | enum_number()
[optional] must be one of [1.1, -1.2] value must be a 64 bit float | -| @Nullable String | stringEnum()
[optional] | -| Number | IntegerEnum()
[optional] | -| String | StringEnumWithDefaultValue()
[optional] | -| Number | IntegerEnumWithDefaultValue()
[optional] | -| Number | IntegerEnumOneValue()
[optional] | -| @Nullable Object | getAdditionalProperty(String name)
provides type safety for additional properties | - -## EnumNumberBoxed -public sealed interface EnumNumberBoxed
-permits
-[EnumNumberBoxedNumber](#enumnumberboxednumber) - -sealed interface that stores validated payloads using boxed classes - -## EnumNumberBoxedNumber -public record EnumNumberBoxedNumber
-implements [EnumNumberBoxed](#enumnumberboxed) - -record that stores validated Number payloads, sealed permits implementation - -### Constructor Summary -| Constructor and Description | -| --------------------------- | -| EnumNumberBoxedNumber(Number data)
Creates an instance, private visibility | - -### Method Summary -| Modifier and Type | Method and Description | -| ----------------- | ---------------------- | -| Number | data()
validated payload | -| @Nullable Object | getData()
validated payload | - -## EnumNumber -public static class EnumNumber
-extends JsonSchema - -A schema class that validates payloads - -### Code Sample -``` -import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags; -import org.openapijsonschematools.client.configurations.SchemaConfiguration; -import org.openapijsonschematools.client.exceptions.ValidationException; -import org.openapijsonschematools.client.schemas.validation.MapUtils; -import org.openapijsonschematools.client.schemas.validation.FrozenList; -import org.openapijsonschematools.client.schemas.validation.FrozenMap; -import org.openapijsonschematools.client.components.schemas.EnumTest; - -import java.util.Arrays; -import java.util.List; -import java.util.AbstractMap; - -static final SchemaConfiguration configuration = new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().build()); - -// double validation -double validatedPayload = EnumTest.EnumNumber.validate( - 3.14d, - configuration -); -``` - -### Field Summary -| Modifier and Type | Field and Description | -| ----------------- | ---------------------- | -| Set> | type = Set.of(
    Integer.class,
    Long.class,
    Float.class,
    Double.class
)
| -| String | type = "double"; | -| Set | enumValues = SetMaker.makeSet(
    1.1,
    -1.2
)
| - -### Method Summary -| Modifier and Type | Method and Description | -| ----------------- | ---------------------- | -| double | validate(double arg, SchemaConfiguration configuration) | -| [EnumNumberBoxedNumber](#enumnumberboxednumber) | validateAndBox(Number arg, SchemaConfiguration configuration) | -| [EnumNumberBoxed](#enumnumberboxed) | validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) | -| @Nullable Object | validate(@Nullable Object arg, SchemaConfiguration configuration) | - -## DoubleEnumNumberEnums -public enum DoubleEnumNumberEnums
-extends `Enum` - -A class that stores Double enum values - -### Enum Constant Summary -| Enum Constant | Description | -| ------------- | ----------- | -| POSITIVE_1_PT_1 | value = 1.1d | -| NEGATIVE_1_PT_2 | value = -1.2d | - -## FloatEnumNumberEnums -public enum FloatEnumNumberEnums
-extends `Enum` - -A class that stores Float enum values - -### Enum Constant Summary -| Enum Constant | Description | -| ------------- | ----------- | -| POSITIVE_1_PT_1 | value = 1.1f | -| NEGATIVE_1_PT_2 | value = -1.2f | - -## EnumIntegerBoxed -public sealed interface EnumIntegerBoxed
-permits
-[EnumIntegerBoxedNumber](#enumintegerboxednumber) - -sealed interface that stores validated payloads using boxed classes - -## EnumIntegerBoxedNumber -public record EnumIntegerBoxedNumber
-implements [EnumIntegerBoxed](#enumintegerboxed) - -record that stores validated Number payloads, sealed permits implementation - -### Constructor Summary -| Constructor and Description | -| --------------------------- | -| EnumIntegerBoxedNumber(Number data)
Creates an instance, private visibility | - -### Method Summary -| Modifier and Type | Method and Description | -| ----------------- | ---------------------- | -| Number | data()
validated payload | -| @Nullable Object | getData()
validated payload | - -## EnumInteger -public static class EnumInteger
-extends JsonSchema - -A schema class that validates payloads - -### Code Sample -``` -import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags; -import org.openapijsonschematools.client.configurations.SchemaConfiguration; -import org.openapijsonschematools.client.exceptions.ValidationException; -import org.openapijsonschematools.client.schemas.validation.MapUtils; -import org.openapijsonschematools.client.schemas.validation.FrozenList; -import org.openapijsonschematools.client.schemas.validation.FrozenMap; -import org.openapijsonschematools.client.components.schemas.EnumTest; - -import java.util.Arrays; -import java.util.List; -import java.util.AbstractMap; - -static final SchemaConfiguration configuration = new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().build()); - -// int validation -int validatedPayload = EnumTest.EnumInteger.validate( - 1, - configuration -); -``` - -### Field Summary -| Modifier and Type | Field and Description | -| ----------------- | ---------------------- | -| Set> | type = Set.of(
    Integer.class,
    Long.class,
    Float.class,
    Double.class
)
| -| String | type = "int32"; | -| Set | enumValues = SetMaker.makeSet(
    1,
    -1
)
| - -### Method Summary -| Modifier and Type | Method and Description | -| ----------------- | ---------------------- | -| int | validate(int arg, SchemaConfiguration configuration) | -| [EnumIntegerBoxedNumber](#enumintegerboxednumber) | validateAndBox(Number arg, SchemaConfiguration configuration) | -| [EnumIntegerBoxed](#enumintegerboxed) | validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) | -| @Nullable Object | validate(@Nullable Object arg, SchemaConfiguration configuration) | - -## IntegerEnumIntegerEnums -public enum IntegerEnumIntegerEnums
-extends `Enum` - -A class that stores Integer enum values - -### Enum Constant Summary -| Enum Constant | Description | -| ------------- | ----------- | -| POSITIVE_1 | value = 1 | -| NEGATIVE_1 | value = -1 | - -## LongEnumIntegerEnums -public enum LongEnumIntegerEnums
-extends `Enum` - -A class that stores Long enum values - -### Enum Constant Summary -| Enum Constant | Description | -| ------------- | ----------- | -| POSITIVE_1 | value = 1L | -| NEGATIVE_1 | value = -1L | - -## FloatEnumIntegerEnums -public enum FloatEnumIntegerEnums
-extends `Enum` - -A class that stores Float enum values - -### Enum Constant Summary -| Enum Constant | Description | -| ------------- | ----------- | -| POSITIVE_1 | value = 1.0f | -| NEGATIVE_1 | value = -1.0f | - -## DoubleEnumIntegerEnums -public enum DoubleEnumIntegerEnums
-extends `Enum` - -A class that stores Double enum values - -### Enum Constant Summary -| Enum Constant | Description | -| ------------- | ----------- | -| POSITIVE_1 | value = 1.0d | -| NEGATIVE_1 | value = -1.0d | - -## EnumStringRequiredBoxed -public sealed interface EnumStringRequiredBoxed
-permits
-[EnumStringRequiredBoxedString](#enumstringrequiredboxedstring) - -sealed interface that stores validated payloads using boxed classes - -## EnumStringRequiredBoxedString -public record EnumStringRequiredBoxedString
-implements [EnumStringRequiredBoxed](#enumstringrequiredboxed) - -record that stores validated String payloads, sealed permits implementation - -### Constructor Summary -| Constructor and Description | -| --------------------------- | -| EnumStringRequiredBoxedString(String data)
Creates an instance, private visibility | - -### Method Summary -| Modifier and Type | Method and Description | -| ----------------- | ---------------------- | -| String | data()
validated payload | -| @Nullable Object | getData()
validated payload | - -## EnumStringRequired -public static class EnumStringRequired
-extends JsonSchema - -A schema class that validates payloads - -### Code Sample -``` -import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags; -import org.openapijsonschematools.client.configurations.SchemaConfiguration; -import org.openapijsonschematools.client.exceptions.ValidationException; -import org.openapijsonschematools.client.schemas.validation.MapUtils; -import org.openapijsonschematools.client.schemas.validation.FrozenList; -import org.openapijsonschematools.client.schemas.validation.FrozenMap; -import org.openapijsonschematools.client.components.schemas.EnumTest; - -import java.util.Arrays; -import java.util.List; -import java.util.AbstractMap; - -static final SchemaConfiguration configuration = new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().build()); - -// String validation -String validatedPayload = EnumTest.EnumStringRequired.validate( - "UPPER", - configuration -); -``` - -### Field Summary -| Modifier and Type | Field and Description | -| ----------------- | ---------------------- | -| Set> | type = Set.of(
    String.class
)
| -| Set | enumValues = SetMaker.makeSet(
    "UPPER",
    "lower",
    ""
)
| - -### Method Summary -| Modifier and Type | Method and Description | -| ----------------- | ---------------------- | -| String | validate(String arg, SchemaConfiguration configuration) | -| String | validate([StringEnumStringRequiredEnums](#stringenumstringrequiredenums) arg, SchemaConfiguration configuration) | -| [EnumStringRequiredBoxedString](#enumstringrequiredboxedstring) | validateAndBox(String arg, SchemaConfiguration configuration) | -| [EnumStringRequiredBoxed](#enumstringrequiredboxed) | validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) | -| @Nullable Object | validate(@Nullable Object arg, SchemaConfiguration configuration) | - -## StringEnumStringRequiredEnums -public enum StringEnumStringRequiredEnums
-extends `Enum` - -A class that stores String enum values - -### Enum Constant Summary -| Enum Constant | Description | -| ------------- | ----------- | -| UPPER | value = "UPPER" | -| LOWER | value = "lower" | -| EMPTY | value = "" | - -## EnumStringBoxed -public sealed interface EnumStringBoxed
-permits
-[EnumStringBoxedString](#enumstringboxedstring) - -sealed interface that stores validated payloads using boxed classes - -## EnumStringBoxedString -public record EnumStringBoxedString
-implements [EnumStringBoxed](#enumstringboxed) - -record that stores validated String payloads, sealed permits implementation - -### Constructor Summary -| Constructor and Description | -| --------------------------- | -| EnumStringBoxedString(String data)
Creates an instance, private visibility | - -### Method Summary -| Modifier and Type | Method and Description | -| ----------------- | ---------------------- | -| String | data()
validated payload | -| @Nullable Object | getData()
validated payload | - -## EnumString -public static class EnumString
-extends JsonSchema - -A schema class that validates payloads - -### Code Sample -``` -import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags; -import org.openapijsonschematools.client.configurations.SchemaConfiguration; -import org.openapijsonschematools.client.exceptions.ValidationException; -import org.openapijsonschematools.client.schemas.validation.MapUtils; -import org.openapijsonschematools.client.schemas.validation.FrozenList; -import org.openapijsonschematools.client.schemas.validation.FrozenMap; -import org.openapijsonschematools.client.components.schemas.EnumTest; - -import java.util.Arrays; -import java.util.List; -import java.util.AbstractMap; - -static final SchemaConfiguration configuration = new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().build()); - -// String validation -String validatedPayload = EnumTest.EnumString.validate( - "UPPER", - configuration -); -``` - -### Field Summary -| Modifier and Type | Field and Description | -| ----------------- | ---------------------- | -| Set> | type = Set.of(
    String.class
)
| -| Set | enumValues = SetMaker.makeSet(
    "UPPER",
    "lower",
    ""
)
| - -### Method Summary -| Modifier and Type | Method and Description | -| ----------------- | ---------------------- | -| String | validate(String arg, SchemaConfiguration configuration) | -| String | validate([StringEnumStringEnums](#stringenumstringenums) arg, SchemaConfiguration configuration) | -| [EnumStringBoxedString](#enumstringboxedstring) | validateAndBox(String arg, SchemaConfiguration configuration) | -| [EnumStringBoxed](#enumstringboxed) | validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) | -| @Nullable Object | validate(@Nullable Object arg, SchemaConfiguration configuration) | - -## StringEnumStringEnums -public enum StringEnumStringEnums
-extends `Enum` - -A class that stores String enum values - -### Enum Constant Summary -| Enum Constant | Description | -| ------------- | ----------- | -| UPPER | value = "UPPER" | -| LOWER | value = "lower" | -| EMPTY | value = "" | - -[[Back to top]](#top) [[Back to Component Schemas]](../../../README.md#Component-Schemas) [[Back to README]](../../../README.md) diff --git a/samples/client/petstore/kotlin/docs/components/schemas/EquilateralTriangle.md b/samples/client/petstore/kotlin/docs/components/schemas/EquilateralTriangle.md deleted file mode 100644 index 55ce3f9f8b2..00000000000 --- a/samples/client/petstore/kotlin/docs/components/schemas/EquilateralTriangle.md +++ /dev/null @@ -1,371 +0,0 @@ -# EquilateralTriangle -org.openapijsonschematools.client.components.schemas.EquilateralTriangle.java -public class EquilateralTriangle
- -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 | [EquilateralTriangle.EquilateralTriangle1Boxed](#equilateraltriangle1boxed)
sealed interface for validated payloads | -| record | [EquilateralTriangle.EquilateralTriangle1BoxedVoid](#equilateraltriangle1boxedvoid)
boxed class to store validated null payloads | -| record | [EquilateralTriangle.EquilateralTriangle1BoxedBoolean](#equilateraltriangle1boxedboolean)
boxed class to store validated boolean payloads | -| record | [EquilateralTriangle.EquilateralTriangle1BoxedNumber](#equilateraltriangle1boxednumber)
boxed class to store validated Number payloads | -| record | [EquilateralTriangle.EquilateralTriangle1BoxedString](#equilateraltriangle1boxedstring)
boxed class to store validated String payloads | -| record | [EquilateralTriangle.EquilateralTriangle1BoxedList](#equilateraltriangle1boxedlist)
boxed class to store validated List payloads | -| record | [EquilateralTriangle.EquilateralTriangle1BoxedMap](#equilateraltriangle1boxedmap)
boxed class to store validated Map payloads | -| static class | [EquilateralTriangle.EquilateralTriangle1](#equilateraltriangle1)
schema class | -| sealed interface | [EquilateralTriangle.Schema1Boxed](#schema1boxed)
sealed interface for validated payloads | -| record | [EquilateralTriangle.Schema1BoxedMap](#schema1boxedmap)
boxed class to store validated Map payloads | -| static class | [EquilateralTriangle.Schema1](#schema1)
schema class | -| static class | [EquilateralTriangle.Schema1MapBuilder](#schema1mapbuilder)
builder for Map payloads | -| static class | [EquilateralTriangle.Schema1Map](#schema1map)
output class for Map payloads | -| sealed interface | [EquilateralTriangle.TriangleTypeBoxed](#triangletypeboxed)
sealed interface for validated payloads | -| record | [EquilateralTriangle.TriangleTypeBoxedString](#triangletypeboxedstring)
boxed class to store validated String payloads | -| static class | [EquilateralTriangle.TriangleType](#triangletype)
schema class | -| enum | [EquilateralTriangle.StringTriangleTypeEnums](#stringtriangletypeenums)
String enum | - -## EquilateralTriangle1Boxed -public sealed interface EquilateralTriangle1Boxed
-permits
-[EquilateralTriangle1BoxedVoid](#equilateraltriangle1boxedvoid), -[EquilateralTriangle1BoxedBoolean](#equilateraltriangle1boxedboolean), -[EquilateralTriangle1BoxedNumber](#equilateraltriangle1boxednumber), -[EquilateralTriangle1BoxedString](#equilateraltriangle1boxedstring), -[EquilateralTriangle1BoxedList](#equilateraltriangle1boxedlist), -[EquilateralTriangle1BoxedMap](#equilateraltriangle1boxedmap) - -sealed interface that stores validated payloads using boxed classes - -## EquilateralTriangle1BoxedVoid -public record EquilateralTriangle1BoxedVoid
-implements [EquilateralTriangle1Boxed](#equilateraltriangle1boxed) - -record that stores validated null payloads, sealed permits implementation - -### Constructor Summary -| Constructor and Description | -| --------------------------- | -| EquilateralTriangle1BoxedVoid(Nothing? data)
Creates an instance, private visibility | - -### Method Summary -| Modifier and Type | Method and Description | -| ----------------- | ---------------------- | -| Nothing? | data()
validated payload | -| @Nullable Object | getData()
validated payload | - -## EquilateralTriangle1BoxedBoolean -public record EquilateralTriangle1BoxedBoolean
-implements [EquilateralTriangle1Boxed](#equilateraltriangle1boxed) - -record that stores validated boolean payloads, sealed permits implementation - -### Constructor Summary -| Constructor and Description | -| --------------------------- | -| EquilateralTriangle1BoxedBoolean(boolean data)
Creates an instance, private visibility | - -### Method Summary -| Modifier and Type | Method and Description | -| ----------------- | ---------------------- | -| boolean | data()
validated payload | -| @Nullable Object | getData()
validated payload | - -## EquilateralTriangle1BoxedNumber -public record EquilateralTriangle1BoxedNumber
-implements [EquilateralTriangle1Boxed](#equilateraltriangle1boxed) - -record that stores validated Number payloads, sealed permits implementation - -### Constructor Summary -| Constructor and Description | -| --------------------------- | -| EquilateralTriangle1BoxedNumber(Number data)
Creates an instance, private visibility | - -### Method Summary -| Modifier and Type | Method and Description | -| ----------------- | ---------------------- | -| Number | data()
validated payload | -| @Nullable Object | getData()
validated payload | - -## EquilateralTriangle1BoxedString -public record EquilateralTriangle1BoxedString
-implements [EquilateralTriangle1Boxed](#equilateraltriangle1boxed) - -record that stores validated String payloads, sealed permits implementation - -### Constructor Summary -| Constructor and Description | -| --------------------------- | -| EquilateralTriangle1BoxedString(String data)
Creates an instance, private visibility | - -### Method Summary -| Modifier and Type | Method and Description | -| ----------------- | ---------------------- | -| String | data()
validated payload | -| @Nullable Object | getData()
validated payload | - -## EquilateralTriangle1BoxedList -public record EquilateralTriangle1BoxedList
-implements [EquilateralTriangle1Boxed](#equilateraltriangle1boxed) - -record that stores validated List payloads, sealed permits implementation - -### Constructor Summary -| Constructor and Description | -| --------------------------- | -| EquilateralTriangle1BoxedList(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 | - -## EquilateralTriangle1BoxedMap -public record EquilateralTriangle1BoxedMap
-implements [EquilateralTriangle1Boxed](#equilateraltriangle1boxed) - -record that stores validated Map payloads, sealed permits implementation - -### Constructor Summary -| Constructor and Description | -| --------------------------- | -| EquilateralTriangle1BoxedMap(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 | - -## EquilateralTriangle1 -public static class EquilateralTriangle1
-extends JsonSchema - -A schema class that validates payloads - -### Field Summary -| Modifier and Type | Field and Description | -| ----------------- | ---------------------- | -| List> | allOf = List.of(
    [TriangleInterface.TriangleInterface1.class](../../components/schemas/TriangleInterface.md#triangleinterface1),
    [Schema1.class](#schema1)
;)
| - -### Method Summary -| Modifier and Type | Method and Description | -| ----------------- | ---------------------- | -| String | validate(String arg, SchemaConfiguration configuration) | -| Nothing? | validate(Nothing? arg, SchemaConfiguration configuration) | -| int | validate(int arg, SchemaConfiguration configuration) | -| long | validate(long arg, SchemaConfiguration configuration) | -| float | validate(float arg, SchemaConfiguration configuration) | -| double | validate(double arg, SchemaConfiguration configuration) | -| Number | validate(Number arg, SchemaConfiguration configuration) | -| boolean | validate(boolean arg, SchemaConfiguration configuration) | -| FrozenMap<@Nullable Object> | validate(Map<?, ?> arg, SchemaConfiguration configuration) | -| FrozenList<@Nullable Object> | validate(List arg, SchemaConfiguration configuration) | -| [EquilateralTriangle1BoxedString](#equilateraltriangle1boxedstring) | validateAndBox(String arg, SchemaConfiguration configuration) | -| [EquilateralTriangle1BoxedVoid](#equilateraltriangle1boxedvoid) | validateAndBox(Nothing? arg, SchemaConfiguration configuration) | -| [EquilateralTriangle1BoxedNumber](#equilateraltriangle1boxednumber) | validateAndBox(Number arg, SchemaConfiguration configuration) | -| [EquilateralTriangle1BoxedBoolean](#equilateraltriangle1boxedboolean) | validateAndBox(boolean arg, SchemaConfiguration configuration) | -| [EquilateralTriangle1BoxedMap](#equilateraltriangle1boxedmap) | validateAndBox(Map<?, ?> arg, SchemaConfiguration configuration) | -| [EquilateralTriangle1BoxedList](#equilateraltriangle1boxedlist) | validateAndBox(List arg, SchemaConfiguration configuration) | -| [EquilateralTriangle1Boxed](#equilateraltriangle1boxed) | validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) | -| @Nullable Object | validate(@Nullable Object arg, SchemaConfiguration configuration) | - -## Schema1Boxed -public sealed interface Schema1Boxed
-permits
-[Schema1BoxedMap](#schema1boxedmap) - -sealed interface that stores validated payloads using boxed classes - -## Schema1BoxedMap -public record Schema1BoxedMap
-implements [Schema1Boxed](#schema1boxed) - -record that stores validated Map payloads, sealed permits implementation - -### Constructor Summary -| Constructor and Description | -| --------------------------- | -| Schema1BoxedMap([Schema1Map](#schema1map) data)
Creates an instance, private visibility | - -### Method Summary -| Modifier and Type | Method and Description | -| ----------------- | ---------------------- | -| [Schema1Map](#schema1map) | data()
validated payload | -| @Nullable Object | getData()
validated payload | - -## Schema1 -public static class Schema1
-extends JsonSchema - -A schema class that validates payloads - -### Code Sample -``` -import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags; -import org.openapijsonschematools.client.configurations.SchemaConfiguration; -import org.openapijsonschematools.client.exceptions.ValidationException; -import org.openapijsonschematools.client.schemas.validation.MapUtils; -import org.openapijsonschematools.client.schemas.validation.FrozenList; -import org.openapijsonschematools.client.schemas.validation.FrozenMap; -import org.openapijsonschematools.client.components.schemas.EquilateralTriangle; - -import java.util.Arrays; -import java.util.List; -import java.util.AbstractMap; - -static final SchemaConfiguration configuration = new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().build()); - -// Map validation -EquilateralTriangle.Schema1Map validatedPayload = - EquilateralTriangle.Schema1.validate( - new EquilateralTriangle.Schema1MapBuilder() - .triangleType("EquilateralTriangle") - - .build(), - configuration -); -``` - -### Field Summary -| Modifier and Type | Field and Description | -| ----------------- | ---------------------- | -| Set> | type = Set.of(Map.class) | -| Map> | properties = Map.ofEntries(
    new PropertyEntry("triangleType", [TriangleType.class](#triangletype)))
)
| - -### Method Summary -| Modifier and Type | Method and Description | -| ----------------- | ---------------------- | -| [Schema1Map](#schema1map) | validate([Map<?, ?>](#schema1mapbuilder) arg, SchemaConfiguration configuration) | -| [Schema1BoxedMap](#schema1boxedmap) | validateAndBox([Map<?, ?>](#schema1mapbuilder) arg, SchemaConfiguration configuration) | -| [Schema1Boxed](#schema1boxed) | validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) | -| @Nullable Object | validate(@Nullable Object arg, SchemaConfiguration configuration) | - -## Schema1MapBuilder -public class Schema1MapBuilder
-builder for `Map` - -A class that builds the Map input type - -### Constructor Summary -| Constructor and Description | -| --------------------------- | -| Schema1MapBuilder()
Creates a builder that contains an empty map | - -### Method Summary -| Modifier and Type | Method and Description | -| ----------------- | ---------------------- | -| Map | build()
Returns map input that should be used with Schema.validate | -| [Schema1MapBuilder](#schema1mapbuilder) | triangleType(String value) | -| [Schema1MapBuilder](#schema1mapbuilder) | triangleType([StringTriangleTypeEnums](#stringtriangletypeenums) value) | -| [Schema1MapBuilder](#schema1mapbuilder) | additionalProperty(String key, Nothing? value) | -| [Schema1MapBuilder](#schema1mapbuilder) | additionalProperty(String key, boolean value) | -| [Schema1MapBuilder](#schema1mapbuilder) | additionalProperty(String key, String value) | -| [Schema1MapBuilder](#schema1mapbuilder) | additionalProperty(String key, int value) | -| [Schema1MapBuilder](#schema1mapbuilder) | additionalProperty(String key, float value) | -| [Schema1MapBuilder](#schema1mapbuilder) | additionalProperty(String key, long value) | -| [Schema1MapBuilder](#schema1mapbuilder) | additionalProperty(String key, double value) | -| [Schema1MapBuilder](#schema1mapbuilder) | additionalProperty(String key, List value) | -| [Schema1MapBuilder](#schema1mapbuilder) | additionalProperty(String key, Map value) | - -## Schema1Map -public static class Schema1Map
-extends FrozenMap - -A class to store validated Map payloads - -### Method Summary -| Modifier and Type | Method and Description | -| ----------------- | ---------------------- | -| static [Schema1Map](#schema1map) | of([Map](#schema1mapbuilder) arg, SchemaConfiguration configuration) | -| String | triangleType()
[optional] must be one of ["EquilateralTriangle"] | -| @Nullable Object | getAdditionalProperty(String name)
provides type safety for additional properties | - -## TriangleTypeBoxed -public sealed interface TriangleTypeBoxed
-permits
-[TriangleTypeBoxedString](#triangletypeboxedstring) - -sealed interface that stores validated payloads using boxed classes - -## TriangleTypeBoxedString -public record TriangleTypeBoxedString
-implements [TriangleTypeBoxed](#triangletypeboxed) - -record that stores validated String payloads, sealed permits implementation - -### Constructor Summary -| Constructor and Description | -| --------------------------- | -| TriangleTypeBoxedString(String data)
Creates an instance, private visibility | - -### Method Summary -| Modifier and Type | Method and Description | -| ----------------- | ---------------------- | -| String | data()
validated payload | -| @Nullable Object | getData()
validated payload | - -## TriangleType -public static class TriangleType
-extends JsonSchema - -A schema class that validates payloads - -### Code Sample -``` -import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags; -import org.openapijsonschematools.client.configurations.SchemaConfiguration; -import org.openapijsonschematools.client.exceptions.ValidationException; -import org.openapijsonschematools.client.schemas.validation.MapUtils; -import org.openapijsonschematools.client.schemas.validation.FrozenList; -import org.openapijsonschematools.client.schemas.validation.FrozenMap; -import org.openapijsonschematools.client.components.schemas.EquilateralTriangle; - -import java.util.Arrays; -import java.util.List; -import java.util.AbstractMap; - -static final SchemaConfiguration configuration = new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().build()); - -// String validation -String validatedPayload = EquilateralTriangle.TriangleType.validate( - "EquilateralTriangle", - configuration -); -``` - -### Field Summary -| Modifier and Type | Field and Description | -| ----------------- | ---------------------- | -| Set> | type = Set.of(
    String.class
)
| -| Set | enumValues = SetMaker.makeSet(
    "EquilateralTriangle"
)
| - -### Method Summary -| Modifier and Type | Method and Description | -| ----------------- | ---------------------- | -| String | validate(String arg, SchemaConfiguration configuration) | -| String | validate([StringTriangleTypeEnums](#stringtriangletypeenums) arg, SchemaConfiguration configuration) | -| [TriangleTypeBoxedString](#triangletypeboxedstring) | validateAndBox(String arg, SchemaConfiguration configuration) | -| [TriangleTypeBoxed](#triangletypeboxed) | validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) | -| @Nullable Object | validate(@Nullable Object arg, SchemaConfiguration configuration) | - -## StringTriangleTypeEnums -public enum StringTriangleTypeEnums
-extends `Enum` - -A class that stores String enum values - -### Enum Constant Summary -| Enum Constant | Description | -| ------------- | ----------- | -| EQUILATERAL_TRIANGLE | value = "EquilateralTriangle" | - -[[Back to top]](#top) [[Back to Component Schemas]](../../../README.md#Component-Schemas) [[Back to README]](../../../README.md) diff --git a/samples/client/petstore/kotlin/docs/components/schemas/File.md b/samples/client/petstore/kotlin/docs/components/schemas/File.md deleted file mode 100644 index f8126c53460..00000000000 --- a/samples/client/petstore/kotlin/docs/components/schemas/File.md +++ /dev/null @@ -1,175 +0,0 @@ -# File -org.openapijsonschematools.client.components.schemas.File.java -public class File
- -A class that contains necessary nested -- schema classes (which validate payloads), extends JsonSchema -- sealed interfaces which store validated payloads, java version of a sum type -- boxed classes which store validated payloads, sealed permits class implementations -- classes to store validated map payloads, extends FrozenMap -- classes to build inputs for map payloads - -## Nested Class Summary -| Modifier and Type | Class and Description | -| ----------------- | ---------------------- | -| sealed interface | [File.File1Boxed](#file1boxed)
sealed interface for validated payloads | -| record | [File.File1BoxedMap](#file1boxedmap)
boxed class to store validated Map payloads | -| static class | [File.File1](#file1)
schema class | -| static class | [File.FileMapBuilder](#filemapbuilder)
builder for Map payloads | -| static class | [File.FileMap](#filemap)
output class for Map payloads | -| sealed interface | [File.SourceURIBoxed](#sourceuriboxed)
sealed interface for validated payloads | -| record | [File.SourceURIBoxedString](#sourceuriboxedstring)
boxed class to store validated String payloads | -| static class | [File.SourceURI](#sourceuri)
schema class | - -## File1Boxed -public sealed interface File1Boxed
-permits
-[File1BoxedMap](#file1boxedmap) - -sealed interface that stores validated payloads using boxed classes - -## File1BoxedMap -public record File1BoxedMap
-implements [File1Boxed](#file1boxed) - -record that stores validated Map payloads, sealed permits implementation - -### Constructor Summary -| Constructor and Description | -| --------------------------- | -| File1BoxedMap([FileMap](#filemap) data)
Creates an instance, private visibility | - -### Method Summary -| Modifier and Type | Method and Description | -| ----------------- | ---------------------- | -| [FileMap](#filemap) | data()
validated payload | -| @Nullable Object | getData()
validated payload | - -## File1 -public static class File1
-extends JsonSchema - -A schema class that validates payloads - -## Description -Must be named `File` for test. - -### Code Sample -``` -import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags; -import org.openapijsonschematools.client.configurations.SchemaConfiguration; -import org.openapijsonschematools.client.exceptions.ValidationException; -import org.openapijsonschematools.client.schemas.validation.MapUtils; -import org.openapijsonschematools.client.schemas.validation.FrozenList; -import org.openapijsonschematools.client.schemas.validation.FrozenMap; -import org.openapijsonschematools.client.components.schemas.File; - -import java.util.Arrays; -import java.util.List; -import java.util.AbstractMap; - -static final SchemaConfiguration configuration = new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().build()); - -// Map validation -File.FileMap validatedPayload = - File.File1.validate( - new File.FileMapBuilder() - .sourceURI("a") - - .build(), - configuration -); -``` - -### Field Summary -| Modifier and Type | Field and Description | -| ----------------- | ---------------------- | -| Set> | type = Set.of(Map.class) | -| Map> | properties = Map.ofEntries(
    new PropertyEntry("sourceURI", [SourceURI.class](#sourceuri)))
)
| - -### Method Summary -| Modifier and Type | Method and Description | -| ----------------- | ---------------------- | -| [FileMap](#filemap) | validate([Map<?, ?>](#filemapbuilder) arg, SchemaConfiguration configuration) | -| [File1BoxedMap](#file1boxedmap) | validateAndBox([Map<?, ?>](#filemapbuilder) arg, SchemaConfiguration configuration) | -| [File1Boxed](#file1boxed) | validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) | -| @Nullable Object | validate(@Nullable Object arg, SchemaConfiguration configuration) | - -## FileMapBuilder -public class FileMapBuilder
-builder for `Map` - -A class that builds the Map input type - -### Constructor Summary -| Constructor and Description | -| --------------------------- | -| FileMapBuilder()
Creates a builder that contains an empty map | - -### Method Summary -| Modifier and Type | Method and Description | -| ----------------- | ---------------------- | -| Map | build()
Returns map input that should be used with Schema.validate | -| [FileMapBuilder](#filemapbuilder) | sourceURI(String value) | -| [FileMapBuilder](#filemapbuilder) | additionalProperty(String key, Nothing? value) | -| [FileMapBuilder](#filemapbuilder) | additionalProperty(String key, boolean value) | -| [FileMapBuilder](#filemapbuilder) | additionalProperty(String key, String value) | -| [FileMapBuilder](#filemapbuilder) | additionalProperty(String key, int value) | -| [FileMapBuilder](#filemapbuilder) | additionalProperty(String key, float value) | -| [FileMapBuilder](#filemapbuilder) | additionalProperty(String key, long value) | -| [FileMapBuilder](#filemapbuilder) | additionalProperty(String key, double value) | -| [FileMapBuilder](#filemapbuilder) | additionalProperty(String key, List value) | -| [FileMapBuilder](#filemapbuilder) | additionalProperty(String key, Map value) | - -## FileMap -public static class FileMap
-extends FrozenMap - -A class to store validated Map payloads - -### Method Summary -| Modifier and Type | Method and Description | -| ----------------- | ---------------------- | -| static [FileMap](#filemap) | of([Map](#filemapbuilder) arg, SchemaConfiguration configuration) | -| String | sourceURI()
[optional] | -| @Nullable Object | getAdditionalProperty(String name)
provides type safety for additional properties | - -## SourceURIBoxed -public sealed interface SourceURIBoxed
-permits
-[SourceURIBoxedString](#sourceuriboxedstring) - -sealed interface that stores validated payloads using boxed classes - -## SourceURIBoxedString -public record SourceURIBoxedString
-implements [SourceURIBoxed](#sourceuriboxed) - -record that stores validated String payloads, sealed permits implementation - -### Constructor Summary -| Constructor and Description | -| --------------------------- | -| SourceURIBoxedString(String data)
Creates an instance, private visibility | - -### Method Summary -| Modifier and Type | Method and Description | -| ----------------- | ---------------------- | -| String | data()
validated payload | -| @Nullable Object | getData()
validated payload | - -## SourceURI -public static class SourceURI
-extends StringJsonSchema.StringJsonSchema1 - -A schema class that validates payloads - -## Description -Test capitalization - -| Methods Inherited from class org.openapijsonschematools.client.schemas.StringJsonSchema.StringJsonSchema1 | -| ------------------------------------------------------------------ | -| validate | -| validateAndBox | - -[[Back to top]](#top) [[Back to Component Schemas]](../../../README.md#Component-Schemas) [[Back to README]](../../../README.md) diff --git a/samples/client/petstore/kotlin/docs/components/schemas/FileSchemaTestClass.md b/samples/client/petstore/kotlin/docs/components/schemas/FileSchemaTestClass.md deleted file mode 100644 index eabdba125c0..00000000000 --- a/samples/client/petstore/kotlin/docs/components/schemas/FileSchemaTestClass.md +++ /dev/null @@ -1,240 +0,0 @@ -# FileSchemaTestClass -org.openapijsonschematools.client.components.schemas.FileSchemaTestClass.java -public class FileSchemaTestClass
- -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 list payloads, extends FrozenList -- classes to build inputs for list payloads -- classes to store validated map payloads, extends FrozenMap -- classes to build inputs for map payloads - -## Nested Class Summary -| Modifier and Type | Class and Description | -| ----------------- | ---------------------- | -| sealed interface | [FileSchemaTestClass.FileSchemaTestClass1Boxed](#fileschematestclass1boxed)
sealed interface for validated payloads | -| record | [FileSchemaTestClass.FileSchemaTestClass1BoxedMap](#fileschematestclass1boxedmap)
boxed class to store validated Map payloads | -| static class | [FileSchemaTestClass.FileSchemaTestClass1](#fileschematestclass1)
schema class | -| static class | [FileSchemaTestClass.FileSchemaTestClassMapBuilder](#fileschematestclassmapbuilder)
builder for Map payloads | -| static class | [FileSchemaTestClass.FileSchemaTestClassMap](#fileschematestclassmap)
output class for Map payloads | -| sealed interface | [FileSchemaTestClass.FilesBoxed](#filesboxed)
sealed interface for validated payloads | -| record | [FileSchemaTestClass.FilesBoxedList](#filesboxedlist)
boxed class to store validated List payloads | -| static class | [FileSchemaTestClass.Files](#files)
schema class | -| static class | [FileSchemaTestClass.FilesListBuilder](#fileslistbuilder)
builder for List payloads | -| static class | [FileSchemaTestClass.FilesList](#fileslist)
output class for List payloads | - -## FileSchemaTestClass1Boxed -public sealed interface FileSchemaTestClass1Boxed
-permits
-[FileSchemaTestClass1BoxedMap](#fileschematestclass1boxedmap) - -sealed interface that stores validated payloads using boxed classes - -## FileSchemaTestClass1BoxedMap -public record FileSchemaTestClass1BoxedMap
-implements [FileSchemaTestClass1Boxed](#fileschematestclass1boxed) - -record that stores validated Map payloads, sealed permits implementation - -### Constructor Summary -| Constructor and Description | -| --------------------------- | -| FileSchemaTestClass1BoxedMap([FileSchemaTestClassMap](#fileschematestclassmap) data)
Creates an instance, private visibility | - -### Method Summary -| Modifier and Type | Method and Description | -| ----------------- | ---------------------- | -| [FileSchemaTestClassMap](#fileschematestclassmap) | data()
validated payload | -| @Nullable Object | getData()
validated payload | - -## FileSchemaTestClass1 -public static class FileSchemaTestClass1
-extends JsonSchema - -A schema class that validates payloads - -### Code Sample -``` -import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags; -import org.openapijsonschematools.client.configurations.SchemaConfiguration; -import org.openapijsonschematools.client.exceptions.ValidationException; -import org.openapijsonschematools.client.schemas.validation.MapUtils; -import org.openapijsonschematools.client.schemas.validation.FrozenList; -import org.openapijsonschematools.client.schemas.validation.FrozenMap; -import org.openapijsonschematools.client.components.schemas.FileSchemaTestClass; - -import java.util.Arrays; -import java.util.List; -import java.util.AbstractMap; - -static final SchemaConfiguration configuration = new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().build()); - -// Map validation -FileSchemaTestClass.FileSchemaTestClassMap validatedPayload = - FileSchemaTestClass.FileSchemaTestClass1.validate( - new FileSchemaTestClass.FileSchemaTestClassMapBuilder() - .files( - Arrays.asList( - ) - ) - .build(), - configuration -); -``` - -### Field Summary -| Modifier and Type | Field and Description | -| ----------------- | ---------------------- | -| Set> | type = Set.of(Map.class) | -| Map> | properties = Map.ofEntries(
    new PropertyEntry("file", [File.File1.class](../../components/schemas/File.md#file1)),
    new PropertyEntry("files", [Files.class](#files)))
)
| - -### Method Summary -| Modifier and Type | Method and Description | -| ----------------- | ---------------------- | -| [FileSchemaTestClassMap](#fileschematestclassmap) | validate([Map<?, ?>](#fileschematestclassmapbuilder) arg, SchemaConfiguration configuration) | -| [FileSchemaTestClass1BoxedMap](#fileschematestclass1boxedmap) | validateAndBox([Map<?, ?>](#fileschematestclassmapbuilder) arg, SchemaConfiguration configuration) | -| [FileSchemaTestClass1Boxed](#fileschematestclass1boxed) | validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) | -| @Nullable Object | validate(@Nullable Object arg, SchemaConfiguration configuration) | - -## FileSchemaTestClassMapBuilder -public class FileSchemaTestClassMapBuilder
-builder for `Map` - -A class that builds the Map input type - -### Constructor Summary -| Constructor and Description | -| --------------------------- | -| FileSchemaTestClassMapBuilder()
Creates a builder that contains an empty map | - -### Method Summary -| Modifier and Type | Method and Description | -| ----------------- | ---------------------- | -| Map | build()
Returns map input that should be used with Schema.validate | -| [FileSchemaTestClassMapBuilder](#fileschematestclassmapbuilder) | file(Map value) | -| [FileSchemaTestClassMapBuilder](#fileschematestclassmapbuilder) | files(List> value) | -| [FileSchemaTestClassMapBuilder](#fileschematestclassmapbuilder) | additionalProperty(String key, Nothing? value) | -| [FileSchemaTestClassMapBuilder](#fileschematestclassmapbuilder) | additionalProperty(String key, boolean value) | -| [FileSchemaTestClassMapBuilder](#fileschematestclassmapbuilder) | additionalProperty(String key, String value) | -| [FileSchemaTestClassMapBuilder](#fileschematestclassmapbuilder) | additionalProperty(String key, int value) | -| [FileSchemaTestClassMapBuilder](#fileschematestclassmapbuilder) | additionalProperty(String key, float value) | -| [FileSchemaTestClassMapBuilder](#fileschematestclassmapbuilder) | additionalProperty(String key, long value) | -| [FileSchemaTestClassMapBuilder](#fileschematestclassmapbuilder) | additionalProperty(String key, double value) | -| [FileSchemaTestClassMapBuilder](#fileschematestclassmapbuilder) | additionalProperty(String key, List value) | -| [FileSchemaTestClassMapBuilder](#fileschematestclassmapbuilder) | additionalProperty(String key, Map value) | - -## FileSchemaTestClassMap -public static class FileSchemaTestClassMap
-extends FrozenMap - -A class to store validated Map payloads - -### Method Summary -| Modifier and Type | Method and Description | -| ----------------- | ---------------------- | -| static [FileSchemaTestClassMap](#fileschematestclassmap) | of([Map](#fileschematestclassmapbuilder) arg, SchemaConfiguration configuration) | -| [File.FileMap](../../components/schemas/File.md#filemap) | file()
[optional] | -| [FilesList](#fileslist) | files()
[optional] | -| @Nullable Object | getAdditionalProperty(String name)
provides type safety for additional properties | - -## FilesBoxed -public sealed interface FilesBoxed
-permits
-[FilesBoxedList](#filesboxedlist) - -sealed interface that stores validated payloads using boxed classes - -## FilesBoxedList -public record FilesBoxedList
-implements [FilesBoxed](#filesboxed) - -record that stores validated List payloads, sealed permits implementation - -### Constructor Summary -| Constructor and Description | -| --------------------------- | -| FilesBoxedList([FilesList](#fileslist) data)
Creates an instance, private visibility | - -### Method Summary -| Modifier and Type | Method and Description | -| ----------------- | ---------------------- | -| [FilesList](#fileslist) | data()
validated payload | -| @Nullable Object | getData()
validated payload | - -## Files -public static class Files
-extends JsonSchema - -A schema class that validates payloads - -### Code Sample -``` -import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags; -import org.openapijsonschematools.client.configurations.SchemaConfiguration; -import org.openapijsonschematools.client.exceptions.ValidationException; -import org.openapijsonschematools.client.schemas.validation.MapUtils; -import org.openapijsonschematools.client.schemas.validation.FrozenList; -import org.openapijsonschematools.client.schemas.validation.FrozenMap; -import org.openapijsonschematools.client.components.schemas.FileSchemaTestClass; - -import java.util.Arrays; -import java.util.List; -import java.util.AbstractMap; - -static final SchemaConfiguration configuration = new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().build()); - -// List validation -FileSchemaTestClass.FilesList validatedPayload = - FileSchemaTestClass.Files.validate( - new FileSchemaTestClass.FilesListBuilder() - .build(), - configuration -); -``` - -### Field Summary -| Modifier and Type | Field and Description | -| ----------------- | ---------------------- | -| Set> | type = Set.of(List.class) | -| Class | items = [File.File1.class](../../components/schemas/File.md#file1) | - -### Method Summary -| Modifier and Type | Method and Description | -| ----------------- | ---------------------- | -| [FilesList](#fileslist) | validate([List](#fileslistbuilder) arg, SchemaConfiguration configuration) | -| [FilesBoxedList](#filesboxedlist) | validateAndBox([List](#fileslistbuilder) arg, SchemaConfiguration configuration) | -| [FilesBoxed](#filesboxed) | validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) | -| @Nullable Object | validate(@Nullable Object arg, SchemaConfiguration configuration) | - -## FilesListBuilder -public class FilesListBuilder
-builder for `List>` - -A class that builds the List input type - -### Constructor Summary -| Constructor and Description | -| --------------------------- | -| FilesListBuilder()
Creates an empty list | -| FilesListBuilder(List> items)
Stores the items in a list | - -### Method Summary -| Modifier and Type | Method and Description | -| ----------------- | ---------------------- | -| FilesListBuilder | add(Map item) | -| List> | build()
Returns list input that should be used with Schema.validate | - -## FilesList -public class FilesList
-extends `FrozenList` - -A class to store validated List payloads - -### Method Summary -| Modifier and Type | Method and Description | -| ----------------- | ---------------------- | -| static [FilesList](#fileslist) | of([List>](#fileslistbuilder) arg, SchemaConfiguration configuration) | - -[[Back to top]](#top) [[Back to Component Schemas]](../../../README.md#Component-Schemas) [[Back to README]](../../../README.md) diff --git a/samples/client/petstore/kotlin/docs/components/schemas/Foo.md b/samples/client/petstore/kotlin/docs/components/schemas/Foo.md deleted file mode 100644 index 4bedecdb95d..00000000000 --- a/samples/client/petstore/kotlin/docs/components/schemas/Foo.md +++ /dev/null @@ -1,129 +0,0 @@ -# Foo -org.openapijsonschematools.client.components.schemas.Foo.java -public class Foo
- -A class that contains necessary nested -- schema classes (which validate payloads), extends JsonSchema -- sealed interfaces which store validated payloads, java version of a sum type -- boxed classes which store validated payloads, sealed permits class implementations -- classes to store validated map payloads, extends FrozenMap -- classes to build inputs for map payloads - -## Nested Class Summary -| Modifier and Type | Class and Description | -| ----------------- | ---------------------- | -| sealed interface | [Foo.Foo1Boxed](#foo1boxed)
sealed interface for validated payloads | -| record | [Foo.Foo1BoxedMap](#foo1boxedmap)
boxed class to store validated Map payloads | -| static class | [Foo.Foo1](#foo1)
schema class | -| static class | [Foo.FooMapBuilder](#foomapbuilder)
builder for Map payloads | -| static class | [Foo.FooMap](#foomap)
output class for Map payloads | - -## Foo1Boxed -public sealed interface Foo1Boxed
-permits
-[Foo1BoxedMap](#foo1boxedmap) - -sealed interface that stores validated payloads using boxed classes - -## Foo1BoxedMap -public record Foo1BoxedMap
-implements [Foo1Boxed](#foo1boxed) - -record that stores validated Map payloads, sealed permits implementation - -### Constructor Summary -| Constructor and Description | -| --------------------------- | -| Foo1BoxedMap([FooMap](#foomap) data)
Creates an instance, private visibility | - -### Method Summary -| Modifier and Type | Method and Description | -| ----------------- | ---------------------- | -| [FooMap](#foomap) | data()
validated payload | -| @Nullable Object | getData()
validated payload | - -## Foo1 -public static class Foo1
-extends JsonSchema - -A schema class that validates payloads - -### Code Sample -``` -import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags; -import org.openapijsonschematools.client.configurations.SchemaConfiguration; -import org.openapijsonschematools.client.exceptions.ValidationException; -import org.openapijsonschematools.client.schemas.validation.MapUtils; -import org.openapijsonschematools.client.schemas.validation.FrozenList; -import org.openapijsonschematools.client.schemas.validation.FrozenMap; -import org.openapijsonschematools.client.components.schemas.Foo; - -import java.util.Arrays; -import java.util.List; -import java.util.AbstractMap; - -static final SchemaConfiguration configuration = new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().build()); - -// Map validation -Foo.FooMap validatedPayload = - Foo.Foo1.validate( - new Foo.FooMapBuilder() - .build(), - configuration -); -``` - -### Field Summary -| Modifier and Type | Field and Description | -| ----------------- | ---------------------- | -| Set> | type = Set.of(Map.class) | -| Map> | properties = Map.ofEntries(
    new PropertyEntry("bar", [Bar.Bar1.class](../../components/schemas/Bar.md#bar1))
)
| - -### Method Summary -| Modifier and Type | Method and Description | -| ----------------- | ---------------------- | -| [FooMap](#foomap) | validate([Map<?, ?>](#foomapbuilder) arg, SchemaConfiguration configuration) | -| [Foo1BoxedMap](#foo1boxedmap) | validateAndBox([Map<?, ?>](#foomapbuilder) arg, SchemaConfiguration configuration) | -| [Foo1Boxed](#foo1boxed) | validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) | -| @Nullable Object | validate(@Nullable Object arg, SchemaConfiguration configuration) | - -## FooMapBuilder -public class FooMapBuilder
-builder for `Map` - -A class that builds the Map input type - -### Constructor Summary -| Constructor and Description | -| --------------------------- | -| FooMapBuilder()
Creates a builder that contains an empty map | - -### Method Summary -| Modifier and Type | Method and Description | -| ----------------- | ---------------------- | -| Map | build()
Returns map input that should be used with Schema.validate | -| [FooMapBuilder](#foomapbuilder) | bar(String value) | -| [FooMapBuilder](#foomapbuilder) | additionalProperty(String key, Nothing? value) | -| [FooMapBuilder](#foomapbuilder) | additionalProperty(String key, boolean value) | -| [FooMapBuilder](#foomapbuilder) | additionalProperty(String key, String value) | -| [FooMapBuilder](#foomapbuilder) | additionalProperty(String key, int value) | -| [FooMapBuilder](#foomapbuilder) | additionalProperty(String key, float value) | -| [FooMapBuilder](#foomapbuilder) | additionalProperty(String key, long value) | -| [FooMapBuilder](#foomapbuilder) | additionalProperty(String key, double value) | -| [FooMapBuilder](#foomapbuilder) | additionalProperty(String key, List value) | -| [FooMapBuilder](#foomapbuilder) | additionalProperty(String key, Map value) | - -## FooMap -public static class FooMap
-extends FrozenMap - -A class to store validated Map payloads - -### Method Summary -| Modifier and Type | Method and Description | -| ----------------- | ---------------------- | -| static [FooMap](#foomap) | of([Map](#foomapbuilder) arg, SchemaConfiguration configuration) | -| String | bar()
[optional] | -| @Nullable Object | getAdditionalProperty(String name)
provides type safety for additional properties | - -[[Back to top]](#top) [[Back to Component Schemas]](../../../README.md#Component-Schemas) [[Back to README]](../../../README.md) diff --git a/samples/client/petstore/kotlin/docs/components/schemas/FormatTest.md b/samples/client/petstore/kotlin/docs/components/schemas/FormatTest.md deleted file mode 100644 index 78dee00ba4b..00000000000 --- a/samples/client/petstore/kotlin/docs/components/schemas/FormatTest.md +++ /dev/null @@ -1,1696 +0,0 @@ -# FormatTest -org.openapijsonschematools.client.components.schemas.FormatTest.java -public class FormatTest
- -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 list payloads, extends FrozenList -- classes to build inputs for list payloads -- classes to store validated map payloads, extends FrozenMap -- classes to build inputs for map payloads - -## Nested Class Summary -| Modifier and Type | Class and Description | -| ----------------- | ---------------------- | -| sealed interface | [FormatTest.FormatTest1Boxed](#formattest1boxed)
sealed interface for validated payloads | -| record | [FormatTest.FormatTest1BoxedMap](#formattest1boxedmap)
boxed class to store validated Map payloads | -| static class | [FormatTest.FormatTest1](#formattest1)
schema class | -| static class | [FormatTest.FormatTestMapBuilder](#formattestmapbuilder)
builder for Map payloads | -| static class | [FormatTest.FormatTestMap](#formattestmap)
output class for Map payloads | -| sealed interface | [FormatTest.NonePropBoxed](#nonepropboxed)
sealed interface for validated payloads | -| record | [FormatTest.NonePropBoxedVoid](#nonepropboxedvoid)
boxed class to store validated null payloads | -| static class | [FormatTest.NoneProp](#noneprop)
schema class | -| sealed interface | [FormatTest.PatternWithDigitsAndDelimiterBoxed](#patternwithdigitsanddelimiterboxed)
sealed interface for validated payloads | -| record | [FormatTest.PatternWithDigitsAndDelimiterBoxedString](#patternwithdigitsanddelimiterboxedstring)
boxed class to store validated String payloads | -| static class | [FormatTest.PatternWithDigitsAndDelimiter](#patternwithdigitsanddelimiter)
schema class | -| sealed interface | [FormatTest.PatternWithDigitsBoxed](#patternwithdigitsboxed)
sealed interface for validated payloads | -| record | [FormatTest.PatternWithDigitsBoxedString](#patternwithdigitsboxedstring)
boxed class to store validated String payloads | -| static class | [FormatTest.PatternWithDigits](#patternwithdigits)
schema class | -| sealed interface | [FormatTest.PasswordBoxed](#passwordboxed)
sealed interface for validated payloads | -| record | [FormatTest.PasswordBoxedString](#passwordboxedstring)
boxed class to store validated String payloads | -| static class | [FormatTest.Password](#password)
schema class | -| sealed interface | [FormatTest.UuidNoExampleBoxed](#uuidnoexampleboxed)
sealed interface for validated payloads | -| record | [FormatTest.UuidNoExampleBoxedString](#uuidnoexampleboxedstring)
boxed class to store validated String payloads | -| static class | [FormatTest.UuidNoExample](#uuidnoexample)
schema class | -| sealed interface | [FormatTest.UuidSchemaBoxed](#uuidschemaboxed)
sealed interface for validated payloads | -| record | [FormatTest.UuidSchemaBoxedString](#uuidschemaboxedstring)
boxed class to store validated String payloads | -| static class | [FormatTest.UuidSchema](#uuidschema)
schema class | -| sealed interface | [FormatTest.DateTimeBoxed](#datetimeboxed)
sealed interface for validated payloads | -| record | [FormatTest.DateTimeBoxedString](#datetimeboxedstring)
boxed class to store validated String payloads | -| static class | [FormatTest.DateTime](#datetime)
schema class | -| sealed interface | [FormatTest.DateBoxed](#dateboxed)
sealed interface for validated payloads | -| record | [FormatTest.DateBoxedString](#dateboxedstring)
boxed class to store validated String payloads | -| static class | [FormatTest.Date](#date)
schema class | -| sealed interface | [FormatTest.BinaryBoxed](#binaryboxed)
sealed interface for validated payloads | -| static class | [FormatTest.Binary](#binary)
schema class | -| sealed interface | [FormatTest.ByteSchemaBoxed](#byteschemaboxed)
sealed interface for validated payloads | -| record | [FormatTest.ByteSchemaBoxedString](#byteschemaboxedstring)
boxed class to store validated String payloads | -| static class | [FormatTest.ByteSchema](#byteschema)
schema class | -| sealed interface | [FormatTest.StringSchemaBoxed](#stringschemaboxed)
sealed interface for validated payloads | -| record | [FormatTest.StringSchemaBoxedString](#stringschemaboxedstring)
boxed class to store validated String payloads | -| static class | [FormatTest.StringSchema](#stringschema)
schema class | -| sealed interface | [FormatTest.ArrayWithUniqueItemsBoxed](#arraywithuniqueitemsboxed)
sealed interface for validated payloads | -| record | [FormatTest.ArrayWithUniqueItemsBoxedList](#arraywithuniqueitemsboxedlist)
boxed class to store validated List payloads | -| static class | [FormatTest.ArrayWithUniqueItems](#arraywithuniqueitems)
schema class | -| static class | [FormatTest.ArrayWithUniqueItemsListBuilder](#arraywithuniqueitemslistbuilder)
builder for List payloads | -| static class | [FormatTest.ArrayWithUniqueItemsList](#arraywithuniqueitemslist)
output class for List payloads | -| sealed interface | [FormatTest.ItemsBoxed](#itemsboxed)
sealed interface for validated payloads | -| record | [FormatTest.ItemsBoxedNumber](#itemsboxednumber)
boxed class to store validated Number payloads | -| static class | [FormatTest.Items](#items)
schema class | -| sealed interface | [FormatTest.Float64Boxed](#float64boxed)
sealed interface for validated payloads | -| record | [FormatTest.Float64BoxedNumber](#float64boxednumber)
boxed class to store validated Number payloads | -| static class | [FormatTest.Float64](#float64)
schema class | -| sealed interface | [FormatTest.DoubleSchemaBoxed](#doubleschemaboxed)
sealed interface for validated payloads | -| record | [FormatTest.DoubleSchemaBoxedNumber](#doubleschemaboxednumber)
boxed class to store validated Number payloads | -| static class | [FormatTest.DoubleSchema](#doubleschema)
schema class | -| sealed interface | [FormatTest.Float32Boxed](#float32boxed)
sealed interface for validated payloads | -| record | [FormatTest.Float32BoxedNumber](#float32boxednumber)
boxed class to store validated Number payloads | -| static class | [FormatTest.Float32](#float32)
schema class | -| sealed interface | [FormatTest.FloatSchemaBoxed](#floatschemaboxed)
sealed interface for validated payloads | -| record | [FormatTest.FloatSchemaBoxedNumber](#floatschemaboxednumber)
boxed class to store validated Number payloads | -| static class | [FormatTest.FloatSchema](#floatschema)
schema class | -| sealed interface | [FormatTest.NumberSchemaBoxed](#numberschemaboxed)
sealed interface for validated payloads | -| record | [FormatTest.NumberSchemaBoxedNumber](#numberschemaboxednumber)
boxed class to store validated Number payloads | -| static class | [FormatTest.NumberSchema](#numberschema)
schema class | -| sealed interface | [FormatTest.Int64Boxed](#int64boxed)
sealed interface for validated payloads | -| record | [FormatTest.Int64BoxedNumber](#int64boxednumber)
boxed class to store validated Number payloads | -| static class | [FormatTest.Int64](#int64)
schema class | -| sealed interface | [FormatTest.Int32withValidationsBoxed](#int32withvalidationsboxed)
sealed interface for validated payloads | -| record | [FormatTest.Int32withValidationsBoxedNumber](#int32withvalidationsboxednumber)
boxed class to store validated Number payloads | -| static class | [FormatTest.Int32withValidations](#int32withvalidations)
schema class | -| sealed interface | [FormatTest.Int32Boxed](#int32boxed)
sealed interface for validated payloads | -| record | [FormatTest.Int32BoxedNumber](#int32boxednumber)
boxed class to store validated Number payloads | -| static class | [FormatTest.Int32](#int32)
schema class | -| sealed interface | [FormatTest.IntegerSchemaBoxed](#integerschemaboxed)
sealed interface for validated payloads | -| record | [FormatTest.IntegerSchemaBoxedNumber](#integerschemaboxednumber)
boxed class to store validated Number payloads | -| static class | [FormatTest.IntegerSchema](#integerschema)
schema class | - -## FormatTest1Boxed -public sealed interface FormatTest1Boxed
-permits
-[FormatTest1BoxedMap](#formattest1boxedmap) - -sealed interface that stores validated payloads using boxed classes - -## FormatTest1BoxedMap -public record FormatTest1BoxedMap
-implements [FormatTest1Boxed](#formattest1boxed) - -record that stores validated Map payloads, sealed permits implementation - -### Constructor Summary -| Constructor and Description | -| --------------------------- | -| FormatTest1BoxedMap([FormatTestMap](#formattestmap) data)
Creates an instance, private visibility | - -### Method Summary -| Modifier and Type | Method and Description | -| ----------------- | ---------------------- | -| [FormatTestMap](#formattestmap) | data()
validated payload | -| @Nullable Object | getData()
validated payload | - -## FormatTest1 -public static class FormatTest1
-extends JsonSchema - -A schema class that validates payloads - -### Code Sample -``` -import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags; -import org.openapijsonschematools.client.configurations.SchemaConfiguration; -import org.openapijsonschematools.client.exceptions.ValidationException; -import org.openapijsonschematools.client.schemas.validation.MapUtils; -import org.openapijsonschematools.client.schemas.validation.FrozenList; -import org.openapijsonschematools.client.schemas.validation.FrozenMap; -import org.openapijsonschematools.client.components.schemas.FormatTest; - -import java.util.Arrays; -import java.util.List; -import java.util.AbstractMap; - -static final SchemaConfiguration configuration = new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().build()); - -// Map validation -FormatTest.FormatTestMap validatedPayload = - FormatTest.FormatTest1.validate( - new FormatTest.FormatTestMapBuilder() - .setByte("a") - - .date("2020-12-13") - - .setNumber(1) - - .password("a") - - .setInteger(1) - - .int32(1) - - .int32withValidations(1) - - .int64(1L) - - .setFloat(3.14f) - - .float32(3.14f) - - .setDouble(3.14d) - - .float64(3.14d) - - .arrayWithUniqueItems( - Arrays.asList( - 1 - ) - ) - .setString("A") - - .binary("a") - - .dateTime("1970-01-01T00:00:00.00Z") - - .setUuid("046b6c7f-0b8a-43b9-b35d-6489e6daee91") - - .uuidNoExample("046b6c7f-0b8a-43b9-b35d-6489e6daee91") - - .pattern_with_digits("0480728880") - - .pattern_with_digits_and_delimiter("IMage_88") - - .noneProp(null) - - .build(), - configuration -); -``` - -### Field Summary -| Modifier and Type | Field and Description | -| ----------------- | ---------------------- | -| Set> | type = Set.of(Map.class) | -| Map> | properties = Map.ofEntries(
    new PropertyEntry("integer", [IntegerSchema.class](#integerschema))),
    new PropertyEntry("int32", [Int32.class](#int32))),
    new PropertyEntry("int32withValidations", [Int32withValidations.class](#int32withvalidations))),
    new PropertyEntry("int64", [Int64.class](#int64))),
    new PropertyEntry("number", [NumberSchema.class](#numberschema))),
    new PropertyEntry("float", [FloatSchema.class](#floatschema))),
    new PropertyEntry("float32", [Float32.class](#float32))),
    new PropertyEntry("double", [DoubleSchema.class](#doubleschema))),
    new PropertyEntry("float64", [Float64.class](#float64))),
    new PropertyEntry("arrayWithUniqueItems", [ArrayWithUniqueItems.class](#arraywithuniqueitems))),
    new PropertyEntry("string", [StringSchema.class](#stringschema))),
    new PropertyEntry("byte", [ByteSchema.class](#byteschema))),
    new PropertyEntry("binary", [Binary.class](#binary))),
    new PropertyEntry("date", [Date.class](#date))),
    new PropertyEntry("dateTime", [DateTime.class](#datetime))),
    new PropertyEntry("uuid", [UuidSchema.class](#uuidschema))),
    new PropertyEntry("uuidNoExample", [UuidNoExample.class](#uuidnoexample))),
    new PropertyEntry("password", [Password.class](#password))),
    new PropertyEntry("pattern_with_digits", [PatternWithDigits.class](#patternwithdigits))),
    new PropertyEntry("pattern_with_digits_and_delimiter", [PatternWithDigitsAndDelimiter.class](#patternwithdigitsanddelimiter))),
    new PropertyEntry("noneProp", [NoneProp.class](#noneprop)))
)
| -| Set | required = Set.of(
    "byte",
    "date",
    "number",
    "password"
)
| - -### Method Summary -| Modifier and Type | Method and Description | -| ----------------- | ---------------------- | -| [FormatTestMap](#formattestmap) | validate([Map<?, ?>](#formattestmapbuilder) arg, SchemaConfiguration configuration) | -| [FormatTest1BoxedMap](#formattest1boxedmap) | validateAndBox([Map<?, ?>](#formattestmapbuilder) arg, SchemaConfiguration configuration) | -| [FormatTest1Boxed](#formattest1boxed) | validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) | -| @Nullable Object | validate(@Nullable Object arg, SchemaConfiguration configuration) | - -## FormatTestMap0000Builder -public class FormatTestMap0000Builder
-builder for `Map` - -A class that builds the Map input type - -### Constructor Summary -| Constructor and Description | -| --------------------------- | -| FormatTestMap0000Builder(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 | -| [FormatTestMap0000Builder](#formattestmap0000builder) | setInteger(int value) | -| [FormatTestMap0000Builder](#formattestmap0000builder) | setInteger(float value) | -| [FormatTestMap0000Builder](#formattestmap0000builder) | setInteger(long value) | -| [FormatTestMap0000Builder](#formattestmap0000builder) | setInteger(double value) | -| [FormatTestMap0000Builder](#formattestmap0000builder) | int32(int value) | -| [FormatTestMap0000Builder](#formattestmap0000builder) | int32(float value) | -| [FormatTestMap0000Builder](#formattestmap0000builder) | int32withValidations(int value) | -| [FormatTestMap0000Builder](#formattestmap0000builder) | int32withValidations(float value) | -| [FormatTestMap0000Builder](#formattestmap0000builder) | int64(int value) | -| [FormatTestMap0000Builder](#formattestmap0000builder) | int64(float value) | -| [FormatTestMap0000Builder](#formattestmap0000builder) | int64(long value) | -| [FormatTestMap0000Builder](#formattestmap0000builder) | int64(double value) | -| [FormatTestMap0000Builder](#formattestmap0000builder) | setFloat(int value) | -| [FormatTestMap0000Builder](#formattestmap0000builder) | setFloat(float value) | -| [FormatTestMap0000Builder](#formattestmap0000builder) | setFloat(long value) | -| [FormatTestMap0000Builder](#formattestmap0000builder) | setFloat(double value) | -| [FormatTestMap0000Builder](#formattestmap0000builder) | float32(int value) | -| [FormatTestMap0000Builder](#formattestmap0000builder) | float32(float value) | -| [FormatTestMap0000Builder](#formattestmap0000builder) | float32(long value) | -| [FormatTestMap0000Builder](#formattestmap0000builder) | float32(double value) | -| [FormatTestMap0000Builder](#formattestmap0000builder) | setDouble(int value) | -| [FormatTestMap0000Builder](#formattestmap0000builder) | setDouble(float value) | -| [FormatTestMap0000Builder](#formattestmap0000builder) | setDouble(long value) | -| [FormatTestMap0000Builder](#formattestmap0000builder) | setDouble(double value) | -| [FormatTestMap0000Builder](#formattestmap0000builder) | float64(int value) | -| [FormatTestMap0000Builder](#formattestmap0000builder) | float64(float value) | -| [FormatTestMap0000Builder](#formattestmap0000builder) | float64(long value) | -| [FormatTestMap0000Builder](#formattestmap0000builder) | float64(double value) | -| [FormatTestMap0000Builder](#formattestmap0000builder) | arrayWithUniqueItems(List value) | -| [FormatTestMap0000Builder](#formattestmap0000builder) | setString(String value) | -| [FormatTestMap0000Builder](#formattestmap0000builder) | binary(String value) | -| [FormatTestMap0000Builder](#formattestmap0000builder) | dateTime(String value) | -| [FormatTestMap0000Builder](#formattestmap0000builder) | setUuid(String value) | -| [FormatTestMap0000Builder](#formattestmap0000builder) | uuidNoExample(String value) | -| [FormatTestMap0000Builder](#formattestmap0000builder) | pattern_with_digits(String value) | -| [FormatTestMap0000Builder](#formattestmap0000builder) | pattern_with_digits_and_delimiter(String value) | -| [FormatTestMap0000Builder](#formattestmap0000builder) | noneProp(Nothing? value) | -| [FormatTestMap0000Builder](#formattestmap0000builder) | additionalProperty(String key, Nothing? value) | -| [FormatTestMap0000Builder](#formattestmap0000builder) | additionalProperty(String key, boolean value) | -| [FormatTestMap0000Builder](#formattestmap0000builder) | additionalProperty(String key, String value) | -| [FormatTestMap0000Builder](#formattestmap0000builder) | additionalProperty(String key, int value) | -| [FormatTestMap0000Builder](#formattestmap0000builder) | additionalProperty(String key, float value) | -| [FormatTestMap0000Builder](#formattestmap0000builder) | additionalProperty(String key, long value) | -| [FormatTestMap0000Builder](#formattestmap0000builder) | additionalProperty(String key, double value) | -| [FormatTestMap0000Builder](#formattestmap0000builder) | additionalProperty(String key, List value) | -| [FormatTestMap0000Builder](#formattestmap0000builder) | additionalProperty(String key, Map value) | - -## FormatTestMap0001Builder -public class FormatTestMap0001Builder
-builder for `Map` - -A class that builds the Map input type - -### Constructor Summary -| Constructor and Description | -| --------------------------- | -| FormatTestMap0001Builder(Map instance)
Creates a builder that contains the passed instance | - -### Method Summary -| Modifier and Type | Method and Description | -| ----------------- | ---------------------- | -| [FormatTestMap0000Builder](#formattestmap0000builder) | password(String value) | - -## FormatTestMap0010Builder -public class FormatTestMap0010Builder
-builder for `Map` - -A class that builds the Map input type - -### Constructor Summary -| Constructor and Description | -| --------------------------- | -| FormatTestMap0010Builder(Map instance)
Creates a builder that contains the passed instance | - -### Method Summary -| Modifier and Type | Method and Description | -| ----------------- | ---------------------- | -| [FormatTestMap0000Builder](#formattestmap0000builder) | setNumber(int value) | -| [FormatTestMap0000Builder](#formattestmap0000builder) | setNumber(float value) | -| [FormatTestMap0000Builder](#formattestmap0000builder) | setNumber(long value) | -| [FormatTestMap0000Builder](#formattestmap0000builder) | setNumber(double value) | - -## FormatTestMap0011Builder -public class FormatTestMap0011Builder
-builder for `Map` - -A class that builds the Map input type - -### Constructor Summary -| Constructor and Description | -| --------------------------- | -| FormatTestMap0011Builder(Map instance)
Creates a builder that contains the passed instance | - -### Method Summary -| Modifier and Type | Method and Description | -| ----------------- | ---------------------- | -| [FormatTestMap0001Builder](#formattestmap0001builder) | setNumber(int value) | -| [FormatTestMap0001Builder](#formattestmap0001builder) | setNumber(float value) | -| [FormatTestMap0001Builder](#formattestmap0001builder) | setNumber(long value) | -| [FormatTestMap0001Builder](#formattestmap0001builder) | setNumber(double value) | -| [FormatTestMap0010Builder](#formattestmap0010builder) | password(String value) | - -## FormatTestMap0100Builder -public class FormatTestMap0100Builder
-builder for `Map` - -A class that builds the Map input type - -### Constructor Summary -| Constructor and Description | -| --------------------------- | -| FormatTestMap0100Builder(Map instance)
Creates a builder that contains the passed instance | - -### Method Summary -| Modifier and Type | Method and Description | -| ----------------- | ---------------------- | -| [FormatTestMap0000Builder](#formattestmap0000builder) | date(String value) | - -## FormatTestMap0101Builder -public class FormatTestMap0101Builder
-builder for `Map` - -A class that builds the Map input type - -### Constructor Summary -| Constructor and Description | -| --------------------------- | -| FormatTestMap0101Builder(Map instance)
Creates a builder that contains the passed instance | - -### Method Summary -| Modifier and Type | Method and Description | -| ----------------- | ---------------------- | -| [FormatTestMap0001Builder](#formattestmap0001builder) | date(String value) | -| [FormatTestMap0100Builder](#formattestmap0100builder) | password(String value) | - -## FormatTestMap0110Builder -public class FormatTestMap0110Builder
-builder for `Map` - -A class that builds the Map input type - -### Constructor Summary -| Constructor and Description | -| --------------------------- | -| FormatTestMap0110Builder(Map instance)
Creates a builder that contains the passed instance | - -### Method Summary -| Modifier and Type | Method and Description | -| ----------------- | ---------------------- | -| [FormatTestMap0010Builder](#formattestmap0010builder) | date(String value) | -| [FormatTestMap0100Builder](#formattestmap0100builder) | setNumber(int value) | -| [FormatTestMap0100Builder](#formattestmap0100builder) | setNumber(float value) | -| [FormatTestMap0100Builder](#formattestmap0100builder) | setNumber(long value) | -| [FormatTestMap0100Builder](#formattestmap0100builder) | setNumber(double value) | - -## FormatTestMap0111Builder -public class FormatTestMap0111Builder
-builder for `Map` - -A class that builds the Map input type - -### Constructor Summary -| Constructor and Description | -| --------------------------- | -| FormatTestMap0111Builder(Map instance)
Creates a builder that contains the passed instance | - -### Method Summary -| Modifier and Type | Method and Description | -| ----------------- | ---------------------- | -| [FormatTestMap0011Builder](#formattestmap0011builder) | date(String value) | -| [FormatTestMap0101Builder](#formattestmap0101builder) | setNumber(int value) | -| [FormatTestMap0101Builder](#formattestmap0101builder) | setNumber(float value) | -| [FormatTestMap0101Builder](#formattestmap0101builder) | setNumber(long value) | -| [FormatTestMap0101Builder](#formattestmap0101builder) | setNumber(double value) | -| [FormatTestMap0110Builder](#formattestmap0110builder) | password(String value) | - -## FormatTestMap1000Builder -public class FormatTestMap1000Builder
-builder for `Map` - -A class that builds the Map input type - -### Constructor Summary -| Constructor and Description | -| --------------------------- | -| FormatTestMap1000Builder(Map instance)
Creates a builder that contains the passed instance | - -### Method Summary -| Modifier and Type | Method and Description | -| ----------------- | ---------------------- | -| [FormatTestMap0000Builder](#formattestmap0000builder) | setByte(String value) | - -## FormatTestMap1001Builder -public class FormatTestMap1001Builder
-builder for `Map` - -A class that builds the Map input type - -### Constructor Summary -| Constructor and Description | -| --------------------------- | -| FormatTestMap1001Builder(Map instance)
Creates a builder that contains the passed instance | - -### Method Summary -| Modifier and Type | Method and Description | -| ----------------- | ---------------------- | -| [FormatTestMap0001Builder](#formattestmap0001builder) | setByte(String value) | -| [FormatTestMap1000Builder](#formattestmap1000builder) | password(String value) | - -## FormatTestMap1010Builder -public class FormatTestMap1010Builder
-builder for `Map` - -A class that builds the Map input type - -### Constructor Summary -| Constructor and Description | -| --------------------------- | -| FormatTestMap1010Builder(Map instance)
Creates a builder that contains the passed instance | - -### Method Summary -| Modifier and Type | Method and Description | -| ----------------- | ---------------------- | -| [FormatTestMap0010Builder](#formattestmap0010builder) | setByte(String value) | -| [FormatTestMap1000Builder](#formattestmap1000builder) | setNumber(int value) | -| [FormatTestMap1000Builder](#formattestmap1000builder) | setNumber(float value) | -| [FormatTestMap1000Builder](#formattestmap1000builder) | setNumber(long value) | -| [FormatTestMap1000Builder](#formattestmap1000builder) | setNumber(double value) | - -## FormatTestMap1011Builder -public class FormatTestMap1011Builder
-builder for `Map` - -A class that builds the Map input type - -### Constructor Summary -| Constructor and Description | -| --------------------------- | -| FormatTestMap1011Builder(Map instance)
Creates a builder that contains the passed instance | - -### Method Summary -| Modifier and Type | Method and Description | -| ----------------- | ---------------------- | -| [FormatTestMap0011Builder](#formattestmap0011builder) | setByte(String value) | -| [FormatTestMap1001Builder](#formattestmap1001builder) | setNumber(int value) | -| [FormatTestMap1001Builder](#formattestmap1001builder) | setNumber(float value) | -| [FormatTestMap1001Builder](#formattestmap1001builder) | setNumber(long value) | -| [FormatTestMap1001Builder](#formattestmap1001builder) | setNumber(double value) | -| [FormatTestMap1010Builder](#formattestmap1010builder) | password(String value) | - -## FormatTestMap1100Builder -public class FormatTestMap1100Builder
-builder for `Map` - -A class that builds the Map input type - -### Constructor Summary -| Constructor and Description | -| --------------------------- | -| FormatTestMap1100Builder(Map instance)
Creates a builder that contains the passed instance | - -### Method Summary -| Modifier and Type | Method and Description | -| ----------------- | ---------------------- | -| [FormatTestMap0100Builder](#formattestmap0100builder) | setByte(String value) | -| [FormatTestMap1000Builder](#formattestmap1000builder) | date(String value) | - -## FormatTestMap1101Builder -public class FormatTestMap1101Builder
-builder for `Map` - -A class that builds the Map input type - -### Constructor Summary -| Constructor and Description | -| --------------------------- | -| FormatTestMap1101Builder(Map instance)
Creates a builder that contains the passed instance | - -### Method Summary -| Modifier and Type | Method and Description | -| ----------------- | ---------------------- | -| [FormatTestMap0101Builder](#formattestmap0101builder) | setByte(String value) | -| [FormatTestMap1001Builder](#formattestmap1001builder) | date(String value) | -| [FormatTestMap1100Builder](#formattestmap1100builder) | password(String value) | - -## FormatTestMap1110Builder -public class FormatTestMap1110Builder
-builder for `Map` - -A class that builds the Map input type - -### Constructor Summary -| Constructor and Description | -| --------------------------- | -| FormatTestMap1110Builder(Map instance)
Creates a builder that contains the passed instance | - -### Method Summary -| Modifier and Type | Method and Description | -| ----------------- | ---------------------- | -| [FormatTestMap0110Builder](#formattestmap0110builder) | setByte(String value) | -| [FormatTestMap1010Builder](#formattestmap1010builder) | date(String value) | -| [FormatTestMap1100Builder](#formattestmap1100builder) | setNumber(int value) | -| [FormatTestMap1100Builder](#formattestmap1100builder) | setNumber(float value) | -| [FormatTestMap1100Builder](#formattestmap1100builder) | setNumber(long value) | -| [FormatTestMap1100Builder](#formattestmap1100builder) | setNumber(double value) | - -## FormatTestMapBuilder -public class FormatTestMapBuilder
-builder for `Map` - -A class that builds the Map input type - -### Constructor Summary -| Constructor and Description | -| --------------------------- | -| FormatTestMapBuilder()
Creates a builder that contains an empty map | - -### Method Summary -| Modifier and Type | Method and Description | -| ----------------- | ---------------------- | -| [FormatTestMap0111Builder](#formattestmap0111builder) | setByte(String value) | -| [FormatTestMap1011Builder](#formattestmap1011builder) | date(String value) | -| [FormatTestMap1101Builder](#formattestmap1101builder) | setNumber(int value) | -| [FormatTestMap1101Builder](#formattestmap1101builder) | setNumber(float value) | -| [FormatTestMap1101Builder](#formattestmap1101builder) | setNumber(long value) | -| [FormatTestMap1101Builder](#formattestmap1101builder) | setNumber(double value) | -| [FormatTestMap1110Builder](#formattestmap1110builder) | password(String value) | - -## FormatTestMap -public static class FormatTestMap
-extends FrozenMap - -A class to store validated Map payloads - -### Method Summary -| Modifier and Type | Method and Description | -| ----------------- | ---------------------- | -| static [FormatTestMap](#formattestmap) | of([Map](#formattestmapbuilder) arg, SchemaConfiguration configuration) | -| String | date()
value must conform to RFC-3339 full-date YYYY-MM-DD | -| String | password()
| -| Number | int32()
[optional] value must be a 32 bit integer | -| Number | int32withValidations()
[optional] value must be a 32 bit integer | -| Number | int64()
[optional] value must be a 64 bit integer | -| Number | float32()
[optional] value must be a 32 bit float | -| Number | float64()
[optional] value must be a 64 bit float | -| [ArrayWithUniqueItemsList](#arraywithuniqueitemslist) | arrayWithUniqueItems()
[optional] | -| String | binary()
[optional] | -| String | dateTime()
[optional] value must conform to RFC-3339 date-time | -| String | uuidNoExample()
[optional] value must be a uuid | -| String | pattern_with_digits()
[optional] | -| String | pattern_with_digits_and_delimiter()
[optional] | -| Nothing? | noneProp()
[optional] | -| @Nullable Object | get(String key)
This schema has invalid Java names so this method must be used when you access instance["byte"], instance["number"], instance["integer"], instance["float"], instance["double"], instance["string"], instance["uuid"], | -| @Nullable Object | getAdditionalProperty(String name)
provides type safety for additional properties | - -## NonePropBoxed -public sealed interface NonePropBoxed
-permits
-[NonePropBoxedVoid](#nonepropboxedvoid) - -sealed interface that stores validated payloads using boxed classes - -## NonePropBoxedVoid -public record NonePropBoxedVoid
-implements [NonePropBoxed](#nonepropboxed) - -record that stores validated null payloads, sealed permits implementation - -### Constructor Summary -| Constructor and Description | -| --------------------------- | -| NonePropBoxedVoid(Nothing? data)
Creates an instance, private visibility | - -### Method Summary -| Modifier and Type | Method and Description | -| ----------------- | ---------------------- | -| Nothing? | data()
validated payload | -| @Nullable Object | getData()
validated payload | - -## NoneProp -public static class NoneProp
-extends NullJsonSchema.NullJsonSchema1 - -A schema class that validates payloads - -| Methods Inherited from class org.openapijsonschematools.client.schemas.NullJsonSchema.NullJsonSchema1 | -| ------------------------------------------------------------------ | -| validate | -| validateAndBox | - -## PatternWithDigitsAndDelimiterBoxed -public sealed interface PatternWithDigitsAndDelimiterBoxed
-permits
-[PatternWithDigitsAndDelimiterBoxedString](#patternwithdigitsanddelimiterboxedstring) - -sealed interface that stores validated payloads using boxed classes - -## PatternWithDigitsAndDelimiterBoxedString -public record PatternWithDigitsAndDelimiterBoxedString
-implements [PatternWithDigitsAndDelimiterBoxed](#patternwithdigitsanddelimiterboxed) - -record that stores validated String payloads, sealed permits implementation - -### Constructor Summary -| Constructor and Description | -| --------------------------- | -| PatternWithDigitsAndDelimiterBoxedString(String data)
Creates an instance, private visibility | - -### Method Summary -| Modifier and Type | Method and Description | -| ----------------- | ---------------------- | -| String | data()
validated payload | -| @Nullable Object | getData()
validated payload | - -## PatternWithDigitsAndDelimiter -public static class PatternWithDigitsAndDelimiter
-extends JsonSchema - -A schema class that validates payloads - -## Description -A string starting with 'image_' (case insensitive) and one to three digits following i.e. Image_01. - -### Code Sample -``` -import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags; -import org.openapijsonschematools.client.configurations.SchemaConfiguration; -import org.openapijsonschematools.client.exceptions.ValidationException; -import org.openapijsonschematools.client.schemas.validation.MapUtils; -import org.openapijsonschematools.client.schemas.validation.FrozenList; -import org.openapijsonschematools.client.schemas.validation.FrozenMap; -import org.openapijsonschematools.client.components.schemas.FormatTest; - -import java.util.Arrays; -import java.util.List; -import java.util.AbstractMap; - -static final SchemaConfiguration configuration = new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().build()); - -// String validation -String validatedPayload = FormatTest.PatternWithDigitsAndDelimiter.validate( - "IMage_88", - configuration -); -``` - -### Field Summary -| Modifier and Type | Field and Description | -| ----------------- | ---------------------- | -| Set> | type = Set.of(
    String.class
)
| -| Pattern | pattern = Pattern.compile(
    "^image_\\d{1,3}$",
    Pattern.CASE_INSENSITIVE
)
| - -### Method Summary -| Modifier and Type | Method and Description | -| ----------------- | ---------------------- | -| String | validate(String arg, SchemaConfiguration configuration) | -| [PatternWithDigitsAndDelimiterBoxedString](#patternwithdigitsanddelimiterboxedstring) | validateAndBox(String arg, SchemaConfiguration configuration) | -| [PatternWithDigitsAndDelimiterBoxed](#patternwithdigitsanddelimiterboxed) | validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) | -| @Nullable Object | validate(@Nullable Object arg, SchemaConfiguration configuration) | - -## PatternWithDigitsBoxed -public sealed interface PatternWithDigitsBoxed
-permits
-[PatternWithDigitsBoxedString](#patternwithdigitsboxedstring) - -sealed interface that stores validated payloads using boxed classes - -## PatternWithDigitsBoxedString -public record PatternWithDigitsBoxedString
-implements [PatternWithDigitsBoxed](#patternwithdigitsboxed) - -record that stores validated String payloads, sealed permits implementation - -### Constructor Summary -| Constructor and Description | -| --------------------------- | -| PatternWithDigitsBoxedString(String data)
Creates an instance, private visibility | - -### Method Summary -| Modifier and Type | Method and Description | -| ----------------- | ---------------------- | -| String | data()
validated payload | -| @Nullable Object | getData()
validated payload | - -## PatternWithDigits -public static class PatternWithDigits
-extends JsonSchema - -A schema class that validates payloads - -## Description -A string that is a 10 digit number. Can have leading zeros. - -### Code Sample -``` -import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags; -import org.openapijsonschematools.client.configurations.SchemaConfiguration; -import org.openapijsonschematools.client.exceptions.ValidationException; -import org.openapijsonschematools.client.schemas.validation.MapUtils; -import org.openapijsonschematools.client.schemas.validation.FrozenList; -import org.openapijsonschematools.client.schemas.validation.FrozenMap; -import org.openapijsonschematools.client.components.schemas.FormatTest; - -import java.util.Arrays; -import java.util.List; -import java.util.AbstractMap; - -static final SchemaConfiguration configuration = new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().build()); - -// String validation -String validatedPayload = FormatTest.PatternWithDigits.validate( - "0480728880", - configuration -); -``` - -### Field Summary -| Modifier and Type | Field and Description | -| ----------------- | ---------------------- | -| Set> | type = Set.of(
    String.class
)
| -| Pattern | pattern = Pattern.compile(
    "^\\d{10}$"
)
| - -### Method Summary -| Modifier and Type | Method and Description | -| ----------------- | ---------------------- | -| String | validate(String arg, SchemaConfiguration configuration) | -| [PatternWithDigitsBoxedString](#patternwithdigitsboxedstring) | validateAndBox(String arg, SchemaConfiguration configuration) | -| [PatternWithDigitsBoxed](#patternwithdigitsboxed) | validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) | -| @Nullable Object | validate(@Nullable Object arg, SchemaConfiguration configuration) | - -## PasswordBoxed -public sealed interface PasswordBoxed
-permits
-[PasswordBoxedString](#passwordboxedstring) - -sealed interface that stores validated payloads using boxed classes - -## PasswordBoxedString -public record PasswordBoxedString
-implements [PasswordBoxed](#passwordboxed) - -record that stores validated String payloads, sealed permits implementation - -### Constructor Summary -| Constructor and Description | -| --------------------------- | -| PasswordBoxedString(String data)
Creates an instance, private visibility | - -### Method Summary -| Modifier and Type | Method and Description | -| ----------------- | ---------------------- | -| String | data()
validated payload | -| @Nullable Object | getData()
validated payload | - -## Password -public static class Password
-extends JsonSchema - -A schema class that validates payloads - -### Code Sample -``` -import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags; -import org.openapijsonschematools.client.configurations.SchemaConfiguration; -import org.openapijsonschematools.client.exceptions.ValidationException; -import org.openapijsonschematools.client.schemas.validation.MapUtils; -import org.openapijsonschematools.client.schemas.validation.FrozenList; -import org.openapijsonschematools.client.schemas.validation.FrozenMap; -import org.openapijsonschematools.client.components.schemas.FormatTest; - -import java.util.Arrays; -import java.util.List; -import java.util.AbstractMap; - -static final SchemaConfiguration configuration = new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().build()); - -// String validation -String validatedPayload = FormatTest.Password.validate( - "a", - configuration -); -``` - -### Field Summary -| Modifier and Type | Field and Description | -| ----------------- | ---------------------- | -| Set> | type = Set.of(
    String.class
)
| -| String | type = "password"; | -| Integer | maxLength = 64 | -| Integer | minLength = 10 | - -### Method Summary -| Modifier and Type | Method and Description | -| ----------------- | ---------------------- | -| String | validate(String arg, SchemaConfiguration configuration) | -| [PasswordBoxedString](#passwordboxedstring) | validateAndBox(String arg, SchemaConfiguration configuration) | -| [PasswordBoxed](#passwordboxed) | validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) | -| @Nullable Object | validate(@Nullable Object arg, SchemaConfiguration configuration) | - -## UuidNoExampleBoxed -public sealed interface UuidNoExampleBoxed
-permits
-[UuidNoExampleBoxedString](#uuidnoexampleboxedstring) - -sealed interface that stores validated payloads using boxed classes - -## UuidNoExampleBoxedString -public record UuidNoExampleBoxedString
-implements [UuidNoExampleBoxed](#uuidnoexampleboxed) - -record that stores validated String payloads, sealed permits implementation - -### Constructor Summary -| Constructor and Description | -| --------------------------- | -| UuidNoExampleBoxedString(String data)
Creates an instance, private visibility | - -### Method Summary -| Modifier and Type | Method and Description | -| ----------------- | ---------------------- | -| String | data()
validated payload | -| @Nullable Object | getData()
validated payload | - -## UuidNoExample -public static class UuidNoExample
-extends UuidJsonSchema.UuidJsonSchema1 - -A schema class that validates payloads - -| Methods Inherited from class org.openapijsonschematools.client.schemas.UuidJsonSchema.UuidJsonSchema1 | -| ------------------------------------------------------------------ | -| validate | -| validateAndBox | - -## UuidSchemaBoxed -public sealed interface UuidSchemaBoxed
-permits
-[UuidSchemaBoxedString](#uuidschemaboxedstring) - -sealed interface that stores validated payloads using boxed classes - -## UuidSchemaBoxedString -public record UuidSchemaBoxedString
-implements [UuidSchemaBoxed](#uuidschemaboxed) - -record that stores validated String payloads, sealed permits implementation - -### Constructor Summary -| Constructor and Description | -| --------------------------- | -| UuidSchemaBoxedString(String data)
Creates an instance, private visibility | - -### Method Summary -| Modifier and Type | Method and Description | -| ----------------- | ---------------------- | -| String | data()
validated payload | -| @Nullable Object | getData()
validated payload | - -## UuidSchema -public static class UuidSchema
-extends UuidJsonSchema.UuidJsonSchema1 - -A schema class that validates payloads - -| Methods Inherited from class org.openapijsonschematools.client.schemas.UuidJsonSchema.UuidJsonSchema1 | -| ------------------------------------------------------------------ | -| validate | -| validateAndBox | - -## DateTimeBoxed -public sealed interface DateTimeBoxed
-permits
-[DateTimeBoxedString](#datetimeboxedstring) - -sealed interface that stores validated payloads using boxed classes - -## DateTimeBoxedString -public record DateTimeBoxedString
-implements [DateTimeBoxed](#datetimeboxed) - -record that stores validated String payloads, sealed permits implementation - -### Constructor Summary -| Constructor and Description | -| --------------------------- | -| DateTimeBoxedString(String data)
Creates an instance, private visibility | - -### Method Summary -| Modifier and Type | Method and Description | -| ----------------- | ---------------------- | -| String | data()
validated payload | -| @Nullable Object | getData()
validated payload | - -## DateTime -public static class DateTime
-extends DateTimeJsonSchema.DateTimeJsonSchema1 - -A schema class that validates payloads - -| Methods Inherited from class org.openapijsonschematools.client.schemas.DateTimeJsonSchema.DateTimeJsonSchema1 | -| ------------------------------------------------------------------ | -| validate | -| validateAndBox | - -## DateBoxed -public sealed interface DateBoxed
-permits
-[DateBoxedString](#dateboxedstring) - -sealed interface that stores validated payloads using boxed classes - -## DateBoxedString -public record DateBoxedString
-implements [DateBoxed](#dateboxed) - -record that stores validated String payloads, sealed permits implementation - -### Constructor Summary -| Constructor and Description | -| --------------------------- | -| DateBoxedString(String data)
Creates an instance, private visibility | - -### Method Summary -| Modifier and Type | Method and Description | -| ----------------- | ---------------------- | -| String | data()
validated payload | -| @Nullable Object | getData()
validated payload | - -## Date -public static class Date
-extends DateJsonSchema.DateJsonSchema1 - -A schema class that validates payloads - -| Methods Inherited from class org.openapijsonschematools.client.schemas.DateJsonSchema.DateJsonSchema1 | -| ------------------------------------------------------------------ | -| validate | -| validateAndBox | - -## BinaryBoxed -public sealed interface BinaryBoxed
-permits
- -sealed interface that stores validated payloads using boxed classes - -## Binary -public static class Binary
-extends JsonSchema - -A schema class that validates payloads - -## ByteSchemaBoxed -public sealed interface ByteSchemaBoxed
-permits
-[ByteSchemaBoxedString](#byteschemaboxedstring) - -sealed interface that stores validated payloads using boxed classes - -## ByteSchemaBoxedString -public record ByteSchemaBoxedString
-implements [ByteSchemaBoxed](#byteschemaboxed) - -record that stores validated String payloads, sealed permits implementation - -### Constructor Summary -| Constructor and Description | -| --------------------------- | -| ByteSchemaBoxedString(String data)
Creates an instance, private visibility | - -### Method Summary -| Modifier and Type | Method and Description | -| ----------------- | ---------------------- | -| String | data()
validated payload | -| @Nullable Object | getData()
validated payload | - -## ByteSchema -public static class ByteSchema
-extends StringJsonSchema.StringJsonSchema1 - -A schema class that validates payloads - -## StringSchemaBoxed -public sealed interface StringSchemaBoxed
-permits
-[StringSchemaBoxedString](#stringschemaboxedstring) - -sealed interface that stores validated payloads using boxed classes - -## StringSchemaBoxedString -public record StringSchemaBoxedString
-implements [StringSchemaBoxed](#stringschemaboxed) - -record that stores validated String payloads, sealed permits implementation - -### Constructor Summary -| Constructor and Description | -| --------------------------- | -| StringSchemaBoxedString(String data)
Creates an instance, private visibility | - -### Method Summary -| Modifier and Type | Method and Description | -| ----------------- | ---------------------- | -| String | data()
validated payload | -| @Nullable Object | getData()
validated payload | - -## StringSchema -public static class StringSchema
-extends JsonSchema - -A schema class that validates payloads - -### Code Sample -``` -import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags; -import org.openapijsonschematools.client.configurations.SchemaConfiguration; -import org.openapijsonschematools.client.exceptions.ValidationException; -import org.openapijsonschematools.client.schemas.validation.MapUtils; -import org.openapijsonschematools.client.schemas.validation.FrozenList; -import org.openapijsonschematools.client.schemas.validation.FrozenMap; -import org.openapijsonschematools.client.components.schemas.FormatTest; - -import java.util.Arrays; -import java.util.List; -import java.util.AbstractMap; - -static final SchemaConfiguration configuration = new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().build()); - -// String validation -String validatedPayload = FormatTest.StringSchema.validate( - "A", - configuration -); -``` - -### Field Summary -| Modifier and Type | Field and Description | -| ----------------- | ---------------------- | -| Set> | type = Set.of(
    String.class
)
| -| Pattern | pattern = Pattern.compile(
    "[a-z]",
    Pattern.CASE_INSENSITIVE
)
| - -### Method Summary -| Modifier and Type | Method and Description | -| ----------------- | ---------------------- | -| String | validate(String arg, SchemaConfiguration configuration) | -| [StringSchemaBoxedString](#stringschemaboxedstring) | validateAndBox(String arg, SchemaConfiguration configuration) | -| [StringSchemaBoxed](#stringschemaboxed) | validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) | -| @Nullable Object | validate(@Nullable Object arg, SchemaConfiguration configuration) | - -## ArrayWithUniqueItemsBoxed -public sealed interface ArrayWithUniqueItemsBoxed
-permits
-[ArrayWithUniqueItemsBoxedList](#arraywithuniqueitemsboxedlist) - -sealed interface that stores validated payloads using boxed classes - -## ArrayWithUniqueItemsBoxedList -public record ArrayWithUniqueItemsBoxedList
-implements [ArrayWithUniqueItemsBoxed](#arraywithuniqueitemsboxed) - -record that stores validated List payloads, sealed permits implementation - -### Constructor Summary -| Constructor and Description | -| --------------------------- | -| ArrayWithUniqueItemsBoxedList([ArrayWithUniqueItemsList](#arraywithuniqueitemslist) data)
Creates an instance, private visibility | - -### Method Summary -| Modifier and Type | Method and Description | -| ----------------- | ---------------------- | -| [ArrayWithUniqueItemsList](#arraywithuniqueitemslist) | data()
validated payload | -| @Nullable Object | getData()
validated payload | - -## ArrayWithUniqueItems -public static class ArrayWithUniqueItems
-extends JsonSchema - -A schema class that validates payloads - -### Code Sample -``` -import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags; -import org.openapijsonschematools.client.configurations.SchemaConfiguration; -import org.openapijsonschematools.client.exceptions.ValidationException; -import org.openapijsonschematools.client.schemas.validation.MapUtils; -import org.openapijsonschematools.client.schemas.validation.FrozenList; -import org.openapijsonschematools.client.schemas.validation.FrozenMap; -import org.openapijsonschematools.client.components.schemas.FormatTest; - -import java.util.Arrays; -import java.util.List; -import java.util.AbstractMap; - -static final SchemaConfiguration configuration = new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().build()); - -// List validation -FormatTest.ArrayWithUniqueItemsList validatedPayload = - FormatTest.ArrayWithUniqueItems.validate( - new FormatTest.ArrayWithUniqueItemsListBuilder() - .add(1) - - .build(), - configuration -); -``` - -### Field Summary -| Modifier and Type | Field and Description | -| ----------------- | ---------------------- | -| Set> | type = Set.of(List.class) | -| Class | items = [Items.class](#items) | -| Boolean | uniqueItems = true | - -### Method Summary -| Modifier and Type | Method and Description | -| ----------------- | ---------------------- | -| [ArrayWithUniqueItemsList](#arraywithuniqueitemslist) | validate([List](#arraywithuniqueitemslistbuilder) arg, SchemaConfiguration configuration) | -| [ArrayWithUniqueItemsBoxedList](#arraywithuniqueitemsboxedlist) | validateAndBox([List](#arraywithuniqueitemslistbuilder) arg, SchemaConfiguration configuration) | -| [ArrayWithUniqueItemsBoxed](#arraywithuniqueitemsboxed) | validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) | -| @Nullable Object | validate(@Nullable Object arg, SchemaConfiguration configuration) | - -## ArrayWithUniqueItemsListBuilder -public class ArrayWithUniqueItemsListBuilder
-builder for `List` - -A class that builds the List input type - -### Constructor Summary -| Constructor and Description | -| --------------------------- | -| ArrayWithUniqueItemsListBuilder()
Creates an empty list | -| ArrayWithUniqueItemsListBuilder(List items)
Stores the items in a list | - -### Method Summary -| Modifier and Type | Method and Description | -| ----------------- | ---------------------- | -| ArrayWithUniqueItemsListBuilder | add(int item) | -| ArrayWithUniqueItemsListBuilder | add(float item) | -| ArrayWithUniqueItemsListBuilder | add(long item) | -| ArrayWithUniqueItemsListBuilder | add(double item) | -| List | build()
Returns list input that should be used with Schema.validate | - -## ArrayWithUniqueItemsList -public class ArrayWithUniqueItemsList
-extends `FrozenList` - -A class to store validated List payloads - -### Method Summary -| Modifier and Type | Method and Description | -| ----------------- | ---------------------- | -| static [ArrayWithUniqueItemsList](#arraywithuniqueitemslist) | of([List](#arraywithuniqueitemslistbuilder) arg, SchemaConfiguration configuration) | - -## ItemsBoxed -public sealed interface ItemsBoxed
-permits
-[ItemsBoxedNumber](#itemsboxednumber) - -sealed interface that stores validated payloads using boxed classes - -## ItemsBoxedNumber -public record ItemsBoxedNumber
-implements [ItemsBoxed](#itemsboxed) - -record that stores validated Number payloads, sealed permits implementation - -### Constructor Summary -| Constructor and Description | -| --------------------------- | -| ItemsBoxedNumber(Number data)
Creates an instance, private visibility | - -### Method Summary -| Modifier and Type | Method and Description | -| ----------------- | ---------------------- | -| Number | data()
validated payload | -| @Nullable Object | getData()
validated payload | - -## Items -public static class Items
-extends NumberJsonSchema.NumberJsonSchema1 - -A schema class that validates payloads - -| Methods Inherited from class org.openapijsonschematools.client.schemas.NumberJsonSchema.NumberJsonSchema1 | -| ------------------------------------------------------------------ | -| validate | -| validateAndBox | - -## Float64Boxed -public sealed interface Float64Boxed
-permits
-[Float64BoxedNumber](#float64boxednumber) - -sealed interface that stores validated payloads using boxed classes - -## Float64BoxedNumber -public record Float64BoxedNumber
-implements [Float64Boxed](#float64boxed) - -record that stores validated Number payloads, sealed permits implementation - -### Constructor Summary -| Constructor and Description | -| --------------------------- | -| Float64BoxedNumber(Number data)
Creates an instance, private visibility | - -### Method Summary -| Modifier and Type | Method and Description | -| ----------------- | ---------------------- | -| Number | data()
validated payload | -| @Nullable Object | getData()
validated payload | - -## Float64 -public static class Float64
-extends DoubleJsonSchema.DoubleJsonSchema1 - -A schema class that validates payloads - -| Methods Inherited from class org.openapijsonschematools.client.schemas.DoubleJsonSchema.DoubleJsonSchema1 | -| ------------------------------------------------------------------ | -| validate | -| validateAndBox | - -## DoubleSchemaBoxed -public sealed interface DoubleSchemaBoxed
-permits
-[DoubleSchemaBoxedNumber](#doubleschemaboxednumber) - -sealed interface that stores validated payloads using boxed classes - -## DoubleSchemaBoxedNumber -public record DoubleSchemaBoxedNumber
-implements [DoubleSchemaBoxed](#doubleschemaboxed) - -record that stores validated Number payloads, sealed permits implementation - -### Constructor Summary -| Constructor and Description | -| --------------------------- | -| DoubleSchemaBoxedNumber(Number data)
Creates an instance, private visibility | - -### Method Summary -| Modifier and Type | Method and Description | -| ----------------- | ---------------------- | -| Number | data()
validated payload | -| @Nullable Object | getData()
validated payload | - -## DoubleSchema -public static class DoubleSchema
-extends JsonSchema - -A schema class that validates payloads - -### Code Sample -``` -import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags; -import org.openapijsonschematools.client.configurations.SchemaConfiguration; -import org.openapijsonschematools.client.exceptions.ValidationException; -import org.openapijsonschematools.client.schemas.validation.MapUtils; -import org.openapijsonschematools.client.schemas.validation.FrozenList; -import org.openapijsonschematools.client.schemas.validation.FrozenMap; -import org.openapijsonschematools.client.components.schemas.FormatTest; - -import java.util.Arrays; -import java.util.List; -import java.util.AbstractMap; - -static final SchemaConfiguration configuration = new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().build()); - -// double validation -double validatedPayload = FormatTest.DoubleSchema.validate( - 3.14d, - configuration -); -``` - -### Field Summary -| Modifier and Type | Field and Description | -| ----------------- | ---------------------- | -| Set> | type = Set.of(
    Integer.class,
    Long.class,
    Float.class,
    Double.class
)
| -| String | type = "double"; | -| Number | maximum = 123.4 | -| Number | minimum = 67.8 | - -### Method Summary -| Modifier and Type | Method and Description | -| ----------------- | ---------------------- | -| double | validate(double arg, SchemaConfiguration configuration) | -| [DoubleSchemaBoxedNumber](#doubleschemaboxednumber) | validateAndBox(Number arg, SchemaConfiguration configuration) | -| [DoubleSchemaBoxed](#doubleschemaboxed) | validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) | -| @Nullable Object | validate(@Nullable Object arg, SchemaConfiguration configuration) | - -## Float32Boxed -public sealed interface Float32Boxed
-permits
-[Float32BoxedNumber](#float32boxednumber) - -sealed interface that stores validated payloads using boxed classes - -## Float32BoxedNumber -public record Float32BoxedNumber
-implements [Float32Boxed](#float32boxed) - -record that stores validated Number payloads, sealed permits implementation - -### Constructor Summary -| Constructor and Description | -| --------------------------- | -| Float32BoxedNumber(Number data)
Creates an instance, private visibility | - -### Method Summary -| Modifier and Type | Method and Description | -| ----------------- | ---------------------- | -| Number | data()
validated payload | -| @Nullable Object | getData()
validated payload | - -## Float32 -public static class Float32
-extends FloatJsonSchema.FloatJsonSchema1 - -A schema class that validates payloads - -| Methods Inherited from class org.openapijsonschematools.client.schemas.FloatJsonSchema.FloatJsonSchema1 | -| ------------------------------------------------------------------ | -| validate | -| validateAndBox | - -## FloatSchemaBoxed -public sealed interface FloatSchemaBoxed
-permits
-[FloatSchemaBoxedNumber](#floatschemaboxednumber) - -sealed interface that stores validated payloads using boxed classes - -## FloatSchemaBoxedNumber -public record FloatSchemaBoxedNumber
-implements [FloatSchemaBoxed](#floatschemaboxed) - -record that stores validated Number payloads, sealed permits implementation - -### Constructor Summary -| Constructor and Description | -| --------------------------- | -| FloatSchemaBoxedNumber(Number data)
Creates an instance, private visibility | - -### Method Summary -| Modifier and Type | Method and Description | -| ----------------- | ---------------------- | -| Number | data()
validated payload | -| @Nullable Object | getData()
validated payload | - -## FloatSchema -public static class FloatSchema
-extends JsonSchema - -A schema class that validates payloads - -## Description -this is a reserved python keyword - -### Code Sample -``` -import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags; -import org.openapijsonschematools.client.configurations.SchemaConfiguration; -import org.openapijsonschematools.client.exceptions.ValidationException; -import org.openapijsonschematools.client.schemas.validation.MapUtils; -import org.openapijsonschematools.client.schemas.validation.FrozenList; -import org.openapijsonschematools.client.schemas.validation.FrozenMap; -import org.openapijsonschematools.client.components.schemas.FormatTest; - -import java.util.Arrays; -import java.util.List; -import java.util.AbstractMap; - -static final SchemaConfiguration configuration = new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().build()); - -// float validation -float validatedPayload = FormatTest.FloatSchema.validate( - 3.14f, - configuration -); -``` - -### Field Summary -| Modifier and Type | Field and Description | -| ----------------- | ---------------------- | -| Set> | type = Set.of(
    Integer.class,
    Long.class,
    Float.class,
    Double.class
)
| -| String | type = "float"; | -| Number | maximum = 987.6 | -| Number | minimum = 54.3 | - -### Method Summary -| Modifier and Type | Method and Description | -| ----------------- | ---------------------- | -| float | validate(float arg, SchemaConfiguration configuration) | -| [FloatSchemaBoxedNumber](#floatschemaboxednumber) | validateAndBox(Number arg, SchemaConfiguration configuration) | -| [FloatSchemaBoxed](#floatschemaboxed) | validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) | -| @Nullable Object | validate(@Nullable Object arg, SchemaConfiguration configuration) | - -## NumberSchemaBoxed -public sealed interface NumberSchemaBoxed
-permits
-[NumberSchemaBoxedNumber](#numberschemaboxednumber) - -sealed interface that stores validated payloads using boxed classes - -## NumberSchemaBoxedNumber -public record NumberSchemaBoxedNumber
-implements [NumberSchemaBoxed](#numberschemaboxed) - -record that stores validated Number payloads, sealed permits implementation - -### Constructor Summary -| Constructor and Description | -| --------------------------- | -| NumberSchemaBoxedNumber(Number data)
Creates an instance, private visibility | - -### Method Summary -| Modifier and Type | Method and Description | -| ----------------- | ---------------------- | -| Number | data()
validated payload | -| @Nullable Object | getData()
validated payload | - -## NumberSchema -public static class NumberSchema
-extends JsonSchema - -A schema class that validates payloads - -### Code Sample -``` -import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags; -import org.openapijsonschematools.client.configurations.SchemaConfiguration; -import org.openapijsonschematools.client.exceptions.ValidationException; -import org.openapijsonschematools.client.schemas.validation.MapUtils; -import org.openapijsonschematools.client.schemas.validation.FrozenList; -import org.openapijsonschematools.client.schemas.validation.FrozenMap; -import org.openapijsonschematools.client.components.schemas.FormatTest; - -import java.util.Arrays; -import java.util.List; -import java.util.AbstractMap; - -static final SchemaConfiguration configuration = new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().build()); - -// int validation -int validatedPayload = FormatTest.NumberSchema.validate( - 1, - configuration -); -``` - -### Field Summary -| Modifier and Type | Field and Description | -| ----------------- | ---------------------- | -| Set> | type = Set.of(
    Integer.class,
    Long.class,
    Float.class,
    Double.class
)
| -| Number | maximum = 543.2 | -| Number | minimum = 32.1 | -| BigDecimal | multipleOf = new BigDecimal("32.5") | - -### Method Summary -| Modifier and Type | Method and Description | -| ----------------- | ---------------------- | -| Number | validate(Number arg, SchemaConfiguration configuration) | -| [NumberSchemaBoxedNumber](#numberschemaboxednumber) | validateAndBox(Number arg, SchemaConfiguration configuration) | -| [NumberSchemaBoxed](#numberschemaboxed) | validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) | -| @Nullable Object | validate(@Nullable Object arg, SchemaConfiguration configuration) | - -## Int64Boxed -public sealed interface Int64Boxed
-permits
-[Int64BoxedNumber](#int64boxednumber) - -sealed interface that stores validated payloads using boxed classes - -## Int64BoxedNumber -public record Int64BoxedNumber
-implements [Int64Boxed](#int64boxed) - -record that stores validated Number payloads, sealed permits implementation - -### Constructor Summary -| Constructor and Description | -| --------------------------- | -| Int64BoxedNumber(Number data)
Creates an instance, private visibility | - -### Method Summary -| Modifier and Type | Method and Description | -| ----------------- | ---------------------- | -| Number | data()
validated payload | -| @Nullable Object | getData()
validated payload | - -## Int64 -public static class Int64
-extends Int64JsonSchema.Int64JsonSchema1 - -A schema class that validates payloads - -| Methods Inherited from class org.openapijsonschematools.client.schemas.Int64JsonSchema.Int64JsonSchema1 | -| ------------------------------------------------------------------ | -| validate | -| validateAndBox | - -## Int32withValidationsBoxed -public sealed interface Int32withValidationsBoxed
-permits
-[Int32withValidationsBoxedNumber](#int32withvalidationsboxednumber) - -sealed interface that stores validated payloads using boxed classes - -## Int32withValidationsBoxedNumber -public record Int32withValidationsBoxedNumber
-implements [Int32withValidationsBoxed](#int32withvalidationsboxed) - -record that stores validated Number payloads, sealed permits implementation - -### Constructor Summary -| Constructor and Description | -| --------------------------- | -| Int32withValidationsBoxedNumber(Number data)
Creates an instance, private visibility | - -### Method Summary -| Modifier and Type | Method and Description | -| ----------------- | ---------------------- | -| Number | data()
validated payload | -| @Nullable Object | getData()
validated payload | - -## Int32withValidations -public static class Int32withValidations
-extends JsonSchema - -A schema class that validates payloads - -### Code Sample -``` -import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags; -import org.openapijsonschematools.client.configurations.SchemaConfiguration; -import org.openapijsonschematools.client.exceptions.ValidationException; -import org.openapijsonschematools.client.schemas.validation.MapUtils; -import org.openapijsonschematools.client.schemas.validation.FrozenList; -import org.openapijsonschematools.client.schemas.validation.FrozenMap; -import org.openapijsonschematools.client.components.schemas.FormatTest; - -import java.util.Arrays; -import java.util.List; -import java.util.AbstractMap; - -static final SchemaConfiguration configuration = new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().build()); - -// int validation -int validatedPayload = FormatTest.Int32withValidations.validate( - 1, - configuration -); -``` - -### Field Summary -| Modifier and Type | Field and Description | -| ----------------- | ---------------------- | -| Set> | type = Set.of(
    Integer.class,
    Long.class,
    Float.class,
    Double.class
)
| -| String | type = "int32"; | -| Number | maximum = 200 | -| Number | minimum = 20 | - -### Method Summary -| Modifier and Type | Method and Description | -| ----------------- | ---------------------- | -| int | validate(int arg, SchemaConfiguration configuration) | -| [Int32withValidationsBoxedNumber](#int32withvalidationsboxednumber) | validateAndBox(Number arg, SchemaConfiguration configuration) | -| [Int32withValidationsBoxed](#int32withvalidationsboxed) | validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) | -| @Nullable Object | validate(@Nullable Object arg, SchemaConfiguration configuration) | - -## Int32Boxed -public sealed interface Int32Boxed
-permits
-[Int32BoxedNumber](#int32boxednumber) - -sealed interface that stores validated payloads using boxed classes - -## Int32BoxedNumber -public record Int32BoxedNumber
-implements [Int32Boxed](#int32boxed) - -record that stores validated Number payloads, sealed permits implementation - -### Constructor Summary -| Constructor and Description | -| --------------------------- | -| Int32BoxedNumber(Number data)
Creates an instance, private visibility | - -### Method Summary -| Modifier and Type | Method and Description | -| ----------------- | ---------------------- | -| Number | data()
validated payload | -| @Nullable Object | getData()
validated payload | - -## Int32 -public static class Int32
-extends Int32JsonSchema.Int32JsonSchema1 - -A schema class that validates payloads - -| Methods Inherited from class org.openapijsonschematools.client.schemas.Int32JsonSchema.Int32JsonSchema1 | -| ------------------------------------------------------------------ | -| validate | -| validateAndBox | - -## IntegerSchemaBoxed -public sealed interface IntegerSchemaBoxed
-permits
-[IntegerSchemaBoxedNumber](#integerschemaboxednumber) - -sealed interface that stores validated payloads using boxed classes - -## IntegerSchemaBoxedNumber -public record IntegerSchemaBoxedNumber
-implements [IntegerSchemaBoxed](#integerschemaboxed) - -record that stores validated Number payloads, sealed permits implementation - -### Constructor Summary -| Constructor and Description | -| --------------------------- | -| IntegerSchemaBoxedNumber(Number data)
Creates an instance, private visibility | - -### Method Summary -| Modifier and Type | Method and Description | -| ----------------- | ---------------------- | -| Number | data()
validated payload | -| @Nullable Object | getData()
validated payload | - -## IntegerSchema -public static class IntegerSchema
-extends JsonSchema - -A schema class that validates payloads - -### Code Sample -``` -import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags; -import org.openapijsonschematools.client.configurations.SchemaConfiguration; -import org.openapijsonschematools.client.exceptions.ValidationException; -import org.openapijsonschematools.client.schemas.validation.MapUtils; -import org.openapijsonschematools.client.schemas.validation.FrozenList; -import org.openapijsonschematools.client.schemas.validation.FrozenMap; -import org.openapijsonschematools.client.components.schemas.FormatTest; - -import java.util.Arrays; -import java.util.List; -import java.util.AbstractMap; - -static final SchemaConfiguration configuration = new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().build()); - -// int validation -int validatedPayload = FormatTest.IntegerSchema.validate( - 1L, - configuration -); -``` - -### Field Summary -| Modifier and Type | Field and Description | -| ----------------- | ---------------------- | -| Set> | type = Set.of(
    Integer.class,
    Long.class,
    Float.class,
    Double.class
)
| -| String | type = "int"; | -| Number | maximum = 100 | -| Number | minimum = 10 | -| BigDecimal | multipleOf = new BigDecimal("2") | - -### Method Summary -| Modifier and Type | Method and Description | -| ----------------- | ---------------------- | -| long | validate(long arg, SchemaConfiguration configuration) | -| [IntegerSchemaBoxedNumber](#integerschemaboxednumber) | validateAndBox(Number arg, SchemaConfiguration configuration) | -| [IntegerSchemaBoxed](#integerschemaboxed) | validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) | -| @Nullable Object | validate(@Nullable Object arg, SchemaConfiguration configuration) | - -[[Back to top]](#top) [[Back to Component Schemas]](../../../README.md#Component-Schemas) [[Back to README]](../../../README.md) diff --git a/samples/client/petstore/kotlin/docs/components/schemas/FromSchema.md b/samples/client/petstore/kotlin/docs/components/schemas/FromSchema.md deleted file mode 100644 index 01c3cffdf56..00000000000 --- a/samples/client/petstore/kotlin/docs/components/schemas/FromSchema.md +++ /dev/null @@ -1,214 +0,0 @@ -# FromSchema -org.openapijsonschematools.client.components.schemas.FromSchema.java -public class FromSchema
- -A class that contains necessary nested -- schema classes (which validate payloads), extends JsonSchema -- sealed interfaces which store validated payloads, java version of a sum type -- boxed classes which store validated payloads, sealed permits class implementations -- classes to store validated map payloads, extends FrozenMap -- classes to build inputs for map payloads - -## Nested Class Summary -| Modifier and Type | Class and Description | -| ----------------- | ---------------------- | -| sealed interface | [FromSchema.FromSchema1Boxed](#fromschema1boxed)
sealed interface for validated payloads | -| record | [FromSchema.FromSchema1BoxedMap](#fromschema1boxedmap)
boxed class to store validated Map payloads | -| static class | [FromSchema.FromSchema1](#fromschema1)
schema class | -| static class | [FromSchema.FromSchemaMapBuilder](#fromschemamapbuilder)
builder for Map payloads | -| static class | [FromSchema.FromSchemaMap](#fromschemamap)
output class for Map payloads | -| sealed interface | [FromSchema.IdBoxed](#idboxed)
sealed interface for validated payloads | -| record | [FromSchema.IdBoxedNumber](#idboxednumber)
boxed class to store validated Number payloads | -| static class | [FromSchema.Id](#id)
schema class | -| sealed interface | [FromSchema.DataBoxed](#databoxed)
sealed interface for validated payloads | -| record | [FromSchema.DataBoxedString](#databoxedstring)
boxed class to store validated String payloads | -| static class | [FromSchema.Data](#data)
schema class | - -## FromSchema1Boxed -public sealed interface FromSchema1Boxed
-permits
-[FromSchema1BoxedMap](#fromschema1boxedmap) - -sealed interface that stores validated payloads using boxed classes - -## FromSchema1BoxedMap -public record FromSchema1BoxedMap
-implements [FromSchema1Boxed](#fromschema1boxed) - -record that stores validated Map payloads, sealed permits implementation - -### Constructor Summary -| Constructor and Description | -| --------------------------- | -| FromSchema1BoxedMap([FromSchemaMap](#fromschemamap) data)
Creates an instance, private visibility | - -### Method Summary -| Modifier and Type | Method and Description | -| ----------------- | ---------------------- | -| [FromSchemaMap](#fromschemamap) | data()
validated payload | -| @Nullable Object | getData()
validated payload | - -## FromSchema1 -public static class FromSchema1
-extends JsonSchema - -A schema class that validates payloads - -### Code Sample -``` -import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags; -import org.openapijsonschematools.client.configurations.SchemaConfiguration; -import org.openapijsonschematools.client.exceptions.ValidationException; -import org.openapijsonschematools.client.schemas.validation.MapUtils; -import org.openapijsonschematools.client.schemas.validation.FrozenList; -import org.openapijsonschematools.client.schemas.validation.FrozenMap; -import org.openapijsonschematools.client.components.schemas.FromSchema; - -import java.util.Arrays; -import java.util.List; -import java.util.AbstractMap; - -static final SchemaConfiguration configuration = new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().build()); - -// Map validation -FromSchema.FromSchemaMap validatedPayload = - FromSchema.FromSchema1.validate( - new FromSchema.FromSchemaMapBuilder() - .data("a") - - .id(1) - - .build(), - configuration -); -``` - -### Field Summary -| Modifier and Type | Field and Description | -| ----------------- | ---------------------- | -| Set> | type = Set.of(Map.class) | -| Map> | properties = Map.ofEntries(
    new PropertyEntry("data", [Data.class](#data))),
    new PropertyEntry("id", [Id.class](#id)))
)
| - -### Method Summary -| Modifier and Type | Method and Description | -| ----------------- | ---------------------- | -| [FromSchemaMap](#fromschemamap) | validate([Map<?, ?>](#fromschemamapbuilder) arg, SchemaConfiguration configuration) | -| [FromSchema1BoxedMap](#fromschema1boxedmap) | validateAndBox([Map<?, ?>](#fromschemamapbuilder) arg, SchemaConfiguration configuration) | -| [FromSchema1Boxed](#fromschema1boxed) | validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) | -| @Nullable Object | validate(@Nullable Object arg, SchemaConfiguration configuration) | - -## FromSchemaMapBuilder -public class FromSchemaMapBuilder
-builder for `Map` - -A class that builds the Map input type - -### Constructor Summary -| Constructor and Description | -| --------------------------- | -| FromSchemaMapBuilder()
Creates a builder that contains an empty map | - -### Method Summary -| Modifier and Type | Method and Description | -| ----------------- | ---------------------- | -| Map | build()
Returns map input that should be used with Schema.validate | -| [FromSchemaMapBuilder](#fromschemamapbuilder) | data(String value) | -| [FromSchemaMapBuilder](#fromschemamapbuilder) | id(int value) | -| [FromSchemaMapBuilder](#fromschemamapbuilder) | id(float value) | -| [FromSchemaMapBuilder](#fromschemamapbuilder) | id(long value) | -| [FromSchemaMapBuilder](#fromschemamapbuilder) | id(double value) | -| [FromSchemaMapBuilder](#fromschemamapbuilder) | additionalProperty(String key, Nothing? value) | -| [FromSchemaMapBuilder](#fromschemamapbuilder) | additionalProperty(String key, boolean value) | -| [FromSchemaMapBuilder](#fromschemamapbuilder) | additionalProperty(String key, String value) | -| [FromSchemaMapBuilder](#fromschemamapbuilder) | additionalProperty(String key, int value) | -| [FromSchemaMapBuilder](#fromschemamapbuilder) | additionalProperty(String key, float value) | -| [FromSchemaMapBuilder](#fromschemamapbuilder) | additionalProperty(String key, long value) | -| [FromSchemaMapBuilder](#fromschemamapbuilder) | additionalProperty(String key, double value) | -| [FromSchemaMapBuilder](#fromschemamapbuilder) | additionalProperty(String key, List value) | -| [FromSchemaMapBuilder](#fromschemamapbuilder) | additionalProperty(String key, Map value) | - -## FromSchemaMap -public static class FromSchemaMap
-extends FrozenMap - -A class to store validated Map payloads - -### Method Summary -| Modifier and Type | Method and Description | -| ----------------- | ---------------------- | -| static [FromSchemaMap](#fromschemamap) | of([Map](#fromschemamapbuilder) arg, SchemaConfiguration configuration) | -| String | data()
[optional] | -| Number | id()
[optional] | -| @Nullable Object | getAdditionalProperty(String name)
provides type safety for additional properties | - -## IdBoxed -public sealed interface IdBoxed
-permits
-[IdBoxedNumber](#idboxednumber) - -sealed interface that stores validated payloads using boxed classes - -## IdBoxedNumber -public record IdBoxedNumber
-implements [IdBoxed](#idboxed) - -record that stores validated Number payloads, sealed permits implementation - -### Constructor Summary -| Constructor and Description | -| --------------------------- | -| IdBoxedNumber(Number data)
Creates an instance, private visibility | - -### Method Summary -| Modifier and Type | Method and Description | -| ----------------- | ---------------------- | -| Number | data()
validated payload | -| @Nullable Object | getData()
validated payload | - -## Id -public static class Id
-extends IntJsonSchema.IntJsonSchema1 - -A schema class that validates payloads - -| Methods Inherited from class org.openapijsonschematools.client.schemas.IntJsonSchema.IntJsonSchema1 | -| ------------------------------------------------------------------ | -| validate | -| validateAndBox | - -## DataBoxed -public sealed interface DataBoxed
-permits
-[DataBoxedString](#databoxedstring) - -sealed interface that stores validated payloads using boxed classes - -## DataBoxedString -public record DataBoxedString
-implements [DataBoxed](#databoxed) - -record that stores validated String payloads, sealed permits implementation - -### Constructor Summary -| Constructor and Description | -| --------------------------- | -| DataBoxedString(String data)
Creates an instance, private visibility | - -### Method Summary -| Modifier and Type | Method and Description | -| ----------------- | ---------------------- | -| String | data()
validated payload | -| @Nullable Object | getData()
validated payload | - -## Data -public static class Data
-extends StringJsonSchema.StringJsonSchema1 - -A schema class that validates payloads - -| Methods Inherited from class org.openapijsonschematools.client.schemas.StringJsonSchema.StringJsonSchema1 | -| ------------------------------------------------------------------ | -| validate | -| validateAndBox | - -[[Back to top]](#top) [[Back to Component Schemas]](../../../README.md#Component-Schemas) [[Back to README]](../../../README.md) diff --git a/samples/client/petstore/kotlin/docs/components/schemas/Fruit.md b/samples/client/petstore/kotlin/docs/components/schemas/Fruit.md deleted file mode 100644 index 262e15ccefe..00000000000 --- a/samples/client/petstore/kotlin/docs/components/schemas/Fruit.md +++ /dev/null @@ -1,251 +0,0 @@ -# Fruit -org.openapijsonschematools.client.components.schemas.Fruit.java -public class Fruit
- -A class that contains necessary nested -- schema classes (which validate payloads), extends JsonSchema -- sealed interfaces which store validated payloads, java version of a sum type -- boxed classes which store validated payloads, sealed permits class implementations -- classes to store validated map payloads, extends FrozenMap -- classes to build inputs for map payloads - -## Nested Class Summary -| Modifier and Type | Class and Description | -| ----------------- | ---------------------- | -| sealed interface | [Fruit.Fruit1Boxed](#fruit1boxed)
sealed interface for validated payloads | -| record | [Fruit.Fruit1BoxedVoid](#fruit1boxedvoid)
boxed class to store validated null payloads | -| record | [Fruit.Fruit1BoxedBoolean](#fruit1boxedboolean)
boxed class to store validated boolean payloads | -| record | [Fruit.Fruit1BoxedNumber](#fruit1boxednumber)
boxed class to store validated Number payloads | -| record | [Fruit.Fruit1BoxedString](#fruit1boxedstring)
boxed class to store validated String payloads | -| record | [Fruit.Fruit1BoxedList](#fruit1boxedlist)
boxed class to store validated List payloads | -| record | [Fruit.Fruit1BoxedMap](#fruit1boxedmap)
boxed class to store validated Map payloads | -| static class | [Fruit.Fruit1](#fruit1)
schema class | -| static class | [Fruit.FruitMapBuilder](#fruitmapbuilder)
builder for Map payloads | -| static class | [Fruit.FruitMap](#fruitmap)
output class for Map payloads | -| sealed interface | [Fruit.ColorBoxed](#colorboxed)
sealed interface for validated payloads | -| record | [Fruit.ColorBoxedString](#colorboxedstring)
boxed class to store validated String payloads | -| static class | [Fruit.Color](#color)
schema class | - -## Fruit1Boxed -public sealed interface Fruit1Boxed
-permits
-[Fruit1BoxedVoid](#fruit1boxedvoid), -[Fruit1BoxedBoolean](#fruit1boxedboolean), -[Fruit1BoxedNumber](#fruit1boxednumber), -[Fruit1BoxedString](#fruit1boxedstring), -[Fruit1BoxedList](#fruit1boxedlist), -[Fruit1BoxedMap](#fruit1boxedmap) - -sealed interface that stores validated payloads using boxed classes - -## Fruit1BoxedVoid -public record Fruit1BoxedVoid
-implements [Fruit1Boxed](#fruit1boxed) - -record that stores validated null payloads, sealed permits implementation - -### Constructor Summary -| Constructor and Description | -| --------------------------- | -| Fruit1BoxedVoid(Nothing? data)
Creates an instance, private visibility | - -### Method Summary -| Modifier and Type | Method and Description | -| ----------------- | ---------------------- | -| Nothing? | data()
validated payload | -| @Nullable Object | getData()
validated payload | - -## Fruit1BoxedBoolean -public record Fruit1BoxedBoolean
-implements [Fruit1Boxed](#fruit1boxed) - -record that stores validated boolean payloads, sealed permits implementation - -### Constructor Summary -| Constructor and Description | -| --------------------------- | -| Fruit1BoxedBoolean(boolean data)
Creates an instance, private visibility | - -### Method Summary -| Modifier and Type | Method and Description | -| ----------------- | ---------------------- | -| boolean | data()
validated payload | -| @Nullable Object | getData()
validated payload | - -## Fruit1BoxedNumber -public record Fruit1BoxedNumber
-implements [Fruit1Boxed](#fruit1boxed) - -record that stores validated Number payloads, sealed permits implementation - -### Constructor Summary -| Constructor and Description | -| --------------------------- | -| Fruit1BoxedNumber(Number data)
Creates an instance, private visibility | - -### Method Summary -| Modifier and Type | Method and Description | -| ----------------- | ---------------------- | -| Number | data()
validated payload | -| @Nullable Object | getData()
validated payload | - -## Fruit1BoxedString -public record Fruit1BoxedString
-implements [Fruit1Boxed](#fruit1boxed) - -record that stores validated String payloads, sealed permits implementation - -### Constructor Summary -| Constructor and Description | -| --------------------------- | -| Fruit1BoxedString(String data)
Creates an instance, private visibility | - -### Method Summary -| Modifier and Type | Method and Description | -| ----------------- | ---------------------- | -| String | data()
validated payload | -| @Nullable Object | getData()
validated payload | - -## Fruit1BoxedList -public record Fruit1BoxedList
-implements [Fruit1Boxed](#fruit1boxed) - -record that stores validated List payloads, sealed permits implementation - -### Constructor Summary -| Constructor and Description | -| --------------------------- | -| Fruit1BoxedList(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 | - -## Fruit1BoxedMap -public record Fruit1BoxedMap
-implements [Fruit1Boxed](#fruit1boxed) - -record that stores validated Map payloads, sealed permits implementation - -### Constructor Summary -| Constructor and Description | -| --------------------------- | -| Fruit1BoxedMap([FruitMap](#fruitmap) data)
Creates an instance, private visibility | - -### Method Summary -| Modifier and Type | Method and Description | -| ----------------- | ---------------------- | -| [FruitMap](#fruitmap) | data()
validated payload | -| @Nullable Object | getData()
validated payload | - -## Fruit1 -public static class Fruit1
-extends JsonSchema - -A schema class that validates payloads - -### Field Summary -| Modifier and Type | Field and Description | -| ----------------- | ---------------------- | -| Map> | properties = Map.ofEntries(
    new PropertyEntry("color", [Color.class](#color)))
)
| -| List> | oneOf = List.of(
    [Apple.Apple1.class](../../components/schemas/Apple.md#apple1),
    [Banana.Banana1.class](../../components/schemas/Banana.md#banana1)
))
| - -### Method Summary -| Modifier and Type | Method and Description | -| ----------------- | ---------------------- | -| String | validate(String arg, SchemaConfiguration configuration) | -| Nothing? | validate(Nothing? arg, SchemaConfiguration configuration) | -| int | validate(int arg, SchemaConfiguration configuration) | -| long | validate(long arg, SchemaConfiguration configuration) | -| float | validate(float arg, SchemaConfiguration configuration) | -| double | validate(double arg, SchemaConfiguration configuration) | -| Number | validate(Number arg, SchemaConfiguration configuration) | -| boolean | validate(boolean arg, SchemaConfiguration configuration) | -| [FruitMap](#fruitmap) | validate([Map<?, ?>](#fruitmapbuilder) arg, SchemaConfiguration configuration) | -| FrozenList<@Nullable Object> | validate(List arg, SchemaConfiguration configuration) | -| [Fruit1BoxedString](#fruit1boxedstring) | validateAndBox(String arg, SchemaConfiguration configuration) | -| [Fruit1BoxedVoid](#fruit1boxedvoid) | validateAndBox(Nothing? arg, SchemaConfiguration configuration) | -| [Fruit1BoxedNumber](#fruit1boxednumber) | validateAndBox(Number arg, SchemaConfiguration configuration) | -| [Fruit1BoxedBoolean](#fruit1boxedboolean) | validateAndBox(boolean arg, SchemaConfiguration configuration) | -| [Fruit1BoxedMap](#fruit1boxedmap) | validateAndBox([Map<?, ?>](#fruitmapbuilder) arg, SchemaConfiguration configuration) | -| [Fruit1BoxedList](#fruit1boxedlist) | validateAndBox(List arg, SchemaConfiguration configuration) | -| [Fruit1Boxed](#fruit1boxed) | validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) | -| @Nullable Object | validate(@Nullable Object arg, SchemaConfiguration configuration) | - -## FruitMapBuilder -public class FruitMapBuilder
-builder for `Map` - -A class that builds the Map input type - -### Constructor Summary -| Constructor and Description | -| --------------------------- | -| FruitMapBuilder()
Creates a builder that contains an empty map | - -### Method Summary -| Modifier and Type | Method and Description | -| ----------------- | ---------------------- | -| Map | build()
Returns map input that should be used with Schema.validate | -| [FruitMapBuilder](#fruitmapbuilder) | color(String value) | -| [FruitMapBuilder](#fruitmapbuilder) | additionalProperty(String key, Nothing? value) | -| [FruitMapBuilder](#fruitmapbuilder) | additionalProperty(String key, boolean value) | -| [FruitMapBuilder](#fruitmapbuilder) | additionalProperty(String key, String value) | -| [FruitMapBuilder](#fruitmapbuilder) | additionalProperty(String key, int value) | -| [FruitMapBuilder](#fruitmapbuilder) | additionalProperty(String key, float value) | -| [FruitMapBuilder](#fruitmapbuilder) | additionalProperty(String key, long value) | -| [FruitMapBuilder](#fruitmapbuilder) | additionalProperty(String key, double value) | -| [FruitMapBuilder](#fruitmapbuilder) | additionalProperty(String key, List value) | -| [FruitMapBuilder](#fruitmapbuilder) | additionalProperty(String key, Map value) | - -## FruitMap -public static class FruitMap
-extends FrozenMap - -A class to store validated Map payloads - -### Method Summary -| Modifier and Type | Method and Description | -| ----------------- | ---------------------- | -| static [FruitMap](#fruitmap) | of([Map](#fruitmapbuilder) arg, SchemaConfiguration configuration) | -| String | color()
[optional] | -| @Nullable Object | getAdditionalProperty(String name)
provides type safety for additional properties | - -## ColorBoxed -public sealed interface ColorBoxed
-permits
-[ColorBoxedString](#colorboxedstring) - -sealed interface that stores validated payloads using boxed classes - -## ColorBoxedString -public record ColorBoxedString
-implements [ColorBoxed](#colorboxed) - -record that stores validated String payloads, sealed permits implementation - -### Constructor Summary -| Constructor and Description | -| --------------------------- | -| ColorBoxedString(String data)
Creates an instance, private visibility | - -### Method Summary -| Modifier and Type | Method and Description | -| ----------------- | ---------------------- | -| String | data()
validated payload | -| @Nullable Object | getData()
validated payload | - -## Color -public static class Color
-extends StringJsonSchema.StringJsonSchema1 - -A schema class that validates payloads - -| Methods Inherited from class org.openapijsonschematools.client.schemas.StringJsonSchema.StringJsonSchema1 | -| ------------------------------------------------------------------ | -| validate | -| validateAndBox | - -[[Back to top]](#top) [[Back to Component Schemas]](../../../README.md#Component-Schemas) [[Back to README]](../../../README.md) diff --git a/samples/client/petstore/kotlin/docs/components/schemas/FruitReq.md b/samples/client/petstore/kotlin/docs/components/schemas/FruitReq.md deleted file mode 100644 index aac35b56aa4..00000000000 --- a/samples/client/petstore/kotlin/docs/components/schemas/FruitReq.md +++ /dev/null @@ -1,207 +0,0 @@ -# FruitReq -org.openapijsonschematools.client.components.schemas.FruitReq.java -public class FruitReq
- -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 - -## Nested Class Summary -| Modifier and Type | Class and Description | -| ----------------- | ---------------------- | -| sealed interface | [FruitReq.FruitReq1Boxed](#fruitreq1boxed)
sealed interface for validated payloads | -| record | [FruitReq.FruitReq1BoxedVoid](#fruitreq1boxedvoid)
boxed class to store validated null payloads | -| record | [FruitReq.FruitReq1BoxedBoolean](#fruitreq1boxedboolean)
boxed class to store validated boolean payloads | -| record | [FruitReq.FruitReq1BoxedNumber](#fruitreq1boxednumber)
boxed class to store validated Number payloads | -| record | [FruitReq.FruitReq1BoxedString](#fruitreq1boxedstring)
boxed class to store validated String payloads | -| record | [FruitReq.FruitReq1BoxedList](#fruitreq1boxedlist)
boxed class to store validated List payloads | -| record | [FruitReq.FruitReq1BoxedMap](#fruitreq1boxedmap)
boxed class to store validated Map payloads | -| static class | [FruitReq.FruitReq1](#fruitreq1)
schema class | -| sealed interface | [FruitReq.Schema0Boxed](#schema0boxed)
sealed interface for validated payloads | -| record | [FruitReq.Schema0BoxedVoid](#schema0boxedvoid)
boxed class to store validated null payloads | -| static class | [FruitReq.Schema0](#schema0)
schema class | - -## FruitReq1Boxed -public sealed interface FruitReq1Boxed
-permits
-[FruitReq1BoxedVoid](#fruitreq1boxedvoid), -[FruitReq1BoxedBoolean](#fruitreq1boxedboolean), -[FruitReq1BoxedNumber](#fruitreq1boxednumber), -[FruitReq1BoxedString](#fruitreq1boxedstring), -[FruitReq1BoxedList](#fruitreq1boxedlist), -[FruitReq1BoxedMap](#fruitreq1boxedmap) - -sealed interface that stores validated payloads using boxed classes - -## FruitReq1BoxedVoid -public record FruitReq1BoxedVoid
-implements [FruitReq1Boxed](#fruitreq1boxed) - -record that stores validated null payloads, sealed permits implementation - -### Constructor Summary -| Constructor and Description | -| --------------------------- | -| FruitReq1BoxedVoid(Nothing? data)
Creates an instance, private visibility | - -### Method Summary -| Modifier and Type | Method and Description | -| ----------------- | ---------------------- | -| Nothing? | data()
validated payload | -| @Nullable Object | getData()
validated payload | - -## FruitReq1BoxedBoolean -public record FruitReq1BoxedBoolean
-implements [FruitReq1Boxed](#fruitreq1boxed) - -record that stores validated boolean payloads, sealed permits implementation - -### Constructor Summary -| Constructor and Description | -| --------------------------- | -| FruitReq1BoxedBoolean(boolean data)
Creates an instance, private visibility | - -### Method Summary -| Modifier and Type | Method and Description | -| ----------------- | ---------------------- | -| boolean | data()
validated payload | -| @Nullable Object | getData()
validated payload | - -## FruitReq1BoxedNumber -public record FruitReq1BoxedNumber
-implements [FruitReq1Boxed](#fruitreq1boxed) - -record that stores validated Number payloads, sealed permits implementation - -### Constructor Summary -| Constructor and Description | -| --------------------------- | -| FruitReq1BoxedNumber(Number data)
Creates an instance, private visibility | - -### Method Summary -| Modifier and Type | Method and Description | -| ----------------- | ---------------------- | -| Number | data()
validated payload | -| @Nullable Object | getData()
validated payload | - -## FruitReq1BoxedString -public record FruitReq1BoxedString
-implements [FruitReq1Boxed](#fruitreq1boxed) - -record that stores validated String payloads, sealed permits implementation - -### Constructor Summary -| Constructor and Description | -| --------------------------- | -| FruitReq1BoxedString(String data)
Creates an instance, private visibility | - -### Method Summary -| Modifier and Type | Method and Description | -| ----------------- | ---------------------- | -| String | data()
validated payload | -| @Nullable Object | getData()
validated payload | - -## FruitReq1BoxedList -public record FruitReq1BoxedList
-implements [FruitReq1Boxed](#fruitreq1boxed) - -record that stores validated List payloads, sealed permits implementation - -### Constructor Summary -| Constructor and Description | -| --------------------------- | -| FruitReq1BoxedList(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 | - -## FruitReq1BoxedMap -public record FruitReq1BoxedMap
-implements [FruitReq1Boxed](#fruitreq1boxed) - -record that stores validated Map payloads, sealed permits implementation - -### Constructor Summary -| Constructor and Description | -| --------------------------- | -| FruitReq1BoxedMap(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 | - -## FruitReq1 -public static class FruitReq1
-extends JsonSchema - -A schema class that validates payloads - -### Field Summary -| Modifier and Type | Field and Description | -| ----------------- | ---------------------- | -| List> | oneOf = List.of(
    [Schema0.class](#schema0),
    [AppleReq.AppleReq1.class](../../components/schemas/AppleReq.md#applereq1),
    [BananaReq.BananaReq1.class](../../components/schemas/BananaReq.md#bananareq1)
))
| - -### Method Summary -| Modifier and Type | Method and Description | -| ----------------- | ---------------------- | -| String | validate(String arg, SchemaConfiguration configuration) | -| Nothing? | validate(Nothing? arg, SchemaConfiguration configuration) | -| int | validate(int arg, SchemaConfiguration configuration) | -| long | validate(long arg, SchemaConfiguration configuration) | -| float | validate(float arg, SchemaConfiguration configuration) | -| double | validate(double arg, SchemaConfiguration configuration) | -| Number | validate(Number arg, SchemaConfiguration configuration) | -| boolean | validate(boolean arg, SchemaConfiguration configuration) | -| FrozenMap<@Nullable Object> | validate(Map<?, ?> arg, SchemaConfiguration configuration) | -| FrozenList<@Nullable Object> | validate(List arg, SchemaConfiguration configuration) | -| [FruitReq1BoxedString](#fruitreq1boxedstring) | validateAndBox(String arg, SchemaConfiguration configuration) | -| [FruitReq1BoxedVoid](#fruitreq1boxedvoid) | validateAndBox(Nothing? arg, SchemaConfiguration configuration) | -| [FruitReq1BoxedNumber](#fruitreq1boxednumber) | validateAndBox(Number arg, SchemaConfiguration configuration) | -| [FruitReq1BoxedBoolean](#fruitreq1boxedboolean) | validateAndBox(boolean arg, SchemaConfiguration configuration) | -| [FruitReq1BoxedMap](#fruitreq1boxedmap) | validateAndBox(Map<?, ?> arg, SchemaConfiguration configuration) | -| [FruitReq1BoxedList](#fruitreq1boxedlist) | validateAndBox(List arg, SchemaConfiguration configuration) | -| [FruitReq1Boxed](#fruitreq1boxed) | validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) | -| @Nullable Object | validate(@Nullable Object arg, SchemaConfiguration configuration) | - -## Schema0Boxed -public sealed interface Schema0Boxed
-permits
-[Schema0BoxedVoid](#schema0boxedvoid) - -sealed interface that stores validated payloads using boxed classes - -## Schema0BoxedVoid -public record Schema0BoxedVoid
-implements [Schema0Boxed](#schema0boxed) - -record that stores validated null payloads, sealed permits implementation - -### Constructor Summary -| Constructor and Description | -| --------------------------- | -| Schema0BoxedVoid(Nothing? data)
Creates an instance, private visibility | - -### Method Summary -| Modifier and Type | Method and Description | -| ----------------- | ---------------------- | -| Nothing? | data()
validated payload | -| @Nullable Object | getData()
validated payload | - -## Schema0 -public static class Schema0
-extends NullJsonSchema.NullJsonSchema1 - -A schema class that validates payloads - -| Methods Inherited from class org.openapijsonschematools.client.schemas.NullJsonSchema.NullJsonSchema1 | -| ------------------------------------------------------------------ | -| validate | -| validateAndBox | - -[[Back to top]](#top) [[Back to Component Schemas]](../../../README.md#Component-Schemas) [[Back to README]](../../../README.md) diff --git a/samples/client/petstore/kotlin/docs/components/schemas/GmFruit.md b/samples/client/petstore/kotlin/docs/components/schemas/GmFruit.md deleted file mode 100644 index f5b138715f4..00000000000 --- a/samples/client/petstore/kotlin/docs/components/schemas/GmFruit.md +++ /dev/null @@ -1,251 +0,0 @@ -# GmFruit -org.openapijsonschematools.client.components.schemas.GmFruit.java -public class GmFruit
- -A class that contains necessary nested -- schema classes (which validate payloads), extends JsonSchema -- sealed interfaces which store validated payloads, java version of a sum type -- boxed classes which store validated payloads, sealed permits class implementations -- classes to store validated map payloads, extends FrozenMap -- classes to build inputs for map payloads - -## Nested Class Summary -| Modifier and Type | Class and Description | -| ----------------- | ---------------------- | -| sealed interface | [GmFruit.GmFruit1Boxed](#gmfruit1boxed)
sealed interface for validated payloads | -| record | [GmFruit.GmFruit1BoxedVoid](#gmfruit1boxedvoid)
boxed class to store validated null payloads | -| record | [GmFruit.GmFruit1BoxedBoolean](#gmfruit1boxedboolean)
boxed class to store validated boolean payloads | -| record | [GmFruit.GmFruit1BoxedNumber](#gmfruit1boxednumber)
boxed class to store validated Number payloads | -| record | [GmFruit.GmFruit1BoxedString](#gmfruit1boxedstring)
boxed class to store validated String payloads | -| record | [GmFruit.GmFruit1BoxedList](#gmfruit1boxedlist)
boxed class to store validated List payloads | -| record | [GmFruit.GmFruit1BoxedMap](#gmfruit1boxedmap)
boxed class to store validated Map payloads | -| static class | [GmFruit.GmFruit1](#gmfruit1)
schema class | -| static class | [GmFruit.GmFruitMapBuilder](#gmfruitmapbuilder)
builder for Map payloads | -| static class | [GmFruit.GmFruitMap](#gmfruitmap)
output class for Map payloads | -| sealed interface | [GmFruit.ColorBoxed](#colorboxed)
sealed interface for validated payloads | -| record | [GmFruit.ColorBoxedString](#colorboxedstring)
boxed class to store validated String payloads | -| static class | [GmFruit.Color](#color)
schema class | - -## GmFruit1Boxed -public sealed interface GmFruit1Boxed
-permits
-[GmFruit1BoxedVoid](#gmfruit1boxedvoid), -[GmFruit1BoxedBoolean](#gmfruit1boxedboolean), -[GmFruit1BoxedNumber](#gmfruit1boxednumber), -[GmFruit1BoxedString](#gmfruit1boxedstring), -[GmFruit1BoxedList](#gmfruit1boxedlist), -[GmFruit1BoxedMap](#gmfruit1boxedmap) - -sealed interface that stores validated payloads using boxed classes - -## GmFruit1BoxedVoid -public record GmFruit1BoxedVoid
-implements [GmFruit1Boxed](#gmfruit1boxed) - -record that stores validated null payloads, sealed permits implementation - -### Constructor Summary -| Constructor and Description | -| --------------------------- | -| GmFruit1BoxedVoid(Nothing? data)
Creates an instance, private visibility | - -### Method Summary -| Modifier and Type | Method and Description | -| ----------------- | ---------------------- | -| Nothing? | data()
validated payload | -| @Nullable Object | getData()
validated payload | - -## GmFruit1BoxedBoolean -public record GmFruit1BoxedBoolean
-implements [GmFruit1Boxed](#gmfruit1boxed) - -record that stores validated boolean payloads, sealed permits implementation - -### Constructor Summary -| Constructor and Description | -| --------------------------- | -| GmFruit1BoxedBoolean(boolean data)
Creates an instance, private visibility | - -### Method Summary -| Modifier and Type | Method and Description | -| ----------------- | ---------------------- | -| boolean | data()
validated payload | -| @Nullable Object | getData()
validated payload | - -## GmFruit1BoxedNumber -public record GmFruit1BoxedNumber
-implements [GmFruit1Boxed](#gmfruit1boxed) - -record that stores validated Number payloads, sealed permits implementation - -### Constructor Summary -| Constructor and Description | -| --------------------------- | -| GmFruit1BoxedNumber(Number data)
Creates an instance, private visibility | - -### Method Summary -| Modifier and Type | Method and Description | -| ----------------- | ---------------------- | -| Number | data()
validated payload | -| @Nullable Object | getData()
validated payload | - -## GmFruit1BoxedString -public record GmFruit1BoxedString
-implements [GmFruit1Boxed](#gmfruit1boxed) - -record that stores validated String payloads, sealed permits implementation - -### Constructor Summary -| Constructor and Description | -| --------------------------- | -| GmFruit1BoxedString(String data)
Creates an instance, private visibility | - -### Method Summary -| Modifier and Type | Method and Description | -| ----------------- | ---------------------- | -| String | data()
validated payload | -| @Nullable Object | getData()
validated payload | - -## GmFruit1BoxedList -public record GmFruit1BoxedList
-implements [GmFruit1Boxed](#gmfruit1boxed) - -record that stores validated List payloads, sealed permits implementation - -### Constructor Summary -| Constructor and Description | -| --------------------------- | -| GmFruit1BoxedList(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 | - -## GmFruit1BoxedMap -public record GmFruit1BoxedMap
-implements [GmFruit1Boxed](#gmfruit1boxed) - -record that stores validated Map payloads, sealed permits implementation - -### Constructor Summary -| Constructor and Description | -| --------------------------- | -| GmFruit1BoxedMap([GmFruitMap](#gmfruitmap) data)
Creates an instance, private visibility | - -### Method Summary -| Modifier and Type | Method and Description | -| ----------------- | ---------------------- | -| [GmFruitMap](#gmfruitmap) | data()
validated payload | -| @Nullable Object | getData()
validated payload | - -## GmFruit1 -public static class GmFruit1
-extends JsonSchema - -A schema class that validates payloads - -### Field Summary -| Modifier and Type | Field and Description | -| ----------------- | ---------------------- | -| Map> | properties = Map.ofEntries(
    new PropertyEntry("color", [Color.class](#color)))
)
| -| List> | anyOf = List.of(
    [Apple.Apple1.class](../../components/schemas/Apple.md#apple1),
    [Banana.Banana1.class](../../components/schemas/Banana.md#banana1)
)
| - -### Method Summary -| Modifier and Type | Method and Description | -| ----------------- | ---------------------- | -| String | validate(String arg, SchemaConfiguration configuration) | -| Nothing? | validate(Nothing? arg, SchemaConfiguration configuration) | -| int | validate(int arg, SchemaConfiguration configuration) | -| long | validate(long arg, SchemaConfiguration configuration) | -| float | validate(float arg, SchemaConfiguration configuration) | -| double | validate(double arg, SchemaConfiguration configuration) | -| Number | validate(Number arg, SchemaConfiguration configuration) | -| boolean | validate(boolean arg, SchemaConfiguration configuration) | -| [GmFruitMap](#gmfruitmap) | validate([Map<?, ?>](#gmfruitmapbuilder) arg, SchemaConfiguration configuration) | -| FrozenList<@Nullable Object> | validate(List arg, SchemaConfiguration configuration) | -| [GmFruit1BoxedString](#gmfruit1boxedstring) | validateAndBox(String arg, SchemaConfiguration configuration) | -| [GmFruit1BoxedVoid](#gmfruit1boxedvoid) | validateAndBox(Nothing? arg, SchemaConfiguration configuration) | -| [GmFruit1BoxedNumber](#gmfruit1boxednumber) | validateAndBox(Number arg, SchemaConfiguration configuration) | -| [GmFruit1BoxedBoolean](#gmfruit1boxedboolean) | validateAndBox(boolean arg, SchemaConfiguration configuration) | -| [GmFruit1BoxedMap](#gmfruit1boxedmap) | validateAndBox([Map<?, ?>](#gmfruitmapbuilder) arg, SchemaConfiguration configuration) | -| [GmFruit1BoxedList](#gmfruit1boxedlist) | validateAndBox(List arg, SchemaConfiguration configuration) | -| [GmFruit1Boxed](#gmfruit1boxed) | validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) | -| @Nullable Object | validate(@Nullable Object arg, SchemaConfiguration configuration) | - -## GmFruitMapBuilder -public class GmFruitMapBuilder
-builder for `Map` - -A class that builds the Map input type - -### Constructor Summary -| Constructor and Description | -| --------------------------- | -| GmFruitMapBuilder()
Creates a builder that contains an empty map | - -### Method Summary -| Modifier and Type | Method and Description | -| ----------------- | ---------------------- | -| Map | build()
Returns map input that should be used with Schema.validate | -| [GmFruitMapBuilder](#gmfruitmapbuilder) | color(String value) | -| [GmFruitMapBuilder](#gmfruitmapbuilder) | additionalProperty(String key, Nothing? value) | -| [GmFruitMapBuilder](#gmfruitmapbuilder) | additionalProperty(String key, boolean value) | -| [GmFruitMapBuilder](#gmfruitmapbuilder) | additionalProperty(String key, String value) | -| [GmFruitMapBuilder](#gmfruitmapbuilder) | additionalProperty(String key, int value) | -| [GmFruitMapBuilder](#gmfruitmapbuilder) | additionalProperty(String key, float value) | -| [GmFruitMapBuilder](#gmfruitmapbuilder) | additionalProperty(String key, long value) | -| [GmFruitMapBuilder](#gmfruitmapbuilder) | additionalProperty(String key, double value) | -| [GmFruitMapBuilder](#gmfruitmapbuilder) | additionalProperty(String key, List value) | -| [GmFruitMapBuilder](#gmfruitmapbuilder) | additionalProperty(String key, Map value) | - -## GmFruitMap -public static class GmFruitMap
-extends FrozenMap - -A class to store validated Map payloads - -### Method Summary -| Modifier and Type | Method and Description | -| ----------------- | ---------------------- | -| static [GmFruitMap](#gmfruitmap) | of([Map](#gmfruitmapbuilder) arg, SchemaConfiguration configuration) | -| String | color()
[optional] | -| @Nullable Object | getAdditionalProperty(String name)
provides type safety for additional properties | - -## ColorBoxed -public sealed interface ColorBoxed
-permits
-[ColorBoxedString](#colorboxedstring) - -sealed interface that stores validated payloads using boxed classes - -## ColorBoxedString -public record ColorBoxedString
-implements [ColorBoxed](#colorboxed) - -record that stores validated String payloads, sealed permits implementation - -### Constructor Summary -| Constructor and Description | -| --------------------------- | -| ColorBoxedString(String data)
Creates an instance, private visibility | - -### Method Summary -| Modifier and Type | Method and Description | -| ----------------- | ---------------------- | -| String | data()
validated payload | -| @Nullable Object | getData()
validated payload | - -## Color -public static class Color
-extends StringJsonSchema.StringJsonSchema1 - -A schema class that validates payloads - -| Methods Inherited from class org.openapijsonschematools.client.schemas.StringJsonSchema.StringJsonSchema1 | -| ------------------------------------------------------------------ | -| validate | -| validateAndBox | - -[[Back to top]](#top) [[Back to Component Schemas]](../../../README.md#Component-Schemas) [[Back to README]](../../../README.md) diff --git a/samples/client/petstore/kotlin/docs/components/schemas/GrandparentAnimal.md b/samples/client/petstore/kotlin/docs/components/schemas/GrandparentAnimal.md deleted file mode 100644 index 7850a898319..00000000000 --- a/samples/client/petstore/kotlin/docs/components/schemas/GrandparentAnimal.md +++ /dev/null @@ -1,185 +0,0 @@ -# GrandparentAnimal -org.openapijsonschematools.client.components.schemas.GrandparentAnimal.java -public class GrandparentAnimal
- -A class that contains necessary nested -- schema classes (which validate payloads), extends JsonSchema -- sealed interfaces which store validated payloads, java version of a sum type -- boxed classes which store validated payloads, sealed permits class implementations -- classes to store validated map payloads, extends FrozenMap -- classes to build inputs for map payloads - -## Nested Class Summary -| Modifier and Type | Class and Description | -| ----------------- | ---------------------- | -| sealed interface | [GrandparentAnimal.GrandparentAnimal1Boxed](#grandparentanimal1boxed)
sealed interface for validated payloads | -| record | [GrandparentAnimal.GrandparentAnimal1BoxedMap](#grandparentanimal1boxedmap)
boxed class to store validated Map payloads | -| static class | [GrandparentAnimal.GrandparentAnimal1](#grandparentanimal1)
schema class | -| static class | [GrandparentAnimal.GrandparentAnimalMapBuilder](#grandparentanimalmapbuilder)
builder for Map payloads | -| static class | [GrandparentAnimal.GrandparentAnimalMap](#grandparentanimalmap)
output class for Map payloads | -| sealed interface | [GrandparentAnimal.PetTypeBoxed](#pettypeboxed)
sealed interface for validated payloads | -| record | [GrandparentAnimal.PetTypeBoxedString](#pettypeboxedstring)
boxed class to store validated String payloads | -| static class | [GrandparentAnimal.PetType](#pettype)
schema class | - -## GrandparentAnimal1Boxed -public sealed interface GrandparentAnimal1Boxed
-permits
-[GrandparentAnimal1BoxedMap](#grandparentanimal1boxedmap) - -sealed interface that stores validated payloads using boxed classes - -## GrandparentAnimal1BoxedMap -public record GrandparentAnimal1BoxedMap
-implements [GrandparentAnimal1Boxed](#grandparentanimal1boxed) - -record that stores validated Map payloads, sealed permits implementation - -### Constructor Summary -| Constructor and Description | -| --------------------------- | -| GrandparentAnimal1BoxedMap([GrandparentAnimalMap](#grandparentanimalmap) data)
Creates an instance, private visibility | - -### Method Summary -| Modifier and Type | Method and Description | -| ----------------- | ---------------------- | -| [GrandparentAnimalMap](#grandparentanimalmap) | data()
validated payload | -| @Nullable Object | getData()
validated payload | - -## GrandparentAnimal1 -public static class GrandparentAnimal1
-extends JsonSchema - -A schema class that validates payloads - -### Code Sample -``` -import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags; -import org.openapijsonschematools.client.configurations.SchemaConfiguration; -import org.openapijsonschematools.client.exceptions.ValidationException; -import org.openapijsonschematools.client.schemas.validation.MapUtils; -import org.openapijsonschematools.client.schemas.validation.FrozenList; -import org.openapijsonschematools.client.schemas.validation.FrozenMap; -import org.openapijsonschematools.client.components.schemas.GrandparentAnimal; - -import java.util.Arrays; -import java.util.List; -import java.util.AbstractMap; - -static final SchemaConfiguration configuration = new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().build()); - -// Map validation -GrandparentAnimal.GrandparentAnimalMap validatedPayload = - GrandparentAnimal.GrandparentAnimal1.validate( - new GrandparentAnimal.GrandparentAnimalMapBuilder() - .pet_type("a") - - .build(), - configuration -); -``` - -### Field Summary -| Modifier and Type | Field and Description | -| ----------------- | ---------------------- | -| Set> | type = Set.of(Map.class) | -| Map> | properties = Map.ofEntries(
    new PropertyEntry("pet_type", [PetType.class](#pettype)))
)
| -| Set | required = Set.of(
    "pet_type"
)
| - -### Method Summary -| Modifier and Type | Method and Description | -| ----------------- | ---------------------- | -| [GrandparentAnimalMap](#grandparentanimalmap) | validate([Map<?, ?>](#grandparentanimalmapbuilder) arg, SchemaConfiguration configuration) | -| [GrandparentAnimal1BoxedMap](#grandparentanimal1boxedmap) | validateAndBox([Map<?, ?>](#grandparentanimalmapbuilder) arg, SchemaConfiguration configuration) | -| [GrandparentAnimal1Boxed](#grandparentanimal1boxed) | validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) | -| @Nullable Object | validate(@Nullable Object arg, SchemaConfiguration configuration) | - -## GrandparentAnimalMap0Builder -public class GrandparentAnimalMap0Builder
-builder for `Map` - -A class that builds the Map input type - -### Constructor Summary -| Constructor and Description | -| --------------------------- | -| GrandparentAnimalMap0Builder(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 | -| [GrandparentAnimalMap0Builder](#grandparentanimalmap0builder) | additionalProperty(String key, Nothing? value) | -| [GrandparentAnimalMap0Builder](#grandparentanimalmap0builder) | additionalProperty(String key, boolean value) | -| [GrandparentAnimalMap0Builder](#grandparentanimalmap0builder) | additionalProperty(String key, String value) | -| [GrandparentAnimalMap0Builder](#grandparentanimalmap0builder) | additionalProperty(String key, int value) | -| [GrandparentAnimalMap0Builder](#grandparentanimalmap0builder) | additionalProperty(String key, float value) | -| [GrandparentAnimalMap0Builder](#grandparentanimalmap0builder) | additionalProperty(String key, long value) | -| [GrandparentAnimalMap0Builder](#grandparentanimalmap0builder) | additionalProperty(String key, double value) | -| [GrandparentAnimalMap0Builder](#grandparentanimalmap0builder) | additionalProperty(String key, List value) | -| [GrandparentAnimalMap0Builder](#grandparentanimalmap0builder) | additionalProperty(String key, Map value) | - -## GrandparentAnimalMapBuilder -public class GrandparentAnimalMapBuilder
-builder for `Map` - -A class that builds the Map input type - -### Constructor Summary -| Constructor and Description | -| --------------------------- | -| GrandparentAnimalMapBuilder()
Creates a builder that contains an empty map | - -### Method Summary -| Modifier and Type | Method and Description | -| ----------------- | ---------------------- | -| [GrandparentAnimalMap0Builder](#grandparentanimalmap0builder) | pet_type(String value) | - -## GrandparentAnimalMap -public static class GrandparentAnimalMap
-extends FrozenMap - -A class to store validated Map payloads - -### Method Summary -| Modifier and Type | Method and Description | -| ----------------- | ---------------------- | -| static [GrandparentAnimalMap](#grandparentanimalmap) | of([Map](#grandparentanimalmapbuilder) arg, SchemaConfiguration configuration) | -| String | pet_type()
| -| @Nullable Object | getAdditionalProperty(String name)
provides type safety for additional properties | - -## PetTypeBoxed -public sealed interface PetTypeBoxed
-permits
-[PetTypeBoxedString](#pettypeboxedstring) - -sealed interface that stores validated payloads using boxed classes - -## PetTypeBoxedString -public record PetTypeBoxedString
-implements [PetTypeBoxed](#pettypeboxed) - -record that stores validated String payloads, sealed permits implementation - -### Constructor Summary -| Constructor and Description | -| --------------------------- | -| PetTypeBoxedString(String data)
Creates an instance, private visibility | - -### Method Summary -| Modifier and Type | Method and Description | -| ----------------- | ---------------------- | -| String | data()
validated payload | -| @Nullable Object | getData()
validated payload | - -## PetType -public static class PetType
-extends StringJsonSchema.StringJsonSchema1 - -A schema class that validates payloads - -| Methods Inherited from class org.openapijsonschematools.client.schemas.StringJsonSchema.StringJsonSchema1 | -| ------------------------------------------------------------------ | -| validate | -| validateAndBox | - -[[Back to top]](#top) [[Back to Component Schemas]](../../../README.md#Component-Schemas) [[Back to README]](../../../README.md) diff --git a/samples/client/petstore/kotlin/docs/components/schemas/HasOnlyReadOnly.md b/samples/client/petstore/kotlin/docs/components/schemas/HasOnlyReadOnly.md deleted file mode 100644 index b521426d668..00000000000 --- a/samples/client/petstore/kotlin/docs/components/schemas/HasOnlyReadOnly.md +++ /dev/null @@ -1,211 +0,0 @@ -# HasOnlyReadOnly -org.openapijsonschematools.client.components.schemas.HasOnlyReadOnly.java -public class HasOnlyReadOnly
- -A class that contains necessary nested -- schema classes (which validate payloads), extends JsonSchema -- sealed interfaces which store validated payloads, java version of a sum type -- boxed classes which store validated payloads, sealed permits class implementations -- classes to store validated map payloads, extends FrozenMap -- classes to build inputs for map payloads - -## Nested Class Summary -| Modifier and Type | Class and Description | -| ----------------- | ---------------------- | -| sealed interface | [HasOnlyReadOnly.HasOnlyReadOnly1Boxed](#hasonlyreadonly1boxed)
sealed interface for validated payloads | -| record | [HasOnlyReadOnly.HasOnlyReadOnly1BoxedMap](#hasonlyreadonly1boxedmap)
boxed class to store validated Map payloads | -| static class | [HasOnlyReadOnly.HasOnlyReadOnly1](#hasonlyreadonly1)
schema class | -| static class | [HasOnlyReadOnly.HasOnlyReadOnlyMapBuilder](#hasonlyreadonlymapbuilder)
builder for Map payloads | -| static class | [HasOnlyReadOnly.HasOnlyReadOnlyMap](#hasonlyreadonlymap)
output class for Map payloads | -| sealed interface | [HasOnlyReadOnly.FooBoxed](#fooboxed)
sealed interface for validated payloads | -| record | [HasOnlyReadOnly.FooBoxedString](#fooboxedstring)
boxed class to store validated String payloads | -| static class | [HasOnlyReadOnly.Foo](#foo)
schema class | -| sealed interface | [HasOnlyReadOnly.BarBoxed](#barboxed)
sealed interface for validated payloads | -| record | [HasOnlyReadOnly.BarBoxedString](#barboxedstring)
boxed class to store validated String payloads | -| static class | [HasOnlyReadOnly.Bar](#bar)
schema class | - -## HasOnlyReadOnly1Boxed -public sealed interface HasOnlyReadOnly1Boxed
-permits
-[HasOnlyReadOnly1BoxedMap](#hasonlyreadonly1boxedmap) - -sealed interface that stores validated payloads using boxed classes - -## HasOnlyReadOnly1BoxedMap -public record HasOnlyReadOnly1BoxedMap
-implements [HasOnlyReadOnly1Boxed](#hasonlyreadonly1boxed) - -record that stores validated Map payloads, sealed permits implementation - -### Constructor Summary -| Constructor and Description | -| --------------------------- | -| HasOnlyReadOnly1BoxedMap([HasOnlyReadOnlyMap](#hasonlyreadonlymap) data)
Creates an instance, private visibility | - -### Method Summary -| Modifier and Type | Method and Description | -| ----------------- | ---------------------- | -| [HasOnlyReadOnlyMap](#hasonlyreadonlymap) | data()
validated payload | -| @Nullable Object | getData()
validated payload | - -## HasOnlyReadOnly1 -public static class HasOnlyReadOnly1
-extends JsonSchema - -A schema class that validates payloads - -### Code Sample -``` -import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags; -import org.openapijsonschematools.client.configurations.SchemaConfiguration; -import org.openapijsonschematools.client.exceptions.ValidationException; -import org.openapijsonschematools.client.schemas.validation.MapUtils; -import org.openapijsonschematools.client.schemas.validation.FrozenList; -import org.openapijsonschematools.client.schemas.validation.FrozenMap; -import org.openapijsonschematools.client.components.schemas.HasOnlyReadOnly; - -import java.util.Arrays; -import java.util.List; -import java.util.AbstractMap; - -static final SchemaConfiguration configuration = new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().build()); - -// Map validation -HasOnlyReadOnly.HasOnlyReadOnlyMap validatedPayload = - HasOnlyReadOnly.HasOnlyReadOnly1.validate( - new HasOnlyReadOnly.HasOnlyReadOnlyMapBuilder() - .bar("a") - - .foo("a") - - .build(), - configuration -); -``` - -### Field Summary -| Modifier and Type | Field and Description | -| ----------------- | ---------------------- | -| Set> | type = Set.of(Map.class) | -| Map> | properties = Map.ofEntries(
    new PropertyEntry("bar", [Bar.class](#bar))),
    new PropertyEntry("foo", [Foo.class](#foo)))
)
| - -### Method Summary -| Modifier and Type | Method and Description | -| ----------------- | ---------------------- | -| [HasOnlyReadOnlyMap](#hasonlyreadonlymap) | validate([Map<?, ?>](#hasonlyreadonlymapbuilder) arg, SchemaConfiguration configuration) | -| [HasOnlyReadOnly1BoxedMap](#hasonlyreadonly1boxedmap) | validateAndBox([Map<?, ?>](#hasonlyreadonlymapbuilder) arg, SchemaConfiguration configuration) | -| [HasOnlyReadOnly1Boxed](#hasonlyreadonly1boxed) | validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) | -| @Nullable Object | validate(@Nullable Object arg, SchemaConfiguration configuration) | - -## HasOnlyReadOnlyMapBuilder -public class HasOnlyReadOnlyMapBuilder
-builder for `Map` - -A class that builds the Map input type - -### Constructor Summary -| Constructor and Description | -| --------------------------- | -| HasOnlyReadOnlyMapBuilder()
Creates a builder that contains an empty map | - -### Method Summary -| Modifier and Type | Method and Description | -| ----------------- | ---------------------- | -| Map | build()
Returns map input that should be used with Schema.validate | -| [HasOnlyReadOnlyMapBuilder](#hasonlyreadonlymapbuilder) | bar(String value) | -| [HasOnlyReadOnlyMapBuilder](#hasonlyreadonlymapbuilder) | foo(String value) | -| [HasOnlyReadOnlyMapBuilder](#hasonlyreadonlymapbuilder) | additionalProperty(String key, Nothing? value) | -| [HasOnlyReadOnlyMapBuilder](#hasonlyreadonlymapbuilder) | additionalProperty(String key, boolean value) | -| [HasOnlyReadOnlyMapBuilder](#hasonlyreadonlymapbuilder) | additionalProperty(String key, String value) | -| [HasOnlyReadOnlyMapBuilder](#hasonlyreadonlymapbuilder) | additionalProperty(String key, int value) | -| [HasOnlyReadOnlyMapBuilder](#hasonlyreadonlymapbuilder) | additionalProperty(String key, float value) | -| [HasOnlyReadOnlyMapBuilder](#hasonlyreadonlymapbuilder) | additionalProperty(String key, long value) | -| [HasOnlyReadOnlyMapBuilder](#hasonlyreadonlymapbuilder) | additionalProperty(String key, double value) | -| [HasOnlyReadOnlyMapBuilder](#hasonlyreadonlymapbuilder) | additionalProperty(String key, List value) | -| [HasOnlyReadOnlyMapBuilder](#hasonlyreadonlymapbuilder) | additionalProperty(String key, Map value) | - -## HasOnlyReadOnlyMap -public static class HasOnlyReadOnlyMap
-extends FrozenMap - -A class to store validated Map payloads - -### Method Summary -| Modifier and Type | Method and Description | -| ----------------- | ---------------------- | -| static [HasOnlyReadOnlyMap](#hasonlyreadonlymap) | of([Map](#hasonlyreadonlymapbuilder) arg, SchemaConfiguration configuration) | -| String | bar()
[optional] | -| String | foo()
[optional] | -| @Nullable Object | getAdditionalProperty(String name)
provides type safety for additional properties | - -## FooBoxed -public sealed interface FooBoxed
-permits
-[FooBoxedString](#fooboxedstring) - -sealed interface that stores validated payloads using boxed classes - -## FooBoxedString -public record FooBoxedString
-implements [FooBoxed](#fooboxed) - -record that stores validated String payloads, sealed permits implementation - -### Constructor Summary -| Constructor and Description | -| --------------------------- | -| FooBoxedString(String data)
Creates an instance, private visibility | - -### Method Summary -| Modifier and Type | Method and Description | -| ----------------- | ---------------------- | -| String | data()
validated payload | -| @Nullable Object | getData()
validated payload | - -## Foo -public static class Foo
-extends StringJsonSchema.StringJsonSchema1 - -A schema class that validates payloads - -| Methods Inherited from class org.openapijsonschematools.client.schemas.StringJsonSchema.StringJsonSchema1 | -| ------------------------------------------------------------------ | -| validate | -| validateAndBox | - -## BarBoxed -public sealed interface BarBoxed
-permits
-[BarBoxedString](#barboxedstring) - -sealed interface that stores validated payloads using boxed classes - -## BarBoxedString -public record BarBoxedString
-implements [BarBoxed](#barboxed) - -record that stores validated String payloads, sealed permits implementation - -### Constructor Summary -| Constructor and Description | -| --------------------------- | -| BarBoxedString(String data)
Creates an instance, private visibility | - -### Method Summary -| Modifier and Type | Method and Description | -| ----------------- | ---------------------- | -| String | data()
validated payload | -| @Nullable Object | getData()
validated payload | - -## Bar -public static class Bar
-extends StringJsonSchema.StringJsonSchema1 - -A schema class that validates payloads - -| Methods Inherited from class org.openapijsonschematools.client.schemas.StringJsonSchema.StringJsonSchema1 | -| ------------------------------------------------------------------ | -| validate | -| validateAndBox | - -[[Back to top]](#top) [[Back to Component Schemas]](../../../README.md#Component-Schemas) [[Back to README]](../../../README.md) diff --git a/samples/client/petstore/kotlin/docs/components/schemas/HealthCheckResult.md b/samples/client/petstore/kotlin/docs/components/schemas/HealthCheckResult.md deleted file mode 100644 index 518fb4c4b67..00000000000 --- a/samples/client/petstore/kotlin/docs/components/schemas/HealthCheckResult.md +++ /dev/null @@ -1,231 +0,0 @@ -# HealthCheckResult -org.openapijsonschematools.client.components.schemas.HealthCheckResult.java -public class HealthCheckResult
- -A class that contains necessary nested -- schema classes (which validate payloads), extends JsonSchema -- sealed interfaces which store validated payloads, java version of a sum type -- boxed classes which store validated payloads, sealed permits class implementations -- classes to store validated map payloads, extends FrozenMap -- classes to build inputs for map payloads - -## Nested Class Summary -| Modifier and Type | Class and Description | -| ----------------- | ---------------------- | -| sealed interface | [HealthCheckResult.HealthCheckResult1Boxed](#healthcheckresult1boxed)
sealed interface for validated payloads | -| record | [HealthCheckResult.HealthCheckResult1BoxedMap](#healthcheckresult1boxedmap)
boxed class to store validated Map payloads | -| static class | [HealthCheckResult.HealthCheckResult1](#healthcheckresult1)
schema class | -| static class | [HealthCheckResult.HealthCheckResultMapBuilder](#healthcheckresultmapbuilder)
builder for Map payloads | -| static class | [HealthCheckResult.HealthCheckResultMap](#healthcheckresultmap)
output class for Map payloads | -| sealed interface | [HealthCheckResult.NullableMessageBoxed](#nullablemessageboxed)
sealed interface for validated payloads | -| record | [HealthCheckResult.NullableMessageBoxedVoid](#nullablemessageboxedvoid)
boxed class to store validated null payloads | -| record | [HealthCheckResult.NullableMessageBoxedString](#nullablemessageboxedstring)
boxed class to store validated String payloads | -| static class | [HealthCheckResult.NullableMessage](#nullablemessage)
schema class | - -## HealthCheckResult1Boxed -public sealed interface HealthCheckResult1Boxed
-permits
-[HealthCheckResult1BoxedMap](#healthcheckresult1boxedmap) - -sealed interface that stores validated payloads using boxed classes - -## HealthCheckResult1BoxedMap -public record HealthCheckResult1BoxedMap
-implements [HealthCheckResult1Boxed](#healthcheckresult1boxed) - -record that stores validated Map payloads, sealed permits implementation - -### Constructor Summary -| Constructor and Description | -| --------------------------- | -| HealthCheckResult1BoxedMap([HealthCheckResultMap](#healthcheckresultmap) data)
Creates an instance, private visibility | - -### Method Summary -| Modifier and Type | Method and Description | -| ----------------- | ---------------------- | -| [HealthCheckResultMap](#healthcheckresultmap) | data()
validated payload | -| @Nullable Object | getData()
validated payload | - -## HealthCheckResult1 -public static class HealthCheckResult1
-extends JsonSchema - -A schema class that validates payloads - -## Description -Just a string to inform instance is up and running. Make it nullable in hope to get it as pointer in generated model. - -### Code Sample -``` -import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags; -import org.openapijsonschematools.client.configurations.SchemaConfiguration; -import org.openapijsonschematools.client.exceptions.ValidationException; -import org.openapijsonschematools.client.schemas.validation.MapUtils; -import org.openapijsonschematools.client.schemas.validation.FrozenList; -import org.openapijsonschematools.client.schemas.validation.FrozenMap; -import org.openapijsonschematools.client.components.schemas.HealthCheckResult; - -import java.util.Arrays; -import java.util.List; -import java.util.AbstractMap; - -static final SchemaConfiguration configuration = new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().build()); - -// Map validation -HealthCheckResult.HealthCheckResultMap validatedPayload = - HealthCheckResult.HealthCheckResult1.validate( - new HealthCheckResult.HealthCheckResultMapBuilder() - .NullableMessage(null) - - .build(), - configuration -); -``` - -### Field Summary -| Modifier and Type | Field and Description | -| ----------------- | ---------------------- | -| Set> | type = Set.of(Map.class) | -| Map> | properties = Map.ofEntries(
    new PropertyEntry("NullableMessage", [NullableMessage.class](#nullablemessage)))
)
| - -### Method Summary -| Modifier and Type | Method and Description | -| ----------------- | ---------------------- | -| [HealthCheckResultMap](#healthcheckresultmap) | validate([Map<?, ?>](#healthcheckresultmapbuilder) arg, SchemaConfiguration configuration) | -| [HealthCheckResult1BoxedMap](#healthcheckresult1boxedmap) | validateAndBox([Map<?, ?>](#healthcheckresultmapbuilder) arg, SchemaConfiguration configuration) | -| [HealthCheckResult1Boxed](#healthcheckresult1boxed) | validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) | -| @Nullable Object | validate(@Nullable Object arg, SchemaConfiguration configuration) | - -## HealthCheckResultMapBuilder -public class HealthCheckResultMapBuilder
-builder for `Map` - -A class that builds the Map input type - -### Constructor Summary -| Constructor and Description | -| --------------------------- | -| HealthCheckResultMapBuilder()
Creates a builder that contains an empty map | - -### Method Summary -| Modifier and Type | Method and Description | -| ----------------- | ---------------------- | -| Map | build()
Returns map input that should be used with Schema.validate | -| [HealthCheckResultMapBuilder](#healthcheckresultmapbuilder) | NullableMessage(Nothing? value) | -| [HealthCheckResultMapBuilder](#healthcheckresultmapbuilder) | NullableMessage(String value) | -| [HealthCheckResultMapBuilder](#healthcheckresultmapbuilder) | additionalProperty(String key, Nothing? value) | -| [HealthCheckResultMapBuilder](#healthcheckresultmapbuilder) | additionalProperty(String key, boolean value) | -| [HealthCheckResultMapBuilder](#healthcheckresultmapbuilder) | additionalProperty(String key, String value) | -| [HealthCheckResultMapBuilder](#healthcheckresultmapbuilder) | additionalProperty(String key, int value) | -| [HealthCheckResultMapBuilder](#healthcheckresultmapbuilder) | additionalProperty(String key, float value) | -| [HealthCheckResultMapBuilder](#healthcheckresultmapbuilder) | additionalProperty(String key, long value) | -| [HealthCheckResultMapBuilder](#healthcheckresultmapbuilder) | additionalProperty(String key, double value) | -| [HealthCheckResultMapBuilder](#healthcheckresultmapbuilder) | additionalProperty(String key, List value) | -| [HealthCheckResultMapBuilder](#healthcheckresultmapbuilder) | additionalProperty(String key, Map value) | - -## HealthCheckResultMap -public static class HealthCheckResultMap
-extends FrozenMap - -A class to store validated Map payloads - -### Method Summary -| Modifier and Type | Method and Description | -| ----------------- | ---------------------- | -| static [HealthCheckResultMap](#healthcheckresultmap) | of([Map](#healthcheckresultmapbuilder) arg, SchemaConfiguration configuration) | -| @Nullable String | NullableMessage()
[optional] | -| @Nullable Object | getAdditionalProperty(String name)
provides type safety for additional properties | - -## NullableMessageBoxed -public sealed interface NullableMessageBoxed
-permits
-[NullableMessageBoxedVoid](#nullablemessageboxedvoid), -[NullableMessageBoxedString](#nullablemessageboxedstring) - -sealed interface that stores validated payloads using boxed classes - -## NullableMessageBoxedVoid -public record NullableMessageBoxedVoid
-implements [NullableMessageBoxed](#nullablemessageboxed) - -record that stores validated null payloads, sealed permits implementation - -### Constructor Summary -| Constructor and Description | -| --------------------------- | -| NullableMessageBoxedVoid(Nothing? data)
Creates an instance, private visibility | - -### Method Summary -| Modifier and Type | Method and Description | -| ----------------- | ---------------------- | -| Nothing? | data()
validated payload | -| @Nullable Object | getData()
validated payload | - -## NullableMessageBoxedString -public record NullableMessageBoxedString
-implements [NullableMessageBoxed](#nullablemessageboxed) - -record that stores validated String payloads, sealed permits implementation - -### Constructor Summary -| Constructor and Description | -| --------------------------- | -| NullableMessageBoxedString(String data)
Creates an instance, private visibility | - -### Method Summary -| Modifier and Type | Method and Description | -| ----------------- | ---------------------- | -| String | data()
validated payload | -| @Nullable Object | getData()
validated payload | - -## NullableMessage -public static class NullableMessage
-extends JsonSchema - -A schema class that validates payloads - -### Code Sample -``` -import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags; -import org.openapijsonschematools.client.configurations.SchemaConfiguration; -import org.openapijsonschematools.client.exceptions.ValidationException; -import org.openapijsonschematools.client.schemas.validation.MapUtils; -import org.openapijsonschematools.client.schemas.validation.FrozenList; -import org.openapijsonschematools.client.schemas.validation.FrozenMap; -import org.openapijsonschematools.client.components.schemas.HealthCheckResult; - -import java.util.Arrays; -import java.util.List; -import java.util.AbstractMap; - -static final SchemaConfiguration configuration = new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().build()); - -// null validation -Nothing? validatedPayload = HealthCheckResult.NullableMessage.validate( - (Nothing?) null, - configuration -); - -// String validation -String validatedPayload = HealthCheckResult.NullableMessage.validate( - "a", - configuration -); -``` - -### Field Summary -| Modifier and Type | Field and Description | -| ----------------- | ---------------------- | -| Set> | type = Set.of(
    Nothing?.class,
    String.class
)
| - -### Method Summary -| Modifier and Type | Method and Description | -| ----------------- | ---------------------- | -| Nothing? | validate(Nothing? arg, SchemaConfiguration configuration) | -| [NullableMessageBoxedVoid](#nullablemessageboxedvoid) | validateAndBox(Nothing? arg, SchemaConfiguration configuration) | -| String | validate(String arg, SchemaConfiguration configuration) | -| [NullableMessageBoxedString](#nullablemessageboxedstring) | validateAndBox(String arg, SchemaConfiguration configuration) | -| [NullableMessageBoxed](#nullablemessageboxed) | validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) | -| @Nullable Object | validate(@Nullable Object arg, SchemaConfiguration configuration) | - -[[Back to top]](#top) [[Back to Component Schemas]](../../../README.md#Component-Schemas) [[Back to README]](../../../README.md) diff --git a/samples/client/petstore/kotlin/docs/components/schemas/IntegerEnum.md b/samples/client/petstore/kotlin/docs/components/schemas/IntegerEnum.md deleted file mode 100644 index 56dd47dc072..00000000000 --- a/samples/client/petstore/kotlin/docs/components/schemas/IntegerEnum.md +++ /dev/null @@ -1,142 +0,0 @@ -# IntegerEnum -org.openapijsonschematools.client.components.schemas.IntegerEnum.java -public class IntegerEnum
- -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 -- enum classes - -## Nested Class Summary -| Modifier and Type | Class and Description | -| ----------------- | ---------------------- | -| sealed interface | [IntegerEnum.IntegerEnum1Boxed](#integerenum1boxed)
sealed interface for validated payloads | -| record | [IntegerEnum.IntegerEnum1BoxedNumber](#integerenum1boxednumber)
boxed class to store validated Number payloads | -| static class | [IntegerEnum.IntegerEnum1](#integerenum1)
schema class | -| enum | [IntegerEnum.IntegerIntegerEnumEnums](#integerintegerenumenums)
Integer enum | -| enum | [IntegerEnum.LongIntegerEnumEnums](#longintegerenumenums)
Long enum | -| enum | [IntegerEnum.FloatIntegerEnumEnums](#floatintegerenumenums)
Float enum | -| enum | [IntegerEnum.DoubleIntegerEnumEnums](#doubleintegerenumenums)
Double enum | - -## IntegerEnum1Boxed -public sealed interface IntegerEnum1Boxed
-permits
-[IntegerEnum1BoxedNumber](#integerenum1boxednumber) - -sealed interface that stores validated payloads using boxed classes - -## IntegerEnum1BoxedNumber -public record IntegerEnum1BoxedNumber
-implements [IntegerEnum1Boxed](#integerenum1boxed) - -record that stores validated Number payloads, sealed permits implementation - -### Constructor Summary -| Constructor and Description | -| --------------------------- | -| IntegerEnum1BoxedNumber(Number data)
Creates an instance, private visibility | - -### Method Summary -| Modifier and Type | Method and Description | -| ----------------- | ---------------------- | -| Number | data()
validated payload | -| @Nullable Object | getData()
validated payload | - -## IntegerEnum1 -public static class IntegerEnum1
-extends JsonSchema - -A schema class that validates payloads - -### Code Sample -``` -import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags; -import org.openapijsonschematools.client.configurations.SchemaConfiguration; -import org.openapijsonschematools.client.exceptions.ValidationException; -import org.openapijsonschematools.client.schemas.validation.MapUtils; -import org.openapijsonschematools.client.schemas.validation.FrozenList; -import org.openapijsonschematools.client.schemas.validation.FrozenMap; -import org.openapijsonschematools.client.components.schemas.IntegerEnum; - -import java.util.Arrays; -import java.util.List; -import java.util.AbstractMap; - -static final SchemaConfiguration configuration = new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().build()); - -// int validation -int validatedPayload = IntegerEnum.IntegerEnum1.validate( - 1L, - configuration -); -``` - -### Field Summary -| Modifier and Type | Field and Description | -| ----------------- | ---------------------- | -| Set> | type = Set.of(
    Integer.class,
    Long.class,
    Float.class,
    Double.class
)
| -| String | type = "int"; | -| Set | enumValues = SetMaker.makeSet(
    0,
    1,
    2
)
| - -### Method Summary -| Modifier and Type | Method and Description | -| ----------------- | ---------------------- | -| long | validate(long arg, SchemaConfiguration configuration) | -| [IntegerEnum1BoxedNumber](#integerenum1boxednumber) | validateAndBox(Number arg, SchemaConfiguration configuration) | -| [IntegerEnum1Boxed](#integerenum1boxed) | validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) | -| @Nullable Object | validate(@Nullable Object arg, SchemaConfiguration configuration) | - -## IntegerIntegerEnumEnums -public enum IntegerIntegerEnumEnums
-extends `Enum` - -A class that stores Integer enum values - -### Enum Constant Summary -| Enum Constant | Description | -| ------------- | ----------- | -| POSITIVE_0 | value = 0 | -| POSITIVE_1 | value = 1 | -| POSITIVE_2 | value = 2 | - -## LongIntegerEnumEnums -public enum LongIntegerEnumEnums
-extends `Enum` - -A class that stores Long enum values - -### Enum Constant Summary -| Enum Constant | Description | -| ------------- | ----------- | -| POSITIVE_0 | value = 0L | -| POSITIVE_1 | value = 1L | -| POSITIVE_2 | value = 2L | - -## FloatIntegerEnumEnums -public enum FloatIntegerEnumEnums
-extends `Enum` - -A class that stores Float enum values - -### Enum Constant Summary -| Enum Constant | Description | -| ------------- | ----------- | -| POSITIVE_0 | value = 0.0f | -| POSITIVE_1 | value = 1.0f | -| POSITIVE_2 | value = 2.0f | - -## DoubleIntegerEnumEnums -public enum DoubleIntegerEnumEnums
-extends `Enum` - -A class that stores Double enum values - -### Enum Constant Summary -| Enum Constant | Description | -| ------------- | ----------- | -| POSITIVE_0 | value = 0.0d | -| POSITIVE_1 | value = 1.0d | -| POSITIVE_2 | value = 2.0d | - -[[Back to top]](#top) [[Back to Component Schemas]](../../../README.md#Component-Schemas) [[Back to README]](../../../README.md) diff --git a/samples/client/petstore/kotlin/docs/components/schemas/IntegerEnumBig.md b/samples/client/petstore/kotlin/docs/components/schemas/IntegerEnumBig.md deleted file mode 100644 index df5967575a1..00000000000 --- a/samples/client/petstore/kotlin/docs/components/schemas/IntegerEnumBig.md +++ /dev/null @@ -1,142 +0,0 @@ -# IntegerEnumBig -org.openapijsonschematools.client.components.schemas.IntegerEnumBig.java -public class IntegerEnumBig
- -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 -- enum classes - -## Nested Class Summary -| Modifier and Type | Class and Description | -| ----------------- | ---------------------- | -| sealed interface | [IntegerEnumBig.IntegerEnumBig1Boxed](#integerenumbig1boxed)
sealed interface for validated payloads | -| record | [IntegerEnumBig.IntegerEnumBig1BoxedNumber](#integerenumbig1boxednumber)
boxed class to store validated Number payloads | -| static class | [IntegerEnumBig.IntegerEnumBig1](#integerenumbig1)
schema class | -| enum | [IntegerEnumBig.IntegerIntegerEnumBigEnums](#integerintegerenumbigenums)
Integer enum | -| enum | [IntegerEnumBig.LongIntegerEnumBigEnums](#longintegerenumbigenums)
Long enum | -| enum | [IntegerEnumBig.FloatIntegerEnumBigEnums](#floatintegerenumbigenums)
Float enum | -| enum | [IntegerEnumBig.DoubleIntegerEnumBigEnums](#doubleintegerenumbigenums)
Double enum | - -## IntegerEnumBig1Boxed -public sealed interface IntegerEnumBig1Boxed
-permits
-[IntegerEnumBig1BoxedNumber](#integerenumbig1boxednumber) - -sealed interface that stores validated payloads using boxed classes - -## IntegerEnumBig1BoxedNumber -public record IntegerEnumBig1BoxedNumber
-implements [IntegerEnumBig1Boxed](#integerenumbig1boxed) - -record that stores validated Number payloads, sealed permits implementation - -### Constructor Summary -| Constructor and Description | -| --------------------------- | -| IntegerEnumBig1BoxedNumber(Number data)
Creates an instance, private visibility | - -### Method Summary -| Modifier and Type | Method and Description | -| ----------------- | ---------------------- | -| Number | data()
validated payload | -| @Nullable Object | getData()
validated payload | - -## IntegerEnumBig1 -public static class IntegerEnumBig1
-extends JsonSchema - -A schema class that validates payloads - -### Code Sample -``` -import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags; -import org.openapijsonschematools.client.configurations.SchemaConfiguration; -import org.openapijsonschematools.client.exceptions.ValidationException; -import org.openapijsonschematools.client.schemas.validation.MapUtils; -import org.openapijsonschematools.client.schemas.validation.FrozenList; -import org.openapijsonschematools.client.schemas.validation.FrozenMap; -import org.openapijsonschematools.client.components.schemas.IntegerEnumBig; - -import java.util.Arrays; -import java.util.List; -import java.util.AbstractMap; - -static final SchemaConfiguration configuration = new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().build()); - -// int validation -int validatedPayload = IntegerEnumBig.IntegerEnumBig1.validate( - 1L, - configuration -); -``` - -### Field Summary -| Modifier and Type | Field and Description | -| ----------------- | ---------------------- | -| Set> | type = Set.of(
    Integer.class,
    Long.class,
    Float.class,
    Double.class
)
| -| String | type = "int"; | -| Set | enumValues = SetMaker.makeSet(
    10,
    11,
    12
)
| - -### Method Summary -| Modifier and Type | Method and Description | -| ----------------- | ---------------------- | -| long | validate(long arg, SchemaConfiguration configuration) | -| [IntegerEnumBig1BoxedNumber](#integerenumbig1boxednumber) | validateAndBox(Number arg, SchemaConfiguration configuration) | -| [IntegerEnumBig1Boxed](#integerenumbig1boxed) | validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) | -| @Nullable Object | validate(@Nullable Object arg, SchemaConfiguration configuration) | - -## IntegerIntegerEnumBigEnums -public enum IntegerIntegerEnumBigEnums
-extends `Enum` - -A class that stores Integer enum values - -### Enum Constant Summary -| Enum Constant | Description | -| ------------- | ----------- | -| POSITIVE_10 | value = 10 | -| POSITIVE_11 | value = 11 | -| POSITIVE_12 | value = 12 | - -## LongIntegerEnumBigEnums -public enum LongIntegerEnumBigEnums
-extends `Enum` - -A class that stores Long enum values - -### Enum Constant Summary -| Enum Constant | Description | -| ------------- | ----------- | -| POSITIVE_10 | value = 10L | -| POSITIVE_11 | value = 11L | -| POSITIVE_12 | value = 12L | - -## FloatIntegerEnumBigEnums -public enum FloatIntegerEnumBigEnums
-extends `Enum` - -A class that stores Float enum values - -### Enum Constant Summary -| Enum Constant | Description | -| ------------- | ----------- | -| POSITIVE_10 | value = 10.0f | -| POSITIVE_11 | value = 11.0f | -| POSITIVE_12 | value = 12.0f | - -## DoubleIntegerEnumBigEnums -public enum DoubleIntegerEnumBigEnums
-extends `Enum` - -A class that stores Double enum values - -### Enum Constant Summary -| Enum Constant | Description | -| ------------- | ----------- | -| POSITIVE_10 | value = 10.0d | -| POSITIVE_11 | value = 11.0d | -| POSITIVE_12 | value = 12.0d | - -[[Back to top]](#top) [[Back to Component Schemas]](../../../README.md#Component-Schemas) [[Back to README]](../../../README.md) diff --git a/samples/client/petstore/kotlin/docs/components/schemas/IntegerEnumOneValue.md b/samples/client/petstore/kotlin/docs/components/schemas/IntegerEnumOneValue.md deleted file mode 100644 index 76e57df77d2..00000000000 --- a/samples/client/petstore/kotlin/docs/components/schemas/IntegerEnumOneValue.md +++ /dev/null @@ -1,134 +0,0 @@ -# IntegerEnumOneValue -org.openapijsonschematools.client.components.schemas.IntegerEnumOneValue.java -public class IntegerEnumOneValue
- -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 -- enum classes - -## Nested Class Summary -| Modifier and Type | Class and Description | -| ----------------- | ---------------------- | -| sealed interface | [IntegerEnumOneValue.IntegerEnumOneValue1Boxed](#integerenumonevalue1boxed)
sealed interface for validated payloads | -| record | [IntegerEnumOneValue.IntegerEnumOneValue1BoxedNumber](#integerenumonevalue1boxednumber)
boxed class to store validated Number payloads | -| static class | [IntegerEnumOneValue.IntegerEnumOneValue1](#integerenumonevalue1)
schema class | -| enum | [IntegerEnumOneValue.IntegerIntegerEnumOneValueEnums](#integerintegerenumonevalueenums)
Integer enum | -| enum | [IntegerEnumOneValue.LongIntegerEnumOneValueEnums](#longintegerenumonevalueenums)
Long enum | -| enum | [IntegerEnumOneValue.FloatIntegerEnumOneValueEnums](#floatintegerenumonevalueenums)
Float enum | -| enum | [IntegerEnumOneValue.DoubleIntegerEnumOneValueEnums](#doubleintegerenumonevalueenums)
Double enum | - -## IntegerEnumOneValue1Boxed -public sealed interface IntegerEnumOneValue1Boxed
-permits
-[IntegerEnumOneValue1BoxedNumber](#integerenumonevalue1boxednumber) - -sealed interface that stores validated payloads using boxed classes - -## IntegerEnumOneValue1BoxedNumber -public record IntegerEnumOneValue1BoxedNumber
-implements [IntegerEnumOneValue1Boxed](#integerenumonevalue1boxed) - -record that stores validated Number payloads, sealed permits implementation - -### Constructor Summary -| Constructor and Description | -| --------------------------- | -| IntegerEnumOneValue1BoxedNumber(Number data)
Creates an instance, private visibility | - -### Method Summary -| Modifier and Type | Method and Description | -| ----------------- | ---------------------- | -| Number | data()
validated payload | -| @Nullable Object | getData()
validated payload | - -## IntegerEnumOneValue1 -public static class IntegerEnumOneValue1
-extends JsonSchema - -A schema class that validates payloads - -### Code Sample -``` -import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags; -import org.openapijsonschematools.client.configurations.SchemaConfiguration; -import org.openapijsonschematools.client.exceptions.ValidationException; -import org.openapijsonschematools.client.schemas.validation.MapUtils; -import org.openapijsonschematools.client.schemas.validation.FrozenList; -import org.openapijsonschematools.client.schemas.validation.FrozenMap; -import org.openapijsonschematools.client.components.schemas.IntegerEnumOneValue; - -import java.util.Arrays; -import java.util.List; -import java.util.AbstractMap; - -static final SchemaConfiguration configuration = new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().build()); - -// int validation -int validatedPayload = IntegerEnumOneValue.IntegerEnumOneValue1.validate( - 1L, - configuration -); -``` - -### Field Summary -| Modifier and Type | Field and Description | -| ----------------- | ---------------------- | -| Set> | type = Set.of(
    Integer.class,
    Long.class,
    Float.class,
    Double.class
)
| -| String | type = "int"; | -| Set | enumValues = SetMaker.makeSet(
    0
)
| - -### Method Summary -| Modifier and Type | Method and Description | -| ----------------- | ---------------------- | -| long | validate(long arg, SchemaConfiguration configuration) | -| [IntegerEnumOneValue1BoxedNumber](#integerenumonevalue1boxednumber) | validateAndBox(Number arg, SchemaConfiguration configuration) | -| [IntegerEnumOneValue1Boxed](#integerenumonevalue1boxed) | validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) | -| @Nullable Object | validate(@Nullable Object arg, SchemaConfiguration configuration) | - -## IntegerIntegerEnumOneValueEnums -public enum IntegerIntegerEnumOneValueEnums
-extends `Enum` - -A class that stores Integer enum values - -### Enum Constant Summary -| Enum Constant | Description | -| ------------- | ----------- | -| POSITIVE_0 | value = 0 | - -## LongIntegerEnumOneValueEnums -public enum LongIntegerEnumOneValueEnums
-extends `Enum` - -A class that stores Long enum values - -### Enum Constant Summary -| Enum Constant | Description | -| ------------- | ----------- | -| POSITIVE_0 | value = 0L | - -## FloatIntegerEnumOneValueEnums -public enum FloatIntegerEnumOneValueEnums
-extends `Enum` - -A class that stores Float enum values - -### Enum Constant Summary -| Enum Constant | Description | -| ------------- | ----------- | -| POSITIVE_0 | value = 0.0f | - -## DoubleIntegerEnumOneValueEnums -public enum DoubleIntegerEnumOneValueEnums
-extends `Enum` - -A class that stores Double enum values - -### Enum Constant Summary -| Enum Constant | Description | -| ------------- | ----------- | -| POSITIVE_0 | value = 0.0d | - -[[Back to top]](#top) [[Back to Component Schemas]](../../../README.md#Component-Schemas) [[Back to README]](../../../README.md) diff --git a/samples/client/petstore/kotlin/docs/components/schemas/IntegerEnumWithDefaultValue.md b/samples/client/petstore/kotlin/docs/components/schemas/IntegerEnumWithDefaultValue.md deleted file mode 100644 index d45ff7f8046..00000000000 --- a/samples/client/petstore/kotlin/docs/components/schemas/IntegerEnumWithDefaultValue.md +++ /dev/null @@ -1,143 +0,0 @@ -# IntegerEnumWithDefaultValue -org.openapijsonschematools.client.components.schemas.IntegerEnumWithDefaultValue.java -public class IntegerEnumWithDefaultValue
- -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 -- enum classes - -## Nested Class Summary -| Modifier and Type | Class and Description | -| ----------------- | ---------------------- | -| sealed interface | [IntegerEnumWithDefaultValue.IntegerEnumWithDefaultValue1Boxed](#integerenumwithdefaultvalue1boxed)
sealed interface for validated payloads | -| record | [IntegerEnumWithDefaultValue.IntegerEnumWithDefaultValue1BoxedNumber](#integerenumwithdefaultvalue1boxednumber)
boxed class to store validated Number payloads | -| static class | [IntegerEnumWithDefaultValue.IntegerEnumWithDefaultValue1](#integerenumwithdefaultvalue1)
schema class | -| enum | [IntegerEnumWithDefaultValue.IntegerIntegerEnumWithDefaultValueEnums](#integerintegerenumwithdefaultvalueenums)
Integer enum | -| enum | [IntegerEnumWithDefaultValue.LongIntegerEnumWithDefaultValueEnums](#longintegerenumwithdefaultvalueenums)
Long enum | -| enum | [IntegerEnumWithDefaultValue.FloatIntegerEnumWithDefaultValueEnums](#floatintegerenumwithdefaultvalueenums)
Float enum | -| enum | [IntegerEnumWithDefaultValue.DoubleIntegerEnumWithDefaultValueEnums](#doubleintegerenumwithdefaultvalueenums)
Double enum | - -## IntegerEnumWithDefaultValue1Boxed -public sealed interface IntegerEnumWithDefaultValue1Boxed
-permits
-[IntegerEnumWithDefaultValue1BoxedNumber](#integerenumwithdefaultvalue1boxednumber) - -sealed interface that stores validated payloads using boxed classes - -## IntegerEnumWithDefaultValue1BoxedNumber -public record IntegerEnumWithDefaultValue1BoxedNumber
-implements [IntegerEnumWithDefaultValue1Boxed](#integerenumwithdefaultvalue1boxed) - -record that stores validated Number payloads, sealed permits implementation - -### Constructor Summary -| Constructor and Description | -| --------------------------- | -| IntegerEnumWithDefaultValue1BoxedNumber(Number data)
Creates an instance, private visibility | - -### Method Summary -| Modifier and Type | Method and Description | -| ----------------- | ---------------------- | -| Number | data()
validated payload | -| @Nullable Object | getData()
validated payload | - -## IntegerEnumWithDefaultValue1 -public static class IntegerEnumWithDefaultValue1
-extends JsonSchema - -A schema class that validates payloads - -### Code Sample -``` -import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags; -import org.openapijsonschematools.client.configurations.SchemaConfiguration; -import org.openapijsonschematools.client.exceptions.ValidationException; -import org.openapijsonschematools.client.schemas.validation.MapUtils; -import org.openapijsonschematools.client.schemas.validation.FrozenList; -import org.openapijsonschematools.client.schemas.validation.FrozenMap; -import org.openapijsonschematools.client.components.schemas.IntegerEnumWithDefaultValue; - -import java.util.Arrays; -import java.util.List; -import java.util.AbstractMap; - -static final SchemaConfiguration configuration = new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().build()); - -// int validation -int validatedPayload = IntegerEnumWithDefaultValue.IntegerEnumWithDefaultValue1.validate( - 1L, - configuration -); -``` - -### Field Summary -| Modifier and Type | Field and Description | -| ----------------- | ---------------------- | -| Set> | type = Set.of(
    Integer.class,
    Long.class,
    Float.class,
    Double.class
)
| -| String | type = "int"; | -| Set | enumValues = SetMaker.makeSet(
    0,
    1,
    2
)
| -| @Nullable Object | defaultValue = 0 | - -### Method Summary -| Modifier and Type | Method and Description | -| ----------------- | ---------------------- | -| long | validate(long arg, SchemaConfiguration configuration) | -| [IntegerEnumWithDefaultValue1BoxedNumber](#integerenumwithdefaultvalue1boxednumber) | validateAndBox(Number arg, SchemaConfiguration configuration) | -| [IntegerEnumWithDefaultValue1Boxed](#integerenumwithdefaultvalue1boxed) | validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) | -| @Nullable Object | validate(@Nullable Object arg, SchemaConfiguration configuration) | - -## IntegerIntegerEnumWithDefaultValueEnums -public enum IntegerIntegerEnumWithDefaultValueEnums
-extends `Enum` - -A class that stores Integer enum values - -### Enum Constant Summary -| Enum Constant | Description | -| ------------- | ----------- | -| POSITIVE_0 | value = 0 | -| POSITIVE_1 | value = 1 | -| POSITIVE_2 | value = 2 | - -## LongIntegerEnumWithDefaultValueEnums -public enum LongIntegerEnumWithDefaultValueEnums
-extends `Enum` - -A class that stores Long enum values - -### Enum Constant Summary -| Enum Constant | Description | -| ------------- | ----------- | -| POSITIVE_0 | value = 0L | -| POSITIVE_1 | value = 1L | -| POSITIVE_2 | value = 2L | - -## FloatIntegerEnumWithDefaultValueEnums -public enum FloatIntegerEnumWithDefaultValueEnums
-extends `Enum` - -A class that stores Float enum values - -### Enum Constant Summary -| Enum Constant | Description | -| ------------- | ----------- | -| POSITIVE_0 | value = 0.0f | -| POSITIVE_1 | value = 1.0f | -| POSITIVE_2 | value = 2.0f | - -## DoubleIntegerEnumWithDefaultValueEnums -public enum DoubleIntegerEnumWithDefaultValueEnums
-extends `Enum` - -A class that stores Double enum values - -### Enum Constant Summary -| Enum Constant | Description | -| ------------- | ----------- | -| POSITIVE_0 | value = 0.0d | -| POSITIVE_1 | value = 1.0d | -| POSITIVE_2 | value = 2.0d | - -[[Back to top]](#top) [[Back to Component Schemas]](../../../README.md#Component-Schemas) [[Back to README]](../../../README.md) diff --git a/samples/client/petstore/kotlin/docs/components/schemas/IntegerMax10.md b/samples/client/petstore/kotlin/docs/components/schemas/IntegerMax10.md deleted file mode 100644 index dcaf721386d..00000000000 --- a/samples/client/petstore/kotlin/docs/components/schemas/IntegerMax10.md +++ /dev/null @@ -1,85 +0,0 @@ -# IntegerMax10 -org.openapijsonschematools.client.components.schemas.IntegerMax10.java -public class IntegerMax10
- -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 - -## Nested Class Summary -| Modifier and Type | Class and Description | -| ----------------- | ---------------------- | -| sealed interface | [IntegerMax10.IntegerMax101Boxed](#integermax101boxed)
sealed interface for validated payloads | -| record | [IntegerMax10.IntegerMax101BoxedNumber](#integermax101boxednumber)
boxed class to store validated Number payloads | -| static class | [IntegerMax10.IntegerMax101](#integermax101)
schema class | - -## IntegerMax101Boxed -public sealed interface IntegerMax101Boxed
-permits
-[IntegerMax101BoxedNumber](#integermax101boxednumber) - -sealed interface that stores validated payloads using boxed classes - -## IntegerMax101BoxedNumber -public record IntegerMax101BoxedNumber
-implements [IntegerMax101Boxed](#integermax101boxed) - -record that stores validated Number payloads, sealed permits implementation - -### Constructor Summary -| Constructor and Description | -| --------------------------- | -| IntegerMax101BoxedNumber(Number data)
Creates an instance, private visibility | - -### Method Summary -| Modifier and Type | Method and Description | -| ----------------- | ---------------------- | -| Number | data()
validated payload | -| @Nullable Object | getData()
validated payload | - -## IntegerMax101 -public static class IntegerMax101
-extends JsonSchema - -A schema class that validates payloads - -### Code Sample -``` -import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags; -import org.openapijsonschematools.client.configurations.SchemaConfiguration; -import org.openapijsonschematools.client.exceptions.ValidationException; -import org.openapijsonschematools.client.schemas.validation.MapUtils; -import org.openapijsonschematools.client.schemas.validation.FrozenList; -import org.openapijsonschematools.client.schemas.validation.FrozenMap; -import org.openapijsonschematools.client.components.schemas.IntegerMax10; - -import java.util.Arrays; -import java.util.List; -import java.util.AbstractMap; - -static final SchemaConfiguration configuration = new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().build()); - -// long validation -long validatedPayload = IntegerMax10.IntegerMax101.validate( - 1L, - configuration -); -``` - -### Field Summary -| Modifier and Type | Field and Description | -| ----------------- | ---------------------- | -| Set> | type = Set.of(
    Integer.class,
    Long.class,
    Float.class,
    Double.class
)
| -| String | type = "int64"; | -| Number | maximum = 10 | - -### Method Summary -| Modifier and Type | Method and Description | -| ----------------- | ---------------------- | -| long | validate(long arg, SchemaConfiguration configuration) | -| [IntegerMax101BoxedNumber](#integermax101boxednumber) | validateAndBox(Number arg, SchemaConfiguration configuration) | -| [IntegerMax101Boxed](#integermax101boxed) | validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) | -| @Nullable Object | validate(@Nullable Object arg, SchemaConfiguration configuration) | - -[[Back to top]](#top) [[Back to Component Schemas]](../../../README.md#Component-Schemas) [[Back to README]](../../../README.md) diff --git a/samples/client/petstore/kotlin/docs/components/schemas/IntegerMin15.md b/samples/client/petstore/kotlin/docs/components/schemas/IntegerMin15.md deleted file mode 100644 index b4b1192132c..00000000000 --- a/samples/client/petstore/kotlin/docs/components/schemas/IntegerMin15.md +++ /dev/null @@ -1,85 +0,0 @@ -# IntegerMin15 -org.openapijsonschematools.client.components.schemas.IntegerMin15.java -public class IntegerMin15
- -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 - -## Nested Class Summary -| Modifier and Type | Class and Description | -| ----------------- | ---------------------- | -| sealed interface | [IntegerMin15.IntegerMin151Boxed](#integermin151boxed)
sealed interface for validated payloads | -| record | [IntegerMin15.IntegerMin151BoxedNumber](#integermin151boxednumber)
boxed class to store validated Number payloads | -| static class | [IntegerMin15.IntegerMin151](#integermin151)
schema class | - -## IntegerMin151Boxed -public sealed interface IntegerMin151Boxed
-permits
-[IntegerMin151BoxedNumber](#integermin151boxednumber) - -sealed interface that stores validated payloads using boxed classes - -## IntegerMin151BoxedNumber -public record IntegerMin151BoxedNumber
-implements [IntegerMin151Boxed](#integermin151boxed) - -record that stores validated Number payloads, sealed permits implementation - -### Constructor Summary -| Constructor and Description | -| --------------------------- | -| IntegerMin151BoxedNumber(Number data)
Creates an instance, private visibility | - -### Method Summary -| Modifier and Type | Method and Description | -| ----------------- | ---------------------- | -| Number | data()
validated payload | -| @Nullable Object | getData()
validated payload | - -## IntegerMin151 -public static class IntegerMin151
-extends JsonSchema - -A schema class that validates payloads - -### Code Sample -``` -import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags; -import org.openapijsonschematools.client.configurations.SchemaConfiguration; -import org.openapijsonschematools.client.exceptions.ValidationException; -import org.openapijsonschematools.client.schemas.validation.MapUtils; -import org.openapijsonschematools.client.schemas.validation.FrozenList; -import org.openapijsonschematools.client.schemas.validation.FrozenMap; -import org.openapijsonschematools.client.components.schemas.IntegerMin15; - -import java.util.Arrays; -import java.util.List; -import java.util.AbstractMap; - -static final SchemaConfiguration configuration = new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().build()); - -// long validation -long validatedPayload = IntegerMin15.IntegerMin151.validate( - 1L, - configuration -); -``` - -### Field Summary -| Modifier and Type | Field and Description | -| ----------------- | ---------------------- | -| Set> | type = Set.of(
    Integer.class,
    Long.class,
    Float.class,
    Double.class
)
| -| String | type = "int64"; | -| Number | minimum = 15 | - -### Method Summary -| Modifier and Type | Method and Description | -| ----------------- | ---------------------- | -| long | validate(long arg, SchemaConfiguration configuration) | -| [IntegerMin151BoxedNumber](#integermin151boxednumber) | validateAndBox(Number arg, SchemaConfiguration configuration) | -| [IntegerMin151Boxed](#integermin151boxed) | validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) | -| @Nullable Object | validate(@Nullable Object arg, SchemaConfiguration configuration) | - -[[Back to top]](#top) [[Back to Component Schemas]](../../../README.md#Component-Schemas) [[Back to README]](../../../README.md) diff --git a/samples/client/petstore/kotlin/docs/components/schemas/IsoscelesTriangle.md b/samples/client/petstore/kotlin/docs/components/schemas/IsoscelesTriangle.md deleted file mode 100644 index e421e54de1b..00000000000 --- a/samples/client/petstore/kotlin/docs/components/schemas/IsoscelesTriangle.md +++ /dev/null @@ -1,371 +0,0 @@ -# IsoscelesTriangle -org.openapijsonschematools.client.components.schemas.IsoscelesTriangle.java -public class IsoscelesTriangle
- -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 | [IsoscelesTriangle.IsoscelesTriangle1Boxed](#isoscelestriangle1boxed)
sealed interface for validated payloads | -| record | [IsoscelesTriangle.IsoscelesTriangle1BoxedVoid](#isoscelestriangle1boxedvoid)
boxed class to store validated null payloads | -| record | [IsoscelesTriangle.IsoscelesTriangle1BoxedBoolean](#isoscelestriangle1boxedboolean)
boxed class to store validated boolean payloads | -| record | [IsoscelesTriangle.IsoscelesTriangle1BoxedNumber](#isoscelestriangle1boxednumber)
boxed class to store validated Number payloads | -| record | [IsoscelesTriangle.IsoscelesTriangle1BoxedString](#isoscelestriangle1boxedstring)
boxed class to store validated String payloads | -| record | [IsoscelesTriangle.IsoscelesTriangle1BoxedList](#isoscelestriangle1boxedlist)
boxed class to store validated List payloads | -| record | [IsoscelesTriangle.IsoscelesTriangle1BoxedMap](#isoscelestriangle1boxedmap)
boxed class to store validated Map payloads | -| static class | [IsoscelesTriangle.IsoscelesTriangle1](#isoscelestriangle1)
schema class | -| sealed interface | [IsoscelesTriangle.Schema1Boxed](#schema1boxed)
sealed interface for validated payloads | -| record | [IsoscelesTriangle.Schema1BoxedMap](#schema1boxedmap)
boxed class to store validated Map payloads | -| static class | [IsoscelesTriangle.Schema1](#schema1)
schema class | -| static class | [IsoscelesTriangle.Schema1MapBuilder](#schema1mapbuilder)
builder for Map payloads | -| static class | [IsoscelesTriangle.Schema1Map](#schema1map)
output class for Map payloads | -| sealed interface | [IsoscelesTriangle.TriangleTypeBoxed](#triangletypeboxed)
sealed interface for validated payloads | -| record | [IsoscelesTriangle.TriangleTypeBoxedString](#triangletypeboxedstring)
boxed class to store validated String payloads | -| static class | [IsoscelesTriangle.TriangleType](#triangletype)
schema class | -| enum | [IsoscelesTriangle.StringTriangleTypeEnums](#stringtriangletypeenums)
String enum | - -## IsoscelesTriangle1Boxed -public sealed interface IsoscelesTriangle1Boxed
-permits
-[IsoscelesTriangle1BoxedVoid](#isoscelestriangle1boxedvoid), -[IsoscelesTriangle1BoxedBoolean](#isoscelestriangle1boxedboolean), -[IsoscelesTriangle1BoxedNumber](#isoscelestriangle1boxednumber), -[IsoscelesTriangle1BoxedString](#isoscelestriangle1boxedstring), -[IsoscelesTriangle1BoxedList](#isoscelestriangle1boxedlist), -[IsoscelesTriangle1BoxedMap](#isoscelestriangle1boxedmap) - -sealed interface that stores validated payloads using boxed classes - -## IsoscelesTriangle1BoxedVoid -public record IsoscelesTriangle1BoxedVoid
-implements [IsoscelesTriangle1Boxed](#isoscelestriangle1boxed) - -record that stores validated null payloads, sealed permits implementation - -### Constructor Summary -| Constructor and Description | -| --------------------------- | -| IsoscelesTriangle1BoxedVoid(Nothing? data)
Creates an instance, private visibility | - -### Method Summary -| Modifier and Type | Method and Description | -| ----------------- | ---------------------- | -| Nothing? | data()
validated payload | -| @Nullable Object | getData()
validated payload | - -## IsoscelesTriangle1BoxedBoolean -public record IsoscelesTriangle1BoxedBoolean
-implements [IsoscelesTriangle1Boxed](#isoscelestriangle1boxed) - -record that stores validated boolean payloads, sealed permits implementation - -### Constructor Summary -| Constructor and Description | -| --------------------------- | -| IsoscelesTriangle1BoxedBoolean(boolean data)
Creates an instance, private visibility | - -### Method Summary -| Modifier and Type | Method and Description | -| ----------------- | ---------------------- | -| boolean | data()
validated payload | -| @Nullable Object | getData()
validated payload | - -## IsoscelesTriangle1BoxedNumber -public record IsoscelesTriangle1BoxedNumber
-implements [IsoscelesTriangle1Boxed](#isoscelestriangle1boxed) - -record that stores validated Number payloads, sealed permits implementation - -### Constructor Summary -| Constructor and Description | -| --------------------------- | -| IsoscelesTriangle1BoxedNumber(Number data)
Creates an instance, private visibility | - -### Method Summary -| Modifier and Type | Method and Description | -| ----------------- | ---------------------- | -| Number | data()
validated payload | -| @Nullable Object | getData()
validated payload | - -## IsoscelesTriangle1BoxedString -public record IsoscelesTriangle1BoxedString
-implements [IsoscelesTriangle1Boxed](#isoscelestriangle1boxed) - -record that stores validated String payloads, sealed permits implementation - -### Constructor Summary -| Constructor and Description | -| --------------------------- | -| IsoscelesTriangle1BoxedString(String data)
Creates an instance, private visibility | - -### Method Summary -| Modifier and Type | Method and Description | -| ----------------- | ---------------------- | -| String | data()
validated payload | -| @Nullable Object | getData()
validated payload | - -## IsoscelesTriangle1BoxedList -public record IsoscelesTriangle1BoxedList
-implements [IsoscelesTriangle1Boxed](#isoscelestriangle1boxed) - -record that stores validated List payloads, sealed permits implementation - -### Constructor Summary -| Constructor and Description | -| --------------------------- | -| IsoscelesTriangle1BoxedList(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 | - -## IsoscelesTriangle1BoxedMap -public record IsoscelesTriangle1BoxedMap
-implements [IsoscelesTriangle1Boxed](#isoscelestriangle1boxed) - -record that stores validated Map payloads, sealed permits implementation - -### Constructor Summary -| Constructor and Description | -| --------------------------- | -| IsoscelesTriangle1BoxedMap(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 | - -## IsoscelesTriangle1 -public static class IsoscelesTriangle1
-extends JsonSchema - -A schema class that validates payloads - -### Field Summary -| Modifier and Type | Field and Description | -| ----------------- | ---------------------- | -| List> | allOf = List.of(
    [TriangleInterface.TriangleInterface1.class](../../components/schemas/TriangleInterface.md#triangleinterface1),
    [Schema1.class](#schema1)
;)
| - -### Method Summary -| Modifier and Type | Method and Description | -| ----------------- | ---------------------- | -| String | validate(String arg, SchemaConfiguration configuration) | -| Nothing? | validate(Nothing? arg, SchemaConfiguration configuration) | -| int | validate(int arg, SchemaConfiguration configuration) | -| long | validate(long arg, SchemaConfiguration configuration) | -| float | validate(float arg, SchemaConfiguration configuration) | -| double | validate(double arg, SchemaConfiguration configuration) | -| Number | validate(Number arg, SchemaConfiguration configuration) | -| boolean | validate(boolean arg, SchemaConfiguration configuration) | -| FrozenMap<@Nullable Object> | validate(Map<?, ?> arg, SchemaConfiguration configuration) | -| FrozenList<@Nullable Object> | validate(List arg, SchemaConfiguration configuration) | -| [IsoscelesTriangle1BoxedString](#isoscelestriangle1boxedstring) | validateAndBox(String arg, SchemaConfiguration configuration) | -| [IsoscelesTriangle1BoxedVoid](#isoscelestriangle1boxedvoid) | validateAndBox(Nothing? arg, SchemaConfiguration configuration) | -| [IsoscelesTriangle1BoxedNumber](#isoscelestriangle1boxednumber) | validateAndBox(Number arg, SchemaConfiguration configuration) | -| [IsoscelesTriangle1BoxedBoolean](#isoscelestriangle1boxedboolean) | validateAndBox(boolean arg, SchemaConfiguration configuration) | -| [IsoscelesTriangle1BoxedMap](#isoscelestriangle1boxedmap) | validateAndBox(Map<?, ?> arg, SchemaConfiguration configuration) | -| [IsoscelesTriangle1BoxedList](#isoscelestriangle1boxedlist) | validateAndBox(List arg, SchemaConfiguration configuration) | -| [IsoscelesTriangle1Boxed](#isoscelestriangle1boxed) | validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) | -| @Nullable Object | validate(@Nullable Object arg, SchemaConfiguration configuration) | - -## Schema1Boxed -public sealed interface Schema1Boxed
-permits
-[Schema1BoxedMap](#schema1boxedmap) - -sealed interface that stores validated payloads using boxed classes - -## Schema1BoxedMap -public record Schema1BoxedMap
-implements [Schema1Boxed](#schema1boxed) - -record that stores validated Map payloads, sealed permits implementation - -### Constructor Summary -| Constructor and Description | -| --------------------------- | -| Schema1BoxedMap([Schema1Map](#schema1map) data)
Creates an instance, private visibility | - -### Method Summary -| Modifier and Type | Method and Description | -| ----------------- | ---------------------- | -| [Schema1Map](#schema1map) | data()
validated payload | -| @Nullable Object | getData()
validated payload | - -## Schema1 -public static class Schema1
-extends JsonSchema - -A schema class that validates payloads - -### Code Sample -``` -import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags; -import org.openapijsonschematools.client.configurations.SchemaConfiguration; -import org.openapijsonschematools.client.exceptions.ValidationException; -import org.openapijsonschematools.client.schemas.validation.MapUtils; -import org.openapijsonschematools.client.schemas.validation.FrozenList; -import org.openapijsonschematools.client.schemas.validation.FrozenMap; -import org.openapijsonschematools.client.components.schemas.IsoscelesTriangle; - -import java.util.Arrays; -import java.util.List; -import java.util.AbstractMap; - -static final SchemaConfiguration configuration = new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().build()); - -// Map validation -IsoscelesTriangle.Schema1Map validatedPayload = - IsoscelesTriangle.Schema1.validate( - new IsoscelesTriangle.Schema1MapBuilder() - .triangleType("IsoscelesTriangle") - - .build(), - configuration -); -``` - -### Field Summary -| Modifier and Type | Field and Description | -| ----------------- | ---------------------- | -| Set> | type = Set.of(Map.class) | -| Map> | properties = Map.ofEntries(
    new PropertyEntry("triangleType", [TriangleType.class](#triangletype)))
)
| - -### Method Summary -| Modifier and Type | Method and Description | -| ----------------- | ---------------------- | -| [Schema1Map](#schema1map) | validate([Map<?, ?>](#schema1mapbuilder) arg, SchemaConfiguration configuration) | -| [Schema1BoxedMap](#schema1boxedmap) | validateAndBox([Map<?, ?>](#schema1mapbuilder) arg, SchemaConfiguration configuration) | -| [Schema1Boxed](#schema1boxed) | validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) | -| @Nullable Object | validate(@Nullable Object arg, SchemaConfiguration configuration) | - -## Schema1MapBuilder -public class Schema1MapBuilder
-builder for `Map` - -A class that builds the Map input type - -### Constructor Summary -| Constructor and Description | -| --------------------------- | -| Schema1MapBuilder()
Creates a builder that contains an empty map | - -### Method Summary -| Modifier and Type | Method and Description | -| ----------------- | ---------------------- | -| Map | build()
Returns map input that should be used with Schema.validate | -| [Schema1MapBuilder](#schema1mapbuilder) | triangleType(String value) | -| [Schema1MapBuilder](#schema1mapbuilder) | triangleType([StringTriangleTypeEnums](#stringtriangletypeenums) value) | -| [Schema1MapBuilder](#schema1mapbuilder) | additionalProperty(String key, Nothing? value) | -| [Schema1MapBuilder](#schema1mapbuilder) | additionalProperty(String key, boolean value) | -| [Schema1MapBuilder](#schema1mapbuilder) | additionalProperty(String key, String value) | -| [Schema1MapBuilder](#schema1mapbuilder) | additionalProperty(String key, int value) | -| [Schema1MapBuilder](#schema1mapbuilder) | additionalProperty(String key, float value) | -| [Schema1MapBuilder](#schema1mapbuilder) | additionalProperty(String key, long value) | -| [Schema1MapBuilder](#schema1mapbuilder) | additionalProperty(String key, double value) | -| [Schema1MapBuilder](#schema1mapbuilder) | additionalProperty(String key, List value) | -| [Schema1MapBuilder](#schema1mapbuilder) | additionalProperty(String key, Map value) | - -## Schema1Map -public static class Schema1Map
-extends FrozenMap - -A class to store validated Map payloads - -### Method Summary -| Modifier and Type | Method and Description | -| ----------------- | ---------------------- | -| static [Schema1Map](#schema1map) | of([Map](#schema1mapbuilder) arg, SchemaConfiguration configuration) | -| String | triangleType()
[optional] must be one of ["IsoscelesTriangle"] | -| @Nullable Object | getAdditionalProperty(String name)
provides type safety for additional properties | - -## TriangleTypeBoxed -public sealed interface TriangleTypeBoxed
-permits
-[TriangleTypeBoxedString](#triangletypeboxedstring) - -sealed interface that stores validated payloads using boxed classes - -## TriangleTypeBoxedString -public record TriangleTypeBoxedString
-implements [TriangleTypeBoxed](#triangletypeboxed) - -record that stores validated String payloads, sealed permits implementation - -### Constructor Summary -| Constructor and Description | -| --------------------------- | -| TriangleTypeBoxedString(String data)
Creates an instance, private visibility | - -### Method Summary -| Modifier and Type | Method and Description | -| ----------------- | ---------------------- | -| String | data()
validated payload | -| @Nullable Object | getData()
validated payload | - -## TriangleType -public static class TriangleType
-extends JsonSchema - -A schema class that validates payloads - -### Code Sample -``` -import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags; -import org.openapijsonschematools.client.configurations.SchemaConfiguration; -import org.openapijsonschematools.client.exceptions.ValidationException; -import org.openapijsonschematools.client.schemas.validation.MapUtils; -import org.openapijsonschematools.client.schemas.validation.FrozenList; -import org.openapijsonschematools.client.schemas.validation.FrozenMap; -import org.openapijsonschematools.client.components.schemas.IsoscelesTriangle; - -import java.util.Arrays; -import java.util.List; -import java.util.AbstractMap; - -static final SchemaConfiguration configuration = new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().build()); - -// String validation -String validatedPayload = IsoscelesTriangle.TriangleType.validate( - "IsoscelesTriangle", - configuration -); -``` - -### Field Summary -| Modifier and Type | Field and Description | -| ----------------- | ---------------------- | -| Set> | type = Set.of(
    String.class
)
| -| Set | enumValues = SetMaker.makeSet(
    "IsoscelesTriangle"
)
| - -### Method Summary -| Modifier and Type | Method and Description | -| ----------------- | ---------------------- | -| String | validate(String arg, SchemaConfiguration configuration) | -| String | validate([StringTriangleTypeEnums](#stringtriangletypeenums) arg, SchemaConfiguration configuration) | -| [TriangleTypeBoxedString](#triangletypeboxedstring) | validateAndBox(String arg, SchemaConfiguration configuration) | -| [TriangleTypeBoxed](#triangletypeboxed) | validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) | -| @Nullable Object | validate(@Nullable Object arg, SchemaConfiguration configuration) | - -## StringTriangleTypeEnums -public enum StringTriangleTypeEnums
-extends `Enum` - -A class that stores String enum values - -### Enum Constant Summary -| Enum Constant | Description | -| ------------- | ----------- | -| ISOSCELES_TRIANGLE | value = "IsoscelesTriangle" | - -[[Back to top]](#top) [[Back to Component Schemas]](../../../README.md#Component-Schemas) [[Back to README]](../../../README.md) diff --git a/samples/client/petstore/kotlin/docs/components/schemas/Items.md b/samples/client/petstore/kotlin/docs/components/schemas/Items.md deleted file mode 100644 index ef9402f5f91..00000000000 --- a/samples/client/petstore/kotlin/docs/components/schemas/Items.md +++ /dev/null @@ -1,160 +0,0 @@ -# Items -org.openapijsonschematools.client.components.schemas.Items.java -public class Items
- -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 list payloads, extends FrozenList -- classes to build inputs for list payloads - -## Nested Class Summary -| Modifier and Type | Class and Description | -| ----------------- | ---------------------- | -| sealed interface | [Items.Items1Boxed](#items1boxed)
sealed interface for validated payloads | -| record | [Items.Items1BoxedList](#items1boxedlist)
boxed class to store validated List payloads | -| static class | [Items.Items1](#items1)
schema class | -| static class | [Items.ItemsListBuilder](#itemslistbuilder)
builder for List payloads | -| static class | [Items.ItemsList](#itemslist)
output class for List payloads | -| sealed interface | [Items.Items2Boxed](#items2boxed)
sealed interface for validated payloads | -| record | [Items.Items2BoxedMap](#items2boxedmap)
boxed class to store validated Map payloads | -| static class | [Items.Items2](#items2)
schema class | - -## Items1Boxed -public sealed interface Items1Boxed
-permits
-[Items1BoxedList](#items1boxedlist) - -sealed interface that stores validated payloads using boxed classes - -## Items1BoxedList -public record Items1BoxedList
-implements [Items1Boxed](#items1boxed) - -record that stores validated List payloads, sealed permits implementation - -### Constructor Summary -| Constructor and Description | -| --------------------------- | -| Items1BoxedList([ItemsList](#itemslist) data)
Creates an instance, private visibility | - -### Method Summary -| Modifier and Type | Method and Description | -| ----------------- | ---------------------- | -| [ItemsList](#itemslist) | data()
validated payload | -| @Nullable Object | getData()
validated payload | - -## Items1 -public static class Items1
-extends JsonSchema - -A schema class that validates payloads - -## Description -component's name collides with the inner schema name - -### Code Sample -``` -import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags; -import org.openapijsonschematools.client.configurations.SchemaConfiguration; -import org.openapijsonschematools.client.exceptions.ValidationException; -import org.openapijsonschematools.client.schemas.validation.MapUtils; -import org.openapijsonschematools.client.schemas.validation.FrozenList; -import org.openapijsonschematools.client.schemas.validation.FrozenMap; -import org.openapijsonschematools.client.components.schemas.Items; - -import java.util.Arrays; -import java.util.List; -import java.util.AbstractMap; - -static final SchemaConfiguration configuration = new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().build()); - -// List validation -Items.ItemsList validatedPayload = - Items.Items1.validate( - new Items.ItemsListBuilder() - .build(), - configuration -); -``` - -### Field Summary -| Modifier and Type | Field and Description | -| ----------------- | ---------------------- | -| Set> | type = Set.of(List.class) | -| Class | items = [Items2.class](#items2) | - -### Method Summary -| Modifier and Type | Method and Description | -| ----------------- | ---------------------- | -| [ItemsList](#itemslist) | validate([List](#itemslistbuilder) arg, SchemaConfiguration configuration) | -| [Items1BoxedList](#items1boxedlist) | validateAndBox([List](#itemslistbuilder) arg, SchemaConfiguration configuration) | -| [Items1Boxed](#items1boxed) | validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) | -| @Nullable Object | validate(@Nullable Object arg, SchemaConfiguration configuration) | - -## ItemsListBuilder -public class ItemsListBuilder
-builder for `List>` - -A class that builds the List input type - -### Constructor Summary -| Constructor and Description | -| --------------------------- | -| ItemsListBuilder()
Creates an empty list | -| ItemsListBuilder(List> items)
Stores the items in a list | - -### Method Summary -| Modifier and Type | Method and Description | -| ----------------- | ---------------------- | -| ItemsListBuilder | add(Map item) | -| List> | build()
Returns list input that should be used with Schema.validate | - -## ItemsList -public class ItemsList
-extends `FrozenList>` - -A class to store validated List payloads - -### Method Summary -| Modifier and Type | Method and Description | -| ----------------- | ---------------------- | -| static [ItemsList](#itemslist) | of([List>](#itemslistbuilder) arg, SchemaConfiguration configuration) | - -## Items2Boxed -public sealed interface Items2Boxed
-permits
-[Items2BoxedMap](#items2boxedmap) - -sealed interface that stores validated payloads using boxed classes - -## Items2BoxedMap -public record Items2BoxedMap
-implements [Items2Boxed](#items2boxed) - -record that stores validated Map payloads, sealed permits implementation - -### Constructor Summary -| Constructor and Description | -| --------------------------- | -| Items2BoxedMap(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 | - -## Items2 -public static class Items2
-extends MapJsonSchema.MapJsonSchema1 - -A schema class that validates payloads - -| Methods Inherited from class org.openapijsonschematools.client.schemas.MapJsonSchema.MapJsonSchema1 | -| ------------------------------------------------------------------ | -| validate | -| validateAndBox | - -[[Back to top]](#top) [[Back to Component Schemas]](../../../README.md#Component-Schemas) [[Back to README]](../../../README.md) diff --git a/samples/client/petstore/kotlin/docs/components/schemas/ItemsSchema.md b/samples/client/petstore/kotlin/docs/components/schemas/ItemsSchema.md deleted file mode 100644 index 6355ac50c42..00000000000 --- a/samples/client/petstore/kotlin/docs/components/schemas/ItemsSchema.md +++ /dev/null @@ -1,253 +0,0 @@ -# ItemsSchema -org.openapijsonschematools.client.components.schemas.ItemsSchema.java -public class ItemsSchema
- -A class that contains necessary nested -- schema classes (which validate payloads), extends JsonSchema -- sealed interfaces which store validated payloads, java version of a sum type -- boxed classes which store validated payloads, sealed permits class implementations -- classes to store validated map payloads, extends FrozenMap -- classes to build inputs for map payloads - -## Nested Class Summary -| Modifier and Type | Class and Description | -| ----------------- | ---------------------- | -| sealed interface | [ItemsSchema.ItemsSchema1Boxed](#itemsschema1boxed)
sealed interface for validated payloads | -| record | [ItemsSchema.ItemsSchema1BoxedMap](#itemsschema1boxedmap)
boxed class to store validated Map payloads | -| static class | [ItemsSchema.ItemsSchema1](#itemsschema1)
schema class | -| static class | [ItemsSchema.ItemsSchemaMapBuilder](#itemsschemamapbuilder)
builder for Map payloads | -| static class | [ItemsSchema.ItemsSchemaMap](#itemsschemamap)
output class for Map payloads | -| sealed interface | [ItemsSchema.SecondAdditionalPropertyBoxed](#secondadditionalpropertyboxed)
sealed interface for validated payloads | -| record | [ItemsSchema.SecondAdditionalPropertyBoxedString](#secondadditionalpropertyboxedstring)
boxed class to store validated String payloads | -| static class | [ItemsSchema.SecondAdditionalProperty](#secondadditionalproperty)
schema class | -| sealed interface | [ItemsSchema.SomePropertyBoxed](#somepropertyboxed)
sealed interface for validated payloads | -| record | [ItemsSchema.SomePropertyBoxedString](#somepropertyboxedstring)
boxed class to store validated String payloads | -| static class | [ItemsSchema.SomeProperty](#someproperty)
schema class | -| sealed interface | [ItemsSchema.NameBoxed](#nameboxed)
sealed interface for validated payloads | -| record | [ItemsSchema.NameBoxedString](#nameboxedstring)
boxed class to store validated String payloads | -| static class | [ItemsSchema.Name](#name)
schema class | - -## ItemsSchema1Boxed -public sealed interface ItemsSchema1Boxed
-permits
-[ItemsSchema1BoxedMap](#itemsschema1boxedmap) - -sealed interface that stores validated payloads using boxed classes - -## ItemsSchema1BoxedMap -public record ItemsSchema1BoxedMap
-implements [ItemsSchema1Boxed](#itemsschema1boxed) - -record that stores validated Map payloads, sealed permits implementation - -### Constructor Summary -| Constructor and Description | -| --------------------------- | -| ItemsSchema1BoxedMap([ItemsSchemaMap](#itemsschemamap) data)
Creates an instance, private visibility | - -### Method Summary -| Modifier and Type | Method and Description | -| ----------------- | ---------------------- | -| [ItemsSchemaMap](#itemsschemamap) | data()
validated payload | -| @Nullable Object | getData()
validated payload | - -## ItemsSchema1 -public static class ItemsSchema1
-extends JsonSchema - -A schema class that validates payloads - -### Code Sample -``` -import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags; -import org.openapijsonschematools.client.configurations.SchemaConfiguration; -import org.openapijsonschematools.client.exceptions.ValidationException; -import org.openapijsonschematools.client.schemas.validation.MapUtils; -import org.openapijsonschematools.client.schemas.validation.FrozenList; -import org.openapijsonschematools.client.schemas.validation.FrozenMap; -import org.openapijsonschematools.client.components.schemas.ItemsSchema; - -import java.util.Arrays; -import java.util.List; -import java.util.AbstractMap; - -static final SchemaConfiguration configuration = new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().build()); - -// Map validation -ItemsSchema.ItemsSchemaMap validatedPayload = - ItemsSchema.ItemsSchema1.validate( - new ItemsSchema.ItemsSchemaMapBuilder() - .name("a") - - .someProperty("a") - - .secondAdditionalProperty("a") - - .build(), - configuration -); -``` - -### Field Summary -| Modifier and Type | Field and Description | -| ----------------- | ---------------------- | -| Set> | type = Set.of(Map.class) | -| Map> | properties = Map.ofEntries(
    new PropertyEntry("name", [Name.class](#name))),
    new PropertyEntry("someProperty", [SomeProperty.class](#someproperty))),
    new PropertyEntry("secondAdditionalProperty", [SecondAdditionalProperty.class](#secondadditionalproperty)))
)
| - -### Method Summary -| Modifier and Type | Method and Description | -| ----------------- | ---------------------- | -| [ItemsSchemaMap](#itemsschemamap) | validate([Map<?, ?>](#itemsschemamapbuilder) arg, SchemaConfiguration configuration) | -| [ItemsSchema1BoxedMap](#itemsschema1boxedmap) | validateAndBox([Map<?, ?>](#itemsschemamapbuilder) arg, SchemaConfiguration configuration) | -| [ItemsSchema1Boxed](#itemsschema1boxed) | validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) | -| @Nullable Object | validate(@Nullable Object arg, SchemaConfiguration configuration) | - -## ItemsSchemaMapBuilder -public class ItemsSchemaMapBuilder
-builder for `Map` - -A class that builds the Map input type - -### Constructor Summary -| Constructor and Description | -| --------------------------- | -| ItemsSchemaMapBuilder()
Creates a builder that contains an empty map | - -### Method Summary -| Modifier and Type | Method and Description | -| ----------------- | ---------------------- | -| Map | build()
Returns map input that should be used with Schema.validate | -| [ItemsSchemaMapBuilder](#itemsschemamapbuilder) | name(String value) | -| [ItemsSchemaMapBuilder](#itemsschemamapbuilder) | someProperty(String value) | -| [ItemsSchemaMapBuilder](#itemsschemamapbuilder) | secondAdditionalProperty(String value) | -| [ItemsSchemaMapBuilder](#itemsschemamapbuilder) | additionalProperty(String key, Nothing? value) | -| [ItemsSchemaMapBuilder](#itemsschemamapbuilder) | additionalProperty(String key, boolean value) | -| [ItemsSchemaMapBuilder](#itemsschemamapbuilder) | additionalProperty(String key, String value) | -| [ItemsSchemaMapBuilder](#itemsschemamapbuilder) | additionalProperty(String key, int value) | -| [ItemsSchemaMapBuilder](#itemsschemamapbuilder) | additionalProperty(String key, float value) | -| [ItemsSchemaMapBuilder](#itemsschemamapbuilder) | additionalProperty(String key, long value) | -| [ItemsSchemaMapBuilder](#itemsschemamapbuilder) | additionalProperty(String key, double value) | -| [ItemsSchemaMapBuilder](#itemsschemamapbuilder) | additionalProperty(String key, List value) | -| [ItemsSchemaMapBuilder](#itemsschemamapbuilder) | additionalProperty(String key, Map value) | - -## ItemsSchemaMap -public static class ItemsSchemaMap
-extends FrozenMap - -A class to store validated Map payloads - -### Method Summary -| Modifier and Type | Method and Description | -| ----------------- | ---------------------- | -| static [ItemsSchemaMap](#itemsschemamap) | of([Map](#itemsschemamapbuilder) arg, SchemaConfiguration configuration) | -| String | name()
[optional] | -| String | someProperty()
[optional] | -| String | secondAdditionalProperty()
[optional] | -| @Nullable Object | getAdditionalProperty(String name)
provides type safety for additional properties | - -## SecondAdditionalPropertyBoxed -public sealed interface SecondAdditionalPropertyBoxed
-permits
-[SecondAdditionalPropertyBoxedString](#secondadditionalpropertyboxedstring) - -sealed interface that stores validated payloads using boxed classes - -## SecondAdditionalPropertyBoxedString -public record SecondAdditionalPropertyBoxedString
-implements [SecondAdditionalPropertyBoxed](#secondadditionalpropertyboxed) - -record that stores validated String payloads, sealed permits implementation - -### Constructor Summary -| Constructor and Description | -| --------------------------- | -| SecondAdditionalPropertyBoxedString(String data)
Creates an instance, private visibility | - -### Method Summary -| Modifier and Type | Method and Description | -| ----------------- | ---------------------- | -| String | data()
validated payload | -| @Nullable Object | getData()
validated payload | - -## SecondAdditionalProperty -public static class SecondAdditionalProperty
-extends StringJsonSchema.StringJsonSchema1 - -A schema class that validates payloads - -| Methods Inherited from class org.openapijsonschematools.client.schemas.StringJsonSchema.StringJsonSchema1 | -| ------------------------------------------------------------------ | -| validate | -| validateAndBox | - -## SomePropertyBoxed -public sealed interface SomePropertyBoxed
-permits
-[SomePropertyBoxedString](#somepropertyboxedstring) - -sealed interface that stores validated payloads using boxed classes - -## SomePropertyBoxedString -public record SomePropertyBoxedString
-implements [SomePropertyBoxed](#somepropertyboxed) - -record that stores validated String payloads, sealed permits implementation - -### Constructor Summary -| Constructor and Description | -| --------------------------- | -| SomePropertyBoxedString(String data)
Creates an instance, private visibility | - -### Method Summary -| Modifier and Type | Method and Description | -| ----------------- | ---------------------- | -| String | data()
validated payload | -| @Nullable Object | getData()
validated payload | - -## SomeProperty -public static class SomeProperty
-extends StringJsonSchema.StringJsonSchema1 - -A schema class that validates payloads - -| Methods Inherited from class org.openapijsonschematools.client.schemas.StringJsonSchema.StringJsonSchema1 | -| ------------------------------------------------------------------ | -| validate | -| validateAndBox | - -## NameBoxed -public sealed interface NameBoxed
-permits
-[NameBoxedString](#nameboxedstring) - -sealed interface that stores validated payloads using boxed classes - -## NameBoxedString -public record NameBoxedString
-implements [NameBoxed](#nameboxed) - -record that stores validated String payloads, sealed permits implementation - -### Constructor Summary -| Constructor and Description | -| --------------------------- | -| NameBoxedString(String data)
Creates an instance, private visibility | - -### Method Summary -| Modifier and Type | Method and Description | -| ----------------- | ---------------------- | -| String | data()
validated payload | -| @Nullable Object | getData()
validated payload | - -## Name -public static class Name
-extends StringJsonSchema.StringJsonSchema1 - -A schema class that validates payloads - -| Methods Inherited from class org.openapijsonschematools.client.schemas.StringJsonSchema.StringJsonSchema1 | -| ------------------------------------------------------------------ | -| validate | -| validateAndBox | - -[[Back to top]](#top) [[Back to Component Schemas]](../../../README.md#Component-Schemas) [[Back to README]](../../../README.md) diff --git a/samples/client/petstore/kotlin/docs/components/schemas/JSONPatchRequest.md b/samples/client/petstore/kotlin/docs/components/schemas/JSONPatchRequest.md deleted file mode 100644 index 3358698409c..00000000000 --- a/samples/client/petstore/kotlin/docs/components/schemas/JSONPatchRequest.md +++ /dev/null @@ -1,282 +0,0 @@ -# JSONPatchRequest -org.openapijsonschematools.client.components.schemas.JSONPatchRequest.java -public class JSONPatchRequest
- -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 list payloads, extends FrozenList -- classes to build inputs for list payloads - -## Nested Class Summary -| Modifier and Type | Class and Description | -| ----------------- | ---------------------- | -| sealed interface | [JSONPatchRequest.JSONPatchRequest1Boxed](#jsonpatchrequest1boxed)
sealed interface for validated payloads | -| record | [JSONPatchRequest.JSONPatchRequest1BoxedList](#jsonpatchrequest1boxedlist)
boxed class to store validated List payloads | -| static class | [JSONPatchRequest.JSONPatchRequest1](#jsonpatchrequest1)
schema class | -| static class | [JSONPatchRequest.JSONPatchRequestListBuilder](#jsonpatchrequestlistbuilder)
builder for List payloads | -| static class | [JSONPatchRequest.JSONPatchRequestList](#jsonpatchrequestlist)
output class for List payloads | -| sealed interface | [JSONPatchRequest.ItemsBoxed](#itemsboxed)
sealed interface for validated payloads | -| record | [JSONPatchRequest.ItemsBoxedVoid](#itemsboxedvoid)
boxed class to store validated null payloads | -| record | [JSONPatchRequest.ItemsBoxedBoolean](#itemsboxedboolean)
boxed class to store validated boolean payloads | -| record | [JSONPatchRequest.ItemsBoxedNumber](#itemsboxednumber)
boxed class to store validated Number payloads | -| record | [JSONPatchRequest.ItemsBoxedString](#itemsboxedstring)
boxed class to store validated String payloads | -| record | [JSONPatchRequest.ItemsBoxedList](#itemsboxedlist)
boxed class to store validated List payloads | -| record | [JSONPatchRequest.ItemsBoxedMap](#itemsboxedmap)
boxed class to store validated Map payloads | -| static class | [JSONPatchRequest.Items](#items)
schema class | - -## JSONPatchRequest1Boxed -public sealed interface JSONPatchRequest1Boxed
-permits
-[JSONPatchRequest1BoxedList](#jsonpatchrequest1boxedlist) - -sealed interface that stores validated payloads using boxed classes - -## JSONPatchRequest1BoxedList -public record JSONPatchRequest1BoxedList
-implements [JSONPatchRequest1Boxed](#jsonpatchrequest1boxed) - -record that stores validated List payloads, sealed permits implementation - -### Constructor Summary -| Constructor and Description | -| --------------------------- | -| JSONPatchRequest1BoxedList([JSONPatchRequestList](#jsonpatchrequestlist) data)
Creates an instance, private visibility | - -### Method Summary -| Modifier and Type | Method and Description | -| ----------------- | ---------------------- | -| [JSONPatchRequestList](#jsonpatchrequestlist) | data()
validated payload | -| @Nullable Object | getData()
validated payload | - -## JSONPatchRequest1 -public static class JSONPatchRequest1
-extends JsonSchema - -A schema class that validates payloads - -### Code Sample -``` -import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags; -import org.openapijsonschematools.client.configurations.SchemaConfiguration; -import org.openapijsonschematools.client.exceptions.ValidationException; -import org.openapijsonschematools.client.schemas.validation.MapUtils; -import org.openapijsonschematools.client.schemas.validation.FrozenList; -import org.openapijsonschematools.client.schemas.validation.FrozenMap; -import org.openapijsonschematools.client.components.schemas.JSONPatchRequest; - -import java.util.Arrays; -import java.util.List; -import java.util.AbstractMap; - -static final SchemaConfiguration configuration = new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().build()); - -// List validation -JSONPatchRequest.JSONPatchRequestList validatedPayload = - JSONPatchRequest.JSONPatchRequest1.validate( - new JSONPatchRequest.JSONPatchRequestListBuilder() - .build(), - configuration -); -``` - -### Field Summary -| Modifier and Type | Field and Description | -| ----------------- | ---------------------- | -| Set> | type = Set.of(List.class) | -| Class | items = [Items.class](#items) | - -### Method Summary -| Modifier and Type | Method and Description | -| ----------------- | ---------------------- | -| [JSONPatchRequestList](#jsonpatchrequestlist) | validate([List](#jsonpatchrequestlistbuilder) arg, SchemaConfiguration configuration) | -| [JSONPatchRequest1BoxedList](#jsonpatchrequest1boxedlist) | validateAndBox([List](#jsonpatchrequestlistbuilder) arg, SchemaConfiguration configuration) | -| [JSONPatchRequest1Boxed](#jsonpatchrequest1boxed) | validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) | -| @Nullable Object | validate(@Nullable Object arg, SchemaConfiguration configuration) | - -## JSONPatchRequestListBuilder -public class JSONPatchRequestListBuilder
-builder for `List<@Nullable Object>` - -A class that builds the List input type - -### Constructor Summary -| Constructor and Description | -| --------------------------- | -| JSONPatchRequestListBuilder()
Creates an empty list | -| JSONPatchRequestListBuilder(List<@Nullable Object> items)
Stores the items in a list | - -### Method Summary -| Modifier and Type | Method and Description | -| ----------------- | ---------------------- | -| JSONPatchRequestListBuilder | add(Nothing? item) | -| JSONPatchRequestListBuilder | add(boolean item) | -| JSONPatchRequestListBuilder | add(String item) | -| JSONPatchRequestListBuilder | add(int item) | -| JSONPatchRequestListBuilder | add(float item) | -| JSONPatchRequestListBuilder | add(long item) | -| JSONPatchRequestListBuilder | add(double item) | -| JSONPatchRequestListBuilder | add(List item) | -| JSONPatchRequestListBuilder | add(Map item) | -| List<@Nullable Object> | build()
Returns list input that should be used with Schema.validate | - -## JSONPatchRequestList -public class JSONPatchRequestList
-extends `FrozenList<@Nullable Object>` - -A class to store validated List payloads - -### Method Summary -| Modifier and Type | Method and Description | -| ----------------- | ---------------------- | -| static [JSONPatchRequestList](#jsonpatchrequestlist) | of([List](#jsonpatchrequestlistbuilder) arg, SchemaConfiguration configuration) | - -## ItemsBoxed -public sealed interface ItemsBoxed
-permits
-[ItemsBoxedVoid](#itemsboxedvoid), -[ItemsBoxedBoolean](#itemsboxedboolean), -[ItemsBoxedNumber](#itemsboxednumber), -[ItemsBoxedString](#itemsboxedstring), -[ItemsBoxedList](#itemsboxedlist), -[ItemsBoxedMap](#itemsboxedmap) - -sealed interface that stores validated payloads using boxed classes - -## ItemsBoxedVoid -public record ItemsBoxedVoid
-implements [ItemsBoxed](#itemsboxed) - -record that stores validated null payloads, sealed permits implementation - -### Constructor Summary -| Constructor and Description | -| --------------------------- | -| ItemsBoxedVoid(Nothing? data)
Creates an instance, private visibility | - -### Method Summary -| Modifier and Type | Method and Description | -| ----------------- | ---------------------- | -| Nothing? | data()
validated payload | -| @Nullable Object | getData()
validated payload | - -## ItemsBoxedBoolean -public record ItemsBoxedBoolean
-implements [ItemsBoxed](#itemsboxed) - -record that stores validated boolean payloads, sealed permits implementation - -### Constructor Summary -| Constructor and Description | -| --------------------------- | -| ItemsBoxedBoolean(boolean data)
Creates an instance, private visibility | - -### Method Summary -| Modifier and Type | Method and Description | -| ----------------- | ---------------------- | -| boolean | data()
validated payload | -| @Nullable Object | getData()
validated payload | - -## ItemsBoxedNumber -public record ItemsBoxedNumber
-implements [ItemsBoxed](#itemsboxed) - -record that stores validated Number payloads, sealed permits implementation - -### Constructor Summary -| Constructor and Description | -| --------------------------- | -| ItemsBoxedNumber(Number data)
Creates an instance, private visibility | - -### Method Summary -| Modifier and Type | Method and Description | -| ----------------- | ---------------------- | -| Number | data()
validated payload | -| @Nullable Object | getData()
validated payload | - -## ItemsBoxedString -public record ItemsBoxedString
-implements [ItemsBoxed](#itemsboxed) - -record that stores validated String payloads, sealed permits implementation - -### Constructor Summary -| Constructor and Description | -| --------------------------- | -| ItemsBoxedString(String data)
Creates an instance, private visibility | - -### Method Summary -| Modifier and Type | Method and Description | -| ----------------- | ---------------------- | -| String | data()
validated payload | -| @Nullable Object | getData()
validated payload | - -## ItemsBoxedList -public record ItemsBoxedList
-implements [ItemsBoxed](#itemsboxed) - -record that stores validated List payloads, sealed permits implementation - -### Constructor Summary -| Constructor and Description | -| --------------------------- | -| ItemsBoxedList(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 | - -## ItemsBoxedMap -public record ItemsBoxedMap
-implements [ItemsBoxed](#itemsboxed) - -record that stores validated Map payloads, sealed permits implementation - -### Constructor Summary -| Constructor and Description | -| --------------------------- | -| ItemsBoxedMap(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 | - -## Items -public static class Items
-extends JsonSchema - -A schema class that validates payloads - -### Field Summary -| Modifier and Type | Field and Description | -| ----------------- | ---------------------- | -| List> | oneOf = List.of(
    [JSONPatchRequestAddReplaceTest.JSONPatchRequestAddReplaceTest1.class](../../components/schemas/JSONPatchRequestAddReplaceTest.md#jsonpatchrequestaddreplacetest1),
    [JSONPatchRequestRemove.JSONPatchRequestRemove1.class](../../components/schemas/JSONPatchRequestRemove.md#jsonpatchrequestremove1),
    [JSONPatchRequestMoveCopy.JSONPatchRequestMoveCopy1.class](../../components/schemas/JSONPatchRequestMoveCopy.md#jsonpatchrequestmovecopy1)
))
| - -### Method Summary -| Modifier and Type | Method and Description | -| ----------------- | ---------------------- | -| String | validate(String arg, SchemaConfiguration configuration) | -| Nothing? | validate(Nothing? arg, SchemaConfiguration configuration) | -| int | validate(int arg, SchemaConfiguration configuration) | -| long | validate(long arg, SchemaConfiguration configuration) | -| float | validate(float arg, SchemaConfiguration configuration) | -| double | validate(double arg, SchemaConfiguration configuration) | -| Number | validate(Number arg, SchemaConfiguration configuration) | -| boolean | validate(boolean arg, SchemaConfiguration configuration) | -| FrozenMap<@Nullable Object> | validate(Map<?, ?> arg, SchemaConfiguration configuration) | -| FrozenList<@Nullable Object> | validate(List arg, SchemaConfiguration configuration) | -| [ItemsBoxedString](#itemsboxedstring) | validateAndBox(String arg, SchemaConfiguration configuration) | -| [ItemsBoxedVoid](#itemsboxedvoid) | validateAndBox(Nothing? arg, SchemaConfiguration configuration) | -| [ItemsBoxedNumber](#itemsboxednumber) | validateAndBox(Number arg, SchemaConfiguration configuration) | -| [ItemsBoxedBoolean](#itemsboxedboolean) | validateAndBox(boolean arg, SchemaConfiguration configuration) | -| [ItemsBoxedMap](#itemsboxedmap) | validateAndBox(Map<?, ?> arg, SchemaConfiguration configuration) | -| [ItemsBoxedList](#itemsboxedlist) | validateAndBox(List arg, SchemaConfiguration configuration) | -| [ItemsBoxed](#itemsboxed) | validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) | -| @Nullable Object | validate(@Nullable Object arg, SchemaConfiguration configuration) | - -[[Back to top]](#top) [[Back to Component Schemas]](../../../README.md#Component-Schemas) [[Back to README]](../../../README.md) diff --git a/samples/client/petstore/kotlin/docs/components/schemas/JSONPatchRequestAddReplaceTest.md b/samples/client/petstore/kotlin/docs/components/schemas/JSONPatchRequestAddReplaceTest.md deleted file mode 100644 index b79cb160737..00000000000 --- a/samples/client/petstore/kotlin/docs/components/schemas/JSONPatchRequestAddReplaceTest.md +++ /dev/null @@ -1,678 +0,0 @@ -# JSONPatchRequestAddReplaceTest -org.openapijsonschematools.client.components.schemas.JSONPatchRequestAddReplaceTest.java -public class JSONPatchRequestAddReplaceTest
- -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 | [JSONPatchRequestAddReplaceTest.JSONPatchRequestAddReplaceTest1Boxed](#jsonpatchrequestaddreplacetest1boxed)
sealed interface for validated payloads | -| record | [JSONPatchRequestAddReplaceTest.JSONPatchRequestAddReplaceTest1BoxedMap](#jsonpatchrequestaddreplacetest1boxedmap)
boxed class to store validated Map payloads | -| static class | [JSONPatchRequestAddReplaceTest.JSONPatchRequestAddReplaceTest1](#jsonpatchrequestaddreplacetest1)
schema class | -| static class | [JSONPatchRequestAddReplaceTest.JSONPatchRequestAddReplaceTestMapBuilder](#jsonpatchrequestaddreplacetestmapbuilder)
builder for Map payloads | -| static class | [JSONPatchRequestAddReplaceTest.JSONPatchRequestAddReplaceTestMap](#jsonpatchrequestaddreplacetestmap)
output class for Map payloads | -| sealed interface | [JSONPatchRequestAddReplaceTest.OpBoxed](#opboxed)
sealed interface for validated payloads | -| record | [JSONPatchRequestAddReplaceTest.OpBoxedString](#opboxedstring)
boxed class to store validated String payloads | -| static class | [JSONPatchRequestAddReplaceTest.Op](#op)
schema class | -| enum | [JSONPatchRequestAddReplaceTest.StringOpEnums](#stringopenums)
String enum | -| sealed interface | [JSONPatchRequestAddReplaceTest.ValueBoxed](#valueboxed)
sealed interface for validated payloads | -| record | [JSONPatchRequestAddReplaceTest.ValueBoxedVoid](#valueboxedvoid)
boxed class to store validated null payloads | -| record | [JSONPatchRequestAddReplaceTest.ValueBoxedBoolean](#valueboxedboolean)
boxed class to store validated boolean payloads | -| record | [JSONPatchRequestAddReplaceTest.ValueBoxedNumber](#valueboxednumber)
boxed class to store validated Number payloads | -| record | [JSONPatchRequestAddReplaceTest.ValueBoxedString](#valueboxedstring)
boxed class to store validated String payloads | -| record | [JSONPatchRequestAddReplaceTest.ValueBoxedList](#valueboxedlist)
boxed class to store validated List payloads | -| record | [JSONPatchRequestAddReplaceTest.ValueBoxedMap](#valueboxedmap)
boxed class to store validated Map payloads | -| static class | [JSONPatchRequestAddReplaceTest.Value](#value)
schema class | -| sealed interface | [JSONPatchRequestAddReplaceTest.PathBoxed](#pathboxed)
sealed interface for validated payloads | -| record | [JSONPatchRequestAddReplaceTest.PathBoxedString](#pathboxedstring)
boxed class to store validated String payloads | -| static class | [JSONPatchRequestAddReplaceTest.Path](#path)
schema class | -| sealed interface | [JSONPatchRequestAddReplaceTest.AdditionalPropertiesBoxed](#additionalpropertiesboxed)
sealed interface for validated payloads | -| record | [JSONPatchRequestAddReplaceTest.AdditionalPropertiesBoxedVoid](#additionalpropertiesboxedvoid)
boxed class to store validated null payloads | -| record | [JSONPatchRequestAddReplaceTest.AdditionalPropertiesBoxedBoolean](#additionalpropertiesboxedboolean)
boxed class to store validated boolean payloads | -| record | [JSONPatchRequestAddReplaceTest.AdditionalPropertiesBoxedNumber](#additionalpropertiesboxednumber)
boxed class to store validated Number payloads | -| record | [JSONPatchRequestAddReplaceTest.AdditionalPropertiesBoxedString](#additionalpropertiesboxedstring)
boxed class to store validated String payloads | -| record | [JSONPatchRequestAddReplaceTest.AdditionalPropertiesBoxedList](#additionalpropertiesboxedlist)
boxed class to store validated List payloads | -| record | [JSONPatchRequestAddReplaceTest.AdditionalPropertiesBoxedMap](#additionalpropertiesboxedmap)
boxed class to store validated Map payloads | -| static class | [JSONPatchRequestAddReplaceTest.AdditionalProperties](#additionalproperties)
schema class | - -## JSONPatchRequestAddReplaceTest1Boxed -public sealed interface JSONPatchRequestAddReplaceTest1Boxed
-permits
-[JSONPatchRequestAddReplaceTest1BoxedMap](#jsonpatchrequestaddreplacetest1boxedmap) - -sealed interface that stores validated payloads using boxed classes - -## JSONPatchRequestAddReplaceTest1BoxedMap -public record JSONPatchRequestAddReplaceTest1BoxedMap
-implements [JSONPatchRequestAddReplaceTest1Boxed](#jsonpatchrequestaddreplacetest1boxed) - -record that stores validated Map payloads, sealed permits implementation - -### Constructor Summary -| Constructor and Description | -| --------------------------- | -| JSONPatchRequestAddReplaceTest1BoxedMap([JSONPatchRequestAddReplaceTestMap](#jsonpatchrequestaddreplacetestmap) data)
Creates an instance, private visibility | - -### Method Summary -| Modifier and Type | Method and Description | -| ----------------- | ---------------------- | -| [JSONPatchRequestAddReplaceTestMap](#jsonpatchrequestaddreplacetestmap) | data()
validated payload | -| @Nullable Object | getData()
validated payload | - -## JSONPatchRequestAddReplaceTest1 -public static class JSONPatchRequestAddReplaceTest1
-extends JsonSchema - -A schema class that validates payloads - -### Code Sample -``` -import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags; -import org.openapijsonschematools.client.configurations.SchemaConfiguration; -import org.openapijsonschematools.client.exceptions.ValidationException; -import org.openapijsonschematools.client.schemas.validation.MapUtils; -import org.openapijsonschematools.client.schemas.validation.FrozenList; -import org.openapijsonschematools.client.schemas.validation.FrozenMap; -import org.openapijsonschematools.client.components.schemas.JSONPatchRequestAddReplaceTest; - -import java.util.Arrays; -import java.util.List; -import java.util.AbstractMap; - -static final SchemaConfiguration configuration = new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().build()); - -// Map validation -JSONPatchRequestAddReplaceTest.JSONPatchRequestAddReplaceTestMap validatedPayload = - JSONPatchRequestAddReplaceTest.JSONPatchRequestAddReplaceTest1.validate( - new JSONPatchRequestAddReplaceTest.JSONPatchRequestAddReplaceTestMapBuilder() - .op("add") - - .path("a") - - .build(), - configuration -); -``` - -### Field Summary -| Modifier and Type | Field and Description | -| ----------------- | ---------------------- | -| Set> | type = Set.of(Map.class) | -| Map> | properties = Map.ofEntries(
    new PropertyEntry("path", [Path.class](#path))),
    new PropertyEntry("value", [Value.class](#value))),
    new PropertyEntry("op", [Op.class](#op)))
)
| -| Set | required = Set.of(
    "op",
    "path",
    "value"
)
| -| Class | additionalProperties = [AdditionalProperties.class](#additionalproperties) | - -### Method Summary -| Modifier and Type | Method and Description | -| ----------------- | ---------------------- | -| [JSONPatchRequestAddReplaceTestMap](#jsonpatchrequestaddreplacetestmap) | validate([Map<?, ?>](#jsonpatchrequestaddreplacetestmapbuilder) arg, SchemaConfiguration configuration) | -| [JSONPatchRequestAddReplaceTest1BoxedMap](#jsonpatchrequestaddreplacetest1boxedmap) | validateAndBox([Map<?, ?>](#jsonpatchrequestaddreplacetestmapbuilder) arg, SchemaConfiguration configuration) | -| [JSONPatchRequestAddReplaceTest1Boxed](#jsonpatchrequestaddreplacetest1boxed) | validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) | -| @Nullable Object | validate(@Nullable Object arg, SchemaConfiguration configuration) | - -## JSONPatchRequestAddReplaceTestMap000Builder -public class JSONPatchRequestAddReplaceTestMap000Builder
-builder for `Map` - -A class that builds the Map input type - -### Constructor Summary -| Constructor and Description | -| --------------------------- | -| JSONPatchRequestAddReplaceTestMap000Builder(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 | - -## JSONPatchRequestAddReplaceTestMap001Builder -public class JSONPatchRequestAddReplaceTestMap001Builder
-builder for `Map` - -A class that builds the Map input type - -### Constructor Summary -| Constructor and Description | -| --------------------------- | -| JSONPatchRequestAddReplaceTestMap001Builder(Map instance)
Creates a builder that contains the passed instance | - -### Method Summary -| Modifier and Type | Method and Description | -| ----------------- | ---------------------- | -| [JSONPatchRequestAddReplaceTestMap000Builder](#jsonpatchrequestaddreplacetestmap000builder) | value(Nothing? value) | -| [JSONPatchRequestAddReplaceTestMap000Builder](#jsonpatchrequestaddreplacetestmap000builder) | value(boolean value) | -| [JSONPatchRequestAddReplaceTestMap000Builder](#jsonpatchrequestaddreplacetestmap000builder) | value(String value) | -| [JSONPatchRequestAddReplaceTestMap000Builder](#jsonpatchrequestaddreplacetestmap000builder) | value(int value) | -| [JSONPatchRequestAddReplaceTestMap000Builder](#jsonpatchrequestaddreplacetestmap000builder) | value(float value) | -| [JSONPatchRequestAddReplaceTestMap000Builder](#jsonpatchrequestaddreplacetestmap000builder) | value(long value) | -| [JSONPatchRequestAddReplaceTestMap000Builder](#jsonpatchrequestaddreplacetestmap000builder) | value(double value) | -| [JSONPatchRequestAddReplaceTestMap000Builder](#jsonpatchrequestaddreplacetestmap000builder) | value(List value) | -| [JSONPatchRequestAddReplaceTestMap000Builder](#jsonpatchrequestaddreplacetestmap000builder) | value(Map value) | - -## JSONPatchRequestAddReplaceTestMap010Builder -public class JSONPatchRequestAddReplaceTestMap010Builder
-builder for `Map` - -A class that builds the Map input type - -### Constructor Summary -| Constructor and Description | -| --------------------------- | -| JSONPatchRequestAddReplaceTestMap010Builder(Map instance)
Creates a builder that contains the passed instance | - -### Method Summary -| Modifier and Type | Method and Description | -| ----------------- | ---------------------- | -| [JSONPatchRequestAddReplaceTestMap000Builder](#jsonpatchrequestaddreplacetestmap000builder) | path(String value) | - -## JSONPatchRequestAddReplaceTestMap011Builder -public class JSONPatchRequestAddReplaceTestMap011Builder
-builder for `Map` - -A class that builds the Map input type - -### Constructor Summary -| Constructor and Description | -| --------------------------- | -| JSONPatchRequestAddReplaceTestMap011Builder(Map instance)
Creates a builder that contains the passed instance | - -### Method Summary -| Modifier and Type | Method and Description | -| ----------------- | ---------------------- | -| [JSONPatchRequestAddReplaceTestMap001Builder](#jsonpatchrequestaddreplacetestmap001builder) | path(String value) | -| [JSONPatchRequestAddReplaceTestMap010Builder](#jsonpatchrequestaddreplacetestmap010builder) | value(Nothing? value) | -| [JSONPatchRequestAddReplaceTestMap010Builder](#jsonpatchrequestaddreplacetestmap010builder) | value(boolean value) | -| [JSONPatchRequestAddReplaceTestMap010Builder](#jsonpatchrequestaddreplacetestmap010builder) | value(String value) | -| [JSONPatchRequestAddReplaceTestMap010Builder](#jsonpatchrequestaddreplacetestmap010builder) | value(int value) | -| [JSONPatchRequestAddReplaceTestMap010Builder](#jsonpatchrequestaddreplacetestmap010builder) | value(float value) | -| [JSONPatchRequestAddReplaceTestMap010Builder](#jsonpatchrequestaddreplacetestmap010builder) | value(long value) | -| [JSONPatchRequestAddReplaceTestMap010Builder](#jsonpatchrequestaddreplacetestmap010builder) | value(double value) | -| [JSONPatchRequestAddReplaceTestMap010Builder](#jsonpatchrequestaddreplacetestmap010builder) | value(List value) | -| [JSONPatchRequestAddReplaceTestMap010Builder](#jsonpatchrequestaddreplacetestmap010builder) | value(Map value) | - -## JSONPatchRequestAddReplaceTestMap100Builder -public class JSONPatchRequestAddReplaceTestMap100Builder
-builder for `Map` - -A class that builds the Map input type - -### Constructor Summary -| Constructor and Description | -| --------------------------- | -| JSONPatchRequestAddReplaceTestMap100Builder(Map instance)
Creates a builder that contains the passed instance | - -### Method Summary -| Modifier and Type | Method and Description | -| ----------------- | ---------------------- | -| [JSONPatchRequestAddReplaceTestMap000Builder](#jsonpatchrequestaddreplacetestmap000builder) | op(String value) | -| [JSONPatchRequestAddReplaceTestMap000Builder](#jsonpatchrequestaddreplacetestmap000builder) | op([StringOpEnums](#stringopenums) value) | - -## JSONPatchRequestAddReplaceTestMap101Builder -public class JSONPatchRequestAddReplaceTestMap101Builder
-builder for `Map` - -A class that builds the Map input type - -### Constructor Summary -| Constructor and Description | -| --------------------------- | -| JSONPatchRequestAddReplaceTestMap101Builder(Map instance)
Creates a builder that contains the passed instance | - -### Method Summary -| Modifier and Type | Method and Description | -| ----------------- | ---------------------- | -| [JSONPatchRequestAddReplaceTestMap001Builder](#jsonpatchrequestaddreplacetestmap001builder) | op(String value) | -| [JSONPatchRequestAddReplaceTestMap001Builder](#jsonpatchrequestaddreplacetestmap001builder) | op([StringOpEnums](#stringopenums) value) | -| [JSONPatchRequestAddReplaceTestMap100Builder](#jsonpatchrequestaddreplacetestmap100builder) | value(Nothing? value) | -| [JSONPatchRequestAddReplaceTestMap100Builder](#jsonpatchrequestaddreplacetestmap100builder) | value(boolean value) | -| [JSONPatchRequestAddReplaceTestMap100Builder](#jsonpatchrequestaddreplacetestmap100builder) | value(String value) | -| [JSONPatchRequestAddReplaceTestMap100Builder](#jsonpatchrequestaddreplacetestmap100builder) | value(int value) | -| [JSONPatchRequestAddReplaceTestMap100Builder](#jsonpatchrequestaddreplacetestmap100builder) | value(float value) | -| [JSONPatchRequestAddReplaceTestMap100Builder](#jsonpatchrequestaddreplacetestmap100builder) | value(long value) | -| [JSONPatchRequestAddReplaceTestMap100Builder](#jsonpatchrequestaddreplacetestmap100builder) | value(double value) | -| [JSONPatchRequestAddReplaceTestMap100Builder](#jsonpatchrequestaddreplacetestmap100builder) | value(List value) | -| [JSONPatchRequestAddReplaceTestMap100Builder](#jsonpatchrequestaddreplacetestmap100builder) | value(Map value) | - -## JSONPatchRequestAddReplaceTestMap110Builder -public class JSONPatchRequestAddReplaceTestMap110Builder
-builder for `Map` - -A class that builds the Map input type - -### Constructor Summary -| Constructor and Description | -| --------------------------- | -| JSONPatchRequestAddReplaceTestMap110Builder(Map instance)
Creates a builder that contains the passed instance | - -### Method Summary -| Modifier and Type | Method and Description | -| ----------------- | ---------------------- | -| [JSONPatchRequestAddReplaceTestMap010Builder](#jsonpatchrequestaddreplacetestmap010builder) | op(String value) | -| [JSONPatchRequestAddReplaceTestMap010Builder](#jsonpatchrequestaddreplacetestmap010builder) | op([StringOpEnums](#stringopenums) value) | -| [JSONPatchRequestAddReplaceTestMap100Builder](#jsonpatchrequestaddreplacetestmap100builder) | path(String value) | - -## JSONPatchRequestAddReplaceTestMapBuilder -public class JSONPatchRequestAddReplaceTestMapBuilder
-builder for `Map` - -A class that builds the Map input type - -### Constructor Summary -| Constructor and Description | -| --------------------------- | -| JSONPatchRequestAddReplaceTestMapBuilder()
Creates a builder that contains an empty map | - -### Method Summary -| Modifier and Type | Method and Description | -| ----------------- | ---------------------- | -| [JSONPatchRequestAddReplaceTestMap011Builder](#jsonpatchrequestaddreplacetestmap011builder) | op(String value) | -| [JSONPatchRequestAddReplaceTestMap011Builder](#jsonpatchrequestaddreplacetestmap011builder) | op([StringOpEnums](#stringopenums) value) | -| [JSONPatchRequestAddReplaceTestMap101Builder](#jsonpatchrequestaddreplacetestmap101builder) | path(String value) | -| [JSONPatchRequestAddReplaceTestMap110Builder](#jsonpatchrequestaddreplacetestmap110builder) | value(Nothing? value) | -| [JSONPatchRequestAddReplaceTestMap110Builder](#jsonpatchrequestaddreplacetestmap110builder) | value(boolean value) | -| [JSONPatchRequestAddReplaceTestMap110Builder](#jsonpatchrequestaddreplacetestmap110builder) | value(String value) | -| [JSONPatchRequestAddReplaceTestMap110Builder](#jsonpatchrequestaddreplacetestmap110builder) | value(int value) | -| [JSONPatchRequestAddReplaceTestMap110Builder](#jsonpatchrequestaddreplacetestmap110builder) | value(float value) | -| [JSONPatchRequestAddReplaceTestMap110Builder](#jsonpatchrequestaddreplacetestmap110builder) | value(long value) | -| [JSONPatchRequestAddReplaceTestMap110Builder](#jsonpatchrequestaddreplacetestmap110builder) | value(double value) | -| [JSONPatchRequestAddReplaceTestMap110Builder](#jsonpatchrequestaddreplacetestmap110builder) | value(List value) | -| [JSONPatchRequestAddReplaceTestMap110Builder](#jsonpatchrequestaddreplacetestmap110builder) | value(Map value) | - -## JSONPatchRequestAddReplaceTestMap -public static class JSONPatchRequestAddReplaceTestMap
-extends FrozenMap - -A class to store validated Map payloads - -### Method Summary -| Modifier and Type | Method and Description | -| ----------------- | ---------------------- | -| static [JSONPatchRequestAddReplaceTestMap](#jsonpatchrequestaddreplacetestmap) | of([Map](#jsonpatchrequestaddreplacetestmapbuilder) arg, SchemaConfiguration configuration) | -| String | op()
must be one of ["add", "replace", "test"] | -| String | path()
| -| @Nullable Object | value()
| - -## OpBoxed -public sealed interface OpBoxed
-permits
-[OpBoxedString](#opboxedstring) - -sealed interface that stores validated payloads using boxed classes - -## OpBoxedString -public record OpBoxedString
-implements [OpBoxed](#opboxed) - -record that stores validated String payloads, sealed permits implementation - -### Constructor Summary -| Constructor and Description | -| --------------------------- | -| OpBoxedString(String data)
Creates an instance, private visibility | - -### Method Summary -| Modifier and Type | Method and Description | -| ----------------- | ---------------------- | -| String | data()
validated payload | -| @Nullable Object | getData()
validated payload | - -## Op -public static class Op
-extends JsonSchema - -A schema class that validates payloads - -## Description -The operation to perform. - -### Code Sample -``` -import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags; -import org.openapijsonschematools.client.configurations.SchemaConfiguration; -import org.openapijsonschematools.client.exceptions.ValidationException; -import org.openapijsonschematools.client.schemas.validation.MapUtils; -import org.openapijsonschematools.client.schemas.validation.FrozenList; -import org.openapijsonschematools.client.schemas.validation.FrozenMap; -import org.openapijsonschematools.client.components.schemas.JSONPatchRequestAddReplaceTest; - -import java.util.Arrays; -import java.util.List; -import java.util.AbstractMap; - -static final SchemaConfiguration configuration = new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().build()); - -// String validation -String validatedPayload = JSONPatchRequestAddReplaceTest.Op.validate( - "add", - configuration -); -``` - -### Field Summary -| Modifier and Type | Field and Description | -| ----------------- | ---------------------- | -| Set> | type = Set.of(
    String.class
)
| -| Set | enumValues = SetMaker.makeSet(
    "add",
    "replace",
    "test"
)
| - -### Method Summary -| Modifier and Type | Method and Description | -| ----------------- | ---------------------- | -| String | validate(String arg, SchemaConfiguration configuration) | -| String | validate([StringOpEnums](#stringopenums) arg, SchemaConfiguration configuration) | -| [OpBoxedString](#opboxedstring) | validateAndBox(String arg, SchemaConfiguration configuration) | -| [OpBoxed](#opboxed) | validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) | -| @Nullable Object | validate(@Nullable Object arg, SchemaConfiguration configuration) | - -## StringOpEnums -public enum StringOpEnums
-extends `Enum` - -A class that stores String enum values - -### Enum Constant Summary -| Enum Constant | Description | -| ------------- | ----------- | -| ADD | value = "add" | -| REPLACE | value = "replace" | -| TEST | value = "test" | - -## ValueBoxed -public sealed interface ValueBoxed
-permits
-[ValueBoxedVoid](#valueboxedvoid), -[ValueBoxedBoolean](#valueboxedboolean), -[ValueBoxedNumber](#valueboxednumber), -[ValueBoxedString](#valueboxedstring), -[ValueBoxedList](#valueboxedlist), -[ValueBoxedMap](#valueboxedmap) - -sealed interface that stores validated payloads using boxed classes - -## ValueBoxedVoid -public record ValueBoxedVoid
-implements [ValueBoxed](#valueboxed) - -record that stores validated null payloads, sealed permits implementation - -### Constructor Summary -| Constructor and Description | -| --------------------------- | -| ValueBoxedVoid(Nothing? data)
Creates an instance, private visibility | - -### Method Summary -| Modifier and Type | Method and Description | -| ----------------- | ---------------------- | -| Nothing? | data()
validated payload | -| @Nullable Object | getData()
validated payload | - -## ValueBoxedBoolean -public record ValueBoxedBoolean
-implements [ValueBoxed](#valueboxed) - -record that stores validated boolean payloads, sealed permits implementation - -### Constructor Summary -| Constructor and Description | -| --------------------------- | -| ValueBoxedBoolean(boolean data)
Creates an instance, private visibility | - -### Method Summary -| Modifier and Type | Method and Description | -| ----------------- | ---------------------- | -| boolean | data()
validated payload | -| @Nullable Object | getData()
validated payload | - -## ValueBoxedNumber -public record ValueBoxedNumber
-implements [ValueBoxed](#valueboxed) - -record that stores validated Number payloads, sealed permits implementation - -### Constructor Summary -| Constructor and Description | -| --------------------------- | -| ValueBoxedNumber(Number data)
Creates an instance, private visibility | - -### Method Summary -| Modifier and Type | Method and Description | -| ----------------- | ---------------------- | -| Number | data()
validated payload | -| @Nullable Object | getData()
validated payload | - -## ValueBoxedString -public record ValueBoxedString
-implements [ValueBoxed](#valueboxed) - -record that stores validated String payloads, sealed permits implementation - -### Constructor Summary -| Constructor and Description | -| --------------------------- | -| ValueBoxedString(String data)
Creates an instance, private visibility | - -### Method Summary -| Modifier and Type | Method and Description | -| ----------------- | ---------------------- | -| String | data()
validated payload | -| @Nullable Object | getData()
validated payload | - -## ValueBoxedList -public record ValueBoxedList
-implements [ValueBoxed](#valueboxed) - -record that stores validated List payloads, sealed permits implementation - -### Constructor Summary -| Constructor and Description | -| --------------------------- | -| ValueBoxedList(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 | - -## ValueBoxedMap -public record ValueBoxedMap
-implements [ValueBoxed](#valueboxed) - -record that stores validated Map payloads, sealed permits implementation - -### Constructor Summary -| Constructor and Description | -| --------------------------- | -| ValueBoxedMap(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 | - -## Value -public static class Value
-extends AnyTypeJsonSchema.AnyTypeJsonSchema1 - -A schema class that validates payloads - -## Description -The value to add, replace or test. - -| Methods Inherited from class org.openapijsonschematools.client.schemas.AnyTypeJsonSchema.AnyTypeJsonSchema1 | -| ------------------------------------------------------------------ | -| validate | -| validateAndBox | - -## PathBoxed -public sealed interface PathBoxed
-permits
-[PathBoxedString](#pathboxedstring) - -sealed interface that stores validated payloads using boxed classes - -## PathBoxedString -public record PathBoxedString
-implements [PathBoxed](#pathboxed) - -record that stores validated String payloads, sealed permits implementation - -### Constructor Summary -| Constructor and Description | -| --------------------------- | -| PathBoxedString(String data)
Creates an instance, private visibility | - -### Method Summary -| Modifier and Type | Method and Description | -| ----------------- | ---------------------- | -| String | data()
validated payload | -| @Nullable Object | getData()
validated payload | - -## Path -public static class Path
-extends StringJsonSchema.StringJsonSchema1 - -A schema class that validates payloads - -## Description -A JSON Pointer path. - -| Methods Inherited from class org.openapijsonschematools.client.schemas.StringJsonSchema.StringJsonSchema1 | -| ------------------------------------------------------------------ | -| validate | -| validateAndBox | - -## 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(Nothing? data)
Creates an instance, private visibility | - -### Method Summary -| Modifier and Type | Method and Description | -| ----------------- | ---------------------- | -| Nothing? | 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 Component Schemas]](../../../README.md#Component-Schemas) [[Back to README]](../../../README.md) diff --git a/samples/client/petstore/kotlin/docs/components/schemas/JSONPatchRequestMoveCopy.md b/samples/client/petstore/kotlin/docs/components/schemas/JSONPatchRequestMoveCopy.md deleted file mode 100644 index 902ec2237a8..00000000000 --- a/samples/client/petstore/kotlin/docs/components/schemas/JSONPatchRequestMoveCopy.md +++ /dev/null @@ -1,552 +0,0 @@ -# JSONPatchRequestMoveCopy -org.openapijsonschematools.client.components.schemas.JSONPatchRequestMoveCopy.java -public class JSONPatchRequestMoveCopy
- -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 | [JSONPatchRequestMoveCopy.JSONPatchRequestMoveCopy1Boxed](#jsonpatchrequestmovecopy1boxed)
sealed interface for validated payloads | -| record | [JSONPatchRequestMoveCopy.JSONPatchRequestMoveCopy1BoxedMap](#jsonpatchrequestmovecopy1boxedmap)
boxed class to store validated Map payloads | -| static class | [JSONPatchRequestMoveCopy.JSONPatchRequestMoveCopy1](#jsonpatchrequestmovecopy1)
schema class | -| static class | [JSONPatchRequestMoveCopy.JSONPatchRequestMoveCopyMapBuilder](#jsonpatchrequestmovecopymapbuilder)
builder for Map payloads | -| static class | [JSONPatchRequestMoveCopy.JSONPatchRequestMoveCopyMap](#jsonpatchrequestmovecopymap)
output class for Map payloads | -| sealed interface | [JSONPatchRequestMoveCopy.OpBoxed](#opboxed)
sealed interface for validated payloads | -| record | [JSONPatchRequestMoveCopy.OpBoxedString](#opboxedstring)
boxed class to store validated String payloads | -| static class | [JSONPatchRequestMoveCopy.Op](#op)
schema class | -| enum | [JSONPatchRequestMoveCopy.StringOpEnums](#stringopenums)
String enum | -| sealed interface | [JSONPatchRequestMoveCopy.PathBoxed](#pathboxed)
sealed interface for validated payloads | -| record | [JSONPatchRequestMoveCopy.PathBoxedString](#pathboxedstring)
boxed class to store validated String payloads | -| static class | [JSONPatchRequestMoveCopy.Path](#path)
schema class | -| sealed interface | [JSONPatchRequestMoveCopy.FromBoxed](#fromboxed)
sealed interface for validated payloads | -| record | [JSONPatchRequestMoveCopy.FromBoxedString](#fromboxedstring)
boxed class to store validated String payloads | -| static class | [JSONPatchRequestMoveCopy.From](#from)
schema class | -| sealed interface | [JSONPatchRequestMoveCopy.AdditionalPropertiesBoxed](#additionalpropertiesboxed)
sealed interface for validated payloads | -| record | [JSONPatchRequestMoveCopy.AdditionalPropertiesBoxedVoid](#additionalpropertiesboxedvoid)
boxed class to store validated null payloads | -| record | [JSONPatchRequestMoveCopy.AdditionalPropertiesBoxedBoolean](#additionalpropertiesboxedboolean)
boxed class to store validated boolean payloads | -| record | [JSONPatchRequestMoveCopy.AdditionalPropertiesBoxedNumber](#additionalpropertiesboxednumber)
boxed class to store validated Number payloads | -| record | [JSONPatchRequestMoveCopy.AdditionalPropertiesBoxedString](#additionalpropertiesboxedstring)
boxed class to store validated String payloads | -| record | [JSONPatchRequestMoveCopy.AdditionalPropertiesBoxedList](#additionalpropertiesboxedlist)
boxed class to store validated List payloads | -| record | [JSONPatchRequestMoveCopy.AdditionalPropertiesBoxedMap](#additionalpropertiesboxedmap)
boxed class to store validated Map payloads | -| static class | [JSONPatchRequestMoveCopy.AdditionalProperties](#additionalproperties)
schema class | - -## JSONPatchRequestMoveCopy1Boxed -public sealed interface JSONPatchRequestMoveCopy1Boxed
-permits
-[JSONPatchRequestMoveCopy1BoxedMap](#jsonpatchrequestmovecopy1boxedmap) - -sealed interface that stores validated payloads using boxed classes - -## JSONPatchRequestMoveCopy1BoxedMap -public record JSONPatchRequestMoveCopy1BoxedMap
-implements [JSONPatchRequestMoveCopy1Boxed](#jsonpatchrequestmovecopy1boxed) - -record that stores validated Map payloads, sealed permits implementation - -### Constructor Summary -| Constructor and Description | -| --------------------------- | -| JSONPatchRequestMoveCopy1BoxedMap([JSONPatchRequestMoveCopyMap](#jsonpatchrequestmovecopymap) data)
Creates an instance, private visibility | - -### Method Summary -| Modifier and Type | Method and Description | -| ----------------- | ---------------------- | -| [JSONPatchRequestMoveCopyMap](#jsonpatchrequestmovecopymap) | data()
validated payload | -| @Nullable Object | getData()
validated payload | - -## JSONPatchRequestMoveCopy1 -public static class JSONPatchRequestMoveCopy1
-extends JsonSchema - -A schema class that validates payloads - -### Code Sample -``` -import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags; -import org.openapijsonschematools.client.configurations.SchemaConfiguration; -import org.openapijsonschematools.client.exceptions.ValidationException; -import org.openapijsonschematools.client.schemas.validation.MapUtils; -import org.openapijsonschematools.client.schemas.validation.FrozenList; -import org.openapijsonschematools.client.schemas.validation.FrozenMap; -import org.openapijsonschematools.client.components.schemas.JSONPatchRequestMoveCopy; - -import java.util.Arrays; -import java.util.List; -import java.util.AbstractMap; - -static final SchemaConfiguration configuration = new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().build()); - -// Map validation -JSONPatchRequestMoveCopy.JSONPatchRequestMoveCopyMap validatedPayload = - JSONPatchRequestMoveCopy.JSONPatchRequestMoveCopy1.validate( - new JSONPatchRequestMoveCopy.JSONPatchRequestMoveCopyMapBuilder() - .from("a") - - .op("move") - - .path("a") - - .build(), - configuration -); -``` - -### Field Summary -| Modifier and Type | Field and Description | -| ----------------- | ---------------------- | -| Set> | type = Set.of(Map.class) | -| Map> | properties = Map.ofEntries(
    new PropertyEntry("from", [From.class](#from))),
    new PropertyEntry("path", [Path.class](#path))),
    new PropertyEntry("op", [Op.class](#op)))
)
| -| Set | required = Set.of(
    "from",
    "op",
    "path"
)
| -| Class | additionalProperties = [AdditionalProperties.class](#additionalproperties) | - -### Method Summary -| Modifier and Type | Method and Description | -| ----------------- | ---------------------- | -| [JSONPatchRequestMoveCopyMap](#jsonpatchrequestmovecopymap) | validate([Map<?, ?>](#jsonpatchrequestmovecopymapbuilder) arg, SchemaConfiguration configuration) | -| [JSONPatchRequestMoveCopy1BoxedMap](#jsonpatchrequestmovecopy1boxedmap) | validateAndBox([Map<?, ?>](#jsonpatchrequestmovecopymapbuilder) arg, SchemaConfiguration configuration) | -| [JSONPatchRequestMoveCopy1Boxed](#jsonpatchrequestmovecopy1boxed) | validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) | -| @Nullable Object | validate(@Nullable Object arg, SchemaConfiguration configuration) | - -## JSONPatchRequestMoveCopyMap000Builder -public class JSONPatchRequestMoveCopyMap000Builder
-builder for `Map` - -A class that builds the Map input type - -### Constructor Summary -| Constructor and Description | -| --------------------------- | -| JSONPatchRequestMoveCopyMap000Builder(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 | - -## JSONPatchRequestMoveCopyMap001Builder -public class JSONPatchRequestMoveCopyMap001Builder
-builder for `Map` - -A class that builds the Map input type - -### Constructor Summary -| Constructor and Description | -| --------------------------- | -| JSONPatchRequestMoveCopyMap001Builder(Map instance)
Creates a builder that contains the passed instance | - -### Method Summary -| Modifier and Type | Method and Description | -| ----------------- | ---------------------- | -| [JSONPatchRequestMoveCopyMap000Builder](#jsonpatchrequestmovecopymap000builder) | path(String value) | - -## JSONPatchRequestMoveCopyMap010Builder -public class JSONPatchRequestMoveCopyMap010Builder
-builder for `Map` - -A class that builds the Map input type - -### Constructor Summary -| Constructor and Description | -| --------------------------- | -| JSONPatchRequestMoveCopyMap010Builder(Map instance)
Creates a builder that contains the passed instance | - -### Method Summary -| Modifier and Type | Method and Description | -| ----------------- | ---------------------- | -| [JSONPatchRequestMoveCopyMap000Builder](#jsonpatchrequestmovecopymap000builder) | op(String value) | -| [JSONPatchRequestMoveCopyMap000Builder](#jsonpatchrequestmovecopymap000builder) | op([StringOpEnums](#stringopenums) value) | - -## JSONPatchRequestMoveCopyMap011Builder -public class JSONPatchRequestMoveCopyMap011Builder
-builder for `Map` - -A class that builds the Map input type - -### Constructor Summary -| Constructor and Description | -| --------------------------- | -| JSONPatchRequestMoveCopyMap011Builder(Map instance)
Creates a builder that contains the passed instance | - -### Method Summary -| Modifier and Type | Method and Description | -| ----------------- | ---------------------- | -| [JSONPatchRequestMoveCopyMap001Builder](#jsonpatchrequestmovecopymap001builder) | op(String value) | -| [JSONPatchRequestMoveCopyMap001Builder](#jsonpatchrequestmovecopymap001builder) | op([StringOpEnums](#stringopenums) value) | -| [JSONPatchRequestMoveCopyMap010Builder](#jsonpatchrequestmovecopymap010builder) | path(String value) | - -## JSONPatchRequestMoveCopyMap100Builder -public class JSONPatchRequestMoveCopyMap100Builder
-builder for `Map` - -A class that builds the Map input type - -### Constructor Summary -| Constructor and Description | -| --------------------------- | -| JSONPatchRequestMoveCopyMap100Builder(Map instance)
Creates a builder that contains the passed instance | - -### Method Summary -| Modifier and Type | Method and Description | -| ----------------- | ---------------------- | -| [JSONPatchRequestMoveCopyMap000Builder](#jsonpatchrequestmovecopymap000builder) | from(String value) | - -## JSONPatchRequestMoveCopyMap101Builder -public class JSONPatchRequestMoveCopyMap101Builder
-builder for `Map` - -A class that builds the Map input type - -### Constructor Summary -| Constructor and Description | -| --------------------------- | -| JSONPatchRequestMoveCopyMap101Builder(Map instance)
Creates a builder that contains the passed instance | - -### Method Summary -| Modifier and Type | Method and Description | -| ----------------- | ---------------------- | -| [JSONPatchRequestMoveCopyMap001Builder](#jsonpatchrequestmovecopymap001builder) | from(String value) | -| [JSONPatchRequestMoveCopyMap100Builder](#jsonpatchrequestmovecopymap100builder) | path(String value) | - -## JSONPatchRequestMoveCopyMap110Builder -public class JSONPatchRequestMoveCopyMap110Builder
-builder for `Map` - -A class that builds the Map input type - -### Constructor Summary -| Constructor and Description | -| --------------------------- | -| JSONPatchRequestMoveCopyMap110Builder(Map instance)
Creates a builder that contains the passed instance | - -### Method Summary -| Modifier and Type | Method and Description | -| ----------------- | ---------------------- | -| [JSONPatchRequestMoveCopyMap010Builder](#jsonpatchrequestmovecopymap010builder) | from(String value) | -| [JSONPatchRequestMoveCopyMap100Builder](#jsonpatchrequestmovecopymap100builder) | op(String value) | -| [JSONPatchRequestMoveCopyMap100Builder](#jsonpatchrequestmovecopymap100builder) | op([StringOpEnums](#stringopenums) value) | - -## JSONPatchRequestMoveCopyMapBuilder -public class JSONPatchRequestMoveCopyMapBuilder
-builder for `Map` - -A class that builds the Map input type - -### Constructor Summary -| Constructor and Description | -| --------------------------- | -| JSONPatchRequestMoveCopyMapBuilder()
Creates a builder that contains an empty map | - -### Method Summary -| Modifier and Type | Method and Description | -| ----------------- | ---------------------- | -| [JSONPatchRequestMoveCopyMap011Builder](#jsonpatchrequestmovecopymap011builder) | from(String value) | -| [JSONPatchRequestMoveCopyMap101Builder](#jsonpatchrequestmovecopymap101builder) | op(String value) | -| [JSONPatchRequestMoveCopyMap101Builder](#jsonpatchrequestmovecopymap101builder) | op([StringOpEnums](#stringopenums) value) | -| [JSONPatchRequestMoveCopyMap110Builder](#jsonpatchrequestmovecopymap110builder) | path(String value) | - -## JSONPatchRequestMoveCopyMap -public static class JSONPatchRequestMoveCopyMap
-extends FrozenMap - -A class to store validated Map payloads - -### Method Summary -| Modifier and Type | Method and Description | -| ----------------- | ---------------------- | -| static [JSONPatchRequestMoveCopyMap](#jsonpatchrequestmovecopymap) | of([Map](#jsonpatchrequestmovecopymapbuilder) arg, SchemaConfiguration configuration) | -| String | from()
| -| String | op()
must be one of ["move", "copy"] | -| String | path()
| - -## OpBoxed -public sealed interface OpBoxed
-permits
-[OpBoxedString](#opboxedstring) - -sealed interface that stores validated payloads using boxed classes - -## OpBoxedString -public record OpBoxedString
-implements [OpBoxed](#opboxed) - -record that stores validated String payloads, sealed permits implementation - -### Constructor Summary -| Constructor and Description | -| --------------------------- | -| OpBoxedString(String data)
Creates an instance, private visibility | - -### Method Summary -| Modifier and Type | Method and Description | -| ----------------- | ---------------------- | -| String | data()
validated payload | -| @Nullable Object | getData()
validated payload | - -## Op -public static class Op
-extends JsonSchema - -A schema class that validates payloads - -## Description -The operation to perform. - -### Code Sample -``` -import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags; -import org.openapijsonschematools.client.configurations.SchemaConfiguration; -import org.openapijsonschematools.client.exceptions.ValidationException; -import org.openapijsonschematools.client.schemas.validation.MapUtils; -import org.openapijsonschematools.client.schemas.validation.FrozenList; -import org.openapijsonschematools.client.schemas.validation.FrozenMap; -import org.openapijsonschematools.client.components.schemas.JSONPatchRequestMoveCopy; - -import java.util.Arrays; -import java.util.List; -import java.util.AbstractMap; - -static final SchemaConfiguration configuration = new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().build()); - -// String validation -String validatedPayload = JSONPatchRequestMoveCopy.Op.validate( - "move", - configuration -); -``` - -### Field Summary -| Modifier and Type | Field and Description | -| ----------------- | ---------------------- | -| Set> | type = Set.of(
    String.class
)
| -| Set | enumValues = SetMaker.makeSet(
    "move",
    "copy"
)
| - -### Method Summary -| Modifier and Type | Method and Description | -| ----------------- | ---------------------- | -| String | validate(String arg, SchemaConfiguration configuration) | -| String | validate([StringOpEnums](#stringopenums) arg, SchemaConfiguration configuration) | -| [OpBoxedString](#opboxedstring) | validateAndBox(String arg, SchemaConfiguration configuration) | -| [OpBoxed](#opboxed) | validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) | -| @Nullable Object | validate(@Nullable Object arg, SchemaConfiguration configuration) | - -## StringOpEnums -public enum StringOpEnums
-extends `Enum` - -A class that stores String enum values - -### Enum Constant Summary -| Enum Constant | Description | -| ------------- | ----------- | -| MOVE | value = "move" | -| COPY | value = "copy" | - -## PathBoxed -public sealed interface PathBoxed
-permits
-[PathBoxedString](#pathboxedstring) - -sealed interface that stores validated payloads using boxed classes - -## PathBoxedString -public record PathBoxedString
-implements [PathBoxed](#pathboxed) - -record that stores validated String payloads, sealed permits implementation - -### Constructor Summary -| Constructor and Description | -| --------------------------- | -| PathBoxedString(String data)
Creates an instance, private visibility | - -### Method Summary -| Modifier and Type | Method and Description | -| ----------------- | ---------------------- | -| String | data()
validated payload | -| @Nullable Object | getData()
validated payload | - -## Path -public static class Path
-extends StringJsonSchema.StringJsonSchema1 - -A schema class that validates payloads - -## Description -A JSON Pointer path. - -| Methods Inherited from class org.openapijsonschematools.client.schemas.StringJsonSchema.StringJsonSchema1 | -| ------------------------------------------------------------------ | -| validate | -| validateAndBox | - -## FromBoxed -public sealed interface FromBoxed
-permits
-[FromBoxedString](#fromboxedstring) - -sealed interface that stores validated payloads using boxed classes - -## FromBoxedString -public record FromBoxedString
-implements [FromBoxed](#fromboxed) - -record that stores validated String payloads, sealed permits implementation - -### Constructor Summary -| Constructor and Description | -| --------------------------- | -| FromBoxedString(String data)
Creates an instance, private visibility | - -### Method Summary -| Modifier and Type | Method and Description | -| ----------------- | ---------------------- | -| String | data()
validated payload | -| @Nullable Object | getData()
validated payload | - -## From -public static class From
-extends StringJsonSchema.StringJsonSchema1 - -A schema class that validates payloads - -## Description -A JSON Pointer path. - -| Methods Inherited from class org.openapijsonschematools.client.schemas.StringJsonSchema.StringJsonSchema1 | -| ------------------------------------------------------------------ | -| validate | -| validateAndBox | - -## 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(Nothing? data)
Creates an instance, private visibility | - -### Method Summary -| Modifier and Type | Method and Description | -| ----------------- | ---------------------- | -| Nothing? | 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 Component Schemas]](../../../README.md#Component-Schemas) [[Back to README]](../../../README.md) diff --git a/samples/client/petstore/kotlin/docs/components/schemas/JSONPatchRequestRemove.md b/samples/client/petstore/kotlin/docs/components/schemas/JSONPatchRequestRemove.md deleted file mode 100644 index b204d5c39aa..00000000000 --- a/samples/client/petstore/kotlin/docs/components/schemas/JSONPatchRequestRemove.md +++ /dev/null @@ -1,437 +0,0 @@ -# JSONPatchRequestRemove -org.openapijsonschematools.client.components.schemas.JSONPatchRequestRemove.java -public class JSONPatchRequestRemove
- -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 | [JSONPatchRequestRemove.JSONPatchRequestRemove1Boxed](#jsonpatchrequestremove1boxed)
sealed interface for validated payloads | -| record | [JSONPatchRequestRemove.JSONPatchRequestRemove1BoxedMap](#jsonpatchrequestremove1boxedmap)
boxed class to store validated Map payloads | -| static class | [JSONPatchRequestRemove.JSONPatchRequestRemove1](#jsonpatchrequestremove1)
schema class | -| static class | [JSONPatchRequestRemove.JSONPatchRequestRemoveMapBuilder](#jsonpatchrequestremovemapbuilder)
builder for Map payloads | -| static class | [JSONPatchRequestRemove.JSONPatchRequestRemoveMap](#jsonpatchrequestremovemap)
output class for Map payloads | -| sealed interface | [JSONPatchRequestRemove.OpBoxed](#opboxed)
sealed interface for validated payloads | -| record | [JSONPatchRequestRemove.OpBoxedString](#opboxedstring)
boxed class to store validated String payloads | -| static class | [JSONPatchRequestRemove.Op](#op)
schema class | -| enum | [JSONPatchRequestRemove.StringOpEnums](#stringopenums)
String enum | -| sealed interface | [JSONPatchRequestRemove.PathBoxed](#pathboxed)
sealed interface for validated payloads | -| record | [JSONPatchRequestRemove.PathBoxedString](#pathboxedstring)
boxed class to store validated String payloads | -| static class | [JSONPatchRequestRemove.Path](#path)
schema class | -| sealed interface | [JSONPatchRequestRemove.AdditionalPropertiesBoxed](#additionalpropertiesboxed)
sealed interface for validated payloads | -| record | [JSONPatchRequestRemove.AdditionalPropertiesBoxedVoid](#additionalpropertiesboxedvoid)
boxed class to store validated null payloads | -| record | [JSONPatchRequestRemove.AdditionalPropertiesBoxedBoolean](#additionalpropertiesboxedboolean)
boxed class to store validated boolean payloads | -| record | [JSONPatchRequestRemove.AdditionalPropertiesBoxedNumber](#additionalpropertiesboxednumber)
boxed class to store validated Number payloads | -| record | [JSONPatchRequestRemove.AdditionalPropertiesBoxedString](#additionalpropertiesboxedstring)
boxed class to store validated String payloads | -| record | [JSONPatchRequestRemove.AdditionalPropertiesBoxedList](#additionalpropertiesboxedlist)
boxed class to store validated List payloads | -| record | [JSONPatchRequestRemove.AdditionalPropertiesBoxedMap](#additionalpropertiesboxedmap)
boxed class to store validated Map payloads | -| static class | [JSONPatchRequestRemove.AdditionalProperties](#additionalproperties)
schema class | - -## JSONPatchRequestRemove1Boxed -public sealed interface JSONPatchRequestRemove1Boxed
-permits
-[JSONPatchRequestRemove1BoxedMap](#jsonpatchrequestremove1boxedmap) - -sealed interface that stores validated payloads using boxed classes - -## JSONPatchRequestRemove1BoxedMap -public record JSONPatchRequestRemove1BoxedMap
-implements [JSONPatchRequestRemove1Boxed](#jsonpatchrequestremove1boxed) - -record that stores validated Map payloads, sealed permits implementation - -### Constructor Summary -| Constructor and Description | -| --------------------------- | -| JSONPatchRequestRemove1BoxedMap([JSONPatchRequestRemoveMap](#jsonpatchrequestremovemap) data)
Creates an instance, private visibility | - -### Method Summary -| Modifier and Type | Method and Description | -| ----------------- | ---------------------- | -| [JSONPatchRequestRemoveMap](#jsonpatchrequestremovemap) | data()
validated payload | -| @Nullable Object | getData()
validated payload | - -## JSONPatchRequestRemove1 -public static class JSONPatchRequestRemove1
-extends JsonSchema - -A schema class that validates payloads - -### Code Sample -``` -import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags; -import org.openapijsonschematools.client.configurations.SchemaConfiguration; -import org.openapijsonschematools.client.exceptions.ValidationException; -import org.openapijsonschematools.client.schemas.validation.MapUtils; -import org.openapijsonschematools.client.schemas.validation.FrozenList; -import org.openapijsonschematools.client.schemas.validation.FrozenMap; -import org.openapijsonschematools.client.components.schemas.JSONPatchRequestRemove; - -import java.util.Arrays; -import java.util.List; -import java.util.AbstractMap; - -static final SchemaConfiguration configuration = new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().build()); - -// Map validation -JSONPatchRequestRemove.JSONPatchRequestRemoveMap validatedPayload = - JSONPatchRequestRemove.JSONPatchRequestRemove1.validate( - new JSONPatchRequestRemove.JSONPatchRequestRemoveMapBuilder() - .op("remove") - - .path("a") - - .build(), - configuration -); -``` - -### Field Summary -| Modifier and Type | Field and Description | -| ----------------- | ---------------------- | -| Set> | type = Set.of(Map.class) | -| Map> | properties = Map.ofEntries(
    new PropertyEntry("path", [Path.class](#path))),
    new PropertyEntry("op", [Op.class](#op)))
)
| -| Set | required = Set.of(
    "op",
    "path"
)
| -| Class | additionalProperties = [AdditionalProperties.class](#additionalproperties) | - -### Method Summary -| Modifier and Type | Method and Description | -| ----------------- | ---------------------- | -| [JSONPatchRequestRemoveMap](#jsonpatchrequestremovemap) | validate([Map<?, ?>](#jsonpatchrequestremovemapbuilder) arg, SchemaConfiguration configuration) | -| [JSONPatchRequestRemove1BoxedMap](#jsonpatchrequestremove1boxedmap) | validateAndBox([Map<?, ?>](#jsonpatchrequestremovemapbuilder) arg, SchemaConfiguration configuration) | -| [JSONPatchRequestRemove1Boxed](#jsonpatchrequestremove1boxed) | validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) | -| @Nullable Object | validate(@Nullable Object arg, SchemaConfiguration configuration) | - -## JSONPatchRequestRemoveMap00Builder -public class JSONPatchRequestRemoveMap00Builder
-builder for `Map` - -A class that builds the Map input type - -### Constructor Summary -| Constructor and Description | -| --------------------------- | -| JSONPatchRequestRemoveMap00Builder(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 | - -## JSONPatchRequestRemoveMap01Builder -public class JSONPatchRequestRemoveMap01Builder
-builder for `Map` - -A class that builds the Map input type - -### Constructor Summary -| Constructor and Description | -| --------------------------- | -| JSONPatchRequestRemoveMap01Builder(Map instance)
Creates a builder that contains the passed instance | - -### Method Summary -| Modifier and Type | Method and Description | -| ----------------- | ---------------------- | -| [JSONPatchRequestRemoveMap00Builder](#jsonpatchrequestremovemap00builder) | path(String value) | - -## JSONPatchRequestRemoveMap10Builder -public class JSONPatchRequestRemoveMap10Builder
-builder for `Map` - -A class that builds the Map input type - -### Constructor Summary -| Constructor and Description | -| --------------------------- | -| JSONPatchRequestRemoveMap10Builder(Map instance)
Creates a builder that contains the passed instance | - -### Method Summary -| Modifier and Type | Method and Description | -| ----------------- | ---------------------- | -| [JSONPatchRequestRemoveMap00Builder](#jsonpatchrequestremovemap00builder) | op(String value) | -| [JSONPatchRequestRemoveMap00Builder](#jsonpatchrequestremovemap00builder) | op([StringOpEnums](#stringopenums) value) | - -## JSONPatchRequestRemoveMapBuilder -public class JSONPatchRequestRemoveMapBuilder
-builder for `Map` - -A class that builds the Map input type - -### Constructor Summary -| Constructor and Description | -| --------------------------- | -| JSONPatchRequestRemoveMapBuilder()
Creates a builder that contains an empty map | - -### Method Summary -| Modifier and Type | Method and Description | -| ----------------- | ---------------------- | -| [JSONPatchRequestRemoveMap01Builder](#jsonpatchrequestremovemap01builder) | op(String value) | -| [JSONPatchRequestRemoveMap01Builder](#jsonpatchrequestremovemap01builder) | op([StringOpEnums](#stringopenums) value) | -| [JSONPatchRequestRemoveMap10Builder](#jsonpatchrequestremovemap10builder) | path(String value) | - -## JSONPatchRequestRemoveMap -public static class JSONPatchRequestRemoveMap
-extends FrozenMap - -A class to store validated Map payloads - -### Method Summary -| Modifier and Type | Method and Description | -| ----------------- | ---------------------- | -| static [JSONPatchRequestRemoveMap](#jsonpatchrequestremovemap) | of([Map](#jsonpatchrequestremovemapbuilder) arg, SchemaConfiguration configuration) | -| String | op()
must be one of ["remove"] | -| String | path()
| - -## OpBoxed -public sealed interface OpBoxed
-permits
-[OpBoxedString](#opboxedstring) - -sealed interface that stores validated payloads using boxed classes - -## OpBoxedString -public record OpBoxedString
-implements [OpBoxed](#opboxed) - -record that stores validated String payloads, sealed permits implementation - -### Constructor Summary -| Constructor and Description | -| --------------------------- | -| OpBoxedString(String data)
Creates an instance, private visibility | - -### Method Summary -| Modifier and Type | Method and Description | -| ----------------- | ---------------------- | -| String | data()
validated payload | -| @Nullable Object | getData()
validated payload | - -## Op -public static class Op
-extends JsonSchema - -A schema class that validates payloads - -## Description -The operation to perform. - -### Code Sample -``` -import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags; -import org.openapijsonschematools.client.configurations.SchemaConfiguration; -import org.openapijsonschematools.client.exceptions.ValidationException; -import org.openapijsonschematools.client.schemas.validation.MapUtils; -import org.openapijsonschematools.client.schemas.validation.FrozenList; -import org.openapijsonschematools.client.schemas.validation.FrozenMap; -import org.openapijsonschematools.client.components.schemas.JSONPatchRequestRemove; - -import java.util.Arrays; -import java.util.List; -import java.util.AbstractMap; - -static final SchemaConfiguration configuration = new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().build()); - -// String validation -String validatedPayload = JSONPatchRequestRemove.Op.validate( - "remove", - configuration -); -``` - -### Field Summary -| Modifier and Type | Field and Description | -| ----------------- | ---------------------- | -| Set> | type = Set.of(
    String.class
)
| -| Set | enumValues = SetMaker.makeSet(
    "remove"
)
| - -### Method Summary -| Modifier and Type | Method and Description | -| ----------------- | ---------------------- | -| String | validate(String arg, SchemaConfiguration configuration) | -| String | validate([StringOpEnums](#stringopenums) arg, SchemaConfiguration configuration) | -| [OpBoxedString](#opboxedstring) | validateAndBox(String arg, SchemaConfiguration configuration) | -| [OpBoxed](#opboxed) | validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) | -| @Nullable Object | validate(@Nullable Object arg, SchemaConfiguration configuration) | - -## StringOpEnums -public enum StringOpEnums
-extends `Enum` - -A class that stores String enum values - -### Enum Constant Summary -| Enum Constant | Description | -| ------------- | ----------- | -| REMOVE | value = "remove" | - -## PathBoxed -public sealed interface PathBoxed
-permits
-[PathBoxedString](#pathboxedstring) - -sealed interface that stores validated payloads using boxed classes - -## PathBoxedString -public record PathBoxedString
-implements [PathBoxed](#pathboxed) - -record that stores validated String payloads, sealed permits implementation - -### Constructor Summary -| Constructor and Description | -| --------------------------- | -| PathBoxedString(String data)
Creates an instance, private visibility | - -### Method Summary -| Modifier and Type | Method and Description | -| ----------------- | ---------------------- | -| String | data()
validated payload | -| @Nullable Object | getData()
validated payload | - -## Path -public static class Path
-extends StringJsonSchema.StringJsonSchema1 - -A schema class that validates payloads - -## Description -A JSON Pointer path. - -| Methods Inherited from class org.openapijsonschematools.client.schemas.StringJsonSchema.StringJsonSchema1 | -| ------------------------------------------------------------------ | -| validate | -| validateAndBox | - -## 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(Nothing? data)
Creates an instance, private visibility | - -### Method Summary -| Modifier and Type | Method and Description | -| ----------------- | ---------------------- | -| Nothing? | 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 Component Schemas]](../../../README.md#Component-Schemas) [[Back to README]](../../../README.md) diff --git a/samples/client/petstore/kotlin/docs/components/schemas/Mammal.md b/samples/client/petstore/kotlin/docs/components/schemas/Mammal.md deleted file mode 100644 index 21fe650ab2e..00000000000 --- a/samples/client/petstore/kotlin/docs/components/schemas/Mammal.md +++ /dev/null @@ -1,169 +0,0 @@ -# Mammal -org.openapijsonschematools.client.components.schemas.Mammal.java -public class Mammal
- -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 - -## Nested Class Summary -| Modifier and Type | Class and Description | -| ----------------- | ---------------------- | -| sealed interface | [Mammal.Mammal1Boxed](#mammal1boxed)
sealed interface for validated payloads | -| record | [Mammal.Mammal1BoxedVoid](#mammal1boxedvoid)
boxed class to store validated null payloads | -| record | [Mammal.Mammal1BoxedBoolean](#mammal1boxedboolean)
boxed class to store validated boolean payloads | -| record | [Mammal.Mammal1BoxedNumber](#mammal1boxednumber)
boxed class to store validated Number payloads | -| record | [Mammal.Mammal1BoxedString](#mammal1boxedstring)
boxed class to store validated String payloads | -| record | [Mammal.Mammal1BoxedList](#mammal1boxedlist)
boxed class to store validated List payloads | -| record | [Mammal.Mammal1BoxedMap](#mammal1boxedmap)
boxed class to store validated Map payloads | -| static class | [Mammal.Mammal1](#mammal1)
schema class | - -## Mammal1Boxed -public sealed interface Mammal1Boxed
-permits
-[Mammal1BoxedVoid](#mammal1boxedvoid), -[Mammal1BoxedBoolean](#mammal1boxedboolean), -[Mammal1BoxedNumber](#mammal1boxednumber), -[Mammal1BoxedString](#mammal1boxedstring), -[Mammal1BoxedList](#mammal1boxedlist), -[Mammal1BoxedMap](#mammal1boxedmap) - -sealed interface that stores validated payloads using boxed classes - -## Mammal1BoxedVoid -public record Mammal1BoxedVoid
-implements [Mammal1Boxed](#mammal1boxed) - -record that stores validated null payloads, sealed permits implementation - -### Constructor Summary -| Constructor and Description | -| --------------------------- | -| Mammal1BoxedVoid(Nothing? data)
Creates an instance, private visibility | - -### Method Summary -| Modifier and Type | Method and Description | -| ----------------- | ---------------------- | -| Nothing? | data()
validated payload | -| @Nullable Object | getData()
validated payload | - -## Mammal1BoxedBoolean -public record Mammal1BoxedBoolean
-implements [Mammal1Boxed](#mammal1boxed) - -record that stores validated boolean payloads, sealed permits implementation - -### Constructor Summary -| Constructor and Description | -| --------------------------- | -| Mammal1BoxedBoolean(boolean data)
Creates an instance, private visibility | - -### Method Summary -| Modifier and Type | Method and Description | -| ----------------- | ---------------------- | -| boolean | data()
validated payload | -| @Nullable Object | getData()
validated payload | - -## Mammal1BoxedNumber -public record Mammal1BoxedNumber
-implements [Mammal1Boxed](#mammal1boxed) - -record that stores validated Number payloads, sealed permits implementation - -### Constructor Summary -| Constructor and Description | -| --------------------------- | -| Mammal1BoxedNumber(Number data)
Creates an instance, private visibility | - -### Method Summary -| Modifier and Type | Method and Description | -| ----------------- | ---------------------- | -| Number | data()
validated payload | -| @Nullable Object | getData()
validated payload | - -## Mammal1BoxedString -public record Mammal1BoxedString
-implements [Mammal1Boxed](#mammal1boxed) - -record that stores validated String payloads, sealed permits implementation - -### Constructor Summary -| Constructor and Description | -| --------------------------- | -| Mammal1BoxedString(String data)
Creates an instance, private visibility | - -### Method Summary -| Modifier and Type | Method and Description | -| ----------------- | ---------------------- | -| String | data()
validated payload | -| @Nullable Object | getData()
validated payload | - -## Mammal1BoxedList -public record Mammal1BoxedList
-implements [Mammal1Boxed](#mammal1boxed) - -record that stores validated List payloads, sealed permits implementation - -### Constructor Summary -| Constructor and Description | -| --------------------------- | -| Mammal1BoxedList(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 | - -## Mammal1BoxedMap -public record Mammal1BoxedMap
-implements [Mammal1Boxed](#mammal1boxed) - -record that stores validated Map payloads, sealed permits implementation - -### Constructor Summary -| Constructor and Description | -| --------------------------- | -| Mammal1BoxedMap(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 | - -## Mammal1 -public static class Mammal1
-extends JsonSchema - -A schema class that validates payloads - -### Field Summary -| Modifier and Type | Field and Description | -| ----------------- | ---------------------- | -| List> | oneOf = List.of(
    [Whale.Whale1.class](../../components/schemas/Whale.md#whale1),
    [Zebra.Zebra1.class](../../components/schemas/Zebra.md#zebra1),
    [Pig.Pig1.class](../../components/schemas/Pig.md#pig1)
))
| - -### Method Summary -| Modifier and Type | Method and Description | -| ----------------- | ---------------------- | -| String | validate(String arg, SchemaConfiguration configuration) | -| Nothing? | validate(Nothing? arg, SchemaConfiguration configuration) | -| int | validate(int arg, SchemaConfiguration configuration) | -| long | validate(long arg, SchemaConfiguration configuration) | -| float | validate(float arg, SchemaConfiguration configuration) | -| double | validate(double arg, SchemaConfiguration configuration) | -| Number | validate(Number arg, SchemaConfiguration configuration) | -| boolean | validate(boolean arg, SchemaConfiguration configuration) | -| FrozenMap<@Nullable Object> | validate(Map<?, ?> arg, SchemaConfiguration configuration) | -| FrozenList<@Nullable Object> | validate(List arg, SchemaConfiguration configuration) | -| [Mammal1BoxedString](#mammal1boxedstring) | validateAndBox(String arg, SchemaConfiguration configuration) | -| [Mammal1BoxedVoid](#mammal1boxedvoid) | validateAndBox(Nothing? arg, SchemaConfiguration configuration) | -| [Mammal1BoxedNumber](#mammal1boxednumber) | validateAndBox(Number arg, SchemaConfiguration configuration) | -| [Mammal1BoxedBoolean](#mammal1boxedboolean) | validateAndBox(boolean arg, SchemaConfiguration configuration) | -| [Mammal1BoxedMap](#mammal1boxedmap) | validateAndBox(Map<?, ?> arg, SchemaConfiguration configuration) | -| [Mammal1BoxedList](#mammal1boxedlist) | validateAndBox(List arg, SchemaConfiguration configuration) | -| [Mammal1Boxed](#mammal1boxed) | validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) | -| @Nullable Object | validate(@Nullable Object arg, SchemaConfiguration configuration) | - -[[Back to top]](#top) [[Back to Component Schemas]](../../../README.md#Component-Schemas) [[Back to README]](../../../README.md) diff --git a/samples/client/petstore/kotlin/docs/components/schemas/MapTest.md b/samples/client/petstore/kotlin/docs/components/schemas/MapTest.md deleted file mode 100644 index 22dff0cf5b6..00000000000 --- a/samples/client/petstore/kotlin/docs/components/schemas/MapTest.md +++ /dev/null @@ -1,753 +0,0 @@ -# MapTest -org.openapijsonschematools.client.components.schemas.MapTest.java -public class MapTest
- -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 | [MapTest.MapTest1Boxed](#maptest1boxed)
sealed interface for validated payloads | -| record | [MapTest.MapTest1BoxedMap](#maptest1boxedmap)
boxed class to store validated Map payloads | -| static class | [MapTest.MapTest1](#maptest1)
schema class | -| static class | [MapTest.MapTestMapBuilder](#maptestmapbuilder)
builder for Map payloads | -| static class | [MapTest.MapTestMap](#maptestmap)
output class for Map payloads | -| sealed interface | [MapTest.DirectMapBoxed](#directmapboxed)
sealed interface for validated payloads | -| record | [MapTest.DirectMapBoxedMap](#directmapboxedmap)
boxed class to store validated Map payloads | -| static class | [MapTest.DirectMap](#directmap)
schema class | -| static class | [MapTest.DirectMapMapBuilder](#directmapmapbuilder)
builder for Map payloads | -| static class | [MapTest.DirectMapMap](#directmapmap)
output class for Map payloads | -| sealed interface | [MapTest.AdditionalProperties3Boxed](#additionalproperties3boxed)
sealed interface for validated payloads | -| record | [MapTest.AdditionalProperties3BoxedBoolean](#additionalproperties3boxedboolean)
boxed class to store validated boolean payloads | -| static class | [MapTest.AdditionalProperties3](#additionalproperties3)
schema class | -| sealed interface | [MapTest.MapOfEnumStringBoxed](#mapofenumstringboxed)
sealed interface for validated payloads | -| record | [MapTest.MapOfEnumStringBoxedMap](#mapofenumstringboxedmap)
boxed class to store validated Map payloads | -| static class | [MapTest.MapOfEnumString](#mapofenumstring)
schema class | -| static class | [MapTest.MapOfEnumStringMapBuilder](#mapofenumstringmapbuilder)
builder for Map payloads | -| static class | [MapTest.MapOfEnumStringMap](#mapofenumstringmap)
output class for Map payloads | -| sealed interface | [MapTest.AdditionalProperties2Boxed](#additionalproperties2boxed)
sealed interface for validated payloads | -| record | [MapTest.AdditionalProperties2BoxedString](#additionalproperties2boxedstring)
boxed class to store validated String payloads | -| static class | [MapTest.AdditionalProperties2](#additionalproperties2)
schema class | -| enum | [MapTest.StringAdditionalPropertiesEnums](#stringadditionalpropertiesenums)
String enum | -| sealed interface | [MapTest.MapMapOfStringBoxed](#mapmapofstringboxed)
sealed interface for validated payloads | -| record | [MapTest.MapMapOfStringBoxedMap](#mapmapofstringboxedmap)
boxed class to store validated Map payloads | -| static class | [MapTest.MapMapOfString](#mapmapofstring)
schema class | -| static class | [MapTest.MapMapOfStringMapBuilder](#mapmapofstringmapbuilder)
builder for Map payloads | -| static class | [MapTest.MapMapOfStringMap](#mapmapofstringmap)
output class for Map payloads | -| sealed interface | [MapTest.AdditionalPropertiesBoxed](#additionalpropertiesboxed)
sealed interface for validated payloads | -| record | [MapTest.AdditionalPropertiesBoxedMap](#additionalpropertiesboxedmap)
boxed class to store validated Map payloads | -| static class | [MapTest.AdditionalProperties](#additionalproperties)
schema class | -| static class | [MapTest.AdditionalPropertiesMapBuilder1](#additionalpropertiesmapbuilder1)
builder for Map payloads | -| static class | [MapTest.AdditionalPropertiesMap](#additionalpropertiesmap)
output class for Map payloads | -| sealed interface | [MapTest.AdditionalProperties1Boxed](#additionalproperties1boxed)
sealed interface for validated payloads | -| record | [MapTest.AdditionalProperties1BoxedString](#additionalproperties1boxedstring)
boxed class to store validated String payloads | -| static class | [MapTest.AdditionalProperties1](#additionalproperties1)
schema class | - -## MapTest1Boxed -public sealed interface MapTest1Boxed
-permits
-[MapTest1BoxedMap](#maptest1boxedmap) - -sealed interface that stores validated payloads using boxed classes - -## MapTest1BoxedMap -public record MapTest1BoxedMap
-implements [MapTest1Boxed](#maptest1boxed) - -record that stores validated Map payloads, sealed permits implementation - -### Constructor Summary -| Constructor and Description | -| --------------------------- | -| MapTest1BoxedMap([MapTestMap](#maptestmap) data)
Creates an instance, private visibility | - -### Method Summary -| Modifier and Type | Method and Description | -| ----------------- | ---------------------- | -| [MapTestMap](#maptestmap) | data()
validated payload | -| @Nullable Object | getData()
validated payload | - -## MapTest1 -public static class MapTest1
-extends JsonSchema - -A schema class that validates payloads - -### Code Sample -``` -import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags; -import org.openapijsonschematools.client.configurations.SchemaConfiguration; -import org.openapijsonschematools.client.exceptions.ValidationException; -import org.openapijsonschematools.client.schemas.validation.MapUtils; -import org.openapijsonschematools.client.schemas.validation.FrozenList; -import org.openapijsonschematools.client.schemas.validation.FrozenMap; -import org.openapijsonschematools.client.components.schemas.MapTest; - -import java.util.Arrays; -import java.util.List; -import java.util.AbstractMap; - -static final SchemaConfiguration configuration = new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().build()); - -// Map validation -MapTest.MapTestMap validatedPayload = - MapTest.MapTest1.validate( - new MapTest.MapTestMapBuilder() - .map_map_of_string( - MapUtils.makeMap( - new AbstractMap.SimpleEntry>( - "someAdditionalProperty", - MapUtils.makeMap( - new AbstractMap.SimpleEntry( - "someAdditionalProperty", - "a" - ) - ) - ) - ) - ) - .map_of_enum_string( - MapUtils.makeMap( - new AbstractMap.SimpleEntry( - "someAdditionalProperty", - "UPPER" - ) - ) - ) - .direct_map( - MapUtils.makeMap( - new AbstractMap.SimpleEntry( - "someAdditionalProperty", - true - ) - ) - ) - .build(), - configuration -); -``` - -### Field Summary -| Modifier and Type | Field and Description | -| ----------------- | ---------------------- | -| Set> | type = Set.of(Map.class) | -| Map> | properties = Map.ofEntries(
    new PropertyEntry("map_map_of_string", [MapMapOfString.class](#mapmapofstring))),
    new PropertyEntry("map_of_enum_string", [MapOfEnumString.class](#mapofenumstring))),
    new PropertyEntry("direct_map", [DirectMap.class](#directmap))),
    new PropertyEntry("indirect_map", [StringBooleanMap.StringBooleanMap1.class](../../components/schemas/StringBooleanMap.md#stringbooleanmap1))
)
| - -### Method Summary -| Modifier and Type | Method and Description | -| ----------------- | ---------------------- | -| [MapTestMap](#maptestmap) | validate([Map<?, ?>](#maptestmapbuilder) arg, SchemaConfiguration configuration) | -| [MapTest1BoxedMap](#maptest1boxedmap) | validateAndBox([Map<?, ?>](#maptestmapbuilder) arg, SchemaConfiguration configuration) | -| [MapTest1Boxed](#maptest1boxed) | validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) | -| @Nullable Object | validate(@Nullable Object arg, SchemaConfiguration configuration) | - -## MapTestMapBuilder -public class MapTestMapBuilder
-builder for `Map` - -A class that builds the Map input type - -### Constructor Summary -| Constructor and Description | -| --------------------------- | -| MapTestMapBuilder()
Creates a builder that contains an empty map | - -### Method Summary -| Modifier and Type | Method and Description | -| ----------------- | ---------------------- | -| Map | build()
Returns map input that should be used with Schema.validate | -| [MapTestMapBuilder](#maptestmapbuilder) | map_map_of_string(Map> value) | -| [MapTestMapBuilder](#maptestmapbuilder) | map_of_enum_string(Map value) | -| [MapTestMapBuilder](#maptestmapbuilder) | direct_map(Map value) | -| [MapTestMapBuilder](#maptestmapbuilder) | indirect_map(Map value) | -| [MapTestMapBuilder](#maptestmapbuilder) | additionalProperty(String key, Nothing? value) | -| [MapTestMapBuilder](#maptestmapbuilder) | additionalProperty(String key, boolean value) | -| [MapTestMapBuilder](#maptestmapbuilder) | additionalProperty(String key, String value) | -| [MapTestMapBuilder](#maptestmapbuilder) | additionalProperty(String key, int value) | -| [MapTestMapBuilder](#maptestmapbuilder) | additionalProperty(String key, float value) | -| [MapTestMapBuilder](#maptestmapbuilder) | additionalProperty(String key, long value) | -| [MapTestMapBuilder](#maptestmapbuilder) | additionalProperty(String key, double value) | -| [MapTestMapBuilder](#maptestmapbuilder) | additionalProperty(String key, List value) | -| [MapTestMapBuilder](#maptestmapbuilder) | additionalProperty(String key, Map value) | - -## MapTestMap -public static class MapTestMap
-extends FrozenMap - -A class to store validated Map payloads - -### Method Summary -| Modifier and Type | Method and Description | -| ----------------- | ---------------------- | -| static [MapTestMap](#maptestmap) | of([Map](#maptestmapbuilder) arg, SchemaConfiguration configuration) | -| [MapMapOfStringMap](#mapmapofstringmap) | map_map_of_string()
[optional] | -| [MapOfEnumStringMap](#mapofenumstringmap) | map_of_enum_string()
[optional] | -| [DirectMapMap](#directmapmap) | direct_map()
[optional] | -| [StringBooleanMap.StringBooleanMapMap](../../components/schemas/StringBooleanMap.md#stringbooleanmapmap) | indirect_map()
[optional] | -| @Nullable Object | getAdditionalProperty(String name)
provides type safety for additional properties | - -## DirectMapBoxed -public sealed interface DirectMapBoxed
-permits
-[DirectMapBoxedMap](#directmapboxedmap) - -sealed interface that stores validated payloads using boxed classes - -## DirectMapBoxedMap -public record DirectMapBoxedMap
-implements [DirectMapBoxed](#directmapboxed) - -record that stores validated Map payloads, sealed permits implementation - -### Constructor Summary -| Constructor and Description | -| --------------------------- | -| DirectMapBoxedMap([DirectMapMap](#directmapmap) data)
Creates an instance, private visibility | - -### Method Summary -| Modifier and Type | Method and Description | -| ----------------- | ---------------------- | -| [DirectMapMap](#directmapmap) | data()
validated payload | -| @Nullable Object | getData()
validated payload | - -## DirectMap -public static class DirectMap
-extends JsonSchema - -A schema class that validates payloads - -### Code Sample -``` -import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags; -import org.openapijsonschematools.client.configurations.SchemaConfiguration; -import org.openapijsonschematools.client.exceptions.ValidationException; -import org.openapijsonschematools.client.schemas.validation.MapUtils; -import org.openapijsonschematools.client.schemas.validation.FrozenList; -import org.openapijsonschematools.client.schemas.validation.FrozenMap; -import org.openapijsonschematools.client.components.schemas.MapTest; - -import java.util.Arrays; -import java.util.List; -import java.util.AbstractMap; - -static final SchemaConfiguration configuration = new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().build()); - -// Map validation -MapTest.DirectMapMap validatedPayload = - MapTest.DirectMap.validate( - new MapTest.DirectMapMapBuilder() - .additionalProperty("someAdditionalProperty", true) - - .build(), - configuration -); -``` - -### Field Summary -| Modifier and Type | Field and Description | -| ----------------- | ---------------------- | -| Set> | type = Set.of(Map.class) | -| Class | additionalProperties = [AdditionalProperties3.class](#additionalproperties3) | - -### Method Summary -| Modifier and Type | Method and Description | -| ----------------- | ---------------------- | -| [DirectMapMap](#directmapmap) | validate([Map<?, ?>](#directmapmapbuilder) arg, SchemaConfiguration configuration) | -| [DirectMapBoxedMap](#directmapboxedmap) | validateAndBox([Map<?, ?>](#directmapmapbuilder) arg, SchemaConfiguration configuration) | -| [DirectMapBoxed](#directmapboxed) | validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) | -| @Nullable Object | validate(@Nullable Object arg, SchemaConfiguration configuration) | - -## DirectMapMapBuilder -public class DirectMapMapBuilder
-builder for `Map` - -A class that builds the Map input type - -### Constructor Summary -| Constructor and Description | -| --------------------------- | -| DirectMapMapBuilder()
Creates a builder that contains an empty map | - -### Method Summary -| Modifier and Type | Method and Description | -| ----------------- | ---------------------- | -| Map | build()
Returns map input that should be used with Schema.validate | -| [DirectMapMapBuilder](#directmapmapbuilder) | additionalProperty(String key, boolean value) | - -## DirectMapMap -public static class DirectMapMap
-extends FrozenMap - -A class to store validated Map payloads - -### Method Summary -| Modifier and Type | Method and Description | -| ----------------- | ---------------------- | -| static [DirectMapMap](#directmapmap) | of([Map](#directmapmapbuilder) arg, SchemaConfiguration configuration) | -| boolean | getAdditionalProperty(String name)
provides type safety for additional properties | - -## AdditionalProperties3Boxed -public sealed interface AdditionalProperties3Boxed
-permits
-[AdditionalProperties3BoxedBoolean](#additionalproperties3boxedboolean) - -sealed interface that stores validated payloads using boxed classes - -## AdditionalProperties3BoxedBoolean -public record AdditionalProperties3BoxedBoolean
-implements [AdditionalProperties3Boxed](#additionalproperties3boxed) - -record that stores validated boolean payloads, sealed permits implementation - -### Constructor Summary -| Constructor and Description | -| --------------------------- | -| AdditionalProperties3BoxedBoolean(boolean data)
Creates an instance, private visibility | - -### Method Summary -| Modifier and Type | Method and Description | -| ----------------- | ---------------------- | -| boolean | data()
validated payload | -| @Nullable Object | getData()
validated payload | - -## AdditionalProperties3 -public static class AdditionalProperties3
-extends BooleanJsonSchema.BooleanJsonSchema1 - -A schema class that validates payloads - -| Methods Inherited from class org.openapijsonschematools.client.schemas.BooleanJsonSchema.BooleanJsonSchema1 | -| ------------------------------------------------------------------ | -| validate | -| validateAndBox | - -## MapOfEnumStringBoxed -public sealed interface MapOfEnumStringBoxed
-permits
-[MapOfEnumStringBoxedMap](#mapofenumstringboxedmap) - -sealed interface that stores validated payloads using boxed classes - -## MapOfEnumStringBoxedMap -public record MapOfEnumStringBoxedMap
-implements [MapOfEnumStringBoxed](#mapofenumstringboxed) - -record that stores validated Map payloads, sealed permits implementation - -### Constructor Summary -| Constructor and Description | -| --------------------------- | -| MapOfEnumStringBoxedMap([MapOfEnumStringMap](#mapofenumstringmap) data)
Creates an instance, private visibility | - -### Method Summary -| Modifier and Type | Method and Description | -| ----------------- | ---------------------- | -| [MapOfEnumStringMap](#mapofenumstringmap) | data()
validated payload | -| @Nullable Object | getData()
validated payload | - -## MapOfEnumString -public static class MapOfEnumString
-extends JsonSchema - -A schema class that validates payloads - -### Code Sample -``` -import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags; -import org.openapijsonschematools.client.configurations.SchemaConfiguration; -import org.openapijsonschematools.client.exceptions.ValidationException; -import org.openapijsonschematools.client.schemas.validation.MapUtils; -import org.openapijsonschematools.client.schemas.validation.FrozenList; -import org.openapijsonschematools.client.schemas.validation.FrozenMap; -import org.openapijsonschematools.client.components.schemas.MapTest; - -import java.util.Arrays; -import java.util.List; -import java.util.AbstractMap; - -static final SchemaConfiguration configuration = new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().build()); - -// Map validation -MapTest.MapOfEnumStringMap validatedPayload = - MapTest.MapOfEnumString.validate( - new MapTest.MapOfEnumStringMapBuilder() - .additionalProperty("someAdditionalProperty", "UPPER") - - .build(), - configuration -); -``` - -### Field Summary -| Modifier and Type | Field and Description | -| ----------------- | ---------------------- | -| Set> | type = Set.of(Map.class) | -| Class | additionalProperties = [AdditionalProperties2.class](#additionalproperties2) | - -### Method Summary -| Modifier and Type | Method and Description | -| ----------------- | ---------------------- | -| [MapOfEnumStringMap](#mapofenumstringmap) | validate([Map<?, ?>](#mapofenumstringmapbuilder) arg, SchemaConfiguration configuration) | -| [MapOfEnumStringBoxedMap](#mapofenumstringboxedmap) | validateAndBox([Map<?, ?>](#mapofenumstringmapbuilder) arg, SchemaConfiguration configuration) | -| [MapOfEnumStringBoxed](#mapofenumstringboxed) | validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) | -| @Nullable Object | validate(@Nullable Object arg, SchemaConfiguration configuration) | - -## MapOfEnumStringMapBuilder -public class MapOfEnumStringMapBuilder
-builder for `Map` - -A class that builds the Map input type - -### Constructor Summary -| Constructor and Description | -| --------------------------- | -| MapOfEnumStringMapBuilder()
Creates a builder that contains an empty map | - -### Method Summary -| Modifier and Type | Method and Description | -| ----------------- | ---------------------- | -| Map | build()
Returns map input that should be used with Schema.validate | -| [MapOfEnumStringMapBuilder](#mapofenumstringmapbuilder) | additionalProperty(String key, String value) | -| [MapOfEnumStringMapBuilder](#mapofenumstringmapbuilder) | additionalProperty(String key, [StringAdditionalPropertiesEnums](#stringadditionalpropertiesenums) value) | - -## MapOfEnumStringMap -public static class MapOfEnumStringMap
-extends FrozenMap - -A class to store validated Map payloads - -### Method Summary -| Modifier and Type | Method and Description | -| ----------------- | ---------------------- | -| static [MapOfEnumStringMap](#mapofenumstringmap) | of([Map](#mapofenumstringmapbuilder) arg, SchemaConfiguration configuration) | -| String | getAdditionalProperty(String name)
provides type safety for additional properties | - -## AdditionalProperties2Boxed -public sealed interface AdditionalProperties2Boxed
-permits
-[AdditionalProperties2BoxedString](#additionalproperties2boxedstring) - -sealed interface that stores validated payloads using boxed classes - -## AdditionalProperties2BoxedString -public record AdditionalProperties2BoxedString
-implements [AdditionalProperties2Boxed](#additionalproperties2boxed) - -record that stores validated String payloads, sealed permits implementation - -### Constructor Summary -| Constructor and Description | -| --------------------------- | -| AdditionalProperties2BoxedString(String data)
Creates an instance, private visibility | - -### Method Summary -| Modifier and Type | Method and Description | -| ----------------- | ---------------------- | -| String | data()
validated payload | -| @Nullable Object | getData()
validated payload | - -## AdditionalProperties2 -public static class AdditionalProperties2
-extends JsonSchema - -A schema class that validates payloads - -### Code Sample -``` -import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags; -import org.openapijsonschematools.client.configurations.SchemaConfiguration; -import org.openapijsonschematools.client.exceptions.ValidationException; -import org.openapijsonschematools.client.schemas.validation.MapUtils; -import org.openapijsonschematools.client.schemas.validation.FrozenList; -import org.openapijsonschematools.client.schemas.validation.FrozenMap; -import org.openapijsonschematools.client.components.schemas.MapTest; - -import java.util.Arrays; -import java.util.List; -import java.util.AbstractMap; - -static final SchemaConfiguration configuration = new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().build()); - -// String validation -String validatedPayload = MapTest.AdditionalProperties2.validate( - "UPPER", - configuration -); -``` - -### Field Summary -| Modifier and Type | Field and Description | -| ----------------- | ---------------------- | -| Set> | type = Set.of(
    String.class
)
| -| Set | enumValues = SetMaker.makeSet(
    "UPPER",
    "lower"
)
| - -### Method Summary -| Modifier and Type | Method and Description | -| ----------------- | ---------------------- | -| String | validate(String arg, SchemaConfiguration configuration) | -| String | validate([StringAdditionalPropertiesEnums](#stringadditionalpropertiesenums) arg, SchemaConfiguration configuration) | -| [AdditionalProperties2BoxedString](#additionalproperties2boxedstring) | validateAndBox(String arg, SchemaConfiguration configuration) | -| [AdditionalProperties2Boxed](#additionalproperties2boxed) | validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) | -| @Nullable Object | validate(@Nullable Object arg, SchemaConfiguration configuration) | - -## StringAdditionalPropertiesEnums -public enum StringAdditionalPropertiesEnums
-extends `Enum` - -A class that stores String enum values - -### Enum Constant Summary -| Enum Constant | Description | -| ------------- | ----------- | -| UPPER | value = "UPPER" | -| LOWER | value = "lower" | - -## MapMapOfStringBoxed -public sealed interface MapMapOfStringBoxed
-permits
-[MapMapOfStringBoxedMap](#mapmapofstringboxedmap) - -sealed interface that stores validated payloads using boxed classes - -## MapMapOfStringBoxedMap -public record MapMapOfStringBoxedMap
-implements [MapMapOfStringBoxed](#mapmapofstringboxed) - -record that stores validated Map payloads, sealed permits implementation - -### Constructor Summary -| Constructor and Description | -| --------------------------- | -| MapMapOfStringBoxedMap([MapMapOfStringMap](#mapmapofstringmap) data)
Creates an instance, private visibility | - -### Method Summary -| Modifier and Type | Method and Description | -| ----------------- | ---------------------- | -| [MapMapOfStringMap](#mapmapofstringmap) | data()
validated payload | -| @Nullable Object | getData()
validated payload | - -## MapMapOfString -public static class MapMapOfString
-extends JsonSchema - -A schema class that validates payloads - -### Code Sample -``` -import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags; -import org.openapijsonschematools.client.configurations.SchemaConfiguration; -import org.openapijsonschematools.client.exceptions.ValidationException; -import org.openapijsonschematools.client.schemas.validation.MapUtils; -import org.openapijsonschematools.client.schemas.validation.FrozenList; -import org.openapijsonschematools.client.schemas.validation.FrozenMap; -import org.openapijsonschematools.client.components.schemas.MapTest; - -import java.util.Arrays; -import java.util.List; -import java.util.AbstractMap; - -static final SchemaConfiguration configuration = new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().build()); - -// Map validation -MapTest.MapMapOfStringMap validatedPayload = - MapTest.MapMapOfString.validate( - new MapTest.MapMapOfStringMapBuilder() - .additionalProperty( - "someAdditionalProperty", - MapUtils.makeMap( - new AbstractMap.SimpleEntry( - "someAdditionalProperty", - "a" - ) - ) - ) - .build(), - configuration -); -``` - -### Field Summary -| Modifier and Type | Field and Description | -| ----------------- | ---------------------- | -| Set> | type = Set.of(Map.class) | -| Class | additionalProperties = [AdditionalProperties.class](#additionalproperties) | - -### Method Summary -| Modifier and Type | Method and Description | -| ----------------- | ---------------------- | -| [MapMapOfStringMap](#mapmapofstringmap) | validate([Map<?, ?>](#mapmapofstringmapbuilder) arg, SchemaConfiguration configuration) | -| [MapMapOfStringBoxedMap](#mapmapofstringboxedmap) | validateAndBox([Map<?, ?>](#mapmapofstringmapbuilder) arg, SchemaConfiguration configuration) | -| [MapMapOfStringBoxed](#mapmapofstringboxed) | validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) | -| @Nullable Object | validate(@Nullable Object arg, SchemaConfiguration configuration) | - -## MapMapOfStringMapBuilder -public class MapMapOfStringMapBuilder
-builder for `Map>` - -A class that builds the Map input type - -### Constructor Summary -| Constructor and Description | -| --------------------------- | -| MapMapOfStringMapBuilder()
Creates a builder that contains an empty map | - -### Method Summary -| Modifier and Type | Method and Description | -| ----------------- | ---------------------- | -| Map> | build()
Returns map input that should be used with Schema.validate | -| [MapMapOfStringMapBuilder](#mapmapofstringmapbuilder) | additionalProperty(String key, Map value) | - -## MapMapOfStringMap -public static class MapMapOfStringMap
-extends FrozenMap - -A class to store validated Map payloads - -### Method Summary -| Modifier and Type | Method and Description | -| ----------------- | ---------------------- | -| static [MapMapOfStringMap](#mapmapofstringmap) | of([Map>](#mapmapofstringmapbuilder) arg, SchemaConfiguration configuration) | -| [AdditionalPropertiesMap](#additionalpropertiesmap) | getAdditionalProperty(String name)
provides type safety for additional properties | - -## AdditionalPropertiesBoxed -public sealed interface AdditionalPropertiesBoxed
-permits
-[AdditionalPropertiesBoxedMap](#additionalpropertiesboxedmap) - -sealed interface that stores validated payloads using boxed classes - -## AdditionalPropertiesBoxedMap -public record AdditionalPropertiesBoxedMap
-implements [AdditionalPropertiesBoxed](#additionalpropertiesboxed) - -record that stores validated Map payloads, sealed permits implementation - -### Constructor Summary -| Constructor and Description | -| --------------------------- | -| AdditionalPropertiesBoxedMap([AdditionalPropertiesMap](#additionalpropertiesmap) data)
Creates an instance, private visibility | - -### Method Summary -| Modifier and Type | Method and Description | -| ----------------- | ---------------------- | -| [AdditionalPropertiesMap](#additionalpropertiesmap) | data()
validated payload | -| @Nullable Object | getData()
validated payload | - -## AdditionalProperties -public static class AdditionalProperties
-extends JsonSchema - -A schema class that validates payloads - -### Code Sample -``` -import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags; -import org.openapijsonschematools.client.configurations.SchemaConfiguration; -import org.openapijsonschematools.client.exceptions.ValidationException; -import org.openapijsonschematools.client.schemas.validation.MapUtils; -import org.openapijsonschematools.client.schemas.validation.FrozenList; -import org.openapijsonschematools.client.schemas.validation.FrozenMap; -import org.openapijsonschematools.client.components.schemas.MapTest; - -import java.util.Arrays; -import java.util.List; -import java.util.AbstractMap; - -static final SchemaConfiguration configuration = new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().build()); - -// Map validation -MapTest.AdditionalPropertiesMap validatedPayload = - MapTest.AdditionalProperties.validate( - new MapTest.AdditionalPropertiesMapBuilder1() - .additionalProperty("someAdditionalProperty", "a") - - .build(), - configuration -); -``` - -### Field Summary -| Modifier and Type | Field and Description | -| ----------------- | ---------------------- | -| Set> | type = Set.of(Map.class) | -| Class | additionalProperties = [AdditionalProperties1.class](#additionalproperties1) | - -### Method Summary -| Modifier and Type | Method and Description | -| ----------------- | ---------------------- | -| [AdditionalPropertiesMap](#additionalpropertiesmap) | validate([Map<?, ?>](#additionalpropertiesmapbuilder1) arg, SchemaConfiguration configuration) | -| [AdditionalPropertiesBoxedMap](#additionalpropertiesboxedmap) | validateAndBox([Map<?, ?>](#additionalpropertiesmapbuilder1) arg, SchemaConfiguration configuration) | -| [AdditionalPropertiesBoxed](#additionalpropertiesboxed) | validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) | -| @Nullable Object | validate(@Nullable Object arg, SchemaConfiguration configuration) | - -## AdditionalPropertiesMapBuilder1 -public class AdditionalPropertiesMapBuilder1
-builder for `Map` - -A class that builds the Map input type - -### Constructor Summary -| Constructor and Description | -| --------------------------- | -| AdditionalPropertiesMapBuilder1()
Creates a builder that contains an empty map | - -### Method Summary -| Modifier and Type | Method and Description | -| ----------------- | ---------------------- | -| Map | build()
Returns map input that should be used with Schema.validate | -| [AdditionalPropertiesMapBuilder1](#additionalpropertiesmapbuilder1) | additionalProperty(String key, String value) | - -## AdditionalPropertiesMap -public static class AdditionalPropertiesMap
-extends FrozenMap - -A class to store validated Map payloads - -### Method Summary -| Modifier and Type | Method and Description | -| ----------------- | ---------------------- | -| static [AdditionalPropertiesMap](#additionalpropertiesmap) | of([Map](#additionalpropertiesmapbuilder1) arg, SchemaConfiguration configuration) | -| String | getAdditionalProperty(String name)
provides type safety for additional properties | - -## AdditionalProperties1Boxed -public sealed interface AdditionalProperties1Boxed
-permits
-[AdditionalProperties1BoxedString](#additionalproperties1boxedstring) - -sealed interface that stores validated payloads using boxed classes - -## AdditionalProperties1BoxedString -public record AdditionalProperties1BoxedString
-implements [AdditionalProperties1Boxed](#additionalproperties1boxed) - -record that stores validated String payloads, sealed permits implementation - -### Constructor Summary -| Constructor and Description | -| --------------------------- | -| AdditionalProperties1BoxedString(String data)
Creates an instance, private visibility | - -### Method Summary -| Modifier and Type | Method and Description | -| ----------------- | ---------------------- | -| String | data()
validated payload | -| @Nullable Object | getData()
validated payload | - -## AdditionalProperties1 -public static class AdditionalProperties1
-extends StringJsonSchema.StringJsonSchema1 - -A schema class that validates payloads - -| Methods Inherited from class org.openapijsonschematools.client.schemas.StringJsonSchema.StringJsonSchema1 | -| ------------------------------------------------------------------ | -| validate | -| validateAndBox | - -[[Back to top]](#top) [[Back to Component Schemas]](../../../README.md#Component-Schemas) [[Back to README]](../../../README.md) diff --git a/samples/client/petstore/kotlin/docs/components/schemas/MixedPropertiesAndAdditionalPropertiesClass.md b/samples/client/petstore/kotlin/docs/components/schemas/MixedPropertiesAndAdditionalPropertiesClass.md deleted file mode 100644 index e7da20d2573..00000000000 --- a/samples/client/petstore/kotlin/docs/components/schemas/MixedPropertiesAndAdditionalPropertiesClass.md +++ /dev/null @@ -1,345 +0,0 @@ -# MixedPropertiesAndAdditionalPropertiesClass -org.openapijsonschematools.client.components.schemas.MixedPropertiesAndAdditionalPropertiesClass.java -public class MixedPropertiesAndAdditionalPropertiesClass
- -A class that contains necessary nested -- schema classes (which validate payloads), extends JsonSchema -- sealed interfaces which store validated payloads, java version of a sum type -- boxed classes which store validated payloads, sealed permits class implementations -- classes to store validated map payloads, extends FrozenMap -- classes to build inputs for map payloads - -## Nested Class Summary -| Modifier and Type | Class and Description | -| ----------------- | ---------------------- | -| sealed interface | [MixedPropertiesAndAdditionalPropertiesClass.MixedPropertiesAndAdditionalPropertiesClass1Boxed](#mixedpropertiesandadditionalpropertiesclass1boxed)
sealed interface for validated payloads | -| record | [MixedPropertiesAndAdditionalPropertiesClass.MixedPropertiesAndAdditionalPropertiesClass1BoxedMap](#mixedpropertiesandadditionalpropertiesclass1boxedmap)
boxed class to store validated Map payloads | -| static class | [MixedPropertiesAndAdditionalPropertiesClass.MixedPropertiesAndAdditionalPropertiesClass1](#mixedpropertiesandadditionalpropertiesclass1)
schema class | -| static class | [MixedPropertiesAndAdditionalPropertiesClass.MixedPropertiesAndAdditionalPropertiesClassMapBuilder](#mixedpropertiesandadditionalpropertiesclassmapbuilder)
builder for Map payloads | -| static class | [MixedPropertiesAndAdditionalPropertiesClass.MixedPropertiesAndAdditionalPropertiesClassMap](#mixedpropertiesandadditionalpropertiesclassmap)
output class for Map payloads | -| sealed interface | [MixedPropertiesAndAdditionalPropertiesClass.MapSchemaBoxed](#mapschemaboxed)
sealed interface for validated payloads | -| record | [MixedPropertiesAndAdditionalPropertiesClass.MapSchemaBoxedMap](#mapschemaboxedmap)
boxed class to store validated Map payloads | -| static class | [MixedPropertiesAndAdditionalPropertiesClass.MapSchema](#mapschema)
schema class | -| static class | [MixedPropertiesAndAdditionalPropertiesClass.MapMapBuilder](#mapmapbuilder)
builder for Map payloads | -| static class | [MixedPropertiesAndAdditionalPropertiesClass.MapMap](#mapmap)
output class for Map payloads | -| sealed interface | [MixedPropertiesAndAdditionalPropertiesClass.DateTimeBoxed](#datetimeboxed)
sealed interface for validated payloads | -| record | [MixedPropertiesAndAdditionalPropertiesClass.DateTimeBoxedString](#datetimeboxedstring)
boxed class to store validated String payloads | -| static class | [MixedPropertiesAndAdditionalPropertiesClass.DateTime](#datetime)
schema class | -| sealed interface | [MixedPropertiesAndAdditionalPropertiesClass.UuidSchemaBoxed](#uuidschemaboxed)
sealed interface for validated payloads | -| record | [MixedPropertiesAndAdditionalPropertiesClass.UuidSchemaBoxedString](#uuidschemaboxedstring)
boxed class to store validated String payloads | -| static class | [MixedPropertiesAndAdditionalPropertiesClass.UuidSchema](#uuidschema)
schema class | - -## MixedPropertiesAndAdditionalPropertiesClass1Boxed -public sealed interface MixedPropertiesAndAdditionalPropertiesClass1Boxed
-permits
-[MixedPropertiesAndAdditionalPropertiesClass1BoxedMap](#mixedpropertiesandadditionalpropertiesclass1boxedmap) - -sealed interface that stores validated payloads using boxed classes - -## MixedPropertiesAndAdditionalPropertiesClass1BoxedMap -public record MixedPropertiesAndAdditionalPropertiesClass1BoxedMap
-implements [MixedPropertiesAndAdditionalPropertiesClass1Boxed](#mixedpropertiesandadditionalpropertiesclass1boxed) - -record that stores validated Map payloads, sealed permits implementation - -### Constructor Summary -| Constructor and Description | -| --------------------------- | -| MixedPropertiesAndAdditionalPropertiesClass1BoxedMap([MixedPropertiesAndAdditionalPropertiesClassMap](#mixedpropertiesandadditionalpropertiesclassmap) data)
Creates an instance, private visibility | - -### Method Summary -| Modifier and Type | Method and Description | -| ----------------- | ---------------------- | -| [MixedPropertiesAndAdditionalPropertiesClassMap](#mixedpropertiesandadditionalpropertiesclassmap) | data()
validated payload | -| @Nullable Object | getData()
validated payload | - -## MixedPropertiesAndAdditionalPropertiesClass1 -public static class MixedPropertiesAndAdditionalPropertiesClass1
-extends JsonSchema - -A schema class that validates payloads - -### Code Sample -``` -import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags; -import org.openapijsonschematools.client.configurations.SchemaConfiguration; -import org.openapijsonschematools.client.exceptions.ValidationException; -import org.openapijsonschematools.client.schemas.validation.MapUtils; -import org.openapijsonschematools.client.schemas.validation.FrozenList; -import org.openapijsonschematools.client.schemas.validation.FrozenMap; -import org.openapijsonschematools.client.components.schemas.MixedPropertiesAndAdditionalPropertiesClass; - -import java.util.Arrays; -import java.util.List; -import java.util.AbstractMap; - -static final SchemaConfiguration configuration = new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().build()); - -// Map validation -MixedPropertiesAndAdditionalPropertiesClass.MixedPropertiesAndAdditionalPropertiesClassMap validatedPayload = - MixedPropertiesAndAdditionalPropertiesClass.MixedPropertiesAndAdditionalPropertiesClass1.validate( - new MixedPropertiesAndAdditionalPropertiesClass.MixedPropertiesAndAdditionalPropertiesClassMapBuilder() - .setUuid("046b6c7f-0b8a-43b9-b35d-6489e6daee91") - - .dateTime("1970-01-01T00:00:00.00Z") - - .setMap( - MapUtils.makeMap( - new AbstractMap.SimpleEntry>( - "someAdditionalProperty", - MapUtils.makeMap( - new AbstractMap.SimpleEntry( - "className", - "a" - ), - new AbstractMap.SimpleEntry( - "color", - "a" - ) - ) - ) - ) - ) - .build(), - configuration -); -``` - -### Field Summary -| Modifier and Type | Field and Description | -| ----------------- | ---------------------- | -| Set> | type = Set.of(Map.class) | -| Map> | properties = Map.ofEntries(
    new PropertyEntry("uuid", [UuidSchema.class](#uuidschema))),
    new PropertyEntry("dateTime", [DateTime.class](#datetime))),
    new PropertyEntry("map", [MapSchema.class](#mapschema)))
)
| - -### Method Summary -| Modifier and Type | Method and Description | -| ----------------- | ---------------------- | -| [MixedPropertiesAndAdditionalPropertiesClassMap](#mixedpropertiesandadditionalpropertiesclassmap) | validate([Map<?, ?>](#mixedpropertiesandadditionalpropertiesclassmapbuilder) arg, SchemaConfiguration configuration) | -| [MixedPropertiesAndAdditionalPropertiesClass1BoxedMap](#mixedpropertiesandadditionalpropertiesclass1boxedmap) | validateAndBox([Map<?, ?>](#mixedpropertiesandadditionalpropertiesclassmapbuilder) arg, SchemaConfiguration configuration) | -| [MixedPropertiesAndAdditionalPropertiesClass1Boxed](#mixedpropertiesandadditionalpropertiesclass1boxed) | validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) | -| @Nullable Object | validate(@Nullable Object arg, SchemaConfiguration configuration) | - -## MixedPropertiesAndAdditionalPropertiesClassMapBuilder -public class MixedPropertiesAndAdditionalPropertiesClassMapBuilder
-builder for `Map` - -A class that builds the Map input type - -### Constructor Summary -| Constructor and Description | -| --------------------------- | -| MixedPropertiesAndAdditionalPropertiesClassMapBuilder()
Creates a builder that contains an empty map | - -### Method Summary -| Modifier and Type | Method and Description | -| ----------------- | ---------------------- | -| Map | build()
Returns map input that should be used with Schema.validate | -| [MixedPropertiesAndAdditionalPropertiesClassMapBuilder](#mixedpropertiesandadditionalpropertiesclassmapbuilder) | setUuid(String value) | -| [MixedPropertiesAndAdditionalPropertiesClassMapBuilder](#mixedpropertiesandadditionalpropertiesclassmapbuilder) | dateTime(String value) | -| [MixedPropertiesAndAdditionalPropertiesClassMapBuilder](#mixedpropertiesandadditionalpropertiesclassmapbuilder) | setMap(Map> value) | -| [MixedPropertiesAndAdditionalPropertiesClassMapBuilder](#mixedpropertiesandadditionalpropertiesclassmapbuilder) | additionalProperty(String key, Nothing? value) | -| [MixedPropertiesAndAdditionalPropertiesClassMapBuilder](#mixedpropertiesandadditionalpropertiesclassmapbuilder) | additionalProperty(String key, boolean value) | -| [MixedPropertiesAndAdditionalPropertiesClassMapBuilder](#mixedpropertiesandadditionalpropertiesclassmapbuilder) | additionalProperty(String key, String value) | -| [MixedPropertiesAndAdditionalPropertiesClassMapBuilder](#mixedpropertiesandadditionalpropertiesclassmapbuilder) | additionalProperty(String key, int value) | -| [MixedPropertiesAndAdditionalPropertiesClassMapBuilder](#mixedpropertiesandadditionalpropertiesclassmapbuilder) | additionalProperty(String key, float value) | -| [MixedPropertiesAndAdditionalPropertiesClassMapBuilder](#mixedpropertiesandadditionalpropertiesclassmapbuilder) | additionalProperty(String key, long value) | -| [MixedPropertiesAndAdditionalPropertiesClassMapBuilder](#mixedpropertiesandadditionalpropertiesclassmapbuilder) | additionalProperty(String key, double value) | -| [MixedPropertiesAndAdditionalPropertiesClassMapBuilder](#mixedpropertiesandadditionalpropertiesclassmapbuilder) | additionalProperty(String key, List value) | -| [MixedPropertiesAndAdditionalPropertiesClassMapBuilder](#mixedpropertiesandadditionalpropertiesclassmapbuilder) | additionalProperty(String key, Map value) | - -## MixedPropertiesAndAdditionalPropertiesClassMap -public static class MixedPropertiesAndAdditionalPropertiesClassMap
-extends FrozenMap - -A class to store validated Map payloads - -### Method Summary -| Modifier and Type | Method and Description | -| ----------------- | ---------------------- | -| static [MixedPropertiesAndAdditionalPropertiesClassMap](#mixedpropertiesandadditionalpropertiesclassmap) | of([Map](#mixedpropertiesandadditionalpropertiesclassmapbuilder) arg, SchemaConfiguration configuration) | -| String | dateTime()
[optional] value must conform to RFC-3339 date-time | -| @Nullable Object | get(String key)
This schema has invalid Java names so this method must be used when you access instance["uuid"], instance["map"], | -| @Nullable Object | getAdditionalProperty(String name)
provides type safety for additional properties | - -## MapSchemaBoxed -public sealed interface MapSchemaBoxed
-permits
-[MapSchemaBoxedMap](#mapschemaboxedmap) - -sealed interface that stores validated payloads using boxed classes - -## MapSchemaBoxedMap -public record MapSchemaBoxedMap
-implements [MapSchemaBoxed](#mapschemaboxed) - -record that stores validated Map payloads, sealed permits implementation - -### Constructor Summary -| Constructor and Description | -| --------------------------- | -| MapSchemaBoxedMap([MapMap](#mapmap) data)
Creates an instance, private visibility | - -### Method Summary -| Modifier and Type | Method and Description | -| ----------------- | ---------------------- | -| [MapMap](#mapmap) | data()
validated payload | -| @Nullable Object | getData()
validated payload | - -## MapSchema -public static class MapSchema
-extends JsonSchema - -A schema class that validates payloads - -### Code Sample -``` -import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags; -import org.openapijsonschematools.client.configurations.SchemaConfiguration; -import org.openapijsonschematools.client.exceptions.ValidationException; -import org.openapijsonschematools.client.schemas.validation.MapUtils; -import org.openapijsonschematools.client.schemas.validation.FrozenList; -import org.openapijsonschematools.client.schemas.validation.FrozenMap; -import org.openapijsonschematools.client.components.schemas.MixedPropertiesAndAdditionalPropertiesClass; - -import java.util.Arrays; -import java.util.List; -import java.util.AbstractMap; - -static final SchemaConfiguration configuration = new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().build()); - -// Map validation -MixedPropertiesAndAdditionalPropertiesClass.MapMap validatedPayload = - MixedPropertiesAndAdditionalPropertiesClass.MapSchema.validate( - new MixedPropertiesAndAdditionalPropertiesClass.MapMapBuilder() - .additionalProperty( - "someAdditionalProperty", - MapUtils.makeMap( - new AbstractMap.SimpleEntry( - "className", - "a" - ), - new AbstractMap.SimpleEntry( - "color", - "a" - ) - ) - ) - .build(), - configuration -); -``` - -### Field Summary -| Modifier and Type | Field and Description | -| ----------------- | ---------------------- | -| Set> | type = Set.of(Map.class) | -| Class | additionalProperties = [Animal.Animal1.class](../../components/schemas/Animal.md#animal1) | - -### Method Summary -| Modifier and Type | Method and Description | -| ----------------- | ---------------------- | -| [MapMap](#mapmap) | validate([Map<?, ?>](#mapmapbuilder) arg, SchemaConfiguration configuration) | -| [MapSchemaBoxedMap](#mapschemaboxedmap) | validateAndBox([Map<?, ?>](#mapmapbuilder) arg, SchemaConfiguration configuration) | -| [MapSchemaBoxed](#mapschemaboxed) | validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) | -| @Nullable Object | validate(@Nullable Object arg, SchemaConfiguration configuration) | - -## MapMapBuilder -public class MapMapBuilder
-builder for `Map>` - -A class that builds the Map input type - -### Constructor Summary -| Constructor and Description | -| --------------------------- | -| MapMapBuilder()
Creates a builder that contains an empty map | - -### Method Summary -| Modifier and Type | Method and Description | -| ----------------- | ---------------------- | -| Map> | build()
Returns map input that should be used with Schema.validate | -| [MapMapBuilder](#mapmapbuilder) | additionalProperty(String key, Map value) | - -## MapMap -public static class MapMap
-extends FrozenMap - -A class to store validated Map payloads - -### Method Summary -| Modifier and Type | Method and Description | -| ----------------- | ---------------------- | -| static [MapMap](#mapmap) | of([Map>](#mapmapbuilder) arg, SchemaConfiguration configuration) | -| [Animal.AnimalMap](../../components/schemas/Animal.md#animalmap) | getAdditionalProperty(String name)
provides type safety for additional properties | - -## DateTimeBoxed -public sealed interface DateTimeBoxed
-permits
-[DateTimeBoxedString](#datetimeboxedstring) - -sealed interface that stores validated payloads using boxed classes - -## DateTimeBoxedString -public record DateTimeBoxedString
-implements [DateTimeBoxed](#datetimeboxed) - -record that stores validated String payloads, sealed permits implementation - -### Constructor Summary -| Constructor and Description | -| --------------------------- | -| DateTimeBoxedString(String data)
Creates an instance, private visibility | - -### Method Summary -| Modifier and Type | Method and Description | -| ----------------- | ---------------------- | -| String | data()
validated payload | -| @Nullable Object | getData()
validated payload | - -## DateTime -public static class DateTime
-extends DateTimeJsonSchema.DateTimeJsonSchema1 - -A schema class that validates payloads - -| Methods Inherited from class org.openapijsonschematools.client.schemas.DateTimeJsonSchema.DateTimeJsonSchema1 | -| ------------------------------------------------------------------ | -| validate | -| validateAndBox | - -## UuidSchemaBoxed -public sealed interface UuidSchemaBoxed
-permits
-[UuidSchemaBoxedString](#uuidschemaboxedstring) - -sealed interface that stores validated payloads using boxed classes - -## UuidSchemaBoxedString -public record UuidSchemaBoxedString
-implements [UuidSchemaBoxed](#uuidschemaboxed) - -record that stores validated String payloads, sealed permits implementation - -### Constructor Summary -| Constructor and Description | -| --------------------------- | -| UuidSchemaBoxedString(String data)
Creates an instance, private visibility | - -### Method Summary -| Modifier and Type | Method and Description | -| ----------------- | ---------------------- | -| String | data()
validated payload | -| @Nullable Object | getData()
validated payload | - -## UuidSchema -public static class UuidSchema
-extends UuidJsonSchema.UuidJsonSchema1 - -A schema class that validates payloads - -| Methods Inherited from class org.openapijsonschematools.client.schemas.UuidJsonSchema.UuidJsonSchema1 | -| ------------------------------------------------------------------ | -| validate | -| validateAndBox | - -[[Back to top]](#top) [[Back to Component Schemas]](../../../README.md#Component-Schemas) [[Back to README]](../../../README.md) diff --git a/samples/client/petstore/kotlin/docs/components/schemas/Money.md b/samples/client/petstore/kotlin/docs/components/schemas/Money.md deleted file mode 100644 index 80ee219f343..00000000000 --- a/samples/client/petstore/kotlin/docs/components/schemas/Money.md +++ /dev/null @@ -1,347 +0,0 @@ -# Money -org.openapijsonschematools.client.components.schemas.Money.java -public class Money
- -A class that contains necessary nested -- schema classes (which validate payloads), extends JsonSchema -- sealed interfaces which store validated payloads, java version of a sum type -- boxed classes which store validated payloads, sealed permits class implementations -- classes to store validated map payloads, extends FrozenMap -- classes to build inputs for map payloads - -## Nested Class Summary -| Modifier and Type | Class and Description | -| ----------------- | ---------------------- | -| sealed interface | [Money.Money1Boxed](#money1boxed)
sealed interface for validated payloads | -| record | [Money.Money1BoxedMap](#money1boxedmap)
boxed class to store validated Map payloads | -| static class | [Money.Money1](#money1)
schema class | -| static class | [Money.MoneyMapBuilder](#moneymapbuilder)
builder for Map payloads | -| static class | [Money.MoneyMap](#moneymap)
output class for Map payloads | -| sealed interface | [Money.AmountBoxed](#amountboxed)
sealed interface for validated payloads | -| record | [Money.AmountBoxedString](#amountboxedstring)
boxed class to store validated String payloads | -| static class | [Money.Amount](#amount)
schema class | -| sealed interface | [Money.AdditionalPropertiesBoxed](#additionalpropertiesboxed)
sealed interface for validated payloads | -| record | [Money.AdditionalPropertiesBoxedVoid](#additionalpropertiesboxedvoid)
boxed class to store validated null payloads | -| record | [Money.AdditionalPropertiesBoxedBoolean](#additionalpropertiesboxedboolean)
boxed class to store validated boolean payloads | -| record | [Money.AdditionalPropertiesBoxedNumber](#additionalpropertiesboxednumber)
boxed class to store validated Number payloads | -| record | [Money.AdditionalPropertiesBoxedString](#additionalpropertiesboxedstring)
boxed class to store validated String payloads | -| record | [Money.AdditionalPropertiesBoxedList](#additionalpropertiesboxedlist)
boxed class to store validated List payloads | -| record | [Money.AdditionalPropertiesBoxedMap](#additionalpropertiesboxedmap)
boxed class to store validated Map payloads | -| static class | [Money.AdditionalProperties](#additionalproperties)
schema class | - -## Money1Boxed -public sealed interface Money1Boxed
-permits
-[Money1BoxedMap](#money1boxedmap) - -sealed interface that stores validated payloads using boxed classes - -## Money1BoxedMap -public record Money1BoxedMap
-implements [Money1Boxed](#money1boxed) - -record that stores validated Map payloads, sealed permits implementation - -### Constructor Summary -| Constructor and Description | -| --------------------------- | -| Money1BoxedMap([MoneyMap](#moneymap) data)
Creates an instance, private visibility | - -### Method Summary -| Modifier and Type | Method and Description | -| ----------------- | ---------------------- | -| [MoneyMap](#moneymap) | data()
validated payload | -| @Nullable Object | getData()
validated payload | - -## Money1 -public static class Money1
-extends JsonSchema - -A schema class that validates payloads - -### Code Sample -``` -import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags; -import org.openapijsonschematools.client.configurations.SchemaConfiguration; -import org.openapijsonschematools.client.exceptions.ValidationException; -import org.openapijsonschematools.client.schemas.validation.MapUtils; -import org.openapijsonschematools.client.schemas.validation.FrozenList; -import org.openapijsonschematools.client.schemas.validation.FrozenMap; -import org.openapijsonschematools.client.components.schemas.Money; - -import java.util.Arrays; -import java.util.List; -import java.util.AbstractMap; - -static final SchemaConfiguration configuration = new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().build()); - -// Map validation -Money.MoneyMap validatedPayload = - Money.Money1.validate( - new Money.MoneyMapBuilder() - .amount("3.14") - - .currency("eur") - - .build(), - configuration -); -``` - -### Field Summary -| Modifier and Type | Field and Description | -| ----------------- | ---------------------- | -| Set> | type = Set.of(Map.class) | -| Map> | properties = Map.ofEntries(
    new PropertyEntry("amount", [Amount.class](#amount))),
    new PropertyEntry("currency", [Currency.Currency1.class](../../components/schemas/Currency.md#currency1))
)
| -| Set | required = Set.of(
    "amount",
    "currency"
)
| -| Class | additionalProperties = [AdditionalProperties.class](#additionalproperties) | - -### Method Summary -| Modifier and Type | Method and Description | -| ----------------- | ---------------------- | -| [MoneyMap](#moneymap) | validate([Map<?, ?>](#moneymapbuilder) arg, SchemaConfiguration configuration) | -| [Money1BoxedMap](#money1boxedmap) | validateAndBox([Map<?, ?>](#moneymapbuilder) arg, SchemaConfiguration configuration) | -| [Money1Boxed](#money1boxed) | validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) | -| @Nullable Object | validate(@Nullable Object arg, SchemaConfiguration configuration) | - -## MoneyMap00Builder -public class MoneyMap00Builder
-builder for `Map` - -A class that builds the Map input type - -### Constructor Summary -| Constructor and Description | -| --------------------------- | -| MoneyMap00Builder(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 | - -## MoneyMap01Builder -public class MoneyMap01Builder
-builder for `Map` - -A class that builds the Map input type - -### Constructor Summary -| Constructor and Description | -| --------------------------- | -| MoneyMap01Builder(Map instance)
Creates a builder that contains the passed instance | - -### Method Summary -| Modifier and Type | Method and Description | -| ----------------- | ---------------------- | -| [MoneyMap00Builder](#moneymap00builder) | currency(String value) | -| [MoneyMap00Builder](#moneymap00builder) | currency([Currency.StringCurrencyEnums](../../components/schemas/Currency.md#stringcurrencyenums) value) | - -## MoneyMap10Builder -public class MoneyMap10Builder
-builder for `Map` - -A class that builds the Map input type - -### Constructor Summary -| Constructor and Description | -| --------------------------- | -| MoneyMap10Builder(Map instance)
Creates a builder that contains the passed instance | - -### Method Summary -| Modifier and Type | Method and Description | -| ----------------- | ---------------------- | -| [MoneyMap00Builder](#moneymap00builder) | amount(String value) | - -## MoneyMapBuilder -public class MoneyMapBuilder
-builder for `Map` - -A class that builds the Map input type - -### Constructor Summary -| Constructor and Description | -| --------------------------- | -| MoneyMapBuilder()
Creates a builder that contains an empty map | - -### Method Summary -| Modifier and Type | Method and Description | -| ----------------- | ---------------------- | -| [MoneyMap01Builder](#moneymap01builder) | amount(String value) | -| [MoneyMap10Builder](#moneymap10builder) | currency(String value) | -| [MoneyMap10Builder](#moneymap10builder) | currency([Currency.StringCurrencyEnums](../../components/schemas/Currency.md#stringcurrencyenums) value) | - -## MoneyMap -public static class MoneyMap
-extends FrozenMap - -A class to store validated Map payloads - -### Method Summary -| Modifier and Type | Method and Description | -| ----------------- | ---------------------- | -| static [MoneyMap](#moneymap) | of([Map](#moneymapbuilder) arg, SchemaConfiguration configuration) | -| String | amount()
value must be int or float numeric | -| String | currency()
| - -## AmountBoxed -public sealed interface AmountBoxed
-permits
-[AmountBoxedString](#amountboxedstring) - -sealed interface that stores validated payloads using boxed classes - -## AmountBoxedString -public record AmountBoxedString
-implements [AmountBoxed](#amountboxed) - -record that stores validated String payloads, sealed permits implementation - -### Constructor Summary -| Constructor and Description | -| --------------------------- | -| AmountBoxedString(String data)
Creates an instance, private visibility | - -### Method Summary -| Modifier and Type | Method and Description | -| ----------------- | ---------------------- | -| String | data()
validated payload | -| @Nullable Object | getData()
validated payload | - -## Amount -public static class Amount
-extends DecimalJsonSchema.DecimalJsonSchema1 - -A schema class that validates payloads - -| Methods Inherited from class org.openapijsonschematools.client.schemas.DecimalJsonSchema.DecimalJsonSchema1 | -| ------------------------------------------------------------------ | -| validate | -| validateAndBox | - -## 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(Nothing? data)
Creates an instance, private visibility | - -### Method Summary -| Modifier and Type | Method and Description | -| ----------------- | ---------------------- | -| Nothing? | 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 Component Schemas]](../../../README.md#Component-Schemas) [[Back to README]](../../../README.md) diff --git a/samples/client/petstore/kotlin/docs/components/schemas/MultiPropertiesSchema.md b/samples/client/petstore/kotlin/docs/components/schemas/MultiPropertiesSchema.md deleted file mode 100644 index 4cc7860079a..00000000000 --- a/samples/client/petstore/kotlin/docs/components/schemas/MultiPropertiesSchema.md +++ /dev/null @@ -1,463 +0,0 @@ -# MultiPropertiesSchema -org.openapijsonschematools.client.components.schemas.MultiPropertiesSchema.java -public class MultiPropertiesSchema
- -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 list payloads, extends FrozenList -- classes to build inputs for list payloads -- classes to store validated map payloads, extends FrozenMap -- classes to build inputs for map payloads - -## Nested Class Summary -| Modifier and Type | Class and Description | -| ----------------- | ---------------------- | -| sealed interface | [MultiPropertiesSchema.MultiPropertiesSchema1Boxed](#multipropertiesschema1boxed)
sealed interface for validated payloads | -| record | [MultiPropertiesSchema.MultiPropertiesSchema1BoxedMap](#multipropertiesschema1boxedmap)
boxed class to store validated Map payloads | -| static class | [MultiPropertiesSchema.MultiPropertiesSchema1](#multipropertiesschema1)
schema class | -| static class | [MultiPropertiesSchema.MultiPropertiesSchemaMapBuilder](#multipropertiesschemamapbuilder)
builder for Map payloads | -| static class | [MultiPropertiesSchema.MultiPropertiesSchemaMap](#multipropertiesschemamap)
output class for Map payloads | -| sealed interface | [MultiPropertiesSchema.DataBoxed](#databoxed)
sealed interface for validated payloads | -| record | [MultiPropertiesSchema.DataBoxedList](#databoxedlist)
boxed class to store validated List payloads | -| static class | [MultiPropertiesSchema.Data](#data)
schema class | -| static class | [MultiPropertiesSchema.DataListBuilder](#datalistbuilder)
builder for List payloads | -| static class | [MultiPropertiesSchema.DataList](#datalist)
output class for List payloads | -| sealed interface | [MultiPropertiesSchema.MessageBoxed](#messageboxed)
sealed interface for validated payloads | -| record | [MultiPropertiesSchema.MessageBoxedString](#messageboxedstring)
boxed class to store validated String payloads | -| static class | [MultiPropertiesSchema.Message](#message)
schema class | -| sealed interface | [MultiPropertiesSchema.StatusBoxed](#statusboxed)
sealed interface for validated payloads | -| record | [MultiPropertiesSchema.StatusBoxedNumber](#statusboxednumber)
boxed class to store validated Number payloads | -| static class | [MultiPropertiesSchema.Status](#status)
schema class | -| sealed interface | [MultiPropertiesSchema.AdditionalPropertiesBoxed](#additionalpropertiesboxed)
sealed interface for validated payloads | -| record | [MultiPropertiesSchema.AdditionalPropertiesBoxedVoid](#additionalpropertiesboxedvoid)
boxed class to store validated null payloads | -| record | [MultiPropertiesSchema.AdditionalPropertiesBoxedBoolean](#additionalpropertiesboxedboolean)
boxed class to store validated boolean payloads | -| record | [MultiPropertiesSchema.AdditionalPropertiesBoxedNumber](#additionalpropertiesboxednumber)
boxed class to store validated Number payloads | -| record | [MultiPropertiesSchema.AdditionalPropertiesBoxedString](#additionalpropertiesboxedstring)
boxed class to store validated String payloads | -| record | [MultiPropertiesSchema.AdditionalPropertiesBoxedList](#additionalpropertiesboxedlist)
boxed class to store validated List payloads | -| record | [MultiPropertiesSchema.AdditionalPropertiesBoxedMap](#additionalpropertiesboxedmap)
boxed class to store validated Map payloads | -| static class | [MultiPropertiesSchema.AdditionalProperties](#additionalproperties)
schema class | - -## MultiPropertiesSchema1Boxed -public sealed interface MultiPropertiesSchema1Boxed
-permits
-[MultiPropertiesSchema1BoxedMap](#multipropertiesschema1boxedmap) - -sealed interface that stores validated payloads using boxed classes - -## MultiPropertiesSchema1BoxedMap -public record MultiPropertiesSchema1BoxedMap
-implements [MultiPropertiesSchema1Boxed](#multipropertiesschema1boxed) - -record that stores validated Map payloads, sealed permits implementation - -### Constructor Summary -| Constructor and Description | -| --------------------------- | -| MultiPropertiesSchema1BoxedMap([MultiPropertiesSchemaMap](#multipropertiesschemamap) data)
Creates an instance, private visibility | - -### Method Summary -| Modifier and Type | Method and Description | -| ----------------- | ---------------------- | -| [MultiPropertiesSchemaMap](#multipropertiesschemamap) | data()
validated payload | -| @Nullable Object | getData()
validated payload | - -## MultiPropertiesSchema1 -public static class MultiPropertiesSchema1
-extends JsonSchema - -A schema class that validates payloads - -### Code Sample -``` -import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags; -import org.openapijsonschematools.client.configurations.SchemaConfiguration; -import org.openapijsonschematools.client.exceptions.ValidationException; -import org.openapijsonschematools.client.schemas.validation.MapUtils; -import org.openapijsonschematools.client.schemas.validation.FrozenList; -import org.openapijsonschematools.client.schemas.validation.FrozenMap; -import org.openapijsonschematools.client.components.schemas.MultiPropertiesSchema; - -import java.util.Arrays; -import java.util.List; -import java.util.AbstractMap; - -static final SchemaConfiguration configuration = new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().build()); - -// Map validation -MultiPropertiesSchema.MultiPropertiesSchemaMap validatedPayload = - MultiPropertiesSchema.MultiPropertiesSchema1.validate( - new MultiPropertiesSchema.MultiPropertiesSchemaMapBuilder() - .status(1) - - .data( - Arrays.asList( - ) - ) - .message("a") - - .build(), - configuration -); -``` - -### Field Summary -| Modifier and Type | Field and Description | -| ----------------- | ---------------------- | -| Set> | type = Set.of(Map.class) | -| Map> | properties = Map.ofEntries(
    new PropertyEntry("status", [Status.class](#status))),
    new PropertyEntry("data", [Data.class](#data))),
    new PropertyEntry("message", [Message.class](#message)))
)
| -| Set | required = Set.of(
    "status"
)
| -| Class | additionalProperties = [AdditionalProperties.class](#additionalproperties) | - -### Method Summary -| Modifier and Type | Method and Description | -| ----------------- | ---------------------- | -| [MultiPropertiesSchemaMap](#multipropertiesschemamap) | validate([Map<?, ?>](#multipropertiesschemamapbuilder) arg, SchemaConfiguration configuration) | -| [MultiPropertiesSchema1BoxedMap](#multipropertiesschema1boxedmap) | validateAndBox([Map<?, ?>](#multipropertiesschemamapbuilder) arg, SchemaConfiguration configuration) | -| [MultiPropertiesSchema1Boxed](#multipropertiesschema1boxed) | validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) | -| @Nullable Object | validate(@Nullable Object arg, SchemaConfiguration configuration) | - -## MultiPropertiesSchemaMap0Builder -public class MultiPropertiesSchemaMap0Builder
-builder for `Map` - -A class that builds the Map input type - -### Constructor Summary -| Constructor and Description | -| --------------------------- | -| MultiPropertiesSchemaMap0Builder(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 | -| [MultiPropertiesSchemaMap0Builder](#multipropertiesschemamap0builder) | data(List> value) | -| [MultiPropertiesSchemaMap0Builder](#multipropertiesschemamap0builder) | message(String value) | - -## MultiPropertiesSchemaMapBuilder -public class MultiPropertiesSchemaMapBuilder
-builder for `Map` - -A class that builds the Map input type - -### Constructor Summary -| Constructor and Description | -| --------------------------- | -| MultiPropertiesSchemaMapBuilder()
Creates a builder that contains an empty map | - -### Method Summary -| Modifier and Type | Method and Description | -| ----------------- | ---------------------- | -| [MultiPropertiesSchemaMap0Builder](#multipropertiesschemamap0builder) | status(int value) | -| [MultiPropertiesSchemaMap0Builder](#multipropertiesschemamap0builder) | status(float value) | - -## MultiPropertiesSchemaMap -public static class MultiPropertiesSchemaMap
-extends FrozenMap - -A class to store validated Map payloads - -### Method Summary -| Modifier and Type | Method and Description | -| ----------------- | ---------------------- | -| static [MultiPropertiesSchemaMap](#multipropertiesschemamap) | of([Map](#multipropertiesschemamapbuilder) arg, SchemaConfiguration configuration) | -| Number | status()
value must be a 32 bit integer | -| [DataList](#datalist) | data()
[optional] | -| String | message()
[optional] | - -## DataBoxed -public sealed interface DataBoxed
-permits
-[DataBoxedList](#databoxedlist) - -sealed interface that stores validated payloads using boxed classes - -## DataBoxedList -public record DataBoxedList
-implements [DataBoxed](#databoxed) - -record that stores validated List payloads, sealed permits implementation - -### Constructor Summary -| Constructor and Description | -| --------------------------- | -| DataBoxedList([DataList](#datalist) data)
Creates an instance, private visibility | - -### Method Summary -| Modifier and Type | Method and Description | -| ----------------- | ---------------------- | -| [DataList](#datalist) | data()
validated payload | -| @Nullable Object | getData()
validated payload | - -## Data -public static class Data
-extends JsonSchema - -A schema class that validates payloads - -### Code Sample -``` -import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags; -import org.openapijsonschematools.client.configurations.SchemaConfiguration; -import org.openapijsonschematools.client.exceptions.ValidationException; -import org.openapijsonschematools.client.schemas.validation.MapUtils; -import org.openapijsonschematools.client.schemas.validation.FrozenList; -import org.openapijsonschematools.client.schemas.validation.FrozenMap; -import org.openapijsonschematools.client.components.schemas.MultiPropertiesSchema; - -import java.util.Arrays; -import java.util.List; -import java.util.AbstractMap; - -static final SchemaConfiguration configuration = new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().build()); - -// List validation -MultiPropertiesSchema.DataList validatedPayload = - MultiPropertiesSchema.Data.validate( - new MultiPropertiesSchema.DataListBuilder() - .build(), - configuration -); -``` - -### Field Summary -| Modifier and Type | Field and Description | -| ----------------- | ---------------------- | -| Set> | type = Set.of(List.class) | -| Class | items = [ItemsSchema.ItemsSchema1.class](../../components/schemas/ItemsSchema.md#itemsschema1) | - -### Method Summary -| Modifier and Type | Method and Description | -| ----------------- | ---------------------- | -| [DataList](#datalist) | validate([List](#datalistbuilder) arg, SchemaConfiguration configuration) | -| [DataBoxedList](#databoxedlist) | validateAndBox([List](#datalistbuilder) arg, SchemaConfiguration configuration) | -| [DataBoxed](#databoxed) | validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) | -| @Nullable Object | validate(@Nullable Object arg, SchemaConfiguration configuration) | - -## DataListBuilder -public class DataListBuilder
-builder for `List>` - -A class that builds the List input type - -### Constructor Summary -| Constructor and Description | -| --------------------------- | -| DataListBuilder()
Creates an empty list | -| DataListBuilder(List> items)
Stores the items in a list | - -### Method Summary -| Modifier and Type | Method and Description | -| ----------------- | ---------------------- | -| DataListBuilder | add(Map item) | -| List> | build()
Returns list input that should be used with Schema.validate | - -## DataList -public class DataList
-extends `FrozenList` - -A class to store validated List payloads - -### Method Summary -| Modifier and Type | Method and Description | -| ----------------- | ---------------------- | -| static [DataList](#datalist) | of([List>](#datalistbuilder) arg, SchemaConfiguration configuration) | - -## MessageBoxed -public sealed interface MessageBoxed
-permits
-[MessageBoxedString](#messageboxedstring) - -sealed interface that stores validated payloads using boxed classes - -## MessageBoxedString -public record MessageBoxedString
-implements [MessageBoxed](#messageboxed) - -record that stores validated String payloads, sealed permits implementation - -### Constructor Summary -| Constructor and Description | -| --------------------------- | -| MessageBoxedString(String data)
Creates an instance, private visibility | - -### Method Summary -| Modifier and Type | Method and Description | -| ----------------- | ---------------------- | -| String | data()
validated payload | -| @Nullable Object | getData()
validated payload | - -## Message -public static class Message
-extends StringJsonSchema.StringJsonSchema1 - -A schema class that validates payloads - -| Methods Inherited from class org.openapijsonschematools.client.schemas.StringJsonSchema.StringJsonSchema1 | -| ------------------------------------------------------------------ | -| validate | -| validateAndBox | - -## StatusBoxed -public sealed interface StatusBoxed
-permits
-[StatusBoxedNumber](#statusboxednumber) - -sealed interface that stores validated payloads using boxed classes - -## StatusBoxedNumber -public record StatusBoxedNumber
-implements [StatusBoxed](#statusboxed) - -record that stores validated Number payloads, sealed permits implementation - -### Constructor Summary -| Constructor and Description | -| --------------------------- | -| StatusBoxedNumber(Number data)
Creates an instance, private visibility | - -### Method Summary -| Modifier and Type | Method and Description | -| ----------------- | ---------------------- | -| Number | data()
validated payload | -| @Nullable Object | getData()
validated payload | - -## Status -public static class Status
-extends Int32JsonSchema.Int32JsonSchema1 - -A schema class that validates payloads - -| Methods Inherited from class org.openapijsonschematools.client.schemas.Int32JsonSchema.Int32JsonSchema1 | -| ------------------------------------------------------------------ | -| validate | -| validateAndBox | - -## 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(Nothing? data)
Creates an instance, private visibility | - -### Method Summary -| Modifier and Type | Method and Description | -| ----------------- | ---------------------- | -| Nothing? | 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 Component Schemas]](../../../README.md#Component-Schemas) [[Back to README]](../../../README.md) diff --git a/samples/client/petstore/kotlin/docs/components/schemas/MyObjectDto.md b/samples/client/petstore/kotlin/docs/components/schemas/MyObjectDto.md deleted file mode 100644 index 3a9b3c4a20b..00000000000 --- a/samples/client/petstore/kotlin/docs/components/schemas/MyObjectDto.md +++ /dev/null @@ -1,293 +0,0 @@ -# MyObjectDto -org.openapijsonschematools.client.components.schemas.MyObjectDto.java -public class MyObjectDto
- -A class that contains necessary nested -- schema classes (which validate payloads), extends JsonSchema -- sealed interfaces which store validated payloads, java version of a sum type -- boxed classes which store validated payloads, sealed permits class implementations -- classes to store validated map payloads, extends FrozenMap -- classes to build inputs for map payloads - -## Nested Class Summary -| Modifier and Type | Class and Description | -| ----------------- | ---------------------- | -| sealed interface | [MyObjectDto.MyObjectDto1Boxed](#myobjectdto1boxed)
sealed interface for validated payloads | -| record | [MyObjectDto.MyObjectDto1BoxedMap](#myobjectdto1boxedmap)
boxed class to store validated Map payloads | -| static class | [MyObjectDto.MyObjectDto1](#myobjectdto1)
schema class | -| static class | [MyObjectDto.MyObjectDtoMapBuilder](#myobjectdtomapbuilder)
builder for Map payloads | -| static class | [MyObjectDto.MyObjectDtoMap](#myobjectdtomap)
output class for Map payloads | -| sealed interface | [MyObjectDto.IdBoxed](#idboxed)
sealed interface for validated payloads | -| record | [MyObjectDto.IdBoxedString](#idboxedstring)
boxed class to store validated String payloads | -| static class | [MyObjectDto.Id](#id)
schema class | -| sealed interface | [MyObjectDto.AdditionalPropertiesBoxed](#additionalpropertiesboxed)
sealed interface for validated payloads | -| record | [MyObjectDto.AdditionalPropertiesBoxedVoid](#additionalpropertiesboxedvoid)
boxed class to store validated null payloads | -| record | [MyObjectDto.AdditionalPropertiesBoxedBoolean](#additionalpropertiesboxedboolean)
boxed class to store validated boolean payloads | -| record | [MyObjectDto.AdditionalPropertiesBoxedNumber](#additionalpropertiesboxednumber)
boxed class to store validated Number payloads | -| record | [MyObjectDto.AdditionalPropertiesBoxedString](#additionalpropertiesboxedstring)
boxed class to store validated String payloads | -| record | [MyObjectDto.AdditionalPropertiesBoxedList](#additionalpropertiesboxedlist)
boxed class to store validated List payloads | -| record | [MyObjectDto.AdditionalPropertiesBoxedMap](#additionalpropertiesboxedmap)
boxed class to store validated Map payloads | -| static class | [MyObjectDto.AdditionalProperties](#additionalproperties)
schema class | - -## MyObjectDto1Boxed -public sealed interface MyObjectDto1Boxed
-permits
-[MyObjectDto1BoxedMap](#myobjectdto1boxedmap) - -sealed interface that stores validated payloads using boxed classes - -## MyObjectDto1BoxedMap -public record MyObjectDto1BoxedMap
-implements [MyObjectDto1Boxed](#myobjectdto1boxed) - -record that stores validated Map payloads, sealed permits implementation - -### Constructor Summary -| Constructor and Description | -| --------------------------- | -| MyObjectDto1BoxedMap([MyObjectDtoMap](#myobjectdtomap) data)
Creates an instance, private visibility | - -### Method Summary -| Modifier and Type | Method and Description | -| ----------------- | ---------------------- | -| [MyObjectDtoMap](#myobjectdtomap) | data()
validated payload | -| @Nullable Object | getData()
validated payload | - -## MyObjectDto1 -public static class MyObjectDto1
-extends JsonSchema - -A schema class that validates payloads - -### Code Sample -``` -import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags; -import org.openapijsonschematools.client.configurations.SchemaConfiguration; -import org.openapijsonschematools.client.exceptions.ValidationException; -import org.openapijsonschematools.client.schemas.validation.MapUtils; -import org.openapijsonschematools.client.schemas.validation.FrozenList; -import org.openapijsonschematools.client.schemas.validation.FrozenMap; -import org.openapijsonschematools.client.components.schemas.MyObjectDto; - -import java.util.Arrays; -import java.util.List; -import java.util.AbstractMap; - -static final SchemaConfiguration configuration = new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().build()); - -// Map validation -MyObjectDto.MyObjectDtoMap validatedPayload = - MyObjectDto.MyObjectDto1.validate( - new MyObjectDto.MyObjectDtoMapBuilder() - .id("046b6c7f-0b8a-43b9-b35d-6489e6daee91") - - .build(), - configuration -); -``` - -### Field Summary -| Modifier and Type | Field and Description | -| ----------------- | ---------------------- | -| Set> | type = Set.of(Map.class) | -| Map> | properties = Map.ofEntries(
    new PropertyEntry("id", [Id.class](#id)))
)
| -| Class | additionalProperties = [AdditionalProperties.class](#additionalproperties) | - -### Method Summary -| Modifier and Type | Method and Description | -| ----------------- | ---------------------- | -| [MyObjectDtoMap](#myobjectdtomap) | validate([Map<?, ?>](#myobjectdtomapbuilder) arg, SchemaConfiguration configuration) | -| [MyObjectDto1BoxedMap](#myobjectdto1boxedmap) | validateAndBox([Map<?, ?>](#myobjectdtomapbuilder) arg, SchemaConfiguration configuration) | -| [MyObjectDto1Boxed](#myobjectdto1boxed) | validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) | -| @Nullable Object | validate(@Nullable Object arg, SchemaConfiguration configuration) | - -## MyObjectDtoMapBuilder -public class MyObjectDtoMapBuilder
-builder for `Map` - -A class that builds the Map input type - -### Constructor Summary -| Constructor and Description | -| --------------------------- | -| MyObjectDtoMapBuilder()
Creates a builder that contains an empty map | - -### Method Summary -| Modifier and Type | Method and Description | -| ----------------- | ---------------------- | -| Map | build()
Returns map input that should be used with Schema.validate | -| [MyObjectDtoMapBuilder](#myobjectdtomapbuilder) | id(String value) | - -## MyObjectDtoMap -public static class MyObjectDtoMap
-extends FrozenMap - -A class to store validated Map payloads - -### Method Summary -| Modifier and Type | Method and Description | -| ----------------- | ---------------------- | -| static [MyObjectDtoMap](#myobjectdtomap) | of([Map](#myobjectdtomapbuilder) arg, SchemaConfiguration configuration) | -| String | id()
[optional] value must be a uuid | - -## IdBoxed -public sealed interface IdBoxed
-permits
-[IdBoxedString](#idboxedstring) - -sealed interface that stores validated payloads using boxed classes - -## IdBoxedString -public record IdBoxedString
-implements [IdBoxed](#idboxed) - -record that stores validated String payloads, sealed permits implementation - -### Constructor Summary -| Constructor and Description | -| --------------------------- | -| IdBoxedString(String data)
Creates an instance, private visibility | - -### Method Summary -| Modifier and Type | Method and Description | -| ----------------- | ---------------------- | -| String | data()
validated payload | -| @Nullable Object | getData()
validated payload | - -## Id -public static class Id
-extends UuidJsonSchema.UuidJsonSchema1 - -A schema class that validates payloads - -| Methods Inherited from class org.openapijsonschematools.client.schemas.UuidJsonSchema.UuidJsonSchema1 | -| ------------------------------------------------------------------ | -| validate | -| validateAndBox | - -## 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(Nothing? data)
Creates an instance, private visibility | - -### Method Summary -| Modifier and Type | Method and Description | -| ----------------- | ---------------------- | -| Nothing? | 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 Component Schemas]](../../../README.md#Component-Schemas) [[Back to README]](../../../README.md) diff --git a/samples/client/petstore/kotlin/docs/components/schemas/Name.md b/samples/client/petstore/kotlin/docs/components/schemas/Name.md deleted file mode 100644 index 145d76ec02f..00000000000 --- a/samples/client/petstore/kotlin/docs/components/schemas/Name.md +++ /dev/null @@ -1,354 +0,0 @@ -# Name -org.openapijsonschematools.client.components.schemas.Name.java -public class Name
- -A class that contains necessary nested -- schema classes (which validate payloads), extends JsonSchema -- sealed interfaces which store validated payloads, java version of a sum type -- boxed classes which store validated payloads, sealed permits class implementations -- classes to store validated map payloads, extends FrozenMap -- classes to build inputs for map payloads - -## Nested Class Summary -| Modifier and Type | Class and Description | -| ----------------- | ---------------------- | -| sealed interface | [Name.Name1Boxed](#name1boxed)
sealed interface for validated payloads | -| record | [Name.Name1BoxedVoid](#name1boxedvoid)
boxed class to store validated null payloads | -| record | [Name.Name1BoxedBoolean](#name1boxedboolean)
boxed class to store validated boolean payloads | -| record | [Name.Name1BoxedNumber](#name1boxednumber)
boxed class to store validated Number payloads | -| record | [Name.Name1BoxedString](#name1boxedstring)
boxed class to store validated String payloads | -| record | [Name.Name1BoxedList](#name1boxedlist)
boxed class to store validated List payloads | -| record | [Name.Name1BoxedMap](#name1boxedmap)
boxed class to store validated Map payloads | -| static class | [Name.Name1](#name1)
schema class | -| static class | [Name.NameMapBuilder1](#namemapbuilder1)
builder for Map payloads | -| static class | [Name.NameMap](#namemap)
output class for Map payloads | -| sealed interface | [Name.PropertyBoxed](#propertyboxed)
sealed interface for validated payloads | -| record | [Name.PropertyBoxedString](#propertyboxedstring)
boxed class to store validated String payloads | -| static class | [Name.Property](#property)
schema class | -| sealed interface | [Name.SnakeCaseBoxed](#snakecaseboxed)
sealed interface for validated payloads | -| record | [Name.SnakeCaseBoxedNumber](#snakecaseboxednumber)
boxed class to store validated Number payloads | -| static class | [Name.SnakeCase](#snakecase)
schema class | -| sealed interface | [Name.Name2Boxed](#name2boxed)
sealed interface for validated payloads | -| record | [Name.Name2BoxedNumber](#name2boxednumber)
boxed class to store validated Number payloads | -| static class | [Name.Name2](#name2)
schema class | - -## Name1Boxed -public sealed interface Name1Boxed
-permits
-[Name1BoxedVoid](#name1boxedvoid), -[Name1BoxedBoolean](#name1boxedboolean), -[Name1BoxedNumber](#name1boxednumber), -[Name1BoxedString](#name1boxedstring), -[Name1BoxedList](#name1boxedlist), -[Name1BoxedMap](#name1boxedmap) - -sealed interface that stores validated payloads using boxed classes - -## Name1BoxedVoid -public record Name1BoxedVoid
-implements [Name1Boxed](#name1boxed) - -record that stores validated null payloads, sealed permits implementation - -### Constructor Summary -| Constructor and Description | -| --------------------------- | -| Name1BoxedVoid(Nothing? data)
Creates an instance, private visibility | - -### Method Summary -| Modifier and Type | Method and Description | -| ----------------- | ---------------------- | -| Nothing? | data()
validated payload | -| @Nullable Object | getData()
validated payload | - -## Name1BoxedBoolean -public record Name1BoxedBoolean
-implements [Name1Boxed](#name1boxed) - -record that stores validated boolean payloads, sealed permits implementation - -### Constructor Summary -| Constructor and Description | -| --------------------------- | -| Name1BoxedBoolean(boolean data)
Creates an instance, private visibility | - -### Method Summary -| Modifier and Type | Method and Description | -| ----------------- | ---------------------- | -| boolean | data()
validated payload | -| @Nullable Object | getData()
validated payload | - -## Name1BoxedNumber -public record Name1BoxedNumber
-implements [Name1Boxed](#name1boxed) - -record that stores validated Number payloads, sealed permits implementation - -### Constructor Summary -| Constructor and Description | -| --------------------------- | -| Name1BoxedNumber(Number data)
Creates an instance, private visibility | - -### Method Summary -| Modifier and Type | Method and Description | -| ----------------- | ---------------------- | -| Number | data()
validated payload | -| @Nullable Object | getData()
validated payload | - -## Name1BoxedString -public record Name1BoxedString
-implements [Name1Boxed](#name1boxed) - -record that stores validated String payloads, sealed permits implementation - -### Constructor Summary -| Constructor and Description | -| --------------------------- | -| Name1BoxedString(String data)
Creates an instance, private visibility | - -### Method Summary -| Modifier and Type | Method and Description | -| ----------------- | ---------------------- | -| String | data()
validated payload | -| @Nullable Object | getData()
validated payload | - -## Name1BoxedList -public record Name1BoxedList
-implements [Name1Boxed](#name1boxed) - -record that stores validated List payloads, sealed permits implementation - -### Constructor Summary -| Constructor and Description | -| --------------------------- | -| Name1BoxedList(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 | - -## Name1BoxedMap -public record Name1BoxedMap
-implements [Name1Boxed](#name1boxed) - -record that stores validated Map payloads, sealed permits implementation - -### Constructor Summary -| Constructor and Description | -| --------------------------- | -| Name1BoxedMap([NameMap](#namemap) data)
Creates an instance, private visibility | - -### Method Summary -| Modifier and Type | Method and Description | -| ----------------- | ---------------------- | -| [NameMap](#namemap) | data()
validated payload | -| @Nullable Object | getData()
validated payload | - -## Name1 -public static class Name1
-extends JsonSchema - -A schema class that validates payloads - -## Description -Model for testing model name same as property name - -### Field Summary -| Modifier and Type | Field and Description | -| ----------------- | ---------------------- | -| Map> | properties = Map.ofEntries(
    new PropertyEntry("name", [Name2.class](#name2))),
    new PropertyEntry("snake_case", [SnakeCase.class](#snakecase))),
    new PropertyEntry("property", [Property.class](#property)))
)
| -| Set | required = Set.of(
    "name"
)
| - -### Method Summary -| Modifier and Type | Method and Description | -| ----------------- | ---------------------- | -| String | validate(String arg, SchemaConfiguration configuration) | -| Nothing? | validate(Nothing? arg, SchemaConfiguration configuration) | -| int | validate(int arg, SchemaConfiguration configuration) | -| long | validate(long arg, SchemaConfiguration configuration) | -| float | validate(float arg, SchemaConfiguration configuration) | -| double | validate(double arg, SchemaConfiguration configuration) | -| Number | validate(Number arg, SchemaConfiguration configuration) | -| boolean | validate(boolean arg, SchemaConfiguration configuration) | -| [NameMap](#namemap) | validate([Map<?, ?>](#namemapbuilder1) arg, SchemaConfiguration configuration) | -| FrozenList<@Nullable Object> | validate(List arg, SchemaConfiguration configuration) | -| [Name1BoxedString](#name1boxedstring) | validateAndBox(String arg, SchemaConfiguration configuration) | -| [Name1BoxedVoid](#name1boxedvoid) | validateAndBox(Nothing? arg, SchemaConfiguration configuration) | -| [Name1BoxedNumber](#name1boxednumber) | validateAndBox(Number arg, SchemaConfiguration configuration) | -| [Name1BoxedBoolean](#name1boxedboolean) | validateAndBox(boolean arg, SchemaConfiguration configuration) | -| [Name1BoxedMap](#name1boxedmap) | validateAndBox([Map<?, ?>](#namemapbuilder1) arg, SchemaConfiguration configuration) | -| [Name1BoxedList](#name1boxedlist) | validateAndBox(List arg, SchemaConfiguration configuration) | -| [Name1Boxed](#name1boxed) | validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) | -| @Nullable Object | validate(@Nullable Object arg, SchemaConfiguration configuration) | - -## NameMap0Builder -public class NameMap0Builder
-builder for `Map` - -A class that builds the Map input type - -### Constructor Summary -| Constructor and Description | -| --------------------------- | -| NameMap0Builder(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 | -| [NameMap0Builder](#namemap0builder) | snake_case(int value) | -| [NameMap0Builder](#namemap0builder) | snake_case(float value) | -| [NameMap0Builder](#namemap0builder) | property(String value) | -| [NameMap0Builder](#namemap0builder) | additionalProperty(String key, Nothing? value) | -| [NameMap0Builder](#namemap0builder) | additionalProperty(String key, boolean value) | -| [NameMap0Builder](#namemap0builder) | additionalProperty(String key, String value) | -| [NameMap0Builder](#namemap0builder) | additionalProperty(String key, int value) | -| [NameMap0Builder](#namemap0builder) | additionalProperty(String key, float value) | -| [NameMap0Builder](#namemap0builder) | additionalProperty(String key, long value) | -| [NameMap0Builder](#namemap0builder) | additionalProperty(String key, double value) | -| [NameMap0Builder](#namemap0builder) | additionalProperty(String key, List value) | -| [NameMap0Builder](#namemap0builder) | additionalProperty(String key, Map value) | - -## NameMapBuilder1 -public class NameMapBuilder1
-builder for `Map` - -A class that builds the Map input type - -### Constructor Summary -| Constructor and Description | -| --------------------------- | -| NameMapBuilder1()
Creates a builder that contains an empty map | - -### Method Summary -| Modifier and Type | Method and Description | -| ----------------- | ---------------------- | -| [NameMap0Builder](#namemap0builder) | name(int value) | -| [NameMap0Builder](#namemap0builder) | name(float value) | - -## NameMap -public static class NameMap
-extends FrozenMap - -A class to store validated Map payloads - -### Method Summary -| Modifier and Type | Method and Description | -| ----------------- | ---------------------- | -| static [NameMap](#namemap) | of([Map](#namemapbuilder1) arg, SchemaConfiguration configuration) | -| Number | name()
value must be a 32 bit integer | -| Number | snake_case()
[optional] value must be a 32 bit integer | -| String | property()
[optional] | -| @Nullable Object | getAdditionalProperty(String name)
provides type safety for additional properties | - -## PropertyBoxed -public sealed interface PropertyBoxed
-permits
-[PropertyBoxedString](#propertyboxedstring) - -sealed interface that stores validated payloads using boxed classes - -## PropertyBoxedString -public record PropertyBoxedString
-implements [PropertyBoxed](#propertyboxed) - -record that stores validated String payloads, sealed permits implementation - -### Constructor Summary -| Constructor and Description | -| --------------------------- | -| PropertyBoxedString(String data)
Creates an instance, private visibility | - -### Method Summary -| Modifier and Type | Method and Description | -| ----------------- | ---------------------- | -| String | data()
validated payload | -| @Nullable Object | getData()
validated payload | - -## Property -public static class Property
-extends StringJsonSchema.StringJsonSchema1 - -A schema class that validates payloads - -## Description -this is a reserved python keyword - -| Methods Inherited from class org.openapijsonschematools.client.schemas.StringJsonSchema.StringJsonSchema1 | -| ------------------------------------------------------------------ | -| validate | -| validateAndBox | - -## SnakeCaseBoxed -public sealed interface SnakeCaseBoxed
-permits
-[SnakeCaseBoxedNumber](#snakecaseboxednumber) - -sealed interface that stores validated payloads using boxed classes - -## SnakeCaseBoxedNumber -public record SnakeCaseBoxedNumber
-implements [SnakeCaseBoxed](#snakecaseboxed) - -record that stores validated Number payloads, sealed permits implementation - -### Constructor Summary -| Constructor and Description | -| --------------------------- | -| SnakeCaseBoxedNumber(Number data)
Creates an instance, private visibility | - -### Method Summary -| Modifier and Type | Method and Description | -| ----------------- | ---------------------- | -| Number | data()
validated payload | -| @Nullable Object | getData()
validated payload | - -## SnakeCase -public static class SnakeCase
-extends Int32JsonSchema.Int32JsonSchema1 - -A schema class that validates payloads - -| Methods Inherited from class org.openapijsonschematools.client.schemas.Int32JsonSchema.Int32JsonSchema1 | -| ------------------------------------------------------------------ | -| validate | -| validateAndBox | - -## Name2Boxed -public sealed interface Name2Boxed
-permits
-[Name2BoxedNumber](#name2boxednumber) - -sealed interface that stores validated payloads using boxed classes - -## Name2BoxedNumber -public record Name2BoxedNumber
-implements [Name2Boxed](#name2boxed) - -record that stores validated Number payloads, sealed permits implementation - -### Constructor Summary -| Constructor and Description | -| --------------------------- | -| Name2BoxedNumber(Number data)
Creates an instance, private visibility | - -### Method Summary -| Modifier and Type | Method and Description | -| ----------------- | ---------------------- | -| Number | data()
validated payload | -| @Nullable Object | getData()
validated payload | - -## Name2 -public static class Name2
-extends Int32JsonSchema.Int32JsonSchema1 - -A schema class that validates payloads - -| Methods Inherited from class org.openapijsonschematools.client.schemas.Int32JsonSchema.Int32JsonSchema1 | -| ------------------------------------------------------------------ | -| validate | -| validateAndBox | - -[[Back to top]](#top) [[Back to Component Schemas]](../../../README.md#Component-Schemas) [[Back to README]](../../../README.md) diff --git a/samples/client/petstore/kotlin/docs/components/schemas/NoAdditionalProperties.md b/samples/client/petstore/kotlin/docs/components/schemas/NoAdditionalProperties.md deleted file mode 100644 index 5cb5b89be70..00000000000 --- a/samples/client/petstore/kotlin/docs/components/schemas/NoAdditionalProperties.md +++ /dev/null @@ -1,357 +0,0 @@ -# NoAdditionalProperties -org.openapijsonschematools.client.components.schemas.NoAdditionalProperties.java -public class NoAdditionalProperties
- -A class that contains necessary nested -- schema classes (which validate payloads), extends JsonSchema -- sealed interfaces which store validated payloads, java version of a sum type -- boxed classes which store validated payloads, sealed permits class implementations -- classes to store validated map payloads, extends FrozenMap -- classes to build inputs for map payloads - -## Nested Class Summary -| Modifier and Type | Class and Description | -| ----------------- | ---------------------- | -| sealed interface | [NoAdditionalProperties.NoAdditionalProperties1Boxed](#noadditionalproperties1boxed)
sealed interface for validated payloads | -| record | [NoAdditionalProperties.NoAdditionalProperties1BoxedMap](#noadditionalproperties1boxedmap)
boxed class to store validated Map payloads | -| static class | [NoAdditionalProperties.NoAdditionalProperties1](#noadditionalproperties1)
schema class | -| static class | [NoAdditionalProperties.NoAdditionalPropertiesMapBuilder](#noadditionalpropertiesmapbuilder)
builder for Map payloads | -| static class | [NoAdditionalProperties.NoAdditionalPropertiesMap](#noadditionalpropertiesmap)
output class for Map payloads | -| sealed interface | [NoAdditionalProperties.PetIdBoxed](#petidboxed)
sealed interface for validated payloads | -| record | [NoAdditionalProperties.PetIdBoxedNumber](#petidboxednumber)
boxed class to store validated Number payloads | -| static class | [NoAdditionalProperties.PetId](#petid)
schema class | -| sealed interface | [NoAdditionalProperties.IdBoxed](#idboxed)
sealed interface for validated payloads | -| record | [NoAdditionalProperties.IdBoxedNumber](#idboxednumber)
boxed class to store validated Number payloads | -| static class | [NoAdditionalProperties.Id](#id)
schema class | -| sealed interface | [NoAdditionalProperties.AdditionalPropertiesBoxed](#additionalpropertiesboxed)
sealed interface for validated payloads | -| record | [NoAdditionalProperties.AdditionalPropertiesBoxedVoid](#additionalpropertiesboxedvoid)
boxed class to store validated null payloads | -| record | [NoAdditionalProperties.AdditionalPropertiesBoxedBoolean](#additionalpropertiesboxedboolean)
boxed class to store validated boolean payloads | -| record | [NoAdditionalProperties.AdditionalPropertiesBoxedNumber](#additionalpropertiesboxednumber)
boxed class to store validated Number payloads | -| record | [NoAdditionalProperties.AdditionalPropertiesBoxedString](#additionalpropertiesboxedstring)
boxed class to store validated String payloads | -| record | [NoAdditionalProperties.AdditionalPropertiesBoxedList](#additionalpropertiesboxedlist)
boxed class to store validated List payloads | -| record | [NoAdditionalProperties.AdditionalPropertiesBoxedMap](#additionalpropertiesboxedmap)
boxed class to store validated Map payloads | -| static class | [NoAdditionalProperties.AdditionalProperties](#additionalproperties)
schema class | - -## NoAdditionalProperties1Boxed -public sealed interface NoAdditionalProperties1Boxed
-permits
-[NoAdditionalProperties1BoxedMap](#noadditionalproperties1boxedmap) - -sealed interface that stores validated payloads using boxed classes - -## NoAdditionalProperties1BoxedMap -public record NoAdditionalProperties1BoxedMap
-implements [NoAdditionalProperties1Boxed](#noadditionalproperties1boxed) - -record that stores validated Map payloads, sealed permits implementation - -### Constructor Summary -| Constructor and Description | -| --------------------------- | -| NoAdditionalProperties1BoxedMap([NoAdditionalPropertiesMap](#noadditionalpropertiesmap) data)
Creates an instance, private visibility | - -### Method Summary -| Modifier and Type | Method and Description | -| ----------------- | ---------------------- | -| [NoAdditionalPropertiesMap](#noadditionalpropertiesmap) | data()
validated payload | -| @Nullable Object | getData()
validated payload | - -## NoAdditionalProperties1 -public static class NoAdditionalProperties1
-extends JsonSchema - -A schema class that validates payloads - -### Code Sample -``` -import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags; -import org.openapijsonschematools.client.configurations.SchemaConfiguration; -import org.openapijsonschematools.client.exceptions.ValidationException; -import org.openapijsonschematools.client.schemas.validation.MapUtils; -import org.openapijsonschematools.client.schemas.validation.FrozenList; -import org.openapijsonschematools.client.schemas.validation.FrozenMap; -import org.openapijsonschematools.client.components.schemas.NoAdditionalProperties; - -import java.util.Arrays; -import java.util.List; -import java.util.AbstractMap; - -static final SchemaConfiguration configuration = new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().build()); - -// Map validation -NoAdditionalProperties.NoAdditionalPropertiesMap validatedPayload = - NoAdditionalProperties.NoAdditionalProperties1.validate( - new NoAdditionalProperties.NoAdditionalPropertiesMapBuilder() - .id(1L) - - .petId(1L) - - .build(), - configuration -); -``` - -### Field Summary -| Modifier and Type | Field and Description | -| ----------------- | ---------------------- | -| Set> | type = Set.of(Map.class) | -| Map> | properties = Map.ofEntries(
    new PropertyEntry("id", [Id.class](#id))),
    new PropertyEntry("petId", [PetId.class](#petid)))
)
| -| Set | required = Set.of(
    "id"
)
| -| Class | additionalProperties = [AdditionalProperties.class](#additionalproperties) | - -### Method Summary -| Modifier and Type | Method and Description | -| ----------------- | ---------------------- | -| [NoAdditionalPropertiesMap](#noadditionalpropertiesmap) | validate([Map<?, ?>](#noadditionalpropertiesmapbuilder) arg, SchemaConfiguration configuration) | -| [NoAdditionalProperties1BoxedMap](#noadditionalproperties1boxedmap) | validateAndBox([Map<?, ?>](#noadditionalpropertiesmapbuilder) arg, SchemaConfiguration configuration) | -| [NoAdditionalProperties1Boxed](#noadditionalproperties1boxed) | validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) | -| @Nullable Object | validate(@Nullable Object arg, SchemaConfiguration configuration) | - -## NoAdditionalPropertiesMap0Builder -public class NoAdditionalPropertiesMap0Builder
-builder for `Map` - -A class that builds the Map input type - -### Constructor Summary -| Constructor and Description | -| --------------------------- | -| NoAdditionalPropertiesMap0Builder(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 | -| [NoAdditionalPropertiesMap0Builder](#noadditionalpropertiesmap0builder) | petId(int value) | -| [NoAdditionalPropertiesMap0Builder](#noadditionalpropertiesmap0builder) | petId(float value) | -| [NoAdditionalPropertiesMap0Builder](#noadditionalpropertiesmap0builder) | petId(long value) | -| [NoAdditionalPropertiesMap0Builder](#noadditionalpropertiesmap0builder) | petId(double value) | - -## NoAdditionalPropertiesMapBuilder -public class NoAdditionalPropertiesMapBuilder
-builder for `Map` - -A class that builds the Map input type - -### Constructor Summary -| Constructor and Description | -| --------------------------- | -| NoAdditionalPropertiesMapBuilder()
Creates a builder that contains an empty map | - -### Method Summary -| Modifier and Type | Method and Description | -| ----------------- | ---------------------- | -| [NoAdditionalPropertiesMap0Builder](#noadditionalpropertiesmap0builder) | id(int value) | -| [NoAdditionalPropertiesMap0Builder](#noadditionalpropertiesmap0builder) | id(float value) | -| [NoAdditionalPropertiesMap0Builder](#noadditionalpropertiesmap0builder) | id(long value) | -| [NoAdditionalPropertiesMap0Builder](#noadditionalpropertiesmap0builder) | id(double value) | - -## NoAdditionalPropertiesMap -public static class NoAdditionalPropertiesMap
-extends FrozenMap - -A class to store validated Map payloads - -### Method Summary -| Modifier and Type | Method and Description | -| ----------------- | ---------------------- | -| static [NoAdditionalPropertiesMap](#noadditionalpropertiesmap) | of([Map](#noadditionalpropertiesmapbuilder) arg, SchemaConfiguration configuration) | -| Number | id()
value must be a 64 bit integer | -| Number | petId()
[optional] value must be a 64 bit integer | - -## PetIdBoxed -public sealed interface PetIdBoxed
-permits
-[PetIdBoxedNumber](#petidboxednumber) - -sealed interface that stores validated payloads using boxed classes - -## PetIdBoxedNumber -public record PetIdBoxedNumber
-implements [PetIdBoxed](#petidboxed) - -record that stores validated Number payloads, sealed permits implementation - -### Constructor Summary -| Constructor and Description | -| --------------------------- | -| PetIdBoxedNumber(Number data)
Creates an instance, private visibility | - -### Method Summary -| Modifier and Type | Method and Description | -| ----------------- | ---------------------- | -| Number | data()
validated payload | -| @Nullable Object | getData()
validated payload | - -## PetId -public static class PetId
-extends Int64JsonSchema.Int64JsonSchema1 - -A schema class that validates payloads - -| Methods Inherited from class org.openapijsonschematools.client.schemas.Int64JsonSchema.Int64JsonSchema1 | -| ------------------------------------------------------------------ | -| validate | -| validateAndBox | - -## IdBoxed -public sealed interface IdBoxed
-permits
-[IdBoxedNumber](#idboxednumber) - -sealed interface that stores validated payloads using boxed classes - -## IdBoxedNumber -public record IdBoxedNumber
-implements [IdBoxed](#idboxed) - -record that stores validated Number payloads, sealed permits implementation - -### Constructor Summary -| Constructor and Description | -| --------------------------- | -| IdBoxedNumber(Number data)
Creates an instance, private visibility | - -### Method Summary -| Modifier and Type | Method and Description | -| ----------------- | ---------------------- | -| Number | data()
validated payload | -| @Nullable Object | getData()
validated payload | - -## Id -public static class Id
-extends Int64JsonSchema.Int64JsonSchema1 - -A schema class that validates payloads - -| Methods Inherited from class org.openapijsonschematools.client.schemas.Int64JsonSchema.Int64JsonSchema1 | -| ------------------------------------------------------------------ | -| validate | -| validateAndBox | - -## 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(Nothing? data)
Creates an instance, private visibility | - -### Method Summary -| Modifier and Type | Method and Description | -| ----------------- | ---------------------- | -| Nothing? | 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 Component Schemas]](../../../README.md#Component-Schemas) [[Back to README]](../../../README.md) diff --git a/samples/client/petstore/kotlin/docs/components/schemas/NullableClass.md b/samples/client/petstore/kotlin/docs/components/schemas/NullableClass.md deleted file mode 100644 index 84627865c31..00000000000 --- a/samples/client/petstore/kotlin/docs/components/schemas/NullableClass.md +++ /dev/null @@ -1,2041 +0,0 @@ -# NullableClass -org.openapijsonschematools.client.components.schemas.NullableClass.java -public class NullableClass
- -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 list payloads, extends FrozenList -- classes to build inputs for list payloads -- classes to store validated map payloads, extends FrozenMap -- classes to build inputs for map payloads - -## Nested Class Summary -| Modifier and Type | Class and Description | -| ----------------- | ---------------------- | -| sealed interface | [NullableClass.NullableClass1Boxed](#nullableclass1boxed)
sealed interface for validated payloads | -| record | [NullableClass.NullableClass1BoxedMap](#nullableclass1boxedmap)
boxed class to store validated Map payloads | -| static class | [NullableClass.NullableClass1](#nullableclass1)
schema class | -| static class | [NullableClass.NullableClassMapBuilder](#nullableclassmapbuilder)
builder for Map payloads | -| static class | [NullableClass.NullableClassMap](#nullableclassmap)
output class for Map payloads | -| sealed interface | [NullableClass.ObjectItemsNullableBoxed](#objectitemsnullableboxed)
sealed interface for validated payloads | -| record | [NullableClass.ObjectItemsNullableBoxedMap](#objectitemsnullableboxedmap)
boxed class to store validated Map payloads | -| static class | [NullableClass.ObjectItemsNullable](#objectitemsnullable)
schema class | -| static class | [NullableClass.ObjectItemsNullableMapBuilder](#objectitemsnullablemapbuilder)
builder for Map payloads | -| static class | [NullableClass.ObjectItemsNullableMap](#objectitemsnullablemap)
output class for Map payloads | -| sealed interface | [NullableClass.AdditionalProperties2Boxed](#additionalproperties2boxed)
sealed interface for validated payloads | -| record | [NullableClass.AdditionalProperties2BoxedVoid](#additionalproperties2boxedvoid)
boxed class to store validated null payloads | -| record | [NullableClass.AdditionalProperties2BoxedMap](#additionalproperties2boxedmap)
boxed class to store validated Map payloads | -| static class | [NullableClass.AdditionalProperties2](#additionalproperties2)
schema class | -| sealed interface | [NullableClass.ObjectAndItemsNullablePropBoxed](#objectanditemsnullablepropboxed)
sealed interface for validated payloads | -| record | [NullableClass.ObjectAndItemsNullablePropBoxedVoid](#objectanditemsnullablepropboxedvoid)
boxed class to store validated null payloads | -| record | [NullableClass.ObjectAndItemsNullablePropBoxedMap](#objectanditemsnullablepropboxedmap)
boxed class to store validated Map payloads | -| static class | [NullableClass.ObjectAndItemsNullableProp](#objectanditemsnullableprop)
schema class | -| static class | [NullableClass.ObjectAndItemsNullablePropMapBuilder](#objectanditemsnullablepropmapbuilder)
builder for Map payloads | -| static class | [NullableClass.ObjectAndItemsNullablePropMap](#objectanditemsnullablepropmap)
output class for Map payloads | -| sealed interface | [NullableClass.AdditionalProperties1Boxed](#additionalproperties1boxed)
sealed interface for validated payloads | -| record | [NullableClass.AdditionalProperties1BoxedVoid](#additionalproperties1boxedvoid)
boxed class to store validated null payloads | -| record | [NullableClass.AdditionalProperties1BoxedMap](#additionalproperties1boxedmap)
boxed class to store validated Map payloads | -| static class | [NullableClass.AdditionalProperties1](#additionalproperties1)
schema class | -| sealed interface | [NullableClass.ObjectNullablePropBoxed](#objectnullablepropboxed)
sealed interface for validated payloads | -| record | [NullableClass.ObjectNullablePropBoxedVoid](#objectnullablepropboxedvoid)
boxed class to store validated null payloads | -| record | [NullableClass.ObjectNullablePropBoxedMap](#objectnullablepropboxedmap)
boxed class to store validated Map payloads | -| static class | [NullableClass.ObjectNullableProp](#objectnullableprop)
schema class | -| static class | [NullableClass.ObjectNullablePropMapBuilder](#objectnullablepropmapbuilder)
builder for Map payloads | -| static class | [NullableClass.ObjectNullablePropMap](#objectnullablepropmap)
output class for Map payloads | -| sealed interface | [NullableClass.AdditionalPropertiesBoxed](#additionalpropertiesboxed)
sealed interface for validated payloads | -| record | [NullableClass.AdditionalPropertiesBoxedMap](#additionalpropertiesboxedmap)
boxed class to store validated Map payloads | -| static class | [NullableClass.AdditionalProperties](#additionalproperties)
schema class | -| sealed interface | [NullableClass.ArrayItemsNullableBoxed](#arrayitemsnullableboxed)
sealed interface for validated payloads | -| record | [NullableClass.ArrayItemsNullableBoxedList](#arrayitemsnullableboxedlist)
boxed class to store validated List payloads | -| static class | [NullableClass.ArrayItemsNullable](#arrayitemsnullable)
schema class | -| static class | [NullableClass.ArrayItemsNullableListBuilder](#arrayitemsnullablelistbuilder)
builder for List payloads | -| static class | [NullableClass.ArrayItemsNullableList](#arrayitemsnullablelist)
output class for List payloads | -| sealed interface | [NullableClass.Items2Boxed](#items2boxed)
sealed interface for validated payloads | -| record | [NullableClass.Items2BoxedVoid](#items2boxedvoid)
boxed class to store validated null payloads | -| record | [NullableClass.Items2BoxedMap](#items2boxedmap)
boxed class to store validated Map payloads | -| static class | [NullableClass.Items2](#items2)
schema class | -| sealed interface | [NullableClass.ArrayAndItemsNullablePropBoxed](#arrayanditemsnullablepropboxed)
sealed interface for validated payloads | -| record | [NullableClass.ArrayAndItemsNullablePropBoxedVoid](#arrayanditemsnullablepropboxedvoid)
boxed class to store validated null payloads | -| record | [NullableClass.ArrayAndItemsNullablePropBoxedList](#arrayanditemsnullablepropboxedlist)
boxed class to store validated List payloads | -| static class | [NullableClass.ArrayAndItemsNullableProp](#arrayanditemsnullableprop)
schema class | -| static class | [NullableClass.ArrayAndItemsNullablePropListBuilder](#arrayanditemsnullableproplistbuilder)
builder for List payloads | -| static class | [NullableClass.ArrayAndItemsNullablePropList](#arrayanditemsnullableproplist)
output class for List payloads | -| sealed interface | [NullableClass.Items1Boxed](#items1boxed)
sealed interface for validated payloads | -| record | [NullableClass.Items1BoxedVoid](#items1boxedvoid)
boxed class to store validated null payloads | -| record | [NullableClass.Items1BoxedMap](#items1boxedmap)
boxed class to store validated Map payloads | -| static class | [NullableClass.Items1](#items1)
schema class | -| sealed interface | [NullableClass.ArrayNullablePropBoxed](#arraynullablepropboxed)
sealed interface for validated payloads | -| record | [NullableClass.ArrayNullablePropBoxedVoid](#arraynullablepropboxedvoid)
boxed class to store validated null payloads | -| record | [NullableClass.ArrayNullablePropBoxedList](#arraynullablepropboxedlist)
boxed class to store validated List payloads | -| static class | [NullableClass.ArrayNullableProp](#arraynullableprop)
schema class | -| static class | [NullableClass.ArrayNullablePropListBuilder](#arraynullableproplistbuilder)
builder for List payloads | -| static class | [NullableClass.ArrayNullablePropList](#arraynullableproplist)
output class for List payloads | -| sealed interface | [NullableClass.ItemsBoxed](#itemsboxed)
sealed interface for validated payloads | -| record | [NullableClass.ItemsBoxedMap](#itemsboxedmap)
boxed class to store validated Map payloads | -| static class | [NullableClass.Items](#items)
schema class | -| sealed interface | [NullableClass.DatetimePropBoxed](#datetimepropboxed)
sealed interface for validated payloads | -| record | [NullableClass.DatetimePropBoxedVoid](#datetimepropboxedvoid)
boxed class to store validated null payloads | -| record | [NullableClass.DatetimePropBoxedString](#datetimepropboxedstring)
boxed class to store validated String payloads | -| static class | [NullableClass.DatetimeProp](#datetimeprop)
schema class | -| sealed interface | [NullableClass.DatePropBoxed](#datepropboxed)
sealed interface for validated payloads | -| record | [NullableClass.DatePropBoxedVoid](#datepropboxedvoid)
boxed class to store validated null payloads | -| record | [NullableClass.DatePropBoxedString](#datepropboxedstring)
boxed class to store validated String payloads | -| static class | [NullableClass.DateProp](#dateprop)
schema class | -| sealed interface | [NullableClass.StringPropBoxed](#stringpropboxed)
sealed interface for validated payloads | -| record | [NullableClass.StringPropBoxedVoid](#stringpropboxedvoid)
boxed class to store validated null payloads | -| record | [NullableClass.StringPropBoxedString](#stringpropboxedstring)
boxed class to store validated String payloads | -| static class | [NullableClass.StringProp](#stringprop)
schema class | -| sealed interface | [NullableClass.BooleanPropBoxed](#booleanpropboxed)
sealed interface for validated payloads | -| record | [NullableClass.BooleanPropBoxedVoid](#booleanpropboxedvoid)
boxed class to store validated null payloads | -| record | [NullableClass.BooleanPropBoxedBoolean](#booleanpropboxedboolean)
boxed class to store validated boolean payloads | -| static class | [NullableClass.BooleanProp](#booleanprop)
schema class | -| sealed interface | [NullableClass.NumberPropBoxed](#numberpropboxed)
sealed interface for validated payloads | -| record | [NullableClass.NumberPropBoxedVoid](#numberpropboxedvoid)
boxed class to store validated null payloads | -| record | [NullableClass.NumberPropBoxedNumber](#numberpropboxednumber)
boxed class to store validated Number payloads | -| static class | [NullableClass.NumberProp](#numberprop)
schema class | -| sealed interface | [NullableClass.IntegerPropBoxed](#integerpropboxed)
sealed interface for validated payloads | -| record | [NullableClass.IntegerPropBoxedVoid](#integerpropboxedvoid)
boxed class to store validated null payloads | -| record | [NullableClass.IntegerPropBoxedNumber](#integerpropboxednumber)
boxed class to store validated Number payloads | -| static class | [NullableClass.IntegerProp](#integerprop)
schema class | -| sealed interface | [NullableClass.AdditionalProperties3Boxed](#additionalproperties3boxed)
sealed interface for validated payloads | -| record | [NullableClass.AdditionalProperties3BoxedVoid](#additionalproperties3boxedvoid)
boxed class to store validated null payloads | -| record | [NullableClass.AdditionalProperties3BoxedMap](#additionalproperties3boxedmap)
boxed class to store validated Map payloads | -| static class | [NullableClass.AdditionalProperties3](#additionalproperties3)
schema class | - -## NullableClass1Boxed -public sealed interface NullableClass1Boxed
-permits
-[NullableClass1BoxedMap](#nullableclass1boxedmap) - -sealed interface that stores validated payloads using boxed classes - -## NullableClass1BoxedMap -public record NullableClass1BoxedMap
-implements [NullableClass1Boxed](#nullableclass1boxed) - -record that stores validated Map payloads, sealed permits implementation - -### Constructor Summary -| Constructor and Description | -| --------------------------- | -| NullableClass1BoxedMap([NullableClassMap](#nullableclassmap) data)
Creates an instance, private visibility | - -### Method Summary -| Modifier and Type | Method and Description | -| ----------------- | ---------------------- | -| [NullableClassMap](#nullableclassmap) | data()
validated payload | -| @Nullable Object | getData()
validated payload | - -## NullableClass1 -public static class NullableClass1
-extends JsonSchema - -A schema class that validates payloads - -### Code Sample -``` -import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags; -import org.openapijsonschematools.client.configurations.SchemaConfiguration; -import org.openapijsonschematools.client.exceptions.ValidationException; -import org.openapijsonschematools.client.schemas.validation.MapUtils; -import org.openapijsonschematools.client.schemas.validation.FrozenList; -import org.openapijsonschematools.client.schemas.validation.FrozenMap; -import org.openapijsonschematools.client.components.schemas.NullableClass; - -import java.util.Arrays; -import java.util.List; -import java.util.AbstractMap; - -static final SchemaConfiguration configuration = new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().build()); - -// Map validation -NullableClass.NullableClassMap validatedPayload = - NullableClass.NullableClass1.validate( - new NullableClass.NullableClassMapBuilder() - .integer_prop(null) - - .number_prop(null) - - .boolean_prop(null) - - .string_prop(null) - - .date_prop(null) - - .datetime_prop(null) - - .array_nullable_prop(null) - - .array_and_items_nullable_prop(null) - - .array_items_nullable( - Arrays.asList( - null - ) - ) - .object_nullable_prop(null) - - .object_and_items_nullable_prop(null) - - .object_items_nullable( - MapUtils.makeMap( - new AbstractMap.SimpleEntry( - "someAdditionalProperty", - null - ) - ) - ) - .additionalProperty("someAdditionalProperty", null) - - .build(), - configuration -); -``` - -### Field Summary -| Modifier and Type | Field and Description | -| ----------------- | ---------------------- | -| Set> | type = Set.of(Map.class) | -| Map> | properties = Map.ofEntries(
    new PropertyEntry("integer_prop", [IntegerProp.class](#integerprop))),
    new PropertyEntry("number_prop", [NumberProp.class](#numberprop))),
    new PropertyEntry("boolean_prop", [BooleanProp.class](#booleanprop))),
    new PropertyEntry("string_prop", [StringProp.class](#stringprop))),
    new PropertyEntry("date_prop", [DateProp.class](#dateprop))),
    new PropertyEntry("datetime_prop", [DatetimeProp.class](#datetimeprop))),
    new PropertyEntry("array_nullable_prop", [ArrayNullableProp.class](#arraynullableprop))),
    new PropertyEntry("array_and_items_nullable_prop", [ArrayAndItemsNullableProp.class](#arrayanditemsnullableprop))),
    new PropertyEntry("array_items_nullable", [ArrayItemsNullable.class](#arrayitemsnullable))),
    new PropertyEntry("object_nullable_prop", [ObjectNullableProp.class](#objectnullableprop))),
    new PropertyEntry("object_and_items_nullable_prop", [ObjectAndItemsNullableProp.class](#objectanditemsnullableprop))),
    new PropertyEntry("object_items_nullable", [ObjectItemsNullable.class](#objectitemsnullable)))
)
| -| Class | additionalProperties = [AdditionalProperties3.class](#additionalproperties3) | - -### Method Summary -| Modifier and Type | Method and Description | -| ----------------- | ---------------------- | -| [NullableClassMap](#nullableclassmap) | validate([Map<?, ?>](#nullableclassmapbuilder) arg, SchemaConfiguration configuration) | -| [NullableClass1BoxedMap](#nullableclass1boxedmap) | validateAndBox([Map<?, ?>](#nullableclassmapbuilder) arg, SchemaConfiguration configuration) | -| [NullableClass1Boxed](#nullableclass1boxed) | validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) | -| @Nullable Object | validate(@Nullable Object arg, SchemaConfiguration configuration) | - -## NullableClassMapBuilder -public class NullableClassMapBuilder
-builder for `Map` - -A class that builds the Map input type - -### Constructor Summary -| Constructor and Description | -| --------------------------- | -| NullableClassMapBuilder()
Creates a builder that contains an empty map | - -### Method Summary -| Modifier and Type | Method and Description | -| ----------------- | ---------------------- | -| Map | build()
Returns map input that should be used with Schema.validate | -| [NullableClassMapBuilder](#nullableclassmapbuilder) | integer_prop(Nothing? value) | -| [NullableClassMapBuilder](#nullableclassmapbuilder) | integer_prop(int value) | -| [NullableClassMapBuilder](#nullableclassmapbuilder) | integer_prop(float value) | -| [NullableClassMapBuilder](#nullableclassmapbuilder) | integer_prop(long value) | -| [NullableClassMapBuilder](#nullableclassmapbuilder) | integer_prop(double value) | -| [NullableClassMapBuilder](#nullableclassmapbuilder) | number_prop(Nothing? value) | -| [NullableClassMapBuilder](#nullableclassmapbuilder) | number_prop(int value) | -| [NullableClassMapBuilder](#nullableclassmapbuilder) | number_prop(float value) | -| [NullableClassMapBuilder](#nullableclassmapbuilder) | number_prop(long value) | -| [NullableClassMapBuilder](#nullableclassmapbuilder) | number_prop(double value) | -| [NullableClassMapBuilder](#nullableclassmapbuilder) | boolean_prop(Nothing? value) | -| [NullableClassMapBuilder](#nullableclassmapbuilder) | boolean_prop(boolean value) | -| [NullableClassMapBuilder](#nullableclassmapbuilder) | string_prop(Nothing? value) | -| [NullableClassMapBuilder](#nullableclassmapbuilder) | string_prop(String value) | -| [NullableClassMapBuilder](#nullableclassmapbuilder) | date_prop(Nothing? value) | -| [NullableClassMapBuilder](#nullableclassmapbuilder) | date_prop(String value) | -| [NullableClassMapBuilder](#nullableclassmapbuilder) | datetime_prop(Nothing? value) | -| [NullableClassMapBuilder](#nullableclassmapbuilder) | datetime_prop(String value) | -| [NullableClassMapBuilder](#nullableclassmapbuilder) | array_nullable_prop(Nothing? value) | -| [NullableClassMapBuilder](#nullableclassmapbuilder) | array_nullable_prop(List> value) | -| [NullableClassMapBuilder](#nullableclassmapbuilder) | array_and_items_nullable_prop(Nothing? value) | -| [NullableClassMapBuilder](#nullableclassmapbuilder) | array_and_items_nullable_prop(List<@Nullable Map> value) | -| [NullableClassMapBuilder](#nullableclassmapbuilder) | array_items_nullable(List<@Nullable Map> value) | -| [NullableClassMapBuilder](#nullableclassmapbuilder) | object_nullable_prop(Nothing? value) | -| [NullableClassMapBuilder](#nullableclassmapbuilder) | object_nullable_prop(Map> value) | -| [NullableClassMapBuilder](#nullableclassmapbuilder) | object_and_items_nullable_prop(Nothing? value) | -| [NullableClassMapBuilder](#nullableclassmapbuilder) | object_and_items_nullable_prop(Map> value) | -| [NullableClassMapBuilder](#nullableclassmapbuilder) | object_items_nullable(Map> value) | -| [NullableClassMapBuilder](#nullableclassmapbuilder) | additionalProperty(String key, Nothing? value) | -| [NullableClassMapBuilder](#nullableclassmapbuilder) | additionalProperty(String key, Map value) | - -## NullableClassMap -public static class NullableClassMap
-extends FrozenMap - -A class to store validated Map payloads - -### Method Summary -| Modifier and Type | Method and Description | -| ----------------- | ---------------------- | -| static [NullableClassMap](#nullableclassmap) | of([Map](#nullableclassmapbuilder) arg, SchemaConfiguration configuration) | -| @Nullable Number | integer_prop()
[optional] | -| @Nullable Number | number_prop()
[optional] | -| @Nullable Boolean | boolean_prop()
[optional] | -| @Nullable String | string_prop()
[optional] | -| @Nullable String | date_prop()
[optional] value must conform to RFC-3339 full-date YYYY-MM-DD | -| @Nullable String | datetime_prop()
[optional] value must conform to RFC-3339 date-time | -| [ArrayNullablePropList](#arraynullableproplist) | array_nullable_prop()
[optional] | -| [ArrayAndItemsNullablePropList](#arrayanditemsnullableproplist) | array_and_items_nullable_prop()
[optional] | -| [ArrayItemsNullableList](#arrayitemsnullablelist) | array_items_nullable()
[optional] | -| [ObjectNullablePropMap](#objectnullablepropmap) | object_nullable_prop()
[optional] | -| [ObjectAndItemsNullablePropMap](#objectanditemsnullablepropmap) | object_and_items_nullable_prop()
[optional] | -| [ObjectItemsNullableMap](#objectitemsnullablemap) | object_items_nullable()
[optional] | -| @Nullable FrozenMap | getAdditionalProperty(String name)
provides type safety for additional properties | - -## ObjectItemsNullableBoxed -public sealed interface ObjectItemsNullableBoxed
-permits
-[ObjectItemsNullableBoxedMap](#objectitemsnullableboxedmap) - -sealed interface that stores validated payloads using boxed classes - -## ObjectItemsNullableBoxedMap -public record ObjectItemsNullableBoxedMap
-implements [ObjectItemsNullableBoxed](#objectitemsnullableboxed) - -record that stores validated Map payloads, sealed permits implementation - -### Constructor Summary -| Constructor and Description | -| --------------------------- | -| ObjectItemsNullableBoxedMap([ObjectItemsNullableMap](#objectitemsnullablemap) data)
Creates an instance, private visibility | - -### Method Summary -| Modifier and Type | Method and Description | -| ----------------- | ---------------------- | -| [ObjectItemsNullableMap](#objectitemsnullablemap) | data()
validated payload | -| @Nullable Object | getData()
validated payload | - -## ObjectItemsNullable -public static class ObjectItemsNullable
-extends JsonSchema - -A schema class that validates payloads - -### Code Sample -``` -import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags; -import org.openapijsonschematools.client.configurations.SchemaConfiguration; -import org.openapijsonschematools.client.exceptions.ValidationException; -import org.openapijsonschematools.client.schemas.validation.MapUtils; -import org.openapijsonschematools.client.schemas.validation.FrozenList; -import org.openapijsonschematools.client.schemas.validation.FrozenMap; -import org.openapijsonschematools.client.components.schemas.NullableClass; - -import java.util.Arrays; -import java.util.List; -import java.util.AbstractMap; - -static final SchemaConfiguration configuration = new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().build()); - -// Map validation -NullableClass.ObjectItemsNullableMap validatedPayload = - NullableClass.ObjectItemsNullable.validate( - new NullableClass.ObjectItemsNullableMapBuilder() - .additionalProperty("someAdditionalProperty", null) - - .build(), - configuration -); -``` - -### Field Summary -| Modifier and Type | Field and Description | -| ----------------- | ---------------------- | -| Set> | type = Set.of(Map.class) | -| Class | additionalProperties = [AdditionalProperties2.class](#additionalproperties2) | - -### Method Summary -| Modifier and Type | Method and Description | -| ----------------- | ---------------------- | -| [ObjectItemsNullableMap](#objectitemsnullablemap) | validate([Map<?, ?>](#objectitemsnullablemapbuilder) arg, SchemaConfiguration configuration) | -| [ObjectItemsNullableBoxedMap](#objectitemsnullableboxedmap) | validateAndBox([Map<?, ?>](#objectitemsnullablemapbuilder) arg, SchemaConfiguration configuration) | -| [ObjectItemsNullableBoxed](#objectitemsnullableboxed) | validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) | -| @Nullable Object | validate(@Nullable Object arg, SchemaConfiguration configuration) | - -## ObjectItemsNullableMapBuilder -public class ObjectItemsNullableMapBuilder
-builder for `Map>` - -A class that builds the Map input type - -### Constructor Summary -| Constructor and Description | -| --------------------------- | -| ObjectItemsNullableMapBuilder()
Creates a builder that contains an empty map | - -### Method Summary -| Modifier and Type | Method and Description | -| ----------------- | ---------------------- | -| Map> | build()
Returns map input that should be used with Schema.validate | -| [ObjectItemsNullableMapBuilder](#objectitemsnullablemapbuilder) | additionalProperty(String key, Nothing? value) | -| [ObjectItemsNullableMapBuilder](#objectitemsnullablemapbuilder) | additionalProperty(String key, Map value) | - -## ObjectItemsNullableMap -public static class ObjectItemsNullableMap
-extends FrozenMap> - -A class to store validated Map payloads - -### Method Summary -| Modifier and Type | Method and Description | -| ----------------- | ---------------------- | -| static [ObjectItemsNullableMap](#objectitemsnullablemap) | of([Map>](#objectitemsnullablemapbuilder) arg, SchemaConfiguration configuration) | -| @Nullable FrozenMap | getAdditionalProperty(String name)
provides type safety for additional properties | - -## AdditionalProperties2Boxed -public sealed interface AdditionalProperties2Boxed
-permits
-[AdditionalProperties2BoxedVoid](#additionalproperties2boxedvoid), -[AdditionalProperties2BoxedMap](#additionalproperties2boxedmap) - -sealed interface that stores validated payloads using boxed classes - -## AdditionalProperties2BoxedVoid -public record AdditionalProperties2BoxedVoid
-implements [AdditionalProperties2Boxed](#additionalproperties2boxed) - -record that stores validated null payloads, sealed permits implementation - -### Constructor Summary -| Constructor and Description | -| --------------------------- | -| AdditionalProperties2BoxedVoid(Nothing? data)
Creates an instance, private visibility | - -### Method Summary -| Modifier and Type | Method and Description | -| ----------------- | ---------------------- | -| Nothing? | data()
validated payload | -| @Nullable Object | getData()
validated payload | - -## AdditionalProperties2BoxedMap -public record AdditionalProperties2BoxedMap
-implements [AdditionalProperties2Boxed](#additionalproperties2boxed) - -record that stores validated Map payloads, sealed permits implementation - -### Constructor Summary -| Constructor and Description | -| --------------------------- | -| AdditionalProperties2BoxedMap(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 | - -## AdditionalProperties2 -public static class AdditionalProperties2
-extends JsonSchema - -A schema class that validates payloads - -### Code Sample -``` -import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags; -import org.openapijsonschematools.client.configurations.SchemaConfiguration; -import org.openapijsonschematools.client.exceptions.ValidationException; -import org.openapijsonschematools.client.schemas.validation.MapUtils; -import org.openapijsonschematools.client.schemas.validation.FrozenList; -import org.openapijsonschematools.client.schemas.validation.FrozenMap; -import org.openapijsonschematools.client.components.schemas.NullableClass; - -import java.util.Arrays; -import java.util.List; -import java.util.AbstractMap; - -static final SchemaConfiguration configuration = new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().build()); - -// null validation -Nothing? validatedPayload = NullableClass.AdditionalProperties2.validate( - (Nothing?) null, - configuration -); -``` - -### Field Summary -| Modifier and Type | Field and Description | -| ----------------- | ---------------------- | -| Set> | type = Set.of(
    Nothing?.class,
    Map.class
)
| - -### Method Summary -| Modifier and Type | Method and Description | -| ----------------- | ---------------------- | -| Nothing? | validate(Nothing? arg, SchemaConfiguration configuration) | -| [AdditionalProperties2BoxedVoid](#additionalproperties2boxedvoid) | validateAndBox(Nothing? arg, SchemaConfiguration configuration) | -| FrozenMap | validate(Map<?, ?> arg, SchemaConfiguration configuration) | -| [AdditionalProperties2BoxedMap](#additionalproperties2boxedmap) | validateAndBox(Map<?, ?> arg, SchemaConfiguration configuration) | -| [AdditionalProperties2Boxed](#additionalproperties2boxed) | validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) | -| @Nullable Object | validate(@Nullable Object arg, SchemaConfiguration configuration) | - -## ObjectAndItemsNullablePropBoxed -public sealed interface ObjectAndItemsNullablePropBoxed
-permits
-[ObjectAndItemsNullablePropBoxedVoid](#objectanditemsnullablepropboxedvoid), -[ObjectAndItemsNullablePropBoxedMap](#objectanditemsnullablepropboxedmap) - -sealed interface that stores validated payloads using boxed classes - -## ObjectAndItemsNullablePropBoxedVoid -public record ObjectAndItemsNullablePropBoxedVoid
-implements [ObjectAndItemsNullablePropBoxed](#objectanditemsnullablepropboxed) - -record that stores validated null payloads, sealed permits implementation - -### Constructor Summary -| Constructor and Description | -| --------------------------- | -| ObjectAndItemsNullablePropBoxedVoid(Nothing? data)
Creates an instance, private visibility | - -### Method Summary -| Modifier and Type | Method and Description | -| ----------------- | ---------------------- | -| Nothing? | data()
validated payload | -| @Nullable Object | getData()
validated payload | - -## ObjectAndItemsNullablePropBoxedMap -public record ObjectAndItemsNullablePropBoxedMap
-implements [ObjectAndItemsNullablePropBoxed](#objectanditemsnullablepropboxed) - -record that stores validated Map payloads, sealed permits implementation - -### Constructor Summary -| Constructor and Description | -| --------------------------- | -| ObjectAndItemsNullablePropBoxedMap([ObjectAndItemsNullablePropMap](#objectanditemsnullablepropmap) data)
Creates an instance, private visibility | - -### Method Summary -| Modifier and Type | Method and Description | -| ----------------- | ---------------------- | -| [ObjectAndItemsNullablePropMap](#objectanditemsnullablepropmap) | data()
validated payload | -| @Nullable Object | getData()
validated payload | - -## ObjectAndItemsNullableProp -public static class ObjectAndItemsNullableProp
-extends JsonSchema - -A schema class that validates payloads - -### Code Sample -``` -import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags; -import org.openapijsonschematools.client.configurations.SchemaConfiguration; -import org.openapijsonschematools.client.exceptions.ValidationException; -import org.openapijsonschematools.client.schemas.validation.MapUtils; -import org.openapijsonschematools.client.schemas.validation.FrozenList; -import org.openapijsonschematools.client.schemas.validation.FrozenMap; -import org.openapijsonschematools.client.components.schemas.NullableClass; - -import java.util.Arrays; -import java.util.List; -import java.util.AbstractMap; - -static final SchemaConfiguration configuration = new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().build()); - -// null validation -Nothing? validatedPayload = NullableClass.ObjectAndItemsNullableProp.validate( - (Nothing?) null, - configuration -); - -// Map validation -NullableClass.ObjectAndItemsNullablePropMap validatedPayload = - NullableClass.ObjectAndItemsNullableProp.validate( - new NullableClass.ObjectAndItemsNullablePropMapBuilder() - .additionalProperty("someAdditionalProperty", null) - - .build(), - configuration -); -``` - -### Field Summary -| Modifier and Type | Field and Description | -| ----------------- | ---------------------- | -| Set> | type = Set.of(
    Nothing?.class,
    Map.class
)
| -| Class | additionalProperties = [AdditionalProperties1.class](#additionalproperties1) | - -### Method Summary -| Modifier and Type | Method and Description | -| ----------------- | ---------------------- | -| Nothing? | validate(Nothing? arg, SchemaConfiguration configuration) | -| [ObjectAndItemsNullablePropBoxedVoid](#objectanditemsnullablepropboxedvoid) | validateAndBox(Nothing? arg, SchemaConfiguration configuration) | -| [ObjectAndItemsNullablePropMap](#objectanditemsnullablepropmap) | validate([Map<?, ?>](#objectanditemsnullablepropmapbuilder) arg, SchemaConfiguration configuration) | -| [ObjectAndItemsNullablePropBoxedMap](#objectanditemsnullablepropboxedmap) | validateAndBox([Map<?, ?>](#objectanditemsnullablepropmapbuilder) arg, SchemaConfiguration configuration) | -| [ObjectAndItemsNullablePropBoxed](#objectanditemsnullablepropboxed) | validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) | -| @Nullable Object | validate(@Nullable Object arg, SchemaConfiguration configuration) | - -## ObjectAndItemsNullablePropMapBuilder -public class ObjectAndItemsNullablePropMapBuilder
-builder for `Map>` - -A class that builds the Map input type - -### Constructor Summary -| Constructor and Description | -| --------------------------- | -| ObjectAndItemsNullablePropMapBuilder()
Creates a builder that contains an empty map | - -### Method Summary -| Modifier and Type | Method and Description | -| ----------------- | ---------------------- | -| Map> | build()
Returns map input that should be used with Schema.validate | -| [ObjectAndItemsNullablePropMapBuilder](#objectanditemsnullablepropmapbuilder) | additionalProperty(String key, Nothing? value) | -| [ObjectAndItemsNullablePropMapBuilder](#objectanditemsnullablepropmapbuilder) | additionalProperty(String key, Map value) | - -## ObjectAndItemsNullablePropMap -public static class ObjectAndItemsNullablePropMap
-extends FrozenMap> - -A class to store validated Map payloads - -### Method Summary -| Modifier and Type | Method and Description | -| ----------------- | ---------------------- | -| static [ObjectAndItemsNullablePropMap](#objectanditemsnullablepropmap) | of([Map>](#objectanditemsnullablepropmapbuilder) arg, SchemaConfiguration configuration) | -| @Nullable FrozenMap | getAdditionalProperty(String name)
provides type safety for additional properties | - -## AdditionalProperties1Boxed -public sealed interface AdditionalProperties1Boxed
-permits
-[AdditionalProperties1BoxedVoid](#additionalproperties1boxedvoid), -[AdditionalProperties1BoxedMap](#additionalproperties1boxedmap) - -sealed interface that stores validated payloads using boxed classes - -## AdditionalProperties1BoxedVoid -public record AdditionalProperties1BoxedVoid
-implements [AdditionalProperties1Boxed](#additionalproperties1boxed) - -record that stores validated null payloads, sealed permits implementation - -### Constructor Summary -| Constructor and Description | -| --------------------------- | -| AdditionalProperties1BoxedVoid(Nothing? data)
Creates an instance, private visibility | - -### Method Summary -| Modifier and Type | Method and Description | -| ----------------- | ---------------------- | -| Nothing? | data()
validated payload | -| @Nullable Object | getData()
validated payload | - -## AdditionalProperties1BoxedMap -public record AdditionalProperties1BoxedMap
-implements [AdditionalProperties1Boxed](#additionalproperties1boxed) - -record that stores validated Map payloads, sealed permits implementation - -### Constructor Summary -| Constructor and Description | -| --------------------------- | -| AdditionalProperties1BoxedMap(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 | - -## AdditionalProperties1 -public static class AdditionalProperties1
-extends JsonSchema - -A schema class that validates payloads - -### Code Sample -``` -import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags; -import org.openapijsonschematools.client.configurations.SchemaConfiguration; -import org.openapijsonschematools.client.exceptions.ValidationException; -import org.openapijsonschematools.client.schemas.validation.MapUtils; -import org.openapijsonschematools.client.schemas.validation.FrozenList; -import org.openapijsonschematools.client.schemas.validation.FrozenMap; -import org.openapijsonschematools.client.components.schemas.NullableClass; - -import java.util.Arrays; -import java.util.List; -import java.util.AbstractMap; - -static final SchemaConfiguration configuration = new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().build()); - -// null validation -Nothing? validatedPayload = NullableClass.AdditionalProperties1.validate( - (Nothing?) null, - configuration -); -``` - -### Field Summary -| Modifier and Type | Field and Description | -| ----------------- | ---------------------- | -| Set> | type = Set.of(
    Nothing?.class,
    Map.class
)
| - -### Method Summary -| Modifier and Type | Method and Description | -| ----------------- | ---------------------- | -| Nothing? | validate(Nothing? arg, SchemaConfiguration configuration) | -| [AdditionalProperties1BoxedVoid](#additionalproperties1boxedvoid) | validateAndBox(Nothing? arg, SchemaConfiguration configuration) | -| FrozenMap | validate(Map<?, ?> arg, SchemaConfiguration configuration) | -| [AdditionalProperties1BoxedMap](#additionalproperties1boxedmap) | validateAndBox(Map<?, ?> arg, SchemaConfiguration configuration) | -| [AdditionalProperties1Boxed](#additionalproperties1boxed) | validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) | -| @Nullable Object | validate(@Nullable Object arg, SchemaConfiguration configuration) | - -## ObjectNullablePropBoxed -public sealed interface ObjectNullablePropBoxed
-permits
-[ObjectNullablePropBoxedVoid](#objectnullablepropboxedvoid), -[ObjectNullablePropBoxedMap](#objectnullablepropboxedmap) - -sealed interface that stores validated payloads using boxed classes - -## ObjectNullablePropBoxedVoid -public record ObjectNullablePropBoxedVoid
-implements [ObjectNullablePropBoxed](#objectnullablepropboxed) - -record that stores validated null payloads, sealed permits implementation - -### Constructor Summary -| Constructor and Description | -| --------------------------- | -| ObjectNullablePropBoxedVoid(Nothing? data)
Creates an instance, private visibility | - -### Method Summary -| Modifier and Type | Method and Description | -| ----------------- | ---------------------- | -| Nothing? | data()
validated payload | -| @Nullable Object | getData()
validated payload | - -## ObjectNullablePropBoxedMap -public record ObjectNullablePropBoxedMap
-implements [ObjectNullablePropBoxed](#objectnullablepropboxed) - -record that stores validated Map payloads, sealed permits implementation - -### Constructor Summary -| Constructor and Description | -| --------------------------- | -| ObjectNullablePropBoxedMap([ObjectNullablePropMap](#objectnullablepropmap) data)
Creates an instance, private visibility | - -### Method Summary -| Modifier and Type | Method and Description | -| ----------------- | ---------------------- | -| [ObjectNullablePropMap](#objectnullablepropmap) | data()
validated payload | -| @Nullable Object | getData()
validated payload | - -## ObjectNullableProp -public static class ObjectNullableProp
-extends JsonSchema - -A schema class that validates payloads - -### Code Sample -``` -import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags; -import org.openapijsonschematools.client.configurations.SchemaConfiguration; -import org.openapijsonschematools.client.exceptions.ValidationException; -import org.openapijsonschematools.client.schemas.validation.MapUtils; -import org.openapijsonschematools.client.schemas.validation.FrozenList; -import org.openapijsonschematools.client.schemas.validation.FrozenMap; -import org.openapijsonschematools.client.components.schemas.NullableClass; - -import java.util.Arrays; -import java.util.List; -import java.util.AbstractMap; - -static final SchemaConfiguration configuration = new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().build()); - -// null validation -Nothing? validatedPayload = NullableClass.ObjectNullableProp.validate( - (Nothing?) null, - configuration -); - -// Map validation -NullableClass.ObjectNullablePropMap validatedPayload = - NullableClass.ObjectNullableProp.validate( - new NullableClass.ObjectNullablePropMapBuilder() - .build(), - configuration -); -``` - -### Field Summary -| Modifier and Type | Field and Description | -| ----------------- | ---------------------- | -| Set> | type = Set.of(
    Nothing?.class,
    Map.class
)
| -| Class | additionalProperties = [AdditionalProperties.class](#additionalproperties) | - -### Method Summary -| Modifier and Type | Method and Description | -| ----------------- | ---------------------- | -| Nothing? | validate(Nothing? arg, SchemaConfiguration configuration) | -| [ObjectNullablePropBoxedVoid](#objectnullablepropboxedvoid) | validateAndBox(Nothing? arg, SchemaConfiguration configuration) | -| [ObjectNullablePropMap](#objectnullablepropmap) | validate([Map<?, ?>](#objectnullablepropmapbuilder) arg, SchemaConfiguration configuration) | -| [ObjectNullablePropBoxedMap](#objectnullablepropboxedmap) | validateAndBox([Map<?, ?>](#objectnullablepropmapbuilder) arg, SchemaConfiguration configuration) | -| [ObjectNullablePropBoxed](#objectnullablepropboxed) | validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) | -| @Nullable Object | validate(@Nullable Object arg, SchemaConfiguration configuration) | - -## ObjectNullablePropMapBuilder -public class ObjectNullablePropMapBuilder
-builder for `Map>` - -A class that builds the Map input type - -### Constructor Summary -| Constructor and Description | -| --------------------------- | -| ObjectNullablePropMapBuilder()
Creates a builder that contains an empty map | - -### Method Summary -| Modifier and Type | Method and Description | -| ----------------- | ---------------------- | -| Map> | build()
Returns map input that should be used with Schema.validate | -| [ObjectNullablePropMapBuilder](#objectnullablepropmapbuilder) | additionalProperty(String key, Map value) | - -## ObjectNullablePropMap -public static class ObjectNullablePropMap
-extends FrozenMap> - -A class to store validated Map payloads - -### Method Summary -| Modifier and Type | Method and Description | -| ----------------- | ---------------------- | -| static [ObjectNullablePropMap](#objectnullablepropmap) | of([Map>](#objectnullablepropmapbuilder) arg, SchemaConfiguration configuration) | -| FrozenMap | getAdditionalProperty(String name)
provides type safety for additional properties | - -## AdditionalPropertiesBoxed -public sealed interface AdditionalPropertiesBoxed
-permits
-[AdditionalPropertiesBoxedMap](#additionalpropertiesboxedmap) - -sealed interface that stores validated payloads using boxed classes - -## 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 MapJsonSchema.MapJsonSchema1 - -A schema class that validates payloads - -| Methods Inherited from class org.openapijsonschematools.client.schemas.MapJsonSchema.MapJsonSchema1 | -| ------------------------------------------------------------------ | -| validate | -| validateAndBox | - -## ArrayItemsNullableBoxed -public sealed interface ArrayItemsNullableBoxed
-permits
-[ArrayItemsNullableBoxedList](#arrayitemsnullableboxedlist) - -sealed interface that stores validated payloads using boxed classes - -## ArrayItemsNullableBoxedList -public record ArrayItemsNullableBoxedList
-implements [ArrayItemsNullableBoxed](#arrayitemsnullableboxed) - -record that stores validated List payloads, sealed permits implementation - -### Constructor Summary -| Constructor and Description | -| --------------------------- | -| ArrayItemsNullableBoxedList([ArrayItemsNullableList](#arrayitemsnullablelist) data)
Creates an instance, private visibility | - -### Method Summary -| Modifier and Type | Method and Description | -| ----------------- | ---------------------- | -| [ArrayItemsNullableList](#arrayitemsnullablelist) | data()
validated payload | -| @Nullable Object | getData()
validated payload | - -## ArrayItemsNullable -public static class ArrayItemsNullable
-extends JsonSchema - -A schema class that validates payloads - -### Code Sample -``` -import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags; -import org.openapijsonschematools.client.configurations.SchemaConfiguration; -import org.openapijsonschematools.client.exceptions.ValidationException; -import org.openapijsonschematools.client.schemas.validation.MapUtils; -import org.openapijsonschematools.client.schemas.validation.FrozenList; -import org.openapijsonschematools.client.schemas.validation.FrozenMap; -import org.openapijsonschematools.client.components.schemas.NullableClass; - -import java.util.Arrays; -import java.util.List; -import java.util.AbstractMap; - -static final SchemaConfiguration configuration = new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().build()); - -// List validation -NullableClass.ArrayItemsNullableList validatedPayload = - NullableClass.ArrayItemsNullable.validate( - new NullableClass.ArrayItemsNullableListBuilder() - .add((Nothing?) null) - - .build(), - configuration -); -``` - -### Field Summary -| Modifier and Type | Field and Description | -| ----------------- | ---------------------- | -| Set> | type = Set.of(List.class) | -| Class | items = [Items2.class](#items2) | - -### Method Summary -| Modifier and Type | Method and Description | -| ----------------- | ---------------------- | -| [ArrayItemsNullableList](#arrayitemsnullablelist) | validate([List](#arrayitemsnullablelistbuilder) arg, SchemaConfiguration configuration) | -| [ArrayItemsNullableBoxedList](#arrayitemsnullableboxedlist) | validateAndBox([List](#arrayitemsnullablelistbuilder) arg, SchemaConfiguration configuration) | -| [ArrayItemsNullableBoxed](#arrayitemsnullableboxed) | validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) | -| @Nullable Object | validate(@Nullable Object arg, SchemaConfiguration configuration) | - -## ArrayItemsNullableListBuilder -public class ArrayItemsNullableListBuilder
-builder for `List<@Nullable Map>` - -A class that builds the List input type - -### Constructor Summary -| Constructor and Description | -| --------------------------- | -| ArrayItemsNullableListBuilder()
Creates an empty list | -| ArrayItemsNullableListBuilder(List<@Nullable Map> items)
Stores the items in a list | - -### Method Summary -| Modifier and Type | Method and Description | -| ----------------- | ---------------------- | -| ArrayItemsNullableListBuilder | add(Nothing? item) | -| ArrayItemsNullableListBuilder | add(Map item) | -| List<@Nullable Map> | build()
Returns list input that should be used with Schema.validate | - -## ArrayItemsNullableList -public class ArrayItemsNullableList
-extends `FrozenList<@Nullable FrozenMap>` - -A class to store validated List payloads - -### Method Summary -| Modifier and Type | Method and Description | -| ----------------- | ---------------------- | -| static [ArrayItemsNullableList](#arrayitemsnullablelist) | of([List>](#arrayitemsnullablelistbuilder) arg, SchemaConfiguration configuration) | - -## Items2Boxed -public sealed interface Items2Boxed
-permits
-[Items2BoxedVoid](#items2boxedvoid), -[Items2BoxedMap](#items2boxedmap) - -sealed interface that stores validated payloads using boxed classes - -## Items2BoxedVoid -public record Items2BoxedVoid
-implements [Items2Boxed](#items2boxed) - -record that stores validated null payloads, sealed permits implementation - -### Constructor Summary -| Constructor and Description | -| --------------------------- | -| Items2BoxedVoid(Nothing? data)
Creates an instance, private visibility | - -### Method Summary -| Modifier and Type | Method and Description | -| ----------------- | ---------------------- | -| Nothing? | data()
validated payload | -| @Nullable Object | getData()
validated payload | - -## Items2BoxedMap -public record Items2BoxedMap
-implements [Items2Boxed](#items2boxed) - -record that stores validated Map payloads, sealed permits implementation - -### Constructor Summary -| Constructor and Description | -| --------------------------- | -| Items2BoxedMap(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 | - -## Items2 -public static class Items2
-extends JsonSchema - -A schema class that validates payloads - -### Code Sample -``` -import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags; -import org.openapijsonschematools.client.configurations.SchemaConfiguration; -import org.openapijsonschematools.client.exceptions.ValidationException; -import org.openapijsonschematools.client.schemas.validation.MapUtils; -import org.openapijsonschematools.client.schemas.validation.FrozenList; -import org.openapijsonschematools.client.schemas.validation.FrozenMap; -import org.openapijsonschematools.client.components.schemas.NullableClass; - -import java.util.Arrays; -import java.util.List; -import java.util.AbstractMap; - -static final SchemaConfiguration configuration = new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().build()); - -// null validation -Nothing? validatedPayload = NullableClass.Items2.validate( - (Nothing?) null, - configuration -); -``` - -### Field Summary -| Modifier and Type | Field and Description | -| ----------------- | ---------------------- | -| Set> | type = Set.of(
    Nothing?.class,
    Map.class
)
| - -### Method Summary -| Modifier and Type | Method and Description | -| ----------------- | ---------------------- | -| Nothing? | validate(Nothing? arg, SchemaConfiguration configuration) | -| [Items2BoxedVoid](#items2boxedvoid) | validateAndBox(Nothing? arg, SchemaConfiguration configuration) | -| FrozenMap | validate(Map<?, ?> arg, SchemaConfiguration configuration) | -| [Items2BoxedMap](#items2boxedmap) | validateAndBox(Map<?, ?> arg, SchemaConfiguration configuration) | -| [Items2Boxed](#items2boxed) | validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) | -| @Nullable Object | validate(@Nullable Object arg, SchemaConfiguration configuration) | - -## ArrayAndItemsNullablePropBoxed -public sealed interface ArrayAndItemsNullablePropBoxed
-permits
-[ArrayAndItemsNullablePropBoxedVoid](#arrayanditemsnullablepropboxedvoid), -[ArrayAndItemsNullablePropBoxedList](#arrayanditemsnullablepropboxedlist) - -sealed interface that stores validated payloads using boxed classes - -## ArrayAndItemsNullablePropBoxedVoid -public record ArrayAndItemsNullablePropBoxedVoid
-implements [ArrayAndItemsNullablePropBoxed](#arrayanditemsnullablepropboxed) - -record that stores validated null payloads, sealed permits implementation - -### Constructor Summary -| Constructor and Description | -| --------------------------- | -| ArrayAndItemsNullablePropBoxedVoid(Nothing? data)
Creates an instance, private visibility | - -### Method Summary -| Modifier and Type | Method and Description | -| ----------------- | ---------------------- | -| Nothing? | data()
validated payload | -| @Nullable Object | getData()
validated payload | - -## ArrayAndItemsNullablePropBoxedList -public record ArrayAndItemsNullablePropBoxedList
-implements [ArrayAndItemsNullablePropBoxed](#arrayanditemsnullablepropboxed) - -record that stores validated List payloads, sealed permits implementation - -### Constructor Summary -| Constructor and Description | -| --------------------------- | -| ArrayAndItemsNullablePropBoxedList([ArrayAndItemsNullablePropList](#arrayanditemsnullableproplist) data)
Creates an instance, private visibility | - -### Method Summary -| Modifier and Type | Method and Description | -| ----------------- | ---------------------- | -| [ArrayAndItemsNullablePropList](#arrayanditemsnullableproplist) | data()
validated payload | -| @Nullable Object | getData()
validated payload | - -## ArrayAndItemsNullableProp -public static class ArrayAndItemsNullableProp
-extends JsonSchema - -A schema class that validates payloads - -### Code Sample -``` -import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags; -import org.openapijsonschematools.client.configurations.SchemaConfiguration; -import org.openapijsonschematools.client.exceptions.ValidationException; -import org.openapijsonschematools.client.schemas.validation.MapUtils; -import org.openapijsonschematools.client.schemas.validation.FrozenList; -import org.openapijsonschematools.client.schemas.validation.FrozenMap; -import org.openapijsonschematools.client.components.schemas.NullableClass; - -import java.util.Arrays; -import java.util.List; -import java.util.AbstractMap; - -static final SchemaConfiguration configuration = new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().build()); - -// null validation -Nothing? validatedPayload = NullableClass.ArrayAndItemsNullableProp.validate( - (Nothing?) null, - configuration -); - -// List validation -NullableClass.ArrayAndItemsNullablePropList validatedPayload = - NullableClass.ArrayAndItemsNullableProp.validate( - new NullableClass.ArrayAndItemsNullablePropListBuilder() - .add((Nothing?) null) - - .build(), - configuration -); -``` - -### Field Summary -| Modifier and Type | Field and Description | -| ----------------- | ---------------------- | -| Set> | type = Set.of(
    Nothing?.class,
    List.class
)
| -| Class | items = [Items1.class](#items1) | - -### Method Summary -| Modifier and Type | Method and Description | -| ----------------- | ---------------------- | -| Nothing? | validate(Nothing? arg, SchemaConfiguration configuration) | -| [ArrayAndItemsNullablePropBoxedVoid](#arrayanditemsnullablepropboxedvoid) | validateAndBox(Nothing? arg, SchemaConfiguration configuration) | -| [ArrayAndItemsNullablePropList](#arrayanditemsnullableproplist) | validate([List](#arrayanditemsnullableproplistbuilder) arg, SchemaConfiguration configuration) | -| [ArrayAndItemsNullablePropBoxedList](#arrayanditemsnullablepropboxedlist) | validateAndBox([List](#arrayanditemsnullableproplistbuilder) arg, SchemaConfiguration configuration) | -| [ArrayAndItemsNullablePropBoxed](#arrayanditemsnullablepropboxed) | validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) | -| @Nullable Object | validate(@Nullable Object arg, SchemaConfiguration configuration) | - -## ArrayAndItemsNullablePropListBuilder -public class ArrayAndItemsNullablePropListBuilder
-builder for `List<@Nullable Map>` - -A class that builds the List input type - -### Constructor Summary -| Constructor and Description | -| --------------------------- | -| ArrayAndItemsNullablePropListBuilder()
Creates an empty list | -| ArrayAndItemsNullablePropListBuilder(List<@Nullable Map> items)
Stores the items in a list | - -### Method Summary -| Modifier and Type | Method and Description | -| ----------------- | ---------------------- | -| ArrayAndItemsNullablePropListBuilder | add(Nothing? item) | -| ArrayAndItemsNullablePropListBuilder | add(Map item) | -| List<@Nullable Map> | build()
Returns list input that should be used with Schema.validate | - -## ArrayAndItemsNullablePropList -public class ArrayAndItemsNullablePropList
-extends `FrozenList<@Nullable FrozenMap>` - -A class to store validated List payloads - -### Method Summary -| Modifier and Type | Method and Description | -| ----------------- | ---------------------- | -| static [ArrayAndItemsNullablePropList](#arrayanditemsnullableproplist) | of([List>](#arrayanditemsnullableproplistbuilder) arg, SchemaConfiguration configuration) | - -## Items1Boxed -public sealed interface Items1Boxed
-permits
-[Items1BoxedVoid](#items1boxedvoid), -[Items1BoxedMap](#items1boxedmap) - -sealed interface that stores validated payloads using boxed classes - -## Items1BoxedVoid -public record Items1BoxedVoid
-implements [Items1Boxed](#items1boxed) - -record that stores validated null payloads, sealed permits implementation - -### Constructor Summary -| Constructor and Description | -| --------------------------- | -| Items1BoxedVoid(Nothing? data)
Creates an instance, private visibility | - -### Method Summary -| Modifier and Type | Method and Description | -| ----------------- | ---------------------- | -| Nothing? | data()
validated payload | -| @Nullable Object | getData()
validated payload | - -## Items1BoxedMap -public record Items1BoxedMap
-implements [Items1Boxed](#items1boxed) - -record that stores validated Map payloads, sealed permits implementation - -### Constructor Summary -| Constructor and Description | -| --------------------------- | -| Items1BoxedMap(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 | - -## Items1 -public static class Items1
-extends JsonSchema - -A schema class that validates payloads - -### Code Sample -``` -import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags; -import org.openapijsonschematools.client.configurations.SchemaConfiguration; -import org.openapijsonschematools.client.exceptions.ValidationException; -import org.openapijsonschematools.client.schemas.validation.MapUtils; -import org.openapijsonschematools.client.schemas.validation.FrozenList; -import org.openapijsonschematools.client.schemas.validation.FrozenMap; -import org.openapijsonschematools.client.components.schemas.NullableClass; - -import java.util.Arrays; -import java.util.List; -import java.util.AbstractMap; - -static final SchemaConfiguration configuration = new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().build()); - -// null validation -Nothing? validatedPayload = NullableClass.Items1.validate( - (Nothing?) null, - configuration -); -``` - -### Field Summary -| Modifier and Type | Field and Description | -| ----------------- | ---------------------- | -| Set> | type = Set.of(
    Nothing?.class,
    Map.class
)
| - -### Method Summary -| Modifier and Type | Method and Description | -| ----------------- | ---------------------- | -| Nothing? | validate(Nothing? arg, SchemaConfiguration configuration) | -| [Items1BoxedVoid](#items1boxedvoid) | validateAndBox(Nothing? arg, SchemaConfiguration configuration) | -| FrozenMap | validate(Map<?, ?> arg, SchemaConfiguration configuration) | -| [Items1BoxedMap](#items1boxedmap) | validateAndBox(Map<?, ?> arg, SchemaConfiguration configuration) | -| [Items1Boxed](#items1boxed) | validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) | -| @Nullable Object | validate(@Nullable Object arg, SchemaConfiguration configuration) | - -## ArrayNullablePropBoxed -public sealed interface ArrayNullablePropBoxed
-permits
-[ArrayNullablePropBoxedVoid](#arraynullablepropboxedvoid), -[ArrayNullablePropBoxedList](#arraynullablepropboxedlist) - -sealed interface that stores validated payloads using boxed classes - -## ArrayNullablePropBoxedVoid -public record ArrayNullablePropBoxedVoid
-implements [ArrayNullablePropBoxed](#arraynullablepropboxed) - -record that stores validated null payloads, sealed permits implementation - -### Constructor Summary -| Constructor and Description | -| --------------------------- | -| ArrayNullablePropBoxedVoid(Nothing? data)
Creates an instance, private visibility | - -### Method Summary -| Modifier and Type | Method and Description | -| ----------------- | ---------------------- | -| Nothing? | data()
validated payload | -| @Nullable Object | getData()
validated payload | - -## ArrayNullablePropBoxedList -public record ArrayNullablePropBoxedList
-implements [ArrayNullablePropBoxed](#arraynullablepropboxed) - -record that stores validated List payloads, sealed permits implementation - -### Constructor Summary -| Constructor and Description | -| --------------------------- | -| ArrayNullablePropBoxedList([ArrayNullablePropList](#arraynullableproplist) data)
Creates an instance, private visibility | - -### Method Summary -| Modifier and Type | Method and Description | -| ----------------- | ---------------------- | -| [ArrayNullablePropList](#arraynullableproplist) | data()
validated payload | -| @Nullable Object | getData()
validated payload | - -## ArrayNullableProp -public static class ArrayNullableProp
-extends JsonSchema - -A schema class that validates payloads - -### Code Sample -``` -import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags; -import org.openapijsonschematools.client.configurations.SchemaConfiguration; -import org.openapijsonschematools.client.exceptions.ValidationException; -import org.openapijsonschematools.client.schemas.validation.MapUtils; -import org.openapijsonschematools.client.schemas.validation.FrozenList; -import org.openapijsonschematools.client.schemas.validation.FrozenMap; -import org.openapijsonschematools.client.components.schemas.NullableClass; - -import java.util.Arrays; -import java.util.List; -import java.util.AbstractMap; - -static final SchemaConfiguration configuration = new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().build()); - -// null validation -Nothing? validatedPayload = NullableClass.ArrayNullableProp.validate( - (Nothing?) null, - configuration -); - -// List validation -NullableClass.ArrayNullablePropList validatedPayload = - NullableClass.ArrayNullableProp.validate( - new NullableClass.ArrayNullablePropListBuilder() - .build(), - configuration -); -``` - -### Field Summary -| Modifier and Type | Field and Description | -| ----------------- | ---------------------- | -| Set> | type = Set.of(
    Nothing?.class,
    List.class
)
| -| Class | items = [Items.class](#items) | - -### Method Summary -| Modifier and Type | Method and Description | -| ----------------- | ---------------------- | -| Nothing? | validate(Nothing? arg, SchemaConfiguration configuration) | -| [ArrayNullablePropBoxedVoid](#arraynullablepropboxedvoid) | validateAndBox(Nothing? arg, SchemaConfiguration configuration) | -| [ArrayNullablePropList](#arraynullableproplist) | validate([List](#arraynullableproplistbuilder) arg, SchemaConfiguration configuration) | -| [ArrayNullablePropBoxedList](#arraynullablepropboxedlist) | validateAndBox([List](#arraynullableproplistbuilder) arg, SchemaConfiguration configuration) | -| [ArrayNullablePropBoxed](#arraynullablepropboxed) | validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) | -| @Nullable Object | validate(@Nullable Object arg, SchemaConfiguration configuration) | - -## ArrayNullablePropListBuilder -public class ArrayNullablePropListBuilder
-builder for `List>` - -A class that builds the List input type - -### Constructor Summary -| Constructor and Description | -| --------------------------- | -| ArrayNullablePropListBuilder()
Creates an empty list | -| ArrayNullablePropListBuilder(List> items)
Stores the items in a list | - -### Method Summary -| Modifier and Type | Method and Description | -| ----------------- | ---------------------- | -| ArrayNullablePropListBuilder | add(Map item) | -| List> | build()
Returns list input that should be used with Schema.validate | - -## ArrayNullablePropList -public class ArrayNullablePropList
-extends `FrozenList>` - -A class to store validated List payloads - -### Method Summary -| Modifier and Type | Method and Description | -| ----------------- | ---------------------- | -| static [ArrayNullablePropList](#arraynullableproplist) | of([List>](#arraynullableproplistbuilder) arg, SchemaConfiguration configuration) | - -## ItemsBoxed -public sealed interface ItemsBoxed
-permits
-[ItemsBoxedMap](#itemsboxedmap) - -sealed interface that stores validated payloads using boxed classes - -## ItemsBoxedMap -public record ItemsBoxedMap
-implements [ItemsBoxed](#itemsboxed) - -record that stores validated Map payloads, sealed permits implementation - -### Constructor Summary -| Constructor and Description | -| --------------------------- | -| ItemsBoxedMap(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 | - -## Items -public static class Items
-extends MapJsonSchema.MapJsonSchema1 - -A schema class that validates payloads - -| Methods Inherited from class org.openapijsonschematools.client.schemas.MapJsonSchema.MapJsonSchema1 | -| ------------------------------------------------------------------ | -| validate | -| validateAndBox | - -## DatetimePropBoxed -public sealed interface DatetimePropBoxed
-permits
-[DatetimePropBoxedVoid](#datetimepropboxedvoid), -[DatetimePropBoxedString](#datetimepropboxedstring) - -sealed interface that stores validated payloads using boxed classes - -## DatetimePropBoxedVoid -public record DatetimePropBoxedVoid
-implements [DatetimePropBoxed](#datetimepropboxed) - -record that stores validated null payloads, sealed permits implementation - -### Constructor Summary -| Constructor and Description | -| --------------------------- | -| DatetimePropBoxedVoid(Nothing? data)
Creates an instance, private visibility | - -### Method Summary -| Modifier and Type | Method and Description | -| ----------------- | ---------------------- | -| Nothing? | data()
validated payload | -| @Nullable Object | getData()
validated payload | - -## DatetimePropBoxedString -public record DatetimePropBoxedString
-implements [DatetimePropBoxed](#datetimepropboxed) - -record that stores validated String payloads, sealed permits implementation - -### Constructor Summary -| Constructor and Description | -| --------------------------- | -| DatetimePropBoxedString(String data)
Creates an instance, private visibility | - -### Method Summary -| Modifier and Type | Method and Description | -| ----------------- | ---------------------- | -| String | data()
validated payload | -| @Nullable Object | getData()
validated payload | - -## DatetimeProp -public static class DatetimeProp
-extends JsonSchema - -A schema class that validates payloads - -### Code Sample -``` -import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags; -import org.openapijsonschematools.client.configurations.SchemaConfiguration; -import org.openapijsonschematools.client.exceptions.ValidationException; -import org.openapijsonschematools.client.schemas.validation.MapUtils; -import org.openapijsonschematools.client.schemas.validation.FrozenList; -import org.openapijsonschematools.client.schemas.validation.FrozenMap; -import org.openapijsonschematools.client.components.schemas.NullableClass; - -import java.util.Arrays; -import java.util.List; -import java.util.AbstractMap; - -static final SchemaConfiguration configuration = new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().build()); - -// null validation -Nothing? validatedPayload = NullableClass.DatetimeProp.validate( - (Nothing?) null, - configuration -); - -// String validation -String validatedPayload = NullableClass.DatetimeProp.validate( - "1970-01-01T00:00:00.00Z", - configuration -); -``` - -### Field Summary -| Modifier and Type | Field and Description | -| ----------------- | ---------------------- | -| Set> | type = Set.of(
    Nothing?.class,
    String.class
)
| -| String | type = "date-time"; | - -### Method Summary -| Modifier and Type | Method and Description | -| ----------------- | ---------------------- | -| Nothing? | validate(Nothing? arg, SchemaConfiguration configuration) | -| [DatetimePropBoxedVoid](#datetimepropboxedvoid) | validateAndBox(Nothing? arg, SchemaConfiguration configuration) | -| String | validate(String arg, SchemaConfiguration configuration) | -| [DatetimePropBoxedString](#datetimepropboxedstring) | validateAndBox(String arg, SchemaConfiguration configuration) | -| [DatetimePropBoxed](#datetimepropboxed) | validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) | -| @Nullable Object | validate(@Nullable Object arg, SchemaConfiguration configuration) | - -## DatePropBoxed -public sealed interface DatePropBoxed
-permits
-[DatePropBoxedVoid](#datepropboxedvoid), -[DatePropBoxedString](#datepropboxedstring) - -sealed interface that stores validated payloads using boxed classes - -## DatePropBoxedVoid -public record DatePropBoxedVoid
-implements [DatePropBoxed](#datepropboxed) - -record that stores validated null payloads, sealed permits implementation - -### Constructor Summary -| Constructor and Description | -| --------------------------- | -| DatePropBoxedVoid(Nothing? data)
Creates an instance, private visibility | - -### Method Summary -| Modifier and Type | Method and Description | -| ----------------- | ---------------------- | -| Nothing? | data()
validated payload | -| @Nullable Object | getData()
validated payload | - -## DatePropBoxedString -public record DatePropBoxedString
-implements [DatePropBoxed](#datepropboxed) - -record that stores validated String payloads, sealed permits implementation - -### Constructor Summary -| Constructor and Description | -| --------------------------- | -| DatePropBoxedString(String data)
Creates an instance, private visibility | - -### Method Summary -| Modifier and Type | Method and Description | -| ----------------- | ---------------------- | -| String | data()
validated payload | -| @Nullable Object | getData()
validated payload | - -## DateProp -public static class DateProp
-extends JsonSchema - -A schema class that validates payloads - -### Code Sample -``` -import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags; -import org.openapijsonschematools.client.configurations.SchemaConfiguration; -import org.openapijsonschematools.client.exceptions.ValidationException; -import org.openapijsonschematools.client.schemas.validation.MapUtils; -import org.openapijsonschematools.client.schemas.validation.FrozenList; -import org.openapijsonschematools.client.schemas.validation.FrozenMap; -import org.openapijsonschematools.client.components.schemas.NullableClass; - -import java.util.Arrays; -import java.util.List; -import java.util.AbstractMap; - -static final SchemaConfiguration configuration = new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().build()); - -// null validation -Nothing? validatedPayload = NullableClass.DateProp.validate( - (Nothing?) null, - configuration -); - -// String validation -String validatedPayload = NullableClass.DateProp.validate( - "2020-12-13", - configuration -); -``` - -### Field Summary -| Modifier and Type | Field and Description | -| ----------------- | ---------------------- | -| Set> | type = Set.of(
    Nothing?.class,
    String.class
)
| -| String | type = "date"; | - -### Method Summary -| Modifier and Type | Method and Description | -| ----------------- | ---------------------- | -| Nothing? | validate(Nothing? arg, SchemaConfiguration configuration) | -| [DatePropBoxedVoid](#datepropboxedvoid) | validateAndBox(Nothing? arg, SchemaConfiguration configuration) | -| String | validate(String arg, SchemaConfiguration configuration) | -| [DatePropBoxedString](#datepropboxedstring) | validateAndBox(String arg, SchemaConfiguration configuration) | -| [DatePropBoxed](#datepropboxed) | validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) | -| @Nullable Object | validate(@Nullable Object arg, SchemaConfiguration configuration) | - -## StringPropBoxed -public sealed interface StringPropBoxed
-permits
-[StringPropBoxedVoid](#stringpropboxedvoid), -[StringPropBoxedString](#stringpropboxedstring) - -sealed interface that stores validated payloads using boxed classes - -## StringPropBoxedVoid -public record StringPropBoxedVoid
-implements [StringPropBoxed](#stringpropboxed) - -record that stores validated null payloads, sealed permits implementation - -### Constructor Summary -| Constructor and Description | -| --------------------------- | -| StringPropBoxedVoid(Nothing? data)
Creates an instance, private visibility | - -### Method Summary -| Modifier and Type | Method and Description | -| ----------------- | ---------------------- | -| Nothing? | data()
validated payload | -| @Nullable Object | getData()
validated payload | - -## StringPropBoxedString -public record StringPropBoxedString
-implements [StringPropBoxed](#stringpropboxed) - -record that stores validated String payloads, sealed permits implementation - -### Constructor Summary -| Constructor and Description | -| --------------------------- | -| StringPropBoxedString(String data)
Creates an instance, private visibility | - -### Method Summary -| Modifier and Type | Method and Description | -| ----------------- | ---------------------- | -| String | data()
validated payload | -| @Nullable Object | getData()
validated payload | - -## StringProp -public static class StringProp
-extends JsonSchema - -A schema class that validates payloads - -### Code Sample -``` -import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags; -import org.openapijsonschematools.client.configurations.SchemaConfiguration; -import org.openapijsonschematools.client.exceptions.ValidationException; -import org.openapijsonschematools.client.schemas.validation.MapUtils; -import org.openapijsonschematools.client.schemas.validation.FrozenList; -import org.openapijsonschematools.client.schemas.validation.FrozenMap; -import org.openapijsonschematools.client.components.schemas.NullableClass; - -import java.util.Arrays; -import java.util.List; -import java.util.AbstractMap; - -static final SchemaConfiguration configuration = new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().build()); - -// null validation -Nothing? validatedPayload = NullableClass.StringProp.validate( - (Nothing?) null, - configuration -); - -// String validation -String validatedPayload = NullableClass.StringProp.validate( - "a", - configuration -); -``` - -### Field Summary -| Modifier and Type | Field and Description | -| ----------------- | ---------------------- | -| Set> | type = Set.of(
    Nothing?.class,
    String.class
)
| - -### Method Summary -| Modifier and Type | Method and Description | -| ----------------- | ---------------------- | -| Nothing? | validate(Nothing? arg, SchemaConfiguration configuration) | -| [StringPropBoxedVoid](#stringpropboxedvoid) | validateAndBox(Nothing? arg, SchemaConfiguration configuration) | -| String | validate(String arg, SchemaConfiguration configuration) | -| [StringPropBoxedString](#stringpropboxedstring) | validateAndBox(String arg, SchemaConfiguration configuration) | -| [StringPropBoxed](#stringpropboxed) | validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) | -| @Nullable Object | validate(@Nullable Object arg, SchemaConfiguration configuration) | - -## BooleanPropBoxed -public sealed interface BooleanPropBoxed
-permits
-[BooleanPropBoxedVoid](#booleanpropboxedvoid), -[BooleanPropBoxedBoolean](#booleanpropboxedboolean) - -sealed interface that stores validated payloads using boxed classes - -## BooleanPropBoxedVoid -public record BooleanPropBoxedVoid
-implements [BooleanPropBoxed](#booleanpropboxed) - -record that stores validated null payloads, sealed permits implementation - -### Constructor Summary -| Constructor and Description | -| --------------------------- | -| BooleanPropBoxedVoid(Nothing? data)
Creates an instance, private visibility | - -### Method Summary -| Modifier and Type | Method and Description | -| ----------------- | ---------------------- | -| Nothing? | data()
validated payload | -| @Nullable Object | getData()
validated payload | - -## BooleanPropBoxedBoolean -public record BooleanPropBoxedBoolean
-implements [BooleanPropBoxed](#booleanpropboxed) - -record that stores validated boolean payloads, sealed permits implementation - -### Constructor Summary -| Constructor and Description | -| --------------------------- | -| BooleanPropBoxedBoolean(boolean data)
Creates an instance, private visibility | - -### Method Summary -| Modifier and Type | Method and Description | -| ----------------- | ---------------------- | -| boolean | data()
validated payload | -| @Nullable Object | getData()
validated payload | - -## BooleanProp -public static class BooleanProp
-extends JsonSchema - -A schema class that validates payloads - -### Code Sample -``` -import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags; -import org.openapijsonschematools.client.configurations.SchemaConfiguration; -import org.openapijsonschematools.client.exceptions.ValidationException; -import org.openapijsonschematools.client.schemas.validation.MapUtils; -import org.openapijsonschematools.client.schemas.validation.FrozenList; -import org.openapijsonschematools.client.schemas.validation.FrozenMap; -import org.openapijsonschematools.client.components.schemas.NullableClass; - -import java.util.Arrays; -import java.util.List; -import java.util.AbstractMap; - -static final SchemaConfiguration configuration = new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().build()); - -// null validation -Nothing? validatedPayload = NullableClass.BooleanProp.validate( - (Nothing?) null, - configuration -); - -// boolean validation -boolean validatedPayload = NullableClass.BooleanProp.validate( - true, - configuration -); -``` - -### Field Summary -| Modifier and Type | Field and Description | -| ----------------- | ---------------------- | -| Set> | type = Set.of(
    Nothing?.class,
    Boolean.class
)
| - -### Method Summary -| Modifier and Type | Method and Description | -| ----------------- | ---------------------- | -| Nothing? | validate(Nothing? arg, SchemaConfiguration configuration) | -| [BooleanPropBoxedVoid](#booleanpropboxedvoid) | validateAndBox(Nothing? arg, SchemaConfiguration configuration) | -| boolean | validate(boolean arg, SchemaConfiguration configuration) | -| [BooleanPropBoxedBoolean](#booleanpropboxedboolean) | validateAndBox(boolean arg, SchemaConfiguration configuration) | -| [BooleanPropBoxed](#booleanpropboxed) | validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) | -| @Nullable Object | validate(@Nullable Object arg, SchemaConfiguration configuration) | - -## NumberPropBoxed -public sealed interface NumberPropBoxed
-permits
-[NumberPropBoxedVoid](#numberpropboxedvoid), -[NumberPropBoxedNumber](#numberpropboxednumber) - -sealed interface that stores validated payloads using boxed classes - -## NumberPropBoxedVoid -public record NumberPropBoxedVoid
-implements [NumberPropBoxed](#numberpropboxed) - -record that stores validated null payloads, sealed permits implementation - -### Constructor Summary -| Constructor and Description | -| --------------------------- | -| NumberPropBoxedVoid(Nothing? data)
Creates an instance, private visibility | - -### Method Summary -| Modifier and Type | Method and Description | -| ----------------- | ---------------------- | -| Nothing? | data()
validated payload | -| @Nullable Object | getData()
validated payload | - -## NumberPropBoxedNumber -public record NumberPropBoxedNumber
-implements [NumberPropBoxed](#numberpropboxed) - -record that stores validated Number payloads, sealed permits implementation - -### Constructor Summary -| Constructor and Description | -| --------------------------- | -| NumberPropBoxedNumber(Number data)
Creates an instance, private visibility | - -### Method Summary -| Modifier and Type | Method and Description | -| ----------------- | ---------------------- | -| Number | data()
validated payload | -| @Nullable Object | getData()
validated payload | - -## NumberProp -public static class NumberProp
-extends JsonSchema - -A schema class that validates payloads - -### Code Sample -``` -import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags; -import org.openapijsonschematools.client.configurations.SchemaConfiguration; -import org.openapijsonschematools.client.exceptions.ValidationException; -import org.openapijsonschematools.client.schemas.validation.MapUtils; -import org.openapijsonschematools.client.schemas.validation.FrozenList; -import org.openapijsonschematools.client.schemas.validation.FrozenMap; -import org.openapijsonschematools.client.components.schemas.NullableClass; - -import java.util.Arrays; -import java.util.List; -import java.util.AbstractMap; - -static final SchemaConfiguration configuration = new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().build()); - -// null validation -Nothing? validatedPayload = NullableClass.NumberProp.validate( - (Nothing?) null, - configuration -); - -// int validation -int validatedPayload = NullableClass.NumberProp.validate( - 1, - configuration -); -``` - -### Field Summary -| Modifier and Type | Field and Description | -| ----------------- | ---------------------- | -| Set> | type = Set.of(
    Nothing?.class,
    Integer.class,
    Long.class,
    Float.class,
    Double.class
)
| - -### Method Summary -| Modifier and Type | Method and Description | -| ----------------- | ---------------------- | -| Nothing? | validate(Nothing? arg, SchemaConfiguration configuration) | -| [NumberPropBoxedVoid](#numberpropboxedvoid) | validateAndBox(Nothing? arg, SchemaConfiguration configuration) | -| Number | validate(Number arg, SchemaConfiguration configuration) | -| [NumberPropBoxedNumber](#numberpropboxednumber) | validateAndBox(Number arg, SchemaConfiguration configuration) | -| [NumberPropBoxed](#numberpropboxed) | validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) | -| @Nullable Object | validate(@Nullable Object arg, SchemaConfiguration configuration) | - -## IntegerPropBoxed -public sealed interface IntegerPropBoxed
-permits
-[IntegerPropBoxedVoid](#integerpropboxedvoid), -[IntegerPropBoxedNumber](#integerpropboxednumber) - -sealed interface that stores validated payloads using boxed classes - -## IntegerPropBoxedVoid -public record IntegerPropBoxedVoid
-implements [IntegerPropBoxed](#integerpropboxed) - -record that stores validated null payloads, sealed permits implementation - -### Constructor Summary -| Constructor and Description | -| --------------------------- | -| IntegerPropBoxedVoid(Nothing? data)
Creates an instance, private visibility | - -### Method Summary -| Modifier and Type | Method and Description | -| ----------------- | ---------------------- | -| Nothing? | data()
validated payload | -| @Nullable Object | getData()
validated payload | - -## IntegerPropBoxedNumber -public record IntegerPropBoxedNumber
-implements [IntegerPropBoxed](#integerpropboxed) - -record that stores validated Number payloads, sealed permits implementation - -### Constructor Summary -| Constructor and Description | -| --------------------------- | -| IntegerPropBoxedNumber(Number data)
Creates an instance, private visibility | - -### Method Summary -| Modifier and Type | Method and Description | -| ----------------- | ---------------------- | -| Number | data()
validated payload | -| @Nullable Object | getData()
validated payload | - -## IntegerProp -public static class IntegerProp
-extends JsonSchema - -A schema class that validates payloads - -### Code Sample -``` -import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags; -import org.openapijsonschematools.client.configurations.SchemaConfiguration; -import org.openapijsonschematools.client.exceptions.ValidationException; -import org.openapijsonschematools.client.schemas.validation.MapUtils; -import org.openapijsonschematools.client.schemas.validation.FrozenList; -import org.openapijsonschematools.client.schemas.validation.FrozenMap; -import org.openapijsonschematools.client.components.schemas.NullableClass; - -import java.util.Arrays; -import java.util.List; -import java.util.AbstractMap; - -static final SchemaConfiguration configuration = new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().build()); - -// null validation -Nothing? validatedPayload = NullableClass.IntegerProp.validate( - (Nothing?) null, - configuration -); - -// int validation -int validatedPayload = NullableClass.IntegerProp.validate( - 1L, - configuration -); -``` - -### Field Summary -| Modifier and Type | Field and Description | -| ----------------- | ---------------------- | -| Set> | type = Set.of(
    Nothing?.class,
    Integer.class,
    Long.class,
    Float.class,
    Double.class
)
| -| String | type = "int"; | - -### Method Summary -| Modifier and Type | Method and Description | -| ----------------- | ---------------------- | -| Nothing? | validate(Nothing? arg, SchemaConfiguration configuration) | -| [IntegerPropBoxedVoid](#integerpropboxedvoid) | validateAndBox(Nothing? arg, SchemaConfiguration configuration) | -| long | validate(long arg, SchemaConfiguration configuration) | -| [IntegerPropBoxedNumber](#integerpropboxednumber) | validateAndBox(Number arg, SchemaConfiguration configuration) | -| [IntegerPropBoxed](#integerpropboxed) | validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) | -| @Nullable Object | validate(@Nullable Object arg, SchemaConfiguration configuration) | - -## AdditionalProperties3Boxed -public sealed interface AdditionalProperties3Boxed
-permits
-[AdditionalProperties3BoxedVoid](#additionalproperties3boxedvoid), -[AdditionalProperties3BoxedMap](#additionalproperties3boxedmap) - -sealed interface that stores validated payloads using boxed classes - -## AdditionalProperties3BoxedVoid -public record AdditionalProperties3BoxedVoid
-implements [AdditionalProperties3Boxed](#additionalproperties3boxed) - -record that stores validated null payloads, sealed permits implementation - -### Constructor Summary -| Constructor and Description | -| --------------------------- | -| AdditionalProperties3BoxedVoid(Nothing? data)
Creates an instance, private visibility | - -### Method Summary -| Modifier and Type | Method and Description | -| ----------------- | ---------------------- | -| Nothing? | data()
validated payload | -| @Nullable Object | getData()
validated payload | - -## AdditionalProperties3BoxedMap -public record AdditionalProperties3BoxedMap
-implements [AdditionalProperties3Boxed](#additionalproperties3boxed) - -record that stores validated Map payloads, sealed permits implementation - -### Constructor Summary -| Constructor and Description | -| --------------------------- | -| AdditionalProperties3BoxedMap(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 | - -## AdditionalProperties3 -public static class AdditionalProperties3
-extends JsonSchema - -A schema class that validates payloads - -### Code Sample -``` -import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags; -import org.openapijsonschematools.client.configurations.SchemaConfiguration; -import org.openapijsonschematools.client.exceptions.ValidationException; -import org.openapijsonschematools.client.schemas.validation.MapUtils; -import org.openapijsonschematools.client.schemas.validation.FrozenList; -import org.openapijsonschematools.client.schemas.validation.FrozenMap; -import org.openapijsonschematools.client.components.schemas.NullableClass; - -import java.util.Arrays; -import java.util.List; -import java.util.AbstractMap; - -static final SchemaConfiguration configuration = new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().build()); - -// null validation -Nothing? validatedPayload = NullableClass.AdditionalProperties3.validate( - (Nothing?) null, - configuration -); -``` - -### Field Summary -| Modifier and Type | Field and Description | -| ----------------- | ---------------------- | -| Set> | type = Set.of(
    Nothing?.class,
    Map.class
)
| - -### Method Summary -| Modifier and Type | Method and Description | -| ----------------- | ---------------------- | -| Nothing? | validate(Nothing? arg, SchemaConfiguration configuration) | -| [AdditionalProperties3BoxedVoid](#additionalproperties3boxedvoid) | validateAndBox(Nothing? arg, SchemaConfiguration configuration) | -| FrozenMap | validate(Map<?, ?> arg, SchemaConfiguration configuration) | -| [AdditionalProperties3BoxedMap](#additionalproperties3boxedmap) | validateAndBox(Map<?, ?> arg, SchemaConfiguration configuration) | -| [AdditionalProperties3Boxed](#additionalproperties3boxed) | validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) | -| @Nullable Object | validate(@Nullable Object arg, SchemaConfiguration configuration) | - -[[Back to top]](#top) [[Back to Component Schemas]](../../../README.md#Component-Schemas) [[Back to README]](../../../README.md) diff --git a/samples/client/petstore/kotlin/docs/components/schemas/NullableShape.md b/samples/client/petstore/kotlin/docs/components/schemas/NullableShape.md deleted file mode 100644 index f3ec3e128d6..00000000000 --- a/samples/client/petstore/kotlin/docs/components/schemas/NullableShape.md +++ /dev/null @@ -1,210 +0,0 @@ -# NullableShape -org.openapijsonschematools.client.components.schemas.NullableShape.java -public class NullableShape
- -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 - -## Nested Class Summary -| Modifier and Type | Class and Description | -| ----------------- | ---------------------- | -| sealed interface | [NullableShape.NullableShape1Boxed](#nullableshape1boxed)
sealed interface for validated payloads | -| record | [NullableShape.NullableShape1BoxedVoid](#nullableshape1boxedvoid)
boxed class to store validated null payloads | -| record | [NullableShape.NullableShape1BoxedBoolean](#nullableshape1boxedboolean)
boxed class to store validated boolean payloads | -| record | [NullableShape.NullableShape1BoxedNumber](#nullableshape1boxednumber)
boxed class to store validated Number payloads | -| record | [NullableShape.NullableShape1BoxedString](#nullableshape1boxedstring)
boxed class to store validated String payloads | -| record | [NullableShape.NullableShape1BoxedList](#nullableshape1boxedlist)
boxed class to store validated List payloads | -| record | [NullableShape.NullableShape1BoxedMap](#nullableshape1boxedmap)
boxed class to store validated Map payloads | -| static class | [NullableShape.NullableShape1](#nullableshape1)
schema class | -| sealed interface | [NullableShape.Schema2Boxed](#schema2boxed)
sealed interface for validated payloads | -| record | [NullableShape.Schema2BoxedVoid](#schema2boxedvoid)
boxed class to store validated null payloads | -| static class | [NullableShape.Schema2](#schema2)
schema class | - -## NullableShape1Boxed -public sealed interface NullableShape1Boxed
-permits
-[NullableShape1BoxedVoid](#nullableshape1boxedvoid), -[NullableShape1BoxedBoolean](#nullableshape1boxedboolean), -[NullableShape1BoxedNumber](#nullableshape1boxednumber), -[NullableShape1BoxedString](#nullableshape1boxedstring), -[NullableShape1BoxedList](#nullableshape1boxedlist), -[NullableShape1BoxedMap](#nullableshape1boxedmap) - -sealed interface that stores validated payloads using boxed classes - -## NullableShape1BoxedVoid -public record NullableShape1BoxedVoid
-implements [NullableShape1Boxed](#nullableshape1boxed) - -record that stores validated null payloads, sealed permits implementation - -### Constructor Summary -| Constructor and Description | -| --------------------------- | -| NullableShape1BoxedVoid(Nothing? data)
Creates an instance, private visibility | - -### Method Summary -| Modifier and Type | Method and Description | -| ----------------- | ---------------------- | -| Nothing? | data()
validated payload | -| @Nullable Object | getData()
validated payload | - -## NullableShape1BoxedBoolean -public record NullableShape1BoxedBoolean
-implements [NullableShape1Boxed](#nullableshape1boxed) - -record that stores validated boolean payloads, sealed permits implementation - -### Constructor Summary -| Constructor and Description | -| --------------------------- | -| NullableShape1BoxedBoolean(boolean data)
Creates an instance, private visibility | - -### Method Summary -| Modifier and Type | Method and Description | -| ----------------- | ---------------------- | -| boolean | data()
validated payload | -| @Nullable Object | getData()
validated payload | - -## NullableShape1BoxedNumber -public record NullableShape1BoxedNumber
-implements [NullableShape1Boxed](#nullableshape1boxed) - -record that stores validated Number payloads, sealed permits implementation - -### Constructor Summary -| Constructor and Description | -| --------------------------- | -| NullableShape1BoxedNumber(Number data)
Creates an instance, private visibility | - -### Method Summary -| Modifier and Type | Method and Description | -| ----------------- | ---------------------- | -| Number | data()
validated payload | -| @Nullable Object | getData()
validated payload | - -## NullableShape1BoxedString -public record NullableShape1BoxedString
-implements [NullableShape1Boxed](#nullableshape1boxed) - -record that stores validated String payloads, sealed permits implementation - -### Constructor Summary -| Constructor and Description | -| --------------------------- | -| NullableShape1BoxedString(String data)
Creates an instance, private visibility | - -### Method Summary -| Modifier and Type | Method and Description | -| ----------------- | ---------------------- | -| String | data()
validated payload | -| @Nullable Object | getData()
validated payload | - -## NullableShape1BoxedList -public record NullableShape1BoxedList
-implements [NullableShape1Boxed](#nullableshape1boxed) - -record that stores validated List payloads, sealed permits implementation - -### Constructor Summary -| Constructor and Description | -| --------------------------- | -| NullableShape1BoxedList(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 | - -## NullableShape1BoxedMap -public record NullableShape1BoxedMap
-implements [NullableShape1Boxed](#nullableshape1boxed) - -record that stores validated Map payloads, sealed permits implementation - -### Constructor Summary -| Constructor and Description | -| --------------------------- | -| NullableShape1BoxedMap(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 | - -## NullableShape1 -public static class NullableShape1
-extends JsonSchema - -A schema class that validates payloads - -## Description -The value may be a shape or the 'null' value. For a composed schema to validate a null payload, one of its chosen oneOf schemas must be type null or nullable (introduced in OAS schema >= 3.0) - -### Field Summary -| Modifier and Type | Field and Description | -| ----------------- | ---------------------- | -| List> | oneOf = List.of(
    [Triangle.Triangle1.class](../../components/schemas/Triangle.md#triangle1),
    [Quadrilateral.Quadrilateral1.class](../../components/schemas/Quadrilateral.md#quadrilateral1),
    [Schema2.class](#schema2)
))
| - -### Method Summary -| Modifier and Type | Method and Description | -| ----------------- | ---------------------- | -| String | validate(String arg, SchemaConfiguration configuration) | -| Nothing? | validate(Nothing? arg, SchemaConfiguration configuration) | -| int | validate(int arg, SchemaConfiguration configuration) | -| long | validate(long arg, SchemaConfiguration configuration) | -| float | validate(float arg, SchemaConfiguration configuration) | -| double | validate(double arg, SchemaConfiguration configuration) | -| Number | validate(Number arg, SchemaConfiguration configuration) | -| boolean | validate(boolean arg, SchemaConfiguration configuration) | -| FrozenMap<@Nullable Object> | validate(Map<?, ?> arg, SchemaConfiguration configuration) | -| FrozenList<@Nullable Object> | validate(List arg, SchemaConfiguration configuration) | -| [NullableShape1BoxedString](#nullableshape1boxedstring) | validateAndBox(String arg, SchemaConfiguration configuration) | -| [NullableShape1BoxedVoid](#nullableshape1boxedvoid) | validateAndBox(Nothing? arg, SchemaConfiguration configuration) | -| [NullableShape1BoxedNumber](#nullableshape1boxednumber) | validateAndBox(Number arg, SchemaConfiguration configuration) | -| [NullableShape1BoxedBoolean](#nullableshape1boxedboolean) | validateAndBox(boolean arg, SchemaConfiguration configuration) | -| [NullableShape1BoxedMap](#nullableshape1boxedmap) | validateAndBox(Map<?, ?> arg, SchemaConfiguration configuration) | -| [NullableShape1BoxedList](#nullableshape1boxedlist) | validateAndBox(List arg, SchemaConfiguration configuration) | -| [NullableShape1Boxed](#nullableshape1boxed) | validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) | -| @Nullable Object | validate(@Nullable Object arg, SchemaConfiguration configuration) | - -## Schema2Boxed -public sealed interface Schema2Boxed
-permits
-[Schema2BoxedVoid](#schema2boxedvoid) - -sealed interface that stores validated payloads using boxed classes - -## Schema2BoxedVoid -public record Schema2BoxedVoid
-implements [Schema2Boxed](#schema2boxed) - -record that stores validated null payloads, sealed permits implementation - -### Constructor Summary -| Constructor and Description | -| --------------------------- | -| Schema2BoxedVoid(Nothing? data)
Creates an instance, private visibility | - -### Method Summary -| Modifier and Type | Method and Description | -| ----------------- | ---------------------- | -| Nothing? | data()
validated payload | -| @Nullable Object | getData()
validated payload | - -## Schema2 -public static class Schema2
-extends NullJsonSchema.NullJsonSchema1 - -A schema class that validates payloads - -| Methods Inherited from class org.openapijsonschematools.client.schemas.NullJsonSchema.NullJsonSchema1 | -| ------------------------------------------------------------------ | -| validate | -| validateAndBox | - -[[Back to top]](#top) [[Back to Component Schemas]](../../../README.md#Component-Schemas) [[Back to README]](../../../README.md) diff --git a/samples/client/petstore/kotlin/docs/components/schemas/NullableString.md b/samples/client/petstore/kotlin/docs/components/schemas/NullableString.md deleted file mode 100644 index d6d453c2b4b..00000000000 --- a/samples/client/petstore/kotlin/docs/components/schemas/NullableString.md +++ /dev/null @@ -1,110 +0,0 @@ -# NullableString -org.openapijsonschematools.client.components.schemas.NullableString.java -public class NullableString
- -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 - -## Nested Class Summary -| Modifier and Type | Class and Description | -| ----------------- | ---------------------- | -| sealed interface | [NullableString.NullableString1Boxed](#nullablestring1boxed)
sealed interface for validated payloads | -| record | [NullableString.NullableString1BoxedVoid](#nullablestring1boxedvoid)
boxed class to store validated null payloads | -| record | [NullableString.NullableString1BoxedString](#nullablestring1boxedstring)
boxed class to store validated String payloads | -| static class | [NullableString.NullableString1](#nullablestring1)
schema class | - -## NullableString1Boxed -public sealed interface NullableString1Boxed
-permits
-[NullableString1BoxedVoid](#nullablestring1boxedvoid), -[NullableString1BoxedString](#nullablestring1boxedstring) - -sealed interface that stores validated payloads using boxed classes - -## NullableString1BoxedVoid -public record NullableString1BoxedVoid
-implements [NullableString1Boxed](#nullablestring1boxed) - -record that stores validated null payloads, sealed permits implementation - -### Constructor Summary -| Constructor and Description | -| --------------------------- | -| NullableString1BoxedVoid(Nothing? data)
Creates an instance, private visibility | - -### Method Summary -| Modifier and Type | Method and Description | -| ----------------- | ---------------------- | -| Nothing? | data()
validated payload | -| @Nullable Object | getData()
validated payload | - -## NullableString1BoxedString -public record NullableString1BoxedString
-implements [NullableString1Boxed](#nullablestring1boxed) - -record that stores validated String payloads, sealed permits implementation - -### Constructor Summary -| Constructor and Description | -| --------------------------- | -| NullableString1BoxedString(String data)
Creates an instance, private visibility | - -### Method Summary -| Modifier and Type | Method and Description | -| ----------------- | ---------------------- | -| String | data()
validated payload | -| @Nullable Object | getData()
validated payload | - -## NullableString1 -public static class NullableString1
-extends JsonSchema - -A schema class that validates payloads - -### Code Sample -``` -import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags; -import org.openapijsonschematools.client.configurations.SchemaConfiguration; -import org.openapijsonschematools.client.exceptions.ValidationException; -import org.openapijsonschematools.client.schemas.validation.MapUtils; -import org.openapijsonschematools.client.schemas.validation.FrozenList; -import org.openapijsonschematools.client.schemas.validation.FrozenMap; -import org.openapijsonschematools.client.components.schemas.NullableString; - -import java.util.Arrays; -import java.util.List; -import java.util.AbstractMap; - -static final SchemaConfiguration configuration = new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().build()); - -// null validation -Nothing? validatedPayload = NullableString.NullableString1.validate( - (Nothing?) null, - configuration -); - -// String validation -String validatedPayload = NullableString.NullableString1.validate( - "a", - configuration -); -``` - -### Field Summary -| Modifier and Type | Field and Description | -| ----------------- | ---------------------- | -| Set> | type = Set.of(
    Nothing?.class,
    String.class
)
| - -### Method Summary -| Modifier and Type | Method and Description | -| ----------------- | ---------------------- | -| Nothing? | validate(Nothing? arg, SchemaConfiguration configuration) | -| [NullableString1BoxedVoid](#nullablestring1boxedvoid) | validateAndBox(Nothing? arg, SchemaConfiguration configuration) | -| String | validate(String arg, SchemaConfiguration configuration) | -| [NullableString1BoxedString](#nullablestring1boxedstring) | validateAndBox(String arg, SchemaConfiguration configuration) | -| [NullableString1Boxed](#nullablestring1boxed) | validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) | -| @Nullable Object | validate(@Nullable Object arg, SchemaConfiguration configuration) | - -[[Back to top]](#top) [[Back to Component Schemas]](../../../README.md#Component-Schemas) [[Back to README]](../../../README.md) diff --git a/samples/client/petstore/kotlin/docs/components/schemas/NumberOnly.md b/samples/client/petstore/kotlin/docs/components/schemas/NumberOnly.md deleted file mode 100644 index af57047d085..00000000000 --- a/samples/client/petstore/kotlin/docs/components/schemas/NumberOnly.md +++ /dev/null @@ -1,172 +0,0 @@ -# NumberOnly -org.openapijsonschematools.client.components.schemas.NumberOnly.java -public class NumberOnly
- -A class that contains necessary nested -- schema classes (which validate payloads), extends JsonSchema -- sealed interfaces which store validated payloads, java version of a sum type -- boxed classes which store validated payloads, sealed permits class implementations -- classes to store validated map payloads, extends FrozenMap -- classes to build inputs for map payloads - -## Nested Class Summary -| Modifier and Type | Class and Description | -| ----------------- | ---------------------- | -| sealed interface | [NumberOnly.NumberOnly1Boxed](#numberonly1boxed)
sealed interface for validated payloads | -| record | [NumberOnly.NumberOnly1BoxedMap](#numberonly1boxedmap)
boxed class to store validated Map payloads | -| static class | [NumberOnly.NumberOnly1](#numberonly1)
schema class | -| static class | [NumberOnly.NumberOnlyMapBuilder](#numberonlymapbuilder)
builder for Map payloads | -| static class | [NumberOnly.NumberOnlyMap](#numberonlymap)
output class for Map payloads | -| sealed interface | [NumberOnly.JustNumberBoxed](#justnumberboxed)
sealed interface for validated payloads | -| record | [NumberOnly.JustNumberBoxedNumber](#justnumberboxednumber)
boxed class to store validated Number payloads | -| static class | [NumberOnly.JustNumber](#justnumber)
schema class | - -## NumberOnly1Boxed -public sealed interface NumberOnly1Boxed
-permits
-[NumberOnly1BoxedMap](#numberonly1boxedmap) - -sealed interface that stores validated payloads using boxed classes - -## NumberOnly1BoxedMap -public record NumberOnly1BoxedMap
-implements [NumberOnly1Boxed](#numberonly1boxed) - -record that stores validated Map payloads, sealed permits implementation - -### Constructor Summary -| Constructor and Description | -| --------------------------- | -| NumberOnly1BoxedMap([NumberOnlyMap](#numberonlymap) data)
Creates an instance, private visibility | - -### Method Summary -| Modifier and Type | Method and Description | -| ----------------- | ---------------------- | -| [NumberOnlyMap](#numberonlymap) | data()
validated payload | -| @Nullable Object | getData()
validated payload | - -## NumberOnly1 -public static class NumberOnly1
-extends JsonSchema - -A schema class that validates payloads - -### Code Sample -``` -import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags; -import org.openapijsonschematools.client.configurations.SchemaConfiguration; -import org.openapijsonschematools.client.exceptions.ValidationException; -import org.openapijsonschematools.client.schemas.validation.MapUtils; -import org.openapijsonschematools.client.schemas.validation.FrozenList; -import org.openapijsonschematools.client.schemas.validation.FrozenMap; -import org.openapijsonschematools.client.components.schemas.NumberOnly; - -import java.util.Arrays; -import java.util.List; -import java.util.AbstractMap; - -static final SchemaConfiguration configuration = new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().build()); - -// Map validation -NumberOnly.NumberOnlyMap validatedPayload = - NumberOnly.NumberOnly1.validate( - new NumberOnly.NumberOnlyMapBuilder() - .JustNumber(1) - - .build(), - configuration -); -``` - -### Field Summary -| Modifier and Type | Field and Description | -| ----------------- | ---------------------- | -| Set> | type = Set.of(Map.class) | -| Map> | properties = Map.ofEntries(
    new PropertyEntry("JustNumber", [JustNumber.class](#justnumber)))
)
| - -### Method Summary -| Modifier and Type | Method and Description | -| ----------------- | ---------------------- | -| [NumberOnlyMap](#numberonlymap) | validate([Map<?, ?>](#numberonlymapbuilder) arg, SchemaConfiguration configuration) | -| [NumberOnly1BoxedMap](#numberonly1boxedmap) | validateAndBox([Map<?, ?>](#numberonlymapbuilder) arg, SchemaConfiguration configuration) | -| [NumberOnly1Boxed](#numberonly1boxed) | validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) | -| @Nullable Object | validate(@Nullable Object arg, SchemaConfiguration configuration) | - -## NumberOnlyMapBuilder -public class NumberOnlyMapBuilder
-builder for `Map` - -A class that builds the Map input type - -### Constructor Summary -| Constructor and Description | -| --------------------------- | -| NumberOnlyMapBuilder()
Creates a builder that contains an empty map | - -### Method Summary -| Modifier and Type | Method and Description | -| ----------------- | ---------------------- | -| Map | build()
Returns map input that should be used with Schema.validate | -| [NumberOnlyMapBuilder](#numberonlymapbuilder) | JustNumber(int value) | -| [NumberOnlyMapBuilder](#numberonlymapbuilder) | JustNumber(float value) | -| [NumberOnlyMapBuilder](#numberonlymapbuilder) | JustNumber(long value) | -| [NumberOnlyMapBuilder](#numberonlymapbuilder) | JustNumber(double value) | -| [NumberOnlyMapBuilder](#numberonlymapbuilder) | additionalProperty(String key, Nothing? value) | -| [NumberOnlyMapBuilder](#numberonlymapbuilder) | additionalProperty(String key, boolean value) | -| [NumberOnlyMapBuilder](#numberonlymapbuilder) | additionalProperty(String key, String value) | -| [NumberOnlyMapBuilder](#numberonlymapbuilder) | additionalProperty(String key, int value) | -| [NumberOnlyMapBuilder](#numberonlymapbuilder) | additionalProperty(String key, float value) | -| [NumberOnlyMapBuilder](#numberonlymapbuilder) | additionalProperty(String key, long value) | -| [NumberOnlyMapBuilder](#numberonlymapbuilder) | additionalProperty(String key, double value) | -| [NumberOnlyMapBuilder](#numberonlymapbuilder) | additionalProperty(String key, List value) | -| [NumberOnlyMapBuilder](#numberonlymapbuilder) | additionalProperty(String key, Map value) | - -## NumberOnlyMap -public static class NumberOnlyMap
-extends FrozenMap - -A class to store validated Map payloads - -### Method Summary -| Modifier and Type | Method and Description | -| ----------------- | ---------------------- | -| static [NumberOnlyMap](#numberonlymap) | of([Map](#numberonlymapbuilder) arg, SchemaConfiguration configuration) | -| Number | JustNumber()
[optional] | -| @Nullable Object | getAdditionalProperty(String name)
provides type safety for additional properties | - -## JustNumberBoxed -public sealed interface JustNumberBoxed
-permits
-[JustNumberBoxedNumber](#justnumberboxednumber) - -sealed interface that stores validated payloads using boxed classes - -## JustNumberBoxedNumber -public record JustNumberBoxedNumber
-implements [JustNumberBoxed](#justnumberboxed) - -record that stores validated Number payloads, sealed permits implementation - -### Constructor Summary -| Constructor and Description | -| --------------------------- | -| JustNumberBoxedNumber(Number data)
Creates an instance, private visibility | - -### Method Summary -| Modifier and Type | Method and Description | -| ----------------- | ---------------------- | -| Number | data()
validated payload | -| @Nullable Object | getData()
validated payload | - -## JustNumber -public static class JustNumber
-extends NumberJsonSchema.NumberJsonSchema1 - -A schema class that validates payloads - -| Methods Inherited from class org.openapijsonschematools.client.schemas.NumberJsonSchema.NumberJsonSchema1 | -| ------------------------------------------------------------------ | -| validate | -| validateAndBox | - -[[Back to top]](#top) [[Back to Component Schemas]](../../../README.md#Component-Schemas) [[Back to README]](../../../README.md) diff --git a/samples/client/petstore/kotlin/docs/components/schemas/NumberSchema.md b/samples/client/petstore/kotlin/docs/components/schemas/NumberSchema.md deleted file mode 100644 index 8ebd5d4cb08..00000000000 --- a/samples/client/petstore/kotlin/docs/components/schemas/NumberSchema.md +++ /dev/null @@ -1,52 +0,0 @@ -# NumberSchema -org.openapijsonschematools.client.components.schemas.NumberSchema.java -public class NumberSchema
- -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 - -## Nested Class Summary -| Modifier and Type | Class and Description | -| ----------------- | ---------------------- | -| sealed interface | [NumberSchema.NumberSchema1Boxed](#numberschema1boxed)
sealed interface for validated payloads | -| record | [NumberSchema.NumberSchema1BoxedNumber](#numberschema1boxednumber)
boxed class to store validated Number payloads | -| static class | [NumberSchema.NumberSchema1](#numberschema1)
schema class | - -## NumberSchema1Boxed -public sealed interface NumberSchema1Boxed
-permits
-[NumberSchema1BoxedNumber](#numberschema1boxednumber) - -sealed interface that stores validated payloads using boxed classes - -## NumberSchema1BoxedNumber -public record NumberSchema1BoxedNumber
-implements [NumberSchema1Boxed](#numberschema1boxed) - -record that stores validated Number payloads, sealed permits implementation - -### Constructor Summary -| Constructor and Description | -| --------------------------- | -| NumberSchema1BoxedNumber(Number data)
Creates an instance, private visibility | - -### Method Summary -| Modifier and Type | Method and Description | -| ----------------- | ---------------------- | -| Number | data()
validated payload | -| @Nullable Object | getData()
validated payload | - -## NumberSchema1 -public static class NumberSchema1
-extends NumberJsonSchema.NumberJsonSchema1 - -A schema class that validates payloads - -| Methods Inherited from class org.openapijsonschematools.client.schemas.NumberJsonSchema.NumberJsonSchema1 | -| ------------------------------------------------------------------ | -| validate | -| validateAndBox | - -[[Back to top]](#top) [[Back to Component Schemas]](../../../README.md#Component-Schemas) [[Back to README]](../../../README.md) diff --git a/samples/client/petstore/kotlin/docs/components/schemas/NumberWithExclusiveMinMax.md b/samples/client/petstore/kotlin/docs/components/schemas/NumberWithExclusiveMinMax.md deleted file mode 100644 index 56bd0585554..00000000000 --- a/samples/client/petstore/kotlin/docs/components/schemas/NumberWithExclusiveMinMax.md +++ /dev/null @@ -1,85 +0,0 @@ -# NumberWithExclusiveMinMax -org.openapijsonschematools.client.components.schemas.NumberWithExclusiveMinMax.java -public class NumberWithExclusiveMinMax
- -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 - -## Nested Class Summary -| Modifier and Type | Class and Description | -| ----------------- | ---------------------- | -| sealed interface | [NumberWithExclusiveMinMax.NumberWithExclusiveMinMax1Boxed](#numberwithexclusiveminmax1boxed)
sealed interface for validated payloads | -| record | [NumberWithExclusiveMinMax.NumberWithExclusiveMinMax1BoxedNumber](#numberwithexclusiveminmax1boxednumber)
boxed class to store validated Number payloads | -| static class | [NumberWithExclusiveMinMax.NumberWithExclusiveMinMax1](#numberwithexclusiveminmax1)
schema class | - -## NumberWithExclusiveMinMax1Boxed -public sealed interface NumberWithExclusiveMinMax1Boxed
-permits
-[NumberWithExclusiveMinMax1BoxedNumber](#numberwithexclusiveminmax1boxednumber) - -sealed interface that stores validated payloads using boxed classes - -## NumberWithExclusiveMinMax1BoxedNumber -public record NumberWithExclusiveMinMax1BoxedNumber
-implements [NumberWithExclusiveMinMax1Boxed](#numberwithexclusiveminmax1boxed) - -record that stores validated Number payloads, sealed permits implementation - -### Constructor Summary -| Constructor and Description | -| --------------------------- | -| NumberWithExclusiveMinMax1BoxedNumber(Number data)
Creates an instance, private visibility | - -### Method Summary -| Modifier and Type | Method and Description | -| ----------------- | ---------------------- | -| Number | data()
validated payload | -| @Nullable Object | getData()
validated payload | - -## NumberWithExclusiveMinMax1 -public static class NumberWithExclusiveMinMax1
-extends JsonSchema - -A schema class that validates payloads - -### Code Sample -``` -import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags; -import org.openapijsonschematools.client.configurations.SchemaConfiguration; -import org.openapijsonschematools.client.exceptions.ValidationException; -import org.openapijsonschematools.client.schemas.validation.MapUtils; -import org.openapijsonschematools.client.schemas.validation.FrozenList; -import org.openapijsonschematools.client.schemas.validation.FrozenMap; -import org.openapijsonschematools.client.components.schemas.NumberWithExclusiveMinMax; - -import java.util.Arrays; -import java.util.List; -import java.util.AbstractMap; - -static final SchemaConfiguration configuration = new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().build()); - -// int validation -int validatedPayload = NumberWithExclusiveMinMax.NumberWithExclusiveMinMax1.validate( - 1, - configuration -); -``` - -### Field Summary -| Modifier and Type | Field and Description | -| ----------------- | ---------------------- | -| Set> | type = Set.of(
    Integer.class,
    Long.class,
    Float.class,
    Double.class
)
| -| Number | exclusiveMaximum = 12 | -| Number | exclusiveMinimum = 10 | - -### Method Summary -| Modifier and Type | Method and Description | -| ----------------- | ---------------------- | -| Number | validate(Number arg, SchemaConfiguration configuration) | -| [NumberWithExclusiveMinMax1BoxedNumber](#numberwithexclusiveminmax1boxednumber) | validateAndBox(Number arg, SchemaConfiguration configuration) | -| [NumberWithExclusiveMinMax1Boxed](#numberwithexclusiveminmax1boxed) | validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) | -| @Nullable Object | validate(@Nullable Object arg, SchemaConfiguration configuration) | - -[[Back to top]](#top) [[Back to Component Schemas]](../../../README.md#Component-Schemas) [[Back to README]](../../../README.md) diff --git a/samples/client/petstore/kotlin/docs/components/schemas/NumberWithValidations.md b/samples/client/petstore/kotlin/docs/components/schemas/NumberWithValidations.md deleted file mode 100644 index 9741c1e3df3..00000000000 --- a/samples/client/petstore/kotlin/docs/components/schemas/NumberWithValidations.md +++ /dev/null @@ -1,85 +0,0 @@ -# NumberWithValidations -org.openapijsonschematools.client.components.schemas.NumberWithValidations.java -public class NumberWithValidations
- -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 - -## Nested Class Summary -| Modifier and Type | Class and Description | -| ----------------- | ---------------------- | -| sealed interface | [NumberWithValidations.NumberWithValidations1Boxed](#numberwithvalidations1boxed)
sealed interface for validated payloads | -| record | [NumberWithValidations.NumberWithValidations1BoxedNumber](#numberwithvalidations1boxednumber)
boxed class to store validated Number payloads | -| static class | [NumberWithValidations.NumberWithValidations1](#numberwithvalidations1)
schema class | - -## NumberWithValidations1Boxed -public sealed interface NumberWithValidations1Boxed
-permits
-[NumberWithValidations1BoxedNumber](#numberwithvalidations1boxednumber) - -sealed interface that stores validated payloads using boxed classes - -## NumberWithValidations1BoxedNumber -public record NumberWithValidations1BoxedNumber
-implements [NumberWithValidations1Boxed](#numberwithvalidations1boxed) - -record that stores validated Number payloads, sealed permits implementation - -### Constructor Summary -| Constructor and Description | -| --------------------------- | -| NumberWithValidations1BoxedNumber(Number data)
Creates an instance, private visibility | - -### Method Summary -| Modifier and Type | Method and Description | -| ----------------- | ---------------------- | -| Number | data()
validated payload | -| @Nullable Object | getData()
validated payload | - -## NumberWithValidations1 -public static class NumberWithValidations1
-extends JsonSchema - -A schema class that validates payloads - -### Code Sample -``` -import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags; -import org.openapijsonschematools.client.configurations.SchemaConfiguration; -import org.openapijsonschematools.client.exceptions.ValidationException; -import org.openapijsonschematools.client.schemas.validation.MapUtils; -import org.openapijsonschematools.client.schemas.validation.FrozenList; -import org.openapijsonschematools.client.schemas.validation.FrozenMap; -import org.openapijsonschematools.client.components.schemas.NumberWithValidations; - -import java.util.Arrays; -import java.util.List; -import java.util.AbstractMap; - -static final SchemaConfiguration configuration = new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().build()); - -// int validation -int validatedPayload = NumberWithValidations.NumberWithValidations1.validate( - 1, - configuration -); -``` - -### Field Summary -| Modifier and Type | Field and Description | -| ----------------- | ---------------------- | -| Set> | type = Set.of(
    Integer.class,
    Long.class,
    Float.class,
    Double.class
)
| -| Number | maximum = 20 | -| Number | minimum = 10 | - -### Method Summary -| Modifier and Type | Method and Description | -| ----------------- | ---------------------- | -| Number | validate(Number arg, SchemaConfiguration configuration) | -| [NumberWithValidations1BoxedNumber](#numberwithvalidations1boxednumber) | validateAndBox(Number arg, SchemaConfiguration configuration) | -| [NumberWithValidations1Boxed](#numberwithvalidations1boxed) | validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) | -| @Nullable Object | validate(@Nullable Object arg, SchemaConfiguration configuration) | - -[[Back to top]](#top) [[Back to Component Schemas]](../../../README.md#Component-Schemas) [[Back to README]](../../../README.md) diff --git a/samples/client/petstore/kotlin/docs/components/schemas/ObjWithRequiredProps.md b/samples/client/petstore/kotlin/docs/components/schemas/ObjWithRequiredProps.md deleted file mode 100644 index 666774be2de..00000000000 --- a/samples/client/petstore/kotlin/docs/components/schemas/ObjWithRequiredProps.md +++ /dev/null @@ -1,186 +0,0 @@ -# ObjWithRequiredProps -org.openapijsonschematools.client.components.schemas.ObjWithRequiredProps.java -public class ObjWithRequiredProps
- -A class that contains necessary nested -- schema classes (which validate payloads), extends JsonSchema -- sealed interfaces which store validated payloads, java version of a sum type -- boxed classes which store validated payloads, sealed permits class implementations -- classes to store validated map payloads, extends FrozenMap -- classes to build inputs for map payloads - -## Nested Class Summary -| Modifier and Type | Class and Description | -| ----------------- | ---------------------- | -| sealed interface | [ObjWithRequiredProps.ObjWithRequiredProps1Boxed](#objwithrequiredprops1boxed)
sealed interface for validated payloads | -| record | [ObjWithRequiredProps.ObjWithRequiredProps1BoxedMap](#objwithrequiredprops1boxedmap)
boxed class to store validated Map payloads | -| static class | [ObjWithRequiredProps.ObjWithRequiredProps1](#objwithrequiredprops1)
schema class | -| static class | [ObjWithRequiredProps.ObjWithRequiredPropsMapBuilder](#objwithrequiredpropsmapbuilder)
builder for Map payloads | -| static class | [ObjWithRequiredProps.ObjWithRequiredPropsMap](#objwithrequiredpropsmap)
output class for Map payloads | -| sealed interface | [ObjWithRequiredProps.ABoxed](#aboxed)
sealed interface for validated payloads | -| record | [ObjWithRequiredProps.ABoxedString](#aboxedstring)
boxed class to store validated String payloads | -| static class | [ObjWithRequiredProps.A](#a)
schema class | - -## ObjWithRequiredProps1Boxed -public sealed interface ObjWithRequiredProps1Boxed
-permits
-[ObjWithRequiredProps1BoxedMap](#objwithrequiredprops1boxedmap) - -sealed interface that stores validated payloads using boxed classes - -## ObjWithRequiredProps1BoxedMap -public record ObjWithRequiredProps1BoxedMap
-implements [ObjWithRequiredProps1Boxed](#objwithrequiredprops1boxed) - -record that stores validated Map payloads, sealed permits implementation - -### Constructor Summary -| Constructor and Description | -| --------------------------- | -| ObjWithRequiredProps1BoxedMap([ObjWithRequiredPropsMap](#objwithrequiredpropsmap) data)
Creates an instance, private visibility | - -### Method Summary -| Modifier and Type | Method and Description | -| ----------------- | ---------------------- | -| [ObjWithRequiredPropsMap](#objwithrequiredpropsmap) | data()
validated payload | -| @Nullable Object | getData()
validated payload | - -## ObjWithRequiredProps1 -public static class ObjWithRequiredProps1
-extends JsonSchema - -A schema class that validates payloads - -### Code Sample -``` -import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags; -import org.openapijsonschematools.client.configurations.SchemaConfiguration; -import org.openapijsonschematools.client.exceptions.ValidationException; -import org.openapijsonschematools.client.schemas.validation.MapUtils; -import org.openapijsonschematools.client.schemas.validation.FrozenList; -import org.openapijsonschematools.client.schemas.validation.FrozenMap; -import org.openapijsonschematools.client.components.schemas.ObjWithRequiredProps; - -import java.util.Arrays; -import java.util.List; -import java.util.AbstractMap; - -static final SchemaConfiguration configuration = new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().build()); - -// Map validation -ObjWithRequiredProps.ObjWithRequiredPropsMap validatedPayload = - ObjWithRequiredProps.ObjWithRequiredProps1.validate( - new ObjWithRequiredProps.ObjWithRequiredPropsMapBuilder() - .a("a") - - .build(), - configuration -); -``` - -### Field Summary -| Modifier and Type | Field and Description | -| ----------------- | ---------------------- | -| Set> | type = Set.of(Map.class) | -| Map> | properties = Map.ofEntries(
    new PropertyEntry("a", [A.class](#a)))
)
| -| Set | required = Set.of(
    "a"
)
| -| List> | allOf = List.of(
    [ObjWithRequiredPropsBase.ObjWithRequiredPropsBase1.class](../../components/schemas/ObjWithRequiredPropsBase.md#objwithrequiredpropsbase1)
;)
| - -### Method Summary -| Modifier and Type | Method and Description | -| ----------------- | ---------------------- | -| [ObjWithRequiredPropsMap](#objwithrequiredpropsmap) | validate([Map<?, ?>](#objwithrequiredpropsmapbuilder) arg, SchemaConfiguration configuration) | -| [ObjWithRequiredProps1BoxedMap](#objwithrequiredprops1boxedmap) | validateAndBox([Map<?, ?>](#objwithrequiredpropsmapbuilder) arg, SchemaConfiguration configuration) | -| [ObjWithRequiredProps1Boxed](#objwithrequiredprops1boxed) | validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) | -| @Nullable Object | validate(@Nullable Object arg, SchemaConfiguration configuration) | - -## ObjWithRequiredPropsMap0Builder -public class ObjWithRequiredPropsMap0Builder
-builder for `Map` - -A class that builds the Map input type - -### Constructor Summary -| Constructor and Description | -| --------------------------- | -| ObjWithRequiredPropsMap0Builder(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 | -| [ObjWithRequiredPropsMap0Builder](#objwithrequiredpropsmap0builder) | additionalProperty(String key, Nothing? value) | -| [ObjWithRequiredPropsMap0Builder](#objwithrequiredpropsmap0builder) | additionalProperty(String key, boolean value) | -| [ObjWithRequiredPropsMap0Builder](#objwithrequiredpropsmap0builder) | additionalProperty(String key, String value) | -| [ObjWithRequiredPropsMap0Builder](#objwithrequiredpropsmap0builder) | additionalProperty(String key, int value) | -| [ObjWithRequiredPropsMap0Builder](#objwithrequiredpropsmap0builder) | additionalProperty(String key, float value) | -| [ObjWithRequiredPropsMap0Builder](#objwithrequiredpropsmap0builder) | additionalProperty(String key, long value) | -| [ObjWithRequiredPropsMap0Builder](#objwithrequiredpropsmap0builder) | additionalProperty(String key, double value) | -| [ObjWithRequiredPropsMap0Builder](#objwithrequiredpropsmap0builder) | additionalProperty(String key, List value) | -| [ObjWithRequiredPropsMap0Builder](#objwithrequiredpropsmap0builder) | additionalProperty(String key, Map value) | - -## ObjWithRequiredPropsMapBuilder -public class ObjWithRequiredPropsMapBuilder
-builder for `Map` - -A class that builds the Map input type - -### Constructor Summary -| Constructor and Description | -| --------------------------- | -| ObjWithRequiredPropsMapBuilder()
Creates a builder that contains an empty map | - -### Method Summary -| Modifier and Type | Method and Description | -| ----------------- | ---------------------- | -| [ObjWithRequiredPropsMap0Builder](#objwithrequiredpropsmap0builder) | a(String value) | - -## ObjWithRequiredPropsMap -public static class ObjWithRequiredPropsMap
-extends FrozenMap - -A class to store validated Map payloads - -### Method Summary -| Modifier and Type | Method and Description | -| ----------------- | ---------------------- | -| static [ObjWithRequiredPropsMap](#objwithrequiredpropsmap) | of([Map](#objwithrequiredpropsmapbuilder) arg, SchemaConfiguration configuration) | -| String | a()
| -| @Nullable Object | getAdditionalProperty(String name)
provides type safety for additional properties | - -## ABoxed -public sealed interface ABoxed
-permits
-[ABoxedString](#aboxedstring) - -sealed interface that stores validated payloads using boxed classes - -## ABoxedString -public record ABoxedString
-implements [ABoxed](#aboxed) - -record that stores validated String payloads, sealed permits implementation - -### Constructor Summary -| Constructor and Description | -| --------------------------- | -| ABoxedString(String data)
Creates an instance, private visibility | - -### Method Summary -| Modifier and Type | Method and Description | -| ----------------- | ---------------------- | -| String | data()
validated payload | -| @Nullable Object | getData()
validated payload | - -## A -public static class A
-extends StringJsonSchema.StringJsonSchema1 - -A schema class that validates payloads - -| Methods Inherited from class org.openapijsonschematools.client.schemas.StringJsonSchema.StringJsonSchema1 | -| ------------------------------------------------------------------ | -| validate | -| validateAndBox | - -[[Back to top]](#top) [[Back to Component Schemas]](../../../README.md#Component-Schemas) [[Back to README]](../../../README.md) diff --git a/samples/client/petstore/kotlin/docs/components/schemas/ObjWithRequiredPropsBase.md b/samples/client/petstore/kotlin/docs/components/schemas/ObjWithRequiredPropsBase.md deleted file mode 100644 index e08d48bff09..00000000000 --- a/samples/client/petstore/kotlin/docs/components/schemas/ObjWithRequiredPropsBase.md +++ /dev/null @@ -1,185 +0,0 @@ -# ObjWithRequiredPropsBase -org.openapijsonschematools.client.components.schemas.ObjWithRequiredPropsBase.java -public class ObjWithRequiredPropsBase
- -A class that contains necessary nested -- schema classes (which validate payloads), extends JsonSchema -- sealed interfaces which store validated payloads, java version of a sum type -- boxed classes which store validated payloads, sealed permits class implementations -- classes to store validated map payloads, extends FrozenMap -- classes to build inputs for map payloads - -## Nested Class Summary -| Modifier and Type | Class and Description | -| ----------------- | ---------------------- | -| sealed interface | [ObjWithRequiredPropsBase.ObjWithRequiredPropsBase1Boxed](#objwithrequiredpropsbase1boxed)
sealed interface for validated payloads | -| record | [ObjWithRequiredPropsBase.ObjWithRequiredPropsBase1BoxedMap](#objwithrequiredpropsbase1boxedmap)
boxed class to store validated Map payloads | -| static class | [ObjWithRequiredPropsBase.ObjWithRequiredPropsBase1](#objwithrequiredpropsbase1)
schema class | -| static class | [ObjWithRequiredPropsBase.ObjWithRequiredPropsBaseMapBuilder](#objwithrequiredpropsbasemapbuilder)
builder for Map payloads | -| static class | [ObjWithRequiredPropsBase.ObjWithRequiredPropsBaseMap](#objwithrequiredpropsbasemap)
output class for Map payloads | -| sealed interface | [ObjWithRequiredPropsBase.BBoxed](#bboxed)
sealed interface for validated payloads | -| record | [ObjWithRequiredPropsBase.BBoxedString](#bboxedstring)
boxed class to store validated String payloads | -| static class | [ObjWithRequiredPropsBase.B](#b)
schema class | - -## ObjWithRequiredPropsBase1Boxed -public sealed interface ObjWithRequiredPropsBase1Boxed
-permits
-[ObjWithRequiredPropsBase1BoxedMap](#objwithrequiredpropsbase1boxedmap) - -sealed interface that stores validated payloads using boxed classes - -## ObjWithRequiredPropsBase1BoxedMap -public record ObjWithRequiredPropsBase1BoxedMap
-implements [ObjWithRequiredPropsBase1Boxed](#objwithrequiredpropsbase1boxed) - -record that stores validated Map payloads, sealed permits implementation - -### Constructor Summary -| Constructor and Description | -| --------------------------- | -| ObjWithRequiredPropsBase1BoxedMap([ObjWithRequiredPropsBaseMap](#objwithrequiredpropsbasemap) data)
Creates an instance, private visibility | - -### Method Summary -| Modifier and Type | Method and Description | -| ----------------- | ---------------------- | -| [ObjWithRequiredPropsBaseMap](#objwithrequiredpropsbasemap) | data()
validated payload | -| @Nullable Object | getData()
validated payload | - -## ObjWithRequiredPropsBase1 -public static class ObjWithRequiredPropsBase1
-extends JsonSchema - -A schema class that validates payloads - -### Code Sample -``` -import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags; -import org.openapijsonschematools.client.configurations.SchemaConfiguration; -import org.openapijsonschematools.client.exceptions.ValidationException; -import org.openapijsonschematools.client.schemas.validation.MapUtils; -import org.openapijsonschematools.client.schemas.validation.FrozenList; -import org.openapijsonschematools.client.schemas.validation.FrozenMap; -import org.openapijsonschematools.client.components.schemas.ObjWithRequiredPropsBase; - -import java.util.Arrays; -import java.util.List; -import java.util.AbstractMap; - -static final SchemaConfiguration configuration = new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().build()); - -// Map validation -ObjWithRequiredPropsBase.ObjWithRequiredPropsBaseMap validatedPayload = - ObjWithRequiredPropsBase.ObjWithRequiredPropsBase1.validate( - new ObjWithRequiredPropsBase.ObjWithRequiredPropsBaseMapBuilder() - .b("a") - - .build(), - configuration -); -``` - -### Field Summary -| Modifier and Type | Field and Description | -| ----------------- | ---------------------- | -| Set> | type = Set.of(Map.class) | -| Map> | properties = Map.ofEntries(
    new PropertyEntry("b", [B.class](#b)))
)
| -| Set | required = Set.of(
    "b"
)
| - -### Method Summary -| Modifier and Type | Method and Description | -| ----------------- | ---------------------- | -| [ObjWithRequiredPropsBaseMap](#objwithrequiredpropsbasemap) | validate([Map<?, ?>](#objwithrequiredpropsbasemapbuilder) arg, SchemaConfiguration configuration) | -| [ObjWithRequiredPropsBase1BoxedMap](#objwithrequiredpropsbase1boxedmap) | validateAndBox([Map<?, ?>](#objwithrequiredpropsbasemapbuilder) arg, SchemaConfiguration configuration) | -| [ObjWithRequiredPropsBase1Boxed](#objwithrequiredpropsbase1boxed) | validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) | -| @Nullable Object | validate(@Nullable Object arg, SchemaConfiguration configuration) | - -## ObjWithRequiredPropsBaseMap0Builder -public class ObjWithRequiredPropsBaseMap0Builder
-builder for `Map` - -A class that builds the Map input type - -### Constructor Summary -| Constructor and Description | -| --------------------------- | -| ObjWithRequiredPropsBaseMap0Builder(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 | -| [ObjWithRequiredPropsBaseMap0Builder](#objwithrequiredpropsbasemap0builder) | additionalProperty(String key, Nothing? value) | -| [ObjWithRequiredPropsBaseMap0Builder](#objwithrequiredpropsbasemap0builder) | additionalProperty(String key, boolean value) | -| [ObjWithRequiredPropsBaseMap0Builder](#objwithrequiredpropsbasemap0builder) | additionalProperty(String key, String value) | -| [ObjWithRequiredPropsBaseMap0Builder](#objwithrequiredpropsbasemap0builder) | additionalProperty(String key, int value) | -| [ObjWithRequiredPropsBaseMap0Builder](#objwithrequiredpropsbasemap0builder) | additionalProperty(String key, float value) | -| [ObjWithRequiredPropsBaseMap0Builder](#objwithrequiredpropsbasemap0builder) | additionalProperty(String key, long value) | -| [ObjWithRequiredPropsBaseMap0Builder](#objwithrequiredpropsbasemap0builder) | additionalProperty(String key, double value) | -| [ObjWithRequiredPropsBaseMap0Builder](#objwithrequiredpropsbasemap0builder) | additionalProperty(String key, List value) | -| [ObjWithRequiredPropsBaseMap0Builder](#objwithrequiredpropsbasemap0builder) | additionalProperty(String key, Map value) | - -## ObjWithRequiredPropsBaseMapBuilder -public class ObjWithRequiredPropsBaseMapBuilder
-builder for `Map` - -A class that builds the Map input type - -### Constructor Summary -| Constructor and Description | -| --------------------------- | -| ObjWithRequiredPropsBaseMapBuilder()
Creates a builder that contains an empty map | - -### Method Summary -| Modifier and Type | Method and Description | -| ----------------- | ---------------------- | -| [ObjWithRequiredPropsBaseMap0Builder](#objwithrequiredpropsbasemap0builder) | b(String value) | - -## ObjWithRequiredPropsBaseMap -public static class ObjWithRequiredPropsBaseMap
-extends FrozenMap - -A class to store validated Map payloads - -### Method Summary -| Modifier and Type | Method and Description | -| ----------------- | ---------------------- | -| static [ObjWithRequiredPropsBaseMap](#objwithrequiredpropsbasemap) | of([Map](#objwithrequiredpropsbasemapbuilder) arg, SchemaConfiguration configuration) | -| String | b()
| -| @Nullable Object | getAdditionalProperty(String name)
provides type safety for additional properties | - -## BBoxed -public sealed interface BBoxed
-permits
-[BBoxedString](#bboxedstring) - -sealed interface that stores validated payloads using boxed classes - -## BBoxedString -public record BBoxedString
-implements [BBoxed](#bboxed) - -record that stores validated String payloads, sealed permits implementation - -### Constructor Summary -| Constructor and Description | -| --------------------------- | -| BBoxedString(String data)
Creates an instance, private visibility | - -### Method Summary -| Modifier and Type | Method and Description | -| ----------------- | ---------------------- | -| String | data()
validated payload | -| @Nullable Object | getData()
validated payload | - -## B -public static class B
-extends StringJsonSchema.StringJsonSchema1 - -A schema class that validates payloads - -| Methods Inherited from class org.openapijsonschematools.client.schemas.StringJsonSchema.StringJsonSchema1 | -| ------------------------------------------------------------------ | -| validate | -| validateAndBox | - -[[Back to top]](#top) [[Back to Component Schemas]](../../../README.md#Component-Schemas) [[Back to README]](../../../README.md) diff --git a/samples/client/petstore/kotlin/docs/components/schemas/ObjectInterface.md b/samples/client/petstore/kotlin/docs/components/schemas/ObjectInterface.md deleted file mode 100644 index b838c721b58..00000000000 --- a/samples/client/petstore/kotlin/docs/components/schemas/ObjectInterface.md +++ /dev/null @@ -1,52 +0,0 @@ -# ObjectInterface -org.openapijsonschematools.client.components.schemas.ObjectInterface.java -public class ObjectInterface
- -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 - -## Nested Class Summary -| Modifier and Type | Class and Description | -| ----------------- | ---------------------- | -| sealed interface | [ObjectInterface.ObjectInterface1Boxed](#objectinterface1boxed)
sealed interface for validated payloads | -| record | [ObjectInterface.ObjectInterface1BoxedMap](#objectinterface1boxedmap)
boxed class to store validated Map payloads | -| static class | [ObjectInterface.ObjectInterface1](#objectinterface1)
schema class | - -## ObjectInterface1Boxed -public sealed interface ObjectInterface1Boxed
-permits
-[ObjectInterface1BoxedMap](#objectinterface1boxedmap) - -sealed interface that stores validated payloads using boxed classes - -## ObjectInterface1BoxedMap -public record ObjectInterface1BoxedMap
-implements [ObjectInterface1Boxed](#objectinterface1boxed) - -record that stores validated Map payloads, sealed permits implementation - -### Constructor Summary -| Constructor and Description | -| --------------------------- | -| ObjectInterface1BoxedMap(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 | - -## ObjectInterface1 -public static class ObjectInterface1
-extends MapJsonSchema.MapJsonSchema1 - -A schema class that validates payloads - -| Methods Inherited from class org.openapijsonschematools.client.schemas.MapJsonSchema.MapJsonSchema1 | -| ------------------------------------------------------------------ | -| validate | -| validateAndBox | - -[[Back to top]](#top) [[Back to Component Schemas]](../../../README.md#Component-Schemas) [[Back to README]](../../../README.md) diff --git a/samples/client/petstore/kotlin/docs/components/schemas/ObjectModelWithArgAndArgsProperties.md b/samples/client/petstore/kotlin/docs/components/schemas/ObjectModelWithArgAndArgsProperties.md deleted file mode 100644 index ebe6eb02a3f..00000000000 --- a/samples/client/petstore/kotlin/docs/components/schemas/ObjectModelWithArgAndArgsProperties.md +++ /dev/null @@ -1,259 +0,0 @@ -# ObjectModelWithArgAndArgsProperties -org.openapijsonschematools.client.components.schemas.ObjectModelWithArgAndArgsProperties.java -public class ObjectModelWithArgAndArgsProperties
- -A class that contains necessary nested -- schema classes (which validate payloads), extends JsonSchema -- sealed interfaces which store validated payloads, java version of a sum type -- boxed classes which store validated payloads, sealed permits class implementations -- classes to store validated map payloads, extends FrozenMap -- classes to build inputs for map payloads - -## Nested Class Summary -| Modifier and Type | Class and Description | -| ----------------- | ---------------------- | -| sealed interface | [ObjectModelWithArgAndArgsProperties.ObjectModelWithArgAndArgsProperties1Boxed](#objectmodelwithargandargsproperties1boxed)
sealed interface for validated payloads | -| record | [ObjectModelWithArgAndArgsProperties.ObjectModelWithArgAndArgsProperties1BoxedMap](#objectmodelwithargandargsproperties1boxedmap)
boxed class to store validated Map payloads | -| static class | [ObjectModelWithArgAndArgsProperties.ObjectModelWithArgAndArgsProperties1](#objectmodelwithargandargsproperties1)
schema class | -| static class | [ObjectModelWithArgAndArgsProperties.ObjectModelWithArgAndArgsPropertiesMapBuilder](#objectmodelwithargandargspropertiesmapbuilder)
builder for Map payloads | -| static class | [ObjectModelWithArgAndArgsProperties.ObjectModelWithArgAndArgsPropertiesMap](#objectmodelwithargandargspropertiesmap)
output class for Map payloads | -| sealed interface | [ObjectModelWithArgAndArgsProperties.ArgsBoxed](#argsboxed)
sealed interface for validated payloads | -| record | [ObjectModelWithArgAndArgsProperties.ArgsBoxedString](#argsboxedstring)
boxed class to store validated String payloads | -| static class | [ObjectModelWithArgAndArgsProperties.Args](#args)
schema class | -| sealed interface | [ObjectModelWithArgAndArgsProperties.ArgBoxed](#argboxed)
sealed interface for validated payloads | -| record | [ObjectModelWithArgAndArgsProperties.ArgBoxedString](#argboxedstring)
boxed class to store validated String payloads | -| static class | [ObjectModelWithArgAndArgsProperties.Arg](#arg)
schema class | - -## ObjectModelWithArgAndArgsProperties1Boxed -public sealed interface ObjectModelWithArgAndArgsProperties1Boxed
-permits
-[ObjectModelWithArgAndArgsProperties1BoxedMap](#objectmodelwithargandargsproperties1boxedmap) - -sealed interface that stores validated payloads using boxed classes - -## ObjectModelWithArgAndArgsProperties1BoxedMap -public record ObjectModelWithArgAndArgsProperties1BoxedMap
-implements [ObjectModelWithArgAndArgsProperties1Boxed](#objectmodelwithargandargsproperties1boxed) - -record that stores validated Map payloads, sealed permits implementation - -### Constructor Summary -| Constructor and Description | -| --------------------------- | -| ObjectModelWithArgAndArgsProperties1BoxedMap([ObjectModelWithArgAndArgsPropertiesMap](#objectmodelwithargandargspropertiesmap) data)
Creates an instance, private visibility | - -### Method Summary -| Modifier and Type | Method and Description | -| ----------------- | ---------------------- | -| [ObjectModelWithArgAndArgsPropertiesMap](#objectmodelwithargandargspropertiesmap) | data()
validated payload | -| @Nullable Object | getData()
validated payload | - -## ObjectModelWithArgAndArgsProperties1 -public static class ObjectModelWithArgAndArgsProperties1
-extends JsonSchema - -A schema class that validates payloads - -### Code Sample -``` -import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags; -import org.openapijsonschematools.client.configurations.SchemaConfiguration; -import org.openapijsonschematools.client.exceptions.ValidationException; -import org.openapijsonschematools.client.schemas.validation.MapUtils; -import org.openapijsonschematools.client.schemas.validation.FrozenList; -import org.openapijsonschematools.client.schemas.validation.FrozenMap; -import org.openapijsonschematools.client.components.schemas.ObjectModelWithArgAndArgsProperties; - -import java.util.Arrays; -import java.util.List; -import java.util.AbstractMap; - -static final SchemaConfiguration configuration = new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().build()); - -// Map validation -ObjectModelWithArgAndArgsProperties.ObjectModelWithArgAndArgsPropertiesMap validatedPayload = - ObjectModelWithArgAndArgsProperties.ObjectModelWithArgAndArgsProperties1.validate( - new ObjectModelWithArgAndArgsProperties.ObjectModelWithArgAndArgsPropertiesMapBuilder() - .arg("a") - - .args("a") - - .build(), - configuration -); -``` - -### Field Summary -| Modifier and Type | Field and Description | -| ----------------- | ---------------------- | -| Set> | type = Set.of(Map.class) | -| Map> | properties = Map.ofEntries(
    new PropertyEntry("arg", [Arg.class](#arg))),
    new PropertyEntry("args", [Args.class](#args)))
)
| -| Set | required = Set.of(
    "arg",
    "args"
)
| - -### Method Summary -| Modifier and Type | Method and Description | -| ----------------- | ---------------------- | -| [ObjectModelWithArgAndArgsPropertiesMap](#objectmodelwithargandargspropertiesmap) | validate([Map<?, ?>](#objectmodelwithargandargspropertiesmapbuilder) arg, SchemaConfiguration configuration) | -| [ObjectModelWithArgAndArgsProperties1BoxedMap](#objectmodelwithargandargsproperties1boxedmap) | validateAndBox([Map<?, ?>](#objectmodelwithargandargspropertiesmapbuilder) arg, SchemaConfiguration configuration) | -| [ObjectModelWithArgAndArgsProperties1Boxed](#objectmodelwithargandargsproperties1boxed) | validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) | -| @Nullable Object | validate(@Nullable Object arg, SchemaConfiguration configuration) | - -## ObjectModelWithArgAndArgsPropertiesMap00Builder -public class ObjectModelWithArgAndArgsPropertiesMap00Builder
-builder for `Map` - -A class that builds the Map input type - -### Constructor Summary -| Constructor and Description | -| --------------------------- | -| ObjectModelWithArgAndArgsPropertiesMap00Builder(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 | -| [ObjectModelWithArgAndArgsPropertiesMap00Builder](#objectmodelwithargandargspropertiesmap00builder) | additionalProperty(String key, Nothing? value) | -| [ObjectModelWithArgAndArgsPropertiesMap00Builder](#objectmodelwithargandargspropertiesmap00builder) | additionalProperty(String key, boolean value) | -| [ObjectModelWithArgAndArgsPropertiesMap00Builder](#objectmodelwithargandargspropertiesmap00builder) | additionalProperty(String key, String value) | -| [ObjectModelWithArgAndArgsPropertiesMap00Builder](#objectmodelwithargandargspropertiesmap00builder) | additionalProperty(String key, int value) | -| [ObjectModelWithArgAndArgsPropertiesMap00Builder](#objectmodelwithargandargspropertiesmap00builder) | additionalProperty(String key, float value) | -| [ObjectModelWithArgAndArgsPropertiesMap00Builder](#objectmodelwithargandargspropertiesmap00builder) | additionalProperty(String key, long value) | -| [ObjectModelWithArgAndArgsPropertiesMap00Builder](#objectmodelwithargandargspropertiesmap00builder) | additionalProperty(String key, double value) | -| [ObjectModelWithArgAndArgsPropertiesMap00Builder](#objectmodelwithargandargspropertiesmap00builder) | additionalProperty(String key, List value) | -| [ObjectModelWithArgAndArgsPropertiesMap00Builder](#objectmodelwithargandargspropertiesmap00builder) | additionalProperty(String key, Map value) | - -## ObjectModelWithArgAndArgsPropertiesMap01Builder -public class ObjectModelWithArgAndArgsPropertiesMap01Builder
-builder for `Map` - -A class that builds the Map input type - -### Constructor Summary -| Constructor and Description | -| --------------------------- | -| ObjectModelWithArgAndArgsPropertiesMap01Builder(Map instance)
Creates a builder that contains the passed instance | - -### Method Summary -| Modifier and Type | Method and Description | -| ----------------- | ---------------------- | -| [ObjectModelWithArgAndArgsPropertiesMap00Builder](#objectmodelwithargandargspropertiesmap00builder) | args(String value) | - -## ObjectModelWithArgAndArgsPropertiesMap10Builder -public class ObjectModelWithArgAndArgsPropertiesMap10Builder
-builder for `Map` - -A class that builds the Map input type - -### Constructor Summary -| Constructor and Description | -| --------------------------- | -| ObjectModelWithArgAndArgsPropertiesMap10Builder(Map instance)
Creates a builder that contains the passed instance | - -### Method Summary -| Modifier and Type | Method and Description | -| ----------------- | ---------------------- | -| [ObjectModelWithArgAndArgsPropertiesMap00Builder](#objectmodelwithargandargspropertiesmap00builder) | arg(String value) | - -## ObjectModelWithArgAndArgsPropertiesMapBuilder -public class ObjectModelWithArgAndArgsPropertiesMapBuilder
-builder for `Map` - -A class that builds the Map input type - -### Constructor Summary -| Constructor and Description | -| --------------------------- | -| ObjectModelWithArgAndArgsPropertiesMapBuilder()
Creates a builder that contains an empty map | - -### Method Summary -| Modifier and Type | Method and Description | -| ----------------- | ---------------------- | -| [ObjectModelWithArgAndArgsPropertiesMap01Builder](#objectmodelwithargandargspropertiesmap01builder) | arg(String value) | -| [ObjectModelWithArgAndArgsPropertiesMap10Builder](#objectmodelwithargandargspropertiesmap10builder) | args(String value) | - -## ObjectModelWithArgAndArgsPropertiesMap -public static class ObjectModelWithArgAndArgsPropertiesMap
-extends FrozenMap - -A class to store validated Map payloads - -### Method Summary -| Modifier and Type | Method and Description | -| ----------------- | ---------------------- | -| static [ObjectModelWithArgAndArgsPropertiesMap](#objectmodelwithargandargspropertiesmap) | of([Map](#objectmodelwithargandargspropertiesmapbuilder) arg, SchemaConfiguration configuration) | -| String | arg()
| -| String | args()
| -| @Nullable Object | getAdditionalProperty(String name)
provides type safety for additional properties | - -## ArgsBoxed -public sealed interface ArgsBoxed
-permits
-[ArgsBoxedString](#argsboxedstring) - -sealed interface that stores validated payloads using boxed classes - -## ArgsBoxedString -public record ArgsBoxedString
-implements [ArgsBoxed](#argsboxed) - -record that stores validated String payloads, sealed permits implementation - -### Constructor Summary -| Constructor and Description | -| --------------------------- | -| ArgsBoxedString(String data)
Creates an instance, private visibility | - -### Method Summary -| Modifier and Type | Method and Description | -| ----------------- | ---------------------- | -| String | data()
validated payload | -| @Nullable Object | getData()
validated payload | - -## Args -public static class Args
-extends StringJsonSchema.StringJsonSchema1 - -A schema class that validates payloads - -| Methods Inherited from class org.openapijsonschematools.client.schemas.StringJsonSchema.StringJsonSchema1 | -| ------------------------------------------------------------------ | -| validate | -| validateAndBox | - -## ArgBoxed -public sealed interface ArgBoxed
-permits
-[ArgBoxedString](#argboxedstring) - -sealed interface that stores validated payloads using boxed classes - -## ArgBoxedString -public record ArgBoxedString
-implements [ArgBoxed](#argboxed) - -record that stores validated String payloads, sealed permits implementation - -### Constructor Summary -| Constructor and Description | -| --------------------------- | -| ArgBoxedString(String data)
Creates an instance, private visibility | - -### Method Summary -| Modifier and Type | Method and Description | -| ----------------- | ---------------------- | -| String | data()
validated payload | -| @Nullable Object | getData()
validated payload | - -## Arg -public static class Arg
-extends StringJsonSchema.StringJsonSchema1 - -A schema class that validates payloads - -| Methods Inherited from class org.openapijsonschematools.client.schemas.StringJsonSchema.StringJsonSchema1 | -| ------------------------------------------------------------------ | -| validate | -| validateAndBox | - -[[Back to top]](#top) [[Back to Component Schemas]](../../../README.md#Component-Schemas) [[Back to README]](../../../README.md) diff --git a/samples/client/petstore/kotlin/docs/components/schemas/ObjectModelWithRefProps.md b/samples/client/petstore/kotlin/docs/components/schemas/ObjectModelWithRefProps.md deleted file mode 100644 index 965b77a1f9e..00000000000 --- a/samples/client/petstore/kotlin/docs/components/schemas/ObjectModelWithRefProps.md +++ /dev/null @@ -1,139 +0,0 @@ -# ObjectModelWithRefProps -org.openapijsonschematools.client.components.schemas.ObjectModelWithRefProps.java -public class ObjectModelWithRefProps
- -A class that contains necessary nested -- schema classes (which validate payloads), extends JsonSchema -- sealed interfaces which store validated payloads, java version of a sum type -- boxed classes which store validated payloads, sealed permits class implementations -- classes to store validated map payloads, extends FrozenMap -- classes to build inputs for map payloads - -## Nested Class Summary -| Modifier and Type | Class and Description | -| ----------------- | ---------------------- | -| sealed interface | [ObjectModelWithRefProps.ObjectModelWithRefProps1Boxed](#objectmodelwithrefprops1boxed)
sealed interface for validated payloads | -| record | [ObjectModelWithRefProps.ObjectModelWithRefProps1BoxedMap](#objectmodelwithrefprops1boxedmap)
boxed class to store validated Map payloads | -| static class | [ObjectModelWithRefProps.ObjectModelWithRefProps1](#objectmodelwithrefprops1)
schema class | -| static class | [ObjectModelWithRefProps.ObjectModelWithRefPropsMapBuilder](#objectmodelwithrefpropsmapbuilder)
builder for Map payloads | -| static class | [ObjectModelWithRefProps.ObjectModelWithRefPropsMap](#objectmodelwithrefpropsmap)
output class for Map payloads | - -## ObjectModelWithRefProps1Boxed -public sealed interface ObjectModelWithRefProps1Boxed
-permits
-[ObjectModelWithRefProps1BoxedMap](#objectmodelwithrefprops1boxedmap) - -sealed interface that stores validated payloads using boxed classes - -## ObjectModelWithRefProps1BoxedMap -public record ObjectModelWithRefProps1BoxedMap
-implements [ObjectModelWithRefProps1Boxed](#objectmodelwithrefprops1boxed) - -record that stores validated Map payloads, sealed permits implementation - -### Constructor Summary -| Constructor and Description | -| --------------------------- | -| ObjectModelWithRefProps1BoxedMap([ObjectModelWithRefPropsMap](#objectmodelwithrefpropsmap) data)
Creates an instance, private visibility | - -### Method Summary -| Modifier and Type | Method and Description | -| ----------------- | ---------------------- | -| [ObjectModelWithRefPropsMap](#objectmodelwithrefpropsmap) | data()
validated payload | -| @Nullable Object | getData()
validated payload | - -## ObjectModelWithRefProps1 -public static class ObjectModelWithRefProps1
-extends JsonSchema - -A schema class that validates payloads - -## Description -a model that includes properties which should stay primitive (String + Boolean) and one which is defined as a class, NumberWithValidations - -### Code Sample -``` -import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags; -import org.openapijsonschematools.client.configurations.SchemaConfiguration; -import org.openapijsonschematools.client.exceptions.ValidationException; -import org.openapijsonschematools.client.schemas.validation.MapUtils; -import org.openapijsonschematools.client.schemas.validation.FrozenList; -import org.openapijsonschematools.client.schemas.validation.FrozenMap; -import org.openapijsonschematools.client.components.schemas.ObjectModelWithRefProps; - -import java.util.Arrays; -import java.util.List; -import java.util.AbstractMap; - -static final SchemaConfiguration configuration = new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().build()); - -// Map validation -ObjectModelWithRefProps.ObjectModelWithRefPropsMap validatedPayload = - ObjectModelWithRefProps.ObjectModelWithRefProps1.validate( - new ObjectModelWithRefProps.ObjectModelWithRefPropsMapBuilder() - .build(), - configuration -); -``` - -### Field Summary -| Modifier and Type | Field and Description | -| ----------------- | ---------------------- | -| Set> | type = Set.of(Map.class) | -| Map> | properties = Map.ofEntries(
    new PropertyEntry("myNumber", [NumberWithValidations.NumberWithValidations1.class](../../components/schemas/NumberWithValidations.md#numberwithvalidations1)),
    new PropertyEntry("myString", [StringSchema.StringSchema1.class](../../components/schemas/StringSchema.md#stringschema1)),
    new PropertyEntry("myBoolean", [BooleanSchema.BooleanSchema1.class](../../components/schemas/BooleanSchema.md#booleanschema1))
)
| - -### Method Summary -| Modifier and Type | Method and Description | -| ----------------- | ---------------------- | -| [ObjectModelWithRefPropsMap](#objectmodelwithrefpropsmap) | validate([Map<?, ?>](#objectmodelwithrefpropsmapbuilder) arg, SchemaConfiguration configuration) | -| [ObjectModelWithRefProps1BoxedMap](#objectmodelwithrefprops1boxedmap) | validateAndBox([Map<?, ?>](#objectmodelwithrefpropsmapbuilder) arg, SchemaConfiguration configuration) | -| [ObjectModelWithRefProps1Boxed](#objectmodelwithrefprops1boxed) | validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) | -| @Nullable Object | validate(@Nullable Object arg, SchemaConfiguration configuration) | - -## ObjectModelWithRefPropsMapBuilder -public class ObjectModelWithRefPropsMapBuilder
-builder for `Map` - -A class that builds the Map input type - -### Constructor Summary -| Constructor and Description | -| --------------------------- | -| ObjectModelWithRefPropsMapBuilder()
Creates a builder that contains an empty map | - -### Method Summary -| Modifier and Type | Method and Description | -| ----------------- | ---------------------- | -| Map | build()
Returns map input that should be used with Schema.validate | -| [ObjectModelWithRefPropsMapBuilder](#objectmodelwithrefpropsmapbuilder) | myNumber(int value) | -| [ObjectModelWithRefPropsMapBuilder](#objectmodelwithrefpropsmapbuilder) | myNumber(float value) | -| [ObjectModelWithRefPropsMapBuilder](#objectmodelwithrefpropsmapbuilder) | myNumber(long value) | -| [ObjectModelWithRefPropsMapBuilder](#objectmodelwithrefpropsmapbuilder) | myNumber(double value) | -| [ObjectModelWithRefPropsMapBuilder](#objectmodelwithrefpropsmapbuilder) | myString(String value) | -| [ObjectModelWithRefPropsMapBuilder](#objectmodelwithrefpropsmapbuilder) | myBoolean(boolean value) | -| [ObjectModelWithRefPropsMapBuilder](#objectmodelwithrefpropsmapbuilder) | additionalProperty(String key, Nothing? value) | -| [ObjectModelWithRefPropsMapBuilder](#objectmodelwithrefpropsmapbuilder) | additionalProperty(String key, boolean value) | -| [ObjectModelWithRefPropsMapBuilder](#objectmodelwithrefpropsmapbuilder) | additionalProperty(String key, String value) | -| [ObjectModelWithRefPropsMapBuilder](#objectmodelwithrefpropsmapbuilder) | additionalProperty(String key, int value) | -| [ObjectModelWithRefPropsMapBuilder](#objectmodelwithrefpropsmapbuilder) | additionalProperty(String key, float value) | -| [ObjectModelWithRefPropsMapBuilder](#objectmodelwithrefpropsmapbuilder) | additionalProperty(String key, long value) | -| [ObjectModelWithRefPropsMapBuilder](#objectmodelwithrefpropsmapbuilder) | additionalProperty(String key, double value) | -| [ObjectModelWithRefPropsMapBuilder](#objectmodelwithrefpropsmapbuilder) | additionalProperty(String key, List value) | -| [ObjectModelWithRefPropsMapBuilder](#objectmodelwithrefpropsmapbuilder) | additionalProperty(String key, Map value) | - -## ObjectModelWithRefPropsMap -public static class ObjectModelWithRefPropsMap
-extends FrozenMap - -A class to store validated Map payloads - -### Method Summary -| Modifier and Type | Method and Description | -| ----------------- | ---------------------- | -| static [ObjectModelWithRefPropsMap](#objectmodelwithrefpropsmap) | of([Map](#objectmodelwithrefpropsmapbuilder) arg, SchemaConfiguration configuration) | -| Number | myNumber()
[optional] | -| String | myString()
[optional] | -| boolean | myBoolean()
[optional] | -| @Nullable Object | getAdditionalProperty(String name)
provides type safety for additional properties | - -[[Back to top]](#top) [[Back to Component Schemas]](../../../README.md#Component-Schemas) [[Back to README]](../../../README.md) diff --git a/samples/client/petstore/kotlin/docs/components/schemas/ObjectWithAllOfWithReqTestPropFromUnsetAddProp.md b/samples/client/petstore/kotlin/docs/components/schemas/ObjectWithAllOfWithReqTestPropFromUnsetAddProp.md deleted file mode 100644 index 42ce8ddc190..00000000000 --- a/samples/client/petstore/kotlin/docs/components/schemas/ObjectWithAllOfWithReqTestPropFromUnsetAddProp.md +++ /dev/null @@ -1,350 +0,0 @@ -# ObjectWithAllOfWithReqTestPropFromUnsetAddProp -org.openapijsonschematools.client.components.schemas.ObjectWithAllOfWithReqTestPropFromUnsetAddProp.java -public class ObjectWithAllOfWithReqTestPropFromUnsetAddProp
- -A class that contains necessary nested -- schema classes (which validate payloads), extends JsonSchema -- sealed interfaces which store validated payloads, java version of a sum type -- boxed classes which store validated payloads, sealed permits class implementations -- classes to store validated map payloads, extends FrozenMap -- classes to build inputs for map payloads - -## Nested Class Summary -| Modifier and Type | Class and Description | -| ----------------- | ---------------------- | -| sealed interface | [ObjectWithAllOfWithReqTestPropFromUnsetAddProp.ObjectWithAllOfWithReqTestPropFromUnsetAddProp1Boxed](#objectwithallofwithreqtestpropfromunsetaddprop1boxed)
sealed interface for validated payloads | -| record | [ObjectWithAllOfWithReqTestPropFromUnsetAddProp.ObjectWithAllOfWithReqTestPropFromUnsetAddProp1BoxedVoid](#objectwithallofwithreqtestpropfromunsetaddprop1boxedvoid)
boxed class to store validated null payloads | -| record | [ObjectWithAllOfWithReqTestPropFromUnsetAddProp.ObjectWithAllOfWithReqTestPropFromUnsetAddProp1BoxedBoolean](#objectwithallofwithreqtestpropfromunsetaddprop1boxedboolean)
boxed class to store validated boolean payloads | -| record | [ObjectWithAllOfWithReqTestPropFromUnsetAddProp.ObjectWithAllOfWithReqTestPropFromUnsetAddProp1BoxedNumber](#objectwithallofwithreqtestpropfromunsetaddprop1boxednumber)
boxed class to store validated Number payloads | -| record | [ObjectWithAllOfWithReqTestPropFromUnsetAddProp.ObjectWithAllOfWithReqTestPropFromUnsetAddProp1BoxedString](#objectwithallofwithreqtestpropfromunsetaddprop1boxedstring)
boxed class to store validated String payloads | -| record | [ObjectWithAllOfWithReqTestPropFromUnsetAddProp.ObjectWithAllOfWithReqTestPropFromUnsetAddProp1BoxedList](#objectwithallofwithreqtestpropfromunsetaddprop1boxedlist)
boxed class to store validated List payloads | -| record | [ObjectWithAllOfWithReqTestPropFromUnsetAddProp.ObjectWithAllOfWithReqTestPropFromUnsetAddProp1BoxedMap](#objectwithallofwithreqtestpropfromunsetaddprop1boxedmap)
boxed class to store validated Map payloads | -| static class | [ObjectWithAllOfWithReqTestPropFromUnsetAddProp.ObjectWithAllOfWithReqTestPropFromUnsetAddProp1](#objectwithallofwithreqtestpropfromunsetaddprop1)
schema class | -| sealed interface | [ObjectWithAllOfWithReqTestPropFromUnsetAddProp.Schema1Boxed](#schema1boxed)
sealed interface for validated payloads | -| record | [ObjectWithAllOfWithReqTestPropFromUnsetAddProp.Schema1BoxedMap](#schema1boxedmap)
boxed class to store validated Map payloads | -| static class | [ObjectWithAllOfWithReqTestPropFromUnsetAddProp.Schema1](#schema1)
schema class | -| static class | [ObjectWithAllOfWithReqTestPropFromUnsetAddProp.Schema1MapBuilder](#schema1mapbuilder)
builder for Map payloads | -| static class | [ObjectWithAllOfWithReqTestPropFromUnsetAddProp.Schema1Map](#schema1map)
output class for Map payloads | -| sealed interface | [ObjectWithAllOfWithReqTestPropFromUnsetAddProp.NameBoxed](#nameboxed)
sealed interface for validated payloads | -| record | [ObjectWithAllOfWithReqTestPropFromUnsetAddProp.NameBoxedString](#nameboxedstring)
boxed class to store validated String payloads | -| static class | [ObjectWithAllOfWithReqTestPropFromUnsetAddProp.Name](#name)
schema class | - -## ObjectWithAllOfWithReqTestPropFromUnsetAddProp1Boxed -public sealed interface ObjectWithAllOfWithReqTestPropFromUnsetAddProp1Boxed
-permits
-[ObjectWithAllOfWithReqTestPropFromUnsetAddProp1BoxedVoid](#objectwithallofwithreqtestpropfromunsetaddprop1boxedvoid), -[ObjectWithAllOfWithReqTestPropFromUnsetAddProp1BoxedBoolean](#objectwithallofwithreqtestpropfromunsetaddprop1boxedboolean), -[ObjectWithAllOfWithReqTestPropFromUnsetAddProp1BoxedNumber](#objectwithallofwithreqtestpropfromunsetaddprop1boxednumber), -[ObjectWithAllOfWithReqTestPropFromUnsetAddProp1BoxedString](#objectwithallofwithreqtestpropfromunsetaddprop1boxedstring), -[ObjectWithAllOfWithReqTestPropFromUnsetAddProp1BoxedList](#objectwithallofwithreqtestpropfromunsetaddprop1boxedlist), -[ObjectWithAllOfWithReqTestPropFromUnsetAddProp1BoxedMap](#objectwithallofwithreqtestpropfromunsetaddprop1boxedmap) - -sealed interface that stores validated payloads using boxed classes - -## ObjectWithAllOfWithReqTestPropFromUnsetAddProp1BoxedVoid -public record ObjectWithAllOfWithReqTestPropFromUnsetAddProp1BoxedVoid
-implements [ObjectWithAllOfWithReqTestPropFromUnsetAddProp1Boxed](#objectwithallofwithreqtestpropfromunsetaddprop1boxed) - -record that stores validated null payloads, sealed permits implementation - -### Constructor Summary -| Constructor and Description | -| --------------------------- | -| ObjectWithAllOfWithReqTestPropFromUnsetAddProp1BoxedVoid(Nothing? data)
Creates an instance, private visibility | - -### Method Summary -| Modifier and Type | Method and Description | -| ----------------- | ---------------------- | -| Nothing? | data()
validated payload | -| @Nullable Object | getData()
validated payload | - -## ObjectWithAllOfWithReqTestPropFromUnsetAddProp1BoxedBoolean -public record ObjectWithAllOfWithReqTestPropFromUnsetAddProp1BoxedBoolean
-implements [ObjectWithAllOfWithReqTestPropFromUnsetAddProp1Boxed](#objectwithallofwithreqtestpropfromunsetaddprop1boxed) - -record that stores validated boolean payloads, sealed permits implementation - -### Constructor Summary -| Constructor and Description | -| --------------------------- | -| ObjectWithAllOfWithReqTestPropFromUnsetAddProp1BoxedBoolean(boolean data)
Creates an instance, private visibility | - -### Method Summary -| Modifier and Type | Method and Description | -| ----------------- | ---------------------- | -| boolean | data()
validated payload | -| @Nullable Object | getData()
validated payload | - -## ObjectWithAllOfWithReqTestPropFromUnsetAddProp1BoxedNumber -public record ObjectWithAllOfWithReqTestPropFromUnsetAddProp1BoxedNumber
-implements [ObjectWithAllOfWithReqTestPropFromUnsetAddProp1Boxed](#objectwithallofwithreqtestpropfromunsetaddprop1boxed) - -record that stores validated Number payloads, sealed permits implementation - -### Constructor Summary -| Constructor and Description | -| --------------------------- | -| ObjectWithAllOfWithReqTestPropFromUnsetAddProp1BoxedNumber(Number data)
Creates an instance, private visibility | - -### Method Summary -| Modifier and Type | Method and Description | -| ----------------- | ---------------------- | -| Number | data()
validated payload | -| @Nullable Object | getData()
validated payload | - -## ObjectWithAllOfWithReqTestPropFromUnsetAddProp1BoxedString -public record ObjectWithAllOfWithReqTestPropFromUnsetAddProp1BoxedString
-implements [ObjectWithAllOfWithReqTestPropFromUnsetAddProp1Boxed](#objectwithallofwithreqtestpropfromunsetaddprop1boxed) - -record that stores validated String payloads, sealed permits implementation - -### Constructor Summary -| Constructor and Description | -| --------------------------- | -| ObjectWithAllOfWithReqTestPropFromUnsetAddProp1BoxedString(String data)
Creates an instance, private visibility | - -### Method Summary -| Modifier and Type | Method and Description | -| ----------------- | ---------------------- | -| String | data()
validated payload | -| @Nullable Object | getData()
validated payload | - -## ObjectWithAllOfWithReqTestPropFromUnsetAddProp1BoxedList -public record ObjectWithAllOfWithReqTestPropFromUnsetAddProp1BoxedList
-implements [ObjectWithAllOfWithReqTestPropFromUnsetAddProp1Boxed](#objectwithallofwithreqtestpropfromunsetaddprop1boxed) - -record that stores validated List payloads, sealed permits implementation - -### Constructor Summary -| Constructor and Description | -| --------------------------- | -| ObjectWithAllOfWithReqTestPropFromUnsetAddProp1BoxedList(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 | - -## ObjectWithAllOfWithReqTestPropFromUnsetAddProp1BoxedMap -public record ObjectWithAllOfWithReqTestPropFromUnsetAddProp1BoxedMap
-implements [ObjectWithAllOfWithReqTestPropFromUnsetAddProp1Boxed](#objectwithallofwithreqtestpropfromunsetaddprop1boxed) - -record that stores validated Map payloads, sealed permits implementation - -### Constructor Summary -| Constructor and Description | -| --------------------------- | -| ObjectWithAllOfWithReqTestPropFromUnsetAddProp1BoxedMap(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 | - -## ObjectWithAllOfWithReqTestPropFromUnsetAddProp1 -public static class ObjectWithAllOfWithReqTestPropFromUnsetAddProp1
-extends JsonSchema - -A schema class that validates payloads - -### Field Summary -| Modifier and Type | Field and Description | -| ----------------- | ---------------------- | -| List> | allOf = List.of(
    [ObjectWithOptionalTestProp.ObjectWithOptionalTestProp1.class](../../components/schemas/ObjectWithOptionalTestProp.md#objectwithoptionaltestprop1),
    [Schema1.class](#schema1)
;)
| - -### Method Summary -| Modifier and Type | Method and Description | -| ----------------- | ---------------------- | -| String | validate(String arg, SchemaConfiguration configuration) | -| Nothing? | validate(Nothing? arg, SchemaConfiguration configuration) | -| int | validate(int arg, SchemaConfiguration configuration) | -| long | validate(long arg, SchemaConfiguration configuration) | -| float | validate(float arg, SchemaConfiguration configuration) | -| double | validate(double arg, SchemaConfiguration configuration) | -| Number | validate(Number arg, SchemaConfiguration configuration) | -| boolean | validate(boolean arg, SchemaConfiguration configuration) | -| FrozenMap<@Nullable Object> | validate(Map<?, ?> arg, SchemaConfiguration configuration) | -| FrozenList<@Nullable Object> | validate(List arg, SchemaConfiguration configuration) | -| [ObjectWithAllOfWithReqTestPropFromUnsetAddProp1BoxedString](#objectwithallofwithreqtestpropfromunsetaddprop1boxedstring) | validateAndBox(String arg, SchemaConfiguration configuration) | -| [ObjectWithAllOfWithReqTestPropFromUnsetAddProp1BoxedVoid](#objectwithallofwithreqtestpropfromunsetaddprop1boxedvoid) | validateAndBox(Nothing? arg, SchemaConfiguration configuration) | -| [ObjectWithAllOfWithReqTestPropFromUnsetAddProp1BoxedNumber](#objectwithallofwithreqtestpropfromunsetaddprop1boxednumber) | validateAndBox(Number arg, SchemaConfiguration configuration) | -| [ObjectWithAllOfWithReqTestPropFromUnsetAddProp1BoxedBoolean](#objectwithallofwithreqtestpropfromunsetaddprop1boxedboolean) | validateAndBox(boolean arg, SchemaConfiguration configuration) | -| [ObjectWithAllOfWithReqTestPropFromUnsetAddProp1BoxedMap](#objectwithallofwithreqtestpropfromunsetaddprop1boxedmap) | validateAndBox(Map<?, ?> arg, SchemaConfiguration configuration) | -| [ObjectWithAllOfWithReqTestPropFromUnsetAddProp1BoxedList](#objectwithallofwithreqtestpropfromunsetaddprop1boxedlist) | validateAndBox(List arg, SchemaConfiguration configuration) | -| [ObjectWithAllOfWithReqTestPropFromUnsetAddProp1Boxed](#objectwithallofwithreqtestpropfromunsetaddprop1boxed) | validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) | -| @Nullable Object | validate(@Nullable Object arg, SchemaConfiguration configuration) | - -## Schema1Boxed -public sealed interface Schema1Boxed
-permits
-[Schema1BoxedMap](#schema1boxedmap) - -sealed interface that stores validated payloads using boxed classes - -## Schema1BoxedMap -public record Schema1BoxedMap
-implements [Schema1Boxed](#schema1boxed) - -record that stores validated Map payloads, sealed permits implementation - -### Constructor Summary -| Constructor and Description | -| --------------------------- | -| Schema1BoxedMap([Schema1Map](#schema1map) data)
Creates an instance, private visibility | - -### Method Summary -| Modifier and Type | Method and Description | -| ----------------- | ---------------------- | -| [Schema1Map](#schema1map) | data()
validated payload | -| @Nullable Object | getData()
validated payload | - -## Schema1 -public static class Schema1
-extends JsonSchema - -A schema class that validates payloads - -### Code Sample -``` -import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags; -import org.openapijsonschematools.client.configurations.SchemaConfiguration; -import org.openapijsonschematools.client.exceptions.ValidationException; -import org.openapijsonschematools.client.schemas.validation.MapUtils; -import org.openapijsonschematools.client.schemas.validation.FrozenList; -import org.openapijsonschematools.client.schemas.validation.FrozenMap; -import org.openapijsonschematools.client.components.schemas.ObjectWithAllOfWithReqTestPropFromUnsetAddProp; - -import java.util.Arrays; -import java.util.List; -import java.util.AbstractMap; - -static final SchemaConfiguration configuration = new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().build()); - -// Map validation -ObjectWithAllOfWithReqTestPropFromUnsetAddProp.Schema1Map validatedPayload = - ObjectWithAllOfWithReqTestPropFromUnsetAddProp.Schema1.validate( - new ObjectWithAllOfWithReqTestPropFromUnsetAddProp.Schema1MapBuilder() - .name("a") - - .build(), - configuration -); -``` - -### Field Summary -| Modifier and Type | Field and Description | -| ----------------- | ---------------------- | -| Set> | type = Set.of(Map.class) | -| Map> | properties = Map.ofEntries(
    new PropertyEntry("name", [Name.class](#name)))
)
| -| Set | required = Set.of(
    "test"
)
| - -### Method Summary -| Modifier and Type | Method and Description | -| ----------------- | ---------------------- | -| [Schema1Map](#schema1map) | validate([Map<?, ?>](#schema1mapbuilder) arg, SchemaConfiguration configuration) | -| [Schema1BoxedMap](#schema1boxedmap) | validateAndBox([Map<?, ?>](#schema1mapbuilder) arg, SchemaConfiguration configuration) | -| [Schema1Boxed](#schema1boxed) | validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) | -| @Nullable Object | validate(@Nullable Object arg, SchemaConfiguration configuration) | - -## Schema1Map0Builder -public class Schema1Map0Builder
-builder for `Map` - -A class that builds the Map input type - -### Constructor Summary -| Constructor and Description | -| --------------------------- | -| Schema1Map0Builder(Map instance)
Creates a builder that contains the passed instance | - -### Method Summary -| Modifier and Type | Method and Description | -| ----------------- | ---------------------- | -| Map | build()
Returns map input that should be used with Schema.validate | -| [Schema1Map0Builder](#schema1map0builder) | name(String value) | -| [Schema1Map0Builder](#schema1map0builder) | additionalProperty(String key, Nothing? value) | -| [Schema1Map0Builder](#schema1map0builder) | additionalProperty(String key, boolean value) | -| [Schema1Map0Builder](#schema1map0builder) | additionalProperty(String key, String value) | -| [Schema1Map0Builder](#schema1map0builder) | additionalProperty(String key, int value) | -| [Schema1Map0Builder](#schema1map0builder) | additionalProperty(String key, float value) | -| [Schema1Map0Builder](#schema1map0builder) | additionalProperty(String key, long value) | -| [Schema1Map0Builder](#schema1map0builder) | additionalProperty(String key, double value) | -| [Schema1Map0Builder](#schema1map0builder) | additionalProperty(String key, List value) | -| [Schema1Map0Builder](#schema1map0builder) | additionalProperty(String key, Map value) | - -## Schema1MapBuilder -public class Schema1MapBuilder
-builder for `Map` - -A class that builds the Map input type - -### Constructor Summary -| Constructor and Description | -| --------------------------- | -| Schema1MapBuilder()
Creates a builder that contains an empty map | - -### Method Summary -| Modifier and Type | Method and Description | -| ----------------- | ---------------------- | -| [Schema1Map0Builder](#schema1map0builder) | test(Nothing? value) | -| [Schema1Map0Builder](#schema1map0builder) | test(boolean value) | -| [Schema1Map0Builder](#schema1map0builder) | test(String value) | -| [Schema1Map0Builder](#schema1map0builder) | test(int value) | -| [Schema1Map0Builder](#schema1map0builder) | test(float value) | -| [Schema1Map0Builder](#schema1map0builder) | test(long value) | -| [Schema1Map0Builder](#schema1map0builder) | test(double value) | -| [Schema1Map0Builder](#schema1map0builder) | test(List value) | -| [Schema1Map0Builder](#schema1map0builder) | test(Map value) | - -## Schema1Map -public static class Schema1Map
-extends FrozenMap - -A class to store validated Map payloads - -### Method Summary -| Modifier and Type | Method and Description | -| ----------------- | ---------------------- | -| static [Schema1Map](#schema1map) | of([Map](#schema1mapbuilder) arg, SchemaConfiguration configuration) | -| @Nullable Object | test()
| -| String | name()
[optional] | -| @Nullable Object | getAdditionalProperty(String name)
provides type safety for additional properties | - -## NameBoxed -public sealed interface NameBoxed
-permits
-[NameBoxedString](#nameboxedstring) - -sealed interface that stores validated payloads using boxed classes - -## NameBoxedString -public record NameBoxedString
-implements [NameBoxed](#nameboxed) - -record that stores validated String payloads, sealed permits implementation - -### Constructor Summary -| Constructor and Description | -| --------------------------- | -| NameBoxedString(String data)
Creates an instance, private visibility | - -### Method Summary -| Modifier and Type | Method and Description | -| ----------------- | ---------------------- | -| String | data()
validated payload | -| @Nullable Object | getData()
validated payload | - -## Name -public static class Name
-extends StringJsonSchema.StringJsonSchema1 - -A schema class that validates payloads - -| Methods Inherited from class org.openapijsonschematools.client.schemas.StringJsonSchema.StringJsonSchema1 | -| ------------------------------------------------------------------ | -| validate | -| validateAndBox | - -[[Back to top]](#top) [[Back to Component Schemas]](../../../README.md#Component-Schemas) [[Back to README]](../../../README.md) diff --git a/samples/client/petstore/kotlin/docs/components/schemas/ObjectWithCollidingProperties.md b/samples/client/petstore/kotlin/docs/components/schemas/ObjectWithCollidingProperties.md deleted file mode 100644 index c41be24becf..00000000000 --- a/samples/client/petstore/kotlin/docs/components/schemas/ObjectWithCollidingProperties.md +++ /dev/null @@ -1,210 +0,0 @@ -# ObjectWithCollidingProperties -org.openapijsonschematools.client.components.schemas.ObjectWithCollidingProperties.java -public class ObjectWithCollidingProperties
- -A class that contains necessary nested -- schema classes (which validate payloads), extends JsonSchema -- sealed interfaces which store validated payloads, java version of a sum type -- boxed classes which store validated payloads, sealed permits class implementations -- classes to store validated map payloads, extends FrozenMap -- classes to build inputs for map payloads - -## Nested Class Summary -| Modifier and Type | Class and Description | -| ----------------- | ---------------------- | -| sealed interface | [ObjectWithCollidingProperties.ObjectWithCollidingProperties1Boxed](#objectwithcollidingproperties1boxed)
sealed interface for validated payloads | -| record | [ObjectWithCollidingProperties.ObjectWithCollidingProperties1BoxedMap](#objectwithcollidingproperties1boxedmap)
boxed class to store validated Map payloads | -| static class | [ObjectWithCollidingProperties.ObjectWithCollidingProperties1](#objectwithcollidingproperties1)
schema class | -| static class | [ObjectWithCollidingProperties.ObjectWithCollidingPropertiesMapBuilder](#objectwithcollidingpropertiesmapbuilder)
builder for Map payloads | -| static class | [ObjectWithCollidingProperties.ObjectWithCollidingPropertiesMap](#objectwithcollidingpropertiesmap)
output class for Map payloads | -| sealed interface | [ObjectWithCollidingProperties.SomepropBoxed](#somepropboxed)
sealed interface for validated payloads | -| record | [ObjectWithCollidingProperties.SomepropBoxedMap](#somepropboxedmap)
boxed class to store validated Map payloads | -| static class | [ObjectWithCollidingProperties.Someprop](#someprop)
schema class | -| sealed interface | [ObjectWithCollidingProperties.SomePropBoxed](#somepropboxed)
sealed interface for validated payloads | -| record | [ObjectWithCollidingProperties.SomePropBoxedMap](#somepropboxedmap)
boxed class to store validated Map payloads | -| static class | [ObjectWithCollidingProperties.SomeProp](#someprop)
schema class | - -## ObjectWithCollidingProperties1Boxed -public sealed interface ObjectWithCollidingProperties1Boxed
-permits
-[ObjectWithCollidingProperties1BoxedMap](#objectwithcollidingproperties1boxedmap) - -sealed interface that stores validated payloads using boxed classes - -## ObjectWithCollidingProperties1BoxedMap -public record ObjectWithCollidingProperties1BoxedMap
-implements [ObjectWithCollidingProperties1Boxed](#objectwithcollidingproperties1boxed) - -record that stores validated Map payloads, sealed permits implementation - -### Constructor Summary -| Constructor and Description | -| --------------------------- | -| ObjectWithCollidingProperties1BoxedMap([ObjectWithCollidingPropertiesMap](#objectwithcollidingpropertiesmap) data)
Creates an instance, private visibility | - -### Method Summary -| Modifier and Type | Method and Description | -| ----------------- | ---------------------- | -| [ObjectWithCollidingPropertiesMap](#objectwithcollidingpropertiesmap) | data()
validated payload | -| @Nullable Object | getData()
validated payload | - -## ObjectWithCollidingProperties1 -public static class ObjectWithCollidingProperties1
-extends JsonSchema - -A schema class that validates payloads - -## Description -component with properties that have name collisions - -### Code Sample -``` -import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags; -import org.openapijsonschematools.client.configurations.SchemaConfiguration; -import org.openapijsonschematools.client.exceptions.ValidationException; -import org.openapijsonschematools.client.schemas.validation.MapUtils; -import org.openapijsonschematools.client.schemas.validation.FrozenList; -import org.openapijsonschematools.client.schemas.validation.FrozenMap; -import org.openapijsonschematools.client.components.schemas.ObjectWithCollidingProperties; - -import java.util.Arrays; -import java.util.List; -import java.util.AbstractMap; - -static final SchemaConfiguration configuration = new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().build()); - -// Map validation -ObjectWithCollidingProperties.ObjectWithCollidingPropertiesMap validatedPayload = - ObjectWithCollidingProperties.ObjectWithCollidingProperties1.validate( - new ObjectWithCollidingProperties.ObjectWithCollidingPropertiesMapBuilder() - .build(), - configuration -); -``` - -### Field Summary -| Modifier and Type | Field and Description | -| ----------------- | ---------------------- | -| Set> | type = Set.of(Map.class) | -| Map> | properties = Map.ofEntries(
    new PropertyEntry("someProp", [SomeProp.class](#someprop))),
    new PropertyEntry("someprop", [Someprop.class](#someprop)))
)
| - -### Method Summary -| Modifier and Type | Method and Description | -| ----------------- | ---------------------- | -| [ObjectWithCollidingPropertiesMap](#objectwithcollidingpropertiesmap) | validate([Map<?, ?>](#objectwithcollidingpropertiesmapbuilder) arg, SchemaConfiguration configuration) | -| [ObjectWithCollidingProperties1BoxedMap](#objectwithcollidingproperties1boxedmap) | validateAndBox([Map<?, ?>](#objectwithcollidingpropertiesmapbuilder) arg, SchemaConfiguration configuration) | -| [ObjectWithCollidingProperties1Boxed](#objectwithcollidingproperties1boxed) | validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) | -| @Nullable Object | validate(@Nullable Object arg, SchemaConfiguration configuration) | - -## ObjectWithCollidingPropertiesMapBuilder -public class ObjectWithCollidingPropertiesMapBuilder
-builder for `Map` - -A class that builds the Map input type - -### Constructor Summary -| Constructor and Description | -| --------------------------- | -| ObjectWithCollidingPropertiesMapBuilder()
Creates a builder that contains an empty map | - -### Method Summary -| Modifier and Type | Method and Description | -| ----------------- | ---------------------- | -| Map | build()
Returns map input that should be used with Schema.validate | -| [ObjectWithCollidingPropertiesMapBuilder](#objectwithcollidingpropertiesmapbuilder) | someProp(Map value) | -| [ObjectWithCollidingPropertiesMapBuilder](#objectwithcollidingpropertiesmapbuilder) | someprop(Map value) | -| [ObjectWithCollidingPropertiesMapBuilder](#objectwithcollidingpropertiesmapbuilder) | additionalProperty(String key, Nothing? value) | -| [ObjectWithCollidingPropertiesMapBuilder](#objectwithcollidingpropertiesmapbuilder) | additionalProperty(String key, boolean value) | -| [ObjectWithCollidingPropertiesMapBuilder](#objectwithcollidingpropertiesmapbuilder) | additionalProperty(String key, String value) | -| [ObjectWithCollidingPropertiesMapBuilder](#objectwithcollidingpropertiesmapbuilder) | additionalProperty(String key, int value) | -| [ObjectWithCollidingPropertiesMapBuilder](#objectwithcollidingpropertiesmapbuilder) | additionalProperty(String key, float value) | -| [ObjectWithCollidingPropertiesMapBuilder](#objectwithcollidingpropertiesmapbuilder) | additionalProperty(String key, long value) | -| [ObjectWithCollidingPropertiesMapBuilder](#objectwithcollidingpropertiesmapbuilder) | additionalProperty(String key, double value) | -| [ObjectWithCollidingPropertiesMapBuilder](#objectwithcollidingpropertiesmapbuilder) | additionalProperty(String key, List value) | -| [ObjectWithCollidingPropertiesMapBuilder](#objectwithcollidingpropertiesmapbuilder) | additionalProperty(String key, Map value) | - -## ObjectWithCollidingPropertiesMap -public static class ObjectWithCollidingPropertiesMap
-extends FrozenMap - -A class to store validated Map payloads - -### Method Summary -| Modifier and Type | Method and Description | -| ----------------- | ---------------------- | -| static [ObjectWithCollidingPropertiesMap](#objectwithcollidingpropertiesmap) | of([Map](#objectwithcollidingpropertiesmapbuilder) arg, SchemaConfiguration configuration) | -| FrozenMap | someProp()
[optional] | -| FrozenMap | someprop()
[optional] | -| @Nullable Object | getAdditionalProperty(String name)
provides type safety for additional properties | - -## SomepropBoxed -public sealed interface SomepropBoxed
-permits
-[SomepropBoxedMap](#somepropboxedmap) - -sealed interface that stores validated payloads using boxed classes - -## SomepropBoxedMap -public record SomepropBoxedMap
-implements [SomepropBoxed](#somepropboxed) - -record that stores validated Map payloads, sealed permits implementation - -### Constructor Summary -| Constructor and Description | -| --------------------------- | -| SomepropBoxedMap(FrozenMap<@Nullable Object> data)
Creates an instance, private visibility | - -### Method Summary -| Modifier and Type | Method and Description | -| ----------------- | ---------------------- | -| FrozenMap<@Nullable Object> | data()
validated payload | -| @Nullable Object | getData()
validated payload | - -## Someprop -public static class Someprop
-extends MapJsonSchema.MapJsonSchema1 - -A schema class that validates payloads - -| Methods Inherited from class org.openapijsonschematools.client.schemas.MapJsonSchema.MapJsonSchema1 | -| ------------------------------------------------------------------ | -| validate | -| validateAndBox | - -## SomePropBoxed -public sealed interface SomePropBoxed
-permits
-[SomePropBoxedMap](#somepropboxedmap) - -sealed interface that stores validated payloads using boxed classes - -## SomePropBoxedMap -public record SomePropBoxedMap
-implements [SomePropBoxed](#somepropboxed) - -record that stores validated Map payloads, sealed permits implementation - -### Constructor Summary -| Constructor and Description | -| --------------------------- | -| SomePropBoxedMap(FrozenMap<@Nullable Object> data)
Creates an instance, private visibility | - -### Method Summary -| Modifier and Type | Method and Description | -| ----------------- | ---------------------- | -| FrozenMap<@Nullable Object> | data()
validated payload | -| @Nullable Object | getData()
validated payload | - -## SomeProp -public static class SomeProp
-extends MapJsonSchema.MapJsonSchema1 - -A schema class that validates payloads - -| Methods Inherited from class org.openapijsonschematools.client.schemas.MapJsonSchema.MapJsonSchema1 | -| ------------------------------------------------------------------ | -| validate | -| validateAndBox | - -[[Back to top]](#top) [[Back to Component Schemas]](../../../README.md#Component-Schemas) [[Back to README]](../../../README.md) diff --git a/samples/client/petstore/kotlin/docs/components/schemas/ObjectWithDecimalProperties.md b/samples/client/petstore/kotlin/docs/components/schemas/ObjectWithDecimalProperties.md deleted file mode 100644 index cbde4daec87..00000000000 --- a/samples/client/petstore/kotlin/docs/components/schemas/ObjectWithDecimalProperties.md +++ /dev/null @@ -1,187 +0,0 @@ -# ObjectWithDecimalProperties -org.openapijsonschematools.client.components.schemas.ObjectWithDecimalProperties.java -public class ObjectWithDecimalProperties
- -A class that contains necessary nested -- schema classes (which validate payloads), extends JsonSchema -- sealed interfaces which store validated payloads, java version of a sum type -- boxed classes which store validated payloads, sealed permits class implementations -- classes to store validated map payloads, extends FrozenMap -- classes to build inputs for map payloads - -## Nested Class Summary -| Modifier and Type | Class and Description | -| ----------------- | ---------------------- | -| sealed interface | [ObjectWithDecimalProperties.ObjectWithDecimalProperties1Boxed](#objectwithdecimalproperties1boxed)
sealed interface for validated payloads | -| record | [ObjectWithDecimalProperties.ObjectWithDecimalProperties1BoxedMap](#objectwithdecimalproperties1boxedmap)
boxed class to store validated Map payloads | -| static class | [ObjectWithDecimalProperties.ObjectWithDecimalProperties1](#objectwithdecimalproperties1)
schema class | -| static class | [ObjectWithDecimalProperties.ObjectWithDecimalPropertiesMapBuilder](#objectwithdecimalpropertiesmapbuilder)
builder for Map payloads | -| static class | [ObjectWithDecimalProperties.ObjectWithDecimalPropertiesMap](#objectwithdecimalpropertiesmap)
output class for Map payloads | -| sealed interface | [ObjectWithDecimalProperties.WidthBoxed](#widthboxed)
sealed interface for validated payloads | -| record | [ObjectWithDecimalProperties.WidthBoxedString](#widthboxedstring)
boxed class to store validated String payloads | -| static class | [ObjectWithDecimalProperties.Width](#width)
schema class | - -## ObjectWithDecimalProperties1Boxed -public sealed interface ObjectWithDecimalProperties1Boxed
-permits
-[ObjectWithDecimalProperties1BoxedMap](#objectwithdecimalproperties1boxedmap) - -sealed interface that stores validated payloads using boxed classes - -## ObjectWithDecimalProperties1BoxedMap -public record ObjectWithDecimalProperties1BoxedMap
-implements [ObjectWithDecimalProperties1Boxed](#objectwithdecimalproperties1boxed) - -record that stores validated Map payloads, sealed permits implementation - -### Constructor Summary -| Constructor and Description | -| --------------------------- | -| ObjectWithDecimalProperties1BoxedMap([ObjectWithDecimalPropertiesMap](#objectwithdecimalpropertiesmap) data)
Creates an instance, private visibility | - -### Method Summary -| Modifier and Type | Method and Description | -| ----------------- | ---------------------- | -| [ObjectWithDecimalPropertiesMap](#objectwithdecimalpropertiesmap) | data()
validated payload | -| @Nullable Object | getData()
validated payload | - -## ObjectWithDecimalProperties1 -public static class ObjectWithDecimalProperties1
-extends JsonSchema - -A schema class that validates payloads - -### Code Sample -``` -import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags; -import org.openapijsonschematools.client.configurations.SchemaConfiguration; -import org.openapijsonschematools.client.exceptions.ValidationException; -import org.openapijsonschematools.client.schemas.validation.MapUtils; -import org.openapijsonschematools.client.schemas.validation.FrozenList; -import org.openapijsonschematools.client.schemas.validation.FrozenMap; -import org.openapijsonschematools.client.components.schemas.ObjectWithDecimalProperties; - -import java.util.Arrays; -import java.util.List; -import java.util.AbstractMap; - -static final SchemaConfiguration configuration = new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().build()); - -// Map validation -ObjectWithDecimalProperties.ObjectWithDecimalPropertiesMap validatedPayload = - ObjectWithDecimalProperties.ObjectWithDecimalProperties1.validate( - new ObjectWithDecimalProperties.ObjectWithDecimalPropertiesMapBuilder() - .length("3.14") - - .width("3.14") - - .cost( - MapUtils.makeMap( - new AbstractMap.SimpleEntry( - "amount", - "3.14" - ), - new AbstractMap.SimpleEntry( - "currency", - "eur" - ) - ) - ) - .build(), - configuration -); -``` - -### Field Summary -| Modifier and Type | Field and Description | -| ----------------- | ---------------------- | -| Set> | type = Set.of(Map.class) | -| Map> | properties = Map.ofEntries(
    new PropertyEntry("length", [DecimalPayload.DecimalPayload1.class](../../components/schemas/DecimalPayload.md#decimalpayload1)),
    new PropertyEntry("width", [Width.class](#width))),
    new PropertyEntry("cost", [Money.Money1.class](../../components/schemas/Money.md#money1))
)
| - -### Method Summary -| Modifier and Type | Method and Description | -| ----------------- | ---------------------- | -| [ObjectWithDecimalPropertiesMap](#objectwithdecimalpropertiesmap) | validate([Map<?, ?>](#objectwithdecimalpropertiesmapbuilder) arg, SchemaConfiguration configuration) | -| [ObjectWithDecimalProperties1BoxedMap](#objectwithdecimalproperties1boxedmap) | validateAndBox([Map<?, ?>](#objectwithdecimalpropertiesmapbuilder) arg, SchemaConfiguration configuration) | -| [ObjectWithDecimalProperties1Boxed](#objectwithdecimalproperties1boxed) | validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) | -| @Nullable Object | validate(@Nullable Object arg, SchemaConfiguration configuration) | - -## ObjectWithDecimalPropertiesMapBuilder -public class ObjectWithDecimalPropertiesMapBuilder
-builder for `Map` - -A class that builds the Map input type - -### Constructor Summary -| Constructor and Description | -| --------------------------- | -| ObjectWithDecimalPropertiesMapBuilder()
Creates a builder that contains an empty map | - -### Method Summary -| Modifier and Type | Method and Description | -| ----------------- | ---------------------- | -| Map | build()
Returns map input that should be used with Schema.validate | -| [ObjectWithDecimalPropertiesMapBuilder](#objectwithdecimalpropertiesmapbuilder) | length(String value) | -| [ObjectWithDecimalPropertiesMapBuilder](#objectwithdecimalpropertiesmapbuilder) | width(String value) | -| [ObjectWithDecimalPropertiesMapBuilder](#objectwithdecimalpropertiesmapbuilder) | cost(Map value) | -| [ObjectWithDecimalPropertiesMapBuilder](#objectwithdecimalpropertiesmapbuilder) | additionalProperty(String key, Nothing? value) | -| [ObjectWithDecimalPropertiesMapBuilder](#objectwithdecimalpropertiesmapbuilder) | additionalProperty(String key, boolean value) | -| [ObjectWithDecimalPropertiesMapBuilder](#objectwithdecimalpropertiesmapbuilder) | additionalProperty(String key, String value) | -| [ObjectWithDecimalPropertiesMapBuilder](#objectwithdecimalpropertiesmapbuilder) | additionalProperty(String key, int value) | -| [ObjectWithDecimalPropertiesMapBuilder](#objectwithdecimalpropertiesmapbuilder) | additionalProperty(String key, float value) | -| [ObjectWithDecimalPropertiesMapBuilder](#objectwithdecimalpropertiesmapbuilder) | additionalProperty(String key, long value) | -| [ObjectWithDecimalPropertiesMapBuilder](#objectwithdecimalpropertiesmapbuilder) | additionalProperty(String key, double value) | -| [ObjectWithDecimalPropertiesMapBuilder](#objectwithdecimalpropertiesmapbuilder) | additionalProperty(String key, List value) | -| [ObjectWithDecimalPropertiesMapBuilder](#objectwithdecimalpropertiesmapbuilder) | additionalProperty(String key, Map value) | - -## ObjectWithDecimalPropertiesMap -public static class ObjectWithDecimalPropertiesMap
-extends FrozenMap - -A class to store validated Map payloads - -### Method Summary -| Modifier and Type | Method and Description | -| ----------------- | ---------------------- | -| static [ObjectWithDecimalPropertiesMap](#objectwithdecimalpropertiesmap) | of([Map](#objectwithdecimalpropertiesmapbuilder) arg, SchemaConfiguration configuration) | -| String | length()
[optional] | -| String | width()
[optional] value must be int or float numeric | -| [Money.MoneyMap](../../components/schemas/Money.md#moneymap) | cost()
[optional] | -| @Nullable Object | getAdditionalProperty(String name)
provides type safety for additional properties | - -## WidthBoxed -public sealed interface WidthBoxed
-permits
-[WidthBoxedString](#widthboxedstring) - -sealed interface that stores validated payloads using boxed classes - -## WidthBoxedString -public record WidthBoxedString
-implements [WidthBoxed](#widthboxed) - -record that stores validated String payloads, sealed permits implementation - -### Constructor Summary -| Constructor and Description | -| --------------------------- | -| WidthBoxedString(String data)
Creates an instance, private visibility | - -### Method Summary -| Modifier and Type | Method and Description | -| ----------------- | ---------------------- | -| String | data()
validated payload | -| @Nullable Object | getData()
validated payload | - -## Width -public static class Width
-extends DecimalJsonSchema.DecimalJsonSchema1 - -A schema class that validates payloads - -| Methods Inherited from class org.openapijsonschematools.client.schemas.DecimalJsonSchema.DecimalJsonSchema1 | -| ------------------------------------------------------------------ | -| validate | -| validateAndBox | - -[[Back to top]](#top) [[Back to Component Schemas]](../../../README.md#Component-Schemas) [[Back to README]](../../../README.md) diff --git a/samples/client/petstore/kotlin/docs/components/schemas/ObjectWithDifficultlyNamedProps.md b/samples/client/petstore/kotlin/docs/components/schemas/ObjectWithDifficultlyNamedProps.md deleted file mode 100644 index 91e847076f7..00000000000 --- a/samples/client/petstore/kotlin/docs/components/schemas/ObjectWithDifficultlyNamedProps.md +++ /dev/null @@ -1,276 +0,0 @@ -# ObjectWithDifficultlyNamedProps -org.openapijsonschematools.client.components.schemas.ObjectWithDifficultlyNamedProps.java -public class ObjectWithDifficultlyNamedProps
- -A class that contains necessary nested -- schema classes (which validate payloads), extends JsonSchema -- sealed interfaces which store validated payloads, java version of a sum type -- boxed classes which store validated payloads, sealed permits class implementations -- classes to store validated map payloads, extends FrozenMap -- classes to build inputs for map payloads - -## Nested Class Summary -| Modifier and Type | Class and Description | -| ----------------- | ---------------------- | -| sealed interface | [ObjectWithDifficultlyNamedProps.ObjectWithDifficultlyNamedProps1Boxed](#objectwithdifficultlynamedprops1boxed)
sealed interface for validated payloads | -| record | [ObjectWithDifficultlyNamedProps.ObjectWithDifficultlyNamedProps1BoxedMap](#objectwithdifficultlynamedprops1boxedmap)
boxed class to store validated Map payloads | -| static class | [ObjectWithDifficultlyNamedProps.ObjectWithDifficultlyNamedProps1](#objectwithdifficultlynamedprops1)
schema class | -| static class | [ObjectWithDifficultlyNamedProps.ObjectWithDifficultlyNamedPropsMapBuilder](#objectwithdifficultlynamedpropsmapbuilder)
builder for Map payloads | -| static class | [ObjectWithDifficultlyNamedProps.ObjectWithDifficultlyNamedPropsMap](#objectwithdifficultlynamedpropsmap)
output class for Map payloads | -| sealed interface | [ObjectWithDifficultlyNamedProps.Schema123NumberBoxed](#schema123numberboxed)
sealed interface for validated payloads | -| record | [ObjectWithDifficultlyNamedProps.Schema123NumberBoxedNumber](#schema123numberboxednumber)
boxed class to store validated Number payloads | -| static class | [ObjectWithDifficultlyNamedProps.Schema123Number](#schema123number)
schema class | -| sealed interface | [ObjectWithDifficultlyNamedProps.Schema123listBoxed](#schema123listboxed)
sealed interface for validated payloads | -| record | [ObjectWithDifficultlyNamedProps.Schema123listBoxedString](#schema123listboxedstring)
boxed class to store validated String payloads | -| static class | [ObjectWithDifficultlyNamedProps.Schema123list](#schema123list)
schema class | -| sealed interface | [ObjectWithDifficultlyNamedProps.SpecialpropertynameBoxed](#specialpropertynameboxed)
sealed interface for validated payloads | -| record | [ObjectWithDifficultlyNamedProps.SpecialpropertynameBoxedNumber](#specialpropertynameboxednumber)
boxed class to store validated Number payloads | -| static class | [ObjectWithDifficultlyNamedProps.Specialpropertyname](#specialpropertyname)
schema class | - -## ObjectWithDifficultlyNamedProps1Boxed -public sealed interface ObjectWithDifficultlyNamedProps1Boxed
-permits
-[ObjectWithDifficultlyNamedProps1BoxedMap](#objectwithdifficultlynamedprops1boxedmap) - -sealed interface that stores validated payloads using boxed classes - -## ObjectWithDifficultlyNamedProps1BoxedMap -public record ObjectWithDifficultlyNamedProps1BoxedMap
-implements [ObjectWithDifficultlyNamedProps1Boxed](#objectwithdifficultlynamedprops1boxed) - -record that stores validated Map payloads, sealed permits implementation - -### Constructor Summary -| Constructor and Description | -| --------------------------- | -| ObjectWithDifficultlyNamedProps1BoxedMap([ObjectWithDifficultlyNamedPropsMap](#objectwithdifficultlynamedpropsmap) data)
Creates an instance, private visibility | - -### Method Summary -| Modifier and Type | Method and Description | -| ----------------- | ---------------------- | -| [ObjectWithDifficultlyNamedPropsMap](#objectwithdifficultlynamedpropsmap) | data()
validated payload | -| @Nullable Object | getData()
validated payload | - -## ObjectWithDifficultlyNamedProps1 -public static class ObjectWithDifficultlyNamedProps1
-extends JsonSchema - -A schema class that validates payloads - -## Description -model with properties that have invalid names for python - -### Code Sample -``` -import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags; -import org.openapijsonschematools.client.configurations.SchemaConfiguration; -import org.openapijsonschematools.client.exceptions.ValidationException; -import org.openapijsonschematools.client.schemas.validation.MapUtils; -import org.openapijsonschematools.client.schemas.validation.FrozenList; -import org.openapijsonschematools.client.schemas.validation.FrozenMap; -import org.openapijsonschematools.client.components.schemas.ObjectWithDifficultlyNamedProps; - -import java.util.Arrays; -import java.util.List; -import java.util.AbstractMap; - -static final SchemaConfiguration configuration = new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().build()); - -// Map validation -ObjectWithDifficultlyNamedProps.ObjectWithDifficultlyNamedPropsMap validatedPayload = - ObjectWithDifficultlyNamedProps.ObjectWithDifficultlyNamedProps1.validate( - new ObjectWithDifficultlyNamedProps.ObjectWithDifficultlyNamedPropsMapBuilder() - .digitOne23HyphenMinusList("a") - - .dollarSignSpecialLeftSquareBracketPropertyFullStopNameRightSquareBracket(1L) - - .digitOne23number(1) - - .build(), - configuration -); -``` - -### Field Summary -| Modifier and Type | Field and Description | -| ----------------- | ---------------------- | -| Set> | type = Set.of(Map.class) | -| Map> | properties = Map.ofEntries(
    new PropertyEntry("$special[property.name]", [Specialpropertyname.class](#specialpropertyname))),
    new PropertyEntry("123-list", [Schema123list.class](#schema123list))),
    new PropertyEntry("123Number", [Schema123Number.class](#schema123number)))
)
| -| Set | required = Set.of(
    "123-list"
)
| - -### Method Summary -| Modifier and Type | Method and Description | -| ----------------- | ---------------------- | -| [ObjectWithDifficultlyNamedPropsMap](#objectwithdifficultlynamedpropsmap) | validate([Map<?, ?>](#objectwithdifficultlynamedpropsmapbuilder) arg, SchemaConfiguration configuration) | -| [ObjectWithDifficultlyNamedProps1BoxedMap](#objectwithdifficultlynamedprops1boxedmap) | validateAndBox([Map<?, ?>](#objectwithdifficultlynamedpropsmapbuilder) arg, SchemaConfiguration configuration) | -| [ObjectWithDifficultlyNamedProps1Boxed](#objectwithdifficultlynamedprops1boxed) | validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) | -| @Nullable Object | validate(@Nullable Object arg, SchemaConfiguration configuration) | - -## ObjectWithDifficultlyNamedPropsMap0Builder -public class ObjectWithDifficultlyNamedPropsMap0Builder
-builder for `Map` - -A class that builds the Map input type - -### Constructor Summary -| Constructor and Description | -| --------------------------- | -| ObjectWithDifficultlyNamedPropsMap0Builder(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 | -| [ObjectWithDifficultlyNamedPropsMap0Builder](#objectwithdifficultlynamedpropsmap0builder) | dollarSignSpecialLeftSquareBracketPropertyFullStopNameRightSquareBracket(int value) | -| [ObjectWithDifficultlyNamedPropsMap0Builder](#objectwithdifficultlynamedpropsmap0builder) | dollarSignSpecialLeftSquareBracketPropertyFullStopNameRightSquareBracket(float value) | -| [ObjectWithDifficultlyNamedPropsMap0Builder](#objectwithdifficultlynamedpropsmap0builder) | dollarSignSpecialLeftSquareBracketPropertyFullStopNameRightSquareBracket(long value) | -| [ObjectWithDifficultlyNamedPropsMap0Builder](#objectwithdifficultlynamedpropsmap0builder) | dollarSignSpecialLeftSquareBracketPropertyFullStopNameRightSquareBracket(double value) | -| [ObjectWithDifficultlyNamedPropsMap0Builder](#objectwithdifficultlynamedpropsmap0builder) | digitOne23number(int value) | -| [ObjectWithDifficultlyNamedPropsMap0Builder](#objectwithdifficultlynamedpropsmap0builder) | digitOne23number(float value) | -| [ObjectWithDifficultlyNamedPropsMap0Builder](#objectwithdifficultlynamedpropsmap0builder) | digitOne23number(long value) | -| [ObjectWithDifficultlyNamedPropsMap0Builder](#objectwithdifficultlynamedpropsmap0builder) | digitOne23number(double value) | -| [ObjectWithDifficultlyNamedPropsMap0Builder](#objectwithdifficultlynamedpropsmap0builder) | additionalProperty(String key, Nothing? value) | -| [ObjectWithDifficultlyNamedPropsMap0Builder](#objectwithdifficultlynamedpropsmap0builder) | additionalProperty(String key, boolean value) | -| [ObjectWithDifficultlyNamedPropsMap0Builder](#objectwithdifficultlynamedpropsmap0builder) | additionalProperty(String key, String value) | -| [ObjectWithDifficultlyNamedPropsMap0Builder](#objectwithdifficultlynamedpropsmap0builder) | additionalProperty(String key, int value) | -| [ObjectWithDifficultlyNamedPropsMap0Builder](#objectwithdifficultlynamedpropsmap0builder) | additionalProperty(String key, float value) | -| [ObjectWithDifficultlyNamedPropsMap0Builder](#objectwithdifficultlynamedpropsmap0builder) | additionalProperty(String key, long value) | -| [ObjectWithDifficultlyNamedPropsMap0Builder](#objectwithdifficultlynamedpropsmap0builder) | additionalProperty(String key, double value) | -| [ObjectWithDifficultlyNamedPropsMap0Builder](#objectwithdifficultlynamedpropsmap0builder) | additionalProperty(String key, List value) | -| [ObjectWithDifficultlyNamedPropsMap0Builder](#objectwithdifficultlynamedpropsmap0builder) | additionalProperty(String key, Map value) | - -## ObjectWithDifficultlyNamedPropsMapBuilder -public class ObjectWithDifficultlyNamedPropsMapBuilder
-builder for `Map` - -A class that builds the Map input type - -### Constructor Summary -| Constructor and Description | -| --------------------------- | -| ObjectWithDifficultlyNamedPropsMapBuilder()
Creates a builder that contains an empty map | - -### Method Summary -| Modifier and Type | Method and Description | -| ----------------- | ---------------------- | -| [ObjectWithDifficultlyNamedPropsMap0Builder](#objectwithdifficultlynamedpropsmap0builder) | digitOne23HyphenMinusList(String value) | - -## ObjectWithDifficultlyNamedPropsMap -public static class ObjectWithDifficultlyNamedPropsMap
-extends FrozenMap - -A class to store validated Map payloads - -### Method Summary -| Modifier and Type | Method and Description | -| ----------------- | ---------------------- | -| static [ObjectWithDifficultlyNamedPropsMap](#objectwithdifficultlynamedpropsmap) | of([Map](#objectwithdifficultlynamedpropsmapbuilder) arg, SchemaConfiguration configuration) | -| @Nullable Object | get(String key)
This schema has invalid Java names so this method must be used when you access instance["123-list"], instance["$special[property.name]"], instance["123Number"], | -| @Nullable Object | getAdditionalProperty(String name)
provides type safety for additional properties | - -## Schema123NumberBoxed -public sealed interface Schema123NumberBoxed
-permits
-[Schema123NumberBoxedNumber](#schema123numberboxednumber) - -sealed interface that stores validated payloads using boxed classes - -## Schema123NumberBoxedNumber -public record Schema123NumberBoxedNumber
-implements [Schema123NumberBoxed](#schema123numberboxed) - -record that stores validated Number payloads, sealed permits implementation - -### Constructor Summary -| Constructor and Description | -| --------------------------- | -| Schema123NumberBoxedNumber(Number data)
Creates an instance, private visibility | - -### Method Summary -| Modifier and Type | Method and Description | -| ----------------- | ---------------------- | -| Number | data()
validated payload | -| @Nullable Object | getData()
validated payload | - -## Schema123Number -public static class Schema123Number
-extends IntJsonSchema.IntJsonSchema1 - -A schema class that validates payloads - -| Methods Inherited from class org.openapijsonschematools.client.schemas.IntJsonSchema.IntJsonSchema1 | -| ------------------------------------------------------------------ | -| validate | -| validateAndBox | - -## Schema123listBoxed -public sealed interface Schema123listBoxed
-permits
-[Schema123listBoxedString](#schema123listboxedstring) - -sealed interface that stores validated payloads using boxed classes - -## Schema123listBoxedString -public record Schema123listBoxedString
-implements [Schema123listBoxed](#schema123listboxed) - -record that stores validated String payloads, sealed permits implementation - -### Constructor Summary -| Constructor and Description | -| --------------------------- | -| Schema123listBoxedString(String data)
Creates an instance, private visibility | - -### Method Summary -| Modifier and Type | Method and Description | -| ----------------- | ---------------------- | -| String | data()
validated payload | -| @Nullable Object | getData()
validated payload | - -## Schema123list -public static class Schema123list
-extends StringJsonSchema.StringJsonSchema1 - -A schema class that validates payloads - -| Methods Inherited from class org.openapijsonschematools.client.schemas.StringJsonSchema.StringJsonSchema1 | -| ------------------------------------------------------------------ | -| validate | -| validateAndBox | - -## SpecialpropertynameBoxed -public sealed interface SpecialpropertynameBoxed
-permits
-[SpecialpropertynameBoxedNumber](#specialpropertynameboxednumber) - -sealed interface that stores validated payloads using boxed classes - -## SpecialpropertynameBoxedNumber -public record SpecialpropertynameBoxedNumber
-implements [SpecialpropertynameBoxed](#specialpropertynameboxed) - -record that stores validated Number payloads, sealed permits implementation - -### Constructor Summary -| Constructor and Description | -| --------------------------- | -| SpecialpropertynameBoxedNumber(Number data)
Creates an instance, private visibility | - -### Method Summary -| Modifier and Type | Method and Description | -| ----------------- | ---------------------- | -| Number | data()
validated payload | -| @Nullable Object | getData()
validated payload | - -## Specialpropertyname -public static class Specialpropertyname
-extends Int64JsonSchema.Int64JsonSchema1 - -A schema class that validates payloads - -| Methods Inherited from class org.openapijsonschematools.client.schemas.Int64JsonSchema.Int64JsonSchema1 | -| ------------------------------------------------------------------ | -| validate | -| validateAndBox | - -[[Back to top]](#top) [[Back to Component Schemas]](../../../README.md#Component-Schemas) [[Back to README]](../../../README.md) diff --git a/samples/client/petstore/kotlin/docs/components/schemas/ObjectWithInlineCompositionProperty.md b/samples/client/petstore/kotlin/docs/components/schemas/ObjectWithInlineCompositionProperty.md deleted file mode 100644 index 1cc319ecbf9..00000000000 --- a/samples/client/petstore/kotlin/docs/components/schemas/ObjectWithInlineCompositionProperty.md +++ /dev/null @@ -1,362 +0,0 @@ -# ObjectWithInlineCompositionProperty -org.openapijsonschematools.client.components.schemas.ObjectWithInlineCompositionProperty.java -public class ObjectWithInlineCompositionProperty
- -A class that contains necessary nested -- schema classes (which validate payloads), extends JsonSchema -- sealed interfaces which store validated payloads, java version of a sum type -- boxed classes which store validated payloads, sealed permits class implementations -- classes to store validated map payloads, extends FrozenMap -- classes to build inputs for map payloads - -## Nested Class Summary -| Modifier and Type | Class and Description | -| ----------------- | ---------------------- | -| sealed interface | [ObjectWithInlineCompositionProperty.ObjectWithInlineCompositionProperty1Boxed](#objectwithinlinecompositionproperty1boxed)
sealed interface for validated payloads | -| record | [ObjectWithInlineCompositionProperty.ObjectWithInlineCompositionProperty1BoxedMap](#objectwithinlinecompositionproperty1boxedmap)
boxed class to store validated Map payloads | -| static class | [ObjectWithInlineCompositionProperty.ObjectWithInlineCompositionProperty1](#objectwithinlinecompositionproperty1)
schema class | -| static class | [ObjectWithInlineCompositionProperty.ObjectWithInlineCompositionPropertyMapBuilder](#objectwithinlinecompositionpropertymapbuilder)
builder for Map payloads | -| static class | [ObjectWithInlineCompositionProperty.ObjectWithInlineCompositionPropertyMap](#objectwithinlinecompositionpropertymap)
output class for Map payloads | -| sealed interface | [ObjectWithInlineCompositionProperty.SomePropBoxed](#somepropboxed)
sealed interface for validated payloads | -| record | [ObjectWithInlineCompositionProperty.SomePropBoxedVoid](#somepropboxedvoid)
boxed class to store validated null payloads | -| record | [ObjectWithInlineCompositionProperty.SomePropBoxedBoolean](#somepropboxedboolean)
boxed class to store validated boolean payloads | -| record | [ObjectWithInlineCompositionProperty.SomePropBoxedNumber](#somepropboxednumber)
boxed class to store validated Number payloads | -| record | [ObjectWithInlineCompositionProperty.SomePropBoxedString](#somepropboxedstring)
boxed class to store validated String payloads | -| record | [ObjectWithInlineCompositionProperty.SomePropBoxedList](#somepropboxedlist)
boxed class to store validated List payloads | -| record | [ObjectWithInlineCompositionProperty.SomePropBoxedMap](#somepropboxedmap)
boxed class to store validated Map payloads | -| static class | [ObjectWithInlineCompositionProperty.SomeProp](#someprop)
schema class | -| sealed interface | [ObjectWithInlineCompositionProperty.Schema0Boxed](#schema0boxed)
sealed interface for validated payloads | -| record | [ObjectWithInlineCompositionProperty.Schema0BoxedString](#schema0boxedstring)
boxed class to store validated String payloads | -| static class | [ObjectWithInlineCompositionProperty.Schema0](#schema0)
schema class | - -## ObjectWithInlineCompositionProperty1Boxed -public sealed interface ObjectWithInlineCompositionProperty1Boxed
-permits
-[ObjectWithInlineCompositionProperty1BoxedMap](#objectwithinlinecompositionproperty1boxedmap) - -sealed interface that stores validated payloads using boxed classes - -## ObjectWithInlineCompositionProperty1BoxedMap -public record ObjectWithInlineCompositionProperty1BoxedMap
-implements [ObjectWithInlineCompositionProperty1Boxed](#objectwithinlinecompositionproperty1boxed) - -record that stores validated Map payloads, sealed permits implementation - -### Constructor Summary -| Constructor and Description | -| --------------------------- | -| ObjectWithInlineCompositionProperty1BoxedMap([ObjectWithInlineCompositionPropertyMap](#objectwithinlinecompositionpropertymap) data)
Creates an instance, private visibility | - -### Method Summary -| Modifier and Type | Method and Description | -| ----------------- | ---------------------- | -| [ObjectWithInlineCompositionPropertyMap](#objectwithinlinecompositionpropertymap) | data()
validated payload | -| @Nullable Object | getData()
validated payload | - -## ObjectWithInlineCompositionProperty1 -public static class ObjectWithInlineCompositionProperty1
-extends JsonSchema - -A schema class that validates payloads - -### Code Sample -``` -import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags; -import org.openapijsonschematools.client.configurations.SchemaConfiguration; -import org.openapijsonschematools.client.exceptions.ValidationException; -import org.openapijsonschematools.client.schemas.validation.MapUtils; -import org.openapijsonschematools.client.schemas.validation.FrozenList; -import org.openapijsonschematools.client.schemas.validation.FrozenMap; -import org.openapijsonschematools.client.components.schemas.ObjectWithInlineCompositionProperty; - -import java.util.Arrays; -import java.util.List; -import java.util.AbstractMap; - -static final SchemaConfiguration configuration = new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().build()); - -// Map validation -ObjectWithInlineCompositionProperty.ObjectWithInlineCompositionPropertyMap validatedPayload = - ObjectWithInlineCompositionProperty.ObjectWithInlineCompositionProperty1.validate( - new ObjectWithInlineCompositionProperty.ObjectWithInlineCompositionPropertyMapBuilder() - .build(), - configuration -); -``` - -### Field Summary -| Modifier and Type | Field and Description | -| ----------------- | ---------------------- | -| Set> | type = Set.of(Map.class) | -| Map> | properties = Map.ofEntries(
    new PropertyEntry("someProp", [SomeProp.class](#someprop)))
)
| - -### Method Summary -| Modifier and Type | Method and Description | -| ----------------- | ---------------------- | -| [ObjectWithInlineCompositionPropertyMap](#objectwithinlinecompositionpropertymap) | validate([Map<?, ?>](#objectwithinlinecompositionpropertymapbuilder) arg, SchemaConfiguration configuration) | -| [ObjectWithInlineCompositionProperty1BoxedMap](#objectwithinlinecompositionproperty1boxedmap) | validateAndBox([Map<?, ?>](#objectwithinlinecompositionpropertymapbuilder) arg, SchemaConfiguration configuration) | -| [ObjectWithInlineCompositionProperty1Boxed](#objectwithinlinecompositionproperty1boxed) | validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) | -| @Nullable Object | validate(@Nullable Object arg, SchemaConfiguration configuration) | - -## ObjectWithInlineCompositionPropertyMapBuilder -public class ObjectWithInlineCompositionPropertyMapBuilder
-builder for `Map` - -A class that builds the Map input type - -### Constructor Summary -| Constructor and Description | -| --------------------------- | -| ObjectWithInlineCompositionPropertyMapBuilder()
Creates a builder that contains an empty map | - -### Method Summary -| Modifier and Type | Method and Description | -| ----------------- | ---------------------- | -| Map | build()
Returns map input that should be used with Schema.validate | -| [ObjectWithInlineCompositionPropertyMapBuilder](#objectwithinlinecompositionpropertymapbuilder) | someProp(Nothing? value) | -| [ObjectWithInlineCompositionPropertyMapBuilder](#objectwithinlinecompositionpropertymapbuilder) | someProp(boolean value) | -| [ObjectWithInlineCompositionPropertyMapBuilder](#objectwithinlinecompositionpropertymapbuilder) | someProp(String value) | -| [ObjectWithInlineCompositionPropertyMapBuilder](#objectwithinlinecompositionpropertymapbuilder) | someProp(int value) | -| [ObjectWithInlineCompositionPropertyMapBuilder](#objectwithinlinecompositionpropertymapbuilder) | someProp(float value) | -| [ObjectWithInlineCompositionPropertyMapBuilder](#objectwithinlinecompositionpropertymapbuilder) | someProp(long value) | -| [ObjectWithInlineCompositionPropertyMapBuilder](#objectwithinlinecompositionpropertymapbuilder) | someProp(double value) | -| [ObjectWithInlineCompositionPropertyMapBuilder](#objectwithinlinecompositionpropertymapbuilder) | someProp(List value) | -| [ObjectWithInlineCompositionPropertyMapBuilder](#objectwithinlinecompositionpropertymapbuilder) | someProp(Map value) | -| [ObjectWithInlineCompositionPropertyMapBuilder](#objectwithinlinecompositionpropertymapbuilder) | additionalProperty(String key, Nothing? value) | -| [ObjectWithInlineCompositionPropertyMapBuilder](#objectwithinlinecompositionpropertymapbuilder) | additionalProperty(String key, boolean value) | -| [ObjectWithInlineCompositionPropertyMapBuilder](#objectwithinlinecompositionpropertymapbuilder) | additionalProperty(String key, String value) | -| [ObjectWithInlineCompositionPropertyMapBuilder](#objectwithinlinecompositionpropertymapbuilder) | additionalProperty(String key, int value) | -| [ObjectWithInlineCompositionPropertyMapBuilder](#objectwithinlinecompositionpropertymapbuilder) | additionalProperty(String key, float value) | -| [ObjectWithInlineCompositionPropertyMapBuilder](#objectwithinlinecompositionpropertymapbuilder) | additionalProperty(String key, long value) | -| [ObjectWithInlineCompositionPropertyMapBuilder](#objectwithinlinecompositionpropertymapbuilder) | additionalProperty(String key, double value) | -| [ObjectWithInlineCompositionPropertyMapBuilder](#objectwithinlinecompositionpropertymapbuilder) | additionalProperty(String key, List value) | -| [ObjectWithInlineCompositionPropertyMapBuilder](#objectwithinlinecompositionpropertymapbuilder) | additionalProperty(String key, Map value) | - -## ObjectWithInlineCompositionPropertyMap -public static class ObjectWithInlineCompositionPropertyMap
-extends FrozenMap - -A class to store validated Map payloads - -### Method Summary -| Modifier and Type | Method and Description | -| ----------------- | ---------------------- | -| static [ObjectWithInlineCompositionPropertyMap](#objectwithinlinecompositionpropertymap) | of([Map](#objectwithinlinecompositionpropertymapbuilder) arg, SchemaConfiguration configuration) | -| @Nullable Object | someProp()
[optional] | -| @Nullable Object | getAdditionalProperty(String name)
provides type safety for additional properties | - -## SomePropBoxed -public sealed interface SomePropBoxed
-permits
-[SomePropBoxedVoid](#somepropboxedvoid), -[SomePropBoxedBoolean](#somepropboxedboolean), -[SomePropBoxedNumber](#somepropboxednumber), -[SomePropBoxedString](#somepropboxedstring), -[SomePropBoxedList](#somepropboxedlist), -[SomePropBoxedMap](#somepropboxedmap) - -sealed interface that stores validated payloads using boxed classes - -## SomePropBoxedVoid -public record SomePropBoxedVoid
-implements [SomePropBoxed](#somepropboxed) - -record that stores validated null payloads, sealed permits implementation - -### Constructor Summary -| Constructor and Description | -| --------------------------- | -| SomePropBoxedVoid(Nothing? data)
Creates an instance, private visibility | - -### Method Summary -| Modifier and Type | Method and Description | -| ----------------- | ---------------------- | -| Nothing? | data()
validated payload | -| @Nullable Object | getData()
validated payload | - -## SomePropBoxedBoolean -public record SomePropBoxedBoolean
-implements [SomePropBoxed](#somepropboxed) - -record that stores validated boolean payloads, sealed permits implementation - -### Constructor Summary -| Constructor and Description | -| --------------------------- | -| SomePropBoxedBoolean(boolean data)
Creates an instance, private visibility | - -### Method Summary -| Modifier and Type | Method and Description | -| ----------------- | ---------------------- | -| boolean | data()
validated payload | -| @Nullable Object | getData()
validated payload | - -## SomePropBoxedNumber -public record SomePropBoxedNumber
-implements [SomePropBoxed](#somepropboxed) - -record that stores validated Number payloads, sealed permits implementation - -### Constructor Summary -| Constructor and Description | -| --------------------------- | -| SomePropBoxedNumber(Number data)
Creates an instance, private visibility | - -### Method Summary -| Modifier and Type | Method and Description | -| ----------------- | ---------------------- | -| Number | data()
validated payload | -| @Nullable Object | getData()
validated payload | - -## SomePropBoxedString -public record SomePropBoxedString
-implements [SomePropBoxed](#somepropboxed) - -record that stores validated String payloads, sealed permits implementation - -### Constructor Summary -| Constructor and Description | -| --------------------------- | -| SomePropBoxedString(String data)
Creates an instance, private visibility | - -### Method Summary -| Modifier and Type | Method and Description | -| ----------------- | ---------------------- | -| String | data()
validated payload | -| @Nullable Object | getData()
validated payload | - -## SomePropBoxedList -public record SomePropBoxedList
-implements [SomePropBoxed](#somepropboxed) - -record that stores validated List payloads, sealed permits implementation - -### Constructor Summary -| Constructor and Description | -| --------------------------- | -| SomePropBoxedList(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 | - -## SomePropBoxedMap -public record SomePropBoxedMap
-implements [SomePropBoxed](#somepropboxed) - -record that stores validated Map payloads, sealed permits implementation - -### Constructor Summary -| Constructor and Description | -| --------------------------- | -| SomePropBoxedMap(FrozenMap<@Nullable Object> data)
Creates an instance, private visibility | - -### Method Summary -| Modifier and Type | Method and Description | -| ----------------- | ---------------------- | -| FrozenMap<@Nullable Object> | data()
validated payload | -| @Nullable Object | getData()
validated payload | - -## SomeProp -public static class SomeProp
-extends JsonSchema - -A schema class that validates payloads - -### Field Summary -| Modifier and Type | Field and Description | -| ----------------- | ---------------------- | -| List> | allOf = List.of(
    [Schema0.class](#schema0)
;)
| - -### Method Summary -| Modifier and Type | Method and Description | -| ----------------- | ---------------------- | -| String | validate(String arg, SchemaConfiguration configuration) | -| Nothing? | validate(Nothing? arg, SchemaConfiguration configuration) | -| int | validate(int arg, SchemaConfiguration configuration) | -| long | validate(long arg, SchemaConfiguration configuration) | -| float | validate(float arg, SchemaConfiguration configuration) | -| double | validate(double arg, SchemaConfiguration configuration) | -| Number | validate(Number arg, SchemaConfiguration configuration) | -| boolean | validate(boolean arg, SchemaConfiguration configuration) | -| FrozenMap<@Nullable Object> | validate(Map<?, ?> arg, SchemaConfiguration configuration) | -| FrozenList<@Nullable Object> | validate(List arg, SchemaConfiguration configuration) | -| [SomePropBoxedString](#somepropboxedstring) | validateAndBox(String arg, SchemaConfiguration configuration) | -| [SomePropBoxedVoid](#somepropboxedvoid) | validateAndBox(Nothing? arg, SchemaConfiguration configuration) | -| [SomePropBoxedNumber](#somepropboxednumber) | validateAndBox(Number arg, SchemaConfiguration configuration) | -| [SomePropBoxedBoolean](#somepropboxedboolean) | validateAndBox(boolean arg, SchemaConfiguration configuration) | -| [SomePropBoxedMap](#somepropboxedmap) | validateAndBox(Map<?, ?> arg, SchemaConfiguration configuration) | -| [SomePropBoxedList](#somepropboxedlist) | validateAndBox(List arg, SchemaConfiguration configuration) | -| [SomePropBoxed](#somepropboxed) | validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) | -| @Nullable Object | validate(@Nullable Object arg, SchemaConfiguration configuration) | - -## Schema0Boxed -public sealed interface Schema0Boxed
-permits
-[Schema0BoxedString](#schema0boxedstring) - -sealed interface that stores validated payloads using boxed classes - -## Schema0BoxedString -public record Schema0BoxedString
-implements [Schema0Boxed](#schema0boxed) - -record that stores validated String payloads, sealed permits implementation - -### Constructor Summary -| Constructor and Description | -| --------------------------- | -| Schema0BoxedString(String data)
Creates an instance, private visibility | - -### Method Summary -| Modifier and Type | Method and Description | -| ----------------- | ---------------------- | -| String | data()
validated payload | -| @Nullable Object | getData()
validated payload | - -## Schema0 -public static class Schema0
-extends JsonSchema - -A schema class that validates payloads - -### Code Sample -``` -import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags; -import org.openapijsonschematools.client.configurations.SchemaConfiguration; -import org.openapijsonschematools.client.exceptions.ValidationException; -import org.openapijsonschematools.client.schemas.validation.MapUtils; -import org.openapijsonschematools.client.schemas.validation.FrozenList; -import org.openapijsonschematools.client.schemas.validation.FrozenMap; -import org.openapijsonschematools.client.components.schemas.ObjectWithInlineCompositionProperty; - -import java.util.Arrays; -import java.util.List; -import java.util.AbstractMap; - -static final SchemaConfiguration configuration = new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().build()); - -// String validation -String validatedPayload = ObjectWithInlineCompositionProperty.Schema0.validate( - "a", - configuration -); -``` - -### Field Summary -| Modifier and Type | Field and Description | -| ----------------- | ---------------------- | -| Set> | type = Set.of(
    String.class
)
| -| Integer | minLength = 1 | - -### Method Summary -| Modifier and Type | Method and Description | -| ----------------- | ---------------------- | -| String | validate(String arg, SchemaConfiguration configuration) | -| [Schema0BoxedString](#schema0boxedstring) | validateAndBox(String arg, SchemaConfiguration configuration) | -| [Schema0Boxed](#schema0boxed) | validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) | -| @Nullable Object | validate(@Nullable Object arg, SchemaConfiguration configuration) | - -[[Back to top]](#top) [[Back to Component Schemas]](../../../README.md#Component-Schemas) [[Back to README]](../../../README.md) diff --git a/samples/client/petstore/kotlin/docs/components/schemas/ObjectWithInvalidNamedRefedProperties.md b/samples/client/petstore/kotlin/docs/components/schemas/ObjectWithInvalidNamedRefedProperties.md deleted file mode 100644 index a70ea28ffb1..00000000000 --- a/samples/client/petstore/kotlin/docs/components/schemas/ObjectWithInvalidNamedRefedProperties.md +++ /dev/null @@ -1,196 +0,0 @@ -# ObjectWithInvalidNamedRefedProperties -org.openapijsonschematools.client.components.schemas.ObjectWithInvalidNamedRefedProperties.java -public class ObjectWithInvalidNamedRefedProperties
- -A class that contains necessary nested -- schema classes (which validate payloads), extends JsonSchema -- sealed interfaces which store validated payloads, java version of a sum type -- boxed classes which store validated payloads, sealed permits class implementations -- classes to store validated map payloads, extends FrozenMap -- classes to build inputs for map payloads - -## Nested Class Summary -| Modifier and Type | Class and Description | -| ----------------- | ---------------------- | -| sealed interface | [ObjectWithInvalidNamedRefedProperties.ObjectWithInvalidNamedRefedProperties1Boxed](#objectwithinvalidnamedrefedproperties1boxed)
sealed interface for validated payloads | -| record | [ObjectWithInvalidNamedRefedProperties.ObjectWithInvalidNamedRefedProperties1BoxedMap](#objectwithinvalidnamedrefedproperties1boxedmap)
boxed class to store validated Map payloads | -| static class | [ObjectWithInvalidNamedRefedProperties.ObjectWithInvalidNamedRefedProperties1](#objectwithinvalidnamedrefedproperties1)
schema class | -| static class | [ObjectWithInvalidNamedRefedProperties.ObjectWithInvalidNamedRefedPropertiesMapBuilder](#objectwithinvalidnamedrefedpropertiesmapbuilder)
builder for Map payloads | -| static class | [ObjectWithInvalidNamedRefedProperties.ObjectWithInvalidNamedRefedPropertiesMap](#objectwithinvalidnamedrefedpropertiesmap)
output class for Map payloads | - -## ObjectWithInvalidNamedRefedProperties1Boxed -public sealed interface ObjectWithInvalidNamedRefedProperties1Boxed
-permits
-[ObjectWithInvalidNamedRefedProperties1BoxedMap](#objectwithinvalidnamedrefedproperties1boxedmap) - -sealed interface that stores validated payloads using boxed classes - -## ObjectWithInvalidNamedRefedProperties1BoxedMap -public record ObjectWithInvalidNamedRefedProperties1BoxedMap
-implements [ObjectWithInvalidNamedRefedProperties1Boxed](#objectwithinvalidnamedrefedproperties1boxed) - -record that stores validated Map payloads, sealed permits implementation - -### Constructor Summary -| Constructor and Description | -| --------------------------- | -| ObjectWithInvalidNamedRefedProperties1BoxedMap([ObjectWithInvalidNamedRefedPropertiesMap](#objectwithinvalidnamedrefedpropertiesmap) data)
Creates an instance, private visibility | - -### Method Summary -| Modifier and Type | Method and Description | -| ----------------- | ---------------------- | -| [ObjectWithInvalidNamedRefedPropertiesMap](#objectwithinvalidnamedrefedpropertiesmap) | data()
validated payload | -| @Nullable Object | getData()
validated payload | - -## ObjectWithInvalidNamedRefedProperties1 -public static class ObjectWithInvalidNamedRefedProperties1
-extends JsonSchema - -A schema class that validates payloads - -### Code Sample -``` -import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags; -import org.openapijsonschematools.client.configurations.SchemaConfiguration; -import org.openapijsonschematools.client.exceptions.ValidationException; -import org.openapijsonschematools.client.schemas.validation.MapUtils; -import org.openapijsonschematools.client.schemas.validation.FrozenList; -import org.openapijsonschematools.client.schemas.validation.FrozenMap; -import org.openapijsonschematools.client.components.schemas.ObjectWithInvalidNamedRefedProperties; - -import java.util.Arrays; -import java.util.List; -import java.util.AbstractMap; - -static final SchemaConfiguration configuration = new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().build()); - -// Map validation -ObjectWithInvalidNamedRefedProperties.ObjectWithInvalidNamedRefedPropertiesMap validatedPayload = - ObjectWithInvalidNamedRefedProperties.ObjectWithInvalidNamedRefedProperties1.validate( - new ObjectWithInvalidNamedRefedProperties.ObjectWithInvalidNamedRefedPropertiesMapBuilder() - .exclamationMarkReference( - Arrays.asList( - 1L - ) - ) - .from( - MapUtils.makeMap( - new AbstractMap.SimpleEntry( - "data", - "a" - ), - new AbstractMap.SimpleEntry( - "id", - 1 - ) - ) - ) - .build(), - configuration -); -``` - -### Field Summary -| Modifier and Type | Field and Description | -| ----------------- | ---------------------- | -| Set> | type = Set.of(Map.class) | -| Map> | properties = Map.ofEntries(
    new PropertyEntry("from", [FromSchema.FromSchema1.class](../../components/schemas/FromSchema.md#fromschema1)),
    new PropertyEntry("!reference", [ArrayWithValidationsInItems.ArrayWithValidationsInItems1.class](../../components/schemas/ArrayWithValidationsInItems.md#arraywithvalidationsinitems1))
)
| -| Set | required = Set.of(
    "!reference",
    "from"
)
| - -### Method Summary -| Modifier and Type | Method and Description | -| ----------------- | ---------------------- | -| [ObjectWithInvalidNamedRefedPropertiesMap](#objectwithinvalidnamedrefedpropertiesmap) | validate([Map<?, ?>](#objectwithinvalidnamedrefedpropertiesmapbuilder) arg, SchemaConfiguration configuration) | -| [ObjectWithInvalidNamedRefedProperties1BoxedMap](#objectwithinvalidnamedrefedproperties1boxedmap) | validateAndBox([Map<?, ?>](#objectwithinvalidnamedrefedpropertiesmapbuilder) arg, SchemaConfiguration configuration) | -| [ObjectWithInvalidNamedRefedProperties1Boxed](#objectwithinvalidnamedrefedproperties1boxed) | validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) | -| @Nullable Object | validate(@Nullable Object arg, SchemaConfiguration configuration) | - -## ObjectWithInvalidNamedRefedPropertiesMap00Builder -public class ObjectWithInvalidNamedRefedPropertiesMap00Builder
-builder for `Map` - -A class that builds the Map input type - -### Constructor Summary -| Constructor and Description | -| --------------------------- | -| ObjectWithInvalidNamedRefedPropertiesMap00Builder(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 | -| [ObjectWithInvalidNamedRefedPropertiesMap00Builder](#objectwithinvalidnamedrefedpropertiesmap00builder) | additionalProperty(String key, Nothing? value) | -| [ObjectWithInvalidNamedRefedPropertiesMap00Builder](#objectwithinvalidnamedrefedpropertiesmap00builder) | additionalProperty(String key, boolean value) | -| [ObjectWithInvalidNamedRefedPropertiesMap00Builder](#objectwithinvalidnamedrefedpropertiesmap00builder) | additionalProperty(String key, String value) | -| [ObjectWithInvalidNamedRefedPropertiesMap00Builder](#objectwithinvalidnamedrefedpropertiesmap00builder) | additionalProperty(String key, int value) | -| [ObjectWithInvalidNamedRefedPropertiesMap00Builder](#objectwithinvalidnamedrefedpropertiesmap00builder) | additionalProperty(String key, float value) | -| [ObjectWithInvalidNamedRefedPropertiesMap00Builder](#objectwithinvalidnamedrefedpropertiesmap00builder) | additionalProperty(String key, long value) | -| [ObjectWithInvalidNamedRefedPropertiesMap00Builder](#objectwithinvalidnamedrefedpropertiesmap00builder) | additionalProperty(String key, double value) | -| [ObjectWithInvalidNamedRefedPropertiesMap00Builder](#objectwithinvalidnamedrefedpropertiesmap00builder) | additionalProperty(String key, List value) | -| [ObjectWithInvalidNamedRefedPropertiesMap00Builder](#objectwithinvalidnamedrefedpropertiesmap00builder) | additionalProperty(String key, Map value) | - -## ObjectWithInvalidNamedRefedPropertiesMap01Builder -public class ObjectWithInvalidNamedRefedPropertiesMap01Builder
-builder for `Map` - -A class that builds the Map input type - -### Constructor Summary -| Constructor and Description | -| --------------------------- | -| ObjectWithInvalidNamedRefedPropertiesMap01Builder(Map instance)
Creates a builder that contains the passed instance | - -### Method Summary -| Modifier and Type | Method and Description | -| ----------------- | ---------------------- | -| [ObjectWithInvalidNamedRefedPropertiesMap00Builder](#objectwithinvalidnamedrefedpropertiesmap00builder) | from(Map value) | - -## ObjectWithInvalidNamedRefedPropertiesMap10Builder -public class ObjectWithInvalidNamedRefedPropertiesMap10Builder
-builder for `Map` - -A class that builds the Map input type - -### Constructor Summary -| Constructor and Description | -| --------------------------- | -| ObjectWithInvalidNamedRefedPropertiesMap10Builder(Map instance)
Creates a builder that contains the passed instance | - -### Method Summary -| Modifier and Type | Method and Description | -| ----------------- | ---------------------- | -| [ObjectWithInvalidNamedRefedPropertiesMap00Builder](#objectwithinvalidnamedrefedpropertiesmap00builder) | exclamationMarkReference(List value) | - -## ObjectWithInvalidNamedRefedPropertiesMapBuilder -public class ObjectWithInvalidNamedRefedPropertiesMapBuilder
-builder for `Map` - -A class that builds the Map input type - -### Constructor Summary -| Constructor and Description | -| --------------------------- | -| ObjectWithInvalidNamedRefedPropertiesMapBuilder()
Creates a builder that contains an empty map | - -### Method Summary -| Modifier and Type | Method and Description | -| ----------------- | ---------------------- | -| [ObjectWithInvalidNamedRefedPropertiesMap01Builder](#objectwithinvalidnamedrefedpropertiesmap01builder) | exclamationMarkReference(List value) | -| [ObjectWithInvalidNamedRefedPropertiesMap10Builder](#objectwithinvalidnamedrefedpropertiesmap10builder) | from(Map value) | - -## ObjectWithInvalidNamedRefedPropertiesMap -public static class ObjectWithInvalidNamedRefedPropertiesMap
-extends FrozenMap - -A class to store validated Map payloads - -### Method Summary -| Modifier and Type | Method and Description | -| ----------------- | ---------------------- | -| static [ObjectWithInvalidNamedRefedPropertiesMap](#objectwithinvalidnamedrefedpropertiesmap) | of([Map](#objectwithinvalidnamedrefedpropertiesmapbuilder) arg, SchemaConfiguration configuration) | -| [FromSchema.FromSchemaMap](../../components/schemas/FromSchema.md#fromschemamap) | from()
| -| @Nullable Object | get(String key)
This schema has invalid Java names so this method must be used when you access instance["!reference"], | -| @Nullable Object | getAdditionalProperty(String name)
provides type safety for additional properties | - -[[Back to top]](#top) [[Back to Component Schemas]](../../../README.md#Component-Schemas) [[Back to README]](../../../README.md) diff --git a/samples/client/petstore/kotlin/docs/components/schemas/ObjectWithNonIntersectingValues.md b/samples/client/petstore/kotlin/docs/components/schemas/ObjectWithNonIntersectingValues.md deleted file mode 100644 index a26f275ad0b..00000000000 --- a/samples/client/petstore/kotlin/docs/components/schemas/ObjectWithNonIntersectingValues.md +++ /dev/null @@ -1,205 +0,0 @@ -# ObjectWithNonIntersectingValues -org.openapijsonschematools.client.components.schemas.ObjectWithNonIntersectingValues.java -public class ObjectWithNonIntersectingValues
- -A class that contains necessary nested -- schema classes (which validate payloads), extends JsonSchema -- sealed interfaces which store validated payloads, java version of a sum type -- boxed classes which store validated payloads, sealed permits class implementations -- classes to store validated map payloads, extends FrozenMap -- classes to build inputs for map payloads - -## Nested Class Summary -| Modifier and Type | Class and Description | -| ----------------- | ---------------------- | -| sealed interface | [ObjectWithNonIntersectingValues.ObjectWithNonIntersectingValues1Boxed](#objectwithnonintersectingvalues1boxed)
sealed interface for validated payloads | -| record | [ObjectWithNonIntersectingValues.ObjectWithNonIntersectingValues1BoxedMap](#objectwithnonintersectingvalues1boxedmap)
boxed class to store validated Map payloads | -| static class | [ObjectWithNonIntersectingValues.ObjectWithNonIntersectingValues1](#objectwithnonintersectingvalues1)
schema class | -| static class | [ObjectWithNonIntersectingValues.ObjectWithNonIntersectingValuesMapBuilder](#objectwithnonintersectingvaluesmapbuilder)
builder for Map payloads | -| static class | [ObjectWithNonIntersectingValues.ObjectWithNonIntersectingValuesMap](#objectwithnonintersectingvaluesmap)
output class for Map payloads | -| sealed interface | [ObjectWithNonIntersectingValues.ABoxed](#aboxed)
sealed interface for validated payloads | -| record | [ObjectWithNonIntersectingValues.ABoxedNumber](#aboxednumber)
boxed class to store validated Number payloads | -| static class | [ObjectWithNonIntersectingValues.A](#a)
schema class | -| sealed interface | [ObjectWithNonIntersectingValues.AdditionalPropertiesBoxed](#additionalpropertiesboxed)
sealed interface for validated payloads | -| record | [ObjectWithNonIntersectingValues.AdditionalPropertiesBoxedString](#additionalpropertiesboxedstring)
boxed class to store validated String payloads | -| static class | [ObjectWithNonIntersectingValues.AdditionalProperties](#additionalproperties)
schema class | - -## ObjectWithNonIntersectingValues1Boxed -public sealed interface ObjectWithNonIntersectingValues1Boxed
-permits
-[ObjectWithNonIntersectingValues1BoxedMap](#objectwithnonintersectingvalues1boxedmap) - -sealed interface that stores validated payloads using boxed classes - -## ObjectWithNonIntersectingValues1BoxedMap -public record ObjectWithNonIntersectingValues1BoxedMap
-implements [ObjectWithNonIntersectingValues1Boxed](#objectwithnonintersectingvalues1boxed) - -record that stores validated Map payloads, sealed permits implementation - -### Constructor Summary -| Constructor and Description | -| --------------------------- | -| ObjectWithNonIntersectingValues1BoxedMap([ObjectWithNonIntersectingValuesMap](#objectwithnonintersectingvaluesmap) data)
Creates an instance, private visibility | - -### Method Summary -| Modifier and Type | Method and Description | -| ----------------- | ---------------------- | -| [ObjectWithNonIntersectingValuesMap](#objectwithnonintersectingvaluesmap) | data()
validated payload | -| @Nullable Object | getData()
validated payload | - -## ObjectWithNonIntersectingValues1 -public static class ObjectWithNonIntersectingValues1
-extends JsonSchema - -A schema class that validates payloads - -### Code Sample -``` -import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags; -import org.openapijsonschematools.client.configurations.SchemaConfiguration; -import org.openapijsonschematools.client.exceptions.ValidationException; -import org.openapijsonschematools.client.schemas.validation.MapUtils; -import org.openapijsonschematools.client.schemas.validation.FrozenList; -import org.openapijsonschematools.client.schemas.validation.FrozenMap; -import org.openapijsonschematools.client.components.schemas.ObjectWithNonIntersectingValues; - -import java.util.Arrays; -import java.util.List; -import java.util.AbstractMap; - -static final SchemaConfiguration configuration = new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().build()); - -// Map validation -ObjectWithNonIntersectingValues.ObjectWithNonIntersectingValuesMap validatedPayload = - ObjectWithNonIntersectingValues.ObjectWithNonIntersectingValues1.validate( - new ObjectWithNonIntersectingValues.ObjectWithNonIntersectingValuesMapBuilder() - .a(1) - - .additionalProperty("someAdditionalProperty", "a") - - .build(), - configuration -); -``` - -### Field Summary -| Modifier and Type | Field and Description | -| ----------------- | ---------------------- | -| Set> | type = Set.of(Map.class) | -| Map> | properties = Map.ofEntries(
    new PropertyEntry("a", [A.class](#a)))
)
| -| Class | additionalProperties = [AdditionalProperties.class](#additionalproperties) | - -### Method Summary -| Modifier and Type | Method and Description | -| ----------------- | ---------------------- | -| [ObjectWithNonIntersectingValuesMap](#objectwithnonintersectingvaluesmap) | validate([Map<?, ?>](#objectwithnonintersectingvaluesmapbuilder) arg, SchemaConfiguration configuration) | -| [ObjectWithNonIntersectingValues1BoxedMap](#objectwithnonintersectingvalues1boxedmap) | validateAndBox([Map<?, ?>](#objectwithnonintersectingvaluesmapbuilder) arg, SchemaConfiguration configuration) | -| [ObjectWithNonIntersectingValues1Boxed](#objectwithnonintersectingvalues1boxed) | validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) | -| @Nullable Object | validate(@Nullable Object arg, SchemaConfiguration configuration) | - -## ObjectWithNonIntersectingValuesMapBuilder -public class ObjectWithNonIntersectingValuesMapBuilder
-builder for `Map` - -A class that builds the Map input type - -### Constructor Summary -| Constructor and Description | -| --------------------------- | -| ObjectWithNonIntersectingValuesMapBuilder()
Creates a builder that contains an empty map | - -### Method Summary -| Modifier and Type | Method and Description | -| ----------------- | ---------------------- | -| Map | build()
Returns map input that should be used with Schema.validate | -| [ObjectWithNonIntersectingValuesMapBuilder](#objectwithnonintersectingvaluesmapbuilder) | a(int value) | -| [ObjectWithNonIntersectingValuesMapBuilder](#objectwithnonintersectingvaluesmapbuilder) | a(float value) | -| [ObjectWithNonIntersectingValuesMapBuilder](#objectwithnonintersectingvaluesmapbuilder) | a(long value) | -| [ObjectWithNonIntersectingValuesMapBuilder](#objectwithnonintersectingvaluesmapbuilder) | a(double value) | -| [ObjectWithNonIntersectingValuesMapBuilder](#objectwithnonintersectingvaluesmapbuilder) | additionalProperty(String key, String value) | - -## ObjectWithNonIntersectingValuesMap -public static class ObjectWithNonIntersectingValuesMap
-extends FrozenMap - -A class to store validated Map payloads - -### Method Summary -| Modifier and Type | Method and Description | -| ----------------- | ---------------------- | -| static [ObjectWithNonIntersectingValuesMap](#objectwithnonintersectingvaluesmap) | of([Map](#objectwithnonintersectingvaluesmapbuilder) arg, SchemaConfiguration configuration) | -| Number | a()
[optional] | -| String | getAdditionalProperty(String name)
provides type safety for additional properties | - -## ABoxed -public sealed interface ABoxed
-permits
-[ABoxedNumber](#aboxednumber) - -sealed interface that stores validated payloads using boxed classes - -## ABoxedNumber -public record ABoxedNumber
-implements [ABoxed](#aboxed) - -record that stores validated Number payloads, sealed permits implementation - -### Constructor Summary -| Constructor and Description | -| --------------------------- | -| ABoxedNumber(Number data)
Creates an instance, private visibility | - -### Method Summary -| Modifier and Type | Method and Description | -| ----------------- | ---------------------- | -| Number | data()
validated payload | -| @Nullable Object | getData()
validated payload | - -## A -public static class A
-extends NumberJsonSchema.NumberJsonSchema1 - -A schema class that validates payloads - -| Methods Inherited from class org.openapijsonschematools.client.schemas.NumberJsonSchema.NumberJsonSchema1 | -| ------------------------------------------------------------------ | -| validate | -| validateAndBox | - -## AdditionalPropertiesBoxed -public sealed interface AdditionalPropertiesBoxed
-permits
-[AdditionalPropertiesBoxedString](#additionalpropertiesboxedstring) - -sealed interface that stores validated payloads using boxed classes - -## 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 | - -## AdditionalProperties -public static class AdditionalProperties
-extends StringJsonSchema.StringJsonSchema1 - -A schema class that validates payloads - -| Methods Inherited from class org.openapijsonschematools.client.schemas.StringJsonSchema.StringJsonSchema1 | -| ------------------------------------------------------------------ | -| validate | -| validateAndBox | - -[[Back to top]](#top) [[Back to Component Schemas]](../../../README.md#Component-Schemas) [[Back to README]](../../../README.md) diff --git a/samples/client/petstore/kotlin/docs/components/schemas/ObjectWithOnlyOptionalProps.md b/samples/client/petstore/kotlin/docs/components/schemas/ObjectWithOnlyOptionalProps.md deleted file mode 100644 index def2c8ea530..00000000000 --- a/samples/client/petstore/kotlin/docs/components/schemas/ObjectWithOnlyOptionalProps.md +++ /dev/null @@ -1,478 +0,0 @@ -# ObjectWithOnlyOptionalProps -org.openapijsonschematools.client.components.schemas.ObjectWithOnlyOptionalProps.java -public class ObjectWithOnlyOptionalProps
- -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 list payloads, extends FrozenList -- classes to build inputs for list payloads -- classes to store validated map payloads, extends FrozenMap -- classes to build inputs for map payloads - -## Nested Class Summary -| Modifier and Type | Class and Description | -| ----------------- | ---------------------- | -| sealed interface | [ObjectWithOnlyOptionalProps.ObjectWithOnlyOptionalProps1Boxed](#objectwithonlyoptionalprops1boxed)
sealed interface for validated payloads | -| record | [ObjectWithOnlyOptionalProps.ObjectWithOnlyOptionalProps1BoxedMap](#objectwithonlyoptionalprops1boxedmap)
boxed class to store validated Map payloads | -| static class | [ObjectWithOnlyOptionalProps.ObjectWithOnlyOptionalProps1](#objectwithonlyoptionalprops1)
schema class | -| static class | [ObjectWithOnlyOptionalProps.ObjectWithOnlyOptionalPropsMapBuilder](#objectwithonlyoptionalpropsmapbuilder)
builder for Map payloads | -| static class | [ObjectWithOnlyOptionalProps.ObjectWithOnlyOptionalPropsMap](#objectwithonlyoptionalpropsmap)
output class for Map payloads | -| sealed interface | [ObjectWithOnlyOptionalProps.ArrayPropertyBoxed](#arraypropertyboxed)
sealed interface for validated payloads | -| record | [ObjectWithOnlyOptionalProps.ArrayPropertyBoxedVoid](#arraypropertyboxedvoid)
boxed class to store validated null payloads | -| record | [ObjectWithOnlyOptionalProps.ArrayPropertyBoxedList](#arraypropertyboxedlist)
boxed class to store validated List payloads | -| static class | [ObjectWithOnlyOptionalProps.ArrayProperty](#arrayproperty)
schema class | -| static class | [ObjectWithOnlyOptionalProps.ArrayPropertyListBuilder](#arraypropertylistbuilder)
builder for List payloads | -| static class | [ObjectWithOnlyOptionalProps.ArrayPropertyList](#arraypropertylist)
output class for List payloads | -| sealed interface | [ObjectWithOnlyOptionalProps.BBoxed](#bboxed)
sealed interface for validated payloads | -| record | [ObjectWithOnlyOptionalProps.BBoxedNumber](#bboxednumber)
boxed class to store validated Number payloads | -| static class | [ObjectWithOnlyOptionalProps.B](#b)
schema class | -| sealed interface | [ObjectWithOnlyOptionalProps.ABoxed](#aboxed)
sealed interface for validated payloads | -| record | [ObjectWithOnlyOptionalProps.ABoxedString](#aboxedstring)
boxed class to store validated String payloads | -| static class | [ObjectWithOnlyOptionalProps.A](#a)
schema class | -| sealed interface | [ObjectWithOnlyOptionalProps.AdditionalPropertiesBoxed](#additionalpropertiesboxed)
sealed interface for validated payloads | -| record | [ObjectWithOnlyOptionalProps.AdditionalPropertiesBoxedVoid](#additionalpropertiesboxedvoid)
boxed class to store validated null payloads | -| record | [ObjectWithOnlyOptionalProps.AdditionalPropertiesBoxedBoolean](#additionalpropertiesboxedboolean)
boxed class to store validated boolean payloads | -| record | [ObjectWithOnlyOptionalProps.AdditionalPropertiesBoxedNumber](#additionalpropertiesboxednumber)
boxed class to store validated Number payloads | -| record | [ObjectWithOnlyOptionalProps.AdditionalPropertiesBoxedString](#additionalpropertiesboxedstring)
boxed class to store validated String payloads | -| record | [ObjectWithOnlyOptionalProps.AdditionalPropertiesBoxedList](#additionalpropertiesboxedlist)
boxed class to store validated List payloads | -| record | [ObjectWithOnlyOptionalProps.AdditionalPropertiesBoxedMap](#additionalpropertiesboxedmap)
boxed class to store validated Map payloads | -| static class | [ObjectWithOnlyOptionalProps.AdditionalProperties](#additionalproperties)
schema class | - -## ObjectWithOnlyOptionalProps1Boxed -public sealed interface ObjectWithOnlyOptionalProps1Boxed
-permits
-[ObjectWithOnlyOptionalProps1BoxedMap](#objectwithonlyoptionalprops1boxedmap) - -sealed interface that stores validated payloads using boxed classes - -## ObjectWithOnlyOptionalProps1BoxedMap -public record ObjectWithOnlyOptionalProps1BoxedMap
-implements [ObjectWithOnlyOptionalProps1Boxed](#objectwithonlyoptionalprops1boxed) - -record that stores validated Map payloads, sealed permits implementation - -### Constructor Summary -| Constructor and Description | -| --------------------------- | -| ObjectWithOnlyOptionalProps1BoxedMap([ObjectWithOnlyOptionalPropsMap](#objectwithonlyoptionalpropsmap) data)
Creates an instance, private visibility | - -### Method Summary -| Modifier and Type | Method and Description | -| ----------------- | ---------------------- | -| [ObjectWithOnlyOptionalPropsMap](#objectwithonlyoptionalpropsmap) | data()
validated payload | -| @Nullable Object | getData()
validated payload | - -## ObjectWithOnlyOptionalProps1 -public static class ObjectWithOnlyOptionalProps1
-extends JsonSchema - -A schema class that validates payloads - -### Code Sample -``` -import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags; -import org.openapijsonschematools.client.configurations.SchemaConfiguration; -import org.openapijsonschematools.client.exceptions.ValidationException; -import org.openapijsonschematools.client.schemas.validation.MapUtils; -import org.openapijsonschematools.client.schemas.validation.FrozenList; -import org.openapijsonschematools.client.schemas.validation.FrozenMap; -import org.openapijsonschematools.client.components.schemas.ObjectWithOnlyOptionalProps; - -import java.util.Arrays; -import java.util.List; -import java.util.AbstractMap; - -static final SchemaConfiguration configuration = new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().build()); - -// Map validation -ObjectWithOnlyOptionalProps.ObjectWithOnlyOptionalPropsMap validatedPayload = - ObjectWithOnlyOptionalProps.ObjectWithOnlyOptionalProps1.validate( - new ObjectWithOnlyOptionalProps.ObjectWithOnlyOptionalPropsMapBuilder() - .a("a") - - .b(1) - - .ArrayProperty(null) - - .build(), - configuration -); -``` - -### Field Summary -| Modifier and Type | Field and Description | -| ----------------- | ---------------------- | -| Set> | type = Set.of(Map.class) | -| Map> | properties = Map.ofEntries(
    new PropertyEntry("a", [A.class](#a))),
    new PropertyEntry("b", [B.class](#b))),
    new PropertyEntry("ArrayProperty", [ArrayProperty.class](#arrayproperty)))
)
| -| Class | additionalProperties = [AdditionalProperties.class](#additionalproperties) | - -### Method Summary -| Modifier and Type | Method and Description | -| ----------------- | ---------------------- | -| [ObjectWithOnlyOptionalPropsMap](#objectwithonlyoptionalpropsmap) | validate([Map<?, ?>](#objectwithonlyoptionalpropsmapbuilder) arg, SchemaConfiguration configuration) | -| [ObjectWithOnlyOptionalProps1BoxedMap](#objectwithonlyoptionalprops1boxedmap) | validateAndBox([Map<?, ?>](#objectwithonlyoptionalpropsmapbuilder) arg, SchemaConfiguration configuration) | -| [ObjectWithOnlyOptionalProps1Boxed](#objectwithonlyoptionalprops1boxed) | validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) | -| @Nullable Object | validate(@Nullable Object arg, SchemaConfiguration configuration) | - -## ObjectWithOnlyOptionalPropsMapBuilder -public class ObjectWithOnlyOptionalPropsMapBuilder
-builder for `Map` - -A class that builds the Map input type - -### Constructor Summary -| Constructor and Description | -| --------------------------- | -| ObjectWithOnlyOptionalPropsMapBuilder()
Creates a builder that contains an empty map | - -### Method Summary -| Modifier and Type | Method and Description | -| ----------------- | ---------------------- | -| Map | build()
Returns map input that should be used with Schema.validate | -| [ObjectWithOnlyOptionalPropsMapBuilder](#objectwithonlyoptionalpropsmapbuilder) | a(String value) | -| [ObjectWithOnlyOptionalPropsMapBuilder](#objectwithonlyoptionalpropsmapbuilder) | b(int value) | -| [ObjectWithOnlyOptionalPropsMapBuilder](#objectwithonlyoptionalpropsmapbuilder) | b(float value) | -| [ObjectWithOnlyOptionalPropsMapBuilder](#objectwithonlyoptionalpropsmapbuilder) | b(long value) | -| [ObjectWithOnlyOptionalPropsMapBuilder](#objectwithonlyoptionalpropsmapbuilder) | b(double value) | -| [ObjectWithOnlyOptionalPropsMapBuilder](#objectwithonlyoptionalpropsmapbuilder) | ArrayProperty(Nothing? value) | -| [ObjectWithOnlyOptionalPropsMapBuilder](#objectwithonlyoptionalpropsmapbuilder) | ArrayProperty(List value) | - -## ObjectWithOnlyOptionalPropsMap -public static class ObjectWithOnlyOptionalPropsMap
-extends FrozenMap - -A class to store validated Map payloads - -### Method Summary -| Modifier and Type | Method and Description | -| ----------------- | ---------------------- | -| static [ObjectWithOnlyOptionalPropsMap](#objectwithonlyoptionalpropsmap) | of([Map](#objectwithonlyoptionalpropsmapbuilder) arg, SchemaConfiguration configuration) | -| String | a()
[optional] | -| Number | b()
[optional] | -| [ArrayPropertyList](#arraypropertylist) | ArrayProperty()
[optional] | - -## ArrayPropertyBoxed -public sealed interface ArrayPropertyBoxed
-permits
-[ArrayPropertyBoxedVoid](#arraypropertyboxedvoid), -[ArrayPropertyBoxedList](#arraypropertyboxedlist) - -sealed interface that stores validated payloads using boxed classes - -## ArrayPropertyBoxedVoid -public record ArrayPropertyBoxedVoid
-implements [ArrayPropertyBoxed](#arraypropertyboxed) - -record that stores validated null payloads, sealed permits implementation - -### Constructor Summary -| Constructor and Description | -| --------------------------- | -| ArrayPropertyBoxedVoid(Nothing? data)
Creates an instance, private visibility | - -### Method Summary -| Modifier and Type | Method and Description | -| ----------------- | ---------------------- | -| Nothing? | data()
validated payload | -| @Nullable Object | getData()
validated payload | - -## ArrayPropertyBoxedList -public record ArrayPropertyBoxedList
-implements [ArrayPropertyBoxed](#arraypropertyboxed) - -record that stores validated List payloads, sealed permits implementation - -### Constructor Summary -| Constructor and Description | -| --------------------------- | -| ArrayPropertyBoxedList([ArrayPropertyList](#arraypropertylist) data)
Creates an instance, private visibility | - -### Method Summary -| Modifier and Type | Method and Description | -| ----------------- | ---------------------- | -| [ArrayPropertyList](#arraypropertylist) | data()
validated payload | -| @Nullable Object | getData()
validated payload | - -## ArrayProperty -public static class ArrayProperty
-extends JsonSchema - -A schema class that validates payloads - -### Code Sample -``` -import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags; -import org.openapijsonschematools.client.configurations.SchemaConfiguration; -import org.openapijsonschematools.client.exceptions.ValidationException; -import org.openapijsonschematools.client.schemas.validation.MapUtils; -import org.openapijsonschematools.client.schemas.validation.FrozenList; -import org.openapijsonschematools.client.schemas.validation.FrozenMap; -import org.openapijsonschematools.client.components.schemas.ObjectWithOnlyOptionalProps; - -import java.util.Arrays; -import java.util.List; -import java.util.AbstractMap; - -static final SchemaConfiguration configuration = new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().build()); - -// null validation -Nothing? validatedPayload = ObjectWithOnlyOptionalProps.ArrayProperty.validate( - (Nothing?) null, - configuration -); - -// List validation -ObjectWithOnlyOptionalProps.ArrayPropertyList validatedPayload = - ObjectWithOnlyOptionalProps.ArrayProperty.validate( - new ObjectWithOnlyOptionalProps.ArrayPropertyListBuilder() - .add("_abc") - - .build(), - configuration -); -``` - -### Field Summary -| Modifier and Type | Field and Description | -| ----------------- | ---------------------- | -| Set> | type = Set.of(
    Nothing?.class,
    List.class
)
| -| Class | items = [EnumClass.EnumClass1.class](../../components/schemas/EnumClass.md#enumclass1) | - -### Method Summary -| Modifier and Type | Method and Description | -| ----------------- | ---------------------- | -| Nothing? | validate(Nothing? arg, SchemaConfiguration configuration) | -| [ArrayPropertyBoxedVoid](#arraypropertyboxedvoid) | validateAndBox(Nothing? arg, SchemaConfiguration configuration) | -| [ArrayPropertyList](#arraypropertylist) | validate([List](#arraypropertylistbuilder) arg, SchemaConfiguration configuration) | -| [ArrayPropertyBoxedList](#arraypropertyboxedlist) | validateAndBox([List](#arraypropertylistbuilder) arg, SchemaConfiguration configuration) | -| [ArrayPropertyBoxed](#arraypropertyboxed) | validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) | -| @Nullable Object | validate(@Nullable Object arg, SchemaConfiguration configuration) | - -## ArrayPropertyListBuilder -public class ArrayPropertyListBuilder
-builder for `List` - -A class that builds the List input type - -### Constructor Summary -| Constructor and Description | -| --------------------------- | -| ArrayPropertyListBuilder()
Creates an empty list | -| ArrayPropertyListBuilder(List items)
Stores the items in a list | - -### Method Summary -| Modifier and Type | Method and Description | -| ----------------- | ---------------------- | -| ArrayPropertyListBuilder | add(String item) | -| ArrayPropertyListBuilder | add([EnumClass.StringEnumClassEnums](../../components/schemas/EnumClass.md#stringenumclassenums) item) | -| List | build()
Returns list input that should be used with Schema.validate | - -## ArrayPropertyList -public class ArrayPropertyList
-extends `FrozenList` - -A class to store validated List payloads - -### Method Summary -| Modifier and Type | Method and Description | -| ----------------- | ---------------------- | -| static [ArrayPropertyList](#arraypropertylist) | of([List](#arraypropertylistbuilder) arg, SchemaConfiguration configuration) | - -## BBoxed -public sealed interface BBoxed
-permits
-[BBoxedNumber](#bboxednumber) - -sealed interface that stores validated payloads using boxed classes - -## BBoxedNumber -public record BBoxedNumber
-implements [BBoxed](#bboxed) - -record that stores validated Number payloads, sealed permits implementation - -### Constructor Summary -| Constructor and Description | -| --------------------------- | -| BBoxedNumber(Number data)
Creates an instance, private visibility | - -### Method Summary -| Modifier and Type | Method and Description | -| ----------------- | ---------------------- | -| Number | data()
validated payload | -| @Nullable Object | getData()
validated payload | - -## B -public static class B
-extends NumberJsonSchema.NumberJsonSchema1 - -A schema class that validates payloads - -| Methods Inherited from class org.openapijsonschematools.client.schemas.NumberJsonSchema.NumberJsonSchema1 | -| ------------------------------------------------------------------ | -| validate | -| validateAndBox | - -## ABoxed -public sealed interface ABoxed
-permits
-[ABoxedString](#aboxedstring) - -sealed interface that stores validated payloads using boxed classes - -## ABoxedString -public record ABoxedString
-implements [ABoxed](#aboxed) - -record that stores validated String payloads, sealed permits implementation - -### Constructor Summary -| Constructor and Description | -| --------------------------- | -| ABoxedString(String data)
Creates an instance, private visibility | - -### Method Summary -| Modifier and Type | Method and Description | -| ----------------- | ---------------------- | -| String | data()
validated payload | -| @Nullable Object | getData()
validated payload | - -## A -public static class A
-extends StringJsonSchema.StringJsonSchema1 - -A schema class that validates payloads - -| Methods Inherited from class org.openapijsonschematools.client.schemas.StringJsonSchema.StringJsonSchema1 | -| ------------------------------------------------------------------ | -| validate | -| validateAndBox | - -## 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(Nothing? data)
Creates an instance, private visibility | - -### Method Summary -| Modifier and Type | Method and Description | -| ----------------- | ---------------------- | -| Nothing? | 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 Component Schemas]](../../../README.md#Component-Schemas) [[Back to README]](../../../README.md) diff --git a/samples/client/petstore/kotlin/docs/components/schemas/ObjectWithOptionalTestProp.md b/samples/client/petstore/kotlin/docs/components/schemas/ObjectWithOptionalTestProp.md deleted file mode 100644 index 46c585734b0..00000000000 --- a/samples/client/petstore/kotlin/docs/components/schemas/ObjectWithOptionalTestProp.md +++ /dev/null @@ -1,169 +0,0 @@ -# ObjectWithOptionalTestProp -org.openapijsonschematools.client.components.schemas.ObjectWithOptionalTestProp.java -public class ObjectWithOptionalTestProp
- -A class that contains necessary nested -- schema classes (which validate payloads), extends JsonSchema -- sealed interfaces which store validated payloads, java version of a sum type -- boxed classes which store validated payloads, sealed permits class implementations -- classes to store validated map payloads, extends FrozenMap -- classes to build inputs for map payloads - -## Nested Class Summary -| Modifier and Type | Class and Description | -| ----------------- | ---------------------- | -| sealed interface | [ObjectWithOptionalTestProp.ObjectWithOptionalTestProp1Boxed](#objectwithoptionaltestprop1boxed)
sealed interface for validated payloads | -| record | [ObjectWithOptionalTestProp.ObjectWithOptionalTestProp1BoxedMap](#objectwithoptionaltestprop1boxedmap)
boxed class to store validated Map payloads | -| static class | [ObjectWithOptionalTestProp.ObjectWithOptionalTestProp1](#objectwithoptionaltestprop1)
schema class | -| static class | [ObjectWithOptionalTestProp.ObjectWithOptionalTestPropMapBuilder](#objectwithoptionaltestpropmapbuilder)
builder for Map payloads | -| static class | [ObjectWithOptionalTestProp.ObjectWithOptionalTestPropMap](#objectwithoptionaltestpropmap)
output class for Map payloads | -| sealed interface | [ObjectWithOptionalTestProp.TestBoxed](#testboxed)
sealed interface for validated payloads | -| record | [ObjectWithOptionalTestProp.TestBoxedString](#testboxedstring)
boxed class to store validated String payloads | -| static class | [ObjectWithOptionalTestProp.Test](#test)
schema class | - -## ObjectWithOptionalTestProp1Boxed -public sealed interface ObjectWithOptionalTestProp1Boxed
-permits
-[ObjectWithOptionalTestProp1BoxedMap](#objectwithoptionaltestprop1boxedmap) - -sealed interface that stores validated payloads using boxed classes - -## ObjectWithOptionalTestProp1BoxedMap -public record ObjectWithOptionalTestProp1BoxedMap
-implements [ObjectWithOptionalTestProp1Boxed](#objectwithoptionaltestprop1boxed) - -record that stores validated Map payloads, sealed permits implementation - -### Constructor Summary -| Constructor and Description | -| --------------------------- | -| ObjectWithOptionalTestProp1BoxedMap([ObjectWithOptionalTestPropMap](#objectwithoptionaltestpropmap) data)
Creates an instance, private visibility | - -### Method Summary -| Modifier and Type | Method and Description | -| ----------------- | ---------------------- | -| [ObjectWithOptionalTestPropMap](#objectwithoptionaltestpropmap) | data()
validated payload | -| @Nullable Object | getData()
validated payload | - -## ObjectWithOptionalTestProp1 -public static class ObjectWithOptionalTestProp1
-extends JsonSchema - -A schema class that validates payloads - -### Code Sample -``` -import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags; -import org.openapijsonschematools.client.configurations.SchemaConfiguration; -import org.openapijsonschematools.client.exceptions.ValidationException; -import org.openapijsonschematools.client.schemas.validation.MapUtils; -import org.openapijsonschematools.client.schemas.validation.FrozenList; -import org.openapijsonschematools.client.schemas.validation.FrozenMap; -import org.openapijsonschematools.client.components.schemas.ObjectWithOptionalTestProp; - -import java.util.Arrays; -import java.util.List; -import java.util.AbstractMap; - -static final SchemaConfiguration configuration = new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().build()); - -// Map validation -ObjectWithOptionalTestProp.ObjectWithOptionalTestPropMap validatedPayload = - ObjectWithOptionalTestProp.ObjectWithOptionalTestProp1.validate( - new ObjectWithOptionalTestProp.ObjectWithOptionalTestPropMapBuilder() - .test("a") - - .build(), - configuration -); -``` - -### Field Summary -| Modifier and Type | Field and Description | -| ----------------- | ---------------------- | -| Set> | type = Set.of(Map.class) | -| Map> | properties = Map.ofEntries(
    new PropertyEntry("test", [Test.class](#test)))
)
| - -### Method Summary -| Modifier and Type | Method and Description | -| ----------------- | ---------------------- | -| [ObjectWithOptionalTestPropMap](#objectwithoptionaltestpropmap) | validate([Map<?, ?>](#objectwithoptionaltestpropmapbuilder) arg, SchemaConfiguration configuration) | -| [ObjectWithOptionalTestProp1BoxedMap](#objectwithoptionaltestprop1boxedmap) | validateAndBox([Map<?, ?>](#objectwithoptionaltestpropmapbuilder) arg, SchemaConfiguration configuration) | -| [ObjectWithOptionalTestProp1Boxed](#objectwithoptionaltestprop1boxed) | validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) | -| @Nullable Object | validate(@Nullable Object arg, SchemaConfiguration configuration) | - -## ObjectWithOptionalTestPropMapBuilder -public class ObjectWithOptionalTestPropMapBuilder
-builder for `Map` - -A class that builds the Map input type - -### Constructor Summary -| Constructor and Description | -| --------------------------- | -| ObjectWithOptionalTestPropMapBuilder()
Creates a builder that contains an empty map | - -### Method Summary -| Modifier and Type | Method and Description | -| ----------------- | ---------------------- | -| Map | build()
Returns map input that should be used with Schema.validate | -| [ObjectWithOptionalTestPropMapBuilder](#objectwithoptionaltestpropmapbuilder) | test(String value) | -| [ObjectWithOptionalTestPropMapBuilder](#objectwithoptionaltestpropmapbuilder) | additionalProperty(String key, Nothing? value) | -| [ObjectWithOptionalTestPropMapBuilder](#objectwithoptionaltestpropmapbuilder) | additionalProperty(String key, boolean value) | -| [ObjectWithOptionalTestPropMapBuilder](#objectwithoptionaltestpropmapbuilder) | additionalProperty(String key, String value) | -| [ObjectWithOptionalTestPropMapBuilder](#objectwithoptionaltestpropmapbuilder) | additionalProperty(String key, int value) | -| [ObjectWithOptionalTestPropMapBuilder](#objectwithoptionaltestpropmapbuilder) | additionalProperty(String key, float value) | -| [ObjectWithOptionalTestPropMapBuilder](#objectwithoptionaltestpropmapbuilder) | additionalProperty(String key, long value) | -| [ObjectWithOptionalTestPropMapBuilder](#objectwithoptionaltestpropmapbuilder) | additionalProperty(String key, double value) | -| [ObjectWithOptionalTestPropMapBuilder](#objectwithoptionaltestpropmapbuilder) | additionalProperty(String key, List value) | -| [ObjectWithOptionalTestPropMapBuilder](#objectwithoptionaltestpropmapbuilder) | additionalProperty(String key, Map value) | - -## ObjectWithOptionalTestPropMap -public static class ObjectWithOptionalTestPropMap
-extends FrozenMap - -A class to store validated Map payloads - -### Method Summary -| Modifier and Type | Method and Description | -| ----------------- | ---------------------- | -| static [ObjectWithOptionalTestPropMap](#objectwithoptionaltestpropmap) | of([Map](#objectwithoptionaltestpropmapbuilder) arg, SchemaConfiguration configuration) | -| String | test()
[optional] | -| @Nullable Object | getAdditionalProperty(String name)
provides type safety for additional properties | - -## TestBoxed -public sealed interface TestBoxed
-permits
-[TestBoxedString](#testboxedstring) - -sealed interface that stores validated payloads using boxed classes - -## TestBoxedString -public record TestBoxedString
-implements [TestBoxed](#testboxed) - -record that stores validated String payloads, sealed permits implementation - -### Constructor Summary -| Constructor and Description | -| --------------------------- | -| TestBoxedString(String data)
Creates an instance, private visibility | - -### Method Summary -| Modifier and Type | Method and Description | -| ----------------- | ---------------------- | -| String | data()
validated payload | -| @Nullable Object | getData()
validated payload | - -## Test -public static class Test
-extends StringJsonSchema.StringJsonSchema1 - -A schema class that validates payloads - -| Methods Inherited from class org.openapijsonschematools.client.schemas.StringJsonSchema.StringJsonSchema1 | -| ------------------------------------------------------------------ | -| validate | -| validateAndBox | - -[[Back to top]](#top) [[Back to Component Schemas]](../../../README.md#Component-Schemas) [[Back to README]](../../../README.md) diff --git a/samples/client/petstore/kotlin/docs/components/schemas/ObjectWithValidations.md b/samples/client/petstore/kotlin/docs/components/schemas/ObjectWithValidations.md deleted file mode 100644 index 755fa9edbb3..00000000000 --- a/samples/client/petstore/kotlin/docs/components/schemas/ObjectWithValidations.md +++ /dev/null @@ -1,61 +0,0 @@ -# ObjectWithValidations -org.openapijsonschematools.client.components.schemas.ObjectWithValidations.java -public class ObjectWithValidations
- -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 - -## Nested Class Summary -| Modifier and Type | Class and Description | -| ----------------- | ---------------------- | -| sealed interface | [ObjectWithValidations.ObjectWithValidations1Boxed](#objectwithvalidations1boxed)
sealed interface for validated payloads | -| record | [ObjectWithValidations.ObjectWithValidations1BoxedMap](#objectwithvalidations1boxedmap)
boxed class to store validated Map payloads | -| static class | [ObjectWithValidations.ObjectWithValidations1](#objectwithvalidations1)
schema class | - -## ObjectWithValidations1Boxed -public sealed interface ObjectWithValidations1Boxed
-permits
-[ObjectWithValidations1BoxedMap](#objectwithvalidations1boxedmap) - -sealed interface that stores validated payloads using boxed classes - -## ObjectWithValidations1BoxedMap -public record ObjectWithValidations1BoxedMap
-implements [ObjectWithValidations1Boxed](#objectwithvalidations1boxed) - -record that stores validated Map payloads, sealed permits implementation - -### Constructor Summary -| Constructor and Description | -| --------------------------- | -| ObjectWithValidations1BoxedMap(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 | - -## ObjectWithValidations1 -public static class ObjectWithValidations1
-extends JsonSchema - -A schema class that validates payloads - -### Field Summary -| Modifier and Type | Field and Description | -| ----------------- | ---------------------- | -| Set> | type = Set.of(Map.class) | -| Integer | minProperties = 2 | - -### Method Summary -| Modifier and Type | Method and Description | -| ----------------- | ---------------------- | -| FrozenMap | validate(Map<?, ?> arg, SchemaConfiguration configuration) | -| [ObjectWithValidations1BoxedMap](#objectwithvalidations1boxedmap) | validateAndBox(Map<?, ?> arg, SchemaConfiguration configuration) | -| [ObjectWithValidations1Boxed](#objectwithvalidations1boxed) | validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) | -| @Nullable Object | validate(@Nullable Object arg, SchemaConfiguration configuration) | - -[[Back to top]](#top) [[Back to Component Schemas]](../../../README.md#Component-Schemas) [[Back to README]](../../../README.md) diff --git a/samples/client/petstore/kotlin/docs/components/schemas/Order.md b/samples/client/petstore/kotlin/docs/components/schemas/Order.md deleted file mode 100644 index ac6a0023076..00000000000 --- a/samples/client/petstore/kotlin/docs/components/schemas/Order.md +++ /dev/null @@ -1,438 +0,0 @@ -# Order -org.openapijsonschematools.client.components.schemas.Order.java -public class Order
- -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 | [Order.Order1Boxed](#order1boxed)
sealed interface for validated payloads | -| record | [Order.Order1BoxedMap](#order1boxedmap)
boxed class to store validated Map payloads | -| static class | [Order.Order1](#order1)
schema class | -| static class | [Order.OrderMapBuilder](#ordermapbuilder)
builder for Map payloads | -| static class | [Order.OrderMap](#ordermap)
output class for Map payloads | -| sealed interface | [Order.CompleteBoxed](#completeboxed)
sealed interface for validated payloads | -| record | [Order.CompleteBoxedBoolean](#completeboxedboolean)
boxed class to store validated boolean payloads | -| static class | [Order.Complete](#complete)
schema class | -| sealed interface | [Order.StatusBoxed](#statusboxed)
sealed interface for validated payloads | -| record | [Order.StatusBoxedString](#statusboxedstring)
boxed class to store validated String payloads | -| static class | [Order.Status](#status)
schema class | -| enum | [Order.StringStatusEnums](#stringstatusenums)
String enum | -| sealed interface | [Order.ShipDateBoxed](#shipdateboxed)
sealed interface for validated payloads | -| record | [Order.ShipDateBoxedString](#shipdateboxedstring)
boxed class to store validated String payloads | -| static class | [Order.ShipDate](#shipdate)
schema class | -| sealed interface | [Order.QuantityBoxed](#quantityboxed)
sealed interface for validated payloads | -| record | [Order.QuantityBoxedNumber](#quantityboxednumber)
boxed class to store validated Number payloads | -| static class | [Order.Quantity](#quantity)
schema class | -| sealed interface | [Order.PetIdBoxed](#petidboxed)
sealed interface for validated payloads | -| record | [Order.PetIdBoxedNumber](#petidboxednumber)
boxed class to store validated Number payloads | -| static class | [Order.PetId](#petid)
schema class | -| sealed interface | [Order.IdBoxed](#idboxed)
sealed interface for validated payloads | -| record | [Order.IdBoxedNumber](#idboxednumber)
boxed class to store validated Number payloads | -| static class | [Order.Id](#id)
schema class | - -## Order1Boxed -public sealed interface Order1Boxed
-permits
-[Order1BoxedMap](#order1boxedmap) - -sealed interface that stores validated payloads using boxed classes - -## Order1BoxedMap -public record Order1BoxedMap
-implements [Order1Boxed](#order1boxed) - -record that stores validated Map payloads, sealed permits implementation - -### Constructor Summary -| Constructor and Description | -| --------------------------- | -| Order1BoxedMap([OrderMap](#ordermap) data)
Creates an instance, private visibility | - -### Method Summary -| Modifier and Type | Method and Description | -| ----------------- | ---------------------- | -| [OrderMap](#ordermap) | data()
validated payload | -| @Nullable Object | getData()
validated payload | - -## Order1 -public static class Order1
-extends JsonSchema - -A schema class that validates payloads - -### Code Sample -``` -import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags; -import org.openapijsonschematools.client.configurations.SchemaConfiguration; -import org.openapijsonschematools.client.exceptions.ValidationException; -import org.openapijsonschematools.client.schemas.validation.MapUtils; -import org.openapijsonschematools.client.schemas.validation.FrozenList; -import org.openapijsonschematools.client.schemas.validation.FrozenMap; -import org.openapijsonschematools.client.components.schemas.Order; - -import java.util.Arrays; -import java.util.List; -import java.util.AbstractMap; - -static final SchemaConfiguration configuration = new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().build()); - -// Map validation -Order.OrderMap validatedPayload = - Order.Order1.validate( - new Order.OrderMapBuilder() - .id(1L) - - .petId(1L) - - .quantity(1) - - .shipDate("1970-01-01T00:00:00.00Z") - - .status("placed") - - .complete(true) - - .build(), - configuration -); -``` - -### Field Summary -| Modifier and Type | Field and Description | -| ----------------- | ---------------------- | -| Set> | type = Set.of(Map.class) | -| Map> | properties = Map.ofEntries(
    new PropertyEntry("id", [Id.class](#id))),
    new PropertyEntry("petId", [PetId.class](#petid))),
    new PropertyEntry("quantity", [Quantity.class](#quantity))),
    new PropertyEntry("shipDate", [ShipDate.class](#shipdate))),
    new PropertyEntry("status", [Status.class](#status))),
    new PropertyEntry("complete", [Complete.class](#complete)))
)
| - -### Method Summary -| Modifier and Type | Method and Description | -| ----------------- | ---------------------- | -| [OrderMap](#ordermap) | validate([Map<?, ?>](#ordermapbuilder) arg, SchemaConfiguration configuration) | -| [Order1BoxedMap](#order1boxedmap) | validateAndBox([Map<?, ?>](#ordermapbuilder) arg, SchemaConfiguration configuration) | -| [Order1Boxed](#order1boxed) | validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) | -| @Nullable Object | validate(@Nullable Object arg, SchemaConfiguration configuration) | - -## OrderMapBuilder -public class OrderMapBuilder
-builder for `Map` - -A class that builds the Map input type - -### Constructor Summary -| Constructor and Description | -| --------------------------- | -| OrderMapBuilder()
Creates a builder that contains an empty map | - -### Method Summary -| Modifier and Type | Method and Description | -| ----------------- | ---------------------- | -| Map | build()
Returns map input that should be used with Schema.validate | -| [OrderMapBuilder](#ordermapbuilder) | id(int value) | -| [OrderMapBuilder](#ordermapbuilder) | id(float value) | -| [OrderMapBuilder](#ordermapbuilder) | id(long value) | -| [OrderMapBuilder](#ordermapbuilder) | id(double value) | -| [OrderMapBuilder](#ordermapbuilder) | petId(int value) | -| [OrderMapBuilder](#ordermapbuilder) | petId(float value) | -| [OrderMapBuilder](#ordermapbuilder) | petId(long value) | -| [OrderMapBuilder](#ordermapbuilder) | petId(double value) | -| [OrderMapBuilder](#ordermapbuilder) | quantity(int value) | -| [OrderMapBuilder](#ordermapbuilder) | quantity(float value) | -| [OrderMapBuilder](#ordermapbuilder) | shipDate(String value) | -| [OrderMapBuilder](#ordermapbuilder) | status(String value) | -| [OrderMapBuilder](#ordermapbuilder) | status([StringStatusEnums](#stringstatusenums) value) | -| [OrderMapBuilder](#ordermapbuilder) | complete(boolean value) | -| [OrderMapBuilder](#ordermapbuilder) | additionalProperty(String key, Nothing? value) | -| [OrderMapBuilder](#ordermapbuilder) | additionalProperty(String key, boolean value) | -| [OrderMapBuilder](#ordermapbuilder) | additionalProperty(String key, String value) | -| [OrderMapBuilder](#ordermapbuilder) | additionalProperty(String key, int value) | -| [OrderMapBuilder](#ordermapbuilder) | additionalProperty(String key, float value) | -| [OrderMapBuilder](#ordermapbuilder) | additionalProperty(String key, long value) | -| [OrderMapBuilder](#ordermapbuilder) | additionalProperty(String key, double value) | -| [OrderMapBuilder](#ordermapbuilder) | additionalProperty(String key, List value) | -| [OrderMapBuilder](#ordermapbuilder) | additionalProperty(String key, Map value) | - -## OrderMap -public static class OrderMap
-extends FrozenMap - -A class to store validated Map payloads - -### Method Summary -| Modifier and Type | Method and Description | -| ----------------- | ---------------------- | -| static [OrderMap](#ordermap) | of([Map](#ordermapbuilder) arg, SchemaConfiguration configuration) | -| Number | id()
[optional] value must be a 64 bit integer | -| Number | petId()
[optional] value must be a 64 bit integer | -| Number | quantity()
[optional] value must be a 32 bit integer | -| String | shipDate()
[optional] value must conform to RFC-3339 date-time | -| String | status()
[optional] must be one of ["placed", "approved", "delivered"] | -| boolean | complete()
[optional] if omitted the server will use the default value of false | -| @Nullable Object | getAdditionalProperty(String name)
provides type safety for additional properties | - -## CompleteBoxed -public sealed interface CompleteBoxed
-permits
-[CompleteBoxedBoolean](#completeboxedboolean) - -sealed interface that stores validated payloads using boxed classes - -## CompleteBoxedBoolean -public record CompleteBoxedBoolean
-implements [CompleteBoxed](#completeboxed) - -record that stores validated boolean payloads, sealed permits implementation - -### Constructor Summary -| Constructor and Description | -| --------------------------- | -| CompleteBoxedBoolean(boolean data)
Creates an instance, private visibility | - -### Method Summary -| Modifier and Type | Method and Description | -| ----------------- | ---------------------- | -| boolean | data()
validated payload | -| @Nullable Object | getData()
validated payload | - -## Complete -public static class Complete
-extends BooleanJsonSchema.BooleanJsonSchema1 - -A schema class that validates payloads - -| Methods Inherited from class org.openapijsonschematools.client.schemas.BooleanJsonSchema.BooleanJsonSchema1 | -| ------------------------------------------------------------------ | -| validate | -| validateAndBox | - -## StatusBoxed -public sealed interface StatusBoxed
-permits
-[StatusBoxedString](#statusboxedstring) - -sealed interface that stores validated payloads using boxed classes - -## StatusBoxedString -public record StatusBoxedString
-implements [StatusBoxed](#statusboxed) - -record that stores validated String payloads, sealed permits implementation - -### Constructor Summary -| Constructor and Description | -| --------------------------- | -| StatusBoxedString(String data)
Creates an instance, private visibility | - -### Method Summary -| Modifier and Type | Method and Description | -| ----------------- | ---------------------- | -| String | data()
validated payload | -| @Nullable Object | getData()
validated payload | - -## Status -public static class Status
-extends JsonSchema - -A schema class that validates payloads - -## Description -Order Status - -### Code Sample -``` -import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags; -import org.openapijsonschematools.client.configurations.SchemaConfiguration; -import org.openapijsonschematools.client.exceptions.ValidationException; -import org.openapijsonschematools.client.schemas.validation.MapUtils; -import org.openapijsonschematools.client.schemas.validation.FrozenList; -import org.openapijsonschematools.client.schemas.validation.FrozenMap; -import org.openapijsonschematools.client.components.schemas.Order; - -import java.util.Arrays; -import java.util.List; -import java.util.AbstractMap; - -static final SchemaConfiguration configuration = new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().build()); - -// String validation -String validatedPayload = Order.Status.validate( - "placed", - configuration -); -``` - -### Field Summary -| Modifier and Type | Field and Description | -| ----------------- | ---------------------- | -| Set> | type = Set.of(
    String.class
)
| -| Set | enumValues = SetMaker.makeSet(
    "placed",
    "approved",
    "delivered"
)
| - -### Method Summary -| Modifier and Type | Method and Description | -| ----------------- | ---------------------- | -| String | validate(String arg, SchemaConfiguration configuration) | -| String | validate([StringStatusEnums](#stringstatusenums) arg, SchemaConfiguration configuration) | -| [StatusBoxedString](#statusboxedstring) | validateAndBox(String arg, SchemaConfiguration configuration) | -| [StatusBoxed](#statusboxed) | validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) | -| @Nullable Object | validate(@Nullable Object arg, SchemaConfiguration configuration) | - -## StringStatusEnums -public enum StringStatusEnums
-extends `Enum` - -A class that stores String enum values - -### Enum Constant Summary -| Enum Constant | Description | -| ------------- | ----------- | -| PLACED | value = "placed" | -| APPROVED | value = "approved" | -| DELIVERED | value = "delivered" | - -## ShipDateBoxed -public sealed interface ShipDateBoxed
-permits
-[ShipDateBoxedString](#shipdateboxedstring) - -sealed interface that stores validated payloads using boxed classes - -## ShipDateBoxedString -public record ShipDateBoxedString
-implements [ShipDateBoxed](#shipdateboxed) - -record that stores validated String payloads, sealed permits implementation - -### Constructor Summary -| Constructor and Description | -| --------------------------- | -| ShipDateBoxedString(String data)
Creates an instance, private visibility | - -### Method Summary -| Modifier and Type | Method and Description | -| ----------------- | ---------------------- | -| String | data()
validated payload | -| @Nullable Object | getData()
validated payload | - -## ShipDate -public static class ShipDate
-extends DateTimeJsonSchema.DateTimeJsonSchema1 - -A schema class that validates payloads - -| Methods Inherited from class org.openapijsonschematools.client.schemas.DateTimeJsonSchema.DateTimeJsonSchema1 | -| ------------------------------------------------------------------ | -| validate | -| validateAndBox | - -## QuantityBoxed -public sealed interface QuantityBoxed
-permits
-[QuantityBoxedNumber](#quantityboxednumber) - -sealed interface that stores validated payloads using boxed classes - -## QuantityBoxedNumber -public record QuantityBoxedNumber
-implements [QuantityBoxed](#quantityboxed) - -record that stores validated Number payloads, sealed permits implementation - -### Constructor Summary -| Constructor and Description | -| --------------------------- | -| QuantityBoxedNumber(Number data)
Creates an instance, private visibility | - -### Method Summary -| Modifier and Type | Method and Description | -| ----------------- | ---------------------- | -| Number | data()
validated payload | -| @Nullable Object | getData()
validated payload | - -## Quantity -public static class Quantity
-extends Int32JsonSchema.Int32JsonSchema1 - -A schema class that validates payloads - -| Methods Inherited from class org.openapijsonschematools.client.schemas.Int32JsonSchema.Int32JsonSchema1 | -| ------------------------------------------------------------------ | -| validate | -| validateAndBox | - -## PetIdBoxed -public sealed interface PetIdBoxed
-permits
-[PetIdBoxedNumber](#petidboxednumber) - -sealed interface that stores validated payloads using boxed classes - -## PetIdBoxedNumber -public record PetIdBoxedNumber
-implements [PetIdBoxed](#petidboxed) - -record that stores validated Number payloads, sealed permits implementation - -### Constructor Summary -| Constructor and Description | -| --------------------------- | -| PetIdBoxedNumber(Number data)
Creates an instance, private visibility | - -### Method Summary -| Modifier and Type | Method and Description | -| ----------------- | ---------------------- | -| Number | data()
validated payload | -| @Nullable Object | getData()
validated payload | - -## PetId -public static class PetId
-extends Int64JsonSchema.Int64JsonSchema1 - -A schema class that validates payloads - -| Methods Inherited from class org.openapijsonschematools.client.schemas.Int64JsonSchema.Int64JsonSchema1 | -| ------------------------------------------------------------------ | -| validate | -| validateAndBox | - -## IdBoxed -public sealed interface IdBoxed
-permits
-[IdBoxedNumber](#idboxednumber) - -sealed interface that stores validated payloads using boxed classes - -## IdBoxedNumber -public record IdBoxedNumber
-implements [IdBoxed](#idboxed) - -record that stores validated Number payloads, sealed permits implementation - -### Constructor Summary -| Constructor and Description | -| --------------------------- | -| IdBoxedNumber(Number data)
Creates an instance, private visibility | - -### Method Summary -| Modifier and Type | Method and Description | -| ----------------- | ---------------------- | -| Number | data()
validated payload | -| @Nullable Object | getData()
validated payload | - -## Id -public static class Id
-extends Int64JsonSchema.Int64JsonSchema1 - -A schema class that validates payloads - -| Methods Inherited from class org.openapijsonschematools.client.schemas.Int64JsonSchema.Int64JsonSchema1 | -| ------------------------------------------------------------------ | -| validate | -| validateAndBox | - -[[Back to top]](#top) [[Back to Component Schemas]](../../../README.md#Component-Schemas) [[Back to README]](../../../README.md) diff --git a/samples/client/petstore/kotlin/docs/components/schemas/PaginatedResultMyObjectDto.md b/samples/client/petstore/kotlin/docs/components/schemas/PaginatedResultMyObjectDto.md deleted file mode 100644 index 885b7c8000c..00000000000 --- a/samples/client/petstore/kotlin/docs/components/schemas/PaginatedResultMyObjectDto.md +++ /dev/null @@ -1,458 +0,0 @@ -# PaginatedResultMyObjectDto -org.openapijsonschematools.client.components.schemas.PaginatedResultMyObjectDto.java -public class PaginatedResultMyObjectDto
- -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 list payloads, extends FrozenList -- classes to build inputs for list payloads -- classes to store validated map payloads, extends FrozenMap -- classes to build inputs for map payloads - -## Nested Class Summary -| Modifier and Type | Class and Description | -| ----------------- | ---------------------- | -| sealed interface | [PaginatedResultMyObjectDto.PaginatedResultMyObjectDto1Boxed](#paginatedresultmyobjectdto1boxed)
sealed interface for validated payloads | -| record | [PaginatedResultMyObjectDto.PaginatedResultMyObjectDto1BoxedMap](#paginatedresultmyobjectdto1boxedmap)
boxed class to store validated Map payloads | -| static class | [PaginatedResultMyObjectDto.PaginatedResultMyObjectDto1](#paginatedresultmyobjectdto1)
schema class | -| static class | [PaginatedResultMyObjectDto.PaginatedResultMyObjectDtoMapBuilder](#paginatedresultmyobjectdtomapbuilder)
builder for Map payloads | -| static class | [PaginatedResultMyObjectDto.PaginatedResultMyObjectDtoMap](#paginatedresultmyobjectdtomap)
output class for Map payloads | -| sealed interface | [PaginatedResultMyObjectDto.ResultsBoxed](#resultsboxed)
sealed interface for validated payloads | -| record | [PaginatedResultMyObjectDto.ResultsBoxedList](#resultsboxedlist)
boxed class to store validated List payloads | -| static class | [PaginatedResultMyObjectDto.Results](#results)
schema class | -| static class | [PaginatedResultMyObjectDto.ResultsListBuilder](#resultslistbuilder)
builder for List payloads | -| static class | [PaginatedResultMyObjectDto.ResultsList](#resultslist)
output class for List payloads | -| sealed interface | [PaginatedResultMyObjectDto.CountBoxed](#countboxed)
sealed interface for validated payloads | -| record | [PaginatedResultMyObjectDto.CountBoxedNumber](#countboxednumber)
boxed class to store validated Number payloads | -| static class | [PaginatedResultMyObjectDto.Count](#count)
schema class | -| sealed interface | [PaginatedResultMyObjectDto.AdditionalPropertiesBoxed](#additionalpropertiesboxed)
sealed interface for validated payloads | -| record | [PaginatedResultMyObjectDto.AdditionalPropertiesBoxedVoid](#additionalpropertiesboxedvoid)
boxed class to store validated null payloads | -| record | [PaginatedResultMyObjectDto.AdditionalPropertiesBoxedBoolean](#additionalpropertiesboxedboolean)
boxed class to store validated boolean payloads | -| record | [PaginatedResultMyObjectDto.AdditionalPropertiesBoxedNumber](#additionalpropertiesboxednumber)
boxed class to store validated Number payloads | -| record | [PaginatedResultMyObjectDto.AdditionalPropertiesBoxedString](#additionalpropertiesboxedstring)
boxed class to store validated String payloads | -| record | [PaginatedResultMyObjectDto.AdditionalPropertiesBoxedList](#additionalpropertiesboxedlist)
boxed class to store validated List payloads | -| record | [PaginatedResultMyObjectDto.AdditionalPropertiesBoxedMap](#additionalpropertiesboxedmap)
boxed class to store validated Map payloads | -| static class | [PaginatedResultMyObjectDto.AdditionalProperties](#additionalproperties)
schema class | - -## PaginatedResultMyObjectDto1Boxed -public sealed interface PaginatedResultMyObjectDto1Boxed
-permits
-[PaginatedResultMyObjectDto1BoxedMap](#paginatedresultmyobjectdto1boxedmap) - -sealed interface that stores validated payloads using boxed classes - -## PaginatedResultMyObjectDto1BoxedMap -public record PaginatedResultMyObjectDto1BoxedMap
-implements [PaginatedResultMyObjectDto1Boxed](#paginatedresultmyobjectdto1boxed) - -record that stores validated Map payloads, sealed permits implementation - -### Constructor Summary -| Constructor and Description | -| --------------------------- | -| PaginatedResultMyObjectDto1BoxedMap([PaginatedResultMyObjectDtoMap](#paginatedresultmyobjectdtomap) data)
Creates an instance, private visibility | - -### Method Summary -| Modifier and Type | Method and Description | -| ----------------- | ---------------------- | -| [PaginatedResultMyObjectDtoMap](#paginatedresultmyobjectdtomap) | data()
validated payload | -| @Nullable Object | getData()
validated payload | - -## PaginatedResultMyObjectDto1 -public static class PaginatedResultMyObjectDto1
-extends JsonSchema - -A schema class that validates payloads - -### Code Sample -``` -import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags; -import org.openapijsonschematools.client.configurations.SchemaConfiguration; -import org.openapijsonschematools.client.exceptions.ValidationException; -import org.openapijsonschematools.client.schemas.validation.MapUtils; -import org.openapijsonschematools.client.schemas.validation.FrozenList; -import org.openapijsonschematools.client.schemas.validation.FrozenMap; -import org.openapijsonschematools.client.components.schemas.PaginatedResultMyObjectDto; - -import java.util.Arrays; -import java.util.List; -import java.util.AbstractMap; - -static final SchemaConfiguration configuration = new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().build()); - -// Map validation -PaginatedResultMyObjectDto.PaginatedResultMyObjectDtoMap validatedPayload = - PaginatedResultMyObjectDto.PaginatedResultMyObjectDto1.validate( - new PaginatedResultMyObjectDto.PaginatedResultMyObjectDtoMapBuilder() - .count(1) - - .results( - Arrays.asList( - ) - ) - .build(), - configuration -); -``` - -### Field Summary -| Modifier and Type | Field and Description | -| ----------------- | ---------------------- | -| Set> | type = Set.of(Map.class) | -| Map> | properties = Map.ofEntries(
    new PropertyEntry("count", [Count.class](#count))),
    new PropertyEntry("results", [Results.class](#results)))
)
| -| Set | required = Set.of(
    "count",
    "results"
)
| -| Class | additionalProperties = [AdditionalProperties.class](#additionalproperties) | - -### Method Summary -| Modifier and Type | Method and Description | -| ----------------- | ---------------------- | -| [PaginatedResultMyObjectDtoMap](#paginatedresultmyobjectdtomap) | validate([Map<?, ?>](#paginatedresultmyobjectdtomapbuilder) arg, SchemaConfiguration configuration) | -| [PaginatedResultMyObjectDto1BoxedMap](#paginatedresultmyobjectdto1boxedmap) | validateAndBox([Map<?, ?>](#paginatedresultmyobjectdtomapbuilder) arg, SchemaConfiguration configuration) | -| [PaginatedResultMyObjectDto1Boxed](#paginatedresultmyobjectdto1boxed) | validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) | -| @Nullable Object | validate(@Nullable Object arg, SchemaConfiguration configuration) | - -## PaginatedResultMyObjectDtoMap00Builder -public class PaginatedResultMyObjectDtoMap00Builder
-builder for `Map` - -A class that builds the Map input type - -### Constructor Summary -| Constructor and Description | -| --------------------------- | -| PaginatedResultMyObjectDtoMap00Builder(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 | - -## PaginatedResultMyObjectDtoMap01Builder -public class PaginatedResultMyObjectDtoMap01Builder
-builder for `Map` - -A class that builds the Map input type - -### Constructor Summary -| Constructor and Description | -| --------------------------- | -| PaginatedResultMyObjectDtoMap01Builder(Map instance)
Creates a builder that contains the passed instance | - -### Method Summary -| Modifier and Type | Method and Description | -| ----------------- | ---------------------- | -| [PaginatedResultMyObjectDtoMap00Builder](#paginatedresultmyobjectdtomap00builder) | results(List> value) | - -## PaginatedResultMyObjectDtoMap10Builder -public class PaginatedResultMyObjectDtoMap10Builder
-builder for `Map` - -A class that builds the Map input type - -### Constructor Summary -| Constructor and Description | -| --------------------------- | -| PaginatedResultMyObjectDtoMap10Builder(Map instance)
Creates a builder that contains the passed instance | - -### Method Summary -| Modifier and Type | Method and Description | -| ----------------- | ---------------------- | -| [PaginatedResultMyObjectDtoMap00Builder](#paginatedresultmyobjectdtomap00builder) | count(int value) | -| [PaginatedResultMyObjectDtoMap00Builder](#paginatedresultmyobjectdtomap00builder) | count(float value) | -| [PaginatedResultMyObjectDtoMap00Builder](#paginatedresultmyobjectdtomap00builder) | count(long value) | -| [PaginatedResultMyObjectDtoMap00Builder](#paginatedresultmyobjectdtomap00builder) | count(double value) | - -## PaginatedResultMyObjectDtoMapBuilder -public class PaginatedResultMyObjectDtoMapBuilder
-builder for `Map` - -A class that builds the Map input type - -### Constructor Summary -| Constructor and Description | -| --------------------------- | -| PaginatedResultMyObjectDtoMapBuilder()
Creates a builder that contains an empty map | - -### Method Summary -| Modifier and Type | Method and Description | -| ----------------- | ---------------------- | -| [PaginatedResultMyObjectDtoMap01Builder](#paginatedresultmyobjectdtomap01builder) | count(int value) | -| [PaginatedResultMyObjectDtoMap01Builder](#paginatedresultmyobjectdtomap01builder) | count(float value) | -| [PaginatedResultMyObjectDtoMap01Builder](#paginatedresultmyobjectdtomap01builder) | count(long value) | -| [PaginatedResultMyObjectDtoMap01Builder](#paginatedresultmyobjectdtomap01builder) | count(double value) | -| [PaginatedResultMyObjectDtoMap10Builder](#paginatedresultmyobjectdtomap10builder) | results(List> value) | - -## PaginatedResultMyObjectDtoMap -public static class PaginatedResultMyObjectDtoMap
-extends FrozenMap - -A class to store validated Map payloads - -### Method Summary -| Modifier and Type | Method and Description | -| ----------------- | ---------------------- | -| static [PaginatedResultMyObjectDtoMap](#paginatedresultmyobjectdtomap) | of([Map](#paginatedresultmyobjectdtomapbuilder) arg, SchemaConfiguration configuration) | -| Number | count()
| -| [ResultsList](#resultslist) | results()
| - -## ResultsBoxed -public sealed interface ResultsBoxed
-permits
-[ResultsBoxedList](#resultsboxedlist) - -sealed interface that stores validated payloads using boxed classes - -## ResultsBoxedList -public record ResultsBoxedList
-implements [ResultsBoxed](#resultsboxed) - -record that stores validated List payloads, sealed permits implementation - -### Constructor Summary -| Constructor and Description | -| --------------------------- | -| ResultsBoxedList([ResultsList](#resultslist) data)
Creates an instance, private visibility | - -### Method Summary -| Modifier and Type | Method and Description | -| ----------------- | ---------------------- | -| [ResultsList](#resultslist) | data()
validated payload | -| @Nullable Object | getData()
validated payload | - -## Results -public static class Results
-extends JsonSchema - -A schema class that validates payloads - -### Code Sample -``` -import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags; -import org.openapijsonschematools.client.configurations.SchemaConfiguration; -import org.openapijsonschematools.client.exceptions.ValidationException; -import org.openapijsonschematools.client.schemas.validation.MapUtils; -import org.openapijsonschematools.client.schemas.validation.FrozenList; -import org.openapijsonschematools.client.schemas.validation.FrozenMap; -import org.openapijsonschematools.client.components.schemas.PaginatedResultMyObjectDto; - -import java.util.Arrays; -import java.util.List; -import java.util.AbstractMap; - -static final SchemaConfiguration configuration = new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().build()); - -// List validation -PaginatedResultMyObjectDto.ResultsList validatedPayload = - PaginatedResultMyObjectDto.Results.validate( - new PaginatedResultMyObjectDto.ResultsListBuilder() - .build(), - configuration -); -``` - -### Field Summary -| Modifier and Type | Field and Description | -| ----------------- | ---------------------- | -| Set> | type = Set.of(List.class) | -| Class | items = [MyObjectDto.MyObjectDto1.class](../../components/schemas/MyObjectDto.md#myobjectdto1) | - -### Method Summary -| Modifier and Type | Method and Description | -| ----------------- | ---------------------- | -| [ResultsList](#resultslist) | validate([List](#resultslistbuilder) arg, SchemaConfiguration configuration) | -| [ResultsBoxedList](#resultsboxedlist) | validateAndBox([List](#resultslistbuilder) arg, SchemaConfiguration configuration) | -| [ResultsBoxed](#resultsboxed) | validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) | -| @Nullable Object | validate(@Nullable Object arg, SchemaConfiguration configuration) | - -## ResultsListBuilder -public class ResultsListBuilder
-builder for `List>` - -A class that builds the List input type - -### Constructor Summary -| Constructor and Description | -| --------------------------- | -| ResultsListBuilder()
Creates an empty list | -| ResultsListBuilder(List> items)
Stores the items in a list | - -### Method Summary -| Modifier and Type | Method and Description | -| ----------------- | ---------------------- | -| ResultsListBuilder | add(Map item) | -| List> | build()
Returns list input that should be used with Schema.validate | - -## ResultsList -public class ResultsList
-extends `FrozenList` - -A class to store validated List payloads - -### Method Summary -| Modifier and Type | Method and Description | -| ----------------- | ---------------------- | -| static [ResultsList](#resultslist) | of([List>](#resultslistbuilder) arg, SchemaConfiguration configuration) | - -## CountBoxed -public sealed interface CountBoxed
-permits
-[CountBoxedNumber](#countboxednumber) - -sealed interface that stores validated payloads using boxed classes - -## CountBoxedNumber -public record CountBoxedNumber
-implements [CountBoxed](#countboxed) - -record that stores validated Number payloads, sealed permits implementation - -### Constructor Summary -| Constructor and Description | -| --------------------------- | -| CountBoxedNumber(Number data)
Creates an instance, private visibility | - -### Method Summary -| Modifier and Type | Method and Description | -| ----------------- | ---------------------- | -| Number | data()
validated payload | -| @Nullable Object | getData()
validated payload | - -## Count -public static class Count
-extends IntJsonSchema.IntJsonSchema1 - -A schema class that validates payloads - -| Methods Inherited from class org.openapijsonschematools.client.schemas.IntJsonSchema.IntJsonSchema1 | -| ------------------------------------------------------------------ | -| validate | -| validateAndBox | - -## 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(Nothing? data)
Creates an instance, private visibility | - -### Method Summary -| Modifier and Type | Method and Description | -| ----------------- | ---------------------- | -| Nothing? | 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 Component Schemas]](../../../README.md#Component-Schemas) [[Back to README]](../../../README.md) diff --git a/samples/client/petstore/kotlin/docs/components/schemas/ParentPet.md b/samples/client/petstore/kotlin/docs/components/schemas/ParentPet.md deleted file mode 100644 index d377636a119..00000000000 --- a/samples/client/petstore/kotlin/docs/components/schemas/ParentPet.md +++ /dev/null @@ -1,61 +0,0 @@ -# ParentPet -org.openapijsonschematools.client.components.schemas.ParentPet.java -public class ParentPet
- -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 - -## Nested Class Summary -| Modifier and Type | Class and Description | -| ----------------- | ---------------------- | -| sealed interface | [ParentPet.ParentPet1Boxed](#parentpet1boxed)
sealed interface for validated payloads | -| record | [ParentPet.ParentPet1BoxedMap](#parentpet1boxedmap)
boxed class to store validated Map payloads | -| static class | [ParentPet.ParentPet1](#parentpet1)
schema class | - -## ParentPet1Boxed -public sealed interface ParentPet1Boxed
-permits
-[ParentPet1BoxedMap](#parentpet1boxedmap) - -sealed interface that stores validated payloads using boxed classes - -## ParentPet1BoxedMap -public record ParentPet1BoxedMap
-implements [ParentPet1Boxed](#parentpet1boxed) - -record that stores validated Map payloads, sealed permits implementation - -### Constructor Summary -| Constructor and Description | -| --------------------------- | -| ParentPet1BoxedMap(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 | - -## ParentPet1 -public static class ParentPet1
-extends JsonSchema - -A schema class that validates payloads - -### Field Summary -| Modifier and Type | Field and Description | -| ----------------- | ---------------------- | -| Set> | type = Set.of(Map.class) | -| List> | allOf = List.of(
    [GrandparentAnimal.GrandparentAnimal1.class](../../components/schemas/GrandparentAnimal.md#grandparentanimal1)
;)
| - -### Method Summary -| Modifier and Type | Method and Description | -| ----------------- | ---------------------- | -| FrozenMap | validate(Map<?, ?> arg, SchemaConfiguration configuration) | -| [ParentPet1BoxedMap](#parentpet1boxedmap) | validateAndBox(Map<?, ?> arg, SchemaConfiguration configuration) | -| [ParentPet1Boxed](#parentpet1boxed) | validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) | -| @Nullable Object | validate(@Nullable Object arg, SchemaConfiguration configuration) | - -[[Back to top]](#top) [[Back to Component Schemas]](../../../README.md#Component-Schemas) [[Back to README]](../../../README.md) diff --git a/samples/client/petstore/kotlin/docs/components/schemas/Pet.md b/samples/client/petstore/kotlin/docs/components/schemas/Pet.md deleted file mode 100644 index 5c54e5b4e49..00000000000 --- a/samples/client/petstore/kotlin/docs/components/schemas/Pet.md +++ /dev/null @@ -1,652 +0,0 @@ -# Pet -org.openapijsonschematools.client.components.schemas.Pet.java -public class Pet
- -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 list payloads, extends FrozenList -- classes to build inputs for list payloads -- 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 | [Pet.Pet1Boxed](#pet1boxed)
sealed interface for validated payloads | -| record | [Pet.Pet1BoxedMap](#pet1boxedmap)
boxed class to store validated Map payloads | -| static class | [Pet.Pet1](#pet1)
schema class | -| static class | [Pet.PetMapBuilder](#petmapbuilder)
builder for Map payloads | -| static class | [Pet.PetMap](#petmap)
output class for Map payloads | -| sealed interface | [Pet.TagsBoxed](#tagsboxed)
sealed interface for validated payloads | -| record | [Pet.TagsBoxedList](#tagsboxedlist)
boxed class to store validated List payloads | -| static class | [Pet.Tags](#tags)
schema class | -| static class | [Pet.TagsListBuilder](#tagslistbuilder)
builder for List payloads | -| static class | [Pet.TagsList](#tagslist)
output class for List payloads | -| sealed interface | [Pet.StatusBoxed](#statusboxed)
sealed interface for validated payloads | -| record | [Pet.StatusBoxedString](#statusboxedstring)
boxed class to store validated String payloads | -| static class | [Pet.Status](#status)
schema class | -| enum | [Pet.StringStatusEnums](#stringstatusenums)
String enum | -| sealed interface | [Pet.PhotoUrlsBoxed](#photourlsboxed)
sealed interface for validated payloads | -| record | [Pet.PhotoUrlsBoxedList](#photourlsboxedlist)
boxed class to store validated List payloads | -| static class | [Pet.PhotoUrls](#photourls)
schema class | -| static class | [Pet.PhotoUrlsListBuilder](#photourlslistbuilder)
builder for List payloads | -| static class | [Pet.PhotoUrlsList](#photourlslist)
output class for List payloads | -| sealed interface | [Pet.ItemsBoxed](#itemsboxed)
sealed interface for validated payloads | -| record | [Pet.ItemsBoxedString](#itemsboxedstring)
boxed class to store validated String payloads | -| static class | [Pet.Items](#items)
schema class | -| sealed interface | [Pet.NameBoxed](#nameboxed)
sealed interface for validated payloads | -| record | [Pet.NameBoxedString](#nameboxedstring)
boxed class to store validated String payloads | -| static class | [Pet.Name](#name)
schema class | -| sealed interface | [Pet.IdBoxed](#idboxed)
sealed interface for validated payloads | -| record | [Pet.IdBoxedNumber](#idboxednumber)
boxed class to store validated Number payloads | -| static class | [Pet.Id](#id)
schema class | - -## Pet1Boxed -public sealed interface Pet1Boxed
-permits
-[Pet1BoxedMap](#pet1boxedmap) - -sealed interface that stores validated payloads using boxed classes - -## Pet1BoxedMap -public record Pet1BoxedMap
-implements [Pet1Boxed](#pet1boxed) - -record that stores validated Map payloads, sealed permits implementation - -### Constructor Summary -| Constructor and Description | -| --------------------------- | -| Pet1BoxedMap([PetMap](#petmap) data)
Creates an instance, private visibility | - -### Method Summary -| Modifier and Type | Method and Description | -| ----------------- | ---------------------- | -| [PetMap](#petmap) | data()
validated payload | -| @Nullable Object | getData()
validated payload | - -## Pet1 -public static class Pet1
-extends JsonSchema - -A schema class that validates payloads - -## Description -Pet object that needs to be added to the store - -### Code Sample -``` -import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags; -import org.openapijsonschematools.client.configurations.SchemaConfiguration; -import org.openapijsonschematools.client.exceptions.ValidationException; -import org.openapijsonschematools.client.schemas.validation.MapUtils; -import org.openapijsonschematools.client.schemas.validation.FrozenList; -import org.openapijsonschematools.client.schemas.validation.FrozenMap; -import org.openapijsonschematools.client.components.schemas.Pet; - -import java.util.Arrays; -import java.util.List; -import java.util.AbstractMap; - -static final SchemaConfiguration configuration = new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().build()); - -// Map validation -Pet.PetMap validatedPayload = - Pet.Pet1.validate( - 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(), - configuration -); -``` - -### Field Summary -| Modifier and Type | Field and Description | -| ----------------- | ---------------------- | -| Set> | type = Set.of(Map.class) | -| Map> | properties = Map.ofEntries(
    new PropertyEntry("id", [Id.class](#id))),
    new PropertyEntry("category", [Category.Category1.class](../../components/schemas/Category.md#category1)),
    new PropertyEntry("name", [Name.class](#name))),
    new PropertyEntry("photoUrls", [PhotoUrls.class](#photourls))),
    new PropertyEntry("tags", [Tags.class](#tags))),
    new PropertyEntry("status", [Status.class](#status)))
)
| -| Set | required = Set.of(
    "name",
    "photoUrls"
)
| - -### Method Summary -| Modifier and Type | Method and Description | -| ----------------- | ---------------------- | -| [PetMap](#petmap) | validate([Map<?, ?>](#petmapbuilder) arg, SchemaConfiguration configuration) | -| [Pet1BoxedMap](#pet1boxedmap) | validateAndBox([Map<?, ?>](#petmapbuilder) arg, SchemaConfiguration configuration) | -| [Pet1Boxed](#pet1boxed) | validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) | -| @Nullable Object | validate(@Nullable Object arg, SchemaConfiguration configuration) | - -## PetMap00Builder -public class PetMap00Builder
-builder for `Map` - -A class that builds the Map input type - -### Constructor Summary -| Constructor and Description | -| --------------------------- | -| PetMap00Builder(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 | -| [PetMap00Builder](#petmap00builder) | id(int value) | -| [PetMap00Builder](#petmap00builder) | id(float value) | -| [PetMap00Builder](#petmap00builder) | id(long value) | -| [PetMap00Builder](#petmap00builder) | id(double value) | -| [PetMap00Builder](#petmap00builder) | category(Map value) | -| [PetMap00Builder](#petmap00builder) | tags(List> value) | -| [PetMap00Builder](#petmap00builder) | status(String value) | -| [PetMap00Builder](#petmap00builder) | status([StringStatusEnums](#stringstatusenums) value) | -| [PetMap00Builder](#petmap00builder) | additionalProperty(String key, Nothing? value) | -| [PetMap00Builder](#petmap00builder) | additionalProperty(String key, boolean value) | -| [PetMap00Builder](#petmap00builder) | additionalProperty(String key, String value) | -| [PetMap00Builder](#petmap00builder) | additionalProperty(String key, int value) | -| [PetMap00Builder](#petmap00builder) | additionalProperty(String key, float value) | -| [PetMap00Builder](#petmap00builder) | additionalProperty(String key, long value) | -| [PetMap00Builder](#petmap00builder) | additionalProperty(String key, double value) | -| [PetMap00Builder](#petmap00builder) | additionalProperty(String key, List value) | -| [PetMap00Builder](#petmap00builder) | additionalProperty(String key, Map value) | - -## PetMap01Builder -public class PetMap01Builder
-builder for `Map` - -A class that builds the Map input type - -### Constructor Summary -| Constructor and Description | -| --------------------------- | -| PetMap01Builder(Map instance)
Creates a builder that contains the passed instance | - -### Method Summary -| Modifier and Type | Method and Description | -| ----------------- | ---------------------- | -| [PetMap00Builder](#petmap00builder) | photoUrls(List value) | - -## PetMap10Builder -public class PetMap10Builder
-builder for `Map` - -A class that builds the Map input type - -### Constructor Summary -| Constructor and Description | -| --------------------------- | -| PetMap10Builder(Map instance)
Creates a builder that contains the passed instance | - -### Method Summary -| Modifier and Type | Method and Description | -| ----------------- | ---------------------- | -| [PetMap00Builder](#petmap00builder) | name(String value) | - -## PetMapBuilder -public class PetMapBuilder
-builder for `Map` - -A class that builds the Map input type - -### Constructor Summary -| Constructor and Description | -| --------------------------- | -| PetMapBuilder()
Creates a builder that contains an empty map | - -### Method Summary -| Modifier and Type | Method and Description | -| ----------------- | ---------------------- | -| [PetMap01Builder](#petmap01builder) | name(String value) | -| [PetMap10Builder](#petmap10builder) | photoUrls(List value) | - -## PetMap -public static class PetMap
-extends FrozenMap - -A class to store validated Map payloads - -### Method Summary -| Modifier and Type | Method and Description | -| ----------------- | ---------------------- | -| static [PetMap](#petmap) | of([Map](#petmapbuilder) arg, SchemaConfiguration configuration) | -| String | name()
| -| [PhotoUrlsList](#photourlslist) | photoUrls()
| -| Number | id()
[optional] value must be a 64 bit integer | -| [Category.CategoryMap](../../components/schemas/Category.md#categorymap) | category()
[optional] | -| [TagsList](#tagslist) | tags()
[optional] | -| String | status()
[optional] must be one of ["available", "pending", "sold"] | -| @Nullable Object | getAdditionalProperty(String name)
provides type safety for additional properties | - -## TagsBoxed -public sealed interface TagsBoxed
-permits
-[TagsBoxedList](#tagsboxedlist) - -sealed interface that stores validated payloads using boxed classes - -## TagsBoxedList -public record TagsBoxedList
-implements [TagsBoxed](#tagsboxed) - -record that stores validated List payloads, sealed permits implementation - -### Constructor Summary -| Constructor and Description | -| --------------------------- | -| TagsBoxedList([TagsList](#tagslist) data)
Creates an instance, private visibility | - -### Method Summary -| Modifier and Type | Method and Description | -| ----------------- | ---------------------- | -| [TagsList](#tagslist) | data()
validated payload | -| @Nullable Object | getData()
validated payload | - -## Tags -public static class Tags
-extends JsonSchema - -A schema class that validates payloads - -### Code Sample -``` -import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags; -import org.openapijsonschematools.client.configurations.SchemaConfiguration; -import org.openapijsonschematools.client.exceptions.ValidationException; -import org.openapijsonschematools.client.schemas.validation.MapUtils; -import org.openapijsonschematools.client.schemas.validation.FrozenList; -import org.openapijsonschematools.client.schemas.validation.FrozenMap; -import org.openapijsonschematools.client.components.schemas.Pet; - -import java.util.Arrays; -import java.util.List; -import java.util.AbstractMap; - -static final SchemaConfiguration configuration = new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().build()); - -// List validation -Pet.TagsList validatedPayload = - Pet.Tags.validate( - new Pet.TagsListBuilder() - .add( - MapUtils.makeMap( - new AbstractMap.SimpleEntry( - "id", - 1L - ), - new AbstractMap.SimpleEntry( - "name", - "a" - ) - ) - ) - .build(), - configuration -); -``` - -### Field Summary -| Modifier and Type | Field and Description | -| ----------------- | ---------------------- | -| Set> | type = Set.of(List.class) | -| Class | items = [Tag.Tag1.class](../../components/schemas/Tag.md#tag1) | - -### Method Summary -| Modifier and Type | Method and Description | -| ----------------- | ---------------------- | -| [TagsList](#tagslist) | validate([List](#tagslistbuilder) arg, SchemaConfiguration configuration) | -| [TagsBoxedList](#tagsboxedlist) | validateAndBox([List](#tagslistbuilder) arg, SchemaConfiguration configuration) | -| [TagsBoxed](#tagsboxed) | validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) | -| @Nullable Object | validate(@Nullable Object arg, SchemaConfiguration configuration) | - -## TagsListBuilder -public class TagsListBuilder
-builder for `List>` - -A class that builds the List input type - -### Constructor Summary -| Constructor and Description | -| --------------------------- | -| TagsListBuilder()
Creates an empty list | -| TagsListBuilder(List> items)
Stores the items in a list | - -### Method Summary -| Modifier and Type | Method and Description | -| ----------------- | ---------------------- | -| TagsListBuilder | add(Map item) | -| List> | build()
Returns list input that should be used with Schema.validate | - -## TagsList -public class TagsList
-extends `FrozenList` - -A class to store validated List payloads - -### Method Summary -| Modifier and Type | Method and Description | -| ----------------- | ---------------------- | -| static [TagsList](#tagslist) | of([List>](#tagslistbuilder) arg, SchemaConfiguration configuration) | - -## StatusBoxed -public sealed interface StatusBoxed
-permits
-[StatusBoxedString](#statusboxedstring) - -sealed interface that stores validated payloads using boxed classes - -## StatusBoxedString -public record StatusBoxedString
-implements [StatusBoxed](#statusboxed) - -record that stores validated String payloads, sealed permits implementation - -### Constructor Summary -| Constructor and Description | -| --------------------------- | -| StatusBoxedString(String data)
Creates an instance, private visibility | - -### Method Summary -| Modifier and Type | Method and Description | -| ----------------- | ---------------------- | -| String | data()
validated payload | -| @Nullable Object | getData()
validated payload | - -## Status -public static class Status
-extends JsonSchema - -A schema class that validates payloads - -## Description -pet status in the store - -### Code Sample -``` -import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags; -import org.openapijsonschematools.client.configurations.SchemaConfiguration; -import org.openapijsonschematools.client.exceptions.ValidationException; -import org.openapijsonschematools.client.schemas.validation.MapUtils; -import org.openapijsonschematools.client.schemas.validation.FrozenList; -import org.openapijsonschematools.client.schemas.validation.FrozenMap; -import org.openapijsonschematools.client.components.schemas.Pet; - -import java.util.Arrays; -import java.util.List; -import java.util.AbstractMap; - -static final SchemaConfiguration configuration = new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().build()); - -// String validation -String validatedPayload = Pet.Status.validate( - "available", - configuration -); -``` - -### Field Summary -| Modifier and Type | Field and Description | -| ----------------- | ---------------------- | -| Set> | type = Set.of(
    String.class
)
| -| Set | enumValues = SetMaker.makeSet(
    "available",
    "pending",
    "sold"
)
| - -### Method Summary -| Modifier and Type | Method and Description | -| ----------------- | ---------------------- | -| String | validate(String arg, SchemaConfiguration configuration) | -| String | validate([StringStatusEnums](#stringstatusenums) arg, SchemaConfiguration configuration) | -| [StatusBoxedString](#statusboxedstring) | validateAndBox(String arg, SchemaConfiguration configuration) | -| [StatusBoxed](#statusboxed) | validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) | -| @Nullable Object | validate(@Nullable Object arg, SchemaConfiguration configuration) | - -## StringStatusEnums -public enum StringStatusEnums
-extends `Enum` - -A class that stores String enum values - -### Enum Constant Summary -| Enum Constant | Description | -| ------------- | ----------- | -| AVAILABLE | value = "available" | -| PENDING | value = "pending" | -| SOLD | value = "sold" | - -## PhotoUrlsBoxed -public sealed interface PhotoUrlsBoxed
-permits
-[PhotoUrlsBoxedList](#photourlsboxedlist) - -sealed interface that stores validated payloads using boxed classes - -## PhotoUrlsBoxedList -public record PhotoUrlsBoxedList
-implements [PhotoUrlsBoxed](#photourlsboxed) - -record that stores validated List payloads, sealed permits implementation - -### Constructor Summary -| Constructor and Description | -| --------------------------- | -| PhotoUrlsBoxedList([PhotoUrlsList](#photourlslist) data)
Creates an instance, private visibility | - -### Method Summary -| Modifier and Type | Method and Description | -| ----------------- | ---------------------- | -| [PhotoUrlsList](#photourlslist) | data()
validated payload | -| @Nullable Object | getData()
validated payload | - -## PhotoUrls -public static class PhotoUrls
-extends JsonSchema - -A schema class that validates payloads - -### Code Sample -``` -import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags; -import org.openapijsonschematools.client.configurations.SchemaConfiguration; -import org.openapijsonschematools.client.exceptions.ValidationException; -import org.openapijsonschematools.client.schemas.validation.MapUtils; -import org.openapijsonschematools.client.schemas.validation.FrozenList; -import org.openapijsonschematools.client.schemas.validation.FrozenMap; -import org.openapijsonschematools.client.components.schemas.Pet; - -import java.util.Arrays; -import java.util.List; -import java.util.AbstractMap; - -static final SchemaConfiguration configuration = new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().build()); - -// List validation -Pet.PhotoUrlsList validatedPayload = - Pet.PhotoUrls.validate( - new Pet.PhotoUrlsListBuilder() - .add("a") - - .build(), - configuration -); -``` - -### Field Summary -| Modifier and Type | Field and Description | -| ----------------- | ---------------------- | -| Set> | type = Set.of(List.class) | -| Class | items = [Items.class](#items) | - -### Method Summary -| Modifier and Type | Method and Description | -| ----------------- | ---------------------- | -| [PhotoUrlsList](#photourlslist) | validate([List](#photourlslistbuilder) arg, SchemaConfiguration configuration) | -| [PhotoUrlsBoxedList](#photourlsboxedlist) | validateAndBox([List](#photourlslistbuilder) arg, SchemaConfiguration configuration) | -| [PhotoUrlsBoxed](#photourlsboxed) | validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) | -| @Nullable Object | validate(@Nullable Object arg, SchemaConfiguration configuration) | - -## PhotoUrlsListBuilder -public class PhotoUrlsListBuilder
-builder for `List` - -A class that builds the List input type - -### Constructor Summary -| Constructor and Description | -| --------------------------- | -| PhotoUrlsListBuilder()
Creates an empty list | -| PhotoUrlsListBuilder(List items)
Stores the items in a list | - -### Method Summary -| Modifier and Type | Method and Description | -| ----------------- | ---------------------- | -| PhotoUrlsListBuilder | add(String item) | -| List | build()
Returns list input that should be used with Schema.validate | - -## PhotoUrlsList -public class PhotoUrlsList
-extends `FrozenList` - -A class to store validated List payloads - -### Method Summary -| Modifier and Type | Method and Description | -| ----------------- | ---------------------- | -| static [PhotoUrlsList](#photourlslist) | of([List](#photourlslistbuilder) arg, SchemaConfiguration configuration) | - -## ItemsBoxed -public sealed interface ItemsBoxed
-permits
-[ItemsBoxedString](#itemsboxedstring) - -sealed interface that stores validated payloads using boxed classes - -## ItemsBoxedString -public record ItemsBoxedString
-implements [ItemsBoxed](#itemsboxed) - -record that stores validated String payloads, sealed permits implementation - -### Constructor Summary -| Constructor and Description | -| --------------------------- | -| ItemsBoxedString(String data)
Creates an instance, private visibility | - -### Method Summary -| Modifier and Type | Method and Description | -| ----------------- | ---------------------- | -| String | data()
validated payload | -| @Nullable Object | getData()
validated payload | - -## Items -public static class Items
-extends StringJsonSchema.StringJsonSchema1 - -A schema class that validates payloads - -| Methods Inherited from class org.openapijsonschematools.client.schemas.StringJsonSchema.StringJsonSchema1 | -| ------------------------------------------------------------------ | -| validate | -| validateAndBox | - -## NameBoxed -public sealed interface NameBoxed
-permits
-[NameBoxedString](#nameboxedstring) - -sealed interface that stores validated payloads using boxed classes - -## NameBoxedString -public record NameBoxedString
-implements [NameBoxed](#nameboxed) - -record that stores validated String payloads, sealed permits implementation - -### Constructor Summary -| Constructor and Description | -| --------------------------- | -| NameBoxedString(String data)
Creates an instance, private visibility | - -### Method Summary -| Modifier and Type | Method and Description | -| ----------------- | ---------------------- | -| String | data()
validated payload | -| @Nullable Object | getData()
validated payload | - -## Name -public static class Name
-extends StringJsonSchema.StringJsonSchema1 - -A schema class that validates payloads - -| Methods Inherited from class org.openapijsonschematools.client.schemas.StringJsonSchema.StringJsonSchema1 | -| ------------------------------------------------------------------ | -| validate | -| validateAndBox | - -## IdBoxed -public sealed interface IdBoxed
-permits
-[IdBoxedNumber](#idboxednumber) - -sealed interface that stores validated payloads using boxed classes - -## IdBoxedNumber -public record IdBoxedNumber
-implements [IdBoxed](#idboxed) - -record that stores validated Number payloads, sealed permits implementation - -### Constructor Summary -| Constructor and Description | -| --------------------------- | -| IdBoxedNumber(Number data)
Creates an instance, private visibility | - -### Method Summary -| Modifier and Type | Method and Description | -| ----------------- | ---------------------- | -| Number | data()
validated payload | -| @Nullable Object | getData()
validated payload | - -## Id -public static class Id
-extends Int64JsonSchema.Int64JsonSchema1 - -A schema class that validates payloads - -| Methods Inherited from class org.openapijsonschematools.client.schemas.Int64JsonSchema.Int64JsonSchema1 | -| ------------------------------------------------------------------ | -| validate | -| validateAndBox | - -[[Back to top]](#top) [[Back to Component Schemas]](../../../README.md#Component-Schemas) [[Back to README]](../../../README.md) diff --git a/samples/client/petstore/kotlin/docs/components/schemas/Pig.md b/samples/client/petstore/kotlin/docs/components/schemas/Pig.md deleted file mode 100644 index fa72e2c2e0c..00000000000 --- a/samples/client/petstore/kotlin/docs/components/schemas/Pig.md +++ /dev/null @@ -1,169 +0,0 @@ -# Pig -org.openapijsonschematools.client.components.schemas.Pig.java -public class Pig
- -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 - -## Nested Class Summary -| Modifier and Type | Class and Description | -| ----------------- | ---------------------- | -| sealed interface | [Pig.Pig1Boxed](#pig1boxed)
sealed interface for validated payloads | -| record | [Pig.Pig1BoxedVoid](#pig1boxedvoid)
boxed class to store validated null payloads | -| record | [Pig.Pig1BoxedBoolean](#pig1boxedboolean)
boxed class to store validated boolean payloads | -| record | [Pig.Pig1BoxedNumber](#pig1boxednumber)
boxed class to store validated Number payloads | -| record | [Pig.Pig1BoxedString](#pig1boxedstring)
boxed class to store validated String payloads | -| record | [Pig.Pig1BoxedList](#pig1boxedlist)
boxed class to store validated List payloads | -| record | [Pig.Pig1BoxedMap](#pig1boxedmap)
boxed class to store validated Map payloads | -| static class | [Pig.Pig1](#pig1)
schema class | - -## Pig1Boxed -public sealed interface Pig1Boxed
-permits
-[Pig1BoxedVoid](#pig1boxedvoid), -[Pig1BoxedBoolean](#pig1boxedboolean), -[Pig1BoxedNumber](#pig1boxednumber), -[Pig1BoxedString](#pig1boxedstring), -[Pig1BoxedList](#pig1boxedlist), -[Pig1BoxedMap](#pig1boxedmap) - -sealed interface that stores validated payloads using boxed classes - -## Pig1BoxedVoid -public record Pig1BoxedVoid
-implements [Pig1Boxed](#pig1boxed) - -record that stores validated null payloads, sealed permits implementation - -### Constructor Summary -| Constructor and Description | -| --------------------------- | -| Pig1BoxedVoid(Nothing? data)
Creates an instance, private visibility | - -### Method Summary -| Modifier and Type | Method and Description | -| ----------------- | ---------------------- | -| Nothing? | data()
validated payload | -| @Nullable Object | getData()
validated payload | - -## Pig1BoxedBoolean -public record Pig1BoxedBoolean
-implements [Pig1Boxed](#pig1boxed) - -record that stores validated boolean payloads, sealed permits implementation - -### Constructor Summary -| Constructor and Description | -| --------------------------- | -| Pig1BoxedBoolean(boolean data)
Creates an instance, private visibility | - -### Method Summary -| Modifier and Type | Method and Description | -| ----------------- | ---------------------- | -| boolean | data()
validated payload | -| @Nullable Object | getData()
validated payload | - -## Pig1BoxedNumber -public record Pig1BoxedNumber
-implements [Pig1Boxed](#pig1boxed) - -record that stores validated Number payloads, sealed permits implementation - -### Constructor Summary -| Constructor and Description | -| --------------------------- | -| Pig1BoxedNumber(Number data)
Creates an instance, private visibility | - -### Method Summary -| Modifier and Type | Method and Description | -| ----------------- | ---------------------- | -| Number | data()
validated payload | -| @Nullable Object | getData()
validated payload | - -## Pig1BoxedString -public record Pig1BoxedString
-implements [Pig1Boxed](#pig1boxed) - -record that stores validated String payloads, sealed permits implementation - -### Constructor Summary -| Constructor and Description | -| --------------------------- | -| Pig1BoxedString(String data)
Creates an instance, private visibility | - -### Method Summary -| Modifier and Type | Method and Description | -| ----------------- | ---------------------- | -| String | data()
validated payload | -| @Nullable Object | getData()
validated payload | - -## Pig1BoxedList -public record Pig1BoxedList
-implements [Pig1Boxed](#pig1boxed) - -record that stores validated List payloads, sealed permits implementation - -### Constructor Summary -| Constructor and Description | -| --------------------------- | -| Pig1BoxedList(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 | - -## Pig1BoxedMap -public record Pig1BoxedMap
-implements [Pig1Boxed](#pig1boxed) - -record that stores validated Map payloads, sealed permits implementation - -### Constructor Summary -| Constructor and Description | -| --------------------------- | -| Pig1BoxedMap(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 | - -## Pig1 -public static class Pig1
-extends JsonSchema - -A schema class that validates payloads - -### Field Summary -| Modifier and Type | Field and Description | -| ----------------- | ---------------------- | -| List> | oneOf = List.of(
    [BasquePig.BasquePig1.class](../../components/schemas/BasquePig.md#basquepig1),
    [DanishPig.DanishPig1.class](../../components/schemas/DanishPig.md#danishpig1)
))
| - -### Method Summary -| Modifier and Type | Method and Description | -| ----------------- | ---------------------- | -| String | validate(String arg, SchemaConfiguration configuration) | -| Nothing? | validate(Nothing? arg, SchemaConfiguration configuration) | -| int | validate(int arg, SchemaConfiguration configuration) | -| long | validate(long arg, SchemaConfiguration configuration) | -| float | validate(float arg, SchemaConfiguration configuration) | -| double | validate(double arg, SchemaConfiguration configuration) | -| Number | validate(Number arg, SchemaConfiguration configuration) | -| boolean | validate(boolean arg, SchemaConfiguration configuration) | -| FrozenMap<@Nullable Object> | validate(Map<?, ?> arg, SchemaConfiguration configuration) | -| FrozenList<@Nullable Object> | validate(List arg, SchemaConfiguration configuration) | -| [Pig1BoxedString](#pig1boxedstring) | validateAndBox(String arg, SchemaConfiguration configuration) | -| [Pig1BoxedVoid](#pig1boxedvoid) | validateAndBox(Nothing? arg, SchemaConfiguration configuration) | -| [Pig1BoxedNumber](#pig1boxednumber) | validateAndBox(Number arg, SchemaConfiguration configuration) | -| [Pig1BoxedBoolean](#pig1boxedboolean) | validateAndBox(boolean arg, SchemaConfiguration configuration) | -| [Pig1BoxedMap](#pig1boxedmap) | validateAndBox(Map<?, ?> arg, SchemaConfiguration configuration) | -| [Pig1BoxedList](#pig1boxedlist) | validateAndBox(List arg, SchemaConfiguration configuration) | -| [Pig1Boxed](#pig1boxed) | validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) | -| @Nullable Object | validate(@Nullable Object arg, SchemaConfiguration configuration) | - -[[Back to top]](#top) [[Back to Component Schemas]](../../../README.md#Component-Schemas) [[Back to README]](../../../README.md) diff --git a/samples/client/petstore/kotlin/docs/components/schemas/Player.md b/samples/client/petstore/kotlin/docs/components/schemas/Player.md deleted file mode 100644 index 9d5bd532a80..00000000000 --- a/samples/client/petstore/kotlin/docs/components/schemas/Player.md +++ /dev/null @@ -1,174 +0,0 @@ -# Player -org.openapijsonschematools.client.components.schemas.Player.java -public class Player
- -A class that contains necessary nested -- schema classes (which validate payloads), extends JsonSchema -- sealed interfaces which store validated payloads, java version of a sum type -- boxed classes which store validated payloads, sealed permits class implementations -- classes to store validated map payloads, extends FrozenMap -- classes to build inputs for map payloads - -## Nested Class Summary -| Modifier and Type | Class and Description | -| ----------------- | ---------------------- | -| sealed interface | [Player.Player1Boxed](#player1boxed)
sealed interface for validated payloads | -| record | [Player.Player1BoxedMap](#player1boxedmap)
boxed class to store validated Map payloads | -| static class | [Player.Player1](#player1)
schema class | -| static class | [Player.PlayerMapBuilder](#playermapbuilder)
builder for Map payloads | -| static class | [Player.PlayerMap](#playermap)
output class for Map payloads | -| sealed interface | [Player.NameBoxed](#nameboxed)
sealed interface for validated payloads | -| record | [Player.NameBoxedString](#nameboxedstring)
boxed class to store validated String payloads | -| static class | [Player.Name](#name)
schema class | - -## Player1Boxed -public sealed interface Player1Boxed
-permits
-[Player1BoxedMap](#player1boxedmap) - -sealed interface that stores validated payloads using boxed classes - -## Player1BoxedMap -public record Player1BoxedMap
-implements [Player1Boxed](#player1boxed) - -record that stores validated Map payloads, sealed permits implementation - -### Constructor Summary -| Constructor and Description | -| --------------------------- | -| Player1BoxedMap([PlayerMap](#playermap) data)
Creates an instance, private visibility | - -### Method Summary -| Modifier and Type | Method and Description | -| ----------------- | ---------------------- | -| [PlayerMap](#playermap) | data()
validated payload | -| @Nullable Object | getData()
validated payload | - -## Player1 -public static class Player1
-extends JsonSchema - -A schema class that validates payloads - -## Description -a model that includes a self reference this forces properties and additionalProperties to be lazy loaded in python models because the Player class has not fully loaded when defining properties - -### Code Sample -``` -import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags; -import org.openapijsonschematools.client.configurations.SchemaConfiguration; -import org.openapijsonschematools.client.exceptions.ValidationException; -import org.openapijsonschematools.client.schemas.validation.MapUtils; -import org.openapijsonschematools.client.schemas.validation.FrozenList; -import org.openapijsonschematools.client.schemas.validation.FrozenMap; -import org.openapijsonschematools.client.components.schemas.Player; - -import java.util.Arrays; -import java.util.List; -import java.util.AbstractMap; - -static final SchemaConfiguration configuration = new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().build()); - -// Map validation -Player.PlayerMap validatedPayload = - Player.Player1.validate( - new Player.PlayerMapBuilder() - .name("a") - - .build(), - configuration -); -``` - -### Field Summary -| Modifier and Type | Field and Description | -| ----------------- | ---------------------- | -| Set> | type = Set.of(Map.class) | -| Map> | properties = Map.ofEntries(
    new PropertyEntry("name", [Name.class](#name))),
    new PropertyEntry("enemyPlayer", [Player1.class](#player1)))
)
| - -### Method Summary -| Modifier and Type | Method and Description | -| ----------------- | ---------------------- | -| [PlayerMap](#playermap) | validate([Map<?, ?>](#playermapbuilder) arg, SchemaConfiguration configuration) | -| [Player1BoxedMap](#player1boxedmap) | validateAndBox([Map<?, ?>](#playermapbuilder) arg, SchemaConfiguration configuration) | -| [Player1Boxed](#player1boxed) | validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) | -| @Nullable Object | validate(@Nullable Object arg, SchemaConfiguration configuration) | - -## PlayerMapBuilder -public class PlayerMapBuilder
-builder for `Map` - -A class that builds the Map input type - -### Constructor Summary -| Constructor and Description | -| --------------------------- | -| PlayerMapBuilder()
Creates a builder that contains an empty map | - -### Method Summary -| Modifier and Type | Method and Description | -| ----------------- | ---------------------- | -| Map | build()
Returns map input that should be used with Schema.validate | -| [PlayerMapBuilder](#playermapbuilder) | name(String value) | -| [PlayerMapBuilder](#playermapbuilder) | enemyPlayer(Map value) | -| [PlayerMapBuilder](#playermapbuilder) | additionalProperty(String key, Nothing? value) | -| [PlayerMapBuilder](#playermapbuilder) | additionalProperty(String key, boolean value) | -| [PlayerMapBuilder](#playermapbuilder) | additionalProperty(String key, String value) | -| [PlayerMapBuilder](#playermapbuilder) | additionalProperty(String key, int value) | -| [PlayerMapBuilder](#playermapbuilder) | additionalProperty(String key, float value) | -| [PlayerMapBuilder](#playermapbuilder) | additionalProperty(String key, long value) | -| [PlayerMapBuilder](#playermapbuilder) | additionalProperty(String key, double value) | -| [PlayerMapBuilder](#playermapbuilder) | additionalProperty(String key, List value) | -| [PlayerMapBuilder](#playermapbuilder) | additionalProperty(String key, Map value) | - -## PlayerMap -public static class PlayerMap
-extends FrozenMap - -A class to store validated Map payloads - -### Method Summary -| Modifier and Type | Method and Description | -| ----------------- | ---------------------- | -| static [PlayerMap](#playermap) | of([Map](#playermapbuilder) arg, SchemaConfiguration configuration) | -| String | name()
[optional] | -| [PlayerMap](#playermap) | enemyPlayer()
[optional] | -| @Nullable Object | getAdditionalProperty(String name)
provides type safety for additional properties | - -## NameBoxed -public sealed interface NameBoxed
-permits
-[NameBoxedString](#nameboxedstring) - -sealed interface that stores validated payloads using boxed classes - -## NameBoxedString -public record NameBoxedString
-implements [NameBoxed](#nameboxed) - -record that stores validated String payloads, sealed permits implementation - -### Constructor Summary -| Constructor and Description | -| --------------------------- | -| NameBoxedString(String data)
Creates an instance, private visibility | - -### Method Summary -| Modifier and Type | Method and Description | -| ----------------- | ---------------------- | -| String | data()
validated payload | -| @Nullable Object | getData()
validated payload | - -## Name -public static class Name
-extends StringJsonSchema.StringJsonSchema1 - -A schema class that validates payloads - -| Methods Inherited from class org.openapijsonschematools.client.schemas.StringJsonSchema.StringJsonSchema1 | -| ------------------------------------------------------------------ | -| validate | -| validateAndBox | - -[[Back to top]](#top) [[Back to Component Schemas]](../../../README.md#Component-Schemas) [[Back to README]](../../../README.md) diff --git a/samples/client/petstore/kotlin/docs/components/schemas/PublicKey.md b/samples/client/petstore/kotlin/docs/components/schemas/PublicKey.md deleted file mode 100644 index 1b67de36d32..00000000000 --- a/samples/client/petstore/kotlin/docs/components/schemas/PublicKey.md +++ /dev/null @@ -1,172 +0,0 @@ -# PublicKey -org.openapijsonschematools.client.components.schemas.PublicKey.java -public class PublicKey
- -A class that contains necessary nested -- schema classes (which validate payloads), extends JsonSchema -- sealed interfaces which store validated payloads, java version of a sum type -- boxed classes which store validated payloads, sealed permits class implementations -- classes to store validated map payloads, extends FrozenMap -- classes to build inputs for map payloads - -## Nested Class Summary -| Modifier and Type | Class and Description | -| ----------------- | ---------------------- | -| sealed interface | [PublicKey.PublicKey1Boxed](#publickey1boxed)
sealed interface for validated payloads | -| record | [PublicKey.PublicKey1BoxedMap](#publickey1boxedmap)
boxed class to store validated Map payloads | -| static class | [PublicKey.PublicKey1](#publickey1)
schema class | -| static class | [PublicKey.PublicKeyMapBuilder](#publickeymapbuilder)
builder for Map payloads | -| static class | [PublicKey.PublicKeyMap](#publickeymap)
output class for Map payloads | -| sealed interface | [PublicKey.KeyBoxed](#keyboxed)
sealed interface for validated payloads | -| record | [PublicKey.KeyBoxedString](#keyboxedstring)
boxed class to store validated String payloads | -| static class | [PublicKey.Key](#key)
schema class | - -## PublicKey1Boxed -public sealed interface PublicKey1Boxed
-permits
-[PublicKey1BoxedMap](#publickey1boxedmap) - -sealed interface that stores validated payloads using boxed classes - -## PublicKey1BoxedMap -public record PublicKey1BoxedMap
-implements [PublicKey1Boxed](#publickey1boxed) - -record that stores validated Map payloads, sealed permits implementation - -### Constructor Summary -| Constructor and Description | -| --------------------------- | -| PublicKey1BoxedMap([PublicKeyMap](#publickeymap) data)
Creates an instance, private visibility | - -### Method Summary -| Modifier and Type | Method and Description | -| ----------------- | ---------------------- | -| [PublicKeyMap](#publickeymap) | data()
validated payload | -| @Nullable Object | getData()
validated payload | - -## PublicKey1 -public static class PublicKey1
-extends JsonSchema - -A schema class that validates payloads - -## Description -schema that contains a property named key - -### Code Sample -``` -import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags; -import org.openapijsonschematools.client.configurations.SchemaConfiguration; -import org.openapijsonschematools.client.exceptions.ValidationException; -import org.openapijsonschematools.client.schemas.validation.MapUtils; -import org.openapijsonschematools.client.schemas.validation.FrozenList; -import org.openapijsonschematools.client.schemas.validation.FrozenMap; -import org.openapijsonschematools.client.components.schemas.PublicKey; - -import java.util.Arrays; -import java.util.List; -import java.util.AbstractMap; - -static final SchemaConfiguration configuration = new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().build()); - -// Map validation -PublicKey.PublicKeyMap validatedPayload = - PublicKey.PublicKey1.validate( - new PublicKey.PublicKeyMapBuilder() - .key("a") - - .build(), - configuration -); -``` - -### Field Summary -| Modifier and Type | Field and Description | -| ----------------- | ---------------------- | -| Set> | type = Set.of(Map.class) | -| Map> | properties = Map.ofEntries(
    new PropertyEntry("key", [Key.class](#key)))
)
| - -### Method Summary -| Modifier and Type | Method and Description | -| ----------------- | ---------------------- | -| [PublicKeyMap](#publickeymap) | validate([Map<?, ?>](#publickeymapbuilder) arg, SchemaConfiguration configuration) | -| [PublicKey1BoxedMap](#publickey1boxedmap) | validateAndBox([Map<?, ?>](#publickeymapbuilder) arg, SchemaConfiguration configuration) | -| [PublicKey1Boxed](#publickey1boxed) | validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) | -| @Nullable Object | validate(@Nullable Object arg, SchemaConfiguration configuration) | - -## PublicKeyMapBuilder -public class PublicKeyMapBuilder
-builder for `Map` - -A class that builds the Map input type - -### Constructor Summary -| Constructor and Description | -| --------------------------- | -| PublicKeyMapBuilder()
Creates a builder that contains an empty map | - -### Method Summary -| Modifier and Type | Method and Description | -| ----------------- | ---------------------- | -| Map | build()
Returns map input that should be used with Schema.validate | -| [PublicKeyMapBuilder](#publickeymapbuilder) | key(String value) | -| [PublicKeyMapBuilder](#publickeymapbuilder) | additionalProperty(String key, Nothing? value) | -| [PublicKeyMapBuilder](#publickeymapbuilder) | additionalProperty(String key, boolean value) | -| [PublicKeyMapBuilder](#publickeymapbuilder) | additionalProperty(String key, String value) | -| [PublicKeyMapBuilder](#publickeymapbuilder) | additionalProperty(String key, int value) | -| [PublicKeyMapBuilder](#publickeymapbuilder) | additionalProperty(String key, float value) | -| [PublicKeyMapBuilder](#publickeymapbuilder) | additionalProperty(String key, long value) | -| [PublicKeyMapBuilder](#publickeymapbuilder) | additionalProperty(String key, double value) | -| [PublicKeyMapBuilder](#publickeymapbuilder) | additionalProperty(String key, List value) | -| [PublicKeyMapBuilder](#publickeymapbuilder) | additionalProperty(String key, Map value) | - -## PublicKeyMap -public static class PublicKeyMap
-extends FrozenMap - -A class to store validated Map payloads - -### Method Summary -| Modifier and Type | Method and Description | -| ----------------- | ---------------------- | -| static [PublicKeyMap](#publickeymap) | of([Map](#publickeymapbuilder) arg, SchemaConfiguration configuration) | -| String | key()
[optional] | -| @Nullable Object | getAdditionalProperty(String name)
provides type safety for additional properties | - -## KeyBoxed -public sealed interface KeyBoxed
-permits
-[KeyBoxedString](#keyboxedstring) - -sealed interface that stores validated payloads using boxed classes - -## KeyBoxedString -public record KeyBoxedString
-implements [KeyBoxed](#keyboxed) - -record that stores validated String payloads, sealed permits implementation - -### Constructor Summary -| Constructor and Description | -| --------------------------- | -| KeyBoxedString(String data)
Creates an instance, private visibility | - -### Method Summary -| Modifier and Type | Method and Description | -| ----------------- | ---------------------- | -| String | data()
validated payload | -| @Nullable Object | getData()
validated payload | - -## Key -public static class Key
-extends StringJsonSchema.StringJsonSchema1 - -A schema class that validates payloads - -| Methods Inherited from class org.openapijsonschematools.client.schemas.StringJsonSchema.StringJsonSchema1 | -| ------------------------------------------------------------------ | -| validate | -| validateAndBox | - -[[Back to top]](#top) [[Back to Component Schemas]](../../../README.md#Component-Schemas) [[Back to README]](../../../README.md) diff --git a/samples/client/petstore/kotlin/docs/components/schemas/Quadrilateral.md b/samples/client/petstore/kotlin/docs/components/schemas/Quadrilateral.md deleted file mode 100644 index 984f6f97984..00000000000 --- a/samples/client/petstore/kotlin/docs/components/schemas/Quadrilateral.md +++ /dev/null @@ -1,169 +0,0 @@ -# Quadrilateral -org.openapijsonschematools.client.components.schemas.Quadrilateral.java -public class Quadrilateral
- -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 - -## Nested Class Summary -| Modifier and Type | Class and Description | -| ----------------- | ---------------------- | -| sealed interface | [Quadrilateral.Quadrilateral1Boxed](#quadrilateral1boxed)
sealed interface for validated payloads | -| record | [Quadrilateral.Quadrilateral1BoxedVoid](#quadrilateral1boxedvoid)
boxed class to store validated null payloads | -| record | [Quadrilateral.Quadrilateral1BoxedBoolean](#quadrilateral1boxedboolean)
boxed class to store validated boolean payloads | -| record | [Quadrilateral.Quadrilateral1BoxedNumber](#quadrilateral1boxednumber)
boxed class to store validated Number payloads | -| record | [Quadrilateral.Quadrilateral1BoxedString](#quadrilateral1boxedstring)
boxed class to store validated String payloads | -| record | [Quadrilateral.Quadrilateral1BoxedList](#quadrilateral1boxedlist)
boxed class to store validated List payloads | -| record | [Quadrilateral.Quadrilateral1BoxedMap](#quadrilateral1boxedmap)
boxed class to store validated Map payloads | -| static class | [Quadrilateral.Quadrilateral1](#quadrilateral1)
schema class | - -## Quadrilateral1Boxed -public sealed interface Quadrilateral1Boxed
-permits
-[Quadrilateral1BoxedVoid](#quadrilateral1boxedvoid), -[Quadrilateral1BoxedBoolean](#quadrilateral1boxedboolean), -[Quadrilateral1BoxedNumber](#quadrilateral1boxednumber), -[Quadrilateral1BoxedString](#quadrilateral1boxedstring), -[Quadrilateral1BoxedList](#quadrilateral1boxedlist), -[Quadrilateral1BoxedMap](#quadrilateral1boxedmap) - -sealed interface that stores validated payloads using boxed classes - -## Quadrilateral1BoxedVoid -public record Quadrilateral1BoxedVoid
-implements [Quadrilateral1Boxed](#quadrilateral1boxed) - -record that stores validated null payloads, sealed permits implementation - -### Constructor Summary -| Constructor and Description | -| --------------------------- | -| Quadrilateral1BoxedVoid(Nothing? data)
Creates an instance, private visibility | - -### Method Summary -| Modifier and Type | Method and Description | -| ----------------- | ---------------------- | -| Nothing? | data()
validated payload | -| @Nullable Object | getData()
validated payload | - -## Quadrilateral1BoxedBoolean -public record Quadrilateral1BoxedBoolean
-implements [Quadrilateral1Boxed](#quadrilateral1boxed) - -record that stores validated boolean payloads, sealed permits implementation - -### Constructor Summary -| Constructor and Description | -| --------------------------- | -| Quadrilateral1BoxedBoolean(boolean data)
Creates an instance, private visibility | - -### Method Summary -| Modifier and Type | Method and Description | -| ----------------- | ---------------------- | -| boolean | data()
validated payload | -| @Nullable Object | getData()
validated payload | - -## Quadrilateral1BoxedNumber -public record Quadrilateral1BoxedNumber
-implements [Quadrilateral1Boxed](#quadrilateral1boxed) - -record that stores validated Number payloads, sealed permits implementation - -### Constructor Summary -| Constructor and Description | -| --------------------------- | -| Quadrilateral1BoxedNumber(Number data)
Creates an instance, private visibility | - -### Method Summary -| Modifier and Type | Method and Description | -| ----------------- | ---------------------- | -| Number | data()
validated payload | -| @Nullable Object | getData()
validated payload | - -## Quadrilateral1BoxedString -public record Quadrilateral1BoxedString
-implements [Quadrilateral1Boxed](#quadrilateral1boxed) - -record that stores validated String payloads, sealed permits implementation - -### Constructor Summary -| Constructor and Description | -| --------------------------- | -| Quadrilateral1BoxedString(String data)
Creates an instance, private visibility | - -### Method Summary -| Modifier and Type | Method and Description | -| ----------------- | ---------------------- | -| String | data()
validated payload | -| @Nullable Object | getData()
validated payload | - -## Quadrilateral1BoxedList -public record Quadrilateral1BoxedList
-implements [Quadrilateral1Boxed](#quadrilateral1boxed) - -record that stores validated List payloads, sealed permits implementation - -### Constructor Summary -| Constructor and Description | -| --------------------------- | -| Quadrilateral1BoxedList(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 | - -## Quadrilateral1BoxedMap -public record Quadrilateral1BoxedMap
-implements [Quadrilateral1Boxed](#quadrilateral1boxed) - -record that stores validated Map payloads, sealed permits implementation - -### Constructor Summary -| Constructor and Description | -| --------------------------- | -| Quadrilateral1BoxedMap(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 | - -## Quadrilateral1 -public static class Quadrilateral1
-extends JsonSchema - -A schema class that validates payloads - -### Field Summary -| Modifier and Type | Field and Description | -| ----------------- | ---------------------- | -| List> | oneOf = List.of(
    [SimpleQuadrilateral.SimpleQuadrilateral1.class](../../components/schemas/SimpleQuadrilateral.md#simplequadrilateral1),
    [ComplexQuadrilateral.ComplexQuadrilateral1.class](../../components/schemas/ComplexQuadrilateral.md#complexquadrilateral1)
))
| - -### Method Summary -| Modifier and Type | Method and Description | -| ----------------- | ---------------------- | -| String | validate(String arg, SchemaConfiguration configuration) | -| Nothing? | validate(Nothing? arg, SchemaConfiguration configuration) | -| int | validate(int arg, SchemaConfiguration configuration) | -| long | validate(long arg, SchemaConfiguration configuration) | -| float | validate(float arg, SchemaConfiguration configuration) | -| double | validate(double arg, SchemaConfiguration configuration) | -| Number | validate(Number arg, SchemaConfiguration configuration) | -| boolean | validate(boolean arg, SchemaConfiguration configuration) | -| FrozenMap<@Nullable Object> | validate(Map<?, ?> arg, SchemaConfiguration configuration) | -| FrozenList<@Nullable Object> | validate(List arg, SchemaConfiguration configuration) | -| [Quadrilateral1BoxedString](#quadrilateral1boxedstring) | validateAndBox(String arg, SchemaConfiguration configuration) | -| [Quadrilateral1BoxedVoid](#quadrilateral1boxedvoid) | validateAndBox(Nothing? arg, SchemaConfiguration configuration) | -| [Quadrilateral1BoxedNumber](#quadrilateral1boxednumber) | validateAndBox(Number arg, SchemaConfiguration configuration) | -| [Quadrilateral1BoxedBoolean](#quadrilateral1boxedboolean) | validateAndBox(boolean arg, SchemaConfiguration configuration) | -| [Quadrilateral1BoxedMap](#quadrilateral1boxedmap) | validateAndBox(Map<?, ?> arg, SchemaConfiguration configuration) | -| [Quadrilateral1BoxedList](#quadrilateral1boxedlist) | validateAndBox(List arg, SchemaConfiguration configuration) | -| [Quadrilateral1Boxed](#quadrilateral1boxed) | validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) | -| @Nullable Object | validate(@Nullable Object arg, SchemaConfiguration configuration) | - -[[Back to top]](#top) [[Back to Component Schemas]](../../../README.md#Component-Schemas) [[Back to README]](../../../README.md) diff --git a/samples/client/petstore/kotlin/docs/components/schemas/QuadrilateralInterface.md b/samples/client/petstore/kotlin/docs/components/schemas/QuadrilateralInterface.md deleted file mode 100644 index 89a9ee40785..00000000000 --- a/samples/client/petstore/kotlin/docs/components/schemas/QuadrilateralInterface.md +++ /dev/null @@ -1,386 +0,0 @@ -# QuadrilateralInterface -org.openapijsonschematools.client.components.schemas.QuadrilateralInterface.java -public class QuadrilateralInterface
- -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 | [QuadrilateralInterface.QuadrilateralInterface1Boxed](#quadrilateralinterface1boxed)
sealed interface for validated payloads | -| record | [QuadrilateralInterface.QuadrilateralInterface1BoxedVoid](#quadrilateralinterface1boxedvoid)
boxed class to store validated null payloads | -| record | [QuadrilateralInterface.QuadrilateralInterface1BoxedBoolean](#quadrilateralinterface1boxedboolean)
boxed class to store validated boolean payloads | -| record | [QuadrilateralInterface.QuadrilateralInterface1BoxedNumber](#quadrilateralinterface1boxednumber)
boxed class to store validated Number payloads | -| record | [QuadrilateralInterface.QuadrilateralInterface1BoxedString](#quadrilateralinterface1boxedstring)
boxed class to store validated String payloads | -| record | [QuadrilateralInterface.QuadrilateralInterface1BoxedList](#quadrilateralinterface1boxedlist)
boxed class to store validated List payloads | -| record | [QuadrilateralInterface.QuadrilateralInterface1BoxedMap](#quadrilateralinterface1boxedmap)
boxed class to store validated Map payloads | -| static class | [QuadrilateralInterface.QuadrilateralInterface1](#quadrilateralinterface1)
schema class | -| static class | [QuadrilateralInterface.QuadrilateralInterfaceMapBuilder](#quadrilateralinterfacemapbuilder)
builder for Map payloads | -| static class | [QuadrilateralInterface.QuadrilateralInterfaceMap](#quadrilateralinterfacemap)
output class for Map payloads | -| sealed interface | [QuadrilateralInterface.QuadrilateralTypeBoxed](#quadrilateraltypeboxed)
sealed interface for validated payloads | -| record | [QuadrilateralInterface.QuadrilateralTypeBoxedString](#quadrilateraltypeboxedstring)
boxed class to store validated String payloads | -| static class | [QuadrilateralInterface.QuadrilateralType](#quadrilateraltype)
schema class | -| sealed interface | [QuadrilateralInterface.ShapeTypeBoxed](#shapetypeboxed)
sealed interface for validated payloads | -| record | [QuadrilateralInterface.ShapeTypeBoxedString](#shapetypeboxedstring)
boxed class to store validated String payloads | -| static class | [QuadrilateralInterface.ShapeType](#shapetype)
schema class | -| enum | [QuadrilateralInterface.StringShapeTypeEnums](#stringshapetypeenums)
String enum | - -## QuadrilateralInterface1Boxed -public sealed interface QuadrilateralInterface1Boxed
-permits
-[QuadrilateralInterface1BoxedVoid](#quadrilateralinterface1boxedvoid), -[QuadrilateralInterface1BoxedBoolean](#quadrilateralinterface1boxedboolean), -[QuadrilateralInterface1BoxedNumber](#quadrilateralinterface1boxednumber), -[QuadrilateralInterface1BoxedString](#quadrilateralinterface1boxedstring), -[QuadrilateralInterface1BoxedList](#quadrilateralinterface1boxedlist), -[QuadrilateralInterface1BoxedMap](#quadrilateralinterface1boxedmap) - -sealed interface that stores validated payloads using boxed classes - -## QuadrilateralInterface1BoxedVoid -public record QuadrilateralInterface1BoxedVoid
-implements [QuadrilateralInterface1Boxed](#quadrilateralinterface1boxed) - -record that stores validated null payloads, sealed permits implementation - -### Constructor Summary -| Constructor and Description | -| --------------------------- | -| QuadrilateralInterface1BoxedVoid(Nothing? data)
Creates an instance, private visibility | - -### Method Summary -| Modifier and Type | Method and Description | -| ----------------- | ---------------------- | -| Nothing? | data()
validated payload | -| @Nullable Object | getData()
validated payload | - -## QuadrilateralInterface1BoxedBoolean -public record QuadrilateralInterface1BoxedBoolean
-implements [QuadrilateralInterface1Boxed](#quadrilateralinterface1boxed) - -record that stores validated boolean payloads, sealed permits implementation - -### Constructor Summary -| Constructor and Description | -| --------------------------- | -| QuadrilateralInterface1BoxedBoolean(boolean data)
Creates an instance, private visibility | - -### Method Summary -| Modifier and Type | Method and Description | -| ----------------- | ---------------------- | -| boolean | data()
validated payload | -| @Nullable Object | getData()
validated payload | - -## QuadrilateralInterface1BoxedNumber -public record QuadrilateralInterface1BoxedNumber
-implements [QuadrilateralInterface1Boxed](#quadrilateralinterface1boxed) - -record that stores validated Number payloads, sealed permits implementation - -### Constructor Summary -| Constructor and Description | -| --------------------------- | -| QuadrilateralInterface1BoxedNumber(Number data)
Creates an instance, private visibility | - -### Method Summary -| Modifier and Type | Method and Description | -| ----------------- | ---------------------- | -| Number | data()
validated payload | -| @Nullable Object | getData()
validated payload | - -## QuadrilateralInterface1BoxedString -public record QuadrilateralInterface1BoxedString
-implements [QuadrilateralInterface1Boxed](#quadrilateralinterface1boxed) - -record that stores validated String payloads, sealed permits implementation - -### Constructor Summary -| Constructor and Description | -| --------------------------- | -| QuadrilateralInterface1BoxedString(String data)
Creates an instance, private visibility | - -### Method Summary -| Modifier and Type | Method and Description | -| ----------------- | ---------------------- | -| String | data()
validated payload | -| @Nullable Object | getData()
validated payload | - -## QuadrilateralInterface1BoxedList -public record QuadrilateralInterface1BoxedList
-implements [QuadrilateralInterface1Boxed](#quadrilateralinterface1boxed) - -record that stores validated List payloads, sealed permits implementation - -### Constructor Summary -| Constructor and Description | -| --------------------------- | -| QuadrilateralInterface1BoxedList(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 | - -## QuadrilateralInterface1BoxedMap -public record QuadrilateralInterface1BoxedMap
-implements [QuadrilateralInterface1Boxed](#quadrilateralinterface1boxed) - -record that stores validated Map payloads, sealed permits implementation - -### Constructor Summary -| Constructor and Description | -| --------------------------- | -| QuadrilateralInterface1BoxedMap([QuadrilateralInterfaceMap](#quadrilateralinterfacemap) data)
Creates an instance, private visibility | - -### Method Summary -| Modifier and Type | Method and Description | -| ----------------- | ---------------------- | -| [QuadrilateralInterfaceMap](#quadrilateralinterfacemap) | data()
validated payload | -| @Nullable Object | getData()
validated payload | - -## QuadrilateralInterface1 -public static class QuadrilateralInterface1
-extends JsonSchema - -A schema class that validates payloads - -### Field Summary -| Modifier and Type | Field and Description | -| ----------------- | ---------------------- | -| Map> | properties = Map.ofEntries(
    new PropertyEntry("shapeType", [ShapeType.class](#shapetype))),
    new PropertyEntry("quadrilateralType", [QuadrilateralType.class](#quadrilateraltype)))
)
| -| Set | required = Set.of(
    "quadrilateralType",
    "shapeType"
)
| - -### Method Summary -| Modifier and Type | Method and Description | -| ----------------- | ---------------------- | -| String | validate(String arg, SchemaConfiguration configuration) | -| Nothing? | validate(Nothing? arg, SchemaConfiguration configuration) | -| int | validate(int arg, SchemaConfiguration configuration) | -| long | validate(long arg, SchemaConfiguration configuration) | -| float | validate(float arg, SchemaConfiguration configuration) | -| double | validate(double arg, SchemaConfiguration configuration) | -| Number | validate(Number arg, SchemaConfiguration configuration) | -| boolean | validate(boolean arg, SchemaConfiguration configuration) | -| [QuadrilateralInterfaceMap](#quadrilateralinterfacemap) | validate([Map<?, ?>](#quadrilateralinterfacemapbuilder) arg, SchemaConfiguration configuration) | -| FrozenList<@Nullable Object> | validate(List arg, SchemaConfiguration configuration) | -| [QuadrilateralInterface1BoxedString](#quadrilateralinterface1boxedstring) | validateAndBox(String arg, SchemaConfiguration configuration) | -| [QuadrilateralInterface1BoxedVoid](#quadrilateralinterface1boxedvoid) | validateAndBox(Nothing? arg, SchemaConfiguration configuration) | -| [QuadrilateralInterface1BoxedNumber](#quadrilateralinterface1boxednumber) | validateAndBox(Number arg, SchemaConfiguration configuration) | -| [QuadrilateralInterface1BoxedBoolean](#quadrilateralinterface1boxedboolean) | validateAndBox(boolean arg, SchemaConfiguration configuration) | -| [QuadrilateralInterface1BoxedMap](#quadrilateralinterface1boxedmap) | validateAndBox([Map<?, ?>](#quadrilateralinterfacemapbuilder) arg, SchemaConfiguration configuration) | -| [QuadrilateralInterface1BoxedList](#quadrilateralinterface1boxedlist) | validateAndBox(List arg, SchemaConfiguration configuration) | -| [QuadrilateralInterface1Boxed](#quadrilateralinterface1boxed) | validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) | -| @Nullable Object | validate(@Nullable Object arg, SchemaConfiguration configuration) | - -## QuadrilateralInterfaceMap00Builder -public class QuadrilateralInterfaceMap00Builder
-builder for `Map` - -A class that builds the Map input type - -### Constructor Summary -| Constructor and Description | -| --------------------------- | -| QuadrilateralInterfaceMap00Builder(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 | -| [QuadrilateralInterfaceMap00Builder](#quadrilateralinterfacemap00builder) | additionalProperty(String key, Nothing? value) | -| [QuadrilateralInterfaceMap00Builder](#quadrilateralinterfacemap00builder) | additionalProperty(String key, boolean value) | -| [QuadrilateralInterfaceMap00Builder](#quadrilateralinterfacemap00builder) | additionalProperty(String key, String value) | -| [QuadrilateralInterfaceMap00Builder](#quadrilateralinterfacemap00builder) | additionalProperty(String key, int value) | -| [QuadrilateralInterfaceMap00Builder](#quadrilateralinterfacemap00builder) | additionalProperty(String key, float value) | -| [QuadrilateralInterfaceMap00Builder](#quadrilateralinterfacemap00builder) | additionalProperty(String key, long value) | -| [QuadrilateralInterfaceMap00Builder](#quadrilateralinterfacemap00builder) | additionalProperty(String key, double value) | -| [QuadrilateralInterfaceMap00Builder](#quadrilateralinterfacemap00builder) | additionalProperty(String key, List value) | -| [QuadrilateralInterfaceMap00Builder](#quadrilateralinterfacemap00builder) | additionalProperty(String key, Map value) | - -## QuadrilateralInterfaceMap01Builder -public class QuadrilateralInterfaceMap01Builder
-builder for `Map` - -A class that builds the Map input type - -### Constructor Summary -| Constructor and Description | -| --------------------------- | -| QuadrilateralInterfaceMap01Builder(Map instance)
Creates a builder that contains the passed instance | - -### Method Summary -| Modifier and Type | Method and Description | -| ----------------- | ---------------------- | -| [QuadrilateralInterfaceMap00Builder](#quadrilateralinterfacemap00builder) | shapeType(String value) | -| [QuadrilateralInterfaceMap00Builder](#quadrilateralinterfacemap00builder) | shapeType([StringShapeTypeEnums](#stringshapetypeenums) value) | - -## QuadrilateralInterfaceMap10Builder -public class QuadrilateralInterfaceMap10Builder
-builder for `Map` - -A class that builds the Map input type - -### Constructor Summary -| Constructor and Description | -| --------------------------- | -| QuadrilateralInterfaceMap10Builder(Map instance)
Creates a builder that contains the passed instance | - -### Method Summary -| Modifier and Type | Method and Description | -| ----------------- | ---------------------- | -| [QuadrilateralInterfaceMap00Builder](#quadrilateralinterfacemap00builder) | quadrilateralType(String value) | - -## QuadrilateralInterfaceMapBuilder -public class QuadrilateralInterfaceMapBuilder
-builder for `Map` - -A class that builds the Map input type - -### Constructor Summary -| Constructor and Description | -| --------------------------- | -| QuadrilateralInterfaceMapBuilder()
Creates a builder that contains an empty map | - -### Method Summary -| Modifier and Type | Method and Description | -| ----------------- | ---------------------- | -| [QuadrilateralInterfaceMap01Builder](#quadrilateralinterfacemap01builder) | quadrilateralType(String value) | -| [QuadrilateralInterfaceMap10Builder](#quadrilateralinterfacemap10builder) | shapeType(String value) | -| [QuadrilateralInterfaceMap10Builder](#quadrilateralinterfacemap10builder) | shapeType([StringShapeTypeEnums](#stringshapetypeenums) value) | - -## QuadrilateralInterfaceMap -public static class QuadrilateralInterfaceMap
-extends FrozenMap - -A class to store validated Map payloads - -### Method Summary -| Modifier and Type | Method and Description | -| ----------------- | ---------------------- | -| static [QuadrilateralInterfaceMap](#quadrilateralinterfacemap) | of([Map](#quadrilateralinterfacemapbuilder) arg, SchemaConfiguration configuration) | -| String | quadrilateralType()
| -| String | shapeType()
must be one of ["Quadrilateral"] | -| @Nullable Object | getAdditionalProperty(String name)
provides type safety for additional properties | - -## QuadrilateralTypeBoxed -public sealed interface QuadrilateralTypeBoxed
-permits
-[QuadrilateralTypeBoxedString](#quadrilateraltypeboxedstring) - -sealed interface that stores validated payloads using boxed classes - -## QuadrilateralTypeBoxedString -public record QuadrilateralTypeBoxedString
-implements [QuadrilateralTypeBoxed](#quadrilateraltypeboxed) - -record that stores validated String payloads, sealed permits implementation - -### Constructor Summary -| Constructor and Description | -| --------------------------- | -| QuadrilateralTypeBoxedString(String data)
Creates an instance, private visibility | - -### Method Summary -| Modifier and Type | Method and Description | -| ----------------- | ---------------------- | -| String | data()
validated payload | -| @Nullable Object | getData()
validated payload | - -## QuadrilateralType -public static class QuadrilateralType
-extends StringJsonSchema.StringJsonSchema1 - -A schema class that validates payloads - -| Methods Inherited from class org.openapijsonschematools.client.schemas.StringJsonSchema.StringJsonSchema1 | -| ------------------------------------------------------------------ | -| validate | -| validateAndBox | - -## ShapeTypeBoxed -public sealed interface ShapeTypeBoxed
-permits
-[ShapeTypeBoxedString](#shapetypeboxedstring) - -sealed interface that stores validated payloads using boxed classes - -## ShapeTypeBoxedString -public record ShapeTypeBoxedString
-implements [ShapeTypeBoxed](#shapetypeboxed) - -record that stores validated String payloads, sealed permits implementation - -### Constructor Summary -| Constructor and Description | -| --------------------------- | -| ShapeTypeBoxedString(String data)
Creates an instance, private visibility | - -### Method Summary -| Modifier and Type | Method and Description | -| ----------------- | ---------------------- | -| String | data()
validated payload | -| @Nullable Object | getData()
validated payload | - -## ShapeType -public static class ShapeType
-extends JsonSchema - -A schema class that validates payloads - -### Code Sample -``` -import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags; -import org.openapijsonschematools.client.configurations.SchemaConfiguration; -import org.openapijsonschematools.client.exceptions.ValidationException; -import org.openapijsonschematools.client.schemas.validation.MapUtils; -import org.openapijsonschematools.client.schemas.validation.FrozenList; -import org.openapijsonschematools.client.schemas.validation.FrozenMap; -import org.openapijsonschematools.client.components.schemas.QuadrilateralInterface; - -import java.util.Arrays; -import java.util.List; -import java.util.AbstractMap; - -static final SchemaConfiguration configuration = new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().build()); - -// String validation -String validatedPayload = QuadrilateralInterface.ShapeType.validate( - "Quadrilateral", - configuration -); -``` - -### Field Summary -| Modifier and Type | Field and Description | -| ----------------- | ---------------------- | -| Set> | type = Set.of(
    String.class
)
| -| Set | enumValues = SetMaker.makeSet(
    "Quadrilateral"
)
| - -### Method Summary -| Modifier and Type | Method and Description | -| ----------------- | ---------------------- | -| String | validate(String arg, SchemaConfiguration configuration) | -| String | validate([StringShapeTypeEnums](#stringshapetypeenums) arg, SchemaConfiguration configuration) | -| [ShapeTypeBoxedString](#shapetypeboxedstring) | validateAndBox(String arg, SchemaConfiguration configuration) | -| [ShapeTypeBoxed](#shapetypeboxed) | validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) | -| @Nullable Object | validate(@Nullable Object arg, SchemaConfiguration configuration) | - -## StringShapeTypeEnums -public enum StringShapeTypeEnums
-extends `Enum` - -A class that stores String enum values - -### Enum Constant Summary -| Enum Constant | Description | -| ------------- | ----------- | -| QUADRILATERAL | value = "Quadrilateral" | - -[[Back to top]](#top) [[Back to Component Schemas]](../../../README.md#Component-Schemas) [[Back to README]](../../../README.md) diff --git a/samples/client/petstore/kotlin/docs/components/schemas/ReadOnlyFirst.md b/samples/client/petstore/kotlin/docs/components/schemas/ReadOnlyFirst.md deleted file mode 100644 index 4ec4c950ba8..00000000000 --- a/samples/client/petstore/kotlin/docs/components/schemas/ReadOnlyFirst.md +++ /dev/null @@ -1,211 +0,0 @@ -# ReadOnlyFirst -org.openapijsonschematools.client.components.schemas.ReadOnlyFirst.java -public class ReadOnlyFirst
- -A class that contains necessary nested -- schema classes (which validate payloads), extends JsonSchema -- sealed interfaces which store validated payloads, java version of a sum type -- boxed classes which store validated payloads, sealed permits class implementations -- classes to store validated map payloads, extends FrozenMap -- classes to build inputs for map payloads - -## Nested Class Summary -| Modifier and Type | Class and Description | -| ----------------- | ---------------------- | -| sealed interface | [ReadOnlyFirst.ReadOnlyFirst1Boxed](#readonlyfirst1boxed)
sealed interface for validated payloads | -| record | [ReadOnlyFirst.ReadOnlyFirst1BoxedMap](#readonlyfirst1boxedmap)
boxed class to store validated Map payloads | -| static class | [ReadOnlyFirst.ReadOnlyFirst1](#readonlyfirst1)
schema class | -| static class | [ReadOnlyFirst.ReadOnlyFirstMapBuilder](#readonlyfirstmapbuilder)
builder for Map payloads | -| static class | [ReadOnlyFirst.ReadOnlyFirstMap](#readonlyfirstmap)
output class for Map payloads | -| sealed interface | [ReadOnlyFirst.BazBoxed](#bazboxed)
sealed interface for validated payloads | -| record | [ReadOnlyFirst.BazBoxedString](#bazboxedstring)
boxed class to store validated String payloads | -| static class | [ReadOnlyFirst.Baz](#baz)
schema class | -| sealed interface | [ReadOnlyFirst.BarBoxed](#barboxed)
sealed interface for validated payloads | -| record | [ReadOnlyFirst.BarBoxedString](#barboxedstring)
boxed class to store validated String payloads | -| static class | [ReadOnlyFirst.Bar](#bar)
schema class | - -## ReadOnlyFirst1Boxed -public sealed interface ReadOnlyFirst1Boxed
-permits
-[ReadOnlyFirst1BoxedMap](#readonlyfirst1boxedmap) - -sealed interface that stores validated payloads using boxed classes - -## ReadOnlyFirst1BoxedMap -public record ReadOnlyFirst1BoxedMap
-implements [ReadOnlyFirst1Boxed](#readonlyfirst1boxed) - -record that stores validated Map payloads, sealed permits implementation - -### Constructor Summary -| Constructor and Description | -| --------------------------- | -| ReadOnlyFirst1BoxedMap([ReadOnlyFirstMap](#readonlyfirstmap) data)
Creates an instance, private visibility | - -### Method Summary -| Modifier and Type | Method and Description | -| ----------------- | ---------------------- | -| [ReadOnlyFirstMap](#readonlyfirstmap) | data()
validated payload | -| @Nullable Object | getData()
validated payload | - -## ReadOnlyFirst1 -public static class ReadOnlyFirst1
-extends JsonSchema - -A schema class that validates payloads - -### Code Sample -``` -import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags; -import org.openapijsonschematools.client.configurations.SchemaConfiguration; -import org.openapijsonschematools.client.exceptions.ValidationException; -import org.openapijsonschematools.client.schemas.validation.MapUtils; -import org.openapijsonschematools.client.schemas.validation.FrozenList; -import org.openapijsonschematools.client.schemas.validation.FrozenMap; -import org.openapijsonschematools.client.components.schemas.ReadOnlyFirst; - -import java.util.Arrays; -import java.util.List; -import java.util.AbstractMap; - -static final SchemaConfiguration configuration = new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().build()); - -// Map validation -ReadOnlyFirst.ReadOnlyFirstMap validatedPayload = - ReadOnlyFirst.ReadOnlyFirst1.validate( - new ReadOnlyFirst.ReadOnlyFirstMapBuilder() - .bar("a") - - .baz("a") - - .build(), - configuration -); -``` - -### Field Summary -| Modifier and Type | Field and Description | -| ----------------- | ---------------------- | -| Set> | type = Set.of(Map.class) | -| Map> | properties = Map.ofEntries(
    new PropertyEntry("bar", [Bar.class](#bar))),
    new PropertyEntry("baz", [Baz.class](#baz)))
)
| - -### Method Summary -| Modifier and Type | Method and Description | -| ----------------- | ---------------------- | -| [ReadOnlyFirstMap](#readonlyfirstmap) | validate([Map<?, ?>](#readonlyfirstmapbuilder) arg, SchemaConfiguration configuration) | -| [ReadOnlyFirst1BoxedMap](#readonlyfirst1boxedmap) | validateAndBox([Map<?, ?>](#readonlyfirstmapbuilder) arg, SchemaConfiguration configuration) | -| [ReadOnlyFirst1Boxed](#readonlyfirst1boxed) | validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) | -| @Nullable Object | validate(@Nullable Object arg, SchemaConfiguration configuration) | - -## ReadOnlyFirstMapBuilder -public class ReadOnlyFirstMapBuilder
-builder for `Map` - -A class that builds the Map input type - -### Constructor Summary -| Constructor and Description | -| --------------------------- | -| ReadOnlyFirstMapBuilder()
Creates a builder that contains an empty map | - -### Method Summary -| Modifier and Type | Method and Description | -| ----------------- | ---------------------- | -| Map | build()
Returns map input that should be used with Schema.validate | -| [ReadOnlyFirstMapBuilder](#readonlyfirstmapbuilder) | bar(String value) | -| [ReadOnlyFirstMapBuilder](#readonlyfirstmapbuilder) | baz(String value) | -| [ReadOnlyFirstMapBuilder](#readonlyfirstmapbuilder) | additionalProperty(String key, Nothing? value) | -| [ReadOnlyFirstMapBuilder](#readonlyfirstmapbuilder) | additionalProperty(String key, boolean value) | -| [ReadOnlyFirstMapBuilder](#readonlyfirstmapbuilder) | additionalProperty(String key, String value) | -| [ReadOnlyFirstMapBuilder](#readonlyfirstmapbuilder) | additionalProperty(String key, int value) | -| [ReadOnlyFirstMapBuilder](#readonlyfirstmapbuilder) | additionalProperty(String key, float value) | -| [ReadOnlyFirstMapBuilder](#readonlyfirstmapbuilder) | additionalProperty(String key, long value) | -| [ReadOnlyFirstMapBuilder](#readonlyfirstmapbuilder) | additionalProperty(String key, double value) | -| [ReadOnlyFirstMapBuilder](#readonlyfirstmapbuilder) | additionalProperty(String key, List value) | -| [ReadOnlyFirstMapBuilder](#readonlyfirstmapbuilder) | additionalProperty(String key, Map value) | - -## ReadOnlyFirstMap -public static class ReadOnlyFirstMap
-extends FrozenMap - -A class to store validated Map payloads - -### Method Summary -| Modifier and Type | Method and Description | -| ----------------- | ---------------------- | -| static [ReadOnlyFirstMap](#readonlyfirstmap) | of([Map](#readonlyfirstmapbuilder) arg, SchemaConfiguration configuration) | -| String | bar()
[optional] | -| String | baz()
[optional] | -| @Nullable Object | getAdditionalProperty(String name)
provides type safety for additional properties | - -## BazBoxed -public sealed interface BazBoxed
-permits
-[BazBoxedString](#bazboxedstring) - -sealed interface that stores validated payloads using boxed classes - -## BazBoxedString -public record BazBoxedString
-implements [BazBoxed](#bazboxed) - -record that stores validated String payloads, sealed permits implementation - -### Constructor Summary -| Constructor and Description | -| --------------------------- | -| BazBoxedString(String data)
Creates an instance, private visibility | - -### Method Summary -| Modifier and Type | Method and Description | -| ----------------- | ---------------------- | -| String | data()
validated payload | -| @Nullable Object | getData()
validated payload | - -## Baz -public static class Baz
-extends StringJsonSchema.StringJsonSchema1 - -A schema class that validates payloads - -| Methods Inherited from class org.openapijsonschematools.client.schemas.StringJsonSchema.StringJsonSchema1 | -| ------------------------------------------------------------------ | -| validate | -| validateAndBox | - -## BarBoxed -public sealed interface BarBoxed
-permits
-[BarBoxedString](#barboxedstring) - -sealed interface that stores validated payloads using boxed classes - -## BarBoxedString -public record BarBoxedString
-implements [BarBoxed](#barboxed) - -record that stores validated String payloads, sealed permits implementation - -### Constructor Summary -| Constructor and Description | -| --------------------------- | -| BarBoxedString(String data)
Creates an instance, private visibility | - -### Method Summary -| Modifier and Type | Method and Description | -| ----------------- | ---------------------- | -| String | data()
validated payload | -| @Nullable Object | getData()
validated payload | - -## Bar -public static class Bar
-extends StringJsonSchema.StringJsonSchema1 - -A schema class that validates payloads - -| Methods Inherited from class org.openapijsonschematools.client.schemas.StringJsonSchema.StringJsonSchema1 | -| ------------------------------------------------------------------ | -| validate | -| validateAndBox | - -[[Back to top]](#top) [[Back to Component Schemas]](../../../README.md#Component-Schemas) [[Back to README]](../../../README.md) diff --git a/samples/client/petstore/kotlin/docs/components/schemas/RefPet.md b/samples/client/petstore/kotlin/docs/components/schemas/RefPet.md deleted file mode 100644 index 73e54bfa49a..00000000000 --- a/samples/client/petstore/kotlin/docs/components/schemas/RefPet.md +++ /dev/null @@ -1,22 +0,0 @@ -# RefPet -org.openapijsonschematools.client.components.schemas.RefPet.java -public class RefPet
-extends [Pet1](../../components/schemas/Pet.md#pet) - -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 - -## Nested Class Summary -| Modifier and Type | Class and Description | -| ----------------- | ---------------------- | -| static class | [RefPet.RefPet1](#refpet1)
schema class | - -## RefPet1 -public static class RefPet1
-extends [Pet.Pet1](../../components/schemas/Pet.md#pet1) - -A schema class that validates payloads - -[[Back to top]](#top) [[Back to Component Schemas]](../../../README.md#Component-Schemas) [[Back to README]](../../../README.md) diff --git a/samples/client/petstore/kotlin/docs/components/schemas/ReqPropsFromExplicitAddProps.md b/samples/client/petstore/kotlin/docs/components/schemas/ReqPropsFromExplicitAddProps.md deleted file mode 100644 index 051029fca2e..00000000000 --- a/samples/client/petstore/kotlin/docs/components/schemas/ReqPropsFromExplicitAddProps.md +++ /dev/null @@ -1,211 +0,0 @@ -# ReqPropsFromExplicitAddProps -org.openapijsonschematools.client.components.schemas.ReqPropsFromExplicitAddProps.java -public class ReqPropsFromExplicitAddProps
- -A class that contains necessary nested -- schema classes (which validate payloads), extends JsonSchema -- sealed interfaces which store validated payloads, java version of a sum type -- boxed classes which store validated payloads, sealed permits class implementations -- classes to store validated map payloads, extends FrozenMap -- classes to build inputs for map payloads - -## Nested Class Summary -| Modifier and Type | Class and Description | -| ----------------- | ---------------------- | -| sealed interface | [ReqPropsFromExplicitAddProps.ReqPropsFromExplicitAddProps1Boxed](#reqpropsfromexplicitaddprops1boxed)
sealed interface for validated payloads | -| record | [ReqPropsFromExplicitAddProps.ReqPropsFromExplicitAddProps1BoxedMap](#reqpropsfromexplicitaddprops1boxedmap)
boxed class to store validated Map payloads | -| static class | [ReqPropsFromExplicitAddProps.ReqPropsFromExplicitAddProps1](#reqpropsfromexplicitaddprops1)
schema class | -| static class | [ReqPropsFromExplicitAddProps.ReqPropsFromExplicitAddPropsMapBuilder](#reqpropsfromexplicitaddpropsmapbuilder)
builder for Map payloads | -| static class | [ReqPropsFromExplicitAddProps.ReqPropsFromExplicitAddPropsMap](#reqpropsfromexplicitaddpropsmap)
output class for Map payloads | -| sealed interface | [ReqPropsFromExplicitAddProps.AdditionalPropertiesBoxed](#additionalpropertiesboxed)
sealed interface for validated payloads | -| record | [ReqPropsFromExplicitAddProps.AdditionalPropertiesBoxedString](#additionalpropertiesboxedstring)
boxed class to store validated String payloads | -| static class | [ReqPropsFromExplicitAddProps.AdditionalProperties](#additionalproperties)
schema class | - -## ReqPropsFromExplicitAddProps1Boxed -public sealed interface ReqPropsFromExplicitAddProps1Boxed
-permits
-[ReqPropsFromExplicitAddProps1BoxedMap](#reqpropsfromexplicitaddprops1boxedmap) - -sealed interface that stores validated payloads using boxed classes - -## ReqPropsFromExplicitAddProps1BoxedMap -public record ReqPropsFromExplicitAddProps1BoxedMap
-implements [ReqPropsFromExplicitAddProps1Boxed](#reqpropsfromexplicitaddprops1boxed) - -record that stores validated Map payloads, sealed permits implementation - -### Constructor Summary -| Constructor and Description | -| --------------------------- | -| ReqPropsFromExplicitAddProps1BoxedMap([ReqPropsFromExplicitAddPropsMap](#reqpropsfromexplicitaddpropsmap) data)
Creates an instance, private visibility | - -### Method Summary -| Modifier and Type | Method and Description | -| ----------------- | ---------------------- | -| [ReqPropsFromExplicitAddPropsMap](#reqpropsfromexplicitaddpropsmap) | data()
validated payload | -| @Nullable Object | getData()
validated payload | - -## ReqPropsFromExplicitAddProps1 -public static class ReqPropsFromExplicitAddProps1
-extends JsonSchema - -A schema class that validates payloads - -### Code Sample -``` -import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags; -import org.openapijsonschematools.client.configurations.SchemaConfiguration; -import org.openapijsonschematools.client.exceptions.ValidationException; -import org.openapijsonschematools.client.schemas.validation.MapUtils; -import org.openapijsonschematools.client.schemas.validation.FrozenList; -import org.openapijsonschematools.client.schemas.validation.FrozenMap; -import org.openapijsonschematools.client.components.schemas.ReqPropsFromExplicitAddProps; - -import java.util.Arrays; -import java.util.List; -import java.util.AbstractMap; - -static final SchemaConfiguration configuration = new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().build()); - -// Map validation -ReqPropsFromExplicitAddProps.ReqPropsFromExplicitAddPropsMap validatedPayload = - ReqPropsFromExplicitAddProps.ReqPropsFromExplicitAddProps1.validate( - new ReqPropsFromExplicitAddProps.ReqPropsFromExplicitAddPropsMapBuilder() - .invalidHyphenMinusName("a") - - .build(), - configuration -); -``` - -### Field Summary -| Modifier and Type | Field and Description | -| ----------------- | ---------------------- | -| Set> | type = Set.of(Map.class) | -| Set | required = Set.of(
    "invalid-name",
    "validName"
)
| -| Class | additionalProperties = [AdditionalProperties.class](#additionalproperties) | - -### Method Summary -| Modifier and Type | Method and Description | -| ----------------- | ---------------------- | -| [ReqPropsFromExplicitAddPropsMap](#reqpropsfromexplicitaddpropsmap) | validate([Map<?, ?>](#reqpropsfromexplicitaddpropsmapbuilder) arg, SchemaConfiguration configuration) | -| [ReqPropsFromExplicitAddProps1BoxedMap](#reqpropsfromexplicitaddprops1boxedmap) | validateAndBox([Map<?, ?>](#reqpropsfromexplicitaddpropsmapbuilder) arg, SchemaConfiguration configuration) | -| [ReqPropsFromExplicitAddProps1Boxed](#reqpropsfromexplicitaddprops1boxed) | validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) | -| @Nullable Object | validate(@Nullable Object arg, SchemaConfiguration configuration) | - -## ReqPropsFromExplicitAddPropsMap00Builder -public class ReqPropsFromExplicitAddPropsMap00Builder
-builder for `Map` - -A class that builds the Map input type - -### Constructor Summary -| Constructor and Description | -| --------------------------- | -| ReqPropsFromExplicitAddPropsMap00Builder(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 | -| [ReqPropsFromExplicitAddPropsMap00Builder](#reqpropsfromexplicitaddpropsmap00builder) | additionalProperty(String key, String value) | - -## ReqPropsFromExplicitAddPropsMap01Builder -public class ReqPropsFromExplicitAddPropsMap01Builder
-builder for `Map` - -A class that builds the Map input type - -### Constructor Summary -| Constructor and Description | -| --------------------------- | -| ReqPropsFromExplicitAddPropsMap01Builder(Map instance)
Creates a builder that contains the passed instance | - -### Method Summary -| Modifier and Type | Method and Description | -| ----------------- | ---------------------- | -| [ReqPropsFromExplicitAddPropsMap00Builder](#reqpropsfromexplicitaddpropsmap00builder) | validName(String value) | - -## ReqPropsFromExplicitAddPropsMap10Builder -public class ReqPropsFromExplicitAddPropsMap10Builder
-builder for `Map` - -A class that builds the Map input type - -### Constructor Summary -| Constructor and Description | -| --------------------------- | -| ReqPropsFromExplicitAddPropsMap10Builder(Map instance)
Creates a builder that contains the passed instance | - -### Method Summary -| Modifier and Type | Method and Description | -| ----------------- | ---------------------- | -| [ReqPropsFromExplicitAddPropsMap00Builder](#reqpropsfromexplicitaddpropsmap00builder) | invalidHyphenMinusName(String value) | - -## ReqPropsFromExplicitAddPropsMapBuilder -public class ReqPropsFromExplicitAddPropsMapBuilder
-builder for `Map` - -A class that builds the Map input type - -### Constructor Summary -| Constructor and Description | -| --------------------------- | -| ReqPropsFromExplicitAddPropsMapBuilder()
Creates a builder that contains an empty map | - -### Method Summary -| Modifier and Type | Method and Description | -| ----------------- | ---------------------- | -| [ReqPropsFromExplicitAddPropsMap01Builder](#reqpropsfromexplicitaddpropsmap01builder) | invalidHyphenMinusName(String value) | -| [ReqPropsFromExplicitAddPropsMap10Builder](#reqpropsfromexplicitaddpropsmap10builder) | validName(String value) | - -## ReqPropsFromExplicitAddPropsMap -public static class ReqPropsFromExplicitAddPropsMap
-extends FrozenMap - -A class to store validated Map payloads - -### Method Summary -| Modifier and Type | Method and Description | -| ----------------- | ---------------------- | -| static [ReqPropsFromExplicitAddPropsMap](#reqpropsfromexplicitaddpropsmap) | of([Map](#reqpropsfromexplicitaddpropsmapbuilder) arg, SchemaConfiguration configuration) | -| String | validName()
| -| String | get(String key)
This schema has invalid Java names so this method must be used when you access instance["invalid-name"], | -| String | getAdditionalProperty(String name)
provides type safety for additional properties | - -## AdditionalPropertiesBoxed -public sealed interface AdditionalPropertiesBoxed
-permits
-[AdditionalPropertiesBoxedString](#additionalpropertiesboxedstring) - -sealed interface that stores validated payloads using boxed classes - -## 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 | - -## AdditionalProperties -public static class AdditionalProperties
-extends StringJsonSchema.StringJsonSchema1 - -A schema class that validates payloads - -| Methods Inherited from class org.openapijsonschematools.client.schemas.StringJsonSchema.StringJsonSchema1 | -| ------------------------------------------------------------------ | -| validate | -| validateAndBox | - -[[Back to top]](#top) [[Back to Component Schemas]](../../../README.md#Component-Schemas) [[Back to README]](../../../README.md) diff --git a/samples/client/petstore/kotlin/docs/components/schemas/ReqPropsFromTrueAddProps.md b/samples/client/petstore/kotlin/docs/components/schemas/ReqPropsFromTrueAddProps.md deleted file mode 100644 index 9dff9f9ec9b..00000000000 --- a/samples/client/petstore/kotlin/docs/components/schemas/ReqPropsFromTrueAddProps.md +++ /dev/null @@ -1,344 +0,0 @@ -# ReqPropsFromTrueAddProps -org.openapijsonschematools.client.components.schemas.ReqPropsFromTrueAddProps.java -public class ReqPropsFromTrueAddProps
- -A class that contains necessary nested -- schema classes (which validate payloads), extends JsonSchema -- sealed interfaces which store validated payloads, java version of a sum type -- boxed classes which store validated payloads, sealed permits class implementations -- classes to store validated map payloads, extends FrozenMap -- classes to build inputs for map payloads - -## Nested Class Summary -| Modifier and Type | Class and Description | -| ----------------- | ---------------------- | -| sealed interface | [ReqPropsFromTrueAddProps.ReqPropsFromTrueAddProps1Boxed](#reqpropsfromtrueaddprops1boxed)
sealed interface for validated payloads | -| record | [ReqPropsFromTrueAddProps.ReqPropsFromTrueAddProps1BoxedMap](#reqpropsfromtrueaddprops1boxedmap)
boxed class to store validated Map payloads | -| static class | [ReqPropsFromTrueAddProps.ReqPropsFromTrueAddProps1](#reqpropsfromtrueaddprops1)
schema class | -| static class | [ReqPropsFromTrueAddProps.ReqPropsFromTrueAddPropsMapBuilder](#reqpropsfromtrueaddpropsmapbuilder)
builder for Map payloads | -| static class | [ReqPropsFromTrueAddProps.ReqPropsFromTrueAddPropsMap](#reqpropsfromtrueaddpropsmap)
output class for Map payloads | -| sealed interface | [ReqPropsFromTrueAddProps.AdditionalPropertiesBoxed](#additionalpropertiesboxed)
sealed interface for validated payloads | -| record | [ReqPropsFromTrueAddProps.AdditionalPropertiesBoxedVoid](#additionalpropertiesboxedvoid)
boxed class to store validated null payloads | -| record | [ReqPropsFromTrueAddProps.AdditionalPropertiesBoxedBoolean](#additionalpropertiesboxedboolean)
boxed class to store validated boolean payloads | -| record | [ReqPropsFromTrueAddProps.AdditionalPropertiesBoxedNumber](#additionalpropertiesboxednumber)
boxed class to store validated Number payloads | -| record | [ReqPropsFromTrueAddProps.AdditionalPropertiesBoxedString](#additionalpropertiesboxedstring)
boxed class to store validated String payloads | -| record | [ReqPropsFromTrueAddProps.AdditionalPropertiesBoxedList](#additionalpropertiesboxedlist)
boxed class to store validated List payloads | -| record | [ReqPropsFromTrueAddProps.AdditionalPropertiesBoxedMap](#additionalpropertiesboxedmap)
boxed class to store validated Map payloads | -| static class | [ReqPropsFromTrueAddProps.AdditionalProperties](#additionalproperties)
schema class | - -## ReqPropsFromTrueAddProps1Boxed -public sealed interface ReqPropsFromTrueAddProps1Boxed
-permits
-[ReqPropsFromTrueAddProps1BoxedMap](#reqpropsfromtrueaddprops1boxedmap) - -sealed interface that stores validated payloads using boxed classes - -## ReqPropsFromTrueAddProps1BoxedMap -public record ReqPropsFromTrueAddProps1BoxedMap
-implements [ReqPropsFromTrueAddProps1Boxed](#reqpropsfromtrueaddprops1boxed) - -record that stores validated Map payloads, sealed permits implementation - -### Constructor Summary -| Constructor and Description | -| --------------------------- | -| ReqPropsFromTrueAddProps1BoxedMap([ReqPropsFromTrueAddPropsMap](#reqpropsfromtrueaddpropsmap) data)
Creates an instance, private visibility | - -### Method Summary -| Modifier and Type | Method and Description | -| ----------------- | ---------------------- | -| [ReqPropsFromTrueAddPropsMap](#reqpropsfromtrueaddpropsmap) | data()
validated payload | -| @Nullable Object | getData()
validated payload | - -## ReqPropsFromTrueAddProps1 -public static class ReqPropsFromTrueAddProps1
-extends JsonSchema - -A schema class that validates payloads - -### Code Sample -``` -import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags; -import org.openapijsonschematools.client.configurations.SchemaConfiguration; -import org.openapijsonschematools.client.exceptions.ValidationException; -import org.openapijsonschematools.client.schemas.validation.MapUtils; -import org.openapijsonschematools.client.schemas.validation.FrozenList; -import org.openapijsonschematools.client.schemas.validation.FrozenMap; -import org.openapijsonschematools.client.components.schemas.ReqPropsFromTrueAddProps; - -import java.util.Arrays; -import java.util.List; -import java.util.AbstractMap; - -static final SchemaConfiguration configuration = new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().build()); - -// Map validation -ReqPropsFromTrueAddProps.ReqPropsFromTrueAddPropsMap validatedPayload = - ReqPropsFromTrueAddProps.ReqPropsFromTrueAddProps1.validate( - new ReqPropsFromTrueAddProps.ReqPropsFromTrueAddPropsMapBuilder() - .build(), - configuration -); -``` - -### Field Summary -| Modifier and Type | Field and Description | -| ----------------- | ---------------------- | -| Set> | type = Set.of(Map.class) | -| Set | required = Set.of(
    "invalid-name",
    "validName"
)
| -| Class | additionalProperties = [AdditionalProperties.class](#additionalproperties) | - -### Method Summary -| Modifier and Type | Method and Description | -| ----------------- | ---------------------- | -| [ReqPropsFromTrueAddPropsMap](#reqpropsfromtrueaddpropsmap) | validate([Map<?, ?>](#reqpropsfromtrueaddpropsmapbuilder) arg, SchemaConfiguration configuration) | -| [ReqPropsFromTrueAddProps1BoxedMap](#reqpropsfromtrueaddprops1boxedmap) | validateAndBox([Map<?, ?>](#reqpropsfromtrueaddpropsmapbuilder) arg, SchemaConfiguration configuration) | -| [ReqPropsFromTrueAddProps1Boxed](#reqpropsfromtrueaddprops1boxed) | validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) | -| @Nullable Object | validate(@Nullable Object arg, SchemaConfiguration configuration) | - -## ReqPropsFromTrueAddPropsMap00Builder -public class ReqPropsFromTrueAddPropsMap00Builder
-builder for `Map` - -A class that builds the Map input type - -### Constructor Summary -| Constructor and Description | -| --------------------------- | -| ReqPropsFromTrueAddPropsMap00Builder(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 | -| [ReqPropsFromTrueAddPropsMap00Builder](#reqpropsfromtrueaddpropsmap00builder) | additionalProperty(String key, Nothing? value) | -| [ReqPropsFromTrueAddPropsMap00Builder](#reqpropsfromtrueaddpropsmap00builder) | additionalProperty(String key, boolean value) | -| [ReqPropsFromTrueAddPropsMap00Builder](#reqpropsfromtrueaddpropsmap00builder) | additionalProperty(String key, String value) | -| [ReqPropsFromTrueAddPropsMap00Builder](#reqpropsfromtrueaddpropsmap00builder) | additionalProperty(String key, int value) | -| [ReqPropsFromTrueAddPropsMap00Builder](#reqpropsfromtrueaddpropsmap00builder) | additionalProperty(String key, float value) | -| [ReqPropsFromTrueAddPropsMap00Builder](#reqpropsfromtrueaddpropsmap00builder) | additionalProperty(String key, long value) | -| [ReqPropsFromTrueAddPropsMap00Builder](#reqpropsfromtrueaddpropsmap00builder) | additionalProperty(String key, double value) | -| [ReqPropsFromTrueAddPropsMap00Builder](#reqpropsfromtrueaddpropsmap00builder) | additionalProperty(String key, List value) | -| [ReqPropsFromTrueAddPropsMap00Builder](#reqpropsfromtrueaddpropsmap00builder) | additionalProperty(String key, Map value) | - -## ReqPropsFromTrueAddPropsMap01Builder -public class ReqPropsFromTrueAddPropsMap01Builder
-builder for `Map` - -A class that builds the Map input type - -### Constructor Summary -| Constructor and Description | -| --------------------------- | -| ReqPropsFromTrueAddPropsMap01Builder(Map instance)
Creates a builder that contains the passed instance | - -### Method Summary -| Modifier and Type | Method and Description | -| ----------------- | ---------------------- | -| [ReqPropsFromTrueAddPropsMap00Builder](#reqpropsfromtrueaddpropsmap00builder) | validName(Nothing? value) | -| [ReqPropsFromTrueAddPropsMap00Builder](#reqpropsfromtrueaddpropsmap00builder) | validName(boolean value) | -| [ReqPropsFromTrueAddPropsMap00Builder](#reqpropsfromtrueaddpropsmap00builder) | validName(String value) | -| [ReqPropsFromTrueAddPropsMap00Builder](#reqpropsfromtrueaddpropsmap00builder) | validName(int value) | -| [ReqPropsFromTrueAddPropsMap00Builder](#reqpropsfromtrueaddpropsmap00builder) | validName(float value) | -| [ReqPropsFromTrueAddPropsMap00Builder](#reqpropsfromtrueaddpropsmap00builder) | validName(long value) | -| [ReqPropsFromTrueAddPropsMap00Builder](#reqpropsfromtrueaddpropsmap00builder) | validName(double value) | -| [ReqPropsFromTrueAddPropsMap00Builder](#reqpropsfromtrueaddpropsmap00builder) | validName(List value) | -| [ReqPropsFromTrueAddPropsMap00Builder](#reqpropsfromtrueaddpropsmap00builder) | validName(Map value) | - -## ReqPropsFromTrueAddPropsMap10Builder -public class ReqPropsFromTrueAddPropsMap10Builder
-builder for `Map` - -A class that builds the Map input type - -### Constructor Summary -| Constructor and Description | -| --------------------------- | -| ReqPropsFromTrueAddPropsMap10Builder(Map instance)
Creates a builder that contains the passed instance | - -### Method Summary -| Modifier and Type | Method and Description | -| ----------------- | ---------------------- | -| [ReqPropsFromTrueAddPropsMap00Builder](#reqpropsfromtrueaddpropsmap00builder) | invalidHyphenMinusName(Nothing? value) | -| [ReqPropsFromTrueAddPropsMap00Builder](#reqpropsfromtrueaddpropsmap00builder) | invalidHyphenMinusName(boolean value) | -| [ReqPropsFromTrueAddPropsMap00Builder](#reqpropsfromtrueaddpropsmap00builder) | invalidHyphenMinusName(String value) | -| [ReqPropsFromTrueAddPropsMap00Builder](#reqpropsfromtrueaddpropsmap00builder) | invalidHyphenMinusName(int value) | -| [ReqPropsFromTrueAddPropsMap00Builder](#reqpropsfromtrueaddpropsmap00builder) | invalidHyphenMinusName(float value) | -| [ReqPropsFromTrueAddPropsMap00Builder](#reqpropsfromtrueaddpropsmap00builder) | invalidHyphenMinusName(long value) | -| [ReqPropsFromTrueAddPropsMap00Builder](#reqpropsfromtrueaddpropsmap00builder) | invalidHyphenMinusName(double value) | -| [ReqPropsFromTrueAddPropsMap00Builder](#reqpropsfromtrueaddpropsmap00builder) | invalidHyphenMinusName(List value) | -| [ReqPropsFromTrueAddPropsMap00Builder](#reqpropsfromtrueaddpropsmap00builder) | invalidHyphenMinusName(Map value) | - -## ReqPropsFromTrueAddPropsMapBuilder -public class ReqPropsFromTrueAddPropsMapBuilder
-builder for `Map` - -A class that builds the Map input type - -### Constructor Summary -| Constructor and Description | -| --------------------------- | -| ReqPropsFromTrueAddPropsMapBuilder()
Creates a builder that contains an empty map | - -### Method Summary -| Modifier and Type | Method and Description | -| ----------------- | ---------------------- | -| [ReqPropsFromTrueAddPropsMap01Builder](#reqpropsfromtrueaddpropsmap01builder) | invalidHyphenMinusName(Nothing? value) | -| [ReqPropsFromTrueAddPropsMap01Builder](#reqpropsfromtrueaddpropsmap01builder) | invalidHyphenMinusName(boolean value) | -| [ReqPropsFromTrueAddPropsMap01Builder](#reqpropsfromtrueaddpropsmap01builder) | invalidHyphenMinusName(String value) | -| [ReqPropsFromTrueAddPropsMap01Builder](#reqpropsfromtrueaddpropsmap01builder) | invalidHyphenMinusName(int value) | -| [ReqPropsFromTrueAddPropsMap01Builder](#reqpropsfromtrueaddpropsmap01builder) | invalidHyphenMinusName(float value) | -| [ReqPropsFromTrueAddPropsMap01Builder](#reqpropsfromtrueaddpropsmap01builder) | invalidHyphenMinusName(long value) | -| [ReqPropsFromTrueAddPropsMap01Builder](#reqpropsfromtrueaddpropsmap01builder) | invalidHyphenMinusName(double value) | -| [ReqPropsFromTrueAddPropsMap01Builder](#reqpropsfromtrueaddpropsmap01builder) | invalidHyphenMinusName(List value) | -| [ReqPropsFromTrueAddPropsMap01Builder](#reqpropsfromtrueaddpropsmap01builder) | invalidHyphenMinusName(Map value) | -| [ReqPropsFromTrueAddPropsMap10Builder](#reqpropsfromtrueaddpropsmap10builder) | validName(Nothing? value) | -| [ReqPropsFromTrueAddPropsMap10Builder](#reqpropsfromtrueaddpropsmap10builder) | validName(boolean value) | -| [ReqPropsFromTrueAddPropsMap10Builder](#reqpropsfromtrueaddpropsmap10builder) | validName(String value) | -| [ReqPropsFromTrueAddPropsMap10Builder](#reqpropsfromtrueaddpropsmap10builder) | validName(int value) | -| [ReqPropsFromTrueAddPropsMap10Builder](#reqpropsfromtrueaddpropsmap10builder) | validName(float value) | -| [ReqPropsFromTrueAddPropsMap10Builder](#reqpropsfromtrueaddpropsmap10builder) | validName(long value) | -| [ReqPropsFromTrueAddPropsMap10Builder](#reqpropsfromtrueaddpropsmap10builder) | validName(double value) | -| [ReqPropsFromTrueAddPropsMap10Builder](#reqpropsfromtrueaddpropsmap10builder) | validName(List value) | -| [ReqPropsFromTrueAddPropsMap10Builder](#reqpropsfromtrueaddpropsmap10builder) | validName(Map value) | - -## ReqPropsFromTrueAddPropsMap -public static class ReqPropsFromTrueAddPropsMap
-extends FrozenMap - -A class to store validated Map payloads - -### Method Summary -| Modifier and Type | Method and Description | -| ----------------- | ---------------------- | -| static [ReqPropsFromTrueAddPropsMap](#reqpropsfromtrueaddpropsmap) | of([Map](#reqpropsfromtrueaddpropsmapbuilder) arg, SchemaConfiguration configuration) | -| @Nullable Object | validName()
| -| @Nullable Object | get(String key)
This schema has invalid Java names so this method must be used when you access instance["invalid-name"], | -| @Nullable Object | getAdditionalProperty(String name)
provides type safety for additional properties | - -## 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(Nothing? data)
Creates an instance, private visibility | - -### Method Summary -| Modifier and Type | Method and Description | -| ----------------- | ---------------------- | -| Nothing? | 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 AnyTypeJsonSchema.AnyTypeJsonSchema1 - -A schema class that validates payloads - -| Methods Inherited from class org.openapijsonschematools.client.schemas.AnyTypeJsonSchema.AnyTypeJsonSchema1 | -| ------------------------------------------------------------------ | -| validate | -| validateAndBox | - -[[Back to top]](#top) [[Back to Component Schemas]](../../../README.md#Component-Schemas) [[Back to README]](../../../README.md) diff --git a/samples/client/petstore/kotlin/docs/components/schemas/ReqPropsFromUnsetAddProps.md b/samples/client/petstore/kotlin/docs/components/schemas/ReqPropsFromUnsetAddProps.md deleted file mode 100644 index 02a34a1dc7a..00000000000 --- a/samples/client/petstore/kotlin/docs/components/schemas/ReqPropsFromUnsetAddProps.md +++ /dev/null @@ -1,210 +0,0 @@ -# ReqPropsFromUnsetAddProps -org.openapijsonschematools.client.components.schemas.ReqPropsFromUnsetAddProps.java -public class ReqPropsFromUnsetAddProps
- -A class that contains necessary nested -- schema classes (which validate payloads), extends JsonSchema -- sealed interfaces which store validated payloads, java version of a sum type -- boxed classes which store validated payloads, sealed permits class implementations -- classes to store validated map payloads, extends FrozenMap -- classes to build inputs for map payloads - -## Nested Class Summary -| Modifier and Type | Class and Description | -| ----------------- | ---------------------- | -| sealed interface | [ReqPropsFromUnsetAddProps.ReqPropsFromUnsetAddProps1Boxed](#reqpropsfromunsetaddprops1boxed)
sealed interface for validated payloads | -| record | [ReqPropsFromUnsetAddProps.ReqPropsFromUnsetAddProps1BoxedMap](#reqpropsfromunsetaddprops1boxedmap)
boxed class to store validated Map payloads | -| static class | [ReqPropsFromUnsetAddProps.ReqPropsFromUnsetAddProps1](#reqpropsfromunsetaddprops1)
schema class | -| static class | [ReqPropsFromUnsetAddProps.ReqPropsFromUnsetAddPropsMapBuilder](#reqpropsfromunsetaddpropsmapbuilder)
builder for Map payloads | -| static class | [ReqPropsFromUnsetAddProps.ReqPropsFromUnsetAddPropsMap](#reqpropsfromunsetaddpropsmap)
output class for Map payloads | - -## ReqPropsFromUnsetAddProps1Boxed -public sealed interface ReqPropsFromUnsetAddProps1Boxed
-permits
-[ReqPropsFromUnsetAddProps1BoxedMap](#reqpropsfromunsetaddprops1boxedmap) - -sealed interface that stores validated payloads using boxed classes - -## ReqPropsFromUnsetAddProps1BoxedMap -public record ReqPropsFromUnsetAddProps1BoxedMap
-implements [ReqPropsFromUnsetAddProps1Boxed](#reqpropsfromunsetaddprops1boxed) - -record that stores validated Map payloads, sealed permits implementation - -### Constructor Summary -| Constructor and Description | -| --------------------------- | -| ReqPropsFromUnsetAddProps1BoxedMap([ReqPropsFromUnsetAddPropsMap](#reqpropsfromunsetaddpropsmap) data)
Creates an instance, private visibility | - -### Method Summary -| Modifier and Type | Method and Description | -| ----------------- | ---------------------- | -| [ReqPropsFromUnsetAddPropsMap](#reqpropsfromunsetaddpropsmap) | data()
validated payload | -| @Nullable Object | getData()
validated payload | - -## ReqPropsFromUnsetAddProps1 -public static class ReqPropsFromUnsetAddProps1
-extends JsonSchema - -A schema class that validates payloads - -### Code Sample -``` -import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags; -import org.openapijsonschematools.client.configurations.SchemaConfiguration; -import org.openapijsonschematools.client.exceptions.ValidationException; -import org.openapijsonschematools.client.schemas.validation.MapUtils; -import org.openapijsonschematools.client.schemas.validation.FrozenList; -import org.openapijsonschematools.client.schemas.validation.FrozenMap; -import org.openapijsonschematools.client.components.schemas.ReqPropsFromUnsetAddProps; - -import java.util.Arrays; -import java.util.List; -import java.util.AbstractMap; - -static final SchemaConfiguration configuration = new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().build()); - -// Map validation -ReqPropsFromUnsetAddProps.ReqPropsFromUnsetAddPropsMap validatedPayload = - ReqPropsFromUnsetAddProps.ReqPropsFromUnsetAddProps1.validate( - new ReqPropsFromUnsetAddProps.ReqPropsFromUnsetAddPropsMapBuilder() - .build(), - configuration -); -``` - -### Field Summary -| Modifier and Type | Field and Description | -| ----------------- | ---------------------- | -| Set> | type = Set.of(Map.class) | -| Set | required = Set.of(
    "invalid-name",
    "validName"
)
| - -### Method Summary -| Modifier and Type | Method and Description | -| ----------------- | ---------------------- | -| [ReqPropsFromUnsetAddPropsMap](#reqpropsfromunsetaddpropsmap) | validate([Map<?, ?>](#reqpropsfromunsetaddpropsmapbuilder) arg, SchemaConfiguration configuration) | -| [ReqPropsFromUnsetAddProps1BoxedMap](#reqpropsfromunsetaddprops1boxedmap) | validateAndBox([Map<?, ?>](#reqpropsfromunsetaddpropsmapbuilder) arg, SchemaConfiguration configuration) | -| [ReqPropsFromUnsetAddProps1Boxed](#reqpropsfromunsetaddprops1boxed) | validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) | -| @Nullable Object | validate(@Nullable Object arg, SchemaConfiguration configuration) | - -## ReqPropsFromUnsetAddPropsMap00Builder -public class ReqPropsFromUnsetAddPropsMap00Builder
-builder for `Map` - -A class that builds the Map input type - -### Constructor Summary -| Constructor and Description | -| --------------------------- | -| ReqPropsFromUnsetAddPropsMap00Builder(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 | -| [ReqPropsFromUnsetAddPropsMap00Builder](#reqpropsfromunsetaddpropsmap00builder) | additionalProperty(String key, Nothing? value) | -| [ReqPropsFromUnsetAddPropsMap00Builder](#reqpropsfromunsetaddpropsmap00builder) | additionalProperty(String key, boolean value) | -| [ReqPropsFromUnsetAddPropsMap00Builder](#reqpropsfromunsetaddpropsmap00builder) | additionalProperty(String key, String value) | -| [ReqPropsFromUnsetAddPropsMap00Builder](#reqpropsfromunsetaddpropsmap00builder) | additionalProperty(String key, int value) | -| [ReqPropsFromUnsetAddPropsMap00Builder](#reqpropsfromunsetaddpropsmap00builder) | additionalProperty(String key, float value) | -| [ReqPropsFromUnsetAddPropsMap00Builder](#reqpropsfromunsetaddpropsmap00builder) | additionalProperty(String key, long value) | -| [ReqPropsFromUnsetAddPropsMap00Builder](#reqpropsfromunsetaddpropsmap00builder) | additionalProperty(String key, double value) | -| [ReqPropsFromUnsetAddPropsMap00Builder](#reqpropsfromunsetaddpropsmap00builder) | additionalProperty(String key, List value) | -| [ReqPropsFromUnsetAddPropsMap00Builder](#reqpropsfromunsetaddpropsmap00builder) | additionalProperty(String key, Map value) | - -## ReqPropsFromUnsetAddPropsMap01Builder -public class ReqPropsFromUnsetAddPropsMap01Builder
-builder for `Map` - -A class that builds the Map input type - -### Constructor Summary -| Constructor and Description | -| --------------------------- | -| ReqPropsFromUnsetAddPropsMap01Builder(Map instance)
Creates a builder that contains the passed instance | - -### Method Summary -| Modifier and Type | Method and Description | -| ----------------- | ---------------------- | -| [ReqPropsFromUnsetAddPropsMap00Builder](#reqpropsfromunsetaddpropsmap00builder) | validName(Nothing? value) | -| [ReqPropsFromUnsetAddPropsMap00Builder](#reqpropsfromunsetaddpropsmap00builder) | validName(boolean value) | -| [ReqPropsFromUnsetAddPropsMap00Builder](#reqpropsfromunsetaddpropsmap00builder) | validName(String value) | -| [ReqPropsFromUnsetAddPropsMap00Builder](#reqpropsfromunsetaddpropsmap00builder) | validName(int value) | -| [ReqPropsFromUnsetAddPropsMap00Builder](#reqpropsfromunsetaddpropsmap00builder) | validName(float value) | -| [ReqPropsFromUnsetAddPropsMap00Builder](#reqpropsfromunsetaddpropsmap00builder) | validName(long value) | -| [ReqPropsFromUnsetAddPropsMap00Builder](#reqpropsfromunsetaddpropsmap00builder) | validName(double value) | -| [ReqPropsFromUnsetAddPropsMap00Builder](#reqpropsfromunsetaddpropsmap00builder) | validName(List value) | -| [ReqPropsFromUnsetAddPropsMap00Builder](#reqpropsfromunsetaddpropsmap00builder) | validName(Map value) | - -## ReqPropsFromUnsetAddPropsMap10Builder -public class ReqPropsFromUnsetAddPropsMap10Builder
-builder for `Map` - -A class that builds the Map input type - -### Constructor Summary -| Constructor and Description | -| --------------------------- | -| ReqPropsFromUnsetAddPropsMap10Builder(Map instance)
Creates a builder that contains the passed instance | - -### Method Summary -| Modifier and Type | Method and Description | -| ----------------- | ---------------------- | -| [ReqPropsFromUnsetAddPropsMap00Builder](#reqpropsfromunsetaddpropsmap00builder) | invalidHyphenMinusName(Nothing? value) | -| [ReqPropsFromUnsetAddPropsMap00Builder](#reqpropsfromunsetaddpropsmap00builder) | invalidHyphenMinusName(boolean value) | -| [ReqPropsFromUnsetAddPropsMap00Builder](#reqpropsfromunsetaddpropsmap00builder) | invalidHyphenMinusName(String value) | -| [ReqPropsFromUnsetAddPropsMap00Builder](#reqpropsfromunsetaddpropsmap00builder) | invalidHyphenMinusName(int value) | -| [ReqPropsFromUnsetAddPropsMap00Builder](#reqpropsfromunsetaddpropsmap00builder) | invalidHyphenMinusName(float value) | -| [ReqPropsFromUnsetAddPropsMap00Builder](#reqpropsfromunsetaddpropsmap00builder) | invalidHyphenMinusName(long value) | -| [ReqPropsFromUnsetAddPropsMap00Builder](#reqpropsfromunsetaddpropsmap00builder) | invalidHyphenMinusName(double value) | -| [ReqPropsFromUnsetAddPropsMap00Builder](#reqpropsfromunsetaddpropsmap00builder) | invalidHyphenMinusName(List value) | -| [ReqPropsFromUnsetAddPropsMap00Builder](#reqpropsfromunsetaddpropsmap00builder) | invalidHyphenMinusName(Map value) | - -## ReqPropsFromUnsetAddPropsMapBuilder -public class ReqPropsFromUnsetAddPropsMapBuilder
-builder for `Map` - -A class that builds the Map input type - -### Constructor Summary -| Constructor and Description | -| --------------------------- | -| ReqPropsFromUnsetAddPropsMapBuilder()
Creates a builder that contains an empty map | - -### Method Summary -| Modifier and Type | Method and Description | -| ----------------- | ---------------------- | -| [ReqPropsFromUnsetAddPropsMap01Builder](#reqpropsfromunsetaddpropsmap01builder) | invalidHyphenMinusName(Nothing? value) | -| [ReqPropsFromUnsetAddPropsMap01Builder](#reqpropsfromunsetaddpropsmap01builder) | invalidHyphenMinusName(boolean value) | -| [ReqPropsFromUnsetAddPropsMap01Builder](#reqpropsfromunsetaddpropsmap01builder) | invalidHyphenMinusName(String value) | -| [ReqPropsFromUnsetAddPropsMap01Builder](#reqpropsfromunsetaddpropsmap01builder) | invalidHyphenMinusName(int value) | -| [ReqPropsFromUnsetAddPropsMap01Builder](#reqpropsfromunsetaddpropsmap01builder) | invalidHyphenMinusName(float value) | -| [ReqPropsFromUnsetAddPropsMap01Builder](#reqpropsfromunsetaddpropsmap01builder) | invalidHyphenMinusName(long value) | -| [ReqPropsFromUnsetAddPropsMap01Builder](#reqpropsfromunsetaddpropsmap01builder) | invalidHyphenMinusName(double value) | -| [ReqPropsFromUnsetAddPropsMap01Builder](#reqpropsfromunsetaddpropsmap01builder) | invalidHyphenMinusName(List value) | -| [ReqPropsFromUnsetAddPropsMap01Builder](#reqpropsfromunsetaddpropsmap01builder) | invalidHyphenMinusName(Map value) | -| [ReqPropsFromUnsetAddPropsMap10Builder](#reqpropsfromunsetaddpropsmap10builder) | validName(Nothing? value) | -| [ReqPropsFromUnsetAddPropsMap10Builder](#reqpropsfromunsetaddpropsmap10builder) | validName(boolean value) | -| [ReqPropsFromUnsetAddPropsMap10Builder](#reqpropsfromunsetaddpropsmap10builder) | validName(String value) | -| [ReqPropsFromUnsetAddPropsMap10Builder](#reqpropsfromunsetaddpropsmap10builder) | validName(int value) | -| [ReqPropsFromUnsetAddPropsMap10Builder](#reqpropsfromunsetaddpropsmap10builder) | validName(float value) | -| [ReqPropsFromUnsetAddPropsMap10Builder](#reqpropsfromunsetaddpropsmap10builder) | validName(long value) | -| [ReqPropsFromUnsetAddPropsMap10Builder](#reqpropsfromunsetaddpropsmap10builder) | validName(double value) | -| [ReqPropsFromUnsetAddPropsMap10Builder](#reqpropsfromunsetaddpropsmap10builder) | validName(List value) | -| [ReqPropsFromUnsetAddPropsMap10Builder](#reqpropsfromunsetaddpropsmap10builder) | validName(Map value) | - -## ReqPropsFromUnsetAddPropsMap -public static class ReqPropsFromUnsetAddPropsMap
-extends FrozenMap - -A class to store validated Map payloads - -### Method Summary -| Modifier and Type | Method and Description | -| ----------------- | ---------------------- | -| static [ReqPropsFromUnsetAddPropsMap](#reqpropsfromunsetaddpropsmap) | of([Map](#reqpropsfromunsetaddpropsmapbuilder) arg, SchemaConfiguration configuration) | -| @Nullable Object | validName()
| -| @Nullable Object | get(String key)
This schema has invalid Java names so this method must be used when you access instance["invalid-name"], | -| @Nullable Object | getAdditionalProperty(String name)
provides type safety for additional properties | - -[[Back to top]](#top) [[Back to Component Schemas]](../../../README.md#Component-Schemas) [[Back to README]](../../../README.md) diff --git a/samples/client/petstore/kotlin/docs/components/schemas/ReturnSchema.md b/samples/client/petstore/kotlin/docs/components/schemas/ReturnSchema.md deleted file mode 100644 index fb5c1608867..00000000000 --- a/samples/client/petstore/kotlin/docs/components/schemas/ReturnSchema.md +++ /dev/null @@ -1,257 +0,0 @@ -# ReturnSchema -org.openapijsonschematools.client.components.schemas.ReturnSchema.java -public class ReturnSchema
- -A class that contains necessary nested -- schema classes (which validate payloads), extends JsonSchema -- sealed interfaces which store validated payloads, java version of a sum type -- boxed classes which store validated payloads, sealed permits class implementations -- classes to store validated map payloads, extends FrozenMap -- classes to build inputs for map payloads - -## Nested Class Summary -| Modifier and Type | Class and Description | -| ----------------- | ---------------------- | -| sealed interface | [ReturnSchema.ReturnSchema1Boxed](#returnschema1boxed)
sealed interface for validated payloads | -| record | [ReturnSchema.ReturnSchema1BoxedVoid](#returnschema1boxedvoid)
boxed class to store validated null payloads | -| record | [ReturnSchema.ReturnSchema1BoxedBoolean](#returnschema1boxedboolean)
boxed class to store validated boolean payloads | -| record | [ReturnSchema.ReturnSchema1BoxedNumber](#returnschema1boxednumber)
boxed class to store validated Number payloads | -| record | [ReturnSchema.ReturnSchema1BoxedString](#returnschema1boxedstring)
boxed class to store validated String payloads | -| record | [ReturnSchema.ReturnSchema1BoxedList](#returnschema1boxedlist)
boxed class to store validated List payloads | -| record | [ReturnSchema.ReturnSchema1BoxedMap](#returnschema1boxedmap)
boxed class to store validated Map payloads | -| static class | [ReturnSchema.ReturnSchema1](#returnschema1)
schema class | -| static class | [ReturnSchema.ReturnMapBuilder1](#returnmapbuilder1)
builder for Map payloads | -| static class | [ReturnSchema.ReturnMap](#returnmap)
output class for Map payloads | -| sealed interface | [ReturnSchema.ReturnSchema2Boxed](#returnschema2boxed)
sealed interface for validated payloads | -| record | [ReturnSchema.ReturnSchema2BoxedNumber](#returnschema2boxednumber)
boxed class to store validated Number payloads | -| static class | [ReturnSchema.ReturnSchema2](#returnschema2)
schema class | - -## ReturnSchema1Boxed -public sealed interface ReturnSchema1Boxed
-permits
-[ReturnSchema1BoxedVoid](#returnschema1boxedvoid), -[ReturnSchema1BoxedBoolean](#returnschema1boxedboolean), -[ReturnSchema1BoxedNumber](#returnschema1boxednumber), -[ReturnSchema1BoxedString](#returnschema1boxedstring), -[ReturnSchema1BoxedList](#returnschema1boxedlist), -[ReturnSchema1BoxedMap](#returnschema1boxedmap) - -sealed interface that stores validated payloads using boxed classes - -## ReturnSchema1BoxedVoid -public record ReturnSchema1BoxedVoid
-implements [ReturnSchema1Boxed](#returnschema1boxed) - -record that stores validated null payloads, sealed permits implementation - -### Constructor Summary -| Constructor and Description | -| --------------------------- | -| ReturnSchema1BoxedVoid(Nothing? data)
Creates an instance, private visibility | - -### Method Summary -| Modifier and Type | Method and Description | -| ----------------- | ---------------------- | -| Nothing? | data()
validated payload | -| @Nullable Object | getData()
validated payload | - -## ReturnSchema1BoxedBoolean -public record ReturnSchema1BoxedBoolean
-implements [ReturnSchema1Boxed](#returnschema1boxed) - -record that stores validated boolean payloads, sealed permits implementation - -### Constructor Summary -| Constructor and Description | -| --------------------------- | -| ReturnSchema1BoxedBoolean(boolean data)
Creates an instance, private visibility | - -### Method Summary -| Modifier and Type | Method and Description | -| ----------------- | ---------------------- | -| boolean | data()
validated payload | -| @Nullable Object | getData()
validated payload | - -## ReturnSchema1BoxedNumber -public record ReturnSchema1BoxedNumber
-implements [ReturnSchema1Boxed](#returnschema1boxed) - -record that stores validated Number payloads, sealed permits implementation - -### Constructor Summary -| Constructor and Description | -| --------------------------- | -| ReturnSchema1BoxedNumber(Number data)
Creates an instance, private visibility | - -### Method Summary -| Modifier and Type | Method and Description | -| ----------------- | ---------------------- | -| Number | data()
validated payload | -| @Nullable Object | getData()
validated payload | - -## ReturnSchema1BoxedString -public record ReturnSchema1BoxedString
-implements [ReturnSchema1Boxed](#returnschema1boxed) - -record that stores validated String payloads, sealed permits implementation - -### Constructor Summary -| Constructor and Description | -| --------------------------- | -| ReturnSchema1BoxedString(String data)
Creates an instance, private visibility | - -### Method Summary -| Modifier and Type | Method and Description | -| ----------------- | ---------------------- | -| String | data()
validated payload | -| @Nullable Object | getData()
validated payload | - -## ReturnSchema1BoxedList -public record ReturnSchema1BoxedList
-implements [ReturnSchema1Boxed](#returnschema1boxed) - -record that stores validated List payloads, sealed permits implementation - -### Constructor Summary -| Constructor and Description | -| --------------------------- | -| ReturnSchema1BoxedList(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 | - -## ReturnSchema1BoxedMap -public record ReturnSchema1BoxedMap
-implements [ReturnSchema1Boxed](#returnschema1boxed) - -record that stores validated Map payloads, sealed permits implementation - -### Constructor Summary -| Constructor and Description | -| --------------------------- | -| ReturnSchema1BoxedMap([ReturnMap](#returnmap) data)
Creates an instance, private visibility | - -### Method Summary -| Modifier and Type | Method and Description | -| ----------------- | ---------------------- | -| [ReturnMap](#returnmap) | data()
validated payload | -| @Nullable Object | getData()
validated payload | - -## ReturnSchema1 -public static class ReturnSchema1
-extends JsonSchema - -A schema class that validates payloads - -## Description -Model for testing reserved words - -### Field Summary -| Modifier and Type | Field and Description | -| ----------------- | ---------------------- | -| Map> | properties = Map.ofEntries(
    new PropertyEntry("return", [ReturnSchema2.class](#returnschema2)))
)
| - -### Method Summary -| Modifier and Type | Method and Description | -| ----------------- | ---------------------- | -| String | validate(String arg, SchemaConfiguration configuration) | -| Nothing? | validate(Nothing? arg, SchemaConfiguration configuration) | -| int | validate(int arg, SchemaConfiguration configuration) | -| long | validate(long arg, SchemaConfiguration configuration) | -| float | validate(float arg, SchemaConfiguration configuration) | -| double | validate(double arg, SchemaConfiguration configuration) | -| Number | validate(Number arg, SchemaConfiguration configuration) | -| boolean | validate(boolean arg, SchemaConfiguration configuration) | -| [ReturnMap](#returnmap) | validate([Map<?, ?>](#returnmapbuilder1) arg, SchemaConfiguration configuration) | -| FrozenList<@Nullable Object> | validate(List arg, SchemaConfiguration configuration) | -| [ReturnSchema1BoxedString](#returnschema1boxedstring) | validateAndBox(String arg, SchemaConfiguration configuration) | -| [ReturnSchema1BoxedVoid](#returnschema1boxedvoid) | validateAndBox(Nothing? arg, SchemaConfiguration configuration) | -| [ReturnSchema1BoxedNumber](#returnschema1boxednumber) | validateAndBox(Number arg, SchemaConfiguration configuration) | -| [ReturnSchema1BoxedBoolean](#returnschema1boxedboolean) | validateAndBox(boolean arg, SchemaConfiguration configuration) | -| [ReturnSchema1BoxedMap](#returnschema1boxedmap) | validateAndBox([Map<?, ?>](#returnmapbuilder1) arg, SchemaConfiguration configuration) | -| [ReturnSchema1BoxedList](#returnschema1boxedlist) | validateAndBox(List arg, SchemaConfiguration configuration) | -| [ReturnSchema1Boxed](#returnschema1boxed) | validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) | -| @Nullable Object | validate(@Nullable Object arg, SchemaConfiguration configuration) | - -## ReturnMapBuilder1 -public class ReturnMapBuilder1
-builder for `Map` - -A class that builds the Map input type - -### Constructor Summary -| Constructor and Description | -| --------------------------- | -| ReturnMapBuilder1()
Creates a builder that contains an empty map | - -### Method Summary -| Modifier and Type | Method and Description | -| ----------------- | ---------------------- | -| Map | build()
Returns map input that should be used with Schema.validate | -| [ReturnMapBuilder1](#returnmapbuilder1) | setReturn(int value) | -| [ReturnMapBuilder1](#returnmapbuilder1) | setReturn(float value) | -| [ReturnMapBuilder1](#returnmapbuilder1) | additionalProperty(String key, Nothing? value) | -| [ReturnMapBuilder1](#returnmapbuilder1) | additionalProperty(String key, boolean value) | -| [ReturnMapBuilder1](#returnmapbuilder1) | additionalProperty(String key, String value) | -| [ReturnMapBuilder1](#returnmapbuilder1) | additionalProperty(String key, int value) | -| [ReturnMapBuilder1](#returnmapbuilder1) | additionalProperty(String key, float value) | -| [ReturnMapBuilder1](#returnmapbuilder1) | additionalProperty(String key, long value) | -| [ReturnMapBuilder1](#returnmapbuilder1) | additionalProperty(String key, double value) | -| [ReturnMapBuilder1](#returnmapbuilder1) | additionalProperty(String key, List value) | -| [ReturnMapBuilder1](#returnmapbuilder1) | additionalProperty(String key, Map value) | - -## ReturnMap -public static class ReturnMap
-extends FrozenMap - -A class to store validated Map payloads - -### Method Summary -| Modifier and Type | Method and Description | -| ----------------- | ---------------------- | -| static [ReturnMap](#returnmap) | of([Map](#returnmapbuilder1) arg, SchemaConfiguration configuration) | -| @Nullable Object | get(String key)
This schema has invalid Java names so this method must be used when you access instance["return"], | -| @Nullable Object | getAdditionalProperty(String name)
provides type safety for additional properties | - -## ReturnSchema2Boxed -public sealed interface ReturnSchema2Boxed
-permits
-[ReturnSchema2BoxedNumber](#returnschema2boxednumber) - -sealed interface that stores validated payloads using boxed classes - -## ReturnSchema2BoxedNumber -public record ReturnSchema2BoxedNumber
-implements [ReturnSchema2Boxed](#returnschema2boxed) - -record that stores validated Number payloads, sealed permits implementation - -### Constructor Summary -| Constructor and Description | -| --------------------------- | -| ReturnSchema2BoxedNumber(Number data)
Creates an instance, private visibility | - -### Method Summary -| Modifier and Type | Method and Description | -| ----------------- | ---------------------- | -| Number | data()
validated payload | -| @Nullable Object | getData()
validated payload | - -## ReturnSchema2 -public static class ReturnSchema2
-extends Int32JsonSchema.Int32JsonSchema1 - -A schema class that validates payloads - -## Description -this is a reserved python keyword - -| Methods Inherited from class org.openapijsonschematools.client.schemas.Int32JsonSchema.Int32JsonSchema1 | -| ------------------------------------------------------------------ | -| validate | -| validateAndBox | - -[[Back to top]](#top) [[Back to Component Schemas]](../../../README.md#Component-Schemas) [[Back to README]](../../../README.md) diff --git a/samples/client/petstore/kotlin/docs/components/schemas/ScaleneTriangle.md b/samples/client/petstore/kotlin/docs/components/schemas/ScaleneTriangle.md deleted file mode 100644 index 7c2be88acb9..00000000000 --- a/samples/client/petstore/kotlin/docs/components/schemas/ScaleneTriangle.md +++ /dev/null @@ -1,371 +0,0 @@ -# ScaleneTriangle -org.openapijsonschematools.client.components.schemas.ScaleneTriangle.java -public class ScaleneTriangle
- -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 | [ScaleneTriangle.ScaleneTriangle1Boxed](#scalenetriangle1boxed)
sealed interface for validated payloads | -| record | [ScaleneTriangle.ScaleneTriangle1BoxedVoid](#scalenetriangle1boxedvoid)
boxed class to store validated null payloads | -| record | [ScaleneTriangle.ScaleneTriangle1BoxedBoolean](#scalenetriangle1boxedboolean)
boxed class to store validated boolean payloads | -| record | [ScaleneTriangle.ScaleneTriangle1BoxedNumber](#scalenetriangle1boxednumber)
boxed class to store validated Number payloads | -| record | [ScaleneTriangle.ScaleneTriangle1BoxedString](#scalenetriangle1boxedstring)
boxed class to store validated String payloads | -| record | [ScaleneTriangle.ScaleneTriangle1BoxedList](#scalenetriangle1boxedlist)
boxed class to store validated List payloads | -| record | [ScaleneTriangle.ScaleneTriangle1BoxedMap](#scalenetriangle1boxedmap)
boxed class to store validated Map payloads | -| static class | [ScaleneTriangle.ScaleneTriangle1](#scalenetriangle1)
schema class | -| sealed interface | [ScaleneTriangle.Schema1Boxed](#schema1boxed)
sealed interface for validated payloads | -| record | [ScaleneTriangle.Schema1BoxedMap](#schema1boxedmap)
boxed class to store validated Map payloads | -| static class | [ScaleneTriangle.Schema1](#schema1)
schema class | -| static class | [ScaleneTriangle.Schema1MapBuilder](#schema1mapbuilder)
builder for Map payloads | -| static class | [ScaleneTriangle.Schema1Map](#schema1map)
output class for Map payloads | -| sealed interface | [ScaleneTriangle.TriangleTypeBoxed](#triangletypeboxed)
sealed interface for validated payloads | -| record | [ScaleneTriangle.TriangleTypeBoxedString](#triangletypeboxedstring)
boxed class to store validated String payloads | -| static class | [ScaleneTriangle.TriangleType](#triangletype)
schema class | -| enum | [ScaleneTriangle.StringTriangleTypeEnums](#stringtriangletypeenums)
String enum | - -## ScaleneTriangle1Boxed -public sealed interface ScaleneTriangle1Boxed
-permits
-[ScaleneTriangle1BoxedVoid](#scalenetriangle1boxedvoid), -[ScaleneTriangle1BoxedBoolean](#scalenetriangle1boxedboolean), -[ScaleneTriangle1BoxedNumber](#scalenetriangle1boxednumber), -[ScaleneTriangle1BoxedString](#scalenetriangle1boxedstring), -[ScaleneTriangle1BoxedList](#scalenetriangle1boxedlist), -[ScaleneTriangle1BoxedMap](#scalenetriangle1boxedmap) - -sealed interface that stores validated payloads using boxed classes - -## ScaleneTriangle1BoxedVoid -public record ScaleneTriangle1BoxedVoid
-implements [ScaleneTriangle1Boxed](#scalenetriangle1boxed) - -record that stores validated null payloads, sealed permits implementation - -### Constructor Summary -| Constructor and Description | -| --------------------------- | -| ScaleneTriangle1BoxedVoid(Nothing? data)
Creates an instance, private visibility | - -### Method Summary -| Modifier and Type | Method and Description | -| ----------------- | ---------------------- | -| Nothing? | data()
validated payload | -| @Nullable Object | getData()
validated payload | - -## ScaleneTriangle1BoxedBoolean -public record ScaleneTriangle1BoxedBoolean
-implements [ScaleneTriangle1Boxed](#scalenetriangle1boxed) - -record that stores validated boolean payloads, sealed permits implementation - -### Constructor Summary -| Constructor and Description | -| --------------------------- | -| ScaleneTriangle1BoxedBoolean(boolean data)
Creates an instance, private visibility | - -### Method Summary -| Modifier and Type | Method and Description | -| ----------------- | ---------------------- | -| boolean | data()
validated payload | -| @Nullable Object | getData()
validated payload | - -## ScaleneTriangle1BoxedNumber -public record ScaleneTriangle1BoxedNumber
-implements [ScaleneTriangle1Boxed](#scalenetriangle1boxed) - -record that stores validated Number payloads, sealed permits implementation - -### Constructor Summary -| Constructor and Description | -| --------------------------- | -| ScaleneTriangle1BoxedNumber(Number data)
Creates an instance, private visibility | - -### Method Summary -| Modifier and Type | Method and Description | -| ----------------- | ---------------------- | -| Number | data()
validated payload | -| @Nullable Object | getData()
validated payload | - -## ScaleneTriangle1BoxedString -public record ScaleneTriangle1BoxedString
-implements [ScaleneTriangle1Boxed](#scalenetriangle1boxed) - -record that stores validated String payloads, sealed permits implementation - -### Constructor Summary -| Constructor and Description | -| --------------------------- | -| ScaleneTriangle1BoxedString(String data)
Creates an instance, private visibility | - -### Method Summary -| Modifier and Type | Method and Description | -| ----------------- | ---------------------- | -| String | data()
validated payload | -| @Nullable Object | getData()
validated payload | - -## ScaleneTriangle1BoxedList -public record ScaleneTriangle1BoxedList
-implements [ScaleneTriangle1Boxed](#scalenetriangle1boxed) - -record that stores validated List payloads, sealed permits implementation - -### Constructor Summary -| Constructor and Description | -| --------------------------- | -| ScaleneTriangle1BoxedList(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 | - -## ScaleneTriangle1BoxedMap -public record ScaleneTriangle1BoxedMap
-implements [ScaleneTriangle1Boxed](#scalenetriangle1boxed) - -record that stores validated Map payloads, sealed permits implementation - -### Constructor Summary -| Constructor and Description | -| --------------------------- | -| ScaleneTriangle1BoxedMap(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 | - -## ScaleneTriangle1 -public static class ScaleneTriangle1
-extends JsonSchema - -A schema class that validates payloads - -### Field Summary -| Modifier and Type | Field and Description | -| ----------------- | ---------------------- | -| List> | allOf = List.of(
    [TriangleInterface.TriangleInterface1.class](../../components/schemas/TriangleInterface.md#triangleinterface1),
    [Schema1.class](#schema1)
;)
| - -### Method Summary -| Modifier and Type | Method and Description | -| ----------------- | ---------------------- | -| String | validate(String arg, SchemaConfiguration configuration) | -| Nothing? | validate(Nothing? arg, SchemaConfiguration configuration) | -| int | validate(int arg, SchemaConfiguration configuration) | -| long | validate(long arg, SchemaConfiguration configuration) | -| float | validate(float arg, SchemaConfiguration configuration) | -| double | validate(double arg, SchemaConfiguration configuration) | -| Number | validate(Number arg, SchemaConfiguration configuration) | -| boolean | validate(boolean arg, SchemaConfiguration configuration) | -| FrozenMap<@Nullable Object> | validate(Map<?, ?> arg, SchemaConfiguration configuration) | -| FrozenList<@Nullable Object> | validate(List arg, SchemaConfiguration configuration) | -| [ScaleneTriangle1BoxedString](#scalenetriangle1boxedstring) | validateAndBox(String arg, SchemaConfiguration configuration) | -| [ScaleneTriangle1BoxedVoid](#scalenetriangle1boxedvoid) | validateAndBox(Nothing? arg, SchemaConfiguration configuration) | -| [ScaleneTriangle1BoxedNumber](#scalenetriangle1boxednumber) | validateAndBox(Number arg, SchemaConfiguration configuration) | -| [ScaleneTriangle1BoxedBoolean](#scalenetriangle1boxedboolean) | validateAndBox(boolean arg, SchemaConfiguration configuration) | -| [ScaleneTriangle1BoxedMap](#scalenetriangle1boxedmap) | validateAndBox(Map<?, ?> arg, SchemaConfiguration configuration) | -| [ScaleneTriangle1BoxedList](#scalenetriangle1boxedlist) | validateAndBox(List arg, SchemaConfiguration configuration) | -| [ScaleneTriangle1Boxed](#scalenetriangle1boxed) | validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) | -| @Nullable Object | validate(@Nullable Object arg, SchemaConfiguration configuration) | - -## Schema1Boxed -public sealed interface Schema1Boxed
-permits
-[Schema1BoxedMap](#schema1boxedmap) - -sealed interface that stores validated payloads using boxed classes - -## Schema1BoxedMap -public record Schema1BoxedMap
-implements [Schema1Boxed](#schema1boxed) - -record that stores validated Map payloads, sealed permits implementation - -### Constructor Summary -| Constructor and Description | -| --------------------------- | -| Schema1BoxedMap([Schema1Map](#schema1map) data)
Creates an instance, private visibility | - -### Method Summary -| Modifier and Type | Method and Description | -| ----------------- | ---------------------- | -| [Schema1Map](#schema1map) | data()
validated payload | -| @Nullable Object | getData()
validated payload | - -## Schema1 -public static class Schema1
-extends JsonSchema - -A schema class that validates payloads - -### Code Sample -``` -import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags; -import org.openapijsonschematools.client.configurations.SchemaConfiguration; -import org.openapijsonschematools.client.exceptions.ValidationException; -import org.openapijsonschematools.client.schemas.validation.MapUtils; -import org.openapijsonschematools.client.schemas.validation.FrozenList; -import org.openapijsonschematools.client.schemas.validation.FrozenMap; -import org.openapijsonschematools.client.components.schemas.ScaleneTriangle; - -import java.util.Arrays; -import java.util.List; -import java.util.AbstractMap; - -static final SchemaConfiguration configuration = new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().build()); - -// Map validation -ScaleneTriangle.Schema1Map validatedPayload = - ScaleneTriangle.Schema1.validate( - new ScaleneTriangle.Schema1MapBuilder() - .triangleType("ScaleneTriangle") - - .build(), - configuration -); -``` - -### Field Summary -| Modifier and Type | Field and Description | -| ----------------- | ---------------------- | -| Set> | type = Set.of(Map.class) | -| Map> | properties = Map.ofEntries(
    new PropertyEntry("triangleType", [TriangleType.class](#triangletype)))
)
| - -### Method Summary -| Modifier and Type | Method and Description | -| ----------------- | ---------------------- | -| [Schema1Map](#schema1map) | validate([Map<?, ?>](#schema1mapbuilder) arg, SchemaConfiguration configuration) | -| [Schema1BoxedMap](#schema1boxedmap) | validateAndBox([Map<?, ?>](#schema1mapbuilder) arg, SchemaConfiguration configuration) | -| [Schema1Boxed](#schema1boxed) | validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) | -| @Nullable Object | validate(@Nullable Object arg, SchemaConfiguration configuration) | - -## Schema1MapBuilder -public class Schema1MapBuilder
-builder for `Map` - -A class that builds the Map input type - -### Constructor Summary -| Constructor and Description | -| --------------------------- | -| Schema1MapBuilder()
Creates a builder that contains an empty map | - -### Method Summary -| Modifier and Type | Method and Description | -| ----------------- | ---------------------- | -| Map | build()
Returns map input that should be used with Schema.validate | -| [Schema1MapBuilder](#schema1mapbuilder) | triangleType(String value) | -| [Schema1MapBuilder](#schema1mapbuilder) | triangleType([StringTriangleTypeEnums](#stringtriangletypeenums) value) | -| [Schema1MapBuilder](#schema1mapbuilder) | additionalProperty(String key, Nothing? value) | -| [Schema1MapBuilder](#schema1mapbuilder) | additionalProperty(String key, boolean value) | -| [Schema1MapBuilder](#schema1mapbuilder) | additionalProperty(String key, String value) | -| [Schema1MapBuilder](#schema1mapbuilder) | additionalProperty(String key, int value) | -| [Schema1MapBuilder](#schema1mapbuilder) | additionalProperty(String key, float value) | -| [Schema1MapBuilder](#schema1mapbuilder) | additionalProperty(String key, long value) | -| [Schema1MapBuilder](#schema1mapbuilder) | additionalProperty(String key, double value) | -| [Schema1MapBuilder](#schema1mapbuilder) | additionalProperty(String key, List value) | -| [Schema1MapBuilder](#schema1mapbuilder) | additionalProperty(String key, Map value) | - -## Schema1Map -public static class Schema1Map
-extends FrozenMap - -A class to store validated Map payloads - -### Method Summary -| Modifier and Type | Method and Description | -| ----------------- | ---------------------- | -| static [Schema1Map](#schema1map) | of([Map](#schema1mapbuilder) arg, SchemaConfiguration configuration) | -| String | triangleType()
[optional] must be one of ["ScaleneTriangle"] | -| @Nullable Object | getAdditionalProperty(String name)
provides type safety for additional properties | - -## TriangleTypeBoxed -public sealed interface TriangleTypeBoxed
-permits
-[TriangleTypeBoxedString](#triangletypeboxedstring) - -sealed interface that stores validated payloads using boxed classes - -## TriangleTypeBoxedString -public record TriangleTypeBoxedString
-implements [TriangleTypeBoxed](#triangletypeboxed) - -record that stores validated String payloads, sealed permits implementation - -### Constructor Summary -| Constructor and Description | -| --------------------------- | -| TriangleTypeBoxedString(String data)
Creates an instance, private visibility | - -### Method Summary -| Modifier and Type | Method and Description | -| ----------------- | ---------------------- | -| String | data()
validated payload | -| @Nullable Object | getData()
validated payload | - -## TriangleType -public static class TriangleType
-extends JsonSchema - -A schema class that validates payloads - -### Code Sample -``` -import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags; -import org.openapijsonschematools.client.configurations.SchemaConfiguration; -import org.openapijsonschematools.client.exceptions.ValidationException; -import org.openapijsonschematools.client.schemas.validation.MapUtils; -import org.openapijsonschematools.client.schemas.validation.FrozenList; -import org.openapijsonschematools.client.schemas.validation.FrozenMap; -import org.openapijsonschematools.client.components.schemas.ScaleneTriangle; - -import java.util.Arrays; -import java.util.List; -import java.util.AbstractMap; - -static final SchemaConfiguration configuration = new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().build()); - -// String validation -String validatedPayload = ScaleneTriangle.TriangleType.validate( - "ScaleneTriangle", - configuration -); -``` - -### Field Summary -| Modifier and Type | Field and Description | -| ----------------- | ---------------------- | -| Set> | type = Set.of(
    String.class
)
| -| Set | enumValues = SetMaker.makeSet(
    "ScaleneTriangle"
)
| - -### Method Summary -| Modifier and Type | Method and Description | -| ----------------- | ---------------------- | -| String | validate(String arg, SchemaConfiguration configuration) | -| String | validate([StringTriangleTypeEnums](#stringtriangletypeenums) arg, SchemaConfiguration configuration) | -| [TriangleTypeBoxedString](#triangletypeboxedstring) | validateAndBox(String arg, SchemaConfiguration configuration) | -| [TriangleTypeBoxed](#triangletypeboxed) | validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) | -| @Nullable Object | validate(@Nullable Object arg, SchemaConfiguration configuration) | - -## StringTriangleTypeEnums -public enum StringTriangleTypeEnums
-extends `Enum` - -A class that stores String enum values - -### Enum Constant Summary -| Enum Constant | Description | -| ------------- | ----------- | -| SCALENE_TRIANGLE | value = "ScaleneTriangle" | - -[[Back to top]](#top) [[Back to Component Schemas]](../../../README.md#Component-Schemas) [[Back to README]](../../../README.md) diff --git a/samples/client/petstore/kotlin/docs/components/schemas/Schema200Response.md b/samples/client/petstore/kotlin/docs/components/schemas/Schema200Response.md deleted file mode 100644 index 8b8860660e9..00000000000 --- a/samples/client/petstore/kotlin/docs/components/schemas/Schema200Response.md +++ /dev/null @@ -1,297 +0,0 @@ -# Schema200Response -org.openapijsonschematools.client.components.schemas.Schema200Response.java -public class Schema200Response
- -A class that contains necessary nested -- schema classes (which validate payloads), extends JsonSchema -- sealed interfaces which store validated payloads, java version of a sum type -- boxed classes which store validated payloads, sealed permits class implementations -- classes to store validated map payloads, extends FrozenMap -- classes to build inputs for map payloads - -## Nested Class Summary -| Modifier and Type | Class and Description | -| ----------------- | ---------------------- | -| sealed interface | [Schema200Response.Schema200Response1Boxed](#schema200response1boxed)
sealed interface for validated payloads | -| record | [Schema200Response.Schema200Response1BoxedVoid](#schema200response1boxedvoid)
boxed class to store validated null payloads | -| record | [Schema200Response.Schema200Response1BoxedBoolean](#schema200response1boxedboolean)
boxed class to store validated boolean payloads | -| record | [Schema200Response.Schema200Response1BoxedNumber](#schema200response1boxednumber)
boxed class to store validated Number payloads | -| record | [Schema200Response.Schema200Response1BoxedString](#schema200response1boxedstring)
boxed class to store validated String payloads | -| record | [Schema200Response.Schema200Response1BoxedList](#schema200response1boxedlist)
boxed class to store validated List payloads | -| record | [Schema200Response.Schema200Response1BoxedMap](#schema200response1boxedmap)
boxed class to store validated Map payloads | -| static class | [Schema200Response.Schema200Response1](#schema200response1)
schema class | -| static class | [Schema200Response.Schema200ResponseMapBuilder](#schema200responsemapbuilder)
builder for Map payloads | -| static class | [Schema200Response.Schema200ResponseMap](#schema200responsemap)
output class for Map payloads | -| sealed interface | [Schema200Response.ClassSchemaBoxed](#classschemaboxed)
sealed interface for validated payloads | -| record | [Schema200Response.ClassSchemaBoxedString](#classschemaboxedstring)
boxed class to store validated String payloads | -| static class | [Schema200Response.ClassSchema](#classschema)
schema class | -| sealed interface | [Schema200Response.NameBoxed](#nameboxed)
sealed interface for validated payloads | -| record | [Schema200Response.NameBoxedNumber](#nameboxednumber)
boxed class to store validated Number payloads | -| static class | [Schema200Response.Name](#name)
schema class | - -## Schema200Response1Boxed -public sealed interface Schema200Response1Boxed
-permits
-[Schema200Response1BoxedVoid](#schema200response1boxedvoid), -[Schema200Response1BoxedBoolean](#schema200response1boxedboolean), -[Schema200Response1BoxedNumber](#schema200response1boxednumber), -[Schema200Response1BoxedString](#schema200response1boxedstring), -[Schema200Response1BoxedList](#schema200response1boxedlist), -[Schema200Response1BoxedMap](#schema200response1boxedmap) - -sealed interface that stores validated payloads using boxed classes - -## Schema200Response1BoxedVoid -public record Schema200Response1BoxedVoid
-implements [Schema200Response1Boxed](#schema200response1boxed) - -record that stores validated null payloads, sealed permits implementation - -### Constructor Summary -| Constructor and Description | -| --------------------------- | -| Schema200Response1BoxedVoid(Nothing? data)
Creates an instance, private visibility | - -### Method Summary -| Modifier and Type | Method and Description | -| ----------------- | ---------------------- | -| Nothing? | data()
validated payload | -| @Nullable Object | getData()
validated payload | - -## Schema200Response1BoxedBoolean -public record Schema200Response1BoxedBoolean
-implements [Schema200Response1Boxed](#schema200response1boxed) - -record that stores validated boolean payloads, sealed permits implementation - -### Constructor Summary -| Constructor and Description | -| --------------------------- | -| Schema200Response1BoxedBoolean(boolean data)
Creates an instance, private visibility | - -### Method Summary -| Modifier and Type | Method and Description | -| ----------------- | ---------------------- | -| boolean | data()
validated payload | -| @Nullable Object | getData()
validated payload | - -## Schema200Response1BoxedNumber -public record Schema200Response1BoxedNumber
-implements [Schema200Response1Boxed](#schema200response1boxed) - -record that stores validated Number payloads, sealed permits implementation - -### Constructor Summary -| Constructor and Description | -| --------------------------- | -| Schema200Response1BoxedNumber(Number data)
Creates an instance, private visibility | - -### Method Summary -| Modifier and Type | Method and Description | -| ----------------- | ---------------------- | -| Number | data()
validated payload | -| @Nullable Object | getData()
validated payload | - -## Schema200Response1BoxedString -public record Schema200Response1BoxedString
-implements [Schema200Response1Boxed](#schema200response1boxed) - -record that stores validated String payloads, sealed permits implementation - -### Constructor Summary -| Constructor and Description | -| --------------------------- | -| Schema200Response1BoxedString(String data)
Creates an instance, private visibility | - -### Method Summary -| Modifier and Type | Method and Description | -| ----------------- | ---------------------- | -| String | data()
validated payload | -| @Nullable Object | getData()
validated payload | - -## Schema200Response1BoxedList -public record Schema200Response1BoxedList
-implements [Schema200Response1Boxed](#schema200response1boxed) - -record that stores validated List payloads, sealed permits implementation - -### Constructor Summary -| Constructor and Description | -| --------------------------- | -| Schema200Response1BoxedList(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 | - -## Schema200Response1BoxedMap -public record Schema200Response1BoxedMap
-implements [Schema200Response1Boxed](#schema200response1boxed) - -record that stores validated Map payloads, sealed permits implementation - -### Constructor Summary -| Constructor and Description | -| --------------------------- | -| Schema200Response1BoxedMap([Schema200ResponseMap](#schema200responsemap) data)
Creates an instance, private visibility | - -### Method Summary -| Modifier and Type | Method and Description | -| ----------------- | ---------------------- | -| [Schema200ResponseMap](#schema200responsemap) | data()
validated payload | -| @Nullable Object | getData()
validated payload | - -## Schema200Response1 -public static class Schema200Response1
-extends JsonSchema - -A schema class that validates payloads - -## Description -model with an invalid class name for python, starts with a number - -### Field Summary -| Modifier and Type | Field and Description | -| ----------------- | ---------------------- | -| Map> | properties = Map.ofEntries(
    new PropertyEntry("name", [Name.class](#name))),
    new PropertyEntry("class", [ClassSchema.class](#classschema)))
)
| - -### Method Summary -| Modifier and Type | Method and Description | -| ----------------- | ---------------------- | -| String | validate(String arg, SchemaConfiguration configuration) | -| Nothing? | validate(Nothing? arg, SchemaConfiguration configuration) | -| int | validate(int arg, SchemaConfiguration configuration) | -| long | validate(long arg, SchemaConfiguration configuration) | -| float | validate(float arg, SchemaConfiguration configuration) | -| double | validate(double arg, SchemaConfiguration configuration) | -| Number | validate(Number arg, SchemaConfiguration configuration) | -| boolean | validate(boolean arg, SchemaConfiguration configuration) | -| [Schema200ResponseMap](#schema200responsemap) | validate([Map<?, ?>](#schema200responsemapbuilder) arg, SchemaConfiguration configuration) | -| FrozenList<@Nullable Object> | validate(List arg, SchemaConfiguration configuration) | -| [Schema200Response1BoxedString](#schema200response1boxedstring) | validateAndBox(String arg, SchemaConfiguration configuration) | -| [Schema200Response1BoxedVoid](#schema200response1boxedvoid) | validateAndBox(Nothing? arg, SchemaConfiguration configuration) | -| [Schema200Response1BoxedNumber](#schema200response1boxednumber) | validateAndBox(Number arg, SchemaConfiguration configuration) | -| [Schema200Response1BoxedBoolean](#schema200response1boxedboolean) | validateAndBox(boolean arg, SchemaConfiguration configuration) | -| [Schema200Response1BoxedMap](#schema200response1boxedmap) | validateAndBox([Map<?, ?>](#schema200responsemapbuilder) arg, SchemaConfiguration configuration) | -| [Schema200Response1BoxedList](#schema200response1boxedlist) | validateAndBox(List arg, SchemaConfiguration configuration) | -| [Schema200Response1Boxed](#schema200response1boxed) | validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) | -| @Nullable Object | validate(@Nullable Object arg, SchemaConfiguration configuration) | - -## Schema200ResponseMapBuilder -public class Schema200ResponseMapBuilder
-builder for `Map` - -A class that builds the Map input type - -### Constructor Summary -| Constructor and Description | -| --------------------------- | -| Schema200ResponseMapBuilder()
Creates a builder that contains an empty map | - -### Method Summary -| Modifier and Type | Method and Description | -| ----------------- | ---------------------- | -| Map | build()
Returns map input that should be used with Schema.validate | -| [Schema200ResponseMapBuilder](#schema200responsemapbuilder) | name(int value) | -| [Schema200ResponseMapBuilder](#schema200responsemapbuilder) | name(float value) | -| [Schema200ResponseMapBuilder](#schema200responsemapbuilder) | setClass(String value) | -| [Schema200ResponseMapBuilder](#schema200responsemapbuilder) | additionalProperty(String key, Nothing? value) | -| [Schema200ResponseMapBuilder](#schema200responsemapbuilder) | additionalProperty(String key, boolean value) | -| [Schema200ResponseMapBuilder](#schema200responsemapbuilder) | additionalProperty(String key, String value) | -| [Schema200ResponseMapBuilder](#schema200responsemapbuilder) | additionalProperty(String key, int value) | -| [Schema200ResponseMapBuilder](#schema200responsemapbuilder) | additionalProperty(String key, float value) | -| [Schema200ResponseMapBuilder](#schema200responsemapbuilder) | additionalProperty(String key, long value) | -| [Schema200ResponseMapBuilder](#schema200responsemapbuilder) | additionalProperty(String key, double value) | -| [Schema200ResponseMapBuilder](#schema200responsemapbuilder) | additionalProperty(String key, List value) | -| [Schema200ResponseMapBuilder](#schema200responsemapbuilder) | additionalProperty(String key, Map value) | - -## Schema200ResponseMap -public static class Schema200ResponseMap
-extends FrozenMap - -A class to store validated Map payloads - -### Method Summary -| Modifier and Type | Method and Description | -| ----------------- | ---------------------- | -| static [Schema200ResponseMap](#schema200responsemap) | of([Map](#schema200responsemapbuilder) arg, SchemaConfiguration configuration) | -| Number | name()
[optional] value must be a 32 bit integer | -| @Nullable Object | get(String key)
This schema has invalid Java names so this method must be used when you access instance["class"], | -| @Nullable Object | getAdditionalProperty(String name)
provides type safety for additional properties | - -## ClassSchemaBoxed -public sealed interface ClassSchemaBoxed
-permits
-[ClassSchemaBoxedString](#classschemaboxedstring) - -sealed interface that stores validated payloads using boxed classes - -## ClassSchemaBoxedString -public record ClassSchemaBoxedString
-implements [ClassSchemaBoxed](#classschemaboxed) - -record that stores validated String payloads, sealed permits implementation - -### Constructor Summary -| Constructor and Description | -| --------------------------- | -| ClassSchemaBoxedString(String data)
Creates an instance, private visibility | - -### Method Summary -| Modifier and Type | Method and Description | -| ----------------- | ---------------------- | -| String | data()
validated payload | -| @Nullable Object | getData()
validated payload | - -## ClassSchema -public static class ClassSchema
-extends StringJsonSchema.StringJsonSchema1 - -A schema class that validates payloads - -## Description -this is a reserved python keyword - -| Methods Inherited from class org.openapijsonschematools.client.schemas.StringJsonSchema.StringJsonSchema1 | -| ------------------------------------------------------------------ | -| validate | -| validateAndBox | - -## NameBoxed -public sealed interface NameBoxed
-permits
-[NameBoxedNumber](#nameboxednumber) - -sealed interface that stores validated payloads using boxed classes - -## NameBoxedNumber -public record NameBoxedNumber
-implements [NameBoxed](#nameboxed) - -record that stores validated Number payloads, sealed permits implementation - -### Constructor Summary -| Constructor and Description | -| --------------------------- | -| NameBoxedNumber(Number data)
Creates an instance, private visibility | - -### Method Summary -| Modifier and Type | Method and Description | -| ----------------- | ---------------------- | -| Number | data()
validated payload | -| @Nullable Object | getData()
validated payload | - -## Name -public static class Name
-extends Int32JsonSchema.Int32JsonSchema1 - -A schema class that validates payloads - -| Methods Inherited from class org.openapijsonschematools.client.schemas.Int32JsonSchema.Int32JsonSchema1 | -| ------------------------------------------------------------------ | -| validate | -| validateAndBox | - -[[Back to top]](#top) [[Back to Component Schemas]](../../../README.md#Component-Schemas) [[Back to README]](../../../README.md) diff --git a/samples/client/petstore/kotlin/docs/components/schemas/SelfReferencingArrayModel.md b/samples/client/petstore/kotlin/docs/components/schemas/SelfReferencingArrayModel.md deleted file mode 100644 index ba989c0d031..00000000000 --- a/samples/client/petstore/kotlin/docs/components/schemas/SelfReferencingArrayModel.md +++ /dev/null @@ -1,119 +0,0 @@ -# SelfReferencingArrayModel -org.openapijsonschematools.client.components.schemas.SelfReferencingArrayModel.java -public class SelfReferencingArrayModel
- -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 list payloads, extends FrozenList -- classes to build inputs for list payloads - -## Nested Class Summary -| Modifier and Type | Class and Description | -| ----------------- | ---------------------- | -| sealed interface | [SelfReferencingArrayModel.SelfReferencingArrayModel1Boxed](#selfreferencingarraymodel1boxed)
sealed interface for validated payloads | -| record | [SelfReferencingArrayModel.SelfReferencingArrayModel1BoxedList](#selfreferencingarraymodel1boxedlist)
boxed class to store validated List payloads | -| static class | [SelfReferencingArrayModel.SelfReferencingArrayModel1](#selfreferencingarraymodel1)
schema class | -| static class | [SelfReferencingArrayModel.SelfReferencingArrayModelListBuilder](#selfreferencingarraymodellistbuilder)
builder for List payloads | -| static class | [SelfReferencingArrayModel.SelfReferencingArrayModelList](#selfreferencingarraymodellist)
output class for List payloads | - -## SelfReferencingArrayModel1Boxed -public sealed interface SelfReferencingArrayModel1Boxed
-permits
-[SelfReferencingArrayModel1BoxedList](#selfreferencingarraymodel1boxedlist) - -sealed interface that stores validated payloads using boxed classes - -## SelfReferencingArrayModel1BoxedList -public record SelfReferencingArrayModel1BoxedList
-implements [SelfReferencingArrayModel1Boxed](#selfreferencingarraymodel1boxed) - -record that stores validated List payloads, sealed permits implementation - -### Constructor Summary -| Constructor and Description | -| --------------------------- | -| SelfReferencingArrayModel1BoxedList([SelfReferencingArrayModelList](#selfreferencingarraymodellist) data)
Creates an instance, private visibility | - -### Method Summary -| Modifier and Type | Method and Description | -| ----------------- | ---------------------- | -| [SelfReferencingArrayModelList](#selfreferencingarraymodellist) | data()
validated payload | -| @Nullable Object | getData()
validated payload | - -## SelfReferencingArrayModel1 -public static class SelfReferencingArrayModel1
-extends JsonSchema - -A schema class that validates payloads - -### Code Sample -``` -import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags; -import org.openapijsonschematools.client.configurations.SchemaConfiguration; -import org.openapijsonschematools.client.exceptions.ValidationException; -import org.openapijsonschematools.client.schemas.validation.MapUtils; -import org.openapijsonschematools.client.schemas.validation.FrozenList; -import org.openapijsonschematools.client.schemas.validation.FrozenMap; -import org.openapijsonschematools.client.components.schemas.SelfReferencingArrayModel; - -import java.util.Arrays; -import java.util.List; -import java.util.AbstractMap; - -static final SchemaConfiguration configuration = new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().build()); - -// List validation -SelfReferencingArrayModel.SelfReferencingArrayModelList validatedPayload = - SelfReferencingArrayModel.SelfReferencingArrayModel1.validate( - new SelfReferencingArrayModel.SelfReferencingArrayModelListBuilder() - .build(), - configuration -); -``` - -### Field Summary -| Modifier and Type | Field and Description | -| ----------------- | ---------------------- | -| Set> | type = Set.of(List.class) | -| Class | items = [SelfReferencingArrayModel1.class](#selfreferencingarraymodel1) | - -### Method Summary -| Modifier and Type | Method and Description | -| ----------------- | ---------------------- | -| [SelfReferencingArrayModelList](#selfreferencingarraymodellist) | validate([List](#selfreferencingarraymodellistbuilder) arg, SchemaConfiguration configuration) | -| [SelfReferencingArrayModel1BoxedList](#selfreferencingarraymodel1boxedlist) | validateAndBox([List](#selfreferencingarraymodellistbuilder) arg, SchemaConfiguration configuration) | -| [SelfReferencingArrayModel1Boxed](#selfreferencingarraymodel1boxed) | validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) | -| @Nullable Object | validate(@Nullable Object arg, SchemaConfiguration configuration) | - -## SelfReferencingArrayModelListBuilder -public class SelfReferencingArrayModelListBuilder
-builder for `List>` - -A class that builds the List input type - -### Constructor Summary -| Constructor and Description | -| --------------------------- | -| SelfReferencingArrayModelListBuilder()
Creates an empty list | -| SelfReferencingArrayModelListBuilder(List> items)
Stores the items in a list | - -### Method Summary -| Modifier and Type | Method and Description | -| ----------------- | ---------------------- | -| SelfReferencingArrayModelListBuilder | add(List item) | -| List> | build()
Returns list input that should be used with Schema.validate | - -## SelfReferencingArrayModelList -public class SelfReferencingArrayModelList
-extends `FrozenList` - -A class to store validated List payloads - -### Method Summary -| Modifier and Type | Method and Description | -| ----------------- | ---------------------- | -| static [SelfReferencingArrayModelList](#selfreferencingarraymodellist) | of([List>](#selfreferencingarraymodellistbuilder) arg, SchemaConfiguration configuration) | - -[[Back to top]](#top) [[Back to Component Schemas]](../../../README.md#Component-Schemas) [[Back to README]](../../../README.md) diff --git a/samples/client/petstore/kotlin/docs/components/schemas/SelfReferencingObjectModel.md b/samples/client/petstore/kotlin/docs/components/schemas/SelfReferencingObjectModel.md deleted file mode 100644 index 587d1f6d89c..00000000000 --- a/samples/client/petstore/kotlin/docs/components/schemas/SelfReferencingObjectModel.md +++ /dev/null @@ -1,122 +0,0 @@ -# SelfReferencingObjectModel -org.openapijsonschematools.client.components.schemas.SelfReferencingObjectModel.java -public class SelfReferencingObjectModel
- -A class that contains necessary nested -- schema classes (which validate payloads), extends JsonSchema -- sealed interfaces which store validated payloads, java version of a sum type -- boxed classes which store validated payloads, sealed permits class implementations -- classes to store validated map payloads, extends FrozenMap -- classes to build inputs for map payloads - -## Nested Class Summary -| Modifier and Type | Class and Description | -| ----------------- | ---------------------- | -| sealed interface | [SelfReferencingObjectModel.SelfReferencingObjectModel1Boxed](#selfreferencingobjectmodel1boxed)
sealed interface for validated payloads | -| record | [SelfReferencingObjectModel.SelfReferencingObjectModel1BoxedMap](#selfreferencingobjectmodel1boxedmap)
boxed class to store validated Map payloads | -| static class | [SelfReferencingObjectModel.SelfReferencingObjectModel1](#selfreferencingobjectmodel1)
schema class | -| static class | [SelfReferencingObjectModel.SelfReferencingObjectModelMapBuilder](#selfreferencingobjectmodelmapbuilder)
builder for Map payloads | -| static class | [SelfReferencingObjectModel.SelfReferencingObjectModelMap](#selfreferencingobjectmodelmap)
output class for Map payloads | - -## SelfReferencingObjectModel1Boxed -public sealed interface SelfReferencingObjectModel1Boxed
-permits
-[SelfReferencingObjectModel1BoxedMap](#selfreferencingobjectmodel1boxedmap) - -sealed interface that stores validated payloads using boxed classes - -## SelfReferencingObjectModel1BoxedMap -public record SelfReferencingObjectModel1BoxedMap
-implements [SelfReferencingObjectModel1Boxed](#selfreferencingobjectmodel1boxed) - -record that stores validated Map payloads, sealed permits implementation - -### Constructor Summary -| Constructor and Description | -| --------------------------- | -| SelfReferencingObjectModel1BoxedMap([SelfReferencingObjectModelMap](#selfreferencingobjectmodelmap) data)
Creates an instance, private visibility | - -### Method Summary -| Modifier and Type | Method and Description | -| ----------------- | ---------------------- | -| [SelfReferencingObjectModelMap](#selfreferencingobjectmodelmap) | data()
validated payload | -| @Nullable Object | getData()
validated payload | - -## SelfReferencingObjectModel1 -public static class SelfReferencingObjectModel1
-extends JsonSchema - -A schema class that validates payloads - -### Code Sample -``` -import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags; -import org.openapijsonschematools.client.configurations.SchemaConfiguration; -import org.openapijsonschematools.client.exceptions.ValidationException; -import org.openapijsonschematools.client.schemas.validation.MapUtils; -import org.openapijsonschematools.client.schemas.validation.FrozenList; -import org.openapijsonschematools.client.schemas.validation.FrozenMap; -import org.openapijsonschematools.client.components.schemas.SelfReferencingObjectModel; - -import java.util.Arrays; -import java.util.List; -import java.util.AbstractMap; - -static final SchemaConfiguration configuration = new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().build()); - -// Map validation -SelfReferencingObjectModel.SelfReferencingObjectModelMap validatedPayload = - SelfReferencingObjectModel.SelfReferencingObjectModel1.validate( - new SelfReferencingObjectModel.SelfReferencingObjectModelMapBuilder() - .build(), - configuration -); -``` - -### Field Summary -| Modifier and Type | Field and Description | -| ----------------- | ---------------------- | -| Set> | type = Set.of(Map.class) | -| Map> | properties = Map.ofEntries(
    new PropertyEntry("selfRef", [SelfReferencingObjectModel1.class](#selfreferencingobjectmodel1)))
)
| -| Class | additionalProperties = [SelfReferencingObjectModel1.class](#selfreferencingobjectmodel1) | - -### Method Summary -| Modifier and Type | Method and Description | -| ----------------- | ---------------------- | -| [SelfReferencingObjectModelMap](#selfreferencingobjectmodelmap) | validate([Map<?, ?>](#selfreferencingobjectmodelmapbuilder) arg, SchemaConfiguration configuration) | -| [SelfReferencingObjectModel1BoxedMap](#selfreferencingobjectmodel1boxedmap) | validateAndBox([Map<?, ?>](#selfreferencingobjectmodelmapbuilder) arg, SchemaConfiguration configuration) | -| [SelfReferencingObjectModel1Boxed](#selfreferencingobjectmodel1boxed) | validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) | -| @Nullable Object | validate(@Nullable Object arg, SchemaConfiguration configuration) | - -## SelfReferencingObjectModelMapBuilder -public class SelfReferencingObjectModelMapBuilder
-builder for `Map` - -A class that builds the Map input type - -### Constructor Summary -| Constructor and Description | -| --------------------------- | -| SelfReferencingObjectModelMapBuilder()
Creates a builder that contains an empty map | - -### Method Summary -| Modifier and Type | Method and Description | -| ----------------- | ---------------------- | -| Map | build()
Returns map input that should be used with Schema.validate | -| [SelfReferencingObjectModelMapBuilder](#selfreferencingobjectmodelmapbuilder) | selfRef(Map value) | -| [SelfReferencingObjectModelMapBuilder](#selfreferencingobjectmodelmapbuilder) | additionalProperty(String key, Map value) | - -## SelfReferencingObjectModelMap -public static class SelfReferencingObjectModelMap
-extends FrozenMap - -A class to store validated Map payloads - -### Method Summary -| Modifier and Type | Method and Description | -| ----------------- | ---------------------- | -| static [SelfReferencingObjectModelMap](#selfreferencingobjectmodelmap) | of([Map](#selfreferencingobjectmodelmapbuilder) arg, SchemaConfiguration configuration) | -| [SelfReferencingObjectModelMap](#selfreferencingobjectmodelmap) | selfRef()
[optional] | -| [SelfReferencingObjectModelMap](#selfreferencingobjectmodelmap) | getAdditionalProperty(String name)
provides type safety for additional properties | - -[[Back to top]](#top) [[Back to Component Schemas]](../../../README.md#Component-Schemas) [[Back to README]](../../../README.md) diff --git a/samples/client/petstore/kotlin/docs/components/schemas/Shape.md b/samples/client/petstore/kotlin/docs/components/schemas/Shape.md deleted file mode 100644 index 3ace8e6991f..00000000000 --- a/samples/client/petstore/kotlin/docs/components/schemas/Shape.md +++ /dev/null @@ -1,169 +0,0 @@ -# Shape -org.openapijsonschematools.client.components.schemas.Shape.java -public class Shape
- -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 - -## Nested Class Summary -| Modifier and Type | Class and Description | -| ----------------- | ---------------------- | -| sealed interface | [Shape.Shape1Boxed](#shape1boxed)
sealed interface for validated payloads | -| record | [Shape.Shape1BoxedVoid](#shape1boxedvoid)
boxed class to store validated null payloads | -| record | [Shape.Shape1BoxedBoolean](#shape1boxedboolean)
boxed class to store validated boolean payloads | -| record | [Shape.Shape1BoxedNumber](#shape1boxednumber)
boxed class to store validated Number payloads | -| record | [Shape.Shape1BoxedString](#shape1boxedstring)
boxed class to store validated String payloads | -| record | [Shape.Shape1BoxedList](#shape1boxedlist)
boxed class to store validated List payloads | -| record | [Shape.Shape1BoxedMap](#shape1boxedmap)
boxed class to store validated Map payloads | -| static class | [Shape.Shape1](#shape1)
schema class | - -## Shape1Boxed -public sealed interface Shape1Boxed
-permits
-[Shape1BoxedVoid](#shape1boxedvoid), -[Shape1BoxedBoolean](#shape1boxedboolean), -[Shape1BoxedNumber](#shape1boxednumber), -[Shape1BoxedString](#shape1boxedstring), -[Shape1BoxedList](#shape1boxedlist), -[Shape1BoxedMap](#shape1boxedmap) - -sealed interface that stores validated payloads using boxed classes - -## Shape1BoxedVoid -public record Shape1BoxedVoid
-implements [Shape1Boxed](#shape1boxed) - -record that stores validated null payloads, sealed permits implementation - -### Constructor Summary -| Constructor and Description | -| --------------------------- | -| Shape1BoxedVoid(Nothing? data)
Creates an instance, private visibility | - -### Method Summary -| Modifier and Type | Method and Description | -| ----------------- | ---------------------- | -| Nothing? | data()
validated payload | -| @Nullable Object | getData()
validated payload | - -## Shape1BoxedBoolean -public record Shape1BoxedBoolean
-implements [Shape1Boxed](#shape1boxed) - -record that stores validated boolean payloads, sealed permits implementation - -### Constructor Summary -| Constructor and Description | -| --------------------------- | -| Shape1BoxedBoolean(boolean data)
Creates an instance, private visibility | - -### Method Summary -| Modifier and Type | Method and Description | -| ----------------- | ---------------------- | -| boolean | data()
validated payload | -| @Nullable Object | getData()
validated payload | - -## Shape1BoxedNumber -public record Shape1BoxedNumber
-implements [Shape1Boxed](#shape1boxed) - -record that stores validated Number payloads, sealed permits implementation - -### Constructor Summary -| Constructor and Description | -| --------------------------- | -| Shape1BoxedNumber(Number data)
Creates an instance, private visibility | - -### Method Summary -| Modifier and Type | Method and Description | -| ----------------- | ---------------------- | -| Number | data()
validated payload | -| @Nullable Object | getData()
validated payload | - -## Shape1BoxedString -public record Shape1BoxedString
-implements [Shape1Boxed](#shape1boxed) - -record that stores validated String payloads, sealed permits implementation - -### Constructor Summary -| Constructor and Description | -| --------------------------- | -| Shape1BoxedString(String data)
Creates an instance, private visibility | - -### Method Summary -| Modifier and Type | Method and Description | -| ----------------- | ---------------------- | -| String | data()
validated payload | -| @Nullable Object | getData()
validated payload | - -## Shape1BoxedList -public record Shape1BoxedList
-implements [Shape1Boxed](#shape1boxed) - -record that stores validated List payloads, sealed permits implementation - -### Constructor Summary -| Constructor and Description | -| --------------------------- | -| Shape1BoxedList(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 | - -## Shape1BoxedMap -public record Shape1BoxedMap
-implements [Shape1Boxed](#shape1boxed) - -record that stores validated Map payloads, sealed permits implementation - -### Constructor Summary -| Constructor and Description | -| --------------------------- | -| Shape1BoxedMap(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 | - -## Shape1 -public static class Shape1
-extends JsonSchema - -A schema class that validates payloads - -### Field Summary -| Modifier and Type | Field and Description | -| ----------------- | ---------------------- | -| List> | oneOf = List.of(
    [Triangle.Triangle1.class](../../components/schemas/Triangle.md#triangle1),
    [Quadrilateral.Quadrilateral1.class](../../components/schemas/Quadrilateral.md#quadrilateral1)
))
| - -### Method Summary -| Modifier and Type | Method and Description | -| ----------------- | ---------------------- | -| String | validate(String arg, SchemaConfiguration configuration) | -| Nothing? | validate(Nothing? arg, SchemaConfiguration configuration) | -| int | validate(int arg, SchemaConfiguration configuration) | -| long | validate(long arg, SchemaConfiguration configuration) | -| float | validate(float arg, SchemaConfiguration configuration) | -| double | validate(double arg, SchemaConfiguration configuration) | -| Number | validate(Number arg, SchemaConfiguration configuration) | -| boolean | validate(boolean arg, SchemaConfiguration configuration) | -| FrozenMap<@Nullable Object> | validate(Map<?, ?> arg, SchemaConfiguration configuration) | -| FrozenList<@Nullable Object> | validate(List arg, SchemaConfiguration configuration) | -| [Shape1BoxedString](#shape1boxedstring) | validateAndBox(String arg, SchemaConfiguration configuration) | -| [Shape1BoxedVoid](#shape1boxedvoid) | validateAndBox(Nothing? arg, SchemaConfiguration configuration) | -| [Shape1BoxedNumber](#shape1boxednumber) | validateAndBox(Number arg, SchemaConfiguration configuration) | -| [Shape1BoxedBoolean](#shape1boxedboolean) | validateAndBox(boolean arg, SchemaConfiguration configuration) | -| [Shape1BoxedMap](#shape1boxedmap) | validateAndBox(Map<?, ?> arg, SchemaConfiguration configuration) | -| [Shape1BoxedList](#shape1boxedlist) | validateAndBox(List arg, SchemaConfiguration configuration) | -| [Shape1Boxed](#shape1boxed) | validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) | -| @Nullable Object | validate(@Nullable Object arg, SchemaConfiguration configuration) | - -[[Back to top]](#top) [[Back to Component Schemas]](../../../README.md#Component-Schemas) [[Back to README]](../../../README.md) diff --git a/samples/client/petstore/kotlin/docs/components/schemas/ShapeOrNull.md b/samples/client/petstore/kotlin/docs/components/schemas/ShapeOrNull.md deleted file mode 100644 index 8ef9d1f2f18..00000000000 --- a/samples/client/petstore/kotlin/docs/components/schemas/ShapeOrNull.md +++ /dev/null @@ -1,210 +0,0 @@ -# ShapeOrNull -org.openapijsonschematools.client.components.schemas.ShapeOrNull.java -public class ShapeOrNull
- -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 - -## Nested Class Summary -| Modifier and Type | Class and Description | -| ----------------- | ---------------------- | -| sealed interface | [ShapeOrNull.ShapeOrNull1Boxed](#shapeornull1boxed)
sealed interface for validated payloads | -| record | [ShapeOrNull.ShapeOrNull1BoxedVoid](#shapeornull1boxedvoid)
boxed class to store validated null payloads | -| record | [ShapeOrNull.ShapeOrNull1BoxedBoolean](#shapeornull1boxedboolean)
boxed class to store validated boolean payloads | -| record | [ShapeOrNull.ShapeOrNull1BoxedNumber](#shapeornull1boxednumber)
boxed class to store validated Number payloads | -| record | [ShapeOrNull.ShapeOrNull1BoxedString](#shapeornull1boxedstring)
boxed class to store validated String payloads | -| record | [ShapeOrNull.ShapeOrNull1BoxedList](#shapeornull1boxedlist)
boxed class to store validated List payloads | -| record | [ShapeOrNull.ShapeOrNull1BoxedMap](#shapeornull1boxedmap)
boxed class to store validated Map payloads | -| static class | [ShapeOrNull.ShapeOrNull1](#shapeornull1)
schema class | -| sealed interface | [ShapeOrNull.Schema0Boxed](#schema0boxed)
sealed interface for validated payloads | -| record | [ShapeOrNull.Schema0BoxedVoid](#schema0boxedvoid)
boxed class to store validated null payloads | -| static class | [ShapeOrNull.Schema0](#schema0)
schema class | - -## ShapeOrNull1Boxed -public sealed interface ShapeOrNull1Boxed
-permits
-[ShapeOrNull1BoxedVoid](#shapeornull1boxedvoid), -[ShapeOrNull1BoxedBoolean](#shapeornull1boxedboolean), -[ShapeOrNull1BoxedNumber](#shapeornull1boxednumber), -[ShapeOrNull1BoxedString](#shapeornull1boxedstring), -[ShapeOrNull1BoxedList](#shapeornull1boxedlist), -[ShapeOrNull1BoxedMap](#shapeornull1boxedmap) - -sealed interface that stores validated payloads using boxed classes - -## ShapeOrNull1BoxedVoid -public record ShapeOrNull1BoxedVoid
-implements [ShapeOrNull1Boxed](#shapeornull1boxed) - -record that stores validated null payloads, sealed permits implementation - -### Constructor Summary -| Constructor and Description | -| --------------------------- | -| ShapeOrNull1BoxedVoid(Nothing? data)
Creates an instance, private visibility | - -### Method Summary -| Modifier and Type | Method and Description | -| ----------------- | ---------------------- | -| Nothing? | data()
validated payload | -| @Nullable Object | getData()
validated payload | - -## ShapeOrNull1BoxedBoolean -public record ShapeOrNull1BoxedBoolean
-implements [ShapeOrNull1Boxed](#shapeornull1boxed) - -record that stores validated boolean payloads, sealed permits implementation - -### Constructor Summary -| Constructor and Description | -| --------------------------- | -| ShapeOrNull1BoxedBoolean(boolean data)
Creates an instance, private visibility | - -### Method Summary -| Modifier and Type | Method and Description | -| ----------------- | ---------------------- | -| boolean | data()
validated payload | -| @Nullable Object | getData()
validated payload | - -## ShapeOrNull1BoxedNumber -public record ShapeOrNull1BoxedNumber
-implements [ShapeOrNull1Boxed](#shapeornull1boxed) - -record that stores validated Number payloads, sealed permits implementation - -### Constructor Summary -| Constructor and Description | -| --------------------------- | -| ShapeOrNull1BoxedNumber(Number data)
Creates an instance, private visibility | - -### Method Summary -| Modifier and Type | Method and Description | -| ----------------- | ---------------------- | -| Number | data()
validated payload | -| @Nullable Object | getData()
validated payload | - -## ShapeOrNull1BoxedString -public record ShapeOrNull1BoxedString
-implements [ShapeOrNull1Boxed](#shapeornull1boxed) - -record that stores validated String payloads, sealed permits implementation - -### Constructor Summary -| Constructor and Description | -| --------------------------- | -| ShapeOrNull1BoxedString(String data)
Creates an instance, private visibility | - -### Method Summary -| Modifier and Type | Method and Description | -| ----------------- | ---------------------- | -| String | data()
validated payload | -| @Nullable Object | getData()
validated payload | - -## ShapeOrNull1BoxedList -public record ShapeOrNull1BoxedList
-implements [ShapeOrNull1Boxed](#shapeornull1boxed) - -record that stores validated List payloads, sealed permits implementation - -### Constructor Summary -| Constructor and Description | -| --------------------------- | -| ShapeOrNull1BoxedList(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 | - -## ShapeOrNull1BoxedMap -public record ShapeOrNull1BoxedMap
-implements [ShapeOrNull1Boxed](#shapeornull1boxed) - -record that stores validated Map payloads, sealed permits implementation - -### Constructor Summary -| Constructor and Description | -| --------------------------- | -| ShapeOrNull1BoxedMap(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 | - -## ShapeOrNull1 -public static class ShapeOrNull1
-extends JsonSchema - -A schema class that validates payloads - -## Description -The value may be a shape or the 'null' value. This is introduced in OAS schema >= 3.1. - -### Field Summary -| Modifier and Type | Field and Description | -| ----------------- | ---------------------- | -| List> | oneOf = List.of(
    [Schema0.class](#schema0),
    [Triangle.Triangle1.class](../../components/schemas/Triangle.md#triangle1),
    [Quadrilateral.Quadrilateral1.class](../../components/schemas/Quadrilateral.md#quadrilateral1)
))
| - -### Method Summary -| Modifier and Type | Method and Description | -| ----------------- | ---------------------- | -| String | validate(String arg, SchemaConfiguration configuration) | -| Nothing? | validate(Nothing? arg, SchemaConfiguration configuration) | -| int | validate(int arg, SchemaConfiguration configuration) | -| long | validate(long arg, SchemaConfiguration configuration) | -| float | validate(float arg, SchemaConfiguration configuration) | -| double | validate(double arg, SchemaConfiguration configuration) | -| Number | validate(Number arg, SchemaConfiguration configuration) | -| boolean | validate(boolean arg, SchemaConfiguration configuration) | -| FrozenMap<@Nullable Object> | validate(Map<?, ?> arg, SchemaConfiguration configuration) | -| FrozenList<@Nullable Object> | validate(List arg, SchemaConfiguration configuration) | -| [ShapeOrNull1BoxedString](#shapeornull1boxedstring) | validateAndBox(String arg, SchemaConfiguration configuration) | -| [ShapeOrNull1BoxedVoid](#shapeornull1boxedvoid) | validateAndBox(Nothing? arg, SchemaConfiguration configuration) | -| [ShapeOrNull1BoxedNumber](#shapeornull1boxednumber) | validateAndBox(Number arg, SchemaConfiguration configuration) | -| [ShapeOrNull1BoxedBoolean](#shapeornull1boxedboolean) | validateAndBox(boolean arg, SchemaConfiguration configuration) | -| [ShapeOrNull1BoxedMap](#shapeornull1boxedmap) | validateAndBox(Map<?, ?> arg, SchemaConfiguration configuration) | -| [ShapeOrNull1BoxedList](#shapeornull1boxedlist) | validateAndBox(List arg, SchemaConfiguration configuration) | -| [ShapeOrNull1Boxed](#shapeornull1boxed) | validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) | -| @Nullable Object | validate(@Nullable Object arg, SchemaConfiguration configuration) | - -## Schema0Boxed -public sealed interface Schema0Boxed
-permits
-[Schema0BoxedVoid](#schema0boxedvoid) - -sealed interface that stores validated payloads using boxed classes - -## Schema0BoxedVoid -public record Schema0BoxedVoid
-implements [Schema0Boxed](#schema0boxed) - -record that stores validated null payloads, sealed permits implementation - -### Constructor Summary -| Constructor and Description | -| --------------------------- | -| Schema0BoxedVoid(Nothing? data)
Creates an instance, private visibility | - -### Method Summary -| Modifier and Type | Method and Description | -| ----------------- | ---------------------- | -| Nothing? | data()
validated payload | -| @Nullable Object | getData()
validated payload | - -## Schema0 -public static class Schema0
-extends NullJsonSchema.NullJsonSchema1 - -A schema class that validates payloads - -| Methods Inherited from class org.openapijsonschematools.client.schemas.NullJsonSchema.NullJsonSchema1 | -| ------------------------------------------------------------------ | -| validate | -| validateAndBox | - -[[Back to top]](#top) [[Back to Component Schemas]](../../../README.md#Component-Schemas) [[Back to README]](../../../README.md) diff --git a/samples/client/petstore/kotlin/docs/components/schemas/SimpleQuadrilateral.md b/samples/client/petstore/kotlin/docs/components/schemas/SimpleQuadrilateral.md deleted file mode 100644 index cff62e66032..00000000000 --- a/samples/client/petstore/kotlin/docs/components/schemas/SimpleQuadrilateral.md +++ /dev/null @@ -1,371 +0,0 @@ -# SimpleQuadrilateral -org.openapijsonschematools.client.components.schemas.SimpleQuadrilateral.java -public class SimpleQuadrilateral
- -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 | [SimpleQuadrilateral.SimpleQuadrilateral1Boxed](#simplequadrilateral1boxed)
sealed interface for validated payloads | -| record | [SimpleQuadrilateral.SimpleQuadrilateral1BoxedVoid](#simplequadrilateral1boxedvoid)
boxed class to store validated null payloads | -| record | [SimpleQuadrilateral.SimpleQuadrilateral1BoxedBoolean](#simplequadrilateral1boxedboolean)
boxed class to store validated boolean payloads | -| record | [SimpleQuadrilateral.SimpleQuadrilateral1BoxedNumber](#simplequadrilateral1boxednumber)
boxed class to store validated Number payloads | -| record | [SimpleQuadrilateral.SimpleQuadrilateral1BoxedString](#simplequadrilateral1boxedstring)
boxed class to store validated String payloads | -| record | [SimpleQuadrilateral.SimpleQuadrilateral1BoxedList](#simplequadrilateral1boxedlist)
boxed class to store validated List payloads | -| record | [SimpleQuadrilateral.SimpleQuadrilateral1BoxedMap](#simplequadrilateral1boxedmap)
boxed class to store validated Map payloads | -| static class | [SimpleQuadrilateral.SimpleQuadrilateral1](#simplequadrilateral1)
schema class | -| sealed interface | [SimpleQuadrilateral.Schema1Boxed](#schema1boxed)
sealed interface for validated payloads | -| record | [SimpleQuadrilateral.Schema1BoxedMap](#schema1boxedmap)
boxed class to store validated Map payloads | -| static class | [SimpleQuadrilateral.Schema1](#schema1)
schema class | -| static class | [SimpleQuadrilateral.Schema1MapBuilder](#schema1mapbuilder)
builder for Map payloads | -| static class | [SimpleQuadrilateral.Schema1Map](#schema1map)
output class for Map payloads | -| sealed interface | [SimpleQuadrilateral.QuadrilateralTypeBoxed](#quadrilateraltypeboxed)
sealed interface for validated payloads | -| record | [SimpleQuadrilateral.QuadrilateralTypeBoxedString](#quadrilateraltypeboxedstring)
boxed class to store validated String payloads | -| static class | [SimpleQuadrilateral.QuadrilateralType](#quadrilateraltype)
schema class | -| enum | [SimpleQuadrilateral.StringQuadrilateralTypeEnums](#stringquadrilateraltypeenums)
String enum | - -## SimpleQuadrilateral1Boxed -public sealed interface SimpleQuadrilateral1Boxed
-permits
-[SimpleQuadrilateral1BoxedVoid](#simplequadrilateral1boxedvoid), -[SimpleQuadrilateral1BoxedBoolean](#simplequadrilateral1boxedboolean), -[SimpleQuadrilateral1BoxedNumber](#simplequadrilateral1boxednumber), -[SimpleQuadrilateral1BoxedString](#simplequadrilateral1boxedstring), -[SimpleQuadrilateral1BoxedList](#simplequadrilateral1boxedlist), -[SimpleQuadrilateral1BoxedMap](#simplequadrilateral1boxedmap) - -sealed interface that stores validated payloads using boxed classes - -## SimpleQuadrilateral1BoxedVoid -public record SimpleQuadrilateral1BoxedVoid
-implements [SimpleQuadrilateral1Boxed](#simplequadrilateral1boxed) - -record that stores validated null payloads, sealed permits implementation - -### Constructor Summary -| Constructor and Description | -| --------------------------- | -| SimpleQuadrilateral1BoxedVoid(Nothing? data)
Creates an instance, private visibility | - -### Method Summary -| Modifier and Type | Method and Description | -| ----------------- | ---------------------- | -| Nothing? | data()
validated payload | -| @Nullable Object | getData()
validated payload | - -## SimpleQuadrilateral1BoxedBoolean -public record SimpleQuadrilateral1BoxedBoolean
-implements [SimpleQuadrilateral1Boxed](#simplequadrilateral1boxed) - -record that stores validated boolean payloads, sealed permits implementation - -### Constructor Summary -| Constructor and Description | -| --------------------------- | -| SimpleQuadrilateral1BoxedBoolean(boolean data)
Creates an instance, private visibility | - -### Method Summary -| Modifier and Type | Method and Description | -| ----------------- | ---------------------- | -| boolean | data()
validated payload | -| @Nullable Object | getData()
validated payload | - -## SimpleQuadrilateral1BoxedNumber -public record SimpleQuadrilateral1BoxedNumber
-implements [SimpleQuadrilateral1Boxed](#simplequadrilateral1boxed) - -record that stores validated Number payloads, sealed permits implementation - -### Constructor Summary -| Constructor and Description | -| --------------------------- | -| SimpleQuadrilateral1BoxedNumber(Number data)
Creates an instance, private visibility | - -### Method Summary -| Modifier and Type | Method and Description | -| ----------------- | ---------------------- | -| Number | data()
validated payload | -| @Nullable Object | getData()
validated payload | - -## SimpleQuadrilateral1BoxedString -public record SimpleQuadrilateral1BoxedString
-implements [SimpleQuadrilateral1Boxed](#simplequadrilateral1boxed) - -record that stores validated String payloads, sealed permits implementation - -### Constructor Summary -| Constructor and Description | -| --------------------------- | -| SimpleQuadrilateral1BoxedString(String data)
Creates an instance, private visibility | - -### Method Summary -| Modifier and Type | Method and Description | -| ----------------- | ---------------------- | -| String | data()
validated payload | -| @Nullable Object | getData()
validated payload | - -## SimpleQuadrilateral1BoxedList -public record SimpleQuadrilateral1BoxedList
-implements [SimpleQuadrilateral1Boxed](#simplequadrilateral1boxed) - -record that stores validated List payloads, sealed permits implementation - -### Constructor Summary -| Constructor and Description | -| --------------------------- | -| SimpleQuadrilateral1BoxedList(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 | - -## SimpleQuadrilateral1BoxedMap -public record SimpleQuadrilateral1BoxedMap
-implements [SimpleQuadrilateral1Boxed](#simplequadrilateral1boxed) - -record that stores validated Map payloads, sealed permits implementation - -### Constructor Summary -| Constructor and Description | -| --------------------------- | -| SimpleQuadrilateral1BoxedMap(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 | - -## SimpleQuadrilateral1 -public static class SimpleQuadrilateral1
-extends JsonSchema - -A schema class that validates payloads - -### Field Summary -| Modifier and Type | Field and Description | -| ----------------- | ---------------------- | -| List> | allOf = List.of(
    [QuadrilateralInterface.QuadrilateralInterface1.class](../../components/schemas/QuadrilateralInterface.md#quadrilateralinterface1),
    [Schema1.class](#schema1)
;)
| - -### Method Summary -| Modifier and Type | Method and Description | -| ----------------- | ---------------------- | -| String | validate(String arg, SchemaConfiguration configuration) | -| Nothing? | validate(Nothing? arg, SchemaConfiguration configuration) | -| int | validate(int arg, SchemaConfiguration configuration) | -| long | validate(long arg, SchemaConfiguration configuration) | -| float | validate(float arg, SchemaConfiguration configuration) | -| double | validate(double arg, SchemaConfiguration configuration) | -| Number | validate(Number arg, SchemaConfiguration configuration) | -| boolean | validate(boolean arg, SchemaConfiguration configuration) | -| FrozenMap<@Nullable Object> | validate(Map<?, ?> arg, SchemaConfiguration configuration) | -| FrozenList<@Nullable Object> | validate(List arg, SchemaConfiguration configuration) | -| [SimpleQuadrilateral1BoxedString](#simplequadrilateral1boxedstring) | validateAndBox(String arg, SchemaConfiguration configuration) | -| [SimpleQuadrilateral1BoxedVoid](#simplequadrilateral1boxedvoid) | validateAndBox(Nothing? arg, SchemaConfiguration configuration) | -| [SimpleQuadrilateral1BoxedNumber](#simplequadrilateral1boxednumber) | validateAndBox(Number arg, SchemaConfiguration configuration) | -| [SimpleQuadrilateral1BoxedBoolean](#simplequadrilateral1boxedboolean) | validateAndBox(boolean arg, SchemaConfiguration configuration) | -| [SimpleQuadrilateral1BoxedMap](#simplequadrilateral1boxedmap) | validateAndBox(Map<?, ?> arg, SchemaConfiguration configuration) | -| [SimpleQuadrilateral1BoxedList](#simplequadrilateral1boxedlist) | validateAndBox(List arg, SchemaConfiguration configuration) | -| [SimpleQuadrilateral1Boxed](#simplequadrilateral1boxed) | validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) | -| @Nullable Object | validate(@Nullable Object arg, SchemaConfiguration configuration) | - -## Schema1Boxed -public sealed interface Schema1Boxed
-permits
-[Schema1BoxedMap](#schema1boxedmap) - -sealed interface that stores validated payloads using boxed classes - -## Schema1BoxedMap -public record Schema1BoxedMap
-implements [Schema1Boxed](#schema1boxed) - -record that stores validated Map payloads, sealed permits implementation - -### Constructor Summary -| Constructor and Description | -| --------------------------- | -| Schema1BoxedMap([Schema1Map](#schema1map) data)
Creates an instance, private visibility | - -### Method Summary -| Modifier and Type | Method and Description | -| ----------------- | ---------------------- | -| [Schema1Map](#schema1map) | data()
validated payload | -| @Nullable Object | getData()
validated payload | - -## Schema1 -public static class Schema1
-extends JsonSchema - -A schema class that validates payloads - -### Code Sample -``` -import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags; -import org.openapijsonschematools.client.configurations.SchemaConfiguration; -import org.openapijsonschematools.client.exceptions.ValidationException; -import org.openapijsonschematools.client.schemas.validation.MapUtils; -import org.openapijsonschematools.client.schemas.validation.FrozenList; -import org.openapijsonschematools.client.schemas.validation.FrozenMap; -import org.openapijsonschematools.client.components.schemas.SimpleQuadrilateral; - -import java.util.Arrays; -import java.util.List; -import java.util.AbstractMap; - -static final SchemaConfiguration configuration = new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().build()); - -// Map validation -SimpleQuadrilateral.Schema1Map validatedPayload = - SimpleQuadrilateral.Schema1.validate( - new SimpleQuadrilateral.Schema1MapBuilder() - .quadrilateralType("SimpleQuadrilateral") - - .build(), - configuration -); -``` - -### Field Summary -| Modifier and Type | Field and Description | -| ----------------- | ---------------------- | -| Set> | type = Set.of(Map.class) | -| Map> | properties = Map.ofEntries(
    new PropertyEntry("quadrilateralType", [QuadrilateralType.class](#quadrilateraltype)))
)
| - -### Method Summary -| Modifier and Type | Method and Description | -| ----------------- | ---------------------- | -| [Schema1Map](#schema1map) | validate([Map<?, ?>](#schema1mapbuilder) arg, SchemaConfiguration configuration) | -| [Schema1BoxedMap](#schema1boxedmap) | validateAndBox([Map<?, ?>](#schema1mapbuilder) arg, SchemaConfiguration configuration) | -| [Schema1Boxed](#schema1boxed) | validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) | -| @Nullable Object | validate(@Nullable Object arg, SchemaConfiguration configuration) | - -## Schema1MapBuilder -public class Schema1MapBuilder
-builder for `Map` - -A class that builds the Map input type - -### Constructor Summary -| Constructor and Description | -| --------------------------- | -| Schema1MapBuilder()
Creates a builder that contains an empty map | - -### Method Summary -| Modifier and Type | Method and Description | -| ----------------- | ---------------------- | -| Map | build()
Returns map input that should be used with Schema.validate | -| [Schema1MapBuilder](#schema1mapbuilder) | quadrilateralType(String value) | -| [Schema1MapBuilder](#schema1mapbuilder) | quadrilateralType([StringQuadrilateralTypeEnums](#stringquadrilateraltypeenums) value) | -| [Schema1MapBuilder](#schema1mapbuilder) | additionalProperty(String key, Nothing? value) | -| [Schema1MapBuilder](#schema1mapbuilder) | additionalProperty(String key, boolean value) | -| [Schema1MapBuilder](#schema1mapbuilder) | additionalProperty(String key, String value) | -| [Schema1MapBuilder](#schema1mapbuilder) | additionalProperty(String key, int value) | -| [Schema1MapBuilder](#schema1mapbuilder) | additionalProperty(String key, float value) | -| [Schema1MapBuilder](#schema1mapbuilder) | additionalProperty(String key, long value) | -| [Schema1MapBuilder](#schema1mapbuilder) | additionalProperty(String key, double value) | -| [Schema1MapBuilder](#schema1mapbuilder) | additionalProperty(String key, List value) | -| [Schema1MapBuilder](#schema1mapbuilder) | additionalProperty(String key, Map value) | - -## Schema1Map -public static class Schema1Map
-extends FrozenMap - -A class to store validated Map payloads - -### Method Summary -| Modifier and Type | Method and Description | -| ----------------- | ---------------------- | -| static [Schema1Map](#schema1map) | of([Map](#schema1mapbuilder) arg, SchemaConfiguration configuration) | -| String | quadrilateralType()
[optional] must be one of ["SimpleQuadrilateral"] | -| @Nullable Object | getAdditionalProperty(String name)
provides type safety for additional properties | - -## QuadrilateralTypeBoxed -public sealed interface QuadrilateralTypeBoxed
-permits
-[QuadrilateralTypeBoxedString](#quadrilateraltypeboxedstring) - -sealed interface that stores validated payloads using boxed classes - -## QuadrilateralTypeBoxedString -public record QuadrilateralTypeBoxedString
-implements [QuadrilateralTypeBoxed](#quadrilateraltypeboxed) - -record that stores validated String payloads, sealed permits implementation - -### Constructor Summary -| Constructor and Description | -| --------------------------- | -| QuadrilateralTypeBoxedString(String data)
Creates an instance, private visibility | - -### Method Summary -| Modifier and Type | Method and Description | -| ----------------- | ---------------------- | -| String | data()
validated payload | -| @Nullable Object | getData()
validated payload | - -## QuadrilateralType -public static class QuadrilateralType
-extends JsonSchema - -A schema class that validates payloads - -### Code Sample -``` -import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags; -import org.openapijsonschematools.client.configurations.SchemaConfiguration; -import org.openapijsonschematools.client.exceptions.ValidationException; -import org.openapijsonschematools.client.schemas.validation.MapUtils; -import org.openapijsonschematools.client.schemas.validation.FrozenList; -import org.openapijsonschematools.client.schemas.validation.FrozenMap; -import org.openapijsonschematools.client.components.schemas.SimpleQuadrilateral; - -import java.util.Arrays; -import java.util.List; -import java.util.AbstractMap; - -static final SchemaConfiguration configuration = new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().build()); - -// String validation -String validatedPayload = SimpleQuadrilateral.QuadrilateralType.validate( - "SimpleQuadrilateral", - configuration -); -``` - -### Field Summary -| Modifier and Type | Field and Description | -| ----------------- | ---------------------- | -| Set> | type = Set.of(
    String.class
)
| -| Set | enumValues = SetMaker.makeSet(
    "SimpleQuadrilateral"
)
| - -### Method Summary -| Modifier and Type | Method and Description | -| ----------------- | ---------------------- | -| String | validate(String arg, SchemaConfiguration configuration) | -| String | validate([StringQuadrilateralTypeEnums](#stringquadrilateraltypeenums) arg, SchemaConfiguration configuration) | -| [QuadrilateralTypeBoxedString](#quadrilateraltypeboxedstring) | validateAndBox(String arg, SchemaConfiguration configuration) | -| [QuadrilateralTypeBoxed](#quadrilateraltypeboxed) | validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) | -| @Nullable Object | validate(@Nullable Object arg, SchemaConfiguration configuration) | - -## StringQuadrilateralTypeEnums -public enum StringQuadrilateralTypeEnums
-extends `Enum` - -A class that stores String enum values - -### Enum Constant Summary -| Enum Constant | Description | -| ------------- | ----------- | -| SIMPLE_QUADRILATERAL | value = "SimpleQuadrilateral" | - -[[Back to top]](#top) [[Back to Component Schemas]](../../../README.md#Component-Schemas) [[Back to README]](../../../README.md) diff --git a/samples/client/petstore/kotlin/docs/components/schemas/SomeObject.md b/samples/client/petstore/kotlin/docs/components/schemas/SomeObject.md deleted file mode 100644 index 5f9a9c8d7fd..00000000000 --- a/samples/client/petstore/kotlin/docs/components/schemas/SomeObject.md +++ /dev/null @@ -1,169 +0,0 @@ -# SomeObject -org.openapijsonschematools.client.components.schemas.SomeObject.java -public class SomeObject
- -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 - -## Nested Class Summary -| Modifier and Type | Class and Description | -| ----------------- | ---------------------- | -| sealed interface | [SomeObject.SomeObject1Boxed](#someobject1boxed)
sealed interface for validated payloads | -| record | [SomeObject.SomeObject1BoxedVoid](#someobject1boxedvoid)
boxed class to store validated null payloads | -| record | [SomeObject.SomeObject1BoxedBoolean](#someobject1boxedboolean)
boxed class to store validated boolean payloads | -| record | [SomeObject.SomeObject1BoxedNumber](#someobject1boxednumber)
boxed class to store validated Number payloads | -| record | [SomeObject.SomeObject1BoxedString](#someobject1boxedstring)
boxed class to store validated String payloads | -| record | [SomeObject.SomeObject1BoxedList](#someobject1boxedlist)
boxed class to store validated List payloads | -| record | [SomeObject.SomeObject1BoxedMap](#someobject1boxedmap)
boxed class to store validated Map payloads | -| static class | [SomeObject.SomeObject1](#someobject1)
schema class | - -## SomeObject1Boxed -public sealed interface SomeObject1Boxed
-permits
-[SomeObject1BoxedVoid](#someobject1boxedvoid), -[SomeObject1BoxedBoolean](#someobject1boxedboolean), -[SomeObject1BoxedNumber](#someobject1boxednumber), -[SomeObject1BoxedString](#someobject1boxedstring), -[SomeObject1BoxedList](#someobject1boxedlist), -[SomeObject1BoxedMap](#someobject1boxedmap) - -sealed interface that stores validated payloads using boxed classes - -## SomeObject1BoxedVoid -public record SomeObject1BoxedVoid
-implements [SomeObject1Boxed](#someobject1boxed) - -record that stores validated null payloads, sealed permits implementation - -### Constructor Summary -| Constructor and Description | -| --------------------------- | -| SomeObject1BoxedVoid(Nothing? data)
Creates an instance, private visibility | - -### Method Summary -| Modifier and Type | Method and Description | -| ----------------- | ---------------------- | -| Nothing? | data()
validated payload | -| @Nullable Object | getData()
validated payload | - -## SomeObject1BoxedBoolean -public record SomeObject1BoxedBoolean
-implements [SomeObject1Boxed](#someobject1boxed) - -record that stores validated boolean payloads, sealed permits implementation - -### Constructor Summary -| Constructor and Description | -| --------------------------- | -| SomeObject1BoxedBoolean(boolean data)
Creates an instance, private visibility | - -### Method Summary -| Modifier and Type | Method and Description | -| ----------------- | ---------------------- | -| boolean | data()
validated payload | -| @Nullable Object | getData()
validated payload | - -## SomeObject1BoxedNumber -public record SomeObject1BoxedNumber
-implements [SomeObject1Boxed](#someobject1boxed) - -record that stores validated Number payloads, sealed permits implementation - -### Constructor Summary -| Constructor and Description | -| --------------------------- | -| SomeObject1BoxedNumber(Number data)
Creates an instance, private visibility | - -### Method Summary -| Modifier and Type | Method and Description | -| ----------------- | ---------------------- | -| Number | data()
validated payload | -| @Nullable Object | getData()
validated payload | - -## SomeObject1BoxedString -public record SomeObject1BoxedString
-implements [SomeObject1Boxed](#someobject1boxed) - -record that stores validated String payloads, sealed permits implementation - -### Constructor Summary -| Constructor and Description | -| --------------------------- | -| SomeObject1BoxedString(String data)
Creates an instance, private visibility | - -### Method Summary -| Modifier and Type | Method and Description | -| ----------------- | ---------------------- | -| String | data()
validated payload | -| @Nullable Object | getData()
validated payload | - -## SomeObject1BoxedList -public record SomeObject1BoxedList
-implements [SomeObject1Boxed](#someobject1boxed) - -record that stores validated List payloads, sealed permits implementation - -### Constructor Summary -| Constructor and Description | -| --------------------------- | -| SomeObject1BoxedList(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 | - -## SomeObject1BoxedMap -public record SomeObject1BoxedMap
-implements [SomeObject1Boxed](#someobject1boxed) - -record that stores validated Map payloads, sealed permits implementation - -### Constructor Summary -| Constructor and Description | -| --------------------------- | -| SomeObject1BoxedMap(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 | - -## SomeObject1 -public static class SomeObject1
-extends JsonSchema - -A schema class that validates payloads - -### Field Summary -| Modifier and Type | Field and Description | -| ----------------- | ---------------------- | -| List> | allOf = List.of(
    [ObjectInterface.ObjectInterface1.class](../../components/schemas/ObjectInterface.md#objectinterface1)
;)
| - -### Method Summary -| Modifier and Type | Method and Description | -| ----------------- | ---------------------- | -| String | validate(String arg, SchemaConfiguration configuration) | -| Nothing? | validate(Nothing? arg, SchemaConfiguration configuration) | -| int | validate(int arg, SchemaConfiguration configuration) | -| long | validate(long arg, SchemaConfiguration configuration) | -| float | validate(float arg, SchemaConfiguration configuration) | -| double | validate(double arg, SchemaConfiguration configuration) | -| Number | validate(Number arg, SchemaConfiguration configuration) | -| boolean | validate(boolean arg, SchemaConfiguration configuration) | -| FrozenMap<@Nullable Object> | validate(Map<?, ?> arg, SchemaConfiguration configuration) | -| FrozenList<@Nullable Object> | validate(List arg, SchemaConfiguration configuration) | -| [SomeObject1BoxedString](#someobject1boxedstring) | validateAndBox(String arg, SchemaConfiguration configuration) | -| [SomeObject1BoxedVoid](#someobject1boxedvoid) | validateAndBox(Nothing? arg, SchemaConfiguration configuration) | -| [SomeObject1BoxedNumber](#someobject1boxednumber) | validateAndBox(Number arg, SchemaConfiguration configuration) | -| [SomeObject1BoxedBoolean](#someobject1boxedboolean) | validateAndBox(boolean arg, SchemaConfiguration configuration) | -| [SomeObject1BoxedMap](#someobject1boxedmap) | validateAndBox(Map<?, ?> arg, SchemaConfiguration configuration) | -| [SomeObject1BoxedList](#someobject1boxedlist) | validateAndBox(List arg, SchemaConfiguration configuration) | -| [SomeObject1Boxed](#someobject1boxed) | validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) | -| @Nullable Object | validate(@Nullable Object arg, SchemaConfiguration configuration) | - -[[Back to top]](#top) [[Back to Component Schemas]](../../../README.md#Component-Schemas) [[Back to README]](../../../README.md) diff --git a/samples/client/petstore/kotlin/docs/components/schemas/SpecialModelname.md b/samples/client/petstore/kotlin/docs/components/schemas/SpecialModelname.md deleted file mode 100644 index f3b31c51a87..00000000000 --- a/samples/client/petstore/kotlin/docs/components/schemas/SpecialModelname.md +++ /dev/null @@ -1,172 +0,0 @@ -# SpecialModelname -org.openapijsonschematools.client.components.schemas.SpecialModelname.java -public class SpecialModelname
- -A class that contains necessary nested -- schema classes (which validate payloads), extends JsonSchema -- sealed interfaces which store validated payloads, java version of a sum type -- boxed classes which store validated payloads, sealed permits class implementations -- classes to store validated map payloads, extends FrozenMap -- classes to build inputs for map payloads - -## Nested Class Summary -| Modifier and Type | Class and Description | -| ----------------- | ---------------------- | -| sealed interface | [SpecialModelname.SpecialModelname1Boxed](#specialmodelname1boxed)
sealed interface for validated payloads | -| record | [SpecialModelname.SpecialModelname1BoxedMap](#specialmodelname1boxedmap)
boxed class to store validated Map payloads | -| static class | [SpecialModelname.SpecialModelname1](#specialmodelname1)
schema class | -| static class | [SpecialModelname.SpecialModelnameMapBuilder](#specialmodelnamemapbuilder)
builder for Map payloads | -| static class | [SpecialModelname.SpecialModelnameMap](#specialmodelnamemap)
output class for Map payloads | -| sealed interface | [SpecialModelname.ABoxed](#aboxed)
sealed interface for validated payloads | -| record | [SpecialModelname.ABoxedString](#aboxedstring)
boxed class to store validated String payloads | -| static class | [SpecialModelname.A](#a)
schema class | - -## SpecialModelname1Boxed -public sealed interface SpecialModelname1Boxed
-permits
-[SpecialModelname1BoxedMap](#specialmodelname1boxedmap) - -sealed interface that stores validated payloads using boxed classes - -## SpecialModelname1BoxedMap -public record SpecialModelname1BoxedMap
-implements [SpecialModelname1Boxed](#specialmodelname1boxed) - -record that stores validated Map payloads, sealed permits implementation - -### Constructor Summary -| Constructor and Description | -| --------------------------- | -| SpecialModelname1BoxedMap([SpecialModelnameMap](#specialmodelnamemap) data)
Creates an instance, private visibility | - -### Method Summary -| Modifier and Type | Method and Description | -| ----------------- | ---------------------- | -| [SpecialModelnameMap](#specialmodelnamemap) | data()
validated payload | -| @Nullable Object | getData()
validated payload | - -## SpecialModelname1 -public static class SpecialModelname1
-extends JsonSchema - -A schema class that validates payloads - -## Description -model with an invalid class name for python - -### Code Sample -``` -import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags; -import org.openapijsonschematools.client.configurations.SchemaConfiguration; -import org.openapijsonschematools.client.exceptions.ValidationException; -import org.openapijsonschematools.client.schemas.validation.MapUtils; -import org.openapijsonschematools.client.schemas.validation.FrozenList; -import org.openapijsonschematools.client.schemas.validation.FrozenMap; -import org.openapijsonschematools.client.components.schemas.SpecialModelname; - -import java.util.Arrays; -import java.util.List; -import java.util.AbstractMap; - -static final SchemaConfiguration configuration = new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().build()); - -// Map validation -SpecialModelname.SpecialModelnameMap validatedPayload = - SpecialModelname.SpecialModelname1.validate( - new SpecialModelname.SpecialModelnameMapBuilder() - .a("a") - - .build(), - configuration -); -``` - -### Field Summary -| Modifier and Type | Field and Description | -| ----------------- | ---------------------- | -| Set> | type = Set.of(Map.class) | -| Map> | properties = Map.ofEntries(
    new PropertyEntry("a", [A.class](#a)))
)
| - -### Method Summary -| Modifier and Type | Method and Description | -| ----------------- | ---------------------- | -| [SpecialModelnameMap](#specialmodelnamemap) | validate([Map<?, ?>](#specialmodelnamemapbuilder) arg, SchemaConfiguration configuration) | -| [SpecialModelname1BoxedMap](#specialmodelname1boxedmap) | validateAndBox([Map<?, ?>](#specialmodelnamemapbuilder) arg, SchemaConfiguration configuration) | -| [SpecialModelname1Boxed](#specialmodelname1boxed) | validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) | -| @Nullable Object | validate(@Nullable Object arg, SchemaConfiguration configuration) | - -## SpecialModelnameMapBuilder -public class SpecialModelnameMapBuilder
-builder for `Map` - -A class that builds the Map input type - -### Constructor Summary -| Constructor and Description | -| --------------------------- | -| SpecialModelnameMapBuilder()
Creates a builder that contains an empty map | - -### Method Summary -| Modifier and Type | Method and Description | -| ----------------- | ---------------------- | -| Map | build()
Returns map input that should be used with Schema.validate | -| [SpecialModelnameMapBuilder](#specialmodelnamemapbuilder) | a(String value) | -| [SpecialModelnameMapBuilder](#specialmodelnamemapbuilder) | additionalProperty(String key, Nothing? value) | -| [SpecialModelnameMapBuilder](#specialmodelnamemapbuilder) | additionalProperty(String key, boolean value) | -| [SpecialModelnameMapBuilder](#specialmodelnamemapbuilder) | additionalProperty(String key, String value) | -| [SpecialModelnameMapBuilder](#specialmodelnamemapbuilder) | additionalProperty(String key, int value) | -| [SpecialModelnameMapBuilder](#specialmodelnamemapbuilder) | additionalProperty(String key, float value) | -| [SpecialModelnameMapBuilder](#specialmodelnamemapbuilder) | additionalProperty(String key, long value) | -| [SpecialModelnameMapBuilder](#specialmodelnamemapbuilder) | additionalProperty(String key, double value) | -| [SpecialModelnameMapBuilder](#specialmodelnamemapbuilder) | additionalProperty(String key, List value) | -| [SpecialModelnameMapBuilder](#specialmodelnamemapbuilder) | additionalProperty(String key, Map value) | - -## SpecialModelnameMap -public static class SpecialModelnameMap
-extends FrozenMap - -A class to store validated Map payloads - -### Method Summary -| Modifier and Type | Method and Description | -| ----------------- | ---------------------- | -| static [SpecialModelnameMap](#specialmodelnamemap) | of([Map](#specialmodelnamemapbuilder) arg, SchemaConfiguration configuration) | -| String | a()
[optional] | -| @Nullable Object | getAdditionalProperty(String name)
provides type safety for additional properties | - -## ABoxed -public sealed interface ABoxed
-permits
-[ABoxedString](#aboxedstring) - -sealed interface that stores validated payloads using boxed classes - -## ABoxedString -public record ABoxedString
-implements [ABoxed](#aboxed) - -record that stores validated String payloads, sealed permits implementation - -### Constructor Summary -| Constructor and Description | -| --------------------------- | -| ABoxedString(String data)
Creates an instance, private visibility | - -### Method Summary -| Modifier and Type | Method and Description | -| ----------------- | ---------------------- | -| String | data()
validated payload | -| @Nullable Object | getData()
validated payload | - -## A -public static class A
-extends StringJsonSchema.StringJsonSchema1 - -A schema class that validates payloads - -| Methods Inherited from class org.openapijsonschematools.client.schemas.StringJsonSchema.StringJsonSchema1 | -| ------------------------------------------------------------------ | -| validate | -| validateAndBox | - -[[Back to top]](#top) [[Back to Component Schemas]](../../../README.md#Component-Schemas) [[Back to README]](../../../README.md) diff --git a/samples/client/petstore/kotlin/docs/components/schemas/StringBooleanMap.md b/samples/client/petstore/kotlin/docs/components/schemas/StringBooleanMap.md deleted file mode 100644 index 1d4ff14b2c6..00000000000 --- a/samples/client/petstore/kotlin/docs/components/schemas/StringBooleanMap.md +++ /dev/null @@ -1,159 +0,0 @@ -# StringBooleanMap -org.openapijsonschematools.client.components.schemas.StringBooleanMap.java -public class StringBooleanMap
- -A class that contains necessary nested -- schema classes (which validate payloads), extends JsonSchema -- sealed interfaces which store validated payloads, java version of a sum type -- boxed classes which store validated payloads, sealed permits class implementations -- classes to store validated map payloads, extends FrozenMap -- classes to build inputs for map payloads - -## Nested Class Summary -| Modifier and Type | Class and Description | -| ----------------- | ---------------------- | -| sealed interface | [StringBooleanMap.StringBooleanMap1Boxed](#stringbooleanmap1boxed)
sealed interface for validated payloads | -| record | [StringBooleanMap.StringBooleanMap1BoxedMap](#stringbooleanmap1boxedmap)
boxed class to store validated Map payloads | -| static class | [StringBooleanMap.StringBooleanMap1](#stringbooleanmap1)
schema class | -| static class | [StringBooleanMap.StringBooleanMapMapBuilder](#stringbooleanmapmapbuilder)
builder for Map payloads | -| static class | [StringBooleanMap.StringBooleanMapMap](#stringbooleanmapmap)
output class for Map payloads | -| sealed interface | [StringBooleanMap.AdditionalPropertiesBoxed](#additionalpropertiesboxed)
sealed interface for validated payloads | -| record | [StringBooleanMap.AdditionalPropertiesBoxedBoolean](#additionalpropertiesboxedboolean)
boxed class to store validated boolean payloads | -| static class | [StringBooleanMap.AdditionalProperties](#additionalproperties)
schema class | - -## StringBooleanMap1Boxed -public sealed interface StringBooleanMap1Boxed
-permits
-[StringBooleanMap1BoxedMap](#stringbooleanmap1boxedmap) - -sealed interface that stores validated payloads using boxed classes - -## StringBooleanMap1BoxedMap -public record StringBooleanMap1BoxedMap
-implements [StringBooleanMap1Boxed](#stringbooleanmap1boxed) - -record that stores validated Map payloads, sealed permits implementation - -### Constructor Summary -| Constructor and Description | -| --------------------------- | -| StringBooleanMap1BoxedMap([StringBooleanMapMap](#stringbooleanmapmap) data)
Creates an instance, private visibility | - -### Method Summary -| Modifier and Type | Method and Description | -| ----------------- | ---------------------- | -| [StringBooleanMapMap](#stringbooleanmapmap) | data()
validated payload | -| @Nullable Object | getData()
validated payload | - -## StringBooleanMap1 -public static class StringBooleanMap1
-extends JsonSchema - -A schema class that validates payloads - -### Code Sample -``` -import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags; -import org.openapijsonschematools.client.configurations.SchemaConfiguration; -import org.openapijsonschematools.client.exceptions.ValidationException; -import org.openapijsonschematools.client.schemas.validation.MapUtils; -import org.openapijsonschematools.client.schemas.validation.FrozenList; -import org.openapijsonschematools.client.schemas.validation.FrozenMap; -import org.openapijsonschematools.client.components.schemas.StringBooleanMap; - -import java.util.Arrays; -import java.util.List; -import java.util.AbstractMap; - -static final SchemaConfiguration configuration = new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().build()); - -// Map validation -StringBooleanMap.StringBooleanMapMap validatedPayload = - StringBooleanMap.StringBooleanMap1.validate( - new StringBooleanMap.StringBooleanMapMapBuilder() - .additionalProperty("someAdditionalProperty", true) - - .build(), - configuration -); -``` - -### Field Summary -| Modifier and Type | Field and Description | -| ----------------- | ---------------------- | -| Set> | type = Set.of(Map.class) | -| Class | additionalProperties = [AdditionalProperties.class](#additionalproperties) | - -### Method Summary -| Modifier and Type | Method and Description | -| ----------------- | ---------------------- | -| [StringBooleanMapMap](#stringbooleanmapmap) | validate([Map<?, ?>](#stringbooleanmapmapbuilder) arg, SchemaConfiguration configuration) | -| [StringBooleanMap1BoxedMap](#stringbooleanmap1boxedmap) | validateAndBox([Map<?, ?>](#stringbooleanmapmapbuilder) arg, SchemaConfiguration configuration) | -| [StringBooleanMap1Boxed](#stringbooleanmap1boxed) | validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) | -| @Nullable Object | validate(@Nullable Object arg, SchemaConfiguration configuration) | - -## StringBooleanMapMapBuilder -public class StringBooleanMapMapBuilder
-builder for `Map` - -A class that builds the Map input type - -### Constructor Summary -| Constructor and Description | -| --------------------------- | -| StringBooleanMapMapBuilder()
Creates a builder that contains an empty map | - -### Method Summary -| Modifier and Type | Method and Description | -| ----------------- | ---------------------- | -| Map | build()
Returns map input that should be used with Schema.validate | -| [StringBooleanMapMapBuilder](#stringbooleanmapmapbuilder) | additionalProperty(String key, boolean value) | - -## StringBooleanMapMap -public static class StringBooleanMapMap
-extends FrozenMap - -A class to store validated Map payloads - -### Method Summary -| Modifier and Type | Method and Description | -| ----------------- | ---------------------- | -| static [StringBooleanMapMap](#stringbooleanmapmap) | of([Map](#stringbooleanmapmapbuilder) arg, SchemaConfiguration configuration) | -| boolean | getAdditionalProperty(String name)
provides type safety for additional properties | - -## AdditionalPropertiesBoxed -public sealed interface AdditionalPropertiesBoxed
-permits
-[AdditionalPropertiesBoxedBoolean](#additionalpropertiesboxedboolean) - -sealed interface that stores validated payloads using boxed classes - -## 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 | - -## AdditionalProperties -public static class AdditionalProperties
-extends BooleanJsonSchema.BooleanJsonSchema1 - -A schema class that validates payloads - -| Methods Inherited from class org.openapijsonschematools.client.schemas.BooleanJsonSchema.BooleanJsonSchema1 | -| ------------------------------------------------------------------ | -| validate | -| validateAndBox | - -[[Back to top]](#top) [[Back to Component Schemas]](../../../README.md#Component-Schemas) [[Back to README]](../../../README.md) diff --git a/samples/client/petstore/kotlin/docs/components/schemas/StringEnum.md b/samples/client/petstore/kotlin/docs/components/schemas/StringEnum.md deleted file mode 100644 index 8a9ae226c59..00000000000 --- a/samples/client/petstore/kotlin/docs/components/schemas/StringEnum.md +++ /dev/null @@ -1,143 +0,0 @@ -# StringEnum -org.openapijsonschematools.client.components.schemas.StringEnum.java -public class StringEnum
- -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 -- enum classes - -## Nested Class Summary -| Modifier and Type | Class and Description | -| ----------------- | ---------------------- | -| sealed interface | [StringEnum.StringEnum1Boxed](#stringenum1boxed)
sealed interface for validated payloads | -| record | [StringEnum.StringEnum1BoxedVoid](#stringenum1boxedvoid)
boxed class to store validated null payloads | -| record | [StringEnum.StringEnum1BoxedString](#stringenum1boxedstring)
boxed class to store validated String payloads | -| static class | [StringEnum.StringEnum1](#stringenum1)
schema class | -| enum | [StringEnum.StringStringEnumEnums](#stringstringenumenums)
String enum | -| enum | [StringEnum.NullStringEnumEnums](#nullstringenumenums)
null enum | - -## StringEnum1Boxed -public sealed interface StringEnum1Boxed
-permits
-[StringEnum1BoxedVoid](#stringenum1boxedvoid), -[StringEnum1BoxedString](#stringenum1boxedstring) - -sealed interface that stores validated payloads using boxed classes - -## StringEnum1BoxedVoid -public record StringEnum1BoxedVoid
-implements [StringEnum1Boxed](#stringenum1boxed) - -record that stores validated null payloads, sealed permits implementation - -### Constructor Summary -| Constructor and Description | -| --------------------------- | -| StringEnum1BoxedVoid(Nothing? data)
Creates an instance, private visibility | - -### Method Summary -| Modifier and Type | Method and Description | -| ----------------- | ---------------------- | -| Nothing? | data()
validated payload | -| @Nullable Object | getData()
validated payload | - -## StringEnum1BoxedString -public record StringEnum1BoxedString
-implements [StringEnum1Boxed](#stringenum1boxed) - -record that stores validated String payloads, sealed permits implementation - -### Constructor Summary -| Constructor and Description | -| --------------------------- | -| StringEnum1BoxedString(String data)
Creates an instance, private visibility | - -### Method Summary -| Modifier and Type | Method and Description | -| ----------------- | ---------------------- | -| String | data()
validated payload | -| @Nullable Object | getData()
validated payload | - -## StringEnum1 -public static class StringEnum1
-extends JsonSchema - -A schema class that validates payloads - -### Code Sample -``` -import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags; -import org.openapijsonschematools.client.configurations.SchemaConfiguration; -import org.openapijsonschematools.client.exceptions.ValidationException; -import org.openapijsonschematools.client.schemas.validation.MapUtils; -import org.openapijsonschematools.client.schemas.validation.FrozenList; -import org.openapijsonschematools.client.schemas.validation.FrozenMap; -import org.openapijsonschematools.client.components.schemas.StringEnum; - -import java.util.Arrays; -import java.util.List; -import java.util.AbstractMap; - -static final SchemaConfiguration configuration = new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().build()); - -// null validation -Nothing? validatedPayload = StringEnum.StringEnum1.validate( - (Nothing?) null, - configuration -); - -// String validation -String validatedPayload = StringEnum.StringEnum1.validate( - "placed", - configuration -); -``` - -### Field Summary -| Modifier and Type | Field and Description | -| ----------------- | ---------------------- | -| Set> | type = Set.of(
    Nothing?.class,
    String.class
)
| -| Set | enumValues = SetMaker.makeSet(
    "placed",
    "approved",
    "delivered",
    "single quoted",
    "multiple\nlines",
    "double quote \n with newline",
    null
)
| - -### Method Summary -| Modifier and Type | Method and Description | -| ----------------- | ---------------------- | -| Nothing? | validate(Nothing? arg, SchemaConfiguration configuration) | -| Nothing? | validate([NullStringEnumEnums](#nullstringenumenums) arg, SchemaConfiguration configuration) | -| [StringEnum1BoxedVoid](#stringenum1boxedvoid) | validateAndBox(Nothing? arg, SchemaConfiguration configuration) | -| String | validate(String arg, SchemaConfiguration configuration) | -| String | validate([StringStringEnumEnums](#stringstringenumenums) arg, SchemaConfiguration configuration) | -| [StringEnum1BoxedString](#stringenum1boxedstring) | validateAndBox(String arg, SchemaConfiguration configuration) | -| [StringEnum1Boxed](#stringenum1boxed) | validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) | -| @Nullable Object | validate(@Nullable Object arg, SchemaConfiguration configuration) | - -## StringStringEnumEnums -public enum StringStringEnumEnums
-extends `Enum` - -A class that stores String enum values - -### Enum Constant Summary -| Enum Constant | Description | -| ------------- | ----------- | -| PLACED | value = "placed" | -| APPROVED | value = "approved" | -| DELIVERED | value = "delivered" | -| SINGLE_QUOTED | value = "single quoted" | -| MULTIPLE_LINE_FEED_LF_LINES | value = "multiple\nlines" | -| DOUBLE_QUOTE_LINE_FEED_LF_WITH_NEWLINE | value = "double quote \n with newline" | - -## NullStringEnumEnums -public enum NullStringEnumEnums
-extends `Enum` - -A class that stores null enum values - -### Enum Constant Summary -| Enum Constant | Description | -| ------------- | ----------- | -| NONE | value = null | - -[[Back to top]](#top) [[Back to Component Schemas]](../../../README.md#Component-Schemas) [[Back to README]](../../../README.md) diff --git a/samples/client/petstore/kotlin/docs/components/schemas/StringEnumWithDefaultValue.md b/samples/client/petstore/kotlin/docs/components/schemas/StringEnumWithDefaultValue.md deleted file mode 100644 index 4f00e792efc..00000000000 --- a/samples/client/petstore/kotlin/docs/components/schemas/StringEnumWithDefaultValue.md +++ /dev/null @@ -1,101 +0,0 @@ -# StringEnumWithDefaultValue -org.openapijsonschematools.client.components.schemas.StringEnumWithDefaultValue.java -public class StringEnumWithDefaultValue
- -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 -- enum classes - -## Nested Class Summary -| Modifier and Type | Class and Description | -| ----------------- | ---------------------- | -| sealed interface | [StringEnumWithDefaultValue.StringEnumWithDefaultValue1Boxed](#stringenumwithdefaultvalue1boxed)
sealed interface for validated payloads | -| record | [StringEnumWithDefaultValue.StringEnumWithDefaultValue1BoxedString](#stringenumwithdefaultvalue1boxedstring)
boxed class to store validated String payloads | -| static class | [StringEnumWithDefaultValue.StringEnumWithDefaultValue1](#stringenumwithdefaultvalue1)
schema class | -| enum | [StringEnumWithDefaultValue.StringStringEnumWithDefaultValueEnums](#stringstringenumwithdefaultvalueenums)
String enum | - -## StringEnumWithDefaultValue1Boxed -public sealed interface StringEnumWithDefaultValue1Boxed
-permits
-[StringEnumWithDefaultValue1BoxedString](#stringenumwithdefaultvalue1boxedstring) - -sealed interface that stores validated payloads using boxed classes - -## StringEnumWithDefaultValue1BoxedString -public record StringEnumWithDefaultValue1BoxedString
-implements [StringEnumWithDefaultValue1Boxed](#stringenumwithdefaultvalue1boxed) - -record that stores validated String payloads, sealed permits implementation - -### Constructor Summary -| Constructor and Description | -| --------------------------- | -| StringEnumWithDefaultValue1BoxedString(String data)
Creates an instance, private visibility | - -### Method Summary -| Modifier and Type | Method and Description | -| ----------------- | ---------------------- | -| String | data()
validated payload | -| @Nullable Object | getData()
validated payload | - -## StringEnumWithDefaultValue1 -public static class StringEnumWithDefaultValue1
-extends JsonSchema - -A schema class that validates payloads - -### Code Sample -``` -import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags; -import org.openapijsonschematools.client.configurations.SchemaConfiguration; -import org.openapijsonschematools.client.exceptions.ValidationException; -import org.openapijsonschematools.client.schemas.validation.MapUtils; -import org.openapijsonschematools.client.schemas.validation.FrozenList; -import org.openapijsonschematools.client.schemas.validation.FrozenMap; -import org.openapijsonschematools.client.components.schemas.StringEnumWithDefaultValue; - -import java.util.Arrays; -import java.util.List; -import java.util.AbstractMap; - -static final SchemaConfiguration configuration = new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().build()); - -// String validation -String validatedPayload = StringEnumWithDefaultValue.StringEnumWithDefaultValue1.validate( - "placed", - configuration -); -``` - -### Field Summary -| Modifier and Type | Field and Description | -| ----------------- | ---------------------- | -| Set> | type = Set.of(
    String.class
)
| -| Set | enumValues = SetMaker.makeSet(
    "placed",
    "approved",
    "delivered"
)
| -| @Nullable Object | defaultValue = "placed" | - -### Method Summary -| Modifier and Type | Method and Description | -| ----------------- | ---------------------- | -| String | validate(String arg, SchemaConfiguration configuration) | -| String | validate([StringStringEnumWithDefaultValueEnums](#stringstringenumwithdefaultvalueenums) arg, SchemaConfiguration configuration) | -| [StringEnumWithDefaultValue1BoxedString](#stringenumwithdefaultvalue1boxedstring) | validateAndBox(String arg, SchemaConfiguration configuration) | -| [StringEnumWithDefaultValue1Boxed](#stringenumwithdefaultvalue1boxed) | validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) | -| @Nullable Object | validate(@Nullable Object arg, SchemaConfiguration configuration) | - -## StringStringEnumWithDefaultValueEnums -public enum StringStringEnumWithDefaultValueEnums
-extends `Enum` - -A class that stores String enum values - -### Enum Constant Summary -| Enum Constant | Description | -| ------------- | ----------- | -| PLACED | value = "placed" | -| APPROVED | value = "approved" | -| DELIVERED | value = "delivered" | - -[[Back to top]](#top) [[Back to Component Schemas]](../../../README.md#Component-Schemas) [[Back to README]](../../../README.md) diff --git a/samples/client/petstore/kotlin/docs/components/schemas/StringSchema.md b/samples/client/petstore/kotlin/docs/components/schemas/StringSchema.md deleted file mode 100644 index 396ff63d7b9..00000000000 --- a/samples/client/petstore/kotlin/docs/components/schemas/StringSchema.md +++ /dev/null @@ -1,52 +0,0 @@ -# StringSchema -org.openapijsonschematools.client.components.schemas.StringSchema.java -public class StringSchema
- -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 - -## Nested Class Summary -| Modifier and Type | Class and Description | -| ----------------- | ---------------------- | -| sealed interface | [StringSchema.StringSchema1Boxed](#stringschema1boxed)
sealed interface for validated payloads | -| record | [StringSchema.StringSchema1BoxedString](#stringschema1boxedstring)
boxed class to store validated String payloads | -| static class | [StringSchema.StringSchema1](#stringschema1)
schema class | - -## StringSchema1Boxed -public sealed interface StringSchema1Boxed
-permits
-[StringSchema1BoxedString](#stringschema1boxedstring) - -sealed interface that stores validated payloads using boxed classes - -## StringSchema1BoxedString -public record StringSchema1BoxedString
-implements [StringSchema1Boxed](#stringschema1boxed) - -record that stores validated String payloads, sealed permits implementation - -### Constructor Summary -| Constructor and Description | -| --------------------------- | -| StringSchema1BoxedString(String data)
Creates an instance, private visibility | - -### Method Summary -| Modifier and Type | Method and Description | -| ----------------- | ---------------------- | -| String | data()
validated payload | -| @Nullable Object | getData()
validated payload | - -## StringSchema1 -public static class StringSchema1
-extends StringJsonSchema.StringJsonSchema1 - -A schema class that validates payloads - -| Methods Inherited from class org.openapijsonschematools.client.schemas.StringJsonSchema.StringJsonSchema1 | -| ------------------------------------------------------------------ | -| validate | -| validateAndBox | - -[[Back to top]](#top) [[Back to Component Schemas]](../../../README.md#Component-Schemas) [[Back to README]](../../../README.md) diff --git a/samples/client/petstore/kotlin/docs/components/schemas/StringWithValidation.md b/samples/client/petstore/kotlin/docs/components/schemas/StringWithValidation.md deleted file mode 100644 index 9fc470d2da0..00000000000 --- a/samples/client/petstore/kotlin/docs/components/schemas/StringWithValidation.md +++ /dev/null @@ -1,84 +0,0 @@ -# StringWithValidation -org.openapijsonschematools.client.components.schemas.StringWithValidation.java -public class StringWithValidation
- -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 - -## Nested Class Summary -| Modifier and Type | Class and Description | -| ----------------- | ---------------------- | -| sealed interface | [StringWithValidation.StringWithValidation1Boxed](#stringwithvalidation1boxed)
sealed interface for validated payloads | -| record | [StringWithValidation.StringWithValidation1BoxedString](#stringwithvalidation1boxedstring)
boxed class to store validated String payloads | -| static class | [StringWithValidation.StringWithValidation1](#stringwithvalidation1)
schema class | - -## StringWithValidation1Boxed -public sealed interface StringWithValidation1Boxed
-permits
-[StringWithValidation1BoxedString](#stringwithvalidation1boxedstring) - -sealed interface that stores validated payloads using boxed classes - -## StringWithValidation1BoxedString -public record StringWithValidation1BoxedString
-implements [StringWithValidation1Boxed](#stringwithvalidation1boxed) - -record that stores validated String payloads, sealed permits implementation - -### Constructor Summary -| Constructor and Description | -| --------------------------- | -| StringWithValidation1BoxedString(String data)
Creates an instance, private visibility | - -### Method Summary -| Modifier and Type | Method and Description | -| ----------------- | ---------------------- | -| String | data()
validated payload | -| @Nullable Object | getData()
validated payload | - -## StringWithValidation1 -public static class StringWithValidation1
-extends JsonSchema - -A schema class that validates payloads - -### Code Sample -``` -import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags; -import org.openapijsonschematools.client.configurations.SchemaConfiguration; -import org.openapijsonschematools.client.exceptions.ValidationException; -import org.openapijsonschematools.client.schemas.validation.MapUtils; -import org.openapijsonschematools.client.schemas.validation.FrozenList; -import org.openapijsonschematools.client.schemas.validation.FrozenMap; -import org.openapijsonschematools.client.components.schemas.StringWithValidation; - -import java.util.Arrays; -import java.util.List; -import java.util.AbstractMap; - -static final SchemaConfiguration configuration = new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().build()); - -// String validation -String validatedPayload = StringWithValidation.StringWithValidation1.validate( - "a", - configuration -); -``` - -### Field Summary -| Modifier and Type | Field and Description | -| ----------------- | ---------------------- | -| Set> | type = Set.of(
    String.class
)
| -| Integer | minLength = 7 | - -### Method Summary -| Modifier and Type | Method and Description | -| ----------------- | ---------------------- | -| String | validate(String arg, SchemaConfiguration configuration) | -| [StringWithValidation1BoxedString](#stringwithvalidation1boxedstring) | validateAndBox(String arg, SchemaConfiguration configuration) | -| [StringWithValidation1Boxed](#stringwithvalidation1boxed) | validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) | -| @Nullable Object | validate(@Nullable Object arg, SchemaConfiguration configuration) | - -[[Back to top]](#top) [[Back to Component Schemas]](../../../README.md#Component-Schemas) [[Back to README]](../../../README.md) diff --git a/samples/client/petstore/kotlin/docs/components/schemas/Tag.md b/samples/client/petstore/kotlin/docs/components/schemas/Tag.md deleted file mode 100644 index b03db519f8a..00000000000 --- a/samples/client/petstore/kotlin/docs/components/schemas/Tag.md +++ /dev/null @@ -1,214 +0,0 @@ -# Tag -org.openapijsonschematools.client.components.schemas.Tag.java -public class Tag
- -A class that contains necessary nested -- schema classes (which validate payloads), extends JsonSchema -- sealed interfaces which store validated payloads, java version of a sum type -- boxed classes which store validated payloads, sealed permits class implementations -- classes to store validated map payloads, extends FrozenMap -- classes to build inputs for map payloads - -## Nested Class Summary -| Modifier and Type | Class and Description | -| ----------------- | ---------------------- | -| sealed interface | [Tag.Tag1Boxed](#tag1boxed)
sealed interface for validated payloads | -| record | [Tag.Tag1BoxedMap](#tag1boxedmap)
boxed class to store validated Map payloads | -| static class | [Tag.Tag1](#tag1)
schema class | -| static class | [Tag.TagMapBuilder](#tagmapbuilder)
builder for Map payloads | -| static class | [Tag.TagMap](#tagmap)
output class for Map payloads | -| sealed interface | [Tag.NameBoxed](#nameboxed)
sealed interface for validated payloads | -| record | [Tag.NameBoxedString](#nameboxedstring)
boxed class to store validated String payloads | -| static class | [Tag.Name](#name)
schema class | -| sealed interface | [Tag.IdBoxed](#idboxed)
sealed interface for validated payloads | -| record | [Tag.IdBoxedNumber](#idboxednumber)
boxed class to store validated Number payloads | -| static class | [Tag.Id](#id)
schema class | - -## Tag1Boxed -public sealed interface Tag1Boxed
-permits
-[Tag1BoxedMap](#tag1boxedmap) - -sealed interface that stores validated payloads using boxed classes - -## Tag1BoxedMap -public record Tag1BoxedMap
-implements [Tag1Boxed](#tag1boxed) - -record that stores validated Map payloads, sealed permits implementation - -### Constructor Summary -| Constructor and Description | -| --------------------------- | -| Tag1BoxedMap([TagMap](#tagmap) data)
Creates an instance, private visibility | - -### Method Summary -| Modifier and Type | Method and Description | -| ----------------- | ---------------------- | -| [TagMap](#tagmap) | data()
validated payload | -| @Nullable Object | getData()
validated payload | - -## Tag1 -public static class Tag1
-extends JsonSchema - -A schema class that validates payloads - -### Code Sample -``` -import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags; -import org.openapijsonschematools.client.configurations.SchemaConfiguration; -import org.openapijsonschematools.client.exceptions.ValidationException; -import org.openapijsonschematools.client.schemas.validation.MapUtils; -import org.openapijsonschematools.client.schemas.validation.FrozenList; -import org.openapijsonschematools.client.schemas.validation.FrozenMap; -import org.openapijsonschematools.client.components.schemas.Tag; - -import java.util.Arrays; -import java.util.List; -import java.util.AbstractMap; - -static final SchemaConfiguration configuration = new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().build()); - -// Map validation -Tag.TagMap validatedPayload = - Tag.Tag1.validate( - new Tag.TagMapBuilder() - .id(1L) - - .name("a") - - .build(), - configuration -); -``` - -### Field Summary -| Modifier and Type | Field and Description | -| ----------------- | ---------------------- | -| Set> | type = Set.of(Map.class) | -| Map> | properties = Map.ofEntries(
    new PropertyEntry("id", [Id.class](#id))),
    new PropertyEntry("name", [Name.class](#name)))
)
| - -### Method Summary -| Modifier and Type | Method and Description | -| ----------------- | ---------------------- | -| [TagMap](#tagmap) | validate([Map<?, ?>](#tagmapbuilder) arg, SchemaConfiguration configuration) | -| [Tag1BoxedMap](#tag1boxedmap) | validateAndBox([Map<?, ?>](#tagmapbuilder) arg, SchemaConfiguration configuration) | -| [Tag1Boxed](#tag1boxed) | validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) | -| @Nullable Object | validate(@Nullable Object arg, SchemaConfiguration configuration) | - -## TagMapBuilder -public class TagMapBuilder
-builder for `Map` - -A class that builds the Map input type - -### Constructor Summary -| Constructor and Description | -| --------------------------- | -| TagMapBuilder()
Creates a builder that contains an empty map | - -### Method Summary -| Modifier and Type | Method and Description | -| ----------------- | ---------------------- | -| Map | build()
Returns map input that should be used with Schema.validate | -| [TagMapBuilder](#tagmapbuilder) | id(int value) | -| [TagMapBuilder](#tagmapbuilder) | id(float value) | -| [TagMapBuilder](#tagmapbuilder) | id(long value) | -| [TagMapBuilder](#tagmapbuilder) | id(double value) | -| [TagMapBuilder](#tagmapbuilder) | name(String value) | -| [TagMapBuilder](#tagmapbuilder) | additionalProperty(String key, Nothing? value) | -| [TagMapBuilder](#tagmapbuilder) | additionalProperty(String key, boolean value) | -| [TagMapBuilder](#tagmapbuilder) | additionalProperty(String key, String value) | -| [TagMapBuilder](#tagmapbuilder) | additionalProperty(String key, int value) | -| [TagMapBuilder](#tagmapbuilder) | additionalProperty(String key, float value) | -| [TagMapBuilder](#tagmapbuilder) | additionalProperty(String key, long value) | -| [TagMapBuilder](#tagmapbuilder) | additionalProperty(String key, double value) | -| [TagMapBuilder](#tagmapbuilder) | additionalProperty(String key, List value) | -| [TagMapBuilder](#tagmapbuilder) | additionalProperty(String key, Map value) | - -## TagMap -public static class TagMap
-extends FrozenMap - -A class to store validated Map payloads - -### Method Summary -| Modifier and Type | Method and Description | -| ----------------- | ---------------------- | -| static [TagMap](#tagmap) | of([Map](#tagmapbuilder) arg, SchemaConfiguration configuration) | -| Number | id()
[optional] value must be a 64 bit integer | -| String | name()
[optional] | -| @Nullable Object | getAdditionalProperty(String name)
provides type safety for additional properties | - -## NameBoxed -public sealed interface NameBoxed
-permits
-[NameBoxedString](#nameboxedstring) - -sealed interface that stores validated payloads using boxed classes - -## NameBoxedString -public record NameBoxedString
-implements [NameBoxed](#nameboxed) - -record that stores validated String payloads, sealed permits implementation - -### Constructor Summary -| Constructor and Description | -| --------------------------- | -| NameBoxedString(String data)
Creates an instance, private visibility | - -### Method Summary -| Modifier and Type | Method and Description | -| ----------------- | ---------------------- | -| String | data()
validated payload | -| @Nullable Object | getData()
validated payload | - -## Name -public static class Name
-extends StringJsonSchema.StringJsonSchema1 - -A schema class that validates payloads - -| Methods Inherited from class org.openapijsonschematools.client.schemas.StringJsonSchema.StringJsonSchema1 | -| ------------------------------------------------------------------ | -| validate | -| validateAndBox | - -## IdBoxed -public sealed interface IdBoxed
-permits
-[IdBoxedNumber](#idboxednumber) - -sealed interface that stores validated payloads using boxed classes - -## IdBoxedNumber -public record IdBoxedNumber
-implements [IdBoxed](#idboxed) - -record that stores validated Number payloads, sealed permits implementation - -### Constructor Summary -| Constructor and Description | -| --------------------------- | -| IdBoxedNumber(Number data)
Creates an instance, private visibility | - -### Method Summary -| Modifier and Type | Method and Description | -| ----------------- | ---------------------- | -| Number | data()
validated payload | -| @Nullable Object | getData()
validated payload | - -## Id -public static class Id
-extends Int64JsonSchema.Int64JsonSchema1 - -A schema class that validates payloads - -| Methods Inherited from class org.openapijsonschematools.client.schemas.Int64JsonSchema.Int64JsonSchema1 | -| ------------------------------------------------------------------ | -| validate | -| validateAndBox | - -[[Back to top]](#top) [[Back to Component Schemas]](../../../README.md#Component-Schemas) [[Back to README]](../../../README.md) diff --git a/samples/client/petstore/kotlin/docs/components/schemas/Triangle.md b/samples/client/petstore/kotlin/docs/components/schemas/Triangle.md deleted file mode 100644 index 64dff16e233..00000000000 --- a/samples/client/petstore/kotlin/docs/components/schemas/Triangle.md +++ /dev/null @@ -1,169 +0,0 @@ -# Triangle -org.openapijsonschematools.client.components.schemas.Triangle.java -public class Triangle
- -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 - -## Nested Class Summary -| Modifier and Type | Class and Description | -| ----------------- | ---------------------- | -| sealed interface | [Triangle.Triangle1Boxed](#triangle1boxed)
sealed interface for validated payloads | -| record | [Triangle.Triangle1BoxedVoid](#triangle1boxedvoid)
boxed class to store validated null payloads | -| record | [Triangle.Triangle1BoxedBoolean](#triangle1boxedboolean)
boxed class to store validated boolean payloads | -| record | [Triangle.Triangle1BoxedNumber](#triangle1boxednumber)
boxed class to store validated Number payloads | -| record | [Triangle.Triangle1BoxedString](#triangle1boxedstring)
boxed class to store validated String payloads | -| record | [Triangle.Triangle1BoxedList](#triangle1boxedlist)
boxed class to store validated List payloads | -| record | [Triangle.Triangle1BoxedMap](#triangle1boxedmap)
boxed class to store validated Map payloads | -| static class | [Triangle.Triangle1](#triangle1)
schema class | - -## Triangle1Boxed -public sealed interface Triangle1Boxed
-permits
-[Triangle1BoxedVoid](#triangle1boxedvoid), -[Triangle1BoxedBoolean](#triangle1boxedboolean), -[Triangle1BoxedNumber](#triangle1boxednumber), -[Triangle1BoxedString](#triangle1boxedstring), -[Triangle1BoxedList](#triangle1boxedlist), -[Triangle1BoxedMap](#triangle1boxedmap) - -sealed interface that stores validated payloads using boxed classes - -## Triangle1BoxedVoid -public record Triangle1BoxedVoid
-implements [Triangle1Boxed](#triangle1boxed) - -record that stores validated null payloads, sealed permits implementation - -### Constructor Summary -| Constructor and Description | -| --------------------------- | -| Triangle1BoxedVoid(Nothing? data)
Creates an instance, private visibility | - -### Method Summary -| Modifier and Type | Method and Description | -| ----------------- | ---------------------- | -| Nothing? | data()
validated payload | -| @Nullable Object | getData()
validated payload | - -## Triangle1BoxedBoolean -public record Triangle1BoxedBoolean
-implements [Triangle1Boxed](#triangle1boxed) - -record that stores validated boolean payloads, sealed permits implementation - -### Constructor Summary -| Constructor and Description | -| --------------------------- | -| Triangle1BoxedBoolean(boolean data)
Creates an instance, private visibility | - -### Method Summary -| Modifier and Type | Method and Description | -| ----------------- | ---------------------- | -| boolean | data()
validated payload | -| @Nullable Object | getData()
validated payload | - -## Triangle1BoxedNumber -public record Triangle1BoxedNumber
-implements [Triangle1Boxed](#triangle1boxed) - -record that stores validated Number payloads, sealed permits implementation - -### Constructor Summary -| Constructor and Description | -| --------------------------- | -| Triangle1BoxedNumber(Number data)
Creates an instance, private visibility | - -### Method Summary -| Modifier and Type | Method and Description | -| ----------------- | ---------------------- | -| Number | data()
validated payload | -| @Nullable Object | getData()
validated payload | - -## Triangle1BoxedString -public record Triangle1BoxedString
-implements [Triangle1Boxed](#triangle1boxed) - -record that stores validated String payloads, sealed permits implementation - -### Constructor Summary -| Constructor and Description | -| --------------------------- | -| Triangle1BoxedString(String data)
Creates an instance, private visibility | - -### Method Summary -| Modifier and Type | Method and Description | -| ----------------- | ---------------------- | -| String | data()
validated payload | -| @Nullable Object | getData()
validated payload | - -## Triangle1BoxedList -public record Triangle1BoxedList
-implements [Triangle1Boxed](#triangle1boxed) - -record that stores validated List payloads, sealed permits implementation - -### Constructor Summary -| Constructor and Description | -| --------------------------- | -| Triangle1BoxedList(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 | - -## Triangle1BoxedMap -public record Triangle1BoxedMap
-implements [Triangle1Boxed](#triangle1boxed) - -record that stores validated Map payloads, sealed permits implementation - -### Constructor Summary -| Constructor and Description | -| --------------------------- | -| Triangle1BoxedMap(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 | - -## Triangle1 -public static class Triangle1
-extends JsonSchema - -A schema class that validates payloads - -### Field Summary -| Modifier and Type | Field and Description | -| ----------------- | ---------------------- | -| List> | oneOf = List.of(
    [EquilateralTriangle.EquilateralTriangle1.class](../../components/schemas/EquilateralTriangle.md#equilateraltriangle1),
    [IsoscelesTriangle.IsoscelesTriangle1.class](../../components/schemas/IsoscelesTriangle.md#isoscelestriangle1),
    [ScaleneTriangle.ScaleneTriangle1.class](../../components/schemas/ScaleneTriangle.md#scalenetriangle1)
))
| - -### Method Summary -| Modifier and Type | Method and Description | -| ----------------- | ---------------------- | -| String | validate(String arg, SchemaConfiguration configuration) | -| Nothing? | validate(Nothing? arg, SchemaConfiguration configuration) | -| int | validate(int arg, SchemaConfiguration configuration) | -| long | validate(long arg, SchemaConfiguration configuration) | -| float | validate(float arg, SchemaConfiguration configuration) | -| double | validate(double arg, SchemaConfiguration configuration) | -| Number | validate(Number arg, SchemaConfiguration configuration) | -| boolean | validate(boolean arg, SchemaConfiguration configuration) | -| FrozenMap<@Nullable Object> | validate(Map<?, ?> arg, SchemaConfiguration configuration) | -| FrozenList<@Nullable Object> | validate(List arg, SchemaConfiguration configuration) | -| [Triangle1BoxedString](#triangle1boxedstring) | validateAndBox(String arg, SchemaConfiguration configuration) | -| [Triangle1BoxedVoid](#triangle1boxedvoid) | validateAndBox(Nothing? arg, SchemaConfiguration configuration) | -| [Triangle1BoxedNumber](#triangle1boxednumber) | validateAndBox(Number arg, SchemaConfiguration configuration) | -| [Triangle1BoxedBoolean](#triangle1boxedboolean) | validateAndBox(boolean arg, SchemaConfiguration configuration) | -| [Triangle1BoxedMap](#triangle1boxedmap) | validateAndBox(Map<?, ?> arg, SchemaConfiguration configuration) | -| [Triangle1BoxedList](#triangle1boxedlist) | validateAndBox(List arg, SchemaConfiguration configuration) | -| [Triangle1Boxed](#triangle1boxed) | validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) | -| @Nullable Object | validate(@Nullable Object arg, SchemaConfiguration configuration) | - -[[Back to top]](#top) [[Back to Component Schemas]](../../../README.md#Component-Schemas) [[Back to README]](../../../README.md) diff --git a/samples/client/petstore/kotlin/docs/components/schemas/TriangleInterface.md b/samples/client/petstore/kotlin/docs/components/schemas/TriangleInterface.md deleted file mode 100644 index 021b25dd7b6..00000000000 --- a/samples/client/petstore/kotlin/docs/components/schemas/TriangleInterface.md +++ /dev/null @@ -1,386 +0,0 @@ -# TriangleInterface -org.openapijsonschematools.client.components.schemas.TriangleInterface.java -public class TriangleInterface
- -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 | [TriangleInterface.TriangleInterface1Boxed](#triangleinterface1boxed)
sealed interface for validated payloads | -| record | [TriangleInterface.TriangleInterface1BoxedVoid](#triangleinterface1boxedvoid)
boxed class to store validated null payloads | -| record | [TriangleInterface.TriangleInterface1BoxedBoolean](#triangleinterface1boxedboolean)
boxed class to store validated boolean payloads | -| record | [TriangleInterface.TriangleInterface1BoxedNumber](#triangleinterface1boxednumber)
boxed class to store validated Number payloads | -| record | [TriangleInterface.TriangleInterface1BoxedString](#triangleinterface1boxedstring)
boxed class to store validated String payloads | -| record | [TriangleInterface.TriangleInterface1BoxedList](#triangleinterface1boxedlist)
boxed class to store validated List payloads | -| record | [TriangleInterface.TriangleInterface1BoxedMap](#triangleinterface1boxedmap)
boxed class to store validated Map payloads | -| static class | [TriangleInterface.TriangleInterface1](#triangleinterface1)
schema class | -| static class | [TriangleInterface.TriangleInterfaceMapBuilder](#triangleinterfacemapbuilder)
builder for Map payloads | -| static class | [TriangleInterface.TriangleInterfaceMap](#triangleinterfacemap)
output class for Map payloads | -| sealed interface | [TriangleInterface.TriangleTypeBoxed](#triangletypeboxed)
sealed interface for validated payloads | -| record | [TriangleInterface.TriangleTypeBoxedString](#triangletypeboxedstring)
boxed class to store validated String payloads | -| static class | [TriangleInterface.TriangleType](#triangletype)
schema class | -| sealed interface | [TriangleInterface.ShapeTypeBoxed](#shapetypeboxed)
sealed interface for validated payloads | -| record | [TriangleInterface.ShapeTypeBoxedString](#shapetypeboxedstring)
boxed class to store validated String payloads | -| static class | [TriangleInterface.ShapeType](#shapetype)
schema class | -| enum | [TriangleInterface.StringShapeTypeEnums](#stringshapetypeenums)
String enum | - -## TriangleInterface1Boxed -public sealed interface TriangleInterface1Boxed
-permits
-[TriangleInterface1BoxedVoid](#triangleinterface1boxedvoid), -[TriangleInterface1BoxedBoolean](#triangleinterface1boxedboolean), -[TriangleInterface1BoxedNumber](#triangleinterface1boxednumber), -[TriangleInterface1BoxedString](#triangleinterface1boxedstring), -[TriangleInterface1BoxedList](#triangleinterface1boxedlist), -[TriangleInterface1BoxedMap](#triangleinterface1boxedmap) - -sealed interface that stores validated payloads using boxed classes - -## TriangleInterface1BoxedVoid -public record TriangleInterface1BoxedVoid
-implements [TriangleInterface1Boxed](#triangleinterface1boxed) - -record that stores validated null payloads, sealed permits implementation - -### Constructor Summary -| Constructor and Description | -| --------------------------- | -| TriangleInterface1BoxedVoid(Nothing? data)
Creates an instance, private visibility | - -### Method Summary -| Modifier and Type | Method and Description | -| ----------------- | ---------------------- | -| Nothing? | data()
validated payload | -| @Nullable Object | getData()
validated payload | - -## TriangleInterface1BoxedBoolean -public record TriangleInterface1BoxedBoolean
-implements [TriangleInterface1Boxed](#triangleinterface1boxed) - -record that stores validated boolean payloads, sealed permits implementation - -### Constructor Summary -| Constructor and Description | -| --------------------------- | -| TriangleInterface1BoxedBoolean(boolean data)
Creates an instance, private visibility | - -### Method Summary -| Modifier and Type | Method and Description | -| ----------------- | ---------------------- | -| boolean | data()
validated payload | -| @Nullable Object | getData()
validated payload | - -## TriangleInterface1BoxedNumber -public record TriangleInterface1BoxedNumber
-implements [TriangleInterface1Boxed](#triangleinterface1boxed) - -record that stores validated Number payloads, sealed permits implementation - -### Constructor Summary -| Constructor and Description | -| --------------------------- | -| TriangleInterface1BoxedNumber(Number data)
Creates an instance, private visibility | - -### Method Summary -| Modifier and Type | Method and Description | -| ----------------- | ---------------------- | -| Number | data()
validated payload | -| @Nullable Object | getData()
validated payload | - -## TriangleInterface1BoxedString -public record TriangleInterface1BoxedString
-implements [TriangleInterface1Boxed](#triangleinterface1boxed) - -record that stores validated String payloads, sealed permits implementation - -### Constructor Summary -| Constructor and Description | -| --------------------------- | -| TriangleInterface1BoxedString(String data)
Creates an instance, private visibility | - -### Method Summary -| Modifier and Type | Method and Description | -| ----------------- | ---------------------- | -| String | data()
validated payload | -| @Nullable Object | getData()
validated payload | - -## TriangleInterface1BoxedList -public record TriangleInterface1BoxedList
-implements [TriangleInterface1Boxed](#triangleinterface1boxed) - -record that stores validated List payloads, sealed permits implementation - -### Constructor Summary -| Constructor and Description | -| --------------------------- | -| TriangleInterface1BoxedList(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 | - -## TriangleInterface1BoxedMap -public record TriangleInterface1BoxedMap
-implements [TriangleInterface1Boxed](#triangleinterface1boxed) - -record that stores validated Map payloads, sealed permits implementation - -### Constructor Summary -| Constructor and Description | -| --------------------------- | -| TriangleInterface1BoxedMap([TriangleInterfaceMap](#triangleinterfacemap) data)
Creates an instance, private visibility | - -### Method Summary -| Modifier and Type | Method and Description | -| ----------------- | ---------------------- | -| [TriangleInterfaceMap](#triangleinterfacemap) | data()
validated payload | -| @Nullable Object | getData()
validated payload | - -## TriangleInterface1 -public static class TriangleInterface1
-extends JsonSchema - -A schema class that validates payloads - -### Field Summary -| Modifier and Type | Field and Description | -| ----------------- | ---------------------- | -| Map> | properties = Map.ofEntries(
    new PropertyEntry("shapeType", [ShapeType.class](#shapetype))),
    new PropertyEntry("triangleType", [TriangleType.class](#triangletype)))
)
| -| Set | required = Set.of(
    "shapeType",
    "triangleType"
)
| - -### Method Summary -| Modifier and Type | Method and Description | -| ----------------- | ---------------------- | -| String | validate(String arg, SchemaConfiguration configuration) | -| Nothing? | validate(Nothing? arg, SchemaConfiguration configuration) | -| int | validate(int arg, SchemaConfiguration configuration) | -| long | validate(long arg, SchemaConfiguration configuration) | -| float | validate(float arg, SchemaConfiguration configuration) | -| double | validate(double arg, SchemaConfiguration configuration) | -| Number | validate(Number arg, SchemaConfiguration configuration) | -| boolean | validate(boolean arg, SchemaConfiguration configuration) | -| [TriangleInterfaceMap](#triangleinterfacemap) | validate([Map<?, ?>](#triangleinterfacemapbuilder) arg, SchemaConfiguration configuration) | -| FrozenList<@Nullable Object> | validate(List arg, SchemaConfiguration configuration) | -| [TriangleInterface1BoxedString](#triangleinterface1boxedstring) | validateAndBox(String arg, SchemaConfiguration configuration) | -| [TriangleInterface1BoxedVoid](#triangleinterface1boxedvoid) | validateAndBox(Nothing? arg, SchemaConfiguration configuration) | -| [TriangleInterface1BoxedNumber](#triangleinterface1boxednumber) | validateAndBox(Number arg, SchemaConfiguration configuration) | -| [TriangleInterface1BoxedBoolean](#triangleinterface1boxedboolean) | validateAndBox(boolean arg, SchemaConfiguration configuration) | -| [TriangleInterface1BoxedMap](#triangleinterface1boxedmap) | validateAndBox([Map<?, ?>](#triangleinterfacemapbuilder) arg, SchemaConfiguration configuration) | -| [TriangleInterface1BoxedList](#triangleinterface1boxedlist) | validateAndBox(List arg, SchemaConfiguration configuration) | -| [TriangleInterface1Boxed](#triangleinterface1boxed) | validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) | -| @Nullable Object | validate(@Nullable Object arg, SchemaConfiguration configuration) | - -## TriangleInterfaceMap00Builder -public class TriangleInterfaceMap00Builder
-builder for `Map` - -A class that builds the Map input type - -### Constructor Summary -| Constructor and Description | -| --------------------------- | -| TriangleInterfaceMap00Builder(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 | -| [TriangleInterfaceMap00Builder](#triangleinterfacemap00builder) | additionalProperty(String key, Nothing? value) | -| [TriangleInterfaceMap00Builder](#triangleinterfacemap00builder) | additionalProperty(String key, boolean value) | -| [TriangleInterfaceMap00Builder](#triangleinterfacemap00builder) | additionalProperty(String key, String value) | -| [TriangleInterfaceMap00Builder](#triangleinterfacemap00builder) | additionalProperty(String key, int value) | -| [TriangleInterfaceMap00Builder](#triangleinterfacemap00builder) | additionalProperty(String key, float value) | -| [TriangleInterfaceMap00Builder](#triangleinterfacemap00builder) | additionalProperty(String key, long value) | -| [TriangleInterfaceMap00Builder](#triangleinterfacemap00builder) | additionalProperty(String key, double value) | -| [TriangleInterfaceMap00Builder](#triangleinterfacemap00builder) | additionalProperty(String key, List value) | -| [TriangleInterfaceMap00Builder](#triangleinterfacemap00builder) | additionalProperty(String key, Map value) | - -## TriangleInterfaceMap01Builder -public class TriangleInterfaceMap01Builder
-builder for `Map` - -A class that builds the Map input type - -### Constructor Summary -| Constructor and Description | -| --------------------------- | -| TriangleInterfaceMap01Builder(Map instance)
Creates a builder that contains the passed instance | - -### Method Summary -| Modifier and Type | Method and Description | -| ----------------- | ---------------------- | -| [TriangleInterfaceMap00Builder](#triangleinterfacemap00builder) | triangleType(String value) | - -## TriangleInterfaceMap10Builder -public class TriangleInterfaceMap10Builder
-builder for `Map` - -A class that builds the Map input type - -### Constructor Summary -| Constructor and Description | -| --------------------------- | -| TriangleInterfaceMap10Builder(Map instance)
Creates a builder that contains the passed instance | - -### Method Summary -| Modifier and Type | Method and Description | -| ----------------- | ---------------------- | -| [TriangleInterfaceMap00Builder](#triangleinterfacemap00builder) | shapeType(String value) | -| [TriangleInterfaceMap00Builder](#triangleinterfacemap00builder) | shapeType([StringShapeTypeEnums](#stringshapetypeenums) value) | - -## TriangleInterfaceMapBuilder -public class TriangleInterfaceMapBuilder
-builder for `Map` - -A class that builds the Map input type - -### Constructor Summary -| Constructor and Description | -| --------------------------- | -| TriangleInterfaceMapBuilder()
Creates a builder that contains an empty map | - -### Method Summary -| Modifier and Type | Method and Description | -| ----------------- | ---------------------- | -| [TriangleInterfaceMap01Builder](#triangleinterfacemap01builder) | shapeType(String value) | -| [TriangleInterfaceMap01Builder](#triangleinterfacemap01builder) | shapeType([StringShapeTypeEnums](#stringshapetypeenums) value) | -| [TriangleInterfaceMap10Builder](#triangleinterfacemap10builder) | triangleType(String value) | - -## TriangleInterfaceMap -public static class TriangleInterfaceMap
-extends FrozenMap - -A class to store validated Map payloads - -### Method Summary -| Modifier and Type | Method and Description | -| ----------------- | ---------------------- | -| static [TriangleInterfaceMap](#triangleinterfacemap) | of([Map](#triangleinterfacemapbuilder) arg, SchemaConfiguration configuration) | -| String | shapeType()
must be one of ["Triangle"] | -| String | triangleType()
| -| @Nullable Object | getAdditionalProperty(String name)
provides type safety for additional properties | - -## TriangleTypeBoxed -public sealed interface TriangleTypeBoxed
-permits
-[TriangleTypeBoxedString](#triangletypeboxedstring) - -sealed interface that stores validated payloads using boxed classes - -## TriangleTypeBoxedString -public record TriangleTypeBoxedString
-implements [TriangleTypeBoxed](#triangletypeboxed) - -record that stores validated String payloads, sealed permits implementation - -### Constructor Summary -| Constructor and Description | -| --------------------------- | -| TriangleTypeBoxedString(String data)
Creates an instance, private visibility | - -### Method Summary -| Modifier and Type | Method and Description | -| ----------------- | ---------------------- | -| String | data()
validated payload | -| @Nullable Object | getData()
validated payload | - -## TriangleType -public static class TriangleType
-extends StringJsonSchema.StringJsonSchema1 - -A schema class that validates payloads - -| Methods Inherited from class org.openapijsonschematools.client.schemas.StringJsonSchema.StringJsonSchema1 | -| ------------------------------------------------------------------ | -| validate | -| validateAndBox | - -## ShapeTypeBoxed -public sealed interface ShapeTypeBoxed
-permits
-[ShapeTypeBoxedString](#shapetypeboxedstring) - -sealed interface that stores validated payloads using boxed classes - -## ShapeTypeBoxedString -public record ShapeTypeBoxedString
-implements [ShapeTypeBoxed](#shapetypeboxed) - -record that stores validated String payloads, sealed permits implementation - -### Constructor Summary -| Constructor and Description | -| --------------------------- | -| ShapeTypeBoxedString(String data)
Creates an instance, private visibility | - -### Method Summary -| Modifier and Type | Method and Description | -| ----------------- | ---------------------- | -| String | data()
validated payload | -| @Nullable Object | getData()
validated payload | - -## ShapeType -public static class ShapeType
-extends JsonSchema - -A schema class that validates payloads - -### Code Sample -``` -import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags; -import org.openapijsonschematools.client.configurations.SchemaConfiguration; -import org.openapijsonschematools.client.exceptions.ValidationException; -import org.openapijsonschematools.client.schemas.validation.MapUtils; -import org.openapijsonschematools.client.schemas.validation.FrozenList; -import org.openapijsonschematools.client.schemas.validation.FrozenMap; -import org.openapijsonschematools.client.components.schemas.TriangleInterface; - -import java.util.Arrays; -import java.util.List; -import java.util.AbstractMap; - -static final SchemaConfiguration configuration = new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().build()); - -// String validation -String validatedPayload = TriangleInterface.ShapeType.validate( - "Triangle", - configuration -); -``` - -### Field Summary -| Modifier and Type | Field and Description | -| ----------------- | ---------------------- | -| Set> | type = Set.of(
    String.class
)
| -| Set | enumValues = SetMaker.makeSet(
    "Triangle"
)
| - -### Method Summary -| Modifier and Type | Method and Description | -| ----------------- | ---------------------- | -| String | validate(String arg, SchemaConfiguration configuration) | -| String | validate([StringShapeTypeEnums](#stringshapetypeenums) arg, SchemaConfiguration configuration) | -| [ShapeTypeBoxedString](#shapetypeboxedstring) | validateAndBox(String arg, SchemaConfiguration configuration) | -| [ShapeTypeBoxed](#shapetypeboxed) | validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) | -| @Nullable Object | validate(@Nullable Object arg, SchemaConfiguration configuration) | - -## StringShapeTypeEnums -public enum StringShapeTypeEnums
-extends `Enum` - -A class that stores String enum values - -### Enum Constant Summary -| Enum Constant | Description | -| ------------- | ----------- | -| TRIANGLE | value = "Triangle" | - -[[Back to top]](#top) [[Back to Component Schemas]](../../../README.md#Component-Schemas) [[Back to README]](../../../README.md) diff --git a/samples/client/petstore/kotlin/docs/components/schemas/UUIDString.md b/samples/client/petstore/kotlin/docs/components/schemas/UUIDString.md deleted file mode 100644 index f6c62c7002f..00000000000 --- a/samples/client/petstore/kotlin/docs/components/schemas/UUIDString.md +++ /dev/null @@ -1,85 +0,0 @@ -# UUIDString -org.openapijsonschematools.client.components.schemas.UUIDString.java -public class UUIDString
- -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 - -## Nested Class Summary -| Modifier and Type | Class and Description | -| ----------------- | ---------------------- | -| sealed interface | [UUIDString.UUIDString1Boxed](#uuidstring1boxed)
sealed interface for validated payloads | -| record | [UUIDString.UUIDString1BoxedString](#uuidstring1boxedstring)
boxed class to store validated String payloads | -| static class | [UUIDString.UUIDString1](#uuidstring1)
schema class | - -## UUIDString1Boxed -public sealed interface UUIDString1Boxed
-permits
-[UUIDString1BoxedString](#uuidstring1boxedstring) - -sealed interface that stores validated payloads using boxed classes - -## UUIDString1BoxedString -public record UUIDString1BoxedString
-implements [UUIDString1Boxed](#uuidstring1boxed) - -record that stores validated String payloads, sealed permits implementation - -### Constructor Summary -| Constructor and Description | -| --------------------------- | -| UUIDString1BoxedString(String data)
Creates an instance, private visibility | - -### Method Summary -| Modifier and Type | Method and Description | -| ----------------- | ---------------------- | -| String | data()
validated payload | -| @Nullable Object | getData()
validated payload | - -## UUIDString1 -public static class UUIDString1
-extends JsonSchema - -A schema class that validates payloads - -### Code Sample -``` -import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags; -import org.openapijsonschematools.client.configurations.SchemaConfiguration; -import org.openapijsonschematools.client.exceptions.ValidationException; -import org.openapijsonschematools.client.schemas.validation.MapUtils; -import org.openapijsonschematools.client.schemas.validation.FrozenList; -import org.openapijsonschematools.client.schemas.validation.FrozenMap; -import org.openapijsonschematools.client.components.schemas.UUIDString; - -import java.util.Arrays; -import java.util.List; -import java.util.AbstractMap; - -static final SchemaConfiguration configuration = new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().build()); - -// String validation -String validatedPayload = UUIDString.UUIDString1.validate( - "046b6c7f-0b8a-43b9-b35d-6489e6daee91", - configuration -); -``` - -### Field Summary -| Modifier and Type | Field and Description | -| ----------------- | ---------------------- | -| Set> | type = Set.of(
    String.class
)
| -| String | type = "uuid"; | -| Integer | minLength = 1 | - -### Method Summary -| Modifier and Type | Method and Description | -| ----------------- | ---------------------- | -| String | validate(String arg, SchemaConfiguration configuration) | -| [UUIDString1BoxedString](#uuidstring1boxedstring) | validateAndBox(String arg, SchemaConfiguration configuration) | -| [UUIDString1Boxed](#uuidstring1boxed) | validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) | -| @Nullable Object | validate(@Nullable Object arg, SchemaConfiguration configuration) | - -[[Back to top]](#top) [[Back to Component Schemas]](../../../README.md#Component-Schemas) [[Back to README]](../../../README.md) diff --git a/samples/client/petstore/kotlin/docs/components/schemas/User.md b/samples/client/petstore/kotlin/docs/components/schemas/User.md deleted file mode 100644 index 190cec7cbc9..00000000000 --- a/samples/client/petstore/kotlin/docs/components/schemas/User.md +++ /dev/null @@ -1,1109 +0,0 @@ -# User -org.openapijsonschematools.client.components.schemas.User.java -public class User
- -A class that contains necessary nested -- schema classes (which validate payloads), extends JsonSchema -- sealed interfaces which store validated payloads, java version of a sum type -- boxed classes which store validated payloads, sealed permits class implementations -- classes to store validated map payloads, extends FrozenMap -- classes to build inputs for map payloads - -## Nested Class Summary -| Modifier and Type | Class and Description | -| ----------------- | ---------------------- | -| sealed interface | [User.User1Boxed](#user1boxed)
sealed interface for validated payloads | -| record | [User.User1BoxedMap](#user1boxedmap)
boxed class to store validated Map payloads | -| static class | [User.User1](#user1)
schema class | -| static class | [User.UserMapBuilder](#usermapbuilder)
builder for Map payloads | -| static class | [User.UserMap](#usermap)
output class for Map payloads | -| sealed interface | [User.AnyTypePropNullableBoxed](#anytypepropnullableboxed)
sealed interface for validated payloads | -| record | [User.AnyTypePropNullableBoxedVoid](#anytypepropnullableboxedvoid)
boxed class to store validated null payloads | -| record | [User.AnyTypePropNullableBoxedBoolean](#anytypepropnullableboxedboolean)
boxed class to store validated boolean payloads | -| record | [User.AnyTypePropNullableBoxedNumber](#anytypepropnullableboxednumber)
boxed class to store validated Number payloads | -| record | [User.AnyTypePropNullableBoxedString](#anytypepropnullableboxedstring)
boxed class to store validated String payloads | -| record | [User.AnyTypePropNullableBoxedList](#anytypepropnullableboxedlist)
boxed class to store validated List payloads | -| record | [User.AnyTypePropNullableBoxedMap](#anytypepropnullableboxedmap)
boxed class to store validated Map payloads | -| static class | [User.AnyTypePropNullable](#anytypepropnullable)
schema class | -| sealed interface | [User.AnyTypeExceptNullPropBoxed](#anytypeexceptnullpropboxed)
sealed interface for validated payloads | -| record | [User.AnyTypeExceptNullPropBoxedVoid](#anytypeexceptnullpropboxedvoid)
boxed class to store validated null payloads | -| record | [User.AnyTypeExceptNullPropBoxedBoolean](#anytypeexceptnullpropboxedboolean)
boxed class to store validated boolean payloads | -| record | [User.AnyTypeExceptNullPropBoxedNumber](#anytypeexceptnullpropboxednumber)
boxed class to store validated Number payloads | -| record | [User.AnyTypeExceptNullPropBoxedString](#anytypeexceptnullpropboxedstring)
boxed class to store validated String payloads | -| record | [User.AnyTypeExceptNullPropBoxedList](#anytypeexceptnullpropboxedlist)
boxed class to store validated List payloads | -| record | [User.AnyTypeExceptNullPropBoxedMap](#anytypeexceptnullpropboxedmap)
boxed class to store validated Map payloads | -| static class | [User.AnyTypeExceptNullProp](#anytypeexceptnullprop)
schema class | -| sealed interface | [User.NotBoxed](#notboxed)
sealed interface for validated payloads | -| record | [User.NotBoxedVoid](#notboxedvoid)
boxed class to store validated null payloads | -| static class | [User.Not](#not)
schema class | -| sealed interface | [User.AnyTypePropBoxed](#anytypepropboxed)
sealed interface for validated payloads | -| record | [User.AnyTypePropBoxedVoid](#anytypepropboxedvoid)
boxed class to store validated null payloads | -| record | [User.AnyTypePropBoxedBoolean](#anytypepropboxedboolean)
boxed class to store validated boolean payloads | -| record | [User.AnyTypePropBoxedNumber](#anytypepropboxednumber)
boxed class to store validated Number payloads | -| record | [User.AnyTypePropBoxedString](#anytypepropboxedstring)
boxed class to store validated String payloads | -| record | [User.AnyTypePropBoxedList](#anytypepropboxedlist)
boxed class to store validated List payloads | -| record | [User.AnyTypePropBoxedMap](#anytypepropboxedmap)
boxed class to store validated Map payloads | -| static class | [User.AnyTypeProp](#anytypeprop)
schema class | -| sealed interface | [User.ObjectWithNoDeclaredPropsNullableBoxed](#objectwithnodeclaredpropsnullableboxed)
sealed interface for validated payloads | -| record | [User.ObjectWithNoDeclaredPropsNullableBoxedVoid](#objectwithnodeclaredpropsnullableboxedvoid)
boxed class to store validated null payloads | -| record | [User.ObjectWithNoDeclaredPropsNullableBoxedMap](#objectwithnodeclaredpropsnullableboxedmap)
boxed class to store validated Map payloads | -| static class | [User.ObjectWithNoDeclaredPropsNullable](#objectwithnodeclaredpropsnullable)
schema class | -| sealed interface | [User.ObjectWithNoDeclaredPropsBoxed](#objectwithnodeclaredpropsboxed)
sealed interface for validated payloads | -| record | [User.ObjectWithNoDeclaredPropsBoxedMap](#objectwithnodeclaredpropsboxedmap)
boxed class to store validated Map payloads | -| static class | [User.ObjectWithNoDeclaredProps](#objectwithnodeclaredprops)
schema class | -| sealed interface | [User.UserStatusBoxed](#userstatusboxed)
sealed interface for validated payloads | -| record | [User.UserStatusBoxedNumber](#userstatusboxednumber)
boxed class to store validated Number payloads | -| static class | [User.UserStatus](#userstatus)
schema class | -| sealed interface | [User.PhoneBoxed](#phoneboxed)
sealed interface for validated payloads | -| record | [User.PhoneBoxedString](#phoneboxedstring)
boxed class to store validated String payloads | -| static class | [User.Phone](#phone)
schema class | -| sealed interface | [User.PasswordBoxed](#passwordboxed)
sealed interface for validated payloads | -| record | [User.PasswordBoxedString](#passwordboxedstring)
boxed class to store validated String payloads | -| static class | [User.Password](#password)
schema class | -| sealed interface | [User.EmailBoxed](#emailboxed)
sealed interface for validated payloads | -| record | [User.EmailBoxedString](#emailboxedstring)
boxed class to store validated String payloads | -| static class | [User.Email](#email)
schema class | -| sealed interface | [User.LastNameBoxed](#lastnameboxed)
sealed interface for validated payloads | -| record | [User.LastNameBoxedString](#lastnameboxedstring)
boxed class to store validated String payloads | -| static class | [User.LastName](#lastname)
schema class | -| sealed interface | [User.FirstNameBoxed](#firstnameboxed)
sealed interface for validated payloads | -| record | [User.FirstNameBoxedString](#firstnameboxedstring)
boxed class to store validated String payloads | -| static class | [User.FirstName](#firstname)
schema class | -| sealed interface | [User.UsernameBoxed](#usernameboxed)
sealed interface for validated payloads | -| record | [User.UsernameBoxedString](#usernameboxedstring)
boxed class to store validated String payloads | -| static class | [User.Username](#username)
schema class | -| sealed interface | [User.IdBoxed](#idboxed)
sealed interface for validated payloads | -| record | [User.IdBoxedNumber](#idboxednumber)
boxed class to store validated Number payloads | -| static class | [User.Id](#id)
schema class | - -## User1Boxed -public sealed interface User1Boxed
-permits
-[User1BoxedMap](#user1boxedmap) - -sealed interface that stores validated payloads using boxed classes - -## User1BoxedMap -public record User1BoxedMap
-implements [User1Boxed](#user1boxed) - -record that stores validated Map payloads, sealed permits implementation - -### Constructor Summary -| Constructor and Description | -| --------------------------- | -| User1BoxedMap([UserMap](#usermap) data)
Creates an instance, private visibility | - -### Method Summary -| Modifier and Type | Method and Description | -| ----------------- | ---------------------- | -| [UserMap](#usermap) | data()
validated payload | -| @Nullable Object | getData()
validated payload | - -## User1 -public static class User1
-extends JsonSchema - -A schema class that validates payloads - -### Code Sample -``` -import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags; -import org.openapijsonschematools.client.configurations.SchemaConfiguration; -import org.openapijsonschematools.client.exceptions.ValidationException; -import org.openapijsonschematools.client.schemas.validation.MapUtils; -import org.openapijsonschematools.client.schemas.validation.FrozenList; -import org.openapijsonschematools.client.schemas.validation.FrozenMap; -import org.openapijsonschematools.client.components.schemas.User; - -import java.util.Arrays; -import java.util.List; -import java.util.AbstractMap; - -static final SchemaConfiguration configuration = new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().build()); - -// Map validation -User.UserMap validatedPayload = - User.User1.validate( - new User.UserMapBuilder() - .id(1L) - - .username("a") - - .firstName("a") - - .lastName("a") - - .email("a") - - .password("a") - - .phone("a") - - .userStatus(1) - - .objectWithNoDeclaredPropsNullable(null) - - .build(), - configuration -); -``` - -### Field Summary -| Modifier and Type | Field and Description | -| ----------------- | ---------------------- | -| Set> | type = Set.of(Map.class) | -| Map> | properties = Map.ofEntries(
    new PropertyEntry("id", [Id.class](#id))),
    new PropertyEntry("username", [Username.class](#username))),
    new PropertyEntry("firstName", [FirstName.class](#firstname))),
    new PropertyEntry("lastName", [LastName.class](#lastname))),
    new PropertyEntry("email", [Email.class](#email))),
    new PropertyEntry("password", [Password.class](#password))),
    new PropertyEntry("phone", [Phone.class](#phone))),
    new PropertyEntry("userStatus", [UserStatus.class](#userstatus))),
    new PropertyEntry("objectWithNoDeclaredProps", [ObjectWithNoDeclaredProps.class](#objectwithnodeclaredprops))),
    new PropertyEntry("objectWithNoDeclaredPropsNullable", [ObjectWithNoDeclaredPropsNullable.class](#objectwithnodeclaredpropsnullable))),
    new PropertyEntry("anyTypeProp", [AnyTypeProp.class](#anytypeprop))),
    new PropertyEntry("anyTypeExceptNullProp", [AnyTypeExceptNullProp.class](#anytypeexceptnullprop))),
    new PropertyEntry("anyTypePropNullable", [AnyTypePropNullable.class](#anytypepropnullable)))
)
| - -### Method Summary -| Modifier and Type | Method and Description | -| ----------------- | ---------------------- | -| [UserMap](#usermap) | validate([Map<?, ?>](#usermapbuilder) arg, SchemaConfiguration configuration) | -| [User1BoxedMap](#user1boxedmap) | validateAndBox([Map<?, ?>](#usermapbuilder) arg, SchemaConfiguration configuration) | -| [User1Boxed](#user1boxed) | validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) | -| @Nullable Object | validate(@Nullable Object arg, SchemaConfiguration configuration) | - -## UserMapBuilder -public class UserMapBuilder
-builder for `Map` - -A class that builds the Map input type - -### Constructor Summary -| Constructor and Description | -| --------------------------- | -| UserMapBuilder()
Creates a builder that contains an empty map | - -### Method Summary -| Modifier and Type | Method and Description | -| ----------------- | ---------------------- | -| Map | build()
Returns map input that should be used with Schema.validate | -| [UserMapBuilder](#usermapbuilder) | id(int value) | -| [UserMapBuilder](#usermapbuilder) | id(float value) | -| [UserMapBuilder](#usermapbuilder) | id(long value) | -| [UserMapBuilder](#usermapbuilder) | id(double value) | -| [UserMapBuilder](#usermapbuilder) | username(String value) | -| [UserMapBuilder](#usermapbuilder) | firstName(String value) | -| [UserMapBuilder](#usermapbuilder) | lastName(String value) | -| [UserMapBuilder](#usermapbuilder) | email(String value) | -| [UserMapBuilder](#usermapbuilder) | password(String value) | -| [UserMapBuilder](#usermapbuilder) | phone(String value) | -| [UserMapBuilder](#usermapbuilder) | userStatus(int value) | -| [UserMapBuilder](#usermapbuilder) | userStatus(float value) | -| [UserMapBuilder](#usermapbuilder) | objectWithNoDeclaredProps(Map value) | -| [UserMapBuilder](#usermapbuilder) | objectWithNoDeclaredPropsNullable(Nothing? value) | -| [UserMapBuilder](#usermapbuilder) | objectWithNoDeclaredPropsNullable(Map value) | -| [UserMapBuilder](#usermapbuilder) | anyTypeProp(Nothing? value) | -| [UserMapBuilder](#usermapbuilder) | anyTypeProp(boolean value) | -| [UserMapBuilder](#usermapbuilder) | anyTypeProp(String value) | -| [UserMapBuilder](#usermapbuilder) | anyTypeProp(int value) | -| [UserMapBuilder](#usermapbuilder) | anyTypeProp(float value) | -| [UserMapBuilder](#usermapbuilder) | anyTypeProp(long value) | -| [UserMapBuilder](#usermapbuilder) | anyTypeProp(double value) | -| [UserMapBuilder](#usermapbuilder) | anyTypeProp(List value) | -| [UserMapBuilder](#usermapbuilder) | anyTypeProp(Map value) | -| [UserMapBuilder](#usermapbuilder) | anyTypeExceptNullProp(Nothing? value) | -| [UserMapBuilder](#usermapbuilder) | anyTypeExceptNullProp(boolean value) | -| [UserMapBuilder](#usermapbuilder) | anyTypeExceptNullProp(String value) | -| [UserMapBuilder](#usermapbuilder) | anyTypeExceptNullProp(int value) | -| [UserMapBuilder](#usermapbuilder) | anyTypeExceptNullProp(float value) | -| [UserMapBuilder](#usermapbuilder) | anyTypeExceptNullProp(long value) | -| [UserMapBuilder](#usermapbuilder) | anyTypeExceptNullProp(double value) | -| [UserMapBuilder](#usermapbuilder) | anyTypeExceptNullProp(List value) | -| [UserMapBuilder](#usermapbuilder) | anyTypeExceptNullProp(Map value) | -| [UserMapBuilder](#usermapbuilder) | anyTypePropNullable(Nothing? value) | -| [UserMapBuilder](#usermapbuilder) | anyTypePropNullable(boolean value) | -| [UserMapBuilder](#usermapbuilder) | anyTypePropNullable(String value) | -| [UserMapBuilder](#usermapbuilder) | anyTypePropNullable(int value) | -| [UserMapBuilder](#usermapbuilder) | anyTypePropNullable(float value) | -| [UserMapBuilder](#usermapbuilder) | anyTypePropNullable(long value) | -| [UserMapBuilder](#usermapbuilder) | anyTypePropNullable(double value) | -| [UserMapBuilder](#usermapbuilder) | anyTypePropNullable(List value) | -| [UserMapBuilder](#usermapbuilder) | anyTypePropNullable(Map value) | -| [UserMapBuilder](#usermapbuilder) | additionalProperty(String key, Nothing? value) | -| [UserMapBuilder](#usermapbuilder) | additionalProperty(String key, boolean value) | -| [UserMapBuilder](#usermapbuilder) | additionalProperty(String key, String value) | -| [UserMapBuilder](#usermapbuilder) | additionalProperty(String key, int value) | -| [UserMapBuilder](#usermapbuilder) | additionalProperty(String key, float value) | -| [UserMapBuilder](#usermapbuilder) | additionalProperty(String key, long value) | -| [UserMapBuilder](#usermapbuilder) | additionalProperty(String key, double value) | -| [UserMapBuilder](#usermapbuilder) | additionalProperty(String key, List value) | -| [UserMapBuilder](#usermapbuilder) | additionalProperty(String key, Map value) | - -## UserMap -public static class UserMap
-extends FrozenMap - -A class to store validated Map payloads - -### Method Summary -| Modifier and Type | Method and Description | -| ----------------- | ---------------------- | -| static [UserMap](#usermap) | of([Map](#usermapbuilder) arg, SchemaConfiguration configuration) | -| Number | id()
[optional] value must be a 64 bit integer | -| String | username()
[optional] | -| String | firstName()
[optional] | -| String | lastName()
[optional] | -| String | email()
[optional] | -| String | password()
[optional] | -| String | phone()
[optional] | -| Number | userStatus()
[optional] value must be a 32 bit integer | -| FrozenMap | objectWithNoDeclaredProps()
[optional] | -| @Nullable FrozenMap | objectWithNoDeclaredPropsNullable()
[optional] | -| @Nullable Object | anyTypeProp()
[optional] | -| @Nullable Object | anyTypeExceptNullProp()
[optional] | -| @Nullable Object | anyTypePropNullable()
[optional] | -| @Nullable Object | getAdditionalProperty(String name)
provides type safety for additional properties | - -## AnyTypePropNullableBoxed -public sealed interface AnyTypePropNullableBoxed
-permits
-[AnyTypePropNullableBoxedVoid](#anytypepropnullableboxedvoid), -[AnyTypePropNullableBoxedBoolean](#anytypepropnullableboxedboolean), -[AnyTypePropNullableBoxedNumber](#anytypepropnullableboxednumber), -[AnyTypePropNullableBoxedString](#anytypepropnullableboxedstring), -[AnyTypePropNullableBoxedList](#anytypepropnullableboxedlist), -[AnyTypePropNullableBoxedMap](#anytypepropnullableboxedmap) - -sealed interface that stores validated payloads using boxed classes - -## AnyTypePropNullableBoxedVoid -public record AnyTypePropNullableBoxedVoid
-implements [AnyTypePropNullableBoxed](#anytypepropnullableboxed) - -record that stores validated null payloads, sealed permits implementation - -### Constructor Summary -| Constructor and Description | -| --------------------------- | -| AnyTypePropNullableBoxedVoid(Nothing? data)
Creates an instance, private visibility | - -### Method Summary -| Modifier and Type | Method and Description | -| ----------------- | ---------------------- | -| Nothing? | data()
validated payload | -| @Nullable Object | getData()
validated payload | - -## AnyTypePropNullableBoxedBoolean -public record AnyTypePropNullableBoxedBoolean
-implements [AnyTypePropNullableBoxed](#anytypepropnullableboxed) - -record that stores validated boolean payloads, sealed permits implementation - -### Constructor Summary -| Constructor and Description | -| --------------------------- | -| AnyTypePropNullableBoxedBoolean(boolean data)
Creates an instance, private visibility | - -### Method Summary -| Modifier and Type | Method and Description | -| ----------------- | ---------------------- | -| boolean | data()
validated payload | -| @Nullable Object | getData()
validated payload | - -## AnyTypePropNullableBoxedNumber -public record AnyTypePropNullableBoxedNumber
-implements [AnyTypePropNullableBoxed](#anytypepropnullableboxed) - -record that stores validated Number payloads, sealed permits implementation - -### Constructor Summary -| Constructor and Description | -| --------------------------- | -| AnyTypePropNullableBoxedNumber(Number data)
Creates an instance, private visibility | - -### Method Summary -| Modifier and Type | Method and Description | -| ----------------- | ---------------------- | -| Number | data()
validated payload | -| @Nullable Object | getData()
validated payload | - -## AnyTypePropNullableBoxedString -public record AnyTypePropNullableBoxedString
-implements [AnyTypePropNullableBoxed](#anytypepropnullableboxed) - -record that stores validated String payloads, sealed permits implementation - -### Constructor Summary -| Constructor and Description | -| --------------------------- | -| AnyTypePropNullableBoxedString(String data)
Creates an instance, private visibility | - -### Method Summary -| Modifier and Type | Method and Description | -| ----------------- | ---------------------- | -| String | data()
validated payload | -| @Nullable Object | getData()
validated payload | - -## AnyTypePropNullableBoxedList -public record AnyTypePropNullableBoxedList
-implements [AnyTypePropNullableBoxed](#anytypepropnullableboxed) - -record that stores validated List payloads, sealed permits implementation - -### Constructor Summary -| Constructor and Description | -| --------------------------- | -| AnyTypePropNullableBoxedList(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 | - -## AnyTypePropNullableBoxedMap -public record AnyTypePropNullableBoxedMap
-implements [AnyTypePropNullableBoxed](#anytypepropnullableboxed) - -record that stores validated Map payloads, sealed permits implementation - -### Constructor Summary -| Constructor and Description | -| --------------------------- | -| AnyTypePropNullableBoxedMap(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 | - -## AnyTypePropNullable -public static class AnyTypePropNullable
-extends AnyTypeJsonSchema.AnyTypeJsonSchema1 - -A schema class that validates payloads - -## Description -test code generation for any type Here the 'type' attribute is not specified, which means the value can be anything, including the null value, string, number, boolean, array or object. The 'nullable' attribute does not change the allowed values. - -| Methods Inherited from class org.openapijsonschematools.client.schemas.AnyTypeJsonSchema.AnyTypeJsonSchema1 | -| ------------------------------------------------------------------ | -| validate | -| validateAndBox | - -## AnyTypeExceptNullPropBoxed -public sealed interface AnyTypeExceptNullPropBoxed
-permits
-[AnyTypeExceptNullPropBoxedVoid](#anytypeexceptnullpropboxedvoid), -[AnyTypeExceptNullPropBoxedBoolean](#anytypeexceptnullpropboxedboolean), -[AnyTypeExceptNullPropBoxedNumber](#anytypeexceptnullpropboxednumber), -[AnyTypeExceptNullPropBoxedString](#anytypeexceptnullpropboxedstring), -[AnyTypeExceptNullPropBoxedList](#anytypeexceptnullpropboxedlist), -[AnyTypeExceptNullPropBoxedMap](#anytypeexceptnullpropboxedmap) - -sealed interface that stores validated payloads using boxed classes - -## AnyTypeExceptNullPropBoxedVoid -public record AnyTypeExceptNullPropBoxedVoid
-implements [AnyTypeExceptNullPropBoxed](#anytypeexceptnullpropboxed) - -record that stores validated null payloads, sealed permits implementation - -### Constructor Summary -| Constructor and Description | -| --------------------------- | -| AnyTypeExceptNullPropBoxedVoid(Nothing? data)
Creates an instance, private visibility | - -### Method Summary -| Modifier and Type | Method and Description | -| ----------------- | ---------------------- | -| Nothing? | data()
validated payload | -| @Nullable Object | getData()
validated payload | - -## AnyTypeExceptNullPropBoxedBoolean -public record AnyTypeExceptNullPropBoxedBoolean
-implements [AnyTypeExceptNullPropBoxed](#anytypeexceptnullpropboxed) - -record that stores validated boolean payloads, sealed permits implementation - -### Constructor Summary -| Constructor and Description | -| --------------------------- | -| AnyTypeExceptNullPropBoxedBoolean(boolean data)
Creates an instance, private visibility | - -### Method Summary -| Modifier and Type | Method and Description | -| ----------------- | ---------------------- | -| boolean | data()
validated payload | -| @Nullable Object | getData()
validated payload | - -## AnyTypeExceptNullPropBoxedNumber -public record AnyTypeExceptNullPropBoxedNumber
-implements [AnyTypeExceptNullPropBoxed](#anytypeexceptnullpropboxed) - -record that stores validated Number payloads, sealed permits implementation - -### Constructor Summary -| Constructor and Description | -| --------------------------- | -| AnyTypeExceptNullPropBoxedNumber(Number data)
Creates an instance, private visibility | - -### Method Summary -| Modifier and Type | Method and Description | -| ----------------- | ---------------------- | -| Number | data()
validated payload | -| @Nullable Object | getData()
validated payload | - -## AnyTypeExceptNullPropBoxedString -public record AnyTypeExceptNullPropBoxedString
-implements [AnyTypeExceptNullPropBoxed](#anytypeexceptnullpropboxed) - -record that stores validated String payloads, sealed permits implementation - -### Constructor Summary -| Constructor and Description | -| --------------------------- | -| AnyTypeExceptNullPropBoxedString(String data)
Creates an instance, private visibility | - -### Method Summary -| Modifier and Type | Method and Description | -| ----------------- | ---------------------- | -| String | data()
validated payload | -| @Nullable Object | getData()
validated payload | - -## AnyTypeExceptNullPropBoxedList -public record AnyTypeExceptNullPropBoxedList
-implements [AnyTypeExceptNullPropBoxed](#anytypeexceptnullpropboxed) - -record that stores validated List payloads, sealed permits implementation - -### Constructor Summary -| Constructor and Description | -| --------------------------- | -| AnyTypeExceptNullPropBoxedList(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 | - -## AnyTypeExceptNullPropBoxedMap -public record AnyTypeExceptNullPropBoxedMap
-implements [AnyTypeExceptNullPropBoxed](#anytypeexceptnullpropboxed) - -record that stores validated Map payloads, sealed permits implementation - -### Constructor Summary -| Constructor and Description | -| --------------------------- | -| AnyTypeExceptNullPropBoxedMap(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 | - -## AnyTypeExceptNullProp -public static class AnyTypeExceptNullProp
-extends JsonSchema - -A schema class that validates payloads - -## Description -any type except 'null' Here the 'type' attribute is not specified, which means the value can be anything, including the null value, string, number, boolean, array or object. - -### Field Summary -| Modifier and Type | Field and Description | -| ----------------- | ---------------------- | -| Class | not = [Not.class](#not) | - -### Method Summary -| Modifier and Type | Method and Description | -| ----------------- | ---------------------- | -| String | validate(String arg, SchemaConfiguration configuration) | -| Nothing? | validate(Nothing? arg, SchemaConfiguration configuration) | -| int | validate(int arg, SchemaConfiguration configuration) | -| long | validate(long arg, SchemaConfiguration configuration) | -| float | validate(float arg, SchemaConfiguration configuration) | -| double | validate(double arg, SchemaConfiguration configuration) | -| Number | validate(Number arg, SchemaConfiguration configuration) | -| boolean | validate(boolean arg, SchemaConfiguration configuration) | -| FrozenMap<@Nullable Object> | validate(Map<?, ?> arg, SchemaConfiguration configuration) | -| FrozenList<@Nullable Object> | validate(List arg, SchemaConfiguration configuration) | -| [AnyTypeExceptNullPropBoxedString](#anytypeexceptnullpropboxedstring) | validateAndBox(String arg, SchemaConfiguration configuration) | -| [AnyTypeExceptNullPropBoxedVoid](#anytypeexceptnullpropboxedvoid) | validateAndBox(Nothing? arg, SchemaConfiguration configuration) | -| [AnyTypeExceptNullPropBoxedNumber](#anytypeexceptnullpropboxednumber) | validateAndBox(Number arg, SchemaConfiguration configuration) | -| [AnyTypeExceptNullPropBoxedBoolean](#anytypeexceptnullpropboxedboolean) | validateAndBox(boolean arg, SchemaConfiguration configuration) | -| [AnyTypeExceptNullPropBoxedMap](#anytypeexceptnullpropboxedmap) | validateAndBox(Map<?, ?> arg, SchemaConfiguration configuration) | -| [AnyTypeExceptNullPropBoxedList](#anytypeexceptnullpropboxedlist) | validateAndBox(List arg, SchemaConfiguration configuration) | -| [AnyTypeExceptNullPropBoxed](#anytypeexceptnullpropboxed) | validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) | -| @Nullable Object | validate(@Nullable Object arg, SchemaConfiguration configuration) | - -## NotBoxed -public sealed interface NotBoxed
-permits
-[NotBoxedVoid](#notboxedvoid) - -sealed interface that stores validated payloads using boxed classes - -## NotBoxedVoid -public record NotBoxedVoid
-implements [NotBoxed](#notboxed) - -record that stores validated null payloads, sealed permits implementation - -### Constructor Summary -| Constructor and Description | -| --------------------------- | -| NotBoxedVoid(Nothing? data)
Creates an instance, private visibility | - -### Method Summary -| Modifier and Type | Method and Description | -| ----------------- | ---------------------- | -| Nothing? | data()
validated payload | -| @Nullable Object | getData()
validated payload | - -## Not -public static class Not
-extends NullJsonSchema.NullJsonSchema1 - -A schema class that validates payloads - -| Methods Inherited from class org.openapijsonschematools.client.schemas.NullJsonSchema.NullJsonSchema1 | -| ------------------------------------------------------------------ | -| validate | -| validateAndBox | - -## AnyTypePropBoxed -public sealed interface AnyTypePropBoxed
-permits
-[AnyTypePropBoxedVoid](#anytypepropboxedvoid), -[AnyTypePropBoxedBoolean](#anytypepropboxedboolean), -[AnyTypePropBoxedNumber](#anytypepropboxednumber), -[AnyTypePropBoxedString](#anytypepropboxedstring), -[AnyTypePropBoxedList](#anytypepropboxedlist), -[AnyTypePropBoxedMap](#anytypepropboxedmap) - -sealed interface that stores validated payloads using boxed classes - -## AnyTypePropBoxedVoid -public record AnyTypePropBoxedVoid
-implements [AnyTypePropBoxed](#anytypepropboxed) - -record that stores validated null payloads, sealed permits implementation - -### Constructor Summary -| Constructor and Description | -| --------------------------- | -| AnyTypePropBoxedVoid(Nothing? data)
Creates an instance, private visibility | - -### Method Summary -| Modifier and Type | Method and Description | -| ----------------- | ---------------------- | -| Nothing? | data()
validated payload | -| @Nullable Object | getData()
validated payload | - -## AnyTypePropBoxedBoolean -public record AnyTypePropBoxedBoolean
-implements [AnyTypePropBoxed](#anytypepropboxed) - -record that stores validated boolean payloads, sealed permits implementation - -### Constructor Summary -| Constructor and Description | -| --------------------------- | -| AnyTypePropBoxedBoolean(boolean data)
Creates an instance, private visibility | - -### Method Summary -| Modifier and Type | Method and Description | -| ----------------- | ---------------------- | -| boolean | data()
validated payload | -| @Nullable Object | getData()
validated payload | - -## AnyTypePropBoxedNumber -public record AnyTypePropBoxedNumber
-implements [AnyTypePropBoxed](#anytypepropboxed) - -record that stores validated Number payloads, sealed permits implementation - -### Constructor Summary -| Constructor and Description | -| --------------------------- | -| AnyTypePropBoxedNumber(Number data)
Creates an instance, private visibility | - -### Method Summary -| Modifier and Type | Method and Description | -| ----------------- | ---------------------- | -| Number | data()
validated payload | -| @Nullable Object | getData()
validated payload | - -## AnyTypePropBoxedString -public record AnyTypePropBoxedString
-implements [AnyTypePropBoxed](#anytypepropboxed) - -record that stores validated String payloads, sealed permits implementation - -### Constructor Summary -| Constructor and Description | -| --------------------------- | -| AnyTypePropBoxedString(String data)
Creates an instance, private visibility | - -### Method Summary -| Modifier and Type | Method and Description | -| ----------------- | ---------------------- | -| String | data()
validated payload | -| @Nullable Object | getData()
validated payload | - -## AnyTypePropBoxedList -public record AnyTypePropBoxedList
-implements [AnyTypePropBoxed](#anytypepropboxed) - -record that stores validated List payloads, sealed permits implementation - -### Constructor Summary -| Constructor and Description | -| --------------------------- | -| AnyTypePropBoxedList(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 | - -## AnyTypePropBoxedMap -public record AnyTypePropBoxedMap
-implements [AnyTypePropBoxed](#anytypepropboxed) - -record that stores validated Map payloads, sealed permits implementation - -### Constructor Summary -| Constructor and Description | -| --------------------------- | -| AnyTypePropBoxedMap(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 | - -## AnyTypeProp -public static class AnyTypeProp
-extends AnyTypeJsonSchema.AnyTypeJsonSchema1 - -A schema class that validates payloads - -## Description -test code generation for any type Here the 'type' attribute is not specified, which means the value can be anything, including the null value, string, number, boolean, array or object. See https://github.com/OAI/OpenAPI-Specification/issues/1389 - -| Methods Inherited from class org.openapijsonschematools.client.schemas.AnyTypeJsonSchema.AnyTypeJsonSchema1 | -| ------------------------------------------------------------------ | -| validate | -| validateAndBox | - -## ObjectWithNoDeclaredPropsNullableBoxed -public sealed interface ObjectWithNoDeclaredPropsNullableBoxed
-permits
-[ObjectWithNoDeclaredPropsNullableBoxedVoid](#objectwithnodeclaredpropsnullableboxedvoid), -[ObjectWithNoDeclaredPropsNullableBoxedMap](#objectwithnodeclaredpropsnullableboxedmap) - -sealed interface that stores validated payloads using boxed classes - -## ObjectWithNoDeclaredPropsNullableBoxedVoid -public record ObjectWithNoDeclaredPropsNullableBoxedVoid
-implements [ObjectWithNoDeclaredPropsNullableBoxed](#objectwithnodeclaredpropsnullableboxed) - -record that stores validated null payloads, sealed permits implementation - -### Constructor Summary -| Constructor and Description | -| --------------------------- | -| ObjectWithNoDeclaredPropsNullableBoxedVoid(Nothing? data)
Creates an instance, private visibility | - -### Method Summary -| Modifier and Type | Method and Description | -| ----------------- | ---------------------- | -| Nothing? | data()
validated payload | -| @Nullable Object | getData()
validated payload | - -## ObjectWithNoDeclaredPropsNullableBoxedMap -public record ObjectWithNoDeclaredPropsNullableBoxedMap
-implements [ObjectWithNoDeclaredPropsNullableBoxed](#objectwithnodeclaredpropsnullableboxed) - -record that stores validated Map payloads, sealed permits implementation - -### Constructor Summary -| Constructor and Description | -| --------------------------- | -| ObjectWithNoDeclaredPropsNullableBoxedMap(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 | - -## ObjectWithNoDeclaredPropsNullable -public static class ObjectWithNoDeclaredPropsNullable
-extends JsonSchema - -A schema class that validates payloads - -## Description -test code generation for nullable objects. Value must be a map of strings to values or the 'null' value. - -### Code Sample -``` -import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags; -import org.openapijsonschematools.client.configurations.SchemaConfiguration; -import org.openapijsonschematools.client.exceptions.ValidationException; -import org.openapijsonschematools.client.schemas.validation.MapUtils; -import org.openapijsonschematools.client.schemas.validation.FrozenList; -import org.openapijsonschematools.client.schemas.validation.FrozenMap; -import org.openapijsonschematools.client.components.schemas.User; - -import java.util.Arrays; -import java.util.List; -import java.util.AbstractMap; - -static final SchemaConfiguration configuration = new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().build()); - -// null validation -Nothing? validatedPayload = User.ObjectWithNoDeclaredPropsNullable.validate( - (Nothing?) null, - configuration -); -``` - -### Field Summary -| Modifier and Type | Field and Description | -| ----------------- | ---------------------- | -| Set> | type = Set.of(
    Nothing?.class,
    Map.class
)
| - -### Method Summary -| Modifier and Type | Method and Description | -| ----------------- | ---------------------- | -| Nothing? | validate(Nothing? arg, SchemaConfiguration configuration) | -| [ObjectWithNoDeclaredPropsNullableBoxedVoid](#objectwithnodeclaredpropsnullableboxedvoid) | validateAndBox(Nothing? arg, SchemaConfiguration configuration) | -| FrozenMap | validate(Map<?, ?> arg, SchemaConfiguration configuration) | -| [ObjectWithNoDeclaredPropsNullableBoxedMap](#objectwithnodeclaredpropsnullableboxedmap) | validateAndBox(Map<?, ?> arg, SchemaConfiguration configuration) | -| [ObjectWithNoDeclaredPropsNullableBoxed](#objectwithnodeclaredpropsnullableboxed) | validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) | -| @Nullable Object | validate(@Nullable Object arg, SchemaConfiguration configuration) | - -## ObjectWithNoDeclaredPropsBoxed -public sealed interface ObjectWithNoDeclaredPropsBoxed
-permits
-[ObjectWithNoDeclaredPropsBoxedMap](#objectwithnodeclaredpropsboxedmap) - -sealed interface that stores validated payloads using boxed classes - -## ObjectWithNoDeclaredPropsBoxedMap -public record ObjectWithNoDeclaredPropsBoxedMap
-implements [ObjectWithNoDeclaredPropsBoxed](#objectwithnodeclaredpropsboxed) - -record that stores validated Map payloads, sealed permits implementation - -### Constructor Summary -| Constructor and Description | -| --------------------------- | -| ObjectWithNoDeclaredPropsBoxedMap(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 | - -## ObjectWithNoDeclaredProps -public static class ObjectWithNoDeclaredProps
-extends MapJsonSchema.MapJsonSchema1 - -A schema class that validates payloads - -## Description -test code generation for objects Value must be a map of strings to values. It cannot be the 'null' value. - -| Methods Inherited from class org.openapijsonschematools.client.schemas.MapJsonSchema.MapJsonSchema1 | -| ------------------------------------------------------------------ | -| validate | -| validateAndBox | - -## UserStatusBoxed -public sealed interface UserStatusBoxed
-permits
-[UserStatusBoxedNumber](#userstatusboxednumber) - -sealed interface that stores validated payloads using boxed classes - -## UserStatusBoxedNumber -public record UserStatusBoxedNumber
-implements [UserStatusBoxed](#userstatusboxed) - -record that stores validated Number payloads, sealed permits implementation - -### Constructor Summary -| Constructor and Description | -| --------------------------- | -| UserStatusBoxedNumber(Number data)
Creates an instance, private visibility | - -### Method Summary -| Modifier and Type | Method and Description | -| ----------------- | ---------------------- | -| Number | data()
validated payload | -| @Nullable Object | getData()
validated payload | - -## UserStatus -public static class UserStatus
-extends Int32JsonSchema.Int32JsonSchema1 - -A schema class that validates payloads - -## Description -User Status - -| Methods Inherited from class org.openapijsonschematools.client.schemas.Int32JsonSchema.Int32JsonSchema1 | -| ------------------------------------------------------------------ | -| validate | -| validateAndBox | - -## PhoneBoxed -public sealed interface PhoneBoxed
-permits
-[PhoneBoxedString](#phoneboxedstring) - -sealed interface that stores validated payloads using boxed classes - -## PhoneBoxedString -public record PhoneBoxedString
-implements [PhoneBoxed](#phoneboxed) - -record that stores validated String payloads, sealed permits implementation - -### Constructor Summary -| Constructor and Description | -| --------------------------- | -| PhoneBoxedString(String data)
Creates an instance, private visibility | - -### Method Summary -| Modifier and Type | Method and Description | -| ----------------- | ---------------------- | -| String | data()
validated payload | -| @Nullable Object | getData()
validated payload | - -## Phone -public static class Phone
-extends StringJsonSchema.StringJsonSchema1 - -A schema class that validates payloads - -| Methods Inherited from class org.openapijsonschematools.client.schemas.StringJsonSchema.StringJsonSchema1 | -| ------------------------------------------------------------------ | -| validate | -| validateAndBox | - -## PasswordBoxed -public sealed interface PasswordBoxed
-permits
-[PasswordBoxedString](#passwordboxedstring) - -sealed interface that stores validated payloads using boxed classes - -## PasswordBoxedString -public record PasswordBoxedString
-implements [PasswordBoxed](#passwordboxed) - -record that stores validated String payloads, sealed permits implementation - -### Constructor Summary -| Constructor and Description | -| --------------------------- | -| PasswordBoxedString(String data)
Creates an instance, private visibility | - -### Method Summary -| Modifier and Type | Method and Description | -| ----------------- | ---------------------- | -| String | data()
validated payload | -| @Nullable Object | getData()
validated payload | - -## Password -public static class Password
-extends StringJsonSchema.StringJsonSchema1 - -A schema class that validates payloads - -| Methods Inherited from class org.openapijsonschematools.client.schemas.StringJsonSchema.StringJsonSchema1 | -| ------------------------------------------------------------------ | -| validate | -| validateAndBox | - -## EmailBoxed -public sealed interface EmailBoxed
-permits
-[EmailBoxedString](#emailboxedstring) - -sealed interface that stores validated payloads using boxed classes - -## EmailBoxedString -public record EmailBoxedString
-implements [EmailBoxed](#emailboxed) - -record that stores validated String payloads, sealed permits implementation - -### Constructor Summary -| Constructor and Description | -| --------------------------- | -| EmailBoxedString(String data)
Creates an instance, private visibility | - -### Method Summary -| Modifier and Type | Method and Description | -| ----------------- | ---------------------- | -| String | data()
validated payload | -| @Nullable Object | getData()
validated payload | - -## Email -public static class Email
-extends StringJsonSchema.StringJsonSchema1 - -A schema class that validates payloads - -| Methods Inherited from class org.openapijsonschematools.client.schemas.StringJsonSchema.StringJsonSchema1 | -| ------------------------------------------------------------------ | -| validate | -| validateAndBox | - -## LastNameBoxed -public sealed interface LastNameBoxed
-permits
-[LastNameBoxedString](#lastnameboxedstring) - -sealed interface that stores validated payloads using boxed classes - -## LastNameBoxedString -public record LastNameBoxedString
-implements [LastNameBoxed](#lastnameboxed) - -record that stores validated String payloads, sealed permits implementation - -### Constructor Summary -| Constructor and Description | -| --------------------------- | -| LastNameBoxedString(String data)
Creates an instance, private visibility | - -### Method Summary -| Modifier and Type | Method and Description | -| ----------------- | ---------------------- | -| String | data()
validated payload | -| @Nullable Object | getData()
validated payload | - -## LastName -public static class LastName
-extends StringJsonSchema.StringJsonSchema1 - -A schema class that validates payloads - -| Methods Inherited from class org.openapijsonschematools.client.schemas.StringJsonSchema.StringJsonSchema1 | -| ------------------------------------------------------------------ | -| validate | -| validateAndBox | - -## FirstNameBoxed -public sealed interface FirstNameBoxed
-permits
-[FirstNameBoxedString](#firstnameboxedstring) - -sealed interface that stores validated payloads using boxed classes - -## FirstNameBoxedString -public record FirstNameBoxedString
-implements [FirstNameBoxed](#firstnameboxed) - -record that stores validated String payloads, sealed permits implementation - -### Constructor Summary -| Constructor and Description | -| --------------------------- | -| FirstNameBoxedString(String data)
Creates an instance, private visibility | - -### Method Summary -| Modifier and Type | Method and Description | -| ----------------- | ---------------------- | -| String | data()
validated payload | -| @Nullable Object | getData()
validated payload | - -## FirstName -public static class FirstName
-extends StringJsonSchema.StringJsonSchema1 - -A schema class that validates payloads - -| Methods Inherited from class org.openapijsonschematools.client.schemas.StringJsonSchema.StringJsonSchema1 | -| ------------------------------------------------------------------ | -| validate | -| validateAndBox | - -## UsernameBoxed -public sealed interface UsernameBoxed
-permits
-[UsernameBoxedString](#usernameboxedstring) - -sealed interface that stores validated payloads using boxed classes - -## UsernameBoxedString -public record UsernameBoxedString
-implements [UsernameBoxed](#usernameboxed) - -record that stores validated String payloads, sealed permits implementation - -### Constructor Summary -| Constructor and Description | -| --------------------------- | -| UsernameBoxedString(String data)
Creates an instance, private visibility | - -### Method Summary -| Modifier and Type | Method and Description | -| ----------------- | ---------------------- | -| String | data()
validated payload | -| @Nullable Object | getData()
validated payload | - -## Username -public static class Username
-extends StringJsonSchema.StringJsonSchema1 - -A schema class that validates payloads - -| Methods Inherited from class org.openapijsonschematools.client.schemas.StringJsonSchema.StringJsonSchema1 | -| ------------------------------------------------------------------ | -| validate | -| validateAndBox | - -## IdBoxed -public sealed interface IdBoxed
-permits
-[IdBoxedNumber](#idboxednumber) - -sealed interface that stores validated payloads using boxed classes - -## IdBoxedNumber -public record IdBoxedNumber
-implements [IdBoxed](#idboxed) - -record that stores validated Number payloads, sealed permits implementation - -### Constructor Summary -| Constructor and Description | -| --------------------------- | -| IdBoxedNumber(Number data)
Creates an instance, private visibility | - -### Method Summary -| Modifier and Type | Method and Description | -| ----------------- | ---------------------- | -| Number | data()
validated payload | -| @Nullable Object | getData()
validated payload | - -## Id -public static class Id
-extends Int64JsonSchema.Int64JsonSchema1 - -A schema class that validates payloads - -| Methods Inherited from class org.openapijsonschematools.client.schemas.Int64JsonSchema.Int64JsonSchema1 | -| ------------------------------------------------------------------ | -| validate | -| validateAndBox | - -[[Back to top]](#top) [[Back to Component Schemas]](../../../README.md#Component-Schemas) [[Back to README]](../../../README.md) diff --git a/samples/client/petstore/kotlin/docs/components/schemas/Whale.md b/samples/client/petstore/kotlin/docs/components/schemas/Whale.md deleted file mode 100644 index 62c94750589..00000000000 --- a/samples/client/petstore/kotlin/docs/components/schemas/Whale.md +++ /dev/null @@ -1,316 +0,0 @@ -# Whale -org.openapijsonschematools.client.components.schemas.Whale.java -public class Whale
- -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 | [Whale.Whale1Boxed](#whale1boxed)
sealed interface for validated payloads | -| record | [Whale.Whale1BoxedMap](#whale1boxedmap)
boxed class to store validated Map payloads | -| static class | [Whale.Whale1](#whale1)
schema class | -| static class | [Whale.WhaleMapBuilder](#whalemapbuilder)
builder for Map payloads | -| static class | [Whale.WhaleMap](#whalemap)
output class for Map payloads | -| sealed interface | [Whale.ClassNameBoxed](#classnameboxed)
sealed interface for validated payloads | -| record | [Whale.ClassNameBoxedString](#classnameboxedstring)
boxed class to store validated String payloads | -| static class | [Whale.ClassName](#classname)
schema class | -| enum | [Whale.StringClassNameEnums](#stringclassnameenums)
String enum | -| sealed interface | [Whale.HasTeethBoxed](#hasteethboxed)
sealed interface for validated payloads | -| record | [Whale.HasTeethBoxedBoolean](#hasteethboxedboolean)
boxed class to store validated boolean payloads | -| static class | [Whale.HasTeeth](#hasteeth)
schema class | -| sealed interface | [Whale.HasBaleenBoxed](#hasbaleenboxed)
sealed interface for validated payloads | -| record | [Whale.HasBaleenBoxedBoolean](#hasbaleenboxedboolean)
boxed class to store validated boolean payloads | -| static class | [Whale.HasBaleen](#hasbaleen)
schema class | - -## Whale1Boxed -public sealed interface Whale1Boxed
-permits
-[Whale1BoxedMap](#whale1boxedmap) - -sealed interface that stores validated payloads using boxed classes - -## Whale1BoxedMap -public record Whale1BoxedMap
-implements [Whale1Boxed](#whale1boxed) - -record that stores validated Map payloads, sealed permits implementation - -### Constructor Summary -| Constructor and Description | -| --------------------------- | -| Whale1BoxedMap([WhaleMap](#whalemap) data)
Creates an instance, private visibility | - -### Method Summary -| Modifier and Type | Method and Description | -| ----------------- | ---------------------- | -| [WhaleMap](#whalemap) | data()
validated payload | -| @Nullable Object | getData()
validated payload | - -## Whale1 -public static class Whale1
-extends JsonSchema - -A schema class that validates payloads - -### Code Sample -``` -import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags; -import org.openapijsonschematools.client.configurations.SchemaConfiguration; -import org.openapijsonschematools.client.exceptions.ValidationException; -import org.openapijsonschematools.client.schemas.validation.MapUtils; -import org.openapijsonschematools.client.schemas.validation.FrozenList; -import org.openapijsonschematools.client.schemas.validation.FrozenMap; -import org.openapijsonschematools.client.components.schemas.Whale; - -import java.util.Arrays; -import java.util.List; -import java.util.AbstractMap; - -static final SchemaConfiguration configuration = new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().build()); - -// Map validation -Whale.WhaleMap validatedPayload = - Whale.Whale1.validate( - new Whale.WhaleMapBuilder() - .className("whale") - - .hasBaleen(true) - - .hasTeeth(true) - - .build(), - configuration -); -``` - -### Field Summary -| Modifier and Type | Field and Description | -| ----------------- | ---------------------- | -| Set> | type = Set.of(Map.class) | -| Map> | properties = Map.ofEntries(
    new PropertyEntry("hasBaleen", [HasBaleen.class](#hasbaleen))),
    new PropertyEntry("hasTeeth", [HasTeeth.class](#hasteeth))),
    new PropertyEntry("className", [ClassName.class](#classname)))
)
| -| Set | required = Set.of(
    "className"
)
| - -### Method Summary -| Modifier and Type | Method and Description | -| ----------------- | ---------------------- | -| [WhaleMap](#whalemap) | validate([Map<?, ?>](#whalemapbuilder) arg, SchemaConfiguration configuration) | -| [Whale1BoxedMap](#whale1boxedmap) | validateAndBox([Map<?, ?>](#whalemapbuilder) arg, SchemaConfiguration configuration) | -| [Whale1Boxed](#whale1boxed) | validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) | -| @Nullable Object | validate(@Nullable Object arg, SchemaConfiguration configuration) | - -## WhaleMap0Builder -public class WhaleMap0Builder
-builder for `Map` - -A class that builds the Map input type - -### Constructor Summary -| Constructor and Description | -| --------------------------- | -| WhaleMap0Builder(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 | -| [WhaleMap0Builder](#whalemap0builder) | hasBaleen(boolean value) | -| [WhaleMap0Builder](#whalemap0builder) | hasTeeth(boolean value) | -| [WhaleMap0Builder](#whalemap0builder) | additionalProperty(String key, Nothing? value) | -| [WhaleMap0Builder](#whalemap0builder) | additionalProperty(String key, boolean value) | -| [WhaleMap0Builder](#whalemap0builder) | additionalProperty(String key, String value) | -| [WhaleMap0Builder](#whalemap0builder) | additionalProperty(String key, int value) | -| [WhaleMap0Builder](#whalemap0builder) | additionalProperty(String key, float value) | -| [WhaleMap0Builder](#whalemap0builder) | additionalProperty(String key, long value) | -| [WhaleMap0Builder](#whalemap0builder) | additionalProperty(String key, double value) | -| [WhaleMap0Builder](#whalemap0builder) | additionalProperty(String key, List value) | -| [WhaleMap0Builder](#whalemap0builder) | additionalProperty(String key, Map value) | - -## WhaleMapBuilder -public class WhaleMapBuilder
-builder for `Map` - -A class that builds the Map input type - -### Constructor Summary -| Constructor and Description | -| --------------------------- | -| WhaleMapBuilder()
Creates a builder that contains an empty map | - -### Method Summary -| Modifier and Type | Method and Description | -| ----------------- | ---------------------- | -| [WhaleMap0Builder](#whalemap0builder) | className(String value) | -| [WhaleMap0Builder](#whalemap0builder) | className([StringClassNameEnums](#stringclassnameenums) value) | - -## WhaleMap -public static class WhaleMap
-extends FrozenMap - -A class to store validated Map payloads - -### Method Summary -| Modifier and Type | Method and Description | -| ----------------- | ---------------------- | -| static [WhaleMap](#whalemap) | of([Map](#whalemapbuilder) arg, SchemaConfiguration configuration) | -| String | className()
must be one of ["whale"] | -| boolean | hasBaleen()
[optional] | -| boolean | hasTeeth()
[optional] | -| @Nullable Object | getAdditionalProperty(String name)
provides type safety for additional properties | - -## ClassNameBoxed -public sealed interface ClassNameBoxed
-permits
-[ClassNameBoxedString](#classnameboxedstring) - -sealed interface that stores validated payloads using boxed classes - -## ClassNameBoxedString -public record ClassNameBoxedString
-implements [ClassNameBoxed](#classnameboxed) - -record that stores validated String payloads, sealed permits implementation - -### Constructor Summary -| Constructor and Description | -| --------------------------- | -| ClassNameBoxedString(String data)
Creates an instance, private visibility | - -### Method Summary -| Modifier and Type | Method and Description | -| ----------------- | ---------------------- | -| String | data()
validated payload | -| @Nullable Object | getData()
validated payload | - -## ClassName -public static class ClassName
-extends JsonSchema - -A schema class that validates payloads - -### Code Sample -``` -import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags; -import org.openapijsonschematools.client.configurations.SchemaConfiguration; -import org.openapijsonschematools.client.exceptions.ValidationException; -import org.openapijsonschematools.client.schemas.validation.MapUtils; -import org.openapijsonschematools.client.schemas.validation.FrozenList; -import org.openapijsonschematools.client.schemas.validation.FrozenMap; -import org.openapijsonschematools.client.components.schemas.Whale; - -import java.util.Arrays; -import java.util.List; -import java.util.AbstractMap; - -static final SchemaConfiguration configuration = new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().build()); - -// String validation -String validatedPayload = Whale.ClassName.validate( - "whale", - configuration -); -``` - -### Field Summary -| Modifier and Type | Field and Description | -| ----------------- | ---------------------- | -| Set> | type = Set.of(
    String.class
)
| -| Set | enumValues = SetMaker.makeSet(
    "whale"
)
| - -### Method Summary -| Modifier and Type | Method and Description | -| ----------------- | ---------------------- | -| String | validate(String arg, SchemaConfiguration configuration) | -| String | validate([StringClassNameEnums](#stringclassnameenums) arg, SchemaConfiguration configuration) | -| [ClassNameBoxedString](#classnameboxedstring) | validateAndBox(String arg, SchemaConfiguration configuration) | -| [ClassNameBoxed](#classnameboxed) | validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) | -| @Nullable Object | validate(@Nullable Object arg, SchemaConfiguration configuration) | - -## StringClassNameEnums -public enum StringClassNameEnums
-extends `Enum` - -A class that stores String enum values - -### Enum Constant Summary -| Enum Constant | Description | -| ------------- | ----------- | -| WHALE | value = "whale" | - -## HasTeethBoxed -public sealed interface HasTeethBoxed
-permits
-[HasTeethBoxedBoolean](#hasteethboxedboolean) - -sealed interface that stores validated payloads using boxed classes - -## HasTeethBoxedBoolean -public record HasTeethBoxedBoolean
-implements [HasTeethBoxed](#hasteethboxed) - -record that stores validated boolean payloads, sealed permits implementation - -### Constructor Summary -| Constructor and Description | -| --------------------------- | -| HasTeethBoxedBoolean(boolean data)
Creates an instance, private visibility | - -### Method Summary -| Modifier and Type | Method and Description | -| ----------------- | ---------------------- | -| boolean | data()
validated payload | -| @Nullable Object | getData()
validated payload | - -## HasTeeth -public static class HasTeeth
-extends BooleanJsonSchema.BooleanJsonSchema1 - -A schema class that validates payloads - -| Methods Inherited from class org.openapijsonschematools.client.schemas.BooleanJsonSchema.BooleanJsonSchema1 | -| ------------------------------------------------------------------ | -| validate | -| validateAndBox | - -## HasBaleenBoxed -public sealed interface HasBaleenBoxed
-permits
-[HasBaleenBoxedBoolean](#hasbaleenboxedboolean) - -sealed interface that stores validated payloads using boxed classes - -## HasBaleenBoxedBoolean -public record HasBaleenBoxedBoolean
-implements [HasBaleenBoxed](#hasbaleenboxed) - -record that stores validated boolean payloads, sealed permits implementation - -### Constructor Summary -| Constructor and Description | -| --------------------------- | -| HasBaleenBoxedBoolean(boolean data)
Creates an instance, private visibility | - -### Method Summary -| Modifier and Type | Method and Description | -| ----------------- | ---------------------- | -| boolean | data()
validated payload | -| @Nullable Object | getData()
validated payload | - -## HasBaleen -public static class HasBaleen
-extends BooleanJsonSchema.BooleanJsonSchema1 - -A schema class that validates payloads - -| Methods Inherited from class org.openapijsonschematools.client.schemas.BooleanJsonSchema.BooleanJsonSchema1 | -| ------------------------------------------------------------------ | -| validate | -| validateAndBox | - -[[Back to top]](#top) [[Back to Component Schemas]](../../../README.md#Component-Schemas) [[Back to README]](../../../README.md) diff --git a/samples/client/petstore/kotlin/docs/components/schemas/Zebra.md b/samples/client/petstore/kotlin/docs/components/schemas/Zebra.md deleted file mode 100644 index 59ed83af36d..00000000000 --- a/samples/client/petstore/kotlin/docs/components/schemas/Zebra.md +++ /dev/null @@ -1,456 +0,0 @@ -# Zebra -org.openapijsonschematools.client.components.schemas.Zebra.java -public class Zebra
- -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 | [Zebra.Zebra1Boxed](#zebra1boxed)
sealed interface for validated payloads | -| record | [Zebra.Zebra1BoxedMap](#zebra1boxedmap)
boxed class to store validated Map payloads | -| static class | [Zebra.Zebra1](#zebra1)
schema class | -| static class | [Zebra.ZebraMapBuilder](#zebramapbuilder)
builder for Map payloads | -| static class | [Zebra.ZebraMap](#zebramap)
output class for Map payloads | -| sealed interface | [Zebra.ClassNameBoxed](#classnameboxed)
sealed interface for validated payloads | -| record | [Zebra.ClassNameBoxedString](#classnameboxedstring)
boxed class to store validated String payloads | -| static class | [Zebra.ClassName](#classname)
schema class | -| enum | [Zebra.StringClassNameEnums](#stringclassnameenums)
String enum | -| sealed interface | [Zebra.TypeBoxed](#typeboxed)
sealed interface for validated payloads | -| record | [Zebra.TypeBoxedString](#typeboxedstring)
boxed class to store validated String payloads | -| static class | [Zebra.Type](#type)
schema class | -| enum | [Zebra.StringTypeEnums](#stringtypeenums)
String enum | -| sealed interface | [Zebra.AdditionalPropertiesBoxed](#additionalpropertiesboxed)
sealed interface for validated payloads | -| record | [Zebra.AdditionalPropertiesBoxedVoid](#additionalpropertiesboxedvoid)
boxed class to store validated null payloads | -| record | [Zebra.AdditionalPropertiesBoxedBoolean](#additionalpropertiesboxedboolean)
boxed class to store validated boolean payloads | -| record | [Zebra.AdditionalPropertiesBoxedNumber](#additionalpropertiesboxednumber)
boxed class to store validated Number payloads | -| record | [Zebra.AdditionalPropertiesBoxedString](#additionalpropertiesboxedstring)
boxed class to store validated String payloads | -| record | [Zebra.AdditionalPropertiesBoxedList](#additionalpropertiesboxedlist)
boxed class to store validated List payloads | -| record | [Zebra.AdditionalPropertiesBoxedMap](#additionalpropertiesboxedmap)
boxed class to store validated Map payloads | -| static class | [Zebra.AdditionalProperties](#additionalproperties)
schema class | - -## Zebra1Boxed -public sealed interface Zebra1Boxed
-permits
-[Zebra1BoxedMap](#zebra1boxedmap) - -sealed interface that stores validated payloads using boxed classes - -## Zebra1BoxedMap -public record Zebra1BoxedMap
-implements [Zebra1Boxed](#zebra1boxed) - -record that stores validated Map payloads, sealed permits implementation - -### Constructor Summary -| Constructor and Description | -| --------------------------- | -| Zebra1BoxedMap([ZebraMap](#zebramap) data)
Creates an instance, private visibility | - -### Method Summary -| Modifier and Type | Method and Description | -| ----------------- | ---------------------- | -| [ZebraMap](#zebramap) | data()
validated payload | -| @Nullable Object | getData()
validated payload | - -## Zebra1 -public static class Zebra1
-extends JsonSchema - -A schema class that validates payloads - -### Code Sample -``` -import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags; -import org.openapijsonschematools.client.configurations.SchemaConfiguration; -import org.openapijsonschematools.client.exceptions.ValidationException; -import org.openapijsonschematools.client.schemas.validation.MapUtils; -import org.openapijsonschematools.client.schemas.validation.FrozenList; -import org.openapijsonschematools.client.schemas.validation.FrozenMap; -import org.openapijsonschematools.client.components.schemas.Zebra; - -import java.util.Arrays; -import java.util.List; -import java.util.AbstractMap; - -static final SchemaConfiguration configuration = new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().build()); - -// Map validation -Zebra.ZebraMap validatedPayload = - Zebra.Zebra1.validate( - new Zebra.ZebraMapBuilder() - .className("zebra") - - .type("plains") - - .build(), - configuration -); -``` - -### Field Summary -| Modifier and Type | Field and Description | -| ----------------- | ---------------------- | -| Set> | type = Set.of(Map.class) | -| Map> | properties = Map.ofEntries(
    new PropertyEntry("type", [Type.class](#type))),
    new PropertyEntry("className", [ClassName.class](#classname)))
)
| -| Set | required = Set.of(
    "className"
)
| -| Class | additionalProperties = [AdditionalProperties.class](#additionalproperties) | - -### Method Summary -| Modifier and Type | Method and Description | -| ----------------- | ---------------------- | -| [ZebraMap](#zebramap) | validate([Map<?, ?>](#zebramapbuilder) arg, SchemaConfiguration configuration) | -| [Zebra1BoxedMap](#zebra1boxedmap) | validateAndBox([Map<?, ?>](#zebramapbuilder) arg, SchemaConfiguration configuration) | -| [Zebra1Boxed](#zebra1boxed) | validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) | -| @Nullable Object | validate(@Nullable Object arg, SchemaConfiguration configuration) | - -## ZebraMap0Builder -public class ZebraMap0Builder
-builder for `Map` - -A class that builds the Map input type - -### Constructor Summary -| Constructor and Description | -| --------------------------- | -| ZebraMap0Builder(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 | -| [ZebraMap0Builder](#zebramap0builder) | type(String value) | -| [ZebraMap0Builder](#zebramap0builder) | type([StringTypeEnums](#stringtypeenums) value) | -| [ZebraMap0Builder](#zebramap0builder) | additionalProperty(String key, Nothing? value) | -| [ZebraMap0Builder](#zebramap0builder) | additionalProperty(String key, boolean value) | -| [ZebraMap0Builder](#zebramap0builder) | additionalProperty(String key, String value) | -| [ZebraMap0Builder](#zebramap0builder) | additionalProperty(String key, int value) | -| [ZebraMap0Builder](#zebramap0builder) | additionalProperty(String key, float value) | -| [ZebraMap0Builder](#zebramap0builder) | additionalProperty(String key, long value) | -| [ZebraMap0Builder](#zebramap0builder) | additionalProperty(String key, double value) | -| [ZebraMap0Builder](#zebramap0builder) | additionalProperty(String key, List value) | -| [ZebraMap0Builder](#zebramap0builder) | additionalProperty(String key, Map value) | - -## ZebraMapBuilder -public class ZebraMapBuilder
-builder for `Map` - -A class that builds the Map input type - -### Constructor Summary -| Constructor and Description | -| --------------------------- | -| ZebraMapBuilder()
Creates a builder that contains an empty map | - -### Method Summary -| Modifier and Type | Method and Description | -| ----------------- | ---------------------- | -| [ZebraMap0Builder](#zebramap0builder) | className(String value) | -| [ZebraMap0Builder](#zebramap0builder) | className([StringClassNameEnums](#stringclassnameenums) value) | - -## ZebraMap -public static class ZebraMap
-extends FrozenMap - -A class to store validated Map payloads - -### Method Summary -| Modifier and Type | Method and Description | -| ----------------- | ---------------------- | -| static [ZebraMap](#zebramap) | of([Map](#zebramapbuilder) arg, SchemaConfiguration configuration) | -| String | className()
must be one of ["zebra"] | -| String | type()
[optional] must be one of ["plains", "mountain", "grevys"] | -| @Nullable Object | getAdditionalProperty(String name)
provides type safety for additional properties | - -## ClassNameBoxed -public sealed interface ClassNameBoxed
-permits
-[ClassNameBoxedString](#classnameboxedstring) - -sealed interface that stores validated payloads using boxed classes - -## ClassNameBoxedString -public record ClassNameBoxedString
-implements [ClassNameBoxed](#classnameboxed) - -record that stores validated String payloads, sealed permits implementation - -### Constructor Summary -| Constructor and Description | -| --------------------------- | -| ClassNameBoxedString(String data)
Creates an instance, private visibility | - -### Method Summary -| Modifier and Type | Method and Description | -| ----------------- | ---------------------- | -| String | data()
validated payload | -| @Nullable Object | getData()
validated payload | - -## ClassName -public static class ClassName
-extends JsonSchema - -A schema class that validates payloads - -### Code Sample -``` -import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags; -import org.openapijsonschematools.client.configurations.SchemaConfiguration; -import org.openapijsonschematools.client.exceptions.ValidationException; -import org.openapijsonschematools.client.schemas.validation.MapUtils; -import org.openapijsonschematools.client.schemas.validation.FrozenList; -import org.openapijsonschematools.client.schemas.validation.FrozenMap; -import org.openapijsonschematools.client.components.schemas.Zebra; - -import java.util.Arrays; -import java.util.List; -import java.util.AbstractMap; - -static final SchemaConfiguration configuration = new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().build()); - -// String validation -String validatedPayload = Zebra.ClassName.validate( - "zebra", - configuration -); -``` - -### Field Summary -| Modifier and Type | Field and Description | -| ----------------- | ---------------------- | -| Set> | type = Set.of(
    String.class
)
| -| Set | enumValues = SetMaker.makeSet(
    "zebra"
)
| - -### Method Summary -| Modifier and Type | Method and Description | -| ----------------- | ---------------------- | -| String | validate(String arg, SchemaConfiguration configuration) | -| String | validate([StringClassNameEnums](#stringclassnameenums) arg, SchemaConfiguration configuration) | -| [ClassNameBoxedString](#classnameboxedstring) | validateAndBox(String arg, SchemaConfiguration configuration) | -| [ClassNameBoxed](#classnameboxed) | validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) | -| @Nullable Object | validate(@Nullable Object arg, SchemaConfiguration configuration) | - -## StringClassNameEnums -public enum StringClassNameEnums
-extends `Enum` - -A class that stores String enum values - -### Enum Constant Summary -| Enum Constant | Description | -| ------------- | ----------- | -| ZEBRA | value = "zebra" | - -## TypeBoxed -public sealed interface TypeBoxed
-permits
-[TypeBoxedString](#typeboxedstring) - -sealed interface that stores validated payloads using boxed classes - -## TypeBoxedString -public record TypeBoxedString
-implements [TypeBoxed](#typeboxed) - -record that stores validated String payloads, sealed permits implementation - -### Constructor Summary -| Constructor and Description | -| --------------------------- | -| TypeBoxedString(String data)
Creates an instance, private visibility | - -### Method Summary -| Modifier and Type | Method and Description | -| ----------------- | ---------------------- | -| String | data()
validated payload | -| @Nullable Object | getData()
validated payload | - -## Type -public static class Type
-extends JsonSchema - -A schema class that validates payloads - -### Code Sample -``` -import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags; -import org.openapijsonschematools.client.configurations.SchemaConfiguration; -import org.openapijsonschematools.client.exceptions.ValidationException; -import org.openapijsonschematools.client.schemas.validation.MapUtils; -import org.openapijsonschematools.client.schemas.validation.FrozenList; -import org.openapijsonschematools.client.schemas.validation.FrozenMap; -import org.openapijsonschematools.client.components.schemas.Zebra; - -import java.util.Arrays; -import java.util.List; -import java.util.AbstractMap; - -static final SchemaConfiguration configuration = new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().build()); - -// String validation -String validatedPayload = Zebra.Type.validate( - "plains", - configuration -); -``` - -### Field Summary -| Modifier and Type | Field and Description | -| ----------------- | ---------------------- | -| Set> | type = Set.of(
    String.class
)
| -| Set | enumValues = SetMaker.makeSet(
    "plains",
    "mountain",
    "grevys"
)
| - -### Method Summary -| Modifier and Type | Method and Description | -| ----------------- | ---------------------- | -| String | validate(String arg, SchemaConfiguration configuration) | -| String | validate([StringTypeEnums](#stringtypeenums) arg, SchemaConfiguration configuration) | -| [TypeBoxedString](#typeboxedstring) | validateAndBox(String arg, SchemaConfiguration configuration) | -| [TypeBoxed](#typeboxed) | validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) | -| @Nullable Object | validate(@Nullable Object arg, SchemaConfiguration configuration) | - -## StringTypeEnums -public enum StringTypeEnums
-extends `Enum` - -A class that stores String enum values - -### Enum Constant Summary -| Enum Constant | Description | -| ------------- | ----------- | -| PLAINS | value = "plains" | -| MOUNTAIN | value = "mountain" | -| GREVYS | value = "grevys" | - -## 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(Nothing? data)
Creates an instance, private visibility | - -### Method Summary -| Modifier and Type | Method and Description | -| ----------------- | ---------------------- | -| Nothing? | 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 AnyTypeJsonSchema.AnyTypeJsonSchema1 - -A schema class that validates payloads - -| Methods Inherited from class org.openapijsonschematools.client.schemas.AnyTypeJsonSchema.AnyTypeJsonSchema1 | -| ------------------------------------------------------------------ | -| validate | -| validateAndBox | - -[[Back to top]](#top) [[Back to Component Schemas]](../../../README.md#Component-Schemas) [[Back to README]](../../../README.md) diff --git a/samples/client/petstore/kotlin/docs/components/securityschemes/ApiKey.md b/samples/client/petstore/kotlin/docs/components/securityschemes/ApiKey.md deleted file mode 100644 index 683fc84f1f0..00000000000 --- a/samples/client/petstore/kotlin/docs/components/securityschemes/ApiKey.md +++ /dev/null @@ -1,22 +0,0 @@ -org.openapijsonschematools.client.components.securityschemes.ApiKey -# SecurityScheme ApiKey - -public class ApiKey -extends ApiKeyHeaderSecurityScheme - -A class that is used to apply auth to a request - -### Description -apiKey in header - -### Method Summary -| Modifier and Type | Method and Description | -| ----------------- | ---------------------- | -| void | applyAuth(Map> headers, String resourcePath, String method, HttpRequest.BodyPublisher bodyPublisher, @Nullable String queryParamsSuffix, List scopeNames) | - -### Constructor Summary -| Constructor and Description | -| --------------------------- | -| ApiKey(String apiKey)
for header apiKey auth | - -[[Back to top]](#top) [[Back to Component Security Schemes]](../../../README.md#Component-SecuritySchemes) [[Back to README]](../../../README.md) diff --git a/samples/client/petstore/kotlin/docs/components/securityschemes/ApiKeyQuery.md b/samples/client/petstore/kotlin/docs/components/securityschemes/ApiKeyQuery.md deleted file mode 100644 index 3a9c08397fa..00000000000 --- a/samples/client/petstore/kotlin/docs/components/securityschemes/ApiKeyQuery.md +++ /dev/null @@ -1,22 +0,0 @@ -org.openapijsonschematools.client.components.securityschemes.ApiKeyQuery -# SecurityScheme ApiKeyQuery - -public class ApiKeyQuery -extends ApiKeyQuerySecurityScheme - -A class that is used to apply auth to a request - -### Description -apiKey in query - -### Method Summary -| Modifier and Type | Method and Description | -| ----------------- | ---------------------- | -| void | applyAuth(Map> headers, String resourcePath, String method, HttpRequest.BodyPublisher bodyPublisher, @Nullable String queryParamsSuffix, List scopeNames) | - -### Constructor Summary -| Constructor and Description | -| --------------------------- | -| ApiKeyQuery(String apiKey)
for query apiKey auth | - -[[Back to top]](#top) [[Back to Component Security Schemes]](../../../README.md#Component-SecuritySchemes) [[Back to README]](../../../README.md) diff --git a/samples/client/petstore/kotlin/docs/components/securityschemes/BearerTest.md b/samples/client/petstore/kotlin/docs/components/securityschemes/BearerTest.md deleted file mode 100644 index fd0b3c2f14b..00000000000 --- a/samples/client/petstore/kotlin/docs/components/securityschemes/BearerTest.md +++ /dev/null @@ -1,22 +0,0 @@ -org.openapijsonschematools.client.components.securityschemes.BearerTest -# SecurityScheme BearerTest - -public class BearerTest -extends HttpBearerSecurityScheme - -A class that is used to apply auth to a request - -### Description -http bearer with JWT bearer format - -### Method Summary -| Modifier and Type | Method and Description | -| ----------------- | ---------------------- | -| void | applyAuth(Map> headers, String resourcePath, String method, HttpRequest.BodyPublisher bodyPublisher, @Nullable String queryParamsSuffix, List scopeNames) | - -### Constructor Summary -| Constructor and Description | -| --------------------------- | -| BearerTest(String accessToken) | - -[[Back to top]](#top) [[Back to Component Security Schemes]](../../../README.md#Component-SecuritySchemes) [[Back to README]](../../../README.md) diff --git a/samples/client/petstore/kotlin/docs/components/securityschemes/HttpBasicTest.md b/samples/client/petstore/kotlin/docs/components/securityschemes/HttpBasicTest.md deleted file mode 100644 index d828c6a7db1..00000000000 --- a/samples/client/petstore/kotlin/docs/components/securityschemes/HttpBasicTest.md +++ /dev/null @@ -1,22 +0,0 @@ -org.openapijsonschematools.client.components.securityschemes.HttpBasicTest -# SecurityScheme HttpBasicTest - -public class HttpBasicTest -extends HttpBasicSecurityScheme - -A class that is used to apply auth to a request - -### Description -http basic - -### Method Summary -| Modifier and Type | Method and Description | -| ----------------- | ---------------------- | -| void | applyAuth(Map> headers, String resourcePath, String method, HttpRequest.BodyPublisher bodyPublisher, @Nullable String queryParamsSuffix, List scopeNames) | - -### Constructor Summary -| Constructor and Description | -| --------------------------- | -| HttpBasicTest(String userId, String password) | - -[[Back to top]](#top) [[Back to Component Security Schemes]](../../../README.md#Component-SecuritySchemes) [[Back to README]](../../../README.md) diff --git a/samples/client/petstore/kotlin/docs/components/securityschemes/HttpSignatureTest.md b/samples/client/petstore/kotlin/docs/components/securityschemes/HttpSignatureTest.md deleted file mode 100644 index 1c3a9df3af0..00000000000 --- a/samples/client/petstore/kotlin/docs/components/securityschemes/HttpSignatureTest.md +++ /dev/null @@ -1,22 +0,0 @@ -org.openapijsonschematools.client.components.securityschemes.HttpSignatureTest -# SecurityScheme HttpSignatureTest - -public class HttpSignatureTest -extends HttpSignatureSecurityScheme - -A class that is used to apply auth to a request - -### Description -http + signature - -### Method Summary -| Modifier and Type | Method and Description | -| ----------------- | ---------------------- | -| void | applyAuth(Map> headers, String resourcePath, String method, HttpRequest.BodyPublisher bodyPublisher, @Nullable String queryParamsSuffix, List scopeNames) | - -### Constructor Summary -| Constructor and Description | -| --------------------------- | -| todo | - -[[Back to top]](#top) [[Back to Component Security Schemes]](../../../README.md#Component-SecuritySchemes) [[Back to README]](../../../README.md) diff --git a/samples/client/petstore/kotlin/docs/components/securityschemes/OpenIdConnectTest.md b/samples/client/petstore/kotlin/docs/components/securityschemes/OpenIdConnectTest.md deleted file mode 100644 index c53a8c6d6df..00000000000 --- a/samples/client/petstore/kotlin/docs/components/securityschemes/OpenIdConnectTest.md +++ /dev/null @@ -1,22 +0,0 @@ -org.openapijsonschematools.client.components.securityschemes.OpenIdConnectTest -# SecurityScheme OpenIdConnectTest - -public class OpenIdConnectTest -extends OpenIdConnectSecurityScheme - -A class that is used to apply auth to a request - -### Description -openIdConnect - -### Method Summary -| Modifier and Type | Method and Description | -| ----------------- | ---------------------- | -| void | applyAuth(Map> headers, String resourcePath, String method, HttpRequest.BodyPublisher bodyPublisher, @Nullable String queryParamsSuffix, List scopeNames) | - -### Constructor Summary -| Constructor and Description | -| --------------------------- | -| todo | - -[[Back to top]](#top) [[Back to Component Security Schemes]](../../../README.md#Component-SecuritySchemes) [[Back to README]](../../../README.md) diff --git a/samples/client/petstore/kotlin/docs/components/securityschemes/PetstoreAuth.md b/samples/client/petstore/kotlin/docs/components/securityschemes/PetstoreAuth.md deleted file mode 100644 index 1a71f915c39..00000000000 --- a/samples/client/petstore/kotlin/docs/components/securityschemes/PetstoreAuth.md +++ /dev/null @@ -1,22 +0,0 @@ -org.openapijsonschematools.client.components.securityschemes.PetstoreAuth -# SecurityScheme PetstoreAuth - -public class PetstoreAuth -extends Oauth2SecurityScheme - -A class that is used to apply auth to a request - -### Description -oauth2 implicit flow with two scopes - -### Method Summary -| Modifier and Type | Method and Description | -| ----------------- | ---------------------- | -| void | applyAuth(Map> headers, String resourcePath, String method, HttpRequest.BodyPublisher bodyPublisher, @Nullable String queryParamsSuffix, List scopeNames) | - -### Constructor Summary -| Constructor and Description | -| --------------------------- | -| todo | - -[[Back to top]](#top) [[Back to Component Security Schemes]](../../../README.md#Component-SecuritySchemes) [[Back to README]](../../../README.md) diff --git a/samples/client/petstore/kotlin/docs/paths/anotherfakedummy/AnotherfakedummyPatch.md b/samples/client/petstore/kotlin/docs/paths/anotherfakedummy/AnotherfakedummyPatch.md deleted file mode 100644 index a85eb636b4c..00000000000 --- a/samples/client/petstore/kotlin/docs/paths/anotherfakedummy/AnotherfakedummyPatch.md +++ /dev/null @@ -1,188 +0,0 @@ -# AnotherfakedummyPatch - -public class AnotherfakedummyPatch - -A class that contains necessary endpoint classes -- a class that calls the endpoint method using the http verb -- a class that calls the endpoint method using the operationId name -- class(es) to store the request inputs -- builder(s) to set the request input data - -## Nested Class Summary -| Modifier and Type | Class and Description | -| ----------------- | --------------------- | -| static class | [Patch](#patch)
The class that has a patch method to call the endpoint | -| interface | [Model123TestSpecialTagsOperation](#model123testspecialtagsoperation)
The interface that has a model123TestSpecialTags method to call the endpoint | -| static class | [PatchRequest](#patchrequest)
The final request inputs class | -| static class | [PatchNullableRequest](#patchnullablerequest)
The initial request inputs class | -| static class | [Patch0RequestBuilder](#patch0requestbuilder)
A builder for the request input class | -| static class | [PatchRequestBuilder](#patchrequestbuilder)
A builder for the request input class | - -## Patch -public static class Patch extends ApiClient.ApiClient1 implements PatchOperation
- -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.AnotherfakedummyPatchRequestBody; -import org.openapijsonschematools.client.components.schemas.Client; -import org.openapijsonschematools.client.servers.RootServer0; -import org.openapijsonschematools.client.servers.RootServer1; -import org.openapijsonschematools.client.servers.RootServer2; -import org.openapijsonschematools.client.paths.anotherfakedummy.patch.responses.AnotherfakedummyPatchCode200Response; -import org.openapijsonschematools.client.servers.RootServerInfo; -import org.openapijsonschematools.client.paths.anotherfakedummy.AnotherfakedummyPatch; -import org.openapijsonschematools.client.paths.anotherfakedummy.patch.AnotherfakedummyPatchResponses; - -import java.io.IOException; -import java.util.Arrays; -import java.util.List; -import java.util.Map; -import java.util.AbstractMap; - -// if you want to use a server that is not SERVER_0 pass it in here and change the ServerIndex input below -ApiConfiguration.ServerInfo serverInfo = new ApiConfiguration.ServerInfoBuilder() - .rootServerInfo( - new RootServerInfo.RootServerInfoBuilder() - .rootServer0(new RootServer0()) - .build() - ) - .build(); -ApiConfiguration.ServerIndexInfo serverIndexInfo = new ApiConfiguration.ServerIndexInfoBuilder() - .rootServerInfoServerIndex(RootServerInfo.ServerIndex.SERVER_0) - .build(); -Duration timeout = Duration.ofSeconds(1L); -Map> defaultHeaders = Map.of("User-Agent", List.of("OpenAPI-JSON-Schema-Generator/1.0.0/java")); -ApiConfiguration apiConfiguration = new ApiConfiguration( - serverInfo - serverIndexInfo, - timeout, - defaultHeaders -); -SchemaConfiguration schemaConfiguration = new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().build()); -AnotherfakedummyPatch.Patch apiClient = new AnotherfakedummyPatch.Patch(apiConfiguration, schemaConfiguration); - - -Client1BoxedMap requestBodyPayload = - Client.Client1.validateAndBox( - new Client.ClientMapBuilder1() - .client("a") - - .build(), - schemaConfiguration -); -AnotherfakedummyPatchRequestBody.SealedRequestBody requestBody = new AnotherfakedummyPatchRequestBody.ApplicationjsonRequestBody(requestBodyPayload); - -var request = new AnotherfakedummyPatch.PatchRequestBuilder() - .requestBody(requestBody) - .build(); - -AnotherfakedummyPatchResponses.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; -} -AnotherfakedummyPatchResponses.EndpointAnotherfakedummyPatchCode200Response castResponse = (AnotherfakedummyPatchResponses.EndpointAnotherfakedummyPatchCode200Response) response; -AnotherfakedummyPatchCode200Response.ApplicationjsonResponseBody deserializedBody = (AnotherfakedummyPatchCode200Response.ApplicationjsonResponseBody) castResponse.body; -// handle deserialized body here -``` -### Constructor Summary -| Constructor and Description | -| --------------------------- | -| Patch(ApiConfiguration apiConfiguration, SchemaConfiguration schemaConfiguration)
Creates an instance | - -### Method Summary -| Modifier and Type | Method and Description | -| ----------------- | ---------------------- | -| [AnotherfakedummyPatchResponses.EndpointResponse](../../paths/anotherfakedummy/patch/AnotherfakedummyPatchResponses.md#endpointresponse) | patch([PatchRequest](#patchrequest) request) | - -## Model123TestSpecialTagsOperation -public interface Model123TestSpecialTagsOperation
- -an interface that allows one to call the endpoint using a method named model123TestSpecialTags by the operationId - -### Method Summary -| Modifier and Type | Method and Description | -| ----------------- | ---------------------- | -| [AnotherfakedummyPatchResponses.EndpointResponse](../../paths/anotherfakedummy/patch/AnotherfakedummyPatchResponses.md#endpointresponse) | model123TestSpecialTags([PatchRequest](#patchrequest) request) | - -## PatchRequest -public static class PatchRequest
- -a class that stores the final request inputs - -### Field Summary -| Modifier and Type | Field and Description | -| ----------------- | --------------------- | -| [AnotherfakedummyPatchRequestBody.SealedRequestBody](../../paths/anotherfakedummy/patch/AnotherfakedummyPatchRequestBody.md#sealedrequestbody) | requestBody | -| [RootServerInfo.@Nullable ServerIndex](../../RootServerInfo.md#serverindex) | serverIndex
optional. Note: this will override the value in apiConfiguration | -| @Nullable Duration | timeout
optional. Note: this will override the value in apiConfiguration | - -## PatchNullableRequest -public static class PatchNullableRequest
- -a class that stores the initial request inputs - -### Field Summary -| Modifier and Type | Field and Description | -| ----------------- | --------------------- | -| [AnotherfakedummyPatchRequestBody.@Nullable SealedRequestBody](../../paths/anotherfakedummy/patch/AnotherfakedummyPatchRequestBody.md#sealedrequestbody) | requestBody | -| [RootServerInfo.@Nullable ServerIndex](../../RootServerInfo.md#serverindex) | serverIndex | -| @Nullable Duration | timeout | - -## Patch0RequestBuilder -public static class Patch0RequestBuilder
- -a builder for request inputs - -### Constructor Summary -| Constructor and Description | -| --------------------------- | -| Patch0RequestBuilder(Patch0RequestBuilder instance)
Creates a builder that contains the passed instance | - -### Method Summary -| Modifier and Type | Method and Description | -| ----------------- | ---------------------- | -| [PatchRequest](#patchrequest) | build()
Returns the request input used to call an endpoint method | -| [Patch0RequestBuilder](#patch0requestbuilder) | serverIndex([RootServerInfo.ServerIndex](../../RootServerInfo.md#serverindex) serverIndex)
sets the optional property. Note: this will override the value in apiConfiguration | -| [Patch0RequestBuilder](#patch0requestbuilder) | timeout(Duration timeout)
sets the optional property. Note: this will override the value in apiConfiguration | - -## PatchRequestBuilder -public static class PatchRequestBuilder
- -a builder for request inputs - -### Constructor Summary -| Constructor and Description | -| --------------------------- | -| PatchRequestBuilder()
Creates a builder that contains null for all parameters | - -### Method Summary -| Modifier and Type | Method and Description | -| ----------------- | ---------------------- | -| [Patch0RequestBuilder](#patch0requestbuilder) | requestBody([AnotherfakedummyPatchRequestBody.SealedRequestBody](../../paths/anotherfakedummy/patch/AnotherfakedummyPatchRequestBody.md#sealedrequestbody) requestBody)
sets the property | - -[[Back to top]](#top) [[Back to README]](../../../README.md) diff --git a/samples/client/petstore/kotlin/docs/paths/anotherfakedummy/patch/AnotherfakedummyPatchRequestBody.md b/samples/client/petstore/kotlin/docs/paths/anotherfakedummy/patch/AnotherfakedummyPatchRequestBody.md deleted file mode 100644 index efa5336e17e..00000000000 --- a/samples/client/petstore/kotlin/docs/paths/anotherfakedummy/patch/AnotherfakedummyPatchRequestBody.md +++ /dev/null @@ -1,17 +0,0 @@ -# AnotherfakedummyPatchRequestBody - -public class AnotherfakedummyPatchRequestBody 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 - -## Nested Class Summary -| Modifier and Type | Class and Description | -| ----------------- | --------------------- | -| static class | [AnotherfakedummyPatchRequestBody.AnotherfakedummyPatchRequestBody1](#anotherfakedummypatchrequestbody1)
class that serializes request bodies | - -## AnotherfakedummyPatchRequestBody1 -public static class AnotherfakedummyPatchRequestBody1 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/kotlin/docs/paths/anotherfakedummy/patch/AnotherfakedummyPatchResponses.md b/samples/client/petstore/kotlin/docs/paths/anotherfakedummy/patch/AnotherfakedummyPatchResponses.md deleted file mode 100644 index 54baee69017..00000000000 --- a/samples/client/petstore/kotlin/docs/paths/anotherfakedummy/patch/AnotherfakedummyPatchResponses.md +++ /dev/null @@ -1,29 +0,0 @@ -# AnotherfakedummyPatchResponses - -public class AnotherfakedummyPatchResponses - -A class that contains necessary responses classes -- a sealed interface, EndpointResponse, that stores endpoint responses -- records for each endpoint response - -## Nested Class Summary -| Modifier and Type | Class and Description | -| ----------------- | --------------------- | -| sealed interface | [EndpointResponse](#endpointresponse)
stores the endpoint responses | -| record | [EndpointAnotherfakedummyPatchCode200Response](#endpointanotherfakedummypatchcode200response)
the response for 200 | - -## EndpointResponse -public sealed interface EndpointResponse permits
-[EndpointAnotherfakedummyPatchCode200Response](#endpointanotherfakedummypatchcode200response) - -a sealed interface that stores endpoint responses - -## EndpointAnotherfakedummyPatchCode200Response -public record EndpointAnotherfakedummyPatchCode200Response( - HttpResponse response, - [AnotherfakedummyPatchCode200Response.SealedResponseBody](../../../paths/anotherfakedummy/patch/responses/AnotherfakedummyPatchCode200Response.md#sealedresponsebody) body, - Nothing? headers -) implements EndpointResponse, ApiResponse
- -a class that stores an endpoint response - diff --git a/samples/client/petstore/kotlin/docs/paths/anotherfakedummy/patch/responses/AnotherfakedummyPatchCode200Response.md b/samples/client/petstore/kotlin/docs/paths/anotherfakedummy/patch/responses/AnotherfakedummyPatchCode200Response.md deleted file mode 100644 index cdbe61ff3ee..00000000000 --- a/samples/client/petstore/kotlin/docs/paths/anotherfakedummy/patch/responses/AnotherfakedummyPatchCode200Response.md +++ /dev/null @@ -1,87 +0,0 @@ -# AnotherfakedummyPatchCode200Response - -public class AnotherfakedummyPatchCode200Response - -A class that contains necessary nested response classes -- SealedMediaType, a sealed interface which contains all the schema/encoding info for each contentType -- records which implement SealedMediaType, the concrete media types -- SealedResponseBody, a sealed interface which contains all the contentType/schema types -- records which implement SealedResponseBody, the concrete response body types -- a class that extends ResponseDeserializer and is used to deserialize responses - -## Nested Class Summary -| Modifier and Type | Class and Description | -| ----------------- | --------------------- | -| sealed interface | [AnotherfakedummyPatchCode200Response.SealedMediaType](#sealedmediatype)
media type sealed interface | -| record | [AnotherfakedummyPatchCode200Response.ApplicationjsonMediaType](#applicationjsonmediatype)
record storing schema + encoding for a specific contentType | -| sealed interface | [AnotherfakedummyPatchCode200Response.SealedResponseBody](#sealedresponsebody)
response body sealed interface | -| record | [AnotherfakedummyPatchCode200Response.ApplicationjsonResponseBody](#applicationjsonresponsebody)
implements sealed interface to store response body | -| static class | [AnotherfakedummyPatchCode200Response.AnotherfakedummyPatchCode200Response1](#anotherfakedummypatchcode200response1)
class that deserializes responses | - -## SealedMediaType -public sealed interface SealedMediaType
-permits
-[ApplicationjsonMediaType](#applicationjsonmediatype) - -sealed interface that stores schema and encoding info - -## ApplicationjsonMediaType -public record ApplicationjsonMediaType
-implements [SealedMediaType](#sealedmediatype), MediaType<[ApplicationjsonSchema.ApplicationjsonSchema1](../../../../paths/anotherfakedummy/patch/responses/code200response/content/applicationjson/ApplicationjsonSchema.md#applicationjsonschema1), Nothing?> - -class storing schema info for a specific contentType - -### Constructor Summary -| Constructor and Description | -| --------------------------- | -| ApplicationjsonMediaType()
Creates an instance | - -### Method Summary -| Modifier and Type | Method and Description | -| ----------------- | ---------------------- | -| [ApplicationjsonSchema.ApplicationjsonSchema1](../../../../paths/anotherfakedummy/patch/responses/code200response/content/applicationjson/ApplicationjsonSchema.md#applicationjsonschema1) | schema()
the schema for this MediaType | -| Nothing? | encoding()
the encoding info | - -## SealedResponseBody -public sealed interface SealedResponseBody
-permits
-[ApplicationjsonResponseBody](#applicationjsonresponsebody) - -sealed interface that stores response body - -## ApplicationjsonResponseBody -public record ApplicationjsonResponseBody
-implements [SealedResponseBody](#sealedresponsebody) - -A record class to store response body for contentType="application/json" - -### Constructor Summary -| Constructor and Description | -| --------------------------- | -| ApplicationjsonResponseBody(ApplicationjsonSchema.[Client1Boxed](../../../../components/schemas/Client.md#client1boxed) body)
Creates an instance | - -### Method Summary -| Modifier and Type | Method and Description | -| ----------------- | ---------------------- | -| ApplicationjsonSchema.[Client1Boxed](../../../../components/schemas/Client.md#client1boxed) | body()
returns the body passed in in the constructor | - -## AnotherfakedummyPatchCode200Response1 -public static class AnotherfakedummyPatchCode200Response1
-extends ResponseDeserializer<[SealedResponseBody](#sealedresponsebody), Nothing?, [SealedMediaType](#sealedmediatype)> - -a class that deserializes responses - -### Constructor Summary -| Constructor and Description | -| --------------------------- | -| AnotherfakedummyPatchCode200Response1()
Creates an instance | - -### Field Summary -| Modifier and Type | Field and Description | -| ----------------- | --------------------- | -| 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 | -| ----------------- | ---------------------- | -| ApiResponse<[SealedResponseBody](#sealedresponsebody), Nothing?> | deserialize(HttpResponse response, SchemaConfiguration configuration)
called by endpoint when deserialize responses | diff --git a/samples/client/petstore/kotlin/docs/paths/anotherfakedummy/patch/responses/code200response/content/applicationjson/ApplicationjsonSchema.md b/samples/client/petstore/kotlin/docs/paths/anotherfakedummy/patch/responses/code200response/content/applicationjson/ApplicationjsonSchema.md deleted file mode 100644 index 534041524ca..00000000000 --- a/samples/client/petstore/kotlin/docs/paths/anotherfakedummy/patch/responses/code200response/content/applicationjson/ApplicationjsonSchema.md +++ /dev/null @@ -1,19 +0,0 @@ -# ApplicationjsonSchema -public class ApplicationjsonSchema
-extends [Client1](../../../../../../../components/schemas/Client.md#client) - -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 - -## Nested Class Summary -| Modifier and Type | Class and Description | -| ----------------- | ---------------------- | -| static class | [ApplicationjsonSchema.ApplicationjsonSchema1](#applicationjsonschema1)
schema class | - -## ApplicationjsonSchema1 -public static class ApplicationjsonSchema1
-extends [Client.Client1](../../../../../../../components/schemas/Client.md#client1) - -A schema class that validates payloads diff --git a/samples/client/petstore/kotlin/docs/paths/commonparamsubdir/CommonparamsubdirDelete.md b/samples/client/petstore/kotlin/docs/paths/commonparamsubdir/CommonparamsubdirDelete.md deleted file mode 100644 index 10427882962..00000000000 --- a/samples/client/petstore/kotlin/docs/paths/commonparamsubdir/CommonparamsubdirDelete.md +++ /dev/null @@ -1,189 +0,0 @@ -# CommonparamsubdirDelete - -public class CommonparamsubdirDelete - -A class that contains necessary endpoint classes -- a class that calls the endpoint method using the http verb -- a class that calls the endpoint method using the operationId name -- class(es) to store the request inputs -- builder(s) to set the request input data - -## Nested Class Summary -| Modifier and Type | Class and Description | -| ----------------- | --------------------- | -| static class | [Delete](#delete)
The class that has a delete method to call the endpoint | -| interface | [DeleteCommonParamOperation](#deletecommonparamoperation)
The interface that has a deleteCommonParam method to call the endpoint | -| static class | [DeleteRequest](#deleterequest)
The final request inputs class | -| static class | [DeleteNullableRequest](#deletenullablerequest)
The initial request inputs class | -| static class | [Delete0RequestBuilder](#delete0requestbuilder)
A builder for the request input class | -| static class | [DeleteRequestBuilder](#deleterequestbuilder)
A builder for the request input class | - -## Delete -public static class Delete extends ApiClient.ApiClient1 implements DeleteOperation
- -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.CommonparamsubdirDeleteHeaderParameters; -import org.openapijsonschematools.client.RootServerInfo; -import org.openapijsonschematools.client.paths.commonparamsubdir.delete.CommonparamsubdirDeletePathParameters; -import org.openapijsonschematools.client.servers.RootServer0; -import org.openapijsonschematools.client.servers.RootServer1; -import org.openapijsonschematools.client.servers.RootServer2; -import org.openapijsonschematools.client.paths.commonparamsubdir.delete.responses.CommonparamsubdirDeleteCode200Response; -import org.openapijsonschematools.client.servers.RootServerInfo; -import org.openapijsonschematools.client.paths.commonparamsubdir.CommonparamsubdirDelete; -import org.openapijsonschematools.client.paths.commonparamsubdir.delete.CommonparamsubdirDeleteResponses; - -import java.io.IOException; -import java.util.Arrays; -import java.util.List; -import java.util.Map; -import java.util.AbstractMap; - -// if you want to use a server that is not SERVER_0 pass it in here and change the ServerIndex input below -ApiConfiguration.ServerInfo serverInfo = new ApiConfiguration.ServerInfoBuilder() - .rootServerInfo( - new RootServerInfo.RootServerInfoBuilder() - .rootServer0(new RootServer0()) - .build() - ) - .build(); -ApiConfiguration.ServerIndexInfo serverIndexInfo = new ApiConfiguration.ServerIndexInfoBuilder() - .rootServerInfoServerIndex(RootServerInfo.ServerIndex.SERVER_0) - .build(); -Duration timeout = Duration.ofSeconds(1L); -Map> defaultHeaders = Map.of("User-Agent", List.of("OpenAPI-JSON-Schema-Generator/1.0.0/java")); -ApiConfiguration apiConfiguration = new ApiConfiguration( - serverInfo - serverIndexInfo, - timeout, - defaultHeaders -); -SchemaConfiguration schemaConfiguration = new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().build()); -CommonparamsubdirDelete.Delete apiClient = new CommonparamsubdirDelete.Delete(apiConfiguration, schemaConfiguration); - - -// Map validation -CommonparamsubdirDeletePathParameters.PathParametersMap pathParameters = - CommonparamsubdirDeletePathParameters.CommonparamsubdirDeletePathParameters1.validate( - new CommonparamsubdirDeletePathParameters.PathParametersMapBuilder() - .subDir("c") - - .build(), - schemaConfiguration -); - -var request = new CommonparamsubdirDelete.DeleteRequestBuilder() - .pathParameters(pathParameters) - .build(); - -CommonparamsubdirDeleteResponses.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; -} -CommonparamsubdirDeleteResponses.EndpointCommonparamsubdirDeleteCode200Response castResponse = (CommonparamsubdirDeleteResponses.EndpointCommonparamsubdirDeleteCode200Response) response; -``` -### Constructor Summary -| Constructor and Description | -| --------------------------- | -| Delete(ApiConfiguration apiConfiguration, SchemaConfiguration schemaConfiguration)
Creates an instance | - -### Method Summary -| Modifier and Type | Method and Description | -| ----------------- | ---------------------- | -| [CommonparamsubdirDeleteResponses.EndpointResponse](../../paths/commonparamsubdir/delete/CommonparamsubdirDeleteResponses.md#endpointresponse) | delete([DeleteRequest](#deleterequest) request) | - -## DeleteCommonParamOperation -public interface DeleteCommonParamOperation
- -an interface that allows one to call the endpoint using a method named deleteCommonParam by the operationId - -### Method Summary -| Modifier and Type | Method and Description | -| ----------------- | ---------------------- | -| [CommonparamsubdirDeleteResponses.EndpointResponse](../../paths/commonparamsubdir/delete/CommonparamsubdirDeleteResponses.md#endpointresponse) | deleteCommonParam([DeleteRequest](#deleterequest) request) | - -## DeleteRequest -public static class DeleteRequest
- -a class that stores the final request inputs - -### Field Summary -| Modifier and Type | Field and Description | -| ----------------- | --------------------- | -| [CommonparamsubdirDeletePathParameters.PathParametersMap](../../paths/commonparamsubdir/delete/CommonparamsubdirDeletePathParameters.md#pathparametersmap) | pathParameters | -| [CommonparamsubdirDeleteHeaderParameters.@Nullable HeaderParametersMap](../../paths/commonparamsubdir/delete/CommonparamsubdirDeleteHeaderParameters.md#headerparametersmap) | headerParameters
optional | -| [RootServerInfo.@Nullable ServerIndex](../../RootServerInfo.md#serverindex) | serverIndex
optional. Note: this will override the value in apiConfiguration | -| @Nullable Duration | timeout
optional. Note: this will override the value in apiConfiguration | - -## DeleteNullableRequest -public static class DeleteNullableRequest
- -a class that stores the initial request inputs - -### Field Summary -| Modifier and Type | Field and Description | -| ----------------- | --------------------- | -| [CommonparamsubdirDeletePathParameters.@Nullable PathParametersMap](../../paths/commonparamsubdir/delete/CommonparamsubdirDeletePathParameters.md#pathparametersmap) | pathParameters | -| [CommonparamsubdirDeleteHeaderParameters.@Nullable HeaderParametersMap](../../paths/commonparamsubdir/delete/CommonparamsubdirDeleteHeaderParameters.md#headerparametersmap) | headerParameters | -| [RootServerInfo.@Nullable ServerIndex](../../RootServerInfo.md#serverindex) | serverIndex | -| @Nullable Duration | timeout | - -## Delete0RequestBuilder -public static class Delete0RequestBuilder
- -a builder for request inputs - -### Constructor Summary -| Constructor and Description | -| --------------------------- | -| Delete0RequestBuilder(Delete0RequestBuilder instance)
Creates a builder that contains the passed instance | - -### Method Summary -| Modifier and Type | Method and Description | -| ----------------- | ---------------------- | -| [DeleteRequest](#deleterequest) | build()
Returns the request input used to call an endpoint method | -| [Delete0RequestBuilder](#delete0requestbuilder) | headerParameters([CommonparamsubdirDeleteHeaderParametersHeaderParametersMap](../../paths/commonparamsubdir/delete/CommonparamsubdirDeleteHeaderParameters.md#headerparametersmap) headerParameters)
sets the optional property | -| [Delete0RequestBuilder](#delete0requestbuilder) | serverIndex([RootServerInfo.ServerIndex](../../RootServerInfo.md#serverindex) serverIndex)
sets the optional property. Note: this will override the value in apiConfiguration | -| [Delete0RequestBuilder](#delete0requestbuilder) | timeout(Duration timeout)
sets the optional property. Note: this will override the value in apiConfiguration | - -## DeleteRequestBuilder -public static class DeleteRequestBuilder
- -a builder for request inputs - -### Constructor Summary -| Constructor and Description | -| --------------------------- | -| DeleteRequestBuilder()
Creates a builder that contains null for all parameters | - -### Method Summary -| Modifier and Type | Method and Description | -| ----------------- | ---------------------- | -| [Delete0RequestBuilder](#delete0requestbuilder) | pathParameters([CommonparamsubdirDeletePathParametersPathParametersMap](../../paths/commonparamsubdir/delete/CommonparamsubdirDeletePathParameters.md#pathparametersmap) pathParameters)
sets the property | - -[[Back to top]](#top) [[Back to README]](../../../README.md) diff --git a/samples/client/petstore/kotlin/docs/paths/commonparamsubdir/CommonparamsubdirGet.md b/samples/client/petstore/kotlin/docs/paths/commonparamsubdir/CommonparamsubdirGet.md deleted file mode 100644 index a3ff40c51bc..00000000000 --- a/samples/client/petstore/kotlin/docs/paths/commonparamsubdir/CommonparamsubdirGet.md +++ /dev/null @@ -1,189 +0,0 @@ -# CommonparamsubdirGet - -public class CommonparamsubdirGet - -A class that contains necessary endpoint classes -- a class that calls the endpoint method using the http verb -- a class that calls the endpoint method using the operationId name -- class(es) to store the request inputs -- builder(s) to set the request input data - -## Nested Class Summary -| Modifier and Type | Class and Description | -| ----------------- | --------------------- | -| static class | [Get](#get)
The class that has a get method to call the endpoint | -| interface | [GetCommonParamOperation](#getcommonparamoperation)
The interface that has a getCommonParam method to call the endpoint | -| static class | [GetRequest](#getrequest)
The final request inputs class | -| static class | [GetNullableRequest](#getnullablerequest)
The initial request inputs class | -| static class | [Get0RequestBuilder](#get0requestbuilder)
A builder for the request input class | -| static class | [GetRequestBuilder](#getrequestbuilder)
A builder for the request input class | - -## Get -public static class Get extends ApiClient.ApiClient1 implements GetOperation
- -a class that allows one to call the endpoint using a method named get - -### 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.get.CommonparamsubdirGetQueryParameters; -import org.openapijsonschematools.client.RootServerInfo; -import org.openapijsonschematools.client.paths.commonparamsubdir.get.CommonparamsubdirGetPathParameters; -import org.openapijsonschematools.client.servers.RootServer0; -import org.openapijsonschematools.client.servers.RootServer1; -import org.openapijsonschematools.client.servers.RootServer2; -import org.openapijsonschematools.client.paths.commonparamsubdir.get.responses.CommonparamsubdirGetCode200Response; -import org.openapijsonschematools.client.servers.RootServerInfo; -import org.openapijsonschematools.client.paths.commonparamsubdir.CommonparamsubdirGet; -import org.openapijsonschematools.client.paths.commonparamsubdir.get.CommonparamsubdirGetResponses; - -import java.io.IOException; -import java.util.Arrays; -import java.util.List; -import java.util.Map; -import java.util.AbstractMap; - -// if you want to use a server that is not SERVER_0 pass it in here and change the ServerIndex input below -ApiConfiguration.ServerInfo serverInfo = new ApiConfiguration.ServerInfoBuilder() - .rootServerInfo( - new RootServerInfo.RootServerInfoBuilder() - .rootServer0(new RootServer0()) - .build() - ) - .build(); -ApiConfiguration.ServerIndexInfo serverIndexInfo = new ApiConfiguration.ServerIndexInfoBuilder() - .rootServerInfoServerIndex(RootServerInfo.ServerIndex.SERVER_0) - .build(); -Duration timeout = Duration.ofSeconds(1L); -Map> defaultHeaders = Map.of("User-Agent", List.of("OpenAPI-JSON-Schema-Generator/1.0.0/java")); -ApiConfiguration apiConfiguration = new ApiConfiguration( - serverInfo - serverIndexInfo, - timeout, - defaultHeaders -); -SchemaConfiguration schemaConfiguration = new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().build()); -CommonparamsubdirGet.Get apiClient = new CommonparamsubdirGet.Get(apiConfiguration, schemaConfiguration); - - -// Map validation -CommonparamsubdirGetPathParameters.PathParametersMap pathParameters = - CommonparamsubdirGetPathParameters.CommonparamsubdirGetPathParameters1.validate( - new CommonparamsubdirGetPathParameters.PathParametersMapBuilder() - .subDir("a") - - .build(), - schemaConfiguration -); - -var request = new CommonparamsubdirGet.GetRequestBuilder() - .pathParameters(pathParameters) - .build(); - -CommonparamsubdirGetResponses.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; -} -CommonparamsubdirGetResponses.EndpointCommonparamsubdirGetCode200Response castResponse = (CommonparamsubdirGetResponses.EndpointCommonparamsubdirGetCode200Response) response; -``` -### Constructor Summary -| Constructor and Description | -| --------------------------- | -| Get(ApiConfiguration apiConfiguration, SchemaConfiguration schemaConfiguration)
Creates an instance | - -### Method Summary -| Modifier and Type | Method and Description | -| ----------------- | ---------------------- | -| [CommonparamsubdirGetResponses.EndpointResponse](../../paths/commonparamsubdir/get/CommonparamsubdirGetResponses.md#endpointresponse) | get([GetRequest](#getrequest) request) | - -## GetCommonParamOperation -public interface GetCommonParamOperation
- -an interface that allows one to call the endpoint using a method named getCommonParam by the operationId - -### Method Summary -| Modifier and Type | Method and Description | -| ----------------- | ---------------------- | -| [CommonparamsubdirGetResponses.EndpointResponse](../../paths/commonparamsubdir/get/CommonparamsubdirGetResponses.md#endpointresponse) | getCommonParam([GetRequest](#getrequest) request) | - -## GetRequest -public static class GetRequest
- -a class that stores the final request inputs - -### Field Summary -| Modifier and Type | Field and Description | -| ----------------- | --------------------- | -| [CommonparamsubdirGetPathParameters.PathParametersMap](../../paths/commonparamsubdir/get/CommonparamsubdirGetPathParameters.md#pathparametersmap) | pathParameters | -| [CommonparamsubdirGetQueryParameters.@Nullable QueryParametersMap](../../paths/commonparamsubdir/get/CommonparamsubdirGetQueryParameters.md#queryparametersmap) | queryParameters
optional | -| [RootServerInfo.@Nullable ServerIndex](../../RootServerInfo.md#serverindex) | serverIndex
optional. Note: this will override the value in apiConfiguration | -| @Nullable Duration | timeout
optional. Note: this will override the value in apiConfiguration | - -## GetNullableRequest -public static class GetNullableRequest
- -a class that stores the initial request inputs - -### Field Summary -| Modifier and Type | Field and Description | -| ----------------- | --------------------- | -| [CommonparamsubdirGetPathParameters.@Nullable PathParametersMap](../../paths/commonparamsubdir/get/CommonparamsubdirGetPathParameters.md#pathparametersmap) | pathParameters | -| [CommonparamsubdirGetQueryParameters.@Nullable QueryParametersMap](../../paths/commonparamsubdir/get/CommonparamsubdirGetQueryParameters.md#queryparametersmap) | queryParameters | -| [RootServerInfo.@Nullable ServerIndex](../../RootServerInfo.md#serverindex) | serverIndex | -| @Nullable Duration | timeout | - -## Get0RequestBuilder -public static class Get0RequestBuilder
- -a builder for request inputs - -### Constructor Summary -| Constructor and Description | -| --------------------------- | -| Get0RequestBuilder(Get0RequestBuilder instance)
Creates a builder that contains the passed instance | - -### Method Summary -| Modifier and Type | Method and Description | -| ----------------- | ---------------------- | -| [GetRequest](#getrequest) | build()
Returns the request input used to call an endpoint method | -| [Get0RequestBuilder](#get0requestbuilder) | queryParameters([CommonparamsubdirGetQueryParametersQueryParametersMap](../../paths/commonparamsubdir/get/CommonparamsubdirGetQueryParameters.md#queryparametersmap) queryParameters)
sets the optional property | -| [Get0RequestBuilder](#get0requestbuilder) | serverIndex([RootServerInfo.ServerIndex](../../RootServerInfo.md#serverindex) serverIndex)
sets the optional property. Note: this will override the value in apiConfiguration | -| [Get0RequestBuilder](#get0requestbuilder) | timeout(Duration timeout)
sets the optional property. Note: this will override the value in apiConfiguration | - -## GetRequestBuilder -public static class GetRequestBuilder
- -a builder for request inputs - -### Constructor Summary -| Constructor and Description | -| --------------------------- | -| GetRequestBuilder()
Creates a builder that contains null for all parameters | - -### Method Summary -| Modifier and Type | Method and Description | -| ----------------- | ---------------------- | -| [Get0RequestBuilder](#get0requestbuilder) | pathParameters([CommonparamsubdirGetPathParametersPathParametersMap](../../paths/commonparamsubdir/get/CommonparamsubdirGetPathParameters.md#pathparametersmap) pathParameters)
sets the property | - -[[Back to top]](#top) [[Back to README]](../../../README.md) diff --git a/samples/client/petstore/kotlin/docs/paths/commonparamsubdir/CommonparamsubdirPost.md b/samples/client/petstore/kotlin/docs/paths/commonparamsubdir/CommonparamsubdirPost.md deleted file mode 100644 index f55668cf6c5..00000000000 --- a/samples/client/petstore/kotlin/docs/paths/commonparamsubdir/CommonparamsubdirPost.md +++ /dev/null @@ -1,189 +0,0 @@ -# CommonparamsubdirPost - -public class CommonparamsubdirPost - -A class that contains necessary endpoint classes -- a class that calls the endpoint method using the http verb -- a class that calls the endpoint method using the operationId name -- class(es) to store the request inputs -- builder(s) to set the request input data - -## Nested Class Summary -| Modifier and Type | Class and Description | -| ----------------- | --------------------- | -| static class | [Post](#post)
The class that has a post method to call the endpoint | -| interface | [PostCommonParamOperation](#postcommonparamoperation)
The interface that has a postCommonParam method to call the endpoint | -| static class | [PostRequest](#postrequest)
The final request inputs class | -| static class | [PostNullableRequest](#postnullablerequest)
The initial request inputs class | -| static class | [Post0RequestBuilder](#post0requestbuilder)
A builder for the request input class | -| static class | [PostRequestBuilder](#postrequestbuilder)
A builder for the request input class | - -## Post -public static class Post 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.commonparamsubdir.post.CommonparamsubdirPostHeaderParameters; -import org.openapijsonschematools.client.RootServerInfo; -import org.openapijsonschematools.client.paths.commonparamsubdir.post.CommonparamsubdirPostPathParameters; -import org.openapijsonschematools.client.servers.RootServer0; -import org.openapijsonschematools.client.servers.RootServer1; -import org.openapijsonschematools.client.servers.RootServer2; -import org.openapijsonschematools.client.paths.commonparamsubdir.post.responses.CommonparamsubdirPostCode200Response; -import org.openapijsonschematools.client.servers.RootServerInfo; -import org.openapijsonschematools.client.paths.commonparamsubdir.CommonparamsubdirPost; -import org.openapijsonschematools.client.paths.commonparamsubdir.post.CommonparamsubdirPostResponses; - -import java.io.IOException; -import java.util.Arrays; -import java.util.List; -import java.util.Map; -import java.util.AbstractMap; - -// if you want to use a server that is not SERVER_0 pass it in here and change the ServerIndex input below -ApiConfiguration.ServerInfo serverInfo = new ApiConfiguration.ServerInfoBuilder() - .rootServerInfo( - new RootServerInfo.RootServerInfoBuilder() - .rootServer0(new RootServer0()) - .build() - ) - .build(); -ApiConfiguration.ServerIndexInfo serverIndexInfo = new ApiConfiguration.ServerIndexInfoBuilder() - .rootServerInfoServerIndex(RootServerInfo.ServerIndex.SERVER_0) - .build(); -Duration timeout = Duration.ofSeconds(1L); -Map> defaultHeaders = Map.of("User-Agent", List.of("OpenAPI-JSON-Schema-Generator/1.0.0/java")); -ApiConfiguration apiConfiguration = new ApiConfiguration( - serverInfo - serverIndexInfo, - timeout, - defaultHeaders -); -SchemaConfiguration schemaConfiguration = new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().build()); -CommonparamsubdirPost.Post apiClient = new CommonparamsubdirPost.Post(apiConfiguration, schemaConfiguration); - - -// Map validation -CommonparamsubdirPostPathParameters.PathParametersMap pathParameters = - CommonparamsubdirPostPathParameters.CommonparamsubdirPostPathParameters1.validate( - new CommonparamsubdirPostPathParameters.PathParametersMapBuilder() - .subDir("a") - - .build(), - schemaConfiguration -); - -var request = new CommonparamsubdirPost.PostRequestBuilder() - .pathParameters(pathParameters) - .build(); - -CommonparamsubdirPostResponses.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; -} -CommonparamsubdirPostResponses.EndpointCommonparamsubdirPostCode200Response castResponse = (CommonparamsubdirPostResponses.EndpointCommonparamsubdirPostCode200Response) response; -``` -### Constructor Summary -| Constructor and Description | -| --------------------------- | -| Post(ApiConfiguration apiConfiguration, SchemaConfiguration schemaConfiguration)
Creates an instance | - -### Method Summary -| Modifier and Type | Method and Description | -| ----------------- | ---------------------- | -| [CommonparamsubdirPostResponses.EndpointResponse](../../paths/commonparamsubdir/post/CommonparamsubdirPostResponses.md#endpointresponse) | post([PostRequest](#postrequest) request) | - -## PostCommonParamOperation -public interface PostCommonParamOperation
- -an interface that allows one to call the endpoint using a method named postCommonParam by the operationId - -### Method Summary -| Modifier and Type | Method and Description | -| ----------------- | ---------------------- | -| [CommonparamsubdirPostResponses.EndpointResponse](../../paths/commonparamsubdir/post/CommonparamsubdirPostResponses.md#endpointresponse) | postCommonParam([PostRequest](#postrequest) request) | - -## PostRequest -public static class PostRequest
- -a class that stores the final request inputs - -### Field Summary -| Modifier and Type | Field and Description | -| ----------------- | --------------------- | -| [CommonparamsubdirPostPathParameters.PathParametersMap](../../paths/commonparamsubdir/post/CommonparamsubdirPostPathParameters.md#pathparametersmap) | pathParameters | -| [CommonparamsubdirPostHeaderParameters.@Nullable HeaderParametersMap](../../paths/commonparamsubdir/post/CommonparamsubdirPostHeaderParameters.md#headerparametersmap) | headerParameters
optional | -| [RootServerInfo.@Nullable ServerIndex](../../RootServerInfo.md#serverindex) | serverIndex
optional. Note: this will override the value in apiConfiguration | -| @Nullable Duration | timeout
optional. Note: this will override the value in apiConfiguration | - -## PostNullableRequest -public static class PostNullableRequest
- -a class that stores the initial request inputs - -### Field Summary -| Modifier and Type | Field and Description | -| ----------------- | --------------------- | -| [CommonparamsubdirPostPathParameters.@Nullable PathParametersMap](../../paths/commonparamsubdir/post/CommonparamsubdirPostPathParameters.md#pathparametersmap) | pathParameters | -| [CommonparamsubdirPostHeaderParameters.@Nullable HeaderParametersMap](../../paths/commonparamsubdir/post/CommonparamsubdirPostHeaderParameters.md#headerparametersmap) | headerParameters | -| [RootServerInfo.@Nullable ServerIndex](../../RootServerInfo.md#serverindex) | serverIndex | -| @Nullable Duration | timeout | - -## Post0RequestBuilder -public static class Post0RequestBuilder
- -a builder for request inputs - -### Constructor Summary -| Constructor and Description | -| --------------------------- | -| Post0RequestBuilder(Post0RequestBuilder instance)
Creates a builder that contains the passed instance | - -### Method Summary -| Modifier and Type | Method and Description | -| ----------------- | ---------------------- | -| [PostRequest](#postrequest) | build()
Returns the request input used to call an endpoint method | -| [Post0RequestBuilder](#post0requestbuilder) | headerParameters([CommonparamsubdirPostHeaderParametersHeaderParametersMap](../../paths/commonparamsubdir/post/CommonparamsubdirPostHeaderParameters.md#headerparametersmap) headerParameters)
sets the optional property | -| [Post0RequestBuilder](#post0requestbuilder) | serverIndex([RootServerInfo.ServerIndex](../../RootServerInfo.md#serverindex) serverIndex)
sets the optional property. Note: this will override the value in apiConfiguration | -| [Post0RequestBuilder](#post0requestbuilder) | timeout(Duration timeout)
sets the optional property. Note: this will override the value in apiConfiguration | - -## PostRequestBuilder -public static class PostRequestBuilder
- -a builder for request inputs - -### Constructor Summary -| Constructor and Description | -| --------------------------- | -| PostRequestBuilder()
Creates a builder that contains null for all parameters | - -### Method Summary -| Modifier and Type | Method and Description | -| ----------------- | ---------------------- | -| [Post0RequestBuilder](#post0requestbuilder) | pathParameters([CommonparamsubdirPostPathParametersPathParametersMap](../../paths/commonparamsubdir/post/CommonparamsubdirPostPathParameters.md#pathparametersmap) pathParameters)
sets the property | - -[[Back to top]](#top) [[Back to README]](../../../README.md) diff --git a/samples/client/petstore/kotlin/docs/paths/commonparamsubdir/delete/CommonparamsubdirDeleteHeaderParameters.md b/samples/client/petstore/kotlin/docs/paths/commonparamsubdir/delete/CommonparamsubdirDeleteHeaderParameters.md deleted file mode 100644 index 03ce1e35104..00000000000 --- a/samples/client/petstore/kotlin/docs/paths/commonparamsubdir/delete/CommonparamsubdirDeleteHeaderParameters.md +++ /dev/null @@ -1,252 +0,0 @@ -# CommonparamsubdirDeleteHeaderParameters -public class CommonparamsubdirDeleteHeaderParameters
- -A class that contains necessary nested -- schema classes (which validate payloads), extends JsonSchema -- sealed interfaces which store validated payloads, java version of a sum type -- boxed classes which store validated payloads, sealed permits class implementations -- classes to store validated map payloads, extends FrozenMap -- classes to build inputs for map payloads - -## Nested Class Summary -| Modifier and Type | Class and Description | -| ----------------- | ---------------------- | -| sealed interface | [CommonparamsubdirDeleteHeaderParameters.CommonparamsubdirDeleteHeaderParameters1Boxed](#commonparamsubdirdeleteheaderparameters1boxed)
sealed interface for validated payloads | -| record | [CommonparamsubdirDeleteHeaderParameters.CommonparamsubdirDeleteHeaderParameters1BoxedMap](#commonparamsubdirdeleteheaderparameters1boxedmap)
boxed class to store validated Map payloads | -| static class | [CommonparamsubdirDeleteHeaderParameters.CommonparamsubdirDeleteHeaderParameters1](#commonparamsubdirdeleteheaderparameters1)
schema class | -| static class | [CommonparamsubdirDeleteHeaderParameters.HeaderParametersMapBuilder](#headerparametersmapbuilder)
builder for Map payloads | -| static class | [CommonparamsubdirDeleteHeaderParameters.HeaderParametersMap](#headerparametersmap)
output class for Map payloads | -| sealed interface | [CommonparamsubdirDeleteHeaderParameters.AdditionalPropertiesBoxed](#additionalpropertiesboxed)
sealed interface for validated payloads | -| record | [CommonparamsubdirDeleteHeaderParameters.AdditionalPropertiesBoxedVoid](#additionalpropertiesboxedvoid)
boxed class to store validated null payloads | -| record | [CommonparamsubdirDeleteHeaderParameters.AdditionalPropertiesBoxedBoolean](#additionalpropertiesboxedboolean)
boxed class to store validated boolean payloads | -| record | [CommonparamsubdirDeleteHeaderParameters.AdditionalPropertiesBoxedNumber](#additionalpropertiesboxednumber)
boxed class to store validated Number payloads | -| record | [CommonparamsubdirDeleteHeaderParameters.AdditionalPropertiesBoxedString](#additionalpropertiesboxedstring)
boxed class to store validated String payloads | -| record | [CommonparamsubdirDeleteHeaderParameters.AdditionalPropertiesBoxedList](#additionalpropertiesboxedlist)
boxed class to store validated List payloads | -| record | [CommonparamsubdirDeleteHeaderParameters.AdditionalPropertiesBoxedMap](#additionalpropertiesboxedmap)
boxed class to store validated Map payloads | -| static class | [CommonparamsubdirDeleteHeaderParameters.AdditionalProperties](#additionalproperties)
schema class | - -## CommonparamsubdirDeleteHeaderParameters1Boxed -public sealed interface CommonparamsubdirDeleteHeaderParameters1Boxed
-permits
-[CommonparamsubdirDeleteHeaderParameters1BoxedMap](#commonparamsubdirdeleteheaderparameters1boxedmap) - -sealed interface that stores validated payloads using boxed classes - -## CommonparamsubdirDeleteHeaderParameters1BoxedMap -public record CommonparamsubdirDeleteHeaderParameters1BoxedMap
-implements [CommonparamsubdirDeleteHeaderParameters1Boxed](#commonparamsubdirdeleteheaderparameters1boxed) - -record that stores validated Map payloads, sealed permits implementation - -### Constructor Summary -| Constructor and Description | -| --------------------------- | -| CommonparamsubdirDeleteHeaderParameters1BoxedMap([HeaderParametersMap](#headerparametersmap) data)
Creates an instance, private visibility | - -### Method Summary -| Modifier and Type | Method and Description | -| ----------------- | ---------------------- | -| [HeaderParametersMap](#headerparametersmap) | data()
validated payload | -| @Nullable Object | getData()
validated payload | - -## CommonparamsubdirDeleteHeaderParameters1 -public static class CommonparamsubdirDeleteHeaderParameters1
-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.commonparamsubdir.delete.CommonparamsubdirDeleteHeaderParameters; - -import java.util.Arrays; -import java.util.List; -import java.util.AbstractMap; - -static final SchemaConfiguration configuration = new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().build()); - -// Map validation -CommonparamsubdirDeleteHeaderParameters.HeaderParametersMap validatedPayload = - CommonparamsubdirDeleteHeaderParameters.CommonparamsubdirDeleteHeaderParameters1.validate( - new CommonparamsubdirDeleteHeaderParameters.HeaderParametersMapBuilder() - .someHeader("a") - - .build(), - configuration -); -``` - -### Field Summary -| Modifier and Type | Field and Description | -| ----------------- | ---------------------- | -| Set> | type = Set.of(Map.class) | -| Map> | properties = Map.ofEntries(
    new PropertyEntry("someHeader", [Schema0.Schema01.class](../../../paths/commonparamsubdir/delete/parameters/parameter0/Schema0.md#schema01))
)
| -| Class | additionalProperties = [AdditionalProperties.class](#additionalproperties) | - -### Method Summary -| Modifier and Type | Method and Description | -| ----------------- | ---------------------- | -| [HeaderParametersMap](#headerparametersmap) | validate([Map<?, ?>](#headerparametersmapbuilder) arg, SchemaConfiguration configuration) | -| [CommonparamsubdirDeleteHeaderParameters1BoxedMap](#commonparamsubdirdeleteheaderparameters1boxedmap) | validateAndBox([Map<?, ?>](#headerparametersmapbuilder) arg, SchemaConfiguration configuration) | -| [CommonparamsubdirDeleteHeaderParameters1Boxed](#commonparamsubdirdeleteheaderparameters1boxed) | validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) | -| @Nullable Object | validate(@Nullable Object arg, SchemaConfiguration configuration) | - -## HeaderParametersMapBuilder -public class HeaderParametersMapBuilder
-builder for `Map` - -A class that builds the Map input type - -### Constructor Summary -| Constructor and Description | -| --------------------------- | -| HeaderParametersMapBuilder()
Creates a builder that contains an empty map | - -### Method Summary -| Modifier and Type | Method and Description | -| ----------------- | ---------------------- | -| Map | build()
Returns map input that should be used with Schema.validate | -| [HeaderParametersMapBuilder](#headerparametersmapbuilder) | someHeader(String value) | - -## HeaderParametersMap -public static class HeaderParametersMap
-extends FrozenMap - -A class to store validated Map payloads - -### Method Summary -| Modifier and Type | Method and Description | -| ----------------- | ---------------------- | -| static [HeaderParametersMap](#headerparametersmap) | of([Map](#headerparametersmapbuilder) arg, SchemaConfiguration configuration) | -| String | someHeader()
[optional] | - -## 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(Nothing? data)
Creates an instance, private visibility | - -### Method Summary -| Modifier and Type | Method and Description | -| ----------------- | ---------------------- | -| Nothing? | 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/kotlin/docs/paths/commonparamsubdir/delete/CommonparamsubdirDeletePathParameters.md b/samples/client/petstore/kotlin/docs/paths/commonparamsubdir/delete/CommonparamsubdirDeletePathParameters.md deleted file mode 100644 index 0c0dd18e40d..00000000000 --- a/samples/client/petstore/kotlin/docs/paths/commonparamsubdir/delete/CommonparamsubdirDeletePathParameters.md +++ /dev/null @@ -1,269 +0,0 @@ -# CommonparamsubdirDeletePathParameters -public class CommonparamsubdirDeletePathParameters
- -A class that contains necessary nested -- schema classes (which validate payloads), extends JsonSchema -- sealed interfaces which store validated payloads, java version of a sum type -- boxed classes which store validated payloads, sealed permits class implementations -- classes to store validated map payloads, extends FrozenMap -- classes to build inputs for map payloads - -## Nested Class Summary -| Modifier and Type | Class and Description | -| ----------------- | ---------------------- | -| sealed interface | [CommonparamsubdirDeletePathParameters.CommonparamsubdirDeletePathParameters1Boxed](#commonparamsubdirdeletepathparameters1boxed)
sealed interface for validated payloads | -| record | [CommonparamsubdirDeletePathParameters.CommonparamsubdirDeletePathParameters1BoxedMap](#commonparamsubdirdeletepathparameters1boxedmap)
boxed class to store validated Map payloads | -| static class | [CommonparamsubdirDeletePathParameters.CommonparamsubdirDeletePathParameters1](#commonparamsubdirdeletepathparameters1)
schema class | -| static class | [CommonparamsubdirDeletePathParameters.PathParametersMapBuilder](#pathparametersmapbuilder)
builder for Map payloads | -| static class | [CommonparamsubdirDeletePathParameters.PathParametersMap](#pathparametersmap)
output class for Map payloads | -| sealed interface | [CommonparamsubdirDeletePathParameters.AdditionalPropertiesBoxed](#additionalpropertiesboxed)
sealed interface for validated payloads | -| record | [CommonparamsubdirDeletePathParameters.AdditionalPropertiesBoxedVoid](#additionalpropertiesboxedvoid)
boxed class to store validated null payloads | -| record | [CommonparamsubdirDeletePathParameters.AdditionalPropertiesBoxedBoolean](#additionalpropertiesboxedboolean)
boxed class to store validated boolean payloads | -| record | [CommonparamsubdirDeletePathParameters.AdditionalPropertiesBoxedNumber](#additionalpropertiesboxednumber)
boxed class to store validated Number payloads | -| record | [CommonparamsubdirDeletePathParameters.AdditionalPropertiesBoxedString](#additionalpropertiesboxedstring)
boxed class to store validated String payloads | -| record | [CommonparamsubdirDeletePathParameters.AdditionalPropertiesBoxedList](#additionalpropertiesboxedlist)
boxed class to store validated List payloads | -| record | [CommonparamsubdirDeletePathParameters.AdditionalPropertiesBoxedMap](#additionalpropertiesboxedmap)
boxed class to store validated Map payloads | -| static class | [CommonparamsubdirDeletePathParameters.AdditionalProperties](#additionalproperties)
schema class | - -## CommonparamsubdirDeletePathParameters1Boxed -public sealed interface CommonparamsubdirDeletePathParameters1Boxed
-permits
-[CommonparamsubdirDeletePathParameters1BoxedMap](#commonparamsubdirdeletepathparameters1boxedmap) - -sealed interface that stores validated payloads using boxed classes - -## CommonparamsubdirDeletePathParameters1BoxedMap -public record CommonparamsubdirDeletePathParameters1BoxedMap
-implements [CommonparamsubdirDeletePathParameters1Boxed](#commonparamsubdirdeletepathparameters1boxed) - -record that stores validated Map payloads, sealed permits implementation - -### Constructor Summary -| Constructor and Description | -| --------------------------- | -| CommonparamsubdirDeletePathParameters1BoxedMap([PathParametersMap](#pathparametersmap) data)
Creates an instance, private visibility | - -### Method Summary -| Modifier and Type | Method and Description | -| ----------------- | ---------------------- | -| [PathParametersMap](#pathparametersmap) | data()
validated payload | -| @Nullable Object | getData()
validated payload | - -## CommonparamsubdirDeletePathParameters1 -public static class CommonparamsubdirDeletePathParameters1
-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.commonparamsubdir.delete.CommonparamsubdirDeletePathParameters; - -import java.util.Arrays; -import java.util.List; -import java.util.AbstractMap; - -static final SchemaConfiguration configuration = new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().build()); - -// Map validation -CommonparamsubdirDeletePathParameters.PathParametersMap validatedPayload = - CommonparamsubdirDeletePathParameters.CommonparamsubdirDeletePathParameters1.validate( - new CommonparamsubdirDeletePathParameters.PathParametersMapBuilder() - .subDir("c") - - .build(), - configuration -); -``` - -### Field Summary -| Modifier and Type | Field and Description | -| ----------------- | ---------------------- | -| Set> | type = Set.of(Map.class) | -| Map> | properties = Map.ofEntries(
    new PropertyEntry("subDir", [Schema1.Schema11.class](../../../paths/commonparamsubdir/delete/parameters/parameter1/Schema1.md#schema11))
)
| -| Set | required = Set.of(
    "subDir"
)
| -| Class | additionalProperties = [AdditionalProperties.class](#additionalproperties) | - -### Method Summary -| Modifier and Type | Method and Description | -| ----------------- | ---------------------- | -| [PathParametersMap](#pathparametersmap) | validate([Map<?, ?>](#pathparametersmapbuilder) arg, SchemaConfiguration configuration) | -| [CommonparamsubdirDeletePathParameters1BoxedMap](#commonparamsubdirdeletepathparameters1boxedmap) | validateAndBox([Map<?, ?>](#pathparametersmapbuilder) arg, SchemaConfiguration configuration) | -| [CommonparamsubdirDeletePathParameters1Boxed](#commonparamsubdirdeletepathparameters1boxed) | validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) | -| @Nullable Object | validate(@Nullable Object arg, SchemaConfiguration configuration) | - -## PathParametersMap0Builder -public class PathParametersMap0Builder
-builder for `Map` - -A class that builds the Map input type - -### Constructor Summary -| Constructor and Description | -| --------------------------- | -| PathParametersMap0Builder(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 | - -## PathParametersMapBuilder -public class PathParametersMapBuilder
-builder for `Map` - -A class that builds the Map input type - -### Constructor Summary -| Constructor and Description | -| --------------------------- | -| PathParametersMapBuilder()
Creates a builder that contains an empty map | - -### Method Summary -| Modifier and Type | Method and Description | -| ----------------- | ---------------------- | -| [PathParametersMap0Builder](#pathparametersmap0builder) | subDir(String value) | -| [PathParametersMap0Builder](#pathparametersmap0builder) | subDir([Schema1.StringSchemaEnums1](../../../paths/commonparamsubdir/delete/parameters/parameter1/Schema1.md#stringschemaenums1) value) | - -## PathParametersMap -public static class PathParametersMap
-extends FrozenMap - -A class to store validated Map payloads - -### Method Summary -| Modifier and Type | Method and Description | -| ----------------- | ---------------------- | -| static [PathParametersMap](#pathparametersmap) | of([Map](#pathparametersmapbuilder) arg, SchemaConfiguration configuration) | -| String | subDir()
| - -## 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(Nothing? data)
Creates an instance, private visibility | - -### Method Summary -| Modifier and Type | Method and Description | -| ----------------- | ---------------------- | -| Nothing? | 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/kotlin/docs/paths/commonparamsubdir/delete/CommonparamsubdirDeleteResponses.md b/samples/client/petstore/kotlin/docs/paths/commonparamsubdir/delete/CommonparamsubdirDeleteResponses.md deleted file mode 100644 index 8cfcc7816e7..00000000000 --- a/samples/client/petstore/kotlin/docs/paths/commonparamsubdir/delete/CommonparamsubdirDeleteResponses.md +++ /dev/null @@ -1,29 +0,0 @@ -# CommonparamsubdirDeleteResponses - -public class CommonparamsubdirDeleteResponses - -A class that contains necessary responses classes -- a sealed interface, EndpointResponse, that stores endpoint responses -- records for each endpoint response - -## Nested Class Summary -| Modifier and Type | Class and Description | -| ----------------- | --------------------- | -| sealed interface | [EndpointResponse](#endpointresponse)
stores the endpoint responses | -| record | [EndpointCommonparamsubdirDeleteCode200Response](#endpointcommonparamsubdirdeletecode200response)
the response for 200 | - -## EndpointResponse -public sealed interface EndpointResponse permits
-[EndpointCommonparamsubdirDeleteCode200Response](#endpointcommonparamsubdirdeletecode200response) - -a sealed interface that stores endpoint responses - -## EndpointCommonparamsubdirDeleteCode200Response -public record EndpointCommonparamsubdirDeleteCode200Response( - HttpResponse response, - Nothing? body, - Nothing? headers -) implements EndpointResponse, ApiResponse
- -a class that stores an endpoint response - diff --git a/samples/client/petstore/kotlin/docs/paths/commonparamsubdir/delete/parameters/parameter0/Schema0.md b/samples/client/petstore/kotlin/docs/paths/commonparamsubdir/delete/parameters/parameter0/Schema0.md deleted file mode 100644 index 9ff90e0bc35..00000000000 --- a/samples/client/petstore/kotlin/docs/paths/commonparamsubdir/delete/parameters/parameter0/Schema0.md +++ /dev/null @@ -1,49 +0,0 @@ -# Schema0 -public class Schema0
- -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 - -## Nested Class Summary -| Modifier and Type | Class and Description | -| ----------------- | ---------------------- | -| sealed interface | [Schema0.Schema01Boxed](#schema01boxed)
sealed interface for validated payloads | -| record | [Schema0.Schema01BoxedString](#schema01boxedstring)
boxed class to store validated String payloads | -| static class | [Schema0.Schema01](#schema01)
schema class | - -## Schema01Boxed -public sealed interface Schema01Boxed
-permits
-[Schema01BoxedString](#schema01boxedstring) - -sealed interface that stores validated payloads using boxed classes - -## Schema01BoxedString -public record Schema01BoxedString
-implements [Schema01Boxed](#schema01boxed) - -record that stores validated String payloads, sealed permits implementation - -### Constructor Summary -| Constructor and Description | -| --------------------------- | -| Schema01BoxedString(String data)
Creates an instance, private visibility | - -### Method Summary -| Modifier and Type | Method and Description | -| ----------------- | ---------------------- | -| String | data()
validated payload | -| @Nullable Object | getData()
validated payload | - -## Schema01 -public static class Schema01
-extends StringJsonSchema.StringJsonSchema1 - -A schema class that validates payloads - -| Methods Inherited from class org.openapijsonschematools.client.schemas.StringJsonSchema.StringJsonSchema1 | -| ------------------------------------------------------------------ | -| validate | -| validateAndBox | diff --git a/samples/client/petstore/kotlin/docs/paths/commonparamsubdir/delete/parameters/parameter1/Schema1.md b/samples/client/petstore/kotlin/docs/paths/commonparamsubdir/delete/parameters/parameter1/Schema1.md deleted file mode 100644 index ef5c82182ba..00000000000 --- a/samples/client/petstore/kotlin/docs/paths/commonparamsubdir/delete/parameters/parameter1/Schema1.md +++ /dev/null @@ -1,96 +0,0 @@ -# Schema1 -public class Schema1
- -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 -- enum classes - -## Nested Class Summary -| Modifier and Type | Class and Description | -| ----------------- | ---------------------- | -| sealed interface | [Schema1.Schema11Boxed](#schema11boxed)
sealed interface for validated payloads | -| record | [Schema1.Schema11BoxedString](#schema11boxedstring)
boxed class to store validated String payloads | -| static class | [Schema1.Schema11](#schema11)
schema class | -| enum | [Schema1.StringSchemaEnums1](#stringschemaenums1)
String enum | - -## Schema11Boxed -public sealed interface Schema11Boxed
-permits
-[Schema11BoxedString](#schema11boxedstring) - -sealed interface that stores validated payloads using boxed classes - -## Schema11BoxedString -public record Schema11BoxedString
-implements [Schema11Boxed](#schema11boxed) - -record that stores validated String payloads, sealed permits implementation - -### Constructor Summary -| Constructor and Description | -| --------------------------- | -| Schema11BoxedString(String data)
Creates an instance, private visibility | - -### Method Summary -| Modifier and Type | Method and Description | -| ----------------- | ---------------------- | -| String | data()
validated payload | -| @Nullable Object | getData()
validated payload | - -## Schema11 -public static class Schema11
-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.commonparamsubdir.delete.parameters.parameter1.Schema1; - -import java.util.Arrays; -import java.util.List; -import java.util.AbstractMap; - -static final SchemaConfiguration configuration = new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().build()); - -// String validation -String validatedPayload = Schema1.Schema11.validate( - "c", - configuration -); -``` - -### Field Summary -| Modifier and Type | Field and Description | -| ----------------- | ---------------------- | -| Set> | type = Set.of(
    String.class
)
| -| Set | enumValues = SetMaker.makeSet(
    "c",
    "d"
)
| - -### Method Summary -| Modifier and Type | Method and Description | -| ----------------- | ---------------------- | -| String | validate(String arg, SchemaConfiguration configuration) | -| String | validate([StringSchemaEnums1](#stringschemaenums1) arg, SchemaConfiguration configuration) | -| [Schema11BoxedString](#schema11boxedstring) | validateAndBox(String arg, SchemaConfiguration configuration) | -| [Schema11Boxed](#schema11boxed) | validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) | -| @Nullable Object | validate(@Nullable Object arg, SchemaConfiguration configuration) | - -## StringSchemaEnums1 -public enum StringSchemaEnums1
-extends `Enum` - -A class that stores String enum values - -### Enum Constant Summary -| Enum Constant | Description | -| ------------- | ----------- | -| C | value = "c" | -| D | value = "d" | diff --git a/samples/client/petstore/kotlin/docs/paths/commonparamsubdir/delete/responses/CommonparamsubdirDeleteCode200Response.md b/samples/client/petstore/kotlin/docs/paths/commonparamsubdir/delete/responses/CommonparamsubdirDeleteCode200Response.md deleted file mode 100644 index 7781a6df85d..00000000000 --- a/samples/client/petstore/kotlin/docs/paths/commonparamsubdir/delete/responses/CommonparamsubdirDeleteCode200Response.md +++ /dev/null @@ -1,17 +0,0 @@ -# CommonparamsubdirDeleteCode200Response - -public class CommonparamsubdirDeleteCode200Response extends [SuccessDescriptionOnly](../../components/responses/SuccessDescriptionOnly.md) - -A class (extended from the $ref class) that contains necessary nested response classes -- a class that extends ResponseDeserializer and is used to deserialize responses - -## Nested Class Summary -| Modifier and Type | Class and Description | -| ----------------- | --------------------- | -| static class | [CommonparamsubdirDeleteCode200Response.CommonparamsubdirDeleteCode200Response1](#commonparamsubdirdeletecode200response1)
class that deserializes responses | - -## CommonparamsubdirDeleteCode200Response1 -public static class CommonparamsubdirDeleteCode200Response1 extends [SuccessDescriptionOnly1](../../components/responses/SuccessDescriptionOnly.md#successdescriptiononly1)
- -a class that deserializes responses, extended from the $ref class - diff --git a/samples/client/petstore/kotlin/docs/paths/commonparamsubdir/get/CommonparamsubdirGetPathParameters.md b/samples/client/petstore/kotlin/docs/paths/commonparamsubdir/get/CommonparamsubdirGetPathParameters.md deleted file mode 100644 index dd6790c7029..00000000000 --- a/samples/client/petstore/kotlin/docs/paths/commonparamsubdir/get/CommonparamsubdirGetPathParameters.md +++ /dev/null @@ -1,269 +0,0 @@ -# CommonparamsubdirGetPathParameters -public class CommonparamsubdirGetPathParameters
- -A class that contains necessary nested -- schema classes (which validate payloads), extends JsonSchema -- sealed interfaces which store validated payloads, java version of a sum type -- boxed classes which store validated payloads, sealed permits class implementations -- classes to store validated map payloads, extends FrozenMap -- classes to build inputs for map payloads - -## Nested Class Summary -| Modifier and Type | Class and Description | -| ----------------- | ---------------------- | -| sealed interface | [CommonparamsubdirGetPathParameters.CommonparamsubdirGetPathParameters1Boxed](#commonparamsubdirgetpathparameters1boxed)
sealed interface for validated payloads | -| record | [CommonparamsubdirGetPathParameters.CommonparamsubdirGetPathParameters1BoxedMap](#commonparamsubdirgetpathparameters1boxedmap)
boxed class to store validated Map payloads | -| static class | [CommonparamsubdirGetPathParameters.CommonparamsubdirGetPathParameters1](#commonparamsubdirgetpathparameters1)
schema class | -| static class | [CommonparamsubdirGetPathParameters.PathParametersMapBuilder](#pathparametersmapbuilder)
builder for Map payloads | -| static class | [CommonparamsubdirGetPathParameters.PathParametersMap](#pathparametersmap)
output class for Map payloads | -| sealed interface | [CommonparamsubdirGetPathParameters.AdditionalPropertiesBoxed](#additionalpropertiesboxed)
sealed interface for validated payloads | -| record | [CommonparamsubdirGetPathParameters.AdditionalPropertiesBoxedVoid](#additionalpropertiesboxedvoid)
boxed class to store validated null payloads | -| record | [CommonparamsubdirGetPathParameters.AdditionalPropertiesBoxedBoolean](#additionalpropertiesboxedboolean)
boxed class to store validated boolean payloads | -| record | [CommonparamsubdirGetPathParameters.AdditionalPropertiesBoxedNumber](#additionalpropertiesboxednumber)
boxed class to store validated Number payloads | -| record | [CommonparamsubdirGetPathParameters.AdditionalPropertiesBoxedString](#additionalpropertiesboxedstring)
boxed class to store validated String payloads | -| record | [CommonparamsubdirGetPathParameters.AdditionalPropertiesBoxedList](#additionalpropertiesboxedlist)
boxed class to store validated List payloads | -| record | [CommonparamsubdirGetPathParameters.AdditionalPropertiesBoxedMap](#additionalpropertiesboxedmap)
boxed class to store validated Map payloads | -| static class | [CommonparamsubdirGetPathParameters.AdditionalProperties](#additionalproperties)
schema class | - -## CommonparamsubdirGetPathParameters1Boxed -public sealed interface CommonparamsubdirGetPathParameters1Boxed
-permits
-[CommonparamsubdirGetPathParameters1BoxedMap](#commonparamsubdirgetpathparameters1boxedmap) - -sealed interface that stores validated payloads using boxed classes - -## CommonparamsubdirGetPathParameters1BoxedMap -public record CommonparamsubdirGetPathParameters1BoxedMap
-implements [CommonparamsubdirGetPathParameters1Boxed](#commonparamsubdirgetpathparameters1boxed) - -record that stores validated Map payloads, sealed permits implementation - -### Constructor Summary -| Constructor and Description | -| --------------------------- | -| CommonparamsubdirGetPathParameters1BoxedMap([PathParametersMap](#pathparametersmap) data)
Creates an instance, private visibility | - -### Method Summary -| Modifier and Type | Method and Description | -| ----------------- | ---------------------- | -| [PathParametersMap](#pathparametersmap) | data()
validated payload | -| @Nullable Object | getData()
validated payload | - -## CommonparamsubdirGetPathParameters1 -public static class CommonparamsubdirGetPathParameters1
-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.commonparamsubdir.get.CommonparamsubdirGetPathParameters; - -import java.util.Arrays; -import java.util.List; -import java.util.AbstractMap; - -static final SchemaConfiguration configuration = new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().build()); - -// Map validation -CommonparamsubdirGetPathParameters.PathParametersMap validatedPayload = - CommonparamsubdirGetPathParameters.CommonparamsubdirGetPathParameters1.validate( - new CommonparamsubdirGetPathParameters.PathParametersMapBuilder() - .subDir("a") - - .build(), - configuration -); -``` - -### Field Summary -| Modifier and Type | Field and Description | -| ----------------- | ---------------------- | -| Set> | type = Set.of(Map.class) | -| Map> | properties = Map.ofEntries(
    new PropertyEntry("subDir", [RouteParamSchema0.RouteParamSchema01.class](../../../paths/commonparamsubdir/parameters/routeparameter0/RouteParamSchema0.md#routeparamschema01))
)
| -| Set | required = Set.of(
    "subDir"
)
| -| Class | additionalProperties = [AdditionalProperties.class](#additionalproperties) | - -### Method Summary -| Modifier and Type | Method and Description | -| ----------------- | ---------------------- | -| [PathParametersMap](#pathparametersmap) | validate([Map<?, ?>](#pathparametersmapbuilder) arg, SchemaConfiguration configuration) | -| [CommonparamsubdirGetPathParameters1BoxedMap](#commonparamsubdirgetpathparameters1boxedmap) | validateAndBox([Map<?, ?>](#pathparametersmapbuilder) arg, SchemaConfiguration configuration) | -| [CommonparamsubdirGetPathParameters1Boxed](#commonparamsubdirgetpathparameters1boxed) | validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) | -| @Nullable Object | validate(@Nullable Object arg, SchemaConfiguration configuration) | - -## PathParametersMap0Builder -public class PathParametersMap0Builder
-builder for `Map` - -A class that builds the Map input type - -### Constructor Summary -| Constructor and Description | -| --------------------------- | -| PathParametersMap0Builder(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 | - -## PathParametersMapBuilder -public class PathParametersMapBuilder
-builder for `Map` - -A class that builds the Map input type - -### Constructor Summary -| Constructor and Description | -| --------------------------- | -| PathParametersMapBuilder()
Creates a builder that contains an empty map | - -### Method Summary -| Modifier and Type | Method and Description | -| ----------------- | ---------------------- | -| [PathParametersMap0Builder](#pathparametersmap0builder) | subDir(String value) | -| [PathParametersMap0Builder](#pathparametersmap0builder) | subDir([RouteParamSchema0.StringRouteParamSchemaEnums0](../../../paths/commonparamsubdir/parameters/routeparameter0/RouteParamSchema0.md#stringrouteparamschemaenums0) value) | - -## PathParametersMap -public static class PathParametersMap
-extends FrozenMap - -A class to store validated Map payloads - -### Method Summary -| Modifier and Type | Method and Description | -| ----------------- | ---------------------- | -| static [PathParametersMap](#pathparametersmap) | of([Map](#pathparametersmapbuilder) arg, SchemaConfiguration configuration) | -| String | subDir()
| - -## 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(Nothing? data)
Creates an instance, private visibility | - -### Method Summary -| Modifier and Type | Method and Description | -| ----------------- | ---------------------- | -| Nothing? | 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/kotlin/docs/paths/commonparamsubdir/get/CommonparamsubdirGetQueryParameters.md b/samples/client/petstore/kotlin/docs/paths/commonparamsubdir/get/CommonparamsubdirGetQueryParameters.md deleted file mode 100644 index 8ccc75d91c1..00000000000 --- a/samples/client/petstore/kotlin/docs/paths/commonparamsubdir/get/CommonparamsubdirGetQueryParameters.md +++ /dev/null @@ -1,252 +0,0 @@ -# CommonparamsubdirGetQueryParameters -public class CommonparamsubdirGetQueryParameters
- -A class that contains necessary nested -- schema classes (which validate payloads), extends JsonSchema -- sealed interfaces which store validated payloads, java version of a sum type -- boxed classes which store validated payloads, sealed permits class implementations -- classes to store validated map payloads, extends FrozenMap -- classes to build inputs for map payloads - -## Nested Class Summary -| Modifier and Type | Class and Description | -| ----------------- | ---------------------- | -| sealed interface | [CommonparamsubdirGetQueryParameters.CommonparamsubdirGetQueryParameters1Boxed](#commonparamsubdirgetqueryparameters1boxed)
sealed interface for validated payloads | -| record | [CommonparamsubdirGetQueryParameters.CommonparamsubdirGetQueryParameters1BoxedMap](#commonparamsubdirgetqueryparameters1boxedmap)
boxed class to store validated Map payloads | -| static class | [CommonparamsubdirGetQueryParameters.CommonparamsubdirGetQueryParameters1](#commonparamsubdirgetqueryparameters1)
schema class | -| static class | [CommonparamsubdirGetQueryParameters.QueryParametersMapBuilder](#queryparametersmapbuilder)
builder for Map payloads | -| static class | [CommonparamsubdirGetQueryParameters.QueryParametersMap](#queryparametersmap)
output class for Map payloads | -| sealed interface | [CommonparamsubdirGetQueryParameters.AdditionalPropertiesBoxed](#additionalpropertiesboxed)
sealed interface for validated payloads | -| record | [CommonparamsubdirGetQueryParameters.AdditionalPropertiesBoxedVoid](#additionalpropertiesboxedvoid)
boxed class to store validated null payloads | -| record | [CommonparamsubdirGetQueryParameters.AdditionalPropertiesBoxedBoolean](#additionalpropertiesboxedboolean)
boxed class to store validated boolean payloads | -| record | [CommonparamsubdirGetQueryParameters.AdditionalPropertiesBoxedNumber](#additionalpropertiesboxednumber)
boxed class to store validated Number payloads | -| record | [CommonparamsubdirGetQueryParameters.AdditionalPropertiesBoxedString](#additionalpropertiesboxedstring)
boxed class to store validated String payloads | -| record | [CommonparamsubdirGetQueryParameters.AdditionalPropertiesBoxedList](#additionalpropertiesboxedlist)
boxed class to store validated List payloads | -| record | [CommonparamsubdirGetQueryParameters.AdditionalPropertiesBoxedMap](#additionalpropertiesboxedmap)
boxed class to store validated Map payloads | -| static class | [CommonparamsubdirGetQueryParameters.AdditionalProperties](#additionalproperties)
schema class | - -## CommonparamsubdirGetQueryParameters1Boxed -public sealed interface CommonparamsubdirGetQueryParameters1Boxed
-permits
-[CommonparamsubdirGetQueryParameters1BoxedMap](#commonparamsubdirgetqueryparameters1boxedmap) - -sealed interface that stores validated payloads using boxed classes - -## CommonparamsubdirGetQueryParameters1BoxedMap -public record CommonparamsubdirGetQueryParameters1BoxedMap
-implements [CommonparamsubdirGetQueryParameters1Boxed](#commonparamsubdirgetqueryparameters1boxed) - -record that stores validated Map payloads, sealed permits implementation - -### Constructor Summary -| Constructor and Description | -| --------------------------- | -| CommonparamsubdirGetQueryParameters1BoxedMap([QueryParametersMap](#queryparametersmap) data)
Creates an instance, private visibility | - -### Method Summary -| Modifier and Type | Method and Description | -| ----------------- | ---------------------- | -| [QueryParametersMap](#queryparametersmap) | data()
validated payload | -| @Nullable Object | getData()
validated payload | - -## CommonparamsubdirGetQueryParameters1 -public static class CommonparamsubdirGetQueryParameters1
-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.commonparamsubdir.get.CommonparamsubdirGetQueryParameters; - -import java.util.Arrays; -import java.util.List; -import java.util.AbstractMap; - -static final SchemaConfiguration configuration = new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().build()); - -// Map validation -CommonparamsubdirGetQueryParameters.QueryParametersMap validatedPayload = - CommonparamsubdirGetQueryParameters.CommonparamsubdirGetQueryParameters1.validate( - new CommonparamsubdirGetQueryParameters.QueryParametersMapBuilder() - .searchStr("a") - - .build(), - configuration -); -``` - -### Field Summary -| Modifier and Type | Field and Description | -| ----------------- | ---------------------- | -| Set> | type = Set.of(Map.class) | -| Map> | properties = Map.ofEntries(
    new PropertyEntry("searchStr", [Schema0.Schema01.class](../../../paths/commonparamsubdir/get/parameters/parameter0/Schema0.md#schema01))
)
| -| Class | additionalProperties = [AdditionalProperties.class](#additionalproperties) | - -### Method Summary -| Modifier and Type | Method and Description | -| ----------------- | ---------------------- | -| [QueryParametersMap](#queryparametersmap) | validate([Map<?, ?>](#queryparametersmapbuilder) arg, SchemaConfiguration configuration) | -| [CommonparamsubdirGetQueryParameters1BoxedMap](#commonparamsubdirgetqueryparameters1boxedmap) | validateAndBox([Map<?, ?>](#queryparametersmapbuilder) arg, SchemaConfiguration configuration) | -| [CommonparamsubdirGetQueryParameters1Boxed](#commonparamsubdirgetqueryparameters1boxed) | validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) | -| @Nullable Object | validate(@Nullable Object arg, SchemaConfiguration configuration) | - -## QueryParametersMapBuilder -public class QueryParametersMapBuilder
-builder for `Map` - -A class that builds the Map input type - -### Constructor Summary -| Constructor and Description | -| --------------------------- | -| QueryParametersMapBuilder()
Creates a builder that contains an empty map | - -### Method Summary -| Modifier and Type | Method and Description | -| ----------------- | ---------------------- | -| Map | build()
Returns map input that should be used with Schema.validate | -| [QueryParametersMapBuilder](#queryparametersmapbuilder) | searchStr(String value) | - -## QueryParametersMap -public static class QueryParametersMap
-extends FrozenMap - -A class to store validated Map payloads - -### Method Summary -| Modifier and Type | Method and Description | -| ----------------- | ---------------------- | -| static [QueryParametersMap](#queryparametersmap) | of([Map](#queryparametersmapbuilder) arg, SchemaConfiguration configuration) | -| String | searchStr()
[optional] | - -## 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(Nothing? data)
Creates an instance, private visibility | - -### Method Summary -| Modifier and Type | Method and Description | -| ----------------- | ---------------------- | -| Nothing? | 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/kotlin/docs/paths/commonparamsubdir/get/CommonparamsubdirGetResponses.md b/samples/client/petstore/kotlin/docs/paths/commonparamsubdir/get/CommonparamsubdirGetResponses.md deleted file mode 100644 index 2fe9a9b9b40..00000000000 --- a/samples/client/petstore/kotlin/docs/paths/commonparamsubdir/get/CommonparamsubdirGetResponses.md +++ /dev/null @@ -1,29 +0,0 @@ -# CommonparamsubdirGetResponses - -public class CommonparamsubdirGetResponses - -A class that contains necessary responses classes -- a sealed interface, EndpointResponse, that stores endpoint responses -- records for each endpoint response - -## Nested Class Summary -| Modifier and Type | Class and Description | -| ----------------- | --------------------- | -| sealed interface | [EndpointResponse](#endpointresponse)
stores the endpoint responses | -| record | [EndpointCommonparamsubdirGetCode200Response](#endpointcommonparamsubdirgetcode200response)
the response for 200 | - -## EndpointResponse -public sealed interface EndpointResponse permits
-[EndpointCommonparamsubdirGetCode200Response](#endpointcommonparamsubdirgetcode200response) - -a sealed interface that stores endpoint responses - -## EndpointCommonparamsubdirGetCode200Response -public record EndpointCommonparamsubdirGetCode200Response( - HttpResponse response, - Nothing? body, - Nothing? headers -) implements EndpointResponse, ApiResponse
- -a class that stores an endpoint response - diff --git a/samples/client/petstore/kotlin/docs/paths/commonparamsubdir/get/parameters/parameter0/Schema0.md b/samples/client/petstore/kotlin/docs/paths/commonparamsubdir/get/parameters/parameter0/Schema0.md deleted file mode 100644 index 9ff90e0bc35..00000000000 --- a/samples/client/petstore/kotlin/docs/paths/commonparamsubdir/get/parameters/parameter0/Schema0.md +++ /dev/null @@ -1,49 +0,0 @@ -# Schema0 -public class Schema0
- -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 - -## Nested Class Summary -| Modifier and Type | Class and Description | -| ----------------- | ---------------------- | -| sealed interface | [Schema0.Schema01Boxed](#schema01boxed)
sealed interface for validated payloads | -| record | [Schema0.Schema01BoxedString](#schema01boxedstring)
boxed class to store validated String payloads | -| static class | [Schema0.Schema01](#schema01)
schema class | - -## Schema01Boxed -public sealed interface Schema01Boxed
-permits
-[Schema01BoxedString](#schema01boxedstring) - -sealed interface that stores validated payloads using boxed classes - -## Schema01BoxedString -public record Schema01BoxedString
-implements [Schema01Boxed](#schema01boxed) - -record that stores validated String payloads, sealed permits implementation - -### Constructor Summary -| Constructor and Description | -| --------------------------- | -| Schema01BoxedString(String data)
Creates an instance, private visibility | - -### Method Summary -| Modifier and Type | Method and Description | -| ----------------- | ---------------------- | -| String | data()
validated payload | -| @Nullable Object | getData()
validated payload | - -## Schema01 -public static class Schema01
-extends StringJsonSchema.StringJsonSchema1 - -A schema class that validates payloads - -| Methods Inherited from class org.openapijsonschematools.client.schemas.StringJsonSchema.StringJsonSchema1 | -| ------------------------------------------------------------------ | -| validate | -| validateAndBox | diff --git a/samples/client/petstore/kotlin/docs/paths/commonparamsubdir/get/responses/CommonparamsubdirGetCode200Response.md b/samples/client/petstore/kotlin/docs/paths/commonparamsubdir/get/responses/CommonparamsubdirGetCode200Response.md deleted file mode 100644 index 11da3fc2681..00000000000 --- a/samples/client/petstore/kotlin/docs/paths/commonparamsubdir/get/responses/CommonparamsubdirGetCode200Response.md +++ /dev/null @@ -1,17 +0,0 @@ -# CommonparamsubdirGetCode200Response - -public class CommonparamsubdirGetCode200Response extends [SuccessDescriptionOnly](../../components/responses/SuccessDescriptionOnly.md) - -A class (extended from the $ref class) that contains necessary nested response classes -- a class that extends ResponseDeserializer and is used to deserialize responses - -## Nested Class Summary -| Modifier and Type | Class and Description | -| ----------------- | --------------------- | -| static class | [CommonparamsubdirGetCode200Response.CommonparamsubdirGetCode200Response1](#commonparamsubdirgetcode200response1)
class that deserializes responses | - -## CommonparamsubdirGetCode200Response1 -public static class CommonparamsubdirGetCode200Response1 extends [SuccessDescriptionOnly1](../../components/responses/SuccessDescriptionOnly.md#successdescriptiononly1)
- -a class that deserializes responses, extended from the $ref class - diff --git a/samples/client/petstore/kotlin/docs/paths/commonparamsubdir/parameters/routeparameter0/RouteParamSchema0.md b/samples/client/petstore/kotlin/docs/paths/commonparamsubdir/parameters/routeparameter0/RouteParamSchema0.md deleted file mode 100644 index a21f308c2ea..00000000000 --- a/samples/client/petstore/kotlin/docs/paths/commonparamsubdir/parameters/routeparameter0/RouteParamSchema0.md +++ /dev/null @@ -1,96 +0,0 @@ -# RouteParamSchema0 -public class RouteParamSchema0
- -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 -- enum classes - -## Nested Class Summary -| Modifier and Type | Class and Description | -| ----------------- | ---------------------- | -| sealed interface | [RouteParamSchema0.RouteParamSchema01Boxed](#routeparamschema01boxed)
sealed interface for validated payloads | -| record | [RouteParamSchema0.RouteParamSchema01BoxedString](#routeparamschema01boxedstring)
boxed class to store validated String payloads | -| static class | [RouteParamSchema0.RouteParamSchema01](#routeparamschema01)
schema class | -| enum | [RouteParamSchema0.StringRouteParamSchemaEnums0](#stringrouteparamschemaenums0)
String enum | - -## RouteParamSchema01Boxed -public sealed interface RouteParamSchema01Boxed
-permits
-[RouteParamSchema01BoxedString](#routeparamschema01boxedstring) - -sealed interface that stores validated payloads using boxed classes - -## RouteParamSchema01BoxedString -public record RouteParamSchema01BoxedString
-implements [RouteParamSchema01Boxed](#routeparamschema01boxed) - -record that stores validated String payloads, sealed permits implementation - -### Constructor Summary -| Constructor and Description | -| --------------------------- | -| RouteParamSchema01BoxedString(String data)
Creates an instance, private visibility | - -### Method Summary -| Modifier and Type | Method and Description | -| ----------------- | ---------------------- | -| String | data()
validated payload | -| @Nullable Object | getData()
validated payload | - -## RouteParamSchema01 -public static class RouteParamSchema01
-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.commonparamsubdir.parameters.routeparameter0.RouteParamSchema0; - -import java.util.Arrays; -import java.util.List; -import java.util.AbstractMap; - -static final SchemaConfiguration configuration = new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().build()); - -// String validation -String validatedPayload = RouteParamSchema0.RouteParamSchema01.validate( - "a", - configuration -); -``` - -### Field Summary -| Modifier and Type | Field and Description | -| ----------------- | ---------------------- | -| Set> | type = Set.of(
    String.class
)
| -| Set | enumValues = SetMaker.makeSet(
    "a",
    "b"
)
| - -### Method Summary -| Modifier and Type | Method and Description | -| ----------------- | ---------------------- | -| String | validate(String arg, SchemaConfiguration configuration) | -| String | validate([StringRouteParamSchemaEnums0](#stringrouteparamschemaenums0) arg, SchemaConfiguration configuration) | -| [RouteParamSchema01BoxedString](#routeparamschema01boxedstring) | validateAndBox(String arg, SchemaConfiguration configuration) | -| [RouteParamSchema01Boxed](#routeparamschema01boxed) | validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) | -| @Nullable Object | validate(@Nullable Object arg, SchemaConfiguration configuration) | - -## StringRouteParamSchemaEnums0 -public enum StringRouteParamSchemaEnums0
-extends `Enum` - -A class that stores String enum values - -### Enum Constant Summary -| Enum Constant | Description | -| ------------- | ----------- | -| A | value = "a" | -| B | value = "b" | diff --git a/samples/client/petstore/kotlin/docs/paths/commonparamsubdir/post/CommonparamsubdirPostHeaderParameters.md b/samples/client/petstore/kotlin/docs/paths/commonparamsubdir/post/CommonparamsubdirPostHeaderParameters.md deleted file mode 100644 index 2bac00c6ce3..00000000000 --- a/samples/client/petstore/kotlin/docs/paths/commonparamsubdir/post/CommonparamsubdirPostHeaderParameters.md +++ /dev/null @@ -1,252 +0,0 @@ -# CommonparamsubdirPostHeaderParameters -public class CommonparamsubdirPostHeaderParameters
- -A class that contains necessary nested -- schema classes (which validate payloads), extends JsonSchema -- sealed interfaces which store validated payloads, java version of a sum type -- boxed classes which store validated payloads, sealed permits class implementations -- classes to store validated map payloads, extends FrozenMap -- classes to build inputs for map payloads - -## Nested Class Summary -| Modifier and Type | Class and Description | -| ----------------- | ---------------------- | -| sealed interface | [CommonparamsubdirPostHeaderParameters.CommonparamsubdirPostHeaderParameters1Boxed](#commonparamsubdirpostheaderparameters1boxed)
sealed interface for validated payloads | -| record | [CommonparamsubdirPostHeaderParameters.CommonparamsubdirPostHeaderParameters1BoxedMap](#commonparamsubdirpostheaderparameters1boxedmap)
boxed class to store validated Map payloads | -| static class | [CommonparamsubdirPostHeaderParameters.CommonparamsubdirPostHeaderParameters1](#commonparamsubdirpostheaderparameters1)
schema class | -| static class | [CommonparamsubdirPostHeaderParameters.HeaderParametersMapBuilder](#headerparametersmapbuilder)
builder for Map payloads | -| static class | [CommonparamsubdirPostHeaderParameters.HeaderParametersMap](#headerparametersmap)
output class for Map payloads | -| sealed interface | [CommonparamsubdirPostHeaderParameters.AdditionalPropertiesBoxed](#additionalpropertiesboxed)
sealed interface for validated payloads | -| record | [CommonparamsubdirPostHeaderParameters.AdditionalPropertiesBoxedVoid](#additionalpropertiesboxedvoid)
boxed class to store validated null payloads | -| record | [CommonparamsubdirPostHeaderParameters.AdditionalPropertiesBoxedBoolean](#additionalpropertiesboxedboolean)
boxed class to store validated boolean payloads | -| record | [CommonparamsubdirPostHeaderParameters.AdditionalPropertiesBoxedNumber](#additionalpropertiesboxednumber)
boxed class to store validated Number payloads | -| record | [CommonparamsubdirPostHeaderParameters.AdditionalPropertiesBoxedString](#additionalpropertiesboxedstring)
boxed class to store validated String payloads | -| record | [CommonparamsubdirPostHeaderParameters.AdditionalPropertiesBoxedList](#additionalpropertiesboxedlist)
boxed class to store validated List payloads | -| record | [CommonparamsubdirPostHeaderParameters.AdditionalPropertiesBoxedMap](#additionalpropertiesboxedmap)
boxed class to store validated Map payloads | -| static class | [CommonparamsubdirPostHeaderParameters.AdditionalProperties](#additionalproperties)
schema class | - -## CommonparamsubdirPostHeaderParameters1Boxed -public sealed interface CommonparamsubdirPostHeaderParameters1Boxed
-permits
-[CommonparamsubdirPostHeaderParameters1BoxedMap](#commonparamsubdirpostheaderparameters1boxedmap) - -sealed interface that stores validated payloads using boxed classes - -## CommonparamsubdirPostHeaderParameters1BoxedMap -public record CommonparamsubdirPostHeaderParameters1BoxedMap
-implements [CommonparamsubdirPostHeaderParameters1Boxed](#commonparamsubdirpostheaderparameters1boxed) - -record that stores validated Map payloads, sealed permits implementation - -### Constructor Summary -| Constructor and Description | -| --------------------------- | -| CommonparamsubdirPostHeaderParameters1BoxedMap([HeaderParametersMap](#headerparametersmap) data)
Creates an instance, private visibility | - -### Method Summary -| Modifier and Type | Method and Description | -| ----------------- | ---------------------- | -| [HeaderParametersMap](#headerparametersmap) | data()
validated payload | -| @Nullable Object | getData()
validated payload | - -## CommonparamsubdirPostHeaderParameters1 -public static class CommonparamsubdirPostHeaderParameters1
-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.commonparamsubdir.post.CommonparamsubdirPostHeaderParameters; - -import java.util.Arrays; -import java.util.List; -import java.util.AbstractMap; - -static final SchemaConfiguration configuration = new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().build()); - -// Map validation -CommonparamsubdirPostHeaderParameters.HeaderParametersMap validatedPayload = - CommonparamsubdirPostHeaderParameters.CommonparamsubdirPostHeaderParameters1.validate( - new CommonparamsubdirPostHeaderParameters.HeaderParametersMapBuilder() - .someHeader("a") - - .build(), - configuration -); -``` - -### Field Summary -| Modifier and Type | Field and Description | -| ----------------- | ---------------------- | -| Set> | type = Set.of(Map.class) | -| Map> | properties = Map.ofEntries(
    new PropertyEntry("someHeader", [Schema0.Schema01.class](../../../paths/commonparamsubdir/post/parameters/parameter0/Schema0.md#schema01))
)
| -| Class | additionalProperties = [AdditionalProperties.class](#additionalproperties) | - -### Method Summary -| Modifier and Type | Method and Description | -| ----------------- | ---------------------- | -| [HeaderParametersMap](#headerparametersmap) | validate([Map<?, ?>](#headerparametersmapbuilder) arg, SchemaConfiguration configuration) | -| [CommonparamsubdirPostHeaderParameters1BoxedMap](#commonparamsubdirpostheaderparameters1boxedmap) | validateAndBox([Map<?, ?>](#headerparametersmapbuilder) arg, SchemaConfiguration configuration) | -| [CommonparamsubdirPostHeaderParameters1Boxed](#commonparamsubdirpostheaderparameters1boxed) | validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) | -| @Nullable Object | validate(@Nullable Object arg, SchemaConfiguration configuration) | - -## HeaderParametersMapBuilder -public class HeaderParametersMapBuilder
-builder for `Map` - -A class that builds the Map input type - -### Constructor Summary -| Constructor and Description | -| --------------------------- | -| HeaderParametersMapBuilder()
Creates a builder that contains an empty map | - -### Method Summary -| Modifier and Type | Method and Description | -| ----------------- | ---------------------- | -| Map | build()
Returns map input that should be used with Schema.validate | -| [HeaderParametersMapBuilder](#headerparametersmapbuilder) | someHeader(String value) | - -## HeaderParametersMap -public static class HeaderParametersMap
-extends FrozenMap - -A class to store validated Map payloads - -### Method Summary -| Modifier and Type | Method and Description | -| ----------------- | ---------------------- | -| static [HeaderParametersMap](#headerparametersmap) | of([Map](#headerparametersmapbuilder) arg, SchemaConfiguration configuration) | -| String | someHeader()
[optional] | - -## 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(Nothing? data)
Creates an instance, private visibility | - -### Method Summary -| Modifier and Type | Method and Description | -| ----------------- | ---------------------- | -| Nothing? | 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/kotlin/docs/paths/commonparamsubdir/post/CommonparamsubdirPostPathParameters.md b/samples/client/petstore/kotlin/docs/paths/commonparamsubdir/post/CommonparamsubdirPostPathParameters.md deleted file mode 100644 index 5ebd1fcc3e3..00000000000 --- a/samples/client/petstore/kotlin/docs/paths/commonparamsubdir/post/CommonparamsubdirPostPathParameters.md +++ /dev/null @@ -1,269 +0,0 @@ -# CommonparamsubdirPostPathParameters -public class CommonparamsubdirPostPathParameters
- -A class that contains necessary nested -- schema classes (which validate payloads), extends JsonSchema -- sealed interfaces which store validated payloads, java version of a sum type -- boxed classes which store validated payloads, sealed permits class implementations -- classes to store validated map payloads, extends FrozenMap -- classes to build inputs for map payloads - -## Nested Class Summary -| Modifier and Type | Class and Description | -| ----------------- | ---------------------- | -| sealed interface | [CommonparamsubdirPostPathParameters.CommonparamsubdirPostPathParameters1Boxed](#commonparamsubdirpostpathparameters1boxed)
sealed interface for validated payloads | -| record | [CommonparamsubdirPostPathParameters.CommonparamsubdirPostPathParameters1BoxedMap](#commonparamsubdirpostpathparameters1boxedmap)
boxed class to store validated Map payloads | -| static class | [CommonparamsubdirPostPathParameters.CommonparamsubdirPostPathParameters1](#commonparamsubdirpostpathparameters1)
schema class | -| static class | [CommonparamsubdirPostPathParameters.PathParametersMapBuilder](#pathparametersmapbuilder)
builder for Map payloads | -| static class | [CommonparamsubdirPostPathParameters.PathParametersMap](#pathparametersmap)
output class for Map payloads | -| sealed interface | [CommonparamsubdirPostPathParameters.AdditionalPropertiesBoxed](#additionalpropertiesboxed)
sealed interface for validated payloads | -| record | [CommonparamsubdirPostPathParameters.AdditionalPropertiesBoxedVoid](#additionalpropertiesboxedvoid)
boxed class to store validated null payloads | -| record | [CommonparamsubdirPostPathParameters.AdditionalPropertiesBoxedBoolean](#additionalpropertiesboxedboolean)
boxed class to store validated boolean payloads | -| record | [CommonparamsubdirPostPathParameters.AdditionalPropertiesBoxedNumber](#additionalpropertiesboxednumber)
boxed class to store validated Number payloads | -| record | [CommonparamsubdirPostPathParameters.AdditionalPropertiesBoxedString](#additionalpropertiesboxedstring)
boxed class to store validated String payloads | -| record | [CommonparamsubdirPostPathParameters.AdditionalPropertiesBoxedList](#additionalpropertiesboxedlist)
boxed class to store validated List payloads | -| record | [CommonparamsubdirPostPathParameters.AdditionalPropertiesBoxedMap](#additionalpropertiesboxedmap)
boxed class to store validated Map payloads | -| static class | [CommonparamsubdirPostPathParameters.AdditionalProperties](#additionalproperties)
schema class | - -## CommonparamsubdirPostPathParameters1Boxed -public sealed interface CommonparamsubdirPostPathParameters1Boxed
-permits
-[CommonparamsubdirPostPathParameters1BoxedMap](#commonparamsubdirpostpathparameters1boxedmap) - -sealed interface that stores validated payloads using boxed classes - -## CommonparamsubdirPostPathParameters1BoxedMap -public record CommonparamsubdirPostPathParameters1BoxedMap
-implements [CommonparamsubdirPostPathParameters1Boxed](#commonparamsubdirpostpathparameters1boxed) - -record that stores validated Map payloads, sealed permits implementation - -### Constructor Summary -| Constructor and Description | -| --------------------------- | -| CommonparamsubdirPostPathParameters1BoxedMap([PathParametersMap](#pathparametersmap) data)
Creates an instance, private visibility | - -### Method Summary -| Modifier and Type | Method and Description | -| ----------------- | ---------------------- | -| [PathParametersMap](#pathparametersmap) | data()
validated payload | -| @Nullable Object | getData()
validated payload | - -## CommonparamsubdirPostPathParameters1 -public static class CommonparamsubdirPostPathParameters1
-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.commonparamsubdir.post.CommonparamsubdirPostPathParameters; - -import java.util.Arrays; -import java.util.List; -import java.util.AbstractMap; - -static final SchemaConfiguration configuration = new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().build()); - -// Map validation -CommonparamsubdirPostPathParameters.PathParametersMap validatedPayload = - CommonparamsubdirPostPathParameters.CommonparamsubdirPostPathParameters1.validate( - new CommonparamsubdirPostPathParameters.PathParametersMapBuilder() - .subDir("a") - - .build(), - configuration -); -``` - -### Field Summary -| Modifier and Type | Field and Description | -| ----------------- | ---------------------- | -| Set> | type = Set.of(Map.class) | -| Map> | properties = Map.ofEntries(
    new PropertyEntry("subDir", [RouteParamSchema0.RouteParamSchema01.class](../../../paths/commonparamsubdir/parameters/routeparameter0/RouteParamSchema0.md#routeparamschema01))
)
| -| Set | required = Set.of(
    "subDir"
)
| -| Class | additionalProperties = [AdditionalProperties.class](#additionalproperties) | - -### Method Summary -| Modifier and Type | Method and Description | -| ----------------- | ---------------------- | -| [PathParametersMap](#pathparametersmap) | validate([Map<?, ?>](#pathparametersmapbuilder) arg, SchemaConfiguration configuration) | -| [CommonparamsubdirPostPathParameters1BoxedMap](#commonparamsubdirpostpathparameters1boxedmap) | validateAndBox([Map<?, ?>](#pathparametersmapbuilder) arg, SchemaConfiguration configuration) | -| [CommonparamsubdirPostPathParameters1Boxed](#commonparamsubdirpostpathparameters1boxed) | validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) | -| @Nullable Object | validate(@Nullable Object arg, SchemaConfiguration configuration) | - -## PathParametersMap0Builder -public class PathParametersMap0Builder
-builder for `Map` - -A class that builds the Map input type - -### Constructor Summary -| Constructor and Description | -| --------------------------- | -| PathParametersMap0Builder(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 | - -## PathParametersMapBuilder -public class PathParametersMapBuilder
-builder for `Map` - -A class that builds the Map input type - -### Constructor Summary -| Constructor and Description | -| --------------------------- | -| PathParametersMapBuilder()
Creates a builder that contains an empty map | - -### Method Summary -| Modifier and Type | Method and Description | -| ----------------- | ---------------------- | -| [PathParametersMap0Builder](#pathparametersmap0builder) | subDir(String value) | -| [PathParametersMap0Builder](#pathparametersmap0builder) | subDir([RouteParamSchema0.StringRouteParamSchemaEnums0](../../../paths/commonparamsubdir/parameters/routeparameter0/RouteParamSchema0.md#stringrouteparamschemaenums0) value) | - -## PathParametersMap -public static class PathParametersMap
-extends FrozenMap - -A class to store validated Map payloads - -### Method Summary -| Modifier and Type | Method and Description | -| ----------------- | ---------------------- | -| static [PathParametersMap](#pathparametersmap) | of([Map](#pathparametersmapbuilder) arg, SchemaConfiguration configuration) | -| String | subDir()
| - -## 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(Nothing? data)
Creates an instance, private visibility | - -### Method Summary -| Modifier and Type | Method and Description | -| ----------------- | ---------------------- | -| Nothing? | 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/kotlin/docs/paths/commonparamsubdir/post/CommonparamsubdirPostResponses.md b/samples/client/petstore/kotlin/docs/paths/commonparamsubdir/post/CommonparamsubdirPostResponses.md deleted file mode 100644 index 3fdc9818f77..00000000000 --- a/samples/client/petstore/kotlin/docs/paths/commonparamsubdir/post/CommonparamsubdirPostResponses.md +++ /dev/null @@ -1,29 +0,0 @@ -# CommonparamsubdirPostResponses - -public class CommonparamsubdirPostResponses - -A class that contains necessary responses classes -- a sealed interface, EndpointResponse, that stores endpoint responses -- records for each endpoint response - -## Nested Class Summary -| Modifier and Type | Class and Description | -| ----------------- | --------------------- | -| sealed interface | [EndpointResponse](#endpointresponse)
stores the endpoint responses | -| record | [EndpointCommonparamsubdirPostCode200Response](#endpointcommonparamsubdirpostcode200response)
the response for 200 | - -## EndpointResponse -public sealed interface EndpointResponse permits
-[EndpointCommonparamsubdirPostCode200Response](#endpointcommonparamsubdirpostcode200response) - -a sealed interface that stores endpoint responses - -## EndpointCommonparamsubdirPostCode200Response -public record EndpointCommonparamsubdirPostCode200Response( - HttpResponse response, - Nothing? body, - Nothing? headers -) implements EndpointResponse, ApiResponse
- -a class that stores an endpoint response - diff --git a/samples/client/petstore/kotlin/docs/paths/commonparamsubdir/post/parameters/parameter0/Schema0.md b/samples/client/petstore/kotlin/docs/paths/commonparamsubdir/post/parameters/parameter0/Schema0.md deleted file mode 100644 index 9ff90e0bc35..00000000000 --- a/samples/client/petstore/kotlin/docs/paths/commonparamsubdir/post/parameters/parameter0/Schema0.md +++ /dev/null @@ -1,49 +0,0 @@ -# Schema0 -public class Schema0
- -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 - -## Nested Class Summary -| Modifier and Type | Class and Description | -| ----------------- | ---------------------- | -| sealed interface | [Schema0.Schema01Boxed](#schema01boxed)
sealed interface for validated payloads | -| record | [Schema0.Schema01BoxedString](#schema01boxedstring)
boxed class to store validated String payloads | -| static class | [Schema0.Schema01](#schema01)
schema class | - -## Schema01Boxed -public sealed interface Schema01Boxed
-permits
-[Schema01BoxedString](#schema01boxedstring) - -sealed interface that stores validated payloads using boxed classes - -## Schema01BoxedString -public record Schema01BoxedString
-implements [Schema01Boxed](#schema01boxed) - -record that stores validated String payloads, sealed permits implementation - -### Constructor Summary -| Constructor and Description | -| --------------------------- | -| Schema01BoxedString(String data)
Creates an instance, private visibility | - -### Method Summary -| Modifier and Type | Method and Description | -| ----------------- | ---------------------- | -| String | data()
validated payload | -| @Nullable Object | getData()
validated payload | - -## Schema01 -public static class Schema01
-extends StringJsonSchema.StringJsonSchema1 - -A schema class that validates payloads - -| Methods Inherited from class org.openapijsonschematools.client.schemas.StringJsonSchema.StringJsonSchema1 | -| ------------------------------------------------------------------ | -| validate | -| validateAndBox | diff --git a/samples/client/petstore/kotlin/docs/paths/commonparamsubdir/post/responses/CommonparamsubdirPostCode200Response.md b/samples/client/petstore/kotlin/docs/paths/commonparamsubdir/post/responses/CommonparamsubdirPostCode200Response.md deleted file mode 100644 index 56ce18a3786..00000000000 --- a/samples/client/petstore/kotlin/docs/paths/commonparamsubdir/post/responses/CommonparamsubdirPostCode200Response.md +++ /dev/null @@ -1,17 +0,0 @@ -# CommonparamsubdirPostCode200Response - -public class CommonparamsubdirPostCode200Response extends [SuccessDescriptionOnly](../../components/responses/SuccessDescriptionOnly.md) - -A class (extended from the $ref class) that contains necessary nested response classes -- a class that extends ResponseDeserializer and is used to deserialize responses - -## Nested Class Summary -| Modifier and Type | Class and Description | -| ----------------- | --------------------- | -| static class | [CommonparamsubdirPostCode200Response.CommonparamsubdirPostCode200Response1](#commonparamsubdirpostcode200response1)
class that deserializes responses | - -## CommonparamsubdirPostCode200Response1 -public static class CommonparamsubdirPostCode200Response1 extends [SuccessDescriptionOnly1](../../components/responses/SuccessDescriptionOnly.md#successdescriptiononly1)
- -a class that deserializes responses, extended from the $ref class - diff --git a/samples/client/petstore/kotlin/docs/paths/fake/FakeDelete.md b/samples/client/petstore/kotlin/docs/paths/fake/FakeDelete.md deleted file mode 100644 index 49f9d408a2b..00000000000 --- a/samples/client/petstore/kotlin/docs/paths/fake/FakeDelete.md +++ /dev/null @@ -1,255 +0,0 @@ -# FakeDelete - -public class FakeDelete - -A class that contains necessary endpoint classes -- a class that calls the endpoint method using the http verb -- a class that calls the endpoint method using the operationId name -- class(es) to store the request inputs -- builder(s) to set the request input data - -## Nested Class Summary -| Modifier and Type | Class and Description | -| ----------------- | --------------------- | -| static class | [Delete](#delete)
The class that has a delete method to call the endpoint | -| interface | [GroupParametersOperation](#groupparametersoperation)
The interface that has a groupParameters method to call the endpoint | -| static class | [DeleteRequest](#deleterequest)
The final request inputs class | -| static class | [DeleteNullableRequest](#deletenullablerequest)
The initial request inputs class | -| static class | [Delete00RequestBuilder](#delete00requestbuilder)
A builder for the request input class | -| static class | [Delete01RequestBuilder](#delete01requestbuilder)
A builder for the request input class | -| static class | [Delete10RequestBuilder](#delete10requestbuilder)
A builder for the request input class | -| static class | [DeleteRequestBuilder](#deleterequestbuilder)
A builder for the request input class | - -## Delete -public static class Delete extends ApiClient.ApiClient1 implements DeleteOperation
- -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.fake.delete.FakeDeleteSecurityInfo; -import org.openapijsonschematools.client.paths.fake.delete.FakeDeleteHeaderParameters; -import org.openapijsonschematools.client.paths.fake.delete.FakeDeleteQueryParameters; -import org.openapijsonschematools.client.servers.RootServer0; -import org.openapijsonschematools.client.servers.RootServer1; -import org.openapijsonschematools.client.servers.RootServer2; -import org.openapijsonschematools.client.securityschemes.SecurityScheme; -import org.openapijsonschematools.client.components.securityschemes.BearerTest; -import org.openapijsonschematools.client.paths.fake.delete.responses.FakeDeleteCode200Response; -import org.openapijsonschematools.client.servers.RootServerInfo; -import org.openapijsonschematools.client.paths.fake.FakeDelete; -import org.openapijsonschematools.client.paths.fake.delete.FakeDeleteResponses; - -import java.io.IOException; -import java.util.Arrays; -import java.util.List; -import java.util.Map; -import java.util.AbstractMap; - -// if you want to use a server that is not SERVER_0 pass it in here and change the ServerIndex input below -ApiConfiguration.ServerInfo serverInfo = new ApiConfiguration.ServerInfoBuilder() - .rootServerInfo( - new RootServerInfo.RootServerInfoBuilder() - .rootServer0(new RootServer0()) - .build() - ) - .build(); -ApiConfiguration.ServerIndexInfo serverIndexInfo = new ApiConfiguration.ServerIndexInfoBuilder() - .rootServerInfoServerIndex(RootServerInfo.ServerIndex.SERVER_0) - .build(); -List securitySchemes = new ArrayList(); -securitySchemes.add( - new BearerTest("someAccessToken"); -); -ApiConfiguration.SecurityIndexInfo securityIndexInfo = new ApiConfiguration.SecurityIndexInfoBuilder() - .fakeDeleteSecurityRequirementObject0SecurityIndex(FakeDeleteSecurityRequirementObject0.SecurityIndex.SECURITY_0) - .build(); -Duration timeout = Duration.ofSeconds(1L); -Map> defaultHeaders = Map.of("User-Agent", List.of("OpenAPI-JSON-Schema-Generator/1.0.0/java")); -ApiConfiguration apiConfiguration = new ApiConfiguration( - serverInfo - serverIndexInfo, - securitySchemes, - securityIndexInfo, - timeout, - defaultHeaders -); -SchemaConfiguration schemaConfiguration = new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().build()); -FakeDelete.Delete apiClient = new FakeDelete.Delete(apiConfiguration, schemaConfiguration); - - -// Map validation -FakeDeleteHeaderParameters.HeaderParametersMap headerParameters = - FakeDeleteHeaderParameters.FakeDeleteHeaderParameters1.validate( - new FakeDeleteHeaderParameters.HeaderParametersMapBuilder() - .required_boolean_group("true") - - .boolean_group("true") - - .build(), - schemaConfiguration -); - -// Map validation -FakeDeleteQueryParameters.QueryParametersMap queryParameters = - FakeDeleteQueryParameters.FakeDeleteQueryParameters1.validate( - new FakeDeleteQueryParameters.QueryParametersMapBuilder() - .required_int64_group(1L) - - .required_string_group("a") - - .int64_group(1L) - - .string_group("a") - - .build(), - schemaConfiguration -); - -var request = new FakeDelete.DeleteRequestBuilder() - .headerParameters(headerParameters) - .queryParameters(queryParameters) - .build(); - -FakeDeleteResponses.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; -} -FakeDeleteResponses.EndpointFakeDeleteCode200Response castResponse = (FakeDeleteResponses.EndpointFakeDeleteCode200Response) response; -``` -### Constructor Summary -| Constructor and Description | -| --------------------------- | -| Delete(ApiConfiguration apiConfiguration, SchemaConfiguration schemaConfiguration)
Creates an instance | - -### Method Summary -| Modifier and Type | Method and Description | -| ----------------- | ---------------------- | -| [FakeDeleteResponses.EndpointResponse](../../paths/fake/delete/FakeDeleteResponses.md#endpointresponse) | delete([DeleteRequest](#deleterequest) request) | - -## GroupParametersOperation -public interface GroupParametersOperation
- -an interface that allows one to call the endpoint using a method named groupParameters by the operationId - -### Method Summary -| Modifier and Type | Method and Description | -| ----------------- | ---------------------- | -| [FakeDeleteResponses.EndpointResponse](../../paths/fake/delete/FakeDeleteResponses.md#endpointresponse) | groupParameters([DeleteRequest](#deleterequest) request) | - -## DeleteRequest -public static class DeleteRequest
- -a class that stores the final request inputs - -### Field Summary -| Modifier and Type | Field and Description | -| ----------------- | --------------------- | -| [FakeDeleteHeaderParameters.HeaderParametersMap](../../paths/fake/delete/FakeDeleteHeaderParameters.md#headerparametersmap) | headerParameters | -| [FakeDeleteQueryParameters.QueryParametersMap](../../paths/fake/delete/FakeDeleteQueryParameters.md#queryparametersmap) | queryParameters | -| [RootServerInfo.@Nullable ServerIndex](../../RootServerInfo.md#serverindex) | serverIndex
optional. Note: this will override the value in apiConfiguration | -| [FakeDeleteSecurityInfo.@Nullable SecurityIndex](../../paths/fake/delete/FakeDeleteSecurityInfo.md#securityindex) | securityIndex
optional. Note: this will override the value in apiConfiguration | -| @Nullable Duration | timeout
optional. Note: this will override the value in apiConfiguration | - -## DeleteNullableRequest -public static class DeleteNullableRequest
- -a class that stores the initial request inputs - -### Field Summary -| Modifier and Type | Field and Description | -| ----------------- | --------------------- | -| [FakeDeleteHeaderParameters.@Nullable HeaderParametersMap](../../paths/fake/delete/FakeDeleteHeaderParameters.md#headerparametersmap) | headerParameters | -| [FakeDeleteQueryParameters.@Nullable QueryParametersMap](../../paths/fake/delete/FakeDeleteQueryParameters.md#queryparametersmap) | queryParameters | -| [RootServerInfo.@Nullable ServerIndex](../../RootServerInfo.md#serverindex) | serverIndex | -| [FakeDeleteSecurityInfo.@Nullable SecurityIndex](../../paths/fake/delete/FakeDeleteSecurityInfo.md#securityindex) | securityIndex | -| @Nullable Duration | timeout | - -## Delete00RequestBuilder -public static class Delete00RequestBuilder
- -a builder for request inputs - -### Constructor Summary -| Constructor and Description | -| --------------------------- | -| Delete00RequestBuilder(Delete00RequestBuilder instance)
Creates a builder that contains the passed instance | - -### Method Summary -| Modifier and Type | Method and Description | -| ----------------- | ---------------------- | -| [DeleteRequest](#deleterequest) | build()
Returns the request input used to call an endpoint method | -| [Delete00RequestBuilder](#delete00requestbuilder) | serverIndex([RootServerInfo.ServerIndex](../../RootServerInfo.md#serverindex) serverIndex)
sets the optional property. Note: this will override the value in apiConfiguration | -| [Delete00RequestBuilder](#delete00requestbuilder) | securityIndex([FakeDeleteSecurityInfo.SecurityIndex](../../paths/fake/delete/FakeDeleteSecurityInfo.md#securityindex) securityIndex)
sets the optional property. Note: this will override the value in apiConfiguration | -| [Delete00RequestBuilder](#delete00requestbuilder) | timeout(Duration timeout)
sets the optional property. Note: this will override the value in apiConfiguration | - -## Delete01RequestBuilder -public static class Delete01RequestBuilder
- -a builder for request inputs - -### Constructor Summary -| Constructor and Description | -| --------------------------- | -| Delete01RequestBuilder(Delete01RequestBuilder instance)
Creates a builder that contains the passed instance | - -### Method Summary -| Modifier and Type | Method and Description | -| ----------------- | ---------------------- | -| [Delete00RequestBuilder](#delete00requestbuilder) | queryParameters([FakeDeleteQueryParametersQueryParametersMap](../../paths/fake/delete/FakeDeleteQueryParameters.md#queryparametersmap) queryParameters)
sets the property | - -## Delete10RequestBuilder -public static class Delete10RequestBuilder
- -a builder for request inputs - -### Constructor Summary -| Constructor and Description | -| --------------------------- | -| Delete10RequestBuilder(Delete10RequestBuilder instance)
Creates a builder that contains the passed instance | - -### Method Summary -| Modifier and Type | Method and Description | -| ----------------- | ---------------------- | -| [Delete00RequestBuilder](#delete00requestbuilder) | headerParameters([FakeDeleteHeaderParametersHeaderParametersMap](../../paths/fake/delete/FakeDeleteHeaderParameters.md#headerparametersmap) headerParameters)
sets the property | - -## DeleteRequestBuilder -public static class DeleteRequestBuilder
- -a builder for request inputs - -### Constructor Summary -| Constructor and Description | -| --------------------------- | -| DeleteRequestBuilder()
Creates a builder that contains null for all parameters | - -### Method Summary -| Modifier and Type | Method and Description | -| ----------------- | ---------------------- | -| [Delete01RequestBuilder](#delete01requestbuilder) | headerParameters([FakeDeleteHeaderParametersHeaderParametersMap](../../paths/fake/delete/FakeDeleteHeaderParameters.md#headerparametersmap) headerParameters)
sets the property | -| [Delete10RequestBuilder](#delete10requestbuilder) | queryParameters([FakeDeleteQueryParametersQueryParametersMap](../../paths/fake/delete/FakeDeleteQueryParameters.md#queryparametersmap) queryParameters)
sets the property | - -[[Back to top]](#top) [[Back to README]](../../../README.md) diff --git a/samples/client/petstore/kotlin/docs/paths/fake/FakeGet.md b/samples/client/petstore/kotlin/docs/paths/fake/FakeGet.md deleted file mode 100644 index 2504a8b4a8d..00000000000 --- a/samples/client/petstore/kotlin/docs/paths/fake/FakeGet.md +++ /dev/null @@ -1,156 +0,0 @@ -# FakeGet - -public class FakeGet - -A class that contains necessary endpoint classes -- a class that calls the endpoint method using the http verb -- a class that calls the endpoint method using the operationId name -- class(es) to store the request inputs -- builder(s) to set the request input data - -## Nested Class Summary -| Modifier and Type | Class and Description | -| ----------------- | --------------------- | -| static class | [Get](#get)
The class that has a get method to call the endpoint | -| interface | [EnumParametersOperation](#enumparametersoperation)
The interface that has a enumParameters method to call the endpoint | -| static class | [GetRequest](#getrequest)
The request inputs class | -| static class | [GetRequestBuilder](#getrequestbuilder)
A builder for the request input class | - -## Get -public static class Get extends ApiClient.ApiClient1 implements GetOperation
- -a class that allows one to call the endpoint using a method named get - -### 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.fake.get.FakeGetRequestBody; -import org.openapijsonschematools.client.paths.fake.get.requestbody.content.applicationxwwwformurlencoded.ApplicationxwwwformurlencodedSchema; -import org.openapijsonschematools.client.paths.fake.get.FakeGetHeaderParameters; -import org.openapijsonschematools.client.paths.fake.get.FakeGetQueryParameters; -import org.openapijsonschematools.client.RootServerInfo; -import org.openapijsonschematools.client.servers.RootServer0; -import org.openapijsonschematools.client.servers.RootServer1; -import org.openapijsonschematools.client.servers.RootServer2; -import org.openapijsonschematools.client.paths.fake.get.responses.FakeGetCode200Response; -import org.openapijsonschematools.client.paths.fake.get.responses.FakeGetCode404Response; -import org.openapijsonschematools.client.servers.RootServerInfo; -import org.openapijsonschematools.client.paths.fake.FakeGet; -import org.openapijsonschematools.client.paths.fake.get.FakeGetResponses; - -import java.io.IOException; -import java.util.Arrays; -import java.util.List; -import java.util.Map; -import java.util.AbstractMap; - -// if you want to use a server that is not SERVER_0 pass it in here and change the ServerIndex input below -ApiConfiguration.ServerInfo serverInfo = new ApiConfiguration.ServerInfoBuilder() - .rootServerInfo( - new RootServerInfo.RootServerInfoBuilder() - .rootServer0(new RootServer0()) - .build() - ) - .build(); -ApiConfiguration.ServerIndexInfo serverIndexInfo = new ApiConfiguration.ServerIndexInfoBuilder() - .rootServerInfoServerIndex(RootServerInfo.ServerIndex.SERVER_0) - .build(); -Duration timeout = Duration.ofSeconds(1L); -Map> defaultHeaders = Map.of("User-Agent", List.of("OpenAPI-JSON-Schema-Generator/1.0.0/java")); -ApiConfiguration apiConfiguration = new ApiConfiguration( - serverInfo - serverIndexInfo, - timeout, - defaultHeaders -); -SchemaConfiguration schemaConfiguration = new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().build()); -FakeGet.Get apiClient = new FakeGet.Get(apiConfiguration, schemaConfiguration); - - -var request = new FakeGet.GetRequestBuilder().build(); - -FakeGetResponses.EndpointResponse response; -try { - response = apiClient.get(request); -} catch (FakeGetCode404Response.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; -} -FakeGetResponses.EndpointFakeGetCode200Response castResponse = (FakeGetResponses.EndpointFakeGetCode200Response) response; -``` -### Constructor Summary -| Constructor and Description | -| --------------------------- | -| Get(ApiConfiguration apiConfiguration, SchemaConfiguration schemaConfiguration)
Creates an instance | - -### Method Summary -| Modifier and Type | Method and Description | -| ----------------- | ---------------------- | -| [FakeGetResponses.EndpointResponse](../../paths/fake/get/FakeGetResponses.md#endpointresponse) | get([GetRequest](#getrequest) request) | - -## EnumParametersOperation -public interface EnumParametersOperation
- -an interface that allows one to call the endpoint using a method named enumParameters by the operationId - -### Method Summary -| Modifier and Type | Method and Description | -| ----------------- | ---------------------- | -| [FakeGetResponses.EndpointResponse](../../paths/fake/get/FakeGetResponses.md#endpointresponse) | enumParameters([GetRequest](#getrequest) request) | - -## GetRequest -public static class GetRequest
- -a class that stores the final request inputs - -### Field Summary -| Modifier and Type | Field and Description | -| ----------------- | --------------------- | -| [FakeGetRequestBody.@Nullable SealedRequestBody](../../paths/fake/get/FakeGetRequestBody.md#sealedrequestbody) | requestBody
optional | -| [FakeGetHeaderParameters.@Nullable HeaderParametersMap](../../paths/fake/get/FakeGetHeaderParameters.md#headerparametersmap) | headerParameters
optional | -| [FakeGetQueryParameters.@Nullable QueryParametersMap](../../paths/fake/get/FakeGetQueryParameters.md#queryparametersmap) | queryParameters
optional | -| [RootServerInfo.@Nullable ServerIndex](../../RootServerInfo.md#serverindex) | serverIndex
optional. Note: this will override the value in apiConfiguration | -| @Nullable Duration | timeout
optional. Note: this will override the value in apiConfiguration | - -## GetRequestBuilder -public static class GetRequestBuilder
- -a builder for request inputs - -### Constructor Summary -| Constructor and Description | -| --------------------------- | -| GetRequestBuilder()
Creates a builder that contains null for all parameters | - -### Method Summary -| Modifier and Type | Method and Description | -| ----------------- | ---------------------- | -| [GetRequest](#getrequest) | build()
Returns the request input used to call an endpoint method | -| [GetRequestBuilder](#getrequestbuilder) | requestBody([FakeGetRequestBody.SealedRequestBody](../../paths/fake/get/FakeGetRequestBody.md#sealedrequestbody) requestBody)
sets the optional property | -| [GetRequestBuilder](#getrequestbuilder) | headerParameters([FakeGetHeaderParametersHeaderParametersMap](../../paths/fake/get/FakeGetHeaderParameters.md#headerparametersmap) headerParameters)
sets the optional property | -| [GetRequestBuilder](#getrequestbuilder) | queryParameters([FakeGetQueryParametersQueryParametersMap](../../paths/fake/get/FakeGetQueryParameters.md#queryparametersmap) queryParameters)
sets the optional property | -| [GetRequestBuilder](#getrequestbuilder) | serverIndex([RootServerInfo.ServerIndex](../../RootServerInfo.md#serverindex) serverIndex)
sets the optional property. Note: this will override the value in apiConfiguration | -| [GetRequestBuilder](#getrequestbuilder) | timeout(Duration timeout)
sets the optional property. Note: this will override the value in apiConfiguration | - -[[Back to top]](#top) [[Back to README]](../../../README.md) diff --git a/samples/client/petstore/kotlin/docs/paths/fake/FakePatch.md b/samples/client/petstore/kotlin/docs/paths/fake/FakePatch.md deleted file mode 100644 index a4b21b9a406..00000000000 --- a/samples/client/petstore/kotlin/docs/paths/fake/FakePatch.md +++ /dev/null @@ -1,188 +0,0 @@ -# FakePatch - -public class FakePatch - -A class that contains necessary endpoint classes -- a class that calls the endpoint method using the http verb -- a class that calls the endpoint method using the operationId name -- class(es) to store the request inputs -- builder(s) to set the request input data - -## Nested Class Summary -| Modifier and Type | Class and Description | -| ----------------- | --------------------- | -| static class | [Patch](#patch)
The class that has a patch method to call the endpoint | -| interface | [ClientModelOperation](#clientmodeloperation)
The interface that has a clientModel method to call the endpoint | -| static class | [PatchRequest](#patchrequest)
The final request inputs class | -| static class | [PatchNullableRequest](#patchnullablerequest)
The initial request inputs class | -| static class | [Patch0RequestBuilder](#patch0requestbuilder)
A builder for the request input class | -| static class | [PatchRequestBuilder](#patchrequestbuilder)
A builder for the request input class | - -## Patch -public static class Patch extends ApiClient.ApiClient1 implements PatchOperation
- -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.fake.patch.FakePatchRequestBody; -import org.openapijsonschematools.client.components.schemas.Client; -import org.openapijsonschematools.client.servers.RootServer0; -import org.openapijsonschematools.client.servers.RootServer1; -import org.openapijsonschematools.client.servers.RootServer2; -import org.openapijsonschematools.client.paths.fake.patch.responses.FakePatchCode200Response; -import org.openapijsonschematools.client.servers.RootServerInfo; -import org.openapijsonschematools.client.paths.fake.FakePatch; -import org.openapijsonschematools.client.paths.fake.patch.FakePatchResponses; - -import java.io.IOException; -import java.util.Arrays; -import java.util.List; -import java.util.Map; -import java.util.AbstractMap; - -// if you want to use a server that is not SERVER_0 pass it in here and change the ServerIndex input below -ApiConfiguration.ServerInfo serverInfo = new ApiConfiguration.ServerInfoBuilder() - .rootServerInfo( - new RootServerInfo.RootServerInfoBuilder() - .rootServer0(new RootServer0()) - .build() - ) - .build(); -ApiConfiguration.ServerIndexInfo serverIndexInfo = new ApiConfiguration.ServerIndexInfoBuilder() - .rootServerInfoServerIndex(RootServerInfo.ServerIndex.SERVER_0) - .build(); -Duration timeout = Duration.ofSeconds(1L); -Map> defaultHeaders = Map.of("User-Agent", List.of("OpenAPI-JSON-Schema-Generator/1.0.0/java")); -ApiConfiguration apiConfiguration = new ApiConfiguration( - serverInfo - serverIndexInfo, - timeout, - defaultHeaders -); -SchemaConfiguration schemaConfiguration = new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().build()); -FakePatch.Patch apiClient = new FakePatch.Patch(apiConfiguration, schemaConfiguration); - - -Client1BoxedMap requestBodyPayload = - Client.Client1.validateAndBox( - new Client.ClientMapBuilder1() - .client("a") - - .build(), - schemaConfiguration -); -FakePatchRequestBody.SealedRequestBody requestBody = new FakePatchRequestBody.ApplicationjsonRequestBody(requestBodyPayload); - -var request = new FakePatch.PatchRequestBuilder() - .requestBody(requestBody) - .build(); - -FakePatchResponses.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; -} -FakePatchResponses.EndpointFakePatchCode200Response castResponse = (FakePatchResponses.EndpointFakePatchCode200Response) response; -FakePatchCode200Response.ApplicationjsonResponseBody deserializedBody = (FakePatchCode200Response.ApplicationjsonResponseBody) castResponse.body; -// handle deserialized body here -``` -### Constructor Summary -| Constructor and Description | -| --------------------------- | -| Patch(ApiConfiguration apiConfiguration, SchemaConfiguration schemaConfiguration)
Creates an instance | - -### Method Summary -| Modifier and Type | Method and Description | -| ----------------- | ---------------------- | -| [FakePatchResponses.EndpointResponse](../../paths/fake/patch/FakePatchResponses.md#endpointresponse) | patch([PatchRequest](#patchrequest) request) | - -## ClientModelOperation -public interface ClientModelOperation
- -an interface that allows one to call the endpoint using a method named clientModel by the operationId - -### Method Summary -| Modifier and Type | Method and Description | -| ----------------- | ---------------------- | -| [FakePatchResponses.EndpointResponse](../../paths/fake/patch/FakePatchResponses.md#endpointresponse) | clientModel([PatchRequest](#patchrequest) request) | - -## PatchRequest -public static class PatchRequest
- -a class that stores the final request inputs - -### Field Summary -| Modifier and Type | Field and Description | -| ----------------- | --------------------- | -| [FakePatchRequestBody.SealedRequestBody](../../paths/fake/patch/FakePatchRequestBody.md#sealedrequestbody) | requestBody | -| [RootServerInfo.@Nullable ServerIndex](../../RootServerInfo.md#serverindex) | serverIndex
optional. Note: this will override the value in apiConfiguration | -| @Nullable Duration | timeout
optional. Note: this will override the value in apiConfiguration | - -## PatchNullableRequest -public static class PatchNullableRequest
- -a class that stores the initial request inputs - -### Field Summary -| Modifier and Type | Field and Description | -| ----------------- | --------------------- | -| [FakePatchRequestBody.@Nullable SealedRequestBody](../../paths/fake/patch/FakePatchRequestBody.md#sealedrequestbody) | requestBody | -| [RootServerInfo.@Nullable ServerIndex](../../RootServerInfo.md#serverindex) | serverIndex | -| @Nullable Duration | timeout | - -## Patch0RequestBuilder -public static class Patch0RequestBuilder
- -a builder for request inputs - -### Constructor Summary -| Constructor and Description | -| --------------------------- | -| Patch0RequestBuilder(Patch0RequestBuilder instance)
Creates a builder that contains the passed instance | - -### Method Summary -| Modifier and Type | Method and Description | -| ----------------- | ---------------------- | -| [PatchRequest](#patchrequest) | build()
Returns the request input used to call an endpoint method | -| [Patch0RequestBuilder](#patch0requestbuilder) | serverIndex([RootServerInfo.ServerIndex](../../RootServerInfo.md#serverindex) serverIndex)
sets the optional property. Note: this will override the value in apiConfiguration | -| [Patch0RequestBuilder](#patch0requestbuilder) | timeout(Duration timeout)
sets the optional property. Note: this will override the value in apiConfiguration | - -## PatchRequestBuilder -public static class PatchRequestBuilder
- -a builder for request inputs - -### Constructor Summary -| Constructor and Description | -| --------------------------- | -| PatchRequestBuilder()
Creates a builder that contains null for all parameters | - -### Method Summary -| Modifier and Type | Method and Description | -| ----------------- | ---------------------- | -| [Patch0RequestBuilder](#patch0requestbuilder) | requestBody([FakePatchRequestBody.SealedRequestBody](../../paths/fake/patch/FakePatchRequestBody.md#sealedrequestbody) requestBody)
sets the property | - -[[Back to top]](#top) [[Back to README]](../../../README.md) diff --git a/samples/client/petstore/kotlin/docs/paths/fake/FakePost.md b/samples/client/petstore/kotlin/docs/paths/fake/FakePost.md deleted file mode 100644 index e9f8e9199b1..00000000000 --- a/samples/client/petstore/kotlin/docs/paths/fake/FakePost.md +++ /dev/null @@ -1,164 +0,0 @@ -# FakePost - -public class FakePost - -A class that contains necessary endpoint classes -- a class that calls the endpoint method using the http verb -- a class that calls the endpoint method using the operationId name -- class(es) to store the request inputs -- builder(s) to set the request input data - -## Nested Class Summary -| Modifier and Type | Class and Description | -| ----------------- | --------------------- | -| static class | [Post](#post)
The class that has a post method to call the endpoint | -| interface | [EndpointParametersOperation](#endpointparametersoperation)
The interface that has a endpointParameters method to call the endpoint | -| static class | [PostRequest](#postrequest)
The request inputs class | -| static class | [PostRequestBuilder](#postrequestbuilder)
A builder for the request input class | - -## Post -public static class Post 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.fake.post.FakePostRequestBody; -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.RootServer0; -import org.openapijsonschematools.client.servers.RootServer1; -import org.openapijsonschematools.client.servers.RootServer2; -import org.openapijsonschematools.client.securityschemes.SecurityScheme; -import org.openapijsonschematools.client.components.securityschemes.HttpBasicTest; -import org.openapijsonschematools.client.paths.fake.post.responses.FakePostCode200Response; -import org.openapijsonschematools.client.paths.fake.post.responses.FakePostCode404Response; -import org.openapijsonschematools.client.servers.RootServerInfo; -import org.openapijsonschematools.client.paths.fake.FakePost; -import org.openapijsonschematools.client.paths.fake.post.FakePostResponses; - -import java.io.IOException; -import java.util.Arrays; -import java.util.List; -import java.util.Map; -import java.util.AbstractMap; - -// if you want to use a server that is not SERVER_0 pass it in here and change the ServerIndex input below -ApiConfiguration.ServerInfo serverInfo = new ApiConfiguration.ServerInfoBuilder() - .rootServerInfo( - new RootServerInfo.RootServerInfoBuilder() - .rootServer0(new RootServer0()) - .build() - ) - .build(); -ApiConfiguration.ServerIndexInfo serverIndexInfo = new ApiConfiguration.ServerIndexInfoBuilder() - .rootServerInfoServerIndex(RootServerInfo.ServerIndex.SERVER_0) - .build(); -List securitySchemes = new ArrayList(); -securitySchemes.add( - new HttpBasicTest("someUserId", "somePassword"); -); -ApiConfiguration.SecurityIndexInfo securityIndexInfo = new ApiConfiguration.SecurityIndexInfoBuilder() - .fakePostSecurityRequirementObject0SecurityIndex(FakePostSecurityRequirementObject0.SecurityIndex.SECURITY_0) - .build(); -Duration timeout = Duration.ofSeconds(1L); -Map> defaultHeaders = Map.of("User-Agent", List.of("OpenAPI-JSON-Schema-Generator/1.0.0/java")); -ApiConfiguration apiConfiguration = new ApiConfiguration( - serverInfo - serverIndexInfo, - securitySchemes, - securityIndexInfo, - timeout, - defaultHeaders -); -SchemaConfiguration schemaConfiguration = new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().build()); -FakePost.Post apiClient = new FakePost.Post(apiConfiguration, schemaConfiguration); - - -var request = new FakePost.PostRequestBuilder().build(); - -FakePostResponses.EndpointResponse response; -try { - response = apiClient.post(request); -} catch (FakePostCode404Response.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; -} -FakePostResponses.EndpointFakePostCode200Response castResponse = (FakePostResponses.EndpointFakePostCode200Response) response; -``` -### Constructor Summary -| Constructor and Description | -| --------------------------- | -| Post(ApiConfiguration apiConfiguration, SchemaConfiguration schemaConfiguration)
Creates an instance | - -### Method Summary -| Modifier and Type | Method and Description | -| ----------------- | ---------------------- | -| [FakePostResponses.EndpointResponse](../../paths/fake/post/FakePostResponses.md#endpointresponse) | post([PostRequest](#postrequest) request) | - -## EndpointParametersOperation -public interface EndpointParametersOperation
- -an interface that allows one to call the endpoint using a method named endpointParameters by the operationId - -### Method Summary -| Modifier and Type | Method and Description | -| ----------------- | ---------------------- | -| [FakePostResponses.EndpointResponse](../../paths/fake/post/FakePostResponses.md#endpointresponse) | endpointParameters([PostRequest](#postrequest) request) | - -## PostRequest -public static class PostRequest
- -a class that stores the final request inputs - -### Field Summary -| Modifier and Type | Field and Description | -| ----------------- | --------------------- | -| [FakePostRequestBody.@Nullable SealedRequestBody](../../paths/fake/post/FakePostRequestBody.md#sealedrequestbody) | requestBody
optional | -| [RootServerInfo.@Nullable ServerIndex](../../RootServerInfo.md#serverindex) | serverIndex
optional. Note: this will override the value in apiConfiguration | -| [FakePostSecurityInfo.@Nullable SecurityIndex](../../paths/fake/post/FakePostSecurityInfo.md#securityindex) | securityIndex
optional. Note: this will override the value in apiConfiguration | -| @Nullable Duration | timeout
optional. Note: this will override the value in apiConfiguration | - -## PostRequestBuilder -public static class PostRequestBuilder
- -a builder for request inputs - -### Constructor Summary -| Constructor and Description | -| --------------------------- | -| PostRequestBuilder()
Creates a builder that contains null for all parameters | - -### Method Summary -| Modifier and Type | Method and Description | -| ----------------- | ---------------------- | -| [PostRequest](#postrequest) | build()
Returns the request input used to call an endpoint method | -| [PostRequestBuilder](#postrequestbuilder) | requestBody([FakePostRequestBody.SealedRequestBody](../../paths/fake/post/FakePostRequestBody.md#sealedrequestbody) requestBody)
sets the optional property | -| [PostRequestBuilder](#postrequestbuilder) | serverIndex([RootServerInfo.ServerIndex](../../RootServerInfo.md#serverindex) serverIndex)
sets the optional property. Note: this will override the value in apiConfiguration | -| [PostRequestBuilder](#postrequestbuilder) | securityIndex([FakePostSecurityInfo.SecurityIndex](../../paths/fake/post/FakePostSecurityInfo.md#securityindex) securityIndex)
sets the optional property. Note: this will override the value in apiConfiguration | -| [PostRequestBuilder](#postrequestbuilder) | timeout(Duration timeout)
sets the optional property. Note: this will override the value in apiConfiguration | - -[[Back to top]](#top) [[Back to README]](../../../README.md) diff --git a/samples/client/petstore/kotlin/docs/paths/fake/delete/FakeDeleteHeaderParameters.md b/samples/client/petstore/kotlin/docs/paths/fake/delete/FakeDeleteHeaderParameters.md deleted file mode 100644 index d1eb380fba6..00000000000 --- a/samples/client/petstore/kotlin/docs/paths/fake/delete/FakeDeleteHeaderParameters.md +++ /dev/null @@ -1,274 +0,0 @@ -# FakeDeleteHeaderParameters -public class FakeDeleteHeaderParameters
- -A class that contains necessary nested -- schema classes (which validate payloads), extends JsonSchema -- sealed interfaces which store validated payloads, java version of a sum type -- boxed classes which store validated payloads, sealed permits class implementations -- classes to store validated map payloads, extends FrozenMap -- classes to build inputs for map payloads - -## Nested Class Summary -| Modifier and Type | Class and Description | -| ----------------- | ---------------------- | -| sealed interface | [FakeDeleteHeaderParameters.FakeDeleteHeaderParameters1Boxed](#fakedeleteheaderparameters1boxed)
sealed interface for validated payloads | -| record | [FakeDeleteHeaderParameters.FakeDeleteHeaderParameters1BoxedMap](#fakedeleteheaderparameters1boxedmap)
boxed class to store validated Map payloads | -| static class | [FakeDeleteHeaderParameters.FakeDeleteHeaderParameters1](#fakedeleteheaderparameters1)
schema class | -| static class | [FakeDeleteHeaderParameters.HeaderParametersMapBuilder](#headerparametersmapbuilder)
builder for Map payloads | -| static class | [FakeDeleteHeaderParameters.HeaderParametersMap](#headerparametersmap)
output class for Map payloads | -| sealed interface | [FakeDeleteHeaderParameters.AdditionalPropertiesBoxed](#additionalpropertiesboxed)
sealed interface for validated payloads | -| record | [FakeDeleteHeaderParameters.AdditionalPropertiesBoxedVoid](#additionalpropertiesboxedvoid)
boxed class to store validated null payloads | -| record | [FakeDeleteHeaderParameters.AdditionalPropertiesBoxedBoolean](#additionalpropertiesboxedboolean)
boxed class to store validated boolean payloads | -| record | [FakeDeleteHeaderParameters.AdditionalPropertiesBoxedNumber](#additionalpropertiesboxednumber)
boxed class to store validated Number payloads | -| record | [FakeDeleteHeaderParameters.AdditionalPropertiesBoxedString](#additionalpropertiesboxedstring)
boxed class to store validated String payloads | -| record | [FakeDeleteHeaderParameters.AdditionalPropertiesBoxedList](#additionalpropertiesboxedlist)
boxed class to store validated List payloads | -| record | [FakeDeleteHeaderParameters.AdditionalPropertiesBoxedMap](#additionalpropertiesboxedmap)
boxed class to store validated Map payloads | -| static class | [FakeDeleteHeaderParameters.AdditionalProperties](#additionalproperties)
schema class | - -## FakeDeleteHeaderParameters1Boxed -public sealed interface FakeDeleteHeaderParameters1Boxed
-permits
-[FakeDeleteHeaderParameters1BoxedMap](#fakedeleteheaderparameters1boxedmap) - -sealed interface that stores validated payloads using boxed classes - -## FakeDeleteHeaderParameters1BoxedMap -public record FakeDeleteHeaderParameters1BoxedMap
-implements [FakeDeleteHeaderParameters1Boxed](#fakedeleteheaderparameters1boxed) - -record that stores validated Map payloads, sealed permits implementation - -### Constructor Summary -| Constructor and Description | -| --------------------------- | -| FakeDeleteHeaderParameters1BoxedMap([HeaderParametersMap](#headerparametersmap) data)
Creates an instance, private visibility | - -### Method Summary -| Modifier and Type | Method and Description | -| ----------------- | ---------------------- | -| [HeaderParametersMap](#headerparametersmap) | data()
validated payload | -| @Nullable Object | getData()
validated payload | - -## FakeDeleteHeaderParameters1 -public static class FakeDeleteHeaderParameters1
-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.fake.delete.FakeDeleteHeaderParameters; - -import java.util.Arrays; -import java.util.List; -import java.util.AbstractMap; - -static final SchemaConfiguration configuration = new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().build()); - -// Map validation -FakeDeleteHeaderParameters.HeaderParametersMap validatedPayload = - FakeDeleteHeaderParameters.FakeDeleteHeaderParameters1.validate( - new FakeDeleteHeaderParameters.HeaderParametersMapBuilder() - .required_boolean_group("true") - - .boolean_group("true") - - .build(), - configuration -); -``` - -### Field Summary -| Modifier and Type | Field and Description | -| ----------------- | ---------------------- | -| Set> | type = Set.of(Map.class) | -| Map> | properties = Map.ofEntries(
    new PropertyEntry("required_boolean_group", [Schema1.Schema11.class](../../../paths/fake/delete/parameters/parameter1/Schema1.md#schema11)),
    new PropertyEntry("boolean_group", [Schema4.Schema41.class](../../../paths/fake/delete/parameters/parameter4/Schema4.md#schema41))
)
| -| Set | required = Set.of(
    "required_boolean_group"
)
| -| Class | additionalProperties = [AdditionalProperties.class](#additionalproperties) | - -### Method Summary -| Modifier and Type | Method and Description | -| ----------------- | ---------------------- | -| [HeaderParametersMap](#headerparametersmap) | validate([Map<?, ?>](#headerparametersmapbuilder) arg, SchemaConfiguration configuration) | -| [FakeDeleteHeaderParameters1BoxedMap](#fakedeleteheaderparameters1boxedmap) | validateAndBox([Map<?, ?>](#headerparametersmapbuilder) arg, SchemaConfiguration configuration) | -| [FakeDeleteHeaderParameters1Boxed](#fakedeleteheaderparameters1boxed) | validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) | -| @Nullable Object | validate(@Nullable Object arg, SchemaConfiguration configuration) | - -## HeaderParametersMap0Builder -public class HeaderParametersMap0Builder
-builder for `Map` - -A class that builds the Map input type - -### Constructor Summary -| Constructor and Description | -| --------------------------- | -| HeaderParametersMap0Builder(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 | -| [HeaderParametersMap0Builder](#headerparametersmap0builder) | boolean_group(String value) | -| [HeaderParametersMap0Builder](#headerparametersmap0builder) | boolean_group([Schema4.StringSchemaEnums4](../../../paths/fake/delete/parameters/parameter4/Schema4.md#stringschemaenums4) value) | - -## HeaderParametersMapBuilder -public class HeaderParametersMapBuilder
-builder for `Map` - -A class that builds the Map input type - -### Constructor Summary -| Constructor and Description | -| --------------------------- | -| HeaderParametersMapBuilder()
Creates a builder that contains an empty map | - -### Method Summary -| Modifier and Type | Method and Description | -| ----------------- | ---------------------- | -| [HeaderParametersMap0Builder](#headerparametersmap0builder) | required_boolean_group(String value) | -| [HeaderParametersMap0Builder](#headerparametersmap0builder) | required_boolean_group([Schema1.StringSchemaEnums1](../../../paths/fake/delete/parameters/parameter1/Schema1.md#stringschemaenums1) value) | - -## HeaderParametersMap -public static class HeaderParametersMap
-extends FrozenMap - -A class to store validated Map payloads - -### Method Summary -| Modifier and Type | Method and Description | -| ----------------- | ---------------------- | -| static [HeaderParametersMap](#headerparametersmap) | of([Map](#headerparametersmapbuilder) arg, SchemaConfiguration configuration) | -| String | required_boolean_group()
| -| String | boolean_group()
[optional] | - -## 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(Nothing? data)
Creates an instance, private visibility | - -### Method Summary -| Modifier and Type | Method and Description | -| ----------------- | ---------------------- | -| Nothing? | 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/kotlin/docs/paths/fake/delete/FakeDeleteQueryParameters.md b/samples/client/petstore/kotlin/docs/paths/fake/delete/FakeDeleteQueryParameters.md deleted file mode 100644 index f3438757587..00000000000 --- a/samples/client/petstore/kotlin/docs/paths/fake/delete/FakeDeleteQueryParameters.md +++ /dev/null @@ -1,321 +0,0 @@ -# FakeDeleteQueryParameters -public class FakeDeleteQueryParameters
- -A class that contains necessary nested -- schema classes (which validate payloads), extends JsonSchema -- sealed interfaces which store validated payloads, java version of a sum type -- boxed classes which store validated payloads, sealed permits class implementations -- classes to store validated map payloads, extends FrozenMap -- classes to build inputs for map payloads - -## Nested Class Summary -| Modifier and Type | Class and Description | -| ----------------- | ---------------------- | -| sealed interface | [FakeDeleteQueryParameters.FakeDeleteQueryParameters1Boxed](#fakedeletequeryparameters1boxed)
sealed interface for validated payloads | -| record | [FakeDeleteQueryParameters.FakeDeleteQueryParameters1BoxedMap](#fakedeletequeryparameters1boxedmap)
boxed class to store validated Map payloads | -| static class | [FakeDeleteQueryParameters.FakeDeleteQueryParameters1](#fakedeletequeryparameters1)
schema class | -| static class | [FakeDeleteQueryParameters.QueryParametersMapBuilder](#queryparametersmapbuilder)
builder for Map payloads | -| static class | [FakeDeleteQueryParameters.QueryParametersMap](#queryparametersmap)
output class for Map payloads | -| sealed interface | [FakeDeleteQueryParameters.AdditionalPropertiesBoxed](#additionalpropertiesboxed)
sealed interface for validated payloads | -| record | [FakeDeleteQueryParameters.AdditionalPropertiesBoxedVoid](#additionalpropertiesboxedvoid)
boxed class to store validated null payloads | -| record | [FakeDeleteQueryParameters.AdditionalPropertiesBoxedBoolean](#additionalpropertiesboxedboolean)
boxed class to store validated boolean payloads | -| record | [FakeDeleteQueryParameters.AdditionalPropertiesBoxedNumber](#additionalpropertiesboxednumber)
boxed class to store validated Number payloads | -| record | [FakeDeleteQueryParameters.AdditionalPropertiesBoxedString](#additionalpropertiesboxedstring)
boxed class to store validated String payloads | -| record | [FakeDeleteQueryParameters.AdditionalPropertiesBoxedList](#additionalpropertiesboxedlist)
boxed class to store validated List payloads | -| record | [FakeDeleteQueryParameters.AdditionalPropertiesBoxedMap](#additionalpropertiesboxedmap)
boxed class to store validated Map payloads | -| static class | [FakeDeleteQueryParameters.AdditionalProperties](#additionalproperties)
schema class | - -## FakeDeleteQueryParameters1Boxed -public sealed interface FakeDeleteQueryParameters1Boxed
-permits
-[FakeDeleteQueryParameters1BoxedMap](#fakedeletequeryparameters1boxedmap) - -sealed interface that stores validated payloads using boxed classes - -## FakeDeleteQueryParameters1BoxedMap -public record FakeDeleteQueryParameters1BoxedMap
-implements [FakeDeleteQueryParameters1Boxed](#fakedeletequeryparameters1boxed) - -record that stores validated Map payloads, sealed permits implementation - -### Constructor Summary -| Constructor and Description | -| --------------------------- | -| FakeDeleteQueryParameters1BoxedMap([QueryParametersMap](#queryparametersmap) data)
Creates an instance, private visibility | - -### Method Summary -| Modifier and Type | Method and Description | -| ----------------- | ---------------------- | -| [QueryParametersMap](#queryparametersmap) | data()
validated payload | -| @Nullable Object | getData()
validated payload | - -## FakeDeleteQueryParameters1 -public static class FakeDeleteQueryParameters1
-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.fake.delete.FakeDeleteQueryParameters; - -import java.util.Arrays; -import java.util.List; -import java.util.AbstractMap; - -static final SchemaConfiguration configuration = new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().build()); - -// Map validation -FakeDeleteQueryParameters.QueryParametersMap validatedPayload = - FakeDeleteQueryParameters.FakeDeleteQueryParameters1.validate( - new FakeDeleteQueryParameters.QueryParametersMapBuilder() - .required_int64_group(1L) - - .required_string_group("a") - - .int64_group(1L) - - .string_group("a") - - .build(), - configuration -); -``` - -### Field Summary -| Modifier and Type | Field and Description | -| ----------------- | ---------------------- | -| Set> | type = Set.of(Map.class) | -| Map> | properties = Map.ofEntries(
    new PropertyEntry("required_string_group", [Schema0.Schema01.class](../../../paths/fake/delete/parameters/parameter0/Schema0.md#schema01)),
    new PropertyEntry("int64_group", [Schema5.Schema51.class](../../../paths/fake/delete/parameters/parameter5/Schema5.md#schema51)),
    new PropertyEntry("string_group", [Schema3.Schema31.class](../../../paths/fake/delete/parameters/parameter3/Schema3.md#schema31)),
    new PropertyEntry("required_int64_group", [Schema2.Schema21.class](../../../paths/fake/delete/parameters/parameter2/Schema2.md#schema21))
)
| -| Set | required = Set.of(
    "required_int64_group",
    "required_string_group"
)
| -| Class | additionalProperties = [AdditionalProperties.class](#additionalproperties) | - -### Method Summary -| Modifier and Type | Method and Description | -| ----------------- | ---------------------- | -| [QueryParametersMap](#queryparametersmap) | validate([Map<?, ?>](#queryparametersmapbuilder) arg, SchemaConfiguration configuration) | -| [FakeDeleteQueryParameters1BoxedMap](#fakedeletequeryparameters1boxedmap) | validateAndBox([Map<?, ?>](#queryparametersmapbuilder) arg, SchemaConfiguration configuration) | -| [FakeDeleteQueryParameters1Boxed](#fakedeletequeryparameters1boxed) | validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) | -| @Nullable Object | validate(@Nullable Object arg, SchemaConfiguration configuration) | - -## QueryParametersMap00Builder -public class QueryParametersMap00Builder
-builder for `Map` - -A class that builds the Map input type - -### Constructor Summary -| Constructor and Description | -| --------------------------- | -| QueryParametersMap00Builder(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 | -| [QueryParametersMap00Builder](#queryparametersmap00builder) | int64_group(int value) | -| [QueryParametersMap00Builder](#queryparametersmap00builder) | int64_group(float value) | -| [QueryParametersMap00Builder](#queryparametersmap00builder) | int64_group(long value) | -| [QueryParametersMap00Builder](#queryparametersmap00builder) | int64_group(double value) | -| [QueryParametersMap00Builder](#queryparametersmap00builder) | string_group(String value) | - -## QueryParametersMap01Builder -public class QueryParametersMap01Builder
-builder for `Map` - -A class that builds the Map input type - -### Constructor Summary -| Constructor and Description | -| --------------------------- | -| QueryParametersMap01Builder(Map instance)
Creates a builder that contains the passed instance | - -### Method Summary -| Modifier and Type | Method and Description | -| ----------------- | ---------------------- | -| [QueryParametersMap00Builder](#queryparametersmap00builder) | required_string_group(String value) | - -## QueryParametersMap10Builder -public class QueryParametersMap10Builder
-builder for `Map` - -A class that builds the Map input type - -### Constructor Summary -| Constructor and Description | -| --------------------------- | -| QueryParametersMap10Builder(Map instance)
Creates a builder that contains the passed instance | - -### Method Summary -| Modifier and Type | Method and Description | -| ----------------- | ---------------------- | -| [QueryParametersMap00Builder](#queryparametersmap00builder) | required_int64_group(int value) | -| [QueryParametersMap00Builder](#queryparametersmap00builder) | required_int64_group(float value) | -| [QueryParametersMap00Builder](#queryparametersmap00builder) | required_int64_group(long value) | -| [QueryParametersMap00Builder](#queryparametersmap00builder) | required_int64_group(double value) | - -## QueryParametersMapBuilder -public class QueryParametersMapBuilder
-builder for `Map` - -A class that builds the Map input type - -### Constructor Summary -| Constructor and Description | -| --------------------------- | -| QueryParametersMapBuilder()
Creates a builder that contains an empty map | - -### Method Summary -| Modifier and Type | Method and Description | -| ----------------- | ---------------------- | -| [QueryParametersMap01Builder](#queryparametersmap01builder) | required_int64_group(int value) | -| [QueryParametersMap01Builder](#queryparametersmap01builder) | required_int64_group(float value) | -| [QueryParametersMap01Builder](#queryparametersmap01builder) | required_int64_group(long value) | -| [QueryParametersMap01Builder](#queryparametersmap01builder) | required_int64_group(double value) | -| [QueryParametersMap10Builder](#queryparametersmap10builder) | required_string_group(String value) | - -## QueryParametersMap -public static class QueryParametersMap
-extends FrozenMap - -A class to store validated Map payloads - -### Method Summary -| Modifier and Type | Method and Description | -| ----------------- | ---------------------- | -| static [QueryParametersMap](#queryparametersmap) | of([Map](#queryparametersmapbuilder) arg, SchemaConfiguration configuration) | -| Number | required_int64_group()
| -| String | required_string_group()
| -| Number | int64_group()
[optional] | -| String | string_group()
[optional] | - -## 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(Nothing? data)
Creates an instance, private visibility | - -### Method Summary -| Modifier and Type | Method and Description | -| ----------------- | ---------------------- | -| Nothing? | 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/kotlin/docs/paths/fake/delete/FakeDeleteResponses.md b/samples/client/petstore/kotlin/docs/paths/fake/delete/FakeDeleteResponses.md deleted file mode 100644 index f4c06c8a474..00000000000 --- a/samples/client/petstore/kotlin/docs/paths/fake/delete/FakeDeleteResponses.md +++ /dev/null @@ -1,29 +0,0 @@ -# FakeDeleteResponses - -public class FakeDeleteResponses - -A class that contains necessary responses classes -- a sealed interface, EndpointResponse, that stores endpoint responses -- records for each endpoint response - -## Nested Class Summary -| Modifier and Type | Class and Description | -| ----------------- | --------------------- | -| sealed interface | [EndpointResponse](#endpointresponse)
stores the endpoint responses | -| record | [EndpointFakeDeleteCode200Response](#endpointfakedeletecode200response)
the response for 200 | - -## EndpointResponse -public sealed interface EndpointResponse permits
-[EndpointFakeDeleteCode200Response](#endpointfakedeletecode200response) - -a sealed interface that stores endpoint responses - -## EndpointFakeDeleteCode200Response -public record EndpointFakeDeleteCode200Response( - HttpResponse response, - Nothing? body, - Nothing? headers -) implements EndpointResponse, ApiResponse
- -a class that stores an endpoint response - diff --git a/samples/client/petstore/kotlin/docs/paths/fake/delete/FakeDeleteSecurityInfo.md b/samples/client/petstore/kotlin/docs/paths/fake/delete/FakeDeleteSecurityInfo.md deleted file mode 100644 index 7c008b766c7..00000000000 --- a/samples/client/petstore/kotlin/docs/paths/fake/delete/FakeDeleteSecurityInfo.md +++ /dev/null @@ -1,40 +0,0 @@ -# FakeDeleteSecurityInfo -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 -- an enum class that describes security index values - -## Nested Class Summary -| Modifier and Type | Class and Description | -| ----------------- | --------------------- | -| static class | [FakeDeleteSecurityInfo.FakeDeleteSecurityInfo1](#fakedeletesecurityinfo1)
SecurityRequirementObjectProvider -| enum | [FakeDeleteSecurityInfo.SecurityIndex](#securityindex)
class that stores a security index | - -## FakeDeleteSecurityInfo1 -implements SecurityRequirementObjectProvider<[SecurityIndex](#securityindex)> - -### Constructor Summary -| Constructor and Description | -| --------------------------- | -| FakeDeleteSecurityInfo1()
Creates an instance | - -### Field Summary -| Modifier and Type | Field and Description | -| ----------------- | --------------------- | -| [FakeDeleteSecurityRequirementObject0](../../../paths/fake/delete/security/FakeDeleteSecurityRequirementObject0.md) | security0 | - -### Method Summary -| Modifier and Type | Method and Description | -| ----------------- | ---------------------- | -| SecurityRequirementObject | getSecurityRequirementObject(@Nullable [SecurityIndex](#securityindex) securityIndex)
If null is input, then the instance's securityIndex will be used | - -## SecurityIndex -enum SecurityIndex
- -### Enum Constant Summary -| Enum Constant And Description | -| ----------------------------- | -| SECURITY_0
security 0 | diff --git a/samples/client/petstore/kotlin/docs/paths/fake/delete/parameters/parameter0/Schema0.md b/samples/client/petstore/kotlin/docs/paths/fake/delete/parameters/parameter0/Schema0.md deleted file mode 100644 index 9ff90e0bc35..00000000000 --- a/samples/client/petstore/kotlin/docs/paths/fake/delete/parameters/parameter0/Schema0.md +++ /dev/null @@ -1,49 +0,0 @@ -# Schema0 -public class Schema0
- -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 - -## Nested Class Summary -| Modifier and Type | Class and Description | -| ----------------- | ---------------------- | -| sealed interface | [Schema0.Schema01Boxed](#schema01boxed)
sealed interface for validated payloads | -| record | [Schema0.Schema01BoxedString](#schema01boxedstring)
boxed class to store validated String payloads | -| static class | [Schema0.Schema01](#schema01)
schema class | - -## Schema01Boxed -public sealed interface Schema01Boxed
-permits
-[Schema01BoxedString](#schema01boxedstring) - -sealed interface that stores validated payloads using boxed classes - -## Schema01BoxedString -public record Schema01BoxedString
-implements [Schema01Boxed](#schema01boxed) - -record that stores validated String payloads, sealed permits implementation - -### Constructor Summary -| Constructor and Description | -| --------------------------- | -| Schema01BoxedString(String data)
Creates an instance, private visibility | - -### Method Summary -| Modifier and Type | Method and Description | -| ----------------- | ---------------------- | -| String | data()
validated payload | -| @Nullable Object | getData()
validated payload | - -## Schema01 -public static class Schema01
-extends StringJsonSchema.StringJsonSchema1 - -A schema class that validates payloads - -| Methods Inherited from class org.openapijsonschematools.client.schemas.StringJsonSchema.StringJsonSchema1 | -| ------------------------------------------------------------------ | -| validate | -| validateAndBox | diff --git a/samples/client/petstore/kotlin/docs/paths/fake/delete/parameters/parameter1/Schema1.md b/samples/client/petstore/kotlin/docs/paths/fake/delete/parameters/parameter1/Schema1.md deleted file mode 100644 index 8f952c2caf2..00000000000 --- a/samples/client/petstore/kotlin/docs/paths/fake/delete/parameters/parameter1/Schema1.md +++ /dev/null @@ -1,96 +0,0 @@ -# Schema1 -public class Schema1
- -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 -- enum classes - -## Nested Class Summary -| Modifier and Type | Class and Description | -| ----------------- | ---------------------- | -| sealed interface | [Schema1.Schema11Boxed](#schema11boxed)
sealed interface for validated payloads | -| record | [Schema1.Schema11BoxedString](#schema11boxedstring)
boxed class to store validated String payloads | -| static class | [Schema1.Schema11](#schema11)
schema class | -| enum | [Schema1.StringSchemaEnums1](#stringschemaenums1)
String enum | - -## Schema11Boxed -public sealed interface Schema11Boxed
-permits
-[Schema11BoxedString](#schema11boxedstring) - -sealed interface that stores validated payloads using boxed classes - -## Schema11BoxedString -public record Schema11BoxedString
-implements [Schema11Boxed](#schema11boxed) - -record that stores validated String payloads, sealed permits implementation - -### Constructor Summary -| Constructor and Description | -| --------------------------- | -| Schema11BoxedString(String data)
Creates an instance, private visibility | - -### Method Summary -| Modifier and Type | Method and Description | -| ----------------- | ---------------------- | -| String | data()
validated payload | -| @Nullable Object | getData()
validated payload | - -## Schema11 -public static class Schema11
-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.fake.delete.parameters.parameter1.Schema1; - -import java.util.Arrays; -import java.util.List; -import java.util.AbstractMap; - -static final SchemaConfiguration configuration = new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().build()); - -// String validation -String validatedPayload = Schema1.Schema11.validate( - "true", - configuration -); -``` - -### Field Summary -| Modifier and Type | Field and Description | -| ----------------- | ---------------------- | -| Set> | type = Set.of(
    String.class
)
| -| Set | enumValues = SetMaker.makeSet(
    "true",
    "false"
)
| - -### Method Summary -| Modifier and Type | Method and Description | -| ----------------- | ---------------------- | -| String | validate(String arg, SchemaConfiguration configuration) | -| String | validate([StringSchemaEnums1](#stringschemaenums1) arg, SchemaConfiguration configuration) | -| [Schema11BoxedString](#schema11boxedstring) | validateAndBox(String arg, SchemaConfiguration configuration) | -| [Schema11Boxed](#schema11boxed) | validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) | -| @Nullable Object | validate(@Nullable Object arg, SchemaConfiguration configuration) | - -## StringSchemaEnums1 -public enum StringSchemaEnums1
-extends `Enum` - -A class that stores String enum values - -### Enum Constant Summary -| Enum Constant | Description | -| ------------- | ----------- | -| TRUE | value = "true" | -| FALSE | value = "false" | diff --git a/samples/client/petstore/kotlin/docs/paths/fake/delete/parameters/parameter2/Schema2.md b/samples/client/petstore/kotlin/docs/paths/fake/delete/parameters/parameter2/Schema2.md deleted file mode 100644 index 440bb8ca283..00000000000 --- a/samples/client/petstore/kotlin/docs/paths/fake/delete/parameters/parameter2/Schema2.md +++ /dev/null @@ -1,49 +0,0 @@ -# Schema2 -public class Schema2
- -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 - -## Nested Class Summary -| Modifier and Type | Class and Description | -| ----------------- | ---------------------- | -| sealed interface | [Schema2.Schema21Boxed](#schema21boxed)
sealed interface for validated payloads | -| record | [Schema2.Schema21BoxedNumber](#schema21boxednumber)
boxed class to store validated Number payloads | -| static class | [Schema2.Schema21](#schema21)
schema class | - -## Schema21Boxed -public sealed interface Schema21Boxed
-permits
-[Schema21BoxedNumber](#schema21boxednumber) - -sealed interface that stores validated payloads using boxed classes - -## Schema21BoxedNumber -public record Schema21BoxedNumber
-implements [Schema21Boxed](#schema21boxed) - -record that stores validated Number payloads, sealed permits implementation - -### Constructor Summary -| Constructor and Description | -| --------------------------- | -| Schema21BoxedNumber(Number data)
Creates an instance, private visibility | - -### Method Summary -| Modifier and Type | Method and Description | -| ----------------- | ---------------------- | -| Number | data()
validated payload | -| @Nullable Object | getData()
validated payload | - -## Schema21 -public static class Schema21
-extends Int64JsonSchema.Int64JsonSchema1 - -A schema class that validates payloads - -| Methods Inherited from class org.openapijsonschematools.client.schemas.Int64JsonSchema.Int64JsonSchema1 | -| ------------------------------------------------------------------ | -| validate | -| validateAndBox | diff --git a/samples/client/petstore/kotlin/docs/paths/fake/delete/parameters/parameter3/Schema3.md b/samples/client/petstore/kotlin/docs/paths/fake/delete/parameters/parameter3/Schema3.md deleted file mode 100644 index 41d54a1d930..00000000000 --- a/samples/client/petstore/kotlin/docs/paths/fake/delete/parameters/parameter3/Schema3.md +++ /dev/null @@ -1,49 +0,0 @@ -# Schema3 -public class Schema3
- -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 - -## Nested Class Summary -| Modifier and Type | Class and Description | -| ----------------- | ---------------------- | -| sealed interface | [Schema3.Schema31Boxed](#schema31boxed)
sealed interface for validated payloads | -| record | [Schema3.Schema31BoxedString](#schema31boxedstring)
boxed class to store validated String payloads | -| static class | [Schema3.Schema31](#schema31)
schema class | - -## Schema31Boxed -public sealed interface Schema31Boxed
-permits
-[Schema31BoxedString](#schema31boxedstring) - -sealed interface that stores validated payloads using boxed classes - -## Schema31BoxedString -public record Schema31BoxedString
-implements [Schema31Boxed](#schema31boxed) - -record that stores validated String payloads, sealed permits implementation - -### Constructor Summary -| Constructor and Description | -| --------------------------- | -| Schema31BoxedString(String data)
Creates an instance, private visibility | - -### Method Summary -| Modifier and Type | Method and Description | -| ----------------- | ---------------------- | -| String | data()
validated payload | -| @Nullable Object | getData()
validated payload | - -## Schema31 -public static class Schema31
-extends StringJsonSchema.StringJsonSchema1 - -A schema class that validates payloads - -| Methods Inherited from class org.openapijsonschematools.client.schemas.StringJsonSchema.StringJsonSchema1 | -| ------------------------------------------------------------------ | -| validate | -| validateAndBox | diff --git a/samples/client/petstore/kotlin/docs/paths/fake/delete/parameters/parameter4/Schema4.md b/samples/client/petstore/kotlin/docs/paths/fake/delete/parameters/parameter4/Schema4.md deleted file mode 100644 index deb5749b4c6..00000000000 --- a/samples/client/petstore/kotlin/docs/paths/fake/delete/parameters/parameter4/Schema4.md +++ /dev/null @@ -1,96 +0,0 @@ -# Schema4 -public class Schema4
- -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 -- enum classes - -## Nested Class Summary -| Modifier and Type | Class and Description | -| ----------------- | ---------------------- | -| sealed interface | [Schema4.Schema41Boxed](#schema41boxed)
sealed interface for validated payloads | -| record | [Schema4.Schema41BoxedString](#schema41boxedstring)
boxed class to store validated String payloads | -| static class | [Schema4.Schema41](#schema41)
schema class | -| enum | [Schema4.StringSchemaEnums4](#stringschemaenums4)
String enum | - -## Schema41Boxed -public sealed interface Schema41Boxed
-permits
-[Schema41BoxedString](#schema41boxedstring) - -sealed interface that stores validated payloads using boxed classes - -## Schema41BoxedString -public record Schema41BoxedString
-implements [Schema41Boxed](#schema41boxed) - -record that stores validated String payloads, sealed permits implementation - -### Constructor Summary -| Constructor and Description | -| --------------------------- | -| Schema41BoxedString(String data)
Creates an instance, private visibility | - -### Method Summary -| Modifier and Type | Method and Description | -| ----------------- | ---------------------- | -| String | data()
validated payload | -| @Nullable Object | getData()
validated payload | - -## Schema41 -public static class Schema41
-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.fake.delete.parameters.parameter4.Schema4; - -import java.util.Arrays; -import java.util.List; -import java.util.AbstractMap; - -static final SchemaConfiguration configuration = new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().build()); - -// String validation -String validatedPayload = Schema4.Schema41.validate( - "true", - configuration -); -``` - -### Field Summary -| Modifier and Type | Field and Description | -| ----------------- | ---------------------- | -| Set> | type = Set.of(
    String.class
)
| -| Set | enumValues = SetMaker.makeSet(
    "true",
    "false"
)
| - -### Method Summary -| Modifier and Type | Method and Description | -| ----------------- | ---------------------- | -| String | validate(String arg, SchemaConfiguration configuration) | -| String | validate([StringSchemaEnums4](#stringschemaenums4) arg, SchemaConfiguration configuration) | -| [Schema41BoxedString](#schema41boxedstring) | validateAndBox(String arg, SchemaConfiguration configuration) | -| [Schema41Boxed](#schema41boxed) | validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) | -| @Nullable Object | validate(@Nullable Object arg, SchemaConfiguration configuration) | - -## StringSchemaEnums4 -public enum StringSchemaEnums4
-extends `Enum` - -A class that stores String enum values - -### Enum Constant Summary -| Enum Constant | Description | -| ------------- | ----------- | -| TRUE | value = "true" | -| FALSE | value = "false" | diff --git a/samples/client/petstore/kotlin/docs/paths/fake/delete/parameters/parameter5/Schema5.md b/samples/client/petstore/kotlin/docs/paths/fake/delete/parameters/parameter5/Schema5.md deleted file mode 100644 index 9611a34edb2..00000000000 --- a/samples/client/petstore/kotlin/docs/paths/fake/delete/parameters/parameter5/Schema5.md +++ /dev/null @@ -1,49 +0,0 @@ -# Schema5 -public class Schema5
- -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 - -## Nested Class Summary -| Modifier and Type | Class and Description | -| ----------------- | ---------------------- | -| sealed interface | [Schema5.Schema51Boxed](#schema51boxed)
sealed interface for validated payloads | -| record | [Schema5.Schema51BoxedNumber](#schema51boxednumber)
boxed class to store validated Number payloads | -| static class | [Schema5.Schema51](#schema51)
schema class | - -## Schema51Boxed -public sealed interface Schema51Boxed
-permits
-[Schema51BoxedNumber](#schema51boxednumber) - -sealed interface that stores validated payloads using boxed classes - -## Schema51BoxedNumber -public record Schema51BoxedNumber
-implements [Schema51Boxed](#schema51boxed) - -record that stores validated Number payloads, sealed permits implementation - -### Constructor Summary -| Constructor and Description | -| --------------------------- | -| Schema51BoxedNumber(Number data)
Creates an instance, private visibility | - -### Method Summary -| Modifier and Type | Method and Description | -| ----------------- | ---------------------- | -| Number | data()
validated payload | -| @Nullable Object | getData()
validated payload | - -## Schema51 -public static class Schema51
-extends Int64JsonSchema.Int64JsonSchema1 - -A schema class that validates payloads - -| Methods Inherited from class org.openapijsonschematools.client.schemas.Int64JsonSchema.Int64JsonSchema1 | -| ------------------------------------------------------------------ | -| validate | -| validateAndBox | diff --git a/samples/client/petstore/kotlin/docs/paths/fake/delete/responses/FakeDeleteCode200Response.md b/samples/client/petstore/kotlin/docs/paths/fake/delete/responses/FakeDeleteCode200Response.md deleted file mode 100644 index 64d63ac41a4..00000000000 --- a/samples/client/petstore/kotlin/docs/paths/fake/delete/responses/FakeDeleteCode200Response.md +++ /dev/null @@ -1,17 +0,0 @@ -# FakeDeleteCode200Response - -public class FakeDeleteCode200Response extends [SuccessDescriptionOnly](../../components/responses/SuccessDescriptionOnly.md) - -A class (extended from the $ref class) that contains necessary nested response classes -- a class that extends ResponseDeserializer and is used to deserialize responses - -## Nested Class Summary -| Modifier and Type | Class and Description | -| ----------------- | --------------------- | -| static class | [FakeDeleteCode200Response.FakeDeleteCode200Response1](#fakedeletecode200response1)
class that deserializes responses | - -## FakeDeleteCode200Response1 -public static class FakeDeleteCode200Response1 extends [SuccessDescriptionOnly1](../../components/responses/SuccessDescriptionOnly.md#successdescriptiononly1)
- -a class that deserializes responses, extended from the $ref class - diff --git a/samples/client/petstore/kotlin/docs/paths/fake/delete/security/FakeDeleteSecurityRequirementObject0.md b/samples/client/petstore/kotlin/docs/paths/fake/delete/security/FakeDeleteSecurityRequirementObject0.md deleted file mode 100644 index ce14db9f6b9..00000000000 --- a/samples/client/petstore/kotlin/docs/paths/fake/delete/security/FakeDeleteSecurityRequirementObject0.md +++ /dev/null @@ -1,15 +0,0 @@ -# FakeDeleteSecurityRequirementObject0 -FakeDeleteSecurityRequirementObject0.java - -public class FakeDeleteSecurityRequirementObject0 -extends SecurityRequirementObject - -### Constructor Summary -| Constructor and Description | -| --------------------------- | -| FakeDeleteSecurityRequirementObject0()
Creates an instance | - -### 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()
    )) | diff --git a/samples/client/petstore/kotlin/docs/paths/fake/get/FakeGetHeaderParameters.md b/samples/client/petstore/kotlin/docs/paths/fake/get/FakeGetHeaderParameters.md deleted file mode 100644 index 3d5df92bc19..00000000000 --- a/samples/client/petstore/kotlin/docs/paths/fake/get/FakeGetHeaderParameters.md +++ /dev/null @@ -1,260 +0,0 @@ -# FakeGetHeaderParameters -public class FakeGetHeaderParameters
- -A class that contains necessary nested -- schema classes (which validate payloads), extends JsonSchema -- sealed interfaces which store validated payloads, java version of a sum type -- boxed classes which store validated payloads, sealed permits class implementations -- classes to store validated map payloads, extends FrozenMap -- classes to build inputs for map payloads - -## Nested Class Summary -| Modifier and Type | Class and Description | -| ----------------- | ---------------------- | -| sealed interface | [FakeGetHeaderParameters.FakeGetHeaderParameters1Boxed](#fakegetheaderparameters1boxed)
sealed interface for validated payloads | -| record | [FakeGetHeaderParameters.FakeGetHeaderParameters1BoxedMap](#fakegetheaderparameters1boxedmap)
boxed class to store validated Map payloads | -| static class | [FakeGetHeaderParameters.FakeGetHeaderParameters1](#fakegetheaderparameters1)
schema class | -| static class | [FakeGetHeaderParameters.HeaderParametersMapBuilder](#headerparametersmapbuilder)
builder for Map payloads | -| static class | [FakeGetHeaderParameters.HeaderParametersMap](#headerparametersmap)
output class for Map payloads | -| sealed interface | [FakeGetHeaderParameters.AdditionalPropertiesBoxed](#additionalpropertiesboxed)
sealed interface for validated payloads | -| record | [FakeGetHeaderParameters.AdditionalPropertiesBoxedVoid](#additionalpropertiesboxedvoid)
boxed class to store validated null payloads | -| record | [FakeGetHeaderParameters.AdditionalPropertiesBoxedBoolean](#additionalpropertiesboxedboolean)
boxed class to store validated boolean payloads | -| record | [FakeGetHeaderParameters.AdditionalPropertiesBoxedNumber](#additionalpropertiesboxednumber)
boxed class to store validated Number payloads | -| record | [FakeGetHeaderParameters.AdditionalPropertiesBoxedString](#additionalpropertiesboxedstring)
boxed class to store validated String payloads | -| record | [FakeGetHeaderParameters.AdditionalPropertiesBoxedList](#additionalpropertiesboxedlist)
boxed class to store validated List payloads | -| record | [FakeGetHeaderParameters.AdditionalPropertiesBoxedMap](#additionalpropertiesboxedmap)
boxed class to store validated Map payloads | -| static class | [FakeGetHeaderParameters.AdditionalProperties](#additionalproperties)
schema class | - -## FakeGetHeaderParameters1Boxed -public sealed interface FakeGetHeaderParameters1Boxed
-permits
-[FakeGetHeaderParameters1BoxedMap](#fakegetheaderparameters1boxedmap) - -sealed interface that stores validated payloads using boxed classes - -## FakeGetHeaderParameters1BoxedMap -public record FakeGetHeaderParameters1BoxedMap
-implements [FakeGetHeaderParameters1Boxed](#fakegetheaderparameters1boxed) - -record that stores validated Map payloads, sealed permits implementation - -### Constructor Summary -| Constructor and Description | -| --------------------------- | -| FakeGetHeaderParameters1BoxedMap([HeaderParametersMap](#headerparametersmap) data)
Creates an instance, private visibility | - -### Method Summary -| Modifier and Type | Method and Description | -| ----------------- | ---------------------- | -| [HeaderParametersMap](#headerparametersmap) | data()
validated payload | -| @Nullable Object | getData()
validated payload | - -## FakeGetHeaderParameters1 -public static class FakeGetHeaderParameters1
-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.fake.get.FakeGetHeaderParameters; - -import java.util.Arrays; -import java.util.List; -import java.util.AbstractMap; - -static final SchemaConfiguration configuration = new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().build()); - -// Map validation -FakeGetHeaderParameters.HeaderParametersMap validatedPayload = - FakeGetHeaderParameters.FakeGetHeaderParameters1.validate( - new FakeGetHeaderParameters.HeaderParametersMapBuilder() - .enum_header_string("_abc") - - .enum_header_string_array( - Arrays.asList( - ">" - ) - ) - .build(), - configuration -); -``` - -### Field Summary -| Modifier and Type | Field and Description | -| ----------------- | ---------------------- | -| Set> | type = Set.of(Map.class) | -| Map> | properties = Map.ofEntries(
    new PropertyEntry("enum_header_string", [Schema1.Schema11.class](../../../paths/fake/get/parameters/parameter1/Schema1.md#schema11)),
    new PropertyEntry("enum_header_string_array", [Schema0.Schema01.class](../../../paths/fake/get/parameters/parameter0/Schema0.md#schema01))
)
| -| Class | additionalProperties = [AdditionalProperties.class](#additionalproperties) | - -### Method Summary -| Modifier and Type | Method and Description | -| ----------------- | ---------------------- | -| [HeaderParametersMap](#headerparametersmap) | validate([Map<?, ?>](#headerparametersmapbuilder) arg, SchemaConfiguration configuration) | -| [FakeGetHeaderParameters1BoxedMap](#fakegetheaderparameters1boxedmap) | validateAndBox([Map<?, ?>](#headerparametersmapbuilder) arg, SchemaConfiguration configuration) | -| [FakeGetHeaderParameters1Boxed](#fakegetheaderparameters1boxed) | validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) | -| @Nullable Object | validate(@Nullable Object arg, SchemaConfiguration configuration) | - -## HeaderParametersMapBuilder -public class HeaderParametersMapBuilder
-builder for `Map` - -A class that builds the Map input type - -### Constructor Summary -| Constructor and Description | -| --------------------------- | -| HeaderParametersMapBuilder()
Creates a builder that contains an empty map | - -### Method Summary -| Modifier and Type | Method and Description | -| ----------------- | ---------------------- | -| Map | build()
Returns map input that should be used with Schema.validate | -| [HeaderParametersMapBuilder](#headerparametersmapbuilder) | enum_header_string(String value) | -| [HeaderParametersMapBuilder](#headerparametersmapbuilder) | enum_header_string([Schema1.StringSchemaEnums1](../../../paths/fake/get/parameters/parameter1/Schema1.md#stringschemaenums1) value) | -| [HeaderParametersMapBuilder](#headerparametersmapbuilder) | enum_header_string_array(List value) | - -## HeaderParametersMap -public static class HeaderParametersMap
-extends FrozenMap - -A class to store validated Map payloads - -### Method Summary -| Modifier and Type | Method and Description | -| ----------------- | ---------------------- | -| static [HeaderParametersMap](#headerparametersmap) | of([Map](#headerparametersmapbuilder) arg, SchemaConfiguration configuration) | -| String | enum_header_string()
[optional] | -| [Schema0.SchemaList0](../../../paths/fake/get/parameters/parameter0/Schema0.md#schemalist0) | enum_header_string_array()
[optional] | - -## 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(Nothing? data)
Creates an instance, private visibility | - -### Method Summary -| Modifier and Type | Method and Description | -| ----------------- | ---------------------- | -| Nothing? | 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/kotlin/docs/paths/fake/get/FakeGetQueryParameters.md b/samples/client/petstore/kotlin/docs/paths/fake/get/FakeGetQueryParameters.md deleted file mode 100644 index afeff7e46dc..00000000000 --- a/samples/client/petstore/kotlin/docs/paths/fake/get/FakeGetQueryParameters.md +++ /dev/null @@ -1,278 +0,0 @@ -# FakeGetQueryParameters -public class FakeGetQueryParameters
- -A class that contains necessary nested -- schema classes (which validate payloads), extends JsonSchema -- sealed interfaces which store validated payloads, java version of a sum type -- boxed classes which store validated payloads, sealed permits class implementations -- classes to store validated map payloads, extends FrozenMap -- classes to build inputs for map payloads - -## Nested Class Summary -| Modifier and Type | Class and Description | -| ----------------- | ---------------------- | -| sealed interface | [FakeGetQueryParameters.FakeGetQueryParameters1Boxed](#fakegetqueryparameters1boxed)
sealed interface for validated payloads | -| record | [FakeGetQueryParameters.FakeGetQueryParameters1BoxedMap](#fakegetqueryparameters1boxedmap)
boxed class to store validated Map payloads | -| static class | [FakeGetQueryParameters.FakeGetQueryParameters1](#fakegetqueryparameters1)
schema class | -| static class | [FakeGetQueryParameters.QueryParametersMapBuilder](#queryparametersmapbuilder)
builder for Map payloads | -| static class | [FakeGetQueryParameters.QueryParametersMap](#queryparametersmap)
output class for Map payloads | -| sealed interface | [FakeGetQueryParameters.AdditionalPropertiesBoxed](#additionalpropertiesboxed)
sealed interface for validated payloads | -| record | [FakeGetQueryParameters.AdditionalPropertiesBoxedVoid](#additionalpropertiesboxedvoid)
boxed class to store validated null payloads | -| record | [FakeGetQueryParameters.AdditionalPropertiesBoxedBoolean](#additionalpropertiesboxedboolean)
boxed class to store validated boolean payloads | -| record | [FakeGetQueryParameters.AdditionalPropertiesBoxedNumber](#additionalpropertiesboxednumber)
boxed class to store validated Number payloads | -| record | [FakeGetQueryParameters.AdditionalPropertiesBoxedString](#additionalpropertiesboxedstring)
boxed class to store validated String payloads | -| record | [FakeGetQueryParameters.AdditionalPropertiesBoxedList](#additionalpropertiesboxedlist)
boxed class to store validated List payloads | -| record | [FakeGetQueryParameters.AdditionalPropertiesBoxedMap](#additionalpropertiesboxedmap)
boxed class to store validated Map payloads | -| static class | [FakeGetQueryParameters.AdditionalProperties](#additionalproperties)
schema class | - -## FakeGetQueryParameters1Boxed -public sealed interface FakeGetQueryParameters1Boxed
-permits
-[FakeGetQueryParameters1BoxedMap](#fakegetqueryparameters1boxedmap) - -sealed interface that stores validated payloads using boxed classes - -## FakeGetQueryParameters1BoxedMap -public record FakeGetQueryParameters1BoxedMap
-implements [FakeGetQueryParameters1Boxed](#fakegetqueryparameters1boxed) - -record that stores validated Map payloads, sealed permits implementation - -### Constructor Summary -| Constructor and Description | -| --------------------------- | -| FakeGetQueryParameters1BoxedMap([QueryParametersMap](#queryparametersmap) data)
Creates an instance, private visibility | - -### Method Summary -| Modifier and Type | Method and Description | -| ----------------- | ---------------------- | -| [QueryParametersMap](#queryparametersmap) | data()
validated payload | -| @Nullable Object | getData()
validated payload | - -## FakeGetQueryParameters1 -public static class FakeGetQueryParameters1
-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.fake.get.FakeGetQueryParameters; - -import java.util.Arrays; -import java.util.List; -import java.util.AbstractMap; - -static final SchemaConfiguration configuration = new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().build()); - -// Map validation -FakeGetQueryParameters.QueryParametersMap validatedPayload = - FakeGetQueryParameters.FakeGetQueryParameters1.validate( - new FakeGetQueryParameters.QueryParametersMapBuilder() - .enum_query_double(3.14d) - - .enum_query_string("_abc") - - .enum_query_integer(1) - - .enum_query_string_array( - Arrays.asList( - ">" - ) - ) - .build(), - configuration -); -``` - -### Field Summary -| Modifier and Type | Field and Description | -| ----------------- | ---------------------- | -| Set> | type = Set.of(Map.class) | -| Map> | properties = Map.ofEntries(
    new PropertyEntry("enum_query_double", [Schema5.Schema51.class](../../../paths/fake/get/parameters/parameter5/Schema5.md#schema51)),
    new PropertyEntry("enum_query_string", [Schema3.Schema31.class](../../../paths/fake/get/parameters/parameter3/Schema3.md#schema31)),
    new PropertyEntry("enum_query_integer", [Schema4.Schema41.class](../../../paths/fake/get/parameters/parameter4/Schema4.md#schema41)),
    new PropertyEntry("enum_query_string_array", [Schema2.Schema21.class](../../../paths/fake/get/parameters/parameter2/Schema2.md#schema21))
)
| -| Class | additionalProperties = [AdditionalProperties.class](#additionalproperties) | - -### Method Summary -| Modifier and Type | Method and Description | -| ----------------- | ---------------------- | -| [QueryParametersMap](#queryparametersmap) | validate([Map<?, ?>](#queryparametersmapbuilder) arg, SchemaConfiguration configuration) | -| [FakeGetQueryParameters1BoxedMap](#fakegetqueryparameters1boxedmap) | validateAndBox([Map<?, ?>](#queryparametersmapbuilder) arg, SchemaConfiguration configuration) | -| [FakeGetQueryParameters1Boxed](#fakegetqueryparameters1boxed) | validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) | -| @Nullable Object | validate(@Nullable Object arg, SchemaConfiguration configuration) | - -## QueryParametersMapBuilder -public class QueryParametersMapBuilder
-builder for `Map` - -A class that builds the Map input type - -### Constructor Summary -| Constructor and Description | -| --------------------------- | -| QueryParametersMapBuilder()
Creates a builder that contains an empty map | - -### Method Summary -| Modifier and Type | Method and Description | -| ----------------- | ---------------------- | -| Map | build()
Returns map input that should be used with Schema.validate | -| [QueryParametersMapBuilder](#queryparametersmapbuilder) | enum_query_double(int value) | -| [QueryParametersMapBuilder](#queryparametersmapbuilder) | enum_query_double(float value) | -| [QueryParametersMapBuilder](#queryparametersmapbuilder) | enum_query_double(long value) | -| [QueryParametersMapBuilder](#queryparametersmapbuilder) | enum_query_double(double value) | -| [QueryParametersMapBuilder](#queryparametersmapbuilder) | enum_query_double([Schema5.DoubleSchemaEnums5](../../../paths/fake/get/parameters/parameter5/Schema5.md#doubleschemaenums5) value) | -| [QueryParametersMapBuilder](#queryparametersmapbuilder) | enum_query_double([Schema5.FloatSchemaEnums5](../../../paths/fake/get/parameters/parameter5/Schema5.md#floatschemaenums5) value) | -| [QueryParametersMapBuilder](#queryparametersmapbuilder) | enum_query_string(String value) | -| [QueryParametersMapBuilder](#queryparametersmapbuilder) | enum_query_string([Schema3.StringSchemaEnums3](../../../paths/fake/get/parameters/parameter3/Schema3.md#stringschemaenums3) value) | -| [QueryParametersMapBuilder](#queryparametersmapbuilder) | enum_query_integer(int value) | -| [QueryParametersMapBuilder](#queryparametersmapbuilder) | enum_query_integer(float value) | -| [QueryParametersMapBuilder](#queryparametersmapbuilder) | enum_query_integer([Schema4.IntegerSchemaEnums4](../../../paths/fake/get/parameters/parameter4/Schema4.md#integerschemaenums4) value) | -| [QueryParametersMapBuilder](#queryparametersmapbuilder) | enum_query_integer([Schema4.LongSchemaEnums4](../../../paths/fake/get/parameters/parameter4/Schema4.md#longschemaenums4) value) | -| [QueryParametersMapBuilder](#queryparametersmapbuilder) | enum_query_integer([Schema4.FloatSchemaEnums4](../../../paths/fake/get/parameters/parameter4/Schema4.md#floatschemaenums4) value) | -| [QueryParametersMapBuilder](#queryparametersmapbuilder) | enum_query_integer([Schema4.DoubleSchemaEnums4](../../../paths/fake/get/parameters/parameter4/Schema4.md#doubleschemaenums4) value) | -| [QueryParametersMapBuilder](#queryparametersmapbuilder) | enum_query_string_array(List value) | - -## QueryParametersMap -public static class QueryParametersMap
-extends FrozenMap - -A class to store validated Map payloads - -### Method Summary -| Modifier and Type | Method and Description | -| ----------------- | ---------------------- | -| static [QueryParametersMap](#queryparametersmap) | of([Map](#queryparametersmapbuilder) arg, SchemaConfiguration configuration) | -| Number | enum_query_double()
[optional] | -| String | enum_query_string()
[optional] | -| Number | enum_query_integer()
[optional] | -| [Schema2.SchemaList2](../../../paths/fake/get/parameters/parameter2/Schema2.md#schemalist2) | enum_query_string_array()
[optional] | - -## 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(Nothing? data)
Creates an instance, private visibility | - -### Method Summary -| Modifier and Type | Method and Description | -| ----------------- | ---------------------- | -| Nothing? | 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/kotlin/docs/paths/fake/get/FakeGetRequestBody.md b/samples/client/petstore/kotlin/docs/paths/fake/get/FakeGetRequestBody.md deleted file mode 100644 index 7da230c5537..00000000000 --- a/samples/client/petstore/kotlin/docs/paths/fake/get/FakeGetRequestBody.md +++ /dev/null @@ -1,90 +0,0 @@ -# FakeGetRequestBody - -public class FakeGetRequestBody - -A class that contains necessary nested request body classes -- SealedMediaType, a sealed interface which contains all the schema/encoding info for each contentType -- records which implement SealedMediaType, the concrete media types -- a class that extends RequestBodySerializer and is used to serialize input SealedRequestBody instances -- SealedRequestBody, a sealed interface which contains all the contentType/schema input types -- records which implement SealedRequestBody, the concrete request body types - -## Nested Class Summary -| Modifier and Type | Class and Description | -| ----------------- | --------------------- | -| sealed interface | [FakeGetRequestBody.SealedMediaType](#sealedmediatype)
media type sealed interface | -| record | [FakeGetRequestBody.ApplicationxwwwformurlencodedMediaType](#applicationxwwwformurlencodedmediatype)
record storing schema + encoding for a specific contentType | -| static class | [FakeGetRequestBody.FakeGetRequestBody1](#fakegetrequestbody1)
class that serializes request bodies | -| sealed interface | [FakeGetRequestBody.SealedRequestBody](#sealedrequestbody)
request body sealed interface | -| record | [FakeGetRequestBody.ApplicationxwwwformurlencodedRequestBody](#applicationxwwwformurlencodedrequestbody)
implements sealed interface to store request body input | - -## SealedMediaType -public sealed interface SealedMediaType
-permits
-[ApplicationxwwwformurlencodedMediaType](#applicationxwwwformurlencodedmediatype) - -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), Nothing?> - -class storing schema info for a specific contentType - -### Constructor Summary -| Constructor and Description | -| --------------------------- | -| ApplicationxwwwformurlencodedMediaType()
Creates an instance | - -### 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 | -| Nothing? | encoding()
the encoding info | - -## FakeGetRequestBody1 -public static class FakeGetRequestBody1
- -a class that serializes SealedRequestBody request bodies - -### Constructor Summary -| Constructor and Description | -| --------------------------- | -| FakeGetRequestBody1()
Creates an instance | - -### Field Summary -| Modifier and Type | Field and Description | -| ----------------- | --------------------- | -| boolean | required = false
whether the request body is required | -| Map | content = Map.ofEntries(
    new AbstractMap.SimpleEntry<>("application/x-www-form-urlencoded", new [ApplicationxwwwformurlencodedMediaType](#applicationxwwwformurlencodedmediatype)())
)
the contentType to schema info | - -### Method Summary -| Modifier and Type | Method and Description | -| ----------------- | ---------------------- | -| SerializedRequestBody | serialize([SealedRequestBody](#sealedrequestbody) requestBody)
called by endpoint when creating request body bytes | - -## SealedRequestBody -public sealed interface SealedRequestBody
-permits
-[ApplicationxwwwformurlencodedRequestBody](#applicationxwwwformurlencodedrequestbody) - -sealed interface that stores request contentType + validated schema data - -## ApplicationxwwwformurlencodedRequestBody -public record ApplicationxwwwformurlencodedRequestBody
-implements [SealedRequestBody](#sealedrequestbody),
-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 | - -### 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 | diff --git a/samples/client/petstore/kotlin/docs/paths/fake/get/FakeGetResponses.md b/samples/client/petstore/kotlin/docs/paths/fake/get/FakeGetResponses.md deleted file mode 100644 index 5631100ed6d..00000000000 --- a/samples/client/petstore/kotlin/docs/paths/fake/get/FakeGetResponses.md +++ /dev/null @@ -1,29 +0,0 @@ -# FakeGetResponses - -public class FakeGetResponses - -A class that contains necessary responses classes -- a sealed interface, EndpointResponse, that stores endpoint responses -- records for each endpoint response - -## Nested Class Summary -| Modifier and Type | Class and Description | -| ----------------- | --------------------- | -| sealed interface | [EndpointResponse](#endpointresponse)
stores the endpoint responses | -| record | [EndpointFakeGetCode200Response](#endpointfakegetcode200response)
the response for 200 | - -## EndpointResponse -public sealed interface EndpointResponse permits
-[EndpointFakeGetCode200Response](#endpointfakegetcode200response) - -a sealed interface that stores endpoint responses - -## EndpointFakeGetCode200Response -public record EndpointFakeGetCode200Response( - HttpResponse response, - Nothing? body, - Nothing? headers -) implements EndpointResponse, ApiResponse
- -a class that stores an endpoint response - diff --git a/samples/client/petstore/kotlin/docs/paths/fake/get/parameters/parameter0/Schema0.md b/samples/client/petstore/kotlin/docs/paths/fake/get/parameters/parameter0/Schema0.md deleted file mode 100644 index 648f585218b..00000000000 --- a/samples/client/petstore/kotlin/docs/paths/fake/get/parameters/parameter0/Schema0.md +++ /dev/null @@ -1,205 +0,0 @@ -# Schema0 -public class Schema0
- -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 list payloads, extends FrozenList -- classes to build inputs for list payloads -- enum classes - -## Nested Class Summary -| Modifier and Type | Class and Description | -| ----------------- | ---------------------- | -| sealed interface | [Schema0.Schema01Boxed](#schema01boxed)
sealed interface for validated payloads | -| record | [Schema0.Schema01BoxedList](#schema01boxedlist)
boxed class to store validated List payloads | -| static class | [Schema0.Schema01](#schema01)
schema class | -| static class | [Schema0.SchemaListBuilder0](#schemalistbuilder0)
builder for List payloads | -| static class | [Schema0.SchemaList0](#schemalist0)
output class for List payloads | -| sealed interface | [Schema0.Items0Boxed](#items0boxed)
sealed interface for validated payloads | -| record | [Schema0.Items0BoxedString](#items0boxedstring)
boxed class to store validated String payloads | -| static class | [Schema0.Items0](#items0)
schema class | -| enum | [Schema0.StringItemsEnums0](#stringitemsenums0)
String enum | - -## Schema01Boxed -public sealed interface Schema01Boxed
-permits
-[Schema01BoxedList](#schema01boxedlist) - -sealed interface that stores validated payloads using boxed classes - -## Schema01BoxedList -public record Schema01BoxedList
-implements [Schema01Boxed](#schema01boxed) - -record that stores validated List payloads, sealed permits implementation - -### Constructor Summary -| Constructor and Description | -| --------------------------- | -| Schema01BoxedList([SchemaList0](#schemalist0) data)
Creates an instance, private visibility | - -### Method Summary -| Modifier and Type | Method and Description | -| ----------------- | ---------------------- | -| [SchemaList0](#schemalist0) | data()
validated payload | -| @Nullable Object | getData()
validated payload | - -## Schema01 -public static class Schema01
-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.fake.get.parameters.parameter0.Schema0; - -import java.util.Arrays; -import java.util.List; -import java.util.AbstractMap; - -static final SchemaConfiguration configuration = new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().build()); - -// List validation -Schema0.SchemaList0 validatedPayload = - Schema0.Schema01.validate( - new Schema0.SchemaListBuilder0() - .add(">") - - .build(), - configuration -); -``` - -### Field Summary -| Modifier and Type | Field and Description | -| ----------------- | ---------------------- | -| Set> | type = Set.of(List.class) | -| Class | items = [Items0.class](#items0) | - -### Method Summary -| Modifier and Type | Method and Description | -| ----------------- | ---------------------- | -| [SchemaList0](#schemalist0) | validate([List](#schemalistbuilder0) arg, SchemaConfiguration configuration) | -| [Schema01BoxedList](#schema01boxedlist) | validateAndBox([List](#schemalistbuilder0) arg, SchemaConfiguration configuration) | -| [Schema01Boxed](#schema01boxed) | validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) | -| @Nullable Object | validate(@Nullable Object arg, SchemaConfiguration configuration) | - -## SchemaListBuilder0 -public class SchemaListBuilder0
-builder for `List` - -A class that builds the List input type - -### Constructor Summary -| Constructor and Description | -| --------------------------- | -| SchemaListBuilder0()
Creates an empty list | -| SchemaListBuilder0(List items)
Stores the items in a list | - -### Method Summary -| Modifier and Type | Method and Description | -| ----------------- | ---------------------- | -| SchemaListBuilder0 | add(String item) | -| SchemaListBuilder0 | add([StringItemsEnums0](#stringitemsenums0) item) | -| List | build()
Returns list input that should be used with Schema.validate | - -## SchemaList0 -public class SchemaList0
-extends `FrozenList` - -A class to store validated List payloads - -### Method Summary -| Modifier and Type | Method and Description | -| ----------------- | ---------------------- | -| static [SchemaList0](#schemalist0) | of([List](#schemalistbuilder0) arg, SchemaConfiguration configuration) | - -## Items0Boxed -public sealed interface Items0Boxed
-permits
-[Items0BoxedString](#items0boxedstring) - -sealed interface that stores validated payloads using boxed classes - -## Items0BoxedString -public record Items0BoxedString
-implements [Items0Boxed](#items0boxed) - -record that stores validated String payloads, sealed permits implementation - -### Constructor Summary -| Constructor and Description | -| --------------------------- | -| Items0BoxedString(String data)
Creates an instance, private visibility | - -### Method Summary -| Modifier and Type | Method and Description | -| ----------------- | ---------------------- | -| String | data()
validated payload | -| @Nullable Object | getData()
validated payload | - -## Items0 -public static class Items0
-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.fake.get.parameters.parameter0.Schema0; - -import java.util.Arrays; -import java.util.List; -import java.util.AbstractMap; - -static final SchemaConfiguration configuration = new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().build()); - -// String validation -String validatedPayload = Schema0.Items0.validate( - ">", - configuration -); -``` - -### Field Summary -| Modifier and Type | Field and Description | -| ----------------- | ---------------------- | -| Set> | type = Set.of(
    String.class
)
| -| Set | enumValues = SetMaker.makeSet(
    ">",
    "$"
)
| -| @Nullable Object | defaultValue = "$" | - -### Method Summary -| Modifier and Type | Method and Description | -| ----------------- | ---------------------- | -| String | validate(String arg, SchemaConfiguration configuration) | -| String | validate([StringItemsEnums0](#stringitemsenums0) arg, SchemaConfiguration configuration) | -| [Items0BoxedString](#items0boxedstring) | validateAndBox(String arg, SchemaConfiguration configuration) | -| [Items0Boxed](#items0boxed) | validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) | -| @Nullable Object | validate(@Nullable Object arg, SchemaConfiguration configuration) | - -## StringItemsEnums0 -public enum StringItemsEnums0
-extends `Enum` - -A class that stores String enum values - -### Enum Constant Summary -| Enum Constant | Description | -| ------------- | ----------- | -| GREATER_THAN_SIGN | value = ">" | -| DOLLAR_SIGN | value = "$" | diff --git a/samples/client/petstore/kotlin/docs/paths/fake/get/parameters/parameter1/Schema1.md b/samples/client/petstore/kotlin/docs/paths/fake/get/parameters/parameter1/Schema1.md deleted file mode 100644 index f800da764fd..00000000000 --- a/samples/client/petstore/kotlin/docs/paths/fake/get/parameters/parameter1/Schema1.md +++ /dev/null @@ -1,98 +0,0 @@ -# Schema1 -public class Schema1
- -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 -- enum classes - -## Nested Class Summary -| Modifier and Type | Class and Description | -| ----------------- | ---------------------- | -| sealed interface | [Schema1.Schema11Boxed](#schema11boxed)
sealed interface for validated payloads | -| record | [Schema1.Schema11BoxedString](#schema11boxedstring)
boxed class to store validated String payloads | -| static class | [Schema1.Schema11](#schema11)
schema class | -| enum | [Schema1.StringSchemaEnums1](#stringschemaenums1)
String enum | - -## Schema11Boxed -public sealed interface Schema11Boxed
-permits
-[Schema11BoxedString](#schema11boxedstring) - -sealed interface that stores validated payloads using boxed classes - -## Schema11BoxedString -public record Schema11BoxedString
-implements [Schema11Boxed](#schema11boxed) - -record that stores validated String payloads, sealed permits implementation - -### Constructor Summary -| Constructor and Description | -| --------------------------- | -| Schema11BoxedString(String data)
Creates an instance, private visibility | - -### Method Summary -| Modifier and Type | Method and Description | -| ----------------- | ---------------------- | -| String | data()
validated payload | -| @Nullable Object | getData()
validated payload | - -## Schema11 -public static class Schema11
-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.fake.get.parameters.parameter1.Schema1; - -import java.util.Arrays; -import java.util.List; -import java.util.AbstractMap; - -static final SchemaConfiguration configuration = new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().build()); - -// String validation -String validatedPayload = Schema1.Schema11.validate( - "_abc", - configuration -); -``` - -### Field Summary -| Modifier and Type | Field and Description | -| ----------------- | ---------------------- | -| Set> | type = Set.of(
    String.class
)
| -| Set | enumValues = SetMaker.makeSet(
    "_abc",
    "-efg",
    "(xyz)"
)
| -| @Nullable Object | defaultValue = "-efg" | - -### Method Summary -| Modifier and Type | Method and Description | -| ----------------- | ---------------------- | -| String | validate(String arg, SchemaConfiguration configuration) | -| String | validate([StringSchemaEnums1](#stringschemaenums1) arg, SchemaConfiguration configuration) | -| [Schema11BoxedString](#schema11boxedstring) | validateAndBox(String arg, SchemaConfiguration configuration) | -| [Schema11Boxed](#schema11boxed) | validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) | -| @Nullable Object | validate(@Nullable Object arg, SchemaConfiguration configuration) | - -## StringSchemaEnums1 -public enum StringSchemaEnums1
-extends `Enum` - -A class that stores String enum values - -### Enum Constant Summary -| Enum Constant | Description | -| ------------- | ----------- | -| LOW_LINE_ABC | value = "_abc" | -| HYPHEN_MINUS_EFG | value = "-efg" | -| LEFT_PARENTHESIS_XYZ_RIGHT_PARENTHESIS | value = "(xyz)" | diff --git a/samples/client/petstore/kotlin/docs/paths/fake/get/parameters/parameter2/Schema2.md b/samples/client/petstore/kotlin/docs/paths/fake/get/parameters/parameter2/Schema2.md deleted file mode 100644 index 0d9d6f7469a..00000000000 --- a/samples/client/petstore/kotlin/docs/paths/fake/get/parameters/parameter2/Schema2.md +++ /dev/null @@ -1,205 +0,0 @@ -# Schema2 -public class Schema2
- -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 list payloads, extends FrozenList -- classes to build inputs for list payloads -- enum classes - -## Nested Class Summary -| Modifier and Type | Class and Description | -| ----------------- | ---------------------- | -| sealed interface | [Schema2.Schema21Boxed](#schema21boxed)
sealed interface for validated payloads | -| record | [Schema2.Schema21BoxedList](#schema21boxedlist)
boxed class to store validated List payloads | -| static class | [Schema2.Schema21](#schema21)
schema class | -| static class | [Schema2.SchemaListBuilder2](#schemalistbuilder2)
builder for List payloads | -| static class | [Schema2.SchemaList2](#schemalist2)
output class for List payloads | -| sealed interface | [Schema2.Items2Boxed](#items2boxed)
sealed interface for validated payloads | -| record | [Schema2.Items2BoxedString](#items2boxedstring)
boxed class to store validated String payloads | -| static class | [Schema2.Items2](#items2)
schema class | -| enum | [Schema2.StringItemsEnums2](#stringitemsenums2)
String enum | - -## Schema21Boxed -public sealed interface Schema21Boxed
-permits
-[Schema21BoxedList](#schema21boxedlist) - -sealed interface that stores validated payloads using boxed classes - -## Schema21BoxedList -public record Schema21BoxedList
-implements [Schema21Boxed](#schema21boxed) - -record that stores validated List payloads, sealed permits implementation - -### Constructor Summary -| Constructor and Description | -| --------------------------- | -| Schema21BoxedList([SchemaList2](#schemalist2) data)
Creates an instance, private visibility | - -### Method Summary -| Modifier and Type | Method and Description | -| ----------------- | ---------------------- | -| [SchemaList2](#schemalist2) | data()
validated payload | -| @Nullable Object | getData()
validated payload | - -## Schema21 -public static class Schema21
-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.fake.get.parameters.parameter2.Schema2; - -import java.util.Arrays; -import java.util.List; -import java.util.AbstractMap; - -static final SchemaConfiguration configuration = new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().build()); - -// List validation -Schema2.SchemaList2 validatedPayload = - Schema2.Schema21.validate( - new Schema2.SchemaListBuilder2() - .add(">") - - .build(), - configuration -); -``` - -### Field Summary -| Modifier and Type | Field and Description | -| ----------------- | ---------------------- | -| Set> | type = Set.of(List.class) | -| Class | items = [Items2.class](#items2) | - -### Method Summary -| Modifier and Type | Method and Description | -| ----------------- | ---------------------- | -| [SchemaList2](#schemalist2) | validate([List](#schemalistbuilder2) arg, SchemaConfiguration configuration) | -| [Schema21BoxedList](#schema21boxedlist) | validateAndBox([List](#schemalistbuilder2) arg, SchemaConfiguration configuration) | -| [Schema21Boxed](#schema21boxed) | validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) | -| @Nullable Object | validate(@Nullable Object arg, SchemaConfiguration configuration) | - -## SchemaListBuilder2 -public class SchemaListBuilder2
-builder for `List` - -A class that builds the List input type - -### Constructor Summary -| Constructor and Description | -| --------------------------- | -| SchemaListBuilder2()
Creates an empty list | -| SchemaListBuilder2(List items)
Stores the items in a list | - -### Method Summary -| Modifier and Type | Method and Description | -| ----------------- | ---------------------- | -| SchemaListBuilder2 | add(String item) | -| SchemaListBuilder2 | add([StringItemsEnums2](#stringitemsenums2) item) | -| List | build()
Returns list input that should be used with Schema.validate | - -## SchemaList2 -public class SchemaList2
-extends `FrozenList` - -A class to store validated List payloads - -### Method Summary -| Modifier and Type | Method and Description | -| ----------------- | ---------------------- | -| static [SchemaList2](#schemalist2) | of([List](#schemalistbuilder2) arg, SchemaConfiguration configuration) | - -## Items2Boxed -public sealed interface Items2Boxed
-permits
-[Items2BoxedString](#items2boxedstring) - -sealed interface that stores validated payloads using boxed classes - -## Items2BoxedString -public record Items2BoxedString
-implements [Items2Boxed](#items2boxed) - -record that stores validated String payloads, sealed permits implementation - -### Constructor Summary -| Constructor and Description | -| --------------------------- | -| Items2BoxedString(String data)
Creates an instance, private visibility | - -### Method Summary -| Modifier and Type | Method and Description | -| ----------------- | ---------------------- | -| String | data()
validated payload | -| @Nullable Object | getData()
validated payload | - -## Items2 -public static class Items2
-extends JsonSchema - -A schema class that validates payloads - -### Code Sample -``` -import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags; -import org.openapijsonschematools.client.configurations.SchemaConfiguration; -import org.openapijsonschematools.client.exceptions.ValidationException; -import org.openapijsonschematools.client.schemas.validation.MapUtils; -import org.openapijsonschematools.client.schemas.validation.FrozenList; -import org.openapijsonschematools.client.schemas.validation.FrozenMap; -import org.openapijsonschematools.client.paths.fake.get.parameters.parameter2.Schema2; - -import java.util.Arrays; -import java.util.List; -import java.util.AbstractMap; - -static final SchemaConfiguration configuration = new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().build()); - -// String validation -String validatedPayload = Schema2.Items2.validate( - ">", - configuration -); -``` - -### Field Summary -| Modifier and Type | Field and Description | -| ----------------- | ---------------------- | -| Set> | type = Set.of(
    String.class
)
| -| Set | enumValues = SetMaker.makeSet(
    ">",
    "$"
)
| -| @Nullable Object | defaultValue = "$" | - -### Method Summary -| Modifier and Type | Method and Description | -| ----------------- | ---------------------- | -| String | validate(String arg, SchemaConfiguration configuration) | -| String | validate([StringItemsEnums2](#stringitemsenums2) arg, SchemaConfiguration configuration) | -| [Items2BoxedString](#items2boxedstring) | validateAndBox(String arg, SchemaConfiguration configuration) | -| [Items2Boxed](#items2boxed) | validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) | -| @Nullable Object | validate(@Nullable Object arg, SchemaConfiguration configuration) | - -## StringItemsEnums2 -public enum StringItemsEnums2
-extends `Enum` - -A class that stores String enum values - -### Enum Constant Summary -| Enum Constant | Description | -| ------------- | ----------- | -| GREATER_THAN_SIGN | value = ">" | -| DOLLAR_SIGN | value = "$" | diff --git a/samples/client/petstore/kotlin/docs/paths/fake/get/parameters/parameter3/Schema3.md b/samples/client/petstore/kotlin/docs/paths/fake/get/parameters/parameter3/Schema3.md deleted file mode 100644 index 8ea43fa12ea..00000000000 --- a/samples/client/petstore/kotlin/docs/paths/fake/get/parameters/parameter3/Schema3.md +++ /dev/null @@ -1,98 +0,0 @@ -# Schema3 -public class Schema3
- -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 -- enum classes - -## Nested Class Summary -| Modifier and Type | Class and Description | -| ----------------- | ---------------------- | -| sealed interface | [Schema3.Schema31Boxed](#schema31boxed)
sealed interface for validated payloads | -| record | [Schema3.Schema31BoxedString](#schema31boxedstring)
boxed class to store validated String payloads | -| static class | [Schema3.Schema31](#schema31)
schema class | -| enum | [Schema3.StringSchemaEnums3](#stringschemaenums3)
String enum | - -## Schema31Boxed -public sealed interface Schema31Boxed
-permits
-[Schema31BoxedString](#schema31boxedstring) - -sealed interface that stores validated payloads using boxed classes - -## Schema31BoxedString -public record Schema31BoxedString
-implements [Schema31Boxed](#schema31boxed) - -record that stores validated String payloads, sealed permits implementation - -### Constructor Summary -| Constructor and Description | -| --------------------------- | -| Schema31BoxedString(String data)
Creates an instance, private visibility | - -### Method Summary -| Modifier and Type | Method and Description | -| ----------------- | ---------------------- | -| String | data()
validated payload | -| @Nullable Object | getData()
validated payload | - -## Schema31 -public static class Schema31
-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.fake.get.parameters.parameter3.Schema3; - -import java.util.Arrays; -import java.util.List; -import java.util.AbstractMap; - -static final SchemaConfiguration configuration = new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().build()); - -// String validation -String validatedPayload = Schema3.Schema31.validate( - "_abc", - configuration -); -``` - -### Field Summary -| Modifier and Type | Field and Description | -| ----------------- | ---------------------- | -| Set> | type = Set.of(
    String.class
)
| -| Set | enumValues = SetMaker.makeSet(
    "_abc",
    "-efg",
    "(xyz)"
)
| -| @Nullable Object | defaultValue = "-efg" | - -### Method Summary -| Modifier and Type | Method and Description | -| ----------------- | ---------------------- | -| String | validate(String arg, SchemaConfiguration configuration) | -| String | validate([StringSchemaEnums3](#stringschemaenums3) arg, SchemaConfiguration configuration) | -| [Schema31BoxedString](#schema31boxedstring) | validateAndBox(String arg, SchemaConfiguration configuration) | -| [Schema31Boxed](#schema31boxed) | validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) | -| @Nullable Object | validate(@Nullable Object arg, SchemaConfiguration configuration) | - -## StringSchemaEnums3 -public enum StringSchemaEnums3
-extends `Enum` - -A class that stores String enum values - -### Enum Constant Summary -| Enum Constant | Description | -| ------------- | ----------- | -| LOW_LINE_ABC | value = "_abc" | -| HYPHEN_MINUS_EFG | value = "-efg" | -| LEFT_PARENTHESIS_XYZ_RIGHT_PARENTHESIS | value = "(xyz)" | diff --git a/samples/client/petstore/kotlin/docs/paths/fake/get/parameters/parameter4/Schema4.md b/samples/client/petstore/kotlin/docs/paths/fake/get/parameters/parameter4/Schema4.md deleted file mode 100644 index 937aae56a94..00000000000 --- a/samples/client/petstore/kotlin/docs/paths/fake/get/parameters/parameter4/Schema4.md +++ /dev/null @@ -1,135 +0,0 @@ -# Schema4 -public class Schema4
- -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 -- enum classes - -## Nested Class Summary -| Modifier and Type | Class and Description | -| ----------------- | ---------------------- | -| sealed interface | [Schema4.Schema41Boxed](#schema41boxed)
sealed interface for validated payloads | -| record | [Schema4.Schema41BoxedNumber](#schema41boxednumber)
boxed class to store validated Number payloads | -| static class | [Schema4.Schema41](#schema41)
schema class | -| enum | [Schema4.IntegerSchemaEnums4](#integerschemaenums4)
Integer enum | -| enum | [Schema4.LongSchemaEnums4](#longschemaenums4)
Long enum | -| enum | [Schema4.FloatSchemaEnums4](#floatschemaenums4)
Float enum | -| enum | [Schema4.DoubleSchemaEnums4](#doubleschemaenums4)
Double enum | - -## Schema41Boxed -public sealed interface Schema41Boxed
-permits
-[Schema41BoxedNumber](#schema41boxednumber) - -sealed interface that stores validated payloads using boxed classes - -## Schema41BoxedNumber -public record Schema41BoxedNumber
-implements [Schema41Boxed](#schema41boxed) - -record that stores validated Number payloads, sealed permits implementation - -### Constructor Summary -| Constructor and Description | -| --------------------------- | -| Schema41BoxedNumber(Number data)
Creates an instance, private visibility | - -### Method Summary -| Modifier and Type | Method and Description | -| ----------------- | ---------------------- | -| Number | data()
validated payload | -| @Nullable Object | getData()
validated payload | - -## Schema41 -public static class Schema41
-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.fake.get.parameters.parameter4.Schema4; - -import java.util.Arrays; -import java.util.List; -import java.util.AbstractMap; - -static final SchemaConfiguration configuration = new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().build()); - -// int validation -int validatedPayload = Schema4.Schema41.validate( - 1, - configuration -); -``` - -### Field Summary -| Modifier and Type | Field and Description | -| ----------------- | ---------------------- | -| Set> | type = Set.of(
    Integer.class,
    Long.class,
    Float.class,
    Double.class
)
| -| String | type = "int32"; | -| Set | enumValues = SetMaker.makeSet(
    1,
    -2
)
| - -### Method Summary -| Modifier and Type | Method and Description | -| ----------------- | ---------------------- | -| int | validate(int arg, SchemaConfiguration configuration) | -| [Schema41BoxedNumber](#schema41boxednumber) | validateAndBox(Number arg, SchemaConfiguration configuration) | -| [Schema41Boxed](#schema41boxed) | validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) | -| @Nullable Object | validate(@Nullable Object arg, SchemaConfiguration configuration) | - -## IntegerSchemaEnums4 -public enum IntegerSchemaEnums4
-extends `Enum` - -A class that stores Integer enum values - -### Enum Constant Summary -| Enum Constant | Description | -| ------------- | ----------- | -| POSITIVE_1 | value = 1 | -| NEGATIVE_2 | value = -2 | - -## LongSchemaEnums4 -public enum LongSchemaEnums4
-extends `Enum` - -A class that stores Long enum values - -### Enum Constant Summary -| Enum Constant | Description | -| ------------- | ----------- | -| POSITIVE_1 | value = 1L | -| NEGATIVE_2 | value = -2L | - -## FloatSchemaEnums4 -public enum FloatSchemaEnums4
-extends `Enum` - -A class that stores Float enum values - -### Enum Constant Summary -| Enum Constant | Description | -| ------------- | ----------- | -| POSITIVE_1 | value = 1.0f | -| NEGATIVE_2 | value = -2.0f | - -## DoubleSchemaEnums4 -public enum DoubleSchemaEnums4
-extends `Enum` - -A class that stores Double enum values - -### Enum Constant Summary -| Enum Constant | Description | -| ------------- | ----------- | -| POSITIVE_1 | value = 1.0d | -| NEGATIVE_2 | value = -2.0d | diff --git a/samples/client/petstore/kotlin/docs/paths/fake/get/parameters/parameter5/Schema5.md b/samples/client/petstore/kotlin/docs/paths/fake/get/parameters/parameter5/Schema5.md deleted file mode 100644 index 63198fed5b8..00000000000 --- a/samples/client/petstore/kotlin/docs/paths/fake/get/parameters/parameter5/Schema5.md +++ /dev/null @@ -1,109 +0,0 @@ -# Schema5 -public class Schema5
- -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 -- enum classes - -## Nested Class Summary -| Modifier and Type | Class and Description | -| ----------------- | ---------------------- | -| sealed interface | [Schema5.Schema51Boxed](#schema51boxed)
sealed interface for validated payloads | -| record | [Schema5.Schema51BoxedNumber](#schema51boxednumber)
boxed class to store validated Number payloads | -| static class | [Schema5.Schema51](#schema51)
schema class | -| enum | [Schema5.DoubleSchemaEnums5](#doubleschemaenums5)
Double enum | -| enum | [Schema5.FloatSchemaEnums5](#floatschemaenums5)
Float enum | - -## Schema51Boxed -public sealed interface Schema51Boxed
-permits
-[Schema51BoxedNumber](#schema51boxednumber) - -sealed interface that stores validated payloads using boxed classes - -## Schema51BoxedNumber -public record Schema51BoxedNumber
-implements [Schema51Boxed](#schema51boxed) - -record that stores validated Number payloads, sealed permits implementation - -### Constructor Summary -| Constructor and Description | -| --------------------------- | -| Schema51BoxedNumber(Number data)
Creates an instance, private visibility | - -### Method Summary -| Modifier and Type | Method and Description | -| ----------------- | ---------------------- | -| Number | data()
validated payload | -| @Nullable Object | getData()
validated payload | - -## Schema51 -public static class Schema51
-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.fake.get.parameters.parameter5.Schema5; - -import java.util.Arrays; -import java.util.List; -import java.util.AbstractMap; - -static final SchemaConfiguration configuration = new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().build()); - -// double validation -double validatedPayload = Schema5.Schema51.validate( - 3.14d, - configuration -); -``` - -### Field Summary -| Modifier and Type | Field and Description | -| ----------------- | ---------------------- | -| Set> | type = Set.of(
    Integer.class,
    Long.class,
    Float.class,
    Double.class
)
| -| String | type = "double"; | -| Set | enumValues = SetMaker.makeSet(
    1.1,
    -1.2
)
| - -### Method Summary -| Modifier and Type | Method and Description | -| ----------------- | ---------------------- | -| double | validate(double arg, SchemaConfiguration configuration) | -| [Schema51BoxedNumber](#schema51boxednumber) | validateAndBox(Number arg, SchemaConfiguration configuration) | -| [Schema51Boxed](#schema51boxed) | validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) | -| @Nullable Object | validate(@Nullable Object arg, SchemaConfiguration configuration) | - -## DoubleSchemaEnums5 -public enum DoubleSchemaEnums5
-extends `Enum` - -A class that stores Double enum values - -### Enum Constant Summary -| Enum Constant | Description | -| ------------- | ----------- | -| POSITIVE_1_PT_1 | value = 1.1d | -| NEGATIVE_1_PT_2 | value = -1.2d | - -## FloatSchemaEnums5 -public enum FloatSchemaEnums5
-extends `Enum` - -A class that stores Float enum values - -### Enum Constant Summary -| Enum Constant | Description | -| ------------- | ----------- | -| POSITIVE_1_PT_1 | value = 1.1f | -| NEGATIVE_1_PT_2 | value = -1.2f | diff --git a/samples/client/petstore/kotlin/docs/paths/fake/get/requestbody/content/applicationxwwwformurlencoded/ApplicationxwwwformurlencodedSchema.md b/samples/client/petstore/kotlin/docs/paths/fake/get/requestbody/content/applicationxwwwformurlencoded/ApplicationxwwwformurlencodedSchema.md deleted file mode 100644 index 06ee7345cb7..00000000000 --- a/samples/client/petstore/kotlin/docs/paths/fake/get/requestbody/content/applicationxwwwformurlencoded/ApplicationxwwwformurlencodedSchema.md +++ /dev/null @@ -1,422 +0,0 @@ -# ApplicationxwwwformurlencodedSchema -public class ApplicationxwwwformurlencodedSchema
- -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 list payloads, extends FrozenList -- classes to build inputs for list payloads -- 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 | [ApplicationxwwwformurlencodedSchema.ApplicationxwwwformurlencodedSchema1Boxed](#applicationxwwwformurlencodedschema1boxed)
sealed interface for validated payloads | -| record | [ApplicationxwwwformurlencodedSchema.ApplicationxwwwformurlencodedSchema1BoxedMap](#applicationxwwwformurlencodedschema1boxedmap)
boxed class to store validated Map payloads | -| static class | [ApplicationxwwwformurlencodedSchema.ApplicationxwwwformurlencodedSchema1](#applicationxwwwformurlencodedschema1)
schema class | -| static class | [ApplicationxwwwformurlencodedSchema.ApplicationxwwwformurlencodedSchemaMapBuilder](#applicationxwwwformurlencodedschemamapbuilder)
builder for Map payloads | -| static class | [ApplicationxwwwformurlencodedSchema.ApplicationxwwwformurlencodedSchemaMap](#applicationxwwwformurlencodedschemamap)
output class for Map payloads | -| sealed interface | [ApplicationxwwwformurlencodedSchema.ApplicationxwwwformurlencodedEnumFormStringBoxed](#applicationxwwwformurlencodedenumformstringboxed)
sealed interface for validated payloads | -| record | [ApplicationxwwwformurlencodedSchema.ApplicationxwwwformurlencodedEnumFormStringBoxedString](#applicationxwwwformurlencodedenumformstringboxedstring)
boxed class to store validated String payloads | -| static class | [ApplicationxwwwformurlencodedSchema.ApplicationxwwwformurlencodedEnumFormString](#applicationxwwwformurlencodedenumformstring)
schema class | -| enum | [ApplicationxwwwformurlencodedSchema.StringApplicationxwwwformurlencodedEnumFormStringEnums](#stringapplicationxwwwformurlencodedenumformstringenums)
String enum | -| sealed interface | [ApplicationxwwwformurlencodedSchema.ApplicationxwwwformurlencodedEnumFormStringArrayBoxed](#applicationxwwwformurlencodedenumformstringarrayboxed)
sealed interface for validated payloads | -| record | [ApplicationxwwwformurlencodedSchema.ApplicationxwwwformurlencodedEnumFormStringArrayBoxedList](#applicationxwwwformurlencodedenumformstringarrayboxedlist)
boxed class to store validated List payloads | -| static class | [ApplicationxwwwformurlencodedSchema.ApplicationxwwwformurlencodedEnumFormStringArray](#applicationxwwwformurlencodedenumformstringarray)
schema class | -| static class | [ApplicationxwwwformurlencodedSchema.ApplicationxwwwformurlencodedEnumFormStringArrayListBuilder](#applicationxwwwformurlencodedenumformstringarraylistbuilder)
builder for List payloads | -| static class | [ApplicationxwwwformurlencodedSchema.ApplicationxwwwformurlencodedEnumFormStringArrayList](#applicationxwwwformurlencodedenumformstringarraylist)
output class for List payloads | -| sealed interface | [ApplicationxwwwformurlencodedSchema.ApplicationxwwwformurlencodedItemsBoxed](#applicationxwwwformurlencodeditemsboxed)
sealed interface for validated payloads | -| record | [ApplicationxwwwformurlencodedSchema.ApplicationxwwwformurlencodedItemsBoxedString](#applicationxwwwformurlencodeditemsboxedstring)
boxed class to store validated String payloads | -| static class | [ApplicationxwwwformurlencodedSchema.ApplicationxwwwformurlencodedItems](#applicationxwwwformurlencodeditems)
schema class | -| enum | [ApplicationxwwwformurlencodedSchema.StringApplicationxwwwformurlencodedItemsEnums](#stringapplicationxwwwformurlencodeditemsenums)
String enum | - -## ApplicationxwwwformurlencodedSchema1Boxed -public sealed interface ApplicationxwwwformurlencodedSchema1Boxed
-permits
-[ApplicationxwwwformurlencodedSchema1BoxedMap](#applicationxwwwformurlencodedschema1boxedmap) - -sealed interface that stores validated payloads using boxed classes - -## ApplicationxwwwformurlencodedSchema1BoxedMap -public record ApplicationxwwwformurlencodedSchema1BoxedMap
-implements [ApplicationxwwwformurlencodedSchema1Boxed](#applicationxwwwformurlencodedschema1boxed) - -record that stores validated Map payloads, sealed permits implementation - -### Constructor Summary -| Constructor and Description | -| --------------------------- | -| ApplicationxwwwformurlencodedSchema1BoxedMap([ApplicationxwwwformurlencodedSchemaMap](#applicationxwwwformurlencodedschemamap) data)
Creates an instance, private visibility | - -### Method Summary -| Modifier and Type | Method and Description | -| ----------------- | ---------------------- | -| [ApplicationxwwwformurlencodedSchemaMap](#applicationxwwwformurlencodedschemamap) | data()
validated payload | -| @Nullable Object | getData()
validated payload | - -## ApplicationxwwwformurlencodedSchema1 -public static class ApplicationxwwwformurlencodedSchema1
-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.fake.get.requestbody.content.applicationxwwwformurlencoded.ApplicationxwwwformurlencodedSchema; - -import java.util.Arrays; -import java.util.List; -import java.util.AbstractMap; - -static final SchemaConfiguration configuration = new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().build()); - -// Map validation -ApplicationxwwwformurlencodedSchema.ApplicationxwwwformurlencodedSchemaMap validatedPayload = - ApplicationxwwwformurlencodedSchema.ApplicationxwwwformurlencodedSchema1.validate( - new ApplicationxwwwformurlencodedSchema.ApplicationxwwwformurlencodedSchemaMapBuilder() - .enum_form_string_array( - Arrays.asList( - ">" - ) - ) - .enum_form_string("_abc") - - .build(), - configuration -); -``` - -### Field Summary -| Modifier and Type | Field and Description | -| ----------------- | ---------------------- | -| Set> | type = Set.of(Map.class) | -| Map> | properties = Map.ofEntries(
    new PropertyEntry("enum_form_string_array", [ApplicationxwwwformurlencodedEnumFormStringArray.class](#applicationxwwwformurlencodedenumformstringarray))),
    new PropertyEntry("enum_form_string", [ApplicationxwwwformurlencodedEnumFormString.class](#applicationxwwwformurlencodedenumformstring)))
)
| - -### Method Summary -| Modifier and Type | Method and Description | -| ----------------- | ---------------------- | -| [ApplicationxwwwformurlencodedSchemaMap](#applicationxwwwformurlencodedschemamap) | validate([Map<?, ?>](#applicationxwwwformurlencodedschemamapbuilder) arg, SchemaConfiguration configuration) | -| [ApplicationxwwwformurlencodedSchema1BoxedMap](#applicationxwwwformurlencodedschema1boxedmap) | validateAndBox([Map<?, ?>](#applicationxwwwformurlencodedschemamapbuilder) arg, SchemaConfiguration configuration) | -| [ApplicationxwwwformurlencodedSchema1Boxed](#applicationxwwwformurlencodedschema1boxed) | validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) | -| @Nullable Object | validate(@Nullable Object arg, SchemaConfiguration configuration) | - -## ApplicationxwwwformurlencodedSchemaMapBuilder -public class ApplicationxwwwformurlencodedSchemaMapBuilder
-builder for `Map` - -A class that builds the Map input type - -### Constructor Summary -| Constructor and Description | -| --------------------------- | -| ApplicationxwwwformurlencodedSchemaMapBuilder()
Creates a builder that contains an empty map | - -### Method Summary -| Modifier and Type | Method and Description | -| ----------------- | ---------------------- | -| Map | build()
Returns map input that should be used with Schema.validate | -| [ApplicationxwwwformurlencodedSchemaMapBuilder](#applicationxwwwformurlencodedschemamapbuilder) | enum_form_string_array(List value) | -| [ApplicationxwwwformurlencodedSchemaMapBuilder](#applicationxwwwformurlencodedschemamapbuilder) | enum_form_string(String value) | -| [ApplicationxwwwformurlencodedSchemaMapBuilder](#applicationxwwwformurlencodedschemamapbuilder) | enum_form_string([StringApplicationxwwwformurlencodedEnumFormStringEnums](#stringapplicationxwwwformurlencodedenumformstringenums) value) | -| [ApplicationxwwwformurlencodedSchemaMapBuilder](#applicationxwwwformurlencodedschemamapbuilder) | additionalProperty(String key, Nothing? value) | -| [ApplicationxwwwformurlencodedSchemaMapBuilder](#applicationxwwwformurlencodedschemamapbuilder) | additionalProperty(String key, boolean value) | -| [ApplicationxwwwformurlencodedSchemaMapBuilder](#applicationxwwwformurlencodedschemamapbuilder) | additionalProperty(String key, String value) | -| [ApplicationxwwwformurlencodedSchemaMapBuilder](#applicationxwwwformurlencodedschemamapbuilder) | additionalProperty(String key, int value) | -| [ApplicationxwwwformurlencodedSchemaMapBuilder](#applicationxwwwformurlencodedschemamapbuilder) | additionalProperty(String key, float value) | -| [ApplicationxwwwformurlencodedSchemaMapBuilder](#applicationxwwwformurlencodedschemamapbuilder) | additionalProperty(String key, long value) | -| [ApplicationxwwwformurlencodedSchemaMapBuilder](#applicationxwwwformurlencodedschemamapbuilder) | additionalProperty(String key, double value) | -| [ApplicationxwwwformurlencodedSchemaMapBuilder](#applicationxwwwformurlencodedschemamapbuilder) | additionalProperty(String key, List value) | -| [ApplicationxwwwformurlencodedSchemaMapBuilder](#applicationxwwwformurlencodedschemamapbuilder) | additionalProperty(String key, Map value) | - -## ApplicationxwwwformurlencodedSchemaMap -public static class ApplicationxwwwformurlencodedSchemaMap
-extends FrozenMap - -A class to store validated Map payloads - -### Method Summary -| Modifier and Type | Method and Description | -| ----------------- | ---------------------- | -| static [ApplicationxwwwformurlencodedSchemaMap](#applicationxwwwformurlencodedschemamap) | of([Map](#applicationxwwwformurlencodedschemamapbuilder) arg, SchemaConfiguration configuration) | -| [ApplicationxwwwformurlencodedEnumFormStringArrayList](#applicationxwwwformurlencodedenumformstringarraylist) | enum_form_string_array()
[optional] | -| String | enum_form_string()
[optional] must be one of ["_abc", "-efg", "(xyz)"] if omitted the server will use the default value of -efg | -| @Nullable Object | getAdditionalProperty(String name)
provides type safety for additional properties | - -## ApplicationxwwwformurlencodedEnumFormStringBoxed -public sealed interface ApplicationxwwwformurlencodedEnumFormStringBoxed
-permits
-[ApplicationxwwwformurlencodedEnumFormStringBoxedString](#applicationxwwwformurlencodedenumformstringboxedstring) - -sealed interface that stores validated payloads using boxed classes - -## ApplicationxwwwformurlencodedEnumFormStringBoxedString -public record ApplicationxwwwformurlencodedEnumFormStringBoxedString
-implements [ApplicationxwwwformurlencodedEnumFormStringBoxed](#applicationxwwwformurlencodedenumformstringboxed) - -record that stores validated String payloads, sealed permits implementation - -### Constructor Summary -| Constructor and Description | -| --------------------------- | -| ApplicationxwwwformurlencodedEnumFormStringBoxedString(String data)
Creates an instance, private visibility | - -### Method Summary -| Modifier and Type | Method and Description | -| ----------------- | ---------------------- | -| String | data()
validated payload | -| @Nullable Object | getData()
validated payload | - -## ApplicationxwwwformurlencodedEnumFormString -public static class ApplicationxwwwformurlencodedEnumFormString
-extends JsonSchema - -A schema class that validates payloads - -## Description -Form parameter enum test (string) - -### 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.fake.get.requestbody.content.applicationxwwwformurlencoded.ApplicationxwwwformurlencodedSchema; - -import java.util.Arrays; -import java.util.List; -import java.util.AbstractMap; - -static final SchemaConfiguration configuration = new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().build()); - -// String validation -String validatedPayload = ApplicationxwwwformurlencodedSchema.ApplicationxwwwformurlencodedEnumFormString.validate( - "_abc", - configuration -); -``` - -### Field Summary -| Modifier and Type | Field and Description | -| ----------------- | ---------------------- | -| Set> | type = Set.of(
    String.class
)
| -| Set | enumValues = SetMaker.makeSet(
    "_abc",
    "-efg",
    "(xyz)"
)
| -| @Nullable Object | defaultValue = "-efg" | - -### Method Summary -| Modifier and Type | Method and Description | -| ----------------- | ---------------------- | -| String | validate(String arg, SchemaConfiguration configuration) | -| String | validate([StringApplicationxwwwformurlencodedEnumFormStringEnums](#stringapplicationxwwwformurlencodedenumformstringenums) arg, SchemaConfiguration configuration) | -| [ApplicationxwwwformurlencodedEnumFormStringBoxedString](#applicationxwwwformurlencodedenumformstringboxedstring) | validateAndBox(String arg, SchemaConfiguration configuration) | -| [ApplicationxwwwformurlencodedEnumFormStringBoxed](#applicationxwwwformurlencodedenumformstringboxed) | validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) | -| @Nullable Object | validate(@Nullable Object arg, SchemaConfiguration configuration) | - -## StringApplicationxwwwformurlencodedEnumFormStringEnums -public enum StringApplicationxwwwformurlencodedEnumFormStringEnums
-extends `Enum` - -A class that stores String enum values - -### Enum Constant Summary -| Enum Constant | Description | -| ------------- | ----------- | -| LOW_LINE_ABC | value = "_abc" | -| HYPHEN_MINUS_EFG | value = "-efg" | -| LEFT_PARENTHESIS_XYZ_RIGHT_PARENTHESIS | value = "(xyz)" | - -## ApplicationxwwwformurlencodedEnumFormStringArrayBoxed -public sealed interface ApplicationxwwwformurlencodedEnumFormStringArrayBoxed
-permits
-[ApplicationxwwwformurlencodedEnumFormStringArrayBoxedList](#applicationxwwwformurlencodedenumformstringarrayboxedlist) - -sealed interface that stores validated payloads using boxed classes - -## ApplicationxwwwformurlencodedEnumFormStringArrayBoxedList -public record ApplicationxwwwformurlencodedEnumFormStringArrayBoxedList
-implements [ApplicationxwwwformurlencodedEnumFormStringArrayBoxed](#applicationxwwwformurlencodedenumformstringarrayboxed) - -record that stores validated List payloads, sealed permits implementation - -### Constructor Summary -| Constructor and Description | -| --------------------------- | -| ApplicationxwwwformurlencodedEnumFormStringArrayBoxedList([ApplicationxwwwformurlencodedEnumFormStringArrayList](#applicationxwwwformurlencodedenumformstringarraylist) data)
Creates an instance, private visibility | - -### Method Summary -| Modifier and Type | Method and Description | -| ----------------- | ---------------------- | -| [ApplicationxwwwformurlencodedEnumFormStringArrayList](#applicationxwwwformurlencodedenumformstringarraylist) | data()
validated payload | -| @Nullable Object | getData()
validated payload | - -## ApplicationxwwwformurlencodedEnumFormStringArray -public static class ApplicationxwwwformurlencodedEnumFormStringArray
-extends JsonSchema - -A schema class that validates payloads - -## Description -Form parameter enum test (string array) - -### 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.fake.get.requestbody.content.applicationxwwwformurlencoded.ApplicationxwwwformurlencodedSchema; - -import java.util.Arrays; -import java.util.List; -import java.util.AbstractMap; - -static final SchemaConfiguration configuration = new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().build()); - -// List validation -ApplicationxwwwformurlencodedSchema.ApplicationxwwwformurlencodedEnumFormStringArrayList validatedPayload = - ApplicationxwwwformurlencodedSchema.ApplicationxwwwformurlencodedEnumFormStringArray.validate( - new ApplicationxwwwformurlencodedSchema.ApplicationxwwwformurlencodedEnumFormStringArrayListBuilder() - .add(">") - - .build(), - configuration -); -``` - -### Field Summary -| Modifier and Type | Field and Description | -| ----------------- | ---------------------- | -| Set> | type = Set.of(List.class) | -| Class | items = [ApplicationxwwwformurlencodedItems.class](#applicationxwwwformurlencodeditems) | - -### Method Summary -| Modifier and Type | Method and Description | -| ----------------- | ---------------------- | -| [ApplicationxwwwformurlencodedEnumFormStringArrayList](#applicationxwwwformurlencodedenumformstringarraylist) | validate([List](#applicationxwwwformurlencodedenumformstringarraylistbuilder) arg, SchemaConfiguration configuration) | -| [ApplicationxwwwformurlencodedEnumFormStringArrayBoxedList](#applicationxwwwformurlencodedenumformstringarrayboxedlist) | validateAndBox([List](#applicationxwwwformurlencodedenumformstringarraylistbuilder) arg, SchemaConfiguration configuration) | -| [ApplicationxwwwformurlencodedEnumFormStringArrayBoxed](#applicationxwwwformurlencodedenumformstringarrayboxed) | validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) | -| @Nullable Object | validate(@Nullable Object arg, SchemaConfiguration configuration) | - -## ApplicationxwwwformurlencodedEnumFormStringArrayListBuilder -public class ApplicationxwwwformurlencodedEnumFormStringArrayListBuilder
-builder for `List` - -A class that builds the List input type - -### Constructor Summary -| Constructor and Description | -| --------------------------- | -| ApplicationxwwwformurlencodedEnumFormStringArrayListBuilder()
Creates an empty list | -| ApplicationxwwwformurlencodedEnumFormStringArrayListBuilder(List items)
Stores the items in a list | - -### Method Summary -| Modifier and Type | Method and Description | -| ----------------- | ---------------------- | -| ApplicationxwwwformurlencodedEnumFormStringArrayListBuilder | add(String item) | -| ApplicationxwwwformurlencodedEnumFormStringArrayListBuilder | add([StringApplicationxwwwformurlencodedItemsEnums](#stringapplicationxwwwformurlencodeditemsenums) item) | -| List | build()
Returns list input that should be used with Schema.validate | - -## ApplicationxwwwformurlencodedEnumFormStringArrayList -public class ApplicationxwwwformurlencodedEnumFormStringArrayList
-extends `FrozenList` - -A class to store validated List payloads - -### Method Summary -| Modifier and Type | Method and Description | -| ----------------- | ---------------------- | -| static [ApplicationxwwwformurlencodedEnumFormStringArrayList](#applicationxwwwformurlencodedenumformstringarraylist) | of([List](#applicationxwwwformurlencodedenumformstringarraylistbuilder) arg, SchemaConfiguration configuration) | - -## ApplicationxwwwformurlencodedItemsBoxed -public sealed interface ApplicationxwwwformurlencodedItemsBoxed
-permits
-[ApplicationxwwwformurlencodedItemsBoxedString](#applicationxwwwformurlencodeditemsboxedstring) - -sealed interface that stores validated payloads using boxed classes - -## ApplicationxwwwformurlencodedItemsBoxedString -public record ApplicationxwwwformurlencodedItemsBoxedString
-implements [ApplicationxwwwformurlencodedItemsBoxed](#applicationxwwwformurlencodeditemsboxed) - -record that stores validated String payloads, sealed permits implementation - -### Constructor Summary -| Constructor and Description | -| --------------------------- | -| ApplicationxwwwformurlencodedItemsBoxedString(String data)
Creates an instance, private visibility | - -### Method Summary -| Modifier and Type | Method and Description | -| ----------------- | ---------------------- | -| String | data()
validated payload | -| @Nullable Object | getData()
validated payload | - -## ApplicationxwwwformurlencodedItems -public static class ApplicationxwwwformurlencodedItems
-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.fake.get.requestbody.content.applicationxwwwformurlencoded.ApplicationxwwwformurlencodedSchema; - -import java.util.Arrays; -import java.util.List; -import java.util.AbstractMap; - -static final SchemaConfiguration configuration = new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().build()); - -// String validation -String validatedPayload = ApplicationxwwwformurlencodedSchema.ApplicationxwwwformurlencodedItems.validate( - ">", - configuration -); -``` - -### Field Summary -| Modifier and Type | Field and Description | -| ----------------- | ---------------------- | -| Set> | type = Set.of(
    String.class
)
| -| Set | enumValues = SetMaker.makeSet(
    ">",
    "$"
)
| -| @Nullable Object | defaultValue = "$" | - -### Method Summary -| Modifier and Type | Method and Description | -| ----------------- | ---------------------- | -| String | validate(String arg, SchemaConfiguration configuration) | -| String | validate([StringApplicationxwwwformurlencodedItemsEnums](#stringapplicationxwwwformurlencodeditemsenums) arg, SchemaConfiguration configuration) | -| [ApplicationxwwwformurlencodedItemsBoxedString](#applicationxwwwformurlencodeditemsboxedstring) | validateAndBox(String arg, SchemaConfiguration configuration) | -| [ApplicationxwwwformurlencodedItemsBoxed](#applicationxwwwformurlencodeditemsboxed) | validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) | -| @Nullable Object | validate(@Nullable Object arg, SchemaConfiguration configuration) | - -## StringApplicationxwwwformurlencodedItemsEnums -public enum StringApplicationxwwwformurlencodedItemsEnums
-extends `Enum` - -A class that stores String enum values - -### Enum Constant Summary -| Enum Constant | Description | -| ------------- | ----------- | -| GREATER_THAN_SIGN | value = ">" | -| DOLLAR_SIGN | value = "$" | diff --git a/samples/client/petstore/kotlin/docs/paths/fake/get/responses/FakeGetCode200Response.md b/samples/client/petstore/kotlin/docs/paths/fake/get/responses/FakeGetCode200Response.md deleted file mode 100644 index e22d671a474..00000000000 --- a/samples/client/petstore/kotlin/docs/paths/fake/get/responses/FakeGetCode200Response.md +++ /dev/null @@ -1,17 +0,0 @@ -# FakeGetCode200Response - -public class FakeGetCode200Response extends [SuccessDescriptionOnly](../../components/responses/SuccessDescriptionOnly.md) - -A class (extended from the $ref class) that contains necessary nested response classes -- a class that extends ResponseDeserializer and is used to deserialize responses - -## Nested Class Summary -| Modifier and Type | Class and Description | -| ----------------- | --------------------- | -| static class | [FakeGetCode200Response.FakeGetCode200Response1](#fakegetcode200response1)
class that deserializes responses | - -## FakeGetCode200Response1 -public static class FakeGetCode200Response1 extends [SuccessDescriptionOnly1](../../components/responses/SuccessDescriptionOnly.md#successdescriptiononly1)
- -a class that deserializes responses, extended from the $ref class - diff --git a/samples/client/petstore/kotlin/docs/paths/fake/get/responses/FakeGetCode404Response.md b/samples/client/petstore/kotlin/docs/paths/fake/get/responses/FakeGetCode404Response.md deleted file mode 100644 index 1506c173bfa..00000000000 --- a/samples/client/petstore/kotlin/docs/paths/fake/get/responses/FakeGetCode404Response.md +++ /dev/null @@ -1,87 +0,0 @@ -# FakeGetCode404Response - -public class FakeGetCode404Response - -A class that contains necessary nested response classes -- SealedMediaType, a sealed interface which contains all the schema/encoding info for each contentType -- records which implement SealedMediaType, the concrete media types -- SealedResponseBody, a sealed interface which contains all the contentType/schema types -- records which implement SealedResponseBody, the concrete response body types -- a class that extends ResponseDeserializer and is used to deserialize responses - -## Nested Class Summary -| Modifier and Type | Class and Description | -| ----------------- | --------------------- | -| sealed interface | [FakeGetCode404Response.SealedMediaType](#sealedmediatype)
media type sealed interface | -| record | [FakeGetCode404Response.ApplicationjsonMediaType](#applicationjsonmediatype)
record storing schema + encoding for a specific contentType | -| sealed interface | [FakeGetCode404Response.SealedResponseBody](#sealedresponsebody)
response body sealed interface | -| record | [FakeGetCode404Response.ApplicationjsonResponseBody](#applicationjsonresponsebody)
implements sealed interface to store response body | -| static class | [FakeGetCode404Response.FakeGetCode404Response1](#fakegetcode404response1)
class that deserializes responses | - -## SealedMediaType -public sealed interface SealedMediaType
-permits
-[ApplicationjsonMediaType](#applicationjsonmediatype) - -sealed interface that stores schema and encoding info - -## ApplicationjsonMediaType -public record ApplicationjsonMediaType
-implements [SealedMediaType](#sealedmediatype), MediaType<[ApplicationjsonSchema.ApplicationjsonSchema1](../../../../paths/fake/get/responses/code404response/content/applicationjson/ApplicationjsonSchema.md#applicationjsonschema1), Nothing?> - -class storing schema info for a specific contentType - -### Constructor Summary -| Constructor and Description | -| --------------------------- | -| ApplicationjsonMediaType()
Creates an instance | - -### Method Summary -| Modifier and Type | Method and Description | -| ----------------- | ---------------------- | -| [ApplicationjsonSchema.ApplicationjsonSchema1](../../../../paths/fake/get/responses/code404response/content/applicationjson/ApplicationjsonSchema.md#applicationjsonschema1) | schema()
the schema for this MediaType | -| Nothing? | encoding()
the encoding info | - -## SealedResponseBody -public sealed interface SealedResponseBody
-permits
-[ApplicationjsonResponseBody](#applicationjsonresponsebody) - -sealed interface that stores response body - -## ApplicationjsonResponseBody -public record ApplicationjsonResponseBody
-implements [SealedResponseBody](#sealedresponsebody) - -A record class to store response body for contentType="application/json" - -### Constructor Summary -| Constructor and Description | -| --------------------------- | -| ApplicationjsonResponseBody(ApplicationjsonSchema.MapJsonSchema1Boxed body)
Creates an instance | - -### Method Summary -| Modifier and Type | Method and Description | -| ----------------- | ---------------------- | -| ApplicationjsonSchema.MapJsonSchema1Boxed | body()
returns the body passed in in the constructor | - -## FakeGetCode404Response1 -public static class FakeGetCode404Response1
-extends ResponseDeserializer<[SealedResponseBody](#sealedresponsebody), Nothing?, [SealedMediaType](#sealedmediatype)> - -a class that deserializes responses - -### Constructor Summary -| Constructor and Description | -| --------------------------- | -| FakeGetCode404Response1()
Creates an instance | - -### Field Summary -| Modifier and Type | Field and Description | -| ----------------- | --------------------- | -| 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 | -| ----------------- | ---------------------- | -| ApiResponse<[SealedResponseBody](#sealedresponsebody), Nothing?> | deserialize(HttpResponse response, SchemaConfiguration configuration)
called by endpoint when deserialize responses | diff --git a/samples/client/petstore/kotlin/docs/paths/fake/get/responses/code404response/content/applicationjson/ApplicationjsonSchema.md b/samples/client/petstore/kotlin/docs/paths/fake/get/responses/code404response/content/applicationjson/ApplicationjsonSchema.md deleted file mode 100644 index 3ce84c1630e..00000000000 --- a/samples/client/petstore/kotlin/docs/paths/fake/get/responses/code404response/content/applicationjson/ApplicationjsonSchema.md +++ /dev/null @@ -1,49 +0,0 @@ -# ApplicationjsonSchema -public class ApplicationjsonSchema
- -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 - -## Nested Class Summary -| Modifier and Type | Class and Description | -| ----------------- | ---------------------- | -| sealed interface | [ApplicationjsonSchema.ApplicationjsonSchema1Boxed](#applicationjsonschema1boxed)
sealed interface for validated payloads | -| record | [ApplicationjsonSchema.ApplicationjsonSchema1BoxedMap](#applicationjsonschema1boxedmap)
boxed class to store validated Map payloads | -| static class | [ApplicationjsonSchema.ApplicationjsonSchema1](#applicationjsonschema1)
schema class | - -## ApplicationjsonSchema1Boxed -public sealed interface ApplicationjsonSchema1Boxed
-permits
-[ApplicationjsonSchema1BoxedMap](#applicationjsonschema1boxedmap) - -sealed interface that stores validated payloads using boxed classes - -## ApplicationjsonSchema1BoxedMap -public record ApplicationjsonSchema1BoxedMap
-implements [ApplicationjsonSchema1Boxed](#applicationjsonschema1boxed) - -record that stores validated Map payloads, sealed permits implementation - -### Constructor Summary -| Constructor and Description | -| --------------------------- | -| ApplicationjsonSchema1BoxedMap(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 | - -## ApplicationjsonSchema1 -public static class ApplicationjsonSchema1
-extends MapJsonSchema.MapJsonSchema1 - -A schema class that validates payloads - -| Methods Inherited from class org.openapijsonschematools.client.schemas.MapJsonSchema.MapJsonSchema1 | -| ------------------------------------------------------------------ | -| validate | -| validateAndBox | diff --git a/samples/client/petstore/kotlin/docs/paths/fake/patch/FakePatchRequestBody.md b/samples/client/petstore/kotlin/docs/paths/fake/patch/FakePatchRequestBody.md deleted file mode 100644 index 3f33af4fba5..00000000000 --- a/samples/client/petstore/kotlin/docs/paths/fake/patch/FakePatchRequestBody.md +++ /dev/null @@ -1,17 +0,0 @@ -# FakePatchRequestBody - -public class FakePatchRequestBody 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 - -## Nested Class Summary -| Modifier and Type | Class and Description | -| ----------------- | --------------------- | -| static class | [FakePatchRequestBody.FakePatchRequestBody1](#fakepatchrequestbody1)
class that serializes request bodies | - -## FakePatchRequestBody1 -public static class FakePatchRequestBody1 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/kotlin/docs/paths/fake/patch/FakePatchResponses.md b/samples/client/petstore/kotlin/docs/paths/fake/patch/FakePatchResponses.md deleted file mode 100644 index da8c837467d..00000000000 --- a/samples/client/petstore/kotlin/docs/paths/fake/patch/FakePatchResponses.md +++ /dev/null @@ -1,29 +0,0 @@ -# FakePatchResponses - -public class FakePatchResponses - -A class that contains necessary responses classes -- a sealed interface, EndpointResponse, that stores endpoint responses -- records for each endpoint response - -## Nested Class Summary -| Modifier and Type | Class and Description | -| ----------------- | --------------------- | -| sealed interface | [EndpointResponse](#endpointresponse)
stores the endpoint responses | -| record | [EndpointFakePatchCode200Response](#endpointfakepatchcode200response)
the response for 200 | - -## EndpointResponse -public sealed interface EndpointResponse permits
-[EndpointFakePatchCode200Response](#endpointfakepatchcode200response) - -a sealed interface that stores endpoint responses - -## EndpointFakePatchCode200Response -public record EndpointFakePatchCode200Response( - HttpResponse response, - [FakePatchCode200Response.SealedResponseBody](../../../paths/fake/patch/responses/FakePatchCode200Response.md#sealedresponsebody) body, - Nothing? headers -) implements EndpointResponse, ApiResponse
- -a class that stores an endpoint response - diff --git a/samples/client/petstore/kotlin/docs/paths/fake/patch/responses/FakePatchCode200Response.md b/samples/client/petstore/kotlin/docs/paths/fake/patch/responses/FakePatchCode200Response.md deleted file mode 100644 index e3cc385681c..00000000000 --- a/samples/client/petstore/kotlin/docs/paths/fake/patch/responses/FakePatchCode200Response.md +++ /dev/null @@ -1,87 +0,0 @@ -# FakePatchCode200Response - -public class FakePatchCode200Response - -A class that contains necessary nested response classes -- SealedMediaType, a sealed interface which contains all the schema/encoding info for each contentType -- records which implement SealedMediaType, the concrete media types -- SealedResponseBody, a sealed interface which contains all the contentType/schema types -- records which implement SealedResponseBody, the concrete response body types -- a class that extends ResponseDeserializer and is used to deserialize responses - -## Nested Class Summary -| Modifier and Type | Class and Description | -| ----------------- | --------------------- | -| sealed interface | [FakePatchCode200Response.SealedMediaType](#sealedmediatype)
media type sealed interface | -| record | [FakePatchCode200Response.ApplicationjsonMediaType](#applicationjsonmediatype)
record storing schema + encoding for a specific contentType | -| sealed interface | [FakePatchCode200Response.SealedResponseBody](#sealedresponsebody)
response body sealed interface | -| record | [FakePatchCode200Response.ApplicationjsonResponseBody](#applicationjsonresponsebody)
implements sealed interface to store response body | -| static class | [FakePatchCode200Response.FakePatchCode200Response1](#fakepatchcode200response1)
class that deserializes responses | - -## SealedMediaType -public sealed interface SealedMediaType
-permits
-[ApplicationjsonMediaType](#applicationjsonmediatype) - -sealed interface that stores schema and encoding info - -## ApplicationjsonMediaType -public record ApplicationjsonMediaType
-implements [SealedMediaType](#sealedmediatype), MediaType<[ApplicationjsonSchema.ApplicationjsonSchema1](../../../../paths/fake/patch/responses/code200response/content/applicationjson/ApplicationjsonSchema.md#applicationjsonschema1), Nothing?> - -class storing schema info for a specific contentType - -### Constructor Summary -| Constructor and Description | -| --------------------------- | -| ApplicationjsonMediaType()
Creates an instance | - -### Method Summary -| Modifier and Type | Method and Description | -| ----------------- | ---------------------- | -| [ApplicationjsonSchema.ApplicationjsonSchema1](../../../../paths/fake/patch/responses/code200response/content/applicationjson/ApplicationjsonSchema.md#applicationjsonschema1) | schema()
the schema for this MediaType | -| Nothing? | encoding()
the encoding info | - -## SealedResponseBody -public sealed interface SealedResponseBody
-permits
-[ApplicationjsonResponseBody](#applicationjsonresponsebody) - -sealed interface that stores response body - -## ApplicationjsonResponseBody -public record ApplicationjsonResponseBody
-implements [SealedResponseBody](#sealedresponsebody) - -A record class to store response body for contentType="application/json" - -### Constructor Summary -| Constructor and Description | -| --------------------------- | -| ApplicationjsonResponseBody(ApplicationjsonSchema.[Client1Boxed](../../../../components/schemas/Client.md#client1boxed) body)
Creates an instance | - -### Method Summary -| Modifier and Type | Method and Description | -| ----------------- | ---------------------- | -| ApplicationjsonSchema.[Client1Boxed](../../../../components/schemas/Client.md#client1boxed) | body()
returns the body passed in in the constructor | - -## FakePatchCode200Response1 -public static class FakePatchCode200Response1
-extends ResponseDeserializer<[SealedResponseBody](#sealedresponsebody), Nothing?, [SealedMediaType](#sealedmediatype)> - -a class that deserializes responses - -### Constructor Summary -| Constructor and Description | -| --------------------------- | -| FakePatchCode200Response1()
Creates an instance | - -### Field Summary -| Modifier and Type | Field and Description | -| ----------------- | --------------------- | -| 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 | -| ----------------- | ---------------------- | -| ApiResponse<[SealedResponseBody](#sealedresponsebody), Nothing?> | deserialize(HttpResponse response, SchemaConfiguration configuration)
called by endpoint when deserialize responses | diff --git a/samples/client/petstore/kotlin/docs/paths/fake/patch/responses/code200response/content/applicationjson/ApplicationjsonSchema.md b/samples/client/petstore/kotlin/docs/paths/fake/patch/responses/code200response/content/applicationjson/ApplicationjsonSchema.md deleted file mode 100644 index 534041524ca..00000000000 --- a/samples/client/petstore/kotlin/docs/paths/fake/patch/responses/code200response/content/applicationjson/ApplicationjsonSchema.md +++ /dev/null @@ -1,19 +0,0 @@ -# ApplicationjsonSchema -public class ApplicationjsonSchema
-extends [Client1](../../../../../../../components/schemas/Client.md#client) - -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 - -## Nested Class Summary -| Modifier and Type | Class and Description | -| ----------------- | ---------------------- | -| static class | [ApplicationjsonSchema.ApplicationjsonSchema1](#applicationjsonschema1)
schema class | - -## ApplicationjsonSchema1 -public static class ApplicationjsonSchema1
-extends [Client.Client1](../../../../../../../components/schemas/Client.md#client1) - -A schema class that validates payloads diff --git a/samples/client/petstore/kotlin/docs/paths/fake/post/FakePostRequestBody.md b/samples/client/petstore/kotlin/docs/paths/fake/post/FakePostRequestBody.md deleted file mode 100644 index 2bc1daf8044..00000000000 --- a/samples/client/petstore/kotlin/docs/paths/fake/post/FakePostRequestBody.md +++ /dev/null @@ -1,90 +0,0 @@ -# FakePostRequestBody - -public class FakePostRequestBody - -A class that contains necessary nested request body classes -- SealedMediaType, a sealed interface which contains all the schema/encoding info for each contentType -- records which implement SealedMediaType, the concrete media types -- a class that extends RequestBodySerializer and is used to serialize input SealedRequestBody instances -- SealedRequestBody, a sealed interface which contains all the contentType/schema input types -- records which implement SealedRequestBody, the concrete request body types - -## Nested Class Summary -| Modifier and Type | Class and Description | -| ----------------- | --------------------- | -| sealed interface | [FakePostRequestBody.SealedMediaType](#sealedmediatype)
media type sealed interface | -| record | [FakePostRequestBody.ApplicationxwwwformurlencodedMediaType](#applicationxwwwformurlencodedmediatype)
record storing schema + encoding for a specific contentType | -| static class | [FakePostRequestBody.FakePostRequestBody1](#fakepostrequestbody1)
class that serializes request bodies | -| sealed interface | [FakePostRequestBody.SealedRequestBody](#sealedrequestbody)
request body sealed interface | -| record | [FakePostRequestBody.ApplicationxwwwformurlencodedRequestBody](#applicationxwwwformurlencodedrequestbody)
implements sealed interface to store request body input | - -## SealedMediaType -public sealed interface SealedMediaType
-permits
-[ApplicationxwwwformurlencodedMediaType](#applicationxwwwformurlencodedmediatype) - -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), Nothing?> - -class storing schema info for a specific contentType - -### Constructor Summary -| Constructor and Description | -| --------------------------- | -| ApplicationxwwwformurlencodedMediaType()
Creates an instance | - -### 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 | -| Nothing? | encoding()
the encoding info | - -## FakePostRequestBody1 -public static class FakePostRequestBody1
- -a class that serializes SealedRequestBody request bodies - -### Constructor Summary -| Constructor and Description | -| --------------------------- | -| FakePostRequestBody1()
Creates an instance | - -### Field Summary -| Modifier and Type | Field and Description | -| ----------------- | --------------------- | -| boolean | required = false
whether the request body is required | -| Map | content = Map.ofEntries(
    new AbstractMap.SimpleEntry<>("application/x-www-form-urlencoded", new [ApplicationxwwwformurlencodedMediaType](#applicationxwwwformurlencodedmediatype)())
)
the contentType to schema info | - -### Method Summary -| Modifier and Type | Method and Description | -| ----------------- | ---------------------- | -| SerializedRequestBody | serialize([SealedRequestBody](#sealedrequestbody) requestBody)
called by endpoint when creating request body bytes | - -## SealedRequestBody -public sealed interface SealedRequestBody
-permits
-[ApplicationxwwwformurlencodedRequestBody](#applicationxwwwformurlencodedrequestbody) - -sealed interface that stores request contentType + validated schema data - -## ApplicationxwwwformurlencodedRequestBody -public record ApplicationxwwwformurlencodedRequestBody
-implements [SealedRequestBody](#sealedrequestbody),
-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 | - -### 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 | diff --git a/samples/client/petstore/kotlin/docs/paths/fake/post/FakePostResponses.md b/samples/client/petstore/kotlin/docs/paths/fake/post/FakePostResponses.md deleted file mode 100644 index dc9d84ba978..00000000000 --- a/samples/client/petstore/kotlin/docs/paths/fake/post/FakePostResponses.md +++ /dev/null @@ -1,29 +0,0 @@ -# FakePostResponses - -public class FakePostResponses - -A class that contains necessary responses classes -- a sealed interface, EndpointResponse, that stores endpoint responses -- records for each endpoint response - -## Nested Class Summary -| Modifier and Type | Class and Description | -| ----------------- | --------------------- | -| sealed interface | [EndpointResponse](#endpointresponse)
stores the endpoint responses | -| record | [EndpointFakePostCode200Response](#endpointfakepostcode200response)
the response for 200 | - -## EndpointResponse -public sealed interface EndpointResponse permits
-[EndpointFakePostCode200Response](#endpointfakepostcode200response) - -a sealed interface that stores endpoint responses - -## EndpointFakePostCode200Response -public record EndpointFakePostCode200Response( - HttpResponse response, - Nothing? body, - Nothing? headers -) implements EndpointResponse, ApiResponse
- -a class that stores an endpoint response - diff --git a/samples/client/petstore/kotlin/docs/paths/fake/post/FakePostSecurityInfo.md b/samples/client/petstore/kotlin/docs/paths/fake/post/FakePostSecurityInfo.md deleted file mode 100644 index 0166862a304..00000000000 --- a/samples/client/petstore/kotlin/docs/paths/fake/post/FakePostSecurityInfo.md +++ /dev/null @@ -1,40 +0,0 @@ -# FakePostSecurityInfo -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 -- an enum class that describes security index values - -## Nested Class Summary -| Modifier and Type | Class and Description | -| ----------------- | --------------------- | -| static class | [FakePostSecurityInfo.FakePostSecurityInfo1](#fakepostsecurityinfo1)
SecurityRequirementObjectProvider -| enum | [FakePostSecurityInfo.SecurityIndex](#securityindex)
class that stores a security index | - -## FakePostSecurityInfo1 -implements SecurityRequirementObjectProvider<[SecurityIndex](#securityindex)> - -### Constructor Summary -| Constructor and Description | -| --------------------------- | -| FakePostSecurityInfo1()
Creates an instance | - -### Field Summary -| Modifier and Type | Field and Description | -| ----------------- | --------------------- | -| [FakePostSecurityRequirementObject0](../../../paths/fake/post/security/FakePostSecurityRequirementObject0.md) | security0 | - -### Method Summary -| Modifier and Type | Method and Description | -| ----------------- | ---------------------- | -| SecurityRequirementObject | getSecurityRequirementObject(@Nullable [SecurityIndex](#securityindex) securityIndex)
If null is input, then the instance's securityIndex will be used | - -## SecurityIndex -enum SecurityIndex
- -### Enum Constant Summary -| Enum Constant And Description | -| ----------------------------- | -| SECURITY_0
security 0 | diff --git a/samples/client/petstore/kotlin/docs/paths/fake/post/requestbody/content/applicationxwwwformurlencoded/ApplicationxwwwformurlencodedSchema.md b/samples/client/petstore/kotlin/docs/paths/fake/post/requestbody/content/applicationxwwwformurlencoded/ApplicationxwwwformurlencodedSchema.md deleted file mode 100644 index c6e16f2048b..00000000000 --- a/samples/client/petstore/kotlin/docs/paths/fake/post/requestbody/content/applicationxwwwformurlencoded/ApplicationxwwwformurlencodedSchema.md +++ /dev/null @@ -1,1331 +0,0 @@ -# ApplicationxwwwformurlencodedSchema -public class ApplicationxwwwformurlencodedSchema
- -A class that contains necessary nested -- schema classes (which validate payloads), extends JsonSchema -- sealed interfaces which store validated payloads, java version of a sum type -- boxed classes which store validated payloads, sealed permits class implementations -- classes to store validated map payloads, extends FrozenMap -- classes to build inputs for map payloads - -## Nested Class Summary -| Modifier and Type | Class and Description | -| ----------------- | ---------------------- | -| sealed interface | [ApplicationxwwwformurlencodedSchema.ApplicationxwwwformurlencodedSchema1Boxed](#applicationxwwwformurlencodedschema1boxed)
sealed interface for validated payloads | -| record | [ApplicationxwwwformurlencodedSchema.ApplicationxwwwformurlencodedSchema1BoxedMap](#applicationxwwwformurlencodedschema1boxedmap)
boxed class to store validated Map payloads | -| static class | [ApplicationxwwwformurlencodedSchema.ApplicationxwwwformurlencodedSchema1](#applicationxwwwformurlencodedschema1)
schema class | -| static class | [ApplicationxwwwformurlencodedSchema.ApplicationxwwwformurlencodedSchemaMapBuilder](#applicationxwwwformurlencodedschemamapbuilder)
builder for Map payloads | -| static class | [ApplicationxwwwformurlencodedSchema.ApplicationxwwwformurlencodedSchemaMap](#applicationxwwwformurlencodedschemamap)
output class for Map payloads | -| sealed interface | [ApplicationxwwwformurlencodedSchema.ApplicationxwwwformurlencodedCallbackBoxed](#applicationxwwwformurlencodedcallbackboxed)
sealed interface for validated payloads | -| record | [ApplicationxwwwformurlencodedSchema.ApplicationxwwwformurlencodedCallbackBoxedString](#applicationxwwwformurlencodedcallbackboxedstring)
boxed class to store validated String payloads | -| static class | [ApplicationxwwwformurlencodedSchema.ApplicationxwwwformurlencodedCallback](#applicationxwwwformurlencodedcallback)
schema class | -| sealed interface | [ApplicationxwwwformurlencodedSchema.ApplicationxwwwformurlencodedPasswordBoxed](#applicationxwwwformurlencodedpasswordboxed)
sealed interface for validated payloads | -| record | [ApplicationxwwwformurlencodedSchema.ApplicationxwwwformurlencodedPasswordBoxedString](#applicationxwwwformurlencodedpasswordboxedstring)
boxed class to store validated String payloads | -| static class | [ApplicationxwwwformurlencodedSchema.ApplicationxwwwformurlencodedPassword](#applicationxwwwformurlencodedpassword)
schema class | -| sealed interface | [ApplicationxwwwformurlencodedSchema.ApplicationxwwwformurlencodedDateTimeBoxed](#applicationxwwwformurlencodeddatetimeboxed)
sealed interface for validated payloads | -| record | [ApplicationxwwwformurlencodedSchema.ApplicationxwwwformurlencodedDateTimeBoxedString](#applicationxwwwformurlencodeddatetimeboxedstring)
boxed class to store validated String payloads | -| static class | [ApplicationxwwwformurlencodedSchema.ApplicationxwwwformurlencodedDateTime](#applicationxwwwformurlencodeddatetime)
schema class | -| sealed interface | [ApplicationxwwwformurlencodedSchema.ApplicationxwwwformurlencodedDateBoxed](#applicationxwwwformurlencodeddateboxed)
sealed interface for validated payloads | -| record | [ApplicationxwwwformurlencodedSchema.ApplicationxwwwformurlencodedDateBoxedString](#applicationxwwwformurlencodeddateboxedstring)
boxed class to store validated String payloads | -| static class | [ApplicationxwwwformurlencodedSchema.ApplicationxwwwformurlencodedDate](#applicationxwwwformurlencodeddate)
schema class | -| sealed interface | [ApplicationxwwwformurlencodedSchema.ApplicationxwwwformurlencodedBinaryBoxed](#applicationxwwwformurlencodedbinaryboxed)
sealed interface for validated payloads | -| static class | [ApplicationxwwwformurlencodedSchema.ApplicationxwwwformurlencodedBinary](#applicationxwwwformurlencodedbinary)
schema class | -| sealed interface | [ApplicationxwwwformurlencodedSchema.ApplicationxwwwformurlencodedByteBoxed](#applicationxwwwformurlencodedbyteboxed)
sealed interface for validated payloads | -| record | [ApplicationxwwwformurlencodedSchema.ApplicationxwwwformurlencodedByteBoxedString](#applicationxwwwformurlencodedbyteboxedstring)
boxed class to store validated String payloads | -| static class | [ApplicationxwwwformurlencodedSchema.ApplicationxwwwformurlencodedByte](#applicationxwwwformurlencodedbyte)
schema class | -| sealed interface | [ApplicationxwwwformurlencodedSchema.ApplicationxwwwformurlencodedPatternWithoutDelimiterBoxed](#applicationxwwwformurlencodedpatternwithoutdelimiterboxed)
sealed interface for validated payloads | -| record | [ApplicationxwwwformurlencodedSchema.ApplicationxwwwformurlencodedPatternWithoutDelimiterBoxedString](#applicationxwwwformurlencodedpatternwithoutdelimiterboxedstring)
boxed class to store validated String payloads | -| static class | [ApplicationxwwwformurlencodedSchema.ApplicationxwwwformurlencodedPatternWithoutDelimiter](#applicationxwwwformurlencodedpatternwithoutdelimiter)
schema class | -| sealed interface | [ApplicationxwwwformurlencodedSchema.ApplicationxwwwformurlencodedStringBoxed](#applicationxwwwformurlencodedstringboxed)
sealed interface for validated payloads | -| record | [ApplicationxwwwformurlencodedSchema.ApplicationxwwwformurlencodedStringBoxedString](#applicationxwwwformurlencodedstringboxedstring)
boxed class to store validated String payloads | -| static class | [ApplicationxwwwformurlencodedSchema.ApplicationxwwwformurlencodedString](#applicationxwwwformurlencodedstring)
schema class | -| sealed interface | [ApplicationxwwwformurlencodedSchema.ApplicationxwwwformurlencodedDoubleBoxed](#applicationxwwwformurlencodeddoubleboxed)
sealed interface for validated payloads | -| record | [ApplicationxwwwformurlencodedSchema.ApplicationxwwwformurlencodedDoubleBoxedNumber](#applicationxwwwformurlencodeddoubleboxednumber)
boxed class to store validated Number payloads | -| static class | [ApplicationxwwwformurlencodedSchema.ApplicationxwwwformurlencodedDouble](#applicationxwwwformurlencodeddouble)
schema class | -| sealed interface | [ApplicationxwwwformurlencodedSchema.ApplicationxwwwformurlencodedFloatBoxed](#applicationxwwwformurlencodedfloatboxed)
sealed interface for validated payloads | -| record | [ApplicationxwwwformurlencodedSchema.ApplicationxwwwformurlencodedFloatBoxedNumber](#applicationxwwwformurlencodedfloatboxednumber)
boxed class to store validated Number payloads | -| static class | [ApplicationxwwwformurlencodedSchema.ApplicationxwwwformurlencodedFloat](#applicationxwwwformurlencodedfloat)
schema class | -| sealed interface | [ApplicationxwwwformurlencodedSchema.ApplicationxwwwformurlencodedNumberBoxed](#applicationxwwwformurlencodednumberboxed)
sealed interface for validated payloads | -| record | [ApplicationxwwwformurlencodedSchema.ApplicationxwwwformurlencodedNumberBoxedNumber](#applicationxwwwformurlencodednumberboxednumber)
boxed class to store validated Number payloads | -| static class | [ApplicationxwwwformurlencodedSchema.ApplicationxwwwformurlencodedNumber](#applicationxwwwformurlencodednumber)
schema class | -| sealed interface | [ApplicationxwwwformurlencodedSchema.ApplicationxwwwformurlencodedInt64Boxed](#applicationxwwwformurlencodedint64boxed)
sealed interface for validated payloads | -| record | [ApplicationxwwwformurlencodedSchema.ApplicationxwwwformurlencodedInt64BoxedNumber](#applicationxwwwformurlencodedint64boxednumber)
boxed class to store validated Number payloads | -| static class | [ApplicationxwwwformurlencodedSchema.ApplicationxwwwformurlencodedInt64](#applicationxwwwformurlencodedint64)
schema class | -| sealed interface | [ApplicationxwwwformurlencodedSchema.ApplicationxwwwformurlencodedInt32Boxed](#applicationxwwwformurlencodedint32boxed)
sealed interface for validated payloads | -| record | [ApplicationxwwwformurlencodedSchema.ApplicationxwwwformurlencodedInt32BoxedNumber](#applicationxwwwformurlencodedint32boxednumber)
boxed class to store validated Number payloads | -| static class | [ApplicationxwwwformurlencodedSchema.ApplicationxwwwformurlencodedInt32](#applicationxwwwformurlencodedint32)
schema class | -| sealed interface | [ApplicationxwwwformurlencodedSchema.ApplicationxwwwformurlencodedIntegerBoxed](#applicationxwwwformurlencodedintegerboxed)
sealed interface for validated payloads | -| record | [ApplicationxwwwformurlencodedSchema.ApplicationxwwwformurlencodedIntegerBoxedNumber](#applicationxwwwformurlencodedintegerboxednumber)
boxed class to store validated Number payloads | -| static class | [ApplicationxwwwformurlencodedSchema.ApplicationxwwwformurlencodedInteger](#applicationxwwwformurlencodedinteger)
schema class | - -## ApplicationxwwwformurlencodedSchema1Boxed -public sealed interface ApplicationxwwwformurlencodedSchema1Boxed
-permits
-[ApplicationxwwwformurlencodedSchema1BoxedMap](#applicationxwwwformurlencodedschema1boxedmap) - -sealed interface that stores validated payloads using boxed classes - -## ApplicationxwwwformurlencodedSchema1BoxedMap -public record ApplicationxwwwformurlencodedSchema1BoxedMap
-implements [ApplicationxwwwformurlencodedSchema1Boxed](#applicationxwwwformurlencodedschema1boxed) - -record that stores validated Map payloads, sealed permits implementation - -### Constructor Summary -| Constructor and Description | -| --------------------------- | -| ApplicationxwwwformurlencodedSchema1BoxedMap([ApplicationxwwwformurlencodedSchemaMap](#applicationxwwwformurlencodedschemamap) data)
Creates an instance, private visibility | - -### Method Summary -| Modifier and Type | Method and Description | -| ----------------- | ---------------------- | -| [ApplicationxwwwformurlencodedSchemaMap](#applicationxwwwformurlencodedschemamap) | data()
validated payload | -| @Nullable Object | getData()
validated payload | - -## ApplicationxwwwformurlencodedSchema1 -public static class ApplicationxwwwformurlencodedSchema1
-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.fake.post.requestbody.content.applicationxwwwformurlencoded.ApplicationxwwwformurlencodedSchema; - -import java.util.Arrays; -import java.util.List; -import java.util.AbstractMap; - -static final SchemaConfiguration configuration = new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().build()); - -// Map validation -ApplicationxwwwformurlencodedSchema.ApplicationxwwwformurlencodedSchemaMap validatedPayload = - ApplicationxwwwformurlencodedSchema.ApplicationxwwwformurlencodedSchema1.validate( - 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(), - configuration -); -``` - -### Field Summary -| Modifier and Type | Field and Description | -| ----------------- | ---------------------- | -| Set> | type = Set.of(Map.class) | -| Map> | properties = Map.ofEntries(
    new PropertyEntry("integer", [ApplicationxwwwformurlencodedInteger.class](#applicationxwwwformurlencodedinteger))),
    new PropertyEntry("int32", [ApplicationxwwwformurlencodedInt32.class](#applicationxwwwformurlencodedint32))),
    new PropertyEntry("int64", [ApplicationxwwwformurlencodedInt64.class](#applicationxwwwformurlencodedint64))),
    new PropertyEntry("number", [ApplicationxwwwformurlencodedNumber.class](#applicationxwwwformurlencodednumber))),
    new PropertyEntry("float", [ApplicationxwwwformurlencodedFloat.class](#applicationxwwwformurlencodedfloat))),
    new PropertyEntry("double", [ApplicationxwwwformurlencodedDouble.class](#applicationxwwwformurlencodeddouble))),
    new PropertyEntry("string", [ApplicationxwwwformurlencodedString.class](#applicationxwwwformurlencodedstring))),
    new PropertyEntry("pattern_without_delimiter", [ApplicationxwwwformurlencodedPatternWithoutDelimiter.class](#applicationxwwwformurlencodedpatternwithoutdelimiter))),
    new PropertyEntry("byte", [ApplicationxwwwformurlencodedByte.class](#applicationxwwwformurlencodedbyte))),
    new PropertyEntry("binary", [ApplicationxwwwformurlencodedBinary.class](#applicationxwwwformurlencodedbinary))),
    new PropertyEntry("date", [ApplicationxwwwformurlencodedDate.class](#applicationxwwwformurlencodeddate))),
    new PropertyEntry("dateTime", [ApplicationxwwwformurlencodedDateTime.class](#applicationxwwwformurlencodeddatetime))),
    new PropertyEntry("password", [ApplicationxwwwformurlencodedPassword.class](#applicationxwwwformurlencodedpassword))),
    new PropertyEntry("callback", [ApplicationxwwwformurlencodedCallback.class](#applicationxwwwformurlencodedcallback)))
)
| -| Set | required = Set.of(
    "byte",
    "double",
    "number",
    "pattern_without_delimiter"
)
| - -### Method Summary -| Modifier and Type | Method and Description | -| ----------------- | ---------------------- | -| [ApplicationxwwwformurlencodedSchemaMap](#applicationxwwwformurlencodedschemamap) | validate([Map<?, ?>](#applicationxwwwformurlencodedschemamapbuilder) arg, SchemaConfiguration configuration) | -| [ApplicationxwwwformurlencodedSchema1BoxedMap](#applicationxwwwformurlencodedschema1boxedmap) | validateAndBox([Map<?, ?>](#applicationxwwwformurlencodedschemamapbuilder) arg, SchemaConfiguration configuration) | -| [ApplicationxwwwformurlencodedSchema1Boxed](#applicationxwwwformurlencodedschema1boxed) | validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) | -| @Nullable Object | validate(@Nullable Object arg, SchemaConfiguration configuration) | - -## ApplicationxwwwformurlencodedSchemaMap0000Builder -public class ApplicationxwwwformurlencodedSchemaMap0000Builder
-builder for `Map` - -A class that builds the Map input type - -### Constructor Summary -| Constructor and Description | -| --------------------------- | -| ApplicationxwwwformurlencodedSchemaMap0000Builder(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 | -| [ApplicationxwwwformurlencodedSchemaMap0000Builder](#applicationxwwwformurlencodedschemamap0000builder) | setInteger(int value) | -| [ApplicationxwwwformurlencodedSchemaMap0000Builder](#applicationxwwwformurlencodedschemamap0000builder) | setInteger(float value) | -| [ApplicationxwwwformurlencodedSchemaMap0000Builder](#applicationxwwwformurlencodedschemamap0000builder) | setInteger(long value) | -| [ApplicationxwwwformurlencodedSchemaMap0000Builder](#applicationxwwwformurlencodedschemamap0000builder) | setInteger(double value) | -| [ApplicationxwwwformurlencodedSchemaMap0000Builder](#applicationxwwwformurlencodedschemamap0000builder) | int32(int value) | -| [ApplicationxwwwformurlencodedSchemaMap0000Builder](#applicationxwwwformurlencodedschemamap0000builder) | int32(float value) | -| [ApplicationxwwwformurlencodedSchemaMap0000Builder](#applicationxwwwformurlencodedschemamap0000builder) | int64(int value) | -| [ApplicationxwwwformurlencodedSchemaMap0000Builder](#applicationxwwwformurlencodedschemamap0000builder) | int64(float value) | -| [ApplicationxwwwformurlencodedSchemaMap0000Builder](#applicationxwwwformurlencodedschemamap0000builder) | int64(long value) | -| [ApplicationxwwwformurlencodedSchemaMap0000Builder](#applicationxwwwformurlencodedschemamap0000builder) | int64(double value) | -| [ApplicationxwwwformurlencodedSchemaMap0000Builder](#applicationxwwwformurlencodedschemamap0000builder) | setFloat(int value) | -| [ApplicationxwwwformurlencodedSchemaMap0000Builder](#applicationxwwwformurlencodedschemamap0000builder) | setFloat(float value) | -| [ApplicationxwwwformurlencodedSchemaMap0000Builder](#applicationxwwwformurlencodedschemamap0000builder) | setFloat(long value) | -| [ApplicationxwwwformurlencodedSchemaMap0000Builder](#applicationxwwwformurlencodedschemamap0000builder) | setFloat(double value) | -| [ApplicationxwwwformurlencodedSchemaMap0000Builder](#applicationxwwwformurlencodedschemamap0000builder) | setString(String value) | -| [ApplicationxwwwformurlencodedSchemaMap0000Builder](#applicationxwwwformurlencodedschemamap0000builder) | binary(String value) | -| [ApplicationxwwwformurlencodedSchemaMap0000Builder](#applicationxwwwformurlencodedschemamap0000builder) | date(String value) | -| [ApplicationxwwwformurlencodedSchemaMap0000Builder](#applicationxwwwformurlencodedschemamap0000builder) | dateTime(String value) | -| [ApplicationxwwwformurlencodedSchemaMap0000Builder](#applicationxwwwformurlencodedschemamap0000builder) | password(String value) | -| [ApplicationxwwwformurlencodedSchemaMap0000Builder](#applicationxwwwformurlencodedschemamap0000builder) | callback(String value) | -| [ApplicationxwwwformurlencodedSchemaMap0000Builder](#applicationxwwwformurlencodedschemamap0000builder) | additionalProperty(String key, Nothing? value) | -| [ApplicationxwwwformurlencodedSchemaMap0000Builder](#applicationxwwwformurlencodedschemamap0000builder) | additionalProperty(String key, boolean value) | -| [ApplicationxwwwformurlencodedSchemaMap0000Builder](#applicationxwwwformurlencodedschemamap0000builder) | additionalProperty(String key, String value) | -| [ApplicationxwwwformurlencodedSchemaMap0000Builder](#applicationxwwwformurlencodedschemamap0000builder) | additionalProperty(String key, int value) | -| [ApplicationxwwwformurlencodedSchemaMap0000Builder](#applicationxwwwformurlencodedschemamap0000builder) | additionalProperty(String key, float value) | -| [ApplicationxwwwformurlencodedSchemaMap0000Builder](#applicationxwwwformurlencodedschemamap0000builder) | additionalProperty(String key, long value) | -| [ApplicationxwwwformurlencodedSchemaMap0000Builder](#applicationxwwwformurlencodedschemamap0000builder) | additionalProperty(String key, double value) | -| [ApplicationxwwwformurlencodedSchemaMap0000Builder](#applicationxwwwformurlencodedschemamap0000builder) | additionalProperty(String key, List value) | -| [ApplicationxwwwformurlencodedSchemaMap0000Builder](#applicationxwwwformurlencodedschemamap0000builder) | additionalProperty(String key, Map value) | - -## ApplicationxwwwformurlencodedSchemaMap0001Builder -public class ApplicationxwwwformurlencodedSchemaMap0001Builder
-builder for `Map` - -A class that builds the Map input type - -### Constructor Summary -| Constructor and Description | -| --------------------------- | -| ApplicationxwwwformurlencodedSchemaMap0001Builder(Map instance)
Creates a builder that contains the passed instance | - -### Method Summary -| Modifier and Type | Method and Description | -| ----------------- | ---------------------- | -| [ApplicationxwwwformurlencodedSchemaMap0000Builder](#applicationxwwwformurlencodedschemamap0000builder) | pattern_without_delimiter(String value) | - -## ApplicationxwwwformurlencodedSchemaMap0010Builder -public class ApplicationxwwwformurlencodedSchemaMap0010Builder
-builder for `Map` - -A class that builds the Map input type - -### Constructor Summary -| Constructor and Description | -| --------------------------- | -| ApplicationxwwwformurlencodedSchemaMap0010Builder(Map instance)
Creates a builder that contains the passed instance | - -### Method Summary -| Modifier and Type | Method and Description | -| ----------------- | ---------------------- | -| [ApplicationxwwwformurlencodedSchemaMap0000Builder](#applicationxwwwformurlencodedschemamap0000builder) | setNumber(int value) | -| [ApplicationxwwwformurlencodedSchemaMap0000Builder](#applicationxwwwformurlencodedschemamap0000builder) | setNumber(float value) | -| [ApplicationxwwwformurlencodedSchemaMap0000Builder](#applicationxwwwformurlencodedschemamap0000builder) | setNumber(long value) | -| [ApplicationxwwwformurlencodedSchemaMap0000Builder](#applicationxwwwformurlencodedschemamap0000builder) | setNumber(double value) | - -## ApplicationxwwwformurlencodedSchemaMap0011Builder -public class ApplicationxwwwformurlencodedSchemaMap0011Builder
-builder for `Map` - -A class that builds the Map input type - -### Constructor Summary -| Constructor and Description | -| --------------------------- | -| ApplicationxwwwformurlencodedSchemaMap0011Builder(Map instance)
Creates a builder that contains the passed instance | - -### Method Summary -| Modifier and Type | Method and Description | -| ----------------- | ---------------------- | -| [ApplicationxwwwformurlencodedSchemaMap0001Builder](#applicationxwwwformurlencodedschemamap0001builder) | setNumber(int value) | -| [ApplicationxwwwformurlencodedSchemaMap0001Builder](#applicationxwwwformurlencodedschemamap0001builder) | setNumber(float value) | -| [ApplicationxwwwformurlencodedSchemaMap0001Builder](#applicationxwwwformurlencodedschemamap0001builder) | setNumber(long value) | -| [ApplicationxwwwformurlencodedSchemaMap0001Builder](#applicationxwwwformurlencodedschemamap0001builder) | setNumber(double value) | -| [ApplicationxwwwformurlencodedSchemaMap0010Builder](#applicationxwwwformurlencodedschemamap0010builder) | pattern_without_delimiter(String value) | - -## ApplicationxwwwformurlencodedSchemaMap0100Builder -public class ApplicationxwwwformurlencodedSchemaMap0100Builder
-builder for `Map` - -A class that builds the Map input type - -### Constructor Summary -| Constructor and Description | -| --------------------------- | -| ApplicationxwwwformurlencodedSchemaMap0100Builder(Map instance)
Creates a builder that contains the passed instance | - -### Method Summary -| Modifier and Type | Method and Description | -| ----------------- | ---------------------- | -| [ApplicationxwwwformurlencodedSchemaMap0000Builder](#applicationxwwwformurlencodedschemamap0000builder) | setDouble(int value) | -| [ApplicationxwwwformurlencodedSchemaMap0000Builder](#applicationxwwwformurlencodedschemamap0000builder) | setDouble(float value) | -| [ApplicationxwwwformurlencodedSchemaMap0000Builder](#applicationxwwwformurlencodedschemamap0000builder) | setDouble(long value) | -| [ApplicationxwwwformurlencodedSchemaMap0000Builder](#applicationxwwwformurlencodedschemamap0000builder) | setDouble(double value) | - -## ApplicationxwwwformurlencodedSchemaMap0101Builder -public class ApplicationxwwwformurlencodedSchemaMap0101Builder
-builder for `Map` - -A class that builds the Map input type - -### Constructor Summary -| Constructor and Description | -| --------------------------- | -| ApplicationxwwwformurlencodedSchemaMap0101Builder(Map instance)
Creates a builder that contains the passed instance | - -### Method Summary -| Modifier and Type | Method and Description | -| ----------------- | ---------------------- | -| [ApplicationxwwwformurlencodedSchemaMap0001Builder](#applicationxwwwformurlencodedschemamap0001builder) | setDouble(int value) | -| [ApplicationxwwwformurlencodedSchemaMap0001Builder](#applicationxwwwformurlencodedschemamap0001builder) | setDouble(float value) | -| [ApplicationxwwwformurlencodedSchemaMap0001Builder](#applicationxwwwformurlencodedschemamap0001builder) | setDouble(long value) | -| [ApplicationxwwwformurlencodedSchemaMap0001Builder](#applicationxwwwformurlencodedschemamap0001builder) | setDouble(double value) | -| [ApplicationxwwwformurlencodedSchemaMap0100Builder](#applicationxwwwformurlencodedschemamap0100builder) | pattern_without_delimiter(String value) | - -## ApplicationxwwwformurlencodedSchemaMap0110Builder -public class ApplicationxwwwformurlencodedSchemaMap0110Builder
-builder for `Map` - -A class that builds the Map input type - -### Constructor Summary -| Constructor and Description | -| --------------------------- | -| ApplicationxwwwformurlencodedSchemaMap0110Builder(Map instance)
Creates a builder that contains the passed instance | - -### Method Summary -| Modifier and Type | Method and Description | -| ----------------- | ---------------------- | -| [ApplicationxwwwformurlencodedSchemaMap0010Builder](#applicationxwwwformurlencodedschemamap0010builder) | setDouble(int value) | -| [ApplicationxwwwformurlencodedSchemaMap0010Builder](#applicationxwwwformurlencodedschemamap0010builder) | setDouble(float value) | -| [ApplicationxwwwformurlencodedSchemaMap0010Builder](#applicationxwwwformurlencodedschemamap0010builder) | setDouble(long value) | -| [ApplicationxwwwformurlencodedSchemaMap0010Builder](#applicationxwwwformurlencodedschemamap0010builder) | setDouble(double value) | -| [ApplicationxwwwformurlencodedSchemaMap0100Builder](#applicationxwwwformurlencodedschemamap0100builder) | setNumber(int value) | -| [ApplicationxwwwformurlencodedSchemaMap0100Builder](#applicationxwwwformurlencodedschemamap0100builder) | setNumber(float value) | -| [ApplicationxwwwformurlencodedSchemaMap0100Builder](#applicationxwwwformurlencodedschemamap0100builder) | setNumber(long value) | -| [ApplicationxwwwformurlencodedSchemaMap0100Builder](#applicationxwwwformurlencodedschemamap0100builder) | setNumber(double value) | - -## ApplicationxwwwformurlencodedSchemaMap0111Builder -public class ApplicationxwwwformurlencodedSchemaMap0111Builder
-builder for `Map` - -A class that builds the Map input type - -### Constructor Summary -| Constructor and Description | -| --------------------------- | -| ApplicationxwwwformurlencodedSchemaMap0111Builder(Map instance)
Creates a builder that contains the passed instance | - -### Method Summary -| Modifier and Type | Method and Description | -| ----------------- | ---------------------- | -| [ApplicationxwwwformurlencodedSchemaMap0011Builder](#applicationxwwwformurlencodedschemamap0011builder) | setDouble(int value) | -| [ApplicationxwwwformurlencodedSchemaMap0011Builder](#applicationxwwwformurlencodedschemamap0011builder) | setDouble(float value) | -| [ApplicationxwwwformurlencodedSchemaMap0011Builder](#applicationxwwwformurlencodedschemamap0011builder) | setDouble(long value) | -| [ApplicationxwwwformurlencodedSchemaMap0011Builder](#applicationxwwwformurlencodedschemamap0011builder) | setDouble(double value) | -| [ApplicationxwwwformurlencodedSchemaMap0101Builder](#applicationxwwwformurlencodedschemamap0101builder) | setNumber(int value) | -| [ApplicationxwwwformurlencodedSchemaMap0101Builder](#applicationxwwwformurlencodedschemamap0101builder) | setNumber(float value) | -| [ApplicationxwwwformurlencodedSchemaMap0101Builder](#applicationxwwwformurlencodedschemamap0101builder) | setNumber(long value) | -| [ApplicationxwwwformurlencodedSchemaMap0101Builder](#applicationxwwwformurlencodedschemamap0101builder) | setNumber(double value) | -| [ApplicationxwwwformurlencodedSchemaMap0110Builder](#applicationxwwwformurlencodedschemamap0110builder) | pattern_without_delimiter(String value) | - -## ApplicationxwwwformurlencodedSchemaMap1000Builder -public class ApplicationxwwwformurlencodedSchemaMap1000Builder
-builder for `Map` - -A class that builds the Map input type - -### Constructor Summary -| Constructor and Description | -| --------------------------- | -| ApplicationxwwwformurlencodedSchemaMap1000Builder(Map instance)
Creates a builder that contains the passed instance | - -### Method Summary -| Modifier and Type | Method and Description | -| ----------------- | ---------------------- | -| [ApplicationxwwwformurlencodedSchemaMap0000Builder](#applicationxwwwformurlencodedschemamap0000builder) | setByte(String value) | - -## ApplicationxwwwformurlencodedSchemaMap1001Builder -public class ApplicationxwwwformurlencodedSchemaMap1001Builder
-builder for `Map` - -A class that builds the Map input type - -### Constructor Summary -| Constructor and Description | -| --------------------------- | -| ApplicationxwwwformurlencodedSchemaMap1001Builder(Map instance)
Creates a builder that contains the passed instance | - -### Method Summary -| Modifier and Type | Method and Description | -| ----------------- | ---------------------- | -| [ApplicationxwwwformurlencodedSchemaMap0001Builder](#applicationxwwwformurlencodedschemamap0001builder) | setByte(String value) | -| [ApplicationxwwwformurlencodedSchemaMap1000Builder](#applicationxwwwformurlencodedschemamap1000builder) | pattern_without_delimiter(String value) | - -## ApplicationxwwwformurlencodedSchemaMap1010Builder -public class ApplicationxwwwformurlencodedSchemaMap1010Builder
-builder for `Map` - -A class that builds the Map input type - -### Constructor Summary -| Constructor and Description | -| --------------------------- | -| ApplicationxwwwformurlencodedSchemaMap1010Builder(Map instance)
Creates a builder that contains the passed instance | - -### Method Summary -| Modifier and Type | Method and Description | -| ----------------- | ---------------------- | -| [ApplicationxwwwformurlencodedSchemaMap0010Builder](#applicationxwwwformurlencodedschemamap0010builder) | setByte(String value) | -| [ApplicationxwwwformurlencodedSchemaMap1000Builder](#applicationxwwwformurlencodedschemamap1000builder) | setNumber(int value) | -| [ApplicationxwwwformurlencodedSchemaMap1000Builder](#applicationxwwwformurlencodedschemamap1000builder) | setNumber(float value) | -| [ApplicationxwwwformurlencodedSchemaMap1000Builder](#applicationxwwwformurlencodedschemamap1000builder) | setNumber(long value) | -| [ApplicationxwwwformurlencodedSchemaMap1000Builder](#applicationxwwwformurlencodedschemamap1000builder) | setNumber(double value) | - -## ApplicationxwwwformurlencodedSchemaMap1011Builder -public class ApplicationxwwwformurlencodedSchemaMap1011Builder
-builder for `Map` - -A class that builds the Map input type - -### Constructor Summary -| Constructor and Description | -| --------------------------- | -| ApplicationxwwwformurlencodedSchemaMap1011Builder(Map instance)
Creates a builder that contains the passed instance | - -### Method Summary -| Modifier and Type | Method and Description | -| ----------------- | ---------------------- | -| [ApplicationxwwwformurlencodedSchemaMap0011Builder](#applicationxwwwformurlencodedschemamap0011builder) | setByte(String value) | -| [ApplicationxwwwformurlencodedSchemaMap1001Builder](#applicationxwwwformurlencodedschemamap1001builder) | setNumber(int value) | -| [ApplicationxwwwformurlencodedSchemaMap1001Builder](#applicationxwwwformurlencodedschemamap1001builder) | setNumber(float value) | -| [ApplicationxwwwformurlencodedSchemaMap1001Builder](#applicationxwwwformurlencodedschemamap1001builder) | setNumber(long value) | -| [ApplicationxwwwformurlencodedSchemaMap1001Builder](#applicationxwwwformurlencodedschemamap1001builder) | setNumber(double value) | -| [ApplicationxwwwformurlencodedSchemaMap1010Builder](#applicationxwwwformurlencodedschemamap1010builder) | pattern_without_delimiter(String value) | - -## ApplicationxwwwformurlencodedSchemaMap1100Builder -public class ApplicationxwwwformurlencodedSchemaMap1100Builder
-builder for `Map` - -A class that builds the Map input type - -### Constructor Summary -| Constructor and Description | -| --------------------------- | -| ApplicationxwwwformurlencodedSchemaMap1100Builder(Map instance)
Creates a builder that contains the passed instance | - -### Method Summary -| Modifier and Type | Method and Description | -| ----------------- | ---------------------- | -| [ApplicationxwwwformurlencodedSchemaMap0100Builder](#applicationxwwwformurlencodedschemamap0100builder) | setByte(String value) | -| [ApplicationxwwwformurlencodedSchemaMap1000Builder](#applicationxwwwformurlencodedschemamap1000builder) | setDouble(int value) | -| [ApplicationxwwwformurlencodedSchemaMap1000Builder](#applicationxwwwformurlencodedschemamap1000builder) | setDouble(float value) | -| [ApplicationxwwwformurlencodedSchemaMap1000Builder](#applicationxwwwformurlencodedschemamap1000builder) | setDouble(long value) | -| [ApplicationxwwwformurlencodedSchemaMap1000Builder](#applicationxwwwformurlencodedschemamap1000builder) | setDouble(double value) | - -## ApplicationxwwwformurlencodedSchemaMap1101Builder -public class ApplicationxwwwformurlencodedSchemaMap1101Builder
-builder for `Map` - -A class that builds the Map input type - -### Constructor Summary -| Constructor and Description | -| --------------------------- | -| ApplicationxwwwformurlencodedSchemaMap1101Builder(Map instance)
Creates a builder that contains the passed instance | - -### Method Summary -| Modifier and Type | Method and Description | -| ----------------- | ---------------------- | -| [ApplicationxwwwformurlencodedSchemaMap0101Builder](#applicationxwwwformurlencodedschemamap0101builder) | setByte(String value) | -| [ApplicationxwwwformurlencodedSchemaMap1001Builder](#applicationxwwwformurlencodedschemamap1001builder) | setDouble(int value) | -| [ApplicationxwwwformurlencodedSchemaMap1001Builder](#applicationxwwwformurlencodedschemamap1001builder) | setDouble(float value) | -| [ApplicationxwwwformurlencodedSchemaMap1001Builder](#applicationxwwwformurlencodedschemamap1001builder) | setDouble(long value) | -| [ApplicationxwwwformurlencodedSchemaMap1001Builder](#applicationxwwwformurlencodedschemamap1001builder) | setDouble(double value) | -| [ApplicationxwwwformurlencodedSchemaMap1100Builder](#applicationxwwwformurlencodedschemamap1100builder) | pattern_without_delimiter(String value) | - -## ApplicationxwwwformurlencodedSchemaMap1110Builder -public class ApplicationxwwwformurlencodedSchemaMap1110Builder
-builder for `Map` - -A class that builds the Map input type - -### Constructor Summary -| Constructor and Description | -| --------------------------- | -| ApplicationxwwwformurlencodedSchemaMap1110Builder(Map instance)
Creates a builder that contains the passed instance | - -### Method Summary -| Modifier and Type | Method and Description | -| ----------------- | ---------------------- | -| [ApplicationxwwwformurlencodedSchemaMap0110Builder](#applicationxwwwformurlencodedschemamap0110builder) | setByte(String value) | -| [ApplicationxwwwformurlencodedSchemaMap1010Builder](#applicationxwwwformurlencodedschemamap1010builder) | setDouble(int value) | -| [ApplicationxwwwformurlencodedSchemaMap1010Builder](#applicationxwwwformurlencodedschemamap1010builder) | setDouble(float value) | -| [ApplicationxwwwformurlencodedSchemaMap1010Builder](#applicationxwwwformurlencodedschemamap1010builder) | setDouble(long value) | -| [ApplicationxwwwformurlencodedSchemaMap1010Builder](#applicationxwwwformurlencodedschemamap1010builder) | setDouble(double value) | -| [ApplicationxwwwformurlencodedSchemaMap1100Builder](#applicationxwwwformurlencodedschemamap1100builder) | setNumber(int value) | -| [ApplicationxwwwformurlencodedSchemaMap1100Builder](#applicationxwwwformurlencodedschemamap1100builder) | setNumber(float value) | -| [ApplicationxwwwformurlencodedSchemaMap1100Builder](#applicationxwwwformurlencodedschemamap1100builder) | setNumber(long value) | -| [ApplicationxwwwformurlencodedSchemaMap1100Builder](#applicationxwwwformurlencodedschemamap1100builder) | setNumber(double value) | - -## ApplicationxwwwformurlencodedSchemaMapBuilder -public class ApplicationxwwwformurlencodedSchemaMapBuilder
-builder for `Map` - -A class that builds the Map input type - -### Constructor Summary -| Constructor and Description | -| --------------------------- | -| ApplicationxwwwformurlencodedSchemaMapBuilder()
Creates a builder that contains an empty map | - -### Method Summary -| Modifier and Type | Method and Description | -| ----------------- | ---------------------- | -| [ApplicationxwwwformurlencodedSchemaMap0111Builder](#applicationxwwwformurlencodedschemamap0111builder) | setByte(String value) | -| [ApplicationxwwwformurlencodedSchemaMap1011Builder](#applicationxwwwformurlencodedschemamap1011builder) | setDouble(int value) | -| [ApplicationxwwwformurlencodedSchemaMap1011Builder](#applicationxwwwformurlencodedschemamap1011builder) | setDouble(float value) | -| [ApplicationxwwwformurlencodedSchemaMap1011Builder](#applicationxwwwformurlencodedschemamap1011builder) | setDouble(long value) | -| [ApplicationxwwwformurlencodedSchemaMap1011Builder](#applicationxwwwformurlencodedschemamap1011builder) | setDouble(double value) | -| [ApplicationxwwwformurlencodedSchemaMap1101Builder](#applicationxwwwformurlencodedschemamap1101builder) | setNumber(int value) | -| [ApplicationxwwwformurlencodedSchemaMap1101Builder](#applicationxwwwformurlencodedschemamap1101builder) | setNumber(float value) | -| [ApplicationxwwwformurlencodedSchemaMap1101Builder](#applicationxwwwformurlencodedschemamap1101builder) | setNumber(long value) | -| [ApplicationxwwwformurlencodedSchemaMap1101Builder](#applicationxwwwformurlencodedschemamap1101builder) | setNumber(double value) | -| [ApplicationxwwwformurlencodedSchemaMap1110Builder](#applicationxwwwformurlencodedschemamap1110builder) | pattern_without_delimiter(String value) | - -## ApplicationxwwwformurlencodedSchemaMap -public static class ApplicationxwwwformurlencodedSchemaMap
-extends FrozenMap - -A class to store validated Map payloads - -### Method Summary -| Modifier and Type | Method and Description | -| ----------------- | ---------------------- | -| static [ApplicationxwwwformurlencodedSchemaMap](#applicationxwwwformurlencodedschemamap) | of([Map](#applicationxwwwformurlencodedschemamapbuilder) arg, SchemaConfiguration configuration) | -| String | pattern_without_delimiter()
| -| Number | int32()
[optional] value must be a 32 bit integer | -| Number | int64()
[optional] value must be a 64 bit integer | -| String | binary()
[optional] | -| String | date()
[optional] value must conform to RFC-3339 full-date YYYY-MM-DD | -| String | dateTime()
[optional] if omitted the server will use the default value of 2010-02-01T10:20:10.111110+01:00 value must conform to RFC-3339 date-time | -| String | password()
[optional] | -| String | callback()
[optional] | -| @Nullable Object | get(String key)
This schema has invalid Java names so this method must be used when you access instance["byte"], instance["double"], instance["number"], instance["integer"], instance["float"], instance["string"], | -| @Nullable Object | getAdditionalProperty(String name)
provides type safety for additional properties | - -## ApplicationxwwwformurlencodedCallbackBoxed -public sealed interface ApplicationxwwwformurlencodedCallbackBoxed
-permits
-[ApplicationxwwwformurlencodedCallbackBoxedString](#applicationxwwwformurlencodedcallbackboxedstring) - -sealed interface that stores validated payloads using boxed classes - -## ApplicationxwwwformurlencodedCallbackBoxedString -public record ApplicationxwwwformurlencodedCallbackBoxedString
-implements [ApplicationxwwwformurlencodedCallbackBoxed](#applicationxwwwformurlencodedcallbackboxed) - -record that stores validated String payloads, sealed permits implementation - -### Constructor Summary -| Constructor and Description | -| --------------------------- | -| ApplicationxwwwformurlencodedCallbackBoxedString(String data)
Creates an instance, private visibility | - -### Method Summary -| Modifier and Type | Method and Description | -| ----------------- | ---------------------- | -| String | data()
validated payload | -| @Nullable Object | getData()
validated payload | - -## ApplicationxwwwformurlencodedCallback -public static class ApplicationxwwwformurlencodedCallback
-extends StringJsonSchema.StringJsonSchema1 - -A schema class that validates payloads - -## Description -None - -| Methods Inherited from class org.openapijsonschematools.client.schemas.StringJsonSchema.StringJsonSchema1 | -| ------------------------------------------------------------------ | -| validate | -| validateAndBox | - -## ApplicationxwwwformurlencodedPasswordBoxed -public sealed interface ApplicationxwwwformurlencodedPasswordBoxed
-permits
-[ApplicationxwwwformurlencodedPasswordBoxedString](#applicationxwwwformurlencodedpasswordboxedstring) - -sealed interface that stores validated payloads using boxed classes - -## ApplicationxwwwformurlencodedPasswordBoxedString -public record ApplicationxwwwformurlencodedPasswordBoxedString
-implements [ApplicationxwwwformurlencodedPasswordBoxed](#applicationxwwwformurlencodedpasswordboxed) - -record that stores validated String payloads, sealed permits implementation - -### Constructor Summary -| Constructor and Description | -| --------------------------- | -| ApplicationxwwwformurlencodedPasswordBoxedString(String data)
Creates an instance, private visibility | - -### Method Summary -| Modifier and Type | Method and Description | -| ----------------- | ---------------------- | -| String | data()
validated payload | -| @Nullable Object | getData()
validated payload | - -## ApplicationxwwwformurlencodedPassword -public static class ApplicationxwwwformurlencodedPassword
-extends JsonSchema - -A schema class that validates payloads - -## Description -None - -### 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.fake.post.requestbody.content.applicationxwwwformurlencoded.ApplicationxwwwformurlencodedSchema; - -import java.util.Arrays; -import java.util.List; -import java.util.AbstractMap; - -static final SchemaConfiguration configuration = new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().build()); - -// String validation -String validatedPayload = ApplicationxwwwformurlencodedSchema.ApplicationxwwwformurlencodedPassword.validate( - "a", - configuration -); -``` - -### Field Summary -| Modifier and Type | Field and Description | -| ----------------- | ---------------------- | -| Set> | type = Set.of(
    String.class
)
| -| String | type = "password"; | -| Integer | maxLength = 64 | -| Integer | minLength = 10 | - -### Method Summary -| Modifier and Type | Method and Description | -| ----------------- | ---------------------- | -| String | validate(String arg, SchemaConfiguration configuration) | -| [ApplicationxwwwformurlencodedPasswordBoxedString](#applicationxwwwformurlencodedpasswordboxedstring) | validateAndBox(String arg, SchemaConfiguration configuration) | -| [ApplicationxwwwformurlencodedPasswordBoxed](#applicationxwwwformurlencodedpasswordboxed) | validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) | -| @Nullable Object | validate(@Nullable Object arg, SchemaConfiguration configuration) | - -## ApplicationxwwwformurlencodedDateTimeBoxed -public sealed interface ApplicationxwwwformurlencodedDateTimeBoxed
-permits
-[ApplicationxwwwformurlencodedDateTimeBoxedString](#applicationxwwwformurlencodeddatetimeboxedstring) - -sealed interface that stores validated payloads using boxed classes - -## ApplicationxwwwformurlencodedDateTimeBoxedString -public record ApplicationxwwwformurlencodedDateTimeBoxedString
-implements [ApplicationxwwwformurlencodedDateTimeBoxed](#applicationxwwwformurlencodeddatetimeboxed) - -record that stores validated String payloads, sealed permits implementation - -### Constructor Summary -| Constructor and Description | -| --------------------------- | -| ApplicationxwwwformurlencodedDateTimeBoxedString(String data)
Creates an instance, private visibility | - -### Method Summary -| Modifier and Type | Method and Description | -| ----------------- | ---------------------- | -| String | data()
validated payload | -| @Nullable Object | getData()
validated payload | - -## ApplicationxwwwformurlencodedDateTime -public static class ApplicationxwwwformurlencodedDateTime
-extends JsonSchema - -A schema class that validates payloads - -## Description -None - -### 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.fake.post.requestbody.content.applicationxwwwformurlencoded.ApplicationxwwwformurlencodedSchema; - -import java.util.Arrays; -import java.util.List; -import java.util.AbstractMap; - -static final SchemaConfiguration configuration = new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().build()); - -// String validation -String validatedPayload = ApplicationxwwwformurlencodedSchema.ApplicationxwwwformurlencodedDateTime.validate( - "1970-01-01T00:00:00.00Z", - configuration -); -``` - -### Field Summary -| Modifier and Type | Field and Description | -| ----------------- | ---------------------- | -| Set> | type = Set.of(
    String.class
)
| -| String | type = "date-time"; | -| @Nullable Object | defaultValue = "2010-02-01T10:20:10.111110+01:00" | - -### Method Summary -| Modifier and Type | Method and Description | -| ----------------- | ---------------------- | -| String | validate(String arg, SchemaConfiguration configuration) | -| [ApplicationxwwwformurlencodedDateTimeBoxedString](#applicationxwwwformurlencodeddatetimeboxedstring) | validateAndBox(String arg, SchemaConfiguration configuration) | -| [ApplicationxwwwformurlencodedDateTimeBoxed](#applicationxwwwformurlencodeddatetimeboxed) | validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) | -| @Nullable Object | validate(@Nullable Object arg, SchemaConfiguration configuration) | - -## ApplicationxwwwformurlencodedDateBoxed -public sealed interface ApplicationxwwwformurlencodedDateBoxed
-permits
-[ApplicationxwwwformurlencodedDateBoxedString](#applicationxwwwformurlencodeddateboxedstring) - -sealed interface that stores validated payloads using boxed classes - -## ApplicationxwwwformurlencodedDateBoxedString -public record ApplicationxwwwformurlencodedDateBoxedString
-implements [ApplicationxwwwformurlencodedDateBoxed](#applicationxwwwformurlencodeddateboxed) - -record that stores validated String payloads, sealed permits implementation - -### Constructor Summary -| Constructor and Description | -| --------------------------- | -| ApplicationxwwwformurlencodedDateBoxedString(String data)
Creates an instance, private visibility | - -### Method Summary -| Modifier and Type | Method and Description | -| ----------------- | ---------------------- | -| String | data()
validated payload | -| @Nullable Object | getData()
validated payload | - -## ApplicationxwwwformurlencodedDate -public static class ApplicationxwwwformurlencodedDate
-extends DateJsonSchema.DateJsonSchema1 - -A schema class that validates payloads - -## Description -None - -| Methods Inherited from class org.openapijsonschematools.client.schemas.DateJsonSchema.DateJsonSchema1 | -| ------------------------------------------------------------------ | -| validate | -| validateAndBox | - -## ApplicationxwwwformurlencodedBinaryBoxed -public sealed interface ApplicationxwwwformurlencodedBinaryBoxed
-permits
- -sealed interface that stores validated payloads using boxed classes - -## ApplicationxwwwformurlencodedBinary -public static class ApplicationxwwwformurlencodedBinary
-extends JsonSchema - -A schema class that validates payloads - -## Description -None - -## ApplicationxwwwformurlencodedByteBoxed -public sealed interface ApplicationxwwwformurlencodedByteBoxed
-permits
-[ApplicationxwwwformurlencodedByteBoxedString](#applicationxwwwformurlencodedbyteboxedstring) - -sealed interface that stores validated payloads using boxed classes - -## ApplicationxwwwformurlencodedByteBoxedString -public record ApplicationxwwwformurlencodedByteBoxedString
-implements [ApplicationxwwwformurlencodedByteBoxed](#applicationxwwwformurlencodedbyteboxed) - -record that stores validated String payloads, sealed permits implementation - -### Constructor Summary -| Constructor and Description | -| --------------------------- | -| ApplicationxwwwformurlencodedByteBoxedString(String data)
Creates an instance, private visibility | - -### Method Summary -| Modifier and Type | Method and Description | -| ----------------- | ---------------------- | -| String | data()
validated payload | -| @Nullable Object | getData()
validated payload | - -## ApplicationxwwwformurlencodedByte -public static class ApplicationxwwwformurlencodedByte
-extends StringJsonSchema.StringJsonSchema1 - -A schema class that validates payloads - -## Description -None - -## ApplicationxwwwformurlencodedPatternWithoutDelimiterBoxed -public sealed interface ApplicationxwwwformurlencodedPatternWithoutDelimiterBoxed
-permits
-[ApplicationxwwwformurlencodedPatternWithoutDelimiterBoxedString](#applicationxwwwformurlencodedpatternwithoutdelimiterboxedstring) - -sealed interface that stores validated payloads using boxed classes - -## ApplicationxwwwformurlencodedPatternWithoutDelimiterBoxedString -public record ApplicationxwwwformurlencodedPatternWithoutDelimiterBoxedString
-implements [ApplicationxwwwformurlencodedPatternWithoutDelimiterBoxed](#applicationxwwwformurlencodedpatternwithoutdelimiterboxed) - -record that stores validated String payloads, sealed permits implementation - -### Constructor Summary -| Constructor and Description | -| --------------------------- | -| ApplicationxwwwformurlencodedPatternWithoutDelimiterBoxedString(String data)
Creates an instance, private visibility | - -### Method Summary -| Modifier and Type | Method and Description | -| ----------------- | ---------------------- | -| String | data()
validated payload | -| @Nullable Object | getData()
validated payload | - -## ApplicationxwwwformurlencodedPatternWithoutDelimiter -public static class ApplicationxwwwformurlencodedPatternWithoutDelimiter
-extends JsonSchema - -A schema class that validates payloads - -## Description -None - -### 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.fake.post.requestbody.content.applicationxwwwformurlencoded.ApplicationxwwwformurlencodedSchema; - -import java.util.Arrays; -import java.util.List; -import java.util.AbstractMap; - -static final SchemaConfiguration configuration = new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().build()); - -// String validation -String validatedPayload = ApplicationxwwwformurlencodedSchema.ApplicationxwwwformurlencodedPatternWithoutDelimiter.validate( - "AUR,rZ#UM/?R,Fp^l6$ARjbhJk C>", - configuration -); -``` - -### Field Summary -| Modifier and Type | Field and Description | -| ----------------- | ---------------------- | -| Set> | type = Set.of(
    String.class
)
| -| Pattern | pattern = Pattern.compile(
    "^[A-Z].*"
)
| - -### Method Summary -| Modifier and Type | Method and Description | -| ----------------- | ---------------------- | -| String | validate(String arg, SchemaConfiguration configuration) | -| [ApplicationxwwwformurlencodedPatternWithoutDelimiterBoxedString](#applicationxwwwformurlencodedpatternwithoutdelimiterboxedstring) | validateAndBox(String arg, SchemaConfiguration configuration) | -| [ApplicationxwwwformurlencodedPatternWithoutDelimiterBoxed](#applicationxwwwformurlencodedpatternwithoutdelimiterboxed) | validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) | -| @Nullable Object | validate(@Nullable Object arg, SchemaConfiguration configuration) | - -## ApplicationxwwwformurlencodedStringBoxed -public sealed interface ApplicationxwwwformurlencodedStringBoxed
-permits
-[ApplicationxwwwformurlencodedStringBoxedString](#applicationxwwwformurlencodedstringboxedstring) - -sealed interface that stores validated payloads using boxed classes - -## ApplicationxwwwformurlencodedStringBoxedString -public record ApplicationxwwwformurlencodedStringBoxedString
-implements [ApplicationxwwwformurlencodedStringBoxed](#applicationxwwwformurlencodedstringboxed) - -record that stores validated String payloads, sealed permits implementation - -### Constructor Summary -| Constructor and Description | -| --------------------------- | -| ApplicationxwwwformurlencodedStringBoxedString(String data)
Creates an instance, private visibility | - -### Method Summary -| Modifier and Type | Method and Description | -| ----------------- | ---------------------- | -| String | data()
validated payload | -| @Nullable Object | getData()
validated payload | - -## ApplicationxwwwformurlencodedString -public static class ApplicationxwwwformurlencodedString
-extends JsonSchema - -A schema class that validates payloads - -## Description -None - -### 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.fake.post.requestbody.content.applicationxwwwformurlencoded.ApplicationxwwwformurlencodedSchema; - -import java.util.Arrays; -import java.util.List; -import java.util.AbstractMap; - -static final SchemaConfiguration configuration = new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().build()); - -// String validation -String validatedPayload = ApplicationxwwwformurlencodedSchema.ApplicationxwwwformurlencodedString.validate( - "A", - configuration -); -``` - -### Field Summary -| Modifier and Type | Field and Description | -| ----------------- | ---------------------- | -| Set> | type = Set.of(
    String.class
)
| -| Pattern | pattern = Pattern.compile(
    "[a-z]",
    Pattern.CASE_INSENSITIVE
)
| - -### Method Summary -| Modifier and Type | Method and Description | -| ----------------- | ---------------------- | -| String | validate(String arg, SchemaConfiguration configuration) | -| [ApplicationxwwwformurlencodedStringBoxedString](#applicationxwwwformurlencodedstringboxedstring) | validateAndBox(String arg, SchemaConfiguration configuration) | -| [ApplicationxwwwformurlencodedStringBoxed](#applicationxwwwformurlencodedstringboxed) | validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) | -| @Nullable Object | validate(@Nullable Object arg, SchemaConfiguration configuration) | - -## ApplicationxwwwformurlencodedDoubleBoxed -public sealed interface ApplicationxwwwformurlencodedDoubleBoxed
-permits
-[ApplicationxwwwformurlencodedDoubleBoxedNumber](#applicationxwwwformurlencodeddoubleboxednumber) - -sealed interface that stores validated payloads using boxed classes - -## ApplicationxwwwformurlencodedDoubleBoxedNumber -public record ApplicationxwwwformurlencodedDoubleBoxedNumber
-implements [ApplicationxwwwformurlencodedDoubleBoxed](#applicationxwwwformurlencodeddoubleboxed) - -record that stores validated Number payloads, sealed permits implementation - -### Constructor Summary -| Constructor and Description | -| --------------------------- | -| ApplicationxwwwformurlencodedDoubleBoxedNumber(Number data)
Creates an instance, private visibility | - -### Method Summary -| Modifier and Type | Method and Description | -| ----------------- | ---------------------- | -| Number | data()
validated payload | -| @Nullable Object | getData()
validated payload | - -## ApplicationxwwwformurlencodedDouble -public static class ApplicationxwwwformurlencodedDouble
-extends JsonSchema - -A schema class that validates payloads - -## Description -None - -### 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.fake.post.requestbody.content.applicationxwwwformurlencoded.ApplicationxwwwformurlencodedSchema; - -import java.util.Arrays; -import java.util.List; -import java.util.AbstractMap; - -static final SchemaConfiguration configuration = new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().build()); - -// double validation -double validatedPayload = ApplicationxwwwformurlencodedSchema.ApplicationxwwwformurlencodedDouble.validate( - 3.14d, - configuration -); -``` - -### Field Summary -| Modifier and Type | Field and Description | -| ----------------- | ---------------------- | -| Set> | type = Set.of(
    Integer.class,
    Long.class,
    Float.class,
    Double.class
)
| -| String | type = "double"; | -| Number | maximum = 123.4 | -| Number | minimum = 67.8 | - -### Method Summary -| Modifier and Type | Method and Description | -| ----------------- | ---------------------- | -| double | validate(double arg, SchemaConfiguration configuration) | -| [ApplicationxwwwformurlencodedDoubleBoxedNumber](#applicationxwwwformurlencodeddoubleboxednumber) | validateAndBox(Number arg, SchemaConfiguration configuration) | -| [ApplicationxwwwformurlencodedDoubleBoxed](#applicationxwwwformurlencodeddoubleboxed) | validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) | -| @Nullable Object | validate(@Nullable Object arg, SchemaConfiguration configuration) | - -## ApplicationxwwwformurlencodedFloatBoxed -public sealed interface ApplicationxwwwformurlencodedFloatBoxed
-permits
-[ApplicationxwwwformurlencodedFloatBoxedNumber](#applicationxwwwformurlencodedfloatboxednumber) - -sealed interface that stores validated payloads using boxed classes - -## ApplicationxwwwformurlencodedFloatBoxedNumber -public record ApplicationxwwwformurlencodedFloatBoxedNumber
-implements [ApplicationxwwwformurlencodedFloatBoxed](#applicationxwwwformurlencodedfloatboxed) - -record that stores validated Number payloads, sealed permits implementation - -### Constructor Summary -| Constructor and Description | -| --------------------------- | -| ApplicationxwwwformurlencodedFloatBoxedNumber(Number data)
Creates an instance, private visibility | - -### Method Summary -| Modifier and Type | Method and Description | -| ----------------- | ---------------------- | -| Number | data()
validated payload | -| @Nullable Object | getData()
validated payload | - -## ApplicationxwwwformurlencodedFloat -public static class ApplicationxwwwformurlencodedFloat
-extends JsonSchema - -A schema class that validates payloads - -## Description -None - -### 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.fake.post.requestbody.content.applicationxwwwformurlencoded.ApplicationxwwwformurlencodedSchema; - -import java.util.Arrays; -import java.util.List; -import java.util.AbstractMap; - -static final SchemaConfiguration configuration = new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().build()); - -// float validation -float validatedPayload = ApplicationxwwwformurlencodedSchema.ApplicationxwwwformurlencodedFloat.validate( - 3.14f, - configuration -); -``` - -### Field Summary -| Modifier and Type | Field and Description | -| ----------------- | ---------------------- | -| Set> | type = Set.of(
    Integer.class,
    Long.class,
    Float.class,
    Double.class
)
| -| String | type = "float"; | -| Number | maximum = 987.6 | - -### Method Summary -| Modifier and Type | Method and Description | -| ----------------- | ---------------------- | -| float | validate(float arg, SchemaConfiguration configuration) | -| [ApplicationxwwwformurlencodedFloatBoxedNumber](#applicationxwwwformurlencodedfloatboxednumber) | validateAndBox(Number arg, SchemaConfiguration configuration) | -| [ApplicationxwwwformurlencodedFloatBoxed](#applicationxwwwformurlencodedfloatboxed) | validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) | -| @Nullable Object | validate(@Nullable Object arg, SchemaConfiguration configuration) | - -## ApplicationxwwwformurlencodedNumberBoxed -public sealed interface ApplicationxwwwformurlencodedNumberBoxed
-permits
-[ApplicationxwwwformurlencodedNumberBoxedNumber](#applicationxwwwformurlencodednumberboxednumber) - -sealed interface that stores validated payloads using boxed classes - -## ApplicationxwwwformurlencodedNumberBoxedNumber -public record ApplicationxwwwformurlencodedNumberBoxedNumber
-implements [ApplicationxwwwformurlencodedNumberBoxed](#applicationxwwwformurlencodednumberboxed) - -record that stores validated Number payloads, sealed permits implementation - -### Constructor Summary -| Constructor and Description | -| --------------------------- | -| ApplicationxwwwformurlencodedNumberBoxedNumber(Number data)
Creates an instance, private visibility | - -### Method Summary -| Modifier and Type | Method and Description | -| ----------------- | ---------------------- | -| Number | data()
validated payload | -| @Nullable Object | getData()
validated payload | - -## ApplicationxwwwformurlencodedNumber -public static class ApplicationxwwwformurlencodedNumber
-extends JsonSchema - -A schema class that validates payloads - -## Description -None - -### 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.fake.post.requestbody.content.applicationxwwwformurlencoded.ApplicationxwwwformurlencodedSchema; - -import java.util.Arrays; -import java.util.List; -import java.util.AbstractMap; - -static final SchemaConfiguration configuration = new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().build()); - -// int validation -int validatedPayload = ApplicationxwwwformurlencodedSchema.ApplicationxwwwformurlencodedNumber.validate( - 1, - configuration -); -``` - -### Field Summary -| Modifier and Type | Field and Description | -| ----------------- | ---------------------- | -| Set> | type = Set.of(
    Integer.class,
    Long.class,
    Float.class,
    Double.class
)
| -| Number | maximum = 543.2 | -| Number | minimum = 32.1 | - -### Method Summary -| Modifier and Type | Method and Description | -| ----------------- | ---------------------- | -| Number | validate(Number arg, SchemaConfiguration configuration) | -| [ApplicationxwwwformurlencodedNumberBoxedNumber](#applicationxwwwformurlencodednumberboxednumber) | validateAndBox(Number arg, SchemaConfiguration configuration) | -| [ApplicationxwwwformurlencodedNumberBoxed](#applicationxwwwformurlencodednumberboxed) | validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) | -| @Nullable Object | validate(@Nullable Object arg, SchemaConfiguration configuration) | - -## ApplicationxwwwformurlencodedInt64Boxed -public sealed interface ApplicationxwwwformurlencodedInt64Boxed
-permits
-[ApplicationxwwwformurlencodedInt64BoxedNumber](#applicationxwwwformurlencodedint64boxednumber) - -sealed interface that stores validated payloads using boxed classes - -## ApplicationxwwwformurlencodedInt64BoxedNumber -public record ApplicationxwwwformurlencodedInt64BoxedNumber
-implements [ApplicationxwwwformurlencodedInt64Boxed](#applicationxwwwformurlencodedint64boxed) - -record that stores validated Number payloads, sealed permits implementation - -### Constructor Summary -| Constructor and Description | -| --------------------------- | -| ApplicationxwwwformurlencodedInt64BoxedNumber(Number data)
Creates an instance, private visibility | - -### Method Summary -| Modifier and Type | Method and Description | -| ----------------- | ---------------------- | -| Number | data()
validated payload | -| @Nullable Object | getData()
validated payload | - -## ApplicationxwwwformurlencodedInt64 -public static class ApplicationxwwwformurlencodedInt64
-extends Int64JsonSchema.Int64JsonSchema1 - -A schema class that validates payloads - -## Description -None - -| Methods Inherited from class org.openapijsonschematools.client.schemas.Int64JsonSchema.Int64JsonSchema1 | -| ------------------------------------------------------------------ | -| validate | -| validateAndBox | - -## ApplicationxwwwformurlencodedInt32Boxed -public sealed interface ApplicationxwwwformurlencodedInt32Boxed
-permits
-[ApplicationxwwwformurlencodedInt32BoxedNumber](#applicationxwwwformurlencodedint32boxednumber) - -sealed interface that stores validated payloads using boxed classes - -## ApplicationxwwwformurlencodedInt32BoxedNumber -public record ApplicationxwwwformurlencodedInt32BoxedNumber
-implements [ApplicationxwwwformurlencodedInt32Boxed](#applicationxwwwformurlencodedint32boxed) - -record that stores validated Number payloads, sealed permits implementation - -### Constructor Summary -| Constructor and Description | -| --------------------------- | -| ApplicationxwwwformurlencodedInt32BoxedNumber(Number data)
Creates an instance, private visibility | - -### Method Summary -| Modifier and Type | Method and Description | -| ----------------- | ---------------------- | -| Number | data()
validated payload | -| @Nullable Object | getData()
validated payload | - -## ApplicationxwwwformurlencodedInt32 -public static class ApplicationxwwwformurlencodedInt32
-extends JsonSchema - -A schema class that validates payloads - -## Description -None - -### 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.fake.post.requestbody.content.applicationxwwwformurlencoded.ApplicationxwwwformurlencodedSchema; - -import java.util.Arrays; -import java.util.List; -import java.util.AbstractMap; - -static final SchemaConfiguration configuration = new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().build()); - -// int validation -int validatedPayload = ApplicationxwwwformurlencodedSchema.ApplicationxwwwformurlencodedInt32.validate( - 1, - configuration -); -``` - -### Field Summary -| Modifier and Type | Field and Description | -| ----------------- | ---------------------- | -| Set> | type = Set.of(
    Integer.class,
    Long.class,
    Float.class,
    Double.class
)
| -| String | type = "int32"; | -| Number | maximum = 200 | -| Number | minimum = 20 | - -### Method Summary -| Modifier and Type | Method and Description | -| ----------------- | ---------------------- | -| int | validate(int arg, SchemaConfiguration configuration) | -| [ApplicationxwwwformurlencodedInt32BoxedNumber](#applicationxwwwformurlencodedint32boxednumber) | validateAndBox(Number arg, SchemaConfiguration configuration) | -| [ApplicationxwwwformurlencodedInt32Boxed](#applicationxwwwformurlencodedint32boxed) | validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) | -| @Nullable Object | validate(@Nullable Object arg, SchemaConfiguration configuration) | - -## ApplicationxwwwformurlencodedIntegerBoxed -public sealed interface ApplicationxwwwformurlencodedIntegerBoxed
-permits
-[ApplicationxwwwformurlencodedIntegerBoxedNumber](#applicationxwwwformurlencodedintegerboxednumber) - -sealed interface that stores validated payloads using boxed classes - -## ApplicationxwwwformurlencodedIntegerBoxedNumber -public record ApplicationxwwwformurlencodedIntegerBoxedNumber
-implements [ApplicationxwwwformurlencodedIntegerBoxed](#applicationxwwwformurlencodedintegerboxed) - -record that stores validated Number payloads, sealed permits implementation - -### Constructor Summary -| Constructor and Description | -| --------------------------- | -| ApplicationxwwwformurlencodedIntegerBoxedNumber(Number data)
Creates an instance, private visibility | - -### Method Summary -| Modifier and Type | Method and Description | -| ----------------- | ---------------------- | -| Number | data()
validated payload | -| @Nullable Object | getData()
validated payload | - -## ApplicationxwwwformurlencodedInteger -public static class ApplicationxwwwformurlencodedInteger
-extends JsonSchema - -A schema class that validates payloads - -## Description -None - -### 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.fake.post.requestbody.content.applicationxwwwformurlencoded.ApplicationxwwwformurlencodedSchema; - -import java.util.Arrays; -import java.util.List; -import java.util.AbstractMap; - -static final SchemaConfiguration configuration = new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().build()); - -// int validation -int validatedPayload = ApplicationxwwwformurlencodedSchema.ApplicationxwwwformurlencodedInteger.validate( - 1L, - configuration -); -``` - -### Field Summary -| Modifier and Type | Field and Description | -| ----------------- | ---------------------- | -| Set> | type = Set.of(
    Integer.class,
    Long.class,
    Float.class,
    Double.class
)
| -| String | type = "int"; | -| Number | maximum = 100 | -| Number | minimum = 10 | - -### Method Summary -| Modifier and Type | Method and Description | -| ----------------- | ---------------------- | -| long | validate(long arg, SchemaConfiguration configuration) | -| [ApplicationxwwwformurlencodedIntegerBoxedNumber](#applicationxwwwformurlencodedintegerboxednumber) | validateAndBox(Number arg, SchemaConfiguration configuration) | -| [ApplicationxwwwformurlencodedIntegerBoxed](#applicationxwwwformurlencodedintegerboxed) | validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) | -| @Nullable Object | validate(@Nullable Object arg, SchemaConfiguration configuration) | diff --git a/samples/client/petstore/kotlin/docs/paths/fake/post/responses/FakePostCode200Response.md b/samples/client/petstore/kotlin/docs/paths/fake/post/responses/FakePostCode200Response.md deleted file mode 100644 index 3e3ca088f80..00000000000 --- a/samples/client/petstore/kotlin/docs/paths/fake/post/responses/FakePostCode200Response.md +++ /dev/null @@ -1,17 +0,0 @@ -# FakePostCode200Response - -public class FakePostCode200Response extends [SuccessDescriptionOnly](../../components/responses/SuccessDescriptionOnly.md) - -A class (extended from the $ref class) that contains necessary nested response classes -- a class that extends ResponseDeserializer and is used to deserialize responses - -## Nested Class Summary -| Modifier and Type | Class and Description | -| ----------------- | --------------------- | -| static class | [FakePostCode200Response.FakePostCode200Response1](#fakepostcode200response1)
class that deserializes responses | - -## FakePostCode200Response1 -public static class FakePostCode200Response1 extends [SuccessDescriptionOnly1](../../components/responses/SuccessDescriptionOnly.md#successdescriptiononly1)
- -a class that deserializes responses, extended from the $ref class - diff --git a/samples/client/petstore/kotlin/docs/paths/fake/post/responses/FakePostCode404Response.md b/samples/client/petstore/kotlin/docs/paths/fake/post/responses/FakePostCode404Response.md deleted file mode 100644 index 7386c472c52..00000000000 --- a/samples/client/petstore/kotlin/docs/paths/fake/post/responses/FakePostCode404Response.md +++ /dev/null @@ -1,32 +0,0 @@ -# FakePostCode404Response - -public class FakePostCode404Response - -A class that contains necessary nested response classes -- a class that extends ResponseDeserializer and is used to deserialize responses - -## Nested Class Summary -| Modifier and Type | Class and Description | -| ----------------- | --------------------- | -| static class | [FakePostCode404Response.FakePostCode404Response1](#fakepostcode404response1)
class that deserializes responses | - -## FakePostCode404Response1 -public static class FakePostCode404Response1
-extends ResponseDeserializer - -a class that deserializes responses - -### Constructor Summary -| Constructor and Description | -| --------------------------- | -| FakePostCode404Response1()
Creates an instance | - -### Field Summary -| Modifier and Type | Field and Description | -| ----------------- | --------------------- | -| Map | content = MapUtils.makeMap(
)
the contentType to schema info | - -### Method Summary -| Modifier and Type | Method and Description | -| ----------------- | ---------------------- | -| ApiResponse | deserialize(HttpResponse response, SchemaConfiguration configuration)
called by endpoint when deserialize responses | diff --git a/samples/client/petstore/kotlin/docs/paths/fake/post/security/FakePostSecurityRequirementObject0.md b/samples/client/petstore/kotlin/docs/paths/fake/post/security/FakePostSecurityRequirementObject0.md deleted file mode 100644 index db0df44256c..00000000000 --- a/samples/client/petstore/kotlin/docs/paths/fake/post/security/FakePostSecurityRequirementObject0.md +++ /dev/null @@ -1,15 +0,0 @@ -# FakePostSecurityRequirementObject0 -FakePostSecurityRequirementObject0.java - -public class FakePostSecurityRequirementObject0 -extends SecurityRequirementObject - -### Constructor Summary -| Constructor and Description | -| --------------------------- | -| FakePostSecurityRequirementObject0()
Creates an instance | - -### 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()
    )) | diff --git a/samples/client/petstore/kotlin/docs/paths/fakeadditionalpropertieswitharrayofenums/FakeadditionalpropertieswitharrayofenumsGet.md b/samples/client/petstore/kotlin/docs/paths/fakeadditionalpropertieswitharrayofenums/FakeadditionalpropertieswitharrayofenumsGet.md deleted file mode 100644 index a1315d492bd..00000000000 --- a/samples/client/petstore/kotlin/docs/paths/fakeadditionalpropertieswitharrayofenums/FakeadditionalpropertieswitharrayofenumsGet.md +++ /dev/null @@ -1,148 +0,0 @@ -# FakeadditionalpropertieswitharrayofenumsGet - -public class FakeadditionalpropertieswitharrayofenumsGet - -A class that contains necessary endpoint classes -- a class that calls the endpoint method using the http verb -- a class that calls the endpoint method using the operationId name -- class(es) to store the request inputs -- builder(s) to set the request input data - -## Nested Class Summary -| Modifier and Type | Class and Description | -| ----------------- | --------------------- | -| static class | [Get](#get)
The class that has a get method to call the endpoint | -| interface | [AdditionalPropertiesWithArrayOfEnumsOperation](#additionalpropertieswitharrayofenumsoperation)
The interface that has a additionalPropertiesWithArrayOfEnums method to call the endpoint | -| static class | [GetRequest](#getrequest)
The request inputs class | -| static class | [GetRequestBuilder](#getrequestbuilder)
A builder for the request input class | - -## Get -public static class Get extends ApiClient.ApiClient1 implements GetOperation
- -a class that allows one to call the endpoint using a method named get - -### 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.fakeadditionalpropertieswitharrayofenums.get.FakeadditionalpropertieswitharrayofenumsGetRequestBody; -import org.openapijsonschematools.client.components.schemas.AdditionalPropertiesWithArrayOfEnums; -import org.openapijsonschematools.client.RootServerInfo; -import org.openapijsonschematools.client.servers.RootServer0; -import org.openapijsonschematools.client.servers.RootServer1; -import org.openapijsonschematools.client.servers.RootServer2; -import org.openapijsonschematools.client.paths.fakeadditionalpropertieswitharrayofenums.get.responses.FakeadditionalpropertieswitharrayofenumsGetCode200Response; -import org.openapijsonschematools.client.servers.RootServerInfo; -import org.openapijsonschematools.client.paths.fakeadditionalpropertieswitharrayofenums.FakeadditionalpropertieswitharrayofenumsGet; -import org.openapijsonschematools.client.paths.fakeadditionalpropertieswitharrayofenums.get.FakeadditionalpropertieswitharrayofenumsGetResponses; - -import java.io.IOException; -import java.util.Arrays; -import java.util.List; -import java.util.Map; -import java.util.AbstractMap; - -// if you want to use a server that is not SERVER_0 pass it in here and change the ServerIndex input below -ApiConfiguration.ServerInfo serverInfo = new ApiConfiguration.ServerInfoBuilder() - .rootServerInfo( - new RootServerInfo.RootServerInfoBuilder() - .rootServer0(new RootServer0()) - .build() - ) - .build(); -ApiConfiguration.ServerIndexInfo serverIndexInfo = new ApiConfiguration.ServerIndexInfoBuilder() - .rootServerInfoServerIndex(RootServerInfo.ServerIndex.SERVER_0) - .build(); -Duration timeout = Duration.ofSeconds(1L); -Map> defaultHeaders = Map.of("User-Agent", List.of("OpenAPI-JSON-Schema-Generator/1.0.0/java")); -ApiConfiguration apiConfiguration = new ApiConfiguration( - serverInfo - serverIndexInfo, - timeout, - defaultHeaders -); -SchemaConfiguration schemaConfiguration = new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().build()); -FakeadditionalpropertieswitharrayofenumsGet.Get apiClient = new FakeadditionalpropertieswitharrayofenumsGet.Get(apiConfiguration, schemaConfiguration); - - -var request = new FakeadditionalpropertieswitharrayofenumsGet.GetRequestBuilder().build(); - -FakeadditionalpropertieswitharrayofenumsGetResponses.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; -} -FakeadditionalpropertieswitharrayofenumsGetResponses.EndpointFakeadditionalpropertieswitharrayofenumsGetCode200Response castResponse = (FakeadditionalpropertieswitharrayofenumsGetResponses.EndpointFakeadditionalpropertieswitharrayofenumsGetCode200Response) response; -FakeadditionalpropertieswitharrayofenumsGetCode200Response.ApplicationjsonResponseBody deserializedBody = (FakeadditionalpropertieswitharrayofenumsGetCode200Response.ApplicationjsonResponseBody) castResponse.body; -// handle deserialized body here -``` -### Constructor Summary -| Constructor and Description | -| --------------------------- | -| Get(ApiConfiguration apiConfiguration, SchemaConfiguration schemaConfiguration)
Creates an instance | - -### Method Summary -| Modifier and Type | Method and Description | -| ----------------- | ---------------------- | -| [FakeadditionalpropertieswitharrayofenumsGetResponses.EndpointResponse](../../paths/fakeadditionalpropertieswitharrayofenums/get/FakeadditionalpropertieswitharrayofenumsGetResponses.md#endpointresponse) | get([GetRequest](#getrequest) request) | - -## AdditionalPropertiesWithArrayOfEnumsOperation -public interface AdditionalPropertiesWithArrayOfEnumsOperation
- -an interface that allows one to call the endpoint using a method named additionalPropertiesWithArrayOfEnums by the operationId - -### Method Summary -| Modifier and Type | Method and Description | -| ----------------- | ---------------------- | -| [FakeadditionalpropertieswitharrayofenumsGetResponses.EndpointResponse](../../paths/fakeadditionalpropertieswitharrayofenums/get/FakeadditionalpropertieswitharrayofenumsGetResponses.md#endpointresponse) | additionalPropertiesWithArrayOfEnums([GetRequest](#getrequest) request) | - -## GetRequest -public static class GetRequest
- -a class that stores the final request inputs - -### Field Summary -| Modifier and Type | Field and Description | -| ----------------- | --------------------- | -| [FakeadditionalpropertieswitharrayofenumsGetRequestBody.@Nullable SealedRequestBody](../../paths/fakeadditionalpropertieswitharrayofenums/get/FakeadditionalpropertieswitharrayofenumsGetRequestBody.md#sealedrequestbody) | requestBody
optional | -| [RootServerInfo.@Nullable ServerIndex](../../RootServerInfo.md#serverindex) | serverIndex
optional. Note: this will override the value in apiConfiguration | -| @Nullable Duration | timeout
optional. Note: this will override the value in apiConfiguration | - -## GetRequestBuilder -public static class GetRequestBuilder
- -a builder for request inputs - -### Constructor Summary -| Constructor and Description | -| --------------------------- | -| GetRequestBuilder()
Creates a builder that contains null for all parameters | - -### Method Summary -| Modifier and Type | Method and Description | -| ----------------- | ---------------------- | -| [GetRequest](#getrequest) | build()
Returns the request input used to call an endpoint method | -| [GetRequestBuilder](#getrequestbuilder) | requestBody([FakeadditionalpropertieswitharrayofenumsGetRequestBody.SealedRequestBody](../../paths/fakeadditionalpropertieswitharrayofenums/get/FakeadditionalpropertieswitharrayofenumsGetRequestBody.md#sealedrequestbody) requestBody)
sets the optional property | -| [GetRequestBuilder](#getrequestbuilder) | serverIndex([RootServerInfo.ServerIndex](../../RootServerInfo.md#serverindex) serverIndex)
sets the optional property. Note: this will override the value in apiConfiguration | -| [GetRequestBuilder](#getrequestbuilder) | timeout(Duration timeout)
sets the optional property. Note: this will override the value in apiConfiguration | - -[[Back to top]](#top) [[Back to README]](../../../README.md) diff --git a/samples/client/petstore/kotlin/docs/paths/fakeadditionalpropertieswitharrayofenums/get/FakeadditionalpropertieswitharrayofenumsGetRequestBody.md b/samples/client/petstore/kotlin/docs/paths/fakeadditionalpropertieswitharrayofenums/get/FakeadditionalpropertieswitharrayofenumsGetRequestBody.md deleted file mode 100644 index 58344dc5d63..00000000000 --- a/samples/client/petstore/kotlin/docs/paths/fakeadditionalpropertieswitharrayofenums/get/FakeadditionalpropertieswitharrayofenumsGetRequestBody.md +++ /dev/null @@ -1,90 +0,0 @@ -# FakeadditionalpropertieswitharrayofenumsGetRequestBody - -public class FakeadditionalpropertieswitharrayofenumsGetRequestBody - -A class that contains necessary nested request body classes -- SealedMediaType, a sealed interface which contains all the schema/encoding info for each contentType -- records which implement SealedMediaType, the concrete media types -- a class that extends RequestBodySerializer and is used to serialize input SealedRequestBody instances -- SealedRequestBody, a sealed interface which contains all the contentType/schema input types -- records which implement SealedRequestBody, the concrete request body types - -## Nested Class Summary -| Modifier and Type | Class and Description | -| ----------------- | --------------------- | -| sealed interface | [FakeadditionalpropertieswitharrayofenumsGetRequestBody.SealedMediaType](#sealedmediatype)
media type sealed interface | -| record | [FakeadditionalpropertieswitharrayofenumsGetRequestBody.ApplicationjsonMediaType](#applicationjsonmediatype)
record storing schema + encoding for a specific contentType | -| static class | [FakeadditionalpropertieswitharrayofenumsGetRequestBody.FakeadditionalpropertieswitharrayofenumsGetRequestBody1](#fakeadditionalpropertieswitharrayofenumsgetrequestbody1)
class that serializes request bodies | -| sealed interface | [FakeadditionalpropertieswitharrayofenumsGetRequestBody.SealedRequestBody](#sealedrequestbody)
request body sealed interface | -| record | [FakeadditionalpropertieswitharrayofenumsGetRequestBody.ApplicationjsonRequestBody](#applicationjsonrequestbody)
implements sealed interface to store request body input | - -## SealedMediaType -public sealed interface SealedMediaType
-permits
-[ApplicationjsonMediaType](#applicationjsonmediatype) - -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), Nothing?> - -class storing schema info for a specific contentType - -### Constructor Summary -| Constructor and Description | -| --------------------------- | -| ApplicationjsonMediaType()
Creates an instance | - -### 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 | -| Nothing? | encoding()
the encoding info | - -## FakeadditionalpropertieswitharrayofenumsGetRequestBody1 -public static class FakeadditionalpropertieswitharrayofenumsGetRequestBody1
- -a class that serializes SealedRequestBody request bodies - -### Constructor Summary -| Constructor and Description | -| --------------------------- | -| FakeadditionalpropertieswitharrayofenumsGetRequestBody1()
Creates an instance | - -### Field Summary -| Modifier and Type | Field and Description | -| ----------------- | --------------------- | -| boolean | required = false
whether the request body is required | -| 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 | -| ----------------- | ---------------------- | -| SerializedRequestBody | serialize([SealedRequestBody](#sealedrequestbody) requestBody)
called by endpoint when creating request body bytes | - -## SealedRequestBody -public sealed interface SealedRequestBody
-permits
-[ApplicationjsonRequestBody](#applicationjsonrequestbody) - -sealed interface that stores request contentType + validated schema data - -## ApplicationjsonRequestBody -public record ApplicationjsonRequestBody
-implements [SealedRequestBody](#sealedrequestbody),
-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 | - -### 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 | diff --git a/samples/client/petstore/kotlin/docs/paths/fakeadditionalpropertieswitharrayofenums/get/FakeadditionalpropertieswitharrayofenumsGetResponses.md b/samples/client/petstore/kotlin/docs/paths/fakeadditionalpropertieswitharrayofenums/get/FakeadditionalpropertieswitharrayofenumsGetResponses.md deleted file mode 100644 index 9e48d107d28..00000000000 --- a/samples/client/petstore/kotlin/docs/paths/fakeadditionalpropertieswitharrayofenums/get/FakeadditionalpropertieswitharrayofenumsGetResponses.md +++ /dev/null @@ -1,29 +0,0 @@ -# FakeadditionalpropertieswitharrayofenumsGetResponses - -public class FakeadditionalpropertieswitharrayofenumsGetResponses - -A class that contains necessary responses classes -- a sealed interface, EndpointResponse, that stores endpoint responses -- records for each endpoint response - -## Nested Class Summary -| Modifier and Type | Class and Description | -| ----------------- | --------------------- | -| sealed interface | [EndpointResponse](#endpointresponse)
stores the endpoint responses | -| record | [EndpointFakeadditionalpropertieswitharrayofenumsGetCode200Response](#endpointfakeadditionalpropertieswitharrayofenumsgetcode200response)
the response for 200 | - -## EndpointResponse -public sealed interface EndpointResponse permits
-[EndpointFakeadditionalpropertieswitharrayofenumsGetCode200Response](#endpointfakeadditionalpropertieswitharrayofenumsgetcode200response) - -a sealed interface that stores endpoint responses - -## EndpointFakeadditionalpropertieswitharrayofenumsGetCode200Response -public record EndpointFakeadditionalpropertieswitharrayofenumsGetCode200Response( - HttpResponse response, - [FakeadditionalpropertieswitharrayofenumsGetCode200Response.SealedResponseBody](../../../paths/fakeadditionalpropertieswitharrayofenums/get/responses/FakeadditionalpropertieswitharrayofenumsGetCode200Response.md#sealedresponsebody) body, - Nothing? headers -) implements EndpointResponse, ApiResponse
- -a class that stores an endpoint response - diff --git a/samples/client/petstore/kotlin/docs/paths/fakeadditionalpropertieswitharrayofenums/get/requestbody/content/applicationjson/ApplicationjsonSchema.md b/samples/client/petstore/kotlin/docs/paths/fakeadditionalpropertieswitharrayofenums/get/requestbody/content/applicationjson/ApplicationjsonSchema.md deleted file mode 100644 index e583d49bf2d..00000000000 --- a/samples/client/petstore/kotlin/docs/paths/fakeadditionalpropertieswitharrayofenums/get/requestbody/content/applicationjson/ApplicationjsonSchema.md +++ /dev/null @@ -1,19 +0,0 @@ -# ApplicationjsonSchema -public class ApplicationjsonSchema
-extends [AdditionalPropertiesWithArrayOfEnums1](../../../../../../components/schemas/AdditionalPropertiesWithArrayOfEnums.md#additionalpropertieswitharrayofenums) - -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 - -## Nested Class Summary -| Modifier and Type | Class and Description | -| ----------------- | ---------------------- | -| static class | [ApplicationjsonSchema.ApplicationjsonSchema1](#applicationjsonschema1)
schema class | - -## ApplicationjsonSchema1 -public static class ApplicationjsonSchema1
-extends [AdditionalPropertiesWithArrayOfEnums.AdditionalPropertiesWithArrayOfEnums1](../../../../../../components/schemas/AdditionalPropertiesWithArrayOfEnums.md#additionalpropertieswitharrayofenums1) - -A schema class that validates payloads diff --git a/samples/client/petstore/kotlin/docs/paths/fakeadditionalpropertieswitharrayofenums/get/responses/FakeadditionalpropertieswitharrayofenumsGetCode200Response.md b/samples/client/petstore/kotlin/docs/paths/fakeadditionalpropertieswitharrayofenums/get/responses/FakeadditionalpropertieswitharrayofenumsGetCode200Response.md deleted file mode 100644 index ef139bd1ed0..00000000000 --- a/samples/client/petstore/kotlin/docs/paths/fakeadditionalpropertieswitharrayofenums/get/responses/FakeadditionalpropertieswitharrayofenumsGetCode200Response.md +++ /dev/null @@ -1,87 +0,0 @@ -# FakeadditionalpropertieswitharrayofenumsGetCode200Response - -public class FakeadditionalpropertieswitharrayofenumsGetCode200Response - -A class that contains necessary nested response classes -- SealedMediaType, a sealed interface which contains all the schema/encoding info for each contentType -- records which implement SealedMediaType, the concrete media types -- SealedResponseBody, a sealed interface which contains all the contentType/schema types -- records which implement SealedResponseBody, the concrete response body types -- a class that extends ResponseDeserializer and is used to deserialize responses - -## Nested Class Summary -| Modifier and Type | Class and Description | -| ----------------- | --------------------- | -| sealed interface | [FakeadditionalpropertieswitharrayofenumsGetCode200Response.SealedMediaType](#sealedmediatype)
media type sealed interface | -| record | [FakeadditionalpropertieswitharrayofenumsGetCode200Response.ApplicationjsonMediaType](#applicationjsonmediatype)
record storing schema + encoding for a specific contentType | -| sealed interface | [FakeadditionalpropertieswitharrayofenumsGetCode200Response.SealedResponseBody](#sealedresponsebody)
response body sealed interface | -| record | [FakeadditionalpropertieswitharrayofenumsGetCode200Response.ApplicationjsonResponseBody](#applicationjsonresponsebody)
implements sealed interface to store response body | -| static class | [FakeadditionalpropertieswitharrayofenumsGetCode200Response.FakeadditionalpropertieswitharrayofenumsGetCode200Response1](#fakeadditionalpropertieswitharrayofenumsgetcode200response1)
class that deserializes responses | - -## SealedMediaType -public sealed interface SealedMediaType
-permits
-[ApplicationjsonMediaType](#applicationjsonmediatype) - -sealed interface that stores schema and encoding info - -## ApplicationjsonMediaType -public record ApplicationjsonMediaType
-implements [SealedMediaType](#sealedmediatype), MediaType<[ApplicationjsonSchema.ApplicationjsonSchema1](../../../../paths/fakeadditionalpropertieswitharrayofenums/get/responses/code200response/content/applicationjson/ApplicationjsonSchema.md#applicationjsonschema1), Nothing?> - -class storing schema info for a specific contentType - -### Constructor Summary -| Constructor and Description | -| --------------------------- | -| ApplicationjsonMediaType()
Creates an instance | - -### Method Summary -| Modifier and Type | Method and Description | -| ----------------- | ---------------------- | -| [ApplicationjsonSchema.ApplicationjsonSchema1](../../../../paths/fakeadditionalpropertieswitharrayofenums/get/responses/code200response/content/applicationjson/ApplicationjsonSchema.md#applicationjsonschema1) | schema()
the schema for this MediaType | -| Nothing? | encoding()
the encoding info | - -## SealedResponseBody -public sealed interface SealedResponseBody
-permits
-[ApplicationjsonResponseBody](#applicationjsonresponsebody) - -sealed interface that stores response body - -## ApplicationjsonResponseBody -public record ApplicationjsonResponseBody
-implements [SealedResponseBody](#sealedresponsebody) - -A record class to store response body for contentType="application/json" - -### Constructor Summary -| Constructor and Description | -| --------------------------- | -| ApplicationjsonResponseBody(ApplicationjsonSchema.[AdditionalPropertiesWithArrayOfEnums1Boxed](../../../../components/schemas/AdditionalPropertiesWithArrayOfEnums.md#additionalpropertieswitharrayofenums1boxed) body)
Creates an instance | - -### Method Summary -| Modifier and Type | Method and Description | -| ----------------- | ---------------------- | -| ApplicationjsonSchema.[AdditionalPropertiesWithArrayOfEnums1Boxed](../../../../components/schemas/AdditionalPropertiesWithArrayOfEnums.md#additionalpropertieswitharrayofenums1boxed) | body()
returns the body passed in in the constructor | - -## FakeadditionalpropertieswitharrayofenumsGetCode200Response1 -public static class FakeadditionalpropertieswitharrayofenumsGetCode200Response1
-extends ResponseDeserializer<[SealedResponseBody](#sealedresponsebody), Nothing?, [SealedMediaType](#sealedmediatype)> - -a class that deserializes responses - -### Constructor Summary -| Constructor and Description | -| --------------------------- | -| FakeadditionalpropertieswitharrayofenumsGetCode200Response1()
Creates an instance | - -### Field Summary -| Modifier and Type | Field and Description | -| ----------------- | --------------------- | -| 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 | -| ----------------- | ---------------------- | -| ApiResponse<[SealedResponseBody](#sealedresponsebody), Nothing?> | deserialize(HttpResponse response, SchemaConfiguration configuration)
called by endpoint when deserialize responses | diff --git a/samples/client/petstore/kotlin/docs/paths/fakeadditionalpropertieswitharrayofenums/get/responses/code200response/content/applicationjson/ApplicationjsonSchema.md b/samples/client/petstore/kotlin/docs/paths/fakeadditionalpropertieswitharrayofenums/get/responses/code200response/content/applicationjson/ApplicationjsonSchema.md deleted file mode 100644 index 3c5d3360d21..00000000000 --- a/samples/client/petstore/kotlin/docs/paths/fakeadditionalpropertieswitharrayofenums/get/responses/code200response/content/applicationjson/ApplicationjsonSchema.md +++ /dev/null @@ -1,19 +0,0 @@ -# ApplicationjsonSchema -public class ApplicationjsonSchema
-extends [AdditionalPropertiesWithArrayOfEnums1](../../../../../../../components/schemas/AdditionalPropertiesWithArrayOfEnums.md#additionalpropertieswitharrayofenums) - -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 - -## Nested Class Summary -| Modifier and Type | Class and Description | -| ----------------- | ---------------------- | -| static class | [ApplicationjsonSchema.ApplicationjsonSchema1](#applicationjsonschema1)
schema class | - -## ApplicationjsonSchema1 -public static class ApplicationjsonSchema1
-extends [AdditionalPropertiesWithArrayOfEnums.AdditionalPropertiesWithArrayOfEnums1](../../../../../../../components/schemas/AdditionalPropertiesWithArrayOfEnums.md#additionalpropertieswitharrayofenums1) - -A schema class that validates payloads diff --git a/samples/client/petstore/kotlin/docs/paths/fakebodywithfileschema/FakebodywithfileschemaPut.md b/samples/client/petstore/kotlin/docs/paths/fakebodywithfileschema/FakebodywithfileschemaPut.md deleted file mode 100644 index 0da6338b397..00000000000 --- a/samples/client/petstore/kotlin/docs/paths/fakebodywithfileschema/FakebodywithfileschemaPut.md +++ /dev/null @@ -1,188 +0,0 @@ -# FakebodywithfileschemaPut - -public class FakebodywithfileschemaPut - -A class that contains necessary endpoint classes -- a class that calls the endpoint method using the http verb -- a class that calls the endpoint method using the operationId name -- class(es) to store the request inputs -- builder(s) to set the request input data - -## Nested Class Summary -| Modifier and Type | Class and Description | -| ----------------- | --------------------- | -| static class | [Put](#put)
The class that has a put method to call the endpoint | -| interface | [BodyWithFileSchemaOperation](#bodywithfileschemaoperation)
The interface that has a bodyWithFileSchema method to call the endpoint | -| static class | [PutRequest](#putrequest)
The final request inputs class | -| static class | [PutNullableRequest](#putnullablerequest)
The initial request inputs class | -| static class | [Put0RequestBuilder](#put0requestbuilder)
A builder for the request input class | -| static class | [PutRequestBuilder](#putrequestbuilder)
A builder for the request input class | - -## Put -public static class Put extends ApiClient.ApiClient1 implements PutOperation
- -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.fakebodywithfileschema.put.FakebodywithfileschemaPutRequestBody; -import org.openapijsonschematools.client.components.schemas.FileSchemaTestClass; -import org.openapijsonschematools.client.servers.RootServer0; -import org.openapijsonschematools.client.servers.RootServer1; -import org.openapijsonschematools.client.servers.RootServer2; -import org.openapijsonschematools.client.paths.fakebodywithfileschema.put.responses.FakebodywithfileschemaPutCode200Response; -import org.openapijsonschematools.client.servers.RootServerInfo; -import org.openapijsonschematools.client.paths.fakebodywithfileschema.FakebodywithfileschemaPut; -import org.openapijsonschematools.client.paths.fakebodywithfileschema.put.FakebodywithfileschemaPutResponses; - -import java.io.IOException; -import java.util.Arrays; -import java.util.List; -import java.util.Map; -import java.util.AbstractMap; - -// if you want to use a server that is not SERVER_0 pass it in here and change the ServerIndex input below -ApiConfiguration.ServerInfo serverInfo = new ApiConfiguration.ServerInfoBuilder() - .rootServerInfo( - new RootServerInfo.RootServerInfoBuilder() - .rootServer0(new RootServer0()) - .build() - ) - .build(); -ApiConfiguration.ServerIndexInfo serverIndexInfo = new ApiConfiguration.ServerIndexInfoBuilder() - .rootServerInfoServerIndex(RootServerInfo.ServerIndex.SERVER_0) - .build(); -Duration timeout = Duration.ofSeconds(1L); -Map> defaultHeaders = Map.of("User-Agent", List.of("OpenAPI-JSON-Schema-Generator/1.0.0/java")); -ApiConfiguration apiConfiguration = new ApiConfiguration( - serverInfo - serverIndexInfo, - timeout, - defaultHeaders -); -SchemaConfiguration schemaConfiguration = new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().build()); -FakebodywithfileschemaPut.Put apiClient = new FakebodywithfileschemaPut.Put(apiConfiguration, schemaConfiguration); - - -FileSchemaTestClass1BoxedMap requestBodyPayload = - FileSchemaTestClass.FileSchemaTestClass1.validateAndBox( - new FileSchemaTestClass.FileSchemaTestClassMapBuilder() - .files( - Arrays.asList( - ) - ) - .build(), - schemaConfiguration -); -FakebodywithfileschemaPut.SealedRequestBody requestBody = new FakebodywithfileschemaPut.ApplicationjsonRequestBody(requestBodyPayload); - -var request = new FakebodywithfileschemaPut.PutRequestBuilder() - .requestBody(requestBody) - .build(); - -FakebodywithfileschemaPutResponses.EndpointResponse response; -try { - response = apiClient.put(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; -} -FakebodywithfileschemaPutResponses.EndpointFakebodywithfileschemaPutCode200Response castResponse = (FakebodywithfileschemaPutResponses.EndpointFakebodywithfileschemaPutCode200Response) response; -``` -### Constructor Summary -| Constructor and Description | -| --------------------------- | -| Put(ApiConfiguration apiConfiguration, SchemaConfiguration schemaConfiguration)
Creates an instance | - -### Method Summary -| Modifier and Type | Method and Description | -| ----------------- | ---------------------- | -| [FakebodywithfileschemaPutResponses.EndpointResponse](../../paths/fakebodywithfileschema/put/FakebodywithfileschemaPutResponses.md#endpointresponse) | put([PutRequest](#putrequest) request) | - -## BodyWithFileSchemaOperation -public interface BodyWithFileSchemaOperation
- -an interface that allows one to call the endpoint using a method named bodyWithFileSchema by the operationId - -### Method Summary -| Modifier and Type | Method and Description | -| ----------------- | ---------------------- | -| [FakebodywithfileschemaPutResponses.EndpointResponse](../../paths/fakebodywithfileschema/put/FakebodywithfileschemaPutResponses.md#endpointresponse) | bodyWithFileSchema([PutRequest](#putrequest) request) | - -## PutRequest -public static class PutRequest
- -a class that stores the final request inputs - -### Field Summary -| Modifier and Type | Field and Description | -| ----------------- | --------------------- | -| [FakebodywithfileschemaPutRequestBody.SealedRequestBody](../../paths/fakebodywithfileschema/put/FakebodywithfileschemaPutRequestBody.md#sealedrequestbody) | requestBody | -| [RootServerInfo.@Nullable ServerIndex](../../RootServerInfo.md#serverindex) | serverIndex
optional. Note: this will override the value in apiConfiguration | -| @Nullable Duration | timeout
optional. Note: this will override the value in apiConfiguration | - -## PutNullableRequest -public static class PutNullableRequest
- -a class that stores the initial request inputs - -### Field Summary -| Modifier and Type | Field and Description | -| ----------------- | --------------------- | -| [FakebodywithfileschemaPutRequestBody.@Nullable SealedRequestBody](../../paths/fakebodywithfileschema/put/FakebodywithfileschemaPutRequestBody.md#sealedrequestbody) | requestBody | -| [RootServerInfo.@Nullable ServerIndex](../../RootServerInfo.md#serverindex) | serverIndex | -| @Nullable Duration | timeout | - -## Put0RequestBuilder -public static class Put0RequestBuilder
- -a builder for request inputs - -### Constructor Summary -| Constructor and Description | -| --------------------------- | -| Put0RequestBuilder(Put0RequestBuilder instance)
Creates a builder that contains the passed instance | - -### Method Summary -| Modifier and Type | Method and Description | -| ----------------- | ---------------------- | -| [PutRequest](#putrequest) | build()
Returns the request input used to call an endpoint method | -| [Put0RequestBuilder](#put0requestbuilder) | serverIndex([RootServerInfo.ServerIndex](../../RootServerInfo.md#serverindex) serverIndex)
sets the optional property. Note: this will override the value in apiConfiguration | -| [Put0RequestBuilder](#put0requestbuilder) | timeout(Duration timeout)
sets the optional property. Note: this will override the value in apiConfiguration | - -## PutRequestBuilder -public static class PutRequestBuilder
- -a builder for request inputs - -### Constructor Summary -| Constructor and Description | -| --------------------------- | -| PutRequestBuilder()
Creates a builder that contains null for all parameters | - -### Method Summary -| Modifier and Type | Method and Description | -| ----------------- | ---------------------- | -| [Put0RequestBuilder](#put0requestbuilder) | requestBody([FakebodywithfileschemaPutRequestBody.SealedRequestBody](../../paths/fakebodywithfileschema/put/FakebodywithfileschemaPutRequestBody.md#sealedrequestbody) requestBody)
sets the property | - -[[Back to top]](#top) [[Back to README]](../../../README.md) diff --git a/samples/client/petstore/kotlin/docs/paths/fakebodywithfileschema/put/FakebodywithfileschemaPutRequestBody.md b/samples/client/petstore/kotlin/docs/paths/fakebodywithfileschema/put/FakebodywithfileschemaPutRequestBody.md deleted file mode 100644 index 651a04da435..00000000000 --- a/samples/client/petstore/kotlin/docs/paths/fakebodywithfileschema/put/FakebodywithfileschemaPutRequestBody.md +++ /dev/null @@ -1,90 +0,0 @@ -# FakebodywithfileschemaPutRequestBody - -public class FakebodywithfileschemaPutRequestBody - -A class that contains necessary nested request body classes -- SealedMediaType, a sealed interface which contains all the schema/encoding info for each contentType -- records which implement SealedMediaType, the concrete media types -- a class that extends RequestBodySerializer and is used to serialize input SealedRequestBody instances -- SealedRequestBody, a sealed interface which contains all the contentType/schema input types -- records which implement SealedRequestBody, the concrete request body types - -## Nested Class Summary -| Modifier and Type | Class and Description | -| ----------------- | --------------------- | -| sealed interface | [FakebodywithfileschemaPutRequestBody.SealedMediaType](#sealedmediatype)
media type sealed interface | -| record | [FakebodywithfileschemaPutRequestBody.ApplicationjsonMediaType](#applicationjsonmediatype)
record storing schema + encoding for a specific contentType | -| static class | [FakebodywithfileschemaPutRequestBody.FakebodywithfileschemaPutRequestBody1](#fakebodywithfileschemaputrequestbody1)
class that serializes request bodies | -| sealed interface | [FakebodywithfileschemaPutRequestBody.SealedRequestBody](#sealedrequestbody)
request body sealed interface | -| record | [FakebodywithfileschemaPutRequestBody.ApplicationjsonRequestBody](#applicationjsonrequestbody)
implements sealed interface to store request body input | - -## SealedMediaType -public sealed interface SealedMediaType
-permits
-[ApplicationjsonMediaType](#applicationjsonmediatype) - -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), Nothing?> - -class storing schema info for a specific contentType - -### Constructor Summary -| Constructor and Description | -| --------------------------- | -| ApplicationjsonMediaType()
Creates an instance | - -### 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 | -| Nothing? | encoding()
the encoding info | - -## FakebodywithfileschemaPutRequestBody1 -public static class FakebodywithfileschemaPutRequestBody1
- -a class that serializes SealedRequestBody request bodies - -### Constructor Summary -| Constructor and Description | -| --------------------------- | -| FakebodywithfileschemaPutRequestBody1()
Creates an instance | - -### Field Summary -| Modifier and Type | Field and Description | -| ----------------- | --------------------- | -| boolean | required = true
whether the request body is required | -| 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 | -| ----------------- | ---------------------- | -| SerializedRequestBody | serialize([SealedRequestBody](#sealedrequestbody) requestBody)
called by endpoint when creating request body bytes | - -## SealedRequestBody -public sealed interface SealedRequestBody
-permits
-[ApplicationjsonRequestBody](#applicationjsonrequestbody) - -sealed interface that stores request contentType + validated schema data - -## ApplicationjsonRequestBody -public record ApplicationjsonRequestBody
-implements [SealedRequestBody](#sealedrequestbody),
-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 | - -### 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 | diff --git a/samples/client/petstore/kotlin/docs/paths/fakebodywithfileschema/put/FakebodywithfileschemaPutResponses.md b/samples/client/petstore/kotlin/docs/paths/fakebodywithfileschema/put/FakebodywithfileschemaPutResponses.md deleted file mode 100644 index 2952ae46d3a..00000000000 --- a/samples/client/petstore/kotlin/docs/paths/fakebodywithfileschema/put/FakebodywithfileschemaPutResponses.md +++ /dev/null @@ -1,29 +0,0 @@ -# FakebodywithfileschemaPutResponses - -public class FakebodywithfileschemaPutResponses - -A class that contains necessary responses classes -- a sealed interface, EndpointResponse, that stores endpoint responses -- records for each endpoint response - -## Nested Class Summary -| Modifier and Type | Class and Description | -| ----------------- | --------------------- | -| sealed interface | [EndpointResponse](#endpointresponse)
stores the endpoint responses | -| record | [EndpointFakebodywithfileschemaPutCode200Response](#endpointfakebodywithfileschemaputcode200response)
the response for 200 | - -## EndpointResponse -public sealed interface EndpointResponse permits
-[EndpointFakebodywithfileschemaPutCode200Response](#endpointfakebodywithfileschemaputcode200response) - -a sealed interface that stores endpoint responses - -## EndpointFakebodywithfileschemaPutCode200Response -public record EndpointFakebodywithfileschemaPutCode200Response( - HttpResponse response, - Nothing? body, - Nothing? headers -) implements EndpointResponse, ApiResponse
- -a class that stores an endpoint response - diff --git a/samples/client/petstore/kotlin/docs/paths/fakebodywithfileschema/put/requestbody/content/applicationjson/ApplicationjsonSchema.md b/samples/client/petstore/kotlin/docs/paths/fakebodywithfileschema/put/requestbody/content/applicationjson/ApplicationjsonSchema.md deleted file mode 100644 index 16f5864b396..00000000000 --- a/samples/client/petstore/kotlin/docs/paths/fakebodywithfileschema/put/requestbody/content/applicationjson/ApplicationjsonSchema.md +++ /dev/null @@ -1,19 +0,0 @@ -# ApplicationjsonSchema -public class ApplicationjsonSchema
-extends [FileSchemaTestClass1](../../../../../../components/schemas/FileSchemaTestClass.md#fileschematestclass) - -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 - -## Nested Class Summary -| Modifier and Type | Class and Description | -| ----------------- | ---------------------- | -| static class | [ApplicationjsonSchema.ApplicationjsonSchema1](#applicationjsonschema1)
schema class | - -## ApplicationjsonSchema1 -public static class ApplicationjsonSchema1
-extends [FileSchemaTestClass.FileSchemaTestClass1](../../../../../../components/schemas/FileSchemaTestClass.md#fileschematestclass1) - -A schema class that validates payloads diff --git a/samples/client/petstore/kotlin/docs/paths/fakebodywithfileschema/put/responses/FakebodywithfileschemaPutCode200Response.md b/samples/client/petstore/kotlin/docs/paths/fakebodywithfileschema/put/responses/FakebodywithfileschemaPutCode200Response.md deleted file mode 100644 index 7de1a2829fb..00000000000 --- a/samples/client/petstore/kotlin/docs/paths/fakebodywithfileschema/put/responses/FakebodywithfileschemaPutCode200Response.md +++ /dev/null @@ -1,17 +0,0 @@ -# FakebodywithfileschemaPutCode200Response - -public class FakebodywithfileschemaPutCode200Response extends [SuccessDescriptionOnly](../../components/responses/SuccessDescriptionOnly.md) - -A class (extended from the $ref class) that contains necessary nested response classes -- a class that extends ResponseDeserializer and is used to deserialize responses - -## Nested Class Summary -| Modifier and Type | Class and Description | -| ----------------- | --------------------- | -| static class | [FakebodywithfileschemaPutCode200Response.FakebodywithfileschemaPutCode200Response1](#fakebodywithfileschemaputcode200response1)
class that deserializes responses | - -## FakebodywithfileschemaPutCode200Response1 -public static class FakebodywithfileschemaPutCode200Response1 extends [SuccessDescriptionOnly1](../../components/responses/SuccessDescriptionOnly.md#successdescriptiononly1)
- -a class that deserializes responses, extended from the $ref class - diff --git a/samples/client/petstore/kotlin/docs/paths/fakebodywithqueryparams/FakebodywithqueryparamsPut.md b/samples/client/petstore/kotlin/docs/paths/fakebodywithqueryparams/FakebodywithqueryparamsPut.md deleted file mode 100644 index 3e459a91467..00000000000 --- a/samples/client/petstore/kotlin/docs/paths/fakebodywithqueryparams/FakebodywithqueryparamsPut.md +++ /dev/null @@ -1,249 +0,0 @@ -# FakebodywithqueryparamsPut - -public class FakebodywithqueryparamsPut - -A class that contains necessary endpoint classes -- a class that calls the endpoint method using the http verb -- a class that calls the endpoint method using the operationId name -- class(es) to store the request inputs -- builder(s) to set the request input data - -## Nested Class Summary -| Modifier and Type | Class and Description | -| ----------------- | --------------------- | -| static class | [Put](#put)
The class that has a put method to call the endpoint | -| interface | [BodyWithQueryParamsOperation](#bodywithqueryparamsoperation)
The interface that has a bodyWithQueryParams method to call the endpoint | -| static class | [PutRequest](#putrequest)
The final request inputs class | -| static class | [PutNullableRequest](#putnullablerequest)
The initial request inputs class | -| static class | [Put00RequestBuilder](#put00requestbuilder)
A builder for the request input class | -| static class | [Put01RequestBuilder](#put01requestbuilder)
A builder for the request input class | -| static class | [Put10RequestBuilder](#put10requestbuilder)
A builder for the request input class | -| static class | [PutRequestBuilder](#putrequestbuilder)
A builder for the request input class | - -## Put -public static class Put extends ApiClient.ApiClient1 implements PutOperation
- -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.fakebodywithqueryparams.put.FakebodywithqueryparamsPutRequestBody; -import org.openapijsonschematools.client.components.schemas.User; -import org.openapijsonschematools.client.paths.fakebodywithqueryparams.put.FakebodywithqueryparamsPutQueryParameters; -import org.openapijsonschematools.client.servers.RootServer0; -import org.openapijsonschematools.client.servers.RootServer1; -import org.openapijsonschematools.client.servers.RootServer2; -import org.openapijsonschematools.client.paths.fakebodywithqueryparams.put.responses.FakebodywithqueryparamsPutCode200Response; -import org.openapijsonschematools.client.servers.RootServerInfo; -import org.openapijsonschematools.client.paths.fakebodywithqueryparams.FakebodywithqueryparamsPut; -import org.openapijsonschematools.client.paths.fakebodywithqueryparams.put.FakebodywithqueryparamsPutResponses; - -import java.io.IOException; -import java.util.Arrays; -import java.util.List; -import java.util.Map; -import java.util.AbstractMap; - -// if you want to use a server that is not SERVER_0 pass it in here and change the ServerIndex input below -ApiConfiguration.ServerInfo serverInfo = new ApiConfiguration.ServerInfoBuilder() - .rootServerInfo( - new RootServerInfo.RootServerInfoBuilder() - .rootServer0(new RootServer0()) - .build() - ) - .build(); -ApiConfiguration.ServerIndexInfo serverIndexInfo = new ApiConfiguration.ServerIndexInfoBuilder() - .rootServerInfoServerIndex(RootServerInfo.ServerIndex.SERVER_0) - .build(); -Duration timeout = Duration.ofSeconds(1L); -Map> defaultHeaders = Map.of("User-Agent", List.of("OpenAPI-JSON-Schema-Generator/1.0.0/java")); -ApiConfiguration apiConfiguration = new ApiConfiguration( - serverInfo - serverIndexInfo, - timeout, - defaultHeaders -); -SchemaConfiguration schemaConfiguration = new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().build()); -FakebodywithqueryparamsPut.Put apiClient = new FakebodywithqueryparamsPut.Put(apiConfiguration, schemaConfiguration); - - -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 -); -FakebodywithqueryparamsPut.SealedRequestBody requestBody = new FakebodywithqueryparamsPut.ApplicationjsonRequestBody(requestBodyPayload); - -// Map validation -FakebodywithqueryparamsPutQueryParameters.QueryParametersMap queryParameters = - FakebodywithqueryparamsPutQueryParameters.FakebodywithqueryparamsPutQueryParameters1.validate( - new FakebodywithqueryparamsPutQueryParameters.QueryParametersMapBuilder() - .query("a") - - .build(), - schemaConfiguration -); - -var request = new FakebodywithqueryparamsPut.PutRequestBuilder() - .requestBody(requestBody) - .queryParameters(queryParameters) - .build(); - -FakebodywithqueryparamsPutResponses.EndpointResponse response; -try { - response = apiClient.put(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; -} -FakebodywithqueryparamsPutResponses.EndpointFakebodywithqueryparamsPutCode200Response castResponse = (FakebodywithqueryparamsPutResponses.EndpointFakebodywithqueryparamsPutCode200Response) response; -``` -### Constructor Summary -| Constructor and Description | -| --------------------------- | -| Put(ApiConfiguration apiConfiguration, SchemaConfiguration schemaConfiguration)
Creates an instance | - -### Method Summary -| Modifier and Type | Method and Description | -| ----------------- | ---------------------- | -| [FakebodywithqueryparamsPutResponses.EndpointResponse](../../paths/fakebodywithqueryparams/put/FakebodywithqueryparamsPutResponses.md#endpointresponse) | put([PutRequest](#putrequest) request) | - -## BodyWithQueryParamsOperation -public interface BodyWithQueryParamsOperation
- -an interface that allows one to call the endpoint using a method named bodyWithQueryParams by the operationId - -### Method Summary -| Modifier and Type | Method and Description | -| ----------------- | ---------------------- | -| [FakebodywithqueryparamsPutResponses.EndpointResponse](../../paths/fakebodywithqueryparams/put/FakebodywithqueryparamsPutResponses.md#endpointresponse) | bodyWithQueryParams([PutRequest](#putrequest) request) | - -## PutRequest -public static class PutRequest
- -a class that stores the final request inputs - -### Field Summary -| Modifier and Type | Field and Description | -| ----------------- | --------------------- | -| [FakebodywithqueryparamsPutRequestBody.SealedRequestBody](../../paths/fakebodywithqueryparams/put/FakebodywithqueryparamsPutRequestBody.md#sealedrequestbody) | requestBody | -| [FakebodywithqueryparamsPutQueryParameters.QueryParametersMap](../../paths/fakebodywithqueryparams/put/FakebodywithqueryparamsPutQueryParameters.md#queryparametersmap) | queryParameters | -| [RootServerInfo.@Nullable ServerIndex](../../RootServerInfo.md#serverindex) | serverIndex
optional. Note: this will override the value in apiConfiguration | -| @Nullable Duration | timeout
optional. Note: this will override the value in apiConfiguration | - -## PutNullableRequest -public static class PutNullableRequest
- -a class that stores the initial request inputs - -### Field Summary -| Modifier and Type | Field and Description | -| ----------------- | --------------------- | -| [FakebodywithqueryparamsPutRequestBody.@Nullable SealedRequestBody](../../paths/fakebodywithqueryparams/put/FakebodywithqueryparamsPutRequestBody.md#sealedrequestbody) | requestBody | -| [FakebodywithqueryparamsPutQueryParameters.@Nullable QueryParametersMap](../../paths/fakebodywithqueryparams/put/FakebodywithqueryparamsPutQueryParameters.md#queryparametersmap) | queryParameters | -| [RootServerInfo.@Nullable ServerIndex](../../RootServerInfo.md#serverindex) | serverIndex | -| @Nullable Duration | timeout | - -## Put00RequestBuilder -public static class Put00RequestBuilder
- -a builder for request inputs - -### Constructor Summary -| Constructor and Description | -| --------------------------- | -| Put00RequestBuilder(Put00RequestBuilder instance)
Creates a builder that contains the passed instance | - -### Method Summary -| Modifier and Type | Method and Description | -| ----------------- | ---------------------- | -| [PutRequest](#putrequest) | build()
Returns the request input used to call an endpoint method | -| [Put00RequestBuilder](#put00requestbuilder) | serverIndex([RootServerInfo.ServerIndex](../../RootServerInfo.md#serverindex) serverIndex)
sets the optional property. Note: this will override the value in apiConfiguration | -| [Put00RequestBuilder](#put00requestbuilder) | timeout(Duration timeout)
sets the optional property. Note: this will override the value in apiConfiguration | - -## Put01RequestBuilder -public static class Put01RequestBuilder
- -a builder for request inputs - -### Constructor Summary -| Constructor and Description | -| --------------------------- | -| Put01RequestBuilder(Put01RequestBuilder instance)
Creates a builder that contains the passed instance | - -### Method Summary -| Modifier and Type | Method and Description | -| ----------------- | ---------------------- | -| [Put00RequestBuilder](#put00requestbuilder) | queryParameters([FakebodywithqueryparamsPutQueryParametersQueryParametersMap](../../paths/fakebodywithqueryparams/put/FakebodywithqueryparamsPutQueryParameters.md#queryparametersmap) queryParameters)
sets the property | - -## Put10RequestBuilder -public static class Put10RequestBuilder
- -a builder for request inputs - -### Constructor Summary -| Constructor and Description | -| --------------------------- | -| Put10RequestBuilder(Put10RequestBuilder instance)
Creates a builder that contains the passed instance | - -### Method Summary -| Modifier and Type | Method and Description | -| ----------------- | ---------------------- | -| [Put00RequestBuilder](#put00requestbuilder) | requestBody([FakebodywithqueryparamsPutRequestBody.SealedRequestBody](../../paths/fakebodywithqueryparams/put/FakebodywithqueryparamsPutRequestBody.md#sealedrequestbody) requestBody)
sets the property | - -## PutRequestBuilder -public static class PutRequestBuilder
- -a builder for request inputs - -### Constructor Summary -| Constructor and Description | -| --------------------------- | -| PutRequestBuilder()
Creates a builder that contains null for all parameters | - -### Method Summary -| Modifier and Type | Method and Description | -| ----------------- | ---------------------- | -| [Put01RequestBuilder](#put01requestbuilder) | requestBody([FakebodywithqueryparamsPutRequestBody.SealedRequestBody](../../paths/fakebodywithqueryparams/put/FakebodywithqueryparamsPutRequestBody.md#sealedrequestbody) requestBody)
sets the property | -| [Put10RequestBuilder](#put10requestbuilder) | queryParameters([FakebodywithqueryparamsPutQueryParametersQueryParametersMap](../../paths/fakebodywithqueryparams/put/FakebodywithqueryparamsPutQueryParameters.md#queryparametersmap) queryParameters)
sets the property | - -[[Back to top]](#top) [[Back to README]](../../../README.md) diff --git a/samples/client/petstore/kotlin/docs/paths/fakebodywithqueryparams/put/FakebodywithqueryparamsPutQueryParameters.md b/samples/client/petstore/kotlin/docs/paths/fakebodywithqueryparams/put/FakebodywithqueryparamsPutQueryParameters.md deleted file mode 100644 index 017ab61c33a..00000000000 --- a/samples/client/petstore/kotlin/docs/paths/fakebodywithqueryparams/put/FakebodywithqueryparamsPutQueryParameters.md +++ /dev/null @@ -1,268 +0,0 @@ -# FakebodywithqueryparamsPutQueryParameters -public class FakebodywithqueryparamsPutQueryParameters
- -A class that contains necessary nested -- schema classes (which validate payloads), extends JsonSchema -- sealed interfaces which store validated payloads, java version of a sum type -- boxed classes which store validated payloads, sealed permits class implementations -- classes to store validated map payloads, extends FrozenMap -- classes to build inputs for map payloads - -## Nested Class Summary -| Modifier and Type | Class and Description | -| ----------------- | ---------------------- | -| sealed interface | [FakebodywithqueryparamsPutQueryParameters.FakebodywithqueryparamsPutQueryParameters1Boxed](#fakebodywithqueryparamsputqueryparameters1boxed)
sealed interface for validated payloads | -| record | [FakebodywithqueryparamsPutQueryParameters.FakebodywithqueryparamsPutQueryParameters1BoxedMap](#fakebodywithqueryparamsputqueryparameters1boxedmap)
boxed class to store validated Map payloads | -| static class | [FakebodywithqueryparamsPutQueryParameters.FakebodywithqueryparamsPutQueryParameters1](#fakebodywithqueryparamsputqueryparameters1)
schema class | -| static class | [FakebodywithqueryparamsPutQueryParameters.QueryParametersMapBuilder](#queryparametersmapbuilder)
builder for Map payloads | -| static class | [FakebodywithqueryparamsPutQueryParameters.QueryParametersMap](#queryparametersmap)
output class for Map payloads | -| sealed interface | [FakebodywithqueryparamsPutQueryParameters.AdditionalPropertiesBoxed](#additionalpropertiesboxed)
sealed interface for validated payloads | -| record | [FakebodywithqueryparamsPutQueryParameters.AdditionalPropertiesBoxedVoid](#additionalpropertiesboxedvoid)
boxed class to store validated null payloads | -| record | [FakebodywithqueryparamsPutQueryParameters.AdditionalPropertiesBoxedBoolean](#additionalpropertiesboxedboolean)
boxed class to store validated boolean payloads | -| record | [FakebodywithqueryparamsPutQueryParameters.AdditionalPropertiesBoxedNumber](#additionalpropertiesboxednumber)
boxed class to store validated Number payloads | -| record | [FakebodywithqueryparamsPutQueryParameters.AdditionalPropertiesBoxedString](#additionalpropertiesboxedstring)
boxed class to store validated String payloads | -| record | [FakebodywithqueryparamsPutQueryParameters.AdditionalPropertiesBoxedList](#additionalpropertiesboxedlist)
boxed class to store validated List payloads | -| record | [FakebodywithqueryparamsPutQueryParameters.AdditionalPropertiesBoxedMap](#additionalpropertiesboxedmap)
boxed class to store validated Map payloads | -| static class | [FakebodywithqueryparamsPutQueryParameters.AdditionalProperties](#additionalproperties)
schema class | - -## FakebodywithqueryparamsPutQueryParameters1Boxed -public sealed interface FakebodywithqueryparamsPutQueryParameters1Boxed
-permits
-[FakebodywithqueryparamsPutQueryParameters1BoxedMap](#fakebodywithqueryparamsputqueryparameters1boxedmap) - -sealed interface that stores validated payloads using boxed classes - -## FakebodywithqueryparamsPutQueryParameters1BoxedMap -public record FakebodywithqueryparamsPutQueryParameters1BoxedMap
-implements [FakebodywithqueryparamsPutQueryParameters1Boxed](#fakebodywithqueryparamsputqueryparameters1boxed) - -record that stores validated Map payloads, sealed permits implementation - -### Constructor Summary -| Constructor and Description | -| --------------------------- | -| FakebodywithqueryparamsPutQueryParameters1BoxedMap([QueryParametersMap](#queryparametersmap) data)
Creates an instance, private visibility | - -### Method Summary -| Modifier and Type | Method and Description | -| ----------------- | ---------------------- | -| [QueryParametersMap](#queryparametersmap) | data()
validated payload | -| @Nullable Object | getData()
validated payload | - -## FakebodywithqueryparamsPutQueryParameters1 -public static class FakebodywithqueryparamsPutQueryParameters1
-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.fakebodywithqueryparams.put.FakebodywithqueryparamsPutQueryParameters; - -import java.util.Arrays; -import java.util.List; -import java.util.AbstractMap; - -static final SchemaConfiguration configuration = new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().build()); - -// Map validation -FakebodywithqueryparamsPutQueryParameters.QueryParametersMap validatedPayload = - FakebodywithqueryparamsPutQueryParameters.FakebodywithqueryparamsPutQueryParameters1.validate( - new FakebodywithqueryparamsPutQueryParameters.QueryParametersMapBuilder() - .query("a") - - .build(), - configuration -); -``` - -### Field Summary -| Modifier and Type | Field and Description | -| ----------------- | ---------------------- | -| Set> | type = Set.of(Map.class) | -| Map> | properties = Map.ofEntries(
    new PropertyEntry("query", [Schema0.Schema01.class](../../../paths/fakebodywithqueryparams/put/parameters/parameter0/Schema0.md#schema01))
)
| -| Set | required = Set.of(
    "query"
)
| -| Class | additionalProperties = [AdditionalProperties.class](#additionalproperties) | - -### Method Summary -| Modifier and Type | Method and Description | -| ----------------- | ---------------------- | -| [QueryParametersMap](#queryparametersmap) | validate([Map<?, ?>](#queryparametersmapbuilder) arg, SchemaConfiguration configuration) | -| [FakebodywithqueryparamsPutQueryParameters1BoxedMap](#fakebodywithqueryparamsputqueryparameters1boxedmap) | validateAndBox([Map<?, ?>](#queryparametersmapbuilder) arg, SchemaConfiguration configuration) | -| [FakebodywithqueryparamsPutQueryParameters1Boxed](#fakebodywithqueryparamsputqueryparameters1boxed) | validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) | -| @Nullable Object | validate(@Nullable Object arg, SchemaConfiguration configuration) | - -## QueryParametersMap0Builder -public class QueryParametersMap0Builder
-builder for `Map` - -A class that builds the Map input type - -### Constructor Summary -| Constructor and Description | -| --------------------------- | -| QueryParametersMap0Builder(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 | - -## QueryParametersMapBuilder -public class QueryParametersMapBuilder
-builder for `Map` - -A class that builds the Map input type - -### Constructor Summary -| Constructor and Description | -| --------------------------- | -| QueryParametersMapBuilder()
Creates a builder that contains an empty map | - -### Method Summary -| Modifier and Type | Method and Description | -| ----------------- | ---------------------- | -| [QueryParametersMap0Builder](#queryparametersmap0builder) | query(String value) | - -## QueryParametersMap -public static class QueryParametersMap
-extends FrozenMap - -A class to store validated Map payloads - -### Method Summary -| Modifier and Type | Method and Description | -| ----------------- | ---------------------- | -| static [QueryParametersMap](#queryparametersmap) | of([Map](#queryparametersmapbuilder) arg, SchemaConfiguration configuration) | -| String | query()
| - -## 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(Nothing? data)
Creates an instance, private visibility | - -### Method Summary -| Modifier and Type | Method and Description | -| ----------------- | ---------------------- | -| Nothing? | 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/kotlin/docs/paths/fakebodywithqueryparams/put/FakebodywithqueryparamsPutRequestBody.md b/samples/client/petstore/kotlin/docs/paths/fakebodywithqueryparams/put/FakebodywithqueryparamsPutRequestBody.md deleted file mode 100644 index 43b883f655f..00000000000 --- a/samples/client/petstore/kotlin/docs/paths/fakebodywithqueryparams/put/FakebodywithqueryparamsPutRequestBody.md +++ /dev/null @@ -1,90 +0,0 @@ -# FakebodywithqueryparamsPutRequestBody - -public class FakebodywithqueryparamsPutRequestBody - -A class that contains necessary nested request body classes -- SealedMediaType, a sealed interface which contains all the schema/encoding info for each contentType -- records which implement SealedMediaType, the concrete media types -- a class that extends RequestBodySerializer and is used to serialize input SealedRequestBody instances -- SealedRequestBody, a sealed interface which contains all the contentType/schema input types -- records which implement SealedRequestBody, the concrete request body types - -## Nested Class Summary -| Modifier and Type | Class and Description | -| ----------------- | --------------------- | -| sealed interface | [FakebodywithqueryparamsPutRequestBody.SealedMediaType](#sealedmediatype)
media type sealed interface | -| record | [FakebodywithqueryparamsPutRequestBody.ApplicationjsonMediaType](#applicationjsonmediatype)
record storing schema + encoding for a specific contentType | -| static class | [FakebodywithqueryparamsPutRequestBody.FakebodywithqueryparamsPutRequestBody1](#fakebodywithqueryparamsputrequestbody1)
class that serializes request bodies | -| sealed interface | [FakebodywithqueryparamsPutRequestBody.SealedRequestBody](#sealedrequestbody)
request body sealed interface | -| record | [FakebodywithqueryparamsPutRequestBody.ApplicationjsonRequestBody](#applicationjsonrequestbody)
implements sealed interface to store request body input | - -## SealedMediaType -public sealed interface SealedMediaType
-permits
-[ApplicationjsonMediaType](#applicationjsonmediatype) - -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), Nothing?> - -class storing schema info for a specific contentType - -### Constructor Summary -| Constructor and Description | -| --------------------------- | -| ApplicationjsonMediaType()
Creates an instance | - -### 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 | -| Nothing? | encoding()
the encoding info | - -## FakebodywithqueryparamsPutRequestBody1 -public static class FakebodywithqueryparamsPutRequestBody1
- -a class that serializes SealedRequestBody request bodies - -### Constructor Summary -| Constructor and Description | -| --------------------------- | -| FakebodywithqueryparamsPutRequestBody1()
Creates an instance | - -### Field Summary -| Modifier and Type | Field and Description | -| ----------------- | --------------------- | -| boolean | required = true
whether the request body is required | -| 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 | -| ----------------- | ---------------------- | -| SerializedRequestBody | serialize([SealedRequestBody](#sealedrequestbody) requestBody)
called by endpoint when creating request body bytes | - -## SealedRequestBody -public sealed interface SealedRequestBody
-permits
-[ApplicationjsonRequestBody](#applicationjsonrequestbody) - -sealed interface that stores request contentType + validated schema data - -## ApplicationjsonRequestBody -public record ApplicationjsonRequestBody
-implements [SealedRequestBody](#sealedrequestbody),
-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 | - -### 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 | diff --git a/samples/client/petstore/kotlin/docs/paths/fakebodywithqueryparams/put/FakebodywithqueryparamsPutResponses.md b/samples/client/petstore/kotlin/docs/paths/fakebodywithqueryparams/put/FakebodywithqueryparamsPutResponses.md deleted file mode 100644 index edd318d56c6..00000000000 --- a/samples/client/petstore/kotlin/docs/paths/fakebodywithqueryparams/put/FakebodywithqueryparamsPutResponses.md +++ /dev/null @@ -1,29 +0,0 @@ -# FakebodywithqueryparamsPutResponses - -public class FakebodywithqueryparamsPutResponses - -A class that contains necessary responses classes -- a sealed interface, EndpointResponse, that stores endpoint responses -- records for each endpoint response - -## Nested Class Summary -| Modifier and Type | Class and Description | -| ----------------- | --------------------- | -| sealed interface | [EndpointResponse](#endpointresponse)
stores the endpoint responses | -| record | [EndpointFakebodywithqueryparamsPutCode200Response](#endpointfakebodywithqueryparamsputcode200response)
the response for 200 | - -## EndpointResponse -public sealed interface EndpointResponse permits
-[EndpointFakebodywithqueryparamsPutCode200Response](#endpointfakebodywithqueryparamsputcode200response) - -a sealed interface that stores endpoint responses - -## EndpointFakebodywithqueryparamsPutCode200Response -public record EndpointFakebodywithqueryparamsPutCode200Response( - HttpResponse response, - Nothing? body, - Nothing? headers -) implements EndpointResponse, ApiResponse
- -a class that stores an endpoint response - diff --git a/samples/client/petstore/kotlin/docs/paths/fakebodywithqueryparams/put/parameters/parameter0/Schema0.md b/samples/client/petstore/kotlin/docs/paths/fakebodywithqueryparams/put/parameters/parameter0/Schema0.md deleted file mode 100644 index 9ff90e0bc35..00000000000 --- a/samples/client/petstore/kotlin/docs/paths/fakebodywithqueryparams/put/parameters/parameter0/Schema0.md +++ /dev/null @@ -1,49 +0,0 @@ -# Schema0 -public class Schema0
- -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 - -## Nested Class Summary -| Modifier and Type | Class and Description | -| ----------------- | ---------------------- | -| sealed interface | [Schema0.Schema01Boxed](#schema01boxed)
sealed interface for validated payloads | -| record | [Schema0.Schema01BoxedString](#schema01boxedstring)
boxed class to store validated String payloads | -| static class | [Schema0.Schema01](#schema01)
schema class | - -## Schema01Boxed -public sealed interface Schema01Boxed
-permits
-[Schema01BoxedString](#schema01boxedstring) - -sealed interface that stores validated payloads using boxed classes - -## Schema01BoxedString -public record Schema01BoxedString
-implements [Schema01Boxed](#schema01boxed) - -record that stores validated String payloads, sealed permits implementation - -### Constructor Summary -| Constructor and Description | -| --------------------------- | -| Schema01BoxedString(String data)
Creates an instance, private visibility | - -### Method Summary -| Modifier and Type | Method and Description | -| ----------------- | ---------------------- | -| String | data()
validated payload | -| @Nullable Object | getData()
validated payload | - -## Schema01 -public static class Schema01
-extends StringJsonSchema.StringJsonSchema1 - -A schema class that validates payloads - -| Methods Inherited from class org.openapijsonschematools.client.schemas.StringJsonSchema.StringJsonSchema1 | -| ------------------------------------------------------------------ | -| validate | -| validateAndBox | diff --git a/samples/client/petstore/kotlin/docs/paths/fakebodywithqueryparams/put/requestbody/content/applicationjson/ApplicationjsonSchema.md b/samples/client/petstore/kotlin/docs/paths/fakebodywithqueryparams/put/requestbody/content/applicationjson/ApplicationjsonSchema.md deleted file mode 100644 index 87ec51870cc..00000000000 --- a/samples/client/petstore/kotlin/docs/paths/fakebodywithqueryparams/put/requestbody/content/applicationjson/ApplicationjsonSchema.md +++ /dev/null @@ -1,19 +0,0 @@ -# ApplicationjsonSchema -public class ApplicationjsonSchema
-extends [User1](../../../../../../components/schemas/User.md#user) - -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 - -## Nested Class Summary -| Modifier and Type | Class and Description | -| ----------------- | ---------------------- | -| static class | [ApplicationjsonSchema.ApplicationjsonSchema1](#applicationjsonschema1)
schema class | - -## ApplicationjsonSchema1 -public static class ApplicationjsonSchema1
-extends [User.User1](../../../../../../components/schemas/User.md#user1) - -A schema class that validates payloads diff --git a/samples/client/petstore/kotlin/docs/paths/fakebodywithqueryparams/put/responses/FakebodywithqueryparamsPutCode200Response.md b/samples/client/petstore/kotlin/docs/paths/fakebodywithqueryparams/put/responses/FakebodywithqueryparamsPutCode200Response.md deleted file mode 100644 index e6bbeac0a7b..00000000000 --- a/samples/client/petstore/kotlin/docs/paths/fakebodywithqueryparams/put/responses/FakebodywithqueryparamsPutCode200Response.md +++ /dev/null @@ -1,17 +0,0 @@ -# FakebodywithqueryparamsPutCode200Response - -public class FakebodywithqueryparamsPutCode200Response extends [SuccessDescriptionOnly](../../components/responses/SuccessDescriptionOnly.md) - -A class (extended from the $ref class) that contains necessary nested response classes -- a class that extends ResponseDeserializer and is used to deserialize responses - -## Nested Class Summary -| Modifier and Type | Class and Description | -| ----------------- | --------------------- | -| static class | [FakebodywithqueryparamsPutCode200Response.FakebodywithqueryparamsPutCode200Response1](#fakebodywithqueryparamsputcode200response1)
class that deserializes responses | - -## FakebodywithqueryparamsPutCode200Response1 -public static class FakebodywithqueryparamsPutCode200Response1 extends [SuccessDescriptionOnly1](../../components/responses/SuccessDescriptionOnly.md#successdescriptiononly1)
- -a class that deserializes responses, extended from the $ref class - diff --git a/samples/client/petstore/kotlin/docs/paths/fakecasesensitiveparams/FakecasesensitiveparamsPut.md b/samples/client/petstore/kotlin/docs/paths/fakecasesensitiveparams/FakecasesensitiveparamsPut.md deleted file mode 100644 index 2996f66f440..00000000000 --- a/samples/client/petstore/kotlin/docs/paths/fakecasesensitiveparams/FakecasesensitiveparamsPut.md +++ /dev/null @@ -1,189 +0,0 @@ -# FakecasesensitiveparamsPut - -public class FakecasesensitiveparamsPut - -A class that contains necessary endpoint classes -- a class that calls the endpoint method using the http verb -- a class that calls the endpoint method using the operationId name -- class(es) to store the request inputs -- builder(s) to set the request input data - -## Nested Class Summary -| Modifier and Type | Class and Description | -| ----------------- | --------------------- | -| static class | [Put](#put)
The class that has a put method to call the endpoint | -| interface | [CaseSensitiveParamsOperation](#casesensitiveparamsoperation)
The interface that has a caseSensitiveParams method to call the endpoint | -| static class | [PutRequest](#putrequest)
The final request inputs class | -| static class | [PutNullableRequest](#putnullablerequest)
The initial request inputs class | -| static class | [Put0RequestBuilder](#put0requestbuilder)
A builder for the request input class | -| static class | [PutRequestBuilder](#putrequestbuilder)
A builder for the request input class | - -## Put -public static class Put extends ApiClient.ApiClient1 implements PutOperation
- -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.fakecasesensitiveparams.put.FakecasesensitiveparamsPutQueryParameters; -import org.openapijsonschematools.client.servers.RootServer0; -import org.openapijsonschematools.client.servers.RootServer1; -import org.openapijsonschematools.client.servers.RootServer2; -import org.openapijsonschematools.client.paths.fakecasesensitiveparams.put.responses.FakecasesensitiveparamsPutCode200Response; -import org.openapijsonschematools.client.servers.RootServerInfo; -import org.openapijsonschematools.client.paths.fakecasesensitiveparams.FakecasesensitiveparamsPut; -import org.openapijsonschematools.client.paths.fakecasesensitiveparams.put.FakecasesensitiveparamsPutResponses; - -import java.io.IOException; -import java.util.Arrays; -import java.util.List; -import java.util.Map; -import java.util.AbstractMap; - -// if you want to use a server that is not SERVER_0 pass it in here and change the ServerIndex input below -ApiConfiguration.ServerInfo serverInfo = new ApiConfiguration.ServerInfoBuilder() - .rootServerInfo( - new RootServerInfo.RootServerInfoBuilder() - .rootServer0(new RootServer0()) - .build() - ) - .build(); -ApiConfiguration.ServerIndexInfo serverIndexInfo = new ApiConfiguration.ServerIndexInfoBuilder() - .rootServerInfoServerIndex(RootServerInfo.ServerIndex.SERVER_0) - .build(); -Duration timeout = Duration.ofSeconds(1L); -Map> defaultHeaders = Map.of("User-Agent", List.of("OpenAPI-JSON-Schema-Generator/1.0.0/java")); -ApiConfiguration apiConfiguration = new ApiConfiguration( - serverInfo - serverIndexInfo, - timeout, - defaultHeaders -); -SchemaConfiguration schemaConfiguration = new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().build()); -FakecasesensitiveparamsPut.Put apiClient = new FakecasesensitiveparamsPut.Put(apiConfiguration, schemaConfiguration); - - -// Map validation -FakecasesensitiveparamsPutQueryParameters.QueryParametersMap queryParameters = - FakecasesensitiveparamsPutQueryParameters.FakecasesensitiveparamsPutQueryParameters1.validate( - new FakecasesensitiveparamsPutQueryParameters.QueryParametersMapBuilder() - .SomeVar("a") - - .someVar("a") - - .some_var("a") - - .build(), - schemaConfiguration -); - -var request = new FakecasesensitiveparamsPut.PutRequestBuilder() - .queryParameters(queryParameters) - .build(); - -FakecasesensitiveparamsPutResponses.EndpointResponse response; -try { - response = apiClient.put(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; -} -FakecasesensitiveparamsPutResponses.EndpointFakecasesensitiveparamsPutCode200Response castResponse = (FakecasesensitiveparamsPutResponses.EndpointFakecasesensitiveparamsPutCode200Response) response; -``` -### Constructor Summary -| Constructor and Description | -| --------------------------- | -| Put(ApiConfiguration apiConfiguration, SchemaConfiguration schemaConfiguration)
Creates an instance | - -### Method Summary -| Modifier and Type | Method and Description | -| ----------------- | ---------------------- | -| [FakecasesensitiveparamsPutResponses.EndpointResponse](../../paths/fakecasesensitiveparams/put/FakecasesensitiveparamsPutResponses.md#endpointresponse) | put([PutRequest](#putrequest) request) | - -## CaseSensitiveParamsOperation -public interface CaseSensitiveParamsOperation
- -an interface that allows one to call the endpoint using a method named caseSensitiveParams by the operationId - -### Method Summary -| Modifier and Type | Method and Description | -| ----------------- | ---------------------- | -| [FakecasesensitiveparamsPutResponses.EndpointResponse](../../paths/fakecasesensitiveparams/put/FakecasesensitiveparamsPutResponses.md#endpointresponse) | caseSensitiveParams([PutRequest](#putrequest) request) | - -## PutRequest -public static class PutRequest
- -a class that stores the final request inputs - -### Field Summary -| Modifier and Type | Field and Description | -| ----------------- | --------------------- | -| [FakecasesensitiveparamsPutQueryParameters.QueryParametersMap](../../paths/fakecasesensitiveparams/put/FakecasesensitiveparamsPutQueryParameters.md#queryparametersmap) | queryParameters | -| [RootServerInfo.@Nullable ServerIndex](../../RootServerInfo.md#serverindex) | serverIndex
optional. Note: this will override the value in apiConfiguration | -| @Nullable Duration | timeout
optional. Note: this will override the value in apiConfiguration | - -## PutNullableRequest -public static class PutNullableRequest
- -a class that stores the initial request inputs - -### Field Summary -| Modifier and Type | Field and Description | -| ----------------- | --------------------- | -| [FakecasesensitiveparamsPutQueryParameters.@Nullable QueryParametersMap](../../paths/fakecasesensitiveparams/put/FakecasesensitiveparamsPutQueryParameters.md#queryparametersmap) | queryParameters | -| [RootServerInfo.@Nullable ServerIndex](../../RootServerInfo.md#serverindex) | serverIndex | -| @Nullable Duration | timeout | - -## Put0RequestBuilder -public static class Put0RequestBuilder
- -a builder for request inputs - -### Constructor Summary -| Constructor and Description | -| --------------------------- | -| Put0RequestBuilder(Put0RequestBuilder instance)
Creates a builder that contains the passed instance | - -### Method Summary -| Modifier and Type | Method and Description | -| ----------------- | ---------------------- | -| [PutRequest](#putrequest) | build()
Returns the request input used to call an endpoint method | -| [Put0RequestBuilder](#put0requestbuilder) | serverIndex([RootServerInfo.ServerIndex](../../RootServerInfo.md#serverindex) serverIndex)
sets the optional property. Note: this will override the value in apiConfiguration | -| [Put0RequestBuilder](#put0requestbuilder) | timeout(Duration timeout)
sets the optional property. Note: this will override the value in apiConfiguration | - -## PutRequestBuilder -public static class PutRequestBuilder
- -a builder for request inputs - -### Constructor Summary -| Constructor and Description | -| --------------------------- | -| PutRequestBuilder()
Creates a builder that contains null for all parameters | - -### Method Summary -| Modifier and Type | Method and Description | -| ----------------- | ---------------------- | -| [Put0RequestBuilder](#put0requestbuilder) | queryParameters([FakecasesensitiveparamsPutQueryParametersQueryParametersMap](../../paths/fakecasesensitiveparams/put/FakecasesensitiveparamsPutQueryParameters.md#queryparametersmap) queryParameters)
sets the property | - -[[Back to top]](#top) [[Back to README]](../../../README.md) diff --git a/samples/client/petstore/kotlin/docs/paths/fakecasesensitiveparams/put/FakecasesensitiveparamsPutQueryParameters.md b/samples/client/petstore/kotlin/docs/paths/fakecasesensitiveparams/put/FakecasesensitiveparamsPutQueryParameters.md deleted file mode 100644 index 2284e865bb5..00000000000 --- a/samples/client/petstore/kotlin/docs/paths/fakecasesensitiveparams/put/FakecasesensitiveparamsPutQueryParameters.md +++ /dev/null @@ -1,375 +0,0 @@ -# FakecasesensitiveparamsPutQueryParameters -public class FakecasesensitiveparamsPutQueryParameters
- -A class that contains necessary nested -- schema classes (which validate payloads), extends JsonSchema -- sealed interfaces which store validated payloads, java version of a sum type -- boxed classes which store validated payloads, sealed permits class implementations -- classes to store validated map payloads, extends FrozenMap -- classes to build inputs for map payloads - -## Nested Class Summary -| Modifier and Type | Class and Description | -| ----------------- | ---------------------- | -| sealed interface | [FakecasesensitiveparamsPutQueryParameters.FakecasesensitiveparamsPutQueryParameters1Boxed](#fakecasesensitiveparamsputqueryparameters1boxed)
sealed interface for validated payloads | -| record | [FakecasesensitiveparamsPutQueryParameters.FakecasesensitiveparamsPutQueryParameters1BoxedMap](#fakecasesensitiveparamsputqueryparameters1boxedmap)
boxed class to store validated Map payloads | -| static class | [FakecasesensitiveparamsPutQueryParameters.FakecasesensitiveparamsPutQueryParameters1](#fakecasesensitiveparamsputqueryparameters1)
schema class | -| static class | [FakecasesensitiveparamsPutQueryParameters.QueryParametersMapBuilder](#queryparametersmapbuilder)
builder for Map payloads | -| static class | [FakecasesensitiveparamsPutQueryParameters.QueryParametersMap](#queryparametersmap)
output class for Map payloads | -| sealed interface | [FakecasesensitiveparamsPutQueryParameters.AdditionalPropertiesBoxed](#additionalpropertiesboxed)
sealed interface for validated payloads | -| record | [FakecasesensitiveparamsPutQueryParameters.AdditionalPropertiesBoxedVoid](#additionalpropertiesboxedvoid)
boxed class to store validated null payloads | -| record | [FakecasesensitiveparamsPutQueryParameters.AdditionalPropertiesBoxedBoolean](#additionalpropertiesboxedboolean)
boxed class to store validated boolean payloads | -| record | [FakecasesensitiveparamsPutQueryParameters.AdditionalPropertiesBoxedNumber](#additionalpropertiesboxednumber)
boxed class to store validated Number payloads | -| record | [FakecasesensitiveparamsPutQueryParameters.AdditionalPropertiesBoxedString](#additionalpropertiesboxedstring)
boxed class to store validated String payloads | -| record | [FakecasesensitiveparamsPutQueryParameters.AdditionalPropertiesBoxedList](#additionalpropertiesboxedlist)
boxed class to store validated List payloads | -| record | [FakecasesensitiveparamsPutQueryParameters.AdditionalPropertiesBoxedMap](#additionalpropertiesboxedmap)
boxed class to store validated Map payloads | -| static class | [FakecasesensitiveparamsPutQueryParameters.AdditionalProperties](#additionalproperties)
schema class | - -## FakecasesensitiveparamsPutQueryParameters1Boxed -public sealed interface FakecasesensitiveparamsPutQueryParameters1Boxed
-permits
-[FakecasesensitiveparamsPutQueryParameters1BoxedMap](#fakecasesensitiveparamsputqueryparameters1boxedmap) - -sealed interface that stores validated payloads using boxed classes - -## FakecasesensitiveparamsPutQueryParameters1BoxedMap -public record FakecasesensitiveparamsPutQueryParameters1BoxedMap
-implements [FakecasesensitiveparamsPutQueryParameters1Boxed](#fakecasesensitiveparamsputqueryparameters1boxed) - -record that stores validated Map payloads, sealed permits implementation - -### Constructor Summary -| Constructor and Description | -| --------------------------- | -| FakecasesensitiveparamsPutQueryParameters1BoxedMap([QueryParametersMap](#queryparametersmap) data)
Creates an instance, private visibility | - -### Method Summary -| Modifier and Type | Method and Description | -| ----------------- | ---------------------- | -| [QueryParametersMap](#queryparametersmap) | data()
validated payload | -| @Nullable Object | getData()
validated payload | - -## FakecasesensitiveparamsPutQueryParameters1 -public static class FakecasesensitiveparamsPutQueryParameters1
-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.fakecasesensitiveparams.put.FakecasesensitiveparamsPutQueryParameters; - -import java.util.Arrays; -import java.util.List; -import java.util.AbstractMap; - -static final SchemaConfiguration configuration = new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().build()); - -// Map validation -FakecasesensitiveparamsPutQueryParameters.QueryParametersMap validatedPayload = - FakecasesensitiveparamsPutQueryParameters.FakecasesensitiveparamsPutQueryParameters1.validate( - new FakecasesensitiveparamsPutQueryParameters.QueryParametersMapBuilder() - .SomeVar("a") - - .someVar("a") - - .some_var("a") - - .build(), - configuration -); -``` - -### Field Summary -| Modifier and Type | Field and Description | -| ----------------- | ---------------------- | -| Set> | type = Set.of(Map.class) | -| Map> | properties = Map.ofEntries(
    new PropertyEntry("someVar", [Schema0.Schema01.class](../../../paths/fakecasesensitiveparams/put/parameters/parameter0/Schema0.md#schema01)),
    new PropertyEntry("some_var", [Schema2.Schema21.class](../../../paths/fakecasesensitiveparams/put/parameters/parameter2/Schema2.md#schema21)),
    new PropertyEntry("SomeVar", [Schema1.Schema11.class](../../../paths/fakecasesensitiveparams/put/parameters/parameter1/Schema1.md#schema11))
)
| -| Set | required = Set.of(
    "SomeVar",
    "someVar",
    "some_var"
)
| -| Class | additionalProperties = [AdditionalProperties.class](#additionalproperties) | - -### Method Summary -| Modifier and Type | Method and Description | -| ----------------- | ---------------------- | -| [QueryParametersMap](#queryparametersmap) | validate([Map<?, ?>](#queryparametersmapbuilder) arg, SchemaConfiguration configuration) | -| [FakecasesensitiveparamsPutQueryParameters1BoxedMap](#fakecasesensitiveparamsputqueryparameters1boxedmap) | validateAndBox([Map<?, ?>](#queryparametersmapbuilder) arg, SchemaConfiguration configuration) | -| [FakecasesensitiveparamsPutQueryParameters1Boxed](#fakecasesensitiveparamsputqueryparameters1boxed) | validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) | -| @Nullable Object | validate(@Nullable Object arg, SchemaConfiguration configuration) | - -## QueryParametersMap000Builder -public class QueryParametersMap000Builder
-builder for `Map` - -A class that builds the Map input type - -### Constructor Summary -| Constructor and Description | -| --------------------------- | -| QueryParametersMap000Builder(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 | - -## QueryParametersMap001Builder -public class QueryParametersMap001Builder
-builder for `Map` - -A class that builds the Map input type - -### Constructor Summary -| Constructor and Description | -| --------------------------- | -| QueryParametersMap001Builder(Map instance)
Creates a builder that contains the passed instance | - -### Method Summary -| Modifier and Type | Method and Description | -| ----------------- | ---------------------- | -| [QueryParametersMap000Builder](#queryparametersmap000builder) | some_var(String value) | - -## QueryParametersMap010Builder -public class QueryParametersMap010Builder
-builder for `Map` - -A class that builds the Map input type - -### Constructor Summary -| Constructor and Description | -| --------------------------- | -| QueryParametersMap010Builder(Map instance)
Creates a builder that contains the passed instance | - -### Method Summary -| Modifier and Type | Method and Description | -| ----------------- | ---------------------- | -| [QueryParametersMap000Builder](#queryparametersmap000builder) | someVar(String value) | - -## QueryParametersMap011Builder -public class QueryParametersMap011Builder
-builder for `Map` - -A class that builds the Map input type - -### Constructor Summary -| Constructor and Description | -| --------------------------- | -| QueryParametersMap011Builder(Map instance)
Creates a builder that contains the passed instance | - -### Method Summary -| Modifier and Type | Method and Description | -| ----------------- | ---------------------- | -| [QueryParametersMap001Builder](#queryparametersmap001builder) | someVar(String value) | -| [QueryParametersMap010Builder](#queryparametersmap010builder) | some_var(String value) | - -## QueryParametersMap100Builder -public class QueryParametersMap100Builder
-builder for `Map` - -A class that builds the Map input type - -### Constructor Summary -| Constructor and Description | -| --------------------------- | -| QueryParametersMap100Builder(Map instance)
Creates a builder that contains the passed instance | - -### Method Summary -| Modifier and Type | Method and Description | -| ----------------- | ---------------------- | -| [QueryParametersMap000Builder](#queryparametersmap000builder) | SomeVar(String value) | - -## QueryParametersMap101Builder -public class QueryParametersMap101Builder
-builder for `Map` - -A class that builds the Map input type - -### Constructor Summary -| Constructor and Description | -| --------------------------- | -| QueryParametersMap101Builder(Map instance)
Creates a builder that contains the passed instance | - -### Method Summary -| Modifier and Type | Method and Description | -| ----------------- | ---------------------- | -| [QueryParametersMap001Builder](#queryparametersmap001builder) | SomeVar(String value) | -| [QueryParametersMap100Builder](#queryparametersmap100builder) | some_var(String value) | - -## QueryParametersMap110Builder -public class QueryParametersMap110Builder
-builder for `Map` - -A class that builds the Map input type - -### Constructor Summary -| Constructor and Description | -| --------------------------- | -| QueryParametersMap110Builder(Map instance)
Creates a builder that contains the passed instance | - -### Method Summary -| Modifier and Type | Method and Description | -| ----------------- | ---------------------- | -| [QueryParametersMap010Builder](#queryparametersmap010builder) | SomeVar(String value) | -| [QueryParametersMap100Builder](#queryparametersmap100builder) | someVar(String value) | - -## QueryParametersMapBuilder -public class QueryParametersMapBuilder
-builder for `Map` - -A class that builds the Map input type - -### Constructor Summary -| Constructor and Description | -| --------------------------- | -| QueryParametersMapBuilder()
Creates a builder that contains an empty map | - -### Method Summary -| Modifier and Type | Method and Description | -| ----------------- | ---------------------- | -| [QueryParametersMap011Builder](#queryparametersmap011builder) | SomeVar(String value) | -| [QueryParametersMap101Builder](#queryparametersmap101builder) | someVar(String value) | -| [QueryParametersMap110Builder](#queryparametersmap110builder) | some_var(String value) | - -## QueryParametersMap -public static class QueryParametersMap
-extends FrozenMap - -A class to store validated Map payloads - -### Method Summary -| Modifier and Type | Method and Description | -| ----------------- | ---------------------- | -| static [QueryParametersMap](#queryparametersmap) | of([Map](#queryparametersmapbuilder) arg, SchemaConfiguration configuration) | -| String | SomeVar()
| -| String | someVar()
| -| String | some_var()
| - -## 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(Nothing? data)
Creates an instance, private visibility | - -### Method Summary -| Modifier and Type | Method and Description | -| ----------------- | ---------------------- | -| Nothing? | 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/kotlin/docs/paths/fakecasesensitiveparams/put/FakecasesensitiveparamsPutResponses.md b/samples/client/petstore/kotlin/docs/paths/fakecasesensitiveparams/put/FakecasesensitiveparamsPutResponses.md deleted file mode 100644 index f28ec994333..00000000000 --- a/samples/client/petstore/kotlin/docs/paths/fakecasesensitiveparams/put/FakecasesensitiveparamsPutResponses.md +++ /dev/null @@ -1,29 +0,0 @@ -# FakecasesensitiveparamsPutResponses - -public class FakecasesensitiveparamsPutResponses - -A class that contains necessary responses classes -- a sealed interface, EndpointResponse, that stores endpoint responses -- records for each endpoint response - -## Nested Class Summary -| Modifier and Type | Class and Description | -| ----------------- | --------------------- | -| sealed interface | [EndpointResponse](#endpointresponse)
stores the endpoint responses | -| record | [EndpointFakecasesensitiveparamsPutCode200Response](#endpointfakecasesensitiveparamsputcode200response)
the response for 200 | - -## EndpointResponse -public sealed interface EndpointResponse permits
-[EndpointFakecasesensitiveparamsPutCode200Response](#endpointfakecasesensitiveparamsputcode200response) - -a sealed interface that stores endpoint responses - -## EndpointFakecasesensitiveparamsPutCode200Response -public record EndpointFakecasesensitiveparamsPutCode200Response( - HttpResponse response, - Nothing? body, - Nothing? headers -) implements EndpointResponse, ApiResponse
- -a class that stores an endpoint response - diff --git a/samples/client/petstore/kotlin/docs/paths/fakecasesensitiveparams/put/parameters/parameter0/Schema0.md b/samples/client/petstore/kotlin/docs/paths/fakecasesensitiveparams/put/parameters/parameter0/Schema0.md deleted file mode 100644 index 9ff90e0bc35..00000000000 --- a/samples/client/petstore/kotlin/docs/paths/fakecasesensitiveparams/put/parameters/parameter0/Schema0.md +++ /dev/null @@ -1,49 +0,0 @@ -# Schema0 -public class Schema0
- -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 - -## Nested Class Summary -| Modifier and Type | Class and Description | -| ----------------- | ---------------------- | -| sealed interface | [Schema0.Schema01Boxed](#schema01boxed)
sealed interface for validated payloads | -| record | [Schema0.Schema01BoxedString](#schema01boxedstring)
boxed class to store validated String payloads | -| static class | [Schema0.Schema01](#schema01)
schema class | - -## Schema01Boxed -public sealed interface Schema01Boxed
-permits
-[Schema01BoxedString](#schema01boxedstring) - -sealed interface that stores validated payloads using boxed classes - -## Schema01BoxedString -public record Schema01BoxedString
-implements [Schema01Boxed](#schema01boxed) - -record that stores validated String payloads, sealed permits implementation - -### Constructor Summary -| Constructor and Description | -| --------------------------- | -| Schema01BoxedString(String data)
Creates an instance, private visibility | - -### Method Summary -| Modifier and Type | Method and Description | -| ----------------- | ---------------------- | -| String | data()
validated payload | -| @Nullable Object | getData()
validated payload | - -## Schema01 -public static class Schema01
-extends StringJsonSchema.StringJsonSchema1 - -A schema class that validates payloads - -| Methods Inherited from class org.openapijsonschematools.client.schemas.StringJsonSchema.StringJsonSchema1 | -| ------------------------------------------------------------------ | -| validate | -| validateAndBox | diff --git a/samples/client/petstore/kotlin/docs/paths/fakecasesensitiveparams/put/parameters/parameter1/Schema1.md b/samples/client/petstore/kotlin/docs/paths/fakecasesensitiveparams/put/parameters/parameter1/Schema1.md deleted file mode 100644 index 63ec3a884fc..00000000000 --- a/samples/client/petstore/kotlin/docs/paths/fakecasesensitiveparams/put/parameters/parameter1/Schema1.md +++ /dev/null @@ -1,49 +0,0 @@ -# Schema1 -public class Schema1
- -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 - -## Nested Class Summary -| Modifier and Type | Class and Description | -| ----------------- | ---------------------- | -| sealed interface | [Schema1.Schema11Boxed](#schema11boxed)
sealed interface for validated payloads | -| record | [Schema1.Schema11BoxedString](#schema11boxedstring)
boxed class to store validated String payloads | -| static class | [Schema1.Schema11](#schema11)
schema class | - -## Schema11Boxed -public sealed interface Schema11Boxed
-permits
-[Schema11BoxedString](#schema11boxedstring) - -sealed interface that stores validated payloads using boxed classes - -## Schema11BoxedString -public record Schema11BoxedString
-implements [Schema11Boxed](#schema11boxed) - -record that stores validated String payloads, sealed permits implementation - -### Constructor Summary -| Constructor and Description | -| --------------------------- | -| Schema11BoxedString(String data)
Creates an instance, private visibility | - -### Method Summary -| Modifier and Type | Method and Description | -| ----------------- | ---------------------- | -| String | data()
validated payload | -| @Nullable Object | getData()
validated payload | - -## Schema11 -public static class Schema11
-extends StringJsonSchema.StringJsonSchema1 - -A schema class that validates payloads - -| Methods Inherited from class org.openapijsonschematools.client.schemas.StringJsonSchema.StringJsonSchema1 | -| ------------------------------------------------------------------ | -| validate | -| validateAndBox | diff --git a/samples/client/petstore/kotlin/docs/paths/fakecasesensitiveparams/put/parameters/parameter2/Schema2.md b/samples/client/petstore/kotlin/docs/paths/fakecasesensitiveparams/put/parameters/parameter2/Schema2.md deleted file mode 100644 index 4a7d57953eb..00000000000 --- a/samples/client/petstore/kotlin/docs/paths/fakecasesensitiveparams/put/parameters/parameter2/Schema2.md +++ /dev/null @@ -1,49 +0,0 @@ -# Schema2 -public class Schema2
- -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 - -## Nested Class Summary -| Modifier and Type | Class and Description | -| ----------------- | ---------------------- | -| sealed interface | [Schema2.Schema21Boxed](#schema21boxed)
sealed interface for validated payloads | -| record | [Schema2.Schema21BoxedString](#schema21boxedstring)
boxed class to store validated String payloads | -| static class | [Schema2.Schema21](#schema21)
schema class | - -## Schema21Boxed -public sealed interface Schema21Boxed
-permits
-[Schema21BoxedString](#schema21boxedstring) - -sealed interface that stores validated payloads using boxed classes - -## Schema21BoxedString -public record Schema21BoxedString
-implements [Schema21Boxed](#schema21boxed) - -record that stores validated String payloads, sealed permits implementation - -### Constructor Summary -| Constructor and Description | -| --------------------------- | -| Schema21BoxedString(String data)
Creates an instance, private visibility | - -### Method Summary -| Modifier and Type | Method and Description | -| ----------------- | ---------------------- | -| String | data()
validated payload | -| @Nullable Object | getData()
validated payload | - -## Schema21 -public static class Schema21
-extends StringJsonSchema.StringJsonSchema1 - -A schema class that validates payloads - -| Methods Inherited from class org.openapijsonschematools.client.schemas.StringJsonSchema.StringJsonSchema1 | -| ------------------------------------------------------------------ | -| validate | -| validateAndBox | diff --git a/samples/client/petstore/kotlin/docs/paths/fakecasesensitiveparams/put/responses/FakecasesensitiveparamsPutCode200Response.md b/samples/client/petstore/kotlin/docs/paths/fakecasesensitiveparams/put/responses/FakecasesensitiveparamsPutCode200Response.md deleted file mode 100644 index 2ec9adb95bd..00000000000 --- a/samples/client/petstore/kotlin/docs/paths/fakecasesensitiveparams/put/responses/FakecasesensitiveparamsPutCode200Response.md +++ /dev/null @@ -1,17 +0,0 @@ -# FakecasesensitiveparamsPutCode200Response - -public class FakecasesensitiveparamsPutCode200Response extends [SuccessDescriptionOnly](../../components/responses/SuccessDescriptionOnly.md) - -A class (extended from the $ref class) that contains necessary nested response classes -- a class that extends ResponseDeserializer and is used to deserialize responses - -## Nested Class Summary -| Modifier and Type | Class and Description | -| ----------------- | --------------------- | -| static class | [FakecasesensitiveparamsPutCode200Response.FakecasesensitiveparamsPutCode200Response1](#fakecasesensitiveparamsputcode200response1)
class that deserializes responses | - -## FakecasesensitiveparamsPutCode200Response1 -public static class FakecasesensitiveparamsPutCode200Response1 extends [SuccessDescriptionOnly1](../../components/responses/SuccessDescriptionOnly.md#successdescriptiononly1)
- -a class that deserializes responses, extended from the $ref class - diff --git a/samples/client/petstore/kotlin/docs/paths/fakeclassnametest/FakeclassnametestPatch.md b/samples/client/petstore/kotlin/docs/paths/fakeclassnametest/FakeclassnametestPatch.md deleted file mode 100644 index 1adc69788e6..00000000000 --- a/samples/client/petstore/kotlin/docs/paths/fakeclassnametest/FakeclassnametestPatch.md +++ /dev/null @@ -1,203 +0,0 @@ -# FakeclassnametestPatch - -public class FakeclassnametestPatch - -A class that contains necessary endpoint classes -- a class that calls the endpoint method using the http verb -- a class that calls the endpoint method using the operationId name -- class(es) to store the request inputs -- builder(s) to set the request input data - -## Nested Class Summary -| Modifier and Type | Class and Description | -| ----------------- | --------------------- | -| static class | [Patch](#patch)
The class that has a patch method to call the endpoint | -| interface | [ClassnameOperation](#classnameoperation)
The interface that has a classname method to call the endpoint | -| static class | [PatchRequest](#patchrequest)
The final request inputs class | -| static class | [PatchNullableRequest](#patchnullablerequest)
The initial request inputs class | -| static class | [Patch0RequestBuilder](#patch0requestbuilder)
A builder for the request input class | -| static class | [PatchRequestBuilder](#patchrequestbuilder)
A builder for the request input class | - -## Patch -public static class Patch extends ApiClient.ApiClient1 implements PatchOperation
- -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.fakeclassnametest.patch.FakeclassnametestPatchSecurityInfo; -import org.openapijsonschematools.client.paths.fakeclassnametest.patch.FakeclassnametestPatchRequestBody; -import org.openapijsonschematools.client.components.schemas.Client; -import org.openapijsonschematools.client.servers.RootServer0; -import org.openapijsonschematools.client.servers.RootServer1; -import org.openapijsonschematools.client.servers.RootServer2; -import org.openapijsonschematools.client.securityschemes.SecurityScheme; -import org.openapijsonschematools.client.components.securityschemes.ApiKeyQuery; -import org.openapijsonschematools.client.paths.fakeclassnametest.patch.responses.FakeclassnametestPatchCode200Response; -import org.openapijsonschematools.client.servers.RootServerInfo; -import org.openapijsonschematools.client.paths.fakeclassnametest.FakeclassnametestPatch; -import org.openapijsonschematools.client.paths.fakeclassnametest.patch.FakeclassnametestPatchResponses; - -import java.io.IOException; -import java.util.Arrays; -import java.util.List; -import java.util.Map; -import java.util.AbstractMap; - -// if you want to use a server that is not SERVER_0 pass it in here and change the ServerIndex input below -ApiConfiguration.ServerInfo serverInfo = new ApiConfiguration.ServerInfoBuilder() - .rootServerInfo( - new RootServerInfo.RootServerInfoBuilder() - .rootServer0(new RootServer0()) - .build() - ) - .build(); -ApiConfiguration.ServerIndexInfo serverIndexInfo = new ApiConfiguration.ServerIndexInfoBuilder() - .rootServerInfoServerIndex(RootServerInfo.ServerIndex.SERVER_0) - .build(); -List securitySchemes = new ArrayList(); -securitySchemes.add( - new ApiKeyQuery("someApiKey"); -); -ApiConfiguration.SecurityIndexInfo securityIndexInfo = new ApiConfiguration.SecurityIndexInfoBuilder() - .fakeclassnametestPatchSecurityRequirementObject0SecurityIndex(FakeclassnametestPatchSecurityRequirementObject0.SecurityIndex.SECURITY_0) - .build(); -Duration timeout = Duration.ofSeconds(1L); -Map> defaultHeaders = Map.of("User-Agent", List.of("OpenAPI-JSON-Schema-Generator/1.0.0/java")); -ApiConfiguration apiConfiguration = new ApiConfiguration( - serverInfo - serverIndexInfo, - securitySchemes, - securityIndexInfo, - timeout, - defaultHeaders -); -SchemaConfiguration schemaConfiguration = new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().build()); -FakeclassnametestPatch.Patch apiClient = new FakeclassnametestPatch.Patch(apiConfiguration, schemaConfiguration); - - -Client1BoxedMap requestBodyPayload = - Client.Client1.validateAndBox( - new Client.ClientMapBuilder1() - .client("a") - - .build(), - schemaConfiguration -); -FakeclassnametestPatchRequestBody.SealedRequestBody requestBody = new FakeclassnametestPatchRequestBody.ApplicationjsonRequestBody(requestBodyPayload); - -var request = new FakeclassnametestPatch.PatchRequestBuilder() - .requestBody(requestBody) - .build(); - -FakeclassnametestPatchResponses.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; -} -FakeclassnametestPatchResponses.EndpointFakeclassnametestPatchCode200Response castResponse = (FakeclassnametestPatchResponses.EndpointFakeclassnametestPatchCode200Response) response; -FakeclassnametestPatchCode200Response.ApplicationjsonResponseBody deserializedBody = (FakeclassnametestPatchCode200Response.ApplicationjsonResponseBody) castResponse.body; -// handle deserialized body here -``` -### Constructor Summary -| Constructor and Description | -| --------------------------- | -| Patch(ApiConfiguration apiConfiguration, SchemaConfiguration schemaConfiguration)
Creates an instance | - -### Method Summary -| Modifier and Type | Method and Description | -| ----------------- | ---------------------- | -| [FakeclassnametestPatchResponses.EndpointResponse](../../paths/fakeclassnametest/patch/FakeclassnametestPatchResponses.md#endpointresponse) | patch([PatchRequest](#patchrequest) request) | - -## ClassnameOperation -public interface ClassnameOperation
- -an interface that allows one to call the endpoint using a method named classname by the operationId - -### Method Summary -| Modifier and Type | Method and Description | -| ----------------- | ---------------------- | -| [FakeclassnametestPatchResponses.EndpointResponse](../../paths/fakeclassnametest/patch/FakeclassnametestPatchResponses.md#endpointresponse) | classname([PatchRequest](#patchrequest) request) | - -## PatchRequest -public static class PatchRequest
- -a class that stores the final request inputs - -### Field Summary -| Modifier and Type | Field and Description | -| ----------------- | --------------------- | -| [FakeclassnametestPatchRequestBody.SealedRequestBody](../../paths/fakeclassnametest/patch/FakeclassnametestPatchRequestBody.md#sealedrequestbody) | requestBody | -| [RootServerInfo.@Nullable ServerIndex](../../RootServerInfo.md#serverindex) | serverIndex
optional. Note: this will override the value in apiConfiguration | -| [FakeclassnametestPatchSecurityInfo.@Nullable SecurityIndex](../../paths/fakeclassnametest/patch/FakeclassnametestPatchSecurityInfo.md#securityindex) | securityIndex
optional. Note: this will override the value in apiConfiguration | -| @Nullable Duration | timeout
optional. Note: this will override the value in apiConfiguration | - -## PatchNullableRequest -public static class PatchNullableRequest
- -a class that stores the initial request inputs - -### Field Summary -| Modifier and Type | Field and Description | -| ----------------- | --------------------- | -| [FakeclassnametestPatchRequestBody.@Nullable SealedRequestBody](../../paths/fakeclassnametest/patch/FakeclassnametestPatchRequestBody.md#sealedrequestbody) | requestBody | -| [RootServerInfo.@Nullable ServerIndex](../../RootServerInfo.md#serverindex) | serverIndex | -| [FakeclassnametestPatchSecurityInfo.@Nullable SecurityIndex](../../paths/fakeclassnametest/patch/FakeclassnametestPatchSecurityInfo.md#securityindex) | securityIndex | -| @Nullable Duration | timeout | - -## Patch0RequestBuilder -public static class Patch0RequestBuilder
- -a builder for request inputs - -### Constructor Summary -| Constructor and Description | -| --------------------------- | -| Patch0RequestBuilder(Patch0RequestBuilder instance)
Creates a builder that contains the passed instance | - -### Method Summary -| Modifier and Type | Method and Description | -| ----------------- | ---------------------- | -| [PatchRequest](#patchrequest) | build()
Returns the request input used to call an endpoint method | -| [Patch0RequestBuilder](#patch0requestbuilder) | serverIndex([RootServerInfo.ServerIndex](../../RootServerInfo.md#serverindex) serverIndex)
sets the optional property. Note: this will override the value in apiConfiguration | -| [Patch0RequestBuilder](#patch0requestbuilder) | securityIndex([FakeclassnametestPatchSecurityInfo.SecurityIndex](../../paths/fakeclassnametest/patch/FakeclassnametestPatchSecurityInfo.md#securityindex) securityIndex)
sets the optional property. Note: this will override the value in apiConfiguration | -| [Patch0RequestBuilder](#patch0requestbuilder) | timeout(Duration timeout)
sets the optional property. Note: this will override the value in apiConfiguration | - -## PatchRequestBuilder -public static class PatchRequestBuilder
- -a builder for request inputs - -### Constructor Summary -| Constructor and Description | -| --------------------------- | -| PatchRequestBuilder()
Creates a builder that contains null for all parameters | - -### Method Summary -| Modifier and Type | Method and Description | -| ----------------- | ---------------------- | -| [Patch0RequestBuilder](#patch0requestbuilder) | requestBody([FakeclassnametestPatchRequestBody.SealedRequestBody](../../paths/fakeclassnametest/patch/FakeclassnametestPatchRequestBody.md#sealedrequestbody) requestBody)
sets the property | - -[[Back to top]](#top) [[Back to README]](../../../README.md) diff --git a/samples/client/petstore/kotlin/docs/paths/fakeclassnametest/patch/FakeclassnametestPatchRequestBody.md b/samples/client/petstore/kotlin/docs/paths/fakeclassnametest/patch/FakeclassnametestPatchRequestBody.md deleted file mode 100644 index ee0772ceed2..00000000000 --- a/samples/client/petstore/kotlin/docs/paths/fakeclassnametest/patch/FakeclassnametestPatchRequestBody.md +++ /dev/null @@ -1,17 +0,0 @@ -# FakeclassnametestPatchRequestBody - -public class FakeclassnametestPatchRequestBody 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 - -## Nested Class Summary -| Modifier and Type | Class and Description | -| ----------------- | --------------------- | -| static class | [FakeclassnametestPatchRequestBody.FakeclassnametestPatchRequestBody1](#fakeclassnametestpatchrequestbody1)
class that serializes request bodies | - -## FakeclassnametestPatchRequestBody1 -public static class FakeclassnametestPatchRequestBody1 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/kotlin/docs/paths/fakeclassnametest/patch/FakeclassnametestPatchResponses.md b/samples/client/petstore/kotlin/docs/paths/fakeclassnametest/patch/FakeclassnametestPatchResponses.md deleted file mode 100644 index 275f4b1980c..00000000000 --- a/samples/client/petstore/kotlin/docs/paths/fakeclassnametest/patch/FakeclassnametestPatchResponses.md +++ /dev/null @@ -1,29 +0,0 @@ -# FakeclassnametestPatchResponses - -public class FakeclassnametestPatchResponses - -A class that contains necessary responses classes -- a sealed interface, EndpointResponse, that stores endpoint responses -- records for each endpoint response - -## Nested Class Summary -| Modifier and Type | Class and Description | -| ----------------- | --------------------- | -| sealed interface | [EndpointResponse](#endpointresponse)
stores the endpoint responses | -| record | [EndpointFakeclassnametestPatchCode200Response](#endpointfakeclassnametestpatchcode200response)
the response for 200 | - -## EndpointResponse -public sealed interface EndpointResponse permits
-[EndpointFakeclassnametestPatchCode200Response](#endpointfakeclassnametestpatchcode200response) - -a sealed interface that stores endpoint responses - -## EndpointFakeclassnametestPatchCode200Response -public record EndpointFakeclassnametestPatchCode200Response( - HttpResponse response, - [FakeclassnametestPatchCode200Response.SealedResponseBody](../../../paths/fakeclassnametest/patch/responses/FakeclassnametestPatchCode200Response.md#sealedresponsebody) body, - Nothing? headers -) implements EndpointResponse, ApiResponse
- -a class that stores an endpoint response - diff --git a/samples/client/petstore/kotlin/docs/paths/fakeclassnametest/patch/FakeclassnametestPatchSecurityInfo.md b/samples/client/petstore/kotlin/docs/paths/fakeclassnametest/patch/FakeclassnametestPatchSecurityInfo.md deleted file mode 100644 index 3e252e7cdd7..00000000000 --- a/samples/client/petstore/kotlin/docs/paths/fakeclassnametest/patch/FakeclassnametestPatchSecurityInfo.md +++ /dev/null @@ -1,40 +0,0 @@ -# FakeclassnametestPatchSecurityInfo -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 -- an enum class that describes security index values - -## Nested Class Summary -| Modifier and Type | Class and Description | -| ----------------- | --------------------- | -| static class | [FakeclassnametestPatchSecurityInfo.FakeclassnametestPatchSecurityInfo1](#fakeclassnametestpatchsecurityinfo1)
SecurityRequirementObjectProvider -| enum | [FakeclassnametestPatchSecurityInfo.SecurityIndex](#securityindex)
class that stores a security index | - -## FakeclassnametestPatchSecurityInfo1 -implements SecurityRequirementObjectProvider<[SecurityIndex](#securityindex)> - -### Constructor Summary -| Constructor and Description | -| --------------------------- | -| FakeclassnametestPatchSecurityInfo1()
Creates an instance | - -### Field Summary -| Modifier and Type | Field and Description | -| ----------------- | --------------------- | -| [FakeclassnametestPatchSecurityRequirementObject0](../../../paths/fakeclassnametest/patch/security/FakeclassnametestPatchSecurityRequirementObject0.md) | security0 | - -### Method Summary -| Modifier and Type | Method and Description | -| ----------------- | ---------------------- | -| SecurityRequirementObject | getSecurityRequirementObject(@Nullable [SecurityIndex](#securityindex) securityIndex)
If null is input, then the instance's securityIndex will be used | - -## SecurityIndex -enum SecurityIndex
- -### Enum Constant Summary -| Enum Constant And Description | -| ----------------------------- | -| SECURITY_0
security 0 | diff --git a/samples/client/petstore/kotlin/docs/paths/fakeclassnametest/patch/responses/FakeclassnametestPatchCode200Response.md b/samples/client/petstore/kotlin/docs/paths/fakeclassnametest/patch/responses/FakeclassnametestPatchCode200Response.md deleted file mode 100644 index b2832a09530..00000000000 --- a/samples/client/petstore/kotlin/docs/paths/fakeclassnametest/patch/responses/FakeclassnametestPatchCode200Response.md +++ /dev/null @@ -1,87 +0,0 @@ -# FakeclassnametestPatchCode200Response - -public class FakeclassnametestPatchCode200Response - -A class that contains necessary nested response classes -- SealedMediaType, a sealed interface which contains all the schema/encoding info for each contentType -- records which implement SealedMediaType, the concrete media types -- SealedResponseBody, a sealed interface which contains all the contentType/schema types -- records which implement SealedResponseBody, the concrete response body types -- a class that extends ResponseDeserializer and is used to deserialize responses - -## Nested Class Summary -| Modifier and Type | Class and Description | -| ----------------- | --------------------- | -| sealed interface | [FakeclassnametestPatchCode200Response.SealedMediaType](#sealedmediatype)
media type sealed interface | -| record | [FakeclassnametestPatchCode200Response.ApplicationjsonMediaType](#applicationjsonmediatype)
record storing schema + encoding for a specific contentType | -| sealed interface | [FakeclassnametestPatchCode200Response.SealedResponseBody](#sealedresponsebody)
response body sealed interface | -| record | [FakeclassnametestPatchCode200Response.ApplicationjsonResponseBody](#applicationjsonresponsebody)
implements sealed interface to store response body | -| static class | [FakeclassnametestPatchCode200Response.FakeclassnametestPatchCode200Response1](#fakeclassnametestpatchcode200response1)
class that deserializes responses | - -## SealedMediaType -public sealed interface SealedMediaType
-permits
-[ApplicationjsonMediaType](#applicationjsonmediatype) - -sealed interface that stores schema and encoding info - -## ApplicationjsonMediaType -public record ApplicationjsonMediaType
-implements [SealedMediaType](#sealedmediatype), MediaType<[ApplicationjsonSchema.ApplicationjsonSchema1](../../../../paths/fakeclassnametest/patch/responses/code200response/content/applicationjson/ApplicationjsonSchema.md#applicationjsonschema1), Nothing?> - -class storing schema info for a specific contentType - -### Constructor Summary -| Constructor and Description | -| --------------------------- | -| ApplicationjsonMediaType()
Creates an instance | - -### Method Summary -| Modifier and Type | Method and Description | -| ----------------- | ---------------------- | -| [ApplicationjsonSchema.ApplicationjsonSchema1](../../../../paths/fakeclassnametest/patch/responses/code200response/content/applicationjson/ApplicationjsonSchema.md#applicationjsonschema1) | schema()
the schema for this MediaType | -| Nothing? | encoding()
the encoding info | - -## SealedResponseBody -public sealed interface SealedResponseBody
-permits
-[ApplicationjsonResponseBody](#applicationjsonresponsebody) - -sealed interface that stores response body - -## ApplicationjsonResponseBody -public record ApplicationjsonResponseBody
-implements [SealedResponseBody](#sealedresponsebody) - -A record class to store response body for contentType="application/json" - -### Constructor Summary -| Constructor and Description | -| --------------------------- | -| ApplicationjsonResponseBody(ApplicationjsonSchema.[Client1Boxed](../../../../components/schemas/Client.md#client1boxed) body)
Creates an instance | - -### Method Summary -| Modifier and Type | Method and Description | -| ----------------- | ---------------------- | -| ApplicationjsonSchema.[Client1Boxed](../../../../components/schemas/Client.md#client1boxed) | body()
returns the body passed in in the constructor | - -## FakeclassnametestPatchCode200Response1 -public static class FakeclassnametestPatchCode200Response1
-extends ResponseDeserializer<[SealedResponseBody](#sealedresponsebody), Nothing?, [SealedMediaType](#sealedmediatype)> - -a class that deserializes responses - -### Constructor Summary -| Constructor and Description | -| --------------------------- | -| FakeclassnametestPatchCode200Response1()
Creates an instance | - -### Field Summary -| Modifier and Type | Field and Description | -| ----------------- | --------------------- | -| 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 | -| ----------------- | ---------------------- | -| ApiResponse<[SealedResponseBody](#sealedresponsebody), Nothing?> | deserialize(HttpResponse response, SchemaConfiguration configuration)
called by endpoint when deserialize responses | diff --git a/samples/client/petstore/kotlin/docs/paths/fakeclassnametest/patch/responses/code200response/content/applicationjson/ApplicationjsonSchema.md b/samples/client/petstore/kotlin/docs/paths/fakeclassnametest/patch/responses/code200response/content/applicationjson/ApplicationjsonSchema.md deleted file mode 100644 index 534041524ca..00000000000 --- a/samples/client/petstore/kotlin/docs/paths/fakeclassnametest/patch/responses/code200response/content/applicationjson/ApplicationjsonSchema.md +++ /dev/null @@ -1,19 +0,0 @@ -# ApplicationjsonSchema -public class ApplicationjsonSchema
-extends [Client1](../../../../../../../components/schemas/Client.md#client) - -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 - -## Nested Class Summary -| Modifier and Type | Class and Description | -| ----------------- | ---------------------- | -| static class | [ApplicationjsonSchema.ApplicationjsonSchema1](#applicationjsonschema1)
schema class | - -## ApplicationjsonSchema1 -public static class ApplicationjsonSchema1
-extends [Client.Client1](../../../../../../../components/schemas/Client.md#client1) - -A schema class that validates payloads diff --git a/samples/client/petstore/kotlin/docs/paths/fakeclassnametest/patch/security/FakeclassnametestPatchSecurityRequirementObject0.md b/samples/client/petstore/kotlin/docs/paths/fakeclassnametest/patch/security/FakeclassnametestPatchSecurityRequirementObject0.md deleted file mode 100644 index 0651521d4b3..00000000000 --- a/samples/client/petstore/kotlin/docs/paths/fakeclassnametest/patch/security/FakeclassnametestPatchSecurityRequirementObject0.md +++ /dev/null @@ -1,15 +0,0 @@ -# FakeclassnametestPatchSecurityRequirementObject0 -FakeclassnametestPatchSecurityRequirementObject0.java - -public class FakeclassnametestPatchSecurityRequirementObject0 -extends SecurityRequirementObject - -### Constructor Summary -| Constructor and Description | -| --------------------------- | -| FakeclassnametestPatchSecurityRequirementObject0()
Creates an instance | - -### 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()
    )) | diff --git a/samples/client/petstore/kotlin/docs/paths/fakedeletecoffeeid/FakedeletecoffeeidDelete.md b/samples/client/petstore/kotlin/docs/paths/fakedeletecoffeeid/FakedeletecoffeeidDelete.md deleted file mode 100644 index 0223066b60f..00000000000 --- a/samples/client/petstore/kotlin/docs/paths/fakedeletecoffeeid/FakedeletecoffeeidDelete.md +++ /dev/null @@ -1,189 +0,0 @@ -# FakedeletecoffeeidDelete - -public class FakedeletecoffeeidDelete - -A class that contains necessary endpoint classes -- a class that calls the endpoint method using the http verb -- a class that calls the endpoint method using the operationId name -- class(es) to store the request inputs -- builder(s) to set the request input data - -## Nested Class Summary -| Modifier and Type | Class and Description | -| ----------------- | --------------------- | -| static class | [Delete](#delete)
The class that has a delete method to call the endpoint | -| interface | [DeleteCoffeeOperation](#deletecoffeeoperation)
The interface that has a deleteCoffee method to call the endpoint | -| static class | [DeleteRequest](#deleterequest)
The final request inputs class | -| static class | [DeleteNullableRequest](#deletenullablerequest)
The initial request inputs class | -| static class | [Delete0RequestBuilder](#delete0requestbuilder)
A builder for the request input class | -| static class | [DeleteRequestBuilder](#deleterequestbuilder)
A builder for the request input class | - -## Delete -public static class Delete extends ApiClient.ApiClient1 implements DeleteOperation
- -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.FakedeletecoffeeidDeletePathParameters; -import org.openapijsonschematools.client.servers.RootServer0; -import org.openapijsonschematools.client.servers.RootServer1; -import org.openapijsonschematools.client.servers.RootServer2; -import org.openapijsonschematools.client.paths.fakedeletecoffeeid.delete.responses.FakedeletecoffeeidDeleteCode200Response; -import org.openapijsonschematools.client.paths.fakedeletecoffeeid.delete.responses.FakedeletecoffeeidDeleteCodedefaultResponse; -import org.openapijsonschematools.client.servers.RootServerInfo; -import org.openapijsonschematools.client.paths.fakedeletecoffeeid.FakedeletecoffeeidDelete; -import org.openapijsonschematools.client.paths.fakedeletecoffeeid.delete.FakedeletecoffeeidDeleteResponses; - -import java.io.IOException; -import java.util.Arrays; -import java.util.List; -import java.util.Map; -import java.util.AbstractMap; - -// if you want to use a server that is not SERVER_0 pass it in here and change the ServerIndex input below -ApiConfiguration.ServerInfo serverInfo = new ApiConfiguration.ServerInfoBuilder() - .rootServerInfo( - new RootServerInfo.RootServerInfoBuilder() - .rootServer0(new RootServer0()) - .build() - ) - .build(); -ApiConfiguration.ServerIndexInfo serverIndexInfo = new ApiConfiguration.ServerIndexInfoBuilder() - .rootServerInfoServerIndex(RootServerInfo.ServerIndex.SERVER_0) - .build(); -Duration timeout = Duration.ofSeconds(1L); -Map> defaultHeaders = Map.of("User-Agent", List.of("OpenAPI-JSON-Schema-Generator/1.0.0/java")); -ApiConfiguration apiConfiguration = new ApiConfiguration( - serverInfo - serverIndexInfo, - timeout, - defaultHeaders -); -SchemaConfiguration schemaConfiguration = new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().build()); -FakedeletecoffeeidDelete.Delete apiClient = new FakedeletecoffeeidDelete.Delete(apiConfiguration, schemaConfiguration); - - -// Map validation -FakedeletecoffeeidDeletePathParameters.PathParametersMap pathParameters = - FakedeletecoffeeidDeletePathParameters.FakedeletecoffeeidDeletePathParameters1.validate( - new FakedeletecoffeeidDeletePathParameters.PathParametersMapBuilder() - .id("a") - - .build(), - schemaConfiguration -); - -var request = new FakedeletecoffeeidDelete.DeleteRequestBuilder() - .pathParameters(pathParameters) - .build(); - -FakedeletecoffeeidDeleteResponses.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 FakedeletecoffeeidDeleteResponses.EndpointFakedeletecoffeeidDeleteCode200Response castResponse) { -} else { - FakedeletecoffeeidDeleteResponses.EndpointFakedeletecoffeeidDeleteCodedefaultResponse castResponse = (FakedeletecoffeeidDeleteResponses.EndpointFakedeletecoffeeidDeleteCodedefaultResponse) response; -} -``` -### Constructor Summary -| Constructor and Description | -| --------------------------- | -| Delete(ApiConfiguration apiConfiguration, SchemaConfiguration schemaConfiguration)
Creates an instance | - -### Method Summary -| Modifier and Type | Method and Description | -| ----------------- | ---------------------- | -| [FakedeletecoffeeidDeleteResponses.EndpointResponse](../../paths/fakedeletecoffeeid/delete/FakedeletecoffeeidDeleteResponses.md#endpointresponse) | delete([DeleteRequest](#deleterequest) request) | - -## DeleteCoffeeOperation -public interface DeleteCoffeeOperation
- -an interface that allows one to call the endpoint using a method named deleteCoffee by the operationId - -### Method Summary -| Modifier and Type | Method and Description | -| ----------------- | ---------------------- | -| [FakedeletecoffeeidDeleteResponses.EndpointResponse](../../paths/fakedeletecoffeeid/delete/FakedeletecoffeeidDeleteResponses.md#endpointresponse) | deleteCoffee([DeleteRequest](#deleterequest) request) | - -## DeleteRequest -public static class DeleteRequest
- -a class that stores the final request inputs - -### Field Summary -| Modifier and Type | Field and Description | -| ----------------- | --------------------- | -| [FakedeletecoffeeidDeletePathParameters.PathParametersMap](../../paths/fakedeletecoffeeid/delete/FakedeletecoffeeidDeletePathParameters.md#pathparametersmap) | pathParameters | -| [RootServerInfo.@Nullable ServerIndex](../../RootServerInfo.md#serverindex) | serverIndex
optional. Note: this will override the value in apiConfiguration | -| @Nullable Duration | timeout
optional. Note: this will override the value in apiConfiguration | - -## DeleteNullableRequest -public static class DeleteNullableRequest
- -a class that stores the initial request inputs - -### Field Summary -| Modifier and Type | Field and Description | -| ----------------- | --------------------- | -| [FakedeletecoffeeidDeletePathParameters.@Nullable PathParametersMap](../../paths/fakedeletecoffeeid/delete/FakedeletecoffeeidDeletePathParameters.md#pathparametersmap) | pathParameters | -| [RootServerInfo.@Nullable ServerIndex](../../RootServerInfo.md#serverindex) | serverIndex | -| @Nullable Duration | timeout | - -## Delete0RequestBuilder -public static class Delete0RequestBuilder
- -a builder for request inputs - -### Constructor Summary -| Constructor and Description | -| --------------------------- | -| Delete0RequestBuilder(Delete0RequestBuilder instance)
Creates a builder that contains the passed instance | - -### Method Summary -| Modifier and Type | Method and Description | -| ----------------- | ---------------------- | -| [DeleteRequest](#deleterequest) | build()
Returns the request input used to call an endpoint method | -| [Delete0RequestBuilder](#delete0requestbuilder) | serverIndex([RootServerInfo.ServerIndex](../../RootServerInfo.md#serverindex) serverIndex)
sets the optional property. Note: this will override the value in apiConfiguration | -| [Delete0RequestBuilder](#delete0requestbuilder) | timeout(Duration timeout)
sets the optional property. Note: this will override the value in apiConfiguration | - -## DeleteRequestBuilder -public static class DeleteRequestBuilder
- -a builder for request inputs - -### Constructor Summary -| Constructor and Description | -| --------------------------- | -| DeleteRequestBuilder()
Creates a builder that contains null for all parameters | - -### Method Summary -| Modifier and Type | Method and Description | -| ----------------- | ---------------------- | -| [Delete0RequestBuilder](#delete0requestbuilder) | pathParameters([FakedeletecoffeeidDeletePathParametersPathParametersMap](../../paths/fakedeletecoffeeid/delete/FakedeletecoffeeidDeletePathParameters.md#pathparametersmap) pathParameters)
sets the property | - -[[Back to top]](#top) [[Back to README]](../../../README.md) diff --git a/samples/client/petstore/kotlin/docs/paths/fakedeletecoffeeid/delete/FakedeletecoffeeidDeletePathParameters.md b/samples/client/petstore/kotlin/docs/paths/fakedeletecoffeeid/delete/FakedeletecoffeeidDeletePathParameters.md deleted file mode 100644 index d9c538067c4..00000000000 --- a/samples/client/petstore/kotlin/docs/paths/fakedeletecoffeeid/delete/FakedeletecoffeeidDeletePathParameters.md +++ /dev/null @@ -1,268 +0,0 @@ -# FakedeletecoffeeidDeletePathParameters -public class FakedeletecoffeeidDeletePathParameters
- -A class that contains necessary nested -- schema classes (which validate payloads), extends JsonSchema -- sealed interfaces which store validated payloads, java version of a sum type -- boxed classes which store validated payloads, sealed permits class implementations -- classes to store validated map payloads, extends FrozenMap -- classes to build inputs for map payloads - -## Nested Class Summary -| Modifier and Type | Class and Description | -| ----------------- | ---------------------- | -| sealed interface | [FakedeletecoffeeidDeletePathParameters.FakedeletecoffeeidDeletePathParameters1Boxed](#fakedeletecoffeeiddeletepathparameters1boxed)
sealed interface for validated payloads | -| record | [FakedeletecoffeeidDeletePathParameters.FakedeletecoffeeidDeletePathParameters1BoxedMap](#fakedeletecoffeeiddeletepathparameters1boxedmap)
boxed class to store validated Map payloads | -| static class | [FakedeletecoffeeidDeletePathParameters.FakedeletecoffeeidDeletePathParameters1](#fakedeletecoffeeiddeletepathparameters1)
schema class | -| static class | [FakedeletecoffeeidDeletePathParameters.PathParametersMapBuilder](#pathparametersmapbuilder)
builder for Map payloads | -| static class | [FakedeletecoffeeidDeletePathParameters.PathParametersMap](#pathparametersmap)
output class for Map payloads | -| sealed interface | [FakedeletecoffeeidDeletePathParameters.AdditionalPropertiesBoxed](#additionalpropertiesboxed)
sealed interface for validated payloads | -| record | [FakedeletecoffeeidDeletePathParameters.AdditionalPropertiesBoxedVoid](#additionalpropertiesboxedvoid)
boxed class to store validated null payloads | -| record | [FakedeletecoffeeidDeletePathParameters.AdditionalPropertiesBoxedBoolean](#additionalpropertiesboxedboolean)
boxed class to store validated boolean payloads | -| record | [FakedeletecoffeeidDeletePathParameters.AdditionalPropertiesBoxedNumber](#additionalpropertiesboxednumber)
boxed class to store validated Number payloads | -| record | [FakedeletecoffeeidDeletePathParameters.AdditionalPropertiesBoxedString](#additionalpropertiesboxedstring)
boxed class to store validated String payloads | -| record | [FakedeletecoffeeidDeletePathParameters.AdditionalPropertiesBoxedList](#additionalpropertiesboxedlist)
boxed class to store validated List payloads | -| record | [FakedeletecoffeeidDeletePathParameters.AdditionalPropertiesBoxedMap](#additionalpropertiesboxedmap)
boxed class to store validated Map payloads | -| static class | [FakedeletecoffeeidDeletePathParameters.AdditionalProperties](#additionalproperties)
schema class | - -## FakedeletecoffeeidDeletePathParameters1Boxed -public sealed interface FakedeletecoffeeidDeletePathParameters1Boxed
-permits
-[FakedeletecoffeeidDeletePathParameters1BoxedMap](#fakedeletecoffeeiddeletepathparameters1boxedmap) - -sealed interface that stores validated payloads using boxed classes - -## FakedeletecoffeeidDeletePathParameters1BoxedMap -public record FakedeletecoffeeidDeletePathParameters1BoxedMap
-implements [FakedeletecoffeeidDeletePathParameters1Boxed](#fakedeletecoffeeiddeletepathparameters1boxed) - -record that stores validated Map payloads, sealed permits implementation - -### Constructor Summary -| Constructor and Description | -| --------------------------- | -| FakedeletecoffeeidDeletePathParameters1BoxedMap([PathParametersMap](#pathparametersmap) data)
Creates an instance, private visibility | - -### Method Summary -| Modifier and Type | Method and Description | -| ----------------- | ---------------------- | -| [PathParametersMap](#pathparametersmap) | data()
validated payload | -| @Nullable Object | getData()
validated payload | - -## FakedeletecoffeeidDeletePathParameters1 -public static class FakedeletecoffeeidDeletePathParameters1
-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.fakedeletecoffeeid.delete.FakedeletecoffeeidDeletePathParameters; - -import java.util.Arrays; -import java.util.List; -import java.util.AbstractMap; - -static final SchemaConfiguration configuration = new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().build()); - -// Map validation -FakedeletecoffeeidDeletePathParameters.PathParametersMap validatedPayload = - FakedeletecoffeeidDeletePathParameters.FakedeletecoffeeidDeletePathParameters1.validate( - new FakedeletecoffeeidDeletePathParameters.PathParametersMapBuilder() - .id("a") - - .build(), - configuration -); -``` - -### Field Summary -| Modifier and Type | Field and Description | -| ----------------- | ---------------------- | -| Set> | type = Set.of(Map.class) | -| Map> | properties = Map.ofEntries(
    new PropertyEntry("id", [Schema0.Schema01.class](../../../paths/fakedeletecoffeeid/delete/parameters/parameter0/Schema0.md#schema01))
)
| -| Set | required = Set.of(
    "id"
)
| -| Class | additionalProperties = [AdditionalProperties.class](#additionalproperties) | - -### Method Summary -| Modifier and Type | Method and Description | -| ----------------- | ---------------------- | -| [PathParametersMap](#pathparametersmap) | validate([Map<?, ?>](#pathparametersmapbuilder) arg, SchemaConfiguration configuration) | -| [FakedeletecoffeeidDeletePathParameters1BoxedMap](#fakedeletecoffeeiddeletepathparameters1boxedmap) | validateAndBox([Map<?, ?>](#pathparametersmapbuilder) arg, SchemaConfiguration configuration) | -| [FakedeletecoffeeidDeletePathParameters1Boxed](#fakedeletecoffeeiddeletepathparameters1boxed) | validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) | -| @Nullable Object | validate(@Nullable Object arg, SchemaConfiguration configuration) | - -## PathParametersMap0Builder -public class PathParametersMap0Builder
-builder for `Map` - -A class that builds the Map input type - -### Constructor Summary -| Constructor and Description | -| --------------------------- | -| PathParametersMap0Builder(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 | - -## PathParametersMapBuilder -public class PathParametersMapBuilder
-builder for `Map` - -A class that builds the Map input type - -### Constructor Summary -| Constructor and Description | -| --------------------------- | -| PathParametersMapBuilder()
Creates a builder that contains an empty map | - -### Method Summary -| Modifier and Type | Method and Description | -| ----------------- | ---------------------- | -| [PathParametersMap0Builder](#pathparametersmap0builder) | id(String value) | - -## PathParametersMap -public static class PathParametersMap
-extends FrozenMap - -A class to store validated Map payloads - -### Method Summary -| Modifier and Type | Method and Description | -| ----------------- | ---------------------- | -| static [PathParametersMap](#pathparametersmap) | of([Map](#pathparametersmapbuilder) arg, SchemaConfiguration configuration) | -| String | id()
| - -## 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(Nothing? data)
Creates an instance, private visibility | - -### Method Summary -| Modifier and Type | Method and Description | -| ----------------- | ---------------------- | -| Nothing? | 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/kotlin/docs/paths/fakedeletecoffeeid/delete/FakedeletecoffeeidDeleteResponses.md b/samples/client/petstore/kotlin/docs/paths/fakedeletecoffeeid/delete/FakedeletecoffeeidDeleteResponses.md deleted file mode 100644 index 1dcadfe6262..00000000000 --- a/samples/client/petstore/kotlin/docs/paths/fakedeletecoffeeid/delete/FakedeletecoffeeidDeleteResponses.md +++ /dev/null @@ -1,40 +0,0 @@ -# FakedeletecoffeeidDeleteResponses - -public class FakedeletecoffeeidDeleteResponses - -A class that contains necessary responses classes -- a sealed interface, EndpointResponse, that stores endpoint responses -- records for each endpoint response - -## Nested Class Summary -| Modifier and Type | Class and Description | -| ----------------- | --------------------- | -| sealed interface | [EndpointResponse](#endpointresponse)
stores the endpoint responses | -| record | [EndpointFakedeletecoffeeidDeleteCode200Response](#endpointfakedeletecoffeeiddeletecode200response)
the response for 200 | -| record | [EndpointFakedeletecoffeeidDeleteCodedefaultResponse](#endpointfakedeletecoffeeiddeletecodedefaultresponse)
the response for default | - -## EndpointResponse -public sealed interface EndpointResponse permits
-[EndpointFakedeletecoffeeidDeleteCode200Response](#endpointfakedeletecoffeeiddeletecode200response), -[EndpointFakedeletecoffeeidDeleteCodedefaultResponse](#endpointfakedeletecoffeeiddeletecodedefaultresponse) - -a sealed interface that stores endpoint responses - -## EndpointFakedeletecoffeeidDeleteCode200Response -public record EndpointFakedeletecoffeeidDeleteCode200Response( - HttpResponse response, - Nothing? body, - Nothing? headers -) implements EndpointResponse, ApiResponse
- -a class that stores an endpoint response - -## EndpointFakedeletecoffeeidDeleteCodedefaultResponse -public record EndpointFakedeletecoffeeidDeleteCodedefaultResponse( - HttpResponse response, - Nothing? body, - Nothing? headers -) implements EndpointResponse, ApiResponse
- -a class that stores an endpoint response - diff --git a/samples/client/petstore/kotlin/docs/paths/fakedeletecoffeeid/delete/parameters/parameter0/Schema0.md b/samples/client/petstore/kotlin/docs/paths/fakedeletecoffeeid/delete/parameters/parameter0/Schema0.md deleted file mode 100644 index 9ff90e0bc35..00000000000 --- a/samples/client/petstore/kotlin/docs/paths/fakedeletecoffeeid/delete/parameters/parameter0/Schema0.md +++ /dev/null @@ -1,49 +0,0 @@ -# Schema0 -public class Schema0
- -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 - -## Nested Class Summary -| Modifier and Type | Class and Description | -| ----------------- | ---------------------- | -| sealed interface | [Schema0.Schema01Boxed](#schema01boxed)
sealed interface for validated payloads | -| record | [Schema0.Schema01BoxedString](#schema01boxedstring)
boxed class to store validated String payloads | -| static class | [Schema0.Schema01](#schema01)
schema class | - -## Schema01Boxed -public sealed interface Schema01Boxed
-permits
-[Schema01BoxedString](#schema01boxedstring) - -sealed interface that stores validated payloads using boxed classes - -## Schema01BoxedString -public record Schema01BoxedString
-implements [Schema01Boxed](#schema01boxed) - -record that stores validated String payloads, sealed permits implementation - -### Constructor Summary -| Constructor and Description | -| --------------------------- | -| Schema01BoxedString(String data)
Creates an instance, private visibility | - -### Method Summary -| Modifier and Type | Method and Description | -| ----------------- | ---------------------- | -| String | data()
validated payload | -| @Nullable Object | getData()
validated payload | - -## Schema01 -public static class Schema01
-extends StringJsonSchema.StringJsonSchema1 - -A schema class that validates payloads - -| Methods Inherited from class org.openapijsonschematools.client.schemas.StringJsonSchema.StringJsonSchema1 | -| ------------------------------------------------------------------ | -| validate | -| validateAndBox | diff --git a/samples/client/petstore/kotlin/docs/paths/fakedeletecoffeeid/delete/responses/FakedeletecoffeeidDeleteCode200Response.md b/samples/client/petstore/kotlin/docs/paths/fakedeletecoffeeid/delete/responses/FakedeletecoffeeidDeleteCode200Response.md deleted file mode 100644 index 6c115aadfcf..00000000000 --- a/samples/client/petstore/kotlin/docs/paths/fakedeletecoffeeid/delete/responses/FakedeletecoffeeidDeleteCode200Response.md +++ /dev/null @@ -1,17 +0,0 @@ -# FakedeletecoffeeidDeleteCode200Response - -public class FakedeletecoffeeidDeleteCode200Response extends [SuccessDescriptionOnly](../../components/responses/SuccessDescriptionOnly.md) - -A class (extended from the $ref class) that contains necessary nested response classes -- a class that extends ResponseDeserializer and is used to deserialize responses - -## Nested Class Summary -| Modifier and Type | Class and Description | -| ----------------- | --------------------- | -| static class | [FakedeletecoffeeidDeleteCode200Response.FakedeletecoffeeidDeleteCode200Response1](#fakedeletecoffeeiddeletecode200response1)
class that deserializes responses | - -## FakedeletecoffeeidDeleteCode200Response1 -public static class FakedeletecoffeeidDeleteCode200Response1 extends [SuccessDescriptionOnly1](../../components/responses/SuccessDescriptionOnly.md#successdescriptiononly1)
- -a class that deserializes responses, extended from the $ref class - diff --git a/samples/client/petstore/kotlin/docs/paths/fakedeletecoffeeid/delete/responses/FakedeletecoffeeidDeleteCodedefaultResponse.md b/samples/client/petstore/kotlin/docs/paths/fakedeletecoffeeid/delete/responses/FakedeletecoffeeidDeleteCodedefaultResponse.md deleted file mode 100644 index 2b26c4cf967..00000000000 --- a/samples/client/petstore/kotlin/docs/paths/fakedeletecoffeeid/delete/responses/FakedeletecoffeeidDeleteCodedefaultResponse.md +++ /dev/null @@ -1,32 +0,0 @@ -# FakedeletecoffeeidDeleteCodedefaultResponse - -public class FakedeletecoffeeidDeleteCodedefaultResponse - -A class that contains necessary nested response classes -- a class that extends ResponseDeserializer and is used to deserialize responses - -## Nested Class Summary -| Modifier and Type | Class and Description | -| ----------------- | --------------------- | -| static class | [FakedeletecoffeeidDeleteCodedefaultResponse.FakedeletecoffeeidDeleteCodedefaultResponse1](#fakedeletecoffeeiddeletecodedefaultresponse1)
class that deserializes responses | - -## FakedeletecoffeeidDeleteCodedefaultResponse1 -public static class FakedeletecoffeeidDeleteCodedefaultResponse1
-extends ResponseDeserializer - -a class that deserializes responses - -### Constructor Summary -| Constructor and Description | -| --------------------------- | -| FakedeletecoffeeidDeleteCodedefaultResponse1()
Creates an instance | - -### Field Summary -| Modifier and Type | Field and Description | -| ----------------- | --------------------- | -| Map | content = MapUtils.makeMap(
)
the contentType to schema info | - -### Method Summary -| Modifier and Type | Method and Description | -| ----------------- | ---------------------- | -| ApiResponse | deserialize(HttpResponse response, SchemaConfiguration configuration)
called by endpoint when deserialize responses | diff --git a/samples/client/petstore/kotlin/docs/paths/fakehealth/FakehealthGet.md b/samples/client/petstore/kotlin/docs/paths/fakehealth/FakehealthGet.md deleted file mode 100644 index d6b572bc19f..00000000000 --- a/samples/client/petstore/kotlin/docs/paths/fakehealth/FakehealthGet.md +++ /dev/null @@ -1,144 +0,0 @@ -# FakehealthGet - -public class FakehealthGet - -A class that contains necessary endpoint classes -- a class that calls the endpoint method using the http verb -- a class that calls the endpoint method using the operationId name -- class(es) to store the request inputs -- builder(s) to set the request input data - -## Nested Class Summary -| Modifier and Type | Class and Description | -| ----------------- | --------------------- | -| static class | [Get](#get)
The class that has a get method to call the endpoint | -| interface | [FakeHealthGetOperation](#fakehealthgetoperation)
The interface that has a fakeHealthGet method to call the endpoint | -| static class | [GetRequest](#getrequest)
The request inputs class | -| static class | [GetRequestBuilder](#getrequestbuilder)
A builder for the request input class | - -## Get -public static class Get extends ApiClient.ApiClient1 implements GetOperation
- -a class that allows one to call the endpoint using a method named get - -### 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.servers.RootServer0; -import org.openapijsonschematools.client.servers.RootServer1; -import org.openapijsonschematools.client.servers.RootServer2; -import org.openapijsonschematools.client.paths.fakehealth.get.responses.FakehealthGetCode200Response; -import org.openapijsonschematools.client.servers.RootServerInfo; -import org.openapijsonschematools.client.paths.fakehealth.FakehealthGet; -import org.openapijsonschematools.client.paths.fakehealth.get.FakehealthGetResponses; - -import java.io.IOException; -import java.util.Arrays; -import java.util.List; -import java.util.Map; -import java.util.AbstractMap; - -// if you want to use a server that is not SERVER_0 pass it in here and change the ServerIndex input below -ApiConfiguration.ServerInfo serverInfo = new ApiConfiguration.ServerInfoBuilder() - .rootServerInfo( - new RootServerInfo.RootServerInfoBuilder() - .rootServer0(new RootServer0()) - .build() - ) - .build(); -ApiConfiguration.ServerIndexInfo serverIndexInfo = new ApiConfiguration.ServerIndexInfoBuilder() - .rootServerInfoServerIndex(RootServerInfo.ServerIndex.SERVER_0) - .build(); -Duration timeout = Duration.ofSeconds(1L); -Map> defaultHeaders = Map.of("User-Agent", List.of("OpenAPI-JSON-Schema-Generator/1.0.0/java")); -ApiConfiguration apiConfiguration = new ApiConfiguration( - serverInfo - serverIndexInfo, - timeout, - defaultHeaders -); -SchemaConfiguration schemaConfiguration = new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().build()); -FakehealthGet.Get apiClient = new FakehealthGet.Get(apiConfiguration, schemaConfiguration); - - -var request = new FakehealthGet.GetRequestBuilder().build(); - -FakehealthGetResponses.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; -} -FakehealthGetResponses.EndpointFakehealthGetCode200Response castResponse = (FakehealthGetResponses.EndpointFakehealthGetCode200Response) response; -FakehealthGetCode200Response.ApplicationjsonResponseBody deserializedBody = (FakehealthGetCode200Response.ApplicationjsonResponseBody) castResponse.body; -// handle deserialized body here -``` -### Constructor Summary -| Constructor and Description | -| --------------------------- | -| Get(ApiConfiguration apiConfiguration, SchemaConfiguration schemaConfiguration)
Creates an instance | - -### Method Summary -| Modifier and Type | Method and Description | -| ----------------- | ---------------------- | -| [FakehealthGetResponses.EndpointResponse](../../paths/fakehealth/get/FakehealthGetResponses.md#endpointresponse) | get([GetRequest](#getrequest) request) | - -## FakeHealthGetOperation -public interface FakeHealthGetOperation
- -an interface that allows one to call the endpoint using a method named fakeHealthGet by the operationId - -### Method Summary -| Modifier and Type | Method and Description | -| ----------------- | ---------------------- | -| [FakehealthGetResponses.EndpointResponse](../../paths/fakehealth/get/FakehealthGetResponses.md#endpointresponse) | fakeHealthGet([GetRequest](#getrequest) request) | - -## GetRequest -public static class GetRequest
- -a class that stores the final request inputs - -### Field Summary -| Modifier and Type | Field and Description | -| ----------------- | --------------------- | -| [RootServerInfo.@Nullable ServerIndex](../../RootServerInfo.md#serverindex) | serverIndex
optional. Note: this will override the value in apiConfiguration | -| @Nullable Duration | timeout
optional. Note: this will override the value in apiConfiguration | - -## GetRequestBuilder -public static class GetRequestBuilder
- -a builder for request inputs - -### Constructor Summary -| Constructor and Description | -| --------------------------- | -| GetRequestBuilder()
Creates a builder that contains null for all parameters | - -### Method Summary -| Modifier and Type | Method and Description | -| ----------------- | ---------------------- | -| [GetRequest](#getrequest) | build()
Returns the request input used to call an endpoint method | -| [GetRequestBuilder](#getrequestbuilder) | serverIndex([RootServerInfo.ServerIndex](../../RootServerInfo.md#serverindex) serverIndex)
sets the optional property. Note: this will override the value in apiConfiguration | -| [GetRequestBuilder](#getrequestbuilder) | timeout(Duration timeout)
sets the optional property. Note: this will override the value in apiConfiguration | - -[[Back to top]](#top) [[Back to README]](../../../README.md) diff --git a/samples/client/petstore/kotlin/docs/paths/fakehealth/get/FakehealthGetResponses.md b/samples/client/petstore/kotlin/docs/paths/fakehealth/get/FakehealthGetResponses.md deleted file mode 100644 index 14cf426c478..00000000000 --- a/samples/client/petstore/kotlin/docs/paths/fakehealth/get/FakehealthGetResponses.md +++ /dev/null @@ -1,29 +0,0 @@ -# FakehealthGetResponses - -public class FakehealthGetResponses - -A class that contains necessary responses classes -- a sealed interface, EndpointResponse, that stores endpoint responses -- records for each endpoint response - -## Nested Class Summary -| Modifier and Type | Class and Description | -| ----------------- | --------------------- | -| sealed interface | [EndpointResponse](#endpointresponse)
stores the endpoint responses | -| record | [EndpointFakehealthGetCode200Response](#endpointfakehealthgetcode200response)
the response for 200 | - -## EndpointResponse -public sealed interface EndpointResponse permits
-[EndpointFakehealthGetCode200Response](#endpointfakehealthgetcode200response) - -a sealed interface that stores endpoint responses - -## EndpointFakehealthGetCode200Response -public record EndpointFakehealthGetCode200Response( - HttpResponse response, - [FakehealthGetCode200Response.SealedResponseBody](../../../paths/fakehealth/get/responses/FakehealthGetCode200Response.md#sealedresponsebody) body, - Nothing? headers -) implements EndpointResponse, ApiResponse
- -a class that stores an endpoint response - diff --git a/samples/client/petstore/kotlin/docs/paths/fakehealth/get/responses/FakehealthGetCode200Response.md b/samples/client/petstore/kotlin/docs/paths/fakehealth/get/responses/FakehealthGetCode200Response.md deleted file mode 100644 index 8157b3f5f0b..00000000000 --- a/samples/client/petstore/kotlin/docs/paths/fakehealth/get/responses/FakehealthGetCode200Response.md +++ /dev/null @@ -1,87 +0,0 @@ -# FakehealthGetCode200Response - -public class FakehealthGetCode200Response - -A class that contains necessary nested response classes -- SealedMediaType, a sealed interface which contains all the schema/encoding info for each contentType -- records which implement SealedMediaType, the concrete media types -- SealedResponseBody, a sealed interface which contains all the contentType/schema types -- records which implement SealedResponseBody, the concrete response body types -- a class that extends ResponseDeserializer and is used to deserialize responses - -## Nested Class Summary -| Modifier and Type | Class and Description | -| ----------------- | --------------------- | -| sealed interface | [FakehealthGetCode200Response.SealedMediaType](#sealedmediatype)
media type sealed interface | -| record | [FakehealthGetCode200Response.ApplicationjsonMediaType](#applicationjsonmediatype)
record storing schema + encoding for a specific contentType | -| sealed interface | [FakehealthGetCode200Response.SealedResponseBody](#sealedresponsebody)
response body sealed interface | -| record | [FakehealthGetCode200Response.ApplicationjsonResponseBody](#applicationjsonresponsebody)
implements sealed interface to store response body | -| static class | [FakehealthGetCode200Response.FakehealthGetCode200Response1](#fakehealthgetcode200response1)
class that deserializes responses | - -## SealedMediaType -public sealed interface SealedMediaType
-permits
-[ApplicationjsonMediaType](#applicationjsonmediatype) - -sealed interface that stores schema and encoding info - -## ApplicationjsonMediaType -public record ApplicationjsonMediaType
-implements [SealedMediaType](#sealedmediatype), MediaType<[ApplicationjsonSchema.ApplicationjsonSchema1](../../../../paths/fakehealth/get/responses/code200response/content/applicationjson/ApplicationjsonSchema.md#applicationjsonschema1), Nothing?> - -class storing schema info for a specific contentType - -### Constructor Summary -| Constructor and Description | -| --------------------------- | -| ApplicationjsonMediaType()
Creates an instance | - -### Method Summary -| Modifier and Type | Method and Description | -| ----------------- | ---------------------- | -| [ApplicationjsonSchema.ApplicationjsonSchema1](../../../../paths/fakehealth/get/responses/code200response/content/applicationjson/ApplicationjsonSchema.md#applicationjsonschema1) | schema()
the schema for this MediaType | -| Nothing? | encoding()
the encoding info | - -## SealedResponseBody -public sealed interface SealedResponseBody
-permits
-[ApplicationjsonResponseBody](#applicationjsonresponsebody) - -sealed interface that stores response body - -## ApplicationjsonResponseBody -public record ApplicationjsonResponseBody
-implements [SealedResponseBody](#sealedresponsebody) - -A record class to store response body for contentType="application/json" - -### Constructor Summary -| Constructor and Description | -| --------------------------- | -| ApplicationjsonResponseBody(ApplicationjsonSchema.[HealthCheckResult1Boxed](../../../../components/schemas/HealthCheckResult.md#healthcheckresult1boxed) body)
Creates an instance | - -### Method Summary -| Modifier and Type | Method and Description | -| ----------------- | ---------------------- | -| ApplicationjsonSchema.[HealthCheckResult1Boxed](../../../../components/schemas/HealthCheckResult.md#healthcheckresult1boxed) | body()
returns the body passed in in the constructor | - -## FakehealthGetCode200Response1 -public static class FakehealthGetCode200Response1
-extends ResponseDeserializer<[SealedResponseBody](#sealedresponsebody), Nothing?, [SealedMediaType](#sealedmediatype)> - -a class that deserializes responses - -### Constructor Summary -| Constructor and Description | -| --------------------------- | -| FakehealthGetCode200Response1()
Creates an instance | - -### Field Summary -| Modifier and Type | Field and Description | -| ----------------- | --------------------- | -| 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 | -| ----------------- | ---------------------- | -| ApiResponse<[SealedResponseBody](#sealedresponsebody), Nothing?> | deserialize(HttpResponse response, SchemaConfiguration configuration)
called by endpoint when deserialize responses | diff --git a/samples/client/petstore/kotlin/docs/paths/fakehealth/get/responses/code200response/content/applicationjson/ApplicationjsonSchema.md b/samples/client/petstore/kotlin/docs/paths/fakehealth/get/responses/code200response/content/applicationjson/ApplicationjsonSchema.md deleted file mode 100644 index 4b80f3aefdb..00000000000 --- a/samples/client/petstore/kotlin/docs/paths/fakehealth/get/responses/code200response/content/applicationjson/ApplicationjsonSchema.md +++ /dev/null @@ -1,19 +0,0 @@ -# ApplicationjsonSchema -public class ApplicationjsonSchema
-extends [HealthCheckResult1](../../../../../../../components/schemas/HealthCheckResult.md#healthcheckresult) - -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 - -## Nested Class Summary -| Modifier and Type | Class and Description | -| ----------------- | ---------------------- | -| static class | [ApplicationjsonSchema.ApplicationjsonSchema1](#applicationjsonschema1)
schema class | - -## ApplicationjsonSchema1 -public static class ApplicationjsonSchema1
-extends [HealthCheckResult.HealthCheckResult1](../../../../../../../components/schemas/HealthCheckResult.md#healthcheckresult1) - -A schema class that validates payloads diff --git a/samples/client/petstore/kotlin/docs/paths/fakeinlineadditionalproperties/FakeinlineadditionalpropertiesPost.md b/samples/client/petstore/kotlin/docs/paths/fakeinlineadditionalproperties/FakeinlineadditionalpropertiesPost.md deleted file mode 100644 index ea4e8d93b7e..00000000000 --- a/samples/client/petstore/kotlin/docs/paths/fakeinlineadditionalproperties/FakeinlineadditionalpropertiesPost.md +++ /dev/null @@ -1,186 +0,0 @@ -# FakeinlineadditionalpropertiesPost - -public class FakeinlineadditionalpropertiesPost - -A class that contains necessary endpoint classes -- a class that calls the endpoint method using the http verb -- a class that calls the endpoint method using the operationId name -- class(es) to store the request inputs -- builder(s) to set the request input data - -## Nested Class Summary -| Modifier and Type | Class and Description | -| ----------------- | --------------------- | -| static class | [Post](#post)
The class that has a post method to call the endpoint | -| interface | [InlineAdditionalPropertiesOperation](#inlineadditionalpropertiesoperation)
The interface that has a inlineAdditionalProperties method to call the endpoint | -| static class | [PostRequest](#postrequest)
The final request inputs class | -| static class | [PostNullableRequest](#postnullablerequest)
The initial request inputs class | -| static class | [Post0RequestBuilder](#post0requestbuilder)
A builder for the request input class | -| static class | [PostRequestBuilder](#postrequestbuilder)
A builder for the request input class | - -## Post -public static class Post 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.fakeinlineadditionalproperties.post.FakeinlineadditionalpropertiesPostRequestBody; -import org.openapijsonschematools.client.paths.fakeinlineadditionalproperties.post.requestbody.content.applicationjson.ApplicationjsonSchema; -import org.openapijsonschematools.client.servers.RootServer0; -import org.openapijsonschematools.client.servers.RootServer1; -import org.openapijsonschematools.client.servers.RootServer2; -import org.openapijsonschematools.client.paths.fakeinlineadditionalproperties.post.responses.FakeinlineadditionalpropertiesPostCode200Response; -import org.openapijsonschematools.client.servers.RootServerInfo; -import org.openapijsonschematools.client.paths.fakeinlineadditionalproperties.FakeinlineadditionalpropertiesPost; -import org.openapijsonschematools.client.paths.fakeinlineadditionalproperties.post.FakeinlineadditionalpropertiesPostResponses; - -import java.io.IOException; -import java.util.Arrays; -import java.util.List; -import java.util.Map; -import java.util.AbstractMap; - -// if you want to use a server that is not SERVER_0 pass it in here and change the ServerIndex input below -ApiConfiguration.ServerInfo serverInfo = new ApiConfiguration.ServerInfoBuilder() - .rootServerInfo( - new RootServerInfo.RootServerInfoBuilder() - .rootServer0(new RootServer0()) - .build() - ) - .build(); -ApiConfiguration.ServerIndexInfo serverIndexInfo = new ApiConfiguration.ServerIndexInfoBuilder() - .rootServerInfoServerIndex(RootServerInfo.ServerIndex.SERVER_0) - .build(); -Duration timeout = Duration.ofSeconds(1L); -Map> defaultHeaders = Map.of("User-Agent", List.of("OpenAPI-JSON-Schema-Generator/1.0.0/java")); -ApiConfiguration apiConfiguration = new ApiConfiguration( - serverInfo - serverIndexInfo, - timeout, - defaultHeaders -); -SchemaConfiguration schemaConfiguration = new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().build()); -FakeinlineadditionalpropertiesPost.Post apiClient = new FakeinlineadditionalpropertiesPost.Post(apiConfiguration, schemaConfiguration); - - -ApplicationjsonSchema1BoxedMap requestBodyPayload = - ApplicationjsonSchema.ApplicationjsonSchema1.validateAndBox( - new ApplicationjsonSchema.ApplicationjsonSchemaMapBuilder() - .additionalProperty("someAdditionalProperty", "a") - - .build(), - schemaConfiguration -); -FakeinlineadditionalpropertiesPost.SealedRequestBody requestBody = new FakeinlineadditionalpropertiesPost.ApplicationjsonRequestBody(requestBodyPayload); - -var request = new FakeinlineadditionalpropertiesPost.PostRequestBuilder() - .requestBody(requestBody) - .build(); - -FakeinlineadditionalpropertiesPostResponses.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; -} -FakeinlineadditionalpropertiesPostResponses.EndpointFakeinlineadditionalpropertiesPostCode200Response castResponse = (FakeinlineadditionalpropertiesPostResponses.EndpointFakeinlineadditionalpropertiesPostCode200Response) response; -``` -### Constructor Summary -| Constructor and Description | -| --------------------------- | -| Post(ApiConfiguration apiConfiguration, SchemaConfiguration schemaConfiguration)
Creates an instance | - -### Method Summary -| Modifier and Type | Method and Description | -| ----------------- | ---------------------- | -| [FakeinlineadditionalpropertiesPostResponses.EndpointResponse](../../paths/fakeinlineadditionalproperties/post/FakeinlineadditionalpropertiesPostResponses.md#endpointresponse) | post([PostRequest](#postrequest) request) | - -## InlineAdditionalPropertiesOperation -public interface InlineAdditionalPropertiesOperation
- -an interface that allows one to call the endpoint using a method named inlineAdditionalProperties by the operationId - -### Method Summary -| Modifier and Type | Method and Description | -| ----------------- | ---------------------- | -| [FakeinlineadditionalpropertiesPostResponses.EndpointResponse](../../paths/fakeinlineadditionalproperties/post/FakeinlineadditionalpropertiesPostResponses.md#endpointresponse) | inlineAdditionalProperties([PostRequest](#postrequest) request) | - -## PostRequest -public static class PostRequest
- -a class that stores the final request inputs - -### Field Summary -| Modifier and Type | Field and Description | -| ----------------- | --------------------- | -| [FakeinlineadditionalpropertiesPostRequestBody.SealedRequestBody](../../paths/fakeinlineadditionalproperties/post/FakeinlineadditionalpropertiesPostRequestBody.md#sealedrequestbody) | requestBody | -| [RootServerInfo.@Nullable ServerIndex](../../RootServerInfo.md#serverindex) | serverIndex
optional. Note: this will override the value in apiConfiguration | -| @Nullable Duration | timeout
optional. Note: this will override the value in apiConfiguration | - -## PostNullableRequest -public static class PostNullableRequest
- -a class that stores the initial request inputs - -### Field Summary -| Modifier and Type | Field and Description | -| ----------------- | --------------------- | -| [FakeinlineadditionalpropertiesPostRequestBody.@Nullable SealedRequestBody](../../paths/fakeinlineadditionalproperties/post/FakeinlineadditionalpropertiesPostRequestBody.md#sealedrequestbody) | requestBody | -| [RootServerInfo.@Nullable ServerIndex](../../RootServerInfo.md#serverindex) | serverIndex | -| @Nullable Duration | timeout | - -## Post0RequestBuilder -public static class Post0RequestBuilder
- -a builder for request inputs - -### Constructor Summary -| Constructor and Description | -| --------------------------- | -| Post0RequestBuilder(Post0RequestBuilder instance)
Creates a builder that contains the passed instance | - -### Method Summary -| Modifier and Type | Method and Description | -| ----------------- | ---------------------- | -| [PostRequest](#postrequest) | build()
Returns the request input used to call an endpoint method | -| [Post0RequestBuilder](#post0requestbuilder) | serverIndex([RootServerInfo.ServerIndex](../../RootServerInfo.md#serverindex) serverIndex)
sets the optional property. Note: this will override the value in apiConfiguration | -| [Post0RequestBuilder](#post0requestbuilder) | timeout(Duration timeout)
sets the optional property. Note: this will override the value in apiConfiguration | - -## PostRequestBuilder -public static class PostRequestBuilder
- -a builder for request inputs - -### Constructor Summary -| Constructor and Description | -| --------------------------- | -| PostRequestBuilder()
Creates a builder that contains null for all parameters | - -### Method Summary -| Modifier and Type | Method and Description | -| ----------------- | ---------------------- | -| [Post0RequestBuilder](#post0requestbuilder) | requestBody([FakeinlineadditionalpropertiesPostRequestBody.SealedRequestBody](../../paths/fakeinlineadditionalproperties/post/FakeinlineadditionalpropertiesPostRequestBody.md#sealedrequestbody) requestBody)
sets the property | - -[[Back to top]](#top) [[Back to README]](../../../README.md) diff --git a/samples/client/petstore/kotlin/docs/paths/fakeinlineadditionalproperties/post/FakeinlineadditionalpropertiesPostRequestBody.md b/samples/client/petstore/kotlin/docs/paths/fakeinlineadditionalproperties/post/FakeinlineadditionalpropertiesPostRequestBody.md deleted file mode 100644 index cead4807700..00000000000 --- a/samples/client/petstore/kotlin/docs/paths/fakeinlineadditionalproperties/post/FakeinlineadditionalpropertiesPostRequestBody.md +++ /dev/null @@ -1,90 +0,0 @@ -# FakeinlineadditionalpropertiesPostRequestBody - -public class FakeinlineadditionalpropertiesPostRequestBody - -A class that contains necessary nested request body classes -- SealedMediaType, a sealed interface which contains all the schema/encoding info for each contentType -- records which implement SealedMediaType, the concrete media types -- a class that extends RequestBodySerializer and is used to serialize input SealedRequestBody instances -- SealedRequestBody, a sealed interface which contains all the contentType/schema input types -- records which implement SealedRequestBody, the concrete request body types - -## Nested Class Summary -| Modifier and Type | Class and Description | -| ----------------- | --------------------- | -| sealed interface | [FakeinlineadditionalpropertiesPostRequestBody.SealedMediaType](#sealedmediatype)
media type sealed interface | -| record | [FakeinlineadditionalpropertiesPostRequestBody.ApplicationjsonMediaType](#applicationjsonmediatype)
record storing schema + encoding for a specific contentType | -| static class | [FakeinlineadditionalpropertiesPostRequestBody.FakeinlineadditionalpropertiesPostRequestBody1](#fakeinlineadditionalpropertiespostrequestbody1)
class that serializes request bodies | -| sealed interface | [FakeinlineadditionalpropertiesPostRequestBody.SealedRequestBody](#sealedrequestbody)
request body sealed interface | -| record | [FakeinlineadditionalpropertiesPostRequestBody.ApplicationjsonRequestBody](#applicationjsonrequestbody)
implements sealed interface to store request body input | - -## SealedMediaType -public sealed interface SealedMediaType
-permits
-[ApplicationjsonMediaType](#applicationjsonmediatype) - -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), Nothing?> - -class storing schema info for a specific contentType - -### Constructor Summary -| Constructor and Description | -| --------------------------- | -| ApplicationjsonMediaType()
Creates an instance | - -### 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 | -| Nothing? | encoding()
the encoding info | - -## FakeinlineadditionalpropertiesPostRequestBody1 -public static class FakeinlineadditionalpropertiesPostRequestBody1
- -a class that serializes SealedRequestBody request bodies - -### Constructor Summary -| Constructor and Description | -| --------------------------- | -| FakeinlineadditionalpropertiesPostRequestBody1()
Creates an instance | - -### Field Summary -| Modifier and Type | Field and Description | -| ----------------- | --------------------- | -| boolean | required = true
whether the request body is required | -| 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 | -| ----------------- | ---------------------- | -| SerializedRequestBody | serialize([SealedRequestBody](#sealedrequestbody) requestBody)
called by endpoint when creating request body bytes | - -## SealedRequestBody -public sealed interface SealedRequestBody
-permits
-[ApplicationjsonRequestBody](#applicationjsonrequestbody) - -sealed interface that stores request contentType + validated schema data - -## ApplicationjsonRequestBody -public record ApplicationjsonRequestBody
-implements [SealedRequestBody](#sealedrequestbody),
-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 | - -### 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 | diff --git a/samples/client/petstore/kotlin/docs/paths/fakeinlineadditionalproperties/post/FakeinlineadditionalpropertiesPostResponses.md b/samples/client/petstore/kotlin/docs/paths/fakeinlineadditionalproperties/post/FakeinlineadditionalpropertiesPostResponses.md deleted file mode 100644 index 7a9ad96cdf4..00000000000 --- a/samples/client/petstore/kotlin/docs/paths/fakeinlineadditionalproperties/post/FakeinlineadditionalpropertiesPostResponses.md +++ /dev/null @@ -1,29 +0,0 @@ -# FakeinlineadditionalpropertiesPostResponses - -public class FakeinlineadditionalpropertiesPostResponses - -A class that contains necessary responses classes -- a sealed interface, EndpointResponse, that stores endpoint responses -- records for each endpoint response - -## Nested Class Summary -| Modifier and Type | Class and Description | -| ----------------- | --------------------- | -| sealed interface | [EndpointResponse](#endpointresponse)
stores the endpoint responses | -| record | [EndpointFakeinlineadditionalpropertiesPostCode200Response](#endpointfakeinlineadditionalpropertiespostcode200response)
the response for 200 | - -## EndpointResponse -public sealed interface EndpointResponse permits
-[EndpointFakeinlineadditionalpropertiesPostCode200Response](#endpointfakeinlineadditionalpropertiespostcode200response) - -a sealed interface that stores endpoint responses - -## EndpointFakeinlineadditionalpropertiesPostCode200Response -public record EndpointFakeinlineadditionalpropertiesPostCode200Response( - HttpResponse response, - Nothing? body, - Nothing? headers -) implements EndpointResponse, ApiResponse
- -a class that stores an endpoint response - diff --git a/samples/client/petstore/kotlin/docs/paths/fakeinlineadditionalproperties/post/requestbody/content/applicationjson/ApplicationjsonSchema.md b/samples/client/petstore/kotlin/docs/paths/fakeinlineadditionalproperties/post/requestbody/content/applicationjson/ApplicationjsonSchema.md deleted file mode 100644 index 99e2db386dc..00000000000 --- a/samples/client/petstore/kotlin/docs/paths/fakeinlineadditionalproperties/post/requestbody/content/applicationjson/ApplicationjsonSchema.md +++ /dev/null @@ -1,156 +0,0 @@ -# ApplicationjsonSchema -public class ApplicationjsonSchema
- -A class that contains necessary nested -- schema classes (which validate payloads), extends JsonSchema -- sealed interfaces which store validated payloads, java version of a sum type -- boxed classes which store validated payloads, sealed permits class implementations -- classes to store validated map payloads, extends FrozenMap -- classes to build inputs for map payloads - -## Nested Class Summary -| Modifier and Type | Class and Description | -| ----------------- | ---------------------- | -| sealed interface | [ApplicationjsonSchema.ApplicationjsonSchema1Boxed](#applicationjsonschema1boxed)
sealed interface for validated payloads | -| record | [ApplicationjsonSchema.ApplicationjsonSchema1BoxedMap](#applicationjsonschema1boxedmap)
boxed class to store validated Map payloads | -| static class | [ApplicationjsonSchema.ApplicationjsonSchema1](#applicationjsonschema1)
schema class | -| static class | [ApplicationjsonSchema.ApplicationjsonSchemaMapBuilder](#applicationjsonschemamapbuilder)
builder for Map payloads | -| static class | [ApplicationjsonSchema.ApplicationjsonSchemaMap](#applicationjsonschemamap)
output class for Map payloads | -| sealed interface | [ApplicationjsonSchema.ApplicationjsonAdditionalPropertiesBoxed](#applicationjsonadditionalpropertiesboxed)
sealed interface for validated payloads | -| record | [ApplicationjsonSchema.ApplicationjsonAdditionalPropertiesBoxedString](#applicationjsonadditionalpropertiesboxedstring)
boxed class to store validated String payloads | -| static class | [ApplicationjsonSchema.ApplicationjsonAdditionalProperties](#applicationjsonadditionalproperties)
schema class | - -## ApplicationjsonSchema1Boxed -public sealed interface ApplicationjsonSchema1Boxed
-permits
-[ApplicationjsonSchema1BoxedMap](#applicationjsonschema1boxedmap) - -sealed interface that stores validated payloads using boxed classes - -## ApplicationjsonSchema1BoxedMap -public record ApplicationjsonSchema1BoxedMap
-implements [ApplicationjsonSchema1Boxed](#applicationjsonschema1boxed) - -record that stores validated Map payloads, sealed permits implementation - -### Constructor Summary -| Constructor and Description | -| --------------------------- | -| ApplicationjsonSchema1BoxedMap([ApplicationjsonSchemaMap](#applicationjsonschemamap) data)
Creates an instance, private visibility | - -### Method Summary -| Modifier and Type | Method and Description | -| ----------------- | ---------------------- | -| [ApplicationjsonSchemaMap](#applicationjsonschemamap) | data()
validated payload | -| @Nullable Object | getData()
validated payload | - -## ApplicationjsonSchema1 -public static class ApplicationjsonSchema1
-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.fakeinlineadditionalproperties.post.requestbody.content.applicationjson.ApplicationjsonSchema; - -import java.util.Arrays; -import java.util.List; -import java.util.AbstractMap; - -static final SchemaConfiguration configuration = new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().build()); - -// Map validation -ApplicationjsonSchema.ApplicationjsonSchemaMap validatedPayload = - ApplicationjsonSchema.ApplicationjsonSchema1.validate( - new ApplicationjsonSchema.ApplicationjsonSchemaMapBuilder() - .additionalProperty("someAdditionalProperty", "a") - - .build(), - configuration -); -``` - -### Field Summary -| Modifier and Type | Field and Description | -| ----------------- | ---------------------- | -| Set> | type = Set.of(Map.class) | -| Class | additionalProperties = [ApplicationjsonAdditionalProperties.class](#applicationjsonadditionalproperties) | - -### Method Summary -| Modifier and Type | Method and Description | -| ----------------- | ---------------------- | -| [ApplicationjsonSchemaMap](#applicationjsonschemamap) | validate([Map<?, ?>](#applicationjsonschemamapbuilder) arg, SchemaConfiguration configuration) | -| [ApplicationjsonSchema1BoxedMap](#applicationjsonschema1boxedmap) | validateAndBox([Map<?, ?>](#applicationjsonschemamapbuilder) arg, SchemaConfiguration configuration) | -| [ApplicationjsonSchema1Boxed](#applicationjsonschema1boxed) | validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) | -| @Nullable Object | validate(@Nullable Object arg, SchemaConfiguration configuration) | - -## ApplicationjsonSchemaMapBuilder -public class ApplicationjsonSchemaMapBuilder
-builder for `Map` - -A class that builds the Map input type - -### Constructor Summary -| Constructor and Description | -| --------------------------- | -| ApplicationjsonSchemaMapBuilder()
Creates a builder that contains an empty map | - -### Method Summary -| Modifier and Type | Method and Description | -| ----------------- | ---------------------- | -| Map | build()
Returns map input that should be used with Schema.validate | -| [ApplicationjsonSchemaMapBuilder](#applicationjsonschemamapbuilder) | additionalProperty(String key, String value) | - -## ApplicationjsonSchemaMap -public static class ApplicationjsonSchemaMap
-extends FrozenMap - -A class to store validated Map payloads - -### Method Summary -| Modifier and Type | Method and Description | -| ----------------- | ---------------------- | -| static [ApplicationjsonSchemaMap](#applicationjsonschemamap) | of([Map](#applicationjsonschemamapbuilder) arg, SchemaConfiguration configuration) | -| String | getAdditionalProperty(String name)
provides type safety for additional properties | - -## ApplicationjsonAdditionalPropertiesBoxed -public sealed interface ApplicationjsonAdditionalPropertiesBoxed
-permits
-[ApplicationjsonAdditionalPropertiesBoxedString](#applicationjsonadditionalpropertiesboxedstring) - -sealed interface that stores validated payloads using boxed classes - -## ApplicationjsonAdditionalPropertiesBoxedString -public record ApplicationjsonAdditionalPropertiesBoxedString
-implements [ApplicationjsonAdditionalPropertiesBoxed](#applicationjsonadditionalpropertiesboxed) - -record that stores validated String payloads, sealed permits implementation - -### Constructor Summary -| Constructor and Description | -| --------------------------- | -| ApplicationjsonAdditionalPropertiesBoxedString(String data)
Creates an instance, private visibility | - -### Method Summary -| Modifier and Type | Method and Description | -| ----------------- | ---------------------- | -| String | data()
validated payload | -| @Nullable Object | getData()
validated payload | - -## ApplicationjsonAdditionalProperties -public static class ApplicationjsonAdditionalProperties
-extends StringJsonSchema.StringJsonSchema1 - -A schema class that validates payloads - -| Methods Inherited from class org.openapijsonschematools.client.schemas.StringJsonSchema.StringJsonSchema1 | -| ------------------------------------------------------------------ | -| validate | -| validateAndBox | diff --git a/samples/client/petstore/kotlin/docs/paths/fakeinlineadditionalproperties/post/responses/FakeinlineadditionalpropertiesPostCode200Response.md b/samples/client/petstore/kotlin/docs/paths/fakeinlineadditionalproperties/post/responses/FakeinlineadditionalpropertiesPostCode200Response.md deleted file mode 100644 index 2c23bf79f3b..00000000000 --- a/samples/client/petstore/kotlin/docs/paths/fakeinlineadditionalproperties/post/responses/FakeinlineadditionalpropertiesPostCode200Response.md +++ /dev/null @@ -1,17 +0,0 @@ -# FakeinlineadditionalpropertiesPostCode200Response - -public class FakeinlineadditionalpropertiesPostCode200Response extends [SuccessDescriptionOnly](../../components/responses/SuccessDescriptionOnly.md) - -A class (extended from the $ref class) that contains necessary nested response classes -- a class that extends ResponseDeserializer and is used to deserialize responses - -## Nested Class Summary -| Modifier and Type | Class and Description | -| ----------------- | --------------------- | -| static class | [FakeinlineadditionalpropertiesPostCode200Response.FakeinlineadditionalpropertiesPostCode200Response1](#fakeinlineadditionalpropertiespostcode200response1)
class that deserializes responses | - -## FakeinlineadditionalpropertiesPostCode200Response1 -public static class FakeinlineadditionalpropertiesPostCode200Response1 extends [SuccessDescriptionOnly1](../../components/responses/SuccessDescriptionOnly.md#successdescriptiononly1)
- -a class that deserializes responses, extended from the $ref class - diff --git a/samples/client/petstore/kotlin/docs/paths/fakeinlinecomposition/FakeinlinecompositionPost.md b/samples/client/petstore/kotlin/docs/paths/fakeinlinecomposition/FakeinlinecompositionPost.md deleted file mode 100644 index 8a6f721e5cd..00000000000 --- a/samples/client/petstore/kotlin/docs/paths/fakeinlinecomposition/FakeinlinecompositionPost.md +++ /dev/null @@ -1,155 +0,0 @@ -# FakeinlinecompositionPost - -public class FakeinlinecompositionPost - -A class that contains necessary endpoint classes -- a class that calls the endpoint method using the http verb -- a class that calls the endpoint method using the operationId name -- class(es) to store the request inputs -- builder(s) to set the request input data - -## Nested Class Summary -| Modifier and Type | Class and Description | -| ----------------- | --------------------- | -| static class | [Post](#post)
The class that has a post method to call the endpoint | -| interface | [InlineCompositionOperation](#inlinecompositionoperation)
The interface that has a inlineComposition method to call the endpoint | -| static class | [PostRequest](#postrequest)
The request inputs class | -| static class | [PostRequestBuilder](#postrequestbuilder)
A builder for the request input class | - -## Post -public static class Post 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.FakeinlinecompositionPostRequestBody; -import org.openapijsonschematools.client.paths.fakeinlinecomposition.post.requestbody.content.applicationjson.ApplicationjsonSchema; -import org.openapijsonschematools.client.paths.fakeinlinecomposition.post.FakeinlinecompositionPostQueryParameters; -import org.openapijsonschematools.client.RootServerInfo; -import org.openapijsonschematools.client.servers.RootServer0; -import org.openapijsonschematools.client.servers.RootServer1; -import org.openapijsonschematools.client.servers.RootServer2; -import org.openapijsonschematools.client.paths.fakeinlinecomposition.post.responses.FakeinlinecompositionPostCode200Response; -import org.openapijsonschematools.client.servers.RootServerInfo; -import org.openapijsonschematools.client.paths.fakeinlinecomposition.FakeinlinecompositionPost; -import org.openapijsonschematools.client.paths.fakeinlinecomposition.post.FakeinlinecompositionPostResponses; - -import java.io.IOException; -import java.util.Arrays; -import java.util.List; -import java.util.Map; -import java.util.AbstractMap; - -// if you want to use a server that is not SERVER_0 pass it in here and change the ServerIndex input below -ApiConfiguration.ServerInfo serverInfo = new ApiConfiguration.ServerInfoBuilder() - .rootServerInfo( - new RootServerInfo.RootServerInfoBuilder() - .rootServer0(new RootServer0()) - .build() - ) - .build(); -ApiConfiguration.ServerIndexInfo serverIndexInfo = new ApiConfiguration.ServerIndexInfoBuilder() - .rootServerInfoServerIndex(RootServerInfo.ServerIndex.SERVER_0) - .build(); -Duration timeout = Duration.ofSeconds(1L); -Map> defaultHeaders = Map.of("User-Agent", List.of("OpenAPI-JSON-Schema-Generator/1.0.0/java")); -ApiConfiguration apiConfiguration = new ApiConfiguration( - serverInfo - serverIndexInfo, - timeout, - defaultHeaders -); -SchemaConfiguration schemaConfiguration = new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().build()); -FakeinlinecompositionPost.Post apiClient = new FakeinlinecompositionPost.Post(apiConfiguration, schemaConfiguration); - - -var request = new FakeinlinecompositionPost.PostRequestBuilder().build(); - -FakeinlinecompositionPostResponses.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; -} -FakeinlinecompositionPostResponses.EndpointFakeinlinecompositionPostCode200Response castResponse = (FakeinlinecompositionPostResponses.EndpointFakeinlinecompositionPostCode200Response) response; -if (castResponse.body instanceof FakeinlinecompositionPostCode200Response.ApplicationjsonResponseBody deserializedBody) { - // handle deserialized body here -} else { - FakeinlinecompositionPostCode200Response.MultipartformdataResponseBody deserializedBody = (FakeinlinecompositionPostCode200Response.MultipartformdataResponseBody) castResponse.body; - // handle deserialized body here -} -``` -### Constructor Summary -| Constructor and Description | -| --------------------------- | -| Post(ApiConfiguration apiConfiguration, SchemaConfiguration schemaConfiguration)
Creates an instance | - -### Method Summary -| Modifier and Type | Method and Description | -| ----------------- | ---------------------- | -| [FakeinlinecompositionPostResponses.EndpointResponse](../../paths/fakeinlinecomposition/post/FakeinlinecompositionPostResponses.md#endpointresponse) | post([PostRequest](#postrequest) request) | - -## InlineCompositionOperation -public interface InlineCompositionOperation
- -an interface that allows one to call the endpoint using a method named inlineComposition by the operationId - -### Method Summary -| Modifier and Type | Method and Description | -| ----------------- | ---------------------- | -| [FakeinlinecompositionPostResponses.EndpointResponse](../../paths/fakeinlinecomposition/post/FakeinlinecompositionPostResponses.md#endpointresponse) | inlineComposition([PostRequest](#postrequest) request) | - -## PostRequest -public static class PostRequest
- -a class that stores the final request inputs - -### Field Summary -| Modifier and Type | Field and Description | -| ----------------- | --------------------- | -| [FakeinlinecompositionPostRequestBody.@Nullable SealedRequestBody](../../paths/fakeinlinecomposition/post/FakeinlinecompositionPostRequestBody.md#sealedrequestbody) | requestBody
optional | -| [FakeinlinecompositionPostQueryParameters.@Nullable QueryParametersMap](../../paths/fakeinlinecomposition/post/FakeinlinecompositionPostQueryParameters.md#queryparametersmap) | queryParameters
optional | -| [RootServerInfo.@Nullable ServerIndex](../../RootServerInfo.md#serverindex) | serverIndex
optional. Note: this will override the value in apiConfiguration | -| @Nullable Duration | timeout
optional. Note: this will override the value in apiConfiguration | - -## PostRequestBuilder -public static class PostRequestBuilder
- -a builder for request inputs - -### Constructor Summary -| Constructor and Description | -| --------------------------- | -| PostRequestBuilder()
Creates a builder that contains null for all parameters | - -### Method Summary -| Modifier and Type | Method and Description | -| ----------------- | ---------------------- | -| [PostRequest](#postrequest) | build()
Returns the request input used to call an endpoint method | -| [PostRequestBuilder](#postrequestbuilder) | requestBody([FakeinlinecompositionPostRequestBody.SealedRequestBody](../../paths/fakeinlinecomposition/post/FakeinlinecompositionPostRequestBody.md#sealedrequestbody) requestBody)
sets the optional property | -| [PostRequestBuilder](#postrequestbuilder) | queryParameters([FakeinlinecompositionPostQueryParametersQueryParametersMap](../../paths/fakeinlinecomposition/post/FakeinlinecompositionPostQueryParameters.md#queryparametersmap) queryParameters)
sets the optional property | -| [PostRequestBuilder](#postrequestbuilder) | serverIndex([RootServerInfo.ServerIndex](../../RootServerInfo.md#serverindex) serverIndex)
sets the optional property. Note: this will override the value in apiConfiguration | -| [PostRequestBuilder](#postrequestbuilder) | timeout(Duration timeout)
sets the optional property. Note: this will override the value in apiConfiguration | - -[[Back to top]](#top) [[Back to README]](../../../README.md) diff --git a/samples/client/petstore/kotlin/docs/paths/fakeinlinecomposition/post/FakeinlinecompositionPostQueryParameters.md b/samples/client/petstore/kotlin/docs/paths/fakeinlinecomposition/post/FakeinlinecompositionPostQueryParameters.md deleted file mode 100644 index 320f389493c..00000000000 --- a/samples/client/petstore/kotlin/docs/paths/fakeinlinecomposition/post/FakeinlinecompositionPostQueryParameters.md +++ /dev/null @@ -1,264 +0,0 @@ -# FakeinlinecompositionPostQueryParameters -public class FakeinlinecompositionPostQueryParameters
- -A class that contains necessary nested -- schema classes (which validate payloads), extends JsonSchema -- sealed interfaces which store validated payloads, java version of a sum type -- boxed classes which store validated payloads, sealed permits class implementations -- classes to store validated map payloads, extends FrozenMap -- classes to build inputs for map payloads - -## Nested Class Summary -| Modifier and Type | Class and Description | -| ----------------- | ---------------------- | -| sealed interface | [FakeinlinecompositionPostQueryParameters.FakeinlinecompositionPostQueryParameters1Boxed](#fakeinlinecompositionpostqueryparameters1boxed)
sealed interface for validated payloads | -| record | [FakeinlinecompositionPostQueryParameters.FakeinlinecompositionPostQueryParameters1BoxedMap](#fakeinlinecompositionpostqueryparameters1boxedmap)
boxed class to store validated Map payloads | -| static class | [FakeinlinecompositionPostQueryParameters.FakeinlinecompositionPostQueryParameters1](#fakeinlinecompositionpostqueryparameters1)
schema class | -| static class | [FakeinlinecompositionPostQueryParameters.QueryParametersMapBuilder](#queryparametersmapbuilder)
builder for Map payloads | -| static class | [FakeinlinecompositionPostQueryParameters.QueryParametersMap](#queryparametersmap)
output class for Map payloads | -| sealed interface | [FakeinlinecompositionPostQueryParameters.AdditionalPropertiesBoxed](#additionalpropertiesboxed)
sealed interface for validated payloads | -| record | [FakeinlinecompositionPostQueryParameters.AdditionalPropertiesBoxedVoid](#additionalpropertiesboxedvoid)
boxed class to store validated null payloads | -| record | [FakeinlinecompositionPostQueryParameters.AdditionalPropertiesBoxedBoolean](#additionalpropertiesboxedboolean)
boxed class to store validated boolean payloads | -| record | [FakeinlinecompositionPostQueryParameters.AdditionalPropertiesBoxedNumber](#additionalpropertiesboxednumber)
boxed class to store validated Number payloads | -| record | [FakeinlinecompositionPostQueryParameters.AdditionalPropertiesBoxedString](#additionalpropertiesboxedstring)
boxed class to store validated String payloads | -| record | [FakeinlinecompositionPostQueryParameters.AdditionalPropertiesBoxedList](#additionalpropertiesboxedlist)
boxed class to store validated List payloads | -| record | [FakeinlinecompositionPostQueryParameters.AdditionalPropertiesBoxedMap](#additionalpropertiesboxedmap)
boxed class to store validated Map payloads | -| static class | [FakeinlinecompositionPostQueryParameters.AdditionalProperties](#additionalproperties)
schema class | - -## FakeinlinecompositionPostQueryParameters1Boxed -public sealed interface FakeinlinecompositionPostQueryParameters1Boxed
-permits
-[FakeinlinecompositionPostQueryParameters1BoxedMap](#fakeinlinecompositionpostqueryparameters1boxedmap) - -sealed interface that stores validated payloads using boxed classes - -## FakeinlinecompositionPostQueryParameters1BoxedMap -public record FakeinlinecompositionPostQueryParameters1BoxedMap
-implements [FakeinlinecompositionPostQueryParameters1Boxed](#fakeinlinecompositionpostqueryparameters1boxed) - -record that stores validated Map payloads, sealed permits implementation - -### Constructor Summary -| Constructor and Description | -| --------------------------- | -| FakeinlinecompositionPostQueryParameters1BoxedMap([QueryParametersMap](#queryparametersmap) data)
Creates an instance, private visibility | - -### Method Summary -| Modifier and Type | Method and Description | -| ----------------- | ---------------------- | -| [QueryParametersMap](#queryparametersmap) | data()
validated payload | -| @Nullable Object | getData()
validated payload | - -## FakeinlinecompositionPostQueryParameters1 -public static class FakeinlinecompositionPostQueryParameters1
-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.fakeinlinecomposition.post.FakeinlinecompositionPostQueryParameters; - -import java.util.Arrays; -import java.util.List; -import java.util.AbstractMap; - -static final SchemaConfiguration configuration = new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().build()); - -// Map validation -FakeinlinecompositionPostQueryParameters.QueryParametersMap validatedPayload = - FakeinlinecompositionPostQueryParameters.FakeinlinecompositionPostQueryParameters1.validate( - new FakeinlinecompositionPostQueryParameters.QueryParametersMapBuilder() - .compositionInProperty( - MapUtils.makeMap( - ) - ) - .build(), - configuration -); -``` - -### Field Summary -| Modifier and Type | Field and Description | -| ----------------- | ---------------------- | -| Set> | type = Set.of(Map.class) | -| Map> | properties = Map.ofEntries(
    new PropertyEntry("compositionAtRoot", [Schema0.Schema01.class](../../../paths/fakeinlinecomposition/post/parameters/parameter0/Schema0.md#schema01)),
    new PropertyEntry("compositionInProperty", [Schema1.Schema11.class](../../../paths/fakeinlinecomposition/post/parameters/parameter1/Schema1.md#schema11))
)
| -| Class | additionalProperties = [AdditionalProperties.class](#additionalproperties) | - -### Method Summary -| Modifier and Type | Method and Description | -| ----------------- | ---------------------- | -| [QueryParametersMap](#queryparametersmap) | validate([Map<?, ?>](#queryparametersmapbuilder) arg, SchemaConfiguration configuration) | -| [FakeinlinecompositionPostQueryParameters1BoxedMap](#fakeinlinecompositionpostqueryparameters1boxedmap) | validateAndBox([Map<?, ?>](#queryparametersmapbuilder) arg, SchemaConfiguration configuration) | -| [FakeinlinecompositionPostQueryParameters1Boxed](#fakeinlinecompositionpostqueryparameters1boxed) | validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) | -| @Nullable Object | validate(@Nullable Object arg, SchemaConfiguration configuration) | - -## QueryParametersMapBuilder -public class QueryParametersMapBuilder
-builder for `Map` - -A class that builds the Map input type - -### Constructor Summary -| Constructor and Description | -| --------------------------- | -| QueryParametersMapBuilder()
Creates a builder that contains an empty map | - -### Method Summary -| Modifier and Type | Method and Description | -| ----------------- | ---------------------- | -| Map | build()
Returns map input that should be used with Schema.validate | -| [QueryParametersMapBuilder](#queryparametersmapbuilder) | compositionAtRoot(Nothing? value) | -| [QueryParametersMapBuilder](#queryparametersmapbuilder) | compositionAtRoot(boolean value) | -| [QueryParametersMapBuilder](#queryparametersmapbuilder) | compositionAtRoot(String value) | -| [QueryParametersMapBuilder](#queryparametersmapbuilder) | compositionAtRoot(int value) | -| [QueryParametersMapBuilder](#queryparametersmapbuilder) | compositionAtRoot(float value) | -| [QueryParametersMapBuilder](#queryparametersmapbuilder) | compositionAtRoot(long value) | -| [QueryParametersMapBuilder](#queryparametersmapbuilder) | compositionAtRoot(double value) | -| [QueryParametersMapBuilder](#queryparametersmapbuilder) | compositionAtRoot(List value) | -| [QueryParametersMapBuilder](#queryparametersmapbuilder) | compositionAtRoot(Map value) | -| [QueryParametersMapBuilder](#queryparametersmapbuilder) | compositionInProperty(Map value) | - -## QueryParametersMap -public static class QueryParametersMap
-extends FrozenMap - -A class to store validated Map payloads - -### Method Summary -| Modifier and Type | Method and Description | -| ----------------- | ---------------------- | -| static [QueryParametersMap](#queryparametersmap) | of([Map](#queryparametersmapbuilder) arg, SchemaConfiguration configuration) | -| @Nullable Object | compositionAtRoot()
[optional] | -| [Schema1.SchemaMap1](../../../paths/fakeinlinecomposition/post/parameters/parameter1/Schema1.md#schemamap1) | compositionInProperty()
[optional] | - -## 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(Nothing? data)
Creates an instance, private visibility | - -### Method Summary -| Modifier and Type | Method and Description | -| ----------------- | ---------------------- | -| Nothing? | 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/kotlin/docs/paths/fakeinlinecomposition/post/FakeinlinecompositionPostRequestBody.md b/samples/client/petstore/kotlin/docs/paths/fakeinlinecomposition/post/FakeinlinecompositionPostRequestBody.md deleted file mode 100644 index b30d7b48634..00000000000 --- a/samples/client/petstore/kotlin/docs/paths/fakeinlinecomposition/post/FakeinlinecompositionPostRequestBody.md +++ /dev/null @@ -1,128 +0,0 @@ -# FakeinlinecompositionPostRequestBody - -public class FakeinlinecompositionPostRequestBody - -A class that contains necessary nested request body classes -- SealedMediaType, a sealed interface which contains all the schema/encoding info for each contentType -- records which implement SealedMediaType, the concrete media types -- a class that extends RequestBodySerializer and is used to serialize input SealedRequestBody instances -- SealedRequestBody, a sealed interface which contains all the contentType/schema input types -- records which implement SealedRequestBody, the concrete request body types - -## Nested Class Summary -| Modifier and Type | Class and Description | -| ----------------- | --------------------- | -| sealed interface | [FakeinlinecompositionPostRequestBody.SealedMediaType](#sealedmediatype)
media type sealed interface | -| record | [FakeinlinecompositionPostRequestBody.ApplicationjsonMediaType](#applicationjsonmediatype)
record storing schema + encoding for a specific contentType | -| record | [FakeinlinecompositionPostRequestBody.MultipartformdataMediaType](#multipartformdatamediatype)
record storing schema + encoding for a specific contentType | -| static class | [FakeinlinecompositionPostRequestBody.FakeinlinecompositionPostRequestBody1](#fakeinlinecompositionpostrequestbody1)
class that serializes request bodies | -| sealed interface | [FakeinlinecompositionPostRequestBody.SealedRequestBody](#sealedrequestbody)
request body sealed interface | -| record | [FakeinlinecompositionPostRequestBody.ApplicationjsonRequestBody](#applicationjsonrequestbody)
implements sealed interface to store request body input | -| record | [FakeinlinecompositionPostRequestBody.MultipartformdataRequestBody](#multipartformdatarequestbody)
implements sealed interface to store request body input | - -## SealedMediaType -public sealed interface SealedMediaType
-permits
-[ApplicationjsonMediaType](#applicationjsonmediatype), -[MultipartformdataMediaType](#multipartformdatamediatype) - -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), Nothing?> - -class storing schema info for a specific contentType - -### Constructor Summary -| Constructor and Description | -| --------------------------- | -| ApplicationjsonMediaType()
Creates an instance | - -### 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 | -| Nothing? | encoding()
the encoding info | - -## MultipartformdataMediaType -public record MultipartformdataMediaType
-implements [SealedMediaType](#sealedmediatype), MediaType<[MultipartformdataSchema.MultipartformdataSchema1](../../../paths/fakeinlinecomposition/post/requestbody/content/multipartformdata/MultipartformdataSchema.md#multipartformdataschema1), Nothing?> - -class storing schema info for a specific contentType - -### Constructor Summary -| Constructor and Description | -| --------------------------- | -| MultipartformdataMediaType()
Creates an instance | - -### 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 | -| Nothing? | encoding()
the encoding info | - -## FakeinlinecompositionPostRequestBody1 -public static class FakeinlinecompositionPostRequestBody1
- -a class that serializes SealedRequestBody request bodies - -### Constructor Summary -| Constructor and Description | -| --------------------------- | -| FakeinlinecompositionPostRequestBody1()
Creates an instance | - -### Field Summary -| Modifier and Type | Field and Description | -| ----------------- | --------------------- | -| boolean | required = false
whether the request body is required | -| Map | content = Map.ofEntries(
    new AbstractMap.SimpleEntry<>("application/json", new [ApplicationjsonMediaType](#applicationjsonmediatype)()),
    new AbstractMap.SimpleEntry<>("multipart/form-data", new [MultipartformdataMediaType](#multipartformdatamediatype)())
)
the contentType to schema info | - -### Method Summary -| Modifier and Type | Method and Description | -| ----------------- | ---------------------- | -| SerializedRequestBody | serialize([SealedRequestBody](#sealedrequestbody) requestBody)
called by endpoint when creating request body bytes | - -## SealedRequestBody -public sealed interface SealedRequestBody
-permits
-[ApplicationjsonRequestBody](#applicationjsonrequestbody), -[MultipartformdataRequestBody](#multipartformdatarequestbody) - -sealed interface that stores request contentType + validated schema data - -## ApplicationjsonRequestBody -public record ApplicationjsonRequestBody
-implements [SealedRequestBody](#sealedrequestbody),
-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 | - -### 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 | -## MultipartformdataRequestBody -public record MultipartformdataRequestBody
-implements [SealedRequestBody](#sealedrequestbody),
-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 | - -### 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 | diff --git a/samples/client/petstore/kotlin/docs/paths/fakeinlinecomposition/post/FakeinlinecompositionPostResponses.md b/samples/client/petstore/kotlin/docs/paths/fakeinlinecomposition/post/FakeinlinecompositionPostResponses.md deleted file mode 100644 index adf05cf26fe..00000000000 --- a/samples/client/petstore/kotlin/docs/paths/fakeinlinecomposition/post/FakeinlinecompositionPostResponses.md +++ /dev/null @@ -1,29 +0,0 @@ -# FakeinlinecompositionPostResponses - -public class FakeinlinecompositionPostResponses - -A class that contains necessary responses classes -- a sealed interface, EndpointResponse, that stores endpoint responses -- records for each endpoint response - -## Nested Class Summary -| Modifier and Type | Class and Description | -| ----------------- | --------------------- | -| sealed interface | [EndpointResponse](#endpointresponse)
stores the endpoint responses | -| record | [EndpointFakeinlinecompositionPostCode200Response](#endpointfakeinlinecompositionpostcode200response)
the response for 200 | - -## EndpointResponse -public sealed interface EndpointResponse permits
-[EndpointFakeinlinecompositionPostCode200Response](#endpointfakeinlinecompositionpostcode200response) - -a sealed interface that stores endpoint responses - -## EndpointFakeinlinecompositionPostCode200Response -public record EndpointFakeinlinecompositionPostCode200Response( - HttpResponse response, - [FakeinlinecompositionPostCode200Response.SealedResponseBody](../../../paths/fakeinlinecomposition/post/responses/FakeinlinecompositionPostCode200Response.md#sealedresponsebody) body, - Nothing? headers -) implements EndpointResponse, ApiResponse
- -a class that stores an endpoint response - diff --git a/samples/client/petstore/kotlin/docs/paths/fakeinlinecomposition/post/parameters/parameter0/Schema0.md b/samples/client/petstore/kotlin/docs/paths/fakeinlinecomposition/post/parameters/parameter0/Schema0.md deleted file mode 100644 index ba6a38f1749..00000000000 --- a/samples/client/petstore/kotlin/docs/paths/fakeinlinecomposition/post/parameters/parameter0/Schema0.md +++ /dev/null @@ -1,236 +0,0 @@ -# Schema0 -public class Schema0
- -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 - -## Nested Class Summary -| Modifier and Type | Class and Description | -| ----------------- | ---------------------- | -| sealed interface | [Schema0.Schema01Boxed](#schema01boxed)
sealed interface for validated payloads | -| record | [Schema0.Schema01BoxedVoid](#schema01boxedvoid)
boxed class to store validated null payloads | -| record | [Schema0.Schema01BoxedBoolean](#schema01boxedboolean)
boxed class to store validated boolean payloads | -| record | [Schema0.Schema01BoxedNumber](#schema01boxednumber)
boxed class to store validated Number payloads | -| record | [Schema0.Schema01BoxedString](#schema01boxedstring)
boxed class to store validated String payloads | -| record | [Schema0.Schema01BoxedList](#schema01boxedlist)
boxed class to store validated List payloads | -| record | [Schema0.Schema01BoxedMap](#schema01boxedmap)
boxed class to store validated Map payloads | -| static class | [Schema0.Schema01](#schema01)
schema class | -| sealed interface | [Schema0.Schema00Boxed](#schema00boxed)
sealed interface for validated payloads | -| record | [Schema0.Schema00BoxedString](#schema00boxedstring)
boxed class to store validated String payloads | -| static class | [Schema0.Schema00](#schema00)
schema class | - -## Schema01Boxed -public sealed interface Schema01Boxed
-permits
-[Schema01BoxedVoid](#schema01boxedvoid), -[Schema01BoxedBoolean](#schema01boxedboolean), -[Schema01BoxedNumber](#schema01boxednumber), -[Schema01BoxedString](#schema01boxedstring), -[Schema01BoxedList](#schema01boxedlist), -[Schema01BoxedMap](#schema01boxedmap) - -sealed interface that stores validated payloads using boxed classes - -## Schema01BoxedVoid -public record Schema01BoxedVoid
-implements [Schema01Boxed](#schema01boxed) - -record that stores validated null payloads, sealed permits implementation - -### Constructor Summary -| Constructor and Description | -| --------------------------- | -| Schema01BoxedVoid(Nothing? data)
Creates an instance, private visibility | - -### Method Summary -| Modifier and Type | Method and Description | -| ----------------- | ---------------------- | -| Nothing? | data()
validated payload | -| @Nullable Object | getData()
validated payload | - -## Schema01BoxedBoolean -public record Schema01BoxedBoolean
-implements [Schema01Boxed](#schema01boxed) - -record that stores validated boolean payloads, sealed permits implementation - -### Constructor Summary -| Constructor and Description | -| --------------------------- | -| Schema01BoxedBoolean(boolean data)
Creates an instance, private visibility | - -### Method Summary -| Modifier and Type | Method and Description | -| ----------------- | ---------------------- | -| boolean | data()
validated payload | -| @Nullable Object | getData()
validated payload | - -## Schema01BoxedNumber -public record Schema01BoxedNumber
-implements [Schema01Boxed](#schema01boxed) - -record that stores validated Number payloads, sealed permits implementation - -### Constructor Summary -| Constructor and Description | -| --------------------------- | -| Schema01BoxedNumber(Number data)
Creates an instance, private visibility | - -### Method Summary -| Modifier and Type | Method and Description | -| ----------------- | ---------------------- | -| Number | data()
validated payload | -| @Nullable Object | getData()
validated payload | - -## Schema01BoxedString -public record Schema01BoxedString
-implements [Schema01Boxed](#schema01boxed) - -record that stores validated String payloads, sealed permits implementation - -### Constructor Summary -| Constructor and Description | -| --------------------------- | -| Schema01BoxedString(String data)
Creates an instance, private visibility | - -### Method Summary -| Modifier and Type | Method and Description | -| ----------------- | ---------------------- | -| String | data()
validated payload | -| @Nullable Object | getData()
validated payload | - -## Schema01BoxedList -public record Schema01BoxedList
-implements [Schema01Boxed](#schema01boxed) - -record that stores validated List payloads, sealed permits implementation - -### Constructor Summary -| Constructor and Description | -| --------------------------- | -| Schema01BoxedList(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 | - -## Schema01BoxedMap -public record Schema01BoxedMap
-implements [Schema01Boxed](#schema01boxed) - -record that stores validated Map payloads, sealed permits implementation - -### Constructor Summary -| Constructor and Description | -| --------------------------- | -| Schema01BoxedMap(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 | - -## Schema01 -public static class Schema01
-extends JsonSchema - -A schema class that validates payloads - -### Field Summary -| Modifier and Type | Field and Description | -| ----------------- | ---------------------- | -| List> | allOf = List.of(
    [Schema00.class](#schema00)
;)
| - -### Method Summary -| Modifier and Type | Method and Description | -| ----------------- | ---------------------- | -| String | validate(String arg, SchemaConfiguration configuration) | -| Nothing? | validate(Nothing? arg, SchemaConfiguration configuration) | -| int | validate(int arg, SchemaConfiguration configuration) | -| long | validate(long arg, SchemaConfiguration configuration) | -| float | validate(float arg, SchemaConfiguration configuration) | -| double | validate(double arg, SchemaConfiguration configuration) | -| Number | validate(Number arg, SchemaConfiguration configuration) | -| boolean | validate(boolean arg, SchemaConfiguration configuration) | -| FrozenMap<@Nullable Object> | validate(Map<?, ?> arg, SchemaConfiguration configuration) | -| FrozenList<@Nullable Object> | validate(List arg, SchemaConfiguration configuration) | -| [Schema01BoxedString](#schema01boxedstring) | validateAndBox(String arg, SchemaConfiguration configuration) | -| [Schema01BoxedVoid](#schema01boxedvoid) | validateAndBox(Nothing? arg, SchemaConfiguration configuration) | -| [Schema01BoxedNumber](#schema01boxednumber) | validateAndBox(Number arg, SchemaConfiguration configuration) | -| [Schema01BoxedBoolean](#schema01boxedboolean) | validateAndBox(boolean arg, SchemaConfiguration configuration) | -| [Schema01BoxedMap](#schema01boxedmap) | validateAndBox(Map<?, ?> arg, SchemaConfiguration configuration) | -| [Schema01BoxedList](#schema01boxedlist) | validateAndBox(List arg, SchemaConfiguration configuration) | -| [Schema01Boxed](#schema01boxed) | validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) | -| @Nullable Object | validate(@Nullable Object arg, SchemaConfiguration configuration) | - -## Schema00Boxed -public sealed interface Schema00Boxed
-permits
-[Schema00BoxedString](#schema00boxedstring) - -sealed interface that stores validated payloads using boxed classes - -## Schema00BoxedString -public record Schema00BoxedString
-implements [Schema00Boxed](#schema00boxed) - -record that stores validated String payloads, sealed permits implementation - -### Constructor Summary -| Constructor and Description | -| --------------------------- | -| Schema00BoxedString(String data)
Creates an instance, private visibility | - -### Method Summary -| Modifier and Type | Method and Description | -| ----------------- | ---------------------- | -| String | data()
validated payload | -| @Nullable Object | getData()
validated payload | - -## Schema00 -public static class Schema00
-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.fakeinlinecomposition.post.parameters.parameter0.Schema0; - -import java.util.Arrays; -import java.util.List; -import java.util.AbstractMap; - -static final SchemaConfiguration configuration = new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().build()); - -// String validation -String validatedPayload = Schema0.Schema00.validate( - "a", - configuration -); -``` - -### Field Summary -| Modifier and Type | Field and Description | -| ----------------- | ---------------------- | -| Set> | type = Set.of(
    String.class
)
| -| Integer | minLength = 1 | - -### Method Summary -| Modifier and Type | Method and Description | -| ----------------- | ---------------------- | -| String | validate(String arg, SchemaConfiguration configuration) | -| [Schema00BoxedString](#schema00boxedstring) | validateAndBox(String arg, SchemaConfiguration configuration) | -| [Schema00Boxed](#schema00boxed) | validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) | -| @Nullable Object | validate(@Nullable Object arg, SchemaConfiguration configuration) | diff --git a/samples/client/petstore/kotlin/docs/paths/fakeinlinecomposition/post/parameters/parameter1/Schema1.md b/samples/client/petstore/kotlin/docs/paths/fakeinlinecomposition/post/parameters/parameter1/Schema1.md deleted file mode 100644 index a46f468b1d1..00000000000 --- a/samples/client/petstore/kotlin/docs/paths/fakeinlinecomposition/post/parameters/parameter1/Schema1.md +++ /dev/null @@ -1,359 +0,0 @@ -# Schema1 -public class Schema1
- -A class that contains necessary nested -- schema classes (which validate payloads), extends JsonSchema -- sealed interfaces which store validated payloads, java version of a sum type -- boxed classes which store validated payloads, sealed permits class implementations -- classes to store validated map payloads, extends FrozenMap -- classes to build inputs for map payloads - -## Nested Class Summary -| Modifier and Type | Class and Description | -| ----------------- | ---------------------- | -| sealed interface | [Schema1.Schema11Boxed](#schema11boxed)
sealed interface for validated payloads | -| record | [Schema1.Schema11BoxedMap](#schema11boxedmap)
boxed class to store validated Map payloads | -| static class | [Schema1.Schema11](#schema11)
schema class | -| static class | [Schema1.SchemaMapBuilder1](#schemamapbuilder1)
builder for Map payloads | -| static class | [Schema1.SchemaMap1](#schemamap1)
output class for Map payloads | -| sealed interface | [Schema1.SomeProp1Boxed](#someprop1boxed)
sealed interface for validated payloads | -| record | [Schema1.SomeProp1BoxedVoid](#someprop1boxedvoid)
boxed class to store validated null payloads | -| record | [Schema1.SomeProp1BoxedBoolean](#someprop1boxedboolean)
boxed class to store validated boolean payloads | -| record | [Schema1.SomeProp1BoxedNumber](#someprop1boxednumber)
boxed class to store validated Number payloads | -| record | [Schema1.SomeProp1BoxedString](#someprop1boxedstring)
boxed class to store validated String payloads | -| record | [Schema1.SomeProp1BoxedList](#someprop1boxedlist)
boxed class to store validated List payloads | -| record | [Schema1.SomeProp1BoxedMap](#someprop1boxedmap)
boxed class to store validated Map payloads | -| static class | [Schema1.SomeProp1](#someprop1)
schema class | -| sealed interface | [Schema1.Schema01Boxed](#schema01boxed)
sealed interface for validated payloads | -| record | [Schema1.Schema01BoxedString](#schema01boxedstring)
boxed class to store validated String payloads | -| static class | [Schema1.Schema01](#schema01)
schema class | - -## Schema11Boxed -public sealed interface Schema11Boxed
-permits
-[Schema11BoxedMap](#schema11boxedmap) - -sealed interface that stores validated payloads using boxed classes - -## Schema11BoxedMap -public record Schema11BoxedMap
-implements [Schema11Boxed](#schema11boxed) - -record that stores validated Map payloads, sealed permits implementation - -### Constructor Summary -| Constructor and Description | -| --------------------------- | -| Schema11BoxedMap([SchemaMap1](#schemamap1) data)
Creates an instance, private visibility | - -### Method Summary -| Modifier and Type | Method and Description | -| ----------------- | ---------------------- | -| [SchemaMap1](#schemamap1) | data()
validated payload | -| @Nullable Object | getData()
validated payload | - -## Schema11 -public static class Schema11
-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.fakeinlinecomposition.post.parameters.parameter1.Schema1; - -import java.util.Arrays; -import java.util.List; -import java.util.AbstractMap; - -static final SchemaConfiguration configuration = new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().build()); - -// Map validation -Schema1.SchemaMap1 validatedPayload = - Schema1.Schema11.validate( - new Schema1.SchemaMapBuilder1() - .build(), - configuration -); -``` - -### Field Summary -| Modifier and Type | Field and Description | -| ----------------- | ---------------------- | -| Set> | type = Set.of(Map.class) | -| Map> | properties = Map.ofEntries(
    new PropertyEntry("someProp", [SomeProp1.class](#someprop1)))
)
| - -### Method Summary -| Modifier and Type | Method and Description | -| ----------------- | ---------------------- | -| [SchemaMap1](#schemamap1) | validate([Map<?, ?>](#schemamapbuilder1) arg, SchemaConfiguration configuration) | -| [Schema11BoxedMap](#schema11boxedmap) | validateAndBox([Map<?, ?>](#schemamapbuilder1) arg, SchemaConfiguration configuration) | -| [Schema11Boxed](#schema11boxed) | validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) | -| @Nullable Object | validate(@Nullable Object arg, SchemaConfiguration configuration) | - -## SchemaMapBuilder1 -public class SchemaMapBuilder1
-builder for `Map` - -A class that builds the Map input type - -### Constructor Summary -| Constructor and Description | -| --------------------------- | -| SchemaMapBuilder1()
Creates a builder that contains an empty map | - -### Method Summary -| Modifier and Type | Method and Description | -| ----------------- | ---------------------- | -| Map | build()
Returns map input that should be used with Schema.validate | -| [SchemaMapBuilder1](#schemamapbuilder1) | someProp(Nothing? value) | -| [SchemaMapBuilder1](#schemamapbuilder1) | someProp(boolean value) | -| [SchemaMapBuilder1](#schemamapbuilder1) | someProp(String value) | -| [SchemaMapBuilder1](#schemamapbuilder1) | someProp(int value) | -| [SchemaMapBuilder1](#schemamapbuilder1) | someProp(float value) | -| [SchemaMapBuilder1](#schemamapbuilder1) | someProp(long value) | -| [SchemaMapBuilder1](#schemamapbuilder1) | someProp(double value) | -| [SchemaMapBuilder1](#schemamapbuilder1) | someProp(List value) | -| [SchemaMapBuilder1](#schemamapbuilder1) | someProp(Map value) | -| [SchemaMapBuilder1](#schemamapbuilder1) | additionalProperty(String key, Nothing? value) | -| [SchemaMapBuilder1](#schemamapbuilder1) | additionalProperty(String key, boolean value) | -| [SchemaMapBuilder1](#schemamapbuilder1) | additionalProperty(String key, String value) | -| [SchemaMapBuilder1](#schemamapbuilder1) | additionalProperty(String key, int value) | -| [SchemaMapBuilder1](#schemamapbuilder1) | additionalProperty(String key, float value) | -| [SchemaMapBuilder1](#schemamapbuilder1) | additionalProperty(String key, long value) | -| [SchemaMapBuilder1](#schemamapbuilder1) | additionalProperty(String key, double value) | -| [SchemaMapBuilder1](#schemamapbuilder1) | additionalProperty(String key, List value) | -| [SchemaMapBuilder1](#schemamapbuilder1) | additionalProperty(String key, Map value) | - -## SchemaMap1 -public static class SchemaMap1
-extends FrozenMap - -A class to store validated Map payloads - -### Method Summary -| Modifier and Type | Method and Description | -| ----------------- | ---------------------- | -| static [SchemaMap1](#schemamap1) | of([Map](#schemamapbuilder1) arg, SchemaConfiguration configuration) | -| @Nullable Object | someProp()
[optional] | -| @Nullable Object | getAdditionalProperty(String name)
provides type safety for additional properties | - -## SomeProp1Boxed -public sealed interface SomeProp1Boxed
-permits
-[SomeProp1BoxedVoid](#someprop1boxedvoid), -[SomeProp1BoxedBoolean](#someprop1boxedboolean), -[SomeProp1BoxedNumber](#someprop1boxednumber), -[SomeProp1BoxedString](#someprop1boxedstring), -[SomeProp1BoxedList](#someprop1boxedlist), -[SomeProp1BoxedMap](#someprop1boxedmap) - -sealed interface that stores validated payloads using boxed classes - -## SomeProp1BoxedVoid -public record SomeProp1BoxedVoid
-implements [SomeProp1Boxed](#someprop1boxed) - -record that stores validated null payloads, sealed permits implementation - -### Constructor Summary -| Constructor and Description | -| --------------------------- | -| SomeProp1BoxedVoid(Nothing? data)
Creates an instance, private visibility | - -### Method Summary -| Modifier and Type | Method and Description | -| ----------------- | ---------------------- | -| Nothing? | data()
validated payload | -| @Nullable Object | getData()
validated payload | - -## SomeProp1BoxedBoolean -public record SomeProp1BoxedBoolean
-implements [SomeProp1Boxed](#someprop1boxed) - -record that stores validated boolean payloads, sealed permits implementation - -### Constructor Summary -| Constructor and Description | -| --------------------------- | -| SomeProp1BoxedBoolean(boolean data)
Creates an instance, private visibility | - -### Method Summary -| Modifier and Type | Method and Description | -| ----------------- | ---------------------- | -| boolean | data()
validated payload | -| @Nullable Object | getData()
validated payload | - -## SomeProp1BoxedNumber -public record SomeProp1BoxedNumber
-implements [SomeProp1Boxed](#someprop1boxed) - -record that stores validated Number payloads, sealed permits implementation - -### Constructor Summary -| Constructor and Description | -| --------------------------- | -| SomeProp1BoxedNumber(Number data)
Creates an instance, private visibility | - -### Method Summary -| Modifier and Type | Method and Description | -| ----------------- | ---------------------- | -| Number | data()
validated payload | -| @Nullable Object | getData()
validated payload | - -## SomeProp1BoxedString -public record SomeProp1BoxedString
-implements [SomeProp1Boxed](#someprop1boxed) - -record that stores validated String payloads, sealed permits implementation - -### Constructor Summary -| Constructor and Description | -| --------------------------- | -| SomeProp1BoxedString(String data)
Creates an instance, private visibility | - -### Method Summary -| Modifier and Type | Method and Description | -| ----------------- | ---------------------- | -| String | data()
validated payload | -| @Nullable Object | getData()
validated payload | - -## SomeProp1BoxedList -public record SomeProp1BoxedList
-implements [SomeProp1Boxed](#someprop1boxed) - -record that stores validated List payloads, sealed permits implementation - -### Constructor Summary -| Constructor and Description | -| --------------------------- | -| SomeProp1BoxedList(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 | - -## SomeProp1BoxedMap -public record SomeProp1BoxedMap
-implements [SomeProp1Boxed](#someprop1boxed) - -record that stores validated Map payloads, sealed permits implementation - -### Constructor Summary -| Constructor and Description | -| --------------------------- | -| SomeProp1BoxedMap(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 | - -## SomeProp1 -public static class SomeProp1
-extends JsonSchema - -A schema class that validates payloads - -### Field Summary -| Modifier and Type | Field and Description | -| ----------------- | ---------------------- | -| List> | allOf = List.of(
    [Schema01.class](#schema01)
;)
| - -### Method Summary -| Modifier and Type | Method and Description | -| ----------------- | ---------------------- | -| String | validate(String arg, SchemaConfiguration configuration) | -| Nothing? | validate(Nothing? arg, SchemaConfiguration configuration) | -| int | validate(int arg, SchemaConfiguration configuration) | -| long | validate(long arg, SchemaConfiguration configuration) | -| float | validate(float arg, SchemaConfiguration configuration) | -| double | validate(double arg, SchemaConfiguration configuration) | -| Number | validate(Number arg, SchemaConfiguration configuration) | -| boolean | validate(boolean arg, SchemaConfiguration configuration) | -| FrozenMap<@Nullable Object> | validate(Map<?, ?> arg, SchemaConfiguration configuration) | -| FrozenList<@Nullable Object> | validate(List arg, SchemaConfiguration configuration) | -| [SomeProp1BoxedString](#someprop1boxedstring) | validateAndBox(String arg, SchemaConfiguration configuration) | -| [SomeProp1BoxedVoid](#someprop1boxedvoid) | validateAndBox(Nothing? arg, SchemaConfiguration configuration) | -| [SomeProp1BoxedNumber](#someprop1boxednumber) | validateAndBox(Number arg, SchemaConfiguration configuration) | -| [SomeProp1BoxedBoolean](#someprop1boxedboolean) | validateAndBox(boolean arg, SchemaConfiguration configuration) | -| [SomeProp1BoxedMap](#someprop1boxedmap) | validateAndBox(Map<?, ?> arg, SchemaConfiguration configuration) | -| [SomeProp1BoxedList](#someprop1boxedlist) | validateAndBox(List arg, SchemaConfiguration configuration) | -| [SomeProp1Boxed](#someprop1boxed) | validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) | -| @Nullable Object | validate(@Nullable Object arg, SchemaConfiguration configuration) | - -## Schema01Boxed -public sealed interface Schema01Boxed
-permits
-[Schema01BoxedString](#schema01boxedstring) - -sealed interface that stores validated payloads using boxed classes - -## Schema01BoxedString -public record Schema01BoxedString
-implements [Schema01Boxed](#schema01boxed) - -record that stores validated String payloads, sealed permits implementation - -### Constructor Summary -| Constructor and Description | -| --------------------------- | -| Schema01BoxedString(String data)
Creates an instance, private visibility | - -### Method Summary -| Modifier and Type | Method and Description | -| ----------------- | ---------------------- | -| String | data()
validated payload | -| @Nullable Object | getData()
validated payload | - -## Schema01 -public static class Schema01
-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.fakeinlinecomposition.post.parameters.parameter1.Schema1; - -import java.util.Arrays; -import java.util.List; -import java.util.AbstractMap; - -static final SchemaConfiguration configuration = new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().build()); - -// String validation -String validatedPayload = Schema1.Schema01.validate( - "a", - configuration -); -``` - -### Field Summary -| Modifier and Type | Field and Description | -| ----------------- | ---------------------- | -| Set> | type = Set.of(
    String.class
)
| -| Integer | minLength = 1 | - -### Method Summary -| Modifier and Type | Method and Description | -| ----------------- | ---------------------- | -| String | validate(String arg, SchemaConfiguration configuration) | -| [Schema01BoxedString](#schema01boxedstring) | validateAndBox(String arg, SchemaConfiguration configuration) | -| [Schema01Boxed](#schema01boxed) | validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) | -| @Nullable Object | validate(@Nullable Object arg, SchemaConfiguration configuration) | diff --git a/samples/client/petstore/kotlin/docs/paths/fakeinlinecomposition/post/requestbody/content/applicationjson/ApplicationjsonSchema.md b/samples/client/petstore/kotlin/docs/paths/fakeinlinecomposition/post/requestbody/content/applicationjson/ApplicationjsonSchema.md deleted file mode 100644 index c75e2cc8dda..00000000000 --- a/samples/client/petstore/kotlin/docs/paths/fakeinlinecomposition/post/requestbody/content/applicationjson/ApplicationjsonSchema.md +++ /dev/null @@ -1,236 +0,0 @@ -# ApplicationjsonSchema -public class ApplicationjsonSchema
- -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 - -## Nested Class Summary -| Modifier and Type | Class and Description | -| ----------------- | ---------------------- | -| sealed interface | [ApplicationjsonSchema.ApplicationjsonSchema1Boxed](#applicationjsonschema1boxed)
sealed interface for validated payloads | -| record | [ApplicationjsonSchema.ApplicationjsonSchema1BoxedVoid](#applicationjsonschema1boxedvoid)
boxed class to store validated null payloads | -| record | [ApplicationjsonSchema.ApplicationjsonSchema1BoxedBoolean](#applicationjsonschema1boxedboolean)
boxed class to store validated boolean payloads | -| record | [ApplicationjsonSchema.ApplicationjsonSchema1BoxedNumber](#applicationjsonschema1boxednumber)
boxed class to store validated Number payloads | -| record | [ApplicationjsonSchema.ApplicationjsonSchema1BoxedString](#applicationjsonschema1boxedstring)
boxed class to store validated String payloads | -| record | [ApplicationjsonSchema.ApplicationjsonSchema1BoxedList](#applicationjsonschema1boxedlist)
boxed class to store validated List payloads | -| record | [ApplicationjsonSchema.ApplicationjsonSchema1BoxedMap](#applicationjsonschema1boxedmap)
boxed class to store validated Map payloads | -| static class | [ApplicationjsonSchema.ApplicationjsonSchema1](#applicationjsonschema1)
schema class | -| sealed interface | [ApplicationjsonSchema.Applicationjson0Boxed](#applicationjson0boxed)
sealed interface for validated payloads | -| record | [ApplicationjsonSchema.Applicationjson0BoxedString](#applicationjson0boxedstring)
boxed class to store validated String payloads | -| static class | [ApplicationjsonSchema.Applicationjson0](#applicationjson0)
schema class | - -## ApplicationjsonSchema1Boxed -public sealed interface ApplicationjsonSchema1Boxed
-permits
-[ApplicationjsonSchema1BoxedVoid](#applicationjsonschema1boxedvoid), -[ApplicationjsonSchema1BoxedBoolean](#applicationjsonschema1boxedboolean), -[ApplicationjsonSchema1BoxedNumber](#applicationjsonschema1boxednumber), -[ApplicationjsonSchema1BoxedString](#applicationjsonschema1boxedstring), -[ApplicationjsonSchema1BoxedList](#applicationjsonschema1boxedlist), -[ApplicationjsonSchema1BoxedMap](#applicationjsonschema1boxedmap) - -sealed interface that stores validated payloads using boxed classes - -## ApplicationjsonSchema1BoxedVoid -public record ApplicationjsonSchema1BoxedVoid
-implements [ApplicationjsonSchema1Boxed](#applicationjsonschema1boxed) - -record that stores validated null payloads, sealed permits implementation - -### Constructor Summary -| Constructor and Description | -| --------------------------- | -| ApplicationjsonSchema1BoxedVoid(Nothing? data)
Creates an instance, private visibility | - -### Method Summary -| Modifier and Type | Method and Description | -| ----------------- | ---------------------- | -| Nothing? | data()
validated payload | -| @Nullable Object | getData()
validated payload | - -## ApplicationjsonSchema1BoxedBoolean -public record ApplicationjsonSchema1BoxedBoolean
-implements [ApplicationjsonSchema1Boxed](#applicationjsonschema1boxed) - -record that stores validated boolean payloads, sealed permits implementation - -### Constructor Summary -| Constructor and Description | -| --------------------------- | -| ApplicationjsonSchema1BoxedBoolean(boolean data)
Creates an instance, private visibility | - -### Method Summary -| Modifier and Type | Method and Description | -| ----------------- | ---------------------- | -| boolean | data()
validated payload | -| @Nullable Object | getData()
validated payload | - -## ApplicationjsonSchema1BoxedNumber -public record ApplicationjsonSchema1BoxedNumber
-implements [ApplicationjsonSchema1Boxed](#applicationjsonschema1boxed) - -record that stores validated Number payloads, sealed permits implementation - -### Constructor Summary -| Constructor and Description | -| --------------------------- | -| ApplicationjsonSchema1BoxedNumber(Number data)
Creates an instance, private visibility | - -### Method Summary -| Modifier and Type | Method and Description | -| ----------------- | ---------------------- | -| Number | data()
validated payload | -| @Nullable Object | getData()
validated payload | - -## ApplicationjsonSchema1BoxedString -public record ApplicationjsonSchema1BoxedString
-implements [ApplicationjsonSchema1Boxed](#applicationjsonschema1boxed) - -record that stores validated String payloads, sealed permits implementation - -### Constructor Summary -| Constructor and Description | -| --------------------------- | -| ApplicationjsonSchema1BoxedString(String data)
Creates an instance, private visibility | - -### Method Summary -| Modifier and Type | Method and Description | -| ----------------- | ---------------------- | -| String | data()
validated payload | -| @Nullable Object | getData()
validated payload | - -## ApplicationjsonSchema1BoxedList -public record ApplicationjsonSchema1BoxedList
-implements [ApplicationjsonSchema1Boxed](#applicationjsonschema1boxed) - -record that stores validated List payloads, sealed permits implementation - -### Constructor Summary -| Constructor and Description | -| --------------------------- | -| ApplicationjsonSchema1BoxedList(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 | - -## ApplicationjsonSchema1BoxedMap -public record ApplicationjsonSchema1BoxedMap
-implements [ApplicationjsonSchema1Boxed](#applicationjsonschema1boxed) - -record that stores validated Map payloads, sealed permits implementation - -### Constructor Summary -| Constructor and Description | -| --------------------------- | -| ApplicationjsonSchema1BoxedMap(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 | - -## ApplicationjsonSchema1 -public static class ApplicationjsonSchema1
-extends JsonSchema - -A schema class that validates payloads - -### Field Summary -| Modifier and Type | Field and Description | -| ----------------- | ---------------------- | -| List> | allOf = List.of(
    [Applicationjson0.class](#applicationjson0)
;)
| - -### Method Summary -| Modifier and Type | Method and Description | -| ----------------- | ---------------------- | -| String | validate(String arg, SchemaConfiguration configuration) | -| Nothing? | validate(Nothing? arg, SchemaConfiguration configuration) | -| int | validate(int arg, SchemaConfiguration configuration) | -| long | validate(long arg, SchemaConfiguration configuration) | -| float | validate(float arg, SchemaConfiguration configuration) | -| double | validate(double arg, SchemaConfiguration configuration) | -| Number | validate(Number arg, SchemaConfiguration configuration) | -| boolean | validate(boolean arg, SchemaConfiguration configuration) | -| FrozenMap<@Nullable Object> | validate(Map<?, ?> arg, SchemaConfiguration configuration) | -| FrozenList<@Nullable Object> | validate(List arg, SchemaConfiguration configuration) | -| [ApplicationjsonSchema1BoxedString](#applicationjsonschema1boxedstring) | validateAndBox(String arg, SchemaConfiguration configuration) | -| [ApplicationjsonSchema1BoxedVoid](#applicationjsonschema1boxedvoid) | validateAndBox(Nothing? arg, SchemaConfiguration configuration) | -| [ApplicationjsonSchema1BoxedNumber](#applicationjsonschema1boxednumber) | validateAndBox(Number arg, SchemaConfiguration configuration) | -| [ApplicationjsonSchema1BoxedBoolean](#applicationjsonschema1boxedboolean) | validateAndBox(boolean arg, SchemaConfiguration configuration) | -| [ApplicationjsonSchema1BoxedMap](#applicationjsonschema1boxedmap) | validateAndBox(Map<?, ?> arg, SchemaConfiguration configuration) | -| [ApplicationjsonSchema1BoxedList](#applicationjsonschema1boxedlist) | validateAndBox(List arg, SchemaConfiguration configuration) | -| [ApplicationjsonSchema1Boxed](#applicationjsonschema1boxed) | validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) | -| @Nullable Object | validate(@Nullable Object arg, SchemaConfiguration configuration) | - -## Applicationjson0Boxed -public sealed interface Applicationjson0Boxed
-permits
-[Applicationjson0BoxedString](#applicationjson0boxedstring) - -sealed interface that stores validated payloads using boxed classes - -## Applicationjson0BoxedString -public record Applicationjson0BoxedString
-implements [Applicationjson0Boxed](#applicationjson0boxed) - -record that stores validated String payloads, sealed permits implementation - -### Constructor Summary -| Constructor and Description | -| --------------------------- | -| Applicationjson0BoxedString(String data)
Creates an instance, private visibility | - -### Method Summary -| Modifier and Type | Method and Description | -| ----------------- | ---------------------- | -| String | data()
validated payload | -| @Nullable Object | getData()
validated payload | - -## Applicationjson0 -public static class Applicationjson0
-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.fakeinlinecomposition.post.requestbody.content.applicationjson.ApplicationjsonSchema; - -import java.util.Arrays; -import java.util.List; -import java.util.AbstractMap; - -static final SchemaConfiguration configuration = new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().build()); - -// String validation -String validatedPayload = ApplicationjsonSchema.Applicationjson0.validate( - "a", - configuration -); -``` - -### Field Summary -| Modifier and Type | Field and Description | -| ----------------- | ---------------------- | -| Set> | type = Set.of(
    String.class
)
| -| Integer | minLength = 1 | - -### Method Summary -| Modifier and Type | Method and Description | -| ----------------- | ---------------------- | -| String | validate(String arg, SchemaConfiguration configuration) | -| [Applicationjson0BoxedString](#applicationjson0boxedstring) | validateAndBox(String arg, SchemaConfiguration configuration) | -| [Applicationjson0Boxed](#applicationjson0boxed) | validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) | -| @Nullable Object | validate(@Nullable Object arg, SchemaConfiguration configuration) | diff --git a/samples/client/petstore/kotlin/docs/paths/fakeinlinecomposition/post/requestbody/content/multipartformdata/MultipartformdataSchema.md b/samples/client/petstore/kotlin/docs/paths/fakeinlinecomposition/post/requestbody/content/multipartformdata/MultipartformdataSchema.md deleted file mode 100644 index 15ac80ffd6e..00000000000 --- a/samples/client/petstore/kotlin/docs/paths/fakeinlinecomposition/post/requestbody/content/multipartformdata/MultipartformdataSchema.md +++ /dev/null @@ -1,359 +0,0 @@ -# MultipartformdataSchema -public class MultipartformdataSchema
- -A class that contains necessary nested -- schema classes (which validate payloads), extends JsonSchema -- sealed interfaces which store validated payloads, java version of a sum type -- boxed classes which store validated payloads, sealed permits class implementations -- classes to store validated map payloads, extends FrozenMap -- classes to build inputs for map payloads - -## Nested Class Summary -| Modifier and Type | Class and Description | -| ----------------- | ---------------------- | -| sealed interface | [MultipartformdataSchema.MultipartformdataSchema1Boxed](#multipartformdataschema1boxed)
sealed interface for validated payloads | -| record | [MultipartformdataSchema.MultipartformdataSchema1BoxedMap](#multipartformdataschema1boxedmap)
boxed class to store validated Map payloads | -| static class | [MultipartformdataSchema.MultipartformdataSchema1](#multipartformdataschema1)
schema class | -| static class | [MultipartformdataSchema.MultipartformdataSchemaMapBuilder](#multipartformdataschemamapbuilder)
builder for Map payloads | -| static class | [MultipartformdataSchema.MultipartformdataSchemaMap](#multipartformdataschemamap)
output class for Map payloads | -| sealed interface | [MultipartformdataSchema.MultipartformdataSomePropBoxed](#multipartformdatasomepropboxed)
sealed interface for validated payloads | -| record | [MultipartformdataSchema.MultipartformdataSomePropBoxedVoid](#multipartformdatasomepropboxedvoid)
boxed class to store validated null payloads | -| record | [MultipartformdataSchema.MultipartformdataSomePropBoxedBoolean](#multipartformdatasomepropboxedboolean)
boxed class to store validated boolean payloads | -| record | [MultipartformdataSchema.MultipartformdataSomePropBoxedNumber](#multipartformdatasomepropboxednumber)
boxed class to store validated Number payloads | -| record | [MultipartformdataSchema.MultipartformdataSomePropBoxedString](#multipartformdatasomepropboxedstring)
boxed class to store validated String payloads | -| record | [MultipartformdataSchema.MultipartformdataSomePropBoxedList](#multipartformdatasomepropboxedlist)
boxed class to store validated List payloads | -| record | [MultipartformdataSchema.MultipartformdataSomePropBoxedMap](#multipartformdatasomepropboxedmap)
boxed class to store validated Map payloads | -| static class | [MultipartformdataSchema.MultipartformdataSomeProp](#multipartformdatasomeprop)
schema class | -| sealed interface | [MultipartformdataSchema.Multipartformdata0Boxed](#multipartformdata0boxed)
sealed interface for validated payloads | -| record | [MultipartformdataSchema.Multipartformdata0BoxedString](#multipartformdata0boxedstring)
boxed class to store validated String payloads | -| static class | [MultipartformdataSchema.Multipartformdata0](#multipartformdata0)
schema class | - -## MultipartformdataSchema1Boxed -public sealed interface MultipartformdataSchema1Boxed
-permits
-[MultipartformdataSchema1BoxedMap](#multipartformdataschema1boxedmap) - -sealed interface that stores validated payloads using boxed classes - -## MultipartformdataSchema1BoxedMap -public record MultipartformdataSchema1BoxedMap
-implements [MultipartformdataSchema1Boxed](#multipartformdataschema1boxed) - -record that stores validated Map payloads, sealed permits implementation - -### Constructor Summary -| Constructor and Description | -| --------------------------- | -| MultipartformdataSchema1BoxedMap([MultipartformdataSchemaMap](#multipartformdataschemamap) data)
Creates an instance, private visibility | - -### Method Summary -| Modifier and Type | Method and Description | -| ----------------- | ---------------------- | -| [MultipartformdataSchemaMap](#multipartformdataschemamap) | data()
validated payload | -| @Nullable Object | getData()
validated payload | - -## MultipartformdataSchema1 -public static class MultipartformdataSchema1
-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.fakeinlinecomposition.post.requestbody.content.multipartformdata.MultipartformdataSchema; - -import java.util.Arrays; -import java.util.List; -import java.util.AbstractMap; - -static final SchemaConfiguration configuration = new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().build()); - -// Map validation -MultipartformdataSchema.MultipartformdataSchemaMap validatedPayload = - MultipartformdataSchema.MultipartformdataSchema1.validate( - new MultipartformdataSchema.MultipartformdataSchemaMapBuilder() - .build(), - configuration -); -``` - -### Field Summary -| Modifier and Type | Field and Description | -| ----------------- | ---------------------- | -| Set> | type = Set.of(Map.class) | -| Map> | properties = Map.ofEntries(
    new PropertyEntry("someProp", [MultipartformdataSomeProp.class](#multipartformdatasomeprop)))
)
| - -### Method Summary -| Modifier and Type | Method and Description | -| ----------------- | ---------------------- | -| [MultipartformdataSchemaMap](#multipartformdataschemamap) | validate([Map<?, ?>](#multipartformdataschemamapbuilder) arg, SchemaConfiguration configuration) | -| [MultipartformdataSchema1BoxedMap](#multipartformdataschema1boxedmap) | validateAndBox([Map<?, ?>](#multipartformdataschemamapbuilder) arg, SchemaConfiguration configuration) | -| [MultipartformdataSchema1Boxed](#multipartformdataschema1boxed) | validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) | -| @Nullable Object | validate(@Nullable Object arg, SchemaConfiguration configuration) | - -## MultipartformdataSchemaMapBuilder -public class MultipartformdataSchemaMapBuilder
-builder for `Map` - -A class that builds the Map input type - -### Constructor Summary -| Constructor and Description | -| --------------------------- | -| MultipartformdataSchemaMapBuilder()
Creates a builder that contains an empty map | - -### Method Summary -| Modifier and Type | Method and Description | -| ----------------- | ---------------------- | -| Map | build()
Returns map input that should be used with Schema.validate | -| [MultipartformdataSchemaMapBuilder](#multipartformdataschemamapbuilder) | someProp(Nothing? value) | -| [MultipartformdataSchemaMapBuilder](#multipartformdataschemamapbuilder) | someProp(boolean value) | -| [MultipartformdataSchemaMapBuilder](#multipartformdataschemamapbuilder) | someProp(String value) | -| [MultipartformdataSchemaMapBuilder](#multipartformdataschemamapbuilder) | someProp(int value) | -| [MultipartformdataSchemaMapBuilder](#multipartformdataschemamapbuilder) | someProp(float value) | -| [MultipartformdataSchemaMapBuilder](#multipartformdataschemamapbuilder) | someProp(long value) | -| [MultipartformdataSchemaMapBuilder](#multipartformdataschemamapbuilder) | someProp(double value) | -| [MultipartformdataSchemaMapBuilder](#multipartformdataschemamapbuilder) | someProp(List value) | -| [MultipartformdataSchemaMapBuilder](#multipartformdataschemamapbuilder) | someProp(Map value) | -| [MultipartformdataSchemaMapBuilder](#multipartformdataschemamapbuilder) | additionalProperty(String key, Nothing? value) | -| [MultipartformdataSchemaMapBuilder](#multipartformdataschemamapbuilder) | additionalProperty(String key, boolean value) | -| [MultipartformdataSchemaMapBuilder](#multipartformdataschemamapbuilder) | additionalProperty(String key, String value) | -| [MultipartformdataSchemaMapBuilder](#multipartformdataschemamapbuilder) | additionalProperty(String key, int value) | -| [MultipartformdataSchemaMapBuilder](#multipartformdataschemamapbuilder) | additionalProperty(String key, float value) | -| [MultipartformdataSchemaMapBuilder](#multipartformdataschemamapbuilder) | additionalProperty(String key, long value) | -| [MultipartformdataSchemaMapBuilder](#multipartformdataschemamapbuilder) | additionalProperty(String key, double value) | -| [MultipartformdataSchemaMapBuilder](#multipartformdataschemamapbuilder) | additionalProperty(String key, List value) | -| [MultipartformdataSchemaMapBuilder](#multipartformdataschemamapbuilder) | additionalProperty(String key, Map value) | - -## MultipartformdataSchemaMap -public static class MultipartformdataSchemaMap
-extends FrozenMap - -A class to store validated Map payloads - -### Method Summary -| Modifier and Type | Method and Description | -| ----------------- | ---------------------- | -| static [MultipartformdataSchemaMap](#multipartformdataschemamap) | of([Map](#multipartformdataschemamapbuilder) arg, SchemaConfiguration configuration) | -| @Nullable Object | someProp()
[optional] | -| @Nullable Object | getAdditionalProperty(String name)
provides type safety for additional properties | - -## MultipartformdataSomePropBoxed -public sealed interface MultipartformdataSomePropBoxed
-permits
-[MultipartformdataSomePropBoxedVoid](#multipartformdatasomepropboxedvoid), -[MultipartformdataSomePropBoxedBoolean](#multipartformdatasomepropboxedboolean), -[MultipartformdataSomePropBoxedNumber](#multipartformdatasomepropboxednumber), -[MultipartformdataSomePropBoxedString](#multipartformdatasomepropboxedstring), -[MultipartformdataSomePropBoxedList](#multipartformdatasomepropboxedlist), -[MultipartformdataSomePropBoxedMap](#multipartformdatasomepropboxedmap) - -sealed interface that stores validated payloads using boxed classes - -## MultipartformdataSomePropBoxedVoid -public record MultipartformdataSomePropBoxedVoid
-implements [MultipartformdataSomePropBoxed](#multipartformdatasomepropboxed) - -record that stores validated null payloads, sealed permits implementation - -### Constructor Summary -| Constructor and Description | -| --------------------------- | -| MultipartformdataSomePropBoxedVoid(Nothing? data)
Creates an instance, private visibility | - -### Method Summary -| Modifier and Type | Method and Description | -| ----------------- | ---------------------- | -| Nothing? | data()
validated payload | -| @Nullable Object | getData()
validated payload | - -## MultipartformdataSomePropBoxedBoolean -public record MultipartformdataSomePropBoxedBoolean
-implements [MultipartformdataSomePropBoxed](#multipartformdatasomepropboxed) - -record that stores validated boolean payloads, sealed permits implementation - -### Constructor Summary -| Constructor and Description | -| --------------------------- | -| MultipartformdataSomePropBoxedBoolean(boolean data)
Creates an instance, private visibility | - -### Method Summary -| Modifier and Type | Method and Description | -| ----------------- | ---------------------- | -| boolean | data()
validated payload | -| @Nullable Object | getData()
validated payload | - -## MultipartformdataSomePropBoxedNumber -public record MultipartformdataSomePropBoxedNumber
-implements [MultipartformdataSomePropBoxed](#multipartformdatasomepropboxed) - -record that stores validated Number payloads, sealed permits implementation - -### Constructor Summary -| Constructor and Description | -| --------------------------- | -| MultipartformdataSomePropBoxedNumber(Number data)
Creates an instance, private visibility | - -### Method Summary -| Modifier and Type | Method and Description | -| ----------------- | ---------------------- | -| Number | data()
validated payload | -| @Nullable Object | getData()
validated payload | - -## MultipartformdataSomePropBoxedString -public record MultipartformdataSomePropBoxedString
-implements [MultipartformdataSomePropBoxed](#multipartformdatasomepropboxed) - -record that stores validated String payloads, sealed permits implementation - -### Constructor Summary -| Constructor and Description | -| --------------------------- | -| MultipartformdataSomePropBoxedString(String data)
Creates an instance, private visibility | - -### Method Summary -| Modifier and Type | Method and Description | -| ----------------- | ---------------------- | -| String | data()
validated payload | -| @Nullable Object | getData()
validated payload | - -## MultipartformdataSomePropBoxedList -public record MultipartformdataSomePropBoxedList
-implements [MultipartformdataSomePropBoxed](#multipartformdatasomepropboxed) - -record that stores validated List payloads, sealed permits implementation - -### Constructor Summary -| Constructor and Description | -| --------------------------- | -| MultipartformdataSomePropBoxedList(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 | - -## MultipartformdataSomePropBoxedMap -public record MultipartformdataSomePropBoxedMap
-implements [MultipartformdataSomePropBoxed](#multipartformdatasomepropboxed) - -record that stores validated Map payloads, sealed permits implementation - -### Constructor Summary -| Constructor and Description | -| --------------------------- | -| MultipartformdataSomePropBoxedMap(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 | - -## MultipartformdataSomeProp -public static class MultipartformdataSomeProp
-extends JsonSchema - -A schema class that validates payloads - -### Field Summary -| Modifier and Type | Field and Description | -| ----------------- | ---------------------- | -| List> | allOf = List.of(
    [Multipartformdata0.class](#multipartformdata0)
;)
| - -### Method Summary -| Modifier and Type | Method and Description | -| ----------------- | ---------------------- | -| String | validate(String arg, SchemaConfiguration configuration) | -| Nothing? | validate(Nothing? arg, SchemaConfiguration configuration) | -| int | validate(int arg, SchemaConfiguration configuration) | -| long | validate(long arg, SchemaConfiguration configuration) | -| float | validate(float arg, SchemaConfiguration configuration) | -| double | validate(double arg, SchemaConfiguration configuration) | -| Number | validate(Number arg, SchemaConfiguration configuration) | -| boolean | validate(boolean arg, SchemaConfiguration configuration) | -| FrozenMap<@Nullable Object> | validate(Map<?, ?> arg, SchemaConfiguration configuration) | -| FrozenList<@Nullable Object> | validate(List arg, SchemaConfiguration configuration) | -| [MultipartformdataSomePropBoxedString](#multipartformdatasomepropboxedstring) | validateAndBox(String arg, SchemaConfiguration configuration) | -| [MultipartformdataSomePropBoxedVoid](#multipartformdatasomepropboxedvoid) | validateAndBox(Nothing? arg, SchemaConfiguration configuration) | -| [MultipartformdataSomePropBoxedNumber](#multipartformdatasomepropboxednumber) | validateAndBox(Number arg, SchemaConfiguration configuration) | -| [MultipartformdataSomePropBoxedBoolean](#multipartformdatasomepropboxedboolean) | validateAndBox(boolean arg, SchemaConfiguration configuration) | -| [MultipartformdataSomePropBoxedMap](#multipartformdatasomepropboxedmap) | validateAndBox(Map<?, ?> arg, SchemaConfiguration configuration) | -| [MultipartformdataSomePropBoxedList](#multipartformdatasomepropboxedlist) | validateAndBox(List arg, SchemaConfiguration configuration) | -| [MultipartformdataSomePropBoxed](#multipartformdatasomepropboxed) | validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) | -| @Nullable Object | validate(@Nullable Object arg, SchemaConfiguration configuration) | - -## Multipartformdata0Boxed -public sealed interface Multipartformdata0Boxed
-permits
-[Multipartformdata0BoxedString](#multipartformdata0boxedstring) - -sealed interface that stores validated payloads using boxed classes - -## Multipartformdata0BoxedString -public record Multipartformdata0BoxedString
-implements [Multipartformdata0Boxed](#multipartformdata0boxed) - -record that stores validated String payloads, sealed permits implementation - -### Constructor Summary -| Constructor and Description | -| --------------------------- | -| Multipartformdata0BoxedString(String data)
Creates an instance, private visibility | - -### Method Summary -| Modifier and Type | Method and Description | -| ----------------- | ---------------------- | -| String | data()
validated payload | -| @Nullable Object | getData()
validated payload | - -## Multipartformdata0 -public static class Multipartformdata0
-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.fakeinlinecomposition.post.requestbody.content.multipartformdata.MultipartformdataSchema; - -import java.util.Arrays; -import java.util.List; -import java.util.AbstractMap; - -static final SchemaConfiguration configuration = new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().build()); - -// String validation -String validatedPayload = MultipartformdataSchema.Multipartformdata0.validate( - "a", - configuration -); -``` - -### Field Summary -| Modifier and Type | Field and Description | -| ----------------- | ---------------------- | -| Set> | type = Set.of(
    String.class
)
| -| Integer | minLength = 1 | - -### Method Summary -| Modifier and Type | Method and Description | -| ----------------- | ---------------------- | -| String | validate(String arg, SchemaConfiguration configuration) | -| [Multipartformdata0BoxedString](#multipartformdata0boxedstring) | validateAndBox(String arg, SchemaConfiguration configuration) | -| [Multipartformdata0Boxed](#multipartformdata0boxed) | validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) | -| @Nullable Object | validate(@Nullable Object arg, SchemaConfiguration configuration) | diff --git a/samples/client/petstore/kotlin/docs/paths/fakeinlinecomposition/post/responses/FakeinlinecompositionPostCode200Response.md b/samples/client/petstore/kotlin/docs/paths/fakeinlinecomposition/post/responses/FakeinlinecompositionPostCode200Response.md deleted file mode 100644 index 78b44969fbf..00000000000 --- a/samples/client/petstore/kotlin/docs/paths/fakeinlinecomposition/post/responses/FakeinlinecompositionPostCode200Response.md +++ /dev/null @@ -1,123 +0,0 @@ -# FakeinlinecompositionPostCode200Response - -public class FakeinlinecompositionPostCode200Response - -A class that contains necessary nested response classes -- SealedMediaType, a sealed interface which contains all the schema/encoding info for each contentType -- records which implement SealedMediaType, the concrete media types -- SealedResponseBody, a sealed interface which contains all the contentType/schema types -- records which implement SealedResponseBody, the concrete response body types -- a class that extends ResponseDeserializer and is used to deserialize responses - -## Nested Class Summary -| Modifier and Type | Class and Description | -| ----------------- | --------------------- | -| sealed interface | [FakeinlinecompositionPostCode200Response.SealedMediaType](#sealedmediatype)
media type sealed interface | -| record | [FakeinlinecompositionPostCode200Response.ApplicationjsonMediaType](#applicationjsonmediatype)
record storing schema + encoding for a specific contentType | -| record | [FakeinlinecompositionPostCode200Response.MultipartformdataMediaType](#multipartformdatamediatype)
record storing schema + encoding for a specific contentType | -| sealed interface | [FakeinlinecompositionPostCode200Response.SealedResponseBody](#sealedresponsebody)
response body sealed interface | -| record | [FakeinlinecompositionPostCode200Response.ApplicationjsonResponseBody](#applicationjsonresponsebody)
implements sealed interface to store response body | -| record | [FakeinlinecompositionPostCode200Response.MultipartformdataResponseBody](#multipartformdataresponsebody)
implements sealed interface to store response body | -| static class | [FakeinlinecompositionPostCode200Response.FakeinlinecompositionPostCode200Response1](#fakeinlinecompositionpostcode200response1)
class that deserializes responses | - -## SealedMediaType -public sealed interface SealedMediaType
-permits
-[ApplicationjsonMediaType](#applicationjsonmediatype), -[MultipartformdataMediaType](#multipartformdatamediatype) - -sealed interface that stores schema and encoding info - -## ApplicationjsonMediaType -public record ApplicationjsonMediaType
-implements [SealedMediaType](#sealedmediatype), MediaType<[ApplicationjsonSchema.ApplicationjsonSchema1](../../../../paths/fakeinlinecomposition/post/responses/code200response/content/applicationjson/ApplicationjsonSchema.md#applicationjsonschema1), Nothing?> - -class storing schema info for a specific contentType - -### Constructor Summary -| Constructor and Description | -| --------------------------- | -| ApplicationjsonMediaType()
Creates an instance | - -### Method Summary -| Modifier and Type | Method and Description | -| ----------------- | ---------------------- | -| [ApplicationjsonSchema.ApplicationjsonSchema1](../../../../paths/fakeinlinecomposition/post/responses/code200response/content/applicationjson/ApplicationjsonSchema.md#applicationjsonschema1) | schema()
the schema for this MediaType | -| Nothing? | encoding()
the encoding info | - -## MultipartformdataMediaType -public record MultipartformdataMediaType
-implements [SealedMediaType](#sealedmediatype), MediaType<[MultipartformdataSchema.MultipartformdataSchema1](../../../../paths/fakeinlinecomposition/post/responses/code200response/content/multipartformdata/MultipartformdataSchema.md#multipartformdataschema1), Nothing?> - -class storing schema info for a specific contentType - -### Constructor Summary -| Constructor and Description | -| --------------------------- | -| MultipartformdataMediaType()
Creates an instance | - -### Method Summary -| Modifier and Type | Method and Description | -| ----------------- | ---------------------- | -| [MultipartformdataSchema.MultipartformdataSchema1](../../../../paths/fakeinlinecomposition/post/responses/code200response/content/multipartformdata/MultipartformdataSchema.md#multipartformdataschema1) | schema()
the schema for this MediaType | -| Nothing? | encoding()
the encoding info | - -## SealedResponseBody -public sealed interface SealedResponseBody
-permits
-[ApplicationjsonResponseBody](#applicationjsonresponsebody), -[MultipartformdataResponseBody](#multipartformdataresponsebody) - -sealed interface that stores response body - -## ApplicationjsonResponseBody -public record ApplicationjsonResponseBody
-implements [SealedResponseBody](#sealedresponsebody) - -A record class to store response body for contentType="application/json" - -### Constructor Summary -| Constructor and Description | -| --------------------------- | -| ApplicationjsonResponseBody(ApplicationjsonSchema.[ApplicationjsonSchema1Boxed](../../../../paths/fakeinlinecomposition/post/responses/code200response/content/applicationjson/ApplicationjsonSchema.md#applicationjsonschema1boxed) body)
Creates an instance | - -### Method Summary -| Modifier and Type | Method and Description | -| ----------------- | ---------------------- | -| ApplicationjsonSchema.[ApplicationjsonSchema1Boxed](../../../../paths/fakeinlinecomposition/post/responses/code200response/content/applicationjson/ApplicationjsonSchema.md#applicationjsonschema1boxed) | body()
returns the body passed in in the constructor | -## MultipartformdataResponseBody -public record MultipartformdataResponseBody
-implements [SealedResponseBody](#sealedresponsebody) - -A record class to store response body for contentType="multipart/form-data" - -### Constructor Summary -| Constructor and Description | -| --------------------------- | -| MultipartformdataResponseBody(MultipartformdataSchema.[MultipartformdataSchema1Boxed](../../../../paths/fakeinlinecomposition/post/responses/code200response/content/multipartformdata/MultipartformdataSchema.md#multipartformdataschema1boxed) body)
Creates an instance | - -### Method Summary -| Modifier and Type | Method and Description | -| ----------------- | ---------------------- | -| MultipartformdataSchema.[MultipartformdataSchema1Boxed](../../../../paths/fakeinlinecomposition/post/responses/code200response/content/multipartformdata/MultipartformdataSchema.md#multipartformdataschema1boxed) | body()
returns the body passed in in the constructor | - -## FakeinlinecompositionPostCode200Response1 -public static class FakeinlinecompositionPostCode200Response1
-extends ResponseDeserializer<[SealedResponseBody](#sealedresponsebody), Nothing?, [SealedMediaType](#sealedmediatype)> - -a class that deserializes responses - -### Constructor Summary -| Constructor and Description | -| --------------------------- | -| FakeinlinecompositionPostCode200Response1()
Creates an instance | - -### Field Summary -| Modifier and Type | Field and Description | -| ----------------- | --------------------- | -| Map | content = Map.ofEntries(
    new AbstractMap.SimpleEntry<>("application/json", new [ApplicationjsonMediaType](#applicationjsonmediatype)()),
    new AbstractMap.SimpleEntry<>("multipart/form-data", new [MultipartformdataMediaType](#multipartformdatamediatype)())
)
the contentType to schema info | - -### Method Summary -| Modifier and Type | Method and Description | -| ----------------- | ---------------------- | -| ApiResponse<[SealedResponseBody](#sealedresponsebody), Nothing?> | deserialize(HttpResponse response, SchemaConfiguration configuration)
called by endpoint when deserialize responses | diff --git a/samples/client/petstore/kotlin/docs/paths/fakeinlinecomposition/post/responses/code200response/content/applicationjson/ApplicationjsonSchema.md b/samples/client/petstore/kotlin/docs/paths/fakeinlinecomposition/post/responses/code200response/content/applicationjson/ApplicationjsonSchema.md deleted file mode 100644 index b2cea57a2d7..00000000000 --- a/samples/client/petstore/kotlin/docs/paths/fakeinlinecomposition/post/responses/code200response/content/applicationjson/ApplicationjsonSchema.md +++ /dev/null @@ -1,236 +0,0 @@ -# ApplicationjsonSchema -public class ApplicationjsonSchema
- -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 - -## Nested Class Summary -| Modifier and Type | Class and Description | -| ----------------- | ---------------------- | -| sealed interface | [ApplicationjsonSchema.ApplicationjsonSchema1Boxed](#applicationjsonschema1boxed)
sealed interface for validated payloads | -| record | [ApplicationjsonSchema.ApplicationjsonSchema1BoxedVoid](#applicationjsonschema1boxedvoid)
boxed class to store validated null payloads | -| record | [ApplicationjsonSchema.ApplicationjsonSchema1BoxedBoolean](#applicationjsonschema1boxedboolean)
boxed class to store validated boolean payloads | -| record | [ApplicationjsonSchema.ApplicationjsonSchema1BoxedNumber](#applicationjsonschema1boxednumber)
boxed class to store validated Number payloads | -| record | [ApplicationjsonSchema.ApplicationjsonSchema1BoxedString](#applicationjsonschema1boxedstring)
boxed class to store validated String payloads | -| record | [ApplicationjsonSchema.ApplicationjsonSchema1BoxedList](#applicationjsonschema1boxedlist)
boxed class to store validated List payloads | -| record | [ApplicationjsonSchema.ApplicationjsonSchema1BoxedMap](#applicationjsonschema1boxedmap)
boxed class to store validated Map payloads | -| static class | [ApplicationjsonSchema.ApplicationjsonSchema1](#applicationjsonschema1)
schema class | -| sealed interface | [ApplicationjsonSchema.Applicationjson0Boxed](#applicationjson0boxed)
sealed interface for validated payloads | -| record | [ApplicationjsonSchema.Applicationjson0BoxedString](#applicationjson0boxedstring)
boxed class to store validated String payloads | -| static class | [ApplicationjsonSchema.Applicationjson0](#applicationjson0)
schema class | - -## ApplicationjsonSchema1Boxed -public sealed interface ApplicationjsonSchema1Boxed
-permits
-[ApplicationjsonSchema1BoxedVoid](#applicationjsonschema1boxedvoid), -[ApplicationjsonSchema1BoxedBoolean](#applicationjsonschema1boxedboolean), -[ApplicationjsonSchema1BoxedNumber](#applicationjsonschema1boxednumber), -[ApplicationjsonSchema1BoxedString](#applicationjsonschema1boxedstring), -[ApplicationjsonSchema1BoxedList](#applicationjsonschema1boxedlist), -[ApplicationjsonSchema1BoxedMap](#applicationjsonschema1boxedmap) - -sealed interface that stores validated payloads using boxed classes - -## ApplicationjsonSchema1BoxedVoid -public record ApplicationjsonSchema1BoxedVoid
-implements [ApplicationjsonSchema1Boxed](#applicationjsonschema1boxed) - -record that stores validated null payloads, sealed permits implementation - -### Constructor Summary -| Constructor and Description | -| --------------------------- | -| ApplicationjsonSchema1BoxedVoid(Nothing? data)
Creates an instance, private visibility | - -### Method Summary -| Modifier and Type | Method and Description | -| ----------------- | ---------------------- | -| Nothing? | data()
validated payload | -| @Nullable Object | getData()
validated payload | - -## ApplicationjsonSchema1BoxedBoolean -public record ApplicationjsonSchema1BoxedBoolean
-implements [ApplicationjsonSchema1Boxed](#applicationjsonschema1boxed) - -record that stores validated boolean payloads, sealed permits implementation - -### Constructor Summary -| Constructor and Description | -| --------------------------- | -| ApplicationjsonSchema1BoxedBoolean(boolean data)
Creates an instance, private visibility | - -### Method Summary -| Modifier and Type | Method and Description | -| ----------------- | ---------------------- | -| boolean | data()
validated payload | -| @Nullable Object | getData()
validated payload | - -## ApplicationjsonSchema1BoxedNumber -public record ApplicationjsonSchema1BoxedNumber
-implements [ApplicationjsonSchema1Boxed](#applicationjsonschema1boxed) - -record that stores validated Number payloads, sealed permits implementation - -### Constructor Summary -| Constructor and Description | -| --------------------------- | -| ApplicationjsonSchema1BoxedNumber(Number data)
Creates an instance, private visibility | - -### Method Summary -| Modifier and Type | Method and Description | -| ----------------- | ---------------------- | -| Number | data()
validated payload | -| @Nullable Object | getData()
validated payload | - -## ApplicationjsonSchema1BoxedString -public record ApplicationjsonSchema1BoxedString
-implements [ApplicationjsonSchema1Boxed](#applicationjsonschema1boxed) - -record that stores validated String payloads, sealed permits implementation - -### Constructor Summary -| Constructor and Description | -| --------------------------- | -| ApplicationjsonSchema1BoxedString(String data)
Creates an instance, private visibility | - -### Method Summary -| Modifier and Type | Method and Description | -| ----------------- | ---------------------- | -| String | data()
validated payload | -| @Nullable Object | getData()
validated payload | - -## ApplicationjsonSchema1BoxedList -public record ApplicationjsonSchema1BoxedList
-implements [ApplicationjsonSchema1Boxed](#applicationjsonschema1boxed) - -record that stores validated List payloads, sealed permits implementation - -### Constructor Summary -| Constructor and Description | -| --------------------------- | -| ApplicationjsonSchema1BoxedList(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 | - -## ApplicationjsonSchema1BoxedMap -public record ApplicationjsonSchema1BoxedMap
-implements [ApplicationjsonSchema1Boxed](#applicationjsonschema1boxed) - -record that stores validated Map payloads, sealed permits implementation - -### Constructor Summary -| Constructor and Description | -| --------------------------- | -| ApplicationjsonSchema1BoxedMap(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 | - -## ApplicationjsonSchema1 -public static class ApplicationjsonSchema1
-extends JsonSchema - -A schema class that validates payloads - -### Field Summary -| Modifier and Type | Field and Description | -| ----------------- | ---------------------- | -| List> | allOf = List.of(
    [Applicationjson0.class](#applicationjson0)
;)
| - -### Method Summary -| Modifier and Type | Method and Description | -| ----------------- | ---------------------- | -| String | validate(String arg, SchemaConfiguration configuration) | -| Nothing? | validate(Nothing? arg, SchemaConfiguration configuration) | -| int | validate(int arg, SchemaConfiguration configuration) | -| long | validate(long arg, SchemaConfiguration configuration) | -| float | validate(float arg, SchemaConfiguration configuration) | -| double | validate(double arg, SchemaConfiguration configuration) | -| Number | validate(Number arg, SchemaConfiguration configuration) | -| boolean | validate(boolean arg, SchemaConfiguration configuration) | -| FrozenMap<@Nullable Object> | validate(Map<?, ?> arg, SchemaConfiguration configuration) | -| FrozenList<@Nullable Object> | validate(List arg, SchemaConfiguration configuration) | -| [ApplicationjsonSchema1BoxedString](#applicationjsonschema1boxedstring) | validateAndBox(String arg, SchemaConfiguration configuration) | -| [ApplicationjsonSchema1BoxedVoid](#applicationjsonschema1boxedvoid) | validateAndBox(Nothing? arg, SchemaConfiguration configuration) | -| [ApplicationjsonSchema1BoxedNumber](#applicationjsonschema1boxednumber) | validateAndBox(Number arg, SchemaConfiguration configuration) | -| [ApplicationjsonSchema1BoxedBoolean](#applicationjsonschema1boxedboolean) | validateAndBox(boolean arg, SchemaConfiguration configuration) | -| [ApplicationjsonSchema1BoxedMap](#applicationjsonschema1boxedmap) | validateAndBox(Map<?, ?> arg, SchemaConfiguration configuration) | -| [ApplicationjsonSchema1BoxedList](#applicationjsonschema1boxedlist) | validateAndBox(List arg, SchemaConfiguration configuration) | -| [ApplicationjsonSchema1Boxed](#applicationjsonschema1boxed) | validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) | -| @Nullable Object | validate(@Nullable Object arg, SchemaConfiguration configuration) | - -## Applicationjson0Boxed -public sealed interface Applicationjson0Boxed
-permits
-[Applicationjson0BoxedString](#applicationjson0boxedstring) - -sealed interface that stores validated payloads using boxed classes - -## Applicationjson0BoxedString -public record Applicationjson0BoxedString
-implements [Applicationjson0Boxed](#applicationjson0boxed) - -record that stores validated String payloads, sealed permits implementation - -### Constructor Summary -| Constructor and Description | -| --------------------------- | -| Applicationjson0BoxedString(String data)
Creates an instance, private visibility | - -### Method Summary -| Modifier and Type | Method and Description | -| ----------------- | ---------------------- | -| String | data()
validated payload | -| @Nullable Object | getData()
validated payload | - -## Applicationjson0 -public static class Applicationjson0
-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.fakeinlinecomposition.post.responses.code200response.content.applicationjson.ApplicationjsonSchema; - -import java.util.Arrays; -import java.util.List; -import java.util.AbstractMap; - -static final SchemaConfiguration configuration = new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().build()); - -// String validation -String validatedPayload = ApplicationjsonSchema.Applicationjson0.validate( - "a", - configuration -); -``` - -### Field Summary -| Modifier and Type | Field and Description | -| ----------------- | ---------------------- | -| Set> | type = Set.of(
    String.class
)
| -| Integer | minLength = 1 | - -### Method Summary -| Modifier and Type | Method and Description | -| ----------------- | ---------------------- | -| String | validate(String arg, SchemaConfiguration configuration) | -| [Applicationjson0BoxedString](#applicationjson0boxedstring) | validateAndBox(String arg, SchemaConfiguration configuration) | -| [Applicationjson0Boxed](#applicationjson0boxed) | validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) | -| @Nullable Object | validate(@Nullable Object arg, SchemaConfiguration configuration) | diff --git a/samples/client/petstore/kotlin/docs/paths/fakeinlinecomposition/post/responses/code200response/content/multipartformdata/MultipartformdataSchema.md b/samples/client/petstore/kotlin/docs/paths/fakeinlinecomposition/post/responses/code200response/content/multipartformdata/MultipartformdataSchema.md deleted file mode 100644 index 717b6b1a45d..00000000000 --- a/samples/client/petstore/kotlin/docs/paths/fakeinlinecomposition/post/responses/code200response/content/multipartformdata/MultipartformdataSchema.md +++ /dev/null @@ -1,359 +0,0 @@ -# MultipartformdataSchema -public class MultipartformdataSchema
- -A class that contains necessary nested -- schema classes (which validate payloads), extends JsonSchema -- sealed interfaces which store validated payloads, java version of a sum type -- boxed classes which store validated payloads, sealed permits class implementations -- classes to store validated map payloads, extends FrozenMap -- classes to build inputs for map payloads - -## Nested Class Summary -| Modifier and Type | Class and Description | -| ----------------- | ---------------------- | -| sealed interface | [MultipartformdataSchema.MultipartformdataSchema1Boxed](#multipartformdataschema1boxed)
sealed interface for validated payloads | -| record | [MultipartformdataSchema.MultipartformdataSchema1BoxedMap](#multipartformdataschema1boxedmap)
boxed class to store validated Map payloads | -| static class | [MultipartformdataSchema.MultipartformdataSchema1](#multipartformdataschema1)
schema class | -| static class | [MultipartformdataSchema.MultipartformdataSchemaMapBuilder](#multipartformdataschemamapbuilder)
builder for Map payloads | -| static class | [MultipartformdataSchema.MultipartformdataSchemaMap](#multipartformdataschemamap)
output class for Map payloads | -| sealed interface | [MultipartformdataSchema.MultipartformdataSomePropBoxed](#multipartformdatasomepropboxed)
sealed interface for validated payloads | -| record | [MultipartformdataSchema.MultipartformdataSomePropBoxedVoid](#multipartformdatasomepropboxedvoid)
boxed class to store validated null payloads | -| record | [MultipartformdataSchema.MultipartformdataSomePropBoxedBoolean](#multipartformdatasomepropboxedboolean)
boxed class to store validated boolean payloads | -| record | [MultipartformdataSchema.MultipartformdataSomePropBoxedNumber](#multipartformdatasomepropboxednumber)
boxed class to store validated Number payloads | -| record | [MultipartformdataSchema.MultipartformdataSomePropBoxedString](#multipartformdatasomepropboxedstring)
boxed class to store validated String payloads | -| record | [MultipartformdataSchema.MultipartformdataSomePropBoxedList](#multipartformdatasomepropboxedlist)
boxed class to store validated List payloads | -| record | [MultipartformdataSchema.MultipartformdataSomePropBoxedMap](#multipartformdatasomepropboxedmap)
boxed class to store validated Map payloads | -| static class | [MultipartformdataSchema.MultipartformdataSomeProp](#multipartformdatasomeprop)
schema class | -| sealed interface | [MultipartformdataSchema.Multipartformdata0Boxed](#multipartformdata0boxed)
sealed interface for validated payloads | -| record | [MultipartformdataSchema.Multipartformdata0BoxedString](#multipartformdata0boxedstring)
boxed class to store validated String payloads | -| static class | [MultipartformdataSchema.Multipartformdata0](#multipartformdata0)
schema class | - -## MultipartformdataSchema1Boxed -public sealed interface MultipartformdataSchema1Boxed
-permits
-[MultipartformdataSchema1BoxedMap](#multipartformdataschema1boxedmap) - -sealed interface that stores validated payloads using boxed classes - -## MultipartformdataSchema1BoxedMap -public record MultipartformdataSchema1BoxedMap
-implements [MultipartformdataSchema1Boxed](#multipartformdataschema1boxed) - -record that stores validated Map payloads, sealed permits implementation - -### Constructor Summary -| Constructor and Description | -| --------------------------- | -| MultipartformdataSchema1BoxedMap([MultipartformdataSchemaMap](#multipartformdataschemamap) data)
Creates an instance, private visibility | - -### Method Summary -| Modifier and Type | Method and Description | -| ----------------- | ---------------------- | -| [MultipartformdataSchemaMap](#multipartformdataschemamap) | data()
validated payload | -| @Nullable Object | getData()
validated payload | - -## MultipartformdataSchema1 -public static class MultipartformdataSchema1
-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.fakeinlinecomposition.post.responses.code200response.content.multipartformdata.MultipartformdataSchema; - -import java.util.Arrays; -import java.util.List; -import java.util.AbstractMap; - -static final SchemaConfiguration configuration = new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().build()); - -// Map validation -MultipartformdataSchema.MultipartformdataSchemaMap validatedPayload = - MultipartformdataSchema.MultipartformdataSchema1.validate( - new MultipartformdataSchema.MultipartformdataSchemaMapBuilder() - .build(), - configuration -); -``` - -### Field Summary -| Modifier and Type | Field and Description | -| ----------------- | ---------------------- | -| Set> | type = Set.of(Map.class) | -| Map> | properties = Map.ofEntries(
    new PropertyEntry("someProp", [MultipartformdataSomeProp.class](#multipartformdatasomeprop)))
)
| - -### Method Summary -| Modifier and Type | Method and Description | -| ----------------- | ---------------------- | -| [MultipartformdataSchemaMap](#multipartformdataschemamap) | validate([Map<?, ?>](#multipartformdataschemamapbuilder) arg, SchemaConfiguration configuration) | -| [MultipartformdataSchema1BoxedMap](#multipartformdataschema1boxedmap) | validateAndBox([Map<?, ?>](#multipartformdataschemamapbuilder) arg, SchemaConfiguration configuration) | -| [MultipartformdataSchema1Boxed](#multipartformdataschema1boxed) | validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) | -| @Nullable Object | validate(@Nullable Object arg, SchemaConfiguration configuration) | - -## MultipartformdataSchemaMapBuilder -public class MultipartformdataSchemaMapBuilder
-builder for `Map` - -A class that builds the Map input type - -### Constructor Summary -| Constructor and Description | -| --------------------------- | -| MultipartformdataSchemaMapBuilder()
Creates a builder that contains an empty map | - -### Method Summary -| Modifier and Type | Method and Description | -| ----------------- | ---------------------- | -| Map | build()
Returns map input that should be used with Schema.validate | -| [MultipartformdataSchemaMapBuilder](#multipartformdataschemamapbuilder) | someProp(Nothing? value) | -| [MultipartformdataSchemaMapBuilder](#multipartformdataschemamapbuilder) | someProp(boolean value) | -| [MultipartformdataSchemaMapBuilder](#multipartformdataschemamapbuilder) | someProp(String value) | -| [MultipartformdataSchemaMapBuilder](#multipartformdataschemamapbuilder) | someProp(int value) | -| [MultipartformdataSchemaMapBuilder](#multipartformdataschemamapbuilder) | someProp(float value) | -| [MultipartformdataSchemaMapBuilder](#multipartformdataschemamapbuilder) | someProp(long value) | -| [MultipartformdataSchemaMapBuilder](#multipartformdataschemamapbuilder) | someProp(double value) | -| [MultipartformdataSchemaMapBuilder](#multipartformdataschemamapbuilder) | someProp(List value) | -| [MultipartformdataSchemaMapBuilder](#multipartformdataschemamapbuilder) | someProp(Map value) | -| [MultipartformdataSchemaMapBuilder](#multipartformdataschemamapbuilder) | additionalProperty(String key, Nothing? value) | -| [MultipartformdataSchemaMapBuilder](#multipartformdataschemamapbuilder) | additionalProperty(String key, boolean value) | -| [MultipartformdataSchemaMapBuilder](#multipartformdataschemamapbuilder) | additionalProperty(String key, String value) | -| [MultipartformdataSchemaMapBuilder](#multipartformdataschemamapbuilder) | additionalProperty(String key, int value) | -| [MultipartformdataSchemaMapBuilder](#multipartformdataschemamapbuilder) | additionalProperty(String key, float value) | -| [MultipartformdataSchemaMapBuilder](#multipartformdataschemamapbuilder) | additionalProperty(String key, long value) | -| [MultipartformdataSchemaMapBuilder](#multipartformdataschemamapbuilder) | additionalProperty(String key, double value) | -| [MultipartformdataSchemaMapBuilder](#multipartformdataschemamapbuilder) | additionalProperty(String key, List value) | -| [MultipartformdataSchemaMapBuilder](#multipartformdataschemamapbuilder) | additionalProperty(String key, Map value) | - -## MultipartformdataSchemaMap -public static class MultipartformdataSchemaMap
-extends FrozenMap - -A class to store validated Map payloads - -### Method Summary -| Modifier and Type | Method and Description | -| ----------------- | ---------------------- | -| static [MultipartformdataSchemaMap](#multipartformdataschemamap) | of([Map](#multipartformdataschemamapbuilder) arg, SchemaConfiguration configuration) | -| @Nullable Object | someProp()
[optional] | -| @Nullable Object | getAdditionalProperty(String name)
provides type safety for additional properties | - -## MultipartformdataSomePropBoxed -public sealed interface MultipartformdataSomePropBoxed
-permits
-[MultipartformdataSomePropBoxedVoid](#multipartformdatasomepropboxedvoid), -[MultipartformdataSomePropBoxedBoolean](#multipartformdatasomepropboxedboolean), -[MultipartformdataSomePropBoxedNumber](#multipartformdatasomepropboxednumber), -[MultipartformdataSomePropBoxedString](#multipartformdatasomepropboxedstring), -[MultipartformdataSomePropBoxedList](#multipartformdatasomepropboxedlist), -[MultipartformdataSomePropBoxedMap](#multipartformdatasomepropboxedmap) - -sealed interface that stores validated payloads using boxed classes - -## MultipartformdataSomePropBoxedVoid -public record MultipartformdataSomePropBoxedVoid
-implements [MultipartformdataSomePropBoxed](#multipartformdatasomepropboxed) - -record that stores validated null payloads, sealed permits implementation - -### Constructor Summary -| Constructor and Description | -| --------------------------- | -| MultipartformdataSomePropBoxedVoid(Nothing? data)
Creates an instance, private visibility | - -### Method Summary -| Modifier and Type | Method and Description | -| ----------------- | ---------------------- | -| Nothing? | data()
validated payload | -| @Nullable Object | getData()
validated payload | - -## MultipartformdataSomePropBoxedBoolean -public record MultipartformdataSomePropBoxedBoolean
-implements [MultipartformdataSomePropBoxed](#multipartformdatasomepropboxed) - -record that stores validated boolean payloads, sealed permits implementation - -### Constructor Summary -| Constructor and Description | -| --------------------------- | -| MultipartformdataSomePropBoxedBoolean(boolean data)
Creates an instance, private visibility | - -### Method Summary -| Modifier and Type | Method and Description | -| ----------------- | ---------------------- | -| boolean | data()
validated payload | -| @Nullable Object | getData()
validated payload | - -## MultipartformdataSomePropBoxedNumber -public record MultipartformdataSomePropBoxedNumber
-implements [MultipartformdataSomePropBoxed](#multipartformdatasomepropboxed) - -record that stores validated Number payloads, sealed permits implementation - -### Constructor Summary -| Constructor and Description | -| --------------------------- | -| MultipartformdataSomePropBoxedNumber(Number data)
Creates an instance, private visibility | - -### Method Summary -| Modifier and Type | Method and Description | -| ----------------- | ---------------------- | -| Number | data()
validated payload | -| @Nullable Object | getData()
validated payload | - -## MultipartformdataSomePropBoxedString -public record MultipartformdataSomePropBoxedString
-implements [MultipartformdataSomePropBoxed](#multipartformdatasomepropboxed) - -record that stores validated String payloads, sealed permits implementation - -### Constructor Summary -| Constructor and Description | -| --------------------------- | -| MultipartformdataSomePropBoxedString(String data)
Creates an instance, private visibility | - -### Method Summary -| Modifier and Type | Method and Description | -| ----------------- | ---------------------- | -| String | data()
validated payload | -| @Nullable Object | getData()
validated payload | - -## MultipartformdataSomePropBoxedList -public record MultipartformdataSomePropBoxedList
-implements [MultipartformdataSomePropBoxed](#multipartformdatasomepropboxed) - -record that stores validated List payloads, sealed permits implementation - -### Constructor Summary -| Constructor and Description | -| --------------------------- | -| MultipartformdataSomePropBoxedList(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 | - -## MultipartformdataSomePropBoxedMap -public record MultipartformdataSomePropBoxedMap
-implements [MultipartformdataSomePropBoxed](#multipartformdatasomepropboxed) - -record that stores validated Map payloads, sealed permits implementation - -### Constructor Summary -| Constructor and Description | -| --------------------------- | -| MultipartformdataSomePropBoxedMap(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 | - -## MultipartformdataSomeProp -public static class MultipartformdataSomeProp
-extends JsonSchema - -A schema class that validates payloads - -### Field Summary -| Modifier and Type | Field and Description | -| ----------------- | ---------------------- | -| List> | allOf = List.of(
    [Multipartformdata0.class](#multipartformdata0)
;)
| - -### Method Summary -| Modifier and Type | Method and Description | -| ----------------- | ---------------------- | -| String | validate(String arg, SchemaConfiguration configuration) | -| Nothing? | validate(Nothing? arg, SchemaConfiguration configuration) | -| int | validate(int arg, SchemaConfiguration configuration) | -| long | validate(long arg, SchemaConfiguration configuration) | -| float | validate(float arg, SchemaConfiguration configuration) | -| double | validate(double arg, SchemaConfiguration configuration) | -| Number | validate(Number arg, SchemaConfiguration configuration) | -| boolean | validate(boolean arg, SchemaConfiguration configuration) | -| FrozenMap<@Nullable Object> | validate(Map<?, ?> arg, SchemaConfiguration configuration) | -| FrozenList<@Nullable Object> | validate(List arg, SchemaConfiguration configuration) | -| [MultipartformdataSomePropBoxedString](#multipartformdatasomepropboxedstring) | validateAndBox(String arg, SchemaConfiguration configuration) | -| [MultipartformdataSomePropBoxedVoid](#multipartformdatasomepropboxedvoid) | validateAndBox(Nothing? arg, SchemaConfiguration configuration) | -| [MultipartformdataSomePropBoxedNumber](#multipartformdatasomepropboxednumber) | validateAndBox(Number arg, SchemaConfiguration configuration) | -| [MultipartformdataSomePropBoxedBoolean](#multipartformdatasomepropboxedboolean) | validateAndBox(boolean arg, SchemaConfiguration configuration) | -| [MultipartformdataSomePropBoxedMap](#multipartformdatasomepropboxedmap) | validateAndBox(Map<?, ?> arg, SchemaConfiguration configuration) | -| [MultipartformdataSomePropBoxedList](#multipartformdatasomepropboxedlist) | validateAndBox(List arg, SchemaConfiguration configuration) | -| [MultipartformdataSomePropBoxed](#multipartformdatasomepropboxed) | validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) | -| @Nullable Object | validate(@Nullable Object arg, SchemaConfiguration configuration) | - -## Multipartformdata0Boxed -public sealed interface Multipartformdata0Boxed
-permits
-[Multipartformdata0BoxedString](#multipartformdata0boxedstring) - -sealed interface that stores validated payloads using boxed classes - -## Multipartformdata0BoxedString -public record Multipartformdata0BoxedString
-implements [Multipartformdata0Boxed](#multipartformdata0boxed) - -record that stores validated String payloads, sealed permits implementation - -### Constructor Summary -| Constructor and Description | -| --------------------------- | -| Multipartformdata0BoxedString(String data)
Creates an instance, private visibility | - -### Method Summary -| Modifier and Type | Method and Description | -| ----------------- | ---------------------- | -| String | data()
validated payload | -| @Nullable Object | getData()
validated payload | - -## Multipartformdata0 -public static class Multipartformdata0
-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.fakeinlinecomposition.post.responses.code200response.content.multipartformdata.MultipartformdataSchema; - -import java.util.Arrays; -import java.util.List; -import java.util.AbstractMap; - -static final SchemaConfiguration configuration = new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().build()); - -// String validation -String validatedPayload = MultipartformdataSchema.Multipartformdata0.validate( - "a", - configuration -); -``` - -### Field Summary -| Modifier and Type | Field and Description | -| ----------------- | ---------------------- | -| Set> | type = Set.of(
    String.class
)
| -| Integer | minLength = 1 | - -### Method Summary -| Modifier and Type | Method and Description | -| ----------------- | ---------------------- | -| String | validate(String arg, SchemaConfiguration configuration) | -| [Multipartformdata0BoxedString](#multipartformdata0boxedstring) | validateAndBox(String arg, SchemaConfiguration configuration) | -| [Multipartformdata0Boxed](#multipartformdata0boxed) | validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) | -| @Nullable Object | validate(@Nullable Object arg, SchemaConfiguration configuration) | diff --git a/samples/client/petstore/kotlin/docs/paths/fakejsonformdata/FakejsonformdataGet.md b/samples/client/petstore/kotlin/docs/paths/fakejsonformdata/FakejsonformdataGet.md deleted file mode 100644 index d7cfc4e3192..00000000000 --- a/samples/client/petstore/kotlin/docs/paths/fakejsonformdata/FakejsonformdataGet.md +++ /dev/null @@ -1,146 +0,0 @@ -# FakejsonformdataGet - -public class FakejsonformdataGet - -A class that contains necessary endpoint classes -- a class that calls the endpoint method using the http verb -- a class that calls the endpoint method using the operationId name -- class(es) to store the request inputs -- builder(s) to set the request input data - -## Nested Class Summary -| Modifier and Type | Class and Description | -| ----------------- | --------------------- | -| static class | [Get](#get)
The class that has a get method to call the endpoint | -| interface | [JsonFormDataOperation](#jsonformdataoperation)
The interface that has a jsonFormData method to call the endpoint | -| static class | [GetRequest](#getrequest)
The request inputs class | -| static class | [GetRequestBuilder](#getrequestbuilder)
A builder for the request input class | - -## Get -public static class Get extends ApiClient.ApiClient1 implements GetOperation
- -a class that allows one to call the endpoint using a method named get - -### 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.fakejsonformdata.get.FakejsonformdataGetRequestBody; -import org.openapijsonschematools.client.paths.fakejsonformdata.get.requestbody.content.applicationxwwwformurlencoded.ApplicationxwwwformurlencodedSchema; -import org.openapijsonschematools.client.RootServerInfo; -import org.openapijsonschematools.client.servers.RootServer0; -import org.openapijsonschematools.client.servers.RootServer1; -import org.openapijsonschematools.client.servers.RootServer2; -import org.openapijsonschematools.client.paths.fakejsonformdata.get.responses.FakejsonformdataGetCode200Response; -import org.openapijsonschematools.client.servers.RootServerInfo; -import org.openapijsonschematools.client.paths.fakejsonformdata.FakejsonformdataGet; -import org.openapijsonschematools.client.paths.fakejsonformdata.get.FakejsonformdataGetResponses; - -import java.io.IOException; -import java.util.Arrays; -import java.util.List; -import java.util.Map; -import java.util.AbstractMap; - -// if you want to use a server that is not SERVER_0 pass it in here and change the ServerIndex input below -ApiConfiguration.ServerInfo serverInfo = new ApiConfiguration.ServerInfoBuilder() - .rootServerInfo( - new RootServerInfo.RootServerInfoBuilder() - .rootServer0(new RootServer0()) - .build() - ) - .build(); -ApiConfiguration.ServerIndexInfo serverIndexInfo = new ApiConfiguration.ServerIndexInfoBuilder() - .rootServerInfoServerIndex(RootServerInfo.ServerIndex.SERVER_0) - .build(); -Duration timeout = Duration.ofSeconds(1L); -Map> defaultHeaders = Map.of("User-Agent", List.of("OpenAPI-JSON-Schema-Generator/1.0.0/java")); -ApiConfiguration apiConfiguration = new ApiConfiguration( - serverInfo - serverIndexInfo, - timeout, - defaultHeaders -); -SchemaConfiguration schemaConfiguration = new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().build()); -FakejsonformdataGet.Get apiClient = new FakejsonformdataGet.Get(apiConfiguration, schemaConfiguration); - - -var request = new FakejsonformdataGet.GetRequestBuilder().build(); - -FakejsonformdataGetResponses.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; -} -FakejsonformdataGetResponses.EndpointFakejsonformdataGetCode200Response castResponse = (FakejsonformdataGetResponses.EndpointFakejsonformdataGetCode200Response) response; -``` -### Constructor Summary -| Constructor and Description | -| --------------------------- | -| Get(ApiConfiguration apiConfiguration, SchemaConfiguration schemaConfiguration)
Creates an instance | - -### Method Summary -| Modifier and Type | Method and Description | -| ----------------- | ---------------------- | -| [FakejsonformdataGetResponses.EndpointResponse](../../paths/fakejsonformdata/get/FakejsonformdataGetResponses.md#endpointresponse) | get([GetRequest](#getrequest) request) | - -## JsonFormDataOperation -public interface JsonFormDataOperation
- -an interface that allows one to call the endpoint using a method named jsonFormData by the operationId - -### Method Summary -| Modifier and Type | Method and Description | -| ----------------- | ---------------------- | -| [FakejsonformdataGetResponses.EndpointResponse](../../paths/fakejsonformdata/get/FakejsonformdataGetResponses.md#endpointresponse) | jsonFormData([GetRequest](#getrequest) request) | - -## GetRequest -public static class GetRequest
- -a class that stores the final request inputs - -### Field Summary -| Modifier and Type | Field and Description | -| ----------------- | --------------------- | -| [FakejsonformdataGetRequestBody.@Nullable SealedRequestBody](../../paths/fakejsonformdata/get/FakejsonformdataGetRequestBody.md#sealedrequestbody) | requestBody
optional | -| [RootServerInfo.@Nullable ServerIndex](../../RootServerInfo.md#serverindex) | serverIndex
optional. Note: this will override the value in apiConfiguration | -| @Nullable Duration | timeout
optional. Note: this will override the value in apiConfiguration | - -## GetRequestBuilder -public static class GetRequestBuilder
- -a builder for request inputs - -### Constructor Summary -| Constructor and Description | -| --------------------------- | -| GetRequestBuilder()
Creates a builder that contains null for all parameters | - -### Method Summary -| Modifier and Type | Method and Description | -| ----------------- | ---------------------- | -| [GetRequest](#getrequest) | build()
Returns the request input used to call an endpoint method | -| [GetRequestBuilder](#getrequestbuilder) | requestBody([FakejsonformdataGetRequestBody.SealedRequestBody](../../paths/fakejsonformdata/get/FakejsonformdataGetRequestBody.md#sealedrequestbody) requestBody)
sets the optional property | -| [GetRequestBuilder](#getrequestbuilder) | serverIndex([RootServerInfo.ServerIndex](../../RootServerInfo.md#serverindex) serverIndex)
sets the optional property. Note: this will override the value in apiConfiguration | -| [GetRequestBuilder](#getrequestbuilder) | timeout(Duration timeout)
sets the optional property. Note: this will override the value in apiConfiguration | - -[[Back to top]](#top) [[Back to README]](../../../README.md) diff --git a/samples/client/petstore/kotlin/docs/paths/fakejsonformdata/get/FakejsonformdataGetRequestBody.md b/samples/client/petstore/kotlin/docs/paths/fakejsonformdata/get/FakejsonformdataGetRequestBody.md deleted file mode 100644 index 8480a0cda2e..00000000000 --- a/samples/client/petstore/kotlin/docs/paths/fakejsonformdata/get/FakejsonformdataGetRequestBody.md +++ /dev/null @@ -1,90 +0,0 @@ -# FakejsonformdataGetRequestBody - -public class FakejsonformdataGetRequestBody - -A class that contains necessary nested request body classes -- SealedMediaType, a sealed interface which contains all the schema/encoding info for each contentType -- records which implement SealedMediaType, the concrete media types -- a class that extends RequestBodySerializer and is used to serialize input SealedRequestBody instances -- SealedRequestBody, a sealed interface which contains all the contentType/schema input types -- records which implement SealedRequestBody, the concrete request body types - -## Nested Class Summary -| Modifier and Type | Class and Description | -| ----------------- | --------------------- | -| sealed interface | [FakejsonformdataGetRequestBody.SealedMediaType](#sealedmediatype)
media type sealed interface | -| record | [FakejsonformdataGetRequestBody.ApplicationxwwwformurlencodedMediaType](#applicationxwwwformurlencodedmediatype)
record storing schema + encoding for a specific contentType | -| static class | [FakejsonformdataGetRequestBody.FakejsonformdataGetRequestBody1](#fakejsonformdatagetrequestbody1)
class that serializes request bodies | -| sealed interface | [FakejsonformdataGetRequestBody.SealedRequestBody](#sealedrequestbody)
request body sealed interface | -| record | [FakejsonformdataGetRequestBody.ApplicationxwwwformurlencodedRequestBody](#applicationxwwwformurlencodedrequestbody)
implements sealed interface to store request body input | - -## SealedMediaType -public sealed interface SealedMediaType
-permits
-[ApplicationxwwwformurlencodedMediaType](#applicationxwwwformurlencodedmediatype) - -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), Nothing?> - -class storing schema info for a specific contentType - -### Constructor Summary -| Constructor and Description | -| --------------------------- | -| ApplicationxwwwformurlencodedMediaType()
Creates an instance | - -### 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 | -| Nothing? | encoding()
the encoding info | - -## FakejsonformdataGetRequestBody1 -public static class FakejsonformdataGetRequestBody1
- -a class that serializes SealedRequestBody request bodies - -### Constructor Summary -| Constructor and Description | -| --------------------------- | -| FakejsonformdataGetRequestBody1()
Creates an instance | - -### Field Summary -| Modifier and Type | Field and Description | -| ----------------- | --------------------- | -| boolean | required = false
whether the request body is required | -| Map | content = Map.ofEntries(
    new AbstractMap.SimpleEntry<>("application/x-www-form-urlencoded", new [ApplicationxwwwformurlencodedMediaType](#applicationxwwwformurlencodedmediatype)())
)
the contentType to schema info | - -### Method Summary -| Modifier and Type | Method and Description | -| ----------------- | ---------------------- | -| SerializedRequestBody | serialize([SealedRequestBody](#sealedrequestbody) requestBody)
called by endpoint when creating request body bytes | - -## SealedRequestBody -public sealed interface SealedRequestBody
-permits
-[ApplicationxwwwformurlencodedRequestBody](#applicationxwwwformurlencodedrequestbody) - -sealed interface that stores request contentType + validated schema data - -## ApplicationxwwwformurlencodedRequestBody -public record ApplicationxwwwformurlencodedRequestBody
-implements [SealedRequestBody](#sealedrequestbody),
-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 | - -### 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 | diff --git a/samples/client/petstore/kotlin/docs/paths/fakejsonformdata/get/FakejsonformdataGetResponses.md b/samples/client/petstore/kotlin/docs/paths/fakejsonformdata/get/FakejsonformdataGetResponses.md deleted file mode 100644 index 0dca33e8171..00000000000 --- a/samples/client/petstore/kotlin/docs/paths/fakejsonformdata/get/FakejsonformdataGetResponses.md +++ /dev/null @@ -1,29 +0,0 @@ -# FakejsonformdataGetResponses - -public class FakejsonformdataGetResponses - -A class that contains necessary responses classes -- a sealed interface, EndpointResponse, that stores endpoint responses -- records for each endpoint response - -## Nested Class Summary -| Modifier and Type | Class and Description | -| ----------------- | --------------------- | -| sealed interface | [EndpointResponse](#endpointresponse)
stores the endpoint responses | -| record | [EndpointFakejsonformdataGetCode200Response](#endpointfakejsonformdatagetcode200response)
the response for 200 | - -## EndpointResponse -public sealed interface EndpointResponse permits
-[EndpointFakejsonformdataGetCode200Response](#endpointfakejsonformdatagetcode200response) - -a sealed interface that stores endpoint responses - -## EndpointFakejsonformdataGetCode200Response -public record EndpointFakejsonformdataGetCode200Response( - HttpResponse response, - Nothing? body, - Nothing? headers -) implements EndpointResponse, ApiResponse
- -a class that stores an endpoint response - diff --git a/samples/client/petstore/kotlin/docs/paths/fakejsonformdata/get/requestbody/content/applicationxwwwformurlencoded/ApplicationxwwwformurlencodedSchema.md b/samples/client/petstore/kotlin/docs/paths/fakejsonformdata/get/requestbody/content/applicationxwwwformurlencoded/ApplicationxwwwformurlencodedSchema.md deleted file mode 100644 index 94222eb71d4..00000000000 --- a/samples/client/petstore/kotlin/docs/paths/fakejsonformdata/get/requestbody/content/applicationxwwwformurlencoded/ApplicationxwwwformurlencodedSchema.md +++ /dev/null @@ -1,262 +0,0 @@ -# ApplicationxwwwformurlencodedSchema -public class ApplicationxwwwformurlencodedSchema
- -A class that contains necessary nested -- schema classes (which validate payloads), extends JsonSchema -- sealed interfaces which store validated payloads, java version of a sum type -- boxed classes which store validated payloads, sealed permits class implementations -- classes to store validated map payloads, extends FrozenMap -- classes to build inputs for map payloads - -## Nested Class Summary -| Modifier and Type | Class and Description | -| ----------------- | ---------------------- | -| sealed interface | [ApplicationxwwwformurlencodedSchema.ApplicationxwwwformurlencodedSchema1Boxed](#applicationxwwwformurlencodedschema1boxed)
sealed interface for validated payloads | -| record | [ApplicationxwwwformurlencodedSchema.ApplicationxwwwformurlencodedSchema1BoxedMap](#applicationxwwwformurlencodedschema1boxedmap)
boxed class to store validated Map payloads | -| static class | [ApplicationxwwwformurlencodedSchema.ApplicationxwwwformurlencodedSchema1](#applicationxwwwformurlencodedschema1)
schema class | -| static class | [ApplicationxwwwformurlencodedSchema.ApplicationxwwwformurlencodedSchemaMapBuilder](#applicationxwwwformurlencodedschemamapbuilder)
builder for Map payloads | -| static class | [ApplicationxwwwformurlencodedSchema.ApplicationxwwwformurlencodedSchemaMap](#applicationxwwwformurlencodedschemamap)
output class for Map payloads | -| sealed interface | [ApplicationxwwwformurlencodedSchema.ApplicationxwwwformurlencodedParam2Boxed](#applicationxwwwformurlencodedparam2boxed)
sealed interface for validated payloads | -| record | [ApplicationxwwwformurlencodedSchema.ApplicationxwwwformurlencodedParam2BoxedString](#applicationxwwwformurlencodedparam2boxedstring)
boxed class to store validated String payloads | -| static class | [ApplicationxwwwformurlencodedSchema.ApplicationxwwwformurlencodedParam2](#applicationxwwwformurlencodedparam2)
schema class | -| sealed interface | [ApplicationxwwwformurlencodedSchema.ApplicationxwwwformurlencodedParamBoxed](#applicationxwwwformurlencodedparamboxed)
sealed interface for validated payloads | -| record | [ApplicationxwwwformurlencodedSchema.ApplicationxwwwformurlencodedParamBoxedString](#applicationxwwwformurlencodedparamboxedstring)
boxed class to store validated String payloads | -| static class | [ApplicationxwwwformurlencodedSchema.ApplicationxwwwformurlencodedParam](#applicationxwwwformurlencodedparam)
schema class | - -## ApplicationxwwwformurlencodedSchema1Boxed -public sealed interface ApplicationxwwwformurlencodedSchema1Boxed
-permits
-[ApplicationxwwwformurlencodedSchema1BoxedMap](#applicationxwwwformurlencodedschema1boxedmap) - -sealed interface that stores validated payloads using boxed classes - -## ApplicationxwwwformurlencodedSchema1BoxedMap -public record ApplicationxwwwformurlencodedSchema1BoxedMap
-implements [ApplicationxwwwformurlencodedSchema1Boxed](#applicationxwwwformurlencodedschema1boxed) - -record that stores validated Map payloads, sealed permits implementation - -### Constructor Summary -| Constructor and Description | -| --------------------------- | -| ApplicationxwwwformurlencodedSchema1BoxedMap([ApplicationxwwwformurlencodedSchemaMap](#applicationxwwwformurlencodedschemamap) data)
Creates an instance, private visibility | - -### Method Summary -| Modifier and Type | Method and Description | -| ----------------- | ---------------------- | -| [ApplicationxwwwformurlencodedSchemaMap](#applicationxwwwformurlencodedschemamap) | data()
validated payload | -| @Nullable Object | getData()
validated payload | - -## ApplicationxwwwformurlencodedSchema1 -public static class ApplicationxwwwformurlencodedSchema1
-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.fakejsonformdata.get.requestbody.content.applicationxwwwformurlencoded.ApplicationxwwwformurlencodedSchema; - -import java.util.Arrays; -import java.util.List; -import java.util.AbstractMap; - -static final SchemaConfiguration configuration = new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().build()); - -// Map validation -ApplicationxwwwformurlencodedSchema.ApplicationxwwwformurlencodedSchemaMap validatedPayload = - ApplicationxwwwformurlencodedSchema.ApplicationxwwwformurlencodedSchema1.validate( - new ApplicationxwwwformurlencodedSchema.ApplicationxwwwformurlencodedSchemaMapBuilder() - .param("a") - - .param2("a") - - .build(), - configuration -); -``` - -### Field Summary -| Modifier and Type | Field and Description | -| ----------------- | ---------------------- | -| Set> | type = Set.of(Map.class) | -| Map> | properties = Map.ofEntries(
    new PropertyEntry("param", [ApplicationxwwwformurlencodedParam.class](#applicationxwwwformurlencodedparam))),
    new PropertyEntry("param2", [ApplicationxwwwformurlencodedParam2.class](#applicationxwwwformurlencodedparam2)))
)
| -| Set | required = Set.of(
    "param",
    "param2"
)
| - -### Method Summary -| Modifier and Type | Method and Description | -| ----------------- | ---------------------- | -| [ApplicationxwwwformurlencodedSchemaMap](#applicationxwwwformurlencodedschemamap) | validate([Map<?, ?>](#applicationxwwwformurlencodedschemamapbuilder) arg, SchemaConfiguration configuration) | -| [ApplicationxwwwformurlencodedSchema1BoxedMap](#applicationxwwwformurlencodedschema1boxedmap) | validateAndBox([Map<?, ?>](#applicationxwwwformurlencodedschemamapbuilder) arg, SchemaConfiguration configuration) | -| [ApplicationxwwwformurlencodedSchema1Boxed](#applicationxwwwformurlencodedschema1boxed) | validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) | -| @Nullable Object | validate(@Nullable Object arg, SchemaConfiguration configuration) | - -## ApplicationxwwwformurlencodedSchemaMap00Builder -public class ApplicationxwwwformurlencodedSchemaMap00Builder
-builder for `Map` - -A class that builds the Map input type - -### Constructor Summary -| Constructor and Description | -| --------------------------- | -| ApplicationxwwwformurlencodedSchemaMap00Builder(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 | -| [ApplicationxwwwformurlencodedSchemaMap00Builder](#applicationxwwwformurlencodedschemamap00builder) | additionalProperty(String key, Nothing? value) | -| [ApplicationxwwwformurlencodedSchemaMap00Builder](#applicationxwwwformurlencodedschemamap00builder) | additionalProperty(String key, boolean value) | -| [ApplicationxwwwformurlencodedSchemaMap00Builder](#applicationxwwwformurlencodedschemamap00builder) | additionalProperty(String key, String value) | -| [ApplicationxwwwformurlencodedSchemaMap00Builder](#applicationxwwwformurlencodedschemamap00builder) | additionalProperty(String key, int value) | -| [ApplicationxwwwformurlencodedSchemaMap00Builder](#applicationxwwwformurlencodedschemamap00builder) | additionalProperty(String key, float value) | -| [ApplicationxwwwformurlencodedSchemaMap00Builder](#applicationxwwwformurlencodedschemamap00builder) | additionalProperty(String key, long value) | -| [ApplicationxwwwformurlencodedSchemaMap00Builder](#applicationxwwwformurlencodedschemamap00builder) | additionalProperty(String key, double value) | -| [ApplicationxwwwformurlencodedSchemaMap00Builder](#applicationxwwwformurlencodedschemamap00builder) | additionalProperty(String key, List value) | -| [ApplicationxwwwformurlencodedSchemaMap00Builder](#applicationxwwwformurlencodedschemamap00builder) | additionalProperty(String key, Map value) | - -## ApplicationxwwwformurlencodedSchemaMap01Builder -public class ApplicationxwwwformurlencodedSchemaMap01Builder
-builder for `Map` - -A class that builds the Map input type - -### Constructor Summary -| Constructor and Description | -| --------------------------- | -| ApplicationxwwwformurlencodedSchemaMap01Builder(Map instance)
Creates a builder that contains the passed instance | - -### Method Summary -| Modifier and Type | Method and Description | -| ----------------- | ---------------------- | -| [ApplicationxwwwformurlencodedSchemaMap00Builder](#applicationxwwwformurlencodedschemamap00builder) | param2(String value) | - -## ApplicationxwwwformurlencodedSchemaMap10Builder -public class ApplicationxwwwformurlencodedSchemaMap10Builder
-builder for `Map` - -A class that builds the Map input type - -### Constructor Summary -| Constructor and Description | -| --------------------------- | -| ApplicationxwwwformurlencodedSchemaMap10Builder(Map instance)
Creates a builder that contains the passed instance | - -### Method Summary -| Modifier and Type | Method and Description | -| ----------------- | ---------------------- | -| [ApplicationxwwwformurlencodedSchemaMap00Builder](#applicationxwwwformurlencodedschemamap00builder) | param(String value) | - -## ApplicationxwwwformurlencodedSchemaMapBuilder -public class ApplicationxwwwformurlencodedSchemaMapBuilder
-builder for `Map` - -A class that builds the Map input type - -### Constructor Summary -| Constructor and Description | -| --------------------------- | -| ApplicationxwwwformurlencodedSchemaMapBuilder()
Creates a builder that contains an empty map | - -### Method Summary -| Modifier and Type | Method and Description | -| ----------------- | ---------------------- | -| [ApplicationxwwwformurlencodedSchemaMap01Builder](#applicationxwwwformurlencodedschemamap01builder) | param(String value) | -| [ApplicationxwwwformurlencodedSchemaMap10Builder](#applicationxwwwformurlencodedschemamap10builder) | param2(String value) | - -## ApplicationxwwwformurlencodedSchemaMap -public static class ApplicationxwwwformurlencodedSchemaMap
-extends FrozenMap - -A class to store validated Map payloads - -### Method Summary -| Modifier and Type | Method and Description | -| ----------------- | ---------------------- | -| static [ApplicationxwwwformurlencodedSchemaMap](#applicationxwwwformurlencodedschemamap) | of([Map](#applicationxwwwformurlencodedschemamapbuilder) arg, SchemaConfiguration configuration) | -| String | param()
| -| String | param2()
| -| @Nullable Object | getAdditionalProperty(String name)
provides type safety for additional properties | - -## ApplicationxwwwformurlencodedParam2Boxed -public sealed interface ApplicationxwwwformurlencodedParam2Boxed
-permits
-[ApplicationxwwwformurlencodedParam2BoxedString](#applicationxwwwformurlencodedparam2boxedstring) - -sealed interface that stores validated payloads using boxed classes - -## ApplicationxwwwformurlencodedParam2BoxedString -public record ApplicationxwwwformurlencodedParam2BoxedString
-implements [ApplicationxwwwformurlencodedParam2Boxed](#applicationxwwwformurlencodedparam2boxed) - -record that stores validated String payloads, sealed permits implementation - -### Constructor Summary -| Constructor and Description | -| --------------------------- | -| ApplicationxwwwformurlencodedParam2BoxedString(String data)
Creates an instance, private visibility | - -### Method Summary -| Modifier and Type | Method and Description | -| ----------------- | ---------------------- | -| String | data()
validated payload | -| @Nullable Object | getData()
validated payload | - -## ApplicationxwwwformurlencodedParam2 -public static class ApplicationxwwwformurlencodedParam2
-extends StringJsonSchema.StringJsonSchema1 - -A schema class that validates payloads - -## Description -field2 - -| Methods Inherited from class org.openapijsonschematools.client.schemas.StringJsonSchema.StringJsonSchema1 | -| ------------------------------------------------------------------ | -| validate | -| validateAndBox | - -## ApplicationxwwwformurlencodedParamBoxed -public sealed interface ApplicationxwwwformurlencodedParamBoxed
-permits
-[ApplicationxwwwformurlencodedParamBoxedString](#applicationxwwwformurlencodedparamboxedstring) - -sealed interface that stores validated payloads using boxed classes - -## ApplicationxwwwformurlencodedParamBoxedString -public record ApplicationxwwwformurlencodedParamBoxedString
-implements [ApplicationxwwwformurlencodedParamBoxed](#applicationxwwwformurlencodedparamboxed) - -record that stores validated String payloads, sealed permits implementation - -### Constructor Summary -| Constructor and Description | -| --------------------------- | -| ApplicationxwwwformurlencodedParamBoxedString(String data)
Creates an instance, private visibility | - -### Method Summary -| Modifier and Type | Method and Description | -| ----------------- | ---------------------- | -| String | data()
validated payload | -| @Nullable Object | getData()
validated payload | - -## ApplicationxwwwformurlencodedParam -public static class ApplicationxwwwformurlencodedParam
-extends StringJsonSchema.StringJsonSchema1 - -A schema class that validates payloads - -## Description -field1 - -| Methods Inherited from class org.openapijsonschematools.client.schemas.StringJsonSchema.StringJsonSchema1 | -| ------------------------------------------------------------------ | -| validate | -| validateAndBox | diff --git a/samples/client/petstore/kotlin/docs/paths/fakejsonformdata/get/responses/FakejsonformdataGetCode200Response.md b/samples/client/petstore/kotlin/docs/paths/fakejsonformdata/get/responses/FakejsonformdataGetCode200Response.md deleted file mode 100644 index c7ae900e122..00000000000 --- a/samples/client/petstore/kotlin/docs/paths/fakejsonformdata/get/responses/FakejsonformdataGetCode200Response.md +++ /dev/null @@ -1,17 +0,0 @@ -# FakejsonformdataGetCode200Response - -public class FakejsonformdataGetCode200Response extends [SuccessDescriptionOnly](../../components/responses/SuccessDescriptionOnly.md) - -A class (extended from the $ref class) that contains necessary nested response classes -- a class that extends ResponseDeserializer and is used to deserialize responses - -## Nested Class Summary -| Modifier and Type | Class and Description | -| ----------------- | --------------------- | -| static class | [FakejsonformdataGetCode200Response.FakejsonformdataGetCode200Response1](#fakejsonformdatagetcode200response1)
class that deserializes responses | - -## FakejsonformdataGetCode200Response1 -public static class FakejsonformdataGetCode200Response1 extends [SuccessDescriptionOnly1](../../components/responses/SuccessDescriptionOnly.md#successdescriptiononly1)
- -a class that deserializes responses, extended from the $ref class - diff --git a/samples/client/petstore/kotlin/docs/paths/fakejsonpatch/FakejsonpatchPatch.md b/samples/client/petstore/kotlin/docs/paths/fakejsonpatch/FakejsonpatchPatch.md deleted file mode 100644 index 28d3b8c040d..00000000000 --- a/samples/client/petstore/kotlin/docs/paths/fakejsonpatch/FakejsonpatchPatch.md +++ /dev/null @@ -1,146 +0,0 @@ -# FakejsonpatchPatch - -public class FakejsonpatchPatch - -A class that contains necessary endpoint classes -- a class that calls the endpoint method using the http verb -- a class that calls the endpoint method using the operationId name -- class(es) to store the request inputs -- builder(s) to set the request input data - -## Nested Class Summary -| Modifier and Type | Class and Description | -| ----------------- | --------------------- | -| static class | [Patch](#patch)
The class that has a patch method to call the endpoint | -| interface | [JsonPatchOperation](#jsonpatchoperation)
The interface that has a jsonPatch method to call the endpoint | -| static class | [PatchRequest](#patchrequest)
The request inputs class | -| static class | [PatchRequestBuilder](#patchrequestbuilder)
A builder for the request input class | - -## Patch -public static class Patch extends ApiClient.ApiClient1 implements PatchOperation
- -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.FakejsonpatchPatchRequestBody; -import org.openapijsonschematools.client.components.schemas.JSONPatchRequest; -import org.openapijsonschematools.client.RootServerInfo; -import org.openapijsonschematools.client.servers.RootServer0; -import org.openapijsonschematools.client.servers.RootServer1; -import org.openapijsonschematools.client.servers.RootServer2; -import org.openapijsonschematools.client.paths.fakejsonpatch.patch.responses.FakejsonpatchPatchCode200Response; -import org.openapijsonschematools.client.servers.RootServerInfo; -import org.openapijsonschematools.client.paths.fakejsonpatch.FakejsonpatchPatch; -import org.openapijsonschematools.client.paths.fakejsonpatch.patch.FakejsonpatchPatchResponses; - -import java.io.IOException; -import java.util.Arrays; -import java.util.List; -import java.util.Map; -import java.util.AbstractMap; - -// if you want to use a server that is not SERVER_0 pass it in here and change the ServerIndex input below -ApiConfiguration.ServerInfo serverInfo = new ApiConfiguration.ServerInfoBuilder() - .rootServerInfo( - new RootServerInfo.RootServerInfoBuilder() - .rootServer0(new RootServer0()) - .build() - ) - .build(); -ApiConfiguration.ServerIndexInfo serverIndexInfo = new ApiConfiguration.ServerIndexInfoBuilder() - .rootServerInfoServerIndex(RootServerInfo.ServerIndex.SERVER_0) - .build(); -Duration timeout = Duration.ofSeconds(1L); -Map> defaultHeaders = Map.of("User-Agent", List.of("OpenAPI-JSON-Schema-Generator/1.0.0/java")); -ApiConfiguration apiConfiguration = new ApiConfiguration( - serverInfo - serverIndexInfo, - timeout, - defaultHeaders -); -SchemaConfiguration schemaConfiguration = new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().build()); -FakejsonpatchPatch.Patch apiClient = new FakejsonpatchPatch.Patch(apiConfiguration, schemaConfiguration); - - -var request = new FakejsonpatchPatch.PatchRequestBuilder().build(); - -FakejsonpatchPatchResponses.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; -} -FakejsonpatchPatchResponses.EndpointFakejsonpatchPatchCode200Response castResponse = (FakejsonpatchPatchResponses.EndpointFakejsonpatchPatchCode200Response) response; -``` -### Constructor Summary -| Constructor and Description | -| --------------------------- | -| Patch(ApiConfiguration apiConfiguration, SchemaConfiguration schemaConfiguration)
Creates an instance | - -### Method Summary -| Modifier and Type | Method and Description | -| ----------------- | ---------------------- | -| [FakejsonpatchPatchResponses.EndpointResponse](../../paths/fakejsonpatch/patch/FakejsonpatchPatchResponses.md#endpointresponse) | patch([PatchRequest](#patchrequest) request) | - -## JsonPatchOperation -public interface JsonPatchOperation
- -an interface that allows one to call the endpoint using a method named jsonPatch by the operationId - -### Method Summary -| Modifier and Type | Method and Description | -| ----------------- | ---------------------- | -| [FakejsonpatchPatchResponses.EndpointResponse](../../paths/fakejsonpatch/patch/FakejsonpatchPatchResponses.md#endpointresponse) | jsonPatch([PatchRequest](#patchrequest) request) | - -## PatchRequest -public static class PatchRequest
- -a class that stores the final request inputs - -### Field Summary -| Modifier and Type | Field and Description | -| ----------------- | --------------------- | -| [FakejsonpatchPatchRequestBody.@Nullable SealedRequestBody](../../paths/fakejsonpatch/patch/FakejsonpatchPatchRequestBody.md#sealedrequestbody) | requestBody
optional | -| [RootServerInfo.@Nullable ServerIndex](../../RootServerInfo.md#serverindex) | serverIndex
optional. Note: this will override the value in apiConfiguration | -| @Nullable Duration | timeout
optional. Note: this will override the value in apiConfiguration | - -## PatchRequestBuilder -public static class PatchRequestBuilder
- -a builder for request inputs - -### Constructor Summary -| Constructor and Description | -| --------------------------- | -| PatchRequestBuilder()
Creates a builder that contains null for all parameters | - -### Method Summary -| Modifier and Type | Method and Description | -| ----------------- | ---------------------- | -| [PatchRequest](#patchrequest) | build()
Returns the request input used to call an endpoint method | -| [PatchRequestBuilder](#patchrequestbuilder) | requestBody([FakejsonpatchPatchRequestBody.SealedRequestBody](../../paths/fakejsonpatch/patch/FakejsonpatchPatchRequestBody.md#sealedrequestbody) requestBody)
sets the optional property | -| [PatchRequestBuilder](#patchrequestbuilder) | serverIndex([RootServerInfo.ServerIndex](../../RootServerInfo.md#serverindex) serverIndex)
sets the optional property. Note: this will override the value in apiConfiguration | -| [PatchRequestBuilder](#patchrequestbuilder) | timeout(Duration timeout)
sets the optional property. Note: this will override the value in apiConfiguration | - -[[Back to top]](#top) [[Back to README]](../../../README.md) diff --git a/samples/client/petstore/kotlin/docs/paths/fakejsonpatch/patch/FakejsonpatchPatchRequestBody.md b/samples/client/petstore/kotlin/docs/paths/fakejsonpatch/patch/FakejsonpatchPatchRequestBody.md deleted file mode 100644 index 2dafa6d19b3..00000000000 --- a/samples/client/petstore/kotlin/docs/paths/fakejsonpatch/patch/FakejsonpatchPatchRequestBody.md +++ /dev/null @@ -1,90 +0,0 @@ -# FakejsonpatchPatchRequestBody - -public class FakejsonpatchPatchRequestBody - -A class that contains necessary nested request body classes -- SealedMediaType, a sealed interface which contains all the schema/encoding info for each contentType -- records which implement SealedMediaType, the concrete media types -- a class that extends RequestBodySerializer and is used to serialize input SealedRequestBody instances -- SealedRequestBody, a sealed interface which contains all the contentType/schema input types -- records which implement SealedRequestBody, the concrete request body types - -## Nested Class Summary -| Modifier and Type | Class and Description | -| ----------------- | --------------------- | -| sealed interface | [FakejsonpatchPatchRequestBody.SealedMediaType](#sealedmediatype)
media type sealed interface | -| record | [FakejsonpatchPatchRequestBody.ApplicationjsonpatchjsonMediaType](#applicationjsonpatchjsonmediatype)
record storing schema + encoding for a specific contentType | -| static class | [FakejsonpatchPatchRequestBody.FakejsonpatchPatchRequestBody1](#fakejsonpatchpatchrequestbody1)
class that serializes request bodies | -| sealed interface | [FakejsonpatchPatchRequestBody.SealedRequestBody](#sealedrequestbody)
request body sealed interface | -| record | [FakejsonpatchPatchRequestBody.ApplicationjsonpatchjsonRequestBody](#applicationjsonpatchjsonrequestbody)
implements sealed interface to store request body input | - -## SealedMediaType -public sealed interface SealedMediaType
-permits
-[ApplicationjsonpatchjsonMediaType](#applicationjsonpatchjsonmediatype) - -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), Nothing?> - -class storing schema info for a specific contentType - -### Constructor Summary -| Constructor and Description | -| --------------------------- | -| ApplicationjsonpatchjsonMediaType()
Creates an instance | - -### 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 | -| Nothing? | encoding()
the encoding info | - -## FakejsonpatchPatchRequestBody1 -public static class FakejsonpatchPatchRequestBody1
- -a class that serializes SealedRequestBody request bodies - -### Constructor Summary -| Constructor and Description | -| --------------------------- | -| FakejsonpatchPatchRequestBody1()
Creates an instance | - -### Field Summary -| Modifier and Type | Field and Description | -| ----------------- | --------------------- | -| boolean | required = false
whether the request body is required | -| Map | content = Map.ofEntries(
    new AbstractMap.SimpleEntry<>("application/json-patch+json", new [ApplicationjsonpatchjsonMediaType](#applicationjsonpatchjsonmediatype)())
)
the contentType to schema info | - -### Method Summary -| Modifier and Type | Method and Description | -| ----------------- | ---------------------- | -| SerializedRequestBody | serialize([SealedRequestBody](#sealedrequestbody) requestBody)
called by endpoint when creating request body bytes | - -## SealedRequestBody -public sealed interface SealedRequestBody
-permits
-[ApplicationjsonpatchjsonRequestBody](#applicationjsonpatchjsonrequestbody) - -sealed interface that stores request contentType + validated schema data - -## ApplicationjsonpatchjsonRequestBody -public record ApplicationjsonpatchjsonRequestBody
-implements [SealedRequestBody](#sealedrequestbody),
-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 | - -### 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 | diff --git a/samples/client/petstore/kotlin/docs/paths/fakejsonpatch/patch/FakejsonpatchPatchResponses.md b/samples/client/petstore/kotlin/docs/paths/fakejsonpatch/patch/FakejsonpatchPatchResponses.md deleted file mode 100644 index 8f0e60d3c15..00000000000 --- a/samples/client/petstore/kotlin/docs/paths/fakejsonpatch/patch/FakejsonpatchPatchResponses.md +++ /dev/null @@ -1,29 +0,0 @@ -# FakejsonpatchPatchResponses - -public class FakejsonpatchPatchResponses - -A class that contains necessary responses classes -- a sealed interface, EndpointResponse, that stores endpoint responses -- records for each endpoint response - -## Nested Class Summary -| Modifier and Type | Class and Description | -| ----------------- | --------------------- | -| sealed interface | [EndpointResponse](#endpointresponse)
stores the endpoint responses | -| record | [EndpointFakejsonpatchPatchCode200Response](#endpointfakejsonpatchpatchcode200response)
the response for 200 | - -## EndpointResponse -public sealed interface EndpointResponse permits
-[EndpointFakejsonpatchPatchCode200Response](#endpointfakejsonpatchpatchcode200response) - -a sealed interface that stores endpoint responses - -## EndpointFakejsonpatchPatchCode200Response -public record EndpointFakejsonpatchPatchCode200Response( - HttpResponse response, - Nothing? body, - Nothing? headers -) implements EndpointResponse, ApiResponse
- -a class that stores an endpoint response - diff --git a/samples/client/petstore/kotlin/docs/paths/fakejsonpatch/patch/requestbody/content/applicationjsonpatchjson/ApplicationjsonpatchjsonSchema.md b/samples/client/petstore/kotlin/docs/paths/fakejsonpatch/patch/requestbody/content/applicationjsonpatchjson/ApplicationjsonpatchjsonSchema.md deleted file mode 100644 index c8f50418586..00000000000 --- a/samples/client/petstore/kotlin/docs/paths/fakejsonpatch/patch/requestbody/content/applicationjsonpatchjson/ApplicationjsonpatchjsonSchema.md +++ /dev/null @@ -1,19 +0,0 @@ -# ApplicationjsonpatchjsonSchema -public class ApplicationjsonpatchjsonSchema
-extends [JSONPatchRequest1](../../../../../../components/schemas/JSONPatchRequest.md#jsonpatchrequest) - -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 - -## Nested Class Summary -| Modifier and Type | Class and Description | -| ----------------- | ---------------------- | -| static class | [ApplicationjsonpatchjsonSchema.ApplicationjsonpatchjsonSchema1](#applicationjsonpatchjsonschema1)
schema class | - -## ApplicationjsonpatchjsonSchema1 -public static class ApplicationjsonpatchjsonSchema1
-extends [JSONPatchRequest.JSONPatchRequest1](../../../../../../components/schemas/JSONPatchRequest.md#jsonpatchrequest1) - -A schema class that validates payloads diff --git a/samples/client/petstore/kotlin/docs/paths/fakejsonpatch/patch/responses/FakejsonpatchPatchCode200Response.md b/samples/client/petstore/kotlin/docs/paths/fakejsonpatch/patch/responses/FakejsonpatchPatchCode200Response.md deleted file mode 100644 index 72f6aff6618..00000000000 --- a/samples/client/petstore/kotlin/docs/paths/fakejsonpatch/patch/responses/FakejsonpatchPatchCode200Response.md +++ /dev/null @@ -1,17 +0,0 @@ -# FakejsonpatchPatchCode200Response - -public class FakejsonpatchPatchCode200Response extends [SuccessDescriptionOnly](../../components/responses/SuccessDescriptionOnly.md) - -A class (extended from the $ref class) that contains necessary nested response classes -- a class that extends ResponseDeserializer and is used to deserialize responses - -## Nested Class Summary -| Modifier and Type | Class and Description | -| ----------------- | --------------------- | -| static class | [FakejsonpatchPatchCode200Response.FakejsonpatchPatchCode200Response1](#fakejsonpatchpatchcode200response1)
class that deserializes responses | - -## FakejsonpatchPatchCode200Response1 -public static class FakejsonpatchPatchCode200Response1 extends [SuccessDescriptionOnly1](../../components/responses/SuccessDescriptionOnly.md#successdescriptiononly1)
- -a class that deserializes responses, extended from the $ref class - diff --git a/samples/client/petstore/kotlin/docs/paths/fakejsonwithcharset/FakejsonwithcharsetPost.md b/samples/client/petstore/kotlin/docs/paths/fakejsonwithcharset/FakejsonwithcharsetPost.md deleted file mode 100644 index 9456e893032..00000000000 --- a/samples/client/petstore/kotlin/docs/paths/fakejsonwithcharset/FakejsonwithcharsetPost.md +++ /dev/null @@ -1,148 +0,0 @@ -# FakejsonwithcharsetPost - -public class FakejsonwithcharsetPost - -A class that contains necessary endpoint classes -- a class that calls the endpoint method using the http verb -- a class that calls the endpoint method using the operationId name -- class(es) to store the request inputs -- builder(s) to set the request input data - -## Nested Class Summary -| Modifier and Type | Class and Description | -| ----------------- | --------------------- | -| static class | [Post](#post)
The class that has a post method to call the endpoint | -| interface | [JsonWithCharsetOperation](#jsonwithcharsetoperation)
The interface that has a jsonWithCharset method to call the endpoint | -| static class | [PostRequest](#postrequest)
The request inputs class | -| static class | [PostRequestBuilder](#postrequestbuilder)
A builder for the request input class | - -## Post -public static class Post 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.FakejsonwithcharsetPostRequestBody; -import org.openapijsonschematools.client.paths.fakejsonwithcharset.post.requestbody.content.applicationjsoncharsetutf8.Applicationjsoncharsetutf8Schema; -import org.openapijsonschematools.client.RootServerInfo; -import org.openapijsonschematools.client.servers.RootServer0; -import org.openapijsonschematools.client.servers.RootServer1; -import org.openapijsonschematools.client.servers.RootServer2; -import org.openapijsonschematools.client.paths.fakejsonwithcharset.post.responses.FakejsonwithcharsetPostCode200Response; -import org.openapijsonschematools.client.servers.RootServerInfo; -import org.openapijsonschematools.client.paths.fakejsonwithcharset.FakejsonwithcharsetPost; -import org.openapijsonschematools.client.paths.fakejsonwithcharset.post.FakejsonwithcharsetPostResponses; - -import java.io.IOException; -import java.util.Arrays; -import java.util.List; -import java.util.Map; -import java.util.AbstractMap; - -// if you want to use a server that is not SERVER_0 pass it in here and change the ServerIndex input below -ApiConfiguration.ServerInfo serverInfo = new ApiConfiguration.ServerInfoBuilder() - .rootServerInfo( - new RootServerInfo.RootServerInfoBuilder() - .rootServer0(new RootServer0()) - .build() - ) - .build(); -ApiConfiguration.ServerIndexInfo serverIndexInfo = new ApiConfiguration.ServerIndexInfoBuilder() - .rootServerInfoServerIndex(RootServerInfo.ServerIndex.SERVER_0) - .build(); -Duration timeout = Duration.ofSeconds(1L); -Map> defaultHeaders = Map.of("User-Agent", List.of("OpenAPI-JSON-Schema-Generator/1.0.0/java")); -ApiConfiguration apiConfiguration = new ApiConfiguration( - serverInfo - serverIndexInfo, - timeout, - defaultHeaders -); -SchemaConfiguration schemaConfiguration = new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().build()); -FakejsonwithcharsetPost.Post apiClient = new FakejsonwithcharsetPost.Post(apiConfiguration, schemaConfiguration); - - -var request = new FakejsonwithcharsetPost.PostRequestBuilder().build(); - -FakejsonwithcharsetPostResponses.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; -} -FakejsonwithcharsetPostResponses.EndpointFakejsonwithcharsetPostCode200Response castResponse = (FakejsonwithcharsetPostResponses.EndpointFakejsonwithcharsetPostCode200Response) response; -FakejsonwithcharsetPostCode200Response.Applicationjsoncharsetutf8ResponseBody deserializedBody = (FakejsonwithcharsetPostCode200Response.Applicationjsoncharsetutf8ResponseBody) castResponse.body; -// handle deserialized body here -``` -### Constructor Summary -| Constructor and Description | -| --------------------------- | -| Post(ApiConfiguration apiConfiguration, SchemaConfiguration schemaConfiguration)
Creates an instance | - -### Method Summary -| Modifier and Type | Method and Description | -| ----------------- | ---------------------- | -| [FakejsonwithcharsetPostResponses.EndpointResponse](../../paths/fakejsonwithcharset/post/FakejsonwithcharsetPostResponses.md#endpointresponse) | post([PostRequest](#postrequest) request) | - -## JsonWithCharsetOperation -public interface JsonWithCharsetOperation
- -an interface that allows one to call the endpoint using a method named jsonWithCharset by the operationId - -### Method Summary -| Modifier and Type | Method and Description | -| ----------------- | ---------------------- | -| [FakejsonwithcharsetPostResponses.EndpointResponse](../../paths/fakejsonwithcharset/post/FakejsonwithcharsetPostResponses.md#endpointresponse) | jsonWithCharset([PostRequest](#postrequest) request) | - -## PostRequest -public static class PostRequest
- -a class that stores the final request inputs - -### Field Summary -| Modifier and Type | Field and Description | -| ----------------- | --------------------- | -| [FakejsonwithcharsetPostRequestBody.@Nullable SealedRequestBody](../../paths/fakejsonwithcharset/post/FakejsonwithcharsetPostRequestBody.md#sealedrequestbody) | requestBody
optional | -| [RootServerInfo.@Nullable ServerIndex](../../RootServerInfo.md#serverindex) | serverIndex
optional. Note: this will override the value in apiConfiguration | -| @Nullable Duration | timeout
optional. Note: this will override the value in apiConfiguration | - -## PostRequestBuilder -public static class PostRequestBuilder
- -a builder for request inputs - -### Constructor Summary -| Constructor and Description | -| --------------------------- | -| PostRequestBuilder()
Creates a builder that contains null for all parameters | - -### Method Summary -| Modifier and Type | Method and Description | -| ----------------- | ---------------------- | -| [PostRequest](#postrequest) | build()
Returns the request input used to call an endpoint method | -| [PostRequestBuilder](#postrequestbuilder) | requestBody([FakejsonwithcharsetPostRequestBody.SealedRequestBody](../../paths/fakejsonwithcharset/post/FakejsonwithcharsetPostRequestBody.md#sealedrequestbody) requestBody)
sets the optional property | -| [PostRequestBuilder](#postrequestbuilder) | serverIndex([RootServerInfo.ServerIndex](../../RootServerInfo.md#serverindex) serverIndex)
sets the optional property. Note: this will override the value in apiConfiguration | -| [PostRequestBuilder](#postrequestbuilder) | timeout(Duration timeout)
sets the optional property. Note: this will override the value in apiConfiguration | - -[[Back to top]](#top) [[Back to README]](../../../README.md) diff --git a/samples/client/petstore/kotlin/docs/paths/fakejsonwithcharset/post/FakejsonwithcharsetPostRequestBody.md b/samples/client/petstore/kotlin/docs/paths/fakejsonwithcharset/post/FakejsonwithcharsetPostRequestBody.md deleted file mode 100644 index 08b63448804..00000000000 --- a/samples/client/petstore/kotlin/docs/paths/fakejsonwithcharset/post/FakejsonwithcharsetPostRequestBody.md +++ /dev/null @@ -1,90 +0,0 @@ -# FakejsonwithcharsetPostRequestBody - -public class FakejsonwithcharsetPostRequestBody - -A class that contains necessary nested request body classes -- SealedMediaType, a sealed interface which contains all the schema/encoding info for each contentType -- records which implement SealedMediaType, the concrete media types -- a class that extends RequestBodySerializer and is used to serialize input SealedRequestBody instances -- SealedRequestBody, a sealed interface which contains all the contentType/schema input types -- records which implement SealedRequestBody, the concrete request body types - -## Nested Class Summary -| Modifier and Type | Class and Description | -| ----------------- | --------------------- | -| sealed interface | [FakejsonwithcharsetPostRequestBody.SealedMediaType](#sealedmediatype)
media type sealed interface | -| record | [FakejsonwithcharsetPostRequestBody.Applicationjsoncharsetutf8MediaType](#applicationjsoncharsetutf8mediatype)
record storing schema + encoding for a specific contentType | -| static class | [FakejsonwithcharsetPostRequestBody.FakejsonwithcharsetPostRequestBody1](#fakejsonwithcharsetpostrequestbody1)
class that serializes request bodies | -| sealed interface | [FakejsonwithcharsetPostRequestBody.SealedRequestBody](#sealedrequestbody)
request body sealed interface | -| record | [FakejsonwithcharsetPostRequestBody.Applicationjsoncharsetutf8RequestBody](#applicationjsoncharsetutf8requestbody)
implements sealed interface to store request body input | - -## SealedMediaType -public sealed interface SealedMediaType
-permits
-[Applicationjsoncharsetutf8MediaType](#applicationjsoncharsetutf8mediatype) - -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), Nothing?> - -class storing schema info for a specific contentType - -### Constructor Summary -| Constructor and Description | -| --------------------------- | -| Applicationjsoncharsetutf8MediaType()
Creates an instance | - -### 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 | -| Nothing? | encoding()
the encoding info | - -## FakejsonwithcharsetPostRequestBody1 -public static class FakejsonwithcharsetPostRequestBody1
- -a class that serializes SealedRequestBody request bodies - -### Constructor Summary -| Constructor and Description | -| --------------------------- | -| FakejsonwithcharsetPostRequestBody1()
Creates an instance | - -### Field Summary -| Modifier and Type | Field and Description | -| ----------------- | --------------------- | -| boolean | required = false
whether the request body is required | -| Map | content = Map.ofEntries(
    new AbstractMap.SimpleEntry<>("application/json; charset=utf-8", new [Applicationjsoncharsetutf8MediaType](#applicationjsoncharsetutf8mediatype)())
)
the contentType to schema info | - -### Method Summary -| Modifier and Type | Method and Description | -| ----------------- | ---------------------- | -| SerializedRequestBody | serialize([SealedRequestBody](#sealedrequestbody) requestBody)
called by endpoint when creating request body bytes | - -## SealedRequestBody -public sealed interface SealedRequestBody
-permits
-[Applicationjsoncharsetutf8RequestBody](#applicationjsoncharsetutf8requestbody) - -sealed interface that stores request contentType + validated schema data - -## Applicationjsoncharsetutf8RequestBody -public record Applicationjsoncharsetutf8RequestBody
-implements [SealedRequestBody](#sealedrequestbody),
-GenericRequestBody
- -A record class to store request body input for contentType="application/json; charset=utf-8" - -### Constructor Summary -| Constructor and Description | -| --------------------------- | -| Applicationjsoncharsetutf8RequestBody(Applicationjsoncharsetutf8Schema.AnyTypeJsonSchema1Boxed body)
Creates an instance | - -### Method Summary -| Modifier and Type | Method and Description | -| ----------------- | ---------------------- | -| String | contentType()
always returns "application/json; charset=utf-8" | -| Applicationjsoncharsetutf8Schema.AnyTypeJsonSchema1Boxed | body()
returns the body passed in in the constructor | diff --git a/samples/client/petstore/kotlin/docs/paths/fakejsonwithcharset/post/FakejsonwithcharsetPostResponses.md b/samples/client/petstore/kotlin/docs/paths/fakejsonwithcharset/post/FakejsonwithcharsetPostResponses.md deleted file mode 100644 index 51564a92e48..00000000000 --- a/samples/client/petstore/kotlin/docs/paths/fakejsonwithcharset/post/FakejsonwithcharsetPostResponses.md +++ /dev/null @@ -1,29 +0,0 @@ -# FakejsonwithcharsetPostResponses - -public class FakejsonwithcharsetPostResponses - -A class that contains necessary responses classes -- a sealed interface, EndpointResponse, that stores endpoint responses -- records for each endpoint response - -## Nested Class Summary -| Modifier and Type | Class and Description | -| ----------------- | --------------------- | -| sealed interface | [EndpointResponse](#endpointresponse)
stores the endpoint responses | -| record | [EndpointFakejsonwithcharsetPostCode200Response](#endpointfakejsonwithcharsetpostcode200response)
the response for 200 | - -## EndpointResponse -public sealed interface EndpointResponse permits
-[EndpointFakejsonwithcharsetPostCode200Response](#endpointfakejsonwithcharsetpostcode200response) - -a sealed interface that stores endpoint responses - -## EndpointFakejsonwithcharsetPostCode200Response -public record EndpointFakejsonwithcharsetPostCode200Response( - HttpResponse response, - [FakejsonwithcharsetPostCode200Response.SealedResponseBody](../../../paths/fakejsonwithcharset/post/responses/FakejsonwithcharsetPostCode200Response.md#sealedresponsebody) body, - Nothing? headers -) implements EndpointResponse, ApiResponse
- -a class that stores an endpoint response - diff --git a/samples/client/petstore/kotlin/docs/paths/fakejsonwithcharset/post/requestbody/content/applicationjsoncharsetutf8/Applicationjsoncharsetutf8Schema.md b/samples/client/petstore/kotlin/docs/paths/fakejsonwithcharset/post/requestbody/content/applicationjsoncharsetutf8/Applicationjsoncharsetutf8Schema.md deleted file mode 100644 index 4f06773c467..00000000000 --- a/samples/client/petstore/kotlin/docs/paths/fakejsonwithcharset/post/requestbody/content/applicationjsoncharsetutf8/Applicationjsoncharsetutf8Schema.md +++ /dev/null @@ -1,144 +0,0 @@ -# Applicationjsoncharsetutf8Schema -public class Applicationjsoncharsetutf8Schema
- -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 - -## Nested Class Summary -| Modifier and Type | Class and Description | -| ----------------- | ---------------------- | -| sealed interface | [Applicationjsoncharsetutf8Schema.Applicationjsoncharsetutf8Schema1Boxed](#applicationjsoncharsetutf8schema1boxed)
sealed interface for validated payloads | -| record | [Applicationjsoncharsetutf8Schema.Applicationjsoncharsetutf8Schema1BoxedVoid](#applicationjsoncharsetutf8schema1boxedvoid)
boxed class to store validated null payloads | -| record | [Applicationjsoncharsetutf8Schema.Applicationjsoncharsetutf8Schema1BoxedBoolean](#applicationjsoncharsetutf8schema1boxedboolean)
boxed class to store validated boolean payloads | -| record | [Applicationjsoncharsetutf8Schema.Applicationjsoncharsetutf8Schema1BoxedNumber](#applicationjsoncharsetutf8schema1boxednumber)
boxed class to store validated Number payloads | -| record | [Applicationjsoncharsetutf8Schema.Applicationjsoncharsetutf8Schema1BoxedString](#applicationjsoncharsetutf8schema1boxedstring)
boxed class to store validated String payloads | -| record | [Applicationjsoncharsetutf8Schema.Applicationjsoncharsetutf8Schema1BoxedList](#applicationjsoncharsetutf8schema1boxedlist)
boxed class to store validated List payloads | -| record | [Applicationjsoncharsetutf8Schema.Applicationjsoncharsetutf8Schema1BoxedMap](#applicationjsoncharsetutf8schema1boxedmap)
boxed class to store validated Map payloads | -| static class | [Applicationjsoncharsetutf8Schema.Applicationjsoncharsetutf8Schema1](#applicationjsoncharsetutf8schema1)
schema class | - -## Applicationjsoncharsetutf8Schema1Boxed -public sealed interface Applicationjsoncharsetutf8Schema1Boxed
-permits
-[Applicationjsoncharsetutf8Schema1BoxedVoid](#applicationjsoncharsetutf8schema1boxedvoid), -[Applicationjsoncharsetutf8Schema1BoxedBoolean](#applicationjsoncharsetutf8schema1boxedboolean), -[Applicationjsoncharsetutf8Schema1BoxedNumber](#applicationjsoncharsetutf8schema1boxednumber), -[Applicationjsoncharsetutf8Schema1BoxedString](#applicationjsoncharsetutf8schema1boxedstring), -[Applicationjsoncharsetutf8Schema1BoxedList](#applicationjsoncharsetutf8schema1boxedlist), -[Applicationjsoncharsetutf8Schema1BoxedMap](#applicationjsoncharsetutf8schema1boxedmap) - -sealed interface that stores validated payloads using boxed classes - -## Applicationjsoncharsetutf8Schema1BoxedVoid -public record Applicationjsoncharsetutf8Schema1BoxedVoid
-implements [Applicationjsoncharsetutf8Schema1Boxed](#applicationjsoncharsetutf8schema1boxed) - -record that stores validated null payloads, sealed permits implementation - -### Constructor Summary -| Constructor and Description | -| --------------------------- | -| Applicationjsoncharsetutf8Schema1BoxedVoid(Nothing? data)
Creates an instance, private visibility | - -### Method Summary -| Modifier and Type | Method and Description | -| ----------------- | ---------------------- | -| Nothing? | data()
validated payload | -| @Nullable Object | getData()
validated payload | - -## Applicationjsoncharsetutf8Schema1BoxedBoolean -public record Applicationjsoncharsetutf8Schema1BoxedBoolean
-implements [Applicationjsoncharsetutf8Schema1Boxed](#applicationjsoncharsetutf8schema1boxed) - -record that stores validated boolean payloads, sealed permits implementation - -### Constructor Summary -| Constructor and Description | -| --------------------------- | -| Applicationjsoncharsetutf8Schema1BoxedBoolean(boolean data)
Creates an instance, private visibility | - -### Method Summary -| Modifier and Type | Method and Description | -| ----------------- | ---------------------- | -| boolean | data()
validated payload | -| @Nullable Object | getData()
validated payload | - -## Applicationjsoncharsetutf8Schema1BoxedNumber -public record Applicationjsoncharsetutf8Schema1BoxedNumber
-implements [Applicationjsoncharsetutf8Schema1Boxed](#applicationjsoncharsetutf8schema1boxed) - -record that stores validated Number payloads, sealed permits implementation - -### Constructor Summary -| Constructor and Description | -| --------------------------- | -| Applicationjsoncharsetutf8Schema1BoxedNumber(Number data)
Creates an instance, private visibility | - -### Method Summary -| Modifier and Type | Method and Description | -| ----------------- | ---------------------- | -| Number | data()
validated payload | -| @Nullable Object | getData()
validated payload | - -## Applicationjsoncharsetutf8Schema1BoxedString -public record Applicationjsoncharsetutf8Schema1BoxedString
-implements [Applicationjsoncharsetutf8Schema1Boxed](#applicationjsoncharsetutf8schema1boxed) - -record that stores validated String payloads, sealed permits implementation - -### Constructor Summary -| Constructor and Description | -| --------------------------- | -| Applicationjsoncharsetutf8Schema1BoxedString(String data)
Creates an instance, private visibility | - -### Method Summary -| Modifier and Type | Method and Description | -| ----------------- | ---------------------- | -| String | data()
validated payload | -| @Nullable Object | getData()
validated payload | - -## Applicationjsoncharsetutf8Schema1BoxedList -public record Applicationjsoncharsetutf8Schema1BoxedList
-implements [Applicationjsoncharsetutf8Schema1Boxed](#applicationjsoncharsetutf8schema1boxed) - -record that stores validated List payloads, sealed permits implementation - -### Constructor Summary -| Constructor and Description | -| --------------------------- | -| Applicationjsoncharsetutf8Schema1BoxedList(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 | - -## Applicationjsoncharsetutf8Schema1BoxedMap -public record Applicationjsoncharsetutf8Schema1BoxedMap
-implements [Applicationjsoncharsetutf8Schema1Boxed](#applicationjsoncharsetutf8schema1boxed) - -record that stores validated Map payloads, sealed permits implementation - -### Constructor Summary -| Constructor and Description | -| --------------------------- | -| Applicationjsoncharsetutf8Schema1BoxedMap(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 | - -## Applicationjsoncharsetutf8Schema1 -public static class Applicationjsoncharsetutf8Schema1
-extends AnyTypeJsonSchema.AnyTypeJsonSchema1 - -A schema class that validates payloads - -| Methods Inherited from class org.openapijsonschematools.client.schemas.AnyTypeJsonSchema.AnyTypeJsonSchema1 | -| ------------------------------------------------------------------ | -| validate | -| validateAndBox | diff --git a/samples/client/petstore/kotlin/docs/paths/fakejsonwithcharset/post/responses/FakejsonwithcharsetPostCode200Response.md b/samples/client/petstore/kotlin/docs/paths/fakejsonwithcharset/post/responses/FakejsonwithcharsetPostCode200Response.md deleted file mode 100644 index 8f0eae05795..00000000000 --- a/samples/client/petstore/kotlin/docs/paths/fakejsonwithcharset/post/responses/FakejsonwithcharsetPostCode200Response.md +++ /dev/null @@ -1,87 +0,0 @@ -# FakejsonwithcharsetPostCode200Response - -public class FakejsonwithcharsetPostCode200Response - -A class that contains necessary nested response classes -- SealedMediaType, a sealed interface which contains all the schema/encoding info for each contentType -- records which implement SealedMediaType, the concrete media types -- SealedResponseBody, a sealed interface which contains all the contentType/schema types -- records which implement SealedResponseBody, the concrete response body types -- a class that extends ResponseDeserializer and is used to deserialize responses - -## Nested Class Summary -| Modifier and Type | Class and Description | -| ----------------- | --------------------- | -| sealed interface | [FakejsonwithcharsetPostCode200Response.SealedMediaType](#sealedmediatype)
media type sealed interface | -| record | [FakejsonwithcharsetPostCode200Response.Applicationjsoncharsetutf8MediaType](#applicationjsoncharsetutf8mediatype)
record storing schema + encoding for a specific contentType | -| sealed interface | [FakejsonwithcharsetPostCode200Response.SealedResponseBody](#sealedresponsebody)
response body sealed interface | -| record | [FakejsonwithcharsetPostCode200Response.Applicationjsoncharsetutf8ResponseBody](#applicationjsoncharsetutf8responsebody)
implements sealed interface to store response body | -| static class | [FakejsonwithcharsetPostCode200Response.FakejsonwithcharsetPostCode200Response1](#fakejsonwithcharsetpostcode200response1)
class that deserializes responses | - -## SealedMediaType -public sealed interface SealedMediaType
-permits
-[Applicationjsoncharsetutf8MediaType](#applicationjsoncharsetutf8mediatype) - -sealed interface that stores schema and encoding info - -## Applicationjsoncharsetutf8MediaType -public record Applicationjsoncharsetutf8MediaType
-implements [SealedMediaType](#sealedmediatype), MediaType<[Applicationjsoncharsetutf8Schema.Applicationjsoncharsetutf8Schema1](../../../../paths/fakejsonwithcharset/post/responses/code200response/content/applicationjsoncharsetutf8/Applicationjsoncharsetutf8Schema.md#applicationjsoncharsetutf8schema1), Nothing?> - -class storing schema info for a specific contentType - -### Constructor Summary -| Constructor and Description | -| --------------------------- | -| Applicationjsoncharsetutf8MediaType()
Creates an instance | - -### Method Summary -| Modifier and Type | Method and Description | -| ----------------- | ---------------------- | -| [Applicationjsoncharsetutf8Schema.Applicationjsoncharsetutf8Schema1](../../../../paths/fakejsonwithcharset/post/responses/code200response/content/applicationjsoncharsetutf8/Applicationjsoncharsetutf8Schema.md#applicationjsoncharsetutf8schema1) | schema()
the schema for this MediaType | -| Nothing? | encoding()
the encoding info | - -## SealedResponseBody -public sealed interface SealedResponseBody
-permits
-[Applicationjsoncharsetutf8ResponseBody](#applicationjsoncharsetutf8responsebody) - -sealed interface that stores response body - -## Applicationjsoncharsetutf8ResponseBody -public record Applicationjsoncharsetutf8ResponseBody
-implements [SealedResponseBody](#sealedresponsebody) - -A record class to store response body for contentType="application/json; charset=utf-8" - -### Constructor Summary -| Constructor and Description | -| --------------------------- | -| Applicationjsoncharsetutf8ResponseBody(Applicationjsoncharsetutf8Schema.AnyTypeJsonSchema1Boxed body)
Creates an instance | - -### Method Summary -| Modifier and Type | Method and Description | -| ----------------- | ---------------------- | -| Applicationjsoncharsetutf8Schema.AnyTypeJsonSchema1Boxed | body()
returns the body passed in in the constructor | - -## FakejsonwithcharsetPostCode200Response1 -public static class FakejsonwithcharsetPostCode200Response1
-extends ResponseDeserializer<[SealedResponseBody](#sealedresponsebody), Nothing?, [SealedMediaType](#sealedmediatype)> - -a class that deserializes responses - -### Constructor Summary -| Constructor and Description | -| --------------------------- | -| FakejsonwithcharsetPostCode200Response1()
Creates an instance | - -### Field Summary -| Modifier and Type | Field and Description | -| ----------------- | --------------------- | -| Map | content = Map.ofEntries(
    new AbstractMap.SimpleEntry<>("application/json; charset=utf-8", new [Applicationjsoncharsetutf8MediaType](#applicationjsoncharsetutf8mediatype)())
)
the contentType to schema info | - -### Method Summary -| Modifier and Type | Method and Description | -| ----------------- | ---------------------- | -| ApiResponse<[SealedResponseBody](#sealedresponsebody), Nothing?> | deserialize(HttpResponse response, SchemaConfiguration configuration)
called by endpoint when deserialize responses | diff --git a/samples/client/petstore/kotlin/docs/paths/fakejsonwithcharset/post/responses/code200response/content/applicationjsoncharsetutf8/Applicationjsoncharsetutf8Schema.md b/samples/client/petstore/kotlin/docs/paths/fakejsonwithcharset/post/responses/code200response/content/applicationjsoncharsetutf8/Applicationjsoncharsetutf8Schema.md deleted file mode 100644 index 4f06773c467..00000000000 --- a/samples/client/petstore/kotlin/docs/paths/fakejsonwithcharset/post/responses/code200response/content/applicationjsoncharsetutf8/Applicationjsoncharsetutf8Schema.md +++ /dev/null @@ -1,144 +0,0 @@ -# Applicationjsoncharsetutf8Schema -public class Applicationjsoncharsetutf8Schema
- -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 - -## Nested Class Summary -| Modifier and Type | Class and Description | -| ----------------- | ---------------------- | -| sealed interface | [Applicationjsoncharsetutf8Schema.Applicationjsoncharsetutf8Schema1Boxed](#applicationjsoncharsetutf8schema1boxed)
sealed interface for validated payloads | -| record | [Applicationjsoncharsetutf8Schema.Applicationjsoncharsetutf8Schema1BoxedVoid](#applicationjsoncharsetutf8schema1boxedvoid)
boxed class to store validated null payloads | -| record | [Applicationjsoncharsetutf8Schema.Applicationjsoncharsetutf8Schema1BoxedBoolean](#applicationjsoncharsetutf8schema1boxedboolean)
boxed class to store validated boolean payloads | -| record | [Applicationjsoncharsetutf8Schema.Applicationjsoncharsetutf8Schema1BoxedNumber](#applicationjsoncharsetutf8schema1boxednumber)
boxed class to store validated Number payloads | -| record | [Applicationjsoncharsetutf8Schema.Applicationjsoncharsetutf8Schema1BoxedString](#applicationjsoncharsetutf8schema1boxedstring)
boxed class to store validated String payloads | -| record | [Applicationjsoncharsetutf8Schema.Applicationjsoncharsetutf8Schema1BoxedList](#applicationjsoncharsetutf8schema1boxedlist)
boxed class to store validated List payloads | -| record | [Applicationjsoncharsetutf8Schema.Applicationjsoncharsetutf8Schema1BoxedMap](#applicationjsoncharsetutf8schema1boxedmap)
boxed class to store validated Map payloads | -| static class | [Applicationjsoncharsetutf8Schema.Applicationjsoncharsetutf8Schema1](#applicationjsoncharsetutf8schema1)
schema class | - -## Applicationjsoncharsetutf8Schema1Boxed -public sealed interface Applicationjsoncharsetutf8Schema1Boxed
-permits
-[Applicationjsoncharsetutf8Schema1BoxedVoid](#applicationjsoncharsetutf8schema1boxedvoid), -[Applicationjsoncharsetutf8Schema1BoxedBoolean](#applicationjsoncharsetutf8schema1boxedboolean), -[Applicationjsoncharsetutf8Schema1BoxedNumber](#applicationjsoncharsetutf8schema1boxednumber), -[Applicationjsoncharsetutf8Schema1BoxedString](#applicationjsoncharsetutf8schema1boxedstring), -[Applicationjsoncharsetutf8Schema1BoxedList](#applicationjsoncharsetutf8schema1boxedlist), -[Applicationjsoncharsetutf8Schema1BoxedMap](#applicationjsoncharsetutf8schema1boxedmap) - -sealed interface that stores validated payloads using boxed classes - -## Applicationjsoncharsetutf8Schema1BoxedVoid -public record Applicationjsoncharsetutf8Schema1BoxedVoid
-implements [Applicationjsoncharsetutf8Schema1Boxed](#applicationjsoncharsetutf8schema1boxed) - -record that stores validated null payloads, sealed permits implementation - -### Constructor Summary -| Constructor and Description | -| --------------------------- | -| Applicationjsoncharsetutf8Schema1BoxedVoid(Nothing? data)
Creates an instance, private visibility | - -### Method Summary -| Modifier and Type | Method and Description | -| ----------------- | ---------------------- | -| Nothing? | data()
validated payload | -| @Nullable Object | getData()
validated payload | - -## Applicationjsoncharsetutf8Schema1BoxedBoolean -public record Applicationjsoncharsetutf8Schema1BoxedBoolean
-implements [Applicationjsoncharsetutf8Schema1Boxed](#applicationjsoncharsetutf8schema1boxed) - -record that stores validated boolean payloads, sealed permits implementation - -### Constructor Summary -| Constructor and Description | -| --------------------------- | -| Applicationjsoncharsetutf8Schema1BoxedBoolean(boolean data)
Creates an instance, private visibility | - -### Method Summary -| Modifier and Type | Method and Description | -| ----------------- | ---------------------- | -| boolean | data()
validated payload | -| @Nullable Object | getData()
validated payload | - -## Applicationjsoncharsetutf8Schema1BoxedNumber -public record Applicationjsoncharsetutf8Schema1BoxedNumber
-implements [Applicationjsoncharsetutf8Schema1Boxed](#applicationjsoncharsetutf8schema1boxed) - -record that stores validated Number payloads, sealed permits implementation - -### Constructor Summary -| Constructor and Description | -| --------------------------- | -| Applicationjsoncharsetutf8Schema1BoxedNumber(Number data)
Creates an instance, private visibility | - -### Method Summary -| Modifier and Type | Method and Description | -| ----------------- | ---------------------- | -| Number | data()
validated payload | -| @Nullable Object | getData()
validated payload | - -## Applicationjsoncharsetutf8Schema1BoxedString -public record Applicationjsoncharsetutf8Schema1BoxedString
-implements [Applicationjsoncharsetutf8Schema1Boxed](#applicationjsoncharsetutf8schema1boxed) - -record that stores validated String payloads, sealed permits implementation - -### Constructor Summary -| Constructor and Description | -| --------------------------- | -| Applicationjsoncharsetutf8Schema1BoxedString(String data)
Creates an instance, private visibility | - -### Method Summary -| Modifier and Type | Method and Description | -| ----------------- | ---------------------- | -| String | data()
validated payload | -| @Nullable Object | getData()
validated payload | - -## Applicationjsoncharsetutf8Schema1BoxedList -public record Applicationjsoncharsetutf8Schema1BoxedList
-implements [Applicationjsoncharsetutf8Schema1Boxed](#applicationjsoncharsetutf8schema1boxed) - -record that stores validated List payloads, sealed permits implementation - -### Constructor Summary -| Constructor and Description | -| --------------------------- | -| Applicationjsoncharsetutf8Schema1BoxedList(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 | - -## Applicationjsoncharsetutf8Schema1BoxedMap -public record Applicationjsoncharsetutf8Schema1BoxedMap
-implements [Applicationjsoncharsetutf8Schema1Boxed](#applicationjsoncharsetutf8schema1boxed) - -record that stores validated Map payloads, sealed permits implementation - -### Constructor Summary -| Constructor and Description | -| --------------------------- | -| Applicationjsoncharsetutf8Schema1BoxedMap(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 | - -## Applicationjsoncharsetutf8Schema1 -public static class Applicationjsoncharsetutf8Schema1
-extends AnyTypeJsonSchema.AnyTypeJsonSchema1 - -A schema class that validates payloads - -| Methods Inherited from class org.openapijsonschematools.client.schemas.AnyTypeJsonSchema.AnyTypeJsonSchema1 | -| ------------------------------------------------------------------ | -| validate | -| validateAndBox | diff --git a/samples/client/petstore/kotlin/docs/paths/fakemultiplerequestbodycontenttypes/FakemultiplerequestbodycontenttypesPost.md b/samples/client/petstore/kotlin/docs/paths/fakemultiplerequestbodycontenttypes/FakemultiplerequestbodycontenttypesPost.md deleted file mode 100644 index a4581c24d6e..00000000000 --- a/samples/client/petstore/kotlin/docs/paths/fakemultiplerequestbodycontenttypes/FakemultiplerequestbodycontenttypesPost.md +++ /dev/null @@ -1,148 +0,0 @@ -# FakemultiplerequestbodycontenttypesPost - -public class FakemultiplerequestbodycontenttypesPost - -A class that contains necessary endpoint classes -- a class that calls the endpoint method using the http verb -- a class that calls the endpoint method using the operationId name -- class(es) to store the request inputs -- builder(s) to set the request input data - -## Nested Class Summary -| Modifier and Type | Class and Description | -| ----------------- | --------------------- | -| static class | [Post](#post)
The class that has a post method to call the endpoint | -| interface | [MultipleRequestBodyContentTypesOperation](#multiplerequestbodycontenttypesoperation)
The interface that has a multipleRequestBodyContentTypes method to call the endpoint | -| static class | [PostRequest](#postrequest)
The request inputs class | -| static class | [PostRequestBuilder](#postrequestbuilder)
A builder for the request input class | - -## Post -public static class Post 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.FakemultiplerequestbodycontenttypesPostRequestBody; -import org.openapijsonschematools.client.paths.fakemultiplerequestbodycontenttypes.post.requestbody.content.applicationjson.ApplicationjsonSchema; -import org.openapijsonschematools.client.RootServerInfo; -import org.openapijsonschematools.client.servers.RootServer0; -import org.openapijsonschematools.client.servers.RootServer1; -import org.openapijsonschematools.client.servers.RootServer2; -import org.openapijsonschematools.client.paths.fakemultiplerequestbodycontenttypes.post.responses.FakemultiplerequestbodycontenttypesPostCode200Response; -import org.openapijsonschematools.client.servers.RootServerInfo; -import org.openapijsonschematools.client.paths.fakemultiplerequestbodycontenttypes.FakemultiplerequestbodycontenttypesPost; -import org.openapijsonschematools.client.paths.fakemultiplerequestbodycontenttypes.post.FakemultiplerequestbodycontenttypesPostResponses; - -import java.io.IOException; -import java.util.Arrays; -import java.util.List; -import java.util.Map; -import java.util.AbstractMap; - -// if you want to use a server that is not SERVER_0 pass it in here and change the ServerIndex input below -ApiConfiguration.ServerInfo serverInfo = new ApiConfiguration.ServerInfoBuilder() - .rootServerInfo( - new RootServerInfo.RootServerInfoBuilder() - .rootServer0(new RootServer0()) - .build() - ) - .build(); -ApiConfiguration.ServerIndexInfo serverIndexInfo = new ApiConfiguration.ServerIndexInfoBuilder() - .rootServerInfoServerIndex(RootServerInfo.ServerIndex.SERVER_0) - .build(); -Duration timeout = Duration.ofSeconds(1L); -Map> defaultHeaders = Map.of("User-Agent", List.of("OpenAPI-JSON-Schema-Generator/1.0.0/java")); -ApiConfiguration apiConfiguration = new ApiConfiguration( - serverInfo - serverIndexInfo, - timeout, - defaultHeaders -); -SchemaConfiguration schemaConfiguration = new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().build()); -FakemultiplerequestbodycontenttypesPost.Post apiClient = new FakemultiplerequestbodycontenttypesPost.Post(apiConfiguration, schemaConfiguration); - - -var request = new FakemultiplerequestbodycontenttypesPost.PostRequestBuilder().build(); - -FakemultiplerequestbodycontenttypesPostResponses.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; -} -FakemultiplerequestbodycontenttypesPostResponses.EndpointFakemultiplerequestbodycontenttypesPostCode200Response castResponse = (FakemultiplerequestbodycontenttypesPostResponses.EndpointFakemultiplerequestbodycontenttypesPostCode200Response) response; -FakemultiplerequestbodycontenttypesPostCode200Response.ApplicationjsonResponseBody deserializedBody = (FakemultiplerequestbodycontenttypesPostCode200Response.ApplicationjsonResponseBody) castResponse.body; -// handle deserialized body here -``` -### Constructor Summary -| Constructor and Description | -| --------------------------- | -| Post(ApiConfiguration apiConfiguration, SchemaConfiguration schemaConfiguration)
Creates an instance | - -### Method Summary -| Modifier and Type | Method and Description | -| ----------------- | ---------------------- | -| [FakemultiplerequestbodycontenttypesPostResponses.EndpointResponse](../../paths/fakemultiplerequestbodycontenttypes/post/FakemultiplerequestbodycontenttypesPostResponses.md#endpointresponse) | post([PostRequest](#postrequest) request) | - -## MultipleRequestBodyContentTypesOperation -public interface MultipleRequestBodyContentTypesOperation
- -an interface that allows one to call the endpoint using a method named multipleRequestBodyContentTypes by the operationId - -### Method Summary -| Modifier and Type | Method and Description | -| ----------------- | ---------------------- | -| [FakemultiplerequestbodycontenttypesPostResponses.EndpointResponse](../../paths/fakemultiplerequestbodycontenttypes/post/FakemultiplerequestbodycontenttypesPostResponses.md#endpointresponse) | multipleRequestBodyContentTypes([PostRequest](#postrequest) request) | - -## PostRequest -public static class PostRequest
- -a class that stores the final request inputs - -### Field Summary -| Modifier and Type | Field and Description | -| ----------------- | --------------------- | -| [FakemultiplerequestbodycontenttypesPostRequestBody.@Nullable SealedRequestBody](../../paths/fakemultiplerequestbodycontenttypes/post/FakemultiplerequestbodycontenttypesPostRequestBody.md#sealedrequestbody) | requestBody
optional | -| [RootServerInfo.@Nullable ServerIndex](../../RootServerInfo.md#serverindex) | serverIndex
optional. Note: this will override the value in apiConfiguration | -| @Nullable Duration | timeout
optional. Note: this will override the value in apiConfiguration | - -## PostRequestBuilder -public static class PostRequestBuilder
- -a builder for request inputs - -### Constructor Summary -| Constructor and Description | -| --------------------------- | -| PostRequestBuilder()
Creates a builder that contains null for all parameters | - -### Method Summary -| Modifier and Type | Method and Description | -| ----------------- | ---------------------- | -| [PostRequest](#postrequest) | build()
Returns the request input used to call an endpoint method | -| [PostRequestBuilder](#postrequestbuilder) | requestBody([FakemultiplerequestbodycontenttypesPostRequestBody.SealedRequestBody](../../paths/fakemultiplerequestbodycontenttypes/post/FakemultiplerequestbodycontenttypesPostRequestBody.md#sealedrequestbody) requestBody)
sets the optional property | -| [PostRequestBuilder](#postrequestbuilder) | serverIndex([RootServerInfo.ServerIndex](../../RootServerInfo.md#serverindex) serverIndex)
sets the optional property. Note: this will override the value in apiConfiguration | -| [PostRequestBuilder](#postrequestbuilder) | timeout(Duration timeout)
sets the optional property. Note: this will override the value in apiConfiguration | - -[[Back to top]](#top) [[Back to README]](../../../README.md) diff --git a/samples/client/petstore/kotlin/docs/paths/fakemultiplerequestbodycontenttypes/post/FakemultiplerequestbodycontenttypesPostRequestBody.md b/samples/client/petstore/kotlin/docs/paths/fakemultiplerequestbodycontenttypes/post/FakemultiplerequestbodycontenttypesPostRequestBody.md deleted file mode 100644 index 34099d1a175..00000000000 --- a/samples/client/petstore/kotlin/docs/paths/fakemultiplerequestbodycontenttypes/post/FakemultiplerequestbodycontenttypesPostRequestBody.md +++ /dev/null @@ -1,128 +0,0 @@ -# FakemultiplerequestbodycontenttypesPostRequestBody - -public class FakemultiplerequestbodycontenttypesPostRequestBody - -A class that contains necessary nested request body classes -- SealedMediaType, a sealed interface which contains all the schema/encoding info for each contentType -- records which implement SealedMediaType, the concrete media types -- a class that extends RequestBodySerializer and is used to serialize input SealedRequestBody instances -- SealedRequestBody, a sealed interface which contains all the contentType/schema input types -- records which implement SealedRequestBody, the concrete request body types - -## Nested Class Summary -| Modifier and Type | Class and Description | -| ----------------- | --------------------- | -| sealed interface | [FakemultiplerequestbodycontenttypesPostRequestBody.SealedMediaType](#sealedmediatype)
media type sealed interface | -| record | [FakemultiplerequestbodycontenttypesPostRequestBody.ApplicationjsonMediaType](#applicationjsonmediatype)
record storing schema + encoding for a specific contentType | -| record | [FakemultiplerequestbodycontenttypesPostRequestBody.MultipartformdataMediaType](#multipartformdatamediatype)
record storing schema + encoding for a specific contentType | -| static class | [FakemultiplerequestbodycontenttypesPostRequestBody.FakemultiplerequestbodycontenttypesPostRequestBody1](#fakemultiplerequestbodycontenttypespostrequestbody1)
class that serializes request bodies | -| sealed interface | [FakemultiplerequestbodycontenttypesPostRequestBody.SealedRequestBody](#sealedrequestbody)
request body sealed interface | -| record | [FakemultiplerequestbodycontenttypesPostRequestBody.ApplicationjsonRequestBody](#applicationjsonrequestbody)
implements sealed interface to store request body input | -| record | [FakemultiplerequestbodycontenttypesPostRequestBody.MultipartformdataRequestBody](#multipartformdatarequestbody)
implements sealed interface to store request body input | - -## SealedMediaType -public sealed interface SealedMediaType
-permits
-[ApplicationjsonMediaType](#applicationjsonmediatype), -[MultipartformdataMediaType](#multipartformdatamediatype) - -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), Nothing?> - -class storing schema info for a specific contentType - -### Constructor Summary -| Constructor and Description | -| --------------------------- | -| ApplicationjsonMediaType()
Creates an instance | - -### 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 | -| Nothing? | encoding()
the encoding info | - -## MultipartformdataMediaType -public record MultipartformdataMediaType
-implements [SealedMediaType](#sealedmediatype), MediaType<[MultipartformdataSchema.MultipartformdataSchema1](../../../paths/fakemultiplerequestbodycontenttypes/post/requestbody/content/multipartformdata/MultipartformdataSchema.md#multipartformdataschema1), Nothing?> - -class storing schema info for a specific contentType - -### Constructor Summary -| Constructor and Description | -| --------------------------- | -| MultipartformdataMediaType()
Creates an instance | - -### 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 | -| Nothing? | encoding()
the encoding info | - -## FakemultiplerequestbodycontenttypesPostRequestBody1 -public static class FakemultiplerequestbodycontenttypesPostRequestBody1
- -a class that serializes SealedRequestBody request bodies - -### Constructor Summary -| Constructor and Description | -| --------------------------- | -| FakemultiplerequestbodycontenttypesPostRequestBody1()
Creates an instance | - -### Field Summary -| Modifier and Type | Field and Description | -| ----------------- | --------------------- | -| boolean | required = false
whether the request body is required | -| Map | content = Map.ofEntries(
    new AbstractMap.SimpleEntry<>("application/json", new [ApplicationjsonMediaType](#applicationjsonmediatype)()),
    new AbstractMap.SimpleEntry<>("multipart/form-data", new [MultipartformdataMediaType](#multipartformdatamediatype)())
)
the contentType to schema info | - -### Method Summary -| Modifier and Type | Method and Description | -| ----------------- | ---------------------- | -| SerializedRequestBody | serialize([SealedRequestBody](#sealedrequestbody) requestBody)
called by endpoint when creating request body bytes | - -## SealedRequestBody -public sealed interface SealedRequestBody
-permits
-[ApplicationjsonRequestBody](#applicationjsonrequestbody), -[MultipartformdataRequestBody](#multipartformdatarequestbody) - -sealed interface that stores request contentType + validated schema data - -## ApplicationjsonRequestBody -public record ApplicationjsonRequestBody
-implements [SealedRequestBody](#sealedrequestbody),
-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 | - -### 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 | -## MultipartformdataRequestBody -public record MultipartformdataRequestBody
-implements [SealedRequestBody](#sealedrequestbody),
-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 | - -### 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 | diff --git a/samples/client/petstore/kotlin/docs/paths/fakemultiplerequestbodycontenttypes/post/FakemultiplerequestbodycontenttypesPostResponses.md b/samples/client/petstore/kotlin/docs/paths/fakemultiplerequestbodycontenttypes/post/FakemultiplerequestbodycontenttypesPostResponses.md deleted file mode 100644 index 79a05e7c5fb..00000000000 --- a/samples/client/petstore/kotlin/docs/paths/fakemultiplerequestbodycontenttypes/post/FakemultiplerequestbodycontenttypesPostResponses.md +++ /dev/null @@ -1,29 +0,0 @@ -# FakemultiplerequestbodycontenttypesPostResponses - -public class FakemultiplerequestbodycontenttypesPostResponses - -A class that contains necessary responses classes -- a sealed interface, EndpointResponse, that stores endpoint responses -- records for each endpoint response - -## Nested Class Summary -| Modifier and Type | Class and Description | -| ----------------- | --------------------- | -| sealed interface | [EndpointResponse](#endpointresponse)
stores the endpoint responses | -| record | [EndpointFakemultiplerequestbodycontenttypesPostCode200Response](#endpointfakemultiplerequestbodycontenttypespostcode200response)
the response for 200 | - -## EndpointResponse -public sealed interface EndpointResponse permits
-[EndpointFakemultiplerequestbodycontenttypesPostCode200Response](#endpointfakemultiplerequestbodycontenttypespostcode200response) - -a sealed interface that stores endpoint responses - -## EndpointFakemultiplerequestbodycontenttypesPostCode200Response -public record EndpointFakemultiplerequestbodycontenttypesPostCode200Response( - HttpResponse response, - [FakemultiplerequestbodycontenttypesPostCode200Response.SealedResponseBody](../../../paths/fakemultiplerequestbodycontenttypes/post/responses/FakemultiplerequestbodycontenttypesPostCode200Response.md#sealedresponsebody) body, - Nothing? headers -) implements EndpointResponse, ApiResponse
- -a class that stores an endpoint response - diff --git a/samples/client/petstore/kotlin/docs/paths/fakemultiplerequestbodycontenttypes/post/requestbody/content/applicationjson/ApplicationjsonSchema.md b/samples/client/petstore/kotlin/docs/paths/fakemultiplerequestbodycontenttypes/post/requestbody/content/applicationjson/ApplicationjsonSchema.md deleted file mode 100644 index b9f5d512ebc..00000000000 --- a/samples/client/petstore/kotlin/docs/paths/fakemultiplerequestbodycontenttypes/post/requestbody/content/applicationjson/ApplicationjsonSchema.md +++ /dev/null @@ -1,166 +0,0 @@ -# ApplicationjsonSchema -public class ApplicationjsonSchema
- -A class that contains necessary nested -- schema classes (which validate payloads), extends JsonSchema -- sealed interfaces which store validated payloads, java version of a sum type -- boxed classes which store validated payloads, sealed permits class implementations -- classes to store validated map payloads, extends FrozenMap -- classes to build inputs for map payloads - -## Nested Class Summary -| Modifier and Type | Class and Description | -| ----------------- | ---------------------- | -| sealed interface | [ApplicationjsonSchema.ApplicationjsonSchema1Boxed](#applicationjsonschema1boxed)
sealed interface for validated payloads | -| record | [ApplicationjsonSchema.ApplicationjsonSchema1BoxedMap](#applicationjsonschema1boxedmap)
boxed class to store validated Map payloads | -| static class | [ApplicationjsonSchema.ApplicationjsonSchema1](#applicationjsonschema1)
schema class | -| static class | [ApplicationjsonSchema.ApplicationjsonSchemaMapBuilder](#applicationjsonschemamapbuilder)
builder for Map payloads | -| static class | [ApplicationjsonSchema.ApplicationjsonSchemaMap](#applicationjsonschemamap)
output class for Map payloads | -| sealed interface | [ApplicationjsonSchema.ApplicationjsonABoxed](#applicationjsonaboxed)
sealed interface for validated payloads | -| record | [ApplicationjsonSchema.ApplicationjsonABoxedString](#applicationjsonaboxedstring)
boxed class to store validated String payloads | -| static class | [ApplicationjsonSchema.ApplicationjsonA](#applicationjsona)
schema class | - -## ApplicationjsonSchema1Boxed -public sealed interface ApplicationjsonSchema1Boxed
-permits
-[ApplicationjsonSchema1BoxedMap](#applicationjsonschema1boxedmap) - -sealed interface that stores validated payloads using boxed classes - -## ApplicationjsonSchema1BoxedMap -public record ApplicationjsonSchema1BoxedMap
-implements [ApplicationjsonSchema1Boxed](#applicationjsonschema1boxed) - -record that stores validated Map payloads, sealed permits implementation - -### Constructor Summary -| Constructor and Description | -| --------------------------- | -| ApplicationjsonSchema1BoxedMap([ApplicationjsonSchemaMap](#applicationjsonschemamap) data)
Creates an instance, private visibility | - -### Method Summary -| Modifier and Type | Method and Description | -| ----------------- | ---------------------- | -| [ApplicationjsonSchemaMap](#applicationjsonschemamap) | data()
validated payload | -| @Nullable Object | getData()
validated payload | - -## ApplicationjsonSchema1 -public static class ApplicationjsonSchema1
-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.fakemultiplerequestbodycontenttypes.post.requestbody.content.applicationjson.ApplicationjsonSchema; - -import java.util.Arrays; -import java.util.List; -import java.util.AbstractMap; - -static final SchemaConfiguration configuration = new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().build()); - -// Map validation -ApplicationjsonSchema.ApplicationjsonSchemaMap validatedPayload = - ApplicationjsonSchema.ApplicationjsonSchema1.validate( - new ApplicationjsonSchema.ApplicationjsonSchemaMapBuilder() - .a("a") - - .build(), - configuration -); -``` - -### Field Summary -| Modifier and Type | Field and Description | -| ----------------- | ---------------------- | -| Set> | type = Set.of(Map.class) | -| Map> | properties = Map.ofEntries(
    new PropertyEntry("a", [ApplicationjsonA.class](#applicationjsona)))
)
| - -### Method Summary -| Modifier and Type | Method and Description | -| ----------------- | ---------------------- | -| [ApplicationjsonSchemaMap](#applicationjsonschemamap) | validate([Map<?, ?>](#applicationjsonschemamapbuilder) arg, SchemaConfiguration configuration) | -| [ApplicationjsonSchema1BoxedMap](#applicationjsonschema1boxedmap) | validateAndBox([Map<?, ?>](#applicationjsonschemamapbuilder) arg, SchemaConfiguration configuration) | -| [ApplicationjsonSchema1Boxed](#applicationjsonschema1boxed) | validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) | -| @Nullable Object | validate(@Nullable Object arg, SchemaConfiguration configuration) | - -## ApplicationjsonSchemaMapBuilder -public class ApplicationjsonSchemaMapBuilder
-builder for `Map` - -A class that builds the Map input type - -### Constructor Summary -| Constructor and Description | -| --------------------------- | -| ApplicationjsonSchemaMapBuilder()
Creates a builder that contains an empty map | - -### Method Summary -| Modifier and Type | Method and Description | -| ----------------- | ---------------------- | -| Map | build()
Returns map input that should be used with Schema.validate | -| [ApplicationjsonSchemaMapBuilder](#applicationjsonschemamapbuilder) | a(String value) | -| [ApplicationjsonSchemaMapBuilder](#applicationjsonschemamapbuilder) | additionalProperty(String key, Nothing? value) | -| [ApplicationjsonSchemaMapBuilder](#applicationjsonschemamapbuilder) | additionalProperty(String key, boolean value) | -| [ApplicationjsonSchemaMapBuilder](#applicationjsonschemamapbuilder) | additionalProperty(String key, String value) | -| [ApplicationjsonSchemaMapBuilder](#applicationjsonschemamapbuilder) | additionalProperty(String key, int value) | -| [ApplicationjsonSchemaMapBuilder](#applicationjsonschemamapbuilder) | additionalProperty(String key, float value) | -| [ApplicationjsonSchemaMapBuilder](#applicationjsonschemamapbuilder) | additionalProperty(String key, long value) | -| [ApplicationjsonSchemaMapBuilder](#applicationjsonschemamapbuilder) | additionalProperty(String key, double value) | -| [ApplicationjsonSchemaMapBuilder](#applicationjsonschemamapbuilder) | additionalProperty(String key, List value) | -| [ApplicationjsonSchemaMapBuilder](#applicationjsonschemamapbuilder) | additionalProperty(String key, Map value) | - -## ApplicationjsonSchemaMap -public static class ApplicationjsonSchemaMap
-extends FrozenMap - -A class to store validated Map payloads - -### Method Summary -| Modifier and Type | Method and Description | -| ----------------- | ---------------------- | -| static [ApplicationjsonSchemaMap](#applicationjsonschemamap) | of([Map](#applicationjsonschemamapbuilder) arg, SchemaConfiguration configuration) | -| String | a()
[optional] | -| @Nullable Object | getAdditionalProperty(String name)
provides type safety for additional properties | - -## ApplicationjsonABoxed -public sealed interface ApplicationjsonABoxed
-permits
-[ApplicationjsonABoxedString](#applicationjsonaboxedstring) - -sealed interface that stores validated payloads using boxed classes - -## ApplicationjsonABoxedString -public record ApplicationjsonABoxedString
-implements [ApplicationjsonABoxed](#applicationjsonaboxed) - -record that stores validated String payloads, sealed permits implementation - -### Constructor Summary -| Constructor and Description | -| --------------------------- | -| ApplicationjsonABoxedString(String data)
Creates an instance, private visibility | - -### Method Summary -| Modifier and Type | Method and Description | -| ----------------- | ---------------------- | -| String | data()
validated payload | -| @Nullable Object | getData()
validated payload | - -## ApplicationjsonA -public static class ApplicationjsonA
-extends StringJsonSchema.StringJsonSchema1 - -A schema class that validates payloads - -| Methods Inherited from class org.openapijsonschematools.client.schemas.StringJsonSchema.StringJsonSchema1 | -| ------------------------------------------------------------------ | -| validate | -| validateAndBox | diff --git a/samples/client/petstore/kotlin/docs/paths/fakemultiplerequestbodycontenttypes/post/requestbody/content/multipartformdata/MultipartformdataSchema.md b/samples/client/petstore/kotlin/docs/paths/fakemultiplerequestbodycontenttypes/post/requestbody/content/multipartformdata/MultipartformdataSchema.md deleted file mode 100644 index ab121c6df87..00000000000 --- a/samples/client/petstore/kotlin/docs/paths/fakemultiplerequestbodycontenttypes/post/requestbody/content/multipartformdata/MultipartformdataSchema.md +++ /dev/null @@ -1,166 +0,0 @@ -# MultipartformdataSchema -public class MultipartformdataSchema
- -A class that contains necessary nested -- schema classes (which validate payloads), extends JsonSchema -- sealed interfaces which store validated payloads, java version of a sum type -- boxed classes which store validated payloads, sealed permits class implementations -- classes to store validated map payloads, extends FrozenMap -- classes to build inputs for map payloads - -## Nested Class Summary -| Modifier and Type | Class and Description | -| ----------------- | ---------------------- | -| sealed interface | [MultipartformdataSchema.MultipartformdataSchema1Boxed](#multipartformdataschema1boxed)
sealed interface for validated payloads | -| record | [MultipartformdataSchema.MultipartformdataSchema1BoxedMap](#multipartformdataschema1boxedmap)
boxed class to store validated Map payloads | -| static class | [MultipartformdataSchema.MultipartformdataSchema1](#multipartformdataschema1)
schema class | -| static class | [MultipartformdataSchema.MultipartformdataSchemaMapBuilder](#multipartformdataschemamapbuilder)
builder for Map payloads | -| static class | [MultipartformdataSchema.MultipartformdataSchemaMap](#multipartformdataschemamap)
output class for Map payloads | -| sealed interface | [MultipartformdataSchema.MultipartformdataBBoxed](#multipartformdatabboxed)
sealed interface for validated payloads | -| record | [MultipartformdataSchema.MultipartformdataBBoxedString](#multipartformdatabboxedstring)
boxed class to store validated String payloads | -| static class | [MultipartformdataSchema.MultipartformdataB](#multipartformdatab)
schema class | - -## MultipartformdataSchema1Boxed -public sealed interface MultipartformdataSchema1Boxed
-permits
-[MultipartformdataSchema1BoxedMap](#multipartformdataschema1boxedmap) - -sealed interface that stores validated payloads using boxed classes - -## MultipartformdataSchema1BoxedMap -public record MultipartformdataSchema1BoxedMap
-implements [MultipartformdataSchema1Boxed](#multipartformdataschema1boxed) - -record that stores validated Map payloads, sealed permits implementation - -### Constructor Summary -| Constructor and Description | -| --------------------------- | -| MultipartformdataSchema1BoxedMap([MultipartformdataSchemaMap](#multipartformdataschemamap) data)
Creates an instance, private visibility | - -### Method Summary -| Modifier and Type | Method and Description | -| ----------------- | ---------------------- | -| [MultipartformdataSchemaMap](#multipartformdataschemamap) | data()
validated payload | -| @Nullable Object | getData()
validated payload | - -## MultipartformdataSchema1 -public static class MultipartformdataSchema1
-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.fakemultiplerequestbodycontenttypes.post.requestbody.content.multipartformdata.MultipartformdataSchema; - -import java.util.Arrays; -import java.util.List; -import java.util.AbstractMap; - -static final SchemaConfiguration configuration = new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().build()); - -// Map validation -MultipartformdataSchema.MultipartformdataSchemaMap validatedPayload = - MultipartformdataSchema.MultipartformdataSchema1.validate( - new MultipartformdataSchema.MultipartformdataSchemaMapBuilder() - .b("a") - - .build(), - configuration -); -``` - -### Field Summary -| Modifier and Type | Field and Description | -| ----------------- | ---------------------- | -| Set> | type = Set.of(Map.class) | -| Map> | properties = Map.ofEntries(
    new PropertyEntry("b", [MultipartformdataB.class](#multipartformdatab)))
)
| - -### Method Summary -| Modifier and Type | Method and Description | -| ----------------- | ---------------------- | -| [MultipartformdataSchemaMap](#multipartformdataschemamap) | validate([Map<?, ?>](#multipartformdataschemamapbuilder) arg, SchemaConfiguration configuration) | -| [MultipartformdataSchema1BoxedMap](#multipartformdataschema1boxedmap) | validateAndBox([Map<?, ?>](#multipartformdataschemamapbuilder) arg, SchemaConfiguration configuration) | -| [MultipartformdataSchema1Boxed](#multipartformdataschema1boxed) | validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) | -| @Nullable Object | validate(@Nullable Object arg, SchemaConfiguration configuration) | - -## MultipartformdataSchemaMapBuilder -public class MultipartformdataSchemaMapBuilder
-builder for `Map` - -A class that builds the Map input type - -### Constructor Summary -| Constructor and Description | -| --------------------------- | -| MultipartformdataSchemaMapBuilder()
Creates a builder that contains an empty map | - -### Method Summary -| Modifier and Type | Method and Description | -| ----------------- | ---------------------- | -| Map | build()
Returns map input that should be used with Schema.validate | -| [MultipartformdataSchemaMapBuilder](#multipartformdataschemamapbuilder) | b(String value) | -| [MultipartformdataSchemaMapBuilder](#multipartformdataschemamapbuilder) | additionalProperty(String key, Nothing? value) | -| [MultipartformdataSchemaMapBuilder](#multipartformdataschemamapbuilder) | additionalProperty(String key, boolean value) | -| [MultipartformdataSchemaMapBuilder](#multipartformdataschemamapbuilder) | additionalProperty(String key, String value) | -| [MultipartformdataSchemaMapBuilder](#multipartformdataschemamapbuilder) | additionalProperty(String key, int value) | -| [MultipartformdataSchemaMapBuilder](#multipartformdataschemamapbuilder) | additionalProperty(String key, float value) | -| [MultipartformdataSchemaMapBuilder](#multipartformdataschemamapbuilder) | additionalProperty(String key, long value) | -| [MultipartformdataSchemaMapBuilder](#multipartformdataschemamapbuilder) | additionalProperty(String key, double value) | -| [MultipartformdataSchemaMapBuilder](#multipartformdataschemamapbuilder) | additionalProperty(String key, List value) | -| [MultipartformdataSchemaMapBuilder](#multipartformdataschemamapbuilder) | additionalProperty(String key, Map value) | - -## MultipartformdataSchemaMap -public static class MultipartformdataSchemaMap
-extends FrozenMap - -A class to store validated Map payloads - -### Method Summary -| Modifier and Type | Method and Description | -| ----------------- | ---------------------- | -| static [MultipartformdataSchemaMap](#multipartformdataschemamap) | of([Map](#multipartformdataschemamapbuilder) arg, SchemaConfiguration configuration) | -| String | b()
[optional] | -| @Nullable Object | getAdditionalProperty(String name)
provides type safety for additional properties | - -## MultipartformdataBBoxed -public sealed interface MultipartformdataBBoxed
-permits
-[MultipartformdataBBoxedString](#multipartformdatabboxedstring) - -sealed interface that stores validated payloads using boxed classes - -## MultipartformdataBBoxedString -public record MultipartformdataBBoxedString
-implements [MultipartformdataBBoxed](#multipartformdatabboxed) - -record that stores validated String payloads, sealed permits implementation - -### Constructor Summary -| Constructor and Description | -| --------------------------- | -| MultipartformdataBBoxedString(String data)
Creates an instance, private visibility | - -### Method Summary -| Modifier and Type | Method and Description | -| ----------------- | ---------------------- | -| String | data()
validated payload | -| @Nullable Object | getData()
validated payload | - -## MultipartformdataB -public static class MultipartformdataB
-extends StringJsonSchema.StringJsonSchema1 - -A schema class that validates payloads - -| Methods Inherited from class org.openapijsonschematools.client.schemas.StringJsonSchema.StringJsonSchema1 | -| ------------------------------------------------------------------ | -| validate | -| validateAndBox | diff --git a/samples/client/petstore/kotlin/docs/paths/fakemultiplerequestbodycontenttypes/post/responses/FakemultiplerequestbodycontenttypesPostCode200Response.md b/samples/client/petstore/kotlin/docs/paths/fakemultiplerequestbodycontenttypes/post/responses/FakemultiplerequestbodycontenttypesPostCode200Response.md deleted file mode 100644 index 73038b6c3c7..00000000000 --- a/samples/client/petstore/kotlin/docs/paths/fakemultiplerequestbodycontenttypes/post/responses/FakemultiplerequestbodycontenttypesPostCode200Response.md +++ /dev/null @@ -1,87 +0,0 @@ -# FakemultiplerequestbodycontenttypesPostCode200Response - -public class FakemultiplerequestbodycontenttypesPostCode200Response - -A class that contains necessary nested response classes -- SealedMediaType, a sealed interface which contains all the schema/encoding info for each contentType -- records which implement SealedMediaType, the concrete media types -- SealedResponseBody, a sealed interface which contains all the contentType/schema types -- records which implement SealedResponseBody, the concrete response body types -- a class that extends ResponseDeserializer and is used to deserialize responses - -## Nested Class Summary -| Modifier and Type | Class and Description | -| ----------------- | --------------------- | -| sealed interface | [FakemultiplerequestbodycontenttypesPostCode200Response.SealedMediaType](#sealedmediatype)
media type sealed interface | -| record | [FakemultiplerequestbodycontenttypesPostCode200Response.ApplicationjsonMediaType](#applicationjsonmediatype)
record storing schema + encoding for a specific contentType | -| sealed interface | [FakemultiplerequestbodycontenttypesPostCode200Response.SealedResponseBody](#sealedresponsebody)
response body sealed interface | -| record | [FakemultiplerequestbodycontenttypesPostCode200Response.ApplicationjsonResponseBody](#applicationjsonresponsebody)
implements sealed interface to store response body | -| static class | [FakemultiplerequestbodycontenttypesPostCode200Response.FakemultiplerequestbodycontenttypesPostCode200Response1](#fakemultiplerequestbodycontenttypespostcode200response1)
class that deserializes responses | - -## SealedMediaType -public sealed interface SealedMediaType
-permits
-[ApplicationjsonMediaType](#applicationjsonmediatype) - -sealed interface that stores schema and encoding info - -## ApplicationjsonMediaType -public record ApplicationjsonMediaType
-implements [SealedMediaType](#sealedmediatype), MediaType<[ApplicationjsonSchema.ApplicationjsonSchema1](../../../../paths/fakemultiplerequestbodycontenttypes/post/responses/code200response/content/applicationjson/ApplicationjsonSchema.md#applicationjsonschema1), Nothing?> - -class storing schema info for a specific contentType - -### Constructor Summary -| Constructor and Description | -| --------------------------- | -| ApplicationjsonMediaType()
Creates an instance | - -### Method Summary -| Modifier and Type | Method and Description | -| ----------------- | ---------------------- | -| [ApplicationjsonSchema.ApplicationjsonSchema1](../../../../paths/fakemultiplerequestbodycontenttypes/post/responses/code200response/content/applicationjson/ApplicationjsonSchema.md#applicationjsonschema1) | schema()
the schema for this MediaType | -| Nothing? | encoding()
the encoding info | - -## SealedResponseBody -public sealed interface SealedResponseBody
-permits
-[ApplicationjsonResponseBody](#applicationjsonresponsebody) - -sealed interface that stores response body - -## ApplicationjsonResponseBody -public record ApplicationjsonResponseBody
-implements [SealedResponseBody](#sealedresponsebody) - -A record class to store response body for contentType="application/json" - -### Constructor Summary -| Constructor and Description | -| --------------------------- | -| ApplicationjsonResponseBody(ApplicationjsonSchema.AnyTypeJsonSchema1Boxed body)
Creates an instance | - -### Method Summary -| Modifier and Type | Method and Description | -| ----------------- | ---------------------- | -| ApplicationjsonSchema.AnyTypeJsonSchema1Boxed | body()
returns the body passed in in the constructor | - -## FakemultiplerequestbodycontenttypesPostCode200Response1 -public static class FakemultiplerequestbodycontenttypesPostCode200Response1
-extends ResponseDeserializer<[SealedResponseBody](#sealedresponsebody), Nothing?, [SealedMediaType](#sealedmediatype)> - -a class that deserializes responses - -### Constructor Summary -| Constructor and Description | -| --------------------------- | -| FakemultiplerequestbodycontenttypesPostCode200Response1()
Creates an instance | - -### Field Summary -| Modifier and Type | Field and Description | -| ----------------- | --------------------- | -| 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 | -| ----------------- | ---------------------- | -| ApiResponse<[SealedResponseBody](#sealedresponsebody), Nothing?> | deserialize(HttpResponse response, SchemaConfiguration configuration)
called by endpoint when deserialize responses | diff --git a/samples/client/petstore/kotlin/docs/paths/fakemultiplerequestbodycontenttypes/post/responses/code200response/content/applicationjson/ApplicationjsonSchema.md b/samples/client/petstore/kotlin/docs/paths/fakemultiplerequestbodycontenttypes/post/responses/code200response/content/applicationjson/ApplicationjsonSchema.md deleted file mode 100644 index b05260b1abf..00000000000 --- a/samples/client/petstore/kotlin/docs/paths/fakemultiplerequestbodycontenttypes/post/responses/code200response/content/applicationjson/ApplicationjsonSchema.md +++ /dev/null @@ -1,144 +0,0 @@ -# ApplicationjsonSchema -public class ApplicationjsonSchema
- -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 - -## Nested Class Summary -| Modifier and Type | Class and Description | -| ----------------- | ---------------------- | -| sealed interface | [ApplicationjsonSchema.ApplicationjsonSchema1Boxed](#applicationjsonschema1boxed)
sealed interface for validated payloads | -| record | [ApplicationjsonSchema.ApplicationjsonSchema1BoxedVoid](#applicationjsonschema1boxedvoid)
boxed class to store validated null payloads | -| record | [ApplicationjsonSchema.ApplicationjsonSchema1BoxedBoolean](#applicationjsonschema1boxedboolean)
boxed class to store validated boolean payloads | -| record | [ApplicationjsonSchema.ApplicationjsonSchema1BoxedNumber](#applicationjsonschema1boxednumber)
boxed class to store validated Number payloads | -| record | [ApplicationjsonSchema.ApplicationjsonSchema1BoxedString](#applicationjsonschema1boxedstring)
boxed class to store validated String payloads | -| record | [ApplicationjsonSchema.ApplicationjsonSchema1BoxedList](#applicationjsonschema1boxedlist)
boxed class to store validated List payloads | -| record | [ApplicationjsonSchema.ApplicationjsonSchema1BoxedMap](#applicationjsonschema1boxedmap)
boxed class to store validated Map payloads | -| static class | [ApplicationjsonSchema.ApplicationjsonSchema1](#applicationjsonschema1)
schema class | - -## ApplicationjsonSchema1Boxed -public sealed interface ApplicationjsonSchema1Boxed
-permits
-[ApplicationjsonSchema1BoxedVoid](#applicationjsonschema1boxedvoid), -[ApplicationjsonSchema1BoxedBoolean](#applicationjsonschema1boxedboolean), -[ApplicationjsonSchema1BoxedNumber](#applicationjsonschema1boxednumber), -[ApplicationjsonSchema1BoxedString](#applicationjsonschema1boxedstring), -[ApplicationjsonSchema1BoxedList](#applicationjsonschema1boxedlist), -[ApplicationjsonSchema1BoxedMap](#applicationjsonschema1boxedmap) - -sealed interface that stores validated payloads using boxed classes - -## ApplicationjsonSchema1BoxedVoid -public record ApplicationjsonSchema1BoxedVoid
-implements [ApplicationjsonSchema1Boxed](#applicationjsonschema1boxed) - -record that stores validated null payloads, sealed permits implementation - -### Constructor Summary -| Constructor and Description | -| --------------------------- | -| ApplicationjsonSchema1BoxedVoid(Nothing? data)
Creates an instance, private visibility | - -### Method Summary -| Modifier and Type | Method and Description | -| ----------------- | ---------------------- | -| Nothing? | data()
validated payload | -| @Nullable Object | getData()
validated payload | - -## ApplicationjsonSchema1BoxedBoolean -public record ApplicationjsonSchema1BoxedBoolean
-implements [ApplicationjsonSchema1Boxed](#applicationjsonschema1boxed) - -record that stores validated boolean payloads, sealed permits implementation - -### Constructor Summary -| Constructor and Description | -| --------------------------- | -| ApplicationjsonSchema1BoxedBoolean(boolean data)
Creates an instance, private visibility | - -### Method Summary -| Modifier and Type | Method and Description | -| ----------------- | ---------------------- | -| boolean | data()
validated payload | -| @Nullable Object | getData()
validated payload | - -## ApplicationjsonSchema1BoxedNumber -public record ApplicationjsonSchema1BoxedNumber
-implements [ApplicationjsonSchema1Boxed](#applicationjsonschema1boxed) - -record that stores validated Number payloads, sealed permits implementation - -### Constructor Summary -| Constructor and Description | -| --------------------------- | -| ApplicationjsonSchema1BoxedNumber(Number data)
Creates an instance, private visibility | - -### Method Summary -| Modifier and Type | Method and Description | -| ----------------- | ---------------------- | -| Number | data()
validated payload | -| @Nullable Object | getData()
validated payload | - -## ApplicationjsonSchema1BoxedString -public record ApplicationjsonSchema1BoxedString
-implements [ApplicationjsonSchema1Boxed](#applicationjsonschema1boxed) - -record that stores validated String payloads, sealed permits implementation - -### Constructor Summary -| Constructor and Description | -| --------------------------- | -| ApplicationjsonSchema1BoxedString(String data)
Creates an instance, private visibility | - -### Method Summary -| Modifier and Type | Method and Description | -| ----------------- | ---------------------- | -| String | data()
validated payload | -| @Nullable Object | getData()
validated payload | - -## ApplicationjsonSchema1BoxedList -public record ApplicationjsonSchema1BoxedList
-implements [ApplicationjsonSchema1Boxed](#applicationjsonschema1boxed) - -record that stores validated List payloads, sealed permits implementation - -### Constructor Summary -| Constructor and Description | -| --------------------------- | -| ApplicationjsonSchema1BoxedList(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 | - -## ApplicationjsonSchema1BoxedMap -public record ApplicationjsonSchema1BoxedMap
-implements [ApplicationjsonSchema1Boxed](#applicationjsonschema1boxed) - -record that stores validated Map payloads, sealed permits implementation - -### Constructor Summary -| Constructor and Description | -| --------------------------- | -| ApplicationjsonSchema1BoxedMap(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 | - -## ApplicationjsonSchema1 -public static class ApplicationjsonSchema1
-extends AnyTypeJsonSchema.AnyTypeJsonSchema1 - -A schema class that validates payloads - -| Methods Inherited from class org.openapijsonschematools.client.schemas.AnyTypeJsonSchema.AnyTypeJsonSchema1 | -| ------------------------------------------------------------------ | -| validate | -| validateAndBox | diff --git a/samples/client/petstore/kotlin/docs/paths/fakemultipleresponsebodies/FakemultipleresponsebodiesGet.md b/samples/client/petstore/kotlin/docs/paths/fakemultipleresponsebodies/FakemultipleresponsebodiesGet.md deleted file mode 100644 index dc5be34e68f..00000000000 --- a/samples/client/petstore/kotlin/docs/paths/fakemultipleresponsebodies/FakemultipleresponsebodiesGet.md +++ /dev/null @@ -1,150 +0,0 @@ -# FakemultipleresponsebodiesGet - -public class FakemultipleresponsebodiesGet - -A class that contains necessary endpoint classes -- a class that calls the endpoint method using the http verb -- a class that calls the endpoint method using the operationId name -- class(es) to store the request inputs -- builder(s) to set the request input data - -## Nested Class Summary -| Modifier and Type | Class and Description | -| ----------------- | --------------------- | -| static class | [Get](#get)
The class that has a get method to call the endpoint | -| interface | [MultipleResponseBodiesOperation](#multipleresponsebodiesoperation)
The interface that has a multipleResponseBodies method to call the endpoint | -| static class | [GetRequest](#getrequest)
The request inputs class | -| static class | [GetRequestBuilder](#getrequestbuilder)
A builder for the request input class | - -## Get -public static class Get extends ApiClient.ApiClient1 implements GetOperation
- -a class that allows one to call the endpoint using a method named get - -### 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.servers.RootServer0; -import org.openapijsonschematools.client.servers.RootServer1; -import org.openapijsonschematools.client.servers.RootServer2; -import org.openapijsonschematools.client.paths.fakemultipleresponsebodies.get.responses.FakemultipleresponsebodiesGetCode200Response; -import org.openapijsonschematools.client.paths.fakemultipleresponsebodies.get.responses.FakemultipleresponsebodiesGetCode202Response; -import org.openapijsonschematools.client.servers.RootServerInfo; -import org.openapijsonschematools.client.paths.fakemultipleresponsebodies.FakemultipleresponsebodiesGet; -import org.openapijsonschematools.client.paths.fakemultipleresponsebodies.get.FakemultipleresponsebodiesGetResponses; - -import java.io.IOException; -import java.util.Arrays; -import java.util.List; -import java.util.Map; -import java.util.AbstractMap; - -// if you want to use a server that is not SERVER_0 pass it in here and change the ServerIndex input below -ApiConfiguration.ServerInfo serverInfo = new ApiConfiguration.ServerInfoBuilder() - .rootServerInfo( - new RootServerInfo.RootServerInfoBuilder() - .rootServer0(new RootServer0()) - .build() - ) - .build(); -ApiConfiguration.ServerIndexInfo serverIndexInfo = new ApiConfiguration.ServerIndexInfoBuilder() - .rootServerInfoServerIndex(RootServerInfo.ServerIndex.SERVER_0) - .build(); -Duration timeout = Duration.ofSeconds(1L); -Map> defaultHeaders = Map.of("User-Agent", List.of("OpenAPI-JSON-Schema-Generator/1.0.0/java")); -ApiConfiguration apiConfiguration = new ApiConfiguration( - serverInfo - serverIndexInfo, - timeout, - defaultHeaders -); -SchemaConfiguration schemaConfiguration = new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().build()); -FakemultipleresponsebodiesGet.Get apiClient = new FakemultipleresponsebodiesGet.Get(apiConfiguration, schemaConfiguration); - - -var request = new FakemultipleresponsebodiesGet.GetRequestBuilder().build(); - -FakemultipleresponsebodiesGetResponses.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; -} -if (response instanceof FakemultipleresponsebodiesGetResponses.EndpointFakemultipleresponsebodiesGetCode200Response castResponse) { - FakemultipleresponsebodiesGetCode200Response.ApplicationjsonResponseBody deserializedBody = (FakemultipleresponsebodiesGetCode200Response.ApplicationjsonResponseBody) castResponse.body; - // handle deserialized body here -} else { - FakemultipleresponsebodiesGetResponses.EndpointFakemultipleresponsebodiesGetCode202Response castResponse = (FakemultipleresponsebodiesGetResponses.EndpointFakemultipleresponsebodiesGetCode202Response) response; - FakemultipleresponsebodiesGetCode202Response.ApplicationjsonResponseBody deserializedBody = (FakemultipleresponsebodiesGetCode202Response.ApplicationjsonResponseBody) castResponse.body; - // handle deserialized body here -} -``` -### Constructor Summary -| Constructor and Description | -| --------------------------- | -| Get(ApiConfiguration apiConfiguration, SchemaConfiguration schemaConfiguration)
Creates an instance | - -### Method Summary -| Modifier and Type | Method and Description | -| ----------------- | ---------------------- | -| [FakemultipleresponsebodiesGetResponses.EndpointResponse](../../paths/fakemultipleresponsebodies/get/FakemultipleresponsebodiesGetResponses.md#endpointresponse) | get([GetRequest](#getrequest) request) | - -## MultipleResponseBodiesOperation -public interface MultipleResponseBodiesOperation
- -an interface that allows one to call the endpoint using a method named multipleResponseBodies by the operationId - -### Method Summary -| Modifier and Type | Method and Description | -| ----------------- | ---------------------- | -| [FakemultipleresponsebodiesGetResponses.EndpointResponse](../../paths/fakemultipleresponsebodies/get/FakemultipleresponsebodiesGetResponses.md#endpointresponse) | multipleResponseBodies([GetRequest](#getrequest) request) | - -## GetRequest -public static class GetRequest
- -a class that stores the final request inputs - -### Field Summary -| Modifier and Type | Field and Description | -| ----------------- | --------------------- | -| [RootServerInfo.@Nullable ServerIndex](../../RootServerInfo.md#serverindex) | serverIndex
optional. Note: this will override the value in apiConfiguration | -| @Nullable Duration | timeout
optional. Note: this will override the value in apiConfiguration | - -## GetRequestBuilder -public static class GetRequestBuilder
- -a builder for request inputs - -### Constructor Summary -| Constructor and Description | -| --------------------------- | -| GetRequestBuilder()
Creates a builder that contains null for all parameters | - -### Method Summary -| Modifier and Type | Method and Description | -| ----------------- | ---------------------- | -| [GetRequest](#getrequest) | build()
Returns the request input used to call an endpoint method | -| [GetRequestBuilder](#getrequestbuilder) | serverIndex([RootServerInfo.ServerIndex](../../RootServerInfo.md#serverindex) serverIndex)
sets the optional property. Note: this will override the value in apiConfiguration | -| [GetRequestBuilder](#getrequestbuilder) | timeout(Duration timeout)
sets the optional property. Note: this will override the value in apiConfiguration | - -[[Back to top]](#top) [[Back to README]](../../../README.md) diff --git a/samples/client/petstore/kotlin/docs/paths/fakemultipleresponsebodies/get/FakemultipleresponsebodiesGetResponses.md b/samples/client/petstore/kotlin/docs/paths/fakemultipleresponsebodies/get/FakemultipleresponsebodiesGetResponses.md deleted file mode 100644 index 974c15a2235..00000000000 --- a/samples/client/petstore/kotlin/docs/paths/fakemultipleresponsebodies/get/FakemultipleresponsebodiesGetResponses.md +++ /dev/null @@ -1,40 +0,0 @@ -# FakemultipleresponsebodiesGetResponses - -public class FakemultipleresponsebodiesGetResponses - -A class that contains necessary responses classes -- a sealed interface, EndpointResponse, that stores endpoint responses -- records for each endpoint response - -## Nested Class Summary -| Modifier and Type | Class and Description | -| ----------------- | --------------------- | -| sealed interface | [EndpointResponse](#endpointresponse)
stores the endpoint responses | -| record | [EndpointFakemultipleresponsebodiesGetCode200Response](#endpointfakemultipleresponsebodiesgetcode200response)
the response for 200 | -| record | [EndpointFakemultipleresponsebodiesGetCode202Response](#endpointfakemultipleresponsebodiesgetcode202response)
the response for 202 | - -## EndpointResponse -public sealed interface EndpointResponse permits
-[EndpointFakemultipleresponsebodiesGetCode200Response](#endpointfakemultipleresponsebodiesgetcode200response), -[EndpointFakemultipleresponsebodiesGetCode202Response](#endpointfakemultipleresponsebodiesgetcode202response) - -a sealed interface that stores endpoint responses - -## EndpointFakemultipleresponsebodiesGetCode200Response -public record EndpointFakemultipleresponsebodiesGetCode200Response( - HttpResponse response, - [FakemultipleresponsebodiesGetCode200Response.SealedResponseBody](../../../paths/fakemultipleresponsebodies/get/responses/FakemultipleresponsebodiesGetCode200Response.md#sealedresponsebody) body, - Nothing? headers -) implements EndpointResponse, ApiResponse
- -a class that stores an endpoint response - -## EndpointFakemultipleresponsebodiesGetCode202Response -public record EndpointFakemultipleresponsebodiesGetCode202Response( - HttpResponse response, - [FakemultipleresponsebodiesGetCode202Response.SealedResponseBody](../../../paths/fakemultipleresponsebodies/get/responses/FakemultipleresponsebodiesGetCode202Response.md#sealedresponsebody) body, - Nothing? headers -) implements EndpointResponse, ApiResponse
- -a class that stores an endpoint response - diff --git a/samples/client/petstore/kotlin/docs/paths/fakemultipleresponsebodies/get/responses/FakemultipleresponsebodiesGetCode200Response.md b/samples/client/petstore/kotlin/docs/paths/fakemultipleresponsebodies/get/responses/FakemultipleresponsebodiesGetCode200Response.md deleted file mode 100644 index 73c87087c99..00000000000 --- a/samples/client/petstore/kotlin/docs/paths/fakemultipleresponsebodies/get/responses/FakemultipleresponsebodiesGetCode200Response.md +++ /dev/null @@ -1,87 +0,0 @@ -# FakemultipleresponsebodiesGetCode200Response - -public class FakemultipleresponsebodiesGetCode200Response - -A class that contains necessary nested response classes -- SealedMediaType, a sealed interface which contains all the schema/encoding info for each contentType -- records which implement SealedMediaType, the concrete media types -- SealedResponseBody, a sealed interface which contains all the contentType/schema types -- records which implement SealedResponseBody, the concrete response body types -- a class that extends ResponseDeserializer and is used to deserialize responses - -## Nested Class Summary -| Modifier and Type | Class and Description | -| ----------------- | --------------------- | -| sealed interface | [FakemultipleresponsebodiesGetCode200Response.SealedMediaType](#sealedmediatype)
media type sealed interface | -| record | [FakemultipleresponsebodiesGetCode200Response.ApplicationjsonMediaType](#applicationjsonmediatype)
record storing schema + encoding for a specific contentType | -| sealed interface | [FakemultipleresponsebodiesGetCode200Response.SealedResponseBody](#sealedresponsebody)
response body sealed interface | -| record | [FakemultipleresponsebodiesGetCode200Response.ApplicationjsonResponseBody](#applicationjsonresponsebody)
implements sealed interface to store response body | -| static class | [FakemultipleresponsebodiesGetCode200Response.FakemultipleresponsebodiesGetCode200Response1](#fakemultipleresponsebodiesgetcode200response1)
class that deserializes responses | - -## SealedMediaType -public sealed interface SealedMediaType
-permits
-[ApplicationjsonMediaType](#applicationjsonmediatype) - -sealed interface that stores schema and encoding info - -## ApplicationjsonMediaType -public record ApplicationjsonMediaType
-implements [SealedMediaType](#sealedmediatype), MediaType<[ApplicationjsonSchema.ApplicationjsonSchema1](../../../../paths/fakemultipleresponsebodies/get/responses/code200response/content/applicationjson/ApplicationjsonSchema.md#applicationjsonschema1), Nothing?> - -class storing schema info for a specific contentType - -### Constructor Summary -| Constructor and Description | -| --------------------------- | -| ApplicationjsonMediaType()
Creates an instance | - -### Method Summary -| Modifier and Type | Method and Description | -| ----------------- | ---------------------- | -| [ApplicationjsonSchema.ApplicationjsonSchema1](../../../../paths/fakemultipleresponsebodies/get/responses/code200response/content/applicationjson/ApplicationjsonSchema.md#applicationjsonschema1) | schema()
the schema for this MediaType | -| Nothing? | encoding()
the encoding info | - -## SealedResponseBody -public sealed interface SealedResponseBody
-permits
-[ApplicationjsonResponseBody](#applicationjsonresponsebody) - -sealed interface that stores response body - -## ApplicationjsonResponseBody -public record ApplicationjsonResponseBody
-implements [SealedResponseBody](#sealedresponsebody) - -A record class to store response body for contentType="application/json" - -### Constructor Summary -| Constructor and Description | -| --------------------------- | -| ApplicationjsonResponseBody(ApplicationjsonSchema.AnyTypeJsonSchema1Boxed body)
Creates an instance | - -### Method Summary -| Modifier and Type | Method and Description | -| ----------------- | ---------------------- | -| ApplicationjsonSchema.AnyTypeJsonSchema1Boxed | body()
returns the body passed in in the constructor | - -## FakemultipleresponsebodiesGetCode200Response1 -public static class FakemultipleresponsebodiesGetCode200Response1
-extends ResponseDeserializer<[SealedResponseBody](#sealedresponsebody), Nothing?, [SealedMediaType](#sealedmediatype)> - -a class that deserializes responses - -### Constructor Summary -| Constructor and Description | -| --------------------------- | -| FakemultipleresponsebodiesGetCode200Response1()
Creates an instance | - -### Field Summary -| Modifier and Type | Field and Description | -| ----------------- | --------------------- | -| 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 | -| ----------------- | ---------------------- | -| ApiResponse<[SealedResponseBody](#sealedresponsebody), Nothing?> | deserialize(HttpResponse response, SchemaConfiguration configuration)
called by endpoint when deserialize responses | diff --git a/samples/client/petstore/kotlin/docs/paths/fakemultipleresponsebodies/get/responses/FakemultipleresponsebodiesGetCode202Response.md b/samples/client/petstore/kotlin/docs/paths/fakemultipleresponsebodies/get/responses/FakemultipleresponsebodiesGetCode202Response.md deleted file mode 100644 index 3bd916b9b72..00000000000 --- a/samples/client/petstore/kotlin/docs/paths/fakemultipleresponsebodies/get/responses/FakemultipleresponsebodiesGetCode202Response.md +++ /dev/null @@ -1,87 +0,0 @@ -# FakemultipleresponsebodiesGetCode202Response - -public class FakemultipleresponsebodiesGetCode202Response - -A class that contains necessary nested response classes -- SealedMediaType, a sealed interface which contains all the schema/encoding info for each contentType -- records which implement SealedMediaType, the concrete media types -- SealedResponseBody, a sealed interface which contains all the contentType/schema types -- records which implement SealedResponseBody, the concrete response body types -- a class that extends ResponseDeserializer and is used to deserialize responses - -## Nested Class Summary -| Modifier and Type | Class and Description | -| ----------------- | --------------------- | -| sealed interface | [FakemultipleresponsebodiesGetCode202Response.SealedMediaType](#sealedmediatype)
media type sealed interface | -| record | [FakemultipleresponsebodiesGetCode202Response.ApplicationjsonMediaType](#applicationjsonmediatype)
record storing schema + encoding for a specific contentType | -| sealed interface | [FakemultipleresponsebodiesGetCode202Response.SealedResponseBody](#sealedresponsebody)
response body sealed interface | -| record | [FakemultipleresponsebodiesGetCode202Response.ApplicationjsonResponseBody](#applicationjsonresponsebody)
implements sealed interface to store response body | -| static class | [FakemultipleresponsebodiesGetCode202Response.FakemultipleresponsebodiesGetCode202Response1](#fakemultipleresponsebodiesgetcode202response1)
class that deserializes responses | - -## SealedMediaType -public sealed interface SealedMediaType
-permits
-[ApplicationjsonMediaType](#applicationjsonmediatype) - -sealed interface that stores schema and encoding info - -## ApplicationjsonMediaType -public record ApplicationjsonMediaType
-implements [SealedMediaType](#sealedmediatype), MediaType<[ApplicationjsonSchema.ApplicationjsonSchema1](../../../../paths/fakemultipleresponsebodies/get/responses/code202response/content/applicationjson/ApplicationjsonSchema.md#applicationjsonschema1), Nothing?> - -class storing schema info for a specific contentType - -### Constructor Summary -| Constructor and Description | -| --------------------------- | -| ApplicationjsonMediaType()
Creates an instance | - -### Method Summary -| Modifier and Type | Method and Description | -| ----------------- | ---------------------- | -| [ApplicationjsonSchema.ApplicationjsonSchema1](../../../../paths/fakemultipleresponsebodies/get/responses/code202response/content/applicationjson/ApplicationjsonSchema.md#applicationjsonschema1) | schema()
the schema for this MediaType | -| Nothing? | encoding()
the encoding info | - -## SealedResponseBody -public sealed interface SealedResponseBody
-permits
-[ApplicationjsonResponseBody](#applicationjsonresponsebody) - -sealed interface that stores response body - -## ApplicationjsonResponseBody -public record ApplicationjsonResponseBody
-implements [SealedResponseBody](#sealedresponsebody) - -A record class to store response body for contentType="application/json" - -### Constructor Summary -| Constructor and Description | -| --------------------------- | -| ApplicationjsonResponseBody(ApplicationjsonSchema.AnyTypeJsonSchema1Boxed body)
Creates an instance | - -### Method Summary -| Modifier and Type | Method and Description | -| ----------------- | ---------------------- | -| ApplicationjsonSchema.AnyTypeJsonSchema1Boxed | body()
returns the body passed in in the constructor | - -## FakemultipleresponsebodiesGetCode202Response1 -public static class FakemultipleresponsebodiesGetCode202Response1
-extends ResponseDeserializer<[SealedResponseBody](#sealedresponsebody), Nothing?, [SealedMediaType](#sealedmediatype)> - -a class that deserializes responses - -### Constructor Summary -| Constructor and Description | -| --------------------------- | -| FakemultipleresponsebodiesGetCode202Response1()
Creates an instance | - -### Field Summary -| Modifier and Type | Field and Description | -| ----------------- | --------------------- | -| 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 | -| ----------------- | ---------------------- | -| ApiResponse<[SealedResponseBody](#sealedresponsebody), Nothing?> | deserialize(HttpResponse response, SchemaConfiguration configuration)
called by endpoint when deserialize responses | diff --git a/samples/client/petstore/kotlin/docs/paths/fakemultipleresponsebodies/get/responses/code200response/content/applicationjson/ApplicationjsonSchema.md b/samples/client/petstore/kotlin/docs/paths/fakemultipleresponsebodies/get/responses/code200response/content/applicationjson/ApplicationjsonSchema.md deleted file mode 100644 index b05260b1abf..00000000000 --- a/samples/client/petstore/kotlin/docs/paths/fakemultipleresponsebodies/get/responses/code200response/content/applicationjson/ApplicationjsonSchema.md +++ /dev/null @@ -1,144 +0,0 @@ -# ApplicationjsonSchema -public class ApplicationjsonSchema
- -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 - -## Nested Class Summary -| Modifier and Type | Class and Description | -| ----------------- | ---------------------- | -| sealed interface | [ApplicationjsonSchema.ApplicationjsonSchema1Boxed](#applicationjsonschema1boxed)
sealed interface for validated payloads | -| record | [ApplicationjsonSchema.ApplicationjsonSchema1BoxedVoid](#applicationjsonschema1boxedvoid)
boxed class to store validated null payloads | -| record | [ApplicationjsonSchema.ApplicationjsonSchema1BoxedBoolean](#applicationjsonschema1boxedboolean)
boxed class to store validated boolean payloads | -| record | [ApplicationjsonSchema.ApplicationjsonSchema1BoxedNumber](#applicationjsonschema1boxednumber)
boxed class to store validated Number payloads | -| record | [ApplicationjsonSchema.ApplicationjsonSchema1BoxedString](#applicationjsonschema1boxedstring)
boxed class to store validated String payloads | -| record | [ApplicationjsonSchema.ApplicationjsonSchema1BoxedList](#applicationjsonschema1boxedlist)
boxed class to store validated List payloads | -| record | [ApplicationjsonSchema.ApplicationjsonSchema1BoxedMap](#applicationjsonschema1boxedmap)
boxed class to store validated Map payloads | -| static class | [ApplicationjsonSchema.ApplicationjsonSchema1](#applicationjsonschema1)
schema class | - -## ApplicationjsonSchema1Boxed -public sealed interface ApplicationjsonSchema1Boxed
-permits
-[ApplicationjsonSchema1BoxedVoid](#applicationjsonschema1boxedvoid), -[ApplicationjsonSchema1BoxedBoolean](#applicationjsonschema1boxedboolean), -[ApplicationjsonSchema1BoxedNumber](#applicationjsonschema1boxednumber), -[ApplicationjsonSchema1BoxedString](#applicationjsonschema1boxedstring), -[ApplicationjsonSchema1BoxedList](#applicationjsonschema1boxedlist), -[ApplicationjsonSchema1BoxedMap](#applicationjsonschema1boxedmap) - -sealed interface that stores validated payloads using boxed classes - -## ApplicationjsonSchema1BoxedVoid -public record ApplicationjsonSchema1BoxedVoid
-implements [ApplicationjsonSchema1Boxed](#applicationjsonschema1boxed) - -record that stores validated null payloads, sealed permits implementation - -### Constructor Summary -| Constructor and Description | -| --------------------------- | -| ApplicationjsonSchema1BoxedVoid(Nothing? data)
Creates an instance, private visibility | - -### Method Summary -| Modifier and Type | Method and Description | -| ----------------- | ---------------------- | -| Nothing? | data()
validated payload | -| @Nullable Object | getData()
validated payload | - -## ApplicationjsonSchema1BoxedBoolean -public record ApplicationjsonSchema1BoxedBoolean
-implements [ApplicationjsonSchema1Boxed](#applicationjsonschema1boxed) - -record that stores validated boolean payloads, sealed permits implementation - -### Constructor Summary -| Constructor and Description | -| --------------------------- | -| ApplicationjsonSchema1BoxedBoolean(boolean data)
Creates an instance, private visibility | - -### Method Summary -| Modifier and Type | Method and Description | -| ----------------- | ---------------------- | -| boolean | data()
validated payload | -| @Nullable Object | getData()
validated payload | - -## ApplicationjsonSchema1BoxedNumber -public record ApplicationjsonSchema1BoxedNumber
-implements [ApplicationjsonSchema1Boxed](#applicationjsonschema1boxed) - -record that stores validated Number payloads, sealed permits implementation - -### Constructor Summary -| Constructor and Description | -| --------------------------- | -| ApplicationjsonSchema1BoxedNumber(Number data)
Creates an instance, private visibility | - -### Method Summary -| Modifier and Type | Method and Description | -| ----------------- | ---------------------- | -| Number | data()
validated payload | -| @Nullable Object | getData()
validated payload | - -## ApplicationjsonSchema1BoxedString -public record ApplicationjsonSchema1BoxedString
-implements [ApplicationjsonSchema1Boxed](#applicationjsonschema1boxed) - -record that stores validated String payloads, sealed permits implementation - -### Constructor Summary -| Constructor and Description | -| --------------------------- | -| ApplicationjsonSchema1BoxedString(String data)
Creates an instance, private visibility | - -### Method Summary -| Modifier and Type | Method and Description | -| ----------------- | ---------------------- | -| String | data()
validated payload | -| @Nullable Object | getData()
validated payload | - -## ApplicationjsonSchema1BoxedList -public record ApplicationjsonSchema1BoxedList
-implements [ApplicationjsonSchema1Boxed](#applicationjsonschema1boxed) - -record that stores validated List payloads, sealed permits implementation - -### Constructor Summary -| Constructor and Description | -| --------------------------- | -| ApplicationjsonSchema1BoxedList(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 | - -## ApplicationjsonSchema1BoxedMap -public record ApplicationjsonSchema1BoxedMap
-implements [ApplicationjsonSchema1Boxed](#applicationjsonschema1boxed) - -record that stores validated Map payloads, sealed permits implementation - -### Constructor Summary -| Constructor and Description | -| --------------------------- | -| ApplicationjsonSchema1BoxedMap(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 | - -## ApplicationjsonSchema1 -public static class ApplicationjsonSchema1
-extends AnyTypeJsonSchema.AnyTypeJsonSchema1 - -A schema class that validates payloads - -| Methods Inherited from class org.openapijsonschematools.client.schemas.AnyTypeJsonSchema.AnyTypeJsonSchema1 | -| ------------------------------------------------------------------ | -| validate | -| validateAndBox | diff --git a/samples/client/petstore/kotlin/docs/paths/fakemultipleresponsebodies/get/responses/code202response/content/applicationjson/ApplicationjsonSchema.md b/samples/client/petstore/kotlin/docs/paths/fakemultipleresponsebodies/get/responses/code202response/content/applicationjson/ApplicationjsonSchema.md deleted file mode 100644 index b05260b1abf..00000000000 --- a/samples/client/petstore/kotlin/docs/paths/fakemultipleresponsebodies/get/responses/code202response/content/applicationjson/ApplicationjsonSchema.md +++ /dev/null @@ -1,144 +0,0 @@ -# ApplicationjsonSchema -public class ApplicationjsonSchema
- -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 - -## Nested Class Summary -| Modifier and Type | Class and Description | -| ----------------- | ---------------------- | -| sealed interface | [ApplicationjsonSchema.ApplicationjsonSchema1Boxed](#applicationjsonschema1boxed)
sealed interface for validated payloads | -| record | [ApplicationjsonSchema.ApplicationjsonSchema1BoxedVoid](#applicationjsonschema1boxedvoid)
boxed class to store validated null payloads | -| record | [ApplicationjsonSchema.ApplicationjsonSchema1BoxedBoolean](#applicationjsonschema1boxedboolean)
boxed class to store validated boolean payloads | -| record | [ApplicationjsonSchema.ApplicationjsonSchema1BoxedNumber](#applicationjsonschema1boxednumber)
boxed class to store validated Number payloads | -| record | [ApplicationjsonSchema.ApplicationjsonSchema1BoxedString](#applicationjsonschema1boxedstring)
boxed class to store validated String payloads | -| record | [ApplicationjsonSchema.ApplicationjsonSchema1BoxedList](#applicationjsonschema1boxedlist)
boxed class to store validated List payloads | -| record | [ApplicationjsonSchema.ApplicationjsonSchema1BoxedMap](#applicationjsonschema1boxedmap)
boxed class to store validated Map payloads | -| static class | [ApplicationjsonSchema.ApplicationjsonSchema1](#applicationjsonschema1)
schema class | - -## ApplicationjsonSchema1Boxed -public sealed interface ApplicationjsonSchema1Boxed
-permits
-[ApplicationjsonSchema1BoxedVoid](#applicationjsonschema1boxedvoid), -[ApplicationjsonSchema1BoxedBoolean](#applicationjsonschema1boxedboolean), -[ApplicationjsonSchema1BoxedNumber](#applicationjsonschema1boxednumber), -[ApplicationjsonSchema1BoxedString](#applicationjsonschema1boxedstring), -[ApplicationjsonSchema1BoxedList](#applicationjsonschema1boxedlist), -[ApplicationjsonSchema1BoxedMap](#applicationjsonschema1boxedmap) - -sealed interface that stores validated payloads using boxed classes - -## ApplicationjsonSchema1BoxedVoid -public record ApplicationjsonSchema1BoxedVoid
-implements [ApplicationjsonSchema1Boxed](#applicationjsonschema1boxed) - -record that stores validated null payloads, sealed permits implementation - -### Constructor Summary -| Constructor and Description | -| --------------------------- | -| ApplicationjsonSchema1BoxedVoid(Nothing? data)
Creates an instance, private visibility | - -### Method Summary -| Modifier and Type | Method and Description | -| ----------------- | ---------------------- | -| Nothing? | data()
validated payload | -| @Nullable Object | getData()
validated payload | - -## ApplicationjsonSchema1BoxedBoolean -public record ApplicationjsonSchema1BoxedBoolean
-implements [ApplicationjsonSchema1Boxed](#applicationjsonschema1boxed) - -record that stores validated boolean payloads, sealed permits implementation - -### Constructor Summary -| Constructor and Description | -| --------------------------- | -| ApplicationjsonSchema1BoxedBoolean(boolean data)
Creates an instance, private visibility | - -### Method Summary -| Modifier and Type | Method and Description | -| ----------------- | ---------------------- | -| boolean | data()
validated payload | -| @Nullable Object | getData()
validated payload | - -## ApplicationjsonSchema1BoxedNumber -public record ApplicationjsonSchema1BoxedNumber
-implements [ApplicationjsonSchema1Boxed](#applicationjsonschema1boxed) - -record that stores validated Number payloads, sealed permits implementation - -### Constructor Summary -| Constructor and Description | -| --------------------------- | -| ApplicationjsonSchema1BoxedNumber(Number data)
Creates an instance, private visibility | - -### Method Summary -| Modifier and Type | Method and Description | -| ----------------- | ---------------------- | -| Number | data()
validated payload | -| @Nullable Object | getData()
validated payload | - -## ApplicationjsonSchema1BoxedString -public record ApplicationjsonSchema1BoxedString
-implements [ApplicationjsonSchema1Boxed](#applicationjsonschema1boxed) - -record that stores validated String payloads, sealed permits implementation - -### Constructor Summary -| Constructor and Description | -| --------------------------- | -| ApplicationjsonSchema1BoxedString(String data)
Creates an instance, private visibility | - -### Method Summary -| Modifier and Type | Method and Description | -| ----------------- | ---------------------- | -| String | data()
validated payload | -| @Nullable Object | getData()
validated payload | - -## ApplicationjsonSchema1BoxedList -public record ApplicationjsonSchema1BoxedList
-implements [ApplicationjsonSchema1Boxed](#applicationjsonschema1boxed) - -record that stores validated List payloads, sealed permits implementation - -### Constructor Summary -| Constructor and Description | -| --------------------------- | -| ApplicationjsonSchema1BoxedList(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 | - -## ApplicationjsonSchema1BoxedMap -public record ApplicationjsonSchema1BoxedMap
-implements [ApplicationjsonSchema1Boxed](#applicationjsonschema1boxed) - -record that stores validated Map payloads, sealed permits implementation - -### Constructor Summary -| Constructor and Description | -| --------------------------- | -| ApplicationjsonSchema1BoxedMap(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 | - -## ApplicationjsonSchema1 -public static class ApplicationjsonSchema1
-extends AnyTypeJsonSchema.AnyTypeJsonSchema1 - -A schema class that validates payloads - -| Methods Inherited from class org.openapijsonschematools.client.schemas.AnyTypeJsonSchema.AnyTypeJsonSchema1 | -| ------------------------------------------------------------------ | -| validate | -| validateAndBox | diff --git a/samples/client/petstore/kotlin/docs/paths/fakemultiplesecurities/FakemultiplesecuritiesGet.md b/samples/client/petstore/kotlin/docs/paths/fakemultiplesecurities/FakemultiplesecuritiesGet.md deleted file mode 100644 index 4ce19768eab..00000000000 --- a/samples/client/petstore/kotlin/docs/paths/fakemultiplesecurities/FakemultiplesecuritiesGet.md +++ /dev/null @@ -1,163 +0,0 @@ -# FakemultiplesecuritiesGet - -public class FakemultiplesecuritiesGet - -A class that contains necessary endpoint classes -- a class that calls the endpoint method using the http verb -- a class that calls the endpoint method using the operationId name -- class(es) to store the request inputs -- builder(s) to set the request input data - -## Nested Class Summary -| Modifier and Type | Class and Description | -| ----------------- | --------------------- | -| static class | [Get](#get)
The class that has a get method to call the endpoint | -| interface | [MultipleSecuritiesOperation](#multiplesecuritiesoperation)
The interface that has a multipleSecurities method to call the endpoint | -| static class | [GetRequest](#getrequest)
The request inputs class | -| static class | [GetRequestBuilder](#getrequestbuilder)
A builder for the request input class | - -## Get -public static class Get extends ApiClient.ApiClient1 implements GetOperation
- -a class that allows one to call the endpoint using a method named get - -### 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.fakemultiplesecurities.get.FakemultiplesecuritiesGetSecurityInfo; -import org.openapijsonschematools.client.servers.RootServer0; -import org.openapijsonschematools.client.servers.RootServer1; -import org.openapijsonschematools.client.servers.RootServer2; -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.FakemultiplesecuritiesGetCode200Response; -import org.openapijsonschematools.client.servers.RootServerInfo; -import org.openapijsonschematools.client.paths.fakemultiplesecurities.FakemultiplesecuritiesGet; -import org.openapijsonschematools.client.paths.fakemultiplesecurities.get.FakemultiplesecuritiesGetResponses; - -import java.io.IOException; -import java.util.Arrays; -import java.util.List; -import java.util.Map; -import java.util.AbstractMap; - -// if you want to use a server that is not SERVER_0 pass it in here and change the ServerIndex input below -ApiConfiguration.ServerInfo serverInfo = new ApiConfiguration.ServerInfoBuilder() - .rootServerInfo( - new RootServerInfo.RootServerInfoBuilder() - .rootServer0(new RootServer0()) - .build() - ) - .build(); -ApiConfiguration.ServerIndexInfo serverIndexInfo = new ApiConfiguration.ServerIndexInfoBuilder() - .rootServerInfoServerIndex(RootServerInfo.ServerIndex.SERVER_0) - .build(); -List securitySchemes = new ArrayList(); -securitySchemes.add( - new HttpBasicTest("someUserId", "somePassword"); -); -securitySchemes.add( - new ApiKey("someApiKey"); -); -ApiConfiguration.SecurityIndexInfo securityIndexInfo = new ApiConfiguration.SecurityIndexInfoBuilder() - .fakemultiplesecuritiesGetSecurityRequirementObject0SecurityIndex(FakemultiplesecuritiesGetSecurityRequirementObject0.SecurityIndex.SECURITY_0) - .build(); -Duration timeout = Duration.ofSeconds(1L); -Map> defaultHeaders = Map.of("User-Agent", List.of("OpenAPI-JSON-Schema-Generator/1.0.0/java")); -ApiConfiguration apiConfiguration = new ApiConfiguration( - serverInfo - serverIndexInfo, - securitySchemes, - securityIndexInfo, - timeout, - defaultHeaders -); -SchemaConfiguration schemaConfiguration = new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().build()); -FakemultiplesecuritiesGet.Get apiClient = new FakemultiplesecuritiesGet.Get(apiConfiguration, schemaConfiguration); - - -var request = new FakemultiplesecuritiesGet.GetRequestBuilder().build(); - -FakemultiplesecuritiesGetResponses.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; -} -FakemultiplesecuritiesGetResponses.EndpointFakemultiplesecuritiesGetCode200Response castResponse = (FakemultiplesecuritiesGetResponses.EndpointFakemultiplesecuritiesGetCode200Response) response; -FakemultiplesecuritiesGetCode200Response.ApplicationjsonResponseBody deserializedBody = (FakemultiplesecuritiesGetCode200Response.ApplicationjsonResponseBody) castResponse.body; -// handle deserialized body here -``` -### Constructor Summary -| Constructor and Description | -| --------------------------- | -| Get(ApiConfiguration apiConfiguration, SchemaConfiguration schemaConfiguration)
Creates an instance | - -### Method Summary -| Modifier and Type | Method and Description | -| ----------------- | ---------------------- | -| [FakemultiplesecuritiesGetResponses.EndpointResponse](../../paths/fakemultiplesecurities/get/FakemultiplesecuritiesGetResponses.md#endpointresponse) | get([GetRequest](#getrequest) request) | - -## MultipleSecuritiesOperation -public interface MultipleSecuritiesOperation
- -an interface that allows one to call the endpoint using a method named multipleSecurities by the operationId - -### Method Summary -| Modifier and Type | Method and Description | -| ----------------- | ---------------------- | -| [FakemultiplesecuritiesGetResponses.EndpointResponse](../../paths/fakemultiplesecurities/get/FakemultiplesecuritiesGetResponses.md#endpointresponse) | multipleSecurities([GetRequest](#getrequest) request) | - -## GetRequest -public static class GetRequest
- -a class that stores the final request inputs - -### Field Summary -| Modifier and Type | Field and Description | -| ----------------- | --------------------- | -| [RootServerInfo.@Nullable ServerIndex](../../RootServerInfo.md#serverindex) | serverIndex
optional. Note: this will override the value in apiConfiguration | -| [FakemultiplesecuritiesGetSecurityInfo.@Nullable SecurityIndex](../../paths/fakemultiplesecurities/get/FakemultiplesecuritiesGetSecurityInfo.md#securityindex) | securityIndex
optional. Note: this will override the value in apiConfiguration | -| @Nullable Duration | timeout
optional. Note: this will override the value in apiConfiguration | - -## GetRequestBuilder -public static class GetRequestBuilder
- -a builder for request inputs - -### Constructor Summary -| Constructor and Description | -| --------------------------- | -| GetRequestBuilder()
Creates a builder that contains null for all parameters | - -### Method Summary -| Modifier and Type | Method and Description | -| ----------------- | ---------------------- | -| [GetRequest](#getrequest) | build()
Returns the request input used to call an endpoint method | -| [GetRequestBuilder](#getrequestbuilder) | serverIndex([RootServerInfo.ServerIndex](../../RootServerInfo.md#serverindex) serverIndex)
sets the optional property. Note: this will override the value in apiConfiguration | -| [GetRequestBuilder](#getrequestbuilder) | securityIndex([FakemultiplesecuritiesGetSecurityInfo.SecurityIndex](../../paths/fakemultiplesecurities/get/FakemultiplesecuritiesGetSecurityInfo.md#securityindex) securityIndex)
sets the optional property. Note: this will override the value in apiConfiguration | -| [GetRequestBuilder](#getrequestbuilder) | timeout(Duration timeout)
sets the optional property. Note: this will override the value in apiConfiguration | - -[[Back to top]](#top) [[Back to README]](../../../README.md) diff --git a/samples/client/petstore/kotlin/docs/paths/fakemultiplesecurities/get/FakemultiplesecuritiesGetResponses.md b/samples/client/petstore/kotlin/docs/paths/fakemultiplesecurities/get/FakemultiplesecuritiesGetResponses.md deleted file mode 100644 index ae5d846c207..00000000000 --- a/samples/client/petstore/kotlin/docs/paths/fakemultiplesecurities/get/FakemultiplesecuritiesGetResponses.md +++ /dev/null @@ -1,29 +0,0 @@ -# FakemultiplesecuritiesGetResponses - -public class FakemultiplesecuritiesGetResponses - -A class that contains necessary responses classes -- a sealed interface, EndpointResponse, that stores endpoint responses -- records for each endpoint response - -## Nested Class Summary -| Modifier and Type | Class and Description | -| ----------------- | --------------------- | -| sealed interface | [EndpointResponse](#endpointresponse)
stores the endpoint responses | -| record | [EndpointFakemultiplesecuritiesGetCode200Response](#endpointfakemultiplesecuritiesgetcode200response)
the response for 200 | - -## EndpointResponse -public sealed interface EndpointResponse permits
-[EndpointFakemultiplesecuritiesGetCode200Response](#endpointfakemultiplesecuritiesgetcode200response) - -a sealed interface that stores endpoint responses - -## EndpointFakemultiplesecuritiesGetCode200Response -public record EndpointFakemultiplesecuritiesGetCode200Response( - HttpResponse response, - [FakemultiplesecuritiesGetCode200Response.SealedResponseBody](../../../paths/fakemultiplesecurities/get/responses/FakemultiplesecuritiesGetCode200Response.md#sealedresponsebody) body, - Nothing? headers -) implements EndpointResponse, ApiResponse
- -a class that stores an endpoint response - diff --git a/samples/client/petstore/kotlin/docs/paths/fakemultiplesecurities/get/FakemultiplesecuritiesGetSecurityInfo.md b/samples/client/petstore/kotlin/docs/paths/fakemultiplesecurities/get/FakemultiplesecuritiesGetSecurityInfo.md deleted file mode 100644 index dfdd24f765d..00000000000 --- a/samples/client/petstore/kotlin/docs/paths/fakemultiplesecurities/get/FakemultiplesecuritiesGetSecurityInfo.md +++ /dev/null @@ -1,44 +0,0 @@ -# FakemultiplesecuritiesGetSecurityInfo -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 -- an enum class that describes security index values - -## Nested Class Summary -| Modifier and Type | Class and Description | -| ----------------- | --------------------- | -| static class | [FakemultiplesecuritiesGetSecurityInfo.FakemultiplesecuritiesGetSecurityInfo1](#fakemultiplesecuritiesgetsecurityinfo1)
SecurityRequirementObjectProvider -| enum | [FakemultiplesecuritiesGetSecurityInfo.SecurityIndex](#securityindex)
class that stores a security index | - -## FakemultiplesecuritiesGetSecurityInfo1 -implements SecurityRequirementObjectProvider<[SecurityIndex](#securityindex)> - -### Constructor Summary -| Constructor and Description | -| --------------------------- | -| FakemultiplesecuritiesGetSecurityInfo1()
Creates an instance | - -### 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 | - -### Method Summary -| Modifier and Type | Method and Description | -| ----------------- | ---------------------- | -| SecurityRequirementObject | getSecurityRequirementObject(@Nullable [SecurityIndex](#securityindex) securityIndex)
If null is input, then the instance's securityIndex will be used | - -## SecurityIndex -enum SecurityIndex
- -### Enum Constant Summary -| Enum Constant And Description | -| ----------------------------- | -| SECURITY_0
security 0 | -| SECURITY_1
security 1 | -| SECURITY_2
security 2 | diff --git a/samples/client/petstore/kotlin/docs/paths/fakemultiplesecurities/get/responses/FakemultiplesecuritiesGetCode200Response.md b/samples/client/petstore/kotlin/docs/paths/fakemultiplesecurities/get/responses/FakemultiplesecuritiesGetCode200Response.md deleted file mode 100644 index fec728526f9..00000000000 --- a/samples/client/petstore/kotlin/docs/paths/fakemultiplesecurities/get/responses/FakemultiplesecuritiesGetCode200Response.md +++ /dev/null @@ -1,87 +0,0 @@ -# FakemultiplesecuritiesGetCode200Response - -public class FakemultiplesecuritiesGetCode200Response - -A class that contains necessary nested response classes -- SealedMediaType, a sealed interface which contains all the schema/encoding info for each contentType -- records which implement SealedMediaType, the concrete media types -- SealedResponseBody, a sealed interface which contains all the contentType/schema types -- records which implement SealedResponseBody, the concrete response body types -- a class that extends ResponseDeserializer and is used to deserialize responses - -## Nested Class Summary -| Modifier and Type | Class and Description | -| ----------------- | --------------------- | -| sealed interface | [FakemultiplesecuritiesGetCode200Response.SealedMediaType](#sealedmediatype)
media type sealed interface | -| record | [FakemultiplesecuritiesGetCode200Response.ApplicationjsonMediaType](#applicationjsonmediatype)
record storing schema + encoding for a specific contentType | -| sealed interface | [FakemultiplesecuritiesGetCode200Response.SealedResponseBody](#sealedresponsebody)
response body sealed interface | -| record | [FakemultiplesecuritiesGetCode200Response.ApplicationjsonResponseBody](#applicationjsonresponsebody)
implements sealed interface to store response body | -| static class | [FakemultiplesecuritiesGetCode200Response.FakemultiplesecuritiesGetCode200Response1](#fakemultiplesecuritiesgetcode200response1)
class that deserializes responses | - -## SealedMediaType -public sealed interface SealedMediaType
-permits
-[ApplicationjsonMediaType](#applicationjsonmediatype) - -sealed interface that stores schema and encoding info - -## ApplicationjsonMediaType -public record ApplicationjsonMediaType
-implements [SealedMediaType](#sealedmediatype), MediaType<[ApplicationjsonSchema.ApplicationjsonSchema1](../../../../paths/fakemultiplesecurities/get/responses/code200response/content/applicationjson/ApplicationjsonSchema.md#applicationjsonschema1), Nothing?> - -class storing schema info for a specific contentType - -### Constructor Summary -| Constructor and Description | -| --------------------------- | -| ApplicationjsonMediaType()
Creates an instance | - -### Method Summary -| Modifier and Type | Method and Description | -| ----------------- | ---------------------- | -| [ApplicationjsonSchema.ApplicationjsonSchema1](../../../../paths/fakemultiplesecurities/get/responses/code200response/content/applicationjson/ApplicationjsonSchema.md#applicationjsonschema1) | schema()
the schema for this MediaType | -| Nothing? | encoding()
the encoding info | - -## SealedResponseBody -public sealed interface SealedResponseBody
-permits
-[ApplicationjsonResponseBody](#applicationjsonresponsebody) - -sealed interface that stores response body - -## ApplicationjsonResponseBody -public record ApplicationjsonResponseBody
-implements [SealedResponseBody](#sealedresponsebody) - -A record class to store response body for contentType="application/json" - -### Constructor Summary -| Constructor and Description | -| --------------------------- | -| ApplicationjsonResponseBody(ApplicationjsonSchema.AnyTypeJsonSchema1Boxed body)
Creates an instance | - -### Method Summary -| Modifier and Type | Method and Description | -| ----------------- | ---------------------- | -| ApplicationjsonSchema.AnyTypeJsonSchema1Boxed | body()
returns the body passed in in the constructor | - -## FakemultiplesecuritiesGetCode200Response1 -public static class FakemultiplesecuritiesGetCode200Response1
-extends ResponseDeserializer<[SealedResponseBody](#sealedresponsebody), Nothing?, [SealedMediaType](#sealedmediatype)> - -a class that deserializes responses - -### Constructor Summary -| Constructor and Description | -| --------------------------- | -| FakemultiplesecuritiesGetCode200Response1()
Creates an instance | - -### Field Summary -| Modifier and Type | Field and Description | -| ----------------- | --------------------- | -| 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 | -| ----------------- | ---------------------- | -| ApiResponse<[SealedResponseBody](#sealedresponsebody), Nothing?> | deserialize(HttpResponse response, SchemaConfiguration configuration)
called by endpoint when deserialize responses | diff --git a/samples/client/petstore/kotlin/docs/paths/fakemultiplesecurities/get/responses/code200response/content/applicationjson/ApplicationjsonSchema.md b/samples/client/petstore/kotlin/docs/paths/fakemultiplesecurities/get/responses/code200response/content/applicationjson/ApplicationjsonSchema.md deleted file mode 100644 index b05260b1abf..00000000000 --- a/samples/client/petstore/kotlin/docs/paths/fakemultiplesecurities/get/responses/code200response/content/applicationjson/ApplicationjsonSchema.md +++ /dev/null @@ -1,144 +0,0 @@ -# ApplicationjsonSchema -public class ApplicationjsonSchema
- -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 - -## Nested Class Summary -| Modifier and Type | Class and Description | -| ----------------- | ---------------------- | -| sealed interface | [ApplicationjsonSchema.ApplicationjsonSchema1Boxed](#applicationjsonschema1boxed)
sealed interface for validated payloads | -| record | [ApplicationjsonSchema.ApplicationjsonSchema1BoxedVoid](#applicationjsonschema1boxedvoid)
boxed class to store validated null payloads | -| record | [ApplicationjsonSchema.ApplicationjsonSchema1BoxedBoolean](#applicationjsonschema1boxedboolean)
boxed class to store validated boolean payloads | -| record | [ApplicationjsonSchema.ApplicationjsonSchema1BoxedNumber](#applicationjsonschema1boxednumber)
boxed class to store validated Number payloads | -| record | [ApplicationjsonSchema.ApplicationjsonSchema1BoxedString](#applicationjsonschema1boxedstring)
boxed class to store validated String payloads | -| record | [ApplicationjsonSchema.ApplicationjsonSchema1BoxedList](#applicationjsonschema1boxedlist)
boxed class to store validated List payloads | -| record | [ApplicationjsonSchema.ApplicationjsonSchema1BoxedMap](#applicationjsonschema1boxedmap)
boxed class to store validated Map payloads | -| static class | [ApplicationjsonSchema.ApplicationjsonSchema1](#applicationjsonschema1)
schema class | - -## ApplicationjsonSchema1Boxed -public sealed interface ApplicationjsonSchema1Boxed
-permits
-[ApplicationjsonSchema1BoxedVoid](#applicationjsonschema1boxedvoid), -[ApplicationjsonSchema1BoxedBoolean](#applicationjsonschema1boxedboolean), -[ApplicationjsonSchema1BoxedNumber](#applicationjsonschema1boxednumber), -[ApplicationjsonSchema1BoxedString](#applicationjsonschema1boxedstring), -[ApplicationjsonSchema1BoxedList](#applicationjsonschema1boxedlist), -[ApplicationjsonSchema1BoxedMap](#applicationjsonschema1boxedmap) - -sealed interface that stores validated payloads using boxed classes - -## ApplicationjsonSchema1BoxedVoid -public record ApplicationjsonSchema1BoxedVoid
-implements [ApplicationjsonSchema1Boxed](#applicationjsonschema1boxed) - -record that stores validated null payloads, sealed permits implementation - -### Constructor Summary -| Constructor and Description | -| --------------------------- | -| ApplicationjsonSchema1BoxedVoid(Nothing? data)
Creates an instance, private visibility | - -### Method Summary -| Modifier and Type | Method and Description | -| ----------------- | ---------------------- | -| Nothing? | data()
validated payload | -| @Nullable Object | getData()
validated payload | - -## ApplicationjsonSchema1BoxedBoolean -public record ApplicationjsonSchema1BoxedBoolean
-implements [ApplicationjsonSchema1Boxed](#applicationjsonschema1boxed) - -record that stores validated boolean payloads, sealed permits implementation - -### Constructor Summary -| Constructor and Description | -| --------------------------- | -| ApplicationjsonSchema1BoxedBoolean(boolean data)
Creates an instance, private visibility | - -### Method Summary -| Modifier and Type | Method and Description | -| ----------------- | ---------------------- | -| boolean | data()
validated payload | -| @Nullable Object | getData()
validated payload | - -## ApplicationjsonSchema1BoxedNumber -public record ApplicationjsonSchema1BoxedNumber
-implements [ApplicationjsonSchema1Boxed](#applicationjsonschema1boxed) - -record that stores validated Number payloads, sealed permits implementation - -### Constructor Summary -| Constructor and Description | -| --------------------------- | -| ApplicationjsonSchema1BoxedNumber(Number data)
Creates an instance, private visibility | - -### Method Summary -| Modifier and Type | Method and Description | -| ----------------- | ---------------------- | -| Number | data()
validated payload | -| @Nullable Object | getData()
validated payload | - -## ApplicationjsonSchema1BoxedString -public record ApplicationjsonSchema1BoxedString
-implements [ApplicationjsonSchema1Boxed](#applicationjsonschema1boxed) - -record that stores validated String payloads, sealed permits implementation - -### Constructor Summary -| Constructor and Description | -| --------------------------- | -| ApplicationjsonSchema1BoxedString(String data)
Creates an instance, private visibility | - -### Method Summary -| Modifier and Type | Method and Description | -| ----------------- | ---------------------- | -| String | data()
validated payload | -| @Nullable Object | getData()
validated payload | - -## ApplicationjsonSchema1BoxedList -public record ApplicationjsonSchema1BoxedList
-implements [ApplicationjsonSchema1Boxed](#applicationjsonschema1boxed) - -record that stores validated List payloads, sealed permits implementation - -### Constructor Summary -| Constructor and Description | -| --------------------------- | -| ApplicationjsonSchema1BoxedList(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 | - -## ApplicationjsonSchema1BoxedMap -public record ApplicationjsonSchema1BoxedMap
-implements [ApplicationjsonSchema1Boxed](#applicationjsonschema1boxed) - -record that stores validated Map payloads, sealed permits implementation - -### Constructor Summary -| Constructor and Description | -| --------------------------- | -| ApplicationjsonSchema1BoxedMap(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 | - -## ApplicationjsonSchema1 -public static class ApplicationjsonSchema1
-extends AnyTypeJsonSchema.AnyTypeJsonSchema1 - -A schema class that validates payloads - -| Methods Inherited from class org.openapijsonschematools.client.schemas.AnyTypeJsonSchema.AnyTypeJsonSchema1 | -| ------------------------------------------------------------------ | -| validate | -| validateAndBox | diff --git a/samples/client/petstore/kotlin/docs/paths/fakemultiplesecurities/get/security/FakemultiplesecuritiesGetSecurityRequirementObject0.md b/samples/client/petstore/kotlin/docs/paths/fakemultiplesecurities/get/security/FakemultiplesecuritiesGetSecurityRequirementObject0.md deleted file mode 100644 index e762a030213..00000000000 --- a/samples/client/petstore/kotlin/docs/paths/fakemultiplesecurities/get/security/FakemultiplesecuritiesGetSecurityRequirementObject0.md +++ /dev/null @@ -1,15 +0,0 @@ -# FakemultiplesecuritiesGetSecurityRequirementObject0 -FakemultiplesecuritiesGetSecurityRequirementObject0.java - -public class FakemultiplesecuritiesGetSecurityRequirementObject0 -extends EmptySecurityRequirementObject - -### Constructor Summary -| Constructor and Description | -| --------------------------- | -| FakemultiplesecuritiesGetSecurityRequirementObject0()
Creates an instance | - -### Field Summary -| Modifier and Type | Field and Description | -| ----------------- | --------------------- | -| Map, List> | securitySchemeToScopes = Map.ofEntries() | diff --git a/samples/client/petstore/kotlin/docs/paths/fakemultiplesecurities/get/security/FakemultiplesecuritiesGetSecurityRequirementObject1.md b/samples/client/petstore/kotlin/docs/paths/fakemultiplesecurities/get/security/FakemultiplesecuritiesGetSecurityRequirementObject1.md deleted file mode 100644 index 2fc62ae0497..00000000000 --- a/samples/client/petstore/kotlin/docs/paths/fakemultiplesecurities/get/security/FakemultiplesecuritiesGetSecurityRequirementObject1.md +++ /dev/null @@ -1,15 +0,0 @@ -# FakemultiplesecuritiesGetSecurityRequirementObject1 -FakemultiplesecuritiesGetSecurityRequirementObject1.java - -public class FakemultiplesecuritiesGetSecurityRequirementObject1 -extends SecurityRequirementObject - -### Constructor Summary -| Constructor and Description | -| --------------------------- | -| FakemultiplesecuritiesGetSecurityRequirementObject1()
Creates an instance | - -### 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()
    )) | diff --git a/samples/client/petstore/kotlin/docs/paths/fakemultiplesecurities/get/security/FakemultiplesecuritiesGetSecurityRequirementObject2.md b/samples/client/petstore/kotlin/docs/paths/fakemultiplesecurities/get/security/FakemultiplesecuritiesGetSecurityRequirementObject2.md deleted file mode 100644 index b073e315c8b..00000000000 --- a/samples/client/petstore/kotlin/docs/paths/fakemultiplesecurities/get/security/FakemultiplesecuritiesGetSecurityRequirementObject2.md +++ /dev/null @@ -1,15 +0,0 @@ -# FakemultiplesecuritiesGetSecurityRequirementObject2 -FakemultiplesecuritiesGetSecurityRequirementObject2.java - -public class FakemultiplesecuritiesGetSecurityRequirementObject2 -extends SecurityRequirementObject - -### Constructor Summary -| Constructor and Description | -| --------------------------- | -| FakemultiplesecuritiesGetSecurityRequirementObject2()
Creates an instance | - -### 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")
    )) | diff --git a/samples/client/petstore/kotlin/docs/paths/fakeobjinquery/FakeobjinqueryGet.md b/samples/client/petstore/kotlin/docs/paths/fakeobjinquery/FakeobjinqueryGet.md deleted file mode 100644 index 0fdd2d46e90..00000000000 --- a/samples/client/petstore/kotlin/docs/paths/fakeobjinquery/FakeobjinqueryGet.md +++ /dev/null @@ -1,145 +0,0 @@ -# FakeobjinqueryGet - -public class FakeobjinqueryGet - -A class that contains necessary endpoint classes -- a class that calls the endpoint method using the http verb -- a class that calls the endpoint method using the operationId name -- class(es) to store the request inputs -- builder(s) to set the request input data - -## Nested Class Summary -| Modifier and Type | Class and Description | -| ----------------- | --------------------- | -| static class | [Get](#get)
The class that has a get method to call the endpoint | -| interface | [ObjectInQueryOperation](#objectinqueryoperation)
The interface that has a objectInQuery method to call the endpoint | -| static class | [GetRequest](#getrequest)
The request inputs class | -| static class | [GetRequestBuilder](#getrequestbuilder)
A builder for the request input class | - -## Get -public static class Get extends ApiClient.ApiClient1 implements GetOperation
- -a class that allows one to call the endpoint using a method named get - -### 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.fakeobjinquery.get.FakeobjinqueryGetQueryParameters; -import org.openapijsonschematools.client.RootServerInfo; -import org.openapijsonschematools.client.servers.RootServer0; -import org.openapijsonschematools.client.servers.RootServer1; -import org.openapijsonschematools.client.servers.RootServer2; -import org.openapijsonschematools.client.paths.fakeobjinquery.get.responses.FakeobjinqueryGetCode200Response; -import org.openapijsonschematools.client.servers.RootServerInfo; -import org.openapijsonschematools.client.paths.fakeobjinquery.FakeobjinqueryGet; -import org.openapijsonschematools.client.paths.fakeobjinquery.get.FakeobjinqueryGetResponses; - -import java.io.IOException; -import java.util.Arrays; -import java.util.List; -import java.util.Map; -import java.util.AbstractMap; - -// if you want to use a server that is not SERVER_0 pass it in here and change the ServerIndex input below -ApiConfiguration.ServerInfo serverInfo = new ApiConfiguration.ServerInfoBuilder() - .rootServerInfo( - new RootServerInfo.RootServerInfoBuilder() - .rootServer0(new RootServer0()) - .build() - ) - .build(); -ApiConfiguration.ServerIndexInfo serverIndexInfo = new ApiConfiguration.ServerIndexInfoBuilder() - .rootServerInfoServerIndex(RootServerInfo.ServerIndex.SERVER_0) - .build(); -Duration timeout = Duration.ofSeconds(1L); -Map> defaultHeaders = Map.of("User-Agent", List.of("OpenAPI-JSON-Schema-Generator/1.0.0/java")); -ApiConfiguration apiConfiguration = new ApiConfiguration( - serverInfo - serverIndexInfo, - timeout, - defaultHeaders -); -SchemaConfiguration schemaConfiguration = new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().build()); -FakeobjinqueryGet.Get apiClient = new FakeobjinqueryGet.Get(apiConfiguration, schemaConfiguration); - - -var request = new FakeobjinqueryGet.GetRequestBuilder().build(); - -FakeobjinqueryGetResponses.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; -} -FakeobjinqueryGetResponses.EndpointFakeobjinqueryGetCode200Response castResponse = (FakeobjinqueryGetResponses.EndpointFakeobjinqueryGetCode200Response) response; -``` -### Constructor Summary -| Constructor and Description | -| --------------------------- | -| Get(ApiConfiguration apiConfiguration, SchemaConfiguration schemaConfiguration)
Creates an instance | - -### Method Summary -| Modifier and Type | Method and Description | -| ----------------- | ---------------------- | -| [FakeobjinqueryGetResponses.EndpointResponse](../../paths/fakeobjinquery/get/FakeobjinqueryGetResponses.md#endpointresponse) | get([GetRequest](#getrequest) request) | - -## ObjectInQueryOperation -public interface ObjectInQueryOperation
- -an interface that allows one to call the endpoint using a method named objectInQuery by the operationId - -### Method Summary -| Modifier and Type | Method and Description | -| ----------------- | ---------------------- | -| [FakeobjinqueryGetResponses.EndpointResponse](../../paths/fakeobjinquery/get/FakeobjinqueryGetResponses.md#endpointresponse) | objectInQuery([GetRequest](#getrequest) request) | - -## GetRequest -public static class GetRequest
- -a class that stores the final request inputs - -### Field Summary -| Modifier and Type | Field and Description | -| ----------------- | --------------------- | -| [FakeobjinqueryGetQueryParameters.@Nullable QueryParametersMap](../../paths/fakeobjinquery/get/FakeobjinqueryGetQueryParameters.md#queryparametersmap) | queryParameters
optional | -| [RootServerInfo.@Nullable ServerIndex](../../RootServerInfo.md#serverindex) | serverIndex
optional. Note: this will override the value in apiConfiguration | -| @Nullable Duration | timeout
optional. Note: this will override the value in apiConfiguration | - -## GetRequestBuilder -public static class GetRequestBuilder
- -a builder for request inputs - -### Constructor Summary -| Constructor and Description | -| --------------------------- | -| GetRequestBuilder()
Creates a builder that contains null for all parameters | - -### Method Summary -| Modifier and Type | Method and Description | -| ----------------- | ---------------------- | -| [GetRequest](#getrequest) | build()
Returns the request input used to call an endpoint method | -| [GetRequestBuilder](#getrequestbuilder) | queryParameters([FakeobjinqueryGetQueryParametersQueryParametersMap](../../paths/fakeobjinquery/get/FakeobjinqueryGetQueryParameters.md#queryparametersmap) queryParameters)
sets the optional property | -| [GetRequestBuilder](#getrequestbuilder) | serverIndex([RootServerInfo.ServerIndex](../../RootServerInfo.md#serverindex) serverIndex)
sets the optional property. Note: this will override the value in apiConfiguration | -| [GetRequestBuilder](#getrequestbuilder) | timeout(Duration timeout)
sets the optional property. Note: this will override the value in apiConfiguration | - -[[Back to top]](#top) [[Back to README]](../../../README.md) diff --git a/samples/client/petstore/kotlin/docs/paths/fakeobjinquery/get/FakeobjinqueryGetQueryParameters.md b/samples/client/petstore/kotlin/docs/paths/fakeobjinquery/get/FakeobjinqueryGetQueryParameters.md deleted file mode 100644 index a68a087e940..00000000000 --- a/samples/client/petstore/kotlin/docs/paths/fakeobjinquery/get/FakeobjinqueryGetQueryParameters.md +++ /dev/null @@ -1,258 +0,0 @@ -# FakeobjinqueryGetQueryParameters -public class FakeobjinqueryGetQueryParameters
- -A class that contains necessary nested -- schema classes (which validate payloads), extends JsonSchema -- sealed interfaces which store validated payloads, java version of a sum type -- boxed classes which store validated payloads, sealed permits class implementations -- classes to store validated map payloads, extends FrozenMap -- classes to build inputs for map payloads - -## Nested Class Summary -| Modifier and Type | Class and Description | -| ----------------- | ---------------------- | -| sealed interface | [FakeobjinqueryGetQueryParameters.FakeobjinqueryGetQueryParameters1Boxed](#fakeobjinquerygetqueryparameters1boxed)
sealed interface for validated payloads | -| record | [FakeobjinqueryGetQueryParameters.FakeobjinqueryGetQueryParameters1BoxedMap](#fakeobjinquerygetqueryparameters1boxedmap)
boxed class to store validated Map payloads | -| static class | [FakeobjinqueryGetQueryParameters.FakeobjinqueryGetQueryParameters1](#fakeobjinquerygetqueryparameters1)
schema class | -| static class | [FakeobjinqueryGetQueryParameters.QueryParametersMapBuilder](#queryparametersmapbuilder)
builder for Map payloads | -| static class | [FakeobjinqueryGetQueryParameters.QueryParametersMap](#queryparametersmap)
output class for Map payloads | -| sealed interface | [FakeobjinqueryGetQueryParameters.AdditionalPropertiesBoxed](#additionalpropertiesboxed)
sealed interface for validated payloads | -| record | [FakeobjinqueryGetQueryParameters.AdditionalPropertiesBoxedVoid](#additionalpropertiesboxedvoid)
boxed class to store validated null payloads | -| record | [FakeobjinqueryGetQueryParameters.AdditionalPropertiesBoxedBoolean](#additionalpropertiesboxedboolean)
boxed class to store validated boolean payloads | -| record | [FakeobjinqueryGetQueryParameters.AdditionalPropertiesBoxedNumber](#additionalpropertiesboxednumber)
boxed class to store validated Number payloads | -| record | [FakeobjinqueryGetQueryParameters.AdditionalPropertiesBoxedString](#additionalpropertiesboxedstring)
boxed class to store validated String payloads | -| record | [FakeobjinqueryGetQueryParameters.AdditionalPropertiesBoxedList](#additionalpropertiesboxedlist)
boxed class to store validated List payloads | -| record | [FakeobjinqueryGetQueryParameters.AdditionalPropertiesBoxedMap](#additionalpropertiesboxedmap)
boxed class to store validated Map payloads | -| static class | [FakeobjinqueryGetQueryParameters.AdditionalProperties](#additionalproperties)
schema class | - -## FakeobjinqueryGetQueryParameters1Boxed -public sealed interface FakeobjinqueryGetQueryParameters1Boxed
-permits
-[FakeobjinqueryGetQueryParameters1BoxedMap](#fakeobjinquerygetqueryparameters1boxedmap) - -sealed interface that stores validated payloads using boxed classes - -## FakeobjinqueryGetQueryParameters1BoxedMap -public record FakeobjinqueryGetQueryParameters1BoxedMap
-implements [FakeobjinqueryGetQueryParameters1Boxed](#fakeobjinquerygetqueryparameters1boxed) - -record that stores validated Map payloads, sealed permits implementation - -### Constructor Summary -| Constructor and Description | -| --------------------------- | -| FakeobjinqueryGetQueryParameters1BoxedMap([QueryParametersMap](#queryparametersmap) data)
Creates an instance, private visibility | - -### Method Summary -| Modifier and Type | Method and Description | -| ----------------- | ---------------------- | -| [QueryParametersMap](#queryparametersmap) | data()
validated payload | -| @Nullable Object | getData()
validated payload | - -## FakeobjinqueryGetQueryParameters1 -public static class FakeobjinqueryGetQueryParameters1
-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.fakeobjinquery.get.FakeobjinqueryGetQueryParameters; - -import java.util.Arrays; -import java.util.List; -import java.util.AbstractMap; - -static final SchemaConfiguration configuration = new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().build()); - -// Map validation -FakeobjinqueryGetQueryParameters.QueryParametersMap validatedPayload = - FakeobjinqueryGetQueryParameters.FakeobjinqueryGetQueryParameters1.validate( - new FakeobjinqueryGetQueryParameters.QueryParametersMapBuilder() - .mapBean( - MapUtils.makeMap( - new AbstractMap.SimpleEntry( - "keyword", - "a" - ) - ) - ) - .build(), - configuration -); -``` - -### Field Summary -| Modifier and Type | Field and Description | -| ----------------- | ---------------------- | -| Set> | type = Set.of(Map.class) | -| Map> | properties = Map.ofEntries(
    new PropertyEntry("mapBean", [Schema0.Schema01.class](../../../paths/fakeobjinquery/get/parameters/parameter0/Schema0.md#schema01))
)
| -| Class | additionalProperties = [AdditionalProperties.class](#additionalproperties) | - -### Method Summary -| Modifier and Type | Method and Description | -| ----------------- | ---------------------- | -| [QueryParametersMap](#queryparametersmap) | validate([Map<?, ?>](#queryparametersmapbuilder) arg, SchemaConfiguration configuration) | -| [FakeobjinqueryGetQueryParameters1BoxedMap](#fakeobjinquerygetqueryparameters1boxedmap) | validateAndBox([Map<?, ?>](#queryparametersmapbuilder) arg, SchemaConfiguration configuration) | -| [FakeobjinqueryGetQueryParameters1Boxed](#fakeobjinquerygetqueryparameters1boxed) | validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) | -| @Nullable Object | validate(@Nullable Object arg, SchemaConfiguration configuration) | - -## QueryParametersMapBuilder -public class QueryParametersMapBuilder
-builder for `Map>` - -A class that builds the Map input type - -### Constructor Summary -| Constructor and Description | -| --------------------------- | -| QueryParametersMapBuilder()
Creates a builder that contains an empty map | - -### Method Summary -| Modifier and Type | Method and Description | -| ----------------- | ---------------------- | -| Map> | build()
Returns map input that should be used with Schema.validate | -| [QueryParametersMapBuilder](#queryparametersmapbuilder) | mapBean(Map value) | - -## QueryParametersMap -public static class QueryParametersMap
-extends FrozenMap - -A class to store validated Map payloads - -### Method Summary -| Modifier and Type | Method and Description | -| ----------------- | ---------------------- | -| static [QueryParametersMap](#queryparametersmap) | of([Map>](#queryparametersmapbuilder) arg, SchemaConfiguration configuration) | -| [Schema0.SchemaMap0](../../../paths/fakeobjinquery/get/parameters/parameter0/Schema0.md#schemamap0) | mapBean()
[optional] | - -## 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(Nothing? data)
Creates an instance, private visibility | - -### Method Summary -| Modifier and Type | Method and Description | -| ----------------- | ---------------------- | -| Nothing? | 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/kotlin/docs/paths/fakeobjinquery/get/FakeobjinqueryGetResponses.md b/samples/client/petstore/kotlin/docs/paths/fakeobjinquery/get/FakeobjinqueryGetResponses.md deleted file mode 100644 index 423bb32fe9e..00000000000 --- a/samples/client/petstore/kotlin/docs/paths/fakeobjinquery/get/FakeobjinqueryGetResponses.md +++ /dev/null @@ -1,29 +0,0 @@ -# FakeobjinqueryGetResponses - -public class FakeobjinqueryGetResponses - -A class that contains necessary responses classes -- a sealed interface, EndpointResponse, that stores endpoint responses -- records for each endpoint response - -## Nested Class Summary -| Modifier and Type | Class and Description | -| ----------------- | --------------------- | -| sealed interface | [EndpointResponse](#endpointresponse)
stores the endpoint responses | -| record | [EndpointFakeobjinqueryGetCode200Response](#endpointfakeobjinquerygetcode200response)
the response for 200 | - -## EndpointResponse -public sealed interface EndpointResponse permits
-[EndpointFakeobjinqueryGetCode200Response](#endpointfakeobjinquerygetcode200response) - -a sealed interface that stores endpoint responses - -## EndpointFakeobjinqueryGetCode200Response -public record EndpointFakeobjinqueryGetCode200Response( - HttpResponse response, - Nothing? body, - Nothing? headers -) implements EndpointResponse, ApiResponse
- -a class that stores an endpoint response - diff --git a/samples/client/petstore/kotlin/docs/paths/fakeobjinquery/get/parameters/parameter0/Schema0.md b/samples/client/petstore/kotlin/docs/paths/fakeobjinquery/get/parameters/parameter0/Schema0.md deleted file mode 100644 index a6ee5eee38a..00000000000 --- a/samples/client/petstore/kotlin/docs/paths/fakeobjinquery/get/parameters/parameter0/Schema0.md +++ /dev/null @@ -1,166 +0,0 @@ -# Schema0 -public class Schema0
- -A class that contains necessary nested -- schema classes (which validate payloads), extends JsonSchema -- sealed interfaces which store validated payloads, java version of a sum type -- boxed classes which store validated payloads, sealed permits class implementations -- classes to store validated map payloads, extends FrozenMap -- classes to build inputs for map payloads - -## Nested Class Summary -| Modifier and Type | Class and Description | -| ----------------- | ---------------------- | -| sealed interface | [Schema0.Schema01Boxed](#schema01boxed)
sealed interface for validated payloads | -| record | [Schema0.Schema01BoxedMap](#schema01boxedmap)
boxed class to store validated Map payloads | -| static class | [Schema0.Schema01](#schema01)
schema class | -| static class | [Schema0.SchemaMapBuilder0](#schemamapbuilder0)
builder for Map payloads | -| static class | [Schema0.SchemaMap0](#schemamap0)
output class for Map payloads | -| sealed interface | [Schema0.Keyword0Boxed](#keyword0boxed)
sealed interface for validated payloads | -| record | [Schema0.Keyword0BoxedString](#keyword0boxedstring)
boxed class to store validated String payloads | -| static class | [Schema0.Keyword0](#keyword0)
schema class | - -## Schema01Boxed -public sealed interface Schema01Boxed
-permits
-[Schema01BoxedMap](#schema01boxedmap) - -sealed interface that stores validated payloads using boxed classes - -## Schema01BoxedMap -public record Schema01BoxedMap
-implements [Schema01Boxed](#schema01boxed) - -record that stores validated Map payloads, sealed permits implementation - -### Constructor Summary -| Constructor and Description | -| --------------------------- | -| Schema01BoxedMap([SchemaMap0](#schemamap0) data)
Creates an instance, private visibility | - -### Method Summary -| Modifier and Type | Method and Description | -| ----------------- | ---------------------- | -| [SchemaMap0](#schemamap0) | data()
validated payload | -| @Nullable Object | getData()
validated payload | - -## Schema01 -public static class Schema01
-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.fakeobjinquery.get.parameters.parameter0.Schema0; - -import java.util.Arrays; -import java.util.List; -import java.util.AbstractMap; - -static final SchemaConfiguration configuration = new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().build()); - -// Map validation -Schema0.SchemaMap0 validatedPayload = - Schema0.Schema01.validate( - new Schema0.SchemaMapBuilder0() - .keyword("a") - - .build(), - configuration -); -``` - -### Field Summary -| Modifier and Type | Field and Description | -| ----------------- | ---------------------- | -| Set> | type = Set.of(Map.class) | -| Map> | properties = Map.ofEntries(
    new PropertyEntry("keyword", [Keyword0.class](#keyword0)))
)
| - -### Method Summary -| Modifier and Type | Method and Description | -| ----------------- | ---------------------- | -| [SchemaMap0](#schemamap0) | validate([Map<?, ?>](#schemamapbuilder0) arg, SchemaConfiguration configuration) | -| [Schema01BoxedMap](#schema01boxedmap) | validateAndBox([Map<?, ?>](#schemamapbuilder0) arg, SchemaConfiguration configuration) | -| [Schema01Boxed](#schema01boxed) | validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) | -| @Nullable Object | validate(@Nullable Object arg, SchemaConfiguration configuration) | - -## SchemaMapBuilder0 -public class SchemaMapBuilder0
-builder for `Map` - -A class that builds the Map input type - -### Constructor Summary -| Constructor and Description | -| --------------------------- | -| SchemaMapBuilder0()
Creates a builder that contains an empty map | - -### Method Summary -| Modifier and Type | Method and Description | -| ----------------- | ---------------------- | -| Map | build()
Returns map input that should be used with Schema.validate | -| [SchemaMapBuilder0](#schemamapbuilder0) | keyword(String value) | -| [SchemaMapBuilder0](#schemamapbuilder0) | additionalProperty(String key, Nothing? value) | -| [SchemaMapBuilder0](#schemamapbuilder0) | additionalProperty(String key, boolean value) | -| [SchemaMapBuilder0](#schemamapbuilder0) | additionalProperty(String key, String value) | -| [SchemaMapBuilder0](#schemamapbuilder0) | additionalProperty(String key, int value) | -| [SchemaMapBuilder0](#schemamapbuilder0) | additionalProperty(String key, float value) | -| [SchemaMapBuilder0](#schemamapbuilder0) | additionalProperty(String key, long value) | -| [SchemaMapBuilder0](#schemamapbuilder0) | additionalProperty(String key, double value) | -| [SchemaMapBuilder0](#schemamapbuilder0) | additionalProperty(String key, List value) | -| [SchemaMapBuilder0](#schemamapbuilder0) | additionalProperty(String key, Map value) | - -## SchemaMap0 -public static class SchemaMap0
-extends FrozenMap - -A class to store validated Map payloads - -### Method Summary -| Modifier and Type | Method and Description | -| ----------------- | ---------------------- | -| static [SchemaMap0](#schemamap0) | of([Map](#schemamapbuilder0) arg, SchemaConfiguration configuration) | -| String | keyword()
[optional] | -| @Nullable Object | getAdditionalProperty(String name)
provides type safety for additional properties | - -## Keyword0Boxed -public sealed interface Keyword0Boxed
-permits
-[Keyword0BoxedString](#keyword0boxedstring) - -sealed interface that stores validated payloads using boxed classes - -## Keyword0BoxedString -public record Keyword0BoxedString
-implements [Keyword0Boxed](#keyword0boxed) - -record that stores validated String payloads, sealed permits implementation - -### Constructor Summary -| Constructor and Description | -| --------------------------- | -| Keyword0BoxedString(String data)
Creates an instance, private visibility | - -### Method Summary -| Modifier and Type | Method and Description | -| ----------------- | ---------------------- | -| String | data()
validated payload | -| @Nullable Object | getData()
validated payload | - -## Keyword0 -public static class Keyword0
-extends StringJsonSchema.StringJsonSchema1 - -A schema class that validates payloads - -| Methods Inherited from class org.openapijsonschematools.client.schemas.StringJsonSchema.StringJsonSchema1 | -| ------------------------------------------------------------------ | -| validate | -| validateAndBox | diff --git a/samples/client/petstore/kotlin/docs/paths/fakeobjinquery/get/responses/FakeobjinqueryGetCode200Response.md b/samples/client/petstore/kotlin/docs/paths/fakeobjinquery/get/responses/FakeobjinqueryGetCode200Response.md deleted file mode 100644 index 6ff3fdb9b67..00000000000 --- a/samples/client/petstore/kotlin/docs/paths/fakeobjinquery/get/responses/FakeobjinqueryGetCode200Response.md +++ /dev/null @@ -1,17 +0,0 @@ -# FakeobjinqueryGetCode200Response - -public class FakeobjinqueryGetCode200Response extends [SuccessDescriptionOnly](../../components/responses/SuccessDescriptionOnly.md) - -A class (extended from the $ref class) that contains necessary nested response classes -- a class that extends ResponseDeserializer and is used to deserialize responses - -## Nested Class Summary -| Modifier and Type | Class and Description | -| ----------------- | --------------------- | -| static class | [FakeobjinqueryGetCode200Response.FakeobjinqueryGetCode200Response1](#fakeobjinquerygetcode200response1)
class that deserializes responses | - -## FakeobjinqueryGetCode200Response1 -public static class FakeobjinqueryGetCode200Response1 extends [SuccessDescriptionOnly1](../../components/responses/SuccessDescriptionOnly.md#successdescriptiononly1)
- -a class that deserializes responses, extended from the $ref class - diff --git a/samples/client/petstore/kotlin/docs/paths/fakeparametercollisions1ababselfab/Fakeparametercollisions1ababselfabPost.md b/samples/client/petstore/kotlin/docs/paths/fakeparametercollisions1ababselfab/Fakeparametercollisions1ababselfabPost.md deleted file mode 100644 index 69f3676cb5e..00000000000 --- a/samples/client/petstore/kotlin/docs/paths/fakeparametercollisions1ababselfab/Fakeparametercollisions1ababselfabPost.md +++ /dev/null @@ -1,211 +0,0 @@ -# Fakeparametercollisions1ababselfabPost - -public class Fakeparametercollisions1ababselfabPost - -A class that contains necessary endpoint classes -- a class that calls the endpoint method using the http verb -- a class that calls the endpoint method using the operationId name -- class(es) to store the request inputs -- builder(s) to set the request input data - -## Nested Class Summary -| Modifier and Type | Class and Description | -| ----------------- | --------------------- | -| static class | [Post](#post)
The class that has a post method to call the endpoint | -| interface | [ParameterCollisionsOperation](#parametercollisionsoperation)
The interface that has a parameterCollisions method to call the endpoint | -| static class | [PostRequest](#postrequest)
The final request inputs class | -| static class | [PostNullableRequest](#postnullablerequest)
The initial request inputs class | -| static class | [Post0RequestBuilder](#post0requestbuilder)
A builder for the request input class | -| static class | [PostRequestBuilder](#postrequestbuilder)
A builder for the request input class | - -## Post -public static class Post 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.fakeparametercollisions1ababselfab.post.Fakeparametercollisions1ababselfabPostRequestBody; -import org.openapijsonschematools.client.paths.fakeparametercollisions1ababselfab.post.Fakeparametercollisions1ababselfabPostHeaderParameters; -import org.openapijsonschematools.client.paths.fakeparametercollisions1ababselfab.post.Fakeparametercollisions1ababselfabPostQueryParameters; -import org.openapijsonschematools.client.paths.fakeparametercollisions1ababselfab.post.Fakeparametercollisions1ababselfabPostCookieParameters; -import org.openapijsonschematools.client.RootServerInfo; -import org.openapijsonschematools.client.paths.fakeparametercollisions1ababselfab.post.Fakeparametercollisions1ababselfabPostPathParameters; -import org.openapijsonschematools.client.servers.RootServer0; -import org.openapijsonschematools.client.servers.RootServer1; -import org.openapijsonschematools.client.servers.RootServer2; -import org.openapijsonschematools.client.paths.fakeparametercollisions1ababselfab.post.responses.Fakeparametercollisions1ababselfabPostCode200Response; -import org.openapijsonschematools.client.servers.RootServerInfo; -import org.openapijsonschematools.client.paths.fakeparametercollisions1ababselfab.Fakeparametercollisions1ababselfabPost; -import org.openapijsonschematools.client.paths.fakeparametercollisions1ababselfab.post.Fakeparametercollisions1ababselfabPostResponses; - -import java.io.IOException; -import java.util.Arrays; -import java.util.List; -import java.util.Map; -import java.util.AbstractMap; - -// if you want to use a server that is not SERVER_0 pass it in here and change the ServerIndex input below -ApiConfiguration.ServerInfo serverInfo = new ApiConfiguration.ServerInfoBuilder() - .rootServerInfo( - new RootServerInfo.RootServerInfoBuilder() - .rootServer0(new RootServer0()) - .build() - ) - .build(); -ApiConfiguration.ServerIndexInfo serverIndexInfo = new ApiConfiguration.ServerIndexInfoBuilder() - .rootServerInfoServerIndex(RootServerInfo.ServerIndex.SERVER_0) - .build(); -Duration timeout = Duration.ofSeconds(1L); -Map> defaultHeaders = Map.of("User-Agent", List.of("OpenAPI-JSON-Schema-Generator/1.0.0/java")); -ApiConfiguration apiConfiguration = new ApiConfiguration( - serverInfo - serverIndexInfo, - timeout, - defaultHeaders -); -SchemaConfiguration schemaConfiguration = new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().build()); -Fakeparametercollisions1ababselfabPost.Post apiClient = new Fakeparametercollisions1ababselfabPost.Post(apiConfiguration, schemaConfiguration); - - -// Map validation -Fakeparametercollisions1ababselfabPostPathParameters.PathParametersMap pathParameters = - Fakeparametercollisions1ababselfabPostPathParameters.Fakeparametercollisions1ababselfabPostPathParameters1.validate( - new Fakeparametercollisions1ababselfabPostPathParameters.PathParametersMapBuilder() - .positive1("a") - - .aHyphenMinusB("a") - - .Ab("a") - - .aB("a") - - .self("a") - - .build(), - schemaConfiguration -); - -var request = new Fakeparametercollisions1ababselfabPost.PostRequestBuilder() - .pathParameters(pathParameters) - .build(); - -Fakeparametercollisions1ababselfabPostResponses.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; -} -Fakeparametercollisions1ababselfabPostResponses.EndpointFakeparametercollisions1ababselfabPostCode200Response castResponse = (Fakeparametercollisions1ababselfabPostResponses.EndpointFakeparametercollisions1ababselfabPostCode200Response) response; -Fakeparametercollisions1ababselfabPostCode200Response.ApplicationjsonResponseBody deserializedBody = (Fakeparametercollisions1ababselfabPostCode200Response.ApplicationjsonResponseBody) castResponse.body; -// handle deserialized body here -``` -### Constructor Summary -| Constructor and Description | -| --------------------------- | -| Post(ApiConfiguration apiConfiguration, SchemaConfiguration schemaConfiguration)
Creates an instance | - -### Method Summary -| Modifier and Type | Method and Description | -| ----------------- | ---------------------- | -| [Fakeparametercollisions1ababselfabPostResponses.EndpointResponse](../../paths/fakeparametercollisions1ababselfab/post/Fakeparametercollisions1ababselfabPostResponses.md#endpointresponse) | post([PostRequest](#postrequest) request) | - -## ParameterCollisionsOperation -public interface ParameterCollisionsOperation
- -an interface that allows one to call the endpoint using a method named parameterCollisions by the operationId - -### Method Summary -| Modifier and Type | Method and Description | -| ----------------- | ---------------------- | -| [Fakeparametercollisions1ababselfabPostResponses.EndpointResponse](../../paths/fakeparametercollisions1ababselfab/post/Fakeparametercollisions1ababselfabPostResponses.md#endpointresponse) | parameterCollisions([PostRequest](#postrequest) request) | - -## PostRequest -public static class PostRequest
- -a class that stores the final request inputs - -### Field Summary -| Modifier and Type | Field and Description | -| ----------------- | --------------------- | -| [Fakeparametercollisions1ababselfabPostPathParameters.PathParametersMap](../../paths/fakeparametercollisions1ababselfab/post/Fakeparametercollisions1ababselfabPostPathParameters.md#pathparametersmap) | pathParameters | -| [Fakeparametercollisions1ababselfabPostRequestBody.@Nullable SealedRequestBody](../../paths/fakeparametercollisions1ababselfab/post/Fakeparametercollisions1ababselfabPostRequestBody.md#sealedrequestbody) | requestBody
optional | -| [Fakeparametercollisions1ababselfabPostHeaderParameters.@Nullable HeaderParametersMap](../../paths/fakeparametercollisions1ababselfab/post/Fakeparametercollisions1ababselfabPostHeaderParameters.md#headerparametersmap) | headerParameters
optional | -| [Fakeparametercollisions1ababselfabPostQueryParameters.@Nullable QueryParametersMap](../../paths/fakeparametercollisions1ababselfab/post/Fakeparametercollisions1ababselfabPostQueryParameters.md#queryparametersmap) | queryParameters
optional | -| [Fakeparametercollisions1ababselfabPostCookieParameters.@Nullable CookieParametersMap](../../paths/fakeparametercollisions1ababselfab/post/Fakeparametercollisions1ababselfabPostCookieParameters.md#cookieparametersmap) | cookieParameters
optional | -| [RootServerInfo.@Nullable ServerIndex](../../RootServerInfo.md#serverindex) | serverIndex
optional. Note: this will override the value in apiConfiguration | -| @Nullable Duration | timeout
optional. Note: this will override the value in apiConfiguration | - -## PostNullableRequest -public static class PostNullableRequest
- -a class that stores the initial request inputs - -### Field Summary -| Modifier and Type | Field and Description | -| ----------------- | --------------------- | -| [Fakeparametercollisions1ababselfabPostPathParameters.@Nullable PathParametersMap](../../paths/fakeparametercollisions1ababselfab/post/Fakeparametercollisions1ababselfabPostPathParameters.md#pathparametersmap) | pathParameters | -| [Fakeparametercollisions1ababselfabPostRequestBody.@Nullable SealedRequestBody](../../paths/fakeparametercollisions1ababselfab/post/Fakeparametercollisions1ababselfabPostRequestBody.md#sealedrequestbody) | requestBody | -| [Fakeparametercollisions1ababselfabPostHeaderParameters.@Nullable HeaderParametersMap](../../paths/fakeparametercollisions1ababselfab/post/Fakeparametercollisions1ababselfabPostHeaderParameters.md#headerparametersmap) | headerParameters | -| [Fakeparametercollisions1ababselfabPostQueryParameters.@Nullable QueryParametersMap](../../paths/fakeparametercollisions1ababselfab/post/Fakeparametercollisions1ababselfabPostQueryParameters.md#queryparametersmap) | queryParameters | -| [Fakeparametercollisions1ababselfabPostCookieParameters.@Nullable CookieParametersMap](../../paths/fakeparametercollisions1ababselfab/post/Fakeparametercollisions1ababselfabPostCookieParameters.md#cookieparametersmap) | cookieParameters | -| [RootServerInfo.@Nullable ServerIndex](../../RootServerInfo.md#serverindex) | serverIndex | -| @Nullable Duration | timeout | - -## Post0RequestBuilder -public static class Post0RequestBuilder
- -a builder for request inputs - -### Constructor Summary -| Constructor and Description | -| --------------------------- | -| Post0RequestBuilder(Post0RequestBuilder instance)
Creates a builder that contains the passed instance | - -### Method Summary -| Modifier and Type | Method and Description | -| ----------------- | ---------------------- | -| [PostRequest](#postrequest) | build()
Returns the request input used to call an endpoint method | -| [Post0RequestBuilder](#post0requestbuilder) | requestBody([Fakeparametercollisions1ababselfabPostRequestBody.SealedRequestBody](../../paths/fakeparametercollisions1ababselfab/post/Fakeparametercollisions1ababselfabPostRequestBody.md#sealedrequestbody) requestBody)
sets the optional property | -| [Post0RequestBuilder](#post0requestbuilder) | headerParameters([Fakeparametercollisions1ababselfabPostHeaderParametersHeaderParametersMap](../../paths/fakeparametercollisions1ababselfab/post/Fakeparametercollisions1ababselfabPostHeaderParameters.md#headerparametersmap) headerParameters)
sets the optional property | -| [Post0RequestBuilder](#post0requestbuilder) | queryParameters([Fakeparametercollisions1ababselfabPostQueryParametersQueryParametersMap](../../paths/fakeparametercollisions1ababselfab/post/Fakeparametercollisions1ababselfabPostQueryParameters.md#queryparametersmap) queryParameters)
sets the optional property | -| [Post0RequestBuilder](#post0requestbuilder) | cookieParameters([Fakeparametercollisions1ababselfabPostCookieParametersCookieParametersMap](../../paths/fakeparametercollisions1ababselfab/post/Fakeparametercollisions1ababselfabPostCookieParameters.md#cookieparametersmap) cookieParameters)
sets the optional property | -| [Post0RequestBuilder](#post0requestbuilder) | serverIndex([RootServerInfo.ServerIndex](../../RootServerInfo.md#serverindex) serverIndex)
sets the optional property. Note: this will override the value in apiConfiguration | -| [Post0RequestBuilder](#post0requestbuilder) | timeout(Duration timeout)
sets the optional property. Note: this will override the value in apiConfiguration | - -## PostRequestBuilder -public static class PostRequestBuilder
- -a builder for request inputs - -### Constructor Summary -| Constructor and Description | -| --------------------------- | -| PostRequestBuilder()
Creates a builder that contains null for all parameters | - -### Method Summary -| Modifier and Type | Method and Description | -| ----------------- | ---------------------- | -| [Post0RequestBuilder](#post0requestbuilder) | pathParameters([Fakeparametercollisions1ababselfabPostPathParametersPathParametersMap](../../paths/fakeparametercollisions1ababselfab/post/Fakeparametercollisions1ababselfabPostPathParameters.md#pathparametersmap) pathParameters)
sets the property | - -[[Back to top]](#top) [[Back to README]](../../../README.md) diff --git a/samples/client/petstore/kotlin/docs/paths/fakeparametercollisions1ababselfab/post/Fakeparametercollisions1ababselfabPostCookieParameters.md b/samples/client/petstore/kotlin/docs/paths/fakeparametercollisions1ababselfab/post/Fakeparametercollisions1ababselfabPostCookieParameters.md deleted file mode 100644 index d5abecc77c4..00000000000 --- a/samples/client/petstore/kotlin/docs/paths/fakeparametercollisions1ababselfab/post/Fakeparametercollisions1ababselfabPostCookieParameters.md +++ /dev/null @@ -1,267 +0,0 @@ -# Fakeparametercollisions1ababselfabPostCookieParameters -public class Fakeparametercollisions1ababselfabPostCookieParameters
- -A class that contains necessary nested -- schema classes (which validate payloads), extends JsonSchema -- sealed interfaces which store validated payloads, java version of a sum type -- boxed classes which store validated payloads, sealed permits class implementations -- classes to store validated map payloads, extends FrozenMap -- classes to build inputs for map payloads - -## Nested Class Summary -| Modifier and Type | Class and Description | -| ----------------- | ---------------------- | -| sealed interface | [Fakeparametercollisions1ababselfabPostCookieParameters.Fakeparametercollisions1ababselfabPostCookieParameters1Boxed](#fakeparametercollisions1ababselfabpostcookieparameters1boxed)
sealed interface for validated payloads | -| record | [Fakeparametercollisions1ababselfabPostCookieParameters.Fakeparametercollisions1ababselfabPostCookieParameters1BoxedMap](#fakeparametercollisions1ababselfabpostcookieparameters1boxedmap)
boxed class to store validated Map payloads | -| static class | [Fakeparametercollisions1ababselfabPostCookieParameters.Fakeparametercollisions1ababselfabPostCookieParameters1](#fakeparametercollisions1ababselfabpostcookieparameters1)
schema class | -| static class | [Fakeparametercollisions1ababselfabPostCookieParameters.CookieParametersMapBuilder](#cookieparametersmapbuilder)
builder for Map payloads | -| static class | [Fakeparametercollisions1ababselfabPostCookieParameters.CookieParametersMap](#cookieparametersmap)
output class for Map payloads | -| sealed interface | [Fakeparametercollisions1ababselfabPostCookieParameters.AdditionalPropertiesBoxed](#additionalpropertiesboxed)
sealed interface for validated payloads | -| record | [Fakeparametercollisions1ababselfabPostCookieParameters.AdditionalPropertiesBoxedVoid](#additionalpropertiesboxedvoid)
boxed class to store validated null payloads | -| record | [Fakeparametercollisions1ababselfabPostCookieParameters.AdditionalPropertiesBoxedBoolean](#additionalpropertiesboxedboolean)
boxed class to store validated boolean payloads | -| record | [Fakeparametercollisions1ababselfabPostCookieParameters.AdditionalPropertiesBoxedNumber](#additionalpropertiesboxednumber)
boxed class to store validated Number payloads | -| record | [Fakeparametercollisions1ababselfabPostCookieParameters.AdditionalPropertiesBoxedString](#additionalpropertiesboxedstring)
boxed class to store validated String payloads | -| record | [Fakeparametercollisions1ababselfabPostCookieParameters.AdditionalPropertiesBoxedList](#additionalpropertiesboxedlist)
boxed class to store validated List payloads | -| record | [Fakeparametercollisions1ababselfabPostCookieParameters.AdditionalPropertiesBoxedMap](#additionalpropertiesboxedmap)
boxed class to store validated Map payloads | -| static class | [Fakeparametercollisions1ababselfabPostCookieParameters.AdditionalProperties](#additionalproperties)
schema class | - -## Fakeparametercollisions1ababselfabPostCookieParameters1Boxed -public sealed interface Fakeparametercollisions1ababselfabPostCookieParameters1Boxed
-permits
-[Fakeparametercollisions1ababselfabPostCookieParameters1BoxedMap](#fakeparametercollisions1ababselfabpostcookieparameters1boxedmap) - -sealed interface that stores validated payloads using boxed classes - -## Fakeparametercollisions1ababselfabPostCookieParameters1BoxedMap -public record Fakeparametercollisions1ababselfabPostCookieParameters1BoxedMap
-implements [Fakeparametercollisions1ababselfabPostCookieParameters1Boxed](#fakeparametercollisions1ababselfabpostcookieparameters1boxed) - -record that stores validated Map payloads, sealed permits implementation - -### Constructor Summary -| Constructor and Description | -| --------------------------- | -| Fakeparametercollisions1ababselfabPostCookieParameters1BoxedMap([CookieParametersMap](#cookieparametersmap) data)
Creates an instance, private visibility | - -### Method Summary -| Modifier and Type | Method and Description | -| ----------------- | ---------------------- | -| [CookieParametersMap](#cookieparametersmap) | data()
validated payload | -| @Nullable Object | getData()
validated payload | - -## Fakeparametercollisions1ababselfabPostCookieParameters1 -public static class Fakeparametercollisions1ababselfabPostCookieParameters1
-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.fakeparametercollisions1ababselfab.post.Fakeparametercollisions1ababselfabPostCookieParameters; - -import java.util.Arrays; -import java.util.List; -import java.util.AbstractMap; - -static final SchemaConfiguration configuration = new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().build()); - -// Map validation -Fakeparametercollisions1ababselfabPostCookieParameters.CookieParametersMap validatedPayload = - Fakeparametercollisions1ababselfabPostCookieParameters.Fakeparametercollisions1ababselfabPostCookieParameters1.validate( - new Fakeparametercollisions1ababselfabPostCookieParameters.CookieParametersMapBuilder() - .positive1("a") - - .aB("a") - - .Ab("a") - - .aHyphenMinusB("a") - - .self("a") - - .build(), - configuration -); -``` - -### Field Summary -| Modifier and Type | Field and Description | -| ----------------- | ---------------------- | -| Set> | type = Set.of(Map.class) | -| Map> | properties = Map.ofEntries(
    new PropertyEntry("1", [Schema14.Schema141.class](../../../paths/fakeparametercollisions1ababselfab/post/parameters/parameter14/Schema14.md#schema141)),
    new PropertyEntry("aB", [Schema15.Schema151.class](../../../paths/fakeparametercollisions1ababselfab/post/parameters/parameter15/Schema15.md#schema151)),
    new PropertyEntry("Ab", [Schema16.Schema161.class](../../../paths/fakeparametercollisions1ababselfab/post/parameters/parameter16/Schema16.md#schema161)),
    new PropertyEntry("A-B", [Schema18.Schema181.class](../../../paths/fakeparametercollisions1ababselfab/post/parameters/parameter18/Schema18.md#schema181)),
    new PropertyEntry("self", [Schema17.Schema171.class](../../../paths/fakeparametercollisions1ababselfab/post/parameters/parameter17/Schema17.md#schema171))
)
| -| Class | additionalProperties = [AdditionalProperties.class](#additionalproperties) | - -### Method Summary -| Modifier and Type | Method and Description | -| ----------------- | ---------------------- | -| [CookieParametersMap](#cookieparametersmap) | validate([Map<?, ?>](#cookieparametersmapbuilder) arg, SchemaConfiguration configuration) | -| [Fakeparametercollisions1ababselfabPostCookieParameters1BoxedMap](#fakeparametercollisions1ababselfabpostcookieparameters1boxedmap) | validateAndBox([Map<?, ?>](#cookieparametersmapbuilder) arg, SchemaConfiguration configuration) | -| [Fakeparametercollisions1ababselfabPostCookieParameters1Boxed](#fakeparametercollisions1ababselfabpostcookieparameters1boxed) | validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) | -| @Nullable Object | validate(@Nullable Object arg, SchemaConfiguration configuration) | - -## CookieParametersMapBuilder -public class CookieParametersMapBuilder
-builder for `Map` - -A class that builds the Map input type - -### Constructor Summary -| Constructor and Description | -| --------------------------- | -| CookieParametersMapBuilder()
Creates a builder that contains an empty map | - -### Method Summary -| Modifier and Type | Method and Description | -| ----------------- | ---------------------- | -| Map | build()
Returns map input that should be used with Schema.validate | -| [CookieParametersMapBuilder](#cookieparametersmapbuilder) | positive1(String value) | -| [CookieParametersMapBuilder](#cookieparametersmapbuilder) | aB(String value) | -| [CookieParametersMapBuilder](#cookieparametersmapbuilder) | Ab(String value) | -| [CookieParametersMapBuilder](#cookieparametersmapbuilder) | aHyphenMinusB(String value) | -| [CookieParametersMapBuilder](#cookieparametersmapbuilder) | self(String value) | - -## CookieParametersMap -public static class CookieParametersMap
-extends FrozenMap - -A class to store validated Map payloads - -### Method Summary -| Modifier and Type | Method and Description | -| ----------------- | ---------------------- | -| static [CookieParametersMap](#cookieparametersmap) | of([Map](#cookieparametersmapbuilder) arg, SchemaConfiguration configuration) | -| String | aB()
[optional] | -| String | Ab()
[optional] | -| String | self()
[optional] | -| @Nullable Object | get(String key)
This schema has invalid Java names so this method must be used when you access instance["1"], instance["A-B"], | - -## 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(Nothing? data)
Creates an instance, private visibility | - -### Method Summary -| Modifier and Type | Method and Description | -| ----------------- | ---------------------- | -| Nothing? | 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/kotlin/docs/paths/fakeparametercollisions1ababselfab/post/Fakeparametercollisions1ababselfabPostHeaderParameters.md b/samples/client/petstore/kotlin/docs/paths/fakeparametercollisions1ababselfab/post/Fakeparametercollisions1ababselfabPostHeaderParameters.md deleted file mode 100644 index 10026a181e7..00000000000 --- a/samples/client/petstore/kotlin/docs/paths/fakeparametercollisions1ababselfab/post/Fakeparametercollisions1ababselfabPostHeaderParameters.md +++ /dev/null @@ -1,263 +0,0 @@ -# Fakeparametercollisions1ababselfabPostHeaderParameters -public class Fakeparametercollisions1ababselfabPostHeaderParameters
- -A class that contains necessary nested -- schema classes (which validate payloads), extends JsonSchema -- sealed interfaces which store validated payloads, java version of a sum type -- boxed classes which store validated payloads, sealed permits class implementations -- classes to store validated map payloads, extends FrozenMap -- classes to build inputs for map payloads - -## Nested Class Summary -| Modifier and Type | Class and Description | -| ----------------- | ---------------------- | -| sealed interface | [Fakeparametercollisions1ababselfabPostHeaderParameters.Fakeparametercollisions1ababselfabPostHeaderParameters1Boxed](#fakeparametercollisions1ababselfabpostheaderparameters1boxed)
sealed interface for validated payloads | -| record | [Fakeparametercollisions1ababselfabPostHeaderParameters.Fakeparametercollisions1ababselfabPostHeaderParameters1BoxedMap](#fakeparametercollisions1ababselfabpostheaderparameters1boxedmap)
boxed class to store validated Map payloads | -| static class | [Fakeparametercollisions1ababselfabPostHeaderParameters.Fakeparametercollisions1ababselfabPostHeaderParameters1](#fakeparametercollisions1ababselfabpostheaderparameters1)
schema class | -| static class | [Fakeparametercollisions1ababselfabPostHeaderParameters.HeaderParametersMapBuilder](#headerparametersmapbuilder)
builder for Map payloads | -| static class | [Fakeparametercollisions1ababselfabPostHeaderParameters.HeaderParametersMap](#headerparametersmap)
output class for Map payloads | -| sealed interface | [Fakeparametercollisions1ababselfabPostHeaderParameters.AdditionalPropertiesBoxed](#additionalpropertiesboxed)
sealed interface for validated payloads | -| record | [Fakeparametercollisions1ababselfabPostHeaderParameters.AdditionalPropertiesBoxedVoid](#additionalpropertiesboxedvoid)
boxed class to store validated null payloads | -| record | [Fakeparametercollisions1ababselfabPostHeaderParameters.AdditionalPropertiesBoxedBoolean](#additionalpropertiesboxedboolean)
boxed class to store validated boolean payloads | -| record | [Fakeparametercollisions1ababselfabPostHeaderParameters.AdditionalPropertiesBoxedNumber](#additionalpropertiesboxednumber)
boxed class to store validated Number payloads | -| record | [Fakeparametercollisions1ababselfabPostHeaderParameters.AdditionalPropertiesBoxedString](#additionalpropertiesboxedstring)
boxed class to store validated String payloads | -| record | [Fakeparametercollisions1ababselfabPostHeaderParameters.AdditionalPropertiesBoxedList](#additionalpropertiesboxedlist)
boxed class to store validated List payloads | -| record | [Fakeparametercollisions1ababselfabPostHeaderParameters.AdditionalPropertiesBoxedMap](#additionalpropertiesboxedmap)
boxed class to store validated Map payloads | -| static class | [Fakeparametercollisions1ababselfabPostHeaderParameters.AdditionalProperties](#additionalproperties)
schema class | - -## Fakeparametercollisions1ababselfabPostHeaderParameters1Boxed -public sealed interface Fakeparametercollisions1ababselfabPostHeaderParameters1Boxed
-permits
-[Fakeparametercollisions1ababselfabPostHeaderParameters1BoxedMap](#fakeparametercollisions1ababselfabpostheaderparameters1boxedmap) - -sealed interface that stores validated payloads using boxed classes - -## Fakeparametercollisions1ababselfabPostHeaderParameters1BoxedMap -public record Fakeparametercollisions1ababselfabPostHeaderParameters1BoxedMap
-implements [Fakeparametercollisions1ababselfabPostHeaderParameters1Boxed](#fakeparametercollisions1ababselfabpostheaderparameters1boxed) - -record that stores validated Map payloads, sealed permits implementation - -### Constructor Summary -| Constructor and Description | -| --------------------------- | -| Fakeparametercollisions1ababselfabPostHeaderParameters1BoxedMap([HeaderParametersMap](#headerparametersmap) data)
Creates an instance, private visibility | - -### Method Summary -| Modifier and Type | Method and Description | -| ----------------- | ---------------------- | -| [HeaderParametersMap](#headerparametersmap) | data()
validated payload | -| @Nullable Object | getData()
validated payload | - -## Fakeparametercollisions1ababselfabPostHeaderParameters1 -public static class Fakeparametercollisions1ababselfabPostHeaderParameters1
-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.fakeparametercollisions1ababselfab.post.Fakeparametercollisions1ababselfabPostHeaderParameters; - -import java.util.Arrays; -import java.util.List; -import java.util.AbstractMap; - -static final SchemaConfiguration configuration = new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().build()); - -// Map validation -Fakeparametercollisions1ababselfabPostHeaderParameters.HeaderParametersMap validatedPayload = - Fakeparametercollisions1ababselfabPostHeaderParameters.Fakeparametercollisions1ababselfabPostHeaderParameters1.validate( - new Fakeparametercollisions1ababselfabPostHeaderParameters.HeaderParametersMapBuilder() - .positive1("a") - - .aB("a") - - .aHyphenMinusB("a") - - .self("a") - - .build(), - configuration -); -``` - -### Field Summary -| Modifier and Type | Field and Description | -| ----------------- | ---------------------- | -| Set> | type = Set.of(Map.class) | -| Map> | properties = Map.ofEntries(
    new PropertyEntry("1", [Schema5.Schema51.class](../../../paths/fakeparametercollisions1ababselfab/post/parameters/parameter5/Schema5.md#schema51)),
    new PropertyEntry("aB", [Schema6.Schema61.class](../../../paths/fakeparametercollisions1ababselfab/post/parameters/parameter6/Schema6.md#schema61)),
    new PropertyEntry("A-B", [Schema8.Schema81.class](../../../paths/fakeparametercollisions1ababselfab/post/parameters/parameter8/Schema8.md#schema81)),
    new PropertyEntry("self", [Schema7.Schema71.class](../../../paths/fakeparametercollisions1ababselfab/post/parameters/parameter7/Schema7.md#schema71))
)
| -| Class | additionalProperties = [AdditionalProperties.class](#additionalproperties) | - -### Method Summary -| Modifier and Type | Method and Description | -| ----------------- | ---------------------- | -| [HeaderParametersMap](#headerparametersmap) | validate([Map<?, ?>](#headerparametersmapbuilder) arg, SchemaConfiguration configuration) | -| [Fakeparametercollisions1ababselfabPostHeaderParameters1BoxedMap](#fakeparametercollisions1ababselfabpostheaderparameters1boxedmap) | validateAndBox([Map<?, ?>](#headerparametersmapbuilder) arg, SchemaConfiguration configuration) | -| [Fakeparametercollisions1ababselfabPostHeaderParameters1Boxed](#fakeparametercollisions1ababselfabpostheaderparameters1boxed) | validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) | -| @Nullable Object | validate(@Nullable Object arg, SchemaConfiguration configuration) | - -## HeaderParametersMapBuilder -public class HeaderParametersMapBuilder
-builder for `Map` - -A class that builds the Map input type - -### Constructor Summary -| Constructor and Description | -| --------------------------- | -| HeaderParametersMapBuilder()
Creates a builder that contains an empty map | - -### Method Summary -| Modifier and Type | Method and Description | -| ----------------- | ---------------------- | -| Map | build()
Returns map input that should be used with Schema.validate | -| [HeaderParametersMapBuilder](#headerparametersmapbuilder) | positive1(String value) | -| [HeaderParametersMapBuilder](#headerparametersmapbuilder) | aB(String value) | -| [HeaderParametersMapBuilder](#headerparametersmapbuilder) | aHyphenMinusB(String value) | -| [HeaderParametersMapBuilder](#headerparametersmapbuilder) | self(String value) | - -## HeaderParametersMap -public static class HeaderParametersMap
-extends FrozenMap - -A class to store validated Map payloads - -### Method Summary -| Modifier and Type | Method and Description | -| ----------------- | ---------------------- | -| static [HeaderParametersMap](#headerparametersmap) | of([Map](#headerparametersmapbuilder) arg, SchemaConfiguration configuration) | -| String | aB()
[optional] | -| String | self()
[optional] | -| @Nullable Object | get(String key)
This schema has invalid Java names so this method must be used when you access instance["1"], instance["A-B"], | - -## 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(Nothing? data)
Creates an instance, private visibility | - -### Method Summary -| Modifier and Type | Method and Description | -| ----------------- | ---------------------- | -| Nothing? | 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/kotlin/docs/paths/fakeparametercollisions1ababselfab/post/Fakeparametercollisions1ababselfabPostPathParameters.md b/samples/client/petstore/kotlin/docs/paths/fakeparametercollisions1ababselfab/post/Fakeparametercollisions1ababselfabPostPathParameters.md deleted file mode 100644 index 6200137f2c2..00000000000 --- a/samples/client/petstore/kotlin/docs/paths/fakeparametercollisions1ababselfab/post/Fakeparametercollisions1ababselfabPostPathParameters.md +++ /dev/null @@ -1,808 +0,0 @@ -# Fakeparametercollisions1ababselfabPostPathParameters -public class Fakeparametercollisions1ababselfabPostPathParameters
- -A class that contains necessary nested -- schema classes (which validate payloads), extends JsonSchema -- sealed interfaces which store validated payloads, java version of a sum type -- boxed classes which store validated payloads, sealed permits class implementations -- classes to store validated map payloads, extends FrozenMap -- classes to build inputs for map payloads - -## Nested Class Summary -| Modifier and Type | Class and Description | -| ----------------- | ---------------------- | -| sealed interface | [Fakeparametercollisions1ababselfabPostPathParameters.Fakeparametercollisions1ababselfabPostPathParameters1Boxed](#fakeparametercollisions1ababselfabpostpathparameters1boxed)
sealed interface for validated payloads | -| record | [Fakeparametercollisions1ababselfabPostPathParameters.Fakeparametercollisions1ababselfabPostPathParameters1BoxedMap](#fakeparametercollisions1ababselfabpostpathparameters1boxedmap)
boxed class to store validated Map payloads | -| static class | [Fakeparametercollisions1ababselfabPostPathParameters.Fakeparametercollisions1ababselfabPostPathParameters1](#fakeparametercollisions1ababselfabpostpathparameters1)
schema class | -| static class | [Fakeparametercollisions1ababselfabPostPathParameters.PathParametersMapBuilder](#pathparametersmapbuilder)
builder for Map payloads | -| static class | [Fakeparametercollisions1ababselfabPostPathParameters.PathParametersMap](#pathparametersmap)
output class for Map payloads | -| sealed interface | [Fakeparametercollisions1ababselfabPostPathParameters.AdditionalPropertiesBoxed](#additionalpropertiesboxed)
sealed interface for validated payloads | -| record | [Fakeparametercollisions1ababselfabPostPathParameters.AdditionalPropertiesBoxedVoid](#additionalpropertiesboxedvoid)
boxed class to store validated null payloads | -| record | [Fakeparametercollisions1ababselfabPostPathParameters.AdditionalPropertiesBoxedBoolean](#additionalpropertiesboxedboolean)
boxed class to store validated boolean payloads | -| record | [Fakeparametercollisions1ababselfabPostPathParameters.AdditionalPropertiesBoxedNumber](#additionalpropertiesboxednumber)
boxed class to store validated Number payloads | -| record | [Fakeparametercollisions1ababselfabPostPathParameters.AdditionalPropertiesBoxedString](#additionalpropertiesboxedstring)
boxed class to store validated String payloads | -| record | [Fakeparametercollisions1ababselfabPostPathParameters.AdditionalPropertiesBoxedList](#additionalpropertiesboxedlist)
boxed class to store validated List payloads | -| record | [Fakeparametercollisions1ababselfabPostPathParameters.AdditionalPropertiesBoxedMap](#additionalpropertiesboxedmap)
boxed class to store validated Map payloads | -| static class | [Fakeparametercollisions1ababselfabPostPathParameters.AdditionalProperties](#additionalproperties)
schema class | - -## Fakeparametercollisions1ababselfabPostPathParameters1Boxed -public sealed interface Fakeparametercollisions1ababselfabPostPathParameters1Boxed
-permits
-[Fakeparametercollisions1ababselfabPostPathParameters1BoxedMap](#fakeparametercollisions1ababselfabpostpathparameters1boxedmap) - -sealed interface that stores validated payloads using boxed classes - -## Fakeparametercollisions1ababselfabPostPathParameters1BoxedMap -public record Fakeparametercollisions1ababselfabPostPathParameters1BoxedMap
-implements [Fakeparametercollisions1ababselfabPostPathParameters1Boxed](#fakeparametercollisions1ababselfabpostpathparameters1boxed) - -record that stores validated Map payloads, sealed permits implementation - -### Constructor Summary -| Constructor and Description | -| --------------------------- | -| Fakeparametercollisions1ababselfabPostPathParameters1BoxedMap([PathParametersMap](#pathparametersmap) data)
Creates an instance, private visibility | - -### Method Summary -| Modifier and Type | Method and Description | -| ----------------- | ---------------------- | -| [PathParametersMap](#pathparametersmap) | data()
validated payload | -| @Nullable Object | getData()
validated payload | - -## Fakeparametercollisions1ababselfabPostPathParameters1 -public static class Fakeparametercollisions1ababselfabPostPathParameters1
-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.fakeparametercollisions1ababselfab.post.Fakeparametercollisions1ababselfabPostPathParameters; - -import java.util.Arrays; -import java.util.List; -import java.util.AbstractMap; - -static final SchemaConfiguration configuration = new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().build()); - -// Map validation -Fakeparametercollisions1ababselfabPostPathParameters.PathParametersMap validatedPayload = - Fakeparametercollisions1ababselfabPostPathParameters.Fakeparametercollisions1ababselfabPostPathParameters1.validate( - new Fakeparametercollisions1ababselfabPostPathParameters.PathParametersMapBuilder() - .positive1("a") - - .aHyphenMinusB("a") - - .Ab("a") - - .aB("a") - - .self("a") - - .build(), - configuration -); -``` - -### Field Summary -| Modifier and Type | Field and Description | -| ----------------- | ---------------------- | -| Set> | type = Set.of(Map.class) | -| Map> | properties = Map.ofEntries(
    new PropertyEntry("1", [Schema9.Schema91.class](../../../paths/fakeparametercollisions1ababselfab/post/parameters/parameter9/Schema9.md#schema91)),
    new PropertyEntry("aB", [Schema10.Schema101.class](../../../paths/fakeparametercollisions1ababselfab/post/parameters/parameter10/Schema10.md#schema101)),
    new PropertyEntry("Ab", [Schema11.Schema111.class](../../../paths/fakeparametercollisions1ababselfab/post/parameters/parameter11/Schema11.md#schema111)),
    new PropertyEntry("A-B", [Schema13.Schema131.class](../../../paths/fakeparametercollisions1ababselfab/post/parameters/parameter13/Schema13.md#schema131)),
    new PropertyEntry("self", [Schema12.Schema121.class](../../../paths/fakeparametercollisions1ababselfab/post/parameters/parameter12/Schema12.md#schema121))
)
| -| Set | required = Set.of(
    "1",
    "A-B",
    "Ab",
    "aB",
    "self"
)
| -| Class | additionalProperties = [AdditionalProperties.class](#additionalproperties) | - -### Method Summary -| Modifier and Type | Method and Description | -| ----------------- | ---------------------- | -| [PathParametersMap](#pathparametersmap) | validate([Map<?, ?>](#pathparametersmapbuilder) arg, SchemaConfiguration configuration) | -| [Fakeparametercollisions1ababselfabPostPathParameters1BoxedMap](#fakeparametercollisions1ababselfabpostpathparameters1boxedmap) | validateAndBox([Map<?, ?>](#pathparametersmapbuilder) arg, SchemaConfiguration configuration) | -| [Fakeparametercollisions1ababselfabPostPathParameters1Boxed](#fakeparametercollisions1ababselfabpostpathparameters1boxed) | validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) | -| @Nullable Object | validate(@Nullable Object arg, SchemaConfiguration configuration) | - -## PathParametersMap00000Builder -public class PathParametersMap00000Builder
-builder for `Map` - -A class that builds the Map input type - -### Constructor Summary -| Constructor and Description | -| --------------------------- | -| PathParametersMap00000Builder(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 | - -## PathParametersMap00001Builder -public class PathParametersMap00001Builder
-builder for `Map` - -A class that builds the Map input type - -### Constructor Summary -| Constructor and Description | -| --------------------------- | -| PathParametersMap00001Builder(Map instance)
Creates a builder that contains the passed instance | - -### Method Summary -| Modifier and Type | Method and Description | -| ----------------- | ---------------------- | -| [PathParametersMap00000Builder](#pathparametersmap00000builder) | self(String value) | - -## PathParametersMap00010Builder -public class PathParametersMap00010Builder
-builder for `Map` - -A class that builds the Map input type - -### Constructor Summary -| Constructor and Description | -| --------------------------- | -| PathParametersMap00010Builder(Map instance)
Creates a builder that contains the passed instance | - -### Method Summary -| Modifier and Type | Method and Description | -| ----------------- | ---------------------- | -| [PathParametersMap00000Builder](#pathparametersmap00000builder) | aB(String value) | - -## PathParametersMap00011Builder -public class PathParametersMap00011Builder
-builder for `Map` - -A class that builds the Map input type - -### Constructor Summary -| Constructor and Description | -| --------------------------- | -| PathParametersMap00011Builder(Map instance)
Creates a builder that contains the passed instance | - -### Method Summary -| Modifier and Type | Method and Description | -| ----------------- | ---------------------- | -| [PathParametersMap00001Builder](#pathparametersmap00001builder) | aB(String value) | -| [PathParametersMap00010Builder](#pathparametersmap00010builder) | self(String value) | - -## PathParametersMap00100Builder -public class PathParametersMap00100Builder
-builder for `Map` - -A class that builds the Map input type - -### Constructor Summary -| Constructor and Description | -| --------------------------- | -| PathParametersMap00100Builder(Map instance)
Creates a builder that contains the passed instance | - -### Method Summary -| Modifier and Type | Method and Description | -| ----------------- | ---------------------- | -| [PathParametersMap00000Builder](#pathparametersmap00000builder) | Ab(String value) | - -## PathParametersMap00101Builder -public class PathParametersMap00101Builder
-builder for `Map` - -A class that builds the Map input type - -### Constructor Summary -| Constructor and Description | -| --------------------------- | -| PathParametersMap00101Builder(Map instance)
Creates a builder that contains the passed instance | - -### Method Summary -| Modifier and Type | Method and Description | -| ----------------- | ---------------------- | -| [PathParametersMap00001Builder](#pathparametersmap00001builder) | Ab(String value) | -| [PathParametersMap00100Builder](#pathparametersmap00100builder) | self(String value) | - -## PathParametersMap00110Builder -public class PathParametersMap00110Builder
-builder for `Map` - -A class that builds the Map input type - -### Constructor Summary -| Constructor and Description | -| --------------------------- | -| PathParametersMap00110Builder(Map instance)
Creates a builder that contains the passed instance | - -### Method Summary -| Modifier and Type | Method and Description | -| ----------------- | ---------------------- | -| [PathParametersMap00010Builder](#pathparametersmap00010builder) | Ab(String value) | -| [PathParametersMap00100Builder](#pathparametersmap00100builder) | aB(String value) | - -## PathParametersMap00111Builder -public class PathParametersMap00111Builder
-builder for `Map` - -A class that builds the Map input type - -### Constructor Summary -| Constructor and Description | -| --------------------------- | -| PathParametersMap00111Builder(Map instance)
Creates a builder that contains the passed instance | - -### Method Summary -| Modifier and Type | Method and Description | -| ----------------- | ---------------------- | -| [PathParametersMap00011Builder](#pathparametersmap00011builder) | Ab(String value) | -| [PathParametersMap00101Builder](#pathparametersmap00101builder) | aB(String value) | -| [PathParametersMap00110Builder](#pathparametersmap00110builder) | self(String value) | - -## PathParametersMap01000Builder -public class PathParametersMap01000Builder
-builder for `Map` - -A class that builds the Map input type - -### Constructor Summary -| Constructor and Description | -| --------------------------- | -| PathParametersMap01000Builder(Map instance)
Creates a builder that contains the passed instance | - -### Method Summary -| Modifier and Type | Method and Description | -| ----------------- | ---------------------- | -| [PathParametersMap00000Builder](#pathparametersmap00000builder) | aHyphenMinusB(String value) | - -## PathParametersMap01001Builder -public class PathParametersMap01001Builder
-builder for `Map` - -A class that builds the Map input type - -### Constructor Summary -| Constructor and Description | -| --------------------------- | -| PathParametersMap01001Builder(Map instance)
Creates a builder that contains the passed instance | - -### Method Summary -| Modifier and Type | Method and Description | -| ----------------- | ---------------------- | -| [PathParametersMap00001Builder](#pathparametersmap00001builder) | aHyphenMinusB(String value) | -| [PathParametersMap01000Builder](#pathparametersmap01000builder) | self(String value) | - -## PathParametersMap01010Builder -public class PathParametersMap01010Builder
-builder for `Map` - -A class that builds the Map input type - -### Constructor Summary -| Constructor and Description | -| --------------------------- | -| PathParametersMap01010Builder(Map instance)
Creates a builder that contains the passed instance | - -### Method Summary -| Modifier and Type | Method and Description | -| ----------------- | ---------------------- | -| [PathParametersMap00010Builder](#pathparametersmap00010builder) | aHyphenMinusB(String value) | -| [PathParametersMap01000Builder](#pathparametersmap01000builder) | aB(String value) | - -## PathParametersMap01011Builder -public class PathParametersMap01011Builder
-builder for `Map` - -A class that builds the Map input type - -### Constructor Summary -| Constructor and Description | -| --------------------------- | -| PathParametersMap01011Builder(Map instance)
Creates a builder that contains the passed instance | - -### Method Summary -| Modifier and Type | Method and Description | -| ----------------- | ---------------------- | -| [PathParametersMap00011Builder](#pathparametersmap00011builder) | aHyphenMinusB(String value) | -| [PathParametersMap01001Builder](#pathparametersmap01001builder) | aB(String value) | -| [PathParametersMap01010Builder](#pathparametersmap01010builder) | self(String value) | - -## PathParametersMap01100Builder -public class PathParametersMap01100Builder
-builder for `Map` - -A class that builds the Map input type - -### Constructor Summary -| Constructor and Description | -| --------------------------- | -| PathParametersMap01100Builder(Map instance)
Creates a builder that contains the passed instance | - -### Method Summary -| Modifier and Type | Method and Description | -| ----------------- | ---------------------- | -| [PathParametersMap00100Builder](#pathparametersmap00100builder) | aHyphenMinusB(String value) | -| [PathParametersMap01000Builder](#pathparametersmap01000builder) | Ab(String value) | - -## PathParametersMap01101Builder -public class PathParametersMap01101Builder
-builder for `Map` - -A class that builds the Map input type - -### Constructor Summary -| Constructor and Description | -| --------------------------- | -| PathParametersMap01101Builder(Map instance)
Creates a builder that contains the passed instance | - -### Method Summary -| Modifier and Type | Method and Description | -| ----------------- | ---------------------- | -| [PathParametersMap00101Builder](#pathparametersmap00101builder) | aHyphenMinusB(String value) | -| [PathParametersMap01001Builder](#pathparametersmap01001builder) | Ab(String value) | -| [PathParametersMap01100Builder](#pathparametersmap01100builder) | self(String value) | - -## PathParametersMap01110Builder -public class PathParametersMap01110Builder
-builder for `Map` - -A class that builds the Map input type - -### Constructor Summary -| Constructor and Description | -| --------------------------- | -| PathParametersMap01110Builder(Map instance)
Creates a builder that contains the passed instance | - -### Method Summary -| Modifier and Type | Method and Description | -| ----------------- | ---------------------- | -| [PathParametersMap00110Builder](#pathparametersmap00110builder) | aHyphenMinusB(String value) | -| [PathParametersMap01010Builder](#pathparametersmap01010builder) | Ab(String value) | -| [PathParametersMap01100Builder](#pathparametersmap01100builder) | aB(String value) | - -## PathParametersMap01111Builder -public class PathParametersMap01111Builder
-builder for `Map` - -A class that builds the Map input type - -### Constructor Summary -| Constructor and Description | -| --------------------------- | -| PathParametersMap01111Builder(Map instance)
Creates a builder that contains the passed instance | - -### Method Summary -| Modifier and Type | Method and Description | -| ----------------- | ---------------------- | -| [PathParametersMap00111Builder](#pathparametersmap00111builder) | aHyphenMinusB(String value) | -| [PathParametersMap01011Builder](#pathparametersmap01011builder) | Ab(String value) | -| [PathParametersMap01101Builder](#pathparametersmap01101builder) | aB(String value) | -| [PathParametersMap01110Builder](#pathparametersmap01110builder) | self(String value) | - -## PathParametersMap10000Builder -public class PathParametersMap10000Builder
-builder for `Map` - -A class that builds the Map input type - -### Constructor Summary -| Constructor and Description | -| --------------------------- | -| PathParametersMap10000Builder(Map instance)
Creates a builder that contains the passed instance | - -### Method Summary -| Modifier and Type | Method and Description | -| ----------------- | ---------------------- | -| [PathParametersMap00000Builder](#pathparametersmap00000builder) | positive1(String value) | - -## PathParametersMap10001Builder -public class PathParametersMap10001Builder
-builder for `Map` - -A class that builds the Map input type - -### Constructor Summary -| Constructor and Description | -| --------------------------- | -| PathParametersMap10001Builder(Map instance)
Creates a builder that contains the passed instance | - -### Method Summary -| Modifier and Type | Method and Description | -| ----------------- | ---------------------- | -| [PathParametersMap00001Builder](#pathparametersmap00001builder) | positive1(String value) | -| [PathParametersMap10000Builder](#pathparametersmap10000builder) | self(String value) | - -## PathParametersMap10010Builder -public class PathParametersMap10010Builder
-builder for `Map` - -A class that builds the Map input type - -### Constructor Summary -| Constructor and Description | -| --------------------------- | -| PathParametersMap10010Builder(Map instance)
Creates a builder that contains the passed instance | - -### Method Summary -| Modifier and Type | Method and Description | -| ----------------- | ---------------------- | -| [PathParametersMap00010Builder](#pathparametersmap00010builder) | positive1(String value) | -| [PathParametersMap10000Builder](#pathparametersmap10000builder) | aB(String value) | - -## PathParametersMap10011Builder -public class PathParametersMap10011Builder
-builder for `Map` - -A class that builds the Map input type - -### Constructor Summary -| Constructor and Description | -| --------------------------- | -| PathParametersMap10011Builder(Map instance)
Creates a builder that contains the passed instance | - -### Method Summary -| Modifier and Type | Method and Description | -| ----------------- | ---------------------- | -| [PathParametersMap00011Builder](#pathparametersmap00011builder) | positive1(String value) | -| [PathParametersMap10001Builder](#pathparametersmap10001builder) | aB(String value) | -| [PathParametersMap10010Builder](#pathparametersmap10010builder) | self(String value) | - -## PathParametersMap10100Builder -public class PathParametersMap10100Builder
-builder for `Map` - -A class that builds the Map input type - -### Constructor Summary -| Constructor and Description | -| --------------------------- | -| PathParametersMap10100Builder(Map instance)
Creates a builder that contains the passed instance | - -### Method Summary -| Modifier and Type | Method and Description | -| ----------------- | ---------------------- | -| [PathParametersMap00100Builder](#pathparametersmap00100builder) | positive1(String value) | -| [PathParametersMap10000Builder](#pathparametersmap10000builder) | Ab(String value) | - -## PathParametersMap10101Builder -public class PathParametersMap10101Builder
-builder for `Map` - -A class that builds the Map input type - -### Constructor Summary -| Constructor and Description | -| --------------------------- | -| PathParametersMap10101Builder(Map instance)
Creates a builder that contains the passed instance | - -### Method Summary -| Modifier and Type | Method and Description | -| ----------------- | ---------------------- | -| [PathParametersMap00101Builder](#pathparametersmap00101builder) | positive1(String value) | -| [PathParametersMap10001Builder](#pathparametersmap10001builder) | Ab(String value) | -| [PathParametersMap10100Builder](#pathparametersmap10100builder) | self(String value) | - -## PathParametersMap10110Builder -public class PathParametersMap10110Builder
-builder for `Map` - -A class that builds the Map input type - -### Constructor Summary -| Constructor and Description | -| --------------------------- | -| PathParametersMap10110Builder(Map instance)
Creates a builder that contains the passed instance | - -### Method Summary -| Modifier and Type | Method and Description | -| ----------------- | ---------------------- | -| [PathParametersMap00110Builder](#pathparametersmap00110builder) | positive1(String value) | -| [PathParametersMap10010Builder](#pathparametersmap10010builder) | Ab(String value) | -| [PathParametersMap10100Builder](#pathparametersmap10100builder) | aB(String value) | - -## PathParametersMap10111Builder -public class PathParametersMap10111Builder
-builder for `Map` - -A class that builds the Map input type - -### Constructor Summary -| Constructor and Description | -| --------------------------- | -| PathParametersMap10111Builder(Map instance)
Creates a builder that contains the passed instance | - -### Method Summary -| Modifier and Type | Method and Description | -| ----------------- | ---------------------- | -| [PathParametersMap00111Builder](#pathparametersmap00111builder) | positive1(String value) | -| [PathParametersMap10011Builder](#pathparametersmap10011builder) | Ab(String value) | -| [PathParametersMap10101Builder](#pathparametersmap10101builder) | aB(String value) | -| [PathParametersMap10110Builder](#pathparametersmap10110builder) | self(String value) | - -## PathParametersMap11000Builder -public class PathParametersMap11000Builder
-builder for `Map` - -A class that builds the Map input type - -### Constructor Summary -| Constructor and Description | -| --------------------------- | -| PathParametersMap11000Builder(Map instance)
Creates a builder that contains the passed instance | - -### Method Summary -| Modifier and Type | Method and Description | -| ----------------- | ---------------------- | -| [PathParametersMap01000Builder](#pathparametersmap01000builder) | positive1(String value) | -| [PathParametersMap10000Builder](#pathparametersmap10000builder) | aHyphenMinusB(String value) | - -## PathParametersMap11001Builder -public class PathParametersMap11001Builder
-builder for `Map` - -A class that builds the Map input type - -### Constructor Summary -| Constructor and Description | -| --------------------------- | -| PathParametersMap11001Builder(Map instance)
Creates a builder that contains the passed instance | - -### Method Summary -| Modifier and Type | Method and Description | -| ----------------- | ---------------------- | -| [PathParametersMap01001Builder](#pathparametersmap01001builder) | positive1(String value) | -| [PathParametersMap10001Builder](#pathparametersmap10001builder) | aHyphenMinusB(String value) | -| [PathParametersMap11000Builder](#pathparametersmap11000builder) | self(String value) | - -## PathParametersMap11010Builder -public class PathParametersMap11010Builder
-builder for `Map` - -A class that builds the Map input type - -### Constructor Summary -| Constructor and Description | -| --------------------------- | -| PathParametersMap11010Builder(Map instance)
Creates a builder that contains the passed instance | - -### Method Summary -| Modifier and Type | Method and Description | -| ----------------- | ---------------------- | -| [PathParametersMap01010Builder](#pathparametersmap01010builder) | positive1(String value) | -| [PathParametersMap10010Builder](#pathparametersmap10010builder) | aHyphenMinusB(String value) | -| [PathParametersMap11000Builder](#pathparametersmap11000builder) | aB(String value) | - -## PathParametersMap11011Builder -public class PathParametersMap11011Builder
-builder for `Map` - -A class that builds the Map input type - -### Constructor Summary -| Constructor and Description | -| --------------------------- | -| PathParametersMap11011Builder(Map instance)
Creates a builder that contains the passed instance | - -### Method Summary -| Modifier and Type | Method and Description | -| ----------------- | ---------------------- | -| [PathParametersMap01011Builder](#pathparametersmap01011builder) | positive1(String value) | -| [PathParametersMap10011Builder](#pathparametersmap10011builder) | aHyphenMinusB(String value) | -| [PathParametersMap11001Builder](#pathparametersmap11001builder) | aB(String value) | -| [PathParametersMap11010Builder](#pathparametersmap11010builder) | self(String value) | - -## PathParametersMap11100Builder -public class PathParametersMap11100Builder
-builder for `Map` - -A class that builds the Map input type - -### Constructor Summary -| Constructor and Description | -| --------------------------- | -| PathParametersMap11100Builder(Map instance)
Creates a builder that contains the passed instance | - -### Method Summary -| Modifier and Type | Method and Description | -| ----------------- | ---------------------- | -| [PathParametersMap01100Builder](#pathparametersmap01100builder) | positive1(String value) | -| [PathParametersMap10100Builder](#pathparametersmap10100builder) | aHyphenMinusB(String value) | -| [PathParametersMap11000Builder](#pathparametersmap11000builder) | Ab(String value) | - -## PathParametersMap11101Builder -public class PathParametersMap11101Builder
-builder for `Map` - -A class that builds the Map input type - -### Constructor Summary -| Constructor and Description | -| --------------------------- | -| PathParametersMap11101Builder(Map instance)
Creates a builder that contains the passed instance | - -### Method Summary -| Modifier and Type | Method and Description | -| ----------------- | ---------------------- | -| [PathParametersMap01101Builder](#pathparametersmap01101builder) | positive1(String value) | -| [PathParametersMap10101Builder](#pathparametersmap10101builder) | aHyphenMinusB(String value) | -| [PathParametersMap11001Builder](#pathparametersmap11001builder) | Ab(String value) | -| [PathParametersMap11100Builder](#pathparametersmap11100builder) | self(String value) | - -## PathParametersMap11110Builder -public class PathParametersMap11110Builder
-builder for `Map` - -A class that builds the Map input type - -### Constructor Summary -| Constructor and Description | -| --------------------------- | -| PathParametersMap11110Builder(Map instance)
Creates a builder that contains the passed instance | - -### Method Summary -| Modifier and Type | Method and Description | -| ----------------- | ---------------------- | -| [PathParametersMap01110Builder](#pathparametersmap01110builder) | positive1(String value) | -| [PathParametersMap10110Builder](#pathparametersmap10110builder) | aHyphenMinusB(String value) | -| [PathParametersMap11010Builder](#pathparametersmap11010builder) | Ab(String value) | -| [PathParametersMap11100Builder](#pathparametersmap11100builder) | aB(String value) | - -## PathParametersMapBuilder -public class PathParametersMapBuilder
-builder for `Map` - -A class that builds the Map input type - -### Constructor Summary -| Constructor and Description | -| --------------------------- | -| PathParametersMapBuilder()
Creates a builder that contains an empty map | - -### Method Summary -| Modifier and Type | Method and Description | -| ----------------- | ---------------------- | -| [PathParametersMap01111Builder](#pathparametersmap01111builder) | positive1(String value) | -| [PathParametersMap10111Builder](#pathparametersmap10111builder) | aHyphenMinusB(String value) | -| [PathParametersMap11011Builder](#pathparametersmap11011builder) | Ab(String value) | -| [PathParametersMap11101Builder](#pathparametersmap11101builder) | aB(String value) | -| [PathParametersMap11110Builder](#pathparametersmap11110builder) | self(String value) | - -## PathParametersMap -public static class PathParametersMap
-extends FrozenMap - -A class to store validated Map payloads - -### Method Summary -| Modifier and Type | Method and Description | -| ----------------- | ---------------------- | -| static [PathParametersMap](#pathparametersmap) | of([Map](#pathparametersmapbuilder) arg, SchemaConfiguration configuration) | -| String | Ab()
| -| String | aB()
| -| String | self()
| -| @Nullable Object | get(String key)
This schema has invalid Java names so this method must be used when you access instance["1"], instance["A-B"], | - -## 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(Nothing? data)
Creates an instance, private visibility | - -### Method Summary -| Modifier and Type | Method and Description | -| ----------------- | ---------------------- | -| Nothing? | 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/kotlin/docs/paths/fakeparametercollisions1ababselfab/post/Fakeparametercollisions1ababselfabPostQueryParameters.md b/samples/client/petstore/kotlin/docs/paths/fakeparametercollisions1ababselfab/post/Fakeparametercollisions1ababselfabPostQueryParameters.md deleted file mode 100644 index a491db22458..00000000000 --- a/samples/client/petstore/kotlin/docs/paths/fakeparametercollisions1ababselfab/post/Fakeparametercollisions1ababselfabPostQueryParameters.md +++ /dev/null @@ -1,267 +0,0 @@ -# Fakeparametercollisions1ababselfabPostQueryParameters -public class Fakeparametercollisions1ababselfabPostQueryParameters
- -A class that contains necessary nested -- schema classes (which validate payloads), extends JsonSchema -- sealed interfaces which store validated payloads, java version of a sum type -- boxed classes which store validated payloads, sealed permits class implementations -- classes to store validated map payloads, extends FrozenMap -- classes to build inputs for map payloads - -## Nested Class Summary -| Modifier and Type | Class and Description | -| ----------------- | ---------------------- | -| sealed interface | [Fakeparametercollisions1ababselfabPostQueryParameters.Fakeparametercollisions1ababselfabPostQueryParameters1Boxed](#fakeparametercollisions1ababselfabpostqueryparameters1boxed)
sealed interface for validated payloads | -| record | [Fakeparametercollisions1ababselfabPostQueryParameters.Fakeparametercollisions1ababselfabPostQueryParameters1BoxedMap](#fakeparametercollisions1ababselfabpostqueryparameters1boxedmap)
boxed class to store validated Map payloads | -| static class | [Fakeparametercollisions1ababselfabPostQueryParameters.Fakeparametercollisions1ababselfabPostQueryParameters1](#fakeparametercollisions1ababselfabpostqueryparameters1)
schema class | -| static class | [Fakeparametercollisions1ababselfabPostQueryParameters.QueryParametersMapBuilder](#queryparametersmapbuilder)
builder for Map payloads | -| static class | [Fakeparametercollisions1ababselfabPostQueryParameters.QueryParametersMap](#queryparametersmap)
output class for Map payloads | -| sealed interface | [Fakeparametercollisions1ababselfabPostQueryParameters.AdditionalPropertiesBoxed](#additionalpropertiesboxed)
sealed interface for validated payloads | -| record | [Fakeparametercollisions1ababselfabPostQueryParameters.AdditionalPropertiesBoxedVoid](#additionalpropertiesboxedvoid)
boxed class to store validated null payloads | -| record | [Fakeparametercollisions1ababselfabPostQueryParameters.AdditionalPropertiesBoxedBoolean](#additionalpropertiesboxedboolean)
boxed class to store validated boolean payloads | -| record | [Fakeparametercollisions1ababselfabPostQueryParameters.AdditionalPropertiesBoxedNumber](#additionalpropertiesboxednumber)
boxed class to store validated Number payloads | -| record | [Fakeparametercollisions1ababselfabPostQueryParameters.AdditionalPropertiesBoxedString](#additionalpropertiesboxedstring)
boxed class to store validated String payloads | -| record | [Fakeparametercollisions1ababselfabPostQueryParameters.AdditionalPropertiesBoxedList](#additionalpropertiesboxedlist)
boxed class to store validated List payloads | -| record | [Fakeparametercollisions1ababselfabPostQueryParameters.AdditionalPropertiesBoxedMap](#additionalpropertiesboxedmap)
boxed class to store validated Map payloads | -| static class | [Fakeparametercollisions1ababselfabPostQueryParameters.AdditionalProperties](#additionalproperties)
schema class | - -## Fakeparametercollisions1ababselfabPostQueryParameters1Boxed -public sealed interface Fakeparametercollisions1ababselfabPostQueryParameters1Boxed
-permits
-[Fakeparametercollisions1ababselfabPostQueryParameters1BoxedMap](#fakeparametercollisions1ababselfabpostqueryparameters1boxedmap) - -sealed interface that stores validated payloads using boxed classes - -## Fakeparametercollisions1ababselfabPostQueryParameters1BoxedMap -public record Fakeparametercollisions1ababselfabPostQueryParameters1BoxedMap
-implements [Fakeparametercollisions1ababselfabPostQueryParameters1Boxed](#fakeparametercollisions1ababselfabpostqueryparameters1boxed) - -record that stores validated Map payloads, sealed permits implementation - -### Constructor Summary -| Constructor and Description | -| --------------------------- | -| Fakeparametercollisions1ababselfabPostQueryParameters1BoxedMap([QueryParametersMap](#queryparametersmap) data)
Creates an instance, private visibility | - -### Method Summary -| Modifier and Type | Method and Description | -| ----------------- | ---------------------- | -| [QueryParametersMap](#queryparametersmap) | data()
validated payload | -| @Nullable Object | getData()
validated payload | - -## Fakeparametercollisions1ababselfabPostQueryParameters1 -public static class Fakeparametercollisions1ababselfabPostQueryParameters1
-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.fakeparametercollisions1ababselfab.post.Fakeparametercollisions1ababselfabPostQueryParameters; - -import java.util.Arrays; -import java.util.List; -import java.util.AbstractMap; - -static final SchemaConfiguration configuration = new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().build()); - -// Map validation -Fakeparametercollisions1ababselfabPostQueryParameters.QueryParametersMap validatedPayload = - Fakeparametercollisions1ababselfabPostQueryParameters.Fakeparametercollisions1ababselfabPostQueryParameters1.validate( - new Fakeparametercollisions1ababselfabPostQueryParameters.QueryParametersMapBuilder() - .positive1("a") - - .aB("a") - - .Ab("a") - - .aHyphenMinusB("a") - - .self("a") - - .build(), - configuration -); -``` - -### Field Summary -| Modifier and Type | Field and Description | -| ----------------- | ---------------------- | -| Set> | type = Set.of(Map.class) | -| Map> | properties = Map.ofEntries(
    new PropertyEntry("1", [Schema0.Schema01.class](../../../paths/fakeparametercollisions1ababselfab/post/parameters/parameter0/Schema0.md#schema01)),
    new PropertyEntry("aB", [Schema1.Schema11.class](../../../paths/fakeparametercollisions1ababselfab/post/parameters/parameter1/Schema1.md#schema11)),
    new PropertyEntry("Ab", [Schema2.Schema21.class](../../../paths/fakeparametercollisions1ababselfab/post/parameters/parameter2/Schema2.md#schema21)),
    new PropertyEntry("A-B", [Schema4.Schema41.class](../../../paths/fakeparametercollisions1ababselfab/post/parameters/parameter4/Schema4.md#schema41)),
    new PropertyEntry("self", [Schema3.Schema31.class](../../../paths/fakeparametercollisions1ababselfab/post/parameters/parameter3/Schema3.md#schema31))
)
| -| Class | additionalProperties = [AdditionalProperties.class](#additionalproperties) | - -### Method Summary -| Modifier and Type | Method and Description | -| ----------------- | ---------------------- | -| [QueryParametersMap](#queryparametersmap) | validate([Map<?, ?>](#queryparametersmapbuilder) arg, SchemaConfiguration configuration) | -| [Fakeparametercollisions1ababselfabPostQueryParameters1BoxedMap](#fakeparametercollisions1ababselfabpostqueryparameters1boxedmap) | validateAndBox([Map<?, ?>](#queryparametersmapbuilder) arg, SchemaConfiguration configuration) | -| [Fakeparametercollisions1ababselfabPostQueryParameters1Boxed](#fakeparametercollisions1ababselfabpostqueryparameters1boxed) | validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) | -| @Nullable Object | validate(@Nullable Object arg, SchemaConfiguration configuration) | - -## QueryParametersMapBuilder -public class QueryParametersMapBuilder
-builder for `Map` - -A class that builds the Map input type - -### Constructor Summary -| Constructor and Description | -| --------------------------- | -| QueryParametersMapBuilder()
Creates a builder that contains an empty map | - -### Method Summary -| Modifier and Type | Method and Description | -| ----------------- | ---------------------- | -| Map | build()
Returns map input that should be used with Schema.validate | -| [QueryParametersMapBuilder](#queryparametersmapbuilder) | positive1(String value) | -| [QueryParametersMapBuilder](#queryparametersmapbuilder) | aB(String value) | -| [QueryParametersMapBuilder](#queryparametersmapbuilder) | Ab(String value) | -| [QueryParametersMapBuilder](#queryparametersmapbuilder) | aHyphenMinusB(String value) | -| [QueryParametersMapBuilder](#queryparametersmapbuilder) | self(String value) | - -## QueryParametersMap -public static class QueryParametersMap
-extends FrozenMap - -A class to store validated Map payloads - -### Method Summary -| Modifier and Type | Method and Description | -| ----------------- | ---------------------- | -| static [QueryParametersMap](#queryparametersmap) | of([Map](#queryparametersmapbuilder) arg, SchemaConfiguration configuration) | -| String | aB()
[optional] | -| String | Ab()
[optional] | -| String | self()
[optional] | -| @Nullable Object | get(String key)
This schema has invalid Java names so this method must be used when you access instance["1"], instance["A-B"], | - -## 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(Nothing? data)
Creates an instance, private visibility | - -### Method Summary -| Modifier and Type | Method and Description | -| ----------------- | ---------------------- | -| Nothing? | 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/kotlin/docs/paths/fakeparametercollisions1ababselfab/post/Fakeparametercollisions1ababselfabPostRequestBody.md b/samples/client/petstore/kotlin/docs/paths/fakeparametercollisions1ababselfab/post/Fakeparametercollisions1ababselfabPostRequestBody.md deleted file mode 100644 index f28eaffd37c..00000000000 --- a/samples/client/petstore/kotlin/docs/paths/fakeparametercollisions1ababselfab/post/Fakeparametercollisions1ababselfabPostRequestBody.md +++ /dev/null @@ -1,90 +0,0 @@ -# Fakeparametercollisions1ababselfabPostRequestBody - -public class Fakeparametercollisions1ababselfabPostRequestBody - -A class that contains necessary nested request body classes -- SealedMediaType, a sealed interface which contains all the schema/encoding info for each contentType -- records which implement SealedMediaType, the concrete media types -- a class that extends RequestBodySerializer and is used to serialize input SealedRequestBody instances -- SealedRequestBody, a sealed interface which contains all the contentType/schema input types -- records which implement SealedRequestBody, the concrete request body types - -## Nested Class Summary -| Modifier and Type | Class and Description | -| ----------------- | --------------------- | -| sealed interface | [Fakeparametercollisions1ababselfabPostRequestBody.SealedMediaType](#sealedmediatype)
media type sealed interface | -| record | [Fakeparametercollisions1ababselfabPostRequestBody.ApplicationjsonMediaType](#applicationjsonmediatype)
record storing schema + encoding for a specific contentType | -| static class | [Fakeparametercollisions1ababselfabPostRequestBody.Fakeparametercollisions1ababselfabPostRequestBody1](#fakeparametercollisions1ababselfabpostrequestbody1)
class that serializes request bodies | -| sealed interface | [Fakeparametercollisions1ababselfabPostRequestBody.SealedRequestBody](#sealedrequestbody)
request body sealed interface | -| record | [Fakeparametercollisions1ababselfabPostRequestBody.ApplicationjsonRequestBody](#applicationjsonrequestbody)
implements sealed interface to store request body input | - -## SealedMediaType -public sealed interface SealedMediaType
-permits
-[ApplicationjsonMediaType](#applicationjsonmediatype) - -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), Nothing?> - -class storing schema info for a specific contentType - -### Constructor Summary -| Constructor and Description | -| --------------------------- | -| ApplicationjsonMediaType()
Creates an instance | - -### 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 | -| Nothing? | encoding()
the encoding info | - -## Fakeparametercollisions1ababselfabPostRequestBody1 -public static class Fakeparametercollisions1ababselfabPostRequestBody1
- -a class that serializes SealedRequestBody request bodies - -### Constructor Summary -| Constructor and Description | -| --------------------------- | -| Fakeparametercollisions1ababselfabPostRequestBody1()
Creates an instance | - -### Field Summary -| Modifier and Type | Field and Description | -| ----------------- | --------------------- | -| boolean | required = false
whether the request body is required | -| 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 | -| ----------------- | ---------------------- | -| SerializedRequestBody | serialize([SealedRequestBody](#sealedrequestbody) requestBody)
called by endpoint when creating request body bytes | - -## SealedRequestBody -public sealed interface SealedRequestBody
-permits
-[ApplicationjsonRequestBody](#applicationjsonrequestbody) - -sealed interface that stores request contentType + validated schema data - -## ApplicationjsonRequestBody -public record ApplicationjsonRequestBody
-implements [SealedRequestBody](#sealedrequestbody),
-GenericRequestBody
- -A record class to store request body input for contentType="application/json" - -### Constructor Summary -| Constructor and Description | -| --------------------------- | -| ApplicationjsonRequestBody(ApplicationjsonSchema.AnyTypeJsonSchema1Boxed body)
Creates an instance | - -### Method Summary -| Modifier and Type | Method and Description | -| ----------------- | ---------------------- | -| String | contentType()
always returns "application/json" | -| ApplicationjsonSchema.AnyTypeJsonSchema1Boxed | body()
returns the body passed in in the constructor | diff --git a/samples/client/petstore/kotlin/docs/paths/fakeparametercollisions1ababselfab/post/Fakeparametercollisions1ababselfabPostResponses.md b/samples/client/petstore/kotlin/docs/paths/fakeparametercollisions1ababselfab/post/Fakeparametercollisions1ababselfabPostResponses.md deleted file mode 100644 index 9dbfaf17ffa..00000000000 --- a/samples/client/petstore/kotlin/docs/paths/fakeparametercollisions1ababselfab/post/Fakeparametercollisions1ababselfabPostResponses.md +++ /dev/null @@ -1,29 +0,0 @@ -# Fakeparametercollisions1ababselfabPostResponses - -public class Fakeparametercollisions1ababselfabPostResponses - -A class that contains necessary responses classes -- a sealed interface, EndpointResponse, that stores endpoint responses -- records for each endpoint response - -## Nested Class Summary -| Modifier and Type | Class and Description | -| ----------------- | --------------------- | -| sealed interface | [EndpointResponse](#endpointresponse)
stores the endpoint responses | -| record | [EndpointFakeparametercollisions1ababselfabPostCode200Response](#endpointfakeparametercollisions1ababselfabpostcode200response)
the response for 200 | - -## EndpointResponse -public sealed interface EndpointResponse permits
-[EndpointFakeparametercollisions1ababselfabPostCode200Response](#endpointfakeparametercollisions1ababselfabpostcode200response) - -a sealed interface that stores endpoint responses - -## EndpointFakeparametercollisions1ababselfabPostCode200Response -public record EndpointFakeparametercollisions1ababselfabPostCode200Response( - HttpResponse response, - [Fakeparametercollisions1ababselfabPostCode200Response.SealedResponseBody](../../../paths/fakeparametercollisions1ababselfab/post/responses/Fakeparametercollisions1ababselfabPostCode200Response.md#sealedresponsebody) body, - Nothing? headers -) implements EndpointResponse, ApiResponse
- -a class that stores an endpoint response - diff --git a/samples/client/petstore/kotlin/docs/paths/fakeparametercollisions1ababselfab/post/parameters/parameter0/Schema0.md b/samples/client/petstore/kotlin/docs/paths/fakeparametercollisions1ababselfab/post/parameters/parameter0/Schema0.md deleted file mode 100644 index 9ff90e0bc35..00000000000 --- a/samples/client/petstore/kotlin/docs/paths/fakeparametercollisions1ababselfab/post/parameters/parameter0/Schema0.md +++ /dev/null @@ -1,49 +0,0 @@ -# Schema0 -public class Schema0
- -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 - -## Nested Class Summary -| Modifier and Type | Class and Description | -| ----------------- | ---------------------- | -| sealed interface | [Schema0.Schema01Boxed](#schema01boxed)
sealed interface for validated payloads | -| record | [Schema0.Schema01BoxedString](#schema01boxedstring)
boxed class to store validated String payloads | -| static class | [Schema0.Schema01](#schema01)
schema class | - -## Schema01Boxed -public sealed interface Schema01Boxed
-permits
-[Schema01BoxedString](#schema01boxedstring) - -sealed interface that stores validated payloads using boxed classes - -## Schema01BoxedString -public record Schema01BoxedString
-implements [Schema01Boxed](#schema01boxed) - -record that stores validated String payloads, sealed permits implementation - -### Constructor Summary -| Constructor and Description | -| --------------------------- | -| Schema01BoxedString(String data)
Creates an instance, private visibility | - -### Method Summary -| Modifier and Type | Method and Description | -| ----------------- | ---------------------- | -| String | data()
validated payload | -| @Nullable Object | getData()
validated payload | - -## Schema01 -public static class Schema01
-extends StringJsonSchema.StringJsonSchema1 - -A schema class that validates payloads - -| Methods Inherited from class org.openapijsonschematools.client.schemas.StringJsonSchema.StringJsonSchema1 | -| ------------------------------------------------------------------ | -| validate | -| validateAndBox | diff --git a/samples/client/petstore/kotlin/docs/paths/fakeparametercollisions1ababselfab/post/parameters/parameter1/Schema1.md b/samples/client/petstore/kotlin/docs/paths/fakeparametercollisions1ababselfab/post/parameters/parameter1/Schema1.md deleted file mode 100644 index 63ec3a884fc..00000000000 --- a/samples/client/petstore/kotlin/docs/paths/fakeparametercollisions1ababselfab/post/parameters/parameter1/Schema1.md +++ /dev/null @@ -1,49 +0,0 @@ -# Schema1 -public class Schema1
- -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 - -## Nested Class Summary -| Modifier and Type | Class and Description | -| ----------------- | ---------------------- | -| sealed interface | [Schema1.Schema11Boxed](#schema11boxed)
sealed interface for validated payloads | -| record | [Schema1.Schema11BoxedString](#schema11boxedstring)
boxed class to store validated String payloads | -| static class | [Schema1.Schema11](#schema11)
schema class | - -## Schema11Boxed -public sealed interface Schema11Boxed
-permits
-[Schema11BoxedString](#schema11boxedstring) - -sealed interface that stores validated payloads using boxed classes - -## Schema11BoxedString -public record Schema11BoxedString
-implements [Schema11Boxed](#schema11boxed) - -record that stores validated String payloads, sealed permits implementation - -### Constructor Summary -| Constructor and Description | -| --------------------------- | -| Schema11BoxedString(String data)
Creates an instance, private visibility | - -### Method Summary -| Modifier and Type | Method and Description | -| ----------------- | ---------------------- | -| String | data()
validated payload | -| @Nullable Object | getData()
validated payload | - -## Schema11 -public static class Schema11
-extends StringJsonSchema.StringJsonSchema1 - -A schema class that validates payloads - -| Methods Inherited from class org.openapijsonschematools.client.schemas.StringJsonSchema.StringJsonSchema1 | -| ------------------------------------------------------------------ | -| validate | -| validateAndBox | diff --git a/samples/client/petstore/kotlin/docs/paths/fakeparametercollisions1ababselfab/post/parameters/parameter10/Schema10.md b/samples/client/petstore/kotlin/docs/paths/fakeparametercollisions1ababselfab/post/parameters/parameter10/Schema10.md deleted file mode 100644 index f2313e921f9..00000000000 --- a/samples/client/petstore/kotlin/docs/paths/fakeparametercollisions1ababselfab/post/parameters/parameter10/Schema10.md +++ /dev/null @@ -1,49 +0,0 @@ -# Schema10 -public class Schema10
- -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 - -## Nested Class Summary -| Modifier and Type | Class and Description | -| ----------------- | ---------------------- | -| sealed interface | [Schema10.Schema101Boxed](#schema101boxed)
sealed interface for validated payloads | -| record | [Schema10.Schema101BoxedString](#schema101boxedstring)
boxed class to store validated String payloads | -| static class | [Schema10.Schema101](#schema101)
schema class | - -## Schema101Boxed -public sealed interface Schema101Boxed
-permits
-[Schema101BoxedString](#schema101boxedstring) - -sealed interface that stores validated payloads using boxed classes - -## Schema101BoxedString -public record Schema101BoxedString
-implements [Schema101Boxed](#schema101boxed) - -record that stores validated String payloads, sealed permits implementation - -### Constructor Summary -| Constructor and Description | -| --------------------------- | -| Schema101BoxedString(String data)
Creates an instance, private visibility | - -### Method Summary -| Modifier and Type | Method and Description | -| ----------------- | ---------------------- | -| String | data()
validated payload | -| @Nullable Object | getData()
validated payload | - -## Schema101 -public static class Schema101
-extends StringJsonSchema.StringJsonSchema1 - -A schema class that validates payloads - -| Methods Inherited from class org.openapijsonschematools.client.schemas.StringJsonSchema.StringJsonSchema1 | -| ------------------------------------------------------------------ | -| validate | -| validateAndBox | diff --git a/samples/client/petstore/kotlin/docs/paths/fakeparametercollisions1ababselfab/post/parameters/parameter11/Schema11.md b/samples/client/petstore/kotlin/docs/paths/fakeparametercollisions1ababselfab/post/parameters/parameter11/Schema11.md deleted file mode 100644 index c309cbd677b..00000000000 --- a/samples/client/petstore/kotlin/docs/paths/fakeparametercollisions1ababselfab/post/parameters/parameter11/Schema11.md +++ /dev/null @@ -1,49 +0,0 @@ -# Schema11 -public class Schema11
- -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 - -## Nested Class Summary -| Modifier and Type | Class and Description | -| ----------------- | ---------------------- | -| sealed interface | [Schema11.Schema111Boxed](#schema111boxed)
sealed interface for validated payloads | -| record | [Schema11.Schema111BoxedString](#schema111boxedstring)
boxed class to store validated String payloads | -| static class | [Schema11.Schema111](#schema111)
schema class | - -## Schema111Boxed -public sealed interface Schema111Boxed
-permits
-[Schema111BoxedString](#schema111boxedstring) - -sealed interface that stores validated payloads using boxed classes - -## Schema111BoxedString -public record Schema111BoxedString
-implements [Schema111Boxed](#schema111boxed) - -record that stores validated String payloads, sealed permits implementation - -### Constructor Summary -| Constructor and Description | -| --------------------------- | -| Schema111BoxedString(String data)
Creates an instance, private visibility | - -### Method Summary -| Modifier and Type | Method and Description | -| ----------------- | ---------------------- | -| String | data()
validated payload | -| @Nullable Object | getData()
validated payload | - -## Schema111 -public static class Schema111
-extends StringJsonSchema.StringJsonSchema1 - -A schema class that validates payloads - -| Methods Inherited from class org.openapijsonschematools.client.schemas.StringJsonSchema.StringJsonSchema1 | -| ------------------------------------------------------------------ | -| validate | -| validateAndBox | diff --git a/samples/client/petstore/kotlin/docs/paths/fakeparametercollisions1ababselfab/post/parameters/parameter12/Schema12.md b/samples/client/petstore/kotlin/docs/paths/fakeparametercollisions1ababselfab/post/parameters/parameter12/Schema12.md deleted file mode 100644 index fa969e69734..00000000000 --- a/samples/client/petstore/kotlin/docs/paths/fakeparametercollisions1ababselfab/post/parameters/parameter12/Schema12.md +++ /dev/null @@ -1,49 +0,0 @@ -# Schema12 -public class Schema12
- -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 - -## Nested Class Summary -| Modifier and Type | Class and Description | -| ----------------- | ---------------------- | -| sealed interface | [Schema12.Schema121Boxed](#schema121boxed)
sealed interface for validated payloads | -| record | [Schema12.Schema121BoxedString](#schema121boxedstring)
boxed class to store validated String payloads | -| static class | [Schema12.Schema121](#schema121)
schema class | - -## Schema121Boxed -public sealed interface Schema121Boxed
-permits
-[Schema121BoxedString](#schema121boxedstring) - -sealed interface that stores validated payloads using boxed classes - -## Schema121BoxedString -public record Schema121BoxedString
-implements [Schema121Boxed](#schema121boxed) - -record that stores validated String payloads, sealed permits implementation - -### Constructor Summary -| Constructor and Description | -| --------------------------- | -| Schema121BoxedString(String data)
Creates an instance, private visibility | - -### Method Summary -| Modifier and Type | Method and Description | -| ----------------- | ---------------------- | -| String | data()
validated payload | -| @Nullable Object | getData()
validated payload | - -## Schema121 -public static class Schema121
-extends StringJsonSchema.StringJsonSchema1 - -A schema class that validates payloads - -| Methods Inherited from class org.openapijsonschematools.client.schemas.StringJsonSchema.StringJsonSchema1 | -| ------------------------------------------------------------------ | -| validate | -| validateAndBox | diff --git a/samples/client/petstore/kotlin/docs/paths/fakeparametercollisions1ababselfab/post/parameters/parameter13/Schema13.md b/samples/client/petstore/kotlin/docs/paths/fakeparametercollisions1ababselfab/post/parameters/parameter13/Schema13.md deleted file mode 100644 index 8b6ce934c35..00000000000 --- a/samples/client/petstore/kotlin/docs/paths/fakeparametercollisions1ababselfab/post/parameters/parameter13/Schema13.md +++ /dev/null @@ -1,49 +0,0 @@ -# Schema13 -public class Schema13
- -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 - -## Nested Class Summary -| Modifier and Type | Class and Description | -| ----------------- | ---------------------- | -| sealed interface | [Schema13.Schema131Boxed](#schema131boxed)
sealed interface for validated payloads | -| record | [Schema13.Schema131BoxedString](#schema131boxedstring)
boxed class to store validated String payloads | -| static class | [Schema13.Schema131](#schema131)
schema class | - -## Schema131Boxed -public sealed interface Schema131Boxed
-permits
-[Schema131BoxedString](#schema131boxedstring) - -sealed interface that stores validated payloads using boxed classes - -## Schema131BoxedString -public record Schema131BoxedString
-implements [Schema131Boxed](#schema131boxed) - -record that stores validated String payloads, sealed permits implementation - -### Constructor Summary -| Constructor and Description | -| --------------------------- | -| Schema131BoxedString(String data)
Creates an instance, private visibility | - -### Method Summary -| Modifier and Type | Method and Description | -| ----------------- | ---------------------- | -| String | data()
validated payload | -| @Nullable Object | getData()
validated payload | - -## Schema131 -public static class Schema131
-extends StringJsonSchema.StringJsonSchema1 - -A schema class that validates payloads - -| Methods Inherited from class org.openapijsonschematools.client.schemas.StringJsonSchema.StringJsonSchema1 | -| ------------------------------------------------------------------ | -| validate | -| validateAndBox | diff --git a/samples/client/petstore/kotlin/docs/paths/fakeparametercollisions1ababselfab/post/parameters/parameter14/Schema14.md b/samples/client/petstore/kotlin/docs/paths/fakeparametercollisions1ababselfab/post/parameters/parameter14/Schema14.md deleted file mode 100644 index b6987c8c80f..00000000000 --- a/samples/client/petstore/kotlin/docs/paths/fakeparametercollisions1ababselfab/post/parameters/parameter14/Schema14.md +++ /dev/null @@ -1,49 +0,0 @@ -# Schema14 -public class Schema14
- -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 - -## Nested Class Summary -| Modifier and Type | Class and Description | -| ----------------- | ---------------------- | -| sealed interface | [Schema14.Schema141Boxed](#schema141boxed)
sealed interface for validated payloads | -| record | [Schema14.Schema141BoxedString](#schema141boxedstring)
boxed class to store validated String payloads | -| static class | [Schema14.Schema141](#schema141)
schema class | - -## Schema141Boxed -public sealed interface Schema141Boxed
-permits
-[Schema141BoxedString](#schema141boxedstring) - -sealed interface that stores validated payloads using boxed classes - -## Schema141BoxedString -public record Schema141BoxedString
-implements [Schema141Boxed](#schema141boxed) - -record that stores validated String payloads, sealed permits implementation - -### Constructor Summary -| Constructor and Description | -| --------------------------- | -| Schema141BoxedString(String data)
Creates an instance, private visibility | - -### Method Summary -| Modifier and Type | Method and Description | -| ----------------- | ---------------------- | -| String | data()
validated payload | -| @Nullable Object | getData()
validated payload | - -## Schema141 -public static class Schema141
-extends StringJsonSchema.StringJsonSchema1 - -A schema class that validates payloads - -| Methods Inherited from class org.openapijsonschematools.client.schemas.StringJsonSchema.StringJsonSchema1 | -| ------------------------------------------------------------------ | -| validate | -| validateAndBox | diff --git a/samples/client/petstore/kotlin/docs/paths/fakeparametercollisions1ababselfab/post/parameters/parameter15/Schema15.md b/samples/client/petstore/kotlin/docs/paths/fakeparametercollisions1ababselfab/post/parameters/parameter15/Schema15.md deleted file mode 100644 index 272a98b600d..00000000000 --- a/samples/client/petstore/kotlin/docs/paths/fakeparametercollisions1ababselfab/post/parameters/parameter15/Schema15.md +++ /dev/null @@ -1,49 +0,0 @@ -# Schema15 -public class Schema15
- -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 - -## Nested Class Summary -| Modifier and Type | Class and Description | -| ----------------- | ---------------------- | -| sealed interface | [Schema15.Schema151Boxed](#schema151boxed)
sealed interface for validated payloads | -| record | [Schema15.Schema151BoxedString](#schema151boxedstring)
boxed class to store validated String payloads | -| static class | [Schema15.Schema151](#schema151)
schema class | - -## Schema151Boxed -public sealed interface Schema151Boxed
-permits
-[Schema151BoxedString](#schema151boxedstring) - -sealed interface that stores validated payloads using boxed classes - -## Schema151BoxedString -public record Schema151BoxedString
-implements [Schema151Boxed](#schema151boxed) - -record that stores validated String payloads, sealed permits implementation - -### Constructor Summary -| Constructor and Description | -| --------------------------- | -| Schema151BoxedString(String data)
Creates an instance, private visibility | - -### Method Summary -| Modifier and Type | Method and Description | -| ----------------- | ---------------------- | -| String | data()
validated payload | -| @Nullable Object | getData()
validated payload | - -## Schema151 -public static class Schema151
-extends StringJsonSchema.StringJsonSchema1 - -A schema class that validates payloads - -| Methods Inherited from class org.openapijsonschematools.client.schemas.StringJsonSchema.StringJsonSchema1 | -| ------------------------------------------------------------------ | -| validate | -| validateAndBox | diff --git a/samples/client/petstore/kotlin/docs/paths/fakeparametercollisions1ababselfab/post/parameters/parameter16/Schema16.md b/samples/client/petstore/kotlin/docs/paths/fakeparametercollisions1ababselfab/post/parameters/parameter16/Schema16.md deleted file mode 100644 index 059eeb943a7..00000000000 --- a/samples/client/petstore/kotlin/docs/paths/fakeparametercollisions1ababselfab/post/parameters/parameter16/Schema16.md +++ /dev/null @@ -1,49 +0,0 @@ -# Schema16 -public class Schema16
- -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 - -## Nested Class Summary -| Modifier and Type | Class and Description | -| ----------------- | ---------------------- | -| sealed interface | [Schema16.Schema161Boxed](#schema161boxed)
sealed interface for validated payloads | -| record | [Schema16.Schema161BoxedString](#schema161boxedstring)
boxed class to store validated String payloads | -| static class | [Schema16.Schema161](#schema161)
schema class | - -## Schema161Boxed -public sealed interface Schema161Boxed
-permits
-[Schema161BoxedString](#schema161boxedstring) - -sealed interface that stores validated payloads using boxed classes - -## Schema161BoxedString -public record Schema161BoxedString
-implements [Schema161Boxed](#schema161boxed) - -record that stores validated String payloads, sealed permits implementation - -### Constructor Summary -| Constructor and Description | -| --------------------------- | -| Schema161BoxedString(String data)
Creates an instance, private visibility | - -### Method Summary -| Modifier and Type | Method and Description | -| ----------------- | ---------------------- | -| String | data()
validated payload | -| @Nullable Object | getData()
validated payload | - -## Schema161 -public static class Schema161
-extends StringJsonSchema.StringJsonSchema1 - -A schema class that validates payloads - -| Methods Inherited from class org.openapijsonschematools.client.schemas.StringJsonSchema.StringJsonSchema1 | -| ------------------------------------------------------------------ | -| validate | -| validateAndBox | diff --git a/samples/client/petstore/kotlin/docs/paths/fakeparametercollisions1ababselfab/post/parameters/parameter17/Schema17.md b/samples/client/petstore/kotlin/docs/paths/fakeparametercollisions1ababselfab/post/parameters/parameter17/Schema17.md deleted file mode 100644 index 4bf4ae7e510..00000000000 --- a/samples/client/petstore/kotlin/docs/paths/fakeparametercollisions1ababselfab/post/parameters/parameter17/Schema17.md +++ /dev/null @@ -1,49 +0,0 @@ -# Schema17 -public class Schema17
- -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 - -## Nested Class Summary -| Modifier and Type | Class and Description | -| ----------------- | ---------------------- | -| sealed interface | [Schema17.Schema171Boxed](#schema171boxed)
sealed interface for validated payloads | -| record | [Schema17.Schema171BoxedString](#schema171boxedstring)
boxed class to store validated String payloads | -| static class | [Schema17.Schema171](#schema171)
schema class | - -## Schema171Boxed -public sealed interface Schema171Boxed
-permits
-[Schema171BoxedString](#schema171boxedstring) - -sealed interface that stores validated payloads using boxed classes - -## Schema171BoxedString -public record Schema171BoxedString
-implements [Schema171Boxed](#schema171boxed) - -record that stores validated String payloads, sealed permits implementation - -### Constructor Summary -| Constructor and Description | -| --------------------------- | -| Schema171BoxedString(String data)
Creates an instance, private visibility | - -### Method Summary -| Modifier and Type | Method and Description | -| ----------------- | ---------------------- | -| String | data()
validated payload | -| @Nullable Object | getData()
validated payload | - -## Schema171 -public static class Schema171
-extends StringJsonSchema.StringJsonSchema1 - -A schema class that validates payloads - -| Methods Inherited from class org.openapijsonschematools.client.schemas.StringJsonSchema.StringJsonSchema1 | -| ------------------------------------------------------------------ | -| validate | -| validateAndBox | diff --git a/samples/client/petstore/kotlin/docs/paths/fakeparametercollisions1ababselfab/post/parameters/parameter18/Schema18.md b/samples/client/petstore/kotlin/docs/paths/fakeparametercollisions1ababselfab/post/parameters/parameter18/Schema18.md deleted file mode 100644 index 962dca4cbb3..00000000000 --- a/samples/client/petstore/kotlin/docs/paths/fakeparametercollisions1ababselfab/post/parameters/parameter18/Schema18.md +++ /dev/null @@ -1,49 +0,0 @@ -# Schema18 -public class Schema18
- -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 - -## Nested Class Summary -| Modifier and Type | Class and Description | -| ----------------- | ---------------------- | -| sealed interface | [Schema18.Schema181Boxed](#schema181boxed)
sealed interface for validated payloads | -| record | [Schema18.Schema181BoxedString](#schema181boxedstring)
boxed class to store validated String payloads | -| static class | [Schema18.Schema181](#schema181)
schema class | - -## Schema181Boxed -public sealed interface Schema181Boxed
-permits
-[Schema181BoxedString](#schema181boxedstring) - -sealed interface that stores validated payloads using boxed classes - -## Schema181BoxedString -public record Schema181BoxedString
-implements [Schema181Boxed](#schema181boxed) - -record that stores validated String payloads, sealed permits implementation - -### Constructor Summary -| Constructor and Description | -| --------------------------- | -| Schema181BoxedString(String data)
Creates an instance, private visibility | - -### Method Summary -| Modifier and Type | Method and Description | -| ----------------- | ---------------------- | -| String | data()
validated payload | -| @Nullable Object | getData()
validated payload | - -## Schema181 -public static class Schema181
-extends StringJsonSchema.StringJsonSchema1 - -A schema class that validates payloads - -| Methods Inherited from class org.openapijsonschematools.client.schemas.StringJsonSchema.StringJsonSchema1 | -| ------------------------------------------------------------------ | -| validate | -| validateAndBox | diff --git a/samples/client/petstore/kotlin/docs/paths/fakeparametercollisions1ababselfab/post/parameters/parameter2/Schema2.md b/samples/client/petstore/kotlin/docs/paths/fakeparametercollisions1ababselfab/post/parameters/parameter2/Schema2.md deleted file mode 100644 index 4a7d57953eb..00000000000 --- a/samples/client/petstore/kotlin/docs/paths/fakeparametercollisions1ababselfab/post/parameters/parameter2/Schema2.md +++ /dev/null @@ -1,49 +0,0 @@ -# Schema2 -public class Schema2
- -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 - -## Nested Class Summary -| Modifier and Type | Class and Description | -| ----------------- | ---------------------- | -| sealed interface | [Schema2.Schema21Boxed](#schema21boxed)
sealed interface for validated payloads | -| record | [Schema2.Schema21BoxedString](#schema21boxedstring)
boxed class to store validated String payloads | -| static class | [Schema2.Schema21](#schema21)
schema class | - -## Schema21Boxed -public sealed interface Schema21Boxed
-permits
-[Schema21BoxedString](#schema21boxedstring) - -sealed interface that stores validated payloads using boxed classes - -## Schema21BoxedString -public record Schema21BoxedString
-implements [Schema21Boxed](#schema21boxed) - -record that stores validated String payloads, sealed permits implementation - -### Constructor Summary -| Constructor and Description | -| --------------------------- | -| Schema21BoxedString(String data)
Creates an instance, private visibility | - -### Method Summary -| Modifier and Type | Method and Description | -| ----------------- | ---------------------- | -| String | data()
validated payload | -| @Nullable Object | getData()
validated payload | - -## Schema21 -public static class Schema21
-extends StringJsonSchema.StringJsonSchema1 - -A schema class that validates payloads - -| Methods Inherited from class org.openapijsonschematools.client.schemas.StringJsonSchema.StringJsonSchema1 | -| ------------------------------------------------------------------ | -| validate | -| validateAndBox | diff --git a/samples/client/petstore/kotlin/docs/paths/fakeparametercollisions1ababselfab/post/parameters/parameter3/Schema3.md b/samples/client/petstore/kotlin/docs/paths/fakeparametercollisions1ababselfab/post/parameters/parameter3/Schema3.md deleted file mode 100644 index 41d54a1d930..00000000000 --- a/samples/client/petstore/kotlin/docs/paths/fakeparametercollisions1ababselfab/post/parameters/parameter3/Schema3.md +++ /dev/null @@ -1,49 +0,0 @@ -# Schema3 -public class Schema3
- -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 - -## Nested Class Summary -| Modifier and Type | Class and Description | -| ----------------- | ---------------------- | -| sealed interface | [Schema3.Schema31Boxed](#schema31boxed)
sealed interface for validated payloads | -| record | [Schema3.Schema31BoxedString](#schema31boxedstring)
boxed class to store validated String payloads | -| static class | [Schema3.Schema31](#schema31)
schema class | - -## Schema31Boxed -public sealed interface Schema31Boxed
-permits
-[Schema31BoxedString](#schema31boxedstring) - -sealed interface that stores validated payloads using boxed classes - -## Schema31BoxedString -public record Schema31BoxedString
-implements [Schema31Boxed](#schema31boxed) - -record that stores validated String payloads, sealed permits implementation - -### Constructor Summary -| Constructor and Description | -| --------------------------- | -| Schema31BoxedString(String data)
Creates an instance, private visibility | - -### Method Summary -| Modifier and Type | Method and Description | -| ----------------- | ---------------------- | -| String | data()
validated payload | -| @Nullable Object | getData()
validated payload | - -## Schema31 -public static class Schema31
-extends StringJsonSchema.StringJsonSchema1 - -A schema class that validates payloads - -| Methods Inherited from class org.openapijsonschematools.client.schemas.StringJsonSchema.StringJsonSchema1 | -| ------------------------------------------------------------------ | -| validate | -| validateAndBox | diff --git a/samples/client/petstore/kotlin/docs/paths/fakeparametercollisions1ababselfab/post/parameters/parameter4/Schema4.md b/samples/client/petstore/kotlin/docs/paths/fakeparametercollisions1ababselfab/post/parameters/parameter4/Schema4.md deleted file mode 100644 index 7bc2523d7af..00000000000 --- a/samples/client/petstore/kotlin/docs/paths/fakeparametercollisions1ababselfab/post/parameters/parameter4/Schema4.md +++ /dev/null @@ -1,49 +0,0 @@ -# Schema4 -public class Schema4
- -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 - -## Nested Class Summary -| Modifier and Type | Class and Description | -| ----------------- | ---------------------- | -| sealed interface | [Schema4.Schema41Boxed](#schema41boxed)
sealed interface for validated payloads | -| record | [Schema4.Schema41BoxedString](#schema41boxedstring)
boxed class to store validated String payloads | -| static class | [Schema4.Schema41](#schema41)
schema class | - -## Schema41Boxed -public sealed interface Schema41Boxed
-permits
-[Schema41BoxedString](#schema41boxedstring) - -sealed interface that stores validated payloads using boxed classes - -## Schema41BoxedString -public record Schema41BoxedString
-implements [Schema41Boxed](#schema41boxed) - -record that stores validated String payloads, sealed permits implementation - -### Constructor Summary -| Constructor and Description | -| --------------------------- | -| Schema41BoxedString(String data)
Creates an instance, private visibility | - -### Method Summary -| Modifier and Type | Method and Description | -| ----------------- | ---------------------- | -| String | data()
validated payload | -| @Nullable Object | getData()
validated payload | - -## Schema41 -public static class Schema41
-extends StringJsonSchema.StringJsonSchema1 - -A schema class that validates payloads - -| Methods Inherited from class org.openapijsonschematools.client.schemas.StringJsonSchema.StringJsonSchema1 | -| ------------------------------------------------------------------ | -| validate | -| validateAndBox | diff --git a/samples/client/petstore/kotlin/docs/paths/fakeparametercollisions1ababselfab/post/parameters/parameter5/Schema5.md b/samples/client/petstore/kotlin/docs/paths/fakeparametercollisions1ababselfab/post/parameters/parameter5/Schema5.md deleted file mode 100644 index ff888c33afd..00000000000 --- a/samples/client/petstore/kotlin/docs/paths/fakeparametercollisions1ababselfab/post/parameters/parameter5/Schema5.md +++ /dev/null @@ -1,49 +0,0 @@ -# Schema5 -public class Schema5
- -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 - -## Nested Class Summary -| Modifier and Type | Class and Description | -| ----------------- | ---------------------- | -| sealed interface | [Schema5.Schema51Boxed](#schema51boxed)
sealed interface for validated payloads | -| record | [Schema5.Schema51BoxedString](#schema51boxedstring)
boxed class to store validated String payloads | -| static class | [Schema5.Schema51](#schema51)
schema class | - -## Schema51Boxed -public sealed interface Schema51Boxed
-permits
-[Schema51BoxedString](#schema51boxedstring) - -sealed interface that stores validated payloads using boxed classes - -## Schema51BoxedString -public record Schema51BoxedString
-implements [Schema51Boxed](#schema51boxed) - -record that stores validated String payloads, sealed permits implementation - -### Constructor Summary -| Constructor and Description | -| --------------------------- | -| Schema51BoxedString(String data)
Creates an instance, private visibility | - -### Method Summary -| Modifier and Type | Method and Description | -| ----------------- | ---------------------- | -| String | data()
validated payload | -| @Nullable Object | getData()
validated payload | - -## Schema51 -public static class Schema51
-extends StringJsonSchema.StringJsonSchema1 - -A schema class that validates payloads - -| Methods Inherited from class org.openapijsonschematools.client.schemas.StringJsonSchema.StringJsonSchema1 | -| ------------------------------------------------------------------ | -| validate | -| validateAndBox | diff --git a/samples/client/petstore/kotlin/docs/paths/fakeparametercollisions1ababselfab/post/parameters/parameter6/Schema6.md b/samples/client/petstore/kotlin/docs/paths/fakeparametercollisions1ababselfab/post/parameters/parameter6/Schema6.md deleted file mode 100644 index ba0b2fad7df..00000000000 --- a/samples/client/petstore/kotlin/docs/paths/fakeparametercollisions1ababselfab/post/parameters/parameter6/Schema6.md +++ /dev/null @@ -1,49 +0,0 @@ -# Schema6 -public class Schema6
- -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 - -## Nested Class Summary -| Modifier and Type | Class and Description | -| ----------------- | ---------------------- | -| sealed interface | [Schema6.Schema61Boxed](#schema61boxed)
sealed interface for validated payloads | -| record | [Schema6.Schema61BoxedString](#schema61boxedstring)
boxed class to store validated String payloads | -| static class | [Schema6.Schema61](#schema61)
schema class | - -## Schema61Boxed -public sealed interface Schema61Boxed
-permits
-[Schema61BoxedString](#schema61boxedstring) - -sealed interface that stores validated payloads using boxed classes - -## Schema61BoxedString -public record Schema61BoxedString
-implements [Schema61Boxed](#schema61boxed) - -record that stores validated String payloads, sealed permits implementation - -### Constructor Summary -| Constructor and Description | -| --------------------------- | -| Schema61BoxedString(String data)
Creates an instance, private visibility | - -### Method Summary -| Modifier and Type | Method and Description | -| ----------------- | ---------------------- | -| String | data()
validated payload | -| @Nullable Object | getData()
validated payload | - -## Schema61 -public static class Schema61
-extends StringJsonSchema.StringJsonSchema1 - -A schema class that validates payloads - -| Methods Inherited from class org.openapijsonschematools.client.schemas.StringJsonSchema.StringJsonSchema1 | -| ------------------------------------------------------------------ | -| validate | -| validateAndBox | diff --git a/samples/client/petstore/kotlin/docs/paths/fakeparametercollisions1ababselfab/post/parameters/parameter7/Schema7.md b/samples/client/petstore/kotlin/docs/paths/fakeparametercollisions1ababselfab/post/parameters/parameter7/Schema7.md deleted file mode 100644 index a4e0ad0106a..00000000000 --- a/samples/client/petstore/kotlin/docs/paths/fakeparametercollisions1ababselfab/post/parameters/parameter7/Schema7.md +++ /dev/null @@ -1,49 +0,0 @@ -# Schema7 -public class Schema7
- -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 - -## Nested Class Summary -| Modifier and Type | Class and Description | -| ----------------- | ---------------------- | -| sealed interface | [Schema7.Schema71Boxed](#schema71boxed)
sealed interface for validated payloads | -| record | [Schema7.Schema71BoxedString](#schema71boxedstring)
boxed class to store validated String payloads | -| static class | [Schema7.Schema71](#schema71)
schema class | - -## Schema71Boxed -public sealed interface Schema71Boxed
-permits
-[Schema71BoxedString](#schema71boxedstring) - -sealed interface that stores validated payloads using boxed classes - -## Schema71BoxedString -public record Schema71BoxedString
-implements [Schema71Boxed](#schema71boxed) - -record that stores validated String payloads, sealed permits implementation - -### Constructor Summary -| Constructor and Description | -| --------------------------- | -| Schema71BoxedString(String data)
Creates an instance, private visibility | - -### Method Summary -| Modifier and Type | Method and Description | -| ----------------- | ---------------------- | -| String | data()
validated payload | -| @Nullable Object | getData()
validated payload | - -## Schema71 -public static class Schema71
-extends StringJsonSchema.StringJsonSchema1 - -A schema class that validates payloads - -| Methods Inherited from class org.openapijsonschematools.client.schemas.StringJsonSchema.StringJsonSchema1 | -| ------------------------------------------------------------------ | -| validate | -| validateAndBox | diff --git a/samples/client/petstore/kotlin/docs/paths/fakeparametercollisions1ababselfab/post/parameters/parameter8/Schema8.md b/samples/client/petstore/kotlin/docs/paths/fakeparametercollisions1ababselfab/post/parameters/parameter8/Schema8.md deleted file mode 100644 index 63b13965df9..00000000000 --- a/samples/client/petstore/kotlin/docs/paths/fakeparametercollisions1ababselfab/post/parameters/parameter8/Schema8.md +++ /dev/null @@ -1,49 +0,0 @@ -# Schema8 -public class Schema8
- -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 - -## Nested Class Summary -| Modifier and Type | Class and Description | -| ----------------- | ---------------------- | -| sealed interface | [Schema8.Schema81Boxed](#schema81boxed)
sealed interface for validated payloads | -| record | [Schema8.Schema81BoxedString](#schema81boxedstring)
boxed class to store validated String payloads | -| static class | [Schema8.Schema81](#schema81)
schema class | - -## Schema81Boxed -public sealed interface Schema81Boxed
-permits
-[Schema81BoxedString](#schema81boxedstring) - -sealed interface that stores validated payloads using boxed classes - -## Schema81BoxedString -public record Schema81BoxedString
-implements [Schema81Boxed](#schema81boxed) - -record that stores validated String payloads, sealed permits implementation - -### Constructor Summary -| Constructor and Description | -| --------------------------- | -| Schema81BoxedString(String data)
Creates an instance, private visibility | - -### Method Summary -| Modifier and Type | Method and Description | -| ----------------- | ---------------------- | -| String | data()
validated payload | -| @Nullable Object | getData()
validated payload | - -## Schema81 -public static class Schema81
-extends StringJsonSchema.StringJsonSchema1 - -A schema class that validates payloads - -| Methods Inherited from class org.openapijsonschematools.client.schemas.StringJsonSchema.StringJsonSchema1 | -| ------------------------------------------------------------------ | -| validate | -| validateAndBox | diff --git a/samples/client/petstore/kotlin/docs/paths/fakeparametercollisions1ababselfab/post/parameters/parameter9/Schema9.md b/samples/client/petstore/kotlin/docs/paths/fakeparametercollisions1ababselfab/post/parameters/parameter9/Schema9.md deleted file mode 100644 index 359fd15e9c6..00000000000 --- a/samples/client/petstore/kotlin/docs/paths/fakeparametercollisions1ababselfab/post/parameters/parameter9/Schema9.md +++ /dev/null @@ -1,49 +0,0 @@ -# Schema9 -public class Schema9
- -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 - -## Nested Class Summary -| Modifier and Type | Class and Description | -| ----------------- | ---------------------- | -| sealed interface | [Schema9.Schema91Boxed](#schema91boxed)
sealed interface for validated payloads | -| record | [Schema9.Schema91BoxedString](#schema91boxedstring)
boxed class to store validated String payloads | -| static class | [Schema9.Schema91](#schema91)
schema class | - -## Schema91Boxed -public sealed interface Schema91Boxed
-permits
-[Schema91BoxedString](#schema91boxedstring) - -sealed interface that stores validated payloads using boxed classes - -## Schema91BoxedString -public record Schema91BoxedString
-implements [Schema91Boxed](#schema91boxed) - -record that stores validated String payloads, sealed permits implementation - -### Constructor Summary -| Constructor and Description | -| --------------------------- | -| Schema91BoxedString(String data)
Creates an instance, private visibility | - -### Method Summary -| Modifier and Type | Method and Description | -| ----------------- | ---------------------- | -| String | data()
validated payload | -| @Nullable Object | getData()
validated payload | - -## Schema91 -public static class Schema91
-extends StringJsonSchema.StringJsonSchema1 - -A schema class that validates payloads - -| Methods Inherited from class org.openapijsonschematools.client.schemas.StringJsonSchema.StringJsonSchema1 | -| ------------------------------------------------------------------ | -| validate | -| validateAndBox | diff --git a/samples/client/petstore/kotlin/docs/paths/fakeparametercollisions1ababselfab/post/requestbody/content/applicationjson/ApplicationjsonSchema.md b/samples/client/petstore/kotlin/docs/paths/fakeparametercollisions1ababselfab/post/requestbody/content/applicationjson/ApplicationjsonSchema.md deleted file mode 100644 index b05260b1abf..00000000000 --- a/samples/client/petstore/kotlin/docs/paths/fakeparametercollisions1ababselfab/post/requestbody/content/applicationjson/ApplicationjsonSchema.md +++ /dev/null @@ -1,144 +0,0 @@ -# ApplicationjsonSchema -public class ApplicationjsonSchema
- -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 - -## Nested Class Summary -| Modifier and Type | Class and Description | -| ----------------- | ---------------------- | -| sealed interface | [ApplicationjsonSchema.ApplicationjsonSchema1Boxed](#applicationjsonschema1boxed)
sealed interface for validated payloads | -| record | [ApplicationjsonSchema.ApplicationjsonSchema1BoxedVoid](#applicationjsonschema1boxedvoid)
boxed class to store validated null payloads | -| record | [ApplicationjsonSchema.ApplicationjsonSchema1BoxedBoolean](#applicationjsonschema1boxedboolean)
boxed class to store validated boolean payloads | -| record | [ApplicationjsonSchema.ApplicationjsonSchema1BoxedNumber](#applicationjsonschema1boxednumber)
boxed class to store validated Number payloads | -| record | [ApplicationjsonSchema.ApplicationjsonSchema1BoxedString](#applicationjsonschema1boxedstring)
boxed class to store validated String payloads | -| record | [ApplicationjsonSchema.ApplicationjsonSchema1BoxedList](#applicationjsonschema1boxedlist)
boxed class to store validated List payloads | -| record | [ApplicationjsonSchema.ApplicationjsonSchema1BoxedMap](#applicationjsonschema1boxedmap)
boxed class to store validated Map payloads | -| static class | [ApplicationjsonSchema.ApplicationjsonSchema1](#applicationjsonschema1)
schema class | - -## ApplicationjsonSchema1Boxed -public sealed interface ApplicationjsonSchema1Boxed
-permits
-[ApplicationjsonSchema1BoxedVoid](#applicationjsonschema1boxedvoid), -[ApplicationjsonSchema1BoxedBoolean](#applicationjsonschema1boxedboolean), -[ApplicationjsonSchema1BoxedNumber](#applicationjsonschema1boxednumber), -[ApplicationjsonSchema1BoxedString](#applicationjsonschema1boxedstring), -[ApplicationjsonSchema1BoxedList](#applicationjsonschema1boxedlist), -[ApplicationjsonSchema1BoxedMap](#applicationjsonschema1boxedmap) - -sealed interface that stores validated payloads using boxed classes - -## ApplicationjsonSchema1BoxedVoid -public record ApplicationjsonSchema1BoxedVoid
-implements [ApplicationjsonSchema1Boxed](#applicationjsonschema1boxed) - -record that stores validated null payloads, sealed permits implementation - -### Constructor Summary -| Constructor and Description | -| --------------------------- | -| ApplicationjsonSchema1BoxedVoid(Nothing? data)
Creates an instance, private visibility | - -### Method Summary -| Modifier and Type | Method and Description | -| ----------------- | ---------------------- | -| Nothing? | data()
validated payload | -| @Nullable Object | getData()
validated payload | - -## ApplicationjsonSchema1BoxedBoolean -public record ApplicationjsonSchema1BoxedBoolean
-implements [ApplicationjsonSchema1Boxed](#applicationjsonschema1boxed) - -record that stores validated boolean payloads, sealed permits implementation - -### Constructor Summary -| Constructor and Description | -| --------------------------- | -| ApplicationjsonSchema1BoxedBoolean(boolean data)
Creates an instance, private visibility | - -### Method Summary -| Modifier and Type | Method and Description | -| ----------------- | ---------------------- | -| boolean | data()
validated payload | -| @Nullable Object | getData()
validated payload | - -## ApplicationjsonSchema1BoxedNumber -public record ApplicationjsonSchema1BoxedNumber
-implements [ApplicationjsonSchema1Boxed](#applicationjsonschema1boxed) - -record that stores validated Number payloads, sealed permits implementation - -### Constructor Summary -| Constructor and Description | -| --------------------------- | -| ApplicationjsonSchema1BoxedNumber(Number data)
Creates an instance, private visibility | - -### Method Summary -| Modifier and Type | Method and Description | -| ----------------- | ---------------------- | -| Number | data()
validated payload | -| @Nullable Object | getData()
validated payload | - -## ApplicationjsonSchema1BoxedString -public record ApplicationjsonSchema1BoxedString
-implements [ApplicationjsonSchema1Boxed](#applicationjsonschema1boxed) - -record that stores validated String payloads, sealed permits implementation - -### Constructor Summary -| Constructor and Description | -| --------------------------- | -| ApplicationjsonSchema1BoxedString(String data)
Creates an instance, private visibility | - -### Method Summary -| Modifier and Type | Method and Description | -| ----------------- | ---------------------- | -| String | data()
validated payload | -| @Nullable Object | getData()
validated payload | - -## ApplicationjsonSchema1BoxedList -public record ApplicationjsonSchema1BoxedList
-implements [ApplicationjsonSchema1Boxed](#applicationjsonschema1boxed) - -record that stores validated List payloads, sealed permits implementation - -### Constructor Summary -| Constructor and Description | -| --------------------------- | -| ApplicationjsonSchema1BoxedList(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 | - -## ApplicationjsonSchema1BoxedMap -public record ApplicationjsonSchema1BoxedMap
-implements [ApplicationjsonSchema1Boxed](#applicationjsonschema1boxed) - -record that stores validated Map payloads, sealed permits implementation - -### Constructor Summary -| Constructor and Description | -| --------------------------- | -| ApplicationjsonSchema1BoxedMap(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 | - -## ApplicationjsonSchema1 -public static class ApplicationjsonSchema1
-extends AnyTypeJsonSchema.AnyTypeJsonSchema1 - -A schema class that validates payloads - -| Methods Inherited from class org.openapijsonschematools.client.schemas.AnyTypeJsonSchema.AnyTypeJsonSchema1 | -| ------------------------------------------------------------------ | -| validate | -| validateAndBox | diff --git a/samples/client/petstore/kotlin/docs/paths/fakeparametercollisions1ababselfab/post/responses/Fakeparametercollisions1ababselfabPostCode200Response.md b/samples/client/petstore/kotlin/docs/paths/fakeparametercollisions1ababselfab/post/responses/Fakeparametercollisions1ababselfabPostCode200Response.md deleted file mode 100644 index a781f4d4e59..00000000000 --- a/samples/client/petstore/kotlin/docs/paths/fakeparametercollisions1ababselfab/post/responses/Fakeparametercollisions1ababselfabPostCode200Response.md +++ /dev/null @@ -1,87 +0,0 @@ -# Fakeparametercollisions1ababselfabPostCode200Response - -public class Fakeparametercollisions1ababselfabPostCode200Response - -A class that contains necessary nested response classes -- SealedMediaType, a sealed interface which contains all the schema/encoding info for each contentType -- records which implement SealedMediaType, the concrete media types -- SealedResponseBody, a sealed interface which contains all the contentType/schema types -- records which implement SealedResponseBody, the concrete response body types -- a class that extends ResponseDeserializer and is used to deserialize responses - -## Nested Class Summary -| Modifier and Type | Class and Description | -| ----------------- | --------------------- | -| sealed interface | [Fakeparametercollisions1ababselfabPostCode200Response.SealedMediaType](#sealedmediatype)
media type sealed interface | -| record | [Fakeparametercollisions1ababselfabPostCode200Response.ApplicationjsonMediaType](#applicationjsonmediatype)
record storing schema + encoding for a specific contentType | -| sealed interface | [Fakeparametercollisions1ababselfabPostCode200Response.SealedResponseBody](#sealedresponsebody)
response body sealed interface | -| record | [Fakeparametercollisions1ababselfabPostCode200Response.ApplicationjsonResponseBody](#applicationjsonresponsebody)
implements sealed interface to store response body | -| static class | [Fakeparametercollisions1ababselfabPostCode200Response.Fakeparametercollisions1ababselfabPostCode200Response1](#fakeparametercollisions1ababselfabpostcode200response1)
class that deserializes responses | - -## SealedMediaType -public sealed interface SealedMediaType
-permits
-[ApplicationjsonMediaType](#applicationjsonmediatype) - -sealed interface that stores schema and encoding info - -## ApplicationjsonMediaType -public record ApplicationjsonMediaType
-implements [SealedMediaType](#sealedmediatype), MediaType<[ApplicationjsonSchema.ApplicationjsonSchema1](../../../../paths/fakeparametercollisions1ababselfab/post/responses/code200response/content/applicationjson/ApplicationjsonSchema.md#applicationjsonschema1), Nothing?> - -class storing schema info for a specific contentType - -### Constructor Summary -| Constructor and Description | -| --------------------------- | -| ApplicationjsonMediaType()
Creates an instance | - -### Method Summary -| Modifier and Type | Method and Description | -| ----------------- | ---------------------- | -| [ApplicationjsonSchema.ApplicationjsonSchema1](../../../../paths/fakeparametercollisions1ababselfab/post/responses/code200response/content/applicationjson/ApplicationjsonSchema.md#applicationjsonschema1) | schema()
the schema for this MediaType | -| Nothing? | encoding()
the encoding info | - -## SealedResponseBody -public sealed interface SealedResponseBody
-permits
-[ApplicationjsonResponseBody](#applicationjsonresponsebody) - -sealed interface that stores response body - -## ApplicationjsonResponseBody -public record ApplicationjsonResponseBody
-implements [SealedResponseBody](#sealedresponsebody) - -A record class to store response body for contentType="application/json" - -### Constructor Summary -| Constructor and Description | -| --------------------------- | -| ApplicationjsonResponseBody(ApplicationjsonSchema.AnyTypeJsonSchema1Boxed body)
Creates an instance | - -### Method Summary -| Modifier and Type | Method and Description | -| ----------------- | ---------------------- | -| ApplicationjsonSchema.AnyTypeJsonSchema1Boxed | body()
returns the body passed in in the constructor | - -## Fakeparametercollisions1ababselfabPostCode200Response1 -public static class Fakeparametercollisions1ababselfabPostCode200Response1
-extends ResponseDeserializer<[SealedResponseBody](#sealedresponsebody), Nothing?, [SealedMediaType](#sealedmediatype)> - -a class that deserializes responses - -### Constructor Summary -| Constructor and Description | -| --------------------------- | -| Fakeparametercollisions1ababselfabPostCode200Response1()
Creates an instance | - -### Field Summary -| Modifier and Type | Field and Description | -| ----------------- | --------------------- | -| 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 | -| ----------------- | ---------------------- | -| ApiResponse<[SealedResponseBody](#sealedresponsebody), Nothing?> | deserialize(HttpResponse response, SchemaConfiguration configuration)
called by endpoint when deserialize responses | diff --git a/samples/client/petstore/kotlin/docs/paths/fakeparametercollisions1ababselfab/post/responses/code200response/content/applicationjson/ApplicationjsonSchema.md b/samples/client/petstore/kotlin/docs/paths/fakeparametercollisions1ababselfab/post/responses/code200response/content/applicationjson/ApplicationjsonSchema.md deleted file mode 100644 index b05260b1abf..00000000000 --- a/samples/client/petstore/kotlin/docs/paths/fakeparametercollisions1ababselfab/post/responses/code200response/content/applicationjson/ApplicationjsonSchema.md +++ /dev/null @@ -1,144 +0,0 @@ -# ApplicationjsonSchema -public class ApplicationjsonSchema
- -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 - -## Nested Class Summary -| Modifier and Type | Class and Description | -| ----------------- | ---------------------- | -| sealed interface | [ApplicationjsonSchema.ApplicationjsonSchema1Boxed](#applicationjsonschema1boxed)
sealed interface for validated payloads | -| record | [ApplicationjsonSchema.ApplicationjsonSchema1BoxedVoid](#applicationjsonschema1boxedvoid)
boxed class to store validated null payloads | -| record | [ApplicationjsonSchema.ApplicationjsonSchema1BoxedBoolean](#applicationjsonschema1boxedboolean)
boxed class to store validated boolean payloads | -| record | [ApplicationjsonSchema.ApplicationjsonSchema1BoxedNumber](#applicationjsonschema1boxednumber)
boxed class to store validated Number payloads | -| record | [ApplicationjsonSchema.ApplicationjsonSchema1BoxedString](#applicationjsonschema1boxedstring)
boxed class to store validated String payloads | -| record | [ApplicationjsonSchema.ApplicationjsonSchema1BoxedList](#applicationjsonschema1boxedlist)
boxed class to store validated List payloads | -| record | [ApplicationjsonSchema.ApplicationjsonSchema1BoxedMap](#applicationjsonschema1boxedmap)
boxed class to store validated Map payloads | -| static class | [ApplicationjsonSchema.ApplicationjsonSchema1](#applicationjsonschema1)
schema class | - -## ApplicationjsonSchema1Boxed -public sealed interface ApplicationjsonSchema1Boxed
-permits
-[ApplicationjsonSchema1BoxedVoid](#applicationjsonschema1boxedvoid), -[ApplicationjsonSchema1BoxedBoolean](#applicationjsonschema1boxedboolean), -[ApplicationjsonSchema1BoxedNumber](#applicationjsonschema1boxednumber), -[ApplicationjsonSchema1BoxedString](#applicationjsonschema1boxedstring), -[ApplicationjsonSchema1BoxedList](#applicationjsonschema1boxedlist), -[ApplicationjsonSchema1BoxedMap](#applicationjsonschema1boxedmap) - -sealed interface that stores validated payloads using boxed classes - -## ApplicationjsonSchema1BoxedVoid -public record ApplicationjsonSchema1BoxedVoid
-implements [ApplicationjsonSchema1Boxed](#applicationjsonschema1boxed) - -record that stores validated null payloads, sealed permits implementation - -### Constructor Summary -| Constructor and Description | -| --------------------------- | -| ApplicationjsonSchema1BoxedVoid(Nothing? data)
Creates an instance, private visibility | - -### Method Summary -| Modifier and Type | Method and Description | -| ----------------- | ---------------------- | -| Nothing? | data()
validated payload | -| @Nullable Object | getData()
validated payload | - -## ApplicationjsonSchema1BoxedBoolean -public record ApplicationjsonSchema1BoxedBoolean
-implements [ApplicationjsonSchema1Boxed](#applicationjsonschema1boxed) - -record that stores validated boolean payloads, sealed permits implementation - -### Constructor Summary -| Constructor and Description | -| --------------------------- | -| ApplicationjsonSchema1BoxedBoolean(boolean data)
Creates an instance, private visibility | - -### Method Summary -| Modifier and Type | Method and Description | -| ----------------- | ---------------------- | -| boolean | data()
validated payload | -| @Nullable Object | getData()
validated payload | - -## ApplicationjsonSchema1BoxedNumber -public record ApplicationjsonSchema1BoxedNumber
-implements [ApplicationjsonSchema1Boxed](#applicationjsonschema1boxed) - -record that stores validated Number payloads, sealed permits implementation - -### Constructor Summary -| Constructor and Description | -| --------------------------- | -| ApplicationjsonSchema1BoxedNumber(Number data)
Creates an instance, private visibility | - -### Method Summary -| Modifier and Type | Method and Description | -| ----------------- | ---------------------- | -| Number | data()
validated payload | -| @Nullable Object | getData()
validated payload | - -## ApplicationjsonSchema1BoxedString -public record ApplicationjsonSchema1BoxedString
-implements [ApplicationjsonSchema1Boxed](#applicationjsonschema1boxed) - -record that stores validated String payloads, sealed permits implementation - -### Constructor Summary -| Constructor and Description | -| --------------------------- | -| ApplicationjsonSchema1BoxedString(String data)
Creates an instance, private visibility | - -### Method Summary -| Modifier and Type | Method and Description | -| ----------------- | ---------------------- | -| String | data()
validated payload | -| @Nullable Object | getData()
validated payload | - -## ApplicationjsonSchema1BoxedList -public record ApplicationjsonSchema1BoxedList
-implements [ApplicationjsonSchema1Boxed](#applicationjsonschema1boxed) - -record that stores validated List payloads, sealed permits implementation - -### Constructor Summary -| Constructor and Description | -| --------------------------- | -| ApplicationjsonSchema1BoxedList(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 | - -## ApplicationjsonSchema1BoxedMap -public record ApplicationjsonSchema1BoxedMap
-implements [ApplicationjsonSchema1Boxed](#applicationjsonschema1boxed) - -record that stores validated Map payloads, sealed permits implementation - -### Constructor Summary -| Constructor and Description | -| --------------------------- | -| ApplicationjsonSchema1BoxedMap(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 | - -## ApplicationjsonSchema1 -public static class ApplicationjsonSchema1
-extends AnyTypeJsonSchema.AnyTypeJsonSchema1 - -A schema class that validates payloads - -| Methods Inherited from class org.openapijsonschematools.client.schemas.AnyTypeJsonSchema.AnyTypeJsonSchema1 | -| ------------------------------------------------------------------ | -| validate | -| validateAndBox | diff --git a/samples/client/petstore/kotlin/docs/paths/fakepemcontenttype/FakepemcontenttypeGet.md b/samples/client/petstore/kotlin/docs/paths/fakepemcontenttype/FakepemcontenttypeGet.md deleted file mode 100644 index 85a6c160680..00000000000 --- a/samples/client/petstore/kotlin/docs/paths/fakepemcontenttype/FakepemcontenttypeGet.md +++ /dev/null @@ -1,148 +0,0 @@ -# FakepemcontenttypeGet - -public class FakepemcontenttypeGet - -A class that contains necessary endpoint classes -- a class that calls the endpoint method using the http verb -- a class that calls the endpoint method using the operationId name -- class(es) to store the request inputs -- builder(s) to set the request input data - -## Nested Class Summary -| Modifier and Type | Class and Description | -| ----------------- | --------------------- | -| static class | [Get](#get)
The class that has a get method to call the endpoint | -| interface | [PemContentTypeOperation](#pemcontenttypeoperation)
The interface that has a pemContentType method to call the endpoint | -| static class | [GetRequest](#getrequest)
The request inputs class | -| static class | [GetRequestBuilder](#getrequestbuilder)
A builder for the request input class | - -## Get -public static class Get extends ApiClient.ApiClient1 implements GetOperation
- -a class that allows one to call the endpoint using a method named get - -### 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.fakepemcontenttype.get.FakepemcontenttypeGetRequestBody; -import org.openapijsonschematools.client.paths.fakepemcontenttype.get.requestbody.content.applicationxpemfile.ApplicationxpemfileSchema; -import org.openapijsonschematools.client.RootServerInfo; -import org.openapijsonschematools.client.servers.RootServer0; -import org.openapijsonschematools.client.servers.RootServer1; -import org.openapijsonschematools.client.servers.RootServer2; -import org.openapijsonschematools.client.paths.fakepemcontenttype.get.responses.FakepemcontenttypeGetCode200Response; -import org.openapijsonschematools.client.servers.RootServerInfo; -import org.openapijsonschematools.client.paths.fakepemcontenttype.FakepemcontenttypeGet; -import org.openapijsonschematools.client.paths.fakepemcontenttype.get.FakepemcontenttypeGetResponses; - -import java.io.IOException; -import java.util.Arrays; -import java.util.List; -import java.util.Map; -import java.util.AbstractMap; - -// if you want to use a server that is not SERVER_0 pass it in here and change the ServerIndex input below -ApiConfiguration.ServerInfo serverInfo = new ApiConfiguration.ServerInfoBuilder() - .rootServerInfo( - new RootServerInfo.RootServerInfoBuilder() - .rootServer0(new RootServer0()) - .build() - ) - .build(); -ApiConfiguration.ServerIndexInfo serverIndexInfo = new ApiConfiguration.ServerIndexInfoBuilder() - .rootServerInfoServerIndex(RootServerInfo.ServerIndex.SERVER_0) - .build(); -Duration timeout = Duration.ofSeconds(1L); -Map> defaultHeaders = Map.of("User-Agent", List.of("OpenAPI-JSON-Schema-Generator/1.0.0/java")); -ApiConfiguration apiConfiguration = new ApiConfiguration( - serverInfo - serverIndexInfo, - timeout, - defaultHeaders -); -SchemaConfiguration schemaConfiguration = new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().build()); -FakepemcontenttypeGet.Get apiClient = new FakepemcontenttypeGet.Get(apiConfiguration, schemaConfiguration); - - -var request = new FakepemcontenttypeGet.GetRequestBuilder().build(); - -FakepemcontenttypeGetResponses.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; -} -FakepemcontenttypeGetResponses.EndpointFakepemcontenttypeGetCode200Response castResponse = (FakepemcontenttypeGetResponses.EndpointFakepemcontenttypeGetCode200Response) response; -FakepemcontenttypeGetCode200Response.ApplicationxpemfileResponseBody deserializedBody = (FakepemcontenttypeGetCode200Response.ApplicationxpemfileResponseBody) castResponse.body; -// handle deserialized body here -``` -### Constructor Summary -| Constructor and Description | -| --------------------------- | -| Get(ApiConfiguration apiConfiguration, SchemaConfiguration schemaConfiguration)
Creates an instance | - -### Method Summary -| Modifier and Type | Method and Description | -| ----------------- | ---------------------- | -| [FakepemcontenttypeGetResponses.EndpointResponse](../../paths/fakepemcontenttype/get/FakepemcontenttypeGetResponses.md#endpointresponse) | get([GetRequest](#getrequest) request) | - -## PemContentTypeOperation -public interface PemContentTypeOperation
- -an interface that allows one to call the endpoint using a method named pemContentType by the operationId - -### Method Summary -| Modifier and Type | Method and Description | -| ----------------- | ---------------------- | -| [FakepemcontenttypeGetResponses.EndpointResponse](../../paths/fakepemcontenttype/get/FakepemcontenttypeGetResponses.md#endpointresponse) | pemContentType([GetRequest](#getrequest) request) | - -## GetRequest -public static class GetRequest
- -a class that stores the final request inputs - -### Field Summary -| Modifier and Type | Field and Description | -| ----------------- | --------------------- | -| [FakepemcontenttypeGetRequestBody.@Nullable SealedRequestBody](../../paths/fakepemcontenttype/get/FakepemcontenttypeGetRequestBody.md#sealedrequestbody) | requestBody
optional | -| [RootServerInfo.@Nullable ServerIndex](../../RootServerInfo.md#serverindex) | serverIndex
optional. Note: this will override the value in apiConfiguration | -| @Nullable Duration | timeout
optional. Note: this will override the value in apiConfiguration | - -## GetRequestBuilder -public static class GetRequestBuilder
- -a builder for request inputs - -### Constructor Summary -| Constructor and Description | -| --------------------------- | -| GetRequestBuilder()
Creates a builder that contains null for all parameters | - -### Method Summary -| Modifier and Type | Method and Description | -| ----------------- | ---------------------- | -| [GetRequest](#getrequest) | build()
Returns the request input used to call an endpoint method | -| [GetRequestBuilder](#getrequestbuilder) | requestBody([FakepemcontenttypeGetRequestBody.SealedRequestBody](../../paths/fakepemcontenttype/get/FakepemcontenttypeGetRequestBody.md#sealedrequestbody) requestBody)
sets the optional property | -| [GetRequestBuilder](#getrequestbuilder) | serverIndex([RootServerInfo.ServerIndex](../../RootServerInfo.md#serverindex) serverIndex)
sets the optional property. Note: this will override the value in apiConfiguration | -| [GetRequestBuilder](#getrequestbuilder) | timeout(Duration timeout)
sets the optional property. Note: this will override the value in apiConfiguration | - -[[Back to top]](#top) [[Back to README]](../../../README.md) diff --git a/samples/client/petstore/kotlin/docs/paths/fakepemcontenttype/get/FakepemcontenttypeGetRequestBody.md b/samples/client/petstore/kotlin/docs/paths/fakepemcontenttype/get/FakepemcontenttypeGetRequestBody.md deleted file mode 100644 index 3bf6549245f..00000000000 --- a/samples/client/petstore/kotlin/docs/paths/fakepemcontenttype/get/FakepemcontenttypeGetRequestBody.md +++ /dev/null @@ -1,90 +0,0 @@ -# FakepemcontenttypeGetRequestBody - -public class FakepemcontenttypeGetRequestBody - -A class that contains necessary nested request body classes -- SealedMediaType, a sealed interface which contains all the schema/encoding info for each contentType -- records which implement SealedMediaType, the concrete media types -- a class that extends RequestBodySerializer and is used to serialize input SealedRequestBody instances -- SealedRequestBody, a sealed interface which contains all the contentType/schema input types -- records which implement SealedRequestBody, the concrete request body types - -## Nested Class Summary -| Modifier and Type | Class and Description | -| ----------------- | --------------------- | -| sealed interface | [FakepemcontenttypeGetRequestBody.SealedMediaType](#sealedmediatype)
media type sealed interface | -| record | [FakepemcontenttypeGetRequestBody.ApplicationxpemfileMediaType](#applicationxpemfilemediatype)
record storing schema + encoding for a specific contentType | -| static class | [FakepemcontenttypeGetRequestBody.FakepemcontenttypeGetRequestBody1](#fakepemcontenttypegetrequestbody1)
class that serializes request bodies | -| sealed interface | [FakepemcontenttypeGetRequestBody.SealedRequestBody](#sealedrequestbody)
request body sealed interface | -| record | [FakepemcontenttypeGetRequestBody.ApplicationxpemfileRequestBody](#applicationxpemfilerequestbody)
implements sealed interface to store request body input | - -## SealedMediaType -public sealed interface SealedMediaType
-permits
-[ApplicationxpemfileMediaType](#applicationxpemfilemediatype) - -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), Nothing?> - -class storing schema info for a specific contentType - -### Constructor Summary -| Constructor and Description | -| --------------------------- | -| ApplicationxpemfileMediaType()
Creates an instance | - -### 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 | -| Nothing? | encoding()
the encoding info | - -## FakepemcontenttypeGetRequestBody1 -public static class FakepemcontenttypeGetRequestBody1
- -a class that serializes SealedRequestBody request bodies - -### Constructor Summary -| Constructor and Description | -| --------------------------- | -| FakepemcontenttypeGetRequestBody1()
Creates an instance | - -### Field Summary -| Modifier and Type | Field and Description | -| ----------------- | --------------------- | -| boolean | required = false
whether the request body is required | -| Map | content = Map.ofEntries(
    new AbstractMap.SimpleEntry<>("application/x-pem-file", new [ApplicationxpemfileMediaType](#applicationxpemfilemediatype)())
)
the contentType to schema info | - -### Method Summary -| Modifier and Type | Method and Description | -| ----------------- | ---------------------- | -| SerializedRequestBody | serialize([SealedRequestBody](#sealedrequestbody) requestBody)
called by endpoint when creating request body bytes | - -## SealedRequestBody -public sealed interface SealedRequestBody
-permits
-[ApplicationxpemfileRequestBody](#applicationxpemfilerequestbody) - -sealed interface that stores request contentType + validated schema data - -## ApplicationxpemfileRequestBody -public record ApplicationxpemfileRequestBody
-implements [SealedRequestBody](#sealedrequestbody),
-GenericRequestBody
- -A record class to store request body input for contentType="application/x-pem-file" - -### Constructor Summary -| Constructor and Description | -| --------------------------- | -| ApplicationxpemfileRequestBody(ApplicationxpemfileSchema.StringJsonSchema1Boxed body)
Creates an instance | - -### Method Summary -| Modifier and Type | Method and Description | -| ----------------- | ---------------------- | -| String | contentType()
always returns "application/x-pem-file" | -| ApplicationxpemfileSchema.StringJsonSchema1Boxed | body()
returns the body passed in in the constructor | diff --git a/samples/client/petstore/kotlin/docs/paths/fakepemcontenttype/get/FakepemcontenttypeGetResponses.md b/samples/client/petstore/kotlin/docs/paths/fakepemcontenttype/get/FakepemcontenttypeGetResponses.md deleted file mode 100644 index 8a3ded7dac3..00000000000 --- a/samples/client/petstore/kotlin/docs/paths/fakepemcontenttype/get/FakepemcontenttypeGetResponses.md +++ /dev/null @@ -1,29 +0,0 @@ -# FakepemcontenttypeGetResponses - -public class FakepemcontenttypeGetResponses - -A class that contains necessary responses classes -- a sealed interface, EndpointResponse, that stores endpoint responses -- records for each endpoint response - -## Nested Class Summary -| Modifier and Type | Class and Description | -| ----------------- | --------------------- | -| sealed interface | [EndpointResponse](#endpointresponse)
stores the endpoint responses | -| record | [EndpointFakepemcontenttypeGetCode200Response](#endpointfakepemcontenttypegetcode200response)
the response for 200 | - -## EndpointResponse -public sealed interface EndpointResponse permits
-[EndpointFakepemcontenttypeGetCode200Response](#endpointfakepemcontenttypegetcode200response) - -a sealed interface that stores endpoint responses - -## EndpointFakepemcontenttypeGetCode200Response -public record EndpointFakepemcontenttypeGetCode200Response( - HttpResponse response, - [FakepemcontenttypeGetCode200Response.SealedResponseBody](../../../paths/fakepemcontenttype/get/responses/FakepemcontenttypeGetCode200Response.md#sealedresponsebody) body, - Nothing? headers -) implements EndpointResponse, ApiResponse
- -a class that stores an endpoint response - diff --git a/samples/client/petstore/kotlin/docs/paths/fakepemcontenttype/get/requestbody/content/applicationxpemfile/ApplicationxpemfileSchema.md b/samples/client/petstore/kotlin/docs/paths/fakepemcontenttype/get/requestbody/content/applicationxpemfile/ApplicationxpemfileSchema.md deleted file mode 100644 index 91a1e361623..00000000000 --- a/samples/client/petstore/kotlin/docs/paths/fakepemcontenttype/get/requestbody/content/applicationxpemfile/ApplicationxpemfileSchema.md +++ /dev/null @@ -1,49 +0,0 @@ -# ApplicationxpemfileSchema -public class ApplicationxpemfileSchema
- -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 - -## Nested Class Summary -| Modifier and Type | Class and Description | -| ----------------- | ---------------------- | -| sealed interface | [ApplicationxpemfileSchema.ApplicationxpemfileSchema1Boxed](#applicationxpemfileschema1boxed)
sealed interface for validated payloads | -| record | [ApplicationxpemfileSchema.ApplicationxpemfileSchema1BoxedString](#applicationxpemfileschema1boxedstring)
boxed class to store validated String payloads | -| static class | [ApplicationxpemfileSchema.ApplicationxpemfileSchema1](#applicationxpemfileschema1)
schema class | - -## ApplicationxpemfileSchema1Boxed -public sealed interface ApplicationxpemfileSchema1Boxed
-permits
-[ApplicationxpemfileSchema1BoxedString](#applicationxpemfileschema1boxedstring) - -sealed interface that stores validated payloads using boxed classes - -## ApplicationxpemfileSchema1BoxedString -public record ApplicationxpemfileSchema1BoxedString
-implements [ApplicationxpemfileSchema1Boxed](#applicationxpemfileschema1boxed) - -record that stores validated String payloads, sealed permits implementation - -### Constructor Summary -| Constructor and Description | -| --------------------------- | -| ApplicationxpemfileSchema1BoxedString(String data)
Creates an instance, private visibility | - -### Method Summary -| Modifier and Type | Method and Description | -| ----------------- | ---------------------- | -| String | data()
validated payload | -| @Nullable Object | getData()
validated payload | - -## ApplicationxpemfileSchema1 -public static class ApplicationxpemfileSchema1
-extends StringJsonSchema.StringJsonSchema1 - -A schema class that validates payloads - -| Methods Inherited from class org.openapijsonschematools.client.schemas.StringJsonSchema.StringJsonSchema1 | -| ------------------------------------------------------------------ | -| validate | -| validateAndBox | diff --git a/samples/client/petstore/kotlin/docs/paths/fakepemcontenttype/get/responses/FakepemcontenttypeGetCode200Response.md b/samples/client/petstore/kotlin/docs/paths/fakepemcontenttype/get/responses/FakepemcontenttypeGetCode200Response.md deleted file mode 100644 index 5a5b6b3499e..00000000000 --- a/samples/client/petstore/kotlin/docs/paths/fakepemcontenttype/get/responses/FakepemcontenttypeGetCode200Response.md +++ /dev/null @@ -1,87 +0,0 @@ -# FakepemcontenttypeGetCode200Response - -public class FakepemcontenttypeGetCode200Response - -A class that contains necessary nested response classes -- SealedMediaType, a sealed interface which contains all the schema/encoding info for each contentType -- records which implement SealedMediaType, the concrete media types -- SealedResponseBody, a sealed interface which contains all the contentType/schema types -- records which implement SealedResponseBody, the concrete response body types -- a class that extends ResponseDeserializer and is used to deserialize responses - -## Nested Class Summary -| Modifier and Type | Class and Description | -| ----------------- | --------------------- | -| sealed interface | [FakepemcontenttypeGetCode200Response.SealedMediaType](#sealedmediatype)
media type sealed interface | -| record | [FakepemcontenttypeGetCode200Response.ApplicationxpemfileMediaType](#applicationxpemfilemediatype)
record storing schema + encoding for a specific contentType | -| sealed interface | [FakepemcontenttypeGetCode200Response.SealedResponseBody](#sealedresponsebody)
response body sealed interface | -| record | [FakepemcontenttypeGetCode200Response.ApplicationxpemfileResponseBody](#applicationxpemfileresponsebody)
implements sealed interface to store response body | -| static class | [FakepemcontenttypeGetCode200Response.FakepemcontenttypeGetCode200Response1](#fakepemcontenttypegetcode200response1)
class that deserializes responses | - -## SealedMediaType -public sealed interface SealedMediaType
-permits
-[ApplicationxpemfileMediaType](#applicationxpemfilemediatype) - -sealed interface that stores schema and encoding info - -## ApplicationxpemfileMediaType -public record ApplicationxpemfileMediaType
-implements [SealedMediaType](#sealedmediatype), MediaType<[ApplicationxpemfileSchema.ApplicationxpemfileSchema1](../../../../paths/fakepemcontenttype/get/responses/code200response/content/applicationxpemfile/ApplicationxpemfileSchema.md#applicationxpemfileschema1), Nothing?> - -class storing schema info for a specific contentType - -### Constructor Summary -| Constructor and Description | -| --------------------------- | -| ApplicationxpemfileMediaType()
Creates an instance | - -### Method Summary -| Modifier and Type | Method and Description | -| ----------------- | ---------------------- | -| [ApplicationxpemfileSchema.ApplicationxpemfileSchema1](../../../../paths/fakepemcontenttype/get/responses/code200response/content/applicationxpemfile/ApplicationxpemfileSchema.md#applicationxpemfileschema1) | schema()
the schema for this MediaType | -| Nothing? | encoding()
the encoding info | - -## SealedResponseBody -public sealed interface SealedResponseBody
-permits
-[ApplicationxpemfileResponseBody](#applicationxpemfileresponsebody) - -sealed interface that stores response body - -## ApplicationxpemfileResponseBody -public record ApplicationxpemfileResponseBody
-implements [SealedResponseBody](#sealedresponsebody) - -A record class to store response body for contentType="application/x-pem-file" - -### Constructor Summary -| Constructor and Description | -| --------------------------- | -| ApplicationxpemfileResponseBody(ApplicationxpemfileSchema.StringJsonSchema1Boxed body)
Creates an instance | - -### Method Summary -| Modifier and Type | Method and Description | -| ----------------- | ---------------------- | -| ApplicationxpemfileSchema.StringJsonSchema1Boxed | body()
returns the body passed in in the constructor | - -## FakepemcontenttypeGetCode200Response1 -public static class FakepemcontenttypeGetCode200Response1
-extends ResponseDeserializer<[SealedResponseBody](#sealedresponsebody), Nothing?, [SealedMediaType](#sealedmediatype)> - -a class that deserializes responses - -### Constructor Summary -| Constructor and Description | -| --------------------------- | -| FakepemcontenttypeGetCode200Response1()
Creates an instance | - -### Field Summary -| Modifier and Type | Field and Description | -| ----------------- | --------------------- | -| Map | content = Map.ofEntries(
    new AbstractMap.SimpleEntry<>("application/x-pem-file", new [ApplicationxpemfileMediaType](#applicationxpemfilemediatype)())
)
the contentType to schema info | - -### Method Summary -| Modifier and Type | Method and Description | -| ----------------- | ---------------------- | -| ApiResponse<[SealedResponseBody](#sealedresponsebody), Nothing?> | deserialize(HttpResponse response, SchemaConfiguration configuration)
called by endpoint when deserialize responses | diff --git a/samples/client/petstore/kotlin/docs/paths/fakepemcontenttype/get/responses/code200response/content/applicationxpemfile/ApplicationxpemfileSchema.md b/samples/client/petstore/kotlin/docs/paths/fakepemcontenttype/get/responses/code200response/content/applicationxpemfile/ApplicationxpemfileSchema.md deleted file mode 100644 index 91a1e361623..00000000000 --- a/samples/client/petstore/kotlin/docs/paths/fakepemcontenttype/get/responses/code200response/content/applicationxpemfile/ApplicationxpemfileSchema.md +++ /dev/null @@ -1,49 +0,0 @@ -# ApplicationxpemfileSchema -public class ApplicationxpemfileSchema
- -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 - -## Nested Class Summary -| Modifier and Type | Class and Description | -| ----------------- | ---------------------- | -| sealed interface | [ApplicationxpemfileSchema.ApplicationxpemfileSchema1Boxed](#applicationxpemfileschema1boxed)
sealed interface for validated payloads | -| record | [ApplicationxpemfileSchema.ApplicationxpemfileSchema1BoxedString](#applicationxpemfileschema1boxedstring)
boxed class to store validated String payloads | -| static class | [ApplicationxpemfileSchema.ApplicationxpemfileSchema1](#applicationxpemfileschema1)
schema class | - -## ApplicationxpemfileSchema1Boxed -public sealed interface ApplicationxpemfileSchema1Boxed
-permits
-[ApplicationxpemfileSchema1BoxedString](#applicationxpemfileschema1boxedstring) - -sealed interface that stores validated payloads using boxed classes - -## ApplicationxpemfileSchema1BoxedString -public record ApplicationxpemfileSchema1BoxedString
-implements [ApplicationxpemfileSchema1Boxed](#applicationxpemfileschema1boxed) - -record that stores validated String payloads, sealed permits implementation - -### Constructor Summary -| Constructor and Description | -| --------------------------- | -| ApplicationxpemfileSchema1BoxedString(String data)
Creates an instance, private visibility | - -### Method Summary -| Modifier and Type | Method and Description | -| ----------------- | ---------------------- | -| String | data()
validated payload | -| @Nullable Object | getData()
validated payload | - -## ApplicationxpemfileSchema1 -public static class ApplicationxpemfileSchema1
-extends StringJsonSchema.StringJsonSchema1 - -A schema class that validates payloads - -| Methods Inherited from class org.openapijsonschematools.client.schemas.StringJsonSchema.StringJsonSchema1 | -| ------------------------------------------------------------------ | -| validate | -| validateAndBox | diff --git a/samples/client/petstore/kotlin/docs/paths/fakepetiduploadimagewithrequiredfile/FakepetiduploadimagewithrequiredfilePost.md b/samples/client/petstore/kotlin/docs/paths/fakepetiduploadimagewithrequiredfile/FakepetiduploadimagewithrequiredfilePost.md deleted file mode 100644 index 0f305d0f1aa..00000000000 --- a/samples/client/petstore/kotlin/docs/paths/fakepetiduploadimagewithrequiredfile/FakepetiduploadimagewithrequiredfilePost.md +++ /dev/null @@ -1,203 +0,0 @@ -# FakepetiduploadimagewithrequiredfilePost - -public class FakepetiduploadimagewithrequiredfilePost - -A class that contains necessary endpoint classes -- a class that calls the endpoint method using the http verb -- a class that calls the endpoint method using the operationId name -- class(es) to store the request inputs -- builder(s) to set the request input data - -## Nested Class Summary -| Modifier and Type | Class and Description | -| ----------------- | --------------------- | -| static class | [Post](#post)
The class that has a post method to call the endpoint | -| interface | [UploadFileWithRequiredFileOperation](#uploadfilewithrequiredfileoperation)
The interface that has a uploadFileWithRequiredFile method to call the endpoint | -| static class | [PostRequest](#postrequest)
The final request inputs class | -| static class | [PostNullableRequest](#postnullablerequest)
The initial request inputs class | -| static class | [Post0RequestBuilder](#post0requestbuilder)
A builder for the request input class | -| static class | [PostRequestBuilder](#postrequestbuilder)
A builder for the request input class | - -## Post -public static class Post 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.FakepetiduploadimagewithrequiredfilePostRequestBody; -import org.openapijsonschematools.client.RootServerInfo; -import org.openapijsonschematools.client.paths.fakepetiduploadimagewithrequiredfile.post.FakepetiduploadimagewithrequiredfilePostSecurityInfo; -import org.openapijsonschematools.client.paths.fakepetiduploadimagewithrequiredfile.post.FakepetiduploadimagewithrequiredfilePostPathParameters; -import org.openapijsonschematools.client.servers.RootServer0; -import org.openapijsonschematools.client.servers.RootServer1; -import org.openapijsonschematools.client.servers.RootServer2; -import org.openapijsonschematools.client.securityschemes.SecurityScheme; -import org.openapijsonschematools.client.components.securityschemes.PetstoreAuth; -import org.openapijsonschematools.client.paths.fakepetiduploadimagewithrequiredfile.post.responses.FakepetiduploadimagewithrequiredfilePostCode200Response; -import org.openapijsonschematools.client.servers.RootServerInfo; -import org.openapijsonschematools.client.paths.fakepetiduploadimagewithrequiredfile.FakepetiduploadimagewithrequiredfilePost; -import org.openapijsonschematools.client.paths.fakepetiduploadimagewithrequiredfile.post.FakepetiduploadimagewithrequiredfilePostResponses; - -import java.io.IOException; -import java.util.Arrays; -import java.util.List; -import java.util.Map; -import java.util.AbstractMap; - -// if you want to use a server that is not SERVER_0 pass it in here and change the ServerIndex input below -ApiConfiguration.ServerInfo serverInfo = new ApiConfiguration.ServerInfoBuilder() - .rootServerInfo( - new RootServerInfo.RootServerInfoBuilder() - .rootServer0(new RootServer0()) - .build() - ) - .build(); -ApiConfiguration.ServerIndexInfo serverIndexInfo = new ApiConfiguration.ServerIndexInfoBuilder() - .rootServerInfoServerIndex(RootServerInfo.ServerIndex.SERVER_0) - .build(); -List securitySchemes = new ArrayList(); -ApiConfiguration.SecurityIndexInfo securityIndexInfo = new ApiConfiguration.SecurityIndexInfoBuilder() - .fakepetiduploadimagewithrequiredfilePostSecurityRequirementObject0SecurityIndex(FakepetiduploadimagewithrequiredfilePostSecurityRequirementObject0.SecurityIndex.SECURITY_0) - .build(); -Duration timeout = Duration.ofSeconds(1L); -Map> defaultHeaders = Map.of("User-Agent", List.of("OpenAPI-JSON-Schema-Generator/1.0.0/java")); -ApiConfiguration apiConfiguration = new ApiConfiguration( - serverInfo - serverIndexInfo, - securitySchemes, - securityIndexInfo, - timeout, - defaultHeaders -); -SchemaConfiguration schemaConfiguration = new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().build()); -FakepetiduploadimagewithrequiredfilePost.Post apiClient = new FakepetiduploadimagewithrequiredfilePost.Post(apiConfiguration, schemaConfiguration); - - -// Map validation -FakepetiduploadimagewithrequiredfilePostPathParameters.PathParametersMap pathParameters = - FakepetiduploadimagewithrequiredfilePostPathParameters.FakepetiduploadimagewithrequiredfilePostPathParameters1.validate( - new FakepetiduploadimagewithrequiredfilePostPathParameters.PathParametersMapBuilder() - .petId(1L) - - .build(), - schemaConfiguration -); - -var request = new FakepetiduploadimagewithrequiredfilePost.PostRequestBuilder() - .pathParameters(pathParameters) - .build(); - -FakepetiduploadimagewithrequiredfilePostResponses.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; -} -FakepetiduploadimagewithrequiredfilePostResponses.EndpointFakepetiduploadimagewithrequiredfilePostCode200Response castResponse = (FakepetiduploadimagewithrequiredfilePostResponses.EndpointFakepetiduploadimagewithrequiredfilePostCode200Response) response; -FakepetiduploadimagewithrequiredfilePostCode200Response.ApplicationjsonResponseBody deserializedBody = (FakepetiduploadimagewithrequiredfilePostCode200Response.ApplicationjsonResponseBody) castResponse.body; -// handle deserialized body here -``` -### Constructor Summary -| Constructor and Description | -| --------------------------- | -| Post(ApiConfiguration apiConfiguration, SchemaConfiguration schemaConfiguration)
Creates an instance | - -### Method Summary -| Modifier and Type | Method and Description | -| ----------------- | ---------------------- | -| [FakepetiduploadimagewithrequiredfilePostResponses.EndpointResponse](../../paths/fakepetiduploadimagewithrequiredfile/post/FakepetiduploadimagewithrequiredfilePostResponses.md#endpointresponse) | post([PostRequest](#postrequest) request) | - -## UploadFileWithRequiredFileOperation -public interface UploadFileWithRequiredFileOperation
- -an interface that allows one to call the endpoint using a method named uploadFileWithRequiredFile by the operationId - -### Method Summary -| Modifier and Type | Method and Description | -| ----------------- | ---------------------- | -| [FakepetiduploadimagewithrequiredfilePostResponses.EndpointResponse](../../paths/fakepetiduploadimagewithrequiredfile/post/FakepetiduploadimagewithrequiredfilePostResponses.md#endpointresponse) | uploadFileWithRequiredFile([PostRequest](#postrequest) request) | - -## PostRequest -public static class PostRequest
- -a class that stores the final request inputs - -### Field Summary -| Modifier and Type | Field and Description | -| ----------------- | --------------------- | -| [FakepetiduploadimagewithrequiredfilePostPathParameters.PathParametersMap](../../paths/fakepetiduploadimagewithrequiredfile/post/FakepetiduploadimagewithrequiredfilePostPathParameters.md#pathparametersmap) | pathParameters | -| [FakepetiduploadimagewithrequiredfilePostRequestBody.@Nullable SealedRequestBody](../../paths/fakepetiduploadimagewithrequiredfile/post/FakepetiduploadimagewithrequiredfilePostRequestBody.md#sealedrequestbody) | requestBody
optional | -| [RootServerInfo.@Nullable ServerIndex](../../RootServerInfo.md#serverindex) | serverIndex
optional. Note: this will override the value in apiConfiguration | -| [FakepetiduploadimagewithrequiredfilePostSecurityInfo.@Nullable SecurityIndex](../../paths/fakepetiduploadimagewithrequiredfile/post/FakepetiduploadimagewithrequiredfilePostSecurityInfo.md#securityindex) | securityIndex
optional. Note: this will override the value in apiConfiguration | -| @Nullable Duration | timeout
optional. Note: this will override the value in apiConfiguration | - -## PostNullableRequest -public static class PostNullableRequest
- -a class that stores the initial request inputs - -### Field Summary -| Modifier and Type | Field and Description | -| ----------------- | --------------------- | -| [FakepetiduploadimagewithrequiredfilePostPathParameters.@Nullable PathParametersMap](../../paths/fakepetiduploadimagewithrequiredfile/post/FakepetiduploadimagewithrequiredfilePostPathParameters.md#pathparametersmap) | pathParameters | -| [FakepetiduploadimagewithrequiredfilePostRequestBody.@Nullable SealedRequestBody](../../paths/fakepetiduploadimagewithrequiredfile/post/FakepetiduploadimagewithrequiredfilePostRequestBody.md#sealedrequestbody) | requestBody | -| [RootServerInfo.@Nullable ServerIndex](../../RootServerInfo.md#serverindex) | serverIndex | -| [FakepetiduploadimagewithrequiredfilePostSecurityInfo.@Nullable SecurityIndex](../../paths/fakepetiduploadimagewithrequiredfile/post/FakepetiduploadimagewithrequiredfilePostSecurityInfo.md#securityindex) | securityIndex | -| @Nullable Duration | timeout | - -## Post0RequestBuilder -public static class Post0RequestBuilder
- -a builder for request inputs - -### Constructor Summary -| Constructor and Description | -| --------------------------- | -| Post0RequestBuilder(Post0RequestBuilder instance)
Creates a builder that contains the passed instance | - -### Method Summary -| Modifier and Type | Method and Description | -| ----------------- | ---------------------- | -| [PostRequest](#postrequest) | build()
Returns the request input used to call an endpoint method | -| [Post0RequestBuilder](#post0requestbuilder) | requestBody([FakepetiduploadimagewithrequiredfilePostRequestBody.SealedRequestBody](../../paths/fakepetiduploadimagewithrequiredfile/post/FakepetiduploadimagewithrequiredfilePostRequestBody.md#sealedrequestbody) requestBody)
sets the optional property | -| [Post0RequestBuilder](#post0requestbuilder) | serverIndex([RootServerInfo.ServerIndex](../../RootServerInfo.md#serverindex) serverIndex)
sets the optional property. Note: this will override the value in apiConfiguration | -| [Post0RequestBuilder](#post0requestbuilder) | securityIndex([FakepetiduploadimagewithrequiredfilePostSecurityInfo.SecurityIndex](../../paths/fakepetiduploadimagewithrequiredfile/post/FakepetiduploadimagewithrequiredfilePostSecurityInfo.md#securityindex) securityIndex)
sets the optional property. Note: this will override the value in apiConfiguration | -| [Post0RequestBuilder](#post0requestbuilder) | timeout(Duration timeout)
sets the optional property. Note: this will override the value in apiConfiguration | - -## PostRequestBuilder -public static class PostRequestBuilder
- -a builder for request inputs - -### Constructor Summary -| Constructor and Description | -| --------------------------- | -| PostRequestBuilder()
Creates a builder that contains null for all parameters | - -### Method Summary -| Modifier and Type | Method and Description | -| ----------------- | ---------------------- | -| [Post0RequestBuilder](#post0requestbuilder) | pathParameters([FakepetiduploadimagewithrequiredfilePostPathParametersPathParametersMap](../../paths/fakepetiduploadimagewithrequiredfile/post/FakepetiduploadimagewithrequiredfilePostPathParameters.md#pathparametersmap) pathParameters)
sets the property | - -[[Back to top]](#top) [[Back to README]](../../../README.md) diff --git a/samples/client/petstore/kotlin/docs/paths/fakepetiduploadimagewithrequiredfile/post/FakepetiduploadimagewithrequiredfilePostPathParameters.md b/samples/client/petstore/kotlin/docs/paths/fakepetiduploadimagewithrequiredfile/post/FakepetiduploadimagewithrequiredfilePostPathParameters.md deleted file mode 100644 index 381179e8327..00000000000 --- a/samples/client/petstore/kotlin/docs/paths/fakepetiduploadimagewithrequiredfile/post/FakepetiduploadimagewithrequiredfilePostPathParameters.md +++ /dev/null @@ -1,271 +0,0 @@ -# FakepetiduploadimagewithrequiredfilePostPathParameters -public class FakepetiduploadimagewithrequiredfilePostPathParameters
- -A class that contains necessary nested -- schema classes (which validate payloads), extends JsonSchema -- sealed interfaces which store validated payloads, java version of a sum type -- boxed classes which store validated payloads, sealed permits class implementations -- classes to store validated map payloads, extends FrozenMap -- classes to build inputs for map payloads - -## Nested Class Summary -| Modifier and Type | Class and Description | -| ----------------- | ---------------------- | -| sealed interface | [FakepetiduploadimagewithrequiredfilePostPathParameters.FakepetiduploadimagewithrequiredfilePostPathParameters1Boxed](#fakepetiduploadimagewithrequiredfilepostpathparameters1boxed)
sealed interface for validated payloads | -| record | [FakepetiduploadimagewithrequiredfilePostPathParameters.FakepetiduploadimagewithrequiredfilePostPathParameters1BoxedMap](#fakepetiduploadimagewithrequiredfilepostpathparameters1boxedmap)
boxed class to store validated Map payloads | -| static class | [FakepetiduploadimagewithrequiredfilePostPathParameters.FakepetiduploadimagewithrequiredfilePostPathParameters1](#fakepetiduploadimagewithrequiredfilepostpathparameters1)
schema class | -| static class | [FakepetiduploadimagewithrequiredfilePostPathParameters.PathParametersMapBuilder](#pathparametersmapbuilder)
builder for Map payloads | -| static class | [FakepetiduploadimagewithrequiredfilePostPathParameters.PathParametersMap](#pathparametersmap)
output class for Map payloads | -| sealed interface | [FakepetiduploadimagewithrequiredfilePostPathParameters.AdditionalPropertiesBoxed](#additionalpropertiesboxed)
sealed interface for validated payloads | -| record | [FakepetiduploadimagewithrequiredfilePostPathParameters.AdditionalPropertiesBoxedVoid](#additionalpropertiesboxedvoid)
boxed class to store validated null payloads | -| record | [FakepetiduploadimagewithrequiredfilePostPathParameters.AdditionalPropertiesBoxedBoolean](#additionalpropertiesboxedboolean)
boxed class to store validated boolean payloads | -| record | [FakepetiduploadimagewithrequiredfilePostPathParameters.AdditionalPropertiesBoxedNumber](#additionalpropertiesboxednumber)
boxed class to store validated Number payloads | -| record | [FakepetiduploadimagewithrequiredfilePostPathParameters.AdditionalPropertiesBoxedString](#additionalpropertiesboxedstring)
boxed class to store validated String payloads | -| record | [FakepetiduploadimagewithrequiredfilePostPathParameters.AdditionalPropertiesBoxedList](#additionalpropertiesboxedlist)
boxed class to store validated List payloads | -| record | [FakepetiduploadimagewithrequiredfilePostPathParameters.AdditionalPropertiesBoxedMap](#additionalpropertiesboxedmap)
boxed class to store validated Map payloads | -| static class | [FakepetiduploadimagewithrequiredfilePostPathParameters.AdditionalProperties](#additionalproperties)
schema class | - -## FakepetiduploadimagewithrequiredfilePostPathParameters1Boxed -public sealed interface FakepetiduploadimagewithrequiredfilePostPathParameters1Boxed
-permits
-[FakepetiduploadimagewithrequiredfilePostPathParameters1BoxedMap](#fakepetiduploadimagewithrequiredfilepostpathparameters1boxedmap) - -sealed interface that stores validated payloads using boxed classes - -## FakepetiduploadimagewithrequiredfilePostPathParameters1BoxedMap -public record FakepetiduploadimagewithrequiredfilePostPathParameters1BoxedMap
-implements [FakepetiduploadimagewithrequiredfilePostPathParameters1Boxed](#fakepetiduploadimagewithrequiredfilepostpathparameters1boxed) - -record that stores validated Map payloads, sealed permits implementation - -### Constructor Summary -| Constructor and Description | -| --------------------------- | -| FakepetiduploadimagewithrequiredfilePostPathParameters1BoxedMap([PathParametersMap](#pathparametersmap) data)
Creates an instance, private visibility | - -### Method Summary -| Modifier and Type | Method and Description | -| ----------------- | ---------------------- | -| [PathParametersMap](#pathparametersmap) | data()
validated payload | -| @Nullable Object | getData()
validated payload | - -## FakepetiduploadimagewithrequiredfilePostPathParameters1 -public static class FakepetiduploadimagewithrequiredfilePostPathParameters1
-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.fakepetiduploadimagewithrequiredfile.post.FakepetiduploadimagewithrequiredfilePostPathParameters; - -import java.util.Arrays; -import java.util.List; -import java.util.AbstractMap; - -static final SchemaConfiguration configuration = new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().build()); - -// Map validation -FakepetiduploadimagewithrequiredfilePostPathParameters.PathParametersMap validatedPayload = - FakepetiduploadimagewithrequiredfilePostPathParameters.FakepetiduploadimagewithrequiredfilePostPathParameters1.validate( - new FakepetiduploadimagewithrequiredfilePostPathParameters.PathParametersMapBuilder() - .petId(1L) - - .build(), - configuration -); -``` - -### Field Summary -| Modifier and Type | Field and Description | -| ----------------- | ---------------------- | -| Set> | type = Set.of(Map.class) | -| Map> | properties = Map.ofEntries(
    new PropertyEntry("petId", [Schema0.Schema01.class](../../../paths/fakepetiduploadimagewithrequiredfile/post/parameters/parameter0/Schema0.md#schema01))
)
| -| Set | required = Set.of(
    "petId"
)
| -| Class | additionalProperties = [AdditionalProperties.class](#additionalproperties) | - -### Method Summary -| Modifier and Type | Method and Description | -| ----------------- | ---------------------- | -| [PathParametersMap](#pathparametersmap) | validate([Map<?, ?>](#pathparametersmapbuilder) arg, SchemaConfiguration configuration) | -| [FakepetiduploadimagewithrequiredfilePostPathParameters1BoxedMap](#fakepetiduploadimagewithrequiredfilepostpathparameters1boxedmap) | validateAndBox([Map<?, ?>](#pathparametersmapbuilder) arg, SchemaConfiguration configuration) | -| [FakepetiduploadimagewithrequiredfilePostPathParameters1Boxed](#fakepetiduploadimagewithrequiredfilepostpathparameters1boxed) | validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) | -| @Nullable Object | validate(@Nullable Object arg, SchemaConfiguration configuration) | - -## PathParametersMap0Builder -public class PathParametersMap0Builder
-builder for `Map` - -A class that builds the Map input type - -### Constructor Summary -| Constructor and Description | -| --------------------------- | -| PathParametersMap0Builder(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 | - -## PathParametersMapBuilder -public class PathParametersMapBuilder
-builder for `Map` - -A class that builds the Map input type - -### Constructor Summary -| Constructor and Description | -| --------------------------- | -| PathParametersMapBuilder()
Creates a builder that contains an empty map | - -### Method Summary -| Modifier and Type | Method and Description | -| ----------------- | ---------------------- | -| [PathParametersMap0Builder](#pathparametersmap0builder) | petId(int value) | -| [PathParametersMap0Builder](#pathparametersmap0builder) | petId(float value) | -| [PathParametersMap0Builder](#pathparametersmap0builder) | petId(long value) | -| [PathParametersMap0Builder](#pathparametersmap0builder) | petId(double value) | - -## PathParametersMap -public static class PathParametersMap
-extends FrozenMap - -A class to store validated Map payloads - -### Method Summary -| Modifier and Type | Method and Description | -| ----------------- | ---------------------- | -| static [PathParametersMap](#pathparametersmap) | of([Map](#pathparametersmapbuilder) arg, SchemaConfiguration configuration) | -| Number | petId()
| - -## 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(Nothing? data)
Creates an instance, private visibility | - -### Method Summary -| Modifier and Type | Method and Description | -| ----------------- | ---------------------- | -| Nothing? | 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/kotlin/docs/paths/fakepetiduploadimagewithrequiredfile/post/FakepetiduploadimagewithrequiredfilePostRequestBody.md b/samples/client/petstore/kotlin/docs/paths/fakepetiduploadimagewithrequiredfile/post/FakepetiduploadimagewithrequiredfilePostRequestBody.md deleted file mode 100644 index 59c267e0298..00000000000 --- a/samples/client/petstore/kotlin/docs/paths/fakepetiduploadimagewithrequiredfile/post/FakepetiduploadimagewithrequiredfilePostRequestBody.md +++ /dev/null @@ -1,90 +0,0 @@ -# FakepetiduploadimagewithrequiredfilePostRequestBody - -public class FakepetiduploadimagewithrequiredfilePostRequestBody - -A class that contains necessary nested request body classes -- SealedMediaType, a sealed interface which contains all the schema/encoding info for each contentType -- records which implement SealedMediaType, the concrete media types -- a class that extends RequestBodySerializer and is used to serialize input SealedRequestBody instances -- SealedRequestBody, a sealed interface which contains all the contentType/schema input types -- records which implement SealedRequestBody, the concrete request body types - -## Nested Class Summary -| Modifier and Type | Class and Description | -| ----------------- | --------------------- | -| sealed interface | [FakepetiduploadimagewithrequiredfilePostRequestBody.SealedMediaType](#sealedmediatype)
media type sealed interface | -| record | [FakepetiduploadimagewithrequiredfilePostRequestBody.MultipartformdataMediaType](#multipartformdatamediatype)
record storing schema + encoding for a specific contentType | -| static class | [FakepetiduploadimagewithrequiredfilePostRequestBody.FakepetiduploadimagewithrequiredfilePostRequestBody1](#fakepetiduploadimagewithrequiredfilepostrequestbody1)
class that serializes request bodies | -| sealed interface | [FakepetiduploadimagewithrequiredfilePostRequestBody.SealedRequestBody](#sealedrequestbody)
request body sealed interface | -| record | [FakepetiduploadimagewithrequiredfilePostRequestBody.MultipartformdataRequestBody](#multipartformdatarequestbody)
implements sealed interface to store request body input | - -## SealedMediaType -public sealed interface SealedMediaType
-permits
-[MultipartformdataMediaType](#multipartformdatamediatype) - -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), Nothing?> - -class storing schema info for a specific contentType - -### Constructor Summary -| Constructor and Description | -| --------------------------- | -| MultipartformdataMediaType()
Creates an instance | - -### 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 | -| Nothing? | encoding()
the encoding info | - -## FakepetiduploadimagewithrequiredfilePostRequestBody1 -public static class FakepetiduploadimagewithrequiredfilePostRequestBody1
- -a class that serializes SealedRequestBody request bodies - -### Constructor Summary -| Constructor and Description | -| --------------------------- | -| FakepetiduploadimagewithrequiredfilePostRequestBody1()
Creates an instance | - -### Field Summary -| Modifier and Type | Field and Description | -| ----------------- | --------------------- | -| boolean | required = false
whether the request body is required | -| Map | content = Map.ofEntries(
    new AbstractMap.SimpleEntry<>("multipart/form-data", new [MultipartformdataMediaType](#multipartformdatamediatype)())
)
the contentType to schema info | - -### Method Summary -| Modifier and Type | Method and Description | -| ----------------- | ---------------------- | -| SerializedRequestBody | serialize([SealedRequestBody](#sealedrequestbody) requestBody)
called by endpoint when creating request body bytes | - -## SealedRequestBody -public sealed interface SealedRequestBody
-permits
-[MultipartformdataRequestBody](#multipartformdatarequestbody) - -sealed interface that stores request contentType + validated schema data - -## MultipartformdataRequestBody -public record MultipartformdataRequestBody
-implements [SealedRequestBody](#sealedrequestbody),
-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 | - -### 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 | diff --git a/samples/client/petstore/kotlin/docs/paths/fakepetiduploadimagewithrequiredfile/post/FakepetiduploadimagewithrequiredfilePostResponses.md b/samples/client/petstore/kotlin/docs/paths/fakepetiduploadimagewithrequiredfile/post/FakepetiduploadimagewithrequiredfilePostResponses.md deleted file mode 100644 index 264b1071b7a..00000000000 --- a/samples/client/petstore/kotlin/docs/paths/fakepetiduploadimagewithrequiredfile/post/FakepetiduploadimagewithrequiredfilePostResponses.md +++ /dev/null @@ -1,29 +0,0 @@ -# FakepetiduploadimagewithrequiredfilePostResponses - -public class FakepetiduploadimagewithrequiredfilePostResponses - -A class that contains necessary responses classes -- a sealed interface, EndpointResponse, that stores endpoint responses -- records for each endpoint response - -## Nested Class Summary -| Modifier and Type | Class and Description | -| ----------------- | --------------------- | -| sealed interface | [EndpointResponse](#endpointresponse)
stores the endpoint responses | -| record | [EndpointFakepetiduploadimagewithrequiredfilePostCode200Response](#endpointfakepetiduploadimagewithrequiredfilepostcode200response)
the response for 200 | - -## EndpointResponse -public sealed interface EndpointResponse permits
-[EndpointFakepetiduploadimagewithrequiredfilePostCode200Response](#endpointfakepetiduploadimagewithrequiredfilepostcode200response) - -a sealed interface that stores endpoint responses - -## EndpointFakepetiduploadimagewithrequiredfilePostCode200Response -public record EndpointFakepetiduploadimagewithrequiredfilePostCode200Response( - HttpResponse response, - [FakepetiduploadimagewithrequiredfilePostCode200Response.SealedResponseBody](../../../paths/fakepetiduploadimagewithrequiredfile/post/responses/FakepetiduploadimagewithrequiredfilePostCode200Response.md#sealedresponsebody) body, - Nothing? headers -) implements EndpointResponse, ApiResponse
- -a class that stores an endpoint response - diff --git a/samples/client/petstore/kotlin/docs/paths/fakepetiduploadimagewithrequiredfile/post/FakepetiduploadimagewithrequiredfilePostSecurityInfo.md b/samples/client/petstore/kotlin/docs/paths/fakepetiduploadimagewithrequiredfile/post/FakepetiduploadimagewithrequiredfilePostSecurityInfo.md deleted file mode 100644 index 7d31590a6a5..00000000000 --- a/samples/client/petstore/kotlin/docs/paths/fakepetiduploadimagewithrequiredfile/post/FakepetiduploadimagewithrequiredfilePostSecurityInfo.md +++ /dev/null @@ -1,40 +0,0 @@ -# FakepetiduploadimagewithrequiredfilePostSecurityInfo -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 -- an enum class that describes security index values - -## Nested Class Summary -| Modifier and Type | Class and Description | -| ----------------- | --------------------- | -| static class | [FakepetiduploadimagewithrequiredfilePostSecurityInfo.FakepetiduploadimagewithrequiredfilePostSecurityInfo1](#fakepetiduploadimagewithrequiredfilepostsecurityinfo1)
SecurityRequirementObjectProvider -| enum | [FakepetiduploadimagewithrequiredfilePostSecurityInfo.SecurityIndex](#securityindex)
class that stores a security index | - -## FakepetiduploadimagewithrequiredfilePostSecurityInfo1 -implements SecurityRequirementObjectProvider<[SecurityIndex](#securityindex)> - -### Constructor Summary -| Constructor and Description | -| --------------------------- | -| FakepetiduploadimagewithrequiredfilePostSecurityInfo1()
Creates an instance | - -### Field Summary -| Modifier and Type | Field and Description | -| ----------------- | --------------------- | -| [FakepetiduploadimagewithrequiredfilePostSecurityRequirementObject0](../../../paths/fakepetiduploadimagewithrequiredfile/post/security/FakepetiduploadimagewithrequiredfilePostSecurityRequirementObject0.md) | security0 | - -### Method Summary -| Modifier and Type | Method and Description | -| ----------------- | ---------------------- | -| SecurityRequirementObject | getSecurityRequirementObject(@Nullable [SecurityIndex](#securityindex) securityIndex)
If null is input, then the instance's securityIndex will be used | - -## SecurityIndex -enum SecurityIndex
- -### Enum Constant Summary -| Enum Constant And Description | -| ----------------------------- | -| SECURITY_0
security 0 | diff --git a/samples/client/petstore/kotlin/docs/paths/fakepetiduploadimagewithrequiredfile/post/parameters/parameter0/Schema0.md b/samples/client/petstore/kotlin/docs/paths/fakepetiduploadimagewithrequiredfile/post/parameters/parameter0/Schema0.md deleted file mode 100644 index 55e4e5cb238..00000000000 --- a/samples/client/petstore/kotlin/docs/paths/fakepetiduploadimagewithrequiredfile/post/parameters/parameter0/Schema0.md +++ /dev/null @@ -1,49 +0,0 @@ -# Schema0 -public class Schema0
- -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 - -## Nested Class Summary -| Modifier and Type | Class and Description | -| ----------------- | ---------------------- | -| sealed interface | [Schema0.Schema01Boxed](#schema01boxed)
sealed interface for validated payloads | -| record | [Schema0.Schema01BoxedNumber](#schema01boxednumber)
boxed class to store validated Number payloads | -| static class | [Schema0.Schema01](#schema01)
schema class | - -## Schema01Boxed -public sealed interface Schema01Boxed
-permits
-[Schema01BoxedNumber](#schema01boxednumber) - -sealed interface that stores validated payloads using boxed classes - -## Schema01BoxedNumber -public record Schema01BoxedNumber
-implements [Schema01Boxed](#schema01boxed) - -record that stores validated Number payloads, sealed permits implementation - -### Constructor Summary -| Constructor and Description | -| --------------------------- | -| Schema01BoxedNumber(Number data)
Creates an instance, private visibility | - -### Method Summary -| Modifier and Type | Method and Description | -| ----------------- | ---------------------- | -| Number | data()
validated payload | -| @Nullable Object | getData()
validated payload | - -## Schema01 -public static class Schema01
-extends Int64JsonSchema.Int64JsonSchema1 - -A schema class that validates payloads - -| Methods Inherited from class org.openapijsonschematools.client.schemas.Int64JsonSchema.Int64JsonSchema1 | -| ------------------------------------------------------------------ | -| validate | -| validateAndBox | diff --git a/samples/client/petstore/kotlin/docs/paths/fakepetiduploadimagewithrequiredfile/post/requestbody/content/multipartformdata/MultipartformdataSchema.md b/samples/client/petstore/kotlin/docs/paths/fakepetiduploadimagewithrequiredfile/post/requestbody/content/multipartformdata/MultipartformdataSchema.md deleted file mode 100644 index 180e48073aa..00000000000 --- a/samples/client/petstore/kotlin/docs/paths/fakepetiduploadimagewithrequiredfile/post/requestbody/content/multipartformdata/MultipartformdataSchema.md +++ /dev/null @@ -1,206 +0,0 @@ -# MultipartformdataSchema -public class MultipartformdataSchema
- -A class that contains necessary nested -- schema classes (which validate payloads), extends JsonSchema -- sealed interfaces which store validated payloads, java version of a sum type -- boxed classes which store validated payloads, sealed permits class implementations -- classes to store validated map payloads, extends FrozenMap -- classes to build inputs for map payloads - -## Nested Class Summary -| Modifier and Type | Class and Description | -| ----------------- | ---------------------- | -| sealed interface | [MultipartformdataSchema.MultipartformdataSchema1Boxed](#multipartformdataschema1boxed)
sealed interface for validated payloads | -| record | [MultipartformdataSchema.MultipartformdataSchema1BoxedMap](#multipartformdataschema1boxedmap)
boxed class to store validated Map payloads | -| static class | [MultipartformdataSchema.MultipartformdataSchema1](#multipartformdataschema1)
schema class | -| static class | [MultipartformdataSchema.MultipartformdataSchemaMapBuilder](#multipartformdataschemamapbuilder)
builder for Map payloads | -| static class | [MultipartformdataSchema.MultipartformdataSchemaMap](#multipartformdataschemamap)
output class for Map payloads | -| sealed interface | [MultipartformdataSchema.MultipartformdataRequiredFileBoxed](#multipartformdatarequiredfileboxed)
sealed interface for validated payloads | -| static class | [MultipartformdataSchema.MultipartformdataRequiredFile](#multipartformdatarequiredfile)
schema class | -| sealed interface | [MultipartformdataSchema.MultipartformdataAdditionalMetadataBoxed](#multipartformdataadditionalmetadataboxed)
sealed interface for validated payloads | -| record | [MultipartformdataSchema.MultipartformdataAdditionalMetadataBoxedString](#multipartformdataadditionalmetadataboxedstring)
boxed class to store validated String payloads | -| static class | [MultipartformdataSchema.MultipartformdataAdditionalMetadata](#multipartformdataadditionalmetadata)
schema class | - -## MultipartformdataSchema1Boxed -public sealed interface MultipartformdataSchema1Boxed
-permits
-[MultipartformdataSchema1BoxedMap](#multipartformdataschema1boxedmap) - -sealed interface that stores validated payloads using boxed classes - -## MultipartformdataSchema1BoxedMap -public record MultipartformdataSchema1BoxedMap
-implements [MultipartformdataSchema1Boxed](#multipartformdataschema1boxed) - -record that stores validated Map payloads, sealed permits implementation - -### Constructor Summary -| Constructor and Description | -| --------------------------- | -| MultipartformdataSchema1BoxedMap([MultipartformdataSchemaMap](#multipartformdataschemamap) data)
Creates an instance, private visibility | - -### Method Summary -| Modifier and Type | Method and Description | -| ----------------- | ---------------------- | -| [MultipartformdataSchemaMap](#multipartformdataschemamap) | data()
validated payload | -| @Nullable Object | getData()
validated payload | - -## MultipartformdataSchema1 -public static class MultipartformdataSchema1
-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.fakepetiduploadimagewithrequiredfile.post.requestbody.content.multipartformdata.MultipartformdataSchema; - -import java.util.Arrays; -import java.util.List; -import java.util.AbstractMap; - -static final SchemaConfiguration configuration = new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().build()); - -// Map validation -MultipartformdataSchema.MultipartformdataSchemaMap validatedPayload = - MultipartformdataSchema.MultipartformdataSchema1.validate( - new MultipartformdataSchema.MultipartformdataSchemaMapBuilder() - .requiredFile("a") - - .additionalMetadata("a") - - .build(), - configuration -); -``` - -### Field Summary -| Modifier and Type | Field and Description | -| ----------------- | ---------------------- | -| Set> | type = Set.of(Map.class) | -| Map> | properties = Map.ofEntries(
    new PropertyEntry("additionalMetadata", [MultipartformdataAdditionalMetadata.class](#multipartformdataadditionalmetadata))),
    new PropertyEntry("requiredFile", [MultipartformdataRequiredFile.class](#multipartformdatarequiredfile)))
)
| -| Set | required = Set.of(
    "requiredFile"
)
| - -### Method Summary -| Modifier and Type | Method and Description | -| ----------------- | ---------------------- | -| [MultipartformdataSchemaMap](#multipartformdataschemamap) | validate([Map<?, ?>](#multipartformdataschemamapbuilder) arg, SchemaConfiguration configuration) | -| [MultipartformdataSchema1BoxedMap](#multipartformdataschema1boxedmap) | validateAndBox([Map<?, ?>](#multipartformdataschemamapbuilder) arg, SchemaConfiguration configuration) | -| [MultipartformdataSchema1Boxed](#multipartformdataschema1boxed) | validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) | -| @Nullable Object | validate(@Nullable Object arg, SchemaConfiguration configuration) | - -## MultipartformdataSchemaMap0Builder -public class MultipartformdataSchemaMap0Builder
-builder for `Map` - -A class that builds the Map input type - -### Constructor Summary -| Constructor and Description | -| --------------------------- | -| MultipartformdataSchemaMap0Builder(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 | -| [MultipartformdataSchemaMap0Builder](#multipartformdataschemamap0builder) | additionalMetadata(String value) | -| [MultipartformdataSchemaMap0Builder](#multipartformdataschemamap0builder) | additionalProperty(String key, Nothing? value) | -| [MultipartformdataSchemaMap0Builder](#multipartformdataschemamap0builder) | additionalProperty(String key, boolean value) | -| [MultipartformdataSchemaMap0Builder](#multipartformdataschemamap0builder) | additionalProperty(String key, String value) | -| [MultipartformdataSchemaMap0Builder](#multipartformdataschemamap0builder) | additionalProperty(String key, int value) | -| [MultipartformdataSchemaMap0Builder](#multipartformdataschemamap0builder) | additionalProperty(String key, float value) | -| [MultipartformdataSchemaMap0Builder](#multipartformdataschemamap0builder) | additionalProperty(String key, long value) | -| [MultipartformdataSchemaMap0Builder](#multipartformdataschemamap0builder) | additionalProperty(String key, double value) | -| [MultipartformdataSchemaMap0Builder](#multipartformdataschemamap0builder) | additionalProperty(String key, List value) | -| [MultipartformdataSchemaMap0Builder](#multipartformdataschemamap0builder) | additionalProperty(String key, Map value) | - -## MultipartformdataSchemaMapBuilder -public class MultipartformdataSchemaMapBuilder
-builder for `Map` - -A class that builds the Map input type - -### Constructor Summary -| Constructor and Description | -| --------------------------- | -| MultipartformdataSchemaMapBuilder()
Creates a builder that contains an empty map | - -### Method Summary -| Modifier and Type | Method and Description | -| ----------------- | ---------------------- | -| [MultipartformdataSchemaMap0Builder](#multipartformdataschemamap0builder) | requiredFile(String value) | - -## MultipartformdataSchemaMap -public static class MultipartformdataSchemaMap
-extends FrozenMap - -A class to store validated Map payloads - -### Method Summary -| Modifier and Type | Method and Description | -| ----------------- | ---------------------- | -| static [MultipartformdataSchemaMap](#multipartformdataschemamap) | of([Map](#multipartformdataschemamapbuilder) arg, SchemaConfiguration configuration) | -| String | requiredFile()
| -| String | additionalMetadata()
[optional] | -| @Nullable Object | getAdditionalProperty(String name)
provides type safety for additional properties | - -## MultipartformdataRequiredFileBoxed -public sealed interface MultipartformdataRequiredFileBoxed
-permits
- -sealed interface that stores validated payloads using boxed classes - -## MultipartformdataRequiredFile -public static class MultipartformdataRequiredFile
-extends JsonSchema - -A schema class that validates payloads - -## Description -file to upload - -## MultipartformdataAdditionalMetadataBoxed -public sealed interface MultipartformdataAdditionalMetadataBoxed
-permits
-[MultipartformdataAdditionalMetadataBoxedString](#multipartformdataadditionalmetadataboxedstring) - -sealed interface that stores validated payloads using boxed classes - -## MultipartformdataAdditionalMetadataBoxedString -public record MultipartformdataAdditionalMetadataBoxedString
-implements [MultipartformdataAdditionalMetadataBoxed](#multipartformdataadditionalmetadataboxed) - -record that stores validated String payloads, sealed permits implementation - -### Constructor Summary -| Constructor and Description | -| --------------------------- | -| MultipartformdataAdditionalMetadataBoxedString(String data)
Creates an instance, private visibility | - -### Method Summary -| Modifier and Type | Method and Description | -| ----------------- | ---------------------- | -| String | data()
validated payload | -| @Nullable Object | getData()
validated payload | - -## MultipartformdataAdditionalMetadata -public static class MultipartformdataAdditionalMetadata
-extends StringJsonSchema.StringJsonSchema1 - -A schema class that validates payloads - -## Description -Additional data to pass to server - -| Methods Inherited from class org.openapijsonschematools.client.schemas.StringJsonSchema.StringJsonSchema1 | -| ------------------------------------------------------------------ | -| validate | -| validateAndBox | diff --git a/samples/client/petstore/kotlin/docs/paths/fakepetiduploadimagewithrequiredfile/post/responses/FakepetiduploadimagewithrequiredfilePostCode200Response.md b/samples/client/petstore/kotlin/docs/paths/fakepetiduploadimagewithrequiredfile/post/responses/FakepetiduploadimagewithrequiredfilePostCode200Response.md deleted file mode 100644 index 72c77fc7a61..00000000000 --- a/samples/client/petstore/kotlin/docs/paths/fakepetiduploadimagewithrequiredfile/post/responses/FakepetiduploadimagewithrequiredfilePostCode200Response.md +++ /dev/null @@ -1,87 +0,0 @@ -# FakepetiduploadimagewithrequiredfilePostCode200Response - -public class FakepetiduploadimagewithrequiredfilePostCode200Response - -A class that contains necessary nested response classes -- SealedMediaType, a sealed interface which contains all the schema/encoding info for each contentType -- records which implement SealedMediaType, the concrete media types -- SealedResponseBody, a sealed interface which contains all the contentType/schema types -- records which implement SealedResponseBody, the concrete response body types -- a class that extends ResponseDeserializer and is used to deserialize responses - -## Nested Class Summary -| Modifier and Type | Class and Description | -| ----------------- | --------------------- | -| sealed interface | [FakepetiduploadimagewithrequiredfilePostCode200Response.SealedMediaType](#sealedmediatype)
media type sealed interface | -| record | [FakepetiduploadimagewithrequiredfilePostCode200Response.ApplicationjsonMediaType](#applicationjsonmediatype)
record storing schema + encoding for a specific contentType | -| sealed interface | [FakepetiduploadimagewithrequiredfilePostCode200Response.SealedResponseBody](#sealedresponsebody)
response body sealed interface | -| record | [FakepetiduploadimagewithrequiredfilePostCode200Response.ApplicationjsonResponseBody](#applicationjsonresponsebody)
implements sealed interface to store response body | -| static class | [FakepetiduploadimagewithrequiredfilePostCode200Response.FakepetiduploadimagewithrequiredfilePostCode200Response1](#fakepetiduploadimagewithrequiredfilepostcode200response1)
class that deserializes responses | - -## SealedMediaType -public sealed interface SealedMediaType
-permits
-[ApplicationjsonMediaType](#applicationjsonmediatype) - -sealed interface that stores schema and encoding info - -## ApplicationjsonMediaType -public record ApplicationjsonMediaType
-implements [SealedMediaType](#sealedmediatype), MediaType<[ApplicationjsonSchema.ApplicationjsonSchema1](../../../../paths/fakepetiduploadimagewithrequiredfile/post/responses/code200response/content/applicationjson/ApplicationjsonSchema.md#applicationjsonschema1), Nothing?> - -class storing schema info for a specific contentType - -### Constructor Summary -| Constructor and Description | -| --------------------------- | -| ApplicationjsonMediaType()
Creates an instance | - -### Method Summary -| Modifier and Type | Method and Description | -| ----------------- | ---------------------- | -| [ApplicationjsonSchema.ApplicationjsonSchema1](../../../../paths/fakepetiduploadimagewithrequiredfile/post/responses/code200response/content/applicationjson/ApplicationjsonSchema.md#applicationjsonschema1) | schema()
the schema for this MediaType | -| Nothing? | encoding()
the encoding info | - -## SealedResponseBody -public sealed interface SealedResponseBody
-permits
-[ApplicationjsonResponseBody](#applicationjsonresponsebody) - -sealed interface that stores response body - -## ApplicationjsonResponseBody -public record ApplicationjsonResponseBody
-implements [SealedResponseBody](#sealedresponsebody) - -A record class to store response body for contentType="application/json" - -### Constructor Summary -| Constructor and Description | -| --------------------------- | -| ApplicationjsonResponseBody(ApplicationjsonSchema.[ApiResponseSchema1Boxed](../../../../components/schemas/ApiResponseSchema.md#apiresponseschema1boxed) body)
Creates an instance | - -### Method Summary -| Modifier and Type | Method and Description | -| ----------------- | ---------------------- | -| ApplicationjsonSchema.[ApiResponseSchema1Boxed](../../../../components/schemas/ApiResponseSchema.md#apiresponseschema1boxed) | body()
returns the body passed in in the constructor | - -## FakepetiduploadimagewithrequiredfilePostCode200Response1 -public static class FakepetiduploadimagewithrequiredfilePostCode200Response1
-extends ResponseDeserializer<[SealedResponseBody](#sealedresponsebody), Nothing?, [SealedMediaType](#sealedmediatype)> - -a class that deserializes responses - -### Constructor Summary -| Constructor and Description | -| --------------------------- | -| FakepetiduploadimagewithrequiredfilePostCode200Response1()
Creates an instance | - -### Field Summary -| Modifier and Type | Field and Description | -| ----------------- | --------------------- | -| 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 | -| ----------------- | ---------------------- | -| ApiResponse<[SealedResponseBody](#sealedresponsebody), Nothing?> | deserialize(HttpResponse response, SchemaConfiguration configuration)
called by endpoint when deserialize responses | diff --git a/samples/client/petstore/kotlin/docs/paths/fakepetiduploadimagewithrequiredfile/post/responses/code200response/content/applicationjson/ApplicationjsonSchema.md b/samples/client/petstore/kotlin/docs/paths/fakepetiduploadimagewithrequiredfile/post/responses/code200response/content/applicationjson/ApplicationjsonSchema.md deleted file mode 100644 index bb60c5776fb..00000000000 --- a/samples/client/petstore/kotlin/docs/paths/fakepetiduploadimagewithrequiredfile/post/responses/code200response/content/applicationjson/ApplicationjsonSchema.md +++ /dev/null @@ -1,19 +0,0 @@ -# ApplicationjsonSchema -public class ApplicationjsonSchema
-extends [ApiResponseSchema1](../../../../../../../components/schemas/ApiResponseSchema.md#apiresponseschema) - -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 - -## Nested Class Summary -| Modifier and Type | Class and Description | -| ----------------- | ---------------------- | -| static class | [ApplicationjsonSchema.ApplicationjsonSchema1](#applicationjsonschema1)
schema class | - -## ApplicationjsonSchema1 -public static class ApplicationjsonSchema1
-extends [ApiResponseSchema.ApiResponseSchema1](../../../../../../../components/schemas/ApiResponseSchema.md#apiresponseschema1) - -A schema class that validates payloads diff --git a/samples/client/petstore/kotlin/docs/paths/fakepetiduploadimagewithrequiredfile/post/security/FakepetiduploadimagewithrequiredfilePostSecurityRequirementObject0.md b/samples/client/petstore/kotlin/docs/paths/fakepetiduploadimagewithrequiredfile/post/security/FakepetiduploadimagewithrequiredfilePostSecurityRequirementObject0.md deleted file mode 100644 index 3e58c101d48..00000000000 --- a/samples/client/petstore/kotlin/docs/paths/fakepetiduploadimagewithrequiredfile/post/security/FakepetiduploadimagewithrequiredfilePostSecurityRequirementObject0.md +++ /dev/null @@ -1,15 +0,0 @@ -# FakepetiduploadimagewithrequiredfilePostSecurityRequirementObject0 -FakepetiduploadimagewithrequiredfilePostSecurityRequirementObject0.java - -public class FakepetiduploadimagewithrequiredfilePostSecurityRequirementObject0 -extends SecurityRequirementObject - -### Constructor Summary -| Constructor and Description | -| --------------------------- | -| FakepetiduploadimagewithrequiredfilePostSecurityRequirementObject0()
Creates an instance | - -### 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")
    )) | diff --git a/samples/client/petstore/kotlin/docs/paths/fakequeryparamwithjsoncontenttype/FakequeryparamwithjsoncontenttypeGet.md b/samples/client/petstore/kotlin/docs/paths/fakequeryparamwithjsoncontenttype/FakequeryparamwithjsoncontenttypeGet.md deleted file mode 100644 index 7371ae8d0dc..00000000000 --- a/samples/client/petstore/kotlin/docs/paths/fakequeryparamwithjsoncontenttype/FakequeryparamwithjsoncontenttypeGet.md +++ /dev/null @@ -1,185 +0,0 @@ -# FakequeryparamwithjsoncontenttypeGet - -public class FakequeryparamwithjsoncontenttypeGet - -A class that contains necessary endpoint classes -- a class that calls the endpoint method using the http verb -- a class that calls the endpoint method using the operationId name -- class(es) to store the request inputs -- builder(s) to set the request input data - -## Nested Class Summary -| Modifier and Type | Class and Description | -| ----------------- | --------------------- | -| static class | [Get](#get)
The class that has a get method to call the endpoint | -| interface | [QueryParamWithJsonContentTypeOperation](#queryparamwithjsoncontenttypeoperation)
The interface that has a queryParamWithJsonContentType method to call the endpoint | -| static class | [GetRequest](#getrequest)
The final request inputs class | -| static class | [GetNullableRequest](#getnullablerequest)
The initial request inputs class | -| static class | [Get0RequestBuilder](#get0requestbuilder)
A builder for the request input class | -| static class | [GetRequestBuilder](#getrequestbuilder)
A builder for the request input class | - -## Get -public static class Get extends ApiClient.ApiClient1 implements GetOperation
- -a class that allows one to call the endpoint using a method named get - -### 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.fakequeryparamwithjsoncontenttype.get.FakequeryparamwithjsoncontenttypeGetQueryParameters; -import org.openapijsonschematools.client.servers.RootServer0; -import org.openapijsonschematools.client.servers.RootServer1; -import org.openapijsonschematools.client.servers.RootServer2; -import org.openapijsonschematools.client.paths.fakequeryparamwithjsoncontenttype.get.responses.FakequeryparamwithjsoncontenttypeGetCode200Response; -import org.openapijsonschematools.client.servers.RootServerInfo; -import org.openapijsonschematools.client.paths.fakequeryparamwithjsoncontenttype.FakequeryparamwithjsoncontenttypeGet; -import org.openapijsonschematools.client.paths.fakequeryparamwithjsoncontenttype.get.FakequeryparamwithjsoncontenttypeGetResponses; - -import java.io.IOException; -import java.util.Arrays; -import java.util.List; -import java.util.Map; -import java.util.AbstractMap; - -// if you want to use a server that is not SERVER_0 pass it in here and change the ServerIndex input below -ApiConfiguration.ServerInfo serverInfo = new ApiConfiguration.ServerInfoBuilder() - .rootServerInfo( - new RootServerInfo.RootServerInfoBuilder() - .rootServer0(new RootServer0()) - .build() - ) - .build(); -ApiConfiguration.ServerIndexInfo serverIndexInfo = new ApiConfiguration.ServerIndexInfoBuilder() - .rootServerInfoServerIndex(RootServerInfo.ServerIndex.SERVER_0) - .build(); -Duration timeout = Duration.ofSeconds(1L); -Map> defaultHeaders = Map.of("User-Agent", List.of("OpenAPI-JSON-Schema-Generator/1.0.0/java")); -ApiConfiguration apiConfiguration = new ApiConfiguration( - serverInfo - serverIndexInfo, - timeout, - defaultHeaders -); -SchemaConfiguration schemaConfiguration = new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().build()); -FakequeryparamwithjsoncontenttypeGet.Get apiClient = new FakequeryparamwithjsoncontenttypeGet.Get(apiConfiguration, schemaConfiguration); - - -// Map validation -FakequeryparamwithjsoncontenttypeGetQueryParameters.QueryParametersMap queryParameters = - FakequeryparamwithjsoncontenttypeGetQueryParameters.FakequeryparamwithjsoncontenttypeGetQueryParameters1.validate( - new FakequeryparamwithjsoncontenttypeGetQueryParameters.QueryParametersMapBuilder() - .build(), - schemaConfiguration -); - -var request = new FakequeryparamwithjsoncontenttypeGet.GetRequestBuilder() - .queryParameters(queryParameters) - .build(); - -FakequeryparamwithjsoncontenttypeGetResponses.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; -} -FakequeryparamwithjsoncontenttypeGetResponses.EndpointFakequeryparamwithjsoncontenttypeGetCode200Response castResponse = (FakequeryparamwithjsoncontenttypeGetResponses.EndpointFakequeryparamwithjsoncontenttypeGetCode200Response) response; -FakequeryparamwithjsoncontenttypeGetCode200Response.ApplicationjsonResponseBody deserializedBody = (FakequeryparamwithjsoncontenttypeGetCode200Response.ApplicationjsonResponseBody) castResponse.body; -// handle deserialized body here -``` -### Constructor Summary -| Constructor and Description | -| --------------------------- | -| Get(ApiConfiguration apiConfiguration, SchemaConfiguration schemaConfiguration)
Creates an instance | - -### Method Summary -| Modifier and Type | Method and Description | -| ----------------- | ---------------------- | -| [FakequeryparamwithjsoncontenttypeGetResponses.EndpointResponse](../../paths/fakequeryparamwithjsoncontenttype/get/FakequeryparamwithjsoncontenttypeGetResponses.md#endpointresponse) | get([GetRequest](#getrequest) request) | - -## QueryParamWithJsonContentTypeOperation -public interface QueryParamWithJsonContentTypeOperation
- -an interface that allows one to call the endpoint using a method named queryParamWithJsonContentType by the operationId - -### Method Summary -| Modifier and Type | Method and Description | -| ----------------- | ---------------------- | -| [FakequeryparamwithjsoncontenttypeGetResponses.EndpointResponse](../../paths/fakequeryparamwithjsoncontenttype/get/FakequeryparamwithjsoncontenttypeGetResponses.md#endpointresponse) | queryParamWithJsonContentType([GetRequest](#getrequest) request) | - -## GetRequest -public static class GetRequest
- -a class that stores the final request inputs - -### Field Summary -| Modifier and Type | Field and Description | -| ----------------- | --------------------- | -| [FakequeryparamwithjsoncontenttypeGetQueryParameters.QueryParametersMap](../../paths/fakequeryparamwithjsoncontenttype/get/FakequeryparamwithjsoncontenttypeGetQueryParameters.md#queryparametersmap) | queryParameters | -| [RootServerInfo.@Nullable ServerIndex](../../RootServerInfo.md#serverindex) | serverIndex
optional. Note: this will override the value in apiConfiguration | -| @Nullable Duration | timeout
optional. Note: this will override the value in apiConfiguration | - -## GetNullableRequest -public static class GetNullableRequest
- -a class that stores the initial request inputs - -### Field Summary -| Modifier and Type | Field and Description | -| ----------------- | --------------------- | -| [FakequeryparamwithjsoncontenttypeGetQueryParameters.@Nullable QueryParametersMap](../../paths/fakequeryparamwithjsoncontenttype/get/FakequeryparamwithjsoncontenttypeGetQueryParameters.md#queryparametersmap) | queryParameters | -| [RootServerInfo.@Nullable ServerIndex](../../RootServerInfo.md#serverindex) | serverIndex | -| @Nullable Duration | timeout | - -## Get0RequestBuilder -public static class Get0RequestBuilder
- -a builder for request inputs - -### Constructor Summary -| Constructor and Description | -| --------------------------- | -| Get0RequestBuilder(Get0RequestBuilder instance)
Creates a builder that contains the passed instance | - -### Method Summary -| Modifier and Type | Method and Description | -| ----------------- | ---------------------- | -| [GetRequest](#getrequest) | build()
Returns the request input used to call an endpoint method | -| [Get0RequestBuilder](#get0requestbuilder) | serverIndex([RootServerInfo.ServerIndex](../../RootServerInfo.md#serverindex) serverIndex)
sets the optional property. Note: this will override the value in apiConfiguration | -| [Get0RequestBuilder](#get0requestbuilder) | timeout(Duration timeout)
sets the optional property. Note: this will override the value in apiConfiguration | - -## GetRequestBuilder -public static class GetRequestBuilder
- -a builder for request inputs - -### Constructor Summary -| Constructor and Description | -| --------------------------- | -| GetRequestBuilder()
Creates a builder that contains null for all parameters | - -### Method Summary -| Modifier and Type | Method and Description | -| ----------------- | ---------------------- | -| [Get0RequestBuilder](#get0requestbuilder) | queryParameters([FakequeryparamwithjsoncontenttypeGetQueryParametersQueryParametersMap](../../paths/fakequeryparamwithjsoncontenttype/get/FakequeryparamwithjsoncontenttypeGetQueryParameters.md#queryparametersmap) queryParameters)
sets the property | - -[[Back to top]](#top) [[Back to README]](../../../README.md) diff --git a/samples/client/petstore/kotlin/docs/paths/fakequeryparamwithjsoncontenttype/get/FakequeryparamwithjsoncontenttypeGetQueryParameters.md b/samples/client/petstore/kotlin/docs/paths/fakequeryparamwithjsoncontenttype/get/FakequeryparamwithjsoncontenttypeGetQueryParameters.md deleted file mode 100644 index d846ab685ae..00000000000 --- a/samples/client/petstore/kotlin/docs/paths/fakequeryparamwithjsoncontenttype/get/FakequeryparamwithjsoncontenttypeGetQueryParameters.md +++ /dev/null @@ -1,274 +0,0 @@ -# FakequeryparamwithjsoncontenttypeGetQueryParameters -public class FakequeryparamwithjsoncontenttypeGetQueryParameters
- -A class that contains necessary nested -- schema classes (which validate payloads), extends JsonSchema -- sealed interfaces which store validated payloads, java version of a sum type -- boxed classes which store validated payloads, sealed permits class implementations -- classes to store validated map payloads, extends FrozenMap -- classes to build inputs for map payloads - -## Nested Class Summary -| Modifier and Type | Class and Description | -| ----------------- | ---------------------- | -| sealed interface | [FakequeryparamwithjsoncontenttypeGetQueryParameters.FakequeryparamwithjsoncontenttypeGetQueryParameters1Boxed](#fakequeryparamwithjsoncontenttypegetqueryparameters1boxed)
sealed interface for validated payloads | -| record | [FakequeryparamwithjsoncontenttypeGetQueryParameters.FakequeryparamwithjsoncontenttypeGetQueryParameters1BoxedMap](#fakequeryparamwithjsoncontenttypegetqueryparameters1boxedmap)
boxed class to store validated Map payloads | -| static class | [FakequeryparamwithjsoncontenttypeGetQueryParameters.FakequeryparamwithjsoncontenttypeGetQueryParameters1](#fakequeryparamwithjsoncontenttypegetqueryparameters1)
schema class | -| static class | [FakequeryparamwithjsoncontenttypeGetQueryParameters.QueryParametersMapBuilder](#queryparametersmapbuilder)
builder for Map payloads | -| static class | [FakequeryparamwithjsoncontenttypeGetQueryParameters.QueryParametersMap](#queryparametersmap)
output class for Map payloads | -| sealed interface | [FakequeryparamwithjsoncontenttypeGetQueryParameters.AdditionalPropertiesBoxed](#additionalpropertiesboxed)
sealed interface for validated payloads | -| record | [FakequeryparamwithjsoncontenttypeGetQueryParameters.AdditionalPropertiesBoxedVoid](#additionalpropertiesboxedvoid)
boxed class to store validated null payloads | -| record | [FakequeryparamwithjsoncontenttypeGetQueryParameters.AdditionalPropertiesBoxedBoolean](#additionalpropertiesboxedboolean)
boxed class to store validated boolean payloads | -| record | [FakequeryparamwithjsoncontenttypeGetQueryParameters.AdditionalPropertiesBoxedNumber](#additionalpropertiesboxednumber)
boxed class to store validated Number payloads | -| record | [FakequeryparamwithjsoncontenttypeGetQueryParameters.AdditionalPropertiesBoxedString](#additionalpropertiesboxedstring)
boxed class to store validated String payloads | -| record | [FakequeryparamwithjsoncontenttypeGetQueryParameters.AdditionalPropertiesBoxedList](#additionalpropertiesboxedlist)
boxed class to store validated List payloads | -| record | [FakequeryparamwithjsoncontenttypeGetQueryParameters.AdditionalPropertiesBoxedMap](#additionalpropertiesboxedmap)
boxed class to store validated Map payloads | -| static class | [FakequeryparamwithjsoncontenttypeGetQueryParameters.AdditionalProperties](#additionalproperties)
schema class | - -## FakequeryparamwithjsoncontenttypeGetQueryParameters1Boxed -public sealed interface FakequeryparamwithjsoncontenttypeGetQueryParameters1Boxed
-permits
-[FakequeryparamwithjsoncontenttypeGetQueryParameters1BoxedMap](#fakequeryparamwithjsoncontenttypegetqueryparameters1boxedmap) - -sealed interface that stores validated payloads using boxed classes - -## FakequeryparamwithjsoncontenttypeGetQueryParameters1BoxedMap -public record FakequeryparamwithjsoncontenttypeGetQueryParameters1BoxedMap
-implements [FakequeryparamwithjsoncontenttypeGetQueryParameters1Boxed](#fakequeryparamwithjsoncontenttypegetqueryparameters1boxed) - -record that stores validated Map payloads, sealed permits implementation - -### Constructor Summary -| Constructor and Description | -| --------------------------- | -| FakequeryparamwithjsoncontenttypeGetQueryParameters1BoxedMap([QueryParametersMap](#queryparametersmap) data)
Creates an instance, private visibility | - -### Method Summary -| Modifier and Type | Method and Description | -| ----------------- | ---------------------- | -| [QueryParametersMap](#queryparametersmap) | data()
validated payload | -| @Nullable Object | getData()
validated payload | - -## FakequeryparamwithjsoncontenttypeGetQueryParameters1 -public static class FakequeryparamwithjsoncontenttypeGetQueryParameters1
-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.fakequeryparamwithjsoncontenttype.get.FakequeryparamwithjsoncontenttypeGetQueryParameters; - -import java.util.Arrays; -import java.util.List; -import java.util.AbstractMap; - -static final SchemaConfiguration configuration = new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().build()); - -// Map validation -FakequeryparamwithjsoncontenttypeGetQueryParameters.QueryParametersMap validatedPayload = - FakequeryparamwithjsoncontenttypeGetQueryParameters.FakequeryparamwithjsoncontenttypeGetQueryParameters1.validate( - new FakequeryparamwithjsoncontenttypeGetQueryParameters.QueryParametersMapBuilder() - .build(), - configuration -); -``` - -### Field Summary -| Modifier and Type | Field and Description | -| ----------------- | ---------------------- | -| Set> | type = Set.of(Map.class) | -| Map> | properties = Map.ofEntries(
    new PropertyEntry("someParam", [Schema0.Schema01.class](../../../paths/fakequeryparamwithjsoncontenttype/get/parameters/parameter0/content/applicationjson/Schema0.md#schema01))
)
| -| Set | required = Set.of(
    "someParam"
)
| -| Class | additionalProperties = [AdditionalProperties.class](#additionalproperties) | - -### Method Summary -| Modifier and Type | Method and Description | -| ----------------- | ---------------------- | -| [QueryParametersMap](#queryparametersmap) | validate([Map<?, ?>](#queryparametersmapbuilder) arg, SchemaConfiguration configuration) | -| [FakequeryparamwithjsoncontenttypeGetQueryParameters1BoxedMap](#fakequeryparamwithjsoncontenttypegetqueryparameters1boxedmap) | validateAndBox([Map<?, ?>](#queryparametersmapbuilder) arg, SchemaConfiguration configuration) | -| [FakequeryparamwithjsoncontenttypeGetQueryParameters1Boxed](#fakequeryparamwithjsoncontenttypegetqueryparameters1boxed) | validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) | -| @Nullable Object | validate(@Nullable Object arg, SchemaConfiguration configuration) | - -## QueryParametersMap0Builder -public class QueryParametersMap0Builder
-builder for `Map` - -A class that builds the Map input type - -### Constructor Summary -| Constructor and Description | -| --------------------------- | -| QueryParametersMap0Builder(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 | - -## QueryParametersMapBuilder -public class QueryParametersMapBuilder
-builder for `Map` - -A class that builds the Map input type - -### Constructor Summary -| Constructor and Description | -| --------------------------- | -| QueryParametersMapBuilder()
Creates a builder that contains an empty map | - -### Method Summary -| Modifier and Type | Method and Description | -| ----------------- | ---------------------- | -| [QueryParametersMap0Builder](#queryparametersmap0builder) | someParam(Nothing? value) | -| [QueryParametersMap0Builder](#queryparametersmap0builder) | someParam(boolean value) | -| [QueryParametersMap0Builder](#queryparametersmap0builder) | someParam(String value) | -| [QueryParametersMap0Builder](#queryparametersmap0builder) | someParam(int value) | -| [QueryParametersMap0Builder](#queryparametersmap0builder) | someParam(float value) | -| [QueryParametersMap0Builder](#queryparametersmap0builder) | someParam(long value) | -| [QueryParametersMap0Builder](#queryparametersmap0builder) | someParam(double value) | -| [QueryParametersMap0Builder](#queryparametersmap0builder) | someParam(List value) | -| [QueryParametersMap0Builder](#queryparametersmap0builder) | someParam(Map value) | - -## QueryParametersMap -public static class QueryParametersMap
-extends FrozenMap - -A class to store validated Map payloads - -### Method Summary -| Modifier and Type | Method and Description | -| ----------------- | ---------------------- | -| static [QueryParametersMap](#queryparametersmap) | of([Map](#queryparametersmapbuilder) arg, SchemaConfiguration configuration) | -| @Nullable Object | someParam()
| - -## 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(Nothing? data)
Creates an instance, private visibility | - -### Method Summary -| Modifier and Type | Method and Description | -| ----------------- | ---------------------- | -| Nothing? | 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/kotlin/docs/paths/fakequeryparamwithjsoncontenttype/get/FakequeryparamwithjsoncontenttypeGetResponses.md b/samples/client/petstore/kotlin/docs/paths/fakequeryparamwithjsoncontenttype/get/FakequeryparamwithjsoncontenttypeGetResponses.md deleted file mode 100644 index ba1b35aa4ef..00000000000 --- a/samples/client/petstore/kotlin/docs/paths/fakequeryparamwithjsoncontenttype/get/FakequeryparamwithjsoncontenttypeGetResponses.md +++ /dev/null @@ -1,29 +0,0 @@ -# FakequeryparamwithjsoncontenttypeGetResponses - -public class FakequeryparamwithjsoncontenttypeGetResponses - -A class that contains necessary responses classes -- a sealed interface, EndpointResponse, that stores endpoint responses -- records for each endpoint response - -## Nested Class Summary -| Modifier and Type | Class and Description | -| ----------------- | --------------------- | -| sealed interface | [EndpointResponse](#endpointresponse)
stores the endpoint responses | -| record | [EndpointFakequeryparamwithjsoncontenttypeGetCode200Response](#endpointfakequeryparamwithjsoncontenttypegetcode200response)
the response for 200 | - -## EndpointResponse -public sealed interface EndpointResponse permits
-[EndpointFakequeryparamwithjsoncontenttypeGetCode200Response](#endpointfakequeryparamwithjsoncontenttypegetcode200response) - -a sealed interface that stores endpoint responses - -## EndpointFakequeryparamwithjsoncontenttypeGetCode200Response -public record EndpointFakequeryparamwithjsoncontenttypeGetCode200Response( - HttpResponse response, - [FakequeryparamwithjsoncontenttypeGetCode200Response.SealedResponseBody](../../../paths/fakequeryparamwithjsoncontenttype/get/responses/FakequeryparamwithjsoncontenttypeGetCode200Response.md#sealedresponsebody) body, - Nothing? headers -) implements EndpointResponse, ApiResponse
- -a class that stores an endpoint response - diff --git a/samples/client/petstore/kotlin/docs/paths/fakequeryparamwithjsoncontenttype/get/parameters/parameter0/content/applicationjson/Schema0.md b/samples/client/petstore/kotlin/docs/paths/fakequeryparamwithjsoncontenttype/get/parameters/parameter0/content/applicationjson/Schema0.md deleted file mode 100644 index 9cf0dc4f86c..00000000000 --- a/samples/client/petstore/kotlin/docs/paths/fakequeryparamwithjsoncontenttype/get/parameters/parameter0/content/applicationjson/Schema0.md +++ /dev/null @@ -1,144 +0,0 @@ -# Schema0 -public class Schema0
- -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 - -## Nested Class Summary -| Modifier and Type | Class and Description | -| ----------------- | ---------------------- | -| sealed interface | [Schema0.Schema01Boxed](#schema01boxed)
sealed interface for validated payloads | -| record | [Schema0.Schema01BoxedVoid](#schema01boxedvoid)
boxed class to store validated null payloads | -| record | [Schema0.Schema01BoxedBoolean](#schema01boxedboolean)
boxed class to store validated boolean payloads | -| record | [Schema0.Schema01BoxedNumber](#schema01boxednumber)
boxed class to store validated Number payloads | -| record | [Schema0.Schema01BoxedString](#schema01boxedstring)
boxed class to store validated String payloads | -| record | [Schema0.Schema01BoxedList](#schema01boxedlist)
boxed class to store validated List payloads | -| record | [Schema0.Schema01BoxedMap](#schema01boxedmap)
boxed class to store validated Map payloads | -| static class | [Schema0.Schema01](#schema01)
schema class | - -## Schema01Boxed -public sealed interface Schema01Boxed
-permits
-[Schema01BoxedVoid](#schema01boxedvoid), -[Schema01BoxedBoolean](#schema01boxedboolean), -[Schema01BoxedNumber](#schema01boxednumber), -[Schema01BoxedString](#schema01boxedstring), -[Schema01BoxedList](#schema01boxedlist), -[Schema01BoxedMap](#schema01boxedmap) - -sealed interface that stores validated payloads using boxed classes - -## Schema01BoxedVoid -public record Schema01BoxedVoid
-implements [Schema01Boxed](#schema01boxed) - -record that stores validated null payloads, sealed permits implementation - -### Constructor Summary -| Constructor and Description | -| --------------------------- | -| Schema01BoxedVoid(Nothing? data)
Creates an instance, private visibility | - -### Method Summary -| Modifier and Type | Method and Description | -| ----------------- | ---------------------- | -| Nothing? | data()
validated payload | -| @Nullable Object | getData()
validated payload | - -## Schema01BoxedBoolean -public record Schema01BoxedBoolean
-implements [Schema01Boxed](#schema01boxed) - -record that stores validated boolean payloads, sealed permits implementation - -### Constructor Summary -| Constructor and Description | -| --------------------------- | -| Schema01BoxedBoolean(boolean data)
Creates an instance, private visibility | - -### Method Summary -| Modifier and Type | Method and Description | -| ----------------- | ---------------------- | -| boolean | data()
validated payload | -| @Nullable Object | getData()
validated payload | - -## Schema01BoxedNumber -public record Schema01BoxedNumber
-implements [Schema01Boxed](#schema01boxed) - -record that stores validated Number payloads, sealed permits implementation - -### Constructor Summary -| Constructor and Description | -| --------------------------- | -| Schema01BoxedNumber(Number data)
Creates an instance, private visibility | - -### Method Summary -| Modifier and Type | Method and Description | -| ----------------- | ---------------------- | -| Number | data()
validated payload | -| @Nullable Object | getData()
validated payload | - -## Schema01BoxedString -public record Schema01BoxedString
-implements [Schema01Boxed](#schema01boxed) - -record that stores validated String payloads, sealed permits implementation - -### Constructor Summary -| Constructor and Description | -| --------------------------- | -| Schema01BoxedString(String data)
Creates an instance, private visibility | - -### Method Summary -| Modifier and Type | Method and Description | -| ----------------- | ---------------------- | -| String | data()
validated payload | -| @Nullable Object | getData()
validated payload | - -## Schema01BoxedList -public record Schema01BoxedList
-implements [Schema01Boxed](#schema01boxed) - -record that stores validated List payloads, sealed permits implementation - -### Constructor Summary -| Constructor and Description | -| --------------------------- | -| Schema01BoxedList(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 | - -## Schema01BoxedMap -public record Schema01BoxedMap
-implements [Schema01Boxed](#schema01boxed) - -record that stores validated Map payloads, sealed permits implementation - -### Constructor Summary -| Constructor and Description | -| --------------------------- | -| Schema01BoxedMap(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 | - -## Schema01 -public static class Schema01
-extends AnyTypeJsonSchema.AnyTypeJsonSchema1 - -A schema class that validates payloads - -| Methods Inherited from class org.openapijsonschematools.client.schemas.AnyTypeJsonSchema.AnyTypeJsonSchema1 | -| ------------------------------------------------------------------ | -| validate | -| validateAndBox | diff --git a/samples/client/petstore/kotlin/docs/paths/fakequeryparamwithjsoncontenttype/get/responses/FakequeryparamwithjsoncontenttypeGetCode200Response.md b/samples/client/petstore/kotlin/docs/paths/fakequeryparamwithjsoncontenttype/get/responses/FakequeryparamwithjsoncontenttypeGetCode200Response.md deleted file mode 100644 index f1bc0044a76..00000000000 --- a/samples/client/petstore/kotlin/docs/paths/fakequeryparamwithjsoncontenttype/get/responses/FakequeryparamwithjsoncontenttypeGetCode200Response.md +++ /dev/null @@ -1,87 +0,0 @@ -# FakequeryparamwithjsoncontenttypeGetCode200Response - -public class FakequeryparamwithjsoncontenttypeGetCode200Response - -A class that contains necessary nested response classes -- SealedMediaType, a sealed interface which contains all the schema/encoding info for each contentType -- records which implement SealedMediaType, the concrete media types -- SealedResponseBody, a sealed interface which contains all the contentType/schema types -- records which implement SealedResponseBody, the concrete response body types -- a class that extends ResponseDeserializer and is used to deserialize responses - -## Nested Class Summary -| Modifier and Type | Class and Description | -| ----------------- | --------------------- | -| sealed interface | [FakequeryparamwithjsoncontenttypeGetCode200Response.SealedMediaType](#sealedmediatype)
media type sealed interface | -| record | [FakequeryparamwithjsoncontenttypeGetCode200Response.ApplicationjsonMediaType](#applicationjsonmediatype)
record storing schema + encoding for a specific contentType | -| sealed interface | [FakequeryparamwithjsoncontenttypeGetCode200Response.SealedResponseBody](#sealedresponsebody)
response body sealed interface | -| record | [FakequeryparamwithjsoncontenttypeGetCode200Response.ApplicationjsonResponseBody](#applicationjsonresponsebody)
implements sealed interface to store response body | -| static class | [FakequeryparamwithjsoncontenttypeGetCode200Response.FakequeryparamwithjsoncontenttypeGetCode200Response1](#fakequeryparamwithjsoncontenttypegetcode200response1)
class that deserializes responses | - -## SealedMediaType -public sealed interface SealedMediaType
-permits
-[ApplicationjsonMediaType](#applicationjsonmediatype) - -sealed interface that stores schema and encoding info - -## ApplicationjsonMediaType -public record ApplicationjsonMediaType
-implements [SealedMediaType](#sealedmediatype), MediaType<[ApplicationjsonSchema.ApplicationjsonSchema1](../../../../paths/fakequeryparamwithjsoncontenttype/get/responses/code200response/content/applicationjson/ApplicationjsonSchema.md#applicationjsonschema1), Nothing?> - -class storing schema info for a specific contentType - -### Constructor Summary -| Constructor and Description | -| --------------------------- | -| ApplicationjsonMediaType()
Creates an instance | - -### Method Summary -| Modifier and Type | Method and Description | -| ----------------- | ---------------------- | -| [ApplicationjsonSchema.ApplicationjsonSchema1](../../../../paths/fakequeryparamwithjsoncontenttype/get/responses/code200response/content/applicationjson/ApplicationjsonSchema.md#applicationjsonschema1) | schema()
the schema for this MediaType | -| Nothing? | encoding()
the encoding info | - -## SealedResponseBody -public sealed interface SealedResponseBody
-permits
-[ApplicationjsonResponseBody](#applicationjsonresponsebody) - -sealed interface that stores response body - -## ApplicationjsonResponseBody -public record ApplicationjsonResponseBody
-implements [SealedResponseBody](#sealedresponsebody) - -A record class to store response body for contentType="application/json" - -### Constructor Summary -| Constructor and Description | -| --------------------------- | -| ApplicationjsonResponseBody(ApplicationjsonSchema.AnyTypeJsonSchema1Boxed body)
Creates an instance | - -### Method Summary -| Modifier and Type | Method and Description | -| ----------------- | ---------------------- | -| ApplicationjsonSchema.AnyTypeJsonSchema1Boxed | body()
returns the body passed in in the constructor | - -## FakequeryparamwithjsoncontenttypeGetCode200Response1 -public static class FakequeryparamwithjsoncontenttypeGetCode200Response1
-extends ResponseDeserializer<[SealedResponseBody](#sealedresponsebody), Nothing?, [SealedMediaType](#sealedmediatype)> - -a class that deserializes responses - -### Constructor Summary -| Constructor and Description | -| --------------------------- | -| FakequeryparamwithjsoncontenttypeGetCode200Response1()
Creates an instance | - -### Field Summary -| Modifier and Type | Field and Description | -| ----------------- | --------------------- | -| 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 | -| ----------------- | ---------------------- | -| ApiResponse<[SealedResponseBody](#sealedresponsebody), Nothing?> | deserialize(HttpResponse response, SchemaConfiguration configuration)
called by endpoint when deserialize responses | diff --git a/samples/client/petstore/kotlin/docs/paths/fakequeryparamwithjsoncontenttype/get/responses/code200response/content/applicationjson/ApplicationjsonSchema.md b/samples/client/petstore/kotlin/docs/paths/fakequeryparamwithjsoncontenttype/get/responses/code200response/content/applicationjson/ApplicationjsonSchema.md deleted file mode 100644 index b05260b1abf..00000000000 --- a/samples/client/petstore/kotlin/docs/paths/fakequeryparamwithjsoncontenttype/get/responses/code200response/content/applicationjson/ApplicationjsonSchema.md +++ /dev/null @@ -1,144 +0,0 @@ -# ApplicationjsonSchema -public class ApplicationjsonSchema
- -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 - -## Nested Class Summary -| Modifier and Type | Class and Description | -| ----------------- | ---------------------- | -| sealed interface | [ApplicationjsonSchema.ApplicationjsonSchema1Boxed](#applicationjsonschema1boxed)
sealed interface for validated payloads | -| record | [ApplicationjsonSchema.ApplicationjsonSchema1BoxedVoid](#applicationjsonschema1boxedvoid)
boxed class to store validated null payloads | -| record | [ApplicationjsonSchema.ApplicationjsonSchema1BoxedBoolean](#applicationjsonschema1boxedboolean)
boxed class to store validated boolean payloads | -| record | [ApplicationjsonSchema.ApplicationjsonSchema1BoxedNumber](#applicationjsonschema1boxednumber)
boxed class to store validated Number payloads | -| record | [ApplicationjsonSchema.ApplicationjsonSchema1BoxedString](#applicationjsonschema1boxedstring)
boxed class to store validated String payloads | -| record | [ApplicationjsonSchema.ApplicationjsonSchema1BoxedList](#applicationjsonschema1boxedlist)
boxed class to store validated List payloads | -| record | [ApplicationjsonSchema.ApplicationjsonSchema1BoxedMap](#applicationjsonschema1boxedmap)
boxed class to store validated Map payloads | -| static class | [ApplicationjsonSchema.ApplicationjsonSchema1](#applicationjsonschema1)
schema class | - -## ApplicationjsonSchema1Boxed -public sealed interface ApplicationjsonSchema1Boxed
-permits
-[ApplicationjsonSchema1BoxedVoid](#applicationjsonschema1boxedvoid), -[ApplicationjsonSchema1BoxedBoolean](#applicationjsonschema1boxedboolean), -[ApplicationjsonSchema1BoxedNumber](#applicationjsonschema1boxednumber), -[ApplicationjsonSchema1BoxedString](#applicationjsonschema1boxedstring), -[ApplicationjsonSchema1BoxedList](#applicationjsonschema1boxedlist), -[ApplicationjsonSchema1BoxedMap](#applicationjsonschema1boxedmap) - -sealed interface that stores validated payloads using boxed classes - -## ApplicationjsonSchema1BoxedVoid -public record ApplicationjsonSchema1BoxedVoid
-implements [ApplicationjsonSchema1Boxed](#applicationjsonschema1boxed) - -record that stores validated null payloads, sealed permits implementation - -### Constructor Summary -| Constructor and Description | -| --------------------------- | -| ApplicationjsonSchema1BoxedVoid(Nothing? data)
Creates an instance, private visibility | - -### Method Summary -| Modifier and Type | Method and Description | -| ----------------- | ---------------------- | -| Nothing? | data()
validated payload | -| @Nullable Object | getData()
validated payload | - -## ApplicationjsonSchema1BoxedBoolean -public record ApplicationjsonSchema1BoxedBoolean
-implements [ApplicationjsonSchema1Boxed](#applicationjsonschema1boxed) - -record that stores validated boolean payloads, sealed permits implementation - -### Constructor Summary -| Constructor and Description | -| --------------------------- | -| ApplicationjsonSchema1BoxedBoolean(boolean data)
Creates an instance, private visibility | - -### Method Summary -| Modifier and Type | Method and Description | -| ----------------- | ---------------------- | -| boolean | data()
validated payload | -| @Nullable Object | getData()
validated payload | - -## ApplicationjsonSchema1BoxedNumber -public record ApplicationjsonSchema1BoxedNumber
-implements [ApplicationjsonSchema1Boxed](#applicationjsonschema1boxed) - -record that stores validated Number payloads, sealed permits implementation - -### Constructor Summary -| Constructor and Description | -| --------------------------- | -| ApplicationjsonSchema1BoxedNumber(Number data)
Creates an instance, private visibility | - -### Method Summary -| Modifier and Type | Method and Description | -| ----------------- | ---------------------- | -| Number | data()
validated payload | -| @Nullable Object | getData()
validated payload | - -## ApplicationjsonSchema1BoxedString -public record ApplicationjsonSchema1BoxedString
-implements [ApplicationjsonSchema1Boxed](#applicationjsonschema1boxed) - -record that stores validated String payloads, sealed permits implementation - -### Constructor Summary -| Constructor and Description | -| --------------------------- | -| ApplicationjsonSchema1BoxedString(String data)
Creates an instance, private visibility | - -### Method Summary -| Modifier and Type | Method and Description | -| ----------------- | ---------------------- | -| String | data()
validated payload | -| @Nullable Object | getData()
validated payload | - -## ApplicationjsonSchema1BoxedList -public record ApplicationjsonSchema1BoxedList
-implements [ApplicationjsonSchema1Boxed](#applicationjsonschema1boxed) - -record that stores validated List payloads, sealed permits implementation - -### Constructor Summary -| Constructor and Description | -| --------------------------- | -| ApplicationjsonSchema1BoxedList(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 | - -## ApplicationjsonSchema1BoxedMap -public record ApplicationjsonSchema1BoxedMap
-implements [ApplicationjsonSchema1Boxed](#applicationjsonschema1boxed) - -record that stores validated Map payloads, sealed permits implementation - -### Constructor Summary -| Constructor and Description | -| --------------------------- | -| ApplicationjsonSchema1BoxedMap(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 | - -## ApplicationjsonSchema1 -public static class ApplicationjsonSchema1
-extends AnyTypeJsonSchema.AnyTypeJsonSchema1 - -A schema class that validates payloads - -| Methods Inherited from class org.openapijsonschematools.client.schemas.AnyTypeJsonSchema.AnyTypeJsonSchema1 | -| ------------------------------------------------------------------ | -| validate | -| validateAndBox | diff --git a/samples/client/petstore/kotlin/docs/paths/fakeredirection/FakeredirectionGet.md b/samples/client/petstore/kotlin/docs/paths/fakeredirection/FakeredirectionGet.md deleted file mode 100644 index fc63432c009..00000000000 --- a/samples/client/petstore/kotlin/docs/paths/fakeredirection/FakeredirectionGet.md +++ /dev/null @@ -1,146 +0,0 @@ -# FakeredirectionGet - -public class FakeredirectionGet - -A class that contains necessary endpoint classes -- a class that calls the endpoint method using the http verb -- a class that calls the endpoint method using the operationId name -- class(es) to store the request inputs -- builder(s) to set the request input data - -## Nested Class Summary -| Modifier and Type | Class and Description | -| ----------------- | --------------------- | -| static class | [Get](#get)
The class that has a get method to call the endpoint | -| interface | [RedirectionOperation](#redirectionoperation)
The interface that has a redirection method to call the endpoint | -| static class | [GetRequest](#getrequest)
The request inputs class | -| static class | [GetRequestBuilder](#getrequestbuilder)
A builder for the request input class | - -## Get -public static class Get extends ApiClient.ApiClient1 implements GetOperation
- -a class that allows one to call the endpoint using a method named get - -### 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.servers.RootServer0; -import org.openapijsonschematools.client.servers.RootServer1; -import org.openapijsonschematools.client.servers.RootServer2; -import org.openapijsonschematools.client.paths.fakeredirection.get.responses.FakeredirectionGetCode303Response; -import org.openapijsonschematools.client.paths.fakeredirection.get.responses.FakeredirectionGetCode3XXResponse; -import org.openapijsonschematools.client.servers.RootServerInfo; -import org.openapijsonschematools.client.paths.fakeredirection.FakeredirectionGet; -import org.openapijsonschematools.client.paths.fakeredirection.get.FakeredirectionGetResponses; - -import java.io.IOException; -import java.util.Arrays; -import java.util.List; -import java.util.Map; -import java.util.AbstractMap; - -// if you want to use a server that is not SERVER_0 pass it in here and change the ServerIndex input below -ApiConfiguration.ServerInfo serverInfo = new ApiConfiguration.ServerInfoBuilder() - .rootServerInfo( - new RootServerInfo.RootServerInfoBuilder() - .rootServer0(new RootServer0()) - .build() - ) - .build(); -ApiConfiguration.ServerIndexInfo serverIndexInfo = new ApiConfiguration.ServerIndexInfoBuilder() - .rootServerInfoServerIndex(RootServerInfo.ServerIndex.SERVER_0) - .build(); -Duration timeout = Duration.ofSeconds(1L); -Map> defaultHeaders = Map.of("User-Agent", List.of("OpenAPI-JSON-Schema-Generator/1.0.0/java")); -ApiConfiguration apiConfiguration = new ApiConfiguration( - serverInfo - serverIndexInfo, - timeout, - defaultHeaders -); -SchemaConfiguration schemaConfiguration = new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().build()); -FakeredirectionGet.Get apiClient = new FakeredirectionGet.Get(apiConfiguration, schemaConfiguration); - - -var request = new FakeredirectionGet.GetRequestBuilder().build(); - -FakeredirectionGetResponses.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; -} -if (response instanceof FakeredirectionGetResponses.EndpointFakeredirectionGetCode3XXResponse castResponse) { -} else { - FakeredirectionGetResponses.EndpointFakeredirectionGetCode303Response castResponse = (FakeredirectionGetResponses.EndpointFakeredirectionGetCode303Response) response; -} -``` -### Constructor Summary -| Constructor and Description | -| --------------------------- | -| Get(ApiConfiguration apiConfiguration, SchemaConfiguration schemaConfiguration)
Creates an instance | - -### Method Summary -| Modifier and Type | Method and Description | -| ----------------- | ---------------------- | -| [FakeredirectionGetResponses.EndpointResponse](../../paths/fakeredirection/get/FakeredirectionGetResponses.md#endpointresponse) | get([GetRequest](#getrequest) request) | - -## RedirectionOperation -public interface RedirectionOperation
- -an interface that allows one to call the endpoint using a method named redirection by the operationId - -### Method Summary -| Modifier and Type | Method and Description | -| ----------------- | ---------------------- | -| [FakeredirectionGetResponses.EndpointResponse](../../paths/fakeredirection/get/FakeredirectionGetResponses.md#endpointresponse) | redirection([GetRequest](#getrequest) request) | - -## GetRequest -public static class GetRequest
- -a class that stores the final request inputs - -### Field Summary -| Modifier and Type | Field and Description | -| ----------------- | --------------------- | -| [RootServerInfo.@Nullable ServerIndex](../../RootServerInfo.md#serverindex) | serverIndex
optional. Note: this will override the value in apiConfiguration | -| @Nullable Duration | timeout
optional. Note: this will override the value in apiConfiguration | - -## GetRequestBuilder -public static class GetRequestBuilder
- -a builder for request inputs - -### Constructor Summary -| Constructor and Description | -| --------------------------- | -| GetRequestBuilder()
Creates a builder that contains null for all parameters | - -### Method Summary -| Modifier and Type | Method and Description | -| ----------------- | ---------------------- | -| [GetRequest](#getrequest) | build()
Returns the request input used to call an endpoint method | -| [GetRequestBuilder](#getrequestbuilder) | serverIndex([RootServerInfo.ServerIndex](../../RootServerInfo.md#serverindex) serverIndex)
sets the optional property. Note: this will override the value in apiConfiguration | -| [GetRequestBuilder](#getrequestbuilder) | timeout(Duration timeout)
sets the optional property. Note: this will override the value in apiConfiguration | - -[[Back to top]](#top) [[Back to README]](../../../README.md) diff --git a/samples/client/petstore/kotlin/docs/paths/fakeredirection/get/FakeredirectionGetResponses.md b/samples/client/petstore/kotlin/docs/paths/fakeredirection/get/FakeredirectionGetResponses.md deleted file mode 100644 index ae99e3b60b0..00000000000 --- a/samples/client/petstore/kotlin/docs/paths/fakeredirection/get/FakeredirectionGetResponses.md +++ /dev/null @@ -1,40 +0,0 @@ -# FakeredirectionGetResponses - -public class FakeredirectionGetResponses - -A class that contains necessary responses classes -- a sealed interface, EndpointResponse, that stores endpoint responses -- records for each endpoint response - -## Nested Class Summary -| Modifier and Type | Class and Description | -| ----------------- | --------------------- | -| sealed interface | [EndpointResponse](#endpointresponse)
stores the endpoint responses | -| record | [EndpointFakeredirectionGetCode3XXResponse](#endpointfakeredirectiongetcode3xxresponse)
the response for 3XX | -| record | [EndpointFakeredirectionGetCode303Response](#endpointfakeredirectiongetcode303response)
the response for 303 | - -## EndpointResponse -public sealed interface EndpointResponse permits
-[EndpointFakeredirectionGetCode3XXResponse](#endpointfakeredirectiongetcode3xxresponse), -[EndpointFakeredirectionGetCode303Response](#endpointfakeredirectiongetcode303response) - -a sealed interface that stores endpoint responses - -## EndpointFakeredirectionGetCode3XXResponse -public record EndpointFakeredirectionGetCode3XXResponse( - HttpResponse response, - Nothing? body, - Nothing? headers -) implements EndpointResponse, ApiResponse
- -a class that stores an endpoint response - -## EndpointFakeredirectionGetCode303Response -public record EndpointFakeredirectionGetCode303Response( - HttpResponse response, - Nothing? body, - Nothing? headers -) implements EndpointResponse, ApiResponse
- -a class that stores an endpoint response - diff --git a/samples/client/petstore/kotlin/docs/paths/fakeredirection/get/responses/FakeredirectionGetCode303Response.md b/samples/client/petstore/kotlin/docs/paths/fakeredirection/get/responses/FakeredirectionGetCode303Response.md deleted file mode 100644 index bfce98f22a9..00000000000 --- a/samples/client/petstore/kotlin/docs/paths/fakeredirection/get/responses/FakeredirectionGetCode303Response.md +++ /dev/null @@ -1,32 +0,0 @@ -# FakeredirectionGetCode303Response - -public class FakeredirectionGetCode303Response - -A class that contains necessary nested response classes -- a class that extends ResponseDeserializer and is used to deserialize responses - -## Nested Class Summary -| Modifier and Type | Class and Description | -| ----------------- | --------------------- | -| static class | [FakeredirectionGetCode303Response.FakeredirectionGetCode303Response1](#fakeredirectiongetcode303response1)
class that deserializes responses | - -## FakeredirectionGetCode303Response1 -public static class FakeredirectionGetCode303Response1
-extends ResponseDeserializer - -a class that deserializes responses - -### Constructor Summary -| Constructor and Description | -| --------------------------- | -| FakeredirectionGetCode303Response1()
Creates an instance | - -### Field Summary -| Modifier and Type | Field and Description | -| ----------------- | --------------------- | -| Map | content = MapUtils.makeMap(
)
the contentType to schema info | - -### Method Summary -| Modifier and Type | Method and Description | -| ----------------- | ---------------------- | -| ApiResponse | deserialize(HttpResponse response, SchemaConfiguration configuration)
called by endpoint when deserialize responses | diff --git a/samples/client/petstore/kotlin/docs/paths/fakeredirection/get/responses/FakeredirectionGetCode3XXResponse.md b/samples/client/petstore/kotlin/docs/paths/fakeredirection/get/responses/FakeredirectionGetCode3XXResponse.md deleted file mode 100644 index 25858ebb406..00000000000 --- a/samples/client/petstore/kotlin/docs/paths/fakeredirection/get/responses/FakeredirectionGetCode3XXResponse.md +++ /dev/null @@ -1,32 +0,0 @@ -# FakeredirectionGetCode3XXResponse - -public class FakeredirectionGetCode3XXResponse - -A class that contains necessary nested response classes -- a class that extends ResponseDeserializer and is used to deserialize responses - -## Nested Class Summary -| Modifier and Type | Class and Description | -| ----------------- | --------------------- | -| static class | [FakeredirectionGetCode3XXResponse.FakeredirectionGetCode3XXResponse1](#fakeredirectiongetcode3xxresponse1)
class that deserializes responses | - -## FakeredirectionGetCode3XXResponse1 -public static class FakeredirectionGetCode3XXResponse1
-extends ResponseDeserializer - -a class that deserializes responses - -### Constructor Summary -| Constructor and Description | -| --------------------------- | -| FakeredirectionGetCode3XXResponse1()
Creates an instance | - -### Field Summary -| Modifier and Type | Field and Description | -| ----------------- | --------------------- | -| Map | content = MapUtils.makeMap(
)
the contentType to schema info | - -### Method Summary -| Modifier and Type | Method and Description | -| ----------------- | ---------------------- | -| ApiResponse | deserialize(HttpResponse response, SchemaConfiguration configuration)
called by endpoint when deserialize responses | diff --git a/samples/client/petstore/kotlin/docs/paths/fakerefobjinquery/FakerefobjinqueryGet.md b/samples/client/petstore/kotlin/docs/paths/fakerefobjinquery/FakerefobjinqueryGet.md deleted file mode 100644 index ee25be0a844..00000000000 --- a/samples/client/petstore/kotlin/docs/paths/fakerefobjinquery/FakerefobjinqueryGet.md +++ /dev/null @@ -1,145 +0,0 @@ -# FakerefobjinqueryGet - -public class FakerefobjinqueryGet - -A class that contains necessary endpoint classes -- a class that calls the endpoint method using the http verb -- a class that calls the endpoint method using the operationId name -- class(es) to store the request inputs -- builder(s) to set the request input data - -## Nested Class Summary -| Modifier and Type | Class and Description | -| ----------------- | --------------------- | -| static class | [Get](#get)
The class that has a get method to call the endpoint | -| interface | [RefObjectInQueryOperation](#refobjectinqueryoperation)
The interface that has a refObjectInQuery method to call the endpoint | -| static class | [GetRequest](#getrequest)
The request inputs class | -| static class | [GetRequestBuilder](#getrequestbuilder)
A builder for the request input class | - -## Get -public static class Get extends ApiClient.ApiClient1 implements GetOperation
- -a class that allows one to call the endpoint using a method named get - -### 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.fakerefobjinquery.get.FakerefobjinqueryGetQueryParameters; -import org.openapijsonschematools.client.RootServerInfo; -import org.openapijsonschematools.client.servers.RootServer0; -import org.openapijsonschematools.client.servers.RootServer1; -import org.openapijsonschematools.client.servers.RootServer2; -import org.openapijsonschematools.client.paths.fakerefobjinquery.get.responses.FakerefobjinqueryGetCode200Response; -import org.openapijsonschematools.client.servers.RootServerInfo; -import org.openapijsonschematools.client.paths.fakerefobjinquery.FakerefobjinqueryGet; -import org.openapijsonschematools.client.paths.fakerefobjinquery.get.FakerefobjinqueryGetResponses; - -import java.io.IOException; -import java.util.Arrays; -import java.util.List; -import java.util.Map; -import java.util.AbstractMap; - -// if you want to use a server that is not SERVER_0 pass it in here and change the ServerIndex input below -ApiConfiguration.ServerInfo serverInfo = new ApiConfiguration.ServerInfoBuilder() - .rootServerInfo( - new RootServerInfo.RootServerInfoBuilder() - .rootServer0(new RootServer0()) - .build() - ) - .build(); -ApiConfiguration.ServerIndexInfo serverIndexInfo = new ApiConfiguration.ServerIndexInfoBuilder() - .rootServerInfoServerIndex(RootServerInfo.ServerIndex.SERVER_0) - .build(); -Duration timeout = Duration.ofSeconds(1L); -Map> defaultHeaders = Map.of("User-Agent", List.of("OpenAPI-JSON-Schema-Generator/1.0.0/java")); -ApiConfiguration apiConfiguration = new ApiConfiguration( - serverInfo - serverIndexInfo, - timeout, - defaultHeaders -); -SchemaConfiguration schemaConfiguration = new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().build()); -FakerefobjinqueryGet.Get apiClient = new FakerefobjinqueryGet.Get(apiConfiguration, schemaConfiguration); - - -var request = new FakerefobjinqueryGet.GetRequestBuilder().build(); - -FakerefobjinqueryGetResponses.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; -} -FakerefobjinqueryGetResponses.EndpointFakerefobjinqueryGetCode200Response castResponse = (FakerefobjinqueryGetResponses.EndpointFakerefobjinqueryGetCode200Response) response; -``` -### Constructor Summary -| Constructor and Description | -| --------------------------- | -| Get(ApiConfiguration apiConfiguration, SchemaConfiguration schemaConfiguration)
Creates an instance | - -### Method Summary -| Modifier and Type | Method and Description | -| ----------------- | ---------------------- | -| [FakerefobjinqueryGetResponses.EndpointResponse](../../paths/fakerefobjinquery/get/FakerefobjinqueryGetResponses.md#endpointresponse) | get([GetRequest](#getrequest) request) | - -## RefObjectInQueryOperation -public interface RefObjectInQueryOperation
- -an interface that allows one to call the endpoint using a method named refObjectInQuery by the operationId - -### Method Summary -| Modifier and Type | Method and Description | -| ----------------- | ---------------------- | -| [FakerefobjinqueryGetResponses.EndpointResponse](../../paths/fakerefobjinquery/get/FakerefobjinqueryGetResponses.md#endpointresponse) | refObjectInQuery([GetRequest](#getrequest) request) | - -## GetRequest -public static class GetRequest
- -a class that stores the final request inputs - -### Field Summary -| Modifier and Type | Field and Description | -| ----------------- | --------------------- | -| [FakerefobjinqueryGetQueryParameters.@Nullable QueryParametersMap](../../paths/fakerefobjinquery/get/FakerefobjinqueryGetQueryParameters.md#queryparametersmap) | queryParameters
optional | -| [RootServerInfo.@Nullable ServerIndex](../../RootServerInfo.md#serverindex) | serverIndex
optional. Note: this will override the value in apiConfiguration | -| @Nullable Duration | timeout
optional. Note: this will override the value in apiConfiguration | - -## GetRequestBuilder -public static class GetRequestBuilder
- -a builder for request inputs - -### Constructor Summary -| Constructor and Description | -| --------------------------- | -| GetRequestBuilder()
Creates a builder that contains null for all parameters | - -### Method Summary -| Modifier and Type | Method and Description | -| ----------------- | ---------------------- | -| [GetRequest](#getrequest) | build()
Returns the request input used to call an endpoint method | -| [GetRequestBuilder](#getrequestbuilder) | queryParameters([FakerefobjinqueryGetQueryParametersQueryParametersMap](../../paths/fakerefobjinquery/get/FakerefobjinqueryGetQueryParameters.md#queryparametersmap) queryParameters)
sets the optional property | -| [GetRequestBuilder](#getrequestbuilder) | serverIndex([RootServerInfo.ServerIndex](../../RootServerInfo.md#serverindex) serverIndex)
sets the optional property. Note: this will override the value in apiConfiguration | -| [GetRequestBuilder](#getrequestbuilder) | timeout(Duration timeout)
sets the optional property. Note: this will override the value in apiConfiguration | - -[[Back to top]](#top) [[Back to README]](../../../README.md) diff --git a/samples/client/petstore/kotlin/docs/paths/fakerefobjinquery/get/FakerefobjinqueryGetQueryParameters.md b/samples/client/petstore/kotlin/docs/paths/fakerefobjinquery/get/FakerefobjinqueryGetQueryParameters.md deleted file mode 100644 index 7d96f638a5b..00000000000 --- a/samples/client/petstore/kotlin/docs/paths/fakerefobjinquery/get/FakerefobjinqueryGetQueryParameters.md +++ /dev/null @@ -1,258 +0,0 @@ -# FakerefobjinqueryGetQueryParameters -public class FakerefobjinqueryGetQueryParameters
- -A class that contains necessary nested -- schema classes (which validate payloads), extends JsonSchema -- sealed interfaces which store validated payloads, java version of a sum type -- boxed classes which store validated payloads, sealed permits class implementations -- classes to store validated map payloads, extends FrozenMap -- classes to build inputs for map payloads - -## Nested Class Summary -| Modifier and Type | Class and Description | -| ----------------- | ---------------------- | -| sealed interface | [FakerefobjinqueryGetQueryParameters.FakerefobjinqueryGetQueryParameters1Boxed](#fakerefobjinquerygetqueryparameters1boxed)
sealed interface for validated payloads | -| record | [FakerefobjinqueryGetQueryParameters.FakerefobjinqueryGetQueryParameters1BoxedMap](#fakerefobjinquerygetqueryparameters1boxedmap)
boxed class to store validated Map payloads | -| static class | [FakerefobjinqueryGetQueryParameters.FakerefobjinqueryGetQueryParameters1](#fakerefobjinquerygetqueryparameters1)
schema class | -| static class | [FakerefobjinqueryGetQueryParameters.QueryParametersMapBuilder](#queryparametersmapbuilder)
builder for Map payloads | -| static class | [FakerefobjinqueryGetQueryParameters.QueryParametersMap](#queryparametersmap)
output class for Map payloads | -| sealed interface | [FakerefobjinqueryGetQueryParameters.AdditionalPropertiesBoxed](#additionalpropertiesboxed)
sealed interface for validated payloads | -| record | [FakerefobjinqueryGetQueryParameters.AdditionalPropertiesBoxedVoid](#additionalpropertiesboxedvoid)
boxed class to store validated null payloads | -| record | [FakerefobjinqueryGetQueryParameters.AdditionalPropertiesBoxedBoolean](#additionalpropertiesboxedboolean)
boxed class to store validated boolean payloads | -| record | [FakerefobjinqueryGetQueryParameters.AdditionalPropertiesBoxedNumber](#additionalpropertiesboxednumber)
boxed class to store validated Number payloads | -| record | [FakerefobjinqueryGetQueryParameters.AdditionalPropertiesBoxedString](#additionalpropertiesboxedstring)
boxed class to store validated String payloads | -| record | [FakerefobjinqueryGetQueryParameters.AdditionalPropertiesBoxedList](#additionalpropertiesboxedlist)
boxed class to store validated List payloads | -| record | [FakerefobjinqueryGetQueryParameters.AdditionalPropertiesBoxedMap](#additionalpropertiesboxedmap)
boxed class to store validated Map payloads | -| static class | [FakerefobjinqueryGetQueryParameters.AdditionalProperties](#additionalproperties)
schema class | - -## FakerefobjinqueryGetQueryParameters1Boxed -public sealed interface FakerefobjinqueryGetQueryParameters1Boxed
-permits
-[FakerefobjinqueryGetQueryParameters1BoxedMap](#fakerefobjinquerygetqueryparameters1boxedmap) - -sealed interface that stores validated payloads using boxed classes - -## FakerefobjinqueryGetQueryParameters1BoxedMap -public record FakerefobjinqueryGetQueryParameters1BoxedMap
-implements [FakerefobjinqueryGetQueryParameters1Boxed](#fakerefobjinquerygetqueryparameters1boxed) - -record that stores validated Map payloads, sealed permits implementation - -### Constructor Summary -| Constructor and Description | -| --------------------------- | -| FakerefobjinqueryGetQueryParameters1BoxedMap([QueryParametersMap](#queryparametersmap) data)
Creates an instance, private visibility | - -### Method Summary -| Modifier and Type | Method and Description | -| ----------------- | ---------------------- | -| [QueryParametersMap](#queryparametersmap) | data()
validated payload | -| @Nullable Object | getData()
validated payload | - -## FakerefobjinqueryGetQueryParameters1 -public static class FakerefobjinqueryGetQueryParameters1
-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.fakerefobjinquery.get.FakerefobjinqueryGetQueryParameters; - -import java.util.Arrays; -import java.util.List; -import java.util.AbstractMap; - -static final SchemaConfiguration configuration = new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().build()); - -// Map validation -FakerefobjinqueryGetQueryParameters.QueryParametersMap validatedPayload = - FakerefobjinqueryGetQueryParameters.FakerefobjinqueryGetQueryParameters1.validate( - new FakerefobjinqueryGetQueryParameters.QueryParametersMapBuilder() - .mapBean( - MapUtils.makeMap( - new AbstractMap.SimpleEntry( - "bar", - "a" - ) - ) - ) - .build(), - configuration -); -``` - -### Field Summary -| Modifier and Type | Field and Description | -| ----------------- | ---------------------- | -| Set> | type = Set.of(Map.class) | -| Map> | properties = Map.ofEntries(
    new PropertyEntry("mapBean", [Foo.Foo1.class](../../../components/schemas/Foo.md#foo1))
)
| -| Class | additionalProperties = [AdditionalProperties.class](#additionalproperties) | - -### Method Summary -| Modifier and Type | Method and Description | -| ----------------- | ---------------------- | -| [QueryParametersMap](#queryparametersmap) | validate([Map<?, ?>](#queryparametersmapbuilder) arg, SchemaConfiguration configuration) | -| [FakerefobjinqueryGetQueryParameters1BoxedMap](#fakerefobjinquerygetqueryparameters1boxedmap) | validateAndBox([Map<?, ?>](#queryparametersmapbuilder) arg, SchemaConfiguration configuration) | -| [FakerefobjinqueryGetQueryParameters1Boxed](#fakerefobjinquerygetqueryparameters1boxed) | validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) | -| @Nullable Object | validate(@Nullable Object arg, SchemaConfiguration configuration) | - -## QueryParametersMapBuilder -public class QueryParametersMapBuilder
-builder for `Map>` - -A class that builds the Map input type - -### Constructor Summary -| Constructor and Description | -| --------------------------- | -| QueryParametersMapBuilder()
Creates a builder that contains an empty map | - -### Method Summary -| Modifier and Type | Method and Description | -| ----------------- | ---------------------- | -| Map> | build()
Returns map input that should be used with Schema.validate | -| [QueryParametersMapBuilder](#queryparametersmapbuilder) | mapBean(Map value) | - -## QueryParametersMap -public static class QueryParametersMap
-extends FrozenMap - -A class to store validated Map payloads - -### Method Summary -| Modifier and Type | Method and Description | -| ----------------- | ---------------------- | -| static [QueryParametersMap](#queryparametersmap) | of([Map>](#queryparametersmapbuilder) arg, SchemaConfiguration configuration) | -| [Foo.FooMap](../../../components/schemas/Foo.md#foomap) | mapBean()
[optional] | - -## 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(Nothing? data)
Creates an instance, private visibility | - -### Method Summary -| Modifier and Type | Method and Description | -| ----------------- | ---------------------- | -| Nothing? | 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/kotlin/docs/paths/fakerefobjinquery/get/FakerefobjinqueryGetResponses.md b/samples/client/petstore/kotlin/docs/paths/fakerefobjinquery/get/FakerefobjinqueryGetResponses.md deleted file mode 100644 index 31c750e35b9..00000000000 --- a/samples/client/petstore/kotlin/docs/paths/fakerefobjinquery/get/FakerefobjinqueryGetResponses.md +++ /dev/null @@ -1,29 +0,0 @@ -# FakerefobjinqueryGetResponses - -public class FakerefobjinqueryGetResponses - -A class that contains necessary responses classes -- a sealed interface, EndpointResponse, that stores endpoint responses -- records for each endpoint response - -## Nested Class Summary -| Modifier and Type | Class and Description | -| ----------------- | --------------------- | -| sealed interface | [EndpointResponse](#endpointresponse)
stores the endpoint responses | -| record | [EndpointFakerefobjinqueryGetCode200Response](#endpointfakerefobjinquerygetcode200response)
the response for 200 | - -## EndpointResponse -public sealed interface EndpointResponse permits
-[EndpointFakerefobjinqueryGetCode200Response](#endpointfakerefobjinquerygetcode200response) - -a sealed interface that stores endpoint responses - -## EndpointFakerefobjinqueryGetCode200Response -public record EndpointFakerefobjinqueryGetCode200Response( - HttpResponse response, - Nothing? body, - Nothing? headers -) implements EndpointResponse, ApiResponse
- -a class that stores an endpoint response - diff --git a/samples/client/petstore/kotlin/docs/paths/fakerefobjinquery/get/parameters/parameter0/Schema0.md b/samples/client/petstore/kotlin/docs/paths/fakerefobjinquery/get/parameters/parameter0/Schema0.md deleted file mode 100644 index 22b82242cfb..00000000000 --- a/samples/client/petstore/kotlin/docs/paths/fakerefobjinquery/get/parameters/parameter0/Schema0.md +++ /dev/null @@ -1,19 +0,0 @@ -# Schema0 -public class Schema0
-extends [Foo1](../../../components/schemas/Foo.md#foo) - -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 - -## Nested Class Summary -| Modifier and Type | Class and Description | -| ----------------- | ---------------------- | -| static class | [Schema0.Schema01](#schema01)
schema class | - -## Schema01 -public static class Schema01
-extends [Foo.Foo1](../../../components/schemas/Foo.md#foo1) - -A schema class that validates payloads diff --git a/samples/client/petstore/kotlin/docs/paths/fakerefobjinquery/get/responses/FakerefobjinqueryGetCode200Response.md b/samples/client/petstore/kotlin/docs/paths/fakerefobjinquery/get/responses/FakerefobjinqueryGetCode200Response.md deleted file mode 100644 index 01ca962f7f5..00000000000 --- a/samples/client/petstore/kotlin/docs/paths/fakerefobjinquery/get/responses/FakerefobjinqueryGetCode200Response.md +++ /dev/null @@ -1,17 +0,0 @@ -# FakerefobjinqueryGetCode200Response - -public class FakerefobjinqueryGetCode200Response extends [SuccessDescriptionOnly](../../components/responses/SuccessDescriptionOnly.md) - -A class (extended from the $ref class) that contains necessary nested response classes -- a class that extends ResponseDeserializer and is used to deserialize responses - -## Nested Class Summary -| Modifier and Type | Class and Description | -| ----------------- | --------------------- | -| static class | [FakerefobjinqueryGetCode200Response.FakerefobjinqueryGetCode200Response1](#fakerefobjinquerygetcode200response1)
class that deserializes responses | - -## FakerefobjinqueryGetCode200Response1 -public static class FakerefobjinqueryGetCode200Response1 extends [SuccessDescriptionOnly1](../../components/responses/SuccessDescriptionOnly.md#successdescriptiononly1)
- -a class that deserializes responses, extended from the $ref class - diff --git a/samples/client/petstore/kotlin/docs/paths/fakerefsarraymodel/FakerefsarraymodelPost.md b/samples/client/petstore/kotlin/docs/paths/fakerefsarraymodel/FakerefsarraymodelPost.md deleted file mode 100644 index f6ec0996f3a..00000000000 --- a/samples/client/petstore/kotlin/docs/paths/fakerefsarraymodel/FakerefsarraymodelPost.md +++ /dev/null @@ -1,148 +0,0 @@ -# FakerefsarraymodelPost - -public class FakerefsarraymodelPost - -A class that contains necessary endpoint classes -- a class that calls the endpoint method using the http verb -- a class that calls the endpoint method using the operationId name -- class(es) to store the request inputs -- builder(s) to set the request input data - -## Nested Class Summary -| Modifier and Type | Class and Description | -| ----------------- | --------------------- | -| static class | [Post](#post)
The class that has a post method to call the endpoint | -| interface | [ArrayModelOperation](#arraymodeloperation)
The interface that has a arrayModel method to call the endpoint | -| static class | [PostRequest](#postrequest)
The request inputs class | -| static class | [PostRequestBuilder](#postrequestbuilder)
A builder for the request input class | - -## Post -public static class Post 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.fakerefsarraymodel.post.FakerefsarraymodelPostRequestBody; -import org.openapijsonschematools.client.components.schemas.AnimalFarm; -import org.openapijsonschematools.client.RootServerInfo; -import org.openapijsonschematools.client.servers.RootServer0; -import org.openapijsonschematools.client.servers.RootServer1; -import org.openapijsonschematools.client.servers.RootServer2; -import org.openapijsonschematools.client.paths.fakerefsarraymodel.post.responses.FakerefsarraymodelPostCode200Response; -import org.openapijsonschematools.client.servers.RootServerInfo; -import org.openapijsonschematools.client.paths.fakerefsarraymodel.FakerefsarraymodelPost; -import org.openapijsonschematools.client.paths.fakerefsarraymodel.post.FakerefsarraymodelPostResponses; - -import java.io.IOException; -import java.util.Arrays; -import java.util.List; -import java.util.Map; -import java.util.AbstractMap; - -// if you want to use a server that is not SERVER_0 pass it in here and change the ServerIndex input below -ApiConfiguration.ServerInfo serverInfo = new ApiConfiguration.ServerInfoBuilder() - .rootServerInfo( - new RootServerInfo.RootServerInfoBuilder() - .rootServer0(new RootServer0()) - .build() - ) - .build(); -ApiConfiguration.ServerIndexInfo serverIndexInfo = new ApiConfiguration.ServerIndexInfoBuilder() - .rootServerInfoServerIndex(RootServerInfo.ServerIndex.SERVER_0) - .build(); -Duration timeout = Duration.ofSeconds(1L); -Map> defaultHeaders = Map.of("User-Agent", List.of("OpenAPI-JSON-Schema-Generator/1.0.0/java")); -ApiConfiguration apiConfiguration = new ApiConfiguration( - serverInfo - serverIndexInfo, - timeout, - defaultHeaders -); -SchemaConfiguration schemaConfiguration = new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().build()); -FakerefsarraymodelPost.Post apiClient = new FakerefsarraymodelPost.Post(apiConfiguration, schemaConfiguration); - - -var request = new FakerefsarraymodelPost.PostRequestBuilder().build(); - -FakerefsarraymodelPostResponses.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; -} -FakerefsarraymodelPostResponses.EndpointFakerefsarraymodelPostCode200Response castResponse = (FakerefsarraymodelPostResponses.EndpointFakerefsarraymodelPostCode200Response) response; -FakerefsarraymodelPostCode200Response.ApplicationjsonResponseBody deserializedBody = (FakerefsarraymodelPostCode200Response.ApplicationjsonResponseBody) castResponse.body; -// handle deserialized body here -``` -### Constructor Summary -| Constructor and Description | -| --------------------------- | -| Post(ApiConfiguration apiConfiguration, SchemaConfiguration schemaConfiguration)
Creates an instance | - -### Method Summary -| Modifier and Type | Method and Description | -| ----------------- | ---------------------- | -| [FakerefsarraymodelPostResponses.EndpointResponse](../../paths/fakerefsarraymodel/post/FakerefsarraymodelPostResponses.md#endpointresponse) | post([PostRequest](#postrequest) request) | - -## ArrayModelOperation -public interface ArrayModelOperation
- -an interface that allows one to call the endpoint using a method named arrayModel by the operationId - -### Method Summary -| Modifier and Type | Method and Description | -| ----------------- | ---------------------- | -| [FakerefsarraymodelPostResponses.EndpointResponse](../../paths/fakerefsarraymodel/post/FakerefsarraymodelPostResponses.md#endpointresponse) | arrayModel([PostRequest](#postrequest) request) | - -## PostRequest -public static class PostRequest
- -a class that stores the final request inputs - -### Field Summary -| Modifier and Type | Field and Description | -| ----------------- | --------------------- | -| [FakerefsarraymodelPostRequestBody.@Nullable SealedRequestBody](../../paths/fakerefsarraymodel/post/FakerefsarraymodelPostRequestBody.md#sealedrequestbody) | requestBody
optional | -| [RootServerInfo.@Nullable ServerIndex](../../RootServerInfo.md#serverindex) | serverIndex
optional. Note: this will override the value in apiConfiguration | -| @Nullable Duration | timeout
optional. Note: this will override the value in apiConfiguration | - -## PostRequestBuilder -public static class PostRequestBuilder
- -a builder for request inputs - -### Constructor Summary -| Constructor and Description | -| --------------------------- | -| PostRequestBuilder()
Creates a builder that contains null for all parameters | - -### Method Summary -| Modifier and Type | Method and Description | -| ----------------- | ---------------------- | -| [PostRequest](#postrequest) | build()
Returns the request input used to call an endpoint method | -| [PostRequestBuilder](#postrequestbuilder) | requestBody([FakerefsarraymodelPostRequestBody.SealedRequestBody](../../paths/fakerefsarraymodel/post/FakerefsarraymodelPostRequestBody.md#sealedrequestbody) requestBody)
sets the optional property | -| [PostRequestBuilder](#postrequestbuilder) | serverIndex([RootServerInfo.ServerIndex](../../RootServerInfo.md#serverindex) serverIndex)
sets the optional property. Note: this will override the value in apiConfiguration | -| [PostRequestBuilder](#postrequestbuilder) | timeout(Duration timeout)
sets the optional property. Note: this will override the value in apiConfiguration | - -[[Back to top]](#top) [[Back to README]](../../../README.md) diff --git a/samples/client/petstore/kotlin/docs/paths/fakerefsarraymodel/post/FakerefsarraymodelPostRequestBody.md b/samples/client/petstore/kotlin/docs/paths/fakerefsarraymodel/post/FakerefsarraymodelPostRequestBody.md deleted file mode 100644 index ad39f5baa4a..00000000000 --- a/samples/client/petstore/kotlin/docs/paths/fakerefsarraymodel/post/FakerefsarraymodelPostRequestBody.md +++ /dev/null @@ -1,90 +0,0 @@ -# FakerefsarraymodelPostRequestBody - -public class FakerefsarraymodelPostRequestBody - -A class that contains necessary nested request body classes -- SealedMediaType, a sealed interface which contains all the schema/encoding info for each contentType -- records which implement SealedMediaType, the concrete media types -- a class that extends RequestBodySerializer and is used to serialize input SealedRequestBody instances -- SealedRequestBody, a sealed interface which contains all the contentType/schema input types -- records which implement SealedRequestBody, the concrete request body types - -## Nested Class Summary -| Modifier and Type | Class and Description | -| ----------------- | --------------------- | -| sealed interface | [FakerefsarraymodelPostRequestBody.SealedMediaType](#sealedmediatype)
media type sealed interface | -| record | [FakerefsarraymodelPostRequestBody.ApplicationjsonMediaType](#applicationjsonmediatype)
record storing schema + encoding for a specific contentType | -| static class | [FakerefsarraymodelPostRequestBody.FakerefsarraymodelPostRequestBody1](#fakerefsarraymodelpostrequestbody1)
class that serializes request bodies | -| sealed interface | [FakerefsarraymodelPostRequestBody.SealedRequestBody](#sealedrequestbody)
request body sealed interface | -| record | [FakerefsarraymodelPostRequestBody.ApplicationjsonRequestBody](#applicationjsonrequestbody)
implements sealed interface to store request body input | - -## SealedMediaType -public sealed interface SealedMediaType
-permits
-[ApplicationjsonMediaType](#applicationjsonmediatype) - -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), Nothing?> - -class storing schema info for a specific contentType - -### Constructor Summary -| Constructor and Description | -| --------------------------- | -| ApplicationjsonMediaType()
Creates an instance | - -### 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 | -| Nothing? | encoding()
the encoding info | - -## FakerefsarraymodelPostRequestBody1 -public static class FakerefsarraymodelPostRequestBody1
- -a class that serializes SealedRequestBody request bodies - -### Constructor Summary -| Constructor and Description | -| --------------------------- | -| FakerefsarraymodelPostRequestBody1()
Creates an instance | - -### Field Summary -| Modifier and Type | Field and Description | -| ----------------- | --------------------- | -| boolean | required = false
whether the request body is required | -| 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 | -| ----------------- | ---------------------- | -| SerializedRequestBody | serialize([SealedRequestBody](#sealedrequestbody) requestBody)
called by endpoint when creating request body bytes | - -## SealedRequestBody -public sealed interface SealedRequestBody
-permits
-[ApplicationjsonRequestBody](#applicationjsonrequestbody) - -sealed interface that stores request contentType + validated schema data - -## ApplicationjsonRequestBody -public record ApplicationjsonRequestBody
-implements [SealedRequestBody](#sealedrequestbody),
-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 | - -### 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 | diff --git a/samples/client/petstore/kotlin/docs/paths/fakerefsarraymodel/post/FakerefsarraymodelPostResponses.md b/samples/client/petstore/kotlin/docs/paths/fakerefsarraymodel/post/FakerefsarraymodelPostResponses.md deleted file mode 100644 index df6d66583f8..00000000000 --- a/samples/client/petstore/kotlin/docs/paths/fakerefsarraymodel/post/FakerefsarraymodelPostResponses.md +++ /dev/null @@ -1,29 +0,0 @@ -# FakerefsarraymodelPostResponses - -public class FakerefsarraymodelPostResponses - -A class that contains necessary responses classes -- a sealed interface, EndpointResponse, that stores endpoint responses -- records for each endpoint response - -## Nested Class Summary -| Modifier and Type | Class and Description | -| ----------------- | --------------------- | -| sealed interface | [EndpointResponse](#endpointresponse)
stores the endpoint responses | -| record | [EndpointFakerefsarraymodelPostCode200Response](#endpointfakerefsarraymodelpostcode200response)
the response for 200 | - -## EndpointResponse -public sealed interface EndpointResponse permits
-[EndpointFakerefsarraymodelPostCode200Response](#endpointfakerefsarraymodelpostcode200response) - -a sealed interface that stores endpoint responses - -## EndpointFakerefsarraymodelPostCode200Response -public record EndpointFakerefsarraymodelPostCode200Response( - HttpResponse response, - [FakerefsarraymodelPostCode200Response.SealedResponseBody](../../../paths/fakerefsarraymodel/post/responses/FakerefsarraymodelPostCode200Response.md#sealedresponsebody) body, - Nothing? headers -) implements EndpointResponse, ApiResponse
- -a class that stores an endpoint response - diff --git a/samples/client/petstore/kotlin/docs/paths/fakerefsarraymodel/post/requestbody/content/applicationjson/ApplicationjsonSchema.md b/samples/client/petstore/kotlin/docs/paths/fakerefsarraymodel/post/requestbody/content/applicationjson/ApplicationjsonSchema.md deleted file mode 100644 index 1418728fbd4..00000000000 --- a/samples/client/petstore/kotlin/docs/paths/fakerefsarraymodel/post/requestbody/content/applicationjson/ApplicationjsonSchema.md +++ /dev/null @@ -1,19 +0,0 @@ -# ApplicationjsonSchema -public class ApplicationjsonSchema
-extends [AnimalFarm1](../../../../../../components/schemas/AnimalFarm.md#animalfarm) - -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 - -## Nested Class Summary -| Modifier and Type | Class and Description | -| ----------------- | ---------------------- | -| static class | [ApplicationjsonSchema.ApplicationjsonSchema1](#applicationjsonschema1)
schema class | - -## ApplicationjsonSchema1 -public static class ApplicationjsonSchema1
-extends [AnimalFarm.AnimalFarm1](../../../../../../components/schemas/AnimalFarm.md#animalfarm1) - -A schema class that validates payloads diff --git a/samples/client/petstore/kotlin/docs/paths/fakerefsarraymodel/post/responses/FakerefsarraymodelPostCode200Response.md b/samples/client/petstore/kotlin/docs/paths/fakerefsarraymodel/post/responses/FakerefsarraymodelPostCode200Response.md deleted file mode 100644 index d59ace399a1..00000000000 --- a/samples/client/petstore/kotlin/docs/paths/fakerefsarraymodel/post/responses/FakerefsarraymodelPostCode200Response.md +++ /dev/null @@ -1,87 +0,0 @@ -# FakerefsarraymodelPostCode200Response - -public class FakerefsarraymodelPostCode200Response - -A class that contains necessary nested response classes -- SealedMediaType, a sealed interface which contains all the schema/encoding info for each contentType -- records which implement SealedMediaType, the concrete media types -- SealedResponseBody, a sealed interface which contains all the contentType/schema types -- records which implement SealedResponseBody, the concrete response body types -- a class that extends ResponseDeserializer and is used to deserialize responses - -## Nested Class Summary -| Modifier and Type | Class and Description | -| ----------------- | --------------------- | -| sealed interface | [FakerefsarraymodelPostCode200Response.SealedMediaType](#sealedmediatype)
media type sealed interface | -| record | [FakerefsarraymodelPostCode200Response.ApplicationjsonMediaType](#applicationjsonmediatype)
record storing schema + encoding for a specific contentType | -| sealed interface | [FakerefsarraymodelPostCode200Response.SealedResponseBody](#sealedresponsebody)
response body sealed interface | -| record | [FakerefsarraymodelPostCode200Response.ApplicationjsonResponseBody](#applicationjsonresponsebody)
implements sealed interface to store response body | -| static class | [FakerefsarraymodelPostCode200Response.FakerefsarraymodelPostCode200Response1](#fakerefsarraymodelpostcode200response1)
class that deserializes responses | - -## SealedMediaType -public sealed interface SealedMediaType
-permits
-[ApplicationjsonMediaType](#applicationjsonmediatype) - -sealed interface that stores schema and encoding info - -## ApplicationjsonMediaType -public record ApplicationjsonMediaType
-implements [SealedMediaType](#sealedmediatype), MediaType<[ApplicationjsonSchema.ApplicationjsonSchema1](../../../../paths/fakerefsarraymodel/post/responses/code200response/content/applicationjson/ApplicationjsonSchema.md#applicationjsonschema1), Nothing?> - -class storing schema info for a specific contentType - -### Constructor Summary -| Constructor and Description | -| --------------------------- | -| ApplicationjsonMediaType()
Creates an instance | - -### Method Summary -| Modifier and Type | Method and Description | -| ----------------- | ---------------------- | -| [ApplicationjsonSchema.ApplicationjsonSchema1](../../../../paths/fakerefsarraymodel/post/responses/code200response/content/applicationjson/ApplicationjsonSchema.md#applicationjsonschema1) | schema()
the schema for this MediaType | -| Nothing? | encoding()
the encoding info | - -## SealedResponseBody -public sealed interface SealedResponseBody
-permits
-[ApplicationjsonResponseBody](#applicationjsonresponsebody) - -sealed interface that stores response body - -## ApplicationjsonResponseBody -public record ApplicationjsonResponseBody
-implements [SealedResponseBody](#sealedresponsebody) - -A record class to store response body for contentType="application/json" - -### Constructor Summary -| Constructor and Description | -| --------------------------- | -| ApplicationjsonResponseBody(ApplicationjsonSchema.[AnimalFarm1Boxed](../../../../components/schemas/AnimalFarm.md#animalfarm1boxed) body)
Creates an instance | - -### Method Summary -| Modifier and Type | Method and Description | -| ----------------- | ---------------------- | -| ApplicationjsonSchema.[AnimalFarm1Boxed](../../../../components/schemas/AnimalFarm.md#animalfarm1boxed) | body()
returns the body passed in in the constructor | - -## FakerefsarraymodelPostCode200Response1 -public static class FakerefsarraymodelPostCode200Response1
-extends ResponseDeserializer<[SealedResponseBody](#sealedresponsebody), Nothing?, [SealedMediaType](#sealedmediatype)> - -a class that deserializes responses - -### Constructor Summary -| Constructor and Description | -| --------------------------- | -| FakerefsarraymodelPostCode200Response1()
Creates an instance | - -### Field Summary -| Modifier and Type | Field and Description | -| ----------------- | --------------------- | -| 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 | -| ----------------- | ---------------------- | -| ApiResponse<[SealedResponseBody](#sealedresponsebody), Nothing?> | deserialize(HttpResponse response, SchemaConfiguration configuration)
called by endpoint when deserialize responses | diff --git a/samples/client/petstore/kotlin/docs/paths/fakerefsarraymodel/post/responses/code200response/content/applicationjson/ApplicationjsonSchema.md b/samples/client/petstore/kotlin/docs/paths/fakerefsarraymodel/post/responses/code200response/content/applicationjson/ApplicationjsonSchema.md deleted file mode 100644 index f4786efc35d..00000000000 --- a/samples/client/petstore/kotlin/docs/paths/fakerefsarraymodel/post/responses/code200response/content/applicationjson/ApplicationjsonSchema.md +++ /dev/null @@ -1,19 +0,0 @@ -# ApplicationjsonSchema -public class ApplicationjsonSchema
-extends [AnimalFarm1](../../../../../../../components/schemas/AnimalFarm.md#animalfarm) - -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 - -## Nested Class Summary -| Modifier and Type | Class and Description | -| ----------------- | ---------------------- | -| static class | [ApplicationjsonSchema.ApplicationjsonSchema1](#applicationjsonschema1)
schema class | - -## ApplicationjsonSchema1 -public static class ApplicationjsonSchema1
-extends [AnimalFarm.AnimalFarm1](../../../../../../../components/schemas/AnimalFarm.md#animalfarm1) - -A schema class that validates payloads diff --git a/samples/client/petstore/kotlin/docs/paths/fakerefsarrayofenums/FakerefsarrayofenumsPost.md b/samples/client/petstore/kotlin/docs/paths/fakerefsarrayofenums/FakerefsarrayofenumsPost.md deleted file mode 100644 index bad74ab9f4c..00000000000 --- a/samples/client/petstore/kotlin/docs/paths/fakerefsarrayofenums/FakerefsarrayofenumsPost.md +++ /dev/null @@ -1,148 +0,0 @@ -# FakerefsarrayofenumsPost - -public class FakerefsarrayofenumsPost - -A class that contains necessary endpoint classes -- a class that calls the endpoint method using the http verb -- a class that calls the endpoint method using the operationId name -- class(es) to store the request inputs -- builder(s) to set the request input data - -## Nested Class Summary -| Modifier and Type | Class and Description | -| ----------------- | --------------------- | -| static class | [Post](#post)
The class that has a post method to call the endpoint | -| interface | [ArrayOfEnumsOperation](#arrayofenumsoperation)
The interface that has a arrayOfEnums method to call the endpoint | -| static class | [PostRequest](#postrequest)
The request inputs class | -| static class | [PostRequestBuilder](#postrequestbuilder)
A builder for the request input class | - -## Post -public static class Post 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.FakerefsarrayofenumsPostRequestBody; -import org.openapijsonschematools.client.components.schemas.ArrayOfEnums; -import org.openapijsonschematools.client.RootServerInfo; -import org.openapijsonschematools.client.servers.RootServer0; -import org.openapijsonschematools.client.servers.RootServer1; -import org.openapijsonschematools.client.servers.RootServer2; -import org.openapijsonschematools.client.paths.fakerefsarrayofenums.post.responses.FakerefsarrayofenumsPostCode200Response; -import org.openapijsonschematools.client.servers.RootServerInfo; -import org.openapijsonschematools.client.paths.fakerefsarrayofenums.FakerefsarrayofenumsPost; -import org.openapijsonschematools.client.paths.fakerefsarrayofenums.post.FakerefsarrayofenumsPostResponses; - -import java.io.IOException; -import java.util.Arrays; -import java.util.List; -import java.util.Map; -import java.util.AbstractMap; - -// if you want to use a server that is not SERVER_0 pass it in here and change the ServerIndex input below -ApiConfiguration.ServerInfo serverInfo = new ApiConfiguration.ServerInfoBuilder() - .rootServerInfo( - new RootServerInfo.RootServerInfoBuilder() - .rootServer0(new RootServer0()) - .build() - ) - .build(); -ApiConfiguration.ServerIndexInfo serverIndexInfo = new ApiConfiguration.ServerIndexInfoBuilder() - .rootServerInfoServerIndex(RootServerInfo.ServerIndex.SERVER_0) - .build(); -Duration timeout = Duration.ofSeconds(1L); -Map> defaultHeaders = Map.of("User-Agent", List.of("OpenAPI-JSON-Schema-Generator/1.0.0/java")); -ApiConfiguration apiConfiguration = new ApiConfiguration( - serverInfo - serverIndexInfo, - timeout, - defaultHeaders -); -SchemaConfiguration schemaConfiguration = new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().build()); -FakerefsarrayofenumsPost.Post apiClient = new FakerefsarrayofenumsPost.Post(apiConfiguration, schemaConfiguration); - - -var request = new FakerefsarrayofenumsPost.PostRequestBuilder().build(); - -FakerefsarrayofenumsPostResponses.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; -} -FakerefsarrayofenumsPostResponses.EndpointFakerefsarrayofenumsPostCode200Response castResponse = (FakerefsarrayofenumsPostResponses.EndpointFakerefsarrayofenumsPostCode200Response) response; -FakerefsarrayofenumsPostCode200Response.ApplicationjsonResponseBody deserializedBody = (FakerefsarrayofenumsPostCode200Response.ApplicationjsonResponseBody) castResponse.body; -// handle deserialized body here -``` -### Constructor Summary -| Constructor and Description | -| --------------------------- | -| Post(ApiConfiguration apiConfiguration, SchemaConfiguration schemaConfiguration)
Creates an instance | - -### Method Summary -| Modifier and Type | Method and Description | -| ----------------- | ---------------------- | -| [FakerefsarrayofenumsPostResponses.EndpointResponse](../../paths/fakerefsarrayofenums/post/FakerefsarrayofenumsPostResponses.md#endpointresponse) | post([PostRequest](#postrequest) request) | - -## ArrayOfEnumsOperation -public interface ArrayOfEnumsOperation
- -an interface that allows one to call the endpoint using a method named arrayOfEnums by the operationId - -### Method Summary -| Modifier and Type | Method and Description | -| ----------------- | ---------------------- | -| [FakerefsarrayofenumsPostResponses.EndpointResponse](../../paths/fakerefsarrayofenums/post/FakerefsarrayofenumsPostResponses.md#endpointresponse) | arrayOfEnums([PostRequest](#postrequest) request) | - -## PostRequest -public static class PostRequest
- -a class that stores the final request inputs - -### Field Summary -| Modifier and Type | Field and Description | -| ----------------- | --------------------- | -| [FakerefsarrayofenumsPostRequestBody.@Nullable SealedRequestBody](../../paths/fakerefsarrayofenums/post/FakerefsarrayofenumsPostRequestBody.md#sealedrequestbody) | requestBody
optional | -| [RootServerInfo.@Nullable ServerIndex](../../RootServerInfo.md#serverindex) | serverIndex
optional. Note: this will override the value in apiConfiguration | -| @Nullable Duration | timeout
optional. Note: this will override the value in apiConfiguration | - -## PostRequestBuilder -public static class PostRequestBuilder
- -a builder for request inputs - -### Constructor Summary -| Constructor and Description | -| --------------------------- | -| PostRequestBuilder()
Creates a builder that contains null for all parameters | - -### Method Summary -| Modifier and Type | Method and Description | -| ----------------- | ---------------------- | -| [PostRequest](#postrequest) | build()
Returns the request input used to call an endpoint method | -| [PostRequestBuilder](#postrequestbuilder) | requestBody([FakerefsarrayofenumsPostRequestBody.SealedRequestBody](../../paths/fakerefsarrayofenums/post/FakerefsarrayofenumsPostRequestBody.md#sealedrequestbody) requestBody)
sets the optional property | -| [PostRequestBuilder](#postrequestbuilder) | serverIndex([RootServerInfo.ServerIndex](../../RootServerInfo.md#serverindex) serverIndex)
sets the optional property. Note: this will override the value in apiConfiguration | -| [PostRequestBuilder](#postrequestbuilder) | timeout(Duration timeout)
sets the optional property. Note: this will override the value in apiConfiguration | - -[[Back to top]](#top) [[Back to README]](../../../README.md) diff --git a/samples/client/petstore/kotlin/docs/paths/fakerefsarrayofenums/post/FakerefsarrayofenumsPostRequestBody.md b/samples/client/petstore/kotlin/docs/paths/fakerefsarrayofenums/post/FakerefsarrayofenumsPostRequestBody.md deleted file mode 100644 index 7c08fd60fea..00000000000 --- a/samples/client/petstore/kotlin/docs/paths/fakerefsarrayofenums/post/FakerefsarrayofenumsPostRequestBody.md +++ /dev/null @@ -1,90 +0,0 @@ -# FakerefsarrayofenumsPostRequestBody - -public class FakerefsarrayofenumsPostRequestBody - -A class that contains necessary nested request body classes -- SealedMediaType, a sealed interface which contains all the schema/encoding info for each contentType -- records which implement SealedMediaType, the concrete media types -- a class that extends RequestBodySerializer and is used to serialize input SealedRequestBody instances -- SealedRequestBody, a sealed interface which contains all the contentType/schema input types -- records which implement SealedRequestBody, the concrete request body types - -## Nested Class Summary -| Modifier and Type | Class and Description | -| ----------------- | --------------------- | -| sealed interface | [FakerefsarrayofenumsPostRequestBody.SealedMediaType](#sealedmediatype)
media type sealed interface | -| record | [FakerefsarrayofenumsPostRequestBody.ApplicationjsonMediaType](#applicationjsonmediatype)
record storing schema + encoding for a specific contentType | -| static class | [FakerefsarrayofenumsPostRequestBody.FakerefsarrayofenumsPostRequestBody1](#fakerefsarrayofenumspostrequestbody1)
class that serializes request bodies | -| sealed interface | [FakerefsarrayofenumsPostRequestBody.SealedRequestBody](#sealedrequestbody)
request body sealed interface | -| record | [FakerefsarrayofenumsPostRequestBody.ApplicationjsonRequestBody](#applicationjsonrequestbody)
implements sealed interface to store request body input | - -## SealedMediaType -public sealed interface SealedMediaType
-permits
-[ApplicationjsonMediaType](#applicationjsonmediatype) - -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), Nothing?> - -class storing schema info for a specific contentType - -### Constructor Summary -| Constructor and Description | -| --------------------------- | -| ApplicationjsonMediaType()
Creates an instance | - -### 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 | -| Nothing? | encoding()
the encoding info | - -## FakerefsarrayofenumsPostRequestBody1 -public static class FakerefsarrayofenumsPostRequestBody1
- -a class that serializes SealedRequestBody request bodies - -### Constructor Summary -| Constructor and Description | -| --------------------------- | -| FakerefsarrayofenumsPostRequestBody1()
Creates an instance | - -### Field Summary -| Modifier and Type | Field and Description | -| ----------------- | --------------------- | -| boolean | required = false
whether the request body is required | -| 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 | -| ----------------- | ---------------------- | -| SerializedRequestBody | serialize([SealedRequestBody](#sealedrequestbody) requestBody)
called by endpoint when creating request body bytes | - -## SealedRequestBody -public sealed interface SealedRequestBody
-permits
-[ApplicationjsonRequestBody](#applicationjsonrequestbody) - -sealed interface that stores request contentType + validated schema data - -## ApplicationjsonRequestBody -public record ApplicationjsonRequestBody
-implements [SealedRequestBody](#sealedrequestbody),
-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 | - -### 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 | diff --git a/samples/client/petstore/kotlin/docs/paths/fakerefsarrayofenums/post/FakerefsarrayofenumsPostResponses.md b/samples/client/petstore/kotlin/docs/paths/fakerefsarrayofenums/post/FakerefsarrayofenumsPostResponses.md deleted file mode 100644 index 9e0cd26ec18..00000000000 --- a/samples/client/petstore/kotlin/docs/paths/fakerefsarrayofenums/post/FakerefsarrayofenumsPostResponses.md +++ /dev/null @@ -1,29 +0,0 @@ -# FakerefsarrayofenumsPostResponses - -public class FakerefsarrayofenumsPostResponses - -A class that contains necessary responses classes -- a sealed interface, EndpointResponse, that stores endpoint responses -- records for each endpoint response - -## Nested Class Summary -| Modifier and Type | Class and Description | -| ----------------- | --------------------- | -| sealed interface | [EndpointResponse](#endpointresponse)
stores the endpoint responses | -| record | [EndpointFakerefsarrayofenumsPostCode200Response](#endpointfakerefsarrayofenumspostcode200response)
the response for 200 | - -## EndpointResponse -public sealed interface EndpointResponse permits
-[EndpointFakerefsarrayofenumsPostCode200Response](#endpointfakerefsarrayofenumspostcode200response) - -a sealed interface that stores endpoint responses - -## EndpointFakerefsarrayofenumsPostCode200Response -public record EndpointFakerefsarrayofenumsPostCode200Response( - HttpResponse response, - [FakerefsarrayofenumsPostCode200Response.SealedResponseBody](../../../paths/fakerefsarrayofenums/post/responses/FakerefsarrayofenumsPostCode200Response.md#sealedresponsebody) body, - Nothing? headers -) implements EndpointResponse, ApiResponse
- -a class that stores an endpoint response - diff --git a/samples/client/petstore/kotlin/docs/paths/fakerefsarrayofenums/post/requestbody/content/applicationjson/ApplicationjsonSchema.md b/samples/client/petstore/kotlin/docs/paths/fakerefsarrayofenums/post/requestbody/content/applicationjson/ApplicationjsonSchema.md deleted file mode 100644 index c49c361c228..00000000000 --- a/samples/client/petstore/kotlin/docs/paths/fakerefsarrayofenums/post/requestbody/content/applicationjson/ApplicationjsonSchema.md +++ /dev/null @@ -1,19 +0,0 @@ -# ApplicationjsonSchema -public class ApplicationjsonSchema
-extends [ArrayOfEnums1](../../../../../../components/schemas/ArrayOfEnums.md#arrayofenums) - -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 - -## Nested Class Summary -| Modifier and Type | Class and Description | -| ----------------- | ---------------------- | -| static class | [ApplicationjsonSchema.ApplicationjsonSchema1](#applicationjsonschema1)
schema class | - -## ApplicationjsonSchema1 -public static class ApplicationjsonSchema1
-extends [ArrayOfEnums.ArrayOfEnums1](../../../../../../components/schemas/ArrayOfEnums.md#arrayofenums1) - -A schema class that validates payloads diff --git a/samples/client/petstore/kotlin/docs/paths/fakerefsarrayofenums/post/responses/FakerefsarrayofenumsPostCode200Response.md b/samples/client/petstore/kotlin/docs/paths/fakerefsarrayofenums/post/responses/FakerefsarrayofenumsPostCode200Response.md deleted file mode 100644 index e56c2bfa7a8..00000000000 --- a/samples/client/petstore/kotlin/docs/paths/fakerefsarrayofenums/post/responses/FakerefsarrayofenumsPostCode200Response.md +++ /dev/null @@ -1,87 +0,0 @@ -# FakerefsarrayofenumsPostCode200Response - -public class FakerefsarrayofenumsPostCode200Response - -A class that contains necessary nested response classes -- SealedMediaType, a sealed interface which contains all the schema/encoding info for each contentType -- records which implement SealedMediaType, the concrete media types -- SealedResponseBody, a sealed interface which contains all the contentType/schema types -- records which implement SealedResponseBody, the concrete response body types -- a class that extends ResponseDeserializer and is used to deserialize responses - -## Nested Class Summary -| Modifier and Type | Class and Description | -| ----------------- | --------------------- | -| sealed interface | [FakerefsarrayofenumsPostCode200Response.SealedMediaType](#sealedmediatype)
media type sealed interface | -| record | [FakerefsarrayofenumsPostCode200Response.ApplicationjsonMediaType](#applicationjsonmediatype)
record storing schema + encoding for a specific contentType | -| sealed interface | [FakerefsarrayofenumsPostCode200Response.SealedResponseBody](#sealedresponsebody)
response body sealed interface | -| record | [FakerefsarrayofenumsPostCode200Response.ApplicationjsonResponseBody](#applicationjsonresponsebody)
implements sealed interface to store response body | -| static class | [FakerefsarrayofenumsPostCode200Response.FakerefsarrayofenumsPostCode200Response1](#fakerefsarrayofenumspostcode200response1)
class that deserializes responses | - -## SealedMediaType -public sealed interface SealedMediaType
-permits
-[ApplicationjsonMediaType](#applicationjsonmediatype) - -sealed interface that stores schema and encoding info - -## ApplicationjsonMediaType -public record ApplicationjsonMediaType
-implements [SealedMediaType](#sealedmediatype), MediaType<[ApplicationjsonSchema.ApplicationjsonSchema1](../../../../paths/fakerefsarrayofenums/post/responses/code200response/content/applicationjson/ApplicationjsonSchema.md#applicationjsonschema1), Nothing?> - -class storing schema info for a specific contentType - -### Constructor Summary -| Constructor and Description | -| --------------------------- | -| ApplicationjsonMediaType()
Creates an instance | - -### Method Summary -| Modifier and Type | Method and Description | -| ----------------- | ---------------------- | -| [ApplicationjsonSchema.ApplicationjsonSchema1](../../../../paths/fakerefsarrayofenums/post/responses/code200response/content/applicationjson/ApplicationjsonSchema.md#applicationjsonschema1) | schema()
the schema for this MediaType | -| Nothing? | encoding()
the encoding info | - -## SealedResponseBody -public sealed interface SealedResponseBody
-permits
-[ApplicationjsonResponseBody](#applicationjsonresponsebody) - -sealed interface that stores response body - -## ApplicationjsonResponseBody -public record ApplicationjsonResponseBody
-implements [SealedResponseBody](#sealedresponsebody) - -A record class to store response body for contentType="application/json" - -### Constructor Summary -| Constructor and Description | -| --------------------------- | -| ApplicationjsonResponseBody(ApplicationjsonSchema.[ArrayOfEnums1Boxed](../../../../components/schemas/ArrayOfEnums.md#arrayofenums1boxed) body)
Creates an instance | - -### Method Summary -| Modifier and Type | Method and Description | -| ----------------- | ---------------------- | -| ApplicationjsonSchema.[ArrayOfEnums1Boxed](../../../../components/schemas/ArrayOfEnums.md#arrayofenums1boxed) | body()
returns the body passed in in the constructor | - -## FakerefsarrayofenumsPostCode200Response1 -public static class FakerefsarrayofenumsPostCode200Response1
-extends ResponseDeserializer<[SealedResponseBody](#sealedresponsebody), Nothing?, [SealedMediaType](#sealedmediatype)> - -a class that deserializes responses - -### Constructor Summary -| Constructor and Description | -| --------------------------- | -| FakerefsarrayofenumsPostCode200Response1()
Creates an instance | - -### Field Summary -| Modifier and Type | Field and Description | -| ----------------- | --------------------- | -| 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 | -| ----------------- | ---------------------- | -| ApiResponse<[SealedResponseBody](#sealedresponsebody), Nothing?> | deserialize(HttpResponse response, SchemaConfiguration configuration)
called by endpoint when deserialize responses | diff --git a/samples/client/petstore/kotlin/docs/paths/fakerefsarrayofenums/post/responses/code200response/content/applicationjson/ApplicationjsonSchema.md b/samples/client/petstore/kotlin/docs/paths/fakerefsarrayofenums/post/responses/code200response/content/applicationjson/ApplicationjsonSchema.md deleted file mode 100644 index 82450aa4900..00000000000 --- a/samples/client/petstore/kotlin/docs/paths/fakerefsarrayofenums/post/responses/code200response/content/applicationjson/ApplicationjsonSchema.md +++ /dev/null @@ -1,19 +0,0 @@ -# ApplicationjsonSchema -public class ApplicationjsonSchema
-extends [ArrayOfEnums1](../../../../../../../components/schemas/ArrayOfEnums.md#arrayofenums) - -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 - -## Nested Class Summary -| Modifier and Type | Class and Description | -| ----------------- | ---------------------- | -| static class | [ApplicationjsonSchema.ApplicationjsonSchema1](#applicationjsonschema1)
schema class | - -## ApplicationjsonSchema1 -public static class ApplicationjsonSchema1
-extends [ArrayOfEnums.ArrayOfEnums1](../../../../../../../components/schemas/ArrayOfEnums.md#arrayofenums1) - -A schema class that validates payloads diff --git a/samples/client/petstore/kotlin/docs/paths/fakerefsboolean/FakerefsbooleanPost.md b/samples/client/petstore/kotlin/docs/paths/fakerefsboolean/FakerefsbooleanPost.md deleted file mode 100644 index e24e63e6ee3..00000000000 --- a/samples/client/petstore/kotlin/docs/paths/fakerefsboolean/FakerefsbooleanPost.md +++ /dev/null @@ -1,148 +0,0 @@ -# FakerefsbooleanPost - -public class FakerefsbooleanPost - -A class that contains necessary endpoint classes -- a class that calls the endpoint method using the http verb -- a class that calls the endpoint method using the operationId name -- class(es) to store the request inputs -- builder(s) to set the request input data - -## Nested Class Summary -| Modifier and Type | Class and Description | -| ----------------- | --------------------- | -| static class | [Post](#post)
The class that has a post method to call the endpoint | -| interface | [ModelBooleanOperation](#modelbooleanoperation)
The interface that has a modelBoolean method to call the endpoint | -| static class | [PostRequest](#postrequest)
The request inputs class | -| static class | [PostRequestBuilder](#postrequestbuilder)
A builder for the request input class | - -## Post -public static class Post 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.FakerefsbooleanPostRequestBody; -import org.openapijsonschematools.client.components.schemas.BooleanSchema; -import org.openapijsonschematools.client.RootServerInfo; -import org.openapijsonschematools.client.servers.RootServer0; -import org.openapijsonschematools.client.servers.RootServer1; -import org.openapijsonschematools.client.servers.RootServer2; -import org.openapijsonschematools.client.paths.fakerefsboolean.post.responses.FakerefsbooleanPostCode200Response; -import org.openapijsonschematools.client.servers.RootServerInfo; -import org.openapijsonschematools.client.paths.fakerefsboolean.FakerefsbooleanPost; -import org.openapijsonschematools.client.paths.fakerefsboolean.post.FakerefsbooleanPostResponses; - -import java.io.IOException; -import java.util.Arrays; -import java.util.List; -import java.util.Map; -import java.util.AbstractMap; - -// if you want to use a server that is not SERVER_0 pass it in here and change the ServerIndex input below -ApiConfiguration.ServerInfo serverInfo = new ApiConfiguration.ServerInfoBuilder() - .rootServerInfo( - new RootServerInfo.RootServerInfoBuilder() - .rootServer0(new RootServer0()) - .build() - ) - .build(); -ApiConfiguration.ServerIndexInfo serverIndexInfo = new ApiConfiguration.ServerIndexInfoBuilder() - .rootServerInfoServerIndex(RootServerInfo.ServerIndex.SERVER_0) - .build(); -Duration timeout = Duration.ofSeconds(1L); -Map> defaultHeaders = Map.of("User-Agent", List.of("OpenAPI-JSON-Schema-Generator/1.0.0/java")); -ApiConfiguration apiConfiguration = new ApiConfiguration( - serverInfo - serverIndexInfo, - timeout, - defaultHeaders -); -SchemaConfiguration schemaConfiguration = new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().build()); -FakerefsbooleanPost.Post apiClient = new FakerefsbooleanPost.Post(apiConfiguration, schemaConfiguration); - - -var request = new FakerefsbooleanPost.PostRequestBuilder().build(); - -FakerefsbooleanPostResponses.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; -} -FakerefsbooleanPostResponses.EndpointFakerefsbooleanPostCode200Response castResponse = (FakerefsbooleanPostResponses.EndpointFakerefsbooleanPostCode200Response) response; -FakerefsbooleanPostCode200Response.ApplicationjsonResponseBody deserializedBody = (FakerefsbooleanPostCode200Response.ApplicationjsonResponseBody) castResponse.body; -// handle deserialized body here -``` -### Constructor Summary -| Constructor and Description | -| --------------------------- | -| Post(ApiConfiguration apiConfiguration, SchemaConfiguration schemaConfiguration)
Creates an instance | - -### Method Summary -| Modifier and Type | Method and Description | -| ----------------- | ---------------------- | -| [FakerefsbooleanPostResponses.EndpointResponse](../../paths/fakerefsboolean/post/FakerefsbooleanPostResponses.md#endpointresponse) | post([PostRequest](#postrequest) request) | - -## ModelBooleanOperation -public interface ModelBooleanOperation
- -an interface that allows one to call the endpoint using a method named modelBoolean by the operationId - -### Method Summary -| Modifier and Type | Method and Description | -| ----------------- | ---------------------- | -| [FakerefsbooleanPostResponses.EndpointResponse](../../paths/fakerefsboolean/post/FakerefsbooleanPostResponses.md#endpointresponse) | modelBoolean([PostRequest](#postrequest) request) | - -## PostRequest -public static class PostRequest
- -a class that stores the final request inputs - -### Field Summary -| Modifier and Type | Field and Description | -| ----------------- | --------------------- | -| [FakerefsbooleanPostRequestBody.@Nullable SealedRequestBody](../../paths/fakerefsboolean/post/FakerefsbooleanPostRequestBody.md#sealedrequestbody) | requestBody
optional | -| [RootServerInfo.@Nullable ServerIndex](../../RootServerInfo.md#serverindex) | serverIndex
optional. Note: this will override the value in apiConfiguration | -| @Nullable Duration | timeout
optional. Note: this will override the value in apiConfiguration | - -## PostRequestBuilder -public static class PostRequestBuilder
- -a builder for request inputs - -### Constructor Summary -| Constructor and Description | -| --------------------------- | -| PostRequestBuilder()
Creates a builder that contains null for all parameters | - -### Method Summary -| Modifier and Type | Method and Description | -| ----------------- | ---------------------- | -| [PostRequest](#postrequest) | build()
Returns the request input used to call an endpoint method | -| [PostRequestBuilder](#postrequestbuilder) | requestBody([FakerefsbooleanPostRequestBody.SealedRequestBody](../../paths/fakerefsboolean/post/FakerefsbooleanPostRequestBody.md#sealedrequestbody) requestBody)
sets the optional property | -| [PostRequestBuilder](#postrequestbuilder) | serverIndex([RootServerInfo.ServerIndex](../../RootServerInfo.md#serverindex) serverIndex)
sets the optional property. Note: this will override the value in apiConfiguration | -| [PostRequestBuilder](#postrequestbuilder) | timeout(Duration timeout)
sets the optional property. Note: this will override the value in apiConfiguration | - -[[Back to top]](#top) [[Back to README]](../../../README.md) diff --git a/samples/client/petstore/kotlin/docs/paths/fakerefsboolean/post/FakerefsbooleanPostRequestBody.md b/samples/client/petstore/kotlin/docs/paths/fakerefsboolean/post/FakerefsbooleanPostRequestBody.md deleted file mode 100644 index 4ea0943cd69..00000000000 --- a/samples/client/petstore/kotlin/docs/paths/fakerefsboolean/post/FakerefsbooleanPostRequestBody.md +++ /dev/null @@ -1,90 +0,0 @@ -# FakerefsbooleanPostRequestBody - -public class FakerefsbooleanPostRequestBody - -A class that contains necessary nested request body classes -- SealedMediaType, a sealed interface which contains all the schema/encoding info for each contentType -- records which implement SealedMediaType, the concrete media types -- a class that extends RequestBodySerializer and is used to serialize input SealedRequestBody instances -- SealedRequestBody, a sealed interface which contains all the contentType/schema input types -- records which implement SealedRequestBody, the concrete request body types - -## Nested Class Summary -| Modifier and Type | Class and Description | -| ----------------- | --------------------- | -| sealed interface | [FakerefsbooleanPostRequestBody.SealedMediaType](#sealedmediatype)
media type sealed interface | -| record | [FakerefsbooleanPostRequestBody.ApplicationjsonMediaType](#applicationjsonmediatype)
record storing schema + encoding for a specific contentType | -| static class | [FakerefsbooleanPostRequestBody.FakerefsbooleanPostRequestBody1](#fakerefsbooleanpostrequestbody1)
class that serializes request bodies | -| sealed interface | [FakerefsbooleanPostRequestBody.SealedRequestBody](#sealedrequestbody)
request body sealed interface | -| record | [FakerefsbooleanPostRequestBody.ApplicationjsonRequestBody](#applicationjsonrequestbody)
implements sealed interface to store request body input | - -## SealedMediaType -public sealed interface SealedMediaType
-permits
-[ApplicationjsonMediaType](#applicationjsonmediatype) - -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), Nothing?> - -class storing schema info for a specific contentType - -### Constructor Summary -| Constructor and Description | -| --------------------------- | -| ApplicationjsonMediaType()
Creates an instance | - -### 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 | -| Nothing? | encoding()
the encoding info | - -## FakerefsbooleanPostRequestBody1 -public static class FakerefsbooleanPostRequestBody1
- -a class that serializes SealedRequestBody request bodies - -### Constructor Summary -| Constructor and Description | -| --------------------------- | -| FakerefsbooleanPostRequestBody1()
Creates an instance | - -### Field Summary -| Modifier and Type | Field and Description | -| ----------------- | --------------------- | -| boolean | required = false
whether the request body is required | -| 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 | -| ----------------- | ---------------------- | -| SerializedRequestBody | serialize([SealedRequestBody](#sealedrequestbody) requestBody)
called by endpoint when creating request body bytes | - -## SealedRequestBody -public sealed interface SealedRequestBody
-permits
-[ApplicationjsonRequestBody](#applicationjsonrequestbody) - -sealed interface that stores request contentType + validated schema data - -## ApplicationjsonRequestBody -public record ApplicationjsonRequestBody
-implements [SealedRequestBody](#sealedrequestbody),
-GenericRequestBody
- -A record class to store request body input for contentType="application/json" - -### Constructor Summary -| Constructor and Description | -| --------------------------- | -| ApplicationjsonRequestBody(ApplicationjsonSchema.BooleanJsonSchema1Boxed body)
Creates an instance | - -### Method Summary -| Modifier and Type | Method and Description | -| ----------------- | ---------------------- | -| String | contentType()
always returns "application/json" | -| ApplicationjsonSchema.BooleanJsonSchema1Boxed | body()
returns the body passed in in the constructor | diff --git a/samples/client/petstore/kotlin/docs/paths/fakerefsboolean/post/FakerefsbooleanPostResponses.md b/samples/client/petstore/kotlin/docs/paths/fakerefsboolean/post/FakerefsbooleanPostResponses.md deleted file mode 100644 index 88deacbf059..00000000000 --- a/samples/client/petstore/kotlin/docs/paths/fakerefsboolean/post/FakerefsbooleanPostResponses.md +++ /dev/null @@ -1,29 +0,0 @@ -# FakerefsbooleanPostResponses - -public class FakerefsbooleanPostResponses - -A class that contains necessary responses classes -- a sealed interface, EndpointResponse, that stores endpoint responses -- records for each endpoint response - -## Nested Class Summary -| Modifier and Type | Class and Description | -| ----------------- | --------------------- | -| sealed interface | [EndpointResponse](#endpointresponse)
stores the endpoint responses | -| record | [EndpointFakerefsbooleanPostCode200Response](#endpointfakerefsbooleanpostcode200response)
the response for 200 | - -## EndpointResponse -public sealed interface EndpointResponse permits
-[EndpointFakerefsbooleanPostCode200Response](#endpointfakerefsbooleanpostcode200response) - -a sealed interface that stores endpoint responses - -## EndpointFakerefsbooleanPostCode200Response -public record EndpointFakerefsbooleanPostCode200Response( - HttpResponse response, - [FakerefsbooleanPostCode200Response.SealedResponseBody](../../../paths/fakerefsboolean/post/responses/FakerefsbooleanPostCode200Response.md#sealedresponsebody) body, - Nothing? headers -) implements EndpointResponse, ApiResponse
- -a class that stores an endpoint response - diff --git a/samples/client/petstore/kotlin/docs/paths/fakerefsboolean/post/requestbody/content/applicationjson/ApplicationjsonSchema.md b/samples/client/petstore/kotlin/docs/paths/fakerefsboolean/post/requestbody/content/applicationjson/ApplicationjsonSchema.md deleted file mode 100644 index d0446d3d804..00000000000 --- a/samples/client/petstore/kotlin/docs/paths/fakerefsboolean/post/requestbody/content/applicationjson/ApplicationjsonSchema.md +++ /dev/null @@ -1,19 +0,0 @@ -# ApplicationjsonSchema -public class ApplicationjsonSchema
-extends [BooleanSchema1](../../../../../../components/schemas/BooleanSchema.md#booleanschema) - -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 - -## Nested Class Summary -| Modifier and Type | Class and Description | -| ----------------- | ---------------------- | -| static class | [ApplicationjsonSchema.ApplicationjsonSchema1](#applicationjsonschema1)
schema class | - -## ApplicationjsonSchema1 -public static class ApplicationjsonSchema1
-extends [BooleanSchema.BooleanSchema1](../../../../../../components/schemas/BooleanSchema.md#booleanschema1) - -A schema class that validates payloads diff --git a/samples/client/petstore/kotlin/docs/paths/fakerefsboolean/post/responses/FakerefsbooleanPostCode200Response.md b/samples/client/petstore/kotlin/docs/paths/fakerefsboolean/post/responses/FakerefsbooleanPostCode200Response.md deleted file mode 100644 index a3df212e20e..00000000000 --- a/samples/client/petstore/kotlin/docs/paths/fakerefsboolean/post/responses/FakerefsbooleanPostCode200Response.md +++ /dev/null @@ -1,87 +0,0 @@ -# FakerefsbooleanPostCode200Response - -public class FakerefsbooleanPostCode200Response - -A class that contains necessary nested response classes -- SealedMediaType, a sealed interface which contains all the schema/encoding info for each contentType -- records which implement SealedMediaType, the concrete media types -- SealedResponseBody, a sealed interface which contains all the contentType/schema types -- records which implement SealedResponseBody, the concrete response body types -- a class that extends ResponseDeserializer and is used to deserialize responses - -## Nested Class Summary -| Modifier and Type | Class and Description | -| ----------------- | --------------------- | -| sealed interface | [FakerefsbooleanPostCode200Response.SealedMediaType](#sealedmediatype)
media type sealed interface | -| record | [FakerefsbooleanPostCode200Response.ApplicationjsonMediaType](#applicationjsonmediatype)
record storing schema + encoding for a specific contentType | -| sealed interface | [FakerefsbooleanPostCode200Response.SealedResponseBody](#sealedresponsebody)
response body sealed interface | -| record | [FakerefsbooleanPostCode200Response.ApplicationjsonResponseBody](#applicationjsonresponsebody)
implements sealed interface to store response body | -| static class | [FakerefsbooleanPostCode200Response.FakerefsbooleanPostCode200Response1](#fakerefsbooleanpostcode200response1)
class that deserializes responses | - -## SealedMediaType -public sealed interface SealedMediaType
-permits
-[ApplicationjsonMediaType](#applicationjsonmediatype) - -sealed interface that stores schema and encoding info - -## ApplicationjsonMediaType -public record ApplicationjsonMediaType
-implements [SealedMediaType](#sealedmediatype), MediaType<[ApplicationjsonSchema.ApplicationjsonSchema1](../../../../paths/fakerefsboolean/post/responses/code200response/content/applicationjson/ApplicationjsonSchema.md#applicationjsonschema1), Nothing?> - -class storing schema info for a specific contentType - -### Constructor Summary -| Constructor and Description | -| --------------------------- | -| ApplicationjsonMediaType()
Creates an instance | - -### Method Summary -| Modifier and Type | Method and Description | -| ----------------- | ---------------------- | -| [ApplicationjsonSchema.ApplicationjsonSchema1](../../../../paths/fakerefsboolean/post/responses/code200response/content/applicationjson/ApplicationjsonSchema.md#applicationjsonschema1) | schema()
the schema for this MediaType | -| Nothing? | encoding()
the encoding info | - -## SealedResponseBody -public sealed interface SealedResponseBody
-permits
-[ApplicationjsonResponseBody](#applicationjsonresponsebody) - -sealed interface that stores response body - -## ApplicationjsonResponseBody -public record ApplicationjsonResponseBody
-implements [SealedResponseBody](#sealedresponsebody) - -A record class to store response body for contentType="application/json" - -### Constructor Summary -| Constructor and Description | -| --------------------------- | -| ApplicationjsonResponseBody(ApplicationjsonSchema.BooleanJsonSchema1Boxed body)
Creates an instance | - -### Method Summary -| Modifier and Type | Method and Description | -| ----------------- | ---------------------- | -| ApplicationjsonSchema.BooleanJsonSchema1Boxed | body()
returns the body passed in in the constructor | - -## FakerefsbooleanPostCode200Response1 -public static class FakerefsbooleanPostCode200Response1
-extends ResponseDeserializer<[SealedResponseBody](#sealedresponsebody), Nothing?, [SealedMediaType](#sealedmediatype)> - -a class that deserializes responses - -### Constructor Summary -| Constructor and Description | -| --------------------------- | -| FakerefsbooleanPostCode200Response1()
Creates an instance | - -### Field Summary -| Modifier and Type | Field and Description | -| ----------------- | --------------------- | -| 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 | -| ----------------- | ---------------------- | -| ApiResponse<[SealedResponseBody](#sealedresponsebody), Nothing?> | deserialize(HttpResponse response, SchemaConfiguration configuration)
called by endpoint when deserialize responses | diff --git a/samples/client/petstore/kotlin/docs/paths/fakerefsboolean/post/responses/code200response/content/applicationjson/ApplicationjsonSchema.md b/samples/client/petstore/kotlin/docs/paths/fakerefsboolean/post/responses/code200response/content/applicationjson/ApplicationjsonSchema.md deleted file mode 100644 index 1694ac4a00a..00000000000 --- a/samples/client/petstore/kotlin/docs/paths/fakerefsboolean/post/responses/code200response/content/applicationjson/ApplicationjsonSchema.md +++ /dev/null @@ -1,19 +0,0 @@ -# ApplicationjsonSchema -public class ApplicationjsonSchema
-extends [BooleanSchema1](../../../../../../../components/schemas/BooleanSchema.md#booleanschema) - -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 - -## Nested Class Summary -| Modifier and Type | Class and Description | -| ----------------- | ---------------------- | -| static class | [ApplicationjsonSchema.ApplicationjsonSchema1](#applicationjsonschema1)
schema class | - -## ApplicationjsonSchema1 -public static class ApplicationjsonSchema1
-extends [BooleanSchema.BooleanSchema1](../../../../../../../components/schemas/BooleanSchema.md#booleanschema1) - -A schema class that validates payloads diff --git a/samples/client/petstore/kotlin/docs/paths/fakerefscomposedoneofnumberwithvalidations/FakerefscomposedoneofnumberwithvalidationsPost.md b/samples/client/petstore/kotlin/docs/paths/fakerefscomposedoneofnumberwithvalidations/FakerefscomposedoneofnumberwithvalidationsPost.md deleted file mode 100644 index 731a2d4015d..00000000000 --- a/samples/client/petstore/kotlin/docs/paths/fakerefscomposedoneofnumberwithvalidations/FakerefscomposedoneofnumberwithvalidationsPost.md +++ /dev/null @@ -1,148 +0,0 @@ -# FakerefscomposedoneofnumberwithvalidationsPost - -public class FakerefscomposedoneofnumberwithvalidationsPost - -A class that contains necessary endpoint classes -- a class that calls the endpoint method using the http verb -- a class that calls the endpoint method using the operationId name -- class(es) to store the request inputs -- builder(s) to set the request input data - -## Nested Class Summary -| Modifier and Type | Class and Description | -| ----------------- | --------------------- | -| static class | [Post](#post)
The class that has a post method to call the endpoint | -| interface | [ComposedOneOfDifferentTypesOperation](#composedoneofdifferenttypesoperation)
The interface that has a composedOneOfDifferentTypes method to call the endpoint | -| static class | [PostRequest](#postrequest)
The request inputs class | -| static class | [PostRequestBuilder](#postrequestbuilder)
A builder for the request input class | - -## Post -public static class Post 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.FakerefscomposedoneofnumberwithvalidationsPostRequestBody; -import org.openapijsonschematools.client.components.schemas.ComposedOneOfDifferentTypes; -import org.openapijsonschematools.client.RootServerInfo; -import org.openapijsonschematools.client.servers.RootServer0; -import org.openapijsonschematools.client.servers.RootServer1; -import org.openapijsonschematools.client.servers.RootServer2; -import org.openapijsonschematools.client.paths.fakerefscomposedoneofnumberwithvalidations.post.responses.FakerefscomposedoneofnumberwithvalidationsPostCode200Response; -import org.openapijsonschematools.client.servers.RootServerInfo; -import org.openapijsonschematools.client.paths.fakerefscomposedoneofnumberwithvalidations.FakerefscomposedoneofnumberwithvalidationsPost; -import org.openapijsonschematools.client.paths.fakerefscomposedoneofnumberwithvalidations.post.FakerefscomposedoneofnumberwithvalidationsPostResponses; - -import java.io.IOException; -import java.util.Arrays; -import java.util.List; -import java.util.Map; -import java.util.AbstractMap; - -// if you want to use a server that is not SERVER_0 pass it in here and change the ServerIndex input below -ApiConfiguration.ServerInfo serverInfo = new ApiConfiguration.ServerInfoBuilder() - .rootServerInfo( - new RootServerInfo.RootServerInfoBuilder() - .rootServer0(new RootServer0()) - .build() - ) - .build(); -ApiConfiguration.ServerIndexInfo serverIndexInfo = new ApiConfiguration.ServerIndexInfoBuilder() - .rootServerInfoServerIndex(RootServerInfo.ServerIndex.SERVER_0) - .build(); -Duration timeout = Duration.ofSeconds(1L); -Map> defaultHeaders = Map.of("User-Agent", List.of("OpenAPI-JSON-Schema-Generator/1.0.0/java")); -ApiConfiguration apiConfiguration = new ApiConfiguration( - serverInfo - serverIndexInfo, - timeout, - defaultHeaders -); -SchemaConfiguration schemaConfiguration = new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().build()); -FakerefscomposedoneofnumberwithvalidationsPost.Post apiClient = new FakerefscomposedoneofnumberwithvalidationsPost.Post(apiConfiguration, schemaConfiguration); - - -var request = new FakerefscomposedoneofnumberwithvalidationsPost.PostRequestBuilder().build(); - -FakerefscomposedoneofnumberwithvalidationsPostResponses.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; -} -FakerefscomposedoneofnumberwithvalidationsPostResponses.EndpointFakerefscomposedoneofnumberwithvalidationsPostCode200Response castResponse = (FakerefscomposedoneofnumberwithvalidationsPostResponses.EndpointFakerefscomposedoneofnumberwithvalidationsPostCode200Response) response; -FakerefscomposedoneofnumberwithvalidationsPostCode200Response.ApplicationjsonResponseBody deserializedBody = (FakerefscomposedoneofnumberwithvalidationsPostCode200Response.ApplicationjsonResponseBody) castResponse.body; -// handle deserialized body here -``` -### Constructor Summary -| Constructor and Description | -| --------------------------- | -| Post(ApiConfiguration apiConfiguration, SchemaConfiguration schemaConfiguration)
Creates an instance | - -### Method Summary -| Modifier and Type | Method and Description | -| ----------------- | ---------------------- | -| [FakerefscomposedoneofnumberwithvalidationsPostResponses.EndpointResponse](../../paths/fakerefscomposedoneofnumberwithvalidations/post/FakerefscomposedoneofnumberwithvalidationsPostResponses.md#endpointresponse) | post([PostRequest](#postrequest) request) | - -## ComposedOneOfDifferentTypesOperation -public interface ComposedOneOfDifferentTypesOperation
- -an interface that allows one to call the endpoint using a method named composedOneOfDifferentTypes by the operationId - -### Method Summary -| Modifier and Type | Method and Description | -| ----------------- | ---------------------- | -| [FakerefscomposedoneofnumberwithvalidationsPostResponses.EndpointResponse](../../paths/fakerefscomposedoneofnumberwithvalidations/post/FakerefscomposedoneofnumberwithvalidationsPostResponses.md#endpointresponse) | composedOneOfDifferentTypes([PostRequest](#postrequest) request) | - -## PostRequest -public static class PostRequest
- -a class that stores the final request inputs - -### Field Summary -| Modifier and Type | Field and Description | -| ----------------- | --------------------- | -| [FakerefscomposedoneofnumberwithvalidationsPostRequestBody.@Nullable SealedRequestBody](../../paths/fakerefscomposedoneofnumberwithvalidations/post/FakerefscomposedoneofnumberwithvalidationsPostRequestBody.md#sealedrequestbody) | requestBody
optional | -| [RootServerInfo.@Nullable ServerIndex](../../RootServerInfo.md#serverindex) | serverIndex
optional. Note: this will override the value in apiConfiguration | -| @Nullable Duration | timeout
optional. Note: this will override the value in apiConfiguration | - -## PostRequestBuilder -public static class PostRequestBuilder
- -a builder for request inputs - -### Constructor Summary -| Constructor and Description | -| --------------------------- | -| PostRequestBuilder()
Creates a builder that contains null for all parameters | - -### Method Summary -| Modifier and Type | Method and Description | -| ----------------- | ---------------------- | -| [PostRequest](#postrequest) | build()
Returns the request input used to call an endpoint method | -| [PostRequestBuilder](#postrequestbuilder) | requestBody([FakerefscomposedoneofnumberwithvalidationsPostRequestBody.SealedRequestBody](../../paths/fakerefscomposedoneofnumberwithvalidations/post/FakerefscomposedoneofnumberwithvalidationsPostRequestBody.md#sealedrequestbody) requestBody)
sets the optional property | -| [PostRequestBuilder](#postrequestbuilder) | serverIndex([RootServerInfo.ServerIndex](../../RootServerInfo.md#serverindex) serverIndex)
sets the optional property. Note: this will override the value in apiConfiguration | -| [PostRequestBuilder](#postrequestbuilder) | timeout(Duration timeout)
sets the optional property. Note: this will override the value in apiConfiguration | - -[[Back to top]](#top) [[Back to README]](../../../README.md) diff --git a/samples/client/petstore/kotlin/docs/paths/fakerefscomposedoneofnumberwithvalidations/post/FakerefscomposedoneofnumberwithvalidationsPostRequestBody.md b/samples/client/petstore/kotlin/docs/paths/fakerefscomposedoneofnumberwithvalidations/post/FakerefscomposedoneofnumberwithvalidationsPostRequestBody.md deleted file mode 100644 index 1a19679e0c2..00000000000 --- a/samples/client/petstore/kotlin/docs/paths/fakerefscomposedoneofnumberwithvalidations/post/FakerefscomposedoneofnumberwithvalidationsPostRequestBody.md +++ /dev/null @@ -1,90 +0,0 @@ -# FakerefscomposedoneofnumberwithvalidationsPostRequestBody - -public class FakerefscomposedoneofnumberwithvalidationsPostRequestBody - -A class that contains necessary nested request body classes -- SealedMediaType, a sealed interface which contains all the schema/encoding info for each contentType -- records which implement SealedMediaType, the concrete media types -- a class that extends RequestBodySerializer and is used to serialize input SealedRequestBody instances -- SealedRequestBody, a sealed interface which contains all the contentType/schema input types -- records which implement SealedRequestBody, the concrete request body types - -## Nested Class Summary -| Modifier and Type | Class and Description | -| ----------------- | --------------------- | -| sealed interface | [FakerefscomposedoneofnumberwithvalidationsPostRequestBody.SealedMediaType](#sealedmediatype)
media type sealed interface | -| record | [FakerefscomposedoneofnumberwithvalidationsPostRequestBody.ApplicationjsonMediaType](#applicationjsonmediatype)
record storing schema + encoding for a specific contentType | -| static class | [FakerefscomposedoneofnumberwithvalidationsPostRequestBody.FakerefscomposedoneofnumberwithvalidationsPostRequestBody1](#fakerefscomposedoneofnumberwithvalidationspostrequestbody1)
class that serializes request bodies | -| sealed interface | [FakerefscomposedoneofnumberwithvalidationsPostRequestBody.SealedRequestBody](#sealedrequestbody)
request body sealed interface | -| record | [FakerefscomposedoneofnumberwithvalidationsPostRequestBody.ApplicationjsonRequestBody](#applicationjsonrequestbody)
implements sealed interface to store request body input | - -## SealedMediaType -public sealed interface SealedMediaType
-permits
-[ApplicationjsonMediaType](#applicationjsonmediatype) - -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), Nothing?> - -class storing schema info for a specific contentType - -### Constructor Summary -| Constructor and Description | -| --------------------------- | -| ApplicationjsonMediaType()
Creates an instance | - -### 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 | -| Nothing? | encoding()
the encoding info | - -## FakerefscomposedoneofnumberwithvalidationsPostRequestBody1 -public static class FakerefscomposedoneofnumberwithvalidationsPostRequestBody1
- -a class that serializes SealedRequestBody request bodies - -### Constructor Summary -| Constructor and Description | -| --------------------------- | -| FakerefscomposedoneofnumberwithvalidationsPostRequestBody1()
Creates an instance | - -### Field Summary -| Modifier and Type | Field and Description | -| ----------------- | --------------------- | -| boolean | required = false
whether the request body is required | -| 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 | -| ----------------- | ---------------------- | -| SerializedRequestBody | serialize([SealedRequestBody](#sealedrequestbody) requestBody)
called by endpoint when creating request body bytes | - -## SealedRequestBody -public sealed interface SealedRequestBody
-permits
-[ApplicationjsonRequestBody](#applicationjsonrequestbody) - -sealed interface that stores request contentType + validated schema data - -## ApplicationjsonRequestBody -public record ApplicationjsonRequestBody
-implements [SealedRequestBody](#sealedrequestbody),
-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 | - -### 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 | diff --git a/samples/client/petstore/kotlin/docs/paths/fakerefscomposedoneofnumberwithvalidations/post/FakerefscomposedoneofnumberwithvalidationsPostResponses.md b/samples/client/petstore/kotlin/docs/paths/fakerefscomposedoneofnumberwithvalidations/post/FakerefscomposedoneofnumberwithvalidationsPostResponses.md deleted file mode 100644 index 79622065b82..00000000000 --- a/samples/client/petstore/kotlin/docs/paths/fakerefscomposedoneofnumberwithvalidations/post/FakerefscomposedoneofnumberwithvalidationsPostResponses.md +++ /dev/null @@ -1,29 +0,0 @@ -# FakerefscomposedoneofnumberwithvalidationsPostResponses - -public class FakerefscomposedoneofnumberwithvalidationsPostResponses - -A class that contains necessary responses classes -- a sealed interface, EndpointResponse, that stores endpoint responses -- records for each endpoint response - -## Nested Class Summary -| Modifier and Type | Class and Description | -| ----------------- | --------------------- | -| sealed interface | [EndpointResponse](#endpointresponse)
stores the endpoint responses | -| record | [EndpointFakerefscomposedoneofnumberwithvalidationsPostCode200Response](#endpointfakerefscomposedoneofnumberwithvalidationspostcode200response)
the response for 200 | - -## EndpointResponse -public sealed interface EndpointResponse permits
-[EndpointFakerefscomposedoneofnumberwithvalidationsPostCode200Response](#endpointfakerefscomposedoneofnumberwithvalidationspostcode200response) - -a sealed interface that stores endpoint responses - -## EndpointFakerefscomposedoneofnumberwithvalidationsPostCode200Response -public record EndpointFakerefscomposedoneofnumberwithvalidationsPostCode200Response( - HttpResponse response, - [FakerefscomposedoneofnumberwithvalidationsPostCode200Response.SealedResponseBody](../../../paths/fakerefscomposedoneofnumberwithvalidations/post/responses/FakerefscomposedoneofnumberwithvalidationsPostCode200Response.md#sealedresponsebody) body, - Nothing? headers -) implements EndpointResponse, ApiResponse
- -a class that stores an endpoint response - diff --git a/samples/client/petstore/kotlin/docs/paths/fakerefscomposedoneofnumberwithvalidations/post/requestbody/content/applicationjson/ApplicationjsonSchema.md b/samples/client/petstore/kotlin/docs/paths/fakerefscomposedoneofnumberwithvalidations/post/requestbody/content/applicationjson/ApplicationjsonSchema.md deleted file mode 100644 index 6d15e5f1438..00000000000 --- a/samples/client/petstore/kotlin/docs/paths/fakerefscomposedoneofnumberwithvalidations/post/requestbody/content/applicationjson/ApplicationjsonSchema.md +++ /dev/null @@ -1,19 +0,0 @@ -# ApplicationjsonSchema -public class ApplicationjsonSchema
-extends [ComposedOneOfDifferentTypes1](../../../../../../components/schemas/ComposedOneOfDifferentTypes.md#composedoneofdifferenttypes) - -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 - -## Nested Class Summary -| Modifier and Type | Class and Description | -| ----------------- | ---------------------- | -| static class | [ApplicationjsonSchema.ApplicationjsonSchema1](#applicationjsonschema1)
schema class | - -## ApplicationjsonSchema1 -public static class ApplicationjsonSchema1
-extends [ComposedOneOfDifferentTypes.ComposedOneOfDifferentTypes1](../../../../../../components/schemas/ComposedOneOfDifferentTypes.md#composedoneofdifferenttypes1) - -A schema class that validates payloads diff --git a/samples/client/petstore/kotlin/docs/paths/fakerefscomposedoneofnumberwithvalidations/post/responses/FakerefscomposedoneofnumberwithvalidationsPostCode200Response.md b/samples/client/petstore/kotlin/docs/paths/fakerefscomposedoneofnumberwithvalidations/post/responses/FakerefscomposedoneofnumberwithvalidationsPostCode200Response.md deleted file mode 100644 index a66b2ce4c32..00000000000 --- a/samples/client/petstore/kotlin/docs/paths/fakerefscomposedoneofnumberwithvalidations/post/responses/FakerefscomposedoneofnumberwithvalidationsPostCode200Response.md +++ /dev/null @@ -1,87 +0,0 @@ -# FakerefscomposedoneofnumberwithvalidationsPostCode200Response - -public class FakerefscomposedoneofnumberwithvalidationsPostCode200Response - -A class that contains necessary nested response classes -- SealedMediaType, a sealed interface which contains all the schema/encoding info for each contentType -- records which implement SealedMediaType, the concrete media types -- SealedResponseBody, a sealed interface which contains all the contentType/schema types -- records which implement SealedResponseBody, the concrete response body types -- a class that extends ResponseDeserializer and is used to deserialize responses - -## Nested Class Summary -| Modifier and Type | Class and Description | -| ----------------- | --------------------- | -| sealed interface | [FakerefscomposedoneofnumberwithvalidationsPostCode200Response.SealedMediaType](#sealedmediatype)
media type sealed interface | -| record | [FakerefscomposedoneofnumberwithvalidationsPostCode200Response.ApplicationjsonMediaType](#applicationjsonmediatype)
record storing schema + encoding for a specific contentType | -| sealed interface | [FakerefscomposedoneofnumberwithvalidationsPostCode200Response.SealedResponseBody](#sealedresponsebody)
response body sealed interface | -| record | [FakerefscomposedoneofnumberwithvalidationsPostCode200Response.ApplicationjsonResponseBody](#applicationjsonresponsebody)
implements sealed interface to store response body | -| static class | [FakerefscomposedoneofnumberwithvalidationsPostCode200Response.FakerefscomposedoneofnumberwithvalidationsPostCode200Response1](#fakerefscomposedoneofnumberwithvalidationspostcode200response1)
class that deserializes responses | - -## SealedMediaType -public sealed interface SealedMediaType
-permits
-[ApplicationjsonMediaType](#applicationjsonmediatype) - -sealed interface that stores schema and encoding info - -## ApplicationjsonMediaType -public record ApplicationjsonMediaType
-implements [SealedMediaType](#sealedmediatype), MediaType<[ApplicationjsonSchema.ApplicationjsonSchema1](../../../../paths/fakerefscomposedoneofnumberwithvalidations/post/responses/code200response/content/applicationjson/ApplicationjsonSchema.md#applicationjsonschema1), Nothing?> - -class storing schema info for a specific contentType - -### Constructor Summary -| Constructor and Description | -| --------------------------- | -| ApplicationjsonMediaType()
Creates an instance | - -### Method Summary -| Modifier and Type | Method and Description | -| ----------------- | ---------------------- | -| [ApplicationjsonSchema.ApplicationjsonSchema1](../../../../paths/fakerefscomposedoneofnumberwithvalidations/post/responses/code200response/content/applicationjson/ApplicationjsonSchema.md#applicationjsonschema1) | schema()
the schema for this MediaType | -| Nothing? | encoding()
the encoding info | - -## SealedResponseBody -public sealed interface SealedResponseBody
-permits
-[ApplicationjsonResponseBody](#applicationjsonresponsebody) - -sealed interface that stores response body - -## ApplicationjsonResponseBody -public record ApplicationjsonResponseBody
-implements [SealedResponseBody](#sealedresponsebody) - -A record class to store response body for contentType="application/json" - -### Constructor Summary -| Constructor and Description | -| --------------------------- | -| ApplicationjsonResponseBody(ApplicationjsonSchema.[ComposedOneOfDifferentTypes1Boxed](../../../../components/schemas/ComposedOneOfDifferentTypes.md#composedoneofdifferenttypes1boxed) body)
Creates an instance | - -### Method Summary -| Modifier and Type | Method and Description | -| ----------------- | ---------------------- | -| ApplicationjsonSchema.[ComposedOneOfDifferentTypes1Boxed](../../../../components/schemas/ComposedOneOfDifferentTypes.md#composedoneofdifferenttypes1boxed) | body()
returns the body passed in in the constructor | - -## FakerefscomposedoneofnumberwithvalidationsPostCode200Response1 -public static class FakerefscomposedoneofnumberwithvalidationsPostCode200Response1
-extends ResponseDeserializer<[SealedResponseBody](#sealedresponsebody), Nothing?, [SealedMediaType](#sealedmediatype)> - -a class that deserializes responses - -### Constructor Summary -| Constructor and Description | -| --------------------------- | -| FakerefscomposedoneofnumberwithvalidationsPostCode200Response1()
Creates an instance | - -### Field Summary -| Modifier and Type | Field and Description | -| ----------------- | --------------------- | -| 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 | -| ----------------- | ---------------------- | -| ApiResponse<[SealedResponseBody](#sealedresponsebody), Nothing?> | deserialize(HttpResponse response, SchemaConfiguration configuration)
called by endpoint when deserialize responses | diff --git a/samples/client/petstore/kotlin/docs/paths/fakerefscomposedoneofnumberwithvalidations/post/responses/code200response/content/applicationjson/ApplicationjsonSchema.md b/samples/client/petstore/kotlin/docs/paths/fakerefscomposedoneofnumberwithvalidations/post/responses/code200response/content/applicationjson/ApplicationjsonSchema.md deleted file mode 100644 index 1e3738551c2..00000000000 --- a/samples/client/petstore/kotlin/docs/paths/fakerefscomposedoneofnumberwithvalidations/post/responses/code200response/content/applicationjson/ApplicationjsonSchema.md +++ /dev/null @@ -1,19 +0,0 @@ -# ApplicationjsonSchema -public class ApplicationjsonSchema
-extends [ComposedOneOfDifferentTypes1](../../../../../../../components/schemas/ComposedOneOfDifferentTypes.md#composedoneofdifferenttypes) - -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 - -## Nested Class Summary -| Modifier and Type | Class and Description | -| ----------------- | ---------------------- | -| static class | [ApplicationjsonSchema.ApplicationjsonSchema1](#applicationjsonschema1)
schema class | - -## ApplicationjsonSchema1 -public static class ApplicationjsonSchema1
-extends [ComposedOneOfDifferentTypes.ComposedOneOfDifferentTypes1](../../../../../../../components/schemas/ComposedOneOfDifferentTypes.md#composedoneofdifferenttypes1) - -A schema class that validates payloads diff --git a/samples/client/petstore/kotlin/docs/paths/fakerefsenum/FakerefsenumPost.md b/samples/client/petstore/kotlin/docs/paths/fakerefsenum/FakerefsenumPost.md deleted file mode 100644 index 25dd52297ca..00000000000 --- a/samples/client/petstore/kotlin/docs/paths/fakerefsenum/FakerefsenumPost.md +++ /dev/null @@ -1,148 +0,0 @@ -# FakerefsenumPost - -public class FakerefsenumPost - -A class that contains necessary endpoint classes -- a class that calls the endpoint method using the http verb -- a class that calls the endpoint method using the operationId name -- class(es) to store the request inputs -- builder(s) to set the request input data - -## Nested Class Summary -| Modifier and Type | Class and Description | -| ----------------- | --------------------- | -| static class | [Post](#post)
The class that has a post method to call the endpoint | -| interface | [StringEnumOperation](#stringenumoperation)
The interface that has a stringEnum method to call the endpoint | -| static class | [PostRequest](#postrequest)
The request inputs class | -| static class | [PostRequestBuilder](#postrequestbuilder)
A builder for the request input class | - -## Post -public static class Post 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.FakerefsenumPostRequestBody; -import org.openapijsonschematools.client.components.schemas.StringEnum; -import org.openapijsonschematools.client.RootServerInfo; -import org.openapijsonschematools.client.servers.RootServer0; -import org.openapijsonschematools.client.servers.RootServer1; -import org.openapijsonschematools.client.servers.RootServer2; -import org.openapijsonschematools.client.paths.fakerefsenum.post.responses.FakerefsenumPostCode200Response; -import org.openapijsonschematools.client.servers.RootServerInfo; -import org.openapijsonschematools.client.paths.fakerefsenum.FakerefsenumPost; -import org.openapijsonschematools.client.paths.fakerefsenum.post.FakerefsenumPostResponses; - -import java.io.IOException; -import java.util.Arrays; -import java.util.List; -import java.util.Map; -import java.util.AbstractMap; - -// if you want to use a server that is not SERVER_0 pass it in here and change the ServerIndex input below -ApiConfiguration.ServerInfo serverInfo = new ApiConfiguration.ServerInfoBuilder() - .rootServerInfo( - new RootServerInfo.RootServerInfoBuilder() - .rootServer0(new RootServer0()) - .build() - ) - .build(); -ApiConfiguration.ServerIndexInfo serverIndexInfo = new ApiConfiguration.ServerIndexInfoBuilder() - .rootServerInfoServerIndex(RootServerInfo.ServerIndex.SERVER_0) - .build(); -Duration timeout = Duration.ofSeconds(1L); -Map> defaultHeaders = Map.of("User-Agent", List.of("OpenAPI-JSON-Schema-Generator/1.0.0/java")); -ApiConfiguration apiConfiguration = new ApiConfiguration( - serverInfo - serverIndexInfo, - timeout, - defaultHeaders -); -SchemaConfiguration schemaConfiguration = new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().build()); -FakerefsenumPost.Post apiClient = new FakerefsenumPost.Post(apiConfiguration, schemaConfiguration); - - -var request = new FakerefsenumPost.PostRequestBuilder().build(); - -FakerefsenumPostResponses.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; -} -FakerefsenumPostResponses.EndpointFakerefsenumPostCode200Response castResponse = (FakerefsenumPostResponses.EndpointFakerefsenumPostCode200Response) response; -FakerefsenumPostCode200Response.ApplicationjsonResponseBody deserializedBody = (FakerefsenumPostCode200Response.ApplicationjsonResponseBody) castResponse.body; -// handle deserialized body here -``` -### Constructor Summary -| Constructor and Description | -| --------------------------- | -| Post(ApiConfiguration apiConfiguration, SchemaConfiguration schemaConfiguration)
Creates an instance | - -### Method Summary -| Modifier and Type | Method and Description | -| ----------------- | ---------------------- | -| [FakerefsenumPostResponses.EndpointResponse](../../paths/fakerefsenum/post/FakerefsenumPostResponses.md#endpointresponse) | post([PostRequest](#postrequest) request) | - -## StringEnumOperation -public interface StringEnumOperation
- -an interface that allows one to call the endpoint using a method named stringEnum by the operationId - -### Method Summary -| Modifier and Type | Method and Description | -| ----------------- | ---------------------- | -| [FakerefsenumPostResponses.EndpointResponse](../../paths/fakerefsenum/post/FakerefsenumPostResponses.md#endpointresponse) | stringEnum([PostRequest](#postrequest) request) | - -## PostRequest -public static class PostRequest
- -a class that stores the final request inputs - -### Field Summary -| Modifier and Type | Field and Description | -| ----------------- | --------------------- | -| [FakerefsenumPostRequestBody.@Nullable SealedRequestBody](../../paths/fakerefsenum/post/FakerefsenumPostRequestBody.md#sealedrequestbody) | requestBody
optional | -| [RootServerInfo.@Nullable ServerIndex](../../RootServerInfo.md#serverindex) | serverIndex
optional. Note: this will override the value in apiConfiguration | -| @Nullable Duration | timeout
optional. Note: this will override the value in apiConfiguration | - -## PostRequestBuilder -public static class PostRequestBuilder
- -a builder for request inputs - -### Constructor Summary -| Constructor and Description | -| --------------------------- | -| PostRequestBuilder()
Creates a builder that contains null for all parameters | - -### Method Summary -| Modifier and Type | Method and Description | -| ----------------- | ---------------------- | -| [PostRequest](#postrequest) | build()
Returns the request input used to call an endpoint method | -| [PostRequestBuilder](#postrequestbuilder) | requestBody([FakerefsenumPostRequestBody.SealedRequestBody](../../paths/fakerefsenum/post/FakerefsenumPostRequestBody.md#sealedrequestbody) requestBody)
sets the optional property | -| [PostRequestBuilder](#postrequestbuilder) | serverIndex([RootServerInfo.ServerIndex](../../RootServerInfo.md#serverindex) serverIndex)
sets the optional property. Note: this will override the value in apiConfiguration | -| [PostRequestBuilder](#postrequestbuilder) | timeout(Duration timeout)
sets the optional property. Note: this will override the value in apiConfiguration | - -[[Back to top]](#top) [[Back to README]](../../../README.md) diff --git a/samples/client/petstore/kotlin/docs/paths/fakerefsenum/post/FakerefsenumPostRequestBody.md b/samples/client/petstore/kotlin/docs/paths/fakerefsenum/post/FakerefsenumPostRequestBody.md deleted file mode 100644 index b28d9e3b6e9..00000000000 --- a/samples/client/petstore/kotlin/docs/paths/fakerefsenum/post/FakerefsenumPostRequestBody.md +++ /dev/null @@ -1,90 +0,0 @@ -# FakerefsenumPostRequestBody - -public class FakerefsenumPostRequestBody - -A class that contains necessary nested request body classes -- SealedMediaType, a sealed interface which contains all the schema/encoding info for each contentType -- records which implement SealedMediaType, the concrete media types -- a class that extends RequestBodySerializer and is used to serialize input SealedRequestBody instances -- SealedRequestBody, a sealed interface which contains all the contentType/schema input types -- records which implement SealedRequestBody, the concrete request body types - -## Nested Class Summary -| Modifier and Type | Class and Description | -| ----------------- | --------------------- | -| sealed interface | [FakerefsenumPostRequestBody.SealedMediaType](#sealedmediatype)
media type sealed interface | -| record | [FakerefsenumPostRequestBody.ApplicationjsonMediaType](#applicationjsonmediatype)
record storing schema + encoding for a specific contentType | -| static class | [FakerefsenumPostRequestBody.FakerefsenumPostRequestBody1](#fakerefsenumpostrequestbody1)
class that serializes request bodies | -| sealed interface | [FakerefsenumPostRequestBody.SealedRequestBody](#sealedrequestbody)
request body sealed interface | -| record | [FakerefsenumPostRequestBody.ApplicationjsonRequestBody](#applicationjsonrequestbody)
implements sealed interface to store request body input | - -## SealedMediaType -public sealed interface SealedMediaType
-permits
-[ApplicationjsonMediaType](#applicationjsonmediatype) - -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), Nothing?> - -class storing schema info for a specific contentType - -### Constructor Summary -| Constructor and Description | -| --------------------------- | -| ApplicationjsonMediaType()
Creates an instance | - -### 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 | -| Nothing? | encoding()
the encoding info | - -## FakerefsenumPostRequestBody1 -public static class FakerefsenumPostRequestBody1
- -a class that serializes SealedRequestBody request bodies - -### Constructor Summary -| Constructor and Description | -| --------------------------- | -| FakerefsenumPostRequestBody1()
Creates an instance | - -### Field Summary -| Modifier and Type | Field and Description | -| ----------------- | --------------------- | -| boolean | required = false
whether the request body is required | -| 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 | -| ----------------- | ---------------------- | -| SerializedRequestBody | serialize([SealedRequestBody](#sealedrequestbody) requestBody)
called by endpoint when creating request body bytes | - -## SealedRequestBody -public sealed interface SealedRequestBody
-permits
-[ApplicationjsonRequestBody](#applicationjsonrequestbody) - -sealed interface that stores request contentType + validated schema data - -## ApplicationjsonRequestBody -public record ApplicationjsonRequestBody
-implements [SealedRequestBody](#sealedrequestbody),
-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 | - -### 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 | diff --git a/samples/client/petstore/kotlin/docs/paths/fakerefsenum/post/FakerefsenumPostResponses.md b/samples/client/petstore/kotlin/docs/paths/fakerefsenum/post/FakerefsenumPostResponses.md deleted file mode 100644 index 572faa88116..00000000000 --- a/samples/client/petstore/kotlin/docs/paths/fakerefsenum/post/FakerefsenumPostResponses.md +++ /dev/null @@ -1,29 +0,0 @@ -# FakerefsenumPostResponses - -public class FakerefsenumPostResponses - -A class that contains necessary responses classes -- a sealed interface, EndpointResponse, that stores endpoint responses -- records for each endpoint response - -## Nested Class Summary -| Modifier and Type | Class and Description | -| ----------------- | --------------------- | -| sealed interface | [EndpointResponse](#endpointresponse)
stores the endpoint responses | -| record | [EndpointFakerefsenumPostCode200Response](#endpointfakerefsenumpostcode200response)
the response for 200 | - -## EndpointResponse -public sealed interface EndpointResponse permits
-[EndpointFakerefsenumPostCode200Response](#endpointfakerefsenumpostcode200response) - -a sealed interface that stores endpoint responses - -## EndpointFakerefsenumPostCode200Response -public record EndpointFakerefsenumPostCode200Response( - HttpResponse response, - [FakerefsenumPostCode200Response.SealedResponseBody](../../../paths/fakerefsenum/post/responses/FakerefsenumPostCode200Response.md#sealedresponsebody) body, - Nothing? headers -) implements EndpointResponse, ApiResponse
- -a class that stores an endpoint response - diff --git a/samples/client/petstore/kotlin/docs/paths/fakerefsenum/post/requestbody/content/applicationjson/ApplicationjsonSchema.md b/samples/client/petstore/kotlin/docs/paths/fakerefsenum/post/requestbody/content/applicationjson/ApplicationjsonSchema.md deleted file mode 100644 index d83adaf246f..00000000000 --- a/samples/client/petstore/kotlin/docs/paths/fakerefsenum/post/requestbody/content/applicationjson/ApplicationjsonSchema.md +++ /dev/null @@ -1,19 +0,0 @@ -# ApplicationjsonSchema -public class ApplicationjsonSchema
-extends [StringEnum1](../../../../../../components/schemas/StringEnum.md#stringenum) - -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 - -## Nested Class Summary -| Modifier and Type | Class and Description | -| ----------------- | ---------------------- | -| static class | [ApplicationjsonSchema.ApplicationjsonSchema1](#applicationjsonschema1)
schema class | - -## ApplicationjsonSchema1 -public static class ApplicationjsonSchema1
-extends [StringEnum.StringEnum1](../../../../../../components/schemas/StringEnum.md#stringenum1) - -A schema class that validates payloads diff --git a/samples/client/petstore/kotlin/docs/paths/fakerefsenum/post/responses/FakerefsenumPostCode200Response.md b/samples/client/petstore/kotlin/docs/paths/fakerefsenum/post/responses/FakerefsenumPostCode200Response.md deleted file mode 100644 index e29827ba69d..00000000000 --- a/samples/client/petstore/kotlin/docs/paths/fakerefsenum/post/responses/FakerefsenumPostCode200Response.md +++ /dev/null @@ -1,87 +0,0 @@ -# FakerefsenumPostCode200Response - -public class FakerefsenumPostCode200Response - -A class that contains necessary nested response classes -- SealedMediaType, a sealed interface which contains all the schema/encoding info for each contentType -- records which implement SealedMediaType, the concrete media types -- SealedResponseBody, a sealed interface which contains all the contentType/schema types -- records which implement SealedResponseBody, the concrete response body types -- a class that extends ResponseDeserializer and is used to deserialize responses - -## Nested Class Summary -| Modifier and Type | Class and Description | -| ----------------- | --------------------- | -| sealed interface | [FakerefsenumPostCode200Response.SealedMediaType](#sealedmediatype)
media type sealed interface | -| record | [FakerefsenumPostCode200Response.ApplicationjsonMediaType](#applicationjsonmediatype)
record storing schema + encoding for a specific contentType | -| sealed interface | [FakerefsenumPostCode200Response.SealedResponseBody](#sealedresponsebody)
response body sealed interface | -| record | [FakerefsenumPostCode200Response.ApplicationjsonResponseBody](#applicationjsonresponsebody)
implements sealed interface to store response body | -| static class | [FakerefsenumPostCode200Response.FakerefsenumPostCode200Response1](#fakerefsenumpostcode200response1)
class that deserializes responses | - -## SealedMediaType -public sealed interface SealedMediaType
-permits
-[ApplicationjsonMediaType](#applicationjsonmediatype) - -sealed interface that stores schema and encoding info - -## ApplicationjsonMediaType -public record ApplicationjsonMediaType
-implements [SealedMediaType](#sealedmediatype), MediaType<[ApplicationjsonSchema.ApplicationjsonSchema1](../../../../paths/fakerefsenum/post/responses/code200response/content/applicationjson/ApplicationjsonSchema.md#applicationjsonschema1), Nothing?> - -class storing schema info for a specific contentType - -### Constructor Summary -| Constructor and Description | -| --------------------------- | -| ApplicationjsonMediaType()
Creates an instance | - -### Method Summary -| Modifier and Type | Method and Description | -| ----------------- | ---------------------- | -| [ApplicationjsonSchema.ApplicationjsonSchema1](../../../../paths/fakerefsenum/post/responses/code200response/content/applicationjson/ApplicationjsonSchema.md#applicationjsonschema1) | schema()
the schema for this MediaType | -| Nothing? | encoding()
the encoding info | - -## SealedResponseBody -public sealed interface SealedResponseBody
-permits
-[ApplicationjsonResponseBody](#applicationjsonresponsebody) - -sealed interface that stores response body - -## ApplicationjsonResponseBody -public record ApplicationjsonResponseBody
-implements [SealedResponseBody](#sealedresponsebody) - -A record class to store response body for contentType="application/json" - -### Constructor Summary -| Constructor and Description | -| --------------------------- | -| ApplicationjsonResponseBody(ApplicationjsonSchema.[StringEnum1Boxed](../../../../components/schemas/StringEnum.md#stringenum1boxed) body)
Creates an instance | - -### Method Summary -| Modifier and Type | Method and Description | -| ----------------- | ---------------------- | -| ApplicationjsonSchema.[StringEnum1Boxed](../../../../components/schemas/StringEnum.md#stringenum1boxed) | body()
returns the body passed in in the constructor | - -## FakerefsenumPostCode200Response1 -public static class FakerefsenumPostCode200Response1
-extends ResponseDeserializer<[SealedResponseBody](#sealedresponsebody), Nothing?, [SealedMediaType](#sealedmediatype)> - -a class that deserializes responses - -### Constructor Summary -| Constructor and Description | -| --------------------------- | -| FakerefsenumPostCode200Response1()
Creates an instance | - -### Field Summary -| Modifier and Type | Field and Description | -| ----------------- | --------------------- | -| 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 | -| ----------------- | ---------------------- | -| ApiResponse<[SealedResponseBody](#sealedresponsebody), Nothing?> | deserialize(HttpResponse response, SchemaConfiguration configuration)
called by endpoint when deserialize responses | diff --git a/samples/client/petstore/kotlin/docs/paths/fakerefsenum/post/responses/code200response/content/applicationjson/ApplicationjsonSchema.md b/samples/client/petstore/kotlin/docs/paths/fakerefsenum/post/responses/code200response/content/applicationjson/ApplicationjsonSchema.md deleted file mode 100644 index 2ac02fd09b9..00000000000 --- a/samples/client/petstore/kotlin/docs/paths/fakerefsenum/post/responses/code200response/content/applicationjson/ApplicationjsonSchema.md +++ /dev/null @@ -1,19 +0,0 @@ -# ApplicationjsonSchema -public class ApplicationjsonSchema
-extends [StringEnum1](../../../../../../../components/schemas/StringEnum.md#stringenum) - -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 - -## Nested Class Summary -| Modifier and Type | Class and Description | -| ----------------- | ---------------------- | -| static class | [ApplicationjsonSchema.ApplicationjsonSchema1](#applicationjsonschema1)
schema class | - -## ApplicationjsonSchema1 -public static class ApplicationjsonSchema1
-extends [StringEnum.StringEnum1](../../../../../../../components/schemas/StringEnum.md#stringenum1) - -A schema class that validates payloads diff --git a/samples/client/petstore/kotlin/docs/paths/fakerefsmammal/FakerefsmammalPost.md b/samples/client/petstore/kotlin/docs/paths/fakerefsmammal/FakerefsmammalPost.md deleted file mode 100644 index 0cd434caa3f..00000000000 --- a/samples/client/petstore/kotlin/docs/paths/fakerefsmammal/FakerefsmammalPost.md +++ /dev/null @@ -1,179 +0,0 @@ -# FakerefsmammalPost - -public class FakerefsmammalPost - -A class that contains necessary endpoint classes -- a class that calls the endpoint method using the http verb -- a class that calls the endpoint method using the operationId name -- class(es) to store the request inputs -- builder(s) to set the request input data - -## Nested Class Summary -| Modifier and Type | Class and Description | -| ----------------- | --------------------- | -| static class | [Post](#post)
The class that has a post method to call the endpoint | -| interface | [MammalOperation](#mammaloperation)
The interface that has a mammal method to call the endpoint | -| static class | [PostRequest](#postrequest)
The final request inputs class | -| static class | [PostNullableRequest](#postnullablerequest)
The initial request inputs class | -| static class | [Post0RequestBuilder](#post0requestbuilder)
A builder for the request input class | -| static class | [PostRequestBuilder](#postrequestbuilder)
A builder for the request input class | - -## Post -public static class Post 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.FakerefsmammalPostRequestBody; -import org.openapijsonschematools.client.components.schemas.Mammal; -import org.openapijsonschematools.client.servers.RootServer0; -import org.openapijsonschematools.client.servers.RootServer1; -import org.openapijsonschematools.client.servers.RootServer2; -import org.openapijsonschematools.client.paths.fakerefsmammal.post.responses.FakerefsmammalPostCode200Response; -import org.openapijsonschematools.client.servers.RootServerInfo; -import org.openapijsonschematools.client.paths.fakerefsmammal.FakerefsmammalPost; -import org.openapijsonschematools.client.paths.fakerefsmammal.post.FakerefsmammalPostResponses; - -import java.io.IOException; -import java.util.Arrays; -import java.util.List; -import java.util.Map; -import java.util.AbstractMap; - -// if you want to use a server that is not SERVER_0 pass it in here and change the ServerIndex input below -ApiConfiguration.ServerInfo serverInfo = new ApiConfiguration.ServerInfoBuilder() - .rootServerInfo( - new RootServerInfo.RootServerInfoBuilder() - .rootServer0(new RootServer0()) - .build() - ) - .build(); -ApiConfiguration.ServerIndexInfo serverIndexInfo = new ApiConfiguration.ServerIndexInfoBuilder() - .rootServerInfoServerIndex(RootServerInfo.ServerIndex.SERVER_0) - .build(); -Duration timeout = Duration.ofSeconds(1L); -Map> defaultHeaders = Map.of("User-Agent", List.of("OpenAPI-JSON-Schema-Generator/1.0.0/java")); -ApiConfiguration apiConfiguration = new ApiConfiguration( - serverInfo - serverIndexInfo, - timeout, - defaultHeaders -); -SchemaConfiguration schemaConfiguration = new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().build()); -FakerefsmammalPost.Post apiClient = new FakerefsmammalPost.Post(apiConfiguration, schemaConfiguration); - -FakerefsmammalPost.SealedRequestBody requestBody = new FakerefsmammalPost.ApplicationjsonRequestBody(requestBodyPayload); - -var request = new FakerefsmammalPost.PostRequestBuilder() - .requestBody(requestBody) - .build(); - -FakerefsmammalPostResponses.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; -} -FakerefsmammalPostResponses.EndpointFakerefsmammalPostCode200Response castResponse = (FakerefsmammalPostResponses.EndpointFakerefsmammalPostCode200Response) response; -FakerefsmammalPostCode200Response.ApplicationjsonResponseBody deserializedBody = (FakerefsmammalPostCode200Response.ApplicationjsonResponseBody) castResponse.body; -// handle deserialized body here -``` -### Constructor Summary -| Constructor and Description | -| --------------------------- | -| Post(ApiConfiguration apiConfiguration, SchemaConfiguration schemaConfiguration)
Creates an instance | - -### Method Summary -| Modifier and Type | Method and Description | -| ----------------- | ---------------------- | -| [FakerefsmammalPostResponses.EndpointResponse](../../paths/fakerefsmammal/post/FakerefsmammalPostResponses.md#endpointresponse) | post([PostRequest](#postrequest) request) | - -## MammalOperation -public interface MammalOperation
- -an interface that allows one to call the endpoint using a method named mammal by the operationId - -### Method Summary -| Modifier and Type | Method and Description | -| ----------------- | ---------------------- | -| [FakerefsmammalPostResponses.EndpointResponse](../../paths/fakerefsmammal/post/FakerefsmammalPostResponses.md#endpointresponse) | mammal([PostRequest](#postrequest) request) | - -## PostRequest -public static class PostRequest
- -a class that stores the final request inputs - -### Field Summary -| Modifier and Type | Field and Description | -| ----------------- | --------------------- | -| [FakerefsmammalPostRequestBody.SealedRequestBody](../../paths/fakerefsmammal/post/FakerefsmammalPostRequestBody.md#sealedrequestbody) | requestBody | -| [RootServerInfo.@Nullable ServerIndex](../../RootServerInfo.md#serverindex) | serverIndex
optional. Note: this will override the value in apiConfiguration | -| @Nullable Duration | timeout
optional. Note: this will override the value in apiConfiguration | - -## PostNullableRequest -public static class PostNullableRequest
- -a class that stores the initial request inputs - -### Field Summary -| Modifier and Type | Field and Description | -| ----------------- | --------------------- | -| [FakerefsmammalPostRequestBody.@Nullable SealedRequestBody](../../paths/fakerefsmammal/post/FakerefsmammalPostRequestBody.md#sealedrequestbody) | requestBody | -| [RootServerInfo.@Nullable ServerIndex](../../RootServerInfo.md#serverindex) | serverIndex | -| @Nullable Duration | timeout | - -## Post0RequestBuilder -public static class Post0RequestBuilder
- -a builder for request inputs - -### Constructor Summary -| Constructor and Description | -| --------------------------- | -| Post0RequestBuilder(Post0RequestBuilder instance)
Creates a builder that contains the passed instance | - -### Method Summary -| Modifier and Type | Method and Description | -| ----------------- | ---------------------- | -| [PostRequest](#postrequest) | build()
Returns the request input used to call an endpoint method | -| [Post0RequestBuilder](#post0requestbuilder) | serverIndex([RootServerInfo.ServerIndex](../../RootServerInfo.md#serverindex) serverIndex)
sets the optional property. Note: this will override the value in apiConfiguration | -| [Post0RequestBuilder](#post0requestbuilder) | timeout(Duration timeout)
sets the optional property. Note: this will override the value in apiConfiguration | - -## PostRequestBuilder -public static class PostRequestBuilder
- -a builder for request inputs - -### Constructor Summary -| Constructor and Description | -| --------------------------- | -| PostRequestBuilder()
Creates a builder that contains null for all parameters | - -### Method Summary -| Modifier and Type | Method and Description | -| ----------------- | ---------------------- | -| [Post0RequestBuilder](#post0requestbuilder) | requestBody([FakerefsmammalPostRequestBody.SealedRequestBody](../../paths/fakerefsmammal/post/FakerefsmammalPostRequestBody.md#sealedrequestbody) requestBody)
sets the property | - -[[Back to top]](#top) [[Back to README]](../../../README.md) diff --git a/samples/client/petstore/kotlin/docs/paths/fakerefsmammal/post/FakerefsmammalPostRequestBody.md b/samples/client/petstore/kotlin/docs/paths/fakerefsmammal/post/FakerefsmammalPostRequestBody.md deleted file mode 100644 index a038d9b1d1b..00000000000 --- a/samples/client/petstore/kotlin/docs/paths/fakerefsmammal/post/FakerefsmammalPostRequestBody.md +++ /dev/null @@ -1,90 +0,0 @@ -# FakerefsmammalPostRequestBody - -public class FakerefsmammalPostRequestBody - -A class that contains necessary nested request body classes -- SealedMediaType, a sealed interface which contains all the schema/encoding info for each contentType -- records which implement SealedMediaType, the concrete media types -- a class that extends RequestBodySerializer and is used to serialize input SealedRequestBody instances -- SealedRequestBody, a sealed interface which contains all the contentType/schema input types -- records which implement SealedRequestBody, the concrete request body types - -## Nested Class Summary -| Modifier and Type | Class and Description | -| ----------------- | --------------------- | -| sealed interface | [FakerefsmammalPostRequestBody.SealedMediaType](#sealedmediatype)
media type sealed interface | -| record | [FakerefsmammalPostRequestBody.ApplicationjsonMediaType](#applicationjsonmediatype)
record storing schema + encoding for a specific contentType | -| static class | [FakerefsmammalPostRequestBody.FakerefsmammalPostRequestBody1](#fakerefsmammalpostrequestbody1)
class that serializes request bodies | -| sealed interface | [FakerefsmammalPostRequestBody.SealedRequestBody](#sealedrequestbody)
request body sealed interface | -| record | [FakerefsmammalPostRequestBody.ApplicationjsonRequestBody](#applicationjsonrequestbody)
implements sealed interface to store request body input | - -## SealedMediaType -public sealed interface SealedMediaType
-permits
-[ApplicationjsonMediaType](#applicationjsonmediatype) - -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), Nothing?> - -class storing schema info for a specific contentType - -### Constructor Summary -| Constructor and Description | -| --------------------------- | -| ApplicationjsonMediaType()
Creates an instance | - -### 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 | -| Nothing? | encoding()
the encoding info | - -## FakerefsmammalPostRequestBody1 -public static class FakerefsmammalPostRequestBody1
- -a class that serializes SealedRequestBody request bodies - -### Constructor Summary -| Constructor and Description | -| --------------------------- | -| FakerefsmammalPostRequestBody1()
Creates an instance | - -### Field Summary -| Modifier and Type | Field and Description | -| ----------------- | --------------------- | -| boolean | required = true
whether the request body is required | -| 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 | -| ----------------- | ---------------------- | -| SerializedRequestBody | serialize([SealedRequestBody](#sealedrequestbody) requestBody)
called by endpoint when creating request body bytes | - -## SealedRequestBody -public sealed interface SealedRequestBody
-permits
-[ApplicationjsonRequestBody](#applicationjsonrequestbody) - -sealed interface that stores request contentType + validated schema data - -## ApplicationjsonRequestBody -public record ApplicationjsonRequestBody
-implements [SealedRequestBody](#sealedrequestbody),
-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 | - -### 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 | diff --git a/samples/client/petstore/kotlin/docs/paths/fakerefsmammal/post/FakerefsmammalPostResponses.md b/samples/client/petstore/kotlin/docs/paths/fakerefsmammal/post/FakerefsmammalPostResponses.md deleted file mode 100644 index c57c6f073e7..00000000000 --- a/samples/client/petstore/kotlin/docs/paths/fakerefsmammal/post/FakerefsmammalPostResponses.md +++ /dev/null @@ -1,29 +0,0 @@ -# FakerefsmammalPostResponses - -public class FakerefsmammalPostResponses - -A class that contains necessary responses classes -- a sealed interface, EndpointResponse, that stores endpoint responses -- records for each endpoint response - -## Nested Class Summary -| Modifier and Type | Class and Description | -| ----------------- | --------------------- | -| sealed interface | [EndpointResponse](#endpointresponse)
stores the endpoint responses | -| record | [EndpointFakerefsmammalPostCode200Response](#endpointfakerefsmammalpostcode200response)
the response for 200 | - -## EndpointResponse -public sealed interface EndpointResponse permits
-[EndpointFakerefsmammalPostCode200Response](#endpointfakerefsmammalpostcode200response) - -a sealed interface that stores endpoint responses - -## EndpointFakerefsmammalPostCode200Response -public record EndpointFakerefsmammalPostCode200Response( - HttpResponse response, - [FakerefsmammalPostCode200Response.SealedResponseBody](../../../paths/fakerefsmammal/post/responses/FakerefsmammalPostCode200Response.md#sealedresponsebody) body, - Nothing? headers -) implements EndpointResponse, ApiResponse
- -a class that stores an endpoint response - diff --git a/samples/client/petstore/kotlin/docs/paths/fakerefsmammal/post/requestbody/content/applicationjson/ApplicationjsonSchema.md b/samples/client/petstore/kotlin/docs/paths/fakerefsmammal/post/requestbody/content/applicationjson/ApplicationjsonSchema.md deleted file mode 100644 index b1b525d94da..00000000000 --- a/samples/client/petstore/kotlin/docs/paths/fakerefsmammal/post/requestbody/content/applicationjson/ApplicationjsonSchema.md +++ /dev/null @@ -1,19 +0,0 @@ -# ApplicationjsonSchema -public class ApplicationjsonSchema
-extends [Mammal1](../../../../../../components/schemas/Mammal.md#mammal) - -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 - -## Nested Class Summary -| Modifier and Type | Class and Description | -| ----------------- | ---------------------- | -| static class | [ApplicationjsonSchema.ApplicationjsonSchema1](#applicationjsonschema1)
schema class | - -## ApplicationjsonSchema1 -public static class ApplicationjsonSchema1
-extends [Mammal.Mammal1](../../../../../../components/schemas/Mammal.md#mammal1) - -A schema class that validates payloads diff --git a/samples/client/petstore/kotlin/docs/paths/fakerefsmammal/post/responses/FakerefsmammalPostCode200Response.md b/samples/client/petstore/kotlin/docs/paths/fakerefsmammal/post/responses/FakerefsmammalPostCode200Response.md deleted file mode 100644 index 4e1883f4f5c..00000000000 --- a/samples/client/petstore/kotlin/docs/paths/fakerefsmammal/post/responses/FakerefsmammalPostCode200Response.md +++ /dev/null @@ -1,87 +0,0 @@ -# FakerefsmammalPostCode200Response - -public class FakerefsmammalPostCode200Response - -A class that contains necessary nested response classes -- SealedMediaType, a sealed interface which contains all the schema/encoding info for each contentType -- records which implement SealedMediaType, the concrete media types -- SealedResponseBody, a sealed interface which contains all the contentType/schema types -- records which implement SealedResponseBody, the concrete response body types -- a class that extends ResponseDeserializer and is used to deserialize responses - -## Nested Class Summary -| Modifier and Type | Class and Description | -| ----------------- | --------------------- | -| sealed interface | [FakerefsmammalPostCode200Response.SealedMediaType](#sealedmediatype)
media type sealed interface | -| record | [FakerefsmammalPostCode200Response.ApplicationjsonMediaType](#applicationjsonmediatype)
record storing schema + encoding for a specific contentType | -| sealed interface | [FakerefsmammalPostCode200Response.SealedResponseBody](#sealedresponsebody)
response body sealed interface | -| record | [FakerefsmammalPostCode200Response.ApplicationjsonResponseBody](#applicationjsonresponsebody)
implements sealed interface to store response body | -| static class | [FakerefsmammalPostCode200Response.FakerefsmammalPostCode200Response1](#fakerefsmammalpostcode200response1)
class that deserializes responses | - -## SealedMediaType -public sealed interface SealedMediaType
-permits
-[ApplicationjsonMediaType](#applicationjsonmediatype) - -sealed interface that stores schema and encoding info - -## ApplicationjsonMediaType -public record ApplicationjsonMediaType
-implements [SealedMediaType](#sealedmediatype), MediaType<[ApplicationjsonSchema.ApplicationjsonSchema1](../../../../paths/fakerefsmammal/post/responses/code200response/content/applicationjson/ApplicationjsonSchema.md#applicationjsonschema1), Nothing?> - -class storing schema info for a specific contentType - -### Constructor Summary -| Constructor and Description | -| --------------------------- | -| ApplicationjsonMediaType()
Creates an instance | - -### Method Summary -| Modifier and Type | Method and Description | -| ----------------- | ---------------------- | -| [ApplicationjsonSchema.ApplicationjsonSchema1](../../../../paths/fakerefsmammal/post/responses/code200response/content/applicationjson/ApplicationjsonSchema.md#applicationjsonschema1) | schema()
the schema for this MediaType | -| Nothing? | encoding()
the encoding info | - -## SealedResponseBody -public sealed interface SealedResponseBody
-permits
-[ApplicationjsonResponseBody](#applicationjsonresponsebody) - -sealed interface that stores response body - -## ApplicationjsonResponseBody -public record ApplicationjsonResponseBody
-implements [SealedResponseBody](#sealedresponsebody) - -A record class to store response body for contentType="application/json" - -### Constructor Summary -| Constructor and Description | -| --------------------------- | -| ApplicationjsonResponseBody(ApplicationjsonSchema.[Mammal1Boxed](../../../../components/schemas/Mammal.md#mammal1boxed) body)
Creates an instance | - -### Method Summary -| Modifier and Type | Method and Description | -| ----------------- | ---------------------- | -| ApplicationjsonSchema.[Mammal1Boxed](../../../../components/schemas/Mammal.md#mammal1boxed) | body()
returns the body passed in in the constructor | - -## FakerefsmammalPostCode200Response1 -public static class FakerefsmammalPostCode200Response1
-extends ResponseDeserializer<[SealedResponseBody](#sealedresponsebody), Nothing?, [SealedMediaType](#sealedmediatype)> - -a class that deserializes responses - -### Constructor Summary -| Constructor and Description | -| --------------------------- | -| FakerefsmammalPostCode200Response1()
Creates an instance | - -### Field Summary -| Modifier and Type | Field and Description | -| ----------------- | --------------------- | -| 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 | -| ----------------- | ---------------------- | -| ApiResponse<[SealedResponseBody](#sealedresponsebody), Nothing?> | deserialize(HttpResponse response, SchemaConfiguration configuration)
called by endpoint when deserialize responses | diff --git a/samples/client/petstore/kotlin/docs/paths/fakerefsmammal/post/responses/code200response/content/applicationjson/ApplicationjsonSchema.md b/samples/client/petstore/kotlin/docs/paths/fakerefsmammal/post/responses/code200response/content/applicationjson/ApplicationjsonSchema.md deleted file mode 100644 index f0a5b53544f..00000000000 --- a/samples/client/petstore/kotlin/docs/paths/fakerefsmammal/post/responses/code200response/content/applicationjson/ApplicationjsonSchema.md +++ /dev/null @@ -1,19 +0,0 @@ -# ApplicationjsonSchema -public class ApplicationjsonSchema
-extends [Mammal1](../../../../../../../components/schemas/Mammal.md#mammal) - -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 - -## Nested Class Summary -| Modifier and Type | Class and Description | -| ----------------- | ---------------------- | -| static class | [ApplicationjsonSchema.ApplicationjsonSchema1](#applicationjsonschema1)
schema class | - -## ApplicationjsonSchema1 -public static class ApplicationjsonSchema1
-extends [Mammal.Mammal1](../../../../../../../components/schemas/Mammal.md#mammal1) - -A schema class that validates payloads diff --git a/samples/client/petstore/kotlin/docs/paths/fakerefsnumber/FakerefsnumberPost.md b/samples/client/petstore/kotlin/docs/paths/fakerefsnumber/FakerefsnumberPost.md deleted file mode 100644 index 8bfc7f4c81f..00000000000 --- a/samples/client/petstore/kotlin/docs/paths/fakerefsnumber/FakerefsnumberPost.md +++ /dev/null @@ -1,148 +0,0 @@ -# FakerefsnumberPost - -public class FakerefsnumberPost - -A class that contains necessary endpoint classes -- a class that calls the endpoint method using the http verb -- a class that calls the endpoint method using the operationId name -- class(es) to store the request inputs -- builder(s) to set the request input data - -## Nested Class Summary -| Modifier and Type | Class and Description | -| ----------------- | --------------------- | -| static class | [Post](#post)
The class that has a post method to call the endpoint | -| interface | [NumberWithValidationsOperation](#numberwithvalidationsoperation)
The interface that has a numberWithValidations method to call the endpoint | -| static class | [PostRequest](#postrequest)
The request inputs class | -| static class | [PostRequestBuilder](#postrequestbuilder)
A builder for the request input class | - -## Post -public static class Post 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.FakerefsnumberPostRequestBody; -import org.openapijsonschematools.client.components.schemas.NumberWithValidations; -import org.openapijsonschematools.client.RootServerInfo; -import org.openapijsonschematools.client.servers.RootServer0; -import org.openapijsonschematools.client.servers.RootServer1; -import org.openapijsonschematools.client.servers.RootServer2; -import org.openapijsonschematools.client.paths.fakerefsnumber.post.responses.FakerefsnumberPostCode200Response; -import org.openapijsonschematools.client.servers.RootServerInfo; -import org.openapijsonschematools.client.paths.fakerefsnumber.FakerefsnumberPost; -import org.openapijsonschematools.client.paths.fakerefsnumber.post.FakerefsnumberPostResponses; - -import java.io.IOException; -import java.util.Arrays; -import java.util.List; -import java.util.Map; -import java.util.AbstractMap; - -// if you want to use a server that is not SERVER_0 pass it in here and change the ServerIndex input below -ApiConfiguration.ServerInfo serverInfo = new ApiConfiguration.ServerInfoBuilder() - .rootServerInfo( - new RootServerInfo.RootServerInfoBuilder() - .rootServer0(new RootServer0()) - .build() - ) - .build(); -ApiConfiguration.ServerIndexInfo serverIndexInfo = new ApiConfiguration.ServerIndexInfoBuilder() - .rootServerInfoServerIndex(RootServerInfo.ServerIndex.SERVER_0) - .build(); -Duration timeout = Duration.ofSeconds(1L); -Map> defaultHeaders = Map.of("User-Agent", List.of("OpenAPI-JSON-Schema-Generator/1.0.0/java")); -ApiConfiguration apiConfiguration = new ApiConfiguration( - serverInfo - serverIndexInfo, - timeout, - defaultHeaders -); -SchemaConfiguration schemaConfiguration = new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().build()); -FakerefsnumberPost.Post apiClient = new FakerefsnumberPost.Post(apiConfiguration, schemaConfiguration); - - -var request = new FakerefsnumberPost.PostRequestBuilder().build(); - -FakerefsnumberPostResponses.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; -} -FakerefsnumberPostResponses.EndpointFakerefsnumberPostCode200Response castResponse = (FakerefsnumberPostResponses.EndpointFakerefsnumberPostCode200Response) response; -FakerefsnumberPostCode200Response.ApplicationjsonResponseBody deserializedBody = (FakerefsnumberPostCode200Response.ApplicationjsonResponseBody) castResponse.body; -// handle deserialized body here -``` -### Constructor Summary -| Constructor and Description | -| --------------------------- | -| Post(ApiConfiguration apiConfiguration, SchemaConfiguration schemaConfiguration)
Creates an instance | - -### Method Summary -| Modifier and Type | Method and Description | -| ----------------- | ---------------------- | -| [FakerefsnumberPostResponses.EndpointResponse](../../paths/fakerefsnumber/post/FakerefsnumberPostResponses.md#endpointresponse) | post([PostRequest](#postrequest) request) | - -## NumberWithValidationsOperation -public interface NumberWithValidationsOperation
- -an interface that allows one to call the endpoint using a method named numberWithValidations by the operationId - -### Method Summary -| Modifier and Type | Method and Description | -| ----------------- | ---------------------- | -| [FakerefsnumberPostResponses.EndpointResponse](../../paths/fakerefsnumber/post/FakerefsnumberPostResponses.md#endpointresponse) | numberWithValidations([PostRequest](#postrequest) request) | - -## PostRequest -public static class PostRequest
- -a class that stores the final request inputs - -### Field Summary -| Modifier and Type | Field and Description | -| ----------------- | --------------------- | -| [FakerefsnumberPostRequestBody.@Nullable SealedRequestBody](../../paths/fakerefsnumber/post/FakerefsnumberPostRequestBody.md#sealedrequestbody) | requestBody
optional | -| [RootServerInfo.@Nullable ServerIndex](../../RootServerInfo.md#serverindex) | serverIndex
optional. Note: this will override the value in apiConfiguration | -| @Nullable Duration | timeout
optional. Note: this will override the value in apiConfiguration | - -## PostRequestBuilder -public static class PostRequestBuilder
- -a builder for request inputs - -### Constructor Summary -| Constructor and Description | -| --------------------------- | -| PostRequestBuilder()
Creates a builder that contains null for all parameters | - -### Method Summary -| Modifier and Type | Method and Description | -| ----------------- | ---------------------- | -| [PostRequest](#postrequest) | build()
Returns the request input used to call an endpoint method | -| [PostRequestBuilder](#postrequestbuilder) | requestBody([FakerefsnumberPostRequestBody.SealedRequestBody](../../paths/fakerefsnumber/post/FakerefsnumberPostRequestBody.md#sealedrequestbody) requestBody)
sets the optional property | -| [PostRequestBuilder](#postrequestbuilder) | serverIndex([RootServerInfo.ServerIndex](../../RootServerInfo.md#serverindex) serverIndex)
sets the optional property. Note: this will override the value in apiConfiguration | -| [PostRequestBuilder](#postrequestbuilder) | timeout(Duration timeout)
sets the optional property. Note: this will override the value in apiConfiguration | - -[[Back to top]](#top) [[Back to README]](../../../README.md) diff --git a/samples/client/petstore/kotlin/docs/paths/fakerefsnumber/post/FakerefsnumberPostRequestBody.md b/samples/client/petstore/kotlin/docs/paths/fakerefsnumber/post/FakerefsnumberPostRequestBody.md deleted file mode 100644 index ab2bbbc531e..00000000000 --- a/samples/client/petstore/kotlin/docs/paths/fakerefsnumber/post/FakerefsnumberPostRequestBody.md +++ /dev/null @@ -1,90 +0,0 @@ -# FakerefsnumberPostRequestBody - -public class FakerefsnumberPostRequestBody - -A class that contains necessary nested request body classes -- SealedMediaType, a sealed interface which contains all the schema/encoding info for each contentType -- records which implement SealedMediaType, the concrete media types -- a class that extends RequestBodySerializer and is used to serialize input SealedRequestBody instances -- SealedRequestBody, a sealed interface which contains all the contentType/schema input types -- records which implement SealedRequestBody, the concrete request body types - -## Nested Class Summary -| Modifier and Type | Class and Description | -| ----------------- | --------------------- | -| sealed interface | [FakerefsnumberPostRequestBody.SealedMediaType](#sealedmediatype)
media type sealed interface | -| record | [FakerefsnumberPostRequestBody.ApplicationjsonMediaType](#applicationjsonmediatype)
record storing schema + encoding for a specific contentType | -| static class | [FakerefsnumberPostRequestBody.FakerefsnumberPostRequestBody1](#fakerefsnumberpostrequestbody1)
class that serializes request bodies | -| sealed interface | [FakerefsnumberPostRequestBody.SealedRequestBody](#sealedrequestbody)
request body sealed interface | -| record | [FakerefsnumberPostRequestBody.ApplicationjsonRequestBody](#applicationjsonrequestbody)
implements sealed interface to store request body input | - -## SealedMediaType -public sealed interface SealedMediaType
-permits
-[ApplicationjsonMediaType](#applicationjsonmediatype) - -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), Nothing?> - -class storing schema info for a specific contentType - -### Constructor Summary -| Constructor and Description | -| --------------------------- | -| ApplicationjsonMediaType()
Creates an instance | - -### 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 | -| Nothing? | encoding()
the encoding info | - -## FakerefsnumberPostRequestBody1 -public static class FakerefsnumberPostRequestBody1
- -a class that serializes SealedRequestBody request bodies - -### Constructor Summary -| Constructor and Description | -| --------------------------- | -| FakerefsnumberPostRequestBody1()
Creates an instance | - -### Field Summary -| Modifier and Type | Field and Description | -| ----------------- | --------------------- | -| boolean | required = false
whether the request body is required | -| 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 | -| ----------------- | ---------------------- | -| SerializedRequestBody | serialize([SealedRequestBody](#sealedrequestbody) requestBody)
called by endpoint when creating request body bytes | - -## SealedRequestBody -public sealed interface SealedRequestBody
-permits
-[ApplicationjsonRequestBody](#applicationjsonrequestbody) - -sealed interface that stores request contentType + validated schema data - -## ApplicationjsonRequestBody -public record ApplicationjsonRequestBody
-implements [SealedRequestBody](#sealedrequestbody),
-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 | - -### 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 | diff --git a/samples/client/petstore/kotlin/docs/paths/fakerefsnumber/post/FakerefsnumberPostResponses.md b/samples/client/petstore/kotlin/docs/paths/fakerefsnumber/post/FakerefsnumberPostResponses.md deleted file mode 100644 index 3f5ac86f022..00000000000 --- a/samples/client/petstore/kotlin/docs/paths/fakerefsnumber/post/FakerefsnumberPostResponses.md +++ /dev/null @@ -1,29 +0,0 @@ -# FakerefsnumberPostResponses - -public class FakerefsnumberPostResponses - -A class that contains necessary responses classes -- a sealed interface, EndpointResponse, that stores endpoint responses -- records for each endpoint response - -## Nested Class Summary -| Modifier and Type | Class and Description | -| ----------------- | --------------------- | -| sealed interface | [EndpointResponse](#endpointresponse)
stores the endpoint responses | -| record | [EndpointFakerefsnumberPostCode200Response](#endpointfakerefsnumberpostcode200response)
the response for 200 | - -## EndpointResponse -public sealed interface EndpointResponse permits
-[EndpointFakerefsnumberPostCode200Response](#endpointfakerefsnumberpostcode200response) - -a sealed interface that stores endpoint responses - -## EndpointFakerefsnumberPostCode200Response -public record EndpointFakerefsnumberPostCode200Response( - HttpResponse response, - [FakerefsnumberPostCode200Response.SealedResponseBody](../../../paths/fakerefsnumber/post/responses/FakerefsnumberPostCode200Response.md#sealedresponsebody) body, - Nothing? headers -) implements EndpointResponse, ApiResponse
- -a class that stores an endpoint response - diff --git a/samples/client/petstore/kotlin/docs/paths/fakerefsnumber/post/requestbody/content/applicationjson/ApplicationjsonSchema.md b/samples/client/petstore/kotlin/docs/paths/fakerefsnumber/post/requestbody/content/applicationjson/ApplicationjsonSchema.md deleted file mode 100644 index a6a485e5657..00000000000 --- a/samples/client/petstore/kotlin/docs/paths/fakerefsnumber/post/requestbody/content/applicationjson/ApplicationjsonSchema.md +++ /dev/null @@ -1,19 +0,0 @@ -# ApplicationjsonSchema -public class ApplicationjsonSchema
-extends [NumberWithValidations1](../../../../../../components/schemas/NumberWithValidations.md#numberwithvalidations) - -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 - -## Nested Class Summary -| Modifier and Type | Class and Description | -| ----------------- | ---------------------- | -| static class | [ApplicationjsonSchema.ApplicationjsonSchema1](#applicationjsonschema1)
schema class | - -## ApplicationjsonSchema1 -public static class ApplicationjsonSchema1
-extends [NumberWithValidations.NumberWithValidations1](../../../../../../components/schemas/NumberWithValidations.md#numberwithvalidations1) - -A schema class that validates payloads diff --git a/samples/client/petstore/kotlin/docs/paths/fakerefsnumber/post/responses/FakerefsnumberPostCode200Response.md b/samples/client/petstore/kotlin/docs/paths/fakerefsnumber/post/responses/FakerefsnumberPostCode200Response.md deleted file mode 100644 index e51d59b9439..00000000000 --- a/samples/client/petstore/kotlin/docs/paths/fakerefsnumber/post/responses/FakerefsnumberPostCode200Response.md +++ /dev/null @@ -1,87 +0,0 @@ -# FakerefsnumberPostCode200Response - -public class FakerefsnumberPostCode200Response - -A class that contains necessary nested response classes -- SealedMediaType, a sealed interface which contains all the schema/encoding info for each contentType -- records which implement SealedMediaType, the concrete media types -- SealedResponseBody, a sealed interface which contains all the contentType/schema types -- records which implement SealedResponseBody, the concrete response body types -- a class that extends ResponseDeserializer and is used to deserialize responses - -## Nested Class Summary -| Modifier and Type | Class and Description | -| ----------------- | --------------------- | -| sealed interface | [FakerefsnumberPostCode200Response.SealedMediaType](#sealedmediatype)
media type sealed interface | -| record | [FakerefsnumberPostCode200Response.ApplicationjsonMediaType](#applicationjsonmediatype)
record storing schema + encoding for a specific contentType | -| sealed interface | [FakerefsnumberPostCode200Response.SealedResponseBody](#sealedresponsebody)
response body sealed interface | -| record | [FakerefsnumberPostCode200Response.ApplicationjsonResponseBody](#applicationjsonresponsebody)
implements sealed interface to store response body | -| static class | [FakerefsnumberPostCode200Response.FakerefsnumberPostCode200Response1](#fakerefsnumberpostcode200response1)
class that deserializes responses | - -## SealedMediaType -public sealed interface SealedMediaType
-permits
-[ApplicationjsonMediaType](#applicationjsonmediatype) - -sealed interface that stores schema and encoding info - -## ApplicationjsonMediaType -public record ApplicationjsonMediaType
-implements [SealedMediaType](#sealedmediatype), MediaType<[ApplicationjsonSchema.ApplicationjsonSchema1](../../../../paths/fakerefsnumber/post/responses/code200response/content/applicationjson/ApplicationjsonSchema.md#applicationjsonschema1), Nothing?> - -class storing schema info for a specific contentType - -### Constructor Summary -| Constructor and Description | -| --------------------------- | -| ApplicationjsonMediaType()
Creates an instance | - -### Method Summary -| Modifier and Type | Method and Description | -| ----------------- | ---------------------- | -| [ApplicationjsonSchema.ApplicationjsonSchema1](../../../../paths/fakerefsnumber/post/responses/code200response/content/applicationjson/ApplicationjsonSchema.md#applicationjsonschema1) | schema()
the schema for this MediaType | -| Nothing? | encoding()
the encoding info | - -## SealedResponseBody -public sealed interface SealedResponseBody
-permits
-[ApplicationjsonResponseBody](#applicationjsonresponsebody) - -sealed interface that stores response body - -## ApplicationjsonResponseBody -public record ApplicationjsonResponseBody
-implements [SealedResponseBody](#sealedresponsebody) - -A record class to store response body for contentType="application/json" - -### Constructor Summary -| Constructor and Description | -| --------------------------- | -| ApplicationjsonResponseBody(ApplicationjsonSchema.[NumberWithValidations1Boxed](../../../../components/schemas/NumberWithValidations.md#numberwithvalidations1boxed) body)
Creates an instance | - -### Method Summary -| Modifier and Type | Method and Description | -| ----------------- | ---------------------- | -| ApplicationjsonSchema.[NumberWithValidations1Boxed](../../../../components/schemas/NumberWithValidations.md#numberwithvalidations1boxed) | body()
returns the body passed in in the constructor | - -## FakerefsnumberPostCode200Response1 -public static class FakerefsnumberPostCode200Response1
-extends ResponseDeserializer<[SealedResponseBody](#sealedresponsebody), Nothing?, [SealedMediaType](#sealedmediatype)> - -a class that deserializes responses - -### Constructor Summary -| Constructor and Description | -| --------------------------- | -| FakerefsnumberPostCode200Response1()
Creates an instance | - -### Field Summary -| Modifier and Type | Field and Description | -| ----------------- | --------------------- | -| 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 | -| ----------------- | ---------------------- | -| ApiResponse<[SealedResponseBody](#sealedresponsebody), Nothing?> | deserialize(HttpResponse response, SchemaConfiguration configuration)
called by endpoint when deserialize responses | diff --git a/samples/client/petstore/kotlin/docs/paths/fakerefsnumber/post/responses/code200response/content/applicationjson/ApplicationjsonSchema.md b/samples/client/petstore/kotlin/docs/paths/fakerefsnumber/post/responses/code200response/content/applicationjson/ApplicationjsonSchema.md deleted file mode 100644 index a903474b2ee..00000000000 --- a/samples/client/petstore/kotlin/docs/paths/fakerefsnumber/post/responses/code200response/content/applicationjson/ApplicationjsonSchema.md +++ /dev/null @@ -1,19 +0,0 @@ -# ApplicationjsonSchema -public class ApplicationjsonSchema
-extends [NumberWithValidations1](../../../../../../../components/schemas/NumberWithValidations.md#numberwithvalidations) - -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 - -## Nested Class Summary -| Modifier and Type | Class and Description | -| ----------------- | ---------------------- | -| static class | [ApplicationjsonSchema.ApplicationjsonSchema1](#applicationjsonschema1)
schema class | - -## ApplicationjsonSchema1 -public static class ApplicationjsonSchema1
-extends [NumberWithValidations.NumberWithValidations1](../../../../../../../components/schemas/NumberWithValidations.md#numberwithvalidations1) - -A schema class that validates payloads diff --git a/samples/client/petstore/kotlin/docs/paths/fakerefsobjectmodelwithrefprops/FakerefsobjectmodelwithrefpropsPost.md b/samples/client/petstore/kotlin/docs/paths/fakerefsobjectmodelwithrefprops/FakerefsobjectmodelwithrefpropsPost.md deleted file mode 100644 index 0b6534762de..00000000000 --- a/samples/client/petstore/kotlin/docs/paths/fakerefsobjectmodelwithrefprops/FakerefsobjectmodelwithrefpropsPost.md +++ /dev/null @@ -1,148 +0,0 @@ -# FakerefsobjectmodelwithrefpropsPost - -public class FakerefsobjectmodelwithrefpropsPost - -A class that contains necessary endpoint classes -- a class that calls the endpoint method using the http verb -- a class that calls the endpoint method using the operationId name -- class(es) to store the request inputs -- builder(s) to set the request input data - -## Nested Class Summary -| Modifier and Type | Class and Description | -| ----------------- | --------------------- | -| static class | [Post](#post)
The class that has a post method to call the endpoint | -| interface | [ObjectModelWithRefPropsOperation](#objectmodelwithrefpropsoperation)
The interface that has a objectModelWithRefProps method to call the endpoint | -| static class | [PostRequest](#postrequest)
The request inputs class | -| static class | [PostRequestBuilder](#postrequestbuilder)
A builder for the request input class | - -## Post -public static class Post 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.FakerefsobjectmodelwithrefpropsPostRequestBody; -import org.openapijsonschematools.client.components.schemas.ObjectModelWithRefProps; -import org.openapijsonschematools.client.RootServerInfo; -import org.openapijsonschematools.client.servers.RootServer0; -import org.openapijsonschematools.client.servers.RootServer1; -import org.openapijsonschematools.client.servers.RootServer2; -import org.openapijsonschematools.client.paths.fakerefsobjectmodelwithrefprops.post.responses.FakerefsobjectmodelwithrefpropsPostCode200Response; -import org.openapijsonschematools.client.servers.RootServerInfo; -import org.openapijsonschematools.client.paths.fakerefsobjectmodelwithrefprops.FakerefsobjectmodelwithrefpropsPost; -import org.openapijsonschematools.client.paths.fakerefsobjectmodelwithrefprops.post.FakerefsobjectmodelwithrefpropsPostResponses; - -import java.io.IOException; -import java.util.Arrays; -import java.util.List; -import java.util.Map; -import java.util.AbstractMap; - -// if you want to use a server that is not SERVER_0 pass it in here and change the ServerIndex input below -ApiConfiguration.ServerInfo serverInfo = new ApiConfiguration.ServerInfoBuilder() - .rootServerInfo( - new RootServerInfo.RootServerInfoBuilder() - .rootServer0(new RootServer0()) - .build() - ) - .build(); -ApiConfiguration.ServerIndexInfo serverIndexInfo = new ApiConfiguration.ServerIndexInfoBuilder() - .rootServerInfoServerIndex(RootServerInfo.ServerIndex.SERVER_0) - .build(); -Duration timeout = Duration.ofSeconds(1L); -Map> defaultHeaders = Map.of("User-Agent", List.of("OpenAPI-JSON-Schema-Generator/1.0.0/java")); -ApiConfiguration apiConfiguration = new ApiConfiguration( - serverInfo - serverIndexInfo, - timeout, - defaultHeaders -); -SchemaConfiguration schemaConfiguration = new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().build()); -FakerefsobjectmodelwithrefpropsPost.Post apiClient = new FakerefsobjectmodelwithrefpropsPost.Post(apiConfiguration, schemaConfiguration); - - -var request = new FakerefsobjectmodelwithrefpropsPost.PostRequestBuilder().build(); - -FakerefsobjectmodelwithrefpropsPostResponses.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; -} -FakerefsobjectmodelwithrefpropsPostResponses.EndpointFakerefsobjectmodelwithrefpropsPostCode200Response castResponse = (FakerefsobjectmodelwithrefpropsPostResponses.EndpointFakerefsobjectmodelwithrefpropsPostCode200Response) response; -FakerefsobjectmodelwithrefpropsPostCode200Response.ApplicationjsonResponseBody deserializedBody = (FakerefsobjectmodelwithrefpropsPostCode200Response.ApplicationjsonResponseBody) castResponse.body; -// handle deserialized body here -``` -### Constructor Summary -| Constructor and Description | -| --------------------------- | -| Post(ApiConfiguration apiConfiguration, SchemaConfiguration schemaConfiguration)
Creates an instance | - -### Method Summary -| Modifier and Type | Method and Description | -| ----------------- | ---------------------- | -| [FakerefsobjectmodelwithrefpropsPostResponses.EndpointResponse](../../paths/fakerefsobjectmodelwithrefprops/post/FakerefsobjectmodelwithrefpropsPostResponses.md#endpointresponse) | post([PostRequest](#postrequest) request) | - -## ObjectModelWithRefPropsOperation -public interface ObjectModelWithRefPropsOperation
- -an interface that allows one to call the endpoint using a method named objectModelWithRefProps by the operationId - -### Method Summary -| Modifier and Type | Method and Description | -| ----------------- | ---------------------- | -| [FakerefsobjectmodelwithrefpropsPostResponses.EndpointResponse](../../paths/fakerefsobjectmodelwithrefprops/post/FakerefsobjectmodelwithrefpropsPostResponses.md#endpointresponse) | objectModelWithRefProps([PostRequest](#postrequest) request) | - -## PostRequest -public static class PostRequest
- -a class that stores the final request inputs - -### Field Summary -| Modifier and Type | Field and Description | -| ----------------- | --------------------- | -| [FakerefsobjectmodelwithrefpropsPostRequestBody.@Nullable SealedRequestBody](../../paths/fakerefsobjectmodelwithrefprops/post/FakerefsobjectmodelwithrefpropsPostRequestBody.md#sealedrequestbody) | requestBody
optional | -| [RootServerInfo.@Nullable ServerIndex](../../RootServerInfo.md#serverindex) | serverIndex
optional. Note: this will override the value in apiConfiguration | -| @Nullable Duration | timeout
optional. Note: this will override the value in apiConfiguration | - -## PostRequestBuilder -public static class PostRequestBuilder
- -a builder for request inputs - -### Constructor Summary -| Constructor and Description | -| --------------------------- | -| PostRequestBuilder()
Creates a builder that contains null for all parameters | - -### Method Summary -| Modifier and Type | Method and Description | -| ----------------- | ---------------------- | -| [PostRequest](#postrequest) | build()
Returns the request input used to call an endpoint method | -| [PostRequestBuilder](#postrequestbuilder) | requestBody([FakerefsobjectmodelwithrefpropsPostRequestBody.SealedRequestBody](../../paths/fakerefsobjectmodelwithrefprops/post/FakerefsobjectmodelwithrefpropsPostRequestBody.md#sealedrequestbody) requestBody)
sets the optional property | -| [PostRequestBuilder](#postrequestbuilder) | serverIndex([RootServerInfo.ServerIndex](../../RootServerInfo.md#serverindex) serverIndex)
sets the optional property. Note: this will override the value in apiConfiguration | -| [PostRequestBuilder](#postrequestbuilder) | timeout(Duration timeout)
sets the optional property. Note: this will override the value in apiConfiguration | - -[[Back to top]](#top) [[Back to README]](../../../README.md) diff --git a/samples/client/petstore/kotlin/docs/paths/fakerefsobjectmodelwithrefprops/post/FakerefsobjectmodelwithrefpropsPostRequestBody.md b/samples/client/petstore/kotlin/docs/paths/fakerefsobjectmodelwithrefprops/post/FakerefsobjectmodelwithrefpropsPostRequestBody.md deleted file mode 100644 index cd1403df034..00000000000 --- a/samples/client/petstore/kotlin/docs/paths/fakerefsobjectmodelwithrefprops/post/FakerefsobjectmodelwithrefpropsPostRequestBody.md +++ /dev/null @@ -1,90 +0,0 @@ -# FakerefsobjectmodelwithrefpropsPostRequestBody - -public class FakerefsobjectmodelwithrefpropsPostRequestBody - -A class that contains necessary nested request body classes -- SealedMediaType, a sealed interface which contains all the schema/encoding info for each contentType -- records which implement SealedMediaType, the concrete media types -- a class that extends RequestBodySerializer and is used to serialize input SealedRequestBody instances -- SealedRequestBody, a sealed interface which contains all the contentType/schema input types -- records which implement SealedRequestBody, the concrete request body types - -## Nested Class Summary -| Modifier and Type | Class and Description | -| ----------------- | --------------------- | -| sealed interface | [FakerefsobjectmodelwithrefpropsPostRequestBody.SealedMediaType](#sealedmediatype)
media type sealed interface | -| record | [FakerefsobjectmodelwithrefpropsPostRequestBody.ApplicationjsonMediaType](#applicationjsonmediatype)
record storing schema + encoding for a specific contentType | -| static class | [FakerefsobjectmodelwithrefpropsPostRequestBody.FakerefsobjectmodelwithrefpropsPostRequestBody1](#fakerefsobjectmodelwithrefpropspostrequestbody1)
class that serializes request bodies | -| sealed interface | [FakerefsobjectmodelwithrefpropsPostRequestBody.SealedRequestBody](#sealedrequestbody)
request body sealed interface | -| record | [FakerefsobjectmodelwithrefpropsPostRequestBody.ApplicationjsonRequestBody](#applicationjsonrequestbody)
implements sealed interface to store request body input | - -## SealedMediaType -public sealed interface SealedMediaType
-permits
-[ApplicationjsonMediaType](#applicationjsonmediatype) - -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), Nothing?> - -class storing schema info for a specific contentType - -### Constructor Summary -| Constructor and Description | -| --------------------------- | -| ApplicationjsonMediaType()
Creates an instance | - -### 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 | -| Nothing? | encoding()
the encoding info | - -## FakerefsobjectmodelwithrefpropsPostRequestBody1 -public static class FakerefsobjectmodelwithrefpropsPostRequestBody1
- -a class that serializes SealedRequestBody request bodies - -### Constructor Summary -| Constructor and Description | -| --------------------------- | -| FakerefsobjectmodelwithrefpropsPostRequestBody1()
Creates an instance | - -### Field Summary -| Modifier and Type | Field and Description | -| ----------------- | --------------------- | -| boolean | required = false
whether the request body is required | -| 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 | -| ----------------- | ---------------------- | -| SerializedRequestBody | serialize([SealedRequestBody](#sealedrequestbody) requestBody)
called by endpoint when creating request body bytes | - -## SealedRequestBody -public sealed interface SealedRequestBody
-permits
-[ApplicationjsonRequestBody](#applicationjsonrequestbody) - -sealed interface that stores request contentType + validated schema data - -## ApplicationjsonRequestBody -public record ApplicationjsonRequestBody
-implements [SealedRequestBody](#sealedrequestbody),
-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 | - -### 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 | diff --git a/samples/client/petstore/kotlin/docs/paths/fakerefsobjectmodelwithrefprops/post/FakerefsobjectmodelwithrefpropsPostResponses.md b/samples/client/petstore/kotlin/docs/paths/fakerefsobjectmodelwithrefprops/post/FakerefsobjectmodelwithrefpropsPostResponses.md deleted file mode 100644 index 08061091baf..00000000000 --- a/samples/client/petstore/kotlin/docs/paths/fakerefsobjectmodelwithrefprops/post/FakerefsobjectmodelwithrefpropsPostResponses.md +++ /dev/null @@ -1,29 +0,0 @@ -# FakerefsobjectmodelwithrefpropsPostResponses - -public class FakerefsobjectmodelwithrefpropsPostResponses - -A class that contains necessary responses classes -- a sealed interface, EndpointResponse, that stores endpoint responses -- records for each endpoint response - -## Nested Class Summary -| Modifier and Type | Class and Description | -| ----------------- | --------------------- | -| sealed interface | [EndpointResponse](#endpointresponse)
stores the endpoint responses | -| record | [EndpointFakerefsobjectmodelwithrefpropsPostCode200Response](#endpointfakerefsobjectmodelwithrefpropspostcode200response)
the response for 200 | - -## EndpointResponse -public sealed interface EndpointResponse permits
-[EndpointFakerefsobjectmodelwithrefpropsPostCode200Response](#endpointfakerefsobjectmodelwithrefpropspostcode200response) - -a sealed interface that stores endpoint responses - -## EndpointFakerefsobjectmodelwithrefpropsPostCode200Response -public record EndpointFakerefsobjectmodelwithrefpropsPostCode200Response( - HttpResponse response, - [FakerefsobjectmodelwithrefpropsPostCode200Response.SealedResponseBody](../../../paths/fakerefsobjectmodelwithrefprops/post/responses/FakerefsobjectmodelwithrefpropsPostCode200Response.md#sealedresponsebody) body, - Nothing? headers -) implements EndpointResponse, ApiResponse
- -a class that stores an endpoint response - diff --git a/samples/client/petstore/kotlin/docs/paths/fakerefsobjectmodelwithrefprops/post/requestbody/content/applicationjson/ApplicationjsonSchema.md b/samples/client/petstore/kotlin/docs/paths/fakerefsobjectmodelwithrefprops/post/requestbody/content/applicationjson/ApplicationjsonSchema.md deleted file mode 100644 index 0cdc2140e3a..00000000000 --- a/samples/client/petstore/kotlin/docs/paths/fakerefsobjectmodelwithrefprops/post/requestbody/content/applicationjson/ApplicationjsonSchema.md +++ /dev/null @@ -1,19 +0,0 @@ -# ApplicationjsonSchema -public class ApplicationjsonSchema
-extends [ObjectModelWithRefProps1](../../../../../../components/schemas/ObjectModelWithRefProps.md#objectmodelwithrefprops) - -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 - -## Nested Class Summary -| Modifier and Type | Class and Description | -| ----------------- | ---------------------- | -| static class | [ApplicationjsonSchema.ApplicationjsonSchema1](#applicationjsonschema1)
schema class | - -## ApplicationjsonSchema1 -public static class ApplicationjsonSchema1
-extends [ObjectModelWithRefProps.ObjectModelWithRefProps1](../../../../../../components/schemas/ObjectModelWithRefProps.md#objectmodelwithrefprops1) - -A schema class that validates payloads diff --git a/samples/client/petstore/kotlin/docs/paths/fakerefsobjectmodelwithrefprops/post/responses/FakerefsobjectmodelwithrefpropsPostCode200Response.md b/samples/client/petstore/kotlin/docs/paths/fakerefsobjectmodelwithrefprops/post/responses/FakerefsobjectmodelwithrefpropsPostCode200Response.md deleted file mode 100644 index 3ed79b631f0..00000000000 --- a/samples/client/petstore/kotlin/docs/paths/fakerefsobjectmodelwithrefprops/post/responses/FakerefsobjectmodelwithrefpropsPostCode200Response.md +++ /dev/null @@ -1,87 +0,0 @@ -# FakerefsobjectmodelwithrefpropsPostCode200Response - -public class FakerefsobjectmodelwithrefpropsPostCode200Response - -A class that contains necessary nested response classes -- SealedMediaType, a sealed interface which contains all the schema/encoding info for each contentType -- records which implement SealedMediaType, the concrete media types -- SealedResponseBody, a sealed interface which contains all the contentType/schema types -- records which implement SealedResponseBody, the concrete response body types -- a class that extends ResponseDeserializer and is used to deserialize responses - -## Nested Class Summary -| Modifier and Type | Class and Description | -| ----------------- | --------------------- | -| sealed interface | [FakerefsobjectmodelwithrefpropsPostCode200Response.SealedMediaType](#sealedmediatype)
media type sealed interface | -| record | [FakerefsobjectmodelwithrefpropsPostCode200Response.ApplicationjsonMediaType](#applicationjsonmediatype)
record storing schema + encoding for a specific contentType | -| sealed interface | [FakerefsobjectmodelwithrefpropsPostCode200Response.SealedResponseBody](#sealedresponsebody)
response body sealed interface | -| record | [FakerefsobjectmodelwithrefpropsPostCode200Response.ApplicationjsonResponseBody](#applicationjsonresponsebody)
implements sealed interface to store response body | -| static class | [FakerefsobjectmodelwithrefpropsPostCode200Response.FakerefsobjectmodelwithrefpropsPostCode200Response1](#fakerefsobjectmodelwithrefpropspostcode200response1)
class that deserializes responses | - -## SealedMediaType -public sealed interface SealedMediaType
-permits
-[ApplicationjsonMediaType](#applicationjsonmediatype) - -sealed interface that stores schema and encoding info - -## ApplicationjsonMediaType -public record ApplicationjsonMediaType
-implements [SealedMediaType](#sealedmediatype), MediaType<[ApplicationjsonSchema.ApplicationjsonSchema1](../../../../paths/fakerefsobjectmodelwithrefprops/post/responses/code200response/content/applicationjson/ApplicationjsonSchema.md#applicationjsonschema1), Nothing?> - -class storing schema info for a specific contentType - -### Constructor Summary -| Constructor and Description | -| --------------------------- | -| ApplicationjsonMediaType()
Creates an instance | - -### Method Summary -| Modifier and Type | Method and Description | -| ----------------- | ---------------------- | -| [ApplicationjsonSchema.ApplicationjsonSchema1](../../../../paths/fakerefsobjectmodelwithrefprops/post/responses/code200response/content/applicationjson/ApplicationjsonSchema.md#applicationjsonschema1) | schema()
the schema for this MediaType | -| Nothing? | encoding()
the encoding info | - -## SealedResponseBody -public sealed interface SealedResponseBody
-permits
-[ApplicationjsonResponseBody](#applicationjsonresponsebody) - -sealed interface that stores response body - -## ApplicationjsonResponseBody -public record ApplicationjsonResponseBody
-implements [SealedResponseBody](#sealedresponsebody) - -A record class to store response body for contentType="application/json" - -### Constructor Summary -| Constructor and Description | -| --------------------------- | -| ApplicationjsonResponseBody(ApplicationjsonSchema.[ObjectModelWithRefProps1Boxed](../../../../components/schemas/ObjectModelWithRefProps.md#objectmodelwithrefprops1boxed) body)
Creates an instance | - -### Method Summary -| Modifier and Type | Method and Description | -| ----------------- | ---------------------- | -| ApplicationjsonSchema.[ObjectModelWithRefProps1Boxed](../../../../components/schemas/ObjectModelWithRefProps.md#objectmodelwithrefprops1boxed) | body()
returns the body passed in in the constructor | - -## FakerefsobjectmodelwithrefpropsPostCode200Response1 -public static class FakerefsobjectmodelwithrefpropsPostCode200Response1
-extends ResponseDeserializer<[SealedResponseBody](#sealedresponsebody), Nothing?, [SealedMediaType](#sealedmediatype)> - -a class that deserializes responses - -### Constructor Summary -| Constructor and Description | -| --------------------------- | -| FakerefsobjectmodelwithrefpropsPostCode200Response1()
Creates an instance | - -### Field Summary -| Modifier and Type | Field and Description | -| ----------------- | --------------------- | -| 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 | -| ----------------- | ---------------------- | -| ApiResponse<[SealedResponseBody](#sealedresponsebody), Nothing?> | deserialize(HttpResponse response, SchemaConfiguration configuration)
called by endpoint when deserialize responses | diff --git a/samples/client/petstore/kotlin/docs/paths/fakerefsobjectmodelwithrefprops/post/responses/code200response/content/applicationjson/ApplicationjsonSchema.md b/samples/client/petstore/kotlin/docs/paths/fakerefsobjectmodelwithrefprops/post/responses/code200response/content/applicationjson/ApplicationjsonSchema.md deleted file mode 100644 index 495e07e6094..00000000000 --- a/samples/client/petstore/kotlin/docs/paths/fakerefsobjectmodelwithrefprops/post/responses/code200response/content/applicationjson/ApplicationjsonSchema.md +++ /dev/null @@ -1,19 +0,0 @@ -# ApplicationjsonSchema -public class ApplicationjsonSchema
-extends [ObjectModelWithRefProps1](../../../../../../../components/schemas/ObjectModelWithRefProps.md#objectmodelwithrefprops) - -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 - -## Nested Class Summary -| Modifier and Type | Class and Description | -| ----------------- | ---------------------- | -| static class | [ApplicationjsonSchema.ApplicationjsonSchema1](#applicationjsonschema1)
schema class | - -## ApplicationjsonSchema1 -public static class ApplicationjsonSchema1
-extends [ObjectModelWithRefProps.ObjectModelWithRefProps1](../../../../../../../components/schemas/ObjectModelWithRefProps.md#objectmodelwithrefprops1) - -A schema class that validates payloads diff --git a/samples/client/petstore/kotlin/docs/paths/fakerefsstring/FakerefsstringPost.md b/samples/client/petstore/kotlin/docs/paths/fakerefsstring/FakerefsstringPost.md deleted file mode 100644 index 0a83e8e30bd..00000000000 --- a/samples/client/petstore/kotlin/docs/paths/fakerefsstring/FakerefsstringPost.md +++ /dev/null @@ -1,148 +0,0 @@ -# FakerefsstringPost - -public class FakerefsstringPost - -A class that contains necessary endpoint classes -- a class that calls the endpoint method using the http verb -- a class that calls the endpoint method using the operationId name -- class(es) to store the request inputs -- builder(s) to set the request input data - -## Nested Class Summary -| Modifier and Type | Class and Description | -| ----------------- | --------------------- | -| static class | [Post](#post)
The class that has a post method to call the endpoint | -| interface | [ModelStringOperation](#modelstringoperation)
The interface that has a modelString method to call the endpoint | -| static class | [PostRequest](#postrequest)
The request inputs class | -| static class | [PostRequestBuilder](#postrequestbuilder)
A builder for the request input class | - -## Post -public static class Post 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.FakerefsstringPostRequestBody; -import org.openapijsonschematools.client.components.schemas.StringSchema; -import org.openapijsonschematools.client.RootServerInfo; -import org.openapijsonschematools.client.servers.RootServer0; -import org.openapijsonschematools.client.servers.RootServer1; -import org.openapijsonschematools.client.servers.RootServer2; -import org.openapijsonschematools.client.paths.fakerefsstring.post.responses.FakerefsstringPostCode200Response; -import org.openapijsonschematools.client.servers.RootServerInfo; -import org.openapijsonschematools.client.paths.fakerefsstring.FakerefsstringPost; -import org.openapijsonschematools.client.paths.fakerefsstring.post.FakerefsstringPostResponses; - -import java.io.IOException; -import java.util.Arrays; -import java.util.List; -import java.util.Map; -import java.util.AbstractMap; - -// if you want to use a server that is not SERVER_0 pass it in here and change the ServerIndex input below -ApiConfiguration.ServerInfo serverInfo = new ApiConfiguration.ServerInfoBuilder() - .rootServerInfo( - new RootServerInfo.RootServerInfoBuilder() - .rootServer0(new RootServer0()) - .build() - ) - .build(); -ApiConfiguration.ServerIndexInfo serverIndexInfo = new ApiConfiguration.ServerIndexInfoBuilder() - .rootServerInfoServerIndex(RootServerInfo.ServerIndex.SERVER_0) - .build(); -Duration timeout = Duration.ofSeconds(1L); -Map> defaultHeaders = Map.of("User-Agent", List.of("OpenAPI-JSON-Schema-Generator/1.0.0/java")); -ApiConfiguration apiConfiguration = new ApiConfiguration( - serverInfo - serverIndexInfo, - timeout, - defaultHeaders -); -SchemaConfiguration schemaConfiguration = new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().build()); -FakerefsstringPost.Post apiClient = new FakerefsstringPost.Post(apiConfiguration, schemaConfiguration); - - -var request = new FakerefsstringPost.PostRequestBuilder().build(); - -FakerefsstringPostResponses.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; -} -FakerefsstringPostResponses.EndpointFakerefsstringPostCode200Response castResponse = (FakerefsstringPostResponses.EndpointFakerefsstringPostCode200Response) response; -FakerefsstringPostCode200Response.ApplicationjsonResponseBody deserializedBody = (FakerefsstringPostCode200Response.ApplicationjsonResponseBody) castResponse.body; -// handle deserialized body here -``` -### Constructor Summary -| Constructor and Description | -| --------------------------- | -| Post(ApiConfiguration apiConfiguration, SchemaConfiguration schemaConfiguration)
Creates an instance | - -### Method Summary -| Modifier and Type | Method and Description | -| ----------------- | ---------------------- | -| [FakerefsstringPostResponses.EndpointResponse](../../paths/fakerefsstring/post/FakerefsstringPostResponses.md#endpointresponse) | post([PostRequest](#postrequest) request) | - -## ModelStringOperation -public interface ModelStringOperation
- -an interface that allows one to call the endpoint using a method named modelString by the operationId - -### Method Summary -| Modifier and Type | Method and Description | -| ----------------- | ---------------------- | -| [FakerefsstringPostResponses.EndpointResponse](../../paths/fakerefsstring/post/FakerefsstringPostResponses.md#endpointresponse) | modelString([PostRequest](#postrequest) request) | - -## PostRequest -public static class PostRequest
- -a class that stores the final request inputs - -### Field Summary -| Modifier and Type | Field and Description | -| ----------------- | --------------------- | -| [FakerefsstringPostRequestBody.@Nullable SealedRequestBody](../../paths/fakerefsstring/post/FakerefsstringPostRequestBody.md#sealedrequestbody) | requestBody
optional | -| [RootServerInfo.@Nullable ServerIndex](../../RootServerInfo.md#serverindex) | serverIndex
optional. Note: this will override the value in apiConfiguration | -| @Nullable Duration | timeout
optional. Note: this will override the value in apiConfiguration | - -## PostRequestBuilder -public static class PostRequestBuilder
- -a builder for request inputs - -### Constructor Summary -| Constructor and Description | -| --------------------------- | -| PostRequestBuilder()
Creates a builder that contains null for all parameters | - -### Method Summary -| Modifier and Type | Method and Description | -| ----------------- | ---------------------- | -| [PostRequest](#postrequest) | build()
Returns the request input used to call an endpoint method | -| [PostRequestBuilder](#postrequestbuilder) | requestBody([FakerefsstringPostRequestBody.SealedRequestBody](../../paths/fakerefsstring/post/FakerefsstringPostRequestBody.md#sealedrequestbody) requestBody)
sets the optional property | -| [PostRequestBuilder](#postrequestbuilder) | serverIndex([RootServerInfo.ServerIndex](../../RootServerInfo.md#serverindex) serverIndex)
sets the optional property. Note: this will override the value in apiConfiguration | -| [PostRequestBuilder](#postrequestbuilder) | timeout(Duration timeout)
sets the optional property. Note: this will override the value in apiConfiguration | - -[[Back to top]](#top) [[Back to README]](../../../README.md) diff --git a/samples/client/petstore/kotlin/docs/paths/fakerefsstring/post/FakerefsstringPostRequestBody.md b/samples/client/petstore/kotlin/docs/paths/fakerefsstring/post/FakerefsstringPostRequestBody.md deleted file mode 100644 index 98df41e8065..00000000000 --- a/samples/client/petstore/kotlin/docs/paths/fakerefsstring/post/FakerefsstringPostRequestBody.md +++ /dev/null @@ -1,90 +0,0 @@ -# FakerefsstringPostRequestBody - -public class FakerefsstringPostRequestBody - -A class that contains necessary nested request body classes -- SealedMediaType, a sealed interface which contains all the schema/encoding info for each contentType -- records which implement SealedMediaType, the concrete media types -- a class that extends RequestBodySerializer and is used to serialize input SealedRequestBody instances -- SealedRequestBody, a sealed interface which contains all the contentType/schema input types -- records which implement SealedRequestBody, the concrete request body types - -## Nested Class Summary -| Modifier and Type | Class and Description | -| ----------------- | --------------------- | -| sealed interface | [FakerefsstringPostRequestBody.SealedMediaType](#sealedmediatype)
media type sealed interface | -| record | [FakerefsstringPostRequestBody.ApplicationjsonMediaType](#applicationjsonmediatype)
record storing schema + encoding for a specific contentType | -| static class | [FakerefsstringPostRequestBody.FakerefsstringPostRequestBody1](#fakerefsstringpostrequestbody1)
class that serializes request bodies | -| sealed interface | [FakerefsstringPostRequestBody.SealedRequestBody](#sealedrequestbody)
request body sealed interface | -| record | [FakerefsstringPostRequestBody.ApplicationjsonRequestBody](#applicationjsonrequestbody)
implements sealed interface to store request body input | - -## SealedMediaType -public sealed interface SealedMediaType
-permits
-[ApplicationjsonMediaType](#applicationjsonmediatype) - -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), Nothing?> - -class storing schema info for a specific contentType - -### Constructor Summary -| Constructor and Description | -| --------------------------- | -| ApplicationjsonMediaType()
Creates an instance | - -### 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 | -| Nothing? | encoding()
the encoding info | - -## FakerefsstringPostRequestBody1 -public static class FakerefsstringPostRequestBody1
- -a class that serializes SealedRequestBody request bodies - -### Constructor Summary -| Constructor and Description | -| --------------------------- | -| FakerefsstringPostRequestBody1()
Creates an instance | - -### Field Summary -| Modifier and Type | Field and Description | -| ----------------- | --------------------- | -| boolean | required = false
whether the request body is required | -| 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 | -| ----------------- | ---------------------- | -| SerializedRequestBody | serialize([SealedRequestBody](#sealedrequestbody) requestBody)
called by endpoint when creating request body bytes | - -## SealedRequestBody -public sealed interface SealedRequestBody
-permits
-[ApplicationjsonRequestBody](#applicationjsonrequestbody) - -sealed interface that stores request contentType + validated schema data - -## ApplicationjsonRequestBody -public record ApplicationjsonRequestBody
-implements [SealedRequestBody](#sealedrequestbody),
-GenericRequestBody
- -A record class to store request body input for contentType="application/json" - -### Constructor Summary -| Constructor and Description | -| --------------------------- | -| ApplicationjsonRequestBody(ApplicationjsonSchema.StringJsonSchema1Boxed body)
Creates an instance | - -### Method Summary -| Modifier and Type | Method and Description | -| ----------------- | ---------------------- | -| String | contentType()
always returns "application/json" | -| ApplicationjsonSchema.StringJsonSchema1Boxed | body()
returns the body passed in in the constructor | diff --git a/samples/client/petstore/kotlin/docs/paths/fakerefsstring/post/FakerefsstringPostResponses.md b/samples/client/petstore/kotlin/docs/paths/fakerefsstring/post/FakerefsstringPostResponses.md deleted file mode 100644 index cf90e75c73b..00000000000 --- a/samples/client/petstore/kotlin/docs/paths/fakerefsstring/post/FakerefsstringPostResponses.md +++ /dev/null @@ -1,29 +0,0 @@ -# FakerefsstringPostResponses - -public class FakerefsstringPostResponses - -A class that contains necessary responses classes -- a sealed interface, EndpointResponse, that stores endpoint responses -- records for each endpoint response - -## Nested Class Summary -| Modifier and Type | Class and Description | -| ----------------- | --------------------- | -| sealed interface | [EndpointResponse](#endpointresponse)
stores the endpoint responses | -| record | [EndpointFakerefsstringPostCode200Response](#endpointfakerefsstringpostcode200response)
the response for 200 | - -## EndpointResponse -public sealed interface EndpointResponse permits
-[EndpointFakerefsstringPostCode200Response](#endpointfakerefsstringpostcode200response) - -a sealed interface that stores endpoint responses - -## EndpointFakerefsstringPostCode200Response -public record EndpointFakerefsstringPostCode200Response( - HttpResponse response, - [FakerefsstringPostCode200Response.SealedResponseBody](../../../paths/fakerefsstring/post/responses/FakerefsstringPostCode200Response.md#sealedresponsebody) body, - Nothing? headers -) implements EndpointResponse, ApiResponse
- -a class that stores an endpoint response - diff --git a/samples/client/petstore/kotlin/docs/paths/fakerefsstring/post/requestbody/content/applicationjson/ApplicationjsonSchema.md b/samples/client/petstore/kotlin/docs/paths/fakerefsstring/post/requestbody/content/applicationjson/ApplicationjsonSchema.md deleted file mode 100644 index abe4f0713c9..00000000000 --- a/samples/client/petstore/kotlin/docs/paths/fakerefsstring/post/requestbody/content/applicationjson/ApplicationjsonSchema.md +++ /dev/null @@ -1,19 +0,0 @@ -# ApplicationjsonSchema -public class ApplicationjsonSchema
-extends [StringSchema1](../../../../../../components/schemas/StringSchema.md#stringschema) - -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 - -## Nested Class Summary -| Modifier and Type | Class and Description | -| ----------------- | ---------------------- | -| static class | [ApplicationjsonSchema.ApplicationjsonSchema1](#applicationjsonschema1)
schema class | - -## ApplicationjsonSchema1 -public static class ApplicationjsonSchema1
-extends [StringSchema.StringSchema1](../../../../../../components/schemas/StringSchema.md#stringschema1) - -A schema class that validates payloads diff --git a/samples/client/petstore/kotlin/docs/paths/fakerefsstring/post/responses/FakerefsstringPostCode200Response.md b/samples/client/petstore/kotlin/docs/paths/fakerefsstring/post/responses/FakerefsstringPostCode200Response.md deleted file mode 100644 index bea2ebfdb19..00000000000 --- a/samples/client/petstore/kotlin/docs/paths/fakerefsstring/post/responses/FakerefsstringPostCode200Response.md +++ /dev/null @@ -1,87 +0,0 @@ -# FakerefsstringPostCode200Response - -public class FakerefsstringPostCode200Response - -A class that contains necessary nested response classes -- SealedMediaType, a sealed interface which contains all the schema/encoding info for each contentType -- records which implement SealedMediaType, the concrete media types -- SealedResponseBody, a sealed interface which contains all the contentType/schema types -- records which implement SealedResponseBody, the concrete response body types -- a class that extends ResponseDeserializer and is used to deserialize responses - -## Nested Class Summary -| Modifier and Type | Class and Description | -| ----------------- | --------------------- | -| sealed interface | [FakerefsstringPostCode200Response.SealedMediaType](#sealedmediatype)
media type sealed interface | -| record | [FakerefsstringPostCode200Response.ApplicationjsonMediaType](#applicationjsonmediatype)
record storing schema + encoding for a specific contentType | -| sealed interface | [FakerefsstringPostCode200Response.SealedResponseBody](#sealedresponsebody)
response body sealed interface | -| record | [FakerefsstringPostCode200Response.ApplicationjsonResponseBody](#applicationjsonresponsebody)
implements sealed interface to store response body | -| static class | [FakerefsstringPostCode200Response.FakerefsstringPostCode200Response1](#fakerefsstringpostcode200response1)
class that deserializes responses | - -## SealedMediaType -public sealed interface SealedMediaType
-permits
-[ApplicationjsonMediaType](#applicationjsonmediatype) - -sealed interface that stores schema and encoding info - -## ApplicationjsonMediaType -public record ApplicationjsonMediaType
-implements [SealedMediaType](#sealedmediatype), MediaType<[ApplicationjsonSchema.ApplicationjsonSchema1](../../../../paths/fakerefsstring/post/responses/code200response/content/applicationjson/ApplicationjsonSchema.md#applicationjsonschema1), Nothing?> - -class storing schema info for a specific contentType - -### Constructor Summary -| Constructor and Description | -| --------------------------- | -| ApplicationjsonMediaType()
Creates an instance | - -### Method Summary -| Modifier and Type | Method and Description | -| ----------------- | ---------------------- | -| [ApplicationjsonSchema.ApplicationjsonSchema1](../../../../paths/fakerefsstring/post/responses/code200response/content/applicationjson/ApplicationjsonSchema.md#applicationjsonschema1) | schema()
the schema for this MediaType | -| Nothing? | encoding()
the encoding info | - -## SealedResponseBody -public sealed interface SealedResponseBody
-permits
-[ApplicationjsonResponseBody](#applicationjsonresponsebody) - -sealed interface that stores response body - -## ApplicationjsonResponseBody -public record ApplicationjsonResponseBody
-implements [SealedResponseBody](#sealedresponsebody) - -A record class to store response body for contentType="application/json" - -### Constructor Summary -| Constructor and Description | -| --------------------------- | -| ApplicationjsonResponseBody(ApplicationjsonSchema.StringJsonSchema1Boxed body)
Creates an instance | - -### Method Summary -| Modifier and Type | Method and Description | -| ----------------- | ---------------------- | -| ApplicationjsonSchema.StringJsonSchema1Boxed | body()
returns the body passed in in the constructor | - -## FakerefsstringPostCode200Response1 -public static class FakerefsstringPostCode200Response1
-extends ResponseDeserializer<[SealedResponseBody](#sealedresponsebody), Nothing?, [SealedMediaType](#sealedmediatype)> - -a class that deserializes responses - -### Constructor Summary -| Constructor and Description | -| --------------------------- | -| FakerefsstringPostCode200Response1()
Creates an instance | - -### Field Summary -| Modifier and Type | Field and Description | -| ----------------- | --------------------- | -| 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 | -| ----------------- | ---------------------- | -| ApiResponse<[SealedResponseBody](#sealedresponsebody), Nothing?> | deserialize(HttpResponse response, SchemaConfiguration configuration)
called by endpoint when deserialize responses | diff --git a/samples/client/petstore/kotlin/docs/paths/fakerefsstring/post/responses/code200response/content/applicationjson/ApplicationjsonSchema.md b/samples/client/petstore/kotlin/docs/paths/fakerefsstring/post/responses/code200response/content/applicationjson/ApplicationjsonSchema.md deleted file mode 100644 index 8fadd779761..00000000000 --- a/samples/client/petstore/kotlin/docs/paths/fakerefsstring/post/responses/code200response/content/applicationjson/ApplicationjsonSchema.md +++ /dev/null @@ -1,19 +0,0 @@ -# ApplicationjsonSchema -public class ApplicationjsonSchema
-extends [StringSchema1](../../../../../../../components/schemas/StringSchema.md#stringschema) - -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 - -## Nested Class Summary -| Modifier and Type | Class and Description | -| ----------------- | ---------------------- | -| static class | [ApplicationjsonSchema.ApplicationjsonSchema1](#applicationjsonschema1)
schema class | - -## ApplicationjsonSchema1 -public static class ApplicationjsonSchema1
-extends [StringSchema.StringSchema1](../../../../../../../components/schemas/StringSchema.md#stringschema1) - -A schema class that validates payloads diff --git a/samples/client/petstore/kotlin/docs/paths/fakeresponsewithoutschema/FakeresponsewithoutschemaGet.md b/samples/client/petstore/kotlin/docs/paths/fakeresponsewithoutschema/FakeresponsewithoutschemaGet.md deleted file mode 100644 index 71fbe73307e..00000000000 --- a/samples/client/petstore/kotlin/docs/paths/fakeresponsewithoutschema/FakeresponsewithoutschemaGet.md +++ /dev/null @@ -1,142 +0,0 @@ -# FakeresponsewithoutschemaGet - -public class FakeresponsewithoutschemaGet - -A class that contains necessary endpoint classes -- a class that calls the endpoint method using the http verb -- a class that calls the endpoint method using the operationId name -- class(es) to store the request inputs -- builder(s) to set the request input data - -## Nested Class Summary -| Modifier and Type | Class and Description | -| ----------------- | --------------------- | -| static class | [Get](#get)
The class that has a get method to call the endpoint | -| interface | [ResponseWithoutSchemaOperation](#responsewithoutschemaoperation)
The interface that has a responseWithoutSchema method to call the endpoint | -| static class | [GetRequest](#getrequest)
The request inputs class | -| static class | [GetRequestBuilder](#getrequestbuilder)
A builder for the request input class | - -## Get -public static class Get extends ApiClient.ApiClient1 implements GetOperation
- -a class that allows one to call the endpoint using a method named get - -### 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.servers.RootServer0; -import org.openapijsonschematools.client.servers.RootServer1; -import org.openapijsonschematools.client.servers.RootServer2; -import org.openapijsonschematools.client.paths.fakeresponsewithoutschema.get.responses.FakeresponsewithoutschemaGetCode200Response; -import org.openapijsonschematools.client.servers.RootServerInfo; -import org.openapijsonschematools.client.paths.fakeresponsewithoutschema.FakeresponsewithoutschemaGet; -import org.openapijsonschematools.client.paths.fakeresponsewithoutschema.get.FakeresponsewithoutschemaGetResponses; - -import java.io.IOException; -import java.util.Arrays; -import java.util.List; -import java.util.Map; -import java.util.AbstractMap; - -// if you want to use a server that is not SERVER_0 pass it in here and change the ServerIndex input below -ApiConfiguration.ServerInfo serverInfo = new ApiConfiguration.ServerInfoBuilder() - .rootServerInfo( - new RootServerInfo.RootServerInfoBuilder() - .rootServer0(new RootServer0()) - .build() - ) - .build(); -ApiConfiguration.ServerIndexInfo serverIndexInfo = new ApiConfiguration.ServerIndexInfoBuilder() - .rootServerInfoServerIndex(RootServerInfo.ServerIndex.SERVER_0) - .build(); -Duration timeout = Duration.ofSeconds(1L); -Map> defaultHeaders = Map.of("User-Agent", List.of("OpenAPI-JSON-Schema-Generator/1.0.0/java")); -ApiConfiguration apiConfiguration = new ApiConfiguration( - serverInfo - serverIndexInfo, - timeout, - defaultHeaders -); -SchemaConfiguration schemaConfiguration = new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().build()); -FakeresponsewithoutschemaGet.Get apiClient = new FakeresponsewithoutschemaGet.Get(apiConfiguration, schemaConfiguration); - - -var request = new FakeresponsewithoutschemaGet.GetRequestBuilder().build(); - -FakeresponsewithoutschemaGetResponses.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; -} -FakeresponsewithoutschemaGetResponses.EndpointFakeresponsewithoutschemaGetCode200Response castResponse = (FakeresponsewithoutschemaGetResponses.EndpointFakeresponsewithoutschemaGetCode200Response) response; -``` -### Constructor Summary -| Constructor and Description | -| --------------------------- | -| Get(ApiConfiguration apiConfiguration, SchemaConfiguration schemaConfiguration)
Creates an instance | - -### Method Summary -| Modifier and Type | Method and Description | -| ----------------- | ---------------------- | -| [FakeresponsewithoutschemaGetResponses.EndpointResponse](../../paths/fakeresponsewithoutschema/get/FakeresponsewithoutschemaGetResponses.md#endpointresponse) | get([GetRequest](#getrequest) request) | - -## ResponseWithoutSchemaOperation -public interface ResponseWithoutSchemaOperation
- -an interface that allows one to call the endpoint using a method named responseWithoutSchema by the operationId - -### Method Summary -| Modifier and Type | Method and Description | -| ----------------- | ---------------------- | -| [FakeresponsewithoutschemaGetResponses.EndpointResponse](../../paths/fakeresponsewithoutschema/get/FakeresponsewithoutschemaGetResponses.md#endpointresponse) | responseWithoutSchema([GetRequest](#getrequest) request) | - -## GetRequest -public static class GetRequest
- -a class that stores the final request inputs - -### Field Summary -| Modifier and Type | Field and Description | -| ----------------- | --------------------- | -| [RootServerInfo.@Nullable ServerIndex](../../RootServerInfo.md#serverindex) | serverIndex
optional. Note: this will override the value in apiConfiguration | -| @Nullable Duration | timeout
optional. Note: this will override the value in apiConfiguration | - -## GetRequestBuilder -public static class GetRequestBuilder
- -a builder for request inputs - -### Constructor Summary -| Constructor and Description | -| --------------------------- | -| GetRequestBuilder()
Creates a builder that contains null for all parameters | - -### Method Summary -| Modifier and Type | Method and Description | -| ----------------- | ---------------------- | -| [GetRequest](#getrequest) | build()
Returns the request input used to call an endpoint method | -| [GetRequestBuilder](#getrequestbuilder) | serverIndex([RootServerInfo.ServerIndex](../../RootServerInfo.md#serverindex) serverIndex)
sets the optional property. Note: this will override the value in apiConfiguration | -| [GetRequestBuilder](#getrequestbuilder) | timeout(Duration timeout)
sets the optional property. Note: this will override the value in apiConfiguration | - -[[Back to top]](#top) [[Back to README]](../../../README.md) diff --git a/samples/client/petstore/kotlin/docs/paths/fakeresponsewithoutschema/get/FakeresponsewithoutschemaGetResponses.md b/samples/client/petstore/kotlin/docs/paths/fakeresponsewithoutschema/get/FakeresponsewithoutschemaGetResponses.md deleted file mode 100644 index cd5796003b5..00000000000 --- a/samples/client/petstore/kotlin/docs/paths/fakeresponsewithoutschema/get/FakeresponsewithoutschemaGetResponses.md +++ /dev/null @@ -1,29 +0,0 @@ -# FakeresponsewithoutschemaGetResponses - -public class FakeresponsewithoutschemaGetResponses - -A class that contains necessary responses classes -- a sealed interface, EndpointResponse, that stores endpoint responses -- records for each endpoint response - -## Nested Class Summary -| Modifier and Type | Class and Description | -| ----------------- | --------------------- | -| sealed interface | [EndpointResponse](#endpointresponse)
stores the endpoint responses | -| record | [EndpointFakeresponsewithoutschemaGetCode200Response](#endpointfakeresponsewithoutschemagetcode200response)
the response for 200 | - -## EndpointResponse -public sealed interface EndpointResponse permits
-[EndpointFakeresponsewithoutschemaGetCode200Response](#endpointfakeresponsewithoutschemagetcode200response) - -a sealed interface that stores endpoint responses - -## EndpointFakeresponsewithoutschemaGetCode200Response -public record EndpointFakeresponsewithoutschemaGetCode200Response( - HttpResponse response, - Nothing? body, - Nothing? headers -) implements EndpointResponse, ApiResponse
- -a class that stores an endpoint response - diff --git a/samples/client/petstore/kotlin/docs/paths/fakeresponsewithoutschema/get/responses/FakeresponsewithoutschemaGetCode200Response.md b/samples/client/petstore/kotlin/docs/paths/fakeresponsewithoutschema/get/responses/FakeresponsewithoutschemaGetCode200Response.md deleted file mode 100644 index 8d5f2f94e67..00000000000 --- a/samples/client/petstore/kotlin/docs/paths/fakeresponsewithoutschema/get/responses/FakeresponsewithoutschemaGetCode200Response.md +++ /dev/null @@ -1,32 +0,0 @@ -# FakeresponsewithoutschemaGetCode200Response - -public class FakeresponsewithoutschemaGetCode200Response - -A class that contains necessary nested response classes -- a class that extends ResponseDeserializer and is used to deserialize responses - -## Nested Class Summary -| Modifier and Type | Class and Description | -| ----------------- | --------------------- | -| static class | [FakeresponsewithoutschemaGetCode200Response.FakeresponsewithoutschemaGetCode200Response1](#fakeresponsewithoutschemagetcode200response1)
class that deserializes responses | - -## FakeresponsewithoutschemaGetCode200Response1 -public static class FakeresponsewithoutschemaGetCode200Response1
-extends ResponseDeserializer - -a class that deserializes responses - -### Constructor Summary -| Constructor and Description | -| --------------------------- | -| FakeresponsewithoutschemaGetCode200Response1()
Creates an instance | - -### Field Summary -| Modifier and Type | Field and Description | -| ----------------- | --------------------- | -| Map | content = MapUtils.makeMap(
    new AbstractMap.SimpleEntry<>("application/json", null),
    new AbstractMap.SimpleEntry<>("application/xml", null)
)
the contentType to schema info | - -### Method Summary -| Modifier and Type | Method and Description | -| ----------------- | ---------------------- | -| ApiResponse | deserialize(HttpResponse response, SchemaConfiguration configuration)
called by endpoint when deserialize responses | diff --git a/samples/client/petstore/kotlin/docs/paths/faketestqueryparamters/FaketestqueryparamtersPut.md b/samples/client/petstore/kotlin/docs/paths/faketestqueryparamters/FaketestqueryparamtersPut.md deleted file mode 100644 index 7c0c5bcc689..00000000000 --- a/samples/client/petstore/kotlin/docs/paths/faketestqueryparamters/FaketestqueryparamtersPut.md +++ /dev/null @@ -1,210 +0,0 @@ -# FaketestqueryparamtersPut - -public class FaketestqueryparamtersPut - -A class that contains necessary endpoint classes -- a class that calls the endpoint method using the http verb -- a class that calls the endpoint method using the operationId name -- class(es) to store the request inputs -- builder(s) to set the request input data - -## Nested Class Summary -| Modifier and Type | Class and Description | -| ----------------- | --------------------- | -| static class | [Put](#put)
The class that has a put method to call the endpoint | -| interface | [QueryParameterCollectionFormatOperation](#queryparametercollectionformatoperation)
The interface that has a queryParameterCollectionFormat method to call the endpoint | -| static class | [PutRequest](#putrequest)
The final request inputs class | -| static class | [PutNullableRequest](#putnullablerequest)
The initial request inputs class | -| static class | [Put0RequestBuilder](#put0requestbuilder)
A builder for the request input class | -| static class | [PutRequestBuilder](#putrequestbuilder)
A builder for the request input class | - -## Put -public static class Put extends ApiClient.ApiClient1 implements PutOperation
- -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.faketestqueryparamters.put.FaketestqueryparamtersPutQueryParameters; -import org.openapijsonschematools.client.servers.RootServer0; -import org.openapijsonschematools.client.servers.RootServer1; -import org.openapijsonschematools.client.servers.RootServer2; -import org.openapijsonschematools.client.paths.faketestqueryparamters.put.responses.FaketestqueryparamtersPutCode200Response; -import org.openapijsonschematools.client.servers.RootServerInfo; -import org.openapijsonschematools.client.paths.faketestqueryparamters.FaketestqueryparamtersPut; -import org.openapijsonschematools.client.paths.faketestqueryparamters.put.FaketestqueryparamtersPutResponses; - -import java.io.IOException; -import java.util.Arrays; -import java.util.List; -import java.util.Map; -import java.util.AbstractMap; - -// if you want to use a server that is not SERVER_0 pass it in here and change the ServerIndex input below -ApiConfiguration.ServerInfo serverInfo = new ApiConfiguration.ServerInfoBuilder() - .rootServerInfo( - new RootServerInfo.RootServerInfoBuilder() - .rootServer0(new RootServer0()) - .build() - ) - .build(); -ApiConfiguration.ServerIndexInfo serverIndexInfo = new ApiConfiguration.ServerIndexInfoBuilder() - .rootServerInfoServerIndex(RootServerInfo.ServerIndex.SERVER_0) - .build(); -Duration timeout = Duration.ofSeconds(1L); -Map> defaultHeaders = Map.of("User-Agent", List.of("OpenAPI-JSON-Schema-Generator/1.0.0/java")); -ApiConfiguration apiConfiguration = new ApiConfiguration( - serverInfo - serverIndexInfo, - timeout, - defaultHeaders -); -SchemaConfiguration schemaConfiguration = new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().build()); -FaketestqueryparamtersPut.Put apiClient = new FaketestqueryparamtersPut.Put(apiConfiguration, schemaConfiguration); - - -// Map validation -FaketestqueryparamtersPutQueryParameters.QueryParametersMap queryParameters = - FaketestqueryparamtersPutQueryParameters.FaketestqueryparamtersPutQueryParameters1.validate( - new FaketestqueryparamtersPutQueryParameters.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 -); - -var request = new FaketestqueryparamtersPut.PutRequestBuilder() - .queryParameters(queryParameters) - .build(); - -FaketestqueryparamtersPutResponses.EndpointResponse response; -try { - response = apiClient.put(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; -} -FaketestqueryparamtersPutResponses.EndpointFaketestqueryparamtersPutCode200Response castResponse = (FaketestqueryparamtersPutResponses.EndpointFaketestqueryparamtersPutCode200Response) response; -``` -### Constructor Summary -| Constructor and Description | -| --------------------------- | -| Put(ApiConfiguration apiConfiguration, SchemaConfiguration schemaConfiguration)
Creates an instance | - -### Method Summary -| Modifier and Type | Method and Description | -| ----------------- | ---------------------- | -| [FaketestqueryparamtersPutResponses.EndpointResponse](../../paths/faketestqueryparamters/put/FaketestqueryparamtersPutResponses.md#endpointresponse) | put([PutRequest](#putrequest) request) | - -## QueryParameterCollectionFormatOperation -public interface QueryParameterCollectionFormatOperation
- -an interface that allows one to call the endpoint using a method named queryParameterCollectionFormat by the operationId - -### Method Summary -| Modifier and Type | Method and Description | -| ----------------- | ---------------------- | -| [FaketestqueryparamtersPutResponses.EndpointResponse](../../paths/faketestqueryparamters/put/FaketestqueryparamtersPutResponses.md#endpointresponse) | queryParameterCollectionFormat([PutRequest](#putrequest) request) | - -## PutRequest -public static class PutRequest
- -a class that stores the final request inputs - -### Field Summary -| Modifier and Type | Field and Description | -| ----------------- | --------------------- | -| [FaketestqueryparamtersPutQueryParameters.QueryParametersMap](../../paths/faketestqueryparamters/put/FaketestqueryparamtersPutQueryParameters.md#queryparametersmap) | queryParameters | -| [RootServerInfo.@Nullable ServerIndex](../../RootServerInfo.md#serverindex) | serverIndex
optional. Note: this will override the value in apiConfiguration | -| @Nullable Duration | timeout
optional. Note: this will override the value in apiConfiguration | - -## PutNullableRequest -public static class PutNullableRequest
- -a class that stores the initial request inputs - -### Field Summary -| Modifier and Type | Field and Description | -| ----------------- | --------------------- | -| [FaketestqueryparamtersPutQueryParameters.@Nullable QueryParametersMap](../../paths/faketestqueryparamters/put/FaketestqueryparamtersPutQueryParameters.md#queryparametersmap) | queryParameters | -| [RootServerInfo.@Nullable ServerIndex](../../RootServerInfo.md#serverindex) | serverIndex | -| @Nullable Duration | timeout | - -## Put0RequestBuilder -public static class Put0RequestBuilder
- -a builder for request inputs - -### Constructor Summary -| Constructor and Description | -| --------------------------- | -| Put0RequestBuilder(Put0RequestBuilder instance)
Creates a builder that contains the passed instance | - -### Method Summary -| Modifier and Type | Method and Description | -| ----------------- | ---------------------- | -| [PutRequest](#putrequest) | build()
Returns the request input used to call an endpoint method | -| [Put0RequestBuilder](#put0requestbuilder) | serverIndex([RootServerInfo.ServerIndex](../../RootServerInfo.md#serverindex) serverIndex)
sets the optional property. Note: this will override the value in apiConfiguration | -| [Put0RequestBuilder](#put0requestbuilder) | timeout(Duration timeout)
sets the optional property. Note: this will override the value in apiConfiguration | - -## PutRequestBuilder -public static class PutRequestBuilder
- -a builder for request inputs - -### Constructor Summary -| Constructor and Description | -| --------------------------- | -| PutRequestBuilder()
Creates a builder that contains null for all parameters | - -### Method Summary -| Modifier and Type | Method and Description | -| ----------------- | ---------------------- | -| [Put0RequestBuilder](#put0requestbuilder) | queryParameters([FaketestqueryparamtersPutQueryParametersQueryParametersMap](../../paths/faketestqueryparamters/put/FaketestqueryparamtersPutQueryParameters.md#queryparametersmap) queryParameters)
sets the property | - -[[Back to top]](#top) [[Back to README]](../../../README.md) diff --git a/samples/client/petstore/kotlin/docs/paths/faketestqueryparamters/put/FaketestqueryparamtersPutQueryParameters.md b/samples/client/petstore/kotlin/docs/paths/faketestqueryparamters/put/FaketestqueryparamtersPutQueryParameters.md deleted file mode 100644 index 6444b0b3515..00000000000 --- a/samples/client/petstore/kotlin/docs/paths/faketestqueryparamters/put/FaketestqueryparamtersPutQueryParameters.md +++ /dev/null @@ -1,1419 +0,0 @@ -# FaketestqueryparamtersPutQueryParameters -public class FaketestqueryparamtersPutQueryParameters
- -A class that contains necessary nested -- schema classes (which validate payloads), extends JsonSchema -- sealed interfaces which store validated payloads, java version of a sum type -- boxed classes which store validated payloads, sealed permits class implementations -- classes to store validated map payloads, extends FrozenMap -- classes to build inputs for map payloads - -## Nested Class Summary -| Modifier and Type | Class and Description | -| ----------------- | ---------------------- | -| sealed interface | [FaketestqueryparamtersPutQueryParameters.FaketestqueryparamtersPutQueryParameters1Boxed](#faketestqueryparamtersputqueryparameters1boxed)
sealed interface for validated payloads | -| record | [FaketestqueryparamtersPutQueryParameters.FaketestqueryparamtersPutQueryParameters1BoxedMap](#faketestqueryparamtersputqueryparameters1boxedmap)
boxed class to store validated Map payloads | -| static class | [FaketestqueryparamtersPutQueryParameters.FaketestqueryparamtersPutQueryParameters1](#faketestqueryparamtersputqueryparameters1)
schema class | -| static class | [FaketestqueryparamtersPutQueryParameters.QueryParametersMapBuilder](#queryparametersmapbuilder)
builder for Map payloads | -| static class | [FaketestqueryparamtersPutQueryParameters.QueryParametersMap](#queryparametersmap)
output class for Map payloads | -| sealed interface | [FaketestqueryparamtersPutQueryParameters.AdditionalPropertiesBoxed](#additionalpropertiesboxed)
sealed interface for validated payloads | -| record | [FaketestqueryparamtersPutQueryParameters.AdditionalPropertiesBoxedVoid](#additionalpropertiesboxedvoid)
boxed class to store validated null payloads | -| record | [FaketestqueryparamtersPutQueryParameters.AdditionalPropertiesBoxedBoolean](#additionalpropertiesboxedboolean)
boxed class to store validated boolean payloads | -| record | [FaketestqueryparamtersPutQueryParameters.AdditionalPropertiesBoxedNumber](#additionalpropertiesboxednumber)
boxed class to store validated Number payloads | -| record | [FaketestqueryparamtersPutQueryParameters.AdditionalPropertiesBoxedString](#additionalpropertiesboxedstring)
boxed class to store validated String payloads | -| record | [FaketestqueryparamtersPutQueryParameters.AdditionalPropertiesBoxedList](#additionalpropertiesboxedlist)
boxed class to store validated List payloads | -| record | [FaketestqueryparamtersPutQueryParameters.AdditionalPropertiesBoxedMap](#additionalpropertiesboxedmap)
boxed class to store validated Map payloads | -| static class | [FaketestqueryparamtersPutQueryParameters.AdditionalProperties](#additionalproperties)
schema class | - -## FaketestqueryparamtersPutQueryParameters1Boxed -public sealed interface FaketestqueryparamtersPutQueryParameters1Boxed
-permits
-[FaketestqueryparamtersPutQueryParameters1BoxedMap](#faketestqueryparamtersputqueryparameters1boxedmap) - -sealed interface that stores validated payloads using boxed classes - -## FaketestqueryparamtersPutQueryParameters1BoxedMap -public record FaketestqueryparamtersPutQueryParameters1BoxedMap
-implements [FaketestqueryparamtersPutQueryParameters1Boxed](#faketestqueryparamtersputqueryparameters1boxed) - -record that stores validated Map payloads, sealed permits implementation - -### Constructor Summary -| Constructor and Description | -| --------------------------- | -| FaketestqueryparamtersPutQueryParameters1BoxedMap([QueryParametersMap](#queryparametersmap) data)
Creates an instance, private visibility | - -### Method Summary -| Modifier and Type | Method and Description | -| ----------------- | ---------------------- | -| [QueryParametersMap](#queryparametersmap) | data()
validated payload | -| @Nullable Object | getData()
validated payload | - -## FaketestqueryparamtersPutQueryParameters1 -public static class FaketestqueryparamtersPutQueryParameters1
-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.faketestqueryparamters.put.FaketestqueryparamtersPutQueryParameters; - -import java.util.Arrays; -import java.util.List; -import java.util.AbstractMap; - -static final SchemaConfiguration configuration = new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().build()); - -// Map validation -FaketestqueryparamtersPutQueryParameters.QueryParametersMap validatedPayload = - FaketestqueryparamtersPutQueryParameters.FaketestqueryparamtersPutQueryParameters1.validate( - new FaketestqueryparamtersPutQueryParameters.QueryParametersMapBuilder() - .context( - Arrays.asList( - "a" - ) - ) - .http( - Arrays.asList( - "a" - ) - ) - .ioutil( - Arrays.asList( - "a" - ) - ) - .pipe( - Arrays.asList( - "a" - ) - ) - .refParam("a") - - .url( - Arrays.asList( - "a" - ) - ) - .build(), - configuration -); -``` - -### Field Summary -| Modifier and Type | Field and Description | -| ----------------- | ---------------------- | -| Set> | type = Set.of(Map.class) | -| Map> | properties = Map.ofEntries(
    new PropertyEntry("refParam", [StringWithValidation.StringWithValidation1.class](../../../components/schemas/StringWithValidation.md#stringwithvalidation1)),
    new PropertyEntry("ioutil", [Schema1.Schema11.class](../../../paths/faketestqueryparamters/put/parameters/parameter1/Schema1.md#schema11)),
    new PropertyEntry("context", [Schema4.Schema41.class](../../../paths/faketestqueryparamters/put/parameters/parameter4/Schema4.md#schema41)),
    new PropertyEntry("http", [Schema2.Schema21.class](../../../paths/faketestqueryparamters/put/parameters/parameter2/Schema2.md#schema21)),
    new PropertyEntry("pipe", [Schema0.Schema01.class](../../../paths/faketestqueryparamters/put/parameters/parameter0/Schema0.md#schema01)),
    new PropertyEntry("url", [Schema3.Schema31.class](../../../paths/faketestqueryparamters/put/parameters/parameter3/Schema3.md#schema31))
)
| -| Set | required = Set.of(
    "context",
    "http",
    "ioutil",
    "pipe",
    "refParam",
    "url"
)
| -| Class | additionalProperties = [AdditionalProperties.class](#additionalproperties) | - -### Method Summary -| Modifier and Type | Method and Description | -| ----------------- | ---------------------- | -| [QueryParametersMap](#queryparametersmap) | validate([Map<?, ?>](#queryparametersmapbuilder) arg, SchemaConfiguration configuration) | -| [FaketestqueryparamtersPutQueryParameters1BoxedMap](#faketestqueryparamtersputqueryparameters1boxedmap) | validateAndBox([Map<?, ?>](#queryparametersmapbuilder) arg, SchemaConfiguration configuration) | -| [FaketestqueryparamtersPutQueryParameters1Boxed](#faketestqueryparamtersputqueryparameters1boxed) | validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) | -| @Nullable Object | validate(@Nullable Object arg, SchemaConfiguration configuration) | - -## QueryParametersMap000000Builder -public class QueryParametersMap000000Builder
-builder for `Map` - -A class that builds the Map input type - -### Constructor Summary -| Constructor and Description | -| --------------------------- | -| QueryParametersMap000000Builder(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 | - -## QueryParametersMap000001Builder -public class QueryParametersMap000001Builder
-builder for `Map` - -A class that builds the Map input type - -### Constructor Summary -| Constructor and Description | -| --------------------------- | -| QueryParametersMap000001Builder(Map instance)
Creates a builder that contains the passed instance | - -### Method Summary -| Modifier and Type | Method and Description | -| ----------------- | ---------------------- | -| [QueryParametersMap000000Builder](#queryparametersmap000000builder) | url(List value) | - -## QueryParametersMap000010Builder -public class QueryParametersMap000010Builder
-builder for `Map` - -A class that builds the Map input type - -### Constructor Summary -| Constructor and Description | -| --------------------------- | -| QueryParametersMap000010Builder(Map instance)
Creates a builder that contains the passed instance | - -### Method Summary -| Modifier and Type | Method and Description | -| ----------------- | ---------------------- | -| [QueryParametersMap000000Builder](#queryparametersmap000000builder) | refParam(String value) | - -## QueryParametersMap000011Builder -public class QueryParametersMap000011Builder
-builder for `Map` - -A class that builds the Map input type - -### Constructor Summary -| Constructor and Description | -| --------------------------- | -| QueryParametersMap000011Builder(Map instance)
Creates a builder that contains the passed instance | - -### Method Summary -| Modifier and Type | Method and Description | -| ----------------- | ---------------------- | -| [QueryParametersMap000001Builder](#queryparametersmap000001builder) | refParam(String value) | -| [QueryParametersMap000010Builder](#queryparametersmap000010builder) | url(List value) | - -## QueryParametersMap000100Builder -public class QueryParametersMap000100Builder
-builder for `Map` - -A class that builds the Map input type - -### Constructor Summary -| Constructor and Description | -| --------------------------- | -| QueryParametersMap000100Builder(Map instance)
Creates a builder that contains the passed instance | - -### Method Summary -| Modifier and Type | Method and Description | -| ----------------- | ---------------------- | -| [QueryParametersMap000000Builder](#queryparametersmap000000builder) | pipe(List value) | - -## QueryParametersMap000101Builder -public class QueryParametersMap000101Builder
-builder for `Map` - -A class that builds the Map input type - -### Constructor Summary -| Constructor and Description | -| --------------------------- | -| QueryParametersMap000101Builder(Map instance)
Creates a builder that contains the passed instance | - -### Method Summary -| Modifier and Type | Method and Description | -| ----------------- | ---------------------- | -| [QueryParametersMap000001Builder](#queryparametersmap000001builder) | pipe(List value) | -| [QueryParametersMap000100Builder](#queryparametersmap000100builder) | url(List value) | - -## QueryParametersMap000110Builder -public class QueryParametersMap000110Builder
-builder for `Map` - -A class that builds the Map input type - -### Constructor Summary -| Constructor and Description | -| --------------------------- | -| QueryParametersMap000110Builder(Map instance)
Creates a builder that contains the passed instance | - -### Method Summary -| Modifier and Type | Method and Description | -| ----------------- | ---------------------- | -| [QueryParametersMap000010Builder](#queryparametersmap000010builder) | pipe(List value) | -| [QueryParametersMap000100Builder](#queryparametersmap000100builder) | refParam(String value) | - -## QueryParametersMap000111Builder -public class QueryParametersMap000111Builder
-builder for `Map` - -A class that builds the Map input type - -### Constructor Summary -| Constructor and Description | -| --------------------------- | -| QueryParametersMap000111Builder(Map instance)
Creates a builder that contains the passed instance | - -### Method Summary -| Modifier and Type | Method and Description | -| ----------------- | ---------------------- | -| [QueryParametersMap000011Builder](#queryparametersmap000011builder) | pipe(List value) | -| [QueryParametersMap000101Builder](#queryparametersmap000101builder) | refParam(String value) | -| [QueryParametersMap000110Builder](#queryparametersmap000110builder) | url(List value) | - -## QueryParametersMap001000Builder -public class QueryParametersMap001000Builder
-builder for `Map` - -A class that builds the Map input type - -### Constructor Summary -| Constructor and Description | -| --------------------------- | -| QueryParametersMap001000Builder(Map instance)
Creates a builder that contains the passed instance | - -### Method Summary -| Modifier and Type | Method and Description | -| ----------------- | ---------------------- | -| [QueryParametersMap000000Builder](#queryparametersmap000000builder) | ioutil(List value) | - -## QueryParametersMap001001Builder -public class QueryParametersMap001001Builder
-builder for `Map` - -A class that builds the Map input type - -### Constructor Summary -| Constructor and Description | -| --------------------------- | -| QueryParametersMap001001Builder(Map instance)
Creates a builder that contains the passed instance | - -### Method Summary -| Modifier and Type | Method and Description | -| ----------------- | ---------------------- | -| [QueryParametersMap000001Builder](#queryparametersmap000001builder) | ioutil(List value) | -| [QueryParametersMap001000Builder](#queryparametersmap001000builder) | url(List value) | - -## QueryParametersMap001010Builder -public class QueryParametersMap001010Builder
-builder for `Map` - -A class that builds the Map input type - -### Constructor Summary -| Constructor and Description | -| --------------------------- | -| QueryParametersMap001010Builder(Map instance)
Creates a builder that contains the passed instance | - -### Method Summary -| Modifier and Type | Method and Description | -| ----------------- | ---------------------- | -| [QueryParametersMap000010Builder](#queryparametersmap000010builder) | ioutil(List value) | -| [QueryParametersMap001000Builder](#queryparametersmap001000builder) | refParam(String value) | - -## QueryParametersMap001011Builder -public class QueryParametersMap001011Builder
-builder for `Map` - -A class that builds the Map input type - -### Constructor Summary -| Constructor and Description | -| --------------------------- | -| QueryParametersMap001011Builder(Map instance)
Creates a builder that contains the passed instance | - -### Method Summary -| Modifier and Type | Method and Description | -| ----------------- | ---------------------- | -| [QueryParametersMap000011Builder](#queryparametersmap000011builder) | ioutil(List value) | -| [QueryParametersMap001001Builder](#queryparametersmap001001builder) | refParam(String value) | -| [QueryParametersMap001010Builder](#queryparametersmap001010builder) | url(List value) | - -## QueryParametersMap001100Builder -public class QueryParametersMap001100Builder
-builder for `Map` - -A class that builds the Map input type - -### Constructor Summary -| Constructor and Description | -| --------------------------- | -| QueryParametersMap001100Builder(Map instance)
Creates a builder that contains the passed instance | - -### Method Summary -| Modifier and Type | Method and Description | -| ----------------- | ---------------------- | -| [QueryParametersMap000100Builder](#queryparametersmap000100builder) | ioutil(List value) | -| [QueryParametersMap001000Builder](#queryparametersmap001000builder) | pipe(List value) | - -## QueryParametersMap001101Builder -public class QueryParametersMap001101Builder
-builder for `Map` - -A class that builds the Map input type - -### Constructor Summary -| Constructor and Description | -| --------------------------- | -| QueryParametersMap001101Builder(Map instance)
Creates a builder that contains the passed instance | - -### Method Summary -| Modifier and Type | Method and Description | -| ----------------- | ---------------------- | -| [QueryParametersMap000101Builder](#queryparametersmap000101builder) | ioutil(List value) | -| [QueryParametersMap001001Builder](#queryparametersmap001001builder) | pipe(List value) | -| [QueryParametersMap001100Builder](#queryparametersmap001100builder) | url(List value) | - -## QueryParametersMap001110Builder -public class QueryParametersMap001110Builder
-builder for `Map` - -A class that builds the Map input type - -### Constructor Summary -| Constructor and Description | -| --------------------------- | -| QueryParametersMap001110Builder(Map instance)
Creates a builder that contains the passed instance | - -### Method Summary -| Modifier and Type | Method and Description | -| ----------------- | ---------------------- | -| [QueryParametersMap000110Builder](#queryparametersmap000110builder) | ioutil(List value) | -| [QueryParametersMap001010Builder](#queryparametersmap001010builder) | pipe(List value) | -| [QueryParametersMap001100Builder](#queryparametersmap001100builder) | refParam(String value) | - -## QueryParametersMap001111Builder -public class QueryParametersMap001111Builder
-builder for `Map` - -A class that builds the Map input type - -### Constructor Summary -| Constructor and Description | -| --------------------------- | -| QueryParametersMap001111Builder(Map instance)
Creates a builder that contains the passed instance | - -### Method Summary -| Modifier and Type | Method and Description | -| ----------------- | ---------------------- | -| [QueryParametersMap000111Builder](#queryparametersmap000111builder) | ioutil(List value) | -| [QueryParametersMap001011Builder](#queryparametersmap001011builder) | pipe(List value) | -| [QueryParametersMap001101Builder](#queryparametersmap001101builder) | refParam(String value) | -| [QueryParametersMap001110Builder](#queryparametersmap001110builder) | url(List value) | - -## QueryParametersMap010000Builder -public class QueryParametersMap010000Builder
-builder for `Map` - -A class that builds the Map input type - -### Constructor Summary -| Constructor and Description | -| --------------------------- | -| QueryParametersMap010000Builder(Map instance)
Creates a builder that contains the passed instance | - -### Method Summary -| Modifier and Type | Method and Description | -| ----------------- | ---------------------- | -| [QueryParametersMap000000Builder](#queryparametersmap000000builder) | http(List value) | - -## QueryParametersMap010001Builder -public class QueryParametersMap010001Builder
-builder for `Map` - -A class that builds the Map input type - -### Constructor Summary -| Constructor and Description | -| --------------------------- | -| QueryParametersMap010001Builder(Map instance)
Creates a builder that contains the passed instance | - -### Method Summary -| Modifier and Type | Method and Description | -| ----------------- | ---------------------- | -| [QueryParametersMap000001Builder](#queryparametersmap000001builder) | http(List value) | -| [QueryParametersMap010000Builder](#queryparametersmap010000builder) | url(List value) | - -## QueryParametersMap010010Builder -public class QueryParametersMap010010Builder
-builder for `Map` - -A class that builds the Map input type - -### Constructor Summary -| Constructor and Description | -| --------------------------- | -| QueryParametersMap010010Builder(Map instance)
Creates a builder that contains the passed instance | - -### Method Summary -| Modifier and Type | Method and Description | -| ----------------- | ---------------------- | -| [QueryParametersMap000010Builder](#queryparametersmap000010builder) | http(List value) | -| [QueryParametersMap010000Builder](#queryparametersmap010000builder) | refParam(String value) | - -## QueryParametersMap010011Builder -public class QueryParametersMap010011Builder
-builder for `Map` - -A class that builds the Map input type - -### Constructor Summary -| Constructor and Description | -| --------------------------- | -| QueryParametersMap010011Builder(Map instance)
Creates a builder that contains the passed instance | - -### Method Summary -| Modifier and Type | Method and Description | -| ----------------- | ---------------------- | -| [QueryParametersMap000011Builder](#queryparametersmap000011builder) | http(List value) | -| [QueryParametersMap010001Builder](#queryparametersmap010001builder) | refParam(String value) | -| [QueryParametersMap010010Builder](#queryparametersmap010010builder) | url(List value) | - -## QueryParametersMap010100Builder -public class QueryParametersMap010100Builder
-builder for `Map` - -A class that builds the Map input type - -### Constructor Summary -| Constructor and Description | -| --------------------------- | -| QueryParametersMap010100Builder(Map instance)
Creates a builder that contains the passed instance | - -### Method Summary -| Modifier and Type | Method and Description | -| ----------------- | ---------------------- | -| [QueryParametersMap000100Builder](#queryparametersmap000100builder) | http(List value) | -| [QueryParametersMap010000Builder](#queryparametersmap010000builder) | pipe(List value) | - -## QueryParametersMap010101Builder -public class QueryParametersMap010101Builder
-builder for `Map` - -A class that builds the Map input type - -### Constructor Summary -| Constructor and Description | -| --------------------------- | -| QueryParametersMap010101Builder(Map instance)
Creates a builder that contains the passed instance | - -### Method Summary -| Modifier and Type | Method and Description | -| ----------------- | ---------------------- | -| [QueryParametersMap000101Builder](#queryparametersmap000101builder) | http(List value) | -| [QueryParametersMap010001Builder](#queryparametersmap010001builder) | pipe(List value) | -| [QueryParametersMap010100Builder](#queryparametersmap010100builder) | url(List value) | - -## QueryParametersMap010110Builder -public class QueryParametersMap010110Builder
-builder for `Map` - -A class that builds the Map input type - -### Constructor Summary -| Constructor and Description | -| --------------------------- | -| QueryParametersMap010110Builder(Map instance)
Creates a builder that contains the passed instance | - -### Method Summary -| Modifier and Type | Method and Description | -| ----------------- | ---------------------- | -| [QueryParametersMap000110Builder](#queryparametersmap000110builder) | http(List value) | -| [QueryParametersMap010010Builder](#queryparametersmap010010builder) | pipe(List value) | -| [QueryParametersMap010100Builder](#queryparametersmap010100builder) | refParam(String value) | - -## QueryParametersMap010111Builder -public class QueryParametersMap010111Builder
-builder for `Map` - -A class that builds the Map input type - -### Constructor Summary -| Constructor and Description | -| --------------------------- | -| QueryParametersMap010111Builder(Map instance)
Creates a builder that contains the passed instance | - -### Method Summary -| Modifier and Type | Method and Description | -| ----------------- | ---------------------- | -| [QueryParametersMap000111Builder](#queryparametersmap000111builder) | http(List value) | -| [QueryParametersMap010011Builder](#queryparametersmap010011builder) | pipe(List value) | -| [QueryParametersMap010101Builder](#queryparametersmap010101builder) | refParam(String value) | -| [QueryParametersMap010110Builder](#queryparametersmap010110builder) | url(List value) | - -## QueryParametersMap011000Builder -public class QueryParametersMap011000Builder
-builder for `Map` - -A class that builds the Map input type - -### Constructor Summary -| Constructor and Description | -| --------------------------- | -| QueryParametersMap011000Builder(Map instance)
Creates a builder that contains the passed instance | - -### Method Summary -| Modifier and Type | Method and Description | -| ----------------- | ---------------------- | -| [QueryParametersMap001000Builder](#queryparametersmap001000builder) | http(List value) | -| [QueryParametersMap010000Builder](#queryparametersmap010000builder) | ioutil(List value) | - -## QueryParametersMap011001Builder -public class QueryParametersMap011001Builder
-builder for `Map` - -A class that builds the Map input type - -### Constructor Summary -| Constructor and Description | -| --------------------------- | -| QueryParametersMap011001Builder(Map instance)
Creates a builder that contains the passed instance | - -### Method Summary -| Modifier and Type | Method and Description | -| ----------------- | ---------------------- | -| [QueryParametersMap001001Builder](#queryparametersmap001001builder) | http(List value) | -| [QueryParametersMap010001Builder](#queryparametersmap010001builder) | ioutil(List value) | -| [QueryParametersMap011000Builder](#queryparametersmap011000builder) | url(List value) | - -## QueryParametersMap011010Builder -public class QueryParametersMap011010Builder
-builder for `Map` - -A class that builds the Map input type - -### Constructor Summary -| Constructor and Description | -| --------------------------- | -| QueryParametersMap011010Builder(Map instance)
Creates a builder that contains the passed instance | - -### Method Summary -| Modifier and Type | Method and Description | -| ----------------- | ---------------------- | -| [QueryParametersMap001010Builder](#queryparametersmap001010builder) | http(List value) | -| [QueryParametersMap010010Builder](#queryparametersmap010010builder) | ioutil(List value) | -| [QueryParametersMap011000Builder](#queryparametersmap011000builder) | refParam(String value) | - -## QueryParametersMap011011Builder -public class QueryParametersMap011011Builder
-builder for `Map` - -A class that builds the Map input type - -### Constructor Summary -| Constructor and Description | -| --------------------------- | -| QueryParametersMap011011Builder(Map instance)
Creates a builder that contains the passed instance | - -### Method Summary -| Modifier and Type | Method and Description | -| ----------------- | ---------------------- | -| [QueryParametersMap001011Builder](#queryparametersmap001011builder) | http(List value) | -| [QueryParametersMap010011Builder](#queryparametersmap010011builder) | ioutil(List value) | -| [QueryParametersMap011001Builder](#queryparametersmap011001builder) | refParam(String value) | -| [QueryParametersMap011010Builder](#queryparametersmap011010builder) | url(List value) | - -## QueryParametersMap011100Builder -public class QueryParametersMap011100Builder
-builder for `Map` - -A class that builds the Map input type - -### Constructor Summary -| Constructor and Description | -| --------------------------- | -| QueryParametersMap011100Builder(Map instance)
Creates a builder that contains the passed instance | - -### Method Summary -| Modifier and Type | Method and Description | -| ----------------- | ---------------------- | -| [QueryParametersMap001100Builder](#queryparametersmap001100builder) | http(List value) | -| [QueryParametersMap010100Builder](#queryparametersmap010100builder) | ioutil(List value) | -| [QueryParametersMap011000Builder](#queryparametersmap011000builder) | pipe(List value) | - -## QueryParametersMap011101Builder -public class QueryParametersMap011101Builder
-builder for `Map` - -A class that builds the Map input type - -### Constructor Summary -| Constructor and Description | -| --------------------------- | -| QueryParametersMap011101Builder(Map instance)
Creates a builder that contains the passed instance | - -### Method Summary -| Modifier and Type | Method and Description | -| ----------------- | ---------------------- | -| [QueryParametersMap001101Builder](#queryparametersmap001101builder) | http(List value) | -| [QueryParametersMap010101Builder](#queryparametersmap010101builder) | ioutil(List value) | -| [QueryParametersMap011001Builder](#queryparametersmap011001builder) | pipe(List value) | -| [QueryParametersMap011100Builder](#queryparametersmap011100builder) | url(List value) | - -## QueryParametersMap011110Builder -public class QueryParametersMap011110Builder
-builder for `Map` - -A class that builds the Map input type - -### Constructor Summary -| Constructor and Description | -| --------------------------- | -| QueryParametersMap011110Builder(Map instance)
Creates a builder that contains the passed instance | - -### Method Summary -| Modifier and Type | Method and Description | -| ----------------- | ---------------------- | -| [QueryParametersMap001110Builder](#queryparametersmap001110builder) | http(List value) | -| [QueryParametersMap010110Builder](#queryparametersmap010110builder) | ioutil(List value) | -| [QueryParametersMap011010Builder](#queryparametersmap011010builder) | pipe(List value) | -| [QueryParametersMap011100Builder](#queryparametersmap011100builder) | refParam(String value) | - -## QueryParametersMap011111Builder -public class QueryParametersMap011111Builder
-builder for `Map` - -A class that builds the Map input type - -### Constructor Summary -| Constructor and Description | -| --------------------------- | -| QueryParametersMap011111Builder(Map instance)
Creates a builder that contains the passed instance | - -### Method Summary -| Modifier and Type | Method and Description | -| ----------------- | ---------------------- | -| [QueryParametersMap001111Builder](#queryparametersmap001111builder) | http(List value) | -| [QueryParametersMap010111Builder](#queryparametersmap010111builder) | ioutil(List value) | -| [QueryParametersMap011011Builder](#queryparametersmap011011builder) | pipe(List value) | -| [QueryParametersMap011101Builder](#queryparametersmap011101builder) | refParam(String value) | -| [QueryParametersMap011110Builder](#queryparametersmap011110builder) | url(List value) | - -## QueryParametersMap100000Builder -public class QueryParametersMap100000Builder
-builder for `Map` - -A class that builds the Map input type - -### Constructor Summary -| Constructor and Description | -| --------------------------- | -| QueryParametersMap100000Builder(Map instance)
Creates a builder that contains the passed instance | - -### Method Summary -| Modifier and Type | Method and Description | -| ----------------- | ---------------------- | -| [QueryParametersMap000000Builder](#queryparametersmap000000builder) | context(List value) | - -## QueryParametersMap100001Builder -public class QueryParametersMap100001Builder
-builder for `Map` - -A class that builds the Map input type - -### Constructor Summary -| Constructor and Description | -| --------------------------- | -| QueryParametersMap100001Builder(Map instance)
Creates a builder that contains the passed instance | - -### Method Summary -| Modifier and Type | Method and Description | -| ----------------- | ---------------------- | -| [QueryParametersMap000001Builder](#queryparametersmap000001builder) | context(List value) | -| [QueryParametersMap100000Builder](#queryparametersmap100000builder) | url(List value) | - -## QueryParametersMap100010Builder -public class QueryParametersMap100010Builder
-builder for `Map` - -A class that builds the Map input type - -### Constructor Summary -| Constructor and Description | -| --------------------------- | -| QueryParametersMap100010Builder(Map instance)
Creates a builder that contains the passed instance | - -### Method Summary -| Modifier and Type | Method and Description | -| ----------------- | ---------------------- | -| [QueryParametersMap000010Builder](#queryparametersmap000010builder) | context(List value) | -| [QueryParametersMap100000Builder](#queryparametersmap100000builder) | refParam(String value) | - -## QueryParametersMap100011Builder -public class QueryParametersMap100011Builder
-builder for `Map` - -A class that builds the Map input type - -### Constructor Summary -| Constructor and Description | -| --------------------------- | -| QueryParametersMap100011Builder(Map instance)
Creates a builder that contains the passed instance | - -### Method Summary -| Modifier and Type | Method and Description | -| ----------------- | ---------------------- | -| [QueryParametersMap000011Builder](#queryparametersmap000011builder) | context(List value) | -| [QueryParametersMap100001Builder](#queryparametersmap100001builder) | refParam(String value) | -| [QueryParametersMap100010Builder](#queryparametersmap100010builder) | url(List value) | - -## QueryParametersMap100100Builder -public class QueryParametersMap100100Builder
-builder for `Map` - -A class that builds the Map input type - -### Constructor Summary -| Constructor and Description | -| --------------------------- | -| QueryParametersMap100100Builder(Map instance)
Creates a builder that contains the passed instance | - -### Method Summary -| Modifier and Type | Method and Description | -| ----------------- | ---------------------- | -| [QueryParametersMap000100Builder](#queryparametersmap000100builder) | context(List value) | -| [QueryParametersMap100000Builder](#queryparametersmap100000builder) | pipe(List value) | - -## QueryParametersMap100101Builder -public class QueryParametersMap100101Builder
-builder for `Map` - -A class that builds the Map input type - -### Constructor Summary -| Constructor and Description | -| --------------------------- | -| QueryParametersMap100101Builder(Map instance)
Creates a builder that contains the passed instance | - -### Method Summary -| Modifier and Type | Method and Description | -| ----------------- | ---------------------- | -| [QueryParametersMap000101Builder](#queryparametersmap000101builder) | context(List value) | -| [QueryParametersMap100001Builder](#queryparametersmap100001builder) | pipe(List value) | -| [QueryParametersMap100100Builder](#queryparametersmap100100builder) | url(List value) | - -## QueryParametersMap100110Builder -public class QueryParametersMap100110Builder
-builder for `Map` - -A class that builds the Map input type - -### Constructor Summary -| Constructor and Description | -| --------------------------- | -| QueryParametersMap100110Builder(Map instance)
Creates a builder that contains the passed instance | - -### Method Summary -| Modifier and Type | Method and Description | -| ----------------- | ---------------------- | -| [QueryParametersMap000110Builder](#queryparametersmap000110builder) | context(List value) | -| [QueryParametersMap100010Builder](#queryparametersmap100010builder) | pipe(List value) | -| [QueryParametersMap100100Builder](#queryparametersmap100100builder) | refParam(String value) | - -## QueryParametersMap100111Builder -public class QueryParametersMap100111Builder
-builder for `Map` - -A class that builds the Map input type - -### Constructor Summary -| Constructor and Description | -| --------------------------- | -| QueryParametersMap100111Builder(Map instance)
Creates a builder that contains the passed instance | - -### Method Summary -| Modifier and Type | Method and Description | -| ----------------- | ---------------------- | -| [QueryParametersMap000111Builder](#queryparametersmap000111builder) | context(List value) | -| [QueryParametersMap100011Builder](#queryparametersmap100011builder) | pipe(List value) | -| [QueryParametersMap100101Builder](#queryparametersmap100101builder) | refParam(String value) | -| [QueryParametersMap100110Builder](#queryparametersmap100110builder) | url(List value) | - -## QueryParametersMap101000Builder -public class QueryParametersMap101000Builder
-builder for `Map` - -A class that builds the Map input type - -### Constructor Summary -| Constructor and Description | -| --------------------------- | -| QueryParametersMap101000Builder(Map instance)
Creates a builder that contains the passed instance | - -### Method Summary -| Modifier and Type | Method and Description | -| ----------------- | ---------------------- | -| [QueryParametersMap001000Builder](#queryparametersmap001000builder) | context(List value) | -| [QueryParametersMap100000Builder](#queryparametersmap100000builder) | ioutil(List value) | - -## QueryParametersMap101001Builder -public class QueryParametersMap101001Builder
-builder for `Map` - -A class that builds the Map input type - -### Constructor Summary -| Constructor and Description | -| --------------------------- | -| QueryParametersMap101001Builder(Map instance)
Creates a builder that contains the passed instance | - -### Method Summary -| Modifier and Type | Method and Description | -| ----------------- | ---------------------- | -| [QueryParametersMap001001Builder](#queryparametersmap001001builder) | context(List value) | -| [QueryParametersMap100001Builder](#queryparametersmap100001builder) | ioutil(List value) | -| [QueryParametersMap101000Builder](#queryparametersmap101000builder) | url(List value) | - -## QueryParametersMap101010Builder -public class QueryParametersMap101010Builder
-builder for `Map` - -A class that builds the Map input type - -### Constructor Summary -| Constructor and Description | -| --------------------------- | -| QueryParametersMap101010Builder(Map instance)
Creates a builder that contains the passed instance | - -### Method Summary -| Modifier and Type | Method and Description | -| ----------------- | ---------------------- | -| [QueryParametersMap001010Builder](#queryparametersmap001010builder) | context(List value) | -| [QueryParametersMap100010Builder](#queryparametersmap100010builder) | ioutil(List value) | -| [QueryParametersMap101000Builder](#queryparametersmap101000builder) | refParam(String value) | - -## QueryParametersMap101011Builder -public class QueryParametersMap101011Builder
-builder for `Map` - -A class that builds the Map input type - -### Constructor Summary -| Constructor and Description | -| --------------------------- | -| QueryParametersMap101011Builder(Map instance)
Creates a builder that contains the passed instance | - -### Method Summary -| Modifier and Type | Method and Description | -| ----------------- | ---------------------- | -| [QueryParametersMap001011Builder](#queryparametersmap001011builder) | context(List value) | -| [QueryParametersMap100011Builder](#queryparametersmap100011builder) | ioutil(List value) | -| [QueryParametersMap101001Builder](#queryparametersmap101001builder) | refParam(String value) | -| [QueryParametersMap101010Builder](#queryparametersmap101010builder) | url(List value) | - -## QueryParametersMap101100Builder -public class QueryParametersMap101100Builder
-builder for `Map` - -A class that builds the Map input type - -### Constructor Summary -| Constructor and Description | -| --------------------------- | -| QueryParametersMap101100Builder(Map instance)
Creates a builder that contains the passed instance | - -### Method Summary -| Modifier and Type | Method and Description | -| ----------------- | ---------------------- | -| [QueryParametersMap001100Builder](#queryparametersmap001100builder) | context(List value) | -| [QueryParametersMap100100Builder](#queryparametersmap100100builder) | ioutil(List value) | -| [QueryParametersMap101000Builder](#queryparametersmap101000builder) | pipe(List value) | - -## QueryParametersMap101101Builder -public class QueryParametersMap101101Builder
-builder for `Map` - -A class that builds the Map input type - -### Constructor Summary -| Constructor and Description | -| --------------------------- | -| QueryParametersMap101101Builder(Map instance)
Creates a builder that contains the passed instance | - -### Method Summary -| Modifier and Type | Method and Description | -| ----------------- | ---------------------- | -| [QueryParametersMap001101Builder](#queryparametersmap001101builder) | context(List value) | -| [QueryParametersMap100101Builder](#queryparametersmap100101builder) | ioutil(List value) | -| [QueryParametersMap101001Builder](#queryparametersmap101001builder) | pipe(List value) | -| [QueryParametersMap101100Builder](#queryparametersmap101100builder) | url(List value) | - -## QueryParametersMap101110Builder -public class QueryParametersMap101110Builder
-builder for `Map` - -A class that builds the Map input type - -### Constructor Summary -| Constructor and Description | -| --------------------------- | -| QueryParametersMap101110Builder(Map instance)
Creates a builder that contains the passed instance | - -### Method Summary -| Modifier and Type | Method and Description | -| ----------------- | ---------------------- | -| [QueryParametersMap001110Builder](#queryparametersmap001110builder) | context(List value) | -| [QueryParametersMap100110Builder](#queryparametersmap100110builder) | ioutil(List value) | -| [QueryParametersMap101010Builder](#queryparametersmap101010builder) | pipe(List value) | -| [QueryParametersMap101100Builder](#queryparametersmap101100builder) | refParam(String value) | - -## QueryParametersMap101111Builder -public class QueryParametersMap101111Builder
-builder for `Map` - -A class that builds the Map input type - -### Constructor Summary -| Constructor and Description | -| --------------------------- | -| QueryParametersMap101111Builder(Map instance)
Creates a builder that contains the passed instance | - -### Method Summary -| Modifier and Type | Method and Description | -| ----------------- | ---------------------- | -| [QueryParametersMap001111Builder](#queryparametersmap001111builder) | context(List value) | -| [QueryParametersMap100111Builder](#queryparametersmap100111builder) | ioutil(List value) | -| [QueryParametersMap101011Builder](#queryparametersmap101011builder) | pipe(List value) | -| [QueryParametersMap101101Builder](#queryparametersmap101101builder) | refParam(String value) | -| [QueryParametersMap101110Builder](#queryparametersmap101110builder) | url(List value) | - -## QueryParametersMap110000Builder -public class QueryParametersMap110000Builder
-builder for `Map` - -A class that builds the Map input type - -### Constructor Summary -| Constructor and Description | -| --------------------------- | -| QueryParametersMap110000Builder(Map instance)
Creates a builder that contains the passed instance | - -### Method Summary -| Modifier and Type | Method and Description | -| ----------------- | ---------------------- | -| [QueryParametersMap010000Builder](#queryparametersmap010000builder) | context(List value) | -| [QueryParametersMap100000Builder](#queryparametersmap100000builder) | http(List value) | - -## QueryParametersMap110001Builder -public class QueryParametersMap110001Builder
-builder for `Map` - -A class that builds the Map input type - -### Constructor Summary -| Constructor and Description | -| --------------------------- | -| QueryParametersMap110001Builder(Map instance)
Creates a builder that contains the passed instance | - -### Method Summary -| Modifier and Type | Method and Description | -| ----------------- | ---------------------- | -| [QueryParametersMap010001Builder](#queryparametersmap010001builder) | context(List value) | -| [QueryParametersMap100001Builder](#queryparametersmap100001builder) | http(List value) | -| [QueryParametersMap110000Builder](#queryparametersmap110000builder) | url(List value) | - -## QueryParametersMap110010Builder -public class QueryParametersMap110010Builder
-builder for `Map` - -A class that builds the Map input type - -### Constructor Summary -| Constructor and Description | -| --------------------------- | -| QueryParametersMap110010Builder(Map instance)
Creates a builder that contains the passed instance | - -### Method Summary -| Modifier and Type | Method and Description | -| ----------------- | ---------------------- | -| [QueryParametersMap010010Builder](#queryparametersmap010010builder) | context(List value) | -| [QueryParametersMap100010Builder](#queryparametersmap100010builder) | http(List value) | -| [QueryParametersMap110000Builder](#queryparametersmap110000builder) | refParam(String value) | - -## QueryParametersMap110011Builder -public class QueryParametersMap110011Builder
-builder for `Map` - -A class that builds the Map input type - -### Constructor Summary -| Constructor and Description | -| --------------------------- | -| QueryParametersMap110011Builder(Map instance)
Creates a builder that contains the passed instance | - -### Method Summary -| Modifier and Type | Method and Description | -| ----------------- | ---------------------- | -| [QueryParametersMap010011Builder](#queryparametersmap010011builder) | context(List value) | -| [QueryParametersMap100011Builder](#queryparametersmap100011builder) | http(List value) | -| [QueryParametersMap110001Builder](#queryparametersmap110001builder) | refParam(String value) | -| [QueryParametersMap110010Builder](#queryparametersmap110010builder) | url(List value) | - -## QueryParametersMap110100Builder -public class QueryParametersMap110100Builder
-builder for `Map` - -A class that builds the Map input type - -### Constructor Summary -| Constructor and Description | -| --------------------------- | -| QueryParametersMap110100Builder(Map instance)
Creates a builder that contains the passed instance | - -### Method Summary -| Modifier and Type | Method and Description | -| ----------------- | ---------------------- | -| [QueryParametersMap010100Builder](#queryparametersmap010100builder) | context(List value) | -| [QueryParametersMap100100Builder](#queryparametersmap100100builder) | http(List value) | -| [QueryParametersMap110000Builder](#queryparametersmap110000builder) | pipe(List value) | - -## QueryParametersMap110101Builder -public class QueryParametersMap110101Builder
-builder for `Map` - -A class that builds the Map input type - -### Constructor Summary -| Constructor and Description | -| --------------------------- | -| QueryParametersMap110101Builder(Map instance)
Creates a builder that contains the passed instance | - -### Method Summary -| Modifier and Type | Method and Description | -| ----------------- | ---------------------- | -| [QueryParametersMap010101Builder](#queryparametersmap010101builder) | context(List value) | -| [QueryParametersMap100101Builder](#queryparametersmap100101builder) | http(List value) | -| [QueryParametersMap110001Builder](#queryparametersmap110001builder) | pipe(List value) | -| [QueryParametersMap110100Builder](#queryparametersmap110100builder) | url(List value) | - -## QueryParametersMap110110Builder -public class QueryParametersMap110110Builder
-builder for `Map` - -A class that builds the Map input type - -### Constructor Summary -| Constructor and Description | -| --------------------------- | -| QueryParametersMap110110Builder(Map instance)
Creates a builder that contains the passed instance | - -### Method Summary -| Modifier and Type | Method and Description | -| ----------------- | ---------------------- | -| [QueryParametersMap010110Builder](#queryparametersmap010110builder) | context(List value) | -| [QueryParametersMap100110Builder](#queryparametersmap100110builder) | http(List value) | -| [QueryParametersMap110010Builder](#queryparametersmap110010builder) | pipe(List value) | -| [QueryParametersMap110100Builder](#queryparametersmap110100builder) | refParam(String value) | - -## QueryParametersMap110111Builder -public class QueryParametersMap110111Builder
-builder for `Map` - -A class that builds the Map input type - -### Constructor Summary -| Constructor and Description | -| --------------------------- | -| QueryParametersMap110111Builder(Map instance)
Creates a builder that contains the passed instance | - -### Method Summary -| Modifier and Type | Method and Description | -| ----------------- | ---------------------- | -| [QueryParametersMap010111Builder](#queryparametersmap010111builder) | context(List value) | -| [QueryParametersMap100111Builder](#queryparametersmap100111builder) | http(List value) | -| [QueryParametersMap110011Builder](#queryparametersmap110011builder) | pipe(List value) | -| [QueryParametersMap110101Builder](#queryparametersmap110101builder) | refParam(String value) | -| [QueryParametersMap110110Builder](#queryparametersmap110110builder) | url(List value) | - -## QueryParametersMap111000Builder -public class QueryParametersMap111000Builder
-builder for `Map` - -A class that builds the Map input type - -### Constructor Summary -| Constructor and Description | -| --------------------------- | -| QueryParametersMap111000Builder(Map instance)
Creates a builder that contains the passed instance | - -### Method Summary -| Modifier and Type | Method and Description | -| ----------------- | ---------------------- | -| [QueryParametersMap011000Builder](#queryparametersmap011000builder) | context(List value) | -| [QueryParametersMap101000Builder](#queryparametersmap101000builder) | http(List value) | -| [QueryParametersMap110000Builder](#queryparametersmap110000builder) | ioutil(List value) | - -## QueryParametersMap111001Builder -public class QueryParametersMap111001Builder
-builder for `Map` - -A class that builds the Map input type - -### Constructor Summary -| Constructor and Description | -| --------------------------- | -| QueryParametersMap111001Builder(Map instance)
Creates a builder that contains the passed instance | - -### Method Summary -| Modifier and Type | Method and Description | -| ----------------- | ---------------------- | -| [QueryParametersMap011001Builder](#queryparametersmap011001builder) | context(List value) | -| [QueryParametersMap101001Builder](#queryparametersmap101001builder) | http(List value) | -| [QueryParametersMap110001Builder](#queryparametersmap110001builder) | ioutil(List value) | -| [QueryParametersMap111000Builder](#queryparametersmap111000builder) | url(List value) | - -## QueryParametersMap111010Builder -public class QueryParametersMap111010Builder
-builder for `Map` - -A class that builds the Map input type - -### Constructor Summary -| Constructor and Description | -| --------------------------- | -| QueryParametersMap111010Builder(Map instance)
Creates a builder that contains the passed instance | - -### Method Summary -| Modifier and Type | Method and Description | -| ----------------- | ---------------------- | -| [QueryParametersMap011010Builder](#queryparametersmap011010builder) | context(List value) | -| [QueryParametersMap101010Builder](#queryparametersmap101010builder) | http(List value) | -| [QueryParametersMap110010Builder](#queryparametersmap110010builder) | ioutil(List value) | -| [QueryParametersMap111000Builder](#queryparametersmap111000builder) | refParam(String value) | - -## QueryParametersMap111011Builder -public class QueryParametersMap111011Builder
-builder for `Map` - -A class that builds the Map input type - -### Constructor Summary -| Constructor and Description | -| --------------------------- | -| QueryParametersMap111011Builder(Map instance)
Creates a builder that contains the passed instance | - -### Method Summary -| Modifier and Type | Method and Description | -| ----------------- | ---------------------- | -| [QueryParametersMap011011Builder](#queryparametersmap011011builder) | context(List value) | -| [QueryParametersMap101011Builder](#queryparametersmap101011builder) | http(List value) | -| [QueryParametersMap110011Builder](#queryparametersmap110011builder) | ioutil(List value) | -| [QueryParametersMap111001Builder](#queryparametersmap111001builder) | refParam(String value) | -| [QueryParametersMap111010Builder](#queryparametersmap111010builder) | url(List value) | - -## QueryParametersMap111100Builder -public class QueryParametersMap111100Builder
-builder for `Map` - -A class that builds the Map input type - -### Constructor Summary -| Constructor and Description | -| --------------------------- | -| QueryParametersMap111100Builder(Map instance)
Creates a builder that contains the passed instance | - -### Method Summary -| Modifier and Type | Method and Description | -| ----------------- | ---------------------- | -| [QueryParametersMap011100Builder](#queryparametersmap011100builder) | context(List value) | -| [QueryParametersMap101100Builder](#queryparametersmap101100builder) | http(List value) | -| [QueryParametersMap110100Builder](#queryparametersmap110100builder) | ioutil(List value) | -| [QueryParametersMap111000Builder](#queryparametersmap111000builder) | pipe(List value) | - -## QueryParametersMap111101Builder -public class QueryParametersMap111101Builder
-builder for `Map` - -A class that builds the Map input type - -### Constructor Summary -| Constructor and Description | -| --------------------------- | -| QueryParametersMap111101Builder(Map instance)
Creates a builder that contains the passed instance | - -### Method Summary -| Modifier and Type | Method and Description | -| ----------------- | ---------------------- | -| [QueryParametersMap011101Builder](#queryparametersmap011101builder) | context(List value) | -| [QueryParametersMap101101Builder](#queryparametersmap101101builder) | http(List value) | -| [QueryParametersMap110101Builder](#queryparametersmap110101builder) | ioutil(List value) | -| [QueryParametersMap111001Builder](#queryparametersmap111001builder) | pipe(List value) | -| [QueryParametersMap111100Builder](#queryparametersmap111100builder) | url(List value) | - -## QueryParametersMap111110Builder -public class QueryParametersMap111110Builder
-builder for `Map` - -A class that builds the Map input type - -### Constructor Summary -| Constructor and Description | -| --------------------------- | -| QueryParametersMap111110Builder(Map instance)
Creates a builder that contains the passed instance | - -### Method Summary -| Modifier and Type | Method and Description | -| ----------------- | ---------------------- | -| [QueryParametersMap011110Builder](#queryparametersmap011110builder) | context(List value) | -| [QueryParametersMap101110Builder](#queryparametersmap101110builder) | http(List value) | -| [QueryParametersMap110110Builder](#queryparametersmap110110builder) | ioutil(List value) | -| [QueryParametersMap111010Builder](#queryparametersmap111010builder) | pipe(List value) | -| [QueryParametersMap111100Builder](#queryparametersmap111100builder) | refParam(String value) | - -## QueryParametersMapBuilder -public class QueryParametersMapBuilder
-builder for `Map` - -A class that builds the Map input type - -### Constructor Summary -| Constructor and Description | -| --------------------------- | -| QueryParametersMapBuilder()
Creates a builder that contains an empty map | - -### Method Summary -| Modifier and Type | Method and Description | -| ----------------- | ---------------------- | -| [QueryParametersMap011111Builder](#queryparametersmap011111builder) | context(List value) | -| [QueryParametersMap101111Builder](#queryparametersmap101111builder) | http(List value) | -| [QueryParametersMap110111Builder](#queryparametersmap110111builder) | ioutil(List value) | -| [QueryParametersMap111011Builder](#queryparametersmap111011builder) | pipe(List value) | -| [QueryParametersMap111101Builder](#queryparametersmap111101builder) | refParam(String value) | -| [QueryParametersMap111110Builder](#queryparametersmap111110builder) | url(List value) | - -## QueryParametersMap -public static class QueryParametersMap
-extends FrozenMap - -A class to store validated Map payloads - -### Method Summary -| Modifier and Type | Method and Description | -| ----------------- | ---------------------- | -| static [QueryParametersMap](#queryparametersmap) | of([Map](#queryparametersmapbuilder) arg, SchemaConfiguration configuration) | -| [Schema4.SchemaList4](../../../paths/faketestqueryparamters/put/parameters/parameter4/Schema4.md#schemalist4) | context()
| -| [Schema2.SchemaList2](../../../paths/faketestqueryparamters/put/parameters/parameter2/Schema2.md#schemalist2) | http()
| -| [Schema1.SchemaList1](../../../paths/faketestqueryparamters/put/parameters/parameter1/Schema1.md#schemalist1) | ioutil()
| -| [Schema0.SchemaList0](../../../paths/faketestqueryparamters/put/parameters/parameter0/Schema0.md#schemalist0) | pipe()
| -| String | refParam()
| -| [Schema3.SchemaList3](../../../paths/faketestqueryparamters/put/parameters/parameter3/Schema3.md#schemalist3) | url()
| - -## 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(Nothing? data)
Creates an instance, private visibility | - -### Method Summary -| Modifier and Type | Method and Description | -| ----------------- | ---------------------- | -| Nothing? | 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/kotlin/docs/paths/faketestqueryparamters/put/FaketestqueryparamtersPutResponses.md b/samples/client/petstore/kotlin/docs/paths/faketestqueryparamters/put/FaketestqueryparamtersPutResponses.md deleted file mode 100644 index 6b0ed25e35f..00000000000 --- a/samples/client/petstore/kotlin/docs/paths/faketestqueryparamters/put/FaketestqueryparamtersPutResponses.md +++ /dev/null @@ -1,29 +0,0 @@ -# FaketestqueryparamtersPutResponses - -public class FaketestqueryparamtersPutResponses - -A class that contains necessary responses classes -- a sealed interface, EndpointResponse, that stores endpoint responses -- records for each endpoint response - -## Nested Class Summary -| Modifier and Type | Class and Description | -| ----------------- | --------------------- | -| sealed interface | [EndpointResponse](#endpointresponse)
stores the endpoint responses | -| record | [EndpointFaketestqueryparamtersPutCode200Response](#endpointfaketestqueryparamtersputcode200response)
the response for 200 | - -## EndpointResponse -public sealed interface EndpointResponse permits
-[EndpointFaketestqueryparamtersPutCode200Response](#endpointfaketestqueryparamtersputcode200response) - -a sealed interface that stores endpoint responses - -## EndpointFaketestqueryparamtersPutCode200Response -public record EndpointFaketestqueryparamtersPutCode200Response( - HttpResponse response, - Nothing? body, - Nothing? headers -) implements EndpointResponse, ApiResponse
- -a class that stores an endpoint response - diff --git a/samples/client/petstore/kotlin/docs/paths/faketestqueryparamters/put/parameters/parameter0/Schema0.md b/samples/client/petstore/kotlin/docs/paths/faketestqueryparamters/put/parameters/parameter0/Schema0.md deleted file mode 100644 index a4efd071e64..00000000000 --- a/samples/client/petstore/kotlin/docs/paths/faketestqueryparamters/put/parameters/parameter0/Schema0.md +++ /dev/null @@ -1,156 +0,0 @@ -# Schema0 -public class Schema0
- -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 list payloads, extends FrozenList -- classes to build inputs for list payloads - -## Nested Class Summary -| Modifier and Type | Class and Description | -| ----------------- | ---------------------- | -| sealed interface | [Schema0.Schema01Boxed](#schema01boxed)
sealed interface for validated payloads | -| record | [Schema0.Schema01BoxedList](#schema01boxedlist)
boxed class to store validated List payloads | -| static class | [Schema0.Schema01](#schema01)
schema class | -| static class | [Schema0.SchemaListBuilder0](#schemalistbuilder0)
builder for List payloads | -| static class | [Schema0.SchemaList0](#schemalist0)
output class for List payloads | -| sealed interface | [Schema0.Items0Boxed](#items0boxed)
sealed interface for validated payloads | -| record | [Schema0.Items0BoxedString](#items0boxedstring)
boxed class to store validated String payloads | -| static class | [Schema0.Items0](#items0)
schema class | - -## Schema01Boxed -public sealed interface Schema01Boxed
-permits
-[Schema01BoxedList](#schema01boxedlist) - -sealed interface that stores validated payloads using boxed classes - -## Schema01BoxedList -public record Schema01BoxedList
-implements [Schema01Boxed](#schema01boxed) - -record that stores validated List payloads, sealed permits implementation - -### Constructor Summary -| Constructor and Description | -| --------------------------- | -| Schema01BoxedList([SchemaList0](#schemalist0) data)
Creates an instance, private visibility | - -### Method Summary -| Modifier and Type | Method and Description | -| ----------------- | ---------------------- | -| [SchemaList0](#schemalist0) | data()
validated payload | -| @Nullable Object | getData()
validated payload | - -## Schema01 -public static class Schema01
-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.faketestqueryparamters.put.parameters.parameter0.Schema0; - -import java.util.Arrays; -import java.util.List; -import java.util.AbstractMap; - -static final SchemaConfiguration configuration = new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().build()); - -// List validation -Schema0.SchemaList0 validatedPayload = - Schema0.Schema01.validate( - new Schema0.SchemaListBuilder0() - .add("a") - - .build(), - configuration -); -``` - -### Field Summary -| Modifier and Type | Field and Description | -| ----------------- | ---------------------- | -| Set> | type = Set.of(List.class) | -| Class | items = [Items0.class](#items0) | - -### Method Summary -| Modifier and Type | Method and Description | -| ----------------- | ---------------------- | -| [SchemaList0](#schemalist0) | validate([List](#schemalistbuilder0) arg, SchemaConfiguration configuration) | -| [Schema01BoxedList](#schema01boxedlist) | validateAndBox([List](#schemalistbuilder0) arg, SchemaConfiguration configuration) | -| [Schema01Boxed](#schema01boxed) | validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) | -| @Nullable Object | validate(@Nullable Object arg, SchemaConfiguration configuration) | - -## SchemaListBuilder0 -public class SchemaListBuilder0
-builder for `List` - -A class that builds the List input type - -### Constructor Summary -| Constructor and Description | -| --------------------------- | -| SchemaListBuilder0()
Creates an empty list | -| SchemaListBuilder0(List items)
Stores the items in a list | - -### Method Summary -| Modifier and Type | Method and Description | -| ----------------- | ---------------------- | -| SchemaListBuilder0 | add(String item) | -| List | build()
Returns list input that should be used with Schema.validate | - -## SchemaList0 -public class SchemaList0
-extends `FrozenList` - -A class to store validated List payloads - -### Method Summary -| Modifier and Type | Method and Description | -| ----------------- | ---------------------- | -| static [SchemaList0](#schemalist0) | of([List](#schemalistbuilder0) arg, SchemaConfiguration configuration) | - -## Items0Boxed -public sealed interface Items0Boxed
-permits
-[Items0BoxedString](#items0boxedstring) - -sealed interface that stores validated payloads using boxed classes - -## Items0BoxedString -public record Items0BoxedString
-implements [Items0Boxed](#items0boxed) - -record that stores validated String payloads, sealed permits implementation - -### Constructor Summary -| Constructor and Description | -| --------------------------- | -| Items0BoxedString(String data)
Creates an instance, private visibility | - -### Method Summary -| Modifier and Type | Method and Description | -| ----------------- | ---------------------- | -| String | data()
validated payload | -| @Nullable Object | getData()
validated payload | - -## Items0 -public static class Items0
-extends StringJsonSchema.StringJsonSchema1 - -A schema class that validates payloads - -| Methods Inherited from class org.openapijsonschematools.client.schemas.StringJsonSchema.StringJsonSchema1 | -| ------------------------------------------------------------------ | -| validate | -| validateAndBox | diff --git a/samples/client/petstore/kotlin/docs/paths/faketestqueryparamters/put/parameters/parameter1/Schema1.md b/samples/client/petstore/kotlin/docs/paths/faketestqueryparamters/put/parameters/parameter1/Schema1.md deleted file mode 100644 index d0d8efab32e..00000000000 --- a/samples/client/petstore/kotlin/docs/paths/faketestqueryparamters/put/parameters/parameter1/Schema1.md +++ /dev/null @@ -1,156 +0,0 @@ -# Schema1 -public class Schema1
- -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 list payloads, extends FrozenList -- classes to build inputs for list payloads - -## Nested Class Summary -| Modifier and Type | Class and Description | -| ----------------- | ---------------------- | -| sealed interface | [Schema1.Schema11Boxed](#schema11boxed)
sealed interface for validated payloads | -| record | [Schema1.Schema11BoxedList](#schema11boxedlist)
boxed class to store validated List payloads | -| static class | [Schema1.Schema11](#schema11)
schema class | -| static class | [Schema1.SchemaListBuilder1](#schemalistbuilder1)
builder for List payloads | -| static class | [Schema1.SchemaList1](#schemalist1)
output class for List payloads | -| sealed interface | [Schema1.Items1Boxed](#items1boxed)
sealed interface for validated payloads | -| record | [Schema1.Items1BoxedString](#items1boxedstring)
boxed class to store validated String payloads | -| static class | [Schema1.Items1](#items1)
schema class | - -## Schema11Boxed -public sealed interface Schema11Boxed
-permits
-[Schema11BoxedList](#schema11boxedlist) - -sealed interface that stores validated payloads using boxed classes - -## Schema11BoxedList -public record Schema11BoxedList
-implements [Schema11Boxed](#schema11boxed) - -record that stores validated List payloads, sealed permits implementation - -### Constructor Summary -| Constructor and Description | -| --------------------------- | -| Schema11BoxedList([SchemaList1](#schemalist1) data)
Creates an instance, private visibility | - -### Method Summary -| Modifier and Type | Method and Description | -| ----------------- | ---------------------- | -| [SchemaList1](#schemalist1) | data()
validated payload | -| @Nullable Object | getData()
validated payload | - -## Schema11 -public static class Schema11
-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.faketestqueryparamters.put.parameters.parameter1.Schema1; - -import java.util.Arrays; -import java.util.List; -import java.util.AbstractMap; - -static final SchemaConfiguration configuration = new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().build()); - -// List validation -Schema1.SchemaList1 validatedPayload = - Schema1.Schema11.validate( - new Schema1.SchemaListBuilder1() - .add("a") - - .build(), - configuration -); -``` - -### Field Summary -| Modifier and Type | Field and Description | -| ----------------- | ---------------------- | -| Set> | type = Set.of(List.class) | -| Class | items = [Items1.class](#items1) | - -### Method Summary -| Modifier and Type | Method and Description | -| ----------------- | ---------------------- | -| [SchemaList1](#schemalist1) | validate([List](#schemalistbuilder1) arg, SchemaConfiguration configuration) | -| [Schema11BoxedList](#schema11boxedlist) | validateAndBox([List](#schemalistbuilder1) arg, SchemaConfiguration configuration) | -| [Schema11Boxed](#schema11boxed) | validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) | -| @Nullable Object | validate(@Nullable Object arg, SchemaConfiguration configuration) | - -## SchemaListBuilder1 -public class SchemaListBuilder1
-builder for `List` - -A class that builds the List input type - -### Constructor Summary -| Constructor and Description | -| --------------------------- | -| SchemaListBuilder1()
Creates an empty list | -| SchemaListBuilder1(List items)
Stores the items in a list | - -### Method Summary -| Modifier and Type | Method and Description | -| ----------------- | ---------------------- | -| SchemaListBuilder1 | add(String item) | -| List | build()
Returns list input that should be used with Schema.validate | - -## SchemaList1 -public class SchemaList1
-extends `FrozenList` - -A class to store validated List payloads - -### Method Summary -| Modifier and Type | Method and Description | -| ----------------- | ---------------------- | -| static [SchemaList1](#schemalist1) | of([List](#schemalistbuilder1) arg, SchemaConfiguration configuration) | - -## Items1Boxed -public sealed interface Items1Boxed
-permits
-[Items1BoxedString](#items1boxedstring) - -sealed interface that stores validated payloads using boxed classes - -## Items1BoxedString -public record Items1BoxedString
-implements [Items1Boxed](#items1boxed) - -record that stores validated String payloads, sealed permits implementation - -### Constructor Summary -| Constructor and Description | -| --------------------------- | -| Items1BoxedString(String data)
Creates an instance, private visibility | - -### Method Summary -| Modifier and Type | Method and Description | -| ----------------- | ---------------------- | -| String | data()
validated payload | -| @Nullable Object | getData()
validated payload | - -## Items1 -public static class Items1
-extends StringJsonSchema.StringJsonSchema1 - -A schema class that validates payloads - -| Methods Inherited from class org.openapijsonschematools.client.schemas.StringJsonSchema.StringJsonSchema1 | -| ------------------------------------------------------------------ | -| validate | -| validateAndBox | diff --git a/samples/client/petstore/kotlin/docs/paths/faketestqueryparamters/put/parameters/parameter2/Schema2.md b/samples/client/petstore/kotlin/docs/paths/faketestqueryparamters/put/parameters/parameter2/Schema2.md deleted file mode 100644 index 3357a64749a..00000000000 --- a/samples/client/petstore/kotlin/docs/paths/faketestqueryparamters/put/parameters/parameter2/Schema2.md +++ /dev/null @@ -1,156 +0,0 @@ -# Schema2 -public class Schema2
- -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 list payloads, extends FrozenList -- classes to build inputs for list payloads - -## Nested Class Summary -| Modifier and Type | Class and Description | -| ----------------- | ---------------------- | -| sealed interface | [Schema2.Schema21Boxed](#schema21boxed)
sealed interface for validated payloads | -| record | [Schema2.Schema21BoxedList](#schema21boxedlist)
boxed class to store validated List payloads | -| static class | [Schema2.Schema21](#schema21)
schema class | -| static class | [Schema2.SchemaListBuilder2](#schemalistbuilder2)
builder for List payloads | -| static class | [Schema2.SchemaList2](#schemalist2)
output class for List payloads | -| sealed interface | [Schema2.Items2Boxed](#items2boxed)
sealed interface for validated payloads | -| record | [Schema2.Items2BoxedString](#items2boxedstring)
boxed class to store validated String payloads | -| static class | [Schema2.Items2](#items2)
schema class | - -## Schema21Boxed -public sealed interface Schema21Boxed
-permits
-[Schema21BoxedList](#schema21boxedlist) - -sealed interface that stores validated payloads using boxed classes - -## Schema21BoxedList -public record Schema21BoxedList
-implements [Schema21Boxed](#schema21boxed) - -record that stores validated List payloads, sealed permits implementation - -### Constructor Summary -| Constructor and Description | -| --------------------------- | -| Schema21BoxedList([SchemaList2](#schemalist2) data)
Creates an instance, private visibility | - -### Method Summary -| Modifier and Type | Method and Description | -| ----------------- | ---------------------- | -| [SchemaList2](#schemalist2) | data()
validated payload | -| @Nullable Object | getData()
validated payload | - -## Schema21 -public static class Schema21
-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.faketestqueryparamters.put.parameters.parameter2.Schema2; - -import java.util.Arrays; -import java.util.List; -import java.util.AbstractMap; - -static final SchemaConfiguration configuration = new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().build()); - -// List validation -Schema2.SchemaList2 validatedPayload = - Schema2.Schema21.validate( - new Schema2.SchemaListBuilder2() - .add("a") - - .build(), - configuration -); -``` - -### Field Summary -| Modifier and Type | Field and Description | -| ----------------- | ---------------------- | -| Set> | type = Set.of(List.class) | -| Class | items = [Items2.class](#items2) | - -### Method Summary -| Modifier and Type | Method and Description | -| ----------------- | ---------------------- | -| [SchemaList2](#schemalist2) | validate([List](#schemalistbuilder2) arg, SchemaConfiguration configuration) | -| [Schema21BoxedList](#schema21boxedlist) | validateAndBox([List](#schemalistbuilder2) arg, SchemaConfiguration configuration) | -| [Schema21Boxed](#schema21boxed) | validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) | -| @Nullable Object | validate(@Nullable Object arg, SchemaConfiguration configuration) | - -## SchemaListBuilder2 -public class SchemaListBuilder2
-builder for `List` - -A class that builds the List input type - -### Constructor Summary -| Constructor and Description | -| --------------------------- | -| SchemaListBuilder2()
Creates an empty list | -| SchemaListBuilder2(List items)
Stores the items in a list | - -### Method Summary -| Modifier and Type | Method and Description | -| ----------------- | ---------------------- | -| SchemaListBuilder2 | add(String item) | -| List | build()
Returns list input that should be used with Schema.validate | - -## SchemaList2 -public class SchemaList2
-extends `FrozenList` - -A class to store validated List payloads - -### Method Summary -| Modifier and Type | Method and Description | -| ----------------- | ---------------------- | -| static [SchemaList2](#schemalist2) | of([List](#schemalistbuilder2) arg, SchemaConfiguration configuration) | - -## Items2Boxed -public sealed interface Items2Boxed
-permits
-[Items2BoxedString](#items2boxedstring) - -sealed interface that stores validated payloads using boxed classes - -## Items2BoxedString -public record Items2BoxedString
-implements [Items2Boxed](#items2boxed) - -record that stores validated String payloads, sealed permits implementation - -### Constructor Summary -| Constructor and Description | -| --------------------------- | -| Items2BoxedString(String data)
Creates an instance, private visibility | - -### Method Summary -| Modifier and Type | Method and Description | -| ----------------- | ---------------------- | -| String | data()
validated payload | -| @Nullable Object | getData()
validated payload | - -## Items2 -public static class Items2
-extends StringJsonSchema.StringJsonSchema1 - -A schema class that validates payloads - -| Methods Inherited from class org.openapijsonschematools.client.schemas.StringJsonSchema.StringJsonSchema1 | -| ------------------------------------------------------------------ | -| validate | -| validateAndBox | diff --git a/samples/client/petstore/kotlin/docs/paths/faketestqueryparamters/put/parameters/parameter3/Schema3.md b/samples/client/petstore/kotlin/docs/paths/faketestqueryparamters/put/parameters/parameter3/Schema3.md deleted file mode 100644 index cede783379d..00000000000 --- a/samples/client/petstore/kotlin/docs/paths/faketestqueryparamters/put/parameters/parameter3/Schema3.md +++ /dev/null @@ -1,156 +0,0 @@ -# Schema3 -public class Schema3
- -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 list payloads, extends FrozenList -- classes to build inputs for list payloads - -## Nested Class Summary -| Modifier and Type | Class and Description | -| ----------------- | ---------------------- | -| sealed interface | [Schema3.Schema31Boxed](#schema31boxed)
sealed interface for validated payloads | -| record | [Schema3.Schema31BoxedList](#schema31boxedlist)
boxed class to store validated List payloads | -| static class | [Schema3.Schema31](#schema31)
schema class | -| static class | [Schema3.SchemaListBuilder3](#schemalistbuilder3)
builder for List payloads | -| static class | [Schema3.SchemaList3](#schemalist3)
output class for List payloads | -| sealed interface | [Schema3.Items3Boxed](#items3boxed)
sealed interface for validated payloads | -| record | [Schema3.Items3BoxedString](#items3boxedstring)
boxed class to store validated String payloads | -| static class | [Schema3.Items3](#items3)
schema class | - -## Schema31Boxed -public sealed interface Schema31Boxed
-permits
-[Schema31BoxedList](#schema31boxedlist) - -sealed interface that stores validated payloads using boxed classes - -## Schema31BoxedList -public record Schema31BoxedList
-implements [Schema31Boxed](#schema31boxed) - -record that stores validated List payloads, sealed permits implementation - -### Constructor Summary -| Constructor and Description | -| --------------------------- | -| Schema31BoxedList([SchemaList3](#schemalist3) data)
Creates an instance, private visibility | - -### Method Summary -| Modifier and Type | Method and Description | -| ----------------- | ---------------------- | -| [SchemaList3](#schemalist3) | data()
validated payload | -| @Nullable Object | getData()
validated payload | - -## Schema31 -public static class Schema31
-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.faketestqueryparamters.put.parameters.parameter3.Schema3; - -import java.util.Arrays; -import java.util.List; -import java.util.AbstractMap; - -static final SchemaConfiguration configuration = new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().build()); - -// List validation -Schema3.SchemaList3 validatedPayload = - Schema3.Schema31.validate( - new Schema3.SchemaListBuilder3() - .add("a") - - .build(), - configuration -); -``` - -### Field Summary -| Modifier and Type | Field and Description | -| ----------------- | ---------------------- | -| Set> | type = Set.of(List.class) | -| Class | items = [Items3.class](#items3) | - -### Method Summary -| Modifier and Type | Method and Description | -| ----------------- | ---------------------- | -| [SchemaList3](#schemalist3) | validate([List](#schemalistbuilder3) arg, SchemaConfiguration configuration) | -| [Schema31BoxedList](#schema31boxedlist) | validateAndBox([List](#schemalistbuilder3) arg, SchemaConfiguration configuration) | -| [Schema31Boxed](#schema31boxed) | validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) | -| @Nullable Object | validate(@Nullable Object arg, SchemaConfiguration configuration) | - -## SchemaListBuilder3 -public class SchemaListBuilder3
-builder for `List` - -A class that builds the List input type - -### Constructor Summary -| Constructor and Description | -| --------------------------- | -| SchemaListBuilder3()
Creates an empty list | -| SchemaListBuilder3(List items)
Stores the items in a list | - -### Method Summary -| Modifier and Type | Method and Description | -| ----------------- | ---------------------- | -| SchemaListBuilder3 | add(String item) | -| List | build()
Returns list input that should be used with Schema.validate | - -## SchemaList3 -public class SchemaList3
-extends `FrozenList` - -A class to store validated List payloads - -### Method Summary -| Modifier and Type | Method and Description | -| ----------------- | ---------------------- | -| static [SchemaList3](#schemalist3) | of([List](#schemalistbuilder3) arg, SchemaConfiguration configuration) | - -## Items3Boxed -public sealed interface Items3Boxed
-permits
-[Items3BoxedString](#items3boxedstring) - -sealed interface that stores validated payloads using boxed classes - -## Items3BoxedString -public record Items3BoxedString
-implements [Items3Boxed](#items3boxed) - -record that stores validated String payloads, sealed permits implementation - -### Constructor Summary -| Constructor and Description | -| --------------------------- | -| Items3BoxedString(String data)
Creates an instance, private visibility | - -### Method Summary -| Modifier and Type | Method and Description | -| ----------------- | ---------------------- | -| String | data()
validated payload | -| @Nullable Object | getData()
validated payload | - -## Items3 -public static class Items3
-extends StringJsonSchema.StringJsonSchema1 - -A schema class that validates payloads - -| Methods Inherited from class org.openapijsonschematools.client.schemas.StringJsonSchema.StringJsonSchema1 | -| ------------------------------------------------------------------ | -| validate | -| validateAndBox | diff --git a/samples/client/petstore/kotlin/docs/paths/faketestqueryparamters/put/parameters/parameter4/Schema4.md b/samples/client/petstore/kotlin/docs/paths/faketestqueryparamters/put/parameters/parameter4/Schema4.md deleted file mode 100644 index 17c3da4dab2..00000000000 --- a/samples/client/petstore/kotlin/docs/paths/faketestqueryparamters/put/parameters/parameter4/Schema4.md +++ /dev/null @@ -1,156 +0,0 @@ -# Schema4 -public class Schema4
- -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 list payloads, extends FrozenList -- classes to build inputs for list payloads - -## Nested Class Summary -| Modifier and Type | Class and Description | -| ----------------- | ---------------------- | -| sealed interface | [Schema4.Schema41Boxed](#schema41boxed)
sealed interface for validated payloads | -| record | [Schema4.Schema41BoxedList](#schema41boxedlist)
boxed class to store validated List payloads | -| static class | [Schema4.Schema41](#schema41)
schema class | -| static class | [Schema4.SchemaListBuilder4](#schemalistbuilder4)
builder for List payloads | -| static class | [Schema4.SchemaList4](#schemalist4)
output class for List payloads | -| sealed interface | [Schema4.Items4Boxed](#items4boxed)
sealed interface for validated payloads | -| record | [Schema4.Items4BoxedString](#items4boxedstring)
boxed class to store validated String payloads | -| static class | [Schema4.Items4](#items4)
schema class | - -## Schema41Boxed -public sealed interface Schema41Boxed
-permits
-[Schema41BoxedList](#schema41boxedlist) - -sealed interface that stores validated payloads using boxed classes - -## Schema41BoxedList -public record Schema41BoxedList
-implements [Schema41Boxed](#schema41boxed) - -record that stores validated List payloads, sealed permits implementation - -### Constructor Summary -| Constructor and Description | -| --------------------------- | -| Schema41BoxedList([SchemaList4](#schemalist4) data)
Creates an instance, private visibility | - -### Method Summary -| Modifier and Type | Method and Description | -| ----------------- | ---------------------- | -| [SchemaList4](#schemalist4) | data()
validated payload | -| @Nullable Object | getData()
validated payload | - -## Schema41 -public static class Schema41
-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.faketestqueryparamters.put.parameters.parameter4.Schema4; - -import java.util.Arrays; -import java.util.List; -import java.util.AbstractMap; - -static final SchemaConfiguration configuration = new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().build()); - -// List validation -Schema4.SchemaList4 validatedPayload = - Schema4.Schema41.validate( - new Schema4.SchemaListBuilder4() - .add("a") - - .build(), - configuration -); -``` - -### Field Summary -| Modifier and Type | Field and Description | -| ----------------- | ---------------------- | -| Set> | type = Set.of(List.class) | -| Class | items = [Items4.class](#items4) | - -### Method Summary -| Modifier and Type | Method and Description | -| ----------------- | ---------------------- | -| [SchemaList4](#schemalist4) | validate([List](#schemalistbuilder4) arg, SchemaConfiguration configuration) | -| [Schema41BoxedList](#schema41boxedlist) | validateAndBox([List](#schemalistbuilder4) arg, SchemaConfiguration configuration) | -| [Schema41Boxed](#schema41boxed) | validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) | -| @Nullable Object | validate(@Nullable Object arg, SchemaConfiguration configuration) | - -## SchemaListBuilder4 -public class SchemaListBuilder4
-builder for `List` - -A class that builds the List input type - -### Constructor Summary -| Constructor and Description | -| --------------------------- | -| SchemaListBuilder4()
Creates an empty list | -| SchemaListBuilder4(List items)
Stores the items in a list | - -### Method Summary -| Modifier and Type | Method and Description | -| ----------------- | ---------------------- | -| SchemaListBuilder4 | add(String item) | -| List | build()
Returns list input that should be used with Schema.validate | - -## SchemaList4 -public class SchemaList4
-extends `FrozenList` - -A class to store validated List payloads - -### Method Summary -| Modifier and Type | Method and Description | -| ----------------- | ---------------------- | -| static [SchemaList4](#schemalist4) | of([List](#schemalistbuilder4) arg, SchemaConfiguration configuration) | - -## Items4Boxed -public sealed interface Items4Boxed
-permits
-[Items4BoxedString](#items4boxedstring) - -sealed interface that stores validated payloads using boxed classes - -## Items4BoxedString -public record Items4BoxedString
-implements [Items4Boxed](#items4boxed) - -record that stores validated String payloads, sealed permits implementation - -### Constructor Summary -| Constructor and Description | -| --------------------------- | -| Items4BoxedString(String data)
Creates an instance, private visibility | - -### Method Summary -| Modifier and Type | Method and Description | -| ----------------- | ---------------------- | -| String | data()
validated payload | -| @Nullable Object | getData()
validated payload | - -## Items4 -public static class Items4
-extends StringJsonSchema.StringJsonSchema1 - -A schema class that validates payloads - -| Methods Inherited from class org.openapijsonschematools.client.schemas.StringJsonSchema.StringJsonSchema1 | -| ------------------------------------------------------------------ | -| validate | -| validateAndBox | diff --git a/samples/client/petstore/kotlin/docs/paths/faketestqueryparamters/put/parameters/parameter5/Schema5.md b/samples/client/petstore/kotlin/docs/paths/faketestqueryparamters/put/parameters/parameter5/Schema5.md deleted file mode 100644 index f566af62cf0..00000000000 --- a/samples/client/petstore/kotlin/docs/paths/faketestqueryparamters/put/parameters/parameter5/Schema5.md +++ /dev/null @@ -1,19 +0,0 @@ -# Schema5 -public class Schema5
-extends [StringWithValidation1](../../../components/schemas/StringWithValidation.md#stringwithvalidation) - -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 - -## Nested Class Summary -| Modifier and Type | Class and Description | -| ----------------- | ---------------------- | -| static class | [Schema5.Schema51](#schema51)
schema class | - -## Schema51 -public static class Schema51
-extends [StringWithValidation.StringWithValidation1](../../../components/schemas/StringWithValidation.md#stringwithvalidation1) - -A schema class that validates payloads diff --git a/samples/client/petstore/kotlin/docs/paths/faketestqueryparamters/put/responses/FaketestqueryparamtersPutCode200Response.md b/samples/client/petstore/kotlin/docs/paths/faketestqueryparamters/put/responses/FaketestqueryparamtersPutCode200Response.md deleted file mode 100644 index 078eb74fdbe..00000000000 --- a/samples/client/petstore/kotlin/docs/paths/faketestqueryparamters/put/responses/FaketestqueryparamtersPutCode200Response.md +++ /dev/null @@ -1,17 +0,0 @@ -# FaketestqueryparamtersPutCode200Response - -public class FaketestqueryparamtersPutCode200Response extends [SuccessDescriptionOnly](../../components/responses/SuccessDescriptionOnly.md) - -A class (extended from the $ref class) that contains necessary nested response classes -- a class that extends ResponseDeserializer and is used to deserialize responses - -## Nested Class Summary -| Modifier and Type | Class and Description | -| ----------------- | --------------------- | -| static class | [FaketestqueryparamtersPutCode200Response.FaketestqueryparamtersPutCode200Response1](#faketestqueryparamtersputcode200response1)
class that deserializes responses | - -## FaketestqueryparamtersPutCode200Response1 -public static class FaketestqueryparamtersPutCode200Response1 extends [SuccessDescriptionOnly1](../../components/responses/SuccessDescriptionOnly.md#successdescriptiononly1)
- -a class that deserializes responses, extended from the $ref class - diff --git a/samples/client/petstore/kotlin/docs/paths/fakeuploaddownloadfile/FakeuploaddownloadfilePost.md b/samples/client/petstore/kotlin/docs/paths/fakeuploaddownloadfile/FakeuploaddownloadfilePost.md deleted file mode 100644 index 70ad30f02e8..00000000000 --- a/samples/client/petstore/kotlin/docs/paths/fakeuploaddownloadfile/FakeuploaddownloadfilePost.md +++ /dev/null @@ -1,184 +0,0 @@ -# FakeuploaddownloadfilePost - -public class FakeuploaddownloadfilePost - -A class that contains necessary endpoint classes -- a class that calls the endpoint method using the http verb -- a class that calls the endpoint method using the operationId name -- class(es) to store the request inputs -- builder(s) to set the request input data - -## Nested Class Summary -| Modifier and Type | Class and Description | -| ----------------- | --------------------- | -| static class | [Post](#post)
The class that has a post method to call the endpoint | -| interface | [UploadDownloadFileOperation](#uploaddownloadfileoperation)
The interface that has a uploadDownloadFile method to call the endpoint | -| static class | [PostRequest](#postrequest)
The final request inputs class | -| static class | [PostNullableRequest](#postnullablerequest)
The initial request inputs class | -| static class | [Post0RequestBuilder](#post0requestbuilder)
A builder for the request input class | -| static class | [PostRequestBuilder](#postrequestbuilder)
A builder for the request input class | - -## Post -public static class Post 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.fakeuploaddownloadfile.post.FakeuploaddownloadfilePostRequestBody; -import org.openapijsonschematools.client.paths.fakeuploaddownloadfile.post.requestbody.content.applicationoctetstream.ApplicationoctetstreamSchema; -import org.openapijsonschematools.client.servers.RootServer0; -import org.openapijsonschematools.client.servers.RootServer1; -import org.openapijsonschematools.client.servers.RootServer2; -import org.openapijsonschematools.client.paths.fakeuploaddownloadfile.post.responses.FakeuploaddownloadfilePostCode200Response; -import org.openapijsonschematools.client.servers.RootServerInfo; -import org.openapijsonschematools.client.paths.fakeuploaddownloadfile.FakeuploaddownloadfilePost; -import org.openapijsonschematools.client.paths.fakeuploaddownloadfile.post.FakeuploaddownloadfilePostResponses; - -import java.io.IOException; -import java.util.Arrays; -import java.util.List; -import java.util.Map; -import java.util.AbstractMap; - -// if you want to use a server that is not SERVER_0 pass it in here and change the ServerIndex input below -ApiConfiguration.ServerInfo serverInfo = new ApiConfiguration.ServerInfoBuilder() - .rootServerInfo( - new RootServerInfo.RootServerInfoBuilder() - .rootServer0(new RootServer0()) - .build() - ) - .build(); -ApiConfiguration.ServerIndexInfo serverIndexInfo = new ApiConfiguration.ServerIndexInfoBuilder() - .rootServerInfoServerIndex(RootServerInfo.ServerIndex.SERVER_0) - .build(); -Duration timeout = Duration.ofSeconds(1L); -Map> defaultHeaders = Map.of("User-Agent", List.of("OpenAPI-JSON-Schema-Generator/1.0.0/java")); -ApiConfiguration apiConfiguration = new ApiConfiguration( - serverInfo - serverIndexInfo, - timeout, - defaultHeaders -); -SchemaConfiguration schemaConfiguration = new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().build()); -FakeuploaddownloadfilePost.Post apiClient = new FakeuploaddownloadfilePost.Post(apiConfiguration, schemaConfiguration); - - -ApplicationoctetstreamSchema1BoxedString requestBodyPayload = ApplicationoctetstreamSchema.ApplicationoctetstreamSchema1.validateAndBox( - "a", - schemaConfiguration -); -FakeuploaddownloadfilePost.SealedRequestBody requestBody = new FakeuploaddownloadfilePost.ApplicationoctetstreamRequestBody(requestBodyPayload); - -var request = new FakeuploaddownloadfilePost.PostRequestBuilder() - .requestBody(requestBody) - .build(); - -FakeuploaddownloadfilePostResponses.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; -} -FakeuploaddownloadfilePostResponses.EndpointFakeuploaddownloadfilePostCode200Response castResponse = (FakeuploaddownloadfilePostResponses.EndpointFakeuploaddownloadfilePostCode200Response) response; -FakeuploaddownloadfilePostCode200Response.ApplicationoctetstreamResponseBody deserializedBody = (FakeuploaddownloadfilePostCode200Response.ApplicationoctetstreamResponseBody) castResponse.body; -// handle deserialized body here -``` -### Constructor Summary -| Constructor and Description | -| --------------------------- | -| Post(ApiConfiguration apiConfiguration, SchemaConfiguration schemaConfiguration)
Creates an instance | - -### Method Summary -| Modifier and Type | Method and Description | -| ----------------- | ---------------------- | -| [FakeuploaddownloadfilePostResponses.EndpointResponse](../../paths/fakeuploaddownloadfile/post/FakeuploaddownloadfilePostResponses.md#endpointresponse) | post([PostRequest](#postrequest) request) | - -## UploadDownloadFileOperation -public interface UploadDownloadFileOperation
- -an interface that allows one to call the endpoint using a method named uploadDownloadFile by the operationId - -### Method Summary -| Modifier and Type | Method and Description | -| ----------------- | ---------------------- | -| [FakeuploaddownloadfilePostResponses.EndpointResponse](../../paths/fakeuploaddownloadfile/post/FakeuploaddownloadfilePostResponses.md#endpointresponse) | uploadDownloadFile([PostRequest](#postrequest) request) | - -## PostRequest -public static class PostRequest
- -a class that stores the final request inputs - -### Field Summary -| Modifier and Type | Field and Description | -| ----------------- | --------------------- | -| [FakeuploaddownloadfilePostRequestBody.SealedRequestBody](../../paths/fakeuploaddownloadfile/post/FakeuploaddownloadfilePostRequestBody.md#sealedrequestbody) | requestBody | -| [RootServerInfo.@Nullable ServerIndex](../../RootServerInfo.md#serverindex) | serverIndex
optional. Note: this will override the value in apiConfiguration | -| @Nullable Duration | timeout
optional. Note: this will override the value in apiConfiguration | - -## PostNullableRequest -public static class PostNullableRequest
- -a class that stores the initial request inputs - -### Field Summary -| Modifier and Type | Field and Description | -| ----------------- | --------------------- | -| [FakeuploaddownloadfilePostRequestBody.@Nullable SealedRequestBody](../../paths/fakeuploaddownloadfile/post/FakeuploaddownloadfilePostRequestBody.md#sealedrequestbody) | requestBody | -| [RootServerInfo.@Nullable ServerIndex](../../RootServerInfo.md#serverindex) | serverIndex | -| @Nullable Duration | timeout | - -## Post0RequestBuilder -public static class Post0RequestBuilder
- -a builder for request inputs - -### Constructor Summary -| Constructor and Description | -| --------------------------- | -| Post0RequestBuilder(Post0RequestBuilder instance)
Creates a builder that contains the passed instance | - -### Method Summary -| Modifier and Type | Method and Description | -| ----------------- | ---------------------- | -| [PostRequest](#postrequest) | build()
Returns the request input used to call an endpoint method | -| [Post0RequestBuilder](#post0requestbuilder) | serverIndex([RootServerInfo.ServerIndex](../../RootServerInfo.md#serverindex) serverIndex)
sets the optional property. Note: this will override the value in apiConfiguration | -| [Post0RequestBuilder](#post0requestbuilder) | timeout(Duration timeout)
sets the optional property. Note: this will override the value in apiConfiguration | - -## PostRequestBuilder -public static class PostRequestBuilder
- -a builder for request inputs - -### Constructor Summary -| Constructor and Description | -| --------------------------- | -| PostRequestBuilder()
Creates a builder that contains null for all parameters | - -### Method Summary -| Modifier and Type | Method and Description | -| ----------------- | ---------------------- | -| [Post0RequestBuilder](#post0requestbuilder) | requestBody([FakeuploaddownloadfilePostRequestBody.SealedRequestBody](../../paths/fakeuploaddownloadfile/post/FakeuploaddownloadfilePostRequestBody.md#sealedrequestbody) requestBody)
sets the property | - -[[Back to top]](#top) [[Back to README]](../../../README.md) diff --git a/samples/client/petstore/kotlin/docs/paths/fakeuploaddownloadfile/post/FakeuploaddownloadfilePostRequestBody.md b/samples/client/petstore/kotlin/docs/paths/fakeuploaddownloadfile/post/FakeuploaddownloadfilePostRequestBody.md deleted file mode 100644 index cf48f85a1f1..00000000000 --- a/samples/client/petstore/kotlin/docs/paths/fakeuploaddownloadfile/post/FakeuploaddownloadfilePostRequestBody.md +++ /dev/null @@ -1,90 +0,0 @@ -# FakeuploaddownloadfilePostRequestBody - -public class FakeuploaddownloadfilePostRequestBody - -A class that contains necessary nested request body classes -- SealedMediaType, a sealed interface which contains all the schema/encoding info for each contentType -- records which implement SealedMediaType, the concrete media types -- a class that extends RequestBodySerializer and is used to serialize input SealedRequestBody instances -- SealedRequestBody, a sealed interface which contains all the contentType/schema input types -- records which implement SealedRequestBody, the concrete request body types - -## Nested Class Summary -| Modifier and Type | Class and Description | -| ----------------- | --------------------- | -| sealed interface | [FakeuploaddownloadfilePostRequestBody.SealedMediaType](#sealedmediatype)
media type sealed interface | -| record | [FakeuploaddownloadfilePostRequestBody.ApplicationoctetstreamMediaType](#applicationoctetstreammediatype)
record storing schema + encoding for a specific contentType | -| static class | [FakeuploaddownloadfilePostRequestBody.FakeuploaddownloadfilePostRequestBody1](#fakeuploaddownloadfilepostrequestbody1)
class that serializes request bodies | -| sealed interface | [FakeuploaddownloadfilePostRequestBody.SealedRequestBody](#sealedrequestbody)
request body sealed interface | -| record | [FakeuploaddownloadfilePostRequestBody.ApplicationoctetstreamRequestBody](#applicationoctetstreamrequestbody)
implements sealed interface to store request body input | - -## SealedMediaType -public sealed interface SealedMediaType
-permits
-[ApplicationoctetstreamMediaType](#applicationoctetstreammediatype) - -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), Nothing?> - -class storing schema info for a specific contentType - -### Constructor Summary -| Constructor and Description | -| --------------------------- | -| ApplicationoctetstreamMediaType()
Creates an instance | - -### 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 | -| Nothing? | encoding()
the encoding info | - -## FakeuploaddownloadfilePostRequestBody1 -public static class FakeuploaddownloadfilePostRequestBody1
- -a class that serializes SealedRequestBody request bodies - -### Constructor Summary -| Constructor and Description | -| --------------------------- | -| FakeuploaddownloadfilePostRequestBody1()
Creates an instance | - -### Field Summary -| Modifier and Type | Field and Description | -| ----------------- | --------------------- | -| boolean | required = true
whether the request body is required | -| Map | content = Map.ofEntries(
    new AbstractMap.SimpleEntry<>("application/octet-stream", new [ApplicationoctetstreamMediaType](#applicationoctetstreammediatype)())
)
the contentType to schema info | - -### Method Summary -| Modifier and Type | Method and Description | -| ----------------- | ---------------------- | -| SerializedRequestBody | serialize([SealedRequestBody](#sealedrequestbody) requestBody)
called by endpoint when creating request body bytes | - -## SealedRequestBody -public sealed interface SealedRequestBody
-permits
-[ApplicationoctetstreamRequestBody](#applicationoctetstreamrequestbody) - -sealed interface that stores request contentType + validated schema data - -## ApplicationoctetstreamRequestBody -public record ApplicationoctetstreamRequestBody
-implements [SealedRequestBody](#sealedrequestbody),
-GenericRequestBody
- -A record class to store request body input for contentType="application/octet-stream" - -### Constructor Summary -| Constructor and Description | -| --------------------------- | -| ApplicationoctetstreamRequestBody(ApplicationoctetstreamSchema.StringJsonSchema1Boxed body)
Creates an instance | - -### Method Summary -| Modifier and Type | Method and Description | -| ----------------- | ---------------------- | -| String | contentType()
always returns "application/octet-stream" | -| ApplicationoctetstreamSchema.StringJsonSchema1Boxed | body()
returns the body passed in in the constructor | diff --git a/samples/client/petstore/kotlin/docs/paths/fakeuploaddownloadfile/post/FakeuploaddownloadfilePostResponses.md b/samples/client/petstore/kotlin/docs/paths/fakeuploaddownloadfile/post/FakeuploaddownloadfilePostResponses.md deleted file mode 100644 index 1bf87111739..00000000000 --- a/samples/client/petstore/kotlin/docs/paths/fakeuploaddownloadfile/post/FakeuploaddownloadfilePostResponses.md +++ /dev/null @@ -1,29 +0,0 @@ -# FakeuploaddownloadfilePostResponses - -public class FakeuploaddownloadfilePostResponses - -A class that contains necessary responses classes -- a sealed interface, EndpointResponse, that stores endpoint responses -- records for each endpoint response - -## Nested Class Summary -| Modifier and Type | Class and Description | -| ----------------- | --------------------- | -| sealed interface | [EndpointResponse](#endpointresponse)
stores the endpoint responses | -| record | [EndpointFakeuploaddownloadfilePostCode200Response](#endpointfakeuploaddownloadfilepostcode200response)
the response for 200 | - -## EndpointResponse -public sealed interface EndpointResponse permits
-[EndpointFakeuploaddownloadfilePostCode200Response](#endpointfakeuploaddownloadfilepostcode200response) - -a sealed interface that stores endpoint responses - -## EndpointFakeuploaddownloadfilePostCode200Response -public record EndpointFakeuploaddownloadfilePostCode200Response( - HttpResponse response, - [FakeuploaddownloadfilePostCode200Response.SealedResponseBody](../../../paths/fakeuploaddownloadfile/post/responses/FakeuploaddownloadfilePostCode200Response.md#sealedresponsebody) body, - Nothing? headers -) implements EndpointResponse, ApiResponse
- -a class that stores an endpoint response - diff --git a/samples/client/petstore/kotlin/docs/paths/fakeuploaddownloadfile/post/requestbody/content/applicationoctetstream/ApplicationoctetstreamSchema.md b/samples/client/petstore/kotlin/docs/paths/fakeuploaddownloadfile/post/requestbody/content/applicationoctetstream/ApplicationoctetstreamSchema.md deleted file mode 100644 index 757329e0634..00000000000 --- a/samples/client/petstore/kotlin/docs/paths/fakeuploaddownloadfile/post/requestbody/content/applicationoctetstream/ApplicationoctetstreamSchema.md +++ /dev/null @@ -1,28 +0,0 @@ -# ApplicationoctetstreamSchema -public class ApplicationoctetstreamSchema
- -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 - -## Nested Class Summary -| Modifier and Type | Class and Description | -| ----------------- | ---------------------- | -| sealed interface | [ApplicationoctetstreamSchema.ApplicationoctetstreamSchema1Boxed](#applicationoctetstreamschema1boxed)
sealed interface for validated payloads | -| static class | [ApplicationoctetstreamSchema.ApplicationoctetstreamSchema1](#applicationoctetstreamschema1)
schema class | - -## ApplicationoctetstreamSchema1Boxed -public sealed interface ApplicationoctetstreamSchema1Boxed
-permits
- -sealed interface that stores validated payloads using boxed classes - -## ApplicationoctetstreamSchema1 -public static class ApplicationoctetstreamSchema1
-extends JsonSchema - -A schema class that validates payloads - -## Description -file to upload diff --git a/samples/client/petstore/kotlin/docs/paths/fakeuploaddownloadfile/post/responses/FakeuploaddownloadfilePostCode200Response.md b/samples/client/petstore/kotlin/docs/paths/fakeuploaddownloadfile/post/responses/FakeuploaddownloadfilePostCode200Response.md deleted file mode 100644 index 7d8c5c4b14c..00000000000 --- a/samples/client/petstore/kotlin/docs/paths/fakeuploaddownloadfile/post/responses/FakeuploaddownloadfilePostCode200Response.md +++ /dev/null @@ -1,87 +0,0 @@ -# FakeuploaddownloadfilePostCode200Response - -public class FakeuploaddownloadfilePostCode200Response - -A class that contains necessary nested response classes -- SealedMediaType, a sealed interface which contains all the schema/encoding info for each contentType -- records which implement SealedMediaType, the concrete media types -- SealedResponseBody, a sealed interface which contains all the contentType/schema types -- records which implement SealedResponseBody, the concrete response body types -- a class that extends ResponseDeserializer and is used to deserialize responses - -## Nested Class Summary -| Modifier and Type | Class and Description | -| ----------------- | --------------------- | -| sealed interface | [FakeuploaddownloadfilePostCode200Response.SealedMediaType](#sealedmediatype)
media type sealed interface | -| record | [FakeuploaddownloadfilePostCode200Response.ApplicationoctetstreamMediaType](#applicationoctetstreammediatype)
record storing schema + encoding for a specific contentType | -| sealed interface | [FakeuploaddownloadfilePostCode200Response.SealedResponseBody](#sealedresponsebody)
response body sealed interface | -| record | [FakeuploaddownloadfilePostCode200Response.ApplicationoctetstreamResponseBody](#applicationoctetstreamresponsebody)
implements sealed interface to store response body | -| static class | [FakeuploaddownloadfilePostCode200Response.FakeuploaddownloadfilePostCode200Response1](#fakeuploaddownloadfilepostcode200response1)
class that deserializes responses | - -## SealedMediaType -public sealed interface SealedMediaType
-permits
-[ApplicationoctetstreamMediaType](#applicationoctetstreammediatype) - -sealed interface that stores schema and encoding info - -## ApplicationoctetstreamMediaType -public record ApplicationoctetstreamMediaType
-implements [SealedMediaType](#sealedmediatype), MediaType<[ApplicationoctetstreamSchema.ApplicationoctetstreamSchema1](../../../../paths/fakeuploaddownloadfile/post/responses/code200response/content/applicationoctetstream/ApplicationoctetstreamSchema.md#applicationoctetstreamschema1), Nothing?> - -class storing schema info for a specific contentType - -### Constructor Summary -| Constructor and Description | -| --------------------------- | -| ApplicationoctetstreamMediaType()
Creates an instance | - -### Method Summary -| Modifier and Type | Method and Description | -| ----------------- | ---------------------- | -| [ApplicationoctetstreamSchema.ApplicationoctetstreamSchema1](../../../../paths/fakeuploaddownloadfile/post/responses/code200response/content/applicationoctetstream/ApplicationoctetstreamSchema.md#applicationoctetstreamschema1) | schema()
the schema for this MediaType | -| Nothing? | encoding()
the encoding info | - -## SealedResponseBody -public sealed interface SealedResponseBody
-permits
-[ApplicationoctetstreamResponseBody](#applicationoctetstreamresponsebody) - -sealed interface that stores response body - -## ApplicationoctetstreamResponseBody -public record ApplicationoctetstreamResponseBody
-implements [SealedResponseBody](#sealedresponsebody) - -A record class to store response body for contentType="application/octet-stream" - -### Constructor Summary -| Constructor and Description | -| --------------------------- | -| ApplicationoctetstreamResponseBody(ApplicationoctetstreamSchema.StringJsonSchema1Boxed body)
Creates an instance | - -### Method Summary -| Modifier and Type | Method and Description | -| ----------------- | ---------------------- | -| ApplicationoctetstreamSchema.StringJsonSchema1Boxed | body()
returns the body passed in in the constructor | - -## FakeuploaddownloadfilePostCode200Response1 -public static class FakeuploaddownloadfilePostCode200Response1
-extends ResponseDeserializer<[SealedResponseBody](#sealedresponsebody), Nothing?, [SealedMediaType](#sealedmediatype)> - -a class that deserializes responses - -### Constructor Summary -| Constructor and Description | -| --------------------------- | -| FakeuploaddownloadfilePostCode200Response1()
Creates an instance | - -### Field Summary -| Modifier and Type | Field and Description | -| ----------------- | --------------------- | -| Map | content = Map.ofEntries(
    new AbstractMap.SimpleEntry<>("application/octet-stream", new [ApplicationoctetstreamMediaType](#applicationoctetstreammediatype)())
)
the contentType to schema info | - -### Method Summary -| Modifier and Type | Method and Description | -| ----------------- | ---------------------- | -| ApiResponse<[SealedResponseBody](#sealedresponsebody), Nothing?> | deserialize(HttpResponse response, SchemaConfiguration configuration)
called by endpoint when deserialize responses | diff --git a/samples/client/petstore/kotlin/docs/paths/fakeuploaddownloadfile/post/responses/code200response/content/applicationoctetstream/ApplicationoctetstreamSchema.md b/samples/client/petstore/kotlin/docs/paths/fakeuploaddownloadfile/post/responses/code200response/content/applicationoctetstream/ApplicationoctetstreamSchema.md deleted file mode 100644 index c1498d3a5a3..00000000000 --- a/samples/client/petstore/kotlin/docs/paths/fakeuploaddownloadfile/post/responses/code200response/content/applicationoctetstream/ApplicationoctetstreamSchema.md +++ /dev/null @@ -1,28 +0,0 @@ -# ApplicationoctetstreamSchema -public class ApplicationoctetstreamSchema
- -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 - -## Nested Class Summary -| Modifier and Type | Class and Description | -| ----------------- | ---------------------- | -| sealed interface | [ApplicationoctetstreamSchema.ApplicationoctetstreamSchema1Boxed](#applicationoctetstreamschema1boxed)
sealed interface for validated payloads | -| static class | [ApplicationoctetstreamSchema.ApplicationoctetstreamSchema1](#applicationoctetstreamschema1)
schema class | - -## ApplicationoctetstreamSchema1Boxed -public sealed interface ApplicationoctetstreamSchema1Boxed
-permits
- -sealed interface that stores validated payloads using boxed classes - -## ApplicationoctetstreamSchema1 -public static class ApplicationoctetstreamSchema1
-extends JsonSchema - -A schema class that validates payloads - -## Description -file to download diff --git a/samples/client/petstore/kotlin/docs/paths/fakeuploadfile/FakeuploadfilePost.md b/samples/client/petstore/kotlin/docs/paths/fakeuploadfile/FakeuploadfilePost.md deleted file mode 100644 index aeb3fc0520d..00000000000 --- a/samples/client/petstore/kotlin/docs/paths/fakeuploadfile/FakeuploadfilePost.md +++ /dev/null @@ -1,148 +0,0 @@ -# FakeuploadfilePost - -public class FakeuploadfilePost - -A class that contains necessary endpoint classes -- a class that calls the endpoint method using the http verb -- a class that calls the endpoint method using the operationId name -- class(es) to store the request inputs -- builder(s) to set the request input data - -## Nested Class Summary -| Modifier and Type | Class and Description | -| ----------------- | --------------------- | -| static class | [Post](#post)
The class that has a post method to call the endpoint | -| interface | [UploadFileOperation](#uploadfileoperation)
The interface that has a uploadFile method to call the endpoint | -| static class | [PostRequest](#postrequest)
The request inputs class | -| static class | [PostRequestBuilder](#postrequestbuilder)
A builder for the request input class | - -## Post -public static class Post 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.FakeuploadfilePostRequestBody; -import org.openapijsonschematools.client.paths.fakeuploadfile.post.requestbody.content.multipartformdata.MultipartformdataSchema; -import org.openapijsonschematools.client.RootServerInfo; -import org.openapijsonschematools.client.servers.RootServer0; -import org.openapijsonschematools.client.servers.RootServer1; -import org.openapijsonschematools.client.servers.RootServer2; -import org.openapijsonschematools.client.paths.fakeuploadfile.post.responses.FakeuploadfilePostCode200Response; -import org.openapijsonschematools.client.servers.RootServerInfo; -import org.openapijsonschematools.client.paths.fakeuploadfile.FakeuploadfilePost; -import org.openapijsonschematools.client.paths.fakeuploadfile.post.FakeuploadfilePostResponses; - -import java.io.IOException; -import java.util.Arrays; -import java.util.List; -import java.util.Map; -import java.util.AbstractMap; - -// if you want to use a server that is not SERVER_0 pass it in here and change the ServerIndex input below -ApiConfiguration.ServerInfo serverInfo = new ApiConfiguration.ServerInfoBuilder() - .rootServerInfo( - new RootServerInfo.RootServerInfoBuilder() - .rootServer0(new RootServer0()) - .build() - ) - .build(); -ApiConfiguration.ServerIndexInfo serverIndexInfo = new ApiConfiguration.ServerIndexInfoBuilder() - .rootServerInfoServerIndex(RootServerInfo.ServerIndex.SERVER_0) - .build(); -Duration timeout = Duration.ofSeconds(1L); -Map> defaultHeaders = Map.of("User-Agent", List.of("OpenAPI-JSON-Schema-Generator/1.0.0/java")); -ApiConfiguration apiConfiguration = new ApiConfiguration( - serverInfo - serverIndexInfo, - timeout, - defaultHeaders -); -SchemaConfiguration schemaConfiguration = new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().build()); -FakeuploadfilePost.Post apiClient = new FakeuploadfilePost.Post(apiConfiguration, schemaConfiguration); - - -var request = new FakeuploadfilePost.PostRequestBuilder().build(); - -FakeuploadfilePostResponses.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; -} -FakeuploadfilePostResponses.EndpointFakeuploadfilePostCode200Response castResponse = (FakeuploadfilePostResponses.EndpointFakeuploadfilePostCode200Response) response; -FakeuploadfilePostCode200Response.ApplicationjsonResponseBody deserializedBody = (FakeuploadfilePostCode200Response.ApplicationjsonResponseBody) castResponse.body; -// handle deserialized body here -``` -### Constructor Summary -| Constructor and Description | -| --------------------------- | -| Post(ApiConfiguration apiConfiguration, SchemaConfiguration schemaConfiguration)
Creates an instance | - -### Method Summary -| Modifier and Type | Method and Description | -| ----------------- | ---------------------- | -| [FakeuploadfilePostResponses.EndpointResponse](../../paths/fakeuploadfile/post/FakeuploadfilePostResponses.md#endpointresponse) | post([PostRequest](#postrequest) request) | - -## UploadFileOperation -public interface UploadFileOperation
- -an interface that allows one to call the endpoint using a method named uploadFile by the operationId - -### Method Summary -| Modifier and Type | Method and Description | -| ----------------- | ---------------------- | -| [FakeuploadfilePostResponses.EndpointResponse](../../paths/fakeuploadfile/post/FakeuploadfilePostResponses.md#endpointresponse) | uploadFile([PostRequest](#postrequest) request) | - -## PostRequest -public static class PostRequest
- -a class that stores the final request inputs - -### Field Summary -| Modifier and Type | Field and Description | -| ----------------- | --------------------- | -| [FakeuploadfilePostRequestBody.@Nullable SealedRequestBody](../../paths/fakeuploadfile/post/FakeuploadfilePostRequestBody.md#sealedrequestbody) | requestBody
optional | -| [RootServerInfo.@Nullable ServerIndex](../../RootServerInfo.md#serverindex) | serverIndex
optional. Note: this will override the value in apiConfiguration | -| @Nullable Duration | timeout
optional. Note: this will override the value in apiConfiguration | - -## PostRequestBuilder -public static class PostRequestBuilder
- -a builder for request inputs - -### Constructor Summary -| Constructor and Description | -| --------------------------- | -| PostRequestBuilder()
Creates a builder that contains null for all parameters | - -### Method Summary -| Modifier and Type | Method and Description | -| ----------------- | ---------------------- | -| [PostRequest](#postrequest) | build()
Returns the request input used to call an endpoint method | -| [PostRequestBuilder](#postrequestbuilder) | requestBody([FakeuploadfilePostRequestBody.SealedRequestBody](../../paths/fakeuploadfile/post/FakeuploadfilePostRequestBody.md#sealedrequestbody) requestBody)
sets the optional property | -| [PostRequestBuilder](#postrequestbuilder) | serverIndex([RootServerInfo.ServerIndex](../../RootServerInfo.md#serverindex) serverIndex)
sets the optional property. Note: this will override the value in apiConfiguration | -| [PostRequestBuilder](#postrequestbuilder) | timeout(Duration timeout)
sets the optional property. Note: this will override the value in apiConfiguration | - -[[Back to top]](#top) [[Back to README]](../../../README.md) diff --git a/samples/client/petstore/kotlin/docs/paths/fakeuploadfile/post/FakeuploadfilePostRequestBody.md b/samples/client/petstore/kotlin/docs/paths/fakeuploadfile/post/FakeuploadfilePostRequestBody.md deleted file mode 100644 index b5a1ed59013..00000000000 --- a/samples/client/petstore/kotlin/docs/paths/fakeuploadfile/post/FakeuploadfilePostRequestBody.md +++ /dev/null @@ -1,90 +0,0 @@ -# FakeuploadfilePostRequestBody - -public class FakeuploadfilePostRequestBody - -A class that contains necessary nested request body classes -- SealedMediaType, a sealed interface which contains all the schema/encoding info for each contentType -- records which implement SealedMediaType, the concrete media types -- a class that extends RequestBodySerializer and is used to serialize input SealedRequestBody instances -- SealedRequestBody, a sealed interface which contains all the contentType/schema input types -- records which implement SealedRequestBody, the concrete request body types - -## Nested Class Summary -| Modifier and Type | Class and Description | -| ----------------- | --------------------- | -| sealed interface | [FakeuploadfilePostRequestBody.SealedMediaType](#sealedmediatype)
media type sealed interface | -| record | [FakeuploadfilePostRequestBody.MultipartformdataMediaType](#multipartformdatamediatype)
record storing schema + encoding for a specific contentType | -| static class | [FakeuploadfilePostRequestBody.FakeuploadfilePostRequestBody1](#fakeuploadfilepostrequestbody1)
class that serializes request bodies | -| sealed interface | [FakeuploadfilePostRequestBody.SealedRequestBody](#sealedrequestbody)
request body sealed interface | -| record | [FakeuploadfilePostRequestBody.MultipartformdataRequestBody](#multipartformdatarequestbody)
implements sealed interface to store request body input | - -## SealedMediaType -public sealed interface SealedMediaType
-permits
-[MultipartformdataMediaType](#multipartformdatamediatype) - -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), Nothing?> - -class storing schema info for a specific contentType - -### Constructor Summary -| Constructor and Description | -| --------------------------- | -| MultipartformdataMediaType()
Creates an instance | - -### 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 | -| Nothing? | encoding()
the encoding info | - -## FakeuploadfilePostRequestBody1 -public static class FakeuploadfilePostRequestBody1
- -a class that serializes SealedRequestBody request bodies - -### Constructor Summary -| Constructor and Description | -| --------------------------- | -| FakeuploadfilePostRequestBody1()
Creates an instance | - -### Field Summary -| Modifier and Type | Field and Description | -| ----------------- | --------------------- | -| boolean | required = false
whether the request body is required | -| Map | content = Map.ofEntries(
    new AbstractMap.SimpleEntry<>("multipart/form-data", new [MultipartformdataMediaType](#multipartformdatamediatype)())
)
the contentType to schema info | - -### Method Summary -| Modifier and Type | Method and Description | -| ----------------- | ---------------------- | -| SerializedRequestBody | serialize([SealedRequestBody](#sealedrequestbody) requestBody)
called by endpoint when creating request body bytes | - -## SealedRequestBody -public sealed interface SealedRequestBody
-permits
-[MultipartformdataRequestBody](#multipartformdatarequestbody) - -sealed interface that stores request contentType + validated schema data - -## MultipartformdataRequestBody -public record MultipartformdataRequestBody
-implements [SealedRequestBody](#sealedrequestbody),
-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 | - -### 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 | diff --git a/samples/client/petstore/kotlin/docs/paths/fakeuploadfile/post/FakeuploadfilePostResponses.md b/samples/client/petstore/kotlin/docs/paths/fakeuploadfile/post/FakeuploadfilePostResponses.md deleted file mode 100644 index e55284be383..00000000000 --- a/samples/client/petstore/kotlin/docs/paths/fakeuploadfile/post/FakeuploadfilePostResponses.md +++ /dev/null @@ -1,29 +0,0 @@ -# FakeuploadfilePostResponses - -public class FakeuploadfilePostResponses - -A class that contains necessary responses classes -- a sealed interface, EndpointResponse, that stores endpoint responses -- records for each endpoint response - -## Nested Class Summary -| Modifier and Type | Class and Description | -| ----------------- | --------------------- | -| sealed interface | [EndpointResponse](#endpointresponse)
stores the endpoint responses | -| record | [EndpointFakeuploadfilePostCode200Response](#endpointfakeuploadfilepostcode200response)
the response for 200 | - -## EndpointResponse -public sealed interface EndpointResponse permits
-[EndpointFakeuploadfilePostCode200Response](#endpointfakeuploadfilepostcode200response) - -a sealed interface that stores endpoint responses - -## EndpointFakeuploadfilePostCode200Response -public record EndpointFakeuploadfilePostCode200Response( - HttpResponse response, - [FakeuploadfilePostCode200Response.SealedResponseBody](../../../paths/fakeuploadfile/post/responses/FakeuploadfilePostCode200Response.md#sealedresponsebody) body, - Nothing? headers -) implements EndpointResponse, ApiResponse
- -a class that stores an endpoint response - diff --git a/samples/client/petstore/kotlin/docs/paths/fakeuploadfile/post/requestbody/content/multipartformdata/MultipartformdataSchema.md b/samples/client/petstore/kotlin/docs/paths/fakeuploadfile/post/requestbody/content/multipartformdata/MultipartformdataSchema.md deleted file mode 100644 index a34c929dfcb..00000000000 --- a/samples/client/petstore/kotlin/docs/paths/fakeuploadfile/post/requestbody/content/multipartformdata/MultipartformdataSchema.md +++ /dev/null @@ -1,206 +0,0 @@ -# MultipartformdataSchema -public class MultipartformdataSchema
- -A class that contains necessary nested -- schema classes (which validate payloads), extends JsonSchema -- sealed interfaces which store validated payloads, java version of a sum type -- boxed classes which store validated payloads, sealed permits class implementations -- classes to store validated map payloads, extends FrozenMap -- classes to build inputs for map payloads - -## Nested Class Summary -| Modifier and Type | Class and Description | -| ----------------- | ---------------------- | -| sealed interface | [MultipartformdataSchema.MultipartformdataSchema1Boxed](#multipartformdataschema1boxed)
sealed interface for validated payloads | -| record | [MultipartformdataSchema.MultipartformdataSchema1BoxedMap](#multipartformdataschema1boxedmap)
boxed class to store validated Map payloads | -| static class | [MultipartformdataSchema.MultipartformdataSchema1](#multipartformdataschema1)
schema class | -| static class | [MultipartformdataSchema.MultipartformdataSchemaMapBuilder](#multipartformdataschemamapbuilder)
builder for Map payloads | -| static class | [MultipartformdataSchema.MultipartformdataSchemaMap](#multipartformdataschemamap)
output class for Map payloads | -| sealed interface | [MultipartformdataSchema.MultipartformdataFileBoxed](#multipartformdatafileboxed)
sealed interface for validated payloads | -| static class | [MultipartformdataSchema.MultipartformdataFile](#multipartformdatafile)
schema class | -| sealed interface | [MultipartformdataSchema.MultipartformdataAdditionalMetadataBoxed](#multipartformdataadditionalmetadataboxed)
sealed interface for validated payloads | -| record | [MultipartformdataSchema.MultipartformdataAdditionalMetadataBoxedString](#multipartformdataadditionalmetadataboxedstring)
boxed class to store validated String payloads | -| static class | [MultipartformdataSchema.MultipartformdataAdditionalMetadata](#multipartformdataadditionalmetadata)
schema class | - -## MultipartformdataSchema1Boxed -public sealed interface MultipartformdataSchema1Boxed
-permits
-[MultipartformdataSchema1BoxedMap](#multipartformdataschema1boxedmap) - -sealed interface that stores validated payloads using boxed classes - -## MultipartformdataSchema1BoxedMap -public record MultipartformdataSchema1BoxedMap
-implements [MultipartformdataSchema1Boxed](#multipartformdataschema1boxed) - -record that stores validated Map payloads, sealed permits implementation - -### Constructor Summary -| Constructor and Description | -| --------------------------- | -| MultipartformdataSchema1BoxedMap([MultipartformdataSchemaMap](#multipartformdataschemamap) data)
Creates an instance, private visibility | - -### Method Summary -| Modifier and Type | Method and Description | -| ----------------- | ---------------------- | -| [MultipartformdataSchemaMap](#multipartformdataschemamap) | data()
validated payload | -| @Nullable Object | getData()
validated payload | - -## MultipartformdataSchema1 -public static class MultipartformdataSchema1
-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.fakeuploadfile.post.requestbody.content.multipartformdata.MultipartformdataSchema; - -import java.util.Arrays; -import java.util.List; -import java.util.AbstractMap; - -static final SchemaConfiguration configuration = new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().build()); - -// Map validation -MultipartformdataSchema.MultipartformdataSchemaMap validatedPayload = - MultipartformdataSchema.MultipartformdataSchema1.validate( - new MultipartformdataSchema.MultipartformdataSchemaMapBuilder() - .file("a") - - .additionalMetadata("a") - - .build(), - configuration -); -``` - -### Field Summary -| Modifier and Type | Field and Description | -| ----------------- | ---------------------- | -| Set> | type = Set.of(Map.class) | -| Map> | properties = Map.ofEntries(
    new PropertyEntry("additionalMetadata", [MultipartformdataAdditionalMetadata.class](#multipartformdataadditionalmetadata))),
    new PropertyEntry("file", [MultipartformdataFile.class](#multipartformdatafile)))
)
| -| Set | required = Set.of(
    "file"
)
| - -### Method Summary -| Modifier and Type | Method and Description | -| ----------------- | ---------------------- | -| [MultipartformdataSchemaMap](#multipartformdataschemamap) | validate([Map<?, ?>](#multipartformdataschemamapbuilder) arg, SchemaConfiguration configuration) | -| [MultipartformdataSchema1BoxedMap](#multipartformdataschema1boxedmap) | validateAndBox([Map<?, ?>](#multipartformdataschemamapbuilder) arg, SchemaConfiguration configuration) | -| [MultipartformdataSchema1Boxed](#multipartformdataschema1boxed) | validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) | -| @Nullable Object | validate(@Nullable Object arg, SchemaConfiguration configuration) | - -## MultipartformdataSchemaMap0Builder -public class MultipartformdataSchemaMap0Builder
-builder for `Map` - -A class that builds the Map input type - -### Constructor Summary -| Constructor and Description | -| --------------------------- | -| MultipartformdataSchemaMap0Builder(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 | -| [MultipartformdataSchemaMap0Builder](#multipartformdataschemamap0builder) | additionalMetadata(String value) | -| [MultipartformdataSchemaMap0Builder](#multipartformdataschemamap0builder) | additionalProperty(String key, Nothing? value) | -| [MultipartformdataSchemaMap0Builder](#multipartformdataschemamap0builder) | additionalProperty(String key, boolean value) | -| [MultipartformdataSchemaMap0Builder](#multipartformdataschemamap0builder) | additionalProperty(String key, String value) | -| [MultipartformdataSchemaMap0Builder](#multipartformdataschemamap0builder) | additionalProperty(String key, int value) | -| [MultipartformdataSchemaMap0Builder](#multipartformdataschemamap0builder) | additionalProperty(String key, float value) | -| [MultipartformdataSchemaMap0Builder](#multipartformdataschemamap0builder) | additionalProperty(String key, long value) | -| [MultipartformdataSchemaMap0Builder](#multipartformdataschemamap0builder) | additionalProperty(String key, double value) | -| [MultipartformdataSchemaMap0Builder](#multipartformdataschemamap0builder) | additionalProperty(String key, List value) | -| [MultipartformdataSchemaMap0Builder](#multipartformdataschemamap0builder) | additionalProperty(String key, Map value) | - -## MultipartformdataSchemaMapBuilder -public class MultipartformdataSchemaMapBuilder
-builder for `Map` - -A class that builds the Map input type - -### Constructor Summary -| Constructor and Description | -| --------------------------- | -| MultipartformdataSchemaMapBuilder()
Creates a builder that contains an empty map | - -### Method Summary -| Modifier and Type | Method and Description | -| ----------------- | ---------------------- | -| [MultipartformdataSchemaMap0Builder](#multipartformdataschemamap0builder) | file(String value) | - -## MultipartformdataSchemaMap -public static class MultipartformdataSchemaMap
-extends FrozenMap - -A class to store validated Map payloads - -### Method Summary -| Modifier and Type | Method and Description | -| ----------------- | ---------------------- | -| static [MultipartformdataSchemaMap](#multipartformdataschemamap) | of([Map](#multipartformdataschemamapbuilder) arg, SchemaConfiguration configuration) | -| String | file()
| -| String | additionalMetadata()
[optional] | -| @Nullable Object | getAdditionalProperty(String name)
provides type safety for additional properties | - -## MultipartformdataFileBoxed -public sealed interface MultipartformdataFileBoxed
-permits
- -sealed interface that stores validated payloads using boxed classes - -## MultipartformdataFile -public static class MultipartformdataFile
-extends JsonSchema - -A schema class that validates payloads - -## Description -file to upload - -## MultipartformdataAdditionalMetadataBoxed -public sealed interface MultipartformdataAdditionalMetadataBoxed
-permits
-[MultipartformdataAdditionalMetadataBoxedString](#multipartformdataadditionalmetadataboxedstring) - -sealed interface that stores validated payloads using boxed classes - -## MultipartformdataAdditionalMetadataBoxedString -public record MultipartformdataAdditionalMetadataBoxedString
-implements [MultipartformdataAdditionalMetadataBoxed](#multipartformdataadditionalmetadataboxed) - -record that stores validated String payloads, sealed permits implementation - -### Constructor Summary -| Constructor and Description | -| --------------------------- | -| MultipartformdataAdditionalMetadataBoxedString(String data)
Creates an instance, private visibility | - -### Method Summary -| Modifier and Type | Method and Description | -| ----------------- | ---------------------- | -| String | data()
validated payload | -| @Nullable Object | getData()
validated payload | - -## MultipartformdataAdditionalMetadata -public static class MultipartformdataAdditionalMetadata
-extends StringJsonSchema.StringJsonSchema1 - -A schema class that validates payloads - -## Description -Additional data to pass to server - -| Methods Inherited from class org.openapijsonschematools.client.schemas.StringJsonSchema.StringJsonSchema1 | -| ------------------------------------------------------------------ | -| validate | -| validateAndBox | diff --git a/samples/client/petstore/kotlin/docs/paths/fakeuploadfile/post/responses/FakeuploadfilePostCode200Response.md b/samples/client/petstore/kotlin/docs/paths/fakeuploadfile/post/responses/FakeuploadfilePostCode200Response.md deleted file mode 100644 index b26fdd70404..00000000000 --- a/samples/client/petstore/kotlin/docs/paths/fakeuploadfile/post/responses/FakeuploadfilePostCode200Response.md +++ /dev/null @@ -1,87 +0,0 @@ -# FakeuploadfilePostCode200Response - -public class FakeuploadfilePostCode200Response - -A class that contains necessary nested response classes -- SealedMediaType, a sealed interface which contains all the schema/encoding info for each contentType -- records which implement SealedMediaType, the concrete media types -- SealedResponseBody, a sealed interface which contains all the contentType/schema types -- records which implement SealedResponseBody, the concrete response body types -- a class that extends ResponseDeserializer and is used to deserialize responses - -## Nested Class Summary -| Modifier and Type | Class and Description | -| ----------------- | --------------------- | -| sealed interface | [FakeuploadfilePostCode200Response.SealedMediaType](#sealedmediatype)
media type sealed interface | -| record | [FakeuploadfilePostCode200Response.ApplicationjsonMediaType](#applicationjsonmediatype)
record storing schema + encoding for a specific contentType | -| sealed interface | [FakeuploadfilePostCode200Response.SealedResponseBody](#sealedresponsebody)
response body sealed interface | -| record | [FakeuploadfilePostCode200Response.ApplicationjsonResponseBody](#applicationjsonresponsebody)
implements sealed interface to store response body | -| static class | [FakeuploadfilePostCode200Response.FakeuploadfilePostCode200Response1](#fakeuploadfilepostcode200response1)
class that deserializes responses | - -## SealedMediaType -public sealed interface SealedMediaType
-permits
-[ApplicationjsonMediaType](#applicationjsonmediatype) - -sealed interface that stores schema and encoding info - -## ApplicationjsonMediaType -public record ApplicationjsonMediaType
-implements [SealedMediaType](#sealedmediatype), MediaType<[ApplicationjsonSchema.ApplicationjsonSchema1](../../../../paths/fakeuploadfile/post/responses/code200response/content/applicationjson/ApplicationjsonSchema.md#applicationjsonschema1), Nothing?> - -class storing schema info for a specific contentType - -### Constructor Summary -| Constructor and Description | -| --------------------------- | -| ApplicationjsonMediaType()
Creates an instance | - -### Method Summary -| Modifier and Type | Method and Description | -| ----------------- | ---------------------- | -| [ApplicationjsonSchema.ApplicationjsonSchema1](../../../../paths/fakeuploadfile/post/responses/code200response/content/applicationjson/ApplicationjsonSchema.md#applicationjsonschema1) | schema()
the schema for this MediaType | -| Nothing? | encoding()
the encoding info | - -## SealedResponseBody -public sealed interface SealedResponseBody
-permits
-[ApplicationjsonResponseBody](#applicationjsonresponsebody) - -sealed interface that stores response body - -## ApplicationjsonResponseBody -public record ApplicationjsonResponseBody
-implements [SealedResponseBody](#sealedresponsebody) - -A record class to store response body for contentType="application/json" - -### Constructor Summary -| Constructor and Description | -| --------------------------- | -| ApplicationjsonResponseBody(ApplicationjsonSchema.[ApiResponseSchema1Boxed](../../../../components/schemas/ApiResponseSchema.md#apiresponseschema1boxed) body)
Creates an instance | - -### Method Summary -| Modifier and Type | Method and Description | -| ----------------- | ---------------------- | -| ApplicationjsonSchema.[ApiResponseSchema1Boxed](../../../../components/schemas/ApiResponseSchema.md#apiresponseschema1boxed) | body()
returns the body passed in in the constructor | - -## FakeuploadfilePostCode200Response1 -public static class FakeuploadfilePostCode200Response1
-extends ResponseDeserializer<[SealedResponseBody](#sealedresponsebody), Nothing?, [SealedMediaType](#sealedmediatype)> - -a class that deserializes responses - -### Constructor Summary -| Constructor and Description | -| --------------------------- | -| FakeuploadfilePostCode200Response1()
Creates an instance | - -### Field Summary -| Modifier and Type | Field and Description | -| ----------------- | --------------------- | -| 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 | -| ----------------- | ---------------------- | -| ApiResponse<[SealedResponseBody](#sealedresponsebody), Nothing?> | deserialize(HttpResponse response, SchemaConfiguration configuration)
called by endpoint when deserialize responses | diff --git a/samples/client/petstore/kotlin/docs/paths/fakeuploadfile/post/responses/code200response/content/applicationjson/ApplicationjsonSchema.md b/samples/client/petstore/kotlin/docs/paths/fakeuploadfile/post/responses/code200response/content/applicationjson/ApplicationjsonSchema.md deleted file mode 100644 index bb60c5776fb..00000000000 --- a/samples/client/petstore/kotlin/docs/paths/fakeuploadfile/post/responses/code200response/content/applicationjson/ApplicationjsonSchema.md +++ /dev/null @@ -1,19 +0,0 @@ -# ApplicationjsonSchema -public class ApplicationjsonSchema
-extends [ApiResponseSchema1](../../../../../../../components/schemas/ApiResponseSchema.md#apiresponseschema) - -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 - -## Nested Class Summary -| Modifier and Type | Class and Description | -| ----------------- | ---------------------- | -| static class | [ApplicationjsonSchema.ApplicationjsonSchema1](#applicationjsonschema1)
schema class | - -## ApplicationjsonSchema1 -public static class ApplicationjsonSchema1
-extends [ApiResponseSchema.ApiResponseSchema1](../../../../../../../components/schemas/ApiResponseSchema.md#apiresponseschema1) - -A schema class that validates payloads diff --git a/samples/client/petstore/kotlin/docs/paths/fakeuploadfiles/FakeuploadfilesPost.md b/samples/client/petstore/kotlin/docs/paths/fakeuploadfiles/FakeuploadfilesPost.md deleted file mode 100644 index 5f1bd2c0a8d..00000000000 --- a/samples/client/petstore/kotlin/docs/paths/fakeuploadfiles/FakeuploadfilesPost.md +++ /dev/null @@ -1,148 +0,0 @@ -# FakeuploadfilesPost - -public class FakeuploadfilesPost - -A class that contains necessary endpoint classes -- a class that calls the endpoint method using the http verb -- a class that calls the endpoint method using the operationId name -- class(es) to store the request inputs -- builder(s) to set the request input data - -## Nested Class Summary -| Modifier and Type | Class and Description | -| ----------------- | --------------------- | -| static class | [Post](#post)
The class that has a post method to call the endpoint | -| interface | [UploadFilesOperation](#uploadfilesoperation)
The interface that has a uploadFiles method to call the endpoint | -| static class | [PostRequest](#postrequest)
The request inputs class | -| static class | [PostRequestBuilder](#postrequestbuilder)
A builder for the request input class | - -## Post -public static class Post 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.FakeuploadfilesPostRequestBody; -import org.openapijsonschematools.client.paths.fakeuploadfiles.post.requestbody.content.multipartformdata.MultipartformdataSchema; -import org.openapijsonschematools.client.RootServerInfo; -import org.openapijsonschematools.client.servers.RootServer0; -import org.openapijsonschematools.client.servers.RootServer1; -import org.openapijsonschematools.client.servers.RootServer2; -import org.openapijsonschematools.client.paths.fakeuploadfiles.post.responses.FakeuploadfilesPostCode200Response; -import org.openapijsonschematools.client.servers.RootServerInfo; -import org.openapijsonschematools.client.paths.fakeuploadfiles.FakeuploadfilesPost; -import org.openapijsonschematools.client.paths.fakeuploadfiles.post.FakeuploadfilesPostResponses; - -import java.io.IOException; -import java.util.Arrays; -import java.util.List; -import java.util.Map; -import java.util.AbstractMap; - -// if you want to use a server that is not SERVER_0 pass it in here and change the ServerIndex input below -ApiConfiguration.ServerInfo serverInfo = new ApiConfiguration.ServerInfoBuilder() - .rootServerInfo( - new RootServerInfo.RootServerInfoBuilder() - .rootServer0(new RootServer0()) - .build() - ) - .build(); -ApiConfiguration.ServerIndexInfo serverIndexInfo = new ApiConfiguration.ServerIndexInfoBuilder() - .rootServerInfoServerIndex(RootServerInfo.ServerIndex.SERVER_0) - .build(); -Duration timeout = Duration.ofSeconds(1L); -Map> defaultHeaders = Map.of("User-Agent", List.of("OpenAPI-JSON-Schema-Generator/1.0.0/java")); -ApiConfiguration apiConfiguration = new ApiConfiguration( - serverInfo - serverIndexInfo, - timeout, - defaultHeaders -); -SchemaConfiguration schemaConfiguration = new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().build()); -FakeuploadfilesPost.Post apiClient = new FakeuploadfilesPost.Post(apiConfiguration, schemaConfiguration); - - -var request = new FakeuploadfilesPost.PostRequestBuilder().build(); - -FakeuploadfilesPostResponses.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; -} -FakeuploadfilesPostResponses.EndpointFakeuploadfilesPostCode200Response castResponse = (FakeuploadfilesPostResponses.EndpointFakeuploadfilesPostCode200Response) response; -FakeuploadfilesPostCode200Response.ApplicationjsonResponseBody deserializedBody = (FakeuploadfilesPostCode200Response.ApplicationjsonResponseBody) castResponse.body; -// handle deserialized body here -``` -### Constructor Summary -| Constructor and Description | -| --------------------------- | -| Post(ApiConfiguration apiConfiguration, SchemaConfiguration schemaConfiguration)
Creates an instance | - -### Method Summary -| Modifier and Type | Method and Description | -| ----------------- | ---------------------- | -| [FakeuploadfilesPostResponses.EndpointResponse](../../paths/fakeuploadfiles/post/FakeuploadfilesPostResponses.md#endpointresponse) | post([PostRequest](#postrequest) request) | - -## UploadFilesOperation -public interface UploadFilesOperation
- -an interface that allows one to call the endpoint using a method named uploadFiles by the operationId - -### Method Summary -| Modifier and Type | Method and Description | -| ----------------- | ---------------------- | -| [FakeuploadfilesPostResponses.EndpointResponse](../../paths/fakeuploadfiles/post/FakeuploadfilesPostResponses.md#endpointresponse) | uploadFiles([PostRequest](#postrequest) request) | - -## PostRequest -public static class PostRequest
- -a class that stores the final request inputs - -### Field Summary -| Modifier and Type | Field and Description | -| ----------------- | --------------------- | -| [FakeuploadfilesPostRequestBody.@Nullable SealedRequestBody](../../paths/fakeuploadfiles/post/FakeuploadfilesPostRequestBody.md#sealedrequestbody) | requestBody
optional | -| [RootServerInfo.@Nullable ServerIndex](../../RootServerInfo.md#serverindex) | serverIndex
optional. Note: this will override the value in apiConfiguration | -| @Nullable Duration | timeout
optional. Note: this will override the value in apiConfiguration | - -## PostRequestBuilder -public static class PostRequestBuilder
- -a builder for request inputs - -### Constructor Summary -| Constructor and Description | -| --------------------------- | -| PostRequestBuilder()
Creates a builder that contains null for all parameters | - -### Method Summary -| Modifier and Type | Method and Description | -| ----------------- | ---------------------- | -| [PostRequest](#postrequest) | build()
Returns the request input used to call an endpoint method | -| [PostRequestBuilder](#postrequestbuilder) | requestBody([FakeuploadfilesPostRequestBody.SealedRequestBody](../../paths/fakeuploadfiles/post/FakeuploadfilesPostRequestBody.md#sealedrequestbody) requestBody)
sets the optional property | -| [PostRequestBuilder](#postrequestbuilder) | serverIndex([RootServerInfo.ServerIndex](../../RootServerInfo.md#serverindex) serverIndex)
sets the optional property. Note: this will override the value in apiConfiguration | -| [PostRequestBuilder](#postrequestbuilder) | timeout(Duration timeout)
sets the optional property. Note: this will override the value in apiConfiguration | - -[[Back to top]](#top) [[Back to README]](../../../README.md) diff --git a/samples/client/petstore/kotlin/docs/paths/fakeuploadfiles/post/FakeuploadfilesPostRequestBody.md b/samples/client/petstore/kotlin/docs/paths/fakeuploadfiles/post/FakeuploadfilesPostRequestBody.md deleted file mode 100644 index ce187406bfb..00000000000 --- a/samples/client/petstore/kotlin/docs/paths/fakeuploadfiles/post/FakeuploadfilesPostRequestBody.md +++ /dev/null @@ -1,90 +0,0 @@ -# FakeuploadfilesPostRequestBody - -public class FakeuploadfilesPostRequestBody - -A class that contains necessary nested request body classes -- SealedMediaType, a sealed interface which contains all the schema/encoding info for each contentType -- records which implement SealedMediaType, the concrete media types -- a class that extends RequestBodySerializer and is used to serialize input SealedRequestBody instances -- SealedRequestBody, a sealed interface which contains all the contentType/schema input types -- records which implement SealedRequestBody, the concrete request body types - -## Nested Class Summary -| Modifier and Type | Class and Description | -| ----------------- | --------------------- | -| sealed interface | [FakeuploadfilesPostRequestBody.SealedMediaType](#sealedmediatype)
media type sealed interface | -| record | [FakeuploadfilesPostRequestBody.MultipartformdataMediaType](#multipartformdatamediatype)
record storing schema + encoding for a specific contentType | -| static class | [FakeuploadfilesPostRequestBody.FakeuploadfilesPostRequestBody1](#fakeuploadfilespostrequestbody1)
class that serializes request bodies | -| sealed interface | [FakeuploadfilesPostRequestBody.SealedRequestBody](#sealedrequestbody)
request body sealed interface | -| record | [FakeuploadfilesPostRequestBody.MultipartformdataRequestBody](#multipartformdatarequestbody)
implements sealed interface to store request body input | - -## SealedMediaType -public sealed interface SealedMediaType
-permits
-[MultipartformdataMediaType](#multipartformdatamediatype) - -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), Nothing?> - -class storing schema info for a specific contentType - -### Constructor Summary -| Constructor and Description | -| --------------------------- | -| MultipartformdataMediaType()
Creates an instance | - -### 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 | -| Nothing? | encoding()
the encoding info | - -## FakeuploadfilesPostRequestBody1 -public static class FakeuploadfilesPostRequestBody1
- -a class that serializes SealedRequestBody request bodies - -### Constructor Summary -| Constructor and Description | -| --------------------------- | -| FakeuploadfilesPostRequestBody1()
Creates an instance | - -### Field Summary -| Modifier and Type | Field and Description | -| ----------------- | --------------------- | -| boolean | required = false
whether the request body is required | -| Map | content = Map.ofEntries(
    new AbstractMap.SimpleEntry<>("multipart/form-data", new [MultipartformdataMediaType](#multipartformdatamediatype)())
)
the contentType to schema info | - -### Method Summary -| Modifier and Type | Method and Description | -| ----------------- | ---------------------- | -| SerializedRequestBody | serialize([SealedRequestBody](#sealedrequestbody) requestBody)
called by endpoint when creating request body bytes | - -## SealedRequestBody -public sealed interface SealedRequestBody
-permits
-[MultipartformdataRequestBody](#multipartformdatarequestbody) - -sealed interface that stores request contentType + validated schema data - -## MultipartformdataRequestBody -public record MultipartformdataRequestBody
-implements [SealedRequestBody](#sealedrequestbody),
-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 | - -### 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 | diff --git a/samples/client/petstore/kotlin/docs/paths/fakeuploadfiles/post/FakeuploadfilesPostResponses.md b/samples/client/petstore/kotlin/docs/paths/fakeuploadfiles/post/FakeuploadfilesPostResponses.md deleted file mode 100644 index 674aa6c746d..00000000000 --- a/samples/client/petstore/kotlin/docs/paths/fakeuploadfiles/post/FakeuploadfilesPostResponses.md +++ /dev/null @@ -1,29 +0,0 @@ -# FakeuploadfilesPostResponses - -public class FakeuploadfilesPostResponses - -A class that contains necessary responses classes -- a sealed interface, EndpointResponse, that stores endpoint responses -- records for each endpoint response - -## Nested Class Summary -| Modifier and Type | Class and Description | -| ----------------- | --------------------- | -| sealed interface | [EndpointResponse](#endpointresponse)
stores the endpoint responses | -| record | [EndpointFakeuploadfilesPostCode200Response](#endpointfakeuploadfilespostcode200response)
the response for 200 | - -## EndpointResponse -public sealed interface EndpointResponse permits
-[EndpointFakeuploadfilesPostCode200Response](#endpointfakeuploadfilespostcode200response) - -a sealed interface that stores endpoint responses - -## EndpointFakeuploadfilesPostCode200Response -public record EndpointFakeuploadfilesPostCode200Response( - HttpResponse response, - [FakeuploadfilesPostCode200Response.SealedResponseBody](../../../paths/fakeuploadfiles/post/responses/FakeuploadfilesPostCode200Response.md#sealedresponsebody) body, - Nothing? headers -) implements EndpointResponse, ApiResponse
- -a class that stores an endpoint response - diff --git a/samples/client/petstore/kotlin/docs/paths/fakeuploadfiles/post/requestbody/content/multipartformdata/MultipartformdataSchema.md b/samples/client/petstore/kotlin/docs/paths/fakeuploadfiles/post/requestbody/content/multipartformdata/MultipartformdataSchema.md deleted file mode 100644 index b71409490f1..00000000000 --- a/samples/client/petstore/kotlin/docs/paths/fakeuploadfiles/post/requestbody/content/multipartformdata/MultipartformdataSchema.md +++ /dev/null @@ -1,252 +0,0 @@ -# MultipartformdataSchema -public class MultipartformdataSchema
- -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 list payloads, extends FrozenList -- classes to build inputs for list payloads -- classes to store validated map payloads, extends FrozenMap -- classes to build inputs for map payloads - -## Nested Class Summary -| Modifier and Type | Class and Description | -| ----------------- | ---------------------- | -| sealed interface | [MultipartformdataSchema.MultipartformdataSchema1Boxed](#multipartformdataschema1boxed)
sealed interface for validated payloads | -| record | [MultipartformdataSchema.MultipartformdataSchema1BoxedMap](#multipartformdataschema1boxedmap)
boxed class to store validated Map payloads | -| static class | [MultipartformdataSchema.MultipartformdataSchema1](#multipartformdataschema1)
schema class | -| static class | [MultipartformdataSchema.MultipartformdataSchemaMapBuilder](#multipartformdataschemamapbuilder)
builder for Map payloads | -| static class | [MultipartformdataSchema.MultipartformdataSchemaMap](#multipartformdataschemamap)
output class for Map payloads | -| sealed interface | [MultipartformdataSchema.MultipartformdataFilesBoxed](#multipartformdatafilesboxed)
sealed interface for validated payloads | -| record | [MultipartformdataSchema.MultipartformdataFilesBoxedList](#multipartformdatafilesboxedlist)
boxed class to store validated List payloads | -| static class | [MultipartformdataSchema.MultipartformdataFiles](#multipartformdatafiles)
schema class | -| static class | [MultipartformdataSchema.MultipartformdataFilesListBuilder](#multipartformdatafileslistbuilder)
builder for List payloads | -| static class | [MultipartformdataSchema.MultipartformdataFilesList](#multipartformdatafileslist)
output class for List payloads | -| sealed interface | [MultipartformdataSchema.MultipartformdataItemsBoxed](#multipartformdataitemsboxed)
sealed interface for validated payloads | -| static class | [MultipartformdataSchema.MultipartformdataItems](#multipartformdataitems)
schema class | - -## MultipartformdataSchema1Boxed -public sealed interface MultipartformdataSchema1Boxed
-permits
-[MultipartformdataSchema1BoxedMap](#multipartformdataschema1boxedmap) - -sealed interface that stores validated payloads using boxed classes - -## MultipartformdataSchema1BoxedMap -public record MultipartformdataSchema1BoxedMap
-implements [MultipartformdataSchema1Boxed](#multipartformdataschema1boxed) - -record that stores validated Map payloads, sealed permits implementation - -### Constructor Summary -| Constructor and Description | -| --------------------------- | -| MultipartformdataSchema1BoxedMap([MultipartformdataSchemaMap](#multipartformdataschemamap) data)
Creates an instance, private visibility | - -### Method Summary -| Modifier and Type | Method and Description | -| ----------------- | ---------------------- | -| [MultipartformdataSchemaMap](#multipartformdataschemamap) | data()
validated payload | -| @Nullable Object | getData()
validated payload | - -## MultipartformdataSchema1 -public static class MultipartformdataSchema1
-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.fakeuploadfiles.post.requestbody.content.multipartformdata.MultipartformdataSchema; - -import java.util.Arrays; -import java.util.List; -import java.util.AbstractMap; - -static final SchemaConfiguration configuration = new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().build()); - -// Map validation -MultipartformdataSchema.MultipartformdataSchemaMap validatedPayload = - MultipartformdataSchema.MultipartformdataSchema1.validate( - new MultipartformdataSchema.MultipartformdataSchemaMapBuilder() - .files( - Arrays.asList( - "a" - ) - ) - .build(), - configuration -); -``` - -### Field Summary -| Modifier and Type | Field and Description | -| ----------------- | ---------------------- | -| Set> | type = Set.of(Map.class) | -| Map> | properties = Map.ofEntries(
    new PropertyEntry("files", [MultipartformdataFiles.class](#multipartformdatafiles)))
)
| - -### Method Summary -| Modifier and Type | Method and Description | -| ----------------- | ---------------------- | -| [MultipartformdataSchemaMap](#multipartformdataschemamap) | validate([Map<?, ?>](#multipartformdataschemamapbuilder) arg, SchemaConfiguration configuration) | -| [MultipartformdataSchema1BoxedMap](#multipartformdataschema1boxedmap) | validateAndBox([Map<?, ?>](#multipartformdataschemamapbuilder) arg, SchemaConfiguration configuration) | -| [MultipartformdataSchema1Boxed](#multipartformdataschema1boxed) | validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) | -| @Nullable Object | validate(@Nullable Object arg, SchemaConfiguration configuration) | - -## MultipartformdataSchemaMapBuilder -public class MultipartformdataSchemaMapBuilder
-builder for `Map` - -A class that builds the Map input type - -### Constructor Summary -| Constructor and Description | -| --------------------------- | -| MultipartformdataSchemaMapBuilder()
Creates a builder that contains an empty map | - -### Method Summary -| Modifier and Type | Method and Description | -| ----------------- | ---------------------- | -| Map | build()
Returns map input that should be used with Schema.validate | -| [MultipartformdataSchemaMapBuilder](#multipartformdataschemamapbuilder) | files(List value) | -| [MultipartformdataSchemaMapBuilder](#multipartformdataschemamapbuilder) | additionalProperty(String key, Nothing? value) | -| [MultipartformdataSchemaMapBuilder](#multipartformdataschemamapbuilder) | additionalProperty(String key, boolean value) | -| [MultipartformdataSchemaMapBuilder](#multipartformdataschemamapbuilder) | additionalProperty(String key, String value) | -| [MultipartformdataSchemaMapBuilder](#multipartformdataschemamapbuilder) | additionalProperty(String key, int value) | -| [MultipartformdataSchemaMapBuilder](#multipartformdataschemamapbuilder) | additionalProperty(String key, float value) | -| [MultipartformdataSchemaMapBuilder](#multipartformdataschemamapbuilder) | additionalProperty(String key, long value) | -| [MultipartformdataSchemaMapBuilder](#multipartformdataschemamapbuilder) | additionalProperty(String key, double value) | -| [MultipartformdataSchemaMapBuilder](#multipartformdataschemamapbuilder) | additionalProperty(String key, List value) | -| [MultipartformdataSchemaMapBuilder](#multipartformdataschemamapbuilder) | additionalProperty(String key, Map value) | - -## MultipartformdataSchemaMap -public static class MultipartformdataSchemaMap
-extends FrozenMap - -A class to store validated Map payloads - -### Method Summary -| Modifier and Type | Method and Description | -| ----------------- | ---------------------- | -| static [MultipartformdataSchemaMap](#multipartformdataschemamap) | of([Map](#multipartformdataschemamapbuilder) arg, SchemaConfiguration configuration) | -| [MultipartformdataFilesList](#multipartformdatafileslist) | files()
[optional] | -| @Nullable Object | getAdditionalProperty(String name)
provides type safety for additional properties | - -## MultipartformdataFilesBoxed -public sealed interface MultipartformdataFilesBoxed
-permits
-[MultipartformdataFilesBoxedList](#multipartformdatafilesboxedlist) - -sealed interface that stores validated payloads using boxed classes - -## MultipartformdataFilesBoxedList -public record MultipartformdataFilesBoxedList
-implements [MultipartformdataFilesBoxed](#multipartformdatafilesboxed) - -record that stores validated List payloads, sealed permits implementation - -### Constructor Summary -| Constructor and Description | -| --------------------------- | -| MultipartformdataFilesBoxedList([MultipartformdataFilesList](#multipartformdatafileslist) data)
Creates an instance, private visibility | - -### Method Summary -| Modifier and Type | Method and Description | -| ----------------- | ---------------------- | -| [MultipartformdataFilesList](#multipartformdatafileslist) | data()
validated payload | -| @Nullable Object | getData()
validated payload | - -## MultipartformdataFiles -public static class MultipartformdataFiles
-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.fakeuploadfiles.post.requestbody.content.multipartformdata.MultipartformdataSchema; - -import java.util.Arrays; -import java.util.List; -import java.util.AbstractMap; - -static final SchemaConfiguration configuration = new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().build()); - -// List validation -MultipartformdataSchema.MultipartformdataFilesList validatedPayload = - MultipartformdataSchema.MultipartformdataFiles.validate( - new MultipartformdataSchema.MultipartformdataFilesListBuilder() - .add("a") - - .build(), - configuration -); -``` - -### Field Summary -| Modifier and Type | Field and Description | -| ----------------- | ---------------------- | -| Set> | type = Set.of(List.class) | -| Class | items = [MultipartformdataItems.class](#multipartformdataitems) | - -### Method Summary -| Modifier and Type | Method and Description | -| ----------------- | ---------------------- | -| [MultipartformdataFilesList](#multipartformdatafileslist) | validate([List](#multipartformdatafileslistbuilder) arg, SchemaConfiguration configuration) | -| [MultipartformdataFilesBoxedList](#multipartformdatafilesboxedlist) | validateAndBox([List](#multipartformdatafileslistbuilder) arg, SchemaConfiguration configuration) | -| [MultipartformdataFilesBoxed](#multipartformdatafilesboxed) | validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) | -| @Nullable Object | validate(@Nullable Object arg, SchemaConfiguration configuration) | - -## MultipartformdataFilesListBuilder -public class MultipartformdataFilesListBuilder
-builder for `List` - -A class that builds the List input type - -### Constructor Summary -| Constructor and Description | -| --------------------------- | -| MultipartformdataFilesListBuilder()
Creates an empty list | -| MultipartformdataFilesListBuilder(List items)
Stores the items in a list | - -### Method Summary -| Modifier and Type | Method and Description | -| ----------------- | ---------------------- | -| MultipartformdataFilesListBuilder | add(String item) | -| List | build()
Returns list input that should be used with Schema.validate | - -## MultipartformdataFilesList -public class MultipartformdataFilesList
-extends `FrozenList` - -A class to store validated List payloads - -### Method Summary -| Modifier and Type | Method and Description | -| ----------------- | ---------------------- | -| static [MultipartformdataFilesList](#multipartformdatafileslist) | of([List](#multipartformdatafileslistbuilder) arg, SchemaConfiguration configuration) | - -## MultipartformdataItemsBoxed -public sealed interface MultipartformdataItemsBoxed
-permits
- -sealed interface that stores validated payloads using boxed classes - -## MultipartformdataItems -public static class MultipartformdataItems
-extends JsonSchema - -A schema class that validates payloads diff --git a/samples/client/petstore/kotlin/docs/paths/fakeuploadfiles/post/responses/FakeuploadfilesPostCode200Response.md b/samples/client/petstore/kotlin/docs/paths/fakeuploadfiles/post/responses/FakeuploadfilesPostCode200Response.md deleted file mode 100644 index b45d0bb35dc..00000000000 --- a/samples/client/petstore/kotlin/docs/paths/fakeuploadfiles/post/responses/FakeuploadfilesPostCode200Response.md +++ /dev/null @@ -1,87 +0,0 @@ -# FakeuploadfilesPostCode200Response - -public class FakeuploadfilesPostCode200Response - -A class that contains necessary nested response classes -- SealedMediaType, a sealed interface which contains all the schema/encoding info for each contentType -- records which implement SealedMediaType, the concrete media types -- SealedResponseBody, a sealed interface which contains all the contentType/schema types -- records which implement SealedResponseBody, the concrete response body types -- a class that extends ResponseDeserializer and is used to deserialize responses - -## Nested Class Summary -| Modifier and Type | Class and Description | -| ----------------- | --------------------- | -| sealed interface | [FakeuploadfilesPostCode200Response.SealedMediaType](#sealedmediatype)
media type sealed interface | -| record | [FakeuploadfilesPostCode200Response.ApplicationjsonMediaType](#applicationjsonmediatype)
record storing schema + encoding for a specific contentType | -| sealed interface | [FakeuploadfilesPostCode200Response.SealedResponseBody](#sealedresponsebody)
response body sealed interface | -| record | [FakeuploadfilesPostCode200Response.ApplicationjsonResponseBody](#applicationjsonresponsebody)
implements sealed interface to store response body | -| static class | [FakeuploadfilesPostCode200Response.FakeuploadfilesPostCode200Response1](#fakeuploadfilespostcode200response1)
class that deserializes responses | - -## SealedMediaType -public sealed interface SealedMediaType
-permits
-[ApplicationjsonMediaType](#applicationjsonmediatype) - -sealed interface that stores schema and encoding info - -## ApplicationjsonMediaType -public record ApplicationjsonMediaType
-implements [SealedMediaType](#sealedmediatype), MediaType<[ApplicationjsonSchema.ApplicationjsonSchema1](../../../../paths/fakeuploadfiles/post/responses/code200response/content/applicationjson/ApplicationjsonSchema.md#applicationjsonschema1), Nothing?> - -class storing schema info for a specific contentType - -### Constructor Summary -| Constructor and Description | -| --------------------------- | -| ApplicationjsonMediaType()
Creates an instance | - -### Method Summary -| Modifier and Type | Method and Description | -| ----------------- | ---------------------- | -| [ApplicationjsonSchema.ApplicationjsonSchema1](../../../../paths/fakeuploadfiles/post/responses/code200response/content/applicationjson/ApplicationjsonSchema.md#applicationjsonschema1) | schema()
the schema for this MediaType | -| Nothing? | encoding()
the encoding info | - -## SealedResponseBody -public sealed interface SealedResponseBody
-permits
-[ApplicationjsonResponseBody](#applicationjsonresponsebody) - -sealed interface that stores response body - -## ApplicationjsonResponseBody -public record ApplicationjsonResponseBody
-implements [SealedResponseBody](#sealedresponsebody) - -A record class to store response body for contentType="application/json" - -### Constructor Summary -| Constructor and Description | -| --------------------------- | -| ApplicationjsonResponseBody(ApplicationjsonSchema.[ApiResponseSchema1Boxed](../../../../components/schemas/ApiResponseSchema.md#apiresponseschema1boxed) body)
Creates an instance | - -### Method Summary -| Modifier and Type | Method and Description | -| ----------------- | ---------------------- | -| ApplicationjsonSchema.[ApiResponseSchema1Boxed](../../../../components/schemas/ApiResponseSchema.md#apiresponseschema1boxed) | body()
returns the body passed in in the constructor | - -## FakeuploadfilesPostCode200Response1 -public static class FakeuploadfilesPostCode200Response1
-extends ResponseDeserializer<[SealedResponseBody](#sealedresponsebody), Nothing?, [SealedMediaType](#sealedmediatype)> - -a class that deserializes responses - -### Constructor Summary -| Constructor and Description | -| --------------------------- | -| FakeuploadfilesPostCode200Response1()
Creates an instance | - -### Field Summary -| Modifier and Type | Field and Description | -| ----------------- | --------------------- | -| 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 | -| ----------------- | ---------------------- | -| ApiResponse<[SealedResponseBody](#sealedresponsebody), Nothing?> | deserialize(HttpResponse response, SchemaConfiguration configuration)
called by endpoint when deserialize responses | diff --git a/samples/client/petstore/kotlin/docs/paths/fakeuploadfiles/post/responses/code200response/content/applicationjson/ApplicationjsonSchema.md b/samples/client/petstore/kotlin/docs/paths/fakeuploadfiles/post/responses/code200response/content/applicationjson/ApplicationjsonSchema.md deleted file mode 100644 index bb60c5776fb..00000000000 --- a/samples/client/petstore/kotlin/docs/paths/fakeuploadfiles/post/responses/code200response/content/applicationjson/ApplicationjsonSchema.md +++ /dev/null @@ -1,19 +0,0 @@ -# ApplicationjsonSchema -public class ApplicationjsonSchema
-extends [ApiResponseSchema1](../../../../../../../components/schemas/ApiResponseSchema.md#apiresponseschema) - -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 - -## Nested Class Summary -| Modifier and Type | Class and Description | -| ----------------- | ---------------------- | -| static class | [ApplicationjsonSchema.ApplicationjsonSchema1](#applicationjsonschema1)
schema class | - -## ApplicationjsonSchema1 -public static class ApplicationjsonSchema1
-extends [ApiResponseSchema.ApiResponseSchema1](../../../../../../../components/schemas/ApiResponseSchema.md#apiresponseschema1) - -A schema class that validates payloads diff --git a/samples/client/petstore/kotlin/docs/paths/fakewildcardresponses/FakewildcardresponsesGet.md b/samples/client/petstore/kotlin/docs/paths/fakewildcardresponses/FakewildcardresponsesGet.md deleted file mode 100644 index f0e232db0bd..00000000000 --- a/samples/client/petstore/kotlin/docs/paths/fakewildcardresponses/FakewildcardresponsesGet.md +++ /dev/null @@ -1,163 +0,0 @@ -# FakewildcardresponsesGet - -public class FakewildcardresponsesGet - -A class that contains necessary endpoint classes -- a class that calls the endpoint method using the http verb -- a class that calls the endpoint method using the operationId name -- class(es) to store the request inputs -- builder(s) to set the request input data - -## Nested Class Summary -| Modifier and Type | Class and Description | -| ----------------- | --------------------- | -| static class | [Get](#get)
The class that has a get method to call the endpoint | -| interface | [WildCardResponsesOperation](#wildcardresponsesoperation)
The interface that has a wildCardResponses method to call the endpoint | -| static class | [GetRequest](#getrequest)
The request inputs class | -| static class | [GetRequestBuilder](#getrequestbuilder)
A builder for the request input class | - -## Get -public static class Get extends ApiClient.ApiClient1 implements GetOperation
- -a class that allows one to call the endpoint using a method named get - -### 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.servers.RootServer0; -import org.openapijsonschematools.client.servers.RootServer1; -import org.openapijsonschematools.client.servers.RootServer2; -import org.openapijsonschematools.client.paths.fakewildcardresponses.get.responses.FakewildcardresponsesGetCode1XXResponse; -import org.openapijsonschematools.client.paths.fakewildcardresponses.get.responses.FakewildcardresponsesGetCode200Response; -import org.openapijsonschematools.client.paths.fakewildcardresponses.get.responses.FakewildcardresponsesGetCode2XXResponse; -import org.openapijsonschematools.client.paths.fakewildcardresponses.get.responses.FakewildcardresponsesGetCode3XXResponse; -import org.openapijsonschematools.client.paths.fakewildcardresponses.get.responses.FakewildcardresponsesGetCode4XXResponse; -import org.openapijsonschematools.client.paths.fakewildcardresponses.get.responses.FakewildcardresponsesGetCode5XXResponse; -import org.openapijsonschematools.client.servers.RootServerInfo; -import org.openapijsonschematools.client.paths.fakewildcardresponses.FakewildcardresponsesGet; -import org.openapijsonschematools.client.paths.fakewildcardresponses.get.FakewildcardresponsesGetResponses; - -import java.io.IOException; -import java.util.Arrays; -import java.util.List; -import java.util.Map; -import java.util.AbstractMap; - -// if you want to use a server that is not SERVER_0 pass it in here and change the ServerIndex input below -ApiConfiguration.ServerInfo serverInfo = new ApiConfiguration.ServerInfoBuilder() - .rootServerInfo( - new RootServerInfo.RootServerInfoBuilder() - .rootServer0(new RootServer0()) - .build() - ) - .build(); -ApiConfiguration.ServerIndexInfo serverIndexInfo = new ApiConfiguration.ServerIndexInfoBuilder() - .rootServerInfoServerIndex(RootServerInfo.ServerIndex.SERVER_0) - .build(); -Duration timeout = Duration.ofSeconds(1L); -Map> defaultHeaders = Map.of("User-Agent", List.of("OpenAPI-JSON-Schema-Generator/1.0.0/java")); -ApiConfiguration apiConfiguration = new ApiConfiguration( - serverInfo - serverIndexInfo, - timeout, - defaultHeaders -); -SchemaConfiguration schemaConfiguration = new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().build()); -FakewildcardresponsesGet.Get apiClient = new FakewildcardresponsesGet.Get(apiConfiguration, schemaConfiguration); - - -var request = new FakewildcardresponsesGet.GetRequestBuilder().build(); - -FakewildcardresponsesGetResponses.EndpointResponse response; -try { - response = apiClient.get(request); -} catch (FakewildcardresponsesGetCode4XXResponse.ResponseApiException | FakewildcardresponsesGetCode5XXResponse.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; -} -if (response instanceof FakewildcardresponsesGetResponses.EndpointFakewildcardresponsesGetCode1XXResponse castResponse) { - FakewildcardresponsesGetCode1XXResponse.ApplicationjsonResponseBody deserializedBody = (FakewildcardresponsesGetCode1XXResponse.ApplicationjsonResponseBody) castResponse.body; - // handle deserialized body here -} else if (response instanceof FakewildcardresponsesGetResponses.EndpointFakewildcardresponsesGetCode2XXResponse castResponse) { - FakewildcardresponsesGetCode2XXResponse.ApplicationjsonResponseBody deserializedBody = (FakewildcardresponsesGetCode2XXResponse.ApplicationjsonResponseBody) castResponse.body; - // handle deserialized body here -} else if (response instanceof FakewildcardresponsesGetResponses.EndpointFakewildcardresponsesGetCode200Response castResponse) { - FakewildcardresponsesGetCode200Response.ApplicationjsonResponseBody deserializedBody = (FakewildcardresponsesGetCode200Response.ApplicationjsonResponseBody) castResponse.body; - // handle deserialized body here -} else { - FakewildcardresponsesGetResponses.EndpointFakewildcardresponsesGetCode3XXResponse castResponse = (FakewildcardresponsesGetResponses.EndpointFakewildcardresponsesGetCode3XXResponse) response; - FakewildcardresponsesGetCode3XXResponse.ApplicationjsonResponseBody deserializedBody = (FakewildcardresponsesGetCode3XXResponse.ApplicationjsonResponseBody) castResponse.body; - // handle deserialized body here -} -``` -### Constructor Summary -| Constructor and Description | -| --------------------------- | -| Get(ApiConfiguration apiConfiguration, SchemaConfiguration schemaConfiguration)
Creates an instance | - -### Method Summary -| Modifier and Type | Method and Description | -| ----------------- | ---------------------- | -| [FakewildcardresponsesGetResponses.EndpointResponse](../../paths/fakewildcardresponses/get/FakewildcardresponsesGetResponses.md#endpointresponse) | get([GetRequest](#getrequest) request) | - -## WildCardResponsesOperation -public interface WildCardResponsesOperation
- -an interface that allows one to call the endpoint using a method named wildCardResponses by the operationId - -### Method Summary -| Modifier and Type | Method and Description | -| ----------------- | ---------------------- | -| [FakewildcardresponsesGetResponses.EndpointResponse](../../paths/fakewildcardresponses/get/FakewildcardresponsesGetResponses.md#endpointresponse) | wildCardResponses([GetRequest](#getrequest) request) | - -## GetRequest -public static class GetRequest
- -a class that stores the final request inputs - -### Field Summary -| Modifier and Type | Field and Description | -| ----------------- | --------------------- | -| [RootServerInfo.@Nullable ServerIndex](../../RootServerInfo.md#serverindex) | serverIndex
optional. Note: this will override the value in apiConfiguration | -| @Nullable Duration | timeout
optional. Note: this will override the value in apiConfiguration | - -## GetRequestBuilder -public static class GetRequestBuilder
- -a builder for request inputs - -### Constructor Summary -| Constructor and Description | -| --------------------------- | -| GetRequestBuilder()
Creates a builder that contains null for all parameters | - -### Method Summary -| Modifier and Type | Method and Description | -| ----------------- | ---------------------- | -| [GetRequest](#getrequest) | build()
Returns the request input used to call an endpoint method | -| [GetRequestBuilder](#getrequestbuilder) | serverIndex([RootServerInfo.ServerIndex](../../RootServerInfo.md#serverindex) serverIndex)
sets the optional property. Note: this will override the value in apiConfiguration | -| [GetRequestBuilder](#getrequestbuilder) | timeout(Duration timeout)
sets the optional property. Note: this will override the value in apiConfiguration | - -[[Back to top]](#top) [[Back to README]](../../../README.md) diff --git a/samples/client/petstore/kotlin/docs/paths/fakewildcardresponses/get/FakewildcardresponsesGetResponses.md b/samples/client/petstore/kotlin/docs/paths/fakewildcardresponses/get/FakewildcardresponsesGetResponses.md deleted file mode 100644 index 10047a6de1b..00000000000 --- a/samples/client/petstore/kotlin/docs/paths/fakewildcardresponses/get/FakewildcardresponsesGetResponses.md +++ /dev/null @@ -1,62 +0,0 @@ -# FakewildcardresponsesGetResponses - -public class FakewildcardresponsesGetResponses - -A class that contains necessary responses classes -- a sealed interface, EndpointResponse, that stores endpoint responses -- records for each endpoint response - -## Nested Class Summary -| Modifier and Type | Class and Description | -| ----------------- | --------------------- | -| sealed interface | [EndpointResponse](#endpointresponse)
stores the endpoint responses | -| record | [EndpointFakewildcardresponsesGetCode1XXResponse](#endpointfakewildcardresponsesgetcode1xxresponse)
the response for 1XX | -| record | [EndpointFakewildcardresponsesGetCode2XXResponse](#endpointfakewildcardresponsesgetcode2xxresponse)
the response for 2XX | -| record | [EndpointFakewildcardresponsesGetCode200Response](#endpointfakewildcardresponsesgetcode200response)
the response for 200 | -| record | [EndpointFakewildcardresponsesGetCode3XXResponse](#endpointfakewildcardresponsesgetcode3xxresponse)
the response for 3XX | - -## EndpointResponse -public sealed interface EndpointResponse permits
-[EndpointFakewildcardresponsesGetCode1XXResponse](#endpointfakewildcardresponsesgetcode1xxresponse), -[EndpointFakewildcardresponsesGetCode2XXResponse](#endpointfakewildcardresponsesgetcode2xxresponse), -[EndpointFakewildcardresponsesGetCode200Response](#endpointfakewildcardresponsesgetcode200response), -[EndpointFakewildcardresponsesGetCode3XXResponse](#endpointfakewildcardresponsesgetcode3xxresponse) - -a sealed interface that stores endpoint responses - -## EndpointFakewildcardresponsesGetCode1XXResponse -public record EndpointFakewildcardresponsesGetCode1XXResponse( - HttpResponse response, - [FakewildcardresponsesGetCode1XXResponse.SealedResponseBody](../../../paths/fakewildcardresponses/get/responses/FakewildcardresponsesGetCode1XXResponse.md#sealedresponsebody) body, - Nothing? headers -) implements EndpointResponse, ApiResponse
- -a class that stores an endpoint response - -## EndpointFakewildcardresponsesGetCode2XXResponse -public record EndpointFakewildcardresponsesGetCode2XXResponse( - HttpResponse response, - [FakewildcardresponsesGetCode2XXResponse.SealedResponseBody](../../../paths/fakewildcardresponses/get/responses/FakewildcardresponsesGetCode2XXResponse.md#sealedresponsebody) body, - Nothing? headers -) implements EndpointResponse, ApiResponse
- -a class that stores an endpoint response - -## EndpointFakewildcardresponsesGetCode200Response -public record EndpointFakewildcardresponsesGetCode200Response( - HttpResponse response, - [FakewildcardresponsesGetCode200Response.SealedResponseBody](../../../paths/fakewildcardresponses/get/responses/FakewildcardresponsesGetCode200Response.md#sealedresponsebody) body, - Nothing? headers -) implements EndpointResponse, ApiResponse
- -a class that stores an endpoint response - -## EndpointFakewildcardresponsesGetCode3XXResponse -public record EndpointFakewildcardresponsesGetCode3XXResponse( - HttpResponse response, - [FakewildcardresponsesGetCode3XXResponse.SealedResponseBody](../../../paths/fakewildcardresponses/get/responses/FakewildcardresponsesGetCode3XXResponse.md#sealedresponsebody) body, - Nothing? headers -) implements EndpointResponse, ApiResponse
- -a class that stores an endpoint response - diff --git a/samples/client/petstore/kotlin/docs/paths/fakewildcardresponses/get/responses/FakewildcardresponsesGetCode1XXResponse.md b/samples/client/petstore/kotlin/docs/paths/fakewildcardresponses/get/responses/FakewildcardresponsesGetCode1XXResponse.md deleted file mode 100644 index 37acdf84652..00000000000 --- a/samples/client/petstore/kotlin/docs/paths/fakewildcardresponses/get/responses/FakewildcardresponsesGetCode1XXResponse.md +++ /dev/null @@ -1,87 +0,0 @@ -# FakewildcardresponsesGetCode1XXResponse - -public class FakewildcardresponsesGetCode1XXResponse - -A class that contains necessary nested response classes -- SealedMediaType, a sealed interface which contains all the schema/encoding info for each contentType -- records which implement SealedMediaType, the concrete media types -- SealedResponseBody, a sealed interface which contains all the contentType/schema types -- records which implement SealedResponseBody, the concrete response body types -- a class that extends ResponseDeserializer and is used to deserialize responses - -## Nested Class Summary -| Modifier and Type | Class and Description | -| ----------------- | --------------------- | -| sealed interface | [FakewildcardresponsesGetCode1XXResponse.SealedMediaType](#sealedmediatype)
media type sealed interface | -| record | [FakewildcardresponsesGetCode1XXResponse.ApplicationjsonMediaType](#applicationjsonmediatype)
record storing schema + encoding for a specific contentType | -| sealed interface | [FakewildcardresponsesGetCode1XXResponse.SealedResponseBody](#sealedresponsebody)
response body sealed interface | -| record | [FakewildcardresponsesGetCode1XXResponse.ApplicationjsonResponseBody](#applicationjsonresponsebody)
implements sealed interface to store response body | -| static class | [FakewildcardresponsesGetCode1XXResponse.FakewildcardresponsesGetCode1XXResponse1](#fakewildcardresponsesgetcode1xxresponse1)
class that deserializes responses | - -## SealedMediaType -public sealed interface SealedMediaType
-permits
-[ApplicationjsonMediaType](#applicationjsonmediatype) - -sealed interface that stores schema and encoding info - -## ApplicationjsonMediaType -public record ApplicationjsonMediaType
-implements [SealedMediaType](#sealedmediatype), MediaType<[ApplicationjsonSchema.ApplicationjsonSchema1](../../../../paths/fakewildcardresponses/get/responses/code1xxresponse/content/applicationjson/ApplicationjsonSchema.md#applicationjsonschema1), Nothing?> - -class storing schema info for a specific contentType - -### Constructor Summary -| Constructor and Description | -| --------------------------- | -| ApplicationjsonMediaType()
Creates an instance | - -### Method Summary -| Modifier and Type | Method and Description | -| ----------------- | ---------------------- | -| [ApplicationjsonSchema.ApplicationjsonSchema1](../../../../paths/fakewildcardresponses/get/responses/code1xxresponse/content/applicationjson/ApplicationjsonSchema.md#applicationjsonschema1) | schema()
the schema for this MediaType | -| Nothing? | encoding()
the encoding info | - -## SealedResponseBody -public sealed interface SealedResponseBody
-permits
-[ApplicationjsonResponseBody](#applicationjsonresponsebody) - -sealed interface that stores response body - -## ApplicationjsonResponseBody -public record ApplicationjsonResponseBody
-implements [SealedResponseBody](#sealedresponsebody) - -A record class to store response body for contentType="application/json" - -### Constructor Summary -| Constructor and Description | -| --------------------------- | -| ApplicationjsonResponseBody(ApplicationjsonSchema.AnyTypeJsonSchema1Boxed body)
Creates an instance | - -### Method Summary -| Modifier and Type | Method and Description | -| ----------------- | ---------------------- | -| ApplicationjsonSchema.AnyTypeJsonSchema1Boxed | body()
returns the body passed in in the constructor | - -## FakewildcardresponsesGetCode1XXResponse1 -public static class FakewildcardresponsesGetCode1XXResponse1
-extends ResponseDeserializer<[SealedResponseBody](#sealedresponsebody), Nothing?, [SealedMediaType](#sealedmediatype)> - -a class that deserializes responses - -### Constructor Summary -| Constructor and Description | -| --------------------------- | -| FakewildcardresponsesGetCode1XXResponse1()
Creates an instance | - -### Field Summary -| Modifier and Type | Field and Description | -| ----------------- | --------------------- | -| 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 | -| ----------------- | ---------------------- | -| ApiResponse<[SealedResponseBody](#sealedresponsebody), Nothing?> | deserialize(HttpResponse response, SchemaConfiguration configuration)
called by endpoint when deserialize responses | diff --git a/samples/client/petstore/kotlin/docs/paths/fakewildcardresponses/get/responses/FakewildcardresponsesGetCode200Response.md b/samples/client/petstore/kotlin/docs/paths/fakewildcardresponses/get/responses/FakewildcardresponsesGetCode200Response.md deleted file mode 100644 index 22174a2e3da..00000000000 --- a/samples/client/petstore/kotlin/docs/paths/fakewildcardresponses/get/responses/FakewildcardresponsesGetCode200Response.md +++ /dev/null @@ -1,87 +0,0 @@ -# FakewildcardresponsesGetCode200Response - -public class FakewildcardresponsesGetCode200Response - -A class that contains necessary nested response classes -- SealedMediaType, a sealed interface which contains all the schema/encoding info for each contentType -- records which implement SealedMediaType, the concrete media types -- SealedResponseBody, a sealed interface which contains all the contentType/schema types -- records which implement SealedResponseBody, the concrete response body types -- a class that extends ResponseDeserializer and is used to deserialize responses - -## Nested Class Summary -| Modifier and Type | Class and Description | -| ----------------- | --------------------- | -| sealed interface | [FakewildcardresponsesGetCode200Response.SealedMediaType](#sealedmediatype)
media type sealed interface | -| record | [FakewildcardresponsesGetCode200Response.ApplicationjsonMediaType](#applicationjsonmediatype)
record storing schema + encoding for a specific contentType | -| sealed interface | [FakewildcardresponsesGetCode200Response.SealedResponseBody](#sealedresponsebody)
response body sealed interface | -| record | [FakewildcardresponsesGetCode200Response.ApplicationjsonResponseBody](#applicationjsonresponsebody)
implements sealed interface to store response body | -| static class | [FakewildcardresponsesGetCode200Response.FakewildcardresponsesGetCode200Response1](#fakewildcardresponsesgetcode200response1)
class that deserializes responses | - -## SealedMediaType -public sealed interface SealedMediaType
-permits
-[ApplicationjsonMediaType](#applicationjsonmediatype) - -sealed interface that stores schema and encoding info - -## ApplicationjsonMediaType -public record ApplicationjsonMediaType
-implements [SealedMediaType](#sealedmediatype), MediaType<[ApplicationjsonSchema.ApplicationjsonSchema1](../../../../paths/fakewildcardresponses/get/responses/code200response/content/applicationjson/ApplicationjsonSchema.md#applicationjsonschema1), Nothing?> - -class storing schema info for a specific contentType - -### Constructor Summary -| Constructor and Description | -| --------------------------- | -| ApplicationjsonMediaType()
Creates an instance | - -### Method Summary -| Modifier and Type | Method and Description | -| ----------------- | ---------------------- | -| [ApplicationjsonSchema.ApplicationjsonSchema1](../../../../paths/fakewildcardresponses/get/responses/code200response/content/applicationjson/ApplicationjsonSchema.md#applicationjsonschema1) | schema()
the schema for this MediaType | -| Nothing? | encoding()
the encoding info | - -## SealedResponseBody -public sealed interface SealedResponseBody
-permits
-[ApplicationjsonResponseBody](#applicationjsonresponsebody) - -sealed interface that stores response body - -## ApplicationjsonResponseBody -public record ApplicationjsonResponseBody
-implements [SealedResponseBody](#sealedresponsebody) - -A record class to store response body for contentType="application/json" - -### Constructor Summary -| Constructor and Description | -| --------------------------- | -| ApplicationjsonResponseBody(ApplicationjsonSchema.AnyTypeJsonSchema1Boxed body)
Creates an instance | - -### Method Summary -| Modifier and Type | Method and Description | -| ----------------- | ---------------------- | -| ApplicationjsonSchema.AnyTypeJsonSchema1Boxed | body()
returns the body passed in in the constructor | - -## FakewildcardresponsesGetCode200Response1 -public static class FakewildcardresponsesGetCode200Response1
-extends ResponseDeserializer<[SealedResponseBody](#sealedresponsebody), Nothing?, [SealedMediaType](#sealedmediatype)> - -a class that deserializes responses - -### Constructor Summary -| Constructor and Description | -| --------------------------- | -| FakewildcardresponsesGetCode200Response1()
Creates an instance | - -### Field Summary -| Modifier and Type | Field and Description | -| ----------------- | --------------------- | -| 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 | -| ----------------- | ---------------------- | -| ApiResponse<[SealedResponseBody](#sealedresponsebody), Nothing?> | deserialize(HttpResponse response, SchemaConfiguration configuration)
called by endpoint when deserialize responses | diff --git a/samples/client/petstore/kotlin/docs/paths/fakewildcardresponses/get/responses/FakewildcardresponsesGetCode2XXResponse.md b/samples/client/petstore/kotlin/docs/paths/fakewildcardresponses/get/responses/FakewildcardresponsesGetCode2XXResponse.md deleted file mode 100644 index 890576595c6..00000000000 --- a/samples/client/petstore/kotlin/docs/paths/fakewildcardresponses/get/responses/FakewildcardresponsesGetCode2XXResponse.md +++ /dev/null @@ -1,87 +0,0 @@ -# FakewildcardresponsesGetCode2XXResponse - -public class FakewildcardresponsesGetCode2XXResponse - -A class that contains necessary nested response classes -- SealedMediaType, a sealed interface which contains all the schema/encoding info for each contentType -- records which implement SealedMediaType, the concrete media types -- SealedResponseBody, a sealed interface which contains all the contentType/schema types -- records which implement SealedResponseBody, the concrete response body types -- a class that extends ResponseDeserializer and is used to deserialize responses - -## Nested Class Summary -| Modifier and Type | Class and Description | -| ----------------- | --------------------- | -| sealed interface | [FakewildcardresponsesGetCode2XXResponse.SealedMediaType](#sealedmediatype)
media type sealed interface | -| record | [FakewildcardresponsesGetCode2XXResponse.ApplicationjsonMediaType](#applicationjsonmediatype)
record storing schema + encoding for a specific contentType | -| sealed interface | [FakewildcardresponsesGetCode2XXResponse.SealedResponseBody](#sealedresponsebody)
response body sealed interface | -| record | [FakewildcardresponsesGetCode2XXResponse.ApplicationjsonResponseBody](#applicationjsonresponsebody)
implements sealed interface to store response body | -| static class | [FakewildcardresponsesGetCode2XXResponse.FakewildcardresponsesGetCode2XXResponse1](#fakewildcardresponsesgetcode2xxresponse1)
class that deserializes responses | - -## SealedMediaType -public sealed interface SealedMediaType
-permits
-[ApplicationjsonMediaType](#applicationjsonmediatype) - -sealed interface that stores schema and encoding info - -## ApplicationjsonMediaType -public record ApplicationjsonMediaType
-implements [SealedMediaType](#sealedmediatype), MediaType<[ApplicationjsonSchema.ApplicationjsonSchema1](../../../../paths/fakewildcardresponses/get/responses/code2xxresponse/content/applicationjson/ApplicationjsonSchema.md#applicationjsonschema1), Nothing?> - -class storing schema info for a specific contentType - -### Constructor Summary -| Constructor and Description | -| --------------------------- | -| ApplicationjsonMediaType()
Creates an instance | - -### Method Summary -| Modifier and Type | Method and Description | -| ----------------- | ---------------------- | -| [ApplicationjsonSchema.ApplicationjsonSchema1](../../../../paths/fakewildcardresponses/get/responses/code2xxresponse/content/applicationjson/ApplicationjsonSchema.md#applicationjsonschema1) | schema()
the schema for this MediaType | -| Nothing? | encoding()
the encoding info | - -## SealedResponseBody -public sealed interface SealedResponseBody
-permits
-[ApplicationjsonResponseBody](#applicationjsonresponsebody) - -sealed interface that stores response body - -## ApplicationjsonResponseBody -public record ApplicationjsonResponseBody
-implements [SealedResponseBody](#sealedresponsebody) - -A record class to store response body for contentType="application/json" - -### Constructor Summary -| Constructor and Description | -| --------------------------- | -| ApplicationjsonResponseBody(ApplicationjsonSchema.AnyTypeJsonSchema1Boxed body)
Creates an instance | - -### Method Summary -| Modifier and Type | Method and Description | -| ----------------- | ---------------------- | -| ApplicationjsonSchema.AnyTypeJsonSchema1Boxed | body()
returns the body passed in in the constructor | - -## FakewildcardresponsesGetCode2XXResponse1 -public static class FakewildcardresponsesGetCode2XXResponse1
-extends ResponseDeserializer<[SealedResponseBody](#sealedresponsebody), Nothing?, [SealedMediaType](#sealedmediatype)> - -a class that deserializes responses - -### Constructor Summary -| Constructor and Description | -| --------------------------- | -| FakewildcardresponsesGetCode2XXResponse1()
Creates an instance | - -### Field Summary -| Modifier and Type | Field and Description | -| ----------------- | --------------------- | -| 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 | -| ----------------- | ---------------------- | -| ApiResponse<[SealedResponseBody](#sealedresponsebody), Nothing?> | deserialize(HttpResponse response, SchemaConfiguration configuration)
called by endpoint when deserialize responses | diff --git a/samples/client/petstore/kotlin/docs/paths/fakewildcardresponses/get/responses/FakewildcardresponsesGetCode3XXResponse.md b/samples/client/petstore/kotlin/docs/paths/fakewildcardresponses/get/responses/FakewildcardresponsesGetCode3XXResponse.md deleted file mode 100644 index 9edfeef9d33..00000000000 --- a/samples/client/petstore/kotlin/docs/paths/fakewildcardresponses/get/responses/FakewildcardresponsesGetCode3XXResponse.md +++ /dev/null @@ -1,87 +0,0 @@ -# FakewildcardresponsesGetCode3XXResponse - -public class FakewildcardresponsesGetCode3XXResponse - -A class that contains necessary nested response classes -- SealedMediaType, a sealed interface which contains all the schema/encoding info for each contentType -- records which implement SealedMediaType, the concrete media types -- SealedResponseBody, a sealed interface which contains all the contentType/schema types -- records which implement SealedResponseBody, the concrete response body types -- a class that extends ResponseDeserializer and is used to deserialize responses - -## Nested Class Summary -| Modifier and Type | Class and Description | -| ----------------- | --------------------- | -| sealed interface | [FakewildcardresponsesGetCode3XXResponse.SealedMediaType](#sealedmediatype)
media type sealed interface | -| record | [FakewildcardresponsesGetCode3XXResponse.ApplicationjsonMediaType](#applicationjsonmediatype)
record storing schema + encoding for a specific contentType | -| sealed interface | [FakewildcardresponsesGetCode3XXResponse.SealedResponseBody](#sealedresponsebody)
response body sealed interface | -| record | [FakewildcardresponsesGetCode3XXResponse.ApplicationjsonResponseBody](#applicationjsonresponsebody)
implements sealed interface to store response body | -| static class | [FakewildcardresponsesGetCode3XXResponse.FakewildcardresponsesGetCode3XXResponse1](#fakewildcardresponsesgetcode3xxresponse1)
class that deserializes responses | - -## SealedMediaType -public sealed interface SealedMediaType
-permits
-[ApplicationjsonMediaType](#applicationjsonmediatype) - -sealed interface that stores schema and encoding info - -## ApplicationjsonMediaType -public record ApplicationjsonMediaType
-implements [SealedMediaType](#sealedmediatype), MediaType<[ApplicationjsonSchema.ApplicationjsonSchema1](../../../../paths/fakewildcardresponses/get/responses/code3xxresponse/content/applicationjson/ApplicationjsonSchema.md#applicationjsonschema1), Nothing?> - -class storing schema info for a specific contentType - -### Constructor Summary -| Constructor and Description | -| --------------------------- | -| ApplicationjsonMediaType()
Creates an instance | - -### Method Summary -| Modifier and Type | Method and Description | -| ----------------- | ---------------------- | -| [ApplicationjsonSchema.ApplicationjsonSchema1](../../../../paths/fakewildcardresponses/get/responses/code3xxresponse/content/applicationjson/ApplicationjsonSchema.md#applicationjsonschema1) | schema()
the schema for this MediaType | -| Nothing? | encoding()
the encoding info | - -## SealedResponseBody -public sealed interface SealedResponseBody
-permits
-[ApplicationjsonResponseBody](#applicationjsonresponsebody) - -sealed interface that stores response body - -## ApplicationjsonResponseBody -public record ApplicationjsonResponseBody
-implements [SealedResponseBody](#sealedresponsebody) - -A record class to store response body for contentType="application/json" - -### Constructor Summary -| Constructor and Description | -| --------------------------- | -| ApplicationjsonResponseBody(ApplicationjsonSchema.AnyTypeJsonSchema1Boxed body)
Creates an instance | - -### Method Summary -| Modifier and Type | Method and Description | -| ----------------- | ---------------------- | -| ApplicationjsonSchema.AnyTypeJsonSchema1Boxed | body()
returns the body passed in in the constructor | - -## FakewildcardresponsesGetCode3XXResponse1 -public static class FakewildcardresponsesGetCode3XXResponse1
-extends ResponseDeserializer<[SealedResponseBody](#sealedresponsebody), Nothing?, [SealedMediaType](#sealedmediatype)> - -a class that deserializes responses - -### Constructor Summary -| Constructor and Description | -| --------------------------- | -| FakewildcardresponsesGetCode3XXResponse1()
Creates an instance | - -### Field Summary -| Modifier and Type | Field and Description | -| ----------------- | --------------------- | -| 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 | -| ----------------- | ---------------------- | -| ApiResponse<[SealedResponseBody](#sealedresponsebody), Nothing?> | deserialize(HttpResponse response, SchemaConfiguration configuration)
called by endpoint when deserialize responses | diff --git a/samples/client/petstore/kotlin/docs/paths/fakewildcardresponses/get/responses/FakewildcardresponsesGetCode4XXResponse.md b/samples/client/petstore/kotlin/docs/paths/fakewildcardresponses/get/responses/FakewildcardresponsesGetCode4XXResponse.md deleted file mode 100644 index c703e8baa23..00000000000 --- a/samples/client/petstore/kotlin/docs/paths/fakewildcardresponses/get/responses/FakewildcardresponsesGetCode4XXResponse.md +++ /dev/null @@ -1,87 +0,0 @@ -# FakewildcardresponsesGetCode4XXResponse - -public class FakewildcardresponsesGetCode4XXResponse - -A class that contains necessary nested response classes -- SealedMediaType, a sealed interface which contains all the schema/encoding info for each contentType -- records which implement SealedMediaType, the concrete media types -- SealedResponseBody, a sealed interface which contains all the contentType/schema types -- records which implement SealedResponseBody, the concrete response body types -- a class that extends ResponseDeserializer and is used to deserialize responses - -## Nested Class Summary -| Modifier and Type | Class and Description | -| ----------------- | --------------------- | -| sealed interface | [FakewildcardresponsesGetCode4XXResponse.SealedMediaType](#sealedmediatype)
media type sealed interface | -| record | [FakewildcardresponsesGetCode4XXResponse.ApplicationjsonMediaType](#applicationjsonmediatype)
record storing schema + encoding for a specific contentType | -| sealed interface | [FakewildcardresponsesGetCode4XXResponse.SealedResponseBody](#sealedresponsebody)
response body sealed interface | -| record | [FakewildcardresponsesGetCode4XXResponse.ApplicationjsonResponseBody](#applicationjsonresponsebody)
implements sealed interface to store response body | -| static class | [FakewildcardresponsesGetCode4XXResponse.FakewildcardresponsesGetCode4XXResponse1](#fakewildcardresponsesgetcode4xxresponse1)
class that deserializes responses | - -## SealedMediaType -public sealed interface SealedMediaType
-permits
-[ApplicationjsonMediaType](#applicationjsonmediatype) - -sealed interface that stores schema and encoding info - -## ApplicationjsonMediaType -public record ApplicationjsonMediaType
-implements [SealedMediaType](#sealedmediatype), MediaType<[ApplicationjsonSchema.ApplicationjsonSchema1](../../../../paths/fakewildcardresponses/get/responses/code4xxresponse/content/applicationjson/ApplicationjsonSchema.md#applicationjsonschema1), Nothing?> - -class storing schema info for a specific contentType - -### Constructor Summary -| Constructor and Description | -| --------------------------- | -| ApplicationjsonMediaType()
Creates an instance | - -### Method Summary -| Modifier and Type | Method and Description | -| ----------------- | ---------------------- | -| [ApplicationjsonSchema.ApplicationjsonSchema1](../../../../paths/fakewildcardresponses/get/responses/code4xxresponse/content/applicationjson/ApplicationjsonSchema.md#applicationjsonschema1) | schema()
the schema for this MediaType | -| Nothing? | encoding()
the encoding info | - -## SealedResponseBody -public sealed interface SealedResponseBody
-permits
-[ApplicationjsonResponseBody](#applicationjsonresponsebody) - -sealed interface that stores response body - -## ApplicationjsonResponseBody -public record ApplicationjsonResponseBody
-implements [SealedResponseBody](#sealedresponsebody) - -A record class to store response body for contentType="application/json" - -### Constructor Summary -| Constructor and Description | -| --------------------------- | -| ApplicationjsonResponseBody(ApplicationjsonSchema.AnyTypeJsonSchema1Boxed body)
Creates an instance | - -### Method Summary -| Modifier and Type | Method and Description | -| ----------------- | ---------------------- | -| ApplicationjsonSchema.AnyTypeJsonSchema1Boxed | body()
returns the body passed in in the constructor | - -## FakewildcardresponsesGetCode4XXResponse1 -public static class FakewildcardresponsesGetCode4XXResponse1
-extends ResponseDeserializer<[SealedResponseBody](#sealedresponsebody), Nothing?, [SealedMediaType](#sealedmediatype)> - -a class that deserializes responses - -### Constructor Summary -| Constructor and Description | -| --------------------------- | -| FakewildcardresponsesGetCode4XXResponse1()
Creates an instance | - -### Field Summary -| Modifier and Type | Field and Description | -| ----------------- | --------------------- | -| 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 | -| ----------------- | ---------------------- | -| ApiResponse<[SealedResponseBody](#sealedresponsebody), Nothing?> | deserialize(HttpResponse response, SchemaConfiguration configuration)
called by endpoint when deserialize responses | diff --git a/samples/client/petstore/kotlin/docs/paths/fakewildcardresponses/get/responses/FakewildcardresponsesGetCode5XXResponse.md b/samples/client/petstore/kotlin/docs/paths/fakewildcardresponses/get/responses/FakewildcardresponsesGetCode5XXResponse.md deleted file mode 100644 index e032cb6c199..00000000000 --- a/samples/client/petstore/kotlin/docs/paths/fakewildcardresponses/get/responses/FakewildcardresponsesGetCode5XXResponse.md +++ /dev/null @@ -1,87 +0,0 @@ -# FakewildcardresponsesGetCode5XXResponse - -public class FakewildcardresponsesGetCode5XXResponse - -A class that contains necessary nested response classes -- SealedMediaType, a sealed interface which contains all the schema/encoding info for each contentType -- records which implement SealedMediaType, the concrete media types -- SealedResponseBody, a sealed interface which contains all the contentType/schema types -- records which implement SealedResponseBody, the concrete response body types -- a class that extends ResponseDeserializer and is used to deserialize responses - -## Nested Class Summary -| Modifier and Type | Class and Description | -| ----------------- | --------------------- | -| sealed interface | [FakewildcardresponsesGetCode5XXResponse.SealedMediaType](#sealedmediatype)
media type sealed interface | -| record | [FakewildcardresponsesGetCode5XXResponse.ApplicationjsonMediaType](#applicationjsonmediatype)
record storing schema + encoding for a specific contentType | -| sealed interface | [FakewildcardresponsesGetCode5XXResponse.SealedResponseBody](#sealedresponsebody)
response body sealed interface | -| record | [FakewildcardresponsesGetCode5XXResponse.ApplicationjsonResponseBody](#applicationjsonresponsebody)
implements sealed interface to store response body | -| static class | [FakewildcardresponsesGetCode5XXResponse.FakewildcardresponsesGetCode5XXResponse1](#fakewildcardresponsesgetcode5xxresponse1)
class that deserializes responses | - -## SealedMediaType -public sealed interface SealedMediaType
-permits
-[ApplicationjsonMediaType](#applicationjsonmediatype) - -sealed interface that stores schema and encoding info - -## ApplicationjsonMediaType -public record ApplicationjsonMediaType
-implements [SealedMediaType](#sealedmediatype), MediaType<[ApplicationjsonSchema.ApplicationjsonSchema1](../../../../paths/fakewildcardresponses/get/responses/code5xxresponse/content/applicationjson/ApplicationjsonSchema.md#applicationjsonschema1), Nothing?> - -class storing schema info for a specific contentType - -### Constructor Summary -| Constructor and Description | -| --------------------------- | -| ApplicationjsonMediaType()
Creates an instance | - -### Method Summary -| Modifier and Type | Method and Description | -| ----------------- | ---------------------- | -| [ApplicationjsonSchema.ApplicationjsonSchema1](../../../../paths/fakewildcardresponses/get/responses/code5xxresponse/content/applicationjson/ApplicationjsonSchema.md#applicationjsonschema1) | schema()
the schema for this MediaType | -| Nothing? | encoding()
the encoding info | - -## SealedResponseBody -public sealed interface SealedResponseBody
-permits
-[ApplicationjsonResponseBody](#applicationjsonresponsebody) - -sealed interface that stores response body - -## ApplicationjsonResponseBody -public record ApplicationjsonResponseBody
-implements [SealedResponseBody](#sealedresponsebody) - -A record class to store response body for contentType="application/json" - -### Constructor Summary -| Constructor and Description | -| --------------------------- | -| ApplicationjsonResponseBody(ApplicationjsonSchema.AnyTypeJsonSchema1Boxed body)
Creates an instance | - -### Method Summary -| Modifier and Type | Method and Description | -| ----------------- | ---------------------- | -| ApplicationjsonSchema.AnyTypeJsonSchema1Boxed | body()
returns the body passed in in the constructor | - -## FakewildcardresponsesGetCode5XXResponse1 -public static class FakewildcardresponsesGetCode5XXResponse1
-extends ResponseDeserializer<[SealedResponseBody](#sealedresponsebody), Nothing?, [SealedMediaType](#sealedmediatype)> - -a class that deserializes responses - -### Constructor Summary -| Constructor and Description | -| --------------------------- | -| FakewildcardresponsesGetCode5XXResponse1()
Creates an instance | - -### Field Summary -| Modifier and Type | Field and Description | -| ----------------- | --------------------- | -| 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 | -| ----------------- | ---------------------- | -| ApiResponse<[SealedResponseBody](#sealedresponsebody), Nothing?> | deserialize(HttpResponse response, SchemaConfiguration configuration)
called by endpoint when deserialize responses | diff --git a/samples/client/petstore/kotlin/docs/paths/fakewildcardresponses/get/responses/code1xxresponse/content/applicationjson/ApplicationjsonSchema.md b/samples/client/petstore/kotlin/docs/paths/fakewildcardresponses/get/responses/code1xxresponse/content/applicationjson/ApplicationjsonSchema.md deleted file mode 100644 index b05260b1abf..00000000000 --- a/samples/client/petstore/kotlin/docs/paths/fakewildcardresponses/get/responses/code1xxresponse/content/applicationjson/ApplicationjsonSchema.md +++ /dev/null @@ -1,144 +0,0 @@ -# ApplicationjsonSchema -public class ApplicationjsonSchema
- -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 - -## Nested Class Summary -| Modifier and Type | Class and Description | -| ----------------- | ---------------------- | -| sealed interface | [ApplicationjsonSchema.ApplicationjsonSchema1Boxed](#applicationjsonschema1boxed)
sealed interface for validated payloads | -| record | [ApplicationjsonSchema.ApplicationjsonSchema1BoxedVoid](#applicationjsonschema1boxedvoid)
boxed class to store validated null payloads | -| record | [ApplicationjsonSchema.ApplicationjsonSchema1BoxedBoolean](#applicationjsonschema1boxedboolean)
boxed class to store validated boolean payloads | -| record | [ApplicationjsonSchema.ApplicationjsonSchema1BoxedNumber](#applicationjsonschema1boxednumber)
boxed class to store validated Number payloads | -| record | [ApplicationjsonSchema.ApplicationjsonSchema1BoxedString](#applicationjsonschema1boxedstring)
boxed class to store validated String payloads | -| record | [ApplicationjsonSchema.ApplicationjsonSchema1BoxedList](#applicationjsonschema1boxedlist)
boxed class to store validated List payloads | -| record | [ApplicationjsonSchema.ApplicationjsonSchema1BoxedMap](#applicationjsonschema1boxedmap)
boxed class to store validated Map payloads | -| static class | [ApplicationjsonSchema.ApplicationjsonSchema1](#applicationjsonschema1)
schema class | - -## ApplicationjsonSchema1Boxed -public sealed interface ApplicationjsonSchema1Boxed
-permits
-[ApplicationjsonSchema1BoxedVoid](#applicationjsonschema1boxedvoid), -[ApplicationjsonSchema1BoxedBoolean](#applicationjsonschema1boxedboolean), -[ApplicationjsonSchema1BoxedNumber](#applicationjsonschema1boxednumber), -[ApplicationjsonSchema1BoxedString](#applicationjsonschema1boxedstring), -[ApplicationjsonSchema1BoxedList](#applicationjsonschema1boxedlist), -[ApplicationjsonSchema1BoxedMap](#applicationjsonschema1boxedmap) - -sealed interface that stores validated payloads using boxed classes - -## ApplicationjsonSchema1BoxedVoid -public record ApplicationjsonSchema1BoxedVoid
-implements [ApplicationjsonSchema1Boxed](#applicationjsonschema1boxed) - -record that stores validated null payloads, sealed permits implementation - -### Constructor Summary -| Constructor and Description | -| --------------------------- | -| ApplicationjsonSchema1BoxedVoid(Nothing? data)
Creates an instance, private visibility | - -### Method Summary -| Modifier and Type | Method and Description | -| ----------------- | ---------------------- | -| Nothing? | data()
validated payload | -| @Nullable Object | getData()
validated payload | - -## ApplicationjsonSchema1BoxedBoolean -public record ApplicationjsonSchema1BoxedBoolean
-implements [ApplicationjsonSchema1Boxed](#applicationjsonschema1boxed) - -record that stores validated boolean payloads, sealed permits implementation - -### Constructor Summary -| Constructor and Description | -| --------------------------- | -| ApplicationjsonSchema1BoxedBoolean(boolean data)
Creates an instance, private visibility | - -### Method Summary -| Modifier and Type | Method and Description | -| ----------------- | ---------------------- | -| boolean | data()
validated payload | -| @Nullable Object | getData()
validated payload | - -## ApplicationjsonSchema1BoxedNumber -public record ApplicationjsonSchema1BoxedNumber
-implements [ApplicationjsonSchema1Boxed](#applicationjsonschema1boxed) - -record that stores validated Number payloads, sealed permits implementation - -### Constructor Summary -| Constructor and Description | -| --------------------------- | -| ApplicationjsonSchema1BoxedNumber(Number data)
Creates an instance, private visibility | - -### Method Summary -| Modifier and Type | Method and Description | -| ----------------- | ---------------------- | -| Number | data()
validated payload | -| @Nullable Object | getData()
validated payload | - -## ApplicationjsonSchema1BoxedString -public record ApplicationjsonSchema1BoxedString
-implements [ApplicationjsonSchema1Boxed](#applicationjsonschema1boxed) - -record that stores validated String payloads, sealed permits implementation - -### Constructor Summary -| Constructor and Description | -| --------------------------- | -| ApplicationjsonSchema1BoxedString(String data)
Creates an instance, private visibility | - -### Method Summary -| Modifier and Type | Method and Description | -| ----------------- | ---------------------- | -| String | data()
validated payload | -| @Nullable Object | getData()
validated payload | - -## ApplicationjsonSchema1BoxedList -public record ApplicationjsonSchema1BoxedList
-implements [ApplicationjsonSchema1Boxed](#applicationjsonschema1boxed) - -record that stores validated List payloads, sealed permits implementation - -### Constructor Summary -| Constructor and Description | -| --------------------------- | -| ApplicationjsonSchema1BoxedList(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 | - -## ApplicationjsonSchema1BoxedMap -public record ApplicationjsonSchema1BoxedMap
-implements [ApplicationjsonSchema1Boxed](#applicationjsonschema1boxed) - -record that stores validated Map payloads, sealed permits implementation - -### Constructor Summary -| Constructor and Description | -| --------------------------- | -| ApplicationjsonSchema1BoxedMap(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 | - -## ApplicationjsonSchema1 -public static class ApplicationjsonSchema1
-extends AnyTypeJsonSchema.AnyTypeJsonSchema1 - -A schema class that validates payloads - -| Methods Inherited from class org.openapijsonschematools.client.schemas.AnyTypeJsonSchema.AnyTypeJsonSchema1 | -| ------------------------------------------------------------------ | -| validate | -| validateAndBox | diff --git a/samples/client/petstore/kotlin/docs/paths/fakewildcardresponses/get/responses/code200response/content/applicationjson/ApplicationjsonSchema.md b/samples/client/petstore/kotlin/docs/paths/fakewildcardresponses/get/responses/code200response/content/applicationjson/ApplicationjsonSchema.md deleted file mode 100644 index b05260b1abf..00000000000 --- a/samples/client/petstore/kotlin/docs/paths/fakewildcardresponses/get/responses/code200response/content/applicationjson/ApplicationjsonSchema.md +++ /dev/null @@ -1,144 +0,0 @@ -# ApplicationjsonSchema -public class ApplicationjsonSchema
- -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 - -## Nested Class Summary -| Modifier and Type | Class and Description | -| ----------------- | ---------------------- | -| sealed interface | [ApplicationjsonSchema.ApplicationjsonSchema1Boxed](#applicationjsonschema1boxed)
sealed interface for validated payloads | -| record | [ApplicationjsonSchema.ApplicationjsonSchema1BoxedVoid](#applicationjsonschema1boxedvoid)
boxed class to store validated null payloads | -| record | [ApplicationjsonSchema.ApplicationjsonSchema1BoxedBoolean](#applicationjsonschema1boxedboolean)
boxed class to store validated boolean payloads | -| record | [ApplicationjsonSchema.ApplicationjsonSchema1BoxedNumber](#applicationjsonschema1boxednumber)
boxed class to store validated Number payloads | -| record | [ApplicationjsonSchema.ApplicationjsonSchema1BoxedString](#applicationjsonschema1boxedstring)
boxed class to store validated String payloads | -| record | [ApplicationjsonSchema.ApplicationjsonSchema1BoxedList](#applicationjsonschema1boxedlist)
boxed class to store validated List payloads | -| record | [ApplicationjsonSchema.ApplicationjsonSchema1BoxedMap](#applicationjsonschema1boxedmap)
boxed class to store validated Map payloads | -| static class | [ApplicationjsonSchema.ApplicationjsonSchema1](#applicationjsonschema1)
schema class | - -## ApplicationjsonSchema1Boxed -public sealed interface ApplicationjsonSchema1Boxed
-permits
-[ApplicationjsonSchema1BoxedVoid](#applicationjsonschema1boxedvoid), -[ApplicationjsonSchema1BoxedBoolean](#applicationjsonschema1boxedboolean), -[ApplicationjsonSchema1BoxedNumber](#applicationjsonschema1boxednumber), -[ApplicationjsonSchema1BoxedString](#applicationjsonschema1boxedstring), -[ApplicationjsonSchema1BoxedList](#applicationjsonschema1boxedlist), -[ApplicationjsonSchema1BoxedMap](#applicationjsonschema1boxedmap) - -sealed interface that stores validated payloads using boxed classes - -## ApplicationjsonSchema1BoxedVoid -public record ApplicationjsonSchema1BoxedVoid
-implements [ApplicationjsonSchema1Boxed](#applicationjsonschema1boxed) - -record that stores validated null payloads, sealed permits implementation - -### Constructor Summary -| Constructor and Description | -| --------------------------- | -| ApplicationjsonSchema1BoxedVoid(Nothing? data)
Creates an instance, private visibility | - -### Method Summary -| Modifier and Type | Method and Description | -| ----------------- | ---------------------- | -| Nothing? | data()
validated payload | -| @Nullable Object | getData()
validated payload | - -## ApplicationjsonSchema1BoxedBoolean -public record ApplicationjsonSchema1BoxedBoolean
-implements [ApplicationjsonSchema1Boxed](#applicationjsonschema1boxed) - -record that stores validated boolean payloads, sealed permits implementation - -### Constructor Summary -| Constructor and Description | -| --------------------------- | -| ApplicationjsonSchema1BoxedBoolean(boolean data)
Creates an instance, private visibility | - -### Method Summary -| Modifier and Type | Method and Description | -| ----------------- | ---------------------- | -| boolean | data()
validated payload | -| @Nullable Object | getData()
validated payload | - -## ApplicationjsonSchema1BoxedNumber -public record ApplicationjsonSchema1BoxedNumber
-implements [ApplicationjsonSchema1Boxed](#applicationjsonschema1boxed) - -record that stores validated Number payloads, sealed permits implementation - -### Constructor Summary -| Constructor and Description | -| --------------------------- | -| ApplicationjsonSchema1BoxedNumber(Number data)
Creates an instance, private visibility | - -### Method Summary -| Modifier and Type | Method and Description | -| ----------------- | ---------------------- | -| Number | data()
validated payload | -| @Nullable Object | getData()
validated payload | - -## ApplicationjsonSchema1BoxedString -public record ApplicationjsonSchema1BoxedString
-implements [ApplicationjsonSchema1Boxed](#applicationjsonschema1boxed) - -record that stores validated String payloads, sealed permits implementation - -### Constructor Summary -| Constructor and Description | -| --------------------------- | -| ApplicationjsonSchema1BoxedString(String data)
Creates an instance, private visibility | - -### Method Summary -| Modifier and Type | Method and Description | -| ----------------- | ---------------------- | -| String | data()
validated payload | -| @Nullable Object | getData()
validated payload | - -## ApplicationjsonSchema1BoxedList -public record ApplicationjsonSchema1BoxedList
-implements [ApplicationjsonSchema1Boxed](#applicationjsonschema1boxed) - -record that stores validated List payloads, sealed permits implementation - -### Constructor Summary -| Constructor and Description | -| --------------------------- | -| ApplicationjsonSchema1BoxedList(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 | - -## ApplicationjsonSchema1BoxedMap -public record ApplicationjsonSchema1BoxedMap
-implements [ApplicationjsonSchema1Boxed](#applicationjsonschema1boxed) - -record that stores validated Map payloads, sealed permits implementation - -### Constructor Summary -| Constructor and Description | -| --------------------------- | -| ApplicationjsonSchema1BoxedMap(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 | - -## ApplicationjsonSchema1 -public static class ApplicationjsonSchema1
-extends AnyTypeJsonSchema.AnyTypeJsonSchema1 - -A schema class that validates payloads - -| Methods Inherited from class org.openapijsonschematools.client.schemas.AnyTypeJsonSchema.AnyTypeJsonSchema1 | -| ------------------------------------------------------------------ | -| validate | -| validateAndBox | diff --git a/samples/client/petstore/kotlin/docs/paths/fakewildcardresponses/get/responses/code2xxresponse/content/applicationjson/ApplicationjsonSchema.md b/samples/client/petstore/kotlin/docs/paths/fakewildcardresponses/get/responses/code2xxresponse/content/applicationjson/ApplicationjsonSchema.md deleted file mode 100644 index b05260b1abf..00000000000 --- a/samples/client/petstore/kotlin/docs/paths/fakewildcardresponses/get/responses/code2xxresponse/content/applicationjson/ApplicationjsonSchema.md +++ /dev/null @@ -1,144 +0,0 @@ -# ApplicationjsonSchema -public class ApplicationjsonSchema
- -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 - -## Nested Class Summary -| Modifier and Type | Class and Description | -| ----------------- | ---------------------- | -| sealed interface | [ApplicationjsonSchema.ApplicationjsonSchema1Boxed](#applicationjsonschema1boxed)
sealed interface for validated payloads | -| record | [ApplicationjsonSchema.ApplicationjsonSchema1BoxedVoid](#applicationjsonschema1boxedvoid)
boxed class to store validated null payloads | -| record | [ApplicationjsonSchema.ApplicationjsonSchema1BoxedBoolean](#applicationjsonschema1boxedboolean)
boxed class to store validated boolean payloads | -| record | [ApplicationjsonSchema.ApplicationjsonSchema1BoxedNumber](#applicationjsonschema1boxednumber)
boxed class to store validated Number payloads | -| record | [ApplicationjsonSchema.ApplicationjsonSchema1BoxedString](#applicationjsonschema1boxedstring)
boxed class to store validated String payloads | -| record | [ApplicationjsonSchema.ApplicationjsonSchema1BoxedList](#applicationjsonschema1boxedlist)
boxed class to store validated List payloads | -| record | [ApplicationjsonSchema.ApplicationjsonSchema1BoxedMap](#applicationjsonschema1boxedmap)
boxed class to store validated Map payloads | -| static class | [ApplicationjsonSchema.ApplicationjsonSchema1](#applicationjsonschema1)
schema class | - -## ApplicationjsonSchema1Boxed -public sealed interface ApplicationjsonSchema1Boxed
-permits
-[ApplicationjsonSchema1BoxedVoid](#applicationjsonschema1boxedvoid), -[ApplicationjsonSchema1BoxedBoolean](#applicationjsonschema1boxedboolean), -[ApplicationjsonSchema1BoxedNumber](#applicationjsonschema1boxednumber), -[ApplicationjsonSchema1BoxedString](#applicationjsonschema1boxedstring), -[ApplicationjsonSchema1BoxedList](#applicationjsonschema1boxedlist), -[ApplicationjsonSchema1BoxedMap](#applicationjsonschema1boxedmap) - -sealed interface that stores validated payloads using boxed classes - -## ApplicationjsonSchema1BoxedVoid -public record ApplicationjsonSchema1BoxedVoid
-implements [ApplicationjsonSchema1Boxed](#applicationjsonschema1boxed) - -record that stores validated null payloads, sealed permits implementation - -### Constructor Summary -| Constructor and Description | -| --------------------------- | -| ApplicationjsonSchema1BoxedVoid(Nothing? data)
Creates an instance, private visibility | - -### Method Summary -| Modifier and Type | Method and Description | -| ----------------- | ---------------------- | -| Nothing? | data()
validated payload | -| @Nullable Object | getData()
validated payload | - -## ApplicationjsonSchema1BoxedBoolean -public record ApplicationjsonSchema1BoxedBoolean
-implements [ApplicationjsonSchema1Boxed](#applicationjsonschema1boxed) - -record that stores validated boolean payloads, sealed permits implementation - -### Constructor Summary -| Constructor and Description | -| --------------------------- | -| ApplicationjsonSchema1BoxedBoolean(boolean data)
Creates an instance, private visibility | - -### Method Summary -| Modifier and Type | Method and Description | -| ----------------- | ---------------------- | -| boolean | data()
validated payload | -| @Nullable Object | getData()
validated payload | - -## ApplicationjsonSchema1BoxedNumber -public record ApplicationjsonSchema1BoxedNumber
-implements [ApplicationjsonSchema1Boxed](#applicationjsonschema1boxed) - -record that stores validated Number payloads, sealed permits implementation - -### Constructor Summary -| Constructor and Description | -| --------------------------- | -| ApplicationjsonSchema1BoxedNumber(Number data)
Creates an instance, private visibility | - -### Method Summary -| Modifier and Type | Method and Description | -| ----------------- | ---------------------- | -| Number | data()
validated payload | -| @Nullable Object | getData()
validated payload | - -## ApplicationjsonSchema1BoxedString -public record ApplicationjsonSchema1BoxedString
-implements [ApplicationjsonSchema1Boxed](#applicationjsonschema1boxed) - -record that stores validated String payloads, sealed permits implementation - -### Constructor Summary -| Constructor and Description | -| --------------------------- | -| ApplicationjsonSchema1BoxedString(String data)
Creates an instance, private visibility | - -### Method Summary -| Modifier and Type | Method and Description | -| ----------------- | ---------------------- | -| String | data()
validated payload | -| @Nullable Object | getData()
validated payload | - -## ApplicationjsonSchema1BoxedList -public record ApplicationjsonSchema1BoxedList
-implements [ApplicationjsonSchema1Boxed](#applicationjsonschema1boxed) - -record that stores validated List payloads, sealed permits implementation - -### Constructor Summary -| Constructor and Description | -| --------------------------- | -| ApplicationjsonSchema1BoxedList(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 | - -## ApplicationjsonSchema1BoxedMap -public record ApplicationjsonSchema1BoxedMap
-implements [ApplicationjsonSchema1Boxed](#applicationjsonschema1boxed) - -record that stores validated Map payloads, sealed permits implementation - -### Constructor Summary -| Constructor and Description | -| --------------------------- | -| ApplicationjsonSchema1BoxedMap(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 | - -## ApplicationjsonSchema1 -public static class ApplicationjsonSchema1
-extends AnyTypeJsonSchema.AnyTypeJsonSchema1 - -A schema class that validates payloads - -| Methods Inherited from class org.openapijsonschematools.client.schemas.AnyTypeJsonSchema.AnyTypeJsonSchema1 | -| ------------------------------------------------------------------ | -| validate | -| validateAndBox | diff --git a/samples/client/petstore/kotlin/docs/paths/fakewildcardresponses/get/responses/code3xxresponse/content/applicationjson/ApplicationjsonSchema.md b/samples/client/petstore/kotlin/docs/paths/fakewildcardresponses/get/responses/code3xxresponse/content/applicationjson/ApplicationjsonSchema.md deleted file mode 100644 index b05260b1abf..00000000000 --- a/samples/client/petstore/kotlin/docs/paths/fakewildcardresponses/get/responses/code3xxresponse/content/applicationjson/ApplicationjsonSchema.md +++ /dev/null @@ -1,144 +0,0 @@ -# ApplicationjsonSchema -public class ApplicationjsonSchema
- -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 - -## Nested Class Summary -| Modifier and Type | Class and Description | -| ----------------- | ---------------------- | -| sealed interface | [ApplicationjsonSchema.ApplicationjsonSchema1Boxed](#applicationjsonschema1boxed)
sealed interface for validated payloads | -| record | [ApplicationjsonSchema.ApplicationjsonSchema1BoxedVoid](#applicationjsonschema1boxedvoid)
boxed class to store validated null payloads | -| record | [ApplicationjsonSchema.ApplicationjsonSchema1BoxedBoolean](#applicationjsonschema1boxedboolean)
boxed class to store validated boolean payloads | -| record | [ApplicationjsonSchema.ApplicationjsonSchema1BoxedNumber](#applicationjsonschema1boxednumber)
boxed class to store validated Number payloads | -| record | [ApplicationjsonSchema.ApplicationjsonSchema1BoxedString](#applicationjsonschema1boxedstring)
boxed class to store validated String payloads | -| record | [ApplicationjsonSchema.ApplicationjsonSchema1BoxedList](#applicationjsonschema1boxedlist)
boxed class to store validated List payloads | -| record | [ApplicationjsonSchema.ApplicationjsonSchema1BoxedMap](#applicationjsonschema1boxedmap)
boxed class to store validated Map payloads | -| static class | [ApplicationjsonSchema.ApplicationjsonSchema1](#applicationjsonschema1)
schema class | - -## ApplicationjsonSchema1Boxed -public sealed interface ApplicationjsonSchema1Boxed
-permits
-[ApplicationjsonSchema1BoxedVoid](#applicationjsonschema1boxedvoid), -[ApplicationjsonSchema1BoxedBoolean](#applicationjsonschema1boxedboolean), -[ApplicationjsonSchema1BoxedNumber](#applicationjsonschema1boxednumber), -[ApplicationjsonSchema1BoxedString](#applicationjsonschema1boxedstring), -[ApplicationjsonSchema1BoxedList](#applicationjsonschema1boxedlist), -[ApplicationjsonSchema1BoxedMap](#applicationjsonschema1boxedmap) - -sealed interface that stores validated payloads using boxed classes - -## ApplicationjsonSchema1BoxedVoid -public record ApplicationjsonSchema1BoxedVoid
-implements [ApplicationjsonSchema1Boxed](#applicationjsonschema1boxed) - -record that stores validated null payloads, sealed permits implementation - -### Constructor Summary -| Constructor and Description | -| --------------------------- | -| ApplicationjsonSchema1BoxedVoid(Nothing? data)
Creates an instance, private visibility | - -### Method Summary -| Modifier and Type | Method and Description | -| ----------------- | ---------------------- | -| Nothing? | data()
validated payload | -| @Nullable Object | getData()
validated payload | - -## ApplicationjsonSchema1BoxedBoolean -public record ApplicationjsonSchema1BoxedBoolean
-implements [ApplicationjsonSchema1Boxed](#applicationjsonschema1boxed) - -record that stores validated boolean payloads, sealed permits implementation - -### Constructor Summary -| Constructor and Description | -| --------------------------- | -| ApplicationjsonSchema1BoxedBoolean(boolean data)
Creates an instance, private visibility | - -### Method Summary -| Modifier and Type | Method and Description | -| ----------------- | ---------------------- | -| boolean | data()
validated payload | -| @Nullable Object | getData()
validated payload | - -## ApplicationjsonSchema1BoxedNumber -public record ApplicationjsonSchema1BoxedNumber
-implements [ApplicationjsonSchema1Boxed](#applicationjsonschema1boxed) - -record that stores validated Number payloads, sealed permits implementation - -### Constructor Summary -| Constructor and Description | -| --------------------------- | -| ApplicationjsonSchema1BoxedNumber(Number data)
Creates an instance, private visibility | - -### Method Summary -| Modifier and Type | Method and Description | -| ----------------- | ---------------------- | -| Number | data()
validated payload | -| @Nullable Object | getData()
validated payload | - -## ApplicationjsonSchema1BoxedString -public record ApplicationjsonSchema1BoxedString
-implements [ApplicationjsonSchema1Boxed](#applicationjsonschema1boxed) - -record that stores validated String payloads, sealed permits implementation - -### Constructor Summary -| Constructor and Description | -| --------------------------- | -| ApplicationjsonSchema1BoxedString(String data)
Creates an instance, private visibility | - -### Method Summary -| Modifier and Type | Method and Description | -| ----------------- | ---------------------- | -| String | data()
validated payload | -| @Nullable Object | getData()
validated payload | - -## ApplicationjsonSchema1BoxedList -public record ApplicationjsonSchema1BoxedList
-implements [ApplicationjsonSchema1Boxed](#applicationjsonschema1boxed) - -record that stores validated List payloads, sealed permits implementation - -### Constructor Summary -| Constructor and Description | -| --------------------------- | -| ApplicationjsonSchema1BoxedList(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 | - -## ApplicationjsonSchema1BoxedMap -public record ApplicationjsonSchema1BoxedMap
-implements [ApplicationjsonSchema1Boxed](#applicationjsonschema1boxed) - -record that stores validated Map payloads, sealed permits implementation - -### Constructor Summary -| Constructor and Description | -| --------------------------- | -| ApplicationjsonSchema1BoxedMap(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 | - -## ApplicationjsonSchema1 -public static class ApplicationjsonSchema1
-extends AnyTypeJsonSchema.AnyTypeJsonSchema1 - -A schema class that validates payloads - -| Methods Inherited from class org.openapijsonschematools.client.schemas.AnyTypeJsonSchema.AnyTypeJsonSchema1 | -| ------------------------------------------------------------------ | -| validate | -| validateAndBox | diff --git a/samples/client/petstore/kotlin/docs/paths/fakewildcardresponses/get/responses/code4xxresponse/content/applicationjson/ApplicationjsonSchema.md b/samples/client/petstore/kotlin/docs/paths/fakewildcardresponses/get/responses/code4xxresponse/content/applicationjson/ApplicationjsonSchema.md deleted file mode 100644 index b05260b1abf..00000000000 --- a/samples/client/petstore/kotlin/docs/paths/fakewildcardresponses/get/responses/code4xxresponse/content/applicationjson/ApplicationjsonSchema.md +++ /dev/null @@ -1,144 +0,0 @@ -# ApplicationjsonSchema -public class ApplicationjsonSchema
- -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 - -## Nested Class Summary -| Modifier and Type | Class and Description | -| ----------------- | ---------------------- | -| sealed interface | [ApplicationjsonSchema.ApplicationjsonSchema1Boxed](#applicationjsonschema1boxed)
sealed interface for validated payloads | -| record | [ApplicationjsonSchema.ApplicationjsonSchema1BoxedVoid](#applicationjsonschema1boxedvoid)
boxed class to store validated null payloads | -| record | [ApplicationjsonSchema.ApplicationjsonSchema1BoxedBoolean](#applicationjsonschema1boxedboolean)
boxed class to store validated boolean payloads | -| record | [ApplicationjsonSchema.ApplicationjsonSchema1BoxedNumber](#applicationjsonschema1boxednumber)
boxed class to store validated Number payloads | -| record | [ApplicationjsonSchema.ApplicationjsonSchema1BoxedString](#applicationjsonschema1boxedstring)
boxed class to store validated String payloads | -| record | [ApplicationjsonSchema.ApplicationjsonSchema1BoxedList](#applicationjsonschema1boxedlist)
boxed class to store validated List payloads | -| record | [ApplicationjsonSchema.ApplicationjsonSchema1BoxedMap](#applicationjsonschema1boxedmap)
boxed class to store validated Map payloads | -| static class | [ApplicationjsonSchema.ApplicationjsonSchema1](#applicationjsonschema1)
schema class | - -## ApplicationjsonSchema1Boxed -public sealed interface ApplicationjsonSchema1Boxed
-permits
-[ApplicationjsonSchema1BoxedVoid](#applicationjsonschema1boxedvoid), -[ApplicationjsonSchema1BoxedBoolean](#applicationjsonschema1boxedboolean), -[ApplicationjsonSchema1BoxedNumber](#applicationjsonschema1boxednumber), -[ApplicationjsonSchema1BoxedString](#applicationjsonschema1boxedstring), -[ApplicationjsonSchema1BoxedList](#applicationjsonschema1boxedlist), -[ApplicationjsonSchema1BoxedMap](#applicationjsonschema1boxedmap) - -sealed interface that stores validated payloads using boxed classes - -## ApplicationjsonSchema1BoxedVoid -public record ApplicationjsonSchema1BoxedVoid
-implements [ApplicationjsonSchema1Boxed](#applicationjsonschema1boxed) - -record that stores validated null payloads, sealed permits implementation - -### Constructor Summary -| Constructor and Description | -| --------------------------- | -| ApplicationjsonSchema1BoxedVoid(Nothing? data)
Creates an instance, private visibility | - -### Method Summary -| Modifier and Type | Method and Description | -| ----------------- | ---------------------- | -| Nothing? | data()
validated payload | -| @Nullable Object | getData()
validated payload | - -## ApplicationjsonSchema1BoxedBoolean -public record ApplicationjsonSchema1BoxedBoolean
-implements [ApplicationjsonSchema1Boxed](#applicationjsonschema1boxed) - -record that stores validated boolean payloads, sealed permits implementation - -### Constructor Summary -| Constructor and Description | -| --------------------------- | -| ApplicationjsonSchema1BoxedBoolean(boolean data)
Creates an instance, private visibility | - -### Method Summary -| Modifier and Type | Method and Description | -| ----------------- | ---------------------- | -| boolean | data()
validated payload | -| @Nullable Object | getData()
validated payload | - -## ApplicationjsonSchema1BoxedNumber -public record ApplicationjsonSchema1BoxedNumber
-implements [ApplicationjsonSchema1Boxed](#applicationjsonschema1boxed) - -record that stores validated Number payloads, sealed permits implementation - -### Constructor Summary -| Constructor and Description | -| --------------------------- | -| ApplicationjsonSchema1BoxedNumber(Number data)
Creates an instance, private visibility | - -### Method Summary -| Modifier and Type | Method and Description | -| ----------------- | ---------------------- | -| Number | data()
validated payload | -| @Nullable Object | getData()
validated payload | - -## ApplicationjsonSchema1BoxedString -public record ApplicationjsonSchema1BoxedString
-implements [ApplicationjsonSchema1Boxed](#applicationjsonschema1boxed) - -record that stores validated String payloads, sealed permits implementation - -### Constructor Summary -| Constructor and Description | -| --------------------------- | -| ApplicationjsonSchema1BoxedString(String data)
Creates an instance, private visibility | - -### Method Summary -| Modifier and Type | Method and Description | -| ----------------- | ---------------------- | -| String | data()
validated payload | -| @Nullable Object | getData()
validated payload | - -## ApplicationjsonSchema1BoxedList -public record ApplicationjsonSchema1BoxedList
-implements [ApplicationjsonSchema1Boxed](#applicationjsonschema1boxed) - -record that stores validated List payloads, sealed permits implementation - -### Constructor Summary -| Constructor and Description | -| --------------------------- | -| ApplicationjsonSchema1BoxedList(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 | - -## ApplicationjsonSchema1BoxedMap -public record ApplicationjsonSchema1BoxedMap
-implements [ApplicationjsonSchema1Boxed](#applicationjsonschema1boxed) - -record that stores validated Map payloads, sealed permits implementation - -### Constructor Summary -| Constructor and Description | -| --------------------------- | -| ApplicationjsonSchema1BoxedMap(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 | - -## ApplicationjsonSchema1 -public static class ApplicationjsonSchema1
-extends AnyTypeJsonSchema.AnyTypeJsonSchema1 - -A schema class that validates payloads - -| Methods Inherited from class org.openapijsonschematools.client.schemas.AnyTypeJsonSchema.AnyTypeJsonSchema1 | -| ------------------------------------------------------------------ | -| validate | -| validateAndBox | diff --git a/samples/client/petstore/kotlin/docs/paths/fakewildcardresponses/get/responses/code5xxresponse/content/applicationjson/ApplicationjsonSchema.md b/samples/client/petstore/kotlin/docs/paths/fakewildcardresponses/get/responses/code5xxresponse/content/applicationjson/ApplicationjsonSchema.md deleted file mode 100644 index b05260b1abf..00000000000 --- a/samples/client/petstore/kotlin/docs/paths/fakewildcardresponses/get/responses/code5xxresponse/content/applicationjson/ApplicationjsonSchema.md +++ /dev/null @@ -1,144 +0,0 @@ -# ApplicationjsonSchema -public class ApplicationjsonSchema
- -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 - -## Nested Class Summary -| Modifier and Type | Class and Description | -| ----------------- | ---------------------- | -| sealed interface | [ApplicationjsonSchema.ApplicationjsonSchema1Boxed](#applicationjsonschema1boxed)
sealed interface for validated payloads | -| record | [ApplicationjsonSchema.ApplicationjsonSchema1BoxedVoid](#applicationjsonschema1boxedvoid)
boxed class to store validated null payloads | -| record | [ApplicationjsonSchema.ApplicationjsonSchema1BoxedBoolean](#applicationjsonschema1boxedboolean)
boxed class to store validated boolean payloads | -| record | [ApplicationjsonSchema.ApplicationjsonSchema1BoxedNumber](#applicationjsonschema1boxednumber)
boxed class to store validated Number payloads | -| record | [ApplicationjsonSchema.ApplicationjsonSchema1BoxedString](#applicationjsonschema1boxedstring)
boxed class to store validated String payloads | -| record | [ApplicationjsonSchema.ApplicationjsonSchema1BoxedList](#applicationjsonschema1boxedlist)
boxed class to store validated List payloads | -| record | [ApplicationjsonSchema.ApplicationjsonSchema1BoxedMap](#applicationjsonschema1boxedmap)
boxed class to store validated Map payloads | -| static class | [ApplicationjsonSchema.ApplicationjsonSchema1](#applicationjsonschema1)
schema class | - -## ApplicationjsonSchema1Boxed -public sealed interface ApplicationjsonSchema1Boxed
-permits
-[ApplicationjsonSchema1BoxedVoid](#applicationjsonschema1boxedvoid), -[ApplicationjsonSchema1BoxedBoolean](#applicationjsonschema1boxedboolean), -[ApplicationjsonSchema1BoxedNumber](#applicationjsonschema1boxednumber), -[ApplicationjsonSchema1BoxedString](#applicationjsonschema1boxedstring), -[ApplicationjsonSchema1BoxedList](#applicationjsonschema1boxedlist), -[ApplicationjsonSchema1BoxedMap](#applicationjsonschema1boxedmap) - -sealed interface that stores validated payloads using boxed classes - -## ApplicationjsonSchema1BoxedVoid -public record ApplicationjsonSchema1BoxedVoid
-implements [ApplicationjsonSchema1Boxed](#applicationjsonschema1boxed) - -record that stores validated null payloads, sealed permits implementation - -### Constructor Summary -| Constructor and Description | -| --------------------------- | -| ApplicationjsonSchema1BoxedVoid(Nothing? data)
Creates an instance, private visibility | - -### Method Summary -| Modifier and Type | Method and Description | -| ----------------- | ---------------------- | -| Nothing? | data()
validated payload | -| @Nullable Object | getData()
validated payload | - -## ApplicationjsonSchema1BoxedBoolean -public record ApplicationjsonSchema1BoxedBoolean
-implements [ApplicationjsonSchema1Boxed](#applicationjsonschema1boxed) - -record that stores validated boolean payloads, sealed permits implementation - -### Constructor Summary -| Constructor and Description | -| --------------------------- | -| ApplicationjsonSchema1BoxedBoolean(boolean data)
Creates an instance, private visibility | - -### Method Summary -| Modifier and Type | Method and Description | -| ----------------- | ---------------------- | -| boolean | data()
validated payload | -| @Nullable Object | getData()
validated payload | - -## ApplicationjsonSchema1BoxedNumber -public record ApplicationjsonSchema1BoxedNumber
-implements [ApplicationjsonSchema1Boxed](#applicationjsonschema1boxed) - -record that stores validated Number payloads, sealed permits implementation - -### Constructor Summary -| Constructor and Description | -| --------------------------- | -| ApplicationjsonSchema1BoxedNumber(Number data)
Creates an instance, private visibility | - -### Method Summary -| Modifier and Type | Method and Description | -| ----------------- | ---------------------- | -| Number | data()
validated payload | -| @Nullable Object | getData()
validated payload | - -## ApplicationjsonSchema1BoxedString -public record ApplicationjsonSchema1BoxedString
-implements [ApplicationjsonSchema1Boxed](#applicationjsonschema1boxed) - -record that stores validated String payloads, sealed permits implementation - -### Constructor Summary -| Constructor and Description | -| --------------------------- | -| ApplicationjsonSchema1BoxedString(String data)
Creates an instance, private visibility | - -### Method Summary -| Modifier and Type | Method and Description | -| ----------------- | ---------------------- | -| String | data()
validated payload | -| @Nullable Object | getData()
validated payload | - -## ApplicationjsonSchema1BoxedList -public record ApplicationjsonSchema1BoxedList
-implements [ApplicationjsonSchema1Boxed](#applicationjsonschema1boxed) - -record that stores validated List payloads, sealed permits implementation - -### Constructor Summary -| Constructor and Description | -| --------------------------- | -| ApplicationjsonSchema1BoxedList(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 | - -## ApplicationjsonSchema1BoxedMap -public record ApplicationjsonSchema1BoxedMap
-implements [ApplicationjsonSchema1Boxed](#applicationjsonschema1boxed) - -record that stores validated Map payloads, sealed permits implementation - -### Constructor Summary -| Constructor and Description | -| --------------------------- | -| ApplicationjsonSchema1BoxedMap(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 | - -## ApplicationjsonSchema1 -public static class ApplicationjsonSchema1
-extends AnyTypeJsonSchema.AnyTypeJsonSchema1 - -A schema class that validates payloads - -| Methods Inherited from class org.openapijsonschematools.client.schemas.AnyTypeJsonSchema.AnyTypeJsonSchema1 | -| ------------------------------------------------------------------ | -| validate | -| validateAndBox | diff --git a/samples/client/petstore/kotlin/docs/paths/foo/FooGet.md b/samples/client/petstore/kotlin/docs/paths/foo/FooGet.md deleted file mode 100644 index da4a2fc69ce..00000000000 --- a/samples/client/petstore/kotlin/docs/paths/foo/FooGet.md +++ /dev/null @@ -1,143 +0,0 @@ -# FooGet - -public class FooGet - -A class that contains necessary endpoint classes -- a class that calls the endpoint method using the http verb -- a class that calls the endpoint method using the operationId name -- class(es) to store the request inputs -- builder(s) to set the request input data - -## Nested Class Summary -| Modifier and Type | Class and Description | -| ----------------- | --------------------- | -| static class | [Get](#get)
The class that has a get method to call the endpoint | -| interface | [FooGetOperation](#foogetoperation)
The interface that has a fooGet method to call the endpoint | -| static class | [GetRequest](#getrequest)
The request inputs class | -| static class | [GetRequestBuilder](#getrequestbuilder)
A builder for the request input class | - -## Get -public static class Get extends ApiClient.ApiClient1 implements GetOperation
- -a class that allows one to call the endpoint using a method named get - -### 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.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.FooGetCodedefaultResponse; -import org.openapijsonschematools.client.paths.foo.get.FooGetServerInfo; -import org.openapijsonschematools.client.paths.foo.FooGet; -import org.openapijsonschematools.client.paths.foo.get.FooGetResponses; - -import java.io.IOException; -import java.util.Arrays; -import java.util.List; -import java.util.Map; -import java.util.AbstractMap; - -// if you want to use a server that is not SERVER_0 pass it in here and change the ServerIndex input below -ApiConfiguration.ServerInfo serverInfo = new ApiConfiguration.ServerInfoBuilder() - .fooGetServerInfo( - new FooGetServerInfo.FooGetServerInfoBuilder() - .fooGetServer0(new FooGetServer0()) - .build() - ) - .build(); -ApiConfiguration.ServerIndexInfo serverIndexInfo = new ApiConfiguration.ServerIndexInfoBuilder() - .fooGetServerInfoServerIndex(FooGetServerInfo.ServerIndex.SERVER_0) - .build(); -Duration timeout = Duration.ofSeconds(1L); -Map> defaultHeaders = Map.of("User-Agent", List.of("OpenAPI-JSON-Schema-Generator/1.0.0/java")); -ApiConfiguration apiConfiguration = new ApiConfiguration( - serverInfo - serverIndexInfo, - timeout, - defaultHeaders -); -SchemaConfiguration schemaConfiguration = new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().build()); -FooGet.Get apiClient = new FooGet.Get(apiConfiguration, schemaConfiguration); - - -var request = new FooGet.GetRequestBuilder().build(); - -FooGetResponses.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; -} -FooGetResponses.EndpointFooGetCodedefaultResponse castResponse = (FooGetResponses.EndpointFooGetCodedefaultResponse) response; -FooGetCodedefaultResponse.ApplicationjsonResponseBody deserializedBody = (FooGetCodedefaultResponse.ApplicationjsonResponseBody) castResponse.body; -// handle deserialized body here -``` -### Constructor Summary -| Constructor and Description | -| --------------------------- | -| Get(ApiConfiguration apiConfiguration, SchemaConfiguration schemaConfiguration)
Creates an instance | - -### Method Summary -| Modifier and Type | Method and Description | -| ----------------- | ---------------------- | -| [FooGetResponses.EndpointResponse](../../paths/foo/get/FooGetResponses.md#endpointresponse) | get([GetRequest](#getrequest) request) | - -## FooGetOperation -public interface FooGetOperation
- -an interface that allows one to call the endpoint using a method named fooGet by the operationId - -### Method Summary -| Modifier and Type | Method and Description | -| ----------------- | ---------------------- | -| [FooGetResponses.EndpointResponse](../../paths/foo/get/FooGetResponses.md#endpointresponse) | fooGet([GetRequest](#getrequest) request) | - -## GetRequest -public static class GetRequest
- -a class that stores the final request inputs - -### Field Summary -| Modifier and Type | Field and Description | -| ----------------- | --------------------- | -| [FooGetServerInfo.@Nullable ServerIndex](../../paths/foo/get/FooGetServerInfo.md#serverindex) | serverIndex
optional. Note: this will override the value in apiConfiguration | -| @Nullable Duration | timeout
optional. Note: this will override the value in apiConfiguration | - -## GetRequestBuilder -public static class GetRequestBuilder
- -a builder for request inputs - -### Constructor Summary -| Constructor and Description | -| --------------------------- | -| GetRequestBuilder()
Creates a builder that contains null for all parameters | - -### Method Summary -| Modifier and Type | Method and Description | -| ----------------- | ---------------------- | -| [GetRequest](#getrequest) | build()
Returns the request input used to call an endpoint method | -| [GetRequestBuilder](#getrequestbuilder) | serverIndex([FooGetServerInfo.ServerIndex](../../paths/foo/get/FooGetServerInfo.md#serverindex) serverIndex)
sets the optional property. Note: this will override the value in apiConfiguration | -| [GetRequestBuilder](#getrequestbuilder) | timeout(Duration timeout)
sets the optional property. Note: this will override the value in apiConfiguration | - -[[Back to top]](#top) [[Back to README]](../../../README.md) diff --git a/samples/client/petstore/kotlin/docs/paths/foo/get/FooGetResponses.md b/samples/client/petstore/kotlin/docs/paths/foo/get/FooGetResponses.md deleted file mode 100644 index ab23aea0db5..00000000000 --- a/samples/client/petstore/kotlin/docs/paths/foo/get/FooGetResponses.md +++ /dev/null @@ -1,29 +0,0 @@ -# FooGetResponses - -public class FooGetResponses - -A class that contains necessary responses classes -- a sealed interface, EndpointResponse, that stores endpoint responses -- records for each endpoint response - -## Nested Class Summary -| Modifier and Type | Class and Description | -| ----------------- | --------------------- | -| sealed interface | [EndpointResponse](#endpointresponse)
stores the endpoint responses | -| record | [EndpointFooGetCodedefaultResponse](#endpointfoogetcodedefaultresponse)
the response for default | - -## EndpointResponse -public sealed interface EndpointResponse permits
-[EndpointFooGetCodedefaultResponse](#endpointfoogetcodedefaultresponse) - -a sealed interface that stores endpoint responses - -## EndpointFooGetCodedefaultResponse -public record EndpointFooGetCodedefaultResponse( - HttpResponse response, - [FooGetCodedefaultResponse.SealedResponseBody](../../../paths/foo/get/responses/FooGetCodedefaultResponse.md#sealedresponsebody) body, - Nothing? headers -) implements EndpointResponse, ApiResponse
- -a class that stores an endpoint response - diff --git a/samples/client/petstore/kotlin/docs/paths/foo/get/FooGetServerInfo.md b/samples/client/petstore/kotlin/docs/paths/foo/get/FooGetServerInfo.md deleted file mode 100644 index 67aede6fd0e..00000000000 --- a/samples/client/petstore/kotlin/docs/paths/foo/get/FooGetServerInfo.md +++ /dev/null @@ -1,62 +0,0 @@ -# FooGetServerInfo -FooGetServerInfo.java - -public class FooGetServerInfo - -A class that provides a server, and any needed server info classes -- a class that is a ServerProvider -- a builder for the ServerProvider -- an enum class that stores server index values - -## Nested Class Summary -| Modifier and Type | Class and Description | -| ----------------- | --------------------- | -| static class | [FooGetServerInfo.FooGetServerInfo1](#foogetserverinfo1)
class that stores a server index | -| static class | [FooGetServerInfo.FooGetServerInfoBuilder](#foogetserverinfobuilder)
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(@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) | - -## FooGetServerInfoBuilder - -a builder for [FooGetServerInfo1](#foogetserverinfo1) - -### Constructor Summary -| Constructor and Description | -| --------------------------- | -| FooGetServerInfoBuilder()
Creates an instance | - -### Method Summary -| Modifier and Type | Method and Description | -| ----------------- | ---------------------- | -| [FooGetServerInfoBuilder](#foogetserverinfobuilder) | fooGetServer0([FooGetServer0](../../../paths/foo/get/servers/FooGetServer0.md) server0)
sets the server | -| [FooGetServerInfoBuilder](#foogetserverinfobuilder) | fooGetServer1([FooGetServer1](../../../paths/foo/get/servers/FooGetServer1.md) server1)
sets the server | -| [FooGetServerInfo1](#foogetserverinfo1) | build() | - -## ServerIndex -enum ServerIndex
- -### Enum Constant Summary -| Enum Constant And Description | -| ----------------------------- | -| SERVER_0
server 0 | -| SERVER_1
server 1 | diff --git a/samples/client/petstore/kotlin/docs/paths/foo/get/responses/FooGetCodedefaultResponse.md b/samples/client/petstore/kotlin/docs/paths/foo/get/responses/FooGetCodedefaultResponse.md deleted file mode 100644 index 0a25708c1c2..00000000000 --- a/samples/client/petstore/kotlin/docs/paths/foo/get/responses/FooGetCodedefaultResponse.md +++ /dev/null @@ -1,87 +0,0 @@ -# FooGetCodedefaultResponse - -public class FooGetCodedefaultResponse - -A class that contains necessary nested response classes -- SealedMediaType, a sealed interface which contains all the schema/encoding info for each contentType -- records which implement SealedMediaType, the concrete media types -- SealedResponseBody, a sealed interface which contains all the contentType/schema types -- records which implement SealedResponseBody, the concrete response body types -- a class that extends ResponseDeserializer and is used to deserialize responses - -## Nested Class Summary -| Modifier and Type | Class and Description | -| ----------------- | --------------------- | -| sealed interface | [FooGetCodedefaultResponse.SealedMediaType](#sealedmediatype)
media type sealed interface | -| record | [FooGetCodedefaultResponse.ApplicationjsonMediaType](#applicationjsonmediatype)
record storing schema + encoding for a specific contentType | -| sealed interface | [FooGetCodedefaultResponse.SealedResponseBody](#sealedresponsebody)
response body sealed interface | -| record | [FooGetCodedefaultResponse.ApplicationjsonResponseBody](#applicationjsonresponsebody)
implements sealed interface to store response body | -| static class | [FooGetCodedefaultResponse.FooGetCodedefaultResponse1](#foogetcodedefaultresponse1)
class that deserializes responses | - -## SealedMediaType -public sealed interface SealedMediaType
-permits
-[ApplicationjsonMediaType](#applicationjsonmediatype) - -sealed interface that stores schema and encoding info - -## ApplicationjsonMediaType -public record ApplicationjsonMediaType
-implements [SealedMediaType](#sealedmediatype), MediaType<[ApplicationjsonSchema.ApplicationjsonSchema1](../../../../paths/foo/get/responses/codedefaultresponse/content/applicationjson/ApplicationjsonSchema.md#applicationjsonschema1), Nothing?> - -class storing schema info for a specific contentType - -### Constructor Summary -| Constructor and Description | -| --------------------------- | -| ApplicationjsonMediaType()
Creates an instance | - -### Method Summary -| Modifier and Type | Method and Description | -| ----------------- | ---------------------- | -| [ApplicationjsonSchema.ApplicationjsonSchema1](../../../../paths/foo/get/responses/codedefaultresponse/content/applicationjson/ApplicationjsonSchema.md#applicationjsonschema1) | schema()
the schema for this MediaType | -| Nothing? | encoding()
the encoding info | - -## SealedResponseBody -public sealed interface SealedResponseBody
-permits
-[ApplicationjsonResponseBody](#applicationjsonresponsebody) - -sealed interface that stores response body - -## ApplicationjsonResponseBody -public record ApplicationjsonResponseBody
-implements [SealedResponseBody](#sealedresponsebody) - -A record class to store response body for contentType="application/json" - -### Constructor Summary -| Constructor and Description | -| --------------------------- | -| ApplicationjsonResponseBody(ApplicationjsonSchema.[ApplicationjsonSchema1Boxed](../../../../paths/foo/get/responses/codedefaultresponse/content/applicationjson/ApplicationjsonSchema.md#applicationjsonschema1boxed) body)
Creates an instance | - -### Method Summary -| Modifier and Type | Method and Description | -| ----------------- | ---------------------- | -| ApplicationjsonSchema.[ApplicationjsonSchema1Boxed](../../../../paths/foo/get/responses/codedefaultresponse/content/applicationjson/ApplicationjsonSchema.md#applicationjsonschema1boxed) | body()
returns the body passed in in the constructor | - -## FooGetCodedefaultResponse1 -public static class FooGetCodedefaultResponse1
-extends ResponseDeserializer<[SealedResponseBody](#sealedresponsebody), Nothing?, [SealedMediaType](#sealedmediatype)> - -a class that deserializes responses - -### Constructor Summary -| Constructor and Description | -| --------------------------- | -| FooGetCodedefaultResponse1()
Creates an instance | - -### Field Summary -| Modifier and Type | Field and Description | -| ----------------- | --------------------- | -| 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 | -| ----------------- | ---------------------- | -| ApiResponse<[SealedResponseBody](#sealedresponsebody), Nothing?> | deserialize(HttpResponse response, SchemaConfiguration configuration)
called by endpoint when deserialize responses | diff --git a/samples/client/petstore/kotlin/docs/paths/foo/get/responses/codedefaultresponse/content/applicationjson/ApplicationjsonSchema.md b/samples/client/petstore/kotlin/docs/paths/foo/get/responses/codedefaultresponse/content/applicationjson/ApplicationjsonSchema.md deleted file mode 100644 index 666f6014f03..00000000000 --- a/samples/client/petstore/kotlin/docs/paths/foo/get/responses/codedefaultresponse/content/applicationjson/ApplicationjsonSchema.md +++ /dev/null @@ -1,134 +0,0 @@ -# ApplicationjsonSchema -public class ApplicationjsonSchema
- -A class that contains necessary nested -- schema classes (which validate payloads), extends JsonSchema -- sealed interfaces which store validated payloads, java version of a sum type -- boxed classes which store validated payloads, sealed permits class implementations -- classes to store validated map payloads, extends FrozenMap -- classes to build inputs for map payloads - -## Nested Class Summary -| Modifier and Type | Class and Description | -| ----------------- | ---------------------- | -| sealed interface | [ApplicationjsonSchema.ApplicationjsonSchema1Boxed](#applicationjsonschema1boxed)
sealed interface for validated payloads | -| record | [ApplicationjsonSchema.ApplicationjsonSchema1BoxedMap](#applicationjsonschema1boxedmap)
boxed class to store validated Map payloads | -| static class | [ApplicationjsonSchema.ApplicationjsonSchema1](#applicationjsonschema1)
schema class | -| static class | [ApplicationjsonSchema.ApplicationjsonSchemaMapBuilder](#applicationjsonschemamapbuilder)
builder for Map payloads | -| static class | [ApplicationjsonSchema.ApplicationjsonSchemaMap](#applicationjsonschemamap)
output class for Map payloads | - -## ApplicationjsonSchema1Boxed -public sealed interface ApplicationjsonSchema1Boxed
-permits
-[ApplicationjsonSchema1BoxedMap](#applicationjsonschema1boxedmap) - -sealed interface that stores validated payloads using boxed classes - -## ApplicationjsonSchema1BoxedMap -public record ApplicationjsonSchema1BoxedMap
-implements [ApplicationjsonSchema1Boxed](#applicationjsonschema1boxed) - -record that stores validated Map payloads, sealed permits implementation - -### Constructor Summary -| Constructor and Description | -| --------------------------- | -| ApplicationjsonSchema1BoxedMap([ApplicationjsonSchemaMap](#applicationjsonschemamap) data)
Creates an instance, private visibility | - -### Method Summary -| Modifier and Type | Method and Description | -| ----------------- | ---------------------- | -| [ApplicationjsonSchemaMap](#applicationjsonschemamap) | data()
validated payload | -| @Nullable Object | getData()
validated payload | - -## ApplicationjsonSchema1 -public static class ApplicationjsonSchema1
-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.responses.codedefaultresponse.content.applicationjson.ApplicationjsonSchema; - -import java.util.Arrays; -import java.util.List; -import java.util.AbstractMap; - -static final SchemaConfiguration configuration = new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().build()); - -// Map validation -ApplicationjsonSchema.ApplicationjsonSchemaMap validatedPayload = - ApplicationjsonSchema.ApplicationjsonSchema1.validate( - new ApplicationjsonSchema.ApplicationjsonSchemaMapBuilder() - .setString( - MapUtils.makeMap( - new AbstractMap.SimpleEntry( - "bar", - "a" - ) - ) - ) - .build(), - configuration -); -``` - -### Field Summary -| Modifier and Type | Field and Description | -| ----------------- | ---------------------- | -| Set> | type = Set.of(Map.class) | -| Map> | properties = Map.ofEntries(
    new PropertyEntry("string", [Foo.Foo1.class](../../../../../../../components/schemas/Foo.md#foo1))
)
| - -### Method Summary -| Modifier and Type | Method and Description | -| ----------------- | ---------------------- | -| [ApplicationjsonSchemaMap](#applicationjsonschemamap) | validate([Map<?, ?>](#applicationjsonschemamapbuilder) arg, SchemaConfiguration configuration) | -| [ApplicationjsonSchema1BoxedMap](#applicationjsonschema1boxedmap) | validateAndBox([Map<?, ?>](#applicationjsonschemamapbuilder) arg, SchemaConfiguration configuration) | -| [ApplicationjsonSchema1Boxed](#applicationjsonschema1boxed) | validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) | -| @Nullable Object | validate(@Nullable Object arg, SchemaConfiguration configuration) | - -## ApplicationjsonSchemaMapBuilder -public class ApplicationjsonSchemaMapBuilder
-builder for `Map` - -A class that builds the Map input type - -### Constructor Summary -| Constructor and Description | -| --------------------------- | -| ApplicationjsonSchemaMapBuilder()
Creates a builder that contains an empty map | - -### Method Summary -| Modifier and Type | Method and Description | -| ----------------- | ---------------------- | -| Map | build()
Returns map input that should be used with Schema.validate | -| [ApplicationjsonSchemaMapBuilder](#applicationjsonschemamapbuilder) | setString(Map value) | -| [ApplicationjsonSchemaMapBuilder](#applicationjsonschemamapbuilder) | additionalProperty(String key, Nothing? value) | -| [ApplicationjsonSchemaMapBuilder](#applicationjsonschemamapbuilder) | additionalProperty(String key, boolean value) | -| [ApplicationjsonSchemaMapBuilder](#applicationjsonschemamapbuilder) | additionalProperty(String key, String value) | -| [ApplicationjsonSchemaMapBuilder](#applicationjsonschemamapbuilder) | additionalProperty(String key, int value) | -| [ApplicationjsonSchemaMapBuilder](#applicationjsonschemamapbuilder) | additionalProperty(String key, float value) | -| [ApplicationjsonSchemaMapBuilder](#applicationjsonschemamapbuilder) | additionalProperty(String key, long value) | -| [ApplicationjsonSchemaMapBuilder](#applicationjsonschemamapbuilder) | additionalProperty(String key, double value) | -| [ApplicationjsonSchemaMapBuilder](#applicationjsonschemamapbuilder) | additionalProperty(String key, List value) | -| [ApplicationjsonSchemaMapBuilder](#applicationjsonschemamapbuilder) | additionalProperty(String key, Map value) | - -## ApplicationjsonSchemaMap -public static class ApplicationjsonSchemaMap
-extends FrozenMap - -A class to store validated Map payloads - -### Method Summary -| Modifier and Type | Method and Description | -| ----------------- | ---------------------- | -| static [ApplicationjsonSchemaMap](#applicationjsonschemamap) | of([Map](#applicationjsonschemamapbuilder) arg, SchemaConfiguration configuration) | -| @Nullable Object | get(String key)
This schema has invalid Java names so this method must be used when you access instance["string"], | -| @Nullable Object | getAdditionalProperty(String name)
provides type safety for additional properties | diff --git a/samples/client/petstore/kotlin/docs/paths/foo/get/servers/FooGetServer0.md b/samples/client/petstore/kotlin/docs/paths/foo/get/servers/FooGetServer0.md deleted file mode 100644 index 31c72b6c42f..00000000000 --- a/samples/client/petstore/kotlin/docs/paths/foo/get/servers/FooGetServer0.md +++ /dev/null @@ -1,14 +0,0 @@ -# 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/kotlin/docs/paths/foo/get/servers/FooGetServer1.md b/samples/client/petstore/kotlin/docs/paths/foo/get/servers/FooGetServer1.md deleted file mode 100644 index a993b2627e9..00000000000 --- a/samples/client/petstore/kotlin/docs/paths/foo/get/servers/FooGetServer1.md +++ /dev/null @@ -1,16 +0,0 @@ -# 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([FooGetServer1Variables.VariablesMap](../../../../paths/foo/get/servers/server1/FooGetServer1Variables.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}" | -| [FooGetServer1Variables.VariablesMap](../../../../paths/foo/get/servers/server1/FooGetServer1Variables.md#variablesmap) | variables | diff --git a/samples/client/petstore/kotlin/docs/paths/foo/get/servers/server1/FooGetServer1Variables.md b/samples/client/petstore/kotlin/docs/paths/foo/get/servers/server1/FooGetServer1Variables.md deleted file mode 100644 index 9eb0202effb..00000000000 --- a/samples/client/petstore/kotlin/docs/paths/foo/get/servers/server1/FooGetServer1Variables.md +++ /dev/null @@ -1,355 +0,0 @@ -# FooGetServer1Variables -public class FooGetServer1Variables
- -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 | [FooGetServer1Variables.FooGetServer1Variables1Boxed](#foogetserver1variables1boxed)
sealed interface for validated payloads | -| record | [FooGetServer1Variables.FooGetServer1Variables1BoxedMap](#foogetserver1variables1boxedmap)
boxed class to store validated Map payloads | -| static class | [FooGetServer1Variables.FooGetServer1Variables1](#foogetserver1variables1)
schema class | -| static class | [FooGetServer1Variables.VariablesMapBuilder](#variablesmapbuilder)
builder for Map payloads | -| static class | [FooGetServer1Variables.VariablesMap](#variablesmap)
output class for Map payloads | -| sealed interface | [FooGetServer1Variables.VersionBoxed](#versionboxed)
sealed interface for validated payloads | -| record | [FooGetServer1Variables.VersionBoxedString](#versionboxedstring)
boxed class to store validated String payloads | -| static class | [FooGetServer1Variables.Version](#version)
schema class | -| enum | [FooGetServer1Variables.StringVersionEnums](#stringversionenums)
String enum | -| sealed interface | [FooGetServer1Variables.AdditionalPropertiesBoxed](#additionalpropertiesboxed)
sealed interface for validated payloads | -| record | [FooGetServer1Variables.AdditionalPropertiesBoxedVoid](#additionalpropertiesboxedvoid)
boxed class to store validated null payloads | -| record | [FooGetServer1Variables.AdditionalPropertiesBoxedBoolean](#additionalpropertiesboxedboolean)
boxed class to store validated boolean payloads | -| record | [FooGetServer1Variables.AdditionalPropertiesBoxedNumber](#additionalpropertiesboxednumber)
boxed class to store validated Number payloads | -| record | [FooGetServer1Variables.AdditionalPropertiesBoxedString](#additionalpropertiesboxedstring)
boxed class to store validated String payloads | -| record | [FooGetServer1Variables.AdditionalPropertiesBoxedList](#additionalpropertiesboxedlist)
boxed class to store validated List payloads | -| record | [FooGetServer1Variables.AdditionalPropertiesBoxedMap](#additionalpropertiesboxedmap)
boxed class to store validated Map payloads | -| static class | [FooGetServer1Variables.AdditionalProperties](#additionalproperties)
schema class | - -## FooGetServer1Variables1Boxed -public sealed interface FooGetServer1Variables1Boxed
-permits
-[FooGetServer1Variables1BoxedMap](#foogetserver1variables1boxedmap) - -sealed interface that stores validated payloads using boxed classes - -## FooGetServer1Variables1BoxedMap -public record FooGetServer1Variables1BoxedMap
-implements [FooGetServer1Variables1Boxed](#foogetserver1variables1boxed) - -record that stores validated Map payloads, sealed permits implementation - -### Constructor Summary -| Constructor and Description | -| --------------------------- | -| FooGetServer1Variables1BoxedMap([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 | - -## FooGetServer1Variables1 -public static class FooGetServer1Variables1
-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.FooGetServer1Variables; - -import java.util.Arrays; -import java.util.List; -import java.util.AbstractMap; - -static final SchemaConfiguration configuration = new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().build()); - -// Map validation -FooGetServer1Variables.VariablesMap validatedPayload = - FooGetServer1Variables.FooGetServer1Variables1.validate( - new FooGetServer1Variables.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) | -| [FooGetServer1Variables1BoxedMap](#foogetserver1variables1boxedmap) | validateAndBox([Map<?, ?>](#variablesmapbuilder) arg, SchemaConfiguration configuration) | -| [FooGetServer1Variables1Boxed](#foogetserver1variables1boxed) | 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.FooGetServer1Variables; - -import java.util.Arrays; -import java.util.List; -import java.util.AbstractMap; - -static final SchemaConfiguration configuration = new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().build()); - -// String validation -String validatedPayload = FooGetServer1Variables.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(Nothing? data)
Creates an instance, private visibility | - -### Method Summary -| Modifier and Type | Method and Description | -| ----------------- | ---------------------- | -| Nothing? | 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/kotlin/docs/paths/pet/PetPost.md b/samples/client/petstore/kotlin/docs/paths/pet/PetPost.md deleted file mode 100644 index 25e3707601c..00000000000 --- a/samples/client/petstore/kotlin/docs/paths/pet/PetPost.md +++ /dev/null @@ -1,238 +0,0 @@ -# PetPost - -public class PetPost - -A class that contains necessary endpoint classes -- a class that calls the endpoint method using the http verb -- a class that calls the endpoint method using the operationId name -- class(es) to store the request inputs -- builder(s) to set the request input data - -## Nested Class Summary -| Modifier and Type | Class and Description | -| ----------------- | --------------------- | -| static class | [Post](#post)
The class that has a post method to call the endpoint | -| interface | [AddPetOperation](#addpetoperation)
The interface that has a addPet method to call the endpoint | -| static class | [PostRequest](#postrequest)
The final request inputs class | -| static class | [PostNullableRequest](#postnullablerequest)
The initial request inputs class | -| static class | [Post0RequestBuilder](#post0requestbuilder)
A builder for the request input class | -| static class | [PostRequestBuilder](#postrequestbuilder)
A builder for the request input class | - -## Post -public static class Post 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.PetPostRequestBody; -import org.openapijsonschematools.client.components.schemas.Pet; -import org.openapijsonschematools.client.servers.RootServer0; -import org.openapijsonschematools.client.servers.RootServer1; -import org.openapijsonschematools.client.servers.RootServer2; -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.PetPostCode200Response; -import org.openapijsonschematools.client.paths.pet.post.responses.PetPostCode405Response; -import org.openapijsonschematools.client.servers.RootServerInfo; -import org.openapijsonschematools.client.paths.pet.PetPost; -import org.openapijsonschematools.client.paths.pet.post.PetPostResponses; - -import java.io.IOException; -import java.util.Arrays; -import java.util.List; -import java.util.Map; -import java.util.AbstractMap; - -// if you want to use a server that is not SERVER_0 pass it in here and change the ServerIndex input below -ApiConfiguration.ServerInfo serverInfo = new ApiConfiguration.ServerInfoBuilder() - .rootServerInfo( - new RootServerInfo.RootServerInfoBuilder() - .rootServer0(new RootServer0()) - .build() - ) - .build(); -ApiConfiguration.ServerIndexInfo serverIndexInfo = new ApiConfiguration.ServerIndexInfoBuilder() - .rootServerInfoServerIndex(RootServerInfo.ServerIndex.SERVER_0) - .build(); -List securitySchemes = new ArrayList(); -securitySchemes.add( - new ApiKey("someApiKey"); -); -ApiConfiguration.SecurityIndexInfo securityIndexInfo = new ApiConfiguration.SecurityIndexInfoBuilder() - .petPostSecurityRequirementObject0SecurityIndex(PetPostSecurityRequirementObject0.SecurityIndex.SECURITY_0) - .build(); -Duration timeout = Duration.ofSeconds(1L); -Map> defaultHeaders = Map.of("User-Agent", List.of("OpenAPI-JSON-Schema-Generator/1.0.0/java")); -ApiConfiguration apiConfiguration = new ApiConfiguration( - serverInfo - serverIndexInfo, - securitySchemes, - securityIndexInfo, - timeout, - defaultHeaders -); -SchemaConfiguration schemaConfiguration = new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().build()); -PetPost.Post apiClient = new PetPost.Post(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 -); -PetPostRequestBody.SealedRequestBody requestBody = new PetPostRequestBody.ApplicationjsonRequestBody(requestBodyPayload); - -var request = new PetPost.PostRequestBuilder() - .requestBody(requestBody) - .build(); - -PetPostResponses.EndpointResponse response; -try { - response = apiClient.post(request); -} catch (PetPostCode405Response.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; -} -PetPostResponses.EndpointPetPostCode200Response castResponse = (PetPostResponses.EndpointPetPostCode200Response) response; -``` -### Constructor Summary -| Constructor and Description | -| --------------------------- | -| Post(ApiConfiguration apiConfiguration, SchemaConfiguration schemaConfiguration)
Creates an instance | - -### Method Summary -| Modifier and Type | Method and Description | -| ----------------- | ---------------------- | -| [PetPostResponses.EndpointResponse](../../paths/pet/post/PetPostResponses.md#endpointresponse) | post([PostRequest](#postrequest) request) | - -## AddPetOperation -public interface AddPetOperation
- -an interface that allows one to call the endpoint using a method named addPet by the operationId - -### Method Summary -| Modifier and Type | Method and Description | -| ----------------- | ---------------------- | -| [PetPostResponses.EndpointResponse](../../paths/pet/post/PetPostResponses.md#endpointresponse) | addPet([PostRequest](#postrequest) request) | - -## PostRequest -public static class PostRequest
- -a class that stores the final request inputs - -### Field Summary -| Modifier and Type | Field and Description | -| ----------------- | --------------------- | -| [PetPostRequestBody.SealedRequestBody](../../paths/pet/post/PetPostRequestBody.md#sealedrequestbody) | requestBody | -| [RootServerInfo.@Nullable ServerIndex](../../RootServerInfo.md#serverindex) | serverIndex
optional. Note: this will override the value in apiConfiguration | -| [PetPostSecurityInfo.@Nullable SecurityIndex](../../paths/pet/post/PetPostSecurityInfo.md#securityindex) | securityIndex
optional. Note: this will override the value in apiConfiguration | -| @Nullable Duration | timeout
optional. Note: this will override the value in apiConfiguration | - -## PostNullableRequest -public static class PostNullableRequest
- -a class that stores the initial request inputs - -### Field Summary -| Modifier and Type | Field and Description | -| ----------------- | --------------------- | -| [PetPostRequestBody.@Nullable SealedRequestBody](../../paths/pet/post/PetPostRequestBody.md#sealedrequestbody) | requestBody | -| [RootServerInfo.@Nullable ServerIndex](../../RootServerInfo.md#serverindex) | serverIndex | -| [PetPostSecurityInfo.@Nullable SecurityIndex](../../paths/pet/post/PetPostSecurityInfo.md#securityindex) | securityIndex | -| @Nullable Duration | timeout | - -## Post0RequestBuilder -public static class Post0RequestBuilder
- -a builder for request inputs - -### Constructor Summary -| Constructor and Description | -| --------------------------- | -| Post0RequestBuilder(Post0RequestBuilder instance)
Creates a builder that contains the passed instance | - -### Method Summary -| Modifier and Type | Method and Description | -| ----------------- | ---------------------- | -| [PostRequest](#postrequest) | build()
Returns the request input used to call an endpoint method | -| [Post0RequestBuilder](#post0requestbuilder) | serverIndex([RootServerInfo.ServerIndex](../../RootServerInfo.md#serverindex) serverIndex)
sets the optional property. Note: this will override the value in apiConfiguration | -| [Post0RequestBuilder](#post0requestbuilder) | securityIndex([PetPostSecurityInfo.SecurityIndex](../../paths/pet/post/PetPostSecurityInfo.md#securityindex) securityIndex)
sets the optional property. Note: this will override the value in apiConfiguration | -| [Post0RequestBuilder](#post0requestbuilder) | timeout(Duration timeout)
sets the optional property. Note: this will override the value in apiConfiguration | - -## PostRequestBuilder -public static class PostRequestBuilder
- -a builder for request inputs - -### Constructor Summary -| Constructor and Description | -| --------------------------- | -| PostRequestBuilder()
Creates a builder that contains null for all parameters | - -### Method Summary -| Modifier and Type | Method and Description | -| ----------------- | ---------------------- | -| [Post0RequestBuilder](#post0requestbuilder) | requestBody([PetPostRequestBody.SealedRequestBody](../../paths/pet/post/PetPostRequestBody.md#sealedrequestbody) requestBody)
sets the property | - -[[Back to top]](#top) [[Back to README]](../../../README.md) diff --git a/samples/client/petstore/kotlin/docs/paths/pet/PetPut.md b/samples/client/petstore/kotlin/docs/paths/pet/PetPut.md deleted file mode 100644 index 404ddd48a9f..00000000000 --- a/samples/client/petstore/kotlin/docs/paths/pet/PetPut.md +++ /dev/null @@ -1,234 +0,0 @@ -# PetPut - -public class PetPut - -A class that contains necessary endpoint classes -- a class that calls the endpoint method using the http verb -- a class that calls the endpoint method using the operationId name -- class(es) to store the request inputs -- builder(s) to set the request input data - -## Nested Class Summary -| Modifier and Type | Class and Description | -| ----------------- | --------------------- | -| static class | [Put](#put)
The class that has a put method to call the endpoint | -| interface | [UpdatePetOperation](#updatepetoperation)
The interface that has a updatePet method to call the endpoint | -| static class | [PutRequest](#putrequest)
The final request inputs class | -| static class | [PutNullableRequest](#putnullablerequest)
The initial request inputs class | -| static class | [Put0RequestBuilder](#put0requestbuilder)
A builder for the request input class | -| static class | [PutRequestBuilder](#putrequestbuilder)
A builder for the request input class | - -## Put -public static class Put extends ApiClient.ApiClient1 implements PutOperation
- -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.PetPutRequestBody; -import org.openapijsonschematools.client.components.schemas.Pet; -import org.openapijsonschematools.client.servers.RootServer0; -import org.openapijsonschematools.client.servers.RootServer1; -import org.openapijsonschematools.client.servers.RootServer2; -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.pet.put.responses.PetPutCode400Response; -import org.openapijsonschematools.client.paths.pet.put.responses.PetPutCode404Response; -import org.openapijsonschematools.client.paths.pet.put.responses.PetPutCode405Response; -import org.openapijsonschematools.client.servers.RootServerInfo; -import org.openapijsonschematools.client.paths.pet.PetPut; -import org.openapijsonschematools.client.paths.pet.put.PetPutResponses; - -import java.io.IOException; -import java.util.Arrays; -import java.util.List; -import java.util.Map; -import java.util.AbstractMap; - -// if you want to use a server that is not SERVER_0 pass it in here and change the ServerIndex input below -ApiConfiguration.ServerInfo serverInfo = new ApiConfiguration.ServerInfoBuilder() - .rootServerInfo( - new RootServerInfo.RootServerInfoBuilder() - .rootServer0(new RootServer0()) - .build() - ) - .build(); -ApiConfiguration.ServerIndexInfo serverIndexInfo = new ApiConfiguration.ServerIndexInfoBuilder() - .rootServerInfoServerIndex(RootServerInfo.ServerIndex.SERVER_0) - .build(); -List securitySchemes = new ArrayList(); -ApiConfiguration.SecurityIndexInfo securityIndexInfo = new ApiConfiguration.SecurityIndexInfoBuilder() - .petPutSecurityRequirementObject0SecurityIndex(PetPutSecurityRequirementObject0.SecurityIndex.SECURITY_0) - .build(); -Duration timeout = Duration.ofSeconds(1L); -Map> defaultHeaders = Map.of("User-Agent", List.of("OpenAPI-JSON-Schema-Generator/1.0.0/java")); -ApiConfiguration apiConfiguration = new ApiConfiguration( - serverInfo - serverIndexInfo, - securitySchemes, - securityIndexInfo, - timeout, - defaultHeaders -); -SchemaConfiguration schemaConfiguration = new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().build()); -PetPut.Put apiClient = new PetPut.Put(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 -); -PetPutRequestBody.SealedRequestBody requestBody = new PetPutRequestBody.ApplicationjsonRequestBody(requestBodyPayload); - -var request = new PetPut.PutRequestBuilder() - .requestBody(requestBody) - .build(); - -Nothing? response; -try { - response = apiClient.put(request); -} catch (PetPutCode400Response.ResponseApiException | PetPutCode404Response.ResponseApiException | PetPutCode405Response.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 | -| --------------------------- | -| Put(ApiConfiguration apiConfiguration, SchemaConfiguration schemaConfiguration)
Creates an instance | - -### Method Summary -| Modifier and Type | Method and Description | -| ----------------- | ---------------------- | -| Nothing? | put([PutRequest](#putrequest) request) | - -## UpdatePetOperation -public interface UpdatePetOperation
- -an interface that allows one to call the endpoint using a method named updatePet by the operationId - -### Method Summary -| Modifier and Type | Method and Description | -| ----------------- | ---------------------- | -| Nothing? | updatePet([PutRequest](#putrequest) request) | - -## PutRequest -public static class PutRequest
- -a class that stores the final request inputs - -### Field Summary -| Modifier and Type | Field and Description | -| ----------------- | --------------------- | -| [PetPutRequestBody.SealedRequestBody](../../paths/pet/put/PetPutRequestBody.md#sealedrequestbody) | requestBody | -| [RootServerInfo.@Nullable ServerIndex](../../RootServerInfo.md#serverindex) | serverIndex
optional. Note: this will override the value in apiConfiguration | -| [PetPutSecurityInfo.@Nullable SecurityIndex](../../paths/pet/put/PetPutSecurityInfo.md#securityindex) | securityIndex
optional. Note: this will override the value in apiConfiguration | -| @Nullable Duration | timeout
optional. Note: this will override the value in apiConfiguration | - -## PutNullableRequest -public static class PutNullableRequest
- -a class that stores the initial request inputs - -### Field Summary -| Modifier and Type | Field and Description | -| ----------------- | --------------------- | -| [PetPutRequestBody.@Nullable SealedRequestBody](../../paths/pet/put/PetPutRequestBody.md#sealedrequestbody) | requestBody | -| [RootServerInfo.@Nullable ServerIndex](../../RootServerInfo.md#serverindex) | serverIndex | -| [PetPutSecurityInfo.@Nullable SecurityIndex](../../paths/pet/put/PetPutSecurityInfo.md#securityindex) | securityIndex | -| @Nullable Duration | timeout | - -## Put0RequestBuilder -public static class Put0RequestBuilder
- -a builder for request inputs - -### Constructor Summary -| Constructor and Description | -| --------------------------- | -| Put0RequestBuilder(Put0RequestBuilder instance)
Creates a builder that contains the passed instance | - -### Method Summary -| Modifier and Type | Method and Description | -| ----------------- | ---------------------- | -| [PutRequest](#putrequest) | build()
Returns the request input used to call an endpoint method | -| [Put0RequestBuilder](#put0requestbuilder) | serverIndex([RootServerInfo.ServerIndex](../../RootServerInfo.md#serverindex) serverIndex)
sets the optional property. Note: this will override the value in apiConfiguration | -| [Put0RequestBuilder](#put0requestbuilder) | securityIndex([PetPutSecurityInfo.SecurityIndex](../../paths/pet/put/PetPutSecurityInfo.md#securityindex) securityIndex)
sets the optional property. Note: this will override the value in apiConfiguration | -| [Put0RequestBuilder](#put0requestbuilder) | timeout(Duration timeout)
sets the optional property. Note: this will override the value in apiConfiguration | - -## PutRequestBuilder -public static class PutRequestBuilder
- -a builder for request inputs - -### Constructor Summary -| Constructor and Description | -| --------------------------- | -| PutRequestBuilder()
Creates a builder that contains null for all parameters | - -### Method Summary -| Modifier and Type | Method and Description | -| ----------------- | ---------------------- | -| [Put0RequestBuilder](#put0requestbuilder) | requestBody([PetPutRequestBody.SealedRequestBody](../../paths/pet/put/PetPutRequestBody.md#sealedrequestbody) requestBody)
sets the property | - -[[Back to top]](#top) [[Back to README]](../../../README.md) diff --git a/samples/client/petstore/kotlin/docs/paths/pet/post/PetPostRequestBody.md b/samples/client/petstore/kotlin/docs/paths/pet/post/PetPostRequestBody.md deleted file mode 100644 index bd9f8d276f1..00000000000 --- a/samples/client/petstore/kotlin/docs/paths/pet/post/PetPostRequestBody.md +++ /dev/null @@ -1,17 +0,0 @@ -# PetPostRequestBody - -public class PetPostRequestBody 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 - -## Nested Class Summary -| Modifier and Type | Class and Description | -| ----------------- | --------------------- | -| static class | [PetPostRequestBody.PetPostRequestBody1](#petpostrequestbody1)
class that serializes request bodies | - -## PetPostRequestBody1 -public static class PetPostRequestBody1 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/kotlin/docs/paths/pet/post/PetPostResponses.md b/samples/client/petstore/kotlin/docs/paths/pet/post/PetPostResponses.md deleted file mode 100644 index dcc8c53edf5..00000000000 --- a/samples/client/petstore/kotlin/docs/paths/pet/post/PetPostResponses.md +++ /dev/null @@ -1,29 +0,0 @@ -# PetPostResponses - -public class PetPostResponses - -A class that contains necessary responses classes -- a sealed interface, EndpointResponse, that stores endpoint responses -- records for each endpoint response - -## Nested Class Summary -| Modifier and Type | Class and Description | -| ----------------- | --------------------- | -| sealed interface | [EndpointResponse](#endpointresponse)
stores the endpoint responses | -| record | [EndpointPetPostCode200Response](#endpointpetpostcode200response)
the response for 200 | - -## EndpointResponse -public sealed interface EndpointResponse permits
-[EndpointPetPostCode200Response](#endpointpetpostcode200response) - -a sealed interface that stores endpoint responses - -## EndpointPetPostCode200Response -public record EndpointPetPostCode200Response( - HttpResponse response, - Nothing? body, - Nothing? headers -) implements EndpointResponse, ApiResponse
- -a class that stores an endpoint response - diff --git a/samples/client/petstore/kotlin/docs/paths/pet/post/PetPostSecurityInfo.md b/samples/client/petstore/kotlin/docs/paths/pet/post/PetPostSecurityInfo.md deleted file mode 100644 index 233fdd10e78..00000000000 --- a/samples/client/petstore/kotlin/docs/paths/pet/post/PetPostSecurityInfo.md +++ /dev/null @@ -1,44 +0,0 @@ -# PetPostSecurityInfo -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 -- an enum class that describes security index values - -## Nested Class Summary -| Modifier and Type | Class and Description | -| ----------------- | --------------------- | -| static class | [PetPostSecurityInfo.PetPostSecurityInfo1](#petpostsecurityinfo1)
SecurityRequirementObjectProvider -| enum | [PetPostSecurityInfo.SecurityIndex](#securityindex)
class that stores a security index | - -## PetPostSecurityInfo1 -implements SecurityRequirementObjectProvider<[SecurityIndex](#securityindex)> - -### Constructor Summary -| Constructor and Description | -| --------------------------- | -| PetPostSecurityInfo1()
Creates an instance | - -### 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 | - -### Method Summary -| Modifier and Type | Method and Description | -| ----------------- | ---------------------- | -| SecurityRequirementObject | getSecurityRequirementObject(@Nullable [SecurityIndex](#securityindex) securityIndex)
If null is input, then the instance's securityIndex will be used | - -## SecurityIndex -enum SecurityIndex
- -### Enum Constant Summary -| Enum Constant And Description | -| ----------------------------- | -| SECURITY_0
security 0 | -| SECURITY_1
security 1 | -| SECURITY_2
security 2 | diff --git a/samples/client/petstore/kotlin/docs/paths/pet/post/responses/PetPostCode200Response.md b/samples/client/petstore/kotlin/docs/paths/pet/post/responses/PetPostCode200Response.md deleted file mode 100644 index 3c59da4cc88..00000000000 --- a/samples/client/petstore/kotlin/docs/paths/pet/post/responses/PetPostCode200Response.md +++ /dev/null @@ -1,17 +0,0 @@ -# PetPostCode200Response - -public class PetPostCode200Response extends [SuccessDescriptionOnly](../../components/responses/SuccessDescriptionOnly.md) - -A class (extended from the $ref class) that contains necessary nested response classes -- a class that extends ResponseDeserializer and is used to deserialize responses - -## Nested Class Summary -| Modifier and Type | Class and Description | -| ----------------- | --------------------- | -| static class | [PetPostCode200Response.PetPostCode200Response1](#petpostcode200response1)
class that deserializes responses | - -## PetPostCode200Response1 -public static class PetPostCode200Response1 extends [SuccessDescriptionOnly1](../../components/responses/SuccessDescriptionOnly.md#successdescriptiononly1)
- -a class that deserializes responses, extended from the $ref class - diff --git a/samples/client/petstore/kotlin/docs/paths/pet/post/responses/PetPostCode405Response.md b/samples/client/petstore/kotlin/docs/paths/pet/post/responses/PetPostCode405Response.md deleted file mode 100644 index e0612c2d821..00000000000 --- a/samples/client/petstore/kotlin/docs/paths/pet/post/responses/PetPostCode405Response.md +++ /dev/null @@ -1,32 +0,0 @@ -# PetPostCode405Response - -public class PetPostCode405Response - -A class that contains necessary nested response classes -- a class that extends ResponseDeserializer and is used to deserialize responses - -## Nested Class Summary -| Modifier and Type | Class and Description | -| ----------------- | --------------------- | -| static class | [PetPostCode405Response.PetPostCode405Response1](#petpostcode405response1)
class that deserializes responses | - -## PetPostCode405Response1 -public static class PetPostCode405Response1
-extends ResponseDeserializer - -a class that deserializes responses - -### Constructor Summary -| Constructor and Description | -| --------------------------- | -| PetPostCode405Response1()
Creates an instance | - -### Field Summary -| Modifier and Type | Field and Description | -| ----------------- | --------------------- | -| Map | content = MapUtils.makeMap(
)
the contentType to schema info | - -### Method Summary -| Modifier and Type | Method and Description | -| ----------------- | ---------------------- | -| ApiResponse | deserialize(HttpResponse response, SchemaConfiguration configuration)
called by endpoint when deserialize responses | diff --git a/samples/client/petstore/kotlin/docs/paths/pet/post/security/PetPostSecurityRequirementObject0.md b/samples/client/petstore/kotlin/docs/paths/pet/post/security/PetPostSecurityRequirementObject0.md deleted file mode 100644 index dc904ae9529..00000000000 --- a/samples/client/petstore/kotlin/docs/paths/pet/post/security/PetPostSecurityRequirementObject0.md +++ /dev/null @@ -1,15 +0,0 @@ -# PetPostSecurityRequirementObject0 -PetPostSecurityRequirementObject0.java - -public class PetPostSecurityRequirementObject0 -extends SecurityRequirementObject - -### Constructor Summary -| Constructor and Description | -| --------------------------- | -| PetPostSecurityRequirementObject0()
Creates an instance | - -### 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()
    )) | diff --git a/samples/client/petstore/kotlin/docs/paths/pet/post/security/PetPostSecurityRequirementObject1.md b/samples/client/petstore/kotlin/docs/paths/pet/post/security/PetPostSecurityRequirementObject1.md deleted file mode 100644 index 4ffc2e46b31..00000000000 --- a/samples/client/petstore/kotlin/docs/paths/pet/post/security/PetPostSecurityRequirementObject1.md +++ /dev/null @@ -1,15 +0,0 @@ -# PetPostSecurityRequirementObject1 -PetPostSecurityRequirementObject1.java - -public class PetPostSecurityRequirementObject1 -extends SecurityRequirementObject - -### Constructor Summary -| Constructor and Description | -| --------------------------- | -| PetPostSecurityRequirementObject1()
Creates an instance | - -### 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()
    )) | diff --git a/samples/client/petstore/kotlin/docs/paths/pet/post/security/PetPostSecurityRequirementObject2.md b/samples/client/petstore/kotlin/docs/paths/pet/post/security/PetPostSecurityRequirementObject2.md deleted file mode 100644 index 88db581a2d6..00000000000 --- a/samples/client/petstore/kotlin/docs/paths/pet/post/security/PetPostSecurityRequirementObject2.md +++ /dev/null @@ -1,15 +0,0 @@ -# PetPostSecurityRequirementObject2 -PetPostSecurityRequirementObject2.java - -public class PetPostSecurityRequirementObject2 -extends SecurityRequirementObject - -### Constructor Summary -| Constructor and Description | -| --------------------------- | -| PetPostSecurityRequirementObject2()
Creates an instance | - -### 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")
    )) | diff --git a/samples/client/petstore/kotlin/docs/paths/pet/put/PetPutRequestBody.md b/samples/client/petstore/kotlin/docs/paths/pet/put/PetPutRequestBody.md deleted file mode 100644 index e732123f8df..00000000000 --- a/samples/client/petstore/kotlin/docs/paths/pet/put/PetPutRequestBody.md +++ /dev/null @@ -1,17 +0,0 @@ -# PetPutRequestBody - -public class PetPutRequestBody 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 - -## Nested Class Summary -| Modifier and Type | Class and Description | -| ----------------- | --------------------- | -| static class | [PetPutRequestBody.PetPutRequestBody1](#petputrequestbody1)
class that serializes request bodies | - -## PetPutRequestBody1 -public static class PetPutRequestBody1 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/kotlin/docs/paths/pet/put/PetPutResponses.md b/samples/client/petstore/kotlin/docs/paths/pet/put/PetPutResponses.md deleted file mode 100644 index fb9a8a6388a..00000000000 --- a/samples/client/petstore/kotlin/docs/paths/pet/put/PetPutResponses.md +++ /dev/null @@ -1,10 +0,0 @@ -# PetPutResponses - -public class PetPutResponses - -A class that contains necessary responses classes - -## Nested Class Summary -| Modifier and Type | Class and Description | -| ----------------- | --------------------- | - diff --git a/samples/client/petstore/kotlin/docs/paths/pet/put/PetPutSecurityInfo.md b/samples/client/petstore/kotlin/docs/paths/pet/put/PetPutSecurityInfo.md deleted file mode 100644 index 1136055dad2..00000000000 --- a/samples/client/petstore/kotlin/docs/paths/pet/put/PetPutSecurityInfo.md +++ /dev/null @@ -1,42 +0,0 @@ -# PetPutSecurityInfo -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 -- an enum class that describes security index values - -## Nested Class Summary -| Modifier and Type | Class and Description | -| ----------------- | --------------------- | -| static class | [PetPutSecurityInfo.PetPutSecurityInfo1](#petputsecurityinfo1)
SecurityRequirementObjectProvider -| enum | [PetPutSecurityInfo.SecurityIndex](#securityindex)
class that stores a security index | - -## PetPutSecurityInfo1 -implements SecurityRequirementObjectProvider<[SecurityIndex](#securityindex)> - -### Constructor Summary -| Constructor and Description | -| --------------------------- | -| PetPutSecurityInfo1()
Creates an instance | - -### Field Summary -| Modifier and Type | Field and Description | -| ----------------- | --------------------- | -| [PetPutSecurityRequirementObject0](../../../paths/pet/put/security/PetPutSecurityRequirementObject0.md) | security0 | -| [PetPutSecurityRequirementObject1](../../../paths/pet/put/security/PetPutSecurityRequirementObject1.md) | security1 | - -### Method Summary -| Modifier and Type | Method and Description | -| ----------------- | ---------------------- | -| SecurityRequirementObject | getSecurityRequirementObject(@Nullable [SecurityIndex](#securityindex) securityIndex)
If null is input, then the instance's securityIndex will be used | - -## SecurityIndex -enum SecurityIndex
- -### Enum Constant Summary -| Enum Constant And Description | -| ----------------------------- | -| SECURITY_0
security 0 | -| SECURITY_1
security 1 | diff --git a/samples/client/petstore/kotlin/docs/paths/pet/put/responses/PetPutCode400Response.md b/samples/client/petstore/kotlin/docs/paths/pet/put/responses/PetPutCode400Response.md deleted file mode 100644 index 19b5acf6249..00000000000 --- a/samples/client/petstore/kotlin/docs/paths/pet/put/responses/PetPutCode400Response.md +++ /dev/null @@ -1,32 +0,0 @@ -# PetPutCode400Response - -public class PetPutCode400Response - -A class that contains necessary nested response classes -- a class that extends ResponseDeserializer and is used to deserialize responses - -## Nested Class Summary -| Modifier and Type | Class and Description | -| ----------------- | --------------------- | -| static class | [PetPutCode400Response.PetPutCode400Response1](#petputcode400response1)
class that deserializes responses | - -## PetPutCode400Response1 -public static class PetPutCode400Response1
-extends ResponseDeserializer - -a class that deserializes responses - -### Constructor Summary -| Constructor and Description | -| --------------------------- | -| PetPutCode400Response1()
Creates an instance | - -### Field Summary -| Modifier and Type | Field and Description | -| ----------------- | --------------------- | -| Map | content = MapUtils.makeMap(
)
the contentType to schema info | - -### Method Summary -| Modifier and Type | Method and Description | -| ----------------- | ---------------------- | -| ApiResponse | deserialize(HttpResponse response, SchemaConfiguration configuration)
called by endpoint when deserialize responses | diff --git a/samples/client/petstore/kotlin/docs/paths/pet/put/responses/PetPutCode404Response.md b/samples/client/petstore/kotlin/docs/paths/pet/put/responses/PetPutCode404Response.md deleted file mode 100644 index dac89b4928c..00000000000 --- a/samples/client/petstore/kotlin/docs/paths/pet/put/responses/PetPutCode404Response.md +++ /dev/null @@ -1,32 +0,0 @@ -# PetPutCode404Response - -public class PetPutCode404Response - -A class that contains necessary nested response classes -- a class that extends ResponseDeserializer and is used to deserialize responses - -## Nested Class Summary -| Modifier and Type | Class and Description | -| ----------------- | --------------------- | -| static class | [PetPutCode404Response.PetPutCode404Response1](#petputcode404response1)
class that deserializes responses | - -## PetPutCode404Response1 -public static class PetPutCode404Response1
-extends ResponseDeserializer - -a class that deserializes responses - -### Constructor Summary -| Constructor and Description | -| --------------------------- | -| PetPutCode404Response1()
Creates an instance | - -### Field Summary -| Modifier and Type | Field and Description | -| ----------------- | --------------------- | -| Map | content = MapUtils.makeMap(
)
the contentType to schema info | - -### Method Summary -| Modifier and Type | Method and Description | -| ----------------- | ---------------------- | -| ApiResponse | deserialize(HttpResponse response, SchemaConfiguration configuration)
called by endpoint when deserialize responses | diff --git a/samples/client/petstore/kotlin/docs/paths/pet/put/responses/PetPutCode405Response.md b/samples/client/petstore/kotlin/docs/paths/pet/put/responses/PetPutCode405Response.md deleted file mode 100644 index 8bc74258d27..00000000000 --- a/samples/client/petstore/kotlin/docs/paths/pet/put/responses/PetPutCode405Response.md +++ /dev/null @@ -1,32 +0,0 @@ -# PetPutCode405Response - -public class PetPutCode405Response - -A class that contains necessary nested response classes -- a class that extends ResponseDeserializer and is used to deserialize responses - -## Nested Class Summary -| Modifier and Type | Class and Description | -| ----------------- | --------------------- | -| static class | [PetPutCode405Response.PetPutCode405Response1](#petputcode405response1)
class that deserializes responses | - -## PetPutCode405Response1 -public static class PetPutCode405Response1
-extends ResponseDeserializer - -a class that deserializes responses - -### Constructor Summary -| Constructor and Description | -| --------------------------- | -| PetPutCode405Response1()
Creates an instance | - -### Field Summary -| Modifier and Type | Field and Description | -| ----------------- | --------------------- | -| Map | content = MapUtils.makeMap(
)
the contentType to schema info | - -### Method Summary -| Modifier and Type | Method and Description | -| ----------------- | ---------------------- | -| ApiResponse | deserialize(HttpResponse response, SchemaConfiguration configuration)
called by endpoint when deserialize responses | diff --git a/samples/client/petstore/kotlin/docs/paths/pet/put/security/PetPutSecurityRequirementObject0.md b/samples/client/petstore/kotlin/docs/paths/pet/put/security/PetPutSecurityRequirementObject0.md deleted file mode 100644 index a0bb52235ba..00000000000 --- a/samples/client/petstore/kotlin/docs/paths/pet/put/security/PetPutSecurityRequirementObject0.md +++ /dev/null @@ -1,15 +0,0 @@ -# PetPutSecurityRequirementObject0 -PetPutSecurityRequirementObject0.java - -public class PetPutSecurityRequirementObject0 -extends SecurityRequirementObject - -### Constructor Summary -| Constructor and Description | -| --------------------------- | -| PetPutSecurityRequirementObject0()
Creates an instance | - -### 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()
    )) | diff --git a/samples/client/petstore/kotlin/docs/paths/pet/put/security/PetPutSecurityRequirementObject1.md b/samples/client/petstore/kotlin/docs/paths/pet/put/security/PetPutSecurityRequirementObject1.md deleted file mode 100644 index 9dd305982f5..00000000000 --- a/samples/client/petstore/kotlin/docs/paths/pet/put/security/PetPutSecurityRequirementObject1.md +++ /dev/null @@ -1,15 +0,0 @@ -# PetPutSecurityRequirementObject1 -PetPutSecurityRequirementObject1.java - -public class PetPutSecurityRequirementObject1 -extends SecurityRequirementObject - -### Constructor Summary -| Constructor and Description | -| --------------------------- | -| PetPutSecurityRequirementObject1()
Creates an instance | - -### 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")
    )) | diff --git a/samples/client/petstore/kotlin/docs/paths/petfindbystatus/PetfindbystatusGet.md b/samples/client/petstore/kotlin/docs/paths/petfindbystatus/PetfindbystatusGet.md deleted file mode 100644 index 209dbc6912b..00000000000 --- a/samples/client/petstore/kotlin/docs/paths/petfindbystatus/PetfindbystatusGet.md +++ /dev/null @@ -1,209 +0,0 @@ -# PetfindbystatusGet - -public class PetfindbystatusGet - -A class that contains necessary endpoint classes -- a class that calls the endpoint method using the http verb -- a class that calls the endpoint method using the operationId name -- class(es) to store the request inputs -- builder(s) to set the request input data - -## Nested Class Summary -| Modifier and Type | Class and Description | -| ----------------- | --------------------- | -| static class | [Get](#get)
The class that has a get method to call the endpoint | -| interface | [FindPetsByStatusOperation](#findpetsbystatusoperation)
The interface that has a findPetsByStatus method to call the endpoint | -| static class | [GetRequest](#getrequest)
The final request inputs class | -| static class | [GetNullableRequest](#getnullablerequest)
The initial request inputs class | -| static class | [Get0RequestBuilder](#get0requestbuilder)
A builder for the request input class | -| static class | [GetRequestBuilder](#getrequestbuilder)
A builder for the request input class | - -## Get -public static class Get extends ApiClient.ApiClient1 implements GetOperation
- -a class that allows one to call the endpoint using a method named get - -### 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.petfindbystatus.PetfindbystatusServerInfo; -import org.openapijsonschematools.client.paths.petfindbystatus.get.PetfindbystatusGetSecurityInfo; -import org.openapijsonschematools.client.paths.petfindbystatus.get.PetfindbystatusGetQueryParameters; -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.PetfindbystatusGetCode200Response; -import org.openapijsonschematools.client.paths.petfindbystatus.get.responses.PetfindbystatusGetCode400Response; -import org.openapijsonschematools.client.paths.petfindbystatus.PetfindbystatusServerInfo; -import org.openapijsonschematools.client.paths.petfindbystatus.PetfindbystatusGet; -import org.openapijsonschematools.client.paths.petfindbystatus.get.PetfindbystatusGetResponses; - -import java.io.IOException; -import java.util.Arrays; -import java.util.List; -import java.util.Map; -import java.util.AbstractMap; - -// if you want to use a server that is not SERVER_0 pass it in here and change the ServerIndex input below -ApiConfiguration.ServerInfo serverInfo = new ApiConfiguration.ServerInfoBuilder() - .petfindbystatusServerInfo( - new PetfindbystatusServerInfo.PetfindbystatusServerInfoBuilder() - .petfindbystatusServer0(new PetfindbystatusServer0()) - .build() - ) - .build(); -ApiConfiguration.ServerIndexInfo serverIndexInfo = new ApiConfiguration.ServerIndexInfoBuilder() - .petfindbystatusServerInfoServerIndex(PetfindbystatusServerInfo.ServerIndex.SERVER_0) - .build(); -List securitySchemes = new ArrayList(); -securitySchemes.add( - new ApiKey("someApiKey"); -); -ApiConfiguration.SecurityIndexInfo securityIndexInfo = new ApiConfiguration.SecurityIndexInfoBuilder() - .petfindbystatusGetSecurityRequirementObject0SecurityIndex(PetfindbystatusGetSecurityRequirementObject0.SecurityIndex.SECURITY_0) - .build(); -Duration timeout = Duration.ofSeconds(1L); -Map> defaultHeaders = Map.of("User-Agent", List.of("OpenAPI-JSON-Schema-Generator/1.0.0/java")); -ApiConfiguration apiConfiguration = new ApiConfiguration( - serverInfo - serverIndexInfo, - securitySchemes, - securityIndexInfo, - timeout, - defaultHeaders -); -SchemaConfiguration schemaConfiguration = new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().build()); -PetfindbystatusGet.Get apiClient = new PetfindbystatusGet.Get(apiConfiguration, schemaConfiguration); - - -// Map validation -PetfindbystatusGetQueryParameters.QueryParametersMap queryParameters = - PetfindbystatusGetQueryParameters.PetfindbystatusGetQueryParameters1.validate( - new PetfindbystatusGetQueryParameters.QueryParametersMapBuilder() - .status( - Arrays.asList( - "available" - ) - ) - .build(), - schemaConfiguration -); - -var request = new PetfindbystatusGet.GetRequestBuilder() - .queryParameters(queryParameters) - .build(); - -PetfindbystatusGetResponses.EndpointResponse response; -try { - response = apiClient.get(request); -} catch (PetfindbystatusGetCode400Response.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; -} -PetfindbystatusGetResponses.EndpointPetfindbystatusGetCode200Response castResponse = (PetfindbystatusGetResponses.EndpointPetfindbystatusGetCode200Response) response; -} -``` -### Constructor Summary -| Constructor and Description | -| --------------------------- | -| Get(ApiConfiguration apiConfiguration, SchemaConfiguration schemaConfiguration)
Creates an instance | - -### Method Summary -| Modifier and Type | Method and Description | -| ----------------- | ---------------------- | -| [PetfindbystatusGetResponses.EndpointResponse](../../paths/petfindbystatus/get/PetfindbystatusGetResponses.md#endpointresponse) | get([GetRequest](#getrequest) request) | - -## FindPetsByStatusOperation -public interface FindPetsByStatusOperation
- -an interface that allows one to call the endpoint using a method named findPetsByStatus by the operationId - -### Method Summary -| Modifier and Type | Method and Description | -| ----------------- | ---------------------- | -| [PetfindbystatusGetResponses.EndpointResponse](../../paths/petfindbystatus/get/PetfindbystatusGetResponses.md#endpointresponse) | findPetsByStatus([GetRequest](#getrequest) request) | - -## GetRequest -public static class GetRequest
- -a class that stores the final request inputs - -### Field Summary -| Modifier and Type | Field and Description | -| ----------------- | --------------------- | -| [PetfindbystatusGetQueryParameters.QueryParametersMap](../../paths/petfindbystatus/get/PetfindbystatusGetQueryParameters.md#queryparametersmap) | queryParameters | -| [PetfindbystatusServerInfo.@Nullable ServerIndex](../../paths/petfindbystatus/PetfindbystatusServerInfo.md#serverindex) | serverIndex
optional. Note: this will override the value in apiConfiguration | -| [PetfindbystatusGetSecurityInfo.@Nullable SecurityIndex](../../paths/petfindbystatus/get/PetfindbystatusGetSecurityInfo.md#securityindex) | securityIndex
optional. Note: this will override the value in apiConfiguration | -| @Nullable Duration | timeout
optional. Note: this will override the value in apiConfiguration | - -## GetNullableRequest -public static class GetNullableRequest
- -a class that stores the initial request inputs - -### Field Summary -| Modifier and Type | Field and Description | -| ----------------- | --------------------- | -| [PetfindbystatusGetQueryParameters.@Nullable QueryParametersMap](../../paths/petfindbystatus/get/PetfindbystatusGetQueryParameters.md#queryparametersmap) | queryParameters | -| [PetfindbystatusServerInfo.@Nullable ServerIndex](../../paths/petfindbystatus/PetfindbystatusServerInfo.md#serverindex) | serverIndex | -| [PetfindbystatusGetSecurityInfo.@Nullable SecurityIndex](../../paths/petfindbystatus/get/PetfindbystatusGetSecurityInfo.md#securityindex) | securityIndex | -| @Nullable Duration | timeout | - -## Get0RequestBuilder -public static class Get0RequestBuilder
- -a builder for request inputs - -### Constructor Summary -| Constructor and Description | -| --------------------------- | -| Get0RequestBuilder(Get0RequestBuilder instance)
Creates a builder that contains the passed instance | - -### Method Summary -| Modifier and Type | Method and Description | -| ----------------- | ---------------------- | -| [GetRequest](#getrequest) | build()
Returns the request input used to call an endpoint method | -| [Get0RequestBuilder](#get0requestbuilder) | serverIndex([PetfindbystatusServerInfo.ServerIndex](../../paths/petfindbystatus/PetfindbystatusServerInfo.md#serverindex) serverIndex)
sets the optional property. Note: this will override the value in apiConfiguration | -| [Get0RequestBuilder](#get0requestbuilder) | securityIndex([PetfindbystatusGetSecurityInfo.SecurityIndex](../../paths/petfindbystatus/get/PetfindbystatusGetSecurityInfo.md#securityindex) securityIndex)
sets the optional property. Note: this will override the value in apiConfiguration | -| [Get0RequestBuilder](#get0requestbuilder) | timeout(Duration timeout)
sets the optional property. Note: this will override the value in apiConfiguration | - -## GetRequestBuilder -public static class GetRequestBuilder
- -a builder for request inputs - -### Constructor Summary -| Constructor and Description | -| --------------------------- | -| GetRequestBuilder()
Creates a builder that contains null for all parameters | - -### Method Summary -| Modifier and Type | Method and Description | -| ----------------- | ---------------------- | -| [Get0RequestBuilder](#get0requestbuilder) | queryParameters([PetfindbystatusGetQueryParametersQueryParametersMap](../../paths/petfindbystatus/get/PetfindbystatusGetQueryParameters.md#queryparametersmap) queryParameters)
sets the property | - -[[Back to top]](#top) [[Back to README]](../../../README.md) diff --git a/samples/client/petstore/kotlin/docs/paths/petfindbystatus/PetfindbystatusServerInfo.md b/samples/client/petstore/kotlin/docs/paths/petfindbystatus/PetfindbystatusServerInfo.md deleted file mode 100644 index fefcf6ae3de..00000000000 --- a/samples/client/petstore/kotlin/docs/paths/petfindbystatus/PetfindbystatusServerInfo.md +++ /dev/null @@ -1,62 +0,0 @@ -# PetfindbystatusServerInfo -PetfindbystatusServerInfo.java - -public class PetfindbystatusServerInfo - -A class that provides a server, and any needed server info classes -- a class that is a ServerProvider -- a builder for the ServerProvider -- an enum class that stores server index values - -## Nested Class Summary -| Modifier and Type | Class and Description | -| ----------------- | --------------------- | -| static class | [PetfindbystatusServerInfo.PetfindbystatusServerInfo1](#petfindbystatusserverinfo1)
class that stores a server index | -| static class | [PetfindbystatusServerInfo.PetfindbystatusServerInfoBuilder](#petfindbystatusserverinfobuilder)
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(@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) | - -## PetfindbystatusServerInfoBuilder - -a builder for [PetfindbystatusServerInfo1](#petfindbystatusserverinfo1) - -### Constructor Summary -| Constructor and Description | -| --------------------------- | -| PetfindbystatusServerInfoBuilder()
Creates an instance | - -### Method Summary -| Modifier and Type | Method and Description | -| ----------------- | ---------------------- | -| [PetfindbystatusServerInfoBuilder](#petfindbystatusserverinfobuilder) | petfindbystatusServer0([PetfindbystatusServer0](../../paths/petfindbystatus/servers/PetfindbystatusServer0.md) server0)
sets the server | -| [PetfindbystatusServerInfoBuilder](#petfindbystatusserverinfobuilder) | petfindbystatusServer1([PetfindbystatusServer1](../../paths/petfindbystatus/servers/PetfindbystatusServer1.md) server1)
sets the server | -| [PetfindbystatusServerInfo1](#petfindbystatusserverinfo1) | build() | - -## ServerIndex -enum ServerIndex
- -### Enum Constant Summary -| Enum Constant And Description | -| ----------------------------- | -| SERVER_0
server 0 | -| SERVER_1
server 1 | diff --git a/samples/client/petstore/kotlin/docs/paths/petfindbystatus/get/PetfindbystatusGetQueryParameters.md b/samples/client/petstore/kotlin/docs/paths/petfindbystatus/get/PetfindbystatusGetQueryParameters.md deleted file mode 100644 index ee1e7068fda..00000000000 --- a/samples/client/petstore/kotlin/docs/paths/petfindbystatus/get/PetfindbystatusGetQueryParameters.md +++ /dev/null @@ -1,271 +0,0 @@ -# PetfindbystatusGetQueryParameters -public class PetfindbystatusGetQueryParameters
- -A class that contains necessary nested -- schema classes (which validate payloads), extends JsonSchema -- sealed interfaces which store validated payloads, java version of a sum type -- boxed classes which store validated payloads, sealed permits class implementations -- classes to store validated map payloads, extends FrozenMap -- classes to build inputs for map payloads - -## Nested Class Summary -| Modifier and Type | Class and Description | -| ----------------- | ---------------------- | -| sealed interface | [PetfindbystatusGetQueryParameters.PetfindbystatusGetQueryParameters1Boxed](#petfindbystatusgetqueryparameters1boxed)
sealed interface for validated payloads | -| record | [PetfindbystatusGetQueryParameters.PetfindbystatusGetQueryParameters1BoxedMap](#petfindbystatusgetqueryparameters1boxedmap)
boxed class to store validated Map payloads | -| static class | [PetfindbystatusGetQueryParameters.PetfindbystatusGetQueryParameters1](#petfindbystatusgetqueryparameters1)
schema class | -| static class | [PetfindbystatusGetQueryParameters.QueryParametersMapBuilder](#queryparametersmapbuilder)
builder for Map payloads | -| static class | [PetfindbystatusGetQueryParameters.QueryParametersMap](#queryparametersmap)
output class for Map payloads | -| sealed interface | [PetfindbystatusGetQueryParameters.AdditionalPropertiesBoxed](#additionalpropertiesboxed)
sealed interface for validated payloads | -| record | [PetfindbystatusGetQueryParameters.AdditionalPropertiesBoxedVoid](#additionalpropertiesboxedvoid)
boxed class to store validated null payloads | -| record | [PetfindbystatusGetQueryParameters.AdditionalPropertiesBoxedBoolean](#additionalpropertiesboxedboolean)
boxed class to store validated boolean payloads | -| record | [PetfindbystatusGetQueryParameters.AdditionalPropertiesBoxedNumber](#additionalpropertiesboxednumber)
boxed class to store validated Number payloads | -| record | [PetfindbystatusGetQueryParameters.AdditionalPropertiesBoxedString](#additionalpropertiesboxedstring)
boxed class to store validated String payloads | -| record | [PetfindbystatusGetQueryParameters.AdditionalPropertiesBoxedList](#additionalpropertiesboxedlist)
boxed class to store validated List payloads | -| record | [PetfindbystatusGetQueryParameters.AdditionalPropertiesBoxedMap](#additionalpropertiesboxedmap)
boxed class to store validated Map payloads | -| static class | [PetfindbystatusGetQueryParameters.AdditionalProperties](#additionalproperties)
schema class | - -## PetfindbystatusGetQueryParameters1Boxed -public sealed interface PetfindbystatusGetQueryParameters1Boxed
-permits
-[PetfindbystatusGetQueryParameters1BoxedMap](#petfindbystatusgetqueryparameters1boxedmap) - -sealed interface that stores validated payloads using boxed classes - -## PetfindbystatusGetQueryParameters1BoxedMap -public record PetfindbystatusGetQueryParameters1BoxedMap
-implements [PetfindbystatusGetQueryParameters1Boxed](#petfindbystatusgetqueryparameters1boxed) - -record that stores validated Map payloads, sealed permits implementation - -### Constructor Summary -| Constructor and Description | -| --------------------------- | -| PetfindbystatusGetQueryParameters1BoxedMap([QueryParametersMap](#queryparametersmap) data)
Creates an instance, private visibility | - -### Method Summary -| Modifier and Type | Method and Description | -| ----------------- | ---------------------- | -| [QueryParametersMap](#queryparametersmap) | data()
validated payload | -| @Nullable Object | getData()
validated payload | - -## PetfindbystatusGetQueryParameters1 -public static class PetfindbystatusGetQueryParameters1
-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.get.PetfindbystatusGetQueryParameters; - -import java.util.Arrays; -import java.util.List; -import java.util.AbstractMap; - -static final SchemaConfiguration configuration = new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().build()); - -// Map validation -PetfindbystatusGetQueryParameters.QueryParametersMap validatedPayload = - PetfindbystatusGetQueryParameters.PetfindbystatusGetQueryParameters1.validate( - new PetfindbystatusGetQueryParameters.QueryParametersMapBuilder() - .status( - Arrays.asList( - "available" - ) - ) - .build(), - configuration -); -``` - -### Field Summary -| Modifier and Type | Field and Description | -| ----------------- | ---------------------- | -| Set> | type = Set.of(Map.class) | -| Map> | properties = Map.ofEntries(
    new PropertyEntry("status", [Schema0.Schema01.class](../../../paths/petfindbystatus/get/parameters/parameter0/Schema0.md#schema01))
)
| -| Set | required = Set.of(
    "status"
)
| -| Class | additionalProperties = [AdditionalProperties.class](#additionalproperties) | - -### Method Summary -| Modifier and Type | Method and Description | -| ----------------- | ---------------------- | -| [QueryParametersMap](#queryparametersmap) | validate([Map<?, ?>](#queryparametersmapbuilder) arg, SchemaConfiguration configuration) | -| [PetfindbystatusGetQueryParameters1BoxedMap](#petfindbystatusgetqueryparameters1boxedmap) | validateAndBox([Map<?, ?>](#queryparametersmapbuilder) arg, SchemaConfiguration configuration) | -| [PetfindbystatusGetQueryParameters1Boxed](#petfindbystatusgetqueryparameters1boxed) | validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) | -| @Nullable Object | validate(@Nullable Object arg, SchemaConfiguration configuration) | - -## QueryParametersMap0Builder -public class QueryParametersMap0Builder
-builder for `Map>` - -A class that builds the Map input type - -### Constructor Summary -| Constructor and Description | -| --------------------------- | -| QueryParametersMap0Builder(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 | - -## QueryParametersMapBuilder -public class QueryParametersMapBuilder
-builder for `Map>` - -A class that builds the Map input type - -### Constructor Summary -| Constructor and Description | -| --------------------------- | -| QueryParametersMapBuilder()
Creates a builder that contains an empty map | - -### Method Summary -| Modifier and Type | Method and Description | -| ----------------- | ---------------------- | -| [QueryParametersMap0Builder](#queryparametersmap0builder) | status(List value) | - -## QueryParametersMap -public static class QueryParametersMap
-extends FrozenMap - -A class to store validated Map payloads - -### Method Summary -| Modifier and Type | Method and Description | -| ----------------- | ---------------------- | -| static [QueryParametersMap](#queryparametersmap) | of([Map>](#queryparametersmapbuilder) arg, SchemaConfiguration configuration) | -| [Schema0.SchemaList0](../../../paths/petfindbystatus/get/parameters/parameter0/Schema0.md#schemalist0) | status()
| - -## 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(Nothing? data)
Creates an instance, private visibility | - -### Method Summary -| Modifier and Type | Method and Description | -| ----------------- | ---------------------- | -| Nothing? | 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/kotlin/docs/paths/petfindbystatus/get/PetfindbystatusGetResponses.md b/samples/client/petstore/kotlin/docs/paths/petfindbystatus/get/PetfindbystatusGetResponses.md deleted file mode 100644 index c93f98c5ef6..00000000000 --- a/samples/client/petstore/kotlin/docs/paths/petfindbystatus/get/PetfindbystatusGetResponses.md +++ /dev/null @@ -1,29 +0,0 @@ -# PetfindbystatusGetResponses - -public class PetfindbystatusGetResponses - -A class that contains necessary responses classes -- a sealed interface, EndpointResponse, that stores endpoint responses -- records for each endpoint response - -## Nested Class Summary -| Modifier and Type | Class and Description | -| ----------------- | --------------------- | -| sealed interface | [EndpointResponse](#endpointresponse)
stores the endpoint responses | -| record | [EndpointPetfindbystatusGetCode200Response](#endpointpetfindbystatusgetcode200response)
the response for 200 | - -## EndpointResponse -public sealed interface EndpointResponse permits
-[EndpointPetfindbystatusGetCode200Response](#endpointpetfindbystatusgetcode200response) - -a sealed interface that stores endpoint responses - -## EndpointPetfindbystatusGetCode200Response -public record EndpointPetfindbystatusGetCode200Response( - HttpResponse response, - [PetfindbystatusGetCode200Response.SealedResponseBody](../../../paths/petfindbystatus/get/responses/PetfindbystatusGetCode200Response.md#sealedresponsebody) body, - Nothing? headers -) implements EndpointResponse, ApiResponse
- -a class that stores an endpoint response - diff --git a/samples/client/petstore/kotlin/docs/paths/petfindbystatus/get/PetfindbystatusGetSecurityInfo.md b/samples/client/petstore/kotlin/docs/paths/petfindbystatus/get/PetfindbystatusGetSecurityInfo.md deleted file mode 100644 index a0bc58eb967..00000000000 --- a/samples/client/petstore/kotlin/docs/paths/petfindbystatus/get/PetfindbystatusGetSecurityInfo.md +++ /dev/null @@ -1,44 +0,0 @@ -# PetfindbystatusGetSecurityInfo -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 -- an enum class that describes security index values - -## Nested Class Summary -| Modifier and Type | Class and Description | -| ----------------- | --------------------- | -| static class | [PetfindbystatusGetSecurityInfo.PetfindbystatusGetSecurityInfo1](#petfindbystatusgetsecurityinfo1)
SecurityRequirementObjectProvider -| enum | [PetfindbystatusGetSecurityInfo.SecurityIndex](#securityindex)
class that stores a security index | - -## PetfindbystatusGetSecurityInfo1 -implements SecurityRequirementObjectProvider<[SecurityIndex](#securityindex)> - -### Constructor Summary -| Constructor and Description | -| --------------------------- | -| PetfindbystatusGetSecurityInfo1()
Creates an instance | - -### 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 | - -### Method Summary -| Modifier and Type | Method and Description | -| ----------------- | ---------------------- | -| SecurityRequirementObject | getSecurityRequirementObject(@Nullable [SecurityIndex](#securityindex) securityIndex)
If null is input, then the instance's securityIndex will be used | - -## SecurityIndex -enum SecurityIndex
- -### Enum Constant Summary -| Enum Constant And Description | -| ----------------------------- | -| SECURITY_0
security 0 | -| SECURITY_1
security 1 | -| SECURITY_2
security 2 | diff --git a/samples/client/petstore/kotlin/docs/paths/petfindbystatus/get/parameters/parameter0/Schema0.md b/samples/client/petstore/kotlin/docs/paths/petfindbystatus/get/parameters/parameter0/Schema0.md deleted file mode 100644 index cbe534fe3c5..00000000000 --- a/samples/client/petstore/kotlin/docs/paths/petfindbystatus/get/parameters/parameter0/Schema0.md +++ /dev/null @@ -1,206 +0,0 @@ -# Schema0 -public class Schema0
- -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 list payloads, extends FrozenList -- classes to build inputs for list payloads -- enum classes - -## Nested Class Summary -| Modifier and Type | Class and Description | -| ----------------- | ---------------------- | -| sealed interface | [Schema0.Schema01Boxed](#schema01boxed)
sealed interface for validated payloads | -| record | [Schema0.Schema01BoxedList](#schema01boxedlist)
boxed class to store validated List payloads | -| static class | [Schema0.Schema01](#schema01)
schema class | -| static class | [Schema0.SchemaListBuilder0](#schemalistbuilder0)
builder for List payloads | -| static class | [Schema0.SchemaList0](#schemalist0)
output class for List payloads | -| sealed interface | [Schema0.Items0Boxed](#items0boxed)
sealed interface for validated payloads | -| record | [Schema0.Items0BoxedString](#items0boxedstring)
boxed class to store validated String payloads | -| static class | [Schema0.Items0](#items0)
schema class | -| enum | [Schema0.StringItemsEnums0](#stringitemsenums0)
String enum | - -## Schema01Boxed -public sealed interface Schema01Boxed
-permits
-[Schema01BoxedList](#schema01boxedlist) - -sealed interface that stores validated payloads using boxed classes - -## Schema01BoxedList -public record Schema01BoxedList
-implements [Schema01Boxed](#schema01boxed) - -record that stores validated List payloads, sealed permits implementation - -### Constructor Summary -| Constructor and Description | -| --------------------------- | -| Schema01BoxedList([SchemaList0](#schemalist0) data)
Creates an instance, private visibility | - -### Method Summary -| Modifier and Type | Method and Description | -| ----------------- | ---------------------- | -| [SchemaList0](#schemalist0) | data()
validated payload | -| @Nullable Object | getData()
validated payload | - -## Schema01 -public static class Schema01
-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.get.parameters.parameter0.Schema0; - -import java.util.Arrays; -import java.util.List; -import java.util.AbstractMap; - -static final SchemaConfiguration configuration = new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().build()); - -// List validation -Schema0.SchemaList0 validatedPayload = - Schema0.Schema01.validate( - new Schema0.SchemaListBuilder0() - .add("available") - - .build(), - configuration -); -``` - -### Field Summary -| Modifier and Type | Field and Description | -| ----------------- | ---------------------- | -| Set> | type = Set.of(List.class) | -| Class | items = [Items0.class](#items0) | - -### Method Summary -| Modifier and Type | Method and Description | -| ----------------- | ---------------------- | -| [SchemaList0](#schemalist0) | validate([List](#schemalistbuilder0) arg, SchemaConfiguration configuration) | -| [Schema01BoxedList](#schema01boxedlist) | validateAndBox([List](#schemalistbuilder0) arg, SchemaConfiguration configuration) | -| [Schema01Boxed](#schema01boxed) | validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) | -| @Nullable Object | validate(@Nullable Object arg, SchemaConfiguration configuration) | - -## SchemaListBuilder0 -public class SchemaListBuilder0
-builder for `List` - -A class that builds the List input type - -### Constructor Summary -| Constructor and Description | -| --------------------------- | -| SchemaListBuilder0()
Creates an empty list | -| SchemaListBuilder0(List items)
Stores the items in a list | - -### Method Summary -| Modifier and Type | Method and Description | -| ----------------- | ---------------------- | -| SchemaListBuilder0 | add(String item) | -| SchemaListBuilder0 | add([StringItemsEnums0](#stringitemsenums0) item) | -| List | build()
Returns list input that should be used with Schema.validate | - -## SchemaList0 -public class SchemaList0
-extends `FrozenList` - -A class to store validated List payloads - -### Method Summary -| Modifier and Type | Method and Description | -| ----------------- | ---------------------- | -| static [SchemaList0](#schemalist0) | of([List](#schemalistbuilder0) arg, SchemaConfiguration configuration) | - -## Items0Boxed -public sealed interface Items0Boxed
-permits
-[Items0BoxedString](#items0boxedstring) - -sealed interface that stores validated payloads using boxed classes - -## Items0BoxedString -public record Items0BoxedString
-implements [Items0Boxed](#items0boxed) - -record that stores validated String payloads, sealed permits implementation - -### Constructor Summary -| Constructor and Description | -| --------------------------- | -| Items0BoxedString(String data)
Creates an instance, private visibility | - -### Method Summary -| Modifier and Type | Method and Description | -| ----------------- | ---------------------- | -| String | data()
validated payload | -| @Nullable Object | getData()
validated payload | - -## Items0 -public static class Items0
-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.get.parameters.parameter0.Schema0; - -import java.util.Arrays; -import java.util.List; -import java.util.AbstractMap; - -static final SchemaConfiguration configuration = new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().build()); - -// String validation -String validatedPayload = Schema0.Items0.validate( - "available", - configuration -); -``` - -### Field Summary -| Modifier and Type | Field and Description | -| ----------------- | ---------------------- | -| Set> | type = Set.of(
    String.class
)
| -| Set | enumValues = SetMaker.makeSet(
    "available",
    "pending",
    "sold"
)
| -| @Nullable Object | defaultValue = "available" | - -### Method Summary -| Modifier and Type | Method and Description | -| ----------------- | ---------------------- | -| String | validate(String arg, SchemaConfiguration configuration) | -| String | validate([StringItemsEnums0](#stringitemsenums0) arg, SchemaConfiguration configuration) | -| [Items0BoxedString](#items0boxedstring) | validateAndBox(String arg, SchemaConfiguration configuration) | -| [Items0Boxed](#items0boxed) | validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) | -| @Nullable Object | validate(@Nullable Object arg, SchemaConfiguration configuration) | - -## StringItemsEnums0 -public enum StringItemsEnums0
-extends `Enum` - -A class that stores String enum values - -### Enum Constant Summary -| Enum Constant | Description | -| ------------- | ----------- | -| AVAILABLE | value = "available" | -| PENDING | value = "pending" | -| SOLD | value = "sold" | diff --git a/samples/client/petstore/kotlin/docs/paths/petfindbystatus/get/responses/PetfindbystatusGetCode200Response.md b/samples/client/petstore/kotlin/docs/paths/petfindbystatus/get/responses/PetfindbystatusGetCode200Response.md deleted file mode 100644 index a6a3459b37a..00000000000 --- a/samples/client/petstore/kotlin/docs/paths/petfindbystatus/get/responses/PetfindbystatusGetCode200Response.md +++ /dev/null @@ -1,17 +0,0 @@ -# PetfindbystatusGetCode200Response - -public class PetfindbystatusGetCode200Response extends [SuccessfulXmlAndJsonArrayOfPet](../../components/responses/SuccessfulXmlAndJsonArrayOfPet.md) - -A class (extended from the $ref class) that contains necessary nested response classes -- a class that extends ResponseDeserializer and is used to deserialize responses - -## Nested Class Summary -| Modifier and Type | Class and Description | -| ----------------- | --------------------- | -| static class | [PetfindbystatusGetCode200Response.PetfindbystatusGetCode200Response1](#petfindbystatusgetcode200response1)
class that deserializes responses | - -## PetfindbystatusGetCode200Response1 -public static class PetfindbystatusGetCode200Response1 extends [SuccessfulXmlAndJsonArrayOfPet1](../../components/responses/SuccessfulXmlAndJsonArrayOfPet.md#successfulxmlandjsonarrayofpet1)
- -a class that deserializes responses, extended from the $ref class - diff --git a/samples/client/petstore/kotlin/docs/paths/petfindbystatus/get/responses/PetfindbystatusGetCode400Response.md b/samples/client/petstore/kotlin/docs/paths/petfindbystatus/get/responses/PetfindbystatusGetCode400Response.md deleted file mode 100644 index 9ef759215f9..00000000000 --- a/samples/client/petstore/kotlin/docs/paths/petfindbystatus/get/responses/PetfindbystatusGetCode400Response.md +++ /dev/null @@ -1,32 +0,0 @@ -# PetfindbystatusGetCode400Response - -public class PetfindbystatusGetCode400Response - -A class that contains necessary nested response classes -- a class that extends ResponseDeserializer and is used to deserialize responses - -## Nested Class Summary -| Modifier and Type | Class and Description | -| ----------------- | --------------------- | -| static class | [PetfindbystatusGetCode400Response.PetfindbystatusGetCode400Response1](#petfindbystatusgetcode400response1)
class that deserializes responses | - -## PetfindbystatusGetCode400Response1 -public static class PetfindbystatusGetCode400Response1
-extends ResponseDeserializer - -a class that deserializes responses - -### Constructor Summary -| Constructor and Description | -| --------------------------- | -| PetfindbystatusGetCode400Response1()
Creates an instance | - -### Field Summary -| Modifier and Type | Field and Description | -| ----------------- | --------------------- | -| Map | content = MapUtils.makeMap(
)
the contentType to schema info | - -### Method Summary -| Modifier and Type | Method and Description | -| ----------------- | ---------------------- | -| ApiResponse | deserialize(HttpResponse response, SchemaConfiguration configuration)
called by endpoint when deserialize responses | diff --git a/samples/client/petstore/kotlin/docs/paths/petfindbystatus/get/security/PetfindbystatusGetSecurityRequirementObject0.md b/samples/client/petstore/kotlin/docs/paths/petfindbystatus/get/security/PetfindbystatusGetSecurityRequirementObject0.md deleted file mode 100644 index 608eb248028..00000000000 --- a/samples/client/petstore/kotlin/docs/paths/petfindbystatus/get/security/PetfindbystatusGetSecurityRequirementObject0.md +++ /dev/null @@ -1,15 +0,0 @@ -# PetfindbystatusGetSecurityRequirementObject0 -PetfindbystatusGetSecurityRequirementObject0.java - -public class PetfindbystatusGetSecurityRequirementObject0 -extends SecurityRequirementObject - -### Constructor Summary -| Constructor and Description | -| --------------------------- | -| PetfindbystatusGetSecurityRequirementObject0()
Creates an instance | - -### 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()
    )) | diff --git a/samples/client/petstore/kotlin/docs/paths/petfindbystatus/get/security/PetfindbystatusGetSecurityRequirementObject1.md b/samples/client/petstore/kotlin/docs/paths/petfindbystatus/get/security/PetfindbystatusGetSecurityRequirementObject1.md deleted file mode 100644 index 6749160f760..00000000000 --- a/samples/client/petstore/kotlin/docs/paths/petfindbystatus/get/security/PetfindbystatusGetSecurityRequirementObject1.md +++ /dev/null @@ -1,15 +0,0 @@ -# PetfindbystatusGetSecurityRequirementObject1 -PetfindbystatusGetSecurityRequirementObject1.java - -public class PetfindbystatusGetSecurityRequirementObject1 -extends SecurityRequirementObject - -### Constructor Summary -| Constructor and Description | -| --------------------------- | -| PetfindbystatusGetSecurityRequirementObject1()
Creates an instance | - -### 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()
    )) | diff --git a/samples/client/petstore/kotlin/docs/paths/petfindbystatus/get/security/PetfindbystatusGetSecurityRequirementObject2.md b/samples/client/petstore/kotlin/docs/paths/petfindbystatus/get/security/PetfindbystatusGetSecurityRequirementObject2.md deleted file mode 100644 index 7f0527ce9f7..00000000000 --- a/samples/client/petstore/kotlin/docs/paths/petfindbystatus/get/security/PetfindbystatusGetSecurityRequirementObject2.md +++ /dev/null @@ -1,15 +0,0 @@ -# PetfindbystatusGetSecurityRequirementObject2 -PetfindbystatusGetSecurityRequirementObject2.java - -public class PetfindbystatusGetSecurityRequirementObject2 -extends SecurityRequirementObject - -### Constructor Summary -| Constructor and Description | -| --------------------------- | -| PetfindbystatusGetSecurityRequirementObject2()
Creates an instance | - -### 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")
    )) | diff --git a/samples/client/petstore/kotlin/docs/paths/petfindbystatus/servers/PetfindbystatusServer0.md b/samples/client/petstore/kotlin/docs/paths/petfindbystatus/servers/PetfindbystatusServer0.md deleted file mode 100644 index 475550269b3..00000000000 --- a/samples/client/petstore/kotlin/docs/paths/petfindbystatus/servers/PetfindbystatusServer0.md +++ /dev/null @@ -1,14 +0,0 @@ -# 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/kotlin/docs/paths/petfindbystatus/servers/PetfindbystatusServer1.md b/samples/client/petstore/kotlin/docs/paths/petfindbystatus/servers/PetfindbystatusServer1.md deleted file mode 100644 index 66dbb2170be..00000000000 --- a/samples/client/petstore/kotlin/docs/paths/petfindbystatus/servers/PetfindbystatusServer1.md +++ /dev/null @@ -1,16 +0,0 @@ -# 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([PetfindbystatusServer1Variables.VariablesMap](../../../paths/petfindbystatus/servers/server1/PetfindbystatusServer1Variables.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}" | -| [PetfindbystatusServer1Variables.VariablesMap](../../../paths/petfindbystatus/servers/server1/PetfindbystatusServer1Variables.md#variablesmap) | variables | diff --git a/samples/client/petstore/kotlin/docs/paths/petfindbystatus/servers/server1/PetfindbystatusServer1Variables.md b/samples/client/petstore/kotlin/docs/paths/petfindbystatus/servers/server1/PetfindbystatusServer1Variables.md deleted file mode 100644 index df668b94ef7..00000000000 --- a/samples/client/petstore/kotlin/docs/paths/petfindbystatus/servers/server1/PetfindbystatusServer1Variables.md +++ /dev/null @@ -1,355 +0,0 @@ -# PetfindbystatusServer1Variables -public class PetfindbystatusServer1Variables
- -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 | [PetfindbystatusServer1Variables.PetfindbystatusServer1Variables1Boxed](#petfindbystatusserver1variables1boxed)
sealed interface for validated payloads | -| record | [PetfindbystatusServer1Variables.PetfindbystatusServer1Variables1BoxedMap](#petfindbystatusserver1variables1boxedmap)
boxed class to store validated Map payloads | -| static class | [PetfindbystatusServer1Variables.PetfindbystatusServer1Variables1](#petfindbystatusserver1variables1)
schema class | -| static class | [PetfindbystatusServer1Variables.VariablesMapBuilder](#variablesmapbuilder)
builder for Map payloads | -| static class | [PetfindbystatusServer1Variables.VariablesMap](#variablesmap)
output class for Map payloads | -| sealed interface | [PetfindbystatusServer1Variables.VersionBoxed](#versionboxed)
sealed interface for validated payloads | -| record | [PetfindbystatusServer1Variables.VersionBoxedString](#versionboxedstring)
boxed class to store validated String payloads | -| static class | [PetfindbystatusServer1Variables.Version](#version)
schema class | -| enum | [PetfindbystatusServer1Variables.StringVersionEnums](#stringversionenums)
String enum | -| sealed interface | [PetfindbystatusServer1Variables.AdditionalPropertiesBoxed](#additionalpropertiesboxed)
sealed interface for validated payloads | -| record | [PetfindbystatusServer1Variables.AdditionalPropertiesBoxedVoid](#additionalpropertiesboxedvoid)
boxed class to store validated null payloads | -| record | [PetfindbystatusServer1Variables.AdditionalPropertiesBoxedBoolean](#additionalpropertiesboxedboolean)
boxed class to store validated boolean payloads | -| record | [PetfindbystatusServer1Variables.AdditionalPropertiesBoxedNumber](#additionalpropertiesboxednumber)
boxed class to store validated Number payloads | -| record | [PetfindbystatusServer1Variables.AdditionalPropertiesBoxedString](#additionalpropertiesboxedstring)
boxed class to store validated String payloads | -| record | [PetfindbystatusServer1Variables.AdditionalPropertiesBoxedList](#additionalpropertiesboxedlist)
boxed class to store validated List payloads | -| record | [PetfindbystatusServer1Variables.AdditionalPropertiesBoxedMap](#additionalpropertiesboxedmap)
boxed class to store validated Map payloads | -| static class | [PetfindbystatusServer1Variables.AdditionalProperties](#additionalproperties)
schema class | - -## PetfindbystatusServer1Variables1Boxed -public sealed interface PetfindbystatusServer1Variables1Boxed
-permits
-[PetfindbystatusServer1Variables1BoxedMap](#petfindbystatusserver1variables1boxedmap) - -sealed interface that stores validated payloads using boxed classes - -## PetfindbystatusServer1Variables1BoxedMap -public record PetfindbystatusServer1Variables1BoxedMap
-implements [PetfindbystatusServer1Variables1Boxed](#petfindbystatusserver1variables1boxed) - -record that stores validated Map payloads, sealed permits implementation - -### Constructor Summary -| Constructor and Description | -| --------------------------- | -| PetfindbystatusServer1Variables1BoxedMap([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 | - -## PetfindbystatusServer1Variables1 -public static class PetfindbystatusServer1Variables1
-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.PetfindbystatusServer1Variables; - -import java.util.Arrays; -import java.util.List; -import java.util.AbstractMap; - -static final SchemaConfiguration configuration = new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().build()); - -// Map validation -PetfindbystatusServer1Variables.VariablesMap validatedPayload = - PetfindbystatusServer1Variables.PetfindbystatusServer1Variables1.validate( - new PetfindbystatusServer1Variables.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) | -| [PetfindbystatusServer1Variables1BoxedMap](#petfindbystatusserver1variables1boxedmap) | validateAndBox([Map<?, ?>](#variablesmapbuilder) arg, SchemaConfiguration configuration) | -| [PetfindbystatusServer1Variables1Boxed](#petfindbystatusserver1variables1boxed) | 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.PetfindbystatusServer1Variables; - -import java.util.Arrays; -import java.util.List; -import java.util.AbstractMap; - -static final SchemaConfiguration configuration = new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().build()); - -// String validation -String validatedPayload = PetfindbystatusServer1Variables.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(Nothing? data)
Creates an instance, private visibility | - -### Method Summary -| Modifier and Type | Method and Description | -| ----------------- | ---------------------- | -| Nothing? | 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/kotlin/docs/paths/petfindbytags/PetfindbytagsGet.md b/samples/client/petstore/kotlin/docs/paths/petfindbytags/PetfindbytagsGet.md deleted file mode 100644 index 2053c4b2596..00000000000 --- a/samples/client/petstore/kotlin/docs/paths/petfindbytags/PetfindbytagsGet.md +++ /dev/null @@ -1,206 +0,0 @@ -# PetfindbytagsGet - -public class PetfindbytagsGet - -A class that contains necessary endpoint classes -- a class that calls the endpoint method using the http verb -- a class that calls the endpoint method using the operationId name -- class(es) to store the request inputs -- builder(s) to set the request input data - -## Nested Class Summary -| Modifier and Type | Class and Description | -| ----------------- | --------------------- | -| static class | [Get](#get)
The class that has a get method to call the endpoint | -| interface | [FindPetsByTagsOperation](#findpetsbytagsoperation)
The interface that has a findPetsByTags method to call the endpoint | -| static class | [GetRequest](#getrequest)
The final request inputs class | -| static class | [GetNullableRequest](#getnullablerequest)
The initial request inputs class | -| static class | [Get0RequestBuilder](#get0requestbuilder)
A builder for the request input class | -| static class | [GetRequestBuilder](#getrequestbuilder)
A builder for the request input class | - -## Get -public static class Get extends ApiClient.ApiClient1 implements GetOperation
- -a class that allows one to call the endpoint using a method named get - -### 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.petfindbytags.get.PetfindbytagsGetSecurityInfo; -import org.openapijsonschematools.client.paths.petfindbytags.get.PetfindbytagsGetQueryParameters; -import org.openapijsonschematools.client.servers.RootServer0; -import org.openapijsonschematools.client.servers.RootServer1; -import org.openapijsonschematools.client.servers.RootServer2; -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.PetfindbytagsGetCode200Response; -import org.openapijsonschematools.client.paths.petfindbytags.get.responses.PetfindbytagsGetCode400Response; -import org.openapijsonschematools.client.servers.RootServerInfo; -import org.openapijsonschematools.client.paths.petfindbytags.PetfindbytagsGet; -import org.openapijsonschematools.client.paths.petfindbytags.get.PetfindbytagsGetResponses; - -import java.io.IOException; -import java.util.Arrays; -import java.util.List; -import java.util.Map; -import java.util.AbstractMap; - -// if you want to use a server that is not SERVER_0 pass it in here and change the ServerIndex input below -ApiConfiguration.ServerInfo serverInfo = new ApiConfiguration.ServerInfoBuilder() - .rootServerInfo( - new RootServerInfo.RootServerInfoBuilder() - .rootServer0(new RootServer0()) - .build() - ) - .build(); -ApiConfiguration.ServerIndexInfo serverIndexInfo = new ApiConfiguration.ServerIndexInfoBuilder() - .rootServerInfoServerIndex(RootServerInfo.ServerIndex.SERVER_0) - .build(); -List securitySchemes = new ArrayList(); -ApiConfiguration.SecurityIndexInfo securityIndexInfo = new ApiConfiguration.SecurityIndexInfoBuilder() - .petfindbytagsGetSecurityRequirementObject0SecurityIndex(PetfindbytagsGetSecurityRequirementObject0.SecurityIndex.SECURITY_0) - .build(); -Duration timeout = Duration.ofSeconds(1L); -Map> defaultHeaders = Map.of("User-Agent", List.of("OpenAPI-JSON-Schema-Generator/1.0.0/java")); -ApiConfiguration apiConfiguration = new ApiConfiguration( - serverInfo - serverIndexInfo, - securitySchemes, - securityIndexInfo, - timeout, - defaultHeaders -); -SchemaConfiguration schemaConfiguration = new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().build()); -PetfindbytagsGet.Get apiClient = new PetfindbytagsGet.Get(apiConfiguration, schemaConfiguration); - - -// Map validation -PetfindbytagsGetQueryParameters.QueryParametersMap queryParameters = - PetfindbytagsGetQueryParameters.PetfindbytagsGetQueryParameters1.validate( - new PetfindbytagsGetQueryParameters.QueryParametersMapBuilder() - .tags( - Arrays.asList( - "a" - ) - ) - .build(), - schemaConfiguration -); - -var request = new PetfindbytagsGet.GetRequestBuilder() - .queryParameters(queryParameters) - .build(); - -PetfindbytagsGetResponses.EndpointResponse response; -try { - response = apiClient.get(request); -} catch (PetfindbytagsGetCode400Response.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; -} -PetfindbytagsGetResponses.EndpointPetfindbytagsGetCode200Response castResponse = (PetfindbytagsGetResponses.EndpointPetfindbytagsGetCode200Response) response; -} -``` -### Constructor Summary -| Constructor and Description | -| --------------------------- | -| Get(ApiConfiguration apiConfiguration, SchemaConfiguration schemaConfiguration)
Creates an instance | - -### Method Summary -| Modifier and Type | Method and Description | -| ----------------- | ---------------------- | -| [PetfindbytagsGetResponses.EndpointResponse](../../paths/petfindbytags/get/PetfindbytagsGetResponses.md#endpointresponse) | get([GetRequest](#getrequest) request) | - -## FindPetsByTagsOperation -public interface FindPetsByTagsOperation
- -an interface that allows one to call the endpoint using a method named findPetsByTags by the operationId - -### Method Summary -| Modifier and Type | Method and Description | -| ----------------- | ---------------------- | -| [PetfindbytagsGetResponses.EndpointResponse](../../paths/petfindbytags/get/PetfindbytagsGetResponses.md#endpointresponse) | findPetsByTags([GetRequest](#getrequest) request) | - -## GetRequest -public static class GetRequest
- -a class that stores the final request inputs - -### Field Summary -| Modifier and Type | Field and Description | -| ----------------- | --------------------- | -| [PetfindbytagsGetQueryParameters.QueryParametersMap](../../paths/petfindbytags/get/PetfindbytagsGetQueryParameters.md#queryparametersmap) | queryParameters | -| [RootServerInfo.@Nullable ServerIndex](../../RootServerInfo.md#serverindex) | serverIndex
optional. Note: this will override the value in apiConfiguration | -| [PetfindbytagsGetSecurityInfo.@Nullable SecurityIndex](../../paths/petfindbytags/get/PetfindbytagsGetSecurityInfo.md#securityindex) | securityIndex
optional. Note: this will override the value in apiConfiguration | -| @Nullable Duration | timeout
optional. Note: this will override the value in apiConfiguration | - -## GetNullableRequest -public static class GetNullableRequest
- -a class that stores the initial request inputs - -### Field Summary -| Modifier and Type | Field and Description | -| ----------------- | --------------------- | -| [PetfindbytagsGetQueryParameters.@Nullable QueryParametersMap](../../paths/petfindbytags/get/PetfindbytagsGetQueryParameters.md#queryparametersmap) | queryParameters | -| [RootServerInfo.@Nullable ServerIndex](../../RootServerInfo.md#serverindex) | serverIndex | -| [PetfindbytagsGetSecurityInfo.@Nullable SecurityIndex](../../paths/petfindbytags/get/PetfindbytagsGetSecurityInfo.md#securityindex) | securityIndex | -| @Nullable Duration | timeout | - -## Get0RequestBuilder -public static class Get0RequestBuilder
- -a builder for request inputs - -### Constructor Summary -| Constructor and Description | -| --------------------------- | -| Get0RequestBuilder(Get0RequestBuilder instance)
Creates a builder that contains the passed instance | - -### Method Summary -| Modifier and Type | Method and Description | -| ----------------- | ---------------------- | -| [GetRequest](#getrequest) | build()
Returns the request input used to call an endpoint method | -| [Get0RequestBuilder](#get0requestbuilder) | serverIndex([RootServerInfo.ServerIndex](../../RootServerInfo.md#serverindex) serverIndex)
sets the optional property. Note: this will override the value in apiConfiguration | -| [Get0RequestBuilder](#get0requestbuilder) | securityIndex([PetfindbytagsGetSecurityInfo.SecurityIndex](../../paths/petfindbytags/get/PetfindbytagsGetSecurityInfo.md#securityindex) securityIndex)
sets the optional property. Note: this will override the value in apiConfiguration | -| [Get0RequestBuilder](#get0requestbuilder) | timeout(Duration timeout)
sets the optional property. Note: this will override the value in apiConfiguration | - -## GetRequestBuilder -public static class GetRequestBuilder
- -a builder for request inputs - -### Constructor Summary -| Constructor and Description | -| --------------------------- | -| GetRequestBuilder()
Creates a builder that contains null for all parameters | - -### Method Summary -| Modifier and Type | Method and Description | -| ----------------- | ---------------------- | -| [Get0RequestBuilder](#get0requestbuilder) | queryParameters([PetfindbytagsGetQueryParametersQueryParametersMap](../../paths/petfindbytags/get/PetfindbytagsGetQueryParameters.md#queryparametersmap) queryParameters)
sets the property | - -[[Back to top]](#top) [[Back to README]](../../../README.md) diff --git a/samples/client/petstore/kotlin/docs/paths/petfindbytags/get/PetfindbytagsGetQueryParameters.md b/samples/client/petstore/kotlin/docs/paths/petfindbytags/get/PetfindbytagsGetQueryParameters.md deleted file mode 100644 index b879671fc74..00000000000 --- a/samples/client/petstore/kotlin/docs/paths/petfindbytags/get/PetfindbytagsGetQueryParameters.md +++ /dev/null @@ -1,271 +0,0 @@ -# PetfindbytagsGetQueryParameters -public class PetfindbytagsGetQueryParameters
- -A class that contains necessary nested -- schema classes (which validate payloads), extends JsonSchema -- sealed interfaces which store validated payloads, java version of a sum type -- boxed classes which store validated payloads, sealed permits class implementations -- classes to store validated map payloads, extends FrozenMap -- classes to build inputs for map payloads - -## Nested Class Summary -| Modifier and Type | Class and Description | -| ----------------- | ---------------------- | -| sealed interface | [PetfindbytagsGetQueryParameters.PetfindbytagsGetQueryParameters1Boxed](#petfindbytagsgetqueryparameters1boxed)
sealed interface for validated payloads | -| record | [PetfindbytagsGetQueryParameters.PetfindbytagsGetQueryParameters1BoxedMap](#petfindbytagsgetqueryparameters1boxedmap)
boxed class to store validated Map payloads | -| static class | [PetfindbytagsGetQueryParameters.PetfindbytagsGetQueryParameters1](#petfindbytagsgetqueryparameters1)
schema class | -| static class | [PetfindbytagsGetQueryParameters.QueryParametersMapBuilder](#queryparametersmapbuilder)
builder for Map payloads | -| static class | [PetfindbytagsGetQueryParameters.QueryParametersMap](#queryparametersmap)
output class for Map payloads | -| sealed interface | [PetfindbytagsGetQueryParameters.AdditionalPropertiesBoxed](#additionalpropertiesboxed)
sealed interface for validated payloads | -| record | [PetfindbytagsGetQueryParameters.AdditionalPropertiesBoxedVoid](#additionalpropertiesboxedvoid)
boxed class to store validated null payloads | -| record | [PetfindbytagsGetQueryParameters.AdditionalPropertiesBoxedBoolean](#additionalpropertiesboxedboolean)
boxed class to store validated boolean payloads | -| record | [PetfindbytagsGetQueryParameters.AdditionalPropertiesBoxedNumber](#additionalpropertiesboxednumber)
boxed class to store validated Number payloads | -| record | [PetfindbytagsGetQueryParameters.AdditionalPropertiesBoxedString](#additionalpropertiesboxedstring)
boxed class to store validated String payloads | -| record | [PetfindbytagsGetQueryParameters.AdditionalPropertiesBoxedList](#additionalpropertiesboxedlist)
boxed class to store validated List payloads | -| record | [PetfindbytagsGetQueryParameters.AdditionalPropertiesBoxedMap](#additionalpropertiesboxedmap)
boxed class to store validated Map payloads | -| static class | [PetfindbytagsGetQueryParameters.AdditionalProperties](#additionalproperties)
schema class | - -## PetfindbytagsGetQueryParameters1Boxed -public sealed interface PetfindbytagsGetQueryParameters1Boxed
-permits
-[PetfindbytagsGetQueryParameters1BoxedMap](#petfindbytagsgetqueryparameters1boxedmap) - -sealed interface that stores validated payloads using boxed classes - -## PetfindbytagsGetQueryParameters1BoxedMap -public record PetfindbytagsGetQueryParameters1BoxedMap
-implements [PetfindbytagsGetQueryParameters1Boxed](#petfindbytagsgetqueryparameters1boxed) - -record that stores validated Map payloads, sealed permits implementation - -### Constructor Summary -| Constructor and Description | -| --------------------------- | -| PetfindbytagsGetQueryParameters1BoxedMap([QueryParametersMap](#queryparametersmap) data)
Creates an instance, private visibility | - -### Method Summary -| Modifier and Type | Method and Description | -| ----------------- | ---------------------- | -| [QueryParametersMap](#queryparametersmap) | data()
validated payload | -| @Nullable Object | getData()
validated payload | - -## PetfindbytagsGetQueryParameters1 -public static class PetfindbytagsGetQueryParameters1
-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.petfindbytags.get.PetfindbytagsGetQueryParameters; - -import java.util.Arrays; -import java.util.List; -import java.util.AbstractMap; - -static final SchemaConfiguration configuration = new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().build()); - -// Map validation -PetfindbytagsGetQueryParameters.QueryParametersMap validatedPayload = - PetfindbytagsGetQueryParameters.PetfindbytagsGetQueryParameters1.validate( - new PetfindbytagsGetQueryParameters.QueryParametersMapBuilder() - .tags( - Arrays.asList( - "a" - ) - ) - .build(), - configuration -); -``` - -### Field Summary -| Modifier and Type | Field and Description | -| ----------------- | ---------------------- | -| Set> | type = Set.of(Map.class) | -| Map> | properties = Map.ofEntries(
    new PropertyEntry("tags", [Schema0.Schema01.class](../../../paths/petfindbytags/get/parameters/parameter0/Schema0.md#schema01))
)
| -| Set | required = Set.of(
    "tags"
)
| -| Class | additionalProperties = [AdditionalProperties.class](#additionalproperties) | - -### Method Summary -| Modifier and Type | Method and Description | -| ----------------- | ---------------------- | -| [QueryParametersMap](#queryparametersmap) | validate([Map<?, ?>](#queryparametersmapbuilder) arg, SchemaConfiguration configuration) | -| [PetfindbytagsGetQueryParameters1BoxedMap](#petfindbytagsgetqueryparameters1boxedmap) | validateAndBox([Map<?, ?>](#queryparametersmapbuilder) arg, SchemaConfiguration configuration) | -| [PetfindbytagsGetQueryParameters1Boxed](#petfindbytagsgetqueryparameters1boxed) | validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) | -| @Nullable Object | validate(@Nullable Object arg, SchemaConfiguration configuration) | - -## QueryParametersMap0Builder -public class QueryParametersMap0Builder
-builder for `Map>` - -A class that builds the Map input type - -### Constructor Summary -| Constructor and Description | -| --------------------------- | -| QueryParametersMap0Builder(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 | - -## QueryParametersMapBuilder -public class QueryParametersMapBuilder
-builder for `Map>` - -A class that builds the Map input type - -### Constructor Summary -| Constructor and Description | -| --------------------------- | -| QueryParametersMapBuilder()
Creates a builder that contains an empty map | - -### Method Summary -| Modifier and Type | Method and Description | -| ----------------- | ---------------------- | -| [QueryParametersMap0Builder](#queryparametersmap0builder) | tags(List value) | - -## QueryParametersMap -public static class QueryParametersMap
-extends FrozenMap - -A class to store validated Map payloads - -### Method Summary -| Modifier and Type | Method and Description | -| ----------------- | ---------------------- | -| static [QueryParametersMap](#queryparametersmap) | of([Map>](#queryparametersmapbuilder) arg, SchemaConfiguration configuration) | -| [Schema0.SchemaList0](../../../paths/petfindbytags/get/parameters/parameter0/Schema0.md#schemalist0) | tags()
| - -## 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(Nothing? data)
Creates an instance, private visibility | - -### Method Summary -| Modifier and Type | Method and Description | -| ----------------- | ---------------------- | -| Nothing? | 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/kotlin/docs/paths/petfindbytags/get/PetfindbytagsGetResponses.md b/samples/client/petstore/kotlin/docs/paths/petfindbytags/get/PetfindbytagsGetResponses.md deleted file mode 100644 index bbad709d795..00000000000 --- a/samples/client/petstore/kotlin/docs/paths/petfindbytags/get/PetfindbytagsGetResponses.md +++ /dev/null @@ -1,29 +0,0 @@ -# PetfindbytagsGetResponses - -public class PetfindbytagsGetResponses - -A class that contains necessary responses classes -- a sealed interface, EndpointResponse, that stores endpoint responses -- records for each endpoint response - -## Nested Class Summary -| Modifier and Type | Class and Description | -| ----------------- | --------------------- | -| sealed interface | [EndpointResponse](#endpointresponse)
stores the endpoint responses | -| record | [EndpointPetfindbytagsGetCode200Response](#endpointpetfindbytagsgetcode200response)
the response for 200 | - -## EndpointResponse -public sealed interface EndpointResponse permits
-[EndpointPetfindbytagsGetCode200Response](#endpointpetfindbytagsgetcode200response) - -a sealed interface that stores endpoint responses - -## EndpointPetfindbytagsGetCode200Response -public record EndpointPetfindbytagsGetCode200Response( - HttpResponse response, - [PetfindbytagsGetCode200Response.SealedResponseBody](../../../paths/petfindbytags/get/responses/PetfindbytagsGetCode200Response.md#sealedresponsebody) body, - Nothing? headers -) implements EndpointResponse, ApiResponse
- -a class that stores an endpoint response - diff --git a/samples/client/petstore/kotlin/docs/paths/petfindbytags/get/PetfindbytagsGetSecurityInfo.md b/samples/client/petstore/kotlin/docs/paths/petfindbytags/get/PetfindbytagsGetSecurityInfo.md deleted file mode 100644 index ea6339e8f26..00000000000 --- a/samples/client/petstore/kotlin/docs/paths/petfindbytags/get/PetfindbytagsGetSecurityInfo.md +++ /dev/null @@ -1,42 +0,0 @@ -# PetfindbytagsGetSecurityInfo -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 -- an enum class that describes security index values - -## Nested Class Summary -| Modifier and Type | Class and Description | -| ----------------- | --------------------- | -| static class | [PetfindbytagsGetSecurityInfo.PetfindbytagsGetSecurityInfo1](#petfindbytagsgetsecurityinfo1)
SecurityRequirementObjectProvider -| enum | [PetfindbytagsGetSecurityInfo.SecurityIndex](#securityindex)
class that stores a security index | - -## PetfindbytagsGetSecurityInfo1 -implements SecurityRequirementObjectProvider<[SecurityIndex](#securityindex)> - -### Constructor Summary -| Constructor and Description | -| --------------------------- | -| PetfindbytagsGetSecurityInfo1()
Creates an instance | - -### Field Summary -| Modifier and Type | Field and Description | -| ----------------- | --------------------- | -| [PetfindbytagsGetSecurityRequirementObject0](../../../paths/petfindbytags/get/security/PetfindbytagsGetSecurityRequirementObject0.md) | security0 | -| [PetfindbytagsGetSecurityRequirementObject1](../../../paths/petfindbytags/get/security/PetfindbytagsGetSecurityRequirementObject1.md) | security1 | - -### Method Summary -| Modifier and Type | Method and Description | -| ----------------- | ---------------------- | -| SecurityRequirementObject | getSecurityRequirementObject(@Nullable [SecurityIndex](#securityindex) securityIndex)
If null is input, then the instance's securityIndex will be used | - -## SecurityIndex -enum SecurityIndex
- -### Enum Constant Summary -| Enum Constant And Description | -| ----------------------------- | -| SECURITY_0
security 0 | -| SECURITY_1
security 1 | diff --git a/samples/client/petstore/kotlin/docs/paths/petfindbytags/get/parameters/parameter0/Schema0.md b/samples/client/petstore/kotlin/docs/paths/petfindbytags/get/parameters/parameter0/Schema0.md deleted file mode 100644 index 8c3322c09f9..00000000000 --- a/samples/client/petstore/kotlin/docs/paths/petfindbytags/get/parameters/parameter0/Schema0.md +++ /dev/null @@ -1,156 +0,0 @@ -# Schema0 -public class Schema0
- -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 list payloads, extends FrozenList -- classes to build inputs for list payloads - -## Nested Class Summary -| Modifier and Type | Class and Description | -| ----------------- | ---------------------- | -| sealed interface | [Schema0.Schema01Boxed](#schema01boxed)
sealed interface for validated payloads | -| record | [Schema0.Schema01BoxedList](#schema01boxedlist)
boxed class to store validated List payloads | -| static class | [Schema0.Schema01](#schema01)
schema class | -| static class | [Schema0.SchemaListBuilder0](#schemalistbuilder0)
builder for List payloads | -| static class | [Schema0.SchemaList0](#schemalist0)
output class for List payloads | -| sealed interface | [Schema0.Items0Boxed](#items0boxed)
sealed interface for validated payloads | -| record | [Schema0.Items0BoxedString](#items0boxedstring)
boxed class to store validated String payloads | -| static class | [Schema0.Items0](#items0)
schema class | - -## Schema01Boxed -public sealed interface Schema01Boxed
-permits
-[Schema01BoxedList](#schema01boxedlist) - -sealed interface that stores validated payloads using boxed classes - -## Schema01BoxedList -public record Schema01BoxedList
-implements [Schema01Boxed](#schema01boxed) - -record that stores validated List payloads, sealed permits implementation - -### Constructor Summary -| Constructor and Description | -| --------------------------- | -| Schema01BoxedList([SchemaList0](#schemalist0) data)
Creates an instance, private visibility | - -### Method Summary -| Modifier and Type | Method and Description | -| ----------------- | ---------------------- | -| [SchemaList0](#schemalist0) | data()
validated payload | -| @Nullable Object | getData()
validated payload | - -## Schema01 -public static class Schema01
-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.petfindbytags.get.parameters.parameter0.Schema0; - -import java.util.Arrays; -import java.util.List; -import java.util.AbstractMap; - -static final SchemaConfiguration configuration = new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().build()); - -// List validation -Schema0.SchemaList0 validatedPayload = - Schema0.Schema01.validate( - new Schema0.SchemaListBuilder0() - .add("a") - - .build(), - configuration -); -``` - -### Field Summary -| Modifier and Type | Field and Description | -| ----------------- | ---------------------- | -| Set> | type = Set.of(List.class) | -| Class | items = [Items0.class](#items0) | - -### Method Summary -| Modifier and Type | Method and Description | -| ----------------- | ---------------------- | -| [SchemaList0](#schemalist0) | validate([List](#schemalistbuilder0) arg, SchemaConfiguration configuration) | -| [Schema01BoxedList](#schema01boxedlist) | validateAndBox([List](#schemalistbuilder0) arg, SchemaConfiguration configuration) | -| [Schema01Boxed](#schema01boxed) | validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) | -| @Nullable Object | validate(@Nullable Object arg, SchemaConfiguration configuration) | - -## SchemaListBuilder0 -public class SchemaListBuilder0
-builder for `List` - -A class that builds the List input type - -### Constructor Summary -| Constructor and Description | -| --------------------------- | -| SchemaListBuilder0()
Creates an empty list | -| SchemaListBuilder0(List items)
Stores the items in a list | - -### Method Summary -| Modifier and Type | Method and Description | -| ----------------- | ---------------------- | -| SchemaListBuilder0 | add(String item) | -| List | build()
Returns list input that should be used with Schema.validate | - -## SchemaList0 -public class SchemaList0
-extends `FrozenList` - -A class to store validated List payloads - -### Method Summary -| Modifier and Type | Method and Description | -| ----------------- | ---------------------- | -| static [SchemaList0](#schemalist0) | of([List](#schemalistbuilder0) arg, SchemaConfiguration configuration) | - -## Items0Boxed -public sealed interface Items0Boxed
-permits
-[Items0BoxedString](#items0boxedstring) - -sealed interface that stores validated payloads using boxed classes - -## Items0BoxedString -public record Items0BoxedString
-implements [Items0Boxed](#items0boxed) - -record that stores validated String payloads, sealed permits implementation - -### Constructor Summary -| Constructor and Description | -| --------------------------- | -| Items0BoxedString(String data)
Creates an instance, private visibility | - -### Method Summary -| Modifier and Type | Method and Description | -| ----------------- | ---------------------- | -| String | data()
validated payload | -| @Nullable Object | getData()
validated payload | - -## Items0 -public static class Items0
-extends StringJsonSchema.StringJsonSchema1 - -A schema class that validates payloads - -| Methods Inherited from class org.openapijsonschematools.client.schemas.StringJsonSchema.StringJsonSchema1 | -| ------------------------------------------------------------------ | -| validate | -| validateAndBox | diff --git a/samples/client/petstore/kotlin/docs/paths/petfindbytags/get/responses/PetfindbytagsGetCode200Response.md b/samples/client/petstore/kotlin/docs/paths/petfindbytags/get/responses/PetfindbytagsGetCode200Response.md deleted file mode 100644 index e2de5e1fab7..00000000000 --- a/samples/client/petstore/kotlin/docs/paths/petfindbytags/get/responses/PetfindbytagsGetCode200Response.md +++ /dev/null @@ -1,17 +0,0 @@ -# PetfindbytagsGetCode200Response - -public class PetfindbytagsGetCode200Response extends [RefSuccessfulXmlAndJsonArrayOfPet](../../components/responses/RefSuccessfulXmlAndJsonArrayOfPet.md) - -A class (extended from the $ref class) that contains necessary nested response classes -- a class that extends ResponseDeserializer and is used to deserialize responses - -## Nested Class Summary -| Modifier and Type | Class and Description | -| ----------------- | --------------------- | -| static class | [PetfindbytagsGetCode200Response.PetfindbytagsGetCode200Response1](#petfindbytagsgetcode200response1)
class that deserializes responses | - -## PetfindbytagsGetCode200Response1 -public static class PetfindbytagsGetCode200Response1 extends [RefSuccessfulXmlAndJsonArrayOfPet1](../../components/responses/RefSuccessfulXmlAndJsonArrayOfPet.md#refsuccessfulxmlandjsonarrayofpet1)
- -a class that deserializes responses, extended from the $ref class - diff --git a/samples/client/petstore/kotlin/docs/paths/petfindbytags/get/responses/PetfindbytagsGetCode400Response.md b/samples/client/petstore/kotlin/docs/paths/petfindbytags/get/responses/PetfindbytagsGetCode400Response.md deleted file mode 100644 index eb3a796fd49..00000000000 --- a/samples/client/petstore/kotlin/docs/paths/petfindbytags/get/responses/PetfindbytagsGetCode400Response.md +++ /dev/null @@ -1,32 +0,0 @@ -# PetfindbytagsGetCode400Response - -public class PetfindbytagsGetCode400Response - -A class that contains necessary nested response classes -- a class that extends ResponseDeserializer and is used to deserialize responses - -## Nested Class Summary -| Modifier and Type | Class and Description | -| ----------------- | --------------------- | -| static class | [PetfindbytagsGetCode400Response.PetfindbytagsGetCode400Response1](#petfindbytagsgetcode400response1)
class that deserializes responses | - -## PetfindbytagsGetCode400Response1 -public static class PetfindbytagsGetCode400Response1
-extends ResponseDeserializer - -a class that deserializes responses - -### Constructor Summary -| Constructor and Description | -| --------------------------- | -| PetfindbytagsGetCode400Response1()
Creates an instance | - -### Field Summary -| Modifier and Type | Field and Description | -| ----------------- | --------------------- | -| Map | content = MapUtils.makeMap(
)
the contentType to schema info | - -### Method Summary -| Modifier and Type | Method and Description | -| ----------------- | ---------------------- | -| ApiResponse | deserialize(HttpResponse response, SchemaConfiguration configuration)
called by endpoint when deserialize responses | diff --git a/samples/client/petstore/kotlin/docs/paths/petfindbytags/get/security/PetfindbytagsGetSecurityRequirementObject0.md b/samples/client/petstore/kotlin/docs/paths/petfindbytags/get/security/PetfindbytagsGetSecurityRequirementObject0.md deleted file mode 100644 index 256a672a40f..00000000000 --- a/samples/client/petstore/kotlin/docs/paths/petfindbytags/get/security/PetfindbytagsGetSecurityRequirementObject0.md +++ /dev/null @@ -1,15 +0,0 @@ -# PetfindbytagsGetSecurityRequirementObject0 -PetfindbytagsGetSecurityRequirementObject0.java - -public class PetfindbytagsGetSecurityRequirementObject0 -extends SecurityRequirementObject - -### Constructor Summary -| Constructor and Description | -| --------------------------- | -| PetfindbytagsGetSecurityRequirementObject0()
Creates an instance | - -### 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()
    )) | diff --git a/samples/client/petstore/kotlin/docs/paths/petfindbytags/get/security/PetfindbytagsGetSecurityRequirementObject1.md b/samples/client/petstore/kotlin/docs/paths/petfindbytags/get/security/PetfindbytagsGetSecurityRequirementObject1.md deleted file mode 100644 index 39a130b834f..00000000000 --- a/samples/client/petstore/kotlin/docs/paths/petfindbytags/get/security/PetfindbytagsGetSecurityRequirementObject1.md +++ /dev/null @@ -1,15 +0,0 @@ -# PetfindbytagsGetSecurityRequirementObject1 -PetfindbytagsGetSecurityRequirementObject1.java - -public class PetfindbytagsGetSecurityRequirementObject1 -extends SecurityRequirementObject - -### Constructor Summary -| Constructor and Description | -| --------------------------- | -| PetfindbytagsGetSecurityRequirementObject1()
Creates an instance | - -### 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")
    )) | diff --git a/samples/client/petstore/kotlin/docs/paths/petpetid/PetpetidDelete.md b/samples/client/petstore/kotlin/docs/paths/petpetid/PetpetidDelete.md deleted file mode 100644 index 6c4053692d4..00000000000 --- a/samples/client/petstore/kotlin/docs/paths/petpetid/PetpetidDelete.md +++ /dev/null @@ -1,207 +0,0 @@ -# PetpetidDelete - -public class PetpetidDelete - -A class that contains necessary endpoint classes -- a class that calls the endpoint method using the http verb -- a class that calls the endpoint method using the operationId name -- class(es) to store the request inputs -- builder(s) to set the request input data - -## Nested Class Summary -| Modifier and Type | Class and Description | -| ----------------- | --------------------- | -| static class | [Delete](#delete)
The class that has a delete method to call the endpoint | -| interface | [DeletePetOperation](#deletepetoperation)
The interface that has a deletePet method to call the endpoint | -| static class | [DeleteRequest](#deleterequest)
The final request inputs class | -| static class | [DeleteNullableRequest](#deletenullablerequest)
The initial request inputs class | -| static class | [Delete0RequestBuilder](#delete0requestbuilder)
A builder for the request input class | -| static class | [DeleteRequestBuilder](#deleterequestbuilder)
A builder for the request input class | - -## Delete -public static class Delete extends ApiClient.ApiClient1 implements DeleteOperation
- -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.PetpetidDeleteHeaderParameters; -import org.openapijsonschematools.client.RootServerInfo; -import org.openapijsonschematools.client.paths.petpetid.delete.PetpetidDeleteSecurityInfo; -import org.openapijsonschematools.client.paths.petpetid.delete.PetpetidDeletePathParameters; -import org.openapijsonschematools.client.servers.RootServer0; -import org.openapijsonschematools.client.servers.RootServer1; -import org.openapijsonschematools.client.servers.RootServer2; -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.PetpetidDeleteCode400Response; -import org.openapijsonschematools.client.servers.RootServerInfo; -import org.openapijsonschematools.client.paths.petpetid.PetpetidDelete; -import org.openapijsonschematools.client.paths.petpetid.delete.PetpetidDeleteResponses; - -import java.io.IOException; -import java.util.Arrays; -import java.util.List; -import java.util.Map; -import java.util.AbstractMap; - -// if you want to use a server that is not SERVER_0 pass it in here and change the ServerIndex input below -ApiConfiguration.ServerInfo serverInfo = new ApiConfiguration.ServerInfoBuilder() - .rootServerInfo( - new RootServerInfo.RootServerInfoBuilder() - .rootServer0(new RootServer0()) - .build() - ) - .build(); -ApiConfiguration.ServerIndexInfo serverIndexInfo = new ApiConfiguration.ServerIndexInfoBuilder() - .rootServerInfoServerIndex(RootServerInfo.ServerIndex.SERVER_0) - .build(); -List securitySchemes = new ArrayList(); -securitySchemes.add( - new ApiKey("someApiKey"); -); -ApiConfiguration.SecurityIndexInfo securityIndexInfo = new ApiConfiguration.SecurityIndexInfoBuilder() - .petpetidDeleteSecurityRequirementObject0SecurityIndex(PetpetidDeleteSecurityRequirementObject0.SecurityIndex.SECURITY_0) - .build(); -Duration timeout = Duration.ofSeconds(1L); -Map> defaultHeaders = Map.of("User-Agent", List.of("OpenAPI-JSON-Schema-Generator/1.0.0/java")); -ApiConfiguration apiConfiguration = new ApiConfiguration( - serverInfo - serverIndexInfo, - securitySchemes, - securityIndexInfo, - timeout, - defaultHeaders -); -SchemaConfiguration schemaConfiguration = new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().build()); -PetpetidDelete.Delete apiClient = new PetpetidDelete.Delete(apiConfiguration, schemaConfiguration); - - -// Map validation -PetpetidDeletePathParameters.PathParametersMap pathParameters = - PetpetidDeletePathParameters.PetpetidDeletePathParameters1.validate( - new PetpetidDeletePathParameters.PathParametersMapBuilder() - .petId(1L) - - .build(), - schemaConfiguration -); - -var request = new PetpetidDelete.DeleteRequestBuilder() - .pathParameters(pathParameters) - .build(); - -Nothing? response; -try { - response = apiClient.delete(request); -} catch (PetpetidDeleteCode400Response.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 | -| --------------------------- | -| Delete(ApiConfiguration apiConfiguration, SchemaConfiguration schemaConfiguration)
Creates an instance | - -### Method Summary -| Modifier and Type | Method and Description | -| ----------------- | ---------------------- | -| Nothing? | delete([DeleteRequest](#deleterequest) request) | - -## DeletePetOperation -public interface DeletePetOperation
- -an interface that allows one to call the endpoint using a method named deletePet by the operationId - -### Method Summary -| Modifier and Type | Method and Description | -| ----------------- | ---------------------- | -| Nothing? | deletePet([DeleteRequest](#deleterequest) request) | - -## DeleteRequest -public static class DeleteRequest
- -a class that stores the final request inputs - -### Field Summary -| Modifier and Type | Field and Description | -| ----------------- | --------------------- | -| [PetpetidDeletePathParameters.PathParametersMap](../../paths/petpetid/delete/PetpetidDeletePathParameters.md#pathparametersmap) | pathParameters | -| [PetpetidDeleteHeaderParameters.@Nullable HeaderParametersMap](../../paths/petpetid/delete/PetpetidDeleteHeaderParameters.md#headerparametersmap) | headerParameters
optional | -| [RootServerInfo.@Nullable ServerIndex](../../RootServerInfo.md#serverindex) | serverIndex
optional. Note: this will override the value in apiConfiguration | -| [PetpetidDeleteSecurityInfo.@Nullable SecurityIndex](../../paths/petpetid/delete/PetpetidDeleteSecurityInfo.md#securityindex) | securityIndex
optional. Note: this will override the value in apiConfiguration | -| @Nullable Duration | timeout
optional. Note: this will override the value in apiConfiguration | - -## DeleteNullableRequest -public static class DeleteNullableRequest
- -a class that stores the initial request inputs - -### Field Summary -| Modifier and Type | Field and Description | -| ----------------- | --------------------- | -| [PetpetidDeletePathParameters.@Nullable PathParametersMap](../../paths/petpetid/delete/PetpetidDeletePathParameters.md#pathparametersmap) | pathParameters | -| [PetpetidDeleteHeaderParameters.@Nullable HeaderParametersMap](../../paths/petpetid/delete/PetpetidDeleteHeaderParameters.md#headerparametersmap) | headerParameters | -| [RootServerInfo.@Nullable ServerIndex](../../RootServerInfo.md#serverindex) | serverIndex | -| [PetpetidDeleteSecurityInfo.@Nullable SecurityIndex](../../paths/petpetid/delete/PetpetidDeleteSecurityInfo.md#securityindex) | securityIndex | -| @Nullable Duration | timeout | - -## Delete0RequestBuilder -public static class Delete0RequestBuilder
- -a builder for request inputs - -### Constructor Summary -| Constructor and Description | -| --------------------------- | -| Delete0RequestBuilder(Delete0RequestBuilder instance)
Creates a builder that contains the passed instance | - -### Method Summary -| Modifier and Type | Method and Description | -| ----------------- | ---------------------- | -| [DeleteRequest](#deleterequest) | build()
Returns the request input used to call an endpoint method | -| [Delete0RequestBuilder](#delete0requestbuilder) | headerParameters([PetpetidDeleteHeaderParametersHeaderParametersMap](../../paths/petpetid/delete/PetpetidDeleteHeaderParameters.md#headerparametersmap) headerParameters)
sets the optional property | -| [Delete0RequestBuilder](#delete0requestbuilder) | serverIndex([RootServerInfo.ServerIndex](../../RootServerInfo.md#serverindex) serverIndex)
sets the optional property. Note: this will override the value in apiConfiguration | -| [Delete0RequestBuilder](#delete0requestbuilder) | securityIndex([PetpetidDeleteSecurityInfo.SecurityIndex](../../paths/petpetid/delete/PetpetidDeleteSecurityInfo.md#securityindex) securityIndex)
sets the optional property. Note: this will override the value in apiConfiguration | -| [Delete0RequestBuilder](#delete0requestbuilder) | timeout(Duration timeout)
sets the optional property. Note: this will override the value in apiConfiguration | - -## DeleteRequestBuilder -public static class DeleteRequestBuilder
- -a builder for request inputs - -### Constructor Summary -| Constructor and Description | -| --------------------------- | -| DeleteRequestBuilder()
Creates a builder that contains null for all parameters | - -### Method Summary -| Modifier and Type | Method and Description | -| ----------------- | ---------------------- | -| [Delete0RequestBuilder](#delete0requestbuilder) | pathParameters([PetpetidDeletePathParametersPathParametersMap](../../paths/petpetid/delete/PetpetidDeletePathParameters.md#pathparametersmap) pathParameters)
sets the property | - -[[Back to top]](#top) [[Back to README]](../../../README.md) diff --git a/samples/client/petstore/kotlin/docs/paths/petpetid/PetpetidGet.md b/samples/client/petstore/kotlin/docs/paths/petpetid/PetpetidGet.md deleted file mode 100644 index 8ce13efbb4b..00000000000 --- a/samples/client/petstore/kotlin/docs/paths/petpetid/PetpetidGet.md +++ /dev/null @@ -1,211 +0,0 @@ -# PetpetidGet - -public class PetpetidGet - -A class that contains necessary endpoint classes -- a class that calls the endpoint method using the http verb -- a class that calls the endpoint method using the operationId name -- class(es) to store the request inputs -- builder(s) to set the request input data - -## Nested Class Summary -| Modifier and Type | Class and Description | -| ----------------- | --------------------- | -| static class | [Get](#get)
The class that has a get method to call the endpoint | -| interface | [GetPetByIdOperation](#getpetbyidoperation)
The interface that has a getPetById method to call the endpoint | -| static class | [GetRequest](#getrequest)
The final request inputs class | -| static class | [GetNullableRequest](#getnullablerequest)
The initial request inputs class | -| static class | [Get0RequestBuilder](#get0requestbuilder)
A builder for the request input class | -| static class | [GetRequestBuilder](#getrequestbuilder)
A builder for the request input class | - -## Get -public static class Get extends ApiClient.ApiClient1 implements GetOperation
- -a class that allows one to call the endpoint using a method named get - -### 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.petpetid.get.PetpetidGetSecurityInfo; -import org.openapijsonschematools.client.paths.petpetid.get.PetpetidGetPathParameters; -import org.openapijsonschematools.client.servers.RootServer0; -import org.openapijsonschematools.client.servers.RootServer1; -import org.openapijsonschematools.client.servers.RootServer2; -import org.openapijsonschematools.client.securityschemes.SecurityScheme; -import org.openapijsonschematools.client.components.securityschemes.ApiKey; -import org.openapijsonschematools.client.paths.petpetid.get.responses.PetpetidGetCode200Response; -import org.openapijsonschematools.client.paths.petpetid.get.responses.PetpetidGetCode400Response; -import org.openapijsonschematools.client.paths.petpetid.get.responses.PetpetidGetCode404Response; -import org.openapijsonschematools.client.servers.RootServerInfo; -import org.openapijsonschematools.client.paths.petpetid.PetpetidGet; -import org.openapijsonschematools.client.paths.petpetid.get.PetpetidGetResponses; - -import java.io.IOException; -import java.util.Arrays; -import java.util.List; -import java.util.Map; -import java.util.AbstractMap; - -// if you want to use a server that is not SERVER_0 pass it in here and change the ServerIndex input below -ApiConfiguration.ServerInfo serverInfo = new ApiConfiguration.ServerInfoBuilder() - .rootServerInfo( - new RootServerInfo.RootServerInfoBuilder() - .rootServer0(new RootServer0()) - .build() - ) - .build(); -ApiConfiguration.ServerIndexInfo serverIndexInfo = new ApiConfiguration.ServerIndexInfoBuilder() - .rootServerInfoServerIndex(RootServerInfo.ServerIndex.SERVER_0) - .build(); -List securitySchemes = new ArrayList(); -securitySchemes.add( - new ApiKey("someApiKey"); -); -ApiConfiguration.SecurityIndexInfo securityIndexInfo = new ApiConfiguration.SecurityIndexInfoBuilder() - .petpetidGetSecurityRequirementObject0SecurityIndex(PetpetidGetSecurityRequirementObject0.SecurityIndex.SECURITY_0) - .build(); -Duration timeout = Duration.ofSeconds(1L); -Map> defaultHeaders = Map.of("User-Agent", List.of("OpenAPI-JSON-Schema-Generator/1.0.0/java")); -ApiConfiguration apiConfiguration = new ApiConfiguration( - serverInfo - serverIndexInfo, - securitySchemes, - securityIndexInfo, - timeout, - defaultHeaders -); -SchemaConfiguration schemaConfiguration = new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().build()); -PetpetidGet.Get apiClient = new PetpetidGet.Get(apiConfiguration, schemaConfiguration); - - -// Map validation -PetpetidGetPathParameters.PathParametersMap pathParameters = - PetpetidGetPathParameters.PetpetidGetPathParameters1.validate( - new PetpetidGetPathParameters.PathParametersMapBuilder() - .petId(1L) - - .build(), - schemaConfiguration -); - -var request = new PetpetidGet.GetRequestBuilder() - .pathParameters(pathParameters) - .build(); - -PetpetidGetResponses.EndpointResponse response; -try { - response = apiClient.get(request); -} catch (PetpetidGetCode400Response.ResponseApiException | PetpetidGetCode404Response.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; -} -PetpetidGetResponses.EndpointPetpetidGetCode200Response castResponse = (PetpetidGetResponses.EndpointPetpetidGetCode200Response) response; -if (castResponse.body instanceof PetpetidGetCode200Response.ApplicationxmlResponseBody deserializedBody) { - // handle deserialized body here -} else { - PetpetidGetCode200Response.ApplicationjsonResponseBody deserializedBody = (PetpetidGetCode200Response.ApplicationjsonResponseBody) castResponse.body; - // handle deserialized body here -} -``` -### Constructor Summary -| Constructor and Description | -| --------------------------- | -| Get(ApiConfiguration apiConfiguration, SchemaConfiguration schemaConfiguration)
Creates an instance | - -### Method Summary -| Modifier and Type | Method and Description | -| ----------------- | ---------------------- | -| [PetpetidGetResponses.EndpointResponse](../../paths/petpetid/get/PetpetidGetResponses.md#endpointresponse) | get([GetRequest](#getrequest) request) | - -## GetPetByIdOperation -public interface GetPetByIdOperation
- -an interface that allows one to call the endpoint using a method named getPetById by the operationId - -### Method Summary -| Modifier and Type | Method and Description | -| ----------------- | ---------------------- | -| [PetpetidGetResponses.EndpointResponse](../../paths/petpetid/get/PetpetidGetResponses.md#endpointresponse) | getPetById([GetRequest](#getrequest) request) | - -## GetRequest -public static class GetRequest
- -a class that stores the final request inputs - -### Field Summary -| Modifier and Type | Field and Description | -| ----------------- | --------------------- | -| [PetpetidGetPathParameters.PathParametersMap](../../paths/petpetid/get/PetpetidGetPathParameters.md#pathparametersmap) | pathParameters | -| [RootServerInfo.@Nullable ServerIndex](../../RootServerInfo.md#serverindex) | serverIndex
optional. Note: this will override the value in apiConfiguration | -| [PetpetidGetSecurityInfo.@Nullable SecurityIndex](../../paths/petpetid/get/PetpetidGetSecurityInfo.md#securityindex) | securityIndex
optional. Note: this will override the value in apiConfiguration | -| @Nullable Duration | timeout
optional. Note: this will override the value in apiConfiguration | - -## GetNullableRequest -public static class GetNullableRequest
- -a class that stores the initial request inputs - -### Field Summary -| Modifier and Type | Field and Description | -| ----------------- | --------------------- | -| [PetpetidGetPathParameters.@Nullable PathParametersMap](../../paths/petpetid/get/PetpetidGetPathParameters.md#pathparametersmap) | pathParameters | -| [RootServerInfo.@Nullable ServerIndex](../../RootServerInfo.md#serverindex) | serverIndex | -| [PetpetidGetSecurityInfo.@Nullable SecurityIndex](../../paths/petpetid/get/PetpetidGetSecurityInfo.md#securityindex) | securityIndex | -| @Nullable Duration | timeout | - -## Get0RequestBuilder -public static class Get0RequestBuilder
- -a builder for request inputs - -### Constructor Summary -| Constructor and Description | -| --------------------------- | -| Get0RequestBuilder(Get0RequestBuilder instance)
Creates a builder that contains the passed instance | - -### Method Summary -| Modifier and Type | Method and Description | -| ----------------- | ---------------------- | -| [GetRequest](#getrequest) | build()
Returns the request input used to call an endpoint method | -| [Get0RequestBuilder](#get0requestbuilder) | serverIndex([RootServerInfo.ServerIndex](../../RootServerInfo.md#serverindex) serverIndex)
sets the optional property. Note: this will override the value in apiConfiguration | -| [Get0RequestBuilder](#get0requestbuilder) | securityIndex([PetpetidGetSecurityInfo.SecurityIndex](../../paths/petpetid/get/PetpetidGetSecurityInfo.md#securityindex) securityIndex)
sets the optional property. Note: this will override the value in apiConfiguration | -| [Get0RequestBuilder](#get0requestbuilder) | timeout(Duration timeout)
sets the optional property. Note: this will override the value in apiConfiguration | - -## GetRequestBuilder -public static class GetRequestBuilder
- -a builder for request inputs - -### Constructor Summary -| Constructor and Description | -| --------------------------- | -| GetRequestBuilder()
Creates a builder that contains null for all parameters | - -### Method Summary -| Modifier and Type | Method and Description | -| ----------------- | ---------------------- | -| [Get0RequestBuilder](#get0requestbuilder) | pathParameters([PetpetidGetPathParametersPathParametersMap](../../paths/petpetid/get/PetpetidGetPathParameters.md#pathparametersmap) pathParameters)
sets the property | - -[[Back to top]](#top) [[Back to README]](../../../README.md) diff --git a/samples/client/petstore/kotlin/docs/paths/petpetid/PetpetidPost.md b/samples/client/petstore/kotlin/docs/paths/petpetid/PetpetidPost.md deleted file mode 100644 index caed33b21ad..00000000000 --- a/samples/client/petstore/kotlin/docs/paths/petpetid/PetpetidPost.md +++ /dev/null @@ -1,207 +0,0 @@ -# PetpetidPost - -public class PetpetidPost - -A class that contains necessary endpoint classes -- a class that calls the endpoint method using the http verb -- a class that calls the endpoint method using the operationId name -- class(es) to store the request inputs -- builder(s) to set the request input data - -## Nested Class Summary -| Modifier and Type | Class and Description | -| ----------------- | --------------------- | -| static class | [Post](#post)
The class that has a post method to call the endpoint | -| interface | [UpdatePetWithFormOperation](#updatepetwithformoperation)
The interface that has a updatePetWithForm method to call the endpoint | -| static class | [PostRequest](#postrequest)
The final request inputs class | -| static class | [PostNullableRequest](#postnullablerequest)
The initial request inputs class | -| static class | [Post0RequestBuilder](#post0requestbuilder)
A builder for the request input class | -| static class | [PostRequestBuilder](#postrequestbuilder)
A builder for the request input class | - -## Post -public static class Post 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.PetpetidPostRequestBody; -import org.openapijsonschematools.client.RootServerInfo; -import org.openapijsonschematools.client.paths.petpetid.post.PetpetidPostSecurityInfo; -import org.openapijsonschematools.client.paths.petpetid.post.PetpetidPostPathParameters; -import org.openapijsonschematools.client.servers.RootServer0; -import org.openapijsonschematools.client.servers.RootServer1; -import org.openapijsonschematools.client.servers.RootServer2; -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.PetpetidPostCode405Response; -import org.openapijsonschematools.client.servers.RootServerInfo; -import org.openapijsonschematools.client.paths.petpetid.PetpetidPost; -import org.openapijsonschematools.client.paths.petpetid.post.PetpetidPostResponses; - -import java.io.IOException; -import java.util.Arrays; -import java.util.List; -import java.util.Map; -import java.util.AbstractMap; - -// if you want to use a server that is not SERVER_0 pass it in here and change the ServerIndex input below -ApiConfiguration.ServerInfo serverInfo = new ApiConfiguration.ServerInfoBuilder() - .rootServerInfo( - new RootServerInfo.RootServerInfoBuilder() - .rootServer0(new RootServer0()) - .build() - ) - .build(); -ApiConfiguration.ServerIndexInfo serverIndexInfo = new ApiConfiguration.ServerIndexInfoBuilder() - .rootServerInfoServerIndex(RootServerInfo.ServerIndex.SERVER_0) - .build(); -List securitySchemes = new ArrayList(); -securitySchemes.add( - new ApiKey("someApiKey"); -); -ApiConfiguration.SecurityIndexInfo securityIndexInfo = new ApiConfiguration.SecurityIndexInfoBuilder() - .petpetidPostSecurityRequirementObject0SecurityIndex(PetpetidPostSecurityRequirementObject0.SecurityIndex.SECURITY_0) - .build(); -Duration timeout = Duration.ofSeconds(1L); -Map> defaultHeaders = Map.of("User-Agent", List.of("OpenAPI-JSON-Schema-Generator/1.0.0/java")); -ApiConfiguration apiConfiguration = new ApiConfiguration( - serverInfo - serverIndexInfo, - securitySchemes, - securityIndexInfo, - timeout, - defaultHeaders -); -SchemaConfiguration schemaConfiguration = new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().build()); -PetpetidPost.Post apiClient = new PetpetidPost.Post(apiConfiguration, schemaConfiguration); - - -// Map validation -PetpetidPostPathParameters.PathParametersMap pathParameters = - PetpetidPostPathParameters.PetpetidPostPathParameters1.validate( - new PetpetidPostPathParameters.PathParametersMapBuilder() - .petId(1L) - - .build(), - schemaConfiguration -); - -var request = new PetpetidPost.PostRequestBuilder() - .pathParameters(pathParameters) - .build(); - -Nothing? response; -try { - response = apiClient.post(request); -} catch (PetpetidPostCode405Response.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 | -| --------------------------- | -| Post(ApiConfiguration apiConfiguration, SchemaConfiguration schemaConfiguration)
Creates an instance | - -### Method Summary -| Modifier and Type | Method and Description | -| ----------------- | ---------------------- | -| Nothing? | post([PostRequest](#postrequest) request) | - -## UpdatePetWithFormOperation -public interface UpdatePetWithFormOperation
- -an interface that allows one to call the endpoint using a method named updatePetWithForm by the operationId - -### Method Summary -| Modifier and Type | Method and Description | -| ----------------- | ---------------------- | -| Nothing? | updatePetWithForm([PostRequest](#postrequest) request) | - -## PostRequest -public static class PostRequest
- -a class that stores the final request inputs - -### Field Summary -| Modifier and Type | Field and Description | -| ----------------- | --------------------- | -| [PetpetidPostPathParameters.PathParametersMap](../../paths/petpetid/post/PetpetidPostPathParameters.md#pathparametersmap) | pathParameters | -| [PetpetidPostRequestBody.@Nullable SealedRequestBody](../../paths/petpetid/post/PetpetidPostRequestBody.md#sealedrequestbody) | requestBody
optional | -| [RootServerInfo.@Nullable ServerIndex](../../RootServerInfo.md#serverindex) | serverIndex
optional. Note: this will override the value in apiConfiguration | -| [PetpetidPostSecurityInfo.@Nullable SecurityIndex](../../paths/petpetid/post/PetpetidPostSecurityInfo.md#securityindex) | securityIndex
optional. Note: this will override the value in apiConfiguration | -| @Nullable Duration | timeout
optional. Note: this will override the value in apiConfiguration | - -## PostNullableRequest -public static class PostNullableRequest
- -a class that stores the initial request inputs - -### Field Summary -| Modifier and Type | Field and Description | -| ----------------- | --------------------- | -| [PetpetidPostPathParameters.@Nullable PathParametersMap](../../paths/petpetid/post/PetpetidPostPathParameters.md#pathparametersmap) | pathParameters | -| [PetpetidPostRequestBody.@Nullable SealedRequestBody](../../paths/petpetid/post/PetpetidPostRequestBody.md#sealedrequestbody) | requestBody | -| [RootServerInfo.@Nullable ServerIndex](../../RootServerInfo.md#serverindex) | serverIndex | -| [PetpetidPostSecurityInfo.@Nullable SecurityIndex](../../paths/petpetid/post/PetpetidPostSecurityInfo.md#securityindex) | securityIndex | -| @Nullable Duration | timeout | - -## Post0RequestBuilder -public static class Post0RequestBuilder
- -a builder for request inputs - -### Constructor Summary -| Constructor and Description | -| --------------------------- | -| Post0RequestBuilder(Post0RequestBuilder instance)
Creates a builder that contains the passed instance | - -### Method Summary -| Modifier and Type | Method and Description | -| ----------------- | ---------------------- | -| [PostRequest](#postrequest) | build()
Returns the request input used to call an endpoint method | -| [Post0RequestBuilder](#post0requestbuilder) | requestBody([PetpetidPostRequestBody.SealedRequestBody](../../paths/petpetid/post/PetpetidPostRequestBody.md#sealedrequestbody) requestBody)
sets the optional property | -| [Post0RequestBuilder](#post0requestbuilder) | serverIndex([RootServerInfo.ServerIndex](../../RootServerInfo.md#serverindex) serverIndex)
sets the optional property. Note: this will override the value in apiConfiguration | -| [Post0RequestBuilder](#post0requestbuilder) | securityIndex([PetpetidPostSecurityInfo.SecurityIndex](../../paths/petpetid/post/PetpetidPostSecurityInfo.md#securityindex) securityIndex)
sets the optional property. Note: this will override the value in apiConfiguration | -| [Post0RequestBuilder](#post0requestbuilder) | timeout(Duration timeout)
sets the optional property. Note: this will override the value in apiConfiguration | - -## PostRequestBuilder -public static class PostRequestBuilder
- -a builder for request inputs - -### Constructor Summary -| Constructor and Description | -| --------------------------- | -| PostRequestBuilder()
Creates a builder that contains null for all parameters | - -### Method Summary -| Modifier and Type | Method and Description | -| ----------------- | ---------------------- | -| [Post0RequestBuilder](#post0requestbuilder) | pathParameters([PetpetidPostPathParametersPathParametersMap](../../paths/petpetid/post/PetpetidPostPathParameters.md#pathparametersmap) pathParameters)
sets the property | - -[[Back to top]](#top) [[Back to README]](../../../README.md) diff --git a/samples/client/petstore/kotlin/docs/paths/petpetid/delete/PetpetidDeleteHeaderParameters.md b/samples/client/petstore/kotlin/docs/paths/petpetid/delete/PetpetidDeleteHeaderParameters.md deleted file mode 100644 index 3b03678d1e5..00000000000 --- a/samples/client/petstore/kotlin/docs/paths/petpetid/delete/PetpetidDeleteHeaderParameters.md +++ /dev/null @@ -1,252 +0,0 @@ -# PetpetidDeleteHeaderParameters -public class PetpetidDeleteHeaderParameters
- -A class that contains necessary nested -- schema classes (which validate payloads), extends JsonSchema -- sealed interfaces which store validated payloads, java version of a sum type -- boxed classes which store validated payloads, sealed permits class implementations -- classes to store validated map payloads, extends FrozenMap -- classes to build inputs for map payloads - -## Nested Class Summary -| Modifier and Type | Class and Description | -| ----------------- | ---------------------- | -| sealed interface | [PetpetidDeleteHeaderParameters.PetpetidDeleteHeaderParameters1Boxed](#petpetiddeleteheaderparameters1boxed)
sealed interface for validated payloads | -| record | [PetpetidDeleteHeaderParameters.PetpetidDeleteHeaderParameters1BoxedMap](#petpetiddeleteheaderparameters1boxedmap)
boxed class to store validated Map payloads | -| static class | [PetpetidDeleteHeaderParameters.PetpetidDeleteHeaderParameters1](#petpetiddeleteheaderparameters1)
schema class | -| static class | [PetpetidDeleteHeaderParameters.HeaderParametersMapBuilder](#headerparametersmapbuilder)
builder for Map payloads | -| static class | [PetpetidDeleteHeaderParameters.HeaderParametersMap](#headerparametersmap)
output class for Map payloads | -| sealed interface | [PetpetidDeleteHeaderParameters.AdditionalPropertiesBoxed](#additionalpropertiesboxed)
sealed interface for validated payloads | -| record | [PetpetidDeleteHeaderParameters.AdditionalPropertiesBoxedVoid](#additionalpropertiesboxedvoid)
boxed class to store validated null payloads | -| record | [PetpetidDeleteHeaderParameters.AdditionalPropertiesBoxedBoolean](#additionalpropertiesboxedboolean)
boxed class to store validated boolean payloads | -| record | [PetpetidDeleteHeaderParameters.AdditionalPropertiesBoxedNumber](#additionalpropertiesboxednumber)
boxed class to store validated Number payloads | -| record | [PetpetidDeleteHeaderParameters.AdditionalPropertiesBoxedString](#additionalpropertiesboxedstring)
boxed class to store validated String payloads | -| record | [PetpetidDeleteHeaderParameters.AdditionalPropertiesBoxedList](#additionalpropertiesboxedlist)
boxed class to store validated List payloads | -| record | [PetpetidDeleteHeaderParameters.AdditionalPropertiesBoxedMap](#additionalpropertiesboxedmap)
boxed class to store validated Map payloads | -| static class | [PetpetidDeleteHeaderParameters.AdditionalProperties](#additionalproperties)
schema class | - -## PetpetidDeleteHeaderParameters1Boxed -public sealed interface PetpetidDeleteHeaderParameters1Boxed
-permits
-[PetpetidDeleteHeaderParameters1BoxedMap](#petpetiddeleteheaderparameters1boxedmap) - -sealed interface that stores validated payloads using boxed classes - -## PetpetidDeleteHeaderParameters1BoxedMap -public record PetpetidDeleteHeaderParameters1BoxedMap
-implements [PetpetidDeleteHeaderParameters1Boxed](#petpetiddeleteheaderparameters1boxed) - -record that stores validated Map payloads, sealed permits implementation - -### Constructor Summary -| Constructor and Description | -| --------------------------- | -| PetpetidDeleteHeaderParameters1BoxedMap([HeaderParametersMap](#headerparametersmap) data)
Creates an instance, private visibility | - -### Method Summary -| Modifier and Type | Method and Description | -| ----------------- | ---------------------- | -| [HeaderParametersMap](#headerparametersmap) | data()
validated payload | -| @Nullable Object | getData()
validated payload | - -## PetpetidDeleteHeaderParameters1 -public static class PetpetidDeleteHeaderParameters1
-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.petpetid.delete.PetpetidDeleteHeaderParameters; - -import java.util.Arrays; -import java.util.List; -import java.util.AbstractMap; - -static final SchemaConfiguration configuration = new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().build()); - -// Map validation -PetpetidDeleteHeaderParameters.HeaderParametersMap validatedPayload = - PetpetidDeleteHeaderParameters.PetpetidDeleteHeaderParameters1.validate( - new PetpetidDeleteHeaderParameters.HeaderParametersMapBuilder() - .api_key("a") - - .build(), - configuration -); -``` - -### Field Summary -| Modifier and Type | Field and Description | -| ----------------- | ---------------------- | -| Set> | type = Set.of(Map.class) | -| Map> | properties = Map.ofEntries(
    new PropertyEntry("api_key", [Schema0.Schema01.class](../../../paths/petpetid/delete/parameters/parameter0/Schema0.md#schema01))
)
| -| Class | additionalProperties = [AdditionalProperties.class](#additionalproperties) | - -### Method Summary -| Modifier and Type | Method and Description | -| ----------------- | ---------------------- | -| [HeaderParametersMap](#headerparametersmap) | validate([Map<?, ?>](#headerparametersmapbuilder) arg, SchemaConfiguration configuration) | -| [PetpetidDeleteHeaderParameters1BoxedMap](#petpetiddeleteheaderparameters1boxedmap) | validateAndBox([Map<?, ?>](#headerparametersmapbuilder) arg, SchemaConfiguration configuration) | -| [PetpetidDeleteHeaderParameters1Boxed](#petpetiddeleteheaderparameters1boxed) | validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) | -| @Nullable Object | validate(@Nullable Object arg, SchemaConfiguration configuration) | - -## HeaderParametersMapBuilder -public class HeaderParametersMapBuilder
-builder for `Map` - -A class that builds the Map input type - -### Constructor Summary -| Constructor and Description | -| --------------------------- | -| HeaderParametersMapBuilder()
Creates a builder that contains an empty map | - -### Method Summary -| Modifier and Type | Method and Description | -| ----------------- | ---------------------- | -| Map | build()
Returns map input that should be used with Schema.validate | -| [HeaderParametersMapBuilder](#headerparametersmapbuilder) | api_key(String value) | - -## HeaderParametersMap -public static class HeaderParametersMap
-extends FrozenMap - -A class to store validated Map payloads - -### Method Summary -| Modifier and Type | Method and Description | -| ----------------- | ---------------------- | -| static [HeaderParametersMap](#headerparametersmap) | of([Map](#headerparametersmapbuilder) arg, SchemaConfiguration configuration) | -| String | api_key()
[optional] | - -## 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(Nothing? data)
Creates an instance, private visibility | - -### Method Summary -| Modifier and Type | Method and Description | -| ----------------- | ---------------------- | -| Nothing? | 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/kotlin/docs/paths/petpetid/delete/PetpetidDeletePathParameters.md b/samples/client/petstore/kotlin/docs/paths/petpetid/delete/PetpetidDeletePathParameters.md deleted file mode 100644 index 4ee36dc8075..00000000000 --- a/samples/client/petstore/kotlin/docs/paths/petpetid/delete/PetpetidDeletePathParameters.md +++ /dev/null @@ -1,271 +0,0 @@ -# PetpetidDeletePathParameters -public class PetpetidDeletePathParameters
- -A class that contains necessary nested -- schema classes (which validate payloads), extends JsonSchema -- sealed interfaces which store validated payloads, java version of a sum type -- boxed classes which store validated payloads, sealed permits class implementations -- classes to store validated map payloads, extends FrozenMap -- classes to build inputs for map payloads - -## Nested Class Summary -| Modifier and Type | Class and Description | -| ----------------- | ---------------------- | -| sealed interface | [PetpetidDeletePathParameters.PetpetidDeletePathParameters1Boxed](#petpetiddeletepathparameters1boxed)
sealed interface for validated payloads | -| record | [PetpetidDeletePathParameters.PetpetidDeletePathParameters1BoxedMap](#petpetiddeletepathparameters1boxedmap)
boxed class to store validated Map payloads | -| static class | [PetpetidDeletePathParameters.PetpetidDeletePathParameters1](#petpetiddeletepathparameters1)
schema class | -| static class | [PetpetidDeletePathParameters.PathParametersMapBuilder](#pathparametersmapbuilder)
builder for Map payloads | -| static class | [PetpetidDeletePathParameters.PathParametersMap](#pathparametersmap)
output class for Map payloads | -| sealed interface | [PetpetidDeletePathParameters.AdditionalPropertiesBoxed](#additionalpropertiesboxed)
sealed interface for validated payloads | -| record | [PetpetidDeletePathParameters.AdditionalPropertiesBoxedVoid](#additionalpropertiesboxedvoid)
boxed class to store validated null payloads | -| record | [PetpetidDeletePathParameters.AdditionalPropertiesBoxedBoolean](#additionalpropertiesboxedboolean)
boxed class to store validated boolean payloads | -| record | [PetpetidDeletePathParameters.AdditionalPropertiesBoxedNumber](#additionalpropertiesboxednumber)
boxed class to store validated Number payloads | -| record | [PetpetidDeletePathParameters.AdditionalPropertiesBoxedString](#additionalpropertiesboxedstring)
boxed class to store validated String payloads | -| record | [PetpetidDeletePathParameters.AdditionalPropertiesBoxedList](#additionalpropertiesboxedlist)
boxed class to store validated List payloads | -| record | [PetpetidDeletePathParameters.AdditionalPropertiesBoxedMap](#additionalpropertiesboxedmap)
boxed class to store validated Map payloads | -| static class | [PetpetidDeletePathParameters.AdditionalProperties](#additionalproperties)
schema class | - -## PetpetidDeletePathParameters1Boxed -public sealed interface PetpetidDeletePathParameters1Boxed
-permits
-[PetpetidDeletePathParameters1BoxedMap](#petpetiddeletepathparameters1boxedmap) - -sealed interface that stores validated payloads using boxed classes - -## PetpetidDeletePathParameters1BoxedMap -public record PetpetidDeletePathParameters1BoxedMap
-implements [PetpetidDeletePathParameters1Boxed](#petpetiddeletepathparameters1boxed) - -record that stores validated Map payloads, sealed permits implementation - -### Constructor Summary -| Constructor and Description | -| --------------------------- | -| PetpetidDeletePathParameters1BoxedMap([PathParametersMap](#pathparametersmap) data)
Creates an instance, private visibility | - -### Method Summary -| Modifier and Type | Method and Description | -| ----------------- | ---------------------- | -| [PathParametersMap](#pathparametersmap) | data()
validated payload | -| @Nullable Object | getData()
validated payload | - -## PetpetidDeletePathParameters1 -public static class PetpetidDeletePathParameters1
-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.petpetid.delete.PetpetidDeletePathParameters; - -import java.util.Arrays; -import java.util.List; -import java.util.AbstractMap; - -static final SchemaConfiguration configuration = new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().build()); - -// Map validation -PetpetidDeletePathParameters.PathParametersMap validatedPayload = - PetpetidDeletePathParameters.PetpetidDeletePathParameters1.validate( - new PetpetidDeletePathParameters.PathParametersMapBuilder() - .petId(1L) - - .build(), - configuration -); -``` - -### Field Summary -| Modifier and Type | Field and Description | -| ----------------- | ---------------------- | -| Set> | type = Set.of(Map.class) | -| Map> | properties = Map.ofEntries(
    new PropertyEntry("petId", [Schema1.Schema11.class](../../../paths/petpetid/delete/parameters/parameter1/Schema1.md#schema11))
)
| -| Set | required = Set.of(
    "petId"
)
| -| Class | additionalProperties = [AdditionalProperties.class](#additionalproperties) | - -### Method Summary -| Modifier and Type | Method and Description | -| ----------------- | ---------------------- | -| [PathParametersMap](#pathparametersmap) | validate([Map<?, ?>](#pathparametersmapbuilder) arg, SchemaConfiguration configuration) | -| [PetpetidDeletePathParameters1BoxedMap](#petpetiddeletepathparameters1boxedmap) | validateAndBox([Map<?, ?>](#pathparametersmapbuilder) arg, SchemaConfiguration configuration) | -| [PetpetidDeletePathParameters1Boxed](#petpetiddeletepathparameters1boxed) | validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) | -| @Nullable Object | validate(@Nullable Object arg, SchemaConfiguration configuration) | - -## PathParametersMap0Builder -public class PathParametersMap0Builder
-builder for `Map` - -A class that builds the Map input type - -### Constructor Summary -| Constructor and Description | -| --------------------------- | -| PathParametersMap0Builder(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 | - -## PathParametersMapBuilder -public class PathParametersMapBuilder
-builder for `Map` - -A class that builds the Map input type - -### Constructor Summary -| Constructor and Description | -| --------------------------- | -| PathParametersMapBuilder()
Creates a builder that contains an empty map | - -### Method Summary -| Modifier and Type | Method and Description | -| ----------------- | ---------------------- | -| [PathParametersMap0Builder](#pathparametersmap0builder) | petId(int value) | -| [PathParametersMap0Builder](#pathparametersmap0builder) | petId(float value) | -| [PathParametersMap0Builder](#pathparametersmap0builder) | petId(long value) | -| [PathParametersMap0Builder](#pathparametersmap0builder) | petId(double value) | - -## PathParametersMap -public static class PathParametersMap
-extends FrozenMap - -A class to store validated Map payloads - -### Method Summary -| Modifier and Type | Method and Description | -| ----------------- | ---------------------- | -| static [PathParametersMap](#pathparametersmap) | of([Map](#pathparametersmapbuilder) arg, SchemaConfiguration configuration) | -| Number | petId()
| - -## 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(Nothing? data)
Creates an instance, private visibility | - -### Method Summary -| Modifier and Type | Method and Description | -| ----------------- | ---------------------- | -| Nothing? | 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/kotlin/docs/paths/petpetid/delete/PetpetidDeleteResponses.md b/samples/client/petstore/kotlin/docs/paths/petpetid/delete/PetpetidDeleteResponses.md deleted file mode 100644 index 393d3ca7126..00000000000 --- a/samples/client/petstore/kotlin/docs/paths/petpetid/delete/PetpetidDeleteResponses.md +++ /dev/null @@ -1,10 +0,0 @@ -# PetpetidDeleteResponses - -public class PetpetidDeleteResponses - -A class that contains necessary responses classes - -## Nested Class Summary -| Modifier and Type | Class and Description | -| ----------------- | --------------------- | - diff --git a/samples/client/petstore/kotlin/docs/paths/petpetid/delete/PetpetidDeleteSecurityInfo.md b/samples/client/petstore/kotlin/docs/paths/petpetid/delete/PetpetidDeleteSecurityInfo.md deleted file mode 100644 index 0a71b0d01f1..00000000000 --- a/samples/client/petstore/kotlin/docs/paths/petpetid/delete/PetpetidDeleteSecurityInfo.md +++ /dev/null @@ -1,42 +0,0 @@ -# PetpetidDeleteSecurityInfo -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 -- an enum class that describes security index values - -## Nested Class Summary -| Modifier and Type | Class and Description | -| ----------------- | --------------------- | -| static class | [PetpetidDeleteSecurityInfo.PetpetidDeleteSecurityInfo1](#petpetiddeletesecurityinfo1)
SecurityRequirementObjectProvider -| enum | [PetpetidDeleteSecurityInfo.SecurityIndex](#securityindex)
class that stores a security index | - -## PetpetidDeleteSecurityInfo1 -implements SecurityRequirementObjectProvider<[SecurityIndex](#securityindex)> - -### Constructor Summary -| Constructor and Description | -| --------------------------- | -| PetpetidDeleteSecurityInfo1()
Creates an instance | - -### Field Summary -| Modifier and Type | Field and Description | -| ----------------- | --------------------- | -| [PetpetidDeleteSecurityRequirementObject0](../../../paths/petpetid/delete/security/PetpetidDeleteSecurityRequirementObject0.md) | security0 | -| [PetpetidDeleteSecurityRequirementObject1](../../../paths/petpetid/delete/security/PetpetidDeleteSecurityRequirementObject1.md) | security1 | - -### Method Summary -| Modifier and Type | Method and Description | -| ----------------- | ---------------------- | -| SecurityRequirementObject | getSecurityRequirementObject(@Nullable [SecurityIndex](#securityindex) securityIndex)
If null is input, then the instance's securityIndex will be used | - -## SecurityIndex -enum SecurityIndex
- -### Enum Constant Summary -| Enum Constant And Description | -| ----------------------------- | -| SECURITY_0
security 0 | -| SECURITY_1
security 1 | diff --git a/samples/client/petstore/kotlin/docs/paths/petpetid/delete/parameters/parameter0/Schema0.md b/samples/client/petstore/kotlin/docs/paths/petpetid/delete/parameters/parameter0/Schema0.md deleted file mode 100644 index 9ff90e0bc35..00000000000 --- a/samples/client/petstore/kotlin/docs/paths/petpetid/delete/parameters/parameter0/Schema0.md +++ /dev/null @@ -1,49 +0,0 @@ -# Schema0 -public class Schema0
- -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 - -## Nested Class Summary -| Modifier and Type | Class and Description | -| ----------------- | ---------------------- | -| sealed interface | [Schema0.Schema01Boxed](#schema01boxed)
sealed interface for validated payloads | -| record | [Schema0.Schema01BoxedString](#schema01boxedstring)
boxed class to store validated String payloads | -| static class | [Schema0.Schema01](#schema01)
schema class | - -## Schema01Boxed -public sealed interface Schema01Boxed
-permits
-[Schema01BoxedString](#schema01boxedstring) - -sealed interface that stores validated payloads using boxed classes - -## Schema01BoxedString -public record Schema01BoxedString
-implements [Schema01Boxed](#schema01boxed) - -record that stores validated String payloads, sealed permits implementation - -### Constructor Summary -| Constructor and Description | -| --------------------------- | -| Schema01BoxedString(String data)
Creates an instance, private visibility | - -### Method Summary -| Modifier and Type | Method and Description | -| ----------------- | ---------------------- | -| String | data()
validated payload | -| @Nullable Object | getData()
validated payload | - -## Schema01 -public static class Schema01
-extends StringJsonSchema.StringJsonSchema1 - -A schema class that validates payloads - -| Methods Inherited from class org.openapijsonschematools.client.schemas.StringJsonSchema.StringJsonSchema1 | -| ------------------------------------------------------------------ | -| validate | -| validateAndBox | diff --git a/samples/client/petstore/kotlin/docs/paths/petpetid/delete/parameters/parameter1/Schema1.md b/samples/client/petstore/kotlin/docs/paths/petpetid/delete/parameters/parameter1/Schema1.md deleted file mode 100644 index d8a770d95a5..00000000000 --- a/samples/client/petstore/kotlin/docs/paths/petpetid/delete/parameters/parameter1/Schema1.md +++ /dev/null @@ -1,49 +0,0 @@ -# Schema1 -public class Schema1
- -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 - -## Nested Class Summary -| Modifier and Type | Class and Description | -| ----------------- | ---------------------- | -| sealed interface | [Schema1.Schema11Boxed](#schema11boxed)
sealed interface for validated payloads | -| record | [Schema1.Schema11BoxedNumber](#schema11boxednumber)
boxed class to store validated Number payloads | -| static class | [Schema1.Schema11](#schema11)
schema class | - -## Schema11Boxed -public sealed interface Schema11Boxed
-permits
-[Schema11BoxedNumber](#schema11boxednumber) - -sealed interface that stores validated payloads using boxed classes - -## Schema11BoxedNumber -public record Schema11BoxedNumber
-implements [Schema11Boxed](#schema11boxed) - -record that stores validated Number payloads, sealed permits implementation - -### Constructor Summary -| Constructor and Description | -| --------------------------- | -| Schema11BoxedNumber(Number data)
Creates an instance, private visibility | - -### Method Summary -| Modifier and Type | Method and Description | -| ----------------- | ---------------------- | -| Number | data()
validated payload | -| @Nullable Object | getData()
validated payload | - -## Schema11 -public static class Schema11
-extends Int64JsonSchema.Int64JsonSchema1 - -A schema class that validates payloads - -| Methods Inherited from class org.openapijsonschematools.client.schemas.Int64JsonSchema.Int64JsonSchema1 | -| ------------------------------------------------------------------ | -| validate | -| validateAndBox | diff --git a/samples/client/petstore/kotlin/docs/paths/petpetid/delete/responses/PetpetidDeleteCode400Response.md b/samples/client/petstore/kotlin/docs/paths/petpetid/delete/responses/PetpetidDeleteCode400Response.md deleted file mode 100644 index 94810ff7246..00000000000 --- a/samples/client/petstore/kotlin/docs/paths/petpetid/delete/responses/PetpetidDeleteCode400Response.md +++ /dev/null @@ -1,32 +0,0 @@ -# PetpetidDeleteCode400Response - -public class PetpetidDeleteCode400Response - -A class that contains necessary nested response classes -- a class that extends ResponseDeserializer and is used to deserialize responses - -## Nested Class Summary -| Modifier and Type | Class and Description | -| ----------------- | --------------------- | -| static class | [PetpetidDeleteCode400Response.PetpetidDeleteCode400Response1](#petpetiddeletecode400response1)
class that deserializes responses | - -## PetpetidDeleteCode400Response1 -public static class PetpetidDeleteCode400Response1
-extends ResponseDeserializer - -a class that deserializes responses - -### Constructor Summary -| Constructor and Description | -| --------------------------- | -| PetpetidDeleteCode400Response1()
Creates an instance | - -### Field Summary -| Modifier and Type | Field and Description | -| ----------------- | --------------------- | -| Map | content = MapUtils.makeMap(
)
the contentType to schema info | - -### Method Summary -| Modifier and Type | Method and Description | -| ----------------- | ---------------------- | -| ApiResponse | deserialize(HttpResponse response, SchemaConfiguration configuration)
called by endpoint when deserialize responses | diff --git a/samples/client/petstore/kotlin/docs/paths/petpetid/delete/security/PetpetidDeleteSecurityRequirementObject0.md b/samples/client/petstore/kotlin/docs/paths/petpetid/delete/security/PetpetidDeleteSecurityRequirementObject0.md deleted file mode 100644 index f80b6f15b40..00000000000 --- a/samples/client/petstore/kotlin/docs/paths/petpetid/delete/security/PetpetidDeleteSecurityRequirementObject0.md +++ /dev/null @@ -1,15 +0,0 @@ -# PetpetidDeleteSecurityRequirementObject0 -PetpetidDeleteSecurityRequirementObject0.java - -public class PetpetidDeleteSecurityRequirementObject0 -extends SecurityRequirementObject - -### Constructor Summary -| Constructor and Description | -| --------------------------- | -| PetpetidDeleteSecurityRequirementObject0()
Creates an instance | - -### 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()
    )) | diff --git a/samples/client/petstore/kotlin/docs/paths/petpetid/delete/security/PetpetidDeleteSecurityRequirementObject1.md b/samples/client/petstore/kotlin/docs/paths/petpetid/delete/security/PetpetidDeleteSecurityRequirementObject1.md deleted file mode 100644 index 8877bdea9a3..00000000000 --- a/samples/client/petstore/kotlin/docs/paths/petpetid/delete/security/PetpetidDeleteSecurityRequirementObject1.md +++ /dev/null @@ -1,15 +0,0 @@ -# PetpetidDeleteSecurityRequirementObject1 -PetpetidDeleteSecurityRequirementObject1.java - -public class PetpetidDeleteSecurityRequirementObject1 -extends SecurityRequirementObject - -### Constructor Summary -| Constructor and Description | -| --------------------------- | -| PetpetidDeleteSecurityRequirementObject1()
Creates an instance | - -### 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")
    )) | diff --git a/samples/client/petstore/kotlin/docs/paths/petpetid/get/PetpetidGetPathParameters.md b/samples/client/petstore/kotlin/docs/paths/petpetid/get/PetpetidGetPathParameters.md deleted file mode 100644 index 058f1414af6..00000000000 --- a/samples/client/petstore/kotlin/docs/paths/petpetid/get/PetpetidGetPathParameters.md +++ /dev/null @@ -1,271 +0,0 @@ -# PetpetidGetPathParameters -public class PetpetidGetPathParameters
- -A class that contains necessary nested -- schema classes (which validate payloads), extends JsonSchema -- sealed interfaces which store validated payloads, java version of a sum type -- boxed classes which store validated payloads, sealed permits class implementations -- classes to store validated map payloads, extends FrozenMap -- classes to build inputs for map payloads - -## Nested Class Summary -| Modifier and Type | Class and Description | -| ----------------- | ---------------------- | -| sealed interface | [PetpetidGetPathParameters.PetpetidGetPathParameters1Boxed](#petpetidgetpathparameters1boxed)
sealed interface for validated payloads | -| record | [PetpetidGetPathParameters.PetpetidGetPathParameters1BoxedMap](#petpetidgetpathparameters1boxedmap)
boxed class to store validated Map payloads | -| static class | [PetpetidGetPathParameters.PetpetidGetPathParameters1](#petpetidgetpathparameters1)
schema class | -| static class | [PetpetidGetPathParameters.PathParametersMapBuilder](#pathparametersmapbuilder)
builder for Map payloads | -| static class | [PetpetidGetPathParameters.PathParametersMap](#pathparametersmap)
output class for Map payloads | -| sealed interface | [PetpetidGetPathParameters.AdditionalPropertiesBoxed](#additionalpropertiesboxed)
sealed interface for validated payloads | -| record | [PetpetidGetPathParameters.AdditionalPropertiesBoxedVoid](#additionalpropertiesboxedvoid)
boxed class to store validated null payloads | -| record | [PetpetidGetPathParameters.AdditionalPropertiesBoxedBoolean](#additionalpropertiesboxedboolean)
boxed class to store validated boolean payloads | -| record | [PetpetidGetPathParameters.AdditionalPropertiesBoxedNumber](#additionalpropertiesboxednumber)
boxed class to store validated Number payloads | -| record | [PetpetidGetPathParameters.AdditionalPropertiesBoxedString](#additionalpropertiesboxedstring)
boxed class to store validated String payloads | -| record | [PetpetidGetPathParameters.AdditionalPropertiesBoxedList](#additionalpropertiesboxedlist)
boxed class to store validated List payloads | -| record | [PetpetidGetPathParameters.AdditionalPropertiesBoxedMap](#additionalpropertiesboxedmap)
boxed class to store validated Map payloads | -| static class | [PetpetidGetPathParameters.AdditionalProperties](#additionalproperties)
schema class | - -## PetpetidGetPathParameters1Boxed -public sealed interface PetpetidGetPathParameters1Boxed
-permits
-[PetpetidGetPathParameters1BoxedMap](#petpetidgetpathparameters1boxedmap) - -sealed interface that stores validated payloads using boxed classes - -## PetpetidGetPathParameters1BoxedMap -public record PetpetidGetPathParameters1BoxedMap
-implements [PetpetidGetPathParameters1Boxed](#petpetidgetpathparameters1boxed) - -record that stores validated Map payloads, sealed permits implementation - -### Constructor Summary -| Constructor and Description | -| --------------------------- | -| PetpetidGetPathParameters1BoxedMap([PathParametersMap](#pathparametersmap) data)
Creates an instance, private visibility | - -### Method Summary -| Modifier and Type | Method and Description | -| ----------------- | ---------------------- | -| [PathParametersMap](#pathparametersmap) | data()
validated payload | -| @Nullable Object | getData()
validated payload | - -## PetpetidGetPathParameters1 -public static class PetpetidGetPathParameters1
-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.petpetid.get.PetpetidGetPathParameters; - -import java.util.Arrays; -import java.util.List; -import java.util.AbstractMap; - -static final SchemaConfiguration configuration = new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().build()); - -// Map validation -PetpetidGetPathParameters.PathParametersMap validatedPayload = - PetpetidGetPathParameters.PetpetidGetPathParameters1.validate( - new PetpetidGetPathParameters.PathParametersMapBuilder() - .petId(1L) - - .build(), - configuration -); -``` - -### Field Summary -| Modifier and Type | Field and Description | -| ----------------- | ---------------------- | -| Set> | type = Set.of(Map.class) | -| Map> | properties = Map.ofEntries(
    new PropertyEntry("petId", [Schema0.Schema01.class](../../../paths/petpetid/get/parameters/parameter0/Schema0.md#schema01))
)
| -| Set | required = Set.of(
    "petId"
)
| -| Class | additionalProperties = [AdditionalProperties.class](#additionalproperties) | - -### Method Summary -| Modifier and Type | Method and Description | -| ----------------- | ---------------------- | -| [PathParametersMap](#pathparametersmap) | validate([Map<?, ?>](#pathparametersmapbuilder) arg, SchemaConfiguration configuration) | -| [PetpetidGetPathParameters1BoxedMap](#petpetidgetpathparameters1boxedmap) | validateAndBox([Map<?, ?>](#pathparametersmapbuilder) arg, SchemaConfiguration configuration) | -| [PetpetidGetPathParameters1Boxed](#petpetidgetpathparameters1boxed) | validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) | -| @Nullable Object | validate(@Nullable Object arg, SchemaConfiguration configuration) | - -## PathParametersMap0Builder -public class PathParametersMap0Builder
-builder for `Map` - -A class that builds the Map input type - -### Constructor Summary -| Constructor and Description | -| --------------------------- | -| PathParametersMap0Builder(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 | - -## PathParametersMapBuilder -public class PathParametersMapBuilder
-builder for `Map` - -A class that builds the Map input type - -### Constructor Summary -| Constructor and Description | -| --------------------------- | -| PathParametersMapBuilder()
Creates a builder that contains an empty map | - -### Method Summary -| Modifier and Type | Method and Description | -| ----------------- | ---------------------- | -| [PathParametersMap0Builder](#pathparametersmap0builder) | petId(int value) | -| [PathParametersMap0Builder](#pathparametersmap0builder) | petId(float value) | -| [PathParametersMap0Builder](#pathparametersmap0builder) | petId(long value) | -| [PathParametersMap0Builder](#pathparametersmap0builder) | petId(double value) | - -## PathParametersMap -public static class PathParametersMap
-extends FrozenMap - -A class to store validated Map payloads - -### Method Summary -| Modifier and Type | Method and Description | -| ----------------- | ---------------------- | -| static [PathParametersMap](#pathparametersmap) | of([Map](#pathparametersmapbuilder) arg, SchemaConfiguration configuration) | -| Number | petId()
| - -## 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(Nothing? data)
Creates an instance, private visibility | - -### Method Summary -| Modifier and Type | Method and Description | -| ----------------- | ---------------------- | -| Nothing? | 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/kotlin/docs/paths/petpetid/get/PetpetidGetResponses.md b/samples/client/petstore/kotlin/docs/paths/petpetid/get/PetpetidGetResponses.md deleted file mode 100644 index 6dff9daa460..00000000000 --- a/samples/client/petstore/kotlin/docs/paths/petpetid/get/PetpetidGetResponses.md +++ /dev/null @@ -1,29 +0,0 @@ -# PetpetidGetResponses - -public class PetpetidGetResponses - -A class that contains necessary responses classes -- a sealed interface, EndpointResponse, that stores endpoint responses -- records for each endpoint response - -## Nested Class Summary -| Modifier and Type | Class and Description | -| ----------------- | --------------------- | -| sealed interface | [EndpointResponse](#endpointresponse)
stores the endpoint responses | -| record | [EndpointPetpetidGetCode200Response](#endpointpetpetidgetcode200response)
the response for 200 | - -## EndpointResponse -public sealed interface EndpointResponse permits
-[EndpointPetpetidGetCode200Response](#endpointpetpetidgetcode200response) - -a sealed interface that stores endpoint responses - -## EndpointPetpetidGetCode200Response -public record EndpointPetpetidGetCode200Response( - HttpResponse response, - [PetpetidGetCode200Response.SealedResponseBody](../../../paths/petpetid/get/responses/PetpetidGetCode200Response.md#sealedresponsebody) body, - Nothing? headers -) implements EndpointResponse, ApiResponse
- -a class that stores an endpoint response - diff --git a/samples/client/petstore/kotlin/docs/paths/petpetid/get/PetpetidGetSecurityInfo.md b/samples/client/petstore/kotlin/docs/paths/petpetid/get/PetpetidGetSecurityInfo.md deleted file mode 100644 index c6615ea3fa9..00000000000 --- a/samples/client/petstore/kotlin/docs/paths/petpetid/get/PetpetidGetSecurityInfo.md +++ /dev/null @@ -1,40 +0,0 @@ -# PetpetidGetSecurityInfo -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 -- an enum class that describes security index values - -## Nested Class Summary -| Modifier and Type | Class and Description | -| ----------------- | --------------------- | -| static class | [PetpetidGetSecurityInfo.PetpetidGetSecurityInfo1](#petpetidgetsecurityinfo1)
SecurityRequirementObjectProvider -| enum | [PetpetidGetSecurityInfo.SecurityIndex](#securityindex)
class that stores a security index | - -## PetpetidGetSecurityInfo1 -implements SecurityRequirementObjectProvider<[SecurityIndex](#securityindex)> - -### Constructor Summary -| Constructor and Description | -| --------------------------- | -| PetpetidGetSecurityInfo1()
Creates an instance | - -### Field Summary -| Modifier and Type | Field and Description | -| ----------------- | --------------------- | -| [PetpetidGetSecurityRequirementObject0](../../../paths/petpetid/get/security/PetpetidGetSecurityRequirementObject0.md) | security0 | - -### Method Summary -| Modifier and Type | Method and Description | -| ----------------- | ---------------------- | -| SecurityRequirementObject | getSecurityRequirementObject(@Nullable [SecurityIndex](#securityindex) securityIndex)
If null is input, then the instance's securityIndex will be used | - -## SecurityIndex -enum SecurityIndex
- -### Enum Constant Summary -| Enum Constant And Description | -| ----------------------------- | -| SECURITY_0
security 0 | diff --git a/samples/client/petstore/kotlin/docs/paths/petpetid/get/parameters/parameter0/Schema0.md b/samples/client/petstore/kotlin/docs/paths/petpetid/get/parameters/parameter0/Schema0.md deleted file mode 100644 index 55e4e5cb238..00000000000 --- a/samples/client/petstore/kotlin/docs/paths/petpetid/get/parameters/parameter0/Schema0.md +++ /dev/null @@ -1,49 +0,0 @@ -# Schema0 -public class Schema0
- -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 - -## Nested Class Summary -| Modifier and Type | Class and Description | -| ----------------- | ---------------------- | -| sealed interface | [Schema0.Schema01Boxed](#schema01boxed)
sealed interface for validated payloads | -| record | [Schema0.Schema01BoxedNumber](#schema01boxednumber)
boxed class to store validated Number payloads | -| static class | [Schema0.Schema01](#schema01)
schema class | - -## Schema01Boxed -public sealed interface Schema01Boxed
-permits
-[Schema01BoxedNumber](#schema01boxednumber) - -sealed interface that stores validated payloads using boxed classes - -## Schema01BoxedNumber -public record Schema01BoxedNumber
-implements [Schema01Boxed](#schema01boxed) - -record that stores validated Number payloads, sealed permits implementation - -### Constructor Summary -| Constructor and Description | -| --------------------------- | -| Schema01BoxedNumber(Number data)
Creates an instance, private visibility | - -### Method Summary -| Modifier and Type | Method and Description | -| ----------------- | ---------------------- | -| Number | data()
validated payload | -| @Nullable Object | getData()
validated payload | - -## Schema01 -public static class Schema01
-extends Int64JsonSchema.Int64JsonSchema1 - -A schema class that validates payloads - -| Methods Inherited from class org.openapijsonschematools.client.schemas.Int64JsonSchema.Int64JsonSchema1 | -| ------------------------------------------------------------------ | -| validate | -| validateAndBox | diff --git a/samples/client/petstore/kotlin/docs/paths/petpetid/get/responses/PetpetidGetCode200Response.md b/samples/client/petstore/kotlin/docs/paths/petpetid/get/responses/PetpetidGetCode200Response.md deleted file mode 100644 index d4d5628d5b2..00000000000 --- a/samples/client/petstore/kotlin/docs/paths/petpetid/get/responses/PetpetidGetCode200Response.md +++ /dev/null @@ -1,123 +0,0 @@ -# PetpetidGetCode200Response - -public class PetpetidGetCode200Response - -A class that contains necessary nested response classes -- SealedMediaType, a sealed interface which contains all the schema/encoding info for each contentType -- records which implement SealedMediaType, the concrete media types -- SealedResponseBody, a sealed interface which contains all the contentType/schema types -- records which implement SealedResponseBody, the concrete response body types -- a class that extends ResponseDeserializer and is used to deserialize responses - -## Nested Class Summary -| Modifier and Type | Class and Description | -| ----------------- | --------------------- | -| sealed interface | [PetpetidGetCode200Response.SealedMediaType](#sealedmediatype)
media type sealed interface | -| record | [PetpetidGetCode200Response.ApplicationxmlMediaType](#applicationxmlmediatype)
record storing schema + encoding for a specific contentType | -| record | [PetpetidGetCode200Response.ApplicationjsonMediaType](#applicationjsonmediatype)
record storing schema + encoding for a specific contentType | -| sealed interface | [PetpetidGetCode200Response.SealedResponseBody](#sealedresponsebody)
response body sealed interface | -| record | [PetpetidGetCode200Response.ApplicationxmlResponseBody](#applicationxmlresponsebody)
implements sealed interface to store response body | -| record | [PetpetidGetCode200Response.ApplicationjsonResponseBody](#applicationjsonresponsebody)
implements sealed interface to store response body | -| static class | [PetpetidGetCode200Response.PetpetidGetCode200Response1](#petpetidgetcode200response1)
class that deserializes responses | - -## SealedMediaType -public sealed interface SealedMediaType
-permits
-[ApplicationxmlMediaType](#applicationxmlmediatype), -[ApplicationjsonMediaType](#applicationjsonmediatype) - -sealed interface that stores schema and encoding info - -## ApplicationxmlMediaType -public record ApplicationxmlMediaType
-implements [SealedMediaType](#sealedmediatype), MediaType<[ApplicationxmlSchema.ApplicationxmlSchema1](../../../../paths/petpetid/get/responses/code200response/content/applicationxml/ApplicationxmlSchema.md#applicationxmlschema1), Nothing?> - -class storing schema info for a specific contentType - -### Constructor Summary -| Constructor and Description | -| --------------------------- | -| ApplicationxmlMediaType()
Creates an instance | - -### Method Summary -| Modifier and Type | Method and Description | -| ----------------- | ---------------------- | -| [ApplicationxmlSchema.ApplicationxmlSchema1](../../../../paths/petpetid/get/responses/code200response/content/applicationxml/ApplicationxmlSchema.md#applicationxmlschema1) | schema()
the schema for this MediaType | -| Nothing? | encoding()
the encoding info | - -## ApplicationjsonMediaType -public record ApplicationjsonMediaType
-implements [SealedMediaType](#sealedmediatype), MediaType<[ApplicationjsonSchema.ApplicationjsonSchema1](../../../../paths/petpetid/get/responses/code200response/content/applicationjson/ApplicationjsonSchema.md#applicationjsonschema1), Nothing?> - -class storing schema info for a specific contentType - -### Constructor Summary -| Constructor and Description | -| --------------------------- | -| ApplicationjsonMediaType()
Creates an instance | - -### Method Summary -| Modifier and Type | Method and Description | -| ----------------- | ---------------------- | -| [ApplicationjsonSchema.ApplicationjsonSchema1](../../../../paths/petpetid/get/responses/code200response/content/applicationjson/ApplicationjsonSchema.md#applicationjsonschema1) | schema()
the schema for this MediaType | -| Nothing? | encoding()
the encoding info | - -## SealedResponseBody -public sealed interface SealedResponseBody
-permits
-[ApplicationxmlResponseBody](#applicationxmlresponsebody), -[ApplicationjsonResponseBody](#applicationjsonresponsebody) - -sealed interface that stores response body - -## ApplicationxmlResponseBody -public record ApplicationxmlResponseBody
-implements [SealedResponseBody](#sealedresponsebody) - -A record class to store response body for contentType="application/xml" - -### Constructor Summary -| Constructor and Description | -| --------------------------- | -| ApplicationxmlResponseBody(ApplicationxmlSchema.[Pet1Boxed](../../../../components/schemas/Pet.md#pet1boxed) body)
Creates an instance | - -### Method Summary -| Modifier and Type | Method and Description | -| ----------------- | ---------------------- | -| ApplicationxmlSchema.[Pet1Boxed](../../../../components/schemas/Pet.md#pet1boxed) | body()
returns the body passed in in the constructor | -## ApplicationjsonResponseBody -public record ApplicationjsonResponseBody
-implements [SealedResponseBody](#sealedresponsebody) - -A record class to store response body for contentType="application/json" - -### Constructor Summary -| Constructor and Description | -| --------------------------- | -| ApplicationjsonResponseBody(ApplicationjsonSchema.[Pet1Boxed](../../../../components/schemas/Pet.md#pet1boxed) body)
Creates an instance | - -### Method Summary -| Modifier and Type | Method and Description | -| ----------------- | ---------------------- | -| ApplicationjsonSchema.[Pet1Boxed](../../../../components/schemas/Pet.md#pet1boxed) | body()
returns the body passed in in the constructor | - -## PetpetidGetCode200Response1 -public static class PetpetidGetCode200Response1
-extends ResponseDeserializer<[SealedResponseBody](#sealedresponsebody), Nothing?, [SealedMediaType](#sealedmediatype)> - -a class that deserializes responses - -### Constructor Summary -| Constructor and Description | -| --------------------------- | -| PetpetidGetCode200Response1()
Creates an instance | - -### Field Summary -| Modifier and Type | Field and Description | -| ----------------- | --------------------- | -| Map | content = Map.ofEntries(
    new AbstractMap.SimpleEntry<>("application/xml", new [ApplicationxmlMediaType](#applicationxmlmediatype)()),
    new AbstractMap.SimpleEntry<>("application/json", new [ApplicationjsonMediaType](#applicationjsonmediatype)())
)
the contentType to schema info | - -### Method Summary -| Modifier and Type | Method and Description | -| ----------------- | ---------------------- | -| ApiResponse<[SealedResponseBody](#sealedresponsebody), Nothing?> | deserialize(HttpResponse response, SchemaConfiguration configuration)
called by endpoint when deserialize responses | diff --git a/samples/client/petstore/kotlin/docs/paths/petpetid/get/responses/PetpetidGetCode400Response.md b/samples/client/petstore/kotlin/docs/paths/petpetid/get/responses/PetpetidGetCode400Response.md deleted file mode 100644 index 4774fd3ff6e..00000000000 --- a/samples/client/petstore/kotlin/docs/paths/petpetid/get/responses/PetpetidGetCode400Response.md +++ /dev/null @@ -1,32 +0,0 @@ -# PetpetidGetCode400Response - -public class PetpetidGetCode400Response - -A class that contains necessary nested response classes -- a class that extends ResponseDeserializer and is used to deserialize responses - -## Nested Class Summary -| Modifier and Type | Class and Description | -| ----------------- | --------------------- | -| static class | [PetpetidGetCode400Response.PetpetidGetCode400Response1](#petpetidgetcode400response1)
class that deserializes responses | - -## PetpetidGetCode400Response1 -public static class PetpetidGetCode400Response1
-extends ResponseDeserializer - -a class that deserializes responses - -### Constructor Summary -| Constructor and Description | -| --------------------------- | -| PetpetidGetCode400Response1()
Creates an instance | - -### Field Summary -| Modifier and Type | Field and Description | -| ----------------- | --------------------- | -| Map | content = MapUtils.makeMap(
)
the contentType to schema info | - -### Method Summary -| Modifier and Type | Method and Description | -| ----------------- | ---------------------- | -| ApiResponse | deserialize(HttpResponse response, SchemaConfiguration configuration)
called by endpoint when deserialize responses | diff --git a/samples/client/petstore/kotlin/docs/paths/petpetid/get/responses/PetpetidGetCode404Response.md b/samples/client/petstore/kotlin/docs/paths/petpetid/get/responses/PetpetidGetCode404Response.md deleted file mode 100644 index ef56994e489..00000000000 --- a/samples/client/petstore/kotlin/docs/paths/petpetid/get/responses/PetpetidGetCode404Response.md +++ /dev/null @@ -1,32 +0,0 @@ -# PetpetidGetCode404Response - -public class PetpetidGetCode404Response - -A class that contains necessary nested response classes -- a class that extends ResponseDeserializer and is used to deserialize responses - -## Nested Class Summary -| Modifier and Type | Class and Description | -| ----------------- | --------------------- | -| static class | [PetpetidGetCode404Response.PetpetidGetCode404Response1](#petpetidgetcode404response1)
class that deserializes responses | - -## PetpetidGetCode404Response1 -public static class PetpetidGetCode404Response1
-extends ResponseDeserializer - -a class that deserializes responses - -### Constructor Summary -| Constructor and Description | -| --------------------------- | -| PetpetidGetCode404Response1()
Creates an instance | - -### Field Summary -| Modifier and Type | Field and Description | -| ----------------- | --------------------- | -| Map | content = MapUtils.makeMap(
)
the contentType to schema info | - -### Method Summary -| Modifier and Type | Method and Description | -| ----------------- | ---------------------- | -| ApiResponse | deserialize(HttpResponse response, SchemaConfiguration configuration)
called by endpoint when deserialize responses | diff --git a/samples/client/petstore/kotlin/docs/paths/petpetid/get/responses/code200response/content/applicationjson/ApplicationjsonSchema.md b/samples/client/petstore/kotlin/docs/paths/petpetid/get/responses/code200response/content/applicationjson/ApplicationjsonSchema.md deleted file mode 100644 index d5c13efb07f..00000000000 --- a/samples/client/petstore/kotlin/docs/paths/petpetid/get/responses/code200response/content/applicationjson/ApplicationjsonSchema.md +++ /dev/null @@ -1,19 +0,0 @@ -# ApplicationjsonSchema -public class ApplicationjsonSchema
-extends [RefPet1](../../../../../../../components/schemas/RefPet.md#refpet) - -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 - -## Nested Class Summary -| Modifier and Type | Class and Description | -| ----------------- | ---------------------- | -| static class | [ApplicationjsonSchema.ApplicationjsonSchema1](#applicationjsonschema1)
schema class | - -## ApplicationjsonSchema1 -public static class ApplicationjsonSchema1
-extends [RefPet.RefPet1](../../../../../../../components/schemas/RefPet.md#refpet1) - -A schema class that validates payloads diff --git a/samples/client/petstore/kotlin/docs/paths/petpetid/get/responses/code200response/content/applicationxml/ApplicationxmlSchema.md b/samples/client/petstore/kotlin/docs/paths/petpetid/get/responses/code200response/content/applicationxml/ApplicationxmlSchema.md deleted file mode 100644 index be8b3ac53c8..00000000000 --- a/samples/client/petstore/kotlin/docs/paths/petpetid/get/responses/code200response/content/applicationxml/ApplicationxmlSchema.md +++ /dev/null @@ -1,19 +0,0 @@ -# ApplicationxmlSchema -public class ApplicationxmlSchema
-extends [Pet1](../../../../../../../components/schemas/Pet.md#pet) - -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 - -## Nested Class Summary -| Modifier and Type | Class and Description | -| ----------------- | ---------------------- | -| static class | [ApplicationxmlSchema.ApplicationxmlSchema1](#applicationxmlschema1)
schema class | - -## ApplicationxmlSchema1 -public static class ApplicationxmlSchema1
-extends [Pet.Pet1](../../../../../../../components/schemas/Pet.md#pet1) - -A schema class that validates payloads diff --git a/samples/client/petstore/kotlin/docs/paths/petpetid/get/security/PetpetidGetSecurityRequirementObject0.md b/samples/client/petstore/kotlin/docs/paths/petpetid/get/security/PetpetidGetSecurityRequirementObject0.md deleted file mode 100644 index 77bfdbe2448..00000000000 --- a/samples/client/petstore/kotlin/docs/paths/petpetid/get/security/PetpetidGetSecurityRequirementObject0.md +++ /dev/null @@ -1,15 +0,0 @@ -# PetpetidGetSecurityRequirementObject0 -PetpetidGetSecurityRequirementObject0.java - -public class PetpetidGetSecurityRequirementObject0 -extends SecurityRequirementObject - -### Constructor Summary -| Constructor and Description | -| --------------------------- | -| PetpetidGetSecurityRequirementObject0()
Creates an instance | - -### 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()
    )) | diff --git a/samples/client/petstore/kotlin/docs/paths/petpetid/post/PetpetidPostPathParameters.md b/samples/client/petstore/kotlin/docs/paths/petpetid/post/PetpetidPostPathParameters.md deleted file mode 100644 index 55e9e695ee2..00000000000 --- a/samples/client/petstore/kotlin/docs/paths/petpetid/post/PetpetidPostPathParameters.md +++ /dev/null @@ -1,271 +0,0 @@ -# PetpetidPostPathParameters -public class PetpetidPostPathParameters
- -A class that contains necessary nested -- schema classes (which validate payloads), extends JsonSchema -- sealed interfaces which store validated payloads, java version of a sum type -- boxed classes which store validated payloads, sealed permits class implementations -- classes to store validated map payloads, extends FrozenMap -- classes to build inputs for map payloads - -## Nested Class Summary -| Modifier and Type | Class and Description | -| ----------------- | ---------------------- | -| sealed interface | [PetpetidPostPathParameters.PetpetidPostPathParameters1Boxed](#petpetidpostpathparameters1boxed)
sealed interface for validated payloads | -| record | [PetpetidPostPathParameters.PetpetidPostPathParameters1BoxedMap](#petpetidpostpathparameters1boxedmap)
boxed class to store validated Map payloads | -| static class | [PetpetidPostPathParameters.PetpetidPostPathParameters1](#petpetidpostpathparameters1)
schema class | -| static class | [PetpetidPostPathParameters.PathParametersMapBuilder](#pathparametersmapbuilder)
builder for Map payloads | -| static class | [PetpetidPostPathParameters.PathParametersMap](#pathparametersmap)
output class for Map payloads | -| sealed interface | [PetpetidPostPathParameters.AdditionalPropertiesBoxed](#additionalpropertiesboxed)
sealed interface for validated payloads | -| record | [PetpetidPostPathParameters.AdditionalPropertiesBoxedVoid](#additionalpropertiesboxedvoid)
boxed class to store validated null payloads | -| record | [PetpetidPostPathParameters.AdditionalPropertiesBoxedBoolean](#additionalpropertiesboxedboolean)
boxed class to store validated boolean payloads | -| record | [PetpetidPostPathParameters.AdditionalPropertiesBoxedNumber](#additionalpropertiesboxednumber)
boxed class to store validated Number payloads | -| record | [PetpetidPostPathParameters.AdditionalPropertiesBoxedString](#additionalpropertiesboxedstring)
boxed class to store validated String payloads | -| record | [PetpetidPostPathParameters.AdditionalPropertiesBoxedList](#additionalpropertiesboxedlist)
boxed class to store validated List payloads | -| record | [PetpetidPostPathParameters.AdditionalPropertiesBoxedMap](#additionalpropertiesboxedmap)
boxed class to store validated Map payloads | -| static class | [PetpetidPostPathParameters.AdditionalProperties](#additionalproperties)
schema class | - -## PetpetidPostPathParameters1Boxed -public sealed interface PetpetidPostPathParameters1Boxed
-permits
-[PetpetidPostPathParameters1BoxedMap](#petpetidpostpathparameters1boxedmap) - -sealed interface that stores validated payloads using boxed classes - -## PetpetidPostPathParameters1BoxedMap -public record PetpetidPostPathParameters1BoxedMap
-implements [PetpetidPostPathParameters1Boxed](#petpetidpostpathparameters1boxed) - -record that stores validated Map payloads, sealed permits implementation - -### Constructor Summary -| Constructor and Description | -| --------------------------- | -| PetpetidPostPathParameters1BoxedMap([PathParametersMap](#pathparametersmap) data)
Creates an instance, private visibility | - -### Method Summary -| Modifier and Type | Method and Description | -| ----------------- | ---------------------- | -| [PathParametersMap](#pathparametersmap) | data()
validated payload | -| @Nullable Object | getData()
validated payload | - -## PetpetidPostPathParameters1 -public static class PetpetidPostPathParameters1
-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.petpetid.post.PetpetidPostPathParameters; - -import java.util.Arrays; -import java.util.List; -import java.util.AbstractMap; - -static final SchemaConfiguration configuration = new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().build()); - -// Map validation -PetpetidPostPathParameters.PathParametersMap validatedPayload = - PetpetidPostPathParameters.PetpetidPostPathParameters1.validate( - new PetpetidPostPathParameters.PathParametersMapBuilder() - .petId(1L) - - .build(), - configuration -); -``` - -### Field Summary -| Modifier and Type | Field and Description | -| ----------------- | ---------------------- | -| Set> | type = Set.of(Map.class) | -| Map> | properties = Map.ofEntries(
    new PropertyEntry("petId", [Schema0.Schema01.class](../../../paths/petpetid/post/parameters/parameter0/Schema0.md#schema01))
)
| -| Set | required = Set.of(
    "petId"
)
| -| Class | additionalProperties = [AdditionalProperties.class](#additionalproperties) | - -### Method Summary -| Modifier and Type | Method and Description | -| ----------------- | ---------------------- | -| [PathParametersMap](#pathparametersmap) | validate([Map<?, ?>](#pathparametersmapbuilder) arg, SchemaConfiguration configuration) | -| [PetpetidPostPathParameters1BoxedMap](#petpetidpostpathparameters1boxedmap) | validateAndBox([Map<?, ?>](#pathparametersmapbuilder) arg, SchemaConfiguration configuration) | -| [PetpetidPostPathParameters1Boxed](#petpetidpostpathparameters1boxed) | validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) | -| @Nullable Object | validate(@Nullable Object arg, SchemaConfiguration configuration) | - -## PathParametersMap0Builder -public class PathParametersMap0Builder
-builder for `Map` - -A class that builds the Map input type - -### Constructor Summary -| Constructor and Description | -| --------------------------- | -| PathParametersMap0Builder(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 | - -## PathParametersMapBuilder -public class PathParametersMapBuilder
-builder for `Map` - -A class that builds the Map input type - -### Constructor Summary -| Constructor and Description | -| --------------------------- | -| PathParametersMapBuilder()
Creates a builder that contains an empty map | - -### Method Summary -| Modifier and Type | Method and Description | -| ----------------- | ---------------------- | -| [PathParametersMap0Builder](#pathparametersmap0builder) | petId(int value) | -| [PathParametersMap0Builder](#pathparametersmap0builder) | petId(float value) | -| [PathParametersMap0Builder](#pathparametersmap0builder) | petId(long value) | -| [PathParametersMap0Builder](#pathparametersmap0builder) | petId(double value) | - -## PathParametersMap -public static class PathParametersMap
-extends FrozenMap - -A class to store validated Map payloads - -### Method Summary -| Modifier and Type | Method and Description | -| ----------------- | ---------------------- | -| static [PathParametersMap](#pathparametersmap) | of([Map](#pathparametersmapbuilder) arg, SchemaConfiguration configuration) | -| Number | petId()
| - -## 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(Nothing? data)
Creates an instance, private visibility | - -### Method Summary -| Modifier and Type | Method and Description | -| ----------------- | ---------------------- | -| Nothing? | 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/kotlin/docs/paths/petpetid/post/PetpetidPostRequestBody.md b/samples/client/petstore/kotlin/docs/paths/petpetid/post/PetpetidPostRequestBody.md deleted file mode 100644 index b220010f891..00000000000 --- a/samples/client/petstore/kotlin/docs/paths/petpetid/post/PetpetidPostRequestBody.md +++ /dev/null @@ -1,90 +0,0 @@ -# PetpetidPostRequestBody - -public class PetpetidPostRequestBody - -A class that contains necessary nested request body classes -- SealedMediaType, a sealed interface which contains all the schema/encoding info for each contentType -- records which implement SealedMediaType, the concrete media types -- a class that extends RequestBodySerializer and is used to serialize input SealedRequestBody instances -- SealedRequestBody, a sealed interface which contains all the contentType/schema input types -- records which implement SealedRequestBody, the concrete request body types - -## Nested Class Summary -| Modifier and Type | Class and Description | -| ----------------- | --------------------- | -| sealed interface | [PetpetidPostRequestBody.SealedMediaType](#sealedmediatype)
media type sealed interface | -| record | [PetpetidPostRequestBody.ApplicationxwwwformurlencodedMediaType](#applicationxwwwformurlencodedmediatype)
record storing schema + encoding for a specific contentType | -| static class | [PetpetidPostRequestBody.PetpetidPostRequestBody1](#petpetidpostrequestbody1)
class that serializes request bodies | -| sealed interface | [PetpetidPostRequestBody.SealedRequestBody](#sealedrequestbody)
request body sealed interface | -| record | [PetpetidPostRequestBody.ApplicationxwwwformurlencodedRequestBody](#applicationxwwwformurlencodedrequestbody)
implements sealed interface to store request body input | - -## SealedMediaType -public sealed interface SealedMediaType
-permits
-[ApplicationxwwwformurlencodedMediaType](#applicationxwwwformurlencodedmediatype) - -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), Nothing?> - -class storing schema info for a specific contentType - -### Constructor Summary -| Constructor and Description | -| --------------------------- | -| ApplicationxwwwformurlencodedMediaType()
Creates an instance | - -### 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 | -| Nothing? | encoding()
the encoding info | - -## PetpetidPostRequestBody1 -public static class PetpetidPostRequestBody1
- -a class that serializes SealedRequestBody request bodies - -### Constructor Summary -| Constructor and Description | -| --------------------------- | -| PetpetidPostRequestBody1()
Creates an instance | - -### Field Summary -| Modifier and Type | Field and Description | -| ----------------- | --------------------- | -| boolean | required = false
whether the request body is required | -| Map | content = Map.ofEntries(
    new AbstractMap.SimpleEntry<>("application/x-www-form-urlencoded", new [ApplicationxwwwformurlencodedMediaType](#applicationxwwwformurlencodedmediatype)())
)
the contentType to schema info | - -### Method Summary -| Modifier and Type | Method and Description | -| ----------------- | ---------------------- | -| SerializedRequestBody | serialize([SealedRequestBody](#sealedrequestbody) requestBody)
called by endpoint when creating request body bytes | - -## SealedRequestBody -public sealed interface SealedRequestBody
-permits
-[ApplicationxwwwformurlencodedRequestBody](#applicationxwwwformurlencodedrequestbody) - -sealed interface that stores request contentType + validated schema data - -## ApplicationxwwwformurlencodedRequestBody -public record ApplicationxwwwformurlencodedRequestBody
-implements [SealedRequestBody](#sealedrequestbody),
-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 | - -### 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 | diff --git a/samples/client/petstore/kotlin/docs/paths/petpetid/post/PetpetidPostResponses.md b/samples/client/petstore/kotlin/docs/paths/petpetid/post/PetpetidPostResponses.md deleted file mode 100644 index 1372e9116b3..00000000000 --- a/samples/client/petstore/kotlin/docs/paths/petpetid/post/PetpetidPostResponses.md +++ /dev/null @@ -1,10 +0,0 @@ -# PetpetidPostResponses - -public class PetpetidPostResponses - -A class that contains necessary responses classes - -## Nested Class Summary -| Modifier and Type | Class and Description | -| ----------------- | --------------------- | - diff --git a/samples/client/petstore/kotlin/docs/paths/petpetid/post/PetpetidPostSecurityInfo.md b/samples/client/petstore/kotlin/docs/paths/petpetid/post/PetpetidPostSecurityInfo.md deleted file mode 100644 index 915b9ce6f7c..00000000000 --- a/samples/client/petstore/kotlin/docs/paths/petpetid/post/PetpetidPostSecurityInfo.md +++ /dev/null @@ -1,42 +0,0 @@ -# PetpetidPostSecurityInfo -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 -- an enum class that describes security index values - -## Nested Class Summary -| Modifier and Type | Class and Description | -| ----------------- | --------------------- | -| static class | [PetpetidPostSecurityInfo.PetpetidPostSecurityInfo1](#petpetidpostsecurityinfo1)
SecurityRequirementObjectProvider -| enum | [PetpetidPostSecurityInfo.SecurityIndex](#securityindex)
class that stores a security index | - -## PetpetidPostSecurityInfo1 -implements SecurityRequirementObjectProvider<[SecurityIndex](#securityindex)> - -### Constructor Summary -| Constructor and Description | -| --------------------------- | -| PetpetidPostSecurityInfo1()
Creates an instance | - -### Field Summary -| Modifier and Type | Field and Description | -| ----------------- | --------------------- | -| [PetpetidPostSecurityRequirementObject0](../../../paths/petpetid/post/security/PetpetidPostSecurityRequirementObject0.md) | security0 | -| [PetpetidPostSecurityRequirementObject1](../../../paths/petpetid/post/security/PetpetidPostSecurityRequirementObject1.md) | security1 | - -### Method Summary -| Modifier and Type | Method and Description | -| ----------------- | ---------------------- | -| SecurityRequirementObject | getSecurityRequirementObject(@Nullable [SecurityIndex](#securityindex) securityIndex)
If null is input, then the instance's securityIndex will be used | - -## SecurityIndex -enum SecurityIndex
- -### Enum Constant Summary -| Enum Constant And Description | -| ----------------------------- | -| SECURITY_0
security 0 | -| SECURITY_1
security 1 | diff --git a/samples/client/petstore/kotlin/docs/paths/petpetid/post/parameters/parameter0/Schema0.md b/samples/client/petstore/kotlin/docs/paths/petpetid/post/parameters/parameter0/Schema0.md deleted file mode 100644 index 55e4e5cb238..00000000000 --- a/samples/client/petstore/kotlin/docs/paths/petpetid/post/parameters/parameter0/Schema0.md +++ /dev/null @@ -1,49 +0,0 @@ -# Schema0 -public class Schema0
- -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 - -## Nested Class Summary -| Modifier and Type | Class and Description | -| ----------------- | ---------------------- | -| sealed interface | [Schema0.Schema01Boxed](#schema01boxed)
sealed interface for validated payloads | -| record | [Schema0.Schema01BoxedNumber](#schema01boxednumber)
boxed class to store validated Number payloads | -| static class | [Schema0.Schema01](#schema01)
schema class | - -## Schema01Boxed -public sealed interface Schema01Boxed
-permits
-[Schema01BoxedNumber](#schema01boxednumber) - -sealed interface that stores validated payloads using boxed classes - -## Schema01BoxedNumber -public record Schema01BoxedNumber
-implements [Schema01Boxed](#schema01boxed) - -record that stores validated Number payloads, sealed permits implementation - -### Constructor Summary -| Constructor and Description | -| --------------------------- | -| Schema01BoxedNumber(Number data)
Creates an instance, private visibility | - -### Method Summary -| Modifier and Type | Method and Description | -| ----------------- | ---------------------- | -| Number | data()
validated payload | -| @Nullable Object | getData()
validated payload | - -## Schema01 -public static class Schema01
-extends Int64JsonSchema.Int64JsonSchema1 - -A schema class that validates payloads - -| Methods Inherited from class org.openapijsonschematools.client.schemas.Int64JsonSchema.Int64JsonSchema1 | -| ------------------------------------------------------------------ | -| validate | -| validateAndBox | diff --git a/samples/client/petstore/kotlin/docs/paths/petpetid/post/requestbody/content/applicationxwwwformurlencoded/ApplicationxwwwformurlencodedSchema.md b/samples/client/petstore/kotlin/docs/paths/petpetid/post/requestbody/content/applicationxwwwformurlencoded/ApplicationxwwwformurlencodedSchema.md deleted file mode 100644 index 9a55a49da6a..00000000000 --- a/samples/client/petstore/kotlin/docs/paths/petpetid/post/requestbody/content/applicationxwwwformurlencoded/ApplicationxwwwformurlencodedSchema.md +++ /dev/null @@ -1,214 +0,0 @@ -# ApplicationxwwwformurlencodedSchema -public class ApplicationxwwwformurlencodedSchema
- -A class that contains necessary nested -- schema classes (which validate payloads), extends JsonSchema -- sealed interfaces which store validated payloads, java version of a sum type -- boxed classes which store validated payloads, sealed permits class implementations -- classes to store validated map payloads, extends FrozenMap -- classes to build inputs for map payloads - -## Nested Class Summary -| Modifier and Type | Class and Description | -| ----------------- | ---------------------- | -| sealed interface | [ApplicationxwwwformurlencodedSchema.ApplicationxwwwformurlencodedSchema1Boxed](#applicationxwwwformurlencodedschema1boxed)
sealed interface for validated payloads | -| record | [ApplicationxwwwformurlencodedSchema.ApplicationxwwwformurlencodedSchema1BoxedMap](#applicationxwwwformurlencodedschema1boxedmap)
boxed class to store validated Map payloads | -| static class | [ApplicationxwwwformurlencodedSchema.ApplicationxwwwformurlencodedSchema1](#applicationxwwwformurlencodedschema1)
schema class | -| static class | [ApplicationxwwwformurlencodedSchema.ApplicationxwwwformurlencodedSchemaMapBuilder](#applicationxwwwformurlencodedschemamapbuilder)
builder for Map payloads | -| static class | [ApplicationxwwwformurlencodedSchema.ApplicationxwwwformurlencodedSchemaMap](#applicationxwwwformurlencodedschemamap)
output class for Map payloads | -| sealed interface | [ApplicationxwwwformurlencodedSchema.ApplicationxwwwformurlencodedStatusBoxed](#applicationxwwwformurlencodedstatusboxed)
sealed interface for validated payloads | -| record | [ApplicationxwwwformurlencodedSchema.ApplicationxwwwformurlencodedStatusBoxedString](#applicationxwwwformurlencodedstatusboxedstring)
boxed class to store validated String payloads | -| static class | [ApplicationxwwwformurlencodedSchema.ApplicationxwwwformurlencodedStatus](#applicationxwwwformurlencodedstatus)
schema class | -| sealed interface | [ApplicationxwwwformurlencodedSchema.ApplicationxwwwformurlencodedNameBoxed](#applicationxwwwformurlencodednameboxed)
sealed interface for validated payloads | -| record | [ApplicationxwwwformurlencodedSchema.ApplicationxwwwformurlencodedNameBoxedString](#applicationxwwwformurlencodednameboxedstring)
boxed class to store validated String payloads | -| static class | [ApplicationxwwwformurlencodedSchema.ApplicationxwwwformurlencodedName](#applicationxwwwformurlencodedname)
schema class | - -## ApplicationxwwwformurlencodedSchema1Boxed -public sealed interface ApplicationxwwwformurlencodedSchema1Boxed
-permits
-[ApplicationxwwwformurlencodedSchema1BoxedMap](#applicationxwwwformurlencodedschema1boxedmap) - -sealed interface that stores validated payloads using boxed classes - -## ApplicationxwwwformurlencodedSchema1BoxedMap -public record ApplicationxwwwformurlencodedSchema1BoxedMap
-implements [ApplicationxwwwformurlencodedSchema1Boxed](#applicationxwwwformurlencodedschema1boxed) - -record that stores validated Map payloads, sealed permits implementation - -### Constructor Summary -| Constructor and Description | -| --------------------------- | -| ApplicationxwwwformurlencodedSchema1BoxedMap([ApplicationxwwwformurlencodedSchemaMap](#applicationxwwwformurlencodedschemamap) data)
Creates an instance, private visibility | - -### Method Summary -| Modifier and Type | Method and Description | -| ----------------- | ---------------------- | -| [ApplicationxwwwformurlencodedSchemaMap](#applicationxwwwformurlencodedschemamap) | data()
validated payload | -| @Nullable Object | getData()
validated payload | - -## ApplicationxwwwformurlencodedSchema1 -public static class ApplicationxwwwformurlencodedSchema1
-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.petpetid.post.requestbody.content.applicationxwwwformurlencoded.ApplicationxwwwformurlencodedSchema; - -import java.util.Arrays; -import java.util.List; -import java.util.AbstractMap; - -static final SchemaConfiguration configuration = new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().build()); - -// Map validation -ApplicationxwwwformurlencodedSchema.ApplicationxwwwformurlencodedSchemaMap validatedPayload = - ApplicationxwwwformurlencodedSchema.ApplicationxwwwformurlencodedSchema1.validate( - new ApplicationxwwwformurlencodedSchema.ApplicationxwwwformurlencodedSchemaMapBuilder() - .name("a") - - .status("a") - - .build(), - configuration -); -``` - -### Field Summary -| Modifier and Type | Field and Description | -| ----------------- | ---------------------- | -| Set> | type = Set.of(Map.class) | -| Map> | properties = Map.ofEntries(
    new PropertyEntry("name", [ApplicationxwwwformurlencodedName.class](#applicationxwwwformurlencodedname))),
    new PropertyEntry("status", [ApplicationxwwwformurlencodedStatus.class](#applicationxwwwformurlencodedstatus)))
)
| - -### Method Summary -| Modifier and Type | Method and Description | -| ----------------- | ---------------------- | -| [ApplicationxwwwformurlencodedSchemaMap](#applicationxwwwformurlencodedschemamap) | validate([Map<?, ?>](#applicationxwwwformurlencodedschemamapbuilder) arg, SchemaConfiguration configuration) | -| [ApplicationxwwwformurlencodedSchema1BoxedMap](#applicationxwwwformurlencodedschema1boxedmap) | validateAndBox([Map<?, ?>](#applicationxwwwformurlencodedschemamapbuilder) arg, SchemaConfiguration configuration) | -| [ApplicationxwwwformurlencodedSchema1Boxed](#applicationxwwwformurlencodedschema1boxed) | validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) | -| @Nullable Object | validate(@Nullable Object arg, SchemaConfiguration configuration) | - -## ApplicationxwwwformurlencodedSchemaMapBuilder -public class ApplicationxwwwformurlencodedSchemaMapBuilder
-builder for `Map` - -A class that builds the Map input type - -### Constructor Summary -| Constructor and Description | -| --------------------------- | -| ApplicationxwwwformurlencodedSchemaMapBuilder()
Creates a builder that contains an empty map | - -### Method Summary -| Modifier and Type | Method and Description | -| ----------------- | ---------------------- | -| Map | build()
Returns map input that should be used with Schema.validate | -| [ApplicationxwwwformurlencodedSchemaMapBuilder](#applicationxwwwformurlencodedschemamapbuilder) | name(String value) | -| [ApplicationxwwwformurlencodedSchemaMapBuilder](#applicationxwwwformurlencodedschemamapbuilder) | status(String value) | -| [ApplicationxwwwformurlencodedSchemaMapBuilder](#applicationxwwwformurlencodedschemamapbuilder) | additionalProperty(String key, Nothing? value) | -| [ApplicationxwwwformurlencodedSchemaMapBuilder](#applicationxwwwformurlencodedschemamapbuilder) | additionalProperty(String key, boolean value) | -| [ApplicationxwwwformurlencodedSchemaMapBuilder](#applicationxwwwformurlencodedschemamapbuilder) | additionalProperty(String key, String value) | -| [ApplicationxwwwformurlencodedSchemaMapBuilder](#applicationxwwwformurlencodedschemamapbuilder) | additionalProperty(String key, int value) | -| [ApplicationxwwwformurlencodedSchemaMapBuilder](#applicationxwwwformurlencodedschemamapbuilder) | additionalProperty(String key, float value) | -| [ApplicationxwwwformurlencodedSchemaMapBuilder](#applicationxwwwformurlencodedschemamapbuilder) | additionalProperty(String key, long value) | -| [ApplicationxwwwformurlencodedSchemaMapBuilder](#applicationxwwwformurlencodedschemamapbuilder) | additionalProperty(String key, double value) | -| [ApplicationxwwwformurlencodedSchemaMapBuilder](#applicationxwwwformurlencodedschemamapbuilder) | additionalProperty(String key, List value) | -| [ApplicationxwwwformurlencodedSchemaMapBuilder](#applicationxwwwformurlencodedschemamapbuilder) | additionalProperty(String key, Map value) | - -## ApplicationxwwwformurlencodedSchemaMap -public static class ApplicationxwwwformurlencodedSchemaMap
-extends FrozenMap - -A class to store validated Map payloads - -### Method Summary -| Modifier and Type | Method and Description | -| ----------------- | ---------------------- | -| static [ApplicationxwwwformurlencodedSchemaMap](#applicationxwwwformurlencodedschemamap) | of([Map](#applicationxwwwformurlencodedschemamapbuilder) arg, SchemaConfiguration configuration) | -| String | name()
[optional] | -| String | status()
[optional] | -| @Nullable Object | getAdditionalProperty(String name)
provides type safety for additional properties | - -## ApplicationxwwwformurlencodedStatusBoxed -public sealed interface ApplicationxwwwformurlencodedStatusBoxed
-permits
-[ApplicationxwwwformurlencodedStatusBoxedString](#applicationxwwwformurlencodedstatusboxedstring) - -sealed interface that stores validated payloads using boxed classes - -## ApplicationxwwwformurlencodedStatusBoxedString -public record ApplicationxwwwformurlencodedStatusBoxedString
-implements [ApplicationxwwwformurlencodedStatusBoxed](#applicationxwwwformurlencodedstatusboxed) - -record that stores validated String payloads, sealed permits implementation - -### Constructor Summary -| Constructor and Description | -| --------------------------- | -| ApplicationxwwwformurlencodedStatusBoxedString(String data)
Creates an instance, private visibility | - -### Method Summary -| Modifier and Type | Method and Description | -| ----------------- | ---------------------- | -| String | data()
validated payload | -| @Nullable Object | getData()
validated payload | - -## ApplicationxwwwformurlencodedStatus -public static class ApplicationxwwwformurlencodedStatus
-extends StringJsonSchema.StringJsonSchema1 - -A schema class that validates payloads - -## Description -Updated status of the pet - -| Methods Inherited from class org.openapijsonschematools.client.schemas.StringJsonSchema.StringJsonSchema1 | -| ------------------------------------------------------------------ | -| validate | -| validateAndBox | - -## ApplicationxwwwformurlencodedNameBoxed -public sealed interface ApplicationxwwwformurlencodedNameBoxed
-permits
-[ApplicationxwwwformurlencodedNameBoxedString](#applicationxwwwformurlencodednameboxedstring) - -sealed interface that stores validated payloads using boxed classes - -## ApplicationxwwwformurlencodedNameBoxedString -public record ApplicationxwwwformurlencodedNameBoxedString
-implements [ApplicationxwwwformurlencodedNameBoxed](#applicationxwwwformurlencodednameboxed) - -record that stores validated String payloads, sealed permits implementation - -### Constructor Summary -| Constructor and Description | -| --------------------------- | -| ApplicationxwwwformurlencodedNameBoxedString(String data)
Creates an instance, private visibility | - -### Method Summary -| Modifier and Type | Method and Description | -| ----------------- | ---------------------- | -| String | data()
validated payload | -| @Nullable Object | getData()
validated payload | - -## ApplicationxwwwformurlencodedName -public static class ApplicationxwwwformurlencodedName
-extends StringJsonSchema.StringJsonSchema1 - -A schema class that validates payloads - -## Description -Updated name of the pet - -| Methods Inherited from class org.openapijsonschematools.client.schemas.StringJsonSchema.StringJsonSchema1 | -| ------------------------------------------------------------------ | -| validate | -| validateAndBox | diff --git a/samples/client/petstore/kotlin/docs/paths/petpetid/post/responses/PetpetidPostCode405Response.md b/samples/client/petstore/kotlin/docs/paths/petpetid/post/responses/PetpetidPostCode405Response.md deleted file mode 100644 index b3693ccc7cd..00000000000 --- a/samples/client/petstore/kotlin/docs/paths/petpetid/post/responses/PetpetidPostCode405Response.md +++ /dev/null @@ -1,32 +0,0 @@ -# PetpetidPostCode405Response - -public class PetpetidPostCode405Response - -A class that contains necessary nested response classes -- a class that extends ResponseDeserializer and is used to deserialize responses - -## Nested Class Summary -| Modifier and Type | Class and Description | -| ----------------- | --------------------- | -| static class | [PetpetidPostCode405Response.PetpetidPostCode405Response1](#petpetidpostcode405response1)
class that deserializes responses | - -## PetpetidPostCode405Response1 -public static class PetpetidPostCode405Response1
-extends ResponseDeserializer - -a class that deserializes responses - -### Constructor Summary -| Constructor and Description | -| --------------------------- | -| PetpetidPostCode405Response1()
Creates an instance | - -### Field Summary -| Modifier and Type | Field and Description | -| ----------------- | --------------------- | -| Map | content = MapUtils.makeMap(
)
the contentType to schema info | - -### Method Summary -| Modifier and Type | Method and Description | -| ----------------- | ---------------------- | -| ApiResponse | deserialize(HttpResponse response, SchemaConfiguration configuration)
called by endpoint when deserialize responses | diff --git a/samples/client/petstore/kotlin/docs/paths/petpetid/post/security/PetpetidPostSecurityRequirementObject0.md b/samples/client/petstore/kotlin/docs/paths/petpetid/post/security/PetpetidPostSecurityRequirementObject0.md deleted file mode 100644 index 0e8d3540345..00000000000 --- a/samples/client/petstore/kotlin/docs/paths/petpetid/post/security/PetpetidPostSecurityRequirementObject0.md +++ /dev/null @@ -1,15 +0,0 @@ -# PetpetidPostSecurityRequirementObject0 -PetpetidPostSecurityRequirementObject0.java - -public class PetpetidPostSecurityRequirementObject0 -extends SecurityRequirementObject - -### Constructor Summary -| Constructor and Description | -| --------------------------- | -| PetpetidPostSecurityRequirementObject0()
Creates an instance | - -### 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()
    )) | diff --git a/samples/client/petstore/kotlin/docs/paths/petpetid/post/security/PetpetidPostSecurityRequirementObject1.md b/samples/client/petstore/kotlin/docs/paths/petpetid/post/security/PetpetidPostSecurityRequirementObject1.md deleted file mode 100644 index fb9621d4c1e..00000000000 --- a/samples/client/petstore/kotlin/docs/paths/petpetid/post/security/PetpetidPostSecurityRequirementObject1.md +++ /dev/null @@ -1,15 +0,0 @@ -# PetpetidPostSecurityRequirementObject1 -PetpetidPostSecurityRequirementObject1.java - -public class PetpetidPostSecurityRequirementObject1 -extends SecurityRequirementObject - -### Constructor Summary -| Constructor and Description | -| --------------------------- | -| PetpetidPostSecurityRequirementObject1()
Creates an instance | - -### 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")
    )) | diff --git a/samples/client/petstore/kotlin/docs/paths/petpetiduploadimage/PetpetiduploadimagePost.md b/samples/client/petstore/kotlin/docs/paths/petpetiduploadimage/PetpetiduploadimagePost.md deleted file mode 100644 index 53d0aedf3a0..00000000000 --- a/samples/client/petstore/kotlin/docs/paths/petpetiduploadimage/PetpetiduploadimagePost.md +++ /dev/null @@ -1,203 +0,0 @@ -# PetpetiduploadimagePost - -public class PetpetiduploadimagePost - -A class that contains necessary endpoint classes -- a class that calls the endpoint method using the http verb -- a class that calls the endpoint method using the operationId name -- class(es) to store the request inputs -- builder(s) to set the request input data - -## Nested Class Summary -| Modifier and Type | Class and Description | -| ----------------- | --------------------- | -| static class | [Post](#post)
The class that has a post method to call the endpoint | -| interface | [UploadImageOperation](#uploadimageoperation)
The interface that has a uploadImage method to call the endpoint | -| static class | [PostRequest](#postrequest)
The final request inputs class | -| static class | [PostNullableRequest](#postnullablerequest)
The initial request inputs class | -| static class | [Post0RequestBuilder](#post0requestbuilder)
A builder for the request input class | -| static class | [PostRequestBuilder](#postrequestbuilder)
A builder for the request input class | - -## Post -public static class Post 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.PetpetiduploadimagePostRequestBody; -import org.openapijsonschematools.client.RootServerInfo; -import org.openapijsonschematools.client.paths.petpetiduploadimage.post.PetpetiduploadimagePostSecurityInfo; -import org.openapijsonschematools.client.paths.petpetiduploadimage.post.PetpetiduploadimagePostPathParameters; -import org.openapijsonschematools.client.servers.RootServer0; -import org.openapijsonschematools.client.servers.RootServer1; -import org.openapijsonschematools.client.servers.RootServer2; -import org.openapijsonschematools.client.securityschemes.SecurityScheme; -import org.openapijsonschematools.client.components.securityschemes.PetstoreAuth; -import org.openapijsonschematools.client.paths.petpetiduploadimage.post.responses.PetpetiduploadimagePostCode200Response; -import org.openapijsonschematools.client.components.responses.successwithjsonapiresponse.SuccessWithJsonApiResponseHeadersSchema; -import org.openapijsonschematools.client.servers.RootServerInfo; -import org.openapijsonschematools.client.paths.petpetiduploadimage.PetpetiduploadimagePost; -import org.openapijsonschematools.client.paths.petpetiduploadimage.post.PetpetiduploadimagePostResponses; - -import java.io.IOException; -import java.util.Arrays; -import java.util.List; -import java.util.Map; -import java.util.AbstractMap; - -// if you want to use a server that is not SERVER_0 pass it in here and change the ServerIndex input below -ApiConfiguration.ServerInfo serverInfo = new ApiConfiguration.ServerInfoBuilder() - .rootServerInfo( - new RootServerInfo.RootServerInfoBuilder() - .rootServer0(new RootServer0()) - .build() - ) - .build(); -ApiConfiguration.ServerIndexInfo serverIndexInfo = new ApiConfiguration.ServerIndexInfoBuilder() - .rootServerInfoServerIndex(RootServerInfo.ServerIndex.SERVER_0) - .build(); -List securitySchemes = new ArrayList(); -ApiConfiguration.SecurityIndexInfo securityIndexInfo = new ApiConfiguration.SecurityIndexInfoBuilder() - .petpetiduploadimagePostSecurityRequirementObject0SecurityIndex(PetpetiduploadimagePostSecurityRequirementObject0.SecurityIndex.SECURITY_0) - .build(); -Duration timeout = Duration.ofSeconds(1L); -Map> defaultHeaders = Map.of("User-Agent", List.of("OpenAPI-JSON-Schema-Generator/1.0.0/java")); -ApiConfiguration apiConfiguration = new ApiConfiguration( - serverInfo - serverIndexInfo, - securitySchemes, - securityIndexInfo, - timeout, - defaultHeaders -); -SchemaConfiguration schemaConfiguration = new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().build()); -PetpetiduploadimagePost.Post apiClient = new PetpetiduploadimagePost.Post(apiConfiguration, schemaConfiguration); - - -// Map validation -PetpetiduploadimagePostPathParameters.PathParametersMap pathParameters = - PetpetiduploadimagePostPathParameters.PetpetiduploadimagePostPathParameters1.validate( - new PetpetiduploadimagePostPathParameters.PathParametersMapBuilder() - .petId(1L) - - .build(), - schemaConfiguration -); - -var request = new PetpetiduploadimagePost.PostRequestBuilder() - .pathParameters(pathParameters) - .build(); - -PetpetiduploadimagePostResponses.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; -} -PetpetiduploadimagePostResponses.EndpointPetpetiduploadimagePostCode200Response castResponse = (PetpetiduploadimagePostResponses.EndpointPetpetiduploadimagePostCode200Response) response; -} -``` -### Constructor Summary -| Constructor and Description | -| --------------------------- | -| Post(ApiConfiguration apiConfiguration, SchemaConfiguration schemaConfiguration)
Creates an instance | - -### Method Summary -| Modifier and Type | Method and Description | -| ----------------- | ---------------------- | -| [PetpetiduploadimagePostResponses.EndpointResponse](../../paths/petpetiduploadimage/post/PetpetiduploadimagePostResponses.md#endpointresponse) | post([PostRequest](#postrequest) request) | - -## UploadImageOperation -public interface UploadImageOperation
- -an interface that allows one to call the endpoint using a method named uploadImage by the operationId - -### Method Summary -| Modifier and Type | Method and Description | -| ----------------- | ---------------------- | -| [PetpetiduploadimagePostResponses.EndpointResponse](../../paths/petpetiduploadimage/post/PetpetiduploadimagePostResponses.md#endpointresponse) | uploadImage([PostRequest](#postrequest) request) | - -## PostRequest -public static class PostRequest
- -a class that stores the final request inputs - -### Field Summary -| Modifier and Type | Field and Description | -| ----------------- | --------------------- | -| [PetpetiduploadimagePostPathParameters.PathParametersMap](../../paths/petpetiduploadimage/post/PetpetiduploadimagePostPathParameters.md#pathparametersmap) | pathParameters | -| [PetpetiduploadimagePostRequestBody.@Nullable SealedRequestBody](../../paths/petpetiduploadimage/post/PetpetiduploadimagePostRequestBody.md#sealedrequestbody) | requestBody
optional | -| [RootServerInfo.@Nullable ServerIndex](../../RootServerInfo.md#serverindex) | serverIndex
optional. Note: this will override the value in apiConfiguration | -| [PetpetiduploadimagePostSecurityInfo.@Nullable SecurityIndex](../../paths/petpetiduploadimage/post/PetpetiduploadimagePostSecurityInfo.md#securityindex) | securityIndex
optional. Note: this will override the value in apiConfiguration | -| @Nullable Duration | timeout
optional. Note: this will override the value in apiConfiguration | - -## PostNullableRequest -public static class PostNullableRequest
- -a class that stores the initial request inputs - -### Field Summary -| Modifier and Type | Field and Description | -| ----------------- | --------------------- | -| [PetpetiduploadimagePostPathParameters.@Nullable PathParametersMap](../../paths/petpetiduploadimage/post/PetpetiduploadimagePostPathParameters.md#pathparametersmap) | pathParameters | -| [PetpetiduploadimagePostRequestBody.@Nullable SealedRequestBody](../../paths/petpetiduploadimage/post/PetpetiduploadimagePostRequestBody.md#sealedrequestbody) | requestBody | -| [RootServerInfo.@Nullable ServerIndex](../../RootServerInfo.md#serverindex) | serverIndex | -| [PetpetiduploadimagePostSecurityInfo.@Nullable SecurityIndex](../../paths/petpetiduploadimage/post/PetpetiduploadimagePostSecurityInfo.md#securityindex) | securityIndex | -| @Nullable Duration | timeout | - -## Post0RequestBuilder -public static class Post0RequestBuilder
- -a builder for request inputs - -### Constructor Summary -| Constructor and Description | -| --------------------------- | -| Post0RequestBuilder(Post0RequestBuilder instance)
Creates a builder that contains the passed instance | - -### Method Summary -| Modifier and Type | Method and Description | -| ----------------- | ---------------------- | -| [PostRequest](#postrequest) | build()
Returns the request input used to call an endpoint method | -| [Post0RequestBuilder](#post0requestbuilder) | requestBody([PetpetiduploadimagePostRequestBody.SealedRequestBody](../../paths/petpetiduploadimage/post/PetpetiduploadimagePostRequestBody.md#sealedrequestbody) requestBody)
sets the optional property | -| [Post0RequestBuilder](#post0requestbuilder) | serverIndex([RootServerInfo.ServerIndex](../../RootServerInfo.md#serverindex) serverIndex)
sets the optional property. Note: this will override the value in apiConfiguration | -| [Post0RequestBuilder](#post0requestbuilder) | securityIndex([PetpetiduploadimagePostSecurityInfo.SecurityIndex](../../paths/petpetiduploadimage/post/PetpetiduploadimagePostSecurityInfo.md#securityindex) securityIndex)
sets the optional property. Note: this will override the value in apiConfiguration | -| [Post0RequestBuilder](#post0requestbuilder) | timeout(Duration timeout)
sets the optional property. Note: this will override the value in apiConfiguration | - -## PostRequestBuilder -public static class PostRequestBuilder
- -a builder for request inputs - -### Constructor Summary -| Constructor and Description | -| --------------------------- | -| PostRequestBuilder()
Creates a builder that contains null for all parameters | - -### Method Summary -| Modifier and Type | Method and Description | -| ----------------- | ---------------------- | -| [Post0RequestBuilder](#post0requestbuilder) | pathParameters([PetpetiduploadimagePostPathParametersPathParametersMap](../../paths/petpetiduploadimage/post/PetpetiduploadimagePostPathParameters.md#pathparametersmap) pathParameters)
sets the property | - -[[Back to top]](#top) [[Back to README]](../../../README.md) diff --git a/samples/client/petstore/kotlin/docs/paths/petpetiduploadimage/post/PetpetiduploadimagePostPathParameters.md b/samples/client/petstore/kotlin/docs/paths/petpetiduploadimage/post/PetpetiduploadimagePostPathParameters.md deleted file mode 100644 index 2ab0aa08198..00000000000 --- a/samples/client/petstore/kotlin/docs/paths/petpetiduploadimage/post/PetpetiduploadimagePostPathParameters.md +++ /dev/null @@ -1,271 +0,0 @@ -# PetpetiduploadimagePostPathParameters -public class PetpetiduploadimagePostPathParameters
- -A class that contains necessary nested -- schema classes (which validate payloads), extends JsonSchema -- sealed interfaces which store validated payloads, java version of a sum type -- boxed classes which store validated payloads, sealed permits class implementations -- classes to store validated map payloads, extends FrozenMap -- classes to build inputs for map payloads - -## Nested Class Summary -| Modifier and Type | Class and Description | -| ----------------- | ---------------------- | -| sealed interface | [PetpetiduploadimagePostPathParameters.PetpetiduploadimagePostPathParameters1Boxed](#petpetiduploadimagepostpathparameters1boxed)
sealed interface for validated payloads | -| record | [PetpetiduploadimagePostPathParameters.PetpetiduploadimagePostPathParameters1BoxedMap](#petpetiduploadimagepostpathparameters1boxedmap)
boxed class to store validated Map payloads | -| static class | [PetpetiduploadimagePostPathParameters.PetpetiduploadimagePostPathParameters1](#petpetiduploadimagepostpathparameters1)
schema class | -| static class | [PetpetiduploadimagePostPathParameters.PathParametersMapBuilder](#pathparametersmapbuilder)
builder for Map payloads | -| static class | [PetpetiduploadimagePostPathParameters.PathParametersMap](#pathparametersmap)
output class for Map payloads | -| sealed interface | [PetpetiduploadimagePostPathParameters.AdditionalPropertiesBoxed](#additionalpropertiesboxed)
sealed interface for validated payloads | -| record | [PetpetiduploadimagePostPathParameters.AdditionalPropertiesBoxedVoid](#additionalpropertiesboxedvoid)
boxed class to store validated null payloads | -| record | [PetpetiduploadimagePostPathParameters.AdditionalPropertiesBoxedBoolean](#additionalpropertiesboxedboolean)
boxed class to store validated boolean payloads | -| record | [PetpetiduploadimagePostPathParameters.AdditionalPropertiesBoxedNumber](#additionalpropertiesboxednumber)
boxed class to store validated Number payloads | -| record | [PetpetiduploadimagePostPathParameters.AdditionalPropertiesBoxedString](#additionalpropertiesboxedstring)
boxed class to store validated String payloads | -| record | [PetpetiduploadimagePostPathParameters.AdditionalPropertiesBoxedList](#additionalpropertiesboxedlist)
boxed class to store validated List payloads | -| record | [PetpetiduploadimagePostPathParameters.AdditionalPropertiesBoxedMap](#additionalpropertiesboxedmap)
boxed class to store validated Map payloads | -| static class | [PetpetiduploadimagePostPathParameters.AdditionalProperties](#additionalproperties)
schema class | - -## PetpetiduploadimagePostPathParameters1Boxed -public sealed interface PetpetiduploadimagePostPathParameters1Boxed
-permits
-[PetpetiduploadimagePostPathParameters1BoxedMap](#petpetiduploadimagepostpathparameters1boxedmap) - -sealed interface that stores validated payloads using boxed classes - -## PetpetiduploadimagePostPathParameters1BoxedMap -public record PetpetiduploadimagePostPathParameters1BoxedMap
-implements [PetpetiduploadimagePostPathParameters1Boxed](#petpetiduploadimagepostpathparameters1boxed) - -record that stores validated Map payloads, sealed permits implementation - -### Constructor Summary -| Constructor and Description | -| --------------------------- | -| PetpetiduploadimagePostPathParameters1BoxedMap([PathParametersMap](#pathparametersmap) data)
Creates an instance, private visibility | - -### Method Summary -| Modifier and Type | Method and Description | -| ----------------- | ---------------------- | -| [PathParametersMap](#pathparametersmap) | data()
validated payload | -| @Nullable Object | getData()
validated payload | - -## PetpetiduploadimagePostPathParameters1 -public static class PetpetiduploadimagePostPathParameters1
-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.petpetiduploadimage.post.PetpetiduploadimagePostPathParameters; - -import java.util.Arrays; -import java.util.List; -import java.util.AbstractMap; - -static final SchemaConfiguration configuration = new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().build()); - -// Map validation -PetpetiduploadimagePostPathParameters.PathParametersMap validatedPayload = - PetpetiduploadimagePostPathParameters.PetpetiduploadimagePostPathParameters1.validate( - new PetpetiduploadimagePostPathParameters.PathParametersMapBuilder() - .petId(1L) - - .build(), - configuration -); -``` - -### Field Summary -| Modifier and Type | Field and Description | -| ----------------- | ---------------------- | -| Set> | type = Set.of(Map.class) | -| Map> | properties = Map.ofEntries(
    new PropertyEntry("petId", [Schema0.Schema01.class](../../../paths/petpetiduploadimage/post/parameters/parameter0/Schema0.md#schema01))
)
| -| Set | required = Set.of(
    "petId"
)
| -| Class | additionalProperties = [AdditionalProperties.class](#additionalproperties) | - -### Method Summary -| Modifier and Type | Method and Description | -| ----------------- | ---------------------- | -| [PathParametersMap](#pathparametersmap) | validate([Map<?, ?>](#pathparametersmapbuilder) arg, SchemaConfiguration configuration) | -| [PetpetiduploadimagePostPathParameters1BoxedMap](#petpetiduploadimagepostpathparameters1boxedmap) | validateAndBox([Map<?, ?>](#pathparametersmapbuilder) arg, SchemaConfiguration configuration) | -| [PetpetiduploadimagePostPathParameters1Boxed](#petpetiduploadimagepostpathparameters1boxed) | validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) | -| @Nullable Object | validate(@Nullable Object arg, SchemaConfiguration configuration) | - -## PathParametersMap0Builder -public class PathParametersMap0Builder
-builder for `Map` - -A class that builds the Map input type - -### Constructor Summary -| Constructor and Description | -| --------------------------- | -| PathParametersMap0Builder(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 | - -## PathParametersMapBuilder -public class PathParametersMapBuilder
-builder for `Map` - -A class that builds the Map input type - -### Constructor Summary -| Constructor and Description | -| --------------------------- | -| PathParametersMapBuilder()
Creates a builder that contains an empty map | - -### Method Summary -| Modifier and Type | Method and Description | -| ----------------- | ---------------------- | -| [PathParametersMap0Builder](#pathparametersmap0builder) | petId(int value) | -| [PathParametersMap0Builder](#pathparametersmap0builder) | petId(float value) | -| [PathParametersMap0Builder](#pathparametersmap0builder) | petId(long value) | -| [PathParametersMap0Builder](#pathparametersmap0builder) | petId(double value) | - -## PathParametersMap -public static class PathParametersMap
-extends FrozenMap - -A class to store validated Map payloads - -### Method Summary -| Modifier and Type | Method and Description | -| ----------------- | ---------------------- | -| static [PathParametersMap](#pathparametersmap) | of([Map](#pathparametersmapbuilder) arg, SchemaConfiguration configuration) | -| Number | petId()
| - -## 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(Nothing? data)
Creates an instance, private visibility | - -### Method Summary -| Modifier and Type | Method and Description | -| ----------------- | ---------------------- | -| Nothing? | 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/kotlin/docs/paths/petpetiduploadimage/post/PetpetiduploadimagePostRequestBody.md b/samples/client/petstore/kotlin/docs/paths/petpetiduploadimage/post/PetpetiduploadimagePostRequestBody.md deleted file mode 100644 index 7f856bff9b9..00000000000 --- a/samples/client/petstore/kotlin/docs/paths/petpetiduploadimage/post/PetpetiduploadimagePostRequestBody.md +++ /dev/null @@ -1,90 +0,0 @@ -# PetpetiduploadimagePostRequestBody - -public class PetpetiduploadimagePostRequestBody - -A class that contains necessary nested request body classes -- SealedMediaType, a sealed interface which contains all the schema/encoding info for each contentType -- records which implement SealedMediaType, the concrete media types -- a class that extends RequestBodySerializer and is used to serialize input SealedRequestBody instances -- SealedRequestBody, a sealed interface which contains all the contentType/schema input types -- records which implement SealedRequestBody, the concrete request body types - -## Nested Class Summary -| Modifier and Type | Class and Description | -| ----------------- | --------------------- | -| sealed interface | [PetpetiduploadimagePostRequestBody.SealedMediaType](#sealedmediatype)
media type sealed interface | -| record | [PetpetiduploadimagePostRequestBody.MultipartformdataMediaType](#multipartformdatamediatype)
record storing schema + encoding for a specific contentType | -| static class | [PetpetiduploadimagePostRequestBody.PetpetiduploadimagePostRequestBody1](#petpetiduploadimagepostrequestbody1)
class that serializes request bodies | -| sealed interface | [PetpetiduploadimagePostRequestBody.SealedRequestBody](#sealedrequestbody)
request body sealed interface | -| record | [PetpetiduploadimagePostRequestBody.MultipartformdataRequestBody](#multipartformdatarequestbody)
implements sealed interface to store request body input | - -## SealedMediaType -public sealed interface SealedMediaType
-permits
-[MultipartformdataMediaType](#multipartformdatamediatype) - -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), Nothing?> - -class storing schema info for a specific contentType - -### Constructor Summary -| Constructor and Description | -| --------------------------- | -| MultipartformdataMediaType()
Creates an instance | - -### 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 | -| Nothing? | encoding()
the encoding info | - -## PetpetiduploadimagePostRequestBody1 -public static class PetpetiduploadimagePostRequestBody1
- -a class that serializes SealedRequestBody request bodies - -### Constructor Summary -| Constructor and Description | -| --------------------------- | -| PetpetiduploadimagePostRequestBody1()
Creates an instance | - -### Field Summary -| Modifier and Type | Field and Description | -| ----------------- | --------------------- | -| boolean | required = false
whether the request body is required | -| Map | content = Map.ofEntries(
    new AbstractMap.SimpleEntry<>("multipart/form-data", new [MultipartformdataMediaType](#multipartformdatamediatype)())
)
the contentType to schema info | - -### Method Summary -| Modifier and Type | Method and Description | -| ----------------- | ---------------------- | -| SerializedRequestBody | serialize([SealedRequestBody](#sealedrequestbody) requestBody)
called by endpoint when creating request body bytes | - -## SealedRequestBody -public sealed interface SealedRequestBody
-permits
-[MultipartformdataRequestBody](#multipartformdatarequestbody) - -sealed interface that stores request contentType + validated schema data - -## MultipartformdataRequestBody -public record MultipartformdataRequestBody
-implements [SealedRequestBody](#sealedrequestbody),
-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 | - -### 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 | diff --git a/samples/client/petstore/kotlin/docs/paths/petpetiduploadimage/post/PetpetiduploadimagePostResponses.md b/samples/client/petstore/kotlin/docs/paths/petpetiduploadimage/post/PetpetiduploadimagePostResponses.md deleted file mode 100644 index b961dc0e86b..00000000000 --- a/samples/client/petstore/kotlin/docs/paths/petpetiduploadimage/post/PetpetiduploadimagePostResponses.md +++ /dev/null @@ -1,29 +0,0 @@ -# PetpetiduploadimagePostResponses - -public class PetpetiduploadimagePostResponses - -A class that contains necessary responses classes -- a sealed interface, EndpointResponse, that stores endpoint responses -- records for each endpoint response - -## Nested Class Summary -| Modifier and Type | Class and Description | -| ----------------- | --------------------- | -| sealed interface | [EndpointResponse](#endpointresponse)
stores the endpoint responses | -| record | [EndpointPetpetiduploadimagePostCode200Response](#endpointpetpetiduploadimagepostcode200response)
the response for 200 | - -## EndpointResponse -public sealed interface EndpointResponse permits
-[EndpointPetpetiduploadimagePostCode200Response](#endpointpetpetiduploadimagepostcode200response) - -a sealed interface that stores endpoint responses - -## EndpointPetpetiduploadimagePostCode200Response -public record EndpointPetpetiduploadimagePostCode200Response( - HttpResponse response, - [PetpetiduploadimagePostCode200Response.SealedResponseBody](../../../paths/petpetiduploadimage/post/responses/PetpetiduploadimagePostCode200Response.md#sealedresponsebody) body, - [SuccessWithJsonApiResponseHeadersSchema.SuccessWithJsonApiResponseHeadersSchemaMap](../../../components/responses/successwithjsonapiresponse/SuccessWithJsonApiResponseHeadersSchema.md#successwithjsonapiresponseheadersschemamap) headers -) implements EndpointResponse, ApiResponse
- -a class that stores an endpoint response - diff --git a/samples/client/petstore/kotlin/docs/paths/petpetiduploadimage/post/PetpetiduploadimagePostSecurityInfo.md b/samples/client/petstore/kotlin/docs/paths/petpetiduploadimage/post/PetpetiduploadimagePostSecurityInfo.md deleted file mode 100644 index a6c84397204..00000000000 --- a/samples/client/petstore/kotlin/docs/paths/petpetiduploadimage/post/PetpetiduploadimagePostSecurityInfo.md +++ /dev/null @@ -1,40 +0,0 @@ -# PetpetiduploadimagePostSecurityInfo -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 -- an enum class that describes security index values - -## Nested Class Summary -| Modifier and Type | Class and Description | -| ----------------- | --------------------- | -| static class | [PetpetiduploadimagePostSecurityInfo.PetpetiduploadimagePostSecurityInfo1](#petpetiduploadimagepostsecurityinfo1)
SecurityRequirementObjectProvider -| enum | [PetpetiduploadimagePostSecurityInfo.SecurityIndex](#securityindex)
class that stores a security index | - -## PetpetiduploadimagePostSecurityInfo1 -implements SecurityRequirementObjectProvider<[SecurityIndex](#securityindex)> - -### Constructor Summary -| Constructor and Description | -| --------------------------- | -| PetpetiduploadimagePostSecurityInfo1()
Creates an instance | - -### Field Summary -| Modifier and Type | Field and Description | -| ----------------- | --------------------- | -| [PetpetiduploadimagePostSecurityRequirementObject0](../../../paths/petpetiduploadimage/post/security/PetpetiduploadimagePostSecurityRequirementObject0.md) | security0 | - -### Method Summary -| Modifier and Type | Method and Description | -| ----------------- | ---------------------- | -| SecurityRequirementObject | getSecurityRequirementObject(@Nullable [SecurityIndex](#securityindex) securityIndex)
If null is input, then the instance's securityIndex will be used | - -## SecurityIndex -enum SecurityIndex
- -### Enum Constant Summary -| Enum Constant And Description | -| ----------------------------- | -| SECURITY_0
security 0 | diff --git a/samples/client/petstore/kotlin/docs/paths/petpetiduploadimage/post/parameters/parameter0/Schema0.md b/samples/client/petstore/kotlin/docs/paths/petpetiduploadimage/post/parameters/parameter0/Schema0.md deleted file mode 100644 index 55e4e5cb238..00000000000 --- a/samples/client/petstore/kotlin/docs/paths/petpetiduploadimage/post/parameters/parameter0/Schema0.md +++ /dev/null @@ -1,49 +0,0 @@ -# Schema0 -public class Schema0
- -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 - -## Nested Class Summary -| Modifier and Type | Class and Description | -| ----------------- | ---------------------- | -| sealed interface | [Schema0.Schema01Boxed](#schema01boxed)
sealed interface for validated payloads | -| record | [Schema0.Schema01BoxedNumber](#schema01boxednumber)
boxed class to store validated Number payloads | -| static class | [Schema0.Schema01](#schema01)
schema class | - -## Schema01Boxed -public sealed interface Schema01Boxed
-permits
-[Schema01BoxedNumber](#schema01boxednumber) - -sealed interface that stores validated payloads using boxed classes - -## Schema01BoxedNumber -public record Schema01BoxedNumber
-implements [Schema01Boxed](#schema01boxed) - -record that stores validated Number payloads, sealed permits implementation - -### Constructor Summary -| Constructor and Description | -| --------------------------- | -| Schema01BoxedNumber(Number data)
Creates an instance, private visibility | - -### Method Summary -| Modifier and Type | Method and Description | -| ----------------- | ---------------------- | -| Number | data()
validated payload | -| @Nullable Object | getData()
validated payload | - -## Schema01 -public static class Schema01
-extends Int64JsonSchema.Int64JsonSchema1 - -A schema class that validates payloads - -| Methods Inherited from class org.openapijsonschematools.client.schemas.Int64JsonSchema.Int64JsonSchema1 | -| ------------------------------------------------------------------ | -| validate | -| validateAndBox | diff --git a/samples/client/petstore/kotlin/docs/paths/petpetiduploadimage/post/requestbody/content/multipartformdata/MultipartformdataSchema.md b/samples/client/petstore/kotlin/docs/paths/petpetiduploadimage/post/requestbody/content/multipartformdata/MultipartformdataSchema.md deleted file mode 100644 index 2c718414bef..00000000000 --- a/samples/client/petstore/kotlin/docs/paths/petpetiduploadimage/post/requestbody/content/multipartformdata/MultipartformdataSchema.md +++ /dev/null @@ -1,190 +0,0 @@ -# MultipartformdataSchema -public class MultipartformdataSchema
- -A class that contains necessary nested -- schema classes (which validate payloads), extends JsonSchema -- sealed interfaces which store validated payloads, java version of a sum type -- boxed classes which store validated payloads, sealed permits class implementations -- classes to store validated map payloads, extends FrozenMap -- classes to build inputs for map payloads - -## Nested Class Summary -| Modifier and Type | Class and Description | -| ----------------- | ---------------------- | -| sealed interface | [MultipartformdataSchema.MultipartformdataSchema1Boxed](#multipartformdataschema1boxed)
sealed interface for validated payloads | -| record | [MultipartformdataSchema.MultipartformdataSchema1BoxedMap](#multipartformdataschema1boxedmap)
boxed class to store validated Map payloads | -| static class | [MultipartformdataSchema.MultipartformdataSchema1](#multipartformdataschema1)
schema class | -| static class | [MultipartformdataSchema.MultipartformdataSchemaMapBuilder](#multipartformdataschemamapbuilder)
builder for Map payloads | -| static class | [MultipartformdataSchema.MultipartformdataSchemaMap](#multipartformdataschemamap)
output class for Map payloads | -| sealed interface | [MultipartformdataSchema.MultipartformdataFileBoxed](#multipartformdatafileboxed)
sealed interface for validated payloads | -| static class | [MultipartformdataSchema.MultipartformdataFile](#multipartformdatafile)
schema class | -| sealed interface | [MultipartformdataSchema.MultipartformdataAdditionalMetadataBoxed](#multipartformdataadditionalmetadataboxed)
sealed interface for validated payloads | -| record | [MultipartformdataSchema.MultipartformdataAdditionalMetadataBoxedString](#multipartformdataadditionalmetadataboxedstring)
boxed class to store validated String payloads | -| static class | [MultipartformdataSchema.MultipartformdataAdditionalMetadata](#multipartformdataadditionalmetadata)
schema class | - -## MultipartformdataSchema1Boxed -public sealed interface MultipartformdataSchema1Boxed
-permits
-[MultipartformdataSchema1BoxedMap](#multipartformdataschema1boxedmap) - -sealed interface that stores validated payloads using boxed classes - -## MultipartformdataSchema1BoxedMap -public record MultipartformdataSchema1BoxedMap
-implements [MultipartformdataSchema1Boxed](#multipartformdataschema1boxed) - -record that stores validated Map payloads, sealed permits implementation - -### Constructor Summary -| Constructor and Description | -| --------------------------- | -| MultipartformdataSchema1BoxedMap([MultipartformdataSchemaMap](#multipartformdataschemamap) data)
Creates an instance, private visibility | - -### Method Summary -| Modifier and Type | Method and Description | -| ----------------- | ---------------------- | -| [MultipartformdataSchemaMap](#multipartformdataschemamap) | data()
validated payload | -| @Nullable Object | getData()
validated payload | - -## MultipartformdataSchema1 -public static class MultipartformdataSchema1
-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.petpetiduploadimage.post.requestbody.content.multipartformdata.MultipartformdataSchema; - -import java.util.Arrays; -import java.util.List; -import java.util.AbstractMap; - -static final SchemaConfiguration configuration = new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().build()); - -// Map validation -MultipartformdataSchema.MultipartformdataSchemaMap validatedPayload = - MultipartformdataSchema.MultipartformdataSchema1.validate( - new MultipartformdataSchema.MultipartformdataSchemaMapBuilder() - .additionalMetadata("a") - - .file("a") - - .build(), - configuration -); -``` - -### Field Summary -| Modifier and Type | Field and Description | -| ----------------- | ---------------------- | -| Set> | type = Set.of(Map.class) | -| Map> | properties = Map.ofEntries(
    new PropertyEntry("additionalMetadata", [MultipartformdataAdditionalMetadata.class](#multipartformdataadditionalmetadata))),
    new PropertyEntry("file", [MultipartformdataFile.class](#multipartformdatafile)))
)
| - -### Method Summary -| Modifier and Type | Method and Description | -| ----------------- | ---------------------- | -| [MultipartformdataSchemaMap](#multipartformdataschemamap) | validate([Map<?, ?>](#multipartformdataschemamapbuilder) arg, SchemaConfiguration configuration) | -| [MultipartformdataSchema1BoxedMap](#multipartformdataschema1boxedmap) | validateAndBox([Map<?, ?>](#multipartformdataschemamapbuilder) arg, SchemaConfiguration configuration) | -| [MultipartformdataSchema1Boxed](#multipartformdataschema1boxed) | validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) | -| @Nullable Object | validate(@Nullable Object arg, SchemaConfiguration configuration) | - -## MultipartformdataSchemaMapBuilder -public class MultipartformdataSchemaMapBuilder
-builder for `Map` - -A class that builds the Map input type - -### Constructor Summary -| Constructor and Description | -| --------------------------- | -| MultipartformdataSchemaMapBuilder()
Creates a builder that contains an empty map | - -### Method Summary -| Modifier and Type | Method and Description | -| ----------------- | ---------------------- | -| Map | build()
Returns map input that should be used with Schema.validate | -| [MultipartformdataSchemaMapBuilder](#multipartformdataschemamapbuilder) | additionalMetadata(String value) | -| [MultipartformdataSchemaMapBuilder](#multipartformdataschemamapbuilder) | file(String value) | -| [MultipartformdataSchemaMapBuilder](#multipartformdataschemamapbuilder) | additionalProperty(String key, Nothing? value) | -| [MultipartformdataSchemaMapBuilder](#multipartformdataschemamapbuilder) | additionalProperty(String key, boolean value) | -| [MultipartformdataSchemaMapBuilder](#multipartformdataschemamapbuilder) | additionalProperty(String key, String value) | -| [MultipartformdataSchemaMapBuilder](#multipartformdataschemamapbuilder) | additionalProperty(String key, int value) | -| [MultipartformdataSchemaMapBuilder](#multipartformdataschemamapbuilder) | additionalProperty(String key, float value) | -| [MultipartformdataSchemaMapBuilder](#multipartformdataschemamapbuilder) | additionalProperty(String key, long value) | -| [MultipartformdataSchemaMapBuilder](#multipartformdataschemamapbuilder) | additionalProperty(String key, double value) | -| [MultipartformdataSchemaMapBuilder](#multipartformdataschemamapbuilder) | additionalProperty(String key, List value) | -| [MultipartformdataSchemaMapBuilder](#multipartformdataschemamapbuilder) | additionalProperty(String key, Map value) | - -## MultipartformdataSchemaMap -public static class MultipartformdataSchemaMap
-extends FrozenMap - -A class to store validated Map payloads - -### Method Summary -| Modifier and Type | Method and Description | -| ----------------- | ---------------------- | -| static [MultipartformdataSchemaMap](#multipartformdataschemamap) | of([Map](#multipartformdataschemamapbuilder) arg, SchemaConfiguration configuration) | -| String | additionalMetadata()
[optional] | -| String | file()
[optional] | -| @Nullable Object | getAdditionalProperty(String name)
provides type safety for additional properties | - -## MultipartformdataFileBoxed -public sealed interface MultipartformdataFileBoxed
-permits
- -sealed interface that stores validated payloads using boxed classes - -## MultipartformdataFile -public static class MultipartformdataFile
-extends JsonSchema - -A schema class that validates payloads - -## Description -file to upload - -## MultipartformdataAdditionalMetadataBoxed -public sealed interface MultipartformdataAdditionalMetadataBoxed
-permits
-[MultipartformdataAdditionalMetadataBoxedString](#multipartformdataadditionalmetadataboxedstring) - -sealed interface that stores validated payloads using boxed classes - -## MultipartformdataAdditionalMetadataBoxedString -public record MultipartformdataAdditionalMetadataBoxedString
-implements [MultipartformdataAdditionalMetadataBoxed](#multipartformdataadditionalmetadataboxed) - -record that stores validated String payloads, sealed permits implementation - -### Constructor Summary -| Constructor and Description | -| --------------------------- | -| MultipartformdataAdditionalMetadataBoxedString(String data)
Creates an instance, private visibility | - -### Method Summary -| Modifier and Type | Method and Description | -| ----------------- | ---------------------- | -| String | data()
validated payload | -| @Nullable Object | getData()
validated payload | - -## MultipartformdataAdditionalMetadata -public static class MultipartformdataAdditionalMetadata
-extends StringJsonSchema.StringJsonSchema1 - -A schema class that validates payloads - -## Description -Additional data to pass to server - -| Methods Inherited from class org.openapijsonschematools.client.schemas.StringJsonSchema.StringJsonSchema1 | -| ------------------------------------------------------------------ | -| validate | -| validateAndBox | diff --git a/samples/client/petstore/kotlin/docs/paths/petpetiduploadimage/post/responses/PetpetiduploadimagePostCode200Response.md b/samples/client/petstore/kotlin/docs/paths/petpetiduploadimage/post/responses/PetpetiduploadimagePostCode200Response.md deleted file mode 100644 index 0be7cd47d32..00000000000 --- a/samples/client/petstore/kotlin/docs/paths/petpetiduploadimage/post/responses/PetpetiduploadimagePostCode200Response.md +++ /dev/null @@ -1,17 +0,0 @@ -# PetpetiduploadimagePostCode200Response - -public class PetpetiduploadimagePostCode200Response extends [SuccessWithJsonApiResponse](../../components/responses/SuccessWithJsonApiResponse.md) - -A class (extended from the $ref class) that contains necessary nested response classes -- a class that extends ResponseDeserializer and is used to deserialize responses - -## Nested Class Summary -| Modifier and Type | Class and Description | -| ----------------- | --------------------- | -| static class | [PetpetiduploadimagePostCode200Response.PetpetiduploadimagePostCode200Response1](#petpetiduploadimagepostcode200response1)
class that deserializes responses | - -## PetpetiduploadimagePostCode200Response1 -public static class PetpetiduploadimagePostCode200Response1 extends [SuccessWithJsonApiResponse1](../../components/responses/SuccessWithJsonApiResponse.md#successwithjsonapiresponse1)
- -a class that deserializes responses, extended from the $ref class - diff --git a/samples/client/petstore/kotlin/docs/paths/petpetiduploadimage/post/security/PetpetiduploadimagePostSecurityRequirementObject0.md b/samples/client/petstore/kotlin/docs/paths/petpetiduploadimage/post/security/PetpetiduploadimagePostSecurityRequirementObject0.md deleted file mode 100644 index adb3502a449..00000000000 --- a/samples/client/petstore/kotlin/docs/paths/petpetiduploadimage/post/security/PetpetiduploadimagePostSecurityRequirementObject0.md +++ /dev/null @@ -1,15 +0,0 @@ -# PetpetiduploadimagePostSecurityRequirementObject0 -PetpetiduploadimagePostSecurityRequirementObject0.java - -public class PetpetiduploadimagePostSecurityRequirementObject0 -extends SecurityRequirementObject - -### Constructor Summary -| Constructor and Description | -| --------------------------- | -| PetpetiduploadimagePostSecurityRequirementObject0()
Creates an instance | - -### 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")
    )) | diff --git a/samples/client/petstore/kotlin/docs/paths/solidus/SolidusGet.md b/samples/client/petstore/kotlin/docs/paths/solidus/SolidusGet.md deleted file mode 100644 index 3d689bca199..00000000000 --- a/samples/client/petstore/kotlin/docs/paths/solidus/SolidusGet.md +++ /dev/null @@ -1,142 +0,0 @@ -# SolidusGet - -public class SolidusGet - -A class that contains necessary endpoint classes -- a class that calls the endpoint method using the http verb -- a class that calls the endpoint method using the operationId name -- class(es) to store the request inputs -- builder(s) to set the request input data - -## Nested Class Summary -| Modifier and Type | Class and Description | -| ----------------- | --------------------- | -| static class | [Get](#get)
The class that has a get method to call the endpoint | -| interface | [SlashRouteOperation](#slashrouteoperation)
The interface that has a slashRoute method to call the endpoint | -| static class | [GetRequest](#getrequest)
The request inputs class | -| static class | [GetRequestBuilder](#getrequestbuilder)
A builder for the request input class | - -## Get -public static class Get extends ApiClient.ApiClient1 implements GetOperation
- -a class that allows one to call the endpoint using a method named get - -### 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.servers.RootServer0; -import org.openapijsonschematools.client.servers.RootServer1; -import org.openapijsonschematools.client.servers.RootServer2; -import org.openapijsonschematools.client.paths.solidus.get.responses.SolidusGetCode200Response; -import org.openapijsonschematools.client.servers.RootServerInfo; -import org.openapijsonschematools.client.paths.solidus.SolidusGet; -import org.openapijsonschematools.client.paths.solidus.get.SolidusGetResponses; - -import java.io.IOException; -import java.util.Arrays; -import java.util.List; -import java.util.Map; -import java.util.AbstractMap; - -// if you want to use a server that is not SERVER_0 pass it in here and change the ServerIndex input below -ApiConfiguration.ServerInfo serverInfo = new ApiConfiguration.ServerInfoBuilder() - .rootServerInfo( - new RootServerInfo.RootServerInfoBuilder() - .rootServer0(new RootServer0()) - .build() - ) - .build(); -ApiConfiguration.ServerIndexInfo serverIndexInfo = new ApiConfiguration.ServerIndexInfoBuilder() - .rootServerInfoServerIndex(RootServerInfo.ServerIndex.SERVER_0) - .build(); -Duration timeout = Duration.ofSeconds(1L); -Map> defaultHeaders = Map.of("User-Agent", List.of("OpenAPI-JSON-Schema-Generator/1.0.0/java")); -ApiConfiguration apiConfiguration = new ApiConfiguration( - serverInfo - serverIndexInfo, - timeout, - defaultHeaders -); -SchemaConfiguration schemaConfiguration = new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().build()); -SolidusGet.Get apiClient = new SolidusGet.Get(apiConfiguration, schemaConfiguration); - - -var request = new SolidusGet.GetRequestBuilder().build(); - -SolidusGetResponses.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; -} -SolidusGetResponses.EndpointSolidusGetCode200Response castResponse = (SolidusGetResponses.EndpointSolidusGetCode200Response) response; -``` -### Constructor Summary -| Constructor and Description | -| --------------------------- | -| Get(ApiConfiguration apiConfiguration, SchemaConfiguration schemaConfiguration)
Creates an instance | - -### Method Summary -| Modifier and Type | Method and Description | -| ----------------- | ---------------------- | -| [SolidusGetResponses.EndpointResponse](../../paths/solidus/get/SolidusGetResponses.md#endpointresponse) | get([GetRequest](#getrequest) request) | - -## SlashRouteOperation -public interface SlashRouteOperation
- -an interface that allows one to call the endpoint using a method named slashRoute by the operationId - -### Method Summary -| Modifier and Type | Method and Description | -| ----------------- | ---------------------- | -| [SolidusGetResponses.EndpointResponse](../../paths/solidus/get/SolidusGetResponses.md#endpointresponse) | slashRoute([GetRequest](#getrequest) request) | - -## GetRequest -public static class GetRequest
- -a class that stores the final request inputs - -### Field Summary -| Modifier and Type | Field and Description | -| ----------------- | --------------------- | -| [RootServerInfo.@Nullable ServerIndex](../../RootServerInfo.md#serverindex) | serverIndex
optional. Note: this will override the value in apiConfiguration | -| @Nullable Duration | timeout
optional. Note: this will override the value in apiConfiguration | - -## GetRequestBuilder -public static class GetRequestBuilder
- -a builder for request inputs - -### Constructor Summary -| Constructor and Description | -| --------------------------- | -| GetRequestBuilder()
Creates a builder that contains null for all parameters | - -### Method Summary -| Modifier and Type | Method and Description | -| ----------------- | ---------------------- | -| [GetRequest](#getrequest) | build()
Returns the request input used to call an endpoint method | -| [GetRequestBuilder](#getrequestbuilder) | serverIndex([RootServerInfo.ServerIndex](../../RootServerInfo.md#serverindex) serverIndex)
sets the optional property. Note: this will override the value in apiConfiguration | -| [GetRequestBuilder](#getrequestbuilder) | timeout(Duration timeout)
sets the optional property. Note: this will override the value in apiConfiguration | - -[[Back to top]](#top) [[Back to README]](../../../README.md) diff --git a/samples/client/petstore/kotlin/docs/paths/solidus/get/SolidusGetResponses.md b/samples/client/petstore/kotlin/docs/paths/solidus/get/SolidusGetResponses.md deleted file mode 100644 index 2d87b4e42f2..00000000000 --- a/samples/client/petstore/kotlin/docs/paths/solidus/get/SolidusGetResponses.md +++ /dev/null @@ -1,29 +0,0 @@ -# SolidusGetResponses - -public class SolidusGetResponses - -A class that contains necessary responses classes -- a sealed interface, EndpointResponse, that stores endpoint responses -- records for each endpoint response - -## Nested Class Summary -| Modifier and Type | Class and Description | -| ----------------- | --------------------- | -| sealed interface | [EndpointResponse](#endpointresponse)
stores the endpoint responses | -| record | [EndpointSolidusGetCode200Response](#endpointsolidusgetcode200response)
the response for 200 | - -## EndpointResponse -public sealed interface EndpointResponse permits
-[EndpointSolidusGetCode200Response](#endpointsolidusgetcode200response) - -a sealed interface that stores endpoint responses - -## EndpointSolidusGetCode200Response -public record EndpointSolidusGetCode200Response( - HttpResponse response, - Nothing? body, - Nothing? headers -) implements EndpointResponse, ApiResponse
- -a class that stores an endpoint response - diff --git a/samples/client/petstore/kotlin/docs/paths/solidus/get/responses/SolidusGetCode200Response.md b/samples/client/petstore/kotlin/docs/paths/solidus/get/responses/SolidusGetCode200Response.md deleted file mode 100644 index e00fe1ece0e..00000000000 --- a/samples/client/petstore/kotlin/docs/paths/solidus/get/responses/SolidusGetCode200Response.md +++ /dev/null @@ -1,17 +0,0 @@ -# SolidusGetCode200Response - -public class SolidusGetCode200Response extends [SuccessDescriptionOnly](../../components/responses/SuccessDescriptionOnly.md) - -A class (extended from the $ref class) that contains necessary nested response classes -- a class that extends ResponseDeserializer and is used to deserialize responses - -## Nested Class Summary -| Modifier and Type | Class and Description | -| ----------------- | --------------------- | -| static class | [SolidusGetCode200Response.SolidusGetCode200Response1](#solidusgetcode200response1)
class that deserializes responses | - -## SolidusGetCode200Response1 -public static class SolidusGetCode200Response1 extends [SuccessDescriptionOnly1](../../components/responses/SuccessDescriptionOnly.md#successdescriptiononly1)
- -a class that deserializes responses, extended from the $ref class - diff --git a/samples/client/petstore/kotlin/docs/paths/storeinventory/StoreinventoryGet.md b/samples/client/petstore/kotlin/docs/paths/storeinventory/StoreinventoryGet.md deleted file mode 100644 index 3ae46788229..00000000000 --- a/samples/client/petstore/kotlin/docs/paths/storeinventory/StoreinventoryGet.md +++ /dev/null @@ -1,158 +0,0 @@ -# StoreinventoryGet - -public class StoreinventoryGet - -A class that contains necessary endpoint classes -- a class that calls the endpoint method using the http verb -- a class that calls the endpoint method using the operationId name -- class(es) to store the request inputs -- builder(s) to set the request input data - -## Nested Class Summary -| Modifier and Type | Class and Description | -| ----------------- | --------------------- | -| static class | [Get](#get)
The class that has a get method to call the endpoint | -| interface | [GetInventoryOperation](#getinventoryoperation)
The interface that has a getInventory method to call the endpoint | -| static class | [GetRequest](#getrequest)
The request inputs class | -| static class | [GetRequestBuilder](#getrequestbuilder)
A builder for the request input class | - -## Get -public static class Get extends ApiClient.ApiClient1 implements GetOperation
- -a class that allows one to call the endpoint using a method named get - -### 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.storeinventory.get.StoreinventoryGetSecurityInfo; -import org.openapijsonschematools.client.servers.RootServer0; -import org.openapijsonschematools.client.servers.RootServer1; -import org.openapijsonschematools.client.servers.RootServer2; -import org.openapijsonschematools.client.securityschemes.SecurityScheme; -import org.openapijsonschematools.client.components.securityschemes.ApiKey; -import org.openapijsonschematools.client.paths.storeinventory.get.responses.StoreinventoryGetCode200Response; -import org.openapijsonschematools.client.components.responses.successinlinecontentandheader.SuccessInlineContentAndHeaderHeadersSchema; -import org.openapijsonschematools.client.servers.RootServerInfo; -import org.openapijsonschematools.client.paths.storeinventory.StoreinventoryGet; -import org.openapijsonschematools.client.paths.storeinventory.get.StoreinventoryGetResponses; - -import java.io.IOException; -import java.util.Arrays; -import java.util.List; -import java.util.Map; -import java.util.AbstractMap; - -// if you want to use a server that is not SERVER_0 pass it in here and change the ServerIndex input below -ApiConfiguration.ServerInfo serverInfo = new ApiConfiguration.ServerInfoBuilder() - .rootServerInfo( - new RootServerInfo.RootServerInfoBuilder() - .rootServer0(new RootServer0()) - .build() - ) - .build(); -ApiConfiguration.ServerIndexInfo serverIndexInfo = new ApiConfiguration.ServerIndexInfoBuilder() - .rootServerInfoServerIndex(RootServerInfo.ServerIndex.SERVER_0) - .build(); -List securitySchemes = new ArrayList(); -securitySchemes.add( - new ApiKey("someApiKey"); -); -ApiConfiguration.SecurityIndexInfo securityIndexInfo = new ApiConfiguration.SecurityIndexInfoBuilder() - .storeinventoryGetSecurityRequirementObject0SecurityIndex(StoreinventoryGetSecurityRequirementObject0.SecurityIndex.SECURITY_0) - .build(); -Duration timeout = Duration.ofSeconds(1L); -Map> defaultHeaders = Map.of("User-Agent", List.of("OpenAPI-JSON-Schema-Generator/1.0.0/java")); -ApiConfiguration apiConfiguration = new ApiConfiguration( - serverInfo - serverIndexInfo, - securitySchemes, - securityIndexInfo, - timeout, - defaultHeaders -); -SchemaConfiguration schemaConfiguration = new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().build()); -StoreinventoryGet.Get apiClient = new StoreinventoryGet.Get(apiConfiguration, schemaConfiguration); - - -var request = new StoreinventoryGet.GetRequestBuilder().build(); - -StoreinventoryGetResponses.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; -} -StoreinventoryGetResponses.EndpointStoreinventoryGetCode200Response castResponse = (StoreinventoryGetResponses.EndpointStoreinventoryGetCode200Response) response; -} -``` -### Constructor Summary -| Constructor and Description | -| --------------------------- | -| Get(ApiConfiguration apiConfiguration, SchemaConfiguration schemaConfiguration)
Creates an instance | - -### Method Summary -| Modifier and Type | Method and Description | -| ----------------- | ---------------------- | -| [StoreinventoryGetResponses.EndpointResponse](../../paths/storeinventory/get/StoreinventoryGetResponses.md#endpointresponse) | get([GetRequest](#getrequest) request) | - -## GetInventoryOperation -public interface GetInventoryOperation
- -an interface that allows one to call the endpoint using a method named getInventory by the operationId - -### Method Summary -| Modifier and Type | Method and Description | -| ----------------- | ---------------------- | -| [StoreinventoryGetResponses.EndpointResponse](../../paths/storeinventory/get/StoreinventoryGetResponses.md#endpointresponse) | getInventory([GetRequest](#getrequest) request) | - -## GetRequest -public static class GetRequest
- -a class that stores the final request inputs - -### Field Summary -| Modifier and Type | Field and Description | -| ----------------- | --------------------- | -| [RootServerInfo.@Nullable ServerIndex](../../RootServerInfo.md#serverindex) | serverIndex
optional. Note: this will override the value in apiConfiguration | -| [StoreinventoryGetSecurityInfo.@Nullable SecurityIndex](../../paths/storeinventory/get/StoreinventoryGetSecurityInfo.md#securityindex) | securityIndex
optional. Note: this will override the value in apiConfiguration | -| @Nullable Duration | timeout
optional. Note: this will override the value in apiConfiguration | - -## GetRequestBuilder -public static class GetRequestBuilder
- -a builder for request inputs - -### Constructor Summary -| Constructor and Description | -| --------------------------- | -| GetRequestBuilder()
Creates a builder that contains null for all parameters | - -### Method Summary -| Modifier and Type | Method and Description | -| ----------------- | ---------------------- | -| [GetRequest](#getrequest) | build()
Returns the request input used to call an endpoint method | -| [GetRequestBuilder](#getrequestbuilder) | serverIndex([RootServerInfo.ServerIndex](../../RootServerInfo.md#serverindex) serverIndex)
sets the optional property. Note: this will override the value in apiConfiguration | -| [GetRequestBuilder](#getrequestbuilder) | securityIndex([StoreinventoryGetSecurityInfo.SecurityIndex](../../paths/storeinventory/get/StoreinventoryGetSecurityInfo.md#securityindex) securityIndex)
sets the optional property. Note: this will override the value in apiConfiguration | -| [GetRequestBuilder](#getrequestbuilder) | timeout(Duration timeout)
sets the optional property. Note: this will override the value in apiConfiguration | - -[[Back to top]](#top) [[Back to README]](../../../README.md) diff --git a/samples/client/petstore/kotlin/docs/paths/storeinventory/get/StoreinventoryGetResponses.md b/samples/client/petstore/kotlin/docs/paths/storeinventory/get/StoreinventoryGetResponses.md deleted file mode 100644 index 9f064be5958..00000000000 --- a/samples/client/petstore/kotlin/docs/paths/storeinventory/get/StoreinventoryGetResponses.md +++ /dev/null @@ -1,29 +0,0 @@ -# StoreinventoryGetResponses - -public class StoreinventoryGetResponses - -A class that contains necessary responses classes -- a sealed interface, EndpointResponse, that stores endpoint responses -- records for each endpoint response - -## Nested Class Summary -| Modifier and Type | Class and Description | -| ----------------- | --------------------- | -| sealed interface | [EndpointResponse](#endpointresponse)
stores the endpoint responses | -| record | [EndpointStoreinventoryGetCode200Response](#endpointstoreinventorygetcode200response)
the response for 200 | - -## EndpointResponse -public sealed interface EndpointResponse permits
-[EndpointStoreinventoryGetCode200Response](#endpointstoreinventorygetcode200response) - -a sealed interface that stores endpoint responses - -## EndpointStoreinventoryGetCode200Response -public record EndpointStoreinventoryGetCode200Response( - HttpResponse response, - [StoreinventoryGetCode200Response.SealedResponseBody](../../../paths/storeinventory/get/responses/StoreinventoryGetCode200Response.md#sealedresponsebody) body, - [SuccessInlineContentAndHeaderHeadersSchema.SuccessInlineContentAndHeaderHeadersSchemaMap](../../../components/responses/successinlinecontentandheader/SuccessInlineContentAndHeaderHeadersSchema.md#successinlinecontentandheaderheadersschemamap) headers -) implements EndpointResponse, ApiResponse
- -a class that stores an endpoint response - diff --git a/samples/client/petstore/kotlin/docs/paths/storeinventory/get/StoreinventoryGetSecurityInfo.md b/samples/client/petstore/kotlin/docs/paths/storeinventory/get/StoreinventoryGetSecurityInfo.md deleted file mode 100644 index 2f5f07f0f26..00000000000 --- a/samples/client/petstore/kotlin/docs/paths/storeinventory/get/StoreinventoryGetSecurityInfo.md +++ /dev/null @@ -1,40 +0,0 @@ -# StoreinventoryGetSecurityInfo -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 -- an enum class that describes security index values - -## Nested Class Summary -| Modifier and Type | Class and Description | -| ----------------- | --------------------- | -| static class | [StoreinventoryGetSecurityInfo.StoreinventoryGetSecurityInfo1](#storeinventorygetsecurityinfo1)
SecurityRequirementObjectProvider -| enum | [StoreinventoryGetSecurityInfo.SecurityIndex](#securityindex)
class that stores a security index | - -## StoreinventoryGetSecurityInfo1 -implements SecurityRequirementObjectProvider<[SecurityIndex](#securityindex)> - -### Constructor Summary -| Constructor and Description | -| --------------------------- | -| StoreinventoryGetSecurityInfo1()
Creates an instance | - -### Field Summary -| Modifier and Type | Field and Description | -| ----------------- | --------------------- | -| [StoreinventoryGetSecurityRequirementObject0](../../../paths/storeinventory/get/security/StoreinventoryGetSecurityRequirementObject0.md) | security0 | - -### Method Summary -| Modifier and Type | Method and Description | -| ----------------- | ---------------------- | -| SecurityRequirementObject | getSecurityRequirementObject(@Nullable [SecurityIndex](#securityindex) securityIndex)
If null is input, then the instance's securityIndex will be used | - -## SecurityIndex -enum SecurityIndex
- -### Enum Constant Summary -| Enum Constant And Description | -| ----------------------------- | -| SECURITY_0
security 0 | diff --git a/samples/client/petstore/kotlin/docs/paths/storeinventory/get/responses/StoreinventoryGetCode200Response.md b/samples/client/petstore/kotlin/docs/paths/storeinventory/get/responses/StoreinventoryGetCode200Response.md deleted file mode 100644 index 969b8dc35f3..00000000000 --- a/samples/client/petstore/kotlin/docs/paths/storeinventory/get/responses/StoreinventoryGetCode200Response.md +++ /dev/null @@ -1,17 +0,0 @@ -# StoreinventoryGetCode200Response - -public class StoreinventoryGetCode200Response extends [SuccessInlineContentAndHeader](../../components/responses/SuccessInlineContentAndHeader.md) - -A class (extended from the $ref class) that contains necessary nested response classes -- a class that extends ResponseDeserializer and is used to deserialize responses - -## Nested Class Summary -| Modifier and Type | Class and Description | -| ----------------- | --------------------- | -| static class | [StoreinventoryGetCode200Response.StoreinventoryGetCode200Response1](#storeinventorygetcode200response1)
class that deserializes responses | - -## StoreinventoryGetCode200Response1 -public static class StoreinventoryGetCode200Response1 extends [SuccessInlineContentAndHeader1](../../components/responses/SuccessInlineContentAndHeader.md#successinlinecontentandheader1)
- -a class that deserializes responses, extended from the $ref class - diff --git a/samples/client/petstore/kotlin/docs/paths/storeinventory/get/security/StoreinventoryGetSecurityRequirementObject0.md b/samples/client/petstore/kotlin/docs/paths/storeinventory/get/security/StoreinventoryGetSecurityRequirementObject0.md deleted file mode 100644 index d979d8cb08c..00000000000 --- a/samples/client/petstore/kotlin/docs/paths/storeinventory/get/security/StoreinventoryGetSecurityRequirementObject0.md +++ /dev/null @@ -1,15 +0,0 @@ -# StoreinventoryGetSecurityRequirementObject0 -StoreinventoryGetSecurityRequirementObject0.java - -public class StoreinventoryGetSecurityRequirementObject0 -extends SecurityRequirementObject - -### Constructor Summary -| Constructor and Description | -| --------------------------- | -| StoreinventoryGetSecurityRequirementObject0()
Creates an instance | - -### 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()
    )) | diff --git a/samples/client/petstore/kotlin/docs/paths/storeorder/StoreorderPost.md b/samples/client/petstore/kotlin/docs/paths/storeorder/StoreorderPost.md deleted file mode 100644 index 220d4837c94..00000000000 --- a/samples/client/petstore/kotlin/docs/paths/storeorder/StoreorderPost.md +++ /dev/null @@ -1,206 +0,0 @@ -# StoreorderPost - -public class StoreorderPost - -A class that contains necessary endpoint classes -- a class that calls the endpoint method using the http verb -- a class that calls the endpoint method using the operationId name -- class(es) to store the request inputs -- builder(s) to set the request input data - -## Nested Class Summary -| Modifier and Type | Class and Description | -| ----------------- | --------------------- | -| static class | [Post](#post)
The class that has a post method to call the endpoint | -| interface | [PlaceOrderOperation](#placeorderoperation)
The interface that has a placeOrder method to call the endpoint | -| static class | [PostRequest](#postrequest)
The final request inputs class | -| static class | [PostNullableRequest](#postnullablerequest)
The initial request inputs class | -| static class | [Post0RequestBuilder](#post0requestbuilder)
A builder for the request input class | -| static class | [PostRequestBuilder](#postrequestbuilder)
A builder for the request input class | - -## Post -public static class Post 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.StoreorderPostRequestBody; -import org.openapijsonschematools.client.components.schemas.Order; -import org.openapijsonschematools.client.servers.RootServer0; -import org.openapijsonschematools.client.servers.RootServer1; -import org.openapijsonschematools.client.servers.RootServer2; -import org.openapijsonschematools.client.paths.storeorder.post.responses.StoreorderPostCode200Response; -import org.openapijsonschematools.client.paths.storeorder.post.responses.StoreorderPostCode400Response; -import org.openapijsonschematools.client.servers.RootServerInfo; -import org.openapijsonschematools.client.paths.storeorder.StoreorderPost; -import org.openapijsonschematools.client.paths.storeorder.post.StoreorderPostResponses; - -import java.io.IOException; -import java.util.Arrays; -import java.util.List; -import java.util.Map; -import java.util.AbstractMap; - -// if you want to use a server that is not SERVER_0 pass it in here and change the ServerIndex input below -ApiConfiguration.ServerInfo serverInfo = new ApiConfiguration.ServerInfoBuilder() - .rootServerInfo( - new RootServerInfo.RootServerInfoBuilder() - .rootServer0(new RootServer0()) - .build() - ) - .build(); -ApiConfiguration.ServerIndexInfo serverIndexInfo = new ApiConfiguration.ServerIndexInfoBuilder() - .rootServerInfoServerIndex(RootServerInfo.ServerIndex.SERVER_0) - .build(); -Duration timeout = Duration.ofSeconds(1L); -Map> defaultHeaders = Map.of("User-Agent", List.of("OpenAPI-JSON-Schema-Generator/1.0.0/java")); -ApiConfiguration apiConfiguration = new ApiConfiguration( - serverInfo - serverIndexInfo, - timeout, - defaultHeaders -); -SchemaConfiguration schemaConfiguration = new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().build()); -StoreorderPost.Post apiClient = new StoreorderPost.Post(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 -); -StoreorderPost.SealedRequestBody requestBody = new StoreorderPost.ApplicationjsonRequestBody(requestBodyPayload); - -var request = new StoreorderPost.PostRequestBuilder() - .requestBody(requestBody) - .build(); - -StoreorderPostResponses.EndpointResponse response; -try { - response = apiClient.post(request); -} catch (StoreorderPostCode400Response.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; -} -StoreorderPostResponses.EndpointStoreorderPostCode200Response castResponse = (StoreorderPostResponses.EndpointStoreorderPostCode200Response) response; -if (castResponse.body instanceof StoreorderPostCode200Response.ApplicationxmlResponseBody deserializedBody) { - // handle deserialized body here -} else { - StoreorderPostCode200Response.ApplicationjsonResponseBody deserializedBody = (StoreorderPostCode200Response.ApplicationjsonResponseBody) castResponse.body; - // handle deserialized body here -} -``` -### Constructor Summary -| Constructor and Description | -| --------------------------- | -| Post(ApiConfiguration apiConfiguration, SchemaConfiguration schemaConfiguration)
Creates an instance | - -### Method Summary -| Modifier and Type | Method and Description | -| ----------------- | ---------------------- | -| [StoreorderPostResponses.EndpointResponse](../../paths/storeorder/post/StoreorderPostResponses.md#endpointresponse) | post([PostRequest](#postrequest) request) | - -## PlaceOrderOperation -public interface PlaceOrderOperation
- -an interface that allows one to call the endpoint using a method named placeOrder by the operationId - -### Method Summary -| Modifier and Type | Method and Description | -| ----------------- | ---------------------- | -| [StoreorderPostResponses.EndpointResponse](../../paths/storeorder/post/StoreorderPostResponses.md#endpointresponse) | placeOrder([PostRequest](#postrequest) request) | - -## PostRequest -public static class PostRequest
- -a class that stores the final request inputs - -### Field Summary -| Modifier and Type | Field and Description | -| ----------------- | --------------------- | -| [StoreorderPostRequestBody.SealedRequestBody](../../paths/storeorder/post/StoreorderPostRequestBody.md#sealedrequestbody) | requestBody | -| [RootServerInfo.@Nullable ServerIndex](../../RootServerInfo.md#serverindex) | serverIndex
optional. Note: this will override the value in apiConfiguration | -| @Nullable Duration | timeout
optional. Note: this will override the value in apiConfiguration | - -## PostNullableRequest -public static class PostNullableRequest
- -a class that stores the initial request inputs - -### Field Summary -| Modifier and Type | Field and Description | -| ----------------- | --------------------- | -| [StoreorderPostRequestBody.@Nullable SealedRequestBody](../../paths/storeorder/post/StoreorderPostRequestBody.md#sealedrequestbody) | requestBody | -| [RootServerInfo.@Nullable ServerIndex](../../RootServerInfo.md#serverindex) | serverIndex | -| @Nullable Duration | timeout | - -## Post0RequestBuilder -public static class Post0RequestBuilder
- -a builder for request inputs - -### Constructor Summary -| Constructor and Description | -| --------------------------- | -| Post0RequestBuilder(Post0RequestBuilder instance)
Creates a builder that contains the passed instance | - -### Method Summary -| Modifier and Type | Method and Description | -| ----------------- | ---------------------- | -| [PostRequest](#postrequest) | build()
Returns the request input used to call an endpoint method | -| [Post0RequestBuilder](#post0requestbuilder) | serverIndex([RootServerInfo.ServerIndex](../../RootServerInfo.md#serverindex) serverIndex)
sets the optional property. Note: this will override the value in apiConfiguration | -| [Post0RequestBuilder](#post0requestbuilder) | timeout(Duration timeout)
sets the optional property. Note: this will override the value in apiConfiguration | - -## PostRequestBuilder -public static class PostRequestBuilder
- -a builder for request inputs - -### Constructor Summary -| Constructor and Description | -| --------------------------- | -| PostRequestBuilder()
Creates a builder that contains null for all parameters | - -### Method Summary -| Modifier and Type | Method and Description | -| ----------------- | ---------------------- | -| [Post0RequestBuilder](#post0requestbuilder) | requestBody([StoreorderPostRequestBody.SealedRequestBody](../../paths/storeorder/post/StoreorderPostRequestBody.md#sealedrequestbody) requestBody)
sets the property | - -[[Back to top]](#top) [[Back to README]](../../../README.md) diff --git a/samples/client/petstore/kotlin/docs/paths/storeorder/post/StoreorderPostRequestBody.md b/samples/client/petstore/kotlin/docs/paths/storeorder/post/StoreorderPostRequestBody.md deleted file mode 100644 index dedc13741f6..00000000000 --- a/samples/client/petstore/kotlin/docs/paths/storeorder/post/StoreorderPostRequestBody.md +++ /dev/null @@ -1,90 +0,0 @@ -# StoreorderPostRequestBody - -public class StoreorderPostRequestBody - -A class that contains necessary nested request body classes -- SealedMediaType, a sealed interface which contains all the schema/encoding info for each contentType -- records which implement SealedMediaType, the concrete media types -- a class that extends RequestBodySerializer and is used to serialize input SealedRequestBody instances -- SealedRequestBody, a sealed interface which contains all the contentType/schema input types -- records which implement SealedRequestBody, the concrete request body types - -## Nested Class Summary -| Modifier and Type | Class and Description | -| ----------------- | --------------------- | -| sealed interface | [StoreorderPostRequestBody.SealedMediaType](#sealedmediatype)
media type sealed interface | -| record | [StoreorderPostRequestBody.ApplicationjsonMediaType](#applicationjsonmediatype)
record storing schema + encoding for a specific contentType | -| static class | [StoreorderPostRequestBody.StoreorderPostRequestBody1](#storeorderpostrequestbody1)
class that serializes request bodies | -| sealed interface | [StoreorderPostRequestBody.SealedRequestBody](#sealedrequestbody)
request body sealed interface | -| record | [StoreorderPostRequestBody.ApplicationjsonRequestBody](#applicationjsonrequestbody)
implements sealed interface to store request body input | - -## SealedMediaType -public sealed interface SealedMediaType
-permits
-[ApplicationjsonMediaType](#applicationjsonmediatype) - -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), Nothing?> - -class storing schema info for a specific contentType - -### Constructor Summary -| Constructor and Description | -| --------------------------- | -| ApplicationjsonMediaType()
Creates an instance | - -### 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 | -| Nothing? | encoding()
the encoding info | - -## StoreorderPostRequestBody1 -public static class StoreorderPostRequestBody1
- -a class that serializes SealedRequestBody request bodies - -### Constructor Summary -| Constructor and Description | -| --------------------------- | -| StoreorderPostRequestBody1()
Creates an instance | - -### Field Summary -| Modifier and Type | Field and Description | -| ----------------- | --------------------- | -| boolean | required = true
whether the request body is required | -| 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 | -| ----------------- | ---------------------- | -| SerializedRequestBody | serialize([SealedRequestBody](#sealedrequestbody) requestBody)
called by endpoint when creating request body bytes | - -## SealedRequestBody -public sealed interface SealedRequestBody
-permits
-[ApplicationjsonRequestBody](#applicationjsonrequestbody) - -sealed interface that stores request contentType + validated schema data - -## ApplicationjsonRequestBody -public record ApplicationjsonRequestBody
-implements [SealedRequestBody](#sealedrequestbody),
-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 | - -### 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 | diff --git a/samples/client/petstore/kotlin/docs/paths/storeorder/post/StoreorderPostResponses.md b/samples/client/petstore/kotlin/docs/paths/storeorder/post/StoreorderPostResponses.md deleted file mode 100644 index ce063899945..00000000000 --- a/samples/client/petstore/kotlin/docs/paths/storeorder/post/StoreorderPostResponses.md +++ /dev/null @@ -1,29 +0,0 @@ -# StoreorderPostResponses - -public class StoreorderPostResponses - -A class that contains necessary responses classes -- a sealed interface, EndpointResponse, that stores endpoint responses -- records for each endpoint response - -## Nested Class Summary -| Modifier and Type | Class and Description | -| ----------------- | --------------------- | -| sealed interface | [EndpointResponse](#endpointresponse)
stores the endpoint responses | -| record | [EndpointStoreorderPostCode200Response](#endpointstoreorderpostcode200response)
the response for 200 | - -## EndpointResponse -public sealed interface EndpointResponse permits
-[EndpointStoreorderPostCode200Response](#endpointstoreorderpostcode200response) - -a sealed interface that stores endpoint responses - -## EndpointStoreorderPostCode200Response -public record EndpointStoreorderPostCode200Response( - HttpResponse response, - [StoreorderPostCode200Response.SealedResponseBody](../../../paths/storeorder/post/responses/StoreorderPostCode200Response.md#sealedresponsebody) body, - Nothing? headers -) implements EndpointResponse, ApiResponse
- -a class that stores an endpoint response - diff --git a/samples/client/petstore/kotlin/docs/paths/storeorder/post/requestbody/content/applicationjson/ApplicationjsonSchema.md b/samples/client/petstore/kotlin/docs/paths/storeorder/post/requestbody/content/applicationjson/ApplicationjsonSchema.md deleted file mode 100644 index 25524457185..00000000000 --- a/samples/client/petstore/kotlin/docs/paths/storeorder/post/requestbody/content/applicationjson/ApplicationjsonSchema.md +++ /dev/null @@ -1,19 +0,0 @@ -# ApplicationjsonSchema -public class ApplicationjsonSchema
-extends [Order1](../../../../../../components/schemas/Order.md#order) - -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 - -## Nested Class Summary -| Modifier and Type | Class and Description | -| ----------------- | ---------------------- | -| static class | [ApplicationjsonSchema.ApplicationjsonSchema1](#applicationjsonschema1)
schema class | - -## ApplicationjsonSchema1 -public static class ApplicationjsonSchema1
-extends [Order.Order1](../../../../../../components/schemas/Order.md#order1) - -A schema class that validates payloads diff --git a/samples/client/petstore/kotlin/docs/paths/storeorder/post/responses/StoreorderPostCode200Response.md b/samples/client/petstore/kotlin/docs/paths/storeorder/post/responses/StoreorderPostCode200Response.md deleted file mode 100644 index 23e93844e0c..00000000000 --- a/samples/client/petstore/kotlin/docs/paths/storeorder/post/responses/StoreorderPostCode200Response.md +++ /dev/null @@ -1,123 +0,0 @@ -# StoreorderPostCode200Response - -public class StoreorderPostCode200Response - -A class that contains necessary nested response classes -- SealedMediaType, a sealed interface which contains all the schema/encoding info for each contentType -- records which implement SealedMediaType, the concrete media types -- SealedResponseBody, a sealed interface which contains all the contentType/schema types -- records which implement SealedResponseBody, the concrete response body types -- a class that extends ResponseDeserializer and is used to deserialize responses - -## Nested Class Summary -| Modifier and Type | Class and Description | -| ----------------- | --------------------- | -| sealed interface | [StoreorderPostCode200Response.SealedMediaType](#sealedmediatype)
media type sealed interface | -| record | [StoreorderPostCode200Response.ApplicationxmlMediaType](#applicationxmlmediatype)
record storing schema + encoding for a specific contentType | -| record | [StoreorderPostCode200Response.ApplicationjsonMediaType](#applicationjsonmediatype)
record storing schema + encoding for a specific contentType | -| sealed interface | [StoreorderPostCode200Response.SealedResponseBody](#sealedresponsebody)
response body sealed interface | -| record | [StoreorderPostCode200Response.ApplicationxmlResponseBody](#applicationxmlresponsebody)
implements sealed interface to store response body | -| record | [StoreorderPostCode200Response.ApplicationjsonResponseBody](#applicationjsonresponsebody)
implements sealed interface to store response body | -| static class | [StoreorderPostCode200Response.StoreorderPostCode200Response1](#storeorderpostcode200response1)
class that deserializes responses | - -## SealedMediaType -public sealed interface SealedMediaType
-permits
-[ApplicationxmlMediaType](#applicationxmlmediatype), -[ApplicationjsonMediaType](#applicationjsonmediatype) - -sealed interface that stores schema and encoding info - -## ApplicationxmlMediaType -public record ApplicationxmlMediaType
-implements [SealedMediaType](#sealedmediatype), MediaType<[ApplicationxmlSchema.ApplicationxmlSchema1](../../../../paths/storeorder/post/responses/code200response/content/applicationxml/ApplicationxmlSchema.md#applicationxmlschema1), Nothing?> - -class storing schema info for a specific contentType - -### Constructor Summary -| Constructor and Description | -| --------------------------- | -| ApplicationxmlMediaType()
Creates an instance | - -### Method Summary -| Modifier and Type | Method and Description | -| ----------------- | ---------------------- | -| [ApplicationxmlSchema.ApplicationxmlSchema1](../../../../paths/storeorder/post/responses/code200response/content/applicationxml/ApplicationxmlSchema.md#applicationxmlschema1) | schema()
the schema for this MediaType | -| Nothing? | encoding()
the encoding info | - -## ApplicationjsonMediaType -public record ApplicationjsonMediaType
-implements [SealedMediaType](#sealedmediatype), MediaType<[ApplicationjsonSchema.ApplicationjsonSchema1](../../../../paths/storeorder/post/responses/code200response/content/applicationjson/ApplicationjsonSchema.md#applicationjsonschema1), Nothing?> - -class storing schema info for a specific contentType - -### Constructor Summary -| Constructor and Description | -| --------------------------- | -| ApplicationjsonMediaType()
Creates an instance | - -### Method Summary -| Modifier and Type | Method and Description | -| ----------------- | ---------------------- | -| [ApplicationjsonSchema.ApplicationjsonSchema1](../../../../paths/storeorder/post/responses/code200response/content/applicationjson/ApplicationjsonSchema.md#applicationjsonschema1) | schema()
the schema for this MediaType | -| Nothing? | encoding()
the encoding info | - -## SealedResponseBody -public sealed interface SealedResponseBody
-permits
-[ApplicationxmlResponseBody](#applicationxmlresponsebody), -[ApplicationjsonResponseBody](#applicationjsonresponsebody) - -sealed interface that stores response body - -## ApplicationxmlResponseBody -public record ApplicationxmlResponseBody
-implements [SealedResponseBody](#sealedresponsebody) - -A record class to store response body for contentType="application/xml" - -### Constructor Summary -| Constructor and Description | -| --------------------------- | -| ApplicationxmlResponseBody(ApplicationxmlSchema.[Order1Boxed](../../../../components/schemas/Order.md#order1boxed) body)
Creates an instance | - -### Method Summary -| Modifier and Type | Method and Description | -| ----------------- | ---------------------- | -| ApplicationxmlSchema.[Order1Boxed](../../../../components/schemas/Order.md#order1boxed) | body()
returns the body passed in in the constructor | -## ApplicationjsonResponseBody -public record ApplicationjsonResponseBody
-implements [SealedResponseBody](#sealedresponsebody) - -A record class to store response body for contentType="application/json" - -### Constructor Summary -| Constructor and Description | -| --------------------------- | -| ApplicationjsonResponseBody(ApplicationjsonSchema.[Order1Boxed](../../../../components/schemas/Order.md#order1boxed) body)
Creates an instance | - -### Method Summary -| Modifier and Type | Method and Description | -| ----------------- | ---------------------- | -| ApplicationjsonSchema.[Order1Boxed](../../../../components/schemas/Order.md#order1boxed) | body()
returns the body passed in in the constructor | - -## StoreorderPostCode200Response1 -public static class StoreorderPostCode200Response1
-extends ResponseDeserializer<[SealedResponseBody](#sealedresponsebody), Nothing?, [SealedMediaType](#sealedmediatype)> - -a class that deserializes responses - -### Constructor Summary -| Constructor and Description | -| --------------------------- | -| StoreorderPostCode200Response1()
Creates an instance | - -### Field Summary -| Modifier and Type | Field and Description | -| ----------------- | --------------------- | -| Map | content = Map.ofEntries(
    new AbstractMap.SimpleEntry<>("application/xml", new [ApplicationxmlMediaType](#applicationxmlmediatype)()),
    new AbstractMap.SimpleEntry<>("application/json", new [ApplicationjsonMediaType](#applicationjsonmediatype)())
)
the contentType to schema info | - -### Method Summary -| Modifier and Type | Method and Description | -| ----------------- | ---------------------- | -| ApiResponse<[SealedResponseBody](#sealedresponsebody), Nothing?> | deserialize(HttpResponse response, SchemaConfiguration configuration)
called by endpoint when deserialize responses | diff --git a/samples/client/petstore/kotlin/docs/paths/storeorder/post/responses/StoreorderPostCode400Response.md b/samples/client/petstore/kotlin/docs/paths/storeorder/post/responses/StoreorderPostCode400Response.md deleted file mode 100644 index 28d7dfe5625..00000000000 --- a/samples/client/petstore/kotlin/docs/paths/storeorder/post/responses/StoreorderPostCode400Response.md +++ /dev/null @@ -1,32 +0,0 @@ -# StoreorderPostCode400Response - -public class StoreorderPostCode400Response - -A class that contains necessary nested response classes -- a class that extends ResponseDeserializer and is used to deserialize responses - -## Nested Class Summary -| Modifier and Type | Class and Description | -| ----------------- | --------------------- | -| static class | [StoreorderPostCode400Response.StoreorderPostCode400Response1](#storeorderpostcode400response1)
class that deserializes responses | - -## StoreorderPostCode400Response1 -public static class StoreorderPostCode400Response1
-extends ResponseDeserializer - -a class that deserializes responses - -### Constructor Summary -| Constructor and Description | -| --------------------------- | -| StoreorderPostCode400Response1()
Creates an instance | - -### Field Summary -| Modifier and Type | Field and Description | -| ----------------- | --------------------- | -| Map | content = MapUtils.makeMap(
)
the contentType to schema info | - -### Method Summary -| Modifier and Type | Method and Description | -| ----------------- | ---------------------- | -| ApiResponse | deserialize(HttpResponse response, SchemaConfiguration configuration)
called by endpoint when deserialize responses | diff --git a/samples/client/petstore/kotlin/docs/paths/storeorder/post/responses/code200response/content/applicationjson/ApplicationjsonSchema.md b/samples/client/petstore/kotlin/docs/paths/storeorder/post/responses/code200response/content/applicationjson/ApplicationjsonSchema.md deleted file mode 100644 index e069f9c21c8..00000000000 --- a/samples/client/petstore/kotlin/docs/paths/storeorder/post/responses/code200response/content/applicationjson/ApplicationjsonSchema.md +++ /dev/null @@ -1,19 +0,0 @@ -# ApplicationjsonSchema -public class ApplicationjsonSchema
-extends [Order1](../../../../../../../components/schemas/Order.md#order) - -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 - -## Nested Class Summary -| Modifier and Type | Class and Description | -| ----------------- | ---------------------- | -| static class | [ApplicationjsonSchema.ApplicationjsonSchema1](#applicationjsonschema1)
schema class | - -## ApplicationjsonSchema1 -public static class ApplicationjsonSchema1
-extends [Order.Order1](../../../../../../../components/schemas/Order.md#order1) - -A schema class that validates payloads diff --git a/samples/client/petstore/kotlin/docs/paths/storeorder/post/responses/code200response/content/applicationxml/ApplicationxmlSchema.md b/samples/client/petstore/kotlin/docs/paths/storeorder/post/responses/code200response/content/applicationxml/ApplicationxmlSchema.md deleted file mode 100644 index 751649039e1..00000000000 --- a/samples/client/petstore/kotlin/docs/paths/storeorder/post/responses/code200response/content/applicationxml/ApplicationxmlSchema.md +++ /dev/null @@ -1,19 +0,0 @@ -# ApplicationxmlSchema -public class ApplicationxmlSchema
-extends [Order1](../../../../../../../components/schemas/Order.md#order) - -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 - -## Nested Class Summary -| Modifier and Type | Class and Description | -| ----------------- | ---------------------- | -| static class | [ApplicationxmlSchema.ApplicationxmlSchema1](#applicationxmlschema1)
schema class | - -## ApplicationxmlSchema1 -public static class ApplicationxmlSchema1
-extends [Order.Order1](../../../../../../../components/schemas/Order.md#order1) - -A schema class that validates payloads diff --git a/samples/client/petstore/kotlin/docs/paths/storeorderorderid/StoreorderorderidDelete.md b/samples/client/petstore/kotlin/docs/paths/storeorderorderid/StoreorderorderidDelete.md deleted file mode 100644 index 3af14480c82..00000000000 --- a/samples/client/petstore/kotlin/docs/paths/storeorderorderid/StoreorderorderidDelete.md +++ /dev/null @@ -1,188 +0,0 @@ -# StoreorderorderidDelete - -public class StoreorderorderidDelete - -A class that contains necessary endpoint classes -- a class that calls the endpoint method using the http verb -- a class that calls the endpoint method using the operationId name -- class(es) to store the request inputs -- builder(s) to set the request input data - -## Nested Class Summary -| Modifier and Type | Class and Description | -| ----------------- | --------------------- | -| static class | [Delete](#delete)
The class that has a delete method to call the endpoint | -| interface | [DeleteOrderOperation](#deleteorderoperation)
The interface that has a deleteOrder method to call the endpoint | -| static class | [DeleteRequest](#deleterequest)
The final request inputs class | -| static class | [DeleteNullableRequest](#deletenullablerequest)
The initial request inputs class | -| static class | [Delete0RequestBuilder](#delete0requestbuilder)
A builder for the request input class | -| static class | [DeleteRequestBuilder](#deleterequestbuilder)
A builder for the request input class | - -## Delete -public static class Delete extends ApiClient.ApiClient1 implements DeleteOperation
- -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.StoreorderorderidDeletePathParameters; -import org.openapijsonschematools.client.servers.RootServer0; -import org.openapijsonschematools.client.servers.RootServer1; -import org.openapijsonschematools.client.servers.RootServer2; -import org.openapijsonschematools.client.paths.storeorderorderid.delete.responses.StoreorderorderidDeleteCode400Response; -import org.openapijsonschematools.client.paths.storeorderorderid.delete.responses.StoreorderorderidDeleteCode404Response; -import org.openapijsonschematools.client.servers.RootServerInfo; -import org.openapijsonschematools.client.paths.storeorderorderid.StoreorderorderidDelete; -import org.openapijsonschematools.client.paths.storeorderorderid.delete.StoreorderorderidDeleteResponses; - -import java.io.IOException; -import java.util.Arrays; -import java.util.List; -import java.util.Map; -import java.util.AbstractMap; - -// if you want to use a server that is not SERVER_0 pass it in here and change the ServerIndex input below -ApiConfiguration.ServerInfo serverInfo = new ApiConfiguration.ServerInfoBuilder() - .rootServerInfo( - new RootServerInfo.RootServerInfoBuilder() - .rootServer0(new RootServer0()) - .build() - ) - .build(); -ApiConfiguration.ServerIndexInfo serverIndexInfo = new ApiConfiguration.ServerIndexInfoBuilder() - .rootServerInfoServerIndex(RootServerInfo.ServerIndex.SERVER_0) - .build(); -Duration timeout = Duration.ofSeconds(1L); -Map> defaultHeaders = Map.of("User-Agent", List.of("OpenAPI-JSON-Schema-Generator/1.0.0/java")); -ApiConfiguration apiConfiguration = new ApiConfiguration( - serverInfo - serverIndexInfo, - timeout, - defaultHeaders -); -SchemaConfiguration schemaConfiguration = new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().build()); -StoreorderorderidDelete.Delete apiClient = new StoreorderorderidDelete.Delete(apiConfiguration, schemaConfiguration); - - -// Map validation -StoreorderorderidDeletePathParameters.PathParametersMap pathParameters = - StoreorderorderidDeletePathParameters.StoreorderorderidDeletePathParameters1.validate( - new StoreorderorderidDeletePathParameters.PathParametersMapBuilder() - .order_id("a") - - .build(), - schemaConfiguration -); - -var request = new StoreorderorderidDelete.DeleteRequestBuilder() - .pathParameters(pathParameters) - .build(); - -Nothing? response; -try { - response = apiClient.delete(request); -} catch (StoreorderorderidDeleteCode400Response.ResponseApiException | StoreorderorderidDeleteCode404Response.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 | -| --------------------------- | -| Delete(ApiConfiguration apiConfiguration, SchemaConfiguration schemaConfiguration)
Creates an instance | - -### Method Summary -| Modifier and Type | Method and Description | -| ----------------- | ---------------------- | -| Nothing? | delete([DeleteRequest](#deleterequest) request) | - -## DeleteOrderOperation -public interface DeleteOrderOperation
- -an interface that allows one to call the endpoint using a method named deleteOrder by the operationId - -### Method Summary -| Modifier and Type | Method and Description | -| ----------------- | ---------------------- | -| Nothing? | deleteOrder([DeleteRequest](#deleterequest) request) | - -## DeleteRequest -public static class DeleteRequest
- -a class that stores the final request inputs - -### Field Summary -| Modifier and Type | Field and Description | -| ----------------- | --------------------- | -| [StoreorderorderidDeletePathParameters.PathParametersMap](../../paths/storeorderorderid/delete/StoreorderorderidDeletePathParameters.md#pathparametersmap) | pathParameters | -| [RootServerInfo.@Nullable ServerIndex](../../RootServerInfo.md#serverindex) | serverIndex
optional. Note: this will override the value in apiConfiguration | -| @Nullable Duration | timeout
optional. Note: this will override the value in apiConfiguration | - -## DeleteNullableRequest -public static class DeleteNullableRequest
- -a class that stores the initial request inputs - -### Field Summary -| Modifier and Type | Field and Description | -| ----------------- | --------------------- | -| [StoreorderorderidDeletePathParameters.@Nullable PathParametersMap](../../paths/storeorderorderid/delete/StoreorderorderidDeletePathParameters.md#pathparametersmap) | pathParameters | -| [RootServerInfo.@Nullable ServerIndex](../../RootServerInfo.md#serverindex) | serverIndex | -| @Nullable Duration | timeout | - -## Delete0RequestBuilder -public static class Delete0RequestBuilder
- -a builder for request inputs - -### Constructor Summary -| Constructor and Description | -| --------------------------- | -| Delete0RequestBuilder(Delete0RequestBuilder instance)
Creates a builder that contains the passed instance | - -### Method Summary -| Modifier and Type | Method and Description | -| ----------------- | ---------------------- | -| [DeleteRequest](#deleterequest) | build()
Returns the request input used to call an endpoint method | -| [Delete0RequestBuilder](#delete0requestbuilder) | serverIndex([RootServerInfo.ServerIndex](../../RootServerInfo.md#serverindex) serverIndex)
sets the optional property. Note: this will override the value in apiConfiguration | -| [Delete0RequestBuilder](#delete0requestbuilder) | timeout(Duration timeout)
sets the optional property. Note: this will override the value in apiConfiguration | - -## DeleteRequestBuilder -public static class DeleteRequestBuilder
- -a builder for request inputs - -### Constructor Summary -| Constructor and Description | -| --------------------------- | -| DeleteRequestBuilder()
Creates a builder that contains null for all parameters | - -### Method Summary -| Modifier and Type | Method and Description | -| ----------------- | ---------------------- | -| [Delete0RequestBuilder](#delete0requestbuilder) | pathParameters([StoreorderorderidDeletePathParametersPathParametersMap](../../paths/storeorderorderid/delete/StoreorderorderidDeletePathParameters.md#pathparametersmap) pathParameters)
sets the property | - -[[Back to top]](#top) [[Back to README]](../../../README.md) diff --git a/samples/client/petstore/kotlin/docs/paths/storeorderorderid/StoreorderorderidGet.md b/samples/client/petstore/kotlin/docs/paths/storeorderorderid/StoreorderorderidGet.md deleted file mode 100644 index 2605c3ef410..00000000000 --- a/samples/client/petstore/kotlin/docs/paths/storeorderorderid/StoreorderorderidGet.md +++ /dev/null @@ -1,196 +0,0 @@ -# StoreorderorderidGet - -public class StoreorderorderidGet - -A class that contains necessary endpoint classes -- a class that calls the endpoint method using the http verb -- a class that calls the endpoint method using the operationId name -- class(es) to store the request inputs -- builder(s) to set the request input data - -## Nested Class Summary -| Modifier and Type | Class and Description | -| ----------------- | --------------------- | -| static class | [Get](#get)
The class that has a get method to call the endpoint | -| interface | [GetOrderByIdOperation](#getorderbyidoperation)
The interface that has a getOrderById method to call the endpoint | -| static class | [GetRequest](#getrequest)
The final request inputs class | -| static class | [GetNullableRequest](#getnullablerequest)
The initial request inputs class | -| static class | [Get0RequestBuilder](#get0requestbuilder)
A builder for the request input class | -| static class | [GetRequestBuilder](#getrequestbuilder)
A builder for the request input class | - -## Get -public static class Get extends ApiClient.ApiClient1 implements GetOperation
- -a class that allows one to call the endpoint using a method named get - -### 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.get.StoreorderorderidGetPathParameters; -import org.openapijsonschematools.client.servers.RootServer0; -import org.openapijsonschematools.client.servers.RootServer1; -import org.openapijsonschematools.client.servers.RootServer2; -import org.openapijsonschematools.client.paths.storeorderorderid.get.responses.StoreorderorderidGetCode200Response; -import org.openapijsonschematools.client.paths.storeorderorderid.get.responses.StoreorderorderidGetCode400Response; -import org.openapijsonschematools.client.paths.storeorderorderid.get.responses.StoreorderorderidGetCode404Response; -import org.openapijsonschematools.client.servers.RootServerInfo; -import org.openapijsonschematools.client.paths.storeorderorderid.StoreorderorderidGet; -import org.openapijsonschematools.client.paths.storeorderorderid.get.StoreorderorderidGetResponses; - -import java.io.IOException; -import java.util.Arrays; -import java.util.List; -import java.util.Map; -import java.util.AbstractMap; - -// if you want to use a server that is not SERVER_0 pass it in here and change the ServerIndex input below -ApiConfiguration.ServerInfo serverInfo = new ApiConfiguration.ServerInfoBuilder() - .rootServerInfo( - new RootServerInfo.RootServerInfoBuilder() - .rootServer0(new RootServer0()) - .build() - ) - .build(); -ApiConfiguration.ServerIndexInfo serverIndexInfo = new ApiConfiguration.ServerIndexInfoBuilder() - .rootServerInfoServerIndex(RootServerInfo.ServerIndex.SERVER_0) - .build(); -Duration timeout = Duration.ofSeconds(1L); -Map> defaultHeaders = Map.of("User-Agent", List.of("OpenAPI-JSON-Schema-Generator/1.0.0/java")); -ApiConfiguration apiConfiguration = new ApiConfiguration( - serverInfo - serverIndexInfo, - timeout, - defaultHeaders -); -SchemaConfiguration schemaConfiguration = new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().build()); -StoreorderorderidGet.Get apiClient = new StoreorderorderidGet.Get(apiConfiguration, schemaConfiguration); - - -// Map validation -StoreorderorderidGetPathParameters.PathParametersMap pathParameters = - StoreorderorderidGetPathParameters.StoreorderorderidGetPathParameters1.validate( - new StoreorderorderidGetPathParameters.PathParametersMapBuilder() - .order_id(1L) - - .build(), - schemaConfiguration -); - -var request = new StoreorderorderidGet.GetRequestBuilder() - .pathParameters(pathParameters) - .build(); - -StoreorderorderidGetResponses.EndpointResponse response; -try { - response = apiClient.get(request); -} catch (StoreorderorderidGetCode400Response.ResponseApiException | StoreorderorderidGetCode404Response.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; -} -StoreorderorderidGetResponses.EndpointStoreorderorderidGetCode200Response castResponse = (StoreorderorderidGetResponses.EndpointStoreorderorderidGetCode200Response) response; -if (castResponse.body instanceof StoreorderorderidGetCode200Response.ApplicationxmlResponseBody deserializedBody) { - // handle deserialized body here -} else { - StoreorderorderidGetCode200Response.ApplicationjsonResponseBody deserializedBody = (StoreorderorderidGetCode200Response.ApplicationjsonResponseBody) castResponse.body; - // handle deserialized body here -} -``` -### Constructor Summary -| Constructor and Description | -| --------------------------- | -| Get(ApiConfiguration apiConfiguration, SchemaConfiguration schemaConfiguration)
Creates an instance | - -### Method Summary -| Modifier and Type | Method and Description | -| ----------------- | ---------------------- | -| [StoreorderorderidGetResponses.EndpointResponse](../../paths/storeorderorderid/get/StoreorderorderidGetResponses.md#endpointresponse) | get([GetRequest](#getrequest) request) | - -## GetOrderByIdOperation -public interface GetOrderByIdOperation
- -an interface that allows one to call the endpoint using a method named getOrderById by the operationId - -### Method Summary -| Modifier and Type | Method and Description | -| ----------------- | ---------------------- | -| [StoreorderorderidGetResponses.EndpointResponse](../../paths/storeorderorderid/get/StoreorderorderidGetResponses.md#endpointresponse) | getOrderById([GetRequest](#getrequest) request) | - -## GetRequest -public static class GetRequest
- -a class that stores the final request inputs - -### Field Summary -| Modifier and Type | Field and Description | -| ----------------- | --------------------- | -| [StoreorderorderidGetPathParameters.PathParametersMap](../../paths/storeorderorderid/get/StoreorderorderidGetPathParameters.md#pathparametersmap) | pathParameters | -| [RootServerInfo.@Nullable ServerIndex](../../RootServerInfo.md#serverindex) | serverIndex
optional. Note: this will override the value in apiConfiguration | -| @Nullable Duration | timeout
optional. Note: this will override the value in apiConfiguration | - -## GetNullableRequest -public static class GetNullableRequest
- -a class that stores the initial request inputs - -### Field Summary -| Modifier and Type | Field and Description | -| ----------------- | --------------------- | -| [StoreorderorderidGetPathParameters.@Nullable PathParametersMap](../../paths/storeorderorderid/get/StoreorderorderidGetPathParameters.md#pathparametersmap) | pathParameters | -| [RootServerInfo.@Nullable ServerIndex](../../RootServerInfo.md#serverindex) | serverIndex | -| @Nullable Duration | timeout | - -## Get0RequestBuilder -public static class Get0RequestBuilder
- -a builder for request inputs - -### Constructor Summary -| Constructor and Description | -| --------------------------- | -| Get0RequestBuilder(Get0RequestBuilder instance)
Creates a builder that contains the passed instance | - -### Method Summary -| Modifier and Type | Method and Description | -| ----------------- | ---------------------- | -| [GetRequest](#getrequest) | build()
Returns the request input used to call an endpoint method | -| [Get0RequestBuilder](#get0requestbuilder) | serverIndex([RootServerInfo.ServerIndex](../../RootServerInfo.md#serverindex) serverIndex)
sets the optional property. Note: this will override the value in apiConfiguration | -| [Get0RequestBuilder](#get0requestbuilder) | timeout(Duration timeout)
sets the optional property. Note: this will override the value in apiConfiguration | - -## GetRequestBuilder -public static class GetRequestBuilder
- -a builder for request inputs - -### Constructor Summary -| Constructor and Description | -| --------------------------- | -| GetRequestBuilder()
Creates a builder that contains null for all parameters | - -### Method Summary -| Modifier and Type | Method and Description | -| ----------------- | ---------------------- | -| [Get0RequestBuilder](#get0requestbuilder) | pathParameters([StoreorderorderidGetPathParametersPathParametersMap](../../paths/storeorderorderid/get/StoreorderorderidGetPathParameters.md#pathparametersmap) pathParameters)
sets the property | - -[[Back to top]](#top) [[Back to README]](../../../README.md) diff --git a/samples/client/petstore/kotlin/docs/paths/storeorderorderid/delete/StoreorderorderidDeletePathParameters.md b/samples/client/petstore/kotlin/docs/paths/storeorderorderid/delete/StoreorderorderidDeletePathParameters.md deleted file mode 100644 index 3c27c5e441d..00000000000 --- a/samples/client/petstore/kotlin/docs/paths/storeorderorderid/delete/StoreorderorderidDeletePathParameters.md +++ /dev/null @@ -1,268 +0,0 @@ -# StoreorderorderidDeletePathParameters -public class StoreorderorderidDeletePathParameters
- -A class that contains necessary nested -- schema classes (which validate payloads), extends JsonSchema -- sealed interfaces which store validated payloads, java version of a sum type -- boxed classes which store validated payloads, sealed permits class implementations -- classes to store validated map payloads, extends FrozenMap -- classes to build inputs for map payloads - -## Nested Class Summary -| Modifier and Type | Class and Description | -| ----------------- | ---------------------- | -| sealed interface | [StoreorderorderidDeletePathParameters.StoreorderorderidDeletePathParameters1Boxed](#storeorderorderiddeletepathparameters1boxed)
sealed interface for validated payloads | -| record | [StoreorderorderidDeletePathParameters.StoreorderorderidDeletePathParameters1BoxedMap](#storeorderorderiddeletepathparameters1boxedmap)
boxed class to store validated Map payloads | -| static class | [StoreorderorderidDeletePathParameters.StoreorderorderidDeletePathParameters1](#storeorderorderiddeletepathparameters1)
schema class | -| static class | [StoreorderorderidDeletePathParameters.PathParametersMapBuilder](#pathparametersmapbuilder)
builder for Map payloads | -| static class | [StoreorderorderidDeletePathParameters.PathParametersMap](#pathparametersmap)
output class for Map payloads | -| sealed interface | [StoreorderorderidDeletePathParameters.AdditionalPropertiesBoxed](#additionalpropertiesboxed)
sealed interface for validated payloads | -| record | [StoreorderorderidDeletePathParameters.AdditionalPropertiesBoxedVoid](#additionalpropertiesboxedvoid)
boxed class to store validated null payloads | -| record | [StoreorderorderidDeletePathParameters.AdditionalPropertiesBoxedBoolean](#additionalpropertiesboxedboolean)
boxed class to store validated boolean payloads | -| record | [StoreorderorderidDeletePathParameters.AdditionalPropertiesBoxedNumber](#additionalpropertiesboxednumber)
boxed class to store validated Number payloads | -| record | [StoreorderorderidDeletePathParameters.AdditionalPropertiesBoxedString](#additionalpropertiesboxedstring)
boxed class to store validated String payloads | -| record | [StoreorderorderidDeletePathParameters.AdditionalPropertiesBoxedList](#additionalpropertiesboxedlist)
boxed class to store validated List payloads | -| record | [StoreorderorderidDeletePathParameters.AdditionalPropertiesBoxedMap](#additionalpropertiesboxedmap)
boxed class to store validated Map payloads | -| static class | [StoreorderorderidDeletePathParameters.AdditionalProperties](#additionalproperties)
schema class | - -## StoreorderorderidDeletePathParameters1Boxed -public sealed interface StoreorderorderidDeletePathParameters1Boxed
-permits
-[StoreorderorderidDeletePathParameters1BoxedMap](#storeorderorderiddeletepathparameters1boxedmap) - -sealed interface that stores validated payloads using boxed classes - -## StoreorderorderidDeletePathParameters1BoxedMap -public record StoreorderorderidDeletePathParameters1BoxedMap
-implements [StoreorderorderidDeletePathParameters1Boxed](#storeorderorderiddeletepathparameters1boxed) - -record that stores validated Map payloads, sealed permits implementation - -### Constructor Summary -| Constructor and Description | -| --------------------------- | -| StoreorderorderidDeletePathParameters1BoxedMap([PathParametersMap](#pathparametersmap) data)
Creates an instance, private visibility | - -### Method Summary -| Modifier and Type | Method and Description | -| ----------------- | ---------------------- | -| [PathParametersMap](#pathparametersmap) | data()
validated payload | -| @Nullable Object | getData()
validated payload | - -## StoreorderorderidDeletePathParameters1 -public static class StoreorderorderidDeletePathParameters1
-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.storeorderorderid.delete.StoreorderorderidDeletePathParameters; - -import java.util.Arrays; -import java.util.List; -import java.util.AbstractMap; - -static final SchemaConfiguration configuration = new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().build()); - -// Map validation -StoreorderorderidDeletePathParameters.PathParametersMap validatedPayload = - StoreorderorderidDeletePathParameters.StoreorderorderidDeletePathParameters1.validate( - new StoreorderorderidDeletePathParameters.PathParametersMapBuilder() - .order_id("a") - - .build(), - configuration -); -``` - -### Field Summary -| Modifier and Type | Field and Description | -| ----------------- | ---------------------- | -| Set> | type = Set.of(Map.class) | -| Map> | properties = Map.ofEntries(
    new PropertyEntry("order_id", [Schema0.Schema01.class](../../../paths/storeorderorderid/delete/parameters/parameter0/Schema0.md#schema01))
)
| -| Set | required = Set.of(
    "order_id"
)
| -| Class | additionalProperties = [AdditionalProperties.class](#additionalproperties) | - -### Method Summary -| Modifier and Type | Method and Description | -| ----------------- | ---------------------- | -| [PathParametersMap](#pathparametersmap) | validate([Map<?, ?>](#pathparametersmapbuilder) arg, SchemaConfiguration configuration) | -| [StoreorderorderidDeletePathParameters1BoxedMap](#storeorderorderiddeletepathparameters1boxedmap) | validateAndBox([Map<?, ?>](#pathparametersmapbuilder) arg, SchemaConfiguration configuration) | -| [StoreorderorderidDeletePathParameters1Boxed](#storeorderorderiddeletepathparameters1boxed) | validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) | -| @Nullable Object | validate(@Nullable Object arg, SchemaConfiguration configuration) | - -## PathParametersMap0Builder -public class PathParametersMap0Builder
-builder for `Map` - -A class that builds the Map input type - -### Constructor Summary -| Constructor and Description | -| --------------------------- | -| PathParametersMap0Builder(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 | - -## PathParametersMapBuilder -public class PathParametersMapBuilder
-builder for `Map` - -A class that builds the Map input type - -### Constructor Summary -| Constructor and Description | -| --------------------------- | -| PathParametersMapBuilder()
Creates a builder that contains an empty map | - -### Method Summary -| Modifier and Type | Method and Description | -| ----------------- | ---------------------- | -| [PathParametersMap0Builder](#pathparametersmap0builder) | order_id(String value) | - -## PathParametersMap -public static class PathParametersMap
-extends FrozenMap - -A class to store validated Map payloads - -### Method Summary -| Modifier and Type | Method and Description | -| ----------------- | ---------------------- | -| static [PathParametersMap](#pathparametersmap) | of([Map](#pathparametersmapbuilder) arg, SchemaConfiguration configuration) | -| String | order_id()
| - -## 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(Nothing? data)
Creates an instance, private visibility | - -### Method Summary -| Modifier and Type | Method and Description | -| ----------------- | ---------------------- | -| Nothing? | 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/kotlin/docs/paths/storeorderorderid/delete/StoreorderorderidDeleteResponses.md b/samples/client/petstore/kotlin/docs/paths/storeorderorderid/delete/StoreorderorderidDeleteResponses.md deleted file mode 100644 index e4447a09189..00000000000 --- a/samples/client/petstore/kotlin/docs/paths/storeorderorderid/delete/StoreorderorderidDeleteResponses.md +++ /dev/null @@ -1,10 +0,0 @@ -# StoreorderorderidDeleteResponses - -public class StoreorderorderidDeleteResponses - -A class that contains necessary responses classes - -## Nested Class Summary -| Modifier and Type | Class and Description | -| ----------------- | --------------------- | - diff --git a/samples/client/petstore/kotlin/docs/paths/storeorderorderid/delete/parameters/parameter0/Schema0.md b/samples/client/petstore/kotlin/docs/paths/storeorderorderid/delete/parameters/parameter0/Schema0.md deleted file mode 100644 index 9ff90e0bc35..00000000000 --- a/samples/client/petstore/kotlin/docs/paths/storeorderorderid/delete/parameters/parameter0/Schema0.md +++ /dev/null @@ -1,49 +0,0 @@ -# Schema0 -public class Schema0
- -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 - -## Nested Class Summary -| Modifier and Type | Class and Description | -| ----------------- | ---------------------- | -| sealed interface | [Schema0.Schema01Boxed](#schema01boxed)
sealed interface for validated payloads | -| record | [Schema0.Schema01BoxedString](#schema01boxedstring)
boxed class to store validated String payloads | -| static class | [Schema0.Schema01](#schema01)
schema class | - -## Schema01Boxed -public sealed interface Schema01Boxed
-permits
-[Schema01BoxedString](#schema01boxedstring) - -sealed interface that stores validated payloads using boxed classes - -## Schema01BoxedString -public record Schema01BoxedString
-implements [Schema01Boxed](#schema01boxed) - -record that stores validated String payloads, sealed permits implementation - -### Constructor Summary -| Constructor and Description | -| --------------------------- | -| Schema01BoxedString(String data)
Creates an instance, private visibility | - -### Method Summary -| Modifier and Type | Method and Description | -| ----------------- | ---------------------- | -| String | data()
validated payload | -| @Nullable Object | getData()
validated payload | - -## Schema01 -public static class Schema01
-extends StringJsonSchema.StringJsonSchema1 - -A schema class that validates payloads - -| Methods Inherited from class org.openapijsonschematools.client.schemas.StringJsonSchema.StringJsonSchema1 | -| ------------------------------------------------------------------ | -| validate | -| validateAndBox | diff --git a/samples/client/petstore/kotlin/docs/paths/storeorderorderid/delete/responses/StoreorderorderidDeleteCode400Response.md b/samples/client/petstore/kotlin/docs/paths/storeorderorderid/delete/responses/StoreorderorderidDeleteCode400Response.md deleted file mode 100644 index 57c9f648969..00000000000 --- a/samples/client/petstore/kotlin/docs/paths/storeorderorderid/delete/responses/StoreorderorderidDeleteCode400Response.md +++ /dev/null @@ -1,32 +0,0 @@ -# StoreorderorderidDeleteCode400Response - -public class StoreorderorderidDeleteCode400Response - -A class that contains necessary nested response classes -- a class that extends ResponseDeserializer and is used to deserialize responses - -## Nested Class Summary -| Modifier and Type | Class and Description | -| ----------------- | --------------------- | -| static class | [StoreorderorderidDeleteCode400Response.StoreorderorderidDeleteCode400Response1](#storeorderorderiddeletecode400response1)
class that deserializes responses | - -## StoreorderorderidDeleteCode400Response1 -public static class StoreorderorderidDeleteCode400Response1
-extends ResponseDeserializer - -a class that deserializes responses - -### Constructor Summary -| Constructor and Description | -| --------------------------- | -| StoreorderorderidDeleteCode400Response1()
Creates an instance | - -### Field Summary -| Modifier and Type | Field and Description | -| ----------------- | --------------------- | -| Map | content = MapUtils.makeMap(
)
the contentType to schema info | - -### Method Summary -| Modifier and Type | Method and Description | -| ----------------- | ---------------------- | -| ApiResponse | deserialize(HttpResponse response, SchemaConfiguration configuration)
called by endpoint when deserialize responses | diff --git a/samples/client/petstore/kotlin/docs/paths/storeorderorderid/delete/responses/StoreorderorderidDeleteCode404Response.md b/samples/client/petstore/kotlin/docs/paths/storeorderorderid/delete/responses/StoreorderorderidDeleteCode404Response.md deleted file mode 100644 index c840323d5c4..00000000000 --- a/samples/client/petstore/kotlin/docs/paths/storeorderorderid/delete/responses/StoreorderorderidDeleteCode404Response.md +++ /dev/null @@ -1,32 +0,0 @@ -# StoreorderorderidDeleteCode404Response - -public class StoreorderorderidDeleteCode404Response - -A class that contains necessary nested response classes -- a class that extends ResponseDeserializer and is used to deserialize responses - -## Nested Class Summary -| Modifier and Type | Class and Description | -| ----------------- | --------------------- | -| static class | [StoreorderorderidDeleteCode404Response.StoreorderorderidDeleteCode404Response1](#storeorderorderiddeletecode404response1)
class that deserializes responses | - -## StoreorderorderidDeleteCode404Response1 -public static class StoreorderorderidDeleteCode404Response1
-extends ResponseDeserializer - -a class that deserializes responses - -### Constructor Summary -| Constructor and Description | -| --------------------------- | -| StoreorderorderidDeleteCode404Response1()
Creates an instance | - -### Field Summary -| Modifier and Type | Field and Description | -| ----------------- | --------------------- | -| Map | content = MapUtils.makeMap(
)
the contentType to schema info | - -### Method Summary -| Modifier and Type | Method and Description | -| ----------------- | ---------------------- | -| ApiResponse | deserialize(HttpResponse response, SchemaConfiguration configuration)
called by endpoint when deserialize responses | diff --git a/samples/client/petstore/kotlin/docs/paths/storeorderorderid/get/StoreorderorderidGetPathParameters.md b/samples/client/petstore/kotlin/docs/paths/storeorderorderid/get/StoreorderorderidGetPathParameters.md deleted file mode 100644 index 002e516da27..00000000000 --- a/samples/client/petstore/kotlin/docs/paths/storeorderorderid/get/StoreorderorderidGetPathParameters.md +++ /dev/null @@ -1,271 +0,0 @@ -# StoreorderorderidGetPathParameters -public class StoreorderorderidGetPathParameters
- -A class that contains necessary nested -- schema classes (which validate payloads), extends JsonSchema -- sealed interfaces which store validated payloads, java version of a sum type -- boxed classes which store validated payloads, sealed permits class implementations -- classes to store validated map payloads, extends FrozenMap -- classes to build inputs for map payloads - -## Nested Class Summary -| Modifier and Type | Class and Description | -| ----------------- | ---------------------- | -| sealed interface | [StoreorderorderidGetPathParameters.StoreorderorderidGetPathParameters1Boxed](#storeorderorderidgetpathparameters1boxed)
sealed interface for validated payloads | -| record | [StoreorderorderidGetPathParameters.StoreorderorderidGetPathParameters1BoxedMap](#storeorderorderidgetpathparameters1boxedmap)
boxed class to store validated Map payloads | -| static class | [StoreorderorderidGetPathParameters.StoreorderorderidGetPathParameters1](#storeorderorderidgetpathparameters1)
schema class | -| static class | [StoreorderorderidGetPathParameters.PathParametersMapBuilder](#pathparametersmapbuilder)
builder for Map payloads | -| static class | [StoreorderorderidGetPathParameters.PathParametersMap](#pathparametersmap)
output class for Map payloads | -| sealed interface | [StoreorderorderidGetPathParameters.AdditionalPropertiesBoxed](#additionalpropertiesboxed)
sealed interface for validated payloads | -| record | [StoreorderorderidGetPathParameters.AdditionalPropertiesBoxedVoid](#additionalpropertiesboxedvoid)
boxed class to store validated null payloads | -| record | [StoreorderorderidGetPathParameters.AdditionalPropertiesBoxedBoolean](#additionalpropertiesboxedboolean)
boxed class to store validated boolean payloads | -| record | [StoreorderorderidGetPathParameters.AdditionalPropertiesBoxedNumber](#additionalpropertiesboxednumber)
boxed class to store validated Number payloads | -| record | [StoreorderorderidGetPathParameters.AdditionalPropertiesBoxedString](#additionalpropertiesboxedstring)
boxed class to store validated String payloads | -| record | [StoreorderorderidGetPathParameters.AdditionalPropertiesBoxedList](#additionalpropertiesboxedlist)
boxed class to store validated List payloads | -| record | [StoreorderorderidGetPathParameters.AdditionalPropertiesBoxedMap](#additionalpropertiesboxedmap)
boxed class to store validated Map payloads | -| static class | [StoreorderorderidGetPathParameters.AdditionalProperties](#additionalproperties)
schema class | - -## StoreorderorderidGetPathParameters1Boxed -public sealed interface StoreorderorderidGetPathParameters1Boxed
-permits
-[StoreorderorderidGetPathParameters1BoxedMap](#storeorderorderidgetpathparameters1boxedmap) - -sealed interface that stores validated payloads using boxed classes - -## StoreorderorderidGetPathParameters1BoxedMap -public record StoreorderorderidGetPathParameters1BoxedMap
-implements [StoreorderorderidGetPathParameters1Boxed](#storeorderorderidgetpathparameters1boxed) - -record that stores validated Map payloads, sealed permits implementation - -### Constructor Summary -| Constructor and Description | -| --------------------------- | -| StoreorderorderidGetPathParameters1BoxedMap([PathParametersMap](#pathparametersmap) data)
Creates an instance, private visibility | - -### Method Summary -| Modifier and Type | Method and Description | -| ----------------- | ---------------------- | -| [PathParametersMap](#pathparametersmap) | data()
validated payload | -| @Nullable Object | getData()
validated payload | - -## StoreorderorderidGetPathParameters1 -public static class StoreorderorderidGetPathParameters1
-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.storeorderorderid.get.StoreorderorderidGetPathParameters; - -import java.util.Arrays; -import java.util.List; -import java.util.AbstractMap; - -static final SchemaConfiguration configuration = new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().build()); - -// Map validation -StoreorderorderidGetPathParameters.PathParametersMap validatedPayload = - StoreorderorderidGetPathParameters.StoreorderorderidGetPathParameters1.validate( - new StoreorderorderidGetPathParameters.PathParametersMapBuilder() - .order_id(1L) - - .build(), - configuration -); -``` - -### Field Summary -| Modifier and Type | Field and Description | -| ----------------- | ---------------------- | -| Set> | type = Set.of(Map.class) | -| Map> | properties = Map.ofEntries(
    new PropertyEntry("order_id", [Schema0.Schema01.class](../../../paths/storeorderorderid/get/parameters/parameter0/Schema0.md#schema01))
)
| -| Set | required = Set.of(
    "order_id"
)
| -| Class | additionalProperties = [AdditionalProperties.class](#additionalproperties) | - -### Method Summary -| Modifier and Type | Method and Description | -| ----------------- | ---------------------- | -| [PathParametersMap](#pathparametersmap) | validate([Map<?, ?>](#pathparametersmapbuilder) arg, SchemaConfiguration configuration) | -| [StoreorderorderidGetPathParameters1BoxedMap](#storeorderorderidgetpathparameters1boxedmap) | validateAndBox([Map<?, ?>](#pathparametersmapbuilder) arg, SchemaConfiguration configuration) | -| [StoreorderorderidGetPathParameters1Boxed](#storeorderorderidgetpathparameters1boxed) | validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) | -| @Nullable Object | validate(@Nullable Object arg, SchemaConfiguration configuration) | - -## PathParametersMap0Builder -public class PathParametersMap0Builder
-builder for `Map` - -A class that builds the Map input type - -### Constructor Summary -| Constructor and Description | -| --------------------------- | -| PathParametersMap0Builder(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 | - -## PathParametersMapBuilder -public class PathParametersMapBuilder
-builder for `Map` - -A class that builds the Map input type - -### Constructor Summary -| Constructor and Description | -| --------------------------- | -| PathParametersMapBuilder()
Creates a builder that contains an empty map | - -### Method Summary -| Modifier and Type | Method and Description | -| ----------------- | ---------------------- | -| [PathParametersMap0Builder](#pathparametersmap0builder) | order_id(int value) | -| [PathParametersMap0Builder](#pathparametersmap0builder) | order_id(float value) | -| [PathParametersMap0Builder](#pathparametersmap0builder) | order_id(long value) | -| [PathParametersMap0Builder](#pathparametersmap0builder) | order_id(double value) | - -## PathParametersMap -public static class PathParametersMap
-extends FrozenMap - -A class to store validated Map payloads - -### Method Summary -| Modifier and Type | Method and Description | -| ----------------- | ---------------------- | -| static [PathParametersMap](#pathparametersmap) | of([Map](#pathparametersmapbuilder) arg, SchemaConfiguration configuration) | -| Number | order_id()
| - -## 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(Nothing? data)
Creates an instance, private visibility | - -### Method Summary -| Modifier and Type | Method and Description | -| ----------------- | ---------------------- | -| Nothing? | 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/kotlin/docs/paths/storeorderorderid/get/StoreorderorderidGetResponses.md b/samples/client/petstore/kotlin/docs/paths/storeorderorderid/get/StoreorderorderidGetResponses.md deleted file mode 100644 index e673e2affbc..00000000000 --- a/samples/client/petstore/kotlin/docs/paths/storeorderorderid/get/StoreorderorderidGetResponses.md +++ /dev/null @@ -1,29 +0,0 @@ -# StoreorderorderidGetResponses - -public class StoreorderorderidGetResponses - -A class that contains necessary responses classes -- a sealed interface, EndpointResponse, that stores endpoint responses -- records for each endpoint response - -## Nested Class Summary -| Modifier and Type | Class and Description | -| ----------------- | --------------------- | -| sealed interface | [EndpointResponse](#endpointresponse)
stores the endpoint responses | -| record | [EndpointStoreorderorderidGetCode200Response](#endpointstoreorderorderidgetcode200response)
the response for 200 | - -## EndpointResponse -public sealed interface EndpointResponse permits
-[EndpointStoreorderorderidGetCode200Response](#endpointstoreorderorderidgetcode200response) - -a sealed interface that stores endpoint responses - -## EndpointStoreorderorderidGetCode200Response -public record EndpointStoreorderorderidGetCode200Response( - HttpResponse response, - [StoreorderorderidGetCode200Response.SealedResponseBody](../../../paths/storeorderorderid/get/responses/StoreorderorderidGetCode200Response.md#sealedresponsebody) body, - Nothing? headers -) implements EndpointResponse, ApiResponse
- -a class that stores an endpoint response - diff --git a/samples/client/petstore/kotlin/docs/paths/storeorderorderid/get/parameters/parameter0/Schema0.md b/samples/client/petstore/kotlin/docs/paths/storeorderorderid/get/parameters/parameter0/Schema0.md deleted file mode 100644 index d6ff718bbf9..00000000000 --- a/samples/client/petstore/kotlin/docs/paths/storeorderorderid/get/parameters/parameter0/Schema0.md +++ /dev/null @@ -1,83 +0,0 @@ -# Schema0 -public class Schema0
- -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 - -## Nested Class Summary -| Modifier and Type | Class and Description | -| ----------------- | ---------------------- | -| sealed interface | [Schema0.Schema01Boxed](#schema01boxed)
sealed interface for validated payloads | -| record | [Schema0.Schema01BoxedNumber](#schema01boxednumber)
boxed class to store validated Number payloads | -| static class | [Schema0.Schema01](#schema01)
schema class | - -## Schema01Boxed -public sealed interface Schema01Boxed
-permits
-[Schema01BoxedNumber](#schema01boxednumber) - -sealed interface that stores validated payloads using boxed classes - -## Schema01BoxedNumber -public record Schema01BoxedNumber
-implements [Schema01Boxed](#schema01boxed) - -record that stores validated Number payloads, sealed permits implementation - -### Constructor Summary -| Constructor and Description | -| --------------------------- | -| Schema01BoxedNumber(Number data)
Creates an instance, private visibility | - -### Method Summary -| Modifier and Type | Method and Description | -| ----------------- | ---------------------- | -| Number | data()
validated payload | -| @Nullable Object | getData()
validated payload | - -## Schema01 -public static class Schema01
-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.storeorderorderid.get.parameters.parameter0.Schema0; - -import java.util.Arrays; -import java.util.List; -import java.util.AbstractMap; - -static final SchemaConfiguration configuration = new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().build()); - -// long validation -long validatedPayload = Schema0.Schema01.validate( - 1L, - configuration -); -``` - -### Field Summary -| Modifier and Type | Field and Description | -| ----------------- | ---------------------- | -| Set> | type = Set.of(
    Integer.class,
    Long.class,
    Float.class,
    Double.class
)
| -| String | type = "int64"; | -| Number | maximum = 5 | -| Number | minimum = 1 | - -### Method Summary -| Modifier and Type | Method and Description | -| ----------------- | ---------------------- | -| long | validate(long arg, SchemaConfiguration configuration) | -| [Schema01BoxedNumber](#schema01boxednumber) | validateAndBox(Number arg, SchemaConfiguration configuration) | -| [Schema01Boxed](#schema01boxed) | validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) | -| @Nullable Object | validate(@Nullable Object arg, SchemaConfiguration configuration) | diff --git a/samples/client/petstore/kotlin/docs/paths/storeorderorderid/get/responses/StoreorderorderidGetCode200Response.md b/samples/client/petstore/kotlin/docs/paths/storeorderorderid/get/responses/StoreorderorderidGetCode200Response.md deleted file mode 100644 index 8f350b2c6fc..00000000000 --- a/samples/client/petstore/kotlin/docs/paths/storeorderorderid/get/responses/StoreorderorderidGetCode200Response.md +++ /dev/null @@ -1,123 +0,0 @@ -# StoreorderorderidGetCode200Response - -public class StoreorderorderidGetCode200Response - -A class that contains necessary nested response classes -- SealedMediaType, a sealed interface which contains all the schema/encoding info for each contentType -- records which implement SealedMediaType, the concrete media types -- SealedResponseBody, a sealed interface which contains all the contentType/schema types -- records which implement SealedResponseBody, the concrete response body types -- a class that extends ResponseDeserializer and is used to deserialize responses - -## Nested Class Summary -| Modifier and Type | Class and Description | -| ----------------- | --------------------- | -| sealed interface | [StoreorderorderidGetCode200Response.SealedMediaType](#sealedmediatype)
media type sealed interface | -| record | [StoreorderorderidGetCode200Response.ApplicationxmlMediaType](#applicationxmlmediatype)
record storing schema + encoding for a specific contentType | -| record | [StoreorderorderidGetCode200Response.ApplicationjsonMediaType](#applicationjsonmediatype)
record storing schema + encoding for a specific contentType | -| sealed interface | [StoreorderorderidGetCode200Response.SealedResponseBody](#sealedresponsebody)
response body sealed interface | -| record | [StoreorderorderidGetCode200Response.ApplicationxmlResponseBody](#applicationxmlresponsebody)
implements sealed interface to store response body | -| record | [StoreorderorderidGetCode200Response.ApplicationjsonResponseBody](#applicationjsonresponsebody)
implements sealed interface to store response body | -| static class | [StoreorderorderidGetCode200Response.StoreorderorderidGetCode200Response1](#storeorderorderidgetcode200response1)
class that deserializes responses | - -## SealedMediaType -public sealed interface SealedMediaType
-permits
-[ApplicationxmlMediaType](#applicationxmlmediatype), -[ApplicationjsonMediaType](#applicationjsonmediatype) - -sealed interface that stores schema and encoding info - -## ApplicationxmlMediaType -public record ApplicationxmlMediaType
-implements [SealedMediaType](#sealedmediatype), MediaType<[ApplicationxmlSchema.ApplicationxmlSchema1](../../../../paths/storeorderorderid/get/responses/code200response/content/applicationxml/ApplicationxmlSchema.md#applicationxmlschema1), Nothing?> - -class storing schema info for a specific contentType - -### Constructor Summary -| Constructor and Description | -| --------------------------- | -| ApplicationxmlMediaType()
Creates an instance | - -### Method Summary -| Modifier and Type | Method and Description | -| ----------------- | ---------------------- | -| [ApplicationxmlSchema.ApplicationxmlSchema1](../../../../paths/storeorderorderid/get/responses/code200response/content/applicationxml/ApplicationxmlSchema.md#applicationxmlschema1) | schema()
the schema for this MediaType | -| Nothing? | encoding()
the encoding info | - -## ApplicationjsonMediaType -public record ApplicationjsonMediaType
-implements [SealedMediaType](#sealedmediatype), MediaType<[ApplicationjsonSchema.ApplicationjsonSchema1](../../../../paths/storeorderorderid/get/responses/code200response/content/applicationjson/ApplicationjsonSchema.md#applicationjsonschema1), Nothing?> - -class storing schema info for a specific contentType - -### Constructor Summary -| Constructor and Description | -| --------------------------- | -| ApplicationjsonMediaType()
Creates an instance | - -### Method Summary -| Modifier and Type | Method and Description | -| ----------------- | ---------------------- | -| [ApplicationjsonSchema.ApplicationjsonSchema1](../../../../paths/storeorderorderid/get/responses/code200response/content/applicationjson/ApplicationjsonSchema.md#applicationjsonschema1) | schema()
the schema for this MediaType | -| Nothing? | encoding()
the encoding info | - -## SealedResponseBody -public sealed interface SealedResponseBody
-permits
-[ApplicationxmlResponseBody](#applicationxmlresponsebody), -[ApplicationjsonResponseBody](#applicationjsonresponsebody) - -sealed interface that stores response body - -## ApplicationxmlResponseBody -public record ApplicationxmlResponseBody
-implements [SealedResponseBody](#sealedresponsebody) - -A record class to store response body for contentType="application/xml" - -### Constructor Summary -| Constructor and Description | -| --------------------------- | -| ApplicationxmlResponseBody(ApplicationxmlSchema.[Order1Boxed](../../../../components/schemas/Order.md#order1boxed) body)
Creates an instance | - -### Method Summary -| Modifier and Type | Method and Description | -| ----------------- | ---------------------- | -| ApplicationxmlSchema.[Order1Boxed](../../../../components/schemas/Order.md#order1boxed) | body()
returns the body passed in in the constructor | -## ApplicationjsonResponseBody -public record ApplicationjsonResponseBody
-implements [SealedResponseBody](#sealedresponsebody) - -A record class to store response body for contentType="application/json" - -### Constructor Summary -| Constructor and Description | -| --------------------------- | -| ApplicationjsonResponseBody(ApplicationjsonSchema.[Order1Boxed](../../../../components/schemas/Order.md#order1boxed) body)
Creates an instance | - -### Method Summary -| Modifier and Type | Method and Description | -| ----------------- | ---------------------- | -| ApplicationjsonSchema.[Order1Boxed](../../../../components/schemas/Order.md#order1boxed) | body()
returns the body passed in in the constructor | - -## StoreorderorderidGetCode200Response1 -public static class StoreorderorderidGetCode200Response1
-extends ResponseDeserializer<[SealedResponseBody](#sealedresponsebody), Nothing?, [SealedMediaType](#sealedmediatype)> - -a class that deserializes responses - -### Constructor Summary -| Constructor and Description | -| --------------------------- | -| StoreorderorderidGetCode200Response1()
Creates an instance | - -### Field Summary -| Modifier and Type | Field and Description | -| ----------------- | --------------------- | -| Map | content = Map.ofEntries(
    new AbstractMap.SimpleEntry<>("application/xml", new [ApplicationxmlMediaType](#applicationxmlmediatype)()),
    new AbstractMap.SimpleEntry<>("application/json", new [ApplicationjsonMediaType](#applicationjsonmediatype)())
)
the contentType to schema info | - -### Method Summary -| Modifier and Type | Method and Description | -| ----------------- | ---------------------- | -| ApiResponse<[SealedResponseBody](#sealedresponsebody), Nothing?> | deserialize(HttpResponse response, SchemaConfiguration configuration)
called by endpoint when deserialize responses | diff --git a/samples/client/petstore/kotlin/docs/paths/storeorderorderid/get/responses/StoreorderorderidGetCode400Response.md b/samples/client/petstore/kotlin/docs/paths/storeorderorderid/get/responses/StoreorderorderidGetCode400Response.md deleted file mode 100644 index 9e766c6e881..00000000000 --- a/samples/client/petstore/kotlin/docs/paths/storeorderorderid/get/responses/StoreorderorderidGetCode400Response.md +++ /dev/null @@ -1,32 +0,0 @@ -# StoreorderorderidGetCode400Response - -public class StoreorderorderidGetCode400Response - -A class that contains necessary nested response classes -- a class that extends ResponseDeserializer and is used to deserialize responses - -## Nested Class Summary -| Modifier and Type | Class and Description | -| ----------------- | --------------------- | -| static class | [StoreorderorderidGetCode400Response.StoreorderorderidGetCode400Response1](#storeorderorderidgetcode400response1)
class that deserializes responses | - -## StoreorderorderidGetCode400Response1 -public static class StoreorderorderidGetCode400Response1
-extends ResponseDeserializer - -a class that deserializes responses - -### Constructor Summary -| Constructor and Description | -| --------------------------- | -| StoreorderorderidGetCode400Response1()
Creates an instance | - -### Field Summary -| Modifier and Type | Field and Description | -| ----------------- | --------------------- | -| Map | content = MapUtils.makeMap(
)
the contentType to schema info | - -### Method Summary -| Modifier and Type | Method and Description | -| ----------------- | ---------------------- | -| ApiResponse | deserialize(HttpResponse response, SchemaConfiguration configuration)
called by endpoint when deserialize responses | diff --git a/samples/client/petstore/kotlin/docs/paths/storeorderorderid/get/responses/StoreorderorderidGetCode404Response.md b/samples/client/petstore/kotlin/docs/paths/storeorderorderid/get/responses/StoreorderorderidGetCode404Response.md deleted file mode 100644 index 857ead34d38..00000000000 --- a/samples/client/petstore/kotlin/docs/paths/storeorderorderid/get/responses/StoreorderorderidGetCode404Response.md +++ /dev/null @@ -1,32 +0,0 @@ -# StoreorderorderidGetCode404Response - -public class StoreorderorderidGetCode404Response - -A class that contains necessary nested response classes -- a class that extends ResponseDeserializer and is used to deserialize responses - -## Nested Class Summary -| Modifier and Type | Class and Description | -| ----------------- | --------------------- | -| static class | [StoreorderorderidGetCode404Response.StoreorderorderidGetCode404Response1](#storeorderorderidgetcode404response1)
class that deserializes responses | - -## StoreorderorderidGetCode404Response1 -public static class StoreorderorderidGetCode404Response1
-extends ResponseDeserializer - -a class that deserializes responses - -### Constructor Summary -| Constructor and Description | -| --------------------------- | -| StoreorderorderidGetCode404Response1()
Creates an instance | - -### Field Summary -| Modifier and Type | Field and Description | -| ----------------- | --------------------- | -| Map | content = MapUtils.makeMap(
)
the contentType to schema info | - -### Method Summary -| Modifier and Type | Method and Description | -| ----------------- | ---------------------- | -| ApiResponse | deserialize(HttpResponse response, SchemaConfiguration configuration)
called by endpoint when deserialize responses | diff --git a/samples/client/petstore/kotlin/docs/paths/storeorderorderid/get/responses/code200response/content/applicationjson/ApplicationjsonSchema.md b/samples/client/petstore/kotlin/docs/paths/storeorderorderid/get/responses/code200response/content/applicationjson/ApplicationjsonSchema.md deleted file mode 100644 index e069f9c21c8..00000000000 --- a/samples/client/petstore/kotlin/docs/paths/storeorderorderid/get/responses/code200response/content/applicationjson/ApplicationjsonSchema.md +++ /dev/null @@ -1,19 +0,0 @@ -# ApplicationjsonSchema -public class ApplicationjsonSchema
-extends [Order1](../../../../../../../components/schemas/Order.md#order) - -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 - -## Nested Class Summary -| Modifier and Type | Class and Description | -| ----------------- | ---------------------- | -| static class | [ApplicationjsonSchema.ApplicationjsonSchema1](#applicationjsonschema1)
schema class | - -## ApplicationjsonSchema1 -public static class ApplicationjsonSchema1
-extends [Order.Order1](../../../../../../../components/schemas/Order.md#order1) - -A schema class that validates payloads diff --git a/samples/client/petstore/kotlin/docs/paths/storeorderorderid/get/responses/code200response/content/applicationxml/ApplicationxmlSchema.md b/samples/client/petstore/kotlin/docs/paths/storeorderorderid/get/responses/code200response/content/applicationxml/ApplicationxmlSchema.md deleted file mode 100644 index 751649039e1..00000000000 --- a/samples/client/petstore/kotlin/docs/paths/storeorderorderid/get/responses/code200response/content/applicationxml/ApplicationxmlSchema.md +++ /dev/null @@ -1,19 +0,0 @@ -# ApplicationxmlSchema -public class ApplicationxmlSchema
-extends [Order1](../../../../../../../components/schemas/Order.md#order) - -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 - -## Nested Class Summary -| Modifier and Type | Class and Description | -| ----------------- | ---------------------- | -| static class | [ApplicationxmlSchema.ApplicationxmlSchema1](#applicationxmlschema1)
schema class | - -## ApplicationxmlSchema1 -public static class ApplicationxmlSchema1
-extends [Order.Order1](../../../../../../../components/schemas/Order.md#order1) - -A schema class that validates payloads diff --git a/samples/client/petstore/kotlin/docs/paths/user/UserPost.md b/samples/client/petstore/kotlin/docs/paths/user/UserPost.md deleted file mode 100644 index 956ce5f8ba3..00000000000 --- a/samples/client/petstore/kotlin/docs/paths/user/UserPost.md +++ /dev/null @@ -1,202 +0,0 @@ -# UserPost - -public class UserPost - -A class that contains necessary endpoint classes -- a class that calls the endpoint method using the http verb -- a class that calls the endpoint method using the operationId name -- class(es) to store the request inputs -- builder(s) to set the request input data - -## Nested Class Summary -| Modifier and Type | Class and Description | -| ----------------- | --------------------- | -| static class | [Post](#post)
The class that has a post method to call the endpoint | -| interface | [CreateUserOperation](#createuseroperation)
The interface that has a createUser method to call the endpoint | -| static class | [PostRequest](#postrequest)
The final request inputs class | -| static class | [PostNullableRequest](#postnullablerequest)
The initial request inputs class | -| static class | [Post0RequestBuilder](#post0requestbuilder)
A builder for the request input class | -| static class | [PostRequestBuilder](#postrequestbuilder)
A builder for the request input class | - -## Post -public static class Post 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.user.post.UserPostRequestBody; -import org.openapijsonschematools.client.components.schemas.User; -import org.openapijsonschematools.client.servers.RootServer0; -import org.openapijsonschematools.client.servers.RootServer1; -import org.openapijsonschematools.client.servers.RootServer2; -import org.openapijsonschematools.client.paths.user.post.responses.UserPostCodedefaultResponse; -import org.openapijsonschematools.client.servers.RootServerInfo; -import org.openapijsonschematools.client.paths.user.UserPost; -import org.openapijsonschematools.client.paths.user.post.UserPostResponses; - -import java.io.IOException; -import java.util.Arrays; -import java.util.List; -import java.util.Map; -import java.util.AbstractMap; - -// if you want to use a server that is not SERVER_0 pass it in here and change the ServerIndex input below -ApiConfiguration.ServerInfo serverInfo = new ApiConfiguration.ServerInfoBuilder() - .rootServerInfo( - new RootServerInfo.RootServerInfoBuilder() - .rootServer0(new RootServer0()) - .build() - ) - .build(); -ApiConfiguration.ServerIndexInfo serverIndexInfo = new ApiConfiguration.ServerIndexInfoBuilder() - .rootServerInfoServerIndex(RootServerInfo.ServerIndex.SERVER_0) - .build(); -Duration timeout = Duration.ofSeconds(1L); -Map> defaultHeaders = Map.of("User-Agent", List.of("OpenAPI-JSON-Schema-Generator/1.0.0/java")); -ApiConfiguration apiConfiguration = new ApiConfiguration( - serverInfo - serverIndexInfo, - timeout, - defaultHeaders -); -SchemaConfiguration schemaConfiguration = new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().build()); -UserPost.Post apiClient = new UserPost.Post(apiConfiguration, schemaConfiguration); - - -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 -); -UserPost.SealedRequestBody requestBody = new UserPost.ApplicationjsonRequestBody(requestBodyPayload); - -var request = new UserPost.PostRequestBuilder() - .requestBody(requestBody) - .build(); - -UserPostResponses.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; -} -UserPostResponses.EndpointUserPostCodedefaultResponse castResponse = (UserPostResponses.EndpointUserPostCodedefaultResponse) response; -``` -### Constructor Summary -| Constructor and Description | -| --------------------------- | -| Post(ApiConfiguration apiConfiguration, SchemaConfiguration schemaConfiguration)
Creates an instance | - -### Method Summary -| Modifier and Type | Method and Description | -| ----------------- | ---------------------- | -| [UserPostResponses.EndpointResponse](../../paths/user/post/UserPostResponses.md#endpointresponse) | post([PostRequest](#postrequest) request) | - -## CreateUserOperation -public interface CreateUserOperation
- -an interface that allows one to call the endpoint using a method named createUser by the operationId - -### Method Summary -| Modifier and Type | Method and Description | -| ----------------- | ---------------------- | -| [UserPostResponses.EndpointResponse](../../paths/user/post/UserPostResponses.md#endpointresponse) | createUser([PostRequest](#postrequest) request) | - -## PostRequest -public static class PostRequest
- -a class that stores the final request inputs - -### Field Summary -| Modifier and Type | Field and Description | -| ----------------- | --------------------- | -| [UserPostRequestBody.SealedRequestBody](../../paths/user/post/UserPostRequestBody.md#sealedrequestbody) | requestBody | -| [RootServerInfo.@Nullable ServerIndex](../../RootServerInfo.md#serverindex) | serverIndex
optional. Note: this will override the value in apiConfiguration | -| @Nullable Duration | timeout
optional. Note: this will override the value in apiConfiguration | - -## PostNullableRequest -public static class PostNullableRequest
- -a class that stores the initial request inputs - -### Field Summary -| Modifier and Type | Field and Description | -| ----------------- | --------------------- | -| [UserPostRequestBody.@Nullable SealedRequestBody](../../paths/user/post/UserPostRequestBody.md#sealedrequestbody) | requestBody | -| [RootServerInfo.@Nullable ServerIndex](../../RootServerInfo.md#serverindex) | serverIndex | -| @Nullable Duration | timeout | - -## Post0RequestBuilder -public static class Post0RequestBuilder
- -a builder for request inputs - -### Constructor Summary -| Constructor and Description | -| --------------------------- | -| Post0RequestBuilder(Post0RequestBuilder instance)
Creates a builder that contains the passed instance | - -### Method Summary -| Modifier and Type | Method and Description | -| ----------------- | ---------------------- | -| [PostRequest](#postrequest) | build()
Returns the request input used to call an endpoint method | -| [Post0RequestBuilder](#post0requestbuilder) | serverIndex([RootServerInfo.ServerIndex](../../RootServerInfo.md#serverindex) serverIndex)
sets the optional property. Note: this will override the value in apiConfiguration | -| [Post0RequestBuilder](#post0requestbuilder) | timeout(Duration timeout)
sets the optional property. Note: this will override the value in apiConfiguration | - -## PostRequestBuilder -public static class PostRequestBuilder
- -a builder for request inputs - -### Constructor Summary -| Constructor and Description | -| --------------------------- | -| PostRequestBuilder()
Creates a builder that contains null for all parameters | - -### Method Summary -| Modifier and Type | Method and Description | -| ----------------- | ---------------------- | -| [Post0RequestBuilder](#post0requestbuilder) | requestBody([UserPostRequestBody.SealedRequestBody](../../paths/user/post/UserPostRequestBody.md#sealedrequestbody) requestBody)
sets the property | - -[[Back to top]](#top) [[Back to README]](../../../README.md) diff --git a/samples/client/petstore/kotlin/docs/paths/user/post/UserPostRequestBody.md b/samples/client/petstore/kotlin/docs/paths/user/post/UserPostRequestBody.md deleted file mode 100644 index 3d9c6d9e137..00000000000 --- a/samples/client/petstore/kotlin/docs/paths/user/post/UserPostRequestBody.md +++ /dev/null @@ -1,90 +0,0 @@ -# UserPostRequestBody - -public class UserPostRequestBody - -A class that contains necessary nested request body classes -- SealedMediaType, a sealed interface which contains all the schema/encoding info for each contentType -- records which implement SealedMediaType, the concrete media types -- a class that extends RequestBodySerializer and is used to serialize input SealedRequestBody instances -- SealedRequestBody, a sealed interface which contains all the contentType/schema input types -- records which implement SealedRequestBody, the concrete request body types - -## Nested Class Summary -| Modifier and Type | Class and Description | -| ----------------- | --------------------- | -| sealed interface | [UserPostRequestBody.SealedMediaType](#sealedmediatype)
media type sealed interface | -| record | [UserPostRequestBody.ApplicationjsonMediaType](#applicationjsonmediatype)
record storing schema + encoding for a specific contentType | -| static class | [UserPostRequestBody.UserPostRequestBody1](#userpostrequestbody1)
class that serializes request bodies | -| sealed interface | [UserPostRequestBody.SealedRequestBody](#sealedrequestbody)
request body sealed interface | -| record | [UserPostRequestBody.ApplicationjsonRequestBody](#applicationjsonrequestbody)
implements sealed interface to store request body input | - -## SealedMediaType -public sealed interface SealedMediaType
-permits
-[ApplicationjsonMediaType](#applicationjsonmediatype) - -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), Nothing?> - -class storing schema info for a specific contentType - -### Constructor Summary -| Constructor and Description | -| --------------------------- | -| ApplicationjsonMediaType()
Creates an instance | - -### 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 | -| Nothing? | encoding()
the encoding info | - -## UserPostRequestBody1 -public static class UserPostRequestBody1
- -a class that serializes SealedRequestBody request bodies - -### Constructor Summary -| Constructor and Description | -| --------------------------- | -| UserPostRequestBody1()
Creates an instance | - -### Field Summary -| Modifier and Type | Field and Description | -| ----------------- | --------------------- | -| boolean | required = true
whether the request body is required | -| 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 | -| ----------------- | ---------------------- | -| SerializedRequestBody | serialize([SealedRequestBody](#sealedrequestbody) requestBody)
called by endpoint when creating request body bytes | - -## SealedRequestBody -public sealed interface SealedRequestBody
-permits
-[ApplicationjsonRequestBody](#applicationjsonrequestbody) - -sealed interface that stores request contentType + validated schema data - -## ApplicationjsonRequestBody -public record ApplicationjsonRequestBody
-implements [SealedRequestBody](#sealedrequestbody),
-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 | - -### 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 | diff --git a/samples/client/petstore/kotlin/docs/paths/user/post/UserPostResponses.md b/samples/client/petstore/kotlin/docs/paths/user/post/UserPostResponses.md deleted file mode 100644 index 763acac4e00..00000000000 --- a/samples/client/petstore/kotlin/docs/paths/user/post/UserPostResponses.md +++ /dev/null @@ -1,29 +0,0 @@ -# UserPostResponses - -public class UserPostResponses - -A class that contains necessary responses classes -- a sealed interface, EndpointResponse, that stores endpoint responses -- records for each endpoint response - -## Nested Class Summary -| Modifier and Type | Class and Description | -| ----------------- | --------------------- | -| sealed interface | [EndpointResponse](#endpointresponse)
stores the endpoint responses | -| record | [EndpointUserPostCodedefaultResponse](#endpointuserpostcodedefaultresponse)
the response for default | - -## EndpointResponse -public sealed interface EndpointResponse permits
-[EndpointUserPostCodedefaultResponse](#endpointuserpostcodedefaultresponse) - -a sealed interface that stores endpoint responses - -## EndpointUserPostCodedefaultResponse -public record EndpointUserPostCodedefaultResponse( - HttpResponse response, - Nothing? body, - Nothing? headers -) implements EndpointResponse, ApiResponse
- -a class that stores an endpoint response - diff --git a/samples/client/petstore/kotlin/docs/paths/user/post/requestbody/content/applicationjson/ApplicationjsonSchema.md b/samples/client/petstore/kotlin/docs/paths/user/post/requestbody/content/applicationjson/ApplicationjsonSchema.md deleted file mode 100644 index 87ec51870cc..00000000000 --- a/samples/client/petstore/kotlin/docs/paths/user/post/requestbody/content/applicationjson/ApplicationjsonSchema.md +++ /dev/null @@ -1,19 +0,0 @@ -# ApplicationjsonSchema -public class ApplicationjsonSchema
-extends [User1](../../../../../../components/schemas/User.md#user) - -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 - -## Nested Class Summary -| Modifier and Type | Class and Description | -| ----------------- | ---------------------- | -| static class | [ApplicationjsonSchema.ApplicationjsonSchema1](#applicationjsonschema1)
schema class | - -## ApplicationjsonSchema1 -public static class ApplicationjsonSchema1
-extends [User.User1](../../../../../../components/schemas/User.md#user1) - -A schema class that validates payloads diff --git a/samples/client/petstore/kotlin/docs/paths/user/post/responses/UserPostCodedefaultResponse.md b/samples/client/petstore/kotlin/docs/paths/user/post/responses/UserPostCodedefaultResponse.md deleted file mode 100644 index 4b45657c98c..00000000000 --- a/samples/client/petstore/kotlin/docs/paths/user/post/responses/UserPostCodedefaultResponse.md +++ /dev/null @@ -1,32 +0,0 @@ -# UserPostCodedefaultResponse - -public class UserPostCodedefaultResponse - -A class that contains necessary nested response classes -- a class that extends ResponseDeserializer and is used to deserialize responses - -## Nested Class Summary -| Modifier and Type | Class and Description | -| ----------------- | --------------------- | -| static class | [UserPostCodedefaultResponse.UserPostCodedefaultResponse1](#userpostcodedefaultresponse1)
class that deserializes responses | - -## UserPostCodedefaultResponse1 -public static class UserPostCodedefaultResponse1
-extends ResponseDeserializer - -a class that deserializes responses - -### Constructor Summary -| Constructor and Description | -| --------------------------- | -| UserPostCodedefaultResponse1()
Creates an instance | - -### Field Summary -| Modifier and Type | Field and Description | -| ----------------- | --------------------- | -| Map | content = MapUtils.makeMap(
)
the contentType to schema info | - -### Method Summary -| Modifier and Type | Method and Description | -| ----------------- | ---------------------- | -| ApiResponse | deserialize(HttpResponse response, SchemaConfiguration configuration)
called by endpoint when deserialize responses | diff --git a/samples/client/petstore/kotlin/docs/paths/usercreatewitharray/UsercreatewitharrayPost.md b/samples/client/petstore/kotlin/docs/paths/usercreatewitharray/UsercreatewitharrayPost.md deleted file mode 100644 index d9c648dfa57..00000000000 --- a/samples/client/petstore/kotlin/docs/paths/usercreatewitharray/UsercreatewitharrayPost.md +++ /dev/null @@ -1,224 +0,0 @@ -# UsercreatewitharrayPost - -public class UsercreatewitharrayPost - -A class that contains necessary endpoint classes -- a class that calls the endpoint method using the http verb -- a class that calls the endpoint method using the operationId name -- class(es) to store the request inputs -- builder(s) to set the request input data - -## Nested Class Summary -| Modifier and Type | Class and Description | -| ----------------- | --------------------- | -| static class | [Post](#post)
The class that has a post method to call the endpoint | -| interface | [CreateUsersWithArrayInputOperation](#createuserswitharrayinputoperation)
The interface that has a createUsersWithArrayInput method to call the endpoint | -| static class | [PostRequest](#postrequest)
The final request inputs class | -| static class | [PostNullableRequest](#postnullablerequest)
The initial request inputs class | -| static class | [Post0RequestBuilder](#post0requestbuilder)
A builder for the request input class | -| static class | [PostRequestBuilder](#postrequestbuilder)
A builder for the request input class | - -## Post -public static class Post 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.UsercreatewitharrayPostRequestBody; -import org.openapijsonschematools.client.components.requestbodies.userarray.content.applicationjson.ApplicationjsonSchema; -import org.openapijsonschematools.client.servers.RootServer0; -import org.openapijsonschematools.client.servers.RootServer1; -import org.openapijsonschematools.client.servers.RootServer2; -import org.openapijsonschematools.client.paths.usercreatewitharray.post.responses.UsercreatewitharrayPostCodedefaultResponse; -import org.openapijsonschematools.client.servers.RootServerInfo; -import org.openapijsonschematools.client.paths.usercreatewitharray.UsercreatewitharrayPost; -import org.openapijsonschematools.client.paths.usercreatewitharray.post.UsercreatewitharrayPostResponses; - -import java.io.IOException; -import java.util.Arrays; -import java.util.List; -import java.util.Map; -import java.util.AbstractMap; - -// if you want to use a server that is not SERVER_0 pass it in here and change the ServerIndex input below -ApiConfiguration.ServerInfo serverInfo = new ApiConfiguration.ServerInfoBuilder() - .rootServerInfo( - new RootServerInfo.RootServerInfoBuilder() - .rootServer0(new RootServer0()) - .build() - ) - .build(); -ApiConfiguration.ServerIndexInfo serverIndexInfo = new ApiConfiguration.ServerIndexInfoBuilder() - .rootServerInfoServerIndex(RootServerInfo.ServerIndex.SERVER_0) - .build(); -Duration timeout = Duration.ofSeconds(1L); -Map> defaultHeaders = Map.of("User-Agent", List.of("OpenAPI-JSON-Schema-Generator/1.0.0/java")); -ApiConfiguration apiConfiguration = new ApiConfiguration( - serverInfo - serverIndexInfo, - timeout, - defaultHeaders -); -SchemaConfiguration schemaConfiguration = new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().build()); -UsercreatewitharrayPost.Post apiClient = new UsercreatewitharrayPost.Post(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 -); -UsercreatewitharrayPostRequestBody.SealedRequestBody requestBody = new UsercreatewitharrayPostRequestBody.ApplicationjsonRequestBody(requestBodyPayload); - -var request = new UsercreatewitharrayPost.PostRequestBuilder() - .requestBody(requestBody) - .build(); - -UsercreatewitharrayPostResponses.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; -} -UsercreatewitharrayPostResponses.EndpointUsercreatewitharrayPostCodedefaultResponse castResponse = (UsercreatewitharrayPostResponses.EndpointUsercreatewitharrayPostCodedefaultResponse) response; -``` -### Constructor Summary -| Constructor and Description | -| --------------------------- | -| Post(ApiConfiguration apiConfiguration, SchemaConfiguration schemaConfiguration)
Creates an instance | - -### Method Summary -| Modifier and Type | Method and Description | -| ----------------- | ---------------------- | -| [UsercreatewitharrayPostResponses.EndpointResponse](../../paths/usercreatewitharray/post/UsercreatewitharrayPostResponses.md#endpointresponse) | post([PostRequest](#postrequest) request) | - -## CreateUsersWithArrayInputOperation -public interface CreateUsersWithArrayInputOperation
- -an interface that allows one to call the endpoint using a method named createUsersWithArrayInput by the operationId - -### Method Summary -| Modifier and Type | Method and Description | -| ----------------- | ---------------------- | -| [UsercreatewitharrayPostResponses.EndpointResponse](../../paths/usercreatewitharray/post/UsercreatewitharrayPostResponses.md#endpointresponse) | createUsersWithArrayInput([PostRequest](#postrequest) request) | - -## PostRequest -public static class PostRequest
- -a class that stores the final request inputs - -### Field Summary -| Modifier and Type | Field and Description | -| ----------------- | --------------------- | -| [UsercreatewitharrayPostRequestBody.SealedRequestBody](../../paths/usercreatewitharray/post/UsercreatewitharrayPostRequestBody.md#sealedrequestbody) | requestBody | -| [RootServerInfo.@Nullable ServerIndex](../../RootServerInfo.md#serverindex) | serverIndex
optional. Note: this will override the value in apiConfiguration | -| @Nullable Duration | timeout
optional. Note: this will override the value in apiConfiguration | - -## PostNullableRequest -public static class PostNullableRequest
- -a class that stores the initial request inputs - -### Field Summary -| Modifier and Type | Field and Description | -| ----------------- | --------------------- | -| [UsercreatewitharrayPostRequestBody.@Nullable SealedRequestBody](../../paths/usercreatewitharray/post/UsercreatewitharrayPostRequestBody.md#sealedrequestbody) | requestBody | -| [RootServerInfo.@Nullable ServerIndex](../../RootServerInfo.md#serverindex) | serverIndex | -| @Nullable Duration | timeout | - -## Post0RequestBuilder -public static class Post0RequestBuilder
- -a builder for request inputs - -### Constructor Summary -| Constructor and Description | -| --------------------------- | -| Post0RequestBuilder(Post0RequestBuilder instance)
Creates a builder that contains the passed instance | - -### Method Summary -| Modifier and Type | Method and Description | -| ----------------- | ---------------------- | -| [PostRequest](#postrequest) | build()
Returns the request input used to call an endpoint method | -| [Post0RequestBuilder](#post0requestbuilder) | serverIndex([RootServerInfo.ServerIndex](../../RootServerInfo.md#serverindex) serverIndex)
sets the optional property. Note: this will override the value in apiConfiguration | -| [Post0RequestBuilder](#post0requestbuilder) | timeout(Duration timeout)
sets the optional property. Note: this will override the value in apiConfiguration | - -## PostRequestBuilder -public static class PostRequestBuilder
- -a builder for request inputs - -### Constructor Summary -| Constructor and Description | -| --------------------------- | -| PostRequestBuilder()
Creates a builder that contains null for all parameters | - -### Method Summary -| Modifier and Type | Method and Description | -| ----------------- | ---------------------- | -| [Post0RequestBuilder](#post0requestbuilder) | requestBody([UsercreatewitharrayPostRequestBody.SealedRequestBody](../../paths/usercreatewitharray/post/UsercreatewitharrayPostRequestBody.md#sealedrequestbody) requestBody)
sets the property | - -[[Back to top]](#top) [[Back to README]](../../../README.md) diff --git a/samples/client/petstore/kotlin/docs/paths/usercreatewitharray/post/UsercreatewitharrayPostRequestBody.md b/samples/client/petstore/kotlin/docs/paths/usercreatewitharray/post/UsercreatewitharrayPostRequestBody.md deleted file mode 100644 index b96ec049cfe..00000000000 --- a/samples/client/petstore/kotlin/docs/paths/usercreatewitharray/post/UsercreatewitharrayPostRequestBody.md +++ /dev/null @@ -1,17 +0,0 @@ -# UsercreatewitharrayPostRequestBody - -public class UsercreatewitharrayPostRequestBody 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 - -## Nested Class Summary -| Modifier and Type | Class and Description | -| ----------------- | --------------------- | -| static class | [UsercreatewitharrayPostRequestBody.UsercreatewitharrayPostRequestBody1](#usercreatewitharraypostrequestbody1)
class that serializes request bodies | - -## UsercreatewitharrayPostRequestBody1 -public static class UsercreatewitharrayPostRequestBody1 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/kotlin/docs/paths/usercreatewitharray/post/UsercreatewitharrayPostResponses.md b/samples/client/petstore/kotlin/docs/paths/usercreatewitharray/post/UsercreatewitharrayPostResponses.md deleted file mode 100644 index 3a8bf5083b7..00000000000 --- a/samples/client/petstore/kotlin/docs/paths/usercreatewitharray/post/UsercreatewitharrayPostResponses.md +++ /dev/null @@ -1,29 +0,0 @@ -# UsercreatewitharrayPostResponses - -public class UsercreatewitharrayPostResponses - -A class that contains necessary responses classes -- a sealed interface, EndpointResponse, that stores endpoint responses -- records for each endpoint response - -## Nested Class Summary -| Modifier and Type | Class and Description | -| ----------------- | --------------------- | -| sealed interface | [EndpointResponse](#endpointresponse)
stores the endpoint responses | -| record | [EndpointUsercreatewitharrayPostCodedefaultResponse](#endpointusercreatewitharraypostcodedefaultresponse)
the response for default | - -## EndpointResponse -public sealed interface EndpointResponse permits
-[EndpointUsercreatewitharrayPostCodedefaultResponse](#endpointusercreatewitharraypostcodedefaultresponse) - -a sealed interface that stores endpoint responses - -## EndpointUsercreatewitharrayPostCodedefaultResponse -public record EndpointUsercreatewitharrayPostCodedefaultResponse( - HttpResponse response, - Nothing? body, - Nothing? headers -) implements EndpointResponse, ApiResponse
- -a class that stores an endpoint response - diff --git a/samples/client/petstore/kotlin/docs/paths/usercreatewitharray/post/responses/UsercreatewitharrayPostCodedefaultResponse.md b/samples/client/petstore/kotlin/docs/paths/usercreatewitharray/post/responses/UsercreatewitharrayPostCodedefaultResponse.md deleted file mode 100644 index cfe169953b4..00000000000 --- a/samples/client/petstore/kotlin/docs/paths/usercreatewitharray/post/responses/UsercreatewitharrayPostCodedefaultResponse.md +++ /dev/null @@ -1,32 +0,0 @@ -# UsercreatewitharrayPostCodedefaultResponse - -public class UsercreatewitharrayPostCodedefaultResponse - -A class that contains necessary nested response classes -- a class that extends ResponseDeserializer and is used to deserialize responses - -## Nested Class Summary -| Modifier and Type | Class and Description | -| ----------------- | --------------------- | -| static class | [UsercreatewitharrayPostCodedefaultResponse.UsercreatewitharrayPostCodedefaultResponse1](#usercreatewitharraypostcodedefaultresponse1)
class that deserializes responses | - -## UsercreatewitharrayPostCodedefaultResponse1 -public static class UsercreatewitharrayPostCodedefaultResponse1
-extends ResponseDeserializer - -a class that deserializes responses - -### Constructor Summary -| Constructor and Description | -| --------------------------- | -| UsercreatewitharrayPostCodedefaultResponse1()
Creates an instance | - -### Field Summary -| Modifier and Type | Field and Description | -| ----------------- | --------------------- | -| Map | content = MapUtils.makeMap(
)
the contentType to schema info | - -### Method Summary -| Modifier and Type | Method and Description | -| ----------------- | ---------------------- | -| ApiResponse | deserialize(HttpResponse response, SchemaConfiguration configuration)
called by endpoint when deserialize responses | diff --git a/samples/client/petstore/kotlin/docs/paths/usercreatewithlist/UsercreatewithlistPost.md b/samples/client/petstore/kotlin/docs/paths/usercreatewithlist/UsercreatewithlistPost.md deleted file mode 100644 index 856224740e5..00000000000 --- a/samples/client/petstore/kotlin/docs/paths/usercreatewithlist/UsercreatewithlistPost.md +++ /dev/null @@ -1,224 +0,0 @@ -# UsercreatewithlistPost - -public class UsercreatewithlistPost - -A class that contains necessary endpoint classes -- a class that calls the endpoint method using the http verb -- a class that calls the endpoint method using the operationId name -- class(es) to store the request inputs -- builder(s) to set the request input data - -## Nested Class Summary -| Modifier and Type | Class and Description | -| ----------------- | --------------------- | -| static class | [Post](#post)
The class that has a post method to call the endpoint | -| interface | [CreateUsersWithListInputOperation](#createuserswithlistinputoperation)
The interface that has a createUsersWithListInput method to call the endpoint | -| static class | [PostRequest](#postrequest)
The final request inputs class | -| static class | [PostNullableRequest](#postnullablerequest)
The initial request inputs class | -| static class | [Post0RequestBuilder](#post0requestbuilder)
A builder for the request input class | -| static class | [PostRequestBuilder](#postrequestbuilder)
A builder for the request input class | - -## Post -public static class Post 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.UsercreatewithlistPostRequestBody; -import org.openapijsonschematools.client.components.requestbodies.userarray.content.applicationjson.ApplicationjsonSchema; -import org.openapijsonschematools.client.servers.RootServer0; -import org.openapijsonschematools.client.servers.RootServer1; -import org.openapijsonschematools.client.servers.RootServer2; -import org.openapijsonschematools.client.paths.usercreatewithlist.post.responses.UsercreatewithlistPostCodedefaultResponse; -import org.openapijsonschematools.client.servers.RootServerInfo; -import org.openapijsonschematools.client.paths.usercreatewithlist.UsercreatewithlistPost; -import org.openapijsonschematools.client.paths.usercreatewithlist.post.UsercreatewithlistPostResponses; - -import java.io.IOException; -import java.util.Arrays; -import java.util.List; -import java.util.Map; -import java.util.AbstractMap; - -// if you want to use a server that is not SERVER_0 pass it in here and change the ServerIndex input below -ApiConfiguration.ServerInfo serverInfo = new ApiConfiguration.ServerInfoBuilder() - .rootServerInfo( - new RootServerInfo.RootServerInfoBuilder() - .rootServer0(new RootServer0()) - .build() - ) - .build(); -ApiConfiguration.ServerIndexInfo serverIndexInfo = new ApiConfiguration.ServerIndexInfoBuilder() - .rootServerInfoServerIndex(RootServerInfo.ServerIndex.SERVER_0) - .build(); -Duration timeout = Duration.ofSeconds(1L); -Map> defaultHeaders = Map.of("User-Agent", List.of("OpenAPI-JSON-Schema-Generator/1.0.0/java")); -ApiConfiguration apiConfiguration = new ApiConfiguration( - serverInfo - serverIndexInfo, - timeout, - defaultHeaders -); -SchemaConfiguration schemaConfiguration = new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().build()); -UsercreatewithlistPost.Post apiClient = new UsercreatewithlistPost.Post(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 -); -UsercreatewithlistPostRequestBody.SealedRequestBody requestBody = new UsercreatewithlistPostRequestBody.ApplicationjsonRequestBody(requestBodyPayload); - -var request = new UsercreatewithlistPost.PostRequestBuilder() - .requestBody(requestBody) - .build(); - -UsercreatewithlistPostResponses.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; -} -UsercreatewithlistPostResponses.EndpointUsercreatewithlistPostCodedefaultResponse castResponse = (UsercreatewithlistPostResponses.EndpointUsercreatewithlistPostCodedefaultResponse) response; -``` -### Constructor Summary -| Constructor and Description | -| --------------------------- | -| Post(ApiConfiguration apiConfiguration, SchemaConfiguration schemaConfiguration)
Creates an instance | - -### Method Summary -| Modifier and Type | Method and Description | -| ----------------- | ---------------------- | -| [UsercreatewithlistPostResponses.EndpointResponse](../../paths/usercreatewithlist/post/UsercreatewithlistPostResponses.md#endpointresponse) | post([PostRequest](#postrequest) request) | - -## CreateUsersWithListInputOperation -public interface CreateUsersWithListInputOperation
- -an interface that allows one to call the endpoint using a method named createUsersWithListInput by the operationId - -### Method Summary -| Modifier and Type | Method and Description | -| ----------------- | ---------------------- | -| [UsercreatewithlistPostResponses.EndpointResponse](../../paths/usercreatewithlist/post/UsercreatewithlistPostResponses.md#endpointresponse) | createUsersWithListInput([PostRequest](#postrequest) request) | - -## PostRequest -public static class PostRequest
- -a class that stores the final request inputs - -### Field Summary -| Modifier and Type | Field and Description | -| ----------------- | --------------------- | -| [UsercreatewithlistPostRequestBody.SealedRequestBody](../../paths/usercreatewithlist/post/UsercreatewithlistPostRequestBody.md#sealedrequestbody) | requestBody | -| [RootServerInfo.@Nullable ServerIndex](../../RootServerInfo.md#serverindex) | serverIndex
optional. Note: this will override the value in apiConfiguration | -| @Nullable Duration | timeout
optional. Note: this will override the value in apiConfiguration | - -## PostNullableRequest -public static class PostNullableRequest
- -a class that stores the initial request inputs - -### Field Summary -| Modifier and Type | Field and Description | -| ----------------- | --------------------- | -| [UsercreatewithlistPostRequestBody.@Nullable SealedRequestBody](../../paths/usercreatewithlist/post/UsercreatewithlistPostRequestBody.md#sealedrequestbody) | requestBody | -| [RootServerInfo.@Nullable ServerIndex](../../RootServerInfo.md#serverindex) | serverIndex | -| @Nullable Duration | timeout | - -## Post0RequestBuilder -public static class Post0RequestBuilder
- -a builder for request inputs - -### Constructor Summary -| Constructor and Description | -| --------------------------- | -| Post0RequestBuilder(Post0RequestBuilder instance)
Creates a builder that contains the passed instance | - -### Method Summary -| Modifier and Type | Method and Description | -| ----------------- | ---------------------- | -| [PostRequest](#postrequest) | build()
Returns the request input used to call an endpoint method | -| [Post0RequestBuilder](#post0requestbuilder) | serverIndex([RootServerInfo.ServerIndex](../../RootServerInfo.md#serverindex) serverIndex)
sets the optional property. Note: this will override the value in apiConfiguration | -| [Post0RequestBuilder](#post0requestbuilder) | timeout(Duration timeout)
sets the optional property. Note: this will override the value in apiConfiguration | - -## PostRequestBuilder -public static class PostRequestBuilder
- -a builder for request inputs - -### Constructor Summary -| Constructor and Description | -| --------------------------- | -| PostRequestBuilder()
Creates a builder that contains null for all parameters | - -### Method Summary -| Modifier and Type | Method and Description | -| ----------------- | ---------------------- | -| [Post0RequestBuilder](#post0requestbuilder) | requestBody([UsercreatewithlistPostRequestBody.SealedRequestBody](../../paths/usercreatewithlist/post/UsercreatewithlistPostRequestBody.md#sealedrequestbody) requestBody)
sets the property | - -[[Back to top]](#top) [[Back to README]](../../../README.md) diff --git a/samples/client/petstore/kotlin/docs/paths/usercreatewithlist/post/UsercreatewithlistPostRequestBody.md b/samples/client/petstore/kotlin/docs/paths/usercreatewithlist/post/UsercreatewithlistPostRequestBody.md deleted file mode 100644 index 872f7a38709..00000000000 --- a/samples/client/petstore/kotlin/docs/paths/usercreatewithlist/post/UsercreatewithlistPostRequestBody.md +++ /dev/null @@ -1,17 +0,0 @@ -# UsercreatewithlistPostRequestBody - -public class UsercreatewithlistPostRequestBody 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 - -## Nested Class Summary -| Modifier and Type | Class and Description | -| ----------------- | --------------------- | -| static class | [UsercreatewithlistPostRequestBody.UsercreatewithlistPostRequestBody1](#usercreatewithlistpostrequestbody1)
class that serializes request bodies | - -## UsercreatewithlistPostRequestBody1 -public static class UsercreatewithlistPostRequestBody1 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/kotlin/docs/paths/usercreatewithlist/post/UsercreatewithlistPostResponses.md b/samples/client/petstore/kotlin/docs/paths/usercreatewithlist/post/UsercreatewithlistPostResponses.md deleted file mode 100644 index 260f259b080..00000000000 --- a/samples/client/petstore/kotlin/docs/paths/usercreatewithlist/post/UsercreatewithlistPostResponses.md +++ /dev/null @@ -1,29 +0,0 @@ -# UsercreatewithlistPostResponses - -public class UsercreatewithlistPostResponses - -A class that contains necessary responses classes -- a sealed interface, EndpointResponse, that stores endpoint responses -- records for each endpoint response - -## Nested Class Summary -| Modifier and Type | Class and Description | -| ----------------- | --------------------- | -| sealed interface | [EndpointResponse](#endpointresponse)
stores the endpoint responses | -| record | [EndpointUsercreatewithlistPostCodedefaultResponse](#endpointusercreatewithlistpostcodedefaultresponse)
the response for default | - -## EndpointResponse -public sealed interface EndpointResponse permits
-[EndpointUsercreatewithlistPostCodedefaultResponse](#endpointusercreatewithlistpostcodedefaultresponse) - -a sealed interface that stores endpoint responses - -## EndpointUsercreatewithlistPostCodedefaultResponse -public record EndpointUsercreatewithlistPostCodedefaultResponse( - HttpResponse response, - Nothing? body, - Nothing? headers -) implements EndpointResponse, ApiResponse
- -a class that stores an endpoint response - diff --git a/samples/client/petstore/kotlin/docs/paths/usercreatewithlist/post/responses/UsercreatewithlistPostCodedefaultResponse.md b/samples/client/petstore/kotlin/docs/paths/usercreatewithlist/post/responses/UsercreatewithlistPostCodedefaultResponse.md deleted file mode 100644 index 8128056fdb8..00000000000 --- a/samples/client/petstore/kotlin/docs/paths/usercreatewithlist/post/responses/UsercreatewithlistPostCodedefaultResponse.md +++ /dev/null @@ -1,32 +0,0 @@ -# UsercreatewithlistPostCodedefaultResponse - -public class UsercreatewithlistPostCodedefaultResponse - -A class that contains necessary nested response classes -- a class that extends ResponseDeserializer and is used to deserialize responses - -## Nested Class Summary -| Modifier and Type | Class and Description | -| ----------------- | --------------------- | -| static class | [UsercreatewithlistPostCodedefaultResponse.UsercreatewithlistPostCodedefaultResponse1](#usercreatewithlistpostcodedefaultresponse1)
class that deserializes responses | - -## UsercreatewithlistPostCodedefaultResponse1 -public static class UsercreatewithlistPostCodedefaultResponse1
-extends ResponseDeserializer - -a class that deserializes responses - -### Constructor Summary -| Constructor and Description | -| --------------------------- | -| UsercreatewithlistPostCodedefaultResponse1()
Creates an instance | - -### Field Summary -| Modifier and Type | Field and Description | -| ----------------- | --------------------- | -| Map | content = MapUtils.makeMap(
)
the contentType to schema info | - -### Method Summary -| Modifier and Type | Method and Description | -| ----------------- | ---------------------- | -| ApiResponse | deserialize(HttpResponse response, SchemaConfiguration configuration)
called by endpoint when deserialize responses | diff --git a/samples/client/petstore/kotlin/docs/paths/userlogin/UserloginGet.md b/samples/client/petstore/kotlin/docs/paths/userlogin/UserloginGet.md deleted file mode 100644 index 97e30c4cba6..00000000000 --- a/samples/client/petstore/kotlin/docs/paths/userlogin/UserloginGet.md +++ /dev/null @@ -1,198 +0,0 @@ -# UserloginGet - -public class UserloginGet - -A class that contains necessary endpoint classes -- a class that calls the endpoint method using the http verb -- a class that calls the endpoint method using the operationId name -- class(es) to store the request inputs -- builder(s) to set the request input data - -## Nested Class Summary -| Modifier and Type | Class and Description | -| ----------------- | --------------------- | -| static class | [Get](#get)
The class that has a get method to call the endpoint | -| interface | [LoginUserOperation](#loginuseroperation)
The interface that has a loginUser method to call the endpoint | -| static class | [GetRequest](#getrequest)
The final request inputs class | -| static class | [GetNullableRequest](#getnullablerequest)
The initial request inputs class | -| static class | [Get0RequestBuilder](#get0requestbuilder)
A builder for the request input class | -| static class | [GetRequestBuilder](#getrequestbuilder)
A builder for the request input class | - -## Get -public static class Get extends ApiClient.ApiClient1 implements GetOperation
- -a class that allows one to call the endpoint using a method named get - -### 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.userlogin.get.UserloginGetQueryParameters; -import org.openapijsonschematools.client.servers.RootServer0; -import org.openapijsonschematools.client.servers.RootServer1; -import org.openapijsonschematools.client.servers.RootServer2; -import org.openapijsonschematools.client.paths.userlogin.get.responses.UserloginGetCode200Response; -import org.openapijsonschematools.client.paths.userlogin.get.responses.code200response.UserloginGetCode200ResponseHeadersSchema; -import org.openapijsonschematools.client.paths.userlogin.get.responses.UserloginGetCode400Response; -import org.openapijsonschematools.client.servers.RootServerInfo; -import org.openapijsonschematools.client.paths.userlogin.UserloginGet; -import org.openapijsonschematools.client.paths.userlogin.get.UserloginGetResponses; - -import java.io.IOException; -import java.util.Arrays; -import java.util.List; -import java.util.Map; -import java.util.AbstractMap; - -// if you want to use a server that is not SERVER_0 pass it in here and change the ServerIndex input below -ApiConfiguration.ServerInfo serverInfo = new ApiConfiguration.ServerInfoBuilder() - .rootServerInfo( - new RootServerInfo.RootServerInfoBuilder() - .rootServer0(new RootServer0()) - .build() - ) - .build(); -ApiConfiguration.ServerIndexInfo serverIndexInfo = new ApiConfiguration.ServerIndexInfoBuilder() - .rootServerInfoServerIndex(RootServerInfo.ServerIndex.SERVER_0) - .build(); -Duration timeout = Duration.ofSeconds(1L); -Map> defaultHeaders = Map.of("User-Agent", List.of("OpenAPI-JSON-Schema-Generator/1.0.0/java")); -ApiConfiguration apiConfiguration = new ApiConfiguration( - serverInfo - serverIndexInfo, - timeout, - defaultHeaders -); -SchemaConfiguration schemaConfiguration = new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().build()); -UserloginGet.Get apiClient = new UserloginGet.Get(apiConfiguration, schemaConfiguration); - - -// Map validation -UserloginGetQueryParameters.QueryParametersMap queryParameters = - UserloginGetQueryParameters.UserloginGetQueryParameters1.validate( - new UserloginGetQueryParameters.QueryParametersMapBuilder() - .password("a") - - .username("a") - - .build(), - schemaConfiguration -); - -var request = new UserloginGet.GetRequestBuilder() - .queryParameters(queryParameters) - .build(); - -UserloginGetResponses.EndpointResponse response; -try { - response = apiClient.get(request); -} catch (UserloginGetCode400Response.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; -} -UserloginGetResponses.EndpointUserloginGetCode200Response castResponse = (UserloginGetResponses.EndpointUserloginGetCode200Response) response; -if (castResponse.body instanceof UserloginGetCode200Response.ApplicationxmlResponseBody deserializedBody) { - // handle deserialized body here -} else { - UserloginGetCode200Response.ApplicationjsonResponseBody deserializedBody = (UserloginGetCode200Response.ApplicationjsonResponseBody) castResponse.body; - // handle deserialized body here -} -``` -### Constructor Summary -| Constructor and Description | -| --------------------------- | -| Get(ApiConfiguration apiConfiguration, SchemaConfiguration schemaConfiguration)
Creates an instance | - -### Method Summary -| Modifier and Type | Method and Description | -| ----------------- | ---------------------- | -| [UserloginGetResponses.EndpointResponse](../../paths/userlogin/get/UserloginGetResponses.md#endpointresponse) | get([GetRequest](#getrequest) request) | - -## LoginUserOperation -public interface LoginUserOperation
- -an interface that allows one to call the endpoint using a method named loginUser by the operationId - -### Method Summary -| Modifier and Type | Method and Description | -| ----------------- | ---------------------- | -| [UserloginGetResponses.EndpointResponse](../../paths/userlogin/get/UserloginGetResponses.md#endpointresponse) | loginUser([GetRequest](#getrequest) request) | - -## GetRequest -public static class GetRequest
- -a class that stores the final request inputs - -### Field Summary -| Modifier and Type | Field and Description | -| ----------------- | --------------------- | -| [UserloginGetQueryParameters.QueryParametersMap](../../paths/userlogin/get/UserloginGetQueryParameters.md#queryparametersmap) | queryParameters | -| [RootServerInfo.@Nullable ServerIndex](../../RootServerInfo.md#serverindex) | serverIndex
optional. Note: this will override the value in apiConfiguration | -| @Nullable Duration | timeout
optional. Note: this will override the value in apiConfiguration | - -## GetNullableRequest -public static class GetNullableRequest
- -a class that stores the initial request inputs - -### Field Summary -| Modifier and Type | Field and Description | -| ----------------- | --------------------- | -| [UserloginGetQueryParameters.@Nullable QueryParametersMap](../../paths/userlogin/get/UserloginGetQueryParameters.md#queryparametersmap) | queryParameters | -| [RootServerInfo.@Nullable ServerIndex](../../RootServerInfo.md#serverindex) | serverIndex | -| @Nullable Duration | timeout | - -## Get0RequestBuilder -public static class Get0RequestBuilder
- -a builder for request inputs - -### Constructor Summary -| Constructor and Description | -| --------------------------- | -| Get0RequestBuilder(Get0RequestBuilder instance)
Creates a builder that contains the passed instance | - -### Method Summary -| Modifier and Type | Method and Description | -| ----------------- | ---------------------- | -| [GetRequest](#getrequest) | build()
Returns the request input used to call an endpoint method | -| [Get0RequestBuilder](#get0requestbuilder) | serverIndex([RootServerInfo.ServerIndex](../../RootServerInfo.md#serverindex) serverIndex)
sets the optional property. Note: this will override the value in apiConfiguration | -| [Get0RequestBuilder](#get0requestbuilder) | timeout(Duration timeout)
sets the optional property. Note: this will override the value in apiConfiguration | - -## GetRequestBuilder -public static class GetRequestBuilder
- -a builder for request inputs - -### Constructor Summary -| Constructor and Description | -| --------------------------- | -| GetRequestBuilder()
Creates a builder that contains null for all parameters | - -### Method Summary -| Modifier and Type | Method and Description | -| ----------------- | ---------------------- | -| [Get0RequestBuilder](#get0requestbuilder) | queryParameters([UserloginGetQueryParametersQueryParametersMap](../../paths/userlogin/get/UserloginGetQueryParameters.md#queryparametersmap) queryParameters)
sets the property | - -[[Back to top]](#top) [[Back to README]](../../../README.md) diff --git a/samples/client/petstore/kotlin/docs/paths/userlogin/get/UserloginGetQueryParameters.md b/samples/client/petstore/kotlin/docs/paths/userlogin/get/UserloginGetQueryParameters.md deleted file mode 100644 index 05824e01652..00000000000 --- a/samples/client/petstore/kotlin/docs/paths/userlogin/get/UserloginGetQueryParameters.md +++ /dev/null @@ -1,304 +0,0 @@ -# UserloginGetQueryParameters -public class UserloginGetQueryParameters
- -A class that contains necessary nested -- schema classes (which validate payloads), extends JsonSchema -- sealed interfaces which store validated payloads, java version of a sum type -- boxed classes which store validated payloads, sealed permits class implementations -- classes to store validated map payloads, extends FrozenMap -- classes to build inputs for map payloads - -## Nested Class Summary -| Modifier and Type | Class and Description | -| ----------------- | ---------------------- | -| sealed interface | [UserloginGetQueryParameters.UserloginGetQueryParameters1Boxed](#userlogingetqueryparameters1boxed)
sealed interface for validated payloads | -| record | [UserloginGetQueryParameters.UserloginGetQueryParameters1BoxedMap](#userlogingetqueryparameters1boxedmap)
boxed class to store validated Map payloads | -| static class | [UserloginGetQueryParameters.UserloginGetQueryParameters1](#userlogingetqueryparameters1)
schema class | -| static class | [UserloginGetQueryParameters.QueryParametersMapBuilder](#queryparametersmapbuilder)
builder for Map payloads | -| static class | [UserloginGetQueryParameters.QueryParametersMap](#queryparametersmap)
output class for Map payloads | -| sealed interface | [UserloginGetQueryParameters.AdditionalPropertiesBoxed](#additionalpropertiesboxed)
sealed interface for validated payloads | -| record | [UserloginGetQueryParameters.AdditionalPropertiesBoxedVoid](#additionalpropertiesboxedvoid)
boxed class to store validated null payloads | -| record | [UserloginGetQueryParameters.AdditionalPropertiesBoxedBoolean](#additionalpropertiesboxedboolean)
boxed class to store validated boolean payloads | -| record | [UserloginGetQueryParameters.AdditionalPropertiesBoxedNumber](#additionalpropertiesboxednumber)
boxed class to store validated Number payloads | -| record | [UserloginGetQueryParameters.AdditionalPropertiesBoxedString](#additionalpropertiesboxedstring)
boxed class to store validated String payloads | -| record | [UserloginGetQueryParameters.AdditionalPropertiesBoxedList](#additionalpropertiesboxedlist)
boxed class to store validated List payloads | -| record | [UserloginGetQueryParameters.AdditionalPropertiesBoxedMap](#additionalpropertiesboxedmap)
boxed class to store validated Map payloads | -| static class | [UserloginGetQueryParameters.AdditionalProperties](#additionalproperties)
schema class | - -## UserloginGetQueryParameters1Boxed -public sealed interface UserloginGetQueryParameters1Boxed
-permits
-[UserloginGetQueryParameters1BoxedMap](#userlogingetqueryparameters1boxedmap) - -sealed interface that stores validated payloads using boxed classes - -## UserloginGetQueryParameters1BoxedMap -public record UserloginGetQueryParameters1BoxedMap
-implements [UserloginGetQueryParameters1Boxed](#userlogingetqueryparameters1boxed) - -record that stores validated Map payloads, sealed permits implementation - -### Constructor Summary -| Constructor and Description | -| --------------------------- | -| UserloginGetQueryParameters1BoxedMap([QueryParametersMap](#queryparametersmap) data)
Creates an instance, private visibility | - -### Method Summary -| Modifier and Type | Method and Description | -| ----------------- | ---------------------- | -| [QueryParametersMap](#queryparametersmap) | data()
validated payload | -| @Nullable Object | getData()
validated payload | - -## UserloginGetQueryParameters1 -public static class UserloginGetQueryParameters1
-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.userlogin.get.UserloginGetQueryParameters; - -import java.util.Arrays; -import java.util.List; -import java.util.AbstractMap; - -static final SchemaConfiguration configuration = new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().build()); - -// Map validation -UserloginGetQueryParameters.QueryParametersMap validatedPayload = - UserloginGetQueryParameters.UserloginGetQueryParameters1.validate( - new UserloginGetQueryParameters.QueryParametersMapBuilder() - .password("a") - - .username("a") - - .build(), - configuration -); -``` - -### Field Summary -| Modifier and Type | Field and Description | -| ----------------- | ---------------------- | -| Set> | type = Set.of(Map.class) | -| Map> | properties = Map.ofEntries(
    new PropertyEntry("password", [Schema1.Schema11.class](../../../paths/userlogin/get/parameters/parameter1/Schema1.md#schema11)),
    new PropertyEntry("username", [Schema0.Schema01.class](../../../paths/userlogin/get/parameters/parameter0/Schema0.md#schema01))
)
| -| Set | required = Set.of(
    "password",
    "username"
)
| -| Class | additionalProperties = [AdditionalProperties.class](#additionalproperties) | - -### Method Summary -| Modifier and Type | Method and Description | -| ----------------- | ---------------------- | -| [QueryParametersMap](#queryparametersmap) | validate([Map<?, ?>](#queryparametersmapbuilder) arg, SchemaConfiguration configuration) | -| [UserloginGetQueryParameters1BoxedMap](#userlogingetqueryparameters1boxedmap) | validateAndBox([Map<?, ?>](#queryparametersmapbuilder) arg, SchemaConfiguration configuration) | -| [UserloginGetQueryParameters1Boxed](#userlogingetqueryparameters1boxed) | validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) | -| @Nullable Object | validate(@Nullable Object arg, SchemaConfiguration configuration) | - -## QueryParametersMap00Builder -public class QueryParametersMap00Builder
-builder for `Map` - -A class that builds the Map input type - -### Constructor Summary -| Constructor and Description | -| --------------------------- | -| QueryParametersMap00Builder(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 | - -## QueryParametersMap01Builder -public class QueryParametersMap01Builder
-builder for `Map` - -A class that builds the Map input type - -### Constructor Summary -| Constructor and Description | -| --------------------------- | -| QueryParametersMap01Builder(Map instance)
Creates a builder that contains the passed instance | - -### Method Summary -| Modifier and Type | Method and Description | -| ----------------- | ---------------------- | -| [QueryParametersMap00Builder](#queryparametersmap00builder) | username(String value) | - -## QueryParametersMap10Builder -public class QueryParametersMap10Builder
-builder for `Map` - -A class that builds the Map input type - -### Constructor Summary -| Constructor and Description | -| --------------------------- | -| QueryParametersMap10Builder(Map instance)
Creates a builder that contains the passed instance | - -### Method Summary -| Modifier and Type | Method and Description | -| ----------------- | ---------------------- | -| [QueryParametersMap00Builder](#queryparametersmap00builder) | password(String value) | - -## QueryParametersMapBuilder -public class QueryParametersMapBuilder
-builder for `Map` - -A class that builds the Map input type - -### Constructor Summary -| Constructor and Description | -| --------------------------- | -| QueryParametersMapBuilder()
Creates a builder that contains an empty map | - -### Method Summary -| Modifier and Type | Method and Description | -| ----------------- | ---------------------- | -| [QueryParametersMap01Builder](#queryparametersmap01builder) | password(String value) | -| [QueryParametersMap10Builder](#queryparametersmap10builder) | username(String value) | - -## QueryParametersMap -public static class QueryParametersMap
-extends FrozenMap - -A class to store validated Map payloads - -### Method Summary -| Modifier and Type | Method and Description | -| ----------------- | ---------------------- | -| static [QueryParametersMap](#queryparametersmap) | of([Map](#queryparametersmapbuilder) arg, SchemaConfiguration configuration) | -| String | password()
| -| String | username()
| - -## 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(Nothing? data)
Creates an instance, private visibility | - -### Method Summary -| Modifier and Type | Method and Description | -| ----------------- | ---------------------- | -| Nothing? | 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/kotlin/docs/paths/userlogin/get/UserloginGetResponses.md b/samples/client/petstore/kotlin/docs/paths/userlogin/get/UserloginGetResponses.md deleted file mode 100644 index 2bec55a9491..00000000000 --- a/samples/client/petstore/kotlin/docs/paths/userlogin/get/UserloginGetResponses.md +++ /dev/null @@ -1,29 +0,0 @@ -# UserloginGetResponses - -public class UserloginGetResponses - -A class that contains necessary responses classes -- a sealed interface, EndpointResponse, that stores endpoint responses -- records for each endpoint response - -## Nested Class Summary -| Modifier and Type | Class and Description | -| ----------------- | --------------------- | -| sealed interface | [EndpointResponse](#endpointresponse)
stores the endpoint responses | -| record | [EndpointUserloginGetCode200Response](#endpointuserlogingetcode200response)
the response for 200 | - -## EndpointResponse -public sealed interface EndpointResponse permits
-[EndpointUserloginGetCode200Response](#endpointuserlogingetcode200response) - -a sealed interface that stores endpoint responses - -## EndpointUserloginGetCode200Response -public record EndpointUserloginGetCode200Response( - HttpResponse response, - [UserloginGetCode200Response.SealedResponseBody](../../../paths/userlogin/get/responses/UserloginGetCode200Response.md#sealedresponsebody) body, - [UserloginGetCode200ResponseHeadersSchema.UserloginGetCode200ResponseHeadersSchemaMap](../../../paths/userlogin/get/responses/code200response/UserloginGetCode200ResponseHeadersSchema.md#userlogingetcode200responseheadersschemamap) headers -) implements EndpointResponse, ApiResponse
- -a class that stores an endpoint response - diff --git a/samples/client/petstore/kotlin/docs/paths/userlogin/get/parameters/parameter0/Schema0.md b/samples/client/petstore/kotlin/docs/paths/userlogin/get/parameters/parameter0/Schema0.md deleted file mode 100644 index 9ff90e0bc35..00000000000 --- a/samples/client/petstore/kotlin/docs/paths/userlogin/get/parameters/parameter0/Schema0.md +++ /dev/null @@ -1,49 +0,0 @@ -# Schema0 -public class Schema0
- -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 - -## Nested Class Summary -| Modifier and Type | Class and Description | -| ----------------- | ---------------------- | -| sealed interface | [Schema0.Schema01Boxed](#schema01boxed)
sealed interface for validated payloads | -| record | [Schema0.Schema01BoxedString](#schema01boxedstring)
boxed class to store validated String payloads | -| static class | [Schema0.Schema01](#schema01)
schema class | - -## Schema01Boxed -public sealed interface Schema01Boxed
-permits
-[Schema01BoxedString](#schema01boxedstring) - -sealed interface that stores validated payloads using boxed classes - -## Schema01BoxedString -public record Schema01BoxedString
-implements [Schema01Boxed](#schema01boxed) - -record that stores validated String payloads, sealed permits implementation - -### Constructor Summary -| Constructor and Description | -| --------------------------- | -| Schema01BoxedString(String data)
Creates an instance, private visibility | - -### Method Summary -| Modifier and Type | Method and Description | -| ----------------- | ---------------------- | -| String | data()
validated payload | -| @Nullable Object | getData()
validated payload | - -## Schema01 -public static class Schema01
-extends StringJsonSchema.StringJsonSchema1 - -A schema class that validates payloads - -| Methods Inherited from class org.openapijsonschematools.client.schemas.StringJsonSchema.StringJsonSchema1 | -| ------------------------------------------------------------------ | -| validate | -| validateAndBox | diff --git a/samples/client/petstore/kotlin/docs/paths/userlogin/get/parameters/parameter1/Schema1.md b/samples/client/petstore/kotlin/docs/paths/userlogin/get/parameters/parameter1/Schema1.md deleted file mode 100644 index 63ec3a884fc..00000000000 --- a/samples/client/petstore/kotlin/docs/paths/userlogin/get/parameters/parameter1/Schema1.md +++ /dev/null @@ -1,49 +0,0 @@ -# Schema1 -public class Schema1
- -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 - -## Nested Class Summary -| Modifier and Type | Class and Description | -| ----------------- | ---------------------- | -| sealed interface | [Schema1.Schema11Boxed](#schema11boxed)
sealed interface for validated payloads | -| record | [Schema1.Schema11BoxedString](#schema11boxedstring)
boxed class to store validated String payloads | -| static class | [Schema1.Schema11](#schema11)
schema class | - -## Schema11Boxed -public sealed interface Schema11Boxed
-permits
-[Schema11BoxedString](#schema11boxedstring) - -sealed interface that stores validated payloads using boxed classes - -## Schema11BoxedString -public record Schema11BoxedString
-implements [Schema11Boxed](#schema11boxed) - -record that stores validated String payloads, sealed permits implementation - -### Constructor Summary -| Constructor and Description | -| --------------------------- | -| Schema11BoxedString(String data)
Creates an instance, private visibility | - -### Method Summary -| Modifier and Type | Method and Description | -| ----------------- | ---------------------- | -| String | data()
validated payload | -| @Nullable Object | getData()
validated payload | - -## Schema11 -public static class Schema11
-extends StringJsonSchema.StringJsonSchema1 - -A schema class that validates payloads - -| Methods Inherited from class org.openapijsonschematools.client.schemas.StringJsonSchema.StringJsonSchema1 | -| ------------------------------------------------------------------ | -| validate | -| validateAndBox | diff --git a/samples/client/petstore/kotlin/docs/paths/userlogin/get/responses/UserloginGetCode200Response.md b/samples/client/petstore/kotlin/docs/paths/userlogin/get/responses/UserloginGetCode200Response.md deleted file mode 100644 index c2719cbebc0..00000000000 --- a/samples/client/petstore/kotlin/docs/paths/userlogin/get/responses/UserloginGetCode200Response.md +++ /dev/null @@ -1,123 +0,0 @@ -# UserloginGetCode200Response - -public class UserloginGetCode200Response - -A class that contains necessary nested response classes -- SealedMediaType, a sealed interface which contains all the schema/encoding info for each contentType -- records which implement SealedMediaType, the concrete media types -- SealedResponseBody, a sealed interface which contains all the contentType/schema types -- records which implement SealedResponseBody, the concrete response body types -- a class that extends ResponseDeserializer and is used to deserialize responses - -## Nested Class Summary -| Modifier and Type | Class and Description | -| ----------------- | --------------------- | -| sealed interface | [UserloginGetCode200Response.SealedMediaType](#sealedmediatype)
media type sealed interface | -| record | [UserloginGetCode200Response.ApplicationxmlMediaType](#applicationxmlmediatype)
record storing schema + encoding for a specific contentType | -| record | [UserloginGetCode200Response.ApplicationjsonMediaType](#applicationjsonmediatype)
record storing schema + encoding for a specific contentType | -| sealed interface | [UserloginGetCode200Response.SealedResponseBody](#sealedresponsebody)
response body sealed interface | -| record | [UserloginGetCode200Response.ApplicationxmlResponseBody](#applicationxmlresponsebody)
implements sealed interface to store response body | -| record | [UserloginGetCode200Response.ApplicationjsonResponseBody](#applicationjsonresponsebody)
implements sealed interface to store response body | -| static class | [UserloginGetCode200Response.UserloginGetCode200Response1](#userlogingetcode200response1)
class that deserializes responses | - -## SealedMediaType -public sealed interface SealedMediaType
-permits
-[ApplicationxmlMediaType](#applicationxmlmediatype), -[ApplicationjsonMediaType](#applicationjsonmediatype) - -sealed interface that stores schema and encoding info - -## ApplicationxmlMediaType -public record ApplicationxmlMediaType
-implements [SealedMediaType](#sealedmediatype), MediaType<[ApplicationxmlSchema.ApplicationxmlSchema1](../../../../paths/userlogin/get/responses/code200response/content/applicationxml/ApplicationxmlSchema.md#applicationxmlschema1), Nothing?> - -class storing schema info for a specific contentType - -### Constructor Summary -| Constructor and Description | -| --------------------------- | -| ApplicationxmlMediaType()
Creates an instance | - -### Method Summary -| Modifier and Type | Method and Description | -| ----------------- | ---------------------- | -| [ApplicationxmlSchema.ApplicationxmlSchema1](../../../../paths/userlogin/get/responses/code200response/content/applicationxml/ApplicationxmlSchema.md#applicationxmlschema1) | schema()
the schema for this MediaType | -| Nothing? | encoding()
the encoding info | - -## ApplicationjsonMediaType -public record ApplicationjsonMediaType
-implements [SealedMediaType](#sealedmediatype), MediaType<[ApplicationjsonSchema.ApplicationjsonSchema1](../../../../paths/userlogin/get/responses/code200response/content/applicationjson/ApplicationjsonSchema.md#applicationjsonschema1), Nothing?> - -class storing schema info for a specific contentType - -### Constructor Summary -| Constructor and Description | -| --------------------------- | -| ApplicationjsonMediaType()
Creates an instance | - -### Method Summary -| Modifier and Type | Method and Description | -| ----------------- | ---------------------- | -| [ApplicationjsonSchema.ApplicationjsonSchema1](../../../../paths/userlogin/get/responses/code200response/content/applicationjson/ApplicationjsonSchema.md#applicationjsonschema1) | schema()
the schema for this MediaType | -| Nothing? | encoding()
the encoding info | - -## SealedResponseBody -public sealed interface SealedResponseBody
-permits
-[ApplicationxmlResponseBody](#applicationxmlresponsebody), -[ApplicationjsonResponseBody](#applicationjsonresponsebody) - -sealed interface that stores response body - -## ApplicationxmlResponseBody -public record ApplicationxmlResponseBody
-implements [SealedResponseBody](#sealedresponsebody) - -A record class to store response body for contentType="application/xml" - -### Constructor Summary -| Constructor and Description | -| --------------------------- | -| ApplicationxmlResponseBody(ApplicationxmlSchema.StringJsonSchema1Boxed body)
Creates an instance | - -### Method Summary -| Modifier and Type | Method and Description | -| ----------------- | ---------------------- | -| ApplicationxmlSchema.StringJsonSchema1Boxed | body()
returns the body passed in in the constructor | -## ApplicationjsonResponseBody -public record ApplicationjsonResponseBody
-implements [SealedResponseBody](#sealedresponsebody) - -A record class to store response body for contentType="application/json" - -### Constructor Summary -| Constructor and Description | -| --------------------------- | -| ApplicationjsonResponseBody(ApplicationjsonSchema.StringJsonSchema1Boxed body)
Creates an instance | - -### Method Summary -| Modifier and Type | Method and Description | -| ----------------- | ---------------------- | -| ApplicationjsonSchema.StringJsonSchema1Boxed | body()
returns the body passed in in the constructor | - -## UserloginGetCode200Response1 -public static class UserloginGetCode200Response1
-extends ResponseDeserializer<[SealedResponseBody](#sealedresponsebody), [UserloginGetCode200ResponseHeadersSchema.UserloginGetCode200ResponseHeadersSchemaMap](../../../../paths/userlogin/get/responses/code200response/UserloginGetCode200ResponseHeadersSchema.md#userlogingetcode200responseheadersschemamap), [SealedMediaType](#sealedmediatype)> - -a class that deserializes responses - -### Constructor Summary -| Constructor and Description | -| --------------------------- | -| UserloginGetCode200Response1()
Creates an instance | - -### Field Summary -| Modifier and Type | Field and Description | -| ----------------- | --------------------- | -| Map | content = Map.ofEntries(
    new AbstractMap.SimpleEntry<>("application/xml", new [ApplicationxmlMediaType](#applicationxmlmediatype)()),
    new AbstractMap.SimpleEntry<>("application/json", new [ApplicationjsonMediaType](#applicationjsonmediatype)())
)
the contentType to schema info | - -### Method Summary -| Modifier and Type | Method and Description | -| ----------------- | ---------------------- | -| ApiResponse<[SealedResponseBody](#sealedresponsebody), [UserloginGetCode200ResponseHeadersSchema.UserloginGetCode200ResponseHeadersSchemaMap](../../../../paths/userlogin/get/responses/code200response/UserloginGetCode200ResponseHeadersSchema.md#userlogingetcode200responseheadersschemamap)> | deserialize(HttpResponse response, SchemaConfiguration configuration)
called by endpoint when deserialize responses | diff --git a/samples/client/petstore/kotlin/docs/paths/userlogin/get/responses/UserloginGetCode400Response.md b/samples/client/petstore/kotlin/docs/paths/userlogin/get/responses/UserloginGetCode400Response.md deleted file mode 100644 index f093cb99296..00000000000 --- a/samples/client/petstore/kotlin/docs/paths/userlogin/get/responses/UserloginGetCode400Response.md +++ /dev/null @@ -1,32 +0,0 @@ -# UserloginGetCode400Response - -public class UserloginGetCode400Response - -A class that contains necessary nested response classes -- a class that extends ResponseDeserializer and is used to deserialize responses - -## Nested Class Summary -| Modifier and Type | Class and Description | -| ----------------- | --------------------- | -| static class | [UserloginGetCode400Response.UserloginGetCode400Response1](#userlogingetcode400response1)
class that deserializes responses | - -## UserloginGetCode400Response1 -public static class UserloginGetCode400Response1
-extends ResponseDeserializer - -a class that deserializes responses - -### Constructor Summary -| Constructor and Description | -| --------------------------- | -| UserloginGetCode400Response1()
Creates an instance | - -### Field Summary -| Modifier and Type | Field and Description | -| ----------------- | --------------------- | -| Map | content = MapUtils.makeMap(
)
the contentType to schema info | - -### Method Summary -| Modifier and Type | Method and Description | -| ----------------- | ---------------------- | -| ApiResponse | deserialize(HttpResponse response, SchemaConfiguration configuration)
called by endpoint when deserialize responses | diff --git a/samples/client/petstore/kotlin/docs/paths/userlogin/get/responses/code200response/UserloginGetCode200ResponseHeadersSchema.md b/samples/client/petstore/kotlin/docs/paths/userlogin/get/responses/code200response/UserloginGetCode200ResponseHeadersSchema.md deleted file mode 100644 index 21bf75ce299..00000000000 --- a/samples/client/petstore/kotlin/docs/paths/userlogin/get/responses/code200response/UserloginGetCode200ResponseHeadersSchema.md +++ /dev/null @@ -1,389 +0,0 @@ -# UserloginGetCode200ResponseHeadersSchema -public class UserloginGetCode200ResponseHeadersSchema
- -A class that contains necessary nested -- schema classes (which validate payloads), extends JsonSchema -- sealed interfaces which store validated payloads, java version of a sum type -- boxed classes which store validated payloads, sealed permits class implementations -- classes to store validated map payloads, extends FrozenMap -- classes to build inputs for map payloads - -## Nested Class Summary -| Modifier and Type | Class and Description | -| ----------------- | ---------------------- | -| sealed interface | [UserloginGetCode200ResponseHeadersSchema.UserloginGetCode200ResponseHeadersSchema1Boxed](#userlogingetcode200responseheadersschema1boxed)
sealed interface for validated payloads | -| record | [UserloginGetCode200ResponseHeadersSchema.UserloginGetCode200ResponseHeadersSchema1BoxedMap](#userlogingetcode200responseheadersschema1boxedmap)
boxed class to store validated Map payloads | -| static class | [UserloginGetCode200ResponseHeadersSchema.UserloginGetCode200ResponseHeadersSchema1](#userlogingetcode200responseheadersschema1)
schema class | -| static class | [UserloginGetCode200ResponseHeadersSchema.UserloginGetCode200ResponseHeadersSchemaMapBuilder](#userlogingetcode200responseheadersschemamapbuilder)
builder for Map payloads | -| static class | [UserloginGetCode200ResponseHeadersSchema.UserloginGetCode200ResponseHeadersSchemaMap](#userlogingetcode200responseheadersschemamap)
output class for Map payloads | -| sealed interface | [UserloginGetCode200ResponseHeadersSchema.UserloginGetCode200ResponseAdditionalPropertiesBoxed](#userlogingetcode200responseadditionalpropertiesboxed)
sealed interface for validated payloads | -| record | [UserloginGetCode200ResponseHeadersSchema.UserloginGetCode200ResponseAdditionalPropertiesBoxedVoid](#userlogingetcode200responseadditionalpropertiesboxedvoid)
boxed class to store validated null payloads | -| record | [UserloginGetCode200ResponseHeadersSchema.UserloginGetCode200ResponseAdditionalPropertiesBoxedBoolean](#userlogingetcode200responseadditionalpropertiesboxedboolean)
boxed class to store validated boolean payloads | -| record | [UserloginGetCode200ResponseHeadersSchema.UserloginGetCode200ResponseAdditionalPropertiesBoxedNumber](#userlogingetcode200responseadditionalpropertiesboxednumber)
boxed class to store validated Number payloads | -| record | [UserloginGetCode200ResponseHeadersSchema.UserloginGetCode200ResponseAdditionalPropertiesBoxedString](#userlogingetcode200responseadditionalpropertiesboxedstring)
boxed class to store validated String payloads | -| record | [UserloginGetCode200ResponseHeadersSchema.UserloginGetCode200ResponseAdditionalPropertiesBoxedList](#userlogingetcode200responseadditionalpropertiesboxedlist)
boxed class to store validated List payloads | -| record | [UserloginGetCode200ResponseHeadersSchema.UserloginGetCode200ResponseAdditionalPropertiesBoxedMap](#userlogingetcode200responseadditionalpropertiesboxedmap)
boxed class to store validated Map payloads | -| static class | [UserloginGetCode200ResponseHeadersSchema.UserloginGetCode200ResponseAdditionalProperties](#userlogingetcode200responseadditionalproperties)
schema class | - -## UserloginGetCode200ResponseHeadersSchema1Boxed -public sealed interface UserloginGetCode200ResponseHeadersSchema1Boxed
-permits
-[UserloginGetCode200ResponseHeadersSchema1BoxedMap](#userlogingetcode200responseheadersschema1boxedmap) - -sealed interface that stores validated payloads using boxed classes - -## UserloginGetCode200ResponseHeadersSchema1BoxedMap -public record UserloginGetCode200ResponseHeadersSchema1BoxedMap
-implements [UserloginGetCode200ResponseHeadersSchema1Boxed](#userlogingetcode200responseheadersschema1boxed) - -record that stores validated Map payloads, sealed permits implementation - -### Constructor Summary -| Constructor and Description | -| --------------------------- | -| UserloginGetCode200ResponseHeadersSchema1BoxedMap([UserloginGetCode200ResponseHeadersSchemaMap](#userlogingetcode200responseheadersschemamap) data)
Creates an instance, private visibility | - -### Method Summary -| Modifier and Type | Method and Description | -| ----------------- | ---------------------- | -| [UserloginGetCode200ResponseHeadersSchemaMap](#userlogingetcode200responseheadersschemamap) | data()
validated payload | -| @Nullable Object | getData()
validated payload | - -## UserloginGetCode200ResponseHeadersSchema1 -public static class UserloginGetCode200ResponseHeadersSchema1
-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.userlogin.get.responses.code200response.UserloginGetCode200ResponseHeadersSchema; - -import java.util.Arrays; -import java.util.List; -import java.util.AbstractMap; - -static final SchemaConfiguration configuration = new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().build()); - -// Map validation -UserloginGetCode200ResponseHeadersSchema.UserloginGetCode200ResponseHeadersSchemaMap validatedPayload = - UserloginGetCode200ResponseHeadersSchema.UserloginGetCode200ResponseHeadersSchema1.validate( - new UserloginGetCode200ResponseHeadersSchema.UserloginGetCode200ResponseHeadersSchemaMapBuilder() - .xHyphenMinusRateHyphenMinusLimit(1) - - .int32(1) - - .refHyphenMinusContentHyphenMinusSchemaHyphenMinusHeader("a") - - .xHyphenMinusExpiresHyphenMinusAfter("1970-01-01T00:00:00.00Z") - - .numberHeader("3.14") - - .build(), - configuration -); -``` - -### Field Summary -| Modifier and Type | Field and Description | -| ----------------- | ---------------------- | -| Set> | type = Set.of(Map.class) | -| Map> | properties = Map.ofEntries(
    new PropertyEntry("X-Rate-Limit", [XRateLimitSchema.XRateLimitSchema1.class](../../../../../paths/userlogin/get/responses/code200response/headers/xratelimit/content/applicationjson/XRateLimitSchema.md#xratelimitschema1)),
    new PropertyEntry("int32", [Int32JsonContentTypeHeaderSchema.Int32JsonContentTypeHeaderSchema1.class](../../../../../components/headers/int32jsoncontenttypeheader/content/applicationjson/Int32JsonContentTypeHeaderSchema.md#int32jsoncontenttypeheaderschema1)),
    new PropertyEntry("X-Expires-After", [XExpiresAfterSchema.XExpiresAfterSchema1.class](../../../../../paths/userlogin/get/responses/code200response/headers/xexpiresafter/XExpiresAfterSchema.md#xexpiresafterschema1)),
    new PropertyEntry("ref-content-schema-header", [StringWithValidation.StringWithValidation1.class](../../../../../components/schemas/StringWithValidation.md#stringwithvalidation1)),
    new PropertyEntry("numberHeader", [NumberHeaderSchema.NumberHeaderSchema1.class](../../../../../components/headers/numberheader/NumberHeaderSchema.md#numberheaderschema1))
)
| -| Set | required = Set.of(
    "X-Rate-Limit",
    "int32",
    "ref-content-schema-header"
)
| -| Class | additionalProperties = [UserloginGetCode200ResponseAdditionalProperties.class](#userlogingetcode200responseadditionalproperties) | - -### Method Summary -| Modifier and Type | Method and Description | -| ----------------- | ---------------------- | -| [UserloginGetCode200ResponseHeadersSchemaMap](#userlogingetcode200responseheadersschemamap) | validate([Map<?, ?>](#userlogingetcode200responseheadersschemamapbuilder) arg, SchemaConfiguration configuration) | -| [UserloginGetCode200ResponseHeadersSchema1BoxedMap](#userlogingetcode200responseheadersschema1boxedmap) | validateAndBox([Map<?, ?>](#userlogingetcode200responseheadersschemamapbuilder) arg, SchemaConfiguration configuration) | -| [UserloginGetCode200ResponseHeadersSchema1Boxed](#userlogingetcode200responseheadersschema1boxed) | validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) | -| @Nullable Object | validate(@Nullable Object arg, SchemaConfiguration configuration) | - -## UserloginGetCode200ResponseHeadersSchemaMap000Builder -public class UserloginGetCode200ResponseHeadersSchemaMap000Builder
-builder for `Map` - -A class that builds the Map input type - -### Constructor Summary -| Constructor and Description | -| --------------------------- | -| UserloginGetCode200ResponseHeadersSchemaMap000Builder(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 | -| [UserloginGetCode200ResponseHeadersSchemaMap000Builder](#userlogingetcode200responseheadersschemamap000builder) | xHyphenMinusExpiresHyphenMinusAfter(String value) | -| [UserloginGetCode200ResponseHeadersSchemaMap000Builder](#userlogingetcode200responseheadersschemamap000builder) | numberHeader(String value) | - -## UserloginGetCode200ResponseHeadersSchemaMap001Builder -public class UserloginGetCode200ResponseHeadersSchemaMap001Builder
-builder for `Map` - -A class that builds the Map input type - -### Constructor Summary -| Constructor and Description | -| --------------------------- | -| UserloginGetCode200ResponseHeadersSchemaMap001Builder(Map instance)
Creates a builder that contains the passed instance | - -### Method Summary -| Modifier and Type | Method and Description | -| ----------------- | ---------------------- | -| [UserloginGetCode200ResponseHeadersSchemaMap000Builder](#userlogingetcode200responseheadersschemamap000builder) | refHyphenMinusContentHyphenMinusSchemaHyphenMinusHeader(String value) | - -## UserloginGetCode200ResponseHeadersSchemaMap010Builder -public class UserloginGetCode200ResponseHeadersSchemaMap010Builder
-builder for `Map` - -A class that builds the Map input type - -### Constructor Summary -| Constructor and Description | -| --------------------------- | -| UserloginGetCode200ResponseHeadersSchemaMap010Builder(Map instance)
Creates a builder that contains the passed instance | - -### Method Summary -| Modifier and Type | Method and Description | -| ----------------- | ---------------------- | -| [UserloginGetCode200ResponseHeadersSchemaMap000Builder](#userlogingetcode200responseheadersschemamap000builder) | int32(int value) | -| [UserloginGetCode200ResponseHeadersSchemaMap000Builder](#userlogingetcode200responseheadersschemamap000builder) | int32(float value) | - -## UserloginGetCode200ResponseHeadersSchemaMap011Builder -public class UserloginGetCode200ResponseHeadersSchemaMap011Builder
-builder for `Map` - -A class that builds the Map input type - -### Constructor Summary -| Constructor and Description | -| --------------------------- | -| UserloginGetCode200ResponseHeadersSchemaMap011Builder(Map instance)
Creates a builder that contains the passed instance | - -### Method Summary -| Modifier and Type | Method and Description | -| ----------------- | ---------------------- | -| [UserloginGetCode200ResponseHeadersSchemaMap001Builder](#userlogingetcode200responseheadersschemamap001builder) | int32(int value) | -| [UserloginGetCode200ResponseHeadersSchemaMap001Builder](#userlogingetcode200responseheadersschemamap001builder) | int32(float value) | -| [UserloginGetCode200ResponseHeadersSchemaMap010Builder](#userlogingetcode200responseheadersschemamap010builder) | refHyphenMinusContentHyphenMinusSchemaHyphenMinusHeader(String value) | - -## UserloginGetCode200ResponseHeadersSchemaMap100Builder -public class UserloginGetCode200ResponseHeadersSchemaMap100Builder
-builder for `Map` - -A class that builds the Map input type - -### Constructor Summary -| Constructor and Description | -| --------------------------- | -| UserloginGetCode200ResponseHeadersSchemaMap100Builder(Map instance)
Creates a builder that contains the passed instance | - -### Method Summary -| Modifier and Type | Method and Description | -| ----------------- | ---------------------- | -| [UserloginGetCode200ResponseHeadersSchemaMap000Builder](#userlogingetcode200responseheadersschemamap000builder) | xHyphenMinusRateHyphenMinusLimit(int value) | -| [UserloginGetCode200ResponseHeadersSchemaMap000Builder](#userlogingetcode200responseheadersschemamap000builder) | xHyphenMinusRateHyphenMinusLimit(float value) | - -## UserloginGetCode200ResponseHeadersSchemaMap101Builder -public class UserloginGetCode200ResponseHeadersSchemaMap101Builder
-builder for `Map` - -A class that builds the Map input type - -### Constructor Summary -| Constructor and Description | -| --------------------------- | -| UserloginGetCode200ResponseHeadersSchemaMap101Builder(Map instance)
Creates a builder that contains the passed instance | - -### Method Summary -| Modifier and Type | Method and Description | -| ----------------- | ---------------------- | -| [UserloginGetCode200ResponseHeadersSchemaMap001Builder](#userlogingetcode200responseheadersschemamap001builder) | xHyphenMinusRateHyphenMinusLimit(int value) | -| [UserloginGetCode200ResponseHeadersSchemaMap001Builder](#userlogingetcode200responseheadersschemamap001builder) | xHyphenMinusRateHyphenMinusLimit(float value) | -| [UserloginGetCode200ResponseHeadersSchemaMap100Builder](#userlogingetcode200responseheadersschemamap100builder) | refHyphenMinusContentHyphenMinusSchemaHyphenMinusHeader(String value) | - -## UserloginGetCode200ResponseHeadersSchemaMap110Builder -public class UserloginGetCode200ResponseHeadersSchemaMap110Builder
-builder for `Map` - -A class that builds the Map input type - -### Constructor Summary -| Constructor and Description | -| --------------------------- | -| UserloginGetCode200ResponseHeadersSchemaMap110Builder(Map instance)
Creates a builder that contains the passed instance | - -### Method Summary -| Modifier and Type | Method and Description | -| ----------------- | ---------------------- | -| [UserloginGetCode200ResponseHeadersSchemaMap010Builder](#userlogingetcode200responseheadersschemamap010builder) | xHyphenMinusRateHyphenMinusLimit(int value) | -| [UserloginGetCode200ResponseHeadersSchemaMap010Builder](#userlogingetcode200responseheadersschemamap010builder) | xHyphenMinusRateHyphenMinusLimit(float value) | -| [UserloginGetCode200ResponseHeadersSchemaMap100Builder](#userlogingetcode200responseheadersschemamap100builder) | int32(int value) | -| [UserloginGetCode200ResponseHeadersSchemaMap100Builder](#userlogingetcode200responseheadersschemamap100builder) | int32(float value) | - -## UserloginGetCode200ResponseHeadersSchemaMapBuilder -public class UserloginGetCode200ResponseHeadersSchemaMapBuilder
-builder for `Map` - -A class that builds the Map input type - -### Constructor Summary -| Constructor and Description | -| --------------------------- | -| UserloginGetCode200ResponseHeadersSchemaMapBuilder()
Creates a builder that contains an empty map | - -### Method Summary -| Modifier and Type | Method and Description | -| ----------------- | ---------------------- | -| [UserloginGetCode200ResponseHeadersSchemaMap011Builder](#userlogingetcode200responseheadersschemamap011builder) | xHyphenMinusRateHyphenMinusLimit(int value) | -| [UserloginGetCode200ResponseHeadersSchemaMap011Builder](#userlogingetcode200responseheadersschemamap011builder) | xHyphenMinusRateHyphenMinusLimit(float value) | -| [UserloginGetCode200ResponseHeadersSchemaMap101Builder](#userlogingetcode200responseheadersschemamap101builder) | int32(int value) | -| [UserloginGetCode200ResponseHeadersSchemaMap101Builder](#userlogingetcode200responseheadersschemamap101builder) | int32(float value) | -| [UserloginGetCode200ResponseHeadersSchemaMap110Builder](#userlogingetcode200responseheadersschemamap110builder) | refHyphenMinusContentHyphenMinusSchemaHyphenMinusHeader(String value) | - -## UserloginGetCode200ResponseHeadersSchemaMap -public static class UserloginGetCode200ResponseHeadersSchemaMap
-extends FrozenMap - -A class to store validated Map payloads - -### Method Summary -| Modifier and Type | Method and Description | -| ----------------- | ---------------------- | -| static [UserloginGetCode200ResponseHeadersSchemaMap](#userlogingetcode200responseheadersschemamap) | of([Map](#userlogingetcode200responseheadersschemamapbuilder) arg, SchemaConfiguration configuration) | -| Number | int32()
| -| String | numberHeader()
[optional] | -| @Nullable Object | get(String key)
This schema has invalid Java names so this method must be used when you access instance["X-Rate-Limit"], instance["ref-content-schema-header"], instance["X-Expires-After"], | - -## UserloginGetCode200ResponseAdditionalPropertiesBoxed -public sealed interface UserloginGetCode200ResponseAdditionalPropertiesBoxed
-permits
-[UserloginGetCode200ResponseAdditionalPropertiesBoxedVoid](#userlogingetcode200responseadditionalpropertiesboxedvoid), -[UserloginGetCode200ResponseAdditionalPropertiesBoxedBoolean](#userlogingetcode200responseadditionalpropertiesboxedboolean), -[UserloginGetCode200ResponseAdditionalPropertiesBoxedNumber](#userlogingetcode200responseadditionalpropertiesboxednumber), -[UserloginGetCode200ResponseAdditionalPropertiesBoxedString](#userlogingetcode200responseadditionalpropertiesboxedstring), -[UserloginGetCode200ResponseAdditionalPropertiesBoxedList](#userlogingetcode200responseadditionalpropertiesboxedlist), -[UserloginGetCode200ResponseAdditionalPropertiesBoxedMap](#userlogingetcode200responseadditionalpropertiesboxedmap) - -sealed interface that stores validated payloads using boxed classes - -## UserloginGetCode200ResponseAdditionalPropertiesBoxedVoid -public record UserloginGetCode200ResponseAdditionalPropertiesBoxedVoid
-implements [UserloginGetCode200ResponseAdditionalPropertiesBoxed](#userlogingetcode200responseadditionalpropertiesboxed) - -record that stores validated null payloads, sealed permits implementation - -### Constructor Summary -| Constructor and Description | -| --------------------------- | -| UserloginGetCode200ResponseAdditionalPropertiesBoxedVoid(Nothing? data)
Creates an instance, private visibility | - -### Method Summary -| Modifier and Type | Method and Description | -| ----------------- | ---------------------- | -| Nothing? | data()
validated payload | -| @Nullable Object | getData()
validated payload | - -## UserloginGetCode200ResponseAdditionalPropertiesBoxedBoolean -public record UserloginGetCode200ResponseAdditionalPropertiesBoxedBoolean
-implements [UserloginGetCode200ResponseAdditionalPropertiesBoxed](#userlogingetcode200responseadditionalpropertiesboxed) - -record that stores validated boolean payloads, sealed permits implementation - -### Constructor Summary -| Constructor and Description | -| --------------------------- | -| UserloginGetCode200ResponseAdditionalPropertiesBoxedBoolean(boolean data)
Creates an instance, private visibility | - -### Method Summary -| Modifier and Type | Method and Description | -| ----------------- | ---------------------- | -| boolean | data()
validated payload | -| @Nullable Object | getData()
validated payload | - -## UserloginGetCode200ResponseAdditionalPropertiesBoxedNumber -public record UserloginGetCode200ResponseAdditionalPropertiesBoxedNumber
-implements [UserloginGetCode200ResponseAdditionalPropertiesBoxed](#userlogingetcode200responseadditionalpropertiesboxed) - -record that stores validated Number payloads, sealed permits implementation - -### Constructor Summary -| Constructor and Description | -| --------------------------- | -| UserloginGetCode200ResponseAdditionalPropertiesBoxedNumber(Number data)
Creates an instance, private visibility | - -### Method Summary -| Modifier and Type | Method and Description | -| ----------------- | ---------------------- | -| Number | data()
validated payload | -| @Nullable Object | getData()
validated payload | - -## UserloginGetCode200ResponseAdditionalPropertiesBoxedString -public record UserloginGetCode200ResponseAdditionalPropertiesBoxedString
-implements [UserloginGetCode200ResponseAdditionalPropertiesBoxed](#userlogingetcode200responseadditionalpropertiesboxed) - -record that stores validated String payloads, sealed permits implementation - -### Constructor Summary -| Constructor and Description | -| --------------------------- | -| UserloginGetCode200ResponseAdditionalPropertiesBoxedString(String data)
Creates an instance, private visibility | - -### Method Summary -| Modifier and Type | Method and Description | -| ----------------- | ---------------------- | -| String | data()
validated payload | -| @Nullable Object | getData()
validated payload | - -## UserloginGetCode200ResponseAdditionalPropertiesBoxedList -public record UserloginGetCode200ResponseAdditionalPropertiesBoxedList
-implements [UserloginGetCode200ResponseAdditionalPropertiesBoxed](#userlogingetcode200responseadditionalpropertiesboxed) - -record that stores validated List payloads, sealed permits implementation - -### Constructor Summary -| Constructor and Description | -| --------------------------- | -| UserloginGetCode200ResponseAdditionalPropertiesBoxedList(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 | - -## UserloginGetCode200ResponseAdditionalPropertiesBoxedMap -public record UserloginGetCode200ResponseAdditionalPropertiesBoxedMap
-implements [UserloginGetCode200ResponseAdditionalPropertiesBoxed](#userlogingetcode200responseadditionalpropertiesboxed) - -record that stores validated Map payloads, sealed permits implementation - -### Constructor Summary -| Constructor and Description | -| --------------------------- | -| UserloginGetCode200ResponseAdditionalPropertiesBoxedMap(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 | - -## UserloginGetCode200ResponseAdditionalProperties -public static class UserloginGetCode200ResponseAdditionalProperties
-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/kotlin/docs/paths/userlogin/get/responses/code200response/content/applicationjson/ApplicationjsonSchema.md b/samples/client/petstore/kotlin/docs/paths/userlogin/get/responses/code200response/content/applicationjson/ApplicationjsonSchema.md deleted file mode 100644 index fe0b32c3b81..00000000000 --- a/samples/client/petstore/kotlin/docs/paths/userlogin/get/responses/code200response/content/applicationjson/ApplicationjsonSchema.md +++ /dev/null @@ -1,49 +0,0 @@ -# ApplicationjsonSchema -public class ApplicationjsonSchema
- -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 - -## Nested Class Summary -| Modifier and Type | Class and Description | -| ----------------- | ---------------------- | -| sealed interface | [ApplicationjsonSchema.ApplicationjsonSchema1Boxed](#applicationjsonschema1boxed)
sealed interface for validated payloads | -| record | [ApplicationjsonSchema.ApplicationjsonSchema1BoxedString](#applicationjsonschema1boxedstring)
boxed class to store validated String payloads | -| static class | [ApplicationjsonSchema.ApplicationjsonSchema1](#applicationjsonschema1)
schema class | - -## ApplicationjsonSchema1Boxed -public sealed interface ApplicationjsonSchema1Boxed
-permits
-[ApplicationjsonSchema1BoxedString](#applicationjsonschema1boxedstring) - -sealed interface that stores validated payloads using boxed classes - -## ApplicationjsonSchema1BoxedString -public record ApplicationjsonSchema1BoxedString
-implements [ApplicationjsonSchema1Boxed](#applicationjsonschema1boxed) - -record that stores validated String payloads, sealed permits implementation - -### Constructor Summary -| Constructor and Description | -| --------------------------- | -| ApplicationjsonSchema1BoxedString(String data)
Creates an instance, private visibility | - -### Method Summary -| Modifier and Type | Method and Description | -| ----------------- | ---------------------- | -| String | data()
validated payload | -| @Nullable Object | getData()
validated payload | - -## ApplicationjsonSchema1 -public static class ApplicationjsonSchema1
-extends StringJsonSchema.StringJsonSchema1 - -A schema class that validates payloads - -| Methods Inherited from class org.openapijsonschematools.client.schemas.StringJsonSchema.StringJsonSchema1 | -| ------------------------------------------------------------------ | -| validate | -| validateAndBox | diff --git a/samples/client/petstore/kotlin/docs/paths/userlogin/get/responses/code200response/content/applicationxml/ApplicationxmlSchema.md b/samples/client/petstore/kotlin/docs/paths/userlogin/get/responses/code200response/content/applicationxml/ApplicationxmlSchema.md deleted file mode 100644 index 81b5c1d6689..00000000000 --- a/samples/client/petstore/kotlin/docs/paths/userlogin/get/responses/code200response/content/applicationxml/ApplicationxmlSchema.md +++ /dev/null @@ -1,49 +0,0 @@ -# ApplicationxmlSchema -public class ApplicationxmlSchema
- -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 - -## Nested Class Summary -| Modifier and Type | Class and Description | -| ----------------- | ---------------------- | -| sealed interface | [ApplicationxmlSchema.ApplicationxmlSchema1Boxed](#applicationxmlschema1boxed)
sealed interface for validated payloads | -| record | [ApplicationxmlSchema.ApplicationxmlSchema1BoxedString](#applicationxmlschema1boxedstring)
boxed class to store validated String payloads | -| static class | [ApplicationxmlSchema.ApplicationxmlSchema1](#applicationxmlschema1)
schema class | - -## ApplicationxmlSchema1Boxed -public sealed interface ApplicationxmlSchema1Boxed
-permits
-[ApplicationxmlSchema1BoxedString](#applicationxmlschema1boxedstring) - -sealed interface that stores validated payloads using boxed classes - -## ApplicationxmlSchema1BoxedString -public record ApplicationxmlSchema1BoxedString
-implements [ApplicationxmlSchema1Boxed](#applicationxmlschema1boxed) - -record that stores validated String payloads, sealed permits implementation - -### Constructor Summary -| Constructor and Description | -| --------------------------- | -| ApplicationxmlSchema1BoxedString(String data)
Creates an instance, private visibility | - -### Method Summary -| Modifier and Type | Method and Description | -| ----------------- | ---------------------- | -| String | data()
validated payload | -| @Nullable Object | getData()
validated payload | - -## ApplicationxmlSchema1 -public static class ApplicationxmlSchema1
-extends StringJsonSchema.StringJsonSchema1 - -A schema class that validates payloads - -| Methods Inherited from class org.openapijsonschematools.client.schemas.StringJsonSchema.StringJsonSchema1 | -| ------------------------------------------------------------------ | -| validate | -| validateAndBox | diff --git a/samples/client/petstore/kotlin/docs/paths/userlogin/get/responses/code200response/headers/xexpiresafter/XExpiresAfterSchema.md b/samples/client/petstore/kotlin/docs/paths/userlogin/get/responses/code200response/headers/xexpiresafter/XExpiresAfterSchema.md deleted file mode 100644 index 20c88d889d0..00000000000 --- a/samples/client/petstore/kotlin/docs/paths/userlogin/get/responses/code200response/headers/xexpiresafter/XExpiresAfterSchema.md +++ /dev/null @@ -1,49 +0,0 @@ -# XExpiresAfterSchema -public class XExpiresAfterSchema
- -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 - -## Nested Class Summary -| Modifier and Type | Class and Description | -| ----------------- | ---------------------- | -| sealed interface | [XExpiresAfterSchema.XExpiresAfterSchema1Boxed](#xexpiresafterschema1boxed)
sealed interface for validated payloads | -| record | [XExpiresAfterSchema.XExpiresAfterSchema1BoxedString](#xexpiresafterschema1boxedstring)
boxed class to store validated String payloads | -| static class | [XExpiresAfterSchema.XExpiresAfterSchema1](#xexpiresafterschema1)
schema class | - -## XExpiresAfterSchema1Boxed -public sealed interface XExpiresAfterSchema1Boxed
-permits
-[XExpiresAfterSchema1BoxedString](#xexpiresafterschema1boxedstring) - -sealed interface that stores validated payloads using boxed classes - -## XExpiresAfterSchema1BoxedString -public record XExpiresAfterSchema1BoxedString
-implements [XExpiresAfterSchema1Boxed](#xexpiresafterschema1boxed) - -record that stores validated String payloads, sealed permits implementation - -### Constructor Summary -| Constructor and Description | -| --------------------------- | -| XExpiresAfterSchema1BoxedString(String data)
Creates an instance, private visibility | - -### Method Summary -| Modifier and Type | Method and Description | -| ----------------- | ---------------------- | -| String | data()
validated payload | -| @Nullable Object | getData()
validated payload | - -## XExpiresAfterSchema1 -public static class XExpiresAfterSchema1
-extends DateTimeJsonSchema.DateTimeJsonSchema1 - -A schema class that validates payloads - -| Methods Inherited from class org.openapijsonschematools.client.schemas.DateTimeJsonSchema.DateTimeJsonSchema1 | -| ------------------------------------------------------------------ | -| validate | -| validateAndBox | diff --git a/samples/client/petstore/kotlin/docs/paths/userlogin/get/responses/code200response/headers/xratelimit/content/applicationjson/XRateLimitSchema.md b/samples/client/petstore/kotlin/docs/paths/userlogin/get/responses/code200response/headers/xratelimit/content/applicationjson/XRateLimitSchema.md deleted file mode 100644 index 76dfd4f33af..00000000000 --- a/samples/client/petstore/kotlin/docs/paths/userlogin/get/responses/code200response/headers/xratelimit/content/applicationjson/XRateLimitSchema.md +++ /dev/null @@ -1,49 +0,0 @@ -# XRateLimitSchema -public class XRateLimitSchema
- -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 - -## Nested Class Summary -| Modifier and Type | Class and Description | -| ----------------- | ---------------------- | -| sealed interface | [XRateLimitSchema.XRateLimitSchema1Boxed](#xratelimitschema1boxed)
sealed interface for validated payloads | -| record | [XRateLimitSchema.XRateLimitSchema1BoxedNumber](#xratelimitschema1boxednumber)
boxed class to store validated Number payloads | -| static class | [XRateLimitSchema.XRateLimitSchema1](#xratelimitschema1)
schema class | - -## XRateLimitSchema1Boxed -public sealed interface XRateLimitSchema1Boxed
-permits
-[XRateLimitSchema1BoxedNumber](#xratelimitschema1boxednumber) - -sealed interface that stores validated payloads using boxed classes - -## XRateLimitSchema1BoxedNumber -public record XRateLimitSchema1BoxedNumber
-implements [XRateLimitSchema1Boxed](#xratelimitschema1boxed) - -record that stores validated Number payloads, sealed permits implementation - -### Constructor Summary -| Constructor and Description | -| --------------------------- | -| XRateLimitSchema1BoxedNumber(Number data)
Creates an instance, private visibility | - -### Method Summary -| Modifier and Type | Method and Description | -| ----------------- | ---------------------- | -| Number | data()
validated payload | -| @Nullable Object | getData()
validated payload | - -## XRateLimitSchema1 -public static class XRateLimitSchema1
-extends Int32JsonSchema.Int32JsonSchema1 - -A schema class that validates payloads - -| Methods Inherited from class org.openapijsonschematools.client.schemas.Int32JsonSchema.Int32JsonSchema1 | -| ------------------------------------------------------------------ | -| validate | -| validateAndBox | diff --git a/samples/client/petstore/kotlin/docs/paths/userlogout/UserlogoutGet.md b/samples/client/petstore/kotlin/docs/paths/userlogout/UserlogoutGet.md deleted file mode 100644 index 6329d5a2ccd..00000000000 --- a/samples/client/petstore/kotlin/docs/paths/userlogout/UserlogoutGet.md +++ /dev/null @@ -1,142 +0,0 @@ -# UserlogoutGet - -public class UserlogoutGet - -A class that contains necessary endpoint classes -- a class that calls the endpoint method using the http verb -- a class that calls the endpoint method using the operationId name -- class(es) to store the request inputs -- builder(s) to set the request input data - -## Nested Class Summary -| Modifier and Type | Class and Description | -| ----------------- | --------------------- | -| static class | [Get](#get)
The class that has a get method to call the endpoint | -| interface | [LogoutUserOperation](#logoutuseroperation)
The interface that has a logoutUser method to call the endpoint | -| static class | [GetRequest](#getrequest)
The request inputs class | -| static class | [GetRequestBuilder](#getrequestbuilder)
A builder for the request input class | - -## Get -public static class Get extends ApiClient.ApiClient1 implements GetOperation
- -a class that allows one to call the endpoint using a method named get - -### 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.servers.RootServer0; -import org.openapijsonschematools.client.servers.RootServer1; -import org.openapijsonschematools.client.servers.RootServer2; -import org.openapijsonschematools.client.paths.userlogout.get.responses.UserlogoutGetCodedefaultResponse; -import org.openapijsonschematools.client.servers.RootServerInfo; -import org.openapijsonschematools.client.paths.userlogout.UserlogoutGet; -import org.openapijsonschematools.client.paths.userlogout.get.UserlogoutGetResponses; - -import java.io.IOException; -import java.util.Arrays; -import java.util.List; -import java.util.Map; -import java.util.AbstractMap; - -// if you want to use a server that is not SERVER_0 pass it in here and change the ServerIndex input below -ApiConfiguration.ServerInfo serverInfo = new ApiConfiguration.ServerInfoBuilder() - .rootServerInfo( - new RootServerInfo.RootServerInfoBuilder() - .rootServer0(new RootServer0()) - .build() - ) - .build(); -ApiConfiguration.ServerIndexInfo serverIndexInfo = new ApiConfiguration.ServerIndexInfoBuilder() - .rootServerInfoServerIndex(RootServerInfo.ServerIndex.SERVER_0) - .build(); -Duration timeout = Duration.ofSeconds(1L); -Map> defaultHeaders = Map.of("User-Agent", List.of("OpenAPI-JSON-Schema-Generator/1.0.0/java")); -ApiConfiguration apiConfiguration = new ApiConfiguration( - serverInfo - serverIndexInfo, - timeout, - defaultHeaders -); -SchemaConfiguration schemaConfiguration = new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().build()); -UserlogoutGet.Get apiClient = new UserlogoutGet.Get(apiConfiguration, schemaConfiguration); - - -var request = new UserlogoutGet.GetRequestBuilder().build(); - -UserlogoutGetResponses.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; -} -UserlogoutGetResponses.EndpointUserlogoutGetCodedefaultResponse castResponse = (UserlogoutGetResponses.EndpointUserlogoutGetCodedefaultResponse) response; -``` -### Constructor Summary -| Constructor and Description | -| --------------------------- | -| Get(ApiConfiguration apiConfiguration, SchemaConfiguration schemaConfiguration)
Creates an instance | - -### Method Summary -| Modifier and Type | Method and Description | -| ----------------- | ---------------------- | -| [UserlogoutGetResponses.EndpointResponse](../../paths/userlogout/get/UserlogoutGetResponses.md#endpointresponse) | get([GetRequest](#getrequest) request) | - -## LogoutUserOperation -public interface LogoutUserOperation
- -an interface that allows one to call the endpoint using a method named logoutUser by the operationId - -### Method Summary -| Modifier and Type | Method and Description | -| ----------------- | ---------------------- | -| [UserlogoutGetResponses.EndpointResponse](../../paths/userlogout/get/UserlogoutGetResponses.md#endpointresponse) | logoutUser([GetRequest](#getrequest) request) | - -## GetRequest -public static class GetRequest
- -a class that stores the final request inputs - -### Field Summary -| Modifier and Type | Field and Description | -| ----------------- | --------------------- | -| [RootServerInfo.@Nullable ServerIndex](../../RootServerInfo.md#serverindex) | serverIndex
optional. Note: this will override the value in apiConfiguration | -| @Nullable Duration | timeout
optional. Note: this will override the value in apiConfiguration | - -## GetRequestBuilder -public static class GetRequestBuilder
- -a builder for request inputs - -### Constructor Summary -| Constructor and Description | -| --------------------------- | -| GetRequestBuilder()
Creates a builder that contains null for all parameters | - -### Method Summary -| Modifier and Type | Method and Description | -| ----------------- | ---------------------- | -| [GetRequest](#getrequest) | build()
Returns the request input used to call an endpoint method | -| [GetRequestBuilder](#getrequestbuilder) | serverIndex([RootServerInfo.ServerIndex](../../RootServerInfo.md#serverindex) serverIndex)
sets the optional property. Note: this will override the value in apiConfiguration | -| [GetRequestBuilder](#getrequestbuilder) | timeout(Duration timeout)
sets the optional property. Note: this will override the value in apiConfiguration | - -[[Back to top]](#top) [[Back to README]](../../../README.md) diff --git a/samples/client/petstore/kotlin/docs/paths/userlogout/get/UserlogoutGetResponses.md b/samples/client/petstore/kotlin/docs/paths/userlogout/get/UserlogoutGetResponses.md deleted file mode 100644 index 8bd75b7e6fa..00000000000 --- a/samples/client/petstore/kotlin/docs/paths/userlogout/get/UserlogoutGetResponses.md +++ /dev/null @@ -1,29 +0,0 @@ -# UserlogoutGetResponses - -public class UserlogoutGetResponses - -A class that contains necessary responses classes -- a sealed interface, EndpointResponse, that stores endpoint responses -- records for each endpoint response - -## Nested Class Summary -| Modifier and Type | Class and Description | -| ----------------- | --------------------- | -| sealed interface | [EndpointResponse](#endpointresponse)
stores the endpoint responses | -| record | [EndpointUserlogoutGetCodedefaultResponse](#endpointuserlogoutgetcodedefaultresponse)
the response for default | - -## EndpointResponse -public sealed interface EndpointResponse permits
-[EndpointUserlogoutGetCodedefaultResponse](#endpointuserlogoutgetcodedefaultresponse) - -a sealed interface that stores endpoint responses - -## EndpointUserlogoutGetCodedefaultResponse -public record EndpointUserlogoutGetCodedefaultResponse( - HttpResponse response, - Nothing? body, - Nothing? headers -) implements EndpointResponse, ApiResponse
- -a class that stores an endpoint response - diff --git a/samples/client/petstore/kotlin/docs/paths/userlogout/get/responses/UserlogoutGetCodedefaultResponse.md b/samples/client/petstore/kotlin/docs/paths/userlogout/get/responses/UserlogoutGetCodedefaultResponse.md deleted file mode 100644 index 7f34ffefe37..00000000000 --- a/samples/client/petstore/kotlin/docs/paths/userlogout/get/responses/UserlogoutGetCodedefaultResponse.md +++ /dev/null @@ -1,17 +0,0 @@ -# UserlogoutGetCodedefaultResponse - -public class UserlogoutGetCodedefaultResponse extends [RefSuccessDescriptionOnly](../../components/responses/RefSuccessDescriptionOnly.md) - -A class (extended from the $ref class) that contains necessary nested response classes -- a class that extends ResponseDeserializer and is used to deserialize responses - -## Nested Class Summary -| Modifier and Type | Class and Description | -| ----------------- | --------------------- | -| static class | [UserlogoutGetCodedefaultResponse.UserlogoutGetCodedefaultResponse1](#userlogoutgetcodedefaultresponse1)
class that deserializes responses | - -## UserlogoutGetCodedefaultResponse1 -public static class UserlogoutGetCodedefaultResponse1 extends [RefSuccessDescriptionOnly1](../../components/responses/RefSuccessDescriptionOnly.md#refsuccessdescriptiononly1)
- -a class that deserializes responses, extended from the $ref class - diff --git a/samples/client/petstore/kotlin/docs/paths/userusername/UserusernameDelete.md b/samples/client/petstore/kotlin/docs/paths/userusername/UserusernameDelete.md deleted file mode 100644 index 6215a06f511..00000000000 --- a/samples/client/petstore/kotlin/docs/paths/userusername/UserusernameDelete.md +++ /dev/null @@ -1,189 +0,0 @@ -# UserusernameDelete - -public class UserusernameDelete - -A class that contains necessary endpoint classes -- a class that calls the endpoint method using the http verb -- a class that calls the endpoint method using the operationId name -- class(es) to store the request inputs -- builder(s) to set the request input data - -## Nested Class Summary -| Modifier and Type | Class and Description | -| ----------------- | --------------------- | -| static class | [Delete](#delete)
The class that has a delete method to call the endpoint | -| interface | [DeleteUserOperation](#deleteuseroperation)
The interface that has a deleteUser method to call the endpoint | -| static class | [DeleteRequest](#deleterequest)
The final request inputs class | -| static class | [DeleteNullableRequest](#deletenullablerequest)
The initial request inputs class | -| static class | [Delete0RequestBuilder](#delete0requestbuilder)
A builder for the request input class | -| static class | [DeleteRequestBuilder](#deleterequestbuilder)
A builder for the request input class | - -## Delete -public static class Delete extends ApiClient.ApiClient1 implements DeleteOperation
- -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.userusername.delete.UserusernameDeletePathParameters; -import org.openapijsonschematools.client.servers.RootServer0; -import org.openapijsonschematools.client.servers.RootServer1; -import org.openapijsonschematools.client.servers.RootServer2; -import org.openapijsonschematools.client.paths.userusername.delete.responses.UserusernameDeleteCode200Response; -import org.openapijsonschematools.client.paths.userusername.delete.responses.UserusernameDeleteCode404Response; -import org.openapijsonschematools.client.servers.RootServerInfo; -import org.openapijsonschematools.client.paths.userusername.UserusernameDelete; -import org.openapijsonschematools.client.paths.userusername.delete.UserusernameDeleteResponses; - -import java.io.IOException; -import java.util.Arrays; -import java.util.List; -import java.util.Map; -import java.util.AbstractMap; - -// if you want to use a server that is not SERVER_0 pass it in here and change the ServerIndex input below -ApiConfiguration.ServerInfo serverInfo = new ApiConfiguration.ServerInfoBuilder() - .rootServerInfo( - new RootServerInfo.RootServerInfoBuilder() - .rootServer0(new RootServer0()) - .build() - ) - .build(); -ApiConfiguration.ServerIndexInfo serverIndexInfo = new ApiConfiguration.ServerIndexInfoBuilder() - .rootServerInfoServerIndex(RootServerInfo.ServerIndex.SERVER_0) - .build(); -Duration timeout = Duration.ofSeconds(1L); -Map> defaultHeaders = Map.of("User-Agent", List.of("OpenAPI-JSON-Schema-Generator/1.0.0/java")); -ApiConfiguration apiConfiguration = new ApiConfiguration( - serverInfo - serverIndexInfo, - timeout, - defaultHeaders -); -SchemaConfiguration schemaConfiguration = new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().build()); -UserusernameDelete.Delete apiClient = new UserusernameDelete.Delete(apiConfiguration, schemaConfiguration); - - -// Map validation -UserusernameDeletePathParameters.PathParametersMap pathParameters = - UserusernameDeletePathParameters.UserusernameDeletePathParameters1.validate( - new UserusernameDeletePathParameters.PathParametersMapBuilder() - .username("a") - - .build(), - schemaConfiguration -); - -var request = new UserusernameDelete.DeleteRequestBuilder() - .pathParameters(pathParameters) - .build(); - -UserusernameDeleteResponses.EndpointResponse response; -try { - response = apiClient.delete(request); -} catch (UserusernameDeleteCode404Response.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; -} -UserusernameDeleteResponses.EndpointUserusernameDeleteCode200Response castResponse = (UserusernameDeleteResponses.EndpointUserusernameDeleteCode200Response) response; -``` -### Constructor Summary -| Constructor and Description | -| --------------------------- | -| Delete(ApiConfiguration apiConfiguration, SchemaConfiguration schemaConfiguration)
Creates an instance | - -### Method Summary -| Modifier and Type | Method and Description | -| ----------------- | ---------------------- | -| [UserusernameDeleteResponses.EndpointResponse](../../paths/userusername/delete/UserusernameDeleteResponses.md#endpointresponse) | delete([DeleteRequest](#deleterequest) request) | - -## DeleteUserOperation -public interface DeleteUserOperation
- -an interface that allows one to call the endpoint using a method named deleteUser by the operationId - -### Method Summary -| Modifier and Type | Method and Description | -| ----------------- | ---------------------- | -| [UserusernameDeleteResponses.EndpointResponse](../../paths/userusername/delete/UserusernameDeleteResponses.md#endpointresponse) | deleteUser([DeleteRequest](#deleterequest) request) | - -## DeleteRequest -public static class DeleteRequest
- -a class that stores the final request inputs - -### Field Summary -| Modifier and Type | Field and Description | -| ----------------- | --------------------- | -| [UserusernameDeletePathParameters.PathParametersMap](../../paths/userusername/delete/UserusernameDeletePathParameters.md#pathparametersmap) | pathParameters | -| [RootServerInfo.@Nullable ServerIndex](../../RootServerInfo.md#serverindex) | serverIndex
optional. Note: this will override the value in apiConfiguration | -| @Nullable Duration | timeout
optional. Note: this will override the value in apiConfiguration | - -## DeleteNullableRequest -public static class DeleteNullableRequest
- -a class that stores the initial request inputs - -### Field Summary -| Modifier and Type | Field and Description | -| ----------------- | --------------------- | -| [UserusernameDeletePathParameters.@Nullable PathParametersMap](../../paths/userusername/delete/UserusernameDeletePathParameters.md#pathparametersmap) | pathParameters | -| [RootServerInfo.@Nullable ServerIndex](../../RootServerInfo.md#serverindex) | serverIndex | -| @Nullable Duration | timeout | - -## Delete0RequestBuilder -public static class Delete0RequestBuilder
- -a builder for request inputs - -### Constructor Summary -| Constructor and Description | -| --------------------------- | -| Delete0RequestBuilder(Delete0RequestBuilder instance)
Creates a builder that contains the passed instance | - -### Method Summary -| Modifier and Type | Method and Description | -| ----------------- | ---------------------- | -| [DeleteRequest](#deleterequest) | build()
Returns the request input used to call an endpoint method | -| [Delete0RequestBuilder](#delete0requestbuilder) | serverIndex([RootServerInfo.ServerIndex](../../RootServerInfo.md#serverindex) serverIndex)
sets the optional property. Note: this will override the value in apiConfiguration | -| [Delete0RequestBuilder](#delete0requestbuilder) | timeout(Duration timeout)
sets the optional property. Note: this will override the value in apiConfiguration | - -## DeleteRequestBuilder -public static class DeleteRequestBuilder
- -a builder for request inputs - -### Constructor Summary -| Constructor and Description | -| --------------------------- | -| DeleteRequestBuilder()
Creates a builder that contains null for all parameters | - -### Method Summary -| Modifier and Type | Method and Description | -| ----------------- | ---------------------- | -| [Delete0RequestBuilder](#delete0requestbuilder) | pathParameters([UserusernameDeletePathParametersPathParametersMap](../../paths/userusername/delete/UserusernameDeletePathParameters.md#pathparametersmap) pathParameters)
sets the property | - -[[Back to top]](#top) [[Back to README]](../../../README.md) diff --git a/samples/client/petstore/kotlin/docs/paths/userusername/UserusernameGet.md b/samples/client/petstore/kotlin/docs/paths/userusername/UserusernameGet.md deleted file mode 100644 index b0313b2f26f..00000000000 --- a/samples/client/petstore/kotlin/docs/paths/userusername/UserusernameGet.md +++ /dev/null @@ -1,196 +0,0 @@ -# UserusernameGet - -public class UserusernameGet - -A class that contains necessary endpoint classes -- a class that calls the endpoint method using the http verb -- a class that calls the endpoint method using the operationId name -- class(es) to store the request inputs -- builder(s) to set the request input data - -## Nested Class Summary -| Modifier and Type | Class and Description | -| ----------------- | --------------------- | -| static class | [Get](#get)
The class that has a get method to call the endpoint | -| interface | [GetUserByNameOperation](#getuserbynameoperation)
The interface that has a getUserByName method to call the endpoint | -| static class | [GetRequest](#getrequest)
The final request inputs class | -| static class | [GetNullableRequest](#getnullablerequest)
The initial request inputs class | -| static class | [Get0RequestBuilder](#get0requestbuilder)
A builder for the request input class | -| static class | [GetRequestBuilder](#getrequestbuilder)
A builder for the request input class | - -## Get -public static class Get extends ApiClient.ApiClient1 implements GetOperation
- -a class that allows one to call the endpoint using a method named get - -### 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.userusername.get.UserusernameGetPathParameters; -import org.openapijsonschematools.client.servers.RootServer0; -import org.openapijsonschematools.client.servers.RootServer1; -import org.openapijsonschematools.client.servers.RootServer2; -import org.openapijsonschematools.client.paths.userusername.get.responses.UserusernameGetCode200Response; -import org.openapijsonschematools.client.paths.userusername.get.responses.UserusernameGetCode400Response; -import org.openapijsonschematools.client.paths.userusername.get.responses.UserusernameGetCode404Response; -import org.openapijsonschematools.client.servers.RootServerInfo; -import org.openapijsonschematools.client.paths.userusername.UserusernameGet; -import org.openapijsonschematools.client.paths.userusername.get.UserusernameGetResponses; - -import java.io.IOException; -import java.util.Arrays; -import java.util.List; -import java.util.Map; -import java.util.AbstractMap; - -// if you want to use a server that is not SERVER_0 pass it in here and change the ServerIndex input below -ApiConfiguration.ServerInfo serverInfo = new ApiConfiguration.ServerInfoBuilder() - .rootServerInfo( - new RootServerInfo.RootServerInfoBuilder() - .rootServer0(new RootServer0()) - .build() - ) - .build(); -ApiConfiguration.ServerIndexInfo serverIndexInfo = new ApiConfiguration.ServerIndexInfoBuilder() - .rootServerInfoServerIndex(RootServerInfo.ServerIndex.SERVER_0) - .build(); -Duration timeout = Duration.ofSeconds(1L); -Map> defaultHeaders = Map.of("User-Agent", List.of("OpenAPI-JSON-Schema-Generator/1.0.0/java")); -ApiConfiguration apiConfiguration = new ApiConfiguration( - serverInfo - serverIndexInfo, - timeout, - defaultHeaders -); -SchemaConfiguration schemaConfiguration = new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().build()); -UserusernameGet.Get apiClient = new UserusernameGet.Get(apiConfiguration, schemaConfiguration); - - -// Map validation -UserusernameGetPathParameters.PathParametersMap pathParameters = - UserusernameGetPathParameters.UserusernameGetPathParameters1.validate( - new UserusernameGetPathParameters.PathParametersMapBuilder() - .username("a") - - .build(), - schemaConfiguration -); - -var request = new UserusernameGet.GetRequestBuilder() - .pathParameters(pathParameters) - .build(); - -UserusernameGetResponses.EndpointResponse response; -try { - response = apiClient.get(request); -} catch (UserusernameGetCode400Response.ResponseApiException | UserusernameGetCode404Response.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; -} -UserusernameGetResponses.EndpointUserusernameGetCode200Response castResponse = (UserusernameGetResponses.EndpointUserusernameGetCode200Response) response; -if (castResponse.body instanceof UserusernameGetCode200Response.ApplicationxmlResponseBody deserializedBody) { - // handle deserialized body here -} else { - UserusernameGetCode200Response.ApplicationjsonResponseBody deserializedBody = (UserusernameGetCode200Response.ApplicationjsonResponseBody) castResponse.body; - // handle deserialized body here -} -``` -### Constructor Summary -| Constructor and Description | -| --------------------------- | -| Get(ApiConfiguration apiConfiguration, SchemaConfiguration schemaConfiguration)
Creates an instance | - -### Method Summary -| Modifier and Type | Method and Description | -| ----------------- | ---------------------- | -| [UserusernameGetResponses.EndpointResponse](../../paths/userusername/get/UserusernameGetResponses.md#endpointresponse) | get([GetRequest](#getrequest) request) | - -## GetUserByNameOperation -public interface GetUserByNameOperation
- -an interface that allows one to call the endpoint using a method named getUserByName by the operationId - -### Method Summary -| Modifier and Type | Method and Description | -| ----------------- | ---------------------- | -| [UserusernameGetResponses.EndpointResponse](../../paths/userusername/get/UserusernameGetResponses.md#endpointresponse) | getUserByName([GetRequest](#getrequest) request) | - -## GetRequest -public static class GetRequest
- -a class that stores the final request inputs - -### Field Summary -| Modifier and Type | Field and Description | -| ----------------- | --------------------- | -| [UserusernameGetPathParameters.PathParametersMap](../../paths/userusername/get/UserusernameGetPathParameters.md#pathparametersmap) | pathParameters | -| [RootServerInfo.@Nullable ServerIndex](../../RootServerInfo.md#serverindex) | serverIndex
optional. Note: this will override the value in apiConfiguration | -| @Nullable Duration | timeout
optional. Note: this will override the value in apiConfiguration | - -## GetNullableRequest -public static class GetNullableRequest
- -a class that stores the initial request inputs - -### Field Summary -| Modifier and Type | Field and Description | -| ----------------- | --------------------- | -| [UserusernameGetPathParameters.@Nullable PathParametersMap](../../paths/userusername/get/UserusernameGetPathParameters.md#pathparametersmap) | pathParameters | -| [RootServerInfo.@Nullable ServerIndex](../../RootServerInfo.md#serverindex) | serverIndex | -| @Nullable Duration | timeout | - -## Get0RequestBuilder -public static class Get0RequestBuilder
- -a builder for request inputs - -### Constructor Summary -| Constructor and Description | -| --------------------------- | -| Get0RequestBuilder(Get0RequestBuilder instance)
Creates a builder that contains the passed instance | - -### Method Summary -| Modifier and Type | Method and Description | -| ----------------- | ---------------------- | -| [GetRequest](#getrequest) | build()
Returns the request input used to call an endpoint method | -| [Get0RequestBuilder](#get0requestbuilder) | serverIndex([RootServerInfo.ServerIndex](../../RootServerInfo.md#serverindex) serverIndex)
sets the optional property. Note: this will override the value in apiConfiguration | -| [Get0RequestBuilder](#get0requestbuilder) | timeout(Duration timeout)
sets the optional property. Note: this will override the value in apiConfiguration | - -## GetRequestBuilder -public static class GetRequestBuilder
- -a builder for request inputs - -### Constructor Summary -| Constructor and Description | -| --------------------------- | -| GetRequestBuilder()
Creates a builder that contains null for all parameters | - -### Method Summary -| Modifier and Type | Method and Description | -| ----------------- | ---------------------- | -| [Get0RequestBuilder](#get0requestbuilder) | pathParameters([UserusernameGetPathParametersPathParametersMap](../../paths/userusername/get/UserusernameGetPathParameters.md#pathparametersmap) pathParameters)
sets the property | - -[[Back to top]](#top) [[Back to README]](../../../README.md) diff --git a/samples/client/petstore/kotlin/docs/paths/userusername/UserusernamePut.md b/samples/client/petstore/kotlin/docs/paths/userusername/UserusernamePut.md deleted file mode 100644 index b8830085972..00000000000 --- a/samples/client/petstore/kotlin/docs/paths/userusername/UserusernamePut.md +++ /dev/null @@ -1,252 +0,0 @@ -# UserusernamePut - -public class UserusernamePut - -A class that contains necessary endpoint classes -- a class that calls the endpoint method using the http verb -- a class that calls the endpoint method using the operationId name -- class(es) to store the request inputs -- builder(s) to set the request input data - -## Nested Class Summary -| Modifier and Type | Class and Description | -| ----------------- | --------------------- | -| static class | [Put](#put)
The class that has a put method to call the endpoint | -| interface | [UpdateUserOperation](#updateuseroperation)
The interface that has a updateUser method to call the endpoint | -| static class | [PutRequest](#putrequest)
The final request inputs class | -| static class | [PutNullableRequest](#putnullablerequest)
The initial request inputs class | -| static class | [Put00RequestBuilder](#put00requestbuilder)
A builder for the request input class | -| static class | [Put01RequestBuilder](#put01requestbuilder)
A builder for the request input class | -| static class | [Put10RequestBuilder](#put10requestbuilder)
A builder for the request input class | -| static class | [PutRequestBuilder](#putrequestbuilder)
A builder for the request input class | - -## Put -public static class Put extends ApiClient.ApiClient1 implements PutOperation
- -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.userusername.put.UserusernamePutRequestBody; -import org.openapijsonschematools.client.components.schemas.User; -import org.openapijsonschematools.client.paths.userusername.put.UserusernamePutPathParameters; -import org.openapijsonschematools.client.servers.RootServer0; -import org.openapijsonschematools.client.servers.RootServer1; -import org.openapijsonschematools.client.servers.RootServer2; -import org.openapijsonschematools.client.paths.userusername.put.responses.UserusernamePutCode400Response; -import org.openapijsonschematools.client.paths.userusername.put.responses.UserusernamePutCode404Response; -import org.openapijsonschematools.client.servers.RootServerInfo; -import org.openapijsonschematools.client.paths.userusername.UserusernamePut; -import org.openapijsonschematools.client.paths.userusername.put.UserusernamePutResponses; - -import java.io.IOException; -import java.util.Arrays; -import java.util.List; -import java.util.Map; -import java.util.AbstractMap; - -// if you want to use a server that is not SERVER_0 pass it in here and change the ServerIndex input below -ApiConfiguration.ServerInfo serverInfo = new ApiConfiguration.ServerInfoBuilder() - .rootServerInfo( - new RootServerInfo.RootServerInfoBuilder() - .rootServer0(new RootServer0()) - .build() - ) - .build(); -ApiConfiguration.ServerIndexInfo serverIndexInfo = new ApiConfiguration.ServerIndexInfoBuilder() - .rootServerInfoServerIndex(RootServerInfo.ServerIndex.SERVER_0) - .build(); -Duration timeout = Duration.ofSeconds(1L); -Map> defaultHeaders = Map.of("User-Agent", List.of("OpenAPI-JSON-Schema-Generator/1.0.0/java")); -ApiConfiguration apiConfiguration = new ApiConfiguration( - serverInfo - serverIndexInfo, - timeout, - defaultHeaders -); -SchemaConfiguration schemaConfiguration = new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().build()); -UserusernamePut.Put apiClient = new UserusernamePut.Put(apiConfiguration, schemaConfiguration); - - -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 -); -UserusernamePut.SealedRequestBody requestBody = new UserusernamePut.ApplicationjsonRequestBody(requestBodyPayload); - -// Map validation -UserusernamePutPathParameters.PathParametersMap pathParameters = - UserusernamePutPathParameters.UserusernamePutPathParameters1.validate( - new UserusernamePutPathParameters.PathParametersMapBuilder() - .username("a") - - .build(), - schemaConfiguration -); - -var request = new UserusernamePut.PutRequestBuilder() - .requestBody(requestBody) - .pathParameters(pathParameters) - .build(); - -Nothing? response; -try { - response = apiClient.put(request); -} catch (UserusernamePutCode400Response.ResponseApiException | UserusernamePutCode404Response.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 | -| --------------------------- | -| Put(ApiConfiguration apiConfiguration, SchemaConfiguration schemaConfiguration)
Creates an instance | - -### Method Summary -| Modifier and Type | Method and Description | -| ----------------- | ---------------------- | -| Nothing? | put([PutRequest](#putrequest) request) | - -## UpdateUserOperation -public interface UpdateUserOperation
- -an interface that allows one to call the endpoint using a method named updateUser by the operationId - -### Method Summary -| Modifier and Type | Method and Description | -| ----------------- | ---------------------- | -| Nothing? | updateUser([PutRequest](#putrequest) request) | - -## PutRequest -public static class PutRequest
- -a class that stores the final request inputs - -### Field Summary -| Modifier and Type | Field and Description | -| ----------------- | --------------------- | -| [UserusernamePutRequestBody.SealedRequestBody](../../paths/userusername/put/UserusernamePutRequestBody.md#sealedrequestbody) | requestBody | -| [UserusernamePutPathParameters.PathParametersMap](../../paths/userusername/put/UserusernamePutPathParameters.md#pathparametersmap) | pathParameters | -| [RootServerInfo.@Nullable ServerIndex](../../RootServerInfo.md#serverindex) | serverIndex
optional. Note: this will override the value in apiConfiguration | -| @Nullable Duration | timeout
optional. Note: this will override the value in apiConfiguration | - -## PutNullableRequest -public static class PutNullableRequest
- -a class that stores the initial request inputs - -### Field Summary -| Modifier and Type | Field and Description | -| ----------------- | --------------------- | -| [UserusernamePutRequestBody.@Nullable SealedRequestBody](../../paths/userusername/put/UserusernamePutRequestBody.md#sealedrequestbody) | requestBody | -| [UserusernamePutPathParameters.@Nullable PathParametersMap](../../paths/userusername/put/UserusernamePutPathParameters.md#pathparametersmap) | pathParameters | -| [RootServerInfo.@Nullable ServerIndex](../../RootServerInfo.md#serverindex) | serverIndex | -| @Nullable Duration | timeout | - -## Put00RequestBuilder -public static class Put00RequestBuilder
- -a builder for request inputs - -### Constructor Summary -| Constructor and Description | -| --------------------------- | -| Put00RequestBuilder(Put00RequestBuilder instance)
Creates a builder that contains the passed instance | - -### Method Summary -| Modifier and Type | Method and Description | -| ----------------- | ---------------------- | -| [PutRequest](#putrequest) | build()
Returns the request input used to call an endpoint method | -| [Put00RequestBuilder](#put00requestbuilder) | serverIndex([RootServerInfo.ServerIndex](../../RootServerInfo.md#serverindex) serverIndex)
sets the optional property. Note: this will override the value in apiConfiguration | -| [Put00RequestBuilder](#put00requestbuilder) | timeout(Duration timeout)
sets the optional property. Note: this will override the value in apiConfiguration | - -## Put01RequestBuilder -public static class Put01RequestBuilder
- -a builder for request inputs - -### Constructor Summary -| Constructor and Description | -| --------------------------- | -| Put01RequestBuilder(Put01RequestBuilder instance)
Creates a builder that contains the passed instance | - -### Method Summary -| Modifier and Type | Method and Description | -| ----------------- | ---------------------- | -| [Put00RequestBuilder](#put00requestbuilder) | pathParameters([UserusernamePutPathParametersPathParametersMap](../../paths/userusername/put/UserusernamePutPathParameters.md#pathparametersmap) pathParameters)
sets the property | - -## Put10RequestBuilder -public static class Put10RequestBuilder
- -a builder for request inputs - -### Constructor Summary -| Constructor and Description | -| --------------------------- | -| Put10RequestBuilder(Put10RequestBuilder instance)
Creates a builder that contains the passed instance | - -### Method Summary -| Modifier and Type | Method and Description | -| ----------------- | ---------------------- | -| [Put00RequestBuilder](#put00requestbuilder) | requestBody([UserusernamePutRequestBody.SealedRequestBody](../../paths/userusername/put/UserusernamePutRequestBody.md#sealedrequestbody) requestBody)
sets the property | - -## PutRequestBuilder -public static class PutRequestBuilder
- -a builder for request inputs - -### Constructor Summary -| Constructor and Description | -| --------------------------- | -| PutRequestBuilder()
Creates a builder that contains null for all parameters | - -### Method Summary -| Modifier and Type | Method and Description | -| ----------------- | ---------------------- | -| [Put01RequestBuilder](#put01requestbuilder) | requestBody([UserusernamePutRequestBody.SealedRequestBody](../../paths/userusername/put/UserusernamePutRequestBody.md#sealedrequestbody) requestBody)
sets the property | -| [Put10RequestBuilder](#put10requestbuilder) | pathParameters([UserusernamePutPathParametersPathParametersMap](../../paths/userusername/put/UserusernamePutPathParameters.md#pathparametersmap) pathParameters)
sets the property | - -[[Back to top]](#top) [[Back to README]](../../../README.md) diff --git a/samples/client/petstore/kotlin/docs/paths/userusername/delete/UserusernameDeletePathParameters.md b/samples/client/petstore/kotlin/docs/paths/userusername/delete/UserusernameDeletePathParameters.md deleted file mode 100644 index b632f34100b..00000000000 --- a/samples/client/petstore/kotlin/docs/paths/userusername/delete/UserusernameDeletePathParameters.md +++ /dev/null @@ -1,268 +0,0 @@ -# UserusernameDeletePathParameters -public class UserusernameDeletePathParameters
- -A class that contains necessary nested -- schema classes (which validate payloads), extends JsonSchema -- sealed interfaces which store validated payloads, java version of a sum type -- boxed classes which store validated payloads, sealed permits class implementations -- classes to store validated map payloads, extends FrozenMap -- classes to build inputs for map payloads - -## Nested Class Summary -| Modifier and Type | Class and Description | -| ----------------- | ---------------------- | -| sealed interface | [UserusernameDeletePathParameters.UserusernameDeletePathParameters1Boxed](#userusernamedeletepathparameters1boxed)
sealed interface for validated payloads | -| record | [UserusernameDeletePathParameters.UserusernameDeletePathParameters1BoxedMap](#userusernamedeletepathparameters1boxedmap)
boxed class to store validated Map payloads | -| static class | [UserusernameDeletePathParameters.UserusernameDeletePathParameters1](#userusernamedeletepathparameters1)
schema class | -| static class | [UserusernameDeletePathParameters.PathParametersMapBuilder](#pathparametersmapbuilder)
builder for Map payloads | -| static class | [UserusernameDeletePathParameters.PathParametersMap](#pathparametersmap)
output class for Map payloads | -| sealed interface | [UserusernameDeletePathParameters.AdditionalPropertiesBoxed](#additionalpropertiesboxed)
sealed interface for validated payloads | -| record | [UserusernameDeletePathParameters.AdditionalPropertiesBoxedVoid](#additionalpropertiesboxedvoid)
boxed class to store validated null payloads | -| record | [UserusernameDeletePathParameters.AdditionalPropertiesBoxedBoolean](#additionalpropertiesboxedboolean)
boxed class to store validated boolean payloads | -| record | [UserusernameDeletePathParameters.AdditionalPropertiesBoxedNumber](#additionalpropertiesboxednumber)
boxed class to store validated Number payloads | -| record | [UserusernameDeletePathParameters.AdditionalPropertiesBoxedString](#additionalpropertiesboxedstring)
boxed class to store validated String payloads | -| record | [UserusernameDeletePathParameters.AdditionalPropertiesBoxedList](#additionalpropertiesboxedlist)
boxed class to store validated List payloads | -| record | [UserusernameDeletePathParameters.AdditionalPropertiesBoxedMap](#additionalpropertiesboxedmap)
boxed class to store validated Map payloads | -| static class | [UserusernameDeletePathParameters.AdditionalProperties](#additionalproperties)
schema class | - -## UserusernameDeletePathParameters1Boxed -public sealed interface UserusernameDeletePathParameters1Boxed
-permits
-[UserusernameDeletePathParameters1BoxedMap](#userusernamedeletepathparameters1boxedmap) - -sealed interface that stores validated payloads using boxed classes - -## UserusernameDeletePathParameters1BoxedMap -public record UserusernameDeletePathParameters1BoxedMap
-implements [UserusernameDeletePathParameters1Boxed](#userusernamedeletepathparameters1boxed) - -record that stores validated Map payloads, sealed permits implementation - -### Constructor Summary -| Constructor and Description | -| --------------------------- | -| UserusernameDeletePathParameters1BoxedMap([PathParametersMap](#pathparametersmap) data)
Creates an instance, private visibility | - -### Method Summary -| Modifier and Type | Method and Description | -| ----------------- | ---------------------- | -| [PathParametersMap](#pathparametersmap) | data()
validated payload | -| @Nullable Object | getData()
validated payload | - -## UserusernameDeletePathParameters1 -public static class UserusernameDeletePathParameters1
-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.userusername.delete.UserusernameDeletePathParameters; - -import java.util.Arrays; -import java.util.List; -import java.util.AbstractMap; - -static final SchemaConfiguration configuration = new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().build()); - -// Map validation -UserusernameDeletePathParameters.PathParametersMap validatedPayload = - UserusernameDeletePathParameters.UserusernameDeletePathParameters1.validate( - new UserusernameDeletePathParameters.PathParametersMapBuilder() - .username("a") - - .build(), - configuration -); -``` - -### Field Summary -| Modifier and Type | Field and Description | -| ----------------- | ---------------------- | -| Set> | type = Set.of(Map.class) | -| Map> | properties = Map.ofEntries(
    new PropertyEntry("username", [Schema.Schema1.class](../../../components/parameters/pathusername/Schema.md#schema1))
)
| -| Set | required = Set.of(
    "username"
)
| -| Class | additionalProperties = [AdditionalProperties.class](#additionalproperties) | - -### Method Summary -| Modifier and Type | Method and Description | -| ----------------- | ---------------------- | -| [PathParametersMap](#pathparametersmap) | validate([Map<?, ?>](#pathparametersmapbuilder) arg, SchemaConfiguration configuration) | -| [UserusernameDeletePathParameters1BoxedMap](#userusernamedeletepathparameters1boxedmap) | validateAndBox([Map<?, ?>](#pathparametersmapbuilder) arg, SchemaConfiguration configuration) | -| [UserusernameDeletePathParameters1Boxed](#userusernamedeletepathparameters1boxed) | validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) | -| @Nullable Object | validate(@Nullable Object arg, SchemaConfiguration configuration) | - -## PathParametersMap0Builder -public class PathParametersMap0Builder
-builder for `Map` - -A class that builds the Map input type - -### Constructor Summary -| Constructor and Description | -| --------------------------- | -| PathParametersMap0Builder(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 | - -## PathParametersMapBuilder -public class PathParametersMapBuilder
-builder for `Map` - -A class that builds the Map input type - -### Constructor Summary -| Constructor and Description | -| --------------------------- | -| PathParametersMapBuilder()
Creates a builder that contains an empty map | - -### Method Summary -| Modifier and Type | Method and Description | -| ----------------- | ---------------------- | -| [PathParametersMap0Builder](#pathparametersmap0builder) | username(String value) | - -## PathParametersMap -public static class PathParametersMap
-extends FrozenMap - -A class to store validated Map payloads - -### Method Summary -| Modifier and Type | Method and Description | -| ----------------- | ---------------------- | -| static [PathParametersMap](#pathparametersmap) | of([Map](#pathparametersmapbuilder) arg, SchemaConfiguration configuration) | -| String | username()
| - -## 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(Nothing? data)
Creates an instance, private visibility | - -### Method Summary -| Modifier and Type | Method and Description | -| ----------------- | ---------------------- | -| Nothing? | 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/kotlin/docs/paths/userusername/delete/UserusernameDeleteResponses.md b/samples/client/petstore/kotlin/docs/paths/userusername/delete/UserusernameDeleteResponses.md deleted file mode 100644 index 030157ef886..00000000000 --- a/samples/client/petstore/kotlin/docs/paths/userusername/delete/UserusernameDeleteResponses.md +++ /dev/null @@ -1,29 +0,0 @@ -# UserusernameDeleteResponses - -public class UserusernameDeleteResponses - -A class that contains necessary responses classes -- a sealed interface, EndpointResponse, that stores endpoint responses -- records for each endpoint response - -## Nested Class Summary -| Modifier and Type | Class and Description | -| ----------------- | --------------------- | -| sealed interface | [EndpointResponse](#endpointresponse)
stores the endpoint responses | -| record | [EndpointUserusernameDeleteCode200Response](#endpointuserusernamedeletecode200response)
the response for 200 | - -## EndpointResponse -public sealed interface EndpointResponse permits
-[EndpointUserusernameDeleteCode200Response](#endpointuserusernamedeletecode200response) - -a sealed interface that stores endpoint responses - -## EndpointUserusernameDeleteCode200Response -public record EndpointUserusernameDeleteCode200Response( - HttpResponse response, - Nothing? body, - Nothing? headers -) implements EndpointResponse, ApiResponse
- -a class that stores an endpoint response - diff --git a/samples/client/petstore/kotlin/docs/paths/userusername/delete/responses/UserusernameDeleteCode200Response.md b/samples/client/petstore/kotlin/docs/paths/userusername/delete/responses/UserusernameDeleteCode200Response.md deleted file mode 100644 index bf7c6aee09d..00000000000 --- a/samples/client/petstore/kotlin/docs/paths/userusername/delete/responses/UserusernameDeleteCode200Response.md +++ /dev/null @@ -1,17 +0,0 @@ -# UserusernameDeleteCode200Response - -public class UserusernameDeleteCode200Response extends [SuccessDescriptionOnly](../../components/responses/SuccessDescriptionOnly.md) - -A class (extended from the $ref class) that contains necessary nested response classes -- a class that extends ResponseDeserializer and is used to deserialize responses - -## Nested Class Summary -| Modifier and Type | Class and Description | -| ----------------- | --------------------- | -| static class | [UserusernameDeleteCode200Response.UserusernameDeleteCode200Response1](#userusernamedeletecode200response1)
class that deserializes responses | - -## UserusernameDeleteCode200Response1 -public static class UserusernameDeleteCode200Response1 extends [SuccessDescriptionOnly1](../../components/responses/SuccessDescriptionOnly.md#successdescriptiononly1)
- -a class that deserializes responses, extended from the $ref class - diff --git a/samples/client/petstore/kotlin/docs/paths/userusername/delete/responses/UserusernameDeleteCode404Response.md b/samples/client/petstore/kotlin/docs/paths/userusername/delete/responses/UserusernameDeleteCode404Response.md deleted file mode 100644 index a467362d7d0..00000000000 --- a/samples/client/petstore/kotlin/docs/paths/userusername/delete/responses/UserusernameDeleteCode404Response.md +++ /dev/null @@ -1,32 +0,0 @@ -# UserusernameDeleteCode404Response - -public class UserusernameDeleteCode404Response - -A class that contains necessary nested response classes -- a class that extends ResponseDeserializer and is used to deserialize responses - -## Nested Class Summary -| Modifier and Type | Class and Description | -| ----------------- | --------------------- | -| static class | [UserusernameDeleteCode404Response.UserusernameDeleteCode404Response1](#userusernamedeletecode404response1)
class that deserializes responses | - -## UserusernameDeleteCode404Response1 -public static class UserusernameDeleteCode404Response1
-extends ResponseDeserializer - -a class that deserializes responses - -### Constructor Summary -| Constructor and Description | -| --------------------------- | -| UserusernameDeleteCode404Response1()
Creates an instance | - -### Field Summary -| Modifier and Type | Field and Description | -| ----------------- | --------------------- | -| Map | content = MapUtils.makeMap(
)
the contentType to schema info | - -### Method Summary -| Modifier and Type | Method and Description | -| ----------------- | ---------------------- | -| ApiResponse | deserialize(HttpResponse response, SchemaConfiguration configuration)
called by endpoint when deserialize responses | diff --git a/samples/client/petstore/kotlin/docs/paths/userusername/get/UserusernameGetPathParameters.md b/samples/client/petstore/kotlin/docs/paths/userusername/get/UserusernameGetPathParameters.md deleted file mode 100644 index 6b6f65cf799..00000000000 --- a/samples/client/petstore/kotlin/docs/paths/userusername/get/UserusernameGetPathParameters.md +++ /dev/null @@ -1,268 +0,0 @@ -# UserusernameGetPathParameters -public class UserusernameGetPathParameters
- -A class that contains necessary nested -- schema classes (which validate payloads), extends JsonSchema -- sealed interfaces which store validated payloads, java version of a sum type -- boxed classes which store validated payloads, sealed permits class implementations -- classes to store validated map payloads, extends FrozenMap -- classes to build inputs for map payloads - -## Nested Class Summary -| Modifier and Type | Class and Description | -| ----------------- | ---------------------- | -| sealed interface | [UserusernameGetPathParameters.UserusernameGetPathParameters1Boxed](#userusernamegetpathparameters1boxed)
sealed interface for validated payloads | -| record | [UserusernameGetPathParameters.UserusernameGetPathParameters1BoxedMap](#userusernamegetpathparameters1boxedmap)
boxed class to store validated Map payloads | -| static class | [UserusernameGetPathParameters.UserusernameGetPathParameters1](#userusernamegetpathparameters1)
schema class | -| static class | [UserusernameGetPathParameters.PathParametersMapBuilder](#pathparametersmapbuilder)
builder for Map payloads | -| static class | [UserusernameGetPathParameters.PathParametersMap](#pathparametersmap)
output class for Map payloads | -| sealed interface | [UserusernameGetPathParameters.AdditionalPropertiesBoxed](#additionalpropertiesboxed)
sealed interface for validated payloads | -| record | [UserusernameGetPathParameters.AdditionalPropertiesBoxedVoid](#additionalpropertiesboxedvoid)
boxed class to store validated null payloads | -| record | [UserusernameGetPathParameters.AdditionalPropertiesBoxedBoolean](#additionalpropertiesboxedboolean)
boxed class to store validated boolean payloads | -| record | [UserusernameGetPathParameters.AdditionalPropertiesBoxedNumber](#additionalpropertiesboxednumber)
boxed class to store validated Number payloads | -| record | [UserusernameGetPathParameters.AdditionalPropertiesBoxedString](#additionalpropertiesboxedstring)
boxed class to store validated String payloads | -| record | [UserusernameGetPathParameters.AdditionalPropertiesBoxedList](#additionalpropertiesboxedlist)
boxed class to store validated List payloads | -| record | [UserusernameGetPathParameters.AdditionalPropertiesBoxedMap](#additionalpropertiesboxedmap)
boxed class to store validated Map payloads | -| static class | [UserusernameGetPathParameters.AdditionalProperties](#additionalproperties)
schema class | - -## UserusernameGetPathParameters1Boxed -public sealed interface UserusernameGetPathParameters1Boxed
-permits
-[UserusernameGetPathParameters1BoxedMap](#userusernamegetpathparameters1boxedmap) - -sealed interface that stores validated payloads using boxed classes - -## UserusernameGetPathParameters1BoxedMap -public record UserusernameGetPathParameters1BoxedMap
-implements [UserusernameGetPathParameters1Boxed](#userusernamegetpathparameters1boxed) - -record that stores validated Map payloads, sealed permits implementation - -### Constructor Summary -| Constructor and Description | -| --------------------------- | -| UserusernameGetPathParameters1BoxedMap([PathParametersMap](#pathparametersmap) data)
Creates an instance, private visibility | - -### Method Summary -| Modifier and Type | Method and Description | -| ----------------- | ---------------------- | -| [PathParametersMap](#pathparametersmap) | data()
validated payload | -| @Nullable Object | getData()
validated payload | - -## UserusernameGetPathParameters1 -public static class UserusernameGetPathParameters1
-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.userusername.get.UserusernameGetPathParameters; - -import java.util.Arrays; -import java.util.List; -import java.util.AbstractMap; - -static final SchemaConfiguration configuration = new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().build()); - -// Map validation -UserusernameGetPathParameters.PathParametersMap validatedPayload = - UserusernameGetPathParameters.UserusernameGetPathParameters1.validate( - new UserusernameGetPathParameters.PathParametersMapBuilder() - .username("a") - - .build(), - configuration -); -``` - -### Field Summary -| Modifier and Type | Field and Description | -| ----------------- | ---------------------- | -| Set> | type = Set.of(Map.class) | -| Map> | properties = Map.ofEntries(
    new PropertyEntry("username", [Schema.Schema1.class](../../../components/parameters/pathusername/Schema.md#schema1))
)
| -| Set | required = Set.of(
    "username"
)
| -| Class | additionalProperties = [AdditionalProperties.class](#additionalproperties) | - -### Method Summary -| Modifier and Type | Method and Description | -| ----------------- | ---------------------- | -| [PathParametersMap](#pathparametersmap) | validate([Map<?, ?>](#pathparametersmapbuilder) arg, SchemaConfiguration configuration) | -| [UserusernameGetPathParameters1BoxedMap](#userusernamegetpathparameters1boxedmap) | validateAndBox([Map<?, ?>](#pathparametersmapbuilder) arg, SchemaConfiguration configuration) | -| [UserusernameGetPathParameters1Boxed](#userusernamegetpathparameters1boxed) | validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) | -| @Nullable Object | validate(@Nullable Object arg, SchemaConfiguration configuration) | - -## PathParametersMap0Builder -public class PathParametersMap0Builder
-builder for `Map` - -A class that builds the Map input type - -### Constructor Summary -| Constructor and Description | -| --------------------------- | -| PathParametersMap0Builder(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 | - -## PathParametersMapBuilder -public class PathParametersMapBuilder
-builder for `Map` - -A class that builds the Map input type - -### Constructor Summary -| Constructor and Description | -| --------------------------- | -| PathParametersMapBuilder()
Creates a builder that contains an empty map | - -### Method Summary -| Modifier and Type | Method and Description | -| ----------------- | ---------------------- | -| [PathParametersMap0Builder](#pathparametersmap0builder) | username(String value) | - -## PathParametersMap -public static class PathParametersMap
-extends FrozenMap - -A class to store validated Map payloads - -### Method Summary -| Modifier and Type | Method and Description | -| ----------------- | ---------------------- | -| static [PathParametersMap](#pathparametersmap) | of([Map](#pathparametersmapbuilder) arg, SchemaConfiguration configuration) | -| String | username()
| - -## 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(Nothing? data)
Creates an instance, private visibility | - -### Method Summary -| Modifier and Type | Method and Description | -| ----------------- | ---------------------- | -| Nothing? | 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/kotlin/docs/paths/userusername/get/UserusernameGetResponses.md b/samples/client/petstore/kotlin/docs/paths/userusername/get/UserusernameGetResponses.md deleted file mode 100644 index 4e86dca325f..00000000000 --- a/samples/client/petstore/kotlin/docs/paths/userusername/get/UserusernameGetResponses.md +++ /dev/null @@ -1,29 +0,0 @@ -# UserusernameGetResponses - -public class UserusernameGetResponses - -A class that contains necessary responses classes -- a sealed interface, EndpointResponse, that stores endpoint responses -- records for each endpoint response - -## Nested Class Summary -| Modifier and Type | Class and Description | -| ----------------- | --------------------- | -| sealed interface | [EndpointResponse](#endpointresponse)
stores the endpoint responses | -| record | [EndpointUserusernameGetCode200Response](#endpointuserusernamegetcode200response)
the response for 200 | - -## EndpointResponse -public sealed interface EndpointResponse permits
-[EndpointUserusernameGetCode200Response](#endpointuserusernamegetcode200response) - -a sealed interface that stores endpoint responses - -## EndpointUserusernameGetCode200Response -public record EndpointUserusernameGetCode200Response( - HttpResponse response, - [UserusernameGetCode200Response.SealedResponseBody](../../../paths/userusername/get/responses/UserusernameGetCode200Response.md#sealedresponsebody) body, - Nothing? headers -) implements EndpointResponse, ApiResponse
- -a class that stores an endpoint response - diff --git a/samples/client/petstore/kotlin/docs/paths/userusername/get/responses/UserusernameGetCode200Response.md b/samples/client/petstore/kotlin/docs/paths/userusername/get/responses/UserusernameGetCode200Response.md deleted file mode 100644 index 6436e92af14..00000000000 --- a/samples/client/petstore/kotlin/docs/paths/userusername/get/responses/UserusernameGetCode200Response.md +++ /dev/null @@ -1,123 +0,0 @@ -# UserusernameGetCode200Response - -public class UserusernameGetCode200Response - -A class that contains necessary nested response classes -- SealedMediaType, a sealed interface which contains all the schema/encoding info for each contentType -- records which implement SealedMediaType, the concrete media types -- SealedResponseBody, a sealed interface which contains all the contentType/schema types -- records which implement SealedResponseBody, the concrete response body types -- a class that extends ResponseDeserializer and is used to deserialize responses - -## Nested Class Summary -| Modifier and Type | Class and Description | -| ----------------- | --------------------- | -| sealed interface | [UserusernameGetCode200Response.SealedMediaType](#sealedmediatype)
media type sealed interface | -| record | [UserusernameGetCode200Response.ApplicationxmlMediaType](#applicationxmlmediatype)
record storing schema + encoding for a specific contentType | -| record | [UserusernameGetCode200Response.ApplicationjsonMediaType](#applicationjsonmediatype)
record storing schema + encoding for a specific contentType | -| sealed interface | [UserusernameGetCode200Response.SealedResponseBody](#sealedresponsebody)
response body sealed interface | -| record | [UserusernameGetCode200Response.ApplicationxmlResponseBody](#applicationxmlresponsebody)
implements sealed interface to store response body | -| record | [UserusernameGetCode200Response.ApplicationjsonResponseBody](#applicationjsonresponsebody)
implements sealed interface to store response body | -| static class | [UserusernameGetCode200Response.UserusernameGetCode200Response1](#userusernamegetcode200response1)
class that deserializes responses | - -## SealedMediaType -public sealed interface SealedMediaType
-permits
-[ApplicationxmlMediaType](#applicationxmlmediatype), -[ApplicationjsonMediaType](#applicationjsonmediatype) - -sealed interface that stores schema and encoding info - -## ApplicationxmlMediaType -public record ApplicationxmlMediaType
-implements [SealedMediaType](#sealedmediatype), MediaType<[ApplicationxmlSchema.ApplicationxmlSchema1](../../../../paths/userusername/get/responses/code200response/content/applicationxml/ApplicationxmlSchema.md#applicationxmlschema1), Nothing?> - -class storing schema info for a specific contentType - -### Constructor Summary -| Constructor and Description | -| --------------------------- | -| ApplicationxmlMediaType()
Creates an instance | - -### Method Summary -| Modifier and Type | Method and Description | -| ----------------- | ---------------------- | -| [ApplicationxmlSchema.ApplicationxmlSchema1](../../../../paths/userusername/get/responses/code200response/content/applicationxml/ApplicationxmlSchema.md#applicationxmlschema1) | schema()
the schema for this MediaType | -| Nothing? | encoding()
the encoding info | - -## ApplicationjsonMediaType -public record ApplicationjsonMediaType
-implements [SealedMediaType](#sealedmediatype), MediaType<[ApplicationjsonSchema.ApplicationjsonSchema1](../../../../paths/userusername/get/responses/code200response/content/applicationjson/ApplicationjsonSchema.md#applicationjsonschema1), Nothing?> - -class storing schema info for a specific contentType - -### Constructor Summary -| Constructor and Description | -| --------------------------- | -| ApplicationjsonMediaType()
Creates an instance | - -### Method Summary -| Modifier and Type | Method and Description | -| ----------------- | ---------------------- | -| [ApplicationjsonSchema.ApplicationjsonSchema1](../../../../paths/userusername/get/responses/code200response/content/applicationjson/ApplicationjsonSchema.md#applicationjsonschema1) | schema()
the schema for this MediaType | -| Nothing? | encoding()
the encoding info | - -## SealedResponseBody -public sealed interface SealedResponseBody
-permits
-[ApplicationxmlResponseBody](#applicationxmlresponsebody), -[ApplicationjsonResponseBody](#applicationjsonresponsebody) - -sealed interface that stores response body - -## ApplicationxmlResponseBody -public record ApplicationxmlResponseBody
-implements [SealedResponseBody](#sealedresponsebody) - -A record class to store response body for contentType="application/xml" - -### Constructor Summary -| Constructor and Description | -| --------------------------- | -| ApplicationxmlResponseBody(ApplicationxmlSchema.[User1Boxed](../../../../components/schemas/User.md#user1boxed) body)
Creates an instance | - -### Method Summary -| Modifier and Type | Method and Description | -| ----------------- | ---------------------- | -| ApplicationxmlSchema.[User1Boxed](../../../../components/schemas/User.md#user1boxed) | body()
returns the body passed in in the constructor | -## ApplicationjsonResponseBody -public record ApplicationjsonResponseBody
-implements [SealedResponseBody](#sealedresponsebody) - -A record class to store response body for contentType="application/json" - -### Constructor Summary -| Constructor and Description | -| --------------------------- | -| ApplicationjsonResponseBody(ApplicationjsonSchema.[User1Boxed](../../../../components/schemas/User.md#user1boxed) body)
Creates an instance | - -### Method Summary -| Modifier and Type | Method and Description | -| ----------------- | ---------------------- | -| ApplicationjsonSchema.[User1Boxed](../../../../components/schemas/User.md#user1boxed) | body()
returns the body passed in in the constructor | - -## UserusernameGetCode200Response1 -public static class UserusernameGetCode200Response1
-extends ResponseDeserializer<[SealedResponseBody](#sealedresponsebody), Nothing?, [SealedMediaType](#sealedmediatype)> - -a class that deserializes responses - -### Constructor Summary -| Constructor and Description | -| --------------------------- | -| UserusernameGetCode200Response1()
Creates an instance | - -### Field Summary -| Modifier and Type | Field and Description | -| ----------------- | --------------------- | -| Map | content = Map.ofEntries(
    new AbstractMap.SimpleEntry<>("application/xml", new [ApplicationxmlMediaType](#applicationxmlmediatype)()),
    new AbstractMap.SimpleEntry<>("application/json", new [ApplicationjsonMediaType](#applicationjsonmediatype)())
)
the contentType to schema info | - -### Method Summary -| Modifier and Type | Method and Description | -| ----------------- | ---------------------- | -| ApiResponse<[SealedResponseBody](#sealedresponsebody), Nothing?> | deserialize(HttpResponse response, SchemaConfiguration configuration)
called by endpoint when deserialize responses | diff --git a/samples/client/petstore/kotlin/docs/paths/userusername/get/responses/UserusernameGetCode400Response.md b/samples/client/petstore/kotlin/docs/paths/userusername/get/responses/UserusernameGetCode400Response.md deleted file mode 100644 index cd71d6f9d39..00000000000 --- a/samples/client/petstore/kotlin/docs/paths/userusername/get/responses/UserusernameGetCode400Response.md +++ /dev/null @@ -1,32 +0,0 @@ -# UserusernameGetCode400Response - -public class UserusernameGetCode400Response - -A class that contains necessary nested response classes -- a class that extends ResponseDeserializer and is used to deserialize responses - -## Nested Class Summary -| Modifier and Type | Class and Description | -| ----------------- | --------------------- | -| static class | [UserusernameGetCode400Response.UserusernameGetCode400Response1](#userusernamegetcode400response1)
class that deserializes responses | - -## UserusernameGetCode400Response1 -public static class UserusernameGetCode400Response1
-extends ResponseDeserializer - -a class that deserializes responses - -### Constructor Summary -| Constructor and Description | -| --------------------------- | -| UserusernameGetCode400Response1()
Creates an instance | - -### Field Summary -| Modifier and Type | Field and Description | -| ----------------- | --------------------- | -| Map | content = MapUtils.makeMap(
)
the contentType to schema info | - -### Method Summary -| Modifier and Type | Method and Description | -| ----------------- | ---------------------- | -| ApiResponse | deserialize(HttpResponse response, SchemaConfiguration configuration)
called by endpoint when deserialize responses | diff --git a/samples/client/petstore/kotlin/docs/paths/userusername/get/responses/UserusernameGetCode404Response.md b/samples/client/petstore/kotlin/docs/paths/userusername/get/responses/UserusernameGetCode404Response.md deleted file mode 100644 index d7ae0ed42b4..00000000000 --- a/samples/client/petstore/kotlin/docs/paths/userusername/get/responses/UserusernameGetCode404Response.md +++ /dev/null @@ -1,32 +0,0 @@ -# UserusernameGetCode404Response - -public class UserusernameGetCode404Response - -A class that contains necessary nested response classes -- a class that extends ResponseDeserializer and is used to deserialize responses - -## Nested Class Summary -| Modifier and Type | Class and Description | -| ----------------- | --------------------- | -| static class | [UserusernameGetCode404Response.UserusernameGetCode404Response1](#userusernamegetcode404response1)
class that deserializes responses | - -## UserusernameGetCode404Response1 -public static class UserusernameGetCode404Response1
-extends ResponseDeserializer - -a class that deserializes responses - -### Constructor Summary -| Constructor and Description | -| --------------------------- | -| UserusernameGetCode404Response1()
Creates an instance | - -### Field Summary -| Modifier and Type | Field and Description | -| ----------------- | --------------------- | -| Map | content = MapUtils.makeMap(
)
the contentType to schema info | - -### Method Summary -| Modifier and Type | Method and Description | -| ----------------- | ---------------------- | -| ApiResponse | deserialize(HttpResponse response, SchemaConfiguration configuration)
called by endpoint when deserialize responses | diff --git a/samples/client/petstore/kotlin/docs/paths/userusername/get/responses/code200response/content/applicationjson/ApplicationjsonSchema.md b/samples/client/petstore/kotlin/docs/paths/userusername/get/responses/code200response/content/applicationjson/ApplicationjsonSchema.md deleted file mode 100644 index 3433b43b8a4..00000000000 --- a/samples/client/petstore/kotlin/docs/paths/userusername/get/responses/code200response/content/applicationjson/ApplicationjsonSchema.md +++ /dev/null @@ -1,19 +0,0 @@ -# ApplicationjsonSchema -public class ApplicationjsonSchema
-extends [User1](../../../../../../../components/schemas/User.md#user) - -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 - -## Nested Class Summary -| Modifier and Type | Class and Description | -| ----------------- | ---------------------- | -| static class | [ApplicationjsonSchema.ApplicationjsonSchema1](#applicationjsonschema1)
schema class | - -## ApplicationjsonSchema1 -public static class ApplicationjsonSchema1
-extends [User.User1](../../../../../../../components/schemas/User.md#user1) - -A schema class that validates payloads diff --git a/samples/client/petstore/kotlin/docs/paths/userusername/get/responses/code200response/content/applicationxml/ApplicationxmlSchema.md b/samples/client/petstore/kotlin/docs/paths/userusername/get/responses/code200response/content/applicationxml/ApplicationxmlSchema.md deleted file mode 100644 index b5aa20f221c..00000000000 --- a/samples/client/petstore/kotlin/docs/paths/userusername/get/responses/code200response/content/applicationxml/ApplicationxmlSchema.md +++ /dev/null @@ -1,19 +0,0 @@ -# ApplicationxmlSchema -public class ApplicationxmlSchema
-extends [User1](../../../../../../../components/schemas/User.md#user) - -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 - -## Nested Class Summary -| Modifier and Type | Class and Description | -| ----------------- | ---------------------- | -| static class | [ApplicationxmlSchema.ApplicationxmlSchema1](#applicationxmlschema1)
schema class | - -## ApplicationxmlSchema1 -public static class ApplicationxmlSchema1
-extends [User.User1](../../../../../../../components/schemas/User.md#user1) - -A schema class that validates payloads diff --git a/samples/client/petstore/kotlin/docs/paths/userusername/put/UserusernamePutPathParameters.md b/samples/client/petstore/kotlin/docs/paths/userusername/put/UserusernamePutPathParameters.md deleted file mode 100644 index a3a3e58336e..00000000000 --- a/samples/client/petstore/kotlin/docs/paths/userusername/put/UserusernamePutPathParameters.md +++ /dev/null @@ -1,268 +0,0 @@ -# UserusernamePutPathParameters -public class UserusernamePutPathParameters
- -A class that contains necessary nested -- schema classes (which validate payloads), extends JsonSchema -- sealed interfaces which store validated payloads, java version of a sum type -- boxed classes which store validated payloads, sealed permits class implementations -- classes to store validated map payloads, extends FrozenMap -- classes to build inputs for map payloads - -## Nested Class Summary -| Modifier and Type | Class and Description | -| ----------------- | ---------------------- | -| sealed interface | [UserusernamePutPathParameters.UserusernamePutPathParameters1Boxed](#userusernameputpathparameters1boxed)
sealed interface for validated payloads | -| record | [UserusernamePutPathParameters.UserusernamePutPathParameters1BoxedMap](#userusernameputpathparameters1boxedmap)
boxed class to store validated Map payloads | -| static class | [UserusernamePutPathParameters.UserusernamePutPathParameters1](#userusernameputpathparameters1)
schema class | -| static class | [UserusernamePutPathParameters.PathParametersMapBuilder](#pathparametersmapbuilder)
builder for Map payloads | -| static class | [UserusernamePutPathParameters.PathParametersMap](#pathparametersmap)
output class for Map payloads | -| sealed interface | [UserusernamePutPathParameters.AdditionalPropertiesBoxed](#additionalpropertiesboxed)
sealed interface for validated payloads | -| record | [UserusernamePutPathParameters.AdditionalPropertiesBoxedVoid](#additionalpropertiesboxedvoid)
boxed class to store validated null payloads | -| record | [UserusernamePutPathParameters.AdditionalPropertiesBoxedBoolean](#additionalpropertiesboxedboolean)
boxed class to store validated boolean payloads | -| record | [UserusernamePutPathParameters.AdditionalPropertiesBoxedNumber](#additionalpropertiesboxednumber)
boxed class to store validated Number payloads | -| record | [UserusernamePutPathParameters.AdditionalPropertiesBoxedString](#additionalpropertiesboxedstring)
boxed class to store validated String payloads | -| record | [UserusernamePutPathParameters.AdditionalPropertiesBoxedList](#additionalpropertiesboxedlist)
boxed class to store validated List payloads | -| record | [UserusernamePutPathParameters.AdditionalPropertiesBoxedMap](#additionalpropertiesboxedmap)
boxed class to store validated Map payloads | -| static class | [UserusernamePutPathParameters.AdditionalProperties](#additionalproperties)
schema class | - -## UserusernamePutPathParameters1Boxed -public sealed interface UserusernamePutPathParameters1Boxed
-permits
-[UserusernamePutPathParameters1BoxedMap](#userusernameputpathparameters1boxedmap) - -sealed interface that stores validated payloads using boxed classes - -## UserusernamePutPathParameters1BoxedMap -public record UserusernamePutPathParameters1BoxedMap
-implements [UserusernamePutPathParameters1Boxed](#userusernameputpathparameters1boxed) - -record that stores validated Map payloads, sealed permits implementation - -### Constructor Summary -| Constructor and Description | -| --------------------------- | -| UserusernamePutPathParameters1BoxedMap([PathParametersMap](#pathparametersmap) data)
Creates an instance, private visibility | - -### Method Summary -| Modifier and Type | Method and Description | -| ----------------- | ---------------------- | -| [PathParametersMap](#pathparametersmap) | data()
validated payload | -| @Nullable Object | getData()
validated payload | - -## UserusernamePutPathParameters1 -public static class UserusernamePutPathParameters1
-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.userusername.put.UserusernamePutPathParameters; - -import java.util.Arrays; -import java.util.List; -import java.util.AbstractMap; - -static final SchemaConfiguration configuration = new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().build()); - -// Map validation -UserusernamePutPathParameters.PathParametersMap validatedPayload = - UserusernamePutPathParameters.UserusernamePutPathParameters1.validate( - new UserusernamePutPathParameters.PathParametersMapBuilder() - .username("a") - - .build(), - configuration -); -``` - -### Field Summary -| Modifier and Type | Field and Description | -| ----------------- | ---------------------- | -| Set> | type = Set.of(Map.class) | -| Map> | properties = Map.ofEntries(
    new PropertyEntry("username", [Schema.Schema1.class](../../../components/parameters/pathusername/Schema.md#schema1))
)
| -| Set | required = Set.of(
    "username"
)
| -| Class | additionalProperties = [AdditionalProperties.class](#additionalproperties) | - -### Method Summary -| Modifier and Type | Method and Description | -| ----------------- | ---------------------- | -| [PathParametersMap](#pathparametersmap) | validate([Map<?, ?>](#pathparametersmapbuilder) arg, SchemaConfiguration configuration) | -| [UserusernamePutPathParameters1BoxedMap](#userusernameputpathparameters1boxedmap) | validateAndBox([Map<?, ?>](#pathparametersmapbuilder) arg, SchemaConfiguration configuration) | -| [UserusernamePutPathParameters1Boxed](#userusernameputpathparameters1boxed) | validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) | -| @Nullable Object | validate(@Nullable Object arg, SchemaConfiguration configuration) | - -## PathParametersMap0Builder -public class PathParametersMap0Builder
-builder for `Map` - -A class that builds the Map input type - -### Constructor Summary -| Constructor and Description | -| --------------------------- | -| PathParametersMap0Builder(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 | - -## PathParametersMapBuilder -public class PathParametersMapBuilder
-builder for `Map` - -A class that builds the Map input type - -### Constructor Summary -| Constructor and Description | -| --------------------------- | -| PathParametersMapBuilder()
Creates a builder that contains an empty map | - -### Method Summary -| Modifier and Type | Method and Description | -| ----------------- | ---------------------- | -| [PathParametersMap0Builder](#pathparametersmap0builder) | username(String value) | - -## PathParametersMap -public static class PathParametersMap
-extends FrozenMap - -A class to store validated Map payloads - -### Method Summary -| Modifier and Type | Method and Description | -| ----------------- | ---------------------- | -| static [PathParametersMap](#pathparametersmap) | of([Map](#pathparametersmapbuilder) arg, SchemaConfiguration configuration) | -| String | username()
| - -## 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(Nothing? data)
Creates an instance, private visibility | - -### Method Summary -| Modifier and Type | Method and Description | -| ----------------- | ---------------------- | -| Nothing? | 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/kotlin/docs/paths/userusername/put/UserusernamePutRequestBody.md b/samples/client/petstore/kotlin/docs/paths/userusername/put/UserusernamePutRequestBody.md deleted file mode 100644 index 5712e2d3fa7..00000000000 --- a/samples/client/petstore/kotlin/docs/paths/userusername/put/UserusernamePutRequestBody.md +++ /dev/null @@ -1,90 +0,0 @@ -# UserusernamePutRequestBody - -public class UserusernamePutRequestBody - -A class that contains necessary nested request body classes -- SealedMediaType, a sealed interface which contains all the schema/encoding info for each contentType -- records which implement SealedMediaType, the concrete media types -- a class that extends RequestBodySerializer and is used to serialize input SealedRequestBody instances -- SealedRequestBody, a sealed interface which contains all the contentType/schema input types -- records which implement SealedRequestBody, the concrete request body types - -## Nested Class Summary -| Modifier and Type | Class and Description | -| ----------------- | --------------------- | -| sealed interface | [UserusernamePutRequestBody.SealedMediaType](#sealedmediatype)
media type sealed interface | -| record | [UserusernamePutRequestBody.ApplicationjsonMediaType](#applicationjsonmediatype)
record storing schema + encoding for a specific contentType | -| static class | [UserusernamePutRequestBody.UserusernamePutRequestBody1](#userusernameputrequestbody1)
class that serializes request bodies | -| sealed interface | [UserusernamePutRequestBody.SealedRequestBody](#sealedrequestbody)
request body sealed interface | -| record | [UserusernamePutRequestBody.ApplicationjsonRequestBody](#applicationjsonrequestbody)
implements sealed interface to store request body input | - -## SealedMediaType -public sealed interface SealedMediaType
-permits
-[ApplicationjsonMediaType](#applicationjsonmediatype) - -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), Nothing?> - -class storing schema info for a specific contentType - -### Constructor Summary -| Constructor and Description | -| --------------------------- | -| ApplicationjsonMediaType()
Creates an instance | - -### 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 | -| Nothing? | encoding()
the encoding info | - -## UserusernamePutRequestBody1 -public static class UserusernamePutRequestBody1
- -a class that serializes SealedRequestBody request bodies - -### Constructor Summary -| Constructor and Description | -| --------------------------- | -| UserusernamePutRequestBody1()
Creates an instance | - -### Field Summary -| Modifier and Type | Field and Description | -| ----------------- | --------------------- | -| boolean | required = true
whether the request body is required | -| 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 | -| ----------------- | ---------------------- | -| SerializedRequestBody | serialize([SealedRequestBody](#sealedrequestbody) requestBody)
called by endpoint when creating request body bytes | - -## SealedRequestBody -public sealed interface SealedRequestBody
-permits
-[ApplicationjsonRequestBody](#applicationjsonrequestbody) - -sealed interface that stores request contentType + validated schema data - -## ApplicationjsonRequestBody -public record ApplicationjsonRequestBody
-implements [SealedRequestBody](#sealedrequestbody),
-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 | - -### 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 | diff --git a/samples/client/petstore/kotlin/docs/paths/userusername/put/UserusernamePutResponses.md b/samples/client/petstore/kotlin/docs/paths/userusername/put/UserusernamePutResponses.md deleted file mode 100644 index 13a79a9fefe..00000000000 --- a/samples/client/petstore/kotlin/docs/paths/userusername/put/UserusernamePutResponses.md +++ /dev/null @@ -1,10 +0,0 @@ -# UserusernamePutResponses - -public class UserusernamePutResponses - -A class that contains necessary responses classes - -## Nested Class Summary -| Modifier and Type | Class and Description | -| ----------------- | --------------------- | - diff --git a/samples/client/petstore/kotlin/docs/paths/userusername/put/requestbody/content/applicationjson/ApplicationjsonSchema.md b/samples/client/petstore/kotlin/docs/paths/userusername/put/requestbody/content/applicationjson/ApplicationjsonSchema.md deleted file mode 100644 index 87ec51870cc..00000000000 --- a/samples/client/petstore/kotlin/docs/paths/userusername/put/requestbody/content/applicationjson/ApplicationjsonSchema.md +++ /dev/null @@ -1,19 +0,0 @@ -# ApplicationjsonSchema -public class ApplicationjsonSchema
-extends [User1](../../../../../../components/schemas/User.md#user) - -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 - -## Nested Class Summary -| Modifier and Type | Class and Description | -| ----------------- | ---------------------- | -| static class | [ApplicationjsonSchema.ApplicationjsonSchema1](#applicationjsonschema1)
schema class | - -## ApplicationjsonSchema1 -public static class ApplicationjsonSchema1
-extends [User.User1](../../../../../../components/schemas/User.md#user1) - -A schema class that validates payloads diff --git a/samples/client/petstore/kotlin/docs/paths/userusername/put/responses/UserusernamePutCode400Response.md b/samples/client/petstore/kotlin/docs/paths/userusername/put/responses/UserusernamePutCode400Response.md deleted file mode 100644 index ae52ec6d807..00000000000 --- a/samples/client/petstore/kotlin/docs/paths/userusername/put/responses/UserusernamePutCode400Response.md +++ /dev/null @@ -1,32 +0,0 @@ -# UserusernamePutCode400Response - -public class UserusernamePutCode400Response - -A class that contains necessary nested response classes -- a class that extends ResponseDeserializer and is used to deserialize responses - -## Nested Class Summary -| Modifier and Type | Class and Description | -| ----------------- | --------------------- | -| static class | [UserusernamePutCode400Response.UserusernamePutCode400Response1](#userusernameputcode400response1)
class that deserializes responses | - -## UserusernamePutCode400Response1 -public static class UserusernamePutCode400Response1
-extends ResponseDeserializer - -a class that deserializes responses - -### Constructor Summary -| Constructor and Description | -| --------------------------- | -| UserusernamePutCode400Response1()
Creates an instance | - -### Field Summary -| Modifier and Type | Field and Description | -| ----------------- | --------------------- | -| Map | content = MapUtils.makeMap(
)
the contentType to schema info | - -### Method Summary -| Modifier and Type | Method and Description | -| ----------------- | ---------------------- | -| ApiResponse | deserialize(HttpResponse response, SchemaConfiguration configuration)
called by endpoint when deserialize responses | diff --git a/samples/client/petstore/kotlin/docs/paths/userusername/put/responses/UserusernamePutCode404Response.md b/samples/client/petstore/kotlin/docs/paths/userusername/put/responses/UserusernamePutCode404Response.md deleted file mode 100644 index b696e708667..00000000000 --- a/samples/client/petstore/kotlin/docs/paths/userusername/put/responses/UserusernamePutCode404Response.md +++ /dev/null @@ -1,32 +0,0 @@ -# UserusernamePutCode404Response - -public class UserusernamePutCode404Response - -A class that contains necessary nested response classes -- a class that extends ResponseDeserializer and is used to deserialize responses - -## Nested Class Summary -| Modifier and Type | Class and Description | -| ----------------- | --------------------- | -| static class | [UserusernamePutCode404Response.UserusernamePutCode404Response1](#userusernameputcode404response1)
class that deserializes responses | - -## UserusernamePutCode404Response1 -public static class UserusernamePutCode404Response1
-extends ResponseDeserializer - -a class that deserializes responses - -### Constructor Summary -| Constructor and Description | -| --------------------------- | -| UserusernamePutCode404Response1()
Creates an instance | - -### Field Summary -| Modifier and Type | Field and Description | -| ----------------- | --------------------- | -| Map | content = MapUtils.makeMap(
)
the contentType to schema info | - -### Method Summary -| Modifier and Type | Method and Description | -| ----------------- | ---------------------- | -| ApiResponse | deserialize(HttpResponse response, SchemaConfiguration configuration)
called by endpoint when deserialize responses | diff --git a/samples/client/petstore/kotlin/docs/servers/RootServer0.md b/samples/client/petstore/kotlin/docs/servers/RootServer0.md deleted file mode 100644 index d7bce71f647..00000000000 --- a/samples/client/petstore/kotlin/docs/servers/RootServer0.md +++ /dev/null @@ -1,22 +0,0 @@ -org.openapijsonschematools.client.servers.RootServer0 -# Server RootServer0 -public class RootServer0 - -A class that stores a server url - -## Description -petstore server - -### Constructor Summary -| Constructor and Description | -| --------------------------- | -| RootServer0()
Creates a server using default values for variables | -| RootServer0([RootServer0Variables.VariablesMap](../servers/rootserver0/RootServer0Variables.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" | -| [RootServer0Variables.VariablesMap](../servers/rootserver0/RootServer0Variables.md#variablesmap) | variables | - -[[Back to top]](#top) [[Back to Servers]](../../README.md#Servers) [[Back to README]](../../README.md) diff --git a/samples/client/petstore/kotlin/docs/servers/RootServer1.md b/samples/client/petstore/kotlin/docs/servers/RootServer1.md deleted file mode 100644 index 4f78ced374a..00000000000 --- a/samples/client/petstore/kotlin/docs/servers/RootServer1.md +++ /dev/null @@ -1,22 +0,0 @@ -org.openapijsonschematools.client.servers.RootServer1 -# Server RootServer1 -public class RootServer1 - -A class that stores a server url - -## Description -The local server - -### Constructor Summary -| Constructor and Description | -| --------------------------- | -| RootServer1()
Creates a server using default values for variables | -| RootServer1([RootServer1Variables.VariablesMap](../servers/rootserver1/RootServer1Variables.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}" | -| [RootServer1Variables.VariablesMap](../servers/rootserver1/RootServer1Variables.md#variablesmap) | variables | - -[[Back to top]](#top) [[Back to Servers]](../../README.md#Servers) [[Back to README]](../../README.md) diff --git a/samples/client/petstore/kotlin/docs/servers/rootserver0/RootServer0Variables.md b/samples/client/petstore/kotlin/docs/servers/rootserver0/RootServer0Variables.md deleted file mode 100644 index c84105ef023..00000000000 --- a/samples/client/petstore/kotlin/docs/servers/rootserver0/RootServer0Variables.md +++ /dev/null @@ -1,486 +0,0 @@ -# RootServer0Variables -public class RootServer0Variables
- -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 | [RootServer0Variables.RootServer0Variables1Boxed](#rootserver0variables1boxed)
sealed interface for validated payloads | -| record | [RootServer0Variables.RootServer0Variables1BoxedMap](#rootserver0variables1boxedmap)
boxed class to store validated Map payloads | -| static class | [RootServer0Variables.RootServer0Variables1](#rootserver0variables1)
schema class | -| static class | [RootServer0Variables.VariablesMapBuilder](#variablesmapbuilder)
builder for Map payloads | -| static class | [RootServer0Variables.VariablesMap](#variablesmap)
output class for Map payloads | -| sealed interface | [RootServer0Variables.PortBoxed](#portboxed)
sealed interface for validated payloads | -| record | [RootServer0Variables.PortBoxedString](#portboxedstring)
boxed class to store validated String payloads | -| static class | [RootServer0Variables.Port](#port)
schema class | -| enum | [RootServer0Variables.StringPortEnums](#stringportenums)
String enum | -| sealed interface | [RootServer0Variables.ServerBoxed](#serverboxed)
sealed interface for validated payloads | -| record | [RootServer0Variables.ServerBoxedString](#serverboxedstring)
boxed class to store validated String payloads | -| static class | [RootServer0Variables.Server](#server)
schema class | -| enum | [RootServer0Variables.StringServerEnums](#stringserverenums)
String enum | -| sealed interface | [RootServer0Variables.AdditionalPropertiesBoxed](#additionalpropertiesboxed)
sealed interface for validated payloads | -| record | [RootServer0Variables.AdditionalPropertiesBoxedVoid](#additionalpropertiesboxedvoid)
boxed class to store validated null payloads | -| record | [RootServer0Variables.AdditionalPropertiesBoxedBoolean](#additionalpropertiesboxedboolean)
boxed class to store validated boolean payloads | -| record | [RootServer0Variables.AdditionalPropertiesBoxedNumber](#additionalpropertiesboxednumber)
boxed class to store validated Number payloads | -| record | [RootServer0Variables.AdditionalPropertiesBoxedString](#additionalpropertiesboxedstring)
boxed class to store validated String payloads | -| record | [RootServer0Variables.AdditionalPropertiesBoxedList](#additionalpropertiesboxedlist)
boxed class to store validated List payloads | -| record | [RootServer0Variables.AdditionalPropertiesBoxedMap](#additionalpropertiesboxedmap)
boxed class to store validated Map payloads | -| static class | [RootServer0Variables.AdditionalProperties](#additionalproperties)
schema class | - -## RootServer0Variables1Boxed -public sealed interface RootServer0Variables1Boxed
-permits
-[RootServer0Variables1BoxedMap](#rootserver0variables1boxedmap) - -sealed interface that stores validated payloads using boxed classes - -## RootServer0Variables1BoxedMap -public record RootServer0Variables1BoxedMap
-implements [RootServer0Variables1Boxed](#rootserver0variables1boxed) - -record that stores validated Map payloads, sealed permits implementation - -### Constructor Summary -| Constructor and Description | -| --------------------------- | -| RootServer0Variables1BoxedMap([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 | - -## RootServer0Variables1 -public static class RootServer0Variables1
-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.rootserver0.RootServer0Variables; - -import java.util.Arrays; -import java.util.List; -import java.util.AbstractMap; - -static final SchemaConfiguration configuration = new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().build()); - -// Map validation -RootServer0Variables.VariablesMap validatedPayload = - RootServer0Variables.RootServer0Variables1.validate( - new RootServer0Variables.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) | -| [RootServer0Variables1BoxedMap](#rootserver0variables1boxedmap) | validateAndBox([Map<?, ?>](#variablesmapbuilder) arg, SchemaConfiguration configuration) | -| [RootServer0Variables1Boxed](#rootserver0variables1boxed) | 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.rootserver0.RootServer0Variables; - -import java.util.Arrays; -import java.util.List; -import java.util.AbstractMap; - -static final SchemaConfiguration configuration = new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().build()); - -// String validation -String validatedPayload = RootServer0Variables.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.rootserver0.RootServer0Variables; - -import java.util.Arrays; -import java.util.List; -import java.util.AbstractMap; - -static final SchemaConfiguration configuration = new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().build()); - -// String validation -String validatedPayload = RootServer0Variables.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(Nothing? data)
Creates an instance, private visibility | - -### Method Summary -| Modifier and Type | Method and Description | -| ----------------- | ---------------------- | -| Nothing? | 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/kotlin/docs/servers/rootserver1/RootServer1Variables.md b/samples/client/petstore/kotlin/docs/servers/rootserver1/RootServer1Variables.md deleted file mode 100644 index ba464ecc52f..00000000000 --- a/samples/client/petstore/kotlin/docs/servers/rootserver1/RootServer1Variables.md +++ /dev/null @@ -1,355 +0,0 @@ -# RootServer1Variables -public class RootServer1Variables
- -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 | [RootServer1Variables.RootServer1Variables1Boxed](#rootserver1variables1boxed)
sealed interface for validated payloads | -| record | [RootServer1Variables.RootServer1Variables1BoxedMap](#rootserver1variables1boxedmap)
boxed class to store validated Map payloads | -| static class | [RootServer1Variables.RootServer1Variables1](#rootserver1variables1)
schema class | -| static class | [RootServer1Variables.VariablesMapBuilder](#variablesmapbuilder)
builder for Map payloads | -| static class | [RootServer1Variables.VariablesMap](#variablesmap)
output class for Map payloads | -| sealed interface | [RootServer1Variables.VersionBoxed](#versionboxed)
sealed interface for validated payloads | -| record | [RootServer1Variables.VersionBoxedString](#versionboxedstring)
boxed class to store validated String payloads | -| static class | [RootServer1Variables.Version](#version)
schema class | -| enum | [RootServer1Variables.StringVersionEnums](#stringversionenums)
String enum | -| sealed interface | [RootServer1Variables.AdditionalPropertiesBoxed](#additionalpropertiesboxed)
sealed interface for validated payloads | -| record | [RootServer1Variables.AdditionalPropertiesBoxedVoid](#additionalpropertiesboxedvoid)
boxed class to store validated null payloads | -| record | [RootServer1Variables.AdditionalPropertiesBoxedBoolean](#additionalpropertiesboxedboolean)
boxed class to store validated boolean payloads | -| record | [RootServer1Variables.AdditionalPropertiesBoxedNumber](#additionalpropertiesboxednumber)
boxed class to store validated Number payloads | -| record | [RootServer1Variables.AdditionalPropertiesBoxedString](#additionalpropertiesboxedstring)
boxed class to store validated String payloads | -| record | [RootServer1Variables.AdditionalPropertiesBoxedList](#additionalpropertiesboxedlist)
boxed class to store validated List payloads | -| record | [RootServer1Variables.AdditionalPropertiesBoxedMap](#additionalpropertiesboxedmap)
boxed class to store validated Map payloads | -| static class | [RootServer1Variables.AdditionalProperties](#additionalproperties)
schema class | - -## RootServer1Variables1Boxed -public sealed interface RootServer1Variables1Boxed
-permits
-[RootServer1Variables1BoxedMap](#rootserver1variables1boxedmap) - -sealed interface that stores validated payloads using boxed classes - -## RootServer1Variables1BoxedMap -public record RootServer1Variables1BoxedMap
-implements [RootServer1Variables1Boxed](#rootserver1variables1boxed) - -record that stores validated Map payloads, sealed permits implementation - -### Constructor Summary -| Constructor and Description | -| --------------------------- | -| RootServer1Variables1BoxedMap([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 | - -## RootServer1Variables1 -public static class RootServer1Variables1
-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.rootserver1.RootServer1Variables; - -import java.util.Arrays; -import java.util.List; -import java.util.AbstractMap; - -static final SchemaConfiguration configuration = new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().build()); - -// Map validation -RootServer1Variables.VariablesMap validatedPayload = - RootServer1Variables.RootServer1Variables1.validate( - new RootServer1Variables.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) | -| [RootServer1Variables1BoxedMap](#rootserver1variables1boxedmap) | validateAndBox([Map<?, ?>](#variablesmapbuilder) arg, SchemaConfiguration configuration) | -| [RootServer1Variables1Boxed](#rootserver1variables1boxed) | 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.rootserver1.RootServer1Variables; - -import java.util.Arrays; -import java.util.List; -import java.util.AbstractMap; - -static final SchemaConfiguration configuration = new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().build()); - -// String validation -String validatedPayload = RootServer1Variables.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(Nothing? data)
Creates an instance, private visibility | - -### Method Summary -| Modifier and Type | Method and Description | -| ----------------- | ---------------------- | -| Nothing? | 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/kotlin/settings.gradle.kts b/samples/client/petstore/kotlin/settings.gradle.kts deleted file mode 100644 index 588673f49ca..00000000000 --- a/samples/client/petstore/kotlin/settings.gradle.kts +++ /dev/null @@ -1,2 +0,0 @@ -rootProject.name = "petstore" - diff --git a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/RootServerInfo.kt b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/RootServerInfo.kt deleted file mode 100644 index 2f47da779f1..00000000000 --- a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/RootServerInfo.kt +++ /dev/null @@ -1,77 +0,0 @@ -package org.openapijsonschematools.client; - -import org.openapijsonschematools.client.servers.RootServer0; -import org.openapijsonschematools.client.servers.RootServer1; -import org.openapijsonschematools.client.servers.RootServer2; -import org.openapijsonschematools.client.servers.Server; -import org.openapijsonschematools.client.servers.ServerProvider; -import org.checkerframework.checker.nullness.qual.Nullable; - -import java.util.Objects; - -public class RootServerInfo { - public static class RootServerInfo1 implements ServerProvider { - private final RootServer0 server0; - private final RootServer1 server1; - private final RootServer2 server2; - - RootServerInfo1( - @Nullable RootServer0 server0, - @Nullable RootServer1 server1, - @Nullable RootServer2 server2 - ) { - this.server0 = Objects.requireNonNullElseGet(server0, RootServer0::new); - this.server1 = Objects.requireNonNullElseGet(server1, RootServer1::new); - this.server2 = Objects.requireNonNullElseGet(server2, RootServer2::new); - } - - @Override - public Server getServer(ServerIndex serverIndex) { - switch (serverIndex) { - case SERVER_0: - return server0; - case SERVER_1: - return server1; - default: - return server2; - } - } - } - - public static class RootServerInfoBuilder { - private @Nullable RootServer0 server0; - private @Nullable RootServer1 server1; - private @Nullable RootServer2 server2; - - public RootServerInfoBuilder() {} - - public RootServerInfoBuilder rootServer0(RootServer0 server0) { - this.server0 = server0; - return this; - } - - public RootServerInfoBuilder rootServer1(RootServer1 server1) { - this.server1 = server1; - return this; - } - - public RootServerInfoBuilder rootServer2(RootServer2 server2) { - this.server2 = server2; - return this; - } - - public RootServerInfo1 build() { - return new RootServerInfo1( - server0, - server1, - server2 - ); - } - } - - public enum ServerIndex { - SERVER_0, - SERVER_1, - SERVER_2 - } -} \ No newline at end of file diff --git a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/apiclient/ApiClient.kt b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/apiclient/ApiClient.kt deleted file mode 100644 index 425e3a1b17f..00000000000 --- a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/apiclient/ApiClient.kt +++ /dev/null @@ -1,39 +0,0 @@ -package org.openapijsonschematools.client.apiclient; - -import org.checkerframework.checker.nullness.qual.Nullable; -import org.openapijsonschematools.client.configurations.ApiConfiguration; -import org.openapijsonschematools.client.configurations.SchemaConfiguration; - -import java.net.http.HttpClient; -import java.time.Duration; - -public class ApiClient { - protected final ApiConfiguration apiConfiguration; - protected final SchemaConfiguration schemaConfiguration; - protected final HttpClient client; - - public ApiClient(ApiConfiguration apiConfiguration, SchemaConfiguration schemaConfiguration) { - this.apiConfiguration = apiConfiguration; - this.schemaConfiguration = schemaConfiguration; - @Nullable Duration timeout = apiConfiguration.getTimeout(); - if (timeout != null) { - this.client = HttpClient.newBuilder() - .connectTimeout(timeout) - .build(); - } else { - this.client = HttpClient.newHttpClient(); - } - } - - public ApiConfiguration getApiConfiguration() { - return apiConfiguration; - } - - public SchemaConfiguration getSchemaConfiguration() { - return schemaConfiguration; - } - - public HttpClient getClient() { - return client; - } -} diff --git a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/apis/paths/Anotherfakedummy.kt b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/apis/paths/Anotherfakedummy.kt deleted file mode 100644 index b687c5fc891..00000000000 --- a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/apis/paths/Anotherfakedummy.kt +++ /dev/null @@ -1,14 +0,0 @@ -package org.openapijsonschematools.client.apis.paths; - -import org.openapijsonschematools.client.apiclient.ApiClient; -import org.openapijsonschematools.client.configurations.ApiConfiguration; -import org.openapijsonschematools.client.configurations.SchemaConfiguration; -import org.openapijsonschematools.client.paths.anotherfakedummy.AnotherfakedummyPatch; - -public class Anotherfakedummy extends ApiClient implements - AnotherfakedummyPatch.PatchOperation -{ - public Anotherfakedummy(ApiConfiguration apiConfiguration, SchemaConfiguration schemaConfiguration) { - super(apiConfiguration, schemaConfiguration); - } -} \ No newline at end of file diff --git a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/apis/paths/Commonparamsubdir.kt b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/apis/paths/Commonparamsubdir.kt deleted file mode 100644 index 400521401ea..00000000000 --- a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/apis/paths/Commonparamsubdir.kt +++ /dev/null @@ -1,18 +0,0 @@ -package org.openapijsonschematools.client.apis.paths; - -import org.openapijsonschematools.client.apiclient.ApiClient; -import org.openapijsonschematools.client.configurations.ApiConfiguration; -import org.openapijsonschematools.client.configurations.SchemaConfiguration; -import org.openapijsonschematools.client.paths.commonparamsubdir.CommonparamsubdirDelete; -import org.openapijsonschematools.client.paths.commonparamsubdir.CommonparamsubdirGet; -import org.openapijsonschematools.client.paths.commonparamsubdir.CommonparamsubdirPost; - -public class Commonparamsubdir extends ApiClient implements - CommonparamsubdirDelete.DeleteOperation, - CommonparamsubdirGet.GetOperation, - CommonparamsubdirPost.PostOperation -{ - public Commonparamsubdir(ApiConfiguration apiConfiguration, SchemaConfiguration schemaConfiguration) { - super(apiConfiguration, schemaConfiguration); - } -} \ No newline at end of file diff --git a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/apis/paths/Fake.kt b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/apis/paths/Fake.kt deleted file mode 100644 index ac3c467aeb1..00000000000 --- a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/apis/paths/Fake.kt +++ /dev/null @@ -1,20 +0,0 @@ -package org.openapijsonschematools.client.apis.paths; - -import org.openapijsonschematools.client.apiclient.ApiClient; -import org.openapijsonschematools.client.configurations.ApiConfiguration; -import org.openapijsonschematools.client.configurations.SchemaConfiguration; -import org.openapijsonschematools.client.paths.fake.FakeDelete; -import org.openapijsonschematools.client.paths.fake.FakeGet; -import org.openapijsonschematools.client.paths.fake.FakePatch; -import org.openapijsonschematools.client.paths.fake.FakePost; - -public class Fake extends ApiClient implements - FakeDelete.DeleteOperation, - FakeGet.GetOperation, - FakePatch.PatchOperation, - FakePost.PostOperation -{ - public Fake(ApiConfiguration apiConfiguration, SchemaConfiguration schemaConfiguration) { - super(apiConfiguration, schemaConfiguration); - } -} \ No newline at end of file diff --git a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/apis/paths/Fakeadditionalpropertieswitharrayofenums.kt b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/apis/paths/Fakeadditionalpropertieswitharrayofenums.kt deleted file mode 100644 index 4bf9d268646..00000000000 --- a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/apis/paths/Fakeadditionalpropertieswitharrayofenums.kt +++ /dev/null @@ -1,14 +0,0 @@ -package org.openapijsonschematools.client.apis.paths; - -import org.openapijsonschematools.client.apiclient.ApiClient; -import org.openapijsonschematools.client.configurations.ApiConfiguration; -import org.openapijsonschematools.client.configurations.SchemaConfiguration; -import org.openapijsonschematools.client.paths.fakeadditionalpropertieswitharrayofenums.FakeadditionalpropertieswitharrayofenumsGet; - -public class Fakeadditionalpropertieswitharrayofenums extends ApiClient implements - FakeadditionalpropertieswitharrayofenumsGet.GetOperation -{ - public Fakeadditionalpropertieswitharrayofenums(ApiConfiguration apiConfiguration, SchemaConfiguration schemaConfiguration) { - super(apiConfiguration, schemaConfiguration); - } -} \ No newline at end of file diff --git a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/apis/paths/Fakebodywithfileschema.kt b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/apis/paths/Fakebodywithfileschema.kt deleted file mode 100644 index a89c0f20cb9..00000000000 --- a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/apis/paths/Fakebodywithfileschema.kt +++ /dev/null @@ -1,14 +0,0 @@ -package org.openapijsonschematools.client.apis.paths; - -import org.openapijsonschematools.client.apiclient.ApiClient; -import org.openapijsonschematools.client.configurations.ApiConfiguration; -import org.openapijsonschematools.client.configurations.SchemaConfiguration; -import org.openapijsonschematools.client.paths.fakebodywithfileschema.FakebodywithfileschemaPut; - -public class Fakebodywithfileschema extends ApiClient implements - FakebodywithfileschemaPut.PutOperation -{ - public Fakebodywithfileschema(ApiConfiguration apiConfiguration, SchemaConfiguration schemaConfiguration) { - super(apiConfiguration, schemaConfiguration); - } -} \ No newline at end of file diff --git a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/apis/paths/Fakebodywithqueryparams.kt b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/apis/paths/Fakebodywithqueryparams.kt deleted file mode 100644 index 6d592293a3d..00000000000 --- a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/apis/paths/Fakebodywithqueryparams.kt +++ /dev/null @@ -1,14 +0,0 @@ -package org.openapijsonschematools.client.apis.paths; - -import org.openapijsonschematools.client.apiclient.ApiClient; -import org.openapijsonschematools.client.configurations.ApiConfiguration; -import org.openapijsonschematools.client.configurations.SchemaConfiguration; -import org.openapijsonschematools.client.paths.fakebodywithqueryparams.FakebodywithqueryparamsPut; - -public class Fakebodywithqueryparams extends ApiClient implements - FakebodywithqueryparamsPut.PutOperation -{ - public Fakebodywithqueryparams(ApiConfiguration apiConfiguration, SchemaConfiguration schemaConfiguration) { - super(apiConfiguration, schemaConfiguration); - } -} \ No newline at end of file diff --git a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/apis/paths/Fakecasesensitiveparams.kt b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/apis/paths/Fakecasesensitiveparams.kt deleted file mode 100644 index efbc1ef7ff2..00000000000 --- a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/apis/paths/Fakecasesensitiveparams.kt +++ /dev/null @@ -1,14 +0,0 @@ -package org.openapijsonschematools.client.apis.paths; - -import org.openapijsonschematools.client.apiclient.ApiClient; -import org.openapijsonschematools.client.configurations.ApiConfiguration; -import org.openapijsonschematools.client.configurations.SchemaConfiguration; -import org.openapijsonschematools.client.paths.fakecasesensitiveparams.FakecasesensitiveparamsPut; - -public class Fakecasesensitiveparams extends ApiClient implements - FakecasesensitiveparamsPut.PutOperation -{ - public Fakecasesensitiveparams(ApiConfiguration apiConfiguration, SchemaConfiguration schemaConfiguration) { - super(apiConfiguration, schemaConfiguration); - } -} \ No newline at end of file diff --git a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/apis/paths/Fakeclassnametest.kt b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/apis/paths/Fakeclassnametest.kt deleted file mode 100644 index 53160a2beb8..00000000000 --- a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/apis/paths/Fakeclassnametest.kt +++ /dev/null @@ -1,14 +0,0 @@ -package org.openapijsonschematools.client.apis.paths; - -import org.openapijsonschematools.client.apiclient.ApiClient; -import org.openapijsonschematools.client.configurations.ApiConfiguration; -import org.openapijsonschematools.client.configurations.SchemaConfiguration; -import org.openapijsonschematools.client.paths.fakeclassnametest.FakeclassnametestPatch; - -public class Fakeclassnametest extends ApiClient implements - FakeclassnametestPatch.PatchOperation -{ - public Fakeclassnametest(ApiConfiguration apiConfiguration, SchemaConfiguration schemaConfiguration) { - super(apiConfiguration, schemaConfiguration); - } -} \ No newline at end of file diff --git a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/apis/paths/Fakedeletecoffeeid.kt b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/apis/paths/Fakedeletecoffeeid.kt deleted file mode 100644 index 5bd8e4f21a5..00000000000 --- a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/apis/paths/Fakedeletecoffeeid.kt +++ /dev/null @@ -1,14 +0,0 @@ -package org.openapijsonschematools.client.apis.paths; - -import org.openapijsonschematools.client.apiclient.ApiClient; -import org.openapijsonschematools.client.configurations.ApiConfiguration; -import org.openapijsonschematools.client.configurations.SchemaConfiguration; -import org.openapijsonschematools.client.paths.fakedeletecoffeeid.FakedeletecoffeeidDelete; - -public class Fakedeletecoffeeid extends ApiClient implements - FakedeletecoffeeidDelete.DeleteOperation -{ - public Fakedeletecoffeeid(ApiConfiguration apiConfiguration, SchemaConfiguration schemaConfiguration) { - super(apiConfiguration, schemaConfiguration); - } -} \ No newline at end of file diff --git a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/apis/paths/Fakehealth.kt b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/apis/paths/Fakehealth.kt deleted file mode 100644 index 391f0afd3a0..00000000000 --- a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/apis/paths/Fakehealth.kt +++ /dev/null @@ -1,14 +0,0 @@ -package org.openapijsonschematools.client.apis.paths; - -import org.openapijsonschematools.client.apiclient.ApiClient; -import org.openapijsonschematools.client.configurations.ApiConfiguration; -import org.openapijsonschematools.client.configurations.SchemaConfiguration; -import org.openapijsonschematools.client.paths.fakehealth.FakehealthGet; - -public class Fakehealth extends ApiClient implements - FakehealthGet.GetOperation -{ - public Fakehealth(ApiConfiguration apiConfiguration, SchemaConfiguration schemaConfiguration) { - super(apiConfiguration, schemaConfiguration); - } -} \ No newline at end of file diff --git a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/apis/paths/Fakeinlineadditionalproperties.kt b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/apis/paths/Fakeinlineadditionalproperties.kt deleted file mode 100644 index 600ba72edd3..00000000000 --- a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/apis/paths/Fakeinlineadditionalproperties.kt +++ /dev/null @@ -1,14 +0,0 @@ -package org.openapijsonschematools.client.apis.paths; - -import org.openapijsonschematools.client.apiclient.ApiClient; -import org.openapijsonschematools.client.configurations.ApiConfiguration; -import org.openapijsonschematools.client.configurations.SchemaConfiguration; -import org.openapijsonschematools.client.paths.fakeinlineadditionalproperties.FakeinlineadditionalpropertiesPost; - -public class Fakeinlineadditionalproperties extends ApiClient implements - FakeinlineadditionalpropertiesPost.PostOperation -{ - public Fakeinlineadditionalproperties(ApiConfiguration apiConfiguration, SchemaConfiguration schemaConfiguration) { - super(apiConfiguration, schemaConfiguration); - } -} \ No newline at end of file diff --git a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/apis/paths/Fakeinlinecomposition.kt b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/apis/paths/Fakeinlinecomposition.kt deleted file mode 100644 index 694beae690f..00000000000 --- a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/apis/paths/Fakeinlinecomposition.kt +++ /dev/null @@ -1,14 +0,0 @@ -package org.openapijsonschematools.client.apis.paths; - -import org.openapijsonschematools.client.apiclient.ApiClient; -import org.openapijsonschematools.client.configurations.ApiConfiguration; -import org.openapijsonschematools.client.configurations.SchemaConfiguration; -import org.openapijsonschematools.client.paths.fakeinlinecomposition.FakeinlinecompositionPost; - -public class Fakeinlinecomposition extends ApiClient implements - FakeinlinecompositionPost.PostOperation -{ - public Fakeinlinecomposition(ApiConfiguration apiConfiguration, SchemaConfiguration schemaConfiguration) { - super(apiConfiguration, schemaConfiguration); - } -} \ No newline at end of file diff --git a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/apis/paths/Fakejsonformdata.kt b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/apis/paths/Fakejsonformdata.kt deleted file mode 100644 index aa70adcb670..00000000000 --- a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/apis/paths/Fakejsonformdata.kt +++ /dev/null @@ -1,14 +0,0 @@ -package org.openapijsonschematools.client.apis.paths; - -import org.openapijsonschematools.client.apiclient.ApiClient; -import org.openapijsonschematools.client.configurations.ApiConfiguration; -import org.openapijsonschematools.client.configurations.SchemaConfiguration; -import org.openapijsonschematools.client.paths.fakejsonformdata.FakejsonformdataGet; - -public class Fakejsonformdata extends ApiClient implements - FakejsonformdataGet.GetOperation -{ - public Fakejsonformdata(ApiConfiguration apiConfiguration, SchemaConfiguration schemaConfiguration) { - super(apiConfiguration, schemaConfiguration); - } -} \ No newline at end of file diff --git a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/apis/paths/Fakejsonpatch.kt b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/apis/paths/Fakejsonpatch.kt deleted file mode 100644 index 373069d8e7e..00000000000 --- a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/apis/paths/Fakejsonpatch.kt +++ /dev/null @@ -1,14 +0,0 @@ -package org.openapijsonschematools.client.apis.paths; - -import org.openapijsonschematools.client.apiclient.ApiClient; -import org.openapijsonschematools.client.configurations.ApiConfiguration; -import org.openapijsonschematools.client.configurations.SchemaConfiguration; -import org.openapijsonschematools.client.paths.fakejsonpatch.FakejsonpatchPatch; - -public class Fakejsonpatch extends ApiClient implements - FakejsonpatchPatch.PatchOperation -{ - public Fakejsonpatch(ApiConfiguration apiConfiguration, SchemaConfiguration schemaConfiguration) { - super(apiConfiguration, schemaConfiguration); - } -} \ No newline at end of file diff --git a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/apis/paths/Fakejsonwithcharset.kt b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/apis/paths/Fakejsonwithcharset.kt deleted file mode 100644 index abf3406ac4d..00000000000 --- a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/apis/paths/Fakejsonwithcharset.kt +++ /dev/null @@ -1,14 +0,0 @@ -package org.openapijsonschematools.client.apis.paths; - -import org.openapijsonschematools.client.apiclient.ApiClient; -import org.openapijsonschematools.client.configurations.ApiConfiguration; -import org.openapijsonschematools.client.configurations.SchemaConfiguration; -import org.openapijsonschematools.client.paths.fakejsonwithcharset.FakejsonwithcharsetPost; - -public class Fakejsonwithcharset extends ApiClient implements - FakejsonwithcharsetPost.PostOperation -{ - public Fakejsonwithcharset(ApiConfiguration apiConfiguration, SchemaConfiguration schemaConfiguration) { - super(apiConfiguration, schemaConfiguration); - } -} \ No newline at end of file diff --git a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/apis/paths/Fakemultiplerequestbodycontenttypes.kt b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/apis/paths/Fakemultiplerequestbodycontenttypes.kt deleted file mode 100644 index 9e1ca236245..00000000000 --- a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/apis/paths/Fakemultiplerequestbodycontenttypes.kt +++ /dev/null @@ -1,14 +0,0 @@ -package org.openapijsonschematools.client.apis.paths; - -import org.openapijsonschematools.client.apiclient.ApiClient; -import org.openapijsonschematools.client.configurations.ApiConfiguration; -import org.openapijsonschematools.client.configurations.SchemaConfiguration; -import org.openapijsonschematools.client.paths.fakemultiplerequestbodycontenttypes.FakemultiplerequestbodycontenttypesPost; - -public class Fakemultiplerequestbodycontenttypes extends ApiClient implements - FakemultiplerequestbodycontenttypesPost.PostOperation -{ - public Fakemultiplerequestbodycontenttypes(ApiConfiguration apiConfiguration, SchemaConfiguration schemaConfiguration) { - super(apiConfiguration, schemaConfiguration); - } -} \ No newline at end of file diff --git a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/apis/paths/Fakemultipleresponsebodies.kt b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/apis/paths/Fakemultipleresponsebodies.kt deleted file mode 100644 index 91d15710637..00000000000 --- a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/apis/paths/Fakemultipleresponsebodies.kt +++ /dev/null @@ -1,14 +0,0 @@ -package org.openapijsonschematools.client.apis.paths; - -import org.openapijsonschematools.client.apiclient.ApiClient; -import org.openapijsonschematools.client.configurations.ApiConfiguration; -import org.openapijsonschematools.client.configurations.SchemaConfiguration; -import org.openapijsonschematools.client.paths.fakemultipleresponsebodies.FakemultipleresponsebodiesGet; - -public class Fakemultipleresponsebodies extends ApiClient implements - FakemultipleresponsebodiesGet.GetOperation -{ - public Fakemultipleresponsebodies(ApiConfiguration apiConfiguration, SchemaConfiguration schemaConfiguration) { - super(apiConfiguration, schemaConfiguration); - } -} \ No newline at end of file diff --git a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/apis/paths/Fakemultiplesecurities.kt b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/apis/paths/Fakemultiplesecurities.kt deleted file mode 100644 index d7cc6cbbcc6..00000000000 --- a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/apis/paths/Fakemultiplesecurities.kt +++ /dev/null @@ -1,14 +0,0 @@ -package org.openapijsonschematools.client.apis.paths; - -import org.openapijsonschematools.client.apiclient.ApiClient; -import org.openapijsonschematools.client.configurations.ApiConfiguration; -import org.openapijsonschematools.client.configurations.SchemaConfiguration; -import org.openapijsonschematools.client.paths.fakemultiplesecurities.FakemultiplesecuritiesGet; - -public class Fakemultiplesecurities extends ApiClient implements - FakemultiplesecuritiesGet.GetOperation -{ - public Fakemultiplesecurities(ApiConfiguration apiConfiguration, SchemaConfiguration schemaConfiguration) { - super(apiConfiguration, schemaConfiguration); - } -} \ No newline at end of file diff --git a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/apis/paths/Fakeobjinquery.kt b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/apis/paths/Fakeobjinquery.kt deleted file mode 100644 index 793a01568fd..00000000000 --- a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/apis/paths/Fakeobjinquery.kt +++ /dev/null @@ -1,14 +0,0 @@ -package org.openapijsonschematools.client.apis.paths; - -import org.openapijsonschematools.client.apiclient.ApiClient; -import org.openapijsonschematools.client.configurations.ApiConfiguration; -import org.openapijsonschematools.client.configurations.SchemaConfiguration; -import org.openapijsonschematools.client.paths.fakeobjinquery.FakeobjinqueryGet; - -public class Fakeobjinquery extends ApiClient implements - FakeobjinqueryGet.GetOperation -{ - public Fakeobjinquery(ApiConfiguration apiConfiguration, SchemaConfiguration schemaConfiguration) { - super(apiConfiguration, schemaConfiguration); - } -} \ No newline at end of file diff --git a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/apis/paths/Fakeparametercollisions1ababselfab.kt b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/apis/paths/Fakeparametercollisions1ababselfab.kt deleted file mode 100644 index 8b399939b4c..00000000000 --- a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/apis/paths/Fakeparametercollisions1ababselfab.kt +++ /dev/null @@ -1,14 +0,0 @@ -package org.openapijsonschematools.client.apis.paths; - -import org.openapijsonschematools.client.apiclient.ApiClient; -import org.openapijsonschematools.client.configurations.ApiConfiguration; -import org.openapijsonschematools.client.configurations.SchemaConfiguration; -import org.openapijsonschematools.client.paths.fakeparametercollisions1ababselfab.Fakeparametercollisions1ababselfabPost; - -public class Fakeparametercollisions1ababselfab extends ApiClient implements - Fakeparametercollisions1ababselfabPost.PostOperation -{ - public Fakeparametercollisions1ababselfab(ApiConfiguration apiConfiguration, SchemaConfiguration schemaConfiguration) { - super(apiConfiguration, schemaConfiguration); - } -} \ No newline at end of file diff --git a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/apis/paths/Fakepemcontenttype.kt b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/apis/paths/Fakepemcontenttype.kt deleted file mode 100644 index 4ca9fe02e9e..00000000000 --- a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/apis/paths/Fakepemcontenttype.kt +++ /dev/null @@ -1,14 +0,0 @@ -package org.openapijsonschematools.client.apis.paths; - -import org.openapijsonschematools.client.apiclient.ApiClient; -import org.openapijsonschematools.client.configurations.ApiConfiguration; -import org.openapijsonschematools.client.configurations.SchemaConfiguration; -import org.openapijsonschematools.client.paths.fakepemcontenttype.FakepemcontenttypeGet; - -public class Fakepemcontenttype extends ApiClient implements - FakepemcontenttypeGet.GetOperation -{ - public Fakepemcontenttype(ApiConfiguration apiConfiguration, SchemaConfiguration schemaConfiguration) { - super(apiConfiguration, schemaConfiguration); - } -} \ No newline at end of file diff --git a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/apis/paths/Fakepetiduploadimagewithrequiredfile.kt b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/apis/paths/Fakepetiduploadimagewithrequiredfile.kt deleted file mode 100644 index bbd2557c597..00000000000 --- a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/apis/paths/Fakepetiduploadimagewithrequiredfile.kt +++ /dev/null @@ -1,14 +0,0 @@ -package org.openapijsonschematools.client.apis.paths; - -import org.openapijsonschematools.client.apiclient.ApiClient; -import org.openapijsonschematools.client.configurations.ApiConfiguration; -import org.openapijsonschematools.client.configurations.SchemaConfiguration; -import org.openapijsonschematools.client.paths.fakepetiduploadimagewithrequiredfile.FakepetiduploadimagewithrequiredfilePost; - -public class Fakepetiduploadimagewithrequiredfile extends ApiClient implements - FakepetiduploadimagewithrequiredfilePost.PostOperation -{ - public Fakepetiduploadimagewithrequiredfile(ApiConfiguration apiConfiguration, SchemaConfiguration schemaConfiguration) { - super(apiConfiguration, schemaConfiguration); - } -} \ No newline at end of file diff --git a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/apis/paths/Fakequeryparamwithjsoncontenttype.kt b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/apis/paths/Fakequeryparamwithjsoncontenttype.kt deleted file mode 100644 index 553ed3c4117..00000000000 --- a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/apis/paths/Fakequeryparamwithjsoncontenttype.kt +++ /dev/null @@ -1,14 +0,0 @@ -package org.openapijsonschematools.client.apis.paths; - -import org.openapijsonschematools.client.apiclient.ApiClient; -import org.openapijsonschematools.client.configurations.ApiConfiguration; -import org.openapijsonschematools.client.configurations.SchemaConfiguration; -import org.openapijsonschematools.client.paths.fakequeryparamwithjsoncontenttype.FakequeryparamwithjsoncontenttypeGet; - -public class Fakequeryparamwithjsoncontenttype extends ApiClient implements - FakequeryparamwithjsoncontenttypeGet.GetOperation -{ - public Fakequeryparamwithjsoncontenttype(ApiConfiguration apiConfiguration, SchemaConfiguration schemaConfiguration) { - super(apiConfiguration, schemaConfiguration); - } -} \ No newline at end of file diff --git a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/apis/paths/Fakeredirection.kt b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/apis/paths/Fakeredirection.kt deleted file mode 100644 index 828e7ba3327..00000000000 --- a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/apis/paths/Fakeredirection.kt +++ /dev/null @@ -1,14 +0,0 @@ -package org.openapijsonschematools.client.apis.paths; - -import org.openapijsonschematools.client.apiclient.ApiClient; -import org.openapijsonschematools.client.configurations.ApiConfiguration; -import org.openapijsonschematools.client.configurations.SchemaConfiguration; -import org.openapijsonschematools.client.paths.fakeredirection.FakeredirectionGet; - -public class Fakeredirection extends ApiClient implements - FakeredirectionGet.GetOperation -{ - public Fakeredirection(ApiConfiguration apiConfiguration, SchemaConfiguration schemaConfiguration) { - super(apiConfiguration, schemaConfiguration); - } -} \ No newline at end of file diff --git a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/apis/paths/Fakerefobjinquery.kt b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/apis/paths/Fakerefobjinquery.kt deleted file mode 100644 index 15bc931dce8..00000000000 --- a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/apis/paths/Fakerefobjinquery.kt +++ /dev/null @@ -1,14 +0,0 @@ -package org.openapijsonschematools.client.apis.paths; - -import org.openapijsonschematools.client.apiclient.ApiClient; -import org.openapijsonschematools.client.configurations.ApiConfiguration; -import org.openapijsonschematools.client.configurations.SchemaConfiguration; -import org.openapijsonschematools.client.paths.fakerefobjinquery.FakerefobjinqueryGet; - -public class Fakerefobjinquery extends ApiClient implements - FakerefobjinqueryGet.GetOperation -{ - public Fakerefobjinquery(ApiConfiguration apiConfiguration, SchemaConfiguration schemaConfiguration) { - super(apiConfiguration, schemaConfiguration); - } -} \ No newline at end of file diff --git a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/apis/paths/Fakerefsarraymodel.kt b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/apis/paths/Fakerefsarraymodel.kt deleted file mode 100644 index 250a772fbc1..00000000000 --- a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/apis/paths/Fakerefsarraymodel.kt +++ /dev/null @@ -1,14 +0,0 @@ -package org.openapijsonschematools.client.apis.paths; - -import org.openapijsonschematools.client.apiclient.ApiClient; -import org.openapijsonschematools.client.configurations.ApiConfiguration; -import org.openapijsonschematools.client.configurations.SchemaConfiguration; -import org.openapijsonschematools.client.paths.fakerefsarraymodel.FakerefsarraymodelPost; - -public class Fakerefsarraymodel extends ApiClient implements - FakerefsarraymodelPost.PostOperation -{ - public Fakerefsarraymodel(ApiConfiguration apiConfiguration, SchemaConfiguration schemaConfiguration) { - super(apiConfiguration, schemaConfiguration); - } -} \ No newline at end of file diff --git a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/apis/paths/Fakerefsarrayofenums.kt b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/apis/paths/Fakerefsarrayofenums.kt deleted file mode 100644 index 988912d6318..00000000000 --- a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/apis/paths/Fakerefsarrayofenums.kt +++ /dev/null @@ -1,14 +0,0 @@ -package org.openapijsonschematools.client.apis.paths; - -import org.openapijsonschematools.client.apiclient.ApiClient; -import org.openapijsonschematools.client.configurations.ApiConfiguration; -import org.openapijsonschematools.client.configurations.SchemaConfiguration; -import org.openapijsonschematools.client.paths.fakerefsarrayofenums.FakerefsarrayofenumsPost; - -public class Fakerefsarrayofenums extends ApiClient implements - FakerefsarrayofenumsPost.PostOperation -{ - public Fakerefsarrayofenums(ApiConfiguration apiConfiguration, SchemaConfiguration schemaConfiguration) { - super(apiConfiguration, schemaConfiguration); - } -} \ No newline at end of file diff --git a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/apis/paths/Fakerefsboolean.kt b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/apis/paths/Fakerefsboolean.kt deleted file mode 100644 index 85159625e64..00000000000 --- a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/apis/paths/Fakerefsboolean.kt +++ /dev/null @@ -1,14 +0,0 @@ -package org.openapijsonschematools.client.apis.paths; - -import org.openapijsonschematools.client.apiclient.ApiClient; -import org.openapijsonschematools.client.configurations.ApiConfiguration; -import org.openapijsonschematools.client.configurations.SchemaConfiguration; -import org.openapijsonschematools.client.paths.fakerefsboolean.FakerefsbooleanPost; - -public class Fakerefsboolean extends ApiClient implements - FakerefsbooleanPost.PostOperation -{ - public Fakerefsboolean(ApiConfiguration apiConfiguration, SchemaConfiguration schemaConfiguration) { - super(apiConfiguration, schemaConfiguration); - } -} \ No newline at end of file diff --git a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/apis/paths/Fakerefscomposedoneofnumberwithvalidations.kt b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/apis/paths/Fakerefscomposedoneofnumberwithvalidations.kt deleted file mode 100644 index a129e1082de..00000000000 --- a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/apis/paths/Fakerefscomposedoneofnumberwithvalidations.kt +++ /dev/null @@ -1,14 +0,0 @@ -package org.openapijsonschematools.client.apis.paths; - -import org.openapijsonschematools.client.apiclient.ApiClient; -import org.openapijsonschematools.client.configurations.ApiConfiguration; -import org.openapijsonschematools.client.configurations.SchemaConfiguration; -import org.openapijsonschematools.client.paths.fakerefscomposedoneofnumberwithvalidations.FakerefscomposedoneofnumberwithvalidationsPost; - -public class Fakerefscomposedoneofnumberwithvalidations extends ApiClient implements - FakerefscomposedoneofnumberwithvalidationsPost.PostOperation -{ - public Fakerefscomposedoneofnumberwithvalidations(ApiConfiguration apiConfiguration, SchemaConfiguration schemaConfiguration) { - super(apiConfiguration, schemaConfiguration); - } -} \ No newline at end of file diff --git a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/apis/paths/Fakerefsenum.kt b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/apis/paths/Fakerefsenum.kt deleted file mode 100644 index 8ba08ff3be7..00000000000 --- a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/apis/paths/Fakerefsenum.kt +++ /dev/null @@ -1,14 +0,0 @@ -package org.openapijsonschematools.client.apis.paths; - -import org.openapijsonschematools.client.apiclient.ApiClient; -import org.openapijsonschematools.client.configurations.ApiConfiguration; -import org.openapijsonschematools.client.configurations.SchemaConfiguration; -import org.openapijsonschematools.client.paths.fakerefsenum.FakerefsenumPost; - -public class Fakerefsenum extends ApiClient implements - FakerefsenumPost.PostOperation -{ - public Fakerefsenum(ApiConfiguration apiConfiguration, SchemaConfiguration schemaConfiguration) { - super(apiConfiguration, schemaConfiguration); - } -} \ No newline at end of file diff --git a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/apis/paths/Fakerefsmammal.kt b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/apis/paths/Fakerefsmammal.kt deleted file mode 100644 index 2ccab524251..00000000000 --- a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/apis/paths/Fakerefsmammal.kt +++ /dev/null @@ -1,14 +0,0 @@ -package org.openapijsonschematools.client.apis.paths; - -import org.openapijsonschematools.client.apiclient.ApiClient; -import org.openapijsonschematools.client.configurations.ApiConfiguration; -import org.openapijsonschematools.client.configurations.SchemaConfiguration; -import org.openapijsonschematools.client.paths.fakerefsmammal.FakerefsmammalPost; - -public class Fakerefsmammal extends ApiClient implements - FakerefsmammalPost.PostOperation -{ - public Fakerefsmammal(ApiConfiguration apiConfiguration, SchemaConfiguration schemaConfiguration) { - super(apiConfiguration, schemaConfiguration); - } -} \ No newline at end of file diff --git a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/apis/paths/Fakerefsnumber.kt b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/apis/paths/Fakerefsnumber.kt deleted file mode 100644 index f1427e288f3..00000000000 --- a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/apis/paths/Fakerefsnumber.kt +++ /dev/null @@ -1,14 +0,0 @@ -package org.openapijsonschematools.client.apis.paths; - -import org.openapijsonschematools.client.apiclient.ApiClient; -import org.openapijsonschematools.client.configurations.ApiConfiguration; -import org.openapijsonschematools.client.configurations.SchemaConfiguration; -import org.openapijsonschematools.client.paths.fakerefsnumber.FakerefsnumberPost; - -public class Fakerefsnumber extends ApiClient implements - FakerefsnumberPost.PostOperation -{ - public Fakerefsnumber(ApiConfiguration apiConfiguration, SchemaConfiguration schemaConfiguration) { - super(apiConfiguration, schemaConfiguration); - } -} \ No newline at end of file diff --git a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/apis/paths/Fakerefsobjectmodelwithrefprops.kt b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/apis/paths/Fakerefsobjectmodelwithrefprops.kt deleted file mode 100644 index ed6b1aff9fc..00000000000 --- a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/apis/paths/Fakerefsobjectmodelwithrefprops.kt +++ /dev/null @@ -1,14 +0,0 @@ -package org.openapijsonschematools.client.apis.paths; - -import org.openapijsonschematools.client.apiclient.ApiClient; -import org.openapijsonschematools.client.configurations.ApiConfiguration; -import org.openapijsonschematools.client.configurations.SchemaConfiguration; -import org.openapijsonschematools.client.paths.fakerefsobjectmodelwithrefprops.FakerefsobjectmodelwithrefpropsPost; - -public class Fakerefsobjectmodelwithrefprops extends ApiClient implements - FakerefsobjectmodelwithrefpropsPost.PostOperation -{ - public Fakerefsobjectmodelwithrefprops(ApiConfiguration apiConfiguration, SchemaConfiguration schemaConfiguration) { - super(apiConfiguration, schemaConfiguration); - } -} \ No newline at end of file diff --git a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/apis/paths/Fakerefsstring.kt b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/apis/paths/Fakerefsstring.kt deleted file mode 100644 index bc6044ae3df..00000000000 --- a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/apis/paths/Fakerefsstring.kt +++ /dev/null @@ -1,14 +0,0 @@ -package org.openapijsonschematools.client.apis.paths; - -import org.openapijsonschematools.client.apiclient.ApiClient; -import org.openapijsonschematools.client.configurations.ApiConfiguration; -import org.openapijsonschematools.client.configurations.SchemaConfiguration; -import org.openapijsonschematools.client.paths.fakerefsstring.FakerefsstringPost; - -public class Fakerefsstring extends ApiClient implements - FakerefsstringPost.PostOperation -{ - public Fakerefsstring(ApiConfiguration apiConfiguration, SchemaConfiguration schemaConfiguration) { - super(apiConfiguration, schemaConfiguration); - } -} \ No newline at end of file diff --git a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/apis/paths/Fakeresponsewithoutschema.kt b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/apis/paths/Fakeresponsewithoutschema.kt deleted file mode 100644 index 6219862cf7d..00000000000 --- a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/apis/paths/Fakeresponsewithoutschema.kt +++ /dev/null @@ -1,14 +0,0 @@ -package org.openapijsonschematools.client.apis.paths; - -import org.openapijsonschematools.client.apiclient.ApiClient; -import org.openapijsonschematools.client.configurations.ApiConfiguration; -import org.openapijsonschematools.client.configurations.SchemaConfiguration; -import org.openapijsonschematools.client.paths.fakeresponsewithoutschema.FakeresponsewithoutschemaGet; - -public class Fakeresponsewithoutschema extends ApiClient implements - FakeresponsewithoutschemaGet.GetOperation -{ - public Fakeresponsewithoutschema(ApiConfiguration apiConfiguration, SchemaConfiguration schemaConfiguration) { - super(apiConfiguration, schemaConfiguration); - } -} \ No newline at end of file diff --git a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/apis/paths/Faketestqueryparamters.kt b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/apis/paths/Faketestqueryparamters.kt deleted file mode 100644 index cc22cfe66be..00000000000 --- a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/apis/paths/Faketestqueryparamters.kt +++ /dev/null @@ -1,14 +0,0 @@ -package org.openapijsonschematools.client.apis.paths; - -import org.openapijsonschematools.client.apiclient.ApiClient; -import org.openapijsonschematools.client.configurations.ApiConfiguration; -import org.openapijsonschematools.client.configurations.SchemaConfiguration; -import org.openapijsonschematools.client.paths.faketestqueryparamters.FaketestqueryparamtersPut; - -public class Faketestqueryparamters extends ApiClient implements - FaketestqueryparamtersPut.PutOperation -{ - public Faketestqueryparamters(ApiConfiguration apiConfiguration, SchemaConfiguration schemaConfiguration) { - super(apiConfiguration, schemaConfiguration); - } -} \ No newline at end of file diff --git a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/apis/paths/Fakeuploaddownloadfile.kt b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/apis/paths/Fakeuploaddownloadfile.kt deleted file mode 100644 index 87b8ed880ff..00000000000 --- a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/apis/paths/Fakeuploaddownloadfile.kt +++ /dev/null @@ -1,14 +0,0 @@ -package org.openapijsonschematools.client.apis.paths; - -import org.openapijsonschematools.client.apiclient.ApiClient; -import org.openapijsonschematools.client.configurations.ApiConfiguration; -import org.openapijsonschematools.client.configurations.SchemaConfiguration; -import org.openapijsonschematools.client.paths.fakeuploaddownloadfile.FakeuploaddownloadfilePost; - -public class Fakeuploaddownloadfile extends ApiClient implements - FakeuploaddownloadfilePost.PostOperation -{ - public Fakeuploaddownloadfile(ApiConfiguration apiConfiguration, SchemaConfiguration schemaConfiguration) { - super(apiConfiguration, schemaConfiguration); - } -} \ No newline at end of file diff --git a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/apis/paths/Fakeuploadfile.kt b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/apis/paths/Fakeuploadfile.kt deleted file mode 100644 index 8b8f6ce8678..00000000000 --- a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/apis/paths/Fakeuploadfile.kt +++ /dev/null @@ -1,14 +0,0 @@ -package org.openapijsonschematools.client.apis.paths; - -import org.openapijsonschematools.client.apiclient.ApiClient; -import org.openapijsonschematools.client.configurations.ApiConfiguration; -import org.openapijsonschematools.client.configurations.SchemaConfiguration; -import org.openapijsonschematools.client.paths.fakeuploadfile.FakeuploadfilePost; - -public class Fakeuploadfile extends ApiClient implements - FakeuploadfilePost.PostOperation -{ - public Fakeuploadfile(ApiConfiguration apiConfiguration, SchemaConfiguration schemaConfiguration) { - super(apiConfiguration, schemaConfiguration); - } -} \ No newline at end of file diff --git a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/apis/paths/Fakeuploadfiles.kt b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/apis/paths/Fakeuploadfiles.kt deleted file mode 100644 index 1a95591c6ac..00000000000 --- a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/apis/paths/Fakeuploadfiles.kt +++ /dev/null @@ -1,14 +0,0 @@ -package org.openapijsonschematools.client.apis.paths; - -import org.openapijsonschematools.client.apiclient.ApiClient; -import org.openapijsonschematools.client.configurations.ApiConfiguration; -import org.openapijsonschematools.client.configurations.SchemaConfiguration; -import org.openapijsonschematools.client.paths.fakeuploadfiles.FakeuploadfilesPost; - -public class Fakeuploadfiles extends ApiClient implements - FakeuploadfilesPost.PostOperation -{ - public Fakeuploadfiles(ApiConfiguration apiConfiguration, SchemaConfiguration schemaConfiguration) { - super(apiConfiguration, schemaConfiguration); - } -} \ No newline at end of file diff --git a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/apis/paths/Fakewildcardresponses.kt b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/apis/paths/Fakewildcardresponses.kt deleted file mode 100644 index 7abc3e972d0..00000000000 --- a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/apis/paths/Fakewildcardresponses.kt +++ /dev/null @@ -1,14 +0,0 @@ -package org.openapijsonschematools.client.apis.paths; - -import org.openapijsonschematools.client.apiclient.ApiClient; -import org.openapijsonschematools.client.configurations.ApiConfiguration; -import org.openapijsonschematools.client.configurations.SchemaConfiguration; -import org.openapijsonschematools.client.paths.fakewildcardresponses.FakewildcardresponsesGet; - -public class Fakewildcardresponses extends ApiClient implements - FakewildcardresponsesGet.GetOperation -{ - public Fakewildcardresponses(ApiConfiguration apiConfiguration, SchemaConfiguration schemaConfiguration) { - super(apiConfiguration, schemaConfiguration); - } -} \ No newline at end of file diff --git a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/apis/paths/Foo.kt b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/apis/paths/Foo.kt deleted file mode 100644 index f17acf763b0..00000000000 --- a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/apis/paths/Foo.kt +++ /dev/null @@ -1,14 +0,0 @@ -package org.openapijsonschematools.client.apis.paths; - -import org.openapijsonschematools.client.apiclient.ApiClient; -import org.openapijsonschematools.client.configurations.ApiConfiguration; -import org.openapijsonschematools.client.configurations.SchemaConfiguration; -import org.openapijsonschematools.client.paths.foo.FooGet; - -public class Foo extends ApiClient implements - FooGet.GetOperation -{ - public Foo(ApiConfiguration apiConfiguration, SchemaConfiguration schemaConfiguration) { - super(apiConfiguration, schemaConfiguration); - } -} \ No newline at end of file diff --git a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/apis/paths/Pet.kt b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/apis/paths/Pet.kt deleted file mode 100644 index 47a158d79f1..00000000000 --- a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/apis/paths/Pet.kt +++ /dev/null @@ -1,16 +0,0 @@ -package org.openapijsonschematools.client.apis.paths; - -import org.openapijsonschematools.client.apiclient.ApiClient; -import org.openapijsonschematools.client.configurations.ApiConfiguration; -import org.openapijsonschematools.client.configurations.SchemaConfiguration; -import org.openapijsonschematools.client.paths.pet.PetPost; -import org.openapijsonschematools.client.paths.pet.PetPut; - -public class Pet extends ApiClient implements - PetPost.PostOperation, - PetPut.PutOperation -{ - public Pet(ApiConfiguration apiConfiguration, SchemaConfiguration schemaConfiguration) { - super(apiConfiguration, schemaConfiguration); - } -} \ No newline at end of file diff --git a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/apis/paths/Petfindbystatus.kt b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/apis/paths/Petfindbystatus.kt deleted file mode 100644 index 0c4c1996263..00000000000 --- a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/apis/paths/Petfindbystatus.kt +++ /dev/null @@ -1,14 +0,0 @@ -package org.openapijsonschematools.client.apis.paths; - -import org.openapijsonschematools.client.apiclient.ApiClient; -import org.openapijsonschematools.client.configurations.ApiConfiguration; -import org.openapijsonschematools.client.configurations.SchemaConfiguration; -import org.openapijsonschematools.client.paths.petfindbystatus.PetfindbystatusGet; - -public class Petfindbystatus extends ApiClient implements - PetfindbystatusGet.GetOperation -{ - public Petfindbystatus(ApiConfiguration apiConfiguration, SchemaConfiguration schemaConfiguration) { - super(apiConfiguration, schemaConfiguration); - } -} \ No newline at end of file diff --git a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/apis/paths/Petfindbytags.kt b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/apis/paths/Petfindbytags.kt deleted file mode 100644 index 10c9d0081b3..00000000000 --- a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/apis/paths/Petfindbytags.kt +++ /dev/null @@ -1,14 +0,0 @@ -package org.openapijsonschematools.client.apis.paths; - -import org.openapijsonschematools.client.apiclient.ApiClient; -import org.openapijsonschematools.client.configurations.ApiConfiguration; -import org.openapijsonschematools.client.configurations.SchemaConfiguration; -import org.openapijsonschematools.client.paths.petfindbytags.PetfindbytagsGet; - -public class Petfindbytags extends ApiClient implements - PetfindbytagsGet.GetOperation -{ - public Petfindbytags(ApiConfiguration apiConfiguration, SchemaConfiguration schemaConfiguration) { - super(apiConfiguration, schemaConfiguration); - } -} \ No newline at end of file diff --git a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/apis/paths/Petpetid.kt b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/apis/paths/Petpetid.kt deleted file mode 100644 index a1fb089c3d3..00000000000 --- a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/apis/paths/Petpetid.kt +++ /dev/null @@ -1,18 +0,0 @@ -package org.openapijsonschematools.client.apis.paths; - -import org.openapijsonschematools.client.apiclient.ApiClient; -import org.openapijsonschematools.client.configurations.ApiConfiguration; -import org.openapijsonschematools.client.configurations.SchemaConfiguration; -import org.openapijsonschematools.client.paths.petpetid.PetpetidDelete; -import org.openapijsonschematools.client.paths.petpetid.PetpetidGet; -import org.openapijsonschematools.client.paths.petpetid.PetpetidPost; - -public class Petpetid extends ApiClient implements - PetpetidDelete.DeleteOperation, - PetpetidGet.GetOperation, - PetpetidPost.PostOperation -{ - public Petpetid(ApiConfiguration apiConfiguration, SchemaConfiguration schemaConfiguration) { - super(apiConfiguration, schemaConfiguration); - } -} \ No newline at end of file diff --git a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/apis/paths/Petpetiduploadimage.kt b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/apis/paths/Petpetiduploadimage.kt deleted file mode 100644 index 2e66215c65e..00000000000 --- a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/apis/paths/Petpetiduploadimage.kt +++ /dev/null @@ -1,14 +0,0 @@ -package org.openapijsonschematools.client.apis.paths; - -import org.openapijsonschematools.client.apiclient.ApiClient; -import org.openapijsonschematools.client.configurations.ApiConfiguration; -import org.openapijsonschematools.client.configurations.SchemaConfiguration; -import org.openapijsonschematools.client.paths.petpetiduploadimage.PetpetiduploadimagePost; - -public class Petpetiduploadimage extends ApiClient implements - PetpetiduploadimagePost.PostOperation -{ - public Petpetiduploadimage(ApiConfiguration apiConfiguration, SchemaConfiguration schemaConfiguration) { - super(apiConfiguration, schemaConfiguration); - } -} \ No newline at end of file diff --git a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/apis/paths/Solidus.kt b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/apis/paths/Solidus.kt deleted file mode 100644 index cf5e430d52a..00000000000 --- a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/apis/paths/Solidus.kt +++ /dev/null @@ -1,14 +0,0 @@ -package org.openapijsonschematools.client.apis.paths; - -import org.openapijsonschematools.client.apiclient.ApiClient; -import org.openapijsonschematools.client.configurations.ApiConfiguration; -import org.openapijsonschematools.client.configurations.SchemaConfiguration; -import org.openapijsonschematools.client.paths.solidus.SolidusGet; - -public class Solidus extends ApiClient implements - SolidusGet.GetOperation -{ - public Solidus(ApiConfiguration apiConfiguration, SchemaConfiguration schemaConfiguration) { - super(apiConfiguration, schemaConfiguration); - } -} \ No newline at end of file diff --git a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/apis/paths/Storeinventory.kt b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/apis/paths/Storeinventory.kt deleted file mode 100644 index bcab950278d..00000000000 --- a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/apis/paths/Storeinventory.kt +++ /dev/null @@ -1,14 +0,0 @@ -package org.openapijsonschematools.client.apis.paths; - -import org.openapijsonschematools.client.apiclient.ApiClient; -import org.openapijsonschematools.client.configurations.ApiConfiguration; -import org.openapijsonschematools.client.configurations.SchemaConfiguration; -import org.openapijsonschematools.client.paths.storeinventory.StoreinventoryGet; - -public class Storeinventory extends ApiClient implements - StoreinventoryGet.GetOperation -{ - public Storeinventory(ApiConfiguration apiConfiguration, SchemaConfiguration schemaConfiguration) { - super(apiConfiguration, schemaConfiguration); - } -} \ No newline at end of file diff --git a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/apis/paths/Storeorder.kt b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/apis/paths/Storeorder.kt deleted file mode 100644 index e7e03c2bffa..00000000000 --- a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/apis/paths/Storeorder.kt +++ /dev/null @@ -1,14 +0,0 @@ -package org.openapijsonschematools.client.apis.paths; - -import org.openapijsonschematools.client.apiclient.ApiClient; -import org.openapijsonschematools.client.configurations.ApiConfiguration; -import org.openapijsonschematools.client.configurations.SchemaConfiguration; -import org.openapijsonschematools.client.paths.storeorder.StoreorderPost; - -public class Storeorder extends ApiClient implements - StoreorderPost.PostOperation -{ - public Storeorder(ApiConfiguration apiConfiguration, SchemaConfiguration schemaConfiguration) { - super(apiConfiguration, schemaConfiguration); - } -} \ No newline at end of file diff --git a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/apis/paths/Storeorderorderid.kt b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/apis/paths/Storeorderorderid.kt deleted file mode 100644 index 4a6c78c4428..00000000000 --- a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/apis/paths/Storeorderorderid.kt +++ /dev/null @@ -1,16 +0,0 @@ -package org.openapijsonschematools.client.apis.paths; - -import org.openapijsonschematools.client.apiclient.ApiClient; -import org.openapijsonschematools.client.configurations.ApiConfiguration; -import org.openapijsonschematools.client.configurations.SchemaConfiguration; -import org.openapijsonschematools.client.paths.storeorderorderid.StoreorderorderidDelete; -import org.openapijsonschematools.client.paths.storeorderorderid.StoreorderorderidGet; - -public class Storeorderorderid extends ApiClient implements - StoreorderorderidDelete.DeleteOperation, - StoreorderorderidGet.GetOperation -{ - public Storeorderorderid(ApiConfiguration apiConfiguration, SchemaConfiguration schemaConfiguration) { - super(apiConfiguration, schemaConfiguration); - } -} \ No newline at end of file diff --git a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/apis/paths/User.kt b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/apis/paths/User.kt deleted file mode 100644 index d5797033de0..00000000000 --- a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/apis/paths/User.kt +++ /dev/null @@ -1,14 +0,0 @@ -package org.openapijsonschematools.client.apis.paths; - -import org.openapijsonschematools.client.apiclient.ApiClient; -import org.openapijsonschematools.client.configurations.ApiConfiguration; -import org.openapijsonschematools.client.configurations.SchemaConfiguration; -import org.openapijsonschematools.client.paths.user.UserPost; - -public class User extends ApiClient implements - UserPost.PostOperation -{ - public User(ApiConfiguration apiConfiguration, SchemaConfiguration schemaConfiguration) { - super(apiConfiguration, schemaConfiguration); - } -} \ No newline at end of file diff --git a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/apis/paths/Usercreatewitharray.kt b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/apis/paths/Usercreatewitharray.kt deleted file mode 100644 index ad5b8a37613..00000000000 --- a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/apis/paths/Usercreatewitharray.kt +++ /dev/null @@ -1,14 +0,0 @@ -package org.openapijsonschematools.client.apis.paths; - -import org.openapijsonschematools.client.apiclient.ApiClient; -import org.openapijsonschematools.client.configurations.ApiConfiguration; -import org.openapijsonschematools.client.configurations.SchemaConfiguration; -import org.openapijsonschematools.client.paths.usercreatewitharray.UsercreatewitharrayPost; - -public class Usercreatewitharray extends ApiClient implements - UsercreatewitharrayPost.PostOperation -{ - public Usercreatewitharray(ApiConfiguration apiConfiguration, SchemaConfiguration schemaConfiguration) { - super(apiConfiguration, schemaConfiguration); - } -} \ No newline at end of file diff --git a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/apis/paths/Usercreatewithlist.kt b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/apis/paths/Usercreatewithlist.kt deleted file mode 100644 index e110f8de79b..00000000000 --- a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/apis/paths/Usercreatewithlist.kt +++ /dev/null @@ -1,14 +0,0 @@ -package org.openapijsonschematools.client.apis.paths; - -import org.openapijsonschematools.client.apiclient.ApiClient; -import org.openapijsonschematools.client.configurations.ApiConfiguration; -import org.openapijsonschematools.client.configurations.SchemaConfiguration; -import org.openapijsonschematools.client.paths.usercreatewithlist.UsercreatewithlistPost; - -public class Usercreatewithlist extends ApiClient implements - UsercreatewithlistPost.PostOperation -{ - public Usercreatewithlist(ApiConfiguration apiConfiguration, SchemaConfiguration schemaConfiguration) { - super(apiConfiguration, schemaConfiguration); - } -} \ No newline at end of file diff --git a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/apis/paths/Userlogin.kt b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/apis/paths/Userlogin.kt deleted file mode 100644 index 5059623c6d1..00000000000 --- a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/apis/paths/Userlogin.kt +++ /dev/null @@ -1,14 +0,0 @@ -package org.openapijsonschematools.client.apis.paths; - -import org.openapijsonschematools.client.apiclient.ApiClient; -import org.openapijsonschematools.client.configurations.ApiConfiguration; -import org.openapijsonschematools.client.configurations.SchemaConfiguration; -import org.openapijsonschematools.client.paths.userlogin.UserloginGet; - -public class Userlogin extends ApiClient implements - UserloginGet.GetOperation -{ - public Userlogin(ApiConfiguration apiConfiguration, SchemaConfiguration schemaConfiguration) { - super(apiConfiguration, schemaConfiguration); - } -} \ No newline at end of file diff --git a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/apis/paths/Userlogout.kt b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/apis/paths/Userlogout.kt deleted file mode 100644 index 00de9ce4f8d..00000000000 --- a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/apis/paths/Userlogout.kt +++ /dev/null @@ -1,14 +0,0 @@ -package org.openapijsonschematools.client.apis.paths; - -import org.openapijsonschematools.client.apiclient.ApiClient; -import org.openapijsonschematools.client.configurations.ApiConfiguration; -import org.openapijsonschematools.client.configurations.SchemaConfiguration; -import org.openapijsonschematools.client.paths.userlogout.UserlogoutGet; - -public class Userlogout extends ApiClient implements - UserlogoutGet.GetOperation -{ - public Userlogout(ApiConfiguration apiConfiguration, SchemaConfiguration schemaConfiguration) { - super(apiConfiguration, schemaConfiguration); - } -} \ No newline at end of file diff --git a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/apis/paths/Userusername.kt b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/apis/paths/Userusername.kt deleted file mode 100644 index 9fc5cde71ca..00000000000 --- a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/apis/paths/Userusername.kt +++ /dev/null @@ -1,18 +0,0 @@ -package org.openapijsonschematools.client.apis.paths; - -import org.openapijsonschematools.client.apiclient.ApiClient; -import org.openapijsonschematools.client.configurations.ApiConfiguration; -import org.openapijsonschematools.client.configurations.SchemaConfiguration; -import org.openapijsonschematools.client.paths.userusername.UserusernameDelete; -import org.openapijsonschematools.client.paths.userusername.UserusernameGet; -import org.openapijsonschematools.client.paths.userusername.UserusernamePut; - -public class Userusername extends ApiClient implements - UserusernameDelete.DeleteOperation, - UserusernameGet.GetOperation, - UserusernamePut.PutOperation -{ - public Userusername(ApiConfiguration apiConfiguration, SchemaConfiguration schemaConfiguration) { - super(apiConfiguration, schemaConfiguration); - } -} \ No newline at end of file diff --git a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/apis/tags/Anotherfake.kt b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/apis/tags/Anotherfake.kt deleted file mode 100644 index 844875c8f4b..00000000000 --- a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/apis/tags/Anotherfake.kt +++ /dev/null @@ -1,14 +0,0 @@ -package org.openapijsonschematools.client.apis.tags; - -import org.openapijsonschematools.client.apiclient.ApiClient; -import org.openapijsonschematools.client.configurations.ApiConfiguration; -import org.openapijsonschematools.client.configurations.SchemaConfiguration; -import org.openapijsonschematools.client.paths.anotherfakedummy.AnotherfakedummyPatch; - -public class Anotherfake extends ApiClient implements - AnotherfakedummyPatch.Model123TestSpecialTagsOperation -{ - public Anotherfake(ApiConfiguration apiConfiguration, SchemaConfiguration schemaConfiguration) { - super(apiConfiguration, schemaConfiguration); - } -} \ No newline at end of file diff --git a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/apis/tags/Default.kt b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/apis/tags/Default.kt deleted file mode 100644 index b55a09a58f4..00000000000 --- a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/apis/tags/Default.kt +++ /dev/null @@ -1,14 +0,0 @@ -package org.openapijsonschematools.client.apis.tags; - -import org.openapijsonschematools.client.apiclient.ApiClient; -import org.openapijsonschematools.client.configurations.ApiConfiguration; -import org.openapijsonschematools.client.configurations.SchemaConfiguration; -import org.openapijsonschematools.client.paths.foo.FooGet; - -public class Default extends ApiClient implements - FooGet.FooGetOperation -{ - public Default(ApiConfiguration apiConfiguration, SchemaConfiguration schemaConfiguration) { - super(apiConfiguration, schemaConfiguration); - } -} \ No newline at end of file diff --git a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/apis/tags/Fake.kt b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/apis/tags/Fake.kt deleted file mode 100644 index 2694e40d4c0..00000000000 --- a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/apis/tags/Fake.kt +++ /dev/null @@ -1,98 +0,0 @@ -package org.openapijsonschematools.client.apis.tags; - -import org.openapijsonschematools.client.apiclient.ApiClient; -import org.openapijsonschematools.client.configurations.ApiConfiguration; -import org.openapijsonschematools.client.configurations.SchemaConfiguration; -import org.openapijsonschematools.client.paths.fakejsonpatch.FakejsonpatchPatch; -import org.openapijsonschematools.client.paths.fakerefsarrayofenums.FakerefsarrayofenumsPost; -import org.openapijsonschematools.client.paths.commonparamsubdir.CommonparamsubdirDelete; -import org.openapijsonschematools.client.paths.commonparamsubdir.CommonparamsubdirGet; -import org.openapijsonschematools.client.paths.commonparamsubdir.CommonparamsubdirPost; -import org.openapijsonschematools.client.paths.fakecasesensitiveparams.FakecasesensitiveparamsPut; -import org.openapijsonschematools.client.paths.fakewildcardresponses.FakewildcardresponsesGet; -import org.openapijsonschematools.client.paths.fakebodywithqueryparams.FakebodywithqueryparamsPut; -import org.openapijsonschematools.client.paths.fakejsonwithcharset.FakejsonwithcharsetPost; -import org.openapijsonschematools.client.paths.fakerefsarraymodel.FakerefsarraymodelPost; -import org.openapijsonschematools.client.paths.fakehealth.FakehealthGet; -import org.openapijsonschematools.client.paths.fakerefscomposedoneofnumberwithvalidations.FakerefscomposedoneofnumberwithvalidationsPost; -import org.openapijsonschematools.client.paths.fakerefobjinquery.FakerefobjinqueryGet; -import org.openapijsonschematools.client.paths.fakebodywithfileschema.FakebodywithfileschemaPut; -import org.openapijsonschematools.client.paths.fakerefsenum.FakerefsenumPost; -import org.openapijsonschematools.client.paths.fakeredirection.FakeredirectionGet; -import org.openapijsonschematools.client.paths.fakeuploadfile.FakeuploadfilePost; -import org.openapijsonschematools.client.paths.fakeinlinecomposition.FakeinlinecompositionPost; -import org.openapijsonschematools.client.paths.fake.FakeDelete; -import org.openapijsonschematools.client.paths.fake.FakeGet; -import org.openapijsonschematools.client.paths.fake.FakePatch; -import org.openapijsonschematools.client.paths.fake.FakePost; -import org.openapijsonschematools.client.paths.fakerefsobjectmodelwithrefprops.FakerefsobjectmodelwithrefpropsPost; -import org.openapijsonschematools.client.paths.fakepemcontenttype.FakepemcontenttypeGet; -import org.openapijsonschematools.client.paths.fakerefsnumber.FakerefsnumberPost; -import org.openapijsonschematools.client.paths.fakerefsstring.FakerefsstringPost; -import org.openapijsonschematools.client.paths.fakeinlineadditionalproperties.FakeinlineadditionalpropertiesPost; -import org.openapijsonschematools.client.paths.fakerefsmammal.FakerefsmammalPost; -import org.openapijsonschematools.client.paths.solidus.SolidusGet; -import org.openapijsonschematools.client.paths.fakerefsboolean.FakerefsbooleanPost; -import org.openapijsonschematools.client.paths.fakejsonformdata.FakejsonformdataGet; -import org.openapijsonschematools.client.paths.fakeparametercollisions1ababselfab.Fakeparametercollisions1ababselfabPost; -import org.openapijsonschematools.client.paths.fakequeryparamwithjsoncontenttype.FakequeryparamwithjsoncontenttypeGet; -import org.openapijsonschematools.client.paths.fakeobjinquery.FakeobjinqueryGet; -import org.openapijsonschematools.client.paths.fakemultiplesecurities.FakemultiplesecuritiesGet; -import org.openapijsonschematools.client.paths.faketestqueryparamters.FaketestqueryparamtersPut; -import org.openapijsonschematools.client.paths.fakemultipleresponsebodies.FakemultipleresponsebodiesGet; -import org.openapijsonschematools.client.paths.fakeresponsewithoutschema.FakeresponsewithoutschemaGet; -import org.openapijsonschematools.client.paths.fakemultiplerequestbodycontenttypes.FakemultiplerequestbodycontenttypesPost; -import org.openapijsonschematools.client.paths.fakeuploaddownloadfile.FakeuploaddownloadfilePost; -import org.openapijsonschematools.client.paths.fakeuploadfiles.FakeuploadfilesPost; -import org.openapijsonschematools.client.paths.fakeadditionalpropertieswitharrayofenums.FakeadditionalpropertieswitharrayofenumsGet; -import org.openapijsonschematools.client.paths.fakedeletecoffeeid.FakedeletecoffeeidDelete; - -public class Fake extends ApiClient implements - FakejsonpatchPatch.JsonPatchOperation, - FakerefsarrayofenumsPost.ArrayOfEnumsOperation, - CommonparamsubdirDelete.DeleteCommonParamOperation, - CommonparamsubdirGet.GetCommonParamOperation, - CommonparamsubdirPost.PostCommonParamOperation, - FakecasesensitiveparamsPut.CaseSensitiveParamsOperation, - FakewildcardresponsesGet.WildCardResponsesOperation, - FakebodywithqueryparamsPut.BodyWithQueryParamsOperation, - FakejsonwithcharsetPost.JsonWithCharsetOperation, - FakerefsarraymodelPost.ArrayModelOperation, - FakehealthGet.FakeHealthGetOperation, - FakerefscomposedoneofnumberwithvalidationsPost.ComposedOneOfDifferentTypesOperation, - FakerefobjinqueryGet.RefObjectInQueryOperation, - FakebodywithfileschemaPut.BodyWithFileSchemaOperation, - FakerefsenumPost.StringEnumOperation, - FakeredirectionGet.RedirectionOperation, - FakeuploadfilePost.UploadFileOperation, - FakeinlinecompositionPost.InlineCompositionOperation, - FakeDelete.GroupParametersOperation, - FakeGet.EnumParametersOperation, - FakePatch.ClientModelOperation, - FakePost.EndpointParametersOperation, - FakerefsobjectmodelwithrefpropsPost.ObjectModelWithRefPropsOperation, - FakepemcontenttypeGet.PemContentTypeOperation, - FakerefsnumberPost.NumberWithValidationsOperation, - FakerefsstringPost.ModelStringOperation, - FakeinlineadditionalpropertiesPost.InlineAdditionalPropertiesOperation, - FakerefsmammalPost.MammalOperation, - SolidusGet.SlashRouteOperation, - FakerefsbooleanPost.ModelBooleanOperation, - FakejsonformdataGet.JsonFormDataOperation, - Fakeparametercollisions1ababselfabPost.ParameterCollisionsOperation, - FakequeryparamwithjsoncontenttypeGet.QueryParamWithJsonContentTypeOperation, - FakeobjinqueryGet.ObjectInQueryOperation, - FakemultiplesecuritiesGet.MultipleSecuritiesOperation, - FaketestqueryparamtersPut.QueryParameterCollectionFormatOperation, - FakemultipleresponsebodiesGet.MultipleResponseBodiesOperation, - FakeresponsewithoutschemaGet.ResponseWithoutSchemaOperation, - FakemultiplerequestbodycontenttypesPost.MultipleRequestBodyContentTypesOperation, - FakeuploaddownloadfilePost.UploadDownloadFileOperation, - FakeuploadfilesPost.UploadFilesOperation, - FakeadditionalpropertieswitharrayofenumsGet.AdditionalPropertiesWithArrayOfEnumsOperation, - FakedeletecoffeeidDelete.DeleteCoffeeOperation -{ - public Fake(ApiConfiguration apiConfiguration, SchemaConfiguration schemaConfiguration) { - super(apiConfiguration, schemaConfiguration); - } -} \ No newline at end of file diff --git a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/apis/tags/Fakeclassnametags123.kt b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/apis/tags/Fakeclassnametags123.kt deleted file mode 100644 index 2a727a57e08..00000000000 --- a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/apis/tags/Fakeclassnametags123.kt +++ /dev/null @@ -1,14 +0,0 @@ -package org.openapijsonschematools.client.apis.tags; - -import org.openapijsonschematools.client.apiclient.ApiClient; -import org.openapijsonschematools.client.configurations.ApiConfiguration; -import org.openapijsonschematools.client.configurations.SchemaConfiguration; -import org.openapijsonschematools.client.paths.fakeclassnametest.FakeclassnametestPatch; - -public class Fakeclassnametags123 extends ApiClient implements - FakeclassnametestPatch.ClassnameOperation -{ - public Fakeclassnametags123(ApiConfiguration apiConfiguration, SchemaConfiguration schemaConfiguration) { - super(apiConfiguration, schemaConfiguration); - } -} \ No newline at end of file diff --git a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/apis/tags/Pet.kt b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/apis/tags/Pet.kt deleted file mode 100644 index 5c0c6e39569..00000000000 --- a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/apis/tags/Pet.kt +++ /dev/null @@ -1,30 +0,0 @@ -package org.openapijsonschematools.client.apis.tags; - -import org.openapijsonschematools.client.apiclient.ApiClient; -import org.openapijsonschematools.client.configurations.ApiConfiguration; -import org.openapijsonschematools.client.configurations.SchemaConfiguration; -import org.openapijsonschematools.client.paths.fakepetiduploadimagewithrequiredfile.FakepetiduploadimagewithrequiredfilePost; -import org.openapijsonschematools.client.paths.pet.PetPost; -import org.openapijsonschematools.client.paths.pet.PetPut; -import org.openapijsonschematools.client.paths.petfindbytags.PetfindbytagsGet; -import org.openapijsonschematools.client.paths.petfindbystatus.PetfindbystatusGet; -import org.openapijsonschematools.client.paths.petpetiduploadimage.PetpetiduploadimagePost; -import org.openapijsonschematools.client.paths.petpetid.PetpetidDelete; -import org.openapijsonschematools.client.paths.petpetid.PetpetidGet; -import org.openapijsonschematools.client.paths.petpetid.PetpetidPost; - -public class Pet extends ApiClient implements - FakepetiduploadimagewithrequiredfilePost.UploadFileWithRequiredFileOperation, - PetPost.AddPetOperation, - PetPut.UpdatePetOperation, - PetfindbytagsGet.FindPetsByTagsOperation, - PetfindbystatusGet.FindPetsByStatusOperation, - PetpetiduploadimagePost.UploadImageOperation, - PetpetidDelete.DeletePetOperation, - PetpetidGet.GetPetByIdOperation, - PetpetidPost.UpdatePetWithFormOperation -{ - public Pet(ApiConfiguration apiConfiguration, SchemaConfiguration schemaConfiguration) { - super(apiConfiguration, schemaConfiguration); - } -} \ No newline at end of file diff --git a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/apis/tags/Store.kt b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/apis/tags/Store.kt deleted file mode 100644 index 04d51443ec5..00000000000 --- a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/apis/tags/Store.kt +++ /dev/null @@ -1,20 +0,0 @@ -package org.openapijsonschematools.client.apis.tags; - -import org.openapijsonschematools.client.apiclient.ApiClient; -import org.openapijsonschematools.client.configurations.ApiConfiguration; -import org.openapijsonschematools.client.configurations.SchemaConfiguration; -import org.openapijsonschematools.client.paths.storeinventory.StoreinventoryGet; -import org.openapijsonschematools.client.paths.storeorderorderid.StoreorderorderidDelete; -import org.openapijsonschematools.client.paths.storeorderorderid.StoreorderorderidGet; -import org.openapijsonschematools.client.paths.storeorder.StoreorderPost; - -public class Store extends ApiClient implements - StoreinventoryGet.GetInventoryOperation, - StoreorderorderidDelete.DeleteOrderOperation, - StoreorderorderidGet.GetOrderByIdOperation, - StoreorderPost.PlaceOrderOperation -{ - public Store(ApiConfiguration apiConfiguration, SchemaConfiguration schemaConfiguration) { - super(apiConfiguration, schemaConfiguration); - } -} \ No newline at end of file diff --git a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/apis/tags/User.kt b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/apis/tags/User.kt deleted file mode 100644 index f8c47d501e1..00000000000 --- a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/apis/tags/User.kt +++ /dev/null @@ -1,28 +0,0 @@ -package org.openapijsonschematools.client.apis.tags; - -import org.openapijsonschematools.client.apiclient.ApiClient; -import org.openapijsonschematools.client.configurations.ApiConfiguration; -import org.openapijsonschematools.client.configurations.SchemaConfiguration; -import org.openapijsonschematools.client.paths.userlogout.UserlogoutGet; -import org.openapijsonschematools.client.paths.usercreatewitharray.UsercreatewitharrayPost; -import org.openapijsonschematools.client.paths.user.UserPost; -import org.openapijsonschematools.client.paths.userlogin.UserloginGet; -import org.openapijsonschematools.client.paths.userusername.UserusernameDelete; -import org.openapijsonschematools.client.paths.userusername.UserusernameGet; -import org.openapijsonschematools.client.paths.userusername.UserusernamePut; -import org.openapijsonschematools.client.paths.usercreatewithlist.UsercreatewithlistPost; - -public class User extends ApiClient implements - UserlogoutGet.LogoutUserOperation, - UsercreatewitharrayPost.CreateUsersWithArrayInputOperation, - UserPost.CreateUserOperation, - UserloginGet.LoginUserOperation, - UserusernameDelete.DeleteUserOperation, - UserusernameGet.GetUserByNameOperation, - UserusernamePut.UpdateUserOperation, - UsercreatewithlistPost.CreateUsersWithListInputOperation -{ - public User(ApiConfiguration apiConfiguration, SchemaConfiguration schemaConfiguration) { - super(apiConfiguration, schemaConfiguration); - } -} \ No newline at end of file diff --git a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/headers/Int32JsonContentTypeHeader.kt b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/headers/Int32JsonContentTypeHeader.kt deleted file mode 100644 index 298d3fcd6b9..00000000000 --- a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/headers/Int32JsonContentTypeHeader.kt +++ /dev/null @@ -1,31 +0,0 @@ -package org.openapijsonschematools.client.components.headers; - -import org.openapijsonschematools.client.header.ContentHeader; -import org.openapijsonschematools.client.mediatype.MediaType; -import org.openapijsonschematools.client.components.headers.int32jsoncontenttypeheader.content.applicationjson.Int32JsonContentTypeHeaderSchema; - -import java.util.AbstractMap; - -public class Int32JsonContentTypeHeader { - - public record ApplicationjsonMediaType(Int32JsonContentTypeHeaderSchema.Int32JsonContentTypeHeaderSchema1 schema) implements MediaType { - public ApplicationjsonMediaType() { - this(Int32JsonContentTypeHeaderSchema.Int32JsonContentTypeHeaderSchema1.getInstance()); - } - @Override - public Nothing? encoding() { - return null; - } - } - - public static class Int32JsonContentTypeHeader1 extends ContentHeader { - public Int32JsonContentTypeHeader1() { - super( - true, - null, - false, - new AbstractMap.SimpleEntry<>("application/json", new ApplicationjsonMediaType()) - ); - } - } -} diff --git a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/headers/NumberHeader.kt b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/headers/NumberHeader.kt deleted file mode 100644 index 703f95cd089..00000000000 --- a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/headers/NumberHeader.kt +++ /dev/null @@ -1,18 +0,0 @@ -package org.openapijsonschematools.client.components.headers; - -import org.openapijsonschematools.client.header.SchemaHeader; -import org.openapijsonschematools.client.components.headers.numberheader.NumberHeaderSchema; - -public class NumberHeader { - - public static class NumberHeader1 extends SchemaHeader { - public NumberHeader1() { - super( - false, - null, - false, - NumberHeaderSchema.NumberHeaderSchema1.getInstance() - ); - } - } -} diff --git a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/headers/RefContentSchemaHeader.kt b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/headers/RefContentSchemaHeader.kt deleted file mode 100644 index 3d0ce933eae..00000000000 --- a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/headers/RefContentSchemaHeader.kt +++ /dev/null @@ -1,31 +0,0 @@ -package org.openapijsonschematools.client.components.headers; - -import org.openapijsonschematools.client.header.ContentHeader; -import org.openapijsonschematools.client.mediatype.MediaType; -import org.openapijsonschematools.client.components.headers.refcontentschemaheader.content.applicationjson.RefContentSchemaHeaderSchema; - -import java.util.AbstractMap; - -public class RefContentSchemaHeader { - - public record ApplicationjsonMediaType(RefContentSchemaHeaderSchema.RefContentSchemaHeaderSchema1 schema) implements MediaType { - public ApplicationjsonMediaType() { - this(RefContentSchemaHeaderSchema.RefContentSchemaHeaderSchema1.getInstance()); - } - @Override - public Nothing? encoding() { - return null; - } - } - - public static class RefContentSchemaHeader1 extends ContentHeader { - public RefContentSchemaHeader1() { - super( - true, - null, - false, - new AbstractMap.SimpleEntry<>("application/json", new ApplicationjsonMediaType()) - ); - } - } -} diff --git a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/headers/RefSchemaHeader.kt b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/headers/RefSchemaHeader.kt deleted file mode 100644 index 21487d79b1f..00000000000 --- a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/headers/RefSchemaHeader.kt +++ /dev/null @@ -1,18 +0,0 @@ -package org.openapijsonschematools.client.components.headers; - -import org.openapijsonschematools.client.header.SchemaHeader; -import org.openapijsonschematools.client.components.headers.refschemaheader.RefSchemaHeaderSchema; - -public class RefSchemaHeader { - - public static class RefSchemaHeader1 extends SchemaHeader { - public RefSchemaHeader1() { - super( - true, - null, - false, - RefSchemaHeaderSchema.RefSchemaHeaderSchema1.getInstance() - ); - } - } -} diff --git a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/headers/RefStringHeader.kt b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/headers/RefStringHeader.kt deleted file mode 100644 index ef2dde6549f..00000000000 --- a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/headers/RefStringHeader.kt +++ /dev/null @@ -1,6 +0,0 @@ -package org.openapijsonschematools.client.components.headers; - - -public class RefStringHeader extends StringHeader { - public static class RefStringHeader1 extends StringHeader1 {} -} diff --git a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/headers/StringHeader.kt b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/headers/StringHeader.kt deleted file mode 100644 index ce2701d1c66..00000000000 --- a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/headers/StringHeader.kt +++ /dev/null @@ -1,18 +0,0 @@ -package org.openapijsonschematools.client.components.headers; - -import org.openapijsonschematools.client.header.SchemaHeader; -import org.openapijsonschematools.client.components.headers.stringheader.StringHeaderSchema; - -public class StringHeader { - - public static class StringHeader1 extends SchemaHeader { - public StringHeader1() { - super( - true, - null, - false, - StringHeaderSchema.StringHeaderSchema1.getInstance() - ); - } - } -} diff --git a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/headers/int32jsoncontenttypeheader/content/applicationjson/Int32JsonContentTypeHeaderSchema.kt b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/headers/int32jsoncontenttypeheader/content/applicationjson/Int32JsonContentTypeHeaderSchema.kt deleted file mode 100644 index 820e50bb2c8..00000000000 --- a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/headers/int32jsoncontenttypeheader/content/applicationjson/Int32JsonContentTypeHeaderSchema.kt +++ /dev/null @@ -1,19 +0,0 @@ -package org.openapijsonschematools.client.components.headers.int32jsoncontenttypeheader.content.applicationjson; -import org.checkerframework.checker.nullness.qual.Nullable; -import org.openapijsonschematools.client.schemas.Int32JsonSchema; - -public class Int32JsonContentTypeHeaderSchema extends Int32JsonSchema { - // nest classes so all schemas and input/output classes can be public - - - public static class Int32JsonContentTypeHeaderSchema1 extends Int32JsonSchema.Int32JsonSchema1 { - private static @Nullable Int32JsonContentTypeHeaderSchema1 instance = null; - public static Int32JsonContentTypeHeaderSchema1 getInstance() { - if (instance == null) { - instance = new Int32JsonContentTypeHeaderSchema1(); - } - return instance; - } - } - -} diff --git a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/headers/numberheader/NumberHeaderSchema.kt b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/headers/numberheader/NumberHeaderSchema.kt deleted file mode 100644 index ba135e61f6d..00000000000 --- a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/headers/numberheader/NumberHeaderSchema.kt +++ /dev/null @@ -1,19 +0,0 @@ -package org.openapijsonschematools.client.components.headers.numberheader; -import org.checkerframework.checker.nullness.qual.Nullable; -import org.openapijsonschematools.client.schemas.DecimalJsonSchema; - -public class NumberHeaderSchema extends DecimalJsonSchema { - // nest classes so all schemas and input/output classes can be public - - - public static class NumberHeaderSchema1 extends DecimalJsonSchema.DecimalJsonSchema1 { - private static @Nullable NumberHeaderSchema1 instance = null; - public static NumberHeaderSchema1 getInstance() { - if (instance == null) { - instance = new NumberHeaderSchema1(); - } - return instance; - } - } - -} diff --git a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/headers/refcontentschemaheader/content/applicationjson/RefContentSchemaHeaderSchema.kt b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/headers/refcontentschemaheader/content/applicationjson/RefContentSchemaHeaderSchema.kt deleted file mode 100644 index 9d4202c7d98..00000000000 --- a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/headers/refcontentschemaheader/content/applicationjson/RefContentSchemaHeaderSchema.kt +++ /dev/null @@ -1,19 +0,0 @@ -package org.openapijsonschematools.client.components.headers.refcontentschemaheader.content.applicationjson; - -import org.checkerframework.checker.nullness.qual.Nullable; -import org.openapijsonschematools.client.components.schemas.StringWithValidation; - -public class RefContentSchemaHeaderSchema extends StringWithValidation { - // $refed class - - - public static class RefContentSchemaHeaderSchema1 extends StringWithValidation1 { - private static @Nullable RefContentSchemaHeaderSchema1 instance = null; - public static RefContentSchemaHeaderSchema1 getInstance() { - if (instance == null) { - instance = new RefContentSchemaHeaderSchema1(); - } - return instance; - } - } -} diff --git a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/headers/refschemaheader/RefSchemaHeaderSchema.kt b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/headers/refschemaheader/RefSchemaHeaderSchema.kt deleted file mode 100644 index 23f9dfa54bd..00000000000 --- a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/headers/refschemaheader/RefSchemaHeaderSchema.kt +++ /dev/null @@ -1,19 +0,0 @@ -package org.openapijsonschematools.client.components.headers.refschemaheader; - -import org.checkerframework.checker.nullness.qual.Nullable; -import org.openapijsonschematools.client.components.schemas.StringWithValidation; - -public class RefSchemaHeaderSchema extends StringWithValidation { - // $refed class - - - public static class RefSchemaHeaderSchema1 extends StringWithValidation1 { - private static @Nullable RefSchemaHeaderSchema1 instance = null; - public static RefSchemaHeaderSchema1 getInstance() { - if (instance == null) { - instance = new RefSchemaHeaderSchema1(); - } - return instance; - } - } -} diff --git a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/headers/stringheader/StringHeaderSchema.kt b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/headers/stringheader/StringHeaderSchema.kt deleted file mode 100644 index 57855e645f7..00000000000 --- a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/headers/stringheader/StringHeaderSchema.kt +++ /dev/null @@ -1,19 +0,0 @@ -package org.openapijsonschematools.client.components.headers.stringheader; -import org.checkerframework.checker.nullness.qual.Nullable; -import org.openapijsonschematools.client.schemas.StringJsonSchema; - -public class StringHeaderSchema extends StringJsonSchema { - // nest classes so all schemas and input/output classes can be public - - - public static class StringHeaderSchema1 extends StringJsonSchema.StringJsonSchema1 { - private static @Nullable StringHeaderSchema1 instance = null; - public static StringHeaderSchema1 getInstance() { - if (instance == null) { - instance = new StringHeaderSchema1(); - } - return instance; - } - } - -} diff --git a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/parameters/ComponentRefSchemaStringWithValidation.kt b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/parameters/ComponentRefSchemaStringWithValidation.kt deleted file mode 100644 index eb055645374..00000000000 --- a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/parameters/ComponentRefSchemaStringWithValidation.kt +++ /dev/null @@ -1,35 +0,0 @@ -package org.openapijsonschematools.client.components.parameters; - -import org.openapijsonschematools.client.parameter.ParameterInType; -import org.openapijsonschematools.client.parameter.ContentParameter; -import org.openapijsonschematools.client.mediatype.MediaType; -import org.openapijsonschematools.client.components.parameters.componentrefschemastringwithvalidation.content.applicationjson.ApplicationjsonSchema; - -import java.util.AbstractMap; - -public class ComponentRefSchemaStringWithValidation { - - public record ApplicationjsonMediaType(ApplicationjsonSchema.ApplicationjsonSchema1 schema) implements MediaType { - public ApplicationjsonMediaType() { - this(ApplicationjsonSchema.ApplicationjsonSchema1.getInstance()); - } - @Override - public Nothing? encoding() { - return null; - } - } - - public static class ComponentRefSchemaStringWithValidation1 extends ContentParameter { - public ComponentRefSchemaStringWithValidation1() { - super( - "CRSstringWithValidation", - ParameterInType.PATH, - true, - null, - null, - false, - new AbstractMap.SimpleEntry<>("application/json", new ApplicationjsonMediaType()) - ); - } - } -} diff --git a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/parameters/PathUserName.kt b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/parameters/PathUserName.kt deleted file mode 100644 index 4fb19f6d4a7..00000000000 --- a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/parameters/PathUserName.kt +++ /dev/null @@ -1,23 +0,0 @@ -package org.openapijsonschematools.client.components.parameters; - -import org.openapijsonschematools.client.parameter.ParameterStyle; -import org.openapijsonschematools.client.parameter.ParameterInType; -import org.openapijsonschematools.client.parameter.SchemaParameter; -import org.openapijsonschematools.client.components.parameters.pathusername.Schema; - -public class PathUserName { - - public static class PathUserName1 extends SchemaParameter { - public PathUserName1() { - super( - "username", - ParameterInType.PATH, - true, - ParameterStyle.SIMPLE, - false, - false, - Schema.Schema1.getInstance() - ); - } - } -} diff --git a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/parameters/RefPathUserName.kt b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/parameters/RefPathUserName.kt deleted file mode 100644 index b6547f8af52..00000000000 --- a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/parameters/RefPathUserName.kt +++ /dev/null @@ -1,6 +0,0 @@ -package org.openapijsonschematools.client.components.parameters; - - -public class RefPathUserName extends PathUserName { - public static class RefPathUserName1 extends PathUserName1 {} -} diff --git a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/parameters/RefSchemaStringWithValidation.kt b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/parameters/RefSchemaStringWithValidation.kt deleted file mode 100644 index 20939147771..00000000000 --- a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/parameters/RefSchemaStringWithValidation.kt +++ /dev/null @@ -1,23 +0,0 @@ -package org.openapijsonschematools.client.components.parameters; - -import org.openapijsonschematools.client.parameter.ParameterStyle; -import org.openapijsonschematools.client.parameter.ParameterInType; -import org.openapijsonschematools.client.parameter.SchemaParameter; -import org.openapijsonschematools.client.components.parameters.refschemastringwithvalidation.Schema; - -public class RefSchemaStringWithValidation { - - public static class RefSchemaStringWithValidation1 extends SchemaParameter { - public RefSchemaStringWithValidation1() { - super( - "RSstringWithValidation", - ParameterInType.PATH, - true, - ParameterStyle.SIMPLE, - false, - false, - Schema.Schema1.getInstance() - ); - } - } -} diff --git a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/parameters/componentrefschemastringwithvalidation/content/applicationjson/ApplicationjsonSchema.kt b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/parameters/componentrefschemastringwithvalidation/content/applicationjson/ApplicationjsonSchema.kt deleted file mode 100644 index e99d0dbcb4a..00000000000 --- a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/parameters/componentrefschemastringwithvalidation/content/applicationjson/ApplicationjsonSchema.kt +++ /dev/null @@ -1,19 +0,0 @@ -package org.openapijsonschematools.client.components.parameters.componentrefschemastringwithvalidation.content.applicationjson; - -import org.checkerframework.checker.nullness.qual.Nullable; -import org.openapijsonschematools.client.components.schemas.StringWithValidation; - -public class ApplicationjsonSchema extends StringWithValidation { - // $refed class - - - public static class ApplicationjsonSchema1 extends StringWithValidation1 { - private static @Nullable ApplicationjsonSchema1 instance = null; - public static ApplicationjsonSchema1 getInstance() { - if (instance == null) { - instance = new ApplicationjsonSchema1(); - } - return instance; - } - } -} diff --git a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/parameters/pathusername/Schema.kt b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/parameters/pathusername/Schema.kt deleted file mode 100644 index 4dd7d5e772b..00000000000 --- a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/parameters/pathusername/Schema.kt +++ /dev/null @@ -1,19 +0,0 @@ -package org.openapijsonschematools.client.components.parameters.pathusername; -import org.checkerframework.checker.nullness.qual.Nullable; -import org.openapijsonschematools.client.schemas.StringJsonSchema; - -public class Schema extends StringJsonSchema { - // nest classes so all schemas and input/output classes can be public - - - public static class Schema1 extends StringJsonSchema.StringJsonSchema1 { - private static @Nullable Schema1 instance = null; - public static Schema1 getInstance() { - if (instance == null) { - instance = new Schema1(); - } - return instance; - } - } - -} diff --git a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/parameters/refschemastringwithvalidation/Schema.kt b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/parameters/refschemastringwithvalidation/Schema.kt deleted file mode 100644 index e812e290473..00000000000 --- a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/parameters/refschemastringwithvalidation/Schema.kt +++ /dev/null @@ -1,19 +0,0 @@ -package org.openapijsonschematools.client.components.parameters.refschemastringwithvalidation; - -import org.checkerframework.checker.nullness.qual.Nullable; -import org.openapijsonschematools.client.components.schemas.StringWithValidation; - -public class Schema extends StringWithValidation { - // $refed class - - - public static class Schema1 extends StringWithValidation1 { - private static @Nullable Schema1 instance = null; - public static Schema1 getInstance() { - if (instance == null) { - instance = new Schema1(); - } - return instance; - } - } -} diff --git a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/requestbodies/Client.kt b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/requestbodies/Client.kt deleted file mode 100644 index 8401f082008..00000000000 --- a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/requestbodies/Client.kt +++ /dev/null @@ -1,49 +0,0 @@ -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; -import org.openapijsonschematools.client.mediatype.MediaType; -import org.openapijsonschematools.client.components.requestbodies.client.content.applicationjson.ApplicationjsonSchema; - -import java.util.AbstractMap; -import java.util.Map; - -public class Client { - public sealed interface SealedMediaType permits ApplicationjsonMediaType {} - - public record ApplicationjsonMediaType(ApplicationjsonSchema.ApplicationjsonSchema1 schema) implements SealedMediaType, MediaType { - public ApplicationjsonMediaType() { - this(ApplicationjsonSchema.ApplicationjsonSchema1.getInstance()); - } - @Override - public Nothing? encoding() { - return null; - } - } - - public static class Client1 extends RequestBodySerializer { - public Client1() { - super( - Map.ofEntries( - new AbstractMap.SimpleEntry<>("application/json", new ApplicationjsonMediaType()) - ), - true - ); - } - - public SerializedRequestBody serialize(SealedRequestBody requestBody) throws NotImplementedException { - ApplicationjsonRequestBody requestBody0 = (ApplicationjsonRequestBody) requestBody; - return serialize(requestBody0.contentType(), requestBody0.body().getData()); - } - } - - public sealed interface SealedRequestBody permits ApplicationjsonRequestBody {} - public record ApplicationjsonRequestBody(ApplicationjsonSchema.Client1Boxed body) implements SealedRequestBody, GenericRequestBody { - @Override - public String contentType() { - return "application/json"; - } - } -} diff --git a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/requestbodies/Pet.kt b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/requestbodies/Pet.kt deleted file mode 100644 index 0df3a51cc6b..00000000000 --- a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/requestbodies/Pet.kt +++ /dev/null @@ -1,71 +0,0 @@ -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; -import org.openapijsonschematools.client.mediatype.MediaType; -import org.openapijsonschematools.client.components.requestbodies.pet.content.applicationjson.ApplicationjsonSchema; -import org.openapijsonschematools.client.components.requestbodies.pet.content.applicationxml.ApplicationxmlSchema; - -import java.util.AbstractMap; -import java.util.Map; - -public class Pet { - public sealed interface SealedMediaType permits ApplicationjsonMediaType, ApplicationxmlMediaType {} - - public record ApplicationjsonMediaType(ApplicationjsonSchema.ApplicationjsonSchema1 schema) implements SealedMediaType, MediaType { - public ApplicationjsonMediaType() { - this(ApplicationjsonSchema.ApplicationjsonSchema1.getInstance()); - } - @Override - public Nothing? encoding() { - return null; - } - } - - public record ApplicationxmlMediaType(ApplicationxmlSchema.ApplicationxmlSchema1 schema) implements SealedMediaType, MediaType { - public ApplicationxmlMediaType() { - this(ApplicationxmlSchema.ApplicationxmlSchema1.getInstance()); - } - @Override - public Nothing? encoding() { - return null; - } - } - - public static class Pet1 extends RequestBodySerializer { - public Pet1() { - super( - Map.ofEntries( - new AbstractMap.SimpleEntry<>("application/json", new ApplicationjsonMediaType()), - new AbstractMap.SimpleEntry<>("application/xml", new ApplicationxmlMediaType()) - ), - true - ); - } - - public SerializedRequestBody serialize(SealedRequestBody requestBody) throws NotImplementedException { - if (requestBody instanceof ApplicationjsonRequestBody requestBody0) { - return serialize(requestBody0.contentType(), requestBody0.body().getData()); - } else { - ApplicationxmlRequestBody requestBody1 = (ApplicationxmlRequestBody) requestBody; - return serialize(requestBody1.contentType(), requestBody1.body().getData()); - } - } - } - - public sealed interface SealedRequestBody permits ApplicationjsonRequestBody, ApplicationxmlRequestBody {} - public record ApplicationjsonRequestBody(ApplicationjsonSchema.Pet1Boxed body) implements SealedRequestBody, GenericRequestBody { - @Override - public String contentType() { - return "application/json"; - } - } - public record ApplicationxmlRequestBody(ApplicationxmlSchema.Pet1Boxed body) implements SealedRequestBody, GenericRequestBody { - @Override - public String contentType() { - return "application/xml"; - } - } -} diff --git a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/requestbodies/RefUserArray.kt b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/requestbodies/RefUserArray.kt deleted file mode 100644 index 5b4af4408d0..00000000000 --- a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/requestbodies/RefUserArray.kt +++ /dev/null @@ -1,6 +0,0 @@ -package org.openapijsonschematools.client.components.requestbodies; - - -public class RefUserArray extends UserArray { - public static class RefUserArray1 extends UserArray1 {} -} diff --git a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/requestbodies/UserArray.kt b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/requestbodies/UserArray.kt deleted file mode 100644 index 25fc82c45c2..00000000000 --- a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/requestbodies/UserArray.kt +++ /dev/null @@ -1,49 +0,0 @@ -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; -import org.openapijsonschematools.client.mediatype.MediaType; -import org.openapijsonschematools.client.components.requestbodies.userarray.content.applicationjson.ApplicationjsonSchema; - -import java.util.AbstractMap; -import java.util.Map; - -public class UserArray { - public sealed interface SealedMediaType permits ApplicationjsonMediaType {} - - public record ApplicationjsonMediaType(ApplicationjsonSchema.ApplicationjsonSchema1 schema) implements SealedMediaType, MediaType { - public ApplicationjsonMediaType() { - this(ApplicationjsonSchema.ApplicationjsonSchema1.getInstance()); - } - @Override - public Nothing? encoding() { - return null; - } - } - - public static class UserArray1 extends RequestBodySerializer { - public UserArray1() { - super( - Map.ofEntries( - new AbstractMap.SimpleEntry<>("application/json", new ApplicationjsonMediaType()) - ), - true - ); - } - - public SerializedRequestBody serialize(SealedRequestBody requestBody) throws NotImplementedException { - ApplicationjsonRequestBody requestBody0 = (ApplicationjsonRequestBody) requestBody; - return serialize(requestBody0.contentType(), requestBody0.body().getData()); - } - } - - public sealed interface SealedRequestBody permits ApplicationjsonRequestBody {} - public record ApplicationjsonRequestBody(ApplicationjsonSchema.ApplicationjsonSchema1Boxed body) implements SealedRequestBody, GenericRequestBody { - @Override - public String contentType() { - return "application/json"; - } - } -} diff --git a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/requestbodies/client/content/applicationjson/ApplicationjsonSchema.kt b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/requestbodies/client/content/applicationjson/ApplicationjsonSchema.kt deleted file mode 100644 index aaebccb5ab2..00000000000 --- a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/requestbodies/client/content/applicationjson/ApplicationjsonSchema.kt +++ /dev/null @@ -1,19 +0,0 @@ -package org.openapijsonschematools.client.components.requestbodies.client.content.applicationjson; - -import org.checkerframework.checker.nullness.qual.Nullable; -import org.openapijsonschematools.client.components.schemas.Client; - -public class ApplicationjsonSchema extends Client { - // $refed class - - - public static class ApplicationjsonSchema1 extends Client1 { - private static @Nullable ApplicationjsonSchema1 instance = null; - public static ApplicationjsonSchema1 getInstance() { - if (instance == null) { - instance = new ApplicationjsonSchema1(); - } - return instance; - } - } -} diff --git a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/requestbodies/pet/content/applicationjson/ApplicationjsonSchema.kt b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/requestbodies/pet/content/applicationjson/ApplicationjsonSchema.kt deleted file mode 100644 index 212fb352a2e..00000000000 --- a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/requestbodies/pet/content/applicationjson/ApplicationjsonSchema.kt +++ /dev/null @@ -1,19 +0,0 @@ -package org.openapijsonschematools.client.components.requestbodies.pet.content.applicationjson; - -import org.checkerframework.checker.nullness.qual.Nullable; -import org.openapijsonschematools.client.components.schemas.Pet; - -public class ApplicationjsonSchema extends Pet { - // $refed class - - - public static class ApplicationjsonSchema1 extends Pet1 { - private static @Nullable ApplicationjsonSchema1 instance = null; - public static ApplicationjsonSchema1 getInstance() { - if (instance == null) { - instance = new ApplicationjsonSchema1(); - } - return instance; - } - } -} diff --git a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/requestbodies/pet/content/applicationxml/ApplicationxmlSchema.kt b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/requestbodies/pet/content/applicationxml/ApplicationxmlSchema.kt deleted file mode 100644 index dd16e13e321..00000000000 --- a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/requestbodies/pet/content/applicationxml/ApplicationxmlSchema.kt +++ /dev/null @@ -1,20 +0,0 @@ -package org.openapijsonschematools.client.components.requestbodies.pet.content.applicationxml; - -import org.checkerframework.checker.nullness.qual.Nullable; -import org.openapijsonschematools.client.components.schemas.Pet; -import org.openapijsonschematools.client.components.schemas.RefPet; - -public class ApplicationxmlSchema extends RefPet { - // $refed class - - - public static class ApplicationxmlSchema1 extends Pet1 { - private static @Nullable ApplicationxmlSchema1 instance = null; - public static ApplicationxmlSchema1 getInstance() { - if (instance == null) { - instance = new ApplicationxmlSchema1(); - } - return instance; - } - } -} diff --git a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/requestbodies/userarray/content/applicationjson/ApplicationjsonSchema.kt b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/requestbodies/userarray/content/applicationjson/ApplicationjsonSchema.kt deleted file mode 100644 index 1cfab7e9e11..00000000000 --- a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/requestbodies/userarray/content/applicationjson/ApplicationjsonSchema.kt +++ /dev/null @@ -1,148 +0,0 @@ -package org.openapijsonschematools.client.components.requestbodies.userarray.content.applicationjson; -import java.util.ArrayList; -import java.util.HashSet; -import java.util.LinkedHashMap; -import java.util.LinkedHashSet; -import java.util.List; -import java.util.Map; -import java.util.Objects; -import java.util.Set; -import org.checkerframework.checker.nullness.qual.Nullable; -import org.openapijsonschematools.client.components.schemas.User; -import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags; -import org.openapijsonschematools.client.configurations.SchemaConfiguration; -import org.openapijsonschematools.client.exceptions.ValidationException; -import org.openapijsonschematools.client.schemas.validation.FrozenList; -import org.openapijsonschematools.client.schemas.validation.FrozenMap; -import org.openapijsonschematools.client.schemas.validation.JsonSchema; -import org.openapijsonschematools.client.schemas.validation.JsonSchemaInfo; -import org.openapijsonschematools.client.schemas.validation.ListSchemaValidator; -import org.openapijsonschematools.client.schemas.validation.PathToSchemasMap; -import org.openapijsonschematools.client.schemas.validation.ValidationMetadata; - -public class ApplicationjsonSchema { - // nest classes so all schemas and input/output classes can be public - - - public static class ApplicationjsonSchemaList extends FrozenList { - protected ApplicationjsonSchemaList(FrozenList m) { - super(m); - } - public static ApplicationjsonSchemaList of(List> arg, SchemaConfiguration configuration) throws ValidationException { - return ApplicationjsonSchema1.getInstance().validate(arg, configuration); - } - } - - public static class ApplicationjsonSchemaListBuilder { - // class to build List> - private final List> list; - - public ApplicationjsonSchemaListBuilder() { - list = new ArrayList<>(); - } - - public ApplicationjsonSchemaListBuilder(List> list) { - this.list = list; - } - - public ApplicationjsonSchemaListBuilder add(Map item) { - list.add(item); - return this; - } - - public List> build() { - return list; - } - } - - - public sealed interface ApplicationjsonSchema1Boxed permits ApplicationjsonSchema1BoxedList { - @Nullable Object getData(); - } - - public record ApplicationjsonSchema1BoxedList(ApplicationjsonSchemaList data) implements ApplicationjsonSchema1Boxed { - @Override - public @Nullable Object getData() { - return data; - } - } - - - - public static class ApplicationjsonSchema1 extends JsonSchema implements ListSchemaValidator { - private static @Nullable ApplicationjsonSchema1 instance = null; - - protected ApplicationjsonSchema1() { - super(new JsonSchemaInfo() - .type(Set.of(List.class)) - .items(User.User1.class) - ); - } - - public static ApplicationjsonSchema1 getInstance() { - if (instance == null) { - instance = new ApplicationjsonSchema1(); - } - return instance; - } - - @Override - public ApplicationjsonSchemaList getNewInstance(List arg, List pathToItem, PathToSchemasMap pathToSchemas) { - List items = new ArrayList<>(); - int i = 0; - for (Object item: arg) { - List itemPathToItem = new ArrayList<>(pathToItem); - itemPathToItem.add(i); - LinkedHashMap, Nothing?> schemas = pathToSchemas.get(itemPathToItem); - if (schemas == null) { - throw new RuntimeException("Validation 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"); - } - items.add((User.UserMap) itemInstance); - i += 1; - } - FrozenList newInstanceItems = new FrozenList<>(items); - return new ApplicationjsonSchemaList(newInstanceItems); - } - - 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); - SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().build())); - ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, new PathToSchemasMap(), new LinkedHashSet<>()); - PathToSchemasMap pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet); - return getNewInstance(castArg, validationMetadata.pathToItem(), pathToSchemasMap); - } - - @Override - public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws 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"); - } - @Override - public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { - 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"); - } - @Override - 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 { - 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"); - } - } -} diff --git a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/responses/HeadersWithNoBody.kt b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/responses/HeadersWithNoBody.kt deleted file mode 100644 index 6b4b40d824e..00000000000 --- a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/responses/HeadersWithNoBody.kt +++ /dev/null @@ -1,47 +0,0 @@ -package org.openapijsonschematools.client.components.responses; - -import org.openapijsonschematools.client.configurations.SchemaConfiguration; -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; - -import java.util.Map; -import java.net.http.HttpResponse; -import java.net.http.HttpHeaders; - -public class HeadersWithNoBody { - - public static class HeadersWithNoBody1 extends ResponseDeserializer { - public HeadersWithNoBody1() { - super( - MapUtils.makeMap( - ) - ); - } - - @Override - protected Nothing? getBody(String contentType, Nothing? mediaType, byte[] body, SchemaConfiguration configuration) { - return null; - } - - @Override - protected HeadersWithNoBodyHeadersSchema.HeadersWithNoBodyHeadersSchemaMap getHeaders(HttpHeaders headers, SchemaConfiguration configuration) throws ValidationException, NotImplementedException { - return new Headers().deserialize(headers, configuration); - } - } - - @SuppressWarnings("serial") - public static class ResponseApiException extends ApiException { - public DeserializedHttpResponse deserializedResponse; - - public ResponseApiException(String s, HttpResponse response, DeserializedHttpResponse deserializedResponse) { - super(s, response); - this.deserializedResponse = deserializedResponse; - } - } -} diff --git a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/responses/RefSuccessDescriptionOnly.kt b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/responses/RefSuccessDescriptionOnly.kt deleted file mode 100644 index 13509546a1f..00000000000 --- a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/responses/RefSuccessDescriptionOnly.kt +++ /dev/null @@ -1,6 +0,0 @@ -package org.openapijsonschematools.client.components.responses; - - -public class RefSuccessDescriptionOnly extends SuccessDescriptionOnly { - public static class RefSuccessDescriptionOnly1 extends SuccessDescriptionOnly1 {} -} diff --git a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/responses/RefSuccessfulXmlAndJsonArrayOfPet.kt b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/responses/RefSuccessfulXmlAndJsonArrayOfPet.kt deleted file mode 100644 index c4276b6db9c..00000000000 --- a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/responses/RefSuccessfulXmlAndJsonArrayOfPet.kt +++ /dev/null @@ -1,6 +0,0 @@ -package org.openapijsonschematools.client.components.responses; - - -public class RefSuccessfulXmlAndJsonArrayOfPet extends SuccessfulXmlAndJsonArrayOfPet { - public static class RefSuccessfulXmlAndJsonArrayOfPet1 extends SuccessfulXmlAndJsonArrayOfPet1 {} -} diff --git a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/responses/SuccessDescriptionOnly.kt b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/responses/SuccessDescriptionOnly.kt deleted file mode 100644 index c2760832d29..00000000000 --- a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/responses/SuccessDescriptionOnly.kt +++ /dev/null @@ -1,45 +0,0 @@ -package org.openapijsonschematools.client.components.responses; - -import org.openapijsonschematools.client.configurations.SchemaConfiguration; -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; -import java.net.http.HttpResponse; -import java.net.http.HttpHeaders; - -public class SuccessDescriptionOnly { - - public static class SuccessDescriptionOnly1 extends ResponseDeserializer { - public SuccessDescriptionOnly1() { - super( - MapUtils.makeMap( - ) - ); - } - - @Override - protected Nothing? getBody(String contentType, Nothing? mediaType, byte[] body, SchemaConfiguration configuration) { - return null; - } - - @Override - protected Nothing? getHeaders(HttpHeaders headers, SchemaConfiguration configuration) { - return null; - } - } - - @SuppressWarnings("serial") - public static class ResponseApiException extends ApiException { - public DeserializedHttpResponse deserializedResponse; - - public ResponseApiException(String s, HttpResponse response, DeserializedHttpResponse deserializedResponse) { - super(s, response); - this.deserializedResponse = deserializedResponse; - } - } -} diff --git a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/responses/SuccessInlineContentAndHeader.kt b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/responses/SuccessInlineContentAndHeader.kt deleted file mode 100644 index fb00d84450f..00000000000 --- a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/responses/SuccessInlineContentAndHeader.kt +++ /dev/null @@ -1,65 +0,0 @@ -package org.openapijsonschematools.client.components.responses; - -import org.openapijsonschematools.client.configurations.SchemaConfiguration; -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; -import org.openapijsonschematools.client.components.responses.successinlinecontentandheader.Headers; - -import java.util.AbstractMap; -import java.util.Map; -import java.net.http.HttpResponse; -import java.net.http.HttpHeaders; - -public class SuccessInlineContentAndHeader { - public sealed interface SealedMediaType permits ApplicationjsonMediaType {} - - public record ApplicationjsonMediaType(ApplicationjsonSchema.ApplicationjsonSchema1 schema) implements SealedMediaType, MediaType { - public ApplicationjsonMediaType() { - this(ApplicationjsonSchema.ApplicationjsonSchema1.getInstance()); - } - @Override - public Nothing? encoding() { - return null; - } - } - public sealed interface SealedResponseBody permits ApplicationjsonResponseBody {} - public record ApplicationjsonResponseBody(ApplicationjsonSchema.ApplicationjsonSchema1Boxed body) implements SealedResponseBody { } - - public static class SuccessInlineContentAndHeader1 extends ResponseDeserializer { - public SuccessInlineContentAndHeader1() { - super( - Map.ofEntries( - new AbstractMap.SimpleEntry<>("application/json", new ApplicationjsonMediaType()) - ) - ); - } - - @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); - } - - @Override - protected SuccessInlineContentAndHeaderHeadersSchema.SuccessInlineContentAndHeaderHeadersSchemaMap getHeaders(HttpHeaders headers, SchemaConfiguration configuration) throws ValidationException, NotImplementedException { - return new Headers().deserialize(headers, configuration); - } - } - - @SuppressWarnings("serial") - public static class ResponseApiException extends ApiException { - public DeserializedHttpResponse deserializedResponse; - - public ResponseApiException(String s, HttpResponse response, DeserializedHttpResponse deserializedResponse) { - super(s, response); - this.deserializedResponse = deserializedResponse; - } - } -} diff --git a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/responses/SuccessWithJsonApiResponse.kt b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/responses/SuccessWithJsonApiResponse.kt deleted file mode 100644 index 08fac81a2fa..00000000000 --- a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/responses/SuccessWithJsonApiResponse.kt +++ /dev/null @@ -1,65 +0,0 @@ -package org.openapijsonschematools.client.components.responses; - -import org.openapijsonschematools.client.configurations.SchemaConfiguration; -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; -import org.openapijsonschematools.client.components.responses.successwithjsonapiresponse.Headers; - -import java.util.AbstractMap; -import java.util.Map; -import java.net.http.HttpResponse; -import java.net.http.HttpHeaders; - -public class SuccessWithJsonApiResponse { - public sealed interface SealedMediaType permits ApplicationjsonMediaType {} - - public record ApplicationjsonMediaType(ApplicationjsonSchema.ApplicationjsonSchema1 schema) implements SealedMediaType, MediaType { - public ApplicationjsonMediaType() { - this(ApplicationjsonSchema.ApplicationjsonSchema1.getInstance()); - } - @Override - public Nothing? encoding() { - return null; - } - } - public sealed interface SealedResponseBody permits ApplicationjsonResponseBody {} - public record ApplicationjsonResponseBody(ApplicationjsonSchema.ApiResponseSchema1Boxed body) implements SealedResponseBody { } - - public static class SuccessWithJsonApiResponse1 extends ResponseDeserializer { - public SuccessWithJsonApiResponse1() { - super( - Map.ofEntries( - new AbstractMap.SimpleEntry<>("application/json", new ApplicationjsonMediaType()) - ) - ); - } - - @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); - } - - @Override - protected SuccessWithJsonApiResponseHeadersSchema.SuccessWithJsonApiResponseHeadersSchemaMap getHeaders(HttpHeaders headers, SchemaConfiguration configuration) throws ValidationException, NotImplementedException { - return new Headers().deserialize(headers, configuration); - } - } - - @SuppressWarnings("serial") - public static class ResponseApiException extends ApiException { - public DeserializedHttpResponse deserializedResponse; - - public ResponseApiException(String s, HttpResponse response, DeserializedHttpResponse deserializedResponse) { - super(s, response); - this.deserializedResponse = deserializedResponse; - } - } -} diff --git a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/responses/SuccessfulXmlAndJsonArrayOfPet.kt b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/responses/SuccessfulXmlAndJsonArrayOfPet.kt deleted file mode 100644 index 26526e55201..00000000000 --- a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/responses/SuccessfulXmlAndJsonArrayOfPet.kt +++ /dev/null @@ -1,81 +0,0 @@ -package org.openapijsonschematools.client.components.responses; - -import org.openapijsonschematools.client.configurations.SchemaConfiguration; -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; - -import java.util.AbstractMap; -import java.util.Map; -import java.net.http.HttpResponse; -import java.net.http.HttpHeaders; - -public class SuccessfulXmlAndJsonArrayOfPet { - public sealed interface SealedMediaType permits ApplicationxmlMediaType, ApplicationjsonMediaType {} - - public record ApplicationxmlMediaType(ApplicationxmlSchema.ApplicationxmlSchema1 schema) implements SealedMediaType, MediaType { - public ApplicationxmlMediaType() { - this(ApplicationxmlSchema.ApplicationxmlSchema1.getInstance()); - } - @Override - public Nothing? encoding() { - return null; - } - } - - public record ApplicationjsonMediaType(ApplicationjsonSchema.ApplicationjsonSchema1 schema) implements SealedMediaType, MediaType { - public ApplicationjsonMediaType() { - this(ApplicationjsonSchema.ApplicationjsonSchema1.getInstance()); - } - @Override - public Nothing? encoding() { - return null; - } - } - public sealed interface SealedResponseBody permits ApplicationxmlResponseBody, ApplicationjsonResponseBody {} - public record ApplicationxmlResponseBody(ApplicationxmlSchema.ApplicationxmlSchema1Boxed body) implements SealedResponseBody { } - public record ApplicationjsonResponseBody(ApplicationjsonSchema.ApplicationjsonSchema1Boxed body) implements SealedResponseBody { } - - public static class SuccessfulXmlAndJsonArrayOfPet1 extends ResponseDeserializer { - public SuccessfulXmlAndJsonArrayOfPet1() { - super( - Map.ofEntries( - new AbstractMap.SimpleEntry<>("application/xml", new ApplicationxmlMediaType()), - new AbstractMap.SimpleEntry<>("application/json", new ApplicationjsonMediaType()) - ) - ); - } - - @Override - 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 { - ApplicationjsonMediaType thisMediaType = (ApplicationjsonMediaType) mediaType; - var deserializedBody = deserializeBody(contentType, body, thisMediaType.schema(), configuration); - return new ApplicationjsonResponseBody(deserializedBody); - } - } - - @Override - protected Nothing? getHeaders(HttpHeaders headers, SchemaConfiguration configuration) { - return null; - } - } - - @SuppressWarnings("serial") - public static class ResponseApiException extends ApiException { - public DeserializedHttpResponse deserializedResponse; - - public ResponseApiException(String s, HttpResponse response, DeserializedHttpResponse deserializedResponse) { - super(s, response); - this.deserializedResponse = deserializedResponse; - } - } -} diff --git a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/responses/headerswithnobody/Headers.kt b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/responses/headerswithnobody/Headers.kt deleted file mode 100644 index dacfb5ee075..00000000000 --- a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/responses/headerswithnobody/Headers.kt +++ /dev/null @@ -1,18 +0,0 @@ -package org.openapijsonschematools.client.components.responses.headerswithnobody; - -import org.openapijsonschematools.client.response.HeadersDeserializer; -import org.openapijsonschematools.client.components.responses.headerswithnobody.headers.Location; - -import java.util.Map; -import java.util.AbstractMap; - -public class Headers extends HeadersDeserializer { - public Headers() { - super( - Map.ofEntries( - new AbstractMap.SimpleEntry<>("location", new Location.Location1()) - ), - HeadersWithNoBodyHeadersSchema.HeadersWithNoBodyHeadersSchema1.getInstance() - ); - } -} \ No newline at end of file diff --git a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/responses/headerswithnobody/HeadersWithNoBodyHeadersSchema.kt b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/responses/headerswithnobody/HeadersWithNoBodyHeadersSchema.kt deleted file mode 100644 index 2ee26178149..00000000000 --- a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/responses/headerswithnobody/HeadersWithNoBodyHeadersSchema.kt +++ /dev/null @@ -1,191 +0,0 @@ -package org.openapijsonschematools.client.components.responses.headerswithnobody; -import java.util.ArrayList; -import java.util.HashSet; -import java.util.LinkedHashMap; -import java.util.LinkedHashSet; -import java.util.List; -import java.util.Map; -import java.util.Objects; -import java.util.Set; -import org.checkerframework.checker.nullness.qual.Nullable; -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.UnsetPropertyException; -import org.openapijsonschematools.client.exceptions.ValidationException; -import org.openapijsonschematools.client.schemas.AnyTypeJsonSchema; -import org.openapijsonschematools.client.schemas.GenericBuilder; -import org.openapijsonschematools.client.schemas.NotAnyTypeJsonSchema; -import org.openapijsonschematools.client.schemas.validation.FrozenMap; -import org.openapijsonschematools.client.schemas.validation.JsonSchema; -import org.openapijsonschematools.client.schemas.validation.JsonSchemaInfo; -import org.openapijsonschematools.client.schemas.validation.MapSchemaValidator; -import org.openapijsonschematools.client.schemas.validation.MapUtils; -import org.openapijsonschematools.client.schemas.validation.PathToSchemasMap; -import org.openapijsonschematools.client.schemas.validation.PropertyEntry; -import org.openapijsonschematools.client.schemas.validation.ValidationMetadata; - -public class HeadersWithNoBodyHeadersSchema { - // nest classes so all schemas and input/output classes can be public - - - public static class HeadersWithNoBodyAdditionalProperties extends NotAnyTypeJsonSchema.NotAnyTypeJsonSchema1 { - // NotAnyTypeSchema - private static @Nullable HeadersWithNoBodyAdditionalProperties instance = null; - public static HeadersWithNoBodyAdditionalProperties getInstance() { - if (instance == null) { - instance = new HeadersWithNoBodyAdditionalProperties(); - } - return instance; - } - } - - - public static class HeadersWithNoBodyHeadersSchemaMap extends FrozenMap { - protected HeadersWithNoBodyHeadersSchemaMap(FrozenMap m) { - super(m); - } - public static final Set requiredKeys = Set.of(); - public static final Set optionalKeys = Set.of( - "location" - ); - public static HeadersWithNoBodyHeadersSchemaMap of(Map arg, SchemaConfiguration configuration) throws ValidationException { - return HeadersWithNoBodyHeadersSchema1.getInstance().validate(arg, configuration); - } - - public String location() throws UnsetPropertyException { - return getOrThrow("location"); - } - } - - public interface SetterForHeadersWithNoBodyLocation { - Map getInstance(); - T getBuilderAfterHeadersWithNoBodyLocation(Map instance); - - default T location(String value) { - var instance = getInstance(); - instance.put("location", value); - return getBuilderAfterHeadersWithNoBodyLocation(instance); - } - } - - public static class HeadersWithNoBodyHeadersSchemaMapBuilder implements GenericBuilder>, SetterForHeadersWithNoBodyLocation { - private final Map instance; - private static final Set knownKeys = Set.of( - "location" - ); - public Set getKnownKeys() { - return knownKeys; - } - public HeadersWithNoBodyHeadersSchemaMapBuilder() { - this.instance = new LinkedHashMap<>(); - } - public Map build() { - return instance; - } - public Map getInstance() { - return instance; - } - public HeadersWithNoBodyHeadersSchemaMapBuilder getBuilderAfterHeadersWithNoBodyLocation(Map instance) { - return this; - } - } - - - public sealed interface HeadersWithNoBodyHeadersSchema1Boxed permits HeadersWithNoBodyHeadersSchema1BoxedMap { - @Nullable Object getData(); - } - - public record HeadersWithNoBodyHeadersSchema1BoxedMap(HeadersWithNoBodyHeadersSchemaMap data) implements HeadersWithNoBodyHeadersSchema1Boxed { - @Override - public @Nullable Object getData() { - return data; - } - } - - - public static class HeadersWithNoBodyHeadersSchema1 extends JsonSchema implements MapSchemaValidator { - private static @Nullable HeadersWithNoBodyHeadersSchema1 instance = null; - - protected HeadersWithNoBodyHeadersSchema1() { - super(new JsonSchemaInfo() - .type(Set.of(Map.class)) - .properties(Map.ofEntries( - new PropertyEntry("location", LocationSchema.LocationSchema1.class) - )) - .additionalProperties(HeadersWithNoBodyAdditionalProperties.class) - ); - } - - public static HeadersWithNoBodyHeadersSchema1 getInstance() { - if (instance == null) { - instance = new HeadersWithNoBodyHeadersSchema1(); - } - return instance; - } - - 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 RuntimeException("Invalid non-string key value"); - } - String propertyName = (String) entryKey; - List propertyPathToItem = new ArrayList<>(pathToItem); - propertyPathToItem.add(propertyName); - Object value = entry.getValue(); - LinkedHashMap, Nothing?> schemas = pathToSchemas.get(propertyPathToItem); - if (schemas == null) { - throw new RuntimeException("Validation 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"); - } - properties.put(propertyName, (String) propertyInstance); - } - FrozenMap castProperties = new FrozenMap<>(properties); - return new HeadersWithNoBodyHeadersSchemaMap(castProperties); - } - - 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); - SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().build())); - ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, new PathToSchemasMap(), new LinkedHashSet<>()); - PathToSchemasMap pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet); - return getNewInstance(castArg, validationMetadata.pathToItem(), pathToSchemasMap); - } - - - @Override - public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws 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"); - } - @Override - public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { - if (arg instanceof Map) { - return getNewInstance((Map) arg, pathToItem, pathToSchemas); - } - 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 { - return new HeadersWithNoBodyHeadersSchema1BoxedMap(validate(arg, configuration)); - } - @Override - public HeadersWithNoBodyHeadersSchema1Boxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { - 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"); - } - } - -} diff --git a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/responses/headerswithnobody/headers/Location.kt b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/responses/headerswithnobody/headers/Location.kt deleted file mode 100644 index 9f172e1f922..00000000000 --- a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/responses/headerswithnobody/headers/Location.kt +++ /dev/null @@ -1,18 +0,0 @@ -package org.openapijsonschematools.client.components.responses.headerswithnobody.headers; - -import org.openapijsonschematools.client.header.SchemaHeader; -import org.openapijsonschematools.client.components.responses.headerswithnobody.headers.location.LocationSchema; - -public class Location { - - public static class Location1 extends SchemaHeader { - public Location1() { - super( - false, - null, - false, - LocationSchema.LocationSchema1.getInstance() - ); - } - } -} diff --git a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/responses/headerswithnobody/headers/location/LocationSchema.kt b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/responses/headerswithnobody/headers/location/LocationSchema.kt deleted file mode 100644 index 74b5a5f48c8..00000000000 --- a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/responses/headerswithnobody/headers/location/LocationSchema.kt +++ /dev/null @@ -1,19 +0,0 @@ -package org.openapijsonschematools.client.components.responses.headerswithnobody.headers.location; -import org.checkerframework.checker.nullness.qual.Nullable; -import org.openapijsonschematools.client.schemas.StringJsonSchema; - -public class LocationSchema extends StringJsonSchema { - // nest classes so all schemas and input/output classes can be public - - - public static class LocationSchema1 extends StringJsonSchema.StringJsonSchema1 { - private static @Nullable LocationSchema1 instance = null; - public static LocationSchema1 getInstance() { - if (instance == null) { - instance = new LocationSchema1(); - } - return instance; - } - } - -} diff --git a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/responses/successfulxmlandjsonarrayofpet/content/applicationjson/ApplicationjsonSchema.kt b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/responses/successfulxmlandjsonarrayofpet/content/applicationjson/ApplicationjsonSchema.kt deleted file mode 100644 index f9f549b50d7..00000000000 --- a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/responses/successfulxmlandjsonarrayofpet/content/applicationjson/ApplicationjsonSchema.kt +++ /dev/null @@ -1,149 +0,0 @@ -package org.openapijsonschematools.client.components.responses.successfulxmlandjsonarrayofpet.content.applicationjson; -import java.util.ArrayList; -import java.util.HashSet; -import java.util.LinkedHashMap; -import java.util.LinkedHashSet; -import java.util.List; -import java.util.Map; -import java.util.Objects; -import java.util.Set; -import org.checkerframework.checker.nullness.qual.Nullable; -import org.openapijsonschematools.client.components.schemas.Pet; -import org.openapijsonschematools.client.components.schemas.RefPet; -import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags; -import org.openapijsonschematools.client.configurations.SchemaConfiguration; -import org.openapijsonschematools.client.exceptions.ValidationException; -import org.openapijsonschematools.client.schemas.validation.FrozenList; -import org.openapijsonschematools.client.schemas.validation.FrozenMap; -import org.openapijsonschematools.client.schemas.validation.JsonSchema; -import org.openapijsonschematools.client.schemas.validation.JsonSchemaInfo; -import org.openapijsonschematools.client.schemas.validation.ListSchemaValidator; -import org.openapijsonschematools.client.schemas.validation.PathToSchemasMap; -import org.openapijsonschematools.client.schemas.validation.ValidationMetadata; - -public class ApplicationjsonSchema { - // nest classes so all schemas and input/output classes can be public - - - public static class ApplicationjsonSchemaList extends FrozenList { - protected ApplicationjsonSchemaList(FrozenList m) { - super(m); - } - public static ApplicationjsonSchemaList of(List> arg, SchemaConfiguration configuration) throws ValidationException { - return ApplicationjsonSchema1.getInstance().validate(arg, configuration); - } - } - - public static class ApplicationjsonSchemaListBuilder { - // class to build List> - private final List> list; - - public ApplicationjsonSchemaListBuilder() { - list = new ArrayList<>(); - } - - public ApplicationjsonSchemaListBuilder(List> list) { - this.list = list; - } - - public ApplicationjsonSchemaListBuilder add(Map item) { - list.add(item); - return this; - } - - public List> build() { - return list; - } - } - - - public sealed interface ApplicationjsonSchema1Boxed permits ApplicationjsonSchema1BoxedList { - @Nullable Object getData(); - } - - public record ApplicationjsonSchema1BoxedList(ApplicationjsonSchemaList data) implements ApplicationjsonSchema1Boxed { - @Override - public @Nullable Object getData() { - return data; - } - } - - - - public static class ApplicationjsonSchema1 extends JsonSchema implements ListSchemaValidator { - private static @Nullable ApplicationjsonSchema1 instance = null; - - protected ApplicationjsonSchema1() { - super(new JsonSchemaInfo() - .type(Set.of(List.class)) - .items(RefPet.RefPet1.class) - ); - } - - public static ApplicationjsonSchema1 getInstance() { - if (instance == null) { - instance = new ApplicationjsonSchema1(); - } - return instance; - } - - @Override - public ApplicationjsonSchemaList getNewInstance(List arg, List pathToItem, PathToSchemasMap pathToSchemas) { - List items = new ArrayList<>(); - int i = 0; - for (Object item: arg) { - List itemPathToItem = new ArrayList<>(pathToItem); - itemPathToItem.add(i); - LinkedHashMap, Nothing?> schemas = pathToSchemas.get(itemPathToItem); - if (schemas == null) { - throw new RuntimeException("Validation 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"); - } - items.add((Pet.PetMap) itemInstance); - i += 1; - } - FrozenList newInstanceItems = new FrozenList<>(items); - return new ApplicationjsonSchemaList(newInstanceItems); - } - - 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); - SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().build())); - ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, new PathToSchemasMap(), new LinkedHashSet<>()); - PathToSchemasMap pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet); - return getNewInstance(castArg, validationMetadata.pathToItem(), pathToSchemasMap); - } - - @Override - public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws 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"); - } - @Override - public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { - 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"); - } - @Override - 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 { - 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"); - } - } -} diff --git a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/responses/successfulxmlandjsonarrayofpet/content/applicationxml/ApplicationxmlSchema.kt b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/responses/successfulxmlandjsonarrayofpet/content/applicationxml/ApplicationxmlSchema.kt deleted file mode 100644 index 94cf4c63c67..00000000000 --- a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/responses/successfulxmlandjsonarrayofpet/content/applicationxml/ApplicationxmlSchema.kt +++ /dev/null @@ -1,148 +0,0 @@ -package org.openapijsonschematools.client.components.responses.successfulxmlandjsonarrayofpet.content.applicationxml; -import java.util.ArrayList; -import java.util.HashSet; -import java.util.LinkedHashMap; -import java.util.LinkedHashSet; -import java.util.List; -import java.util.Map; -import java.util.Objects; -import java.util.Set; -import org.checkerframework.checker.nullness.qual.Nullable; -import org.openapijsonschematools.client.components.schemas.Pet; -import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags; -import org.openapijsonschematools.client.configurations.SchemaConfiguration; -import org.openapijsonschematools.client.exceptions.ValidationException; -import org.openapijsonschematools.client.schemas.validation.FrozenList; -import org.openapijsonschematools.client.schemas.validation.FrozenMap; -import org.openapijsonschematools.client.schemas.validation.JsonSchema; -import org.openapijsonschematools.client.schemas.validation.JsonSchemaInfo; -import org.openapijsonschematools.client.schemas.validation.ListSchemaValidator; -import org.openapijsonschematools.client.schemas.validation.PathToSchemasMap; -import org.openapijsonschematools.client.schemas.validation.ValidationMetadata; - -public class ApplicationxmlSchema { - // nest classes so all schemas and input/output classes can be public - - - public static class ApplicationxmlSchemaList extends FrozenList { - protected ApplicationxmlSchemaList(FrozenList m) { - super(m); - } - public static ApplicationxmlSchemaList of(List> arg, SchemaConfiguration configuration) throws ValidationException { - return ApplicationxmlSchema1.getInstance().validate(arg, configuration); - } - } - - public static class ApplicationxmlSchemaListBuilder { - // class to build List> - private final List> list; - - public ApplicationxmlSchemaListBuilder() { - list = new ArrayList<>(); - } - - public ApplicationxmlSchemaListBuilder(List> list) { - this.list = list; - } - - public ApplicationxmlSchemaListBuilder add(Map item) { - list.add(item); - return this; - } - - public List> build() { - return list; - } - } - - - public sealed interface ApplicationxmlSchema1Boxed permits ApplicationxmlSchema1BoxedList { - @Nullable Object getData(); - } - - public record ApplicationxmlSchema1BoxedList(ApplicationxmlSchemaList data) implements ApplicationxmlSchema1Boxed { - @Override - public @Nullable Object getData() { - return data; - } - } - - - - public static class ApplicationxmlSchema1 extends JsonSchema implements ListSchemaValidator { - private static @Nullable ApplicationxmlSchema1 instance = null; - - protected ApplicationxmlSchema1() { - super(new JsonSchemaInfo() - .type(Set.of(List.class)) - .items(Pet.Pet1.class) - ); - } - - public static ApplicationxmlSchema1 getInstance() { - if (instance == null) { - instance = new ApplicationxmlSchema1(); - } - return instance; - } - - @Override - public ApplicationxmlSchemaList getNewInstance(List arg, List pathToItem, PathToSchemasMap pathToSchemas) { - List items = new ArrayList<>(); - int i = 0; - for (Object item: arg) { - List itemPathToItem = new ArrayList<>(pathToItem); - itemPathToItem.add(i); - LinkedHashMap, Nothing?> schemas = pathToSchemas.get(itemPathToItem); - if (schemas == null) { - throw new RuntimeException("Validation 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"); - } - items.add((Pet.PetMap) itemInstance); - i += 1; - } - FrozenList newInstanceItems = new FrozenList<>(items); - return new ApplicationxmlSchemaList(newInstanceItems); - } - - 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); - SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().build())); - ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, new PathToSchemasMap(), new LinkedHashSet<>()); - PathToSchemasMap pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet); - return getNewInstance(castArg, validationMetadata.pathToItem(), pathToSchemasMap); - } - - @Override - public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws 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"); - } - @Override - public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { - 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"); - } - @Override - 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 { - 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"); - } - } -} diff --git a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/responses/successinlinecontentandheader/Headers.kt b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/responses/successinlinecontentandheader/Headers.kt deleted file mode 100644 index dece46b982e..00000000000 --- a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/responses/successinlinecontentandheader/Headers.kt +++ /dev/null @@ -1,18 +0,0 @@ -package org.openapijsonschematools.client.components.responses.successinlinecontentandheader; - -import org.openapijsonschematools.client.response.HeadersDeserializer; -import org.openapijsonschematools.client.components.responses.successinlinecontentandheader.headers.SomeHeader; - -import java.util.Map; -import java.util.AbstractMap; - -public class Headers extends HeadersDeserializer { - public Headers() { - super( - Map.ofEntries( - new AbstractMap.SimpleEntry<>("someHeader", new SomeHeader.SomeHeader1()) - ), - SuccessInlineContentAndHeaderHeadersSchema.SuccessInlineContentAndHeaderHeadersSchema1.getInstance() - ); - } -} \ No newline at end of file diff --git a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/responses/successinlinecontentandheader/SuccessInlineContentAndHeaderHeadersSchema.kt b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/responses/successinlinecontentandheader/SuccessInlineContentAndHeaderHeadersSchema.kt deleted file mode 100644 index 96c9737d130..00000000000 --- a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/responses/successinlinecontentandheader/SuccessInlineContentAndHeaderHeadersSchema.kt +++ /dev/null @@ -1,191 +0,0 @@ -package org.openapijsonschematools.client.components.responses.successinlinecontentandheader; -import java.util.ArrayList; -import java.util.HashSet; -import java.util.LinkedHashMap; -import java.util.LinkedHashSet; -import java.util.List; -import java.util.Map; -import java.util.Objects; -import java.util.Set; -import org.checkerframework.checker.nullness.qual.Nullable; -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.UnsetPropertyException; -import org.openapijsonschematools.client.exceptions.ValidationException; -import org.openapijsonschematools.client.schemas.AnyTypeJsonSchema; -import org.openapijsonschematools.client.schemas.GenericBuilder; -import org.openapijsonschematools.client.schemas.NotAnyTypeJsonSchema; -import org.openapijsonschematools.client.schemas.validation.FrozenMap; -import org.openapijsonschematools.client.schemas.validation.JsonSchema; -import org.openapijsonschematools.client.schemas.validation.JsonSchemaInfo; -import org.openapijsonschematools.client.schemas.validation.MapSchemaValidator; -import org.openapijsonschematools.client.schemas.validation.MapUtils; -import org.openapijsonschematools.client.schemas.validation.PathToSchemasMap; -import org.openapijsonschematools.client.schemas.validation.PropertyEntry; -import org.openapijsonschematools.client.schemas.validation.ValidationMetadata; - -public class SuccessInlineContentAndHeaderHeadersSchema { - // nest classes so all schemas and input/output classes can be public - - - public static class SuccessInlineContentAndHeaderAdditionalProperties extends NotAnyTypeJsonSchema.NotAnyTypeJsonSchema1 { - // NotAnyTypeSchema - private static @Nullable SuccessInlineContentAndHeaderAdditionalProperties instance = null; - public static SuccessInlineContentAndHeaderAdditionalProperties getInstance() { - if (instance == null) { - instance = new SuccessInlineContentAndHeaderAdditionalProperties(); - } - return instance; - } - } - - - public static class SuccessInlineContentAndHeaderHeadersSchemaMap extends FrozenMap { - protected SuccessInlineContentAndHeaderHeadersSchemaMap(FrozenMap m) { - super(m); - } - public static final Set requiredKeys = Set.of(); - public static final Set optionalKeys = Set.of( - "someHeader" - ); - public static SuccessInlineContentAndHeaderHeadersSchemaMap of(Map arg, SchemaConfiguration configuration) throws ValidationException { - return SuccessInlineContentAndHeaderHeadersSchema1.getInstance().validate(arg, configuration); - } - - public String someHeader() throws UnsetPropertyException { - return getOrThrow("someHeader"); - } - } - - public interface SetterForSuccessInlineContentAndHeaderSomeHeader { - Map getInstance(); - T getBuilderAfterSuccessInlineContentAndHeaderSomeHeader(Map instance); - - default T someHeader(String value) { - var instance = getInstance(); - instance.put("someHeader", value); - return getBuilderAfterSuccessInlineContentAndHeaderSomeHeader(instance); - } - } - - public static class SuccessInlineContentAndHeaderHeadersSchemaMapBuilder implements GenericBuilder>, SetterForSuccessInlineContentAndHeaderSomeHeader { - private final Map instance; - private static final Set knownKeys = Set.of( - "someHeader" - ); - public Set getKnownKeys() { - return knownKeys; - } - public SuccessInlineContentAndHeaderHeadersSchemaMapBuilder() { - this.instance = new LinkedHashMap<>(); - } - public Map build() { - return instance; - } - public Map getInstance() { - return instance; - } - public SuccessInlineContentAndHeaderHeadersSchemaMapBuilder getBuilderAfterSuccessInlineContentAndHeaderSomeHeader(Map instance) { - return this; - } - } - - - public sealed interface SuccessInlineContentAndHeaderHeadersSchema1Boxed permits SuccessInlineContentAndHeaderHeadersSchema1BoxedMap { - @Nullable Object getData(); - } - - public record SuccessInlineContentAndHeaderHeadersSchema1BoxedMap(SuccessInlineContentAndHeaderHeadersSchemaMap data) implements SuccessInlineContentAndHeaderHeadersSchema1Boxed { - @Override - public @Nullable Object getData() { - return data; - } - } - - - public static class SuccessInlineContentAndHeaderHeadersSchema1 extends JsonSchema implements MapSchemaValidator { - private static @Nullable SuccessInlineContentAndHeaderHeadersSchema1 instance = null; - - protected SuccessInlineContentAndHeaderHeadersSchema1() { - super(new JsonSchemaInfo() - .type(Set.of(Map.class)) - .properties(Map.ofEntries( - new PropertyEntry("someHeader", SomeHeaderSchema.SomeHeaderSchema1.class) - )) - .additionalProperties(SuccessInlineContentAndHeaderAdditionalProperties.class) - ); - } - - public static SuccessInlineContentAndHeaderHeadersSchema1 getInstance() { - if (instance == null) { - instance = new SuccessInlineContentAndHeaderHeadersSchema1(); - } - return instance; - } - - 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 RuntimeException("Invalid non-string key value"); - } - String propertyName = (String) entryKey; - List propertyPathToItem = new ArrayList<>(pathToItem); - propertyPathToItem.add(propertyName); - Object value = entry.getValue(); - LinkedHashMap, Nothing?> schemas = pathToSchemas.get(propertyPathToItem); - if (schemas == null) { - throw new RuntimeException("Validation 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"); - } - properties.put(propertyName, (String) propertyInstance); - } - FrozenMap castProperties = new FrozenMap<>(properties); - return new SuccessInlineContentAndHeaderHeadersSchemaMap(castProperties); - } - - 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); - SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().build())); - ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, new PathToSchemasMap(), new LinkedHashSet<>()); - PathToSchemasMap pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet); - return getNewInstance(castArg, validationMetadata.pathToItem(), pathToSchemasMap); - } - - - @Override - public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws 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"); - } - @Override - public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { - if (arg instanceof Map) { - return getNewInstance((Map) arg, pathToItem, pathToSchemas); - } - 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 { - return new SuccessInlineContentAndHeaderHeadersSchema1BoxedMap(validate(arg, configuration)); - } - @Override - public SuccessInlineContentAndHeaderHeadersSchema1Boxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { - 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"); - } - } - -} diff --git a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/responses/successinlinecontentandheader/content/applicationjson/ApplicationjsonSchema.kt b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/responses/successinlinecontentandheader/content/applicationjson/ApplicationjsonSchema.kt deleted file mode 100644 index 73cc093b356..00000000000 --- a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/responses/successinlinecontentandheader/content/applicationjson/ApplicationjsonSchema.kt +++ /dev/null @@ -1,190 +0,0 @@ -package org.openapijsonschematools.client.components.responses.successinlinecontentandheader.content.applicationjson; -import java.util.ArrayList; -import java.util.HashSet; -import java.util.LinkedHashMap; -import java.util.LinkedHashSet; -import java.util.List; -import java.util.Map; -import java.util.Objects; -import java.util.Set; -import org.checkerframework.checker.nullness.qual.Nullable; -import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags; -import org.openapijsonschematools.client.configurations.SchemaConfiguration; -import org.openapijsonschematools.client.exceptions.InvalidAdditionalPropertyException; -import org.openapijsonschematools.client.exceptions.UnsetPropertyException; -import org.openapijsonschematools.client.exceptions.ValidationException; -import org.openapijsonschematools.client.schemas.GenericBuilder; -import org.openapijsonschematools.client.schemas.Int32JsonSchema; -import org.openapijsonschematools.client.schemas.validation.FrozenMap; -import org.openapijsonschematools.client.schemas.validation.JsonSchema; -import org.openapijsonschematools.client.schemas.validation.JsonSchemaInfo; -import org.openapijsonschematools.client.schemas.validation.MapSchemaValidator; -import org.openapijsonschematools.client.schemas.validation.MapUtils; -import org.openapijsonschematools.client.schemas.validation.PathToSchemasMap; -import org.openapijsonschematools.client.schemas.validation.ValidationMetadata; - -public class ApplicationjsonSchema { - // nest classes so all schemas and input/output classes can be public - - - public static class ApplicationjsonAdditionalProperties extends Int32JsonSchema.Int32JsonSchema1 { - private static @Nullable ApplicationjsonAdditionalProperties instance = null; - public static ApplicationjsonAdditionalProperties getInstance() { - if (instance == null) { - instance = new ApplicationjsonAdditionalProperties(); - } - return instance; - } - } - - - public static class ApplicationjsonSchemaMap extends FrozenMap { - protected ApplicationjsonSchemaMap(FrozenMap m) { - super(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 { - return ApplicationjsonSchema1.getInstance().validate(arg, configuration); - } - - public Number getAdditionalProperty(String name) throws UnsetPropertyException { - return getOrThrow(name); - } - } - - public interface SetterForApplicationjsonAdditionalProperties { - Set getKnownKeys(); - Map getInstance(); - T getBuilderAfterAdditionalProperty(Map instance); - - default T additionalProperty(String key, int value) throws InvalidAdditionalPropertyException { - MapUtils.throwIfKeyKnown(key, getKnownKeys(), true); - var instance = getInstance(); - instance.put(key, value); - return getBuilderAfterAdditionalProperty(instance); - } - - default T additionalProperty(String key, float value) throws InvalidAdditionalPropertyException { - MapUtils.throwIfKeyKnown(key, getKnownKeys(), true); - var instance = getInstance(); - instance.put(key, value); - return getBuilderAfterAdditionalProperty(instance); - } - } - - public static class ApplicationjsonSchemaMapBuilder implements GenericBuilder>, SetterForApplicationjsonAdditionalProperties { - private final Map instance; - private static final Set knownKeys = Set.of(); - public Set getKnownKeys() { - return knownKeys; - } - public ApplicationjsonSchemaMapBuilder() { - this.instance = new LinkedHashMap<>(); - } - public Map build() { - return instance; - } - public Map getInstance() { - return instance; - } - public ApplicationjsonSchemaMapBuilder getBuilderAfterAdditionalProperty(Map instance) { - return this; - } - } - - - public sealed interface ApplicationjsonSchema1Boxed permits ApplicationjsonSchema1BoxedMap { - @Nullable Object getData(); - } - - public record ApplicationjsonSchema1BoxedMap(ApplicationjsonSchemaMap data) implements ApplicationjsonSchema1Boxed { - @Override - public @Nullable Object getData() { - return data; - } - } - - - public static class ApplicationjsonSchema1 extends JsonSchema implements MapSchemaValidator { - private static @Nullable ApplicationjsonSchema1 instance = null; - - protected ApplicationjsonSchema1() { - super(new JsonSchemaInfo() - .type(Set.of(Map.class)) - .additionalProperties(ApplicationjsonAdditionalProperties.class) - ); - } - - public static ApplicationjsonSchema1 getInstance() { - if (instance == null) { - instance = new ApplicationjsonSchema1(); - } - return instance; - } - - 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 RuntimeException("Invalid non-string key value"); - } - String propertyName = (String) entryKey; - List propertyPathToItem = new ArrayList<>(pathToItem); - propertyPathToItem.add(propertyName); - Object value = entry.getValue(); - LinkedHashMap, Nothing?> schemas = pathToSchemas.get(propertyPathToItem); - if (schemas == null) { - throw new RuntimeException("Validation 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"); - } - properties.put(propertyName, (Number) propertyInstance); - } - FrozenMap castProperties = new FrozenMap<>(properties); - return new ApplicationjsonSchemaMap(castProperties); - } - - 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); - SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().build())); - ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, new PathToSchemasMap(), new LinkedHashSet<>()); - PathToSchemasMap pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet); - return getNewInstance(castArg, validationMetadata.pathToItem(), pathToSchemasMap); - } - - - @Override - public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws 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"); - } - @Override - public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { - if (arg instanceof Map) { - return getNewInstance((Map) arg, pathToItem, pathToSchemas); - } - 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 { - return new ApplicationjsonSchema1BoxedMap(validate(arg, configuration)); - } - @Override - public ApplicationjsonSchema1Boxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { - 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"); - } - } - -} diff --git a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/responses/successinlinecontentandheader/headers/SomeHeader.kt b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/responses/successinlinecontentandheader/headers/SomeHeader.kt deleted file mode 100644 index f0146d6c5d6..00000000000 --- a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/responses/successinlinecontentandheader/headers/SomeHeader.kt +++ /dev/null @@ -1,18 +0,0 @@ -package org.openapijsonschematools.client.components.responses.successinlinecontentandheader.headers; - -import org.openapijsonschematools.client.header.SchemaHeader; -import org.openapijsonschematools.client.components.responses.successinlinecontentandheader.headers.someheader.SomeHeaderSchema; - -public class SomeHeader { - - public static class SomeHeader1 extends SchemaHeader { - public SomeHeader1() { - super( - false, - null, - false, - SomeHeaderSchema.SomeHeaderSchema1.getInstance() - ); - } - } -} diff --git a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/responses/successinlinecontentandheader/headers/someheader/SomeHeaderSchema.kt b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/responses/successinlinecontentandheader/headers/someheader/SomeHeaderSchema.kt deleted file mode 100644 index 64929f2e4d2..00000000000 --- a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/responses/successinlinecontentandheader/headers/someheader/SomeHeaderSchema.kt +++ /dev/null @@ -1,19 +0,0 @@ -package org.openapijsonschematools.client.components.responses.successinlinecontentandheader.headers.someheader; -import org.checkerframework.checker.nullness.qual.Nullable; -import org.openapijsonschematools.client.schemas.StringJsonSchema; - -public class SomeHeaderSchema extends StringJsonSchema { - // nest classes so all schemas and input/output classes can be public - - - public static class SomeHeaderSchema1 extends StringJsonSchema.StringJsonSchema1 { - private static @Nullable SomeHeaderSchema1 instance = null; - public static SomeHeaderSchema1 getInstance() { - if (instance == null) { - instance = new SomeHeaderSchema1(); - } - return instance; - } - } - -} diff --git a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/responses/successwithjsonapiresponse/Headers.kt b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/responses/successwithjsonapiresponse/Headers.kt deleted file mode 100644 index d762e053d69..00000000000 --- a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/responses/successwithjsonapiresponse/Headers.kt +++ /dev/null @@ -1,26 +0,0 @@ -package org.openapijsonschematools.client.components.responses.successwithjsonapiresponse; - -import org.openapijsonschematools.client.response.HeadersDeserializer; -import org.openapijsonschematools.client.components.responses.successwithjsonapiresponse.headers.Refschemaheader; -import org.openapijsonschematools.client.components.responses.successwithjsonapiresponse.headers.Int32; -import org.openapijsonschematools.client.components.responses.successwithjsonapiresponse.headers.Refcontentschemaheader; -import org.openapijsonschematools.client.components.responses.successwithjsonapiresponse.headers.StringHeader; -import org.openapijsonschematools.client.components.responses.successwithjsonapiresponse.headers.NumberHeader; - -import java.util.Map; -import java.util.AbstractMap; - -public class Headers extends HeadersDeserializer { - public Headers() { - super( - Map.ofEntries( - new AbstractMap.SimpleEntry<>("ref-schema-header", new Refschemaheader.Refschemaheader1()), - new AbstractMap.SimpleEntry<>("int32", new Int32.Int321()), - new AbstractMap.SimpleEntry<>("ref-content-schema-header", new Refcontentschemaheader.Refcontentschemaheader1()), - new AbstractMap.SimpleEntry<>("stringHeader", new StringHeader.StringHeader1()), - new AbstractMap.SimpleEntry<>("numberHeader", new NumberHeader.NumberHeader1()) - ), - SuccessWithJsonApiResponseHeadersSchema.SuccessWithJsonApiResponseHeadersSchema1.getInstance() - ); - } -} \ No newline at end of file diff --git a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/responses/successwithjsonapiresponse/SuccessWithJsonApiResponseHeadersSchema.kt b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/responses/successwithjsonapiresponse/SuccessWithJsonApiResponseHeadersSchema.kt deleted file mode 100644 index 13f3499e106..00000000000 --- a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/responses/successwithjsonapiresponse/SuccessWithJsonApiResponseHeadersSchema.kt +++ /dev/null @@ -1,528 +0,0 @@ -package org.openapijsonschematools.client.components.responses.successwithjsonapiresponse; -import java.util.ArrayList; -import java.util.HashSet; -import java.util.LinkedHashMap; -import java.util.LinkedHashSet; -import java.util.List; -import java.util.Map; -import java.util.Objects; -import java.util.Set; -import org.checkerframework.checker.nullness.qual.Nullable; -import org.openapijsonschematools.client.components.headers.int32jsoncontenttypeheader.content.applicationjson.Int32JsonContentTypeHeaderSchema; -import org.openapijsonschematools.client.components.headers.numberheader.NumberHeaderSchema; -import org.openapijsonschematools.client.components.headers.stringheader.StringHeaderSchema; -import org.openapijsonschematools.client.components.schemas.StringWithValidation; -import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags; -import org.openapijsonschematools.client.configurations.SchemaConfiguration; -import org.openapijsonschematools.client.exceptions.UnsetPropertyException; -import org.openapijsonschematools.client.exceptions.ValidationException; -import org.openapijsonschematools.client.schemas.AnyTypeJsonSchema; -import org.openapijsonschematools.client.schemas.GenericBuilder; -import org.openapijsonschematools.client.schemas.NotAnyTypeJsonSchema; -import org.openapijsonschematools.client.schemas.validation.FrozenMap; -import org.openapijsonschematools.client.schemas.validation.JsonSchema; -import org.openapijsonschematools.client.schemas.validation.JsonSchemaInfo; -import org.openapijsonschematools.client.schemas.validation.MapSchemaValidator; -import org.openapijsonschematools.client.schemas.validation.MapUtils; -import org.openapijsonschematools.client.schemas.validation.PathToSchemasMap; -import org.openapijsonschematools.client.schemas.validation.PropertyEntry; -import org.openapijsonschematools.client.schemas.validation.ValidationMetadata; - -public class SuccessWithJsonApiResponseHeadersSchema { - // nest classes so all schemas and input/output classes can be public - - - public static class SuccessWithJsonApiResponseAdditionalProperties extends NotAnyTypeJsonSchema.NotAnyTypeJsonSchema1 { - // NotAnyTypeSchema - private static @Nullable SuccessWithJsonApiResponseAdditionalProperties instance = null; - public static SuccessWithJsonApiResponseAdditionalProperties getInstance() { - if (instance == null) { - instance = new SuccessWithJsonApiResponseAdditionalProperties(); - } - return instance; - } - } - - - public static class SuccessWithJsonApiResponseHeadersSchemaMap extends FrozenMap<@Nullable Object> { - protected SuccessWithJsonApiResponseHeadersSchemaMap(FrozenMap<@Nullable Object> m) { - super(m); - } - public static final Set requiredKeys = Set.of( - "int32", - "ref-content-schema-header", - "ref-schema-header", - "stringHeader" - ); - public static final Set optionalKeys = Set.of( - "numberHeader" - ); - public static SuccessWithJsonApiResponseHeadersSchemaMap of(Map arg, SchemaConfiguration configuration) throws ValidationException { - return SuccessWithJsonApiResponseHeadersSchema1.getInstance().validate(arg, configuration); - } - - public Number int32() { - @Nullable Object value = get("int32"); - if (!(value instanceof Number)) { - throw new RuntimeException("Invalid value stored for int32"); - } - return (Number) value; - } - - public String stringHeader() { - @Nullable Object value = get("stringHeader"); - if (!(value instanceof String)) { - throw new RuntimeException("Invalid value stored for stringHeader"); - } - return (String) value; - } - - public String numberHeader() throws UnsetPropertyException { - String key = "numberHeader"; - throwIfKeyNotPresent(key); - @Nullable Object value = get(key); - if (!(value instanceof String)) { - throw new RuntimeException("Invalid value stored for numberHeader"); - } - return (String) value; - } - } - - public interface SetterForSuccessWithJsonApiResponseInt32 { - Map getInstance(); - T getBuilderAfterSuccessWithJsonApiResponseInt32(Map instance); - - default T int32(int value) { - var instance = getInstance(); - instance.put("int32", value); - return getBuilderAfterSuccessWithJsonApiResponseInt32(instance); - } - - default T int32(float value) { - var instance = getInstance(); - instance.put("int32", value); - return getBuilderAfterSuccessWithJsonApiResponseInt32(instance); - } - } - - public interface SetterForSuccessWithJsonApiResponseRefcontentschemaheader { - Map getInstance(); - T getBuilderAfterSuccessWithJsonApiResponseRefcontentschemaheader(Map instance); - - default T refHyphenMinusContentHyphenMinusSchemaHyphenMinusHeader(String value) { - var instance = getInstance(); - instance.put("ref-content-schema-header", value); - return getBuilderAfterSuccessWithJsonApiResponseRefcontentschemaheader(instance); - } - } - - public interface SetterForSuccessWithJsonApiResponseRefschemaheader { - Map getInstance(); - T getBuilderAfterSuccessWithJsonApiResponseRefschemaheader(Map instance); - - default T refHyphenMinusSchemaHyphenMinusHeader(String value) { - var instance = getInstance(); - instance.put("ref-schema-header", value); - return getBuilderAfterSuccessWithJsonApiResponseRefschemaheader(instance); - } - } - - public interface SetterForSuccessWithJsonApiResponseStringHeader { - Map getInstance(); - T getBuilderAfterSuccessWithJsonApiResponseStringHeader(Map instance); - - default T stringHeader(String value) { - var instance = getInstance(); - instance.put("stringHeader", value); - return getBuilderAfterSuccessWithJsonApiResponseStringHeader(instance); - } - } - - public interface SetterForSuccessWithJsonApiResponseNumberHeader { - Map getInstance(); - T getBuilderAfterSuccessWithJsonApiResponseNumberHeader(Map instance); - - default T numberHeader(String value) { - var instance = getInstance(); - instance.put("numberHeader", value); - return getBuilderAfterSuccessWithJsonApiResponseNumberHeader(instance); - } - } - - public static class SuccessWithJsonApiResponseHeadersSchemaMap0000Builder implements GenericBuilder>, SetterForSuccessWithJsonApiResponseNumberHeader { - private final Map instance; - private static final Set knownKeys = Set.of( - "int32", - "ref-content-schema-header", - "ref-schema-header", - "stringHeader", - "numberHeader" - ); - public Set getKnownKeys() { - return knownKeys; - } - public SuccessWithJsonApiResponseHeadersSchemaMap0000Builder(Map instance) { - this.instance = instance; - } - public Map build() { - return instance; - } - public Map getInstance() { - return instance; - } - public SuccessWithJsonApiResponseHeadersSchemaMap0000Builder getBuilderAfterSuccessWithJsonApiResponseNumberHeader(Map instance) { - return this; - } - } - - public static class SuccessWithJsonApiResponseHeadersSchemaMap0001Builder implements SetterForSuccessWithJsonApiResponseStringHeader { - private final Map instance; - public SuccessWithJsonApiResponseHeadersSchemaMap0001Builder(Map instance) { - this.instance = instance; - } - public Map getInstance() { - return instance; - } - public SuccessWithJsonApiResponseHeadersSchemaMap0000Builder getBuilderAfterSuccessWithJsonApiResponseStringHeader(Map instance) { - return new SuccessWithJsonApiResponseHeadersSchemaMap0000Builder(instance); - } - } - - public static class SuccessWithJsonApiResponseHeadersSchemaMap0010Builder implements SetterForSuccessWithJsonApiResponseRefschemaheader { - private final Map instance; - public SuccessWithJsonApiResponseHeadersSchemaMap0010Builder(Map instance) { - this.instance = instance; - } - public Map getInstance() { - return instance; - } - public SuccessWithJsonApiResponseHeadersSchemaMap0000Builder getBuilderAfterSuccessWithJsonApiResponseRefschemaheader(Map instance) { - return new SuccessWithJsonApiResponseHeadersSchemaMap0000Builder(instance); - } - } - - public static class SuccessWithJsonApiResponseHeadersSchemaMap0011Builder implements SetterForSuccessWithJsonApiResponseRefschemaheader, SetterForSuccessWithJsonApiResponseStringHeader { - private final Map instance; - public SuccessWithJsonApiResponseHeadersSchemaMap0011Builder(Map instance) { - this.instance = instance; - } - public Map getInstance() { - return instance; - } - public SuccessWithJsonApiResponseHeadersSchemaMap0001Builder getBuilderAfterSuccessWithJsonApiResponseRefschemaheader(Map instance) { - return new SuccessWithJsonApiResponseHeadersSchemaMap0001Builder(instance); - } - public SuccessWithJsonApiResponseHeadersSchemaMap0010Builder getBuilderAfterSuccessWithJsonApiResponseStringHeader(Map instance) { - return new SuccessWithJsonApiResponseHeadersSchemaMap0010Builder(instance); - } - } - - public static class SuccessWithJsonApiResponseHeadersSchemaMap0100Builder implements SetterForSuccessWithJsonApiResponseRefcontentschemaheader { - private final Map instance; - public SuccessWithJsonApiResponseHeadersSchemaMap0100Builder(Map instance) { - this.instance = instance; - } - public Map getInstance() { - return instance; - } - public SuccessWithJsonApiResponseHeadersSchemaMap0000Builder getBuilderAfterSuccessWithJsonApiResponseRefcontentschemaheader(Map instance) { - return new SuccessWithJsonApiResponseHeadersSchemaMap0000Builder(instance); - } - } - - public static class SuccessWithJsonApiResponseHeadersSchemaMap0101Builder implements SetterForSuccessWithJsonApiResponseRefcontentschemaheader, SetterForSuccessWithJsonApiResponseStringHeader { - private final Map instance; - public SuccessWithJsonApiResponseHeadersSchemaMap0101Builder(Map instance) { - this.instance = instance; - } - public Map getInstance() { - return instance; - } - public SuccessWithJsonApiResponseHeadersSchemaMap0001Builder getBuilderAfterSuccessWithJsonApiResponseRefcontentschemaheader(Map instance) { - return new SuccessWithJsonApiResponseHeadersSchemaMap0001Builder(instance); - } - public SuccessWithJsonApiResponseHeadersSchemaMap0100Builder getBuilderAfterSuccessWithJsonApiResponseStringHeader(Map instance) { - return new SuccessWithJsonApiResponseHeadersSchemaMap0100Builder(instance); - } - } - - public static class SuccessWithJsonApiResponseHeadersSchemaMap0110Builder implements SetterForSuccessWithJsonApiResponseRefcontentschemaheader, SetterForSuccessWithJsonApiResponseRefschemaheader { - private final Map instance; - public SuccessWithJsonApiResponseHeadersSchemaMap0110Builder(Map instance) { - this.instance = instance; - } - public Map getInstance() { - return instance; - } - public SuccessWithJsonApiResponseHeadersSchemaMap0010Builder getBuilderAfterSuccessWithJsonApiResponseRefcontentschemaheader(Map instance) { - return new SuccessWithJsonApiResponseHeadersSchemaMap0010Builder(instance); - } - public SuccessWithJsonApiResponseHeadersSchemaMap0100Builder getBuilderAfterSuccessWithJsonApiResponseRefschemaheader(Map instance) { - return new SuccessWithJsonApiResponseHeadersSchemaMap0100Builder(instance); - } - } - - public static class SuccessWithJsonApiResponseHeadersSchemaMap0111Builder implements SetterForSuccessWithJsonApiResponseRefcontentschemaheader, SetterForSuccessWithJsonApiResponseRefschemaheader, SetterForSuccessWithJsonApiResponseStringHeader { - private final Map instance; - public SuccessWithJsonApiResponseHeadersSchemaMap0111Builder(Map instance) { - this.instance = instance; - } - public Map getInstance() { - return instance; - } - public SuccessWithJsonApiResponseHeadersSchemaMap0011Builder getBuilderAfterSuccessWithJsonApiResponseRefcontentschemaheader(Map instance) { - return new SuccessWithJsonApiResponseHeadersSchemaMap0011Builder(instance); - } - public SuccessWithJsonApiResponseHeadersSchemaMap0101Builder getBuilderAfterSuccessWithJsonApiResponseRefschemaheader(Map instance) { - return new SuccessWithJsonApiResponseHeadersSchemaMap0101Builder(instance); - } - public SuccessWithJsonApiResponseHeadersSchemaMap0110Builder getBuilderAfterSuccessWithJsonApiResponseStringHeader(Map instance) { - return new SuccessWithJsonApiResponseHeadersSchemaMap0110Builder(instance); - } - } - - public static class SuccessWithJsonApiResponseHeadersSchemaMap1000Builder implements SetterForSuccessWithJsonApiResponseInt32 { - private final Map instance; - public SuccessWithJsonApiResponseHeadersSchemaMap1000Builder(Map instance) { - this.instance = instance; - } - public Map getInstance() { - return instance; - } - public SuccessWithJsonApiResponseHeadersSchemaMap0000Builder getBuilderAfterSuccessWithJsonApiResponseInt32(Map instance) { - return new SuccessWithJsonApiResponseHeadersSchemaMap0000Builder(instance); - } - } - - public static class SuccessWithJsonApiResponseHeadersSchemaMap1001Builder implements SetterForSuccessWithJsonApiResponseInt32, SetterForSuccessWithJsonApiResponseStringHeader { - private final Map instance; - public SuccessWithJsonApiResponseHeadersSchemaMap1001Builder(Map instance) { - this.instance = instance; - } - public Map getInstance() { - return instance; - } - public SuccessWithJsonApiResponseHeadersSchemaMap0001Builder getBuilderAfterSuccessWithJsonApiResponseInt32(Map instance) { - return new SuccessWithJsonApiResponseHeadersSchemaMap0001Builder(instance); - } - public SuccessWithJsonApiResponseHeadersSchemaMap1000Builder getBuilderAfterSuccessWithJsonApiResponseStringHeader(Map instance) { - return new SuccessWithJsonApiResponseHeadersSchemaMap1000Builder(instance); - } - } - - public static class SuccessWithJsonApiResponseHeadersSchemaMap1010Builder implements SetterForSuccessWithJsonApiResponseInt32, SetterForSuccessWithJsonApiResponseRefschemaheader { - private final Map instance; - public SuccessWithJsonApiResponseHeadersSchemaMap1010Builder(Map instance) { - this.instance = instance; - } - public Map getInstance() { - return instance; - } - public SuccessWithJsonApiResponseHeadersSchemaMap0010Builder getBuilderAfterSuccessWithJsonApiResponseInt32(Map instance) { - return new SuccessWithJsonApiResponseHeadersSchemaMap0010Builder(instance); - } - public SuccessWithJsonApiResponseHeadersSchemaMap1000Builder getBuilderAfterSuccessWithJsonApiResponseRefschemaheader(Map instance) { - return new SuccessWithJsonApiResponseHeadersSchemaMap1000Builder(instance); - } - } - - public static class SuccessWithJsonApiResponseHeadersSchemaMap1011Builder implements SetterForSuccessWithJsonApiResponseInt32, SetterForSuccessWithJsonApiResponseRefschemaheader, SetterForSuccessWithJsonApiResponseStringHeader { - private final Map instance; - public SuccessWithJsonApiResponseHeadersSchemaMap1011Builder(Map instance) { - this.instance = instance; - } - public Map getInstance() { - return instance; - } - public SuccessWithJsonApiResponseHeadersSchemaMap0011Builder getBuilderAfterSuccessWithJsonApiResponseInt32(Map instance) { - return new SuccessWithJsonApiResponseHeadersSchemaMap0011Builder(instance); - } - public SuccessWithJsonApiResponseHeadersSchemaMap1001Builder getBuilderAfterSuccessWithJsonApiResponseRefschemaheader(Map instance) { - return new SuccessWithJsonApiResponseHeadersSchemaMap1001Builder(instance); - } - public SuccessWithJsonApiResponseHeadersSchemaMap1010Builder getBuilderAfterSuccessWithJsonApiResponseStringHeader(Map instance) { - return new SuccessWithJsonApiResponseHeadersSchemaMap1010Builder(instance); - } - } - - public static class SuccessWithJsonApiResponseHeadersSchemaMap1100Builder implements SetterForSuccessWithJsonApiResponseInt32, SetterForSuccessWithJsonApiResponseRefcontentschemaheader { - private final Map instance; - public SuccessWithJsonApiResponseHeadersSchemaMap1100Builder(Map instance) { - this.instance = instance; - } - public Map getInstance() { - return instance; - } - public SuccessWithJsonApiResponseHeadersSchemaMap0100Builder getBuilderAfterSuccessWithJsonApiResponseInt32(Map instance) { - return new SuccessWithJsonApiResponseHeadersSchemaMap0100Builder(instance); - } - public SuccessWithJsonApiResponseHeadersSchemaMap1000Builder getBuilderAfterSuccessWithJsonApiResponseRefcontentschemaheader(Map instance) { - return new SuccessWithJsonApiResponseHeadersSchemaMap1000Builder(instance); - } - } - - public static class SuccessWithJsonApiResponseHeadersSchemaMap1101Builder implements SetterForSuccessWithJsonApiResponseInt32, SetterForSuccessWithJsonApiResponseRefcontentschemaheader, SetterForSuccessWithJsonApiResponseStringHeader { - private final Map instance; - public SuccessWithJsonApiResponseHeadersSchemaMap1101Builder(Map instance) { - this.instance = instance; - } - public Map getInstance() { - return instance; - } - public SuccessWithJsonApiResponseHeadersSchemaMap0101Builder getBuilderAfterSuccessWithJsonApiResponseInt32(Map instance) { - return new SuccessWithJsonApiResponseHeadersSchemaMap0101Builder(instance); - } - public SuccessWithJsonApiResponseHeadersSchemaMap1001Builder getBuilderAfterSuccessWithJsonApiResponseRefcontentschemaheader(Map instance) { - return new SuccessWithJsonApiResponseHeadersSchemaMap1001Builder(instance); - } - public SuccessWithJsonApiResponseHeadersSchemaMap1100Builder getBuilderAfterSuccessWithJsonApiResponseStringHeader(Map instance) { - return new SuccessWithJsonApiResponseHeadersSchemaMap1100Builder(instance); - } - } - - public static class SuccessWithJsonApiResponseHeadersSchemaMap1110Builder implements SetterForSuccessWithJsonApiResponseInt32, SetterForSuccessWithJsonApiResponseRefcontentschemaheader, SetterForSuccessWithJsonApiResponseRefschemaheader { - private final Map instance; - public SuccessWithJsonApiResponseHeadersSchemaMap1110Builder(Map instance) { - this.instance = instance; - } - public Map getInstance() { - return instance; - } - public SuccessWithJsonApiResponseHeadersSchemaMap0110Builder getBuilderAfterSuccessWithJsonApiResponseInt32(Map instance) { - return new SuccessWithJsonApiResponseHeadersSchemaMap0110Builder(instance); - } - public SuccessWithJsonApiResponseHeadersSchemaMap1010Builder getBuilderAfterSuccessWithJsonApiResponseRefcontentschemaheader(Map instance) { - return new SuccessWithJsonApiResponseHeadersSchemaMap1010Builder(instance); - } - public SuccessWithJsonApiResponseHeadersSchemaMap1100Builder getBuilderAfterSuccessWithJsonApiResponseRefschemaheader(Map instance) { - return new SuccessWithJsonApiResponseHeadersSchemaMap1100Builder(instance); - } - } - - public static class SuccessWithJsonApiResponseHeadersSchemaMapBuilder implements SetterForSuccessWithJsonApiResponseInt32, SetterForSuccessWithJsonApiResponseRefcontentschemaheader, SetterForSuccessWithJsonApiResponseRefschemaheader, SetterForSuccessWithJsonApiResponseStringHeader { - private final Map instance; - public SuccessWithJsonApiResponseHeadersSchemaMapBuilder() { - this.instance = new LinkedHashMap<>(); - } - public Map getInstance() { - return instance; - } - public SuccessWithJsonApiResponseHeadersSchemaMap0111Builder getBuilderAfterSuccessWithJsonApiResponseInt32(Map instance) { - return new SuccessWithJsonApiResponseHeadersSchemaMap0111Builder(instance); - } - public SuccessWithJsonApiResponseHeadersSchemaMap1011Builder getBuilderAfterSuccessWithJsonApiResponseRefcontentschemaheader(Map instance) { - return new SuccessWithJsonApiResponseHeadersSchemaMap1011Builder(instance); - } - public SuccessWithJsonApiResponseHeadersSchemaMap1101Builder getBuilderAfterSuccessWithJsonApiResponseRefschemaheader(Map instance) { - return new SuccessWithJsonApiResponseHeadersSchemaMap1101Builder(instance); - } - public SuccessWithJsonApiResponseHeadersSchemaMap1110Builder getBuilderAfterSuccessWithJsonApiResponseStringHeader(Map instance) { - return new SuccessWithJsonApiResponseHeadersSchemaMap1110Builder(instance); - } - } - - - public sealed interface SuccessWithJsonApiResponseHeadersSchema1Boxed permits SuccessWithJsonApiResponseHeadersSchema1BoxedMap { - @Nullable Object getData(); - } - - public record SuccessWithJsonApiResponseHeadersSchema1BoxedMap(SuccessWithJsonApiResponseHeadersSchemaMap data) implements SuccessWithJsonApiResponseHeadersSchema1Boxed { - @Override - public @Nullable Object getData() { - return data; - } - } - - - public static class SuccessWithJsonApiResponseHeadersSchema1 extends JsonSchema implements MapSchemaValidator { - private static @Nullable SuccessWithJsonApiResponseHeadersSchema1 instance = null; - - protected SuccessWithJsonApiResponseHeadersSchema1() { - super(new JsonSchemaInfo() - .type(Set.of(Map.class)) - .properties(Map.ofEntries( - new PropertyEntry("ref-schema-header", StringWithValidation.StringWithValidation1.class), - new PropertyEntry("int32", Int32JsonContentTypeHeaderSchema.Int32JsonContentTypeHeaderSchema1.class), - new PropertyEntry("ref-content-schema-header", StringWithValidation.StringWithValidation1.class), - new PropertyEntry("stringHeader", StringHeaderSchema.StringHeaderSchema1.class), - new PropertyEntry("numberHeader", NumberHeaderSchema.NumberHeaderSchema1.class) - )) - .required(Set.of( - "int32", - "ref-content-schema-header", - "ref-schema-header", - "stringHeader" - )) - .additionalProperties(SuccessWithJsonApiResponseAdditionalProperties.class) - ); - } - - public static SuccessWithJsonApiResponseHeadersSchema1 getInstance() { - if (instance == null) { - instance = new SuccessWithJsonApiResponseHeadersSchema1(); - } - return instance; - } - - 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 RuntimeException("Invalid non-string key value"); - } - String propertyName = (String) entryKey; - List propertyPathToItem = new ArrayList<>(pathToItem); - propertyPathToItem.add(propertyName); - Object value = entry.getValue(); - LinkedHashMap, Nothing?> schemas = pathToSchemas.get(propertyPathToItem); - if (schemas == null) { - throw new RuntimeException("Validation result is invalid, schemas must exist for a pathToItem"); - } - JsonSchema propertySchema = schemas.entrySet().iterator().next().getKey(); - @Nullable Object propertyInstance = propertySchema.getNewInstance(value, propertyPathToItem, pathToSchemas); - properties.put(propertyName, propertyInstance); - } - FrozenMap<@Nullable Object> castProperties = new FrozenMap<>(properties); - return new SuccessWithJsonApiResponseHeadersSchemaMap(castProperties); - } - - 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); - SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().build())); - ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, new PathToSchemasMap(), new LinkedHashSet<>()); - PathToSchemasMap pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet); - return getNewInstance(castArg, validationMetadata.pathToItem(), pathToSchemasMap); - } - - - @Override - public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws 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"); - } - @Override - public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { - if (arg instanceof Map) { - return getNewInstance((Map) arg, pathToItem, pathToSchemas); - } - 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 { - return new SuccessWithJsonApiResponseHeadersSchema1BoxedMap(validate(arg, configuration)); - } - @Override - public SuccessWithJsonApiResponseHeadersSchema1Boxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { - 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"); - } - } - -} diff --git a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/responses/successwithjsonapiresponse/content/applicationjson/ApplicationjsonSchema.kt b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/responses/successwithjsonapiresponse/content/applicationjson/ApplicationjsonSchema.kt deleted file mode 100644 index b8f8b6efa4a..00000000000 --- a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/responses/successwithjsonapiresponse/content/applicationjson/ApplicationjsonSchema.kt +++ /dev/null @@ -1,19 +0,0 @@ -package org.openapijsonschematools.client.components.responses.successwithjsonapiresponse.content.applicationjson; - -import org.checkerframework.checker.nullness.qual.Nullable; -import org.openapijsonschematools.client.components.schemas.ApiResponseSchema; - -public class ApplicationjsonSchema extends ApiResponseSchema { - // $refed class - - - public static class ApplicationjsonSchema1 extends ApiResponseSchema1 { - private static @Nullable ApplicationjsonSchema1 instance = null; - public static ApplicationjsonSchema1 getInstance() { - if (instance == null) { - instance = new ApplicationjsonSchema1(); - } - return instance; - } - } -} diff --git a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/responses/successwithjsonapiresponse/headers/Int32.kt b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/responses/successwithjsonapiresponse/headers/Int32.kt deleted file mode 100644 index 335c486ac51..00000000000 --- a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/responses/successwithjsonapiresponse/headers/Int32.kt +++ /dev/null @@ -1,7 +0,0 @@ -package org.openapijsonschematools.client.components.responses.successwithjsonapiresponse.headers; - -import org.openapijsonschematools.client.components.headers.Int32JsonContentTypeHeader; - -public class Int32 extends Int32JsonContentTypeHeader { - public static class Int321 extends Int32JsonContentTypeHeader1 {} -} diff --git a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/responses/successwithjsonapiresponse/headers/NumberHeader.kt b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/responses/successwithjsonapiresponse/headers/NumberHeader.kt deleted file mode 100644 index 0fd5232f8d9..00000000000 --- a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/responses/successwithjsonapiresponse/headers/NumberHeader.kt +++ /dev/null @@ -1,3 +0,0 @@ -package org.openapijsonschematools.client.components.responses.successwithjsonapiresponse.headers; - -public class NumberHeader extends org.openapijsonschematools.client.components.headers.NumberHeader {} diff --git a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/responses/successwithjsonapiresponse/headers/Refcontentschemaheader.kt b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/responses/successwithjsonapiresponse/headers/Refcontentschemaheader.kt deleted file mode 100644 index 4f5df9abe04..00000000000 --- a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/responses/successwithjsonapiresponse/headers/Refcontentschemaheader.kt +++ /dev/null @@ -1,7 +0,0 @@ -package org.openapijsonschematools.client.components.responses.successwithjsonapiresponse.headers; - -import org.openapijsonschematools.client.components.headers.RefContentSchemaHeader; - -public class Refcontentschemaheader extends RefContentSchemaHeader { - public static class Refcontentschemaheader1 extends RefContentSchemaHeader1 {} -} diff --git a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/responses/successwithjsonapiresponse/headers/Refschemaheader.kt b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/responses/successwithjsonapiresponse/headers/Refschemaheader.kt deleted file mode 100644 index ab531e35e1f..00000000000 --- a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/responses/successwithjsonapiresponse/headers/Refschemaheader.kt +++ /dev/null @@ -1,7 +0,0 @@ -package org.openapijsonschematools.client.components.responses.successwithjsonapiresponse.headers; - -import org.openapijsonschematools.client.components.headers.RefSchemaHeader; - -public class Refschemaheader extends RefSchemaHeader { - public static class Refschemaheader1 extends RefSchemaHeader1 {} -} diff --git a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/responses/successwithjsonapiresponse/headers/StringHeader.kt b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/responses/successwithjsonapiresponse/headers/StringHeader.kt deleted file mode 100644 index 339328f5b28..00000000000 --- a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/responses/successwithjsonapiresponse/headers/StringHeader.kt +++ /dev/null @@ -1,7 +0,0 @@ -package org.openapijsonschematools.client.components.responses.successwithjsonapiresponse.headers; - -import org.openapijsonschematools.client.components.headers.RefStringHeader; - -public class StringHeader extends RefStringHeader { - public static class StringHeader1 extends RefStringHeader1 {} -} diff --git a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/schemas/AbstractStepMessage.kt b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/schemas/AbstractStepMessage.kt deleted file mode 100644 index 3a8efe21ea9..00000000000 --- a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/schemas/AbstractStepMessage.kt +++ /dev/null @@ -1,455 +0,0 @@ -package org.openapijsonschematools.client.components.schemas; -import java.util.ArrayList; -import java.util.HashSet; -import java.util.LinkedHashMap; -import java.util.LinkedHashSet; -import java.util.List; -import java.util.Map; -import java.util.Objects; -import java.util.Set; -import org.checkerframework.checker.nullness.qual.Nullable; -import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags; -import org.openapijsonschematools.client.configurations.SchemaConfiguration; -import org.openapijsonschematools.client.exceptions.InvalidAdditionalPropertyException; -import org.openapijsonschematools.client.exceptions.UnsetPropertyException; -import org.openapijsonschematools.client.exceptions.ValidationException; -import org.openapijsonschematools.client.schemas.GenericBuilder; -import org.openapijsonschematools.client.schemas.StringJsonSchema; -import org.openapijsonschematools.client.schemas.UnsetAddPropsSetter; -import org.openapijsonschematools.client.schemas.validation.FrozenMap; -import org.openapijsonschematools.client.schemas.validation.JsonSchema; -import org.openapijsonschematools.client.schemas.validation.JsonSchemaInfo; -import org.openapijsonschematools.client.schemas.validation.MapSchemaValidator; -import org.openapijsonschematools.client.schemas.validation.PathToSchemasMap; -import org.openapijsonschematools.client.schemas.validation.PropertyEntry; -import org.openapijsonschematools.client.schemas.validation.ValidationMetadata; - -public class AbstractStepMessage { - // nest classes so all schemas and input/output classes can be public - - - public static class Discriminator extends StringJsonSchema.StringJsonSchema1 { - private static @Nullable Discriminator instance = null; - public static Discriminator getInstance() { - if (instance == null) { - instance = new Discriminator(); - } - return instance; - } - } - - - public static class AbstractStepMessageMap extends FrozenMap<@Nullable Object> { - protected AbstractStepMessageMap(FrozenMap<@Nullable Object> m) { - super(m); - } - public static final Set requiredKeys = Set.of( - "description", - "discriminator", - "sequenceNumber" - ); - public static final Set optionalKeys = Set.of(); - public static AbstractStepMessageMap of(Map arg, SchemaConfiguration configuration) throws ValidationException { - return AbstractStepMessage1.getInstance().validate(arg, configuration); - } - - public @Nullable Object 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 RuntimeException("Invalid value stored for discriminator"); - } - return (String) value; - } - - public @Nullable Object sequenceNumber() { - try { - return getOrThrow("version"); - } catch (UnsetPropertyException e) { - throw new RuntimeException(e); - } - } - - public @Nullable Object getAdditionalProperty(String name) throws UnsetPropertyException, InvalidAdditionalPropertyException { - throwIfKeyKnown(name, requiredKeys, optionalKeys); - throwIfKeyNotPresent(name); - return get(name); - } - } - - public interface SetterForDescription { - Map getInstance(); - T getBuilderAfterDescription(Map instance); - - default T description(Nothing? value) { - var instance = getInstance(); - instance.put("description", null); - return getBuilderAfterDescription(instance); - } - - default T description(boolean value) { - var instance = getInstance(); - instance.put("description", value); - return getBuilderAfterDescription(instance); - } - - default T description(String value) { - var instance = getInstance(); - instance.put("description", value); - return getBuilderAfterDescription(instance); - } - - default T description(int value) { - var instance = getInstance(); - instance.put("description", value); - return getBuilderAfterDescription(instance); - } - - default T description(float value) { - var instance = getInstance(); - instance.put("description", value); - return getBuilderAfterDescription(instance); - } - - default T description(long value) { - var instance = getInstance(); - instance.put("description", value); - return getBuilderAfterDescription(instance); - } - - default T description(double value) { - var instance = getInstance(); - instance.put("description", value); - return getBuilderAfterDescription(instance); - } - - default T description(List value) { - var instance = getInstance(); - instance.put("description", value); - return getBuilderAfterDescription(instance); - } - - default T description(Map value) { - var instance = getInstance(); - instance.put("description", value); - return getBuilderAfterDescription(instance); - } - } - - public interface SetterForDiscriminator { - Map getInstance(); - T getBuilderAfterDiscriminator(Map instance); - - default T discriminator(String value) { - var instance = getInstance(); - instance.put("discriminator", value); - return getBuilderAfterDiscriminator(instance); - } - } - - public interface SetterForSequenceNumber { - Map getInstance(); - T getBuilderAfterSequenceNumber(Map instance); - - default T sequenceNumber(Nothing? value) { - var instance = getInstance(); - instance.put("sequenceNumber", null); - return getBuilderAfterSequenceNumber(instance); - } - - default T sequenceNumber(boolean value) { - var instance = getInstance(); - instance.put("sequenceNumber", value); - return getBuilderAfterSequenceNumber(instance); - } - - default T sequenceNumber(String value) { - var instance = getInstance(); - instance.put("sequenceNumber", value); - return getBuilderAfterSequenceNumber(instance); - } - - default T sequenceNumber(int value) { - var instance = getInstance(); - instance.put("sequenceNumber", value); - return getBuilderAfterSequenceNumber(instance); - } - - default T sequenceNumber(float value) { - var instance = getInstance(); - instance.put("sequenceNumber", value); - return getBuilderAfterSequenceNumber(instance); - } - - default T sequenceNumber(long value) { - var instance = getInstance(); - instance.put("sequenceNumber", value); - return getBuilderAfterSequenceNumber(instance); - } - - default T sequenceNumber(double value) { - var instance = getInstance(); - instance.put("sequenceNumber", value); - return getBuilderAfterSequenceNumber(instance); - } - - default T sequenceNumber(List value) { - var instance = getInstance(); - instance.put("sequenceNumber", value); - return getBuilderAfterSequenceNumber(instance); - } - - default T sequenceNumber(Map value) { - var instance = getInstance(); - instance.put("sequenceNumber", value); - return getBuilderAfterSequenceNumber(instance); - } - } - - public static class AbstractStepMessageMap000Builder extends UnsetAddPropsSetter implements GenericBuilder> { - private final Map instance; - private static final Set knownKeys = Set.of( - "description", - "discriminator", - "sequenceNumber" - ); - public Set getKnownKeys() { - return knownKeys; - } - public AbstractStepMessageMap000Builder(Map instance) { - this.instance = instance; - } - public Map build() { - return instance; - } - public Map getInstance() { - return instance; - } - public AbstractStepMessageMap000Builder getBuilderAfterAdditionalProperty(Map instance) { - return this; - } - } - - public static class AbstractStepMessageMap001Builder implements SetterForSequenceNumber { - private final Map instance; - public AbstractStepMessageMap001Builder(Map instance) { - this.instance = instance; - } - public Map getInstance() { - return instance; - } - public AbstractStepMessageMap000Builder getBuilderAfterSequenceNumber(Map instance) { - return new AbstractStepMessageMap000Builder(instance); - } - } - - public static class AbstractStepMessageMap010Builder implements SetterForDiscriminator { - private final Map instance; - public AbstractStepMessageMap010Builder(Map instance) { - this.instance = instance; - } - public Map getInstance() { - return instance; - } - public AbstractStepMessageMap000Builder getBuilderAfterDiscriminator(Map instance) { - return new AbstractStepMessageMap000Builder(instance); - } - } - - public static class AbstractStepMessageMap011Builder implements SetterForDiscriminator, SetterForSequenceNumber { - private final Map instance; - public AbstractStepMessageMap011Builder(Map instance) { - this.instance = instance; - } - public Map getInstance() { - return instance; - } - public AbstractStepMessageMap001Builder getBuilderAfterDiscriminator(Map instance) { - return new AbstractStepMessageMap001Builder(instance); - } - public AbstractStepMessageMap010Builder getBuilderAfterSequenceNumber(Map instance) { - return new AbstractStepMessageMap010Builder(instance); - } - } - - public static class AbstractStepMessageMap100Builder implements SetterForDescription { - private final Map instance; - public AbstractStepMessageMap100Builder(Map instance) { - this.instance = instance; - } - public Map getInstance() { - return instance; - } - public AbstractStepMessageMap000Builder getBuilderAfterDescription(Map instance) { - return new AbstractStepMessageMap000Builder(instance); - } - } - - public static class AbstractStepMessageMap101Builder implements SetterForDescription, SetterForSequenceNumber { - private final Map instance; - public AbstractStepMessageMap101Builder(Map instance) { - this.instance = instance; - } - public Map getInstance() { - return instance; - } - public AbstractStepMessageMap001Builder getBuilderAfterDescription(Map instance) { - return new AbstractStepMessageMap001Builder(instance); - } - public AbstractStepMessageMap100Builder getBuilderAfterSequenceNumber(Map instance) { - return new AbstractStepMessageMap100Builder(instance); - } - } - - public static class AbstractStepMessageMap110Builder implements SetterForDescription, SetterForDiscriminator { - private final Map instance; - public AbstractStepMessageMap110Builder(Map instance) { - this.instance = instance; - } - public Map getInstance() { - return instance; - } - public AbstractStepMessageMap010Builder getBuilderAfterDescription(Map instance) { - return new AbstractStepMessageMap010Builder(instance); - } - public AbstractStepMessageMap100Builder getBuilderAfterDiscriminator(Map instance) { - return new AbstractStepMessageMap100Builder(instance); - } - } - - public static class AbstractStepMessageMapBuilder implements SetterForDescription, SetterForDiscriminator, SetterForSequenceNumber { - private final Map instance; - public AbstractStepMessageMapBuilder() { - this.instance = new LinkedHashMap<>(); - } - public Map getInstance() { - return instance; - } - public AbstractStepMessageMap011Builder getBuilderAfterDescription(Map instance) { - return new AbstractStepMessageMap011Builder(instance); - } - public AbstractStepMessageMap101Builder getBuilderAfterDiscriminator(Map instance) { - return new AbstractStepMessageMap101Builder(instance); - } - public AbstractStepMessageMap110Builder getBuilderAfterSequenceNumber(Map instance) { - return new AbstractStepMessageMap110Builder(instance); - } - } - - - public sealed interface AbstractStepMessage1Boxed permits AbstractStepMessage1BoxedMap { - @Nullable Object getData(); - } - - public record AbstractStepMessage1BoxedMap(AbstractStepMessageMap data) implements AbstractStepMessage1Boxed { - @Override - public @Nullable Object getData() { - return data; - } - } - - - public static class AbstractStepMessage1 extends JsonSchema implements MapSchemaValidator { - /* - NOTE: This class is auto generated by OpenAPI JSON Schema Generator. - Ref: https://github.com/openapi-json-schema-tools/openapi-json-schema-generator - - Do not edit the class manually. - - Abstract Step - */ - private static @Nullable AbstractStepMessage1 instance = null; - - protected AbstractStepMessage1() { - super(new JsonSchemaInfo() - .type(Set.of(Map.class)) - .properties(Map.ofEntries( - new PropertyEntry("discriminator", Discriminator.class) - )) - .required(Set.of( - "description", - "discriminator", - "sequenceNumber" - )) - .anyOf(List.of( - AbstractStepMessage1.class - )) - ); - } - - public static AbstractStepMessage1 getInstance() { - if (instance == null) { - instance = new AbstractStepMessage1(); - } - return instance; - } - - 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 RuntimeException("Invalid non-string key value"); - } - String propertyName = (String) entryKey; - List propertyPathToItem = new ArrayList<>(pathToItem); - propertyPathToItem.add(propertyName); - Object value = entry.getValue(); - LinkedHashMap, Nothing?> schemas = pathToSchemas.get(propertyPathToItem); - if (schemas == null) { - throw new RuntimeException("Validation result is invalid, schemas must exist for a pathToItem"); - } - JsonSchema propertySchema = schemas.entrySet().iterator().next().getKey(); - @Nullable Object propertyInstance = propertySchema.getNewInstance(value, propertyPathToItem, pathToSchemas); - properties.put(propertyName, propertyInstance); - } - FrozenMap<@Nullable Object> castProperties = new FrozenMap<>(properties); - return new AbstractStepMessageMap(castProperties); - } - - 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); - SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().build())); - ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, new PathToSchemasMap(), new LinkedHashSet<>()); - PathToSchemasMap pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet); - return getNewInstance(castArg, validationMetadata.pathToItem(), pathToSchemasMap); - } - - - @Override - public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws 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"); - } - @Override - public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { - if (arg instanceof Map) { - return getNewInstance((Map) arg, pathToItem, pathToSchemas); - } - 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 { - return new AbstractStepMessage1BoxedMap(validate(arg, configuration)); - } - @Override - public AbstractStepMessage1Boxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { - 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"); - } - } - -} diff --git a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/schemas/AdditionalPropertiesClass.kt b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/schemas/AdditionalPropertiesClass.kt deleted file mode 100644 index 3b28278419b..00000000000 --- a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/schemas/AdditionalPropertiesClass.kt +++ /dev/null @@ -1,1405 +0,0 @@ -package org.openapijsonschematools.client.components.schemas; -import java.util.ArrayList; -import java.util.HashSet; -import java.util.LinkedHashMap; -import java.util.LinkedHashSet; -import java.util.List; -import java.util.Map; -import java.util.Objects; -import java.util.Set; -import org.checkerframework.checker.nullness.qual.Nullable; -import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags; -import org.openapijsonschematools.client.configurations.SchemaConfiguration; -import org.openapijsonschematools.client.exceptions.InvalidAdditionalPropertyException; -import org.openapijsonschematools.client.exceptions.UnsetPropertyException; -import org.openapijsonschematools.client.exceptions.ValidationException; -import org.openapijsonschematools.client.schemas.AnyTypeJsonSchema; -import org.openapijsonschematools.client.schemas.GenericBuilder; -import org.openapijsonschematools.client.schemas.MapJsonSchema; -import org.openapijsonschematools.client.schemas.NotAnyTypeJsonSchema; -import org.openapijsonschematools.client.schemas.StringJsonSchema; -import org.openapijsonschematools.client.schemas.UnsetAddPropsSetter; -import org.openapijsonschematools.client.schemas.validation.FrozenMap; -import org.openapijsonschematools.client.schemas.validation.JsonSchema; -import org.openapijsonschematools.client.schemas.validation.JsonSchemaInfo; -import org.openapijsonschematools.client.schemas.validation.MapSchemaValidator; -import org.openapijsonschematools.client.schemas.validation.MapUtils; -import org.openapijsonschematools.client.schemas.validation.PathToSchemasMap; -import org.openapijsonschematools.client.schemas.validation.PropertyEntry; -import org.openapijsonschematools.client.schemas.validation.ValidationMetadata; - -public class AdditionalPropertiesClass { - // nest classes so all schemas and input/output classes can be public - - - public static class AdditionalProperties extends StringJsonSchema.StringJsonSchema1 { - private static @Nullable AdditionalProperties instance = null; - public static AdditionalProperties getInstance() { - if (instance == null) { - instance = new AdditionalProperties(); - } - return instance; - } - } - - - public static class MapPropertyMap extends FrozenMap { - protected MapPropertyMap(FrozenMap m) { - super(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 { - return MapProperty.getInstance().validate(arg, configuration); - } - - public String getAdditionalProperty(String name) throws UnsetPropertyException { - return getOrThrow(name); - } - } - - public interface SetterForAdditionalProperties { - Set getKnownKeys(); - Map getInstance(); - T getBuilderAfterAdditionalProperty(Map instance); - - default T additionalProperty(String key, String value) throws InvalidAdditionalPropertyException { - MapUtils.throwIfKeyKnown(key, getKnownKeys(), true); - var instance = getInstance(); - instance.put(key, value); - return getBuilderAfterAdditionalProperty(instance); - } - } - - public static class MapPropertyMapBuilder implements GenericBuilder>, SetterForAdditionalProperties { - private final Map instance; - private static final Set knownKeys = Set.of(); - public Set getKnownKeys() { - return knownKeys; - } - public MapPropertyMapBuilder() { - this.instance = new LinkedHashMap<>(); - } - public Map build() { - return instance; - } - public Map getInstance() { - return instance; - } - public MapPropertyMapBuilder getBuilderAfterAdditionalProperty(Map instance) { - return this; - } - } - - - public sealed interface MapPropertyBoxed permits MapPropertyBoxedMap { - @Nullable Object getData(); - } - - public record MapPropertyBoxedMap(MapPropertyMap data) implements MapPropertyBoxed { - @Override - public @Nullable Object getData() { - return data; - } - } - - - public static class MapProperty extends JsonSchema implements MapSchemaValidator { - private static @Nullable MapProperty instance = null; - - protected MapProperty() { - super(new JsonSchemaInfo() - .type(Set.of(Map.class)) - .additionalProperties(AdditionalProperties.class) - ); - } - - public static MapProperty getInstance() { - if (instance == null) { - instance = new MapProperty(); - } - return instance; - } - - 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 RuntimeException("Invalid non-string key value"); - } - String propertyName = (String) entryKey; - List propertyPathToItem = new ArrayList<>(pathToItem); - propertyPathToItem.add(propertyName); - Object value = entry.getValue(); - LinkedHashMap, Nothing?> schemas = pathToSchemas.get(propertyPathToItem); - if (schemas == null) { - throw new RuntimeException("Validation 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"); - } - properties.put(propertyName, (String) propertyInstance); - } - FrozenMap castProperties = new FrozenMap<>(properties); - return new MapPropertyMap(castProperties); - } - - 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); - SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().build())); - ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, new PathToSchemasMap(), new LinkedHashSet<>()); - PathToSchemasMap pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet); - return getNewInstance(castArg, validationMetadata.pathToItem(), pathToSchemasMap); - } - - - @Override - public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws 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"); - } - @Override - public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { - if (arg instanceof Map) { - return getNewInstance((Map) arg, pathToItem, pathToSchemas); - } - 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 { - return new MapPropertyBoxedMap(validate(arg, configuration)); - } - @Override - public MapPropertyBoxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { - 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"); - } - } - - - public static class AdditionalProperties2 extends StringJsonSchema.StringJsonSchema1 { - private static @Nullable AdditionalProperties2 instance = null; - public static AdditionalProperties2 getInstance() { - if (instance == null) { - instance = new AdditionalProperties2(); - } - return instance; - } - } - - - public static class AdditionalPropertiesMap extends FrozenMap { - protected AdditionalPropertiesMap(FrozenMap m) { - super(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 { - return AdditionalProperties1.getInstance().validate(arg, configuration); - } - - public String getAdditionalProperty(String name) throws UnsetPropertyException { - return getOrThrow(name); - } - } - - public interface SetterForAdditionalProperties2 { - Set getKnownKeys(); - Map getInstance(); - T getBuilderAfterAdditionalProperty(Map instance); - - default T additionalProperty(String key, String value) throws InvalidAdditionalPropertyException { - MapUtils.throwIfKeyKnown(key, getKnownKeys(), true); - var instance = getInstance(); - instance.put(key, value); - return getBuilderAfterAdditionalProperty(instance); - } - } - - public static class AdditionalPropertiesMapBuilder2 implements GenericBuilder>, SetterForAdditionalProperties2 { - private final Map instance; - private static final Set knownKeys = Set.of(); - public Set getKnownKeys() { - return knownKeys; - } - public AdditionalPropertiesMapBuilder2() { - this.instance = new LinkedHashMap<>(); - } - public Map build() { - return instance; - } - public Map getInstance() { - return instance; - } - public AdditionalPropertiesMapBuilder2 getBuilderAfterAdditionalProperty(Map instance) { - return this; - } - } - - - public sealed interface AdditionalProperties1Boxed permits AdditionalProperties1BoxedMap { - @Nullable Object getData(); - } - - public record AdditionalProperties1BoxedMap(AdditionalPropertiesMap data) implements AdditionalProperties1Boxed { - @Override - public @Nullable Object getData() { - return data; - } - } - - - public static class AdditionalProperties1 extends JsonSchema implements MapSchemaValidator { - private static @Nullable AdditionalProperties1 instance = null; - - protected AdditionalProperties1() { - super(new JsonSchemaInfo() - .type(Set.of(Map.class)) - .additionalProperties(AdditionalProperties2.class) - ); - } - - public static AdditionalProperties1 getInstance() { - if (instance == null) { - instance = new AdditionalProperties1(); - } - return instance; - } - - 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 RuntimeException("Invalid non-string key value"); - } - String propertyName = (String) entryKey; - List propertyPathToItem = new ArrayList<>(pathToItem); - propertyPathToItem.add(propertyName); - Object value = entry.getValue(); - LinkedHashMap, Nothing?> schemas = pathToSchemas.get(propertyPathToItem); - if (schemas == null) { - throw new RuntimeException("Validation 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"); - } - properties.put(propertyName, (String) propertyInstance); - } - FrozenMap castProperties = new FrozenMap<>(properties); - return new AdditionalPropertiesMap(castProperties); - } - - 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); - SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().build())); - ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, new PathToSchemasMap(), new LinkedHashSet<>()); - PathToSchemasMap pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet); - return getNewInstance(castArg, validationMetadata.pathToItem(), pathToSchemasMap); - } - - - @Override - public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws 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"); - } - @Override - public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { - if (arg instanceof Map) { - return getNewInstance((Map) arg, pathToItem, pathToSchemas); - } - 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 { - return new AdditionalProperties1BoxedMap(validate(arg, configuration)); - } - @Override - public AdditionalProperties1Boxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { - 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"); - } - } - - - public static class MapOfMapPropertyMap extends FrozenMap { - protected MapOfMapPropertyMap(FrozenMap m) { - super(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 { - return MapOfMapProperty.getInstance().validate(arg, configuration); - } - - public AdditionalPropertiesMap getAdditionalProperty(String name) throws UnsetPropertyException { - return getOrThrow(name); - } - } - - public interface SetterForAdditionalProperties1 { - Set getKnownKeys(); - Map> getInstance(); - T getBuilderAfterAdditionalProperty(Map> instance); - - default T additionalProperty(String key, Map value) throws InvalidAdditionalPropertyException { - MapUtils.throwIfKeyKnown(key, getKnownKeys(), true); - var instance = getInstance(); - instance.put(key, value); - return getBuilderAfterAdditionalProperty(instance); - } - } - - public static class MapOfMapPropertyMapBuilder implements GenericBuilder>>, SetterForAdditionalProperties1 { - private final Map> instance; - private static final Set knownKeys = Set.of(); - public Set getKnownKeys() { - return knownKeys; - } - public MapOfMapPropertyMapBuilder() { - this.instance = new LinkedHashMap<>(); - } - public Map> build() { - return instance; - } - public Map> getInstance() { - return instance; - } - public MapOfMapPropertyMapBuilder getBuilderAfterAdditionalProperty(Map> instance) { - return this; - } - } - - - public sealed interface MapOfMapPropertyBoxed permits MapOfMapPropertyBoxedMap { - @Nullable Object getData(); - } - - public record MapOfMapPropertyBoxedMap(MapOfMapPropertyMap data) implements MapOfMapPropertyBoxed { - @Override - public @Nullable Object getData() { - return data; - } - } - - - public static class MapOfMapProperty extends JsonSchema implements MapSchemaValidator { - private static @Nullable MapOfMapProperty instance = null; - - protected MapOfMapProperty() { - super(new JsonSchemaInfo() - .type(Set.of(Map.class)) - .additionalProperties(AdditionalProperties1.class) - ); - } - - public static MapOfMapProperty getInstance() { - if (instance == null) { - instance = new MapOfMapProperty(); - } - return instance; - } - - 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 RuntimeException("Invalid non-string key value"); - } - String propertyName = (String) entryKey; - List propertyPathToItem = new ArrayList<>(pathToItem); - propertyPathToItem.add(propertyName); - Object value = entry.getValue(); - LinkedHashMap, Nothing?> schemas = pathToSchemas.get(propertyPathToItem); - if (schemas == null) { - throw new RuntimeException("Validation 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"); - } - properties.put(propertyName, (AdditionalPropertiesMap) propertyInstance); - } - FrozenMap castProperties = new FrozenMap<>(properties); - return new MapOfMapPropertyMap(castProperties); - } - - 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); - SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().build())); - ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, new PathToSchemasMap(), new LinkedHashSet<>()); - PathToSchemasMap pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet); - return getNewInstance(castArg, validationMetadata.pathToItem(), pathToSchemasMap); - } - - - @Override - public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws 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"); - } - @Override - public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { - if (arg instanceof Map) { - return getNewInstance((Map) arg, pathToItem, pathToSchemas); - } - 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 { - return new MapOfMapPropertyBoxedMap(validate(arg, configuration)); - } - @Override - public MapOfMapPropertyBoxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { - 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"); - } - } - - - public static class Anytype1 extends AnyTypeJsonSchema.AnyTypeJsonSchema1 { - private static @Nullable Anytype1 instance = null; - public static Anytype1 getInstance() { - if (instance == null) { - instance = new Anytype1(); - } - return instance; - } - } - - - public static class MapWithUndeclaredPropertiesAnytype1 extends MapJsonSchema.MapJsonSchema1 { - private static @Nullable MapWithUndeclaredPropertiesAnytype1 instance = null; - public static MapWithUndeclaredPropertiesAnytype1 getInstance() { - if (instance == null) { - instance = new MapWithUndeclaredPropertiesAnytype1(); - } - return instance; - } - } - - - public static class MapWithUndeclaredPropertiesAnytype2 extends MapJsonSchema.MapJsonSchema1 { - private static @Nullable MapWithUndeclaredPropertiesAnytype2 instance = null; - public static MapWithUndeclaredPropertiesAnytype2 getInstance() { - if (instance == null) { - instance = new MapWithUndeclaredPropertiesAnytype2(); - } - return instance; - } - } - - - public static class AdditionalProperties3 extends AnyTypeJsonSchema.AnyTypeJsonSchema1 { - private static @Nullable AdditionalProperties3 instance = null; - public static AdditionalProperties3 getInstance() { - if (instance == null) { - instance = new AdditionalProperties3(); - } - return instance; - } - } - - - public static class MapWithUndeclaredPropertiesAnytype3Map extends FrozenMap<@Nullable Object> { - protected MapWithUndeclaredPropertiesAnytype3Map(FrozenMap<@Nullable Object> m) { - super(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 { - return MapWithUndeclaredPropertiesAnytype3.getInstance().validate(arg, configuration); - } - - public @Nullable Object getAdditionalProperty(String name) throws UnsetPropertyException { - return getOrThrow(name); - } - } - - public interface SetterForAdditionalProperties3 { - Set getKnownKeys(); - Map getInstance(); - T getBuilderAfterAdditionalProperty(Map instance); - - default T additionalProperty(String key, Nothing? value) throws InvalidAdditionalPropertyException { - MapUtils.throwIfKeyKnown(key, getKnownKeys(), true); - var instance = getInstance(); - instance.put(key, null); - return getBuilderAfterAdditionalProperty(instance); - } - - default T additionalProperty(String key, boolean value) throws InvalidAdditionalPropertyException { - MapUtils.throwIfKeyKnown(key, getKnownKeys(), true); - var instance = getInstance(); - instance.put(key, value); - return getBuilderAfterAdditionalProperty(instance); - } - - default T additionalProperty(String key, String value) throws InvalidAdditionalPropertyException { - MapUtils.throwIfKeyKnown(key, getKnownKeys(), true); - var instance = getInstance(); - instance.put(key, value); - return getBuilderAfterAdditionalProperty(instance); - } - - default T additionalProperty(String key, int value) throws InvalidAdditionalPropertyException { - MapUtils.throwIfKeyKnown(key, getKnownKeys(), true); - var instance = getInstance(); - instance.put(key, value); - return getBuilderAfterAdditionalProperty(instance); - } - - default T additionalProperty(String key, float value) throws InvalidAdditionalPropertyException { - MapUtils.throwIfKeyKnown(key, getKnownKeys(), true); - var instance = getInstance(); - instance.put(key, value); - return getBuilderAfterAdditionalProperty(instance); - } - - default T additionalProperty(String key, long value) throws InvalidAdditionalPropertyException { - MapUtils.throwIfKeyKnown(key, getKnownKeys(), true); - var instance = getInstance(); - instance.put(key, value); - return getBuilderAfterAdditionalProperty(instance); - } - - default T additionalProperty(String key, double value) throws InvalidAdditionalPropertyException { - MapUtils.throwIfKeyKnown(key, getKnownKeys(), true); - var instance = getInstance(); - instance.put(key, value); - return getBuilderAfterAdditionalProperty(instance); - } - - default T additionalProperty(String key, List value) throws InvalidAdditionalPropertyException { - MapUtils.throwIfKeyKnown(key, getKnownKeys(), true); - var instance = getInstance(); - instance.put(key, value); - return getBuilderAfterAdditionalProperty(instance); - } - - default T additionalProperty(String key, Map value) throws InvalidAdditionalPropertyException { - MapUtils.throwIfKeyKnown(key, getKnownKeys(), true); - var instance = getInstance(); - instance.put(key, value); - return getBuilderAfterAdditionalProperty(instance); - } - } - - public static class MapWithUndeclaredPropertiesAnytype3MapBuilder implements GenericBuilder>, SetterForAdditionalProperties3 { - private final Map instance; - private static final Set knownKeys = Set.of(); - public Set getKnownKeys() { - return knownKeys; - } - public MapWithUndeclaredPropertiesAnytype3MapBuilder() { - this.instance = new LinkedHashMap<>(); - } - public Map build() { - return instance; - } - public Map getInstance() { - return instance; - } - public MapWithUndeclaredPropertiesAnytype3MapBuilder getBuilderAfterAdditionalProperty(Map instance) { - return this; - } - } - - - public sealed interface MapWithUndeclaredPropertiesAnytype3Boxed permits MapWithUndeclaredPropertiesAnytype3BoxedMap { - @Nullable Object getData(); - } - - public record MapWithUndeclaredPropertiesAnytype3BoxedMap(MapWithUndeclaredPropertiesAnytype3Map data) implements MapWithUndeclaredPropertiesAnytype3Boxed { - @Override - public @Nullable Object getData() { - return data; - } - } - - - public static class MapWithUndeclaredPropertiesAnytype3 extends JsonSchema implements MapSchemaValidator { - private static @Nullable MapWithUndeclaredPropertiesAnytype3 instance = null; - - protected MapWithUndeclaredPropertiesAnytype3() { - super(new JsonSchemaInfo() - .type(Set.of(Map.class)) - .additionalProperties(AdditionalProperties3.class) - ); - } - - public static MapWithUndeclaredPropertiesAnytype3 getInstance() { - if (instance == null) { - instance = new MapWithUndeclaredPropertiesAnytype3(); - } - return instance; - } - - 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 RuntimeException("Invalid non-string key value"); - } - String propertyName = (String) entryKey; - List propertyPathToItem = new ArrayList<>(pathToItem); - propertyPathToItem.add(propertyName); - Object value = entry.getValue(); - LinkedHashMap, Nothing?> schemas = pathToSchemas.get(propertyPathToItem); - if (schemas == null) { - throw new RuntimeException("Validation result is invalid, schemas must exist for a pathToItem"); - } - JsonSchema propertySchema = schemas.entrySet().iterator().next().getKey(); - @Nullable Object propertyInstance = propertySchema.getNewInstance(value, propertyPathToItem, pathToSchemas); - properties.put(propertyName, propertyInstance); - } - FrozenMap<@Nullable Object> castProperties = new FrozenMap<>(properties); - return new MapWithUndeclaredPropertiesAnytype3Map(castProperties); - } - - 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); - SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().build())); - ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, new PathToSchemasMap(), new LinkedHashSet<>()); - PathToSchemasMap pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet); - return getNewInstance(castArg, validationMetadata.pathToItem(), pathToSchemasMap); - } - - - @Override - public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws 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"); - } - @Override - public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { - if (arg instanceof Map) { - return getNewInstance((Map) arg, pathToItem, pathToSchemas); - } - 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 { - return new MapWithUndeclaredPropertiesAnytype3BoxedMap(validate(arg, configuration)); - } - @Override - public MapWithUndeclaredPropertiesAnytype3Boxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { - 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"); - } - } - - - public static class AdditionalProperties4 extends NotAnyTypeJsonSchema.NotAnyTypeJsonSchema1 { - // NotAnyTypeSchema - private static @Nullable AdditionalProperties4 instance = null; - public static AdditionalProperties4 getInstance() { - if (instance == null) { - instance = new AdditionalProperties4(); - } - return instance; - } - } - - - public static class EmptyMapMap extends FrozenMap<@Nullable Object> { - protected EmptyMapMap(FrozenMap<@Nullable Object> m) { - super(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 { - return EmptyMap.getInstance().validate(arg, configuration); - } - } - - public static class EmptyMapMapBuilder implements GenericBuilder> { - private final Map instance; - private static final Set knownKeys = Set.of(); - public Set getKnownKeys() { - return knownKeys; - } - public EmptyMapMapBuilder() { - this.instance = new LinkedHashMap<>(); - } - public Map build() { - return instance; - } - } - - - public sealed interface EmptyMapBoxed permits EmptyMapBoxedMap { - @Nullable Object getData(); - } - - public record EmptyMapBoxedMap(EmptyMapMap data) implements EmptyMapBoxed { - @Override - public @Nullable Object getData() { - return data; - } - } - - - public static class EmptyMap extends JsonSchema implements MapSchemaValidator { - private static @Nullable EmptyMap instance = null; - - protected EmptyMap() { - super(new JsonSchemaInfo() - .type(Set.of(Map.class)) - .additionalProperties(AdditionalProperties4.class) - ); - } - - public static EmptyMap getInstance() { - if (instance == null) { - instance = new EmptyMap(); - } - return instance; - } - - 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 RuntimeException("Invalid non-string key value"); - } - String propertyName = (String) entryKey; - List propertyPathToItem = new ArrayList<>(pathToItem); - propertyPathToItem.add(propertyName); - Object value = entry.getValue(); - LinkedHashMap, Nothing?> schemas = pathToSchemas.get(propertyPathToItem); - if (schemas == null) { - throw new RuntimeException("Validation result is invalid, schemas must exist for a pathToItem"); - } - JsonSchema propertySchema = schemas.entrySet().iterator().next().getKey(); - @Nullable Object propertyInstance = propertySchema.getNewInstance(value, propertyPathToItem, pathToSchemas); - properties.put(propertyName, propertyInstance); - } - FrozenMap<@Nullable Object> castProperties = new FrozenMap<>(properties); - return new EmptyMapMap(castProperties); - } - - 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); - SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().build())); - ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, new PathToSchemasMap(), new LinkedHashSet<>()); - PathToSchemasMap pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet); - return getNewInstance(castArg, validationMetadata.pathToItem(), pathToSchemasMap); - } - - - @Override - public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws 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"); - } - @Override - public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { - if (arg instanceof Map) { - return getNewInstance((Map) arg, pathToItem, pathToSchemas); - } - 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 { - return new EmptyMapBoxedMap(validate(arg, configuration)); - } - @Override - public EmptyMapBoxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { - 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"); - } - } - - - public static class AdditionalProperties5 extends StringJsonSchema.StringJsonSchema1 { - private static @Nullable AdditionalProperties5 instance = null; - public static AdditionalProperties5 getInstance() { - if (instance == null) { - instance = new AdditionalProperties5(); - } - return instance; - } - } - - - public static class MapWithUndeclaredPropertiesStringMap extends FrozenMap { - protected MapWithUndeclaredPropertiesStringMap(FrozenMap m) { - super(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 { - return MapWithUndeclaredPropertiesString.getInstance().validate(arg, configuration); - } - - public String getAdditionalProperty(String name) throws UnsetPropertyException { - return getOrThrow(name); - } - } - - public interface SetterForAdditionalProperties5 { - Set getKnownKeys(); - Map getInstance(); - T getBuilderAfterAdditionalProperty(Map instance); - - default T additionalProperty(String key, String value) throws InvalidAdditionalPropertyException { - MapUtils.throwIfKeyKnown(key, getKnownKeys(), true); - var instance = getInstance(); - instance.put(key, value); - return getBuilderAfterAdditionalProperty(instance); - } - } - - public static class MapWithUndeclaredPropertiesStringMapBuilder implements GenericBuilder>, SetterForAdditionalProperties5 { - private final Map instance; - private static final Set knownKeys = Set.of(); - public Set getKnownKeys() { - return knownKeys; - } - public MapWithUndeclaredPropertiesStringMapBuilder() { - this.instance = new LinkedHashMap<>(); - } - public Map build() { - return instance; - } - public Map getInstance() { - return instance; - } - public MapWithUndeclaredPropertiesStringMapBuilder getBuilderAfterAdditionalProperty(Map instance) { - return this; - } - } - - - public sealed interface MapWithUndeclaredPropertiesStringBoxed permits MapWithUndeclaredPropertiesStringBoxedMap { - @Nullable Object getData(); - } - - public record MapWithUndeclaredPropertiesStringBoxedMap(MapWithUndeclaredPropertiesStringMap data) implements MapWithUndeclaredPropertiesStringBoxed { - @Override - public @Nullable Object getData() { - return data; - } - } - - - public static class MapWithUndeclaredPropertiesString extends JsonSchema implements MapSchemaValidator { - private static @Nullable MapWithUndeclaredPropertiesString instance = null; - - protected MapWithUndeclaredPropertiesString() { - super(new JsonSchemaInfo() - .type(Set.of(Map.class)) - .additionalProperties(AdditionalProperties5.class) - ); - } - - public static MapWithUndeclaredPropertiesString getInstance() { - if (instance == null) { - instance = new MapWithUndeclaredPropertiesString(); - } - return instance; - } - - 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 RuntimeException("Invalid non-string key value"); - } - String propertyName = (String) entryKey; - List propertyPathToItem = new ArrayList<>(pathToItem); - propertyPathToItem.add(propertyName); - Object value = entry.getValue(); - LinkedHashMap, Nothing?> schemas = pathToSchemas.get(propertyPathToItem); - if (schemas == null) { - throw new RuntimeException("Validation 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"); - } - properties.put(propertyName, (String) propertyInstance); - } - FrozenMap castProperties = new FrozenMap<>(properties); - return new MapWithUndeclaredPropertiesStringMap(castProperties); - } - - 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); - SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().build())); - ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, new PathToSchemasMap(), new LinkedHashSet<>()); - PathToSchemasMap pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet); - return getNewInstance(castArg, validationMetadata.pathToItem(), pathToSchemasMap); - } - - - @Override - public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws 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"); - } - @Override - public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { - if (arg instanceof Map) { - return getNewInstance((Map) arg, pathToItem, pathToSchemas); - } - 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 { - return new MapWithUndeclaredPropertiesStringBoxedMap(validate(arg, configuration)); - } - @Override - public MapWithUndeclaredPropertiesStringBoxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { - 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"); - } - } - - - public static class AdditionalPropertiesClassMap extends FrozenMap<@Nullable Object> { - protected AdditionalPropertiesClassMap(FrozenMap<@Nullable Object> m) { - super(m); - } - public static final Set requiredKeys = Set.of(); - public static final Set optionalKeys = Set.of( - "map_property", - "map_of_map_property", - "anytype_1", - "map_with_undeclared_properties_anytype_1", - "map_with_undeclared_properties_anytype_2", - "map_with_undeclared_properties_anytype_3", - "empty_map", - "map_with_undeclared_properties_string" - ); - public static AdditionalPropertiesClassMap of(Map arg, SchemaConfiguration configuration) throws ValidationException { - return AdditionalPropertiesClass1.getInstance().validate(arg, configuration); - } - - public MapPropertyMap map_property() throws UnsetPropertyException { - String key = "map_property"; - throwIfKeyNotPresent(key); - @Nullable Object value = get(key); - if (!(value instanceof MapPropertyMap)) { - throw new RuntimeException("Invalid value stored for map_property"); - } - return (MapPropertyMap) value; - } - - public MapOfMapPropertyMap map_of_map_property() throws UnsetPropertyException { - String key = "map_of_map_property"; - throwIfKeyNotPresent(key); - @Nullable Object value = get(key); - if (!(value instanceof MapOfMapPropertyMap)) { - throw new RuntimeException("Invalid value stored for map_of_map_property"); - } - return (MapOfMapPropertyMap) value; - } - - public @Nullable Object anytype_1() throws UnsetPropertyException { - return getOrThrow("anytype_1"); - } - - public FrozenMap map_with_undeclared_properties_anytype_1() throws UnsetPropertyException { - String key = "map_with_undeclared_properties_anytype_1"; - throwIfKeyNotPresent(key); - @Nullable Object value = get(key); - if (!(value instanceof FrozenMap)) { - throw new RuntimeException("Invalid value stored for map_with_undeclared_properties_anytype_1"); - } - return (FrozenMap) value; - } - - public FrozenMap map_with_undeclared_properties_anytype_2() throws UnsetPropertyException { - String key = "map_with_undeclared_properties_anytype_2"; - throwIfKeyNotPresent(key); - @Nullable Object value = get(key); - if (!(value instanceof FrozenMap)) { - throw new RuntimeException("Invalid value stored for map_with_undeclared_properties_anytype_2"); - } - return (FrozenMap) value; - } - - public MapWithUndeclaredPropertiesAnytype3Map map_with_undeclared_properties_anytype_3() throws UnsetPropertyException { - String key = "map_with_undeclared_properties_anytype_3"; - throwIfKeyNotPresent(key); - @Nullable Object value = get(key); - if (!(value instanceof MapWithUndeclaredPropertiesAnytype3Map)) { - throw new RuntimeException("Invalid value stored for map_with_undeclared_properties_anytype_3"); - } - return (MapWithUndeclaredPropertiesAnytype3Map) value; - } - - public EmptyMapMap empty_map() throws UnsetPropertyException { - String key = "empty_map"; - throwIfKeyNotPresent(key); - @Nullable Object value = get(key); - if (!(value instanceof EmptyMapMap)) { - throw new RuntimeException("Invalid value stored for empty_map"); - } - return (EmptyMapMap) value; - } - - public MapWithUndeclaredPropertiesStringMap map_with_undeclared_properties_string() throws UnsetPropertyException { - String key = "map_with_undeclared_properties_string"; - throwIfKeyNotPresent(key); - @Nullable Object value = get(key); - if (!(value instanceof MapWithUndeclaredPropertiesStringMap)) { - throw new RuntimeException("Invalid value stored for map_with_undeclared_properties_string"); - } - return (MapWithUndeclaredPropertiesStringMap) value; - } - - public @Nullable Object getAdditionalProperty(String name) throws UnsetPropertyException, InvalidAdditionalPropertyException { - throwIfKeyKnown(name, requiredKeys, optionalKeys); - throwIfKeyNotPresent(name); - return get(name); - } - } - - public interface SetterForMapProperty { - Map getInstance(); - T getBuilderAfterMapProperty(Map instance); - - default T map_property(Map value) { - var instance = getInstance(); - instance.put("map_property", value); - return getBuilderAfterMapProperty(instance); - } - } - - public interface SetterForMapOfMapProperty { - Map getInstance(); - T getBuilderAfterMapOfMapProperty(Map instance); - - default T map_of_map_property(Map> value) { - var instance = getInstance(); - instance.put("map_of_map_property", value); - return getBuilderAfterMapOfMapProperty(instance); - } - } - - public interface SetterForAnytype1 { - Map getInstance(); - T getBuilderAfterAnytype1(Map instance); - - default T anytype_1(Nothing? value) { - var instance = getInstance(); - instance.put("anytype_1", null); - return getBuilderAfterAnytype1(instance); - } - - default T anytype_1(boolean value) { - var instance = getInstance(); - instance.put("anytype_1", value); - return getBuilderAfterAnytype1(instance); - } - - default T anytype_1(String value) { - var instance = getInstance(); - instance.put("anytype_1", value); - return getBuilderAfterAnytype1(instance); - } - - default T anytype_1(int value) { - var instance = getInstance(); - instance.put("anytype_1", value); - return getBuilderAfterAnytype1(instance); - } - - default T anytype_1(float value) { - var instance = getInstance(); - instance.put("anytype_1", value); - return getBuilderAfterAnytype1(instance); - } - - default T anytype_1(long value) { - var instance = getInstance(); - instance.put("anytype_1", value); - return getBuilderAfterAnytype1(instance); - } - - default T anytype_1(double value) { - var instance = getInstance(); - instance.put("anytype_1", value); - return getBuilderAfterAnytype1(instance); - } - - default T anytype_1(List value) { - var instance = getInstance(); - instance.put("anytype_1", value); - return getBuilderAfterAnytype1(instance); - } - - default T anytype_1(Map value) { - var instance = getInstance(); - instance.put("anytype_1", value); - return getBuilderAfterAnytype1(instance); - } - } - - public interface SetterForMapWithUndeclaredPropertiesAnytype1 { - Map getInstance(); - T getBuilderAfterMapWithUndeclaredPropertiesAnytype1(Map instance); - - default T map_with_undeclared_properties_anytype_1(Map value) { - var instance = getInstance(); - instance.put("map_with_undeclared_properties_anytype_1", value); - return getBuilderAfterMapWithUndeclaredPropertiesAnytype1(instance); - } - } - - public interface SetterForMapWithUndeclaredPropertiesAnytype2 { - Map getInstance(); - T getBuilderAfterMapWithUndeclaredPropertiesAnytype2(Map instance); - - default T map_with_undeclared_properties_anytype_2(Map value) { - var instance = getInstance(); - instance.put("map_with_undeclared_properties_anytype_2", value); - return getBuilderAfterMapWithUndeclaredPropertiesAnytype2(instance); - } - } - - public interface SetterForMapWithUndeclaredPropertiesAnytype3 { - Map getInstance(); - T getBuilderAfterMapWithUndeclaredPropertiesAnytype3(Map instance); - - default T map_with_undeclared_properties_anytype_3(Map value) { - var instance = getInstance(); - instance.put("map_with_undeclared_properties_anytype_3", value); - return getBuilderAfterMapWithUndeclaredPropertiesAnytype3(instance); - } - } - - public interface SetterForEmptyMap { - Map getInstance(); - T getBuilderAfterEmptyMap(Map instance); - - default T empty_map(Map value) { - var instance = getInstance(); - instance.put("empty_map", value); - return getBuilderAfterEmptyMap(instance); - } - } - - public interface SetterForMapWithUndeclaredPropertiesString { - Map getInstance(); - T getBuilderAfterMapWithUndeclaredPropertiesString(Map instance); - - default T map_with_undeclared_properties_string(Map value) { - var instance = getInstance(); - instance.put("map_with_undeclared_properties_string", value); - return getBuilderAfterMapWithUndeclaredPropertiesString(instance); - } - } - - public static class AdditionalPropertiesClassMapBuilder extends UnsetAddPropsSetter implements GenericBuilder>, SetterForMapProperty, SetterForMapOfMapProperty, SetterForAnytype1, SetterForMapWithUndeclaredPropertiesAnytype1, SetterForMapWithUndeclaredPropertiesAnytype2, SetterForMapWithUndeclaredPropertiesAnytype3, SetterForEmptyMap, SetterForMapWithUndeclaredPropertiesString { - private final Map instance; - private static final Set knownKeys = Set.of( - "map_property", - "map_of_map_property", - "anytype_1", - "map_with_undeclared_properties_anytype_1", - "map_with_undeclared_properties_anytype_2", - "map_with_undeclared_properties_anytype_3", - "empty_map", - "map_with_undeclared_properties_string" - ); - public Set getKnownKeys() { - return knownKeys; - } - public AdditionalPropertiesClassMapBuilder() { - this.instance = new LinkedHashMap<>(); - } - public Map build() { - return instance; - } - public Map getInstance() { - return instance; - } - public AdditionalPropertiesClassMapBuilder getBuilderAfterMapProperty(Map instance) { - return this; - } - public AdditionalPropertiesClassMapBuilder getBuilderAfterMapOfMapProperty(Map instance) { - return this; - } - public AdditionalPropertiesClassMapBuilder getBuilderAfterAnytype1(Map instance) { - return this; - } - public AdditionalPropertiesClassMapBuilder getBuilderAfterMapWithUndeclaredPropertiesAnytype1(Map instance) { - return this; - } - public AdditionalPropertiesClassMapBuilder getBuilderAfterMapWithUndeclaredPropertiesAnytype2(Map instance) { - return this; - } - public AdditionalPropertiesClassMapBuilder getBuilderAfterMapWithUndeclaredPropertiesAnytype3(Map instance) { - return this; - } - public AdditionalPropertiesClassMapBuilder getBuilderAfterEmptyMap(Map instance) { - return this; - } - public AdditionalPropertiesClassMapBuilder getBuilderAfterMapWithUndeclaredPropertiesString(Map instance) { - return this; - } - public AdditionalPropertiesClassMapBuilder getBuilderAfterAdditionalProperty(Map instance) { - return this; - } - } - - - public sealed interface AdditionalPropertiesClass1Boxed permits AdditionalPropertiesClass1BoxedMap { - @Nullable Object getData(); - } - - public record AdditionalPropertiesClass1BoxedMap(AdditionalPropertiesClassMap data) implements AdditionalPropertiesClass1Boxed { - @Override - public @Nullable Object getData() { - return data; - } - } - - - public static class AdditionalPropertiesClass1 extends JsonSchema implements MapSchemaValidator { - /* - NOTE: This class is auto generated by OpenAPI JSON Schema Generator. - Ref: https://github.com/openapi-json-schema-tools/openapi-json-schema-generator - - Do not edit the class manually. - */ - private static @Nullable AdditionalPropertiesClass1 instance = null; - - protected AdditionalPropertiesClass1() { - super(new JsonSchemaInfo() - .type(Set.of(Map.class)) - .properties(Map.ofEntries( - new PropertyEntry("map_property", MapProperty.class), - new PropertyEntry("map_of_map_property", MapOfMapProperty.class), - new PropertyEntry("anytype_1", Anytype1.class), - new PropertyEntry("map_with_undeclared_properties_anytype_1", MapWithUndeclaredPropertiesAnytype1.class), - new PropertyEntry("map_with_undeclared_properties_anytype_2", MapWithUndeclaredPropertiesAnytype2.class), - new PropertyEntry("map_with_undeclared_properties_anytype_3", MapWithUndeclaredPropertiesAnytype3.class), - new PropertyEntry("empty_map", EmptyMap.class), - new PropertyEntry("map_with_undeclared_properties_string", MapWithUndeclaredPropertiesString.class) - )) - ); - } - - public static AdditionalPropertiesClass1 getInstance() { - if (instance == null) { - instance = new AdditionalPropertiesClass1(); - } - return instance; - } - - 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 RuntimeException("Invalid non-string key value"); - } - String propertyName = (String) entryKey; - List propertyPathToItem = new ArrayList<>(pathToItem); - propertyPathToItem.add(propertyName); - Object value = entry.getValue(); - LinkedHashMap, Nothing?> schemas = pathToSchemas.get(propertyPathToItem); - if (schemas == null) { - throw new RuntimeException("Validation result is invalid, schemas must exist for a pathToItem"); - } - JsonSchema propertySchema = schemas.entrySet().iterator().next().getKey(); - @Nullable Object propertyInstance = propertySchema.getNewInstance(value, propertyPathToItem, pathToSchemas); - properties.put(propertyName, propertyInstance); - } - FrozenMap<@Nullable Object> castProperties = new FrozenMap<>(properties); - return new AdditionalPropertiesClassMap(castProperties); - } - - 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); - SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().build())); - ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, new PathToSchemasMap(), new LinkedHashSet<>()); - PathToSchemasMap pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet); - return getNewInstance(castArg, validationMetadata.pathToItem(), pathToSchemasMap); - } - - - @Override - public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws 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"); - } - @Override - public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { - if (arg instanceof Map) { - return getNewInstance((Map) arg, pathToItem, pathToSchemas); - } - 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 { - return new AdditionalPropertiesClass1BoxedMap(validate(arg, configuration)); - } - @Override - public AdditionalPropertiesClass1Boxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { - 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"); - } - } - -} diff --git a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/schemas/AdditionalPropertiesSchema.kt b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/schemas/AdditionalPropertiesSchema.kt deleted file mode 100644 index 842951a945d..00000000000 --- a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/schemas/AdditionalPropertiesSchema.kt +++ /dev/null @@ -1,1309 +0,0 @@ -package org.openapijsonschematools.client.components.schemas; -import java.time.LocalDate; -import java.time.ZonedDateTime; -import java.util.ArrayList; -import java.util.HashSet; -import java.util.LinkedHashMap; -import java.util.LinkedHashSet; -import java.util.List; -import java.util.Map; -import java.util.Objects; -import java.util.Set; -import java.util.UUID; -import org.checkerframework.checker.nullness.qual.Nullable; -import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags; -import org.openapijsonschematools.client.configurations.SchemaConfiguration; -import org.openapijsonschematools.client.exceptions.InvalidAdditionalPropertyException; -import org.openapijsonschematools.client.exceptions.UnsetPropertyException; -import org.openapijsonschematools.client.exceptions.ValidationException; -import org.openapijsonschematools.client.schemas.AnyTypeJsonSchema; -import org.openapijsonschematools.client.schemas.GenericBuilder; -import org.openapijsonschematools.client.schemas.UnsetAddPropsSetter; -import org.openapijsonschematools.client.schemas.validation.BooleanSchemaValidator; -import org.openapijsonschematools.client.schemas.validation.FrozenList; -import org.openapijsonschematools.client.schemas.validation.FrozenMap; -import org.openapijsonschematools.client.schemas.validation.JsonSchema; -import org.openapijsonschematools.client.schemas.validation.JsonSchemaInfo; -import org.openapijsonschematools.client.schemas.validation.ListSchemaValidator; -import org.openapijsonschematools.client.schemas.validation.MapSchemaValidator; -import org.openapijsonschematools.client.schemas.validation.MapUtils; -import org.openapijsonschematools.client.schemas.validation.NullSchemaValidator; -import org.openapijsonschematools.client.schemas.validation.NumberSchemaValidator; -import org.openapijsonschematools.client.schemas.validation.PathToSchemasMap; -import org.openapijsonschematools.client.schemas.validation.StringSchemaValidator; -import org.openapijsonschematools.client.schemas.validation.ValidationMetadata; - -public class AdditionalPropertiesSchema { - // nest classes so all schemas and input/output classes can be public - - - public static class AdditionalProperties extends AnyTypeJsonSchema.AnyTypeJsonSchema1 { - private static @Nullable AdditionalProperties instance = null; - public static AdditionalProperties getInstance() { - if (instance == null) { - instance = new AdditionalProperties(); - } - return instance; - } - } - - - public static class Schema0Map extends FrozenMap<@Nullable Object> { - protected Schema0Map(FrozenMap<@Nullable Object> m) { - super(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 { - return Schema0.getInstance().validate(arg, configuration); - } - - public @Nullable Object getAdditionalProperty(String name) throws UnsetPropertyException { - return getOrThrow(name); - } - } - - public interface SetterForAdditionalProperties { - Set getKnownKeys(); - Map getInstance(); - T getBuilderAfterAdditionalProperty(Map instance); - - default T additionalProperty(String key, Nothing? value) throws InvalidAdditionalPropertyException { - MapUtils.throwIfKeyKnown(key, getKnownKeys(), true); - var instance = getInstance(); - instance.put(key, null); - return getBuilderAfterAdditionalProperty(instance); - } - - default T additionalProperty(String key, boolean value) throws InvalidAdditionalPropertyException { - MapUtils.throwIfKeyKnown(key, getKnownKeys(), true); - var instance = getInstance(); - instance.put(key, value); - return getBuilderAfterAdditionalProperty(instance); - } - - default T additionalProperty(String key, String value) throws InvalidAdditionalPropertyException { - MapUtils.throwIfKeyKnown(key, getKnownKeys(), true); - var instance = getInstance(); - instance.put(key, value); - return getBuilderAfterAdditionalProperty(instance); - } - - default T additionalProperty(String key, int value) throws InvalidAdditionalPropertyException { - MapUtils.throwIfKeyKnown(key, getKnownKeys(), true); - var instance = getInstance(); - instance.put(key, value); - return getBuilderAfterAdditionalProperty(instance); - } - - default T additionalProperty(String key, float value) throws InvalidAdditionalPropertyException { - MapUtils.throwIfKeyKnown(key, getKnownKeys(), true); - var instance = getInstance(); - instance.put(key, value); - return getBuilderAfterAdditionalProperty(instance); - } - - default T additionalProperty(String key, long value) throws InvalidAdditionalPropertyException { - MapUtils.throwIfKeyKnown(key, getKnownKeys(), true); - var instance = getInstance(); - instance.put(key, value); - return getBuilderAfterAdditionalProperty(instance); - } - - default T additionalProperty(String key, double value) throws InvalidAdditionalPropertyException { - MapUtils.throwIfKeyKnown(key, getKnownKeys(), true); - var instance = getInstance(); - instance.put(key, value); - return getBuilderAfterAdditionalProperty(instance); - } - - default T additionalProperty(String key, List value) throws InvalidAdditionalPropertyException { - MapUtils.throwIfKeyKnown(key, getKnownKeys(), true); - var instance = getInstance(); - instance.put(key, value); - return getBuilderAfterAdditionalProperty(instance); - } - - default T additionalProperty(String key, Map value) throws InvalidAdditionalPropertyException { - MapUtils.throwIfKeyKnown(key, getKnownKeys(), true); - var instance = getInstance(); - instance.put(key, value); - return getBuilderAfterAdditionalProperty(instance); - } - } - - public static class Schema0MapBuilder implements GenericBuilder>, SetterForAdditionalProperties { - private final Map instance; - private static final Set knownKeys = Set.of(); - public Set getKnownKeys() { - return knownKeys; - } - public Schema0MapBuilder() { - this.instance = new LinkedHashMap<>(); - } - public Map build() { - return instance; - } - public Map getInstance() { - return instance; - } - public Schema0MapBuilder getBuilderAfterAdditionalProperty(Map instance) { - return this; - } - } - - - public sealed interface Schema0Boxed permits Schema0BoxedMap { - @Nullable Object getData(); - } - - public record Schema0BoxedMap(Schema0Map data) implements Schema0Boxed { - @Override - public @Nullable Object getData() { - return data; - } - } - - - public static class Schema0 extends JsonSchema implements MapSchemaValidator { - private static @Nullable Schema0 instance = null; - - protected Schema0() { - super(new JsonSchemaInfo() - .type(Set.of(Map.class)) - .additionalProperties(AdditionalProperties.class) - ); - } - - public static Schema0 getInstance() { - if (instance == null) { - instance = new Schema0(); - } - return instance; - } - - 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 RuntimeException("Invalid non-string key value"); - } - String propertyName = (String) entryKey; - List propertyPathToItem = new ArrayList<>(pathToItem); - propertyPathToItem.add(propertyName); - Object value = entry.getValue(); - LinkedHashMap, Nothing?> schemas = pathToSchemas.get(propertyPathToItem); - if (schemas == null) { - throw new RuntimeException("Validation result is invalid, schemas must exist for a pathToItem"); - } - JsonSchema propertySchema = schemas.entrySet().iterator().next().getKey(); - @Nullable Object propertyInstance = propertySchema.getNewInstance(value, propertyPathToItem, pathToSchemas); - properties.put(propertyName, propertyInstance); - } - FrozenMap<@Nullable Object> castProperties = new FrozenMap<>(properties); - return new Schema0Map(castProperties); - } - - 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); - SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().build())); - ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, new PathToSchemasMap(), new LinkedHashSet<>()); - PathToSchemasMap pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet); - return getNewInstance(castArg, validationMetadata.pathToItem(), pathToSchemasMap); - } - - - @Override - public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws 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"); - } - @Override - public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { - if (arg instanceof Map) { - return getNewInstance((Map) arg, pathToItem, pathToSchemas); - } - 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 { - return new Schema0BoxedMap(validate(arg, configuration)); - } - @Override - public Schema0Boxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { - 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"); - } - } - - - public sealed interface AdditionalProperties1Boxed permits AdditionalProperties1BoxedVoid, AdditionalProperties1BoxedBoolean, AdditionalProperties1BoxedNumber, AdditionalProperties1BoxedString, AdditionalProperties1BoxedList, AdditionalProperties1BoxedMap { - @Nullable Object getData(); - } - - public record AdditionalProperties1BoxedVoid(Nothing? data) implements AdditionalProperties1Boxed { - @Override - public @Nullable Object getData() { - return data; - } - } - - public record AdditionalProperties1BoxedBoolean(boolean data) implements AdditionalProperties1Boxed { - @Override - public @Nullable Object getData() { - return data; - } - } - - public record AdditionalProperties1BoxedNumber(Number data) implements AdditionalProperties1Boxed { - @Override - public @Nullable Object getData() { - return data; - } - } - - public record AdditionalProperties1BoxedString(String data) implements AdditionalProperties1Boxed { - @Override - public @Nullable Object getData() { - return data; - } - } - - public record AdditionalProperties1BoxedList(FrozenList<@Nullable Object> data) implements AdditionalProperties1Boxed { - @Override - public @Nullable Object getData() { - return data; - } - } - - public record AdditionalProperties1BoxedMap(FrozenMap<@Nullable Object> data) implements AdditionalProperties1Boxed { - @Override - public @Nullable Object getData() { - return data; - } - } - - - public static class AdditionalProperties1 extends JsonSchema implements NullSchemaValidator, BooleanSchemaValidator, NumberSchemaValidator, StringSchemaValidator, ListSchemaValidator, AdditionalProperties1BoxedList>, MapSchemaValidator, AdditionalProperties1BoxedMap> { - private static @Nullable AdditionalProperties1 instance = null; - - protected AdditionalProperties1() { - super(new JsonSchemaInfo() - .minLength(3) - ); - } - - public static AdditionalProperties1 getInstance() { - if (instance == null) { - instance = new AdditionalProperties1(); - } - return instance; - } - - @Override - public Nothing? validate(Nothing? arg, SchemaConfiguration configuration) throws ValidationException { - Set> pathSet = new HashSet<>(); - List pathToItem = List.of("args[0]"); - Nothing? castArg = castToAllowedTypes(arg, pathToItem, pathSet); - SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().build())); - PathToSchemasMap validatedPathToSchemas = new PathToSchemasMap(); - ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, new LinkedHashSet<>()); - getPathToSchemas(this, castArg, validationMetadata, pathSet); - return castArg; - } - - @Override - public boolean validate(boolean arg, SchemaConfiguration configuration) throws ValidationException { - Set> pathSet = new HashSet<>(); - List pathToItem = List.of("args[0]"); - boolean castArg = castToAllowedTypes(arg, pathToItem, pathSet); - SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().build())); - PathToSchemasMap validatedPathToSchemas = new PathToSchemasMap(); - ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, new LinkedHashSet<>()); - getPathToSchemas(this, castArg, validationMetadata, pathSet); - return castArg; - } - - @Override - public Number validate(Number arg, SchemaConfiguration configuration) throws ValidationException { - Set> pathSet = new HashSet<>(); - List pathToItem = List.of("args[0]"); - Number castArg = castToAllowedTypes(arg, pathToItem, pathSet); - SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().build())); - PathToSchemasMap validatedPathToSchemas = new PathToSchemasMap(); - ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, new LinkedHashSet<>()); - getPathToSchemas(this, castArg, validationMetadata, pathSet); - return castArg; - } - - public int validate(int arg, SchemaConfiguration configuration) throws ValidationException { - return (int) validate((Number) arg, configuration); - } - - public long validate(long arg, SchemaConfiguration configuration) throws ValidationException { - return (long) validate((Number) arg, configuration); - } - - public float validate(float arg, SchemaConfiguration configuration) throws ValidationException { - return (float) validate((Number) arg, configuration); - } - - public double validate(double arg, SchemaConfiguration configuration) throws ValidationException { - return (double) validate((Number) arg, configuration); - } - - @Override - public String validate(String arg, SchemaConfiguration configuration) throws ValidationException { - Set> pathSet = new HashSet<>(); - List pathToItem = List.of("args[0]"); - String castArg = castToAllowedTypes(arg, pathToItem, pathSet); - SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().build())); - PathToSchemasMap validatedPathToSchemas = new PathToSchemasMap(); - ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, new LinkedHashSet<>()); - getPathToSchemas(this, castArg, validationMetadata, pathSet); - return castArg; - } - - public String validate(LocalDate arg, SchemaConfiguration configuration) throws ValidationException { - return validate(arg.toString(), configuration); - } - - public String validate(ZonedDateTime arg, SchemaConfiguration configuration) throws ValidationException { - return validate(arg.toString(), configuration); - } - - public String validate(UUID arg, SchemaConfiguration configuration) throws ValidationException { - return validate(arg.toString(), configuration); - } - - @Override - public FrozenList<@Nullable Object> getNewInstance(List arg, List pathToItem, PathToSchemasMap pathToSchemas) { - List<@Nullable Object> items = new ArrayList<>(); - int i = 0; - for (Object item: arg) { - List itemPathToItem = new ArrayList<>(pathToItem); - itemPathToItem.add(i); - LinkedHashMap, Nothing?> schemas = pathToSchemas.get(itemPathToItem); - if (schemas == null) { - throw new RuntimeException("Validation result is invalid, schemas must exist for a pathToItem"); - } - JsonSchema itemSchema = schemas.entrySet().iterator().next().getKey(); - @Nullable Object itemInstance = itemSchema.getNewInstance(item, itemPathToItem, pathToSchemas); - items.add(itemInstance); - i += 1; - } - FrozenList<@Nullable Object> newInstanceItems = new FrozenList<>(items); - return newInstanceItems; - } - - 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); - SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().build())); - ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, new PathToSchemasMap(), new LinkedHashSet<>()); - PathToSchemasMap pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet); - return getNewInstance(castArg, validationMetadata.pathToItem(), pathToSchemasMap); - } - - @Override - 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 RuntimeException("Invalid non-string key value"); - } - String propertyName = (String) entryKey; - List propertyPathToItem = new ArrayList<>(pathToItem); - propertyPathToItem.add(propertyName); - Object value = entry.getValue(); - LinkedHashMap, Nothing?> schemas = pathToSchemas.get(propertyPathToItem); - if (schemas == null) { - throw new RuntimeException("Validation result is invalid, schemas must exist for a pathToItem"); - } - JsonSchema propertySchema = schemas.entrySet().iterator().next().getKey(); - @Nullable Object propertyInstance = propertySchema.getNewInstance(value, propertyPathToItem, pathToSchemas); - properties.put(propertyName, propertyInstance); - } - FrozenMap<@Nullable Object> castProperties = new FrozenMap<>(properties); - return castProperties; - } - - public FrozenMap<@Nullable Object> validate(Map arg, SchemaConfiguration configuration) throws ValidationException { - Set> pathSet = new HashSet<>(); - List pathToItem = List.of("args[0]"); - Map castArg = castToAllowedTypes(arg, pathToItem, pathSet); - SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().build())); - PathToSchemasMap validatedPathToSchemas = new PathToSchemasMap(); - ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, new LinkedHashSet<>()); - PathToSchemasMap pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet); - return getNewInstance(castArg, validationMetadata.pathToItem(), pathToSchemasMap); - } - - @Override - public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { - if (arg == null) { - return validate((Nothing?) null, configuration); - } else if (arg instanceof Boolean) { - boolean boolArg = (Boolean) arg; - return validate(boolArg, configuration); - } else if (arg instanceof Number) { - return validate((Number) arg, configuration); - } else if (arg instanceof String) { - return validate((String) arg, configuration); - } else if (arg instanceof List) { - return validate((List) arg, 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"); - } - @Override - public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { - if (arg == null) { - return getNewInstance((Nothing?) null, pathToItem, pathToSchemas); - } else if (arg instanceof Boolean) { - boolean boolArg = (Boolean) arg; - return getNewInstance(boolArg, pathToItem, pathToSchemas); - } else if (arg instanceof Number) { - return getNewInstance((Number) arg, pathToItem, pathToSchemas); - } else if (arg instanceof String) { - return getNewInstance((String) arg, pathToItem, pathToSchemas); - } else if (arg instanceof List) { - return getNewInstance((List) arg, 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"); - } - @Override - public AdditionalProperties1BoxedVoid validateAndBox(Nothing? arg, SchemaConfiguration configuration) throws ValidationException { - return new AdditionalProperties1BoxedVoid(validate(arg, configuration)); - } - @Override - 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 { - return new AdditionalProperties1BoxedNumber(validate(arg, configuration)); - } - @Override - 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 { - return new AdditionalProperties1BoxedList(validate(arg, configuration)); - } - @Override - 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 { - if (arg == null) { - Nothing? castArg = (Nothing?) arg; - return validateAndBox(castArg, configuration); - } else if (arg instanceof Boolean booleanArg) { - boolean castArg = booleanArg; - return validateAndBox(castArg, configuration); - } else if (arg instanceof String castArg) { - return validateAndBox(castArg, configuration); - } else if (arg instanceof Number castArg) { - return validateAndBox(castArg, configuration); - } else if (arg instanceof List castArg) { - 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"); - } - } - - public static class Schema1Map extends FrozenMap<@Nullable Object> { - protected Schema1Map(FrozenMap<@Nullable Object> m) { - super(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 { - return Schema1.getInstance().validate(arg, configuration); - } - - public @Nullable Object getAdditionalProperty(String name) throws UnsetPropertyException { - return getOrThrow(name); - } - } - - public interface SetterForAdditionalProperties1 { - Set getKnownKeys(); - Map getInstance(); - T getBuilderAfterAdditionalProperty(Map instance); - - default T additionalProperty(String key, Nothing? value) throws InvalidAdditionalPropertyException { - MapUtils.throwIfKeyKnown(key, getKnownKeys(), true); - var instance = getInstance(); - instance.put(key, null); - return getBuilderAfterAdditionalProperty(instance); - } - - default T additionalProperty(String key, boolean value) throws InvalidAdditionalPropertyException { - MapUtils.throwIfKeyKnown(key, getKnownKeys(), true); - var instance = getInstance(); - instance.put(key, value); - return getBuilderAfterAdditionalProperty(instance); - } - - default T additionalProperty(String key, String value) throws InvalidAdditionalPropertyException { - MapUtils.throwIfKeyKnown(key, getKnownKeys(), true); - var instance = getInstance(); - instance.put(key, value); - return getBuilderAfterAdditionalProperty(instance); - } - - default T additionalProperty(String key, int value) throws InvalidAdditionalPropertyException { - MapUtils.throwIfKeyKnown(key, getKnownKeys(), true); - var instance = getInstance(); - instance.put(key, value); - return getBuilderAfterAdditionalProperty(instance); - } - - default T additionalProperty(String key, float value) throws InvalidAdditionalPropertyException { - MapUtils.throwIfKeyKnown(key, getKnownKeys(), true); - var instance = getInstance(); - instance.put(key, value); - return getBuilderAfterAdditionalProperty(instance); - } - - default T additionalProperty(String key, long value) throws InvalidAdditionalPropertyException { - MapUtils.throwIfKeyKnown(key, getKnownKeys(), true); - var instance = getInstance(); - instance.put(key, value); - return getBuilderAfterAdditionalProperty(instance); - } - - default T additionalProperty(String key, double value) throws InvalidAdditionalPropertyException { - MapUtils.throwIfKeyKnown(key, getKnownKeys(), true); - var instance = getInstance(); - instance.put(key, value); - return getBuilderAfterAdditionalProperty(instance); - } - - default T additionalProperty(String key, List value) throws InvalidAdditionalPropertyException { - MapUtils.throwIfKeyKnown(key, getKnownKeys(), true); - var instance = getInstance(); - instance.put(key, value); - return getBuilderAfterAdditionalProperty(instance); - } - - default T additionalProperty(String key, Map value) throws InvalidAdditionalPropertyException { - MapUtils.throwIfKeyKnown(key, getKnownKeys(), true); - var instance = getInstance(); - instance.put(key, value); - return getBuilderAfterAdditionalProperty(instance); - } - } - - public static class Schema1MapBuilder implements GenericBuilder>, SetterForAdditionalProperties1 { - private final Map instance; - private static final Set knownKeys = Set.of(); - public Set getKnownKeys() { - return knownKeys; - } - public Schema1MapBuilder() { - this.instance = new LinkedHashMap<>(); - } - public Map build() { - return instance; - } - public Map getInstance() { - return instance; - } - public Schema1MapBuilder getBuilderAfterAdditionalProperty(Map instance) { - return this; - } - } - - - public sealed interface Schema1Boxed permits Schema1BoxedMap { - @Nullable Object getData(); - } - - public record Schema1BoxedMap(Schema1Map data) implements Schema1Boxed { - @Override - public @Nullable Object getData() { - return data; - } - } - - - public static class Schema1 extends JsonSchema implements MapSchemaValidator { - private static @Nullable Schema1 instance = null; - - protected Schema1() { - super(new JsonSchemaInfo() - .type(Set.of(Map.class)) - .additionalProperties(AdditionalProperties1.class) - ); - } - - public static Schema1 getInstance() { - if (instance == null) { - instance = new Schema1(); - } - return instance; - } - - 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 RuntimeException("Invalid non-string key value"); - } - String propertyName = (String) entryKey; - List propertyPathToItem = new ArrayList<>(pathToItem); - propertyPathToItem.add(propertyName); - Object value = entry.getValue(); - LinkedHashMap, Nothing?> schemas = pathToSchemas.get(propertyPathToItem); - if (schemas == null) { - throw new RuntimeException("Validation result is invalid, schemas must exist for a pathToItem"); - } - JsonSchema propertySchema = schemas.entrySet().iterator().next().getKey(); - @Nullable Object propertyInstance = propertySchema.getNewInstance(value, propertyPathToItem, pathToSchemas); - properties.put(propertyName, propertyInstance); - } - FrozenMap<@Nullable Object> castProperties = new FrozenMap<>(properties); - return new Schema1Map(castProperties); - } - - 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); - SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().build())); - ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, new PathToSchemasMap(), new LinkedHashSet<>()); - PathToSchemasMap pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet); - return getNewInstance(castArg, validationMetadata.pathToItem(), pathToSchemasMap); - } - - - @Override - public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws 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"); - } - @Override - public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { - if (arg instanceof Map) { - return getNewInstance((Map) arg, pathToItem, pathToSchemas); - } - 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 { - return new Schema1BoxedMap(validate(arg, configuration)); - } - @Override - public Schema1Boxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { - 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"); - } - } - - - public sealed interface AdditionalProperties2Boxed permits AdditionalProperties2BoxedVoid, AdditionalProperties2BoxedBoolean, AdditionalProperties2BoxedNumber, AdditionalProperties2BoxedString, AdditionalProperties2BoxedList, AdditionalProperties2BoxedMap { - @Nullable Object getData(); - } - - public record AdditionalProperties2BoxedVoid(Nothing? data) implements AdditionalProperties2Boxed { - @Override - public @Nullable Object getData() { - return data; - } - } - - public record AdditionalProperties2BoxedBoolean(boolean data) implements AdditionalProperties2Boxed { - @Override - public @Nullable Object getData() { - return data; - } - } - - public record AdditionalProperties2BoxedNumber(Number data) implements AdditionalProperties2Boxed { - @Override - public @Nullable Object getData() { - return data; - } - } - - public record AdditionalProperties2BoxedString(String data) implements AdditionalProperties2Boxed { - @Override - public @Nullable Object getData() { - return data; - } - } - - public record AdditionalProperties2BoxedList(FrozenList<@Nullable Object> data) implements AdditionalProperties2Boxed { - @Override - public @Nullable Object getData() { - return data; - } - } - - public record AdditionalProperties2BoxedMap(FrozenMap<@Nullable Object> data) implements AdditionalProperties2Boxed { - @Override - public @Nullable Object getData() { - return data; - } - } - - - public static class AdditionalProperties2 extends JsonSchema implements NullSchemaValidator, BooleanSchemaValidator, NumberSchemaValidator, StringSchemaValidator, ListSchemaValidator, AdditionalProperties2BoxedList>, MapSchemaValidator, AdditionalProperties2BoxedMap> { - private static @Nullable AdditionalProperties2 instance = null; - - protected AdditionalProperties2() { - super(new JsonSchemaInfo() - .maxLength(5) - ); - } - - public static AdditionalProperties2 getInstance() { - if (instance == null) { - instance = new AdditionalProperties2(); - } - return instance; - } - - @Override - public Nothing? validate(Nothing? arg, SchemaConfiguration configuration) throws ValidationException { - Set> pathSet = new HashSet<>(); - List pathToItem = List.of("args[0]"); - Nothing? castArg = castToAllowedTypes(arg, pathToItem, pathSet); - SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().build())); - PathToSchemasMap validatedPathToSchemas = new PathToSchemasMap(); - ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, new LinkedHashSet<>()); - getPathToSchemas(this, castArg, validationMetadata, pathSet); - return castArg; - } - - @Override - public boolean validate(boolean arg, SchemaConfiguration configuration) throws ValidationException { - Set> pathSet = new HashSet<>(); - List pathToItem = List.of("args[0]"); - boolean castArg = castToAllowedTypes(arg, pathToItem, pathSet); - SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().build())); - PathToSchemasMap validatedPathToSchemas = new PathToSchemasMap(); - ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, new LinkedHashSet<>()); - getPathToSchemas(this, castArg, validationMetadata, pathSet); - return castArg; - } - - @Override - public Number validate(Number arg, SchemaConfiguration configuration) throws ValidationException { - Set> pathSet = new HashSet<>(); - List pathToItem = List.of("args[0]"); - Number castArg = castToAllowedTypes(arg, pathToItem, pathSet); - SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().build())); - PathToSchemasMap validatedPathToSchemas = new PathToSchemasMap(); - ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, new LinkedHashSet<>()); - getPathToSchemas(this, castArg, validationMetadata, pathSet); - return castArg; - } - - public int validate(int arg, SchemaConfiguration configuration) throws ValidationException { - return (int) validate((Number) arg, configuration); - } - - public long validate(long arg, SchemaConfiguration configuration) throws ValidationException { - return (long) validate((Number) arg, configuration); - } - - public float validate(float arg, SchemaConfiguration configuration) throws ValidationException { - return (float) validate((Number) arg, configuration); - } - - public double validate(double arg, SchemaConfiguration configuration) throws ValidationException { - return (double) validate((Number) arg, configuration); - } - - @Override - public String validate(String arg, SchemaConfiguration configuration) throws ValidationException { - Set> pathSet = new HashSet<>(); - List pathToItem = List.of("args[0]"); - String castArg = castToAllowedTypes(arg, pathToItem, pathSet); - SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().build())); - PathToSchemasMap validatedPathToSchemas = new PathToSchemasMap(); - ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, new LinkedHashSet<>()); - getPathToSchemas(this, castArg, validationMetadata, pathSet); - return castArg; - } - - public String validate(LocalDate arg, SchemaConfiguration configuration) throws ValidationException { - return validate(arg.toString(), configuration); - } - - public String validate(ZonedDateTime arg, SchemaConfiguration configuration) throws ValidationException { - return validate(arg.toString(), configuration); - } - - public String validate(UUID arg, SchemaConfiguration configuration) throws ValidationException { - return validate(arg.toString(), configuration); - } - - @Override - public FrozenList<@Nullable Object> getNewInstance(List arg, List pathToItem, PathToSchemasMap pathToSchemas) { - List<@Nullable Object> items = new ArrayList<>(); - int i = 0; - for (Object item: arg) { - List itemPathToItem = new ArrayList<>(pathToItem); - itemPathToItem.add(i); - LinkedHashMap, Nothing?> schemas = pathToSchemas.get(itemPathToItem); - if (schemas == null) { - throw new RuntimeException("Validation result is invalid, schemas must exist for a pathToItem"); - } - JsonSchema itemSchema = schemas.entrySet().iterator().next().getKey(); - @Nullable Object itemInstance = itemSchema.getNewInstance(item, itemPathToItem, pathToSchemas); - items.add(itemInstance); - i += 1; - } - FrozenList<@Nullable Object> newInstanceItems = new FrozenList<>(items); - return newInstanceItems; - } - - 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); - SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().build())); - ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, new PathToSchemasMap(), new LinkedHashSet<>()); - PathToSchemasMap pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet); - return getNewInstance(castArg, validationMetadata.pathToItem(), pathToSchemasMap); - } - - @Override - 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 RuntimeException("Invalid non-string key value"); - } - String propertyName = (String) entryKey; - List propertyPathToItem = new ArrayList<>(pathToItem); - propertyPathToItem.add(propertyName); - Object value = entry.getValue(); - LinkedHashMap, Nothing?> schemas = pathToSchemas.get(propertyPathToItem); - if (schemas == null) { - throw new RuntimeException("Validation result is invalid, schemas must exist for a pathToItem"); - } - JsonSchema propertySchema = schemas.entrySet().iterator().next().getKey(); - @Nullable Object propertyInstance = propertySchema.getNewInstance(value, propertyPathToItem, pathToSchemas); - properties.put(propertyName, propertyInstance); - } - FrozenMap<@Nullable Object> castProperties = new FrozenMap<>(properties); - return castProperties; - } - - public FrozenMap<@Nullable Object> validate(Map arg, SchemaConfiguration configuration) throws ValidationException { - Set> pathSet = new HashSet<>(); - List pathToItem = List.of("args[0]"); - Map castArg = castToAllowedTypes(arg, pathToItem, pathSet); - SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().build())); - PathToSchemasMap validatedPathToSchemas = new PathToSchemasMap(); - ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, new LinkedHashSet<>()); - PathToSchemasMap pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet); - return getNewInstance(castArg, validationMetadata.pathToItem(), pathToSchemasMap); - } - - @Override - public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { - if (arg == null) { - return validate((Nothing?) null, configuration); - } else if (arg instanceof Boolean) { - boolean boolArg = (Boolean) arg; - return validate(boolArg, configuration); - } else if (arg instanceof Number) { - return validate((Number) arg, configuration); - } else if (arg instanceof String) { - return validate((String) arg, configuration); - } else if (arg instanceof List) { - return validate((List) arg, 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"); - } - @Override - public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { - if (arg == null) { - return getNewInstance((Nothing?) null, pathToItem, pathToSchemas); - } else if (arg instanceof Boolean) { - boolean boolArg = (Boolean) arg; - return getNewInstance(boolArg, pathToItem, pathToSchemas); - } else if (arg instanceof Number) { - return getNewInstance((Number) arg, pathToItem, pathToSchemas); - } else if (arg instanceof String) { - return getNewInstance((String) arg, pathToItem, pathToSchemas); - } else if (arg instanceof List) { - return getNewInstance((List) arg, 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"); - } - @Override - public AdditionalProperties2BoxedVoid validateAndBox(Nothing? arg, SchemaConfiguration configuration) throws ValidationException { - return new AdditionalProperties2BoxedVoid(validate(arg, configuration)); - } - @Override - 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 { - return new AdditionalProperties2BoxedNumber(validate(arg, configuration)); - } - @Override - 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 { - return new AdditionalProperties2BoxedList(validate(arg, configuration)); - } - @Override - 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 { - if (arg == null) { - Nothing? castArg = (Nothing?) arg; - return validateAndBox(castArg, configuration); - } else if (arg instanceof Boolean booleanArg) { - boolean castArg = booleanArg; - return validateAndBox(castArg, configuration); - } else if (arg instanceof String castArg) { - return validateAndBox(castArg, configuration); - } else if (arg instanceof Number castArg) { - return validateAndBox(castArg, configuration); - } else if (arg instanceof List castArg) { - 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"); - } - } - - public static class Schema2Map extends FrozenMap<@Nullable Object> { - protected Schema2Map(FrozenMap<@Nullable Object> m) { - super(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 { - return Schema2.getInstance().validate(arg, configuration); - } - - public @Nullable Object getAdditionalProperty(String name) throws UnsetPropertyException { - return getOrThrow(name); - } - } - - public interface SetterForAdditionalProperties2 { - Set getKnownKeys(); - Map getInstance(); - T getBuilderAfterAdditionalProperty(Map instance); - - default T additionalProperty(String key, Nothing? value) throws InvalidAdditionalPropertyException { - MapUtils.throwIfKeyKnown(key, getKnownKeys(), true); - var instance = getInstance(); - instance.put(key, null); - return getBuilderAfterAdditionalProperty(instance); - } - - default T additionalProperty(String key, boolean value) throws InvalidAdditionalPropertyException { - MapUtils.throwIfKeyKnown(key, getKnownKeys(), true); - var instance = getInstance(); - instance.put(key, value); - return getBuilderAfterAdditionalProperty(instance); - } - - default T additionalProperty(String key, String value) throws InvalidAdditionalPropertyException { - MapUtils.throwIfKeyKnown(key, getKnownKeys(), true); - var instance = getInstance(); - instance.put(key, value); - return getBuilderAfterAdditionalProperty(instance); - } - - default T additionalProperty(String key, int value) throws InvalidAdditionalPropertyException { - MapUtils.throwIfKeyKnown(key, getKnownKeys(), true); - var instance = getInstance(); - instance.put(key, value); - return getBuilderAfterAdditionalProperty(instance); - } - - default T additionalProperty(String key, float value) throws InvalidAdditionalPropertyException { - MapUtils.throwIfKeyKnown(key, getKnownKeys(), true); - var instance = getInstance(); - instance.put(key, value); - return getBuilderAfterAdditionalProperty(instance); - } - - default T additionalProperty(String key, long value) throws InvalidAdditionalPropertyException { - MapUtils.throwIfKeyKnown(key, getKnownKeys(), true); - var instance = getInstance(); - instance.put(key, value); - return getBuilderAfterAdditionalProperty(instance); - } - - default T additionalProperty(String key, double value) throws InvalidAdditionalPropertyException { - MapUtils.throwIfKeyKnown(key, getKnownKeys(), true); - var instance = getInstance(); - instance.put(key, value); - return getBuilderAfterAdditionalProperty(instance); - } - - default T additionalProperty(String key, List value) throws InvalidAdditionalPropertyException { - MapUtils.throwIfKeyKnown(key, getKnownKeys(), true); - var instance = getInstance(); - instance.put(key, value); - return getBuilderAfterAdditionalProperty(instance); - } - - default T additionalProperty(String key, Map value) throws InvalidAdditionalPropertyException { - MapUtils.throwIfKeyKnown(key, getKnownKeys(), true); - var instance = getInstance(); - instance.put(key, value); - return getBuilderAfterAdditionalProperty(instance); - } - } - - public static class Schema2MapBuilder implements GenericBuilder>, SetterForAdditionalProperties2 { - private final Map instance; - private static final Set knownKeys = Set.of(); - public Set getKnownKeys() { - return knownKeys; - } - public Schema2MapBuilder() { - this.instance = new LinkedHashMap<>(); - } - public Map build() { - return instance; - } - public Map getInstance() { - return instance; - } - public Schema2MapBuilder getBuilderAfterAdditionalProperty(Map instance) { - return this; - } - } - - - public sealed interface Schema2Boxed permits Schema2BoxedMap { - @Nullable Object getData(); - } - - public record Schema2BoxedMap(Schema2Map data) implements Schema2Boxed { - @Override - public @Nullable Object getData() { - return data; - } - } - - - public static class Schema2 extends JsonSchema implements MapSchemaValidator { - private static @Nullable Schema2 instance = null; - - protected Schema2() { - super(new JsonSchemaInfo() - .type(Set.of(Map.class)) - .additionalProperties(AdditionalProperties2.class) - ); - } - - public static Schema2 getInstance() { - if (instance == null) { - instance = new Schema2(); - } - return instance; - } - - 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 RuntimeException("Invalid non-string key value"); - } - String propertyName = (String) entryKey; - List propertyPathToItem = new ArrayList<>(pathToItem); - propertyPathToItem.add(propertyName); - Object value = entry.getValue(); - LinkedHashMap, Nothing?> schemas = pathToSchemas.get(propertyPathToItem); - if (schemas == null) { - throw new RuntimeException("Validation result is invalid, schemas must exist for a pathToItem"); - } - JsonSchema propertySchema = schemas.entrySet().iterator().next().getKey(); - @Nullable Object propertyInstance = propertySchema.getNewInstance(value, propertyPathToItem, pathToSchemas); - properties.put(propertyName, propertyInstance); - } - FrozenMap<@Nullable Object> castProperties = new FrozenMap<>(properties); - return new Schema2Map(castProperties); - } - - 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); - SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().build())); - ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, new PathToSchemasMap(), new LinkedHashSet<>()); - PathToSchemasMap pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet); - return getNewInstance(castArg, validationMetadata.pathToItem(), pathToSchemasMap); - } - - - @Override - public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws 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"); - } - @Override - public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { - if (arg instanceof Map) { - return getNewInstance((Map) arg, pathToItem, pathToSchemas); - } - 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 { - return new Schema2BoxedMap(validate(arg, configuration)); - } - @Override - public Schema2Boxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { - 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"); - } - } - - - public sealed interface AdditionalPropertiesSchema1Boxed permits AdditionalPropertiesSchema1BoxedMap { - @Nullable Object getData(); - } - - public record AdditionalPropertiesSchema1BoxedMap(FrozenMap<@Nullable Object> data) implements AdditionalPropertiesSchema1Boxed { - @Override - public @Nullable Object getData() { - return data; - } - } - - - public static class AdditionalPropertiesSchema1 extends JsonSchema implements MapSchemaValidator, AdditionalPropertiesSchema1BoxedMap> { - /* - NOTE: This class is auto generated by OpenAPI JSON Schema Generator. - Ref: https://github.com/openapi-json-schema-tools/openapi-json-schema-generator - - Do not edit the class manually. - */ - private static @Nullable AdditionalPropertiesSchema1 instance = null; - - protected AdditionalPropertiesSchema1() { - super(new JsonSchemaInfo() - .type(Set.of(Map.class)) - .allOf(List.of( - Schema0.class, - Schema1.class, - Schema2.class - )) - ); - } - - public static AdditionalPropertiesSchema1 getInstance() { - if (instance == null) { - instance = new AdditionalPropertiesSchema1(); - } - return instance; - } - - 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 RuntimeException("Invalid non-string key value"); - } - String propertyName = (String) entryKey; - List propertyPathToItem = new ArrayList<>(pathToItem); - propertyPathToItem.add(propertyName); - Object value = entry.getValue(); - LinkedHashMap, Nothing?> schemas = pathToSchemas.get(propertyPathToItem); - if (schemas == null) { - throw new RuntimeException("Validation result is invalid, schemas must exist for a pathToItem"); - } - JsonSchema propertySchema = schemas.entrySet().iterator().next().getKey(); - @Nullable Object propertyInstance = propertySchema.getNewInstance(value, propertyPathToItem, pathToSchemas); - properties.put(propertyName, propertyInstance); - } - FrozenMap<@Nullable Object> castProperties = new FrozenMap<>(properties); - return castProperties; - } - - public FrozenMap<@Nullable Object> validate(Map arg, SchemaConfiguration configuration) throws ValidationException { - Set> pathSet = new HashSet<>(); - List pathToItem = List.of("args[0"); - Map castArg = castToAllowedTypes(arg, pathToItem, pathSet); - SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().build())); - ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, new PathToSchemasMap(), new LinkedHashSet<>()); - PathToSchemasMap pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet); - return getNewInstance(castArg, validationMetadata.pathToItem(), pathToSchemasMap); - } - - - @Override - public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws 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"); - } - @Override - public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { - if (arg instanceof Map) { - return getNewInstance((Map) arg, pathToItem, pathToSchemas); - } - 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 { - return new AdditionalPropertiesSchema1BoxedMap(validate(arg, configuration)); - } - @Override - public AdditionalPropertiesSchema1Boxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { - 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"); - } - } - -} diff --git a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/schemas/AdditionalPropertiesWithArrayOfEnums.kt b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/schemas/AdditionalPropertiesWithArrayOfEnums.kt deleted file mode 100644 index 8630730c47b..00000000000 --- a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/schemas/AdditionalPropertiesWithArrayOfEnums.kt +++ /dev/null @@ -1,310 +0,0 @@ -package org.openapijsonschematools.client.components.schemas; -import java.util.ArrayList; -import java.util.HashSet; -import java.util.LinkedHashMap; -import java.util.LinkedHashSet; -import java.util.List; -import java.util.Map; -import java.util.Objects; -import java.util.Set; -import org.checkerframework.checker.nullness.qual.Nullable; -import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags; -import org.openapijsonschematools.client.configurations.SchemaConfiguration; -import org.openapijsonschematools.client.exceptions.InvalidAdditionalPropertyException; -import org.openapijsonschematools.client.exceptions.UnsetPropertyException; -import org.openapijsonschematools.client.exceptions.ValidationException; -import org.openapijsonschematools.client.schemas.GenericBuilder; -import org.openapijsonschematools.client.schemas.validation.FrozenList; -import org.openapijsonschematools.client.schemas.validation.FrozenMap; -import org.openapijsonschematools.client.schemas.validation.JsonSchema; -import org.openapijsonschematools.client.schemas.validation.JsonSchemaInfo; -import org.openapijsonschematools.client.schemas.validation.ListSchemaValidator; -import org.openapijsonschematools.client.schemas.validation.MapSchemaValidator; -import org.openapijsonschematools.client.schemas.validation.MapUtils; -import org.openapijsonschematools.client.schemas.validation.PathToSchemasMap; -import org.openapijsonschematools.client.schemas.validation.ValidationMetadata; - -public class AdditionalPropertiesWithArrayOfEnums { - // nest classes so all schemas and input/output classes can be public - - - public static class AdditionalPropertiesList extends FrozenList { - protected AdditionalPropertiesList(FrozenList m) { - super(m); - } - public static AdditionalPropertiesList of(List arg, SchemaConfiguration configuration) throws ValidationException { - return AdditionalProperties.getInstance().validate(arg, configuration); - } - } - - public static class AdditionalPropertiesListBuilder { - // class to build List - private final List list; - - public AdditionalPropertiesListBuilder() { - list = new ArrayList<>(); - } - - public AdditionalPropertiesListBuilder(List list) { - this.list = list; - } - - public AdditionalPropertiesListBuilder add(String item) { - list.add(item); - return this; - } - - public AdditionalPropertiesListBuilder add(EnumClass.StringEnumClassEnums item) { - list.add(item.value()); - return this; - } - - public List build() { - return list; - } - } - - - public sealed interface AdditionalPropertiesBoxed permits AdditionalPropertiesBoxedList { - @Nullable Object getData(); - } - - public record AdditionalPropertiesBoxedList(AdditionalPropertiesList data) implements AdditionalPropertiesBoxed { - @Override - public @Nullable Object getData() { - return data; - } - } - - - - public static class AdditionalProperties extends JsonSchema implements ListSchemaValidator { - private static @Nullable AdditionalProperties instance = null; - - protected AdditionalProperties() { - super(new JsonSchemaInfo() - .type(Set.of(List.class)) - .items(EnumClass.EnumClass1.class) - ); - } - - public static AdditionalProperties getInstance() { - if (instance == null) { - instance = new AdditionalProperties(); - } - return instance; - } - - @Override - public AdditionalPropertiesList getNewInstance(List arg, List pathToItem, PathToSchemasMap pathToSchemas) { - List items = new ArrayList<>(); - int i = 0; - for (Object item: arg) { - List itemPathToItem = new ArrayList<>(pathToItem); - itemPathToItem.add(i); - LinkedHashMap, Nothing?> schemas = pathToSchemas.get(itemPathToItem); - if (schemas == null) { - throw new RuntimeException("Validation 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"); - } - items.add((String) itemInstance); - i += 1; - } - FrozenList newInstanceItems = new FrozenList<>(items); - return new AdditionalPropertiesList(newInstanceItems); - } - - 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); - SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().build())); - ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, new PathToSchemasMap(), new LinkedHashSet<>()); - PathToSchemasMap pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet); - return getNewInstance(castArg, validationMetadata.pathToItem(), pathToSchemasMap); - } - - @Override - public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws 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"); - } - @Override - public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { - 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"); - } - @Override - 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 { - 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"); - } - } - - public static class AdditionalPropertiesWithArrayOfEnumsMap extends FrozenMap { - protected AdditionalPropertiesWithArrayOfEnumsMap(FrozenMap m) { - super(m); - } - public static final Set requiredKeys = Set.of(); - public static final Set optionalKeys = Set.of(); - public static AdditionalPropertiesWithArrayOfEnumsMap of(Map> arg, SchemaConfiguration configuration) throws ValidationException { - return AdditionalPropertiesWithArrayOfEnums1.getInstance().validate(arg, configuration); - } - - public AdditionalPropertiesList getAdditionalProperty(String name) throws UnsetPropertyException { - var value = getOrThrow(name); - if (!(value instanceof AdditionalPropertiesList)) { - throw new RuntimeException("Invalid value stored for " + name); - } - return (AdditionalPropertiesList) value; - } - } - - public interface SetterForAdditionalProperties { - Set getKnownKeys(); - Map> getInstance(); - T getBuilderAfterAdditionalProperty(Map> instance); - - default T additionalProperty(String key, List value) throws InvalidAdditionalPropertyException { - MapUtils.throwIfKeyKnown(key, getKnownKeys(), true); - var instance = getInstance(); - instance.put(key, value); - return getBuilderAfterAdditionalProperty(instance); - } - } - - public static class AdditionalPropertiesWithArrayOfEnumsMapBuilder implements GenericBuilder>>, SetterForAdditionalProperties { - private final Map> instance; - private static final Set knownKeys = Set.of(); - public Set getKnownKeys() { - return knownKeys; - } - public AdditionalPropertiesWithArrayOfEnumsMapBuilder() { - this.instance = new LinkedHashMap<>(); - } - public Map> build() { - return instance; - } - public Map> getInstance() { - return instance; - } - public AdditionalPropertiesWithArrayOfEnumsMapBuilder getBuilderAfterAdditionalProperty(Map> instance) { - return this; - } - } - - - public sealed interface AdditionalPropertiesWithArrayOfEnums1Boxed permits AdditionalPropertiesWithArrayOfEnums1BoxedMap { - @Nullable Object getData(); - } - - public record AdditionalPropertiesWithArrayOfEnums1BoxedMap(AdditionalPropertiesWithArrayOfEnumsMap data) implements AdditionalPropertiesWithArrayOfEnums1Boxed { - @Override - public @Nullable Object getData() { - return data; - } - } - - - public static class AdditionalPropertiesWithArrayOfEnums1 extends JsonSchema implements MapSchemaValidator { - /* - NOTE: This class is auto generated by OpenAPI JSON Schema Generator. - Ref: https://github.com/openapi-json-schema-tools/openapi-json-schema-generator - - Do not edit the class manually. - */ - private static @Nullable AdditionalPropertiesWithArrayOfEnums1 instance = null; - - protected AdditionalPropertiesWithArrayOfEnums1() { - super(new JsonSchemaInfo() - .type(Set.of(Map.class)) - .additionalProperties(AdditionalProperties.class) - ); - } - - public static AdditionalPropertiesWithArrayOfEnums1 getInstance() { - if (instance == null) { - instance = new AdditionalPropertiesWithArrayOfEnums1(); - } - return instance; - } - - 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 RuntimeException("Invalid non-string key value"); - } - String propertyName = (String) entryKey; - List propertyPathToItem = new ArrayList<>(pathToItem); - propertyPathToItem.add(propertyName); - Object value = entry.getValue(); - LinkedHashMap, Nothing?> schemas = pathToSchemas.get(propertyPathToItem); - if (schemas == null) { - throw new RuntimeException("Validation 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"); - } - properties.put(propertyName, (AdditionalPropertiesList) propertyInstance); - } - FrozenMap castProperties = new FrozenMap<>(properties); - return new AdditionalPropertiesWithArrayOfEnumsMap(castProperties); - } - - 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); - SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().build())); - ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, new PathToSchemasMap(), new LinkedHashSet<>()); - PathToSchemasMap pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet); - return getNewInstance(castArg, validationMetadata.pathToItem(), pathToSchemasMap); - } - - - @Override - public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws 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"); - } - @Override - public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { - if (arg instanceof Map) { - return getNewInstance((Map) arg, pathToItem, pathToSchemas); - } - 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 { - return new AdditionalPropertiesWithArrayOfEnums1BoxedMap(validate(arg, configuration)); - } - @Override - public AdditionalPropertiesWithArrayOfEnums1Boxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { - 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"); - } - } - -} diff --git a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/schemas/Address.kt b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/schemas/Address.kt deleted file mode 100644 index 3c8f31022f0..00000000000 --- a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/schemas/Address.kt +++ /dev/null @@ -1,210 +0,0 @@ -package org.openapijsonschematools.client.components.schemas; -import java.util.ArrayList; -import java.util.HashSet; -import java.util.LinkedHashMap; -import java.util.LinkedHashSet; -import java.util.List; -import java.util.Map; -import java.util.Objects; -import java.util.Set; -import org.checkerframework.checker.nullness.qual.Nullable; -import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags; -import org.openapijsonschematools.client.configurations.SchemaConfiguration; -import org.openapijsonschematools.client.exceptions.InvalidAdditionalPropertyException; -import org.openapijsonschematools.client.exceptions.UnsetPropertyException; -import org.openapijsonschematools.client.exceptions.ValidationException; -import org.openapijsonschematools.client.schemas.GenericBuilder; -import org.openapijsonschematools.client.schemas.IntJsonSchema; -import org.openapijsonschematools.client.schemas.validation.FrozenMap; -import org.openapijsonschematools.client.schemas.validation.JsonSchema; -import org.openapijsonschematools.client.schemas.validation.JsonSchemaInfo; -import org.openapijsonschematools.client.schemas.validation.MapSchemaValidator; -import org.openapijsonschematools.client.schemas.validation.MapUtils; -import org.openapijsonschematools.client.schemas.validation.PathToSchemasMap; -import org.openapijsonschematools.client.schemas.validation.ValidationMetadata; - -public class Address { - // nest classes so all schemas and input/output classes can be public - - - public static class AdditionalProperties extends IntJsonSchema.IntJsonSchema1 { - private static @Nullable AdditionalProperties instance = null; - public static AdditionalProperties getInstance() { - if (instance == null) { - instance = new AdditionalProperties(); - } - return instance; - } - } - - - public static class AddressMap extends FrozenMap { - protected AddressMap(FrozenMap m) { - super(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 { - return Address1.getInstance().validate(arg, configuration); - } - - public Number getAdditionalProperty(String name) throws UnsetPropertyException { - return getOrThrow(name); - } - } - - public interface SetterForAdditionalProperties { - Set getKnownKeys(); - Map getInstance(); - T getBuilderAfterAdditionalProperty(Map instance); - - default T additionalProperty(String key, int value) throws InvalidAdditionalPropertyException { - MapUtils.throwIfKeyKnown(key, getKnownKeys(), true); - var instance = getInstance(); - instance.put(key, value); - return getBuilderAfterAdditionalProperty(instance); - } - - default T additionalProperty(String key, float value) throws InvalidAdditionalPropertyException { - MapUtils.throwIfKeyKnown(key, getKnownKeys(), true); - var instance = getInstance(); - instance.put(key, value); - return getBuilderAfterAdditionalProperty(instance); - } - - default T additionalProperty(String key, long value) throws InvalidAdditionalPropertyException { - MapUtils.throwIfKeyKnown(key, getKnownKeys(), true); - var instance = getInstance(); - instance.put(key, value); - return getBuilderAfterAdditionalProperty(instance); - } - - default T additionalProperty(String key, double value) throws InvalidAdditionalPropertyException { - MapUtils.throwIfKeyKnown(key, getKnownKeys(), true); - var instance = getInstance(); - instance.put(key, value); - return getBuilderAfterAdditionalProperty(instance); - } - } - - public static class AddressMapBuilder implements GenericBuilder>, SetterForAdditionalProperties { - private final Map instance; - private static final Set knownKeys = Set.of(); - public Set getKnownKeys() { - return knownKeys; - } - public AddressMapBuilder() { - this.instance = new LinkedHashMap<>(); - } - public Map build() { - return instance; - } - public Map getInstance() { - return instance; - } - public AddressMapBuilder getBuilderAfterAdditionalProperty(Map instance) { - return this; - } - } - - - public sealed interface Address1Boxed permits Address1BoxedMap { - @Nullable Object getData(); - } - - public record Address1BoxedMap(AddressMap data) implements Address1Boxed { - @Override - public @Nullable Object getData() { - return data; - } - } - - - public static class Address1 extends JsonSchema implements MapSchemaValidator { - /* - NOTE: This class is auto generated by OpenAPI JSON Schema Generator. - Ref: https://github.com/openapi-json-schema-tools/openapi-json-schema-generator - - Do not edit the class manually. - */ - private static @Nullable Address1 instance = null; - - protected Address1() { - super(new JsonSchemaInfo() - .type(Set.of(Map.class)) - .additionalProperties(AdditionalProperties.class) - ); - } - - public static Address1 getInstance() { - if (instance == null) { - instance = new Address1(); - } - return instance; - } - - 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 RuntimeException("Invalid non-string key value"); - } - String propertyName = (String) entryKey; - List propertyPathToItem = new ArrayList<>(pathToItem); - propertyPathToItem.add(propertyName); - Object value = entry.getValue(); - LinkedHashMap, Nothing?> schemas = pathToSchemas.get(propertyPathToItem); - if (schemas == null) { - throw new RuntimeException("Validation 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"); - } - properties.put(propertyName, (Number) propertyInstance); - } - FrozenMap castProperties = new FrozenMap<>(properties); - return new AddressMap(castProperties); - } - - 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); - SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().build())); - ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, new PathToSchemasMap(), new LinkedHashSet<>()); - PathToSchemasMap pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet); - return getNewInstance(castArg, validationMetadata.pathToItem(), pathToSchemasMap); - } - - - @Override - public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws 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"); - } - @Override - public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { - if (arg instanceof Map) { - return getNewInstance((Map) arg, pathToItem, pathToSchemas); - } - 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 { - return new Address1BoxedMap(validate(arg, configuration)); - } - @Override - public Address1Boxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { - 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"); - } - } - -} diff --git a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/schemas/Animal.kt b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/schemas/Animal.kt deleted file mode 100644 index 2d4a97082e9..00000000000 --- a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/schemas/Animal.kt +++ /dev/null @@ -1,323 +0,0 @@ -package org.openapijsonschematools.client.components.schemas; -import java.util.ArrayList; -import java.util.HashSet; -import java.util.LinkedHashMap; -import java.util.LinkedHashSet; -import java.util.List; -import java.util.Map; -import java.util.Objects; -import java.util.Set; -import org.checkerframework.checker.nullness.qual.Nullable; -import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags; -import org.openapijsonschematools.client.configurations.SchemaConfiguration; -import org.openapijsonschematools.client.exceptions.InvalidAdditionalPropertyException; -import org.openapijsonschematools.client.exceptions.UnsetPropertyException; -import org.openapijsonschematools.client.exceptions.ValidationException; -import org.openapijsonschematools.client.schemas.GenericBuilder; -import org.openapijsonschematools.client.schemas.StringJsonSchema; -import org.openapijsonschematools.client.schemas.UnsetAddPropsSetter; -import org.openapijsonschematools.client.schemas.validation.DefaultValueMethod; -import org.openapijsonschematools.client.schemas.validation.FrozenMap; -import org.openapijsonschematools.client.schemas.validation.JsonSchema; -import org.openapijsonschematools.client.schemas.validation.JsonSchemaInfo; -import org.openapijsonschematools.client.schemas.validation.MapSchemaValidator; -import org.openapijsonschematools.client.schemas.validation.PathToSchemasMap; -import org.openapijsonschematools.client.schemas.validation.PropertyEntry; -import org.openapijsonschematools.client.schemas.validation.StringSchemaValidator; -import org.openapijsonschematools.client.schemas.validation.ValidationMetadata; - -public class Animal { - // nest classes so all schemas and input/output classes can be public - - - public static class ClassName extends StringJsonSchema.StringJsonSchema1 { - private static @Nullable ClassName instance = null; - public static ClassName getInstance() { - if (instance == null) { - instance = new ClassName(); - } - return instance; - } - } - - - public sealed interface ColorBoxed permits ColorBoxedString { - @Nullable Object getData(); - } - - public record ColorBoxedString(String data) implements ColorBoxed { - @Override - public @Nullable Object getData() { - return data; - } - } - - - - public static class Color extends JsonSchema implements StringSchemaValidator, DefaultValueMethod { - private static @Nullable Color instance = null; - - protected Color() { - super(new JsonSchemaInfo() - .type(Set.of( - String.class - )) - .defaultValue("red") - ); - } - - public static Color getInstance() { - if (instance == null) { - instance = new Color(); - } - return instance; - } - - @Override - public String validate(String arg, SchemaConfiguration configuration) throws ValidationException { - Set> pathSet = new HashSet<>(); - List pathToItem = List.of("args[0"); - String castArg = castToAllowedTypes(arg, pathToItem, pathSet); - SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().build())); - ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, new PathToSchemasMap(), new LinkedHashSet<>()); - getPathToSchemas(this, castArg, validationMetadata, pathSet); - return castArg; - } - - @Override - public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws 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"); - } - @Override - public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { - 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"); - } - public String defaultValue() throws ValidationException { - if (defaultValue instanceof String) { - return (String) defaultValue; - } - throw new ValidationException("Invalid type stored in defaultValue"); - } - @Override - 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 { - 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"); - } - } - - public static class AnimalMap extends FrozenMap<@Nullable Object> { - protected AnimalMap(FrozenMap<@Nullable Object> m) { - super(m); - } - public static final Set requiredKeys = Set.of( - "className" - ); - public static final Set optionalKeys = Set.of( - "color" - ); - public static AnimalMap of(Map arg, SchemaConfiguration configuration) throws ValidationException { - return Animal1.getInstance().validate(arg, configuration); - } - - public String className() { - @Nullable Object value = get("className"); - if (!(value instanceof String)) { - throw new RuntimeException("Invalid value stored for className"); - } - return (String) value; - } - - public String color() throws UnsetPropertyException { - String key = "color"; - throwIfKeyNotPresent(key); - @Nullable Object value = get(key); - if (!(value instanceof String)) { - throw new RuntimeException("Invalid value stored for color"); - } - return (String) value; - } - - public @Nullable Object getAdditionalProperty(String name) throws UnsetPropertyException, InvalidAdditionalPropertyException { - throwIfKeyKnown(name, requiredKeys, optionalKeys); - throwIfKeyNotPresent(name); - return get(name); - } - } - - public interface SetterForClassName { - Map getInstance(); - T getBuilderAfterClassName(Map instance); - - default T className(String value) { - var instance = getInstance(); - instance.put("className", value); - return getBuilderAfterClassName(instance); - } - } - - public interface SetterForColor { - Map getInstance(); - T getBuilderAfterColor(Map instance); - - default T color(String value) { - var instance = getInstance(); - instance.put("color", value); - return getBuilderAfterColor(instance); - } - } - - public static class AnimalMap0Builder extends UnsetAddPropsSetter implements GenericBuilder>, SetterForColor { - private final Map instance; - private static final Set knownKeys = Set.of( - "className", - "color" - ); - public Set getKnownKeys() { - return knownKeys; - } - public AnimalMap0Builder(Map instance) { - this.instance = instance; - } - public Map build() { - return instance; - } - public Map getInstance() { - return instance; - } - public AnimalMap0Builder getBuilderAfterColor(Map instance) { - return this; - } - public AnimalMap0Builder getBuilderAfterAdditionalProperty(Map instance) { - return this; - } - } - - public static class AnimalMapBuilder implements SetterForClassName { - private final Map instance; - public AnimalMapBuilder() { - this.instance = new LinkedHashMap<>(); - } - public Map getInstance() { - return instance; - } - public AnimalMap0Builder getBuilderAfterClassName(Map instance) { - return new AnimalMap0Builder(instance); - } - } - - - public sealed interface Animal1Boxed permits Animal1BoxedMap { - @Nullable Object getData(); - } - - public record Animal1BoxedMap(AnimalMap data) implements Animal1Boxed { - @Override - public @Nullable Object getData() { - return data; - } - } - - - public static class Animal1 extends JsonSchema implements MapSchemaValidator { - /* - NOTE: This class is auto generated by OpenAPI JSON Schema Generator. - Ref: https://github.com/openapi-json-schema-tools/openapi-json-schema-generator - - Do not edit the class manually. - */ - private static @Nullable Animal1 instance = null; - - protected Animal1() { - super(new JsonSchemaInfo() - .type(Set.of(Map.class)) - .properties(Map.ofEntries( - new PropertyEntry("className", ClassName.class), - new PropertyEntry("color", Color.class) - )) - .required(Set.of( - "className" - )) - ); - } - - public static Animal1 getInstance() { - if (instance == null) { - instance = new Animal1(); - } - return instance; - } - - 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 RuntimeException("Invalid non-string key value"); - } - String propertyName = (String) entryKey; - List propertyPathToItem = new ArrayList<>(pathToItem); - propertyPathToItem.add(propertyName); - Object value = entry.getValue(); - LinkedHashMap, Nothing?> schemas = pathToSchemas.get(propertyPathToItem); - if (schemas == null) { - throw new RuntimeException("Validation result is invalid, schemas must exist for a pathToItem"); - } - JsonSchema propertySchema = schemas.entrySet().iterator().next().getKey(); - @Nullable Object propertyInstance = propertySchema.getNewInstance(value, propertyPathToItem, pathToSchemas); - properties.put(propertyName, propertyInstance); - } - FrozenMap<@Nullable Object> castProperties = new FrozenMap<>(properties); - return new AnimalMap(castProperties); - } - - 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); - SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().build())); - ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, new PathToSchemasMap(), new LinkedHashSet<>()); - PathToSchemasMap pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet); - return getNewInstance(castArg, validationMetadata.pathToItem(), pathToSchemasMap); - } - - - @Override - public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws 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"); - } - @Override - public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { - if (arg instanceof Map) { - return getNewInstance((Map) arg, pathToItem, pathToSchemas); - } - 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 { - return new Animal1BoxedMap(validate(arg, configuration)); - } - @Override - public Animal1Boxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { - 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"); - } - } - -} diff --git a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/schemas/AnimalFarm.kt b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/schemas/AnimalFarm.kt deleted file mode 100644 index c837ba2ce71..00000000000 --- a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/schemas/AnimalFarm.kt +++ /dev/null @@ -1,153 +0,0 @@ -package org.openapijsonschematools.client.components.schemas; -import java.util.ArrayList; -import java.util.HashSet; -import java.util.LinkedHashMap; -import java.util.LinkedHashSet; -import java.util.List; -import java.util.Map; -import java.util.Objects; -import java.util.Set; -import org.checkerframework.checker.nullness.qual.Nullable; -import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags; -import org.openapijsonschematools.client.configurations.SchemaConfiguration; -import org.openapijsonschematools.client.exceptions.ValidationException; -import org.openapijsonschematools.client.schemas.validation.FrozenList; -import org.openapijsonschematools.client.schemas.validation.FrozenMap; -import org.openapijsonschematools.client.schemas.validation.JsonSchema; -import org.openapijsonschematools.client.schemas.validation.JsonSchemaInfo; -import org.openapijsonschematools.client.schemas.validation.ListSchemaValidator; -import org.openapijsonschematools.client.schemas.validation.PathToSchemasMap; -import org.openapijsonschematools.client.schemas.validation.ValidationMetadata; - -public class AnimalFarm { - // nest classes so all schemas and input/output classes can be public - - - public static class AnimalFarmList extends FrozenList { - protected AnimalFarmList(FrozenList m) { - super(m); - } - public static AnimalFarmList of(List> arg, SchemaConfiguration configuration) throws ValidationException { - return AnimalFarm1.getInstance().validate(arg, configuration); - } - } - - public static class AnimalFarmListBuilder { - // class to build List> - private final List> list; - - public AnimalFarmListBuilder() { - list = new ArrayList<>(); - } - - public AnimalFarmListBuilder(List> list) { - this.list = list; - } - - public AnimalFarmListBuilder add(Map item) { - list.add(item); - return this; - } - - public List> build() { - return list; - } - } - - - public sealed interface AnimalFarm1Boxed permits AnimalFarm1BoxedList { - @Nullable Object getData(); - } - - public record AnimalFarm1BoxedList(AnimalFarmList data) implements AnimalFarm1Boxed { - @Override - public @Nullable Object getData() { - return data; - } - } - - - - public static class AnimalFarm1 extends JsonSchema implements ListSchemaValidator { - /* - NOTE: This class is auto generated by OpenAPI JSON Schema Generator. - Ref: https://github.com/openapi-json-schema-tools/openapi-json-schema-generator - - Do not edit the class manually. - */ - private static @Nullable AnimalFarm1 instance = null; - - protected AnimalFarm1() { - super(new JsonSchemaInfo() - .type(Set.of(List.class)) - .items(Animal.Animal1.class) - ); - } - - public static AnimalFarm1 getInstance() { - if (instance == null) { - instance = new AnimalFarm1(); - } - return instance; - } - - @Override - public AnimalFarmList getNewInstance(List arg, List pathToItem, PathToSchemasMap pathToSchemas) { - List items = new ArrayList<>(); - int i = 0; - for (Object item: arg) { - List itemPathToItem = new ArrayList<>(pathToItem); - itemPathToItem.add(i); - LinkedHashMap, Nothing?> schemas = pathToSchemas.get(itemPathToItem); - if (schemas == null) { - throw new RuntimeException("Validation 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"); - } - items.add((Animal.AnimalMap) itemInstance); - i += 1; - } - FrozenList newInstanceItems = new FrozenList<>(items); - return new AnimalFarmList(newInstanceItems); - } - - 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); - SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().build())); - ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, new PathToSchemasMap(), new LinkedHashSet<>()); - PathToSchemasMap pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet); - return getNewInstance(castArg, validationMetadata.pathToItem(), pathToSchemasMap); - } - - @Override - public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws 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"); - } - @Override - public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { - 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"); - } - @Override - 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 { - 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"); - } - } -} diff --git a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/schemas/AnyTypeAndFormat.kt b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/schemas/AnyTypeAndFormat.kt deleted file mode 100644 index 6ecf522580f..00000000000 --- a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/schemas/AnyTypeAndFormat.kt +++ /dev/null @@ -1,3342 +0,0 @@ -package org.openapijsonschematools.client.components.schemas; -import java.time.LocalDate; -import java.time.ZonedDateTime; -import java.util.ArrayList; -import java.util.HashSet; -import java.util.LinkedHashMap; -import java.util.LinkedHashSet; -import java.util.List; -import java.util.Map; -import java.util.Objects; -import java.util.Set; -import java.util.UUID; -import org.checkerframework.checker.nullness.qual.Nullable; -import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags; -import org.openapijsonschematools.client.configurations.SchemaConfiguration; -import org.openapijsonschematools.client.exceptions.InvalidAdditionalPropertyException; -import org.openapijsonschematools.client.exceptions.UnsetPropertyException; -import org.openapijsonschematools.client.exceptions.ValidationException; -import org.openapijsonschematools.client.schemas.GenericBuilder; -import org.openapijsonschematools.client.schemas.UnsetAddPropsSetter; -import org.openapijsonschematools.client.schemas.validation.BooleanSchemaValidator; -import org.openapijsonschematools.client.schemas.validation.FrozenList; -import org.openapijsonschematools.client.schemas.validation.FrozenMap; -import org.openapijsonschematools.client.schemas.validation.JsonSchema; -import org.openapijsonschematools.client.schemas.validation.JsonSchemaInfo; -import org.openapijsonschematools.client.schemas.validation.ListSchemaValidator; -import org.openapijsonschematools.client.schemas.validation.MapSchemaValidator; -import org.openapijsonschematools.client.schemas.validation.NullSchemaValidator; -import org.openapijsonschematools.client.schemas.validation.NumberSchemaValidator; -import org.openapijsonschematools.client.schemas.validation.PathToSchemasMap; -import org.openapijsonschematools.client.schemas.validation.PropertyEntry; -import org.openapijsonschematools.client.schemas.validation.StringSchemaValidator; -import org.openapijsonschematools.client.schemas.validation.ValidationMetadata; - -public class AnyTypeAndFormat { - // nest classes so all schemas and input/output classes can be public - - - public sealed interface UuidSchemaBoxed permits UuidSchemaBoxedVoid, UuidSchemaBoxedBoolean, UuidSchemaBoxedNumber, UuidSchemaBoxedString, UuidSchemaBoxedList, UuidSchemaBoxedMap { - @Nullable Object getData(); - } - - public record UuidSchemaBoxedVoid(Nothing? data) implements UuidSchemaBoxed { - @Override - public @Nullable Object getData() { - return data; - } - } - - public record UuidSchemaBoxedBoolean(boolean data) implements UuidSchemaBoxed { - @Override - public @Nullable Object getData() { - return data; - } - } - - public record UuidSchemaBoxedNumber(Number data) implements UuidSchemaBoxed { - @Override - public @Nullable Object getData() { - return data; - } - } - - public record UuidSchemaBoxedString(String data) implements UuidSchemaBoxed { - @Override - public @Nullable Object getData() { - return data; - } - } - - public record UuidSchemaBoxedList(FrozenList<@Nullable Object> data) implements UuidSchemaBoxed { - @Override - public @Nullable Object getData() { - return data; - } - } - - public record UuidSchemaBoxedMap(FrozenMap<@Nullable Object> data) implements UuidSchemaBoxed { - @Override - public @Nullable Object getData() { - return data; - } - } - - - public static class UuidSchema extends JsonSchema implements NullSchemaValidator, BooleanSchemaValidator, NumberSchemaValidator, StringSchemaValidator, ListSchemaValidator, UuidSchemaBoxedList>, MapSchemaValidator, UuidSchemaBoxedMap> { - private static @Nullable UuidSchema instance = null; - - protected UuidSchema() { - super(new JsonSchemaInfo() - .format("uuid") - ); - } - - public static UuidSchema getInstance() { - if (instance == null) { - instance = new UuidSchema(); - } - return instance; - } - - @Override - public Nothing? validate(Nothing? arg, SchemaConfiguration configuration) throws ValidationException { - Set> pathSet = new HashSet<>(); - List pathToItem = List.of("args[0]"); - Nothing? castArg = castToAllowedTypes(arg, pathToItem, pathSet); - SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().build())); - PathToSchemasMap validatedPathToSchemas = new PathToSchemasMap(); - ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, new LinkedHashSet<>()); - getPathToSchemas(this, castArg, validationMetadata, pathSet); - return castArg; - } - - @Override - public boolean validate(boolean arg, SchemaConfiguration configuration) throws ValidationException { - Set> pathSet = new HashSet<>(); - List pathToItem = List.of("args[0]"); - boolean castArg = castToAllowedTypes(arg, pathToItem, pathSet); - SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().build())); - PathToSchemasMap validatedPathToSchemas = new PathToSchemasMap(); - ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, new LinkedHashSet<>()); - getPathToSchemas(this, castArg, validationMetadata, pathSet); - return castArg; - } - - @Override - public Number validate(Number arg, SchemaConfiguration configuration) throws ValidationException { - Set> pathSet = new HashSet<>(); - List pathToItem = List.of("args[0]"); - Number castArg = castToAllowedTypes(arg, pathToItem, pathSet); - SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().build())); - PathToSchemasMap validatedPathToSchemas = new PathToSchemasMap(); - ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, new LinkedHashSet<>()); - getPathToSchemas(this, castArg, validationMetadata, pathSet); - return castArg; - } - - public int validate(int arg, SchemaConfiguration configuration) throws ValidationException { - return (int) validate((Number) arg, configuration); - } - - public long validate(long arg, SchemaConfiguration configuration) throws ValidationException { - return (long) validate((Number) arg, configuration); - } - - public float validate(float arg, SchemaConfiguration configuration) throws ValidationException { - return (float) validate((Number) arg, configuration); - } - - public double validate(double arg, SchemaConfiguration configuration) throws ValidationException { - return (double) validate((Number) arg, configuration); - } - - @Override - public String validate(String arg, SchemaConfiguration configuration) throws ValidationException { - Set> pathSet = new HashSet<>(); - List pathToItem = List.of("args[0]"); - String castArg = castToAllowedTypes(arg, pathToItem, pathSet); - SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().build())); - PathToSchemasMap validatedPathToSchemas = new PathToSchemasMap(); - ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, new LinkedHashSet<>()); - getPathToSchemas(this, castArg, validationMetadata, pathSet); - return castArg; - } - - public String validate(LocalDate arg, SchemaConfiguration configuration) throws ValidationException { - return validate(arg.toString(), configuration); - } - - public String validate(ZonedDateTime arg, SchemaConfiguration configuration) throws ValidationException { - return validate(arg.toString(), configuration); - } - - public String validate(UUID arg, SchemaConfiguration configuration) throws ValidationException { - return validate(arg.toString(), configuration); - } - - @Override - public FrozenList<@Nullable Object> getNewInstance(List arg, List pathToItem, PathToSchemasMap pathToSchemas) { - List<@Nullable Object> items = new ArrayList<>(); - int i = 0; - for (Object item: arg) { - List itemPathToItem = new ArrayList<>(pathToItem); - itemPathToItem.add(i); - LinkedHashMap, Nothing?> schemas = pathToSchemas.get(itemPathToItem); - if (schemas == null) { - throw new RuntimeException("Validation result is invalid, schemas must exist for a pathToItem"); - } - JsonSchema itemSchema = schemas.entrySet().iterator().next().getKey(); - @Nullable Object itemInstance = itemSchema.getNewInstance(item, itemPathToItem, pathToSchemas); - items.add(itemInstance); - i += 1; - } - FrozenList<@Nullable Object> newInstanceItems = new FrozenList<>(items); - return newInstanceItems; - } - - 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); - SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().build())); - ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, new PathToSchemasMap(), new LinkedHashSet<>()); - PathToSchemasMap pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet); - return getNewInstance(castArg, validationMetadata.pathToItem(), pathToSchemasMap); - } - - @Override - 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 RuntimeException("Invalid non-string key value"); - } - String propertyName = (String) entryKey; - List propertyPathToItem = new ArrayList<>(pathToItem); - propertyPathToItem.add(propertyName); - Object value = entry.getValue(); - LinkedHashMap, Nothing?> schemas = pathToSchemas.get(propertyPathToItem); - if (schemas == null) { - throw new RuntimeException("Validation result is invalid, schemas must exist for a pathToItem"); - } - JsonSchema propertySchema = schemas.entrySet().iterator().next().getKey(); - @Nullable Object propertyInstance = propertySchema.getNewInstance(value, propertyPathToItem, pathToSchemas); - properties.put(propertyName, propertyInstance); - } - FrozenMap<@Nullable Object> castProperties = new FrozenMap<>(properties); - return castProperties; - } - - public FrozenMap<@Nullable Object> validate(Map arg, SchemaConfiguration configuration) throws ValidationException { - Set> pathSet = new HashSet<>(); - List pathToItem = List.of("args[0]"); - Map castArg = castToAllowedTypes(arg, pathToItem, pathSet); - SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().build())); - PathToSchemasMap validatedPathToSchemas = new PathToSchemasMap(); - ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, new LinkedHashSet<>()); - PathToSchemasMap pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet); - return getNewInstance(castArg, validationMetadata.pathToItem(), pathToSchemasMap); - } - - @Override - public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { - if (arg == null) { - return validate((Nothing?) null, configuration); - } else if (arg instanceof Boolean) { - boolean boolArg = (Boolean) arg; - return validate(boolArg, configuration); - } else if (arg instanceof Number) { - return validate((Number) arg, configuration); - } else if (arg instanceof String) { - return validate((String) arg, configuration); - } else if (arg instanceof List) { - return validate((List) arg, 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"); - } - @Override - public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { - if (arg == null) { - return getNewInstance((Nothing?) null, pathToItem, pathToSchemas); - } else if (arg instanceof Boolean) { - boolean boolArg = (Boolean) arg; - return getNewInstance(boolArg, pathToItem, pathToSchemas); - } else if (arg instanceof Number) { - return getNewInstance((Number) arg, pathToItem, pathToSchemas); - } else if (arg instanceof String) { - return getNewInstance((String) arg, pathToItem, pathToSchemas); - } else if (arg instanceof List) { - return getNewInstance((List) arg, 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"); - } - @Override - public UuidSchemaBoxedVoid validateAndBox(Nothing? arg, SchemaConfiguration configuration) throws ValidationException { - return new UuidSchemaBoxedVoid(validate(arg, configuration)); - } - @Override - 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 { - return new UuidSchemaBoxedNumber(validate(arg, configuration)); - } - @Override - 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 { - return new UuidSchemaBoxedList(validate(arg, configuration)); - } - @Override - 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 { - if (arg == null) { - Nothing? castArg = (Nothing?) arg; - return validateAndBox(castArg, configuration); - } else if (arg instanceof Boolean booleanArg) { - boolean castArg = booleanArg; - return validateAndBox(castArg, configuration); - } else if (arg instanceof String castArg) { - return validateAndBox(castArg, configuration); - } else if (arg instanceof Number castArg) { - return validateAndBox(castArg, configuration); - } else if (arg instanceof List castArg) { - 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"); - } - } - - public sealed interface DateBoxed permits DateBoxedVoid, DateBoxedBoolean, DateBoxedNumber, DateBoxedString, DateBoxedList, DateBoxedMap { - @Nullable Object getData(); - } - - public record DateBoxedVoid(Nothing? data) implements DateBoxed { - @Override - public @Nullable Object getData() { - return data; - } - } - - public record DateBoxedBoolean(boolean data) implements DateBoxed { - @Override - public @Nullable Object getData() { - return data; - } - } - - public record DateBoxedNumber(Number data) implements DateBoxed { - @Override - public @Nullable Object getData() { - return data; - } - } - - public record DateBoxedString(String data) implements DateBoxed { - @Override - public @Nullable Object getData() { - return data; - } - } - - public record DateBoxedList(FrozenList<@Nullable Object> data) implements DateBoxed { - @Override - public @Nullable Object getData() { - return data; - } - } - - public record DateBoxedMap(FrozenMap<@Nullable Object> data) implements DateBoxed { - @Override - public @Nullable Object getData() { - return data; - } - } - - - public static class Date extends JsonSchema implements NullSchemaValidator, BooleanSchemaValidator, NumberSchemaValidator, StringSchemaValidator, ListSchemaValidator, DateBoxedList>, MapSchemaValidator, DateBoxedMap> { - private static @Nullable Date instance = null; - - protected Date() { - super(new JsonSchemaInfo() - .format("date") - ); - } - - public static Date getInstance() { - if (instance == null) { - instance = new Date(); - } - return instance; - } - - @Override - public Nothing? validate(Nothing? arg, SchemaConfiguration configuration) throws ValidationException { - Set> pathSet = new HashSet<>(); - List pathToItem = List.of("args[0]"); - Nothing? castArg = castToAllowedTypes(arg, pathToItem, pathSet); - SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().build())); - PathToSchemasMap validatedPathToSchemas = new PathToSchemasMap(); - ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, new LinkedHashSet<>()); - getPathToSchemas(this, castArg, validationMetadata, pathSet); - return castArg; - } - - @Override - public boolean validate(boolean arg, SchemaConfiguration configuration) throws ValidationException { - Set> pathSet = new HashSet<>(); - List pathToItem = List.of("args[0]"); - boolean castArg = castToAllowedTypes(arg, pathToItem, pathSet); - SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().build())); - PathToSchemasMap validatedPathToSchemas = new PathToSchemasMap(); - ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, new LinkedHashSet<>()); - getPathToSchemas(this, castArg, validationMetadata, pathSet); - return castArg; - } - - @Override - public Number validate(Number arg, SchemaConfiguration configuration) throws ValidationException { - Set> pathSet = new HashSet<>(); - List pathToItem = List.of("args[0]"); - Number castArg = castToAllowedTypes(arg, pathToItem, pathSet); - SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().build())); - PathToSchemasMap validatedPathToSchemas = new PathToSchemasMap(); - ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, new LinkedHashSet<>()); - getPathToSchemas(this, castArg, validationMetadata, pathSet); - return castArg; - } - - public int validate(int arg, SchemaConfiguration configuration) throws ValidationException { - return (int) validate((Number) arg, configuration); - } - - public long validate(long arg, SchemaConfiguration configuration) throws ValidationException { - return (long) validate((Number) arg, configuration); - } - - public float validate(float arg, SchemaConfiguration configuration) throws ValidationException { - return (float) validate((Number) arg, configuration); - } - - public double validate(double arg, SchemaConfiguration configuration) throws ValidationException { - return (double) validate((Number) arg, configuration); - } - - @Override - public String validate(String arg, SchemaConfiguration configuration) throws ValidationException { - Set> pathSet = new HashSet<>(); - List pathToItem = List.of("args[0]"); - String castArg = castToAllowedTypes(arg, pathToItem, pathSet); - SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().build())); - PathToSchemasMap validatedPathToSchemas = new PathToSchemasMap(); - ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, new LinkedHashSet<>()); - getPathToSchemas(this, castArg, validationMetadata, pathSet); - return castArg; - } - - public String validate(LocalDate arg, SchemaConfiguration configuration) throws ValidationException { - return validate(arg.toString(), configuration); - } - - public String validate(ZonedDateTime arg, SchemaConfiguration configuration) throws ValidationException { - return validate(arg.toString(), configuration); - } - - public String validate(UUID arg, SchemaConfiguration configuration) throws ValidationException { - return validate(arg.toString(), configuration); - } - - @Override - public FrozenList<@Nullable Object> getNewInstance(List arg, List pathToItem, PathToSchemasMap pathToSchemas) { - List<@Nullable Object> items = new ArrayList<>(); - int i = 0; - for (Object item: arg) { - List itemPathToItem = new ArrayList<>(pathToItem); - itemPathToItem.add(i); - LinkedHashMap, Nothing?> schemas = pathToSchemas.get(itemPathToItem); - if (schemas == null) { - throw new RuntimeException("Validation result is invalid, schemas must exist for a pathToItem"); - } - JsonSchema itemSchema = schemas.entrySet().iterator().next().getKey(); - @Nullable Object itemInstance = itemSchema.getNewInstance(item, itemPathToItem, pathToSchemas); - items.add(itemInstance); - i += 1; - } - FrozenList<@Nullable Object> newInstanceItems = new FrozenList<>(items); - return newInstanceItems; - } - - 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); - SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().build())); - ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, new PathToSchemasMap(), new LinkedHashSet<>()); - PathToSchemasMap pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet); - return getNewInstance(castArg, validationMetadata.pathToItem(), pathToSchemasMap); - } - - @Override - 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 RuntimeException("Invalid non-string key value"); - } - String propertyName = (String) entryKey; - List propertyPathToItem = new ArrayList<>(pathToItem); - propertyPathToItem.add(propertyName); - Object value = entry.getValue(); - LinkedHashMap, Nothing?> schemas = pathToSchemas.get(propertyPathToItem); - if (schemas == null) { - throw new RuntimeException("Validation result is invalid, schemas must exist for a pathToItem"); - } - JsonSchema propertySchema = schemas.entrySet().iterator().next().getKey(); - @Nullable Object propertyInstance = propertySchema.getNewInstance(value, propertyPathToItem, pathToSchemas); - properties.put(propertyName, propertyInstance); - } - FrozenMap<@Nullable Object> castProperties = new FrozenMap<>(properties); - return castProperties; - } - - public FrozenMap<@Nullable Object> validate(Map arg, SchemaConfiguration configuration) throws ValidationException { - Set> pathSet = new HashSet<>(); - List pathToItem = List.of("args[0]"); - Map castArg = castToAllowedTypes(arg, pathToItem, pathSet); - SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().build())); - PathToSchemasMap validatedPathToSchemas = new PathToSchemasMap(); - ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, new LinkedHashSet<>()); - PathToSchemasMap pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet); - return getNewInstance(castArg, validationMetadata.pathToItem(), pathToSchemasMap); - } - - @Override - public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { - if (arg == null) { - return validate((Nothing?) null, configuration); - } else if (arg instanceof Boolean) { - boolean boolArg = (Boolean) arg; - return validate(boolArg, configuration); - } else if (arg instanceof Number) { - return validate((Number) arg, configuration); - } else if (arg instanceof String) { - return validate((String) arg, configuration); - } else if (arg instanceof List) { - return validate((List) arg, 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"); - } - @Override - public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { - if (arg == null) { - return getNewInstance((Nothing?) null, pathToItem, pathToSchemas); - } else if (arg instanceof Boolean) { - boolean boolArg = (Boolean) arg; - return getNewInstance(boolArg, pathToItem, pathToSchemas); - } else if (arg instanceof Number) { - return getNewInstance((Number) arg, pathToItem, pathToSchemas); - } else if (arg instanceof String) { - return getNewInstance((String) arg, pathToItem, pathToSchemas); - } else if (arg instanceof List) { - return getNewInstance((List) arg, 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"); - } - @Override - public DateBoxedVoid validateAndBox(Nothing? arg, SchemaConfiguration configuration) throws ValidationException { - return new DateBoxedVoid(validate(arg, configuration)); - } - @Override - 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 { - return new DateBoxedNumber(validate(arg, configuration)); - } - @Override - 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 { - return new DateBoxedList(validate(arg, configuration)); - } - @Override - 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 { - if (arg == null) { - Nothing? castArg = (Nothing?) arg; - return validateAndBox(castArg, configuration); - } else if (arg instanceof Boolean booleanArg) { - boolean castArg = booleanArg; - return validateAndBox(castArg, configuration); - } else if (arg instanceof String castArg) { - return validateAndBox(castArg, configuration); - } else if (arg instanceof Number castArg) { - return validateAndBox(castArg, configuration); - } else if (arg instanceof List castArg) { - 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"); - } - } - - public sealed interface DatetimeBoxed permits DatetimeBoxedVoid, DatetimeBoxedBoolean, DatetimeBoxedNumber, DatetimeBoxedString, DatetimeBoxedList, DatetimeBoxedMap { - @Nullable Object getData(); - } - - public record DatetimeBoxedVoid(Nothing? data) implements DatetimeBoxed { - @Override - public @Nullable Object getData() { - return data; - } - } - - public record DatetimeBoxedBoolean(boolean data) implements DatetimeBoxed { - @Override - public @Nullable Object getData() { - return data; - } - } - - public record DatetimeBoxedNumber(Number data) implements DatetimeBoxed { - @Override - public @Nullable Object getData() { - return data; - } - } - - public record DatetimeBoxedString(String data) implements DatetimeBoxed { - @Override - public @Nullable Object getData() { - return data; - } - } - - public record DatetimeBoxedList(FrozenList<@Nullable Object> data) implements DatetimeBoxed { - @Override - public @Nullable Object getData() { - return data; - } - } - - public record DatetimeBoxedMap(FrozenMap<@Nullable Object> data) implements DatetimeBoxed { - @Override - public @Nullable Object getData() { - return data; - } - } - - - public static class Datetime extends JsonSchema implements NullSchemaValidator, BooleanSchemaValidator, NumberSchemaValidator, StringSchemaValidator, ListSchemaValidator, DatetimeBoxedList>, MapSchemaValidator, DatetimeBoxedMap> { - private static @Nullable Datetime instance = null; - - protected Datetime() { - super(new JsonSchemaInfo() - .format("date-time") - ); - } - - public static Datetime getInstance() { - if (instance == null) { - instance = new Datetime(); - } - return instance; - } - - @Override - public Nothing? validate(Nothing? arg, SchemaConfiguration configuration) throws ValidationException { - Set> pathSet = new HashSet<>(); - List pathToItem = List.of("args[0]"); - Nothing? castArg = castToAllowedTypes(arg, pathToItem, pathSet); - SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().build())); - PathToSchemasMap validatedPathToSchemas = new PathToSchemasMap(); - ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, new LinkedHashSet<>()); - getPathToSchemas(this, castArg, validationMetadata, pathSet); - return castArg; - } - - @Override - public boolean validate(boolean arg, SchemaConfiguration configuration) throws ValidationException { - Set> pathSet = new HashSet<>(); - List pathToItem = List.of("args[0]"); - boolean castArg = castToAllowedTypes(arg, pathToItem, pathSet); - SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().build())); - PathToSchemasMap validatedPathToSchemas = new PathToSchemasMap(); - ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, new LinkedHashSet<>()); - getPathToSchemas(this, castArg, validationMetadata, pathSet); - return castArg; - } - - @Override - public Number validate(Number arg, SchemaConfiguration configuration) throws ValidationException { - Set> pathSet = new HashSet<>(); - List pathToItem = List.of("args[0]"); - Number castArg = castToAllowedTypes(arg, pathToItem, pathSet); - SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().build())); - PathToSchemasMap validatedPathToSchemas = new PathToSchemasMap(); - ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, new LinkedHashSet<>()); - getPathToSchemas(this, castArg, validationMetadata, pathSet); - return castArg; - } - - public int validate(int arg, SchemaConfiguration configuration) throws ValidationException { - return (int) validate((Number) arg, configuration); - } - - public long validate(long arg, SchemaConfiguration configuration) throws ValidationException { - return (long) validate((Number) arg, configuration); - } - - public float validate(float arg, SchemaConfiguration configuration) throws ValidationException { - return (float) validate((Number) arg, configuration); - } - - public double validate(double arg, SchemaConfiguration configuration) throws ValidationException { - return (double) validate((Number) arg, configuration); - } - - @Override - public String validate(String arg, SchemaConfiguration configuration) throws ValidationException { - Set> pathSet = new HashSet<>(); - List pathToItem = List.of("args[0]"); - String castArg = castToAllowedTypes(arg, pathToItem, pathSet); - SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().build())); - PathToSchemasMap validatedPathToSchemas = new PathToSchemasMap(); - ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, new LinkedHashSet<>()); - getPathToSchemas(this, castArg, validationMetadata, pathSet); - return castArg; - } - - public String validate(LocalDate arg, SchemaConfiguration configuration) throws ValidationException { - return validate(arg.toString(), configuration); - } - - public String validate(ZonedDateTime arg, SchemaConfiguration configuration) throws ValidationException { - return validate(arg.toString(), configuration); - } - - public String validate(UUID arg, SchemaConfiguration configuration) throws ValidationException { - return validate(arg.toString(), configuration); - } - - @Override - public FrozenList<@Nullable Object> getNewInstance(List arg, List pathToItem, PathToSchemasMap pathToSchemas) { - List<@Nullable Object> items = new ArrayList<>(); - int i = 0; - for (Object item: arg) { - List itemPathToItem = new ArrayList<>(pathToItem); - itemPathToItem.add(i); - LinkedHashMap, Nothing?> schemas = pathToSchemas.get(itemPathToItem); - if (schemas == null) { - throw new RuntimeException("Validation result is invalid, schemas must exist for a pathToItem"); - } - JsonSchema itemSchema = schemas.entrySet().iterator().next().getKey(); - @Nullable Object itemInstance = itemSchema.getNewInstance(item, itemPathToItem, pathToSchemas); - items.add(itemInstance); - i += 1; - } - FrozenList<@Nullable Object> newInstanceItems = new FrozenList<>(items); - return newInstanceItems; - } - - 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); - SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().build())); - ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, new PathToSchemasMap(), new LinkedHashSet<>()); - PathToSchemasMap pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet); - return getNewInstance(castArg, validationMetadata.pathToItem(), pathToSchemasMap); - } - - @Override - 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 RuntimeException("Invalid non-string key value"); - } - String propertyName = (String) entryKey; - List propertyPathToItem = new ArrayList<>(pathToItem); - propertyPathToItem.add(propertyName); - Object value = entry.getValue(); - LinkedHashMap, Nothing?> schemas = pathToSchemas.get(propertyPathToItem); - if (schemas == null) { - throw new RuntimeException("Validation result is invalid, schemas must exist for a pathToItem"); - } - JsonSchema propertySchema = schemas.entrySet().iterator().next().getKey(); - @Nullable Object propertyInstance = propertySchema.getNewInstance(value, propertyPathToItem, pathToSchemas); - properties.put(propertyName, propertyInstance); - } - FrozenMap<@Nullable Object> castProperties = new FrozenMap<>(properties); - return castProperties; - } - - public FrozenMap<@Nullable Object> validate(Map arg, SchemaConfiguration configuration) throws ValidationException { - Set> pathSet = new HashSet<>(); - List pathToItem = List.of("args[0]"); - Map castArg = castToAllowedTypes(arg, pathToItem, pathSet); - SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().build())); - PathToSchemasMap validatedPathToSchemas = new PathToSchemasMap(); - ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, new LinkedHashSet<>()); - PathToSchemasMap pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet); - return getNewInstance(castArg, validationMetadata.pathToItem(), pathToSchemasMap); - } - - @Override - public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { - if (arg == null) { - return validate((Nothing?) null, configuration); - } else if (arg instanceof Boolean) { - boolean boolArg = (Boolean) arg; - return validate(boolArg, configuration); - } else if (arg instanceof Number) { - return validate((Number) arg, configuration); - } else if (arg instanceof String) { - return validate((String) arg, configuration); - } else if (arg instanceof List) { - return validate((List) arg, 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"); - } - @Override - public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { - if (arg == null) { - return getNewInstance((Nothing?) null, pathToItem, pathToSchemas); - } else if (arg instanceof Boolean) { - boolean boolArg = (Boolean) arg; - return getNewInstance(boolArg, pathToItem, pathToSchemas); - } else if (arg instanceof Number) { - return getNewInstance((Number) arg, pathToItem, pathToSchemas); - } else if (arg instanceof String) { - return getNewInstance((String) arg, pathToItem, pathToSchemas); - } else if (arg instanceof List) { - return getNewInstance((List) arg, 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"); - } - @Override - public DatetimeBoxedVoid validateAndBox(Nothing? arg, SchemaConfiguration configuration) throws ValidationException { - return new DatetimeBoxedVoid(validate(arg, configuration)); - } - @Override - 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 { - return new DatetimeBoxedNumber(validate(arg, configuration)); - } - @Override - 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 { - return new DatetimeBoxedList(validate(arg, configuration)); - } - @Override - 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 { - if (arg == null) { - Nothing? castArg = (Nothing?) arg; - return validateAndBox(castArg, configuration); - } else if (arg instanceof Boolean booleanArg) { - boolean castArg = booleanArg; - return validateAndBox(castArg, configuration); - } else if (arg instanceof String castArg) { - return validateAndBox(castArg, configuration); - } else if (arg instanceof Number castArg) { - return validateAndBox(castArg, configuration); - } else if (arg instanceof List castArg) { - 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"); - } - } - - public sealed interface NumberSchemaBoxed permits NumberSchemaBoxedVoid, NumberSchemaBoxedBoolean, NumberSchemaBoxedNumber, NumberSchemaBoxedString, NumberSchemaBoxedList, NumberSchemaBoxedMap { - @Nullable Object getData(); - } - - public record NumberSchemaBoxedVoid(Nothing? data) implements NumberSchemaBoxed { - @Override - public @Nullable Object getData() { - return data; - } - } - - public record NumberSchemaBoxedBoolean(boolean data) implements NumberSchemaBoxed { - @Override - public @Nullable Object getData() { - return data; - } - } - - public record NumberSchemaBoxedNumber(Number data) implements NumberSchemaBoxed { - @Override - public @Nullable Object getData() { - return data; - } - } - - public record NumberSchemaBoxedString(String data) implements NumberSchemaBoxed { - @Override - public @Nullable Object getData() { - return data; - } - } - - public record NumberSchemaBoxedList(FrozenList<@Nullable Object> data) implements NumberSchemaBoxed { - @Override - public @Nullable Object getData() { - return data; - } - } - - public record NumberSchemaBoxedMap(FrozenMap<@Nullable Object> data) implements NumberSchemaBoxed { - @Override - public @Nullable Object getData() { - return data; - } - } - - - public static class NumberSchema extends JsonSchema implements NullSchemaValidator, BooleanSchemaValidator, NumberSchemaValidator, StringSchemaValidator, ListSchemaValidator, NumberSchemaBoxedList>, MapSchemaValidator, NumberSchemaBoxedMap> { - private static @Nullable NumberSchema instance = null; - - protected NumberSchema() { - super(new JsonSchemaInfo() - .format("number") - ); - } - - public static NumberSchema getInstance() { - if (instance == null) { - instance = new NumberSchema(); - } - return instance; - } - - @Override - public Nothing? validate(Nothing? arg, SchemaConfiguration configuration) throws ValidationException { - Set> pathSet = new HashSet<>(); - List pathToItem = List.of("args[0]"); - Nothing? castArg = castToAllowedTypes(arg, pathToItem, pathSet); - SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().build())); - PathToSchemasMap validatedPathToSchemas = new PathToSchemasMap(); - ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, new LinkedHashSet<>()); - getPathToSchemas(this, castArg, validationMetadata, pathSet); - return castArg; - } - - @Override - public boolean validate(boolean arg, SchemaConfiguration configuration) throws ValidationException { - Set> pathSet = new HashSet<>(); - List pathToItem = List.of("args[0]"); - boolean castArg = castToAllowedTypes(arg, pathToItem, pathSet); - SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().build())); - PathToSchemasMap validatedPathToSchemas = new PathToSchemasMap(); - ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, new LinkedHashSet<>()); - getPathToSchemas(this, castArg, validationMetadata, pathSet); - return castArg; - } - - @Override - public Number validate(Number arg, SchemaConfiguration configuration) throws ValidationException { - Set> pathSet = new HashSet<>(); - List pathToItem = List.of("args[0]"); - Number castArg = castToAllowedTypes(arg, pathToItem, pathSet); - SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().build())); - PathToSchemasMap validatedPathToSchemas = new PathToSchemasMap(); - ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, new LinkedHashSet<>()); - getPathToSchemas(this, castArg, validationMetadata, pathSet); - return castArg; - } - - public int validate(int arg, SchemaConfiguration configuration) throws ValidationException { - return (int) validate((Number) arg, configuration); - } - - public long validate(long arg, SchemaConfiguration configuration) throws ValidationException { - return (long) validate((Number) arg, configuration); - } - - public float validate(float arg, SchemaConfiguration configuration) throws ValidationException { - return (float) validate((Number) arg, configuration); - } - - public double validate(double arg, SchemaConfiguration configuration) throws ValidationException { - return (double) validate((Number) arg, configuration); - } - - @Override - public String validate(String arg, SchemaConfiguration configuration) throws ValidationException { - Set> pathSet = new HashSet<>(); - List pathToItem = List.of("args[0]"); - String castArg = castToAllowedTypes(arg, pathToItem, pathSet); - SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().build())); - PathToSchemasMap validatedPathToSchemas = new PathToSchemasMap(); - ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, new LinkedHashSet<>()); - getPathToSchemas(this, castArg, validationMetadata, pathSet); - return castArg; - } - - public String validate(LocalDate arg, SchemaConfiguration configuration) throws ValidationException { - return validate(arg.toString(), configuration); - } - - public String validate(ZonedDateTime arg, SchemaConfiguration configuration) throws ValidationException { - return validate(arg.toString(), configuration); - } - - public String validate(UUID arg, SchemaConfiguration configuration) throws ValidationException { - return validate(arg.toString(), configuration); - } - - @Override - public FrozenList<@Nullable Object> getNewInstance(List arg, List pathToItem, PathToSchemasMap pathToSchemas) { - List<@Nullable Object> items = new ArrayList<>(); - int i = 0; - for (Object item: arg) { - List itemPathToItem = new ArrayList<>(pathToItem); - itemPathToItem.add(i); - LinkedHashMap, Nothing?> schemas = pathToSchemas.get(itemPathToItem); - if (schemas == null) { - throw new RuntimeException("Validation result is invalid, schemas must exist for a pathToItem"); - } - JsonSchema itemSchema = schemas.entrySet().iterator().next().getKey(); - @Nullable Object itemInstance = itemSchema.getNewInstance(item, itemPathToItem, pathToSchemas); - items.add(itemInstance); - i += 1; - } - FrozenList<@Nullable Object> newInstanceItems = new FrozenList<>(items); - return newInstanceItems; - } - - 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); - SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().build())); - ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, new PathToSchemasMap(), new LinkedHashSet<>()); - PathToSchemasMap pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet); - return getNewInstance(castArg, validationMetadata.pathToItem(), pathToSchemasMap); - } - - @Override - 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 RuntimeException("Invalid non-string key value"); - } - String propertyName = (String) entryKey; - List propertyPathToItem = new ArrayList<>(pathToItem); - propertyPathToItem.add(propertyName); - Object value = entry.getValue(); - LinkedHashMap, Nothing?> schemas = pathToSchemas.get(propertyPathToItem); - if (schemas == null) { - throw new RuntimeException("Validation result is invalid, schemas must exist for a pathToItem"); - } - JsonSchema propertySchema = schemas.entrySet().iterator().next().getKey(); - @Nullable Object propertyInstance = propertySchema.getNewInstance(value, propertyPathToItem, pathToSchemas); - properties.put(propertyName, propertyInstance); - } - FrozenMap<@Nullable Object> castProperties = new FrozenMap<>(properties); - return castProperties; - } - - public FrozenMap<@Nullable Object> validate(Map arg, SchemaConfiguration configuration) throws ValidationException { - Set> pathSet = new HashSet<>(); - List pathToItem = List.of("args[0]"); - Map castArg = castToAllowedTypes(arg, pathToItem, pathSet); - SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().build())); - PathToSchemasMap validatedPathToSchemas = new PathToSchemasMap(); - ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, new LinkedHashSet<>()); - PathToSchemasMap pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet); - return getNewInstance(castArg, validationMetadata.pathToItem(), pathToSchemasMap); - } - - @Override - public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { - if (arg == null) { - return validate((Nothing?) null, configuration); - } else if (arg instanceof Boolean) { - boolean boolArg = (Boolean) arg; - return validate(boolArg, configuration); - } else if (arg instanceof Number) { - return validate((Number) arg, configuration); - } else if (arg instanceof String) { - return validate((String) arg, configuration); - } else if (arg instanceof List) { - return validate((List) arg, 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"); - } - @Override - public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { - if (arg == null) { - return getNewInstance((Nothing?) null, pathToItem, pathToSchemas); - } else if (arg instanceof Boolean) { - boolean boolArg = (Boolean) arg; - return getNewInstance(boolArg, pathToItem, pathToSchemas); - } else if (arg instanceof Number) { - return getNewInstance((Number) arg, pathToItem, pathToSchemas); - } else if (arg instanceof String) { - return getNewInstance((String) arg, pathToItem, pathToSchemas); - } else if (arg instanceof List) { - return getNewInstance((List) arg, 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"); - } - @Override - public NumberSchemaBoxedVoid validateAndBox(Nothing? arg, SchemaConfiguration configuration) throws ValidationException { - return new NumberSchemaBoxedVoid(validate(arg, configuration)); - } - @Override - 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 { - return new NumberSchemaBoxedNumber(validate(arg, configuration)); - } - @Override - 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 { - return new NumberSchemaBoxedList(validate(arg, configuration)); - } - @Override - 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 { - if (arg == null) { - Nothing? castArg = (Nothing?) arg; - return validateAndBox(castArg, configuration); - } else if (arg instanceof Boolean booleanArg) { - boolean castArg = booleanArg; - return validateAndBox(castArg, configuration); - } else if (arg instanceof String castArg) { - return validateAndBox(castArg, configuration); - } else if (arg instanceof Number castArg) { - return validateAndBox(castArg, configuration); - } else if (arg instanceof List castArg) { - 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"); - } - } - - public sealed interface BinaryBoxed permits BinaryBoxedVoid, BinaryBoxedBoolean, BinaryBoxedNumber, BinaryBoxedString, BinaryBoxedList, BinaryBoxedMap { - @Nullable Object getData(); - } - - public record BinaryBoxedVoid(Nothing? data) implements BinaryBoxed { - @Override - public @Nullable Object getData() { - return data; - } - } - - public record BinaryBoxedBoolean(boolean data) implements BinaryBoxed { - @Override - public @Nullable Object getData() { - return data; - } - } - - public record BinaryBoxedNumber(Number data) implements BinaryBoxed { - @Override - public @Nullable Object getData() { - return data; - } - } - - public record BinaryBoxedString(String data) implements BinaryBoxed { - @Override - public @Nullable Object getData() { - return data; - } - } - - public record BinaryBoxedList(FrozenList<@Nullable Object> data) implements BinaryBoxed { - @Override - public @Nullable Object getData() { - return data; - } - } - - public record BinaryBoxedMap(FrozenMap<@Nullable Object> data) implements BinaryBoxed { - @Override - public @Nullable Object getData() { - return data; - } - } - - - public static class Binary extends JsonSchema implements NullSchemaValidator, BooleanSchemaValidator, NumberSchemaValidator, StringSchemaValidator, ListSchemaValidator, BinaryBoxedList>, MapSchemaValidator, BinaryBoxedMap> { - private static @Nullable Binary instance = null; - - protected Binary() { - super(new JsonSchemaInfo() - .format("binary") - ); - } - - public static Binary getInstance() { - if (instance == null) { - instance = new Binary(); - } - return instance; - } - - @Override - public Nothing? validate(Nothing? arg, SchemaConfiguration configuration) throws ValidationException { - Set> pathSet = new HashSet<>(); - List pathToItem = List.of("args[0]"); - Nothing? castArg = castToAllowedTypes(arg, pathToItem, pathSet); - SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().build())); - PathToSchemasMap validatedPathToSchemas = new PathToSchemasMap(); - ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, new LinkedHashSet<>()); - getPathToSchemas(this, castArg, validationMetadata, pathSet); - return castArg; - } - - @Override - public boolean validate(boolean arg, SchemaConfiguration configuration) throws ValidationException { - Set> pathSet = new HashSet<>(); - List pathToItem = List.of("args[0]"); - boolean castArg = castToAllowedTypes(arg, pathToItem, pathSet); - SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().build())); - PathToSchemasMap validatedPathToSchemas = new PathToSchemasMap(); - ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, new LinkedHashSet<>()); - getPathToSchemas(this, castArg, validationMetadata, pathSet); - return castArg; - } - - @Override - public Number validate(Number arg, SchemaConfiguration configuration) throws ValidationException { - Set> pathSet = new HashSet<>(); - List pathToItem = List.of("args[0]"); - Number castArg = castToAllowedTypes(arg, pathToItem, pathSet); - SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().build())); - PathToSchemasMap validatedPathToSchemas = new PathToSchemasMap(); - ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, new LinkedHashSet<>()); - getPathToSchemas(this, castArg, validationMetadata, pathSet); - return castArg; - } - - public int validate(int arg, SchemaConfiguration configuration) throws ValidationException { - return (int) validate((Number) arg, configuration); - } - - public long validate(long arg, SchemaConfiguration configuration) throws ValidationException { - return (long) validate((Number) arg, configuration); - } - - public float validate(float arg, SchemaConfiguration configuration) throws ValidationException { - return (float) validate((Number) arg, configuration); - } - - public double validate(double arg, SchemaConfiguration configuration) throws ValidationException { - return (double) validate((Number) arg, configuration); - } - - @Override - public String validate(String arg, SchemaConfiguration configuration) throws ValidationException { - Set> pathSet = new HashSet<>(); - List pathToItem = List.of("args[0]"); - String castArg = castToAllowedTypes(arg, pathToItem, pathSet); - SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().build())); - PathToSchemasMap validatedPathToSchemas = new PathToSchemasMap(); - ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, new LinkedHashSet<>()); - getPathToSchemas(this, castArg, validationMetadata, pathSet); - return castArg; - } - - public String validate(LocalDate arg, SchemaConfiguration configuration) throws ValidationException { - return validate(arg.toString(), configuration); - } - - public String validate(ZonedDateTime arg, SchemaConfiguration configuration) throws ValidationException { - return validate(arg.toString(), configuration); - } - - public String validate(UUID arg, SchemaConfiguration configuration) throws ValidationException { - return validate(arg.toString(), configuration); - } - - @Override - public FrozenList<@Nullable Object> getNewInstance(List arg, List pathToItem, PathToSchemasMap pathToSchemas) { - List<@Nullable Object> items = new ArrayList<>(); - int i = 0; - for (Object item: arg) { - List itemPathToItem = new ArrayList<>(pathToItem); - itemPathToItem.add(i); - LinkedHashMap, Nothing?> schemas = pathToSchemas.get(itemPathToItem); - if (schemas == null) { - throw new RuntimeException("Validation result is invalid, schemas must exist for a pathToItem"); - } - JsonSchema itemSchema = schemas.entrySet().iterator().next().getKey(); - @Nullable Object itemInstance = itemSchema.getNewInstance(item, itemPathToItem, pathToSchemas); - items.add(itemInstance); - i += 1; - } - FrozenList<@Nullable Object> newInstanceItems = new FrozenList<>(items); - return newInstanceItems; - } - - 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); - SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().build())); - ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, new PathToSchemasMap(), new LinkedHashSet<>()); - PathToSchemasMap pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet); - return getNewInstance(castArg, validationMetadata.pathToItem(), pathToSchemasMap); - } - - @Override - 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 RuntimeException("Invalid non-string key value"); - } - String propertyName = (String) entryKey; - List propertyPathToItem = new ArrayList<>(pathToItem); - propertyPathToItem.add(propertyName); - Object value = entry.getValue(); - LinkedHashMap, Nothing?> schemas = pathToSchemas.get(propertyPathToItem); - if (schemas == null) { - throw new RuntimeException("Validation result is invalid, schemas must exist for a pathToItem"); - } - JsonSchema propertySchema = schemas.entrySet().iterator().next().getKey(); - @Nullable Object propertyInstance = propertySchema.getNewInstance(value, propertyPathToItem, pathToSchemas); - properties.put(propertyName, propertyInstance); - } - FrozenMap<@Nullable Object> castProperties = new FrozenMap<>(properties); - return castProperties; - } - - public FrozenMap<@Nullable Object> validate(Map arg, SchemaConfiguration configuration) throws ValidationException { - Set> pathSet = new HashSet<>(); - List pathToItem = List.of("args[0]"); - Map castArg = castToAllowedTypes(arg, pathToItem, pathSet); - SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().build())); - PathToSchemasMap validatedPathToSchemas = new PathToSchemasMap(); - ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, new LinkedHashSet<>()); - PathToSchemasMap pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet); - return getNewInstance(castArg, validationMetadata.pathToItem(), pathToSchemasMap); - } - - @Override - public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { - if (arg == null) { - return validate((Nothing?) null, configuration); - } else if (arg instanceof Boolean) { - boolean boolArg = (Boolean) arg; - return validate(boolArg, configuration); - } else if (arg instanceof Number) { - return validate((Number) arg, configuration); - } else if (arg instanceof String) { - return validate((String) arg, configuration); - } else if (arg instanceof List) { - return validate((List) arg, 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"); - } - @Override - public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { - if (arg == null) { - return getNewInstance((Nothing?) null, pathToItem, pathToSchemas); - } else if (arg instanceof Boolean) { - boolean boolArg = (Boolean) arg; - return getNewInstance(boolArg, pathToItem, pathToSchemas); - } else if (arg instanceof Number) { - return getNewInstance((Number) arg, pathToItem, pathToSchemas); - } else if (arg instanceof String) { - return getNewInstance((String) arg, pathToItem, pathToSchemas); - } else if (arg instanceof List) { - return getNewInstance((List) arg, 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"); - } - @Override - public BinaryBoxedVoid validateAndBox(Nothing? arg, SchemaConfiguration configuration) throws ValidationException { - return new BinaryBoxedVoid(validate(arg, configuration)); - } - @Override - 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 { - return new BinaryBoxedNumber(validate(arg, configuration)); - } - @Override - 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 { - return new BinaryBoxedList(validate(arg, configuration)); - } - @Override - 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 { - if (arg == null) { - Nothing? castArg = (Nothing?) arg; - return validateAndBox(castArg, configuration); - } else if (arg instanceof Boolean booleanArg) { - boolean castArg = booleanArg; - return validateAndBox(castArg, configuration); - } else if (arg instanceof String castArg) { - return validateAndBox(castArg, configuration); - } else if (arg instanceof Number castArg) { - return validateAndBox(castArg, configuration); - } else if (arg instanceof List castArg) { - 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"); - } - } - - public sealed interface Int32Boxed permits Int32BoxedVoid, Int32BoxedBoolean, Int32BoxedNumber, Int32BoxedString, Int32BoxedList, Int32BoxedMap { - @Nullable Object getData(); - } - - public record Int32BoxedVoid(Nothing? data) implements Int32Boxed { - @Override - public @Nullable Object getData() { - return data; - } - } - - public record Int32BoxedBoolean(boolean data) implements Int32Boxed { - @Override - public @Nullable Object getData() { - return data; - } - } - - public record Int32BoxedNumber(Number data) implements Int32Boxed { - @Override - public @Nullable Object getData() { - return data; - } - } - - public record Int32BoxedString(String data) implements Int32Boxed { - @Override - public @Nullable Object getData() { - return data; - } - } - - public record Int32BoxedList(FrozenList<@Nullable Object> data) implements Int32Boxed { - @Override - public @Nullable Object getData() { - return data; - } - } - - public record Int32BoxedMap(FrozenMap<@Nullable Object> data) implements Int32Boxed { - @Override - public @Nullable Object getData() { - return data; - } - } - - - public static class Int32 extends JsonSchema implements NullSchemaValidator, BooleanSchemaValidator, NumberSchemaValidator, StringSchemaValidator, ListSchemaValidator, Int32BoxedList>, MapSchemaValidator, Int32BoxedMap> { - private static @Nullable Int32 instance = null; - - protected Int32() { - super(new JsonSchemaInfo() - .format("int32") - ); - } - - public static Int32 getInstance() { - if (instance == null) { - instance = new Int32(); - } - return instance; - } - - @Override - public Nothing? validate(Nothing? arg, SchemaConfiguration configuration) throws ValidationException { - Set> pathSet = new HashSet<>(); - List pathToItem = List.of("args[0]"); - Nothing? castArg = castToAllowedTypes(arg, pathToItem, pathSet); - SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().build())); - PathToSchemasMap validatedPathToSchemas = new PathToSchemasMap(); - ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, new LinkedHashSet<>()); - getPathToSchemas(this, castArg, validationMetadata, pathSet); - return castArg; - } - - @Override - public boolean validate(boolean arg, SchemaConfiguration configuration) throws ValidationException { - Set> pathSet = new HashSet<>(); - List pathToItem = List.of("args[0]"); - boolean castArg = castToAllowedTypes(arg, pathToItem, pathSet); - SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().build())); - PathToSchemasMap validatedPathToSchemas = new PathToSchemasMap(); - ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, new LinkedHashSet<>()); - getPathToSchemas(this, castArg, validationMetadata, pathSet); - return castArg; - } - - @Override - public Number validate(Number arg, SchemaConfiguration configuration) throws ValidationException { - Set> pathSet = new HashSet<>(); - List pathToItem = List.of("args[0]"); - Number castArg = castToAllowedTypes(arg, pathToItem, pathSet); - SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().build())); - PathToSchemasMap validatedPathToSchemas = new PathToSchemasMap(); - ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, new LinkedHashSet<>()); - getPathToSchemas(this, castArg, validationMetadata, pathSet); - return castArg; - } - - public int validate(int arg, SchemaConfiguration configuration) throws ValidationException { - return (int) validate((Number) arg, configuration); - } - - public long validate(long arg, SchemaConfiguration configuration) throws ValidationException { - return (long) validate((Number) arg, configuration); - } - - public float validate(float arg, SchemaConfiguration configuration) throws ValidationException { - return (float) validate((Number) arg, configuration); - } - - public double validate(double arg, SchemaConfiguration configuration) throws ValidationException { - return (double) validate((Number) arg, configuration); - } - - @Override - public String validate(String arg, SchemaConfiguration configuration) throws ValidationException { - Set> pathSet = new HashSet<>(); - List pathToItem = List.of("args[0]"); - String castArg = castToAllowedTypes(arg, pathToItem, pathSet); - SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().build())); - PathToSchemasMap validatedPathToSchemas = new PathToSchemasMap(); - ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, new LinkedHashSet<>()); - getPathToSchemas(this, castArg, validationMetadata, pathSet); - return castArg; - } - - public String validate(LocalDate arg, SchemaConfiguration configuration) throws ValidationException { - return validate(arg.toString(), configuration); - } - - public String validate(ZonedDateTime arg, SchemaConfiguration configuration) throws ValidationException { - return validate(arg.toString(), configuration); - } - - public String validate(UUID arg, SchemaConfiguration configuration) throws ValidationException { - return validate(arg.toString(), configuration); - } - - @Override - public FrozenList<@Nullable Object> getNewInstance(List arg, List pathToItem, PathToSchemasMap pathToSchemas) { - List<@Nullable Object> items = new ArrayList<>(); - int i = 0; - for (Object item: arg) { - List itemPathToItem = new ArrayList<>(pathToItem); - itemPathToItem.add(i); - LinkedHashMap, Nothing?> schemas = pathToSchemas.get(itemPathToItem); - if (schemas == null) { - throw new RuntimeException("Validation result is invalid, schemas must exist for a pathToItem"); - } - JsonSchema itemSchema = schemas.entrySet().iterator().next().getKey(); - @Nullable Object itemInstance = itemSchema.getNewInstance(item, itemPathToItem, pathToSchemas); - items.add(itemInstance); - i += 1; - } - FrozenList<@Nullable Object> newInstanceItems = new FrozenList<>(items); - return newInstanceItems; - } - - 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); - SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().build())); - ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, new PathToSchemasMap(), new LinkedHashSet<>()); - PathToSchemasMap pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet); - return getNewInstance(castArg, validationMetadata.pathToItem(), pathToSchemasMap); - } - - @Override - 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 RuntimeException("Invalid non-string key value"); - } - String propertyName = (String) entryKey; - List propertyPathToItem = new ArrayList<>(pathToItem); - propertyPathToItem.add(propertyName); - Object value = entry.getValue(); - LinkedHashMap, Nothing?> schemas = pathToSchemas.get(propertyPathToItem); - if (schemas == null) { - throw new RuntimeException("Validation result is invalid, schemas must exist for a pathToItem"); - } - JsonSchema propertySchema = schemas.entrySet().iterator().next().getKey(); - @Nullable Object propertyInstance = propertySchema.getNewInstance(value, propertyPathToItem, pathToSchemas); - properties.put(propertyName, propertyInstance); - } - FrozenMap<@Nullable Object> castProperties = new FrozenMap<>(properties); - return castProperties; - } - - public FrozenMap<@Nullable Object> validate(Map arg, SchemaConfiguration configuration) throws ValidationException { - Set> pathSet = new HashSet<>(); - List pathToItem = List.of("args[0]"); - Map castArg = castToAllowedTypes(arg, pathToItem, pathSet); - SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().build())); - PathToSchemasMap validatedPathToSchemas = new PathToSchemasMap(); - ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, new LinkedHashSet<>()); - PathToSchemasMap pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet); - return getNewInstance(castArg, validationMetadata.pathToItem(), pathToSchemasMap); - } - - @Override - public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { - if (arg == null) { - return validate((Nothing?) null, configuration); - } else if (arg instanceof Boolean) { - boolean boolArg = (Boolean) arg; - return validate(boolArg, configuration); - } else if (arg instanceof Number) { - return validate((Number) arg, configuration); - } else if (arg instanceof String) { - return validate((String) arg, configuration); - } else if (arg instanceof List) { - return validate((List) arg, 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"); - } - @Override - public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { - if (arg == null) { - return getNewInstance((Nothing?) null, pathToItem, pathToSchemas); - } else if (arg instanceof Boolean) { - boolean boolArg = (Boolean) arg; - return getNewInstance(boolArg, pathToItem, pathToSchemas); - } else if (arg instanceof Number) { - return getNewInstance((Number) arg, pathToItem, pathToSchemas); - } else if (arg instanceof String) { - return getNewInstance((String) arg, pathToItem, pathToSchemas); - } else if (arg instanceof List) { - return getNewInstance((List) arg, 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"); - } - @Override - public Int32BoxedVoid validateAndBox(Nothing? arg, SchemaConfiguration configuration) throws ValidationException { - return new Int32BoxedVoid(validate(arg, configuration)); - } - @Override - 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 { - return new Int32BoxedNumber(validate(arg, configuration)); - } - @Override - 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 { - return new Int32BoxedList(validate(arg, configuration)); - } - @Override - 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 { - if (arg == null) { - Nothing? castArg = (Nothing?) arg; - return validateAndBox(castArg, configuration); - } else if (arg instanceof Boolean booleanArg) { - boolean castArg = booleanArg; - return validateAndBox(castArg, configuration); - } else if (arg instanceof String castArg) { - return validateAndBox(castArg, configuration); - } else if (arg instanceof Number castArg) { - return validateAndBox(castArg, configuration); - } else if (arg instanceof List castArg) { - 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"); - } - } - - public sealed interface Int64Boxed permits Int64BoxedVoid, Int64BoxedBoolean, Int64BoxedNumber, Int64BoxedString, Int64BoxedList, Int64BoxedMap { - @Nullable Object getData(); - } - - public record Int64BoxedVoid(Nothing? data) implements Int64Boxed { - @Override - public @Nullable Object getData() { - return data; - } - } - - public record Int64BoxedBoolean(boolean data) implements Int64Boxed { - @Override - public @Nullable Object getData() { - return data; - } - } - - public record Int64BoxedNumber(Number data) implements Int64Boxed { - @Override - public @Nullable Object getData() { - return data; - } - } - - public record Int64BoxedString(String data) implements Int64Boxed { - @Override - public @Nullable Object getData() { - return data; - } - } - - public record Int64BoxedList(FrozenList<@Nullable Object> data) implements Int64Boxed { - @Override - public @Nullable Object getData() { - return data; - } - } - - public record Int64BoxedMap(FrozenMap<@Nullable Object> data) implements Int64Boxed { - @Override - public @Nullable Object getData() { - return data; - } - } - - - public static class Int64 extends JsonSchema implements NullSchemaValidator, BooleanSchemaValidator, NumberSchemaValidator, StringSchemaValidator, ListSchemaValidator, Int64BoxedList>, MapSchemaValidator, Int64BoxedMap> { - private static @Nullable Int64 instance = null; - - protected Int64() { - super(new JsonSchemaInfo() - .format("int64") - ); - } - - public static Int64 getInstance() { - if (instance == null) { - instance = new Int64(); - } - return instance; - } - - @Override - public Nothing? validate(Nothing? arg, SchemaConfiguration configuration) throws ValidationException { - Set> pathSet = new HashSet<>(); - List pathToItem = List.of("args[0]"); - Nothing? castArg = castToAllowedTypes(arg, pathToItem, pathSet); - SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().build())); - PathToSchemasMap validatedPathToSchemas = new PathToSchemasMap(); - ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, new LinkedHashSet<>()); - getPathToSchemas(this, castArg, validationMetadata, pathSet); - return castArg; - } - - @Override - public boolean validate(boolean arg, SchemaConfiguration configuration) throws ValidationException { - Set> pathSet = new HashSet<>(); - List pathToItem = List.of("args[0]"); - boolean castArg = castToAllowedTypes(arg, pathToItem, pathSet); - SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().build())); - PathToSchemasMap validatedPathToSchemas = new PathToSchemasMap(); - ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, new LinkedHashSet<>()); - getPathToSchemas(this, castArg, validationMetadata, pathSet); - return castArg; - } - - @Override - public Number validate(Number arg, SchemaConfiguration configuration) throws ValidationException { - Set> pathSet = new HashSet<>(); - List pathToItem = List.of("args[0]"); - Number castArg = castToAllowedTypes(arg, pathToItem, pathSet); - SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().build())); - PathToSchemasMap validatedPathToSchemas = new PathToSchemasMap(); - ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, new LinkedHashSet<>()); - getPathToSchemas(this, castArg, validationMetadata, pathSet); - return castArg; - } - - public int validate(int arg, SchemaConfiguration configuration) throws ValidationException { - return (int) validate((Number) arg, configuration); - } - - public long validate(long arg, SchemaConfiguration configuration) throws ValidationException { - return (long) validate((Number) arg, configuration); - } - - public float validate(float arg, SchemaConfiguration configuration) throws ValidationException { - return (float) validate((Number) arg, configuration); - } - - public double validate(double arg, SchemaConfiguration configuration) throws ValidationException { - return (double) validate((Number) arg, configuration); - } - - @Override - public String validate(String arg, SchemaConfiguration configuration) throws ValidationException { - Set> pathSet = new HashSet<>(); - List pathToItem = List.of("args[0]"); - String castArg = castToAllowedTypes(arg, pathToItem, pathSet); - SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().build())); - PathToSchemasMap validatedPathToSchemas = new PathToSchemasMap(); - ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, new LinkedHashSet<>()); - getPathToSchemas(this, castArg, validationMetadata, pathSet); - return castArg; - } - - public String validate(LocalDate arg, SchemaConfiguration configuration) throws ValidationException { - return validate(arg.toString(), configuration); - } - - public String validate(ZonedDateTime arg, SchemaConfiguration configuration) throws ValidationException { - return validate(arg.toString(), configuration); - } - - public String validate(UUID arg, SchemaConfiguration configuration) throws ValidationException { - return validate(arg.toString(), configuration); - } - - @Override - public FrozenList<@Nullable Object> getNewInstance(List arg, List pathToItem, PathToSchemasMap pathToSchemas) { - List<@Nullable Object> items = new ArrayList<>(); - int i = 0; - for (Object item: arg) { - List itemPathToItem = new ArrayList<>(pathToItem); - itemPathToItem.add(i); - LinkedHashMap, Nothing?> schemas = pathToSchemas.get(itemPathToItem); - if (schemas == null) { - throw new RuntimeException("Validation result is invalid, schemas must exist for a pathToItem"); - } - JsonSchema itemSchema = schemas.entrySet().iterator().next().getKey(); - @Nullable Object itemInstance = itemSchema.getNewInstance(item, itemPathToItem, pathToSchemas); - items.add(itemInstance); - i += 1; - } - FrozenList<@Nullable Object> newInstanceItems = new FrozenList<>(items); - return newInstanceItems; - } - - 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); - SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().build())); - ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, new PathToSchemasMap(), new LinkedHashSet<>()); - PathToSchemasMap pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet); - return getNewInstance(castArg, validationMetadata.pathToItem(), pathToSchemasMap); - } - - @Override - 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 RuntimeException("Invalid non-string key value"); - } - String propertyName = (String) entryKey; - List propertyPathToItem = new ArrayList<>(pathToItem); - propertyPathToItem.add(propertyName); - Object value = entry.getValue(); - LinkedHashMap, Nothing?> schemas = pathToSchemas.get(propertyPathToItem); - if (schemas == null) { - throw new RuntimeException("Validation result is invalid, schemas must exist for a pathToItem"); - } - JsonSchema propertySchema = schemas.entrySet().iterator().next().getKey(); - @Nullable Object propertyInstance = propertySchema.getNewInstance(value, propertyPathToItem, pathToSchemas); - properties.put(propertyName, propertyInstance); - } - FrozenMap<@Nullable Object> castProperties = new FrozenMap<>(properties); - return castProperties; - } - - public FrozenMap<@Nullable Object> validate(Map arg, SchemaConfiguration configuration) throws ValidationException { - Set> pathSet = new HashSet<>(); - List pathToItem = List.of("args[0]"); - Map castArg = castToAllowedTypes(arg, pathToItem, pathSet); - SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().build())); - PathToSchemasMap validatedPathToSchemas = new PathToSchemasMap(); - ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, new LinkedHashSet<>()); - PathToSchemasMap pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet); - return getNewInstance(castArg, validationMetadata.pathToItem(), pathToSchemasMap); - } - - @Override - public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { - if (arg == null) { - return validate((Nothing?) null, configuration); - } else if (arg instanceof Boolean) { - boolean boolArg = (Boolean) arg; - return validate(boolArg, configuration); - } else if (arg instanceof Number) { - return validate((Number) arg, configuration); - } else if (arg instanceof String) { - return validate((String) arg, configuration); - } else if (arg instanceof List) { - return validate((List) arg, 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"); - } - @Override - public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { - if (arg == null) { - return getNewInstance((Nothing?) null, pathToItem, pathToSchemas); - } else if (arg instanceof Boolean) { - boolean boolArg = (Boolean) arg; - return getNewInstance(boolArg, pathToItem, pathToSchemas); - } else if (arg instanceof Number) { - return getNewInstance((Number) arg, pathToItem, pathToSchemas); - } else if (arg instanceof String) { - return getNewInstance((String) arg, pathToItem, pathToSchemas); - } else if (arg instanceof List) { - return getNewInstance((List) arg, 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"); - } - @Override - public Int64BoxedVoid validateAndBox(Nothing? arg, SchemaConfiguration configuration) throws ValidationException { - return new Int64BoxedVoid(validate(arg, configuration)); - } - @Override - 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 { - return new Int64BoxedNumber(validate(arg, configuration)); - } - @Override - 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 { - return new Int64BoxedList(validate(arg, configuration)); - } - @Override - 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 { - if (arg == null) { - Nothing? castArg = (Nothing?) arg; - return validateAndBox(castArg, configuration); - } else if (arg instanceof Boolean booleanArg) { - boolean castArg = booleanArg; - return validateAndBox(castArg, configuration); - } else if (arg instanceof String castArg) { - return validateAndBox(castArg, configuration); - } else if (arg instanceof Number castArg) { - return validateAndBox(castArg, configuration); - } else if (arg instanceof List castArg) { - 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"); - } - } - - public sealed interface DoubleSchemaBoxed permits DoubleSchemaBoxedVoid, DoubleSchemaBoxedBoolean, DoubleSchemaBoxedNumber, DoubleSchemaBoxedString, DoubleSchemaBoxedList, DoubleSchemaBoxedMap { - @Nullable Object getData(); - } - - public record DoubleSchemaBoxedVoid(Nothing? data) implements DoubleSchemaBoxed { - @Override - public @Nullable Object getData() { - return data; - } - } - - public record DoubleSchemaBoxedBoolean(boolean data) implements DoubleSchemaBoxed { - @Override - public @Nullable Object getData() { - return data; - } - } - - public record DoubleSchemaBoxedNumber(Number data) implements DoubleSchemaBoxed { - @Override - public @Nullable Object getData() { - return data; - } - } - - public record DoubleSchemaBoxedString(String data) implements DoubleSchemaBoxed { - @Override - public @Nullable Object getData() { - return data; - } - } - - public record DoubleSchemaBoxedList(FrozenList<@Nullable Object> data) implements DoubleSchemaBoxed { - @Override - public @Nullable Object getData() { - return data; - } - } - - public record DoubleSchemaBoxedMap(FrozenMap<@Nullable Object> data) implements DoubleSchemaBoxed { - @Override - public @Nullable Object getData() { - return data; - } - } - - - public static class DoubleSchema extends JsonSchema implements NullSchemaValidator, BooleanSchemaValidator, NumberSchemaValidator, StringSchemaValidator, ListSchemaValidator, DoubleSchemaBoxedList>, MapSchemaValidator, DoubleSchemaBoxedMap> { - private static @Nullable DoubleSchema instance = null; - - protected DoubleSchema() { - super(new JsonSchemaInfo() - .format("double") - ); - } - - public static DoubleSchema getInstance() { - if (instance == null) { - instance = new DoubleSchema(); - } - return instance; - } - - @Override - public Nothing? validate(Nothing? arg, SchemaConfiguration configuration) throws ValidationException { - Set> pathSet = new HashSet<>(); - List pathToItem = List.of("args[0]"); - Nothing? castArg = castToAllowedTypes(arg, pathToItem, pathSet); - SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().build())); - PathToSchemasMap validatedPathToSchemas = new PathToSchemasMap(); - ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, new LinkedHashSet<>()); - getPathToSchemas(this, castArg, validationMetadata, pathSet); - return castArg; - } - - @Override - public boolean validate(boolean arg, SchemaConfiguration configuration) throws ValidationException { - Set> pathSet = new HashSet<>(); - List pathToItem = List.of("args[0]"); - boolean castArg = castToAllowedTypes(arg, pathToItem, pathSet); - SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().build())); - PathToSchemasMap validatedPathToSchemas = new PathToSchemasMap(); - ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, new LinkedHashSet<>()); - getPathToSchemas(this, castArg, validationMetadata, pathSet); - return castArg; - } - - @Override - public Number validate(Number arg, SchemaConfiguration configuration) throws ValidationException { - Set> pathSet = new HashSet<>(); - List pathToItem = List.of("args[0]"); - Number castArg = castToAllowedTypes(arg, pathToItem, pathSet); - SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().build())); - PathToSchemasMap validatedPathToSchemas = new PathToSchemasMap(); - ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, new LinkedHashSet<>()); - getPathToSchemas(this, castArg, validationMetadata, pathSet); - return castArg; - } - - public int validate(int arg, SchemaConfiguration configuration) throws ValidationException { - return (int) validate((Number) arg, configuration); - } - - public long validate(long arg, SchemaConfiguration configuration) throws ValidationException { - return (long) validate((Number) arg, configuration); - } - - public float validate(float arg, SchemaConfiguration configuration) throws ValidationException { - return (float) validate((Number) arg, configuration); - } - - public double validate(double arg, SchemaConfiguration configuration) throws ValidationException { - return (double) validate((Number) arg, configuration); - } - - @Override - public String validate(String arg, SchemaConfiguration configuration) throws ValidationException { - Set> pathSet = new HashSet<>(); - List pathToItem = List.of("args[0]"); - String castArg = castToAllowedTypes(arg, pathToItem, pathSet); - SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().build())); - PathToSchemasMap validatedPathToSchemas = new PathToSchemasMap(); - ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, new LinkedHashSet<>()); - getPathToSchemas(this, castArg, validationMetadata, pathSet); - return castArg; - } - - public String validate(LocalDate arg, SchemaConfiguration configuration) throws ValidationException { - return validate(arg.toString(), configuration); - } - - public String validate(ZonedDateTime arg, SchemaConfiguration configuration) throws ValidationException { - return validate(arg.toString(), configuration); - } - - public String validate(UUID arg, SchemaConfiguration configuration) throws ValidationException { - return validate(arg.toString(), configuration); - } - - @Override - public FrozenList<@Nullable Object> getNewInstance(List arg, List pathToItem, PathToSchemasMap pathToSchemas) { - List<@Nullable Object> items = new ArrayList<>(); - int i = 0; - for (Object item: arg) { - List itemPathToItem = new ArrayList<>(pathToItem); - itemPathToItem.add(i); - LinkedHashMap, Nothing?> schemas = pathToSchemas.get(itemPathToItem); - if (schemas == null) { - throw new RuntimeException("Validation result is invalid, schemas must exist for a pathToItem"); - } - JsonSchema itemSchema = schemas.entrySet().iterator().next().getKey(); - @Nullable Object itemInstance = itemSchema.getNewInstance(item, itemPathToItem, pathToSchemas); - items.add(itemInstance); - i += 1; - } - FrozenList<@Nullable Object> newInstanceItems = new FrozenList<>(items); - return newInstanceItems; - } - - 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); - SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().build())); - ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, new PathToSchemasMap(), new LinkedHashSet<>()); - PathToSchemasMap pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet); - return getNewInstance(castArg, validationMetadata.pathToItem(), pathToSchemasMap); - } - - @Override - 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 RuntimeException("Invalid non-string key value"); - } - String propertyName = (String) entryKey; - List propertyPathToItem = new ArrayList<>(pathToItem); - propertyPathToItem.add(propertyName); - Object value = entry.getValue(); - LinkedHashMap, Nothing?> schemas = pathToSchemas.get(propertyPathToItem); - if (schemas == null) { - throw new RuntimeException("Validation result is invalid, schemas must exist for a pathToItem"); - } - JsonSchema propertySchema = schemas.entrySet().iterator().next().getKey(); - @Nullable Object propertyInstance = propertySchema.getNewInstance(value, propertyPathToItem, pathToSchemas); - properties.put(propertyName, propertyInstance); - } - FrozenMap<@Nullable Object> castProperties = new FrozenMap<>(properties); - return castProperties; - } - - public FrozenMap<@Nullable Object> validate(Map arg, SchemaConfiguration configuration) throws ValidationException { - Set> pathSet = new HashSet<>(); - List pathToItem = List.of("args[0]"); - Map castArg = castToAllowedTypes(arg, pathToItem, pathSet); - SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().build())); - PathToSchemasMap validatedPathToSchemas = new PathToSchemasMap(); - ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, new LinkedHashSet<>()); - PathToSchemasMap pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet); - return getNewInstance(castArg, validationMetadata.pathToItem(), pathToSchemasMap); - } - - @Override - public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { - if (arg == null) { - return validate((Nothing?) null, configuration); - } else if (arg instanceof Boolean) { - boolean boolArg = (Boolean) arg; - return validate(boolArg, configuration); - } else if (arg instanceof Number) { - return validate((Number) arg, configuration); - } else if (arg instanceof String) { - return validate((String) arg, configuration); - } else if (arg instanceof List) { - return validate((List) arg, 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"); - } - @Override - public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { - if (arg == null) { - return getNewInstance((Nothing?) null, pathToItem, pathToSchemas); - } else if (arg instanceof Boolean) { - boolean boolArg = (Boolean) arg; - return getNewInstance(boolArg, pathToItem, pathToSchemas); - } else if (arg instanceof Number) { - return getNewInstance((Number) arg, pathToItem, pathToSchemas); - } else if (arg instanceof String) { - return getNewInstance((String) arg, pathToItem, pathToSchemas); - } else if (arg instanceof List) { - return getNewInstance((List) arg, 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"); - } - @Override - public DoubleSchemaBoxedVoid validateAndBox(Nothing? arg, SchemaConfiguration configuration) throws ValidationException { - return new DoubleSchemaBoxedVoid(validate(arg, configuration)); - } - @Override - 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 { - return new DoubleSchemaBoxedNumber(validate(arg, configuration)); - } - @Override - 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 { - return new DoubleSchemaBoxedList(validate(arg, configuration)); - } - @Override - 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 { - if (arg == null) { - Nothing? castArg = (Nothing?) arg; - return validateAndBox(castArg, configuration); - } else if (arg instanceof Boolean booleanArg) { - boolean castArg = booleanArg; - return validateAndBox(castArg, configuration); - } else if (arg instanceof String castArg) { - return validateAndBox(castArg, configuration); - } else if (arg instanceof Number castArg) { - return validateAndBox(castArg, configuration); - } else if (arg instanceof List castArg) { - 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"); - } - } - - public sealed interface FloatSchemaBoxed permits FloatSchemaBoxedVoid, FloatSchemaBoxedBoolean, FloatSchemaBoxedNumber, FloatSchemaBoxedString, FloatSchemaBoxedList, FloatSchemaBoxedMap { - @Nullable Object getData(); - } - - public record FloatSchemaBoxedVoid(Nothing? data) implements FloatSchemaBoxed { - @Override - public @Nullable Object getData() { - return data; - } - } - - public record FloatSchemaBoxedBoolean(boolean data) implements FloatSchemaBoxed { - @Override - public @Nullable Object getData() { - return data; - } - } - - public record FloatSchemaBoxedNumber(Number data) implements FloatSchemaBoxed { - @Override - public @Nullable Object getData() { - return data; - } - } - - public record FloatSchemaBoxedString(String data) implements FloatSchemaBoxed { - @Override - public @Nullable Object getData() { - return data; - } - } - - public record FloatSchemaBoxedList(FrozenList<@Nullable Object> data) implements FloatSchemaBoxed { - @Override - public @Nullable Object getData() { - return data; - } - } - - public record FloatSchemaBoxedMap(FrozenMap<@Nullable Object> data) implements FloatSchemaBoxed { - @Override - public @Nullable Object getData() { - return data; - } - } - - - public static class FloatSchema extends JsonSchema implements NullSchemaValidator, BooleanSchemaValidator, NumberSchemaValidator, StringSchemaValidator, ListSchemaValidator, FloatSchemaBoxedList>, MapSchemaValidator, FloatSchemaBoxedMap> { - private static @Nullable FloatSchema instance = null; - - protected FloatSchema() { - super(new JsonSchemaInfo() - .format("float") - ); - } - - public static FloatSchema getInstance() { - if (instance == null) { - instance = new FloatSchema(); - } - return instance; - } - - @Override - public Nothing? validate(Nothing? arg, SchemaConfiguration configuration) throws ValidationException { - Set> pathSet = new HashSet<>(); - List pathToItem = List.of("args[0]"); - Nothing? castArg = castToAllowedTypes(arg, pathToItem, pathSet); - SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().build())); - PathToSchemasMap validatedPathToSchemas = new PathToSchemasMap(); - ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, new LinkedHashSet<>()); - getPathToSchemas(this, castArg, validationMetadata, pathSet); - return castArg; - } - - @Override - public boolean validate(boolean arg, SchemaConfiguration configuration) throws ValidationException { - Set> pathSet = new HashSet<>(); - List pathToItem = List.of("args[0]"); - boolean castArg = castToAllowedTypes(arg, pathToItem, pathSet); - SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().build())); - PathToSchemasMap validatedPathToSchemas = new PathToSchemasMap(); - ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, new LinkedHashSet<>()); - getPathToSchemas(this, castArg, validationMetadata, pathSet); - return castArg; - } - - @Override - public Number validate(Number arg, SchemaConfiguration configuration) throws ValidationException { - Set> pathSet = new HashSet<>(); - List pathToItem = List.of("args[0]"); - Number castArg = castToAllowedTypes(arg, pathToItem, pathSet); - SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().build())); - PathToSchemasMap validatedPathToSchemas = new PathToSchemasMap(); - ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, new LinkedHashSet<>()); - getPathToSchemas(this, castArg, validationMetadata, pathSet); - return castArg; - } - - public int validate(int arg, SchemaConfiguration configuration) throws ValidationException { - return (int) validate((Number) arg, configuration); - } - - public long validate(long arg, SchemaConfiguration configuration) throws ValidationException { - return (long) validate((Number) arg, configuration); - } - - public float validate(float arg, SchemaConfiguration configuration) throws ValidationException { - return (float) validate((Number) arg, configuration); - } - - public double validate(double arg, SchemaConfiguration configuration) throws ValidationException { - return (double) validate((Number) arg, configuration); - } - - @Override - public String validate(String arg, SchemaConfiguration configuration) throws ValidationException { - Set> pathSet = new HashSet<>(); - List pathToItem = List.of("args[0]"); - String castArg = castToAllowedTypes(arg, pathToItem, pathSet); - SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().build())); - PathToSchemasMap validatedPathToSchemas = new PathToSchemasMap(); - ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, new LinkedHashSet<>()); - getPathToSchemas(this, castArg, validationMetadata, pathSet); - return castArg; - } - - public String validate(LocalDate arg, SchemaConfiguration configuration) throws ValidationException { - return validate(arg.toString(), configuration); - } - - public String validate(ZonedDateTime arg, SchemaConfiguration configuration) throws ValidationException { - return validate(arg.toString(), configuration); - } - - public String validate(UUID arg, SchemaConfiguration configuration) throws ValidationException { - return validate(arg.toString(), configuration); - } - - @Override - public FrozenList<@Nullable Object> getNewInstance(List arg, List pathToItem, PathToSchemasMap pathToSchemas) { - List<@Nullable Object> items = new ArrayList<>(); - int i = 0; - for (Object item: arg) { - List itemPathToItem = new ArrayList<>(pathToItem); - itemPathToItem.add(i); - LinkedHashMap, Nothing?> schemas = pathToSchemas.get(itemPathToItem); - if (schemas == null) { - throw new RuntimeException("Validation result is invalid, schemas must exist for a pathToItem"); - } - JsonSchema itemSchema = schemas.entrySet().iterator().next().getKey(); - @Nullable Object itemInstance = itemSchema.getNewInstance(item, itemPathToItem, pathToSchemas); - items.add(itemInstance); - i += 1; - } - FrozenList<@Nullable Object> newInstanceItems = new FrozenList<>(items); - return newInstanceItems; - } - - 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); - SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().build())); - ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, new PathToSchemasMap(), new LinkedHashSet<>()); - PathToSchemasMap pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet); - return getNewInstance(castArg, validationMetadata.pathToItem(), pathToSchemasMap); - } - - @Override - 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 RuntimeException("Invalid non-string key value"); - } - String propertyName = (String) entryKey; - List propertyPathToItem = new ArrayList<>(pathToItem); - propertyPathToItem.add(propertyName); - Object value = entry.getValue(); - LinkedHashMap, Nothing?> schemas = pathToSchemas.get(propertyPathToItem); - if (schemas == null) { - throw new RuntimeException("Validation result is invalid, schemas must exist for a pathToItem"); - } - JsonSchema propertySchema = schemas.entrySet().iterator().next().getKey(); - @Nullable Object propertyInstance = propertySchema.getNewInstance(value, propertyPathToItem, pathToSchemas); - properties.put(propertyName, propertyInstance); - } - FrozenMap<@Nullable Object> castProperties = new FrozenMap<>(properties); - return castProperties; - } - - public FrozenMap<@Nullable Object> validate(Map arg, SchemaConfiguration configuration) throws ValidationException { - Set> pathSet = new HashSet<>(); - List pathToItem = List.of("args[0]"); - Map castArg = castToAllowedTypes(arg, pathToItem, pathSet); - SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().build())); - PathToSchemasMap validatedPathToSchemas = new PathToSchemasMap(); - ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, new LinkedHashSet<>()); - PathToSchemasMap pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet); - return getNewInstance(castArg, validationMetadata.pathToItem(), pathToSchemasMap); - } - - @Override - public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { - if (arg == null) { - return validate((Nothing?) null, configuration); - } else if (arg instanceof Boolean) { - boolean boolArg = (Boolean) arg; - return validate(boolArg, configuration); - } else if (arg instanceof Number) { - return validate((Number) arg, configuration); - } else if (arg instanceof String) { - return validate((String) arg, configuration); - } else if (arg instanceof List) { - return validate((List) arg, 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"); - } - @Override - public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { - if (arg == null) { - return getNewInstance((Nothing?) null, pathToItem, pathToSchemas); - } else if (arg instanceof Boolean) { - boolean boolArg = (Boolean) arg; - return getNewInstance(boolArg, pathToItem, pathToSchemas); - } else if (arg instanceof Number) { - return getNewInstance((Number) arg, pathToItem, pathToSchemas); - } else if (arg instanceof String) { - return getNewInstance((String) arg, pathToItem, pathToSchemas); - } else if (arg instanceof List) { - return getNewInstance((List) arg, 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"); - } - @Override - public FloatSchemaBoxedVoid validateAndBox(Nothing? arg, SchemaConfiguration configuration) throws ValidationException { - return new FloatSchemaBoxedVoid(validate(arg, configuration)); - } - @Override - 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 { - return new FloatSchemaBoxedNumber(validate(arg, configuration)); - } - @Override - 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 { - return new FloatSchemaBoxedList(validate(arg, configuration)); - } - @Override - 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 { - if (arg == null) { - Nothing? castArg = (Nothing?) arg; - return validateAndBox(castArg, configuration); - } else if (arg instanceof Boolean booleanArg) { - boolean castArg = booleanArg; - return validateAndBox(castArg, configuration); - } else if (arg instanceof String castArg) { - return validateAndBox(castArg, configuration); - } else if (arg instanceof Number castArg) { - return validateAndBox(castArg, configuration); - } else if (arg instanceof List castArg) { - 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"); - } - } - - public static class AnyTypeAndFormatMap extends FrozenMap<@Nullable Object> { - protected AnyTypeAndFormatMap(FrozenMap<@Nullable Object> m) { - super(m); - } - public static final Set requiredKeys = Set.of(); - public static final Set optionalKeys = Set.of( - "uuid", - "date", - "date-time", - "number", - "binary", - "int32", - "int64", - "double", - "float" - ); - public static AnyTypeAndFormatMap of(Map arg, SchemaConfiguration configuration) throws ValidationException { - return AnyTypeAndFormat1.getInstance().validate(arg, configuration); - } - - public @Nullable Object date() throws UnsetPropertyException { - return getOrThrow("date"); - } - - public @Nullable Object binary() throws UnsetPropertyException { - return getOrThrow("binary"); - } - - public @Nullable Object int32() throws UnsetPropertyException { - return getOrThrow("int32"); - } - - public @Nullable Object int64() throws UnsetPropertyException { - return getOrThrow("int64"); - } - - public @Nullable Object getAdditionalProperty(String name) throws UnsetPropertyException, InvalidAdditionalPropertyException { - throwIfKeyKnown(name, requiredKeys, optionalKeys); - throwIfKeyNotPresent(name); - return get(name); - } - } - - public interface SetterForUuidSchema { - Map getInstance(); - T getBuilderAfterUuidSchema(Map instance); - - default T setUuid(Nothing? value) { - var instance = getInstance(); - instance.put("uuid", null); - return getBuilderAfterUuidSchema(instance); - } - - default T setUuid(boolean value) { - var instance = getInstance(); - instance.put("uuid", value); - return getBuilderAfterUuidSchema(instance); - } - - default T setUuid(String value) { - var instance = getInstance(); - instance.put("uuid", value); - return getBuilderAfterUuidSchema(instance); - } - - default T setUuid(int value) { - var instance = getInstance(); - instance.put("uuid", value); - return getBuilderAfterUuidSchema(instance); - } - - default T setUuid(float value) { - var instance = getInstance(); - instance.put("uuid", value); - return getBuilderAfterUuidSchema(instance); - } - - default T setUuid(long value) { - var instance = getInstance(); - instance.put("uuid", value); - return getBuilderAfterUuidSchema(instance); - } - - default T setUuid(double value) { - var instance = getInstance(); - instance.put("uuid", value); - return getBuilderAfterUuidSchema(instance); - } - - default T setUuid(List value) { - var instance = getInstance(); - instance.put("uuid", value); - return getBuilderAfterUuidSchema(instance); - } - - default T setUuid(Map value) { - var instance = getInstance(); - instance.put("uuid", value); - return getBuilderAfterUuidSchema(instance); - } - } - - public interface SetterForDate { - Map getInstance(); - T getBuilderAfterDate(Map instance); - - default T date(Nothing? value) { - var instance = getInstance(); - instance.put("date", null); - return getBuilderAfterDate(instance); - } - - default T date(boolean value) { - var instance = getInstance(); - instance.put("date", value); - return getBuilderAfterDate(instance); - } - - default T date(String value) { - var instance = getInstance(); - instance.put("date", value); - return getBuilderAfterDate(instance); - } - - default T date(int value) { - var instance = getInstance(); - instance.put("date", value); - return getBuilderAfterDate(instance); - } - - default T date(float value) { - var instance = getInstance(); - instance.put("date", value); - return getBuilderAfterDate(instance); - } - - default T date(long value) { - var instance = getInstance(); - instance.put("date", value); - return getBuilderAfterDate(instance); - } - - default T date(double value) { - var instance = getInstance(); - instance.put("date", value); - return getBuilderAfterDate(instance); - } - - default T date(List value) { - var instance = getInstance(); - instance.put("date", value); - return getBuilderAfterDate(instance); - } - - default T date(Map value) { - var instance = getInstance(); - instance.put("date", value); - return getBuilderAfterDate(instance); - } - } - - public interface SetterForDatetime { - Map getInstance(); - T getBuilderAfterDatetime(Map instance); - - default T dateHyphenMinusTime(Nothing? value) { - var instance = getInstance(); - instance.put("date-time", null); - return getBuilderAfterDatetime(instance); - } - - default T dateHyphenMinusTime(boolean value) { - var instance = getInstance(); - instance.put("date-time", value); - return getBuilderAfterDatetime(instance); - } - - default T dateHyphenMinusTime(String value) { - var instance = getInstance(); - instance.put("date-time", value); - return getBuilderAfterDatetime(instance); - } - - default T dateHyphenMinusTime(int value) { - var instance = getInstance(); - instance.put("date-time", value); - return getBuilderAfterDatetime(instance); - } - - default T dateHyphenMinusTime(float value) { - var instance = getInstance(); - instance.put("date-time", value); - return getBuilderAfterDatetime(instance); - } - - default T dateHyphenMinusTime(long value) { - var instance = getInstance(); - instance.put("date-time", value); - return getBuilderAfterDatetime(instance); - } - - default T dateHyphenMinusTime(double value) { - var instance = getInstance(); - instance.put("date-time", value); - return getBuilderAfterDatetime(instance); - } - - default T dateHyphenMinusTime(List value) { - var instance = getInstance(); - instance.put("date-time", value); - return getBuilderAfterDatetime(instance); - } - - default T dateHyphenMinusTime(Map value) { - var instance = getInstance(); - instance.put("date-time", value); - return getBuilderAfterDatetime(instance); - } - } - - public interface SetterForNumberSchema { - Map getInstance(); - T getBuilderAfterNumberSchema(Map instance); - - default T setNumber(Nothing? value) { - var instance = getInstance(); - instance.put("number", null); - return getBuilderAfterNumberSchema(instance); - } - - default T setNumber(boolean value) { - var instance = getInstance(); - instance.put("number", value); - return getBuilderAfterNumberSchema(instance); - } - - default T setNumber(String value) { - var instance = getInstance(); - instance.put("number", value); - return getBuilderAfterNumberSchema(instance); - } - - default T setNumber(int value) { - var instance = getInstance(); - instance.put("number", value); - return getBuilderAfterNumberSchema(instance); - } - - default T setNumber(float value) { - var instance = getInstance(); - instance.put("number", value); - return getBuilderAfterNumberSchema(instance); - } - - default T setNumber(long value) { - var instance = getInstance(); - instance.put("number", value); - return getBuilderAfterNumberSchema(instance); - } - - default T setNumber(double value) { - var instance = getInstance(); - instance.put("number", value); - return getBuilderAfterNumberSchema(instance); - } - - default T setNumber(List value) { - var instance = getInstance(); - instance.put("number", value); - return getBuilderAfterNumberSchema(instance); - } - - default T setNumber(Map value) { - var instance = getInstance(); - instance.put("number", value); - return getBuilderAfterNumberSchema(instance); - } - } - - public interface SetterForBinary { - Map getInstance(); - T getBuilderAfterBinary(Map instance); - - default T binary(Nothing? value) { - var instance = getInstance(); - instance.put("binary", null); - return getBuilderAfterBinary(instance); - } - - default T binary(boolean value) { - var instance = getInstance(); - instance.put("binary", value); - return getBuilderAfterBinary(instance); - } - - default T binary(String value) { - var instance = getInstance(); - instance.put("binary", value); - return getBuilderAfterBinary(instance); - } - - default T binary(int value) { - var instance = getInstance(); - instance.put("binary", value); - return getBuilderAfterBinary(instance); - } - - default T binary(float value) { - var instance = getInstance(); - instance.put("binary", value); - return getBuilderAfterBinary(instance); - } - - default T binary(long value) { - var instance = getInstance(); - instance.put("binary", value); - return getBuilderAfterBinary(instance); - } - - default T binary(double value) { - var instance = getInstance(); - instance.put("binary", value); - return getBuilderAfterBinary(instance); - } - - default T binary(List value) { - var instance = getInstance(); - instance.put("binary", value); - return getBuilderAfterBinary(instance); - } - - default T binary(Map value) { - var instance = getInstance(); - instance.put("binary", value); - return getBuilderAfterBinary(instance); - } - } - - public interface SetterForInt32 { - Map getInstance(); - T getBuilderAfterInt32(Map instance); - - default T int32(Nothing? value) { - var instance = getInstance(); - instance.put("int32", null); - return getBuilderAfterInt32(instance); - } - - default T int32(boolean value) { - var instance = getInstance(); - instance.put("int32", value); - return getBuilderAfterInt32(instance); - } - - default T int32(String value) { - var instance = getInstance(); - instance.put("int32", value); - return getBuilderAfterInt32(instance); - } - - default T int32(int value) { - var instance = getInstance(); - instance.put("int32", value); - return getBuilderAfterInt32(instance); - } - - default T int32(float value) { - var instance = getInstance(); - instance.put("int32", value); - return getBuilderAfterInt32(instance); - } - - default T int32(long value) { - var instance = getInstance(); - instance.put("int32", value); - return getBuilderAfterInt32(instance); - } - - default T int32(double value) { - var instance = getInstance(); - instance.put("int32", value); - return getBuilderAfterInt32(instance); - } - - default T int32(List value) { - var instance = getInstance(); - instance.put("int32", value); - return getBuilderAfterInt32(instance); - } - - default T int32(Map value) { - var instance = getInstance(); - instance.put("int32", value); - return getBuilderAfterInt32(instance); - } - } - - public interface SetterForInt64 { - Map getInstance(); - T getBuilderAfterInt64(Map instance); - - default T int64(Nothing? value) { - var instance = getInstance(); - instance.put("int64", null); - return getBuilderAfterInt64(instance); - } - - default T int64(boolean value) { - var instance = getInstance(); - instance.put("int64", value); - return getBuilderAfterInt64(instance); - } - - default T int64(String value) { - var instance = getInstance(); - instance.put("int64", value); - return getBuilderAfterInt64(instance); - } - - default T int64(int value) { - var instance = getInstance(); - instance.put("int64", value); - return getBuilderAfterInt64(instance); - } - - default T int64(float value) { - var instance = getInstance(); - instance.put("int64", value); - return getBuilderAfterInt64(instance); - } - - default T int64(long value) { - var instance = getInstance(); - instance.put("int64", value); - return getBuilderAfterInt64(instance); - } - - default T int64(double value) { - var instance = getInstance(); - instance.put("int64", value); - return getBuilderAfterInt64(instance); - } - - default T int64(List value) { - var instance = getInstance(); - instance.put("int64", value); - return getBuilderAfterInt64(instance); - } - - default T int64(Map value) { - var instance = getInstance(); - instance.put("int64", value); - return getBuilderAfterInt64(instance); - } - } - - public interface SetterForDoubleSchema { - Map getInstance(); - T getBuilderAfterDoubleSchema(Map instance); - - default T setDouble(Nothing? value) { - var instance = getInstance(); - instance.put("double", null); - return getBuilderAfterDoubleSchema(instance); - } - - default T setDouble(boolean value) { - var instance = getInstance(); - instance.put("double", value); - return getBuilderAfterDoubleSchema(instance); - } - - default T setDouble(String value) { - var instance = getInstance(); - instance.put("double", value); - return getBuilderAfterDoubleSchema(instance); - } - - default T setDouble(int value) { - var instance = getInstance(); - instance.put("double", value); - return getBuilderAfterDoubleSchema(instance); - } - - default T setDouble(float value) { - var instance = getInstance(); - instance.put("double", value); - return getBuilderAfterDoubleSchema(instance); - } - - default T setDouble(long value) { - var instance = getInstance(); - instance.put("double", value); - return getBuilderAfterDoubleSchema(instance); - } - - default T setDouble(double value) { - var instance = getInstance(); - instance.put("double", value); - return getBuilderAfterDoubleSchema(instance); - } - - default T setDouble(List value) { - var instance = getInstance(); - instance.put("double", value); - return getBuilderAfterDoubleSchema(instance); - } - - default T setDouble(Map value) { - var instance = getInstance(); - instance.put("double", value); - return getBuilderAfterDoubleSchema(instance); - } - } - - public interface SetterForFloatSchema { - Map getInstance(); - T getBuilderAfterFloatSchema(Map instance); - - default T setFloat(Nothing? value) { - var instance = getInstance(); - instance.put("float", null); - return getBuilderAfterFloatSchema(instance); - } - - default T setFloat(boolean value) { - var instance = getInstance(); - instance.put("float", value); - return getBuilderAfterFloatSchema(instance); - } - - default T setFloat(String value) { - var instance = getInstance(); - instance.put("float", value); - return getBuilderAfterFloatSchema(instance); - } - - default T setFloat(int value) { - var instance = getInstance(); - instance.put("float", value); - return getBuilderAfterFloatSchema(instance); - } - - default T setFloat(float value) { - var instance = getInstance(); - instance.put("float", value); - return getBuilderAfterFloatSchema(instance); - } - - default T setFloat(long value) { - var instance = getInstance(); - instance.put("float", value); - return getBuilderAfterFloatSchema(instance); - } - - default T setFloat(double value) { - var instance = getInstance(); - instance.put("float", value); - return getBuilderAfterFloatSchema(instance); - } - - default T setFloat(List value) { - var instance = getInstance(); - instance.put("float", value); - return getBuilderAfterFloatSchema(instance); - } - - default T setFloat(Map value) { - var instance = getInstance(); - instance.put("float", value); - return getBuilderAfterFloatSchema(instance); - } - } - - public static class AnyTypeAndFormatMapBuilder extends UnsetAddPropsSetter implements GenericBuilder>, SetterForUuidSchema, SetterForDate, SetterForDatetime, SetterForNumberSchema, SetterForBinary, SetterForInt32, SetterForInt64, SetterForDoubleSchema, SetterForFloatSchema { - private final Map instance; - private static final Set knownKeys = Set.of( - "uuid", - "date", - "date-time", - "number", - "binary", - "int32", - "int64", - "double", - "float" - ); - public Set getKnownKeys() { - return knownKeys; - } - public AnyTypeAndFormatMapBuilder() { - this.instance = new LinkedHashMap<>(); - } - public Map build() { - return instance; - } - public Map getInstance() { - return instance; - } - public AnyTypeAndFormatMapBuilder getBuilderAfterUuidSchema(Map instance) { - return this; - } - public AnyTypeAndFormatMapBuilder getBuilderAfterDate(Map instance) { - return this; - } - public AnyTypeAndFormatMapBuilder getBuilderAfterDatetime(Map instance) { - return this; - } - public AnyTypeAndFormatMapBuilder getBuilderAfterNumberSchema(Map instance) { - return this; - } - public AnyTypeAndFormatMapBuilder getBuilderAfterBinary(Map instance) { - return this; - } - public AnyTypeAndFormatMapBuilder getBuilderAfterInt32(Map instance) { - return this; - } - public AnyTypeAndFormatMapBuilder getBuilderAfterInt64(Map instance) { - return this; - } - public AnyTypeAndFormatMapBuilder getBuilderAfterDoubleSchema(Map instance) { - return this; - } - public AnyTypeAndFormatMapBuilder getBuilderAfterFloatSchema(Map instance) { - return this; - } - public AnyTypeAndFormatMapBuilder getBuilderAfterAdditionalProperty(Map instance) { - return this; - } - } - - - public sealed interface AnyTypeAndFormat1Boxed permits AnyTypeAndFormat1BoxedMap { - @Nullable Object getData(); - } - - public record AnyTypeAndFormat1BoxedMap(AnyTypeAndFormatMap data) implements AnyTypeAndFormat1Boxed { - @Override - public @Nullable Object getData() { - return data; - } - } - - - public static class AnyTypeAndFormat1 extends JsonSchema implements MapSchemaValidator { - /* - NOTE: This class is auto generated by OpenAPI JSON Schema Generator. - Ref: https://github.com/openapi-json-schema-tools/openapi-json-schema-generator - - Do not edit the class manually. - */ - private static @Nullable AnyTypeAndFormat1 instance = null; - - protected AnyTypeAndFormat1() { - super(new JsonSchemaInfo() - .type(Set.of(Map.class)) - .properties(Map.ofEntries( - new PropertyEntry("uuid", UuidSchema.class), - new PropertyEntry("date", Date.class), - new PropertyEntry("date-time", Datetime.class), - new PropertyEntry("number", NumberSchema.class), - new PropertyEntry("binary", Binary.class), - new PropertyEntry("int32", Int32.class), - new PropertyEntry("int64", Int64.class), - new PropertyEntry("double", DoubleSchema.class), - new PropertyEntry("float", FloatSchema.class) - )) - ); - } - - public static AnyTypeAndFormat1 getInstance() { - if (instance == null) { - instance = new AnyTypeAndFormat1(); - } - return instance; - } - - 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 RuntimeException("Invalid non-string key value"); - } - String propertyName = (String) entryKey; - List propertyPathToItem = new ArrayList<>(pathToItem); - propertyPathToItem.add(propertyName); - Object value = entry.getValue(); - LinkedHashMap, Nothing?> schemas = pathToSchemas.get(propertyPathToItem); - if (schemas == null) { - throw new RuntimeException("Validation result is invalid, schemas must exist for a pathToItem"); - } - JsonSchema propertySchema = schemas.entrySet().iterator().next().getKey(); - @Nullable Object propertyInstance = propertySchema.getNewInstance(value, propertyPathToItem, pathToSchemas); - properties.put(propertyName, propertyInstance); - } - FrozenMap<@Nullable Object> castProperties = new FrozenMap<>(properties); - return new AnyTypeAndFormatMap(castProperties); - } - - 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); - SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().build())); - ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, new PathToSchemasMap(), new LinkedHashSet<>()); - PathToSchemasMap pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet); - return getNewInstance(castArg, validationMetadata.pathToItem(), pathToSchemasMap); - } - - - @Override - public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws 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"); - } - @Override - public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { - if (arg instanceof Map) { - return getNewInstance((Map) arg, pathToItem, pathToSchemas); - } - 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 { - return new AnyTypeAndFormat1BoxedMap(validate(arg, configuration)); - } - @Override - public AnyTypeAndFormat1Boxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { - 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"); - } - } - -} diff --git a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/schemas/AnyTypeNotString.kt b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/schemas/AnyTypeNotString.kt deleted file mode 100644 index e1fc92d61ae..00000000000 --- a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/schemas/AnyTypeNotString.kt +++ /dev/null @@ -1,339 +0,0 @@ -package org.openapijsonschematools.client.components.schemas; -import java.time.LocalDate; -import java.time.ZonedDateTime; -import java.util.ArrayList; -import java.util.HashSet; -import java.util.LinkedHashMap; -import java.util.LinkedHashSet; -import java.util.List; -import java.util.Map; -import java.util.Objects; -import java.util.Set; -import java.util.UUID; -import org.checkerframework.checker.nullness.qual.Nullable; -import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags; -import org.openapijsonschematools.client.configurations.SchemaConfiguration; -import org.openapijsonschematools.client.exceptions.InvalidAdditionalPropertyException; -import org.openapijsonschematools.client.exceptions.UnsetPropertyException; -import org.openapijsonschematools.client.exceptions.ValidationException; -import org.openapijsonschematools.client.schemas.StringJsonSchema; -import org.openapijsonschematools.client.schemas.UnsetAddPropsSetter; -import org.openapijsonschematools.client.schemas.validation.BooleanSchemaValidator; -import org.openapijsonschematools.client.schemas.validation.FrozenList; -import org.openapijsonschematools.client.schemas.validation.FrozenMap; -import org.openapijsonschematools.client.schemas.validation.JsonSchema; -import org.openapijsonschematools.client.schemas.validation.JsonSchemaInfo; -import org.openapijsonschematools.client.schemas.validation.ListSchemaValidator; -import org.openapijsonschematools.client.schemas.validation.MapSchemaValidator; -import org.openapijsonschematools.client.schemas.validation.NullSchemaValidator; -import org.openapijsonschematools.client.schemas.validation.NumberSchemaValidator; -import org.openapijsonschematools.client.schemas.validation.PathToSchemasMap; -import org.openapijsonschematools.client.schemas.validation.StringSchemaValidator; -import org.openapijsonschematools.client.schemas.validation.ValidationMetadata; - -public class AnyTypeNotString { - // nest classes so all schemas and input/output classes can be public - - - public static class Not extends StringJsonSchema.StringJsonSchema1 { - private static @Nullable Not instance = null; - public static Not getInstance() { - if (instance == null) { - instance = new Not(); - } - return instance; - } - } - - - public sealed interface AnyTypeNotString1Boxed permits AnyTypeNotString1BoxedVoid, AnyTypeNotString1BoxedBoolean, AnyTypeNotString1BoxedNumber, AnyTypeNotString1BoxedString, AnyTypeNotString1BoxedList, AnyTypeNotString1BoxedMap { - @Nullable Object getData(); - } - - public record AnyTypeNotString1BoxedVoid(Nothing? data) implements AnyTypeNotString1Boxed { - @Override - public @Nullable Object getData() { - return data; - } - } - - public record AnyTypeNotString1BoxedBoolean(boolean data) implements AnyTypeNotString1Boxed { - @Override - public @Nullable Object getData() { - return data; - } - } - - public record AnyTypeNotString1BoxedNumber(Number data) implements AnyTypeNotString1Boxed { - @Override - public @Nullable Object getData() { - return data; - } - } - - public record AnyTypeNotString1BoxedString(String data) implements AnyTypeNotString1Boxed { - @Override - public @Nullable Object getData() { - return data; - } - } - - public record AnyTypeNotString1BoxedList(FrozenList<@Nullable Object> data) implements AnyTypeNotString1Boxed { - @Override - public @Nullable Object getData() { - return data; - } - } - - public record AnyTypeNotString1BoxedMap(FrozenMap<@Nullable Object> data) implements AnyTypeNotString1Boxed { - @Override - public @Nullable Object getData() { - return data; - } - } - - - public static class AnyTypeNotString1 extends JsonSchema implements NullSchemaValidator, BooleanSchemaValidator, NumberSchemaValidator, StringSchemaValidator, ListSchemaValidator, AnyTypeNotString1BoxedList>, MapSchemaValidator, AnyTypeNotString1BoxedMap> { - /* - NOTE: This class is auto generated by OpenAPI JSON Schema Generator. - Ref: https://github.com/openapi-json-schema-tools/openapi-json-schema-generator - - Do not edit the class manually. - */ - private static @Nullable AnyTypeNotString1 instance = null; - - protected AnyTypeNotString1() { - super(new JsonSchemaInfo() - .not(Not.class) - ); - } - - public static AnyTypeNotString1 getInstance() { - if (instance == null) { - instance = new AnyTypeNotString1(); - } - return instance; - } - - @Override - public Nothing? validate(Nothing? arg, SchemaConfiguration configuration) throws ValidationException { - Set> pathSet = new HashSet<>(); - List pathToItem = List.of("args[0]"); - Nothing? castArg = castToAllowedTypes(arg, pathToItem, pathSet); - SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().build())); - PathToSchemasMap validatedPathToSchemas = new PathToSchemasMap(); - ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, new LinkedHashSet<>()); - getPathToSchemas(this, castArg, validationMetadata, pathSet); - return castArg; - } - - @Override - public boolean validate(boolean arg, SchemaConfiguration configuration) throws ValidationException { - Set> pathSet = new HashSet<>(); - List pathToItem = List.of("args[0]"); - boolean castArg = castToAllowedTypes(arg, pathToItem, pathSet); - SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().build())); - PathToSchemasMap validatedPathToSchemas = new PathToSchemasMap(); - ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, new LinkedHashSet<>()); - getPathToSchemas(this, castArg, validationMetadata, pathSet); - return castArg; - } - - @Override - public Number validate(Number arg, SchemaConfiguration configuration) throws ValidationException { - Set> pathSet = new HashSet<>(); - List pathToItem = List.of("args[0]"); - Number castArg = castToAllowedTypes(arg, pathToItem, pathSet); - SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().build())); - PathToSchemasMap validatedPathToSchemas = new PathToSchemasMap(); - ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, new LinkedHashSet<>()); - getPathToSchemas(this, castArg, validationMetadata, pathSet); - return castArg; - } - - public int validate(int arg, SchemaConfiguration configuration) throws ValidationException { - return (int) validate((Number) arg, configuration); - } - - public long validate(long arg, SchemaConfiguration configuration) throws ValidationException { - return (long) validate((Number) arg, configuration); - } - - public float validate(float arg, SchemaConfiguration configuration) throws ValidationException { - return (float) validate((Number) arg, configuration); - } - - public double validate(double arg, SchemaConfiguration configuration) throws ValidationException { - return (double) validate((Number) arg, configuration); - } - - @Override - public String validate(String arg, SchemaConfiguration configuration) throws ValidationException { - Set> pathSet = new HashSet<>(); - List pathToItem = List.of("args[0]"); - String castArg = castToAllowedTypes(arg, pathToItem, pathSet); - SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().build())); - PathToSchemasMap validatedPathToSchemas = new PathToSchemasMap(); - ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, new LinkedHashSet<>()); - getPathToSchemas(this, castArg, validationMetadata, pathSet); - return castArg; - } - - public String validate(LocalDate arg, SchemaConfiguration configuration) throws ValidationException { - return validate(arg.toString(), configuration); - } - - public String validate(ZonedDateTime arg, SchemaConfiguration configuration) throws ValidationException { - return validate(arg.toString(), configuration); - } - - public String validate(UUID arg, SchemaConfiguration configuration) throws ValidationException { - return validate(arg.toString(), configuration); - } - - @Override - public FrozenList<@Nullable Object> getNewInstance(List arg, List pathToItem, PathToSchemasMap pathToSchemas) { - List<@Nullable Object> items = new ArrayList<>(); - int i = 0; - for (Object item: arg) { - List itemPathToItem = new ArrayList<>(pathToItem); - itemPathToItem.add(i); - LinkedHashMap, Nothing?> schemas = pathToSchemas.get(itemPathToItem); - if (schemas == null) { - throw new RuntimeException("Validation result is invalid, schemas must exist for a pathToItem"); - } - JsonSchema itemSchema = schemas.entrySet().iterator().next().getKey(); - @Nullable Object itemInstance = itemSchema.getNewInstance(item, itemPathToItem, pathToSchemas); - items.add(itemInstance); - i += 1; - } - FrozenList<@Nullable Object> newInstanceItems = new FrozenList<>(items); - return newInstanceItems; - } - - 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); - SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().build())); - ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, new PathToSchemasMap(), new LinkedHashSet<>()); - PathToSchemasMap pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet); - return getNewInstance(castArg, validationMetadata.pathToItem(), pathToSchemasMap); - } - - @Override - 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 RuntimeException("Invalid non-string key value"); - } - String propertyName = (String) entryKey; - List propertyPathToItem = new ArrayList<>(pathToItem); - propertyPathToItem.add(propertyName); - Object value = entry.getValue(); - LinkedHashMap, Nothing?> schemas = pathToSchemas.get(propertyPathToItem); - if (schemas == null) { - throw new RuntimeException("Validation result is invalid, schemas must exist for a pathToItem"); - } - JsonSchema propertySchema = schemas.entrySet().iterator().next().getKey(); - @Nullable Object propertyInstance = propertySchema.getNewInstance(value, propertyPathToItem, pathToSchemas); - properties.put(propertyName, propertyInstance); - } - FrozenMap<@Nullable Object> castProperties = new FrozenMap<>(properties); - return castProperties; - } - - public FrozenMap<@Nullable Object> validate(Map arg, SchemaConfiguration configuration) throws ValidationException { - Set> pathSet = new HashSet<>(); - List pathToItem = List.of("args[0]"); - Map castArg = castToAllowedTypes(arg, pathToItem, pathSet); - SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().build())); - PathToSchemasMap validatedPathToSchemas = new PathToSchemasMap(); - ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, new LinkedHashSet<>()); - PathToSchemasMap pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet); - return getNewInstance(castArg, validationMetadata.pathToItem(), pathToSchemasMap); - } - - @Override - public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { - if (arg == null) { - return validate((Nothing?) null, configuration); - } else if (arg instanceof Boolean) { - boolean boolArg = (Boolean) arg; - return validate(boolArg, configuration); - } else if (arg instanceof Number) { - return validate((Number) arg, configuration); - } else if (arg instanceof String) { - return validate((String) arg, configuration); - } else if (arg instanceof List) { - return validate((List) arg, 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"); - } - @Override - public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { - if (arg == null) { - return getNewInstance((Nothing?) null, pathToItem, pathToSchemas); - } else if (arg instanceof Boolean) { - boolean boolArg = (Boolean) arg; - return getNewInstance(boolArg, pathToItem, pathToSchemas); - } else if (arg instanceof Number) { - return getNewInstance((Number) arg, pathToItem, pathToSchemas); - } else if (arg instanceof String) { - return getNewInstance((String) arg, pathToItem, pathToSchemas); - } else if (arg instanceof List) { - return getNewInstance((List) arg, 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"); - } - @Override - public AnyTypeNotString1BoxedVoid validateAndBox(Nothing? arg, SchemaConfiguration configuration) throws ValidationException { - return new AnyTypeNotString1BoxedVoid(validate(arg, configuration)); - } - @Override - 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 { - return new AnyTypeNotString1BoxedNumber(validate(arg, configuration)); - } - @Override - 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 { - return new AnyTypeNotString1BoxedList(validate(arg, configuration)); - } - @Override - 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 { - if (arg == null) { - Nothing? castArg = (Nothing?) arg; - return validateAndBox(castArg, configuration); - } else if (arg instanceof Boolean booleanArg) { - boolean castArg = booleanArg; - return validateAndBox(castArg, configuration); - } else if (arg instanceof String castArg) { - return validateAndBox(castArg, configuration); - } else if (arg instanceof Number castArg) { - return validateAndBox(castArg, configuration); - } else if (arg instanceof List castArg) { - 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"); - } - } -} diff --git a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/schemas/ApiResponseSchema.kt b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/schemas/ApiResponseSchema.kt deleted file mode 100644 index eb7876838e7..00000000000 --- a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/schemas/ApiResponseSchema.kt +++ /dev/null @@ -1,289 +0,0 @@ -package org.openapijsonschematools.client.components.schemas; -import java.util.ArrayList; -import java.util.HashSet; -import java.util.LinkedHashMap; -import java.util.LinkedHashSet; -import java.util.List; -import java.util.Map; -import java.util.Objects; -import java.util.Set; -import org.checkerframework.checker.nullness.qual.Nullable; -import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags; -import org.openapijsonschematools.client.configurations.SchemaConfiguration; -import org.openapijsonschematools.client.exceptions.InvalidAdditionalPropertyException; -import org.openapijsonschematools.client.exceptions.UnsetPropertyException; -import org.openapijsonschematools.client.exceptions.ValidationException; -import org.openapijsonschematools.client.schemas.GenericBuilder; -import org.openapijsonschematools.client.schemas.Int32JsonSchema; -import org.openapijsonschematools.client.schemas.StringJsonSchema; -import org.openapijsonschematools.client.schemas.UnsetAddPropsSetter; -import org.openapijsonschematools.client.schemas.validation.FrozenMap; -import org.openapijsonschematools.client.schemas.validation.JsonSchema; -import org.openapijsonschematools.client.schemas.validation.JsonSchemaInfo; -import org.openapijsonschematools.client.schemas.validation.MapSchemaValidator; -import org.openapijsonschematools.client.schemas.validation.PathToSchemasMap; -import org.openapijsonschematools.client.schemas.validation.PropertyEntry; -import org.openapijsonschematools.client.schemas.validation.ValidationMetadata; - -public class ApiResponseSchema { - // nest classes so all schemas and input/output classes can be public - - - public static class Code extends Int32JsonSchema.Int32JsonSchema1 { - private static @Nullable Code instance = null; - public static Code getInstance() { - if (instance == null) { - instance = new Code(); - } - return instance; - } - } - - - public static class Type extends StringJsonSchema.StringJsonSchema1 { - private static @Nullable Type instance = null; - public static Type getInstance() { - if (instance == null) { - instance = new Type(); - } - return instance; - } - } - - - public static class Message extends StringJsonSchema.StringJsonSchema1 { - private static @Nullable Message instance = null; - public static Message getInstance() { - if (instance == null) { - instance = new Message(); - } - return instance; - } - } - - - public static class ApiResponseMap extends FrozenMap<@Nullable Object> { - protected ApiResponseMap(FrozenMap<@Nullable Object> m) { - super(m); - } - public static final Set requiredKeys = Set.of(); - public static final Set optionalKeys = Set.of( - "code", - "type", - "message" - ); - public static ApiResponseMap of(Map arg, SchemaConfiguration configuration) throws ValidationException { - return ApiResponseSchema1.getInstance().validate(arg, configuration); - } - - public Number code() throws UnsetPropertyException { - String key = "code"; - throwIfKeyNotPresent(key); - @Nullable Object value = get(key); - if (!(value instanceof Number)) { - throw new RuntimeException("Invalid value stored for code"); - } - return (Number) value; - } - - public String type() throws UnsetPropertyException { - String key = "type"; - throwIfKeyNotPresent(key); - @Nullable Object value = get(key); - if (!(value instanceof String)) { - throw new RuntimeException("Invalid value stored for type"); - } - return (String) value; - } - - public String message() throws UnsetPropertyException { - String key = "message"; - throwIfKeyNotPresent(key); - @Nullable Object value = get(key); - if (!(value instanceof String)) { - throw new RuntimeException("Invalid value stored for message"); - } - return (String) value; - } - - public @Nullable Object getAdditionalProperty(String name) throws UnsetPropertyException, InvalidAdditionalPropertyException { - throwIfKeyKnown(name, requiredKeys, optionalKeys); - throwIfKeyNotPresent(name); - return get(name); - } - } - - public interface SetterForCode { - Map getInstance(); - T getBuilderAfterCode(Map instance); - - default T code(int value) { - var instance = getInstance(); - instance.put("code", value); - return getBuilderAfterCode(instance); - } - - default T code(float value) { - var instance = getInstance(); - instance.put("code", value); - return getBuilderAfterCode(instance); - } - } - - public interface SetterForType { - Map getInstance(); - T getBuilderAfterType(Map instance); - - default T type(String value) { - var instance = getInstance(); - instance.put("type", value); - return getBuilderAfterType(instance); - } - } - - public interface SetterForMessage { - Map getInstance(); - T getBuilderAfterMessage(Map instance); - - default T message(String value) { - var instance = getInstance(); - instance.put("message", value); - return getBuilderAfterMessage(instance); - } - } - - public static class ApiResponseMapBuilder extends UnsetAddPropsSetter implements GenericBuilder>, SetterForCode, SetterForType, SetterForMessage { - private final Map instance; - private static final Set knownKeys = Set.of( - "code", - "type", - "message" - ); - public Set getKnownKeys() { - return knownKeys; - } - public ApiResponseMapBuilder() { - this.instance = new LinkedHashMap<>(); - } - public Map build() { - return instance; - } - public Map getInstance() { - return instance; - } - public ApiResponseMapBuilder getBuilderAfterCode(Map instance) { - return this; - } - public ApiResponseMapBuilder getBuilderAfterType(Map instance) { - return this; - } - public ApiResponseMapBuilder getBuilderAfterMessage(Map instance) { - return this; - } - public ApiResponseMapBuilder getBuilderAfterAdditionalProperty(Map instance) { - return this; - } - } - - - public sealed interface ApiResponseSchema1Boxed permits ApiResponseSchema1BoxedMap { - @Nullable Object getData(); - } - - public record ApiResponseSchema1BoxedMap(ApiResponseMap data) implements ApiResponseSchema1Boxed { - @Override - public @Nullable Object getData() { - return data; - } - } - - - public static class ApiResponseSchema1 extends JsonSchema implements MapSchemaValidator { - /* - NOTE: This class is auto generated by OpenAPI JSON Schema Generator. - Ref: https://github.com/openapi-json-schema-tools/openapi-json-schema-generator - - Do not edit the class manually. - */ - private static @Nullable ApiResponseSchema1 instance = null; - - protected ApiResponseSchema1() { - super(new JsonSchemaInfo() - .type(Set.of(Map.class)) - .properties(Map.ofEntries( - new PropertyEntry("code", Code.class), - new PropertyEntry("type", Type.class), - new PropertyEntry("message", Message.class) - )) - ); - } - - public static ApiResponseSchema1 getInstance() { - if (instance == null) { - instance = new ApiResponseSchema1(); - } - return instance; - } - - 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 RuntimeException("Invalid non-string key value"); - } - String propertyName = (String) entryKey; - List propertyPathToItem = new ArrayList<>(pathToItem); - propertyPathToItem.add(propertyName); - Object value = entry.getValue(); - LinkedHashMap, Nothing?> schemas = pathToSchemas.get(propertyPathToItem); - if (schemas == null) { - throw new RuntimeException("Validation result is invalid, schemas must exist for a pathToItem"); - } - JsonSchema propertySchema = schemas.entrySet().iterator().next().getKey(); - @Nullable Object propertyInstance = propertySchema.getNewInstance(value, propertyPathToItem, pathToSchemas); - properties.put(propertyName, propertyInstance); - } - FrozenMap<@Nullable Object> castProperties = new FrozenMap<>(properties); - return new ApiResponseMap(castProperties); - } - - 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); - SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().build())); - ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, new PathToSchemasMap(), new LinkedHashSet<>()); - PathToSchemasMap pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet); - return getNewInstance(castArg, validationMetadata.pathToItem(), pathToSchemasMap); - } - - - @Override - public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws 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"); - } - @Override - public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { - if (arg instanceof Map) { - return getNewInstance((Map) arg, pathToItem, pathToSchemas); - } - 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 { - return new ApiResponseSchema1BoxedMap(validate(arg, configuration)); - } - @Override - public ApiResponseSchema1Boxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { - 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"); - } - } - -} diff --git a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/schemas/Apple.kt b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/schemas/Apple.kt deleted file mode 100644 index 1d546b70cdb..00000000000 --- a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/schemas/Apple.kt +++ /dev/null @@ -1,412 +0,0 @@ -package org.openapijsonschematools.client.components.schemas; -import java.util.ArrayList; -import java.util.HashSet; -import java.util.LinkedHashMap; -import java.util.LinkedHashSet; -import java.util.List; -import java.util.Map; -import java.util.Objects; -import java.util.Set; -import java.util.regex.Pattern; -import org.checkerframework.checker.nullness.qual.Nullable; -import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags; -import org.openapijsonschematools.client.configurations.SchemaConfiguration; -import org.openapijsonschematools.client.exceptions.InvalidAdditionalPropertyException; -import org.openapijsonschematools.client.exceptions.UnsetPropertyException; -import org.openapijsonschematools.client.exceptions.ValidationException; -import org.openapijsonschematools.client.schemas.GenericBuilder; -import org.openapijsonschematools.client.schemas.UnsetAddPropsSetter; -import org.openapijsonschematools.client.schemas.validation.FrozenMap; -import org.openapijsonschematools.client.schemas.validation.JsonSchema; -import org.openapijsonschematools.client.schemas.validation.JsonSchemaInfo; -import org.openapijsonschematools.client.schemas.validation.MapSchemaValidator; -import org.openapijsonschematools.client.schemas.validation.NullSchemaValidator; -import org.openapijsonschematools.client.schemas.validation.PathToSchemasMap; -import org.openapijsonschematools.client.schemas.validation.PropertyEntry; -import org.openapijsonschematools.client.schemas.validation.StringSchemaValidator; -import org.openapijsonschematools.client.schemas.validation.ValidationMetadata; - -public class Apple { - // nest classes so all schemas and input/output classes can be public - - - public sealed interface CultivarBoxed permits CultivarBoxedString { - @Nullable Object getData(); - } - - public record CultivarBoxedString(String data) implements CultivarBoxed { - @Override - public @Nullable Object getData() { - return data; - } - } - - - - public static class Cultivar extends JsonSchema implements StringSchemaValidator { - private static @Nullable Cultivar instance = null; - - protected Cultivar() { - super(new JsonSchemaInfo() - .type(Set.of( - String.class - )) - .pattern(Pattern.compile( - "^[a-zA-Z\\s]*$" - )) - ); - } - - public static Cultivar getInstance() { - if (instance == null) { - instance = new Cultivar(); - } - return instance; - } - - @Override - public String validate(String arg, SchemaConfiguration configuration) throws ValidationException { - Set> pathSet = new HashSet<>(); - List pathToItem = List.of("args[0"); - String castArg = castToAllowedTypes(arg, pathToItem, pathSet); - SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().build())); - ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, new PathToSchemasMap(), new LinkedHashSet<>()); - getPathToSchemas(this, castArg, validationMetadata, pathSet); - return castArg; - } - - @Override - public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws 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"); - } - @Override - public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { - 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"); - } - @Override - 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 { - 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"); - } - } - - public sealed interface OriginBoxed permits OriginBoxedString { - @Nullable Object getData(); - } - - public record OriginBoxedString(String data) implements OriginBoxed { - @Override - public @Nullable Object getData() { - return data; - } - } - - - - public static class Origin extends JsonSchema implements StringSchemaValidator { - private static @Nullable Origin instance = null; - - protected Origin() { - super(new JsonSchemaInfo() - .type(Set.of( - String.class - )) - .pattern(Pattern.compile( - "^[A-Z\\s]*$", - Pattern.CASE_INSENSITIVE - )) - ); - } - - public static Origin getInstance() { - if (instance == null) { - instance = new Origin(); - } - return instance; - } - - @Override - public String validate(String arg, SchemaConfiguration configuration) throws ValidationException { - Set> pathSet = new HashSet<>(); - List pathToItem = List.of("args[0"); - String castArg = castToAllowedTypes(arg, pathToItem, pathSet); - SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().build())); - ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, new PathToSchemasMap(), new LinkedHashSet<>()); - getPathToSchemas(this, castArg, validationMetadata, pathSet); - return castArg; - } - - @Override - public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws 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"); - } - @Override - public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { - 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"); - } - @Override - 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 { - 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"); - } - } - - public static class AppleMap extends FrozenMap<@Nullable Object> { - protected AppleMap(FrozenMap<@Nullable Object> m) { - super(m); - } - public static final Set requiredKeys = Set.of( - "cultivar" - ); - public static final Set optionalKeys = Set.of( - "origin" - ); - public static AppleMap of(Map arg, SchemaConfiguration configuration) throws ValidationException { - return Apple1.getInstance().validate(arg, configuration); - } - - public String cultivar() { - @Nullable Object value = get("cultivar"); - if (!(value instanceof String)) { - throw new RuntimeException("Invalid value stored for cultivar"); - } - return (String) value; - } - - public String origin() throws UnsetPropertyException { - String key = "origin"; - throwIfKeyNotPresent(key); - @Nullable Object value = get(key); - if (!(value instanceof String)) { - throw new RuntimeException("Invalid value stored for origin"); - } - return (String) value; - } - - public @Nullable Object getAdditionalProperty(String name) throws UnsetPropertyException, InvalidAdditionalPropertyException { - throwIfKeyKnown(name, requiredKeys, optionalKeys); - throwIfKeyNotPresent(name); - return get(name); - } - } - - public interface SetterForCultivar { - Map getInstance(); - T getBuilderAfterCultivar(Map instance); - - default T cultivar(String value) { - var instance = getInstance(); - instance.put("cultivar", value); - return getBuilderAfterCultivar(instance); - } - } - - public interface SetterForOrigin { - Map getInstance(); - T getBuilderAfterOrigin(Map instance); - - default T origin(String value) { - var instance = getInstance(); - instance.put("origin", value); - return getBuilderAfterOrigin(instance); - } - } - - public static class AppleMap0Builder extends UnsetAddPropsSetter implements GenericBuilder>, SetterForOrigin { - private final Map instance; - private static final Set knownKeys = Set.of( - "cultivar", - "origin" - ); - public Set getKnownKeys() { - return knownKeys; - } - public AppleMap0Builder(Map instance) { - this.instance = instance; - } - public Map build() { - return instance; - } - public Map getInstance() { - return instance; - } - public AppleMap0Builder getBuilderAfterOrigin(Map instance) { - return this; - } - public AppleMap0Builder getBuilderAfterAdditionalProperty(Map instance) { - return this; - } - } - - public static class AppleMapBuilder implements SetterForCultivar { - private final Map instance; - public AppleMapBuilder() { - this.instance = new LinkedHashMap<>(); - } - public Map getInstance() { - return instance; - } - public AppleMap0Builder getBuilderAfterCultivar(Map instance) { - return new AppleMap0Builder(instance); - } - } - - - public sealed interface Apple1Boxed permits Apple1BoxedNothing?, Apple1BoxedMap { - @Nullable Object getData(); - } - - public record Apple1BoxedVoid(Nothing? data) implements Apple1Boxed { - @Override - public @Nullable Object getData() { - return data; - } - } - - public record Apple1BoxedMap(AppleMap data) implements Apple1Boxed { - @Override - public @Nullable Object getData() { - return data; - } - } - - - public static class Apple1 extends JsonSchema implements NullSchemaValidator, MapSchemaValidator { - /* - NOTE: This class is auto generated by OpenAPI JSON Schema Generator. - Ref: https://github.com/openapi-json-schema-tools/openapi-json-schema-generator - - Do not edit the class manually. - */ - private static @Nullable Apple1 instance = null; - - protected Apple1() { - super(new JsonSchemaInfo() - .type(Set.of( - Nothing?.class, - Map.class - )) - .properties(Map.ofEntries( - new PropertyEntry("cultivar", Cultivar.class), - new PropertyEntry("origin", Origin.class) - )) - .required(Set.of( - "cultivar" - )) - ); - } - - public static Apple1 getInstance() { - if (instance == null) { - instance = new Apple1(); - } - return instance; - } - - @Override - public Nothing? validate(Nothing? arg, SchemaConfiguration configuration) throws ValidationException { - Set> pathSet = new HashSet<>(); - List pathToItem = List.of("args[0"); - Nothing? castArg = castToAllowedTypes(arg, pathToItem, pathSet); - SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().build())); - ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, new PathToSchemasMap(), new LinkedHashSet<>()); - getPathToSchemas(this, castArg, validationMetadata, pathSet); - return castArg; - } - - 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 RuntimeException("Invalid non-string key value"); - } - String propertyName = (String) entryKey; - List propertyPathToItem = new ArrayList<>(pathToItem); - propertyPathToItem.add(propertyName); - Object value = entry.getValue(); - LinkedHashMap, Nothing?> schemas = pathToSchemas.get(propertyPathToItem); - if (schemas == null) { - throw new RuntimeException("Validation result is invalid, schemas must exist for a pathToItem"); - } - JsonSchema propertySchema = schemas.entrySet().iterator().next().getKey(); - @Nullable Object propertyInstance = propertySchema.getNewInstance(value, propertyPathToItem, pathToSchemas); - properties.put(propertyName, propertyInstance); - } - FrozenMap<@Nullable Object> castProperties = new FrozenMap<>(properties); - return new AppleMap(castProperties); - } - - 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); - SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().build())); - ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, new PathToSchemasMap(), new LinkedHashSet<>()); - PathToSchemasMap pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet); - return getNewInstance(castArg, validationMetadata.pathToItem(), pathToSchemasMap); - } - - - @Override - public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { - if (arg == null) { - return validate((Nothing?) 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"); - } - @Override - public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { - if (arg == null) { - return getNewInstance((Nothing?) 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"); - } - @Override - public Apple1BoxedVoid validateAndBox(Nothing? arg, SchemaConfiguration configuration) throws ValidationException { - return new Apple1BoxedVoid(validate(arg, configuration)); - } - @Override - 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 { - if (arg == null) { - Nothing? castArg = (Nothing?) 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"); - } - } -} diff --git a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/schemas/AppleReq.kt b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/schemas/AppleReq.kt deleted file mode 100644 index 6ee8fce1ee7..00000000000 --- a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/schemas/AppleReq.kt +++ /dev/null @@ -1,265 +0,0 @@ -package org.openapijsonschematools.client.components.schemas; -import java.util.ArrayList; -import java.util.HashSet; -import java.util.LinkedHashMap; -import java.util.LinkedHashSet; -import java.util.List; -import java.util.Map; -import java.util.Objects; -import java.util.Set; -import org.checkerframework.checker.nullness.qual.Nullable; -import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags; -import org.openapijsonschematools.client.configurations.SchemaConfiguration; -import org.openapijsonschematools.client.exceptions.UnsetPropertyException; -import org.openapijsonschematools.client.exceptions.ValidationException; -import org.openapijsonschematools.client.schemas.AnyTypeJsonSchema; -import org.openapijsonschematools.client.schemas.BooleanJsonSchema; -import org.openapijsonschematools.client.schemas.GenericBuilder; -import org.openapijsonschematools.client.schemas.NotAnyTypeJsonSchema; -import org.openapijsonschematools.client.schemas.StringJsonSchema; -import org.openapijsonschematools.client.schemas.validation.FrozenMap; -import org.openapijsonschematools.client.schemas.validation.JsonSchema; -import org.openapijsonschematools.client.schemas.validation.JsonSchemaInfo; -import org.openapijsonschematools.client.schemas.validation.MapSchemaValidator; -import org.openapijsonschematools.client.schemas.validation.MapUtils; -import org.openapijsonschematools.client.schemas.validation.PathToSchemasMap; -import org.openapijsonschematools.client.schemas.validation.PropertyEntry; -import org.openapijsonschematools.client.schemas.validation.ValidationMetadata; - -public class AppleReq { - // nest classes so all schemas and input/output classes can be public - - - public static class AdditionalProperties extends NotAnyTypeJsonSchema.NotAnyTypeJsonSchema1 { - // NotAnyTypeSchema - private static @Nullable AdditionalProperties instance = null; - public static AdditionalProperties getInstance() { - if (instance == null) { - instance = new AdditionalProperties(); - } - return instance; - } - } - - - public static class Cultivar extends StringJsonSchema.StringJsonSchema1 { - private static @Nullable Cultivar instance = null; - public static Cultivar getInstance() { - if (instance == null) { - instance = new Cultivar(); - } - return instance; - } - } - - - public static class Mealy extends BooleanJsonSchema.BooleanJsonSchema1 { - private static @Nullable Mealy instance = null; - public static Mealy getInstance() { - if (instance == null) { - instance = new Mealy(); - } - return instance; - } - } - - - public static class AppleReqMap extends FrozenMap { - protected AppleReqMap(FrozenMap m) { - super(m); - } - public static final Set requiredKeys = Set.of( - "cultivar" - ); - public static final Set optionalKeys = Set.of( - "mealy" - ); - public static AppleReqMap of(Map arg, SchemaConfiguration configuration) throws ValidationException { - return AppleReq1.getInstance().validate(arg, configuration); - } - - public String cultivar() { - Object value = get("cultivar"); - if (!(value instanceof String)) { - throw new RuntimeException("Invalid value stored for cultivar"); - } - return (String) value; - } - - public boolean mealy() throws UnsetPropertyException { - String key = "mealy"; - throwIfKeyNotPresent(key); - Object value = get(key); - if (!(value instanceof Boolean)) { - throw new RuntimeException("Invalid value stored for mealy"); - } - return (boolean) value; - } - } - - public interface SetterForCultivar { - Map getInstance(); - T getBuilderAfterCultivar(Map instance); - - default T cultivar(String value) { - var instance = getInstance(); - instance.put("cultivar", value); - return getBuilderAfterCultivar(instance); - } - } - - public interface SetterForMealy { - Map getInstance(); - T getBuilderAfterMealy(Map instance); - - default T mealy(boolean value) { - var instance = getInstance(); - instance.put("mealy", value); - return getBuilderAfterMealy(instance); - } - } - - public static class AppleReqMap0Builder implements GenericBuilder>, SetterForMealy { - private final Map instance; - private static final Set knownKeys = Set.of( - "cultivar", - "mealy" - ); - public Set getKnownKeys() { - return knownKeys; - } - public AppleReqMap0Builder(Map instance) { - this.instance = instance; - } - public Map build() { - return instance; - } - public Map getInstance() { - return instance; - } - public AppleReqMap0Builder getBuilderAfterMealy(Map instance) { - return this; - } - } - - public static class AppleReqMapBuilder implements SetterForCultivar { - private final Map instance; - public AppleReqMapBuilder() { - this.instance = new LinkedHashMap<>(); - } - public Map getInstance() { - return instance; - } - public AppleReqMap0Builder getBuilderAfterCultivar(Map instance) { - return new AppleReqMap0Builder(instance); - } - } - - - public sealed interface AppleReq1Boxed permits AppleReq1BoxedMap { - @Nullable Object getData(); - } - - public record AppleReq1BoxedMap(AppleReqMap data) implements AppleReq1Boxed { - @Override - public @Nullable Object getData() { - return data; - } - } - - - public static class AppleReq1 extends JsonSchema implements MapSchemaValidator { - /* - NOTE: This class is auto generated by OpenAPI JSON Schema Generator. - Ref: https://github.com/openapi-json-schema-tools/openapi-json-schema-generator - - Do not edit the class manually. - */ - private static @Nullable AppleReq1 instance = null; - - protected AppleReq1() { - super(new JsonSchemaInfo() - .type(Set.of(Map.class)) - .properties(Map.ofEntries( - new PropertyEntry("cultivar", Cultivar.class), - new PropertyEntry("mealy", Mealy.class) - )) - .required(Set.of( - "cultivar" - )) - .additionalProperties(AdditionalProperties.class) - ); - } - - public static AppleReq1 getInstance() { - if (instance == null) { - instance = new AppleReq1(); - } - return instance; - } - - 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 RuntimeException("Invalid non-string key value"); - } - String propertyName = (String) entryKey; - List propertyPathToItem = new ArrayList<>(pathToItem); - propertyPathToItem.add(propertyName); - Object value = entry.getValue(); - LinkedHashMap, Nothing?> schemas = pathToSchemas.get(propertyPathToItem); - if (schemas == null) { - throw new RuntimeException("Validation 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"); - } - properties.put(propertyName, (Object) propertyInstance); - } - FrozenMap castProperties = new FrozenMap<>(properties); - return new AppleReqMap(castProperties); - } - - 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); - SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().build())); - ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, new PathToSchemasMap(), new LinkedHashSet<>()); - PathToSchemasMap pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet); - return getNewInstance(castArg, validationMetadata.pathToItem(), pathToSchemasMap); - } - - - @Override - public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws 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"); - } - @Override - public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { - if (arg instanceof Map) { - return getNewInstance((Map) arg, pathToItem, pathToSchemas); - } - 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 { - return new AppleReq1BoxedMap(validate(arg, configuration)); - } - @Override - public AppleReq1Boxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { - 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"); - } - } - -} diff --git a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/schemas/ArrayHoldingAnyType.kt b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/schemas/ArrayHoldingAnyType.kt deleted file mode 100644 index cf3ad57a540..00000000000 --- a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/schemas/ArrayHoldingAnyType.kt +++ /dev/null @@ -1,201 +0,0 @@ -package org.openapijsonschematools.client.components.schemas; -import java.util.ArrayList; -import java.util.HashSet; -import java.util.LinkedHashMap; -import java.util.LinkedHashSet; -import java.util.List; -import java.util.Map; -import java.util.Objects; -import java.util.Set; -import org.checkerframework.checker.nullness.qual.Nullable; -import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags; -import org.openapijsonschematools.client.configurations.SchemaConfiguration; -import org.openapijsonschematools.client.exceptions.ValidationException; -import org.openapijsonschematools.client.schemas.AnyTypeJsonSchema; -import org.openapijsonschematools.client.schemas.validation.FrozenList; -import org.openapijsonschematools.client.schemas.validation.JsonSchema; -import org.openapijsonschematools.client.schemas.validation.JsonSchemaInfo; -import org.openapijsonschematools.client.schemas.validation.ListSchemaValidator; -import org.openapijsonschematools.client.schemas.validation.PathToSchemasMap; -import org.openapijsonschematools.client.schemas.validation.ValidationMetadata; - -public class ArrayHoldingAnyType { - // nest classes so all schemas and input/output classes can be public - - - public static class Items extends AnyTypeJsonSchema.AnyTypeJsonSchema1 { - private static @Nullable Items instance = null; - public static Items getInstance() { - if (instance == null) { - instance = new Items(); - } - return instance; - } - } - - - 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 { - return ArrayHoldingAnyType1.getInstance().validate(arg, configuration); - } - } - - public static class ArrayHoldingAnyTypeListBuilder { - // class to build List<@Nullable Object> - private final List<@Nullable Object> list; - - public ArrayHoldingAnyTypeListBuilder() { - list = new ArrayList<>(); - } - - public ArrayHoldingAnyTypeListBuilder(List<@Nullable Object> list) { - this.list = list; - } - - public ArrayHoldingAnyTypeListBuilder add(Nothing? item) { - list.add(null); - return this; - } - - public ArrayHoldingAnyTypeListBuilder add(boolean item) { - list.add(item); - return this; - } - - public ArrayHoldingAnyTypeListBuilder add(String item) { - list.add(item); - return this; - } - - public ArrayHoldingAnyTypeListBuilder add(int item) { - list.add(item); - return this; - } - - public ArrayHoldingAnyTypeListBuilder add(float item) { - list.add(item); - return this; - } - - public ArrayHoldingAnyTypeListBuilder add(long item) { - list.add(item); - return this; - } - - public ArrayHoldingAnyTypeListBuilder add(double item) { - list.add(item); - return this; - } - - public ArrayHoldingAnyTypeListBuilder add(List item) { - list.add(item); - return this; - } - - public ArrayHoldingAnyTypeListBuilder add(Map item) { - list.add(item); - return this; - } - - public List<@Nullable Object> build() { - return list; - } - } - - - public sealed interface ArrayHoldingAnyType1Boxed permits ArrayHoldingAnyType1BoxedList { - @Nullable Object getData(); - } - - public record ArrayHoldingAnyType1BoxedList(ArrayHoldingAnyTypeList data) implements ArrayHoldingAnyType1Boxed { - @Override - public @Nullable Object getData() { - return data; - } - } - - - - public static class ArrayHoldingAnyType1 extends JsonSchema implements ListSchemaValidator { - /* - NOTE: This class is auto generated by OpenAPI JSON Schema Generator. - Ref: https://github.com/openapi-json-schema-tools/openapi-json-schema-generator - - Do not edit the class manually. - */ - private static @Nullable ArrayHoldingAnyType1 instance = null; - - protected ArrayHoldingAnyType1() { - super(new JsonSchemaInfo() - .type(Set.of(List.class)) - .items(Items.class) - ); - } - - public static ArrayHoldingAnyType1 getInstance() { - if (instance == null) { - instance = new ArrayHoldingAnyType1(); - } - return instance; - } - - @Override - public ArrayHoldingAnyTypeList getNewInstance(List arg, List pathToItem, PathToSchemasMap pathToSchemas) { - List<@Nullable Object> items = new ArrayList<>(); - int i = 0; - for (Object item: arg) { - List itemPathToItem = new ArrayList<>(pathToItem); - itemPathToItem.add(i); - LinkedHashMap, Nothing?> schemas = pathToSchemas.get(itemPathToItem); - if (schemas == null) { - throw new RuntimeException("Validation result is invalid, schemas must exist for a pathToItem"); - } - JsonSchema itemSchema = schemas.entrySet().iterator().next().getKey(); - @Nullable Object itemInstance = itemSchema.getNewInstance(item, itemPathToItem, pathToSchemas); - items.add(itemInstance); - i += 1; - } - FrozenList<@Nullable Object> newInstanceItems = new FrozenList<>(items); - return new ArrayHoldingAnyTypeList(newInstanceItems); - } - - 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); - SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().build())); - ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, new PathToSchemasMap(), new LinkedHashSet<>()); - PathToSchemasMap pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet); - return getNewInstance(castArg, validationMetadata.pathToItem(), pathToSchemasMap); - } - - @Override - public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws 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"); - } - @Override - public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { - 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"); - } - @Override - 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 { - 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"); - } - } -} diff --git a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/schemas/ArrayOfArrayOfNumberOnly.kt b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/schemas/ArrayOfArrayOfNumberOnly.kt deleted file mode 100644 index b389fcf7d61..00000000000 --- a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/schemas/ArrayOfArrayOfNumberOnly.kt +++ /dev/null @@ -1,467 +0,0 @@ -package org.openapijsonschematools.client.components.schemas; -import java.util.ArrayList; -import java.util.HashSet; -import java.util.LinkedHashMap; -import java.util.LinkedHashSet; -import java.util.List; -import java.util.Map; -import java.util.Objects; -import java.util.Set; -import org.checkerframework.checker.nullness.qual.Nullable; -import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags; -import org.openapijsonschematools.client.configurations.SchemaConfiguration; -import org.openapijsonschematools.client.exceptions.InvalidAdditionalPropertyException; -import org.openapijsonschematools.client.exceptions.UnsetPropertyException; -import org.openapijsonschematools.client.exceptions.ValidationException; -import org.openapijsonschematools.client.schemas.GenericBuilder; -import org.openapijsonschematools.client.schemas.NumberJsonSchema; -import org.openapijsonschematools.client.schemas.UnsetAddPropsSetter; -import org.openapijsonschematools.client.schemas.validation.FrozenList; -import org.openapijsonschematools.client.schemas.validation.FrozenMap; -import org.openapijsonschematools.client.schemas.validation.JsonSchema; -import org.openapijsonschematools.client.schemas.validation.JsonSchemaInfo; -import org.openapijsonschematools.client.schemas.validation.ListSchemaValidator; -import org.openapijsonschematools.client.schemas.validation.MapSchemaValidator; -import org.openapijsonschematools.client.schemas.validation.PathToSchemasMap; -import org.openapijsonschematools.client.schemas.validation.PropertyEntry; -import org.openapijsonschematools.client.schemas.validation.ValidationMetadata; - -public class ArrayOfArrayOfNumberOnly { - // nest classes so all schemas and input/output classes can be public - - - public static class Items1 extends NumberJsonSchema.NumberJsonSchema1 { - private static @Nullable Items1 instance = null; - public static Items1 getInstance() { - if (instance == null) { - instance = new Items1(); - } - return instance; - } - } - - - public static class ItemsList extends FrozenList { - protected ItemsList(FrozenList m) { - super(m); - } - public static ItemsList of(List arg, SchemaConfiguration configuration) throws ValidationException { - return Items.getInstance().validate(arg, configuration); - } - } - - public static class ItemsListBuilder { - // class to build List - private final List list; - - public ItemsListBuilder() { - list = new ArrayList<>(); - } - - public ItemsListBuilder(List list) { - this.list = list; - } - - public ItemsListBuilder add(int item) { - list.add(item); - return this; - } - - public ItemsListBuilder add(float item) { - list.add(item); - return this; - } - - public ItemsListBuilder add(long item) { - list.add(item); - return this; - } - - public ItemsListBuilder add(double item) { - list.add(item); - return this; - } - - public List build() { - return list; - } - } - - - public sealed interface ItemsBoxed permits ItemsBoxedList { - @Nullable Object getData(); - } - - public record ItemsBoxedList(ItemsList data) implements ItemsBoxed { - @Override - public @Nullable Object getData() { - return data; - } - } - - - - public static class Items extends JsonSchema implements ListSchemaValidator { - private static @Nullable Items instance = null; - - protected Items() { - super(new JsonSchemaInfo() - .type(Set.of(List.class)) - .items(Items1.class) - ); - } - - public static Items getInstance() { - if (instance == null) { - instance = new Items(); - } - return instance; - } - - @Override - public ItemsList getNewInstance(List arg, List pathToItem, PathToSchemasMap pathToSchemas) { - List items = new ArrayList<>(); - int i = 0; - for (Object item: arg) { - List itemPathToItem = new ArrayList<>(pathToItem); - itemPathToItem.add(i); - LinkedHashMap, Nothing?> schemas = pathToSchemas.get(itemPathToItem); - if (schemas == null) { - throw new RuntimeException("Validation 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"); - } - items.add((Number) itemInstance); - i += 1; - } - FrozenList newInstanceItems = new FrozenList<>(items); - return new ItemsList(newInstanceItems); - } - - 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); - SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().build())); - ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, new PathToSchemasMap(), new LinkedHashSet<>()); - PathToSchemasMap pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet); - return getNewInstance(castArg, validationMetadata.pathToItem(), pathToSchemasMap); - } - - @Override - public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws 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"); - } - @Override - public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { - 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"); - } - @Override - 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 { - 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"); - } - } - - public static class ArrayArrayNumberList extends FrozenList { - protected ArrayArrayNumberList(FrozenList m) { - super(m); - } - public static ArrayArrayNumberList of(List> arg, SchemaConfiguration configuration) throws ValidationException { - return ArrayArrayNumber.getInstance().validate(arg, configuration); - } - } - - public static class ArrayArrayNumberListBuilder { - // class to build List> - private final List> list; - - public ArrayArrayNumberListBuilder() { - list = new ArrayList<>(); - } - - public ArrayArrayNumberListBuilder(List> list) { - this.list = list; - } - - public ArrayArrayNumberListBuilder add(List item) { - list.add(item); - return this; - } - - public List> build() { - return list; - } - } - - - public sealed interface ArrayArrayNumberBoxed permits ArrayArrayNumberBoxedList { - @Nullable Object getData(); - } - - public record ArrayArrayNumberBoxedList(ArrayArrayNumberList data) implements ArrayArrayNumberBoxed { - @Override - public @Nullable Object getData() { - return data; - } - } - - - - public static class ArrayArrayNumber extends JsonSchema implements ListSchemaValidator { - private static @Nullable ArrayArrayNumber instance = null; - - protected ArrayArrayNumber() { - super(new JsonSchemaInfo() - .type(Set.of(List.class)) - .items(Items.class) - ); - } - - public static ArrayArrayNumber getInstance() { - if (instance == null) { - instance = new ArrayArrayNumber(); - } - return instance; - } - - @Override - public ArrayArrayNumberList getNewInstance(List arg, List pathToItem, PathToSchemasMap pathToSchemas) { - List items = new ArrayList<>(); - int i = 0; - for (Object item: arg) { - List itemPathToItem = new ArrayList<>(pathToItem); - itemPathToItem.add(i); - LinkedHashMap, Nothing?> schemas = pathToSchemas.get(itemPathToItem); - if (schemas == null) { - throw new RuntimeException("Validation 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"); - } - items.add((ItemsList) itemInstance); - i += 1; - } - FrozenList newInstanceItems = new FrozenList<>(items); - return new ArrayArrayNumberList(newInstanceItems); - } - - 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); - SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().build())); - ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, new PathToSchemasMap(), new LinkedHashSet<>()); - PathToSchemasMap pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet); - return getNewInstance(castArg, validationMetadata.pathToItem(), pathToSchemasMap); - } - - @Override - public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws 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"); - } - @Override - public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { - 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"); - } - @Override - 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 { - 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"); - } - } - - public static class ArrayOfArrayOfNumberOnlyMap extends FrozenMap<@Nullable Object> { - protected ArrayOfArrayOfNumberOnlyMap(FrozenMap<@Nullable Object> m) { - super(m); - } - public static final Set requiredKeys = Set.of(); - public static final Set optionalKeys = Set.of( - "ArrayArrayNumber" - ); - public static ArrayOfArrayOfNumberOnlyMap of(Map arg, SchemaConfiguration configuration) throws ValidationException { - return ArrayOfArrayOfNumberOnly1.getInstance().validate(arg, configuration); - } - - public ArrayArrayNumberList ArrayArrayNumber() throws UnsetPropertyException { - String key = "ArrayArrayNumber"; - throwIfKeyNotPresent(key); - @Nullable Object value = get(key); - if (!(value instanceof ArrayArrayNumberList)) { - throw new RuntimeException("Invalid value stored for ArrayArrayNumber"); - } - return (ArrayArrayNumberList) value; - } - - public @Nullable Object getAdditionalProperty(String name) throws UnsetPropertyException, InvalidAdditionalPropertyException { - throwIfKeyKnown(name, requiredKeys, optionalKeys); - throwIfKeyNotPresent(name); - return get(name); - } - } - - public interface SetterForArrayArrayNumber { - Map getInstance(); - T getBuilderAfterArrayArrayNumber(Map instance); - - default T ArrayArrayNumber(List> value) { - var instance = getInstance(); - instance.put("ArrayArrayNumber", value); - return getBuilderAfterArrayArrayNumber(instance); - } - } - - public static class ArrayOfArrayOfNumberOnlyMapBuilder extends UnsetAddPropsSetter implements GenericBuilder>, SetterForArrayArrayNumber { - private final Map instance; - private static final Set knownKeys = Set.of( - "ArrayArrayNumber" - ); - public Set getKnownKeys() { - return knownKeys; - } - public ArrayOfArrayOfNumberOnlyMapBuilder() { - this.instance = new LinkedHashMap<>(); - } - public Map build() { - return instance; - } - public Map getInstance() { - return instance; - } - public ArrayOfArrayOfNumberOnlyMapBuilder getBuilderAfterArrayArrayNumber(Map instance) { - return this; - } - public ArrayOfArrayOfNumberOnlyMapBuilder getBuilderAfterAdditionalProperty(Map instance) { - return this; - } - } - - - public sealed interface ArrayOfArrayOfNumberOnly1Boxed permits ArrayOfArrayOfNumberOnly1BoxedMap { - @Nullable Object getData(); - } - - public record ArrayOfArrayOfNumberOnly1BoxedMap(ArrayOfArrayOfNumberOnlyMap data) implements ArrayOfArrayOfNumberOnly1Boxed { - @Override - public @Nullable Object getData() { - return data; - } - } - - - public static class ArrayOfArrayOfNumberOnly1 extends JsonSchema implements MapSchemaValidator { - /* - NOTE: This class is auto generated by OpenAPI JSON Schema Generator. - Ref: https://github.com/openapi-json-schema-tools/openapi-json-schema-generator - - Do not edit the class manually. - */ - private static @Nullable ArrayOfArrayOfNumberOnly1 instance = null; - - protected ArrayOfArrayOfNumberOnly1() { - super(new JsonSchemaInfo() - .type(Set.of(Map.class)) - .properties(Map.ofEntries( - new PropertyEntry("ArrayArrayNumber", ArrayArrayNumber.class) - )) - ); - } - - public static ArrayOfArrayOfNumberOnly1 getInstance() { - if (instance == null) { - instance = new ArrayOfArrayOfNumberOnly1(); - } - return instance; - } - - 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 RuntimeException("Invalid non-string key value"); - } - String propertyName = (String) entryKey; - List propertyPathToItem = new ArrayList<>(pathToItem); - propertyPathToItem.add(propertyName); - Object value = entry.getValue(); - LinkedHashMap, Nothing?> schemas = pathToSchemas.get(propertyPathToItem); - if (schemas == null) { - throw new RuntimeException("Validation result is invalid, schemas must exist for a pathToItem"); - } - JsonSchema propertySchema = schemas.entrySet().iterator().next().getKey(); - @Nullable Object propertyInstance = propertySchema.getNewInstance(value, propertyPathToItem, pathToSchemas); - properties.put(propertyName, propertyInstance); - } - FrozenMap<@Nullable Object> castProperties = new FrozenMap<>(properties); - return new ArrayOfArrayOfNumberOnlyMap(castProperties); - } - - 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); - SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().build())); - ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, new PathToSchemasMap(), new LinkedHashSet<>()); - PathToSchemasMap pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet); - return getNewInstance(castArg, validationMetadata.pathToItem(), pathToSchemasMap); - } - - - @Override - public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws 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"); - } - @Override - public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { - if (arg instanceof Map) { - return getNewInstance((Map) arg, pathToItem, pathToSchemas); - } - 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 { - return new ArrayOfArrayOfNumberOnly1BoxedMap(validate(arg, configuration)); - } - @Override - public ArrayOfArrayOfNumberOnly1Boxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { - 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"); - } - } - -} diff --git a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/schemas/ArrayOfEnums.kt b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/schemas/ArrayOfEnums.kt deleted file mode 100644 index 7c33b03af15..00000000000 --- a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/schemas/ArrayOfEnums.kt +++ /dev/null @@ -1,166 +0,0 @@ -package org.openapijsonschematools.client.components.schemas; -import java.util.ArrayList; -import java.util.HashSet; -import java.util.LinkedHashMap; -import java.util.LinkedHashSet; -import java.util.List; -import java.util.Objects; -import java.util.Set; -import org.checkerframework.checker.nullness.qual.Nullable; -import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags; -import org.openapijsonschematools.client.configurations.SchemaConfiguration; -import org.openapijsonschematools.client.exceptions.ValidationException; -import org.openapijsonschematools.client.schemas.validation.FrozenList; -import org.openapijsonschematools.client.schemas.validation.JsonSchema; -import org.openapijsonschematools.client.schemas.validation.JsonSchemaInfo; -import org.openapijsonschematools.client.schemas.validation.ListSchemaValidator; -import org.openapijsonschematools.client.schemas.validation.PathToSchemasMap; -import org.openapijsonschematools.client.schemas.validation.ValidationMetadata; - -public class ArrayOfEnums { - // nest classes so all schemas and input/output classes can be public - - - 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 { - return ArrayOfEnums1.getInstance().validate(arg, configuration); - } - } - - public static class ArrayOfEnumsListBuilder { - // class to build List<@Nullable String> - private final List<@Nullable String> list; - - public ArrayOfEnumsListBuilder() { - list = new ArrayList<>(); - } - - public ArrayOfEnumsListBuilder(List<@Nullable String> list) { - this.list = list; - } - - public ArrayOfEnumsListBuilder add(Nothing? item) { - list.add(null); - return this; - } - - public ArrayOfEnumsListBuilder add(String item) { - list.add(item); - return this; - } - - public ArrayOfEnumsListBuilder add(StringEnum.StringStringEnumEnums item) { - list.add(item.value()); - return this; - } - - public ArrayOfEnumsListBuilder add(StringEnum.NullStringEnumEnums item) { - list.add(null); - return this; - } - - public List<@Nullable String> build() { - return list; - } - } - - - public sealed interface ArrayOfEnums1Boxed permits ArrayOfEnums1BoxedList { - @Nullable Object getData(); - } - - public record ArrayOfEnums1BoxedList(ArrayOfEnumsList data) implements ArrayOfEnums1Boxed { - @Override - public @Nullable Object getData() { - return data; - } - } - - - - public static class ArrayOfEnums1 extends JsonSchema implements ListSchemaValidator { - /* - NOTE: This class is auto generated by OpenAPI JSON Schema Generator. - Ref: https://github.com/openapi-json-schema-tools/openapi-json-schema-generator - - Do not edit the class manually. - */ - private static @Nullable ArrayOfEnums1 instance = null; - - protected ArrayOfEnums1() { - super(new JsonSchemaInfo() - .type(Set.of(List.class)) - .items(StringEnum.StringEnum1.class) - ); - } - - public static ArrayOfEnums1 getInstance() { - if (instance == null) { - instance = new ArrayOfEnums1(); - } - return instance; - } - - @Override - public ArrayOfEnumsList getNewInstance(List arg, List pathToItem, PathToSchemasMap pathToSchemas) { - List<@Nullable String> items = new ArrayList<>(); - int i = 0; - for (Object item: arg) { - List itemPathToItem = new ArrayList<>(pathToItem); - itemPathToItem.add(i); - LinkedHashMap, Nothing?> schemas = pathToSchemas.get(itemPathToItem); - if (schemas == null) { - throw new RuntimeException("Validation 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"); - } - items.add((@Nullable String) itemInstance); - i += 1; - } - FrozenList<@Nullable String> newInstanceItems = new FrozenList<>(items); - return new ArrayOfEnumsList(newInstanceItems); - } - - 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); - SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().build())); - ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, new PathToSchemasMap(), new LinkedHashSet<>()); - PathToSchemasMap pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet); - return getNewInstance(castArg, validationMetadata.pathToItem(), pathToSchemasMap); - } - - @Override - public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws 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"); - } - @Override - public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { - 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"); - } - @Override - 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 { - 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"); - } - } -} diff --git a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/schemas/ArrayOfNumberOnly.kt b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/schemas/ArrayOfNumberOnly.kt deleted file mode 100644 index 4cbe80c9753..00000000000 --- a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/schemas/ArrayOfNumberOnly.kt +++ /dev/null @@ -1,345 +0,0 @@ -package org.openapijsonschematools.client.components.schemas; -import java.util.ArrayList; -import java.util.HashSet; -import java.util.LinkedHashMap; -import java.util.LinkedHashSet; -import java.util.List; -import java.util.Map; -import java.util.Objects; -import java.util.Set; -import org.checkerframework.checker.nullness.qual.Nullable; -import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags; -import org.openapijsonschematools.client.configurations.SchemaConfiguration; -import org.openapijsonschematools.client.exceptions.InvalidAdditionalPropertyException; -import org.openapijsonschematools.client.exceptions.UnsetPropertyException; -import org.openapijsonschematools.client.exceptions.ValidationException; -import org.openapijsonschematools.client.schemas.GenericBuilder; -import org.openapijsonschematools.client.schemas.NumberJsonSchema; -import org.openapijsonschematools.client.schemas.UnsetAddPropsSetter; -import org.openapijsonschematools.client.schemas.validation.FrozenList; -import org.openapijsonschematools.client.schemas.validation.FrozenMap; -import org.openapijsonschematools.client.schemas.validation.JsonSchema; -import org.openapijsonschematools.client.schemas.validation.JsonSchemaInfo; -import org.openapijsonschematools.client.schemas.validation.ListSchemaValidator; -import org.openapijsonschematools.client.schemas.validation.MapSchemaValidator; -import org.openapijsonschematools.client.schemas.validation.PathToSchemasMap; -import org.openapijsonschematools.client.schemas.validation.PropertyEntry; -import org.openapijsonschematools.client.schemas.validation.ValidationMetadata; - -public class ArrayOfNumberOnly { - // nest classes so all schemas and input/output classes can be public - - - public static class Items extends NumberJsonSchema.NumberJsonSchema1 { - private static @Nullable Items instance = null; - public static Items getInstance() { - if (instance == null) { - instance = new Items(); - } - return instance; - } - } - - - public static class ArrayNumberList extends FrozenList { - protected ArrayNumberList(FrozenList m) { - super(m); - } - public static ArrayNumberList of(List arg, SchemaConfiguration configuration) throws ValidationException { - return ArrayNumber.getInstance().validate(arg, configuration); - } - } - - public static class ArrayNumberListBuilder { - // class to build List - private final List list; - - public ArrayNumberListBuilder() { - list = new ArrayList<>(); - } - - public ArrayNumberListBuilder(List list) { - this.list = list; - } - - public ArrayNumberListBuilder add(int item) { - list.add(item); - return this; - } - - public ArrayNumberListBuilder add(float item) { - list.add(item); - return this; - } - - public ArrayNumberListBuilder add(long item) { - list.add(item); - return this; - } - - public ArrayNumberListBuilder add(double item) { - list.add(item); - return this; - } - - public List build() { - return list; - } - } - - - public sealed interface ArrayNumberBoxed permits ArrayNumberBoxedList { - @Nullable Object getData(); - } - - public record ArrayNumberBoxedList(ArrayNumberList data) implements ArrayNumberBoxed { - @Override - public @Nullable Object getData() { - return data; - } - } - - - - public static class ArrayNumber extends JsonSchema implements ListSchemaValidator { - private static @Nullable ArrayNumber instance = null; - - protected ArrayNumber() { - super(new JsonSchemaInfo() - .type(Set.of(List.class)) - .items(Items.class) - ); - } - - public static ArrayNumber getInstance() { - if (instance == null) { - instance = new ArrayNumber(); - } - return instance; - } - - @Override - public ArrayNumberList getNewInstance(List arg, List pathToItem, PathToSchemasMap pathToSchemas) { - List items = new ArrayList<>(); - int i = 0; - for (Object item: arg) { - List itemPathToItem = new ArrayList<>(pathToItem); - itemPathToItem.add(i); - LinkedHashMap, Nothing?> schemas = pathToSchemas.get(itemPathToItem); - if (schemas == null) { - throw new RuntimeException("Validation 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"); - } - items.add((Number) itemInstance); - i += 1; - } - FrozenList newInstanceItems = new FrozenList<>(items); - return new ArrayNumberList(newInstanceItems); - } - - 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); - SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().build())); - ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, new PathToSchemasMap(), new LinkedHashSet<>()); - PathToSchemasMap pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet); - return getNewInstance(castArg, validationMetadata.pathToItem(), pathToSchemasMap); - } - - @Override - public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws 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"); - } - @Override - public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { - 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"); - } - @Override - 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 { - 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"); - } - } - - public static class ArrayOfNumberOnlyMap extends FrozenMap<@Nullable Object> { - protected ArrayOfNumberOnlyMap(FrozenMap<@Nullable Object> m) { - super(m); - } - public static final Set requiredKeys = Set.of(); - public static final Set optionalKeys = Set.of( - "ArrayNumber" - ); - public static ArrayOfNumberOnlyMap of(Map arg, SchemaConfiguration configuration) throws ValidationException { - return ArrayOfNumberOnly1.getInstance().validate(arg, configuration); - } - - public ArrayNumberList ArrayNumber() throws UnsetPropertyException { - String key = "ArrayNumber"; - throwIfKeyNotPresent(key); - @Nullable Object value = get(key); - if (!(value instanceof ArrayNumberList)) { - throw new RuntimeException("Invalid value stored for ArrayNumber"); - } - return (ArrayNumberList) value; - } - - public @Nullable Object getAdditionalProperty(String name) throws UnsetPropertyException, InvalidAdditionalPropertyException { - throwIfKeyKnown(name, requiredKeys, optionalKeys); - throwIfKeyNotPresent(name); - return get(name); - } - } - - public interface SetterForArrayNumber { - Map getInstance(); - T getBuilderAfterArrayNumber(Map instance); - - default T ArrayNumber(List value) { - var instance = getInstance(); - instance.put("ArrayNumber", value); - return getBuilderAfterArrayNumber(instance); - } - } - - public static class ArrayOfNumberOnlyMapBuilder extends UnsetAddPropsSetter implements GenericBuilder>, SetterForArrayNumber { - private final Map instance; - private static final Set knownKeys = Set.of( - "ArrayNumber" - ); - public Set getKnownKeys() { - return knownKeys; - } - public ArrayOfNumberOnlyMapBuilder() { - this.instance = new LinkedHashMap<>(); - } - public Map build() { - return instance; - } - public Map getInstance() { - return instance; - } - public ArrayOfNumberOnlyMapBuilder getBuilderAfterArrayNumber(Map instance) { - return this; - } - public ArrayOfNumberOnlyMapBuilder getBuilderAfterAdditionalProperty(Map instance) { - return this; - } - } - - - public sealed interface ArrayOfNumberOnly1Boxed permits ArrayOfNumberOnly1BoxedMap { - @Nullable Object getData(); - } - - public record ArrayOfNumberOnly1BoxedMap(ArrayOfNumberOnlyMap data) implements ArrayOfNumberOnly1Boxed { - @Override - public @Nullable Object getData() { - return data; - } - } - - - public static class ArrayOfNumberOnly1 extends JsonSchema implements MapSchemaValidator { - /* - NOTE: This class is auto generated by OpenAPI JSON Schema Generator. - Ref: https://github.com/openapi-json-schema-tools/openapi-json-schema-generator - - Do not edit the class manually. - */ - private static @Nullable ArrayOfNumberOnly1 instance = null; - - protected ArrayOfNumberOnly1() { - super(new JsonSchemaInfo() - .type(Set.of(Map.class)) - .properties(Map.ofEntries( - new PropertyEntry("ArrayNumber", ArrayNumber.class) - )) - ); - } - - public static ArrayOfNumberOnly1 getInstance() { - if (instance == null) { - instance = new ArrayOfNumberOnly1(); - } - return instance; - } - - 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 RuntimeException("Invalid non-string key value"); - } - String propertyName = (String) entryKey; - List propertyPathToItem = new ArrayList<>(pathToItem); - propertyPathToItem.add(propertyName); - Object value = entry.getValue(); - LinkedHashMap, Nothing?> schemas = pathToSchemas.get(propertyPathToItem); - if (schemas == null) { - throw new RuntimeException("Validation result is invalid, schemas must exist for a pathToItem"); - } - JsonSchema propertySchema = schemas.entrySet().iterator().next().getKey(); - @Nullable Object propertyInstance = propertySchema.getNewInstance(value, propertyPathToItem, pathToSchemas); - properties.put(propertyName, propertyInstance); - } - FrozenMap<@Nullable Object> castProperties = new FrozenMap<>(properties); - return new ArrayOfNumberOnlyMap(castProperties); - } - - 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); - SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().build())); - ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, new PathToSchemasMap(), new LinkedHashSet<>()); - PathToSchemasMap pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet); - return getNewInstance(castArg, validationMetadata.pathToItem(), pathToSchemasMap); - } - - - @Override - public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws 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"); - } - @Override - public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { - if (arg instanceof Map) { - return getNewInstance((Map) arg, pathToItem, pathToSchemas); - } - 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 { - return new ArrayOfNumberOnly1BoxedMap(validate(arg, configuration)); - } - @Override - public ArrayOfNumberOnly1Boxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { - 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"); - } - } - -} diff --git a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/schemas/ArrayTest.kt b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/schemas/ArrayTest.kt deleted file mode 100644 index 65aad8374af..00000000000 --- a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/schemas/ArrayTest.kt +++ /dev/null @@ -1,899 +0,0 @@ -package org.openapijsonschematools.client.components.schemas; -import java.util.ArrayList; -import java.util.HashSet; -import java.util.LinkedHashMap; -import java.util.LinkedHashSet; -import java.util.List; -import java.util.Map; -import java.util.Objects; -import java.util.Set; -import org.checkerframework.checker.nullness.qual.Nullable; -import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags; -import org.openapijsonschematools.client.configurations.SchemaConfiguration; -import org.openapijsonschematools.client.exceptions.InvalidAdditionalPropertyException; -import org.openapijsonschematools.client.exceptions.UnsetPropertyException; -import org.openapijsonschematools.client.exceptions.ValidationException; -import org.openapijsonschematools.client.schemas.GenericBuilder; -import org.openapijsonschematools.client.schemas.Int64JsonSchema; -import org.openapijsonschematools.client.schemas.StringJsonSchema; -import org.openapijsonschematools.client.schemas.UnsetAddPropsSetter; -import org.openapijsonschematools.client.schemas.validation.FrozenList; -import org.openapijsonschematools.client.schemas.validation.FrozenMap; -import org.openapijsonschematools.client.schemas.validation.JsonSchema; -import org.openapijsonschematools.client.schemas.validation.JsonSchemaInfo; -import org.openapijsonschematools.client.schemas.validation.ListSchemaValidator; -import org.openapijsonschematools.client.schemas.validation.MapSchemaValidator; -import org.openapijsonschematools.client.schemas.validation.PathToSchemasMap; -import org.openapijsonschematools.client.schemas.validation.PropertyEntry; -import org.openapijsonschematools.client.schemas.validation.ValidationMetadata; - -public class ArrayTest { - // nest classes so all schemas and input/output classes can be public - - - public static class Items extends StringJsonSchema.StringJsonSchema1 { - private static @Nullable Items instance = null; - public static Items getInstance() { - if (instance == null) { - instance = new Items(); - } - return instance; - } - } - - - public static class ArrayOfStringList extends FrozenList { - protected ArrayOfStringList(FrozenList m) { - super(m); - } - public static ArrayOfStringList of(List arg, SchemaConfiguration configuration) throws ValidationException { - return ArrayOfString.getInstance().validate(arg, configuration); - } - } - - public static class ArrayOfStringListBuilder { - // class to build List - private final List list; - - public ArrayOfStringListBuilder() { - list = new ArrayList<>(); - } - - public ArrayOfStringListBuilder(List list) { - this.list = list; - } - - public ArrayOfStringListBuilder add(String item) { - list.add(item); - return this; - } - - public List build() { - return list; - } - } - - - public sealed interface ArrayOfStringBoxed permits ArrayOfStringBoxedList { - @Nullable Object getData(); - } - - public record ArrayOfStringBoxedList(ArrayOfStringList data) implements ArrayOfStringBoxed { - @Override - public @Nullable Object getData() { - return data; - } - } - - - - public static class ArrayOfString extends JsonSchema implements ListSchemaValidator { - private static @Nullable ArrayOfString instance = null; - - protected ArrayOfString() { - super(new JsonSchemaInfo() - .type(Set.of(List.class)) - .items(Items.class) - ); - } - - public static ArrayOfString getInstance() { - if (instance == null) { - instance = new ArrayOfString(); - } - return instance; - } - - @Override - public ArrayOfStringList getNewInstance(List arg, List pathToItem, PathToSchemasMap pathToSchemas) { - List items = new ArrayList<>(); - int i = 0; - for (Object item: arg) { - List itemPathToItem = new ArrayList<>(pathToItem); - itemPathToItem.add(i); - LinkedHashMap, Nothing?> schemas = pathToSchemas.get(itemPathToItem); - if (schemas == null) { - throw new RuntimeException("Validation 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"); - } - items.add((String) itemInstance); - i += 1; - } - FrozenList newInstanceItems = new FrozenList<>(items); - return new ArrayOfStringList(newInstanceItems); - } - - 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); - SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().build())); - ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, new PathToSchemasMap(), new LinkedHashSet<>()); - PathToSchemasMap pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet); - return getNewInstance(castArg, validationMetadata.pathToItem(), pathToSchemasMap); - } - - @Override - public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws 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"); - } - @Override - public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { - 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"); - } - @Override - 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 { - 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"); - } - } - - public static class Items2 extends Int64JsonSchema.Int64JsonSchema1 { - private static @Nullable Items2 instance = null; - public static Items2 getInstance() { - if (instance == null) { - instance = new Items2(); - } - return instance; - } - } - - - public static class ItemsList extends FrozenList { - protected ItemsList(FrozenList m) { - super(m); - } - public static ItemsList of(List arg, SchemaConfiguration configuration) throws ValidationException { - return Items1.getInstance().validate(arg, configuration); - } - } - - public static class ItemsListBuilder { - // class to build List - private final List list; - - public ItemsListBuilder() { - list = new ArrayList<>(); - } - - public ItemsListBuilder(List list) { - this.list = list; - } - - public ItemsListBuilder add(int item) { - list.add(item); - return this; - } - - public ItemsListBuilder add(float item) { - list.add(item); - return this; - } - - public ItemsListBuilder add(long item) { - list.add(item); - return this; - } - - public ItemsListBuilder add(double item) { - list.add(item); - return this; - } - - public List build() { - return list; - } - } - - - public sealed interface Items1Boxed permits Items1BoxedList { - @Nullable Object getData(); - } - - public record Items1BoxedList(ItemsList data) implements Items1Boxed { - @Override - public @Nullable Object getData() { - return data; - } - } - - - - public static class Items1 extends JsonSchema implements ListSchemaValidator { - private static @Nullable Items1 instance = null; - - protected Items1() { - super(new JsonSchemaInfo() - .type(Set.of(List.class)) - .items(Items2.class) - ); - } - - public static Items1 getInstance() { - if (instance == null) { - instance = new Items1(); - } - return instance; - } - - @Override - public ItemsList getNewInstance(List arg, List pathToItem, PathToSchemasMap pathToSchemas) { - List items = new ArrayList<>(); - int i = 0; - for (Object item: arg) { - List itemPathToItem = new ArrayList<>(pathToItem); - itemPathToItem.add(i); - LinkedHashMap, Nothing?> schemas = pathToSchemas.get(itemPathToItem); - if (schemas == null) { - throw new RuntimeException("Validation 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"); - } - items.add((Number) itemInstance); - i += 1; - } - FrozenList newInstanceItems = new FrozenList<>(items); - return new ItemsList(newInstanceItems); - } - - 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); - SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().build())); - ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, new PathToSchemasMap(), new LinkedHashSet<>()); - PathToSchemasMap pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet); - return getNewInstance(castArg, validationMetadata.pathToItem(), pathToSchemasMap); - } - - @Override - public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws 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"); - } - @Override - public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { - 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"); - } - @Override - 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 { - 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"); - } - } - - public static class ArrayArrayOfIntegerList extends FrozenList { - protected ArrayArrayOfIntegerList(FrozenList m) { - super(m); - } - public static ArrayArrayOfIntegerList of(List> arg, SchemaConfiguration configuration) throws ValidationException { - return ArrayArrayOfInteger.getInstance().validate(arg, configuration); - } - } - - public static class ArrayArrayOfIntegerListBuilder { - // class to build List> - private final List> list; - - public ArrayArrayOfIntegerListBuilder() { - list = new ArrayList<>(); - } - - public ArrayArrayOfIntegerListBuilder(List> list) { - this.list = list; - } - - public ArrayArrayOfIntegerListBuilder add(List item) { - list.add(item); - return this; - } - - public List> build() { - return list; - } - } - - - public sealed interface ArrayArrayOfIntegerBoxed permits ArrayArrayOfIntegerBoxedList { - @Nullable Object getData(); - } - - public record ArrayArrayOfIntegerBoxedList(ArrayArrayOfIntegerList data) implements ArrayArrayOfIntegerBoxed { - @Override - public @Nullable Object getData() { - return data; - } - } - - - - public static class ArrayArrayOfInteger extends JsonSchema implements ListSchemaValidator { - private static @Nullable ArrayArrayOfInteger instance = null; - - protected ArrayArrayOfInteger() { - super(new JsonSchemaInfo() - .type(Set.of(List.class)) - .items(Items1.class) - ); - } - - public static ArrayArrayOfInteger getInstance() { - if (instance == null) { - instance = new ArrayArrayOfInteger(); - } - return instance; - } - - @Override - public ArrayArrayOfIntegerList getNewInstance(List arg, List pathToItem, PathToSchemasMap pathToSchemas) { - List items = new ArrayList<>(); - int i = 0; - for (Object item: arg) { - List itemPathToItem = new ArrayList<>(pathToItem); - itemPathToItem.add(i); - LinkedHashMap, Nothing?> schemas = pathToSchemas.get(itemPathToItem); - if (schemas == null) { - throw new RuntimeException("Validation 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"); - } - items.add((ItemsList) itemInstance); - i += 1; - } - FrozenList newInstanceItems = new FrozenList<>(items); - return new ArrayArrayOfIntegerList(newInstanceItems); - } - - 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); - SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().build())); - ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, new PathToSchemasMap(), new LinkedHashSet<>()); - PathToSchemasMap pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet); - return getNewInstance(castArg, validationMetadata.pathToItem(), pathToSchemasMap); - } - - @Override - public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws 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"); - } - @Override - public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { - 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"); - } - @Override - 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 { - 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"); - } - } - - public static class ItemsList1 extends FrozenList { - protected ItemsList1(FrozenList m) { - super(m); - } - public static ItemsList1 of(List> arg, SchemaConfiguration configuration) throws ValidationException { - return Items3.getInstance().validate(arg, configuration); - } - } - - public static class ItemsListBuilder1 { - // class to build List> - private final List> list; - - public ItemsListBuilder1() { - list = new ArrayList<>(); - } - - public ItemsListBuilder1(List> list) { - this.list = list; - } - - public ItemsListBuilder1 add(Map item) { - list.add(item); - return this; - } - - public List> build() { - return list; - } - } - - - public sealed interface Items3Boxed permits Items3BoxedList { - @Nullable Object getData(); - } - - public record Items3BoxedList(ItemsList1 data) implements Items3Boxed { - @Override - public @Nullable Object getData() { - return data; - } - } - - - - public static class Items3 extends JsonSchema implements ListSchemaValidator { - private static @Nullable Items3 instance = null; - - protected Items3() { - super(new JsonSchemaInfo() - .type(Set.of(List.class)) - .items(ReadOnlyFirst.ReadOnlyFirst1.class) - ); - } - - public static Items3 getInstance() { - if (instance == null) { - instance = new Items3(); - } - return instance; - } - - @Override - public ItemsList1 getNewInstance(List arg, List pathToItem, PathToSchemasMap pathToSchemas) { - List items = new ArrayList<>(); - int i = 0; - for (Object item: arg) { - List itemPathToItem = new ArrayList<>(pathToItem); - itemPathToItem.add(i); - LinkedHashMap, Nothing?> schemas = pathToSchemas.get(itemPathToItem); - if (schemas == null) { - throw new RuntimeException("Validation 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"); - } - items.add((ReadOnlyFirst.ReadOnlyFirstMap) itemInstance); - i += 1; - } - FrozenList newInstanceItems = new FrozenList<>(items); - return new ItemsList1(newInstanceItems); - } - - 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); - SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().build())); - ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, new PathToSchemasMap(), new LinkedHashSet<>()); - PathToSchemasMap pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet); - return getNewInstance(castArg, validationMetadata.pathToItem(), pathToSchemasMap); - } - - @Override - public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws 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"); - } - @Override - public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { - 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"); - } - @Override - 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 { - 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"); - } - } - - public static class ArrayArrayOfModelList extends FrozenList { - protected ArrayArrayOfModelList(FrozenList m) { - super(m); - } - public static ArrayArrayOfModelList of(List>> arg, SchemaConfiguration configuration) throws ValidationException { - return ArrayArrayOfModel.getInstance().validate(arg, configuration); - } - } - - public static class ArrayArrayOfModelListBuilder { - // class to build List>> - private final List>> list; - - public ArrayArrayOfModelListBuilder() { - list = new ArrayList<>(); - } - - public ArrayArrayOfModelListBuilder(List>> list) { - this.list = list; - } - - public ArrayArrayOfModelListBuilder add(List> item) { - list.add(item); - return this; - } - - public List>> build() { - return list; - } - } - - - public sealed interface ArrayArrayOfModelBoxed permits ArrayArrayOfModelBoxedList { - @Nullable Object getData(); - } - - public record ArrayArrayOfModelBoxedList(ArrayArrayOfModelList data) implements ArrayArrayOfModelBoxed { - @Override - public @Nullable Object getData() { - return data; - } - } - - - - public static class ArrayArrayOfModel extends JsonSchema implements ListSchemaValidator { - private static @Nullable ArrayArrayOfModel instance = null; - - protected ArrayArrayOfModel() { - super(new JsonSchemaInfo() - .type(Set.of(List.class)) - .items(Items3.class) - ); - } - - public static ArrayArrayOfModel getInstance() { - if (instance == null) { - instance = new ArrayArrayOfModel(); - } - return instance; - } - - @Override - public ArrayArrayOfModelList getNewInstance(List arg, List pathToItem, PathToSchemasMap pathToSchemas) { - List items = new ArrayList<>(); - int i = 0; - for (Object item: arg) { - List itemPathToItem = new ArrayList<>(pathToItem); - itemPathToItem.add(i); - LinkedHashMap, Nothing?> schemas = pathToSchemas.get(itemPathToItem); - if (schemas == null) { - throw new RuntimeException("Validation 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"); - } - items.add((ItemsList1) itemInstance); - i += 1; - } - FrozenList newInstanceItems = new FrozenList<>(items); - return new ArrayArrayOfModelList(newInstanceItems); - } - - 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); - SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().build())); - ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, new PathToSchemasMap(), new LinkedHashSet<>()); - PathToSchemasMap pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet); - return getNewInstance(castArg, validationMetadata.pathToItem(), pathToSchemasMap); - } - - @Override - public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws 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"); - } - @Override - public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { - 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"); - } - @Override - 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 { - 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"); - } - } - - public static class ArrayTestMap extends FrozenMap<@Nullable Object> { - protected ArrayTestMap(FrozenMap<@Nullable Object> m) { - super(m); - } - public static final Set requiredKeys = Set.of(); - public static final Set optionalKeys = Set.of( - "array_of_string", - "array_array_of_integer", - "array_array_of_model" - ); - public static ArrayTestMap of(Map arg, SchemaConfiguration configuration) throws ValidationException { - return ArrayTest1.getInstance().validate(arg, configuration); - } - - public ArrayOfStringList array_of_string() throws UnsetPropertyException { - String key = "array_of_string"; - throwIfKeyNotPresent(key); - @Nullable Object value = get(key); - if (!(value instanceof ArrayOfStringList)) { - throw new RuntimeException("Invalid value stored for array_of_string"); - } - return (ArrayOfStringList) value; - } - - public ArrayArrayOfIntegerList array_array_of_integer() throws UnsetPropertyException { - String key = "array_array_of_integer"; - throwIfKeyNotPresent(key); - @Nullable Object value = get(key); - if (!(value instanceof ArrayArrayOfIntegerList)) { - throw new RuntimeException("Invalid value stored for array_array_of_integer"); - } - return (ArrayArrayOfIntegerList) value; - } - - public ArrayArrayOfModelList array_array_of_model() throws UnsetPropertyException { - String key = "array_array_of_model"; - throwIfKeyNotPresent(key); - @Nullable Object value = get(key); - if (!(value instanceof ArrayArrayOfModelList)) { - throw new RuntimeException("Invalid value stored for array_array_of_model"); - } - return (ArrayArrayOfModelList) value; - } - - public @Nullable Object getAdditionalProperty(String name) throws UnsetPropertyException, InvalidAdditionalPropertyException { - throwIfKeyKnown(name, requiredKeys, optionalKeys); - throwIfKeyNotPresent(name); - return get(name); - } - } - - public interface SetterForArrayOfString { - Map getInstance(); - T getBuilderAfterArrayOfString(Map instance); - - default T array_of_string(List value) { - var instance = getInstance(); - instance.put("array_of_string", value); - return getBuilderAfterArrayOfString(instance); - } - } - - public interface SetterForArrayArrayOfInteger { - Map getInstance(); - T getBuilderAfterArrayArrayOfInteger(Map instance); - - default T array_array_of_integer(List> value) { - var instance = getInstance(); - instance.put("array_array_of_integer", value); - return getBuilderAfterArrayArrayOfInteger(instance); - } - } - - public interface SetterForArrayArrayOfModel { - Map getInstance(); - T getBuilderAfterArrayArrayOfModel(Map instance); - - default T array_array_of_model(List>> value) { - var instance = getInstance(); - instance.put("array_array_of_model", value); - return getBuilderAfterArrayArrayOfModel(instance); - } - } - - public static class ArrayTestMapBuilder extends UnsetAddPropsSetter implements GenericBuilder>, SetterForArrayOfString, SetterForArrayArrayOfInteger, SetterForArrayArrayOfModel { - private final Map instance; - private static final Set knownKeys = Set.of( - "array_of_string", - "array_array_of_integer", - "array_array_of_model" - ); - public Set getKnownKeys() { - return knownKeys; - } - public ArrayTestMapBuilder() { - this.instance = new LinkedHashMap<>(); - } - public Map build() { - return instance; - } - public Map getInstance() { - return instance; - } - public ArrayTestMapBuilder getBuilderAfterArrayOfString(Map instance) { - return this; - } - public ArrayTestMapBuilder getBuilderAfterArrayArrayOfInteger(Map instance) { - return this; - } - public ArrayTestMapBuilder getBuilderAfterArrayArrayOfModel(Map instance) { - return this; - } - public ArrayTestMapBuilder getBuilderAfterAdditionalProperty(Map instance) { - return this; - } - } - - - public sealed interface ArrayTest1Boxed permits ArrayTest1BoxedMap { - @Nullable Object getData(); - } - - public record ArrayTest1BoxedMap(ArrayTestMap data) implements ArrayTest1Boxed { - @Override - public @Nullable Object getData() { - return data; - } - } - - - public static class ArrayTest1 extends JsonSchema implements MapSchemaValidator { - /* - NOTE: This class is auto generated by OpenAPI JSON Schema Generator. - Ref: https://github.com/openapi-json-schema-tools/openapi-json-schema-generator - - Do not edit the class manually. - */ - private static @Nullable ArrayTest1 instance = null; - - protected ArrayTest1() { - super(new JsonSchemaInfo() - .type(Set.of(Map.class)) - .properties(Map.ofEntries( - new PropertyEntry("array_of_string", ArrayOfString.class), - new PropertyEntry("array_array_of_integer", ArrayArrayOfInteger.class), - new PropertyEntry("array_array_of_model", ArrayArrayOfModel.class) - )) - ); - } - - public static ArrayTest1 getInstance() { - if (instance == null) { - instance = new ArrayTest1(); - } - return instance; - } - - 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 RuntimeException("Invalid non-string key value"); - } - String propertyName = (String) entryKey; - List propertyPathToItem = new ArrayList<>(pathToItem); - propertyPathToItem.add(propertyName); - Object value = entry.getValue(); - LinkedHashMap, Nothing?> schemas = pathToSchemas.get(propertyPathToItem); - if (schemas == null) { - throw new RuntimeException("Validation result is invalid, schemas must exist for a pathToItem"); - } - JsonSchema propertySchema = schemas.entrySet().iterator().next().getKey(); - @Nullable Object propertyInstance = propertySchema.getNewInstance(value, propertyPathToItem, pathToSchemas); - properties.put(propertyName, propertyInstance); - } - FrozenMap<@Nullable Object> castProperties = new FrozenMap<>(properties); - return new ArrayTestMap(castProperties); - } - - 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); - SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().build())); - ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, new PathToSchemasMap(), new LinkedHashSet<>()); - PathToSchemasMap pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet); - return getNewInstance(castArg, validationMetadata.pathToItem(), pathToSchemasMap); - } - - - @Override - public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws 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"); - } - @Override - public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { - if (arg instanceof Map) { - return getNewInstance((Map) arg, pathToItem, pathToSchemas); - } - 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 { - return new ArrayTest1BoxedMap(validate(arg, configuration)); - } - @Override - public ArrayTest1Boxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { - 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"); - } - } - -} diff --git a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/schemas/ArrayWithValidationsInItems.kt b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/schemas/ArrayWithValidationsInItems.kt deleted file mode 100644 index 22f3a639470..00000000000 --- a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/schemas/ArrayWithValidationsInItems.kt +++ /dev/null @@ -1,258 +0,0 @@ -package org.openapijsonschematools.client.components.schemas; -import java.util.ArrayList; -import java.util.HashSet; -import java.util.LinkedHashMap; -import java.util.LinkedHashSet; -import java.util.List; -import java.util.Objects; -import java.util.Set; -import org.checkerframework.checker.nullness.qual.Nullable; -import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags; -import org.openapijsonschematools.client.configurations.SchemaConfiguration; -import org.openapijsonschematools.client.exceptions.ValidationException; -import org.openapijsonschematools.client.schemas.validation.FrozenList; -import org.openapijsonschematools.client.schemas.validation.JsonSchema; -import org.openapijsonschematools.client.schemas.validation.JsonSchemaInfo; -import org.openapijsonschematools.client.schemas.validation.ListSchemaValidator; -import org.openapijsonschematools.client.schemas.validation.NumberSchemaValidator; -import org.openapijsonschematools.client.schemas.validation.PathToSchemasMap; -import org.openapijsonschematools.client.schemas.validation.ValidationMetadata; - -public class ArrayWithValidationsInItems { - // nest classes so all schemas and input/output classes can be public - - - public sealed interface ItemsBoxed permits ItemsBoxedNumber { - @Nullable Object getData(); - } - - public record ItemsBoxedNumber(Number data) implements ItemsBoxed { - @Override - public @Nullable Object getData() { - return data; - } - } - - - - public static class Items extends JsonSchema implements NumberSchemaValidator { - private static @Nullable Items instance = null; - - protected Items() { - super(new JsonSchemaInfo() - .type(Set.of( - Integer.class, - Long.class, - Float.class, - Double.class - )) - .format("int64") - .maximum(7) - ); - } - - public static Items getInstance() { - if (instance == null) { - instance = new Items(); - } - return instance; - } - - @Override - public Number validate(Number arg, SchemaConfiguration configuration) throws ValidationException { - Set> pathSet = new HashSet<>(); - List pathToItem = List.of("args[0"); - Number castArg = castToAllowedTypes(arg, pathToItem, pathSet); - SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().build())); - ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, new PathToSchemasMap(), new LinkedHashSet<>()); - getPathToSchemas(this, castArg, validationMetadata, pathSet); - return castArg; - } - - public int validate(int arg, SchemaConfiguration configuration) throws ValidationException { - return (int) validate((Number) arg, configuration); - } - - public float validate(float arg, SchemaConfiguration configuration) throws ValidationException { - return (float) validate((Number) arg, configuration); - } - - public long validate(long arg, SchemaConfiguration configuration) throws ValidationException { - return (long) validate((Number) arg, configuration); - } - - 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 { - 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"); - } - @Override - public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { - 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"); - } - @Override - 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 { - 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"); - } - } - - public static class ArrayWithValidationsInItemsList extends FrozenList { - protected ArrayWithValidationsInItemsList(FrozenList m) { - super(m); - } - public static ArrayWithValidationsInItemsList of(List arg, SchemaConfiguration configuration) throws ValidationException { - return ArrayWithValidationsInItems1.getInstance().validate(arg, configuration); - } - } - - public static class ArrayWithValidationsInItemsListBuilder { - // class to build List - private final List list; - - public ArrayWithValidationsInItemsListBuilder() { - list = new ArrayList<>(); - } - - public ArrayWithValidationsInItemsListBuilder(List list) { - this.list = list; - } - - public ArrayWithValidationsInItemsListBuilder add(int item) { - list.add(item); - return this; - } - - public ArrayWithValidationsInItemsListBuilder add(float item) { - list.add(item); - return this; - } - - public ArrayWithValidationsInItemsListBuilder add(long item) { - list.add(item); - return this; - } - - public ArrayWithValidationsInItemsListBuilder add(double item) { - list.add(item); - return this; - } - - public List build() { - return list; - } - } - - - public sealed interface ArrayWithValidationsInItems1Boxed permits ArrayWithValidationsInItems1BoxedList { - @Nullable Object getData(); - } - - public record ArrayWithValidationsInItems1BoxedList(ArrayWithValidationsInItemsList data) implements ArrayWithValidationsInItems1Boxed { - @Override - public @Nullable Object getData() { - return data; - } - } - - - - public static class ArrayWithValidationsInItems1 extends JsonSchema implements ListSchemaValidator { - /* - NOTE: This class is auto generated by OpenAPI JSON Schema Generator. - Ref: https://github.com/openapi-json-schema-tools/openapi-json-schema-generator - - Do not edit the class manually. - */ - private static @Nullable ArrayWithValidationsInItems1 instance = null; - - protected ArrayWithValidationsInItems1() { - super(new JsonSchemaInfo() - .type(Set.of(List.class)) - .items(Items.class) - .maxItems(2) - ); - } - - public static ArrayWithValidationsInItems1 getInstance() { - if (instance == null) { - instance = new ArrayWithValidationsInItems1(); - } - return instance; - } - - @Override - public ArrayWithValidationsInItemsList getNewInstance(List arg, List pathToItem, PathToSchemasMap pathToSchemas) { - List items = new ArrayList<>(); - int i = 0; - for (Object item: arg) { - List itemPathToItem = new ArrayList<>(pathToItem); - itemPathToItem.add(i); - LinkedHashMap, Nothing?> schemas = pathToSchemas.get(itemPathToItem); - if (schemas == null) { - throw new RuntimeException("Validation 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"); - } - items.add((Number) itemInstance); - i += 1; - } - FrozenList newInstanceItems = new FrozenList<>(items); - return new ArrayWithValidationsInItemsList(newInstanceItems); - } - - 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); - SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().build())); - ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, new PathToSchemasMap(), new LinkedHashSet<>()); - PathToSchemasMap pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet); - return getNewInstance(castArg, validationMetadata.pathToItem(), pathToSchemasMap); - } - - @Override - public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws 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"); - } - @Override - public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { - 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"); - } - @Override - 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 { - 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"); - } - } -} diff --git a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/schemas/Banana.kt b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/schemas/Banana.kt deleted file mode 100644 index 114af31b2aa..00000000000 --- a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/schemas/Banana.kt +++ /dev/null @@ -1,235 +0,0 @@ -package org.openapijsonschematools.client.components.schemas; -import java.util.ArrayList; -import java.util.HashSet; -import java.util.LinkedHashMap; -import java.util.LinkedHashSet; -import java.util.List; -import java.util.Map; -import java.util.Objects; -import java.util.Set; -import org.checkerframework.checker.nullness.qual.Nullable; -import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags; -import org.openapijsonschematools.client.configurations.SchemaConfiguration; -import org.openapijsonschematools.client.exceptions.InvalidAdditionalPropertyException; -import org.openapijsonschematools.client.exceptions.UnsetPropertyException; -import org.openapijsonschematools.client.exceptions.ValidationException; -import org.openapijsonschematools.client.schemas.GenericBuilder; -import org.openapijsonschematools.client.schemas.NumberJsonSchema; -import org.openapijsonschematools.client.schemas.UnsetAddPropsSetter; -import org.openapijsonschematools.client.schemas.validation.FrozenMap; -import org.openapijsonschematools.client.schemas.validation.JsonSchema; -import org.openapijsonschematools.client.schemas.validation.JsonSchemaInfo; -import org.openapijsonschematools.client.schemas.validation.MapSchemaValidator; -import org.openapijsonschematools.client.schemas.validation.PathToSchemasMap; -import org.openapijsonschematools.client.schemas.validation.PropertyEntry; -import org.openapijsonschematools.client.schemas.validation.ValidationMetadata; - -public class Banana { - // nest classes so all schemas and input/output classes can be public - - - public static class LengthCm extends NumberJsonSchema.NumberJsonSchema1 { - private static @Nullable LengthCm instance = null; - public static LengthCm getInstance() { - if (instance == null) { - instance = new LengthCm(); - } - return instance; - } - } - - - public static class BananaMap extends FrozenMap<@Nullable Object> { - protected BananaMap(FrozenMap<@Nullable Object> m) { - super(m); - } - public static final Set requiredKeys = Set.of( - "lengthCm" - ); - public static final Set optionalKeys = Set.of(); - public static BananaMap of(Map arg, SchemaConfiguration configuration) throws ValidationException { - return Banana1.getInstance().validate(arg, configuration); - } - - public Number lengthCm() { - @Nullable Object value = get("lengthCm"); - if (!(value instanceof Number)) { - throw new RuntimeException("Invalid value stored for lengthCm"); - } - return (Number) value; - } - - public @Nullable Object getAdditionalProperty(String name) throws UnsetPropertyException, InvalidAdditionalPropertyException { - throwIfKeyKnown(name, requiredKeys, optionalKeys); - throwIfKeyNotPresent(name); - return get(name); - } - } - - public interface SetterForLengthCm { - Map getInstance(); - T getBuilderAfterLengthCm(Map instance); - - default T lengthCm(int value) { - var instance = getInstance(); - instance.put("lengthCm", value); - return getBuilderAfterLengthCm(instance); - } - - default T lengthCm(float value) { - var instance = getInstance(); - instance.put("lengthCm", value); - return getBuilderAfterLengthCm(instance); - } - - default T lengthCm(long value) { - var instance = getInstance(); - instance.put("lengthCm", value); - return getBuilderAfterLengthCm(instance); - } - - default T lengthCm(double value) { - var instance = getInstance(); - instance.put("lengthCm", value); - return getBuilderAfterLengthCm(instance); - } - } - - public static class BananaMap0Builder extends UnsetAddPropsSetter implements GenericBuilder> { - private final Map instance; - private static final Set knownKeys = Set.of( - "lengthCm" - ); - public Set getKnownKeys() { - return knownKeys; - } - public BananaMap0Builder(Map instance) { - this.instance = instance; - } - public Map build() { - return instance; - } - public Map getInstance() { - return instance; - } - public BananaMap0Builder getBuilderAfterAdditionalProperty(Map instance) { - return this; - } - } - - public static class BananaMapBuilder implements SetterForLengthCm { - private final Map instance; - public BananaMapBuilder() { - this.instance = new LinkedHashMap<>(); - } - public Map getInstance() { - return instance; - } - public BananaMap0Builder getBuilderAfterLengthCm(Map instance) { - return new BananaMap0Builder(instance); - } - } - - - public sealed interface Banana1Boxed permits Banana1BoxedMap { - @Nullable Object getData(); - } - - public record Banana1BoxedMap(BananaMap data) implements Banana1Boxed { - @Override - public @Nullable Object getData() { - return data; - } - } - - - public static class Banana1 extends JsonSchema implements MapSchemaValidator { - /* - NOTE: This class is auto generated by OpenAPI JSON Schema Generator. - Ref: https://github.com/openapi-json-schema-tools/openapi-json-schema-generator - - Do not edit the class manually. - */ - private static @Nullable Banana1 instance = null; - - protected Banana1() { - super(new JsonSchemaInfo() - .type(Set.of(Map.class)) - .properties(Map.ofEntries( - new PropertyEntry("lengthCm", LengthCm.class) - )) - .required(Set.of( - "lengthCm" - )) - ); - } - - public static Banana1 getInstance() { - if (instance == null) { - instance = new Banana1(); - } - return instance; - } - - 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 RuntimeException("Invalid non-string key value"); - } - String propertyName = (String) entryKey; - List propertyPathToItem = new ArrayList<>(pathToItem); - propertyPathToItem.add(propertyName); - Object value = entry.getValue(); - LinkedHashMap, Nothing?> schemas = pathToSchemas.get(propertyPathToItem); - if (schemas == null) { - throw new RuntimeException("Validation result is invalid, schemas must exist for a pathToItem"); - } - JsonSchema propertySchema = schemas.entrySet().iterator().next().getKey(); - @Nullable Object propertyInstance = propertySchema.getNewInstance(value, propertyPathToItem, pathToSchemas); - properties.put(propertyName, propertyInstance); - } - FrozenMap<@Nullable Object> castProperties = new FrozenMap<>(properties); - return new BananaMap(castProperties); - } - - 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); - SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().build())); - ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, new PathToSchemasMap(), new LinkedHashSet<>()); - PathToSchemasMap pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet); - return getNewInstance(castArg, validationMetadata.pathToItem(), pathToSchemasMap); - } - - - @Override - public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws 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"); - } - @Override - public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { - if (arg instanceof Map) { - return getNewInstance((Map) arg, pathToItem, pathToSchemas); - } - 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 { - return new Banana1BoxedMap(validate(arg, configuration)); - } - @Override - public Banana1Boxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { - 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"); - } - } - -} diff --git a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/schemas/BananaReq.kt b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/schemas/BananaReq.kt deleted file mode 100644 index a51291305c7..00000000000 --- a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/schemas/BananaReq.kt +++ /dev/null @@ -1,283 +0,0 @@ -package org.openapijsonschematools.client.components.schemas; -import java.util.ArrayList; -import java.util.HashSet; -import java.util.LinkedHashMap; -import java.util.LinkedHashSet; -import java.util.List; -import java.util.Map; -import java.util.Objects; -import java.util.Set; -import org.checkerframework.checker.nullness.qual.Nullable; -import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags; -import org.openapijsonschematools.client.configurations.SchemaConfiguration; -import org.openapijsonschematools.client.exceptions.UnsetPropertyException; -import org.openapijsonschematools.client.exceptions.ValidationException; -import org.openapijsonschematools.client.schemas.AnyTypeJsonSchema; -import org.openapijsonschematools.client.schemas.BooleanJsonSchema; -import org.openapijsonschematools.client.schemas.GenericBuilder; -import org.openapijsonschematools.client.schemas.NotAnyTypeJsonSchema; -import org.openapijsonschematools.client.schemas.NumberJsonSchema; -import org.openapijsonschematools.client.schemas.validation.FrozenMap; -import org.openapijsonschematools.client.schemas.validation.JsonSchema; -import org.openapijsonschematools.client.schemas.validation.JsonSchemaInfo; -import org.openapijsonschematools.client.schemas.validation.MapSchemaValidator; -import org.openapijsonschematools.client.schemas.validation.MapUtils; -import org.openapijsonschematools.client.schemas.validation.PathToSchemasMap; -import org.openapijsonschematools.client.schemas.validation.PropertyEntry; -import org.openapijsonschematools.client.schemas.validation.ValidationMetadata; - -public class BananaReq { - // nest classes so all schemas and input/output classes can be public - - - public static class AdditionalProperties extends NotAnyTypeJsonSchema.NotAnyTypeJsonSchema1 { - // NotAnyTypeSchema - private static @Nullable AdditionalProperties instance = null; - public static AdditionalProperties getInstance() { - if (instance == null) { - instance = new AdditionalProperties(); - } - return instance; - } - } - - - public static class LengthCm extends NumberJsonSchema.NumberJsonSchema1 { - private static @Nullable LengthCm instance = null; - public static LengthCm getInstance() { - if (instance == null) { - instance = new LengthCm(); - } - return instance; - } - } - - - public static class Sweet extends BooleanJsonSchema.BooleanJsonSchema1 { - private static @Nullable Sweet instance = null; - public static Sweet getInstance() { - if (instance == null) { - instance = new Sweet(); - } - return instance; - } - } - - - public static class BananaReqMap extends FrozenMap { - protected BananaReqMap(FrozenMap m) { - super(m); - } - public static final Set requiredKeys = Set.of( - "lengthCm" - ); - public static final Set optionalKeys = Set.of( - "sweet" - ); - public static BananaReqMap of(Map arg, SchemaConfiguration configuration) throws ValidationException { - return BananaReq1.getInstance().validate(arg, configuration); - } - - public Number lengthCm() { - Object value = get("lengthCm"); - if (!(value instanceof Number)) { - throw new RuntimeException("Invalid value stored for lengthCm"); - } - return (Number) value; - } - - public boolean sweet() throws UnsetPropertyException { - String key = "sweet"; - throwIfKeyNotPresent(key); - Object value = get(key); - if (!(value instanceof Boolean)) { - throw new RuntimeException("Invalid value stored for sweet"); - } - return (boolean) value; - } - } - - public interface SetterForLengthCm { - Map getInstance(); - T getBuilderAfterLengthCm(Map instance); - - default T lengthCm(int value) { - var instance = getInstance(); - instance.put("lengthCm", value); - return getBuilderAfterLengthCm(instance); - } - - default T lengthCm(float value) { - var instance = getInstance(); - instance.put("lengthCm", value); - return getBuilderAfterLengthCm(instance); - } - - default T lengthCm(long value) { - var instance = getInstance(); - instance.put("lengthCm", value); - return getBuilderAfterLengthCm(instance); - } - - default T lengthCm(double value) { - var instance = getInstance(); - instance.put("lengthCm", value); - return getBuilderAfterLengthCm(instance); - } - } - - public interface SetterForSweet { - Map getInstance(); - T getBuilderAfterSweet(Map instance); - - default T sweet(boolean value) { - var instance = getInstance(); - instance.put("sweet", value); - return getBuilderAfterSweet(instance); - } - } - - public static class BananaReqMap0Builder implements GenericBuilder>, SetterForSweet { - private final Map instance; - private static final Set knownKeys = Set.of( - "lengthCm", - "sweet" - ); - public Set getKnownKeys() { - return knownKeys; - } - public BananaReqMap0Builder(Map instance) { - this.instance = instance; - } - public Map build() { - return instance; - } - public Map getInstance() { - return instance; - } - public BananaReqMap0Builder getBuilderAfterSweet(Map instance) { - return this; - } - } - - public static class BananaReqMapBuilder implements SetterForLengthCm { - private final Map instance; - public BananaReqMapBuilder() { - this.instance = new LinkedHashMap<>(); - } - public Map getInstance() { - return instance; - } - public BananaReqMap0Builder getBuilderAfterLengthCm(Map instance) { - return new BananaReqMap0Builder(instance); - } - } - - - public sealed interface BananaReq1Boxed permits BananaReq1BoxedMap { - @Nullable Object getData(); - } - - public record BananaReq1BoxedMap(BananaReqMap data) implements BananaReq1Boxed { - @Override - public @Nullable Object getData() { - return data; - } - } - - - public static class BananaReq1 extends JsonSchema implements MapSchemaValidator { - /* - NOTE: This class is auto generated by OpenAPI JSON Schema Generator. - Ref: https://github.com/openapi-json-schema-tools/openapi-json-schema-generator - - Do not edit the class manually. - */ - private static @Nullable BananaReq1 instance = null; - - protected BananaReq1() { - super(new JsonSchemaInfo() - .type(Set.of(Map.class)) - .properties(Map.ofEntries( - new PropertyEntry("lengthCm", LengthCm.class), - new PropertyEntry("sweet", Sweet.class) - )) - .required(Set.of( - "lengthCm" - )) - .additionalProperties(AdditionalProperties.class) - ); - } - - public static BananaReq1 getInstance() { - if (instance == null) { - instance = new BananaReq1(); - } - return instance; - } - - 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 RuntimeException("Invalid non-string key value"); - } - String propertyName = (String) entryKey; - List propertyPathToItem = new ArrayList<>(pathToItem); - propertyPathToItem.add(propertyName); - Object value = entry.getValue(); - LinkedHashMap, Nothing?> schemas = pathToSchemas.get(propertyPathToItem); - if (schemas == null) { - throw new RuntimeException("Validation 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"); - } - properties.put(propertyName, (Object) propertyInstance); - } - FrozenMap castProperties = new FrozenMap<>(properties); - return new BananaReqMap(castProperties); - } - - 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); - SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().build())); - ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, new PathToSchemasMap(), new LinkedHashSet<>()); - PathToSchemasMap pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet); - return getNewInstance(castArg, validationMetadata.pathToItem(), pathToSchemasMap); - } - - - @Override - public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws 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"); - } - @Override - public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { - if (arg instanceof Map) { - return getNewInstance((Map) arg, pathToItem, pathToSchemas); - } - 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 { - return new BananaReq1BoxedMap(validate(arg, configuration)); - } - @Override - public BananaReq1Boxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { - 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"); - } - } - -} diff --git a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/schemas/Bar.kt b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/schemas/Bar.kt deleted file mode 100644 index 72288a40e46..00000000000 --- a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/schemas/Bar.kt +++ /dev/null @@ -1,103 +0,0 @@ -package org.openapijsonschematools.client.components.schemas; -import java.util.HashSet; -import java.util.LinkedHashSet; -import java.util.List; -import java.util.Objects; -import java.util.Set; -import org.checkerframework.checker.nullness.qual.Nullable; -import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags; -import org.openapijsonschematools.client.configurations.SchemaConfiguration; -import org.openapijsonschematools.client.exceptions.ValidationException; -import org.openapijsonschematools.client.schemas.validation.DefaultValueMethod; -import org.openapijsonschematools.client.schemas.validation.JsonSchema; -import org.openapijsonschematools.client.schemas.validation.JsonSchemaInfo; -import org.openapijsonschematools.client.schemas.validation.PathToSchemasMap; -import org.openapijsonschematools.client.schemas.validation.StringSchemaValidator; -import org.openapijsonschematools.client.schemas.validation.ValidationMetadata; - -public class Bar { - // nest classes so all schemas and input/output classes can be public - - - public sealed interface Bar1Boxed permits Bar1BoxedString { - @Nullable Object getData(); - } - - public record Bar1BoxedString(String data) implements Bar1Boxed { - @Override - public @Nullable Object getData() { - return data; - } - } - - - - public static class Bar1 extends JsonSchema implements StringSchemaValidator, DefaultValueMethod { - /* - NOTE: This class is auto generated by OpenAPI JSON Schema Generator. - Ref: https://github.com/openapi-json-schema-tools/openapi-json-schema-generator - - Do not edit the class manually. - */ - private static @Nullable Bar1 instance = null; - - protected Bar1() { - super(new JsonSchemaInfo() - .type(Set.of( - String.class - )) - .defaultValue("bar") - ); - } - - public static Bar1 getInstance() { - if (instance == null) { - instance = new Bar1(); - } - return instance; - } - - @Override - public String validate(String arg, SchemaConfiguration configuration) throws ValidationException { - Set> pathSet = new HashSet<>(); - List pathToItem = List.of("args[0"); - String castArg = castToAllowedTypes(arg, pathToItem, pathSet); - SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().build())); - ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, new PathToSchemasMap(), new LinkedHashSet<>()); - getPathToSchemas(this, castArg, validationMetadata, pathSet); - return castArg; - } - - @Override - public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws 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"); - } - @Override - public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { - 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"); - } - public String defaultValue() throws ValidationException { - if (defaultValue instanceof String) { - return (String) defaultValue; - } - throw new ValidationException("Invalid type stored in defaultValue"); - } - @Override - 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 { - 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"); - } - } -} diff --git a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/schemas/BasquePig.kt b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/schemas/BasquePig.kt deleted file mode 100644 index a3a584e7d3f..00000000000 --- a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/schemas/BasquePig.kt +++ /dev/null @@ -1,304 +0,0 @@ -package org.openapijsonschematools.client.components.schemas; -import java.util.ArrayList; -import java.util.HashSet; -import java.util.LinkedHashMap; -import java.util.LinkedHashSet; -import java.util.List; -import java.util.Map; -import java.util.Objects; -import java.util.Set; -import org.checkerframework.checker.nullness.qual.Nullable; -import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags; -import org.openapijsonschematools.client.configurations.SchemaConfiguration; -import org.openapijsonschematools.client.exceptions.InvalidAdditionalPropertyException; -import org.openapijsonschematools.client.exceptions.UnsetPropertyException; -import org.openapijsonschematools.client.exceptions.ValidationException; -import org.openapijsonschematools.client.schemas.GenericBuilder; -import org.openapijsonschematools.client.schemas.SetMaker; -import org.openapijsonschematools.client.schemas.UnsetAddPropsSetter; -import org.openapijsonschematools.client.schemas.validation.FrozenMap; -import org.openapijsonschematools.client.schemas.validation.JsonSchema; -import org.openapijsonschematools.client.schemas.validation.JsonSchemaInfo; -import org.openapijsonschematools.client.schemas.validation.MapSchemaValidator; -import org.openapijsonschematools.client.schemas.validation.PathToSchemasMap; -import org.openapijsonschematools.client.schemas.validation.PropertyEntry; -import org.openapijsonschematools.client.schemas.validation.StringEnumValidator; -import org.openapijsonschematools.client.schemas.validation.StringSchemaValidator; -import org.openapijsonschematools.client.schemas.validation.StringValueMethod; -import org.openapijsonschematools.client.schemas.validation.ValidationMetadata; - -public class BasquePig { - // nest classes so all schemas and input/output classes can be public - - public enum StringClassNameEnums implements StringValueMethod { - BASQUE_PIG("BasquePig"); - private final String value; - - StringClassNameEnums(String value) { - this.value = value; - } - public String value() { - return this.value; - } - } - - - public sealed interface ClassNameBoxed permits ClassNameBoxedString { - @Nullable Object getData(); - } - - public record ClassNameBoxedString(String data) implements ClassNameBoxed { - @Override - public @Nullable Object getData() { - return data; - } - } - - - - public static class ClassName extends JsonSchema implements StringSchemaValidator, StringEnumValidator { - private static @Nullable ClassName instance = null; - - protected ClassName() { - super(new JsonSchemaInfo() - .type(Set.of( - String.class - )) - .enumValues(SetMaker.makeSet( - "BasquePig" - )) - ); - } - - public static ClassName getInstance() { - if (instance == null) { - instance = new ClassName(); - } - return instance; - } - - @Override - public String validate(String arg, SchemaConfiguration configuration) throws ValidationException { - Set> pathSet = new HashSet<>(); - List pathToItem = List.of("args[0"); - String castArg = castToAllowedTypes(arg, pathToItem, pathSet); - SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().build())); - ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, new PathToSchemasMap(), new LinkedHashSet<>()); - getPathToSchemas(this, castArg, validationMetadata, pathSet); - return castArg; - } - - @Override - 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 { - 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"); - } - @Override - public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { - 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"); - } - @Override - 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 { - 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"); - } - } - - public static class BasquePigMap extends FrozenMap<@Nullable Object> { - protected BasquePigMap(FrozenMap<@Nullable Object> m) { - super(m); - } - public static final Set requiredKeys = Set.of( - "className" - ); - public static final Set optionalKeys = Set.of(); - public static BasquePigMap of(Map arg, SchemaConfiguration configuration) throws ValidationException { - return BasquePig1.getInstance().validate(arg, configuration); - } - - public String className() { - @Nullable Object value = get("className"); - if (!(value instanceof String)) { - throw new RuntimeException("Invalid value stored for className"); - } - return (String) value; - } - - public @Nullable Object getAdditionalProperty(String name) throws UnsetPropertyException, InvalidAdditionalPropertyException { - throwIfKeyKnown(name, requiredKeys, optionalKeys); - throwIfKeyNotPresent(name); - return get(name); - } - } - - public interface SetterForClassName { - Map getInstance(); - T getBuilderAfterClassName(Map instance); - - default T className(String value) { - var instance = getInstance(); - instance.put("className", value); - return getBuilderAfterClassName(instance); - } - - default T className(StringClassNameEnums value) { - var instance = getInstance(); - instance.put("className", value.value()); - return getBuilderAfterClassName(instance); - } - } - - public static class BasquePigMap0Builder extends UnsetAddPropsSetter implements GenericBuilder> { - private final Map instance; - private static final Set knownKeys = Set.of( - "className" - ); - public Set getKnownKeys() { - return knownKeys; - } - public BasquePigMap0Builder(Map instance) { - this.instance = instance; - } - public Map build() { - return instance; - } - public Map getInstance() { - return instance; - } - public BasquePigMap0Builder getBuilderAfterAdditionalProperty(Map instance) { - return this; - } - } - - public static class BasquePigMapBuilder implements SetterForClassName { - private final Map instance; - public BasquePigMapBuilder() { - this.instance = new LinkedHashMap<>(); - } - public Map getInstance() { - return instance; - } - public BasquePigMap0Builder getBuilderAfterClassName(Map instance) { - return new BasquePigMap0Builder(instance); - } - } - - - public sealed interface BasquePig1Boxed permits BasquePig1BoxedMap { - @Nullable Object getData(); - } - - public record BasquePig1BoxedMap(BasquePigMap data) implements BasquePig1Boxed { - @Override - public @Nullable Object getData() { - return data; - } - } - - - public static class BasquePig1 extends JsonSchema implements MapSchemaValidator { - /* - NOTE: This class is auto generated by OpenAPI JSON Schema Generator. - Ref: https://github.com/openapi-json-schema-tools/openapi-json-schema-generator - - Do not edit the class manually. - */ - private static @Nullable BasquePig1 instance = null; - - protected BasquePig1() { - super(new JsonSchemaInfo() - .type(Set.of(Map.class)) - .properties(Map.ofEntries( - new PropertyEntry("className", ClassName.class) - )) - .required(Set.of( - "className" - )) - ); - } - - public static BasquePig1 getInstance() { - if (instance == null) { - instance = new BasquePig1(); - } - return instance; - } - - 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 RuntimeException("Invalid non-string key value"); - } - String propertyName = (String) entryKey; - List propertyPathToItem = new ArrayList<>(pathToItem); - propertyPathToItem.add(propertyName); - Object value = entry.getValue(); - LinkedHashMap, Nothing?> schemas = pathToSchemas.get(propertyPathToItem); - if (schemas == null) { - throw new RuntimeException("Validation result is invalid, schemas must exist for a pathToItem"); - } - JsonSchema propertySchema = schemas.entrySet().iterator().next().getKey(); - @Nullable Object propertyInstance = propertySchema.getNewInstance(value, propertyPathToItem, pathToSchemas); - properties.put(propertyName, propertyInstance); - } - FrozenMap<@Nullable Object> castProperties = new FrozenMap<>(properties); - return new BasquePigMap(castProperties); - } - - 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); - SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().build())); - ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, new PathToSchemasMap(), new LinkedHashSet<>()); - PathToSchemasMap pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet); - return getNewInstance(castArg, validationMetadata.pathToItem(), pathToSchemasMap); - } - - - @Override - public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws 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"); - } - @Override - public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { - if (arg instanceof Map) { - return getNewInstance((Map) arg, pathToItem, pathToSchemas); - } - 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 { - return new BasquePig1BoxedMap(validate(arg, configuration)); - } - @Override - public BasquePig1Boxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { - 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"); - } - } - -} diff --git a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/schemas/BooleanEnum.kt b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/schemas/BooleanEnum.kt deleted file mode 100644 index 02c9acce67a..00000000000 --- a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/schemas/BooleanEnum.kt +++ /dev/null @@ -1,119 +0,0 @@ -package org.openapijsonschematools.client.components.schemas; -import java.util.HashSet; -import java.util.LinkedHashSet; -import java.util.List; -import java.util.Objects; -import java.util.Set; -import org.checkerframework.checker.nullness.qual.Nullable; -import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags; -import org.openapijsonschematools.client.configurations.SchemaConfiguration; -import org.openapijsonschematools.client.exceptions.ValidationException; -import org.openapijsonschematools.client.schemas.SetMaker; -import org.openapijsonschematools.client.schemas.validation.BooleanEnumValidator; -import org.openapijsonschematools.client.schemas.validation.BooleanSchemaValidator; -import org.openapijsonschematools.client.schemas.validation.BooleanValueMethod; -import org.openapijsonschematools.client.schemas.validation.JsonSchema; -import org.openapijsonschematools.client.schemas.validation.JsonSchemaInfo; -import org.openapijsonschematools.client.schemas.validation.PathToSchemasMap; -import org.openapijsonschematools.client.schemas.validation.ValidationMetadata; - -public class BooleanEnum { - // nest classes so all schemas and input/output classes can be public - - public enum BooleanBooleanEnumEnums implements BooleanValueMethod { - TRUE(true); - private final boolean value; - - BooleanBooleanEnumEnums(boolean value) { - this.value = value; - } - public boolean value() { - return this.value; - } - } - - - public sealed interface BooleanEnum1Boxed permits BooleanEnum1BoxedBoolean { - @Nullable Object getData(); - } - - public record BooleanEnum1BoxedBoolean(boolean data) implements BooleanEnum1Boxed { - @Override - public @Nullable Object getData() { - return data; - } - } - - - - public static class BooleanEnum1 extends JsonSchema implements BooleanSchemaValidator, BooleanEnumValidator { - /* - NOTE: This class is auto generated by OpenAPI JSON Schema Generator. - Ref: https://github.com/openapi-json-schema-tools/openapi-json-schema-generator - - Do not edit the class manually. - */ - private static @Nullable BooleanEnum1 instance = null; - - protected BooleanEnum1() { - super(new JsonSchemaInfo() - .type(Set.of(Boolean.class)) - .enumValues(SetMaker.makeSet( - true - )) - ); - } - - public static BooleanEnum1 getInstance() { - if (instance == null) { - instance = new BooleanEnum1(); - } - return instance; - } - - @Override - public boolean validate(boolean arg, SchemaConfiguration configuration) throws ValidationException { - Set> pathSet = new HashSet<>(); - List pathToItem = List.of("args[0"); - boolean castArg = castToAllowedTypes(arg, pathToItem, pathSet); - SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().build())); - ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, new PathToSchemasMap(), new LinkedHashSet<>()); - getPathToSchemas(this, castArg, validationMetadata, pathSet); - return castArg; - } - - @Override - 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 { - 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"); - } - @Override - 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 RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); - } - @Override - 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 { - 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"); - } - } -} diff --git a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/schemas/BooleanSchema.kt b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/schemas/BooleanSchema.kt deleted file mode 100644 index 8253de14589..00000000000 --- a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/schemas/BooleanSchema.kt +++ /dev/null @@ -1,19 +0,0 @@ -package org.openapijsonschematools.client.components.schemas; -import org.checkerframework.checker.nullness.qual.Nullable; -import org.openapijsonschematools.client.schemas.BooleanJsonSchema; - -public class BooleanSchema extends BooleanJsonSchema { - // nest classes so all schemas and input/output classes can be public - - - public static class BooleanSchema1 extends BooleanJsonSchema.BooleanJsonSchema1 { - private static @Nullable BooleanSchema1 instance = null; - public static BooleanSchema1 getInstance() { - if (instance == null) { - instance = new BooleanSchema1(); - } - return instance; - } - } - -} diff --git a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/schemas/Capitalization.kt b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/schemas/Capitalization.kt deleted file mode 100644 index d080f6df578..00000000000 --- a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/schemas/Capitalization.kt +++ /dev/null @@ -1,396 +0,0 @@ -package org.openapijsonschematools.client.components.schemas; -import java.util.ArrayList; -import java.util.HashSet; -import java.util.LinkedHashMap; -import java.util.LinkedHashSet; -import java.util.List; -import java.util.Map; -import java.util.Objects; -import java.util.Set; -import org.checkerframework.checker.nullness.qual.Nullable; -import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags; -import org.openapijsonschematools.client.configurations.SchemaConfiguration; -import org.openapijsonschematools.client.exceptions.InvalidAdditionalPropertyException; -import org.openapijsonschematools.client.exceptions.UnsetPropertyException; -import org.openapijsonschematools.client.exceptions.ValidationException; -import org.openapijsonschematools.client.schemas.GenericBuilder; -import org.openapijsonschematools.client.schemas.StringJsonSchema; -import org.openapijsonschematools.client.schemas.UnsetAddPropsSetter; -import org.openapijsonschematools.client.schemas.validation.FrozenMap; -import org.openapijsonschematools.client.schemas.validation.JsonSchema; -import org.openapijsonschematools.client.schemas.validation.JsonSchemaInfo; -import org.openapijsonschematools.client.schemas.validation.MapSchemaValidator; -import org.openapijsonschematools.client.schemas.validation.PathToSchemasMap; -import org.openapijsonschematools.client.schemas.validation.PropertyEntry; -import org.openapijsonschematools.client.schemas.validation.ValidationMetadata; - -public class Capitalization { - // nest classes so all schemas and input/output classes can be public - - - public static class SmallCamel extends StringJsonSchema.StringJsonSchema1 { - private static @Nullable SmallCamel instance = null; - public static SmallCamel getInstance() { - if (instance == null) { - instance = new SmallCamel(); - } - return instance; - } - } - - - public static class CapitalCamel extends StringJsonSchema.StringJsonSchema1 { - private static @Nullable CapitalCamel instance = null; - public static CapitalCamel getInstance() { - if (instance == null) { - instance = new CapitalCamel(); - } - return instance; - } - } - - - public static class SmallSnake extends StringJsonSchema.StringJsonSchema1 { - private static @Nullable SmallSnake instance = null; - public static SmallSnake getInstance() { - if (instance == null) { - instance = new SmallSnake(); - } - return instance; - } - } - - - public static class CapitalSnake extends StringJsonSchema.StringJsonSchema1 { - private static @Nullable CapitalSnake instance = null; - public static CapitalSnake getInstance() { - if (instance == null) { - instance = new CapitalSnake(); - } - return instance; - } - } - - - public static class SCAETHFlowPoints extends StringJsonSchema.StringJsonSchema1 { - private static @Nullable SCAETHFlowPoints instance = null; - public static SCAETHFlowPoints getInstance() { - if (instance == null) { - instance = new SCAETHFlowPoints(); - } - return instance; - } - } - - - public static class ATTNAME extends StringJsonSchema.StringJsonSchema1 { - private static @Nullable ATTNAME instance = null; - public static ATTNAME getInstance() { - if (instance == null) { - instance = new ATTNAME(); - } - return instance; - } - } - - - public static class CapitalizationMap extends FrozenMap<@Nullable Object> { - protected CapitalizationMap(FrozenMap<@Nullable Object> m) { - super(m); - } - public static final Set requiredKeys = Set.of(); - public static final Set optionalKeys = Set.of( - "smallCamel", - "CapitalCamel", - "small_Snake", - "Capital_Snake", - "SCA_ETH_Flow_Points", - "ATT_NAME" - ); - public static CapitalizationMap of(Map arg, SchemaConfiguration configuration) throws ValidationException { - return Capitalization1.getInstance().validate(arg, configuration); - } - - public String smallCamel() throws UnsetPropertyException { - String key = "smallCamel"; - throwIfKeyNotPresent(key); - @Nullable Object value = get(key); - if (!(value instanceof String)) { - throw new RuntimeException("Invalid value stored for smallCamel"); - } - return (String) value; - } - - public String CapitalCamel() throws UnsetPropertyException { - String key = "CapitalCamel"; - throwIfKeyNotPresent(key); - @Nullable Object value = get(key); - if (!(value instanceof String)) { - throw new RuntimeException("Invalid value stored for CapitalCamel"); - } - return (String) value; - } - - public String small_Snake() throws UnsetPropertyException { - String key = "small_Snake"; - throwIfKeyNotPresent(key); - @Nullable Object value = get(key); - if (!(value instanceof String)) { - throw new RuntimeException("Invalid value stored for small_Snake"); - } - return (String) value; - } - - public String Capital_Snake() throws UnsetPropertyException { - String key = "Capital_Snake"; - throwIfKeyNotPresent(key); - @Nullable Object value = get(key); - if (!(value instanceof String)) { - throw new RuntimeException("Invalid value stored for Capital_Snake"); - } - return (String) value; - } - - public String SCA_ETH_Flow_Points() throws UnsetPropertyException { - String key = "SCA_ETH_Flow_Points"; - throwIfKeyNotPresent(key); - @Nullable Object value = get(key); - if (!(value instanceof String)) { - throw new RuntimeException("Invalid value stored for SCA_ETH_Flow_Points"); - } - return (String) value; - } - - public String ATT_NAME() throws UnsetPropertyException { - String key = "ATT_NAME"; - throwIfKeyNotPresent(key); - @Nullable Object value = get(key); - if (!(value instanceof String)) { - throw new RuntimeException("Invalid value stored for ATT_NAME"); - } - return (String) value; - } - - public @Nullable Object getAdditionalProperty(String name) throws UnsetPropertyException, InvalidAdditionalPropertyException { - throwIfKeyKnown(name, requiredKeys, optionalKeys); - throwIfKeyNotPresent(name); - return get(name); - } - } - - public interface SetterForSmallCamel { - Map getInstance(); - T getBuilderAfterSmallCamel(Map instance); - - default T smallCamel(String value) { - var instance = getInstance(); - instance.put("smallCamel", value); - return getBuilderAfterSmallCamel(instance); - } - } - - public interface SetterForCapitalCamel { - Map getInstance(); - T getBuilderAfterCapitalCamel(Map instance); - - default T CapitalCamel(String value) { - var instance = getInstance(); - instance.put("CapitalCamel", value); - return getBuilderAfterCapitalCamel(instance); - } - } - - public interface SetterForSmallSnake { - Map getInstance(); - T getBuilderAfterSmallSnake(Map instance); - - default T small_Snake(String value) { - var instance = getInstance(); - instance.put("small_Snake", value); - return getBuilderAfterSmallSnake(instance); - } - } - - public interface SetterForCapitalSnake { - Map getInstance(); - T getBuilderAfterCapitalSnake(Map instance); - - default T Capital_Snake(String value) { - var instance = getInstance(); - instance.put("Capital_Snake", value); - return getBuilderAfterCapitalSnake(instance); - } - } - - public interface SetterForSCAETHFlowPoints { - Map getInstance(); - T getBuilderAfterSCAETHFlowPoints(Map instance); - - default T SCA_ETH_Flow_Points(String value) { - var instance = getInstance(); - instance.put("SCA_ETH_Flow_Points", value); - return getBuilderAfterSCAETHFlowPoints(instance); - } - } - - public interface SetterForATTNAME { - Map getInstance(); - T getBuilderAfterATTNAME(Map instance); - - default T ATT_NAME(String value) { - var instance = getInstance(); - instance.put("ATT_NAME", value); - return getBuilderAfterATTNAME(instance); - } - } - - public static class CapitalizationMapBuilder extends UnsetAddPropsSetter implements GenericBuilder>, SetterForSmallCamel, SetterForCapitalCamel, SetterForSmallSnake, SetterForCapitalSnake, SetterForSCAETHFlowPoints, SetterForATTNAME { - private final Map instance; - private static final Set knownKeys = Set.of( - "smallCamel", - "CapitalCamel", - "small_Snake", - "Capital_Snake", - "SCA_ETH_Flow_Points", - "ATT_NAME" - ); - public Set getKnownKeys() { - return knownKeys; - } - public CapitalizationMapBuilder() { - this.instance = new LinkedHashMap<>(); - } - public Map build() { - return instance; - } - public Map getInstance() { - return instance; - } - public CapitalizationMapBuilder getBuilderAfterSmallCamel(Map instance) { - return this; - } - public CapitalizationMapBuilder getBuilderAfterCapitalCamel(Map instance) { - return this; - } - public CapitalizationMapBuilder getBuilderAfterSmallSnake(Map instance) { - return this; - } - public CapitalizationMapBuilder getBuilderAfterCapitalSnake(Map instance) { - return this; - } - public CapitalizationMapBuilder getBuilderAfterSCAETHFlowPoints(Map instance) { - return this; - } - public CapitalizationMapBuilder getBuilderAfterATTNAME(Map instance) { - return this; - } - public CapitalizationMapBuilder getBuilderAfterAdditionalProperty(Map instance) { - return this; - } - } - - - public sealed interface Capitalization1Boxed permits Capitalization1BoxedMap { - @Nullable Object getData(); - } - - public record Capitalization1BoxedMap(CapitalizationMap data) implements Capitalization1Boxed { - @Override - public @Nullable Object getData() { - return data; - } - } - - - public static class Capitalization1 extends JsonSchema implements MapSchemaValidator { - /* - NOTE: This class is auto generated by OpenAPI JSON Schema Generator. - Ref: https://github.com/openapi-json-schema-tools/openapi-json-schema-generator - - Do not edit the class manually. - */ - private static @Nullable Capitalization1 instance = null; - - protected Capitalization1() { - super(new JsonSchemaInfo() - .type(Set.of(Map.class)) - .properties(Map.ofEntries( - new PropertyEntry("smallCamel", SmallCamel.class), - new PropertyEntry("CapitalCamel", CapitalCamel.class), - new PropertyEntry("small_Snake", SmallSnake.class), - new PropertyEntry("Capital_Snake", CapitalSnake.class), - new PropertyEntry("SCA_ETH_Flow_Points", SCAETHFlowPoints.class), - new PropertyEntry("ATT_NAME", ATTNAME.class) - )) - ); - } - - public static Capitalization1 getInstance() { - if (instance == null) { - instance = new Capitalization1(); - } - return instance; - } - - 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 RuntimeException("Invalid non-string key value"); - } - String propertyName = (String) entryKey; - List propertyPathToItem = new ArrayList<>(pathToItem); - propertyPathToItem.add(propertyName); - Object value = entry.getValue(); - LinkedHashMap, Nothing?> schemas = pathToSchemas.get(propertyPathToItem); - if (schemas == null) { - throw new RuntimeException("Validation result is invalid, schemas must exist for a pathToItem"); - } - JsonSchema propertySchema = schemas.entrySet().iterator().next().getKey(); - @Nullable Object propertyInstance = propertySchema.getNewInstance(value, propertyPathToItem, pathToSchemas); - properties.put(propertyName, propertyInstance); - } - FrozenMap<@Nullable Object> castProperties = new FrozenMap<>(properties); - return new CapitalizationMap(castProperties); - } - - 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); - SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().build())); - ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, new PathToSchemasMap(), new LinkedHashSet<>()); - PathToSchemasMap pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet); - return getNewInstance(castArg, validationMetadata.pathToItem(), pathToSchemasMap); - } - - - @Override - public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws 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"); - } - @Override - public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { - if (arg instanceof Map) { - return getNewInstance((Map) arg, pathToItem, pathToSchemas); - } - 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 { - return new Capitalization1BoxedMap(validate(arg, configuration)); - } - @Override - public Capitalization1Boxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { - 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"); - } - } - -} diff --git a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/schemas/Cat.kt b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/schemas/Cat.kt deleted file mode 100644 index 8d72279c906..00000000000 --- a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/schemas/Cat.kt +++ /dev/null @@ -1,503 +0,0 @@ -package org.openapijsonschematools.client.components.schemas; -import java.time.LocalDate; -import java.time.ZonedDateTime; -import java.util.ArrayList; -import java.util.HashSet; -import java.util.LinkedHashMap; -import java.util.LinkedHashSet; -import java.util.List; -import java.util.Map; -import java.util.Objects; -import java.util.Set; -import java.util.UUID; -import org.checkerframework.checker.nullness.qual.Nullable; -import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags; -import org.openapijsonschematools.client.configurations.SchemaConfiguration; -import org.openapijsonschematools.client.exceptions.InvalidAdditionalPropertyException; -import org.openapijsonschematools.client.exceptions.UnsetPropertyException; -import org.openapijsonschematools.client.exceptions.ValidationException; -import org.openapijsonschematools.client.schemas.BooleanJsonSchema; -import org.openapijsonschematools.client.schemas.GenericBuilder; -import org.openapijsonschematools.client.schemas.UnsetAddPropsSetter; -import org.openapijsonschematools.client.schemas.validation.BooleanSchemaValidator; -import org.openapijsonschematools.client.schemas.validation.FrozenList; -import org.openapijsonschematools.client.schemas.validation.FrozenMap; -import org.openapijsonschematools.client.schemas.validation.JsonSchema; -import org.openapijsonschematools.client.schemas.validation.JsonSchemaInfo; -import org.openapijsonschematools.client.schemas.validation.ListSchemaValidator; -import org.openapijsonschematools.client.schemas.validation.MapSchemaValidator; -import org.openapijsonschematools.client.schemas.validation.NullSchemaValidator; -import org.openapijsonschematools.client.schemas.validation.NumberSchemaValidator; -import org.openapijsonschematools.client.schemas.validation.PathToSchemasMap; -import org.openapijsonschematools.client.schemas.validation.PropertyEntry; -import org.openapijsonschematools.client.schemas.validation.StringSchemaValidator; -import org.openapijsonschematools.client.schemas.validation.ValidationMetadata; - -public class Cat { - // nest classes so all schemas and input/output classes can be public - - - public static class Declawed extends BooleanJsonSchema.BooleanJsonSchema1 { - private static @Nullable Declawed instance = null; - public static Declawed getInstance() { - if (instance == null) { - instance = new Declawed(); - } - return instance; - } - } - - - public static class Schema1Map extends FrozenMap<@Nullable Object> { - protected Schema1Map(FrozenMap<@Nullable Object> m) { - super(m); - } - public static final Set requiredKeys = Set.of(); - public static final Set optionalKeys = Set.of( - "declawed" - ); - public static Schema1Map of(Map arg, SchemaConfiguration configuration) throws ValidationException { - return Schema1.getInstance().validate(arg, configuration); - } - - public boolean declawed() throws UnsetPropertyException { - String key = "declawed"; - throwIfKeyNotPresent(key); - @Nullable Object value = get(key); - if (!(value instanceof Boolean)) { - throw new RuntimeException("Invalid value stored for declawed"); - } - return (boolean) value; - } - - public @Nullable Object getAdditionalProperty(String name) throws UnsetPropertyException, InvalidAdditionalPropertyException { - throwIfKeyKnown(name, requiredKeys, optionalKeys); - throwIfKeyNotPresent(name); - return get(name); - } - } - - public interface SetterForDeclawed { - Map getInstance(); - T getBuilderAfterDeclawed(Map instance); - - default T declawed(boolean value) { - var instance = getInstance(); - instance.put("declawed", value); - return getBuilderAfterDeclawed(instance); - } - } - - public static class Schema1MapBuilder extends UnsetAddPropsSetter implements GenericBuilder>, SetterForDeclawed { - private final Map instance; - private static final Set knownKeys = Set.of( - "declawed" - ); - public Set getKnownKeys() { - return knownKeys; - } - public Schema1MapBuilder() { - this.instance = new LinkedHashMap<>(); - } - public Map build() { - return instance; - } - public Map getInstance() { - return instance; - } - public Schema1MapBuilder getBuilderAfterDeclawed(Map instance) { - return this; - } - public Schema1MapBuilder getBuilderAfterAdditionalProperty(Map instance) { - return this; - } - } - - - public sealed interface Schema1Boxed permits Schema1BoxedMap { - @Nullable Object getData(); - } - - public record Schema1BoxedMap(Schema1Map data) implements Schema1Boxed { - @Override - public @Nullable Object getData() { - return data; - } - } - - - public static class Schema1 extends JsonSchema implements MapSchemaValidator { - private static @Nullable Schema1 instance = null; - - protected Schema1() { - super(new JsonSchemaInfo() - .type(Set.of(Map.class)) - .properties(Map.ofEntries( - new PropertyEntry("declawed", Declawed.class) - )) - ); - } - - public static Schema1 getInstance() { - if (instance == null) { - instance = new Schema1(); - } - return instance; - } - - 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 RuntimeException("Invalid non-string key value"); - } - String propertyName = (String) entryKey; - List propertyPathToItem = new ArrayList<>(pathToItem); - propertyPathToItem.add(propertyName); - Object value = entry.getValue(); - LinkedHashMap, Nothing?> schemas = pathToSchemas.get(propertyPathToItem); - if (schemas == null) { - throw new RuntimeException("Validation result is invalid, schemas must exist for a pathToItem"); - } - JsonSchema propertySchema = schemas.entrySet().iterator().next().getKey(); - @Nullable Object propertyInstance = propertySchema.getNewInstance(value, propertyPathToItem, pathToSchemas); - properties.put(propertyName, propertyInstance); - } - FrozenMap<@Nullable Object> castProperties = new FrozenMap<>(properties); - return new Schema1Map(castProperties); - } - - 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); - SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().build())); - ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, new PathToSchemasMap(), new LinkedHashSet<>()); - PathToSchemasMap pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet); - return getNewInstance(castArg, validationMetadata.pathToItem(), pathToSchemasMap); - } - - - @Override - public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws 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"); - } - @Override - public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { - if (arg instanceof Map) { - return getNewInstance((Map) arg, pathToItem, pathToSchemas); - } - 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 { - return new Schema1BoxedMap(validate(arg, configuration)); - } - @Override - public Schema1Boxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { - 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"); - } - } - - - public sealed interface Cat1Boxed permits Cat1BoxedVoid, Cat1BoxedBoolean, Cat1BoxedNumber, Cat1BoxedString, Cat1BoxedList, Cat1BoxedMap { - @Nullable Object getData(); - } - - public record Cat1BoxedVoid(Nothing? data) implements Cat1Boxed { - @Override - public @Nullable Object getData() { - return data; - } - } - - public record Cat1BoxedBoolean(boolean data) implements Cat1Boxed { - @Override - public @Nullable Object getData() { - return data; - } - } - - public record Cat1BoxedNumber(Number data) implements Cat1Boxed { - @Override - public @Nullable Object getData() { - return data; - } - } - - public record Cat1BoxedString(String data) implements Cat1Boxed { - @Override - public @Nullable Object getData() { - return data; - } - } - - public record Cat1BoxedList(FrozenList<@Nullable Object> data) implements Cat1Boxed { - @Override - public @Nullable Object getData() { - return data; - } - } - - public record Cat1BoxedMap(FrozenMap<@Nullable Object> data) implements Cat1Boxed { - @Override - public @Nullable Object getData() { - return data; - } - } - - - public static class Cat1 extends JsonSchema implements NullSchemaValidator, BooleanSchemaValidator, NumberSchemaValidator, StringSchemaValidator, ListSchemaValidator, Cat1BoxedList>, MapSchemaValidator, Cat1BoxedMap> { - /* - NOTE: This class is auto generated by OpenAPI JSON Schema Generator. - Ref: https://github.com/openapi-json-schema-tools/openapi-json-schema-generator - - Do not edit the class manually. - */ - private static @Nullable Cat1 instance = null; - - protected Cat1() { - super(new JsonSchemaInfo() - .allOf(List.of( - Animal.Animal1.class, - Schema1.class - )) - ); - } - - public static Cat1 getInstance() { - if (instance == null) { - instance = new Cat1(); - } - return instance; - } - - @Override - public Nothing? validate(Nothing? arg, SchemaConfiguration configuration) throws ValidationException { - Set> pathSet = new HashSet<>(); - List pathToItem = List.of("args[0]"); - Nothing? castArg = castToAllowedTypes(arg, pathToItem, pathSet); - SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().build())); - PathToSchemasMap validatedPathToSchemas = new PathToSchemasMap(); - ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, new LinkedHashSet<>()); - getPathToSchemas(this, castArg, validationMetadata, pathSet); - return castArg; - } - - @Override - public boolean validate(boolean arg, SchemaConfiguration configuration) throws ValidationException { - Set> pathSet = new HashSet<>(); - List pathToItem = List.of("args[0]"); - boolean castArg = castToAllowedTypes(arg, pathToItem, pathSet); - SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().build())); - PathToSchemasMap validatedPathToSchemas = new PathToSchemasMap(); - ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, new LinkedHashSet<>()); - getPathToSchemas(this, castArg, validationMetadata, pathSet); - return castArg; - } - - @Override - public Number validate(Number arg, SchemaConfiguration configuration) throws ValidationException { - Set> pathSet = new HashSet<>(); - List pathToItem = List.of("args[0]"); - Number castArg = castToAllowedTypes(arg, pathToItem, pathSet); - SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().build())); - PathToSchemasMap validatedPathToSchemas = new PathToSchemasMap(); - ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, new LinkedHashSet<>()); - getPathToSchemas(this, castArg, validationMetadata, pathSet); - return castArg; - } - - public int validate(int arg, SchemaConfiguration configuration) throws ValidationException { - return (int) validate((Number) arg, configuration); - } - - public long validate(long arg, SchemaConfiguration configuration) throws ValidationException { - return (long) validate((Number) arg, configuration); - } - - public float validate(float arg, SchemaConfiguration configuration) throws ValidationException { - return (float) validate((Number) arg, configuration); - } - - public double validate(double arg, SchemaConfiguration configuration) throws ValidationException { - return (double) validate((Number) arg, configuration); - } - - @Override - public String validate(String arg, SchemaConfiguration configuration) throws ValidationException { - Set> pathSet = new HashSet<>(); - List pathToItem = List.of("args[0]"); - String castArg = castToAllowedTypes(arg, pathToItem, pathSet); - SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().build())); - PathToSchemasMap validatedPathToSchemas = new PathToSchemasMap(); - ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, new LinkedHashSet<>()); - getPathToSchemas(this, castArg, validationMetadata, pathSet); - return castArg; - } - - public String validate(LocalDate arg, SchemaConfiguration configuration) throws ValidationException { - return validate(arg.toString(), configuration); - } - - public String validate(ZonedDateTime arg, SchemaConfiguration configuration) throws ValidationException { - return validate(arg.toString(), configuration); - } - - public String validate(UUID arg, SchemaConfiguration configuration) throws ValidationException { - return validate(arg.toString(), configuration); - } - - @Override - public FrozenList<@Nullable Object> getNewInstance(List arg, List pathToItem, PathToSchemasMap pathToSchemas) { - List<@Nullable Object> items = new ArrayList<>(); - int i = 0; - for (Object item: arg) { - List itemPathToItem = new ArrayList<>(pathToItem); - itemPathToItem.add(i); - LinkedHashMap, Nothing?> schemas = pathToSchemas.get(itemPathToItem); - if (schemas == null) { - throw new RuntimeException("Validation result is invalid, schemas must exist for a pathToItem"); - } - JsonSchema itemSchema = schemas.entrySet().iterator().next().getKey(); - @Nullable Object itemInstance = itemSchema.getNewInstance(item, itemPathToItem, pathToSchemas); - items.add(itemInstance); - i += 1; - } - FrozenList<@Nullable Object> newInstanceItems = new FrozenList<>(items); - return newInstanceItems; - } - - 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); - SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().build())); - ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, new PathToSchemasMap(), new LinkedHashSet<>()); - PathToSchemasMap pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet); - return getNewInstance(castArg, validationMetadata.pathToItem(), pathToSchemasMap); - } - - @Override - 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 RuntimeException("Invalid non-string key value"); - } - String propertyName = (String) entryKey; - List propertyPathToItem = new ArrayList<>(pathToItem); - propertyPathToItem.add(propertyName); - Object value = entry.getValue(); - LinkedHashMap, Nothing?> schemas = pathToSchemas.get(propertyPathToItem); - if (schemas == null) { - throw new RuntimeException("Validation result is invalid, schemas must exist for a pathToItem"); - } - JsonSchema propertySchema = schemas.entrySet().iterator().next().getKey(); - @Nullable Object propertyInstance = propertySchema.getNewInstance(value, propertyPathToItem, pathToSchemas); - properties.put(propertyName, propertyInstance); - } - FrozenMap<@Nullable Object> castProperties = new FrozenMap<>(properties); - return castProperties; - } - - public FrozenMap<@Nullable Object> validate(Map arg, SchemaConfiguration configuration) throws ValidationException { - Set> pathSet = new HashSet<>(); - List pathToItem = List.of("args[0]"); - Map castArg = castToAllowedTypes(arg, pathToItem, pathSet); - SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().build())); - PathToSchemasMap validatedPathToSchemas = new PathToSchemasMap(); - ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, new LinkedHashSet<>()); - PathToSchemasMap pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet); - return getNewInstance(castArg, validationMetadata.pathToItem(), pathToSchemasMap); - } - - @Override - public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { - if (arg == null) { - return validate((Nothing?) null, configuration); - } else if (arg instanceof Boolean) { - boolean boolArg = (Boolean) arg; - return validate(boolArg, configuration); - } else if (arg instanceof Number) { - return validate((Number) arg, configuration); - } else if (arg instanceof String) { - return validate((String) arg, configuration); - } else if (arg instanceof List) { - return validate((List) arg, 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"); - } - @Override - public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { - if (arg == null) { - return getNewInstance((Nothing?) null, pathToItem, pathToSchemas); - } else if (arg instanceof Boolean) { - boolean boolArg = (Boolean) arg; - return getNewInstance(boolArg, pathToItem, pathToSchemas); - } else if (arg instanceof Number) { - return getNewInstance((Number) arg, pathToItem, pathToSchemas); - } else if (arg instanceof String) { - return getNewInstance((String) arg, pathToItem, pathToSchemas); - } else if (arg instanceof List) { - return getNewInstance((List) arg, 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"); - } - @Override - public Cat1BoxedVoid validateAndBox(Nothing? arg, SchemaConfiguration configuration) throws ValidationException { - return new Cat1BoxedVoid(validate(arg, configuration)); - } - @Override - 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 { - return new Cat1BoxedNumber(validate(arg, configuration)); - } - @Override - 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 { - return new Cat1BoxedList(validate(arg, configuration)); - } - @Override - 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 { - if (arg == null) { - Nothing? castArg = (Nothing?) arg; - return validateAndBox(castArg, configuration); - } else if (arg instanceof Boolean booleanArg) { - boolean castArg = booleanArg; - return validateAndBox(castArg, configuration); - } else if (arg instanceof String castArg) { - return validateAndBox(castArg, configuration); - } else if (arg instanceof Number castArg) { - return validateAndBox(castArg, configuration); - } else if (arg instanceof List castArg) { - 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"); - } - } -} diff --git a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/schemas/Category.kt b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/schemas/Category.kt deleted file mode 100644 index df36d6e43b4..00000000000 --- a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/schemas/Category.kt +++ /dev/null @@ -1,341 +0,0 @@ -package org.openapijsonschematools.client.components.schemas; -import java.util.ArrayList; -import java.util.HashSet; -import java.util.LinkedHashMap; -import java.util.LinkedHashSet; -import java.util.List; -import java.util.Map; -import java.util.Objects; -import java.util.Set; -import org.checkerframework.checker.nullness.qual.Nullable; -import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags; -import org.openapijsonschematools.client.configurations.SchemaConfiguration; -import org.openapijsonschematools.client.exceptions.InvalidAdditionalPropertyException; -import org.openapijsonschematools.client.exceptions.UnsetPropertyException; -import org.openapijsonschematools.client.exceptions.ValidationException; -import org.openapijsonschematools.client.schemas.GenericBuilder; -import org.openapijsonschematools.client.schemas.Int64JsonSchema; -import org.openapijsonschematools.client.schemas.UnsetAddPropsSetter; -import org.openapijsonschematools.client.schemas.validation.DefaultValueMethod; -import org.openapijsonschematools.client.schemas.validation.FrozenMap; -import org.openapijsonschematools.client.schemas.validation.JsonSchema; -import org.openapijsonschematools.client.schemas.validation.JsonSchemaInfo; -import org.openapijsonschematools.client.schemas.validation.MapSchemaValidator; -import org.openapijsonschematools.client.schemas.validation.PathToSchemasMap; -import org.openapijsonschematools.client.schemas.validation.PropertyEntry; -import org.openapijsonschematools.client.schemas.validation.StringSchemaValidator; -import org.openapijsonschematools.client.schemas.validation.ValidationMetadata; - -public class Category { - // nest classes so all schemas and input/output classes can be public - - - public static class Id extends Int64JsonSchema.Int64JsonSchema1 { - private static @Nullable Id instance = null; - public static Id getInstance() { - if (instance == null) { - instance = new Id(); - } - return instance; - } - } - - - public sealed interface NameBoxed permits NameBoxedString { - @Nullable Object getData(); - } - - public record NameBoxedString(String data) implements NameBoxed { - @Override - public @Nullable Object getData() { - return data; - } - } - - - - public static class Name extends JsonSchema implements StringSchemaValidator, DefaultValueMethod { - private static @Nullable Name instance = null; - - protected Name() { - super(new JsonSchemaInfo() - .type(Set.of( - String.class - )) - .defaultValue("default-name") - ); - } - - public static Name getInstance() { - if (instance == null) { - instance = new Name(); - } - return instance; - } - - @Override - public String validate(String arg, SchemaConfiguration configuration) throws ValidationException { - Set> pathSet = new HashSet<>(); - List pathToItem = List.of("args[0"); - String castArg = castToAllowedTypes(arg, pathToItem, pathSet); - SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().build())); - ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, new PathToSchemasMap(), new LinkedHashSet<>()); - getPathToSchemas(this, castArg, validationMetadata, pathSet); - return castArg; - } - - @Override - public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws 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"); - } - @Override - public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { - 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"); - } - public String defaultValue() throws ValidationException { - if (defaultValue instanceof String) { - return (String) defaultValue; - } - throw new ValidationException("Invalid type stored in defaultValue"); - } - @Override - 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 { - 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"); - } - } - - public static class CategoryMap extends FrozenMap<@Nullable Object> { - protected CategoryMap(FrozenMap<@Nullable Object> m) { - super(m); - } - public static final Set requiredKeys = Set.of( - "name" - ); - public static final Set optionalKeys = Set.of( - "id" - ); - public static CategoryMap of(Map arg, SchemaConfiguration configuration) throws ValidationException { - return Category1.getInstance().validate(arg, configuration); - } - - public String name() { - @Nullable Object value = get("name"); - if (!(value instanceof String)) { - throw new RuntimeException("Invalid value stored for name"); - } - return (String) value; - } - - public Number id() throws UnsetPropertyException { - String key = "id"; - throwIfKeyNotPresent(key); - @Nullable Object value = get(key); - if (!(value instanceof Number)) { - throw new RuntimeException("Invalid value stored for id"); - } - return (Number) value; - } - - public @Nullable Object getAdditionalProperty(String name) throws UnsetPropertyException, InvalidAdditionalPropertyException { - throwIfKeyKnown(name, requiredKeys, optionalKeys); - throwIfKeyNotPresent(name); - return get(name); - } - } - - public interface SetterForName { - Map getInstance(); - T getBuilderAfterName(Map instance); - - default T name(String value) { - var instance = getInstance(); - instance.put("name", value); - return getBuilderAfterName(instance); - } - } - - public interface SetterForId { - Map getInstance(); - T getBuilderAfterId(Map instance); - - default T id(int value) { - var instance = getInstance(); - instance.put("id", value); - return getBuilderAfterId(instance); - } - - default T id(float value) { - var instance = getInstance(); - instance.put("id", value); - return getBuilderAfterId(instance); - } - - default T id(long value) { - var instance = getInstance(); - instance.put("id", value); - return getBuilderAfterId(instance); - } - - default T id(double value) { - var instance = getInstance(); - instance.put("id", value); - return getBuilderAfterId(instance); - } - } - - public static class CategoryMap0Builder extends UnsetAddPropsSetter implements GenericBuilder>, SetterForId { - private final Map instance; - private static final Set knownKeys = Set.of( - "name", - "id" - ); - public Set getKnownKeys() { - return knownKeys; - } - public CategoryMap0Builder(Map instance) { - this.instance = instance; - } - public Map build() { - return instance; - } - public Map getInstance() { - return instance; - } - public CategoryMap0Builder getBuilderAfterId(Map instance) { - return this; - } - public CategoryMap0Builder getBuilderAfterAdditionalProperty(Map instance) { - return this; - } - } - - public static class CategoryMapBuilder implements SetterForName { - private final Map instance; - public CategoryMapBuilder() { - this.instance = new LinkedHashMap<>(); - } - public Map getInstance() { - return instance; - } - public CategoryMap0Builder getBuilderAfterName(Map instance) { - return new CategoryMap0Builder(instance); - } - } - - - public sealed interface Category1Boxed permits Category1BoxedMap { - @Nullable Object getData(); - } - - public record Category1BoxedMap(CategoryMap data) implements Category1Boxed { - @Override - public @Nullable Object getData() { - return data; - } - } - - - public static class Category1 extends JsonSchema implements MapSchemaValidator { - /* - NOTE: This class is auto generated by OpenAPI JSON Schema Generator. - Ref: https://github.com/openapi-json-schema-tools/openapi-json-schema-generator - - Do not edit the class manually. - */ - private static @Nullable Category1 instance = null; - - protected Category1() { - super(new JsonSchemaInfo() - .type(Set.of(Map.class)) - .properties(Map.ofEntries( - new PropertyEntry("id", Id.class), - new PropertyEntry("name", Name.class) - )) - .required(Set.of( - "name" - )) - ); - } - - public static Category1 getInstance() { - if (instance == null) { - instance = new Category1(); - } - return instance; - } - - 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 RuntimeException("Invalid non-string key value"); - } - String propertyName = (String) entryKey; - List propertyPathToItem = new ArrayList<>(pathToItem); - propertyPathToItem.add(propertyName); - Object value = entry.getValue(); - LinkedHashMap, Nothing?> schemas = pathToSchemas.get(propertyPathToItem); - if (schemas == null) { - throw new RuntimeException("Validation result is invalid, schemas must exist for a pathToItem"); - } - JsonSchema propertySchema = schemas.entrySet().iterator().next().getKey(); - @Nullable Object propertyInstance = propertySchema.getNewInstance(value, propertyPathToItem, pathToSchemas); - properties.put(propertyName, propertyInstance); - } - FrozenMap<@Nullable Object> castProperties = new FrozenMap<>(properties); - return new CategoryMap(castProperties); - } - - 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); - SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().build())); - ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, new PathToSchemasMap(), new LinkedHashSet<>()); - PathToSchemasMap pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet); - return getNewInstance(castArg, validationMetadata.pathToItem(), pathToSchemasMap); - } - - - @Override - public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws 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"); - } - @Override - public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { - if (arg instanceof Map) { - return getNewInstance((Map) arg, pathToItem, pathToSchemas); - } - 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 { - return new Category1BoxedMap(validate(arg, configuration)); - } - @Override - public Category1Boxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { - 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"); - } - } - -} diff --git a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/schemas/ChildCat.kt b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/schemas/ChildCat.kt deleted file mode 100644 index ebb949fd2f5..00000000000 --- a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/schemas/ChildCat.kt +++ /dev/null @@ -1,503 +0,0 @@ -package org.openapijsonschematools.client.components.schemas; -import java.time.LocalDate; -import java.time.ZonedDateTime; -import java.util.ArrayList; -import java.util.HashSet; -import java.util.LinkedHashMap; -import java.util.LinkedHashSet; -import java.util.List; -import java.util.Map; -import java.util.Objects; -import java.util.Set; -import java.util.UUID; -import org.checkerframework.checker.nullness.qual.Nullable; -import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags; -import org.openapijsonschematools.client.configurations.SchemaConfiguration; -import org.openapijsonschematools.client.exceptions.InvalidAdditionalPropertyException; -import org.openapijsonschematools.client.exceptions.UnsetPropertyException; -import org.openapijsonschematools.client.exceptions.ValidationException; -import org.openapijsonschematools.client.schemas.GenericBuilder; -import org.openapijsonschematools.client.schemas.StringJsonSchema; -import org.openapijsonschematools.client.schemas.UnsetAddPropsSetter; -import org.openapijsonschematools.client.schemas.validation.BooleanSchemaValidator; -import org.openapijsonschematools.client.schemas.validation.FrozenList; -import org.openapijsonschematools.client.schemas.validation.FrozenMap; -import org.openapijsonschematools.client.schemas.validation.JsonSchema; -import org.openapijsonschematools.client.schemas.validation.JsonSchemaInfo; -import org.openapijsonschematools.client.schemas.validation.ListSchemaValidator; -import org.openapijsonschematools.client.schemas.validation.MapSchemaValidator; -import org.openapijsonschematools.client.schemas.validation.NullSchemaValidator; -import org.openapijsonschematools.client.schemas.validation.NumberSchemaValidator; -import org.openapijsonschematools.client.schemas.validation.PathToSchemasMap; -import org.openapijsonschematools.client.schemas.validation.PropertyEntry; -import org.openapijsonschematools.client.schemas.validation.StringSchemaValidator; -import org.openapijsonschematools.client.schemas.validation.ValidationMetadata; - -public class ChildCat { - // nest classes so all schemas and input/output classes can be public - - - public static class Name extends StringJsonSchema.StringJsonSchema1 { - private static @Nullable Name instance = null; - public static Name getInstance() { - if (instance == null) { - instance = new Name(); - } - return instance; - } - } - - - public static class Schema1Map extends FrozenMap<@Nullable Object> { - protected Schema1Map(FrozenMap<@Nullable Object> m) { - super(m); - } - public static final Set requiredKeys = Set.of(); - public static final Set optionalKeys = Set.of( - "name" - ); - public static Schema1Map of(Map arg, SchemaConfiguration configuration) throws ValidationException { - return Schema1.getInstance().validate(arg, configuration); - } - - public String name() throws UnsetPropertyException { - String key = "name"; - throwIfKeyNotPresent(key); - @Nullable Object value = get(key); - if (!(value instanceof String)) { - throw new RuntimeException("Invalid value stored for name"); - } - return (String) value; - } - - public @Nullable Object getAdditionalProperty(String name) throws UnsetPropertyException, InvalidAdditionalPropertyException { - throwIfKeyKnown(name, requiredKeys, optionalKeys); - throwIfKeyNotPresent(name); - return get(name); - } - } - - public interface SetterForName { - Map getInstance(); - T getBuilderAfterName(Map instance); - - default T name(String value) { - var instance = getInstance(); - instance.put("name", value); - return getBuilderAfterName(instance); - } - } - - public static class Schema1MapBuilder extends UnsetAddPropsSetter implements GenericBuilder>, SetterForName { - private final Map instance; - private static final Set knownKeys = Set.of( - "name" - ); - public Set getKnownKeys() { - return knownKeys; - } - public Schema1MapBuilder() { - this.instance = new LinkedHashMap<>(); - } - public Map build() { - return instance; - } - public Map getInstance() { - return instance; - } - public Schema1MapBuilder getBuilderAfterName(Map instance) { - return this; - } - public Schema1MapBuilder getBuilderAfterAdditionalProperty(Map instance) { - return this; - } - } - - - public sealed interface Schema1Boxed permits Schema1BoxedMap { - @Nullable Object getData(); - } - - public record Schema1BoxedMap(Schema1Map data) implements Schema1Boxed { - @Override - public @Nullable Object getData() { - return data; - } - } - - - public static class Schema1 extends JsonSchema implements MapSchemaValidator { - private static @Nullable Schema1 instance = null; - - protected Schema1() { - super(new JsonSchemaInfo() - .type(Set.of(Map.class)) - .properties(Map.ofEntries( - new PropertyEntry("name", Name.class) - )) - ); - } - - public static Schema1 getInstance() { - if (instance == null) { - instance = new Schema1(); - } - return instance; - } - - 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 RuntimeException("Invalid non-string key value"); - } - String propertyName = (String) entryKey; - List propertyPathToItem = new ArrayList<>(pathToItem); - propertyPathToItem.add(propertyName); - Object value = entry.getValue(); - LinkedHashMap, Nothing?> schemas = pathToSchemas.get(propertyPathToItem); - if (schemas == null) { - throw new RuntimeException("Validation result is invalid, schemas must exist for a pathToItem"); - } - JsonSchema propertySchema = schemas.entrySet().iterator().next().getKey(); - @Nullable Object propertyInstance = propertySchema.getNewInstance(value, propertyPathToItem, pathToSchemas); - properties.put(propertyName, propertyInstance); - } - FrozenMap<@Nullable Object> castProperties = new FrozenMap<>(properties); - return new Schema1Map(castProperties); - } - - 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); - SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().build())); - ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, new PathToSchemasMap(), new LinkedHashSet<>()); - PathToSchemasMap pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet); - return getNewInstance(castArg, validationMetadata.pathToItem(), pathToSchemasMap); - } - - - @Override - public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws 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"); - } - @Override - public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { - if (arg instanceof Map) { - return getNewInstance((Map) arg, pathToItem, pathToSchemas); - } - 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 { - return new Schema1BoxedMap(validate(arg, configuration)); - } - @Override - public Schema1Boxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { - 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"); - } - } - - - public sealed interface ChildCat1Boxed permits ChildCat1BoxedVoid, ChildCat1BoxedBoolean, ChildCat1BoxedNumber, ChildCat1BoxedString, ChildCat1BoxedList, ChildCat1BoxedMap { - @Nullable Object getData(); - } - - public record ChildCat1BoxedVoid(Nothing? data) implements ChildCat1Boxed { - @Override - public @Nullable Object getData() { - return data; - } - } - - public record ChildCat1BoxedBoolean(boolean data) implements ChildCat1Boxed { - @Override - public @Nullable Object getData() { - return data; - } - } - - public record ChildCat1BoxedNumber(Number data) implements ChildCat1Boxed { - @Override - public @Nullable Object getData() { - return data; - } - } - - public record ChildCat1BoxedString(String data) implements ChildCat1Boxed { - @Override - public @Nullable Object getData() { - return data; - } - } - - public record ChildCat1BoxedList(FrozenList<@Nullable Object> data) implements ChildCat1Boxed { - @Override - public @Nullable Object getData() { - return data; - } - } - - public record ChildCat1BoxedMap(FrozenMap<@Nullable Object> data) implements ChildCat1Boxed { - @Override - public @Nullable Object getData() { - return data; - } - } - - - public static class ChildCat1 extends JsonSchema implements NullSchemaValidator, BooleanSchemaValidator, NumberSchemaValidator, StringSchemaValidator, ListSchemaValidator, ChildCat1BoxedList>, MapSchemaValidator, ChildCat1BoxedMap> { - /* - NOTE: This class is auto generated by OpenAPI JSON Schema Generator. - Ref: https://github.com/openapi-json-schema-tools/openapi-json-schema-generator - - Do not edit the class manually. - */ - private static @Nullable ChildCat1 instance = null; - - protected ChildCat1() { - super(new JsonSchemaInfo() - .allOf(List.of( - ParentPet.ParentPet1.class, - Schema1.class - )) - ); - } - - public static ChildCat1 getInstance() { - if (instance == null) { - instance = new ChildCat1(); - } - return instance; - } - - @Override - public Nothing? validate(Nothing? arg, SchemaConfiguration configuration) throws ValidationException { - Set> pathSet = new HashSet<>(); - List pathToItem = List.of("args[0]"); - Nothing? castArg = castToAllowedTypes(arg, pathToItem, pathSet); - SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().build())); - PathToSchemasMap validatedPathToSchemas = new PathToSchemasMap(); - ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, new LinkedHashSet<>()); - getPathToSchemas(this, castArg, validationMetadata, pathSet); - return castArg; - } - - @Override - public boolean validate(boolean arg, SchemaConfiguration configuration) throws ValidationException { - Set> pathSet = new HashSet<>(); - List pathToItem = List.of("args[0]"); - boolean castArg = castToAllowedTypes(arg, pathToItem, pathSet); - SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().build())); - PathToSchemasMap validatedPathToSchemas = new PathToSchemasMap(); - ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, new LinkedHashSet<>()); - getPathToSchemas(this, castArg, validationMetadata, pathSet); - return castArg; - } - - @Override - public Number validate(Number arg, SchemaConfiguration configuration) throws ValidationException { - Set> pathSet = new HashSet<>(); - List pathToItem = List.of("args[0]"); - Number castArg = castToAllowedTypes(arg, pathToItem, pathSet); - SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().build())); - PathToSchemasMap validatedPathToSchemas = new PathToSchemasMap(); - ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, new LinkedHashSet<>()); - getPathToSchemas(this, castArg, validationMetadata, pathSet); - return castArg; - } - - public int validate(int arg, SchemaConfiguration configuration) throws ValidationException { - return (int) validate((Number) arg, configuration); - } - - public long validate(long arg, SchemaConfiguration configuration) throws ValidationException { - return (long) validate((Number) arg, configuration); - } - - public float validate(float arg, SchemaConfiguration configuration) throws ValidationException { - return (float) validate((Number) arg, configuration); - } - - public double validate(double arg, SchemaConfiguration configuration) throws ValidationException { - return (double) validate((Number) arg, configuration); - } - - @Override - public String validate(String arg, SchemaConfiguration configuration) throws ValidationException { - Set> pathSet = new HashSet<>(); - List pathToItem = List.of("args[0]"); - String castArg = castToAllowedTypes(arg, pathToItem, pathSet); - SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().build())); - PathToSchemasMap validatedPathToSchemas = new PathToSchemasMap(); - ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, new LinkedHashSet<>()); - getPathToSchemas(this, castArg, validationMetadata, pathSet); - return castArg; - } - - public String validate(LocalDate arg, SchemaConfiguration configuration) throws ValidationException { - return validate(arg.toString(), configuration); - } - - public String validate(ZonedDateTime arg, SchemaConfiguration configuration) throws ValidationException { - return validate(arg.toString(), configuration); - } - - public String validate(UUID arg, SchemaConfiguration configuration) throws ValidationException { - return validate(arg.toString(), configuration); - } - - @Override - public FrozenList<@Nullable Object> getNewInstance(List arg, List pathToItem, PathToSchemasMap pathToSchemas) { - List<@Nullable Object> items = new ArrayList<>(); - int i = 0; - for (Object item: arg) { - List itemPathToItem = new ArrayList<>(pathToItem); - itemPathToItem.add(i); - LinkedHashMap, Nothing?> schemas = pathToSchemas.get(itemPathToItem); - if (schemas == null) { - throw new RuntimeException("Validation result is invalid, schemas must exist for a pathToItem"); - } - JsonSchema itemSchema = schemas.entrySet().iterator().next().getKey(); - @Nullable Object itemInstance = itemSchema.getNewInstance(item, itemPathToItem, pathToSchemas); - items.add(itemInstance); - i += 1; - } - FrozenList<@Nullable Object> newInstanceItems = new FrozenList<>(items); - return newInstanceItems; - } - - 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); - SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().build())); - ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, new PathToSchemasMap(), new LinkedHashSet<>()); - PathToSchemasMap pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet); - return getNewInstance(castArg, validationMetadata.pathToItem(), pathToSchemasMap); - } - - @Override - 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 RuntimeException("Invalid non-string key value"); - } - String propertyName = (String) entryKey; - List propertyPathToItem = new ArrayList<>(pathToItem); - propertyPathToItem.add(propertyName); - Object value = entry.getValue(); - LinkedHashMap, Nothing?> schemas = pathToSchemas.get(propertyPathToItem); - if (schemas == null) { - throw new RuntimeException("Validation result is invalid, schemas must exist for a pathToItem"); - } - JsonSchema propertySchema = schemas.entrySet().iterator().next().getKey(); - @Nullable Object propertyInstance = propertySchema.getNewInstance(value, propertyPathToItem, pathToSchemas); - properties.put(propertyName, propertyInstance); - } - FrozenMap<@Nullable Object> castProperties = new FrozenMap<>(properties); - return castProperties; - } - - public FrozenMap<@Nullable Object> validate(Map arg, SchemaConfiguration configuration) throws ValidationException { - Set> pathSet = new HashSet<>(); - List pathToItem = List.of("args[0]"); - Map castArg = castToAllowedTypes(arg, pathToItem, pathSet); - SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().build())); - PathToSchemasMap validatedPathToSchemas = new PathToSchemasMap(); - ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, new LinkedHashSet<>()); - PathToSchemasMap pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet); - return getNewInstance(castArg, validationMetadata.pathToItem(), pathToSchemasMap); - } - - @Override - public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { - if (arg == null) { - return validate((Nothing?) null, configuration); - } else if (arg instanceof Boolean) { - boolean boolArg = (Boolean) arg; - return validate(boolArg, configuration); - } else if (arg instanceof Number) { - return validate((Number) arg, configuration); - } else if (arg instanceof String) { - return validate((String) arg, configuration); - } else if (arg instanceof List) { - return validate((List) arg, 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"); - } - @Override - public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { - if (arg == null) { - return getNewInstance((Nothing?) null, pathToItem, pathToSchemas); - } else if (arg instanceof Boolean) { - boolean boolArg = (Boolean) arg; - return getNewInstance(boolArg, pathToItem, pathToSchemas); - } else if (arg instanceof Number) { - return getNewInstance((Number) arg, pathToItem, pathToSchemas); - } else if (arg instanceof String) { - return getNewInstance((String) arg, pathToItem, pathToSchemas); - } else if (arg instanceof List) { - return getNewInstance((List) arg, 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"); - } - @Override - public ChildCat1BoxedVoid validateAndBox(Nothing? arg, SchemaConfiguration configuration) throws ValidationException { - return new ChildCat1BoxedVoid(validate(arg, configuration)); - } - @Override - 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 { - return new ChildCat1BoxedNumber(validate(arg, configuration)); - } - @Override - 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 { - return new ChildCat1BoxedList(validate(arg, configuration)); - } - @Override - 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 { - if (arg == null) { - Nothing? castArg = (Nothing?) arg; - return validateAndBox(castArg, configuration); - } else if (arg instanceof Boolean booleanArg) { - boolean castArg = booleanArg; - return validateAndBox(castArg, configuration); - } else if (arg instanceof String castArg) { - return validateAndBox(castArg, configuration); - } else if (arg instanceof Number castArg) { - return validateAndBox(castArg, configuration); - } else if (arg instanceof List castArg) { - 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"); - } - } -} diff --git a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/schemas/ClassModel.kt b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/schemas/ClassModel.kt deleted file mode 100644 index 49761ad9652..00000000000 --- a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/schemas/ClassModel.kt +++ /dev/null @@ -1,401 +0,0 @@ -package org.openapijsonschematools.client.components.schemas; -import java.time.LocalDate; -import java.time.ZonedDateTime; -import java.util.ArrayList; -import java.util.HashSet; -import java.util.LinkedHashMap; -import java.util.LinkedHashSet; -import java.util.List; -import java.util.Map; -import java.util.Objects; -import java.util.Set; -import java.util.UUID; -import org.checkerframework.checker.nullness.qual.Nullable; -import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags; -import org.openapijsonschematools.client.configurations.SchemaConfiguration; -import org.openapijsonschematools.client.exceptions.InvalidAdditionalPropertyException; -import org.openapijsonschematools.client.exceptions.UnsetPropertyException; -import org.openapijsonschematools.client.exceptions.ValidationException; -import org.openapijsonschematools.client.schemas.GenericBuilder; -import org.openapijsonschematools.client.schemas.StringJsonSchema; -import org.openapijsonschematools.client.schemas.UnsetAddPropsSetter; -import org.openapijsonschematools.client.schemas.validation.BooleanSchemaValidator; -import org.openapijsonschematools.client.schemas.validation.FrozenList; -import org.openapijsonschematools.client.schemas.validation.FrozenMap; -import org.openapijsonschematools.client.schemas.validation.JsonSchema; -import org.openapijsonschematools.client.schemas.validation.JsonSchemaInfo; -import org.openapijsonschematools.client.schemas.validation.ListSchemaValidator; -import org.openapijsonschematools.client.schemas.validation.MapSchemaValidator; -import org.openapijsonschematools.client.schemas.validation.NullSchemaValidator; -import org.openapijsonschematools.client.schemas.validation.NumberSchemaValidator; -import org.openapijsonschematools.client.schemas.validation.PathToSchemasMap; -import org.openapijsonschematools.client.schemas.validation.PropertyEntry; -import org.openapijsonschematools.client.schemas.validation.StringSchemaValidator; -import org.openapijsonschematools.client.schemas.validation.ValidationMetadata; - -public class ClassModel { - // nest classes so all schemas and input/output classes can be public - - - public static class ClassSchema extends StringJsonSchema.StringJsonSchema1 { - private static @Nullable ClassSchema instance = null; - public static ClassSchema getInstance() { - if (instance == null) { - instance = new ClassSchema(); - } - return instance; - } - } - - - public static class ClassModelMap extends FrozenMap<@Nullable Object> { - protected ClassModelMap(FrozenMap<@Nullable Object> m) { - super(m); - } - public static final Set requiredKeys = Set.of(); - public static final Set optionalKeys = Set.of( - "_class" - ); - public static ClassModelMap of(Map arg, SchemaConfiguration configuration) throws ValidationException { - return ClassModel1.getInstance().validate(arg, configuration); - } - - public @Nullable Object getAdditionalProperty(String name) throws UnsetPropertyException, InvalidAdditionalPropertyException { - throwIfKeyKnown(name, requiredKeys, optionalKeys); - throwIfKeyNotPresent(name); - return get(name); - } - } - - public interface SetterForClassSchema { - Map getInstance(); - T getBuilderAfterClassSchema(Map instance); - - default T lowLineClass(String value) { - var instance = getInstance(); - instance.put("_class", value); - return getBuilderAfterClassSchema(instance); - } - } - - public static class ClassModelMapBuilder extends UnsetAddPropsSetter implements GenericBuilder>, SetterForClassSchema { - private final Map instance; - private static final Set knownKeys = Set.of( - "_class" - ); - public Set getKnownKeys() { - return knownKeys; - } - public ClassModelMapBuilder() { - this.instance = new LinkedHashMap<>(); - } - public Map build() { - return instance; - } - public Map getInstance() { - return instance; - } - public ClassModelMapBuilder getBuilderAfterClassSchema(Map instance) { - return this; - } - public ClassModelMapBuilder getBuilderAfterAdditionalProperty(Map instance) { - return this; - } - } - - - public sealed interface ClassModel1Boxed permits ClassModel1BoxedVoid, ClassModel1BoxedBoolean, ClassModel1BoxedNumber, ClassModel1BoxedString, ClassModel1BoxedList, ClassModel1BoxedMap { - @Nullable Object getData(); - } - - public record ClassModel1BoxedVoid(Nothing? data) implements ClassModel1Boxed { - @Override - public @Nullable Object getData() { - return data; - } - } - - public record ClassModel1BoxedBoolean(boolean data) implements ClassModel1Boxed { - @Override - public @Nullable Object getData() { - return data; - } - } - - public record ClassModel1BoxedNumber(Number data) implements ClassModel1Boxed { - @Override - public @Nullable Object getData() { - return data; - } - } - - public record ClassModel1BoxedString(String data) implements ClassModel1Boxed { - @Override - public @Nullable Object getData() { - return data; - } - } - - public record ClassModel1BoxedList(FrozenList<@Nullable Object> data) implements ClassModel1Boxed { - @Override - public @Nullable Object getData() { - return data; - } - } - - public record ClassModel1BoxedMap(ClassModelMap data) implements ClassModel1Boxed { - @Override - public @Nullable Object getData() { - return data; - } - } - - - public static class ClassModel1 extends JsonSchema implements NullSchemaValidator, BooleanSchemaValidator, NumberSchemaValidator, StringSchemaValidator, ListSchemaValidator, ClassModel1BoxedList>, MapSchemaValidator { - /* - NOTE: This class is auto generated by OpenAPI JSON Schema Generator. - Ref: https://github.com/openapi-json-schema-tools/openapi-json-schema-generator - - Do not edit the class manually. - - Model for testing model with "_class" property - */ - private static @Nullable ClassModel1 instance = null; - - protected ClassModel1() { - super(new JsonSchemaInfo() - .properties(Map.ofEntries( - new PropertyEntry("_class", ClassSchema.class) - )) - ); - } - - public static ClassModel1 getInstance() { - if (instance == null) { - instance = new ClassModel1(); - } - return instance; - } - - @Override - public Nothing? validate(Nothing? arg, SchemaConfiguration configuration) throws ValidationException { - Set> pathSet = new HashSet<>(); - List pathToItem = List.of("args[0]"); - Nothing? castArg = castToAllowedTypes(arg, pathToItem, pathSet); - SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().build())); - PathToSchemasMap validatedPathToSchemas = new PathToSchemasMap(); - ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, new LinkedHashSet<>()); - getPathToSchemas(this, castArg, validationMetadata, pathSet); - return castArg; - } - - @Override - public boolean validate(boolean arg, SchemaConfiguration configuration) throws ValidationException { - Set> pathSet = new HashSet<>(); - List pathToItem = List.of("args[0]"); - boolean castArg = castToAllowedTypes(arg, pathToItem, pathSet); - SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().build())); - PathToSchemasMap validatedPathToSchemas = new PathToSchemasMap(); - ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, new LinkedHashSet<>()); - getPathToSchemas(this, castArg, validationMetadata, pathSet); - return castArg; - } - - @Override - public Number validate(Number arg, SchemaConfiguration configuration) throws ValidationException { - Set> pathSet = new HashSet<>(); - List pathToItem = List.of("args[0]"); - Number castArg = castToAllowedTypes(arg, pathToItem, pathSet); - SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().build())); - PathToSchemasMap validatedPathToSchemas = new PathToSchemasMap(); - ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, new LinkedHashSet<>()); - getPathToSchemas(this, castArg, validationMetadata, pathSet); - return castArg; - } - - public int validate(int arg, SchemaConfiguration configuration) throws ValidationException { - return (int) validate((Number) arg, configuration); - } - - public long validate(long arg, SchemaConfiguration configuration) throws ValidationException { - return (long) validate((Number) arg, configuration); - } - - public float validate(float arg, SchemaConfiguration configuration) throws ValidationException { - return (float) validate((Number) arg, configuration); - } - - public double validate(double arg, SchemaConfiguration configuration) throws ValidationException { - return (double) validate((Number) arg, configuration); - } - - @Override - public String validate(String arg, SchemaConfiguration configuration) throws ValidationException { - Set> pathSet = new HashSet<>(); - List pathToItem = List.of("args[0]"); - String castArg = castToAllowedTypes(arg, pathToItem, pathSet); - SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().build())); - PathToSchemasMap validatedPathToSchemas = new PathToSchemasMap(); - ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, new LinkedHashSet<>()); - getPathToSchemas(this, castArg, validationMetadata, pathSet); - return castArg; - } - - public String validate(LocalDate arg, SchemaConfiguration configuration) throws ValidationException { - return validate(arg.toString(), configuration); - } - - public String validate(ZonedDateTime arg, SchemaConfiguration configuration) throws ValidationException { - return validate(arg.toString(), configuration); - } - - public String validate(UUID arg, SchemaConfiguration configuration) throws ValidationException { - return validate(arg.toString(), configuration); - } - - @Override - public FrozenList<@Nullable Object> getNewInstance(List arg, List pathToItem, PathToSchemasMap pathToSchemas) { - List<@Nullable Object> items = new ArrayList<>(); - int i = 0; - for (Object item: arg) { - List itemPathToItem = new ArrayList<>(pathToItem); - itemPathToItem.add(i); - LinkedHashMap, Nothing?> schemas = pathToSchemas.get(itemPathToItem); - if (schemas == null) { - throw new RuntimeException("Validation result is invalid, schemas must exist for a pathToItem"); - } - JsonSchema itemSchema = schemas.entrySet().iterator().next().getKey(); - @Nullable Object itemInstance = itemSchema.getNewInstance(item, itemPathToItem, pathToSchemas); - items.add(itemInstance); - i += 1; - } - FrozenList<@Nullable Object> newInstanceItems = new FrozenList<>(items); - return newInstanceItems; - } - - 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); - SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().build())); - ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, new PathToSchemasMap(), new LinkedHashSet<>()); - PathToSchemasMap pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet); - return getNewInstance(castArg, validationMetadata.pathToItem(), pathToSchemasMap); - } - - @Override - 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 RuntimeException("Invalid non-string key value"); - } - String propertyName = (String) entryKey; - List propertyPathToItem = new ArrayList<>(pathToItem); - propertyPathToItem.add(propertyName); - Object value = entry.getValue(); - LinkedHashMap, Nothing?> schemas = pathToSchemas.get(propertyPathToItem); - if (schemas == null) { - throw new RuntimeException("Validation result is invalid, schemas must exist for a pathToItem"); - } - JsonSchema propertySchema = schemas.entrySet().iterator().next().getKey(); - @Nullable Object propertyInstance = propertySchema.getNewInstance(value, propertyPathToItem, pathToSchemas); - properties.put(propertyName, propertyInstance); - } - FrozenMap<@Nullable Object> castProperties = new FrozenMap<>(properties); - return new ClassModelMap(castProperties); - } - - 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); - SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().build())); - PathToSchemasMap validatedPathToSchemas = new PathToSchemasMap(); - ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, new LinkedHashSet<>()); - PathToSchemasMap pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet); - return getNewInstance(castArg, validationMetadata.pathToItem(), pathToSchemasMap); - } - - @Override - public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { - if (arg == null) { - return validate((Nothing?) null, configuration); - } else if (arg instanceof Boolean) { - boolean boolArg = (Boolean) arg; - return validate(boolArg, configuration); - } else if (arg instanceof Number) { - return validate((Number) arg, configuration); - } else if (arg instanceof String) { - return validate((String) arg, configuration); - } else if (arg instanceof List) { - return validate((List) arg, 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"); - } - @Override - public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { - if (arg == null) { - return getNewInstance((Nothing?) null, pathToItem, pathToSchemas); - } else if (arg instanceof Boolean) { - boolean boolArg = (Boolean) arg; - return getNewInstance(boolArg, pathToItem, pathToSchemas); - } else if (arg instanceof Number) { - return getNewInstance((Number) arg, pathToItem, pathToSchemas); - } else if (arg instanceof String) { - return getNewInstance((String) arg, pathToItem, pathToSchemas); - } else if (arg instanceof List) { - return getNewInstance((List) arg, 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"); - } - @Override - public ClassModel1BoxedVoid validateAndBox(Nothing? arg, SchemaConfiguration configuration) throws ValidationException { - return new ClassModel1BoxedVoid(validate(arg, configuration)); - } - @Override - 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 { - return new ClassModel1BoxedNumber(validate(arg, configuration)); - } - @Override - 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 { - return new ClassModel1BoxedList(validate(arg, configuration)); - } - @Override - 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 { - if (arg == null) { - Nothing? castArg = (Nothing?) arg; - return validateAndBox(castArg, configuration); - } else if (arg instanceof Boolean booleanArg) { - boolean castArg = booleanArg; - return validateAndBox(castArg, configuration); - } else if (arg instanceof String castArg) { - return validateAndBox(castArg, configuration); - } else if (arg instanceof Number castArg) { - return validateAndBox(castArg, configuration); - } else if (arg instanceof List castArg) { - 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"); - } - } -} diff --git a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/schemas/Client.kt b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/schemas/Client.kt deleted file mode 100644 index 2042b415a6f..00000000000 --- a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/schemas/Client.kt +++ /dev/null @@ -1,206 +0,0 @@ -package org.openapijsonschematools.client.components.schemas; -import java.util.ArrayList; -import java.util.HashSet; -import java.util.LinkedHashMap; -import java.util.LinkedHashSet; -import java.util.List; -import java.util.Map; -import java.util.Objects; -import java.util.Set; -import org.checkerframework.checker.nullness.qual.Nullable; -import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags; -import org.openapijsonschematools.client.configurations.SchemaConfiguration; -import org.openapijsonschematools.client.exceptions.InvalidAdditionalPropertyException; -import org.openapijsonschematools.client.exceptions.UnsetPropertyException; -import org.openapijsonschematools.client.exceptions.ValidationException; -import org.openapijsonschematools.client.schemas.GenericBuilder; -import org.openapijsonschematools.client.schemas.StringJsonSchema; -import org.openapijsonschematools.client.schemas.UnsetAddPropsSetter; -import org.openapijsonschematools.client.schemas.validation.FrozenMap; -import org.openapijsonschematools.client.schemas.validation.JsonSchema; -import org.openapijsonschematools.client.schemas.validation.JsonSchemaInfo; -import org.openapijsonschematools.client.schemas.validation.MapSchemaValidator; -import org.openapijsonschematools.client.schemas.validation.PathToSchemasMap; -import org.openapijsonschematools.client.schemas.validation.PropertyEntry; -import org.openapijsonschematools.client.schemas.validation.ValidationMetadata; - -public class Client { - // nest classes so all schemas and input/output classes can be public - - - public static class Client2 extends StringJsonSchema.StringJsonSchema1 { - private static @Nullable Client2 instance = null; - public static Client2 getInstance() { - if (instance == null) { - instance = new Client2(); - } - return instance; - } - } - - - public static class ClientMap extends FrozenMap<@Nullable Object> { - protected ClientMap(FrozenMap<@Nullable Object> m) { - super(m); - } - public static final Set requiredKeys = Set.of(); - public static final Set optionalKeys = Set.of( - "client" - ); - public static ClientMap of(Map arg, SchemaConfiguration configuration) throws ValidationException { - return Client1.getInstance().validate(arg, configuration); - } - - public String client() throws UnsetPropertyException { - String key = "client"; - throwIfKeyNotPresent(key); - @Nullable Object value = get(key); - if (!(value instanceof String)) { - throw new RuntimeException("Invalid value stored for client"); - } - return (String) value; - } - - public @Nullable Object getAdditionalProperty(String name) throws UnsetPropertyException, InvalidAdditionalPropertyException { - throwIfKeyKnown(name, requiredKeys, optionalKeys); - throwIfKeyNotPresent(name); - return get(name); - } - } - - public interface SetterForClient2 { - Map getInstance(); - T getBuilderAfterClient2(Map instance); - - default T client(String value) { - var instance = getInstance(); - instance.put("client", value); - return getBuilderAfterClient2(instance); - } - } - - public static class ClientMapBuilder1 extends UnsetAddPropsSetter implements GenericBuilder>, SetterForClient2 { - private final Map instance; - private static final Set knownKeys = Set.of( - "client" - ); - public Set getKnownKeys() { - return knownKeys; - } - public ClientMapBuilder1() { - this.instance = new LinkedHashMap<>(); - } - public Map build() { - return instance; - } - public Map getInstance() { - return instance; - } - public ClientMapBuilder1 getBuilderAfterClient2(Map instance) { - return this; - } - public ClientMapBuilder1 getBuilderAfterAdditionalProperty(Map instance) { - return this; - } - } - - - public sealed interface Client1Boxed permits Client1BoxedMap { - @Nullable Object getData(); - } - - public record Client1BoxedMap(ClientMap data) implements Client1Boxed { - @Override - public @Nullable Object getData() { - return data; - } - } - - - public static class Client1 extends JsonSchema implements MapSchemaValidator { - /* - NOTE: This class is auto generated by OpenAPI JSON Schema Generator. - Ref: https://github.com/openapi-json-schema-tools/openapi-json-schema-generator - - Do not edit the class manually. - */ - private static @Nullable Client1 instance = null; - - protected Client1() { - super(new JsonSchemaInfo() - .type(Set.of(Map.class)) - .properties(Map.ofEntries( - new PropertyEntry("client", Client2.class) - )) - ); - } - - public static Client1 getInstance() { - if (instance == null) { - instance = new Client1(); - } - return instance; - } - - 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 RuntimeException("Invalid non-string key value"); - } - String propertyName = (String) entryKey; - List propertyPathToItem = new ArrayList<>(pathToItem); - propertyPathToItem.add(propertyName); - Object value = entry.getValue(); - LinkedHashMap, Nothing?> schemas = pathToSchemas.get(propertyPathToItem); - if (schemas == null) { - throw new RuntimeException("Validation result is invalid, schemas must exist for a pathToItem"); - } - JsonSchema propertySchema = schemas.entrySet().iterator().next().getKey(); - @Nullable Object propertyInstance = propertySchema.getNewInstance(value, propertyPathToItem, pathToSchemas); - properties.put(propertyName, propertyInstance); - } - FrozenMap<@Nullable Object> castProperties = new FrozenMap<>(properties); - return new ClientMap(castProperties); - } - - 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); - SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().build())); - ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, new PathToSchemasMap(), new LinkedHashSet<>()); - PathToSchemasMap pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet); - return getNewInstance(castArg, validationMetadata.pathToItem(), pathToSchemasMap); - } - - - @Override - public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws 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"); - } - @Override - public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { - if (arg instanceof Map) { - return getNewInstance((Map) arg, pathToItem, pathToSchemas); - } - 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 { - return new Client1BoxedMap(validate(arg, configuration)); - } - @Override - public Client1Boxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { - 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"); - } - } - -} diff --git a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/schemas/ComplexQuadrilateral.kt b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/schemas/ComplexQuadrilateral.kt deleted file mode 100644 index e6a458be9c3..00000000000 --- a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/schemas/ComplexQuadrilateral.kt +++ /dev/null @@ -1,589 +0,0 @@ -package org.openapijsonschematools.client.components.schemas; -import java.time.LocalDate; -import java.time.ZonedDateTime; -import java.util.ArrayList; -import java.util.HashSet; -import java.util.LinkedHashMap; -import java.util.LinkedHashSet; -import java.util.List; -import java.util.Map; -import java.util.Objects; -import java.util.Set; -import java.util.UUID; -import org.checkerframework.checker.nullness.qual.Nullable; -import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags; -import org.openapijsonschematools.client.configurations.SchemaConfiguration; -import org.openapijsonschematools.client.exceptions.InvalidAdditionalPropertyException; -import org.openapijsonschematools.client.exceptions.UnsetPropertyException; -import org.openapijsonschematools.client.exceptions.ValidationException; -import org.openapijsonschematools.client.schemas.GenericBuilder; -import org.openapijsonschematools.client.schemas.SetMaker; -import org.openapijsonschematools.client.schemas.UnsetAddPropsSetter; -import org.openapijsonschematools.client.schemas.validation.BooleanSchemaValidator; -import org.openapijsonschematools.client.schemas.validation.FrozenList; -import org.openapijsonschematools.client.schemas.validation.FrozenMap; -import org.openapijsonschematools.client.schemas.validation.JsonSchema; -import org.openapijsonschematools.client.schemas.validation.JsonSchemaInfo; -import org.openapijsonschematools.client.schemas.validation.ListSchemaValidator; -import org.openapijsonschematools.client.schemas.validation.MapSchemaValidator; -import org.openapijsonschematools.client.schemas.validation.NullSchemaValidator; -import org.openapijsonschematools.client.schemas.validation.NumberSchemaValidator; -import org.openapijsonschematools.client.schemas.validation.PathToSchemasMap; -import org.openapijsonschematools.client.schemas.validation.PropertyEntry; -import org.openapijsonschematools.client.schemas.validation.StringEnumValidator; -import org.openapijsonschematools.client.schemas.validation.StringSchemaValidator; -import org.openapijsonschematools.client.schemas.validation.StringValueMethod; -import org.openapijsonschematools.client.schemas.validation.ValidationMetadata; - -public class ComplexQuadrilateral { - // nest classes so all schemas and input/output classes can be public - - public enum StringQuadrilateralTypeEnums implements StringValueMethod { - COMPLEX_QUADRILATERAL("ComplexQuadrilateral"); - private final String value; - - StringQuadrilateralTypeEnums(String value) { - this.value = value; - } - public String value() { - return this.value; - } - } - - - public sealed interface QuadrilateralTypeBoxed permits QuadrilateralTypeBoxedString { - @Nullable Object getData(); - } - - public record QuadrilateralTypeBoxedString(String data) implements QuadrilateralTypeBoxed { - @Override - public @Nullable Object getData() { - return data; - } - } - - - - public static class QuadrilateralType extends JsonSchema implements StringSchemaValidator, StringEnumValidator { - private static @Nullable QuadrilateralType instance = null; - - protected QuadrilateralType() { - super(new JsonSchemaInfo() - .type(Set.of( - String.class - )) - .enumValues(SetMaker.makeSet( - "ComplexQuadrilateral" - )) - ); - } - - public static QuadrilateralType getInstance() { - if (instance == null) { - instance = new QuadrilateralType(); - } - return instance; - } - - @Override - public String validate(String arg, SchemaConfiguration configuration) throws ValidationException { - Set> pathSet = new HashSet<>(); - List pathToItem = List.of("args[0"); - String castArg = castToAllowedTypes(arg, pathToItem, pathSet); - SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().build())); - ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, new PathToSchemasMap(), new LinkedHashSet<>()); - getPathToSchemas(this, castArg, validationMetadata, pathSet); - return castArg; - } - - @Override - 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 { - 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"); - } - @Override - public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { - 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"); - } - @Override - 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 { - 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"); - } - } - - public static class Schema1Map extends FrozenMap<@Nullable Object> { - protected Schema1Map(FrozenMap<@Nullable Object> m) { - super(m); - } - public static final Set requiredKeys = Set.of(); - public static final Set optionalKeys = Set.of( - "quadrilateralType" - ); - public static Schema1Map of(Map arg, SchemaConfiguration configuration) throws ValidationException { - return Schema1.getInstance().validate(arg, configuration); - } - - public String quadrilateralType() throws UnsetPropertyException { - String key = "quadrilateralType"; - throwIfKeyNotPresent(key); - @Nullable Object value = get(key); - if (!(value instanceof String)) { - throw new RuntimeException("Invalid value stored for quadrilateralType"); - } - return (String) value; - } - - public @Nullable Object getAdditionalProperty(String name) throws UnsetPropertyException, InvalidAdditionalPropertyException { - throwIfKeyKnown(name, requiredKeys, optionalKeys); - throwIfKeyNotPresent(name); - return get(name); - } - } - - public interface SetterForQuadrilateralType { - Map getInstance(); - T getBuilderAfterQuadrilateralType(Map instance); - - default T quadrilateralType(String value) { - var instance = getInstance(); - instance.put("quadrilateralType", value); - return getBuilderAfterQuadrilateralType(instance); - } - - default T quadrilateralType(StringQuadrilateralTypeEnums value) { - var instance = getInstance(); - instance.put("quadrilateralType", value.value()); - return getBuilderAfterQuadrilateralType(instance); - } - } - - public static class Schema1MapBuilder extends UnsetAddPropsSetter implements GenericBuilder>, SetterForQuadrilateralType { - private final Map instance; - private static final Set knownKeys = Set.of( - "quadrilateralType" - ); - public Set getKnownKeys() { - return knownKeys; - } - public Schema1MapBuilder() { - this.instance = new LinkedHashMap<>(); - } - public Map build() { - return instance; - } - public Map getInstance() { - return instance; - } - public Schema1MapBuilder getBuilderAfterQuadrilateralType(Map instance) { - return this; - } - public Schema1MapBuilder getBuilderAfterAdditionalProperty(Map instance) { - return this; - } - } - - - public sealed interface Schema1Boxed permits Schema1BoxedMap { - @Nullable Object getData(); - } - - public record Schema1BoxedMap(Schema1Map data) implements Schema1Boxed { - @Override - public @Nullable Object getData() { - return data; - } - } - - - public static class Schema1 extends JsonSchema implements MapSchemaValidator { - private static @Nullable Schema1 instance = null; - - protected Schema1() { - super(new JsonSchemaInfo() - .type(Set.of(Map.class)) - .properties(Map.ofEntries( - new PropertyEntry("quadrilateralType", QuadrilateralType.class) - )) - ); - } - - public static Schema1 getInstance() { - if (instance == null) { - instance = new Schema1(); - } - return instance; - } - - 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 RuntimeException("Invalid non-string key value"); - } - String propertyName = (String) entryKey; - List propertyPathToItem = new ArrayList<>(pathToItem); - propertyPathToItem.add(propertyName); - Object value = entry.getValue(); - LinkedHashMap, Nothing?> schemas = pathToSchemas.get(propertyPathToItem); - if (schemas == null) { - throw new RuntimeException("Validation result is invalid, schemas must exist for a pathToItem"); - } - JsonSchema propertySchema = schemas.entrySet().iterator().next().getKey(); - @Nullable Object propertyInstance = propertySchema.getNewInstance(value, propertyPathToItem, pathToSchemas); - properties.put(propertyName, propertyInstance); - } - FrozenMap<@Nullable Object> castProperties = new FrozenMap<>(properties); - return new Schema1Map(castProperties); - } - - 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); - SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().build())); - ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, new PathToSchemasMap(), new LinkedHashSet<>()); - PathToSchemasMap pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet); - return getNewInstance(castArg, validationMetadata.pathToItem(), pathToSchemasMap); - } - - - @Override - public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws 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"); - } - @Override - public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { - if (arg instanceof Map) { - return getNewInstance((Map) arg, pathToItem, pathToSchemas); - } - 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 { - return new Schema1BoxedMap(validate(arg, configuration)); - } - @Override - public Schema1Boxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { - 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"); - } - } - - - public sealed interface ComplexQuadrilateral1Boxed permits ComplexQuadrilateral1BoxedVoid, ComplexQuadrilateral1BoxedBoolean, ComplexQuadrilateral1BoxedNumber, ComplexQuadrilateral1BoxedString, ComplexQuadrilateral1BoxedList, ComplexQuadrilateral1BoxedMap { - @Nullable Object getData(); - } - - public record ComplexQuadrilateral1BoxedVoid(Nothing? data) implements ComplexQuadrilateral1Boxed { - @Override - public @Nullable Object getData() { - return data; - } - } - - public record ComplexQuadrilateral1BoxedBoolean(boolean data) implements ComplexQuadrilateral1Boxed { - @Override - public @Nullable Object getData() { - return data; - } - } - - public record ComplexQuadrilateral1BoxedNumber(Number data) implements ComplexQuadrilateral1Boxed { - @Override - public @Nullable Object getData() { - return data; - } - } - - public record ComplexQuadrilateral1BoxedString(String data) implements ComplexQuadrilateral1Boxed { - @Override - public @Nullable Object getData() { - return data; - } - } - - public record ComplexQuadrilateral1BoxedList(FrozenList<@Nullable Object> data) implements ComplexQuadrilateral1Boxed { - @Override - public @Nullable Object getData() { - return data; - } - } - - public record ComplexQuadrilateral1BoxedMap(FrozenMap<@Nullable Object> data) implements ComplexQuadrilateral1Boxed { - @Override - public @Nullable Object getData() { - return data; - } - } - - - public static class ComplexQuadrilateral1 extends JsonSchema implements NullSchemaValidator, BooleanSchemaValidator, NumberSchemaValidator, StringSchemaValidator, ListSchemaValidator, ComplexQuadrilateral1BoxedList>, MapSchemaValidator, ComplexQuadrilateral1BoxedMap> { - /* - NOTE: This class is auto generated by OpenAPI JSON Schema Generator. - Ref: https://github.com/openapi-json-schema-tools/openapi-json-schema-generator - - Do not edit the class manually. - */ - private static @Nullable ComplexQuadrilateral1 instance = null; - - protected ComplexQuadrilateral1() { - super(new JsonSchemaInfo() - .allOf(List.of( - QuadrilateralInterface.QuadrilateralInterface1.class, - Schema1.class - )) - ); - } - - public static ComplexQuadrilateral1 getInstance() { - if (instance == null) { - instance = new ComplexQuadrilateral1(); - } - return instance; - } - - @Override - public Nothing? validate(Nothing? arg, SchemaConfiguration configuration) throws ValidationException { - Set> pathSet = new HashSet<>(); - List pathToItem = List.of("args[0]"); - Nothing? castArg = castToAllowedTypes(arg, pathToItem, pathSet); - SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().build())); - PathToSchemasMap validatedPathToSchemas = new PathToSchemasMap(); - ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, new LinkedHashSet<>()); - getPathToSchemas(this, castArg, validationMetadata, pathSet); - return castArg; - } - - @Override - public boolean validate(boolean arg, SchemaConfiguration configuration) throws ValidationException { - Set> pathSet = new HashSet<>(); - List pathToItem = List.of("args[0]"); - boolean castArg = castToAllowedTypes(arg, pathToItem, pathSet); - SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().build())); - PathToSchemasMap validatedPathToSchemas = new PathToSchemasMap(); - ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, new LinkedHashSet<>()); - getPathToSchemas(this, castArg, validationMetadata, pathSet); - return castArg; - } - - @Override - public Number validate(Number arg, SchemaConfiguration configuration) throws ValidationException { - Set> pathSet = new HashSet<>(); - List pathToItem = List.of("args[0]"); - Number castArg = castToAllowedTypes(arg, pathToItem, pathSet); - SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().build())); - PathToSchemasMap validatedPathToSchemas = new PathToSchemasMap(); - ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, new LinkedHashSet<>()); - getPathToSchemas(this, castArg, validationMetadata, pathSet); - return castArg; - } - - public int validate(int arg, SchemaConfiguration configuration) throws ValidationException { - return (int) validate((Number) arg, configuration); - } - - public long validate(long arg, SchemaConfiguration configuration) throws ValidationException { - return (long) validate((Number) arg, configuration); - } - - public float validate(float arg, SchemaConfiguration configuration) throws ValidationException { - return (float) validate((Number) arg, configuration); - } - - public double validate(double arg, SchemaConfiguration configuration) throws ValidationException { - return (double) validate((Number) arg, configuration); - } - - @Override - public String validate(String arg, SchemaConfiguration configuration) throws ValidationException { - Set> pathSet = new HashSet<>(); - List pathToItem = List.of("args[0]"); - String castArg = castToAllowedTypes(arg, pathToItem, pathSet); - SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().build())); - PathToSchemasMap validatedPathToSchemas = new PathToSchemasMap(); - ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, new LinkedHashSet<>()); - getPathToSchemas(this, castArg, validationMetadata, pathSet); - return castArg; - } - - public String validate(LocalDate arg, SchemaConfiguration configuration) throws ValidationException { - return validate(arg.toString(), configuration); - } - - public String validate(ZonedDateTime arg, SchemaConfiguration configuration) throws ValidationException { - return validate(arg.toString(), configuration); - } - - public String validate(UUID arg, SchemaConfiguration configuration) throws ValidationException { - return validate(arg.toString(), configuration); - } - - @Override - public FrozenList<@Nullable Object> getNewInstance(List arg, List pathToItem, PathToSchemasMap pathToSchemas) { - List<@Nullable Object> items = new ArrayList<>(); - int i = 0; - for (Object item: arg) { - List itemPathToItem = new ArrayList<>(pathToItem); - itemPathToItem.add(i); - LinkedHashMap, Nothing?> schemas = pathToSchemas.get(itemPathToItem); - if (schemas == null) { - throw new RuntimeException("Validation result is invalid, schemas must exist for a pathToItem"); - } - JsonSchema itemSchema = schemas.entrySet().iterator().next().getKey(); - @Nullable Object itemInstance = itemSchema.getNewInstance(item, itemPathToItem, pathToSchemas); - items.add(itemInstance); - i += 1; - } - FrozenList<@Nullable Object> newInstanceItems = new FrozenList<>(items); - return newInstanceItems; - } - - 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); - SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().build())); - ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, new PathToSchemasMap(), new LinkedHashSet<>()); - PathToSchemasMap pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet); - return getNewInstance(castArg, validationMetadata.pathToItem(), pathToSchemasMap); - } - - @Override - 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 RuntimeException("Invalid non-string key value"); - } - String propertyName = (String) entryKey; - List propertyPathToItem = new ArrayList<>(pathToItem); - propertyPathToItem.add(propertyName); - Object value = entry.getValue(); - LinkedHashMap, Nothing?> schemas = pathToSchemas.get(propertyPathToItem); - if (schemas == null) { - throw new RuntimeException("Validation result is invalid, schemas must exist for a pathToItem"); - } - JsonSchema propertySchema = schemas.entrySet().iterator().next().getKey(); - @Nullable Object propertyInstance = propertySchema.getNewInstance(value, propertyPathToItem, pathToSchemas); - properties.put(propertyName, propertyInstance); - } - FrozenMap<@Nullable Object> castProperties = new FrozenMap<>(properties); - return castProperties; - } - - public FrozenMap<@Nullable Object> validate(Map arg, SchemaConfiguration configuration) throws ValidationException { - Set> pathSet = new HashSet<>(); - List pathToItem = List.of("args[0]"); - Map castArg = castToAllowedTypes(arg, pathToItem, pathSet); - SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().build())); - PathToSchemasMap validatedPathToSchemas = new PathToSchemasMap(); - ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, new LinkedHashSet<>()); - PathToSchemasMap pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet); - return getNewInstance(castArg, validationMetadata.pathToItem(), pathToSchemasMap); - } - - @Override - public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { - if (arg == null) { - return validate((Nothing?) null, configuration); - } else if (arg instanceof Boolean) { - boolean boolArg = (Boolean) arg; - return validate(boolArg, configuration); - } else if (arg instanceof Number) { - return validate((Number) arg, configuration); - } else if (arg instanceof String) { - return validate((String) arg, configuration); - } else if (arg instanceof List) { - return validate((List) arg, 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"); - } - @Override - public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { - if (arg == null) { - return getNewInstance((Nothing?) null, pathToItem, pathToSchemas); - } else if (arg instanceof Boolean) { - boolean boolArg = (Boolean) arg; - return getNewInstance(boolArg, pathToItem, pathToSchemas); - } else if (arg instanceof Number) { - return getNewInstance((Number) arg, pathToItem, pathToSchemas); - } else if (arg instanceof String) { - return getNewInstance((String) arg, pathToItem, pathToSchemas); - } else if (arg instanceof List) { - return getNewInstance((List) arg, 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"); - } - @Override - public ComplexQuadrilateral1BoxedVoid validateAndBox(Nothing? arg, SchemaConfiguration configuration) throws ValidationException { - return new ComplexQuadrilateral1BoxedVoid(validate(arg, configuration)); - } - @Override - 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 { - return new ComplexQuadrilateral1BoxedNumber(validate(arg, configuration)); - } - @Override - 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 { - return new ComplexQuadrilateral1BoxedList(validate(arg, configuration)); - } - @Override - 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 { - if (arg == null) { - Nothing? castArg = (Nothing?) arg; - return validateAndBox(castArg, configuration); - } else if (arg instanceof Boolean booleanArg) { - boolean castArg = booleanArg; - return validateAndBox(castArg, configuration); - } else if (arg instanceof String castArg) { - return validateAndBox(castArg, configuration); - } else if (arg instanceof Number castArg) { - return validateAndBox(castArg, configuration); - } else if (arg instanceof List castArg) { - 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"); - } - } -} diff --git a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/schemas/ComposedAnyOfDifferentTypesNoValidations.kt b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/schemas/ComposedAnyOfDifferentTypesNoValidations.kt deleted file mode 100644 index fe0fbfb318f..00000000000 --- a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/schemas/ComposedAnyOfDifferentTypesNoValidations.kt +++ /dev/null @@ -1,693 +0,0 @@ -package org.openapijsonschematools.client.components.schemas; -import java.time.LocalDate; -import java.time.ZonedDateTime; -import java.util.ArrayList; -import java.util.HashSet; -import java.util.LinkedHashMap; -import java.util.LinkedHashSet; -import java.util.List; -import java.util.Map; -import java.util.Objects; -import java.util.Set; -import java.util.UUID; -import org.checkerframework.checker.nullness.qual.Nullable; -import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags; -import org.openapijsonschematools.client.configurations.SchemaConfiguration; -import org.openapijsonschematools.client.exceptions.InvalidAdditionalPropertyException; -import org.openapijsonschematools.client.exceptions.UnsetPropertyException; -import org.openapijsonschematools.client.exceptions.ValidationException; -import org.openapijsonschematools.client.schemas.AnyTypeJsonSchema; -import org.openapijsonschematools.client.schemas.BooleanJsonSchema; -import org.openapijsonschematools.client.schemas.DateJsonSchema; -import org.openapijsonschematools.client.schemas.DateTimeJsonSchema; -import org.openapijsonschematools.client.schemas.DoubleJsonSchema; -import org.openapijsonschematools.client.schemas.FloatJsonSchema; -import org.openapijsonschematools.client.schemas.Int32JsonSchema; -import org.openapijsonschematools.client.schemas.Int64JsonSchema; -import org.openapijsonschematools.client.schemas.IntJsonSchema; -import org.openapijsonschematools.client.schemas.MapJsonSchema; -import org.openapijsonschematools.client.schemas.NullJsonSchema; -import org.openapijsonschematools.client.schemas.NumberJsonSchema; -import org.openapijsonschematools.client.schemas.StringJsonSchema; -import org.openapijsonschematools.client.schemas.UnsetAddPropsSetter; -import org.openapijsonschematools.client.schemas.validation.BooleanSchemaValidator; -import org.openapijsonschematools.client.schemas.validation.FrozenList; -import org.openapijsonschematools.client.schemas.validation.FrozenMap; -import org.openapijsonschematools.client.schemas.validation.JsonSchema; -import org.openapijsonschematools.client.schemas.validation.JsonSchemaInfo; -import org.openapijsonschematools.client.schemas.validation.ListSchemaValidator; -import org.openapijsonschematools.client.schemas.validation.MapSchemaValidator; -import org.openapijsonschematools.client.schemas.validation.NullSchemaValidator; -import org.openapijsonschematools.client.schemas.validation.NumberSchemaValidator; -import org.openapijsonschematools.client.schemas.validation.PathToSchemasMap; -import org.openapijsonschematools.client.schemas.validation.StringSchemaValidator; -import org.openapijsonschematools.client.schemas.validation.ValidationMetadata; - -public class ComposedAnyOfDifferentTypesNoValidations { - // nest classes so all schemas and input/output classes can be public - - - public static class Schema0 extends MapJsonSchema.MapJsonSchema1 { - private static @Nullable Schema0 instance = null; - public static Schema0 getInstance() { - if (instance == null) { - instance = new Schema0(); - } - return instance; - } - } - - - public static class Schema1 extends DateJsonSchema.DateJsonSchema1 { - private static @Nullable Schema1 instance = null; - public static Schema1 getInstance() { - if (instance == null) { - instance = new Schema1(); - } - return instance; - } - } - - - public static class Schema2 extends DateTimeJsonSchema.DateTimeJsonSchema1 { - private static @Nullable Schema2 instance = null; - public static Schema2 getInstance() { - if (instance == null) { - instance = new Schema2(); - } - return instance; - } - } - - - public static class Schema3 extends StringJsonSchema.StringJsonSchema1 { - // BinarySchema - private static @Nullable Schema3 instance = null; - public static Schema3 getInstance() { - if (instance == null) { - instance = new Schema3(); - } - return instance; - } - } - - - public static class Schema4 extends StringJsonSchema.StringJsonSchema1 { - private static @Nullable Schema4 instance = null; - public static Schema4 getInstance() { - if (instance == null) { - instance = new Schema4(); - } - return instance; - } - } - - - public static class Schema5 extends StringJsonSchema.StringJsonSchema1 { - private static @Nullable Schema5 instance = null; - public static Schema5 getInstance() { - if (instance == null) { - instance = new Schema5(); - } - return instance; - } - } - - - public static class Schema6 extends MapJsonSchema.MapJsonSchema1 { - private static @Nullable Schema6 instance = null; - public static Schema6 getInstance() { - if (instance == null) { - instance = new Schema6(); - } - return instance; - } - } - - - public static class Schema7 extends BooleanJsonSchema.BooleanJsonSchema1 { - private static @Nullable Schema7 instance = null; - public static Schema7 getInstance() { - if (instance == null) { - instance = new Schema7(); - } - return instance; - } - } - - - public static class Schema8 extends NullJsonSchema.NullJsonSchema1 { - private static @Nullable Schema8 instance = null; - public static Schema8 getInstance() { - if (instance == null) { - instance = new Schema8(); - } - return instance; - } - } - - - public static class Items extends AnyTypeJsonSchema.AnyTypeJsonSchema1 { - private static @Nullable Items instance = null; - public static Items getInstance() { - if (instance == null) { - instance = new Items(); - } - return instance; - } - } - - - 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 { - return Schema9.getInstance().validate(arg, configuration); - } - } - - public static class Schema9ListBuilder { - // class to build List<@Nullable Object> - private final List<@Nullable Object> list; - - public Schema9ListBuilder() { - list = new ArrayList<>(); - } - - public Schema9ListBuilder(List<@Nullable Object> list) { - this.list = list; - } - - public Schema9ListBuilder add(Nothing? item) { - list.add(null); - return this; - } - - public Schema9ListBuilder add(boolean item) { - list.add(item); - return this; - } - - public Schema9ListBuilder add(String item) { - list.add(item); - return this; - } - - public Schema9ListBuilder add(int item) { - list.add(item); - return this; - } - - public Schema9ListBuilder add(float item) { - list.add(item); - return this; - } - - public Schema9ListBuilder add(long item) { - list.add(item); - return this; - } - - public Schema9ListBuilder add(double item) { - list.add(item); - return this; - } - - public Schema9ListBuilder add(List item) { - list.add(item); - return this; - } - - public Schema9ListBuilder add(Map item) { - list.add(item); - return this; - } - - public List<@Nullable Object> build() { - return list; - } - } - - - public sealed interface Schema9Boxed permits Schema9BoxedList { - @Nullable Object getData(); - } - - public record Schema9BoxedList(Schema9List data) implements Schema9Boxed { - @Override - public @Nullable Object getData() { - return data; - } - } - - - - public static class Schema9 extends JsonSchema implements ListSchemaValidator { - private static @Nullable Schema9 instance = null; - - protected Schema9() { - super(new JsonSchemaInfo() - .type(Set.of(List.class)) - .items(Items.class) - ); - } - - public static Schema9 getInstance() { - if (instance == null) { - instance = new Schema9(); - } - return instance; - } - - @Override - public Schema9List getNewInstance(List arg, List pathToItem, PathToSchemasMap pathToSchemas) { - List<@Nullable Object> items = new ArrayList<>(); - int i = 0; - for (Object item: arg) { - List itemPathToItem = new ArrayList<>(pathToItem); - itemPathToItem.add(i); - LinkedHashMap, Nothing?> schemas = pathToSchemas.get(itemPathToItem); - if (schemas == null) { - throw new RuntimeException("Validation result is invalid, schemas must exist for a pathToItem"); - } - JsonSchema itemSchema = schemas.entrySet().iterator().next().getKey(); - @Nullable Object itemInstance = itemSchema.getNewInstance(item, itemPathToItem, pathToSchemas); - items.add(itemInstance); - i += 1; - } - FrozenList<@Nullable Object> newInstanceItems = new FrozenList<>(items); - return new Schema9List(newInstanceItems); - } - - 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); - SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().build())); - ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, new PathToSchemasMap(), new LinkedHashSet<>()); - PathToSchemasMap pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet); - return getNewInstance(castArg, validationMetadata.pathToItem(), pathToSchemasMap); - } - - @Override - public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws 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"); - } - @Override - public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { - 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"); - } - @Override - 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 { - 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"); - } - } - - public static class Schema10 extends NumberJsonSchema.NumberJsonSchema1 { - private static @Nullable Schema10 instance = null; - public static Schema10 getInstance() { - if (instance == null) { - instance = new Schema10(); - } - return instance; - } - } - - - public static class Schema11 extends FloatJsonSchema.FloatJsonSchema1 { - private static @Nullable Schema11 instance = null; - public static Schema11 getInstance() { - if (instance == null) { - instance = new Schema11(); - } - return instance; - } - } - - - public static class Schema12 extends DoubleJsonSchema.DoubleJsonSchema1 { - private static @Nullable Schema12 instance = null; - public static Schema12 getInstance() { - if (instance == null) { - instance = new Schema12(); - } - return instance; - } - } - - - public static class Schema13 extends IntJsonSchema.IntJsonSchema1 { - private static @Nullable Schema13 instance = null; - public static Schema13 getInstance() { - if (instance == null) { - instance = new Schema13(); - } - return instance; - } - } - - - public static class Schema14 extends Int32JsonSchema.Int32JsonSchema1 { - private static @Nullable Schema14 instance = null; - public static Schema14 getInstance() { - if (instance == null) { - instance = new Schema14(); - } - return instance; - } - } - - - public static class Schema15 extends Int64JsonSchema.Int64JsonSchema1 { - private static @Nullable Schema15 instance = null; - public static Schema15 getInstance() { - if (instance == null) { - instance = new Schema15(); - } - return instance; - } - } - - - public sealed interface ComposedAnyOfDifferentTypesNoValidations1Boxed permits ComposedAnyOfDifferentTypesNoValidations1BoxedVoid, ComposedAnyOfDifferentTypesNoValidations1BoxedBoolean, ComposedAnyOfDifferentTypesNoValidations1BoxedNumber, ComposedAnyOfDifferentTypesNoValidations1BoxedString, ComposedAnyOfDifferentTypesNoValidations1BoxedList, ComposedAnyOfDifferentTypesNoValidations1BoxedMap { - @Nullable Object getData(); - } - - public record ComposedAnyOfDifferentTypesNoValidations1BoxedVoid(Nothing? data) implements ComposedAnyOfDifferentTypesNoValidations1Boxed { - @Override - public @Nullable Object getData() { - return data; - } - } - - public record ComposedAnyOfDifferentTypesNoValidations1BoxedBoolean(boolean data) implements ComposedAnyOfDifferentTypesNoValidations1Boxed { - @Override - public @Nullable Object getData() { - return data; - } - } - - public record ComposedAnyOfDifferentTypesNoValidations1BoxedNumber(Number data) implements ComposedAnyOfDifferentTypesNoValidations1Boxed { - @Override - public @Nullable Object getData() { - return data; - } - } - - public record ComposedAnyOfDifferentTypesNoValidations1BoxedString(String data) implements ComposedAnyOfDifferentTypesNoValidations1Boxed { - @Override - public @Nullable Object getData() { - return data; - } - } - - public record ComposedAnyOfDifferentTypesNoValidations1BoxedList(FrozenList<@Nullable Object> data) implements ComposedAnyOfDifferentTypesNoValidations1Boxed { - @Override - public @Nullable Object getData() { - return data; - } - } - - public record ComposedAnyOfDifferentTypesNoValidations1BoxedMap(FrozenMap<@Nullable Object> data) implements ComposedAnyOfDifferentTypesNoValidations1Boxed { - @Override - public @Nullable Object getData() { - return data; - } - } - - - public static class ComposedAnyOfDifferentTypesNoValidations1 extends JsonSchema implements NullSchemaValidator, BooleanSchemaValidator, NumberSchemaValidator, StringSchemaValidator, ListSchemaValidator, ComposedAnyOfDifferentTypesNoValidations1BoxedList>, MapSchemaValidator, ComposedAnyOfDifferentTypesNoValidations1BoxedMap> { - /* - NOTE: This class is auto generated by OpenAPI JSON Schema Generator. - Ref: https://github.com/openapi-json-schema-tools/openapi-json-schema-generator - - Do not edit the class manually. - */ - private static @Nullable ComposedAnyOfDifferentTypesNoValidations1 instance = null; - - protected ComposedAnyOfDifferentTypesNoValidations1() { - super(new JsonSchemaInfo() - .anyOf(List.of( - Schema0.class, - Schema1.class, - Schema2.class, - Schema3.class, - Schema4.class, - Schema5.class, - Schema6.class, - Schema7.class, - Schema8.class, - Schema9.class, - Schema10.class, - Schema11.class, - Schema12.class, - Schema13.class, - Schema14.class, - Schema15.class - )) - ); - } - - public static ComposedAnyOfDifferentTypesNoValidations1 getInstance() { - if (instance == null) { - instance = new ComposedAnyOfDifferentTypesNoValidations1(); - } - return instance; - } - - @Override - public Nothing? validate(Nothing? arg, SchemaConfiguration configuration) throws ValidationException { - Set> pathSet = new HashSet<>(); - List pathToItem = List.of("args[0]"); - Nothing? castArg = castToAllowedTypes(arg, pathToItem, pathSet); - SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().build())); - PathToSchemasMap validatedPathToSchemas = new PathToSchemasMap(); - ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, new LinkedHashSet<>()); - getPathToSchemas(this, castArg, validationMetadata, pathSet); - return castArg; - } - - @Override - public boolean validate(boolean arg, SchemaConfiguration configuration) throws ValidationException { - Set> pathSet = new HashSet<>(); - List pathToItem = List.of("args[0]"); - boolean castArg = castToAllowedTypes(arg, pathToItem, pathSet); - SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().build())); - PathToSchemasMap validatedPathToSchemas = new PathToSchemasMap(); - ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, new LinkedHashSet<>()); - getPathToSchemas(this, castArg, validationMetadata, pathSet); - return castArg; - } - - @Override - public Number validate(Number arg, SchemaConfiguration configuration) throws ValidationException { - Set> pathSet = new HashSet<>(); - List pathToItem = List.of("args[0]"); - Number castArg = castToAllowedTypes(arg, pathToItem, pathSet); - SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().build())); - PathToSchemasMap validatedPathToSchemas = new PathToSchemasMap(); - ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, new LinkedHashSet<>()); - getPathToSchemas(this, castArg, validationMetadata, pathSet); - return castArg; - } - - public int validate(int arg, SchemaConfiguration configuration) throws ValidationException { - return (int) validate((Number) arg, configuration); - } - - public long validate(long arg, SchemaConfiguration configuration) throws ValidationException { - return (long) validate((Number) arg, configuration); - } - - public float validate(float arg, SchemaConfiguration configuration) throws ValidationException { - return (float) validate((Number) arg, configuration); - } - - public double validate(double arg, SchemaConfiguration configuration) throws ValidationException { - return (double) validate((Number) arg, configuration); - } - - @Override - public String validate(String arg, SchemaConfiguration configuration) throws ValidationException { - Set> pathSet = new HashSet<>(); - List pathToItem = List.of("args[0]"); - String castArg = castToAllowedTypes(arg, pathToItem, pathSet); - SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().build())); - PathToSchemasMap validatedPathToSchemas = new PathToSchemasMap(); - ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, new LinkedHashSet<>()); - getPathToSchemas(this, castArg, validationMetadata, pathSet); - return castArg; - } - - public String validate(LocalDate arg, SchemaConfiguration configuration) throws ValidationException { - return validate(arg.toString(), configuration); - } - - public String validate(ZonedDateTime arg, SchemaConfiguration configuration) throws ValidationException { - return validate(arg.toString(), configuration); - } - - public String validate(UUID arg, SchemaConfiguration configuration) throws ValidationException { - return validate(arg.toString(), configuration); - } - - @Override - public FrozenList<@Nullable Object> getNewInstance(List arg, List pathToItem, PathToSchemasMap pathToSchemas) { - List<@Nullable Object> items = new ArrayList<>(); - int i = 0; - for (Object item: arg) { - List itemPathToItem = new ArrayList<>(pathToItem); - itemPathToItem.add(i); - LinkedHashMap, Nothing?> schemas = pathToSchemas.get(itemPathToItem); - if (schemas == null) { - throw new RuntimeException("Validation result is invalid, schemas must exist for a pathToItem"); - } - JsonSchema itemSchema = schemas.entrySet().iterator().next().getKey(); - @Nullable Object itemInstance = itemSchema.getNewInstance(item, itemPathToItem, pathToSchemas); - items.add(itemInstance); - i += 1; - } - FrozenList<@Nullable Object> newInstanceItems = new FrozenList<>(items); - return newInstanceItems; - } - - 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); - SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().build())); - ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, new PathToSchemasMap(), new LinkedHashSet<>()); - PathToSchemasMap pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet); - return getNewInstance(castArg, validationMetadata.pathToItem(), pathToSchemasMap); - } - - @Override - 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 RuntimeException("Invalid non-string key value"); - } - String propertyName = (String) entryKey; - List propertyPathToItem = new ArrayList<>(pathToItem); - propertyPathToItem.add(propertyName); - Object value = entry.getValue(); - LinkedHashMap, Nothing?> schemas = pathToSchemas.get(propertyPathToItem); - if (schemas == null) { - throw new RuntimeException("Validation result is invalid, schemas must exist for a pathToItem"); - } - JsonSchema propertySchema = schemas.entrySet().iterator().next().getKey(); - @Nullable Object propertyInstance = propertySchema.getNewInstance(value, propertyPathToItem, pathToSchemas); - properties.put(propertyName, propertyInstance); - } - FrozenMap<@Nullable Object> castProperties = new FrozenMap<>(properties); - return castProperties; - } - - public FrozenMap<@Nullable Object> validate(Map arg, SchemaConfiguration configuration) throws ValidationException { - Set> pathSet = new HashSet<>(); - List pathToItem = List.of("args[0]"); - Map castArg = castToAllowedTypes(arg, pathToItem, pathSet); - SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().build())); - PathToSchemasMap validatedPathToSchemas = new PathToSchemasMap(); - ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, new LinkedHashSet<>()); - PathToSchemasMap pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet); - return getNewInstance(castArg, validationMetadata.pathToItem(), pathToSchemasMap); - } - - @Override - public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { - if (arg == null) { - return validate((Nothing?) null, configuration); - } else if (arg instanceof Boolean) { - boolean boolArg = (Boolean) arg; - return validate(boolArg, configuration); - } else if (arg instanceof Number) { - return validate((Number) arg, configuration); - } else if (arg instanceof String) { - return validate((String) arg, configuration); - } else if (arg instanceof List) { - return validate((List) arg, 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"); - } - @Override - public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { - if (arg == null) { - return getNewInstance((Nothing?) null, pathToItem, pathToSchemas); - } else if (arg instanceof Boolean) { - boolean boolArg = (Boolean) arg; - return getNewInstance(boolArg, pathToItem, pathToSchemas); - } else if (arg instanceof Number) { - return getNewInstance((Number) arg, pathToItem, pathToSchemas); - } else if (arg instanceof String) { - return getNewInstance((String) arg, pathToItem, pathToSchemas); - } else if (arg instanceof List) { - return getNewInstance((List) arg, 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"); - } - @Override - public ComposedAnyOfDifferentTypesNoValidations1BoxedVoid validateAndBox(Nothing? arg, SchemaConfiguration configuration) throws ValidationException { - return new ComposedAnyOfDifferentTypesNoValidations1BoxedVoid(validate(arg, configuration)); - } - @Override - 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 { - return new ComposedAnyOfDifferentTypesNoValidations1BoxedNumber(validate(arg, configuration)); - } - @Override - 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 { - return new ComposedAnyOfDifferentTypesNoValidations1BoxedList(validate(arg, configuration)); - } - @Override - 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 { - if (arg == null) { - Nothing? castArg = (Nothing?) arg; - return validateAndBox(castArg, configuration); - } else if (arg instanceof Boolean booleanArg) { - boolean castArg = booleanArg; - return validateAndBox(castArg, configuration); - } else if (arg instanceof String castArg) { - return validateAndBox(castArg, configuration); - } else if (arg instanceof Number castArg) { - return validateAndBox(castArg, configuration); - } else if (arg instanceof List castArg) { - 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"); - } - } -} diff --git a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/schemas/ComposedArray.kt b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/schemas/ComposedArray.kt deleted file mode 100644 index 1bc378734b8..00000000000 --- a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/schemas/ComposedArray.kt +++ /dev/null @@ -1,201 +0,0 @@ -package org.openapijsonschematools.client.components.schemas; -import java.util.ArrayList; -import java.util.HashSet; -import java.util.LinkedHashMap; -import java.util.LinkedHashSet; -import java.util.List; -import java.util.Map; -import java.util.Objects; -import java.util.Set; -import org.checkerframework.checker.nullness.qual.Nullable; -import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags; -import org.openapijsonschematools.client.configurations.SchemaConfiguration; -import org.openapijsonschematools.client.exceptions.ValidationException; -import org.openapijsonschematools.client.schemas.AnyTypeJsonSchema; -import org.openapijsonschematools.client.schemas.validation.FrozenList; -import org.openapijsonschematools.client.schemas.validation.JsonSchema; -import org.openapijsonschematools.client.schemas.validation.JsonSchemaInfo; -import org.openapijsonschematools.client.schemas.validation.ListSchemaValidator; -import org.openapijsonschematools.client.schemas.validation.PathToSchemasMap; -import org.openapijsonschematools.client.schemas.validation.ValidationMetadata; - -public class ComposedArray { - // nest classes so all schemas and input/output classes can be public - - - public static class Items extends AnyTypeJsonSchema.AnyTypeJsonSchema1 { - private static @Nullable Items instance = null; - public static Items getInstance() { - if (instance == null) { - instance = new Items(); - } - return instance; - } - } - - - 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 { - return ComposedArray1.getInstance().validate(arg, configuration); - } - } - - public static class ComposedArrayListBuilder { - // class to build List<@Nullable Object> - private final List<@Nullable Object> list; - - public ComposedArrayListBuilder() { - list = new ArrayList<>(); - } - - public ComposedArrayListBuilder(List<@Nullable Object> list) { - this.list = list; - } - - public ComposedArrayListBuilder add(Nothing? item) { - list.add(null); - return this; - } - - public ComposedArrayListBuilder add(boolean item) { - list.add(item); - return this; - } - - public ComposedArrayListBuilder add(String item) { - list.add(item); - return this; - } - - public ComposedArrayListBuilder add(int item) { - list.add(item); - return this; - } - - public ComposedArrayListBuilder add(float item) { - list.add(item); - return this; - } - - public ComposedArrayListBuilder add(long item) { - list.add(item); - return this; - } - - public ComposedArrayListBuilder add(double item) { - list.add(item); - return this; - } - - public ComposedArrayListBuilder add(List item) { - list.add(item); - return this; - } - - public ComposedArrayListBuilder add(Map item) { - list.add(item); - return this; - } - - public List<@Nullable Object> build() { - return list; - } - } - - - public sealed interface ComposedArray1Boxed permits ComposedArray1BoxedList { - @Nullable Object getData(); - } - - public record ComposedArray1BoxedList(ComposedArrayList data) implements ComposedArray1Boxed { - @Override - public @Nullable Object getData() { - return data; - } - } - - - - public static class ComposedArray1 extends JsonSchema implements ListSchemaValidator { - /* - NOTE: This class is auto generated by OpenAPI JSON Schema Generator. - Ref: https://github.com/openapi-json-schema-tools/openapi-json-schema-generator - - Do not edit the class manually. - */ - private static @Nullable ComposedArray1 instance = null; - - protected ComposedArray1() { - super(new JsonSchemaInfo() - .type(Set.of(List.class)) - .items(Items.class) - ); - } - - public static ComposedArray1 getInstance() { - if (instance == null) { - instance = new ComposedArray1(); - } - return instance; - } - - @Override - public ComposedArrayList getNewInstance(List arg, List pathToItem, PathToSchemasMap pathToSchemas) { - List<@Nullable Object> items = new ArrayList<>(); - int i = 0; - for (Object item: arg) { - List itemPathToItem = new ArrayList<>(pathToItem); - itemPathToItem.add(i); - LinkedHashMap, Nothing?> schemas = pathToSchemas.get(itemPathToItem); - if (schemas == null) { - throw new RuntimeException("Validation result is invalid, schemas must exist for a pathToItem"); - } - JsonSchema itemSchema = schemas.entrySet().iterator().next().getKey(); - @Nullable Object itemInstance = itemSchema.getNewInstance(item, itemPathToItem, pathToSchemas); - items.add(itemInstance); - i += 1; - } - FrozenList<@Nullable Object> newInstanceItems = new FrozenList<>(items); - return new ComposedArrayList(newInstanceItems); - } - - 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); - SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().build())); - ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, new PathToSchemasMap(), new LinkedHashSet<>()); - PathToSchemasMap pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet); - return getNewInstance(castArg, validationMetadata.pathToItem(), pathToSchemasMap); - } - - @Override - public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws 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"); - } - @Override - public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { - 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"); - } - @Override - 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 { - 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"); - } - } -} diff --git a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/schemas/ComposedBool.kt b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/schemas/ComposedBool.kt deleted file mode 100644 index 6e3fc408ed7..00000000000 --- a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/schemas/ComposedBool.kt +++ /dev/null @@ -1,111 +0,0 @@ -package org.openapijsonschematools.client.components.schemas; -import java.util.HashSet; -import java.util.LinkedHashSet; -import java.util.List; -import java.util.Objects; -import java.util.Set; -import org.checkerframework.checker.nullness.qual.Nullable; -import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags; -import org.openapijsonschematools.client.configurations.SchemaConfiguration; -import org.openapijsonschematools.client.exceptions.ValidationException; -import org.openapijsonschematools.client.schemas.AnyTypeJsonSchema; -import org.openapijsonschematools.client.schemas.validation.BooleanSchemaValidator; -import org.openapijsonschematools.client.schemas.validation.JsonSchema; -import org.openapijsonschematools.client.schemas.validation.JsonSchemaInfo; -import org.openapijsonschematools.client.schemas.validation.PathToSchemasMap; -import org.openapijsonschematools.client.schemas.validation.ValidationMetadata; - -public class ComposedBool { - // nest classes so all schemas and input/output classes can be public - - - public static class Schema0 extends AnyTypeJsonSchema.AnyTypeJsonSchema1 { - private static @Nullable Schema0 instance = null; - public static Schema0 getInstance() { - if (instance == null) { - instance = new Schema0(); - } - return instance; - } - } - - - public sealed interface ComposedBool1Boxed permits ComposedBool1BoxedBoolean { - @Nullable Object getData(); - } - - public record ComposedBool1BoxedBoolean(boolean data) implements ComposedBool1Boxed { - @Override - public @Nullable Object getData() { - return data; - } - } - - - - public static class ComposedBool1 extends JsonSchema implements BooleanSchemaValidator { - /* - NOTE: This class is auto generated by OpenAPI JSON Schema Generator. - Ref: https://github.com/openapi-json-schema-tools/openapi-json-schema-generator - - Do not edit the class manually. - */ - private static @Nullable ComposedBool1 instance = null; - - protected ComposedBool1() { - super(new JsonSchemaInfo() - .type(Set.of(Boolean.class)) - .allOf(List.of( - Schema0.class - )) - ); - } - - public static ComposedBool1 getInstance() { - if (instance == null) { - instance = new ComposedBool1(); - } - return instance; - } - - @Override - public boolean validate(boolean arg, SchemaConfiguration configuration) throws ValidationException { - Set> pathSet = new HashSet<>(); - List pathToItem = List.of("args[0"); - boolean castArg = castToAllowedTypes(arg, pathToItem, pathSet); - SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().build())); - ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, new PathToSchemasMap(), new LinkedHashSet<>()); - getPathToSchemas(this, castArg, validationMetadata, pathSet); - return castArg; - } - - @Override - 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 ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); - } - @Override - 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 RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); - } - @Override - 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 { - 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"); - } - } -} diff --git a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/schemas/ComposedNone.kt b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/schemas/ComposedNone.kt deleted file mode 100644 index c9aa0cbd2bf..00000000000 --- a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/schemas/ComposedNone.kt +++ /dev/null @@ -1,109 +0,0 @@ -package org.openapijsonschematools.client.components.schemas; -import java.util.HashSet; -import java.util.LinkedHashSet; -import java.util.List; -import java.util.Objects; -import java.util.Set; -import org.checkerframework.checker.nullness.qual.Nullable; -import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags; -import org.openapijsonschematools.client.configurations.SchemaConfiguration; -import org.openapijsonschematools.client.exceptions.ValidationException; -import org.openapijsonschematools.client.schemas.AnyTypeJsonSchema; -import org.openapijsonschematools.client.schemas.validation.JsonSchema; -import org.openapijsonschematools.client.schemas.validation.JsonSchemaInfo; -import org.openapijsonschematools.client.schemas.validation.NullSchemaValidator; -import org.openapijsonschematools.client.schemas.validation.PathToSchemasMap; -import org.openapijsonschematools.client.schemas.validation.ValidationMetadata; - -public class ComposedNone { - // nest classes so all schemas and input/output classes can be public - - - public static class Schema0 extends AnyTypeJsonSchema.AnyTypeJsonSchema1 { - private static @Nullable Schema0 instance = null; - public static Schema0 getInstance() { - if (instance == null) { - instance = new Schema0(); - } - return instance; - } - } - - - public sealed interface ComposedNone1Boxed permits ComposedNone1BoxedNothing? { - @Nullable Object getData(); - } - - public record ComposedNone1BoxedVoid(Nothing? data) implements ComposedNone1Boxed { - @Override - public @Nullable Object getData() { - return data; - } - } - - - - public static class ComposedNone1 extends JsonSchema implements NullSchemaValidator { - /* - NOTE: This class is auto generated by OpenAPI JSON Schema Generator. - Ref: https://github.com/openapi-json-schema-tools/openapi-json-schema-generator - - Do not edit the class manually. - */ - private static @Nullable ComposedNone1 instance = null; - - protected ComposedNone1() { - super(new JsonSchemaInfo() - .type(Set.of(Nothing?.class)) - .allOf(List.of( - Schema0.class - )) - ); - } - - public static ComposedNone1 getInstance() { - if (instance == null) { - instance = new ComposedNone1(); - } - return instance; - } - - @Override - public Nothing? validate(Nothing? arg, SchemaConfiguration configuration) throws ValidationException { - Set> pathSet = new HashSet<>(); - List pathToItem = List.of("args[0"); - Nothing? castArg = castToAllowedTypes(arg, pathToItem, pathSet); - SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().build())); - ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, new PathToSchemasMap(), new LinkedHashSet<>()); - getPathToSchemas(this, castArg, validationMetadata, pathSet); - return castArg; - } - - @Override - public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { - if (arg == null) { - return validate((Nothing?) null, configuration); - } - throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); - } - @Override - public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { - if (arg == null) { - return getNewInstance((Nothing?) null, pathToItem, pathToSchemas); - } - throw new RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); - } - @Override - public ComposedNone1BoxedVoid validateAndBox(Nothing? arg, SchemaConfiguration configuration) throws ValidationException { - return new ComposedNone1BoxedVoid(validate(arg, configuration)); - } - @Override - public ComposedNone1Boxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { - if (arg == null) { - Nothing? castArg = (Nothing?) arg; - return validateAndBox(castArg, configuration); - } - throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); - } - } -} diff --git a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/schemas/ComposedNumber.kt b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/schemas/ComposedNumber.kt deleted file mode 100644 index 44bb713e4de..00000000000 --- a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/schemas/ComposedNumber.kt +++ /dev/null @@ -1,129 +0,0 @@ -package org.openapijsonschematools.client.components.schemas; -import java.util.HashSet; -import java.util.LinkedHashSet; -import java.util.List; -import java.util.Objects; -import java.util.Set; -import org.checkerframework.checker.nullness.qual.Nullable; -import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags; -import org.openapijsonschematools.client.configurations.SchemaConfiguration; -import org.openapijsonschematools.client.exceptions.ValidationException; -import org.openapijsonschematools.client.schemas.AnyTypeJsonSchema; -import org.openapijsonschematools.client.schemas.validation.JsonSchema; -import org.openapijsonschematools.client.schemas.validation.JsonSchemaInfo; -import org.openapijsonschematools.client.schemas.validation.NumberSchemaValidator; -import org.openapijsonschematools.client.schemas.validation.PathToSchemasMap; -import org.openapijsonschematools.client.schemas.validation.ValidationMetadata; - -public class ComposedNumber { - // nest classes so all schemas and input/output classes can be public - - - public static class Schema0 extends AnyTypeJsonSchema.AnyTypeJsonSchema1 { - private static @Nullable Schema0 instance = null; - public static Schema0 getInstance() { - if (instance == null) { - instance = new Schema0(); - } - return instance; - } - } - - - public sealed interface ComposedNumber1Boxed permits ComposedNumber1BoxedNumber { - @Nullable Object getData(); - } - - public record ComposedNumber1BoxedNumber(Number data) implements ComposedNumber1Boxed { - @Override - public @Nullable Object getData() { - return data; - } - } - - - - public static class ComposedNumber1 extends JsonSchema implements NumberSchemaValidator { - /* - NOTE: This class is auto generated by OpenAPI JSON Schema Generator. - Ref: https://github.com/openapi-json-schema-tools/openapi-json-schema-generator - - Do not edit the class manually. - */ - private static @Nullable ComposedNumber1 instance = null; - - protected ComposedNumber1() { - super(new JsonSchemaInfo() - .type(Set.of( - Integer.class, - Long.class, - Float.class, - Double.class - )) - .allOf(List.of( - Schema0.class - )) - ); - } - - public static ComposedNumber1 getInstance() { - if (instance == null) { - instance = new ComposedNumber1(); - } - return instance; - } - - @Override - public Number validate(Number arg, SchemaConfiguration configuration) throws ValidationException { - Set> pathSet = new HashSet<>(); - List pathToItem = List.of("args[0"); - Number castArg = castToAllowedTypes(arg, pathToItem, pathSet); - SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().build())); - ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, new PathToSchemasMap(), new LinkedHashSet<>()); - PathToSchemasMap pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet); - return castArg; - } - - public int validate(int arg, SchemaConfiguration configuration) throws ValidationException { - return (int) validate((Number) arg, configuration); - } - - public long validate(long arg, SchemaConfiguration configuration) throws ValidationException { - return (long) validate((Number) arg, configuration); - } - - public float validate(float arg, SchemaConfiguration configuration) throws ValidationException { - return (float) validate((Number) arg, configuration); - } - - 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 { - 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"); - } - @Override - public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { - 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"); - } - @Override - 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 { - 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"); - } - } -} diff --git a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/schemas/ComposedObject.kt b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/schemas/ComposedObject.kt deleted file mode 100644 index 3a641bad085..00000000000 --- a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/schemas/ComposedObject.kt +++ /dev/null @@ -1,138 +0,0 @@ -package org.openapijsonschematools.client.components.schemas; -import java.util.ArrayList; -import java.util.HashSet; -import java.util.LinkedHashMap; -import java.util.LinkedHashSet; -import java.util.List; -import java.util.Map; -import java.util.Objects; -import java.util.Set; -import org.checkerframework.checker.nullness.qual.Nullable; -import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags; -import org.openapijsonschematools.client.configurations.SchemaConfiguration; -import org.openapijsonschematools.client.exceptions.InvalidAdditionalPropertyException; -import org.openapijsonschematools.client.exceptions.UnsetPropertyException; -import org.openapijsonschematools.client.exceptions.ValidationException; -import org.openapijsonschematools.client.schemas.AnyTypeJsonSchema; -import org.openapijsonschematools.client.schemas.UnsetAddPropsSetter; -import org.openapijsonschematools.client.schemas.validation.FrozenMap; -import org.openapijsonschematools.client.schemas.validation.JsonSchema; -import org.openapijsonschematools.client.schemas.validation.JsonSchemaInfo; -import org.openapijsonschematools.client.schemas.validation.MapSchemaValidator; -import org.openapijsonschematools.client.schemas.validation.PathToSchemasMap; -import org.openapijsonschematools.client.schemas.validation.ValidationMetadata; - -public class ComposedObject { - // nest classes so all schemas and input/output classes can be public - - - public static class Schema0 extends AnyTypeJsonSchema.AnyTypeJsonSchema1 { - private static @Nullable Schema0 instance = null; - public static Schema0 getInstance() { - if (instance == null) { - instance = new Schema0(); - } - return instance; - } - } - - - public sealed interface ComposedObject1Boxed permits ComposedObject1BoxedMap { - @Nullable Object getData(); - } - - public record ComposedObject1BoxedMap(FrozenMap<@Nullable Object> data) implements ComposedObject1Boxed { - @Override - public @Nullable Object getData() { - return data; - } - } - - - public static class ComposedObject1 extends JsonSchema implements MapSchemaValidator, ComposedObject1BoxedMap> { - /* - NOTE: This class is auto generated by OpenAPI JSON Schema Generator. - Ref: https://github.com/openapi-json-schema-tools/openapi-json-schema-generator - - Do not edit the class manually. - */ - private static @Nullable ComposedObject1 instance = null; - - protected ComposedObject1() { - super(new JsonSchemaInfo() - .type(Set.of(Map.class)) - .allOf(List.of( - Schema0.class - )) - ); - } - - public static ComposedObject1 getInstance() { - if (instance == null) { - instance = new ComposedObject1(); - } - return instance; - } - - 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 RuntimeException("Invalid non-string key value"); - } - String propertyName = (String) entryKey; - List propertyPathToItem = new ArrayList<>(pathToItem); - propertyPathToItem.add(propertyName); - Object value = entry.getValue(); - LinkedHashMap, Nothing?> schemas = pathToSchemas.get(propertyPathToItem); - if (schemas == null) { - throw new RuntimeException("Validation result is invalid, schemas must exist for a pathToItem"); - } - JsonSchema propertySchema = schemas.entrySet().iterator().next().getKey(); - @Nullable Object propertyInstance = propertySchema.getNewInstance(value, propertyPathToItem, pathToSchemas); - properties.put(propertyName, propertyInstance); - } - FrozenMap<@Nullable Object> castProperties = new FrozenMap<>(properties); - return castProperties; - } - - public FrozenMap<@Nullable Object> validate(Map arg, SchemaConfiguration configuration) throws ValidationException { - Set> pathSet = new HashSet<>(); - List pathToItem = List.of("args[0"); - Map castArg = castToAllowedTypes(arg, pathToItem, pathSet); - SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().build())); - ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, new PathToSchemasMap(), new LinkedHashSet<>()); - PathToSchemasMap pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet); - return getNewInstance(castArg, validationMetadata.pathToItem(), pathToSchemasMap); - } - - - @Override - public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws 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"); - } - @Override - public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { - if (arg instanceof Map) { - return getNewInstance((Map) arg, pathToItem, pathToSchemas); - } - 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 { - return new ComposedObject1BoxedMap(validate(arg, configuration)); - } - @Override - public ComposedObject1Boxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { - 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"); - } - } - -} diff --git a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/schemas/ComposedOneOfDifferentTypes.kt b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/schemas/ComposedOneOfDifferentTypes.kt deleted file mode 100644 index 56e644f0af4..00000000000 --- a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/schemas/ComposedOneOfDifferentTypes.kt +++ /dev/null @@ -1,700 +0,0 @@ -package org.openapijsonschematools.client.components.schemas; -import java.time.LocalDate; -import java.time.ZonedDateTime; -import java.util.ArrayList; -import java.util.HashSet; -import java.util.LinkedHashMap; -import java.util.LinkedHashSet; -import java.util.List; -import java.util.Map; -import java.util.Objects; -import java.util.Set; -import java.util.UUID; -import java.util.regex.Pattern; -import org.checkerframework.checker.nullness.qual.Nullable; -import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags; -import org.openapijsonschematools.client.configurations.SchemaConfiguration; -import org.openapijsonschematools.client.exceptions.InvalidAdditionalPropertyException; -import org.openapijsonschematools.client.exceptions.UnsetPropertyException; -import org.openapijsonschematools.client.exceptions.ValidationException; -import org.openapijsonschematools.client.schemas.AnyTypeJsonSchema; -import org.openapijsonschematools.client.schemas.DateJsonSchema; -import org.openapijsonschematools.client.schemas.NullJsonSchema; -import org.openapijsonschematools.client.schemas.UnsetAddPropsSetter; -import org.openapijsonschematools.client.schemas.validation.BooleanSchemaValidator; -import org.openapijsonschematools.client.schemas.validation.FrozenList; -import org.openapijsonschematools.client.schemas.validation.FrozenMap; -import org.openapijsonschematools.client.schemas.validation.JsonSchema; -import org.openapijsonschematools.client.schemas.validation.JsonSchemaInfo; -import org.openapijsonschematools.client.schemas.validation.ListSchemaValidator; -import org.openapijsonschematools.client.schemas.validation.MapSchemaValidator; -import org.openapijsonschematools.client.schemas.validation.NullSchemaValidator; -import org.openapijsonschematools.client.schemas.validation.NumberSchemaValidator; -import org.openapijsonschematools.client.schemas.validation.PathToSchemasMap; -import org.openapijsonschematools.client.schemas.validation.StringSchemaValidator; -import org.openapijsonschematools.client.schemas.validation.ValidationMetadata; - -public class ComposedOneOfDifferentTypes { - // nest classes so all schemas and input/output classes can be public - - - public static class Schema2 extends NullJsonSchema.NullJsonSchema1 { - private static @Nullable Schema2 instance = null; - public static Schema2 getInstance() { - if (instance == null) { - instance = new Schema2(); - } - return instance; - } - } - - - public static class Schema3 extends DateJsonSchema.DateJsonSchema1 { - private static @Nullable Schema3 instance = null; - public static Schema3 getInstance() { - if (instance == null) { - instance = new Schema3(); - } - return instance; - } - } - - - public sealed interface Schema4Boxed permits Schema4BoxedMap { - @Nullable Object getData(); - } - - public record Schema4BoxedMap(FrozenMap<@Nullable Object> data) implements Schema4Boxed { - @Override - public @Nullable Object getData() { - return data; - } - } - - - public static class Schema4 extends JsonSchema implements MapSchemaValidator, Schema4BoxedMap> { - private static @Nullable Schema4 instance = null; - - protected Schema4() { - super(new JsonSchemaInfo() - .type(Set.of(Map.class)) - .maxProperties(4) - .minProperties(4) - ); - } - - public static Schema4 getInstance() { - if (instance == null) { - instance = new Schema4(); - } - return instance; - } - - 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 RuntimeException("Invalid non-string key value"); - } - String propertyName = (String) entryKey; - List propertyPathToItem = new ArrayList<>(pathToItem); - propertyPathToItem.add(propertyName); - Object value = entry.getValue(); - LinkedHashMap, Nothing?> schemas = pathToSchemas.get(propertyPathToItem); - if (schemas == null) { - throw new RuntimeException("Validation result is invalid, schemas must exist for a pathToItem"); - } - JsonSchema propertySchema = schemas.entrySet().iterator().next().getKey(); - @Nullable Object propertyInstance = propertySchema.getNewInstance(value, propertyPathToItem, pathToSchemas); - properties.put(propertyName, propertyInstance); - } - FrozenMap<@Nullable Object> castProperties = new FrozenMap<>(properties); - return castProperties; - } - - public FrozenMap<@Nullable Object> validate(Map arg, SchemaConfiguration configuration) throws ValidationException { - Set> pathSet = new HashSet<>(); - List pathToItem = List.of("args[0"); - Map castArg = castToAllowedTypes(arg, pathToItem, pathSet); - SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().build())); - ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, new PathToSchemasMap(), new LinkedHashSet<>()); - PathToSchemasMap pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet); - return getNewInstance(castArg, validationMetadata.pathToItem(), pathToSchemasMap); - } - - - @Override - public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws 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"); - } - @Override - public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { - if (arg instanceof Map) { - return getNewInstance((Map) arg, pathToItem, pathToSchemas); - } - 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 { - return new Schema4BoxedMap(validate(arg, configuration)); - } - @Override - public Schema4Boxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { - 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"); - } - } - - - public static class Items extends AnyTypeJsonSchema.AnyTypeJsonSchema1 { - private static @Nullable Items instance = null; - public static Items getInstance() { - if (instance == null) { - instance = new Items(); - } - return instance; - } - } - - - 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 { - return Schema5.getInstance().validate(arg, configuration); - } - } - - public static class Schema5ListBuilder { - // class to build List<@Nullable Object> - private final List<@Nullable Object> list; - - public Schema5ListBuilder() { - list = new ArrayList<>(); - } - - public Schema5ListBuilder(List<@Nullable Object> list) { - this.list = list; - } - - public Schema5ListBuilder add(Nothing? item) { - list.add(null); - return this; - } - - public Schema5ListBuilder add(boolean item) { - list.add(item); - return this; - } - - public Schema5ListBuilder add(String item) { - list.add(item); - return this; - } - - public Schema5ListBuilder add(int item) { - list.add(item); - return this; - } - - public Schema5ListBuilder add(float item) { - list.add(item); - return this; - } - - public Schema5ListBuilder add(long item) { - list.add(item); - return this; - } - - public Schema5ListBuilder add(double item) { - list.add(item); - return this; - } - - public Schema5ListBuilder add(List item) { - list.add(item); - return this; - } - - public Schema5ListBuilder add(Map item) { - list.add(item); - return this; - } - - public List<@Nullable Object> build() { - return list; - } - } - - - public sealed interface Schema5Boxed permits Schema5BoxedList { - @Nullable Object getData(); - } - - public record Schema5BoxedList(Schema5List data) implements Schema5Boxed { - @Override - public @Nullable Object getData() { - return data; - } - } - - - - public static class Schema5 extends JsonSchema implements ListSchemaValidator { - private static @Nullable Schema5 instance = null; - - protected Schema5() { - super(new JsonSchemaInfo() - .type(Set.of(List.class)) - .items(Items.class) - .maxItems(4) - .minItems(4) - ); - } - - public static Schema5 getInstance() { - if (instance == null) { - instance = new Schema5(); - } - return instance; - } - - @Override - public Schema5List getNewInstance(List arg, List pathToItem, PathToSchemasMap pathToSchemas) { - List<@Nullable Object> items = new ArrayList<>(); - int i = 0; - for (Object item: arg) { - List itemPathToItem = new ArrayList<>(pathToItem); - itemPathToItem.add(i); - LinkedHashMap, Nothing?> schemas = pathToSchemas.get(itemPathToItem); - if (schemas == null) { - throw new RuntimeException("Validation result is invalid, schemas must exist for a pathToItem"); - } - JsonSchema itemSchema = schemas.entrySet().iterator().next().getKey(); - @Nullable Object itemInstance = itemSchema.getNewInstance(item, itemPathToItem, pathToSchemas); - items.add(itemInstance); - i += 1; - } - FrozenList<@Nullable Object> newInstanceItems = new FrozenList<>(items); - return new Schema5List(newInstanceItems); - } - - 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); - SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().build())); - ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, new PathToSchemasMap(), new LinkedHashSet<>()); - PathToSchemasMap pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet); - return getNewInstance(castArg, validationMetadata.pathToItem(), pathToSchemasMap); - } - - @Override - public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws 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"); - } - @Override - public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { - 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"); - } - @Override - 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 { - 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"); - } - } - - public sealed interface Schema6Boxed permits Schema6BoxedString { - @Nullable Object getData(); - } - - public record Schema6BoxedString(String data) implements Schema6Boxed { - @Override - public @Nullable Object getData() { - return data; - } - } - - - - public static class Schema6 extends JsonSchema implements StringSchemaValidator { - private static @Nullable Schema6 instance = null; - - protected Schema6() { - super(new JsonSchemaInfo() - .type(Set.of( - String.class - )) - .format("date-time") - .pattern(Pattern.compile( - "^2020.*" - )) - ); - } - - public static Schema6 getInstance() { - if (instance == null) { - instance = new Schema6(); - } - return instance; - } - - @Override - public String validate(String arg, SchemaConfiguration configuration) throws ValidationException { - Set> pathSet = new HashSet<>(); - List pathToItem = List.of("args[0"); - String castArg = castToAllowedTypes(arg, pathToItem, pathSet); - SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().build())); - ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, new PathToSchemasMap(), new LinkedHashSet<>()); - getPathToSchemas(this, castArg, validationMetadata, pathSet); - return castArg; - } - - @Override - public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws 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"); - } - @Override - public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { - 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"); - } - @Override - 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 { - 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"); - } - } - - public sealed interface ComposedOneOfDifferentTypes1Boxed permits ComposedOneOfDifferentTypes1BoxedVoid, ComposedOneOfDifferentTypes1BoxedBoolean, ComposedOneOfDifferentTypes1BoxedNumber, ComposedOneOfDifferentTypes1BoxedString, ComposedOneOfDifferentTypes1BoxedList, ComposedOneOfDifferentTypes1BoxedMap { - @Nullable Object getData(); - } - - public record ComposedOneOfDifferentTypes1BoxedVoid(Nothing? data) implements ComposedOneOfDifferentTypes1Boxed { - @Override - public @Nullable Object getData() { - return data; - } - } - - public record ComposedOneOfDifferentTypes1BoxedBoolean(boolean data) implements ComposedOneOfDifferentTypes1Boxed { - @Override - public @Nullable Object getData() { - return data; - } - } - - public record ComposedOneOfDifferentTypes1BoxedNumber(Number data) implements ComposedOneOfDifferentTypes1Boxed { - @Override - public @Nullable Object getData() { - return data; - } - } - - public record ComposedOneOfDifferentTypes1BoxedString(String data) implements ComposedOneOfDifferentTypes1Boxed { - @Override - public @Nullable Object getData() { - return data; - } - } - - public record ComposedOneOfDifferentTypes1BoxedList(FrozenList<@Nullable Object> data) implements ComposedOneOfDifferentTypes1Boxed { - @Override - public @Nullable Object getData() { - return data; - } - } - - public record ComposedOneOfDifferentTypes1BoxedMap(FrozenMap<@Nullable Object> data) implements ComposedOneOfDifferentTypes1Boxed { - @Override - public @Nullable Object getData() { - return data; - } - } - - - public static class ComposedOneOfDifferentTypes1 extends JsonSchema implements NullSchemaValidator, BooleanSchemaValidator, NumberSchemaValidator, StringSchemaValidator, ListSchemaValidator, ComposedOneOfDifferentTypes1BoxedList>, MapSchemaValidator, ComposedOneOfDifferentTypes1BoxedMap> { - /* - NOTE: This class is auto generated by OpenAPI JSON Schema Generator. - Ref: https://github.com/openapi-json-schema-tools/openapi-json-schema-generator - - Do not edit the class manually. - - this is a model that allows payloads of type object or number - */ - private static @Nullable ComposedOneOfDifferentTypes1 instance = null; - - protected ComposedOneOfDifferentTypes1() { - super(new JsonSchemaInfo() - .oneOf(List.of( - NumberWithValidations.NumberWithValidations1.class, - Animal.Animal1.class, - Schema2.class, - Schema3.class, - Schema4.class, - Schema5.class, - Schema6.class - )) - ); - } - - public static ComposedOneOfDifferentTypes1 getInstance() { - if (instance == null) { - instance = new ComposedOneOfDifferentTypes1(); - } - return instance; - } - - @Override - public Nothing? validate(Nothing? arg, SchemaConfiguration configuration) throws ValidationException { - Set> pathSet = new HashSet<>(); - List pathToItem = List.of("args[0]"); - Nothing? castArg = castToAllowedTypes(arg, pathToItem, pathSet); - SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().build())); - PathToSchemasMap validatedPathToSchemas = new PathToSchemasMap(); - ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, new LinkedHashSet<>()); - getPathToSchemas(this, castArg, validationMetadata, pathSet); - return castArg; - } - - @Override - public boolean validate(boolean arg, SchemaConfiguration configuration) throws ValidationException { - Set> pathSet = new HashSet<>(); - List pathToItem = List.of("args[0]"); - boolean castArg = castToAllowedTypes(arg, pathToItem, pathSet); - SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().build())); - PathToSchemasMap validatedPathToSchemas = new PathToSchemasMap(); - ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, new LinkedHashSet<>()); - getPathToSchemas(this, castArg, validationMetadata, pathSet); - return castArg; - } - - @Override - public Number validate(Number arg, SchemaConfiguration configuration) throws ValidationException { - Set> pathSet = new HashSet<>(); - List pathToItem = List.of("args[0]"); - Number castArg = castToAllowedTypes(arg, pathToItem, pathSet); - SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().build())); - PathToSchemasMap validatedPathToSchemas = new PathToSchemasMap(); - ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, new LinkedHashSet<>()); - getPathToSchemas(this, castArg, validationMetadata, pathSet); - return castArg; - } - - public int validate(int arg, SchemaConfiguration configuration) throws ValidationException { - return (int) validate((Number) arg, configuration); - } - - public long validate(long arg, SchemaConfiguration configuration) throws ValidationException { - return (long) validate((Number) arg, configuration); - } - - public float validate(float arg, SchemaConfiguration configuration) throws ValidationException { - return (float) validate((Number) arg, configuration); - } - - public double validate(double arg, SchemaConfiguration configuration) throws ValidationException { - return (double) validate((Number) arg, configuration); - } - - @Override - public String validate(String arg, SchemaConfiguration configuration) throws ValidationException { - Set> pathSet = new HashSet<>(); - List pathToItem = List.of("args[0]"); - String castArg = castToAllowedTypes(arg, pathToItem, pathSet); - SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().build())); - PathToSchemasMap validatedPathToSchemas = new PathToSchemasMap(); - ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, new LinkedHashSet<>()); - getPathToSchemas(this, castArg, validationMetadata, pathSet); - return castArg; - } - - public String validate(LocalDate arg, SchemaConfiguration configuration) throws ValidationException { - return validate(arg.toString(), configuration); - } - - public String validate(ZonedDateTime arg, SchemaConfiguration configuration) throws ValidationException { - return validate(arg.toString(), configuration); - } - - public String validate(UUID arg, SchemaConfiguration configuration) throws ValidationException { - return validate(arg.toString(), configuration); - } - - @Override - public FrozenList<@Nullable Object> getNewInstance(List arg, List pathToItem, PathToSchemasMap pathToSchemas) { - List<@Nullable Object> items = new ArrayList<>(); - int i = 0; - for (Object item: arg) { - List itemPathToItem = new ArrayList<>(pathToItem); - itemPathToItem.add(i); - LinkedHashMap, Nothing?> schemas = pathToSchemas.get(itemPathToItem); - if (schemas == null) { - throw new RuntimeException("Validation result is invalid, schemas must exist for a pathToItem"); - } - JsonSchema itemSchema = schemas.entrySet().iterator().next().getKey(); - @Nullable Object itemInstance = itemSchema.getNewInstance(item, itemPathToItem, pathToSchemas); - items.add(itemInstance); - i += 1; - } - FrozenList<@Nullable Object> newInstanceItems = new FrozenList<>(items); - return newInstanceItems; - } - - 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); - SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().build())); - ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, new PathToSchemasMap(), new LinkedHashSet<>()); - PathToSchemasMap pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet); - return getNewInstance(castArg, validationMetadata.pathToItem(), pathToSchemasMap); - } - - @Override - 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 RuntimeException("Invalid non-string key value"); - } - String propertyName = (String) entryKey; - List propertyPathToItem = new ArrayList<>(pathToItem); - propertyPathToItem.add(propertyName); - Object value = entry.getValue(); - LinkedHashMap, Nothing?> schemas = pathToSchemas.get(propertyPathToItem); - if (schemas == null) { - throw new RuntimeException("Validation result is invalid, schemas must exist for a pathToItem"); - } - JsonSchema propertySchema = schemas.entrySet().iterator().next().getKey(); - @Nullable Object propertyInstance = propertySchema.getNewInstance(value, propertyPathToItem, pathToSchemas); - properties.put(propertyName, propertyInstance); - } - FrozenMap<@Nullable Object> castProperties = new FrozenMap<>(properties); - return castProperties; - } - - public FrozenMap<@Nullable Object> validate(Map arg, SchemaConfiguration configuration) throws ValidationException { - Set> pathSet = new HashSet<>(); - List pathToItem = List.of("args[0]"); - Map castArg = castToAllowedTypes(arg, pathToItem, pathSet); - SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().build())); - PathToSchemasMap validatedPathToSchemas = new PathToSchemasMap(); - ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, new LinkedHashSet<>()); - PathToSchemasMap pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet); - return getNewInstance(castArg, validationMetadata.pathToItem(), pathToSchemasMap); - } - - @Override - public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { - if (arg == null) { - return validate((Nothing?) null, configuration); - } else if (arg instanceof Boolean) { - boolean boolArg = (Boolean) arg; - return validate(boolArg, configuration); - } else if (arg instanceof Number) { - return validate((Number) arg, configuration); - } else if (arg instanceof String) { - return validate((String) arg, configuration); - } else if (arg instanceof List) { - return validate((List) arg, 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"); - } - @Override - public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { - if (arg == null) { - return getNewInstance((Nothing?) null, pathToItem, pathToSchemas); - } else if (arg instanceof Boolean) { - boolean boolArg = (Boolean) arg; - return getNewInstance(boolArg, pathToItem, pathToSchemas); - } else if (arg instanceof Number) { - return getNewInstance((Number) arg, pathToItem, pathToSchemas); - } else if (arg instanceof String) { - return getNewInstance((String) arg, pathToItem, pathToSchemas); - } else if (arg instanceof List) { - return getNewInstance((List) arg, 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"); - } - @Override - public ComposedOneOfDifferentTypes1BoxedVoid validateAndBox(Nothing? arg, SchemaConfiguration configuration) throws ValidationException { - return new ComposedOneOfDifferentTypes1BoxedVoid(validate(arg, configuration)); - } - @Override - 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 { - return new ComposedOneOfDifferentTypes1BoxedNumber(validate(arg, configuration)); - } - @Override - 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 { - return new ComposedOneOfDifferentTypes1BoxedList(validate(arg, configuration)); - } - @Override - 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 { - if (arg == null) { - Nothing? castArg = (Nothing?) arg; - return validateAndBox(castArg, configuration); - } else if (arg instanceof Boolean booleanArg) { - boolean castArg = booleanArg; - return validateAndBox(castArg, configuration); - } else if (arg instanceof String castArg) { - return validateAndBox(castArg, configuration); - } else if (arg instanceof Number castArg) { - return validateAndBox(castArg, configuration); - } else if (arg instanceof List castArg) { - 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"); - } - } -} diff --git a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/schemas/ComposedString.kt b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/schemas/ComposedString.kt deleted file mode 100644 index 73214362cf6..00000000000 --- a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/schemas/ComposedString.kt +++ /dev/null @@ -1,110 +0,0 @@ -package org.openapijsonschematools.client.components.schemas; -import java.util.HashSet; -import java.util.LinkedHashSet; -import java.util.List; -import java.util.Objects; -import java.util.Set; -import org.checkerframework.checker.nullness.qual.Nullable; -import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags; -import org.openapijsonschematools.client.configurations.SchemaConfiguration; -import org.openapijsonschematools.client.exceptions.ValidationException; -import org.openapijsonschematools.client.schemas.AnyTypeJsonSchema; -import org.openapijsonschematools.client.schemas.validation.JsonSchema; -import org.openapijsonschematools.client.schemas.validation.JsonSchemaInfo; -import org.openapijsonschematools.client.schemas.validation.PathToSchemasMap; -import org.openapijsonschematools.client.schemas.validation.StringSchemaValidator; -import org.openapijsonschematools.client.schemas.validation.ValidationMetadata; - -public class ComposedString { - // nest classes so all schemas and input/output classes can be public - - - public static class Schema0 extends AnyTypeJsonSchema.AnyTypeJsonSchema1 { - private static @Nullable Schema0 instance = null; - public static Schema0 getInstance() { - if (instance == null) { - instance = new Schema0(); - } - return instance; - } - } - - - public sealed interface ComposedString1Boxed permits ComposedString1BoxedString { - @Nullable Object getData(); - } - - public record ComposedString1BoxedString(String data) implements ComposedString1Boxed { - @Override - public @Nullable Object getData() { - return data; - } - } - - - - public static class ComposedString1 extends JsonSchema implements StringSchemaValidator { - /* - NOTE: This class is auto generated by OpenAPI JSON Schema Generator. - Ref: https://github.com/openapi-json-schema-tools/openapi-json-schema-generator - - Do not edit the class manually. - */ - private static @Nullable ComposedString1 instance = null; - - protected ComposedString1() { - super(new JsonSchemaInfo() - .type(Set.of( - String.class - )) - .allOf(List.of( - Schema0.class - )) - ); - } - - public static ComposedString1 getInstance() { - if (instance == null) { - instance = new ComposedString1(); - } - return instance; - } - - @Override - public String validate(String arg, SchemaConfiguration configuration) throws ValidationException { - Set> pathSet = new HashSet<>(); - List pathToItem = List.of("args[0"); - String castArg = castToAllowedTypes(arg, pathToItem, pathSet); - SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().build())); - ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, new PathToSchemasMap(), new LinkedHashSet<>()); - getPathToSchemas(this, castArg, validationMetadata, pathSet); - return castArg; - } - - @Override - public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws 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"); - } - @Override - public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { - 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"); - } - @Override - 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 { - 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"); - } - } -} diff --git a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/schemas/Currency.kt b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/schemas/Currency.kt deleted file mode 100644 index 863e5f2b21e..00000000000 --- a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/schemas/Currency.kt +++ /dev/null @@ -1,120 +0,0 @@ -package org.openapijsonschematools.client.components.schemas; -import java.util.HashSet; -import java.util.LinkedHashSet; -import java.util.List; -import java.util.Objects; -import java.util.Set; -import org.checkerframework.checker.nullness.qual.Nullable; -import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags; -import org.openapijsonschematools.client.configurations.SchemaConfiguration; -import org.openapijsonschematools.client.exceptions.ValidationException; -import org.openapijsonschematools.client.schemas.SetMaker; -import org.openapijsonschematools.client.schemas.validation.JsonSchema; -import org.openapijsonschematools.client.schemas.validation.JsonSchemaInfo; -import org.openapijsonschematools.client.schemas.validation.PathToSchemasMap; -import org.openapijsonschematools.client.schemas.validation.StringEnumValidator; -import org.openapijsonschematools.client.schemas.validation.StringSchemaValidator; -import org.openapijsonschematools.client.schemas.validation.StringValueMethod; -import org.openapijsonschematools.client.schemas.validation.ValidationMetadata; - -public class Currency { - // nest classes so all schemas and input/output classes can be public - - public enum StringCurrencyEnums implements StringValueMethod { - EUR("eur"), - USD("usd"); - private final String value; - - StringCurrencyEnums(String value) { - this.value = value; - } - public String value() { - return this.value; - } - } - - - public sealed interface Currency1Boxed permits Currency1BoxedString { - @Nullable Object getData(); - } - - public record Currency1BoxedString(String data) implements Currency1Boxed { - @Override - public @Nullable Object getData() { - return data; - } - } - - - - public static class Currency1 extends JsonSchema implements StringSchemaValidator, StringEnumValidator { - /* - NOTE: This class is auto generated by OpenAPI JSON Schema Generator. - Ref: https://github.com/openapi-json-schema-tools/openapi-json-schema-generator - - Do not edit the class manually. - */ - private static @Nullable Currency1 instance = null; - - protected Currency1() { - super(new JsonSchemaInfo() - .type(Set.of( - String.class - )) - .enumValues(SetMaker.makeSet( - "eur", - "usd" - )) - ); - } - - public static Currency1 getInstance() { - if (instance == null) { - instance = new Currency1(); - } - return instance; - } - - @Override - public String validate(String arg, SchemaConfiguration configuration) throws ValidationException { - Set> pathSet = new HashSet<>(); - List pathToItem = List.of("args[0"); - String castArg = castToAllowedTypes(arg, pathToItem, pathSet); - SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().build())); - ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, new PathToSchemasMap(), new LinkedHashSet<>()); - getPathToSchemas(this, castArg, validationMetadata, pathSet); - return castArg; - } - - @Override - 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 { - 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"); - } - @Override - public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { - 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"); - } - @Override - 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 { - 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"); - } - } -} diff --git a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/schemas/DanishPig.kt b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/schemas/DanishPig.kt deleted file mode 100644 index 4f2c28c2398..00000000000 --- a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/schemas/DanishPig.kt +++ /dev/null @@ -1,304 +0,0 @@ -package org.openapijsonschematools.client.components.schemas; -import java.util.ArrayList; -import java.util.HashSet; -import java.util.LinkedHashMap; -import java.util.LinkedHashSet; -import java.util.List; -import java.util.Map; -import java.util.Objects; -import java.util.Set; -import org.checkerframework.checker.nullness.qual.Nullable; -import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags; -import org.openapijsonschematools.client.configurations.SchemaConfiguration; -import org.openapijsonschematools.client.exceptions.InvalidAdditionalPropertyException; -import org.openapijsonschematools.client.exceptions.UnsetPropertyException; -import org.openapijsonschematools.client.exceptions.ValidationException; -import org.openapijsonschematools.client.schemas.GenericBuilder; -import org.openapijsonschematools.client.schemas.SetMaker; -import org.openapijsonschematools.client.schemas.UnsetAddPropsSetter; -import org.openapijsonschematools.client.schemas.validation.FrozenMap; -import org.openapijsonschematools.client.schemas.validation.JsonSchema; -import org.openapijsonschematools.client.schemas.validation.JsonSchemaInfo; -import org.openapijsonschematools.client.schemas.validation.MapSchemaValidator; -import org.openapijsonschematools.client.schemas.validation.PathToSchemasMap; -import org.openapijsonschematools.client.schemas.validation.PropertyEntry; -import org.openapijsonschematools.client.schemas.validation.StringEnumValidator; -import org.openapijsonschematools.client.schemas.validation.StringSchemaValidator; -import org.openapijsonschematools.client.schemas.validation.StringValueMethod; -import org.openapijsonschematools.client.schemas.validation.ValidationMetadata; - -public class DanishPig { - // nest classes so all schemas and input/output classes can be public - - public enum StringClassNameEnums implements StringValueMethod { - DANISH_PIG("DanishPig"); - private final String value; - - StringClassNameEnums(String value) { - this.value = value; - } - public String value() { - return this.value; - } - } - - - public sealed interface ClassNameBoxed permits ClassNameBoxedString { - @Nullable Object getData(); - } - - public record ClassNameBoxedString(String data) implements ClassNameBoxed { - @Override - public @Nullable Object getData() { - return data; - } - } - - - - public static class ClassName extends JsonSchema implements StringSchemaValidator, StringEnumValidator { - private static @Nullable ClassName instance = null; - - protected ClassName() { - super(new JsonSchemaInfo() - .type(Set.of( - String.class - )) - .enumValues(SetMaker.makeSet( - "DanishPig" - )) - ); - } - - public static ClassName getInstance() { - if (instance == null) { - instance = new ClassName(); - } - return instance; - } - - @Override - public String validate(String arg, SchemaConfiguration configuration) throws ValidationException { - Set> pathSet = new HashSet<>(); - List pathToItem = List.of("args[0"); - String castArg = castToAllowedTypes(arg, pathToItem, pathSet); - SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().build())); - ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, new PathToSchemasMap(), new LinkedHashSet<>()); - getPathToSchemas(this, castArg, validationMetadata, pathSet); - return castArg; - } - - @Override - 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 { - 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"); - } - @Override - public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { - 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"); - } - @Override - 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 { - 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"); - } - } - - public static class DanishPigMap extends FrozenMap<@Nullable Object> { - protected DanishPigMap(FrozenMap<@Nullable Object> m) { - super(m); - } - public static final Set requiredKeys = Set.of( - "className" - ); - public static final Set optionalKeys = Set.of(); - public static DanishPigMap of(Map arg, SchemaConfiguration configuration) throws ValidationException { - return DanishPig1.getInstance().validate(arg, configuration); - } - - public String className() { - @Nullable Object value = get("className"); - if (!(value instanceof String)) { - throw new RuntimeException("Invalid value stored for className"); - } - return (String) value; - } - - public @Nullable Object getAdditionalProperty(String name) throws UnsetPropertyException, InvalidAdditionalPropertyException { - throwIfKeyKnown(name, requiredKeys, optionalKeys); - throwIfKeyNotPresent(name); - return get(name); - } - } - - public interface SetterForClassName { - Map getInstance(); - T getBuilderAfterClassName(Map instance); - - default T className(String value) { - var instance = getInstance(); - instance.put("className", value); - return getBuilderAfterClassName(instance); - } - - default T className(StringClassNameEnums value) { - var instance = getInstance(); - instance.put("className", value.value()); - return getBuilderAfterClassName(instance); - } - } - - public static class DanishPigMap0Builder extends UnsetAddPropsSetter implements GenericBuilder> { - private final Map instance; - private static final Set knownKeys = Set.of( - "className" - ); - public Set getKnownKeys() { - return knownKeys; - } - public DanishPigMap0Builder(Map instance) { - this.instance = instance; - } - public Map build() { - return instance; - } - public Map getInstance() { - return instance; - } - public DanishPigMap0Builder getBuilderAfterAdditionalProperty(Map instance) { - return this; - } - } - - public static class DanishPigMapBuilder implements SetterForClassName { - private final Map instance; - public DanishPigMapBuilder() { - this.instance = new LinkedHashMap<>(); - } - public Map getInstance() { - return instance; - } - public DanishPigMap0Builder getBuilderAfterClassName(Map instance) { - return new DanishPigMap0Builder(instance); - } - } - - - public sealed interface DanishPig1Boxed permits DanishPig1BoxedMap { - @Nullable Object getData(); - } - - public record DanishPig1BoxedMap(DanishPigMap data) implements DanishPig1Boxed { - @Override - public @Nullable Object getData() { - return data; - } - } - - - public static class DanishPig1 extends JsonSchema implements MapSchemaValidator { - /* - NOTE: This class is auto generated by OpenAPI JSON Schema Generator. - Ref: https://github.com/openapi-json-schema-tools/openapi-json-schema-generator - - Do not edit the class manually. - */ - private static @Nullable DanishPig1 instance = null; - - protected DanishPig1() { - super(new JsonSchemaInfo() - .type(Set.of(Map.class)) - .properties(Map.ofEntries( - new PropertyEntry("className", ClassName.class) - )) - .required(Set.of( - "className" - )) - ); - } - - public static DanishPig1 getInstance() { - if (instance == null) { - instance = new DanishPig1(); - } - return instance; - } - - 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 RuntimeException("Invalid non-string key value"); - } - String propertyName = (String) entryKey; - List propertyPathToItem = new ArrayList<>(pathToItem); - propertyPathToItem.add(propertyName); - Object value = entry.getValue(); - LinkedHashMap, Nothing?> schemas = pathToSchemas.get(propertyPathToItem); - if (schemas == null) { - throw new RuntimeException("Validation result is invalid, schemas must exist for a pathToItem"); - } - JsonSchema propertySchema = schemas.entrySet().iterator().next().getKey(); - @Nullable Object propertyInstance = propertySchema.getNewInstance(value, propertyPathToItem, pathToSchemas); - properties.put(propertyName, propertyInstance); - } - FrozenMap<@Nullable Object> castProperties = new FrozenMap<>(properties); - return new DanishPigMap(castProperties); - } - - 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); - SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().build())); - ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, new PathToSchemasMap(), new LinkedHashSet<>()); - PathToSchemasMap pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet); - return getNewInstance(castArg, validationMetadata.pathToItem(), pathToSchemasMap); - } - - - @Override - public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws 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"); - } - @Override - public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { - if (arg instanceof Map) { - return getNewInstance((Map) arg, pathToItem, pathToSchemas); - } - 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 { - return new DanishPig1BoxedMap(validate(arg, configuration)); - } - @Override - public DanishPig1Boxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { - 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"); - } - } - -} diff --git a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/schemas/DateTimeTest.kt b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/schemas/DateTimeTest.kt deleted file mode 100644 index 54cebf78aeb..00000000000 --- a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/schemas/DateTimeTest.kt +++ /dev/null @@ -1,105 +0,0 @@ -package org.openapijsonschematools.client.components.schemas; -import java.time.ZonedDateTime; -import java.util.HashSet; -import java.util.LinkedHashSet; -import java.util.List; -import java.util.Objects; -import java.util.Set; -import org.checkerframework.checker.nullness.qual.Nullable; -import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags; -import org.openapijsonschematools.client.configurations.SchemaConfiguration; -import org.openapijsonschematools.client.exceptions.ValidationException; -import org.openapijsonschematools.client.schemas.validation.DefaultValueMethod; -import org.openapijsonschematools.client.schemas.validation.JsonSchema; -import org.openapijsonschematools.client.schemas.validation.JsonSchemaInfo; -import org.openapijsonschematools.client.schemas.validation.PathToSchemasMap; -import org.openapijsonschematools.client.schemas.validation.StringSchemaValidator; -import org.openapijsonschematools.client.schemas.validation.ValidationMetadata; - -public class DateTimeTest { - // nest classes so all schemas and input/output classes can be public - - - public sealed interface DateTimeTest1Boxed permits DateTimeTest1BoxedString { - @Nullable Object getData(); - } - - public record DateTimeTest1BoxedString(String data) implements DateTimeTest1Boxed { - @Override - public @Nullable Object getData() { - return data; - } - } - - - - public static class DateTimeTest1 extends JsonSchema implements StringSchemaValidator, DefaultValueMethod { - /* - NOTE: This class is auto generated by OpenAPI JSON Schema Generator. - Ref: https://github.com/openapi-json-schema-tools/openapi-json-schema-generator - - Do not edit the class manually. - */ - private static @Nullable DateTimeTest1 instance = null; - - protected DateTimeTest1() { - super(new JsonSchemaInfo() - .type(Set.of( - String.class - )) - .format("date-time") - .defaultValue("2010-01-01T10:10:10.000111+01:00") - ); - } - - public static DateTimeTest1 getInstance() { - if (instance == null) { - instance = new DateTimeTest1(); - } - return instance; - } - - @Override - public String validate(String arg, SchemaConfiguration configuration) throws ValidationException { - Set> pathSet = new HashSet<>(); - List pathToItem = List.of("args[0"); - String castArg = castToAllowedTypes(arg, pathToItem, pathSet); - SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().build())); - ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, new PathToSchemasMap(), new LinkedHashSet<>()); - getPathToSchemas(this, castArg, validationMetadata, pathSet); - return castArg; - } - - @Override - public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws 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"); - } - @Override - public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { - 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"); - } - public String defaultValue() throws ValidationException { - if (defaultValue instanceof String) { - return (String) defaultValue; - } - throw new ValidationException("Invalid type stored in defaultValue"); - } - @Override - 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 { - 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"); - } - } -} diff --git a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/schemas/DateTimeWithValidations.kt b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/schemas/DateTimeWithValidations.kt deleted file mode 100644 index 5fa8cfa1bf7..00000000000 --- a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/schemas/DateTimeWithValidations.kt +++ /dev/null @@ -1,101 +0,0 @@ -package org.openapijsonschematools.client.components.schemas; -import java.time.ZonedDateTime; -import java.util.HashSet; -import java.util.LinkedHashSet; -import java.util.List; -import java.util.Objects; -import java.util.Set; -import java.util.regex.Pattern; -import org.checkerframework.checker.nullness.qual.Nullable; -import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags; -import org.openapijsonschematools.client.configurations.SchemaConfiguration; -import org.openapijsonschematools.client.exceptions.ValidationException; -import org.openapijsonschematools.client.schemas.validation.JsonSchema; -import org.openapijsonschematools.client.schemas.validation.JsonSchemaInfo; -import org.openapijsonschematools.client.schemas.validation.PathToSchemasMap; -import org.openapijsonschematools.client.schemas.validation.StringSchemaValidator; -import org.openapijsonschematools.client.schemas.validation.ValidationMetadata; - -public class DateTimeWithValidations { - // nest classes so all schemas and input/output classes can be public - - - public sealed interface DateTimeWithValidations1Boxed permits DateTimeWithValidations1BoxedString { - @Nullable Object getData(); - } - - public record DateTimeWithValidations1BoxedString(String data) implements DateTimeWithValidations1Boxed { - @Override - public @Nullable Object getData() { - return data; - } - } - - - - public static class DateTimeWithValidations1 extends JsonSchema implements StringSchemaValidator { - /* - NOTE: This class is auto generated by OpenAPI JSON Schema Generator. - Ref: https://github.com/openapi-json-schema-tools/openapi-json-schema-generator - - Do not edit the class manually. - */ - private static @Nullable DateTimeWithValidations1 instance = null; - - protected DateTimeWithValidations1() { - super(new JsonSchemaInfo() - .type(Set.of( - String.class - )) - .format("date-time") - .pattern(Pattern.compile( - "^2020.*" - )) - ); - } - - public static DateTimeWithValidations1 getInstance() { - if (instance == null) { - instance = new DateTimeWithValidations1(); - } - return instance; - } - - @Override - public String validate(String arg, SchemaConfiguration configuration) throws ValidationException { - Set> pathSet = new HashSet<>(); - List pathToItem = List.of("args[0"); - String castArg = castToAllowedTypes(arg, pathToItem, pathSet); - SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().build())); - ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, new PathToSchemasMap(), new LinkedHashSet<>()); - getPathToSchemas(this, castArg, validationMetadata, pathSet); - return castArg; - } - - @Override - public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws 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"); - } - @Override - public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { - 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"); - } - @Override - 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 { - 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"); - } - } -} diff --git a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/schemas/DateWithValidations.kt b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/schemas/DateWithValidations.kt deleted file mode 100644 index 37e06a9b8ee..00000000000 --- a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/schemas/DateWithValidations.kt +++ /dev/null @@ -1,101 +0,0 @@ -package org.openapijsonschematools.client.components.schemas; -import java.time.LocalDate; -import java.util.HashSet; -import java.util.LinkedHashSet; -import java.util.List; -import java.util.Objects; -import java.util.Set; -import java.util.regex.Pattern; -import org.checkerframework.checker.nullness.qual.Nullable; -import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags; -import org.openapijsonschematools.client.configurations.SchemaConfiguration; -import org.openapijsonschematools.client.exceptions.ValidationException; -import org.openapijsonschematools.client.schemas.validation.JsonSchema; -import org.openapijsonschematools.client.schemas.validation.JsonSchemaInfo; -import org.openapijsonschematools.client.schemas.validation.PathToSchemasMap; -import org.openapijsonschematools.client.schemas.validation.StringSchemaValidator; -import org.openapijsonschematools.client.schemas.validation.ValidationMetadata; - -public class DateWithValidations { - // nest classes so all schemas and input/output classes can be public - - - public sealed interface DateWithValidations1Boxed permits DateWithValidations1BoxedString { - @Nullable Object getData(); - } - - public record DateWithValidations1BoxedString(String data) implements DateWithValidations1Boxed { - @Override - public @Nullable Object getData() { - return data; - } - } - - - - public static class DateWithValidations1 extends JsonSchema implements StringSchemaValidator { - /* - NOTE: This class is auto generated by OpenAPI JSON Schema Generator. - Ref: https://github.com/openapi-json-schema-tools/openapi-json-schema-generator - - Do not edit the class manually. - */ - private static @Nullable DateWithValidations1 instance = null; - - protected DateWithValidations1() { - super(new JsonSchemaInfo() - .type(Set.of( - String.class - )) - .format("date") - .pattern(Pattern.compile( - "^2020.*" - )) - ); - } - - public static DateWithValidations1 getInstance() { - if (instance == null) { - instance = new DateWithValidations1(); - } - return instance; - } - - @Override - public String validate(String arg, SchemaConfiguration configuration) throws ValidationException { - Set> pathSet = new HashSet<>(); - List pathToItem = List.of("args[0"); - String castArg = castToAllowedTypes(arg, pathToItem, pathSet); - SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().build())); - ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, new PathToSchemasMap(), new LinkedHashSet<>()); - getPathToSchemas(this, castArg, validationMetadata, pathSet); - return castArg; - } - - @Override - public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws 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"); - } - @Override - public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { - 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"); - } - @Override - 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 { - 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"); - } - } -} diff --git a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/schemas/DecimalPayload.kt b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/schemas/DecimalPayload.kt deleted file mode 100644 index e2388b2f7b9..00000000000 --- a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/schemas/DecimalPayload.kt +++ /dev/null @@ -1,19 +0,0 @@ -package org.openapijsonschematools.client.components.schemas; -import org.checkerframework.checker.nullness.qual.Nullable; -import org.openapijsonschematools.client.schemas.DecimalJsonSchema; - -public class DecimalPayload extends DecimalJsonSchema { - // nest classes so all schemas and input/output classes can be public - - - public static class DecimalPayload1 extends DecimalJsonSchema.DecimalJsonSchema1 { - private static @Nullable DecimalPayload1 instance = null; - public static DecimalPayload1 getInstance() { - if (instance == null) { - instance = new DecimalPayload1(); - } - return instance; - } - } - -} diff --git a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/schemas/Dog.kt b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/schemas/Dog.kt deleted file mode 100644 index a76f7e42185..00000000000 --- a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/schemas/Dog.kt +++ /dev/null @@ -1,503 +0,0 @@ -package org.openapijsonschematools.client.components.schemas; -import java.time.LocalDate; -import java.time.ZonedDateTime; -import java.util.ArrayList; -import java.util.HashSet; -import java.util.LinkedHashMap; -import java.util.LinkedHashSet; -import java.util.List; -import java.util.Map; -import java.util.Objects; -import java.util.Set; -import java.util.UUID; -import org.checkerframework.checker.nullness.qual.Nullable; -import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags; -import org.openapijsonschematools.client.configurations.SchemaConfiguration; -import org.openapijsonschematools.client.exceptions.InvalidAdditionalPropertyException; -import org.openapijsonschematools.client.exceptions.UnsetPropertyException; -import org.openapijsonschematools.client.exceptions.ValidationException; -import org.openapijsonschematools.client.schemas.GenericBuilder; -import org.openapijsonschematools.client.schemas.StringJsonSchema; -import org.openapijsonschematools.client.schemas.UnsetAddPropsSetter; -import org.openapijsonschematools.client.schemas.validation.BooleanSchemaValidator; -import org.openapijsonschematools.client.schemas.validation.FrozenList; -import org.openapijsonschematools.client.schemas.validation.FrozenMap; -import org.openapijsonschematools.client.schemas.validation.JsonSchema; -import org.openapijsonschematools.client.schemas.validation.JsonSchemaInfo; -import org.openapijsonschematools.client.schemas.validation.ListSchemaValidator; -import org.openapijsonschematools.client.schemas.validation.MapSchemaValidator; -import org.openapijsonschematools.client.schemas.validation.NullSchemaValidator; -import org.openapijsonschematools.client.schemas.validation.NumberSchemaValidator; -import org.openapijsonschematools.client.schemas.validation.PathToSchemasMap; -import org.openapijsonschematools.client.schemas.validation.PropertyEntry; -import org.openapijsonschematools.client.schemas.validation.StringSchemaValidator; -import org.openapijsonschematools.client.schemas.validation.ValidationMetadata; - -public class Dog { - // nest classes so all schemas and input/output classes can be public - - - public static class Breed extends StringJsonSchema.StringJsonSchema1 { - private static @Nullable Breed instance = null; - public static Breed getInstance() { - if (instance == null) { - instance = new Breed(); - } - return instance; - } - } - - - public static class Schema1Map extends FrozenMap<@Nullable Object> { - protected Schema1Map(FrozenMap<@Nullable Object> m) { - super(m); - } - public static final Set requiredKeys = Set.of(); - public static final Set optionalKeys = Set.of( - "breed" - ); - public static Schema1Map of(Map arg, SchemaConfiguration configuration) throws ValidationException { - return Schema1.getInstance().validate(arg, configuration); - } - - public String breed() throws UnsetPropertyException { - String key = "breed"; - throwIfKeyNotPresent(key); - @Nullable Object value = get(key); - if (!(value instanceof String)) { - throw new RuntimeException("Invalid value stored for breed"); - } - return (String) value; - } - - public @Nullable Object getAdditionalProperty(String name) throws UnsetPropertyException, InvalidAdditionalPropertyException { - throwIfKeyKnown(name, requiredKeys, optionalKeys); - throwIfKeyNotPresent(name); - return get(name); - } - } - - public interface SetterForBreed { - Map getInstance(); - T getBuilderAfterBreed(Map instance); - - default T breed(String value) { - var instance = getInstance(); - instance.put("breed", value); - return getBuilderAfterBreed(instance); - } - } - - public static class Schema1MapBuilder extends UnsetAddPropsSetter implements GenericBuilder>, SetterForBreed { - private final Map instance; - private static final Set knownKeys = Set.of( - "breed" - ); - public Set getKnownKeys() { - return knownKeys; - } - public Schema1MapBuilder() { - this.instance = new LinkedHashMap<>(); - } - public Map build() { - return instance; - } - public Map getInstance() { - return instance; - } - public Schema1MapBuilder getBuilderAfterBreed(Map instance) { - return this; - } - public Schema1MapBuilder getBuilderAfterAdditionalProperty(Map instance) { - return this; - } - } - - - public sealed interface Schema1Boxed permits Schema1BoxedMap { - @Nullable Object getData(); - } - - public record Schema1BoxedMap(Schema1Map data) implements Schema1Boxed { - @Override - public @Nullable Object getData() { - return data; - } - } - - - public static class Schema1 extends JsonSchema implements MapSchemaValidator { - private static @Nullable Schema1 instance = null; - - protected Schema1() { - super(new JsonSchemaInfo() - .type(Set.of(Map.class)) - .properties(Map.ofEntries( - new PropertyEntry("breed", Breed.class) - )) - ); - } - - public static Schema1 getInstance() { - if (instance == null) { - instance = new Schema1(); - } - return instance; - } - - 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 RuntimeException("Invalid non-string key value"); - } - String propertyName = (String) entryKey; - List propertyPathToItem = new ArrayList<>(pathToItem); - propertyPathToItem.add(propertyName); - Object value = entry.getValue(); - LinkedHashMap, Nothing?> schemas = pathToSchemas.get(propertyPathToItem); - if (schemas == null) { - throw new RuntimeException("Validation result is invalid, schemas must exist for a pathToItem"); - } - JsonSchema propertySchema = schemas.entrySet().iterator().next().getKey(); - @Nullable Object propertyInstance = propertySchema.getNewInstance(value, propertyPathToItem, pathToSchemas); - properties.put(propertyName, propertyInstance); - } - FrozenMap<@Nullable Object> castProperties = new FrozenMap<>(properties); - return new Schema1Map(castProperties); - } - - 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); - SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().build())); - ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, new PathToSchemasMap(), new LinkedHashSet<>()); - PathToSchemasMap pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet); - return getNewInstance(castArg, validationMetadata.pathToItem(), pathToSchemasMap); - } - - - @Override - public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws 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"); - } - @Override - public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { - if (arg instanceof Map) { - return getNewInstance((Map) arg, pathToItem, pathToSchemas); - } - 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 { - return new Schema1BoxedMap(validate(arg, configuration)); - } - @Override - public Schema1Boxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { - 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"); - } - } - - - public sealed interface Dog1Boxed permits Dog1BoxedVoid, Dog1BoxedBoolean, Dog1BoxedNumber, Dog1BoxedString, Dog1BoxedList, Dog1BoxedMap { - @Nullable Object getData(); - } - - public record Dog1BoxedVoid(Nothing? data) implements Dog1Boxed { - @Override - public @Nullable Object getData() { - return data; - } - } - - public record Dog1BoxedBoolean(boolean data) implements Dog1Boxed { - @Override - public @Nullable Object getData() { - return data; - } - } - - public record Dog1BoxedNumber(Number data) implements Dog1Boxed { - @Override - public @Nullable Object getData() { - return data; - } - } - - public record Dog1BoxedString(String data) implements Dog1Boxed { - @Override - public @Nullable Object getData() { - return data; - } - } - - public record Dog1BoxedList(FrozenList<@Nullable Object> data) implements Dog1Boxed { - @Override - public @Nullable Object getData() { - return data; - } - } - - public record Dog1BoxedMap(FrozenMap<@Nullable Object> data) implements Dog1Boxed { - @Override - public @Nullable Object getData() { - return data; - } - } - - - public static class Dog1 extends JsonSchema implements NullSchemaValidator, BooleanSchemaValidator, NumberSchemaValidator, StringSchemaValidator, ListSchemaValidator, Dog1BoxedList>, MapSchemaValidator, Dog1BoxedMap> { - /* - NOTE: This class is auto generated by OpenAPI JSON Schema Generator. - Ref: https://github.com/openapi-json-schema-tools/openapi-json-schema-generator - - Do not edit the class manually. - */ - private static @Nullable Dog1 instance = null; - - protected Dog1() { - super(new JsonSchemaInfo() - .allOf(List.of( - Animal.Animal1.class, - Schema1.class - )) - ); - } - - public static Dog1 getInstance() { - if (instance == null) { - instance = new Dog1(); - } - return instance; - } - - @Override - public Nothing? validate(Nothing? arg, SchemaConfiguration configuration) throws ValidationException { - Set> pathSet = new HashSet<>(); - List pathToItem = List.of("args[0]"); - Nothing? castArg = castToAllowedTypes(arg, pathToItem, pathSet); - SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().build())); - PathToSchemasMap validatedPathToSchemas = new PathToSchemasMap(); - ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, new LinkedHashSet<>()); - getPathToSchemas(this, castArg, validationMetadata, pathSet); - return castArg; - } - - @Override - public boolean validate(boolean arg, SchemaConfiguration configuration) throws ValidationException { - Set> pathSet = new HashSet<>(); - List pathToItem = List.of("args[0]"); - boolean castArg = castToAllowedTypes(arg, pathToItem, pathSet); - SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().build())); - PathToSchemasMap validatedPathToSchemas = new PathToSchemasMap(); - ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, new LinkedHashSet<>()); - getPathToSchemas(this, castArg, validationMetadata, pathSet); - return castArg; - } - - @Override - public Number validate(Number arg, SchemaConfiguration configuration) throws ValidationException { - Set> pathSet = new HashSet<>(); - List pathToItem = List.of("args[0]"); - Number castArg = castToAllowedTypes(arg, pathToItem, pathSet); - SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().build())); - PathToSchemasMap validatedPathToSchemas = new PathToSchemasMap(); - ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, new LinkedHashSet<>()); - getPathToSchemas(this, castArg, validationMetadata, pathSet); - return castArg; - } - - public int validate(int arg, SchemaConfiguration configuration) throws ValidationException { - return (int) validate((Number) arg, configuration); - } - - public long validate(long arg, SchemaConfiguration configuration) throws ValidationException { - return (long) validate((Number) arg, configuration); - } - - public float validate(float arg, SchemaConfiguration configuration) throws ValidationException { - return (float) validate((Number) arg, configuration); - } - - public double validate(double arg, SchemaConfiguration configuration) throws ValidationException { - return (double) validate((Number) arg, configuration); - } - - @Override - public String validate(String arg, SchemaConfiguration configuration) throws ValidationException { - Set> pathSet = new HashSet<>(); - List pathToItem = List.of("args[0]"); - String castArg = castToAllowedTypes(arg, pathToItem, pathSet); - SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().build())); - PathToSchemasMap validatedPathToSchemas = new PathToSchemasMap(); - ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, new LinkedHashSet<>()); - getPathToSchemas(this, castArg, validationMetadata, pathSet); - return castArg; - } - - public String validate(LocalDate arg, SchemaConfiguration configuration) throws ValidationException { - return validate(arg.toString(), configuration); - } - - public String validate(ZonedDateTime arg, SchemaConfiguration configuration) throws ValidationException { - return validate(arg.toString(), configuration); - } - - public String validate(UUID arg, SchemaConfiguration configuration) throws ValidationException { - return validate(arg.toString(), configuration); - } - - @Override - public FrozenList<@Nullable Object> getNewInstance(List arg, List pathToItem, PathToSchemasMap pathToSchemas) { - List<@Nullable Object> items = new ArrayList<>(); - int i = 0; - for (Object item: arg) { - List itemPathToItem = new ArrayList<>(pathToItem); - itemPathToItem.add(i); - LinkedHashMap, Nothing?> schemas = pathToSchemas.get(itemPathToItem); - if (schemas == null) { - throw new RuntimeException("Validation result is invalid, schemas must exist for a pathToItem"); - } - JsonSchema itemSchema = schemas.entrySet().iterator().next().getKey(); - @Nullable Object itemInstance = itemSchema.getNewInstance(item, itemPathToItem, pathToSchemas); - items.add(itemInstance); - i += 1; - } - FrozenList<@Nullable Object> newInstanceItems = new FrozenList<>(items); - return newInstanceItems; - } - - 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); - SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().build())); - ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, new PathToSchemasMap(), new LinkedHashSet<>()); - PathToSchemasMap pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet); - return getNewInstance(castArg, validationMetadata.pathToItem(), pathToSchemasMap); - } - - @Override - 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 RuntimeException("Invalid non-string key value"); - } - String propertyName = (String) entryKey; - List propertyPathToItem = new ArrayList<>(pathToItem); - propertyPathToItem.add(propertyName); - Object value = entry.getValue(); - LinkedHashMap, Nothing?> schemas = pathToSchemas.get(propertyPathToItem); - if (schemas == null) { - throw new RuntimeException("Validation result is invalid, schemas must exist for a pathToItem"); - } - JsonSchema propertySchema = schemas.entrySet().iterator().next().getKey(); - @Nullable Object propertyInstance = propertySchema.getNewInstance(value, propertyPathToItem, pathToSchemas); - properties.put(propertyName, propertyInstance); - } - FrozenMap<@Nullable Object> castProperties = new FrozenMap<>(properties); - return castProperties; - } - - public FrozenMap<@Nullable Object> validate(Map arg, SchemaConfiguration configuration) throws ValidationException { - Set> pathSet = new HashSet<>(); - List pathToItem = List.of("args[0]"); - Map castArg = castToAllowedTypes(arg, pathToItem, pathSet); - SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().build())); - PathToSchemasMap validatedPathToSchemas = new PathToSchemasMap(); - ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, new LinkedHashSet<>()); - PathToSchemasMap pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet); - return getNewInstance(castArg, validationMetadata.pathToItem(), pathToSchemasMap); - } - - @Override - public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { - if (arg == null) { - return validate((Nothing?) null, configuration); - } else if (arg instanceof Boolean) { - boolean boolArg = (Boolean) arg; - return validate(boolArg, configuration); - } else if (arg instanceof Number) { - return validate((Number) arg, configuration); - } else if (arg instanceof String) { - return validate((String) arg, configuration); - } else if (arg instanceof List) { - return validate((List) arg, 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"); - } - @Override - public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { - if (arg == null) { - return getNewInstance((Nothing?) null, pathToItem, pathToSchemas); - } else if (arg instanceof Boolean) { - boolean boolArg = (Boolean) arg; - return getNewInstance(boolArg, pathToItem, pathToSchemas); - } else if (arg instanceof Number) { - return getNewInstance((Number) arg, pathToItem, pathToSchemas); - } else if (arg instanceof String) { - return getNewInstance((String) arg, pathToItem, pathToSchemas); - } else if (arg instanceof List) { - return getNewInstance((List) arg, 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"); - } - @Override - public Dog1BoxedVoid validateAndBox(Nothing? arg, SchemaConfiguration configuration) throws ValidationException { - return new Dog1BoxedVoid(validate(arg, configuration)); - } - @Override - 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 { - return new Dog1BoxedNumber(validate(arg, configuration)); - } - @Override - 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 { - return new Dog1BoxedList(validate(arg, configuration)); - } - @Override - 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 { - if (arg == null) { - Nothing? castArg = (Nothing?) arg; - return validateAndBox(castArg, configuration); - } else if (arg instanceof Boolean booleanArg) { - boolean castArg = booleanArg; - return validateAndBox(castArg, configuration); - } else if (arg instanceof String castArg) { - return validateAndBox(castArg, configuration); - } else if (arg instanceof Number castArg) { - return validateAndBox(castArg, configuration); - } else if (arg instanceof List castArg) { - 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"); - } - } -} diff --git a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/schemas/Drawing.kt b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/schemas/Drawing.kt deleted file mode 100644 index cd536f89a1d..00000000000 --- a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/schemas/Drawing.kt +++ /dev/null @@ -1,656 +0,0 @@ -package org.openapijsonschematools.client.components.schemas; -import java.util.ArrayList; -import java.util.HashSet; -import java.util.LinkedHashMap; -import java.util.LinkedHashSet; -import java.util.List; -import java.util.Map; -import java.util.Objects; -import java.util.Set; -import org.checkerframework.checker.nullness.qual.Nullable; -import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags; -import org.openapijsonschematools.client.configurations.SchemaConfiguration; -import org.openapijsonschematools.client.exceptions.InvalidAdditionalPropertyException; -import org.openapijsonschematools.client.exceptions.UnsetPropertyException; -import org.openapijsonschematools.client.exceptions.ValidationException; -import org.openapijsonschematools.client.schemas.GenericBuilder; -import org.openapijsonschematools.client.schemas.validation.FrozenList; -import org.openapijsonschematools.client.schemas.validation.FrozenMap; -import org.openapijsonschematools.client.schemas.validation.JsonSchema; -import org.openapijsonschematools.client.schemas.validation.JsonSchemaInfo; -import org.openapijsonschematools.client.schemas.validation.ListSchemaValidator; -import org.openapijsonschematools.client.schemas.validation.MapSchemaValidator; -import org.openapijsonschematools.client.schemas.validation.MapUtils; -import org.openapijsonschematools.client.schemas.validation.PathToSchemasMap; -import org.openapijsonschematools.client.schemas.validation.PropertyEntry; -import org.openapijsonschematools.client.schemas.validation.ValidationMetadata; - -public class Drawing { - // nest classes so all schemas and input/output classes can be public - - - 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 { - return Shapes.getInstance().validate(arg, configuration); - } - } - - public static class ShapesListBuilder { - // class to build List<@Nullable Object> - private final List<@Nullable Object> list; - - public ShapesListBuilder() { - list = new ArrayList<>(); - } - - public ShapesListBuilder(List<@Nullable Object> list) { - this.list = list; - } - - public ShapesListBuilder add(Nothing? item) { - list.add(null); - return this; - } - - public ShapesListBuilder add(boolean item) { - list.add(item); - return this; - } - - public ShapesListBuilder add(String item) { - list.add(item); - return this; - } - - public ShapesListBuilder add(int item) { - list.add(item); - return this; - } - - public ShapesListBuilder add(float item) { - list.add(item); - return this; - } - - public ShapesListBuilder add(long item) { - list.add(item); - return this; - } - - public ShapesListBuilder add(double item) { - list.add(item); - return this; - } - - public ShapesListBuilder add(List item) { - list.add(item); - return this; - } - - public ShapesListBuilder add(Map item) { - list.add(item); - return this; - } - - public List<@Nullable Object> build() { - return list; - } - } - - - public sealed interface ShapesBoxed permits ShapesBoxedList { - @Nullable Object getData(); - } - - public record ShapesBoxedList(ShapesList data) implements ShapesBoxed { - @Override - public @Nullable Object getData() { - return data; - } - } - - - - public static class Shapes extends JsonSchema implements ListSchemaValidator { - private static @Nullable Shapes instance = null; - - protected Shapes() { - super(new JsonSchemaInfo() - .type(Set.of(List.class)) - .items(Shape.Shape1.class) - ); - } - - public static Shapes getInstance() { - if (instance == null) { - instance = new Shapes(); - } - return instance; - } - - @Override - public ShapesList getNewInstance(List arg, List pathToItem, PathToSchemasMap pathToSchemas) { - List<@Nullable Object> items = new ArrayList<>(); - int i = 0; - for (Object item: arg) { - List itemPathToItem = new ArrayList<>(pathToItem); - itemPathToItem.add(i); - LinkedHashMap, Nothing?> schemas = pathToSchemas.get(itemPathToItem); - if (schemas == null) { - throw new RuntimeException("Validation 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"); - } - items.add((@Nullable Object) itemInstance); - i += 1; - } - FrozenList<@Nullable Object> newInstanceItems = new FrozenList<>(items); - return new ShapesList(newInstanceItems); - } - - 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); - SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().build())); - ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, new PathToSchemasMap(), new LinkedHashSet<>()); - PathToSchemasMap pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet); - return getNewInstance(castArg, validationMetadata.pathToItem(), pathToSchemasMap); - } - - @Override - public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws 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"); - } - @Override - public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { - 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"); - } - @Override - 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 { - 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"); - } - } - - public static class DrawingMap extends FrozenMap<@Nullable Object> { - protected DrawingMap(FrozenMap<@Nullable Object> m) { - super(m); - } - public static final Set requiredKeys = Set.of(); - public static final Set optionalKeys = Set.of( - "mainShape", - "shapeOrNull", - "nullableShape", - "shapes" - ); - public static DrawingMap of(Map arg, SchemaConfiguration configuration) throws ValidationException { - return Drawing1.getInstance().validate(arg, configuration); - } - - public @Nullable Object mainShape() throws UnsetPropertyException { - String key = "mainShape"; - throwIfKeyNotPresent(key); - @Nullable Object value = get(key); - if (!(value instanceof Object)) { - throw new RuntimeException("Invalid value stored for mainShape"); - } - return (@Nullable Object) value; - } - - public @Nullable Object shapeOrNull() throws UnsetPropertyException { - String key = "shapeOrNull"; - throwIfKeyNotPresent(key); - @Nullable Object value = get(key); - if (!(value instanceof Object)) { - throw new RuntimeException("Invalid value stored for shapeOrNull"); - } - return (@Nullable Object) value; - } - - public @Nullable Object nullableShape() throws UnsetPropertyException { - String key = "nullableShape"; - throwIfKeyNotPresent(key); - @Nullable Object value = get(key); - if (!(value instanceof Object)) { - throw new RuntimeException("Invalid value stored for nullableShape"); - } - return (@Nullable Object) value; - } - - public ShapesList shapes() throws UnsetPropertyException { - String key = "shapes"; - throwIfKeyNotPresent(key); - @Nullable Object value = get(key); - if (!(value instanceof ShapesList)) { - throw new RuntimeException("Invalid value stored for shapes"); - } - return (ShapesList) value; - } - - public @Nullable Object getAdditionalProperty(String name) throws UnsetPropertyException, InvalidAdditionalPropertyException { - throwIfKeyKnown(name, requiredKeys, optionalKeys); - var value = getOrThrow(name); - if (!(value instanceof Object)) { - throw new RuntimeException("Invalid value stored for " + name); - } - return (@Nullable Object) value; - } - } - - public interface SetterForMainShape { - Map getInstance(); - T getBuilderAfterMainShape(Map instance); - - default T mainShape(Nothing? value) { - var instance = getInstance(); - instance.put("mainShape", null); - return getBuilderAfterMainShape(instance); - } - - default T mainShape(boolean value) { - var instance = getInstance(); - instance.put("mainShape", value); - return getBuilderAfterMainShape(instance); - } - - default T mainShape(String value) { - var instance = getInstance(); - instance.put("mainShape", value); - return getBuilderAfterMainShape(instance); - } - - default T mainShape(int value) { - var instance = getInstance(); - instance.put("mainShape", value); - return getBuilderAfterMainShape(instance); - } - - default T mainShape(float value) { - var instance = getInstance(); - instance.put("mainShape", value); - return getBuilderAfterMainShape(instance); - } - - default T mainShape(long value) { - var instance = getInstance(); - instance.put("mainShape", value); - return getBuilderAfterMainShape(instance); - } - - default T mainShape(double value) { - var instance = getInstance(); - instance.put("mainShape", value); - return getBuilderAfterMainShape(instance); - } - - default T mainShape(List value) { - var instance = getInstance(); - instance.put("mainShape", value); - return getBuilderAfterMainShape(instance); - } - - default T mainShape(Map value) { - var instance = getInstance(); - instance.put("mainShape", value); - return getBuilderAfterMainShape(instance); - } - } - - public interface SetterForShapeOrNull { - Map getInstance(); - T getBuilderAfterShapeOrNull(Map instance); - - default T shapeOrNull(Nothing? value) { - var instance = getInstance(); - instance.put("shapeOrNull", null); - return getBuilderAfterShapeOrNull(instance); - } - - default T shapeOrNull(boolean value) { - var instance = getInstance(); - instance.put("shapeOrNull", value); - return getBuilderAfterShapeOrNull(instance); - } - - default T shapeOrNull(String value) { - var instance = getInstance(); - instance.put("shapeOrNull", value); - return getBuilderAfterShapeOrNull(instance); - } - - default T shapeOrNull(int value) { - var instance = getInstance(); - instance.put("shapeOrNull", value); - return getBuilderAfterShapeOrNull(instance); - } - - default T shapeOrNull(float value) { - var instance = getInstance(); - instance.put("shapeOrNull", value); - return getBuilderAfterShapeOrNull(instance); - } - - default T shapeOrNull(long value) { - var instance = getInstance(); - instance.put("shapeOrNull", value); - return getBuilderAfterShapeOrNull(instance); - } - - default T shapeOrNull(double value) { - var instance = getInstance(); - instance.put("shapeOrNull", value); - return getBuilderAfterShapeOrNull(instance); - } - - default T shapeOrNull(List value) { - var instance = getInstance(); - instance.put("shapeOrNull", value); - return getBuilderAfterShapeOrNull(instance); - } - - default T shapeOrNull(Map value) { - var instance = getInstance(); - instance.put("shapeOrNull", value); - return getBuilderAfterShapeOrNull(instance); - } - } - - public interface SetterForNullableShape { - Map getInstance(); - T getBuilderAfterNullableShape(Map instance); - - default T nullableShape(Nothing? value) { - var instance = getInstance(); - instance.put("nullableShape", null); - return getBuilderAfterNullableShape(instance); - } - - default T nullableShape(boolean value) { - var instance = getInstance(); - instance.put("nullableShape", value); - return getBuilderAfterNullableShape(instance); - } - - default T nullableShape(String value) { - var instance = getInstance(); - instance.put("nullableShape", value); - return getBuilderAfterNullableShape(instance); - } - - default T nullableShape(int value) { - var instance = getInstance(); - instance.put("nullableShape", value); - return getBuilderAfterNullableShape(instance); - } - - default T nullableShape(float value) { - var instance = getInstance(); - instance.put("nullableShape", value); - return getBuilderAfterNullableShape(instance); - } - - default T nullableShape(long value) { - var instance = getInstance(); - instance.put("nullableShape", value); - return getBuilderAfterNullableShape(instance); - } - - default T nullableShape(double value) { - var instance = getInstance(); - instance.put("nullableShape", value); - return getBuilderAfterNullableShape(instance); - } - - default T nullableShape(List value) { - var instance = getInstance(); - instance.put("nullableShape", value); - return getBuilderAfterNullableShape(instance); - } - - default T nullableShape(Map value) { - var instance = getInstance(); - instance.put("nullableShape", value); - return getBuilderAfterNullableShape(instance); - } - } - - public interface SetterForShapes { - Map getInstance(); - T getBuilderAfterShapes(Map instance); - - default T shapes(List<@Nullable Object> value) { - var instance = getInstance(); - instance.put("shapes", value); - return getBuilderAfterShapes(instance); - } - } - - public interface SetterForAdditionalProperties { - Set getKnownKeys(); - Map getInstance(); - T getBuilderAfterAdditionalProperty(Map instance); - - default T additionalProperty(String key, Nothing? value) throws InvalidAdditionalPropertyException { - MapUtils.throwIfKeyKnown(key, getKnownKeys(), true); - var instance = getInstance(); - instance.put(key, null); - return getBuilderAfterAdditionalProperty(instance); - } - - default T additionalProperty(String key, boolean value) throws InvalidAdditionalPropertyException { - MapUtils.throwIfKeyKnown(key, getKnownKeys(), true); - var instance = getInstance(); - instance.put(key, value); - return getBuilderAfterAdditionalProperty(instance); - } - - default T additionalProperty(String key, String value) throws InvalidAdditionalPropertyException { - MapUtils.throwIfKeyKnown(key, getKnownKeys(), true); - var instance = getInstance(); - instance.put(key, value); - return getBuilderAfterAdditionalProperty(instance); - } - - default T additionalProperty(String key, int value) throws InvalidAdditionalPropertyException { - MapUtils.throwIfKeyKnown(key, getKnownKeys(), true); - var instance = getInstance(); - instance.put(key, value); - return getBuilderAfterAdditionalProperty(instance); - } - - default T additionalProperty(String key, float value) throws InvalidAdditionalPropertyException { - MapUtils.throwIfKeyKnown(key, getKnownKeys(), true); - var instance = getInstance(); - instance.put(key, value); - return getBuilderAfterAdditionalProperty(instance); - } - - default T additionalProperty(String key, long value) throws InvalidAdditionalPropertyException { - MapUtils.throwIfKeyKnown(key, getKnownKeys(), true); - var instance = getInstance(); - instance.put(key, value); - return getBuilderAfterAdditionalProperty(instance); - } - - default T additionalProperty(String key, double value) throws InvalidAdditionalPropertyException { - MapUtils.throwIfKeyKnown(key, getKnownKeys(), true); - var instance = getInstance(); - instance.put(key, value); - return getBuilderAfterAdditionalProperty(instance); - } - - default T additionalProperty(String key, List value) throws InvalidAdditionalPropertyException { - MapUtils.throwIfKeyKnown(key, getKnownKeys(), true); - var instance = getInstance(); - instance.put(key, value); - return getBuilderAfterAdditionalProperty(instance); - } - - default T additionalProperty(String key, Map value) throws InvalidAdditionalPropertyException { - MapUtils.throwIfKeyKnown(key, getKnownKeys(), true); - var instance = getInstance(); - instance.put(key, value); - return getBuilderAfterAdditionalProperty(instance); - } - } - - public static class DrawingMapBuilder implements GenericBuilder>, SetterForMainShape, SetterForShapeOrNull, SetterForNullableShape, SetterForShapes, SetterForAdditionalProperties { - private final Map instance; - private static final Set knownKeys = Set.of( - "mainShape", - "shapeOrNull", - "nullableShape", - "shapes" - ); - public Set getKnownKeys() { - return knownKeys; - } - public DrawingMapBuilder() { - this.instance = new LinkedHashMap<>(); - } - public Map build() { - return instance; - } - public Map getInstance() { - return instance; - } - public DrawingMapBuilder getBuilderAfterMainShape(Map instance) { - return this; - } - public DrawingMapBuilder getBuilderAfterShapeOrNull(Map instance) { - return this; - } - public DrawingMapBuilder getBuilderAfterNullableShape(Map instance) { - return this; - } - public DrawingMapBuilder getBuilderAfterShapes(Map instance) { - return this; - } - public DrawingMapBuilder getBuilderAfterAdditionalProperty(Map instance) { - return this; - } - } - - - public sealed interface Drawing1Boxed permits Drawing1BoxedMap { - @Nullable Object getData(); - } - - public record Drawing1BoxedMap(DrawingMap data) implements Drawing1Boxed { - @Override - public @Nullable Object getData() { - return data; - } - } - - - public static class Drawing1 extends JsonSchema implements MapSchemaValidator { - /* - NOTE: This class is auto generated by OpenAPI JSON Schema Generator. - Ref: https://github.com/openapi-json-schema-tools/openapi-json-schema-generator - - Do not edit the class manually. - */ - private static @Nullable Drawing1 instance = null; - - protected Drawing1() { - super(new JsonSchemaInfo() - .type(Set.of(Map.class)) - .properties(Map.ofEntries( - new PropertyEntry("mainShape", Shape.Shape1.class), - new PropertyEntry("shapeOrNull", ShapeOrNull.ShapeOrNull1.class), - new PropertyEntry("nullableShape", NullableShape.NullableShape1.class), - new PropertyEntry("shapes", Shapes.class) - )) - .additionalProperties(Fruit.Fruit1.class) - ); - } - - public static Drawing1 getInstance() { - if (instance == null) { - instance = new Drawing1(); - } - return instance; - } - - 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 RuntimeException("Invalid non-string key value"); - } - String propertyName = (String) entryKey; - List propertyPathToItem = new ArrayList<>(pathToItem); - propertyPathToItem.add(propertyName); - Object value = entry.getValue(); - LinkedHashMap, Nothing?> schemas = pathToSchemas.get(propertyPathToItem); - if (schemas == null) { - throw new RuntimeException("Validation result is invalid, schemas must exist for a pathToItem"); - } - JsonSchema propertySchema = schemas.entrySet().iterator().next().getKey(); - @Nullable Object propertyInstance = propertySchema.getNewInstance(value, propertyPathToItem, pathToSchemas); - properties.put(propertyName, propertyInstance); - } - FrozenMap<@Nullable Object> castProperties = new FrozenMap<>(properties); - return new DrawingMap(castProperties); - } - - 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); - SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().build())); - ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, new PathToSchemasMap(), new LinkedHashSet<>()); - PathToSchemasMap pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet); - return getNewInstance(castArg, validationMetadata.pathToItem(), pathToSchemasMap); - } - - - @Override - public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws 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"); - } - @Override - public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { - if (arg instanceof Map) { - return getNewInstance((Map) arg, pathToItem, pathToSchemas); - } - 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 { - return new Drawing1BoxedMap(validate(arg, configuration)); - } - @Override - public Drawing1Boxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { - 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"); - } - } - -} diff --git a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/schemas/EnumArrays.kt b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/schemas/EnumArrays.kt deleted file mode 100644 index c9d26d014fe..00000000000 --- a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/schemas/EnumArrays.kt +++ /dev/null @@ -1,542 +0,0 @@ -package org.openapijsonschematools.client.components.schemas; -import java.util.ArrayList; -import java.util.HashSet; -import java.util.LinkedHashMap; -import java.util.LinkedHashSet; -import java.util.List; -import java.util.Map; -import java.util.Objects; -import java.util.Set; -import org.checkerframework.checker.nullness.qual.Nullable; -import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags; -import org.openapijsonschematools.client.configurations.SchemaConfiguration; -import org.openapijsonschematools.client.exceptions.InvalidAdditionalPropertyException; -import org.openapijsonschematools.client.exceptions.UnsetPropertyException; -import org.openapijsonschematools.client.exceptions.ValidationException; -import org.openapijsonschematools.client.schemas.GenericBuilder; -import org.openapijsonschematools.client.schemas.SetMaker; -import org.openapijsonschematools.client.schemas.UnsetAddPropsSetter; -import org.openapijsonschematools.client.schemas.validation.FrozenList; -import org.openapijsonschematools.client.schemas.validation.FrozenMap; -import org.openapijsonschematools.client.schemas.validation.JsonSchema; -import org.openapijsonschematools.client.schemas.validation.JsonSchemaInfo; -import org.openapijsonschematools.client.schemas.validation.ListSchemaValidator; -import org.openapijsonschematools.client.schemas.validation.MapSchemaValidator; -import org.openapijsonschematools.client.schemas.validation.PathToSchemasMap; -import org.openapijsonschematools.client.schemas.validation.PropertyEntry; -import org.openapijsonschematools.client.schemas.validation.StringEnumValidator; -import org.openapijsonschematools.client.schemas.validation.StringSchemaValidator; -import org.openapijsonschematools.client.schemas.validation.StringValueMethod; -import org.openapijsonschematools.client.schemas.validation.ValidationMetadata; - -public class EnumArrays { - // nest classes so all schemas and input/output classes can be public - - public enum StringJustSymbolEnums implements StringValueMethod { - GREATER_THAN_SIGN_EQUALS_SIGN(">="), - DOLLAR_SIGN("$"); - private final String value; - - StringJustSymbolEnums(String value) { - this.value = value; - } - public String value() { - return this.value; - } - } - - - public sealed interface JustSymbolBoxed permits JustSymbolBoxedString { - @Nullable Object getData(); - } - - public record JustSymbolBoxedString(String data) implements JustSymbolBoxed { - @Override - public @Nullable Object getData() { - return data; - } - } - - - - public static class JustSymbol extends JsonSchema implements StringSchemaValidator, StringEnumValidator { - private static @Nullable JustSymbol instance = null; - - protected JustSymbol() { - super(new JsonSchemaInfo() - .type(Set.of( - String.class - )) - .enumValues(SetMaker.makeSet( - ">=", - "$" - )) - ); - } - - public static JustSymbol getInstance() { - if (instance == null) { - instance = new JustSymbol(); - } - return instance; - } - - @Override - public String validate(String arg, SchemaConfiguration configuration) throws ValidationException { - Set> pathSet = new HashSet<>(); - List pathToItem = List.of("args[0"); - String castArg = castToAllowedTypes(arg, pathToItem, pathSet); - SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().build())); - ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, new PathToSchemasMap(), new LinkedHashSet<>()); - getPathToSchemas(this, castArg, validationMetadata, pathSet); - return castArg; - } - - @Override - 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 { - 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"); - } - @Override - public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { - 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"); - } - @Override - 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 { - 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"); - } - } - public enum StringItemsEnums implements StringValueMethod { - FISH("fish"), - CRAB("crab"); - private final String value; - - StringItemsEnums(String value) { - this.value = value; - } - public String value() { - return this.value; - } - } - - - public sealed interface ItemsBoxed permits ItemsBoxedString { - @Nullable Object getData(); - } - - public record ItemsBoxedString(String data) implements ItemsBoxed { - @Override - public @Nullable Object getData() { - return data; - } - } - - - - public static class Items extends JsonSchema implements StringSchemaValidator, StringEnumValidator { - private static @Nullable Items instance = null; - - protected Items() { - super(new JsonSchemaInfo() - .type(Set.of( - String.class - )) - .enumValues(SetMaker.makeSet( - "fish", - "crab" - )) - ); - } - - public static Items getInstance() { - if (instance == null) { - instance = new Items(); - } - return instance; - } - - @Override - public String validate(String arg, SchemaConfiguration configuration) throws ValidationException { - Set> pathSet = new HashSet<>(); - List pathToItem = List.of("args[0"); - String castArg = castToAllowedTypes(arg, pathToItem, pathSet); - SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().build())); - ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, new PathToSchemasMap(), new LinkedHashSet<>()); - getPathToSchemas(this, castArg, validationMetadata, pathSet); - return castArg; - } - - @Override - 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 { - 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"); - } - @Override - public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { - 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"); - } - @Override - 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 { - 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"); - } - } - - public static class ArrayEnumList extends FrozenList { - protected ArrayEnumList(FrozenList m) { - super(m); - } - public static ArrayEnumList of(List arg, SchemaConfiguration configuration) throws ValidationException { - return ArrayEnum.getInstance().validate(arg, configuration); - } - } - - public static class ArrayEnumListBuilder { - // class to build List - private final List list; - - public ArrayEnumListBuilder() { - list = new ArrayList<>(); - } - - public ArrayEnumListBuilder(List list) { - this.list = list; - } - - public ArrayEnumListBuilder add(String item) { - list.add(item); - return this; - } - - public ArrayEnumListBuilder add(StringItemsEnums item) { - list.add(item.value()); - return this; - } - - public List build() { - return list; - } - } - - - public sealed interface ArrayEnumBoxed permits ArrayEnumBoxedList { - @Nullable Object getData(); - } - - public record ArrayEnumBoxedList(ArrayEnumList data) implements ArrayEnumBoxed { - @Override - public @Nullable Object getData() { - return data; - } - } - - - - public static class ArrayEnum extends JsonSchema implements ListSchemaValidator { - private static @Nullable ArrayEnum instance = null; - - protected ArrayEnum() { - super(new JsonSchemaInfo() - .type(Set.of(List.class)) - .items(Items.class) - ); - } - - public static ArrayEnum getInstance() { - if (instance == null) { - instance = new ArrayEnum(); - } - return instance; - } - - @Override - public ArrayEnumList getNewInstance(List arg, List pathToItem, PathToSchemasMap pathToSchemas) { - List items = new ArrayList<>(); - int i = 0; - for (Object item: arg) { - List itemPathToItem = new ArrayList<>(pathToItem); - itemPathToItem.add(i); - LinkedHashMap, Nothing?> schemas = pathToSchemas.get(itemPathToItem); - if (schemas == null) { - throw new RuntimeException("Validation 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"); - } - items.add((String) itemInstance); - i += 1; - } - FrozenList newInstanceItems = new FrozenList<>(items); - return new ArrayEnumList(newInstanceItems); - } - - 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); - SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().build())); - ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, new PathToSchemasMap(), new LinkedHashSet<>()); - PathToSchemasMap pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet); - return getNewInstance(castArg, validationMetadata.pathToItem(), pathToSchemasMap); - } - - @Override - public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws 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"); - } - @Override - public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { - 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"); - } - @Override - 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 { - 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"); - } - } - - public static class EnumArraysMap extends FrozenMap<@Nullable Object> { - protected EnumArraysMap(FrozenMap<@Nullable Object> m) { - super(m); - } - public static final Set requiredKeys = Set.of(); - public static final Set optionalKeys = Set.of( - "just_symbol", - "array_enum" - ); - public static EnumArraysMap of(Map arg, SchemaConfiguration configuration) throws ValidationException { - return EnumArrays1.getInstance().validate(arg, configuration); - } - - public String just_symbol() throws UnsetPropertyException { - String key = "just_symbol"; - throwIfKeyNotPresent(key); - @Nullable Object value = get(key); - if (!(value instanceof String)) { - throw new RuntimeException("Invalid value stored for just_symbol"); - } - return (String) value; - } - - public ArrayEnumList array_enum() throws UnsetPropertyException { - String key = "array_enum"; - throwIfKeyNotPresent(key); - @Nullable Object value = get(key); - if (!(value instanceof ArrayEnumList)) { - throw new RuntimeException("Invalid value stored for array_enum"); - } - return (ArrayEnumList) value; - } - - public @Nullable Object getAdditionalProperty(String name) throws UnsetPropertyException, InvalidAdditionalPropertyException { - throwIfKeyKnown(name, requiredKeys, optionalKeys); - throwIfKeyNotPresent(name); - return get(name); - } - } - - public interface SetterForJustSymbol { - Map getInstance(); - T getBuilderAfterJustSymbol(Map instance); - - default T just_symbol(String value) { - var instance = getInstance(); - instance.put("just_symbol", value); - return getBuilderAfterJustSymbol(instance); - } - - default T just_symbol(StringJustSymbolEnums value) { - var instance = getInstance(); - instance.put("just_symbol", value.value()); - return getBuilderAfterJustSymbol(instance); - } - } - - public interface SetterForArrayEnum { - Map getInstance(); - T getBuilderAfterArrayEnum(Map instance); - - default T array_enum(List value) { - var instance = getInstance(); - instance.put("array_enum", value); - return getBuilderAfterArrayEnum(instance); - } - } - - public static class EnumArraysMapBuilder extends UnsetAddPropsSetter implements GenericBuilder>, SetterForJustSymbol, SetterForArrayEnum { - private final Map instance; - private static final Set knownKeys = Set.of( - "just_symbol", - "array_enum" - ); - public Set getKnownKeys() { - return knownKeys; - } - public EnumArraysMapBuilder() { - this.instance = new LinkedHashMap<>(); - } - public Map build() { - return instance; - } - public Map getInstance() { - return instance; - } - public EnumArraysMapBuilder getBuilderAfterJustSymbol(Map instance) { - return this; - } - public EnumArraysMapBuilder getBuilderAfterArrayEnum(Map instance) { - return this; - } - public EnumArraysMapBuilder getBuilderAfterAdditionalProperty(Map instance) { - return this; - } - } - - - public sealed interface EnumArrays1Boxed permits EnumArrays1BoxedMap { - @Nullable Object getData(); - } - - public record EnumArrays1BoxedMap(EnumArraysMap data) implements EnumArrays1Boxed { - @Override - public @Nullable Object getData() { - return data; - } - } - - - public static class EnumArrays1 extends JsonSchema implements MapSchemaValidator { - /* - NOTE: This class is auto generated by OpenAPI JSON Schema Generator. - Ref: https://github.com/openapi-json-schema-tools/openapi-json-schema-generator - - Do not edit the class manually. - */ - private static @Nullable EnumArrays1 instance = null; - - protected EnumArrays1() { - super(new JsonSchemaInfo() - .type(Set.of(Map.class)) - .properties(Map.ofEntries( - new PropertyEntry("just_symbol", JustSymbol.class), - new PropertyEntry("array_enum", ArrayEnum.class) - )) - ); - } - - public static EnumArrays1 getInstance() { - if (instance == null) { - instance = new EnumArrays1(); - } - return instance; - } - - 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 RuntimeException("Invalid non-string key value"); - } - String propertyName = (String) entryKey; - List propertyPathToItem = new ArrayList<>(pathToItem); - propertyPathToItem.add(propertyName); - Object value = entry.getValue(); - LinkedHashMap, Nothing?> schemas = pathToSchemas.get(propertyPathToItem); - if (schemas == null) { - throw new RuntimeException("Validation result is invalid, schemas must exist for a pathToItem"); - } - JsonSchema propertySchema = schemas.entrySet().iterator().next().getKey(); - @Nullable Object propertyInstance = propertySchema.getNewInstance(value, propertyPathToItem, pathToSchemas); - properties.put(propertyName, propertyInstance); - } - FrozenMap<@Nullable Object> castProperties = new FrozenMap<>(properties); - return new EnumArraysMap(castProperties); - } - - 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); - SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().build())); - ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, new PathToSchemasMap(), new LinkedHashSet<>()); - PathToSchemasMap pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet); - return getNewInstance(castArg, validationMetadata.pathToItem(), pathToSchemasMap); - } - - - @Override - public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws 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"); - } - @Override - public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { - if (arg instanceof Map) { - return getNewInstance((Map) arg, pathToItem, pathToSchemas); - } - 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 { - return new EnumArrays1BoxedMap(validate(arg, configuration)); - } - @Override - public EnumArrays1Boxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { - 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"); - } - } - -} diff --git a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/schemas/EnumClass.kt b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/schemas/EnumClass.kt deleted file mode 100644 index 210abc01cb8..00000000000 --- a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/schemas/EnumClass.kt +++ /dev/null @@ -1,134 +0,0 @@ -package org.openapijsonschematools.client.components.schemas; -import java.util.HashSet; -import java.util.LinkedHashSet; -import java.util.List; -import java.util.Objects; -import java.util.Set; -import org.checkerframework.checker.nullness.qual.Nullable; -import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags; -import org.openapijsonschematools.client.configurations.SchemaConfiguration; -import org.openapijsonschematools.client.exceptions.ValidationException; -import org.openapijsonschematools.client.schemas.SetMaker; -import org.openapijsonschematools.client.schemas.validation.DefaultValueMethod; -import org.openapijsonschematools.client.schemas.validation.JsonSchema; -import org.openapijsonschematools.client.schemas.validation.JsonSchemaInfo; -import org.openapijsonschematools.client.schemas.validation.PathToSchemasMap; -import org.openapijsonschematools.client.schemas.validation.StringEnumValidator; -import org.openapijsonschematools.client.schemas.validation.StringSchemaValidator; -import org.openapijsonschematools.client.schemas.validation.StringValueMethod; -import org.openapijsonschematools.client.schemas.validation.ValidationMetadata; - -public class EnumClass { - // nest classes so all schemas and input/output classes can be public - - public enum StringEnumClassEnums implements StringValueMethod { - LOW_LINE_ABC("_abc"), - HYPHEN_MINUS_EFG("-efg"), - LEFT_PARENTHESIS_XYZ_RIGHT_PARENTHESIS("(xyz)"), - COUNT_1M("COUNT_1M"), - COUNT_50M("COUNT_50M"); - private final String value; - - StringEnumClassEnums(String value) { - this.value = value; - } - public String value() { - return this.value; - } - } - - - public sealed interface EnumClass1Boxed permits EnumClass1BoxedString { - @Nullable Object getData(); - } - - public record EnumClass1BoxedString(String data) implements EnumClass1Boxed { - @Override - public @Nullable Object getData() { - return data; - } - } - - - - public static class EnumClass1 extends JsonSchema implements StringSchemaValidator, StringEnumValidator, DefaultValueMethod { - /* - NOTE: This class is auto generated by OpenAPI JSON Schema Generator. - Ref: https://github.com/openapi-json-schema-tools/openapi-json-schema-generator - - Do not edit the class manually. - */ - private static @Nullable EnumClass1 instance = null; - - protected EnumClass1() { - super(new JsonSchemaInfo() - .type(Set.of( - String.class - )) - .enumValues(SetMaker.makeSet( - "_abc", - "-efg", - "(xyz)", - "COUNT_1M", - "COUNT_50M" - )) - .defaultValue("-efg") - ); - } - - public static EnumClass1 getInstance() { - if (instance == null) { - instance = new EnumClass1(); - } - return instance; - } - - @Override - public String validate(String arg, SchemaConfiguration configuration) throws ValidationException { - Set> pathSet = new HashSet<>(); - List pathToItem = List.of("args[0"); - String castArg = castToAllowedTypes(arg, pathToItem, pathSet); - SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().build())); - ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, new PathToSchemasMap(), new LinkedHashSet<>()); - getPathToSchemas(this, castArg, validationMetadata, pathSet); - return castArg; - } - - @Override - 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 { - 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"); - } - @Override - public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { - 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"); - } - public String defaultValue() throws ValidationException { - if (defaultValue instanceof String) { - return (String) defaultValue; - } - throw new ValidationException("Invalid type stored in defaultValue"); - } - @Override - 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 { - 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"); - } - } -} diff --git a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/schemas/EnumTest.kt b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/schemas/EnumTest.kt deleted file mode 100644 index e2312abcb78..00000000000 --- a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/schemas/EnumTest.kt +++ /dev/null @@ -1,1117 +0,0 @@ -package org.openapijsonschematools.client.components.schemas; -import java.math.BigDecimal; -import java.util.ArrayList; -import java.util.HashSet; -import java.util.LinkedHashMap; -import java.util.LinkedHashSet; -import java.util.List; -import java.util.Map; -import java.util.Objects; -import java.util.Set; -import org.checkerframework.checker.nullness.qual.Nullable; -import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags; -import org.openapijsonschematools.client.configurations.SchemaConfiguration; -import org.openapijsonschematools.client.exceptions.InvalidAdditionalPropertyException; -import org.openapijsonschematools.client.exceptions.UnsetPropertyException; -import org.openapijsonschematools.client.exceptions.ValidationException; -import org.openapijsonschematools.client.schemas.GenericBuilder; -import org.openapijsonschematools.client.schemas.SetMaker; -import org.openapijsonschematools.client.schemas.UnsetAddPropsSetter; -import org.openapijsonschematools.client.schemas.validation.DoubleEnumValidator; -import org.openapijsonschematools.client.schemas.validation.DoubleValueMethod; -import org.openapijsonschematools.client.schemas.validation.FloatEnumValidator; -import org.openapijsonschematools.client.schemas.validation.FloatValueMethod; -import org.openapijsonschematools.client.schemas.validation.FrozenMap; -import org.openapijsonschematools.client.schemas.validation.IntegerEnumValidator; -import org.openapijsonschematools.client.schemas.validation.IntegerValueMethod; -import org.openapijsonschematools.client.schemas.validation.JsonSchema; -import org.openapijsonschematools.client.schemas.validation.JsonSchemaInfo; -import org.openapijsonschematools.client.schemas.validation.LongEnumValidator; -import org.openapijsonschematools.client.schemas.validation.LongValueMethod; -import org.openapijsonschematools.client.schemas.validation.MapSchemaValidator; -import org.openapijsonschematools.client.schemas.validation.NumberSchemaValidator; -import org.openapijsonschematools.client.schemas.validation.PathToSchemasMap; -import org.openapijsonschematools.client.schemas.validation.PropertyEntry; -import org.openapijsonschematools.client.schemas.validation.StringEnumValidator; -import org.openapijsonschematools.client.schemas.validation.StringSchemaValidator; -import org.openapijsonschematools.client.schemas.validation.StringValueMethod; -import org.openapijsonschematools.client.schemas.validation.ValidationMetadata; - -public class EnumTest { - // nest classes so all schemas and input/output classes can be public - - public enum StringEnumStringEnums implements StringValueMethod { - UPPER("UPPER"), - LOWER("lower"), - EMPTY(""); - private final String value; - - StringEnumStringEnums(String value) { - this.value = value; - } - public String value() { - return this.value; - } - } - - - public sealed interface EnumStringBoxed permits EnumStringBoxedString { - @Nullable Object getData(); - } - - public record EnumStringBoxedString(String data) implements EnumStringBoxed { - @Override - public @Nullable Object getData() { - return data; - } - } - - - - public static class EnumString extends JsonSchema implements StringSchemaValidator, StringEnumValidator { - private static @Nullable EnumString instance = null; - - protected EnumString() { - super(new JsonSchemaInfo() - .type(Set.of( - String.class - )) - .enumValues(SetMaker.makeSet( - "UPPER", - "lower", - "" - )) - ); - } - - public static EnumString getInstance() { - if (instance == null) { - instance = new EnumString(); - } - return instance; - } - - @Override - public String validate(String arg, SchemaConfiguration configuration) throws ValidationException { - Set> pathSet = new HashSet<>(); - List pathToItem = List.of("args[0"); - String castArg = castToAllowedTypes(arg, pathToItem, pathSet); - SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().build())); - ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, new PathToSchemasMap(), new LinkedHashSet<>()); - getPathToSchemas(this, castArg, validationMetadata, pathSet); - return castArg; - } - - @Override - 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 { - 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"); - } - @Override - public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { - 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"); - } - @Override - 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 { - 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"); - } - } - public enum StringEnumStringRequiredEnums implements StringValueMethod { - UPPER("UPPER"), - LOWER("lower"), - EMPTY(""); - private final String value; - - StringEnumStringRequiredEnums(String value) { - this.value = value; - } - public String value() { - return this.value; - } - } - - - public sealed interface EnumStringRequiredBoxed permits EnumStringRequiredBoxedString { - @Nullable Object getData(); - } - - public record EnumStringRequiredBoxedString(String data) implements EnumStringRequiredBoxed { - @Override - public @Nullable Object getData() { - return data; - } - } - - - - public static class EnumStringRequired extends JsonSchema implements StringSchemaValidator, StringEnumValidator { - private static @Nullable EnumStringRequired instance = null; - - protected EnumStringRequired() { - super(new JsonSchemaInfo() - .type(Set.of( - String.class - )) - .enumValues(SetMaker.makeSet( - "UPPER", - "lower", - "" - )) - ); - } - - public static EnumStringRequired getInstance() { - if (instance == null) { - instance = new EnumStringRequired(); - } - return instance; - } - - @Override - public String validate(String arg, SchemaConfiguration configuration) throws ValidationException { - Set> pathSet = new HashSet<>(); - List pathToItem = List.of("args[0"); - String castArg = castToAllowedTypes(arg, pathToItem, pathSet); - SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().build())); - ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, new PathToSchemasMap(), new LinkedHashSet<>()); - getPathToSchemas(this, castArg, validationMetadata, pathSet); - return castArg; - } - - @Override - 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 { - 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"); - } - @Override - public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { - 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"); - } - @Override - 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 { - 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"); - } - } - public enum IntegerEnumIntegerEnums implements IntegerValueMethod { - POSITIVE_1(1), - NEGATIVE_1(-1); - private final int value; - - IntegerEnumIntegerEnums(int value) { - this.value = value; - } - public int value() { - return this.value; - } - } - - public enum LongEnumIntegerEnums implements LongValueMethod { - POSITIVE_1(1L), - NEGATIVE_1(-1L); - private final long value; - - LongEnumIntegerEnums(long value) { - this.value = value; - } - public long value() { - return this.value; - } - } - - public enum FloatEnumIntegerEnums implements FloatValueMethod { - POSITIVE_1(1.0f), - NEGATIVE_1(-1.0f); - private final float value; - - FloatEnumIntegerEnums(float value) { - this.value = value; - } - public float value() { - return this.value; - } - } - - public enum DoubleEnumIntegerEnums implements DoubleValueMethod { - POSITIVE_1(1.0d), - NEGATIVE_1(-1.0d); - private final double value; - - DoubleEnumIntegerEnums(double value) { - this.value = value; - } - public double value() { - return this.value; - } - } - - - public sealed interface EnumIntegerBoxed permits EnumIntegerBoxedNumber { - @Nullable Object getData(); - } - - public record EnumIntegerBoxedNumber(Number data) implements EnumIntegerBoxed { - @Override - public @Nullable Object getData() { - return data; - } - } - - - - public static class EnumInteger extends JsonSchema implements IntegerEnumValidator, LongEnumValidator, FloatEnumValidator, DoubleEnumValidator, NumberSchemaValidator { - private static @Nullable EnumInteger instance = null; - - protected EnumInteger() { - super(new JsonSchemaInfo() - .type(Set.of( - Integer.class, - Long.class, - Float.class, - Double.class - )) - .format("int32") - .enumValues(SetMaker.makeSet( - new BigDecimal("1"), - new BigDecimal("-1") - )) - ); - } - - public static EnumInteger getInstance() { - if (instance == null) { - instance = new EnumInteger(); - } - return instance; - } - - @Override - public Number validate(Number arg, SchemaConfiguration configuration) throws ValidationException { - Set> pathSet = new HashSet<>(); - List pathToItem = List.of("args[0"); - Number castArg = castToAllowedTypes(arg, pathToItem, pathSet); - SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().build())); - ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, new PathToSchemasMap(), new LinkedHashSet<>()); - getPathToSchemas(this, castArg, validationMetadata, pathSet); - return castArg; - } - - public int validate(int arg, SchemaConfiguration configuration) throws ValidationException { - return (int) validate((Number) arg, configuration); - } - - public float validate(float arg, SchemaConfiguration configuration) throws ValidationException { - return (float) validate((Number) arg, configuration); - } - - @Override - 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 ValidationException { - return (long) validate((Number) arg.value(), configuration); - } - - @Override - 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 ValidationException { - return (double) validate((Number) arg.value(), configuration); - } - - @Override - public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws 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"); - } - @Override - public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { - 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"); - } - @Override - 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 { - 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"); - } - } - public enum DoubleEnumNumberEnums implements DoubleValueMethod { - POSITIVE_1_PT_1(1.1d), - NEGATIVE_1_PT_2(-1.2d); - private final double value; - - DoubleEnumNumberEnums(double value) { - this.value = value; - } - public double value() { - return this.value; - } - } - - public enum FloatEnumNumberEnums implements FloatValueMethod { - POSITIVE_1_PT_1(1.1f), - NEGATIVE_1_PT_2(-1.2f); - private final float value; - - FloatEnumNumberEnums(float value) { - this.value = value; - } - public float value() { - return this.value; - } - } - - - public sealed interface EnumNumberBoxed permits EnumNumberBoxedNumber { - @Nullable Object getData(); - } - - public record EnumNumberBoxedNumber(Number data) implements EnumNumberBoxed { - @Override - public @Nullable Object getData() { - return data; - } - } - - - - public static class EnumNumber extends JsonSchema implements FloatEnumValidator, DoubleEnumValidator, NumberSchemaValidator { - private static @Nullable EnumNumber instance = null; - - protected EnumNumber() { - super(new JsonSchemaInfo() - .type(Set.of( - Integer.class, - Long.class, - Float.class, - Double.class - )) - .format("double") - .enumValues(SetMaker.makeSet( - new BigDecimal("1.1"), - new BigDecimal("-1.2") - )) - ); - } - - public static EnumNumber getInstance() { - if (instance == null) { - instance = new EnumNumber(); - } - return instance; - } - - @Override - public Number validate(Number arg, SchemaConfiguration configuration) throws ValidationException { - Set> pathSet = new HashSet<>(); - List pathToItem = List.of("args[0"); - Number castArg = castToAllowedTypes(arg, pathToItem, pathSet); - SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().build())); - ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, new PathToSchemasMap(), new LinkedHashSet<>()); - PathToSchemasMap pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet); - return castArg; - } - public double validate(double arg, SchemaConfiguration configuration) throws ValidationException { - return (double) validate((Number) arg, configuration); - } - - @Override - 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 ValidationException { - return (double) validate((Number) arg.value(), configuration); - } - - @Override - public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws 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"); - } - @Override - public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { - 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"); - } - @Override - 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 { - 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"); - } - } - - public static class EnumTestMap extends FrozenMap<@Nullable Object> { - protected EnumTestMap(FrozenMap<@Nullable Object> m) { - super(m); - } - public static final Set requiredKeys = Set.of( - "enum_string_required" - ); - public static final Set optionalKeys = Set.of( - "enum_string", - "enum_integer", - "enum_number", - "stringEnum", - "IntegerEnum", - "StringEnumWithDefaultValue", - "IntegerEnumWithDefaultValue", - "IntegerEnumOneValue" - ); - public static EnumTestMap of(Map arg, SchemaConfiguration configuration) throws ValidationException { - return EnumTest1.getInstance().validate(arg, configuration); - } - - 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"); - } - return (String) value; - } - - public String enum_string() throws UnsetPropertyException { - String key = "enum_string"; - throwIfKeyNotPresent(key); - @Nullable Object value = get(key); - if (!(value instanceof String)) { - throw new RuntimeException("Invalid value stored for enum_string"); - } - return (String) value; - } - - public Number enum_integer() throws UnsetPropertyException { - String key = "enum_integer"; - throwIfKeyNotPresent(key); - @Nullable Object value = get(key); - if (!(value instanceof Number)) { - throw new RuntimeException("Invalid value stored for enum_integer"); - } - return (Number) value; - } - - public Number enum_number() throws UnsetPropertyException { - String key = "enum_number"; - throwIfKeyNotPresent(key); - @Nullable Object value = get(key); - if (!(value instanceof Number)) { - throw new RuntimeException("Invalid value stored for enum_number"); - } - return (Number) value; - } - - public @Nullable String stringEnum() throws UnsetPropertyException { - String key = "stringEnum"; - throwIfKeyNotPresent(key); - @Nullable Object value = get(key); - if (!(value instanceof String)) { - throw new RuntimeException("Invalid value stored for stringEnum"); - } - return (@Nullable String) value; - } - - public Number IntegerEnum() throws UnsetPropertyException { - String key = "IntegerEnum"; - throwIfKeyNotPresent(key); - @Nullable Object value = get(key); - if (!(value instanceof Number)) { - throw new RuntimeException("Invalid value stored for IntegerEnum"); - } - return (Number) value; - } - - public String StringEnumWithDefaultValue() throws UnsetPropertyException { - String key = "StringEnumWithDefaultValue"; - throwIfKeyNotPresent(key); - @Nullable Object value = get(key); - if (!(value instanceof String)) { - throw new RuntimeException("Invalid value stored for StringEnumWithDefaultValue"); - } - return (String) value; - } - - public Number IntegerEnumWithDefaultValue() throws UnsetPropertyException { - String key = "IntegerEnumWithDefaultValue"; - throwIfKeyNotPresent(key); - @Nullable Object value = get(key); - if (!(value instanceof Number)) { - throw new RuntimeException("Invalid value stored for IntegerEnumWithDefaultValue"); - } - return (Number) value; - } - - public Number IntegerEnumOneValue() throws UnsetPropertyException { - String key = "IntegerEnumOneValue"; - throwIfKeyNotPresent(key); - @Nullable Object value = get(key); - if (!(value instanceof Number)) { - throw new RuntimeException("Invalid value stored for IntegerEnumOneValue"); - } - return (Number) value; - } - - public @Nullable Object getAdditionalProperty(String name) throws UnsetPropertyException, InvalidAdditionalPropertyException { - throwIfKeyKnown(name, requiredKeys, optionalKeys); - throwIfKeyNotPresent(name); - return get(name); - } - } - - public interface SetterForEnumStringRequired { - Map getInstance(); - T getBuilderAfterEnumStringRequired(Map instance); - - default T enum_string_required(String value) { - var instance = getInstance(); - instance.put("enum_string_required", value); - return getBuilderAfterEnumStringRequired(instance); - } - - default T enum_string_required(StringEnumStringRequiredEnums value) { - var instance = getInstance(); - instance.put("enum_string_required", value.value()); - return getBuilderAfterEnumStringRequired(instance); - } - } - - public interface SetterForEnumString { - Map getInstance(); - T getBuilderAfterEnumString(Map instance); - - default T enum_string(String value) { - var instance = getInstance(); - instance.put("enum_string", value); - return getBuilderAfterEnumString(instance); - } - - default T enum_string(StringEnumStringEnums value) { - var instance = getInstance(); - instance.put("enum_string", value.value()); - return getBuilderAfterEnumString(instance); - } - } - - public interface SetterForEnumInteger { - Map getInstance(); - T getBuilderAfterEnumInteger(Map instance); - - default T enum_integer(int value) { - var instance = getInstance(); - instance.put("enum_integer", value); - return getBuilderAfterEnumInteger(instance); - } - - default T enum_integer(float value) { - var instance = getInstance(); - instance.put("enum_integer", value); - return getBuilderAfterEnumInteger(instance); - } - - default T enum_integer(IntegerEnumIntegerEnums value) { - var instance = getInstance(); - instance.put("enum_integer", value.value()); - return getBuilderAfterEnumInteger(instance); - } - - default T enum_integer(LongEnumIntegerEnums value) { - var instance = getInstance(); - instance.put("enum_integer", value.value()); - return getBuilderAfterEnumInteger(instance); - } - - default T enum_integer(FloatEnumIntegerEnums value) { - var instance = getInstance(); - instance.put("enum_integer", value.value()); - return getBuilderAfterEnumInteger(instance); - } - - default T enum_integer(DoubleEnumIntegerEnums value) { - var instance = getInstance(); - instance.put("enum_integer", value.value()); - return getBuilderAfterEnumInteger(instance); - } - } - - public interface SetterForEnumNumber { - Map getInstance(); - T getBuilderAfterEnumNumber(Map instance); - - default T enum_number(int value) { - var instance = getInstance(); - instance.put("enum_number", value); - return getBuilderAfterEnumNumber(instance); - } - - default T enum_number(float value) { - var instance = getInstance(); - instance.put("enum_number", value); - return getBuilderAfterEnumNumber(instance); - } - - default T enum_number(long value) { - var instance = getInstance(); - instance.put("enum_number", value); - return getBuilderAfterEnumNumber(instance); - } - - default T enum_number(double value) { - var instance = getInstance(); - instance.put("enum_number", value); - return getBuilderAfterEnumNumber(instance); - } - - default T enum_number(DoubleEnumNumberEnums value) { - var instance = getInstance(); - instance.put("enum_number", value.value()); - return getBuilderAfterEnumNumber(instance); - } - - default T enum_number(FloatEnumNumberEnums value) { - var instance = getInstance(); - instance.put("enum_number", value.value()); - return getBuilderAfterEnumNumber(instance); - } - } - - public interface SetterForStringEnum { - Map getInstance(); - T getBuilderAfterStringEnum(Map instance); - - default T stringEnum(Nothing? value) { - var instance = getInstance(); - instance.put("stringEnum", null); - return getBuilderAfterStringEnum(instance); - } - - default T stringEnum(String value) { - var instance = getInstance(); - instance.put("stringEnum", value); - return getBuilderAfterStringEnum(instance); - } - - default T stringEnum(StringEnum.StringStringEnumEnums value) { - var instance = getInstance(); - instance.put("stringEnum", value.value()); - return getBuilderAfterStringEnum(instance); - } - - default T stringEnum(StringEnum.NullStringEnumEnums value) { - var instance = getInstance(); - instance.put("stringEnum", null); - return getBuilderAfterStringEnum(instance); - } - } - - public interface SetterForIntegerEnum { - Map getInstance(); - T getBuilderAfterIntegerEnum(Map instance); - - default T IntegerEnum(int value) { - var instance = getInstance(); - instance.put("IntegerEnum", value); - return getBuilderAfterIntegerEnum(instance); - } - - default T IntegerEnum(float value) { - var instance = getInstance(); - instance.put("IntegerEnum", value); - return getBuilderAfterIntegerEnum(instance); - } - - default T IntegerEnum(long value) { - var instance = getInstance(); - instance.put("IntegerEnum", value); - return getBuilderAfterIntegerEnum(instance); - } - - default T IntegerEnum(double value) { - var instance = getInstance(); - instance.put("IntegerEnum", value); - return getBuilderAfterIntegerEnum(instance); - } - - default T IntegerEnum(IntegerEnum.IntegerIntegerEnumEnums value) { - var instance = getInstance(); - instance.put("IntegerEnum", value.value()); - return getBuilderAfterIntegerEnum(instance); - } - - default T IntegerEnum(IntegerEnum.LongIntegerEnumEnums value) { - var instance = getInstance(); - instance.put("IntegerEnum", value.value()); - return getBuilderAfterIntegerEnum(instance); - } - - default T IntegerEnum(IntegerEnum.FloatIntegerEnumEnums value) { - var instance = getInstance(); - instance.put("IntegerEnum", value.value()); - return getBuilderAfterIntegerEnum(instance); - } - - default T IntegerEnum(IntegerEnum.DoubleIntegerEnumEnums value) { - var instance = getInstance(); - instance.put("IntegerEnum", value.value()); - return getBuilderAfterIntegerEnum(instance); - } - } - - public interface SetterForStringEnumWithDefaultValue { - Map getInstance(); - T getBuilderAfterStringEnumWithDefaultValue(Map instance); - - default T StringEnumWithDefaultValue(String value) { - var instance = getInstance(); - instance.put("StringEnumWithDefaultValue", value); - return getBuilderAfterStringEnumWithDefaultValue(instance); - } - - default T StringEnumWithDefaultValue(StringEnumWithDefaultValue.StringStringEnumWithDefaultValueEnums value) { - var instance = getInstance(); - instance.put("StringEnumWithDefaultValue", value.value()); - return getBuilderAfterStringEnumWithDefaultValue(instance); - } - } - - public interface SetterForIntegerEnumWithDefaultValue { - Map getInstance(); - T getBuilderAfterIntegerEnumWithDefaultValue(Map instance); - - default T IntegerEnumWithDefaultValue(int value) { - var instance = getInstance(); - instance.put("IntegerEnumWithDefaultValue", value); - return getBuilderAfterIntegerEnumWithDefaultValue(instance); - } - - default T IntegerEnumWithDefaultValue(float value) { - var instance = getInstance(); - instance.put("IntegerEnumWithDefaultValue", value); - return getBuilderAfterIntegerEnumWithDefaultValue(instance); - } - - default T IntegerEnumWithDefaultValue(long value) { - var instance = getInstance(); - instance.put("IntegerEnumWithDefaultValue", value); - return getBuilderAfterIntegerEnumWithDefaultValue(instance); - } - - default T IntegerEnumWithDefaultValue(double value) { - var instance = getInstance(); - instance.put("IntegerEnumWithDefaultValue", value); - return getBuilderAfterIntegerEnumWithDefaultValue(instance); - } - - default T IntegerEnumWithDefaultValue(IntegerEnumWithDefaultValue.IntegerIntegerEnumWithDefaultValueEnums value) { - var instance = getInstance(); - instance.put("IntegerEnumWithDefaultValue", value.value()); - return getBuilderAfterIntegerEnumWithDefaultValue(instance); - } - - default T IntegerEnumWithDefaultValue(IntegerEnumWithDefaultValue.LongIntegerEnumWithDefaultValueEnums value) { - var instance = getInstance(); - instance.put("IntegerEnumWithDefaultValue", value.value()); - return getBuilderAfterIntegerEnumWithDefaultValue(instance); - } - - default T IntegerEnumWithDefaultValue(IntegerEnumWithDefaultValue.FloatIntegerEnumWithDefaultValueEnums value) { - var instance = getInstance(); - instance.put("IntegerEnumWithDefaultValue", value.value()); - return getBuilderAfterIntegerEnumWithDefaultValue(instance); - } - - default T IntegerEnumWithDefaultValue(IntegerEnumWithDefaultValue.DoubleIntegerEnumWithDefaultValueEnums value) { - var instance = getInstance(); - instance.put("IntegerEnumWithDefaultValue", value.value()); - return getBuilderAfterIntegerEnumWithDefaultValue(instance); - } - } - - public interface SetterForIntegerEnumOneValue { - Map getInstance(); - T getBuilderAfterIntegerEnumOneValue(Map instance); - - default T IntegerEnumOneValue(int value) { - var instance = getInstance(); - instance.put("IntegerEnumOneValue", value); - return getBuilderAfterIntegerEnumOneValue(instance); - } - - default T IntegerEnumOneValue(float value) { - var instance = getInstance(); - instance.put("IntegerEnumOneValue", value); - return getBuilderAfterIntegerEnumOneValue(instance); - } - - default T IntegerEnumOneValue(long value) { - var instance = getInstance(); - instance.put("IntegerEnumOneValue", value); - return getBuilderAfterIntegerEnumOneValue(instance); - } - - default T IntegerEnumOneValue(double value) { - var instance = getInstance(); - instance.put("IntegerEnumOneValue", value); - return getBuilderAfterIntegerEnumOneValue(instance); - } - - default T IntegerEnumOneValue(IntegerEnumOneValue.IntegerIntegerEnumOneValueEnums value) { - var instance = getInstance(); - instance.put("IntegerEnumOneValue", value.value()); - return getBuilderAfterIntegerEnumOneValue(instance); - } - - default T IntegerEnumOneValue(IntegerEnumOneValue.LongIntegerEnumOneValueEnums value) { - var instance = getInstance(); - instance.put("IntegerEnumOneValue", value.value()); - return getBuilderAfterIntegerEnumOneValue(instance); - } - - default T IntegerEnumOneValue(IntegerEnumOneValue.FloatIntegerEnumOneValueEnums value) { - var instance = getInstance(); - instance.put("IntegerEnumOneValue", value.value()); - return getBuilderAfterIntegerEnumOneValue(instance); - } - - default T IntegerEnumOneValue(IntegerEnumOneValue.DoubleIntegerEnumOneValueEnums value) { - var instance = getInstance(); - instance.put("IntegerEnumOneValue", value.value()); - return getBuilderAfterIntegerEnumOneValue(instance); - } - } - - public static class EnumTestMap0Builder extends UnsetAddPropsSetter implements GenericBuilder>, SetterForEnumString, SetterForEnumInteger, SetterForEnumNumber, SetterForStringEnum, SetterForIntegerEnum, SetterForStringEnumWithDefaultValue, SetterForIntegerEnumWithDefaultValue, SetterForIntegerEnumOneValue { - private final Map instance; - private static final Set knownKeys = Set.of( - "enum_string_required", - "enum_string", - "enum_integer", - "enum_number", - "stringEnum", - "IntegerEnum", - "StringEnumWithDefaultValue", - "IntegerEnumWithDefaultValue", - "IntegerEnumOneValue" - ); - public Set getKnownKeys() { - return knownKeys; - } - public EnumTestMap0Builder(Map instance) { - this.instance = instance; - } - public Map build() { - return instance; - } - public Map getInstance() { - return instance; - } - public EnumTestMap0Builder getBuilderAfterEnumString(Map instance) { - return this; - } - public EnumTestMap0Builder getBuilderAfterEnumInteger(Map instance) { - return this; - } - public EnumTestMap0Builder getBuilderAfterEnumNumber(Map instance) { - return this; - } - public EnumTestMap0Builder getBuilderAfterStringEnum(Map instance) { - return this; - } - public EnumTestMap0Builder getBuilderAfterIntegerEnum(Map instance) { - return this; - } - public EnumTestMap0Builder getBuilderAfterStringEnumWithDefaultValue(Map instance) { - return this; - } - public EnumTestMap0Builder getBuilderAfterIntegerEnumWithDefaultValue(Map instance) { - return this; - } - public EnumTestMap0Builder getBuilderAfterIntegerEnumOneValue(Map instance) { - return this; - } - public EnumTestMap0Builder getBuilderAfterAdditionalProperty(Map instance) { - return this; - } - } - - public static class EnumTestMapBuilder implements SetterForEnumStringRequired { - private final Map instance; - public EnumTestMapBuilder() { - this.instance = new LinkedHashMap<>(); - } - public Map getInstance() { - return instance; - } - public EnumTestMap0Builder getBuilderAfterEnumStringRequired(Map instance) { - return new EnumTestMap0Builder(instance); - } - } - - - public sealed interface EnumTest1Boxed permits EnumTest1BoxedMap { - @Nullable Object getData(); - } - - public record EnumTest1BoxedMap(EnumTestMap data) implements EnumTest1Boxed { - @Override - public @Nullable Object getData() { - return data; - } - } - - - public static class EnumTest1 extends JsonSchema implements MapSchemaValidator { - /* - NOTE: This class is auto generated by OpenAPI JSON Schema Generator. - Ref: https://github.com/openapi-json-schema-tools/openapi-json-schema-generator - - Do not edit the class manually. - */ - private static @Nullable EnumTest1 instance = null; - - protected EnumTest1() { - super(new JsonSchemaInfo() - .type(Set.of(Map.class)) - .properties(Map.ofEntries( - new PropertyEntry("enum_string", EnumString.class), - new PropertyEntry("enum_string_required", EnumStringRequired.class), - new PropertyEntry("enum_integer", EnumInteger.class), - new PropertyEntry("enum_number", EnumNumber.class), - new PropertyEntry("stringEnum", StringEnum.StringEnum1.class), - new PropertyEntry("IntegerEnum", IntegerEnum.IntegerEnum1.class), - new PropertyEntry("StringEnumWithDefaultValue", StringEnumWithDefaultValue.StringEnumWithDefaultValue1.class), - new PropertyEntry("IntegerEnumWithDefaultValue", IntegerEnumWithDefaultValue.IntegerEnumWithDefaultValue1.class), - new PropertyEntry("IntegerEnumOneValue", IntegerEnumOneValue.IntegerEnumOneValue1.class) - )) - .required(Set.of( - "enum_string_required" - )) - ); - } - - public static EnumTest1 getInstance() { - if (instance == null) { - instance = new EnumTest1(); - } - return instance; - } - - 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 RuntimeException("Invalid non-string key value"); - } - String propertyName = (String) entryKey; - List propertyPathToItem = new ArrayList<>(pathToItem); - propertyPathToItem.add(propertyName); - Object value = entry.getValue(); - LinkedHashMap, Nothing?> schemas = pathToSchemas.get(propertyPathToItem); - if (schemas == null) { - throw new RuntimeException("Validation result is invalid, schemas must exist for a pathToItem"); - } - JsonSchema propertySchema = schemas.entrySet().iterator().next().getKey(); - @Nullable Object propertyInstance = propertySchema.getNewInstance(value, propertyPathToItem, pathToSchemas); - properties.put(propertyName, propertyInstance); - } - FrozenMap<@Nullable Object> castProperties = new FrozenMap<>(properties); - return new EnumTestMap(castProperties); - } - - 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); - SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().build())); - ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, new PathToSchemasMap(), new LinkedHashSet<>()); - PathToSchemasMap pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet); - return getNewInstance(castArg, validationMetadata.pathToItem(), pathToSchemasMap); - } - - - @Override - public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws 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"); - } - @Override - public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { - if (arg instanceof Map) { - return getNewInstance((Map) arg, pathToItem, pathToSchemas); - } - 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 { - return new EnumTest1BoxedMap(validate(arg, configuration)); - } - @Override - public EnumTest1Boxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { - 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"); - } - } - -} diff --git a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/schemas/EquilateralTriangle.kt b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/schemas/EquilateralTriangle.kt deleted file mode 100644 index 3a7ef43bfe8..00000000000 --- a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/schemas/EquilateralTriangle.kt +++ /dev/null @@ -1,589 +0,0 @@ -package org.openapijsonschematools.client.components.schemas; -import java.time.LocalDate; -import java.time.ZonedDateTime; -import java.util.ArrayList; -import java.util.HashSet; -import java.util.LinkedHashMap; -import java.util.LinkedHashSet; -import java.util.List; -import java.util.Map; -import java.util.Objects; -import java.util.Set; -import java.util.UUID; -import org.checkerframework.checker.nullness.qual.Nullable; -import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags; -import org.openapijsonschematools.client.configurations.SchemaConfiguration; -import org.openapijsonschematools.client.exceptions.InvalidAdditionalPropertyException; -import org.openapijsonschematools.client.exceptions.UnsetPropertyException; -import org.openapijsonschematools.client.exceptions.ValidationException; -import org.openapijsonschematools.client.schemas.GenericBuilder; -import org.openapijsonschematools.client.schemas.SetMaker; -import org.openapijsonschematools.client.schemas.UnsetAddPropsSetter; -import org.openapijsonschematools.client.schemas.validation.BooleanSchemaValidator; -import org.openapijsonschematools.client.schemas.validation.FrozenList; -import org.openapijsonschematools.client.schemas.validation.FrozenMap; -import org.openapijsonschematools.client.schemas.validation.JsonSchema; -import org.openapijsonschematools.client.schemas.validation.JsonSchemaInfo; -import org.openapijsonschematools.client.schemas.validation.ListSchemaValidator; -import org.openapijsonschematools.client.schemas.validation.MapSchemaValidator; -import org.openapijsonschematools.client.schemas.validation.NullSchemaValidator; -import org.openapijsonschematools.client.schemas.validation.NumberSchemaValidator; -import org.openapijsonschematools.client.schemas.validation.PathToSchemasMap; -import org.openapijsonschematools.client.schemas.validation.PropertyEntry; -import org.openapijsonschematools.client.schemas.validation.StringEnumValidator; -import org.openapijsonschematools.client.schemas.validation.StringSchemaValidator; -import org.openapijsonschematools.client.schemas.validation.StringValueMethod; -import org.openapijsonschematools.client.schemas.validation.ValidationMetadata; - -public class EquilateralTriangle { - // nest classes so all schemas and input/output classes can be public - - public enum StringTriangleTypeEnums implements StringValueMethod { - EQUILATERAL_TRIANGLE("EquilateralTriangle"); - private final String value; - - StringTriangleTypeEnums(String value) { - this.value = value; - } - public String value() { - return this.value; - } - } - - - public sealed interface TriangleTypeBoxed permits TriangleTypeBoxedString { - @Nullable Object getData(); - } - - public record TriangleTypeBoxedString(String data) implements TriangleTypeBoxed { - @Override - public @Nullable Object getData() { - return data; - } - } - - - - public static class TriangleType extends JsonSchema implements StringSchemaValidator, StringEnumValidator { - private static @Nullable TriangleType instance = null; - - protected TriangleType() { - super(new JsonSchemaInfo() - .type(Set.of( - String.class - )) - .enumValues(SetMaker.makeSet( - "EquilateralTriangle" - )) - ); - } - - public static TriangleType getInstance() { - if (instance == null) { - instance = new TriangleType(); - } - return instance; - } - - @Override - public String validate(String arg, SchemaConfiguration configuration) throws ValidationException { - Set> pathSet = new HashSet<>(); - List pathToItem = List.of("args[0"); - String castArg = castToAllowedTypes(arg, pathToItem, pathSet); - SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().build())); - ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, new PathToSchemasMap(), new LinkedHashSet<>()); - getPathToSchemas(this, castArg, validationMetadata, pathSet); - return castArg; - } - - @Override - 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 { - 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"); - } - @Override - public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { - 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"); - } - @Override - 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 { - 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"); - } - } - - public static class Schema1Map extends FrozenMap<@Nullable Object> { - protected Schema1Map(FrozenMap<@Nullable Object> m) { - super(m); - } - public static final Set requiredKeys = Set.of(); - public static final Set optionalKeys = Set.of( - "triangleType" - ); - public static Schema1Map of(Map arg, SchemaConfiguration configuration) throws ValidationException { - return Schema1.getInstance().validate(arg, configuration); - } - - public String triangleType() throws UnsetPropertyException { - String key = "triangleType"; - throwIfKeyNotPresent(key); - @Nullable Object value = get(key); - if (!(value instanceof String)) { - throw new RuntimeException("Invalid value stored for triangleType"); - } - return (String) value; - } - - public @Nullable Object getAdditionalProperty(String name) throws UnsetPropertyException, InvalidAdditionalPropertyException { - throwIfKeyKnown(name, requiredKeys, optionalKeys); - throwIfKeyNotPresent(name); - return get(name); - } - } - - public interface SetterForTriangleType { - Map getInstance(); - T getBuilderAfterTriangleType(Map instance); - - default T triangleType(String value) { - var instance = getInstance(); - instance.put("triangleType", value); - return getBuilderAfterTriangleType(instance); - } - - default T triangleType(StringTriangleTypeEnums value) { - var instance = getInstance(); - instance.put("triangleType", value.value()); - return getBuilderAfterTriangleType(instance); - } - } - - public static class Schema1MapBuilder extends UnsetAddPropsSetter implements GenericBuilder>, SetterForTriangleType { - private final Map instance; - private static final Set knownKeys = Set.of( - "triangleType" - ); - public Set getKnownKeys() { - return knownKeys; - } - public Schema1MapBuilder() { - this.instance = new LinkedHashMap<>(); - } - public Map build() { - return instance; - } - public Map getInstance() { - return instance; - } - public Schema1MapBuilder getBuilderAfterTriangleType(Map instance) { - return this; - } - public Schema1MapBuilder getBuilderAfterAdditionalProperty(Map instance) { - return this; - } - } - - - public sealed interface Schema1Boxed permits Schema1BoxedMap { - @Nullable Object getData(); - } - - public record Schema1BoxedMap(Schema1Map data) implements Schema1Boxed { - @Override - public @Nullable Object getData() { - return data; - } - } - - - public static class Schema1 extends JsonSchema implements MapSchemaValidator { - private static @Nullable Schema1 instance = null; - - protected Schema1() { - super(new JsonSchemaInfo() - .type(Set.of(Map.class)) - .properties(Map.ofEntries( - new PropertyEntry("triangleType", TriangleType.class) - )) - ); - } - - public static Schema1 getInstance() { - if (instance == null) { - instance = new Schema1(); - } - return instance; - } - - 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 RuntimeException("Invalid non-string key value"); - } - String propertyName = (String) entryKey; - List propertyPathToItem = new ArrayList<>(pathToItem); - propertyPathToItem.add(propertyName); - Object value = entry.getValue(); - LinkedHashMap, Nothing?> schemas = pathToSchemas.get(propertyPathToItem); - if (schemas == null) { - throw new RuntimeException("Validation result is invalid, schemas must exist for a pathToItem"); - } - JsonSchema propertySchema = schemas.entrySet().iterator().next().getKey(); - @Nullable Object propertyInstance = propertySchema.getNewInstance(value, propertyPathToItem, pathToSchemas); - properties.put(propertyName, propertyInstance); - } - FrozenMap<@Nullable Object> castProperties = new FrozenMap<>(properties); - return new Schema1Map(castProperties); - } - - 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); - SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().build())); - ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, new PathToSchemasMap(), new LinkedHashSet<>()); - PathToSchemasMap pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet); - return getNewInstance(castArg, validationMetadata.pathToItem(), pathToSchemasMap); - } - - - @Override - public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws 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"); - } - @Override - public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { - if (arg instanceof Map) { - return getNewInstance((Map) arg, pathToItem, pathToSchemas); - } - 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 { - return new Schema1BoxedMap(validate(arg, configuration)); - } - @Override - public Schema1Boxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { - 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"); - } - } - - - public sealed interface EquilateralTriangle1Boxed permits EquilateralTriangle1BoxedVoid, EquilateralTriangle1BoxedBoolean, EquilateralTriangle1BoxedNumber, EquilateralTriangle1BoxedString, EquilateralTriangle1BoxedList, EquilateralTriangle1BoxedMap { - @Nullable Object getData(); - } - - public record EquilateralTriangle1BoxedVoid(Nothing? data) implements EquilateralTriangle1Boxed { - @Override - public @Nullable Object getData() { - return data; - } - } - - public record EquilateralTriangle1BoxedBoolean(boolean data) implements EquilateralTriangle1Boxed { - @Override - public @Nullable Object getData() { - return data; - } - } - - public record EquilateralTriangle1BoxedNumber(Number data) implements EquilateralTriangle1Boxed { - @Override - public @Nullable Object getData() { - return data; - } - } - - public record EquilateralTriangle1BoxedString(String data) implements EquilateralTriangle1Boxed { - @Override - public @Nullable Object getData() { - return data; - } - } - - public record EquilateralTriangle1BoxedList(FrozenList<@Nullable Object> data) implements EquilateralTriangle1Boxed { - @Override - public @Nullable Object getData() { - return data; - } - } - - public record EquilateralTriangle1BoxedMap(FrozenMap<@Nullable Object> data) implements EquilateralTriangle1Boxed { - @Override - public @Nullable Object getData() { - return data; - } - } - - - public static class EquilateralTriangle1 extends JsonSchema implements NullSchemaValidator, BooleanSchemaValidator, NumberSchemaValidator, StringSchemaValidator, ListSchemaValidator, EquilateralTriangle1BoxedList>, MapSchemaValidator, EquilateralTriangle1BoxedMap> { - /* - NOTE: This class is auto generated by OpenAPI JSON Schema Generator. - Ref: https://github.com/openapi-json-schema-tools/openapi-json-schema-generator - - Do not edit the class manually. - */ - private static @Nullable EquilateralTriangle1 instance = null; - - protected EquilateralTriangle1() { - super(new JsonSchemaInfo() - .allOf(List.of( - TriangleInterface.TriangleInterface1.class, - Schema1.class - )) - ); - } - - public static EquilateralTriangle1 getInstance() { - if (instance == null) { - instance = new EquilateralTriangle1(); - } - return instance; - } - - @Override - public Nothing? validate(Nothing? arg, SchemaConfiguration configuration) throws ValidationException { - Set> pathSet = new HashSet<>(); - List pathToItem = List.of("args[0]"); - Nothing? castArg = castToAllowedTypes(arg, pathToItem, pathSet); - SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().build())); - PathToSchemasMap validatedPathToSchemas = new PathToSchemasMap(); - ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, new LinkedHashSet<>()); - getPathToSchemas(this, castArg, validationMetadata, pathSet); - return castArg; - } - - @Override - public boolean validate(boolean arg, SchemaConfiguration configuration) throws ValidationException { - Set> pathSet = new HashSet<>(); - List pathToItem = List.of("args[0]"); - boolean castArg = castToAllowedTypes(arg, pathToItem, pathSet); - SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().build())); - PathToSchemasMap validatedPathToSchemas = new PathToSchemasMap(); - ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, new LinkedHashSet<>()); - getPathToSchemas(this, castArg, validationMetadata, pathSet); - return castArg; - } - - @Override - public Number validate(Number arg, SchemaConfiguration configuration) throws ValidationException { - Set> pathSet = new HashSet<>(); - List pathToItem = List.of("args[0]"); - Number castArg = castToAllowedTypes(arg, pathToItem, pathSet); - SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().build())); - PathToSchemasMap validatedPathToSchemas = new PathToSchemasMap(); - ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, new LinkedHashSet<>()); - getPathToSchemas(this, castArg, validationMetadata, pathSet); - return castArg; - } - - public int validate(int arg, SchemaConfiguration configuration) throws ValidationException { - return (int) validate((Number) arg, configuration); - } - - public long validate(long arg, SchemaConfiguration configuration) throws ValidationException { - return (long) validate((Number) arg, configuration); - } - - public float validate(float arg, SchemaConfiguration configuration) throws ValidationException { - return (float) validate((Number) arg, configuration); - } - - public double validate(double arg, SchemaConfiguration configuration) throws ValidationException { - return (double) validate((Number) arg, configuration); - } - - @Override - public String validate(String arg, SchemaConfiguration configuration) throws ValidationException { - Set> pathSet = new HashSet<>(); - List pathToItem = List.of("args[0]"); - String castArg = castToAllowedTypes(arg, pathToItem, pathSet); - SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().build())); - PathToSchemasMap validatedPathToSchemas = new PathToSchemasMap(); - ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, new LinkedHashSet<>()); - getPathToSchemas(this, castArg, validationMetadata, pathSet); - return castArg; - } - - public String validate(LocalDate arg, SchemaConfiguration configuration) throws ValidationException { - return validate(arg.toString(), configuration); - } - - public String validate(ZonedDateTime arg, SchemaConfiguration configuration) throws ValidationException { - return validate(arg.toString(), configuration); - } - - public String validate(UUID arg, SchemaConfiguration configuration) throws ValidationException { - return validate(arg.toString(), configuration); - } - - @Override - public FrozenList<@Nullable Object> getNewInstance(List arg, List pathToItem, PathToSchemasMap pathToSchemas) { - List<@Nullable Object> items = new ArrayList<>(); - int i = 0; - for (Object item: arg) { - List itemPathToItem = new ArrayList<>(pathToItem); - itemPathToItem.add(i); - LinkedHashMap, Nothing?> schemas = pathToSchemas.get(itemPathToItem); - if (schemas == null) { - throw new RuntimeException("Validation result is invalid, schemas must exist for a pathToItem"); - } - JsonSchema itemSchema = schemas.entrySet().iterator().next().getKey(); - @Nullable Object itemInstance = itemSchema.getNewInstance(item, itemPathToItem, pathToSchemas); - items.add(itemInstance); - i += 1; - } - FrozenList<@Nullable Object> newInstanceItems = new FrozenList<>(items); - return newInstanceItems; - } - - 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); - SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().build())); - ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, new PathToSchemasMap(), new LinkedHashSet<>()); - PathToSchemasMap pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet); - return getNewInstance(castArg, validationMetadata.pathToItem(), pathToSchemasMap); - } - - @Override - 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 RuntimeException("Invalid non-string key value"); - } - String propertyName = (String) entryKey; - List propertyPathToItem = new ArrayList<>(pathToItem); - propertyPathToItem.add(propertyName); - Object value = entry.getValue(); - LinkedHashMap, Nothing?> schemas = pathToSchemas.get(propertyPathToItem); - if (schemas == null) { - throw new RuntimeException("Validation result is invalid, schemas must exist for a pathToItem"); - } - JsonSchema propertySchema = schemas.entrySet().iterator().next().getKey(); - @Nullable Object propertyInstance = propertySchema.getNewInstance(value, propertyPathToItem, pathToSchemas); - properties.put(propertyName, propertyInstance); - } - FrozenMap<@Nullable Object> castProperties = new FrozenMap<>(properties); - return castProperties; - } - - public FrozenMap<@Nullable Object> validate(Map arg, SchemaConfiguration configuration) throws ValidationException { - Set> pathSet = new HashSet<>(); - List pathToItem = List.of("args[0]"); - Map castArg = castToAllowedTypes(arg, pathToItem, pathSet); - SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().build())); - PathToSchemasMap validatedPathToSchemas = new PathToSchemasMap(); - ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, new LinkedHashSet<>()); - PathToSchemasMap pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet); - return getNewInstance(castArg, validationMetadata.pathToItem(), pathToSchemasMap); - } - - @Override - public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { - if (arg == null) { - return validate((Nothing?) null, configuration); - } else if (arg instanceof Boolean) { - boolean boolArg = (Boolean) arg; - return validate(boolArg, configuration); - } else if (arg instanceof Number) { - return validate((Number) arg, configuration); - } else if (arg instanceof String) { - return validate((String) arg, configuration); - } else if (arg instanceof List) { - return validate((List) arg, 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"); - } - @Override - public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { - if (arg == null) { - return getNewInstance((Nothing?) null, pathToItem, pathToSchemas); - } else if (arg instanceof Boolean) { - boolean boolArg = (Boolean) arg; - return getNewInstance(boolArg, pathToItem, pathToSchemas); - } else if (arg instanceof Number) { - return getNewInstance((Number) arg, pathToItem, pathToSchemas); - } else if (arg instanceof String) { - return getNewInstance((String) arg, pathToItem, pathToSchemas); - } else if (arg instanceof List) { - return getNewInstance((List) arg, 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"); - } - @Override - public EquilateralTriangle1BoxedVoid validateAndBox(Nothing? arg, SchemaConfiguration configuration) throws ValidationException { - return new EquilateralTriangle1BoxedVoid(validate(arg, configuration)); - } - @Override - 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 { - return new EquilateralTriangle1BoxedNumber(validate(arg, configuration)); - } - @Override - 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 { - return new EquilateralTriangle1BoxedList(validate(arg, configuration)); - } - @Override - 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 { - if (arg == null) { - Nothing? castArg = (Nothing?) arg; - return validateAndBox(castArg, configuration); - } else if (arg instanceof Boolean booleanArg) { - boolean castArg = booleanArg; - return validateAndBox(castArg, configuration); - } else if (arg instanceof String castArg) { - return validateAndBox(castArg, configuration); - } else if (arg instanceof Number castArg) { - return validateAndBox(castArg, configuration); - } else if (arg instanceof List castArg) { - 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"); - } - } -} diff --git a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/schemas/File.kt b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/schemas/File.kt deleted file mode 100644 index ddc771163a0..00000000000 --- a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/schemas/File.kt +++ /dev/null @@ -1,208 +0,0 @@ -package org.openapijsonschematools.client.components.schemas; -import java.util.ArrayList; -import java.util.HashSet; -import java.util.LinkedHashMap; -import java.util.LinkedHashSet; -import java.util.List; -import java.util.Map; -import java.util.Objects; -import java.util.Set; -import org.checkerframework.checker.nullness.qual.Nullable; -import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags; -import org.openapijsonschematools.client.configurations.SchemaConfiguration; -import org.openapijsonschematools.client.exceptions.InvalidAdditionalPropertyException; -import org.openapijsonschematools.client.exceptions.UnsetPropertyException; -import org.openapijsonschematools.client.exceptions.ValidationException; -import org.openapijsonschematools.client.schemas.GenericBuilder; -import org.openapijsonschematools.client.schemas.StringJsonSchema; -import org.openapijsonschematools.client.schemas.UnsetAddPropsSetter; -import org.openapijsonschematools.client.schemas.validation.FrozenMap; -import org.openapijsonschematools.client.schemas.validation.JsonSchema; -import org.openapijsonschematools.client.schemas.validation.JsonSchemaInfo; -import org.openapijsonschematools.client.schemas.validation.MapSchemaValidator; -import org.openapijsonschematools.client.schemas.validation.PathToSchemasMap; -import org.openapijsonschematools.client.schemas.validation.PropertyEntry; -import org.openapijsonschematools.client.schemas.validation.ValidationMetadata; - -public class File { - // nest classes so all schemas and input/output classes can be public - - - public static class SourceURI extends StringJsonSchema.StringJsonSchema1 { - private static @Nullable SourceURI instance = null; - public static SourceURI getInstance() { - if (instance == null) { - instance = new SourceURI(); - } - return instance; - } - } - - - public static class FileMap extends FrozenMap<@Nullable Object> { - protected FileMap(FrozenMap<@Nullable Object> m) { - super(m); - } - public static final Set requiredKeys = Set.of(); - public static final Set optionalKeys = Set.of( - "sourceURI" - ); - public static FileMap of(Map arg, SchemaConfiguration configuration) throws ValidationException { - return File1.getInstance().validate(arg, configuration); - } - - public String sourceURI() throws UnsetPropertyException { - String key = "sourceURI"; - throwIfKeyNotPresent(key); - @Nullable Object value = get(key); - if (!(value instanceof String)) { - throw new RuntimeException("Invalid value stored for sourceURI"); - } - return (String) value; - } - - public @Nullable Object getAdditionalProperty(String name) throws UnsetPropertyException, InvalidAdditionalPropertyException { - throwIfKeyKnown(name, requiredKeys, optionalKeys); - throwIfKeyNotPresent(name); - return get(name); - } - } - - public interface SetterForSourceURI { - Map getInstance(); - T getBuilderAfterSourceURI(Map instance); - - default T sourceURI(String value) { - var instance = getInstance(); - instance.put("sourceURI", value); - return getBuilderAfterSourceURI(instance); - } - } - - public static class FileMapBuilder extends UnsetAddPropsSetter implements GenericBuilder>, SetterForSourceURI { - private final Map instance; - private static final Set knownKeys = Set.of( - "sourceURI" - ); - public Set getKnownKeys() { - return knownKeys; - } - public FileMapBuilder() { - this.instance = new LinkedHashMap<>(); - } - public Map build() { - return instance; - } - public Map getInstance() { - return instance; - } - public FileMapBuilder getBuilderAfterSourceURI(Map instance) { - return this; - } - public FileMapBuilder getBuilderAfterAdditionalProperty(Map instance) { - return this; - } - } - - - public sealed interface File1Boxed permits File1BoxedMap { - @Nullable Object getData(); - } - - public record File1BoxedMap(FileMap data) implements File1Boxed { - @Override - public @Nullable Object getData() { - return data; - } - } - - - public static class File1 extends JsonSchema implements MapSchemaValidator { - /* - NOTE: This class is auto generated by OpenAPI JSON Schema Generator. - Ref: https://github.com/openapi-json-schema-tools/openapi-json-schema-generator - - Do not edit the class manually. - - Must be named `File` for test. - */ - private static @Nullable File1 instance = null; - - protected File1() { - super(new JsonSchemaInfo() - .type(Set.of(Map.class)) - .properties(Map.ofEntries( - new PropertyEntry("sourceURI", SourceURI.class) - )) - ); - } - - public static File1 getInstance() { - if (instance == null) { - instance = new File1(); - } - return instance; - } - - 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 RuntimeException("Invalid non-string key value"); - } - String propertyName = (String) entryKey; - List propertyPathToItem = new ArrayList<>(pathToItem); - propertyPathToItem.add(propertyName); - Object value = entry.getValue(); - LinkedHashMap, Nothing?> schemas = pathToSchemas.get(propertyPathToItem); - if (schemas == null) { - throw new RuntimeException("Validation result is invalid, schemas must exist for a pathToItem"); - } - JsonSchema propertySchema = schemas.entrySet().iterator().next().getKey(); - @Nullable Object propertyInstance = propertySchema.getNewInstance(value, propertyPathToItem, pathToSchemas); - properties.put(propertyName, propertyInstance); - } - FrozenMap<@Nullable Object> castProperties = new FrozenMap<>(properties); - return new FileMap(castProperties); - } - - 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); - SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().build())); - ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, new PathToSchemasMap(), new LinkedHashSet<>()); - PathToSchemasMap pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet); - return getNewInstance(castArg, validationMetadata.pathToItem(), pathToSchemasMap); - } - - - @Override - public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws 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"); - } - @Override - public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { - if (arg instanceof Map) { - return getNewInstance((Map) arg, pathToItem, pathToSchemas); - } - 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 { - return new File1BoxedMap(validate(arg, configuration)); - } - @Override - public File1Boxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { - 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"); - } - } - -} diff --git a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/schemas/FileSchemaTestClass.kt b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/schemas/FileSchemaTestClass.kt deleted file mode 100644 index 6336a6aab3c..00000000000 --- a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/schemas/FileSchemaTestClass.kt +++ /dev/null @@ -1,345 +0,0 @@ -package org.openapijsonschematools.client.components.schemas; -import java.util.ArrayList; -import java.util.HashSet; -import java.util.LinkedHashMap; -import java.util.LinkedHashSet; -import java.util.List; -import java.util.Map; -import java.util.Objects; -import java.util.Set; -import org.checkerframework.checker.nullness.qual.Nullable; -import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags; -import org.openapijsonschematools.client.configurations.SchemaConfiguration; -import org.openapijsonschematools.client.exceptions.InvalidAdditionalPropertyException; -import org.openapijsonschematools.client.exceptions.UnsetPropertyException; -import org.openapijsonschematools.client.exceptions.ValidationException; -import org.openapijsonschematools.client.schemas.GenericBuilder; -import org.openapijsonschematools.client.schemas.UnsetAddPropsSetter; -import org.openapijsonschematools.client.schemas.validation.FrozenList; -import org.openapijsonschematools.client.schemas.validation.FrozenMap; -import org.openapijsonschematools.client.schemas.validation.JsonSchema; -import org.openapijsonschematools.client.schemas.validation.JsonSchemaInfo; -import org.openapijsonschematools.client.schemas.validation.ListSchemaValidator; -import org.openapijsonschematools.client.schemas.validation.MapSchemaValidator; -import org.openapijsonschematools.client.schemas.validation.PathToSchemasMap; -import org.openapijsonschematools.client.schemas.validation.PropertyEntry; -import org.openapijsonschematools.client.schemas.validation.ValidationMetadata; - -public class FileSchemaTestClass { - // nest classes so all schemas and input/output classes can be public - - - public static class FilesList extends FrozenList { - protected FilesList(FrozenList m) { - super(m); - } - public static FilesList of(List> arg, SchemaConfiguration configuration) throws ValidationException { - return Files.getInstance().validate(arg, configuration); - } - } - - public static class FilesListBuilder { - // class to build List> - private final List> list; - - public FilesListBuilder() { - list = new ArrayList<>(); - } - - public FilesListBuilder(List> list) { - this.list = list; - } - - public FilesListBuilder add(Map item) { - list.add(item); - return this; - } - - public List> build() { - return list; - } - } - - - public sealed interface FilesBoxed permits FilesBoxedList { - @Nullable Object getData(); - } - - public record FilesBoxedList(FilesList data) implements FilesBoxed { - @Override - public @Nullable Object getData() { - return data; - } - } - - - - public static class Files extends JsonSchema implements ListSchemaValidator { - private static @Nullable Files instance = null; - - protected Files() { - super(new JsonSchemaInfo() - .type(Set.of(List.class)) - .items(File.File1.class) - ); - } - - public static Files getInstance() { - if (instance == null) { - instance = new Files(); - } - return instance; - } - - @Override - public FilesList getNewInstance(List arg, List pathToItem, PathToSchemasMap pathToSchemas) { - List items = new ArrayList<>(); - int i = 0; - for (Object item: arg) { - List itemPathToItem = new ArrayList<>(pathToItem); - itemPathToItem.add(i); - LinkedHashMap, Nothing?> schemas = pathToSchemas.get(itemPathToItem); - if (schemas == null) { - throw new RuntimeException("Validation 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"); - } - items.add((File.FileMap) itemInstance); - i += 1; - } - FrozenList newInstanceItems = new FrozenList<>(items); - return new FilesList(newInstanceItems); - } - - 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); - SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().build())); - ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, new PathToSchemasMap(), new LinkedHashSet<>()); - PathToSchemasMap pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet); - return getNewInstance(castArg, validationMetadata.pathToItem(), pathToSchemasMap); - } - - @Override - public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws 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"); - } - @Override - public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { - 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"); - } - @Override - 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 { - 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"); - } - } - - public static class FileSchemaTestClassMap extends FrozenMap<@Nullable Object> { - protected FileSchemaTestClassMap(FrozenMap<@Nullable Object> m) { - super(m); - } - public static final Set requiredKeys = Set.of(); - public static final Set optionalKeys = Set.of( - "file", - "files" - ); - public static FileSchemaTestClassMap of(Map arg, SchemaConfiguration configuration) throws ValidationException { - return FileSchemaTestClass1.getInstance().validate(arg, configuration); - } - - public File.FileMap file() throws UnsetPropertyException { - String key = "file"; - throwIfKeyNotPresent(key); - @Nullable Object value = get(key); - if (!(value instanceof File.FileMap)) { - throw new RuntimeException("Invalid value stored for file"); - } - return (File.FileMap) value; - } - - public FilesList files() throws UnsetPropertyException { - String key = "files"; - throwIfKeyNotPresent(key); - @Nullable Object value = get(key); - if (!(value instanceof FilesList)) { - throw new RuntimeException("Invalid value stored for files"); - } - return (FilesList) value; - } - - public @Nullable Object getAdditionalProperty(String name) throws UnsetPropertyException, InvalidAdditionalPropertyException { - throwIfKeyKnown(name, requiredKeys, optionalKeys); - throwIfKeyNotPresent(name); - return get(name); - } - } - - public interface SetterForFile { - Map getInstance(); - T getBuilderAfterFile(Map instance); - - default T file(Map value) { - var instance = getInstance(); - instance.put("file", value); - return getBuilderAfterFile(instance); - } - } - - public interface SetterForFiles { - Map getInstance(); - T getBuilderAfterFiles(Map instance); - - default T files(List> value) { - var instance = getInstance(); - instance.put("files", value); - return getBuilderAfterFiles(instance); - } - } - - public static class FileSchemaTestClassMapBuilder extends UnsetAddPropsSetter implements GenericBuilder>, SetterForFile, SetterForFiles { - private final Map instance; - private static final Set knownKeys = Set.of( - "file", - "files" - ); - public Set getKnownKeys() { - return knownKeys; - } - public FileSchemaTestClassMapBuilder() { - this.instance = new LinkedHashMap<>(); - } - public Map build() { - return instance; - } - public Map getInstance() { - return instance; - } - public FileSchemaTestClassMapBuilder getBuilderAfterFile(Map instance) { - return this; - } - public FileSchemaTestClassMapBuilder getBuilderAfterFiles(Map instance) { - return this; - } - public FileSchemaTestClassMapBuilder getBuilderAfterAdditionalProperty(Map instance) { - return this; - } - } - - - public sealed interface FileSchemaTestClass1Boxed permits FileSchemaTestClass1BoxedMap { - @Nullable Object getData(); - } - - public record FileSchemaTestClass1BoxedMap(FileSchemaTestClassMap data) implements FileSchemaTestClass1Boxed { - @Override - public @Nullable Object getData() { - return data; - } - } - - - public static class FileSchemaTestClass1 extends JsonSchema implements MapSchemaValidator { - /* - NOTE: This class is auto generated by OpenAPI JSON Schema Generator. - Ref: https://github.com/openapi-json-schema-tools/openapi-json-schema-generator - - Do not edit the class manually. - */ - private static @Nullable FileSchemaTestClass1 instance = null; - - protected FileSchemaTestClass1() { - super(new JsonSchemaInfo() - .type(Set.of(Map.class)) - .properties(Map.ofEntries( - new PropertyEntry("file", File.File1.class), - new PropertyEntry("files", Files.class) - )) - ); - } - - public static FileSchemaTestClass1 getInstance() { - if (instance == null) { - instance = new FileSchemaTestClass1(); - } - return instance; - } - - 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 RuntimeException("Invalid non-string key value"); - } - String propertyName = (String) entryKey; - List propertyPathToItem = new ArrayList<>(pathToItem); - propertyPathToItem.add(propertyName); - Object value = entry.getValue(); - LinkedHashMap, Nothing?> schemas = pathToSchemas.get(propertyPathToItem); - if (schemas == null) { - throw new RuntimeException("Validation result is invalid, schemas must exist for a pathToItem"); - } - JsonSchema propertySchema = schemas.entrySet().iterator().next().getKey(); - @Nullable Object propertyInstance = propertySchema.getNewInstance(value, propertyPathToItem, pathToSchemas); - properties.put(propertyName, propertyInstance); - } - FrozenMap<@Nullable Object> castProperties = new FrozenMap<>(properties); - return new FileSchemaTestClassMap(castProperties); - } - - 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); - SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().build())); - ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, new PathToSchemasMap(), new LinkedHashSet<>()); - PathToSchemasMap pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet); - return getNewInstance(castArg, validationMetadata.pathToItem(), pathToSchemasMap); - } - - - @Override - public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws 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"); - } - @Override - public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { - if (arg instanceof Map) { - return getNewInstance((Map) arg, pathToItem, pathToSchemas); - } - 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 { - return new FileSchemaTestClass1BoxedMap(validate(arg, configuration)); - } - @Override - public FileSchemaTestClass1Boxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { - 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"); - } - } - -} diff --git a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/schemas/Foo.kt b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/schemas/Foo.kt deleted file mode 100644 index 2b293f4ddb7..00000000000 --- a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/schemas/Foo.kt +++ /dev/null @@ -1,194 +0,0 @@ -package org.openapijsonschematools.client.components.schemas; -import java.util.ArrayList; -import java.util.HashSet; -import java.util.LinkedHashMap; -import java.util.LinkedHashSet; -import java.util.List; -import java.util.Map; -import java.util.Objects; -import java.util.Set; -import org.checkerframework.checker.nullness.qual.Nullable; -import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags; -import org.openapijsonschematools.client.configurations.SchemaConfiguration; -import org.openapijsonschematools.client.exceptions.InvalidAdditionalPropertyException; -import org.openapijsonschematools.client.exceptions.UnsetPropertyException; -import org.openapijsonschematools.client.exceptions.ValidationException; -import org.openapijsonschematools.client.schemas.GenericBuilder; -import org.openapijsonschematools.client.schemas.UnsetAddPropsSetter; -import org.openapijsonschematools.client.schemas.validation.FrozenMap; -import org.openapijsonschematools.client.schemas.validation.JsonSchema; -import org.openapijsonschematools.client.schemas.validation.JsonSchemaInfo; -import org.openapijsonschematools.client.schemas.validation.MapSchemaValidator; -import org.openapijsonschematools.client.schemas.validation.PathToSchemasMap; -import org.openapijsonschematools.client.schemas.validation.PropertyEntry; -import org.openapijsonschematools.client.schemas.validation.ValidationMetadata; - -public class Foo { - // nest classes so all schemas and input/output classes can be public - - - public static class FooMap extends FrozenMap<@Nullable Object> { - protected FooMap(FrozenMap<@Nullable Object> m) { - super(m); - } - public static final Set requiredKeys = Set.of(); - public static final Set optionalKeys = Set.of( - "bar" - ); - public static FooMap of(Map arg, SchemaConfiguration configuration) throws ValidationException { - return Foo1.getInstance().validate(arg, configuration); - } - - public String bar() throws UnsetPropertyException { - String key = "bar"; - throwIfKeyNotPresent(key); - @Nullable Object value = get(key); - if (!(value instanceof String)) { - throw new RuntimeException("Invalid value stored for bar"); - } - return (String) value; - } - - public @Nullable Object getAdditionalProperty(String name) throws UnsetPropertyException, InvalidAdditionalPropertyException { - throwIfKeyKnown(name, requiredKeys, optionalKeys); - throwIfKeyNotPresent(name); - return get(name); - } - } - - public interface SetterForBar { - Map getInstance(); - T getBuilderAfterBar(Map instance); - - default T bar(String value) { - var instance = getInstance(); - instance.put("bar", value); - return getBuilderAfterBar(instance); - } - } - - public static class FooMapBuilder extends UnsetAddPropsSetter implements GenericBuilder>, SetterForBar { - private final Map instance; - private static final Set knownKeys = Set.of( - "bar" - ); - public Set getKnownKeys() { - return knownKeys; - } - public FooMapBuilder() { - this.instance = new LinkedHashMap<>(); - } - public Map build() { - return instance; - } - public Map getInstance() { - return instance; - } - public FooMapBuilder getBuilderAfterBar(Map instance) { - return this; - } - public FooMapBuilder getBuilderAfterAdditionalProperty(Map instance) { - return this; - } - } - - - public sealed interface Foo1Boxed permits Foo1BoxedMap { - @Nullable Object getData(); - } - - public record Foo1BoxedMap(FooMap data) implements Foo1Boxed { - @Override - public @Nullable Object getData() { - return data; - } - } - - - public static class Foo1 extends JsonSchema implements MapSchemaValidator { - /* - NOTE: This class is auto generated by OpenAPI JSON Schema Generator. - Ref: https://github.com/openapi-json-schema-tools/openapi-json-schema-generator - - Do not edit the class manually. - */ - private static @Nullable Foo1 instance = null; - - protected Foo1() { - super(new JsonSchemaInfo() - .type(Set.of(Map.class)) - .properties(Map.ofEntries( - new PropertyEntry("bar", Bar.Bar1.class) - )) - ); - } - - public static Foo1 getInstance() { - if (instance == null) { - instance = new Foo1(); - } - return instance; - } - - 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 RuntimeException("Invalid non-string key value"); - } - String propertyName = (String) entryKey; - List propertyPathToItem = new ArrayList<>(pathToItem); - propertyPathToItem.add(propertyName); - Object value = entry.getValue(); - LinkedHashMap, Nothing?> schemas = pathToSchemas.get(propertyPathToItem); - if (schemas == null) { - throw new RuntimeException("Validation result is invalid, schemas must exist for a pathToItem"); - } - JsonSchema propertySchema = schemas.entrySet().iterator().next().getKey(); - @Nullable Object propertyInstance = propertySchema.getNewInstance(value, propertyPathToItem, pathToSchemas); - properties.put(propertyName, propertyInstance); - } - FrozenMap<@Nullable Object> castProperties = new FrozenMap<>(properties); - return new FooMap(castProperties); - } - - 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); - SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().build())); - ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, new PathToSchemasMap(), new LinkedHashSet<>()); - PathToSchemasMap pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet); - return getNewInstance(castArg, validationMetadata.pathToItem(), pathToSchemasMap); - } - - - @Override - public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws 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"); - } - @Override - public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { - if (arg instanceof Map) { - return getNewInstance((Map) arg, pathToItem, pathToSchemas); - } - 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 { - return new Foo1BoxedMap(validate(arg, configuration)); - } - @Override - public Foo1Boxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { - 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"); - } - } - -} diff --git a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/schemas/FormatTest.kt b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/schemas/FormatTest.kt deleted file mode 100644 index d6a31f4c867..00000000000 --- a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/schemas/FormatTest.kt +++ /dev/null @@ -1,2038 +0,0 @@ -package org.openapijsonschematools.client.components.schemas; -import java.math.BigDecimal; -import java.util.ArrayList; -import java.util.HashSet; -import java.util.LinkedHashMap; -import java.util.LinkedHashSet; -import java.util.List; -import java.util.Map; -import java.util.Objects; -import java.util.Set; -import java.util.regex.Pattern; -import org.checkerframework.checker.nullness.qual.Nullable; -import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags; -import org.openapijsonschematools.client.configurations.SchemaConfiguration; -import org.openapijsonschematools.client.exceptions.InvalidAdditionalPropertyException; -import org.openapijsonschematools.client.exceptions.UnsetPropertyException; -import org.openapijsonschematools.client.exceptions.ValidationException; -import org.openapijsonschematools.client.schemas.DateJsonSchema; -import org.openapijsonschematools.client.schemas.DateTimeJsonSchema; -import org.openapijsonschematools.client.schemas.DoubleJsonSchema; -import org.openapijsonschematools.client.schemas.FloatJsonSchema; -import org.openapijsonschematools.client.schemas.GenericBuilder; -import org.openapijsonschematools.client.schemas.Int32JsonSchema; -import org.openapijsonschematools.client.schemas.Int64JsonSchema; -import org.openapijsonschematools.client.schemas.NullJsonSchema; -import org.openapijsonschematools.client.schemas.NumberJsonSchema; -import org.openapijsonschematools.client.schemas.StringJsonSchema; -import org.openapijsonschematools.client.schemas.UnsetAddPropsSetter; -import org.openapijsonschematools.client.schemas.UuidJsonSchema; -import org.openapijsonschematools.client.schemas.validation.FrozenList; -import org.openapijsonschematools.client.schemas.validation.FrozenMap; -import org.openapijsonschematools.client.schemas.validation.JsonSchema; -import org.openapijsonschematools.client.schemas.validation.JsonSchemaInfo; -import org.openapijsonschematools.client.schemas.validation.ListSchemaValidator; -import org.openapijsonschematools.client.schemas.validation.MapSchemaValidator; -import org.openapijsonschematools.client.schemas.validation.NumberSchemaValidator; -import org.openapijsonschematools.client.schemas.validation.PathToSchemasMap; -import org.openapijsonschematools.client.schemas.validation.PropertyEntry; -import org.openapijsonschematools.client.schemas.validation.StringSchemaValidator; -import org.openapijsonschematools.client.schemas.validation.ValidationMetadata; - -public class FormatTest { - // nest classes so all schemas and input/output classes can be public - - - public sealed interface IntegerSchemaBoxed permits IntegerSchemaBoxedNumber { - @Nullable Object getData(); - } - - public record IntegerSchemaBoxedNumber(Number data) implements IntegerSchemaBoxed { - @Override - public @Nullable Object getData() { - return data; - } - } - - - - public static class IntegerSchema extends JsonSchema implements NumberSchemaValidator { - private static @Nullable IntegerSchema instance = null; - - protected IntegerSchema() { - super(new JsonSchemaInfo() - .type(Set.of( - Integer.class, - Long.class, - Float.class, - Double.class - )) - .format("int") - .maximum(100) - .minimum(10) - .multipleOf(new BigDecimal("2")) - ); - } - - public static IntegerSchema getInstance() { - if (instance == null) { - instance = new IntegerSchema(); - } - return instance; - } - - @Override - public Number validate(Number arg, SchemaConfiguration configuration) throws ValidationException { - Set> pathSet = new HashSet<>(); - List pathToItem = List.of("args[0"); - Number castArg = castToAllowedTypes(arg, pathToItem, pathSet); - SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().build())); - ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, new PathToSchemasMap(), new LinkedHashSet<>()); - getPathToSchemas(this, castArg, validationMetadata, pathSet); - return castArg; - } - - public int validate(int arg, SchemaConfiguration configuration) throws ValidationException { - return (int) validate((Number) arg, configuration); - } - - public float validate(float arg, SchemaConfiguration configuration) throws ValidationException { - return (float) validate((Number) arg, configuration); - } - - public long validate(long arg, SchemaConfiguration configuration) throws ValidationException { - return (long) validate((Number) arg, configuration); - } - - 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 { - 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"); - } - @Override - public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { - 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"); - } - @Override - 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 { - 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"); - } - } - - public static class Int32 extends Int32JsonSchema.Int32JsonSchema1 { - private static @Nullable Int32 instance = null; - public static Int32 getInstance() { - if (instance == null) { - instance = new Int32(); - } - return instance; - } - } - - - public sealed interface Int32withValidationsBoxed permits Int32withValidationsBoxedNumber { - @Nullable Object getData(); - } - - public record Int32withValidationsBoxedNumber(Number data) implements Int32withValidationsBoxed { - @Override - public @Nullable Object getData() { - return data; - } - } - - - - public static class Int32withValidations extends JsonSchema implements NumberSchemaValidator { - private static @Nullable Int32withValidations instance = null; - - protected Int32withValidations() { - super(new JsonSchemaInfo() - .type(Set.of( - Integer.class, - Long.class, - Float.class, - Double.class - )) - .format("int32") - .maximum(200) - .minimum(20) - ); - } - - public static Int32withValidations getInstance() { - if (instance == null) { - instance = new Int32withValidations(); - } - return instance; - } - - @Override - public Number validate(Number arg, SchemaConfiguration configuration) throws ValidationException { - Set> pathSet = new HashSet<>(); - List pathToItem = List.of("args[0"); - Number castArg = castToAllowedTypes(arg, pathToItem, pathSet); - SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().build())); - ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, new PathToSchemasMap(), new LinkedHashSet<>()); - getPathToSchemas(this, castArg, validationMetadata, pathSet); - return castArg; - } - - public int validate(int arg, SchemaConfiguration configuration) throws ValidationException { - return (int) validate((Number) arg, configuration); - } - - 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 { - 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"); - } - @Override - public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { - 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"); - } - @Override - 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 { - 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"); - } - } - - public static class Int64 extends Int64JsonSchema.Int64JsonSchema1 { - private static @Nullable Int64 instance = null; - public static Int64 getInstance() { - if (instance == null) { - instance = new Int64(); - } - return instance; - } - } - - - public sealed interface NumberSchemaBoxed permits NumberSchemaBoxedNumber { - @Nullable Object getData(); - } - - public record NumberSchemaBoxedNumber(Number data) implements NumberSchemaBoxed { - @Override - public @Nullable Object getData() { - return data; - } - } - - - - public static class NumberSchema extends JsonSchema implements NumberSchemaValidator { - private static @Nullable NumberSchema instance = null; - - protected NumberSchema() { - super(new JsonSchemaInfo() - .type(Set.of( - Integer.class, - Long.class, - Float.class, - Double.class - )) - .maximum(543.2) - .minimum(32.1) - .multipleOf(new BigDecimal("32.5")) - ); - } - - public static NumberSchema getInstance() { - if (instance == null) { - instance = new NumberSchema(); - } - return instance; - } - - @Override - public Number validate(Number arg, SchemaConfiguration configuration) throws ValidationException { - Set> pathSet = new HashSet<>(); - List pathToItem = List.of("args[0"); - Number castArg = castToAllowedTypes(arg, pathToItem, pathSet); - SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().build())); - ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, new PathToSchemasMap(), new LinkedHashSet<>()); - PathToSchemasMap pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet); - return castArg; - } - - public int validate(int arg, SchemaConfiguration configuration) throws ValidationException { - return (int) validate((Number) arg, configuration); - } - - public long validate(long arg, SchemaConfiguration configuration) throws ValidationException { - return (long) validate((Number) arg, configuration); - } - - public float validate(float arg, SchemaConfiguration configuration) throws ValidationException { - return (float) validate((Number) arg, configuration); - } - - 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 { - 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"); - } - @Override - public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { - 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"); - } - @Override - 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 { - 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"); - } - } - - public sealed interface FloatSchemaBoxed permits FloatSchemaBoxedNumber { - @Nullable Object getData(); - } - - public record FloatSchemaBoxedNumber(Number data) implements FloatSchemaBoxed { - @Override - public @Nullable Object getData() { - return data; - } - } - - - - public static class FloatSchema extends JsonSchema implements NumberSchemaValidator { - private static @Nullable FloatSchema instance = null; - - protected FloatSchema() { - super(new JsonSchemaInfo() - .type(Set.of( - Integer.class, - Long.class, - Float.class, - Double.class - )) - .format("float") - .maximum(987.6) - .minimum(54.3) - ); - } - - public static FloatSchema getInstance() { - if (instance == null) { - instance = new FloatSchema(); - } - return instance; - } - - @Override - public Number validate(Number arg, SchemaConfiguration configuration) throws ValidationException { - Set> pathSet = new HashSet<>(); - List pathToItem = List.of("args[0"); - Number castArg = castToAllowedTypes(arg, pathToItem, pathSet); - SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().build())); - ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, new PathToSchemasMap(), new LinkedHashSet<>()); - PathToSchemasMap pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet); - return castArg; - } - 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 { - 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"); - } - @Override - public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { - 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"); - } - @Override - 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 { - 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"); - } - } - - public static class Float32 extends FloatJsonSchema.FloatJsonSchema1 { - private static @Nullable Float32 instance = null; - public static Float32 getInstance() { - if (instance == null) { - instance = new Float32(); - } - return instance; - } - } - - - public sealed interface DoubleSchemaBoxed permits DoubleSchemaBoxedNumber { - @Nullable Object getData(); - } - - public record DoubleSchemaBoxedNumber(Number data) implements DoubleSchemaBoxed { - @Override - public @Nullable Object getData() { - return data; - } - } - - - - public static class DoubleSchema extends JsonSchema implements NumberSchemaValidator { - private static @Nullable DoubleSchema instance = null; - - protected DoubleSchema() { - super(new JsonSchemaInfo() - .type(Set.of( - Integer.class, - Long.class, - Float.class, - Double.class - )) - .format("double") - .maximum(123.4) - .minimum(67.8) - ); - } - - public static DoubleSchema getInstance() { - if (instance == null) { - instance = new DoubleSchema(); - } - return instance; - } - - @Override - public Number validate(Number arg, SchemaConfiguration configuration) throws ValidationException { - Set> pathSet = new HashSet<>(); - List pathToItem = List.of("args[0"); - Number castArg = castToAllowedTypes(arg, pathToItem, pathSet); - SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().build())); - ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, new PathToSchemasMap(), new LinkedHashSet<>()); - PathToSchemasMap pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet); - return castArg; - } - 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 { - 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"); - } - @Override - public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { - 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"); - } - @Override - 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 { - 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"); - } - } - - public static class Float64 extends DoubleJsonSchema.DoubleJsonSchema1 { - private static @Nullable Float64 instance = null; - public static Float64 getInstance() { - if (instance == null) { - instance = new Float64(); - } - return instance; - } - } - - - public static class Items extends NumberJsonSchema.NumberJsonSchema1 { - private static @Nullable Items instance = null; - public static Items getInstance() { - if (instance == null) { - instance = new Items(); - } - return instance; - } - } - - - public static class ArrayWithUniqueItemsList extends FrozenList { - protected ArrayWithUniqueItemsList(FrozenList m) { - super(m); - } - public static ArrayWithUniqueItemsList of(List arg, SchemaConfiguration configuration) throws ValidationException { - return ArrayWithUniqueItems.getInstance().validate(arg, configuration); - } - } - - public static class ArrayWithUniqueItemsListBuilder { - // class to build List - private final List list; - - public ArrayWithUniqueItemsListBuilder() { - list = new ArrayList<>(); - } - - public ArrayWithUniqueItemsListBuilder(List list) { - this.list = list; - } - - public ArrayWithUniqueItemsListBuilder add(int item) { - list.add(item); - return this; - } - - public ArrayWithUniqueItemsListBuilder add(float item) { - list.add(item); - return this; - } - - public ArrayWithUniqueItemsListBuilder add(long item) { - list.add(item); - return this; - } - - public ArrayWithUniqueItemsListBuilder add(double item) { - list.add(item); - return this; - } - - public List build() { - return list; - } - } - - - public sealed interface ArrayWithUniqueItemsBoxed permits ArrayWithUniqueItemsBoxedList { - @Nullable Object getData(); - } - - public record ArrayWithUniqueItemsBoxedList(ArrayWithUniqueItemsList data) implements ArrayWithUniqueItemsBoxed { - @Override - public @Nullable Object getData() { - return data; - } - } - - - - public static class ArrayWithUniqueItems extends JsonSchema implements ListSchemaValidator { - private static @Nullable ArrayWithUniqueItems instance = null; - - protected ArrayWithUniqueItems() { - super(new JsonSchemaInfo() - .type(Set.of(List.class)) - .items(Items.class) - .uniqueItems(true) - ); - } - - public static ArrayWithUniqueItems getInstance() { - if (instance == null) { - instance = new ArrayWithUniqueItems(); - } - return instance; - } - - @Override - public ArrayWithUniqueItemsList getNewInstance(List arg, List pathToItem, PathToSchemasMap pathToSchemas) { - List items = new ArrayList<>(); - int i = 0; - for (Object item: arg) { - List itemPathToItem = new ArrayList<>(pathToItem); - itemPathToItem.add(i); - LinkedHashMap, Nothing?> schemas = pathToSchemas.get(itemPathToItem); - if (schemas == null) { - throw new RuntimeException("Validation 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"); - } - items.add((Number) itemInstance); - i += 1; - } - FrozenList newInstanceItems = new FrozenList<>(items); - return new ArrayWithUniqueItemsList(newInstanceItems); - } - - 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); - SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().build())); - ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, new PathToSchemasMap(), new LinkedHashSet<>()); - PathToSchemasMap pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet); - return getNewInstance(castArg, validationMetadata.pathToItem(), pathToSchemasMap); - } - - @Override - public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws 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"); - } - @Override - public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { - 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"); - } - @Override - 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 { - 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"); - } - } - - public sealed interface StringSchemaBoxed permits StringSchemaBoxedString { - @Nullable Object getData(); - } - - public record StringSchemaBoxedString(String data) implements StringSchemaBoxed { - @Override - public @Nullable Object getData() { - return data; - } - } - - - - public static class StringSchema extends JsonSchema implements StringSchemaValidator { - private static @Nullable StringSchema instance = null; - - protected StringSchema() { - super(new JsonSchemaInfo() - .type(Set.of( - String.class - )) - .pattern(Pattern.compile( - "[a-z]", - Pattern.CASE_INSENSITIVE - )) - ); - } - - public static StringSchema getInstance() { - if (instance == null) { - instance = new StringSchema(); - } - return instance; - } - - @Override - public String validate(String arg, SchemaConfiguration configuration) throws ValidationException { - Set> pathSet = new HashSet<>(); - List pathToItem = List.of("args[0"); - String castArg = castToAllowedTypes(arg, pathToItem, pathSet); - SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().build())); - ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, new PathToSchemasMap(), new LinkedHashSet<>()); - getPathToSchemas(this, castArg, validationMetadata, pathSet); - return castArg; - } - - @Override - public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws 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"); - } - @Override - public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { - 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"); - } - @Override - 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 { - 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"); - } - } - - public static class ByteSchema extends StringJsonSchema.StringJsonSchema1 { - private static @Nullable ByteSchema instance = null; - public static ByteSchema getInstance() { - if (instance == null) { - instance = new ByteSchema(); - } - return instance; - } - } - - - public static class Binary extends StringJsonSchema.StringJsonSchema1 { - // BinarySchema - private static @Nullable Binary instance = null; - public static Binary getInstance() { - if (instance == null) { - instance = new Binary(); - } - return instance; - } - } - - - public static class Date extends DateJsonSchema.DateJsonSchema1 { - private static @Nullable Date instance = null; - public static Date getInstance() { - if (instance == null) { - instance = new Date(); - } - return instance; - } - } - - - public static class DateTime extends DateTimeJsonSchema.DateTimeJsonSchema1 { - private static @Nullable DateTime instance = null; - public static DateTime getInstance() { - if (instance == null) { - instance = new DateTime(); - } - return instance; - } - } - - - public static class UuidSchema extends UuidJsonSchema.UuidJsonSchema1 { - private static @Nullable UuidSchema instance = null; - public static UuidSchema getInstance() { - if (instance == null) { - instance = new UuidSchema(); - } - return instance; - } - } - - - public static class UuidNoExample extends UuidJsonSchema.UuidJsonSchema1 { - private static @Nullable UuidNoExample instance = null; - public static UuidNoExample getInstance() { - if (instance == null) { - instance = new UuidNoExample(); - } - return instance; - } - } - - - public sealed interface PasswordBoxed permits PasswordBoxedString { - @Nullable Object getData(); - } - - public record PasswordBoxedString(String data) implements PasswordBoxed { - @Override - public @Nullable Object getData() { - return data; - } - } - - - - public static class Password extends JsonSchema implements StringSchemaValidator { - private static @Nullable Password instance = null; - - protected Password() { - super(new JsonSchemaInfo() - .type(Set.of( - String.class - )) - .format("password") - .maxLength(64) - .minLength(10) - ); - } - - public static Password getInstance() { - if (instance == null) { - instance = new Password(); - } - return instance; - } - - @Override - public String validate(String arg, SchemaConfiguration configuration) throws ValidationException { - Set> pathSet = new HashSet<>(); - List pathToItem = List.of("args[0"); - String castArg = castToAllowedTypes(arg, pathToItem, pathSet); - SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().build())); - ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, new PathToSchemasMap(), new LinkedHashSet<>()); - getPathToSchemas(this, castArg, validationMetadata, pathSet); - return castArg; - } - - @Override - public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws 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"); - } - @Override - public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { - 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"); - } - @Override - 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 { - 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"); - } - } - - public sealed interface PatternWithDigitsBoxed permits PatternWithDigitsBoxedString { - @Nullable Object getData(); - } - - public record PatternWithDigitsBoxedString(String data) implements PatternWithDigitsBoxed { - @Override - public @Nullable Object getData() { - return data; - } - } - - - - public static class PatternWithDigits extends JsonSchema implements StringSchemaValidator { - private static @Nullable PatternWithDigits instance = null; - - protected PatternWithDigits() { - super(new JsonSchemaInfo() - .type(Set.of( - String.class - )) - .pattern(Pattern.compile( - "^\\d{10}$" - )) - ); - } - - public static PatternWithDigits getInstance() { - if (instance == null) { - instance = new PatternWithDigits(); - } - return instance; - } - - @Override - public String validate(String arg, SchemaConfiguration configuration) throws ValidationException { - Set> pathSet = new HashSet<>(); - List pathToItem = List.of("args[0"); - String castArg = castToAllowedTypes(arg, pathToItem, pathSet); - SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().build())); - ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, new PathToSchemasMap(), new LinkedHashSet<>()); - getPathToSchemas(this, castArg, validationMetadata, pathSet); - return castArg; - } - - @Override - public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws 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"); - } - @Override - public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { - 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"); - } - @Override - 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 { - 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"); - } - } - - public sealed interface PatternWithDigitsAndDelimiterBoxed permits PatternWithDigitsAndDelimiterBoxedString { - @Nullable Object getData(); - } - - public record PatternWithDigitsAndDelimiterBoxedString(String data) implements PatternWithDigitsAndDelimiterBoxed { - @Override - public @Nullable Object getData() { - return data; - } - } - - - - public static class PatternWithDigitsAndDelimiter extends JsonSchema implements StringSchemaValidator { - private static @Nullable PatternWithDigitsAndDelimiter instance = null; - - protected PatternWithDigitsAndDelimiter() { - super(new JsonSchemaInfo() - .type(Set.of( - String.class - )) - .pattern(Pattern.compile( - "^image_\\d{1,3}$", - Pattern.CASE_INSENSITIVE - )) - ); - } - - public static PatternWithDigitsAndDelimiter getInstance() { - if (instance == null) { - instance = new PatternWithDigitsAndDelimiter(); - } - return instance; - } - - @Override - public String validate(String arg, SchemaConfiguration configuration) throws ValidationException { - Set> pathSet = new HashSet<>(); - List pathToItem = List.of("args[0"); - String castArg = castToAllowedTypes(arg, pathToItem, pathSet); - SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().build())); - ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, new PathToSchemasMap(), new LinkedHashSet<>()); - getPathToSchemas(this, castArg, validationMetadata, pathSet); - return castArg; - } - - @Override - public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws 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"); - } - @Override - public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { - 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"); - } - @Override - 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 { - 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"); - } - } - - public static class NoneProp extends NullJsonSchema.NullJsonSchema1 { - private static @Nullable NoneProp instance = null; - public static NoneProp getInstance() { - if (instance == null) { - instance = new NoneProp(); - } - return instance; - } - } - - - public static class FormatTestMap extends FrozenMap<@Nullable Object> { - protected FormatTestMap(FrozenMap<@Nullable Object> m) { - super(m); - } - public static final Set requiredKeys = Set.of( - "byte", - "date", - "number", - "password" - ); - public static final Set optionalKeys = Set.of( - "integer", - "int32", - "int32withValidations", - "int64", - "float", - "float32", - "double", - "float64", - "arrayWithUniqueItems", - "string", - "binary", - "dateTime", - "uuid", - "uuidNoExample", - "pattern_with_digits", - "pattern_with_digits_and_delimiter", - "noneProp" - ); - public static FormatTestMap of(Map arg, SchemaConfiguration configuration) throws ValidationException { - return FormatTest1.getInstance().validate(arg, configuration); - } - - public String date() { - @Nullable Object value = get("date"); - if (!(value instanceof String)) { - throw new RuntimeException("Invalid value stored for date"); - } - return (String) value; - } - - public String password() { - @Nullable Object value = get("password"); - if (!(value instanceof String)) { - throw new RuntimeException("Invalid value stored for password"); - } - return (String) value; - } - - public Number int32() throws UnsetPropertyException { - String key = "int32"; - throwIfKeyNotPresent(key); - @Nullable Object value = get(key); - if (!(value instanceof Number)) { - throw new RuntimeException("Invalid value stored for int32"); - } - return (Number) value; - } - - public Number int32withValidations() throws UnsetPropertyException { - String key = "int32withValidations"; - throwIfKeyNotPresent(key); - @Nullable Object value = get(key); - if (!(value instanceof Number)) { - throw new RuntimeException("Invalid value stored for int32withValidations"); - } - return (Number) value; - } - - public Number int64() throws UnsetPropertyException { - String key = "int64"; - throwIfKeyNotPresent(key); - @Nullable Object value = get(key); - if (!(value instanceof Number)) { - throw new RuntimeException("Invalid value stored for int64"); - } - return (Number) value; - } - - public Number float32() throws UnsetPropertyException { - String key = "float32"; - throwIfKeyNotPresent(key); - @Nullable Object value = get(key); - if (!(value instanceof Number)) { - throw new RuntimeException("Invalid value stored for float32"); - } - return (Number) value; - } - - public Number float64() throws UnsetPropertyException { - String key = "float64"; - throwIfKeyNotPresent(key); - @Nullable Object value = get(key); - if (!(value instanceof Number)) { - throw new RuntimeException("Invalid value stored for float64"); - } - return (Number) value; - } - - public ArrayWithUniqueItemsList arrayWithUniqueItems() throws UnsetPropertyException { - String key = "arrayWithUniqueItems"; - throwIfKeyNotPresent(key); - @Nullable Object value = get(key); - if (!(value instanceof ArrayWithUniqueItemsList)) { - throw new RuntimeException("Invalid value stored for arrayWithUniqueItems"); - } - return (ArrayWithUniqueItemsList) value; - } - - public String binary() throws UnsetPropertyException { - String key = "binary"; - throwIfKeyNotPresent(key); - @Nullable Object value = get(key); - if (!(value instanceof String)) { - throw new RuntimeException("Invalid value stored for binary"); - } - return (String) value; - } - - public String dateTime() throws UnsetPropertyException { - String key = "dateTime"; - throwIfKeyNotPresent(key); - @Nullable Object value = get(key); - if (!(value instanceof String)) { - throw new RuntimeException("Invalid value stored for dateTime"); - } - return (String) value; - } - - public String uuidNoExample() throws UnsetPropertyException { - String key = "uuidNoExample"; - throwIfKeyNotPresent(key); - @Nullable Object value = get(key); - if (!(value instanceof String)) { - throw new RuntimeException("Invalid value stored for uuidNoExample"); - } - return (String) value; - } - - public String pattern_with_digits() throws UnsetPropertyException { - String key = "pattern_with_digits"; - throwIfKeyNotPresent(key); - @Nullable Object value = get(key); - if (!(value instanceof String)) { - throw new RuntimeException("Invalid value stored for pattern_with_digits"); - } - return (String) value; - } - - public String pattern_with_digits_and_delimiter() throws UnsetPropertyException { - String key = "pattern_with_digits_and_delimiter"; - throwIfKeyNotPresent(key); - @Nullable Object value = get(key); - if (!(value instanceof String)) { - throw new RuntimeException("Invalid value stored for pattern_with_digits_and_delimiter"); - } - return (String) value; - } - - public Nothing? noneProp() throws UnsetPropertyException { - String key = "noneProp"; - throwIfKeyNotPresent(key); - @Nullable Object value = get(key); - if (!(value == null || value instanceof Nothing?)) { - throw new RuntimeException("Invalid value stored for noneProp"); - } - return (Nothing?) value; - } - - public @Nullable Object getAdditionalProperty(String name) throws UnsetPropertyException, InvalidAdditionalPropertyException { - throwIfKeyKnown(name, requiredKeys, optionalKeys); - throwIfKeyNotPresent(name); - return get(name); - } - } - - public interface SetterForByteSchema { - Map getInstance(); - T getBuilderAfterByteSchema(Map instance); - - default T setByte(String value) { - var instance = getInstance(); - instance.put("byte", value); - return getBuilderAfterByteSchema(instance); - } - } - - public interface SetterForDate { - Map getInstance(); - T getBuilderAfterDate(Map instance); - - default T date(String value) { - var instance = getInstance(); - instance.put("date", value); - return getBuilderAfterDate(instance); - } - } - - public interface SetterForNumberSchema { - Map getInstance(); - T getBuilderAfterNumberSchema(Map instance); - - default T setNumber(int value) { - var instance = getInstance(); - instance.put("number", value); - return getBuilderAfterNumberSchema(instance); - } - - default T setNumber(float value) { - var instance = getInstance(); - instance.put("number", value); - return getBuilderAfterNumberSchema(instance); - } - - default T setNumber(long value) { - var instance = getInstance(); - instance.put("number", value); - return getBuilderAfterNumberSchema(instance); - } - - default T setNumber(double value) { - var instance = getInstance(); - instance.put("number", value); - return getBuilderAfterNumberSchema(instance); - } - } - - public interface SetterForPassword { - Map getInstance(); - T getBuilderAfterPassword(Map instance); - - default T password(String value) { - var instance = getInstance(); - instance.put("password", value); - return getBuilderAfterPassword(instance); - } - } - - public interface SetterForIntegerSchema { - Map getInstance(); - T getBuilderAfterIntegerSchema(Map instance); - - default T setInteger(int value) { - var instance = getInstance(); - instance.put("integer", value); - return getBuilderAfterIntegerSchema(instance); - } - - default T setInteger(float value) { - var instance = getInstance(); - instance.put("integer", value); - return getBuilderAfterIntegerSchema(instance); - } - - default T setInteger(long value) { - var instance = getInstance(); - instance.put("integer", value); - return getBuilderAfterIntegerSchema(instance); - } - - default T setInteger(double value) { - var instance = getInstance(); - instance.put("integer", value); - return getBuilderAfterIntegerSchema(instance); - } - } - - public interface SetterForInt32 { - Map getInstance(); - T getBuilderAfterInt32(Map instance); - - default T int32(int value) { - var instance = getInstance(); - instance.put("int32", value); - return getBuilderAfterInt32(instance); - } - - default T int32(float value) { - var instance = getInstance(); - instance.put("int32", value); - return getBuilderAfterInt32(instance); - } - } - - public interface SetterForInt32withValidations { - Map getInstance(); - T getBuilderAfterInt32withValidations(Map instance); - - default T int32withValidations(int value) { - var instance = getInstance(); - instance.put("int32withValidations", value); - return getBuilderAfterInt32withValidations(instance); - } - - default T int32withValidations(float value) { - var instance = getInstance(); - instance.put("int32withValidations", value); - return getBuilderAfterInt32withValidations(instance); - } - } - - public interface SetterForInt64 { - Map getInstance(); - T getBuilderAfterInt64(Map instance); - - default T int64(int value) { - var instance = getInstance(); - instance.put("int64", value); - return getBuilderAfterInt64(instance); - } - - default T int64(float value) { - var instance = getInstance(); - instance.put("int64", value); - return getBuilderAfterInt64(instance); - } - - default T int64(long value) { - var instance = getInstance(); - instance.put("int64", value); - return getBuilderAfterInt64(instance); - } - - default T int64(double value) { - var instance = getInstance(); - instance.put("int64", value); - return getBuilderAfterInt64(instance); - } - } - - public interface SetterForFloatSchema { - Map getInstance(); - T getBuilderAfterFloatSchema(Map instance); - - default T setFloat(int value) { - var instance = getInstance(); - instance.put("float", value); - return getBuilderAfterFloatSchema(instance); - } - - default T setFloat(float value) { - var instance = getInstance(); - instance.put("float", value); - return getBuilderAfterFloatSchema(instance); - } - - default T setFloat(long value) { - var instance = getInstance(); - instance.put("float", value); - return getBuilderAfterFloatSchema(instance); - } - - default T setFloat(double value) { - var instance = getInstance(); - instance.put("float", value); - return getBuilderAfterFloatSchema(instance); - } - } - - public interface SetterForFloat32 { - Map getInstance(); - T getBuilderAfterFloat32(Map instance); - - default T float32(int value) { - var instance = getInstance(); - instance.put("float32", value); - return getBuilderAfterFloat32(instance); - } - - default T float32(float value) { - var instance = getInstance(); - instance.put("float32", value); - return getBuilderAfterFloat32(instance); - } - - default T float32(long value) { - var instance = getInstance(); - instance.put("float32", value); - return getBuilderAfterFloat32(instance); - } - - default T float32(double value) { - var instance = getInstance(); - instance.put("float32", value); - return getBuilderAfterFloat32(instance); - } - } - - public interface SetterForDoubleSchema { - Map getInstance(); - T getBuilderAfterDoubleSchema(Map instance); - - default T setDouble(int value) { - var instance = getInstance(); - instance.put("double", value); - return getBuilderAfterDoubleSchema(instance); - } - - default T setDouble(float value) { - var instance = getInstance(); - instance.put("double", value); - return getBuilderAfterDoubleSchema(instance); - } - - default T setDouble(long value) { - var instance = getInstance(); - instance.put("double", value); - return getBuilderAfterDoubleSchema(instance); - } - - default T setDouble(double value) { - var instance = getInstance(); - instance.put("double", value); - return getBuilderAfterDoubleSchema(instance); - } - } - - public interface SetterForFloat64 { - Map getInstance(); - T getBuilderAfterFloat64(Map instance); - - default T float64(int value) { - var instance = getInstance(); - instance.put("float64", value); - return getBuilderAfterFloat64(instance); - } - - default T float64(float value) { - var instance = getInstance(); - instance.put("float64", value); - return getBuilderAfterFloat64(instance); - } - - default T float64(long value) { - var instance = getInstance(); - instance.put("float64", value); - return getBuilderAfterFloat64(instance); - } - - default T float64(double value) { - var instance = getInstance(); - instance.put("float64", value); - return getBuilderAfterFloat64(instance); - } - } - - public interface SetterForArrayWithUniqueItems { - Map getInstance(); - T getBuilderAfterArrayWithUniqueItems(Map instance); - - default T arrayWithUniqueItems(List value) { - var instance = getInstance(); - instance.put("arrayWithUniqueItems", value); - return getBuilderAfterArrayWithUniqueItems(instance); - } - } - - public interface SetterForStringSchema { - Map getInstance(); - T getBuilderAfterStringSchema(Map instance); - - default T setString(String value) { - var instance = getInstance(); - instance.put("string", value); - return getBuilderAfterStringSchema(instance); - } - } - - public interface SetterForBinary { - Map getInstance(); - T getBuilderAfterBinary(Map instance); - - default T binary(String value) { - var instance = getInstance(); - instance.put("binary", value); - return getBuilderAfterBinary(instance); - } - } - - public interface SetterForDateTime { - Map getInstance(); - T getBuilderAfterDateTime(Map instance); - - default T dateTime(String value) { - var instance = getInstance(); - instance.put("dateTime", value); - return getBuilderAfterDateTime(instance); - } - } - - public interface SetterForUuidSchema { - Map getInstance(); - T getBuilderAfterUuidSchema(Map instance); - - default T setUuid(String value) { - var instance = getInstance(); - instance.put("uuid", value); - return getBuilderAfterUuidSchema(instance); - } - } - - public interface SetterForUuidNoExample { - Map getInstance(); - T getBuilderAfterUuidNoExample(Map instance); - - default T uuidNoExample(String value) { - var instance = getInstance(); - instance.put("uuidNoExample", value); - return getBuilderAfterUuidNoExample(instance); - } - } - - public interface SetterForPatternWithDigits { - Map getInstance(); - T getBuilderAfterPatternWithDigits(Map instance); - - default T pattern_with_digits(String value) { - var instance = getInstance(); - instance.put("pattern_with_digits", value); - return getBuilderAfterPatternWithDigits(instance); - } - } - - public interface SetterForPatternWithDigitsAndDelimiter { - Map getInstance(); - T getBuilderAfterPatternWithDigitsAndDelimiter(Map instance); - - default T pattern_with_digits_and_delimiter(String value) { - var instance = getInstance(); - instance.put("pattern_with_digits_and_delimiter", value); - return getBuilderAfterPatternWithDigitsAndDelimiter(instance); - } - } - - public interface SetterForNoneProp { - Map getInstance(); - T getBuilderAfterNoneProp(Map instance); - - default T noneProp(Nothing? value) { - var instance = getInstance(); - instance.put("noneProp", null); - return getBuilderAfterNoneProp(instance); - } - } - - public static class FormatTestMap0000Builder extends UnsetAddPropsSetter implements GenericBuilder>, SetterForIntegerSchema, SetterForInt32, SetterForInt32withValidations, SetterForInt64, SetterForFloatSchema, SetterForFloat32, SetterForDoubleSchema, SetterForFloat64, SetterForArrayWithUniqueItems, SetterForStringSchema, SetterForBinary, SetterForDateTime, SetterForUuidSchema, SetterForUuidNoExample, SetterForPatternWithDigits, SetterForPatternWithDigitsAndDelimiter, SetterForNoneProp { - private final Map instance; - private static final Set knownKeys = Set.of( - "byte", - "date", - "number", - "password", - "integer", - "int32", - "int32withValidations", - "int64", - "float", - "float32", - "double", - "float64", - "arrayWithUniqueItems", - "string", - "binary", - "dateTime", - "uuid", - "uuidNoExample", - "pattern_with_digits", - "pattern_with_digits_and_delimiter", - "noneProp" - ); - public Set getKnownKeys() { - return knownKeys; - } - public FormatTestMap0000Builder(Map instance) { - this.instance = instance; - } - public Map build() { - return instance; - } - public Map getInstance() { - return instance; - } - public FormatTestMap0000Builder getBuilderAfterIntegerSchema(Map instance) { - return this; - } - public FormatTestMap0000Builder getBuilderAfterInt32(Map instance) { - return this; - } - public FormatTestMap0000Builder getBuilderAfterInt32withValidations(Map instance) { - return this; - } - public FormatTestMap0000Builder getBuilderAfterInt64(Map instance) { - return this; - } - public FormatTestMap0000Builder getBuilderAfterFloatSchema(Map instance) { - return this; - } - public FormatTestMap0000Builder getBuilderAfterFloat32(Map instance) { - return this; - } - public FormatTestMap0000Builder getBuilderAfterDoubleSchema(Map instance) { - return this; - } - public FormatTestMap0000Builder getBuilderAfterFloat64(Map instance) { - return this; - } - public FormatTestMap0000Builder getBuilderAfterArrayWithUniqueItems(Map instance) { - return this; - } - public FormatTestMap0000Builder getBuilderAfterStringSchema(Map instance) { - return this; - } - public FormatTestMap0000Builder getBuilderAfterBinary(Map instance) { - return this; - } - public FormatTestMap0000Builder getBuilderAfterDateTime(Map instance) { - return this; - } - public FormatTestMap0000Builder getBuilderAfterUuidSchema(Map instance) { - return this; - } - public FormatTestMap0000Builder getBuilderAfterUuidNoExample(Map instance) { - return this; - } - public FormatTestMap0000Builder getBuilderAfterPatternWithDigits(Map instance) { - return this; - } - public FormatTestMap0000Builder getBuilderAfterPatternWithDigitsAndDelimiter(Map instance) { - return this; - } - public FormatTestMap0000Builder getBuilderAfterNoneProp(Map instance) { - return this; - } - public FormatTestMap0000Builder getBuilderAfterAdditionalProperty(Map instance) { - return this; - } - } - - public static class FormatTestMap0001Builder implements SetterForPassword { - private final Map instance; - public FormatTestMap0001Builder(Map instance) { - this.instance = instance; - } - public Map getInstance() { - return instance; - } - public FormatTestMap0000Builder getBuilderAfterPassword(Map instance) { - return new FormatTestMap0000Builder(instance); - } - } - - public static class FormatTestMap0010Builder implements SetterForNumberSchema { - private final Map instance; - public FormatTestMap0010Builder(Map instance) { - this.instance = instance; - } - public Map getInstance() { - return instance; - } - public FormatTestMap0000Builder getBuilderAfterNumberSchema(Map instance) { - return new FormatTestMap0000Builder(instance); - } - } - - public static class FormatTestMap0011Builder implements SetterForNumberSchema, SetterForPassword { - private final Map instance; - public FormatTestMap0011Builder(Map instance) { - this.instance = instance; - } - public Map getInstance() { - return instance; - } - public FormatTestMap0001Builder getBuilderAfterNumberSchema(Map instance) { - return new FormatTestMap0001Builder(instance); - } - public FormatTestMap0010Builder getBuilderAfterPassword(Map instance) { - return new FormatTestMap0010Builder(instance); - } - } - - public static class FormatTestMap0100Builder implements SetterForDate { - private final Map instance; - public FormatTestMap0100Builder(Map instance) { - this.instance = instance; - } - public Map getInstance() { - return instance; - } - public FormatTestMap0000Builder getBuilderAfterDate(Map instance) { - return new FormatTestMap0000Builder(instance); - } - } - - public static class FormatTestMap0101Builder implements SetterForDate, SetterForPassword { - private final Map instance; - public FormatTestMap0101Builder(Map instance) { - this.instance = instance; - } - public Map getInstance() { - return instance; - } - public FormatTestMap0001Builder getBuilderAfterDate(Map instance) { - return new FormatTestMap0001Builder(instance); - } - public FormatTestMap0100Builder getBuilderAfterPassword(Map instance) { - return new FormatTestMap0100Builder(instance); - } - } - - public static class FormatTestMap0110Builder implements SetterForDate, SetterForNumberSchema { - private final Map instance; - public FormatTestMap0110Builder(Map instance) { - this.instance = instance; - } - public Map getInstance() { - return instance; - } - public FormatTestMap0010Builder getBuilderAfterDate(Map instance) { - return new FormatTestMap0010Builder(instance); - } - public FormatTestMap0100Builder getBuilderAfterNumberSchema(Map instance) { - return new FormatTestMap0100Builder(instance); - } - } - - public static class FormatTestMap0111Builder implements SetterForDate, SetterForNumberSchema, SetterForPassword { - private final Map instance; - public FormatTestMap0111Builder(Map instance) { - this.instance = instance; - } - public Map getInstance() { - return instance; - } - public FormatTestMap0011Builder getBuilderAfterDate(Map instance) { - return new FormatTestMap0011Builder(instance); - } - public FormatTestMap0101Builder getBuilderAfterNumberSchema(Map instance) { - return new FormatTestMap0101Builder(instance); - } - public FormatTestMap0110Builder getBuilderAfterPassword(Map instance) { - return new FormatTestMap0110Builder(instance); - } - } - - public static class FormatTestMap1000Builder implements SetterForByteSchema { - private final Map instance; - public FormatTestMap1000Builder(Map instance) { - this.instance = instance; - } - public Map getInstance() { - return instance; - } - public FormatTestMap0000Builder getBuilderAfterByteSchema(Map instance) { - return new FormatTestMap0000Builder(instance); - } - } - - public static class FormatTestMap1001Builder implements SetterForByteSchema, SetterForPassword { - private final Map instance; - public FormatTestMap1001Builder(Map instance) { - this.instance = instance; - } - public Map getInstance() { - return instance; - } - public FormatTestMap0001Builder getBuilderAfterByteSchema(Map instance) { - return new FormatTestMap0001Builder(instance); - } - public FormatTestMap1000Builder getBuilderAfterPassword(Map instance) { - return new FormatTestMap1000Builder(instance); - } - } - - public static class FormatTestMap1010Builder implements SetterForByteSchema, SetterForNumberSchema { - private final Map instance; - public FormatTestMap1010Builder(Map instance) { - this.instance = instance; - } - public Map getInstance() { - return instance; - } - public FormatTestMap0010Builder getBuilderAfterByteSchema(Map instance) { - return new FormatTestMap0010Builder(instance); - } - public FormatTestMap1000Builder getBuilderAfterNumberSchema(Map instance) { - return new FormatTestMap1000Builder(instance); - } - } - - public static class FormatTestMap1011Builder implements SetterForByteSchema, SetterForNumberSchema, SetterForPassword { - private final Map instance; - public FormatTestMap1011Builder(Map instance) { - this.instance = instance; - } - public Map getInstance() { - return instance; - } - public FormatTestMap0011Builder getBuilderAfterByteSchema(Map instance) { - return new FormatTestMap0011Builder(instance); - } - public FormatTestMap1001Builder getBuilderAfterNumberSchema(Map instance) { - return new FormatTestMap1001Builder(instance); - } - public FormatTestMap1010Builder getBuilderAfterPassword(Map instance) { - return new FormatTestMap1010Builder(instance); - } - } - - public static class FormatTestMap1100Builder implements SetterForByteSchema, SetterForDate { - private final Map instance; - public FormatTestMap1100Builder(Map instance) { - this.instance = instance; - } - public Map getInstance() { - return instance; - } - public FormatTestMap0100Builder getBuilderAfterByteSchema(Map instance) { - return new FormatTestMap0100Builder(instance); - } - public FormatTestMap1000Builder getBuilderAfterDate(Map instance) { - return new FormatTestMap1000Builder(instance); - } - } - - public static class FormatTestMap1101Builder implements SetterForByteSchema, SetterForDate, SetterForPassword { - private final Map instance; - public FormatTestMap1101Builder(Map instance) { - this.instance = instance; - } - public Map getInstance() { - return instance; - } - public FormatTestMap0101Builder getBuilderAfterByteSchema(Map instance) { - return new FormatTestMap0101Builder(instance); - } - public FormatTestMap1001Builder getBuilderAfterDate(Map instance) { - return new FormatTestMap1001Builder(instance); - } - public FormatTestMap1100Builder getBuilderAfterPassword(Map instance) { - return new FormatTestMap1100Builder(instance); - } - } - - public static class FormatTestMap1110Builder implements SetterForByteSchema, SetterForDate, SetterForNumberSchema { - private final Map instance; - public FormatTestMap1110Builder(Map instance) { - this.instance = instance; - } - public Map getInstance() { - return instance; - } - public FormatTestMap0110Builder getBuilderAfterByteSchema(Map instance) { - return new FormatTestMap0110Builder(instance); - } - public FormatTestMap1010Builder getBuilderAfterDate(Map instance) { - return new FormatTestMap1010Builder(instance); - } - public FormatTestMap1100Builder getBuilderAfterNumberSchema(Map instance) { - return new FormatTestMap1100Builder(instance); - } - } - - public static class FormatTestMapBuilder implements SetterForByteSchema, SetterForDate, SetterForNumberSchema, SetterForPassword { - private final Map instance; - public FormatTestMapBuilder() { - this.instance = new LinkedHashMap<>(); - } - public Map getInstance() { - return instance; - } - public FormatTestMap0111Builder getBuilderAfterByteSchema(Map instance) { - return new FormatTestMap0111Builder(instance); - } - public FormatTestMap1011Builder getBuilderAfterDate(Map instance) { - return new FormatTestMap1011Builder(instance); - } - public FormatTestMap1101Builder getBuilderAfterNumberSchema(Map instance) { - return new FormatTestMap1101Builder(instance); - } - public FormatTestMap1110Builder getBuilderAfterPassword(Map instance) { - return new FormatTestMap1110Builder(instance); - } - } - - - public sealed interface FormatTest1Boxed permits FormatTest1BoxedMap { - @Nullable Object getData(); - } - - public record FormatTest1BoxedMap(FormatTestMap data) implements FormatTest1Boxed { - @Override - public @Nullable Object getData() { - return data; - } - } - - - public static class FormatTest1 extends JsonSchema implements MapSchemaValidator { - /* - NOTE: This class is auto generated by OpenAPI JSON Schema Generator. - Ref: https://github.com/openapi-json-schema-tools/openapi-json-schema-generator - - Do not edit the class manually. - */ - private static @Nullable FormatTest1 instance = null; - - protected FormatTest1() { - super(new JsonSchemaInfo() - .type(Set.of(Map.class)) - .properties(Map.ofEntries( - new PropertyEntry("integer", IntegerSchema.class), - new PropertyEntry("int32", Int32.class), - new PropertyEntry("int32withValidations", Int32withValidations.class), - new PropertyEntry("int64", Int64.class), - new PropertyEntry("number", NumberSchema.class), - new PropertyEntry("float", FloatSchema.class), - new PropertyEntry("float32", Float32.class), - new PropertyEntry("double", DoubleSchema.class), - new PropertyEntry("float64", Float64.class), - new PropertyEntry("arrayWithUniqueItems", ArrayWithUniqueItems.class), - new PropertyEntry("string", StringSchema.class), - new PropertyEntry("byte", ByteSchema.class), - new PropertyEntry("binary", Binary.class), - new PropertyEntry("date", Date.class), - new PropertyEntry("dateTime", DateTime.class), - new PropertyEntry("uuid", UuidSchema.class), - new PropertyEntry("uuidNoExample", UuidNoExample.class), - new PropertyEntry("password", Password.class), - new PropertyEntry("pattern_with_digits", PatternWithDigits.class), - new PropertyEntry("pattern_with_digits_and_delimiter", PatternWithDigitsAndDelimiter.class), - new PropertyEntry("noneProp", NoneProp.class) - )) - .required(Set.of( - "byte", - "date", - "number", - "password" - )) - ); - } - - public static FormatTest1 getInstance() { - if (instance == null) { - instance = new FormatTest1(); - } - return instance; - } - - 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 RuntimeException("Invalid non-string key value"); - } - String propertyName = (String) entryKey; - List propertyPathToItem = new ArrayList<>(pathToItem); - propertyPathToItem.add(propertyName); - Object value = entry.getValue(); - LinkedHashMap, Nothing?> schemas = pathToSchemas.get(propertyPathToItem); - if (schemas == null) { - throw new RuntimeException("Validation result is invalid, schemas must exist for a pathToItem"); - } - JsonSchema propertySchema = schemas.entrySet().iterator().next().getKey(); - @Nullable Object propertyInstance = propertySchema.getNewInstance(value, propertyPathToItem, pathToSchemas); - properties.put(propertyName, propertyInstance); - } - FrozenMap<@Nullable Object> castProperties = new FrozenMap<>(properties); - return new FormatTestMap(castProperties); - } - - 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); - SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().build())); - ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, new PathToSchemasMap(), new LinkedHashSet<>()); - PathToSchemasMap pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet); - return getNewInstance(castArg, validationMetadata.pathToItem(), pathToSchemasMap); - } - - - @Override - public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws 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"); - } - @Override - public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { - if (arg instanceof Map) { - return getNewInstance((Map) arg, pathToItem, pathToSchemas); - } - 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 { - return new FormatTest1BoxedMap(validate(arg, configuration)); - } - @Override - public FormatTest1Boxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { - 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"); - } - } - -} diff --git a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/schemas/FromSchema.kt b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/schemas/FromSchema.kt deleted file mode 100644 index 31f15de6c34..00000000000 --- a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/schemas/FromSchema.kt +++ /dev/null @@ -1,263 +0,0 @@ -package org.openapijsonschematools.client.components.schemas; -import java.util.ArrayList; -import java.util.HashSet; -import java.util.LinkedHashMap; -import java.util.LinkedHashSet; -import java.util.List; -import java.util.Map; -import java.util.Objects; -import java.util.Set; -import org.checkerframework.checker.nullness.qual.Nullable; -import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags; -import org.openapijsonschematools.client.configurations.SchemaConfiguration; -import org.openapijsonschematools.client.exceptions.InvalidAdditionalPropertyException; -import org.openapijsonschematools.client.exceptions.UnsetPropertyException; -import org.openapijsonschematools.client.exceptions.ValidationException; -import org.openapijsonschematools.client.schemas.GenericBuilder; -import org.openapijsonschematools.client.schemas.IntJsonSchema; -import org.openapijsonschematools.client.schemas.StringJsonSchema; -import org.openapijsonschematools.client.schemas.UnsetAddPropsSetter; -import org.openapijsonschematools.client.schemas.validation.FrozenMap; -import org.openapijsonschematools.client.schemas.validation.JsonSchema; -import org.openapijsonschematools.client.schemas.validation.JsonSchemaInfo; -import org.openapijsonschematools.client.schemas.validation.MapSchemaValidator; -import org.openapijsonschematools.client.schemas.validation.PathToSchemasMap; -import org.openapijsonschematools.client.schemas.validation.PropertyEntry; -import org.openapijsonschematools.client.schemas.validation.ValidationMetadata; - -public class FromSchema { - // nest classes so all schemas and input/output classes can be public - - - public static class Data extends StringJsonSchema.StringJsonSchema1 { - private static @Nullable Data instance = null; - public static Data getInstance() { - if (instance == null) { - instance = new Data(); - } - return instance; - } - } - - - public static class Id extends IntJsonSchema.IntJsonSchema1 { - private static @Nullable Id instance = null; - public static Id getInstance() { - if (instance == null) { - instance = new Id(); - } - return instance; - } - } - - - public static class FromSchemaMap extends FrozenMap<@Nullable Object> { - protected FromSchemaMap(FrozenMap<@Nullable Object> m) { - super(m); - } - public static final Set requiredKeys = Set.of(); - public static final Set optionalKeys = Set.of( - "data", - "id" - ); - public static FromSchemaMap of(Map arg, SchemaConfiguration configuration) throws ValidationException { - return FromSchema1.getInstance().validate(arg, configuration); - } - - public String data() throws UnsetPropertyException { - String key = "data"; - throwIfKeyNotPresent(key); - @Nullable Object value = get(key); - if (!(value instanceof String)) { - throw new RuntimeException("Invalid value stored for data"); - } - return (String) value; - } - - public Number id() throws UnsetPropertyException { - String key = "id"; - throwIfKeyNotPresent(key); - @Nullable Object value = get(key); - if (!(value instanceof Number)) { - throw new RuntimeException("Invalid value stored for id"); - } - return (Number) value; - } - - public @Nullable Object getAdditionalProperty(String name) throws UnsetPropertyException, InvalidAdditionalPropertyException { - throwIfKeyKnown(name, requiredKeys, optionalKeys); - throwIfKeyNotPresent(name); - return get(name); - } - } - - public interface SetterForData { - Map getInstance(); - T getBuilderAfterData(Map instance); - - default T data(String value) { - var instance = getInstance(); - instance.put("data", value); - return getBuilderAfterData(instance); - } - } - - public interface SetterForId { - Map getInstance(); - T getBuilderAfterId(Map instance); - - default T id(int value) { - var instance = getInstance(); - instance.put("id", value); - return getBuilderAfterId(instance); - } - - default T id(float value) { - var instance = getInstance(); - instance.put("id", value); - return getBuilderAfterId(instance); - } - - default T id(long value) { - var instance = getInstance(); - instance.put("id", value); - return getBuilderAfterId(instance); - } - - default T id(double value) { - var instance = getInstance(); - instance.put("id", value); - return getBuilderAfterId(instance); - } - } - - public static class FromSchemaMapBuilder extends UnsetAddPropsSetter implements GenericBuilder>, SetterForData, SetterForId { - private final Map instance; - private static final Set knownKeys = Set.of( - "data", - "id" - ); - public Set getKnownKeys() { - return knownKeys; - } - public FromSchemaMapBuilder() { - this.instance = new LinkedHashMap<>(); - } - public Map build() { - return instance; - } - public Map getInstance() { - return instance; - } - public FromSchemaMapBuilder getBuilderAfterData(Map instance) { - return this; - } - public FromSchemaMapBuilder getBuilderAfterId(Map instance) { - return this; - } - public FromSchemaMapBuilder getBuilderAfterAdditionalProperty(Map instance) { - return this; - } - } - - - public sealed interface FromSchema1Boxed permits FromSchema1BoxedMap { - @Nullable Object getData(); - } - - public record FromSchema1BoxedMap(FromSchemaMap data) implements FromSchema1Boxed { - @Override - public @Nullable Object getData() { - return data; - } - } - - - public static class FromSchema1 extends JsonSchema implements MapSchemaValidator { - /* - NOTE: This class is auto generated by OpenAPI JSON Schema Generator. - Ref: https://github.com/openapi-json-schema-tools/openapi-json-schema-generator - - Do not edit the class manually. - */ - private static @Nullable FromSchema1 instance = null; - - protected FromSchema1() { - super(new JsonSchemaInfo() - .type(Set.of(Map.class)) - .properties(Map.ofEntries( - new PropertyEntry("data", Data.class), - new PropertyEntry("id", Id.class) - )) - ); - } - - public static FromSchema1 getInstance() { - if (instance == null) { - instance = new FromSchema1(); - } - return instance; - } - - 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 RuntimeException("Invalid non-string key value"); - } - String propertyName = (String) entryKey; - List propertyPathToItem = new ArrayList<>(pathToItem); - propertyPathToItem.add(propertyName); - Object value = entry.getValue(); - LinkedHashMap, Nothing?> schemas = pathToSchemas.get(propertyPathToItem); - if (schemas == null) { - throw new RuntimeException("Validation result is invalid, schemas must exist for a pathToItem"); - } - JsonSchema propertySchema = schemas.entrySet().iterator().next().getKey(); - @Nullable Object propertyInstance = propertySchema.getNewInstance(value, propertyPathToItem, pathToSchemas); - properties.put(propertyName, propertyInstance); - } - FrozenMap<@Nullable Object> castProperties = new FrozenMap<>(properties); - return new FromSchemaMap(castProperties); - } - - 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); - SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().build())); - ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, new PathToSchemasMap(), new LinkedHashSet<>()); - PathToSchemasMap pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet); - return getNewInstance(castArg, validationMetadata.pathToItem(), pathToSchemasMap); - } - - - @Override - public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws 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"); - } - @Override - public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { - if (arg instanceof Map) { - return getNewInstance((Map) arg, pathToItem, pathToSchemas); - } - 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 { - return new FromSchema1BoxedMap(validate(arg, configuration)); - } - @Override - public FromSchema1Boxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { - 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"); - } - } - -} diff --git a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/schemas/Fruit.kt b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/schemas/Fruit.kt deleted file mode 100644 index 0b9fff4a2b1..00000000000 --- a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/schemas/Fruit.kt +++ /dev/null @@ -1,413 +0,0 @@ -package org.openapijsonschematools.client.components.schemas; -import java.time.LocalDate; -import java.time.ZonedDateTime; -import java.util.ArrayList; -import java.util.HashSet; -import java.util.LinkedHashMap; -import java.util.LinkedHashSet; -import java.util.List; -import java.util.Map; -import java.util.Objects; -import java.util.Set; -import java.util.UUID; -import org.checkerframework.checker.nullness.qual.Nullable; -import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags; -import org.openapijsonschematools.client.configurations.SchemaConfiguration; -import org.openapijsonschematools.client.exceptions.InvalidAdditionalPropertyException; -import org.openapijsonschematools.client.exceptions.UnsetPropertyException; -import org.openapijsonschematools.client.exceptions.ValidationException; -import org.openapijsonschematools.client.schemas.GenericBuilder; -import org.openapijsonschematools.client.schemas.StringJsonSchema; -import org.openapijsonschematools.client.schemas.UnsetAddPropsSetter; -import org.openapijsonschematools.client.schemas.validation.BooleanSchemaValidator; -import org.openapijsonschematools.client.schemas.validation.FrozenList; -import org.openapijsonschematools.client.schemas.validation.FrozenMap; -import org.openapijsonschematools.client.schemas.validation.JsonSchema; -import org.openapijsonschematools.client.schemas.validation.JsonSchemaInfo; -import org.openapijsonschematools.client.schemas.validation.ListSchemaValidator; -import org.openapijsonschematools.client.schemas.validation.MapSchemaValidator; -import org.openapijsonschematools.client.schemas.validation.NullSchemaValidator; -import org.openapijsonschematools.client.schemas.validation.NumberSchemaValidator; -import org.openapijsonschematools.client.schemas.validation.PathToSchemasMap; -import org.openapijsonschematools.client.schemas.validation.PropertyEntry; -import org.openapijsonschematools.client.schemas.validation.StringSchemaValidator; -import org.openapijsonschematools.client.schemas.validation.ValidationMetadata; - -public class Fruit { - // nest classes so all schemas and input/output classes can be public - - - public static class Color extends StringJsonSchema.StringJsonSchema1 { - private static @Nullable Color instance = null; - public static Color getInstance() { - if (instance == null) { - instance = new Color(); - } - return instance; - } - } - - - public static class FruitMap extends FrozenMap<@Nullable Object> { - protected FruitMap(FrozenMap<@Nullable Object> m) { - super(m); - } - public static final Set requiredKeys = Set.of(); - public static final Set optionalKeys = Set.of( - "color" - ); - public static FruitMap of(Map arg, SchemaConfiguration configuration) throws ValidationException { - return Fruit1.getInstance().validate(arg, configuration); - } - - public String color() throws UnsetPropertyException { - String key = "color"; - throwIfKeyNotPresent(key); - @Nullable Object value = get(key); - if (!(value instanceof String)) { - throw new RuntimeException("Invalid value stored for color"); - } - return (String) value; - } - - public @Nullable Object getAdditionalProperty(String name) throws UnsetPropertyException, InvalidAdditionalPropertyException { - throwIfKeyKnown(name, requiredKeys, optionalKeys); - throwIfKeyNotPresent(name); - return get(name); - } - } - - public interface SetterForColor { - Map getInstance(); - T getBuilderAfterColor(Map instance); - - default T color(String value) { - var instance = getInstance(); - instance.put("color", value); - return getBuilderAfterColor(instance); - } - } - - public static class FruitMapBuilder extends UnsetAddPropsSetter implements GenericBuilder>, SetterForColor { - private final Map instance; - private static final Set knownKeys = Set.of( - "color" - ); - public Set getKnownKeys() { - return knownKeys; - } - public FruitMapBuilder() { - this.instance = new LinkedHashMap<>(); - } - public Map build() { - return instance; - } - public Map getInstance() { - return instance; - } - public FruitMapBuilder getBuilderAfterColor(Map instance) { - return this; - } - public FruitMapBuilder getBuilderAfterAdditionalProperty(Map instance) { - return this; - } - } - - - public sealed interface Fruit1Boxed permits Fruit1BoxedVoid, Fruit1BoxedBoolean, Fruit1BoxedNumber, Fruit1BoxedString, Fruit1BoxedList, Fruit1BoxedMap { - @Nullable Object getData(); - } - - public record Fruit1BoxedVoid(Nothing? data) implements Fruit1Boxed { - @Override - public @Nullable Object getData() { - return data; - } - } - - public record Fruit1BoxedBoolean(boolean data) implements Fruit1Boxed { - @Override - public @Nullable Object getData() { - return data; - } - } - - public record Fruit1BoxedNumber(Number data) implements Fruit1Boxed { - @Override - public @Nullable Object getData() { - return data; - } - } - - public record Fruit1BoxedString(String data) implements Fruit1Boxed { - @Override - public @Nullable Object getData() { - return data; - } - } - - public record Fruit1BoxedList(FrozenList<@Nullable Object> data) implements Fruit1Boxed { - @Override - public @Nullable Object getData() { - return data; - } - } - - public record Fruit1BoxedMap(FruitMap data) implements Fruit1Boxed { - @Override - public @Nullable Object getData() { - return data; - } - } - - - public static class Fruit1 extends JsonSchema implements NullSchemaValidator, BooleanSchemaValidator, NumberSchemaValidator, StringSchemaValidator, ListSchemaValidator, Fruit1BoxedList>, MapSchemaValidator { - /* - NOTE: This class is auto generated by OpenAPI JSON Schema Generator. - Ref: https://github.com/openapi-json-schema-tools/openapi-json-schema-generator - - Do not edit the class manually. - */ - private static @Nullable Fruit1 instance = null; - - protected Fruit1() { - super(new JsonSchemaInfo() - .properties(Map.ofEntries( - new PropertyEntry("color", Color.class) - )) - .oneOf(List.of( - Apple.Apple1.class, - Banana.Banana1.class - )) - ); - } - - public static Fruit1 getInstance() { - if (instance == null) { - instance = new Fruit1(); - } - return instance; - } - - @Override - public Nothing? validate(Nothing? arg, SchemaConfiguration configuration) throws ValidationException { - Set> pathSet = new HashSet<>(); - List pathToItem = List.of("args[0]"); - Nothing? castArg = castToAllowedTypes(arg, pathToItem, pathSet); - SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().build())); - PathToSchemasMap validatedPathToSchemas = new PathToSchemasMap(); - ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, new LinkedHashSet<>()); - getPathToSchemas(this, castArg, validationMetadata, pathSet); - return castArg; - } - - @Override - public boolean validate(boolean arg, SchemaConfiguration configuration) throws ValidationException { - Set> pathSet = new HashSet<>(); - List pathToItem = List.of("args[0]"); - boolean castArg = castToAllowedTypes(arg, pathToItem, pathSet); - SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().build())); - PathToSchemasMap validatedPathToSchemas = new PathToSchemasMap(); - ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, new LinkedHashSet<>()); - getPathToSchemas(this, castArg, validationMetadata, pathSet); - return castArg; - } - - @Override - public Number validate(Number arg, SchemaConfiguration configuration) throws ValidationException { - Set> pathSet = new HashSet<>(); - List pathToItem = List.of("args[0]"); - Number castArg = castToAllowedTypes(arg, pathToItem, pathSet); - SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().build())); - PathToSchemasMap validatedPathToSchemas = new PathToSchemasMap(); - ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, new LinkedHashSet<>()); - getPathToSchemas(this, castArg, validationMetadata, pathSet); - return castArg; - } - - public int validate(int arg, SchemaConfiguration configuration) throws ValidationException { - return (int) validate((Number) arg, configuration); - } - - public long validate(long arg, SchemaConfiguration configuration) throws ValidationException { - return (long) validate((Number) arg, configuration); - } - - public float validate(float arg, SchemaConfiguration configuration) throws ValidationException { - return (float) validate((Number) arg, configuration); - } - - public double validate(double arg, SchemaConfiguration configuration) throws ValidationException { - return (double) validate((Number) arg, configuration); - } - - @Override - public String validate(String arg, SchemaConfiguration configuration) throws ValidationException { - Set> pathSet = new HashSet<>(); - List pathToItem = List.of("args[0]"); - String castArg = castToAllowedTypes(arg, pathToItem, pathSet); - SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().build())); - PathToSchemasMap validatedPathToSchemas = new PathToSchemasMap(); - ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, new LinkedHashSet<>()); - getPathToSchemas(this, castArg, validationMetadata, pathSet); - return castArg; - } - - public String validate(LocalDate arg, SchemaConfiguration configuration) throws ValidationException { - return validate(arg.toString(), configuration); - } - - public String validate(ZonedDateTime arg, SchemaConfiguration configuration) throws ValidationException { - return validate(arg.toString(), configuration); - } - - public String validate(UUID arg, SchemaConfiguration configuration) throws ValidationException { - return validate(arg.toString(), configuration); - } - - @Override - public FrozenList<@Nullable Object> getNewInstance(List arg, List pathToItem, PathToSchemasMap pathToSchemas) { - List<@Nullable Object> items = new ArrayList<>(); - int i = 0; - for (Object item: arg) { - List itemPathToItem = new ArrayList<>(pathToItem); - itemPathToItem.add(i); - LinkedHashMap, Nothing?> schemas = pathToSchemas.get(itemPathToItem); - if (schemas == null) { - throw new RuntimeException("Validation result is invalid, schemas must exist for a pathToItem"); - } - JsonSchema itemSchema = schemas.entrySet().iterator().next().getKey(); - @Nullable Object itemInstance = itemSchema.getNewInstance(item, itemPathToItem, pathToSchemas); - items.add(itemInstance); - i += 1; - } - FrozenList<@Nullable Object> newInstanceItems = new FrozenList<>(items); - return newInstanceItems; - } - - 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); - SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().build())); - ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, new PathToSchemasMap(), new LinkedHashSet<>()); - PathToSchemasMap pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet); - return getNewInstance(castArg, validationMetadata.pathToItem(), pathToSchemasMap); - } - - @Override - 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 RuntimeException("Invalid non-string key value"); - } - String propertyName = (String) entryKey; - List propertyPathToItem = new ArrayList<>(pathToItem); - propertyPathToItem.add(propertyName); - Object value = entry.getValue(); - LinkedHashMap, Nothing?> schemas = pathToSchemas.get(propertyPathToItem); - if (schemas == null) { - throw new RuntimeException("Validation result is invalid, schemas must exist for a pathToItem"); - } - JsonSchema propertySchema = schemas.entrySet().iterator().next().getKey(); - @Nullable Object propertyInstance = propertySchema.getNewInstance(value, propertyPathToItem, pathToSchemas); - properties.put(propertyName, propertyInstance); - } - FrozenMap<@Nullable Object> castProperties = new FrozenMap<>(properties); - return new FruitMap(castProperties); - } - - 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); - SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().build())); - PathToSchemasMap validatedPathToSchemas = new PathToSchemasMap(); - ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, new LinkedHashSet<>()); - PathToSchemasMap pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet); - return getNewInstance(castArg, validationMetadata.pathToItem(), pathToSchemasMap); - } - - @Override - public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { - if (arg == null) { - return validate((Nothing?) null, configuration); - } else if (arg instanceof Boolean) { - boolean boolArg = (Boolean) arg; - return validate(boolArg, configuration); - } else if (arg instanceof Number) { - return validate((Number) arg, configuration); - } else if (arg instanceof String) { - return validate((String) arg, configuration); - } else if (arg instanceof List) { - return validate((List) arg, 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"); - } - @Override - public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { - if (arg == null) { - return getNewInstance((Nothing?) null, pathToItem, pathToSchemas); - } else if (arg instanceof Boolean) { - boolean boolArg = (Boolean) arg; - return getNewInstance(boolArg, pathToItem, pathToSchemas); - } else if (arg instanceof Number) { - return getNewInstance((Number) arg, pathToItem, pathToSchemas); - } else if (arg instanceof String) { - return getNewInstance((String) arg, pathToItem, pathToSchemas); - } else if (arg instanceof List) { - return getNewInstance((List) arg, 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"); - } - @Override - public Fruit1BoxedVoid validateAndBox(Nothing? arg, SchemaConfiguration configuration) throws ValidationException { - return new Fruit1BoxedVoid(validate(arg, configuration)); - } - @Override - 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 { - return new Fruit1BoxedNumber(validate(arg, configuration)); - } - @Override - 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 { - return new Fruit1BoxedList(validate(arg, configuration)); - } - @Override - 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 { - if (arg == null) { - Nothing? castArg = (Nothing?) arg; - return validateAndBox(castArg, configuration); - } else if (arg instanceof Boolean booleanArg) { - boolean castArg = booleanArg; - return validateAndBox(castArg, configuration); - } else if (arg instanceof String castArg) { - return validateAndBox(castArg, configuration); - } else if (arg instanceof Number castArg) { - return validateAndBox(castArg, configuration); - } else if (arg instanceof List castArg) { - 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"); - } - } -} diff --git a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/schemas/FruitReq.kt b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/schemas/FruitReq.kt deleted file mode 100644 index 7df923b3071..00000000000 --- a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/schemas/FruitReq.kt +++ /dev/null @@ -1,343 +0,0 @@ -package org.openapijsonschematools.client.components.schemas; -import java.time.LocalDate; -import java.time.ZonedDateTime; -import java.util.ArrayList; -import java.util.HashSet; -import java.util.LinkedHashMap; -import java.util.LinkedHashSet; -import java.util.List; -import java.util.Map; -import java.util.Objects; -import java.util.Set; -import java.util.UUID; -import org.checkerframework.checker.nullness.qual.Nullable; -import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags; -import org.openapijsonschematools.client.configurations.SchemaConfiguration; -import org.openapijsonschematools.client.exceptions.InvalidAdditionalPropertyException; -import org.openapijsonschematools.client.exceptions.UnsetPropertyException; -import org.openapijsonschematools.client.exceptions.ValidationException; -import org.openapijsonschematools.client.schemas.NullJsonSchema; -import org.openapijsonschematools.client.schemas.UnsetAddPropsSetter; -import org.openapijsonschematools.client.schemas.validation.BooleanSchemaValidator; -import org.openapijsonschematools.client.schemas.validation.FrozenList; -import org.openapijsonschematools.client.schemas.validation.FrozenMap; -import org.openapijsonschematools.client.schemas.validation.JsonSchema; -import org.openapijsonschematools.client.schemas.validation.JsonSchemaInfo; -import org.openapijsonschematools.client.schemas.validation.ListSchemaValidator; -import org.openapijsonschematools.client.schemas.validation.MapSchemaValidator; -import org.openapijsonschematools.client.schemas.validation.NullSchemaValidator; -import org.openapijsonschematools.client.schemas.validation.NumberSchemaValidator; -import org.openapijsonschematools.client.schemas.validation.PathToSchemasMap; -import org.openapijsonschematools.client.schemas.validation.StringSchemaValidator; -import org.openapijsonschematools.client.schemas.validation.ValidationMetadata; - -public class FruitReq { - // nest classes so all schemas and input/output classes can be public - - - public static class Schema0 extends NullJsonSchema.NullJsonSchema1 { - private static @Nullable Schema0 instance = null; - public static Schema0 getInstance() { - if (instance == null) { - instance = new Schema0(); - } - return instance; - } - } - - - public sealed interface FruitReq1Boxed permits FruitReq1BoxedVoid, FruitReq1BoxedBoolean, FruitReq1BoxedNumber, FruitReq1BoxedString, FruitReq1BoxedList, FruitReq1BoxedMap { - @Nullable Object getData(); - } - - public record FruitReq1BoxedVoid(Nothing? data) implements FruitReq1Boxed { - @Override - public @Nullable Object getData() { - return data; - } - } - - public record FruitReq1BoxedBoolean(boolean data) implements FruitReq1Boxed { - @Override - public @Nullable Object getData() { - return data; - } - } - - public record FruitReq1BoxedNumber(Number data) implements FruitReq1Boxed { - @Override - public @Nullable Object getData() { - return data; - } - } - - public record FruitReq1BoxedString(String data) implements FruitReq1Boxed { - @Override - public @Nullable Object getData() { - return data; - } - } - - public record FruitReq1BoxedList(FrozenList<@Nullable Object> data) implements FruitReq1Boxed { - @Override - public @Nullable Object getData() { - return data; - } - } - - public record FruitReq1BoxedMap(FrozenMap<@Nullable Object> data) implements FruitReq1Boxed { - @Override - public @Nullable Object getData() { - return data; - } - } - - - public static class FruitReq1 extends JsonSchema implements NullSchemaValidator, BooleanSchemaValidator, NumberSchemaValidator, StringSchemaValidator, ListSchemaValidator, FruitReq1BoxedList>, MapSchemaValidator, FruitReq1BoxedMap> { - /* - NOTE: This class is auto generated by OpenAPI JSON Schema Generator. - Ref: https://github.com/openapi-json-schema-tools/openapi-json-schema-generator - - Do not edit the class manually. - */ - private static @Nullable FruitReq1 instance = null; - - protected FruitReq1() { - super(new JsonSchemaInfo() - .oneOf(List.of( - Schema0.class, - AppleReq.AppleReq1.class, - BananaReq.BananaReq1.class - )) - ); - } - - public static FruitReq1 getInstance() { - if (instance == null) { - instance = new FruitReq1(); - } - return instance; - } - - @Override - public Nothing? validate(Nothing? arg, SchemaConfiguration configuration) throws ValidationException { - Set> pathSet = new HashSet<>(); - List pathToItem = List.of("args[0]"); - Nothing? castArg = castToAllowedTypes(arg, pathToItem, pathSet); - SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().build())); - PathToSchemasMap validatedPathToSchemas = new PathToSchemasMap(); - ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, new LinkedHashSet<>()); - getPathToSchemas(this, castArg, validationMetadata, pathSet); - return castArg; - } - - @Override - public boolean validate(boolean arg, SchemaConfiguration configuration) throws ValidationException { - Set> pathSet = new HashSet<>(); - List pathToItem = List.of("args[0]"); - boolean castArg = castToAllowedTypes(arg, pathToItem, pathSet); - SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().build())); - PathToSchemasMap validatedPathToSchemas = new PathToSchemasMap(); - ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, new LinkedHashSet<>()); - getPathToSchemas(this, castArg, validationMetadata, pathSet); - return castArg; - } - - @Override - public Number validate(Number arg, SchemaConfiguration configuration) throws ValidationException { - Set> pathSet = new HashSet<>(); - List pathToItem = List.of("args[0]"); - Number castArg = castToAllowedTypes(arg, pathToItem, pathSet); - SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().build())); - PathToSchemasMap validatedPathToSchemas = new PathToSchemasMap(); - ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, new LinkedHashSet<>()); - getPathToSchemas(this, castArg, validationMetadata, pathSet); - return castArg; - } - - public int validate(int arg, SchemaConfiguration configuration) throws ValidationException { - return (int) validate((Number) arg, configuration); - } - - public long validate(long arg, SchemaConfiguration configuration) throws ValidationException { - return (long) validate((Number) arg, configuration); - } - - public float validate(float arg, SchemaConfiguration configuration) throws ValidationException { - return (float) validate((Number) arg, configuration); - } - - public double validate(double arg, SchemaConfiguration configuration) throws ValidationException { - return (double) validate((Number) arg, configuration); - } - - @Override - public String validate(String arg, SchemaConfiguration configuration) throws ValidationException { - Set> pathSet = new HashSet<>(); - List pathToItem = List.of("args[0]"); - String castArg = castToAllowedTypes(arg, pathToItem, pathSet); - SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().build())); - PathToSchemasMap validatedPathToSchemas = new PathToSchemasMap(); - ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, new LinkedHashSet<>()); - getPathToSchemas(this, castArg, validationMetadata, pathSet); - return castArg; - } - - public String validate(LocalDate arg, SchemaConfiguration configuration) throws ValidationException { - return validate(arg.toString(), configuration); - } - - public String validate(ZonedDateTime arg, SchemaConfiguration configuration) throws ValidationException { - return validate(arg.toString(), configuration); - } - - public String validate(UUID arg, SchemaConfiguration configuration) throws ValidationException { - return validate(arg.toString(), configuration); - } - - @Override - public FrozenList<@Nullable Object> getNewInstance(List arg, List pathToItem, PathToSchemasMap pathToSchemas) { - List<@Nullable Object> items = new ArrayList<>(); - int i = 0; - for (Object item: arg) { - List itemPathToItem = new ArrayList<>(pathToItem); - itemPathToItem.add(i); - LinkedHashMap, Nothing?> schemas = pathToSchemas.get(itemPathToItem); - if (schemas == null) { - throw new RuntimeException("Validation result is invalid, schemas must exist for a pathToItem"); - } - JsonSchema itemSchema = schemas.entrySet().iterator().next().getKey(); - @Nullable Object itemInstance = itemSchema.getNewInstance(item, itemPathToItem, pathToSchemas); - items.add(itemInstance); - i += 1; - } - FrozenList<@Nullable Object> newInstanceItems = new FrozenList<>(items); - return newInstanceItems; - } - - 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); - SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().build())); - ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, new PathToSchemasMap(), new LinkedHashSet<>()); - PathToSchemasMap pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet); - return getNewInstance(castArg, validationMetadata.pathToItem(), pathToSchemasMap); - } - - @Override - 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 RuntimeException("Invalid non-string key value"); - } - String propertyName = (String) entryKey; - List propertyPathToItem = new ArrayList<>(pathToItem); - propertyPathToItem.add(propertyName); - Object value = entry.getValue(); - LinkedHashMap, Nothing?> schemas = pathToSchemas.get(propertyPathToItem); - if (schemas == null) { - throw new RuntimeException("Validation result is invalid, schemas must exist for a pathToItem"); - } - JsonSchema propertySchema = schemas.entrySet().iterator().next().getKey(); - @Nullable Object propertyInstance = propertySchema.getNewInstance(value, propertyPathToItem, pathToSchemas); - properties.put(propertyName, propertyInstance); - } - FrozenMap<@Nullable Object> castProperties = new FrozenMap<>(properties); - return castProperties; - } - - public FrozenMap<@Nullable Object> validate(Map arg, SchemaConfiguration configuration) throws ValidationException { - Set> pathSet = new HashSet<>(); - List pathToItem = List.of("args[0]"); - Map castArg = castToAllowedTypes(arg, pathToItem, pathSet); - SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().build())); - PathToSchemasMap validatedPathToSchemas = new PathToSchemasMap(); - ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, new LinkedHashSet<>()); - PathToSchemasMap pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet); - return getNewInstance(castArg, validationMetadata.pathToItem(), pathToSchemasMap); - } - - @Override - public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { - if (arg == null) { - return validate((Nothing?) null, configuration); - } else if (arg instanceof Boolean) { - boolean boolArg = (Boolean) arg; - return validate(boolArg, configuration); - } else if (arg instanceof Number) { - return validate((Number) arg, configuration); - } else if (arg instanceof String) { - return validate((String) arg, configuration); - } else if (arg instanceof List) { - return validate((List) arg, 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"); - } - @Override - public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { - if (arg == null) { - return getNewInstance((Nothing?) null, pathToItem, pathToSchemas); - } else if (arg instanceof Boolean) { - boolean boolArg = (Boolean) arg; - return getNewInstance(boolArg, pathToItem, pathToSchemas); - } else if (arg instanceof Number) { - return getNewInstance((Number) arg, pathToItem, pathToSchemas); - } else if (arg instanceof String) { - return getNewInstance((String) arg, pathToItem, pathToSchemas); - } else if (arg instanceof List) { - return getNewInstance((List) arg, 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"); - } - @Override - public FruitReq1BoxedVoid validateAndBox(Nothing? arg, SchemaConfiguration configuration) throws ValidationException { - return new FruitReq1BoxedVoid(validate(arg, configuration)); - } - @Override - 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 { - return new FruitReq1BoxedNumber(validate(arg, configuration)); - } - @Override - 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 { - return new FruitReq1BoxedList(validate(arg, configuration)); - } - @Override - 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 { - if (arg == null) { - Nothing? castArg = (Nothing?) arg; - return validateAndBox(castArg, configuration); - } else if (arg instanceof Boolean booleanArg) { - boolean castArg = booleanArg; - return validateAndBox(castArg, configuration); - } else if (arg instanceof String castArg) { - return validateAndBox(castArg, configuration); - } else if (arg instanceof Number castArg) { - return validateAndBox(castArg, configuration); - } else if (arg instanceof List castArg) { - 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"); - } - } -} diff --git a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/schemas/GmFruit.kt b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/schemas/GmFruit.kt deleted file mode 100644 index 03f8f7f5180..00000000000 --- a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/schemas/GmFruit.kt +++ /dev/null @@ -1,413 +0,0 @@ -package org.openapijsonschematools.client.components.schemas; -import java.time.LocalDate; -import java.time.ZonedDateTime; -import java.util.ArrayList; -import java.util.HashSet; -import java.util.LinkedHashMap; -import java.util.LinkedHashSet; -import java.util.List; -import java.util.Map; -import java.util.Objects; -import java.util.Set; -import java.util.UUID; -import org.checkerframework.checker.nullness.qual.Nullable; -import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags; -import org.openapijsonschematools.client.configurations.SchemaConfiguration; -import org.openapijsonschematools.client.exceptions.InvalidAdditionalPropertyException; -import org.openapijsonschematools.client.exceptions.UnsetPropertyException; -import org.openapijsonschematools.client.exceptions.ValidationException; -import org.openapijsonschematools.client.schemas.GenericBuilder; -import org.openapijsonschematools.client.schemas.StringJsonSchema; -import org.openapijsonschematools.client.schemas.UnsetAddPropsSetter; -import org.openapijsonschematools.client.schemas.validation.BooleanSchemaValidator; -import org.openapijsonschematools.client.schemas.validation.FrozenList; -import org.openapijsonschematools.client.schemas.validation.FrozenMap; -import org.openapijsonschematools.client.schemas.validation.JsonSchema; -import org.openapijsonschematools.client.schemas.validation.JsonSchemaInfo; -import org.openapijsonschematools.client.schemas.validation.ListSchemaValidator; -import org.openapijsonschematools.client.schemas.validation.MapSchemaValidator; -import org.openapijsonschematools.client.schemas.validation.NullSchemaValidator; -import org.openapijsonschematools.client.schemas.validation.NumberSchemaValidator; -import org.openapijsonschematools.client.schemas.validation.PathToSchemasMap; -import org.openapijsonschematools.client.schemas.validation.PropertyEntry; -import org.openapijsonschematools.client.schemas.validation.StringSchemaValidator; -import org.openapijsonschematools.client.schemas.validation.ValidationMetadata; - -public class GmFruit { - // nest classes so all schemas and input/output classes can be public - - - public static class Color extends StringJsonSchema.StringJsonSchema1 { - private static @Nullable Color instance = null; - public static Color getInstance() { - if (instance == null) { - instance = new Color(); - } - return instance; - } - } - - - public static class GmFruitMap extends FrozenMap<@Nullable Object> { - protected GmFruitMap(FrozenMap<@Nullable Object> m) { - super(m); - } - public static final Set requiredKeys = Set.of(); - public static final Set optionalKeys = Set.of( - "color" - ); - public static GmFruitMap of(Map arg, SchemaConfiguration configuration) throws ValidationException { - return GmFruit1.getInstance().validate(arg, configuration); - } - - public String color() throws UnsetPropertyException { - String key = "color"; - throwIfKeyNotPresent(key); - @Nullable Object value = get(key); - if (!(value instanceof String)) { - throw new RuntimeException("Invalid value stored for color"); - } - return (String) value; - } - - public @Nullable Object getAdditionalProperty(String name) throws UnsetPropertyException, InvalidAdditionalPropertyException { - throwIfKeyKnown(name, requiredKeys, optionalKeys); - throwIfKeyNotPresent(name); - return get(name); - } - } - - public interface SetterForColor { - Map getInstance(); - T getBuilderAfterColor(Map instance); - - default T color(String value) { - var instance = getInstance(); - instance.put("color", value); - return getBuilderAfterColor(instance); - } - } - - public static class GmFruitMapBuilder extends UnsetAddPropsSetter implements GenericBuilder>, SetterForColor { - private final Map instance; - private static final Set knownKeys = Set.of( - "color" - ); - public Set getKnownKeys() { - return knownKeys; - } - public GmFruitMapBuilder() { - this.instance = new LinkedHashMap<>(); - } - public Map build() { - return instance; - } - public Map getInstance() { - return instance; - } - public GmFruitMapBuilder getBuilderAfterColor(Map instance) { - return this; - } - public GmFruitMapBuilder getBuilderAfterAdditionalProperty(Map instance) { - return this; - } - } - - - public sealed interface GmFruit1Boxed permits GmFruit1BoxedVoid, GmFruit1BoxedBoolean, GmFruit1BoxedNumber, GmFruit1BoxedString, GmFruit1BoxedList, GmFruit1BoxedMap { - @Nullable Object getData(); - } - - public record GmFruit1BoxedVoid(Nothing? data) implements GmFruit1Boxed { - @Override - public @Nullable Object getData() { - return data; - } - } - - public record GmFruit1BoxedBoolean(boolean data) implements GmFruit1Boxed { - @Override - public @Nullable Object getData() { - return data; - } - } - - public record GmFruit1BoxedNumber(Number data) implements GmFruit1Boxed { - @Override - public @Nullable Object getData() { - return data; - } - } - - public record GmFruit1BoxedString(String data) implements GmFruit1Boxed { - @Override - public @Nullable Object getData() { - return data; - } - } - - public record GmFruit1BoxedList(FrozenList<@Nullable Object> data) implements GmFruit1Boxed { - @Override - public @Nullable Object getData() { - return data; - } - } - - public record GmFruit1BoxedMap(GmFruitMap data) implements GmFruit1Boxed { - @Override - public @Nullable Object getData() { - return data; - } - } - - - public static class GmFruit1 extends JsonSchema implements NullSchemaValidator, BooleanSchemaValidator, NumberSchemaValidator, StringSchemaValidator, ListSchemaValidator, GmFruit1BoxedList>, MapSchemaValidator { - /* - NOTE: This class is auto generated by OpenAPI JSON Schema Generator. - Ref: https://github.com/openapi-json-schema-tools/openapi-json-schema-generator - - Do not edit the class manually. - */ - private static @Nullable GmFruit1 instance = null; - - protected GmFruit1() { - super(new JsonSchemaInfo() - .properties(Map.ofEntries( - new PropertyEntry("color", Color.class) - )) - .anyOf(List.of( - Apple.Apple1.class, - Banana.Banana1.class - )) - ); - } - - public static GmFruit1 getInstance() { - if (instance == null) { - instance = new GmFruit1(); - } - return instance; - } - - @Override - public Nothing? validate(Nothing? arg, SchemaConfiguration configuration) throws ValidationException { - Set> pathSet = new HashSet<>(); - List pathToItem = List.of("args[0]"); - Nothing? castArg = castToAllowedTypes(arg, pathToItem, pathSet); - SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().build())); - PathToSchemasMap validatedPathToSchemas = new PathToSchemasMap(); - ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, new LinkedHashSet<>()); - getPathToSchemas(this, castArg, validationMetadata, pathSet); - return castArg; - } - - @Override - public boolean validate(boolean arg, SchemaConfiguration configuration) throws ValidationException { - Set> pathSet = new HashSet<>(); - List pathToItem = List.of("args[0]"); - boolean castArg = castToAllowedTypes(arg, pathToItem, pathSet); - SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().build())); - PathToSchemasMap validatedPathToSchemas = new PathToSchemasMap(); - ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, new LinkedHashSet<>()); - getPathToSchemas(this, castArg, validationMetadata, pathSet); - return castArg; - } - - @Override - public Number validate(Number arg, SchemaConfiguration configuration) throws ValidationException { - Set> pathSet = new HashSet<>(); - List pathToItem = List.of("args[0]"); - Number castArg = castToAllowedTypes(arg, pathToItem, pathSet); - SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().build())); - PathToSchemasMap validatedPathToSchemas = new PathToSchemasMap(); - ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, new LinkedHashSet<>()); - getPathToSchemas(this, castArg, validationMetadata, pathSet); - return castArg; - } - - public int validate(int arg, SchemaConfiguration configuration) throws ValidationException { - return (int) validate((Number) arg, configuration); - } - - public long validate(long arg, SchemaConfiguration configuration) throws ValidationException { - return (long) validate((Number) arg, configuration); - } - - public float validate(float arg, SchemaConfiguration configuration) throws ValidationException { - return (float) validate((Number) arg, configuration); - } - - public double validate(double arg, SchemaConfiguration configuration) throws ValidationException { - return (double) validate((Number) arg, configuration); - } - - @Override - public String validate(String arg, SchemaConfiguration configuration) throws ValidationException { - Set> pathSet = new HashSet<>(); - List pathToItem = List.of("args[0]"); - String castArg = castToAllowedTypes(arg, pathToItem, pathSet); - SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().build())); - PathToSchemasMap validatedPathToSchemas = new PathToSchemasMap(); - ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, new LinkedHashSet<>()); - getPathToSchemas(this, castArg, validationMetadata, pathSet); - return castArg; - } - - public String validate(LocalDate arg, SchemaConfiguration configuration) throws ValidationException { - return validate(arg.toString(), configuration); - } - - public String validate(ZonedDateTime arg, SchemaConfiguration configuration) throws ValidationException { - return validate(arg.toString(), configuration); - } - - public String validate(UUID arg, SchemaConfiguration configuration) throws ValidationException { - return validate(arg.toString(), configuration); - } - - @Override - public FrozenList<@Nullable Object> getNewInstance(List arg, List pathToItem, PathToSchemasMap pathToSchemas) { - List<@Nullable Object> items = new ArrayList<>(); - int i = 0; - for (Object item: arg) { - List itemPathToItem = new ArrayList<>(pathToItem); - itemPathToItem.add(i); - LinkedHashMap, Nothing?> schemas = pathToSchemas.get(itemPathToItem); - if (schemas == null) { - throw new RuntimeException("Validation result is invalid, schemas must exist for a pathToItem"); - } - JsonSchema itemSchema = schemas.entrySet().iterator().next().getKey(); - @Nullable Object itemInstance = itemSchema.getNewInstance(item, itemPathToItem, pathToSchemas); - items.add(itemInstance); - i += 1; - } - FrozenList<@Nullable Object> newInstanceItems = new FrozenList<>(items); - return newInstanceItems; - } - - 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); - SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().build())); - ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, new PathToSchemasMap(), new LinkedHashSet<>()); - PathToSchemasMap pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet); - return getNewInstance(castArg, validationMetadata.pathToItem(), pathToSchemasMap); - } - - @Override - 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 RuntimeException("Invalid non-string key value"); - } - String propertyName = (String) entryKey; - List propertyPathToItem = new ArrayList<>(pathToItem); - propertyPathToItem.add(propertyName); - Object value = entry.getValue(); - LinkedHashMap, Nothing?> schemas = pathToSchemas.get(propertyPathToItem); - if (schemas == null) { - throw new RuntimeException("Validation result is invalid, schemas must exist for a pathToItem"); - } - JsonSchema propertySchema = schemas.entrySet().iterator().next().getKey(); - @Nullable Object propertyInstance = propertySchema.getNewInstance(value, propertyPathToItem, pathToSchemas); - properties.put(propertyName, propertyInstance); - } - FrozenMap<@Nullable Object> castProperties = new FrozenMap<>(properties); - return new GmFruitMap(castProperties); - } - - 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); - SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().build())); - PathToSchemasMap validatedPathToSchemas = new PathToSchemasMap(); - ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, new LinkedHashSet<>()); - PathToSchemasMap pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet); - return getNewInstance(castArg, validationMetadata.pathToItem(), pathToSchemasMap); - } - - @Override - public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { - if (arg == null) { - return validate((Nothing?) null, configuration); - } else if (arg instanceof Boolean) { - boolean boolArg = (Boolean) arg; - return validate(boolArg, configuration); - } else if (arg instanceof Number) { - return validate((Number) arg, configuration); - } else if (arg instanceof String) { - return validate((String) arg, configuration); - } else if (arg instanceof List) { - return validate((List) arg, 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"); - } - @Override - public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { - if (arg == null) { - return getNewInstance((Nothing?) null, pathToItem, pathToSchemas); - } else if (arg instanceof Boolean) { - boolean boolArg = (Boolean) arg; - return getNewInstance(boolArg, pathToItem, pathToSchemas); - } else if (arg instanceof Number) { - return getNewInstance((Number) arg, pathToItem, pathToSchemas); - } else if (arg instanceof String) { - return getNewInstance((String) arg, pathToItem, pathToSchemas); - } else if (arg instanceof List) { - return getNewInstance((List) arg, 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"); - } - @Override - public GmFruit1BoxedVoid validateAndBox(Nothing? arg, SchemaConfiguration configuration) throws ValidationException { - return new GmFruit1BoxedVoid(validate(arg, configuration)); - } - @Override - 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 { - return new GmFruit1BoxedNumber(validate(arg, configuration)); - } - @Override - 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 { - return new GmFruit1BoxedList(validate(arg, configuration)); - } - @Override - 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 { - if (arg == null) { - Nothing? castArg = (Nothing?) arg; - return validateAndBox(castArg, configuration); - } else if (arg instanceof Boolean booleanArg) { - boolean castArg = booleanArg; - return validateAndBox(castArg, configuration); - } else if (arg instanceof String castArg) { - return validateAndBox(castArg, configuration); - } else if (arg instanceof Number castArg) { - return validateAndBox(castArg, configuration); - } else if (arg instanceof List castArg) { - 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"); - } - } -} diff --git a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/schemas/GrandparentAnimal.kt b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/schemas/GrandparentAnimal.kt deleted file mode 100644 index 030b6a18914..00000000000 --- a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/schemas/GrandparentAnimal.kt +++ /dev/null @@ -1,217 +0,0 @@ -package org.openapijsonschematools.client.components.schemas; -import java.util.ArrayList; -import java.util.HashSet; -import java.util.LinkedHashMap; -import java.util.LinkedHashSet; -import java.util.List; -import java.util.Map; -import java.util.Objects; -import java.util.Set; -import org.checkerframework.checker.nullness.qual.Nullable; -import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags; -import org.openapijsonschematools.client.configurations.SchemaConfiguration; -import org.openapijsonschematools.client.exceptions.InvalidAdditionalPropertyException; -import org.openapijsonschematools.client.exceptions.UnsetPropertyException; -import org.openapijsonschematools.client.exceptions.ValidationException; -import org.openapijsonschematools.client.schemas.GenericBuilder; -import org.openapijsonschematools.client.schemas.StringJsonSchema; -import org.openapijsonschematools.client.schemas.UnsetAddPropsSetter; -import org.openapijsonschematools.client.schemas.validation.FrozenMap; -import org.openapijsonschematools.client.schemas.validation.JsonSchema; -import org.openapijsonschematools.client.schemas.validation.JsonSchemaInfo; -import org.openapijsonschematools.client.schemas.validation.MapSchemaValidator; -import org.openapijsonschematools.client.schemas.validation.PathToSchemasMap; -import org.openapijsonschematools.client.schemas.validation.PropertyEntry; -import org.openapijsonschematools.client.schemas.validation.ValidationMetadata; - -public class GrandparentAnimal { - // nest classes so all schemas and input/output classes can be public - - - public static class PetType extends StringJsonSchema.StringJsonSchema1 { - private static @Nullable PetType instance = null; - public static PetType getInstance() { - if (instance == null) { - instance = new PetType(); - } - return instance; - } - } - - - public static class GrandparentAnimalMap extends FrozenMap<@Nullable Object> { - protected GrandparentAnimalMap(FrozenMap<@Nullable Object> m) { - super(m); - } - public static final Set requiredKeys = Set.of( - "pet_type" - ); - public static final Set optionalKeys = Set.of(); - public static GrandparentAnimalMap of(Map arg, SchemaConfiguration configuration) throws ValidationException { - return GrandparentAnimal1.getInstance().validate(arg, configuration); - } - - public String pet_type() { - @Nullable Object value = get("pet_type"); - if (!(value instanceof String)) { - throw new RuntimeException("Invalid value stored for pet_type"); - } - return (String) value; - } - - public @Nullable Object getAdditionalProperty(String name) throws UnsetPropertyException, InvalidAdditionalPropertyException { - throwIfKeyKnown(name, requiredKeys, optionalKeys); - throwIfKeyNotPresent(name); - return get(name); - } - } - - public interface SetterForPetType { - Map getInstance(); - T getBuilderAfterPetType(Map instance); - - default T pet_type(String value) { - var instance = getInstance(); - instance.put("pet_type", value); - return getBuilderAfterPetType(instance); - } - } - - public static class GrandparentAnimalMap0Builder extends UnsetAddPropsSetter implements GenericBuilder> { - private final Map instance; - private static final Set knownKeys = Set.of( - "pet_type" - ); - public Set getKnownKeys() { - return knownKeys; - } - public GrandparentAnimalMap0Builder(Map instance) { - this.instance = instance; - } - public Map build() { - return instance; - } - public Map getInstance() { - return instance; - } - public GrandparentAnimalMap0Builder getBuilderAfterAdditionalProperty(Map instance) { - return this; - } - } - - public static class GrandparentAnimalMapBuilder implements SetterForPetType { - private final Map instance; - public GrandparentAnimalMapBuilder() { - this.instance = new LinkedHashMap<>(); - } - public Map getInstance() { - return instance; - } - public GrandparentAnimalMap0Builder getBuilderAfterPetType(Map instance) { - return new GrandparentAnimalMap0Builder(instance); - } - } - - - public sealed interface GrandparentAnimal1Boxed permits GrandparentAnimal1BoxedMap { - @Nullable Object getData(); - } - - public record GrandparentAnimal1BoxedMap(GrandparentAnimalMap data) implements GrandparentAnimal1Boxed { - @Override - public @Nullable Object getData() { - return data; - } - } - - - public static class GrandparentAnimal1 extends JsonSchema implements MapSchemaValidator { - /* - NOTE: This class is auto generated by OpenAPI JSON Schema Generator. - Ref: https://github.com/openapi-json-schema-tools/openapi-json-schema-generator - - Do not edit the class manually. - */ - private static @Nullable GrandparentAnimal1 instance = null; - - protected GrandparentAnimal1() { - super(new JsonSchemaInfo() - .type(Set.of(Map.class)) - .properties(Map.ofEntries( - new PropertyEntry("pet_type", PetType.class) - )) - .required(Set.of( - "pet_type" - )) - ); - } - - public static GrandparentAnimal1 getInstance() { - if (instance == null) { - instance = new GrandparentAnimal1(); - } - return instance; - } - - 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 RuntimeException("Invalid non-string key value"); - } - String propertyName = (String) entryKey; - List propertyPathToItem = new ArrayList<>(pathToItem); - propertyPathToItem.add(propertyName); - Object value = entry.getValue(); - LinkedHashMap, Nothing?> schemas = pathToSchemas.get(propertyPathToItem); - if (schemas == null) { - throw new RuntimeException("Validation result is invalid, schemas must exist for a pathToItem"); - } - JsonSchema propertySchema = schemas.entrySet().iterator().next().getKey(); - @Nullable Object propertyInstance = propertySchema.getNewInstance(value, propertyPathToItem, pathToSchemas); - properties.put(propertyName, propertyInstance); - } - FrozenMap<@Nullable Object> castProperties = new FrozenMap<>(properties); - return new GrandparentAnimalMap(castProperties); - } - - 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); - SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().build())); - ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, new PathToSchemasMap(), new LinkedHashSet<>()); - PathToSchemasMap pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet); - return getNewInstance(castArg, validationMetadata.pathToItem(), pathToSchemasMap); - } - - - @Override - public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws 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"); - } - @Override - public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { - if (arg instanceof Map) { - return getNewInstance((Map) arg, pathToItem, pathToSchemas); - } - 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 { - return new GrandparentAnimal1BoxedMap(validate(arg, configuration)); - } - @Override - public GrandparentAnimal1Boxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { - 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"); - } - } - -} diff --git a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/schemas/HasOnlyReadOnly.kt b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/schemas/HasOnlyReadOnly.kt deleted file mode 100644 index 6c556c75e4e..00000000000 --- a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/schemas/HasOnlyReadOnly.kt +++ /dev/null @@ -1,244 +0,0 @@ -package org.openapijsonschematools.client.components.schemas; -import java.util.ArrayList; -import java.util.HashSet; -import java.util.LinkedHashMap; -import java.util.LinkedHashSet; -import java.util.List; -import java.util.Map; -import java.util.Objects; -import java.util.Set; -import org.checkerframework.checker.nullness.qual.Nullable; -import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags; -import org.openapijsonschematools.client.configurations.SchemaConfiguration; -import org.openapijsonschematools.client.exceptions.InvalidAdditionalPropertyException; -import org.openapijsonschematools.client.exceptions.UnsetPropertyException; -import org.openapijsonschematools.client.exceptions.ValidationException; -import org.openapijsonschematools.client.schemas.GenericBuilder; -import org.openapijsonschematools.client.schemas.StringJsonSchema; -import org.openapijsonschematools.client.schemas.UnsetAddPropsSetter; -import org.openapijsonschematools.client.schemas.validation.FrozenMap; -import org.openapijsonschematools.client.schemas.validation.JsonSchema; -import org.openapijsonschematools.client.schemas.validation.JsonSchemaInfo; -import org.openapijsonschematools.client.schemas.validation.MapSchemaValidator; -import org.openapijsonschematools.client.schemas.validation.PathToSchemasMap; -import org.openapijsonschematools.client.schemas.validation.PropertyEntry; -import org.openapijsonschematools.client.schemas.validation.ValidationMetadata; - -public class HasOnlyReadOnly { - // nest classes so all schemas and input/output classes can be public - - - public static class Bar extends StringJsonSchema.StringJsonSchema1 { - private static @Nullable Bar instance = null; - public static Bar getInstance() { - if (instance == null) { - instance = new Bar(); - } - return instance; - } - } - - - public static class Foo extends StringJsonSchema.StringJsonSchema1 { - private static @Nullable Foo instance = null; - public static Foo getInstance() { - if (instance == null) { - instance = new Foo(); - } - return instance; - } - } - - - public static class HasOnlyReadOnlyMap extends FrozenMap<@Nullable Object> { - protected HasOnlyReadOnlyMap(FrozenMap<@Nullable Object> m) { - super(m); - } - public static final Set requiredKeys = Set.of(); - public static final Set optionalKeys = Set.of( - "bar", - "foo" - ); - public static HasOnlyReadOnlyMap of(Map arg, SchemaConfiguration configuration) throws ValidationException { - return HasOnlyReadOnly1.getInstance().validate(arg, configuration); - } - - public String bar() throws UnsetPropertyException { - String key = "bar"; - throwIfKeyNotPresent(key); - @Nullable Object value = get(key); - if (!(value instanceof String)) { - throw new RuntimeException("Invalid value stored for bar"); - } - return (String) value; - } - - public String foo() throws UnsetPropertyException { - String key = "foo"; - throwIfKeyNotPresent(key); - @Nullable Object value = get(key); - if (!(value instanceof String)) { - throw new RuntimeException("Invalid value stored for foo"); - } - return (String) value; - } - - public @Nullable Object getAdditionalProperty(String name) throws UnsetPropertyException, InvalidAdditionalPropertyException { - throwIfKeyKnown(name, requiredKeys, optionalKeys); - throwIfKeyNotPresent(name); - return get(name); - } - } - - public interface SetterForBar { - Map getInstance(); - T getBuilderAfterBar(Map instance); - - default T bar(String value) { - var instance = getInstance(); - instance.put("bar", value); - return getBuilderAfterBar(instance); - } - } - - public interface SetterForFoo { - Map getInstance(); - T getBuilderAfterFoo(Map instance); - - default T foo(String value) { - var instance = getInstance(); - instance.put("foo", value); - return getBuilderAfterFoo(instance); - } - } - - public static class HasOnlyReadOnlyMapBuilder extends UnsetAddPropsSetter implements GenericBuilder>, SetterForBar, SetterForFoo { - private final Map instance; - private static final Set knownKeys = Set.of( - "bar", - "foo" - ); - public Set getKnownKeys() { - return knownKeys; - } - public HasOnlyReadOnlyMapBuilder() { - this.instance = new LinkedHashMap<>(); - } - public Map build() { - return instance; - } - public Map getInstance() { - return instance; - } - public HasOnlyReadOnlyMapBuilder getBuilderAfterBar(Map instance) { - return this; - } - public HasOnlyReadOnlyMapBuilder getBuilderAfterFoo(Map instance) { - return this; - } - public HasOnlyReadOnlyMapBuilder getBuilderAfterAdditionalProperty(Map instance) { - return this; - } - } - - - public sealed interface HasOnlyReadOnly1Boxed permits HasOnlyReadOnly1BoxedMap { - @Nullable Object getData(); - } - - public record HasOnlyReadOnly1BoxedMap(HasOnlyReadOnlyMap data) implements HasOnlyReadOnly1Boxed { - @Override - public @Nullable Object getData() { - return data; - } - } - - - public static class HasOnlyReadOnly1 extends JsonSchema implements MapSchemaValidator { - /* - NOTE: This class is auto generated by OpenAPI JSON Schema Generator. - Ref: https://github.com/openapi-json-schema-tools/openapi-json-schema-generator - - Do not edit the class manually. - */ - private static @Nullable HasOnlyReadOnly1 instance = null; - - protected HasOnlyReadOnly1() { - super(new JsonSchemaInfo() - .type(Set.of(Map.class)) - .properties(Map.ofEntries( - new PropertyEntry("bar", Bar.class), - new PropertyEntry("foo", Foo.class) - )) - ); - } - - public static HasOnlyReadOnly1 getInstance() { - if (instance == null) { - instance = new HasOnlyReadOnly1(); - } - return instance; - } - - 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 RuntimeException("Invalid non-string key value"); - } - String propertyName = (String) entryKey; - List propertyPathToItem = new ArrayList<>(pathToItem); - propertyPathToItem.add(propertyName); - Object value = entry.getValue(); - LinkedHashMap, Nothing?> schemas = pathToSchemas.get(propertyPathToItem); - if (schemas == null) { - throw new RuntimeException("Validation result is invalid, schemas must exist for a pathToItem"); - } - JsonSchema propertySchema = schemas.entrySet().iterator().next().getKey(); - @Nullable Object propertyInstance = propertySchema.getNewInstance(value, propertyPathToItem, pathToSchemas); - properties.put(propertyName, propertyInstance); - } - FrozenMap<@Nullable Object> castProperties = new FrozenMap<>(properties); - return new HasOnlyReadOnlyMap(castProperties); - } - - 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); - SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().build())); - ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, new PathToSchemasMap(), new LinkedHashSet<>()); - PathToSchemasMap pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet); - return getNewInstance(castArg, validationMetadata.pathToItem(), pathToSchemasMap); - } - - - @Override - public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws 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"); - } - @Override - public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { - if (arg instanceof Map) { - return getNewInstance((Map) arg, pathToItem, pathToSchemas); - } - 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 { - return new HasOnlyReadOnly1BoxedMap(validate(arg, configuration)); - } - @Override - public HasOnlyReadOnly1Boxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { - 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"); - } - } - -} diff --git a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/schemas/HealthCheckResult.kt b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/schemas/HealthCheckResult.kt deleted file mode 100644 index bdcfe505d2e..00000000000 --- a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/schemas/HealthCheckResult.kt +++ /dev/null @@ -1,303 +0,0 @@ -package org.openapijsonschematools.client.components.schemas; -import java.util.ArrayList; -import java.util.HashSet; -import java.util.LinkedHashMap; -import java.util.LinkedHashSet; -import java.util.List; -import java.util.Map; -import java.util.Objects; -import java.util.Set; -import org.checkerframework.checker.nullness.qual.Nullable; -import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags; -import org.openapijsonschematools.client.configurations.SchemaConfiguration; -import org.openapijsonschematools.client.exceptions.InvalidAdditionalPropertyException; -import org.openapijsonschematools.client.exceptions.UnsetPropertyException; -import org.openapijsonschematools.client.exceptions.ValidationException; -import org.openapijsonschematools.client.schemas.GenericBuilder; -import org.openapijsonschematools.client.schemas.UnsetAddPropsSetter; -import org.openapijsonschematools.client.schemas.validation.FrozenMap; -import org.openapijsonschematools.client.schemas.validation.JsonSchema; -import org.openapijsonschematools.client.schemas.validation.JsonSchemaInfo; -import org.openapijsonschematools.client.schemas.validation.MapSchemaValidator; -import org.openapijsonschematools.client.schemas.validation.NullSchemaValidator; -import org.openapijsonschematools.client.schemas.validation.PathToSchemasMap; -import org.openapijsonschematools.client.schemas.validation.PropertyEntry; -import org.openapijsonschematools.client.schemas.validation.StringSchemaValidator; -import org.openapijsonschematools.client.schemas.validation.ValidationMetadata; - -public class HealthCheckResult { - // nest classes so all schemas and input/output classes can be public - - - public sealed interface NullableMessageBoxed permits NullableMessageBoxedNothing?, NullableMessageBoxedString { - @Nullable Object getData(); - } - - public record NullableMessageBoxedVoid(Nothing? data) implements NullableMessageBoxed { - @Override - public @Nullable Object getData() { - return data; - } - } - - public record NullableMessageBoxedString(String data) implements NullableMessageBoxed { - @Override - public @Nullable Object getData() { - return data; - } - } - - - - public static class NullableMessage extends JsonSchema implements NullSchemaValidator, StringSchemaValidator { - private static @Nullable NullableMessage instance = null; - - protected NullableMessage() { - super(new JsonSchemaInfo() - .type(Set.of( - Nothing?.class, - String.class - )) - ); - } - - public static NullableMessage getInstance() { - if (instance == null) { - instance = new NullableMessage(); - } - return instance; - } - - @Override - public Nothing? validate(Nothing? arg, SchemaConfiguration configuration) throws ValidationException { - Set> pathSet = new HashSet<>(); - List pathToItem = List.of("args[0"); - Nothing? castArg = castToAllowedTypes(arg, pathToItem, pathSet); - SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().build())); - ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, new PathToSchemasMap(), new LinkedHashSet<>()); - getPathToSchemas(this, castArg, validationMetadata, pathSet); - return castArg; - } - - @Override - public String validate(String arg, SchemaConfiguration configuration) throws ValidationException { - Set> pathSet = new HashSet<>(); - List pathToItem = List.of("args[0"); - String castArg = castToAllowedTypes(arg, pathToItem, pathSet); - SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().build())); - ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, new PathToSchemasMap(), new LinkedHashSet<>()); - getPathToSchemas(this, castArg, validationMetadata, pathSet); - return castArg; - } - - @Override - public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { - if (arg == null) { - return validate((Nothing?) 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"); - } - @Override - public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { - if (arg == null) { - return getNewInstance((Nothing?) 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"); - } - @Override - public NullableMessageBoxedVoid validateAndBox(Nothing? arg, SchemaConfiguration configuration) throws ValidationException { - return new NullableMessageBoxedVoid(validate(arg, configuration)); - } - @Override - 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 { - if (arg == null) { - Nothing? castArg = (Nothing?) 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"); - } - } - - public static class HealthCheckResultMap extends FrozenMap<@Nullable Object> { - protected HealthCheckResultMap(FrozenMap<@Nullable Object> m) { - super(m); - } - public static final Set requiredKeys = Set.of(); - public static final Set optionalKeys = Set.of( - "NullableMessage" - ); - public static HealthCheckResultMap of(Map arg, SchemaConfiguration configuration) throws ValidationException { - return HealthCheckResult1.getInstance().validate(arg, configuration); - } - - public @Nullable String NullableMessage() throws UnsetPropertyException { - String key = "NullableMessage"; - throwIfKeyNotPresent(key); - @Nullable Object value = get(key); - if (!(value == null || value instanceof String)) { - throw new RuntimeException("Invalid value stored for NullableMessage"); - } - return (@Nullable String) value; - } - - public @Nullable Object getAdditionalProperty(String name) throws UnsetPropertyException, InvalidAdditionalPropertyException { - throwIfKeyKnown(name, requiredKeys, optionalKeys); - throwIfKeyNotPresent(name); - return get(name); - } - } - - public interface SetterForNullableMessage { - Map getInstance(); - T getBuilderAfterNullableMessage(Map instance); - - default T NullableMessage(Nothing? value) { - var instance = getInstance(); - instance.put("NullableMessage", null); - return getBuilderAfterNullableMessage(instance); - } - - default T NullableMessage(String value) { - var instance = getInstance(); - instance.put("NullableMessage", value); - return getBuilderAfterNullableMessage(instance); - } - } - - public static class HealthCheckResultMapBuilder extends UnsetAddPropsSetter implements GenericBuilder>, SetterForNullableMessage { - private final Map instance; - private static final Set knownKeys = Set.of( - "NullableMessage" - ); - public Set getKnownKeys() { - return knownKeys; - } - public HealthCheckResultMapBuilder() { - this.instance = new LinkedHashMap<>(); - } - public Map build() { - return instance; - } - public Map getInstance() { - return instance; - } - public HealthCheckResultMapBuilder getBuilderAfterNullableMessage(Map instance) { - return this; - } - public HealthCheckResultMapBuilder getBuilderAfterAdditionalProperty(Map instance) { - return this; - } - } - - - public sealed interface HealthCheckResult1Boxed permits HealthCheckResult1BoxedMap { - @Nullable Object getData(); - } - - public record HealthCheckResult1BoxedMap(HealthCheckResultMap data) implements HealthCheckResult1Boxed { - @Override - public @Nullable Object getData() { - return data; - } - } - - - public static class HealthCheckResult1 extends JsonSchema implements MapSchemaValidator { - /* - NOTE: This class is auto generated by OpenAPI JSON Schema Generator. - Ref: https://github.com/openapi-json-schema-tools/openapi-json-schema-generator - - Do not edit the class manually. - - Just a string to inform instance is up and running. Make it nullable in hope to get it as pointer in generated model. - */ - private static @Nullable HealthCheckResult1 instance = null; - - protected HealthCheckResult1() { - super(new JsonSchemaInfo() - .type(Set.of(Map.class)) - .properties(Map.ofEntries( - new PropertyEntry("NullableMessage", NullableMessage.class) - )) - ); - } - - public static HealthCheckResult1 getInstance() { - if (instance == null) { - instance = new HealthCheckResult1(); - } - return instance; - } - - 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 RuntimeException("Invalid non-string key value"); - } - String propertyName = (String) entryKey; - List propertyPathToItem = new ArrayList<>(pathToItem); - propertyPathToItem.add(propertyName); - Object value = entry.getValue(); - LinkedHashMap, Nothing?> schemas = pathToSchemas.get(propertyPathToItem); - if (schemas == null) { - throw new RuntimeException("Validation result is invalid, schemas must exist for a pathToItem"); - } - JsonSchema propertySchema = schemas.entrySet().iterator().next().getKey(); - @Nullable Object propertyInstance = propertySchema.getNewInstance(value, propertyPathToItem, pathToSchemas); - properties.put(propertyName, propertyInstance); - } - FrozenMap<@Nullable Object> castProperties = new FrozenMap<>(properties); - return new HealthCheckResultMap(castProperties); - } - - 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); - SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().build())); - ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, new PathToSchemasMap(), new LinkedHashSet<>()); - PathToSchemasMap pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet); - return getNewInstance(castArg, validationMetadata.pathToItem(), pathToSchemasMap); - } - - - @Override - public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws 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"); - } - @Override - public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { - if (arg instanceof Map) { - return getNewInstance((Map) arg, pathToItem, pathToSchemas); - } - 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 { - return new HealthCheckResult1BoxedMap(validate(arg, configuration)); - } - @Override - public HealthCheckResult1Boxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { - 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"); - } - } - -} diff --git a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/schemas/IntegerEnum.kt b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/schemas/IntegerEnum.kt deleted file mode 100644 index bb3b5f6f94f..00000000000 --- a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/schemas/IntegerEnum.kt +++ /dev/null @@ -1,206 +0,0 @@ -package org.openapijsonschematools.client.components.schemas; -import java.math.BigDecimal; -import java.util.HashSet; -import java.util.LinkedHashSet; -import java.util.List; -import java.util.Objects; -import java.util.Set; -import org.checkerframework.checker.nullness.qual.Nullable; -import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags; -import org.openapijsonschematools.client.configurations.SchemaConfiguration; -import org.openapijsonschematools.client.exceptions.ValidationException; -import org.openapijsonschematools.client.schemas.SetMaker; -import org.openapijsonschematools.client.schemas.validation.DoubleEnumValidator; -import org.openapijsonschematools.client.schemas.validation.DoubleValueMethod; -import org.openapijsonschematools.client.schemas.validation.FloatEnumValidator; -import org.openapijsonschematools.client.schemas.validation.FloatValueMethod; -import org.openapijsonschematools.client.schemas.validation.IntegerEnumValidator; -import org.openapijsonschematools.client.schemas.validation.IntegerValueMethod; -import org.openapijsonschematools.client.schemas.validation.JsonSchema; -import org.openapijsonschematools.client.schemas.validation.JsonSchemaInfo; -import org.openapijsonschematools.client.schemas.validation.LongEnumValidator; -import org.openapijsonschematools.client.schemas.validation.LongValueMethod; -import org.openapijsonschematools.client.schemas.validation.NumberSchemaValidator; -import org.openapijsonschematools.client.schemas.validation.PathToSchemasMap; -import org.openapijsonschematools.client.schemas.validation.ValidationMetadata; - -public class IntegerEnum { - // nest classes so all schemas and input/output classes can be public - - public enum IntegerIntegerEnumEnums implements IntegerValueMethod { - POSITIVE_0(0), - POSITIVE_1(1), - POSITIVE_2(2); - private final int value; - - IntegerIntegerEnumEnums(int value) { - this.value = value; - } - public int value() { - return this.value; - } - } - - public enum LongIntegerEnumEnums implements LongValueMethod { - POSITIVE_0(0L), - POSITIVE_1(1L), - POSITIVE_2(2L); - private final long value; - - LongIntegerEnumEnums(long value) { - this.value = value; - } - public long value() { - return this.value; - } - } - - public enum FloatIntegerEnumEnums implements FloatValueMethod { - POSITIVE_0(0.0f), - POSITIVE_1(1.0f), - POSITIVE_2(2.0f); - private final float value; - - FloatIntegerEnumEnums(float value) { - this.value = value; - } - public float value() { - return this.value; - } - } - - public enum DoubleIntegerEnumEnums implements DoubleValueMethod { - POSITIVE_0(0.0d), - POSITIVE_1(1.0d), - POSITIVE_2(2.0d); - private final double value; - - DoubleIntegerEnumEnums(double value) { - this.value = value; - } - public double value() { - return this.value; - } - } - - - public sealed interface IntegerEnum1Boxed permits IntegerEnum1BoxedNumber { - @Nullable Object getData(); - } - - public record IntegerEnum1BoxedNumber(Number data) implements IntegerEnum1Boxed { - @Override - public @Nullable Object getData() { - return data; - } - } - - - - public static class IntegerEnum1 extends JsonSchema implements IntegerEnumValidator, LongEnumValidator, FloatEnumValidator, DoubleEnumValidator, NumberSchemaValidator { - /* - NOTE: This class is auto generated by OpenAPI JSON Schema Generator. - Ref: https://github.com/openapi-json-schema-tools/openapi-json-schema-generator - - Do not edit the class manually. - */ - private static @Nullable IntegerEnum1 instance = null; - - protected IntegerEnum1() { - super(new JsonSchemaInfo() - .type(Set.of( - Integer.class, - Long.class, - Float.class, - Double.class - )) - .format("int") - .enumValues(SetMaker.makeSet( - new BigDecimal("0"), - new BigDecimal("1"), - new BigDecimal("2") - )) - ); - } - - public static IntegerEnum1 getInstance() { - if (instance == null) { - instance = new IntegerEnum1(); - } - return instance; - } - - @Override - public Number validate(Number arg, SchemaConfiguration configuration) throws ValidationException { - Set> pathSet = new HashSet<>(); - List pathToItem = List.of("args[0"); - Number castArg = castToAllowedTypes(arg, pathToItem, pathSet); - SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().build())); - ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, new PathToSchemasMap(), new LinkedHashSet<>()); - getPathToSchemas(this, castArg, validationMetadata, pathSet); - return castArg; - } - - public int validate(int arg, SchemaConfiguration configuration) throws ValidationException { - return (int) validate((Number) arg, configuration); - } - - public float validate(float arg, SchemaConfiguration configuration) throws ValidationException { - return (float) validate((Number) arg, configuration); - } - - public long validate(long arg, SchemaConfiguration configuration) throws ValidationException { - return (long) validate((Number) arg, configuration); - } - - public double validate(double arg, SchemaConfiguration configuration) throws ValidationException { - return (double) validate((Number) arg, configuration); - } - - @Override - 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 ValidationException { - return (long) validate((Number) arg.value(), configuration); - } - - @Override - 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 ValidationException { - return (double) validate((Number) arg.value(), configuration); - } - - @Override - public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws 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"); - } - @Override - public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { - 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"); - } - @Override - 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 { - 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"); - } - } -} diff --git a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/schemas/IntegerEnumBig.kt b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/schemas/IntegerEnumBig.kt deleted file mode 100644 index 01e7b0c0d0b..00000000000 --- a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/schemas/IntegerEnumBig.kt +++ /dev/null @@ -1,206 +0,0 @@ -package org.openapijsonschematools.client.components.schemas; -import java.math.BigDecimal; -import java.util.HashSet; -import java.util.LinkedHashSet; -import java.util.List; -import java.util.Objects; -import java.util.Set; -import org.checkerframework.checker.nullness.qual.Nullable; -import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags; -import org.openapijsonschematools.client.configurations.SchemaConfiguration; -import org.openapijsonschematools.client.exceptions.ValidationException; -import org.openapijsonschematools.client.schemas.SetMaker; -import org.openapijsonschematools.client.schemas.validation.DoubleEnumValidator; -import org.openapijsonschematools.client.schemas.validation.DoubleValueMethod; -import org.openapijsonschematools.client.schemas.validation.FloatEnumValidator; -import org.openapijsonschematools.client.schemas.validation.FloatValueMethod; -import org.openapijsonschematools.client.schemas.validation.IntegerEnumValidator; -import org.openapijsonschematools.client.schemas.validation.IntegerValueMethod; -import org.openapijsonschematools.client.schemas.validation.JsonSchema; -import org.openapijsonschematools.client.schemas.validation.JsonSchemaInfo; -import org.openapijsonschematools.client.schemas.validation.LongEnumValidator; -import org.openapijsonschematools.client.schemas.validation.LongValueMethod; -import org.openapijsonschematools.client.schemas.validation.NumberSchemaValidator; -import org.openapijsonschematools.client.schemas.validation.PathToSchemasMap; -import org.openapijsonschematools.client.schemas.validation.ValidationMetadata; - -public class IntegerEnumBig { - // nest classes so all schemas and input/output classes can be public - - public enum IntegerIntegerEnumBigEnums implements IntegerValueMethod { - POSITIVE_10(10), - POSITIVE_11(11), - POSITIVE_12(12); - private final int value; - - IntegerIntegerEnumBigEnums(int value) { - this.value = value; - } - public int value() { - return this.value; - } - } - - public enum LongIntegerEnumBigEnums implements LongValueMethod { - POSITIVE_10(10L), - POSITIVE_11(11L), - POSITIVE_12(12L); - private final long value; - - LongIntegerEnumBigEnums(long value) { - this.value = value; - } - public long value() { - return this.value; - } - } - - public enum FloatIntegerEnumBigEnums implements FloatValueMethod { - POSITIVE_10(10.0f), - POSITIVE_11(11.0f), - POSITIVE_12(12.0f); - private final float value; - - FloatIntegerEnumBigEnums(float value) { - this.value = value; - } - public float value() { - return this.value; - } - } - - public enum DoubleIntegerEnumBigEnums implements DoubleValueMethod { - POSITIVE_10(10.0d), - POSITIVE_11(11.0d), - POSITIVE_12(12.0d); - private final double value; - - DoubleIntegerEnumBigEnums(double value) { - this.value = value; - } - public double value() { - return this.value; - } - } - - - public sealed interface IntegerEnumBig1Boxed permits IntegerEnumBig1BoxedNumber { - @Nullable Object getData(); - } - - public record IntegerEnumBig1BoxedNumber(Number data) implements IntegerEnumBig1Boxed { - @Override - public @Nullable Object getData() { - return data; - } - } - - - - public static class IntegerEnumBig1 extends JsonSchema implements IntegerEnumValidator, LongEnumValidator, FloatEnumValidator, DoubleEnumValidator, NumberSchemaValidator { - /* - NOTE: This class is auto generated by OpenAPI JSON Schema Generator. - Ref: https://github.com/openapi-json-schema-tools/openapi-json-schema-generator - - Do not edit the class manually. - */ - private static @Nullable IntegerEnumBig1 instance = null; - - protected IntegerEnumBig1() { - super(new JsonSchemaInfo() - .type(Set.of( - Integer.class, - Long.class, - Float.class, - Double.class - )) - .format("int") - .enumValues(SetMaker.makeSet( - new BigDecimal("10"), - new BigDecimal("11"), - new BigDecimal("12") - )) - ); - } - - public static IntegerEnumBig1 getInstance() { - if (instance == null) { - instance = new IntegerEnumBig1(); - } - return instance; - } - - @Override - public Number validate(Number arg, SchemaConfiguration configuration) throws ValidationException { - Set> pathSet = new HashSet<>(); - List pathToItem = List.of("args[0"); - Number castArg = castToAllowedTypes(arg, pathToItem, pathSet); - SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().build())); - ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, new PathToSchemasMap(), new LinkedHashSet<>()); - getPathToSchemas(this, castArg, validationMetadata, pathSet); - return castArg; - } - - public int validate(int arg, SchemaConfiguration configuration) throws ValidationException { - return (int) validate((Number) arg, configuration); - } - - public float validate(float arg, SchemaConfiguration configuration) throws ValidationException { - return (float) validate((Number) arg, configuration); - } - - public long validate(long arg, SchemaConfiguration configuration) throws ValidationException { - return (long) validate((Number) arg, configuration); - } - - public double validate(double arg, SchemaConfiguration configuration) throws ValidationException { - return (double) validate((Number) arg, configuration); - } - - @Override - 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 ValidationException { - return (long) validate((Number) arg.value(), configuration); - } - - @Override - 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 ValidationException { - return (double) validate((Number) arg.value(), configuration); - } - - @Override - public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws 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"); - } - @Override - public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { - 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"); - } - @Override - 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 { - 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"); - } - } -} diff --git a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/schemas/IntegerEnumOneValue.kt b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/schemas/IntegerEnumOneValue.kt deleted file mode 100644 index 68282e3aab5..00000000000 --- a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/schemas/IntegerEnumOneValue.kt +++ /dev/null @@ -1,196 +0,0 @@ -package org.openapijsonschematools.client.components.schemas; -import java.math.BigDecimal; -import java.util.HashSet; -import java.util.LinkedHashSet; -import java.util.List; -import java.util.Objects; -import java.util.Set; -import org.checkerframework.checker.nullness.qual.Nullable; -import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags; -import org.openapijsonschematools.client.configurations.SchemaConfiguration; -import org.openapijsonschematools.client.exceptions.ValidationException; -import org.openapijsonschematools.client.schemas.SetMaker; -import org.openapijsonschematools.client.schemas.validation.DoubleEnumValidator; -import org.openapijsonschematools.client.schemas.validation.DoubleValueMethod; -import org.openapijsonschematools.client.schemas.validation.FloatEnumValidator; -import org.openapijsonschematools.client.schemas.validation.FloatValueMethod; -import org.openapijsonschematools.client.schemas.validation.IntegerEnumValidator; -import org.openapijsonschematools.client.schemas.validation.IntegerValueMethod; -import org.openapijsonschematools.client.schemas.validation.JsonSchema; -import org.openapijsonschematools.client.schemas.validation.JsonSchemaInfo; -import org.openapijsonschematools.client.schemas.validation.LongEnumValidator; -import org.openapijsonschematools.client.schemas.validation.LongValueMethod; -import org.openapijsonschematools.client.schemas.validation.NumberSchemaValidator; -import org.openapijsonschematools.client.schemas.validation.PathToSchemasMap; -import org.openapijsonschematools.client.schemas.validation.ValidationMetadata; - -public class IntegerEnumOneValue { - // nest classes so all schemas and input/output classes can be public - - public enum IntegerIntegerEnumOneValueEnums implements IntegerValueMethod { - POSITIVE_0(0); - private final int value; - - IntegerIntegerEnumOneValueEnums(int value) { - this.value = value; - } - public int value() { - return this.value; - } - } - - public enum LongIntegerEnumOneValueEnums implements LongValueMethod { - POSITIVE_0(0L); - private final long value; - - LongIntegerEnumOneValueEnums(long value) { - this.value = value; - } - public long value() { - return this.value; - } - } - - public enum FloatIntegerEnumOneValueEnums implements FloatValueMethod { - POSITIVE_0(0.0f); - private final float value; - - FloatIntegerEnumOneValueEnums(float value) { - this.value = value; - } - public float value() { - return this.value; - } - } - - public enum DoubleIntegerEnumOneValueEnums implements DoubleValueMethod { - POSITIVE_0(0.0d); - private final double value; - - DoubleIntegerEnumOneValueEnums(double value) { - this.value = value; - } - public double value() { - return this.value; - } - } - - - public sealed interface IntegerEnumOneValue1Boxed permits IntegerEnumOneValue1BoxedNumber { - @Nullable Object getData(); - } - - public record IntegerEnumOneValue1BoxedNumber(Number data) implements IntegerEnumOneValue1Boxed { - @Override - public @Nullable Object getData() { - return data; - } - } - - - - public static class IntegerEnumOneValue1 extends JsonSchema implements IntegerEnumValidator, LongEnumValidator, FloatEnumValidator, DoubleEnumValidator, NumberSchemaValidator { - /* - NOTE: This class is auto generated by OpenAPI JSON Schema Generator. - Ref: https://github.com/openapi-json-schema-tools/openapi-json-schema-generator - - Do not edit the class manually. - */ - private static @Nullable IntegerEnumOneValue1 instance = null; - - protected IntegerEnumOneValue1() { - super(new JsonSchemaInfo() - .type(Set.of( - Integer.class, - Long.class, - Float.class, - Double.class - )) - .format("int") - .enumValues(SetMaker.makeSet( - new BigDecimal("0") - )) - ); - } - - public static IntegerEnumOneValue1 getInstance() { - if (instance == null) { - instance = new IntegerEnumOneValue1(); - } - return instance; - } - - @Override - public Number validate(Number arg, SchemaConfiguration configuration) throws ValidationException { - Set> pathSet = new HashSet<>(); - List pathToItem = List.of("args[0"); - Number castArg = castToAllowedTypes(arg, pathToItem, pathSet); - SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().build())); - ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, new PathToSchemasMap(), new LinkedHashSet<>()); - getPathToSchemas(this, castArg, validationMetadata, pathSet); - return castArg; - } - - public int validate(int arg, SchemaConfiguration configuration) throws ValidationException { - return (int) validate((Number) arg, configuration); - } - - public float validate(float arg, SchemaConfiguration configuration) throws ValidationException { - return (float) validate((Number) arg, configuration); - } - - public long validate(long arg, SchemaConfiguration configuration) throws ValidationException { - return (long) validate((Number) arg, configuration); - } - - public double validate(double arg, SchemaConfiguration configuration) throws ValidationException { - return (double) validate((Number) arg, configuration); - } - - @Override - 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 ValidationException { - return (long) validate((Number) arg.value(), configuration); - } - - @Override - 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 ValidationException { - return (double) validate((Number) arg.value(), configuration); - } - - @Override - public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws 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"); - } - @Override - public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { - 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"); - } - @Override - 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 { - 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"); - } - } -} diff --git a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/schemas/IntegerEnumWithDefaultValue.kt b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/schemas/IntegerEnumWithDefaultValue.kt deleted file mode 100644 index e65c48c3cc5..00000000000 --- a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/schemas/IntegerEnumWithDefaultValue.kt +++ /dev/null @@ -1,208 +0,0 @@ -package org.openapijsonschematools.client.components.schemas; -import java.math.BigDecimal; -import java.util.HashSet; -import java.util.LinkedHashSet; -import java.util.List; -import java.util.Objects; -import java.util.Set; -import org.checkerframework.checker.nullness.qual.Nullable; -import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags; -import org.openapijsonschematools.client.configurations.SchemaConfiguration; -import org.openapijsonschematools.client.exceptions.ValidationException; -import org.openapijsonschematools.client.schemas.SetMaker; -import org.openapijsonschematools.client.schemas.validation.DefaultValueMethod; -import org.openapijsonschematools.client.schemas.validation.DoubleEnumValidator; -import org.openapijsonschematools.client.schemas.validation.DoubleValueMethod; -import org.openapijsonschematools.client.schemas.validation.FloatEnumValidator; -import org.openapijsonschematools.client.schemas.validation.FloatValueMethod; -import org.openapijsonschematools.client.schemas.validation.IntegerEnumValidator; -import org.openapijsonschematools.client.schemas.validation.IntegerValueMethod; -import org.openapijsonschematools.client.schemas.validation.JsonSchema; -import org.openapijsonschematools.client.schemas.validation.JsonSchemaInfo; -import org.openapijsonschematools.client.schemas.validation.LongEnumValidator; -import org.openapijsonschematools.client.schemas.validation.LongValueMethod; -import org.openapijsonschematools.client.schemas.validation.NumberSchemaValidator; -import org.openapijsonschematools.client.schemas.validation.PathToSchemasMap; -import org.openapijsonschematools.client.schemas.validation.ValidationMetadata; - -public class IntegerEnumWithDefaultValue { - // nest classes so all schemas and input/output classes can be public - - public enum IntegerIntegerEnumWithDefaultValueEnums implements IntegerValueMethod { - POSITIVE_0(0), - POSITIVE_1(1), - POSITIVE_2(2); - private final int value; - - IntegerIntegerEnumWithDefaultValueEnums(int value) { - this.value = value; - } - public int value() { - return this.value; - } - } - - public enum LongIntegerEnumWithDefaultValueEnums implements LongValueMethod { - POSITIVE_0(0L), - POSITIVE_1(1L), - POSITIVE_2(2L); - private final long value; - - LongIntegerEnumWithDefaultValueEnums(long value) { - this.value = value; - } - public long value() { - return this.value; - } - } - - public enum FloatIntegerEnumWithDefaultValueEnums implements FloatValueMethod { - POSITIVE_0(0.0f), - POSITIVE_1(1.0f), - POSITIVE_2(2.0f); - private final float value; - - FloatIntegerEnumWithDefaultValueEnums(float value) { - this.value = value; - } - public float value() { - return this.value; - } - } - - public enum DoubleIntegerEnumWithDefaultValueEnums implements DoubleValueMethod { - POSITIVE_0(0.0d), - POSITIVE_1(1.0d), - POSITIVE_2(2.0d); - private final double value; - - DoubleIntegerEnumWithDefaultValueEnums(double value) { - this.value = value; - } - public double value() { - return this.value; - } - } - - - public sealed interface IntegerEnumWithDefaultValue1Boxed permits IntegerEnumWithDefaultValue1BoxedNumber { - @Nullable Object getData(); - } - - public record IntegerEnumWithDefaultValue1BoxedNumber(Number data) implements IntegerEnumWithDefaultValue1Boxed { - @Override - public @Nullable Object getData() { - return data; - } - } - - - - public static class IntegerEnumWithDefaultValue1 extends JsonSchema implements IntegerEnumValidator, LongEnumValidator, FloatEnumValidator, DoubleEnumValidator, NumberSchemaValidator { - /* - NOTE: This class is auto generated by OpenAPI JSON Schema Generator. - Ref: https://github.com/openapi-json-schema-tools/openapi-json-schema-generator - - Do not edit the class manually. - */ - private static @Nullable IntegerEnumWithDefaultValue1 instance = null; - - protected IntegerEnumWithDefaultValue1() { - super(new JsonSchemaInfo() - .type(Set.of( - Integer.class, - Long.class, - Float.class, - Double.class - )) - .format("int") - .enumValues(SetMaker.makeSet( - new BigDecimal("0"), - new BigDecimal("1"), - new BigDecimal("2") - )) - .defaultValue(0) - ); - } - - public static IntegerEnumWithDefaultValue1 getInstance() { - if (instance == null) { - instance = new IntegerEnumWithDefaultValue1(); - } - return instance; - } - - @Override - public Number validate(Number arg, SchemaConfiguration configuration) throws ValidationException { - Set> pathSet = new HashSet<>(); - List pathToItem = List.of("args[0"); - Number castArg = castToAllowedTypes(arg, pathToItem, pathSet); - SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().build())); - ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, new PathToSchemasMap(), new LinkedHashSet<>()); - getPathToSchemas(this, castArg, validationMetadata, pathSet); - return castArg; - } - - public int validate(int arg, SchemaConfiguration configuration) throws ValidationException { - return (int) validate((Number) arg, configuration); - } - - public float validate(float arg, SchemaConfiguration configuration) throws ValidationException { - return (float) validate((Number) arg, configuration); - } - - public long validate(long arg, SchemaConfiguration configuration) throws ValidationException { - return (long) validate((Number) arg, configuration); - } - - public double validate(double arg, SchemaConfiguration configuration) throws ValidationException { - return (double) validate((Number) arg, configuration); - } - - @Override - 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 ValidationException { - return (long) validate((Number) arg.value(), configuration); - } - - @Override - 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 ValidationException { - return (double) validate((Number) arg.value(), configuration); - } - - @Override - public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws 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"); - } - @Override - public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { - 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"); - } - @Override - 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 { - 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"); - } - } -} diff --git a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/schemas/IntegerMax10.kt b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/schemas/IntegerMax10.kt deleted file mode 100644 index aee3586634b..00000000000 --- a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/schemas/IntegerMax10.kt +++ /dev/null @@ -1,116 +0,0 @@ -package org.openapijsonschematools.client.components.schemas; -import java.util.HashSet; -import java.util.LinkedHashSet; -import java.util.List; -import java.util.Objects; -import java.util.Set; -import org.checkerframework.checker.nullness.qual.Nullable; -import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags; -import org.openapijsonschematools.client.configurations.SchemaConfiguration; -import org.openapijsonschematools.client.exceptions.ValidationException; -import org.openapijsonschematools.client.schemas.validation.JsonSchema; -import org.openapijsonschematools.client.schemas.validation.JsonSchemaInfo; -import org.openapijsonschematools.client.schemas.validation.NumberSchemaValidator; -import org.openapijsonschematools.client.schemas.validation.PathToSchemasMap; -import org.openapijsonschematools.client.schemas.validation.ValidationMetadata; - -public class IntegerMax10 { - // nest classes so all schemas and input/output classes can be public - - - public sealed interface IntegerMax101Boxed permits IntegerMax101BoxedNumber { - @Nullable Object getData(); - } - - public record IntegerMax101BoxedNumber(Number data) implements IntegerMax101Boxed { - @Override - public @Nullable Object getData() { - return data; - } - } - - - - public static class IntegerMax101 extends JsonSchema implements NumberSchemaValidator { - /* - NOTE: This class is auto generated by OpenAPI JSON Schema Generator. - Ref: https://github.com/openapi-json-schema-tools/openapi-json-schema-generator - - Do not edit the class manually. - */ - private static @Nullable IntegerMax101 instance = null; - - protected IntegerMax101() { - super(new JsonSchemaInfo() - .type(Set.of( - Integer.class, - Long.class, - Float.class, - Double.class - )) - .format("int64") - .maximum(10) - ); - } - - public static IntegerMax101 getInstance() { - if (instance == null) { - instance = new IntegerMax101(); - } - return instance; - } - - @Override - public Number validate(Number arg, SchemaConfiguration configuration) throws ValidationException { - Set> pathSet = new HashSet<>(); - List pathToItem = List.of("args[0"); - Number castArg = castToAllowedTypes(arg, pathToItem, pathSet); - SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().build())); - ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, new PathToSchemasMap(), new LinkedHashSet<>()); - getPathToSchemas(this, castArg, validationMetadata, pathSet); - return castArg; - } - - public int validate(int arg, SchemaConfiguration configuration) throws ValidationException { - return (int) validate((Number) arg, configuration); - } - - public float validate(float arg, SchemaConfiguration configuration) throws ValidationException { - return (float) validate((Number) arg, configuration); - } - - public long validate(long arg, SchemaConfiguration configuration) throws ValidationException { - return (long) validate((Number) arg, configuration); - } - - 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 { - 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"); - } - @Override - public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { - 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"); - } - @Override - 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 { - 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"); - } - } -} diff --git a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/schemas/IntegerMin15.kt b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/schemas/IntegerMin15.kt deleted file mode 100644 index 279eb26879c..00000000000 --- a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/schemas/IntegerMin15.kt +++ /dev/null @@ -1,116 +0,0 @@ -package org.openapijsonschematools.client.components.schemas; -import java.util.HashSet; -import java.util.LinkedHashSet; -import java.util.List; -import java.util.Objects; -import java.util.Set; -import org.checkerframework.checker.nullness.qual.Nullable; -import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags; -import org.openapijsonschematools.client.configurations.SchemaConfiguration; -import org.openapijsonschematools.client.exceptions.ValidationException; -import org.openapijsonschematools.client.schemas.validation.JsonSchema; -import org.openapijsonschematools.client.schemas.validation.JsonSchemaInfo; -import org.openapijsonschematools.client.schemas.validation.NumberSchemaValidator; -import org.openapijsonschematools.client.schemas.validation.PathToSchemasMap; -import org.openapijsonschematools.client.schemas.validation.ValidationMetadata; - -public class IntegerMin15 { - // nest classes so all schemas and input/output classes can be public - - - public sealed interface IntegerMin151Boxed permits IntegerMin151BoxedNumber { - @Nullable Object getData(); - } - - public record IntegerMin151BoxedNumber(Number data) implements IntegerMin151Boxed { - @Override - public @Nullable Object getData() { - return data; - } - } - - - - public static class IntegerMin151 extends JsonSchema implements NumberSchemaValidator { - /* - NOTE: This class is auto generated by OpenAPI JSON Schema Generator. - Ref: https://github.com/openapi-json-schema-tools/openapi-json-schema-generator - - Do not edit the class manually. - */ - private static @Nullable IntegerMin151 instance = null; - - protected IntegerMin151() { - super(new JsonSchemaInfo() - .type(Set.of( - Integer.class, - Long.class, - Float.class, - Double.class - )) - .format("int64") - .minimum(15) - ); - } - - public static IntegerMin151 getInstance() { - if (instance == null) { - instance = new IntegerMin151(); - } - return instance; - } - - @Override - public Number validate(Number arg, SchemaConfiguration configuration) throws ValidationException { - Set> pathSet = new HashSet<>(); - List pathToItem = List.of("args[0"); - Number castArg = castToAllowedTypes(arg, pathToItem, pathSet); - SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().build())); - ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, new PathToSchemasMap(), new LinkedHashSet<>()); - getPathToSchemas(this, castArg, validationMetadata, pathSet); - return castArg; - } - - public int validate(int arg, SchemaConfiguration configuration) throws ValidationException { - return (int) validate((Number) arg, configuration); - } - - public float validate(float arg, SchemaConfiguration configuration) throws ValidationException { - return (float) validate((Number) arg, configuration); - } - - public long validate(long arg, SchemaConfiguration configuration) throws ValidationException { - return (long) validate((Number) arg, configuration); - } - - 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 { - 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"); - } - @Override - public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { - 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"); - } - @Override - 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 { - 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"); - } - } -} diff --git a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/schemas/IsoscelesTriangle.kt b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/schemas/IsoscelesTriangle.kt deleted file mode 100644 index ac25aac6766..00000000000 --- a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/schemas/IsoscelesTriangle.kt +++ /dev/null @@ -1,589 +0,0 @@ -package org.openapijsonschematools.client.components.schemas; -import java.time.LocalDate; -import java.time.ZonedDateTime; -import java.util.ArrayList; -import java.util.HashSet; -import java.util.LinkedHashMap; -import java.util.LinkedHashSet; -import java.util.List; -import java.util.Map; -import java.util.Objects; -import java.util.Set; -import java.util.UUID; -import org.checkerframework.checker.nullness.qual.Nullable; -import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags; -import org.openapijsonschematools.client.configurations.SchemaConfiguration; -import org.openapijsonschematools.client.exceptions.InvalidAdditionalPropertyException; -import org.openapijsonschematools.client.exceptions.UnsetPropertyException; -import org.openapijsonschematools.client.exceptions.ValidationException; -import org.openapijsonschematools.client.schemas.GenericBuilder; -import org.openapijsonschematools.client.schemas.SetMaker; -import org.openapijsonschematools.client.schemas.UnsetAddPropsSetter; -import org.openapijsonschematools.client.schemas.validation.BooleanSchemaValidator; -import org.openapijsonschematools.client.schemas.validation.FrozenList; -import org.openapijsonschematools.client.schemas.validation.FrozenMap; -import org.openapijsonschematools.client.schemas.validation.JsonSchema; -import org.openapijsonschematools.client.schemas.validation.JsonSchemaInfo; -import org.openapijsonschematools.client.schemas.validation.ListSchemaValidator; -import org.openapijsonschematools.client.schemas.validation.MapSchemaValidator; -import org.openapijsonschematools.client.schemas.validation.NullSchemaValidator; -import org.openapijsonschematools.client.schemas.validation.NumberSchemaValidator; -import org.openapijsonschematools.client.schemas.validation.PathToSchemasMap; -import org.openapijsonschematools.client.schemas.validation.PropertyEntry; -import org.openapijsonschematools.client.schemas.validation.StringEnumValidator; -import org.openapijsonschematools.client.schemas.validation.StringSchemaValidator; -import org.openapijsonschematools.client.schemas.validation.StringValueMethod; -import org.openapijsonschematools.client.schemas.validation.ValidationMetadata; - -public class IsoscelesTriangle { - // nest classes so all schemas and input/output classes can be public - - public enum StringTriangleTypeEnums implements StringValueMethod { - ISOSCELES_TRIANGLE("IsoscelesTriangle"); - private final String value; - - StringTriangleTypeEnums(String value) { - this.value = value; - } - public String value() { - return this.value; - } - } - - - public sealed interface TriangleTypeBoxed permits TriangleTypeBoxedString { - @Nullable Object getData(); - } - - public record TriangleTypeBoxedString(String data) implements TriangleTypeBoxed { - @Override - public @Nullable Object getData() { - return data; - } - } - - - - public static class TriangleType extends JsonSchema implements StringSchemaValidator, StringEnumValidator { - private static @Nullable TriangleType instance = null; - - protected TriangleType() { - super(new JsonSchemaInfo() - .type(Set.of( - String.class - )) - .enumValues(SetMaker.makeSet( - "IsoscelesTriangle" - )) - ); - } - - public static TriangleType getInstance() { - if (instance == null) { - instance = new TriangleType(); - } - return instance; - } - - @Override - public String validate(String arg, SchemaConfiguration configuration) throws ValidationException { - Set> pathSet = new HashSet<>(); - List pathToItem = List.of("args[0"); - String castArg = castToAllowedTypes(arg, pathToItem, pathSet); - SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().build())); - ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, new PathToSchemasMap(), new LinkedHashSet<>()); - getPathToSchemas(this, castArg, validationMetadata, pathSet); - return castArg; - } - - @Override - 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 { - 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"); - } - @Override - public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { - 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"); - } - @Override - 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 { - 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"); - } - } - - public static class Schema1Map extends FrozenMap<@Nullable Object> { - protected Schema1Map(FrozenMap<@Nullable Object> m) { - super(m); - } - public static final Set requiredKeys = Set.of(); - public static final Set optionalKeys = Set.of( - "triangleType" - ); - public static Schema1Map of(Map arg, SchemaConfiguration configuration) throws ValidationException { - return Schema1.getInstance().validate(arg, configuration); - } - - public String triangleType() throws UnsetPropertyException { - String key = "triangleType"; - throwIfKeyNotPresent(key); - @Nullable Object value = get(key); - if (!(value instanceof String)) { - throw new RuntimeException("Invalid value stored for triangleType"); - } - return (String) value; - } - - public @Nullable Object getAdditionalProperty(String name) throws UnsetPropertyException, InvalidAdditionalPropertyException { - throwIfKeyKnown(name, requiredKeys, optionalKeys); - throwIfKeyNotPresent(name); - return get(name); - } - } - - public interface SetterForTriangleType { - Map getInstance(); - T getBuilderAfterTriangleType(Map instance); - - default T triangleType(String value) { - var instance = getInstance(); - instance.put("triangleType", value); - return getBuilderAfterTriangleType(instance); - } - - default T triangleType(StringTriangleTypeEnums value) { - var instance = getInstance(); - instance.put("triangleType", value.value()); - return getBuilderAfterTriangleType(instance); - } - } - - public static class Schema1MapBuilder extends UnsetAddPropsSetter implements GenericBuilder>, SetterForTriangleType { - private final Map instance; - private static final Set knownKeys = Set.of( - "triangleType" - ); - public Set getKnownKeys() { - return knownKeys; - } - public Schema1MapBuilder() { - this.instance = new LinkedHashMap<>(); - } - public Map build() { - return instance; - } - public Map getInstance() { - return instance; - } - public Schema1MapBuilder getBuilderAfterTriangleType(Map instance) { - return this; - } - public Schema1MapBuilder getBuilderAfterAdditionalProperty(Map instance) { - return this; - } - } - - - public sealed interface Schema1Boxed permits Schema1BoxedMap { - @Nullable Object getData(); - } - - public record Schema1BoxedMap(Schema1Map data) implements Schema1Boxed { - @Override - public @Nullable Object getData() { - return data; - } - } - - - public static class Schema1 extends JsonSchema implements MapSchemaValidator { - private static @Nullable Schema1 instance = null; - - protected Schema1() { - super(new JsonSchemaInfo() - .type(Set.of(Map.class)) - .properties(Map.ofEntries( - new PropertyEntry("triangleType", TriangleType.class) - )) - ); - } - - public static Schema1 getInstance() { - if (instance == null) { - instance = new Schema1(); - } - return instance; - } - - 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 RuntimeException("Invalid non-string key value"); - } - String propertyName = (String) entryKey; - List propertyPathToItem = new ArrayList<>(pathToItem); - propertyPathToItem.add(propertyName); - Object value = entry.getValue(); - LinkedHashMap, Nothing?> schemas = pathToSchemas.get(propertyPathToItem); - if (schemas == null) { - throw new RuntimeException("Validation result is invalid, schemas must exist for a pathToItem"); - } - JsonSchema propertySchema = schemas.entrySet().iterator().next().getKey(); - @Nullable Object propertyInstance = propertySchema.getNewInstance(value, propertyPathToItem, pathToSchemas); - properties.put(propertyName, propertyInstance); - } - FrozenMap<@Nullable Object> castProperties = new FrozenMap<>(properties); - return new Schema1Map(castProperties); - } - - 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); - SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().build())); - ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, new PathToSchemasMap(), new LinkedHashSet<>()); - PathToSchemasMap pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet); - return getNewInstance(castArg, validationMetadata.pathToItem(), pathToSchemasMap); - } - - - @Override - public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws 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"); - } - @Override - public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { - if (arg instanceof Map) { - return getNewInstance((Map) arg, pathToItem, pathToSchemas); - } - 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 { - return new Schema1BoxedMap(validate(arg, configuration)); - } - @Override - public Schema1Boxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { - 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"); - } - } - - - public sealed interface IsoscelesTriangle1Boxed permits IsoscelesTriangle1BoxedVoid, IsoscelesTriangle1BoxedBoolean, IsoscelesTriangle1BoxedNumber, IsoscelesTriangle1BoxedString, IsoscelesTriangle1BoxedList, IsoscelesTriangle1BoxedMap { - @Nullable Object getData(); - } - - public record IsoscelesTriangle1BoxedVoid(Nothing? data) implements IsoscelesTriangle1Boxed { - @Override - public @Nullable Object getData() { - return data; - } - } - - public record IsoscelesTriangle1BoxedBoolean(boolean data) implements IsoscelesTriangle1Boxed { - @Override - public @Nullable Object getData() { - return data; - } - } - - public record IsoscelesTriangle1BoxedNumber(Number data) implements IsoscelesTriangle1Boxed { - @Override - public @Nullable Object getData() { - return data; - } - } - - public record IsoscelesTriangle1BoxedString(String data) implements IsoscelesTriangle1Boxed { - @Override - public @Nullable Object getData() { - return data; - } - } - - public record IsoscelesTriangle1BoxedList(FrozenList<@Nullable Object> data) implements IsoscelesTriangle1Boxed { - @Override - public @Nullable Object getData() { - return data; - } - } - - public record IsoscelesTriangle1BoxedMap(FrozenMap<@Nullable Object> data) implements IsoscelesTriangle1Boxed { - @Override - public @Nullable Object getData() { - return data; - } - } - - - public static class IsoscelesTriangle1 extends JsonSchema implements NullSchemaValidator, BooleanSchemaValidator, NumberSchemaValidator, StringSchemaValidator, ListSchemaValidator, IsoscelesTriangle1BoxedList>, MapSchemaValidator, IsoscelesTriangle1BoxedMap> { - /* - NOTE: This class is auto generated by OpenAPI JSON Schema Generator. - Ref: https://github.com/openapi-json-schema-tools/openapi-json-schema-generator - - Do not edit the class manually. - */ - private static @Nullable IsoscelesTriangle1 instance = null; - - protected IsoscelesTriangle1() { - super(new JsonSchemaInfo() - .allOf(List.of( - TriangleInterface.TriangleInterface1.class, - Schema1.class - )) - ); - } - - public static IsoscelesTriangle1 getInstance() { - if (instance == null) { - instance = new IsoscelesTriangle1(); - } - return instance; - } - - @Override - public Nothing? validate(Nothing? arg, SchemaConfiguration configuration) throws ValidationException { - Set> pathSet = new HashSet<>(); - List pathToItem = List.of("args[0]"); - Nothing? castArg = castToAllowedTypes(arg, pathToItem, pathSet); - SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().build())); - PathToSchemasMap validatedPathToSchemas = new PathToSchemasMap(); - ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, new LinkedHashSet<>()); - getPathToSchemas(this, castArg, validationMetadata, pathSet); - return castArg; - } - - @Override - public boolean validate(boolean arg, SchemaConfiguration configuration) throws ValidationException { - Set> pathSet = new HashSet<>(); - List pathToItem = List.of("args[0]"); - boolean castArg = castToAllowedTypes(arg, pathToItem, pathSet); - SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().build())); - PathToSchemasMap validatedPathToSchemas = new PathToSchemasMap(); - ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, new LinkedHashSet<>()); - getPathToSchemas(this, castArg, validationMetadata, pathSet); - return castArg; - } - - @Override - public Number validate(Number arg, SchemaConfiguration configuration) throws ValidationException { - Set> pathSet = new HashSet<>(); - List pathToItem = List.of("args[0]"); - Number castArg = castToAllowedTypes(arg, pathToItem, pathSet); - SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().build())); - PathToSchemasMap validatedPathToSchemas = new PathToSchemasMap(); - ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, new LinkedHashSet<>()); - getPathToSchemas(this, castArg, validationMetadata, pathSet); - return castArg; - } - - public int validate(int arg, SchemaConfiguration configuration) throws ValidationException { - return (int) validate((Number) arg, configuration); - } - - public long validate(long arg, SchemaConfiguration configuration) throws ValidationException { - return (long) validate((Number) arg, configuration); - } - - public float validate(float arg, SchemaConfiguration configuration) throws ValidationException { - return (float) validate((Number) arg, configuration); - } - - public double validate(double arg, SchemaConfiguration configuration) throws ValidationException { - return (double) validate((Number) arg, configuration); - } - - @Override - public String validate(String arg, SchemaConfiguration configuration) throws ValidationException { - Set> pathSet = new HashSet<>(); - List pathToItem = List.of("args[0]"); - String castArg = castToAllowedTypes(arg, pathToItem, pathSet); - SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().build())); - PathToSchemasMap validatedPathToSchemas = new PathToSchemasMap(); - ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, new LinkedHashSet<>()); - getPathToSchemas(this, castArg, validationMetadata, pathSet); - return castArg; - } - - public String validate(LocalDate arg, SchemaConfiguration configuration) throws ValidationException { - return validate(arg.toString(), configuration); - } - - public String validate(ZonedDateTime arg, SchemaConfiguration configuration) throws ValidationException { - return validate(arg.toString(), configuration); - } - - public String validate(UUID arg, SchemaConfiguration configuration) throws ValidationException { - return validate(arg.toString(), configuration); - } - - @Override - public FrozenList<@Nullable Object> getNewInstance(List arg, List pathToItem, PathToSchemasMap pathToSchemas) { - List<@Nullable Object> items = new ArrayList<>(); - int i = 0; - for (Object item: arg) { - List itemPathToItem = new ArrayList<>(pathToItem); - itemPathToItem.add(i); - LinkedHashMap, Nothing?> schemas = pathToSchemas.get(itemPathToItem); - if (schemas == null) { - throw new RuntimeException("Validation result is invalid, schemas must exist for a pathToItem"); - } - JsonSchema itemSchema = schemas.entrySet().iterator().next().getKey(); - @Nullable Object itemInstance = itemSchema.getNewInstance(item, itemPathToItem, pathToSchemas); - items.add(itemInstance); - i += 1; - } - FrozenList<@Nullable Object> newInstanceItems = new FrozenList<>(items); - return newInstanceItems; - } - - 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); - SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().build())); - ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, new PathToSchemasMap(), new LinkedHashSet<>()); - PathToSchemasMap pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet); - return getNewInstance(castArg, validationMetadata.pathToItem(), pathToSchemasMap); - } - - @Override - 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 RuntimeException("Invalid non-string key value"); - } - String propertyName = (String) entryKey; - List propertyPathToItem = new ArrayList<>(pathToItem); - propertyPathToItem.add(propertyName); - Object value = entry.getValue(); - LinkedHashMap, Nothing?> schemas = pathToSchemas.get(propertyPathToItem); - if (schemas == null) { - throw new RuntimeException("Validation result is invalid, schemas must exist for a pathToItem"); - } - JsonSchema propertySchema = schemas.entrySet().iterator().next().getKey(); - @Nullable Object propertyInstance = propertySchema.getNewInstance(value, propertyPathToItem, pathToSchemas); - properties.put(propertyName, propertyInstance); - } - FrozenMap<@Nullable Object> castProperties = new FrozenMap<>(properties); - return castProperties; - } - - public FrozenMap<@Nullable Object> validate(Map arg, SchemaConfiguration configuration) throws ValidationException { - Set> pathSet = new HashSet<>(); - List pathToItem = List.of("args[0]"); - Map castArg = castToAllowedTypes(arg, pathToItem, pathSet); - SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().build())); - PathToSchemasMap validatedPathToSchemas = new PathToSchemasMap(); - ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, new LinkedHashSet<>()); - PathToSchemasMap pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet); - return getNewInstance(castArg, validationMetadata.pathToItem(), pathToSchemasMap); - } - - @Override - public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { - if (arg == null) { - return validate((Nothing?) null, configuration); - } else if (arg instanceof Boolean) { - boolean boolArg = (Boolean) arg; - return validate(boolArg, configuration); - } else if (arg instanceof Number) { - return validate((Number) arg, configuration); - } else if (arg instanceof String) { - return validate((String) arg, configuration); - } else if (arg instanceof List) { - return validate((List) arg, 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"); - } - @Override - public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { - if (arg == null) { - return getNewInstance((Nothing?) null, pathToItem, pathToSchemas); - } else if (arg instanceof Boolean) { - boolean boolArg = (Boolean) arg; - return getNewInstance(boolArg, pathToItem, pathToSchemas); - } else if (arg instanceof Number) { - return getNewInstance((Number) arg, pathToItem, pathToSchemas); - } else if (arg instanceof String) { - return getNewInstance((String) arg, pathToItem, pathToSchemas); - } else if (arg instanceof List) { - return getNewInstance((List) arg, 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"); - } - @Override - public IsoscelesTriangle1BoxedVoid validateAndBox(Nothing? arg, SchemaConfiguration configuration) throws ValidationException { - return new IsoscelesTriangle1BoxedVoid(validate(arg, configuration)); - } - @Override - 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 { - return new IsoscelesTriangle1BoxedNumber(validate(arg, configuration)); - } - @Override - 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 { - return new IsoscelesTriangle1BoxedList(validate(arg, configuration)); - } - @Override - 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 { - if (arg == null) { - Nothing? castArg = (Nothing?) arg; - return validateAndBox(castArg, configuration); - } else if (arg instanceof Boolean booleanArg) { - boolean castArg = booleanArg; - return validateAndBox(castArg, configuration); - } else if (arg instanceof String castArg) { - return validateAndBox(castArg, configuration); - } else if (arg instanceof Number castArg) { - return validateAndBox(castArg, configuration); - } else if (arg instanceof List castArg) { - 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"); - } - } -} diff --git a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/schemas/Items.kt b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/schemas/Items.kt deleted file mode 100644 index 4006c02f963..00000000000 --- a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/schemas/Items.kt +++ /dev/null @@ -1,167 +0,0 @@ -package org.openapijsonschematools.client.components.schemas; -import java.util.ArrayList; -import java.util.HashSet; -import java.util.LinkedHashMap; -import java.util.LinkedHashSet; -import java.util.List; -import java.util.Map; -import java.util.Objects; -import java.util.Set; -import org.checkerframework.checker.nullness.qual.Nullable; -import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags; -import org.openapijsonschematools.client.configurations.SchemaConfiguration; -import org.openapijsonschematools.client.exceptions.ValidationException; -import org.openapijsonschematools.client.schemas.MapJsonSchema; -import org.openapijsonschematools.client.schemas.validation.FrozenList; -import org.openapijsonschematools.client.schemas.validation.FrozenMap; -import org.openapijsonschematools.client.schemas.validation.JsonSchema; -import org.openapijsonschematools.client.schemas.validation.JsonSchemaInfo; -import org.openapijsonschematools.client.schemas.validation.ListSchemaValidator; -import org.openapijsonschematools.client.schemas.validation.PathToSchemasMap; -import org.openapijsonschematools.client.schemas.validation.ValidationMetadata; - -public class Items { - // nest classes so all schemas and input/output classes can be public - - - public static class Items2 extends MapJsonSchema.MapJsonSchema1 { - private static @Nullable Items2 instance = null; - public static Items2 getInstance() { - if (instance == null) { - instance = new Items2(); - } - return instance; - } - } - - - public static class ItemsList extends FrozenList> { - protected ItemsList(FrozenList> m) { - super(m); - } - public static ItemsList of(List> arg, SchemaConfiguration configuration) throws ValidationException { - return Items1.getInstance().validate(arg, configuration); - } - } - - public static class ItemsListBuilder { - // class to build List> - private final List> list; - - public ItemsListBuilder() { - list = new ArrayList<>(); - } - - public ItemsListBuilder(List> list) { - this.list = list; - } - - public ItemsListBuilder add(Map item) { - list.add(item); - return this; - } - - public List> build() { - return list; - } - } - - - public sealed interface Items1Boxed permits Items1BoxedList { - @Nullable Object getData(); - } - - public record Items1BoxedList(ItemsList data) implements Items1Boxed { - @Override - public @Nullable Object getData() { - return data; - } - } - - - - public static class Items1 extends JsonSchema implements ListSchemaValidator { - /* - NOTE: This class is auto generated by OpenAPI JSON Schema Generator. - Ref: https://github.com/openapi-json-schema-tools/openapi-json-schema-generator - - Do not edit the class manually. - - component's name collides with the inner schema name - */ - private static @Nullable Items1 instance = null; - - protected Items1() { - super(new JsonSchemaInfo() - .type(Set.of(List.class)) - .items(Items2.class) - ); - } - - public static Items1 getInstance() { - if (instance == null) { - instance = new Items1(); - } - return instance; - } - - @Override - public ItemsList getNewInstance(List arg, List pathToItem, PathToSchemasMap pathToSchemas) { - List> items = new ArrayList<>(); - int i = 0; - for (Object item: arg) { - List itemPathToItem = new ArrayList<>(pathToItem); - itemPathToItem.add(i); - LinkedHashMap, Nothing?> schemas = pathToSchemas.get(itemPathToItem); - if (schemas == null) { - throw new RuntimeException("Validation 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"); - } - items.add((FrozenMap) itemInstance); - i += 1; - } - FrozenList> newInstanceItems = new FrozenList<>(items); - return new ItemsList(newInstanceItems); - } - - 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); - SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().build())); - ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, new PathToSchemasMap(), new LinkedHashSet<>()); - PathToSchemasMap pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet); - return getNewInstance(castArg, validationMetadata.pathToItem(), pathToSchemasMap); - } - - @Override - public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws 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"); - } - @Override - public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { - 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"); - } - @Override - 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 { - 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"); - } - } -} diff --git a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/schemas/ItemsSchema.kt b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/schemas/ItemsSchema.kt deleted file mode 100644 index 67f471d0a01..00000000000 --- a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/schemas/ItemsSchema.kt +++ /dev/null @@ -1,282 +0,0 @@ -package org.openapijsonschematools.client.components.schemas; -import java.util.ArrayList; -import java.util.HashSet; -import java.util.LinkedHashMap; -import java.util.LinkedHashSet; -import java.util.List; -import java.util.Map; -import java.util.Objects; -import java.util.Set; -import org.checkerframework.checker.nullness.qual.Nullable; -import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags; -import org.openapijsonschematools.client.configurations.SchemaConfiguration; -import org.openapijsonschematools.client.exceptions.InvalidAdditionalPropertyException; -import org.openapijsonschematools.client.exceptions.UnsetPropertyException; -import org.openapijsonschematools.client.exceptions.ValidationException; -import org.openapijsonschematools.client.schemas.GenericBuilder; -import org.openapijsonschematools.client.schemas.StringJsonSchema; -import org.openapijsonschematools.client.schemas.UnsetAddPropsSetter; -import org.openapijsonschematools.client.schemas.validation.FrozenMap; -import org.openapijsonschematools.client.schemas.validation.JsonSchema; -import org.openapijsonschematools.client.schemas.validation.JsonSchemaInfo; -import org.openapijsonschematools.client.schemas.validation.MapSchemaValidator; -import org.openapijsonschematools.client.schemas.validation.PathToSchemasMap; -import org.openapijsonschematools.client.schemas.validation.PropertyEntry; -import org.openapijsonschematools.client.schemas.validation.ValidationMetadata; - -public class ItemsSchema { - // nest classes so all schemas and input/output classes can be public - - - public static class Name extends StringJsonSchema.StringJsonSchema1 { - private static @Nullable Name instance = null; - public static Name getInstance() { - if (instance == null) { - instance = new Name(); - } - return instance; - } - } - - - public static class SomeProperty extends StringJsonSchema.StringJsonSchema1 { - private static @Nullable SomeProperty instance = null; - public static SomeProperty getInstance() { - if (instance == null) { - instance = new SomeProperty(); - } - return instance; - } - } - - - public static class SecondAdditionalProperty extends StringJsonSchema.StringJsonSchema1 { - private static @Nullable SecondAdditionalProperty instance = null; - public static SecondAdditionalProperty getInstance() { - if (instance == null) { - instance = new SecondAdditionalProperty(); - } - return instance; - } - } - - - public static class ItemsSchemaMap extends FrozenMap<@Nullable Object> { - protected ItemsSchemaMap(FrozenMap<@Nullable Object> m) { - super(m); - } - public static final Set requiredKeys = Set.of(); - public static final Set optionalKeys = Set.of( - "name", - "someProperty", - "secondAdditionalProperty" - ); - public static ItemsSchemaMap of(Map arg, SchemaConfiguration configuration) throws ValidationException { - return ItemsSchema1.getInstance().validate(arg, configuration); - } - - public String name() throws UnsetPropertyException { - String key = "name"; - throwIfKeyNotPresent(key); - @Nullable Object value = get(key); - if (!(value instanceof String)) { - throw new RuntimeException("Invalid value stored for name"); - } - return (String) value; - } - - public String someProperty() throws UnsetPropertyException { - String key = "someProperty"; - throwIfKeyNotPresent(key); - @Nullable Object value = get(key); - if (!(value instanceof String)) { - throw new RuntimeException("Invalid value stored for someProperty"); - } - return (String) value; - } - - public String secondAdditionalProperty() throws UnsetPropertyException { - String key = "secondAdditionalProperty"; - throwIfKeyNotPresent(key); - @Nullable Object value = get(key); - if (!(value instanceof String)) { - throw new RuntimeException("Invalid value stored for secondAdditionalProperty"); - } - return (String) value; - } - - public @Nullable Object getAdditionalProperty(String name) throws UnsetPropertyException, InvalidAdditionalPropertyException { - throwIfKeyKnown(name, requiredKeys, optionalKeys); - throwIfKeyNotPresent(name); - return get(name); - } - } - - public interface SetterForName { - Map getInstance(); - T getBuilderAfterName(Map instance); - - default T name(String value) { - var instance = getInstance(); - instance.put("name", value); - return getBuilderAfterName(instance); - } - } - - public interface SetterForSomeProperty { - Map getInstance(); - T getBuilderAfterSomeProperty(Map instance); - - default T someProperty(String value) { - var instance = getInstance(); - instance.put("someProperty", value); - return getBuilderAfterSomeProperty(instance); - } - } - - public interface SetterForSecondAdditionalProperty { - Map getInstance(); - T getBuilderAfterSecondAdditionalProperty(Map instance); - - default T secondAdditionalProperty(String value) { - var instance = getInstance(); - instance.put("secondAdditionalProperty", value); - return getBuilderAfterSecondAdditionalProperty(instance); - } - } - - public static class ItemsSchemaMapBuilder extends UnsetAddPropsSetter implements GenericBuilder>, SetterForName, SetterForSomeProperty, SetterForSecondAdditionalProperty { - private final Map instance; - private static final Set knownKeys = Set.of( - "name", - "someProperty", - "secondAdditionalProperty" - ); - public Set getKnownKeys() { - return knownKeys; - } - public ItemsSchemaMapBuilder() { - this.instance = new LinkedHashMap<>(); - } - public Map build() { - return instance; - } - public Map getInstance() { - return instance; - } - public ItemsSchemaMapBuilder getBuilderAfterName(Map instance) { - return this; - } - public ItemsSchemaMapBuilder getBuilderAfterSomeProperty(Map instance) { - return this; - } - public ItemsSchemaMapBuilder getBuilderAfterSecondAdditionalProperty(Map instance) { - return this; - } - public ItemsSchemaMapBuilder getBuilderAfterAdditionalProperty(Map instance) { - return this; - } - } - - - public sealed interface ItemsSchema1Boxed permits ItemsSchema1BoxedMap { - @Nullable Object getData(); - } - - public record ItemsSchema1BoxedMap(ItemsSchemaMap data) implements ItemsSchema1Boxed { - @Override - public @Nullable Object getData() { - return data; - } - } - - - public static class ItemsSchema1 extends JsonSchema implements MapSchemaValidator { - /* - NOTE: This class is auto generated by OpenAPI JSON Schema Generator. - Ref: https://github.com/openapi-json-schema-tools/openapi-json-schema-generator - - Do not edit the class manually. - */ - private static @Nullable ItemsSchema1 instance = null; - - protected ItemsSchema1() { - super(new JsonSchemaInfo() - .type(Set.of(Map.class)) - .properties(Map.ofEntries( - new PropertyEntry("name", Name.class), - new PropertyEntry("someProperty", SomeProperty.class), - new PropertyEntry("secondAdditionalProperty", SecondAdditionalProperty.class) - )) - ); - } - - public static ItemsSchema1 getInstance() { - if (instance == null) { - instance = new ItemsSchema1(); - } - return instance; - } - - public ItemsSchemaMap 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 RuntimeException("Invalid non-string key value"); - } - String propertyName = (String) entryKey; - List propertyPathToItem = new ArrayList<>(pathToItem); - propertyPathToItem.add(propertyName); - Object value = entry.getValue(); - LinkedHashMap, Nothing?> schemas = pathToSchemas.get(propertyPathToItem); - if (schemas == null) { - throw new RuntimeException("Validation result is invalid, schemas must exist for a pathToItem"); - } - JsonSchema propertySchema = schemas.entrySet().iterator().next().getKey(); - @Nullable Object propertyInstance = propertySchema.getNewInstance(value, propertyPathToItem, pathToSchemas); - properties.put(propertyName, propertyInstance); - } - FrozenMap<@Nullable Object> castProperties = new FrozenMap<>(properties); - return new ItemsSchemaMap(castProperties); - } - - public ItemsSchemaMap validate(Map arg, SchemaConfiguration configuration) throws ValidationException { - Set> pathSet = new HashSet<>(); - List pathToItem = List.of("args[0"); - Map castArg = castToAllowedTypes(arg, pathToItem, pathSet); - SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().build())); - ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, new PathToSchemasMap(), new LinkedHashSet<>()); - PathToSchemasMap pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet); - return getNewInstance(castArg, validationMetadata.pathToItem(), pathToSchemasMap); - } - - - @Override - public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws 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"); - } - @Override - public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { - if (arg instanceof Map) { - return getNewInstance((Map) arg, pathToItem, pathToSchemas); - } - throw new RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); - } - @Override - public ItemsSchema1BoxedMap validateAndBox(Map arg, SchemaConfiguration configuration) throws ValidationException { - return new ItemsSchema1BoxedMap(validate(arg, configuration)); - } - @Override - public ItemsSchema1Boxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { - 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"); - } - } - -} diff --git a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/schemas/JSONPatchRequest.kt b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/schemas/JSONPatchRequest.kt deleted file mode 100644 index b1eeaf6b387..00000000000 --- a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/schemas/JSONPatchRequest.kt +++ /dev/null @@ -1,490 +0,0 @@ -package org.openapijsonschematools.client.components.schemas; -import java.time.LocalDate; -import java.time.ZonedDateTime; -import java.util.ArrayList; -import java.util.HashSet; -import java.util.LinkedHashMap; -import java.util.LinkedHashSet; -import java.util.List; -import java.util.Map; -import java.util.Objects; -import java.util.Set; -import java.util.UUID; -import org.checkerframework.checker.nullness.qual.Nullable; -import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags; -import org.openapijsonschematools.client.configurations.SchemaConfiguration; -import org.openapijsonschematools.client.exceptions.InvalidAdditionalPropertyException; -import org.openapijsonschematools.client.exceptions.UnsetPropertyException; -import org.openapijsonschematools.client.exceptions.ValidationException; -import org.openapijsonschematools.client.schemas.UnsetAddPropsSetter; -import org.openapijsonschematools.client.schemas.validation.BooleanSchemaValidator; -import org.openapijsonschematools.client.schemas.validation.FrozenList; -import org.openapijsonschematools.client.schemas.validation.FrozenMap; -import org.openapijsonschematools.client.schemas.validation.JsonSchema; -import org.openapijsonschematools.client.schemas.validation.JsonSchemaInfo; -import org.openapijsonschematools.client.schemas.validation.ListSchemaValidator; -import org.openapijsonschematools.client.schemas.validation.MapSchemaValidator; -import org.openapijsonschematools.client.schemas.validation.NullSchemaValidator; -import org.openapijsonschematools.client.schemas.validation.NumberSchemaValidator; -import org.openapijsonschematools.client.schemas.validation.PathToSchemasMap; -import org.openapijsonschematools.client.schemas.validation.StringSchemaValidator; -import org.openapijsonschematools.client.schemas.validation.ValidationMetadata; - -public class JSONPatchRequest { - // nest classes so all schemas and input/output classes can be public - - - public sealed interface ItemsBoxed permits ItemsBoxedVoid, ItemsBoxedBoolean, ItemsBoxedNumber, ItemsBoxedString, ItemsBoxedList, ItemsBoxedMap { - @Nullable Object getData(); - } - - public record ItemsBoxedVoid(Nothing? data) implements ItemsBoxed { - @Override - public @Nullable Object getData() { - return data; - } - } - - public record ItemsBoxedBoolean(boolean data) implements ItemsBoxed { - @Override - public @Nullable Object getData() { - return data; - } - } - - public record ItemsBoxedNumber(Number data) implements ItemsBoxed { - @Override - public @Nullable Object getData() { - return data; - } - } - - public record ItemsBoxedString(String data) implements ItemsBoxed { - @Override - public @Nullable Object getData() { - return data; - } - } - - public record ItemsBoxedList(FrozenList<@Nullable Object> data) implements ItemsBoxed { - @Override - public @Nullable Object getData() { - return data; - } - } - - public record ItemsBoxedMap(FrozenMap<@Nullable Object> data) implements ItemsBoxed { - @Override - public @Nullable Object getData() { - return data; - } - } - - - public static class Items extends JsonSchema implements NullSchemaValidator, BooleanSchemaValidator, NumberSchemaValidator, StringSchemaValidator, ListSchemaValidator, ItemsBoxedList>, MapSchemaValidator, ItemsBoxedMap> { - private static @Nullable Items instance = null; - - protected Items() { - super(new JsonSchemaInfo() - .oneOf(List.of( - JSONPatchRequestAddReplaceTest.JSONPatchRequestAddReplaceTest1.class, - JSONPatchRequestRemove.JSONPatchRequestRemove1.class, - JSONPatchRequestMoveCopy.JSONPatchRequestMoveCopy1.class - )) - ); - } - - public static Items getInstance() { - if (instance == null) { - instance = new Items(); - } - return instance; - } - - @Override - public Nothing? validate(Nothing? arg, SchemaConfiguration configuration) throws ValidationException { - Set> pathSet = new HashSet<>(); - List pathToItem = List.of("args[0]"); - Nothing? castArg = castToAllowedTypes(arg, pathToItem, pathSet); - SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().build())); - PathToSchemasMap validatedPathToSchemas = new PathToSchemasMap(); - ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, new LinkedHashSet<>()); - getPathToSchemas(this, castArg, validationMetadata, pathSet); - return castArg; - } - - @Override - public boolean validate(boolean arg, SchemaConfiguration configuration) throws ValidationException { - Set> pathSet = new HashSet<>(); - List pathToItem = List.of("args[0]"); - boolean castArg = castToAllowedTypes(arg, pathToItem, pathSet); - SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().build())); - PathToSchemasMap validatedPathToSchemas = new PathToSchemasMap(); - ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, new LinkedHashSet<>()); - getPathToSchemas(this, castArg, validationMetadata, pathSet); - return castArg; - } - - @Override - public Number validate(Number arg, SchemaConfiguration configuration) throws ValidationException { - Set> pathSet = new HashSet<>(); - List pathToItem = List.of("args[0]"); - Number castArg = castToAllowedTypes(arg, pathToItem, pathSet); - SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().build())); - PathToSchemasMap validatedPathToSchemas = new PathToSchemasMap(); - ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, new LinkedHashSet<>()); - getPathToSchemas(this, castArg, validationMetadata, pathSet); - return castArg; - } - - public int validate(int arg, SchemaConfiguration configuration) throws ValidationException { - return (int) validate((Number) arg, configuration); - } - - public long validate(long arg, SchemaConfiguration configuration) throws ValidationException { - return (long) validate((Number) arg, configuration); - } - - public float validate(float arg, SchemaConfiguration configuration) throws ValidationException { - return (float) validate((Number) arg, configuration); - } - - public double validate(double arg, SchemaConfiguration configuration) throws ValidationException { - return (double) validate((Number) arg, configuration); - } - - @Override - public String validate(String arg, SchemaConfiguration configuration) throws ValidationException { - Set> pathSet = new HashSet<>(); - List pathToItem = List.of("args[0]"); - String castArg = castToAllowedTypes(arg, pathToItem, pathSet); - SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().build())); - PathToSchemasMap validatedPathToSchemas = new PathToSchemasMap(); - ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, new LinkedHashSet<>()); - getPathToSchemas(this, castArg, validationMetadata, pathSet); - return castArg; - } - - public String validate(LocalDate arg, SchemaConfiguration configuration) throws ValidationException { - return validate(arg.toString(), configuration); - } - - public String validate(ZonedDateTime arg, SchemaConfiguration configuration) throws ValidationException { - return validate(arg.toString(), configuration); - } - - public String validate(UUID arg, SchemaConfiguration configuration) throws ValidationException { - return validate(arg.toString(), configuration); - } - - @Override - public FrozenList<@Nullable Object> getNewInstance(List arg, List pathToItem, PathToSchemasMap pathToSchemas) { - List<@Nullable Object> items = new ArrayList<>(); - int i = 0; - for (Object item: arg) { - List itemPathToItem = new ArrayList<>(pathToItem); - itemPathToItem.add(i); - LinkedHashMap, Nothing?> schemas = pathToSchemas.get(itemPathToItem); - if (schemas == null) { - throw new RuntimeException("Validation result is invalid, schemas must exist for a pathToItem"); - } - JsonSchema itemSchema = schemas.entrySet().iterator().next().getKey(); - @Nullable Object itemInstance = itemSchema.getNewInstance(item, itemPathToItem, pathToSchemas); - items.add(itemInstance); - i += 1; - } - FrozenList<@Nullable Object> newInstanceItems = new FrozenList<>(items); - return newInstanceItems; - } - - 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); - SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().build())); - ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, new PathToSchemasMap(), new LinkedHashSet<>()); - PathToSchemasMap pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet); - return getNewInstance(castArg, validationMetadata.pathToItem(), pathToSchemasMap); - } - - @Override - 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 RuntimeException("Invalid non-string key value"); - } - String propertyName = (String) entryKey; - List propertyPathToItem = new ArrayList<>(pathToItem); - propertyPathToItem.add(propertyName); - Object value = entry.getValue(); - LinkedHashMap, Nothing?> schemas = pathToSchemas.get(propertyPathToItem); - if (schemas == null) { - throw new RuntimeException("Validation result is invalid, schemas must exist for a pathToItem"); - } - JsonSchema propertySchema = schemas.entrySet().iterator().next().getKey(); - @Nullable Object propertyInstance = propertySchema.getNewInstance(value, propertyPathToItem, pathToSchemas); - properties.put(propertyName, propertyInstance); - } - FrozenMap<@Nullable Object> castProperties = new FrozenMap<>(properties); - return castProperties; - } - - public FrozenMap<@Nullable Object> validate(Map arg, SchemaConfiguration configuration) throws ValidationException { - Set> pathSet = new HashSet<>(); - List pathToItem = List.of("args[0]"); - Map castArg = castToAllowedTypes(arg, pathToItem, pathSet); - SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().build())); - PathToSchemasMap validatedPathToSchemas = new PathToSchemasMap(); - ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, new LinkedHashSet<>()); - PathToSchemasMap pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet); - return getNewInstance(castArg, validationMetadata.pathToItem(), pathToSchemasMap); - } - - @Override - public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { - if (arg == null) { - return validate((Nothing?) null, configuration); - } else if (arg instanceof Boolean) { - boolean boolArg = (Boolean) arg; - return validate(boolArg, configuration); - } else if (arg instanceof Number) { - return validate((Number) arg, configuration); - } else if (arg instanceof String) { - return validate((String) arg, configuration); - } else if (arg instanceof List) { - return validate((List) arg, 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"); - } - @Override - public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { - if (arg == null) { - return getNewInstance((Nothing?) null, pathToItem, pathToSchemas); - } else if (arg instanceof Boolean) { - boolean boolArg = (Boolean) arg; - return getNewInstance(boolArg, pathToItem, pathToSchemas); - } else if (arg instanceof Number) { - return getNewInstance((Number) arg, pathToItem, pathToSchemas); - } else if (arg instanceof String) { - return getNewInstance((String) arg, pathToItem, pathToSchemas); - } else if (arg instanceof List) { - return getNewInstance((List) arg, 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"); - } - @Override - public ItemsBoxedVoid validateAndBox(Nothing? arg, SchemaConfiguration configuration) throws ValidationException { - return new ItemsBoxedVoid(validate(arg, configuration)); - } - @Override - 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 { - return new ItemsBoxedNumber(validate(arg, configuration)); - } - @Override - 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 { - return new ItemsBoxedList(validate(arg, configuration)); - } - @Override - 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 { - if (arg == null) { - Nothing? castArg = (Nothing?) arg; - return validateAndBox(castArg, configuration); - } else if (arg instanceof Boolean booleanArg) { - boolean castArg = booleanArg; - return validateAndBox(castArg, configuration); - } else if (arg instanceof String castArg) { - return validateAndBox(castArg, configuration); - } else if (arg instanceof Number castArg) { - return validateAndBox(castArg, configuration); - } else if (arg instanceof List castArg) { - 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"); - } - } - - 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 { - return JSONPatchRequest1.getInstance().validate(arg, configuration); - } - } - - public static class JSONPatchRequestListBuilder { - // class to build List<@Nullable Object> - private final List<@Nullable Object> list; - - public JSONPatchRequestListBuilder() { - list = new ArrayList<>(); - } - - public JSONPatchRequestListBuilder(List<@Nullable Object> list) { - this.list = list; - } - - public JSONPatchRequestListBuilder add(Nothing? item) { - list.add(null); - return this; - } - - public JSONPatchRequestListBuilder add(boolean item) { - list.add(item); - return this; - } - - public JSONPatchRequestListBuilder add(String item) { - list.add(item); - return this; - } - - public JSONPatchRequestListBuilder add(int item) { - list.add(item); - return this; - } - - public JSONPatchRequestListBuilder add(float item) { - list.add(item); - return this; - } - - public JSONPatchRequestListBuilder add(long item) { - list.add(item); - return this; - } - - public JSONPatchRequestListBuilder add(double item) { - list.add(item); - return this; - } - - public JSONPatchRequestListBuilder add(List item) { - list.add(item); - return this; - } - - public JSONPatchRequestListBuilder add(Map item) { - list.add(item); - return this; - } - - public List<@Nullable Object> build() { - return list; - } - } - - - public sealed interface JSONPatchRequest1Boxed permits JSONPatchRequest1BoxedList { - @Nullable Object getData(); - } - - public record JSONPatchRequest1BoxedList(JSONPatchRequestList data) implements JSONPatchRequest1Boxed { - @Override - public @Nullable Object getData() { - return data; - } - } - - - - public static class JSONPatchRequest1 extends JsonSchema implements ListSchemaValidator { - /* - NOTE: This class is auto generated by OpenAPI JSON Schema Generator. - Ref: https://github.com/openapi-json-schema-tools/openapi-json-schema-generator - - Do not edit the class manually. - */ - private static @Nullable JSONPatchRequest1 instance = null; - - protected JSONPatchRequest1() { - super(new JsonSchemaInfo() - .type(Set.of(List.class)) - .items(Items.class) - ); - } - - public static JSONPatchRequest1 getInstance() { - if (instance == null) { - instance = new JSONPatchRequest1(); - } - return instance; - } - - @Override - public JSONPatchRequestList getNewInstance(List arg, List pathToItem, PathToSchemasMap pathToSchemas) { - List<@Nullable Object> items = new ArrayList<>(); - int i = 0; - for (Object item: arg) { - List itemPathToItem = new ArrayList<>(pathToItem); - itemPathToItem.add(i); - LinkedHashMap, Nothing?> schemas = pathToSchemas.get(itemPathToItem); - if (schemas == null) { - throw new RuntimeException("Validation result is invalid, schemas must exist for a pathToItem"); - } - JsonSchema itemSchema = schemas.entrySet().iterator().next().getKey(); - @Nullable Object itemInstance = itemSchema.getNewInstance(item, itemPathToItem, pathToSchemas); - items.add(itemInstance); - i += 1; - } - FrozenList<@Nullable Object> newInstanceItems = new FrozenList<>(items); - return new JSONPatchRequestList(newInstanceItems); - } - - 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); - SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().build())); - ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, new PathToSchemasMap(), new LinkedHashSet<>()); - PathToSchemasMap pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet); - return getNewInstance(castArg, validationMetadata.pathToItem(), pathToSchemasMap); - } - - @Override - public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws 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"); - } - @Override - public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { - 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"); - } - @Override - 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 { - 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"); - } - } -} diff --git a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/schemas/JSONPatchRequestAddReplaceTest.kt b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/schemas/JSONPatchRequestAddReplaceTest.kt deleted file mode 100644 index d688713b3be..00000000000 --- a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/schemas/JSONPatchRequestAddReplaceTest.kt +++ /dev/null @@ -1,520 +0,0 @@ -package org.openapijsonschematools.client.components.schemas; -import java.util.ArrayList; -import java.util.HashSet; -import java.util.LinkedHashMap; -import java.util.LinkedHashSet; -import java.util.List; -import java.util.Map; -import java.util.Objects; -import java.util.Set; -import org.checkerframework.checker.nullness.qual.Nullable; -import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags; -import org.openapijsonschematools.client.configurations.SchemaConfiguration; -import org.openapijsonschematools.client.exceptions.UnsetPropertyException; -import org.openapijsonschematools.client.exceptions.ValidationException; -import org.openapijsonschematools.client.schemas.AnyTypeJsonSchema; -import org.openapijsonschematools.client.schemas.GenericBuilder; -import org.openapijsonschematools.client.schemas.NotAnyTypeJsonSchema; -import org.openapijsonschematools.client.schemas.SetMaker; -import org.openapijsonschematools.client.schemas.StringJsonSchema; -import org.openapijsonschematools.client.schemas.validation.FrozenMap; -import org.openapijsonschematools.client.schemas.validation.JsonSchema; -import org.openapijsonschematools.client.schemas.validation.JsonSchemaInfo; -import org.openapijsonschematools.client.schemas.validation.MapSchemaValidator; -import org.openapijsonschematools.client.schemas.validation.MapUtils; -import org.openapijsonschematools.client.schemas.validation.PathToSchemasMap; -import org.openapijsonschematools.client.schemas.validation.PropertyEntry; -import org.openapijsonschematools.client.schemas.validation.StringEnumValidator; -import org.openapijsonschematools.client.schemas.validation.StringSchemaValidator; -import org.openapijsonschematools.client.schemas.validation.StringValueMethod; -import org.openapijsonschematools.client.schemas.validation.ValidationMetadata; - -public class JSONPatchRequestAddReplaceTest { - // nest classes so all schemas and input/output classes can be public - - - public static class AdditionalProperties extends NotAnyTypeJsonSchema.NotAnyTypeJsonSchema1 { - // NotAnyTypeSchema - private static @Nullable AdditionalProperties instance = null; - public static AdditionalProperties getInstance() { - if (instance == null) { - instance = new AdditionalProperties(); - } - return instance; - } - } - - - public static class Path extends StringJsonSchema.StringJsonSchema1 { - private static @Nullable Path instance = null; - public static Path getInstance() { - if (instance == null) { - instance = new Path(); - } - return instance; - } - } - - - public static class Value extends AnyTypeJsonSchema.AnyTypeJsonSchema1 { - private static @Nullable Value instance = null; - public static Value getInstance() { - if (instance == null) { - instance = new Value(); - } - return instance; - } - } - - public enum StringOpEnums implements StringValueMethod { - ADD("add"), - REPLACE("replace"), - TEST("test"); - private final String value; - - StringOpEnums(String value) { - this.value = value; - } - public String value() { - return this.value; - } - } - - - public sealed interface OpBoxed permits OpBoxedString { - @Nullable Object getData(); - } - - public record OpBoxedString(String data) implements OpBoxed { - @Override - public @Nullable Object getData() { - return data; - } - } - - - - public static class Op extends JsonSchema implements StringSchemaValidator, StringEnumValidator { - private static @Nullable Op instance = null; - - protected Op() { - super(new JsonSchemaInfo() - .type(Set.of( - String.class - )) - .enumValues(SetMaker.makeSet( - "add", - "replace", - "test" - )) - ); - } - - public static Op getInstance() { - if (instance == null) { - instance = new Op(); - } - return instance; - } - - @Override - public String validate(String arg, SchemaConfiguration configuration) throws ValidationException { - Set> pathSet = new HashSet<>(); - List pathToItem = List.of("args[0"); - String castArg = castToAllowedTypes(arg, pathToItem, pathSet); - SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().build())); - ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, new PathToSchemasMap(), new LinkedHashSet<>()); - getPathToSchemas(this, castArg, validationMetadata, pathSet); - return castArg; - } - - @Override - 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 { - 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"); - } - @Override - public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { - 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"); - } - @Override - 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 { - 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"); - } - } - - public static class JSONPatchRequestAddReplaceTestMap extends FrozenMap<@Nullable Object> { - protected JSONPatchRequestAddReplaceTestMap(FrozenMap<@Nullable Object> m) { - super(m); - } - public static final Set requiredKeys = Set.of( - "op", - "path", - "value" - ); - public static final Set optionalKeys = Set.of(); - public static JSONPatchRequestAddReplaceTestMap of(Map arg, SchemaConfiguration configuration) throws ValidationException { - return JSONPatchRequestAddReplaceTest1.getInstance().validate(arg, configuration); - } - - public String op() { - @Nullable Object value = get("op"); - if (!(value instanceof String)) { - throw new RuntimeException("Invalid value stored for op"); - } - return (String) value; - } - - public String path() { - @Nullable Object value = get("path"); - if (!(value instanceof String)) { - throw new RuntimeException("Invalid value stored for path"); - } - return (String) value; - } - - public @Nullable Object value() { - try { - return getOrThrow("version"); - } catch (UnsetPropertyException e) { - throw new RuntimeException(e); - } - } - } - - public interface SetterForOp { - Map getInstance(); - T getBuilderAfterOp(Map instance); - - default T op(String value) { - var instance = getInstance(); - instance.put("op", value); - return getBuilderAfterOp(instance); - } - - default T op(StringOpEnums value) { - var instance = getInstance(); - instance.put("op", value.value()); - return getBuilderAfterOp(instance); - } - } - - public interface SetterForPath { - Map getInstance(); - T getBuilderAfterPath(Map instance); - - default T path(String value) { - var instance = getInstance(); - instance.put("path", value); - return getBuilderAfterPath(instance); - } - } - - public interface SetterForValue { - Map getInstance(); - T getBuilderAfterValue(Map instance); - - default T value(Nothing? value) { - var instance = getInstance(); - instance.put("value", null); - return getBuilderAfterValue(instance); - } - - default T value(boolean value) { - var instance = getInstance(); - instance.put("value", value); - return getBuilderAfterValue(instance); - } - - default T value(String value) { - var instance = getInstance(); - instance.put("value", value); - return getBuilderAfterValue(instance); - } - - default T value(int value) { - var instance = getInstance(); - instance.put("value", value); - return getBuilderAfterValue(instance); - } - - default T value(float value) { - var instance = getInstance(); - instance.put("value", value); - return getBuilderAfterValue(instance); - } - - default T value(long value) { - var instance = getInstance(); - instance.put("value", value); - return getBuilderAfterValue(instance); - } - - default T value(double value) { - var instance = getInstance(); - instance.put("value", value); - return getBuilderAfterValue(instance); - } - - default T value(List value) { - var instance = getInstance(); - instance.put("value", value); - return getBuilderAfterValue(instance); - } - - default T value(Map value) { - var instance = getInstance(); - instance.put("value", value); - return getBuilderAfterValue(instance); - } - } - - public static class JSONPatchRequestAddReplaceTestMap000Builder implements GenericBuilder> { - private final Map instance; - private static final Set knownKeys = Set.of( - "op", - "path", - "value" - ); - public Set getKnownKeys() { - return knownKeys; - } - public JSONPatchRequestAddReplaceTestMap000Builder(Map instance) { - this.instance = instance; - } - public Map build() { - return instance; - } - } - - public static class JSONPatchRequestAddReplaceTestMap001Builder implements SetterForValue { - private final Map instance; - public JSONPatchRequestAddReplaceTestMap001Builder(Map instance) { - this.instance = instance; - } - public Map getInstance() { - return instance; - } - public JSONPatchRequestAddReplaceTestMap000Builder getBuilderAfterValue(Map instance) { - return new JSONPatchRequestAddReplaceTestMap000Builder(instance); - } - } - - public static class JSONPatchRequestAddReplaceTestMap010Builder implements SetterForPath { - private final Map instance; - public JSONPatchRequestAddReplaceTestMap010Builder(Map instance) { - this.instance = instance; - } - public Map getInstance() { - return instance; - } - public JSONPatchRequestAddReplaceTestMap000Builder getBuilderAfterPath(Map instance) { - return new JSONPatchRequestAddReplaceTestMap000Builder(instance); - } - } - - public static class JSONPatchRequestAddReplaceTestMap011Builder implements SetterForPath, SetterForValue { - private final Map instance; - public JSONPatchRequestAddReplaceTestMap011Builder(Map instance) { - this.instance = instance; - } - public Map getInstance() { - return instance; - } - public JSONPatchRequestAddReplaceTestMap001Builder getBuilderAfterPath(Map instance) { - return new JSONPatchRequestAddReplaceTestMap001Builder(instance); - } - public JSONPatchRequestAddReplaceTestMap010Builder getBuilderAfterValue(Map instance) { - return new JSONPatchRequestAddReplaceTestMap010Builder(instance); - } - } - - public static class JSONPatchRequestAddReplaceTestMap100Builder implements SetterForOp { - private final Map instance; - public JSONPatchRequestAddReplaceTestMap100Builder(Map instance) { - this.instance = instance; - } - public Map getInstance() { - return instance; - } - public JSONPatchRequestAddReplaceTestMap000Builder getBuilderAfterOp(Map instance) { - return new JSONPatchRequestAddReplaceTestMap000Builder(instance); - } - } - - public static class JSONPatchRequestAddReplaceTestMap101Builder implements SetterForOp, SetterForValue { - private final Map instance; - public JSONPatchRequestAddReplaceTestMap101Builder(Map instance) { - this.instance = instance; - } - public Map getInstance() { - return instance; - } - public JSONPatchRequestAddReplaceTestMap001Builder getBuilderAfterOp(Map instance) { - return new JSONPatchRequestAddReplaceTestMap001Builder(instance); - } - public JSONPatchRequestAddReplaceTestMap100Builder getBuilderAfterValue(Map instance) { - return new JSONPatchRequestAddReplaceTestMap100Builder(instance); - } - } - - public static class JSONPatchRequestAddReplaceTestMap110Builder implements SetterForOp, SetterForPath { - private final Map instance; - public JSONPatchRequestAddReplaceTestMap110Builder(Map instance) { - this.instance = instance; - } - public Map getInstance() { - return instance; - } - public JSONPatchRequestAddReplaceTestMap010Builder getBuilderAfterOp(Map instance) { - return new JSONPatchRequestAddReplaceTestMap010Builder(instance); - } - public JSONPatchRequestAddReplaceTestMap100Builder getBuilderAfterPath(Map instance) { - return new JSONPatchRequestAddReplaceTestMap100Builder(instance); - } - } - - public static class JSONPatchRequestAddReplaceTestMapBuilder implements SetterForOp, SetterForPath, SetterForValue { - private final Map instance; - public JSONPatchRequestAddReplaceTestMapBuilder() { - this.instance = new LinkedHashMap<>(); - } - public Map getInstance() { - return instance; - } - public JSONPatchRequestAddReplaceTestMap011Builder getBuilderAfterOp(Map instance) { - return new JSONPatchRequestAddReplaceTestMap011Builder(instance); - } - public JSONPatchRequestAddReplaceTestMap101Builder getBuilderAfterPath(Map instance) { - return new JSONPatchRequestAddReplaceTestMap101Builder(instance); - } - public JSONPatchRequestAddReplaceTestMap110Builder getBuilderAfterValue(Map instance) { - return new JSONPatchRequestAddReplaceTestMap110Builder(instance); - } - } - - - public sealed interface JSONPatchRequestAddReplaceTest1Boxed permits JSONPatchRequestAddReplaceTest1BoxedMap { - @Nullable Object getData(); - } - - public record JSONPatchRequestAddReplaceTest1BoxedMap(JSONPatchRequestAddReplaceTestMap data) implements JSONPatchRequestAddReplaceTest1Boxed { - @Override - public @Nullable Object getData() { - return data; - } - } - - - public static class JSONPatchRequestAddReplaceTest1 extends JsonSchema implements MapSchemaValidator { - /* - NOTE: This class is auto generated by OpenAPI JSON Schema Generator. - Ref: https://github.com/openapi-json-schema-tools/openapi-json-schema-generator - - Do not edit the class manually. - */ - private static @Nullable JSONPatchRequestAddReplaceTest1 instance = null; - - protected JSONPatchRequestAddReplaceTest1() { - super(new JsonSchemaInfo() - .type(Set.of(Map.class)) - .properties(Map.ofEntries( - new PropertyEntry("path", Path.class), - new PropertyEntry("value", Value.class), - new PropertyEntry("op", Op.class) - )) - .required(Set.of( - "op", - "path", - "value" - )) - .additionalProperties(AdditionalProperties.class) - ); - } - - public static JSONPatchRequestAddReplaceTest1 getInstance() { - if (instance == null) { - instance = new JSONPatchRequestAddReplaceTest1(); - } - return instance; - } - - 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 RuntimeException("Invalid non-string key value"); - } - String propertyName = (String) entryKey; - List propertyPathToItem = new ArrayList<>(pathToItem); - propertyPathToItem.add(propertyName); - Object value = entry.getValue(); - LinkedHashMap, Nothing?> schemas = pathToSchemas.get(propertyPathToItem); - if (schemas == null) { - throw new RuntimeException("Validation result is invalid, schemas must exist for a pathToItem"); - } - JsonSchema propertySchema = schemas.entrySet().iterator().next().getKey(); - @Nullable Object propertyInstance = propertySchema.getNewInstance(value, propertyPathToItem, pathToSchemas); - properties.put(propertyName, propertyInstance); - } - FrozenMap<@Nullable Object> castProperties = new FrozenMap<>(properties); - return new JSONPatchRequestAddReplaceTestMap(castProperties); - } - - 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); - SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().build())); - ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, new PathToSchemasMap(), new LinkedHashSet<>()); - PathToSchemasMap pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet); - return getNewInstance(castArg, validationMetadata.pathToItem(), pathToSchemasMap); - } - - - @Override - public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws 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"); - } - @Override - public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { - if (arg instanceof Map) { - return getNewInstance((Map) arg, pathToItem, pathToSchemas); - } - 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 { - return new JSONPatchRequestAddReplaceTest1BoxedMap(validate(arg, configuration)); - } - @Override - public JSONPatchRequestAddReplaceTest1Boxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { - 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"); - } - } - -} diff --git a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/schemas/JSONPatchRequestMoveCopy.kt b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/schemas/JSONPatchRequestMoveCopy.kt deleted file mode 100644 index d5d1120067c..00000000000 --- a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/schemas/JSONPatchRequestMoveCopy.kt +++ /dev/null @@ -1,473 +0,0 @@ -package org.openapijsonschematools.client.components.schemas; -import java.util.ArrayList; -import java.util.HashSet; -import java.util.LinkedHashMap; -import java.util.LinkedHashSet; -import java.util.List; -import java.util.Map; -import java.util.Objects; -import java.util.Set; -import org.checkerframework.checker.nullness.qual.Nullable; -import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags; -import org.openapijsonschematools.client.configurations.SchemaConfiguration; -import org.openapijsonschematools.client.exceptions.UnsetPropertyException; -import org.openapijsonschematools.client.exceptions.ValidationException; -import org.openapijsonschematools.client.schemas.AnyTypeJsonSchema; -import org.openapijsonschematools.client.schemas.GenericBuilder; -import org.openapijsonschematools.client.schemas.NotAnyTypeJsonSchema; -import org.openapijsonschematools.client.schemas.SetMaker; -import org.openapijsonschematools.client.schemas.StringJsonSchema; -import org.openapijsonschematools.client.schemas.validation.FrozenMap; -import org.openapijsonschematools.client.schemas.validation.JsonSchema; -import org.openapijsonschematools.client.schemas.validation.JsonSchemaInfo; -import org.openapijsonschematools.client.schemas.validation.MapSchemaValidator; -import org.openapijsonschematools.client.schemas.validation.MapUtils; -import org.openapijsonschematools.client.schemas.validation.PathToSchemasMap; -import org.openapijsonschematools.client.schemas.validation.PropertyEntry; -import org.openapijsonschematools.client.schemas.validation.StringEnumValidator; -import org.openapijsonschematools.client.schemas.validation.StringSchemaValidator; -import org.openapijsonschematools.client.schemas.validation.StringValueMethod; -import org.openapijsonschematools.client.schemas.validation.ValidationMetadata; - -public class JSONPatchRequestMoveCopy { - // nest classes so all schemas and input/output classes can be public - - - public static class AdditionalProperties extends NotAnyTypeJsonSchema.NotAnyTypeJsonSchema1 { - // NotAnyTypeSchema - private static @Nullable AdditionalProperties instance = null; - public static AdditionalProperties getInstance() { - if (instance == null) { - instance = new AdditionalProperties(); - } - return instance; - } - } - - - public static class From extends StringJsonSchema.StringJsonSchema1 { - private static @Nullable From instance = null; - public static From getInstance() { - if (instance == null) { - instance = new From(); - } - return instance; - } - } - - - public static class Path extends StringJsonSchema.StringJsonSchema1 { - private static @Nullable Path instance = null; - public static Path getInstance() { - if (instance == null) { - instance = new Path(); - } - return instance; - } - } - - public enum StringOpEnums implements StringValueMethod { - MOVE("move"), - COPY("copy"); - private final String value; - - StringOpEnums(String value) { - this.value = value; - } - public String value() { - return this.value; - } - } - - - public sealed interface OpBoxed permits OpBoxedString { - @Nullable Object getData(); - } - - public record OpBoxedString(String data) implements OpBoxed { - @Override - public @Nullable Object getData() { - return data; - } - } - - - - public static class Op extends JsonSchema implements StringSchemaValidator, StringEnumValidator { - private static @Nullable Op instance = null; - - protected Op() { - super(new JsonSchemaInfo() - .type(Set.of( - String.class - )) - .enumValues(SetMaker.makeSet( - "move", - "copy" - )) - ); - } - - public static Op getInstance() { - if (instance == null) { - instance = new Op(); - } - return instance; - } - - @Override - public String validate(String arg, SchemaConfiguration configuration) throws ValidationException { - Set> pathSet = new HashSet<>(); - List pathToItem = List.of("args[0"); - String castArg = castToAllowedTypes(arg, pathToItem, pathSet); - SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().build())); - ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, new PathToSchemasMap(), new LinkedHashSet<>()); - getPathToSchemas(this, castArg, validationMetadata, pathSet); - return castArg; - } - - @Override - 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 { - 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"); - } - @Override - public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { - 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"); - } - @Override - 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 { - 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"); - } - } - - public static class JSONPatchRequestMoveCopyMap extends FrozenMap { - protected JSONPatchRequestMoveCopyMap(FrozenMap m) { - super(m); - } - public static final Set requiredKeys = Set.of( - "from", - "op", - "path" - ); - public static final Set optionalKeys = Set.of(); - public static JSONPatchRequestMoveCopyMap of(Map arg, SchemaConfiguration configuration) throws ValidationException { - return JSONPatchRequestMoveCopy1.getInstance().validate(arg, configuration); - } - - public String 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 RuntimeException("Invalid value stored for op"); - } - return (String) value; - } - - public String path() { - try { - return getOrThrow("version"); - } catch (UnsetPropertyException e) { - throw new RuntimeException(e); - } - } - } - - public interface SetterForFrom { - Map getInstance(); - T getBuilderAfterFrom(Map instance); - - default T from(String value) { - var instance = getInstance(); - instance.put("from", value); - return getBuilderAfterFrom(instance); - } - } - - public interface SetterForOp { - Map getInstance(); - T getBuilderAfterOp(Map instance); - - default T op(String value) { - var instance = getInstance(); - instance.put("op", value); - return getBuilderAfterOp(instance); - } - - default T op(StringOpEnums value) { - var instance = getInstance(); - instance.put("op", value.value()); - return getBuilderAfterOp(instance); - } - } - - public interface SetterForPath { - Map getInstance(); - T getBuilderAfterPath(Map instance); - - default T path(String value) { - var instance = getInstance(); - instance.put("path", value); - return getBuilderAfterPath(instance); - } - } - - public static class JSONPatchRequestMoveCopyMap000Builder implements GenericBuilder> { - private final Map instance; - private static final Set knownKeys = Set.of( - "from", - "op", - "path" - ); - public Set getKnownKeys() { - return knownKeys; - } - public JSONPatchRequestMoveCopyMap000Builder(Map instance) { - this.instance = instance; - } - public Map build() { - return instance; - } - } - - public static class JSONPatchRequestMoveCopyMap001Builder implements SetterForPath { - private final Map instance; - public JSONPatchRequestMoveCopyMap001Builder(Map instance) { - this.instance = instance; - } - public Map getInstance() { - return instance; - } - public JSONPatchRequestMoveCopyMap000Builder getBuilderAfterPath(Map instance) { - return new JSONPatchRequestMoveCopyMap000Builder(instance); - } - } - - public static class JSONPatchRequestMoveCopyMap010Builder implements SetterForOp { - private final Map instance; - public JSONPatchRequestMoveCopyMap010Builder(Map instance) { - this.instance = instance; - } - public Map getInstance() { - return instance; - } - public JSONPatchRequestMoveCopyMap000Builder getBuilderAfterOp(Map instance) { - return new JSONPatchRequestMoveCopyMap000Builder(instance); - } - } - - public static class JSONPatchRequestMoveCopyMap011Builder implements SetterForOp, SetterForPath { - private final Map instance; - public JSONPatchRequestMoveCopyMap011Builder(Map instance) { - this.instance = instance; - } - public Map getInstance() { - return instance; - } - public JSONPatchRequestMoveCopyMap001Builder getBuilderAfterOp(Map instance) { - return new JSONPatchRequestMoveCopyMap001Builder(instance); - } - public JSONPatchRequestMoveCopyMap010Builder getBuilderAfterPath(Map instance) { - return new JSONPatchRequestMoveCopyMap010Builder(instance); - } - } - - public static class JSONPatchRequestMoveCopyMap100Builder implements SetterForFrom { - private final Map instance; - public JSONPatchRequestMoveCopyMap100Builder(Map instance) { - this.instance = instance; - } - public Map getInstance() { - return instance; - } - public JSONPatchRequestMoveCopyMap000Builder getBuilderAfterFrom(Map instance) { - return new JSONPatchRequestMoveCopyMap000Builder(instance); - } - } - - public static class JSONPatchRequestMoveCopyMap101Builder implements SetterForFrom, SetterForPath { - private final Map instance; - public JSONPatchRequestMoveCopyMap101Builder(Map instance) { - this.instance = instance; - } - public Map getInstance() { - return instance; - } - public JSONPatchRequestMoveCopyMap001Builder getBuilderAfterFrom(Map instance) { - return new JSONPatchRequestMoveCopyMap001Builder(instance); - } - public JSONPatchRequestMoveCopyMap100Builder getBuilderAfterPath(Map instance) { - return new JSONPatchRequestMoveCopyMap100Builder(instance); - } - } - - public static class JSONPatchRequestMoveCopyMap110Builder implements SetterForFrom, SetterForOp { - private final Map instance; - public JSONPatchRequestMoveCopyMap110Builder(Map instance) { - this.instance = instance; - } - public Map getInstance() { - return instance; - } - public JSONPatchRequestMoveCopyMap010Builder getBuilderAfterFrom(Map instance) { - return new JSONPatchRequestMoveCopyMap010Builder(instance); - } - public JSONPatchRequestMoveCopyMap100Builder getBuilderAfterOp(Map instance) { - return new JSONPatchRequestMoveCopyMap100Builder(instance); - } - } - - public static class JSONPatchRequestMoveCopyMapBuilder implements SetterForFrom, SetterForOp, SetterForPath { - private final Map instance; - public JSONPatchRequestMoveCopyMapBuilder() { - this.instance = new LinkedHashMap<>(); - } - public Map getInstance() { - return instance; - } - public JSONPatchRequestMoveCopyMap011Builder getBuilderAfterFrom(Map instance) { - return new JSONPatchRequestMoveCopyMap011Builder(instance); - } - public JSONPatchRequestMoveCopyMap101Builder getBuilderAfterOp(Map instance) { - return new JSONPatchRequestMoveCopyMap101Builder(instance); - } - public JSONPatchRequestMoveCopyMap110Builder getBuilderAfterPath(Map instance) { - return new JSONPatchRequestMoveCopyMap110Builder(instance); - } - } - - - public sealed interface JSONPatchRequestMoveCopy1Boxed permits JSONPatchRequestMoveCopy1BoxedMap { - @Nullable Object getData(); - } - - public record JSONPatchRequestMoveCopy1BoxedMap(JSONPatchRequestMoveCopyMap data) implements JSONPatchRequestMoveCopy1Boxed { - @Override - public @Nullable Object getData() { - return data; - } - } - - - public static class JSONPatchRequestMoveCopy1 extends JsonSchema implements MapSchemaValidator { - /* - NOTE: This class is auto generated by OpenAPI JSON Schema Generator. - Ref: https://github.com/openapi-json-schema-tools/openapi-json-schema-generator - - Do not edit the class manually. - */ - private static @Nullable JSONPatchRequestMoveCopy1 instance = null; - - protected JSONPatchRequestMoveCopy1() { - super(new JsonSchemaInfo() - .type(Set.of(Map.class)) - .properties(Map.ofEntries( - new PropertyEntry("from", From.class), - new PropertyEntry("path", Path.class), - new PropertyEntry("op", Op.class) - )) - .required(Set.of( - "from", - "op", - "path" - )) - .additionalProperties(AdditionalProperties.class) - ); - } - - public static JSONPatchRequestMoveCopy1 getInstance() { - if (instance == null) { - instance = new JSONPatchRequestMoveCopy1(); - } - return instance; - } - - 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 RuntimeException("Invalid non-string key value"); - } - String propertyName = (String) entryKey; - List propertyPathToItem = new ArrayList<>(pathToItem); - propertyPathToItem.add(propertyName); - Object value = entry.getValue(); - LinkedHashMap, Nothing?> schemas = pathToSchemas.get(propertyPathToItem); - if (schemas == null) { - throw new RuntimeException("Validation 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"); - } - properties.put(propertyName, (String) propertyInstance); - } - FrozenMap castProperties = new FrozenMap<>(properties); - return new JSONPatchRequestMoveCopyMap(castProperties); - } - - 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); - SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().build())); - ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, new PathToSchemasMap(), new LinkedHashSet<>()); - PathToSchemasMap pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet); - return getNewInstance(castArg, validationMetadata.pathToItem(), pathToSchemasMap); - } - - - @Override - public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws 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"); - } - @Override - public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { - if (arg instanceof Map) { - return getNewInstance((Map) arg, pathToItem, pathToSchemas); - } - 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 { - return new JSONPatchRequestMoveCopy1BoxedMap(validate(arg, configuration)); - } - @Override - public JSONPatchRequestMoveCopy1Boxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { - 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"); - } - } - -} diff --git a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/schemas/JSONPatchRequestRemove.kt b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/schemas/JSONPatchRequestRemove.kt deleted file mode 100644 index fabeec56091..00000000000 --- a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/schemas/JSONPatchRequestRemove.kt +++ /dev/null @@ -1,373 +0,0 @@ -package org.openapijsonschematools.client.components.schemas; -import java.util.ArrayList; -import java.util.HashSet; -import java.util.LinkedHashMap; -import java.util.LinkedHashSet; -import java.util.List; -import java.util.Map; -import java.util.Objects; -import java.util.Set; -import org.checkerframework.checker.nullness.qual.Nullable; -import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags; -import org.openapijsonschematools.client.configurations.SchemaConfiguration; -import org.openapijsonschematools.client.exceptions.UnsetPropertyException; -import org.openapijsonschematools.client.exceptions.ValidationException; -import org.openapijsonschematools.client.schemas.AnyTypeJsonSchema; -import org.openapijsonschematools.client.schemas.GenericBuilder; -import org.openapijsonschematools.client.schemas.NotAnyTypeJsonSchema; -import org.openapijsonschematools.client.schemas.SetMaker; -import org.openapijsonschematools.client.schemas.StringJsonSchema; -import org.openapijsonschematools.client.schemas.validation.FrozenMap; -import org.openapijsonschematools.client.schemas.validation.JsonSchema; -import org.openapijsonschematools.client.schemas.validation.JsonSchemaInfo; -import org.openapijsonschematools.client.schemas.validation.MapSchemaValidator; -import org.openapijsonschematools.client.schemas.validation.MapUtils; -import org.openapijsonschematools.client.schemas.validation.PathToSchemasMap; -import org.openapijsonschematools.client.schemas.validation.PropertyEntry; -import org.openapijsonschematools.client.schemas.validation.StringEnumValidator; -import org.openapijsonschematools.client.schemas.validation.StringSchemaValidator; -import org.openapijsonschematools.client.schemas.validation.StringValueMethod; -import org.openapijsonschematools.client.schemas.validation.ValidationMetadata; - -public class JSONPatchRequestRemove { - // nest classes so all schemas and input/output classes can be public - - - public static class AdditionalProperties extends NotAnyTypeJsonSchema.NotAnyTypeJsonSchema1 { - // NotAnyTypeSchema - private static @Nullable AdditionalProperties instance = null; - public static AdditionalProperties getInstance() { - if (instance == null) { - instance = new AdditionalProperties(); - } - return instance; - } - } - - - public static class Path extends StringJsonSchema.StringJsonSchema1 { - private static @Nullable Path instance = null; - public static Path getInstance() { - if (instance == null) { - instance = new Path(); - } - return instance; - } - } - - public enum StringOpEnums implements StringValueMethod { - REMOVE("remove"); - private final String value; - - StringOpEnums(String value) { - this.value = value; - } - public String value() { - return this.value; - } - } - - - public sealed interface OpBoxed permits OpBoxedString { - @Nullable Object getData(); - } - - public record OpBoxedString(String data) implements OpBoxed { - @Override - public @Nullable Object getData() { - return data; - } - } - - - - public static class Op extends JsonSchema implements StringSchemaValidator, StringEnumValidator { - private static @Nullable Op instance = null; - - protected Op() { - super(new JsonSchemaInfo() - .type(Set.of( - String.class - )) - .enumValues(SetMaker.makeSet( - "remove" - )) - ); - } - - public static Op getInstance() { - if (instance == null) { - instance = new Op(); - } - return instance; - } - - @Override - public String validate(String arg, SchemaConfiguration configuration) throws ValidationException { - Set> pathSet = new HashSet<>(); - List pathToItem = List.of("args[0"); - String castArg = castToAllowedTypes(arg, pathToItem, pathSet); - SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().build())); - ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, new PathToSchemasMap(), new LinkedHashSet<>()); - getPathToSchemas(this, castArg, validationMetadata, pathSet); - return castArg; - } - - @Override - 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 { - 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"); - } - @Override - public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { - 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"); - } - @Override - 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 { - 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"); - } - } - - public static class JSONPatchRequestRemoveMap extends FrozenMap { - protected JSONPatchRequestRemoveMap(FrozenMap m) { - super(m); - } - public static final Set requiredKeys = Set.of( - "op", - "path" - ); - public static final Set optionalKeys = Set.of(); - public static JSONPatchRequestRemoveMap of(Map arg, SchemaConfiguration configuration) throws ValidationException { - return JSONPatchRequestRemove1.getInstance().validate(arg, configuration); - } - - public String op() { - String value = get("op"); - if (!(value instanceof String)) { - throw new RuntimeException("Invalid value stored for op"); - } - return (String) value; - } - - public String path() { - try { - return getOrThrow("version"); - } catch (UnsetPropertyException e) { - throw new RuntimeException(e); - } - } - } - - public interface SetterForOp { - Map getInstance(); - T getBuilderAfterOp(Map instance); - - default T op(String value) { - var instance = getInstance(); - instance.put("op", value); - return getBuilderAfterOp(instance); - } - - default T op(StringOpEnums value) { - var instance = getInstance(); - instance.put("op", value.value()); - return getBuilderAfterOp(instance); - } - } - - public interface SetterForPath { - Map getInstance(); - T getBuilderAfterPath(Map instance); - - default T path(String value) { - var instance = getInstance(); - instance.put("path", value); - return getBuilderAfterPath(instance); - } - } - - public static class JSONPatchRequestRemoveMap00Builder implements GenericBuilder> { - private final Map instance; - private static final Set knownKeys = Set.of( - "op", - "path" - ); - public Set getKnownKeys() { - return knownKeys; - } - public JSONPatchRequestRemoveMap00Builder(Map instance) { - this.instance = instance; - } - public Map build() { - return instance; - } - } - - public static class JSONPatchRequestRemoveMap01Builder implements SetterForPath { - private final Map instance; - public JSONPatchRequestRemoveMap01Builder(Map instance) { - this.instance = instance; - } - public Map getInstance() { - return instance; - } - public JSONPatchRequestRemoveMap00Builder getBuilderAfterPath(Map instance) { - return new JSONPatchRequestRemoveMap00Builder(instance); - } - } - - public static class JSONPatchRequestRemoveMap10Builder implements SetterForOp { - private final Map instance; - public JSONPatchRequestRemoveMap10Builder(Map instance) { - this.instance = instance; - } - public Map getInstance() { - return instance; - } - public JSONPatchRequestRemoveMap00Builder getBuilderAfterOp(Map instance) { - return new JSONPatchRequestRemoveMap00Builder(instance); - } - } - - public static class JSONPatchRequestRemoveMapBuilder implements SetterForOp, SetterForPath { - private final Map instance; - public JSONPatchRequestRemoveMapBuilder() { - this.instance = new LinkedHashMap<>(); - } - public Map getInstance() { - return instance; - } - public JSONPatchRequestRemoveMap01Builder getBuilderAfterOp(Map instance) { - return new JSONPatchRequestRemoveMap01Builder(instance); - } - public JSONPatchRequestRemoveMap10Builder getBuilderAfterPath(Map instance) { - return new JSONPatchRequestRemoveMap10Builder(instance); - } - } - - - public sealed interface JSONPatchRequestRemove1Boxed permits JSONPatchRequestRemove1BoxedMap { - @Nullable Object getData(); - } - - public record JSONPatchRequestRemove1BoxedMap(JSONPatchRequestRemoveMap data) implements JSONPatchRequestRemove1Boxed { - @Override - public @Nullable Object getData() { - return data; - } - } - - - public static class JSONPatchRequestRemove1 extends JsonSchema implements MapSchemaValidator { - /* - NOTE: This class is auto generated by OpenAPI JSON Schema Generator. - Ref: https://github.com/openapi-json-schema-tools/openapi-json-schema-generator - - Do not edit the class manually. - */ - private static @Nullable JSONPatchRequestRemove1 instance = null; - - protected JSONPatchRequestRemove1() { - super(new JsonSchemaInfo() - .type(Set.of(Map.class)) - .properties(Map.ofEntries( - new PropertyEntry("path", Path.class), - new PropertyEntry("op", Op.class) - )) - .required(Set.of( - "op", - "path" - )) - .additionalProperties(AdditionalProperties.class) - ); - } - - public static JSONPatchRequestRemove1 getInstance() { - if (instance == null) { - instance = new JSONPatchRequestRemove1(); - } - return instance; - } - - 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 RuntimeException("Invalid non-string key value"); - } - String propertyName = (String) entryKey; - List propertyPathToItem = new ArrayList<>(pathToItem); - propertyPathToItem.add(propertyName); - Object value = entry.getValue(); - LinkedHashMap, Nothing?> schemas = pathToSchemas.get(propertyPathToItem); - if (schemas == null) { - throw new RuntimeException("Validation 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"); - } - properties.put(propertyName, (String) propertyInstance); - } - FrozenMap castProperties = new FrozenMap<>(properties); - return new JSONPatchRequestRemoveMap(castProperties); - } - - 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); - SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().build())); - ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, new PathToSchemasMap(), new LinkedHashSet<>()); - PathToSchemasMap pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet); - return getNewInstance(castArg, validationMetadata.pathToItem(), pathToSchemasMap); - } - - - @Override - public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws 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"); - } - @Override - public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { - if (arg instanceof Map) { - return getNewInstance((Map) arg, pathToItem, pathToSchemas); - } - 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 { - return new JSONPatchRequestRemove1BoxedMap(validate(arg, configuration)); - } - @Override - public JSONPatchRequestRemove1Boxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { - 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"); - } - } - -} diff --git a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/schemas/Mammal.kt b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/schemas/Mammal.kt deleted file mode 100644 index cdb9adce4a4..00000000000 --- a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/schemas/Mammal.kt +++ /dev/null @@ -1,331 +0,0 @@ -package org.openapijsonschematools.client.components.schemas; -import java.time.LocalDate; -import java.time.ZonedDateTime; -import java.util.ArrayList; -import java.util.HashSet; -import java.util.LinkedHashMap; -import java.util.LinkedHashSet; -import java.util.List; -import java.util.Map; -import java.util.Objects; -import java.util.Set; -import java.util.UUID; -import org.checkerframework.checker.nullness.qual.Nullable; -import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags; -import org.openapijsonschematools.client.configurations.SchemaConfiguration; -import org.openapijsonschematools.client.exceptions.InvalidAdditionalPropertyException; -import org.openapijsonschematools.client.exceptions.UnsetPropertyException; -import org.openapijsonschematools.client.exceptions.ValidationException; -import org.openapijsonschematools.client.schemas.UnsetAddPropsSetter; -import org.openapijsonschematools.client.schemas.validation.BooleanSchemaValidator; -import org.openapijsonschematools.client.schemas.validation.FrozenList; -import org.openapijsonschematools.client.schemas.validation.FrozenMap; -import org.openapijsonschematools.client.schemas.validation.JsonSchema; -import org.openapijsonschematools.client.schemas.validation.JsonSchemaInfo; -import org.openapijsonschematools.client.schemas.validation.ListSchemaValidator; -import org.openapijsonschematools.client.schemas.validation.MapSchemaValidator; -import org.openapijsonschematools.client.schemas.validation.NullSchemaValidator; -import org.openapijsonschematools.client.schemas.validation.NumberSchemaValidator; -import org.openapijsonschematools.client.schemas.validation.PathToSchemasMap; -import org.openapijsonschematools.client.schemas.validation.StringSchemaValidator; -import org.openapijsonschematools.client.schemas.validation.ValidationMetadata; - -public class Mammal { - // nest classes so all schemas and input/output classes can be public - - - public sealed interface Mammal1Boxed permits Mammal1BoxedVoid, Mammal1BoxedBoolean, Mammal1BoxedNumber, Mammal1BoxedString, Mammal1BoxedList, Mammal1BoxedMap { - @Nullable Object getData(); - } - - public record Mammal1BoxedVoid(Nothing? data) implements Mammal1Boxed { - @Override - public @Nullable Object getData() { - return data; - } - } - - public record Mammal1BoxedBoolean(boolean data) implements Mammal1Boxed { - @Override - public @Nullable Object getData() { - return data; - } - } - - public record Mammal1BoxedNumber(Number data) implements Mammal1Boxed { - @Override - public @Nullable Object getData() { - return data; - } - } - - public record Mammal1BoxedString(String data) implements Mammal1Boxed { - @Override - public @Nullable Object getData() { - return data; - } - } - - public record Mammal1BoxedList(FrozenList<@Nullable Object> data) implements Mammal1Boxed { - @Override - public @Nullable Object getData() { - return data; - } - } - - public record Mammal1BoxedMap(FrozenMap<@Nullable Object> data) implements Mammal1Boxed { - @Override - public @Nullable Object getData() { - return data; - } - } - - - public static class Mammal1 extends JsonSchema implements NullSchemaValidator, BooleanSchemaValidator, NumberSchemaValidator, StringSchemaValidator, ListSchemaValidator, Mammal1BoxedList>, MapSchemaValidator, Mammal1BoxedMap> { - /* - NOTE: This class is auto generated by OpenAPI JSON Schema Generator. - Ref: https://github.com/openapi-json-schema-tools/openapi-json-schema-generator - - Do not edit the class manually. - */ - private static @Nullable Mammal1 instance = null; - - protected Mammal1() { - super(new JsonSchemaInfo() - .oneOf(List.of( - Whale.Whale1.class, - Zebra.Zebra1.class, - Pig.Pig1.class - )) - ); - } - - public static Mammal1 getInstance() { - if (instance == null) { - instance = new Mammal1(); - } - return instance; - } - - @Override - public Nothing? validate(Nothing? arg, SchemaConfiguration configuration) throws ValidationException { - Set> pathSet = new HashSet<>(); - List pathToItem = List.of("args[0]"); - Nothing? castArg = castToAllowedTypes(arg, pathToItem, pathSet); - SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().build())); - PathToSchemasMap validatedPathToSchemas = new PathToSchemasMap(); - ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, new LinkedHashSet<>()); - getPathToSchemas(this, castArg, validationMetadata, pathSet); - return castArg; - } - - @Override - public boolean validate(boolean arg, SchemaConfiguration configuration) throws ValidationException { - Set> pathSet = new HashSet<>(); - List pathToItem = List.of("args[0]"); - boolean castArg = castToAllowedTypes(arg, pathToItem, pathSet); - SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().build())); - PathToSchemasMap validatedPathToSchemas = new PathToSchemasMap(); - ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, new LinkedHashSet<>()); - getPathToSchemas(this, castArg, validationMetadata, pathSet); - return castArg; - } - - @Override - public Number validate(Number arg, SchemaConfiguration configuration) throws ValidationException { - Set> pathSet = new HashSet<>(); - List pathToItem = List.of("args[0]"); - Number castArg = castToAllowedTypes(arg, pathToItem, pathSet); - SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().build())); - PathToSchemasMap validatedPathToSchemas = new PathToSchemasMap(); - ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, new LinkedHashSet<>()); - getPathToSchemas(this, castArg, validationMetadata, pathSet); - return castArg; - } - - public int validate(int arg, SchemaConfiguration configuration) throws ValidationException { - return (int) validate((Number) arg, configuration); - } - - public long validate(long arg, SchemaConfiguration configuration) throws ValidationException { - return (long) validate((Number) arg, configuration); - } - - public float validate(float arg, SchemaConfiguration configuration) throws ValidationException { - return (float) validate((Number) arg, configuration); - } - - public double validate(double arg, SchemaConfiguration configuration) throws ValidationException { - return (double) validate((Number) arg, configuration); - } - - @Override - public String validate(String arg, SchemaConfiguration configuration) throws ValidationException { - Set> pathSet = new HashSet<>(); - List pathToItem = List.of("args[0]"); - String castArg = castToAllowedTypes(arg, pathToItem, pathSet); - SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().build())); - PathToSchemasMap validatedPathToSchemas = new PathToSchemasMap(); - ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, new LinkedHashSet<>()); - getPathToSchemas(this, castArg, validationMetadata, pathSet); - return castArg; - } - - public String validate(LocalDate arg, SchemaConfiguration configuration) throws ValidationException { - return validate(arg.toString(), configuration); - } - - public String validate(ZonedDateTime arg, SchemaConfiguration configuration) throws ValidationException { - return validate(arg.toString(), configuration); - } - - public String validate(UUID arg, SchemaConfiguration configuration) throws ValidationException { - return validate(arg.toString(), configuration); - } - - @Override - public FrozenList<@Nullable Object> getNewInstance(List arg, List pathToItem, PathToSchemasMap pathToSchemas) { - List<@Nullable Object> items = new ArrayList<>(); - int i = 0; - for (Object item: arg) { - List itemPathToItem = new ArrayList<>(pathToItem); - itemPathToItem.add(i); - LinkedHashMap, Nothing?> schemas = pathToSchemas.get(itemPathToItem); - if (schemas == null) { - throw new RuntimeException("Validation result is invalid, schemas must exist for a pathToItem"); - } - JsonSchema itemSchema = schemas.entrySet().iterator().next().getKey(); - @Nullable Object itemInstance = itemSchema.getNewInstance(item, itemPathToItem, pathToSchemas); - items.add(itemInstance); - i += 1; - } - FrozenList<@Nullable Object> newInstanceItems = new FrozenList<>(items); - return newInstanceItems; - } - - 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); - SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().build())); - ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, new PathToSchemasMap(), new LinkedHashSet<>()); - PathToSchemasMap pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet); - return getNewInstance(castArg, validationMetadata.pathToItem(), pathToSchemasMap); - } - - @Override - 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 RuntimeException("Invalid non-string key value"); - } - String propertyName = (String) entryKey; - List propertyPathToItem = new ArrayList<>(pathToItem); - propertyPathToItem.add(propertyName); - Object value = entry.getValue(); - LinkedHashMap, Nothing?> schemas = pathToSchemas.get(propertyPathToItem); - if (schemas == null) { - throw new RuntimeException("Validation result is invalid, schemas must exist for a pathToItem"); - } - JsonSchema propertySchema = schemas.entrySet().iterator().next().getKey(); - @Nullable Object propertyInstance = propertySchema.getNewInstance(value, propertyPathToItem, pathToSchemas); - properties.put(propertyName, propertyInstance); - } - FrozenMap<@Nullable Object> castProperties = new FrozenMap<>(properties); - return castProperties; - } - - public FrozenMap<@Nullable Object> validate(Map arg, SchemaConfiguration configuration) throws ValidationException { - Set> pathSet = new HashSet<>(); - List pathToItem = List.of("args[0]"); - Map castArg = castToAllowedTypes(arg, pathToItem, pathSet); - SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().build())); - PathToSchemasMap validatedPathToSchemas = new PathToSchemasMap(); - ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, new LinkedHashSet<>()); - PathToSchemasMap pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet); - return getNewInstance(castArg, validationMetadata.pathToItem(), pathToSchemasMap); - } - - @Override - public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { - if (arg == null) { - return validate((Nothing?) null, configuration); - } else if (arg instanceof Boolean) { - boolean boolArg = (Boolean) arg; - return validate(boolArg, configuration); - } else if (arg instanceof Number) { - return validate((Number) arg, configuration); - } else if (arg instanceof String) { - return validate((String) arg, configuration); - } else if (arg instanceof List) { - return validate((List) arg, 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"); - } - @Override - public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { - if (arg == null) { - return getNewInstance((Nothing?) null, pathToItem, pathToSchemas); - } else if (arg instanceof Boolean) { - boolean boolArg = (Boolean) arg; - return getNewInstance(boolArg, pathToItem, pathToSchemas); - } else if (arg instanceof Number) { - return getNewInstance((Number) arg, pathToItem, pathToSchemas); - } else if (arg instanceof String) { - return getNewInstance((String) arg, pathToItem, pathToSchemas); - } else if (arg instanceof List) { - return getNewInstance((List) arg, 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"); - } - @Override - public Mammal1BoxedVoid validateAndBox(Nothing? arg, SchemaConfiguration configuration) throws ValidationException { - return new Mammal1BoxedVoid(validate(arg, configuration)); - } - @Override - 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 { - return new Mammal1BoxedNumber(validate(arg, configuration)); - } - @Override - 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 { - return new Mammal1BoxedList(validate(arg, configuration)); - } - @Override - 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 { - if (arg == null) { - Nothing? castArg = (Nothing?) arg; - return validateAndBox(castArg, configuration); - } else if (arg instanceof Boolean booleanArg) { - boolean castArg = booleanArg; - return validateAndBox(castArg, configuration); - } else if (arg instanceof String castArg) { - return validateAndBox(castArg, configuration); - } else if (arg instanceof Number castArg) { - return validateAndBox(castArg, configuration); - } else if (arg instanceof List castArg) { - 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"); - } - } -} diff --git a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/schemas/MapTest.kt b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/schemas/MapTest.kt deleted file mode 100644 index cd5f0d6fa5c..00000000000 --- a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/schemas/MapTest.kt +++ /dev/null @@ -1,979 +0,0 @@ -package org.openapijsonschematools.client.components.schemas; -import java.util.ArrayList; -import java.util.HashSet; -import java.util.LinkedHashMap; -import java.util.LinkedHashSet; -import java.util.List; -import java.util.Map; -import java.util.Objects; -import java.util.Set; -import org.checkerframework.checker.nullness.qual.Nullable; -import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags; -import org.openapijsonschematools.client.configurations.SchemaConfiguration; -import org.openapijsonschematools.client.exceptions.InvalidAdditionalPropertyException; -import org.openapijsonschematools.client.exceptions.UnsetPropertyException; -import org.openapijsonschematools.client.exceptions.ValidationException; -import org.openapijsonschematools.client.schemas.BooleanJsonSchema; -import org.openapijsonschematools.client.schemas.GenericBuilder; -import org.openapijsonschematools.client.schemas.SetMaker; -import org.openapijsonschematools.client.schemas.StringJsonSchema; -import org.openapijsonschematools.client.schemas.UnsetAddPropsSetter; -import org.openapijsonschematools.client.schemas.validation.FrozenMap; -import org.openapijsonschematools.client.schemas.validation.JsonSchema; -import org.openapijsonschematools.client.schemas.validation.JsonSchemaInfo; -import org.openapijsonschematools.client.schemas.validation.MapSchemaValidator; -import org.openapijsonschematools.client.schemas.validation.MapUtils; -import org.openapijsonschematools.client.schemas.validation.PathToSchemasMap; -import org.openapijsonschematools.client.schemas.validation.PropertyEntry; -import org.openapijsonschematools.client.schemas.validation.StringEnumValidator; -import org.openapijsonschematools.client.schemas.validation.StringSchemaValidator; -import org.openapijsonschematools.client.schemas.validation.StringValueMethod; -import org.openapijsonschematools.client.schemas.validation.ValidationMetadata; - -public class MapTest { - // nest classes so all schemas and input/output classes can be public - - - public static class AdditionalProperties1 extends StringJsonSchema.StringJsonSchema1 { - private static @Nullable AdditionalProperties1 instance = null; - public static AdditionalProperties1 getInstance() { - if (instance == null) { - instance = new AdditionalProperties1(); - } - return instance; - } - } - - - public static class AdditionalPropertiesMap extends FrozenMap { - protected AdditionalPropertiesMap(FrozenMap m) { - super(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 { - return AdditionalProperties.getInstance().validate(arg, configuration); - } - - public String getAdditionalProperty(String name) throws UnsetPropertyException { - return getOrThrow(name); - } - } - - public interface SetterForAdditionalProperties1 { - Set getKnownKeys(); - Map getInstance(); - T getBuilderAfterAdditionalProperty(Map instance); - - default T additionalProperty(String key, String value) throws InvalidAdditionalPropertyException { - MapUtils.throwIfKeyKnown(key, getKnownKeys(), true); - var instance = getInstance(); - instance.put(key, value); - return getBuilderAfterAdditionalProperty(instance); - } - } - - public static class AdditionalPropertiesMapBuilder1 implements GenericBuilder>, SetterForAdditionalProperties1 { - private final Map instance; - private static final Set knownKeys = Set.of(); - public Set getKnownKeys() { - return knownKeys; - } - public AdditionalPropertiesMapBuilder1() { - this.instance = new LinkedHashMap<>(); - } - public Map build() { - return instance; - } - public Map getInstance() { - return instance; - } - public AdditionalPropertiesMapBuilder1 getBuilderAfterAdditionalProperty(Map instance) { - return this; - } - } - - - public sealed interface AdditionalPropertiesBoxed permits AdditionalPropertiesBoxedMap { - @Nullable Object getData(); - } - - public record AdditionalPropertiesBoxedMap(AdditionalPropertiesMap data) implements AdditionalPropertiesBoxed { - @Override - public @Nullable Object getData() { - return data; - } - } - - - public static class AdditionalProperties extends JsonSchema implements MapSchemaValidator { - private static @Nullable AdditionalProperties instance = null; - - protected AdditionalProperties() { - super(new JsonSchemaInfo() - .type(Set.of(Map.class)) - .additionalProperties(AdditionalProperties1.class) - ); - } - - public static AdditionalProperties getInstance() { - if (instance == null) { - instance = new AdditionalProperties(); - } - return instance; - } - - 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 RuntimeException("Invalid non-string key value"); - } - String propertyName = (String) entryKey; - List propertyPathToItem = new ArrayList<>(pathToItem); - propertyPathToItem.add(propertyName); - Object value = entry.getValue(); - LinkedHashMap, Nothing?> schemas = pathToSchemas.get(propertyPathToItem); - if (schemas == null) { - throw new RuntimeException("Validation 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"); - } - properties.put(propertyName, (String) propertyInstance); - } - FrozenMap castProperties = new FrozenMap<>(properties); - return new AdditionalPropertiesMap(castProperties); - } - - 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); - SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().build())); - ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, new PathToSchemasMap(), new LinkedHashSet<>()); - PathToSchemasMap pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet); - return getNewInstance(castArg, validationMetadata.pathToItem(), pathToSchemasMap); - } - - - @Override - public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws 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"); - } - @Override - public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { - if (arg instanceof Map) { - return getNewInstance((Map) arg, pathToItem, pathToSchemas); - } - 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 { - return new AdditionalPropertiesBoxedMap(validate(arg, configuration)); - } - @Override - public AdditionalPropertiesBoxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { - 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"); - } - } - - - public static class MapMapOfStringMap extends FrozenMap { - protected MapMapOfStringMap(FrozenMap m) { - super(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 { - return MapMapOfString.getInstance().validate(arg, configuration); - } - - public AdditionalPropertiesMap getAdditionalProperty(String name) throws UnsetPropertyException { - return getOrThrow(name); - } - } - - public interface SetterForAdditionalProperties { - Set getKnownKeys(); - Map> getInstance(); - T getBuilderAfterAdditionalProperty(Map> instance); - - default T additionalProperty(String key, Map value) throws InvalidAdditionalPropertyException { - MapUtils.throwIfKeyKnown(key, getKnownKeys(), true); - var instance = getInstance(); - instance.put(key, value); - return getBuilderAfterAdditionalProperty(instance); - } - } - - public static class MapMapOfStringMapBuilder implements GenericBuilder>>, SetterForAdditionalProperties { - private final Map> instance; - private static final Set knownKeys = Set.of(); - public Set getKnownKeys() { - return knownKeys; - } - public MapMapOfStringMapBuilder() { - this.instance = new LinkedHashMap<>(); - } - public Map> build() { - return instance; - } - public Map> getInstance() { - return instance; - } - public MapMapOfStringMapBuilder getBuilderAfterAdditionalProperty(Map> instance) { - return this; - } - } - - - public sealed interface MapMapOfStringBoxed permits MapMapOfStringBoxedMap { - @Nullable Object getData(); - } - - public record MapMapOfStringBoxedMap(MapMapOfStringMap data) implements MapMapOfStringBoxed { - @Override - public @Nullable Object getData() { - return data; - } - } - - - public static class MapMapOfString extends JsonSchema implements MapSchemaValidator { - private static @Nullable MapMapOfString instance = null; - - protected MapMapOfString() { - super(new JsonSchemaInfo() - .type(Set.of(Map.class)) - .additionalProperties(AdditionalProperties.class) - ); - } - - public static MapMapOfString getInstance() { - if (instance == null) { - instance = new MapMapOfString(); - } - return instance; - } - - 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 RuntimeException("Invalid non-string key value"); - } - String propertyName = (String) entryKey; - List propertyPathToItem = new ArrayList<>(pathToItem); - propertyPathToItem.add(propertyName); - Object value = entry.getValue(); - LinkedHashMap, Nothing?> schemas = pathToSchemas.get(propertyPathToItem); - if (schemas == null) { - throw new RuntimeException("Validation 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"); - } - properties.put(propertyName, (AdditionalPropertiesMap) propertyInstance); - } - FrozenMap castProperties = new FrozenMap<>(properties); - return new MapMapOfStringMap(castProperties); - } - - 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); - SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().build())); - ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, new PathToSchemasMap(), new LinkedHashSet<>()); - PathToSchemasMap pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet); - return getNewInstance(castArg, validationMetadata.pathToItem(), pathToSchemasMap); - } - - - @Override - public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws 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"); - } - @Override - public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { - if (arg instanceof Map) { - return getNewInstance((Map) arg, pathToItem, pathToSchemas); - } - 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 { - return new MapMapOfStringBoxedMap(validate(arg, configuration)); - } - @Override - public MapMapOfStringBoxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { - 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"); - } - } - - public enum StringAdditionalPropertiesEnums implements StringValueMethod { - UPPER("UPPER"), - LOWER("lower"); - private final String value; - - StringAdditionalPropertiesEnums(String value) { - this.value = value; - } - public String value() { - return this.value; - } - } - - - public sealed interface AdditionalProperties2Boxed permits AdditionalProperties2BoxedString { - @Nullable Object getData(); - } - - public record AdditionalProperties2BoxedString(String data) implements AdditionalProperties2Boxed { - @Override - public @Nullable Object getData() { - return data; - } - } - - - - public static class AdditionalProperties2 extends JsonSchema implements StringSchemaValidator, StringEnumValidator { - private static @Nullable AdditionalProperties2 instance = null; - - protected AdditionalProperties2() { - super(new JsonSchemaInfo() - .type(Set.of( - String.class - )) - .enumValues(SetMaker.makeSet( - "UPPER", - "lower" - )) - ); - } - - public static AdditionalProperties2 getInstance() { - if (instance == null) { - instance = new AdditionalProperties2(); - } - return instance; - } - - @Override - public String validate(String arg, SchemaConfiguration configuration) throws ValidationException { - Set> pathSet = new HashSet<>(); - List pathToItem = List.of("args[0"); - String castArg = castToAllowedTypes(arg, pathToItem, pathSet); - SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().build())); - ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, new PathToSchemasMap(), new LinkedHashSet<>()); - getPathToSchemas(this, castArg, validationMetadata, pathSet); - return castArg; - } - - @Override - 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 { - 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"); - } - @Override - public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { - 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"); - } - @Override - 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 { - 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"); - } - } - - public static class MapOfEnumStringMap extends FrozenMap { - protected MapOfEnumStringMap(FrozenMap m) { - super(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 { - return MapOfEnumString.getInstance().validate(arg, configuration); - } - - public String getAdditionalProperty(String name) throws UnsetPropertyException { - return getOrThrow(name); - } - } - - public interface SetterForAdditionalProperties2 { - Set getKnownKeys(); - Map getInstance(); - T getBuilderAfterAdditionalProperty(Map instance); - - default T additionalProperty(String key, String value) throws InvalidAdditionalPropertyException { - MapUtils.throwIfKeyKnown(key, getKnownKeys(), true); - var instance = getInstance(); - instance.put(key, value); - return getBuilderAfterAdditionalProperty(instance); - } - - default T additionalProperty(String key, StringAdditionalPropertiesEnums value) throws InvalidAdditionalPropertyException { - MapUtils.throwIfKeyKnown(key, getKnownKeys(), true); - var instance = getInstance(); - instance.put(key, value.value()); - return getBuilderAfterAdditionalProperty(instance); - } - } - - public static class MapOfEnumStringMapBuilder implements GenericBuilder>, SetterForAdditionalProperties2 { - private final Map instance; - private static final Set knownKeys = Set.of(); - public Set getKnownKeys() { - return knownKeys; - } - public MapOfEnumStringMapBuilder() { - this.instance = new LinkedHashMap<>(); - } - public Map build() { - return instance; - } - public Map getInstance() { - return instance; - } - public MapOfEnumStringMapBuilder getBuilderAfterAdditionalProperty(Map instance) { - return this; - } - } - - - public sealed interface MapOfEnumStringBoxed permits MapOfEnumStringBoxedMap { - @Nullable Object getData(); - } - - public record MapOfEnumStringBoxedMap(MapOfEnumStringMap data) implements MapOfEnumStringBoxed { - @Override - public @Nullable Object getData() { - return data; - } - } - - - public static class MapOfEnumString extends JsonSchema implements MapSchemaValidator { - private static @Nullable MapOfEnumString instance = null; - - protected MapOfEnumString() { - super(new JsonSchemaInfo() - .type(Set.of(Map.class)) - .additionalProperties(AdditionalProperties2.class) - ); - } - - public static MapOfEnumString getInstance() { - if (instance == null) { - instance = new MapOfEnumString(); - } - return instance; - } - - 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 RuntimeException("Invalid non-string key value"); - } - String propertyName = (String) entryKey; - List propertyPathToItem = new ArrayList<>(pathToItem); - propertyPathToItem.add(propertyName); - Object value = entry.getValue(); - LinkedHashMap, Nothing?> schemas = pathToSchemas.get(propertyPathToItem); - if (schemas == null) { - throw new RuntimeException("Validation 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"); - } - properties.put(propertyName, (String) propertyInstance); - } - FrozenMap castProperties = new FrozenMap<>(properties); - return new MapOfEnumStringMap(castProperties); - } - - 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); - SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().build())); - ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, new PathToSchemasMap(), new LinkedHashSet<>()); - PathToSchemasMap pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet); - return getNewInstance(castArg, validationMetadata.pathToItem(), pathToSchemasMap); - } - - - @Override - public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws 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"); - } - @Override - public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { - if (arg instanceof Map) { - return getNewInstance((Map) arg, pathToItem, pathToSchemas); - } - 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 { - return new MapOfEnumStringBoxedMap(validate(arg, configuration)); - } - @Override - public MapOfEnumStringBoxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { - 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"); - } - } - - - public static class AdditionalProperties3 extends BooleanJsonSchema.BooleanJsonSchema1 { - private static @Nullable AdditionalProperties3 instance = null; - public static AdditionalProperties3 getInstance() { - if (instance == null) { - instance = new AdditionalProperties3(); - } - return instance; - } - } - - - public static class DirectMapMap extends FrozenMap { - protected DirectMapMap(FrozenMap m) { - super(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 { - return DirectMap.getInstance().validate(arg, configuration); - } - - public boolean getAdditionalProperty(String name) throws UnsetPropertyException { - throwIfKeyNotPresent(name); - Boolean value = get(name); - if (value == null) { - throw new RuntimeException("Value may not be null"); - } - return (boolean) value; - } - } - - public interface SetterForAdditionalProperties3 { - Set getKnownKeys(); - Map getInstance(); - T getBuilderAfterAdditionalProperty(Map instance); - - default T additionalProperty(String key, boolean value) throws InvalidAdditionalPropertyException { - MapUtils.throwIfKeyKnown(key, getKnownKeys(), true); - var instance = getInstance(); - instance.put(key, value); - return getBuilderAfterAdditionalProperty(instance); - } - } - - public static class DirectMapMapBuilder implements GenericBuilder>, SetterForAdditionalProperties3 { - private final Map instance; - private static final Set knownKeys = Set.of(); - public Set getKnownKeys() { - return knownKeys; - } - public DirectMapMapBuilder() { - this.instance = new LinkedHashMap<>(); - } - public Map build() { - return instance; - } - public Map getInstance() { - return instance; - } - public DirectMapMapBuilder getBuilderAfterAdditionalProperty(Map instance) { - return this; - } - } - - - public sealed interface DirectMapBoxed permits DirectMapBoxedMap { - @Nullable Object getData(); - } - - public record DirectMapBoxedMap(DirectMapMap data) implements DirectMapBoxed { - @Override - public @Nullable Object getData() { - return data; - } - } - - - public static class DirectMap extends JsonSchema implements MapSchemaValidator { - private static @Nullable DirectMap instance = null; - - protected DirectMap() { - super(new JsonSchemaInfo() - .type(Set.of(Map.class)) - .additionalProperties(AdditionalProperties3.class) - ); - } - - public static DirectMap getInstance() { - if (instance == null) { - instance = new DirectMap(); - } - return instance; - } - - 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 RuntimeException("Invalid non-string key value"); - } - String propertyName = (String) entryKey; - List propertyPathToItem = new ArrayList<>(pathToItem); - propertyPathToItem.add(propertyName); - Object value = entry.getValue(); - LinkedHashMap, Nothing?> schemas = pathToSchemas.get(propertyPathToItem); - if (schemas == null) { - throw new RuntimeException("Validation 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"); - } - properties.put(propertyName, (Boolean) propertyInstance); - } - FrozenMap castProperties = new FrozenMap<>(properties); - return new DirectMapMap(castProperties); - } - - 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); - SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().build())); - ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, new PathToSchemasMap(), new LinkedHashSet<>()); - PathToSchemasMap pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet); - return getNewInstance(castArg, validationMetadata.pathToItem(), pathToSchemasMap); - } - - - @Override - public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws 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"); - } - @Override - public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { - if (arg instanceof Map) { - return getNewInstance((Map) arg, pathToItem, pathToSchemas); - } - 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 { - return new DirectMapBoxedMap(validate(arg, configuration)); - } - @Override - public DirectMapBoxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { - 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"); - } - } - - - public static class MapTestMap extends FrozenMap<@Nullable Object> { - protected MapTestMap(FrozenMap<@Nullable Object> m) { - super(m); - } - public static final Set requiredKeys = Set.of(); - public static final Set optionalKeys = Set.of( - "map_map_of_string", - "map_of_enum_string", - "direct_map", - "indirect_map" - ); - public static MapTestMap of(Map arg, SchemaConfiguration configuration) throws ValidationException { - return MapTest1.getInstance().validate(arg, configuration); - } - - public MapMapOfStringMap map_map_of_string() throws UnsetPropertyException { - String key = "map_map_of_string"; - throwIfKeyNotPresent(key); - @Nullable Object value = get(key); - if (!(value instanceof MapMapOfStringMap)) { - throw new RuntimeException("Invalid value stored for map_map_of_string"); - } - return (MapMapOfStringMap) value; - } - - public MapOfEnumStringMap map_of_enum_string() throws UnsetPropertyException { - String key = "map_of_enum_string"; - throwIfKeyNotPresent(key); - @Nullable Object value = get(key); - if (!(value instanceof MapOfEnumStringMap)) { - throw new RuntimeException("Invalid value stored for map_of_enum_string"); - } - return (MapOfEnumStringMap) value; - } - - public DirectMapMap direct_map() throws UnsetPropertyException { - String key = "direct_map"; - throwIfKeyNotPresent(key); - @Nullable Object value = get(key); - if (!(value instanceof DirectMapMap)) { - throw new RuntimeException("Invalid value stored for direct_map"); - } - return (DirectMapMap) value; - } - - public StringBooleanMap.StringBooleanMapMap indirect_map() throws UnsetPropertyException { - String key = "indirect_map"; - throwIfKeyNotPresent(key); - @Nullable Object value = get(key); - if (!(value instanceof StringBooleanMap.StringBooleanMapMap)) { - throw new RuntimeException("Invalid value stored for indirect_map"); - } - return (StringBooleanMap.StringBooleanMapMap) value; - } - - public @Nullable Object getAdditionalProperty(String name) throws UnsetPropertyException, InvalidAdditionalPropertyException { - throwIfKeyKnown(name, requiredKeys, optionalKeys); - throwIfKeyNotPresent(name); - return get(name); - } - } - - public interface SetterForMapMapOfString { - Map getInstance(); - T getBuilderAfterMapMapOfString(Map instance); - - default T map_map_of_string(Map> value) { - var instance = getInstance(); - instance.put("map_map_of_string", value); - return getBuilderAfterMapMapOfString(instance); - } - } - - public interface SetterForMapOfEnumString { - Map getInstance(); - T getBuilderAfterMapOfEnumString(Map instance); - - default T map_of_enum_string(Map value) { - var instance = getInstance(); - instance.put("map_of_enum_string", value); - return getBuilderAfterMapOfEnumString(instance); - } - } - - public interface SetterForDirectMap { - Map getInstance(); - T getBuilderAfterDirectMap(Map instance); - - default T direct_map(Map value) { - var instance = getInstance(); - instance.put("direct_map", value); - return getBuilderAfterDirectMap(instance); - } - } - - public interface SetterForIndirectMap { - Map getInstance(); - T getBuilderAfterIndirectMap(Map instance); - - default T indirect_map(Map value) { - var instance = getInstance(); - instance.put("indirect_map", value); - return getBuilderAfterIndirectMap(instance); - } - } - - public static class MapTestMapBuilder extends UnsetAddPropsSetter implements GenericBuilder>, SetterForMapMapOfString, SetterForMapOfEnumString, SetterForDirectMap, SetterForIndirectMap { - private final Map instance; - private static final Set knownKeys = Set.of( - "map_map_of_string", - "map_of_enum_string", - "direct_map", - "indirect_map" - ); - public Set getKnownKeys() { - return knownKeys; - } - public MapTestMapBuilder() { - this.instance = new LinkedHashMap<>(); - } - public Map build() { - return instance; - } - public Map getInstance() { - return instance; - } - public MapTestMapBuilder getBuilderAfterMapMapOfString(Map instance) { - return this; - } - public MapTestMapBuilder getBuilderAfterMapOfEnumString(Map instance) { - return this; - } - public MapTestMapBuilder getBuilderAfterDirectMap(Map instance) { - return this; - } - public MapTestMapBuilder getBuilderAfterIndirectMap(Map instance) { - return this; - } - public MapTestMapBuilder getBuilderAfterAdditionalProperty(Map instance) { - return this; - } - } - - - public sealed interface MapTest1Boxed permits MapTest1BoxedMap { - @Nullable Object getData(); - } - - public record MapTest1BoxedMap(MapTestMap data) implements MapTest1Boxed { - @Override - public @Nullable Object getData() { - return data; - } - } - - - public static class MapTest1 extends JsonSchema implements MapSchemaValidator { - /* - NOTE: This class is auto generated by OpenAPI JSON Schema Generator. - Ref: https://github.com/openapi-json-schema-tools/openapi-json-schema-generator - - Do not edit the class manually. - */ - private static @Nullable MapTest1 instance = null; - - protected MapTest1() { - super(new JsonSchemaInfo() - .type(Set.of(Map.class)) - .properties(Map.ofEntries( - new PropertyEntry("map_map_of_string", MapMapOfString.class), - new PropertyEntry("map_of_enum_string", MapOfEnumString.class), - new PropertyEntry("direct_map", DirectMap.class), - new PropertyEntry("indirect_map", StringBooleanMap.StringBooleanMap1.class) - )) - ); - } - - public static MapTest1 getInstance() { - if (instance == null) { - instance = new MapTest1(); - } - return instance; - } - - 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 RuntimeException("Invalid non-string key value"); - } - String propertyName = (String) entryKey; - List propertyPathToItem = new ArrayList<>(pathToItem); - propertyPathToItem.add(propertyName); - Object value = entry.getValue(); - LinkedHashMap, Nothing?> schemas = pathToSchemas.get(propertyPathToItem); - if (schemas == null) { - throw new RuntimeException("Validation result is invalid, schemas must exist for a pathToItem"); - } - JsonSchema propertySchema = schemas.entrySet().iterator().next().getKey(); - @Nullable Object propertyInstance = propertySchema.getNewInstance(value, propertyPathToItem, pathToSchemas); - properties.put(propertyName, propertyInstance); - } - FrozenMap<@Nullable Object> castProperties = new FrozenMap<>(properties); - return new MapTestMap(castProperties); - } - - 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); - SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().build())); - ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, new PathToSchemasMap(), new LinkedHashSet<>()); - PathToSchemasMap pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet); - return getNewInstance(castArg, validationMetadata.pathToItem(), pathToSchemasMap); - } - - - @Override - public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws 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"); - } - @Override - public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { - if (arg instanceof Map) { - return getNewInstance((Map) arg, pathToItem, pathToSchemas); - } - 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 { - return new MapTest1BoxedMap(validate(arg, configuration)); - } - @Override - public MapTest1Boxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { - 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"); - } - } - -} diff --git a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/schemas/MixedPropertiesAndAdditionalPropertiesClass.kt b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/schemas/MixedPropertiesAndAdditionalPropertiesClass.kt deleted file mode 100644 index a2e8e4bbfa6..00000000000 --- a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/schemas/MixedPropertiesAndAdditionalPropertiesClass.kt +++ /dev/null @@ -1,396 +0,0 @@ -package org.openapijsonschematools.client.components.schemas; -import java.util.ArrayList; -import java.util.HashSet; -import java.util.LinkedHashMap; -import java.util.LinkedHashSet; -import java.util.List; -import java.util.Map; -import java.util.Objects; -import java.util.Set; -import org.checkerframework.checker.nullness.qual.Nullable; -import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags; -import org.openapijsonschematools.client.configurations.SchemaConfiguration; -import org.openapijsonschematools.client.exceptions.InvalidAdditionalPropertyException; -import org.openapijsonschematools.client.exceptions.UnsetPropertyException; -import org.openapijsonschematools.client.exceptions.ValidationException; -import org.openapijsonschematools.client.schemas.DateTimeJsonSchema; -import org.openapijsonschematools.client.schemas.GenericBuilder; -import org.openapijsonschematools.client.schemas.UnsetAddPropsSetter; -import org.openapijsonschematools.client.schemas.UuidJsonSchema; -import org.openapijsonschematools.client.schemas.validation.FrozenMap; -import org.openapijsonschematools.client.schemas.validation.JsonSchema; -import org.openapijsonschematools.client.schemas.validation.JsonSchemaInfo; -import org.openapijsonschematools.client.schemas.validation.MapSchemaValidator; -import org.openapijsonschematools.client.schemas.validation.MapUtils; -import org.openapijsonschematools.client.schemas.validation.PathToSchemasMap; -import org.openapijsonschematools.client.schemas.validation.PropertyEntry; -import org.openapijsonschematools.client.schemas.validation.ValidationMetadata; - -public class MixedPropertiesAndAdditionalPropertiesClass { - // nest classes so all schemas and input/output classes can be public - - - public static class UuidSchema extends UuidJsonSchema.UuidJsonSchema1 { - private static @Nullable UuidSchema instance = null; - public static UuidSchema getInstance() { - if (instance == null) { - instance = new UuidSchema(); - } - return instance; - } - } - - - public static class DateTime extends DateTimeJsonSchema.DateTimeJsonSchema1 { - private static @Nullable DateTime instance = null; - public static DateTime getInstance() { - if (instance == null) { - instance = new DateTime(); - } - return instance; - } - } - - - public static class MapMap extends FrozenMap { - protected MapMap(FrozenMap m) { - super(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 { - return MapSchema.getInstance().validate(arg, configuration); - } - - public Animal.AnimalMap getAdditionalProperty(String name) throws UnsetPropertyException { - return getOrThrow(name); - } - } - - public interface SetterForAdditionalProperties { - Set getKnownKeys(); - Map> getInstance(); - T getBuilderAfterAdditionalProperty(Map> instance); - - default T additionalProperty(String key, Map value) throws InvalidAdditionalPropertyException { - MapUtils.throwIfKeyKnown(key, getKnownKeys(), true); - var instance = getInstance(); - instance.put(key, value); - return getBuilderAfterAdditionalProperty(instance); - } - } - - public static class MapMapBuilder implements GenericBuilder>>, SetterForAdditionalProperties { - private final Map> instance; - private static final Set knownKeys = Set.of(); - public Set getKnownKeys() { - return knownKeys; - } - public MapMapBuilder() { - this.instance = new LinkedHashMap<>(); - } - public Map> build() { - return instance; - } - public Map> getInstance() { - return instance; - } - public MapMapBuilder getBuilderAfterAdditionalProperty(Map> instance) { - return this; - } - } - - - public sealed interface MapSchemaBoxed permits MapSchemaBoxedMap { - @Nullable Object getData(); - } - - public record MapSchemaBoxedMap(MapMap data) implements MapSchemaBoxed { - @Override - public @Nullable Object getData() { - return data; - } - } - - - public static class MapSchema extends JsonSchema implements MapSchemaValidator { - private static @Nullable MapSchema instance = null; - - protected MapSchema() { - super(new JsonSchemaInfo() - .type(Set.of(Map.class)) - .additionalProperties(Animal.Animal1.class) - ); - } - - public static MapSchema getInstance() { - if (instance == null) { - instance = new MapSchema(); - } - return instance; - } - - 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 RuntimeException("Invalid non-string key value"); - } - String propertyName = (String) entryKey; - List propertyPathToItem = new ArrayList<>(pathToItem); - propertyPathToItem.add(propertyName); - Object value = entry.getValue(); - LinkedHashMap, Nothing?> schemas = pathToSchemas.get(propertyPathToItem); - if (schemas == null) { - throw new RuntimeException("Validation 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"); - } - properties.put(propertyName, (Animal.AnimalMap) propertyInstance); - } - FrozenMap castProperties = new FrozenMap<>(properties); - return new MapMap(castProperties); - } - - 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); - SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().build())); - ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, new PathToSchemasMap(), new LinkedHashSet<>()); - PathToSchemasMap pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet); - return getNewInstance(castArg, validationMetadata.pathToItem(), pathToSchemasMap); - } - - - @Override - public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws 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"); - } - @Override - public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { - if (arg instanceof Map) { - return getNewInstance((Map) arg, pathToItem, pathToSchemas); - } - 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 { - return new MapSchemaBoxedMap(validate(arg, configuration)); - } - @Override - public MapSchemaBoxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { - 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"); - } - } - - - public static class MixedPropertiesAndAdditionalPropertiesClassMap extends FrozenMap<@Nullable Object> { - protected MixedPropertiesAndAdditionalPropertiesClassMap(FrozenMap<@Nullable Object> m) { - super(m); - } - public static final Set requiredKeys = Set.of(); - public static final Set optionalKeys = Set.of( - "uuid", - "dateTime", - "map" - ); - public static MixedPropertiesAndAdditionalPropertiesClassMap of(Map arg, SchemaConfiguration configuration) throws ValidationException { - return MixedPropertiesAndAdditionalPropertiesClass1.getInstance().validate(arg, configuration); - } - - public String dateTime() throws UnsetPropertyException { - String key = "dateTime"; - throwIfKeyNotPresent(key); - @Nullable Object value = get(key); - if (!(value instanceof String)) { - throw new RuntimeException("Invalid value stored for dateTime"); - } - return (String) value; - } - - public @Nullable Object getAdditionalProperty(String name) throws UnsetPropertyException, InvalidAdditionalPropertyException { - throwIfKeyKnown(name, requiredKeys, optionalKeys); - throwIfKeyNotPresent(name); - return get(name); - } - } - - public interface SetterForUuidSchema { - Map getInstance(); - T getBuilderAfterUuidSchema(Map instance); - - default T setUuid(String value) { - var instance = getInstance(); - instance.put("uuid", value); - return getBuilderAfterUuidSchema(instance); - } - } - - public interface SetterForDateTime { - Map getInstance(); - T getBuilderAfterDateTime(Map instance); - - default T dateTime(String value) { - var instance = getInstance(); - instance.put("dateTime", value); - return getBuilderAfterDateTime(instance); - } - } - - public interface SetterForMapSchema { - Map getInstance(); - T getBuilderAfterMapSchema(Map instance); - - default T setMap(Map> value) { - var instance = getInstance(); - instance.put("map", value); - return getBuilderAfterMapSchema(instance); - } - } - - public static class MixedPropertiesAndAdditionalPropertiesClassMapBuilder extends UnsetAddPropsSetter implements GenericBuilder>, SetterForUuidSchema, SetterForDateTime, SetterForMapSchema { - private final Map instance; - private static final Set knownKeys = Set.of( - "uuid", - "dateTime", - "map" - ); - public Set getKnownKeys() { - return knownKeys; - } - public MixedPropertiesAndAdditionalPropertiesClassMapBuilder() { - this.instance = new LinkedHashMap<>(); - } - public Map build() { - return instance; - } - public Map getInstance() { - return instance; - } - public MixedPropertiesAndAdditionalPropertiesClassMapBuilder getBuilderAfterUuidSchema(Map instance) { - return this; - } - public MixedPropertiesAndAdditionalPropertiesClassMapBuilder getBuilderAfterDateTime(Map instance) { - return this; - } - public MixedPropertiesAndAdditionalPropertiesClassMapBuilder getBuilderAfterMapSchema(Map instance) { - return this; - } - public MixedPropertiesAndAdditionalPropertiesClassMapBuilder getBuilderAfterAdditionalProperty(Map instance) { - return this; - } - } - - - public sealed interface MixedPropertiesAndAdditionalPropertiesClass1Boxed permits MixedPropertiesAndAdditionalPropertiesClass1BoxedMap { - @Nullable Object getData(); - } - - public record MixedPropertiesAndAdditionalPropertiesClass1BoxedMap(MixedPropertiesAndAdditionalPropertiesClassMap data) implements MixedPropertiesAndAdditionalPropertiesClass1Boxed { - @Override - public @Nullable Object getData() { - return data; - } - } - - - public static class MixedPropertiesAndAdditionalPropertiesClass1 extends JsonSchema implements MapSchemaValidator { - /* - NOTE: This class is auto generated by OpenAPI JSON Schema Generator. - Ref: https://github.com/openapi-json-schema-tools/openapi-json-schema-generator - - Do not edit the class manually. - */ - private static @Nullable MixedPropertiesAndAdditionalPropertiesClass1 instance = null; - - protected MixedPropertiesAndAdditionalPropertiesClass1() { - super(new JsonSchemaInfo() - .type(Set.of(Map.class)) - .properties(Map.ofEntries( - new PropertyEntry("uuid", UuidSchema.class), - new PropertyEntry("dateTime", DateTime.class), - new PropertyEntry("map", MapSchema.class) - )) - ); - } - - public static MixedPropertiesAndAdditionalPropertiesClass1 getInstance() { - if (instance == null) { - instance = new MixedPropertiesAndAdditionalPropertiesClass1(); - } - return instance; - } - - 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 RuntimeException("Invalid non-string key value"); - } - String propertyName = (String) entryKey; - List propertyPathToItem = new ArrayList<>(pathToItem); - propertyPathToItem.add(propertyName); - Object value = entry.getValue(); - LinkedHashMap, Nothing?> schemas = pathToSchemas.get(propertyPathToItem); - if (schemas == null) { - throw new RuntimeException("Validation result is invalid, schemas must exist for a pathToItem"); - } - JsonSchema propertySchema = schemas.entrySet().iterator().next().getKey(); - @Nullable Object propertyInstance = propertySchema.getNewInstance(value, propertyPathToItem, pathToSchemas); - properties.put(propertyName, propertyInstance); - } - FrozenMap<@Nullable Object> castProperties = new FrozenMap<>(properties); - return new MixedPropertiesAndAdditionalPropertiesClassMap(castProperties); - } - - 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); - SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().build())); - ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, new PathToSchemasMap(), new LinkedHashSet<>()); - PathToSchemasMap pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet); - return getNewInstance(castArg, validationMetadata.pathToItem(), pathToSchemasMap); - } - - - @Override - public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws 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"); - } - @Override - public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { - if (arg instanceof Map) { - return getNewInstance((Map) arg, pathToItem, pathToSchemas); - } - 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 { - return new MixedPropertiesAndAdditionalPropertiesClass1BoxedMap(validate(arg, configuration)); - } - @Override - public MixedPropertiesAndAdditionalPropertiesClass1Boxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { - 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"); - } - } - -} diff --git a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/schemas/Money.kt b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/schemas/Money.kt deleted file mode 100644 index 265d11ad1d0..00000000000 --- a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/schemas/Money.kt +++ /dev/null @@ -1,277 +0,0 @@ -package org.openapijsonschematools.client.components.schemas; -import java.util.ArrayList; -import java.util.HashSet; -import java.util.LinkedHashMap; -import java.util.LinkedHashSet; -import java.util.List; -import java.util.Map; -import java.util.Objects; -import java.util.Set; -import org.checkerframework.checker.nullness.qual.Nullable; -import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags; -import org.openapijsonschematools.client.configurations.SchemaConfiguration; -import org.openapijsonschematools.client.exceptions.UnsetPropertyException; -import org.openapijsonschematools.client.exceptions.ValidationException; -import org.openapijsonschematools.client.schemas.AnyTypeJsonSchema; -import org.openapijsonschematools.client.schemas.DecimalJsonSchema; -import org.openapijsonschematools.client.schemas.GenericBuilder; -import org.openapijsonschematools.client.schemas.NotAnyTypeJsonSchema; -import org.openapijsonschematools.client.schemas.validation.FrozenMap; -import org.openapijsonschematools.client.schemas.validation.JsonSchema; -import org.openapijsonschematools.client.schemas.validation.JsonSchemaInfo; -import org.openapijsonschematools.client.schemas.validation.MapSchemaValidator; -import org.openapijsonschematools.client.schemas.validation.MapUtils; -import org.openapijsonschematools.client.schemas.validation.PathToSchemasMap; -import org.openapijsonschematools.client.schemas.validation.PropertyEntry; -import org.openapijsonschematools.client.schemas.validation.ValidationMetadata; - -public class Money { - // nest classes so all schemas and input/output classes can be public - - - public static class AdditionalProperties extends NotAnyTypeJsonSchema.NotAnyTypeJsonSchema1 { - // NotAnyTypeSchema - private static @Nullable AdditionalProperties instance = null; - public static AdditionalProperties getInstance() { - if (instance == null) { - instance = new AdditionalProperties(); - } - return instance; - } - } - - - public static class Amount extends DecimalJsonSchema.DecimalJsonSchema1 { - private static @Nullable Amount instance = null; - public static Amount getInstance() { - if (instance == null) { - instance = new Amount(); - } - return instance; - } - } - - - public static class MoneyMap extends FrozenMap<@Nullable Object> { - protected MoneyMap(FrozenMap<@Nullable Object> m) { - super(m); - } - public static final Set requiredKeys = Set.of( - "amount", - "currency" - ); - public static final Set optionalKeys = Set.of(); - public static MoneyMap of(Map arg, SchemaConfiguration configuration) throws ValidationException { - return Money1.getInstance().validate(arg, configuration); - } - - public String amount() { - @Nullable Object value = get("amount"); - if (!(value instanceof String)) { - throw new RuntimeException("Invalid value stored for amount"); - } - return (String) value; - } - - public String currency() { - @Nullable Object value = get("currency"); - if (!(value instanceof String)) { - throw new RuntimeException("Invalid value stored for currency"); - } - return (String) value; - } - } - - public interface SetterForAmount { - Map getInstance(); - T getBuilderAfterAmount(Map instance); - - default T amount(String value) { - var instance = getInstance(); - instance.put("amount", value); - return getBuilderAfterAmount(instance); - } - } - - public interface SetterForCurrency { - Map getInstance(); - T getBuilderAfterCurrency(Map instance); - - default T currency(String value) { - var instance = getInstance(); - instance.put("currency", value); - return getBuilderAfterCurrency(instance); - } - - default T currency(Currency.StringCurrencyEnums value) { - var instance = getInstance(); - instance.put("currency", value.value()); - return getBuilderAfterCurrency(instance); - } - } - - public static class MoneyMap00Builder implements GenericBuilder> { - private final Map instance; - private static final Set knownKeys = Set.of( - "amount", - "currency" - ); - public Set getKnownKeys() { - return knownKeys; - } - public MoneyMap00Builder(Map instance) { - this.instance = instance; - } - public Map build() { - return instance; - } - } - - public static class MoneyMap01Builder implements SetterForCurrency { - private final Map instance; - public MoneyMap01Builder(Map instance) { - this.instance = instance; - } - public Map getInstance() { - return instance; - } - public MoneyMap00Builder getBuilderAfterCurrency(Map instance) { - return new MoneyMap00Builder(instance); - } - } - - public static class MoneyMap10Builder implements SetterForAmount { - private final Map instance; - public MoneyMap10Builder(Map instance) { - this.instance = instance; - } - public Map getInstance() { - return instance; - } - public MoneyMap00Builder getBuilderAfterAmount(Map instance) { - return new MoneyMap00Builder(instance); - } - } - - public static class MoneyMapBuilder implements SetterForAmount, SetterForCurrency { - private final Map instance; - public MoneyMapBuilder() { - this.instance = new LinkedHashMap<>(); - } - public Map getInstance() { - return instance; - } - public MoneyMap01Builder getBuilderAfterAmount(Map instance) { - return new MoneyMap01Builder(instance); - } - public MoneyMap10Builder getBuilderAfterCurrency(Map instance) { - return new MoneyMap10Builder(instance); - } - } - - - public sealed interface Money1Boxed permits Money1BoxedMap { - @Nullable Object getData(); - } - - public record Money1BoxedMap(MoneyMap data) implements Money1Boxed { - @Override - public @Nullable Object getData() { - return data; - } - } - - - public static class Money1 extends JsonSchema implements MapSchemaValidator { - /* - NOTE: This class is auto generated by OpenAPI JSON Schema Generator. - Ref: https://github.com/openapi-json-schema-tools/openapi-json-schema-generator - - Do not edit the class manually. - */ - private static @Nullable Money1 instance = null; - - protected Money1() { - super(new JsonSchemaInfo() - .type(Set.of(Map.class)) - .properties(Map.ofEntries( - new PropertyEntry("amount", Amount.class), - new PropertyEntry("currency", Currency.Currency1.class) - )) - .required(Set.of( - "amount", - "currency" - )) - .additionalProperties(AdditionalProperties.class) - ); - } - - public static Money1 getInstance() { - if (instance == null) { - instance = new Money1(); - } - return instance; - } - - 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 RuntimeException("Invalid non-string key value"); - } - String propertyName = (String) entryKey; - List propertyPathToItem = new ArrayList<>(pathToItem); - propertyPathToItem.add(propertyName); - Object value = entry.getValue(); - LinkedHashMap, Nothing?> schemas = pathToSchemas.get(propertyPathToItem); - if (schemas == null) { - throw new RuntimeException("Validation result is invalid, schemas must exist for a pathToItem"); - } - JsonSchema propertySchema = schemas.entrySet().iterator().next().getKey(); - @Nullable Object propertyInstance = propertySchema.getNewInstance(value, propertyPathToItem, pathToSchemas); - properties.put(propertyName, propertyInstance); - } - FrozenMap<@Nullable Object> castProperties = new FrozenMap<>(properties); - return new MoneyMap(castProperties); - } - - 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); - SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().build())); - ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, new PathToSchemasMap(), new LinkedHashSet<>()); - PathToSchemasMap pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet); - return getNewInstance(castArg, validationMetadata.pathToItem(), pathToSchemasMap); - } - - - @Override - public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws 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"); - } - @Override - public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { - if (arg instanceof Map) { - return getNewInstance((Map) arg, pathToItem, pathToSchemas); - } - 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 { - return new Money1BoxedMap(validate(arg, configuration)); - } - @Override - public Money1Boxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { - 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"); - } - } - -} diff --git a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/schemas/MultiPropertiesSchema.kt b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/schemas/MultiPropertiesSchema.kt deleted file mode 100644 index b1c1a23f334..00000000000 --- a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/schemas/MultiPropertiesSchema.kt +++ /dev/null @@ -1,422 +0,0 @@ -package org.openapijsonschematools.client.components.schemas; -import java.util.ArrayList; -import java.util.HashSet; -import java.util.LinkedHashMap; -import java.util.LinkedHashSet; -import java.util.List; -import java.util.Map; -import java.util.Objects; -import java.util.Set; -import org.checkerframework.checker.nullness.qual.Nullable; -import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags; -import org.openapijsonschematools.client.configurations.SchemaConfiguration; -import org.openapijsonschematools.client.exceptions.UnsetPropertyException; -import org.openapijsonschematools.client.exceptions.ValidationException; -import org.openapijsonschematools.client.schemas.AnyTypeJsonSchema; -import org.openapijsonschematools.client.schemas.GenericBuilder; -import org.openapijsonschematools.client.schemas.Int32JsonSchema; -import org.openapijsonschematools.client.schemas.NotAnyTypeJsonSchema; -import org.openapijsonschematools.client.schemas.StringJsonSchema; -import org.openapijsonschematools.client.schemas.validation.FrozenList; -import org.openapijsonschematools.client.schemas.validation.FrozenMap; -import org.openapijsonschematools.client.schemas.validation.JsonSchema; -import org.openapijsonschematools.client.schemas.validation.JsonSchemaInfo; -import org.openapijsonschematools.client.schemas.validation.ListSchemaValidator; -import org.openapijsonschematools.client.schemas.validation.MapSchemaValidator; -import org.openapijsonschematools.client.schemas.validation.MapUtils; -import org.openapijsonschematools.client.schemas.validation.PathToSchemasMap; -import org.openapijsonschematools.client.schemas.validation.PropertyEntry; -import org.openapijsonschematools.client.schemas.validation.ValidationMetadata; - -public class MultiPropertiesSchema { - // nest classes so all schemas and input/output classes can be public - - - public static class AdditionalProperties extends NotAnyTypeJsonSchema.NotAnyTypeJsonSchema1 { - // NotAnyTypeSchema - private static @Nullable AdditionalProperties instance = null; - public static AdditionalProperties getInstance() { - if (instance == null) { - instance = new AdditionalProperties(); - } - return instance; - } - } - - - public static class Status extends Int32JsonSchema.Int32JsonSchema1 { - private static @Nullable Status instance = null; - public static Status getInstance() { - if (instance == null) { - instance = new Status(); - } - return instance; - } - } - - - public static class Message extends StringJsonSchema.StringJsonSchema1 { - private static @Nullable Message instance = null; - public static Message getInstance() { - if (instance == null) { - instance = new Message(); - } - return instance; - } - } - - - public static class DataList extends FrozenList { - protected DataList(FrozenList m) { - super(m); - } - public static DataList of(List> arg, SchemaConfiguration configuration) throws ValidationException { - return Data.getInstance().validate(arg, configuration); - } - } - - public static class DataListBuilder { - // class to build List> - private final List> list; - - public DataListBuilder() { - list = new ArrayList<>(); - } - - public DataListBuilder(List> list) { - this.list = list; - } - - public DataListBuilder add(Map item) { - list.add(item); - return this; - } - - public List> build() { - return list; - } - } - - - public sealed interface DataBoxed permits DataBoxedList { - @Nullable Object getData(); - } - - public record DataBoxedList(DataList data) implements DataBoxed { - @Override - public @Nullable Object getData() { - return data; - } - } - - - - public static class Data extends JsonSchema implements ListSchemaValidator { - private static @Nullable Data instance = null; - - protected Data() { - super(new JsonSchemaInfo() - .type(Set.of(List.class)) - .items(ItemsSchema.ItemsSchema1.class) - ); - } - - public static Data getInstance() { - if (instance == null) { - instance = new Data(); - } - return instance; - } - - @Override - public DataList getNewInstance(List arg, List pathToItem, PathToSchemasMap pathToSchemas) { - List items = new ArrayList<>(); - int i = 0; - for (Object item: arg) { - List itemPathToItem = new ArrayList<>(pathToItem); - itemPathToItem.add(i); - LinkedHashMap, Nothing?> schemas = pathToSchemas.get(itemPathToItem); - if (schemas == null) { - throw new RuntimeException("Validation 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 ItemsSchema.ItemsSchemaMap)) { - throw new RuntimeException("Invalid instantiated value"); - } - items.add((ItemsSchema.ItemsSchemaMap) itemInstance); - i += 1; - } - FrozenList newInstanceItems = new FrozenList<>(items); - return new DataList(newInstanceItems); - } - - public DataList validate(List arg, SchemaConfiguration configuration) throws ValidationException { - Set> pathSet = new HashSet<>(); - List pathToItem = List.of("args[0"); - List castArg = castToAllowedTypes(arg, pathToItem, pathSet); - SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().build())); - ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, new PathToSchemasMap(), new LinkedHashSet<>()); - PathToSchemasMap pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet); - return getNewInstance(castArg, validationMetadata.pathToItem(), pathToSchemasMap); - } - - @Override - public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws 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"); - } - @Override - public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { - 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"); - } - @Override - public DataBoxedList validateAndBox(List arg, SchemaConfiguration configuration) throws ValidationException { - return new DataBoxedList(validate(arg, configuration)); - } - @Override - public DataBoxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { - 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"); - } - } - - public static class MultiPropertiesSchemaMap extends FrozenMap { - protected MultiPropertiesSchemaMap(FrozenMap m) { - super(m); - } - public static final Set requiredKeys = Set.of( - "status" - ); - public static final Set optionalKeys = Set.of( - "data", - "message" - ); - public static MultiPropertiesSchemaMap of(Map arg, SchemaConfiguration configuration) throws ValidationException { - return MultiPropertiesSchema1.getInstance().validate(arg, configuration); - } - - public Number status() { - Object value = get("status"); - if (!(value instanceof Number)) { - throw new RuntimeException("Invalid value stored for status"); - } - return (Number) value; - } - - public DataList data() throws UnsetPropertyException { - String key = "data"; - throwIfKeyNotPresent(key); - Object value = get(key); - if (!(value instanceof DataList)) { - throw new RuntimeException("Invalid value stored for data"); - } - return (DataList) value; - } - - public String message() throws UnsetPropertyException { - String key = "message"; - throwIfKeyNotPresent(key); - Object value = get(key); - if (!(value instanceof String)) { - throw new RuntimeException("Invalid value stored for message"); - } - return (String) value; - } - } - - public interface SetterForStatus { - Map getInstance(); - T getBuilderAfterStatus(Map instance); - - default T status(int value) { - var instance = getInstance(); - instance.put("status", value); - return getBuilderAfterStatus(instance); - } - - default T status(float value) { - var instance = getInstance(); - instance.put("status", value); - return getBuilderAfterStatus(instance); - } - } - - public interface SetterForData { - Map getInstance(); - T getBuilderAfterData(Map instance); - - default T data(List> value) { - var instance = getInstance(); - instance.put("data", value); - return getBuilderAfterData(instance); - } - } - - public interface SetterForMessage { - Map getInstance(); - T getBuilderAfterMessage(Map instance); - - default T message(String value) { - var instance = getInstance(); - instance.put("message", value); - return getBuilderAfterMessage(instance); - } - } - - public static class MultiPropertiesSchemaMap0Builder implements GenericBuilder>, SetterForData, SetterForMessage { - private final Map instance; - private static final Set knownKeys = Set.of( - "status", - "data", - "message" - ); - public Set getKnownKeys() { - return knownKeys; - } - public MultiPropertiesSchemaMap0Builder(Map instance) { - this.instance = instance; - } - public Map build() { - return instance; - } - public Map getInstance() { - return instance; - } - public MultiPropertiesSchemaMap0Builder getBuilderAfterData(Map instance) { - return this; - } - public MultiPropertiesSchemaMap0Builder getBuilderAfterMessage(Map instance) { - return this; - } - } - - public static class MultiPropertiesSchemaMapBuilder implements SetterForStatus { - private final Map instance; - public MultiPropertiesSchemaMapBuilder() { - this.instance = new LinkedHashMap<>(); - } - public Map getInstance() { - return instance; - } - public MultiPropertiesSchemaMap0Builder getBuilderAfterStatus(Map instance) { - return new MultiPropertiesSchemaMap0Builder(instance); - } - } - - - public sealed interface MultiPropertiesSchema1Boxed permits MultiPropertiesSchema1BoxedMap { - @Nullable Object getData(); - } - - public record MultiPropertiesSchema1BoxedMap(MultiPropertiesSchemaMap data) implements MultiPropertiesSchema1Boxed { - @Override - public @Nullable Object getData() { - return data; - } - } - - - public static class MultiPropertiesSchema1 extends JsonSchema implements MapSchemaValidator { - /* - NOTE: This class is auto generated by OpenAPI JSON Schema Generator. - Ref: https://github.com/openapi-json-schema-tools/openapi-json-schema-generator - - Do not edit the class manually. - */ - private static @Nullable MultiPropertiesSchema1 instance = null; - - protected MultiPropertiesSchema1() { - super(new JsonSchemaInfo() - .type(Set.of(Map.class)) - .properties(Map.ofEntries( - new PropertyEntry("status", Status.class), - new PropertyEntry("data", Data.class), - new PropertyEntry("message", Message.class) - )) - .required(Set.of( - "status" - )) - .additionalProperties(AdditionalProperties.class) - ); - } - - public static MultiPropertiesSchema1 getInstance() { - if (instance == null) { - instance = new MultiPropertiesSchema1(); - } - return instance; - } - - public MultiPropertiesSchemaMap 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 RuntimeException("Invalid non-string key value"); - } - String propertyName = (String) entryKey; - List propertyPathToItem = new ArrayList<>(pathToItem); - propertyPathToItem.add(propertyName); - Object value = entry.getValue(); - LinkedHashMap, Nothing?> schemas = pathToSchemas.get(propertyPathToItem); - if (schemas == null) { - throw new RuntimeException("Validation 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"); - } - properties.put(propertyName, (Object) propertyInstance); - } - FrozenMap castProperties = new FrozenMap<>(properties); - return new MultiPropertiesSchemaMap(castProperties); - } - - public MultiPropertiesSchemaMap validate(Map arg, SchemaConfiguration configuration) throws ValidationException { - Set> pathSet = new HashSet<>(); - List pathToItem = List.of("args[0"); - Map castArg = castToAllowedTypes(arg, pathToItem, pathSet); - SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().build())); - ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, new PathToSchemasMap(), new LinkedHashSet<>()); - PathToSchemasMap pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet); - return getNewInstance(castArg, validationMetadata.pathToItem(), pathToSchemasMap); - } - - - @Override - public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws 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"); - } - @Override - public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { - if (arg instanceof Map) { - return getNewInstance((Map) arg, pathToItem, pathToSchemas); - } - throw new RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); - } - @Override - public MultiPropertiesSchema1BoxedMap validateAndBox(Map arg, SchemaConfiguration configuration) throws ValidationException { - return new MultiPropertiesSchema1BoxedMap(validate(arg, configuration)); - } - @Override - public MultiPropertiesSchema1Boxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { - 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"); - } - } - -} diff --git a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/schemas/MyObjectDto.kt b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/schemas/MyObjectDto.kt deleted file mode 100644 index 3483de6cfc0..00000000000 --- a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/schemas/MyObjectDto.kt +++ /dev/null @@ -1,208 +0,0 @@ -package org.openapijsonschematools.client.components.schemas; -import java.util.ArrayList; -import java.util.HashSet; -import java.util.LinkedHashMap; -import java.util.LinkedHashSet; -import java.util.List; -import java.util.Map; -import java.util.Objects; -import java.util.Set; -import org.checkerframework.checker.nullness.qual.Nullable; -import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags; -import org.openapijsonschematools.client.configurations.SchemaConfiguration; -import org.openapijsonschematools.client.exceptions.UnsetPropertyException; -import org.openapijsonschematools.client.exceptions.ValidationException; -import org.openapijsonschematools.client.schemas.AnyTypeJsonSchema; -import org.openapijsonschematools.client.schemas.GenericBuilder; -import org.openapijsonschematools.client.schemas.NotAnyTypeJsonSchema; -import org.openapijsonschematools.client.schemas.UuidJsonSchema; -import org.openapijsonschematools.client.schemas.validation.FrozenMap; -import org.openapijsonschematools.client.schemas.validation.JsonSchema; -import org.openapijsonschematools.client.schemas.validation.JsonSchemaInfo; -import org.openapijsonschematools.client.schemas.validation.MapSchemaValidator; -import org.openapijsonschematools.client.schemas.validation.MapUtils; -import org.openapijsonschematools.client.schemas.validation.PathToSchemasMap; -import org.openapijsonschematools.client.schemas.validation.PropertyEntry; -import org.openapijsonschematools.client.schemas.validation.ValidationMetadata; - -public class MyObjectDto { - // nest classes so all schemas and input/output classes can be public - - - public static class AdditionalProperties extends NotAnyTypeJsonSchema.NotAnyTypeJsonSchema1 { - // NotAnyTypeSchema - private static @Nullable AdditionalProperties instance = null; - public static AdditionalProperties getInstance() { - if (instance == null) { - instance = new AdditionalProperties(); - } - return instance; - } - } - - - public static class Id extends UuidJsonSchema.UuidJsonSchema1 { - private static @Nullable Id instance = null; - public static Id getInstance() { - if (instance == null) { - instance = new Id(); - } - return instance; - } - } - - - public static class MyObjectDtoMap extends FrozenMap { - protected MyObjectDtoMap(FrozenMap m) { - super(m); - } - public static final Set requiredKeys = Set.of(); - public static final Set optionalKeys = Set.of( - "id" - ); - public static MyObjectDtoMap of(Map arg, SchemaConfiguration configuration) throws ValidationException { - return MyObjectDto1.getInstance().validate(arg, configuration); - } - - public String id() throws UnsetPropertyException { - return getOrThrow("id"); - } - } - - public interface SetterForId { - Map getInstance(); - T getBuilderAfterId(Map instance); - - default T id(String value) { - var instance = getInstance(); - instance.put("id", value); - return getBuilderAfterId(instance); - } - } - - public static class MyObjectDtoMapBuilder implements GenericBuilder>, SetterForId { - private final Map instance; - private static final Set knownKeys = Set.of( - "id" - ); - public Set getKnownKeys() { - return knownKeys; - } - public MyObjectDtoMapBuilder() { - this.instance = new LinkedHashMap<>(); - } - public Map build() { - return instance; - } - public Map getInstance() { - return instance; - } - public MyObjectDtoMapBuilder getBuilderAfterId(Map instance) { - return this; - } - } - - - public sealed interface MyObjectDto1Boxed permits MyObjectDto1BoxedMap { - @Nullable Object getData(); - } - - public record MyObjectDto1BoxedMap(MyObjectDtoMap data) implements MyObjectDto1Boxed { - @Override - public @Nullable Object getData() { - return data; - } - } - - - public static class MyObjectDto1 extends JsonSchema implements MapSchemaValidator { - /* - NOTE: This class is auto generated by OpenAPI JSON Schema Generator. - Ref: https://github.com/openapi-json-schema-tools/openapi-json-schema-generator - - Do not edit the class manually. - */ - private static @Nullable MyObjectDto1 instance = null; - - protected MyObjectDto1() { - super(new JsonSchemaInfo() - .type(Set.of(Map.class)) - .properties(Map.ofEntries( - new PropertyEntry("id", Id.class) - )) - .additionalProperties(AdditionalProperties.class) - ); - } - - public static MyObjectDto1 getInstance() { - if (instance == null) { - instance = new MyObjectDto1(); - } - return instance; - } - - 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 RuntimeException("Invalid non-string key value"); - } - String propertyName = (String) entryKey; - List propertyPathToItem = new ArrayList<>(pathToItem); - propertyPathToItem.add(propertyName); - Object value = entry.getValue(); - LinkedHashMap, Nothing?> schemas = pathToSchemas.get(propertyPathToItem); - if (schemas == null) { - throw new RuntimeException("Validation 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"); - } - properties.put(propertyName, (String) propertyInstance); - } - FrozenMap castProperties = new FrozenMap<>(properties); - return new MyObjectDtoMap(castProperties); - } - - 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); - SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().build())); - ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, new PathToSchemasMap(), new LinkedHashSet<>()); - PathToSchemasMap pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet); - return getNewInstance(castArg, validationMetadata.pathToItem(), pathToSchemasMap); - } - - - @Override - public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws 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"); - } - @Override - public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { - if (arg instanceof Map) { - return getNewInstance((Map) arg, pathToItem, pathToSchemas); - } - 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 { - return new MyObjectDto1BoxedMap(validate(arg, configuration)); - } - @Override - public MyObjectDto1Boxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { - 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"); - } - } - -} diff --git a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/schemas/Name.kt b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/schemas/Name.kt deleted file mode 100644 index a66b87538f1..00000000000 --- a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/schemas/Name.kt +++ /dev/null @@ -1,512 +0,0 @@ -package org.openapijsonschematools.client.components.schemas; -import java.time.LocalDate; -import java.time.ZonedDateTime; -import java.util.ArrayList; -import java.util.HashSet; -import java.util.LinkedHashMap; -import java.util.LinkedHashSet; -import java.util.List; -import java.util.Map; -import java.util.Objects; -import java.util.Set; -import java.util.UUID; -import org.checkerframework.checker.nullness.qual.Nullable; -import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags; -import org.openapijsonschematools.client.configurations.SchemaConfiguration; -import org.openapijsonschematools.client.exceptions.InvalidAdditionalPropertyException; -import org.openapijsonschematools.client.exceptions.UnsetPropertyException; -import org.openapijsonschematools.client.exceptions.ValidationException; -import org.openapijsonschematools.client.schemas.GenericBuilder; -import org.openapijsonschematools.client.schemas.Int32JsonSchema; -import org.openapijsonschematools.client.schemas.StringJsonSchema; -import org.openapijsonschematools.client.schemas.UnsetAddPropsSetter; -import org.openapijsonschematools.client.schemas.validation.BooleanSchemaValidator; -import org.openapijsonschematools.client.schemas.validation.FrozenList; -import org.openapijsonschematools.client.schemas.validation.FrozenMap; -import org.openapijsonschematools.client.schemas.validation.JsonSchema; -import org.openapijsonschematools.client.schemas.validation.JsonSchemaInfo; -import org.openapijsonschematools.client.schemas.validation.ListSchemaValidator; -import org.openapijsonschematools.client.schemas.validation.MapSchemaValidator; -import org.openapijsonschematools.client.schemas.validation.NullSchemaValidator; -import org.openapijsonschematools.client.schemas.validation.NumberSchemaValidator; -import org.openapijsonschematools.client.schemas.validation.PathToSchemasMap; -import org.openapijsonschematools.client.schemas.validation.PropertyEntry; -import org.openapijsonschematools.client.schemas.validation.StringSchemaValidator; -import org.openapijsonschematools.client.schemas.validation.ValidationMetadata; - -public class Name { - // nest classes so all schemas and input/output classes can be public - - - public static class Name2 extends Int32JsonSchema.Int32JsonSchema1 { - private static @Nullable Name2 instance = null; - public static Name2 getInstance() { - if (instance == null) { - instance = new Name2(); - } - return instance; - } - } - - - public static class SnakeCase extends Int32JsonSchema.Int32JsonSchema1 { - private static @Nullable SnakeCase instance = null; - public static SnakeCase getInstance() { - if (instance == null) { - instance = new SnakeCase(); - } - return instance; - } - } - - - public static class Property extends StringJsonSchema.StringJsonSchema1 { - private static @Nullable Property instance = null; - public static Property getInstance() { - if (instance == null) { - instance = new Property(); - } - return instance; - } - } - - - public static class NameMap extends FrozenMap<@Nullable Object> { - protected NameMap(FrozenMap<@Nullable Object> m) { - super(m); - } - public static final Set requiredKeys = Set.of( - "name" - ); - public static final Set optionalKeys = Set.of( - "snake_case", - "property" - ); - public static NameMap of(Map arg, SchemaConfiguration configuration) throws ValidationException { - return Name1.getInstance().validate(arg, configuration); - } - - public Number name() { - @Nullable Object value = get("name"); - if (!(value instanceof Number)) { - throw new RuntimeException("Invalid value stored for name"); - } - return (Number) value; - } - - public Number snake_case() throws UnsetPropertyException { - String key = "snake_case"; - throwIfKeyNotPresent(key); - @Nullable Object value = get(key); - if (!(value instanceof Number)) { - throw new RuntimeException("Invalid value stored for snake_case"); - } - return (Number) value; - } - - public String property() throws UnsetPropertyException { - String key = "property"; - throwIfKeyNotPresent(key); - @Nullable Object value = get(key); - if (!(value instanceof String)) { - throw new RuntimeException("Invalid value stored for property"); - } - return (String) value; - } - - public @Nullable Object getAdditionalProperty(String name) throws UnsetPropertyException, InvalidAdditionalPropertyException { - throwIfKeyKnown(name, requiredKeys, optionalKeys); - throwIfKeyNotPresent(name); - return get(name); - } - } - - public interface SetterForName2 { - Map getInstance(); - T getBuilderAfterName2(Map instance); - - default T name(int value) { - var instance = getInstance(); - instance.put("name", value); - return getBuilderAfterName2(instance); - } - - default T name(float value) { - var instance = getInstance(); - instance.put("name", value); - return getBuilderAfterName2(instance); - } - } - - public interface SetterForSnakeCase { - Map getInstance(); - T getBuilderAfterSnakeCase(Map instance); - - default T snake_case(int value) { - var instance = getInstance(); - instance.put("snake_case", value); - return getBuilderAfterSnakeCase(instance); - } - - default T snake_case(float value) { - var instance = getInstance(); - instance.put("snake_case", value); - return getBuilderAfterSnakeCase(instance); - } - } - - public interface SetterForProperty { - Map getInstance(); - T getBuilderAfterProperty(Map instance); - - default T property(String value) { - var instance = getInstance(); - instance.put("property", value); - return getBuilderAfterProperty(instance); - } - } - - public static class NameMap0Builder extends UnsetAddPropsSetter implements GenericBuilder>, SetterForSnakeCase, SetterForProperty { - private final Map instance; - private static final Set knownKeys = Set.of( - "name", - "snake_case", - "property" - ); - public Set getKnownKeys() { - return knownKeys; - } - public NameMap0Builder(Map instance) { - this.instance = instance; - } - public Map build() { - return instance; - } - public Map getInstance() { - return instance; - } - public NameMap0Builder getBuilderAfterSnakeCase(Map instance) { - return this; - } - public NameMap0Builder getBuilderAfterProperty(Map instance) { - return this; - } - public NameMap0Builder getBuilderAfterAdditionalProperty(Map instance) { - return this; - } - } - - public static class NameMapBuilder1 implements SetterForName2 { - private final Map instance; - public NameMapBuilder1() { - this.instance = new LinkedHashMap<>(); - } - public Map getInstance() { - return instance; - } - public NameMap0Builder getBuilderAfterName2(Map instance) { - return new NameMap0Builder(instance); - } - } - - - public sealed interface Name1Boxed permits Name1BoxedVoid, Name1BoxedBoolean, Name1BoxedNumber, Name1BoxedString, Name1BoxedList, Name1BoxedMap { - @Nullable Object getData(); - } - - public record Name1BoxedVoid(Nothing? data) implements Name1Boxed { - @Override - public @Nullable Object getData() { - return data; - } - } - - public record Name1BoxedBoolean(boolean data) implements Name1Boxed { - @Override - public @Nullable Object getData() { - return data; - } - } - - public record Name1BoxedNumber(Number data) implements Name1Boxed { - @Override - public @Nullable Object getData() { - return data; - } - } - - public record Name1BoxedString(String data) implements Name1Boxed { - @Override - public @Nullable Object getData() { - return data; - } - } - - public record Name1BoxedList(FrozenList<@Nullable Object> data) implements Name1Boxed { - @Override - public @Nullable Object getData() { - return data; - } - } - - public record Name1BoxedMap(NameMap data) implements Name1Boxed { - @Override - public @Nullable Object getData() { - return data; - } - } - - - public static class Name1 extends JsonSchema implements NullSchemaValidator, BooleanSchemaValidator, NumberSchemaValidator, StringSchemaValidator, ListSchemaValidator, Name1BoxedList>, MapSchemaValidator { - /* - NOTE: This class is auto generated by OpenAPI JSON Schema Generator. - Ref: https://github.com/openapi-json-schema-tools/openapi-json-schema-generator - - Do not edit the class manually. - - Model for testing model name same as property name - */ - private static @Nullable Name1 instance = null; - - protected Name1() { - super(new JsonSchemaInfo() - .properties(Map.ofEntries( - new PropertyEntry("name", Name2.class), - new PropertyEntry("snake_case", SnakeCase.class), - new PropertyEntry("property", Property.class) - )) - .required(Set.of( - "name" - )) - ); - } - - public static Name1 getInstance() { - if (instance == null) { - instance = new Name1(); - } - return instance; - } - - @Override - public Nothing? validate(Nothing? arg, SchemaConfiguration configuration) throws ValidationException { - Set> pathSet = new HashSet<>(); - List pathToItem = List.of("args[0]"); - Nothing? castArg = castToAllowedTypes(arg, pathToItem, pathSet); - SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().build())); - PathToSchemasMap validatedPathToSchemas = new PathToSchemasMap(); - ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, new LinkedHashSet<>()); - getPathToSchemas(this, castArg, validationMetadata, pathSet); - return castArg; - } - - @Override - public boolean validate(boolean arg, SchemaConfiguration configuration) throws ValidationException { - Set> pathSet = new HashSet<>(); - List pathToItem = List.of("args[0]"); - boolean castArg = castToAllowedTypes(arg, pathToItem, pathSet); - SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().build())); - PathToSchemasMap validatedPathToSchemas = new PathToSchemasMap(); - ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, new LinkedHashSet<>()); - getPathToSchemas(this, castArg, validationMetadata, pathSet); - return castArg; - } - - @Override - public Number validate(Number arg, SchemaConfiguration configuration) throws ValidationException { - Set> pathSet = new HashSet<>(); - List pathToItem = List.of("args[0]"); - Number castArg = castToAllowedTypes(arg, pathToItem, pathSet); - SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().build())); - PathToSchemasMap validatedPathToSchemas = new PathToSchemasMap(); - ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, new LinkedHashSet<>()); - getPathToSchemas(this, castArg, validationMetadata, pathSet); - return castArg; - } - - public int validate(int arg, SchemaConfiguration configuration) throws ValidationException { - return (int) validate((Number) arg, configuration); - } - - public long validate(long arg, SchemaConfiguration configuration) throws ValidationException { - return (long) validate((Number) arg, configuration); - } - - public float validate(float arg, SchemaConfiguration configuration) throws ValidationException { - return (float) validate((Number) arg, configuration); - } - - public double validate(double arg, SchemaConfiguration configuration) throws ValidationException { - return (double) validate((Number) arg, configuration); - } - - @Override - public String validate(String arg, SchemaConfiguration configuration) throws ValidationException { - Set> pathSet = new HashSet<>(); - List pathToItem = List.of("args[0]"); - String castArg = castToAllowedTypes(arg, pathToItem, pathSet); - SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().build())); - PathToSchemasMap validatedPathToSchemas = new PathToSchemasMap(); - ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, new LinkedHashSet<>()); - getPathToSchemas(this, castArg, validationMetadata, pathSet); - return castArg; - } - - public String validate(LocalDate arg, SchemaConfiguration configuration) throws ValidationException { - return validate(arg.toString(), configuration); - } - - public String validate(ZonedDateTime arg, SchemaConfiguration configuration) throws ValidationException { - return validate(arg.toString(), configuration); - } - - public String validate(UUID arg, SchemaConfiguration configuration) throws ValidationException { - return validate(arg.toString(), configuration); - } - - @Override - public FrozenList<@Nullable Object> getNewInstance(List arg, List pathToItem, PathToSchemasMap pathToSchemas) { - List<@Nullable Object> items = new ArrayList<>(); - int i = 0; - for (Object item: arg) { - List itemPathToItem = new ArrayList<>(pathToItem); - itemPathToItem.add(i); - LinkedHashMap, Nothing?> schemas = pathToSchemas.get(itemPathToItem); - if (schemas == null) { - throw new RuntimeException("Validation result is invalid, schemas must exist for a pathToItem"); - } - JsonSchema itemSchema = schemas.entrySet().iterator().next().getKey(); - @Nullable Object itemInstance = itemSchema.getNewInstance(item, itemPathToItem, pathToSchemas); - items.add(itemInstance); - i += 1; - } - FrozenList<@Nullable Object> newInstanceItems = new FrozenList<>(items); - return newInstanceItems; - } - - 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); - SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().build())); - ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, new PathToSchemasMap(), new LinkedHashSet<>()); - PathToSchemasMap pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet); - return getNewInstance(castArg, validationMetadata.pathToItem(), pathToSchemasMap); - } - - @Override - 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 RuntimeException("Invalid non-string key value"); - } - String propertyName = (String) entryKey; - List propertyPathToItem = new ArrayList<>(pathToItem); - propertyPathToItem.add(propertyName); - Object value = entry.getValue(); - LinkedHashMap, Nothing?> schemas = pathToSchemas.get(propertyPathToItem); - if (schemas == null) { - throw new RuntimeException("Validation result is invalid, schemas must exist for a pathToItem"); - } - JsonSchema propertySchema = schemas.entrySet().iterator().next().getKey(); - @Nullable Object propertyInstance = propertySchema.getNewInstance(value, propertyPathToItem, pathToSchemas); - properties.put(propertyName, propertyInstance); - } - FrozenMap<@Nullable Object> castProperties = new FrozenMap<>(properties); - return new NameMap(castProperties); - } - - 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); - SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().build())); - PathToSchemasMap validatedPathToSchemas = new PathToSchemasMap(); - ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, new LinkedHashSet<>()); - PathToSchemasMap pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet); - return getNewInstance(castArg, validationMetadata.pathToItem(), pathToSchemasMap); - } - - @Override - public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { - if (arg == null) { - return validate((Nothing?) null, configuration); - } else if (arg instanceof Boolean) { - boolean boolArg = (Boolean) arg; - return validate(boolArg, configuration); - } else if (arg instanceof Number) { - return validate((Number) arg, configuration); - } else if (arg instanceof String) { - return validate((String) arg, configuration); - } else if (arg instanceof List) { - return validate((List) arg, 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"); - } - @Override - public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { - if (arg == null) { - return getNewInstance((Nothing?) null, pathToItem, pathToSchemas); - } else if (arg instanceof Boolean) { - boolean boolArg = (Boolean) arg; - return getNewInstance(boolArg, pathToItem, pathToSchemas); - } else if (arg instanceof Number) { - return getNewInstance((Number) arg, pathToItem, pathToSchemas); - } else if (arg instanceof String) { - return getNewInstance((String) arg, pathToItem, pathToSchemas); - } else if (arg instanceof List) { - return getNewInstance((List) arg, 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"); - } - @Override - public Name1BoxedVoid validateAndBox(Nothing? arg, SchemaConfiguration configuration) throws ValidationException { - return new Name1BoxedVoid(validate(arg, configuration)); - } - @Override - 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 { - return new Name1BoxedNumber(validate(arg, configuration)); - } - @Override - 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 { - return new Name1BoxedList(validate(arg, configuration)); - } - @Override - 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 { - if (arg == null) { - Nothing? castArg = (Nothing?) arg; - return validateAndBox(castArg, configuration); - } else if (arg instanceof Boolean booleanArg) { - boolean castArg = booleanArg; - return validateAndBox(castArg, configuration); - } else if (arg instanceof String castArg) { - return validateAndBox(castArg, configuration); - } else if (arg instanceof Number castArg) { - return validateAndBox(castArg, configuration); - } else if (arg instanceof List castArg) { - 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"); - } - } -} diff --git a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/schemas/NoAdditionalProperties.kt b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/schemas/NoAdditionalProperties.kt deleted file mode 100644 index f21403e41cb..00000000000 --- a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/schemas/NoAdditionalProperties.kt +++ /dev/null @@ -1,294 +0,0 @@ -package org.openapijsonschematools.client.components.schemas; -import java.util.ArrayList; -import java.util.HashSet; -import java.util.LinkedHashMap; -import java.util.LinkedHashSet; -import java.util.List; -import java.util.Map; -import java.util.Objects; -import java.util.Set; -import org.checkerframework.checker.nullness.qual.Nullable; -import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags; -import org.openapijsonschematools.client.configurations.SchemaConfiguration; -import org.openapijsonschematools.client.exceptions.UnsetPropertyException; -import org.openapijsonschematools.client.exceptions.ValidationException; -import org.openapijsonschematools.client.schemas.AnyTypeJsonSchema; -import org.openapijsonschematools.client.schemas.GenericBuilder; -import org.openapijsonschematools.client.schemas.Int64JsonSchema; -import org.openapijsonschematools.client.schemas.NotAnyTypeJsonSchema; -import org.openapijsonschematools.client.schemas.validation.FrozenMap; -import org.openapijsonschematools.client.schemas.validation.JsonSchema; -import org.openapijsonschematools.client.schemas.validation.JsonSchemaInfo; -import org.openapijsonschematools.client.schemas.validation.MapSchemaValidator; -import org.openapijsonschematools.client.schemas.validation.MapUtils; -import org.openapijsonschematools.client.schemas.validation.PathToSchemasMap; -import org.openapijsonschematools.client.schemas.validation.PropertyEntry; -import org.openapijsonschematools.client.schemas.validation.ValidationMetadata; - -public class NoAdditionalProperties { - // nest classes so all schemas and input/output classes can be public - - - public static class AdditionalProperties extends NotAnyTypeJsonSchema.NotAnyTypeJsonSchema1 { - // NotAnyTypeSchema - private static @Nullable AdditionalProperties instance = null; - public static AdditionalProperties getInstance() { - if (instance == null) { - instance = new AdditionalProperties(); - } - return instance; - } - } - - - public static class Id extends Int64JsonSchema.Int64JsonSchema1 { - private static @Nullable Id instance = null; - public static Id getInstance() { - if (instance == null) { - instance = new Id(); - } - return instance; - } - } - - - public static class PetId extends Int64JsonSchema.Int64JsonSchema1 { - private static @Nullable PetId instance = null; - public static PetId getInstance() { - if (instance == null) { - instance = new PetId(); - } - return instance; - } - } - - - public static class NoAdditionalPropertiesMap extends FrozenMap { - protected NoAdditionalPropertiesMap(FrozenMap m) { - super(m); - } - public static final Set requiredKeys = Set.of( - "id" - ); - public static final Set optionalKeys = Set.of( - "petId" - ); - public static NoAdditionalPropertiesMap of(Map arg, SchemaConfiguration configuration) throws ValidationException { - return NoAdditionalProperties1.getInstance().validate(arg, configuration); - } - - public Number id() { - try { - return getOrThrow("version"); - } catch (UnsetPropertyException e) { - throw new RuntimeException(e); - } - } - - public Number petId() throws UnsetPropertyException { - return getOrThrow("petId"); - } - } - - public interface SetterForId { - Map getInstance(); - T getBuilderAfterId(Map instance); - - default T id(int value) { - var instance = getInstance(); - instance.put("id", value); - return getBuilderAfterId(instance); - } - - default T id(float value) { - var instance = getInstance(); - instance.put("id", value); - return getBuilderAfterId(instance); - } - - default T id(long value) { - var instance = getInstance(); - instance.put("id", value); - return getBuilderAfterId(instance); - } - - default T id(double value) { - var instance = getInstance(); - instance.put("id", value); - return getBuilderAfterId(instance); - } - } - - public interface SetterForPetId { - Map getInstance(); - T getBuilderAfterPetId(Map instance); - - default T petId(int value) { - var instance = getInstance(); - instance.put("petId", value); - return getBuilderAfterPetId(instance); - } - - default T petId(float value) { - var instance = getInstance(); - instance.put("petId", value); - return getBuilderAfterPetId(instance); - } - - default T petId(long value) { - var instance = getInstance(); - instance.put("petId", value); - return getBuilderAfterPetId(instance); - } - - default T petId(double value) { - var instance = getInstance(); - instance.put("petId", value); - return getBuilderAfterPetId(instance); - } - } - - public static class NoAdditionalPropertiesMap0Builder implements GenericBuilder>, SetterForPetId { - private final Map instance; - private static final Set knownKeys = Set.of( - "id", - "petId" - ); - public Set getKnownKeys() { - return knownKeys; - } - public NoAdditionalPropertiesMap0Builder(Map instance) { - this.instance = instance; - } - public Map build() { - return instance; - } - public Map getInstance() { - return instance; - } - public NoAdditionalPropertiesMap0Builder getBuilderAfterPetId(Map instance) { - return this; - } - } - - public static class NoAdditionalPropertiesMapBuilder implements SetterForId { - private final Map instance; - public NoAdditionalPropertiesMapBuilder() { - this.instance = new LinkedHashMap<>(); - } - public Map getInstance() { - return instance; - } - public NoAdditionalPropertiesMap0Builder getBuilderAfterId(Map instance) { - return new NoAdditionalPropertiesMap0Builder(instance); - } - } - - - public sealed interface NoAdditionalProperties1Boxed permits NoAdditionalProperties1BoxedMap { - @Nullable Object getData(); - } - - public record NoAdditionalProperties1BoxedMap(NoAdditionalPropertiesMap data) implements NoAdditionalProperties1Boxed { - @Override - public @Nullable Object getData() { - return data; - } - } - - - public static class NoAdditionalProperties1 extends JsonSchema implements MapSchemaValidator { - /* - NOTE: This class is auto generated by OpenAPI JSON Schema Generator. - Ref: https://github.com/openapi-json-schema-tools/openapi-json-schema-generator - - Do not edit the class manually. - */ - private static @Nullable NoAdditionalProperties1 instance = null; - - protected NoAdditionalProperties1() { - super(new JsonSchemaInfo() - .type(Set.of(Map.class)) - .properties(Map.ofEntries( - new PropertyEntry("id", Id.class), - new PropertyEntry("petId", PetId.class) - )) - .required(Set.of( - "id" - )) - .additionalProperties(AdditionalProperties.class) - ); - } - - public static NoAdditionalProperties1 getInstance() { - if (instance == null) { - instance = new NoAdditionalProperties1(); - } - return instance; - } - - 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 RuntimeException("Invalid non-string key value"); - } - String propertyName = (String) entryKey; - List propertyPathToItem = new ArrayList<>(pathToItem); - propertyPathToItem.add(propertyName); - Object value = entry.getValue(); - LinkedHashMap, Nothing?> schemas = pathToSchemas.get(propertyPathToItem); - if (schemas == null) { - throw new RuntimeException("Validation 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"); - } - properties.put(propertyName, (Number) propertyInstance); - } - FrozenMap castProperties = new FrozenMap<>(properties); - return new NoAdditionalPropertiesMap(castProperties); - } - - 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); - SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().build())); - ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, new PathToSchemasMap(), new LinkedHashSet<>()); - PathToSchemasMap pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet); - return getNewInstance(castArg, validationMetadata.pathToItem(), pathToSchemasMap); - } - - - @Override - public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws 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"); - } - @Override - public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { - if (arg instanceof Map) { - return getNewInstance((Map) arg, pathToItem, pathToSchemas); - } - 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 { - return new NoAdditionalProperties1BoxedMap(validate(arg, configuration)); - } - @Override - public NoAdditionalProperties1Boxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { - 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"); - } - } - -} diff --git a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/schemas/NullableClass.kt b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/schemas/NullableClass.kt deleted file mode 100644 index ee03f17c95d..00000000000 --- a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/schemas/NullableClass.kt +++ /dev/null @@ -1,2834 +0,0 @@ -package org.openapijsonschematools.client.components.schemas; -import java.time.LocalDate; -import java.time.ZonedDateTime; -import java.util.ArrayList; -import java.util.HashSet; -import java.util.LinkedHashMap; -import java.util.LinkedHashSet; -import java.util.List; -import java.util.Map; -import java.util.Objects; -import java.util.Set; -import org.checkerframework.checker.nullness.qual.Nullable; -import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags; -import org.openapijsonschematools.client.configurations.SchemaConfiguration; -import org.openapijsonschematools.client.exceptions.InvalidAdditionalPropertyException; -import org.openapijsonschematools.client.exceptions.UnsetPropertyException; -import org.openapijsonschematools.client.exceptions.ValidationException; -import org.openapijsonschematools.client.schemas.GenericBuilder; -import org.openapijsonschematools.client.schemas.MapJsonSchema; -import org.openapijsonschematools.client.schemas.UnsetAddPropsSetter; -import org.openapijsonschematools.client.schemas.validation.BooleanSchemaValidator; -import org.openapijsonschematools.client.schemas.validation.FrozenList; -import org.openapijsonschematools.client.schemas.validation.FrozenMap; -import org.openapijsonschematools.client.schemas.validation.JsonSchema; -import org.openapijsonschematools.client.schemas.validation.JsonSchemaInfo; -import org.openapijsonschematools.client.schemas.validation.ListSchemaValidator; -import org.openapijsonschematools.client.schemas.validation.MapSchemaValidator; -import org.openapijsonschematools.client.schemas.validation.MapUtils; -import org.openapijsonschematools.client.schemas.validation.NullSchemaValidator; -import org.openapijsonschematools.client.schemas.validation.NumberSchemaValidator; -import org.openapijsonschematools.client.schemas.validation.PathToSchemasMap; -import org.openapijsonschematools.client.schemas.validation.PropertyEntry; -import org.openapijsonschematools.client.schemas.validation.StringSchemaValidator; -import org.openapijsonschematools.client.schemas.validation.ValidationMetadata; - -public class NullableClass { - // nest classes so all schemas and input/output classes can be public - - - public sealed interface AdditionalProperties3Boxed permits AdditionalProperties3BoxedNothing?, AdditionalProperties3BoxedMap { - @Nullable Object getData(); - } - - public record AdditionalProperties3BoxedVoid(Nothing? data) implements AdditionalProperties3Boxed { - @Override - public @Nullable Object getData() { - return data; - } - } - - public record AdditionalProperties3BoxedMap(FrozenMap<@Nullable Object> data) implements AdditionalProperties3Boxed { - @Override - public @Nullable Object getData() { - return data; - } - } - - - public static class AdditionalProperties3 extends JsonSchema implements NullSchemaValidator, MapSchemaValidator, AdditionalProperties3BoxedMap> { - private static @Nullable AdditionalProperties3 instance = null; - - protected AdditionalProperties3() { - super(new JsonSchemaInfo() - .type(Set.of( - Nothing?.class, - Map.class - )) - ); - } - - public static AdditionalProperties3 getInstance() { - if (instance == null) { - instance = new AdditionalProperties3(); - } - return instance; - } - - @Override - public Nothing? validate(Nothing? arg, SchemaConfiguration configuration) throws ValidationException { - Set> pathSet = new HashSet<>(); - List pathToItem = List.of("args[0"); - Nothing? castArg = castToAllowedTypes(arg, pathToItem, pathSet); - SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().build())); - ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, new PathToSchemasMap(), new LinkedHashSet<>()); - getPathToSchemas(this, castArg, validationMetadata, pathSet); - return castArg; - } - - 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 RuntimeException("Invalid non-string key value"); - } - String propertyName = (String) entryKey; - List propertyPathToItem = new ArrayList<>(pathToItem); - propertyPathToItem.add(propertyName); - Object value = entry.getValue(); - LinkedHashMap, Nothing?> schemas = pathToSchemas.get(propertyPathToItem); - if (schemas == null) { - throw new RuntimeException("Validation result is invalid, schemas must exist for a pathToItem"); - } - JsonSchema propertySchema = schemas.entrySet().iterator().next().getKey(); - @Nullable Object propertyInstance = propertySchema.getNewInstance(value, propertyPathToItem, pathToSchemas); - properties.put(propertyName, propertyInstance); - } - FrozenMap<@Nullable Object> castProperties = new FrozenMap<>(properties); - return castProperties; - } - - public FrozenMap<@Nullable Object> validate(Map arg, SchemaConfiguration configuration) throws ValidationException { - Set> pathSet = new HashSet<>(); - List pathToItem = List.of("args[0"); - Map castArg = castToAllowedTypes(arg, pathToItem, pathSet); - SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().build())); - ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, new PathToSchemasMap(), new LinkedHashSet<>()); - PathToSchemasMap pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet); - return getNewInstance(castArg, validationMetadata.pathToItem(), pathToSchemasMap); - } - - - @Override - public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { - if (arg == null) { - return validate((Nothing?) 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"); - } - @Override - public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { - if (arg == null) { - return getNewInstance((Nothing?) 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"); - } - @Override - public AdditionalProperties3BoxedVoid validateAndBox(Nothing? arg, SchemaConfiguration configuration) throws ValidationException { - return new AdditionalProperties3BoxedVoid(validate(arg, configuration)); - } - @Override - 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 { - if (arg == null) { - Nothing? castArg = (Nothing?) 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"); - } - } - - public sealed interface IntegerPropBoxed permits IntegerPropBoxedNothing?, IntegerPropBoxedNumber { - @Nullable Object getData(); - } - - public record IntegerPropBoxedVoid(Nothing? data) implements IntegerPropBoxed { - @Override - public @Nullable Object getData() { - return data; - } - } - - public record IntegerPropBoxedNumber(Number data) implements IntegerPropBoxed { - @Override - public @Nullable Object getData() { - return data; - } - } - - - - public static class IntegerProp extends JsonSchema implements NullSchemaValidator, NumberSchemaValidator { - private static @Nullable IntegerProp instance = null; - - protected IntegerProp() { - super(new JsonSchemaInfo() - .type(Set.of( - Nothing?.class, - Integer.class, - Long.class, - Float.class, - Double.class - )) - .format("int") - ); - } - - public static IntegerProp getInstance() { - if (instance == null) { - instance = new IntegerProp(); - } - return instance; - } - - @Override - public Nothing? validate(Nothing? arg, SchemaConfiguration configuration) throws ValidationException { - Set> pathSet = new HashSet<>(); - List pathToItem = List.of("args[0"); - Nothing? castArg = castToAllowedTypes(arg, pathToItem, pathSet); - SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().build())); - ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, new PathToSchemasMap(), new LinkedHashSet<>()); - getPathToSchemas(this, castArg, validationMetadata, pathSet); - return castArg; - } - - @Override - public Number validate(Number arg, SchemaConfiguration configuration) throws ValidationException { - Set> pathSet = new HashSet<>(); - List pathToItem = List.of("args[0"); - Number castArg = castToAllowedTypes(arg, pathToItem, pathSet); - SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().build())); - ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, new PathToSchemasMap(), new LinkedHashSet<>()); - getPathToSchemas(this, castArg, validationMetadata, pathSet); - return castArg; - } - - public int validate(int arg, SchemaConfiguration configuration) throws ValidationException { - return (int) validate((Number) arg, configuration); - } - - public float validate(float arg, SchemaConfiguration configuration) throws ValidationException { - return (float) validate((Number) arg, configuration); - } - - public long validate(long arg, SchemaConfiguration configuration) throws ValidationException { - return (long) validate((Number) arg, configuration); - } - - 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 { - if (arg == null) { - return validate((Nothing?) 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"); - } - @Override - public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { - if (arg == null) { - return getNewInstance((Nothing?) 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"); - } - @Override - public IntegerPropBoxedVoid validateAndBox(Nothing? arg, SchemaConfiguration configuration) throws ValidationException { - return new IntegerPropBoxedVoid(validate(arg, configuration)); - } - @Override - 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 { - if (arg == null) { - Nothing? castArg = (Nothing?) 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"); - } - } - - public sealed interface NumberPropBoxed permits NumberPropBoxedNothing?, NumberPropBoxedNumber { - @Nullable Object getData(); - } - - public record NumberPropBoxedVoid(Nothing? data) implements NumberPropBoxed { - @Override - public @Nullable Object getData() { - return data; - } - } - - public record NumberPropBoxedNumber(Number data) implements NumberPropBoxed { - @Override - public @Nullable Object getData() { - return data; - } - } - - - - public static class NumberProp extends JsonSchema implements NullSchemaValidator, NumberSchemaValidator { - private static @Nullable NumberProp instance = null; - - protected NumberProp() { - super(new JsonSchemaInfo() - .type(Set.of( - Nothing?.class, - Integer.class, - Long.class, - Float.class, - Double.class - )) - ); - } - - public static NumberProp getInstance() { - if (instance == null) { - instance = new NumberProp(); - } - return instance; - } - - @Override - public Nothing? validate(Nothing? arg, SchemaConfiguration configuration) throws ValidationException { - Set> pathSet = new HashSet<>(); - List pathToItem = List.of("args[0"); - Nothing? castArg = castToAllowedTypes(arg, pathToItem, pathSet); - SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().build())); - ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, new PathToSchemasMap(), new LinkedHashSet<>()); - getPathToSchemas(this, castArg, validationMetadata, pathSet); - return castArg; - } - - @Override - public Number validate(Number arg, SchemaConfiguration configuration) throws ValidationException { - Set> pathSet = new HashSet<>(); - List pathToItem = List.of("args[0"); - Number castArg = castToAllowedTypes(arg, pathToItem, pathSet); - SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().build())); - ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, new PathToSchemasMap(), new LinkedHashSet<>()); - PathToSchemasMap pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet); - return castArg; - } - - public int validate(int arg, SchemaConfiguration configuration) throws ValidationException { - return (int) validate((Number) arg, configuration); - } - - public long validate(long arg, SchemaConfiguration configuration) throws ValidationException { - return (long) validate((Number) arg, configuration); - } - - public float validate(float arg, SchemaConfiguration configuration) throws ValidationException { - return (float) validate((Number) arg, configuration); - } - - 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 { - if (arg == null) { - return validate((Nothing?) 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"); - } - @Override - public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { - if (arg == null) { - return getNewInstance((Nothing?) 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"); - } - @Override - public NumberPropBoxedVoid validateAndBox(Nothing? arg, SchemaConfiguration configuration) throws ValidationException { - return new NumberPropBoxedVoid(validate(arg, configuration)); - } - @Override - 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 { - if (arg == null) { - Nothing? castArg = (Nothing?) 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"); - } - } - - public sealed interface BooleanPropBoxed permits BooleanPropBoxedNothing?, BooleanPropBoxedBoolean { - @Nullable Object getData(); - } - - public record BooleanPropBoxedVoid(Nothing? data) implements BooleanPropBoxed { - @Override - public @Nullable Object getData() { - return data; - } - } - - public record BooleanPropBoxedBoolean(boolean data) implements BooleanPropBoxed { - @Override - public @Nullable Object getData() { - return data; - } - } - - - - public static class BooleanProp extends JsonSchema implements NullSchemaValidator, BooleanSchemaValidator { - private static @Nullable BooleanProp instance = null; - - protected BooleanProp() { - super(new JsonSchemaInfo() - .type(Set.of( - Nothing?.class, - Boolean.class - )) - ); - } - - public static BooleanProp getInstance() { - if (instance == null) { - instance = new BooleanProp(); - } - return instance; - } - - @Override - public Nothing? validate(Nothing? arg, SchemaConfiguration configuration) throws ValidationException { - Set> pathSet = new HashSet<>(); - List pathToItem = List.of("args[0"); - Nothing? castArg = castToAllowedTypes(arg, pathToItem, pathSet); - SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().build())); - ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, new PathToSchemasMap(), new LinkedHashSet<>()); - getPathToSchemas(this, castArg, validationMetadata, pathSet); - return castArg; - } - - @Override - public boolean validate(boolean arg, SchemaConfiguration configuration) throws ValidationException { - Set> pathSet = new HashSet<>(); - List pathToItem = List.of("args[0"); - boolean castArg = castToAllowedTypes(arg, pathToItem, pathSet); - SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().build())); - ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, new PathToSchemasMap(), new LinkedHashSet<>()); - getPathToSchemas(this, castArg, validationMetadata, pathSet); - return castArg; - } - - @Override - public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { - if (arg == null) { - return validate((Nothing?) 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"); - } - @Override - public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { - if (arg == null) { - return getNewInstance((Nothing?) 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"); - } - @Override - public BooleanPropBoxedVoid validateAndBox(Nothing? arg, SchemaConfiguration configuration) throws ValidationException { - return new BooleanPropBoxedVoid(validate(arg, configuration)); - } - @Override - 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 { - if (arg == null) { - Nothing? castArg = (Nothing?) arg; - return validateAndBox(castArg, configuration); - } else 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"); - } - } - - public sealed interface StringPropBoxed permits StringPropBoxedNothing?, StringPropBoxedString { - @Nullable Object getData(); - } - - public record StringPropBoxedVoid(Nothing? data) implements StringPropBoxed { - @Override - public @Nullable Object getData() { - return data; - } - } - - public record StringPropBoxedString(String data) implements StringPropBoxed { - @Override - public @Nullable Object getData() { - return data; - } - } - - - - public static class StringProp extends JsonSchema implements NullSchemaValidator, StringSchemaValidator { - private static @Nullable StringProp instance = null; - - protected StringProp() { - super(new JsonSchemaInfo() - .type(Set.of( - Nothing?.class, - String.class - )) - ); - } - - public static StringProp getInstance() { - if (instance == null) { - instance = new StringProp(); - } - return instance; - } - - @Override - public Nothing? validate(Nothing? arg, SchemaConfiguration configuration) throws ValidationException { - Set> pathSet = new HashSet<>(); - List pathToItem = List.of("args[0"); - Nothing? castArg = castToAllowedTypes(arg, pathToItem, pathSet); - SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().build())); - ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, new PathToSchemasMap(), new LinkedHashSet<>()); - getPathToSchemas(this, castArg, validationMetadata, pathSet); - return castArg; - } - - @Override - public String validate(String arg, SchemaConfiguration configuration) throws ValidationException { - Set> pathSet = new HashSet<>(); - List pathToItem = List.of("args[0"); - String castArg = castToAllowedTypes(arg, pathToItem, pathSet); - SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().build())); - ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, new PathToSchemasMap(), new LinkedHashSet<>()); - getPathToSchemas(this, castArg, validationMetadata, pathSet); - return castArg; - } - - @Override - public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { - if (arg == null) { - return validate((Nothing?) 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"); - } - @Override - public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { - if (arg == null) { - return getNewInstance((Nothing?) 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"); - } - @Override - public StringPropBoxedVoid validateAndBox(Nothing? arg, SchemaConfiguration configuration) throws ValidationException { - return new StringPropBoxedVoid(validate(arg, configuration)); - } - @Override - 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 { - if (arg == null) { - Nothing? castArg = (Nothing?) 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"); - } - } - - public sealed interface DatePropBoxed permits DatePropBoxedNothing?, DatePropBoxedString { - @Nullable Object getData(); - } - - public record DatePropBoxedVoid(Nothing? data) implements DatePropBoxed { - @Override - public @Nullable Object getData() { - return data; - } - } - - public record DatePropBoxedString(String data) implements DatePropBoxed { - @Override - public @Nullable Object getData() { - return data; - } - } - - - - public static class DateProp extends JsonSchema implements NullSchemaValidator, StringSchemaValidator { - private static @Nullable DateProp instance = null; - - protected DateProp() { - super(new JsonSchemaInfo() - .type(Set.of( - Nothing?.class, - String.class - )) - .format("date") - ); - } - - public static DateProp getInstance() { - if (instance == null) { - instance = new DateProp(); - } - return instance; - } - - @Override - public Nothing? validate(Nothing? arg, SchemaConfiguration configuration) throws ValidationException { - Set> pathSet = new HashSet<>(); - List pathToItem = List.of("args[0"); - Nothing? castArg = castToAllowedTypes(arg, pathToItem, pathSet); - SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().build())); - ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, new PathToSchemasMap(), new LinkedHashSet<>()); - getPathToSchemas(this, castArg, validationMetadata, pathSet); - return castArg; - } - - @Override - public String validate(String arg, SchemaConfiguration configuration) throws ValidationException { - Set> pathSet = new HashSet<>(); - List pathToItem = List.of("args[0"); - String castArg = castToAllowedTypes(arg, pathToItem, pathSet); - SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().build())); - ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, new PathToSchemasMap(), new LinkedHashSet<>()); - getPathToSchemas(this, castArg, validationMetadata, pathSet); - return castArg; - } - - @Override - public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { - if (arg == null) { - return validate((Nothing?) 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"); - } - @Override - public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { - if (arg == null) { - return getNewInstance((Nothing?) 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"); - } - @Override - public DatePropBoxedVoid validateAndBox(Nothing? arg, SchemaConfiguration configuration) throws ValidationException { - return new DatePropBoxedVoid(validate(arg, configuration)); - } - @Override - 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 { - if (arg == null) { - Nothing? castArg = (Nothing?) 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"); - } - } - - public sealed interface DatetimePropBoxed permits DatetimePropBoxedNothing?, DatetimePropBoxedString { - @Nullable Object getData(); - } - - public record DatetimePropBoxedVoid(Nothing? data) implements DatetimePropBoxed { - @Override - public @Nullable Object getData() { - return data; - } - } - - public record DatetimePropBoxedString(String data) implements DatetimePropBoxed { - @Override - public @Nullable Object getData() { - return data; - } - } - - - - public static class DatetimeProp extends JsonSchema implements NullSchemaValidator, StringSchemaValidator { - private static @Nullable DatetimeProp instance = null; - - protected DatetimeProp() { - super(new JsonSchemaInfo() - .type(Set.of( - Nothing?.class, - String.class - )) - .format("date-time") - ); - } - - public static DatetimeProp getInstance() { - if (instance == null) { - instance = new DatetimeProp(); - } - return instance; - } - - @Override - public Nothing? validate(Nothing? arg, SchemaConfiguration configuration) throws ValidationException { - Set> pathSet = new HashSet<>(); - List pathToItem = List.of("args[0"); - Nothing? castArg = castToAllowedTypes(arg, pathToItem, pathSet); - SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().build())); - ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, new PathToSchemasMap(), new LinkedHashSet<>()); - getPathToSchemas(this, castArg, validationMetadata, pathSet); - return castArg; - } - - @Override - public String validate(String arg, SchemaConfiguration configuration) throws ValidationException { - Set> pathSet = new HashSet<>(); - List pathToItem = List.of("args[0"); - String castArg = castToAllowedTypes(arg, pathToItem, pathSet); - SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().build())); - ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, new PathToSchemasMap(), new LinkedHashSet<>()); - getPathToSchemas(this, castArg, validationMetadata, pathSet); - return castArg; - } - - @Override - public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { - if (arg == null) { - return validate((Nothing?) 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"); - } - @Override - public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { - if (arg == null) { - return getNewInstance((Nothing?) 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"); - } - @Override - public DatetimePropBoxedVoid validateAndBox(Nothing? arg, SchemaConfiguration configuration) throws ValidationException { - return new DatetimePropBoxedVoid(validate(arg, configuration)); - } - @Override - 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 { - if (arg == null) { - Nothing? castArg = (Nothing?) 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"); - } - } - - public static class Items extends MapJsonSchema.MapJsonSchema1 { - private static @Nullable Items instance = null; - public static Items getInstance() { - if (instance == null) { - instance = new Items(); - } - return instance; - } - } - - - public static class ArrayNullablePropList extends FrozenList> { - protected ArrayNullablePropList(FrozenList> m) { - super(m); - } - public static ArrayNullablePropList of(List> arg, SchemaConfiguration configuration) throws ValidationException { - return ArrayNullableProp.getInstance().validate(arg, configuration); - } - } - - public static class ArrayNullablePropListBuilder { - // class to build List> - private final List> list; - - public ArrayNullablePropListBuilder() { - list = new ArrayList<>(); - } - - public ArrayNullablePropListBuilder(List> list) { - this.list = list; - } - - public ArrayNullablePropListBuilder add(Map item) { - list.add(item); - return this; - } - - public List> build() { - return list; - } - } - - - public sealed interface ArrayNullablePropBoxed permits ArrayNullablePropBoxedNothing?, ArrayNullablePropBoxedList { - @Nullable Object getData(); - } - - public record ArrayNullablePropBoxedVoid(Nothing? data) implements ArrayNullablePropBoxed { - @Override - public @Nullable Object getData() { - return data; - } - } - - public record ArrayNullablePropBoxedList(ArrayNullablePropList data) implements ArrayNullablePropBoxed { - @Override - public @Nullable Object getData() { - return data; - } - } - - - - public static class ArrayNullableProp extends JsonSchema implements NullSchemaValidator, ListSchemaValidator { - private static @Nullable ArrayNullableProp instance = null; - - protected ArrayNullableProp() { - super(new JsonSchemaInfo() - .type(Set.of( - Nothing?.class, - List.class - )) - .items(Items.class) - ); - } - - public static ArrayNullableProp getInstance() { - if (instance == null) { - instance = new ArrayNullableProp(); - } - return instance; - } - - @Override - public Nothing? validate(Nothing? arg, SchemaConfiguration configuration) throws ValidationException { - Set> pathSet = new HashSet<>(); - List pathToItem = List.of("args[0"); - Nothing? castArg = castToAllowedTypes(arg, pathToItem, pathSet); - SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().build())); - ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, new PathToSchemasMap(), new LinkedHashSet<>()); - getPathToSchemas(this, castArg, validationMetadata, pathSet); - return castArg; - } - - @Override - public ArrayNullablePropList getNewInstance(List arg, List pathToItem, PathToSchemasMap pathToSchemas) { - List> items = new ArrayList<>(); - int i = 0; - for (Object item: arg) { - List itemPathToItem = new ArrayList<>(pathToItem); - itemPathToItem.add(i); - LinkedHashMap, Nothing?> schemas = pathToSchemas.get(itemPathToItem); - if (schemas == null) { - throw new RuntimeException("Validation 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"); - } - items.add((FrozenMap) itemInstance); - i += 1; - } - FrozenList> newInstanceItems = new FrozenList<>(items); - return new ArrayNullablePropList(newInstanceItems); - } - - 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); - SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().build())); - ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, new PathToSchemasMap(), new LinkedHashSet<>()); - PathToSchemasMap pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet); - return getNewInstance(castArg, validationMetadata.pathToItem(), pathToSchemasMap); - } - - @Override - public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { - if (arg == null) { - return validate((Nothing?) 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"); - } - @Override - public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { - if (arg == null) { - return getNewInstance((Nothing?) 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"); - } - @Override - public ArrayNullablePropBoxedVoid validateAndBox(Nothing? arg, SchemaConfiguration configuration) throws ValidationException { - return new ArrayNullablePropBoxedVoid(validate(arg, configuration)); - } - @Override - 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 { - if (arg == null) { - Nothing? castArg = (Nothing?) 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"); - } - } - - public sealed interface Items1Boxed permits Items1BoxedNothing?, Items1BoxedMap { - @Nullable Object getData(); - } - - public record Items1BoxedVoid(Nothing? data) implements Items1Boxed { - @Override - public @Nullable Object getData() { - return data; - } - } - - public record Items1BoxedMap(FrozenMap<@Nullable Object> data) implements Items1Boxed { - @Override - public @Nullable Object getData() { - return data; - } - } - - - public static class Items1 extends JsonSchema implements NullSchemaValidator, MapSchemaValidator, Items1BoxedMap> { - private static @Nullable Items1 instance = null; - - protected Items1() { - super(new JsonSchemaInfo() - .type(Set.of( - Nothing?.class, - Map.class - )) - ); - } - - public static Items1 getInstance() { - if (instance == null) { - instance = new Items1(); - } - return instance; - } - - @Override - public Nothing? validate(Nothing? arg, SchemaConfiguration configuration) throws ValidationException { - Set> pathSet = new HashSet<>(); - List pathToItem = List.of("args[0"); - Nothing? castArg = castToAllowedTypes(arg, pathToItem, pathSet); - SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().build())); - ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, new PathToSchemasMap(), new LinkedHashSet<>()); - getPathToSchemas(this, castArg, validationMetadata, pathSet); - return castArg; - } - - 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 RuntimeException("Invalid non-string key value"); - } - String propertyName = (String) entryKey; - List propertyPathToItem = new ArrayList<>(pathToItem); - propertyPathToItem.add(propertyName); - Object value = entry.getValue(); - LinkedHashMap, Nothing?> schemas = pathToSchemas.get(propertyPathToItem); - if (schemas == null) { - throw new RuntimeException("Validation result is invalid, schemas must exist for a pathToItem"); - } - JsonSchema propertySchema = schemas.entrySet().iterator().next().getKey(); - @Nullable Object propertyInstance = propertySchema.getNewInstance(value, propertyPathToItem, pathToSchemas); - properties.put(propertyName, propertyInstance); - } - FrozenMap<@Nullable Object> castProperties = new FrozenMap<>(properties); - return castProperties; - } - - public FrozenMap<@Nullable Object> validate(Map arg, SchemaConfiguration configuration) throws ValidationException { - Set> pathSet = new HashSet<>(); - List pathToItem = List.of("args[0"); - Map castArg = castToAllowedTypes(arg, pathToItem, pathSet); - SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().build())); - ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, new PathToSchemasMap(), new LinkedHashSet<>()); - PathToSchemasMap pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet); - return getNewInstance(castArg, validationMetadata.pathToItem(), pathToSchemasMap); - } - - - @Override - public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { - if (arg == null) { - return validate((Nothing?) 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"); - } - @Override - public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { - if (arg == null) { - return getNewInstance((Nothing?) 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"); - } - @Override - public Items1BoxedVoid validateAndBox(Nothing? arg, SchemaConfiguration configuration) throws ValidationException { - return new Items1BoxedVoid(validate(arg, configuration)); - } - @Override - 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 { - if (arg == null) { - Nothing? castArg = (Nothing?) 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"); - } - } - - public static class ArrayAndItemsNullablePropList extends FrozenList<@Nullable FrozenMap> { - protected ArrayAndItemsNullablePropList(FrozenList<@Nullable FrozenMap> m) { - super(m); - } - public static ArrayAndItemsNullablePropList of(List> arg, SchemaConfiguration configuration) throws ValidationException { - return ArrayAndItemsNullableProp.getInstance().validate(arg, configuration); - } - } - - public static class ArrayAndItemsNullablePropListBuilder { - // class to build List<@Nullable Map> - private final List<@Nullable Map> list; - - public ArrayAndItemsNullablePropListBuilder() { - list = new ArrayList<>(); - } - - public ArrayAndItemsNullablePropListBuilder(List<@Nullable Map> list) { - this.list = list; - } - - public ArrayAndItemsNullablePropListBuilder add(Nothing? item) { - list.add(null); - return this; - } - - public ArrayAndItemsNullablePropListBuilder add(Map item) { - list.add(item); - return this; - } - - public List<@Nullable Map> build() { - return list; - } - } - - - public sealed interface ArrayAndItemsNullablePropBoxed permits ArrayAndItemsNullablePropBoxedNothing?, ArrayAndItemsNullablePropBoxedList { - @Nullable Object getData(); - } - - public record ArrayAndItemsNullablePropBoxedVoid(Nothing? data) implements ArrayAndItemsNullablePropBoxed { - @Override - public @Nullable Object getData() { - return data; - } - } - - public record ArrayAndItemsNullablePropBoxedList(ArrayAndItemsNullablePropList data) implements ArrayAndItemsNullablePropBoxed { - @Override - public @Nullable Object getData() { - return data; - } - } - - - - public static class ArrayAndItemsNullableProp extends JsonSchema implements NullSchemaValidator, ListSchemaValidator { - private static @Nullable ArrayAndItemsNullableProp instance = null; - - protected ArrayAndItemsNullableProp() { - super(new JsonSchemaInfo() - .type(Set.of( - Nothing?.class, - List.class - )) - .items(Items1.class) - ); - } - - public static ArrayAndItemsNullableProp getInstance() { - if (instance == null) { - instance = new ArrayAndItemsNullableProp(); - } - return instance; - } - - @Override - public Nothing? validate(Nothing? arg, SchemaConfiguration configuration) throws ValidationException { - Set> pathSet = new HashSet<>(); - List pathToItem = List.of("args[0"); - Nothing? castArg = castToAllowedTypes(arg, pathToItem, pathSet); - SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().build())); - ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, new PathToSchemasMap(), new LinkedHashSet<>()); - getPathToSchemas(this, castArg, validationMetadata, pathSet); - return castArg; - } - - @Override - public ArrayAndItemsNullablePropList getNewInstance(List arg, List pathToItem, PathToSchemasMap pathToSchemas) { - List<@Nullable FrozenMap> items = new ArrayList<>(); - int i = 0; - for (Object item: arg) { - List itemPathToItem = new ArrayList<>(pathToItem); - itemPathToItem.add(i); - LinkedHashMap, Nothing?> schemas = pathToSchemas.get(itemPathToItem); - if (schemas == null) { - throw new RuntimeException("Validation 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"); - } - items.add((@Nullable FrozenMap) itemInstance); - i += 1; - } - FrozenList<@Nullable FrozenMap> newInstanceItems = new FrozenList<>(items); - return new ArrayAndItemsNullablePropList(newInstanceItems); - } - - 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); - SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().build())); - ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, new PathToSchemasMap(), new LinkedHashSet<>()); - PathToSchemasMap pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet); - return getNewInstance(castArg, validationMetadata.pathToItem(), pathToSchemasMap); - } - - @Override - public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { - if (arg == null) { - return validate((Nothing?) 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"); - } - @Override - public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { - if (arg == null) { - return getNewInstance((Nothing?) 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"); - } - @Override - public ArrayAndItemsNullablePropBoxedVoid validateAndBox(Nothing? arg, SchemaConfiguration configuration) throws ValidationException { - return new ArrayAndItemsNullablePropBoxedVoid(validate(arg, configuration)); - } - @Override - 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 { - if (arg == null) { - Nothing? castArg = (Nothing?) 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"); - } - } - - public sealed interface Items2Boxed permits Items2BoxedNothing?, Items2BoxedMap { - @Nullable Object getData(); - } - - public record Items2BoxedVoid(Nothing? data) implements Items2Boxed { - @Override - public @Nullable Object getData() { - return data; - } - } - - public record Items2BoxedMap(FrozenMap<@Nullable Object> data) implements Items2Boxed { - @Override - public @Nullable Object getData() { - return data; - } - } - - - public static class Items2 extends JsonSchema implements NullSchemaValidator, MapSchemaValidator, Items2BoxedMap> { - private static @Nullable Items2 instance = null; - - protected Items2() { - super(new JsonSchemaInfo() - .type(Set.of( - Nothing?.class, - Map.class - )) - ); - } - - public static Items2 getInstance() { - if (instance == null) { - instance = new Items2(); - } - return instance; - } - - @Override - public Nothing? validate(Nothing? arg, SchemaConfiguration configuration) throws ValidationException { - Set> pathSet = new HashSet<>(); - List pathToItem = List.of("args[0"); - Nothing? castArg = castToAllowedTypes(arg, pathToItem, pathSet); - SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().build())); - ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, new PathToSchemasMap(), new LinkedHashSet<>()); - getPathToSchemas(this, castArg, validationMetadata, pathSet); - return castArg; - } - - 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 RuntimeException("Invalid non-string key value"); - } - String propertyName = (String) entryKey; - List propertyPathToItem = new ArrayList<>(pathToItem); - propertyPathToItem.add(propertyName); - Object value = entry.getValue(); - LinkedHashMap, Nothing?> schemas = pathToSchemas.get(propertyPathToItem); - if (schemas == null) { - throw new RuntimeException("Validation result is invalid, schemas must exist for a pathToItem"); - } - JsonSchema propertySchema = schemas.entrySet().iterator().next().getKey(); - @Nullable Object propertyInstance = propertySchema.getNewInstance(value, propertyPathToItem, pathToSchemas); - properties.put(propertyName, propertyInstance); - } - FrozenMap<@Nullable Object> castProperties = new FrozenMap<>(properties); - return castProperties; - } - - public FrozenMap<@Nullable Object> validate(Map arg, SchemaConfiguration configuration) throws ValidationException { - Set> pathSet = new HashSet<>(); - List pathToItem = List.of("args[0"); - Map castArg = castToAllowedTypes(arg, pathToItem, pathSet); - SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().build())); - ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, new PathToSchemasMap(), new LinkedHashSet<>()); - PathToSchemasMap pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet); - return getNewInstance(castArg, validationMetadata.pathToItem(), pathToSchemasMap); - } - - - @Override - public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { - if (arg == null) { - return validate((Nothing?) 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"); - } - @Override - public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { - if (arg == null) { - return getNewInstance((Nothing?) 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"); - } - @Override - public Items2BoxedVoid validateAndBox(Nothing? arg, SchemaConfiguration configuration) throws ValidationException { - return new Items2BoxedVoid(validate(arg, configuration)); - } - @Override - 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 { - if (arg == null) { - Nothing? castArg = (Nothing?) 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"); - } - } - - public static class ArrayItemsNullableList extends FrozenList<@Nullable FrozenMap> { - protected ArrayItemsNullableList(FrozenList<@Nullable FrozenMap> m) { - super(m); - } - public static ArrayItemsNullableList of(List> arg, SchemaConfiguration configuration) throws ValidationException { - return ArrayItemsNullable.getInstance().validate(arg, configuration); - } - } - - public static class ArrayItemsNullableListBuilder { - // class to build List<@Nullable Map> - private final List<@Nullable Map> list; - - public ArrayItemsNullableListBuilder() { - list = new ArrayList<>(); - } - - public ArrayItemsNullableListBuilder(List<@Nullable Map> list) { - this.list = list; - } - - public ArrayItemsNullableListBuilder add(Nothing? item) { - list.add(null); - return this; - } - - public ArrayItemsNullableListBuilder add(Map item) { - list.add(item); - return this; - } - - public List<@Nullable Map> build() { - return list; - } - } - - - public sealed interface ArrayItemsNullableBoxed permits ArrayItemsNullableBoxedList { - @Nullable Object getData(); - } - - public record ArrayItemsNullableBoxedList(ArrayItemsNullableList data) implements ArrayItemsNullableBoxed { - @Override - public @Nullable Object getData() { - return data; - } - } - - - - public static class ArrayItemsNullable extends JsonSchema implements ListSchemaValidator { - private static @Nullable ArrayItemsNullable instance = null; - - protected ArrayItemsNullable() { - super(new JsonSchemaInfo() - .type(Set.of(List.class)) - .items(Items2.class) - ); - } - - public static ArrayItemsNullable getInstance() { - if (instance == null) { - instance = new ArrayItemsNullable(); - } - return instance; - } - - @Override - public ArrayItemsNullableList getNewInstance(List arg, List pathToItem, PathToSchemasMap pathToSchemas) { - List<@Nullable FrozenMap> items = new ArrayList<>(); - int i = 0; - for (Object item: arg) { - List itemPathToItem = new ArrayList<>(pathToItem); - itemPathToItem.add(i); - LinkedHashMap, Nothing?> schemas = pathToSchemas.get(itemPathToItem); - if (schemas == null) { - throw new RuntimeException("Validation 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"); - } - items.add((@Nullable FrozenMap) itemInstance); - i += 1; - } - FrozenList<@Nullable FrozenMap> newInstanceItems = new FrozenList<>(items); - return new ArrayItemsNullableList(newInstanceItems); - } - - 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); - SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().build())); - ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, new PathToSchemasMap(), new LinkedHashSet<>()); - PathToSchemasMap pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet); - return getNewInstance(castArg, validationMetadata.pathToItem(), pathToSchemasMap); - } - - @Override - public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws 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"); - } - @Override - public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { - 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"); - } - @Override - 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 { - 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"); - } - } - - public static class AdditionalProperties extends MapJsonSchema.MapJsonSchema1 { - private static @Nullable AdditionalProperties instance = null; - public static AdditionalProperties getInstance() { - if (instance == null) { - instance = new AdditionalProperties(); - } - return instance; - } - } - - - public static class ObjectNullablePropMap extends FrozenMap> { - protected ObjectNullablePropMap(FrozenMap> m) { - super(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 { - return ObjectNullableProp.getInstance().validate(arg, configuration); - } - - public FrozenMap getAdditionalProperty(String name) throws UnsetPropertyException { - return getOrThrow(name); - } - } - - public interface SetterForAdditionalProperties { - Set getKnownKeys(); - Map> getInstance(); - T getBuilderAfterAdditionalProperty(Map> instance); - - default T additionalProperty(String key, Map value) throws InvalidAdditionalPropertyException { - MapUtils.throwIfKeyKnown(key, getKnownKeys(), true); - var instance = getInstance(); - instance.put(key, value); - return getBuilderAfterAdditionalProperty(instance); - } - } - - public static class ObjectNullablePropMapBuilder implements GenericBuilder>>, SetterForAdditionalProperties { - private final Map> instance; - private static final Set knownKeys = Set.of(); - public Set getKnownKeys() { - return knownKeys; - } - public ObjectNullablePropMapBuilder() { - this.instance = new LinkedHashMap<>(); - } - public Map> build() { - return instance; - } - public Map> getInstance() { - return instance; - } - public ObjectNullablePropMapBuilder getBuilderAfterAdditionalProperty(Map> instance) { - return this; - } - } - - - public sealed interface ObjectNullablePropBoxed permits ObjectNullablePropBoxedNothing?, ObjectNullablePropBoxedMap { - @Nullable Object getData(); - } - - public record ObjectNullablePropBoxedVoid(Nothing? data) implements ObjectNullablePropBoxed { - @Override - public @Nullable Object getData() { - return data; - } - } - - public record ObjectNullablePropBoxedMap(ObjectNullablePropMap data) implements ObjectNullablePropBoxed { - @Override - public @Nullable Object getData() { - return data; - } - } - - - public static class ObjectNullableProp extends JsonSchema implements NullSchemaValidator, MapSchemaValidator { - private static @Nullable ObjectNullableProp instance = null; - - protected ObjectNullableProp() { - super(new JsonSchemaInfo() - .type(Set.of( - Nothing?.class, - Map.class - )) - .additionalProperties(AdditionalProperties.class) - ); - } - - public static ObjectNullableProp getInstance() { - if (instance == null) { - instance = new ObjectNullableProp(); - } - return instance; - } - - @Override - public Nothing? validate(Nothing? arg, SchemaConfiguration configuration) throws ValidationException { - Set> pathSet = new HashSet<>(); - List pathToItem = List.of("args[0"); - Nothing? castArg = castToAllowedTypes(arg, pathToItem, pathSet); - SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().build())); - ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, new PathToSchemasMap(), new LinkedHashSet<>()); - getPathToSchemas(this, castArg, validationMetadata, pathSet); - return castArg; - } - - 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 RuntimeException("Invalid non-string key value"); - } - String propertyName = (String) entryKey; - List propertyPathToItem = new ArrayList<>(pathToItem); - propertyPathToItem.add(propertyName); - Object value = entry.getValue(); - LinkedHashMap, Nothing?> schemas = pathToSchemas.get(propertyPathToItem); - if (schemas == null) { - throw new RuntimeException("Validation 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"); - } - properties.put(propertyName, (FrozenMap) propertyInstance); - } - FrozenMap> castProperties = new FrozenMap<>(properties); - return new ObjectNullablePropMap(castProperties); - } - - 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); - SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().build())); - ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, new PathToSchemasMap(), new LinkedHashSet<>()); - PathToSchemasMap pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet); - return getNewInstance(castArg, validationMetadata.pathToItem(), pathToSchemasMap); - } - - - @Override - public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { - if (arg == null) { - return validate((Nothing?) 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"); - } - @Override - public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { - if (arg == null) { - return getNewInstance((Nothing?) 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"); - } - @Override - public ObjectNullablePropBoxedVoid validateAndBox(Nothing? arg, SchemaConfiguration configuration) throws ValidationException { - return new ObjectNullablePropBoxedVoid(validate(arg, configuration)); - } - @Override - 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 { - if (arg == null) { - Nothing? castArg = (Nothing?) 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"); - } - } - - public sealed interface AdditionalProperties1Boxed permits AdditionalProperties1BoxedNothing?, AdditionalProperties1BoxedMap { - @Nullable Object getData(); - } - - public record AdditionalProperties1BoxedVoid(Nothing? data) implements AdditionalProperties1Boxed { - @Override - public @Nullable Object getData() { - return data; - } - } - - public record AdditionalProperties1BoxedMap(FrozenMap<@Nullable Object> data) implements AdditionalProperties1Boxed { - @Override - public @Nullable Object getData() { - return data; - } - } - - - public static class AdditionalProperties1 extends JsonSchema implements NullSchemaValidator, MapSchemaValidator, AdditionalProperties1BoxedMap> { - private static @Nullable AdditionalProperties1 instance = null; - - protected AdditionalProperties1() { - super(new JsonSchemaInfo() - .type(Set.of( - Nothing?.class, - Map.class - )) - ); - } - - public static AdditionalProperties1 getInstance() { - if (instance == null) { - instance = new AdditionalProperties1(); - } - return instance; - } - - @Override - public Nothing? validate(Nothing? arg, SchemaConfiguration configuration) throws ValidationException { - Set> pathSet = new HashSet<>(); - List pathToItem = List.of("args[0"); - Nothing? castArg = castToAllowedTypes(arg, pathToItem, pathSet); - SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().build())); - ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, new PathToSchemasMap(), new LinkedHashSet<>()); - getPathToSchemas(this, castArg, validationMetadata, pathSet); - return castArg; - } - - 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 RuntimeException("Invalid non-string key value"); - } - String propertyName = (String) entryKey; - List propertyPathToItem = new ArrayList<>(pathToItem); - propertyPathToItem.add(propertyName); - Object value = entry.getValue(); - LinkedHashMap, Nothing?> schemas = pathToSchemas.get(propertyPathToItem); - if (schemas == null) { - throw new RuntimeException("Validation result is invalid, schemas must exist for a pathToItem"); - } - JsonSchema propertySchema = schemas.entrySet().iterator().next().getKey(); - @Nullable Object propertyInstance = propertySchema.getNewInstance(value, propertyPathToItem, pathToSchemas); - properties.put(propertyName, propertyInstance); - } - FrozenMap<@Nullable Object> castProperties = new FrozenMap<>(properties); - return castProperties; - } - - public FrozenMap<@Nullable Object> validate(Map arg, SchemaConfiguration configuration) throws ValidationException { - Set> pathSet = new HashSet<>(); - List pathToItem = List.of("args[0"); - Map castArg = castToAllowedTypes(arg, pathToItem, pathSet); - SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().build())); - ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, new PathToSchemasMap(), new LinkedHashSet<>()); - PathToSchemasMap pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet); - return getNewInstance(castArg, validationMetadata.pathToItem(), pathToSchemasMap); - } - - - @Override - public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { - if (arg == null) { - return validate((Nothing?) 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"); - } - @Override - public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { - if (arg == null) { - return getNewInstance((Nothing?) 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"); - } - @Override - public AdditionalProperties1BoxedVoid validateAndBox(Nothing? arg, SchemaConfiguration configuration) throws ValidationException { - return new AdditionalProperties1BoxedVoid(validate(arg, configuration)); - } - @Override - 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 { - if (arg == null) { - Nothing? castArg = (Nothing?) 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"); - } - } - - public static class ObjectAndItemsNullablePropMap extends FrozenMap<@Nullable FrozenMap> { - protected ObjectAndItemsNullablePropMap(FrozenMap<@Nullable FrozenMap> m) { - super(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 { - return ObjectAndItemsNullableProp.getInstance().validate(arg, configuration); - } - - public @Nullable FrozenMap getAdditionalProperty(String name) throws UnsetPropertyException { - return getOrThrow(name); - } - } - - public interface SetterForAdditionalProperties1 { - Set getKnownKeys(); - Map> getInstance(); - T getBuilderAfterAdditionalProperty(Map> instance); - - default T additionalProperty(String key, Nothing? value) throws InvalidAdditionalPropertyException { - MapUtils.throwIfKeyKnown(key, getKnownKeys(), true); - var instance = getInstance(); - instance.put(key, null); - return getBuilderAfterAdditionalProperty(instance); - } - - default T additionalProperty(String key, Map value) throws InvalidAdditionalPropertyException { - MapUtils.throwIfKeyKnown(key, getKnownKeys(), true); - var instance = getInstance(); - instance.put(key, value); - return getBuilderAfterAdditionalProperty(instance); - } - } - - public static class ObjectAndItemsNullablePropMapBuilder implements GenericBuilder>>, SetterForAdditionalProperties1 { - private final Map> instance; - private static final Set knownKeys = Set.of(); - public Set getKnownKeys() { - return knownKeys; - } - public ObjectAndItemsNullablePropMapBuilder() { - this.instance = new LinkedHashMap<>(); - } - public Map> build() { - return instance; - } - public Map> getInstance() { - return instance; - } - public ObjectAndItemsNullablePropMapBuilder getBuilderAfterAdditionalProperty(Map> instance) { - return this; - } - } - - - public sealed interface ObjectAndItemsNullablePropBoxed permits ObjectAndItemsNullablePropBoxedNothing?, ObjectAndItemsNullablePropBoxedMap { - @Nullable Object getData(); - } - - public record ObjectAndItemsNullablePropBoxedVoid(Nothing? data) implements ObjectAndItemsNullablePropBoxed { - @Override - public @Nullable Object getData() { - return data; - } - } - - public record ObjectAndItemsNullablePropBoxedMap(ObjectAndItemsNullablePropMap data) implements ObjectAndItemsNullablePropBoxed { - @Override - public @Nullable Object getData() { - return data; - } - } - - - public static class ObjectAndItemsNullableProp extends JsonSchema implements NullSchemaValidator, MapSchemaValidator { - private static @Nullable ObjectAndItemsNullableProp instance = null; - - protected ObjectAndItemsNullableProp() { - super(new JsonSchemaInfo() - .type(Set.of( - Nothing?.class, - Map.class - )) - .additionalProperties(AdditionalProperties1.class) - ); - } - - public static ObjectAndItemsNullableProp getInstance() { - if (instance == null) { - instance = new ObjectAndItemsNullableProp(); - } - return instance; - } - - @Override - public Nothing? validate(Nothing? arg, SchemaConfiguration configuration) throws ValidationException { - Set> pathSet = new HashSet<>(); - List pathToItem = List.of("args[0"); - Nothing? castArg = castToAllowedTypes(arg, pathToItem, pathSet); - SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().build())); - ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, new PathToSchemasMap(), new LinkedHashSet<>()); - getPathToSchemas(this, castArg, validationMetadata, pathSet); - return castArg; - } - - 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 RuntimeException("Invalid non-string key value"); - } - String propertyName = (String) entryKey; - List propertyPathToItem = new ArrayList<>(pathToItem); - propertyPathToItem.add(propertyName); - Object value = entry.getValue(); - LinkedHashMap, Nothing?> schemas = pathToSchemas.get(propertyPathToItem); - if (schemas == null) { - throw new RuntimeException("Validation 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"); - } - properties.put(propertyName, (@Nullable FrozenMap) propertyInstance); - } - FrozenMap<@Nullable FrozenMap> castProperties = new FrozenMap<>(properties); - return new ObjectAndItemsNullablePropMap(castProperties); - } - - 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); - SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().build())); - ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, new PathToSchemasMap(), new LinkedHashSet<>()); - PathToSchemasMap pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet); - return getNewInstance(castArg, validationMetadata.pathToItem(), pathToSchemasMap); - } - - - @Override - public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { - if (arg == null) { - return validate((Nothing?) 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"); - } - @Override - public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { - if (arg == null) { - return getNewInstance((Nothing?) 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"); - } - @Override - public ObjectAndItemsNullablePropBoxedVoid validateAndBox(Nothing? arg, SchemaConfiguration configuration) throws ValidationException { - return new ObjectAndItemsNullablePropBoxedVoid(validate(arg, configuration)); - } - @Override - 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 { - if (arg == null) { - Nothing? castArg = (Nothing?) 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"); - } - } - - public sealed interface AdditionalProperties2Boxed permits AdditionalProperties2BoxedNothing?, AdditionalProperties2BoxedMap { - @Nullable Object getData(); - } - - public record AdditionalProperties2BoxedVoid(Nothing? data) implements AdditionalProperties2Boxed { - @Override - public @Nullable Object getData() { - return data; - } - } - - public record AdditionalProperties2BoxedMap(FrozenMap<@Nullable Object> data) implements AdditionalProperties2Boxed { - @Override - public @Nullable Object getData() { - return data; - } - } - - - public static class AdditionalProperties2 extends JsonSchema implements NullSchemaValidator, MapSchemaValidator, AdditionalProperties2BoxedMap> { - private static @Nullable AdditionalProperties2 instance = null; - - protected AdditionalProperties2() { - super(new JsonSchemaInfo() - .type(Set.of( - Nothing?.class, - Map.class - )) - ); - } - - public static AdditionalProperties2 getInstance() { - if (instance == null) { - instance = new AdditionalProperties2(); - } - return instance; - } - - @Override - public Nothing? validate(Nothing? arg, SchemaConfiguration configuration) throws ValidationException { - Set> pathSet = new HashSet<>(); - List pathToItem = List.of("args[0"); - Nothing? castArg = castToAllowedTypes(arg, pathToItem, pathSet); - SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().build())); - ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, new PathToSchemasMap(), new LinkedHashSet<>()); - getPathToSchemas(this, castArg, validationMetadata, pathSet); - return castArg; - } - - 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 RuntimeException("Invalid non-string key value"); - } - String propertyName = (String) entryKey; - List propertyPathToItem = new ArrayList<>(pathToItem); - propertyPathToItem.add(propertyName); - Object value = entry.getValue(); - LinkedHashMap, Nothing?> schemas = pathToSchemas.get(propertyPathToItem); - if (schemas == null) { - throw new RuntimeException("Validation result is invalid, schemas must exist for a pathToItem"); - } - JsonSchema propertySchema = schemas.entrySet().iterator().next().getKey(); - @Nullable Object propertyInstance = propertySchema.getNewInstance(value, propertyPathToItem, pathToSchemas); - properties.put(propertyName, propertyInstance); - } - FrozenMap<@Nullable Object> castProperties = new FrozenMap<>(properties); - return castProperties; - } - - public FrozenMap<@Nullable Object> validate(Map arg, SchemaConfiguration configuration) throws ValidationException { - Set> pathSet = new HashSet<>(); - List pathToItem = List.of("args[0"); - Map castArg = castToAllowedTypes(arg, pathToItem, pathSet); - SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().build())); - ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, new PathToSchemasMap(), new LinkedHashSet<>()); - PathToSchemasMap pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet); - return getNewInstance(castArg, validationMetadata.pathToItem(), pathToSchemasMap); - } - - - @Override - public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { - if (arg == null) { - return validate((Nothing?) 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"); - } - @Override - public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { - if (arg == null) { - return getNewInstance((Nothing?) 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"); - } - @Override - public AdditionalProperties2BoxedVoid validateAndBox(Nothing? arg, SchemaConfiguration configuration) throws ValidationException { - return new AdditionalProperties2BoxedVoid(validate(arg, configuration)); - } - @Override - 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 { - if (arg == null) { - Nothing? castArg = (Nothing?) 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"); - } - } - - public static class ObjectItemsNullableMap extends FrozenMap<@Nullable FrozenMap> { - protected ObjectItemsNullableMap(FrozenMap<@Nullable FrozenMap> m) { - super(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 { - return ObjectItemsNullable.getInstance().validate(arg, configuration); - } - - public @Nullable FrozenMap getAdditionalProperty(String name) throws UnsetPropertyException { - return getOrThrow(name); - } - } - - public interface SetterForAdditionalProperties2 { - Set getKnownKeys(); - Map> getInstance(); - T getBuilderAfterAdditionalProperty(Map> instance); - - default T additionalProperty(String key, Nothing? value) throws InvalidAdditionalPropertyException { - MapUtils.throwIfKeyKnown(key, getKnownKeys(), true); - var instance = getInstance(); - instance.put(key, null); - return getBuilderAfterAdditionalProperty(instance); - } - - default T additionalProperty(String key, Map value) throws InvalidAdditionalPropertyException { - MapUtils.throwIfKeyKnown(key, getKnownKeys(), true); - var instance = getInstance(); - instance.put(key, value); - return getBuilderAfterAdditionalProperty(instance); - } - } - - public static class ObjectItemsNullableMapBuilder implements GenericBuilder>>, SetterForAdditionalProperties2 { - private final Map> instance; - private static final Set knownKeys = Set.of(); - public Set getKnownKeys() { - return knownKeys; - } - public ObjectItemsNullableMapBuilder() { - this.instance = new LinkedHashMap<>(); - } - public Map> build() { - return instance; - } - public Map> getInstance() { - return instance; - } - public ObjectItemsNullableMapBuilder getBuilderAfterAdditionalProperty(Map> instance) { - return this; - } - } - - - public sealed interface ObjectItemsNullableBoxed permits ObjectItemsNullableBoxedMap { - @Nullable Object getData(); - } - - public record ObjectItemsNullableBoxedMap(ObjectItemsNullableMap data) implements ObjectItemsNullableBoxed { - @Override - public @Nullable Object getData() { - return data; - } - } - - - public static class ObjectItemsNullable extends JsonSchema implements MapSchemaValidator { - private static @Nullable ObjectItemsNullable instance = null; - - protected ObjectItemsNullable() { - super(new JsonSchemaInfo() - .type(Set.of(Map.class)) - .additionalProperties(AdditionalProperties2.class) - ); - } - - public static ObjectItemsNullable getInstance() { - if (instance == null) { - instance = new ObjectItemsNullable(); - } - return instance; - } - - 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 RuntimeException("Invalid non-string key value"); - } - String propertyName = (String) entryKey; - List propertyPathToItem = new ArrayList<>(pathToItem); - propertyPathToItem.add(propertyName); - Object value = entry.getValue(); - LinkedHashMap, Nothing?> schemas = pathToSchemas.get(propertyPathToItem); - if (schemas == null) { - throw new RuntimeException("Validation 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"); - } - properties.put(propertyName, (@Nullable FrozenMap) propertyInstance); - } - FrozenMap<@Nullable FrozenMap> castProperties = new FrozenMap<>(properties); - return new ObjectItemsNullableMap(castProperties); - } - - 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); - SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().build())); - ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, new PathToSchemasMap(), new LinkedHashSet<>()); - PathToSchemasMap pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet); - return getNewInstance(castArg, validationMetadata.pathToItem(), pathToSchemasMap); - } - - - @Override - public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws 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"); - } - @Override - public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { - if (arg instanceof Map) { - return getNewInstance((Map) arg, pathToItem, pathToSchemas); - } - 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 { - return new ObjectItemsNullableBoxedMap(validate(arg, configuration)); - } - @Override - public ObjectItemsNullableBoxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { - 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"); - } - } - - - public static class NullableClassMap extends FrozenMap<@Nullable Object> { - protected NullableClassMap(FrozenMap<@Nullable Object> m) { - super(m); - } - public static final Set requiredKeys = Set.of(); - public static final Set optionalKeys = Set.of( - "integer_prop", - "number_prop", - "boolean_prop", - "string_prop", - "date_prop", - "datetime_prop", - "array_nullable_prop", - "array_and_items_nullable_prop", - "array_items_nullable", - "object_nullable_prop", - "object_and_items_nullable_prop", - "object_items_nullable" - ); - public static NullableClassMap of(Map arg, SchemaConfiguration configuration) throws ValidationException { - return NullableClass1.getInstance().validate(arg, configuration); - } - - public @Nullable Number integer_prop() throws UnsetPropertyException { - String key = "integer_prop"; - throwIfKeyNotPresent(key); - @Nullable Object value = get(key); - if (!(value == null || value instanceof Number)) { - throw new RuntimeException("Invalid value stored for integer_prop"); - } - return (@Nullable Number) value; - } - - public @Nullable Number number_prop() throws UnsetPropertyException { - String key = "number_prop"; - throwIfKeyNotPresent(key); - @Nullable Object value = get(key); - if (!(value == null || value instanceof Number)) { - throw new RuntimeException("Invalid value stored for number_prop"); - } - return (@Nullable Number) value; - } - - public @Nullable Boolean boolean_prop() throws UnsetPropertyException { - String key = "boolean_prop"; - throwIfKeyNotPresent(key); - @Nullable Object value = get(key); - if (!(value == null || value instanceof Boolean)) { - throw new RuntimeException("Invalid value stored for boolean_prop"); - } - return (@Nullable Boolean) value; - } - - public @Nullable String string_prop() throws UnsetPropertyException { - String key = "string_prop"; - throwIfKeyNotPresent(key); - @Nullable Object value = get(key); - if (!(value == null || value instanceof String)) { - throw new RuntimeException("Invalid value stored for string_prop"); - } - return (@Nullable String) value; - } - - public @Nullable String date_prop() throws UnsetPropertyException { - String key = "date_prop"; - throwIfKeyNotPresent(key); - @Nullable Object value = get(key); - if (!(value == null || value instanceof String)) { - throw new RuntimeException("Invalid value stored for date_prop"); - } - return (@Nullable String) value; - } - - public @Nullable String datetime_prop() throws UnsetPropertyException { - String key = "datetime_prop"; - throwIfKeyNotPresent(key); - @Nullable Object value = get(key); - if (!(value == null || value instanceof String)) { - throw new RuntimeException("Invalid value stored for datetime_prop"); - } - return (@Nullable String) value; - } - - public @Nullable ArrayNullablePropList array_nullable_prop() throws UnsetPropertyException { - String key = "array_nullable_prop"; - throwIfKeyNotPresent(key); - @Nullable Object value = get(key); - if (!(value == null || value instanceof ArrayNullablePropList)) { - throw new RuntimeException("Invalid value stored for array_nullable_prop"); - } - return (@Nullable ArrayNullablePropList) value; - } - - public @Nullable ArrayAndItemsNullablePropList array_and_items_nullable_prop() throws UnsetPropertyException { - String key = "array_and_items_nullable_prop"; - 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"); - } - return (@Nullable ArrayAndItemsNullablePropList) value; - } - - public ArrayItemsNullableList array_items_nullable() throws UnsetPropertyException { - String key = "array_items_nullable"; - throwIfKeyNotPresent(key); - @Nullable Object value = get(key); - if (!(value instanceof ArrayItemsNullableList)) { - throw new RuntimeException("Invalid value stored for array_items_nullable"); - } - return (ArrayItemsNullableList) value; - } - - public @Nullable ObjectNullablePropMap object_nullable_prop() throws UnsetPropertyException { - String key = "object_nullable_prop"; - throwIfKeyNotPresent(key); - @Nullable Object value = get(key); - if (!(value == null || value instanceof ObjectNullablePropMap)) { - throw new RuntimeException("Invalid value stored for object_nullable_prop"); - } - return (@Nullable ObjectNullablePropMap) value; - } - - public @Nullable ObjectAndItemsNullablePropMap object_and_items_nullable_prop() throws UnsetPropertyException { - String key = "object_and_items_nullable_prop"; - 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"); - } - return (@Nullable ObjectAndItemsNullablePropMap) value; - } - - public ObjectItemsNullableMap object_items_nullable() throws UnsetPropertyException { - String key = "object_items_nullable"; - throwIfKeyNotPresent(key); - @Nullable Object value = get(key); - if (!(value instanceof ObjectItemsNullableMap)) { - throw new RuntimeException("Invalid value stored for object_items_nullable"); - } - return (ObjectItemsNullableMap) value; - } - - public @Nullable FrozenMap getAdditionalProperty(String name) throws UnsetPropertyException, InvalidAdditionalPropertyException { - throwIfKeyKnown(name, requiredKeys, optionalKeys); - var value = getOrThrow(name); - if (!(value == null || value instanceof FrozenMap)) { - throw new RuntimeException("Invalid value stored for " + name); - } - return (@Nullable FrozenMap) value; - } - } - - public interface SetterForIntegerProp { - Map getInstance(); - T getBuilderAfterIntegerProp(Map instance); - - default T integer_prop(Nothing? value) { - var instance = getInstance(); - instance.put("integer_prop", null); - return getBuilderAfterIntegerProp(instance); - } - - default T integer_prop(int value) { - var instance = getInstance(); - instance.put("integer_prop", value); - return getBuilderAfterIntegerProp(instance); - } - - default T integer_prop(float value) { - var instance = getInstance(); - instance.put("integer_prop", value); - return getBuilderAfterIntegerProp(instance); - } - - default T integer_prop(long value) { - var instance = getInstance(); - instance.put("integer_prop", value); - return getBuilderAfterIntegerProp(instance); - } - - default T integer_prop(double value) { - var instance = getInstance(); - instance.put("integer_prop", value); - return getBuilderAfterIntegerProp(instance); - } - } - - public interface SetterForNumberProp { - Map getInstance(); - T getBuilderAfterNumberProp(Map instance); - - default T number_prop(Nothing? value) { - var instance = getInstance(); - instance.put("number_prop", null); - return getBuilderAfterNumberProp(instance); - } - - default T number_prop(int value) { - var instance = getInstance(); - instance.put("number_prop", value); - return getBuilderAfterNumberProp(instance); - } - - default T number_prop(float value) { - var instance = getInstance(); - instance.put("number_prop", value); - return getBuilderAfterNumberProp(instance); - } - - default T number_prop(long value) { - var instance = getInstance(); - instance.put("number_prop", value); - return getBuilderAfterNumberProp(instance); - } - - default T number_prop(double value) { - var instance = getInstance(); - instance.put("number_prop", value); - return getBuilderAfterNumberProp(instance); - } - } - - public interface SetterForBooleanProp { - Map getInstance(); - T getBuilderAfterBooleanProp(Map instance); - - default T boolean_prop(Nothing? value) { - var instance = getInstance(); - instance.put("boolean_prop", null); - return getBuilderAfterBooleanProp(instance); - } - - default T boolean_prop(boolean value) { - var instance = getInstance(); - instance.put("boolean_prop", value); - return getBuilderAfterBooleanProp(instance); - } - } - - public interface SetterForStringProp { - Map getInstance(); - T getBuilderAfterStringProp(Map instance); - - default T string_prop(Nothing? value) { - var instance = getInstance(); - instance.put("string_prop", null); - return getBuilderAfterStringProp(instance); - } - - default T string_prop(String value) { - var instance = getInstance(); - instance.put("string_prop", value); - return getBuilderAfterStringProp(instance); - } - } - - public interface SetterForDateProp { - Map getInstance(); - T getBuilderAfterDateProp(Map instance); - - default T date_prop(Nothing? value) { - var instance = getInstance(); - instance.put("date_prop", null); - return getBuilderAfterDateProp(instance); - } - - default T date_prop(String value) { - var instance = getInstance(); - instance.put("date_prop", value); - return getBuilderAfterDateProp(instance); - } - } - - public interface SetterForDatetimeProp { - Map getInstance(); - T getBuilderAfterDatetimeProp(Map instance); - - default T datetime_prop(Nothing? value) { - var instance = getInstance(); - instance.put("datetime_prop", null); - return getBuilderAfterDatetimeProp(instance); - } - - default T datetime_prop(String value) { - var instance = getInstance(); - instance.put("datetime_prop", value); - return getBuilderAfterDatetimeProp(instance); - } - } - - public interface SetterForArrayNullableProp { - Map getInstance(); - T getBuilderAfterArrayNullableProp(Map instance); - - default T array_nullable_prop(Nothing? value) { - var instance = getInstance(); - instance.put("array_nullable_prop", null); - return getBuilderAfterArrayNullableProp(instance); - } - - default T array_nullable_prop(List> value) { - var instance = getInstance(); - instance.put("array_nullable_prop", value); - return getBuilderAfterArrayNullableProp(instance); - } - } - - public interface SetterForArrayAndItemsNullableProp { - Map getInstance(); - T getBuilderAfterArrayAndItemsNullableProp(Map instance); - - default T array_and_items_nullable_prop(Nothing? value) { - var instance = getInstance(); - instance.put("array_and_items_nullable_prop", null); - return getBuilderAfterArrayAndItemsNullableProp(instance); - } - - default T array_and_items_nullable_prop(List<@Nullable Map> value) { - var instance = getInstance(); - instance.put("array_and_items_nullable_prop", value); - return getBuilderAfterArrayAndItemsNullableProp(instance); - } - } - - public interface SetterForArrayItemsNullable { - Map getInstance(); - T getBuilderAfterArrayItemsNullable(Map instance); - - default T array_items_nullable(List<@Nullable Map> value) { - var instance = getInstance(); - instance.put("array_items_nullable", value); - return getBuilderAfterArrayItemsNullable(instance); - } - } - - public interface SetterForObjectNullableProp { - Map getInstance(); - T getBuilderAfterObjectNullableProp(Map instance); - - default T object_nullable_prop(Nothing? value) { - var instance = getInstance(); - instance.put("object_nullable_prop", null); - return getBuilderAfterObjectNullableProp(instance); - } - - default T object_nullable_prop(Map> value) { - var instance = getInstance(); - instance.put("object_nullable_prop", value); - return getBuilderAfterObjectNullableProp(instance); - } - } - - public interface SetterForObjectAndItemsNullableProp { - Map getInstance(); - T getBuilderAfterObjectAndItemsNullableProp(Map instance); - - default T object_and_items_nullable_prop(Nothing? value) { - var instance = getInstance(); - instance.put("object_and_items_nullable_prop", null); - return getBuilderAfterObjectAndItemsNullableProp(instance); - } - - default T object_and_items_nullable_prop(Map> value) { - var instance = getInstance(); - instance.put("object_and_items_nullable_prop", value); - return getBuilderAfterObjectAndItemsNullableProp(instance); - } - } - - public interface SetterForObjectItemsNullable { - Map getInstance(); - T getBuilderAfterObjectItemsNullable(Map instance); - - default T object_items_nullable(Map> value) { - var instance = getInstance(); - instance.put("object_items_nullable", value); - return getBuilderAfterObjectItemsNullable(instance); - } - } - - public interface SetterForAdditionalProperties3 { - Set getKnownKeys(); - Map getInstance(); - T getBuilderAfterAdditionalProperty(Map instance); - - default T additionalProperty(String key, Nothing? value) throws InvalidAdditionalPropertyException { - MapUtils.throwIfKeyKnown(key, getKnownKeys(), true); - var instance = getInstance(); - instance.put(key, null); - return getBuilderAfterAdditionalProperty(instance); - } - - default T additionalProperty(String key, Map value) throws InvalidAdditionalPropertyException { - MapUtils.throwIfKeyKnown(key, getKnownKeys(), true); - var instance = getInstance(); - instance.put(key, value); - return getBuilderAfterAdditionalProperty(instance); - } - } - - public static class NullableClassMapBuilder implements GenericBuilder>, SetterForIntegerProp, SetterForNumberProp, SetterForBooleanProp, SetterForStringProp, SetterForDateProp, SetterForDatetimeProp, SetterForArrayNullableProp, SetterForArrayAndItemsNullableProp, SetterForArrayItemsNullable, SetterForObjectNullableProp, SetterForObjectAndItemsNullableProp, SetterForObjectItemsNullable, SetterForAdditionalProperties3 { - private final Map instance; - private static final Set knownKeys = Set.of( - "integer_prop", - "number_prop", - "boolean_prop", - "string_prop", - "date_prop", - "datetime_prop", - "array_nullable_prop", - "array_and_items_nullable_prop", - "array_items_nullable", - "object_nullable_prop", - "object_and_items_nullable_prop", - "object_items_nullable" - ); - public Set getKnownKeys() { - return knownKeys; - } - public NullableClassMapBuilder() { - this.instance = new LinkedHashMap<>(); - } - public Map build() { - return instance; - } - public Map getInstance() { - return instance; - } - public NullableClassMapBuilder getBuilderAfterIntegerProp(Map instance) { - return this; - } - public NullableClassMapBuilder getBuilderAfterNumberProp(Map instance) { - return this; - } - public NullableClassMapBuilder getBuilderAfterBooleanProp(Map instance) { - return this; - } - public NullableClassMapBuilder getBuilderAfterStringProp(Map instance) { - return this; - } - public NullableClassMapBuilder getBuilderAfterDateProp(Map instance) { - return this; - } - public NullableClassMapBuilder getBuilderAfterDatetimeProp(Map instance) { - return this; - } - public NullableClassMapBuilder getBuilderAfterArrayNullableProp(Map instance) { - return this; - } - public NullableClassMapBuilder getBuilderAfterArrayAndItemsNullableProp(Map instance) { - return this; - } - public NullableClassMapBuilder getBuilderAfterArrayItemsNullable(Map instance) { - return this; - } - public NullableClassMapBuilder getBuilderAfterObjectNullableProp(Map instance) { - return this; - } - public NullableClassMapBuilder getBuilderAfterObjectAndItemsNullableProp(Map instance) { - return this; - } - public NullableClassMapBuilder getBuilderAfterObjectItemsNullable(Map instance) { - return this; - } - public NullableClassMapBuilder getBuilderAfterAdditionalProperty(Map instance) { - return this; - } - } - - - public sealed interface NullableClass1Boxed permits NullableClass1BoxedMap { - @Nullable Object getData(); - } - - public record NullableClass1BoxedMap(NullableClassMap data) implements NullableClass1Boxed { - @Override - public @Nullable Object getData() { - return data; - } - } - - - public static class NullableClass1 extends JsonSchema implements MapSchemaValidator { - /* - NOTE: This class is auto generated by OpenAPI JSON Schema Generator. - Ref: https://github.com/openapi-json-schema-tools/openapi-json-schema-generator - - Do not edit the class manually. - */ - private static @Nullable NullableClass1 instance = null; - - protected NullableClass1() { - super(new JsonSchemaInfo() - .type(Set.of(Map.class)) - .properties(Map.ofEntries( - new PropertyEntry("integer_prop", IntegerProp.class), - new PropertyEntry("number_prop", NumberProp.class), - new PropertyEntry("boolean_prop", BooleanProp.class), - new PropertyEntry("string_prop", StringProp.class), - new PropertyEntry("date_prop", DateProp.class), - new PropertyEntry("datetime_prop", DatetimeProp.class), - new PropertyEntry("array_nullable_prop", ArrayNullableProp.class), - new PropertyEntry("array_and_items_nullable_prop", ArrayAndItemsNullableProp.class), - new PropertyEntry("array_items_nullable", ArrayItemsNullable.class), - new PropertyEntry("object_nullable_prop", ObjectNullableProp.class), - new PropertyEntry("object_and_items_nullable_prop", ObjectAndItemsNullableProp.class), - new PropertyEntry("object_items_nullable", ObjectItemsNullable.class) - )) - .additionalProperties(AdditionalProperties3.class) - ); - } - - public static NullableClass1 getInstance() { - if (instance == null) { - instance = new NullableClass1(); - } - return instance; - } - - 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 RuntimeException("Invalid non-string key value"); - } - String propertyName = (String) entryKey; - List propertyPathToItem = new ArrayList<>(pathToItem); - propertyPathToItem.add(propertyName); - Object value = entry.getValue(); - LinkedHashMap, Nothing?> schemas = pathToSchemas.get(propertyPathToItem); - if (schemas == null) { - throw new RuntimeException("Validation 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"); - } - properties.put(propertyName, (@Nullable Object) propertyInstance); - } - FrozenMap<@Nullable Object> castProperties = new FrozenMap<>(properties); - return new NullableClassMap(castProperties); - } - - 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); - SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().build())); - ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, new PathToSchemasMap(), new LinkedHashSet<>()); - PathToSchemasMap pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet); - return getNewInstance(castArg, validationMetadata.pathToItem(), pathToSchemasMap); - } - - - @Override - public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws 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"); - } - @Override - public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { - if (arg instanceof Map) { - return getNewInstance((Map) arg, pathToItem, pathToSchemas); - } - 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 { - return new NullableClass1BoxedMap(validate(arg, configuration)); - } - @Override - public NullableClass1Boxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { - 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"); - } - } - -} diff --git a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/schemas/NullableShape.kt b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/schemas/NullableShape.kt deleted file mode 100644 index 411aff9b896..00000000000 --- a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/schemas/NullableShape.kt +++ /dev/null @@ -1,345 +0,0 @@ -package org.openapijsonschematools.client.components.schemas; -import java.time.LocalDate; -import java.time.ZonedDateTime; -import java.util.ArrayList; -import java.util.HashSet; -import java.util.LinkedHashMap; -import java.util.LinkedHashSet; -import java.util.List; -import java.util.Map; -import java.util.Objects; -import java.util.Set; -import java.util.UUID; -import org.checkerframework.checker.nullness.qual.Nullable; -import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags; -import org.openapijsonschematools.client.configurations.SchemaConfiguration; -import org.openapijsonschematools.client.exceptions.InvalidAdditionalPropertyException; -import org.openapijsonschematools.client.exceptions.UnsetPropertyException; -import org.openapijsonschematools.client.exceptions.ValidationException; -import org.openapijsonschematools.client.schemas.NullJsonSchema; -import org.openapijsonschematools.client.schemas.UnsetAddPropsSetter; -import org.openapijsonschematools.client.schemas.validation.BooleanSchemaValidator; -import org.openapijsonschematools.client.schemas.validation.FrozenList; -import org.openapijsonschematools.client.schemas.validation.FrozenMap; -import org.openapijsonschematools.client.schemas.validation.JsonSchema; -import org.openapijsonschematools.client.schemas.validation.JsonSchemaInfo; -import org.openapijsonschematools.client.schemas.validation.ListSchemaValidator; -import org.openapijsonschematools.client.schemas.validation.MapSchemaValidator; -import org.openapijsonschematools.client.schemas.validation.NullSchemaValidator; -import org.openapijsonschematools.client.schemas.validation.NumberSchemaValidator; -import org.openapijsonschematools.client.schemas.validation.PathToSchemasMap; -import org.openapijsonschematools.client.schemas.validation.StringSchemaValidator; -import org.openapijsonschematools.client.schemas.validation.ValidationMetadata; - -public class NullableShape { - // nest classes so all schemas and input/output classes can be public - - - public static class Schema2 extends NullJsonSchema.NullJsonSchema1 { - private static @Nullable Schema2 instance = null; - public static Schema2 getInstance() { - if (instance == null) { - instance = new Schema2(); - } - return instance; - } - } - - - public sealed interface NullableShape1Boxed permits NullableShape1BoxedVoid, NullableShape1BoxedBoolean, NullableShape1BoxedNumber, NullableShape1BoxedString, NullableShape1BoxedList, NullableShape1BoxedMap { - @Nullable Object getData(); - } - - public record NullableShape1BoxedVoid(Nothing? data) implements NullableShape1Boxed { - @Override - public @Nullable Object getData() { - return data; - } - } - - public record NullableShape1BoxedBoolean(boolean data) implements NullableShape1Boxed { - @Override - public @Nullable Object getData() { - return data; - } - } - - public record NullableShape1BoxedNumber(Number data) implements NullableShape1Boxed { - @Override - public @Nullable Object getData() { - return data; - } - } - - public record NullableShape1BoxedString(String data) implements NullableShape1Boxed { - @Override - public @Nullable Object getData() { - return data; - } - } - - public record NullableShape1BoxedList(FrozenList<@Nullable Object> data) implements NullableShape1Boxed { - @Override - public @Nullable Object getData() { - return data; - } - } - - public record NullableShape1BoxedMap(FrozenMap<@Nullable Object> data) implements NullableShape1Boxed { - @Override - public @Nullable Object getData() { - return data; - } - } - - - public static class NullableShape1 extends JsonSchema implements NullSchemaValidator, BooleanSchemaValidator, NumberSchemaValidator, StringSchemaValidator, ListSchemaValidator, NullableShape1BoxedList>, MapSchemaValidator, NullableShape1BoxedMap> { - /* - NOTE: This class is auto generated by OpenAPI JSON Schema Generator. - Ref: https://github.com/openapi-json-schema-tools/openapi-json-schema-generator - - Do not edit the class manually. - - The value may be a shape or the 'null' value. For a composed schema to validate a null payload, one of its chosen oneOf schemas must be type null or nullable (introduced in OAS schema >= 3.0) - */ - private static @Nullable NullableShape1 instance = null; - - protected NullableShape1() { - super(new JsonSchemaInfo() - .oneOf(List.of( - Triangle.Triangle1.class, - Quadrilateral.Quadrilateral1.class, - Schema2.class - )) - ); - } - - public static NullableShape1 getInstance() { - if (instance == null) { - instance = new NullableShape1(); - } - return instance; - } - - @Override - public Nothing? validate(Nothing? arg, SchemaConfiguration configuration) throws ValidationException { - Set> pathSet = new HashSet<>(); - List pathToItem = List.of("args[0]"); - Nothing? castArg = castToAllowedTypes(arg, pathToItem, pathSet); - SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().build())); - PathToSchemasMap validatedPathToSchemas = new PathToSchemasMap(); - ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, new LinkedHashSet<>()); - getPathToSchemas(this, castArg, validationMetadata, pathSet); - return castArg; - } - - @Override - public boolean validate(boolean arg, SchemaConfiguration configuration) throws ValidationException { - Set> pathSet = new HashSet<>(); - List pathToItem = List.of("args[0]"); - boolean castArg = castToAllowedTypes(arg, pathToItem, pathSet); - SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().build())); - PathToSchemasMap validatedPathToSchemas = new PathToSchemasMap(); - ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, new LinkedHashSet<>()); - getPathToSchemas(this, castArg, validationMetadata, pathSet); - return castArg; - } - - @Override - public Number validate(Number arg, SchemaConfiguration configuration) throws ValidationException { - Set> pathSet = new HashSet<>(); - List pathToItem = List.of("args[0]"); - Number castArg = castToAllowedTypes(arg, pathToItem, pathSet); - SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().build())); - PathToSchemasMap validatedPathToSchemas = new PathToSchemasMap(); - ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, new LinkedHashSet<>()); - getPathToSchemas(this, castArg, validationMetadata, pathSet); - return castArg; - } - - public int validate(int arg, SchemaConfiguration configuration) throws ValidationException { - return (int) validate((Number) arg, configuration); - } - - public long validate(long arg, SchemaConfiguration configuration) throws ValidationException { - return (long) validate((Number) arg, configuration); - } - - public float validate(float arg, SchemaConfiguration configuration) throws ValidationException { - return (float) validate((Number) arg, configuration); - } - - public double validate(double arg, SchemaConfiguration configuration) throws ValidationException { - return (double) validate((Number) arg, configuration); - } - - @Override - public String validate(String arg, SchemaConfiguration configuration) throws ValidationException { - Set> pathSet = new HashSet<>(); - List pathToItem = List.of("args[0]"); - String castArg = castToAllowedTypes(arg, pathToItem, pathSet); - SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().build())); - PathToSchemasMap validatedPathToSchemas = new PathToSchemasMap(); - ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, new LinkedHashSet<>()); - getPathToSchemas(this, castArg, validationMetadata, pathSet); - return castArg; - } - - public String validate(LocalDate arg, SchemaConfiguration configuration) throws ValidationException { - return validate(arg.toString(), configuration); - } - - public String validate(ZonedDateTime arg, SchemaConfiguration configuration) throws ValidationException { - return validate(arg.toString(), configuration); - } - - public String validate(UUID arg, SchemaConfiguration configuration) throws ValidationException { - return validate(arg.toString(), configuration); - } - - @Override - public FrozenList<@Nullable Object> getNewInstance(List arg, List pathToItem, PathToSchemasMap pathToSchemas) { - List<@Nullable Object> items = new ArrayList<>(); - int i = 0; - for (Object item: arg) { - List itemPathToItem = new ArrayList<>(pathToItem); - itemPathToItem.add(i); - LinkedHashMap, Nothing?> schemas = pathToSchemas.get(itemPathToItem); - if (schemas == null) { - throw new RuntimeException("Validation result is invalid, schemas must exist for a pathToItem"); - } - JsonSchema itemSchema = schemas.entrySet().iterator().next().getKey(); - @Nullable Object itemInstance = itemSchema.getNewInstance(item, itemPathToItem, pathToSchemas); - items.add(itemInstance); - i += 1; - } - FrozenList<@Nullable Object> newInstanceItems = new FrozenList<>(items); - return newInstanceItems; - } - - 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); - SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().build())); - ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, new PathToSchemasMap(), new LinkedHashSet<>()); - PathToSchemasMap pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet); - return getNewInstance(castArg, validationMetadata.pathToItem(), pathToSchemasMap); - } - - @Override - 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 RuntimeException("Invalid non-string key value"); - } - String propertyName = (String) entryKey; - List propertyPathToItem = new ArrayList<>(pathToItem); - propertyPathToItem.add(propertyName); - Object value = entry.getValue(); - LinkedHashMap, Nothing?> schemas = pathToSchemas.get(propertyPathToItem); - if (schemas == null) { - throw new RuntimeException("Validation result is invalid, schemas must exist for a pathToItem"); - } - JsonSchema propertySchema = schemas.entrySet().iterator().next().getKey(); - @Nullable Object propertyInstance = propertySchema.getNewInstance(value, propertyPathToItem, pathToSchemas); - properties.put(propertyName, propertyInstance); - } - FrozenMap<@Nullable Object> castProperties = new FrozenMap<>(properties); - return castProperties; - } - - public FrozenMap<@Nullable Object> validate(Map arg, SchemaConfiguration configuration) throws ValidationException { - Set> pathSet = new HashSet<>(); - List pathToItem = List.of("args[0]"); - Map castArg = castToAllowedTypes(arg, pathToItem, pathSet); - SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().build())); - PathToSchemasMap validatedPathToSchemas = new PathToSchemasMap(); - ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, new LinkedHashSet<>()); - PathToSchemasMap pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet); - return getNewInstance(castArg, validationMetadata.pathToItem(), pathToSchemasMap); - } - - @Override - public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { - if (arg == null) { - return validate((Nothing?) null, configuration); - } else if (arg instanceof Boolean) { - boolean boolArg = (Boolean) arg; - return validate(boolArg, configuration); - } else if (arg instanceof Number) { - return validate((Number) arg, configuration); - } else if (arg instanceof String) { - return validate((String) arg, configuration); - } else if (arg instanceof List) { - return validate((List) arg, 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"); - } - @Override - public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { - if (arg == null) { - return getNewInstance((Nothing?) null, pathToItem, pathToSchemas); - } else if (arg instanceof Boolean) { - boolean boolArg = (Boolean) arg; - return getNewInstance(boolArg, pathToItem, pathToSchemas); - } else if (arg instanceof Number) { - return getNewInstance((Number) arg, pathToItem, pathToSchemas); - } else if (arg instanceof String) { - return getNewInstance((String) arg, pathToItem, pathToSchemas); - } else if (arg instanceof List) { - return getNewInstance((List) arg, 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"); - } - @Override - public NullableShape1BoxedVoid validateAndBox(Nothing? arg, SchemaConfiguration configuration) throws ValidationException { - return new NullableShape1BoxedVoid(validate(arg, configuration)); - } - @Override - 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 { - return new NullableShape1BoxedNumber(validate(arg, configuration)); - } - @Override - 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 { - return new NullableShape1BoxedList(validate(arg, configuration)); - } - @Override - 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 { - if (arg == null) { - Nothing? castArg = (Nothing?) arg; - return validateAndBox(castArg, configuration); - } else if (arg instanceof Boolean booleanArg) { - boolean castArg = booleanArg; - return validateAndBox(castArg, configuration); - } else if (arg instanceof String castArg) { - return validateAndBox(castArg, configuration); - } else if (arg instanceof Number castArg) { - return validateAndBox(castArg, configuration); - } else if (arg instanceof List castArg) { - 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"); - } - } -} diff --git a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/schemas/NullableString.kt b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/schemas/NullableString.kt deleted file mode 100644 index 6fba0f0e912..00000000000 --- a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/schemas/NullableString.kt +++ /dev/null @@ -1,127 +0,0 @@ -package org.openapijsonschematools.client.components.schemas; -import java.util.HashSet; -import java.util.LinkedHashSet; -import java.util.List; -import java.util.Map; -import java.util.Objects; -import java.util.Set; -import org.checkerframework.checker.nullness.qual.Nullable; -import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags; -import org.openapijsonschematools.client.configurations.SchemaConfiguration; -import org.openapijsonschematools.client.exceptions.ValidationException; -import org.openapijsonschematools.client.schemas.validation.JsonSchema; -import org.openapijsonschematools.client.schemas.validation.JsonSchemaInfo; -import org.openapijsonschematools.client.schemas.validation.NullSchemaValidator; -import org.openapijsonschematools.client.schemas.validation.PathToSchemasMap; -import org.openapijsonschematools.client.schemas.validation.StringSchemaValidator; -import org.openapijsonschematools.client.schemas.validation.ValidationMetadata; - -public class NullableString { - // nest classes so all schemas and input/output classes can be public - - - public sealed interface NullableString1Boxed permits NullableString1BoxedNothing?, NullableString1BoxedString { - @Nullable Object getData(); - } - - public record NullableString1BoxedVoid(Nothing? data) implements NullableString1Boxed { - @Override - public @Nullable Object getData() { - return data; - } - } - - public record NullableString1BoxedString(String data) implements NullableString1Boxed { - @Override - public @Nullable Object getData() { - return data; - } - } - - - - public static class NullableString1 extends JsonSchema implements NullSchemaValidator, StringSchemaValidator { - /* - NOTE: This class is auto generated by OpenAPI JSON Schema Generator. - Ref: https://github.com/openapi-json-schema-tools/openapi-json-schema-generator - - Do not edit the class manually. - */ - private static @Nullable NullableString1 instance = null; - - protected NullableString1() { - super(new JsonSchemaInfo() - .type(Set.of( - Nothing?.class, - String.class - )) - ); - } - - public static NullableString1 getInstance() { - if (instance == null) { - instance = new NullableString1(); - } - return instance; - } - - @Override - public Nothing? validate(Nothing? arg, SchemaConfiguration configuration) throws ValidationException { - Set> pathSet = new HashSet<>(); - List pathToItem = List.of("args[0"); - Nothing? castArg = castToAllowedTypes(arg, pathToItem, pathSet); - SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().build())); - ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, new PathToSchemasMap(), new LinkedHashSet<>()); - getPathToSchemas(this, castArg, validationMetadata, pathSet); - return castArg; - } - - @Override - public String validate(String arg, SchemaConfiguration configuration) throws ValidationException { - Set> pathSet = new HashSet<>(); - List pathToItem = List.of("args[0"); - String castArg = castToAllowedTypes(arg, pathToItem, pathSet); - SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().build())); - ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, new PathToSchemasMap(), new LinkedHashSet<>()); - getPathToSchemas(this, castArg, validationMetadata, pathSet); - return castArg; - } - - @Override - public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { - if (arg == null) { - return validate((Nothing?) 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"); - } - @Override - public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { - if (arg == null) { - return getNewInstance((Nothing?) 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"); - } - @Override - public NullableString1BoxedVoid validateAndBox(Nothing? arg, SchemaConfiguration configuration) throws ValidationException { - return new NullableString1BoxedVoid(validate(arg, configuration)); - } - @Override - 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 { - if (arg == null) { - Nothing? castArg = (Nothing?) 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"); - } - } -} diff --git a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/schemas/NumberOnly.kt b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/schemas/NumberOnly.kt deleted file mode 100644 index 4588c7a1b23..00000000000 --- a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/schemas/NumberOnly.kt +++ /dev/null @@ -1,224 +0,0 @@ -package org.openapijsonschematools.client.components.schemas; -import java.util.ArrayList; -import java.util.HashSet; -import java.util.LinkedHashMap; -import java.util.LinkedHashSet; -import java.util.List; -import java.util.Map; -import java.util.Objects; -import java.util.Set; -import org.checkerframework.checker.nullness.qual.Nullable; -import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags; -import org.openapijsonschematools.client.configurations.SchemaConfiguration; -import org.openapijsonschematools.client.exceptions.InvalidAdditionalPropertyException; -import org.openapijsonschematools.client.exceptions.UnsetPropertyException; -import org.openapijsonschematools.client.exceptions.ValidationException; -import org.openapijsonschematools.client.schemas.GenericBuilder; -import org.openapijsonschematools.client.schemas.NumberJsonSchema; -import org.openapijsonschematools.client.schemas.UnsetAddPropsSetter; -import org.openapijsonschematools.client.schemas.validation.FrozenMap; -import org.openapijsonschematools.client.schemas.validation.JsonSchema; -import org.openapijsonschematools.client.schemas.validation.JsonSchemaInfo; -import org.openapijsonschematools.client.schemas.validation.MapSchemaValidator; -import org.openapijsonschematools.client.schemas.validation.PathToSchemasMap; -import org.openapijsonschematools.client.schemas.validation.PropertyEntry; -import org.openapijsonschematools.client.schemas.validation.ValidationMetadata; - -public class NumberOnly { - // nest classes so all schemas and input/output classes can be public - - - public static class JustNumber extends NumberJsonSchema.NumberJsonSchema1 { - private static @Nullable JustNumber instance = null; - public static JustNumber getInstance() { - if (instance == null) { - instance = new JustNumber(); - } - return instance; - } - } - - - public static class NumberOnlyMap extends FrozenMap<@Nullable Object> { - protected NumberOnlyMap(FrozenMap<@Nullable Object> m) { - super(m); - } - public static final Set requiredKeys = Set.of(); - public static final Set optionalKeys = Set.of( - "JustNumber" - ); - public static NumberOnlyMap of(Map arg, SchemaConfiguration configuration) throws ValidationException { - return NumberOnly1.getInstance().validate(arg, configuration); - } - - public Number JustNumber() throws UnsetPropertyException { - String key = "JustNumber"; - throwIfKeyNotPresent(key); - @Nullable Object value = get(key); - if (!(value instanceof Number)) { - throw new RuntimeException("Invalid value stored for JustNumber"); - } - return (Number) value; - } - - public @Nullable Object getAdditionalProperty(String name) throws UnsetPropertyException, InvalidAdditionalPropertyException { - throwIfKeyKnown(name, requiredKeys, optionalKeys); - throwIfKeyNotPresent(name); - return get(name); - } - } - - public interface SetterForJustNumber { - Map getInstance(); - T getBuilderAfterJustNumber(Map instance); - - default T JustNumber(int value) { - var instance = getInstance(); - instance.put("JustNumber", value); - return getBuilderAfterJustNumber(instance); - } - - default T JustNumber(float value) { - var instance = getInstance(); - instance.put("JustNumber", value); - return getBuilderAfterJustNumber(instance); - } - - default T JustNumber(long value) { - var instance = getInstance(); - instance.put("JustNumber", value); - return getBuilderAfterJustNumber(instance); - } - - default T JustNumber(double value) { - var instance = getInstance(); - instance.put("JustNumber", value); - return getBuilderAfterJustNumber(instance); - } - } - - public static class NumberOnlyMapBuilder extends UnsetAddPropsSetter implements GenericBuilder>, SetterForJustNumber { - private final Map instance; - private static final Set knownKeys = Set.of( - "JustNumber" - ); - public Set getKnownKeys() { - return knownKeys; - } - public NumberOnlyMapBuilder() { - this.instance = new LinkedHashMap<>(); - } - public Map build() { - return instance; - } - public Map getInstance() { - return instance; - } - public NumberOnlyMapBuilder getBuilderAfterJustNumber(Map instance) { - return this; - } - public NumberOnlyMapBuilder getBuilderAfterAdditionalProperty(Map instance) { - return this; - } - } - - - public sealed interface NumberOnly1Boxed permits NumberOnly1BoxedMap { - @Nullable Object getData(); - } - - public record NumberOnly1BoxedMap(NumberOnlyMap data) implements NumberOnly1Boxed { - @Override - public @Nullable Object getData() { - return data; - } - } - - - public static class NumberOnly1 extends JsonSchema implements MapSchemaValidator { - /* - NOTE: This class is auto generated by OpenAPI JSON Schema Generator. - Ref: https://github.com/openapi-json-schema-tools/openapi-json-schema-generator - - Do not edit the class manually. - */ - private static @Nullable NumberOnly1 instance = null; - - protected NumberOnly1() { - super(new JsonSchemaInfo() - .type(Set.of(Map.class)) - .properties(Map.ofEntries( - new PropertyEntry("JustNumber", JustNumber.class) - )) - ); - } - - public static NumberOnly1 getInstance() { - if (instance == null) { - instance = new NumberOnly1(); - } - return instance; - } - - 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 RuntimeException("Invalid non-string key value"); - } - String propertyName = (String) entryKey; - List propertyPathToItem = new ArrayList<>(pathToItem); - propertyPathToItem.add(propertyName); - Object value = entry.getValue(); - LinkedHashMap, Nothing?> schemas = pathToSchemas.get(propertyPathToItem); - if (schemas == null) { - throw new RuntimeException("Validation result is invalid, schemas must exist for a pathToItem"); - } - JsonSchema propertySchema = schemas.entrySet().iterator().next().getKey(); - @Nullable Object propertyInstance = propertySchema.getNewInstance(value, propertyPathToItem, pathToSchemas); - properties.put(propertyName, propertyInstance); - } - FrozenMap<@Nullable Object> castProperties = new FrozenMap<>(properties); - return new NumberOnlyMap(castProperties); - } - - 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); - SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().build())); - ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, new PathToSchemasMap(), new LinkedHashSet<>()); - PathToSchemasMap pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet); - return getNewInstance(castArg, validationMetadata.pathToItem(), pathToSchemasMap); - } - - - @Override - public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws 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"); - } - @Override - public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { - if (arg instanceof Map) { - return getNewInstance((Map) arg, pathToItem, pathToSchemas); - } - 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 { - return new NumberOnly1BoxedMap(validate(arg, configuration)); - } - @Override - public NumberOnly1Boxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { - 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"); - } - } - -} diff --git a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/schemas/NumberSchema.kt b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/schemas/NumberSchema.kt deleted file mode 100644 index c28406475e1..00000000000 --- a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/schemas/NumberSchema.kt +++ /dev/null @@ -1,19 +0,0 @@ -package org.openapijsonschematools.client.components.schemas; -import org.checkerframework.checker.nullness.qual.Nullable; -import org.openapijsonschematools.client.schemas.NumberJsonSchema; - -public class NumberSchema extends NumberJsonSchema { - // nest classes so all schemas and input/output classes can be public - - - public static class NumberSchema1 extends NumberJsonSchema.NumberJsonSchema1 { - private static @Nullable NumberSchema1 instance = null; - public static NumberSchema1 getInstance() { - if (instance == null) { - instance = new NumberSchema1(); - } - return instance; - } - } - -} diff --git a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/schemas/NumberWithExclusiveMinMax.kt b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/schemas/NumberWithExclusiveMinMax.kt deleted file mode 100644 index 12e6b1ceb4b..00000000000 --- a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/schemas/NumberWithExclusiveMinMax.kt +++ /dev/null @@ -1,116 +0,0 @@ -package org.openapijsonschematools.client.components.schemas; -import java.util.HashSet; -import java.util.LinkedHashSet; -import java.util.List; -import java.util.Objects; -import java.util.Set; -import org.checkerframework.checker.nullness.qual.Nullable; -import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags; -import org.openapijsonschematools.client.configurations.SchemaConfiguration; -import org.openapijsonschematools.client.exceptions.ValidationException; -import org.openapijsonschematools.client.schemas.validation.JsonSchema; -import org.openapijsonschematools.client.schemas.validation.JsonSchemaInfo; -import org.openapijsonschematools.client.schemas.validation.NumberSchemaValidator; -import org.openapijsonschematools.client.schemas.validation.PathToSchemasMap; -import org.openapijsonschematools.client.schemas.validation.ValidationMetadata; - -public class NumberWithExclusiveMinMax { - // nest classes so all schemas and input/output classes can be public - - - public sealed interface NumberWithExclusiveMinMax1Boxed permits NumberWithExclusiveMinMax1BoxedNumber { - @Nullable Object getData(); - } - - public record NumberWithExclusiveMinMax1BoxedNumber(Number data) implements NumberWithExclusiveMinMax1Boxed { - @Override - public @Nullable Object getData() { - return data; - } - } - - - - public static class NumberWithExclusiveMinMax1 extends JsonSchema implements NumberSchemaValidator { - /* - NOTE: This class is auto generated by OpenAPI JSON Schema Generator. - Ref: https://github.com/openapi-json-schema-tools/openapi-json-schema-generator - - Do not edit the class manually. - */ - private static @Nullable NumberWithExclusiveMinMax1 instance = null; - - protected NumberWithExclusiveMinMax1() { - super(new JsonSchemaInfo() - .type(Set.of( - Integer.class, - Long.class, - Float.class, - Double.class - )) - .exclusiveMaximum(12) - .exclusiveMinimum(10) - ); - } - - public static NumberWithExclusiveMinMax1 getInstance() { - if (instance == null) { - instance = new NumberWithExclusiveMinMax1(); - } - return instance; - } - - @Override - public Number validate(Number arg, SchemaConfiguration configuration) throws ValidationException { - Set> pathSet = new HashSet<>(); - List pathToItem = List.of("args[0"); - Number castArg = castToAllowedTypes(arg, pathToItem, pathSet); - SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().build())); - ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, new PathToSchemasMap(), new LinkedHashSet<>()); - PathToSchemasMap pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet); - return castArg; - } - - public int validate(int arg, SchemaConfiguration configuration) throws ValidationException { - return (int) validate((Number) arg, configuration); - } - - public long validate(long arg, SchemaConfiguration configuration) throws ValidationException { - return (long) validate((Number) arg, configuration); - } - - public float validate(float arg, SchemaConfiguration configuration) throws ValidationException { - return (float) validate((Number) arg, configuration); - } - - 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 { - 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"); - } - @Override - public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { - 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"); - } - @Override - 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 { - 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"); - } - } -} diff --git a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/schemas/NumberWithValidations.kt b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/schemas/NumberWithValidations.kt deleted file mode 100644 index 8798481a6db..00000000000 --- a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/schemas/NumberWithValidations.kt +++ /dev/null @@ -1,116 +0,0 @@ -package org.openapijsonschematools.client.components.schemas; -import java.util.HashSet; -import java.util.LinkedHashSet; -import java.util.List; -import java.util.Objects; -import java.util.Set; -import org.checkerframework.checker.nullness.qual.Nullable; -import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags; -import org.openapijsonschematools.client.configurations.SchemaConfiguration; -import org.openapijsonschematools.client.exceptions.ValidationException; -import org.openapijsonschematools.client.schemas.validation.JsonSchema; -import org.openapijsonschematools.client.schemas.validation.JsonSchemaInfo; -import org.openapijsonschematools.client.schemas.validation.NumberSchemaValidator; -import org.openapijsonschematools.client.schemas.validation.PathToSchemasMap; -import org.openapijsonschematools.client.schemas.validation.ValidationMetadata; - -public class NumberWithValidations { - // nest classes so all schemas and input/output classes can be public - - - public sealed interface NumberWithValidations1Boxed permits NumberWithValidations1BoxedNumber { - @Nullable Object getData(); - } - - public record NumberWithValidations1BoxedNumber(Number data) implements NumberWithValidations1Boxed { - @Override - public @Nullable Object getData() { - return data; - } - } - - - - public static class NumberWithValidations1 extends JsonSchema implements NumberSchemaValidator { - /* - NOTE: This class is auto generated by OpenAPI JSON Schema Generator. - Ref: https://github.com/openapi-json-schema-tools/openapi-json-schema-generator - - Do not edit the class manually. - */ - private static @Nullable NumberWithValidations1 instance = null; - - protected NumberWithValidations1() { - super(new JsonSchemaInfo() - .type(Set.of( - Integer.class, - Long.class, - Float.class, - Double.class - )) - .maximum(20) - .minimum(10) - ); - } - - public static NumberWithValidations1 getInstance() { - if (instance == null) { - instance = new NumberWithValidations1(); - } - return instance; - } - - @Override - public Number validate(Number arg, SchemaConfiguration configuration) throws ValidationException { - Set> pathSet = new HashSet<>(); - List pathToItem = List.of("args[0"); - Number castArg = castToAllowedTypes(arg, pathToItem, pathSet); - SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().build())); - ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, new PathToSchemasMap(), new LinkedHashSet<>()); - PathToSchemasMap pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet); - return castArg; - } - - public int validate(int arg, SchemaConfiguration configuration) throws ValidationException { - return (int) validate((Number) arg, configuration); - } - - public long validate(long arg, SchemaConfiguration configuration) throws ValidationException { - return (long) validate((Number) arg, configuration); - } - - public float validate(float arg, SchemaConfiguration configuration) throws ValidationException { - return (float) validate((Number) arg, configuration); - } - - 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 { - 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"); - } - @Override - public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { - 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"); - } - @Override - 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 { - 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"); - } - } -} diff --git a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/schemas/ObjWithRequiredProps.kt b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/schemas/ObjWithRequiredProps.kt deleted file mode 100644 index bdfa8f9aba7..00000000000 --- a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/schemas/ObjWithRequiredProps.kt +++ /dev/null @@ -1,220 +0,0 @@ -package org.openapijsonschematools.client.components.schemas; -import java.util.ArrayList; -import java.util.HashSet; -import java.util.LinkedHashMap; -import java.util.LinkedHashSet; -import java.util.List; -import java.util.Map; -import java.util.Objects; -import java.util.Set; -import org.checkerframework.checker.nullness.qual.Nullable; -import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags; -import org.openapijsonschematools.client.configurations.SchemaConfiguration; -import org.openapijsonschematools.client.exceptions.InvalidAdditionalPropertyException; -import org.openapijsonschematools.client.exceptions.UnsetPropertyException; -import org.openapijsonschematools.client.exceptions.ValidationException; -import org.openapijsonschematools.client.schemas.GenericBuilder; -import org.openapijsonschematools.client.schemas.StringJsonSchema; -import org.openapijsonschematools.client.schemas.UnsetAddPropsSetter; -import org.openapijsonschematools.client.schemas.validation.FrozenMap; -import org.openapijsonschematools.client.schemas.validation.JsonSchema; -import org.openapijsonschematools.client.schemas.validation.JsonSchemaInfo; -import org.openapijsonschematools.client.schemas.validation.MapSchemaValidator; -import org.openapijsonschematools.client.schemas.validation.PathToSchemasMap; -import org.openapijsonschematools.client.schemas.validation.PropertyEntry; -import org.openapijsonschematools.client.schemas.validation.ValidationMetadata; - -public class ObjWithRequiredProps { - // nest classes so all schemas and input/output classes can be public - - - public static class A extends StringJsonSchema.StringJsonSchema1 { - private static @Nullable A instance = null; - public static A getInstance() { - if (instance == null) { - instance = new A(); - } - return instance; - } - } - - - public static class ObjWithRequiredPropsMap extends FrozenMap<@Nullable Object> { - protected ObjWithRequiredPropsMap(FrozenMap<@Nullable Object> m) { - super(m); - } - public static final Set requiredKeys = Set.of( - "a" - ); - public static final Set optionalKeys = Set.of(); - public static ObjWithRequiredPropsMap of(Map arg, SchemaConfiguration configuration) throws ValidationException { - return ObjWithRequiredProps1.getInstance().validate(arg, configuration); - } - - public String a() { - @Nullable Object value = get("a"); - if (!(value instanceof String)) { - throw new RuntimeException("Invalid value stored for a"); - } - return (String) value; - } - - public @Nullable Object getAdditionalProperty(String name) throws UnsetPropertyException, InvalidAdditionalPropertyException { - throwIfKeyKnown(name, requiredKeys, optionalKeys); - throwIfKeyNotPresent(name); - return get(name); - } - } - - public interface SetterForA { - Map getInstance(); - T getBuilderAfterA(Map instance); - - default T a(String value) { - var instance = getInstance(); - instance.put("a", value); - return getBuilderAfterA(instance); - } - } - - public static class ObjWithRequiredPropsMap0Builder extends UnsetAddPropsSetter implements GenericBuilder> { - private final Map instance; - private static final Set knownKeys = Set.of( - "a" - ); - public Set getKnownKeys() { - return knownKeys; - } - public ObjWithRequiredPropsMap0Builder(Map instance) { - this.instance = instance; - } - public Map build() { - return instance; - } - public Map getInstance() { - return instance; - } - public ObjWithRequiredPropsMap0Builder getBuilderAfterAdditionalProperty(Map instance) { - return this; - } - } - - public static class ObjWithRequiredPropsMapBuilder implements SetterForA { - private final Map instance; - public ObjWithRequiredPropsMapBuilder() { - this.instance = new LinkedHashMap<>(); - } - public Map getInstance() { - return instance; - } - public ObjWithRequiredPropsMap0Builder getBuilderAfterA(Map instance) { - return new ObjWithRequiredPropsMap0Builder(instance); - } - } - - - public sealed interface ObjWithRequiredProps1Boxed permits ObjWithRequiredProps1BoxedMap { - @Nullable Object getData(); - } - - public record ObjWithRequiredProps1BoxedMap(ObjWithRequiredPropsMap data) implements ObjWithRequiredProps1Boxed { - @Override - public @Nullable Object getData() { - return data; - } - } - - - public static class ObjWithRequiredProps1 extends JsonSchema implements MapSchemaValidator { - /* - NOTE: This class is auto generated by OpenAPI JSON Schema Generator. - Ref: https://github.com/openapi-json-schema-tools/openapi-json-schema-generator - - Do not edit the class manually. - */ - private static @Nullable ObjWithRequiredProps1 instance = null; - - protected ObjWithRequiredProps1() { - super(new JsonSchemaInfo() - .type(Set.of(Map.class)) - .properties(Map.ofEntries( - new PropertyEntry("a", A.class) - )) - .required(Set.of( - "a" - )) - .allOf(List.of( - ObjWithRequiredPropsBase.ObjWithRequiredPropsBase1.class - )) - ); - } - - public static ObjWithRequiredProps1 getInstance() { - if (instance == null) { - instance = new ObjWithRequiredProps1(); - } - return instance; - } - - 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 RuntimeException("Invalid non-string key value"); - } - String propertyName = (String) entryKey; - List propertyPathToItem = new ArrayList<>(pathToItem); - propertyPathToItem.add(propertyName); - Object value = entry.getValue(); - LinkedHashMap, Nothing?> schemas = pathToSchemas.get(propertyPathToItem); - if (schemas == null) { - throw new RuntimeException("Validation result is invalid, schemas must exist for a pathToItem"); - } - JsonSchema propertySchema = schemas.entrySet().iterator().next().getKey(); - @Nullable Object propertyInstance = propertySchema.getNewInstance(value, propertyPathToItem, pathToSchemas); - properties.put(propertyName, propertyInstance); - } - FrozenMap<@Nullable Object> castProperties = new FrozenMap<>(properties); - return new ObjWithRequiredPropsMap(castProperties); - } - - 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); - SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().build())); - ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, new PathToSchemasMap(), new LinkedHashSet<>()); - PathToSchemasMap pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet); - return getNewInstance(castArg, validationMetadata.pathToItem(), pathToSchemasMap); - } - - - @Override - public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws 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"); - } - @Override - public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { - if (arg instanceof Map) { - return getNewInstance((Map) arg, pathToItem, pathToSchemas); - } - 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 { - return new ObjWithRequiredProps1BoxedMap(validate(arg, configuration)); - } - @Override - public ObjWithRequiredProps1Boxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { - 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"); - } - } - -} diff --git a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/schemas/ObjWithRequiredPropsBase.kt b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/schemas/ObjWithRequiredPropsBase.kt deleted file mode 100644 index fb8aebee635..00000000000 --- a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/schemas/ObjWithRequiredPropsBase.kt +++ /dev/null @@ -1,217 +0,0 @@ -package org.openapijsonschematools.client.components.schemas; -import java.util.ArrayList; -import java.util.HashSet; -import java.util.LinkedHashMap; -import java.util.LinkedHashSet; -import java.util.List; -import java.util.Map; -import java.util.Objects; -import java.util.Set; -import org.checkerframework.checker.nullness.qual.Nullable; -import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags; -import org.openapijsonschematools.client.configurations.SchemaConfiguration; -import org.openapijsonschematools.client.exceptions.InvalidAdditionalPropertyException; -import org.openapijsonschematools.client.exceptions.UnsetPropertyException; -import org.openapijsonschematools.client.exceptions.ValidationException; -import org.openapijsonschematools.client.schemas.GenericBuilder; -import org.openapijsonschematools.client.schemas.StringJsonSchema; -import org.openapijsonschematools.client.schemas.UnsetAddPropsSetter; -import org.openapijsonschematools.client.schemas.validation.FrozenMap; -import org.openapijsonschematools.client.schemas.validation.JsonSchema; -import org.openapijsonschematools.client.schemas.validation.JsonSchemaInfo; -import org.openapijsonschematools.client.schemas.validation.MapSchemaValidator; -import org.openapijsonschematools.client.schemas.validation.PathToSchemasMap; -import org.openapijsonschematools.client.schemas.validation.PropertyEntry; -import org.openapijsonschematools.client.schemas.validation.ValidationMetadata; - -public class ObjWithRequiredPropsBase { - // nest classes so all schemas and input/output classes can be public - - - public static class B extends StringJsonSchema.StringJsonSchema1 { - private static @Nullable B instance = null; - public static B getInstance() { - if (instance == null) { - instance = new B(); - } - return instance; - } - } - - - public static class ObjWithRequiredPropsBaseMap extends FrozenMap<@Nullable Object> { - protected ObjWithRequiredPropsBaseMap(FrozenMap<@Nullable Object> m) { - super(m); - } - public static final Set requiredKeys = Set.of( - "b" - ); - public static final Set optionalKeys = Set.of(); - public static ObjWithRequiredPropsBaseMap of(Map arg, SchemaConfiguration configuration) throws ValidationException { - return ObjWithRequiredPropsBase1.getInstance().validate(arg, configuration); - } - - public String b() { - @Nullable Object value = get("b"); - if (!(value instanceof String)) { - throw new RuntimeException("Invalid value stored for b"); - } - return (String) value; - } - - public @Nullable Object getAdditionalProperty(String name) throws UnsetPropertyException, InvalidAdditionalPropertyException { - throwIfKeyKnown(name, requiredKeys, optionalKeys); - throwIfKeyNotPresent(name); - return get(name); - } - } - - public interface SetterForB { - Map getInstance(); - T getBuilderAfterB(Map instance); - - default T b(String value) { - var instance = getInstance(); - instance.put("b", value); - return getBuilderAfterB(instance); - } - } - - public static class ObjWithRequiredPropsBaseMap0Builder extends UnsetAddPropsSetter implements GenericBuilder> { - private final Map instance; - private static final Set knownKeys = Set.of( - "b" - ); - public Set getKnownKeys() { - return knownKeys; - } - public ObjWithRequiredPropsBaseMap0Builder(Map instance) { - this.instance = instance; - } - public Map build() { - return instance; - } - public Map getInstance() { - return instance; - } - public ObjWithRequiredPropsBaseMap0Builder getBuilderAfterAdditionalProperty(Map instance) { - return this; - } - } - - public static class ObjWithRequiredPropsBaseMapBuilder implements SetterForB { - private final Map instance; - public ObjWithRequiredPropsBaseMapBuilder() { - this.instance = new LinkedHashMap<>(); - } - public Map getInstance() { - return instance; - } - public ObjWithRequiredPropsBaseMap0Builder getBuilderAfterB(Map instance) { - return new ObjWithRequiredPropsBaseMap0Builder(instance); - } - } - - - public sealed interface ObjWithRequiredPropsBase1Boxed permits ObjWithRequiredPropsBase1BoxedMap { - @Nullable Object getData(); - } - - public record ObjWithRequiredPropsBase1BoxedMap(ObjWithRequiredPropsBaseMap data) implements ObjWithRequiredPropsBase1Boxed { - @Override - public @Nullable Object getData() { - return data; - } - } - - - public static class ObjWithRequiredPropsBase1 extends JsonSchema implements MapSchemaValidator { - /* - NOTE: This class is auto generated by OpenAPI JSON Schema Generator. - Ref: https://github.com/openapi-json-schema-tools/openapi-json-schema-generator - - Do not edit the class manually. - */ - private static @Nullable ObjWithRequiredPropsBase1 instance = null; - - protected ObjWithRequiredPropsBase1() { - super(new JsonSchemaInfo() - .type(Set.of(Map.class)) - .properties(Map.ofEntries( - new PropertyEntry("b", B.class) - )) - .required(Set.of( - "b" - )) - ); - } - - public static ObjWithRequiredPropsBase1 getInstance() { - if (instance == null) { - instance = new ObjWithRequiredPropsBase1(); - } - return instance; - } - - 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 RuntimeException("Invalid non-string key value"); - } - String propertyName = (String) entryKey; - List propertyPathToItem = new ArrayList<>(pathToItem); - propertyPathToItem.add(propertyName); - Object value = entry.getValue(); - LinkedHashMap, Nothing?> schemas = pathToSchemas.get(propertyPathToItem); - if (schemas == null) { - throw new RuntimeException("Validation result is invalid, schemas must exist for a pathToItem"); - } - JsonSchema propertySchema = schemas.entrySet().iterator().next().getKey(); - @Nullable Object propertyInstance = propertySchema.getNewInstance(value, propertyPathToItem, pathToSchemas); - properties.put(propertyName, propertyInstance); - } - FrozenMap<@Nullable Object> castProperties = new FrozenMap<>(properties); - return new ObjWithRequiredPropsBaseMap(castProperties); - } - - 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); - SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().build())); - ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, new PathToSchemasMap(), new LinkedHashSet<>()); - PathToSchemasMap pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet); - return getNewInstance(castArg, validationMetadata.pathToItem(), pathToSchemasMap); - } - - - @Override - public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws 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"); - } - @Override - public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { - if (arg instanceof Map) { - return getNewInstance((Map) arg, pathToItem, pathToSchemas); - } - 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 { - return new ObjWithRequiredPropsBase1BoxedMap(validate(arg, configuration)); - } - @Override - public ObjWithRequiredPropsBase1Boxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { - 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"); - } - } - -} diff --git a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/schemas/ObjectInterface.kt b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/schemas/ObjectInterface.kt deleted file mode 100644 index 9c844505d2c..00000000000 --- a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/schemas/ObjectInterface.kt +++ /dev/null @@ -1,20 +0,0 @@ -package org.openapijsonschematools.client.components.schemas; -import org.checkerframework.checker.nullness.qual.Nullable; -import org.openapijsonschematools.client.schemas.MapJsonSchema; -import org.openapijsonschematools.client.schemas.validation.FrozenMap; - -public class ObjectInterface extends MapJsonSchema { - // nest classes so all schemas and input/output classes can be public - - - public static class ObjectInterface1 extends MapJsonSchema.MapJsonSchema1 { - private static @Nullable ObjectInterface1 instance = null; - public static ObjectInterface1 getInstance() { - if (instance == null) { - instance = new ObjectInterface1(); - } - return instance; - } - } - -} diff --git a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/schemas/ObjectModelWithArgAndArgsProperties.kt b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/schemas/ObjectModelWithArgAndArgsProperties.kt deleted file mode 100644 index d786a0dedde..00000000000 --- a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/schemas/ObjectModelWithArgAndArgsProperties.kt +++ /dev/null @@ -1,280 +0,0 @@ -package org.openapijsonschematools.client.components.schemas; -import java.util.ArrayList; -import java.util.HashSet; -import java.util.LinkedHashMap; -import java.util.LinkedHashSet; -import java.util.List; -import java.util.Map; -import java.util.Objects; -import java.util.Set; -import org.checkerframework.checker.nullness.qual.Nullable; -import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags; -import org.openapijsonschematools.client.configurations.SchemaConfiguration; -import org.openapijsonschematools.client.exceptions.InvalidAdditionalPropertyException; -import org.openapijsonschematools.client.exceptions.UnsetPropertyException; -import org.openapijsonschematools.client.exceptions.ValidationException; -import org.openapijsonschematools.client.schemas.GenericBuilder; -import org.openapijsonschematools.client.schemas.StringJsonSchema; -import org.openapijsonschematools.client.schemas.UnsetAddPropsSetter; -import org.openapijsonschematools.client.schemas.validation.FrozenMap; -import org.openapijsonschematools.client.schemas.validation.JsonSchema; -import org.openapijsonschematools.client.schemas.validation.JsonSchemaInfo; -import org.openapijsonschematools.client.schemas.validation.MapSchemaValidator; -import org.openapijsonschematools.client.schemas.validation.PathToSchemasMap; -import org.openapijsonschematools.client.schemas.validation.PropertyEntry; -import org.openapijsonschematools.client.schemas.validation.ValidationMetadata; - -public class ObjectModelWithArgAndArgsProperties { - // nest classes so all schemas and input/output classes can be public - - - public static class Arg extends StringJsonSchema.StringJsonSchema1 { - private static @Nullable Arg instance = null; - public static Arg getInstance() { - if (instance == null) { - instance = new Arg(); - } - return instance; - } - } - - - public static class Args extends StringJsonSchema.StringJsonSchema1 { - private static @Nullable Args instance = null; - public static Args getInstance() { - if (instance == null) { - instance = new Args(); - } - return instance; - } - } - - - public static class ObjectModelWithArgAndArgsPropertiesMap extends FrozenMap<@Nullable Object> { - protected ObjectModelWithArgAndArgsPropertiesMap(FrozenMap<@Nullable Object> m) { - super(m); - } - public static final Set requiredKeys = Set.of( - "arg", - "args" - ); - public static final Set optionalKeys = Set.of(); - public static ObjectModelWithArgAndArgsPropertiesMap of(Map arg, SchemaConfiguration configuration) throws ValidationException { - return ObjectModelWithArgAndArgsProperties1.getInstance().validate(arg, configuration); - } - - public String arg() { - @Nullable Object value = get("arg"); - if (!(value instanceof String)) { - throw new RuntimeException("Invalid value stored for arg"); - } - return (String) value; - } - - public String args() { - @Nullable Object value = get("args"); - if (!(value instanceof String)) { - throw new RuntimeException("Invalid value stored for args"); - } - return (String) value; - } - - public @Nullable Object getAdditionalProperty(String name) throws UnsetPropertyException, InvalidAdditionalPropertyException { - throwIfKeyKnown(name, requiredKeys, optionalKeys); - throwIfKeyNotPresent(name); - return get(name); - } - } - - public interface SetterForArg { - Map getInstance(); - T getBuilderAfterArg(Map instance); - - default T arg(String value) { - var instance = getInstance(); - instance.put("arg", value); - return getBuilderAfterArg(instance); - } - } - - public interface SetterForArgs { - Map getInstance(); - T getBuilderAfterArgs(Map instance); - - default T args(String value) { - var instance = getInstance(); - instance.put("args", value); - return getBuilderAfterArgs(instance); - } - } - - public static class ObjectModelWithArgAndArgsPropertiesMap00Builder extends UnsetAddPropsSetter implements GenericBuilder> { - private final Map instance; - private static final Set knownKeys = Set.of( - "arg", - "args" - ); - public Set getKnownKeys() { - return knownKeys; - } - public ObjectModelWithArgAndArgsPropertiesMap00Builder(Map instance) { - this.instance = instance; - } - public Map build() { - return instance; - } - public Map getInstance() { - return instance; - } - public ObjectModelWithArgAndArgsPropertiesMap00Builder getBuilderAfterAdditionalProperty(Map instance) { - return this; - } - } - - public static class ObjectModelWithArgAndArgsPropertiesMap01Builder implements SetterForArgs { - private final Map instance; - public ObjectModelWithArgAndArgsPropertiesMap01Builder(Map instance) { - this.instance = instance; - } - public Map getInstance() { - return instance; - } - public ObjectModelWithArgAndArgsPropertiesMap00Builder getBuilderAfterArgs(Map instance) { - return new ObjectModelWithArgAndArgsPropertiesMap00Builder(instance); - } - } - - public static class ObjectModelWithArgAndArgsPropertiesMap10Builder implements SetterForArg { - private final Map instance; - public ObjectModelWithArgAndArgsPropertiesMap10Builder(Map instance) { - this.instance = instance; - } - public Map getInstance() { - return instance; - } - public ObjectModelWithArgAndArgsPropertiesMap00Builder getBuilderAfterArg(Map instance) { - return new ObjectModelWithArgAndArgsPropertiesMap00Builder(instance); - } - } - - public static class ObjectModelWithArgAndArgsPropertiesMapBuilder implements SetterForArg, SetterForArgs { - private final Map instance; - public ObjectModelWithArgAndArgsPropertiesMapBuilder() { - this.instance = new LinkedHashMap<>(); - } - public Map getInstance() { - return instance; - } - public ObjectModelWithArgAndArgsPropertiesMap01Builder getBuilderAfterArg(Map instance) { - return new ObjectModelWithArgAndArgsPropertiesMap01Builder(instance); - } - public ObjectModelWithArgAndArgsPropertiesMap10Builder getBuilderAfterArgs(Map instance) { - return new ObjectModelWithArgAndArgsPropertiesMap10Builder(instance); - } - } - - - public sealed interface ObjectModelWithArgAndArgsProperties1Boxed permits ObjectModelWithArgAndArgsProperties1BoxedMap { - @Nullable Object getData(); - } - - public record ObjectModelWithArgAndArgsProperties1BoxedMap(ObjectModelWithArgAndArgsPropertiesMap data) implements ObjectModelWithArgAndArgsProperties1Boxed { - @Override - public @Nullable Object getData() { - return data; - } - } - - - public static class ObjectModelWithArgAndArgsProperties1 extends JsonSchema implements MapSchemaValidator { - /* - NOTE: This class is auto generated by OpenAPI JSON Schema Generator. - Ref: https://github.com/openapi-json-schema-tools/openapi-json-schema-generator - - Do not edit the class manually. - */ - private static @Nullable ObjectModelWithArgAndArgsProperties1 instance = null; - - protected ObjectModelWithArgAndArgsProperties1() { - super(new JsonSchemaInfo() - .type(Set.of(Map.class)) - .properties(Map.ofEntries( - new PropertyEntry("arg", Arg.class), - new PropertyEntry("args", Args.class) - )) - .required(Set.of( - "arg", - "args" - )) - ); - } - - public static ObjectModelWithArgAndArgsProperties1 getInstance() { - if (instance == null) { - instance = new ObjectModelWithArgAndArgsProperties1(); - } - return instance; - } - - 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 RuntimeException("Invalid non-string key value"); - } - String propertyName = (String) entryKey; - List propertyPathToItem = new ArrayList<>(pathToItem); - propertyPathToItem.add(propertyName); - Object value = entry.getValue(); - LinkedHashMap, Nothing?> schemas = pathToSchemas.get(propertyPathToItem); - if (schemas == null) { - throw new RuntimeException("Validation result is invalid, schemas must exist for a pathToItem"); - } - JsonSchema propertySchema = schemas.entrySet().iterator().next().getKey(); - @Nullable Object propertyInstance = propertySchema.getNewInstance(value, propertyPathToItem, pathToSchemas); - properties.put(propertyName, propertyInstance); - } - FrozenMap<@Nullable Object> castProperties = new FrozenMap<>(properties); - return new ObjectModelWithArgAndArgsPropertiesMap(castProperties); - } - - 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); - SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().build())); - ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, new PathToSchemasMap(), new LinkedHashSet<>()); - PathToSchemasMap pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet); - return getNewInstance(castArg, validationMetadata.pathToItem(), pathToSchemasMap); - } - - - @Override - public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws 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"); - } - @Override - public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { - if (arg instanceof Map) { - return getNewInstance((Map) arg, pathToItem, pathToSchemas); - } - 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 { - return new ObjectModelWithArgAndArgsProperties1BoxedMap(validate(arg, configuration)); - } - @Override - public ObjectModelWithArgAndArgsProperties1Boxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { - 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"); - } - } - -} diff --git a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/schemas/ObjectModelWithRefProps.kt b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/schemas/ObjectModelWithRefProps.kt deleted file mode 100644 index 7b79624f159..00000000000 --- a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/schemas/ObjectModelWithRefProps.kt +++ /dev/null @@ -1,268 +0,0 @@ -package org.openapijsonschematools.client.components.schemas; -import java.util.ArrayList; -import java.util.HashSet; -import java.util.LinkedHashMap; -import java.util.LinkedHashSet; -import java.util.List; -import java.util.Map; -import java.util.Objects; -import java.util.Set; -import org.checkerframework.checker.nullness.qual.Nullable; -import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags; -import org.openapijsonschematools.client.configurations.SchemaConfiguration; -import org.openapijsonschematools.client.exceptions.InvalidAdditionalPropertyException; -import org.openapijsonschematools.client.exceptions.UnsetPropertyException; -import org.openapijsonschematools.client.exceptions.ValidationException; -import org.openapijsonschematools.client.schemas.GenericBuilder; -import org.openapijsonschematools.client.schemas.UnsetAddPropsSetter; -import org.openapijsonschematools.client.schemas.validation.FrozenMap; -import org.openapijsonschematools.client.schemas.validation.JsonSchema; -import org.openapijsonschematools.client.schemas.validation.JsonSchemaInfo; -import org.openapijsonschematools.client.schemas.validation.MapSchemaValidator; -import org.openapijsonschematools.client.schemas.validation.PathToSchemasMap; -import org.openapijsonschematools.client.schemas.validation.PropertyEntry; -import org.openapijsonschematools.client.schemas.validation.ValidationMetadata; - -public class ObjectModelWithRefProps { - // nest classes so all schemas and input/output classes can be public - - - public static class ObjectModelWithRefPropsMap extends FrozenMap<@Nullable Object> { - protected ObjectModelWithRefPropsMap(FrozenMap<@Nullable Object> m) { - super(m); - } - public static final Set requiredKeys = Set.of(); - public static final Set optionalKeys = Set.of( - "myNumber", - "myString", - "myBoolean" - ); - public static ObjectModelWithRefPropsMap of(Map arg, SchemaConfiguration configuration) throws ValidationException { - return ObjectModelWithRefProps1.getInstance().validate(arg, configuration); - } - - public Number myNumber() throws UnsetPropertyException { - String key = "myNumber"; - throwIfKeyNotPresent(key); - @Nullable Object value = get(key); - if (!(value instanceof Number)) { - throw new RuntimeException("Invalid value stored for myNumber"); - } - return (Number) value; - } - - public String myString() throws UnsetPropertyException { - String key = "myString"; - throwIfKeyNotPresent(key); - @Nullable Object value = get(key); - if (!(value instanceof String)) { - throw new RuntimeException("Invalid value stored for myString"); - } - return (String) value; - } - - public boolean myBoolean() throws UnsetPropertyException { - String key = "myBoolean"; - throwIfKeyNotPresent(key); - @Nullable Object value = get(key); - if (!(value instanceof Boolean)) { - throw new RuntimeException("Invalid value stored for myBoolean"); - } - return (boolean) value; - } - - public @Nullable Object getAdditionalProperty(String name) throws UnsetPropertyException, InvalidAdditionalPropertyException { - throwIfKeyKnown(name, requiredKeys, optionalKeys); - throwIfKeyNotPresent(name); - return get(name); - } - } - - public interface SetterForMyNumber { - Map getInstance(); - T getBuilderAfterMyNumber(Map instance); - - default T myNumber(int value) { - var instance = getInstance(); - instance.put("myNumber", value); - return getBuilderAfterMyNumber(instance); - } - - default T myNumber(float value) { - var instance = getInstance(); - instance.put("myNumber", value); - return getBuilderAfterMyNumber(instance); - } - - default T myNumber(long value) { - var instance = getInstance(); - instance.put("myNumber", value); - return getBuilderAfterMyNumber(instance); - } - - default T myNumber(double value) { - var instance = getInstance(); - instance.put("myNumber", value); - return getBuilderAfterMyNumber(instance); - } - } - - public interface SetterForMyString { - Map getInstance(); - T getBuilderAfterMyString(Map instance); - - default T myString(String value) { - var instance = getInstance(); - instance.put("myString", value); - return getBuilderAfterMyString(instance); - } - } - - public interface SetterForMyBoolean { - Map getInstance(); - T getBuilderAfterMyBoolean(Map instance); - - default T myBoolean(boolean value) { - var instance = getInstance(); - instance.put("myBoolean", value); - return getBuilderAfterMyBoolean(instance); - } - } - - public static class ObjectModelWithRefPropsMapBuilder extends UnsetAddPropsSetter implements GenericBuilder>, SetterForMyNumber, SetterForMyString, SetterForMyBoolean { - private final Map instance; - private static final Set knownKeys = Set.of( - "myNumber", - "myString", - "myBoolean" - ); - public Set getKnownKeys() { - return knownKeys; - } - public ObjectModelWithRefPropsMapBuilder() { - this.instance = new LinkedHashMap<>(); - } - public Map build() { - return instance; - } - public Map getInstance() { - return instance; - } - public ObjectModelWithRefPropsMapBuilder getBuilderAfterMyNumber(Map instance) { - return this; - } - public ObjectModelWithRefPropsMapBuilder getBuilderAfterMyString(Map instance) { - return this; - } - public ObjectModelWithRefPropsMapBuilder getBuilderAfterMyBoolean(Map instance) { - return this; - } - public ObjectModelWithRefPropsMapBuilder getBuilderAfterAdditionalProperty(Map instance) { - return this; - } - } - - - public sealed interface ObjectModelWithRefProps1Boxed permits ObjectModelWithRefProps1BoxedMap { - @Nullable Object getData(); - } - - public record ObjectModelWithRefProps1BoxedMap(ObjectModelWithRefPropsMap data) implements ObjectModelWithRefProps1Boxed { - @Override - public @Nullable Object getData() { - return data; - } - } - - - public static class ObjectModelWithRefProps1 extends JsonSchema implements MapSchemaValidator { - /* - NOTE: This class is auto generated by OpenAPI JSON Schema Generator. - Ref: https://github.com/openapi-json-schema-tools/openapi-json-schema-generator - - Do not edit the class manually. - - a model that includes properties which should stay primitive (String + Boolean) and one which is defined as a class, NumberWithValidations - */ - private static @Nullable ObjectModelWithRefProps1 instance = null; - - protected ObjectModelWithRefProps1() { - super(new JsonSchemaInfo() - .type(Set.of(Map.class)) - .properties(Map.ofEntries( - new PropertyEntry("myNumber", NumberWithValidations.NumberWithValidations1.class), - new PropertyEntry("myString", StringSchema.StringSchema1.class), - new PropertyEntry("myBoolean", BooleanSchema.BooleanSchema1.class) - )) - ); - } - - public static ObjectModelWithRefProps1 getInstance() { - if (instance == null) { - instance = new ObjectModelWithRefProps1(); - } - return instance; - } - - 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 RuntimeException("Invalid non-string key value"); - } - String propertyName = (String) entryKey; - List propertyPathToItem = new ArrayList<>(pathToItem); - propertyPathToItem.add(propertyName); - Object value = entry.getValue(); - LinkedHashMap, Nothing?> schemas = pathToSchemas.get(propertyPathToItem); - if (schemas == null) { - throw new RuntimeException("Validation result is invalid, schemas must exist for a pathToItem"); - } - JsonSchema propertySchema = schemas.entrySet().iterator().next().getKey(); - @Nullable Object propertyInstance = propertySchema.getNewInstance(value, propertyPathToItem, pathToSchemas); - properties.put(propertyName, propertyInstance); - } - FrozenMap<@Nullable Object> castProperties = new FrozenMap<>(properties); - return new ObjectModelWithRefPropsMap(castProperties); - } - - 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); - SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().build())); - ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, new PathToSchemasMap(), new LinkedHashSet<>()); - PathToSchemasMap pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet); - return getNewInstance(castArg, validationMetadata.pathToItem(), pathToSchemasMap); - } - - - @Override - public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws 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"); - } - @Override - public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { - if (arg instanceof Map) { - return getNewInstance((Map) arg, pathToItem, pathToSchemas); - } - 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 { - return new ObjectModelWithRefProps1BoxedMap(validate(arg, configuration)); - } - @Override - public ObjectModelWithRefProps1Boxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { - 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"); - } - } - -} diff --git a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/schemas/ObjectWithAllOfWithReqTestPropFromUnsetAddProp.kt b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/schemas/ObjectWithAllOfWithReqTestPropFromUnsetAddProp.kt deleted file mode 100644 index 8446ab928c2..00000000000 --- a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/schemas/ObjectWithAllOfWithReqTestPropFromUnsetAddProp.kt +++ /dev/null @@ -1,589 +0,0 @@ -package org.openapijsonschematools.client.components.schemas; -import java.time.LocalDate; -import java.time.ZonedDateTime; -import java.util.ArrayList; -import java.util.HashSet; -import java.util.LinkedHashMap; -import java.util.LinkedHashSet; -import java.util.List; -import java.util.Map; -import java.util.Objects; -import java.util.Set; -import java.util.UUID; -import org.checkerframework.checker.nullness.qual.Nullable; -import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags; -import org.openapijsonschematools.client.configurations.SchemaConfiguration; -import org.openapijsonschematools.client.exceptions.InvalidAdditionalPropertyException; -import org.openapijsonschematools.client.exceptions.UnsetPropertyException; -import org.openapijsonschematools.client.exceptions.ValidationException; -import org.openapijsonschematools.client.schemas.GenericBuilder; -import org.openapijsonschematools.client.schemas.StringJsonSchema; -import org.openapijsonschematools.client.schemas.UnsetAddPropsSetter; -import org.openapijsonschematools.client.schemas.validation.BooleanSchemaValidator; -import org.openapijsonschematools.client.schemas.validation.FrozenList; -import org.openapijsonschematools.client.schemas.validation.FrozenMap; -import org.openapijsonschematools.client.schemas.validation.JsonSchema; -import org.openapijsonschematools.client.schemas.validation.JsonSchemaInfo; -import org.openapijsonschematools.client.schemas.validation.ListSchemaValidator; -import org.openapijsonschematools.client.schemas.validation.MapSchemaValidator; -import org.openapijsonschematools.client.schemas.validation.NullSchemaValidator; -import org.openapijsonschematools.client.schemas.validation.NumberSchemaValidator; -import org.openapijsonschematools.client.schemas.validation.PathToSchemasMap; -import org.openapijsonschematools.client.schemas.validation.PropertyEntry; -import org.openapijsonschematools.client.schemas.validation.StringSchemaValidator; -import org.openapijsonschematools.client.schemas.validation.ValidationMetadata; - -public class ObjectWithAllOfWithReqTestPropFromUnsetAddProp { - // nest classes so all schemas and input/output classes can be public - - - public static class Name extends StringJsonSchema.StringJsonSchema1 { - private static @Nullable Name instance = null; - public static Name getInstance() { - if (instance == null) { - instance = new Name(); - } - return instance; - } - } - - - public static class Schema1Map extends FrozenMap<@Nullable Object> { - protected Schema1Map(FrozenMap<@Nullable Object> m) { - super(m); - } - public static final Set requiredKeys = Set.of( - "test" - ); - public static final Set optionalKeys = Set.of( - "name" - ); - public static Schema1Map of(Map arg, SchemaConfiguration configuration) throws ValidationException { - return Schema1.getInstance().validate(arg, configuration); - } - - public @Nullable Object test() { - try { - return getOrThrow("version"); - } catch (UnsetPropertyException e) { - throw new RuntimeException(e); - } - } - - public String name() throws UnsetPropertyException { - String key = "name"; - throwIfKeyNotPresent(key); - @Nullable Object value = get(key); - if (!(value instanceof String)) { - throw new RuntimeException("Invalid value stored for name"); - } - return (String) value; - } - - public @Nullable Object getAdditionalProperty(String name) throws UnsetPropertyException, InvalidAdditionalPropertyException { - throwIfKeyKnown(name, requiredKeys, optionalKeys); - throwIfKeyNotPresent(name); - return get(name); - } - } - - public interface SetterForTest { - Map getInstance(); - T getBuilderAfterTest(Map instance); - - default T test(Nothing? value) { - var instance = getInstance(); - instance.put("test", null); - return getBuilderAfterTest(instance); - } - - default T test(boolean value) { - var instance = getInstance(); - instance.put("test", value); - return getBuilderAfterTest(instance); - } - - default T test(String value) { - var instance = getInstance(); - instance.put("test", value); - return getBuilderAfterTest(instance); - } - - default T test(int value) { - var instance = getInstance(); - instance.put("test", value); - return getBuilderAfterTest(instance); - } - - default T test(float value) { - var instance = getInstance(); - instance.put("test", value); - return getBuilderAfterTest(instance); - } - - default T test(long value) { - var instance = getInstance(); - instance.put("test", value); - return getBuilderAfterTest(instance); - } - - default T test(double value) { - var instance = getInstance(); - instance.put("test", value); - return getBuilderAfterTest(instance); - } - - default T test(List value) { - var instance = getInstance(); - instance.put("test", value); - return getBuilderAfterTest(instance); - } - - default T test(Map value) { - var instance = getInstance(); - instance.put("test", value); - return getBuilderAfterTest(instance); - } - } - - public interface SetterForName { - Map getInstance(); - T getBuilderAfterName(Map instance); - - default T name(String value) { - var instance = getInstance(); - instance.put("name", value); - return getBuilderAfterName(instance); - } - } - - public static class Schema1Map0Builder extends UnsetAddPropsSetter implements GenericBuilder>, SetterForName { - private final Map instance; - private static final Set knownKeys = Set.of( - "test", - "name" - ); - public Set getKnownKeys() { - return knownKeys; - } - public Schema1Map0Builder(Map instance) { - this.instance = instance; - } - public Map build() { - return instance; - } - public Map getInstance() { - return instance; - } - public Schema1Map0Builder getBuilderAfterName(Map instance) { - return this; - } - public Schema1Map0Builder getBuilderAfterAdditionalProperty(Map instance) { - return this; - } - } - - public static class Schema1MapBuilder implements SetterForTest { - private final Map instance; - public Schema1MapBuilder() { - this.instance = new LinkedHashMap<>(); - } - public Map getInstance() { - return instance; - } - public Schema1Map0Builder getBuilderAfterTest(Map instance) { - return new Schema1Map0Builder(instance); - } - } - - - public sealed interface Schema1Boxed permits Schema1BoxedMap { - @Nullable Object getData(); - } - - public record Schema1BoxedMap(Schema1Map data) implements Schema1Boxed { - @Override - public @Nullable Object getData() { - return data; - } - } - - - public static class Schema1 extends JsonSchema implements MapSchemaValidator { - private static @Nullable Schema1 instance = null; - - protected Schema1() { - super(new JsonSchemaInfo() - .type(Set.of(Map.class)) - .properties(Map.ofEntries( - new PropertyEntry("name", Name.class) - )) - .required(Set.of( - "test" - )) - ); - } - - public static Schema1 getInstance() { - if (instance == null) { - instance = new Schema1(); - } - return instance; - } - - 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 RuntimeException("Invalid non-string key value"); - } - String propertyName = (String) entryKey; - List propertyPathToItem = new ArrayList<>(pathToItem); - propertyPathToItem.add(propertyName); - Object value = entry.getValue(); - LinkedHashMap, Nothing?> schemas = pathToSchemas.get(propertyPathToItem); - if (schemas == null) { - throw new RuntimeException("Validation result is invalid, schemas must exist for a pathToItem"); - } - JsonSchema propertySchema = schemas.entrySet().iterator().next().getKey(); - @Nullable Object propertyInstance = propertySchema.getNewInstance(value, propertyPathToItem, pathToSchemas); - properties.put(propertyName, propertyInstance); - } - FrozenMap<@Nullable Object> castProperties = new FrozenMap<>(properties); - return new Schema1Map(castProperties); - } - - 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); - SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().build())); - ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, new PathToSchemasMap(), new LinkedHashSet<>()); - PathToSchemasMap pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet); - return getNewInstance(castArg, validationMetadata.pathToItem(), pathToSchemasMap); - } - - - @Override - public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws 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"); - } - @Override - public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { - if (arg instanceof Map) { - return getNewInstance((Map) arg, pathToItem, pathToSchemas); - } - 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 { - return new Schema1BoxedMap(validate(arg, configuration)); - } - @Override - public Schema1Boxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { - 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"); - } - } - - - public sealed interface ObjectWithAllOfWithReqTestPropFromUnsetAddProp1Boxed permits ObjectWithAllOfWithReqTestPropFromUnsetAddProp1BoxedVoid, ObjectWithAllOfWithReqTestPropFromUnsetAddProp1BoxedBoolean, ObjectWithAllOfWithReqTestPropFromUnsetAddProp1BoxedNumber, ObjectWithAllOfWithReqTestPropFromUnsetAddProp1BoxedString, ObjectWithAllOfWithReqTestPropFromUnsetAddProp1BoxedList, ObjectWithAllOfWithReqTestPropFromUnsetAddProp1BoxedMap { - @Nullable Object getData(); - } - - public record ObjectWithAllOfWithReqTestPropFromUnsetAddProp1BoxedVoid(Nothing? data) implements ObjectWithAllOfWithReqTestPropFromUnsetAddProp1Boxed { - @Override - public @Nullable Object getData() { - return data; - } - } - - public record ObjectWithAllOfWithReqTestPropFromUnsetAddProp1BoxedBoolean(boolean data) implements ObjectWithAllOfWithReqTestPropFromUnsetAddProp1Boxed { - @Override - public @Nullable Object getData() { - return data; - } - } - - public record ObjectWithAllOfWithReqTestPropFromUnsetAddProp1BoxedNumber(Number data) implements ObjectWithAllOfWithReqTestPropFromUnsetAddProp1Boxed { - @Override - public @Nullable Object getData() { - return data; - } - } - - public record ObjectWithAllOfWithReqTestPropFromUnsetAddProp1BoxedString(String data) implements ObjectWithAllOfWithReqTestPropFromUnsetAddProp1Boxed { - @Override - public @Nullable Object getData() { - return data; - } - } - - public record ObjectWithAllOfWithReqTestPropFromUnsetAddProp1BoxedList(FrozenList<@Nullable Object> data) implements ObjectWithAllOfWithReqTestPropFromUnsetAddProp1Boxed { - @Override - public @Nullable Object getData() { - return data; - } - } - - public record ObjectWithAllOfWithReqTestPropFromUnsetAddProp1BoxedMap(FrozenMap<@Nullable Object> data) implements ObjectWithAllOfWithReqTestPropFromUnsetAddProp1Boxed { - @Override - public @Nullable Object getData() { - return data; - } - } - - - public static class ObjectWithAllOfWithReqTestPropFromUnsetAddProp1 extends JsonSchema implements NullSchemaValidator, BooleanSchemaValidator, NumberSchemaValidator, StringSchemaValidator, ListSchemaValidator, ObjectWithAllOfWithReqTestPropFromUnsetAddProp1BoxedList>, MapSchemaValidator, ObjectWithAllOfWithReqTestPropFromUnsetAddProp1BoxedMap> { - /* - NOTE: This class is auto generated by OpenAPI JSON Schema Generator. - Ref: https://github.com/openapi-json-schema-tools/openapi-json-schema-generator - - Do not edit the class manually. - */ - private static @Nullable ObjectWithAllOfWithReqTestPropFromUnsetAddProp1 instance = null; - - protected ObjectWithAllOfWithReqTestPropFromUnsetAddProp1() { - super(new JsonSchemaInfo() - .allOf(List.of( - ObjectWithOptionalTestProp.ObjectWithOptionalTestProp1.class, - Schema1.class - )) - ); - } - - public static ObjectWithAllOfWithReqTestPropFromUnsetAddProp1 getInstance() { - if (instance == null) { - instance = new ObjectWithAllOfWithReqTestPropFromUnsetAddProp1(); - } - return instance; - } - - @Override - public Nothing? validate(Nothing? arg, SchemaConfiguration configuration) throws ValidationException { - Set> pathSet = new HashSet<>(); - List pathToItem = List.of("args[0]"); - Nothing? castArg = castToAllowedTypes(arg, pathToItem, pathSet); - SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().build())); - PathToSchemasMap validatedPathToSchemas = new PathToSchemasMap(); - ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, new LinkedHashSet<>()); - getPathToSchemas(this, castArg, validationMetadata, pathSet); - return castArg; - } - - @Override - public boolean validate(boolean arg, SchemaConfiguration configuration) throws ValidationException { - Set> pathSet = new HashSet<>(); - List pathToItem = List.of("args[0]"); - boolean castArg = castToAllowedTypes(arg, pathToItem, pathSet); - SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().build())); - PathToSchemasMap validatedPathToSchemas = new PathToSchemasMap(); - ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, new LinkedHashSet<>()); - getPathToSchemas(this, castArg, validationMetadata, pathSet); - return castArg; - } - - @Override - public Number validate(Number arg, SchemaConfiguration configuration) throws ValidationException { - Set> pathSet = new HashSet<>(); - List pathToItem = List.of("args[0]"); - Number castArg = castToAllowedTypes(arg, pathToItem, pathSet); - SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().build())); - PathToSchemasMap validatedPathToSchemas = new PathToSchemasMap(); - ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, new LinkedHashSet<>()); - getPathToSchemas(this, castArg, validationMetadata, pathSet); - return castArg; - } - - public int validate(int arg, SchemaConfiguration configuration) throws ValidationException { - return (int) validate((Number) arg, configuration); - } - - public long validate(long arg, SchemaConfiguration configuration) throws ValidationException { - return (long) validate((Number) arg, configuration); - } - - public float validate(float arg, SchemaConfiguration configuration) throws ValidationException { - return (float) validate((Number) arg, configuration); - } - - public double validate(double arg, SchemaConfiguration configuration) throws ValidationException { - return (double) validate((Number) arg, configuration); - } - - @Override - public String validate(String arg, SchemaConfiguration configuration) throws ValidationException { - Set> pathSet = new HashSet<>(); - List pathToItem = List.of("args[0]"); - String castArg = castToAllowedTypes(arg, pathToItem, pathSet); - SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().build())); - PathToSchemasMap validatedPathToSchemas = new PathToSchemasMap(); - ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, new LinkedHashSet<>()); - getPathToSchemas(this, castArg, validationMetadata, pathSet); - return castArg; - } - - public String validate(LocalDate arg, SchemaConfiguration configuration) throws ValidationException { - return validate(arg.toString(), configuration); - } - - public String validate(ZonedDateTime arg, SchemaConfiguration configuration) throws ValidationException { - return validate(arg.toString(), configuration); - } - - public String validate(UUID arg, SchemaConfiguration configuration) throws ValidationException { - return validate(arg.toString(), configuration); - } - - @Override - public FrozenList<@Nullable Object> getNewInstance(List arg, List pathToItem, PathToSchemasMap pathToSchemas) { - List<@Nullable Object> items = new ArrayList<>(); - int i = 0; - for (Object item: arg) { - List itemPathToItem = new ArrayList<>(pathToItem); - itemPathToItem.add(i); - LinkedHashMap, Nothing?> schemas = pathToSchemas.get(itemPathToItem); - if (schemas == null) { - throw new RuntimeException("Validation result is invalid, schemas must exist for a pathToItem"); - } - JsonSchema itemSchema = schemas.entrySet().iterator().next().getKey(); - @Nullable Object itemInstance = itemSchema.getNewInstance(item, itemPathToItem, pathToSchemas); - items.add(itemInstance); - i += 1; - } - FrozenList<@Nullable Object> newInstanceItems = new FrozenList<>(items); - return newInstanceItems; - } - - 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); - SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().build())); - ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, new PathToSchemasMap(), new LinkedHashSet<>()); - PathToSchemasMap pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet); - return getNewInstance(castArg, validationMetadata.pathToItem(), pathToSchemasMap); - } - - @Override - 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 RuntimeException("Invalid non-string key value"); - } - String propertyName = (String) entryKey; - List propertyPathToItem = new ArrayList<>(pathToItem); - propertyPathToItem.add(propertyName); - Object value = entry.getValue(); - LinkedHashMap, Nothing?> schemas = pathToSchemas.get(propertyPathToItem); - if (schemas == null) { - throw new RuntimeException("Validation result is invalid, schemas must exist for a pathToItem"); - } - JsonSchema propertySchema = schemas.entrySet().iterator().next().getKey(); - @Nullable Object propertyInstance = propertySchema.getNewInstance(value, propertyPathToItem, pathToSchemas); - properties.put(propertyName, propertyInstance); - } - FrozenMap<@Nullable Object> castProperties = new FrozenMap<>(properties); - return castProperties; - } - - public FrozenMap<@Nullable Object> validate(Map arg, SchemaConfiguration configuration) throws ValidationException { - Set> pathSet = new HashSet<>(); - List pathToItem = List.of("args[0]"); - Map castArg = castToAllowedTypes(arg, pathToItem, pathSet); - SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().build())); - PathToSchemasMap validatedPathToSchemas = new PathToSchemasMap(); - ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, new LinkedHashSet<>()); - PathToSchemasMap pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet); - return getNewInstance(castArg, validationMetadata.pathToItem(), pathToSchemasMap); - } - - @Override - public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { - if (arg == null) { - return validate((Nothing?) null, configuration); - } else if (arg instanceof Boolean) { - boolean boolArg = (Boolean) arg; - return validate(boolArg, configuration); - } else if (arg instanceof Number) { - return validate((Number) arg, configuration); - } else if (arg instanceof String) { - return validate((String) arg, configuration); - } else if (arg instanceof List) { - return validate((List) arg, 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"); - } - @Override - public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { - if (arg == null) { - return getNewInstance((Nothing?) null, pathToItem, pathToSchemas); - } else if (arg instanceof Boolean) { - boolean boolArg = (Boolean) arg; - return getNewInstance(boolArg, pathToItem, pathToSchemas); - } else if (arg instanceof Number) { - return getNewInstance((Number) arg, pathToItem, pathToSchemas); - } else if (arg instanceof String) { - return getNewInstance((String) arg, pathToItem, pathToSchemas); - } else if (arg instanceof List) { - return getNewInstance((List) arg, 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"); - } - @Override - public ObjectWithAllOfWithReqTestPropFromUnsetAddProp1BoxedVoid validateAndBox(Nothing? arg, SchemaConfiguration configuration) throws ValidationException { - return new ObjectWithAllOfWithReqTestPropFromUnsetAddProp1BoxedVoid(validate(arg, configuration)); - } - @Override - 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 { - return new ObjectWithAllOfWithReqTestPropFromUnsetAddProp1BoxedNumber(validate(arg, configuration)); - } - @Override - 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 { - return new ObjectWithAllOfWithReqTestPropFromUnsetAddProp1BoxedList(validate(arg, configuration)); - } - @Override - 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 { - if (arg == null) { - Nothing? castArg = (Nothing?) arg; - return validateAndBox(castArg, configuration); - } else if (arg instanceof Boolean booleanArg) { - boolean castArg = booleanArg; - return validateAndBox(castArg, configuration); - } else if (arg instanceof String castArg) { - return validateAndBox(castArg, configuration); - } else if (arg instanceof Number castArg) { - return validateAndBox(castArg, configuration); - } else if (arg instanceof List castArg) { - 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"); - } - } -} diff --git a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/schemas/ObjectWithCollidingProperties.kt b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/schemas/ObjectWithCollidingProperties.kt deleted file mode 100644 index 3fd4b4ed714..00000000000 --- a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/schemas/ObjectWithCollidingProperties.kt +++ /dev/null @@ -1,246 +0,0 @@ -package org.openapijsonschematools.client.components.schemas; -import java.util.ArrayList; -import java.util.HashSet; -import java.util.LinkedHashMap; -import java.util.LinkedHashSet; -import java.util.List; -import java.util.Map; -import java.util.Objects; -import java.util.Set; -import org.checkerframework.checker.nullness.qual.Nullable; -import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags; -import org.openapijsonschematools.client.configurations.SchemaConfiguration; -import org.openapijsonschematools.client.exceptions.InvalidAdditionalPropertyException; -import org.openapijsonschematools.client.exceptions.UnsetPropertyException; -import org.openapijsonschematools.client.exceptions.ValidationException; -import org.openapijsonschematools.client.schemas.GenericBuilder; -import org.openapijsonschematools.client.schemas.MapJsonSchema; -import org.openapijsonschematools.client.schemas.UnsetAddPropsSetter; -import org.openapijsonschematools.client.schemas.validation.FrozenMap; -import org.openapijsonschematools.client.schemas.validation.JsonSchema; -import org.openapijsonschematools.client.schemas.validation.JsonSchemaInfo; -import org.openapijsonschematools.client.schemas.validation.MapSchemaValidator; -import org.openapijsonschematools.client.schemas.validation.PathToSchemasMap; -import org.openapijsonschematools.client.schemas.validation.PropertyEntry; -import org.openapijsonschematools.client.schemas.validation.ValidationMetadata; - -public class ObjectWithCollidingProperties { - // nest classes so all schemas and input/output classes can be public - - - public static class SomeProp extends MapJsonSchema.MapJsonSchema1 { - private static @Nullable SomeProp instance = null; - public static SomeProp getInstance() { - if (instance == null) { - instance = new SomeProp(); - } - return instance; - } - } - - - public static class Someprop extends MapJsonSchema.MapJsonSchema1 { - private static @Nullable Someprop instance = null; - public static Someprop getInstance() { - if (instance == null) { - instance = new Someprop(); - } - return instance; - } - } - - - public static class ObjectWithCollidingPropertiesMap extends FrozenMap<@Nullable Object> { - protected ObjectWithCollidingPropertiesMap(FrozenMap<@Nullable Object> m) { - super(m); - } - public static final Set requiredKeys = Set.of(); - public static final Set optionalKeys = Set.of( - "someProp", - "someprop" - ); - public static ObjectWithCollidingPropertiesMap of(Map arg, SchemaConfiguration configuration) throws ValidationException { - return ObjectWithCollidingProperties1.getInstance().validate(arg, configuration); - } - - public FrozenMap someProp() throws UnsetPropertyException { - String key = "someProp"; - throwIfKeyNotPresent(key); - @Nullable Object value = get(key); - if (!(value instanceof FrozenMap)) { - throw new RuntimeException("Invalid value stored for someProp"); - } - return (FrozenMap) value; - } - - public FrozenMap someprop() throws UnsetPropertyException { - String key = "someprop"; - throwIfKeyNotPresent(key); - @Nullable Object value = get(key); - if (!(value instanceof FrozenMap)) { - throw new RuntimeException("Invalid value stored for someprop"); - } - return (FrozenMap) value; - } - - public @Nullable Object getAdditionalProperty(String name) throws UnsetPropertyException, InvalidAdditionalPropertyException { - throwIfKeyKnown(name, requiredKeys, optionalKeys); - throwIfKeyNotPresent(name); - return get(name); - } - } - - public interface SetterForSomeProp { - Map getInstance(); - T getBuilderAfterSomeProp(Map instance); - - default T someProp(Map value) { - var instance = getInstance(); - instance.put("someProp", value); - return getBuilderAfterSomeProp(instance); - } - } - - public interface SetterForSomeprop { - Map getInstance(); - T getBuilderAfterSomeprop(Map instance); - - default T someprop(Map value) { - var instance = getInstance(); - instance.put("someprop", value); - return getBuilderAfterSomeprop(instance); - } - } - - public static class ObjectWithCollidingPropertiesMapBuilder extends UnsetAddPropsSetter implements GenericBuilder>, SetterForSomeProp, SetterForSomeprop { - private final Map instance; - private static final Set knownKeys = Set.of( - "someProp", - "someprop" - ); - public Set getKnownKeys() { - return knownKeys; - } - public ObjectWithCollidingPropertiesMapBuilder() { - this.instance = new LinkedHashMap<>(); - } - public Map build() { - return instance; - } - public Map getInstance() { - return instance; - } - public ObjectWithCollidingPropertiesMapBuilder getBuilderAfterSomeProp(Map instance) { - return this; - } - public ObjectWithCollidingPropertiesMapBuilder getBuilderAfterSomeprop(Map instance) { - return this; - } - public ObjectWithCollidingPropertiesMapBuilder getBuilderAfterAdditionalProperty(Map instance) { - return this; - } - } - - - public sealed interface ObjectWithCollidingProperties1Boxed permits ObjectWithCollidingProperties1BoxedMap { - @Nullable Object getData(); - } - - public record ObjectWithCollidingProperties1BoxedMap(ObjectWithCollidingPropertiesMap data) implements ObjectWithCollidingProperties1Boxed { - @Override - public @Nullable Object getData() { - return data; - } - } - - - public static class ObjectWithCollidingProperties1 extends JsonSchema implements MapSchemaValidator { - /* - NOTE: This class is auto generated by OpenAPI JSON Schema Generator. - Ref: https://github.com/openapi-json-schema-tools/openapi-json-schema-generator - - Do not edit the class manually. - - component with properties that have name collisions - */ - private static @Nullable ObjectWithCollidingProperties1 instance = null; - - protected ObjectWithCollidingProperties1() { - super(new JsonSchemaInfo() - .type(Set.of(Map.class)) - .properties(Map.ofEntries( - new PropertyEntry("someProp", SomeProp.class), - new PropertyEntry("someprop", Someprop.class) - )) - ); - } - - public static ObjectWithCollidingProperties1 getInstance() { - if (instance == null) { - instance = new ObjectWithCollidingProperties1(); - } - return instance; - } - - 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 RuntimeException("Invalid non-string key value"); - } - String propertyName = (String) entryKey; - List propertyPathToItem = new ArrayList<>(pathToItem); - propertyPathToItem.add(propertyName); - Object value = entry.getValue(); - LinkedHashMap, Nothing?> schemas = pathToSchemas.get(propertyPathToItem); - if (schemas == null) { - throw new RuntimeException("Validation result is invalid, schemas must exist for a pathToItem"); - } - JsonSchema propertySchema = schemas.entrySet().iterator().next().getKey(); - @Nullable Object propertyInstance = propertySchema.getNewInstance(value, propertyPathToItem, pathToSchemas); - properties.put(propertyName, propertyInstance); - } - FrozenMap<@Nullable Object> castProperties = new FrozenMap<>(properties); - return new ObjectWithCollidingPropertiesMap(castProperties); - } - - 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); - SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().build())); - ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, new PathToSchemasMap(), new LinkedHashSet<>()); - PathToSchemasMap pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet); - return getNewInstance(castArg, validationMetadata.pathToItem(), pathToSchemasMap); - } - - - @Override - public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws 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"); - } - @Override - public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { - if (arg instanceof Map) { - return getNewInstance((Map) arg, pathToItem, pathToSchemas); - } - 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 { - return new ObjectWithCollidingProperties1BoxedMap(validate(arg, configuration)); - } - @Override - public ObjectWithCollidingProperties1Boxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { - 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"); - } - } - -} diff --git a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/schemas/ObjectWithDecimalProperties.kt b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/schemas/ObjectWithDecimalProperties.kt deleted file mode 100644 index df7bd037680..00000000000 --- a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/schemas/ObjectWithDecimalProperties.kt +++ /dev/null @@ -1,260 +0,0 @@ -package org.openapijsonschematools.client.components.schemas; -import java.util.ArrayList; -import java.util.HashSet; -import java.util.LinkedHashMap; -import java.util.LinkedHashSet; -import java.util.List; -import java.util.Map; -import java.util.Objects; -import java.util.Set; -import org.checkerframework.checker.nullness.qual.Nullable; -import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags; -import org.openapijsonschematools.client.configurations.SchemaConfiguration; -import org.openapijsonschematools.client.exceptions.InvalidAdditionalPropertyException; -import org.openapijsonschematools.client.exceptions.UnsetPropertyException; -import org.openapijsonschematools.client.exceptions.ValidationException; -import org.openapijsonschematools.client.schemas.DecimalJsonSchema; -import org.openapijsonschematools.client.schemas.GenericBuilder; -import org.openapijsonschematools.client.schemas.UnsetAddPropsSetter; -import org.openapijsonschematools.client.schemas.validation.FrozenMap; -import org.openapijsonschematools.client.schemas.validation.JsonSchema; -import org.openapijsonschematools.client.schemas.validation.JsonSchemaInfo; -import org.openapijsonschematools.client.schemas.validation.MapSchemaValidator; -import org.openapijsonschematools.client.schemas.validation.PathToSchemasMap; -import org.openapijsonschematools.client.schemas.validation.PropertyEntry; -import org.openapijsonschematools.client.schemas.validation.ValidationMetadata; - -public class ObjectWithDecimalProperties { - // nest classes so all schemas and input/output classes can be public - - - public static class Width extends DecimalJsonSchema.DecimalJsonSchema1 { - private static @Nullable Width instance = null; - public static Width getInstance() { - if (instance == null) { - instance = new Width(); - } - return instance; - } - } - - - public static class ObjectWithDecimalPropertiesMap extends FrozenMap<@Nullable Object> { - protected ObjectWithDecimalPropertiesMap(FrozenMap<@Nullable Object> m) { - super(m); - } - public static final Set requiredKeys = Set.of(); - public static final Set optionalKeys = Set.of( - "length", - "width", - "cost" - ); - public static ObjectWithDecimalPropertiesMap of(Map arg, SchemaConfiguration configuration) throws ValidationException { - return ObjectWithDecimalProperties1.getInstance().validate(arg, configuration); - } - - public String length() throws UnsetPropertyException { - String key = "length"; - throwIfKeyNotPresent(key); - @Nullable Object value = get(key); - if (!(value instanceof String)) { - throw new RuntimeException("Invalid value stored for length"); - } - return (String) value; - } - - public String width() throws UnsetPropertyException { - String key = "width"; - throwIfKeyNotPresent(key); - @Nullable Object value = get(key); - if (!(value instanceof String)) { - throw new RuntimeException("Invalid value stored for width"); - } - return (String) value; - } - - public Money.MoneyMap cost() throws UnsetPropertyException { - String key = "cost"; - throwIfKeyNotPresent(key); - @Nullable Object value = get(key); - if (!(value instanceof Money.MoneyMap)) { - throw new RuntimeException("Invalid value stored for cost"); - } - return (Money.MoneyMap) value; - } - - public @Nullable Object getAdditionalProperty(String name) throws UnsetPropertyException, InvalidAdditionalPropertyException { - throwIfKeyKnown(name, requiredKeys, optionalKeys); - throwIfKeyNotPresent(name); - return get(name); - } - } - - public interface SetterForLength { - Map getInstance(); - T getBuilderAfterLength(Map instance); - - default T length(String value) { - var instance = getInstance(); - instance.put("length", value); - return getBuilderAfterLength(instance); - } - } - - public interface SetterForWidth { - Map getInstance(); - T getBuilderAfterWidth(Map instance); - - default T width(String value) { - var instance = getInstance(); - instance.put("width", value); - return getBuilderAfterWidth(instance); - } - } - - public interface SetterForCost { - Map getInstance(); - T getBuilderAfterCost(Map instance); - - default T cost(Map value) { - var instance = getInstance(); - instance.put("cost", value); - return getBuilderAfterCost(instance); - } - } - - public static class ObjectWithDecimalPropertiesMapBuilder extends UnsetAddPropsSetter implements GenericBuilder>, SetterForLength, SetterForWidth, SetterForCost { - private final Map instance; - private static final Set knownKeys = Set.of( - "length", - "width", - "cost" - ); - public Set getKnownKeys() { - return knownKeys; - } - public ObjectWithDecimalPropertiesMapBuilder() { - this.instance = new LinkedHashMap<>(); - } - public Map build() { - return instance; - } - public Map getInstance() { - return instance; - } - public ObjectWithDecimalPropertiesMapBuilder getBuilderAfterLength(Map instance) { - return this; - } - public ObjectWithDecimalPropertiesMapBuilder getBuilderAfterWidth(Map instance) { - return this; - } - public ObjectWithDecimalPropertiesMapBuilder getBuilderAfterCost(Map instance) { - return this; - } - public ObjectWithDecimalPropertiesMapBuilder getBuilderAfterAdditionalProperty(Map instance) { - return this; - } - } - - - public sealed interface ObjectWithDecimalProperties1Boxed permits ObjectWithDecimalProperties1BoxedMap { - @Nullable Object getData(); - } - - public record ObjectWithDecimalProperties1BoxedMap(ObjectWithDecimalPropertiesMap data) implements ObjectWithDecimalProperties1Boxed { - @Override - public @Nullable Object getData() { - return data; - } - } - - - public static class ObjectWithDecimalProperties1 extends JsonSchema implements MapSchemaValidator { - /* - NOTE: This class is auto generated by OpenAPI JSON Schema Generator. - Ref: https://github.com/openapi-json-schema-tools/openapi-json-schema-generator - - Do not edit the class manually. - */ - private static @Nullable ObjectWithDecimalProperties1 instance = null; - - protected ObjectWithDecimalProperties1() { - super(new JsonSchemaInfo() - .type(Set.of(Map.class)) - .properties(Map.ofEntries( - new PropertyEntry("length", DecimalPayload.DecimalPayload1.class), - new PropertyEntry("width", Width.class), - new PropertyEntry("cost", Money.Money1.class) - )) - ); - } - - public static ObjectWithDecimalProperties1 getInstance() { - if (instance == null) { - instance = new ObjectWithDecimalProperties1(); - } - return instance; - } - - 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 RuntimeException("Invalid non-string key value"); - } - String propertyName = (String) entryKey; - List propertyPathToItem = new ArrayList<>(pathToItem); - propertyPathToItem.add(propertyName); - Object value = entry.getValue(); - LinkedHashMap, Nothing?> schemas = pathToSchemas.get(propertyPathToItem); - if (schemas == null) { - throw new RuntimeException("Validation result is invalid, schemas must exist for a pathToItem"); - } - JsonSchema propertySchema = schemas.entrySet().iterator().next().getKey(); - @Nullable Object propertyInstance = propertySchema.getNewInstance(value, propertyPathToItem, pathToSchemas); - properties.put(propertyName, propertyInstance); - } - FrozenMap<@Nullable Object> castProperties = new FrozenMap<>(properties); - return new ObjectWithDecimalPropertiesMap(castProperties); - } - - 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); - SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().build())); - ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, new PathToSchemasMap(), new LinkedHashSet<>()); - PathToSchemasMap pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet); - return getNewInstance(castArg, validationMetadata.pathToItem(), pathToSchemasMap); - } - - - @Override - public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws 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"); - } - @Override - public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { - if (arg instanceof Map) { - return getNewInstance((Map) arg, pathToItem, pathToSchemas); - } - 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 { - return new ObjectWithDecimalProperties1BoxedMap(validate(arg, configuration)); - } - @Override - public ObjectWithDecimalProperties1Boxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { - 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"); - } - } - -} diff --git a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/schemas/ObjectWithDifficultlyNamedProps.kt b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/schemas/ObjectWithDifficultlyNamedProps.kt deleted file mode 100644 index 506f79e01cd..00000000000 --- a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/schemas/ObjectWithDifficultlyNamedProps.kt +++ /dev/null @@ -1,306 +0,0 @@ -package org.openapijsonschematools.client.components.schemas; -import java.util.ArrayList; -import java.util.HashSet; -import java.util.LinkedHashMap; -import java.util.LinkedHashSet; -import java.util.List; -import java.util.Map; -import java.util.Objects; -import java.util.Set; -import org.checkerframework.checker.nullness.qual.Nullable; -import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags; -import org.openapijsonschematools.client.configurations.SchemaConfiguration; -import org.openapijsonschematools.client.exceptions.InvalidAdditionalPropertyException; -import org.openapijsonschematools.client.exceptions.UnsetPropertyException; -import org.openapijsonschematools.client.exceptions.ValidationException; -import org.openapijsonschematools.client.schemas.GenericBuilder; -import org.openapijsonschematools.client.schemas.Int64JsonSchema; -import org.openapijsonschematools.client.schemas.IntJsonSchema; -import org.openapijsonschematools.client.schemas.StringJsonSchema; -import org.openapijsonschematools.client.schemas.UnsetAddPropsSetter; -import org.openapijsonschematools.client.schemas.validation.FrozenMap; -import org.openapijsonschematools.client.schemas.validation.JsonSchema; -import org.openapijsonschematools.client.schemas.validation.JsonSchemaInfo; -import org.openapijsonschematools.client.schemas.validation.MapSchemaValidator; -import org.openapijsonschematools.client.schemas.validation.PathToSchemasMap; -import org.openapijsonschematools.client.schemas.validation.PropertyEntry; -import org.openapijsonschematools.client.schemas.validation.ValidationMetadata; - -public class ObjectWithDifficultlyNamedProps { - // nest classes so all schemas and input/output classes can be public - - - public static class Specialpropertyname extends Int64JsonSchema.Int64JsonSchema1 { - private static @Nullable Specialpropertyname instance = null; - public static Specialpropertyname getInstance() { - if (instance == null) { - instance = new Specialpropertyname(); - } - return instance; - } - } - - - public static class Schema123list extends StringJsonSchema.StringJsonSchema1 { - private static @Nullable Schema123list instance = null; - public static Schema123list getInstance() { - if (instance == null) { - instance = new Schema123list(); - } - return instance; - } - } - - - public static class Schema123Number extends IntJsonSchema.IntJsonSchema1 { - private static @Nullable Schema123Number instance = null; - public static Schema123Number getInstance() { - if (instance == null) { - instance = new Schema123Number(); - } - return instance; - } - } - - - public static class ObjectWithDifficultlyNamedPropsMap extends FrozenMap<@Nullable Object> { - protected ObjectWithDifficultlyNamedPropsMap(FrozenMap<@Nullable Object> m) { - super(m); - } - public static final Set requiredKeys = Set.of( - "123-list" - ); - public static final Set optionalKeys = Set.of( - "$special[property.name]", - "123Number" - ); - public static ObjectWithDifficultlyNamedPropsMap of(Map arg, SchemaConfiguration configuration) throws ValidationException { - return ObjectWithDifficultlyNamedProps1.getInstance().validate(arg, configuration); - } - - public @Nullable Object getAdditionalProperty(String name) throws UnsetPropertyException, InvalidAdditionalPropertyException { - throwIfKeyKnown(name, requiredKeys, optionalKeys); - throwIfKeyNotPresent(name); - return get(name); - } - } - - public interface SetterForSchema123list { - Map getInstance(); - T getBuilderAfterSchema123list(Map instance); - - default T digitOne23HyphenMinusList(String value) { - var instance = getInstance(); - instance.put("123-list", value); - return getBuilderAfterSchema123list(instance); - } - } - - public interface SetterForSpecialpropertyname { - Map getInstance(); - T getBuilderAfterSpecialpropertyname(Map instance); - - default T dollarSignSpecialLeftSquareBracketPropertyFullStopNameRightSquareBracket(int value) { - var instance = getInstance(); - instance.put("$special[property.name]", value); - return getBuilderAfterSpecialpropertyname(instance); - } - - default T dollarSignSpecialLeftSquareBracketPropertyFullStopNameRightSquareBracket(float value) { - var instance = getInstance(); - instance.put("$special[property.name]", value); - return getBuilderAfterSpecialpropertyname(instance); - } - - default T dollarSignSpecialLeftSquareBracketPropertyFullStopNameRightSquareBracket(long value) { - var instance = getInstance(); - instance.put("$special[property.name]", value); - return getBuilderAfterSpecialpropertyname(instance); - } - - default T dollarSignSpecialLeftSquareBracketPropertyFullStopNameRightSquareBracket(double value) { - var instance = getInstance(); - instance.put("$special[property.name]", value); - return getBuilderAfterSpecialpropertyname(instance); - } - } - - public interface SetterForSchema123Number { - Map getInstance(); - T getBuilderAfterSchema123Number(Map instance); - - default T digitOne23number(int value) { - var instance = getInstance(); - instance.put("123Number", value); - return getBuilderAfterSchema123Number(instance); - } - - default T digitOne23number(float value) { - var instance = getInstance(); - instance.put("123Number", value); - return getBuilderAfterSchema123Number(instance); - } - - default T digitOne23number(long value) { - var instance = getInstance(); - instance.put("123Number", value); - return getBuilderAfterSchema123Number(instance); - } - - default T digitOne23number(double value) { - var instance = getInstance(); - instance.put("123Number", value); - return getBuilderAfterSchema123Number(instance); - } - } - - public static class ObjectWithDifficultlyNamedPropsMap0Builder extends UnsetAddPropsSetter implements GenericBuilder>, SetterForSpecialpropertyname, SetterForSchema123Number { - private final Map instance; - private static final Set knownKeys = Set.of( - "123-list", - "$special[property.name]", - "123Number" - ); - public Set getKnownKeys() { - return knownKeys; - } - public ObjectWithDifficultlyNamedPropsMap0Builder(Map instance) { - this.instance = instance; - } - public Map build() { - return instance; - } - public Map getInstance() { - return instance; - } - public ObjectWithDifficultlyNamedPropsMap0Builder getBuilderAfterSpecialpropertyname(Map instance) { - return this; - } - public ObjectWithDifficultlyNamedPropsMap0Builder getBuilderAfterSchema123Number(Map instance) { - return this; - } - public ObjectWithDifficultlyNamedPropsMap0Builder getBuilderAfterAdditionalProperty(Map instance) { - return this; - } - } - - public static class ObjectWithDifficultlyNamedPropsMapBuilder implements SetterForSchema123list { - private final Map instance; - public ObjectWithDifficultlyNamedPropsMapBuilder() { - this.instance = new LinkedHashMap<>(); - } - public Map getInstance() { - return instance; - } - public ObjectWithDifficultlyNamedPropsMap0Builder getBuilderAfterSchema123list(Map instance) { - return new ObjectWithDifficultlyNamedPropsMap0Builder(instance); - } - } - - - public sealed interface ObjectWithDifficultlyNamedProps1Boxed permits ObjectWithDifficultlyNamedProps1BoxedMap { - @Nullable Object getData(); - } - - public record ObjectWithDifficultlyNamedProps1BoxedMap(ObjectWithDifficultlyNamedPropsMap data) implements ObjectWithDifficultlyNamedProps1Boxed { - @Override - public @Nullable Object getData() { - return data; - } - } - - - public static class ObjectWithDifficultlyNamedProps1 extends JsonSchema implements MapSchemaValidator { - /* - NOTE: This class is auto generated by OpenAPI JSON Schema Generator. - Ref: https://github.com/openapi-json-schema-tools/openapi-json-schema-generator - - Do not edit the class manually. - - model with properties that have invalid names for python - */ - private static @Nullable ObjectWithDifficultlyNamedProps1 instance = null; - - protected ObjectWithDifficultlyNamedProps1() { - super(new JsonSchemaInfo() - .type(Set.of(Map.class)) - .properties(Map.ofEntries( - new PropertyEntry("$special[property.name]", Specialpropertyname.class), - new PropertyEntry("123-list", Schema123list.class), - new PropertyEntry("123Number", Schema123Number.class) - )) - .required(Set.of( - "123-list" - )) - ); - } - - public static ObjectWithDifficultlyNamedProps1 getInstance() { - if (instance == null) { - instance = new ObjectWithDifficultlyNamedProps1(); - } - return instance; - } - - 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 RuntimeException("Invalid non-string key value"); - } - String propertyName = (String) entryKey; - List propertyPathToItem = new ArrayList<>(pathToItem); - propertyPathToItem.add(propertyName); - Object value = entry.getValue(); - LinkedHashMap, Nothing?> schemas = pathToSchemas.get(propertyPathToItem); - if (schemas == null) { - throw new RuntimeException("Validation result is invalid, schemas must exist for a pathToItem"); - } - JsonSchema propertySchema = schemas.entrySet().iterator().next().getKey(); - @Nullable Object propertyInstance = propertySchema.getNewInstance(value, propertyPathToItem, pathToSchemas); - properties.put(propertyName, propertyInstance); - } - FrozenMap<@Nullable Object> castProperties = new FrozenMap<>(properties); - return new ObjectWithDifficultlyNamedPropsMap(castProperties); - } - - 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); - SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().build())); - ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, new PathToSchemasMap(), new LinkedHashSet<>()); - PathToSchemasMap pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet); - return getNewInstance(castArg, validationMetadata.pathToItem(), pathToSchemasMap); - } - - - @Override - public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws 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"); - } - @Override - public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { - if (arg instanceof Map) { - return getNewInstance((Map) arg, pathToItem, pathToSchemas); - } - 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 { - return new ObjectWithDifficultlyNamedProps1BoxedMap(validate(arg, configuration)); - } - @Override - public ObjectWithDifficultlyNamedProps1Boxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { - 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"); - } - } - -} diff --git a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/schemas/ObjectWithInlineCompositionProperty.kt b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/schemas/ObjectWithInlineCompositionProperty.kt deleted file mode 100644 index 2dd41f751f3..00000000000 --- a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/schemas/ObjectWithInlineCompositionProperty.kt +++ /dev/null @@ -1,602 +0,0 @@ -package org.openapijsonschematools.client.components.schemas; -import java.time.LocalDate; -import java.time.ZonedDateTime; -import java.util.ArrayList; -import java.util.HashSet; -import java.util.LinkedHashMap; -import java.util.LinkedHashSet; -import java.util.List; -import java.util.Map; -import java.util.Objects; -import java.util.Set; -import java.util.UUID; -import org.checkerframework.checker.nullness.qual.Nullable; -import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags; -import org.openapijsonschematools.client.configurations.SchemaConfiguration; -import org.openapijsonschematools.client.exceptions.InvalidAdditionalPropertyException; -import org.openapijsonschematools.client.exceptions.UnsetPropertyException; -import org.openapijsonschematools.client.exceptions.ValidationException; -import org.openapijsonschematools.client.schemas.GenericBuilder; -import org.openapijsonschematools.client.schemas.UnsetAddPropsSetter; -import org.openapijsonschematools.client.schemas.validation.BooleanSchemaValidator; -import org.openapijsonschematools.client.schemas.validation.FrozenList; -import org.openapijsonschematools.client.schemas.validation.FrozenMap; -import org.openapijsonschematools.client.schemas.validation.JsonSchema; -import org.openapijsonschematools.client.schemas.validation.JsonSchemaInfo; -import org.openapijsonschematools.client.schemas.validation.ListSchemaValidator; -import org.openapijsonschematools.client.schemas.validation.MapSchemaValidator; -import org.openapijsonschematools.client.schemas.validation.NullSchemaValidator; -import org.openapijsonschematools.client.schemas.validation.NumberSchemaValidator; -import org.openapijsonschematools.client.schemas.validation.PathToSchemasMap; -import org.openapijsonschematools.client.schemas.validation.PropertyEntry; -import org.openapijsonschematools.client.schemas.validation.StringSchemaValidator; -import org.openapijsonschematools.client.schemas.validation.ValidationMetadata; - -public class ObjectWithInlineCompositionProperty { - // nest classes so all schemas and input/output classes can be public - - - public sealed interface Schema0Boxed permits Schema0BoxedString { - @Nullable Object getData(); - } - - public record Schema0BoxedString(String data) implements Schema0Boxed { - @Override - public @Nullable Object getData() { - return data; - } - } - - - - public static class Schema0 extends JsonSchema implements StringSchemaValidator { - private static @Nullable Schema0 instance = null; - - protected Schema0() { - super(new JsonSchemaInfo() - .type(Set.of( - String.class - )) - .minLength(1) - ); - } - - public static Schema0 getInstance() { - if (instance == null) { - instance = new Schema0(); - } - return instance; - } - - @Override - public String validate(String arg, SchemaConfiguration configuration) throws ValidationException { - Set> pathSet = new HashSet<>(); - List pathToItem = List.of("args[0"); - String castArg = castToAllowedTypes(arg, pathToItem, pathSet); - SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().build())); - ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, new PathToSchemasMap(), new LinkedHashSet<>()); - getPathToSchemas(this, castArg, validationMetadata, pathSet); - return castArg; - } - - @Override - public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws 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"); - } - @Override - public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { - 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"); - } - @Override - 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 { - 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"); - } - } - - public sealed interface SomePropBoxed permits SomePropBoxedVoid, SomePropBoxedBoolean, SomePropBoxedNumber, SomePropBoxedString, SomePropBoxedList, SomePropBoxedMap { - @Nullable Object getData(); - } - - public record SomePropBoxedVoid(Nothing? data) implements SomePropBoxed { - @Override - public @Nullable Object getData() { - return data; - } - } - - public record SomePropBoxedBoolean(boolean data) implements SomePropBoxed { - @Override - public @Nullable Object getData() { - return data; - } - } - - public record SomePropBoxedNumber(Number data) implements SomePropBoxed { - @Override - public @Nullable Object getData() { - return data; - } - } - - public record SomePropBoxedString(String data) implements SomePropBoxed { - @Override - public @Nullable Object getData() { - return data; - } - } - - public record SomePropBoxedList(FrozenList<@Nullable Object> data) implements SomePropBoxed { - @Override - public @Nullable Object getData() { - return data; - } - } - - public record SomePropBoxedMap(FrozenMap<@Nullable Object> data) implements SomePropBoxed { - @Override - public @Nullable Object getData() { - return data; - } - } - - - public static class SomeProp extends JsonSchema implements NullSchemaValidator, BooleanSchemaValidator, NumberSchemaValidator, StringSchemaValidator, ListSchemaValidator, SomePropBoxedList>, MapSchemaValidator, SomePropBoxedMap> { - private static @Nullable SomeProp instance = null; - - protected SomeProp() { - super(new JsonSchemaInfo() - .allOf(List.of( - Schema0.class - )) - ); - } - - public static SomeProp getInstance() { - if (instance == null) { - instance = new SomeProp(); - } - return instance; - } - - @Override - public Nothing? validate(Nothing? arg, SchemaConfiguration configuration) throws ValidationException { - Set> pathSet = new HashSet<>(); - List pathToItem = List.of("args[0]"); - Nothing? castArg = castToAllowedTypes(arg, pathToItem, pathSet); - SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().build())); - PathToSchemasMap validatedPathToSchemas = new PathToSchemasMap(); - ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, new LinkedHashSet<>()); - getPathToSchemas(this, castArg, validationMetadata, pathSet); - return castArg; - } - - @Override - public boolean validate(boolean arg, SchemaConfiguration configuration) throws ValidationException { - Set> pathSet = new HashSet<>(); - List pathToItem = List.of("args[0]"); - boolean castArg = castToAllowedTypes(arg, pathToItem, pathSet); - SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().build())); - PathToSchemasMap validatedPathToSchemas = new PathToSchemasMap(); - ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, new LinkedHashSet<>()); - getPathToSchemas(this, castArg, validationMetadata, pathSet); - return castArg; - } - - @Override - public Number validate(Number arg, SchemaConfiguration configuration) throws ValidationException { - Set> pathSet = new HashSet<>(); - List pathToItem = List.of("args[0]"); - Number castArg = castToAllowedTypes(arg, pathToItem, pathSet); - SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().build())); - PathToSchemasMap validatedPathToSchemas = new PathToSchemasMap(); - ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, new LinkedHashSet<>()); - getPathToSchemas(this, castArg, validationMetadata, pathSet); - return castArg; - } - - public int validate(int arg, SchemaConfiguration configuration) throws ValidationException { - return (int) validate((Number) arg, configuration); - } - - public long validate(long arg, SchemaConfiguration configuration) throws ValidationException { - return (long) validate((Number) arg, configuration); - } - - public float validate(float arg, SchemaConfiguration configuration) throws ValidationException { - return (float) validate((Number) arg, configuration); - } - - public double validate(double arg, SchemaConfiguration configuration) throws ValidationException { - return (double) validate((Number) arg, configuration); - } - - @Override - public String validate(String arg, SchemaConfiguration configuration) throws ValidationException { - Set> pathSet = new HashSet<>(); - List pathToItem = List.of("args[0]"); - String castArg = castToAllowedTypes(arg, pathToItem, pathSet); - SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().build())); - PathToSchemasMap validatedPathToSchemas = new PathToSchemasMap(); - ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, new LinkedHashSet<>()); - getPathToSchemas(this, castArg, validationMetadata, pathSet); - return castArg; - } - - public String validate(LocalDate arg, SchemaConfiguration configuration) throws ValidationException { - return validate(arg.toString(), configuration); - } - - public String validate(ZonedDateTime arg, SchemaConfiguration configuration) throws ValidationException { - return validate(arg.toString(), configuration); - } - - public String validate(UUID arg, SchemaConfiguration configuration) throws ValidationException { - return validate(arg.toString(), configuration); - } - - @Override - public FrozenList<@Nullable Object> getNewInstance(List arg, List pathToItem, PathToSchemasMap pathToSchemas) { - List<@Nullable Object> items = new ArrayList<>(); - int i = 0; - for (Object item: arg) { - List itemPathToItem = new ArrayList<>(pathToItem); - itemPathToItem.add(i); - LinkedHashMap, Nothing?> schemas = pathToSchemas.get(itemPathToItem); - if (schemas == null) { - throw new RuntimeException("Validation result is invalid, schemas must exist for a pathToItem"); - } - JsonSchema itemSchema = schemas.entrySet().iterator().next().getKey(); - @Nullable Object itemInstance = itemSchema.getNewInstance(item, itemPathToItem, pathToSchemas); - items.add(itemInstance); - i += 1; - } - FrozenList<@Nullable Object> newInstanceItems = new FrozenList<>(items); - return newInstanceItems; - } - - 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); - SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().build())); - ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, new PathToSchemasMap(), new LinkedHashSet<>()); - PathToSchemasMap pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet); - return getNewInstance(castArg, validationMetadata.pathToItem(), pathToSchemasMap); - } - - @Override - 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 RuntimeException("Invalid non-string key value"); - } - String propertyName = (String) entryKey; - List propertyPathToItem = new ArrayList<>(pathToItem); - propertyPathToItem.add(propertyName); - Object value = entry.getValue(); - LinkedHashMap, Nothing?> schemas = pathToSchemas.get(propertyPathToItem); - if (schemas == null) { - throw new RuntimeException("Validation result is invalid, schemas must exist for a pathToItem"); - } - JsonSchema propertySchema = schemas.entrySet().iterator().next().getKey(); - @Nullable Object propertyInstance = propertySchema.getNewInstance(value, propertyPathToItem, pathToSchemas); - properties.put(propertyName, propertyInstance); - } - FrozenMap<@Nullable Object> castProperties = new FrozenMap<>(properties); - return castProperties; - } - - public FrozenMap<@Nullable Object> validate(Map arg, SchemaConfiguration configuration) throws ValidationException { - Set> pathSet = new HashSet<>(); - List pathToItem = List.of("args[0]"); - Map castArg = castToAllowedTypes(arg, pathToItem, pathSet); - SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().build())); - PathToSchemasMap validatedPathToSchemas = new PathToSchemasMap(); - ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, new LinkedHashSet<>()); - PathToSchemasMap pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet); - return getNewInstance(castArg, validationMetadata.pathToItem(), pathToSchemasMap); - } - - @Override - public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { - if (arg == null) { - return validate((Nothing?) null, configuration); - } else if (arg instanceof Boolean) { - boolean boolArg = (Boolean) arg; - return validate(boolArg, configuration); - } else if (arg instanceof Number) { - return validate((Number) arg, configuration); - } else if (arg instanceof String) { - return validate((String) arg, configuration); - } else if (arg instanceof List) { - return validate((List) arg, 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"); - } - @Override - public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { - if (arg == null) { - return getNewInstance((Nothing?) null, pathToItem, pathToSchemas); - } else if (arg instanceof Boolean) { - boolean boolArg = (Boolean) arg; - return getNewInstance(boolArg, pathToItem, pathToSchemas); - } else if (arg instanceof Number) { - return getNewInstance((Number) arg, pathToItem, pathToSchemas); - } else if (arg instanceof String) { - return getNewInstance((String) arg, pathToItem, pathToSchemas); - } else if (arg instanceof List) { - return getNewInstance((List) arg, 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"); - } - @Override - public SomePropBoxedVoid validateAndBox(Nothing? arg, SchemaConfiguration configuration) throws ValidationException { - return new SomePropBoxedVoid(validate(arg, configuration)); - } - @Override - 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 { - return new SomePropBoxedNumber(validate(arg, configuration)); - } - @Override - 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 { - return new SomePropBoxedList(validate(arg, configuration)); - } - @Override - 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 { - if (arg == null) { - Nothing? castArg = (Nothing?) arg; - return validateAndBox(castArg, configuration); - } else if (arg instanceof Boolean booleanArg) { - boolean castArg = booleanArg; - return validateAndBox(castArg, configuration); - } else if (arg instanceof String castArg) { - return validateAndBox(castArg, configuration); - } else if (arg instanceof Number castArg) { - return validateAndBox(castArg, configuration); - } else if (arg instanceof List castArg) { - 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"); - } - } - - public static class ObjectWithInlineCompositionPropertyMap extends FrozenMap<@Nullable Object> { - protected ObjectWithInlineCompositionPropertyMap(FrozenMap<@Nullable Object> m) { - super(m); - } - public static final Set requiredKeys = Set.of(); - public static final Set optionalKeys = Set.of( - "someProp" - ); - public static ObjectWithInlineCompositionPropertyMap of(Map arg, SchemaConfiguration configuration) throws ValidationException { - return ObjectWithInlineCompositionProperty1.getInstance().validate(arg, configuration); - } - - public @Nullable Object someProp() throws UnsetPropertyException { - return getOrThrow("someProp"); - } - - public @Nullable Object getAdditionalProperty(String name) throws UnsetPropertyException, InvalidAdditionalPropertyException { - throwIfKeyKnown(name, requiredKeys, optionalKeys); - throwIfKeyNotPresent(name); - return get(name); - } - } - - public interface SetterForSomeProp { - Map getInstance(); - T getBuilderAfterSomeProp(Map instance); - - default T someProp(Nothing? value) { - var instance = getInstance(); - instance.put("someProp", null); - return getBuilderAfterSomeProp(instance); - } - - default T someProp(boolean value) { - var instance = getInstance(); - instance.put("someProp", value); - return getBuilderAfterSomeProp(instance); - } - - default T someProp(String value) { - var instance = getInstance(); - instance.put("someProp", value); - return getBuilderAfterSomeProp(instance); - } - - default T someProp(int value) { - var instance = getInstance(); - instance.put("someProp", value); - return getBuilderAfterSomeProp(instance); - } - - default T someProp(float value) { - var instance = getInstance(); - instance.put("someProp", value); - return getBuilderAfterSomeProp(instance); - } - - default T someProp(long value) { - var instance = getInstance(); - instance.put("someProp", value); - return getBuilderAfterSomeProp(instance); - } - - default T someProp(double value) { - var instance = getInstance(); - instance.put("someProp", value); - return getBuilderAfterSomeProp(instance); - } - - default T someProp(List value) { - var instance = getInstance(); - instance.put("someProp", value); - return getBuilderAfterSomeProp(instance); - } - - default T someProp(Map value) { - var instance = getInstance(); - instance.put("someProp", value); - return getBuilderAfterSomeProp(instance); - } - } - - public static class ObjectWithInlineCompositionPropertyMapBuilder extends UnsetAddPropsSetter implements GenericBuilder>, SetterForSomeProp { - private final Map instance; - private static final Set knownKeys = Set.of( - "someProp" - ); - public Set getKnownKeys() { - return knownKeys; - } - public ObjectWithInlineCompositionPropertyMapBuilder() { - this.instance = new LinkedHashMap<>(); - } - public Map build() { - return instance; - } - public Map getInstance() { - return instance; - } - public ObjectWithInlineCompositionPropertyMapBuilder getBuilderAfterSomeProp(Map instance) { - return this; - } - public ObjectWithInlineCompositionPropertyMapBuilder getBuilderAfterAdditionalProperty(Map instance) { - return this; - } - } - - - public sealed interface ObjectWithInlineCompositionProperty1Boxed permits ObjectWithInlineCompositionProperty1BoxedMap { - @Nullable Object getData(); - } - - public record ObjectWithInlineCompositionProperty1BoxedMap(ObjectWithInlineCompositionPropertyMap data) implements ObjectWithInlineCompositionProperty1Boxed { - @Override - public @Nullable Object getData() { - return data; - } - } - - - public static class ObjectWithInlineCompositionProperty1 extends JsonSchema implements MapSchemaValidator { - /* - NOTE: This class is auto generated by OpenAPI JSON Schema Generator. - Ref: https://github.com/openapi-json-schema-tools/openapi-json-schema-generator - - Do not edit the class manually. - */ - private static @Nullable ObjectWithInlineCompositionProperty1 instance = null; - - protected ObjectWithInlineCompositionProperty1() { - super(new JsonSchemaInfo() - .type(Set.of(Map.class)) - .properties(Map.ofEntries( - new PropertyEntry("someProp", SomeProp.class) - )) - ); - } - - public static ObjectWithInlineCompositionProperty1 getInstance() { - if (instance == null) { - instance = new ObjectWithInlineCompositionProperty1(); - } - return instance; - } - - 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 RuntimeException("Invalid non-string key value"); - } - String propertyName = (String) entryKey; - List propertyPathToItem = new ArrayList<>(pathToItem); - propertyPathToItem.add(propertyName); - Object value = entry.getValue(); - LinkedHashMap, Nothing?> schemas = pathToSchemas.get(propertyPathToItem); - if (schemas == null) { - throw new RuntimeException("Validation result is invalid, schemas must exist for a pathToItem"); - } - JsonSchema propertySchema = schemas.entrySet().iterator().next().getKey(); - @Nullable Object propertyInstance = propertySchema.getNewInstance(value, propertyPathToItem, pathToSchemas); - properties.put(propertyName, propertyInstance); - } - FrozenMap<@Nullable Object> castProperties = new FrozenMap<>(properties); - return new ObjectWithInlineCompositionPropertyMap(castProperties); - } - - 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); - SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().build())); - ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, new PathToSchemasMap(), new LinkedHashSet<>()); - PathToSchemasMap pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet); - return getNewInstance(castArg, validationMetadata.pathToItem(), pathToSchemasMap); - } - - - @Override - public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws 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"); - } - @Override - public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { - if (arg instanceof Map) { - return getNewInstance((Map) arg, pathToItem, pathToSchemas); - } - 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 { - return new ObjectWithInlineCompositionProperty1BoxedMap(validate(arg, configuration)); - } - @Override - public ObjectWithInlineCompositionProperty1Boxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { - 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"); - } - } - -} diff --git a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/schemas/ObjectWithInvalidNamedRefedProperties.kt b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/schemas/ObjectWithInvalidNamedRefedProperties.kt deleted file mode 100644 index b5992953735..00000000000 --- a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/schemas/ObjectWithInvalidNamedRefedProperties.kt +++ /dev/null @@ -1,249 +0,0 @@ -package org.openapijsonschematools.client.components.schemas; -import java.util.ArrayList; -import java.util.HashSet; -import java.util.LinkedHashMap; -import java.util.LinkedHashSet; -import java.util.List; -import java.util.Map; -import java.util.Objects; -import java.util.Set; -import org.checkerframework.checker.nullness.qual.Nullable; -import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags; -import org.openapijsonschematools.client.configurations.SchemaConfiguration; -import org.openapijsonschematools.client.exceptions.InvalidAdditionalPropertyException; -import org.openapijsonschematools.client.exceptions.UnsetPropertyException; -import org.openapijsonschematools.client.exceptions.ValidationException; -import org.openapijsonschematools.client.schemas.GenericBuilder; -import org.openapijsonschematools.client.schemas.UnsetAddPropsSetter; -import org.openapijsonschematools.client.schemas.validation.FrozenMap; -import org.openapijsonschematools.client.schemas.validation.JsonSchema; -import org.openapijsonschematools.client.schemas.validation.JsonSchemaInfo; -import org.openapijsonschematools.client.schemas.validation.MapSchemaValidator; -import org.openapijsonschematools.client.schemas.validation.PathToSchemasMap; -import org.openapijsonschematools.client.schemas.validation.PropertyEntry; -import org.openapijsonschematools.client.schemas.validation.ValidationMetadata; - -public class ObjectWithInvalidNamedRefedProperties { - // nest classes so all schemas and input/output classes can be public - - - public static class ObjectWithInvalidNamedRefedPropertiesMap extends FrozenMap<@Nullable Object> { - protected ObjectWithInvalidNamedRefedPropertiesMap(FrozenMap<@Nullable Object> m) { - super(m); - } - public static final Set requiredKeys = Set.of( - "!reference", - "from" - ); - public static final Set optionalKeys = Set.of(); - public static ObjectWithInvalidNamedRefedPropertiesMap of(Map arg, SchemaConfiguration configuration) throws ValidationException { - return ObjectWithInvalidNamedRefedProperties1.getInstance().validate(arg, configuration); - } - - public FromSchema.FromSchemaMap from() { - @Nullable Object value = get("from"); - if (!(value instanceof FromSchema.FromSchemaMap)) { - throw new RuntimeException("Invalid value stored for from"); - } - return (FromSchema.FromSchemaMap) value; - } - - public @Nullable Object getAdditionalProperty(String name) throws UnsetPropertyException, InvalidAdditionalPropertyException { - throwIfKeyKnown(name, requiredKeys, optionalKeys); - throwIfKeyNotPresent(name); - return get(name); - } - } - - public interface SetterForReference { - Map getInstance(); - T getBuilderAfterReference(Map instance); - - default T exclamationMarkReference(List value) { - var instance = getInstance(); - instance.put("!reference", value); - return getBuilderAfterReference(instance); - } - } - - public interface SetterForFrom { - Map getInstance(); - T getBuilderAfterFrom(Map instance); - - default T from(Map value) { - var instance = getInstance(); - instance.put("from", value); - return getBuilderAfterFrom(instance); - } - } - - public static class ObjectWithInvalidNamedRefedPropertiesMap00Builder extends UnsetAddPropsSetter implements GenericBuilder> { - private final Map instance; - private static final Set knownKeys = Set.of( - "!reference", - "from" - ); - public Set getKnownKeys() { - return knownKeys; - } - public ObjectWithInvalidNamedRefedPropertiesMap00Builder(Map instance) { - this.instance = instance; - } - public Map build() { - return instance; - } - public Map getInstance() { - return instance; - } - public ObjectWithInvalidNamedRefedPropertiesMap00Builder getBuilderAfterAdditionalProperty(Map instance) { - return this; - } - } - - public static class ObjectWithInvalidNamedRefedPropertiesMap01Builder implements SetterForFrom { - private final Map instance; - public ObjectWithInvalidNamedRefedPropertiesMap01Builder(Map instance) { - this.instance = instance; - } - public Map getInstance() { - return instance; - } - public ObjectWithInvalidNamedRefedPropertiesMap00Builder getBuilderAfterFrom(Map instance) { - return new ObjectWithInvalidNamedRefedPropertiesMap00Builder(instance); - } - } - - public static class ObjectWithInvalidNamedRefedPropertiesMap10Builder implements SetterForReference { - private final Map instance; - public ObjectWithInvalidNamedRefedPropertiesMap10Builder(Map instance) { - this.instance = instance; - } - public Map getInstance() { - return instance; - } - public ObjectWithInvalidNamedRefedPropertiesMap00Builder getBuilderAfterReference(Map instance) { - return new ObjectWithInvalidNamedRefedPropertiesMap00Builder(instance); - } - } - - public static class ObjectWithInvalidNamedRefedPropertiesMapBuilder implements SetterForReference, SetterForFrom { - private final Map instance; - public ObjectWithInvalidNamedRefedPropertiesMapBuilder() { - this.instance = new LinkedHashMap<>(); - } - public Map getInstance() { - return instance; - } - public ObjectWithInvalidNamedRefedPropertiesMap01Builder getBuilderAfterReference(Map instance) { - return new ObjectWithInvalidNamedRefedPropertiesMap01Builder(instance); - } - public ObjectWithInvalidNamedRefedPropertiesMap10Builder getBuilderAfterFrom(Map instance) { - return new ObjectWithInvalidNamedRefedPropertiesMap10Builder(instance); - } - } - - - public sealed interface ObjectWithInvalidNamedRefedProperties1Boxed permits ObjectWithInvalidNamedRefedProperties1BoxedMap { - @Nullable Object getData(); - } - - public record ObjectWithInvalidNamedRefedProperties1BoxedMap(ObjectWithInvalidNamedRefedPropertiesMap data) implements ObjectWithInvalidNamedRefedProperties1Boxed { - @Override - public @Nullable Object getData() { - return data; - } - } - - - public static class ObjectWithInvalidNamedRefedProperties1 extends JsonSchema implements MapSchemaValidator { - /* - NOTE: This class is auto generated by OpenAPI JSON Schema Generator. - Ref: https://github.com/openapi-json-schema-tools/openapi-json-schema-generator - - Do not edit the class manually. - */ - private static @Nullable ObjectWithInvalidNamedRefedProperties1 instance = null; - - protected ObjectWithInvalidNamedRefedProperties1() { - super(new JsonSchemaInfo() - .type(Set.of(Map.class)) - .properties(Map.ofEntries( - new PropertyEntry("from", FromSchema.FromSchema1.class), - new PropertyEntry("!reference", ArrayWithValidationsInItems.ArrayWithValidationsInItems1.class) - )) - .required(Set.of( - "!reference", - "from" - )) - ); - } - - public static ObjectWithInvalidNamedRefedProperties1 getInstance() { - if (instance == null) { - instance = new ObjectWithInvalidNamedRefedProperties1(); - } - return instance; - } - - 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 RuntimeException("Invalid non-string key value"); - } - String propertyName = (String) entryKey; - List propertyPathToItem = new ArrayList<>(pathToItem); - propertyPathToItem.add(propertyName); - Object value = entry.getValue(); - LinkedHashMap, Nothing?> schemas = pathToSchemas.get(propertyPathToItem); - if (schemas == null) { - throw new RuntimeException("Validation result is invalid, schemas must exist for a pathToItem"); - } - JsonSchema propertySchema = schemas.entrySet().iterator().next().getKey(); - @Nullable Object propertyInstance = propertySchema.getNewInstance(value, propertyPathToItem, pathToSchemas); - properties.put(propertyName, propertyInstance); - } - FrozenMap<@Nullable Object> castProperties = new FrozenMap<>(properties); - return new ObjectWithInvalidNamedRefedPropertiesMap(castProperties); - } - - 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); - SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().build())); - ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, new PathToSchemasMap(), new LinkedHashSet<>()); - PathToSchemasMap pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet); - return getNewInstance(castArg, validationMetadata.pathToItem(), pathToSchemasMap); - } - - - @Override - public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws 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"); - } - @Override - public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { - if (arg instanceof Map) { - return getNewInstance((Map) arg, pathToItem, pathToSchemas); - } - 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 { - return new ObjectWithInvalidNamedRefedProperties1BoxedMap(validate(arg, configuration)); - } - @Override - public ObjectWithInvalidNamedRefedProperties1Boxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { - 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"); - } - } - -} diff --git a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/schemas/ObjectWithNonIntersectingValues.kt b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/schemas/ObjectWithNonIntersectingValues.kt deleted file mode 100644 index 4a69c585c8f..00000000000 --- a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/schemas/ObjectWithNonIntersectingValues.kt +++ /dev/null @@ -1,256 +0,0 @@ -package org.openapijsonschematools.client.components.schemas; -import java.util.ArrayList; -import java.util.HashSet; -import java.util.LinkedHashMap; -import java.util.LinkedHashSet; -import java.util.List; -import java.util.Map; -import java.util.Objects; -import java.util.Set; -import org.checkerframework.checker.nullness.qual.Nullable; -import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags; -import org.openapijsonschematools.client.configurations.SchemaConfiguration; -import org.openapijsonschematools.client.exceptions.InvalidAdditionalPropertyException; -import org.openapijsonschematools.client.exceptions.UnsetPropertyException; -import org.openapijsonschematools.client.exceptions.ValidationException; -import org.openapijsonschematools.client.schemas.GenericBuilder; -import org.openapijsonschematools.client.schemas.NumberJsonSchema; -import org.openapijsonschematools.client.schemas.StringJsonSchema; -import org.openapijsonschematools.client.schemas.validation.FrozenMap; -import org.openapijsonschematools.client.schemas.validation.JsonSchema; -import org.openapijsonschematools.client.schemas.validation.JsonSchemaInfo; -import org.openapijsonschematools.client.schemas.validation.MapSchemaValidator; -import org.openapijsonschematools.client.schemas.validation.MapUtils; -import org.openapijsonschematools.client.schemas.validation.PathToSchemasMap; -import org.openapijsonschematools.client.schemas.validation.PropertyEntry; -import org.openapijsonschematools.client.schemas.validation.ValidationMetadata; - -public class ObjectWithNonIntersectingValues { - // nest classes so all schemas and input/output classes can be public - - - public static class AdditionalProperties extends StringJsonSchema.StringJsonSchema1 { - private static @Nullable AdditionalProperties instance = null; - public static AdditionalProperties getInstance() { - if (instance == null) { - instance = new AdditionalProperties(); - } - return instance; - } - } - - - public static class A extends NumberJsonSchema.NumberJsonSchema1 { - private static @Nullable A instance = null; - public static A getInstance() { - if (instance == null) { - instance = new A(); - } - return instance; - } - } - - - public static class ObjectWithNonIntersectingValuesMap extends FrozenMap { - protected ObjectWithNonIntersectingValuesMap(FrozenMap m) { - super(m); - } - public static final Set requiredKeys = Set.of(); - public static final Set optionalKeys = Set.of( - "a" - ); - public static ObjectWithNonIntersectingValuesMap of(Map arg, SchemaConfiguration configuration) throws ValidationException { - return ObjectWithNonIntersectingValues1.getInstance().validate(arg, configuration); - } - - public Number a() throws UnsetPropertyException { - String key = "a"; - throwIfKeyNotPresent(key); - Object value = get(key); - if (!(value instanceof Number)) { - throw new RuntimeException("Invalid value stored for a"); - } - return (Number) value; - } - - public String getAdditionalProperty(String name) throws UnsetPropertyException, InvalidAdditionalPropertyException { - throwIfKeyKnown(name, requiredKeys, optionalKeys); - var value = getOrThrow(name); - if (!(value instanceof String)) { - throw new RuntimeException("Invalid value stored for " + name); - } - return (String) value; - } - } - - public interface SetterForA { - Map getInstance(); - T getBuilderAfterA(Map instance); - - default T a(int value) { - var instance = getInstance(); - instance.put("a", value); - return getBuilderAfterA(instance); - } - - default T a(float value) { - var instance = getInstance(); - instance.put("a", value); - return getBuilderAfterA(instance); - } - - default T a(long value) { - var instance = getInstance(); - instance.put("a", value); - return getBuilderAfterA(instance); - } - - default T a(double value) { - var instance = getInstance(); - instance.put("a", value); - return getBuilderAfterA(instance); - } - } - - public interface SetterForAdditionalProperties { - Set getKnownKeys(); - Map getInstance(); - T getBuilderAfterAdditionalProperty(Map instance); - - default T additionalProperty(String key, String value) throws InvalidAdditionalPropertyException { - MapUtils.throwIfKeyKnown(key, getKnownKeys(), true); - var instance = getInstance(); - instance.put(key, value); - return getBuilderAfterAdditionalProperty(instance); - } - } - - public static class ObjectWithNonIntersectingValuesMapBuilder implements GenericBuilder>, SetterForA, SetterForAdditionalProperties { - private final Map instance; - private static final Set knownKeys = Set.of( - "a" - ); - public Set getKnownKeys() { - return knownKeys; - } - public ObjectWithNonIntersectingValuesMapBuilder() { - this.instance = new LinkedHashMap<>(); - } - public Map build() { - return instance; - } - public Map getInstance() { - return instance; - } - public ObjectWithNonIntersectingValuesMapBuilder getBuilderAfterA(Map instance) { - return this; - } - public ObjectWithNonIntersectingValuesMapBuilder getBuilderAfterAdditionalProperty(Map instance) { - return this; - } - } - - - public sealed interface ObjectWithNonIntersectingValues1Boxed permits ObjectWithNonIntersectingValues1BoxedMap { - @Nullable Object getData(); - } - - public record ObjectWithNonIntersectingValues1BoxedMap(ObjectWithNonIntersectingValuesMap data) implements ObjectWithNonIntersectingValues1Boxed { - @Override - public @Nullable Object getData() { - return data; - } - } - - - public static class ObjectWithNonIntersectingValues1 extends JsonSchema implements MapSchemaValidator { - /* - NOTE: This class is auto generated by OpenAPI JSON Schema Generator. - Ref: https://github.com/openapi-json-schema-tools/openapi-json-schema-generator - - Do not edit the class manually. - */ - private static @Nullable ObjectWithNonIntersectingValues1 instance = null; - - protected ObjectWithNonIntersectingValues1() { - super(new JsonSchemaInfo() - .type(Set.of(Map.class)) - .properties(Map.ofEntries( - new PropertyEntry("a", A.class) - )) - .additionalProperties(AdditionalProperties.class) - ); - } - - public static ObjectWithNonIntersectingValues1 getInstance() { - if (instance == null) { - instance = new ObjectWithNonIntersectingValues1(); - } - return instance; - } - - 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 RuntimeException("Invalid non-string key value"); - } - String propertyName = (String) entryKey; - List propertyPathToItem = new ArrayList<>(pathToItem); - propertyPathToItem.add(propertyName); - Object value = entry.getValue(); - LinkedHashMap, Nothing?> schemas = pathToSchemas.get(propertyPathToItem); - if (schemas == null) { - throw new RuntimeException("Validation 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"); - } - properties.put(propertyName, (Object) propertyInstance); - } - FrozenMap castProperties = new FrozenMap<>(properties); - return new ObjectWithNonIntersectingValuesMap(castProperties); - } - - 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); - SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().build())); - ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, new PathToSchemasMap(), new LinkedHashSet<>()); - PathToSchemasMap pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet); - return getNewInstance(castArg, validationMetadata.pathToItem(), pathToSchemasMap); - } - - - @Override - public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws 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"); - } - @Override - public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { - if (arg instanceof Map) { - return getNewInstance((Map) arg, pathToItem, pathToSchemas); - } - 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 { - return new ObjectWithNonIntersectingValues1BoxedMap(validate(arg, configuration)); - } - @Override - public ObjectWithNonIntersectingValues1Boxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { - 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"); - } - } - -} diff --git a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/schemas/ObjectWithOnlyOptionalProps.kt b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/schemas/ObjectWithOnlyOptionalProps.kt deleted file mode 100644 index 8f7d1238543..00000000000 --- a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/schemas/ObjectWithOnlyOptionalProps.kt +++ /dev/null @@ -1,463 +0,0 @@ -package org.openapijsonschematools.client.components.schemas; -import java.util.ArrayList; -import java.util.HashSet; -import java.util.LinkedHashMap; -import java.util.LinkedHashSet; -import java.util.List; -import java.util.Map; -import java.util.Objects; -import java.util.Set; -import org.checkerframework.checker.nullness.qual.Nullable; -import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags; -import org.openapijsonschematools.client.configurations.SchemaConfiguration; -import org.openapijsonschematools.client.exceptions.UnsetPropertyException; -import org.openapijsonschematools.client.exceptions.ValidationException; -import org.openapijsonschematools.client.schemas.AnyTypeJsonSchema; -import org.openapijsonschematools.client.schemas.GenericBuilder; -import org.openapijsonschematools.client.schemas.NotAnyTypeJsonSchema; -import org.openapijsonschematools.client.schemas.NumberJsonSchema; -import org.openapijsonschematools.client.schemas.StringJsonSchema; -import org.openapijsonschematools.client.schemas.validation.FrozenList; -import org.openapijsonschematools.client.schemas.validation.FrozenMap; -import org.openapijsonschematools.client.schemas.validation.JsonSchema; -import org.openapijsonschematools.client.schemas.validation.JsonSchemaInfo; -import org.openapijsonschematools.client.schemas.validation.ListSchemaValidator; -import org.openapijsonschematools.client.schemas.validation.MapSchemaValidator; -import org.openapijsonschematools.client.schemas.validation.MapUtils; -import org.openapijsonschematools.client.schemas.validation.NullSchemaValidator; -import org.openapijsonschematools.client.schemas.validation.PathToSchemasMap; -import org.openapijsonschematools.client.schemas.validation.PropertyEntry; -import org.openapijsonschematools.client.schemas.validation.ValidationMetadata; - -public class ObjectWithOnlyOptionalProps { - // nest classes so all schemas and input/output classes can be public - - - public static class AdditionalProperties extends NotAnyTypeJsonSchema.NotAnyTypeJsonSchema1 { - // NotAnyTypeSchema - private static @Nullable AdditionalProperties instance = null; - public static AdditionalProperties getInstance() { - if (instance == null) { - instance = new AdditionalProperties(); - } - return instance; - } - } - - - public static class A extends StringJsonSchema.StringJsonSchema1 { - private static @Nullable A instance = null; - public static A getInstance() { - if (instance == null) { - instance = new A(); - } - return instance; - } - } - - - public static class B extends NumberJsonSchema.NumberJsonSchema1 { - private static @Nullable B instance = null; - public static B getInstance() { - if (instance == null) { - instance = new B(); - } - return instance; - } - } - - - public static class ArrayPropertyList extends FrozenList { - protected ArrayPropertyList(FrozenList m) { - super(m); - } - public static ArrayPropertyList of(List arg, SchemaConfiguration configuration) throws ValidationException { - return ArrayProperty.getInstance().validate(arg, configuration); - } - } - - public static class ArrayPropertyListBuilder { - // class to build List - private final List list; - - public ArrayPropertyListBuilder() { - list = new ArrayList<>(); - } - - public ArrayPropertyListBuilder(List list) { - this.list = list; - } - - public ArrayPropertyListBuilder add(String item) { - list.add(item); - return this; - } - - public ArrayPropertyListBuilder add(EnumClass.StringEnumClassEnums item) { - list.add(item.value()); - return this; - } - - public List build() { - return list; - } - } - - - public sealed interface ArrayPropertyBoxed permits ArrayPropertyBoxedNothing?, ArrayPropertyBoxedList { - @Nullable Object getData(); - } - - public record ArrayPropertyBoxedVoid(Nothing? data) implements ArrayPropertyBoxed { - @Override - public @Nullable Object getData() { - return data; - } - } - - public record ArrayPropertyBoxedList(ArrayPropertyList data) implements ArrayPropertyBoxed { - @Override - public @Nullable Object getData() { - return data; - } - } - - - - public static class ArrayProperty extends JsonSchema implements NullSchemaValidator, ListSchemaValidator { - private static @Nullable ArrayProperty instance = null; - - protected ArrayProperty() { - super(new JsonSchemaInfo() - .type(Set.of( - Nothing?.class, - List.class - )) - .items(EnumClass.EnumClass1.class) - ); - } - - public static ArrayProperty getInstance() { - if (instance == null) { - instance = new ArrayProperty(); - } - return instance; - } - - @Override - public Nothing? validate(Nothing? arg, SchemaConfiguration configuration) throws ValidationException { - Set> pathSet = new HashSet<>(); - List pathToItem = List.of("args[0"); - Nothing? castArg = castToAllowedTypes(arg, pathToItem, pathSet); - SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().build())); - ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, new PathToSchemasMap(), new LinkedHashSet<>()); - getPathToSchemas(this, castArg, validationMetadata, pathSet); - return castArg; - } - - @Override - public ArrayPropertyList getNewInstance(List arg, List pathToItem, PathToSchemasMap pathToSchemas) { - List items = new ArrayList<>(); - int i = 0; - for (Object item: arg) { - List itemPathToItem = new ArrayList<>(pathToItem); - itemPathToItem.add(i); - LinkedHashMap, Nothing?> schemas = pathToSchemas.get(itemPathToItem); - if (schemas == null) { - throw new RuntimeException("Validation 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"); - } - items.add((String) itemInstance); - i += 1; - } - FrozenList newInstanceItems = new FrozenList<>(items); - return new ArrayPropertyList(newInstanceItems); - } - - public ArrayPropertyList validate(List arg, SchemaConfiguration configuration) throws ValidationException { - Set> pathSet = new HashSet<>(); - List pathToItem = List.of("args[0"); - List castArg = castToAllowedTypes(arg, pathToItem, pathSet); - SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().build())); - ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, new PathToSchemasMap(), new LinkedHashSet<>()); - PathToSchemasMap pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet); - return getNewInstance(castArg, validationMetadata.pathToItem(), pathToSchemasMap); - } - - @Override - public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { - if (arg == null) { - return validate((Nothing?) 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"); - } - @Override - public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { - if (arg == null) { - return getNewInstance((Nothing?) 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"); - } - @Override - public ArrayPropertyBoxedVoid validateAndBox(Nothing? arg, SchemaConfiguration configuration) throws ValidationException { - return new ArrayPropertyBoxedVoid(validate(arg, configuration)); - } - @Override - public ArrayPropertyBoxedList validateAndBox(List arg, SchemaConfiguration configuration) throws ValidationException { - return new ArrayPropertyBoxedList(validate(arg, configuration)); - } - @Override - public ArrayPropertyBoxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { - if (arg == null) { - Nothing? castArg = (Nothing?) 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"); - } - } - - public static class ObjectWithOnlyOptionalPropsMap extends FrozenMap<@Nullable Object> { - protected ObjectWithOnlyOptionalPropsMap(FrozenMap<@Nullable Object> m) { - super(m); - } - public static final Set requiredKeys = Set.of(); - public static final Set optionalKeys = Set.of( - "a", - "b", - "ArrayProperty" - ); - public static ObjectWithOnlyOptionalPropsMap of(Map arg, SchemaConfiguration configuration) throws ValidationException { - return ObjectWithOnlyOptionalProps1.getInstance().validate(arg, configuration); - } - - public String a() throws UnsetPropertyException { - String key = "a"; - throwIfKeyNotPresent(key); - @Nullable Object value = get(key); - if (!(value instanceof String)) { - throw new RuntimeException("Invalid value stored for a"); - } - return (String) value; - } - - public Number b() throws UnsetPropertyException { - String key = "b"; - throwIfKeyNotPresent(key); - @Nullable Object value = get(key); - if (!(value instanceof Number)) { - throw new RuntimeException("Invalid value stored for b"); - } - return (Number) value; - } - - public @Nullable ArrayPropertyList ArrayProperty() throws UnsetPropertyException { - String key = "ArrayProperty"; - throwIfKeyNotPresent(key); - @Nullable Object value = get(key); - if (!(value == null || value instanceof ArrayPropertyList)) { - throw new RuntimeException("Invalid value stored for ArrayProperty"); - } - return (@Nullable ArrayPropertyList) value; - } - } - - public interface SetterForA { - Map getInstance(); - T getBuilderAfterA(Map instance); - - default T a(String value) { - var instance = getInstance(); - instance.put("a", value); - return getBuilderAfterA(instance); - } - } - - public interface SetterForB { - Map getInstance(); - T getBuilderAfterB(Map instance); - - default T b(int value) { - var instance = getInstance(); - instance.put("b", value); - return getBuilderAfterB(instance); - } - - default T b(float value) { - var instance = getInstance(); - instance.put("b", value); - return getBuilderAfterB(instance); - } - - default T b(long value) { - var instance = getInstance(); - instance.put("b", value); - return getBuilderAfterB(instance); - } - - default T b(double value) { - var instance = getInstance(); - instance.put("b", value); - return getBuilderAfterB(instance); - } - } - - public interface SetterForArrayProperty { - Map getInstance(); - T getBuilderAfterArrayProperty(Map instance); - - default T ArrayProperty(Nothing? value) { - var instance = getInstance(); - instance.put("ArrayProperty", null); - return getBuilderAfterArrayProperty(instance); - } - - default T ArrayProperty(List value) { - var instance = getInstance(); - instance.put("ArrayProperty", value); - return getBuilderAfterArrayProperty(instance); - } - } - - public static class ObjectWithOnlyOptionalPropsMapBuilder implements GenericBuilder>, SetterForA, SetterForB, SetterForArrayProperty { - private final Map instance; - private static final Set knownKeys = Set.of( - "a", - "b", - "ArrayProperty" - ); - public Set getKnownKeys() { - return knownKeys; - } - public ObjectWithOnlyOptionalPropsMapBuilder() { - this.instance = new LinkedHashMap<>(); - } - public Map build() { - return instance; - } - public Map getInstance() { - return instance; - } - public ObjectWithOnlyOptionalPropsMapBuilder getBuilderAfterA(Map instance) { - return this; - } - public ObjectWithOnlyOptionalPropsMapBuilder getBuilderAfterB(Map instance) { - return this; - } - public ObjectWithOnlyOptionalPropsMapBuilder getBuilderAfterArrayProperty(Map instance) { - return this; - } - } - - - public sealed interface ObjectWithOnlyOptionalProps1Boxed permits ObjectWithOnlyOptionalProps1BoxedMap { - @Nullable Object getData(); - } - - public record ObjectWithOnlyOptionalProps1BoxedMap(ObjectWithOnlyOptionalPropsMap data) implements ObjectWithOnlyOptionalProps1Boxed { - @Override - public @Nullable Object getData() { - return data; - } - } - - - public static class ObjectWithOnlyOptionalProps1 extends JsonSchema implements MapSchemaValidator { - /* - NOTE: This class is auto generated by OpenAPI JSON Schema Generator. - Ref: https://github.com/openapi-json-schema-tools/openapi-json-schema-generator - - Do not edit the class manually. - */ - private static @Nullable ObjectWithOnlyOptionalProps1 instance = null; - - protected ObjectWithOnlyOptionalProps1() { - super(new JsonSchemaInfo() - .type(Set.of(Map.class)) - .properties(Map.ofEntries( - new PropertyEntry("a", A.class), - new PropertyEntry("b", B.class), - new PropertyEntry("ArrayProperty", ArrayProperty.class) - )) - .additionalProperties(AdditionalProperties.class) - ); - } - - public static ObjectWithOnlyOptionalProps1 getInstance() { - if (instance == null) { - instance = new ObjectWithOnlyOptionalProps1(); - } - return instance; - } - - 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 RuntimeException("Invalid non-string key value"); - } - String propertyName = (String) entryKey; - List propertyPathToItem = new ArrayList<>(pathToItem); - propertyPathToItem.add(propertyName); - Object value = entry.getValue(); - LinkedHashMap, Nothing?> schemas = pathToSchemas.get(propertyPathToItem); - if (schemas == null) { - throw new RuntimeException("Validation result is invalid, schemas must exist for a pathToItem"); - } - JsonSchema propertySchema = schemas.entrySet().iterator().next().getKey(); - @Nullable Object propertyInstance = propertySchema.getNewInstance(value, propertyPathToItem, pathToSchemas); - properties.put(propertyName, propertyInstance); - } - FrozenMap<@Nullable Object> castProperties = new FrozenMap<>(properties); - return new ObjectWithOnlyOptionalPropsMap(castProperties); - } - - 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); - SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().build())); - ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, new PathToSchemasMap(), new LinkedHashSet<>()); - PathToSchemasMap pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet); - return getNewInstance(castArg, validationMetadata.pathToItem(), pathToSchemasMap); - } - - - @Override - public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws 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"); - } - @Override - public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { - if (arg instanceof Map) { - return getNewInstance((Map) arg, pathToItem, pathToSchemas); - } - 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 { - return new ObjectWithOnlyOptionalProps1BoxedMap(validate(arg, configuration)); - } - @Override - public ObjectWithOnlyOptionalProps1Boxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { - 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"); - } - } - -} diff --git a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/schemas/ObjectWithOptionalTestProp.kt b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/schemas/ObjectWithOptionalTestProp.kt deleted file mode 100644 index 476f41ddbad..00000000000 --- a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/schemas/ObjectWithOptionalTestProp.kt +++ /dev/null @@ -1,206 +0,0 @@ -package org.openapijsonschematools.client.components.schemas; -import java.util.ArrayList; -import java.util.HashSet; -import java.util.LinkedHashMap; -import java.util.LinkedHashSet; -import java.util.List; -import java.util.Map; -import java.util.Objects; -import java.util.Set; -import org.checkerframework.checker.nullness.qual.Nullable; -import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags; -import org.openapijsonschematools.client.configurations.SchemaConfiguration; -import org.openapijsonschematools.client.exceptions.InvalidAdditionalPropertyException; -import org.openapijsonschematools.client.exceptions.UnsetPropertyException; -import org.openapijsonschematools.client.exceptions.ValidationException; -import org.openapijsonschematools.client.schemas.GenericBuilder; -import org.openapijsonschematools.client.schemas.StringJsonSchema; -import org.openapijsonschematools.client.schemas.UnsetAddPropsSetter; -import org.openapijsonschematools.client.schemas.validation.FrozenMap; -import org.openapijsonschematools.client.schemas.validation.JsonSchema; -import org.openapijsonschematools.client.schemas.validation.JsonSchemaInfo; -import org.openapijsonschematools.client.schemas.validation.MapSchemaValidator; -import org.openapijsonschematools.client.schemas.validation.PathToSchemasMap; -import org.openapijsonschematools.client.schemas.validation.PropertyEntry; -import org.openapijsonschematools.client.schemas.validation.ValidationMetadata; - -public class ObjectWithOptionalTestProp { - // nest classes so all schemas and input/output classes can be public - - - public static class Test extends StringJsonSchema.StringJsonSchema1 { - private static @Nullable Test instance = null; - public static Test getInstance() { - if (instance == null) { - instance = new Test(); - } - return instance; - } - } - - - public static class ObjectWithOptionalTestPropMap extends FrozenMap<@Nullable Object> { - protected ObjectWithOptionalTestPropMap(FrozenMap<@Nullable Object> m) { - super(m); - } - public static final Set requiredKeys = Set.of(); - public static final Set optionalKeys = Set.of( - "test" - ); - public static ObjectWithOptionalTestPropMap of(Map arg, SchemaConfiguration configuration) throws ValidationException { - return ObjectWithOptionalTestProp1.getInstance().validate(arg, configuration); - } - - public String test() throws UnsetPropertyException { - String key = "test"; - throwIfKeyNotPresent(key); - @Nullable Object value = get(key); - if (!(value instanceof String)) { - throw new RuntimeException("Invalid value stored for test"); - } - return (String) value; - } - - public @Nullable Object getAdditionalProperty(String name) throws UnsetPropertyException, InvalidAdditionalPropertyException { - throwIfKeyKnown(name, requiredKeys, optionalKeys); - throwIfKeyNotPresent(name); - return get(name); - } - } - - public interface SetterForTest { - Map getInstance(); - T getBuilderAfterTest(Map instance); - - default T test(String value) { - var instance = getInstance(); - instance.put("test", value); - return getBuilderAfterTest(instance); - } - } - - public static class ObjectWithOptionalTestPropMapBuilder extends UnsetAddPropsSetter implements GenericBuilder>, SetterForTest { - private final Map instance; - private static final Set knownKeys = Set.of( - "test" - ); - public Set getKnownKeys() { - return knownKeys; - } - public ObjectWithOptionalTestPropMapBuilder() { - this.instance = new LinkedHashMap<>(); - } - public Map build() { - return instance; - } - public Map getInstance() { - return instance; - } - public ObjectWithOptionalTestPropMapBuilder getBuilderAfterTest(Map instance) { - return this; - } - public ObjectWithOptionalTestPropMapBuilder getBuilderAfterAdditionalProperty(Map instance) { - return this; - } - } - - - public sealed interface ObjectWithOptionalTestProp1Boxed permits ObjectWithOptionalTestProp1BoxedMap { - @Nullable Object getData(); - } - - public record ObjectWithOptionalTestProp1BoxedMap(ObjectWithOptionalTestPropMap data) implements ObjectWithOptionalTestProp1Boxed { - @Override - public @Nullable Object getData() { - return data; - } - } - - - public static class ObjectWithOptionalTestProp1 extends JsonSchema implements MapSchemaValidator { - /* - NOTE: This class is auto generated by OpenAPI JSON Schema Generator. - Ref: https://github.com/openapi-json-schema-tools/openapi-json-schema-generator - - Do not edit the class manually. - */ - private static @Nullable ObjectWithOptionalTestProp1 instance = null; - - protected ObjectWithOptionalTestProp1() { - super(new JsonSchemaInfo() - .type(Set.of(Map.class)) - .properties(Map.ofEntries( - new PropertyEntry("test", Test.class) - )) - ); - } - - public static ObjectWithOptionalTestProp1 getInstance() { - if (instance == null) { - instance = new ObjectWithOptionalTestProp1(); - } - return instance; - } - - 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 RuntimeException("Invalid non-string key value"); - } - String propertyName = (String) entryKey; - List propertyPathToItem = new ArrayList<>(pathToItem); - propertyPathToItem.add(propertyName); - Object value = entry.getValue(); - LinkedHashMap, Nothing?> schemas = pathToSchemas.get(propertyPathToItem); - if (schemas == null) { - throw new RuntimeException("Validation result is invalid, schemas must exist for a pathToItem"); - } - JsonSchema propertySchema = schemas.entrySet().iterator().next().getKey(); - @Nullable Object propertyInstance = propertySchema.getNewInstance(value, propertyPathToItem, pathToSchemas); - properties.put(propertyName, propertyInstance); - } - FrozenMap<@Nullable Object> castProperties = new FrozenMap<>(properties); - return new ObjectWithOptionalTestPropMap(castProperties); - } - - 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); - SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().build())); - ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, new PathToSchemasMap(), new LinkedHashSet<>()); - PathToSchemasMap pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet); - return getNewInstance(castArg, validationMetadata.pathToItem(), pathToSchemasMap); - } - - - @Override - public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws 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"); - } - @Override - public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { - if (arg instanceof Map) { - return getNewInstance((Map) arg, pathToItem, pathToSchemas); - } - 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 { - return new ObjectWithOptionalTestProp1BoxedMap(validate(arg, configuration)); - } - @Override - public ObjectWithOptionalTestProp1Boxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { - 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"); - } - } - -} diff --git a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/schemas/ObjectWithValidations.kt b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/schemas/ObjectWithValidations.kt deleted file mode 100644 index f1ca89d5902..00000000000 --- a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/schemas/ObjectWithValidations.kt +++ /dev/null @@ -1,124 +0,0 @@ -package org.openapijsonschematools.client.components.schemas; -import java.util.ArrayList; -import java.util.HashSet; -import java.util.LinkedHashMap; -import java.util.LinkedHashSet; -import java.util.List; -import java.util.Map; -import java.util.Objects; -import java.util.Set; -import org.checkerframework.checker.nullness.qual.Nullable; -import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags; -import org.openapijsonschematools.client.configurations.SchemaConfiguration; -import org.openapijsonschematools.client.exceptions.InvalidAdditionalPropertyException; -import org.openapijsonschematools.client.exceptions.UnsetPropertyException; -import org.openapijsonschematools.client.exceptions.ValidationException; -import org.openapijsonschematools.client.schemas.UnsetAddPropsSetter; -import org.openapijsonschematools.client.schemas.validation.FrozenMap; -import org.openapijsonschematools.client.schemas.validation.JsonSchema; -import org.openapijsonschematools.client.schemas.validation.JsonSchemaInfo; -import org.openapijsonschematools.client.schemas.validation.MapSchemaValidator; -import org.openapijsonschematools.client.schemas.validation.PathToSchemasMap; -import org.openapijsonschematools.client.schemas.validation.ValidationMetadata; - -public class ObjectWithValidations { - // nest classes so all schemas and input/output classes can be public - - - public sealed interface ObjectWithValidations1Boxed permits ObjectWithValidations1BoxedMap { - @Nullable Object getData(); - } - - public record ObjectWithValidations1BoxedMap(FrozenMap<@Nullable Object> data) implements ObjectWithValidations1Boxed { - @Override - public @Nullable Object getData() { - return data; - } - } - - - public static class ObjectWithValidations1 extends JsonSchema implements MapSchemaValidator, ObjectWithValidations1BoxedMap> { - /* - NOTE: This class is auto generated by OpenAPI JSON Schema Generator. - Ref: https://github.com/openapi-json-schema-tools/openapi-json-schema-generator - - Do not edit the class manually. - */ - private static @Nullable ObjectWithValidations1 instance = null; - - protected ObjectWithValidations1() { - super(new JsonSchemaInfo() - .type(Set.of(Map.class)) - .minProperties(2) - ); - } - - public static ObjectWithValidations1 getInstance() { - if (instance == null) { - instance = new ObjectWithValidations1(); - } - return instance; - } - - 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 RuntimeException("Invalid non-string key value"); - } - String propertyName = (String) entryKey; - List propertyPathToItem = new ArrayList<>(pathToItem); - propertyPathToItem.add(propertyName); - Object value = entry.getValue(); - LinkedHashMap, Nothing?> schemas = pathToSchemas.get(propertyPathToItem); - if (schemas == null) { - throw new RuntimeException("Validation result is invalid, schemas must exist for a pathToItem"); - } - JsonSchema propertySchema = schemas.entrySet().iterator().next().getKey(); - @Nullable Object propertyInstance = propertySchema.getNewInstance(value, propertyPathToItem, pathToSchemas); - properties.put(propertyName, propertyInstance); - } - FrozenMap<@Nullable Object> castProperties = new FrozenMap<>(properties); - return castProperties; - } - - public FrozenMap<@Nullable Object> validate(Map arg, SchemaConfiguration configuration) throws ValidationException { - Set> pathSet = new HashSet<>(); - List pathToItem = List.of("args[0"); - Map castArg = castToAllowedTypes(arg, pathToItem, pathSet); - SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().build())); - ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, new PathToSchemasMap(), new LinkedHashSet<>()); - PathToSchemasMap pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet); - return getNewInstance(castArg, validationMetadata.pathToItem(), pathToSchemasMap); - } - - - @Override - public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws 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"); - } - @Override - public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { - if (arg instanceof Map) { - return getNewInstance((Map) arg, pathToItem, pathToSchemas); - } - 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 { - return new ObjectWithValidations1BoxedMap(validate(arg, configuration)); - } - @Override - public ObjectWithValidations1Boxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { - 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"); - } - } - -} diff --git a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/schemas/Order.kt b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/schemas/Order.kt deleted file mode 100644 index 28039a3de48..00000000000 --- a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/schemas/Order.kt +++ /dev/null @@ -1,533 +0,0 @@ -package org.openapijsonschematools.client.components.schemas; -import java.util.ArrayList; -import java.util.HashSet; -import java.util.LinkedHashMap; -import java.util.LinkedHashSet; -import java.util.List; -import java.util.Map; -import java.util.Objects; -import java.util.Set; -import org.checkerframework.checker.nullness.qual.Nullable; -import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags; -import org.openapijsonschematools.client.configurations.SchemaConfiguration; -import org.openapijsonschematools.client.exceptions.InvalidAdditionalPropertyException; -import org.openapijsonschematools.client.exceptions.UnsetPropertyException; -import org.openapijsonschematools.client.exceptions.ValidationException; -import org.openapijsonschematools.client.schemas.BooleanJsonSchema; -import org.openapijsonschematools.client.schemas.DateTimeJsonSchema; -import org.openapijsonschematools.client.schemas.GenericBuilder; -import org.openapijsonschematools.client.schemas.Int32JsonSchema; -import org.openapijsonschematools.client.schemas.Int64JsonSchema; -import org.openapijsonschematools.client.schemas.SetMaker; -import org.openapijsonschematools.client.schemas.UnsetAddPropsSetter; -import org.openapijsonschematools.client.schemas.validation.FrozenMap; -import org.openapijsonschematools.client.schemas.validation.JsonSchema; -import org.openapijsonschematools.client.schemas.validation.JsonSchemaInfo; -import org.openapijsonschematools.client.schemas.validation.MapSchemaValidator; -import org.openapijsonschematools.client.schemas.validation.PathToSchemasMap; -import org.openapijsonschematools.client.schemas.validation.PropertyEntry; -import org.openapijsonschematools.client.schemas.validation.StringEnumValidator; -import org.openapijsonschematools.client.schemas.validation.StringSchemaValidator; -import org.openapijsonschematools.client.schemas.validation.StringValueMethod; -import org.openapijsonschematools.client.schemas.validation.ValidationMetadata; - -public class Order { - // nest classes so all schemas and input/output classes can be public - - - public static class Id extends Int64JsonSchema.Int64JsonSchema1 { - private static @Nullable Id instance = null; - public static Id getInstance() { - if (instance == null) { - instance = new Id(); - } - return instance; - } - } - - - public static class PetId extends Int64JsonSchema.Int64JsonSchema1 { - private static @Nullable PetId instance = null; - public static PetId getInstance() { - if (instance == null) { - instance = new PetId(); - } - return instance; - } - } - - - public static class Quantity extends Int32JsonSchema.Int32JsonSchema1 { - private static @Nullable Quantity instance = null; - public static Quantity getInstance() { - if (instance == null) { - instance = new Quantity(); - } - return instance; - } - } - - - public static class ShipDate extends DateTimeJsonSchema.DateTimeJsonSchema1 { - private static @Nullable ShipDate instance = null; - public static ShipDate getInstance() { - if (instance == null) { - instance = new ShipDate(); - } - return instance; - } - } - - public enum StringStatusEnums implements StringValueMethod { - PLACED("placed"), - APPROVED("approved"), - DELIVERED("delivered"); - private final String value; - - StringStatusEnums(String value) { - this.value = value; - } - public String value() { - return this.value; - } - } - - - public sealed interface StatusBoxed permits StatusBoxedString { - @Nullable Object getData(); - } - - public record StatusBoxedString(String data) implements StatusBoxed { - @Override - public @Nullable Object getData() { - return data; - } - } - - - - public static class Status extends JsonSchema implements StringSchemaValidator, StringEnumValidator { - private static @Nullable Status instance = null; - - protected Status() { - super(new JsonSchemaInfo() - .type(Set.of( - String.class - )) - .enumValues(SetMaker.makeSet( - "placed", - "approved", - "delivered" - )) - ); - } - - public static Status getInstance() { - if (instance == null) { - instance = new Status(); - } - return instance; - } - - @Override - public String validate(String arg, SchemaConfiguration configuration) throws ValidationException { - Set> pathSet = new HashSet<>(); - List pathToItem = List.of("args[0"); - String castArg = castToAllowedTypes(arg, pathToItem, pathSet); - SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().build())); - ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, new PathToSchemasMap(), new LinkedHashSet<>()); - getPathToSchemas(this, castArg, validationMetadata, pathSet); - return castArg; - } - - @Override - 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 { - 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"); - } - @Override - public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { - 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"); - } - @Override - 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 { - 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"); - } - } - - public static class Complete extends BooleanJsonSchema.BooleanJsonSchema1 { - private static @Nullable Complete instance = null; - public static Complete getInstance() { - if (instance == null) { - instance = new Complete(); - } - return instance; - } - } - - - public static class OrderMap extends FrozenMap<@Nullable Object> { - protected OrderMap(FrozenMap<@Nullable Object> m) { - super(m); - } - public static final Set requiredKeys = Set.of(); - public static final Set optionalKeys = Set.of( - "id", - "petId", - "quantity", - "shipDate", - "status", - "complete" - ); - public static OrderMap of(Map arg, SchemaConfiguration configuration) throws ValidationException { - return Order1.getInstance().validate(arg, configuration); - } - - public Number id() throws UnsetPropertyException { - String key = "id"; - throwIfKeyNotPresent(key); - @Nullable Object value = get(key); - if (!(value instanceof Number)) { - throw new RuntimeException("Invalid value stored for id"); - } - return (Number) value; - } - - public Number petId() throws UnsetPropertyException { - String key = "petId"; - throwIfKeyNotPresent(key); - @Nullable Object value = get(key); - if (!(value instanceof Number)) { - throw new RuntimeException("Invalid value stored for petId"); - } - return (Number) value; - } - - public Number quantity() throws UnsetPropertyException { - String key = "quantity"; - throwIfKeyNotPresent(key); - @Nullable Object value = get(key); - if (!(value instanceof Number)) { - throw new RuntimeException("Invalid value stored for quantity"); - } - return (Number) value; - } - - public String shipDate() throws UnsetPropertyException { - String key = "shipDate"; - throwIfKeyNotPresent(key); - @Nullable Object value = get(key); - if (!(value instanceof String)) { - throw new RuntimeException("Invalid value stored for shipDate"); - } - return (String) value; - } - - public String status() throws UnsetPropertyException { - String key = "status"; - throwIfKeyNotPresent(key); - @Nullable Object value = get(key); - if (!(value instanceof String)) { - throw new RuntimeException("Invalid value stored for status"); - } - return (String) value; - } - - public boolean complete() throws UnsetPropertyException { - String key = "complete"; - throwIfKeyNotPresent(key); - @Nullable Object value = get(key); - if (!(value instanceof Boolean)) { - throw new RuntimeException("Invalid value stored for complete"); - } - return (boolean) value; - } - - public @Nullable Object getAdditionalProperty(String name) throws UnsetPropertyException, InvalidAdditionalPropertyException { - throwIfKeyKnown(name, requiredKeys, optionalKeys); - throwIfKeyNotPresent(name); - return get(name); - } - } - - public interface SetterForId { - Map getInstance(); - T getBuilderAfterId(Map instance); - - default T id(int value) { - var instance = getInstance(); - instance.put("id", value); - return getBuilderAfterId(instance); - } - - default T id(float value) { - var instance = getInstance(); - instance.put("id", value); - return getBuilderAfterId(instance); - } - - default T id(long value) { - var instance = getInstance(); - instance.put("id", value); - return getBuilderAfterId(instance); - } - - default T id(double value) { - var instance = getInstance(); - instance.put("id", value); - return getBuilderAfterId(instance); - } - } - - public interface SetterForPetId { - Map getInstance(); - T getBuilderAfterPetId(Map instance); - - default T petId(int value) { - var instance = getInstance(); - instance.put("petId", value); - return getBuilderAfterPetId(instance); - } - - default T petId(float value) { - var instance = getInstance(); - instance.put("petId", value); - return getBuilderAfterPetId(instance); - } - - default T petId(long value) { - var instance = getInstance(); - instance.put("petId", value); - return getBuilderAfterPetId(instance); - } - - default T petId(double value) { - var instance = getInstance(); - instance.put("petId", value); - return getBuilderAfterPetId(instance); - } - } - - public interface SetterForQuantity { - Map getInstance(); - T getBuilderAfterQuantity(Map instance); - - default T quantity(int value) { - var instance = getInstance(); - instance.put("quantity", value); - return getBuilderAfterQuantity(instance); - } - - default T quantity(float value) { - var instance = getInstance(); - instance.put("quantity", value); - return getBuilderAfterQuantity(instance); - } - } - - public interface SetterForShipDate { - Map getInstance(); - T getBuilderAfterShipDate(Map instance); - - default T shipDate(String value) { - var instance = getInstance(); - instance.put("shipDate", value); - return getBuilderAfterShipDate(instance); - } - } - - public interface SetterForStatus { - Map getInstance(); - T getBuilderAfterStatus(Map instance); - - default T status(String value) { - var instance = getInstance(); - instance.put("status", value); - return getBuilderAfterStatus(instance); - } - - default T status(StringStatusEnums value) { - var instance = getInstance(); - instance.put("status", value.value()); - return getBuilderAfterStatus(instance); - } - } - - public interface SetterForComplete { - Map getInstance(); - T getBuilderAfterComplete(Map instance); - - default T complete(boolean value) { - var instance = getInstance(); - instance.put("complete", value); - return getBuilderAfterComplete(instance); - } - } - - public static class OrderMapBuilder extends UnsetAddPropsSetter implements GenericBuilder>, SetterForId, SetterForPetId, SetterForQuantity, SetterForShipDate, SetterForStatus, SetterForComplete { - private final Map instance; - private static final Set knownKeys = Set.of( - "id", - "petId", - "quantity", - "shipDate", - "status", - "complete" - ); - public Set getKnownKeys() { - return knownKeys; - } - public OrderMapBuilder() { - this.instance = new LinkedHashMap<>(); - } - public Map build() { - return instance; - } - public Map getInstance() { - return instance; - } - public OrderMapBuilder getBuilderAfterId(Map instance) { - return this; - } - public OrderMapBuilder getBuilderAfterPetId(Map instance) { - return this; - } - public OrderMapBuilder getBuilderAfterQuantity(Map instance) { - return this; - } - public OrderMapBuilder getBuilderAfterShipDate(Map instance) { - return this; - } - public OrderMapBuilder getBuilderAfterStatus(Map instance) { - return this; - } - public OrderMapBuilder getBuilderAfterComplete(Map instance) { - return this; - } - public OrderMapBuilder getBuilderAfterAdditionalProperty(Map instance) { - return this; - } - } - - - public sealed interface Order1Boxed permits Order1BoxedMap { - @Nullable Object getData(); - } - - public record Order1BoxedMap(OrderMap data) implements Order1Boxed { - @Override - public @Nullable Object getData() { - return data; - } - } - - - public static class Order1 extends JsonSchema implements MapSchemaValidator { - /* - NOTE: This class is auto generated by OpenAPI JSON Schema Generator. - Ref: https://github.com/openapi-json-schema-tools/openapi-json-schema-generator - - Do not edit the class manually. - */ - private static @Nullable Order1 instance = null; - - protected Order1() { - super(new JsonSchemaInfo() - .type(Set.of(Map.class)) - .properties(Map.ofEntries( - new PropertyEntry("id", Id.class), - new PropertyEntry("petId", PetId.class), - new PropertyEntry("quantity", Quantity.class), - new PropertyEntry("shipDate", ShipDate.class), - new PropertyEntry("status", Status.class), - new PropertyEntry("complete", Complete.class) - )) - ); - } - - public static Order1 getInstance() { - if (instance == null) { - instance = new Order1(); - } - return instance; - } - - 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 RuntimeException("Invalid non-string key value"); - } - String propertyName = (String) entryKey; - List propertyPathToItem = new ArrayList<>(pathToItem); - propertyPathToItem.add(propertyName); - Object value = entry.getValue(); - LinkedHashMap, Nothing?> schemas = pathToSchemas.get(propertyPathToItem); - if (schemas == null) { - throw new RuntimeException("Validation result is invalid, schemas must exist for a pathToItem"); - } - JsonSchema propertySchema = schemas.entrySet().iterator().next().getKey(); - @Nullable Object propertyInstance = propertySchema.getNewInstance(value, propertyPathToItem, pathToSchemas); - properties.put(propertyName, propertyInstance); - } - FrozenMap<@Nullable Object> castProperties = new FrozenMap<>(properties); - return new OrderMap(castProperties); - } - - 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); - SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().build())); - ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, new PathToSchemasMap(), new LinkedHashSet<>()); - PathToSchemasMap pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet); - return getNewInstance(castArg, validationMetadata.pathToItem(), pathToSchemasMap); - } - - - @Override - public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws 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"); - } - @Override - public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { - if (arg instanceof Map) { - return getNewInstance((Map) arg, pathToItem, pathToSchemas); - } - 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 { - return new Order1BoxedMap(validate(arg, configuration)); - } - @Override - public Order1Boxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { - 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"); - } - } - -} diff --git a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/schemas/PaginatedResultMyObjectDto.kt b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/schemas/PaginatedResultMyObjectDto.kt deleted file mode 100644 index b27b4338252..00000000000 --- a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/schemas/PaginatedResultMyObjectDto.kt +++ /dev/null @@ -1,416 +0,0 @@ -package org.openapijsonschematools.client.components.schemas; -import java.util.ArrayList; -import java.util.HashSet; -import java.util.LinkedHashMap; -import java.util.LinkedHashSet; -import java.util.List; -import java.util.Map; -import java.util.Objects; -import java.util.Set; -import org.checkerframework.checker.nullness.qual.Nullable; -import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags; -import org.openapijsonschematools.client.configurations.SchemaConfiguration; -import org.openapijsonschematools.client.exceptions.UnsetPropertyException; -import org.openapijsonschematools.client.exceptions.ValidationException; -import org.openapijsonschematools.client.schemas.AnyTypeJsonSchema; -import org.openapijsonschematools.client.schemas.GenericBuilder; -import org.openapijsonschematools.client.schemas.IntJsonSchema; -import org.openapijsonschematools.client.schemas.NotAnyTypeJsonSchema; -import org.openapijsonschematools.client.schemas.validation.FrozenList; -import org.openapijsonschematools.client.schemas.validation.FrozenMap; -import org.openapijsonschematools.client.schemas.validation.JsonSchema; -import org.openapijsonschematools.client.schemas.validation.JsonSchemaInfo; -import org.openapijsonschematools.client.schemas.validation.ListSchemaValidator; -import org.openapijsonschematools.client.schemas.validation.MapSchemaValidator; -import org.openapijsonschematools.client.schemas.validation.MapUtils; -import org.openapijsonschematools.client.schemas.validation.PathToSchemasMap; -import org.openapijsonschematools.client.schemas.validation.PropertyEntry; -import org.openapijsonschematools.client.schemas.validation.ValidationMetadata; - -public class PaginatedResultMyObjectDto { - // nest classes so all schemas and input/output classes can be public - - - public static class AdditionalProperties extends NotAnyTypeJsonSchema.NotAnyTypeJsonSchema1 { - // NotAnyTypeSchema - private static @Nullable AdditionalProperties instance = null; - public static AdditionalProperties getInstance() { - if (instance == null) { - instance = new AdditionalProperties(); - } - return instance; - } - } - - - public static class Count extends IntJsonSchema.IntJsonSchema1 { - private static @Nullable Count instance = null; - public static Count getInstance() { - if (instance == null) { - instance = new Count(); - } - return instance; - } - } - - - public static class ResultsList extends FrozenList { - protected ResultsList(FrozenList m) { - super(m); - } - public static ResultsList of(List> arg, SchemaConfiguration configuration) throws ValidationException { - return Results.getInstance().validate(arg, configuration); - } - } - - public static class ResultsListBuilder { - // class to build List> - private final List> list; - - public ResultsListBuilder() { - list = new ArrayList<>(); - } - - public ResultsListBuilder(List> list) { - this.list = list; - } - - public ResultsListBuilder add(Map item) { - list.add(item); - return this; - } - - public List> build() { - return list; - } - } - - - public sealed interface ResultsBoxed permits ResultsBoxedList { - @Nullable Object getData(); - } - - public record ResultsBoxedList(ResultsList data) implements ResultsBoxed { - @Override - public @Nullable Object getData() { - return data; - } - } - - - - public static class Results extends JsonSchema implements ListSchemaValidator { - private static @Nullable Results instance = null; - - protected Results() { - super(new JsonSchemaInfo() - .type(Set.of(List.class)) - .items(MyObjectDto.MyObjectDto1.class) - ); - } - - public static Results getInstance() { - if (instance == null) { - instance = new Results(); - } - return instance; - } - - @Override - public ResultsList getNewInstance(List arg, List pathToItem, PathToSchemasMap pathToSchemas) { - List items = new ArrayList<>(); - int i = 0; - for (Object item: arg) { - List itemPathToItem = new ArrayList<>(pathToItem); - itemPathToItem.add(i); - LinkedHashMap, Nothing?> schemas = pathToSchemas.get(itemPathToItem); - if (schemas == null) { - throw new RuntimeException("Validation 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"); - } - items.add((MyObjectDto.MyObjectDtoMap) itemInstance); - i += 1; - } - FrozenList newInstanceItems = new FrozenList<>(items); - return new ResultsList(newInstanceItems); - } - - 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); - SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().build())); - ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, new PathToSchemasMap(), new LinkedHashSet<>()); - PathToSchemasMap pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet); - return getNewInstance(castArg, validationMetadata.pathToItem(), pathToSchemasMap); - } - - @Override - public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws 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"); - } - @Override - public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { - 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"); - } - @Override - 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 { - 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"); - } - } - - public static class PaginatedResultMyObjectDtoMap extends FrozenMap { - protected PaginatedResultMyObjectDtoMap(FrozenMap m) { - super(m); - } - public static final Set requiredKeys = Set.of( - "count", - "results" - ); - public static final Set optionalKeys = Set.of(); - public static PaginatedResultMyObjectDtoMap of(Map arg, SchemaConfiguration configuration) throws ValidationException { - return PaginatedResultMyObjectDto1.getInstance().validate(arg, configuration); - } - - public Number count() { - Object value = get("count"); - if (!(value instanceof Number)) { - throw new RuntimeException("Invalid value stored for count"); - } - return (Number) value; - } - - public ResultsList results() { - Object value = get("results"); - if (!(value instanceof ResultsList)) { - throw new RuntimeException("Invalid value stored for results"); - } - return (ResultsList) value; - } - } - - public interface SetterForCount { - Map getInstance(); - T getBuilderAfterCount(Map instance); - - default T count(int value) { - var instance = getInstance(); - instance.put("count", value); - return getBuilderAfterCount(instance); - } - - default T count(float value) { - var instance = getInstance(); - instance.put("count", value); - return getBuilderAfterCount(instance); - } - - default T count(long value) { - var instance = getInstance(); - instance.put("count", value); - return getBuilderAfterCount(instance); - } - - default T count(double value) { - var instance = getInstance(); - instance.put("count", value); - return getBuilderAfterCount(instance); - } - } - - public interface SetterForResults { - Map getInstance(); - T getBuilderAfterResults(Map instance); - - default T results(List> value) { - var instance = getInstance(); - instance.put("results", value); - return getBuilderAfterResults(instance); - } - } - - public static class PaginatedResultMyObjectDtoMap00Builder implements GenericBuilder> { - private final Map instance; - private static final Set knownKeys = Set.of( - "count", - "results" - ); - public Set getKnownKeys() { - return knownKeys; - } - public PaginatedResultMyObjectDtoMap00Builder(Map instance) { - this.instance = instance; - } - public Map build() { - return instance; - } - } - - public static class PaginatedResultMyObjectDtoMap01Builder implements SetterForResults { - private final Map instance; - public PaginatedResultMyObjectDtoMap01Builder(Map instance) { - this.instance = instance; - } - public Map getInstance() { - return instance; - } - public PaginatedResultMyObjectDtoMap00Builder getBuilderAfterResults(Map instance) { - return new PaginatedResultMyObjectDtoMap00Builder(instance); - } - } - - public static class PaginatedResultMyObjectDtoMap10Builder implements SetterForCount { - private final Map instance; - public PaginatedResultMyObjectDtoMap10Builder(Map instance) { - this.instance = instance; - } - public Map getInstance() { - return instance; - } - public PaginatedResultMyObjectDtoMap00Builder getBuilderAfterCount(Map instance) { - return new PaginatedResultMyObjectDtoMap00Builder(instance); - } - } - - public static class PaginatedResultMyObjectDtoMapBuilder implements SetterForCount, SetterForResults { - private final Map instance; - public PaginatedResultMyObjectDtoMapBuilder() { - this.instance = new LinkedHashMap<>(); - } - public Map getInstance() { - return instance; - } - public PaginatedResultMyObjectDtoMap01Builder getBuilderAfterCount(Map instance) { - return new PaginatedResultMyObjectDtoMap01Builder(instance); - } - public PaginatedResultMyObjectDtoMap10Builder getBuilderAfterResults(Map instance) { - return new PaginatedResultMyObjectDtoMap10Builder(instance); - } - } - - - public sealed interface PaginatedResultMyObjectDto1Boxed permits PaginatedResultMyObjectDto1BoxedMap { - @Nullable Object getData(); - } - - public record PaginatedResultMyObjectDto1BoxedMap(PaginatedResultMyObjectDtoMap data) implements PaginatedResultMyObjectDto1Boxed { - @Override - public @Nullable Object getData() { - return data; - } - } - - - public static class PaginatedResultMyObjectDto1 extends JsonSchema implements MapSchemaValidator { - /* - NOTE: This class is auto generated by OpenAPI JSON Schema Generator. - Ref: https://github.com/openapi-json-schema-tools/openapi-json-schema-generator - - Do not edit the class manually. - */ - private static @Nullable PaginatedResultMyObjectDto1 instance = null; - - protected PaginatedResultMyObjectDto1() { - super(new JsonSchemaInfo() - .type(Set.of(Map.class)) - .properties(Map.ofEntries( - new PropertyEntry("count", Count.class), - new PropertyEntry("results", Results.class) - )) - .required(Set.of( - "count", - "results" - )) - .additionalProperties(AdditionalProperties.class) - ); - } - - public static PaginatedResultMyObjectDto1 getInstance() { - if (instance == null) { - instance = new PaginatedResultMyObjectDto1(); - } - return instance; - } - - 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 RuntimeException("Invalid non-string key value"); - } - String propertyName = (String) entryKey; - List propertyPathToItem = new ArrayList<>(pathToItem); - propertyPathToItem.add(propertyName); - Object value = entry.getValue(); - LinkedHashMap, Nothing?> schemas = pathToSchemas.get(propertyPathToItem); - if (schemas == null) { - throw new RuntimeException("Validation 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"); - } - properties.put(propertyName, (Object) propertyInstance); - } - FrozenMap castProperties = new FrozenMap<>(properties); - return new PaginatedResultMyObjectDtoMap(castProperties); - } - - 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); - SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().build())); - ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, new PathToSchemasMap(), new LinkedHashSet<>()); - PathToSchemasMap pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet); - return getNewInstance(castArg, validationMetadata.pathToItem(), pathToSchemasMap); - } - - - @Override - public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws 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"); - } - @Override - public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { - if (arg instanceof Map) { - return getNewInstance((Map) arg, pathToItem, pathToSchemas); - } - 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 { - return new PaginatedResultMyObjectDto1BoxedMap(validate(arg, configuration)); - } - @Override - public PaginatedResultMyObjectDto1Boxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { - 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"); - } - } - -} diff --git a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/schemas/ParentPet.kt b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/schemas/ParentPet.kt deleted file mode 100644 index 54e907bd68f..00000000000 --- a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/schemas/ParentPet.kt +++ /dev/null @@ -1,126 +0,0 @@ -package org.openapijsonschematools.client.components.schemas; -import java.util.ArrayList; -import java.util.HashSet; -import java.util.LinkedHashMap; -import java.util.LinkedHashSet; -import java.util.List; -import java.util.Map; -import java.util.Objects; -import java.util.Set; -import org.checkerframework.checker.nullness.qual.Nullable; -import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags; -import org.openapijsonschematools.client.configurations.SchemaConfiguration; -import org.openapijsonschematools.client.exceptions.InvalidAdditionalPropertyException; -import org.openapijsonschematools.client.exceptions.UnsetPropertyException; -import org.openapijsonschematools.client.exceptions.ValidationException; -import org.openapijsonschematools.client.schemas.UnsetAddPropsSetter; -import org.openapijsonschematools.client.schemas.validation.FrozenMap; -import org.openapijsonschematools.client.schemas.validation.JsonSchema; -import org.openapijsonschematools.client.schemas.validation.JsonSchemaInfo; -import org.openapijsonschematools.client.schemas.validation.MapSchemaValidator; -import org.openapijsonschematools.client.schemas.validation.PathToSchemasMap; -import org.openapijsonschematools.client.schemas.validation.ValidationMetadata; - -public class ParentPet { - // nest classes so all schemas and input/output classes can be public - - - public sealed interface ParentPet1Boxed permits ParentPet1BoxedMap { - @Nullable Object getData(); - } - - public record ParentPet1BoxedMap(FrozenMap<@Nullable Object> data) implements ParentPet1Boxed { - @Override - public @Nullable Object getData() { - return data; - } - } - - - public static class ParentPet1 extends JsonSchema implements MapSchemaValidator, ParentPet1BoxedMap> { - /* - NOTE: This class is auto generated by OpenAPI JSON Schema Generator. - Ref: https://github.com/openapi-json-schema-tools/openapi-json-schema-generator - - Do not edit the class manually. - */ - private static @Nullable ParentPet1 instance = null; - - protected ParentPet1() { - super(new JsonSchemaInfo() - .type(Set.of(Map.class)) - .allOf(List.of( - GrandparentAnimal.GrandparentAnimal1.class - )) - ); - } - - public static ParentPet1 getInstance() { - if (instance == null) { - instance = new ParentPet1(); - } - return instance; - } - - 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 RuntimeException("Invalid non-string key value"); - } - String propertyName = (String) entryKey; - List propertyPathToItem = new ArrayList<>(pathToItem); - propertyPathToItem.add(propertyName); - Object value = entry.getValue(); - LinkedHashMap, Nothing?> schemas = pathToSchemas.get(propertyPathToItem); - if (schemas == null) { - throw new RuntimeException("Validation result is invalid, schemas must exist for a pathToItem"); - } - JsonSchema propertySchema = schemas.entrySet().iterator().next().getKey(); - @Nullable Object propertyInstance = propertySchema.getNewInstance(value, propertyPathToItem, pathToSchemas); - properties.put(propertyName, propertyInstance); - } - FrozenMap<@Nullable Object> castProperties = new FrozenMap<>(properties); - return castProperties; - } - - public FrozenMap<@Nullable Object> validate(Map arg, SchemaConfiguration configuration) throws ValidationException { - Set> pathSet = new HashSet<>(); - List pathToItem = List.of("args[0"); - Map castArg = castToAllowedTypes(arg, pathToItem, pathSet); - SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().build())); - ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, new PathToSchemasMap(), new LinkedHashSet<>()); - PathToSchemasMap pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet); - return getNewInstance(castArg, validationMetadata.pathToItem(), pathToSchemasMap); - } - - - @Override - public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws 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"); - } - @Override - public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { - if (arg instanceof Map) { - return getNewInstance((Map) arg, pathToItem, pathToSchemas); - } - 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 { - return new ParentPet1BoxedMap(validate(arg, configuration)); - } - @Override - public ParentPet1Boxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { - 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"); - } - } - -} diff --git a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/schemas/Pet.kt b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/schemas/Pet.kt deleted file mode 100644 index 14f0a7796b8..00000000000 --- a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/schemas/Pet.kt +++ /dev/null @@ -1,770 +0,0 @@ -package org.openapijsonschematools.client.components.schemas; -import java.util.ArrayList; -import java.util.HashSet; -import java.util.LinkedHashMap; -import java.util.LinkedHashSet; -import java.util.List; -import java.util.Map; -import java.util.Objects; -import java.util.Set; -import org.checkerframework.checker.nullness.qual.Nullable; -import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags; -import org.openapijsonschematools.client.configurations.SchemaConfiguration; -import org.openapijsonschematools.client.exceptions.InvalidAdditionalPropertyException; -import org.openapijsonschematools.client.exceptions.UnsetPropertyException; -import org.openapijsonschematools.client.exceptions.ValidationException; -import org.openapijsonschematools.client.schemas.GenericBuilder; -import org.openapijsonschematools.client.schemas.Int64JsonSchema; -import org.openapijsonschematools.client.schemas.SetMaker; -import org.openapijsonschematools.client.schemas.StringJsonSchema; -import org.openapijsonschematools.client.schemas.UnsetAddPropsSetter; -import org.openapijsonschematools.client.schemas.validation.FrozenList; -import org.openapijsonschematools.client.schemas.validation.FrozenMap; -import org.openapijsonschematools.client.schemas.validation.JsonSchema; -import org.openapijsonschematools.client.schemas.validation.JsonSchemaInfo; -import org.openapijsonschematools.client.schemas.validation.ListSchemaValidator; -import org.openapijsonschematools.client.schemas.validation.MapSchemaValidator; -import org.openapijsonschematools.client.schemas.validation.PathToSchemasMap; -import org.openapijsonschematools.client.schemas.validation.PropertyEntry; -import org.openapijsonschematools.client.schemas.validation.StringEnumValidator; -import org.openapijsonschematools.client.schemas.validation.StringSchemaValidator; -import org.openapijsonschematools.client.schemas.validation.StringValueMethod; -import org.openapijsonschematools.client.schemas.validation.ValidationMetadata; - -public class Pet { - // nest classes so all schemas and input/output classes can be public - - - public static class Id extends Int64JsonSchema.Int64JsonSchema1 { - private static @Nullable Id instance = null; - public static Id getInstance() { - if (instance == null) { - instance = new Id(); - } - return instance; - } - } - - - public static class Name extends StringJsonSchema.StringJsonSchema1 { - private static @Nullable Name instance = null; - public static Name getInstance() { - if (instance == null) { - instance = new Name(); - } - return instance; - } - } - - - public static class Items extends StringJsonSchema.StringJsonSchema1 { - private static @Nullable Items instance = null; - public static Items getInstance() { - if (instance == null) { - instance = new Items(); - } - return instance; - } - } - - - public static class PhotoUrlsList extends FrozenList { - protected PhotoUrlsList(FrozenList m) { - super(m); - } - public static PhotoUrlsList of(List arg, SchemaConfiguration configuration) throws ValidationException { - return PhotoUrls.getInstance().validate(arg, configuration); - } - } - - public static class PhotoUrlsListBuilder { - // class to build List - private final List list; - - public PhotoUrlsListBuilder() { - list = new ArrayList<>(); - } - - public PhotoUrlsListBuilder(List list) { - this.list = list; - } - - public PhotoUrlsListBuilder add(String item) { - list.add(item); - return this; - } - - public List build() { - return list; - } - } - - - public sealed interface PhotoUrlsBoxed permits PhotoUrlsBoxedList { - @Nullable Object getData(); - } - - public record PhotoUrlsBoxedList(PhotoUrlsList data) implements PhotoUrlsBoxed { - @Override - public @Nullable Object getData() { - return data; - } - } - - - - public static class PhotoUrls extends JsonSchema implements ListSchemaValidator { - private static @Nullable PhotoUrls instance = null; - - protected PhotoUrls() { - super(new JsonSchemaInfo() - .type(Set.of(List.class)) - .items(Items.class) - ); - } - - public static PhotoUrls getInstance() { - if (instance == null) { - instance = new PhotoUrls(); - } - return instance; - } - - @Override - public PhotoUrlsList getNewInstance(List arg, List pathToItem, PathToSchemasMap pathToSchemas) { - List items = new ArrayList<>(); - int i = 0; - for (Object item: arg) { - List itemPathToItem = new ArrayList<>(pathToItem); - itemPathToItem.add(i); - LinkedHashMap, Nothing?> schemas = pathToSchemas.get(itemPathToItem); - if (schemas == null) { - throw new RuntimeException("Validation 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"); - } - items.add((String) itemInstance); - i += 1; - } - FrozenList newInstanceItems = new FrozenList<>(items); - return new PhotoUrlsList(newInstanceItems); - } - - 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); - SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().build())); - ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, new PathToSchemasMap(), new LinkedHashSet<>()); - PathToSchemasMap pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet); - return getNewInstance(castArg, validationMetadata.pathToItem(), pathToSchemasMap); - } - - @Override - public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws 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"); - } - @Override - public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { - 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"); - } - @Override - 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 { - 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"); - } - } - public enum StringStatusEnums implements StringValueMethod { - AVAILABLE("available"), - PENDING("pending"), - SOLD("sold"); - private final String value; - - StringStatusEnums(String value) { - this.value = value; - } - public String value() { - return this.value; - } - } - - - public sealed interface StatusBoxed permits StatusBoxedString { - @Nullable Object getData(); - } - - public record StatusBoxedString(String data) implements StatusBoxed { - @Override - public @Nullable Object getData() { - return data; - } - } - - - - public static class Status extends JsonSchema implements StringSchemaValidator, StringEnumValidator { - private static @Nullable Status instance = null; - - protected Status() { - super(new JsonSchemaInfo() - .type(Set.of( - String.class - )) - .enumValues(SetMaker.makeSet( - "available", - "pending", - "sold" - )) - ); - } - - public static Status getInstance() { - if (instance == null) { - instance = new Status(); - } - return instance; - } - - @Override - public String validate(String arg, SchemaConfiguration configuration) throws ValidationException { - Set> pathSet = new HashSet<>(); - List pathToItem = List.of("args[0"); - String castArg = castToAllowedTypes(arg, pathToItem, pathSet); - SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().build())); - ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, new PathToSchemasMap(), new LinkedHashSet<>()); - getPathToSchemas(this, castArg, validationMetadata, pathSet); - return castArg; - } - - @Override - 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 { - 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"); - } - @Override - public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { - 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"); - } - @Override - 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 { - 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"); - } - } - - public static class TagsList extends FrozenList { - protected TagsList(FrozenList m) { - super(m); - } - public static TagsList of(List> arg, SchemaConfiguration configuration) throws ValidationException { - return Tags.getInstance().validate(arg, configuration); - } - } - - public static class TagsListBuilder { - // class to build List> - private final List> list; - - public TagsListBuilder() { - list = new ArrayList<>(); - } - - public TagsListBuilder(List> list) { - this.list = list; - } - - public TagsListBuilder add(Map item) { - list.add(item); - return this; - } - - public List> build() { - return list; - } - } - - - public sealed interface TagsBoxed permits TagsBoxedList { - @Nullable Object getData(); - } - - public record TagsBoxedList(TagsList data) implements TagsBoxed { - @Override - public @Nullable Object getData() { - return data; - } - } - - - - public static class Tags extends JsonSchema implements ListSchemaValidator { - private static @Nullable Tags instance = null; - - protected Tags() { - super(new JsonSchemaInfo() - .type(Set.of(List.class)) - .items(Tag.Tag1.class) - ); - } - - public static Tags getInstance() { - if (instance == null) { - instance = new Tags(); - } - return instance; - } - - @Override - public TagsList getNewInstance(List arg, List pathToItem, PathToSchemasMap pathToSchemas) { - List items = new ArrayList<>(); - int i = 0; - for (Object item: arg) { - List itemPathToItem = new ArrayList<>(pathToItem); - itemPathToItem.add(i); - LinkedHashMap, Nothing?> schemas = pathToSchemas.get(itemPathToItem); - if (schemas == null) { - throw new RuntimeException("Validation 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"); - } - items.add((Tag.TagMap) itemInstance); - i += 1; - } - FrozenList newInstanceItems = new FrozenList<>(items); - return new TagsList(newInstanceItems); - } - - 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); - SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().build())); - ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, new PathToSchemasMap(), new LinkedHashSet<>()); - PathToSchemasMap pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet); - return getNewInstance(castArg, validationMetadata.pathToItem(), pathToSchemasMap); - } - - @Override - public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws 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"); - } - @Override - public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { - 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"); - } - @Override - 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 { - 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"); - } - } - - public static class PetMap extends FrozenMap<@Nullable Object> { - protected PetMap(FrozenMap<@Nullable Object> m) { - super(m); - } - public static final Set requiredKeys = Set.of( - "name", - "photoUrls" - ); - public static final Set optionalKeys = Set.of( - "id", - "category", - "tags", - "status" - ); - public static PetMap of(Map arg, SchemaConfiguration configuration) throws ValidationException { - return Pet1.getInstance().validate(arg, configuration); - } - - public String name() { - @Nullable Object value = get("name"); - if (!(value instanceof String)) { - throw new RuntimeException("Invalid value stored for name"); - } - return (String) value; - } - - public PhotoUrlsList photoUrls() { - @Nullable Object value = get("photoUrls"); - if (!(value instanceof PhotoUrlsList)) { - throw new RuntimeException("Invalid value stored for photoUrls"); - } - return (PhotoUrlsList) value; - } - - public Number id() throws UnsetPropertyException { - String key = "id"; - throwIfKeyNotPresent(key); - @Nullable Object value = get(key); - if (!(value instanceof Number)) { - throw new RuntimeException("Invalid value stored for id"); - } - return (Number) value; - } - - public Category.CategoryMap category() throws UnsetPropertyException { - String key = "category"; - throwIfKeyNotPresent(key); - @Nullable Object value = get(key); - if (!(value instanceof Category.CategoryMap)) { - throw new RuntimeException("Invalid value stored for category"); - } - return (Category.CategoryMap) value; - } - - public TagsList tags() throws UnsetPropertyException { - String key = "tags"; - throwIfKeyNotPresent(key); - @Nullable Object value = get(key); - if (!(value instanceof TagsList)) { - throw new RuntimeException("Invalid value stored for tags"); - } - return (TagsList) value; - } - - public String status() throws UnsetPropertyException { - String key = "status"; - throwIfKeyNotPresent(key); - @Nullable Object value = get(key); - if (!(value instanceof String)) { - throw new RuntimeException("Invalid value stored for status"); - } - return (String) value; - } - - public @Nullable Object getAdditionalProperty(String name) throws UnsetPropertyException, InvalidAdditionalPropertyException { - throwIfKeyKnown(name, requiredKeys, optionalKeys); - throwIfKeyNotPresent(name); - return get(name); - } - } - - public interface SetterForName { - Map getInstance(); - T getBuilderAfterName(Map instance); - - default T name(String value) { - var instance = getInstance(); - instance.put("name", value); - return getBuilderAfterName(instance); - } - } - - public interface SetterForPhotoUrls { - Map getInstance(); - T getBuilderAfterPhotoUrls(Map instance); - - default T photoUrls(List value) { - var instance = getInstance(); - instance.put("photoUrls", value); - return getBuilderAfterPhotoUrls(instance); - } - } - - public interface SetterForId { - Map getInstance(); - T getBuilderAfterId(Map instance); - - default T id(int value) { - var instance = getInstance(); - instance.put("id", value); - return getBuilderAfterId(instance); - } - - default T id(float value) { - var instance = getInstance(); - instance.put("id", value); - return getBuilderAfterId(instance); - } - - default T id(long value) { - var instance = getInstance(); - instance.put("id", value); - return getBuilderAfterId(instance); - } - - default T id(double value) { - var instance = getInstance(); - instance.put("id", value); - return getBuilderAfterId(instance); - } - } - - public interface SetterForCategory { - Map getInstance(); - T getBuilderAfterCategory(Map instance); - - default T category(Map value) { - var instance = getInstance(); - instance.put("category", value); - return getBuilderAfterCategory(instance); - } - } - - public interface SetterForTags { - Map getInstance(); - T getBuilderAfterTags(Map instance); - - default T tags(List> value) { - var instance = getInstance(); - instance.put("tags", value); - return getBuilderAfterTags(instance); - } - } - - public interface SetterForStatus { - Map getInstance(); - T getBuilderAfterStatus(Map instance); - - default T status(String value) { - var instance = getInstance(); - instance.put("status", value); - return getBuilderAfterStatus(instance); - } - - default T status(StringStatusEnums value) { - var instance = getInstance(); - instance.put("status", value.value()); - return getBuilderAfterStatus(instance); - } - } - - public static class PetMap00Builder extends UnsetAddPropsSetter implements GenericBuilder>, SetterForId, SetterForCategory, SetterForTags, SetterForStatus { - private final Map instance; - private static final Set knownKeys = Set.of( - "name", - "photoUrls", - "id", - "category", - "tags", - "status" - ); - public Set getKnownKeys() { - return knownKeys; - } - public PetMap00Builder(Map instance) { - this.instance = instance; - } - public Map build() { - return instance; - } - public Map getInstance() { - return instance; - } - public PetMap00Builder getBuilderAfterId(Map instance) { - return this; - } - public PetMap00Builder getBuilderAfterCategory(Map instance) { - return this; - } - public PetMap00Builder getBuilderAfterTags(Map instance) { - return this; - } - public PetMap00Builder getBuilderAfterStatus(Map instance) { - return this; - } - public PetMap00Builder getBuilderAfterAdditionalProperty(Map instance) { - return this; - } - } - - public static class PetMap01Builder implements SetterForPhotoUrls { - private final Map instance; - public PetMap01Builder(Map instance) { - this.instance = instance; - } - public Map getInstance() { - return instance; - } - public PetMap00Builder getBuilderAfterPhotoUrls(Map instance) { - return new PetMap00Builder(instance); - } - } - - public static class PetMap10Builder implements SetterForName { - private final Map instance; - public PetMap10Builder(Map instance) { - this.instance = instance; - } - public Map getInstance() { - return instance; - } - public PetMap00Builder getBuilderAfterName(Map instance) { - return new PetMap00Builder(instance); - } - } - - public static class PetMapBuilder implements SetterForName, SetterForPhotoUrls { - private final Map instance; - public PetMapBuilder() { - this.instance = new LinkedHashMap<>(); - } - public Map getInstance() { - return instance; - } - public PetMap01Builder getBuilderAfterName(Map instance) { - return new PetMap01Builder(instance); - } - public PetMap10Builder getBuilderAfterPhotoUrls(Map instance) { - return new PetMap10Builder(instance); - } - } - - - public sealed interface Pet1Boxed permits Pet1BoxedMap { - @Nullable Object getData(); - } - - public record Pet1BoxedMap(PetMap data) implements Pet1Boxed { - @Override - public @Nullable Object getData() { - return data; - } - } - - - public static class Pet1 extends JsonSchema implements MapSchemaValidator { - /* - NOTE: This class is auto generated by OpenAPI JSON Schema Generator. - Ref: https://github.com/openapi-json-schema-tools/openapi-json-schema-generator - - Do not edit the class manually. - - Pet object that needs to be added to the store - */ - private static @Nullable Pet1 instance = null; - - protected Pet1() { - super(new JsonSchemaInfo() - .type(Set.of(Map.class)) - .properties(Map.ofEntries( - new PropertyEntry("id", Id.class), - new PropertyEntry("category", Category.Category1.class), - new PropertyEntry("name", Name.class), - new PropertyEntry("photoUrls", PhotoUrls.class), - new PropertyEntry("tags", Tags.class), - new PropertyEntry("status", Status.class) - )) - .required(Set.of( - "name", - "photoUrls" - )) - ); - } - - public static Pet1 getInstance() { - if (instance == null) { - instance = new Pet1(); - } - return instance; - } - - 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 RuntimeException("Invalid non-string key value"); - } - String propertyName = (String) entryKey; - List propertyPathToItem = new ArrayList<>(pathToItem); - propertyPathToItem.add(propertyName); - Object value = entry.getValue(); - LinkedHashMap, Nothing?> schemas = pathToSchemas.get(propertyPathToItem); - if (schemas == null) { - throw new RuntimeException("Validation result is invalid, schemas must exist for a pathToItem"); - } - JsonSchema propertySchema = schemas.entrySet().iterator().next().getKey(); - @Nullable Object propertyInstance = propertySchema.getNewInstance(value, propertyPathToItem, pathToSchemas); - properties.put(propertyName, propertyInstance); - } - FrozenMap<@Nullable Object> castProperties = new FrozenMap<>(properties); - return new PetMap(castProperties); - } - - 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); - SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().build())); - ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, new PathToSchemasMap(), new LinkedHashSet<>()); - PathToSchemasMap pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet); - return getNewInstance(castArg, validationMetadata.pathToItem(), pathToSchemasMap); - } - - - @Override - public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws 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"); - } - @Override - public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { - if (arg instanceof Map) { - return getNewInstance((Map) arg, pathToItem, pathToSchemas); - } - 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 { - return new Pet1BoxedMap(validate(arg, configuration)); - } - @Override - public Pet1Boxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { - 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"); - } - } - -} diff --git a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/schemas/Pig.kt b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/schemas/Pig.kt deleted file mode 100644 index 1528499db75..00000000000 --- a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/schemas/Pig.kt +++ /dev/null @@ -1,330 +0,0 @@ -package org.openapijsonschematools.client.components.schemas; -import java.time.LocalDate; -import java.time.ZonedDateTime; -import java.util.ArrayList; -import java.util.HashSet; -import java.util.LinkedHashMap; -import java.util.LinkedHashSet; -import java.util.List; -import java.util.Map; -import java.util.Objects; -import java.util.Set; -import java.util.UUID; -import org.checkerframework.checker.nullness.qual.Nullable; -import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags; -import org.openapijsonschematools.client.configurations.SchemaConfiguration; -import org.openapijsonschematools.client.exceptions.InvalidAdditionalPropertyException; -import org.openapijsonschematools.client.exceptions.UnsetPropertyException; -import org.openapijsonschematools.client.exceptions.ValidationException; -import org.openapijsonschematools.client.schemas.UnsetAddPropsSetter; -import org.openapijsonschematools.client.schemas.validation.BooleanSchemaValidator; -import org.openapijsonschematools.client.schemas.validation.FrozenList; -import org.openapijsonschematools.client.schemas.validation.FrozenMap; -import org.openapijsonschematools.client.schemas.validation.JsonSchema; -import org.openapijsonschematools.client.schemas.validation.JsonSchemaInfo; -import org.openapijsonschematools.client.schemas.validation.ListSchemaValidator; -import org.openapijsonschematools.client.schemas.validation.MapSchemaValidator; -import org.openapijsonschematools.client.schemas.validation.NullSchemaValidator; -import org.openapijsonschematools.client.schemas.validation.NumberSchemaValidator; -import org.openapijsonschematools.client.schemas.validation.PathToSchemasMap; -import org.openapijsonschematools.client.schemas.validation.StringSchemaValidator; -import org.openapijsonschematools.client.schemas.validation.ValidationMetadata; - -public class Pig { - // nest classes so all schemas and input/output classes can be public - - - public sealed interface Pig1Boxed permits Pig1BoxedVoid, Pig1BoxedBoolean, Pig1BoxedNumber, Pig1BoxedString, Pig1BoxedList, Pig1BoxedMap { - @Nullable Object getData(); - } - - public record Pig1BoxedVoid(Nothing? data) implements Pig1Boxed { - @Override - public @Nullable Object getData() { - return data; - } - } - - public record Pig1BoxedBoolean(boolean data) implements Pig1Boxed { - @Override - public @Nullable Object getData() { - return data; - } - } - - public record Pig1BoxedNumber(Number data) implements Pig1Boxed { - @Override - public @Nullable Object getData() { - return data; - } - } - - public record Pig1BoxedString(String data) implements Pig1Boxed { - @Override - public @Nullable Object getData() { - return data; - } - } - - public record Pig1BoxedList(FrozenList<@Nullable Object> data) implements Pig1Boxed { - @Override - public @Nullable Object getData() { - return data; - } - } - - public record Pig1BoxedMap(FrozenMap<@Nullable Object> data) implements Pig1Boxed { - @Override - public @Nullable Object getData() { - return data; - } - } - - - public static class Pig1 extends JsonSchema implements NullSchemaValidator, BooleanSchemaValidator, NumberSchemaValidator, StringSchemaValidator, ListSchemaValidator, Pig1BoxedList>, MapSchemaValidator, Pig1BoxedMap> { - /* - NOTE: This class is auto generated by OpenAPI JSON Schema Generator. - Ref: https://github.com/openapi-json-schema-tools/openapi-json-schema-generator - - Do not edit the class manually. - */ - private static @Nullable Pig1 instance = null; - - protected Pig1() { - super(new JsonSchemaInfo() - .oneOf(List.of( - BasquePig.BasquePig1.class, - DanishPig.DanishPig1.class - )) - ); - } - - public static Pig1 getInstance() { - if (instance == null) { - instance = new Pig1(); - } - return instance; - } - - @Override - public Nothing? validate(Nothing? arg, SchemaConfiguration configuration) throws ValidationException { - Set> pathSet = new HashSet<>(); - List pathToItem = List.of("args[0]"); - Nothing? castArg = castToAllowedTypes(arg, pathToItem, pathSet); - SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().build())); - PathToSchemasMap validatedPathToSchemas = new PathToSchemasMap(); - ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, new LinkedHashSet<>()); - getPathToSchemas(this, castArg, validationMetadata, pathSet); - return castArg; - } - - @Override - public boolean validate(boolean arg, SchemaConfiguration configuration) throws ValidationException { - Set> pathSet = new HashSet<>(); - List pathToItem = List.of("args[0]"); - boolean castArg = castToAllowedTypes(arg, pathToItem, pathSet); - SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().build())); - PathToSchemasMap validatedPathToSchemas = new PathToSchemasMap(); - ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, new LinkedHashSet<>()); - getPathToSchemas(this, castArg, validationMetadata, pathSet); - return castArg; - } - - @Override - public Number validate(Number arg, SchemaConfiguration configuration) throws ValidationException { - Set> pathSet = new HashSet<>(); - List pathToItem = List.of("args[0]"); - Number castArg = castToAllowedTypes(arg, pathToItem, pathSet); - SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().build())); - PathToSchemasMap validatedPathToSchemas = new PathToSchemasMap(); - ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, new LinkedHashSet<>()); - getPathToSchemas(this, castArg, validationMetadata, pathSet); - return castArg; - } - - public int validate(int arg, SchemaConfiguration configuration) throws ValidationException { - return (int) validate((Number) arg, configuration); - } - - public long validate(long arg, SchemaConfiguration configuration) throws ValidationException { - return (long) validate((Number) arg, configuration); - } - - public float validate(float arg, SchemaConfiguration configuration) throws ValidationException { - return (float) validate((Number) arg, configuration); - } - - public double validate(double arg, SchemaConfiguration configuration) throws ValidationException { - return (double) validate((Number) arg, configuration); - } - - @Override - public String validate(String arg, SchemaConfiguration configuration) throws ValidationException { - Set> pathSet = new HashSet<>(); - List pathToItem = List.of("args[0]"); - String castArg = castToAllowedTypes(arg, pathToItem, pathSet); - SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().build())); - PathToSchemasMap validatedPathToSchemas = new PathToSchemasMap(); - ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, new LinkedHashSet<>()); - getPathToSchemas(this, castArg, validationMetadata, pathSet); - return castArg; - } - - public String validate(LocalDate arg, SchemaConfiguration configuration) throws ValidationException { - return validate(arg.toString(), configuration); - } - - public String validate(ZonedDateTime arg, SchemaConfiguration configuration) throws ValidationException { - return validate(arg.toString(), configuration); - } - - public String validate(UUID arg, SchemaConfiguration configuration) throws ValidationException { - return validate(arg.toString(), configuration); - } - - @Override - public FrozenList<@Nullable Object> getNewInstance(List arg, List pathToItem, PathToSchemasMap pathToSchemas) { - List<@Nullable Object> items = new ArrayList<>(); - int i = 0; - for (Object item: arg) { - List itemPathToItem = new ArrayList<>(pathToItem); - itemPathToItem.add(i); - LinkedHashMap, Nothing?> schemas = pathToSchemas.get(itemPathToItem); - if (schemas == null) { - throw new RuntimeException("Validation result is invalid, schemas must exist for a pathToItem"); - } - JsonSchema itemSchema = schemas.entrySet().iterator().next().getKey(); - @Nullable Object itemInstance = itemSchema.getNewInstance(item, itemPathToItem, pathToSchemas); - items.add(itemInstance); - i += 1; - } - FrozenList<@Nullable Object> newInstanceItems = new FrozenList<>(items); - return newInstanceItems; - } - - 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); - SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().build())); - ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, new PathToSchemasMap(), new LinkedHashSet<>()); - PathToSchemasMap pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet); - return getNewInstance(castArg, validationMetadata.pathToItem(), pathToSchemasMap); - } - - @Override - 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 RuntimeException("Invalid non-string key value"); - } - String propertyName = (String) entryKey; - List propertyPathToItem = new ArrayList<>(pathToItem); - propertyPathToItem.add(propertyName); - Object value = entry.getValue(); - LinkedHashMap, Nothing?> schemas = pathToSchemas.get(propertyPathToItem); - if (schemas == null) { - throw new RuntimeException("Validation result is invalid, schemas must exist for a pathToItem"); - } - JsonSchema propertySchema = schemas.entrySet().iterator().next().getKey(); - @Nullable Object propertyInstance = propertySchema.getNewInstance(value, propertyPathToItem, pathToSchemas); - properties.put(propertyName, propertyInstance); - } - FrozenMap<@Nullable Object> castProperties = new FrozenMap<>(properties); - return castProperties; - } - - public FrozenMap<@Nullable Object> validate(Map arg, SchemaConfiguration configuration) throws ValidationException { - Set> pathSet = new HashSet<>(); - List pathToItem = List.of("args[0]"); - Map castArg = castToAllowedTypes(arg, pathToItem, pathSet); - SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().build())); - PathToSchemasMap validatedPathToSchemas = new PathToSchemasMap(); - ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, new LinkedHashSet<>()); - PathToSchemasMap pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet); - return getNewInstance(castArg, validationMetadata.pathToItem(), pathToSchemasMap); - } - - @Override - public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { - if (arg == null) { - return validate((Nothing?) null, configuration); - } else if (arg instanceof Boolean) { - boolean boolArg = (Boolean) arg; - return validate(boolArg, configuration); - } else if (arg instanceof Number) { - return validate((Number) arg, configuration); - } else if (arg instanceof String) { - return validate((String) arg, configuration); - } else if (arg instanceof List) { - return validate((List) arg, 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"); - } - @Override - public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { - if (arg == null) { - return getNewInstance((Nothing?) null, pathToItem, pathToSchemas); - } else if (arg instanceof Boolean) { - boolean boolArg = (Boolean) arg; - return getNewInstance(boolArg, pathToItem, pathToSchemas); - } else if (arg instanceof Number) { - return getNewInstance((Number) arg, pathToItem, pathToSchemas); - } else if (arg instanceof String) { - return getNewInstance((String) arg, pathToItem, pathToSchemas); - } else if (arg instanceof List) { - return getNewInstance((List) arg, 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"); - } - @Override - public Pig1BoxedVoid validateAndBox(Nothing? arg, SchemaConfiguration configuration) throws ValidationException { - return new Pig1BoxedVoid(validate(arg, configuration)); - } - @Override - 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 { - return new Pig1BoxedNumber(validate(arg, configuration)); - } - @Override - 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 { - return new Pig1BoxedList(validate(arg, configuration)); - } - @Override - 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 { - if (arg == null) { - Nothing? castArg = (Nothing?) arg; - return validateAndBox(castArg, configuration); - } else if (arg instanceof Boolean booleanArg) { - boolean castArg = booleanArg; - return validateAndBox(castArg, configuration); - } else if (arg instanceof String castArg) { - return validateAndBox(castArg, configuration); - } else if (arg instanceof Number castArg) { - return validateAndBox(castArg, configuration); - } else if (arg instanceof List castArg) { - 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"); - } - } -} diff --git a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/schemas/Player.kt b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/schemas/Player.kt deleted file mode 100644 index 02e51a628fa..00000000000 --- a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/schemas/Player.kt +++ /dev/null @@ -1,235 +0,0 @@ -package org.openapijsonschematools.client.components.schemas; -import java.util.ArrayList; -import java.util.HashSet; -import java.util.LinkedHashMap; -import java.util.LinkedHashSet; -import java.util.List; -import java.util.Map; -import java.util.Objects; -import java.util.Set; -import org.checkerframework.checker.nullness.qual.Nullable; -import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags; -import org.openapijsonschematools.client.configurations.SchemaConfiguration; -import org.openapijsonschematools.client.exceptions.InvalidAdditionalPropertyException; -import org.openapijsonschematools.client.exceptions.UnsetPropertyException; -import org.openapijsonschematools.client.exceptions.ValidationException; -import org.openapijsonschematools.client.schemas.GenericBuilder; -import org.openapijsonschematools.client.schemas.StringJsonSchema; -import org.openapijsonschematools.client.schemas.UnsetAddPropsSetter; -import org.openapijsonschematools.client.schemas.validation.FrozenMap; -import org.openapijsonschematools.client.schemas.validation.JsonSchema; -import org.openapijsonschematools.client.schemas.validation.JsonSchemaInfo; -import org.openapijsonschematools.client.schemas.validation.MapSchemaValidator; -import org.openapijsonschematools.client.schemas.validation.PathToSchemasMap; -import org.openapijsonschematools.client.schemas.validation.PropertyEntry; -import org.openapijsonschematools.client.schemas.validation.ValidationMetadata; - -public class Player { - // nest classes so all schemas and input/output classes can be public - - - public static class Name extends StringJsonSchema.StringJsonSchema1 { - private static @Nullable Name instance = null; - public static Name getInstance() { - if (instance == null) { - instance = new Name(); - } - return instance; - } - } - - - public static class PlayerMap extends FrozenMap<@Nullable Object> { - protected PlayerMap(FrozenMap<@Nullable Object> m) { - super(m); - } - public static final Set requiredKeys = Set.of(); - public static final Set optionalKeys = Set.of( - "name", - "enemyPlayer" - ); - public static PlayerMap of(Map arg, SchemaConfiguration configuration) throws ValidationException { - return Player1.getInstance().validate(arg, configuration); - } - - public String name() throws UnsetPropertyException { - String key = "name"; - throwIfKeyNotPresent(key); - @Nullable Object value = get(key); - if (!(value instanceof String)) { - throw new RuntimeException("Invalid value stored for name"); - } - return (String) value; - } - - public PlayerMap enemyPlayer() throws UnsetPropertyException { - String key = "enemyPlayer"; - throwIfKeyNotPresent(key); - @Nullable Object value = get(key); - if (!(value instanceof PlayerMap)) { - throw new RuntimeException("Invalid value stored for enemyPlayer"); - } - return (PlayerMap) value; - } - - public @Nullable Object getAdditionalProperty(String name) throws UnsetPropertyException, InvalidAdditionalPropertyException { - throwIfKeyKnown(name, requiredKeys, optionalKeys); - throwIfKeyNotPresent(name); - return get(name); - } - } - - public interface SetterForName { - Map getInstance(); - T getBuilderAfterName(Map instance); - - default T name(String value) { - var instance = getInstance(); - instance.put("name", value); - return getBuilderAfterName(instance); - } - } - - public interface SetterForEnemyPlayer { - Map getInstance(); - T getBuilderAfterEnemyPlayer(Map instance); - - default T enemyPlayer(Map value) { - var instance = getInstance(); - instance.put("enemyPlayer", value); - return getBuilderAfterEnemyPlayer(instance); - } - } - - public static class PlayerMapBuilder extends UnsetAddPropsSetter implements GenericBuilder>, SetterForName, SetterForEnemyPlayer { - private final Map instance; - private static final Set knownKeys = Set.of( - "name", - "enemyPlayer" - ); - public Set getKnownKeys() { - return knownKeys; - } - public PlayerMapBuilder() { - this.instance = new LinkedHashMap<>(); - } - public Map build() { - return instance; - } - public Map getInstance() { - return instance; - } - public PlayerMapBuilder getBuilderAfterName(Map instance) { - return this; - } - public PlayerMapBuilder getBuilderAfterEnemyPlayer(Map instance) { - return this; - } - public PlayerMapBuilder getBuilderAfterAdditionalProperty(Map instance) { - return this; - } - } - - - public sealed interface Player1Boxed permits Player1BoxedMap { - @Nullable Object getData(); - } - - public record Player1BoxedMap(PlayerMap data) implements Player1Boxed { - @Override - public @Nullable Object getData() { - return data; - } - } - - - public static class Player1 extends JsonSchema implements MapSchemaValidator { - /* - NOTE: This class is auto generated by OpenAPI JSON Schema Generator. - Ref: https://github.com/openapi-json-schema-tools/openapi-json-schema-generator - - Do not edit the class manually. - - a model that includes a self reference this forces properties and additionalProperties to be lazy loaded in python models because the Player class has not fully loaded when defining properties - */ - private static @Nullable Player1 instance = null; - - protected Player1() { - super(new JsonSchemaInfo() - .type(Set.of(Map.class)) - .properties(Map.ofEntries( - new PropertyEntry("name", Name.class), - new PropertyEntry("enemyPlayer", Player1.class) - )) - ); - } - - public static Player1 getInstance() { - if (instance == null) { - instance = new Player1(); - } - return instance; - } - - 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 RuntimeException("Invalid non-string key value"); - } - String propertyName = (String) entryKey; - List propertyPathToItem = new ArrayList<>(pathToItem); - propertyPathToItem.add(propertyName); - Object value = entry.getValue(); - LinkedHashMap, Nothing?> schemas = pathToSchemas.get(propertyPathToItem); - if (schemas == null) { - throw new RuntimeException("Validation result is invalid, schemas must exist for a pathToItem"); - } - JsonSchema propertySchema = schemas.entrySet().iterator().next().getKey(); - @Nullable Object propertyInstance = propertySchema.getNewInstance(value, propertyPathToItem, pathToSchemas); - properties.put(propertyName, propertyInstance); - } - FrozenMap<@Nullable Object> castProperties = new FrozenMap<>(properties); - return new PlayerMap(castProperties); - } - - 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); - SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().build())); - ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, new PathToSchemasMap(), new LinkedHashSet<>()); - PathToSchemasMap pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet); - return getNewInstance(castArg, validationMetadata.pathToItem(), pathToSchemasMap); - } - - - @Override - public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws 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"); - } - @Override - public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { - if (arg instanceof Map) { - return getNewInstance((Map) arg, pathToItem, pathToSchemas); - } - 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 { - return new Player1BoxedMap(validate(arg, configuration)); - } - @Override - public Player1Boxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { - 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"); - } - } - -} diff --git a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/schemas/PublicKey.kt b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/schemas/PublicKey.kt deleted file mode 100644 index 8f3e65e35d0..00000000000 --- a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/schemas/PublicKey.kt +++ /dev/null @@ -1,208 +0,0 @@ -package org.openapijsonschematools.client.components.schemas; -import java.util.ArrayList; -import java.util.HashSet; -import java.util.LinkedHashMap; -import java.util.LinkedHashSet; -import java.util.List; -import java.util.Map; -import java.util.Objects; -import java.util.Set; -import org.checkerframework.checker.nullness.qual.Nullable; -import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags; -import org.openapijsonschematools.client.configurations.SchemaConfiguration; -import org.openapijsonschematools.client.exceptions.InvalidAdditionalPropertyException; -import org.openapijsonschematools.client.exceptions.UnsetPropertyException; -import org.openapijsonschematools.client.exceptions.ValidationException; -import org.openapijsonschematools.client.schemas.GenericBuilder; -import org.openapijsonschematools.client.schemas.StringJsonSchema; -import org.openapijsonschematools.client.schemas.UnsetAddPropsSetter; -import org.openapijsonschematools.client.schemas.validation.FrozenMap; -import org.openapijsonschematools.client.schemas.validation.JsonSchema; -import org.openapijsonschematools.client.schemas.validation.JsonSchemaInfo; -import org.openapijsonschematools.client.schemas.validation.MapSchemaValidator; -import org.openapijsonschematools.client.schemas.validation.PathToSchemasMap; -import org.openapijsonschematools.client.schemas.validation.PropertyEntry; -import org.openapijsonschematools.client.schemas.validation.ValidationMetadata; - -public class PublicKey { - // nest classes so all schemas and input/output classes can be public - - - public static class Key extends StringJsonSchema.StringJsonSchema1 { - private static @Nullable Key instance = null; - public static Key getInstance() { - if (instance == null) { - instance = new Key(); - } - return instance; - } - } - - - public static class PublicKeyMap extends FrozenMap<@Nullable Object> { - protected PublicKeyMap(FrozenMap<@Nullable Object> m) { - super(m); - } - public static final Set requiredKeys = Set.of(); - public static final Set optionalKeys = Set.of( - "key" - ); - public static PublicKeyMap of(Map arg, SchemaConfiguration configuration) throws ValidationException { - return PublicKey1.getInstance().validate(arg, configuration); - } - - public String key() throws UnsetPropertyException { - String key = "key"; - throwIfKeyNotPresent(key); - @Nullable Object value = get(key); - if (!(value instanceof String)) { - throw new RuntimeException("Invalid value stored for key"); - } - return (String) value; - } - - public @Nullable Object getAdditionalProperty(String name) throws UnsetPropertyException, InvalidAdditionalPropertyException { - throwIfKeyKnown(name, requiredKeys, optionalKeys); - throwIfKeyNotPresent(name); - return get(name); - } - } - - public interface SetterForKey { - Map getInstance(); - T getBuilderAfterKey(Map instance); - - default T key(String value) { - var instance = getInstance(); - instance.put("key", value); - return getBuilderAfterKey(instance); - } - } - - public static class PublicKeyMapBuilder extends UnsetAddPropsSetter implements GenericBuilder>, SetterForKey { - private final Map instance; - private static final Set knownKeys = Set.of( - "key" - ); - public Set getKnownKeys() { - return knownKeys; - } - public PublicKeyMapBuilder() { - this.instance = new LinkedHashMap<>(); - } - public Map build() { - return instance; - } - public Map getInstance() { - return instance; - } - public PublicKeyMapBuilder getBuilderAfterKey(Map instance) { - return this; - } - public PublicKeyMapBuilder getBuilderAfterAdditionalProperty(Map instance) { - return this; - } - } - - - public sealed interface PublicKey1Boxed permits PublicKey1BoxedMap { - @Nullable Object getData(); - } - - public record PublicKey1BoxedMap(PublicKeyMap data) implements PublicKey1Boxed { - @Override - public @Nullable Object getData() { - return data; - } - } - - - public static class PublicKey1 extends JsonSchema implements MapSchemaValidator { - /* - NOTE: This class is auto generated by OpenAPI JSON Schema Generator. - Ref: https://github.com/openapi-json-schema-tools/openapi-json-schema-generator - - Do not edit the class manually. - - schema that contains a property named key - */ - private static @Nullable PublicKey1 instance = null; - - protected PublicKey1() { - super(new JsonSchemaInfo() - .type(Set.of(Map.class)) - .properties(Map.ofEntries( - new PropertyEntry("key", Key.class) - )) - ); - } - - public static PublicKey1 getInstance() { - if (instance == null) { - instance = new PublicKey1(); - } - return instance; - } - - 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 RuntimeException("Invalid non-string key value"); - } - String propertyName = (String) entryKey; - List propertyPathToItem = new ArrayList<>(pathToItem); - propertyPathToItem.add(propertyName); - Object value = entry.getValue(); - LinkedHashMap, Nothing?> schemas = pathToSchemas.get(propertyPathToItem); - if (schemas == null) { - throw new RuntimeException("Validation result is invalid, schemas must exist for a pathToItem"); - } - JsonSchema propertySchema = schemas.entrySet().iterator().next().getKey(); - @Nullable Object propertyInstance = propertySchema.getNewInstance(value, propertyPathToItem, pathToSchemas); - properties.put(propertyName, propertyInstance); - } - FrozenMap<@Nullable Object> castProperties = new FrozenMap<>(properties); - return new PublicKeyMap(castProperties); - } - - 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); - SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().build())); - ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, new PathToSchemasMap(), new LinkedHashSet<>()); - PathToSchemasMap pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet); - return getNewInstance(castArg, validationMetadata.pathToItem(), pathToSchemasMap); - } - - - @Override - public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws 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"); - } - @Override - public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { - if (arg instanceof Map) { - return getNewInstance((Map) arg, pathToItem, pathToSchemas); - } - 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 { - return new PublicKey1BoxedMap(validate(arg, configuration)); - } - @Override - public PublicKey1Boxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { - 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"); - } - } - -} diff --git a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/schemas/Quadrilateral.kt b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/schemas/Quadrilateral.kt deleted file mode 100644 index 17eb261f9d3..00000000000 --- a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/schemas/Quadrilateral.kt +++ /dev/null @@ -1,330 +0,0 @@ -package org.openapijsonschematools.client.components.schemas; -import java.time.LocalDate; -import java.time.ZonedDateTime; -import java.util.ArrayList; -import java.util.HashSet; -import java.util.LinkedHashMap; -import java.util.LinkedHashSet; -import java.util.List; -import java.util.Map; -import java.util.Objects; -import java.util.Set; -import java.util.UUID; -import org.checkerframework.checker.nullness.qual.Nullable; -import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags; -import org.openapijsonschematools.client.configurations.SchemaConfiguration; -import org.openapijsonschematools.client.exceptions.InvalidAdditionalPropertyException; -import org.openapijsonschematools.client.exceptions.UnsetPropertyException; -import org.openapijsonschematools.client.exceptions.ValidationException; -import org.openapijsonschematools.client.schemas.UnsetAddPropsSetter; -import org.openapijsonschematools.client.schemas.validation.BooleanSchemaValidator; -import org.openapijsonschematools.client.schemas.validation.FrozenList; -import org.openapijsonschematools.client.schemas.validation.FrozenMap; -import org.openapijsonschematools.client.schemas.validation.JsonSchema; -import org.openapijsonschematools.client.schemas.validation.JsonSchemaInfo; -import org.openapijsonschematools.client.schemas.validation.ListSchemaValidator; -import org.openapijsonschematools.client.schemas.validation.MapSchemaValidator; -import org.openapijsonschematools.client.schemas.validation.NullSchemaValidator; -import org.openapijsonschematools.client.schemas.validation.NumberSchemaValidator; -import org.openapijsonschematools.client.schemas.validation.PathToSchemasMap; -import org.openapijsonschematools.client.schemas.validation.StringSchemaValidator; -import org.openapijsonschematools.client.schemas.validation.ValidationMetadata; - -public class Quadrilateral { - // nest classes so all schemas and input/output classes can be public - - - public sealed interface Quadrilateral1Boxed permits Quadrilateral1BoxedVoid, Quadrilateral1BoxedBoolean, Quadrilateral1BoxedNumber, Quadrilateral1BoxedString, Quadrilateral1BoxedList, Quadrilateral1BoxedMap { - @Nullable Object getData(); - } - - public record Quadrilateral1BoxedVoid(Nothing? data) implements Quadrilateral1Boxed { - @Override - public @Nullable Object getData() { - return data; - } - } - - public record Quadrilateral1BoxedBoolean(boolean data) implements Quadrilateral1Boxed { - @Override - public @Nullable Object getData() { - return data; - } - } - - public record Quadrilateral1BoxedNumber(Number data) implements Quadrilateral1Boxed { - @Override - public @Nullable Object getData() { - return data; - } - } - - public record Quadrilateral1BoxedString(String data) implements Quadrilateral1Boxed { - @Override - public @Nullable Object getData() { - return data; - } - } - - public record Quadrilateral1BoxedList(FrozenList<@Nullable Object> data) implements Quadrilateral1Boxed { - @Override - public @Nullable Object getData() { - return data; - } - } - - public record Quadrilateral1BoxedMap(FrozenMap<@Nullable Object> data) implements Quadrilateral1Boxed { - @Override - public @Nullable Object getData() { - return data; - } - } - - - public static class Quadrilateral1 extends JsonSchema implements NullSchemaValidator, BooleanSchemaValidator, NumberSchemaValidator, StringSchemaValidator, ListSchemaValidator, Quadrilateral1BoxedList>, MapSchemaValidator, Quadrilateral1BoxedMap> { - /* - NOTE: This class is auto generated by OpenAPI JSON Schema Generator. - Ref: https://github.com/openapi-json-schema-tools/openapi-json-schema-generator - - Do not edit the class manually. - */ - private static @Nullable Quadrilateral1 instance = null; - - protected Quadrilateral1() { - super(new JsonSchemaInfo() - .oneOf(List.of( - SimpleQuadrilateral.SimpleQuadrilateral1.class, - ComplexQuadrilateral.ComplexQuadrilateral1.class - )) - ); - } - - public static Quadrilateral1 getInstance() { - if (instance == null) { - instance = new Quadrilateral1(); - } - return instance; - } - - @Override - public Nothing? validate(Nothing? arg, SchemaConfiguration configuration) throws ValidationException { - Set> pathSet = new HashSet<>(); - List pathToItem = List.of("args[0]"); - Nothing? castArg = castToAllowedTypes(arg, pathToItem, pathSet); - SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().build())); - PathToSchemasMap validatedPathToSchemas = new PathToSchemasMap(); - ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, new LinkedHashSet<>()); - getPathToSchemas(this, castArg, validationMetadata, pathSet); - return castArg; - } - - @Override - public boolean validate(boolean arg, SchemaConfiguration configuration) throws ValidationException { - Set> pathSet = new HashSet<>(); - List pathToItem = List.of("args[0]"); - boolean castArg = castToAllowedTypes(arg, pathToItem, pathSet); - SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().build())); - PathToSchemasMap validatedPathToSchemas = new PathToSchemasMap(); - ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, new LinkedHashSet<>()); - getPathToSchemas(this, castArg, validationMetadata, pathSet); - return castArg; - } - - @Override - public Number validate(Number arg, SchemaConfiguration configuration) throws ValidationException { - Set> pathSet = new HashSet<>(); - List pathToItem = List.of("args[0]"); - Number castArg = castToAllowedTypes(arg, pathToItem, pathSet); - SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().build())); - PathToSchemasMap validatedPathToSchemas = new PathToSchemasMap(); - ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, new LinkedHashSet<>()); - getPathToSchemas(this, castArg, validationMetadata, pathSet); - return castArg; - } - - public int validate(int arg, SchemaConfiguration configuration) throws ValidationException { - return (int) validate((Number) arg, configuration); - } - - public long validate(long arg, SchemaConfiguration configuration) throws ValidationException { - return (long) validate((Number) arg, configuration); - } - - public float validate(float arg, SchemaConfiguration configuration) throws ValidationException { - return (float) validate((Number) arg, configuration); - } - - public double validate(double arg, SchemaConfiguration configuration) throws ValidationException { - return (double) validate((Number) arg, configuration); - } - - @Override - public String validate(String arg, SchemaConfiguration configuration) throws ValidationException { - Set> pathSet = new HashSet<>(); - List pathToItem = List.of("args[0]"); - String castArg = castToAllowedTypes(arg, pathToItem, pathSet); - SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().build())); - PathToSchemasMap validatedPathToSchemas = new PathToSchemasMap(); - ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, new LinkedHashSet<>()); - getPathToSchemas(this, castArg, validationMetadata, pathSet); - return castArg; - } - - public String validate(LocalDate arg, SchemaConfiguration configuration) throws ValidationException { - return validate(arg.toString(), configuration); - } - - public String validate(ZonedDateTime arg, SchemaConfiguration configuration) throws ValidationException { - return validate(arg.toString(), configuration); - } - - public String validate(UUID arg, SchemaConfiguration configuration) throws ValidationException { - return validate(arg.toString(), configuration); - } - - @Override - public FrozenList<@Nullable Object> getNewInstance(List arg, List pathToItem, PathToSchemasMap pathToSchemas) { - List<@Nullable Object> items = new ArrayList<>(); - int i = 0; - for (Object item: arg) { - List itemPathToItem = new ArrayList<>(pathToItem); - itemPathToItem.add(i); - LinkedHashMap, Nothing?> schemas = pathToSchemas.get(itemPathToItem); - if (schemas == null) { - throw new RuntimeException("Validation result is invalid, schemas must exist for a pathToItem"); - } - JsonSchema itemSchema = schemas.entrySet().iterator().next().getKey(); - @Nullable Object itemInstance = itemSchema.getNewInstance(item, itemPathToItem, pathToSchemas); - items.add(itemInstance); - i += 1; - } - FrozenList<@Nullable Object> newInstanceItems = new FrozenList<>(items); - return newInstanceItems; - } - - 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); - SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().build())); - ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, new PathToSchemasMap(), new LinkedHashSet<>()); - PathToSchemasMap pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet); - return getNewInstance(castArg, validationMetadata.pathToItem(), pathToSchemasMap); - } - - @Override - 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 RuntimeException("Invalid non-string key value"); - } - String propertyName = (String) entryKey; - List propertyPathToItem = new ArrayList<>(pathToItem); - propertyPathToItem.add(propertyName); - Object value = entry.getValue(); - LinkedHashMap, Nothing?> schemas = pathToSchemas.get(propertyPathToItem); - if (schemas == null) { - throw new RuntimeException("Validation result is invalid, schemas must exist for a pathToItem"); - } - JsonSchema propertySchema = schemas.entrySet().iterator().next().getKey(); - @Nullable Object propertyInstance = propertySchema.getNewInstance(value, propertyPathToItem, pathToSchemas); - properties.put(propertyName, propertyInstance); - } - FrozenMap<@Nullable Object> castProperties = new FrozenMap<>(properties); - return castProperties; - } - - public FrozenMap<@Nullable Object> validate(Map arg, SchemaConfiguration configuration) throws ValidationException { - Set> pathSet = new HashSet<>(); - List pathToItem = List.of("args[0]"); - Map castArg = castToAllowedTypes(arg, pathToItem, pathSet); - SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().build())); - PathToSchemasMap validatedPathToSchemas = new PathToSchemasMap(); - ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, new LinkedHashSet<>()); - PathToSchemasMap pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet); - return getNewInstance(castArg, validationMetadata.pathToItem(), pathToSchemasMap); - } - - @Override - public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { - if (arg == null) { - return validate((Nothing?) null, configuration); - } else if (arg instanceof Boolean) { - boolean boolArg = (Boolean) arg; - return validate(boolArg, configuration); - } else if (arg instanceof Number) { - return validate((Number) arg, configuration); - } else if (arg instanceof String) { - return validate((String) arg, configuration); - } else if (arg instanceof List) { - return validate((List) arg, 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"); - } - @Override - public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { - if (arg == null) { - return getNewInstance((Nothing?) null, pathToItem, pathToSchemas); - } else if (arg instanceof Boolean) { - boolean boolArg = (Boolean) arg; - return getNewInstance(boolArg, pathToItem, pathToSchemas); - } else if (arg instanceof Number) { - return getNewInstance((Number) arg, pathToItem, pathToSchemas); - } else if (arg instanceof String) { - return getNewInstance((String) arg, pathToItem, pathToSchemas); - } else if (arg instanceof List) { - return getNewInstance((List) arg, 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"); - } - @Override - public Quadrilateral1BoxedVoid validateAndBox(Nothing? arg, SchemaConfiguration configuration) throws ValidationException { - return new Quadrilateral1BoxedVoid(validate(arg, configuration)); - } - @Override - 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 { - return new Quadrilateral1BoxedNumber(validate(arg, configuration)); - } - @Override - 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 { - return new Quadrilateral1BoxedList(validate(arg, configuration)); - } - @Override - 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 { - if (arg == null) { - Nothing? castArg = (Nothing?) arg; - return validateAndBox(castArg, configuration); - } else if (arg instanceof Boolean booleanArg) { - boolean castArg = booleanArg; - return validateAndBox(castArg, configuration); - } else if (arg instanceof String castArg) { - return validateAndBox(castArg, configuration); - } else if (arg instanceof Number castArg) { - return validateAndBox(castArg, configuration); - } else if (arg instanceof List castArg) { - 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"); - } - } -} diff --git a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/schemas/QuadrilateralInterface.kt b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/schemas/QuadrilateralInterface.kt deleted file mode 100644 index fa635ecad8d..00000000000 --- a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/schemas/QuadrilateralInterface.kt +++ /dev/null @@ -1,570 +0,0 @@ -package org.openapijsonschematools.client.components.schemas; -import java.time.LocalDate; -import java.time.ZonedDateTime; -import java.util.ArrayList; -import java.util.HashSet; -import java.util.LinkedHashMap; -import java.util.LinkedHashSet; -import java.util.List; -import java.util.Map; -import java.util.Objects; -import java.util.Set; -import java.util.UUID; -import org.checkerframework.checker.nullness.qual.Nullable; -import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags; -import org.openapijsonschematools.client.configurations.SchemaConfiguration; -import org.openapijsonschematools.client.exceptions.InvalidAdditionalPropertyException; -import org.openapijsonschematools.client.exceptions.UnsetPropertyException; -import org.openapijsonschematools.client.exceptions.ValidationException; -import org.openapijsonschematools.client.schemas.GenericBuilder; -import org.openapijsonschematools.client.schemas.SetMaker; -import org.openapijsonschematools.client.schemas.StringJsonSchema; -import org.openapijsonschematools.client.schemas.UnsetAddPropsSetter; -import org.openapijsonschematools.client.schemas.validation.BooleanSchemaValidator; -import org.openapijsonschematools.client.schemas.validation.FrozenList; -import org.openapijsonschematools.client.schemas.validation.FrozenMap; -import org.openapijsonschematools.client.schemas.validation.JsonSchema; -import org.openapijsonschematools.client.schemas.validation.JsonSchemaInfo; -import org.openapijsonschematools.client.schemas.validation.ListSchemaValidator; -import org.openapijsonschematools.client.schemas.validation.MapSchemaValidator; -import org.openapijsonschematools.client.schemas.validation.NullSchemaValidator; -import org.openapijsonschematools.client.schemas.validation.NumberSchemaValidator; -import org.openapijsonschematools.client.schemas.validation.PathToSchemasMap; -import org.openapijsonschematools.client.schemas.validation.PropertyEntry; -import org.openapijsonschematools.client.schemas.validation.StringEnumValidator; -import org.openapijsonschematools.client.schemas.validation.StringSchemaValidator; -import org.openapijsonschematools.client.schemas.validation.StringValueMethod; -import org.openapijsonschematools.client.schemas.validation.ValidationMetadata; - -public class QuadrilateralInterface { - // nest classes so all schemas and input/output classes can be public - - public enum StringShapeTypeEnums implements StringValueMethod { - QUADRILATERAL("Quadrilateral"); - private final String value; - - StringShapeTypeEnums(String value) { - this.value = value; - } - public String value() { - return this.value; - } - } - - - public sealed interface ShapeTypeBoxed permits ShapeTypeBoxedString { - @Nullable Object getData(); - } - - public record ShapeTypeBoxedString(String data) implements ShapeTypeBoxed { - @Override - public @Nullable Object getData() { - return data; - } - } - - - - public static class ShapeType extends JsonSchema implements StringSchemaValidator, StringEnumValidator { - private static @Nullable ShapeType instance = null; - - protected ShapeType() { - super(new JsonSchemaInfo() - .type(Set.of( - String.class - )) - .enumValues(SetMaker.makeSet( - "Quadrilateral" - )) - ); - } - - public static ShapeType getInstance() { - if (instance == null) { - instance = new ShapeType(); - } - return instance; - } - - @Override - public String validate(String arg, SchemaConfiguration configuration) throws ValidationException { - Set> pathSet = new HashSet<>(); - List pathToItem = List.of("args[0"); - String castArg = castToAllowedTypes(arg, pathToItem, pathSet); - SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().build())); - ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, new PathToSchemasMap(), new LinkedHashSet<>()); - getPathToSchemas(this, castArg, validationMetadata, pathSet); - return castArg; - } - - @Override - 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 { - 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"); - } - @Override - public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { - 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"); - } - @Override - 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 { - 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"); - } - } - - public static class QuadrilateralType extends StringJsonSchema.StringJsonSchema1 { - private static @Nullable QuadrilateralType instance = null; - public static QuadrilateralType getInstance() { - if (instance == null) { - instance = new QuadrilateralType(); - } - return instance; - } - } - - - public static class QuadrilateralInterfaceMap extends FrozenMap<@Nullable Object> { - protected QuadrilateralInterfaceMap(FrozenMap<@Nullable Object> m) { - super(m); - } - public static final Set requiredKeys = Set.of( - "quadrilateralType", - "shapeType" - ); - public static final Set optionalKeys = Set.of(); - public static QuadrilateralInterfaceMap of(Map arg, SchemaConfiguration configuration) throws ValidationException { - return QuadrilateralInterface1.getInstance().validate(arg, configuration); - } - - public String quadrilateralType() { - @Nullable Object value = get("quadrilateralType"); - if (!(value instanceof String)) { - throw new RuntimeException("Invalid value stored for quadrilateralType"); - } - return (String) value; - } - - public String shapeType() { - @Nullable Object value = get("shapeType"); - if (!(value instanceof String)) { - throw new RuntimeException("Invalid value stored for shapeType"); - } - return (String) value; - } - - public @Nullable Object getAdditionalProperty(String name) throws UnsetPropertyException, InvalidAdditionalPropertyException { - throwIfKeyKnown(name, requiredKeys, optionalKeys); - throwIfKeyNotPresent(name); - return get(name); - } - } - - public interface SetterForQuadrilateralType { - Map getInstance(); - T getBuilderAfterQuadrilateralType(Map instance); - - default T quadrilateralType(String value) { - var instance = getInstance(); - instance.put("quadrilateralType", value); - return getBuilderAfterQuadrilateralType(instance); - } - } - - public interface SetterForShapeType { - Map getInstance(); - T getBuilderAfterShapeType(Map instance); - - default T shapeType(String value) { - var instance = getInstance(); - instance.put("shapeType", value); - return getBuilderAfterShapeType(instance); - } - - default T shapeType(StringShapeTypeEnums value) { - var instance = getInstance(); - instance.put("shapeType", value.value()); - return getBuilderAfterShapeType(instance); - } - } - - public static class QuadrilateralInterfaceMap00Builder extends UnsetAddPropsSetter implements GenericBuilder> { - private final Map instance; - private static final Set knownKeys = Set.of( - "quadrilateralType", - "shapeType" - ); - public Set getKnownKeys() { - return knownKeys; - } - public QuadrilateralInterfaceMap00Builder(Map instance) { - this.instance = instance; - } - public Map build() { - return instance; - } - public Map getInstance() { - return instance; - } - public QuadrilateralInterfaceMap00Builder getBuilderAfterAdditionalProperty(Map instance) { - return this; - } - } - - public static class QuadrilateralInterfaceMap01Builder implements SetterForShapeType { - private final Map instance; - public QuadrilateralInterfaceMap01Builder(Map instance) { - this.instance = instance; - } - public Map getInstance() { - return instance; - } - public QuadrilateralInterfaceMap00Builder getBuilderAfterShapeType(Map instance) { - return new QuadrilateralInterfaceMap00Builder(instance); - } - } - - public static class QuadrilateralInterfaceMap10Builder implements SetterForQuadrilateralType { - private final Map instance; - public QuadrilateralInterfaceMap10Builder(Map instance) { - this.instance = instance; - } - public Map getInstance() { - return instance; - } - public QuadrilateralInterfaceMap00Builder getBuilderAfterQuadrilateralType(Map instance) { - return new QuadrilateralInterfaceMap00Builder(instance); - } - } - - public static class QuadrilateralInterfaceMapBuilder implements SetterForQuadrilateralType, SetterForShapeType { - private final Map instance; - public QuadrilateralInterfaceMapBuilder() { - this.instance = new LinkedHashMap<>(); - } - public Map getInstance() { - return instance; - } - public QuadrilateralInterfaceMap01Builder getBuilderAfterQuadrilateralType(Map instance) { - return new QuadrilateralInterfaceMap01Builder(instance); - } - public QuadrilateralInterfaceMap10Builder getBuilderAfterShapeType(Map instance) { - return new QuadrilateralInterfaceMap10Builder(instance); - } - } - - - public sealed interface QuadrilateralInterface1Boxed permits QuadrilateralInterface1BoxedVoid, QuadrilateralInterface1BoxedBoolean, QuadrilateralInterface1BoxedNumber, QuadrilateralInterface1BoxedString, QuadrilateralInterface1BoxedList, QuadrilateralInterface1BoxedMap { - @Nullable Object getData(); - } - - public record QuadrilateralInterface1BoxedVoid(Nothing? data) implements QuadrilateralInterface1Boxed { - @Override - public @Nullable Object getData() { - return data; - } - } - - public record QuadrilateralInterface1BoxedBoolean(boolean data) implements QuadrilateralInterface1Boxed { - @Override - public @Nullable Object getData() { - return data; - } - } - - public record QuadrilateralInterface1BoxedNumber(Number data) implements QuadrilateralInterface1Boxed { - @Override - public @Nullable Object getData() { - return data; - } - } - - public record QuadrilateralInterface1BoxedString(String data) implements QuadrilateralInterface1Boxed { - @Override - public @Nullable Object getData() { - return data; - } - } - - public record QuadrilateralInterface1BoxedList(FrozenList<@Nullable Object> data) implements QuadrilateralInterface1Boxed { - @Override - public @Nullable Object getData() { - return data; - } - } - - public record QuadrilateralInterface1BoxedMap(QuadrilateralInterfaceMap data) implements QuadrilateralInterface1Boxed { - @Override - public @Nullable Object getData() { - return data; - } - } - - - public static class QuadrilateralInterface1 extends JsonSchema implements NullSchemaValidator, BooleanSchemaValidator, NumberSchemaValidator, StringSchemaValidator, ListSchemaValidator, QuadrilateralInterface1BoxedList>, MapSchemaValidator { - /* - NOTE: This class is auto generated by OpenAPI JSON Schema Generator. - Ref: https://github.com/openapi-json-schema-tools/openapi-json-schema-generator - - Do not edit the class manually. - */ - private static @Nullable QuadrilateralInterface1 instance = null; - - protected QuadrilateralInterface1() { - super(new JsonSchemaInfo() - .properties(Map.ofEntries( - new PropertyEntry("shapeType", ShapeType.class), - new PropertyEntry("quadrilateralType", QuadrilateralType.class) - )) - .required(Set.of( - "quadrilateralType", - "shapeType" - )) - ); - } - - public static QuadrilateralInterface1 getInstance() { - if (instance == null) { - instance = new QuadrilateralInterface1(); - } - return instance; - } - - @Override - public Nothing? validate(Nothing? arg, SchemaConfiguration configuration) throws ValidationException { - Set> pathSet = new HashSet<>(); - List pathToItem = List.of("args[0]"); - Nothing? castArg = castToAllowedTypes(arg, pathToItem, pathSet); - SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().build())); - PathToSchemasMap validatedPathToSchemas = new PathToSchemasMap(); - ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, new LinkedHashSet<>()); - getPathToSchemas(this, castArg, validationMetadata, pathSet); - return castArg; - } - - @Override - public boolean validate(boolean arg, SchemaConfiguration configuration) throws ValidationException { - Set> pathSet = new HashSet<>(); - List pathToItem = List.of("args[0]"); - boolean castArg = castToAllowedTypes(arg, pathToItem, pathSet); - SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().build())); - PathToSchemasMap validatedPathToSchemas = new PathToSchemasMap(); - ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, new LinkedHashSet<>()); - getPathToSchemas(this, castArg, validationMetadata, pathSet); - return castArg; - } - - @Override - public Number validate(Number arg, SchemaConfiguration configuration) throws ValidationException { - Set> pathSet = new HashSet<>(); - List pathToItem = List.of("args[0]"); - Number castArg = castToAllowedTypes(arg, pathToItem, pathSet); - SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().build())); - PathToSchemasMap validatedPathToSchemas = new PathToSchemasMap(); - ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, new LinkedHashSet<>()); - getPathToSchemas(this, castArg, validationMetadata, pathSet); - return castArg; - } - - public int validate(int arg, SchemaConfiguration configuration) throws ValidationException { - return (int) validate((Number) arg, configuration); - } - - public long validate(long arg, SchemaConfiguration configuration) throws ValidationException { - return (long) validate((Number) arg, configuration); - } - - public float validate(float arg, SchemaConfiguration configuration) throws ValidationException { - return (float) validate((Number) arg, configuration); - } - - public double validate(double arg, SchemaConfiguration configuration) throws ValidationException { - return (double) validate((Number) arg, configuration); - } - - @Override - public String validate(String arg, SchemaConfiguration configuration) throws ValidationException { - Set> pathSet = new HashSet<>(); - List pathToItem = List.of("args[0]"); - String castArg = castToAllowedTypes(arg, pathToItem, pathSet); - SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().build())); - PathToSchemasMap validatedPathToSchemas = new PathToSchemasMap(); - ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, new LinkedHashSet<>()); - getPathToSchemas(this, castArg, validationMetadata, pathSet); - return castArg; - } - - public String validate(LocalDate arg, SchemaConfiguration configuration) throws ValidationException { - return validate(arg.toString(), configuration); - } - - public String validate(ZonedDateTime arg, SchemaConfiguration configuration) throws ValidationException { - return validate(arg.toString(), configuration); - } - - public String validate(UUID arg, SchemaConfiguration configuration) throws ValidationException { - return validate(arg.toString(), configuration); - } - - @Override - public FrozenList<@Nullable Object> getNewInstance(List arg, List pathToItem, PathToSchemasMap pathToSchemas) { - List<@Nullable Object> items = new ArrayList<>(); - int i = 0; - for (Object item: arg) { - List itemPathToItem = new ArrayList<>(pathToItem); - itemPathToItem.add(i); - LinkedHashMap, Nothing?> schemas = pathToSchemas.get(itemPathToItem); - if (schemas == null) { - throw new RuntimeException("Validation result is invalid, schemas must exist for a pathToItem"); - } - JsonSchema itemSchema = schemas.entrySet().iterator().next().getKey(); - @Nullable Object itemInstance = itemSchema.getNewInstance(item, itemPathToItem, pathToSchemas); - items.add(itemInstance); - i += 1; - } - FrozenList<@Nullable Object> newInstanceItems = new FrozenList<>(items); - return newInstanceItems; - } - - 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); - SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().build())); - ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, new PathToSchemasMap(), new LinkedHashSet<>()); - PathToSchemasMap pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet); - return getNewInstance(castArg, validationMetadata.pathToItem(), pathToSchemasMap); - } - - @Override - 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 RuntimeException("Invalid non-string key value"); - } - String propertyName = (String) entryKey; - List propertyPathToItem = new ArrayList<>(pathToItem); - propertyPathToItem.add(propertyName); - Object value = entry.getValue(); - LinkedHashMap, Nothing?> schemas = pathToSchemas.get(propertyPathToItem); - if (schemas == null) { - throw new RuntimeException("Validation result is invalid, schemas must exist for a pathToItem"); - } - JsonSchema propertySchema = schemas.entrySet().iterator().next().getKey(); - @Nullable Object propertyInstance = propertySchema.getNewInstance(value, propertyPathToItem, pathToSchemas); - properties.put(propertyName, propertyInstance); - } - FrozenMap<@Nullable Object> castProperties = new FrozenMap<>(properties); - return new QuadrilateralInterfaceMap(castProperties); - } - - 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); - SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().build())); - PathToSchemasMap validatedPathToSchemas = new PathToSchemasMap(); - ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, new LinkedHashSet<>()); - PathToSchemasMap pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet); - return getNewInstance(castArg, validationMetadata.pathToItem(), pathToSchemasMap); - } - - @Override - public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { - if (arg == null) { - return validate((Nothing?) null, configuration); - } else if (arg instanceof Boolean) { - boolean boolArg = (Boolean) arg; - return validate(boolArg, configuration); - } else if (arg instanceof Number) { - return validate((Number) arg, configuration); - } else if (arg instanceof String) { - return validate((String) arg, configuration); - } else if (arg instanceof List) { - return validate((List) arg, 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"); - } - @Override - public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { - if (arg == null) { - return getNewInstance((Nothing?) null, pathToItem, pathToSchemas); - } else if (arg instanceof Boolean) { - boolean boolArg = (Boolean) arg; - return getNewInstance(boolArg, pathToItem, pathToSchemas); - } else if (arg instanceof Number) { - return getNewInstance((Number) arg, pathToItem, pathToSchemas); - } else if (arg instanceof String) { - return getNewInstance((String) arg, pathToItem, pathToSchemas); - } else if (arg instanceof List) { - return getNewInstance((List) arg, 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"); - } - @Override - public QuadrilateralInterface1BoxedVoid validateAndBox(Nothing? arg, SchemaConfiguration configuration) throws ValidationException { - return new QuadrilateralInterface1BoxedVoid(validate(arg, configuration)); - } - @Override - 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 { - return new QuadrilateralInterface1BoxedNumber(validate(arg, configuration)); - } - @Override - 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 { - return new QuadrilateralInterface1BoxedList(validate(arg, configuration)); - } - @Override - 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 { - if (arg == null) { - Nothing? castArg = (Nothing?) arg; - return validateAndBox(castArg, configuration); - } else if (arg instanceof Boolean booleanArg) { - boolean castArg = booleanArg; - return validateAndBox(castArg, configuration); - } else if (arg instanceof String castArg) { - return validateAndBox(castArg, configuration); - } else if (arg instanceof Number castArg) { - return validateAndBox(castArg, configuration); - } else if (arg instanceof List castArg) { - 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"); - } - } -} diff --git a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/schemas/ReadOnlyFirst.kt b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/schemas/ReadOnlyFirst.kt deleted file mode 100644 index 48da489c9c0..00000000000 --- a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/schemas/ReadOnlyFirst.kt +++ /dev/null @@ -1,244 +0,0 @@ -package org.openapijsonschematools.client.components.schemas; -import java.util.ArrayList; -import java.util.HashSet; -import java.util.LinkedHashMap; -import java.util.LinkedHashSet; -import java.util.List; -import java.util.Map; -import java.util.Objects; -import java.util.Set; -import org.checkerframework.checker.nullness.qual.Nullable; -import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags; -import org.openapijsonschematools.client.configurations.SchemaConfiguration; -import org.openapijsonschematools.client.exceptions.InvalidAdditionalPropertyException; -import org.openapijsonschematools.client.exceptions.UnsetPropertyException; -import org.openapijsonschematools.client.exceptions.ValidationException; -import org.openapijsonschematools.client.schemas.GenericBuilder; -import org.openapijsonschematools.client.schemas.StringJsonSchema; -import org.openapijsonschematools.client.schemas.UnsetAddPropsSetter; -import org.openapijsonschematools.client.schemas.validation.FrozenMap; -import org.openapijsonschematools.client.schemas.validation.JsonSchema; -import org.openapijsonschematools.client.schemas.validation.JsonSchemaInfo; -import org.openapijsonschematools.client.schemas.validation.MapSchemaValidator; -import org.openapijsonschematools.client.schemas.validation.PathToSchemasMap; -import org.openapijsonschematools.client.schemas.validation.PropertyEntry; -import org.openapijsonschematools.client.schemas.validation.ValidationMetadata; - -public class ReadOnlyFirst { - // nest classes so all schemas and input/output classes can be public - - - public static class Bar extends StringJsonSchema.StringJsonSchema1 { - private static @Nullable Bar instance = null; - public static Bar getInstance() { - if (instance == null) { - instance = new Bar(); - } - return instance; - } - } - - - public static class Baz extends StringJsonSchema.StringJsonSchema1 { - private static @Nullable Baz instance = null; - public static Baz getInstance() { - if (instance == null) { - instance = new Baz(); - } - return instance; - } - } - - - public static class ReadOnlyFirstMap extends FrozenMap<@Nullable Object> { - protected ReadOnlyFirstMap(FrozenMap<@Nullable Object> m) { - super(m); - } - public static final Set requiredKeys = Set.of(); - public static final Set optionalKeys = Set.of( - "bar", - "baz" - ); - public static ReadOnlyFirstMap of(Map arg, SchemaConfiguration configuration) throws ValidationException { - return ReadOnlyFirst1.getInstance().validate(arg, configuration); - } - - public String bar() throws UnsetPropertyException { - String key = "bar"; - throwIfKeyNotPresent(key); - @Nullable Object value = get(key); - if (!(value instanceof String)) { - throw new RuntimeException("Invalid value stored for bar"); - } - return (String) value; - } - - public String baz() throws UnsetPropertyException { - String key = "baz"; - throwIfKeyNotPresent(key); - @Nullable Object value = get(key); - if (!(value instanceof String)) { - throw new RuntimeException("Invalid value stored for baz"); - } - return (String) value; - } - - public @Nullable Object getAdditionalProperty(String name) throws UnsetPropertyException, InvalidAdditionalPropertyException { - throwIfKeyKnown(name, requiredKeys, optionalKeys); - throwIfKeyNotPresent(name); - return get(name); - } - } - - public interface SetterForBar { - Map getInstance(); - T getBuilderAfterBar(Map instance); - - default T bar(String value) { - var instance = getInstance(); - instance.put("bar", value); - return getBuilderAfterBar(instance); - } - } - - public interface SetterForBaz { - Map getInstance(); - T getBuilderAfterBaz(Map instance); - - default T baz(String value) { - var instance = getInstance(); - instance.put("baz", value); - return getBuilderAfterBaz(instance); - } - } - - public static class ReadOnlyFirstMapBuilder extends UnsetAddPropsSetter implements GenericBuilder>, SetterForBar, SetterForBaz { - private final Map instance; - private static final Set knownKeys = Set.of( - "bar", - "baz" - ); - public Set getKnownKeys() { - return knownKeys; - } - public ReadOnlyFirstMapBuilder() { - this.instance = new LinkedHashMap<>(); - } - public Map build() { - return instance; - } - public Map getInstance() { - return instance; - } - public ReadOnlyFirstMapBuilder getBuilderAfterBar(Map instance) { - return this; - } - public ReadOnlyFirstMapBuilder getBuilderAfterBaz(Map instance) { - return this; - } - public ReadOnlyFirstMapBuilder getBuilderAfterAdditionalProperty(Map instance) { - return this; - } - } - - - public sealed interface ReadOnlyFirst1Boxed permits ReadOnlyFirst1BoxedMap { - @Nullable Object getData(); - } - - public record ReadOnlyFirst1BoxedMap(ReadOnlyFirstMap data) implements ReadOnlyFirst1Boxed { - @Override - public @Nullable Object getData() { - return data; - } - } - - - public static class ReadOnlyFirst1 extends JsonSchema implements MapSchemaValidator { - /* - NOTE: This class is auto generated by OpenAPI JSON Schema Generator. - Ref: https://github.com/openapi-json-schema-tools/openapi-json-schema-generator - - Do not edit the class manually. - */ - private static @Nullable ReadOnlyFirst1 instance = null; - - protected ReadOnlyFirst1() { - super(new JsonSchemaInfo() - .type(Set.of(Map.class)) - .properties(Map.ofEntries( - new PropertyEntry("bar", Bar.class), - new PropertyEntry("baz", Baz.class) - )) - ); - } - - public static ReadOnlyFirst1 getInstance() { - if (instance == null) { - instance = new ReadOnlyFirst1(); - } - return instance; - } - - 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 RuntimeException("Invalid non-string key value"); - } - String propertyName = (String) entryKey; - List propertyPathToItem = new ArrayList<>(pathToItem); - propertyPathToItem.add(propertyName); - Object value = entry.getValue(); - LinkedHashMap, Nothing?> schemas = pathToSchemas.get(propertyPathToItem); - if (schemas == null) { - throw new RuntimeException("Validation result is invalid, schemas must exist for a pathToItem"); - } - JsonSchema propertySchema = schemas.entrySet().iterator().next().getKey(); - @Nullable Object propertyInstance = propertySchema.getNewInstance(value, propertyPathToItem, pathToSchemas); - properties.put(propertyName, propertyInstance); - } - FrozenMap<@Nullable Object> castProperties = new FrozenMap<>(properties); - return new ReadOnlyFirstMap(castProperties); - } - - 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); - SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().build())); - ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, new PathToSchemasMap(), new LinkedHashSet<>()); - PathToSchemasMap pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet); - return getNewInstance(castArg, validationMetadata.pathToItem(), pathToSchemasMap); - } - - - @Override - public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws 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"); - } - @Override - public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { - if (arg instanceof Map) { - return getNewInstance((Map) arg, pathToItem, pathToSchemas); - } - 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 { - return new ReadOnlyFirst1BoxedMap(validate(arg, configuration)); - } - @Override - public ReadOnlyFirst1Boxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { - 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"); - } - } - -} diff --git a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/schemas/RefPet.kt b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/schemas/RefPet.kt deleted file mode 100644 index 08574fbbc86..00000000000 --- a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/schemas/RefPet.kt +++ /dev/null @@ -1,18 +0,0 @@ -package org.openapijsonschematools.client.components.schemas; - -import org.checkerframework.checker.nullness.qual.Nullable; - -public class RefPet extends Pet { - // $refed class - - - public static class RefPet1 extends Pet1 { - private static @Nullable RefPet1 instance = null; - public static RefPet1 getInstance() { - if (instance == null) { - instance = new RefPet1(); - } - return instance; - } - } -} diff --git a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/schemas/ReqPropsFromExplicitAddProps.kt b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/schemas/ReqPropsFromExplicitAddProps.kt deleted file mode 100644 index ad149650b05..00000000000 --- a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/schemas/ReqPropsFromExplicitAddProps.kt +++ /dev/null @@ -1,272 +0,0 @@ -package org.openapijsonschematools.client.components.schemas; -import java.util.ArrayList; -import java.util.HashSet; -import java.util.LinkedHashMap; -import java.util.LinkedHashSet; -import java.util.List; -import java.util.Map; -import java.util.Objects; -import java.util.Set; -import org.checkerframework.checker.nullness.qual.Nullable; -import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags; -import org.openapijsonschematools.client.configurations.SchemaConfiguration; -import org.openapijsonschematools.client.exceptions.InvalidAdditionalPropertyException; -import org.openapijsonschematools.client.exceptions.UnsetPropertyException; -import org.openapijsonschematools.client.exceptions.ValidationException; -import org.openapijsonschematools.client.schemas.GenericBuilder; -import org.openapijsonschematools.client.schemas.StringJsonSchema; -import org.openapijsonschematools.client.schemas.validation.FrozenMap; -import org.openapijsonschematools.client.schemas.validation.JsonSchema; -import org.openapijsonschematools.client.schemas.validation.JsonSchemaInfo; -import org.openapijsonschematools.client.schemas.validation.MapSchemaValidator; -import org.openapijsonschematools.client.schemas.validation.MapUtils; -import org.openapijsonschematools.client.schemas.validation.PathToSchemasMap; -import org.openapijsonschematools.client.schemas.validation.ValidationMetadata; - -public class ReqPropsFromExplicitAddProps { - // nest classes so all schemas and input/output classes can be public - - - public static class AdditionalProperties extends StringJsonSchema.StringJsonSchema1 { - private static @Nullable AdditionalProperties instance = null; - public static AdditionalProperties getInstance() { - if (instance == null) { - instance = new AdditionalProperties(); - } - return instance; - } - } - - - public static class ReqPropsFromExplicitAddPropsMap extends FrozenMap { - protected ReqPropsFromExplicitAddPropsMap(FrozenMap m) { - super(m); - } - public static final Set requiredKeys = Set.of( - "invalid-name", - "validName" - ); - public static final Set optionalKeys = Set.of(); - public static ReqPropsFromExplicitAddPropsMap of(Map arg, SchemaConfiguration configuration) throws ValidationException { - return ReqPropsFromExplicitAddProps1.getInstance().validate(arg, configuration); - } - - public String validName() { - try { - return getOrThrow("version"); - } catch (UnsetPropertyException e) { - throw new RuntimeException(e); - } - } - - public String getAdditionalProperty(String name) throws UnsetPropertyException, InvalidAdditionalPropertyException { - throwIfKeyKnown(name, requiredKeys, optionalKeys); - return getOrThrow(name); - } - } - - public interface SetterForInvalidname { - Map getInstance(); - T getBuilderAfterInvalidname(Map instance); - - default T invalidHyphenMinusName(String value) { - var instance = getInstance(); - instance.put("invalid-name", value); - return getBuilderAfterInvalidname(instance); - } - } - - public interface SetterForValidName { - Map getInstance(); - T getBuilderAfterValidName(Map instance); - - default T validName(String value) { - var instance = getInstance(); - instance.put("validName", value); - return getBuilderAfterValidName(instance); - } - } - - public interface SetterForAdditionalProperties { - Set getKnownKeys(); - Map getInstance(); - T getBuilderAfterAdditionalProperty(Map instance); - - default T additionalProperty(String key, String value) throws InvalidAdditionalPropertyException { - MapUtils.throwIfKeyKnown(key, getKnownKeys(), true); - var instance = getInstance(); - instance.put(key, value); - return getBuilderAfterAdditionalProperty(instance); - } - } - - public static class ReqPropsFromExplicitAddPropsMap00Builder implements GenericBuilder>, SetterForAdditionalProperties { - private final Map instance; - private static final Set knownKeys = Set.of( - "invalid-name", - "validName" - ); - public Set getKnownKeys() { - return knownKeys; - } - public ReqPropsFromExplicitAddPropsMap00Builder(Map instance) { - this.instance = instance; - } - public Map build() { - return instance; - } - public Map getInstance() { - return instance; - } - public ReqPropsFromExplicitAddPropsMap00Builder getBuilderAfterAdditionalProperty(Map instance) { - return this; - } - } - - public static class ReqPropsFromExplicitAddPropsMap01Builder implements SetterForValidName { - private final Map instance; - public ReqPropsFromExplicitAddPropsMap01Builder(Map instance) { - this.instance = instance; - } - public Map getInstance() { - return instance; - } - public ReqPropsFromExplicitAddPropsMap00Builder getBuilderAfterValidName(Map instance) { - return new ReqPropsFromExplicitAddPropsMap00Builder(instance); - } - } - - public static class ReqPropsFromExplicitAddPropsMap10Builder implements SetterForInvalidname { - private final Map instance; - public ReqPropsFromExplicitAddPropsMap10Builder(Map instance) { - this.instance = instance; - } - public Map getInstance() { - return instance; - } - public ReqPropsFromExplicitAddPropsMap00Builder getBuilderAfterInvalidname(Map instance) { - return new ReqPropsFromExplicitAddPropsMap00Builder(instance); - } - } - - public static class ReqPropsFromExplicitAddPropsMapBuilder implements SetterForInvalidname, SetterForValidName { - private final Map instance; - public ReqPropsFromExplicitAddPropsMapBuilder() { - this.instance = new LinkedHashMap<>(); - } - public Map getInstance() { - return instance; - } - public ReqPropsFromExplicitAddPropsMap01Builder getBuilderAfterInvalidname(Map instance) { - return new ReqPropsFromExplicitAddPropsMap01Builder(instance); - } - public ReqPropsFromExplicitAddPropsMap10Builder getBuilderAfterValidName(Map instance) { - return new ReqPropsFromExplicitAddPropsMap10Builder(instance); - } - } - - - public sealed interface ReqPropsFromExplicitAddProps1Boxed permits ReqPropsFromExplicitAddProps1BoxedMap { - @Nullable Object getData(); - } - - public record ReqPropsFromExplicitAddProps1BoxedMap(ReqPropsFromExplicitAddPropsMap data) implements ReqPropsFromExplicitAddProps1Boxed { - @Override - public @Nullable Object getData() { - return data; - } - } - - - public static class ReqPropsFromExplicitAddProps1 extends JsonSchema implements MapSchemaValidator { - /* - NOTE: This class is auto generated by OpenAPI JSON Schema Generator. - Ref: https://github.com/openapi-json-schema-tools/openapi-json-schema-generator - - Do not edit the class manually. - */ - private static @Nullable ReqPropsFromExplicitAddProps1 instance = null; - - protected ReqPropsFromExplicitAddProps1() { - super(new JsonSchemaInfo() - .type(Set.of(Map.class)) - .required(Set.of( - "invalid-name", - "validName" - )) - .additionalProperties(AdditionalProperties.class) - ); - } - - public static ReqPropsFromExplicitAddProps1 getInstance() { - if (instance == null) { - instance = new ReqPropsFromExplicitAddProps1(); - } - return instance; - } - - 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 RuntimeException("Invalid non-string key value"); - } - String propertyName = (String) entryKey; - List propertyPathToItem = new ArrayList<>(pathToItem); - propertyPathToItem.add(propertyName); - Object value = entry.getValue(); - LinkedHashMap, Nothing?> schemas = pathToSchemas.get(propertyPathToItem); - if (schemas == null) { - throw new RuntimeException("Validation 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"); - } - properties.put(propertyName, (String) propertyInstance); - } - FrozenMap castProperties = new FrozenMap<>(properties); - return new ReqPropsFromExplicitAddPropsMap(castProperties); - } - - 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); - SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().build())); - ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, new PathToSchemasMap(), new LinkedHashSet<>()); - PathToSchemasMap pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet); - return getNewInstance(castArg, validationMetadata.pathToItem(), pathToSchemasMap); - } - - - @Override - public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws 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"); - } - @Override - public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { - if (arg instanceof Map) { - return getNewInstance((Map) arg, pathToItem, pathToSchemas); - } - 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 { - return new ReqPropsFromExplicitAddProps1BoxedMap(validate(arg, configuration)); - } - @Override - public ReqPropsFromExplicitAddProps1Boxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { - 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"); - } - } - -} diff --git a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/schemas/ReqPropsFromTrueAddProps.kt b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/schemas/ReqPropsFromTrueAddProps.kt deleted file mode 100644 index 062ef60050b..00000000000 --- a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/schemas/ReqPropsFromTrueAddProps.kt +++ /dev/null @@ -1,421 +0,0 @@ -package org.openapijsonschematools.client.components.schemas; -import java.util.ArrayList; -import java.util.HashSet; -import java.util.LinkedHashMap; -import java.util.LinkedHashSet; -import java.util.List; -import java.util.Map; -import java.util.Objects; -import java.util.Set; -import org.checkerframework.checker.nullness.qual.Nullable; -import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags; -import org.openapijsonschematools.client.configurations.SchemaConfiguration; -import org.openapijsonschematools.client.exceptions.InvalidAdditionalPropertyException; -import org.openapijsonschematools.client.exceptions.UnsetPropertyException; -import org.openapijsonschematools.client.exceptions.ValidationException; -import org.openapijsonschematools.client.schemas.AnyTypeJsonSchema; -import org.openapijsonschematools.client.schemas.GenericBuilder; -import org.openapijsonschematools.client.schemas.validation.FrozenMap; -import org.openapijsonschematools.client.schemas.validation.JsonSchema; -import org.openapijsonschematools.client.schemas.validation.JsonSchemaInfo; -import org.openapijsonschematools.client.schemas.validation.MapSchemaValidator; -import org.openapijsonschematools.client.schemas.validation.MapUtils; -import org.openapijsonschematools.client.schemas.validation.PathToSchemasMap; -import org.openapijsonschematools.client.schemas.validation.ValidationMetadata; - -public class ReqPropsFromTrueAddProps { - // nest classes so all schemas and input/output classes can be public - - - public static class AdditionalProperties extends AnyTypeJsonSchema.AnyTypeJsonSchema1 { - private static @Nullable AdditionalProperties instance = null; - public static AdditionalProperties getInstance() { - if (instance == null) { - instance = new AdditionalProperties(); - } - return instance; - } - } - - - public static class ReqPropsFromTrueAddPropsMap extends FrozenMap<@Nullable Object> { - protected ReqPropsFromTrueAddPropsMap(FrozenMap<@Nullable Object> m) { - super(m); - } - public static final Set requiredKeys = Set.of( - "invalid-name", - "validName" - ); - public static final Set optionalKeys = Set.of(); - public static ReqPropsFromTrueAddPropsMap of(Map arg, SchemaConfiguration configuration) throws ValidationException { - return ReqPropsFromTrueAddProps1.getInstance().validate(arg, configuration); - } - - public @Nullable Object validName() { - try { - return getOrThrow("version"); - } catch (UnsetPropertyException e) { - throw new RuntimeException(e); - } - } - - public @Nullable Object getAdditionalProperty(String name) throws UnsetPropertyException, InvalidAdditionalPropertyException { - throwIfKeyKnown(name, requiredKeys, optionalKeys); - return getOrThrow(name); - } - } - - public interface SetterForInvalidname { - Map getInstance(); - T getBuilderAfterInvalidname(Map instance); - - default T invalidHyphenMinusName(Nothing? value) { - var instance = getInstance(); - instance.put("invalid-name", null); - return getBuilderAfterInvalidname(instance); - } - - default T invalidHyphenMinusName(boolean value) { - var instance = getInstance(); - instance.put("invalid-name", value); - return getBuilderAfterInvalidname(instance); - } - - default T invalidHyphenMinusName(String value) { - var instance = getInstance(); - instance.put("invalid-name", value); - return getBuilderAfterInvalidname(instance); - } - - default T invalidHyphenMinusName(int value) { - var instance = getInstance(); - instance.put("invalid-name", value); - return getBuilderAfterInvalidname(instance); - } - - default T invalidHyphenMinusName(float value) { - var instance = getInstance(); - instance.put("invalid-name", value); - return getBuilderAfterInvalidname(instance); - } - - default T invalidHyphenMinusName(long value) { - var instance = getInstance(); - instance.put("invalid-name", value); - return getBuilderAfterInvalidname(instance); - } - - default T invalidHyphenMinusName(double value) { - var instance = getInstance(); - instance.put("invalid-name", value); - return getBuilderAfterInvalidname(instance); - } - - default T invalidHyphenMinusName(List value) { - var instance = getInstance(); - instance.put("invalid-name", value); - return getBuilderAfterInvalidname(instance); - } - - default T invalidHyphenMinusName(Map value) { - var instance = getInstance(); - instance.put("invalid-name", value); - return getBuilderAfterInvalidname(instance); - } - } - - public interface SetterForValidName { - Map getInstance(); - T getBuilderAfterValidName(Map instance); - - default T validName(Nothing? value) { - var instance = getInstance(); - instance.put("validName", null); - return getBuilderAfterValidName(instance); - } - - default T validName(boolean value) { - var instance = getInstance(); - instance.put("validName", value); - return getBuilderAfterValidName(instance); - } - - default T validName(String value) { - var instance = getInstance(); - instance.put("validName", value); - return getBuilderAfterValidName(instance); - } - - default T validName(int value) { - var instance = getInstance(); - instance.put("validName", value); - return getBuilderAfterValidName(instance); - } - - default T validName(float value) { - var instance = getInstance(); - instance.put("validName", value); - return getBuilderAfterValidName(instance); - } - - default T validName(long value) { - var instance = getInstance(); - instance.put("validName", value); - return getBuilderAfterValidName(instance); - } - - default T validName(double value) { - var instance = getInstance(); - instance.put("validName", value); - return getBuilderAfterValidName(instance); - } - - default T validName(List value) { - var instance = getInstance(); - instance.put("validName", value); - return getBuilderAfterValidName(instance); - } - - default T validName(Map value) { - var instance = getInstance(); - instance.put("validName", value); - return getBuilderAfterValidName(instance); - } - } - - public interface SetterForAdditionalProperties { - Set getKnownKeys(); - Map getInstance(); - T getBuilderAfterAdditionalProperty(Map instance); - - default T additionalProperty(String key, Nothing? value) throws InvalidAdditionalPropertyException { - MapUtils.throwIfKeyKnown(key, getKnownKeys(), true); - var instance = getInstance(); - instance.put(key, null); - return getBuilderAfterAdditionalProperty(instance); - } - - default T additionalProperty(String key, boolean value) throws InvalidAdditionalPropertyException { - MapUtils.throwIfKeyKnown(key, getKnownKeys(), true); - var instance = getInstance(); - instance.put(key, value); - return getBuilderAfterAdditionalProperty(instance); - } - - default T additionalProperty(String key, String value) throws InvalidAdditionalPropertyException { - MapUtils.throwIfKeyKnown(key, getKnownKeys(), true); - var instance = getInstance(); - instance.put(key, value); - return getBuilderAfterAdditionalProperty(instance); - } - - default T additionalProperty(String key, int value) throws InvalidAdditionalPropertyException { - MapUtils.throwIfKeyKnown(key, getKnownKeys(), true); - var instance = getInstance(); - instance.put(key, value); - return getBuilderAfterAdditionalProperty(instance); - } - - default T additionalProperty(String key, float value) throws InvalidAdditionalPropertyException { - MapUtils.throwIfKeyKnown(key, getKnownKeys(), true); - var instance = getInstance(); - instance.put(key, value); - return getBuilderAfterAdditionalProperty(instance); - } - - default T additionalProperty(String key, long value) throws InvalidAdditionalPropertyException { - MapUtils.throwIfKeyKnown(key, getKnownKeys(), true); - var instance = getInstance(); - instance.put(key, value); - return getBuilderAfterAdditionalProperty(instance); - } - - default T additionalProperty(String key, double value) throws InvalidAdditionalPropertyException { - MapUtils.throwIfKeyKnown(key, getKnownKeys(), true); - var instance = getInstance(); - instance.put(key, value); - return getBuilderAfterAdditionalProperty(instance); - } - - default T additionalProperty(String key, List value) throws InvalidAdditionalPropertyException { - MapUtils.throwIfKeyKnown(key, getKnownKeys(), true); - var instance = getInstance(); - instance.put(key, value); - return getBuilderAfterAdditionalProperty(instance); - } - - default T additionalProperty(String key, Map value) throws InvalidAdditionalPropertyException { - MapUtils.throwIfKeyKnown(key, getKnownKeys(), true); - var instance = getInstance(); - instance.put(key, value); - return getBuilderAfterAdditionalProperty(instance); - } - } - - public static class ReqPropsFromTrueAddPropsMap00Builder implements GenericBuilder>, SetterForAdditionalProperties { - private final Map instance; - private static final Set knownKeys = Set.of( - "invalid-name", - "validName" - ); - public Set getKnownKeys() { - return knownKeys; - } - public ReqPropsFromTrueAddPropsMap00Builder(Map instance) { - this.instance = instance; - } - public Map build() { - return instance; - } - public Map getInstance() { - return instance; - } - public ReqPropsFromTrueAddPropsMap00Builder getBuilderAfterAdditionalProperty(Map instance) { - return this; - } - } - - public static class ReqPropsFromTrueAddPropsMap01Builder implements SetterForValidName { - private final Map instance; - public ReqPropsFromTrueAddPropsMap01Builder(Map instance) { - this.instance = instance; - } - public Map getInstance() { - return instance; - } - public ReqPropsFromTrueAddPropsMap00Builder getBuilderAfterValidName(Map instance) { - return new ReqPropsFromTrueAddPropsMap00Builder(instance); - } - } - - public static class ReqPropsFromTrueAddPropsMap10Builder implements SetterForInvalidname { - private final Map instance; - public ReqPropsFromTrueAddPropsMap10Builder(Map instance) { - this.instance = instance; - } - public Map getInstance() { - return instance; - } - public ReqPropsFromTrueAddPropsMap00Builder getBuilderAfterInvalidname(Map instance) { - return new ReqPropsFromTrueAddPropsMap00Builder(instance); - } - } - - public static class ReqPropsFromTrueAddPropsMapBuilder implements SetterForInvalidname, SetterForValidName { - private final Map instance; - public ReqPropsFromTrueAddPropsMapBuilder() { - this.instance = new LinkedHashMap<>(); - } - public Map getInstance() { - return instance; - } - public ReqPropsFromTrueAddPropsMap01Builder getBuilderAfterInvalidname(Map instance) { - return new ReqPropsFromTrueAddPropsMap01Builder(instance); - } - public ReqPropsFromTrueAddPropsMap10Builder getBuilderAfterValidName(Map instance) { - return new ReqPropsFromTrueAddPropsMap10Builder(instance); - } - } - - - public sealed interface ReqPropsFromTrueAddProps1Boxed permits ReqPropsFromTrueAddProps1BoxedMap { - @Nullable Object getData(); - } - - public record ReqPropsFromTrueAddProps1BoxedMap(ReqPropsFromTrueAddPropsMap data) implements ReqPropsFromTrueAddProps1Boxed { - @Override - public @Nullable Object getData() { - return data; - } - } - - - public static class ReqPropsFromTrueAddProps1 extends JsonSchema implements MapSchemaValidator { - /* - NOTE: This class is auto generated by OpenAPI JSON Schema Generator. - Ref: https://github.com/openapi-json-schema-tools/openapi-json-schema-generator - - Do not edit the class manually. - */ - private static @Nullable ReqPropsFromTrueAddProps1 instance = null; - - protected ReqPropsFromTrueAddProps1() { - super(new JsonSchemaInfo() - .type(Set.of(Map.class)) - .required(Set.of( - "invalid-name", - "validName" - )) - .additionalProperties(AdditionalProperties.class) - ); - } - - public static ReqPropsFromTrueAddProps1 getInstance() { - if (instance == null) { - instance = new ReqPropsFromTrueAddProps1(); - } - return instance; - } - - 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 RuntimeException("Invalid non-string key value"); - } - String propertyName = (String) entryKey; - List propertyPathToItem = new ArrayList<>(pathToItem); - propertyPathToItem.add(propertyName); - Object value = entry.getValue(); - LinkedHashMap, Nothing?> schemas = pathToSchemas.get(propertyPathToItem); - if (schemas == null) { - throw new RuntimeException("Validation result is invalid, schemas must exist for a pathToItem"); - } - JsonSchema propertySchema = schemas.entrySet().iterator().next().getKey(); - @Nullable Object propertyInstance = propertySchema.getNewInstance(value, propertyPathToItem, pathToSchemas); - properties.put(propertyName, propertyInstance); - } - FrozenMap<@Nullable Object> castProperties = new FrozenMap<>(properties); - return new ReqPropsFromTrueAddPropsMap(castProperties); - } - - 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); - SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().build())); - ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, new PathToSchemasMap(), new LinkedHashSet<>()); - PathToSchemasMap pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet); - return getNewInstance(castArg, validationMetadata.pathToItem(), pathToSchemasMap); - } - - - @Override - public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws 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"); - } - @Override - public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { - if (arg instanceof Map) { - return getNewInstance((Map) arg, pathToItem, pathToSchemas); - } - 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 { - return new ReqPropsFromTrueAddProps1BoxedMap(validate(arg, configuration)); - } - @Override - public ReqPropsFromTrueAddProps1Boxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { - 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"); - } - } - -} diff --git a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/schemas/ReqPropsFromUnsetAddProps.kt b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/schemas/ReqPropsFromUnsetAddProps.kt deleted file mode 100644 index ef600c19648..00000000000 --- a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/schemas/ReqPropsFromUnsetAddProps.kt +++ /dev/null @@ -1,340 +0,0 @@ -package org.openapijsonschematools.client.components.schemas; -import java.util.ArrayList; -import java.util.HashSet; -import java.util.LinkedHashMap; -import java.util.LinkedHashSet; -import java.util.List; -import java.util.Map; -import java.util.Objects; -import java.util.Set; -import org.checkerframework.checker.nullness.qual.Nullable; -import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags; -import org.openapijsonschematools.client.configurations.SchemaConfiguration; -import org.openapijsonschematools.client.exceptions.InvalidAdditionalPropertyException; -import org.openapijsonschematools.client.exceptions.UnsetPropertyException; -import org.openapijsonschematools.client.exceptions.ValidationException; -import org.openapijsonschematools.client.schemas.GenericBuilder; -import org.openapijsonschematools.client.schemas.UnsetAddPropsSetter; -import org.openapijsonschematools.client.schemas.validation.FrozenMap; -import org.openapijsonschematools.client.schemas.validation.JsonSchema; -import org.openapijsonschematools.client.schemas.validation.JsonSchemaInfo; -import org.openapijsonschematools.client.schemas.validation.MapSchemaValidator; -import org.openapijsonschematools.client.schemas.validation.PathToSchemasMap; -import org.openapijsonschematools.client.schemas.validation.ValidationMetadata; - -public class ReqPropsFromUnsetAddProps { - // nest classes so all schemas and input/output classes can be public - - - public static class ReqPropsFromUnsetAddPropsMap extends FrozenMap<@Nullable Object> { - protected ReqPropsFromUnsetAddPropsMap(FrozenMap<@Nullable Object> m) { - super(m); - } - public static final Set requiredKeys = Set.of( - "invalid-name", - "validName" - ); - public static final Set optionalKeys = Set.of(); - public static ReqPropsFromUnsetAddPropsMap of(Map arg, SchemaConfiguration configuration) throws ValidationException { - return ReqPropsFromUnsetAddProps1.getInstance().validate(arg, configuration); - } - - public @Nullable Object validName() { - try { - return getOrThrow("version"); - } catch (UnsetPropertyException e) { - throw new RuntimeException(e); - } - } - - public @Nullable Object getAdditionalProperty(String name) throws UnsetPropertyException, InvalidAdditionalPropertyException { - throwIfKeyKnown(name, requiredKeys, optionalKeys); - throwIfKeyNotPresent(name); - return get(name); - } - } - - public interface SetterForInvalidname { - Map getInstance(); - T getBuilderAfterInvalidname(Map instance); - - default T invalidHyphenMinusName(Nothing? value) { - var instance = getInstance(); - instance.put("invalid-name", null); - return getBuilderAfterInvalidname(instance); - } - - default T invalidHyphenMinusName(boolean value) { - var instance = getInstance(); - instance.put("invalid-name", value); - return getBuilderAfterInvalidname(instance); - } - - default T invalidHyphenMinusName(String value) { - var instance = getInstance(); - instance.put("invalid-name", value); - return getBuilderAfterInvalidname(instance); - } - - default T invalidHyphenMinusName(int value) { - var instance = getInstance(); - instance.put("invalid-name", value); - return getBuilderAfterInvalidname(instance); - } - - default T invalidHyphenMinusName(float value) { - var instance = getInstance(); - instance.put("invalid-name", value); - return getBuilderAfterInvalidname(instance); - } - - default T invalidHyphenMinusName(long value) { - var instance = getInstance(); - instance.put("invalid-name", value); - return getBuilderAfterInvalidname(instance); - } - - default T invalidHyphenMinusName(double value) { - var instance = getInstance(); - instance.put("invalid-name", value); - return getBuilderAfterInvalidname(instance); - } - - default T invalidHyphenMinusName(List value) { - var instance = getInstance(); - instance.put("invalid-name", value); - return getBuilderAfterInvalidname(instance); - } - - default T invalidHyphenMinusName(Map value) { - var instance = getInstance(); - instance.put("invalid-name", value); - return getBuilderAfterInvalidname(instance); - } - } - - public interface SetterForValidName { - Map getInstance(); - T getBuilderAfterValidName(Map instance); - - default T validName(Nothing? value) { - var instance = getInstance(); - instance.put("validName", null); - return getBuilderAfterValidName(instance); - } - - default T validName(boolean value) { - var instance = getInstance(); - instance.put("validName", value); - return getBuilderAfterValidName(instance); - } - - default T validName(String value) { - var instance = getInstance(); - instance.put("validName", value); - return getBuilderAfterValidName(instance); - } - - default T validName(int value) { - var instance = getInstance(); - instance.put("validName", value); - return getBuilderAfterValidName(instance); - } - - default T validName(float value) { - var instance = getInstance(); - instance.put("validName", value); - return getBuilderAfterValidName(instance); - } - - default T validName(long value) { - var instance = getInstance(); - instance.put("validName", value); - return getBuilderAfterValidName(instance); - } - - default T validName(double value) { - var instance = getInstance(); - instance.put("validName", value); - return getBuilderAfterValidName(instance); - } - - default T validName(List value) { - var instance = getInstance(); - instance.put("validName", value); - return getBuilderAfterValidName(instance); - } - - default T validName(Map value) { - var instance = getInstance(); - instance.put("validName", value); - return getBuilderAfterValidName(instance); - } - } - - public static class ReqPropsFromUnsetAddPropsMap00Builder extends UnsetAddPropsSetter implements GenericBuilder> { - private final Map instance; - private static final Set knownKeys = Set.of( - "invalid-name", - "validName" - ); - public Set getKnownKeys() { - return knownKeys; - } - public ReqPropsFromUnsetAddPropsMap00Builder(Map instance) { - this.instance = instance; - } - public Map build() { - return instance; - } - public Map getInstance() { - return instance; - } - public ReqPropsFromUnsetAddPropsMap00Builder getBuilderAfterAdditionalProperty(Map instance) { - return this; - } - } - - public static class ReqPropsFromUnsetAddPropsMap01Builder implements SetterForValidName { - private final Map instance; - public ReqPropsFromUnsetAddPropsMap01Builder(Map instance) { - this.instance = instance; - } - public Map getInstance() { - return instance; - } - public ReqPropsFromUnsetAddPropsMap00Builder getBuilderAfterValidName(Map instance) { - return new ReqPropsFromUnsetAddPropsMap00Builder(instance); - } - } - - public static class ReqPropsFromUnsetAddPropsMap10Builder implements SetterForInvalidname { - private final Map instance; - public ReqPropsFromUnsetAddPropsMap10Builder(Map instance) { - this.instance = instance; - } - public Map getInstance() { - return instance; - } - public ReqPropsFromUnsetAddPropsMap00Builder getBuilderAfterInvalidname(Map instance) { - return new ReqPropsFromUnsetAddPropsMap00Builder(instance); - } - } - - public static class ReqPropsFromUnsetAddPropsMapBuilder implements SetterForInvalidname, SetterForValidName { - private final Map instance; - public ReqPropsFromUnsetAddPropsMapBuilder() { - this.instance = new LinkedHashMap<>(); - } - public Map getInstance() { - return instance; - } - public ReqPropsFromUnsetAddPropsMap01Builder getBuilderAfterInvalidname(Map instance) { - return new ReqPropsFromUnsetAddPropsMap01Builder(instance); - } - public ReqPropsFromUnsetAddPropsMap10Builder getBuilderAfterValidName(Map instance) { - return new ReqPropsFromUnsetAddPropsMap10Builder(instance); - } - } - - - public sealed interface ReqPropsFromUnsetAddProps1Boxed permits ReqPropsFromUnsetAddProps1BoxedMap { - @Nullable Object getData(); - } - - public record ReqPropsFromUnsetAddProps1BoxedMap(ReqPropsFromUnsetAddPropsMap data) implements ReqPropsFromUnsetAddProps1Boxed { - @Override - public @Nullable Object getData() { - return data; - } - } - - - public static class ReqPropsFromUnsetAddProps1 extends JsonSchema implements MapSchemaValidator { - /* - NOTE: This class is auto generated by OpenAPI JSON Schema Generator. - Ref: https://github.com/openapi-json-schema-tools/openapi-json-schema-generator - - Do not edit the class manually. - */ - private static @Nullable ReqPropsFromUnsetAddProps1 instance = null; - - protected ReqPropsFromUnsetAddProps1() { - super(new JsonSchemaInfo() - .type(Set.of(Map.class)) - .required(Set.of( - "invalid-name", - "validName" - )) - ); - } - - public static ReqPropsFromUnsetAddProps1 getInstance() { - if (instance == null) { - instance = new ReqPropsFromUnsetAddProps1(); - } - return instance; - } - - 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 RuntimeException("Invalid non-string key value"); - } - String propertyName = (String) entryKey; - List propertyPathToItem = new ArrayList<>(pathToItem); - propertyPathToItem.add(propertyName); - Object value = entry.getValue(); - LinkedHashMap, Nothing?> schemas = pathToSchemas.get(propertyPathToItem); - if (schemas == null) { - throw new RuntimeException("Validation result is invalid, schemas must exist for a pathToItem"); - } - JsonSchema propertySchema = schemas.entrySet().iterator().next().getKey(); - @Nullable Object propertyInstance = propertySchema.getNewInstance(value, propertyPathToItem, pathToSchemas); - properties.put(propertyName, propertyInstance); - } - FrozenMap<@Nullable Object> castProperties = new FrozenMap<>(properties); - return new ReqPropsFromUnsetAddPropsMap(castProperties); - } - - 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); - SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().build())); - ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, new PathToSchemasMap(), new LinkedHashSet<>()); - PathToSchemasMap pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet); - return getNewInstance(castArg, validationMetadata.pathToItem(), pathToSchemasMap); - } - - - @Override - public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws 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"); - } - @Override - public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { - if (arg instanceof Map) { - return getNewInstance((Map) arg, pathToItem, pathToSchemas); - } - 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 { - return new ReqPropsFromUnsetAddProps1BoxedMap(validate(arg, configuration)); - } - @Override - public ReqPropsFromUnsetAddProps1Boxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { - 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"); - } - } - -} diff --git a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/schemas/ReturnSchema.kt b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/schemas/ReturnSchema.kt deleted file mode 100644 index b4bbc31a404..00000000000 --- a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/schemas/ReturnSchema.kt +++ /dev/null @@ -1,407 +0,0 @@ -package org.openapijsonschematools.client.components.schemas; -import java.time.LocalDate; -import java.time.ZonedDateTime; -import java.util.ArrayList; -import java.util.HashSet; -import java.util.LinkedHashMap; -import java.util.LinkedHashSet; -import java.util.List; -import java.util.Map; -import java.util.Objects; -import java.util.Set; -import java.util.UUID; -import org.checkerframework.checker.nullness.qual.Nullable; -import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags; -import org.openapijsonschematools.client.configurations.SchemaConfiguration; -import org.openapijsonschematools.client.exceptions.InvalidAdditionalPropertyException; -import org.openapijsonschematools.client.exceptions.UnsetPropertyException; -import org.openapijsonschematools.client.exceptions.ValidationException; -import org.openapijsonschematools.client.schemas.GenericBuilder; -import org.openapijsonschematools.client.schemas.Int32JsonSchema; -import org.openapijsonschematools.client.schemas.UnsetAddPropsSetter; -import org.openapijsonschematools.client.schemas.validation.BooleanSchemaValidator; -import org.openapijsonschematools.client.schemas.validation.FrozenList; -import org.openapijsonschematools.client.schemas.validation.FrozenMap; -import org.openapijsonschematools.client.schemas.validation.JsonSchema; -import org.openapijsonschematools.client.schemas.validation.JsonSchemaInfo; -import org.openapijsonschematools.client.schemas.validation.ListSchemaValidator; -import org.openapijsonschematools.client.schemas.validation.MapSchemaValidator; -import org.openapijsonschematools.client.schemas.validation.NullSchemaValidator; -import org.openapijsonschematools.client.schemas.validation.NumberSchemaValidator; -import org.openapijsonschematools.client.schemas.validation.PathToSchemasMap; -import org.openapijsonschematools.client.schemas.validation.PropertyEntry; -import org.openapijsonschematools.client.schemas.validation.StringSchemaValidator; -import org.openapijsonschematools.client.schemas.validation.ValidationMetadata; - -public class ReturnSchema { - // nest classes so all schemas and input/output classes can be public - - - public static class ReturnSchema2 extends Int32JsonSchema.Int32JsonSchema1 { - private static @Nullable ReturnSchema2 instance = null; - public static ReturnSchema2 getInstance() { - if (instance == null) { - instance = new ReturnSchema2(); - } - return instance; - } - } - - - public static class ReturnMap extends FrozenMap<@Nullable Object> { - protected ReturnMap(FrozenMap<@Nullable Object> m) { - super(m); - } - public static final Set requiredKeys = Set.of(); - public static final Set optionalKeys = Set.of( - "return" - ); - public static ReturnMap of(Map arg, SchemaConfiguration configuration) throws ValidationException { - return ReturnSchema1.getInstance().validate(arg, configuration); - } - - public @Nullable Object getAdditionalProperty(String name) throws UnsetPropertyException, InvalidAdditionalPropertyException { - throwIfKeyKnown(name, requiredKeys, optionalKeys); - throwIfKeyNotPresent(name); - return get(name); - } - } - - public interface SetterForReturnSchema2 { - Map getInstance(); - T getBuilderAfterReturnSchema2(Map instance); - - default T setReturn(int value) { - var instance = getInstance(); - instance.put("return", value); - return getBuilderAfterReturnSchema2(instance); - } - - default T setReturn(float value) { - var instance = getInstance(); - instance.put("return", value); - return getBuilderAfterReturnSchema2(instance); - } - } - - public static class ReturnMapBuilder1 extends UnsetAddPropsSetter implements GenericBuilder>, SetterForReturnSchema2 { - private final Map instance; - private static final Set knownKeys = Set.of( - "return" - ); - public Set getKnownKeys() { - return knownKeys; - } - public ReturnMapBuilder1() { - this.instance = new LinkedHashMap<>(); - } - public Map build() { - return instance; - } - public Map getInstance() { - return instance; - } - public ReturnMapBuilder1 getBuilderAfterReturnSchema2(Map instance) { - return this; - } - public ReturnMapBuilder1 getBuilderAfterAdditionalProperty(Map instance) { - return this; - } - } - - - public sealed interface ReturnSchema1Boxed permits ReturnSchema1BoxedVoid, ReturnSchema1BoxedBoolean, ReturnSchema1BoxedNumber, ReturnSchema1BoxedString, ReturnSchema1BoxedList, ReturnSchema1BoxedMap { - @Nullable Object getData(); - } - - public record ReturnSchema1BoxedVoid(Nothing? data) implements ReturnSchema1Boxed { - @Override - public @Nullable Object getData() { - return data; - } - } - - public record ReturnSchema1BoxedBoolean(boolean data) implements ReturnSchema1Boxed { - @Override - public @Nullable Object getData() { - return data; - } - } - - public record ReturnSchema1BoxedNumber(Number data) implements ReturnSchema1Boxed { - @Override - public @Nullable Object getData() { - return data; - } - } - - public record ReturnSchema1BoxedString(String data) implements ReturnSchema1Boxed { - @Override - public @Nullable Object getData() { - return data; - } - } - - public record ReturnSchema1BoxedList(FrozenList<@Nullable Object> data) implements ReturnSchema1Boxed { - @Override - public @Nullable Object getData() { - return data; - } - } - - public record ReturnSchema1BoxedMap(ReturnMap data) implements ReturnSchema1Boxed { - @Override - public @Nullable Object getData() { - return data; - } - } - - - public static class ReturnSchema1 extends JsonSchema implements NullSchemaValidator, BooleanSchemaValidator, NumberSchemaValidator, StringSchemaValidator, ListSchemaValidator, ReturnSchema1BoxedList>, MapSchemaValidator { - /* - NOTE: This class is auto generated by OpenAPI JSON Schema Generator. - Ref: https://github.com/openapi-json-schema-tools/openapi-json-schema-generator - - Do not edit the class manually. - - Model for testing reserved words - */ - private static @Nullable ReturnSchema1 instance = null; - - protected ReturnSchema1() { - super(new JsonSchemaInfo() - .properties(Map.ofEntries( - new PropertyEntry("return", ReturnSchema2.class) - )) - ); - } - - public static ReturnSchema1 getInstance() { - if (instance == null) { - instance = new ReturnSchema1(); - } - return instance; - } - - @Override - public Nothing? validate(Nothing? arg, SchemaConfiguration configuration) throws ValidationException { - Set> pathSet = new HashSet<>(); - List pathToItem = List.of("args[0]"); - Nothing? castArg = castToAllowedTypes(arg, pathToItem, pathSet); - SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().build())); - PathToSchemasMap validatedPathToSchemas = new PathToSchemasMap(); - ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, new LinkedHashSet<>()); - getPathToSchemas(this, castArg, validationMetadata, pathSet); - return castArg; - } - - @Override - public boolean validate(boolean arg, SchemaConfiguration configuration) throws ValidationException { - Set> pathSet = new HashSet<>(); - List pathToItem = List.of("args[0]"); - boolean castArg = castToAllowedTypes(arg, pathToItem, pathSet); - SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().build())); - PathToSchemasMap validatedPathToSchemas = new PathToSchemasMap(); - ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, new LinkedHashSet<>()); - getPathToSchemas(this, castArg, validationMetadata, pathSet); - return castArg; - } - - @Override - public Number validate(Number arg, SchemaConfiguration configuration) throws ValidationException { - Set> pathSet = new HashSet<>(); - List pathToItem = List.of("args[0]"); - Number castArg = castToAllowedTypes(arg, pathToItem, pathSet); - SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().build())); - PathToSchemasMap validatedPathToSchemas = new PathToSchemasMap(); - ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, new LinkedHashSet<>()); - getPathToSchemas(this, castArg, validationMetadata, pathSet); - return castArg; - } - - public int validate(int arg, SchemaConfiguration configuration) throws ValidationException { - return (int) validate((Number) arg, configuration); - } - - public long validate(long arg, SchemaConfiguration configuration) throws ValidationException { - return (long) validate((Number) arg, configuration); - } - - public float validate(float arg, SchemaConfiguration configuration) throws ValidationException { - return (float) validate((Number) arg, configuration); - } - - public double validate(double arg, SchemaConfiguration configuration) throws ValidationException { - return (double) validate((Number) arg, configuration); - } - - @Override - public String validate(String arg, SchemaConfiguration configuration) throws ValidationException { - Set> pathSet = new HashSet<>(); - List pathToItem = List.of("args[0]"); - String castArg = castToAllowedTypes(arg, pathToItem, pathSet); - SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().build())); - PathToSchemasMap validatedPathToSchemas = new PathToSchemasMap(); - ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, new LinkedHashSet<>()); - getPathToSchemas(this, castArg, validationMetadata, pathSet); - return castArg; - } - - public String validate(LocalDate arg, SchemaConfiguration configuration) throws ValidationException { - return validate(arg.toString(), configuration); - } - - public String validate(ZonedDateTime arg, SchemaConfiguration configuration) throws ValidationException { - return validate(arg.toString(), configuration); - } - - public String validate(UUID arg, SchemaConfiguration configuration) throws ValidationException { - return validate(arg.toString(), configuration); - } - - @Override - public FrozenList<@Nullable Object> getNewInstance(List arg, List pathToItem, PathToSchemasMap pathToSchemas) { - List<@Nullable Object> items = new ArrayList<>(); - int i = 0; - for (Object item: arg) { - List itemPathToItem = new ArrayList<>(pathToItem); - itemPathToItem.add(i); - LinkedHashMap, Nothing?> schemas = pathToSchemas.get(itemPathToItem); - if (schemas == null) { - throw new RuntimeException("Validation result is invalid, schemas must exist for a pathToItem"); - } - JsonSchema itemSchema = schemas.entrySet().iterator().next().getKey(); - @Nullable Object itemInstance = itemSchema.getNewInstance(item, itemPathToItem, pathToSchemas); - items.add(itemInstance); - i += 1; - } - FrozenList<@Nullable Object> newInstanceItems = new FrozenList<>(items); - return newInstanceItems; - } - - 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); - SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().build())); - ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, new PathToSchemasMap(), new LinkedHashSet<>()); - PathToSchemasMap pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet); - return getNewInstance(castArg, validationMetadata.pathToItem(), pathToSchemasMap); - } - - @Override - 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 RuntimeException("Invalid non-string key value"); - } - String propertyName = (String) entryKey; - List propertyPathToItem = new ArrayList<>(pathToItem); - propertyPathToItem.add(propertyName); - Object value = entry.getValue(); - LinkedHashMap, Nothing?> schemas = pathToSchemas.get(propertyPathToItem); - if (schemas == null) { - throw new RuntimeException("Validation result is invalid, schemas must exist for a pathToItem"); - } - JsonSchema propertySchema = schemas.entrySet().iterator().next().getKey(); - @Nullable Object propertyInstance = propertySchema.getNewInstance(value, propertyPathToItem, pathToSchemas); - properties.put(propertyName, propertyInstance); - } - FrozenMap<@Nullable Object> castProperties = new FrozenMap<>(properties); - return new ReturnMap(castProperties); - } - - 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); - SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().build())); - PathToSchemasMap validatedPathToSchemas = new PathToSchemasMap(); - ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, new LinkedHashSet<>()); - PathToSchemasMap pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet); - return getNewInstance(castArg, validationMetadata.pathToItem(), pathToSchemasMap); - } - - @Override - public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { - if (arg == null) { - return validate((Nothing?) null, configuration); - } else if (arg instanceof Boolean) { - boolean boolArg = (Boolean) arg; - return validate(boolArg, configuration); - } else if (arg instanceof Number) { - return validate((Number) arg, configuration); - } else if (arg instanceof String) { - return validate((String) arg, configuration); - } else if (arg instanceof List) { - return validate((List) arg, 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"); - } - @Override - public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { - if (arg == null) { - return getNewInstance((Nothing?) null, pathToItem, pathToSchemas); - } else if (arg instanceof Boolean) { - boolean boolArg = (Boolean) arg; - return getNewInstance(boolArg, pathToItem, pathToSchemas); - } else if (arg instanceof Number) { - return getNewInstance((Number) arg, pathToItem, pathToSchemas); - } else if (arg instanceof String) { - return getNewInstance((String) arg, pathToItem, pathToSchemas); - } else if (arg instanceof List) { - return getNewInstance((List) arg, 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"); - } - @Override - public ReturnSchema1BoxedVoid validateAndBox(Nothing? arg, SchemaConfiguration configuration) throws ValidationException { - return new ReturnSchema1BoxedVoid(validate(arg, configuration)); - } - @Override - 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 { - return new ReturnSchema1BoxedNumber(validate(arg, configuration)); - } - @Override - 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 { - return new ReturnSchema1BoxedList(validate(arg, configuration)); - } - @Override - 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 { - if (arg == null) { - Nothing? castArg = (Nothing?) arg; - return validateAndBox(castArg, configuration); - } else if (arg instanceof Boolean booleanArg) { - boolean castArg = booleanArg; - return validateAndBox(castArg, configuration); - } else if (arg instanceof String castArg) { - return validateAndBox(castArg, configuration); - } else if (arg instanceof Number castArg) { - return validateAndBox(castArg, configuration); - } else if (arg instanceof List castArg) { - 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"); - } - } -} diff --git a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/schemas/ScaleneTriangle.kt b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/schemas/ScaleneTriangle.kt deleted file mode 100644 index b8da956f796..00000000000 --- a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/schemas/ScaleneTriangle.kt +++ /dev/null @@ -1,589 +0,0 @@ -package org.openapijsonschematools.client.components.schemas; -import java.time.LocalDate; -import java.time.ZonedDateTime; -import java.util.ArrayList; -import java.util.HashSet; -import java.util.LinkedHashMap; -import java.util.LinkedHashSet; -import java.util.List; -import java.util.Map; -import java.util.Objects; -import java.util.Set; -import java.util.UUID; -import org.checkerframework.checker.nullness.qual.Nullable; -import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags; -import org.openapijsonschematools.client.configurations.SchemaConfiguration; -import org.openapijsonschematools.client.exceptions.InvalidAdditionalPropertyException; -import org.openapijsonschematools.client.exceptions.UnsetPropertyException; -import org.openapijsonschematools.client.exceptions.ValidationException; -import org.openapijsonschematools.client.schemas.GenericBuilder; -import org.openapijsonschematools.client.schemas.SetMaker; -import org.openapijsonschematools.client.schemas.UnsetAddPropsSetter; -import org.openapijsonschematools.client.schemas.validation.BooleanSchemaValidator; -import org.openapijsonschematools.client.schemas.validation.FrozenList; -import org.openapijsonschematools.client.schemas.validation.FrozenMap; -import org.openapijsonschematools.client.schemas.validation.JsonSchema; -import org.openapijsonschematools.client.schemas.validation.JsonSchemaInfo; -import org.openapijsonschematools.client.schemas.validation.ListSchemaValidator; -import org.openapijsonschematools.client.schemas.validation.MapSchemaValidator; -import org.openapijsonschematools.client.schemas.validation.NullSchemaValidator; -import org.openapijsonschematools.client.schemas.validation.NumberSchemaValidator; -import org.openapijsonschematools.client.schemas.validation.PathToSchemasMap; -import org.openapijsonschematools.client.schemas.validation.PropertyEntry; -import org.openapijsonschematools.client.schemas.validation.StringEnumValidator; -import org.openapijsonschematools.client.schemas.validation.StringSchemaValidator; -import org.openapijsonschematools.client.schemas.validation.StringValueMethod; -import org.openapijsonschematools.client.schemas.validation.ValidationMetadata; - -public class ScaleneTriangle { - // nest classes so all schemas and input/output classes can be public - - public enum StringTriangleTypeEnums implements StringValueMethod { - SCALENE_TRIANGLE("ScaleneTriangle"); - private final String value; - - StringTriangleTypeEnums(String value) { - this.value = value; - } - public String value() { - return this.value; - } - } - - - public sealed interface TriangleTypeBoxed permits TriangleTypeBoxedString { - @Nullable Object getData(); - } - - public record TriangleTypeBoxedString(String data) implements TriangleTypeBoxed { - @Override - public @Nullable Object getData() { - return data; - } - } - - - - public static class TriangleType extends JsonSchema implements StringSchemaValidator, StringEnumValidator { - private static @Nullable TriangleType instance = null; - - protected TriangleType() { - super(new JsonSchemaInfo() - .type(Set.of( - String.class - )) - .enumValues(SetMaker.makeSet( - "ScaleneTriangle" - )) - ); - } - - public static TriangleType getInstance() { - if (instance == null) { - instance = new TriangleType(); - } - return instance; - } - - @Override - public String validate(String arg, SchemaConfiguration configuration) throws ValidationException { - Set> pathSet = new HashSet<>(); - List pathToItem = List.of("args[0"); - String castArg = castToAllowedTypes(arg, pathToItem, pathSet); - SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().build())); - ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, new PathToSchemasMap(), new LinkedHashSet<>()); - getPathToSchemas(this, castArg, validationMetadata, pathSet); - return castArg; - } - - @Override - 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 { - 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"); - } - @Override - public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { - 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"); - } - @Override - 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 { - 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"); - } - } - - public static class Schema1Map extends FrozenMap<@Nullable Object> { - protected Schema1Map(FrozenMap<@Nullable Object> m) { - super(m); - } - public static final Set requiredKeys = Set.of(); - public static final Set optionalKeys = Set.of( - "triangleType" - ); - public static Schema1Map of(Map arg, SchemaConfiguration configuration) throws ValidationException { - return Schema1.getInstance().validate(arg, configuration); - } - - public String triangleType() throws UnsetPropertyException { - String key = "triangleType"; - throwIfKeyNotPresent(key); - @Nullable Object value = get(key); - if (!(value instanceof String)) { - throw new RuntimeException("Invalid value stored for triangleType"); - } - return (String) value; - } - - public @Nullable Object getAdditionalProperty(String name) throws UnsetPropertyException, InvalidAdditionalPropertyException { - throwIfKeyKnown(name, requiredKeys, optionalKeys); - throwIfKeyNotPresent(name); - return get(name); - } - } - - public interface SetterForTriangleType { - Map getInstance(); - T getBuilderAfterTriangleType(Map instance); - - default T triangleType(String value) { - var instance = getInstance(); - instance.put("triangleType", value); - return getBuilderAfterTriangleType(instance); - } - - default T triangleType(StringTriangleTypeEnums value) { - var instance = getInstance(); - instance.put("triangleType", value.value()); - return getBuilderAfterTriangleType(instance); - } - } - - public static class Schema1MapBuilder extends UnsetAddPropsSetter implements GenericBuilder>, SetterForTriangleType { - private final Map instance; - private static final Set knownKeys = Set.of( - "triangleType" - ); - public Set getKnownKeys() { - return knownKeys; - } - public Schema1MapBuilder() { - this.instance = new LinkedHashMap<>(); - } - public Map build() { - return instance; - } - public Map getInstance() { - return instance; - } - public Schema1MapBuilder getBuilderAfterTriangleType(Map instance) { - return this; - } - public Schema1MapBuilder getBuilderAfterAdditionalProperty(Map instance) { - return this; - } - } - - - public sealed interface Schema1Boxed permits Schema1BoxedMap { - @Nullable Object getData(); - } - - public record Schema1BoxedMap(Schema1Map data) implements Schema1Boxed { - @Override - public @Nullable Object getData() { - return data; - } - } - - - public static class Schema1 extends JsonSchema implements MapSchemaValidator { - private static @Nullable Schema1 instance = null; - - protected Schema1() { - super(new JsonSchemaInfo() - .type(Set.of(Map.class)) - .properties(Map.ofEntries( - new PropertyEntry("triangleType", TriangleType.class) - )) - ); - } - - public static Schema1 getInstance() { - if (instance == null) { - instance = new Schema1(); - } - return instance; - } - - 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 RuntimeException("Invalid non-string key value"); - } - String propertyName = (String) entryKey; - List propertyPathToItem = new ArrayList<>(pathToItem); - propertyPathToItem.add(propertyName); - Object value = entry.getValue(); - LinkedHashMap, Nothing?> schemas = pathToSchemas.get(propertyPathToItem); - if (schemas == null) { - throw new RuntimeException("Validation result is invalid, schemas must exist for a pathToItem"); - } - JsonSchema propertySchema = schemas.entrySet().iterator().next().getKey(); - @Nullable Object propertyInstance = propertySchema.getNewInstance(value, propertyPathToItem, pathToSchemas); - properties.put(propertyName, propertyInstance); - } - FrozenMap<@Nullable Object> castProperties = new FrozenMap<>(properties); - return new Schema1Map(castProperties); - } - - 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); - SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().build())); - ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, new PathToSchemasMap(), new LinkedHashSet<>()); - PathToSchemasMap pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet); - return getNewInstance(castArg, validationMetadata.pathToItem(), pathToSchemasMap); - } - - - @Override - public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws 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"); - } - @Override - public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { - if (arg instanceof Map) { - return getNewInstance((Map) arg, pathToItem, pathToSchemas); - } - 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 { - return new Schema1BoxedMap(validate(arg, configuration)); - } - @Override - public Schema1Boxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { - 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"); - } - } - - - public sealed interface ScaleneTriangle1Boxed permits ScaleneTriangle1BoxedVoid, ScaleneTriangle1BoxedBoolean, ScaleneTriangle1BoxedNumber, ScaleneTriangle1BoxedString, ScaleneTriangle1BoxedList, ScaleneTriangle1BoxedMap { - @Nullable Object getData(); - } - - public record ScaleneTriangle1BoxedVoid(Nothing? data) implements ScaleneTriangle1Boxed { - @Override - public @Nullable Object getData() { - return data; - } - } - - public record ScaleneTriangle1BoxedBoolean(boolean data) implements ScaleneTriangle1Boxed { - @Override - public @Nullable Object getData() { - return data; - } - } - - public record ScaleneTriangle1BoxedNumber(Number data) implements ScaleneTriangle1Boxed { - @Override - public @Nullable Object getData() { - return data; - } - } - - public record ScaleneTriangle1BoxedString(String data) implements ScaleneTriangle1Boxed { - @Override - public @Nullable Object getData() { - return data; - } - } - - public record ScaleneTriangle1BoxedList(FrozenList<@Nullable Object> data) implements ScaleneTriangle1Boxed { - @Override - public @Nullable Object getData() { - return data; - } - } - - public record ScaleneTriangle1BoxedMap(FrozenMap<@Nullable Object> data) implements ScaleneTriangle1Boxed { - @Override - public @Nullable Object getData() { - return data; - } - } - - - public static class ScaleneTriangle1 extends JsonSchema implements NullSchemaValidator, BooleanSchemaValidator, NumberSchemaValidator, StringSchemaValidator, ListSchemaValidator, ScaleneTriangle1BoxedList>, MapSchemaValidator, ScaleneTriangle1BoxedMap> { - /* - NOTE: This class is auto generated by OpenAPI JSON Schema Generator. - Ref: https://github.com/openapi-json-schema-tools/openapi-json-schema-generator - - Do not edit the class manually. - */ - private static @Nullable ScaleneTriangle1 instance = null; - - protected ScaleneTriangle1() { - super(new JsonSchemaInfo() - .allOf(List.of( - TriangleInterface.TriangleInterface1.class, - Schema1.class - )) - ); - } - - public static ScaleneTriangle1 getInstance() { - if (instance == null) { - instance = new ScaleneTriangle1(); - } - return instance; - } - - @Override - public Nothing? validate(Nothing? arg, SchemaConfiguration configuration) throws ValidationException { - Set> pathSet = new HashSet<>(); - List pathToItem = List.of("args[0]"); - Nothing? castArg = castToAllowedTypes(arg, pathToItem, pathSet); - SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().build())); - PathToSchemasMap validatedPathToSchemas = new PathToSchemasMap(); - ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, new LinkedHashSet<>()); - getPathToSchemas(this, castArg, validationMetadata, pathSet); - return castArg; - } - - @Override - public boolean validate(boolean arg, SchemaConfiguration configuration) throws ValidationException { - Set> pathSet = new HashSet<>(); - List pathToItem = List.of("args[0]"); - boolean castArg = castToAllowedTypes(arg, pathToItem, pathSet); - SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().build())); - PathToSchemasMap validatedPathToSchemas = new PathToSchemasMap(); - ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, new LinkedHashSet<>()); - getPathToSchemas(this, castArg, validationMetadata, pathSet); - return castArg; - } - - @Override - public Number validate(Number arg, SchemaConfiguration configuration) throws ValidationException { - Set> pathSet = new HashSet<>(); - List pathToItem = List.of("args[0]"); - Number castArg = castToAllowedTypes(arg, pathToItem, pathSet); - SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().build())); - PathToSchemasMap validatedPathToSchemas = new PathToSchemasMap(); - ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, new LinkedHashSet<>()); - getPathToSchemas(this, castArg, validationMetadata, pathSet); - return castArg; - } - - public int validate(int arg, SchemaConfiguration configuration) throws ValidationException { - return (int) validate((Number) arg, configuration); - } - - public long validate(long arg, SchemaConfiguration configuration) throws ValidationException { - return (long) validate((Number) arg, configuration); - } - - public float validate(float arg, SchemaConfiguration configuration) throws ValidationException { - return (float) validate((Number) arg, configuration); - } - - public double validate(double arg, SchemaConfiguration configuration) throws ValidationException { - return (double) validate((Number) arg, configuration); - } - - @Override - public String validate(String arg, SchemaConfiguration configuration) throws ValidationException { - Set> pathSet = new HashSet<>(); - List pathToItem = List.of("args[0]"); - String castArg = castToAllowedTypes(arg, pathToItem, pathSet); - SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().build())); - PathToSchemasMap validatedPathToSchemas = new PathToSchemasMap(); - ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, new LinkedHashSet<>()); - getPathToSchemas(this, castArg, validationMetadata, pathSet); - return castArg; - } - - public String validate(LocalDate arg, SchemaConfiguration configuration) throws ValidationException { - return validate(arg.toString(), configuration); - } - - public String validate(ZonedDateTime arg, SchemaConfiguration configuration) throws ValidationException { - return validate(arg.toString(), configuration); - } - - public String validate(UUID arg, SchemaConfiguration configuration) throws ValidationException { - return validate(arg.toString(), configuration); - } - - @Override - public FrozenList<@Nullable Object> getNewInstance(List arg, List pathToItem, PathToSchemasMap pathToSchemas) { - List<@Nullable Object> items = new ArrayList<>(); - int i = 0; - for (Object item: arg) { - List itemPathToItem = new ArrayList<>(pathToItem); - itemPathToItem.add(i); - LinkedHashMap, Nothing?> schemas = pathToSchemas.get(itemPathToItem); - if (schemas == null) { - throw new RuntimeException("Validation result is invalid, schemas must exist for a pathToItem"); - } - JsonSchema itemSchema = schemas.entrySet().iterator().next().getKey(); - @Nullable Object itemInstance = itemSchema.getNewInstance(item, itemPathToItem, pathToSchemas); - items.add(itemInstance); - i += 1; - } - FrozenList<@Nullable Object> newInstanceItems = new FrozenList<>(items); - return newInstanceItems; - } - - 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); - SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().build())); - ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, new PathToSchemasMap(), new LinkedHashSet<>()); - PathToSchemasMap pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet); - return getNewInstance(castArg, validationMetadata.pathToItem(), pathToSchemasMap); - } - - @Override - 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 RuntimeException("Invalid non-string key value"); - } - String propertyName = (String) entryKey; - List propertyPathToItem = new ArrayList<>(pathToItem); - propertyPathToItem.add(propertyName); - Object value = entry.getValue(); - LinkedHashMap, Nothing?> schemas = pathToSchemas.get(propertyPathToItem); - if (schemas == null) { - throw new RuntimeException("Validation result is invalid, schemas must exist for a pathToItem"); - } - JsonSchema propertySchema = schemas.entrySet().iterator().next().getKey(); - @Nullable Object propertyInstance = propertySchema.getNewInstance(value, propertyPathToItem, pathToSchemas); - properties.put(propertyName, propertyInstance); - } - FrozenMap<@Nullable Object> castProperties = new FrozenMap<>(properties); - return castProperties; - } - - public FrozenMap<@Nullable Object> validate(Map arg, SchemaConfiguration configuration) throws ValidationException { - Set> pathSet = new HashSet<>(); - List pathToItem = List.of("args[0]"); - Map castArg = castToAllowedTypes(arg, pathToItem, pathSet); - SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().build())); - PathToSchemasMap validatedPathToSchemas = new PathToSchemasMap(); - ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, new LinkedHashSet<>()); - PathToSchemasMap pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet); - return getNewInstance(castArg, validationMetadata.pathToItem(), pathToSchemasMap); - } - - @Override - public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { - if (arg == null) { - return validate((Nothing?) null, configuration); - } else if (arg instanceof Boolean) { - boolean boolArg = (Boolean) arg; - return validate(boolArg, configuration); - } else if (arg instanceof Number) { - return validate((Number) arg, configuration); - } else if (arg instanceof String) { - return validate((String) arg, configuration); - } else if (arg instanceof List) { - return validate((List) arg, 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"); - } - @Override - public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { - if (arg == null) { - return getNewInstance((Nothing?) null, pathToItem, pathToSchemas); - } else if (arg instanceof Boolean) { - boolean boolArg = (Boolean) arg; - return getNewInstance(boolArg, pathToItem, pathToSchemas); - } else if (arg instanceof Number) { - return getNewInstance((Number) arg, pathToItem, pathToSchemas); - } else if (arg instanceof String) { - return getNewInstance((String) arg, pathToItem, pathToSchemas); - } else if (arg instanceof List) { - return getNewInstance((List) arg, 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"); - } - @Override - public ScaleneTriangle1BoxedVoid validateAndBox(Nothing? arg, SchemaConfiguration configuration) throws ValidationException { - return new ScaleneTriangle1BoxedVoid(validate(arg, configuration)); - } - @Override - 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 { - return new ScaleneTriangle1BoxedNumber(validate(arg, configuration)); - } - @Override - 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 { - return new ScaleneTriangle1BoxedList(validate(arg, configuration)); - } - @Override - 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 { - if (arg == null) { - Nothing? castArg = (Nothing?) arg; - return validateAndBox(castArg, configuration); - } else if (arg instanceof Boolean booleanArg) { - boolean castArg = booleanArg; - return validateAndBox(castArg, configuration); - } else if (arg instanceof String castArg) { - return validateAndBox(castArg, configuration); - } else if (arg instanceof Number castArg) { - return validateAndBox(castArg, configuration); - } else if (arg instanceof List castArg) { - 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"); - } - } -} diff --git a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/schemas/Schema200Response.kt b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/schemas/Schema200Response.kt deleted file mode 100644 index 0098c952421..00000000000 --- a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/schemas/Schema200Response.kt +++ /dev/null @@ -1,446 +0,0 @@ -package org.openapijsonschematools.client.components.schemas; -import java.time.LocalDate; -import java.time.ZonedDateTime; -import java.util.ArrayList; -import java.util.HashSet; -import java.util.LinkedHashMap; -import java.util.LinkedHashSet; -import java.util.List; -import java.util.Map; -import java.util.Objects; -import java.util.Set; -import java.util.UUID; -import org.checkerframework.checker.nullness.qual.Nullable; -import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags; -import org.openapijsonschematools.client.configurations.SchemaConfiguration; -import org.openapijsonschematools.client.exceptions.InvalidAdditionalPropertyException; -import org.openapijsonschematools.client.exceptions.UnsetPropertyException; -import org.openapijsonschematools.client.exceptions.ValidationException; -import org.openapijsonschematools.client.schemas.GenericBuilder; -import org.openapijsonschematools.client.schemas.Int32JsonSchema; -import org.openapijsonschematools.client.schemas.StringJsonSchema; -import org.openapijsonschematools.client.schemas.UnsetAddPropsSetter; -import org.openapijsonschematools.client.schemas.validation.BooleanSchemaValidator; -import org.openapijsonschematools.client.schemas.validation.FrozenList; -import org.openapijsonschematools.client.schemas.validation.FrozenMap; -import org.openapijsonschematools.client.schemas.validation.JsonSchema; -import org.openapijsonschematools.client.schemas.validation.JsonSchemaInfo; -import org.openapijsonschematools.client.schemas.validation.ListSchemaValidator; -import org.openapijsonschematools.client.schemas.validation.MapSchemaValidator; -import org.openapijsonschematools.client.schemas.validation.NullSchemaValidator; -import org.openapijsonschematools.client.schemas.validation.NumberSchemaValidator; -import org.openapijsonschematools.client.schemas.validation.PathToSchemasMap; -import org.openapijsonschematools.client.schemas.validation.PropertyEntry; -import org.openapijsonschematools.client.schemas.validation.StringSchemaValidator; -import org.openapijsonschematools.client.schemas.validation.ValidationMetadata; - -public class Schema200Response { - // nest classes so all schemas and input/output classes can be public - - - public static class Name extends Int32JsonSchema.Int32JsonSchema1 { - private static @Nullable Name instance = null; - public static Name getInstance() { - if (instance == null) { - instance = new Name(); - } - return instance; - } - } - - - public static class ClassSchema extends StringJsonSchema.StringJsonSchema1 { - private static @Nullable ClassSchema instance = null; - public static ClassSchema getInstance() { - if (instance == null) { - instance = new ClassSchema(); - } - return instance; - } - } - - - public static class Schema200ResponseMap extends FrozenMap<@Nullable Object> { - protected Schema200ResponseMap(FrozenMap<@Nullable Object> m) { - super(m); - } - public static final Set requiredKeys = Set.of(); - public static final Set optionalKeys = Set.of( - "name", - "class" - ); - public static Schema200ResponseMap of(Map arg, SchemaConfiguration configuration) throws ValidationException { - return Schema200Response1.getInstance().validate(arg, configuration); - } - - public Number name() throws UnsetPropertyException { - String key = "name"; - throwIfKeyNotPresent(key); - @Nullable Object value = get(key); - if (!(value instanceof Number)) { - throw new RuntimeException("Invalid value stored for name"); - } - return (Number) value; - } - - public @Nullable Object getAdditionalProperty(String name) throws UnsetPropertyException, InvalidAdditionalPropertyException { - throwIfKeyKnown(name, requiredKeys, optionalKeys); - throwIfKeyNotPresent(name); - return get(name); - } - } - - public interface SetterForName { - Map getInstance(); - T getBuilderAfterName(Map instance); - - default T name(int value) { - var instance = getInstance(); - instance.put("name", value); - return getBuilderAfterName(instance); - } - - default T name(float value) { - var instance = getInstance(); - instance.put("name", value); - return getBuilderAfterName(instance); - } - } - - public interface SetterForClassSchema { - Map getInstance(); - T getBuilderAfterClassSchema(Map instance); - - default T setClass(String value) { - var instance = getInstance(); - instance.put("class", value); - return getBuilderAfterClassSchema(instance); - } - } - - public static class Schema200ResponseMapBuilder extends UnsetAddPropsSetter implements GenericBuilder>, SetterForName, SetterForClassSchema { - private final Map instance; - private static final Set knownKeys = Set.of( - "name", - "class" - ); - public Set getKnownKeys() { - return knownKeys; - } - public Schema200ResponseMapBuilder() { - this.instance = new LinkedHashMap<>(); - } - public Map build() { - return instance; - } - public Map getInstance() { - return instance; - } - public Schema200ResponseMapBuilder getBuilderAfterName(Map instance) { - return this; - } - public Schema200ResponseMapBuilder getBuilderAfterClassSchema(Map instance) { - return this; - } - public Schema200ResponseMapBuilder getBuilderAfterAdditionalProperty(Map instance) { - return this; - } - } - - - public sealed interface Schema200Response1Boxed permits Schema200Response1BoxedVoid, Schema200Response1BoxedBoolean, Schema200Response1BoxedNumber, Schema200Response1BoxedString, Schema200Response1BoxedList, Schema200Response1BoxedMap { - @Nullable Object getData(); - } - - public record Schema200Response1BoxedVoid(Nothing? data) implements Schema200Response1Boxed { - @Override - public @Nullable Object getData() { - return data; - } - } - - public record Schema200Response1BoxedBoolean(boolean data) implements Schema200Response1Boxed { - @Override - public @Nullable Object getData() { - return data; - } - } - - public record Schema200Response1BoxedNumber(Number data) implements Schema200Response1Boxed { - @Override - public @Nullable Object getData() { - return data; - } - } - - public record Schema200Response1BoxedString(String data) implements Schema200Response1Boxed { - @Override - public @Nullable Object getData() { - return data; - } - } - - public record Schema200Response1BoxedList(FrozenList<@Nullable Object> data) implements Schema200Response1Boxed { - @Override - public @Nullable Object getData() { - return data; - } - } - - public record Schema200Response1BoxedMap(Schema200ResponseMap data) implements Schema200Response1Boxed { - @Override - public @Nullable Object getData() { - return data; - } - } - - - public static class Schema200Response1 extends JsonSchema implements NullSchemaValidator, BooleanSchemaValidator, NumberSchemaValidator, StringSchemaValidator, ListSchemaValidator, Schema200Response1BoxedList>, MapSchemaValidator { - /* - NOTE: This class is auto generated by OpenAPI JSON Schema Generator. - Ref: https://github.com/openapi-json-schema-tools/openapi-json-schema-generator - - Do not edit the class manually. - - model with an invalid class name for python, starts with a number - */ - private static @Nullable Schema200Response1 instance = null; - - protected Schema200Response1() { - super(new JsonSchemaInfo() - .properties(Map.ofEntries( - new PropertyEntry("name", Name.class), - new PropertyEntry("class", ClassSchema.class) - )) - ); - } - - public static Schema200Response1 getInstance() { - if (instance == null) { - instance = new Schema200Response1(); - } - return instance; - } - - @Override - public Nothing? validate(Nothing? arg, SchemaConfiguration configuration) throws ValidationException { - Set> pathSet = new HashSet<>(); - List pathToItem = List.of("args[0]"); - Nothing? castArg = castToAllowedTypes(arg, pathToItem, pathSet); - SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().build())); - PathToSchemasMap validatedPathToSchemas = new PathToSchemasMap(); - ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, new LinkedHashSet<>()); - getPathToSchemas(this, castArg, validationMetadata, pathSet); - return castArg; - } - - @Override - public boolean validate(boolean arg, SchemaConfiguration configuration) throws ValidationException { - Set> pathSet = new HashSet<>(); - List pathToItem = List.of("args[0]"); - boolean castArg = castToAllowedTypes(arg, pathToItem, pathSet); - SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().build())); - PathToSchemasMap validatedPathToSchemas = new PathToSchemasMap(); - ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, new LinkedHashSet<>()); - getPathToSchemas(this, castArg, validationMetadata, pathSet); - return castArg; - } - - @Override - public Number validate(Number arg, SchemaConfiguration configuration) throws ValidationException { - Set> pathSet = new HashSet<>(); - List pathToItem = List.of("args[0]"); - Number castArg = castToAllowedTypes(arg, pathToItem, pathSet); - SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().build())); - PathToSchemasMap validatedPathToSchemas = new PathToSchemasMap(); - ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, new LinkedHashSet<>()); - getPathToSchemas(this, castArg, validationMetadata, pathSet); - return castArg; - } - - public int validate(int arg, SchemaConfiguration configuration) throws ValidationException { - return (int) validate((Number) arg, configuration); - } - - public long validate(long arg, SchemaConfiguration configuration) throws ValidationException { - return (long) validate((Number) arg, configuration); - } - - public float validate(float arg, SchemaConfiguration configuration) throws ValidationException { - return (float) validate((Number) arg, configuration); - } - - public double validate(double arg, SchemaConfiguration configuration) throws ValidationException { - return (double) validate((Number) arg, configuration); - } - - @Override - public String validate(String arg, SchemaConfiguration configuration) throws ValidationException { - Set> pathSet = new HashSet<>(); - List pathToItem = List.of("args[0]"); - String castArg = castToAllowedTypes(arg, pathToItem, pathSet); - SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().build())); - PathToSchemasMap validatedPathToSchemas = new PathToSchemasMap(); - ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, new LinkedHashSet<>()); - getPathToSchemas(this, castArg, validationMetadata, pathSet); - return castArg; - } - - public String validate(LocalDate arg, SchemaConfiguration configuration) throws ValidationException { - return validate(arg.toString(), configuration); - } - - public String validate(ZonedDateTime arg, SchemaConfiguration configuration) throws ValidationException { - return validate(arg.toString(), configuration); - } - - public String validate(UUID arg, SchemaConfiguration configuration) throws ValidationException { - return validate(arg.toString(), configuration); - } - - @Override - public FrozenList<@Nullable Object> getNewInstance(List arg, List pathToItem, PathToSchemasMap pathToSchemas) { - List<@Nullable Object> items = new ArrayList<>(); - int i = 0; - for (Object item: arg) { - List itemPathToItem = new ArrayList<>(pathToItem); - itemPathToItem.add(i); - LinkedHashMap, Nothing?> schemas = pathToSchemas.get(itemPathToItem); - if (schemas == null) { - throw new RuntimeException("Validation result is invalid, schemas must exist for a pathToItem"); - } - JsonSchema itemSchema = schemas.entrySet().iterator().next().getKey(); - @Nullable Object itemInstance = itemSchema.getNewInstance(item, itemPathToItem, pathToSchemas); - items.add(itemInstance); - i += 1; - } - FrozenList<@Nullable Object> newInstanceItems = new FrozenList<>(items); - return newInstanceItems; - } - - 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); - SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().build())); - ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, new PathToSchemasMap(), new LinkedHashSet<>()); - PathToSchemasMap pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet); - return getNewInstance(castArg, validationMetadata.pathToItem(), pathToSchemasMap); - } - - @Override - 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 RuntimeException("Invalid non-string key value"); - } - String propertyName = (String) entryKey; - List propertyPathToItem = new ArrayList<>(pathToItem); - propertyPathToItem.add(propertyName); - Object value = entry.getValue(); - LinkedHashMap, Nothing?> schemas = pathToSchemas.get(propertyPathToItem); - if (schemas == null) { - throw new RuntimeException("Validation result is invalid, schemas must exist for a pathToItem"); - } - JsonSchema propertySchema = schemas.entrySet().iterator().next().getKey(); - @Nullable Object propertyInstance = propertySchema.getNewInstance(value, propertyPathToItem, pathToSchemas); - properties.put(propertyName, propertyInstance); - } - FrozenMap<@Nullable Object> castProperties = new FrozenMap<>(properties); - return new Schema200ResponseMap(castProperties); - } - - 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); - SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().build())); - PathToSchemasMap validatedPathToSchemas = new PathToSchemasMap(); - ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, new LinkedHashSet<>()); - PathToSchemasMap pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet); - return getNewInstance(castArg, validationMetadata.pathToItem(), pathToSchemasMap); - } - - @Override - public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { - if (arg == null) { - return validate((Nothing?) null, configuration); - } else if (arg instanceof Boolean) { - boolean boolArg = (Boolean) arg; - return validate(boolArg, configuration); - } else if (arg instanceof Number) { - return validate((Number) arg, configuration); - } else if (arg instanceof String) { - return validate((String) arg, configuration); - } else if (arg instanceof List) { - return validate((List) arg, 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"); - } - @Override - public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { - if (arg == null) { - return getNewInstance((Nothing?) null, pathToItem, pathToSchemas); - } else if (arg instanceof Boolean) { - boolean boolArg = (Boolean) arg; - return getNewInstance(boolArg, pathToItem, pathToSchemas); - } else if (arg instanceof Number) { - return getNewInstance((Number) arg, pathToItem, pathToSchemas); - } else if (arg instanceof String) { - return getNewInstance((String) arg, pathToItem, pathToSchemas); - } else if (arg instanceof List) { - return getNewInstance((List) arg, 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"); - } - @Override - public Schema200Response1BoxedVoid validateAndBox(Nothing? arg, SchemaConfiguration configuration) throws ValidationException { - return new Schema200Response1BoxedVoid(validate(arg, configuration)); - } - @Override - 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 { - return new Schema200Response1BoxedNumber(validate(arg, configuration)); - } - @Override - 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 { - return new Schema200Response1BoxedList(validate(arg, configuration)); - } - @Override - 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 { - if (arg == null) { - Nothing? castArg = (Nothing?) arg; - return validateAndBox(castArg, configuration); - } else if (arg instanceof Boolean booleanArg) { - boolean castArg = booleanArg; - return validateAndBox(castArg, configuration); - } else if (arg instanceof String castArg) { - return validateAndBox(castArg, configuration); - } else if (arg instanceof Number castArg) { - return validateAndBox(castArg, configuration); - } else if (arg instanceof List castArg) { - 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"); - } - } -} diff --git a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/schemas/SelfReferencingArrayModel.kt b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/schemas/SelfReferencingArrayModel.kt deleted file mode 100644 index b149affb747..00000000000 --- a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/schemas/SelfReferencingArrayModel.kt +++ /dev/null @@ -1,152 +0,0 @@ -package org.openapijsonschematools.client.components.schemas; -import java.util.ArrayList; -import java.util.HashSet; -import java.util.LinkedHashMap; -import java.util.LinkedHashSet; -import java.util.List; -import java.util.Map; -import java.util.Objects; -import java.util.Set; -import org.checkerframework.checker.nullness.qual.Nullable; -import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags; -import org.openapijsonschematools.client.configurations.SchemaConfiguration; -import org.openapijsonschematools.client.exceptions.ValidationException; -import org.openapijsonschematools.client.schemas.validation.FrozenList; -import org.openapijsonschematools.client.schemas.validation.JsonSchema; -import org.openapijsonschematools.client.schemas.validation.JsonSchemaInfo; -import org.openapijsonschematools.client.schemas.validation.ListSchemaValidator; -import org.openapijsonschematools.client.schemas.validation.PathToSchemasMap; -import org.openapijsonschematools.client.schemas.validation.ValidationMetadata; - -public class SelfReferencingArrayModel { - // nest classes so all schemas and input/output classes can be public - - - public static class SelfReferencingArrayModelList extends FrozenList { - protected SelfReferencingArrayModelList(FrozenList m) { - super(m); - } - public static SelfReferencingArrayModelList of(List> arg, SchemaConfiguration configuration) throws ValidationException { - return SelfReferencingArrayModel1.getInstance().validate(arg, configuration); - } - } - - public static class SelfReferencingArrayModelListBuilder { - // class to build List> - private final List> list; - - public SelfReferencingArrayModelListBuilder() { - list = new ArrayList<>(); - } - - public SelfReferencingArrayModelListBuilder(List> list) { - this.list = list; - } - - public SelfReferencingArrayModelListBuilder add(List item) { - list.add(item); - return this; - } - - public List> build() { - return list; - } - } - - - public sealed interface SelfReferencingArrayModel1Boxed permits SelfReferencingArrayModel1BoxedList { - @Nullable Object getData(); - } - - public record SelfReferencingArrayModel1BoxedList(SelfReferencingArrayModelList data) implements SelfReferencingArrayModel1Boxed { - @Override - public @Nullable Object getData() { - return data; - } - } - - - - public static class SelfReferencingArrayModel1 extends JsonSchema implements ListSchemaValidator { - /* - NOTE: This class is auto generated by OpenAPI JSON Schema Generator. - Ref: https://github.com/openapi-json-schema-tools/openapi-json-schema-generator - - Do not edit the class manually. - */ - private static @Nullable SelfReferencingArrayModel1 instance = null; - - protected SelfReferencingArrayModel1() { - super(new JsonSchemaInfo() - .type(Set.of(List.class)) - .items(SelfReferencingArrayModel1.class) - ); - } - - public static SelfReferencingArrayModel1 getInstance() { - if (instance == null) { - instance = new SelfReferencingArrayModel1(); - } - return instance; - } - - @Override - public SelfReferencingArrayModelList getNewInstance(List arg, List pathToItem, PathToSchemasMap pathToSchemas) { - List items = new ArrayList<>(); - int i = 0; - for (Object item: arg) { - List itemPathToItem = new ArrayList<>(pathToItem); - itemPathToItem.add(i); - LinkedHashMap, Nothing?> schemas = pathToSchemas.get(itemPathToItem); - if (schemas == null) { - throw new RuntimeException("Validation 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"); - } - items.add((SelfReferencingArrayModelList) itemInstance); - i += 1; - } - FrozenList newInstanceItems = new FrozenList<>(items); - return new SelfReferencingArrayModelList(newInstanceItems); - } - - 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); - SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().build())); - ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, new PathToSchemasMap(), new LinkedHashSet<>()); - PathToSchemasMap pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet); - return getNewInstance(castArg, validationMetadata.pathToItem(), pathToSchemasMap); - } - - @Override - public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws 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"); - } - @Override - public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { - 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"); - } - @Override - 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 { - 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"); - } - } -} diff --git a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/schemas/SelfReferencingObjectModel.kt b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/schemas/SelfReferencingObjectModel.kt deleted file mode 100644 index 5b959c73d8a..00000000000 --- a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/schemas/SelfReferencingObjectModel.kt +++ /dev/null @@ -1,211 +0,0 @@ -package org.openapijsonschematools.client.components.schemas; -import java.util.ArrayList; -import java.util.HashSet; -import java.util.LinkedHashMap; -import java.util.LinkedHashSet; -import java.util.List; -import java.util.Map; -import java.util.Objects; -import java.util.Set; -import org.checkerframework.checker.nullness.qual.Nullable; -import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags; -import org.openapijsonschematools.client.configurations.SchemaConfiguration; -import org.openapijsonschematools.client.exceptions.InvalidAdditionalPropertyException; -import org.openapijsonschematools.client.exceptions.UnsetPropertyException; -import org.openapijsonschematools.client.exceptions.ValidationException; -import org.openapijsonschematools.client.schemas.GenericBuilder; -import org.openapijsonschematools.client.schemas.validation.FrozenMap; -import org.openapijsonschematools.client.schemas.validation.JsonSchema; -import org.openapijsonschematools.client.schemas.validation.JsonSchemaInfo; -import org.openapijsonschematools.client.schemas.validation.MapSchemaValidator; -import org.openapijsonschematools.client.schemas.validation.MapUtils; -import org.openapijsonschematools.client.schemas.validation.PathToSchemasMap; -import org.openapijsonschematools.client.schemas.validation.PropertyEntry; -import org.openapijsonschematools.client.schemas.validation.ValidationMetadata; - -public class SelfReferencingObjectModel { - // nest classes so all schemas and input/output classes can be public - - - public static class SelfReferencingObjectModelMap extends FrozenMap<@Nullable Object> { - protected SelfReferencingObjectModelMap(FrozenMap<@Nullable Object> m) { - super(m); - } - public static final Set requiredKeys = Set.of(); - public static final Set optionalKeys = Set.of( - "selfRef" - ); - public static SelfReferencingObjectModelMap of(Map arg, SchemaConfiguration configuration) throws ValidationException { - return SelfReferencingObjectModel1.getInstance().validate(arg, configuration); - } - - public SelfReferencingObjectModelMap selfRef() throws UnsetPropertyException { - String key = "selfRef"; - throwIfKeyNotPresent(key); - @Nullable Object value = get(key); - if (!(value instanceof SelfReferencingObjectModelMap)) { - throw new RuntimeException("Invalid value stored for selfRef"); - } - return (SelfReferencingObjectModelMap) value; - } - - public SelfReferencingObjectModelMap getAdditionalProperty(String name) throws UnsetPropertyException, InvalidAdditionalPropertyException { - throwIfKeyKnown(name, requiredKeys, optionalKeys); - var value = getOrThrow(name); - if (!(value instanceof SelfReferencingObjectModelMap)) { - throw new RuntimeException("Invalid value stored for " + name); - } - return (SelfReferencingObjectModelMap) value; - } - } - - public interface SetterForSelfRef { - Map getInstance(); - T getBuilderAfterSelfRef(Map instance); - - default T selfRef(Map value) { - var instance = getInstance(); - instance.put("selfRef", value); - return getBuilderAfterSelfRef(instance); - } - } - - public interface SetterForAdditionalProperties { - Set getKnownKeys(); - Map getInstance(); - T getBuilderAfterAdditionalProperty(Map instance); - - default T additionalProperty(String key, Map value) throws InvalidAdditionalPropertyException { - MapUtils.throwIfKeyKnown(key, getKnownKeys(), true); - var instance = getInstance(); - instance.put(key, value); - return getBuilderAfterAdditionalProperty(instance); - } - } - - public static class SelfReferencingObjectModelMapBuilder implements GenericBuilder>, SetterForSelfRef, SetterForAdditionalProperties { - private final Map instance; - private static final Set knownKeys = Set.of( - "selfRef" - ); - public Set getKnownKeys() { - return knownKeys; - } - public SelfReferencingObjectModelMapBuilder() { - this.instance = new LinkedHashMap<>(); - } - public Map build() { - return instance; - } - public Map getInstance() { - return instance; - } - public SelfReferencingObjectModelMapBuilder getBuilderAfterSelfRef(Map instance) { - return this; - } - public SelfReferencingObjectModelMapBuilder getBuilderAfterAdditionalProperty(Map instance) { - return this; - } - } - - - public sealed interface SelfReferencingObjectModel1Boxed permits SelfReferencingObjectModel1BoxedMap { - @Nullable Object getData(); - } - - public record SelfReferencingObjectModel1BoxedMap(SelfReferencingObjectModelMap data) implements SelfReferencingObjectModel1Boxed { - @Override - public @Nullable Object getData() { - return data; - } - } - - - public static class SelfReferencingObjectModel1 extends JsonSchema implements MapSchemaValidator { - /* - NOTE: This class is auto generated by OpenAPI JSON Schema Generator. - Ref: https://github.com/openapi-json-schema-tools/openapi-json-schema-generator - - Do not edit the class manually. - */ - private static @Nullable SelfReferencingObjectModel1 instance = null; - - protected SelfReferencingObjectModel1() { - super(new JsonSchemaInfo() - .type(Set.of(Map.class)) - .properties(Map.ofEntries( - new PropertyEntry("selfRef", SelfReferencingObjectModel1.class) - )) - .additionalProperties(SelfReferencingObjectModel1.class) - ); - } - - public static SelfReferencingObjectModel1 getInstance() { - if (instance == null) { - instance = new SelfReferencingObjectModel1(); - } - return instance; - } - - 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 RuntimeException("Invalid non-string key value"); - } - String propertyName = (String) entryKey; - List propertyPathToItem = new ArrayList<>(pathToItem); - propertyPathToItem.add(propertyName); - Object value = entry.getValue(); - LinkedHashMap, Nothing?> schemas = pathToSchemas.get(propertyPathToItem); - if (schemas == null) { - throw new RuntimeException("Validation result is invalid, schemas must exist for a pathToItem"); - } - JsonSchema propertySchema = schemas.entrySet().iterator().next().getKey(); - @Nullable Object propertyInstance = propertySchema.getNewInstance(value, propertyPathToItem, pathToSchemas); - properties.put(propertyName, propertyInstance); - } - FrozenMap<@Nullable Object> castProperties = new FrozenMap<>(properties); - return new SelfReferencingObjectModelMap(castProperties); - } - - 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); - SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().build())); - ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, new PathToSchemasMap(), new LinkedHashSet<>()); - PathToSchemasMap pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet); - return getNewInstance(castArg, validationMetadata.pathToItem(), pathToSchemasMap); - } - - - @Override - public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws 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"); - } - @Override - public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { - if (arg instanceof Map) { - return getNewInstance((Map) arg, pathToItem, pathToSchemas); - } - 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 { - return new SelfReferencingObjectModel1BoxedMap(validate(arg, configuration)); - } - @Override - public SelfReferencingObjectModel1Boxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { - 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"); - } - } - -} diff --git a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/schemas/Shape.kt b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/schemas/Shape.kt deleted file mode 100644 index 5fdca31ab2a..00000000000 --- a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/schemas/Shape.kt +++ /dev/null @@ -1,330 +0,0 @@ -package org.openapijsonschematools.client.components.schemas; -import java.time.LocalDate; -import java.time.ZonedDateTime; -import java.util.ArrayList; -import java.util.HashSet; -import java.util.LinkedHashMap; -import java.util.LinkedHashSet; -import java.util.List; -import java.util.Map; -import java.util.Objects; -import java.util.Set; -import java.util.UUID; -import org.checkerframework.checker.nullness.qual.Nullable; -import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags; -import org.openapijsonschematools.client.configurations.SchemaConfiguration; -import org.openapijsonschematools.client.exceptions.InvalidAdditionalPropertyException; -import org.openapijsonschematools.client.exceptions.UnsetPropertyException; -import org.openapijsonschematools.client.exceptions.ValidationException; -import org.openapijsonschematools.client.schemas.UnsetAddPropsSetter; -import org.openapijsonschematools.client.schemas.validation.BooleanSchemaValidator; -import org.openapijsonschematools.client.schemas.validation.FrozenList; -import org.openapijsonschematools.client.schemas.validation.FrozenMap; -import org.openapijsonschematools.client.schemas.validation.JsonSchema; -import org.openapijsonschematools.client.schemas.validation.JsonSchemaInfo; -import org.openapijsonschematools.client.schemas.validation.ListSchemaValidator; -import org.openapijsonschematools.client.schemas.validation.MapSchemaValidator; -import org.openapijsonschematools.client.schemas.validation.NullSchemaValidator; -import org.openapijsonschematools.client.schemas.validation.NumberSchemaValidator; -import org.openapijsonschematools.client.schemas.validation.PathToSchemasMap; -import org.openapijsonschematools.client.schemas.validation.StringSchemaValidator; -import org.openapijsonschematools.client.schemas.validation.ValidationMetadata; - -public class Shape { - // nest classes so all schemas and input/output classes can be public - - - public sealed interface Shape1Boxed permits Shape1BoxedVoid, Shape1BoxedBoolean, Shape1BoxedNumber, Shape1BoxedString, Shape1BoxedList, Shape1BoxedMap { - @Nullable Object getData(); - } - - public record Shape1BoxedVoid(Nothing? data) implements Shape1Boxed { - @Override - public @Nullable Object getData() { - return data; - } - } - - public record Shape1BoxedBoolean(boolean data) implements Shape1Boxed { - @Override - public @Nullable Object getData() { - return data; - } - } - - public record Shape1BoxedNumber(Number data) implements Shape1Boxed { - @Override - public @Nullable Object getData() { - return data; - } - } - - public record Shape1BoxedString(String data) implements Shape1Boxed { - @Override - public @Nullable Object getData() { - return data; - } - } - - public record Shape1BoxedList(FrozenList<@Nullable Object> data) implements Shape1Boxed { - @Override - public @Nullable Object getData() { - return data; - } - } - - public record Shape1BoxedMap(FrozenMap<@Nullable Object> data) implements Shape1Boxed { - @Override - public @Nullable Object getData() { - return data; - } - } - - - public static class Shape1 extends JsonSchema implements NullSchemaValidator, BooleanSchemaValidator, NumberSchemaValidator, StringSchemaValidator, ListSchemaValidator, Shape1BoxedList>, MapSchemaValidator, Shape1BoxedMap> { - /* - NOTE: This class is auto generated by OpenAPI JSON Schema Generator. - Ref: https://github.com/openapi-json-schema-tools/openapi-json-schema-generator - - Do not edit the class manually. - */ - private static @Nullable Shape1 instance = null; - - protected Shape1() { - super(new JsonSchemaInfo() - .oneOf(List.of( - Triangle.Triangle1.class, - Quadrilateral.Quadrilateral1.class - )) - ); - } - - public static Shape1 getInstance() { - if (instance == null) { - instance = new Shape1(); - } - return instance; - } - - @Override - public Nothing? validate(Nothing? arg, SchemaConfiguration configuration) throws ValidationException { - Set> pathSet = new HashSet<>(); - List pathToItem = List.of("args[0]"); - Nothing? castArg = castToAllowedTypes(arg, pathToItem, pathSet); - SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().build())); - PathToSchemasMap validatedPathToSchemas = new PathToSchemasMap(); - ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, new LinkedHashSet<>()); - getPathToSchemas(this, castArg, validationMetadata, pathSet); - return castArg; - } - - @Override - public boolean validate(boolean arg, SchemaConfiguration configuration) throws ValidationException { - Set> pathSet = new HashSet<>(); - List pathToItem = List.of("args[0]"); - boolean castArg = castToAllowedTypes(arg, pathToItem, pathSet); - SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().build())); - PathToSchemasMap validatedPathToSchemas = new PathToSchemasMap(); - ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, new LinkedHashSet<>()); - getPathToSchemas(this, castArg, validationMetadata, pathSet); - return castArg; - } - - @Override - public Number validate(Number arg, SchemaConfiguration configuration) throws ValidationException { - Set> pathSet = new HashSet<>(); - List pathToItem = List.of("args[0]"); - Number castArg = castToAllowedTypes(arg, pathToItem, pathSet); - SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().build())); - PathToSchemasMap validatedPathToSchemas = new PathToSchemasMap(); - ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, new LinkedHashSet<>()); - getPathToSchemas(this, castArg, validationMetadata, pathSet); - return castArg; - } - - public int validate(int arg, SchemaConfiguration configuration) throws ValidationException { - return (int) validate((Number) arg, configuration); - } - - public long validate(long arg, SchemaConfiguration configuration) throws ValidationException { - return (long) validate((Number) arg, configuration); - } - - public float validate(float arg, SchemaConfiguration configuration) throws ValidationException { - return (float) validate((Number) arg, configuration); - } - - public double validate(double arg, SchemaConfiguration configuration) throws ValidationException { - return (double) validate((Number) arg, configuration); - } - - @Override - public String validate(String arg, SchemaConfiguration configuration) throws ValidationException { - Set> pathSet = new HashSet<>(); - List pathToItem = List.of("args[0]"); - String castArg = castToAllowedTypes(arg, pathToItem, pathSet); - SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().build())); - PathToSchemasMap validatedPathToSchemas = new PathToSchemasMap(); - ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, new LinkedHashSet<>()); - getPathToSchemas(this, castArg, validationMetadata, pathSet); - return castArg; - } - - public String validate(LocalDate arg, SchemaConfiguration configuration) throws ValidationException { - return validate(arg.toString(), configuration); - } - - public String validate(ZonedDateTime arg, SchemaConfiguration configuration) throws ValidationException { - return validate(arg.toString(), configuration); - } - - public String validate(UUID arg, SchemaConfiguration configuration) throws ValidationException { - return validate(arg.toString(), configuration); - } - - @Override - public FrozenList<@Nullable Object> getNewInstance(List arg, List pathToItem, PathToSchemasMap pathToSchemas) { - List<@Nullable Object> items = new ArrayList<>(); - int i = 0; - for (Object item: arg) { - List itemPathToItem = new ArrayList<>(pathToItem); - itemPathToItem.add(i); - LinkedHashMap, Nothing?> schemas = pathToSchemas.get(itemPathToItem); - if (schemas == null) { - throw new RuntimeException("Validation result is invalid, schemas must exist for a pathToItem"); - } - JsonSchema itemSchema = schemas.entrySet().iterator().next().getKey(); - @Nullable Object itemInstance = itemSchema.getNewInstance(item, itemPathToItem, pathToSchemas); - items.add(itemInstance); - i += 1; - } - FrozenList<@Nullable Object> newInstanceItems = new FrozenList<>(items); - return newInstanceItems; - } - - 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); - SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().build())); - ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, new PathToSchemasMap(), new LinkedHashSet<>()); - PathToSchemasMap pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet); - return getNewInstance(castArg, validationMetadata.pathToItem(), pathToSchemasMap); - } - - @Override - 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 RuntimeException("Invalid non-string key value"); - } - String propertyName = (String) entryKey; - List propertyPathToItem = new ArrayList<>(pathToItem); - propertyPathToItem.add(propertyName); - Object value = entry.getValue(); - LinkedHashMap, Nothing?> schemas = pathToSchemas.get(propertyPathToItem); - if (schemas == null) { - throw new RuntimeException("Validation result is invalid, schemas must exist for a pathToItem"); - } - JsonSchema propertySchema = schemas.entrySet().iterator().next().getKey(); - @Nullable Object propertyInstance = propertySchema.getNewInstance(value, propertyPathToItem, pathToSchemas); - properties.put(propertyName, propertyInstance); - } - FrozenMap<@Nullable Object> castProperties = new FrozenMap<>(properties); - return castProperties; - } - - public FrozenMap<@Nullable Object> validate(Map arg, SchemaConfiguration configuration) throws ValidationException { - Set> pathSet = new HashSet<>(); - List pathToItem = List.of("args[0]"); - Map castArg = castToAllowedTypes(arg, pathToItem, pathSet); - SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().build())); - PathToSchemasMap validatedPathToSchemas = new PathToSchemasMap(); - ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, new LinkedHashSet<>()); - PathToSchemasMap pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet); - return getNewInstance(castArg, validationMetadata.pathToItem(), pathToSchemasMap); - } - - @Override - public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { - if (arg == null) { - return validate((Nothing?) null, configuration); - } else if (arg instanceof Boolean) { - boolean boolArg = (Boolean) arg; - return validate(boolArg, configuration); - } else if (arg instanceof Number) { - return validate((Number) arg, configuration); - } else if (arg instanceof String) { - return validate((String) arg, configuration); - } else if (arg instanceof List) { - return validate((List) arg, 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"); - } - @Override - public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { - if (arg == null) { - return getNewInstance((Nothing?) null, pathToItem, pathToSchemas); - } else if (arg instanceof Boolean) { - boolean boolArg = (Boolean) arg; - return getNewInstance(boolArg, pathToItem, pathToSchemas); - } else if (arg instanceof Number) { - return getNewInstance((Number) arg, pathToItem, pathToSchemas); - } else if (arg instanceof String) { - return getNewInstance((String) arg, pathToItem, pathToSchemas); - } else if (arg instanceof List) { - return getNewInstance((List) arg, 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"); - } - @Override - public Shape1BoxedVoid validateAndBox(Nothing? arg, SchemaConfiguration configuration) throws ValidationException { - return new Shape1BoxedVoid(validate(arg, configuration)); - } - @Override - 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 { - return new Shape1BoxedNumber(validate(arg, configuration)); - } - @Override - 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 { - return new Shape1BoxedList(validate(arg, configuration)); - } - @Override - 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 { - if (arg == null) { - Nothing? castArg = (Nothing?) arg; - return validateAndBox(castArg, configuration); - } else if (arg instanceof Boolean booleanArg) { - boolean castArg = booleanArg; - return validateAndBox(castArg, configuration); - } else if (arg instanceof String castArg) { - return validateAndBox(castArg, configuration); - } else if (arg instanceof Number castArg) { - return validateAndBox(castArg, configuration); - } else if (arg instanceof List castArg) { - 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"); - } - } -} diff --git a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/schemas/ShapeOrNull.kt b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/schemas/ShapeOrNull.kt deleted file mode 100644 index edf65df7aaf..00000000000 --- a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/schemas/ShapeOrNull.kt +++ /dev/null @@ -1,345 +0,0 @@ -package org.openapijsonschematools.client.components.schemas; -import java.time.LocalDate; -import java.time.ZonedDateTime; -import java.util.ArrayList; -import java.util.HashSet; -import java.util.LinkedHashMap; -import java.util.LinkedHashSet; -import java.util.List; -import java.util.Map; -import java.util.Objects; -import java.util.Set; -import java.util.UUID; -import org.checkerframework.checker.nullness.qual.Nullable; -import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags; -import org.openapijsonschematools.client.configurations.SchemaConfiguration; -import org.openapijsonschematools.client.exceptions.InvalidAdditionalPropertyException; -import org.openapijsonschematools.client.exceptions.UnsetPropertyException; -import org.openapijsonschematools.client.exceptions.ValidationException; -import org.openapijsonschematools.client.schemas.NullJsonSchema; -import org.openapijsonschematools.client.schemas.UnsetAddPropsSetter; -import org.openapijsonschematools.client.schemas.validation.BooleanSchemaValidator; -import org.openapijsonschematools.client.schemas.validation.FrozenList; -import org.openapijsonschematools.client.schemas.validation.FrozenMap; -import org.openapijsonschematools.client.schemas.validation.JsonSchema; -import org.openapijsonschematools.client.schemas.validation.JsonSchemaInfo; -import org.openapijsonschematools.client.schemas.validation.ListSchemaValidator; -import org.openapijsonschematools.client.schemas.validation.MapSchemaValidator; -import org.openapijsonschematools.client.schemas.validation.NullSchemaValidator; -import org.openapijsonschematools.client.schemas.validation.NumberSchemaValidator; -import org.openapijsonschematools.client.schemas.validation.PathToSchemasMap; -import org.openapijsonschematools.client.schemas.validation.StringSchemaValidator; -import org.openapijsonschematools.client.schemas.validation.ValidationMetadata; - -public class ShapeOrNull { - // nest classes so all schemas and input/output classes can be public - - - public static class Schema0 extends NullJsonSchema.NullJsonSchema1 { - private static @Nullable Schema0 instance = null; - public static Schema0 getInstance() { - if (instance == null) { - instance = new Schema0(); - } - return instance; - } - } - - - public sealed interface ShapeOrNull1Boxed permits ShapeOrNull1BoxedVoid, ShapeOrNull1BoxedBoolean, ShapeOrNull1BoxedNumber, ShapeOrNull1BoxedString, ShapeOrNull1BoxedList, ShapeOrNull1BoxedMap { - @Nullable Object getData(); - } - - public record ShapeOrNull1BoxedVoid(Nothing? data) implements ShapeOrNull1Boxed { - @Override - public @Nullable Object getData() { - return data; - } - } - - public record ShapeOrNull1BoxedBoolean(boolean data) implements ShapeOrNull1Boxed { - @Override - public @Nullable Object getData() { - return data; - } - } - - public record ShapeOrNull1BoxedNumber(Number data) implements ShapeOrNull1Boxed { - @Override - public @Nullable Object getData() { - return data; - } - } - - public record ShapeOrNull1BoxedString(String data) implements ShapeOrNull1Boxed { - @Override - public @Nullable Object getData() { - return data; - } - } - - public record ShapeOrNull1BoxedList(FrozenList<@Nullable Object> data) implements ShapeOrNull1Boxed { - @Override - public @Nullable Object getData() { - return data; - } - } - - public record ShapeOrNull1BoxedMap(FrozenMap<@Nullable Object> data) implements ShapeOrNull1Boxed { - @Override - public @Nullable Object getData() { - return data; - } - } - - - public static class ShapeOrNull1 extends JsonSchema implements NullSchemaValidator, BooleanSchemaValidator, NumberSchemaValidator, StringSchemaValidator, ListSchemaValidator, ShapeOrNull1BoxedList>, MapSchemaValidator, ShapeOrNull1BoxedMap> { - /* - NOTE: This class is auto generated by OpenAPI JSON Schema Generator. - Ref: https://github.com/openapi-json-schema-tools/openapi-json-schema-generator - - Do not edit the class manually. - - The value may be a shape or the 'null' value. This is introduced in OAS schema >= 3.1. - */ - private static @Nullable ShapeOrNull1 instance = null; - - protected ShapeOrNull1() { - super(new JsonSchemaInfo() - .oneOf(List.of( - Schema0.class, - Triangle.Triangle1.class, - Quadrilateral.Quadrilateral1.class - )) - ); - } - - public static ShapeOrNull1 getInstance() { - if (instance == null) { - instance = new ShapeOrNull1(); - } - return instance; - } - - @Override - public Nothing? validate(Nothing? arg, SchemaConfiguration configuration) throws ValidationException { - Set> pathSet = new HashSet<>(); - List pathToItem = List.of("args[0]"); - Nothing? castArg = castToAllowedTypes(arg, pathToItem, pathSet); - SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().build())); - PathToSchemasMap validatedPathToSchemas = new PathToSchemasMap(); - ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, new LinkedHashSet<>()); - getPathToSchemas(this, castArg, validationMetadata, pathSet); - return castArg; - } - - @Override - public boolean validate(boolean arg, SchemaConfiguration configuration) throws ValidationException { - Set> pathSet = new HashSet<>(); - List pathToItem = List.of("args[0]"); - boolean castArg = castToAllowedTypes(arg, pathToItem, pathSet); - SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().build())); - PathToSchemasMap validatedPathToSchemas = new PathToSchemasMap(); - ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, new LinkedHashSet<>()); - getPathToSchemas(this, castArg, validationMetadata, pathSet); - return castArg; - } - - @Override - public Number validate(Number arg, SchemaConfiguration configuration) throws ValidationException { - Set> pathSet = new HashSet<>(); - List pathToItem = List.of("args[0]"); - Number castArg = castToAllowedTypes(arg, pathToItem, pathSet); - SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().build())); - PathToSchemasMap validatedPathToSchemas = new PathToSchemasMap(); - ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, new LinkedHashSet<>()); - getPathToSchemas(this, castArg, validationMetadata, pathSet); - return castArg; - } - - public int validate(int arg, SchemaConfiguration configuration) throws ValidationException { - return (int) validate((Number) arg, configuration); - } - - public long validate(long arg, SchemaConfiguration configuration) throws ValidationException { - return (long) validate((Number) arg, configuration); - } - - public float validate(float arg, SchemaConfiguration configuration) throws ValidationException { - return (float) validate((Number) arg, configuration); - } - - public double validate(double arg, SchemaConfiguration configuration) throws ValidationException { - return (double) validate((Number) arg, configuration); - } - - @Override - public String validate(String arg, SchemaConfiguration configuration) throws ValidationException { - Set> pathSet = new HashSet<>(); - List pathToItem = List.of("args[0]"); - String castArg = castToAllowedTypes(arg, pathToItem, pathSet); - SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().build())); - PathToSchemasMap validatedPathToSchemas = new PathToSchemasMap(); - ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, new LinkedHashSet<>()); - getPathToSchemas(this, castArg, validationMetadata, pathSet); - return castArg; - } - - public String validate(LocalDate arg, SchemaConfiguration configuration) throws ValidationException { - return validate(arg.toString(), configuration); - } - - public String validate(ZonedDateTime arg, SchemaConfiguration configuration) throws ValidationException { - return validate(arg.toString(), configuration); - } - - public String validate(UUID arg, SchemaConfiguration configuration) throws ValidationException { - return validate(arg.toString(), configuration); - } - - @Override - public FrozenList<@Nullable Object> getNewInstance(List arg, List pathToItem, PathToSchemasMap pathToSchemas) { - List<@Nullable Object> items = new ArrayList<>(); - int i = 0; - for (Object item: arg) { - List itemPathToItem = new ArrayList<>(pathToItem); - itemPathToItem.add(i); - LinkedHashMap, Nothing?> schemas = pathToSchemas.get(itemPathToItem); - if (schemas == null) { - throw new RuntimeException("Validation result is invalid, schemas must exist for a pathToItem"); - } - JsonSchema itemSchema = schemas.entrySet().iterator().next().getKey(); - @Nullable Object itemInstance = itemSchema.getNewInstance(item, itemPathToItem, pathToSchemas); - items.add(itemInstance); - i += 1; - } - FrozenList<@Nullable Object> newInstanceItems = new FrozenList<>(items); - return newInstanceItems; - } - - 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); - SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().build())); - ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, new PathToSchemasMap(), new LinkedHashSet<>()); - PathToSchemasMap pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet); - return getNewInstance(castArg, validationMetadata.pathToItem(), pathToSchemasMap); - } - - @Override - 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 RuntimeException("Invalid non-string key value"); - } - String propertyName = (String) entryKey; - List propertyPathToItem = new ArrayList<>(pathToItem); - propertyPathToItem.add(propertyName); - Object value = entry.getValue(); - LinkedHashMap, Nothing?> schemas = pathToSchemas.get(propertyPathToItem); - if (schemas == null) { - throw new RuntimeException("Validation result is invalid, schemas must exist for a pathToItem"); - } - JsonSchema propertySchema = schemas.entrySet().iterator().next().getKey(); - @Nullable Object propertyInstance = propertySchema.getNewInstance(value, propertyPathToItem, pathToSchemas); - properties.put(propertyName, propertyInstance); - } - FrozenMap<@Nullable Object> castProperties = new FrozenMap<>(properties); - return castProperties; - } - - public FrozenMap<@Nullable Object> validate(Map arg, SchemaConfiguration configuration) throws ValidationException { - Set> pathSet = new HashSet<>(); - List pathToItem = List.of("args[0]"); - Map castArg = castToAllowedTypes(arg, pathToItem, pathSet); - SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().build())); - PathToSchemasMap validatedPathToSchemas = new PathToSchemasMap(); - ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, new LinkedHashSet<>()); - PathToSchemasMap pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet); - return getNewInstance(castArg, validationMetadata.pathToItem(), pathToSchemasMap); - } - - @Override - public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { - if (arg == null) { - return validate((Nothing?) null, configuration); - } else if (arg instanceof Boolean) { - boolean boolArg = (Boolean) arg; - return validate(boolArg, configuration); - } else if (arg instanceof Number) { - return validate((Number) arg, configuration); - } else if (arg instanceof String) { - return validate((String) arg, configuration); - } else if (arg instanceof List) { - return validate((List) arg, 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"); - } - @Override - public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { - if (arg == null) { - return getNewInstance((Nothing?) null, pathToItem, pathToSchemas); - } else if (arg instanceof Boolean) { - boolean boolArg = (Boolean) arg; - return getNewInstance(boolArg, pathToItem, pathToSchemas); - } else if (arg instanceof Number) { - return getNewInstance((Number) arg, pathToItem, pathToSchemas); - } else if (arg instanceof String) { - return getNewInstance((String) arg, pathToItem, pathToSchemas); - } else if (arg instanceof List) { - return getNewInstance((List) arg, 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"); - } - @Override - public ShapeOrNull1BoxedVoid validateAndBox(Nothing? arg, SchemaConfiguration configuration) throws ValidationException { - return new ShapeOrNull1BoxedVoid(validate(arg, configuration)); - } - @Override - 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 { - return new ShapeOrNull1BoxedNumber(validate(arg, configuration)); - } - @Override - 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 { - return new ShapeOrNull1BoxedList(validate(arg, configuration)); - } - @Override - 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 { - if (arg == null) { - Nothing? castArg = (Nothing?) arg; - return validateAndBox(castArg, configuration); - } else if (arg instanceof Boolean booleanArg) { - boolean castArg = booleanArg; - return validateAndBox(castArg, configuration); - } else if (arg instanceof String castArg) { - return validateAndBox(castArg, configuration); - } else if (arg instanceof Number castArg) { - return validateAndBox(castArg, configuration); - } else if (arg instanceof List castArg) { - 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"); - } - } -} diff --git a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/schemas/SimpleQuadrilateral.kt b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/schemas/SimpleQuadrilateral.kt deleted file mode 100644 index f1edb5ee8e6..00000000000 --- a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/schemas/SimpleQuadrilateral.kt +++ /dev/null @@ -1,589 +0,0 @@ -package org.openapijsonschematools.client.components.schemas; -import java.time.LocalDate; -import java.time.ZonedDateTime; -import java.util.ArrayList; -import java.util.HashSet; -import java.util.LinkedHashMap; -import java.util.LinkedHashSet; -import java.util.List; -import java.util.Map; -import java.util.Objects; -import java.util.Set; -import java.util.UUID; -import org.checkerframework.checker.nullness.qual.Nullable; -import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags; -import org.openapijsonschematools.client.configurations.SchemaConfiguration; -import org.openapijsonschematools.client.exceptions.InvalidAdditionalPropertyException; -import org.openapijsonschematools.client.exceptions.UnsetPropertyException; -import org.openapijsonschematools.client.exceptions.ValidationException; -import org.openapijsonschematools.client.schemas.GenericBuilder; -import org.openapijsonschematools.client.schemas.SetMaker; -import org.openapijsonschematools.client.schemas.UnsetAddPropsSetter; -import org.openapijsonschematools.client.schemas.validation.BooleanSchemaValidator; -import org.openapijsonschematools.client.schemas.validation.FrozenList; -import org.openapijsonschematools.client.schemas.validation.FrozenMap; -import org.openapijsonschematools.client.schemas.validation.JsonSchema; -import org.openapijsonschematools.client.schemas.validation.JsonSchemaInfo; -import org.openapijsonschematools.client.schemas.validation.ListSchemaValidator; -import org.openapijsonschematools.client.schemas.validation.MapSchemaValidator; -import org.openapijsonschematools.client.schemas.validation.NullSchemaValidator; -import org.openapijsonschematools.client.schemas.validation.NumberSchemaValidator; -import org.openapijsonschematools.client.schemas.validation.PathToSchemasMap; -import org.openapijsonschematools.client.schemas.validation.PropertyEntry; -import org.openapijsonschematools.client.schemas.validation.StringEnumValidator; -import org.openapijsonschematools.client.schemas.validation.StringSchemaValidator; -import org.openapijsonschematools.client.schemas.validation.StringValueMethod; -import org.openapijsonschematools.client.schemas.validation.ValidationMetadata; - -public class SimpleQuadrilateral { - // nest classes so all schemas and input/output classes can be public - - public enum StringQuadrilateralTypeEnums implements StringValueMethod { - SIMPLE_QUADRILATERAL("SimpleQuadrilateral"); - private final String value; - - StringQuadrilateralTypeEnums(String value) { - this.value = value; - } - public String value() { - return this.value; - } - } - - - public sealed interface QuadrilateralTypeBoxed permits QuadrilateralTypeBoxedString { - @Nullable Object getData(); - } - - public record QuadrilateralTypeBoxedString(String data) implements QuadrilateralTypeBoxed { - @Override - public @Nullable Object getData() { - return data; - } - } - - - - public static class QuadrilateralType extends JsonSchema implements StringSchemaValidator, StringEnumValidator { - private static @Nullable QuadrilateralType instance = null; - - protected QuadrilateralType() { - super(new JsonSchemaInfo() - .type(Set.of( - String.class - )) - .enumValues(SetMaker.makeSet( - "SimpleQuadrilateral" - )) - ); - } - - public static QuadrilateralType getInstance() { - if (instance == null) { - instance = new QuadrilateralType(); - } - return instance; - } - - @Override - public String validate(String arg, SchemaConfiguration configuration) throws ValidationException { - Set> pathSet = new HashSet<>(); - List pathToItem = List.of("args[0"); - String castArg = castToAllowedTypes(arg, pathToItem, pathSet); - SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().build())); - ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, new PathToSchemasMap(), new LinkedHashSet<>()); - getPathToSchemas(this, castArg, validationMetadata, pathSet); - return castArg; - } - - @Override - 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 { - 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"); - } - @Override - public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { - 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"); - } - @Override - 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 { - 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"); - } - } - - public static class Schema1Map extends FrozenMap<@Nullable Object> { - protected Schema1Map(FrozenMap<@Nullable Object> m) { - super(m); - } - public static final Set requiredKeys = Set.of(); - public static final Set optionalKeys = Set.of( - "quadrilateralType" - ); - public static Schema1Map of(Map arg, SchemaConfiguration configuration) throws ValidationException { - return Schema1.getInstance().validate(arg, configuration); - } - - public String quadrilateralType() throws UnsetPropertyException { - String key = "quadrilateralType"; - throwIfKeyNotPresent(key); - @Nullable Object value = get(key); - if (!(value instanceof String)) { - throw new RuntimeException("Invalid value stored for quadrilateralType"); - } - return (String) value; - } - - public @Nullable Object getAdditionalProperty(String name) throws UnsetPropertyException, InvalidAdditionalPropertyException { - throwIfKeyKnown(name, requiredKeys, optionalKeys); - throwIfKeyNotPresent(name); - return get(name); - } - } - - public interface SetterForQuadrilateralType { - Map getInstance(); - T getBuilderAfterQuadrilateralType(Map instance); - - default T quadrilateralType(String value) { - var instance = getInstance(); - instance.put("quadrilateralType", value); - return getBuilderAfterQuadrilateralType(instance); - } - - default T quadrilateralType(StringQuadrilateralTypeEnums value) { - var instance = getInstance(); - instance.put("quadrilateralType", value.value()); - return getBuilderAfterQuadrilateralType(instance); - } - } - - public static class Schema1MapBuilder extends UnsetAddPropsSetter implements GenericBuilder>, SetterForQuadrilateralType { - private final Map instance; - private static final Set knownKeys = Set.of( - "quadrilateralType" - ); - public Set getKnownKeys() { - return knownKeys; - } - public Schema1MapBuilder() { - this.instance = new LinkedHashMap<>(); - } - public Map build() { - return instance; - } - public Map getInstance() { - return instance; - } - public Schema1MapBuilder getBuilderAfterQuadrilateralType(Map instance) { - return this; - } - public Schema1MapBuilder getBuilderAfterAdditionalProperty(Map instance) { - return this; - } - } - - - public sealed interface Schema1Boxed permits Schema1BoxedMap { - @Nullable Object getData(); - } - - public record Schema1BoxedMap(Schema1Map data) implements Schema1Boxed { - @Override - public @Nullable Object getData() { - return data; - } - } - - - public static class Schema1 extends JsonSchema implements MapSchemaValidator { - private static @Nullable Schema1 instance = null; - - protected Schema1() { - super(new JsonSchemaInfo() - .type(Set.of(Map.class)) - .properties(Map.ofEntries( - new PropertyEntry("quadrilateralType", QuadrilateralType.class) - )) - ); - } - - public static Schema1 getInstance() { - if (instance == null) { - instance = new Schema1(); - } - return instance; - } - - 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 RuntimeException("Invalid non-string key value"); - } - String propertyName = (String) entryKey; - List propertyPathToItem = new ArrayList<>(pathToItem); - propertyPathToItem.add(propertyName); - Object value = entry.getValue(); - LinkedHashMap, Nothing?> schemas = pathToSchemas.get(propertyPathToItem); - if (schemas == null) { - throw new RuntimeException("Validation result is invalid, schemas must exist for a pathToItem"); - } - JsonSchema propertySchema = schemas.entrySet().iterator().next().getKey(); - @Nullable Object propertyInstance = propertySchema.getNewInstance(value, propertyPathToItem, pathToSchemas); - properties.put(propertyName, propertyInstance); - } - FrozenMap<@Nullable Object> castProperties = new FrozenMap<>(properties); - return new Schema1Map(castProperties); - } - - 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); - SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().build())); - ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, new PathToSchemasMap(), new LinkedHashSet<>()); - PathToSchemasMap pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet); - return getNewInstance(castArg, validationMetadata.pathToItem(), pathToSchemasMap); - } - - - @Override - public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws 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"); - } - @Override - public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { - if (arg instanceof Map) { - return getNewInstance((Map) arg, pathToItem, pathToSchemas); - } - 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 { - return new Schema1BoxedMap(validate(arg, configuration)); - } - @Override - public Schema1Boxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { - 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"); - } - } - - - public sealed interface SimpleQuadrilateral1Boxed permits SimpleQuadrilateral1BoxedVoid, SimpleQuadrilateral1BoxedBoolean, SimpleQuadrilateral1BoxedNumber, SimpleQuadrilateral1BoxedString, SimpleQuadrilateral1BoxedList, SimpleQuadrilateral1BoxedMap { - @Nullable Object getData(); - } - - public record SimpleQuadrilateral1BoxedVoid(Nothing? data) implements SimpleQuadrilateral1Boxed { - @Override - public @Nullable Object getData() { - return data; - } - } - - public record SimpleQuadrilateral1BoxedBoolean(boolean data) implements SimpleQuadrilateral1Boxed { - @Override - public @Nullable Object getData() { - return data; - } - } - - public record SimpleQuadrilateral1BoxedNumber(Number data) implements SimpleQuadrilateral1Boxed { - @Override - public @Nullable Object getData() { - return data; - } - } - - public record SimpleQuadrilateral1BoxedString(String data) implements SimpleQuadrilateral1Boxed { - @Override - public @Nullable Object getData() { - return data; - } - } - - public record SimpleQuadrilateral1BoxedList(FrozenList<@Nullable Object> data) implements SimpleQuadrilateral1Boxed { - @Override - public @Nullable Object getData() { - return data; - } - } - - public record SimpleQuadrilateral1BoxedMap(FrozenMap<@Nullable Object> data) implements SimpleQuadrilateral1Boxed { - @Override - public @Nullable Object getData() { - return data; - } - } - - - public static class SimpleQuadrilateral1 extends JsonSchema implements NullSchemaValidator, BooleanSchemaValidator, NumberSchemaValidator, StringSchemaValidator, ListSchemaValidator, SimpleQuadrilateral1BoxedList>, MapSchemaValidator, SimpleQuadrilateral1BoxedMap> { - /* - NOTE: This class is auto generated by OpenAPI JSON Schema Generator. - Ref: https://github.com/openapi-json-schema-tools/openapi-json-schema-generator - - Do not edit the class manually. - */ - private static @Nullable SimpleQuadrilateral1 instance = null; - - protected SimpleQuadrilateral1() { - super(new JsonSchemaInfo() - .allOf(List.of( - QuadrilateralInterface.QuadrilateralInterface1.class, - Schema1.class - )) - ); - } - - public static SimpleQuadrilateral1 getInstance() { - if (instance == null) { - instance = new SimpleQuadrilateral1(); - } - return instance; - } - - @Override - public Nothing? validate(Nothing? arg, SchemaConfiguration configuration) throws ValidationException { - Set> pathSet = new HashSet<>(); - List pathToItem = List.of("args[0]"); - Nothing? castArg = castToAllowedTypes(arg, pathToItem, pathSet); - SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().build())); - PathToSchemasMap validatedPathToSchemas = new PathToSchemasMap(); - ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, new LinkedHashSet<>()); - getPathToSchemas(this, castArg, validationMetadata, pathSet); - return castArg; - } - - @Override - public boolean validate(boolean arg, SchemaConfiguration configuration) throws ValidationException { - Set> pathSet = new HashSet<>(); - List pathToItem = List.of("args[0]"); - boolean castArg = castToAllowedTypes(arg, pathToItem, pathSet); - SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().build())); - PathToSchemasMap validatedPathToSchemas = new PathToSchemasMap(); - ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, new LinkedHashSet<>()); - getPathToSchemas(this, castArg, validationMetadata, pathSet); - return castArg; - } - - @Override - public Number validate(Number arg, SchemaConfiguration configuration) throws ValidationException { - Set> pathSet = new HashSet<>(); - List pathToItem = List.of("args[0]"); - Number castArg = castToAllowedTypes(arg, pathToItem, pathSet); - SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().build())); - PathToSchemasMap validatedPathToSchemas = new PathToSchemasMap(); - ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, new LinkedHashSet<>()); - getPathToSchemas(this, castArg, validationMetadata, pathSet); - return castArg; - } - - public int validate(int arg, SchemaConfiguration configuration) throws ValidationException { - return (int) validate((Number) arg, configuration); - } - - public long validate(long arg, SchemaConfiguration configuration) throws ValidationException { - return (long) validate((Number) arg, configuration); - } - - public float validate(float arg, SchemaConfiguration configuration) throws ValidationException { - return (float) validate((Number) arg, configuration); - } - - public double validate(double arg, SchemaConfiguration configuration) throws ValidationException { - return (double) validate((Number) arg, configuration); - } - - @Override - public String validate(String arg, SchemaConfiguration configuration) throws ValidationException { - Set> pathSet = new HashSet<>(); - List pathToItem = List.of("args[0]"); - String castArg = castToAllowedTypes(arg, pathToItem, pathSet); - SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().build())); - PathToSchemasMap validatedPathToSchemas = new PathToSchemasMap(); - ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, new LinkedHashSet<>()); - getPathToSchemas(this, castArg, validationMetadata, pathSet); - return castArg; - } - - public String validate(LocalDate arg, SchemaConfiguration configuration) throws ValidationException { - return validate(arg.toString(), configuration); - } - - public String validate(ZonedDateTime arg, SchemaConfiguration configuration) throws ValidationException { - return validate(arg.toString(), configuration); - } - - public String validate(UUID arg, SchemaConfiguration configuration) throws ValidationException { - return validate(arg.toString(), configuration); - } - - @Override - public FrozenList<@Nullable Object> getNewInstance(List arg, List pathToItem, PathToSchemasMap pathToSchemas) { - List<@Nullable Object> items = new ArrayList<>(); - int i = 0; - for (Object item: arg) { - List itemPathToItem = new ArrayList<>(pathToItem); - itemPathToItem.add(i); - LinkedHashMap, Nothing?> schemas = pathToSchemas.get(itemPathToItem); - if (schemas == null) { - throw new RuntimeException("Validation result is invalid, schemas must exist for a pathToItem"); - } - JsonSchema itemSchema = schemas.entrySet().iterator().next().getKey(); - @Nullable Object itemInstance = itemSchema.getNewInstance(item, itemPathToItem, pathToSchemas); - items.add(itemInstance); - i += 1; - } - FrozenList<@Nullable Object> newInstanceItems = new FrozenList<>(items); - return newInstanceItems; - } - - 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); - SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().build())); - ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, new PathToSchemasMap(), new LinkedHashSet<>()); - PathToSchemasMap pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet); - return getNewInstance(castArg, validationMetadata.pathToItem(), pathToSchemasMap); - } - - @Override - 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 RuntimeException("Invalid non-string key value"); - } - String propertyName = (String) entryKey; - List propertyPathToItem = new ArrayList<>(pathToItem); - propertyPathToItem.add(propertyName); - Object value = entry.getValue(); - LinkedHashMap, Nothing?> schemas = pathToSchemas.get(propertyPathToItem); - if (schemas == null) { - throw new RuntimeException("Validation result is invalid, schemas must exist for a pathToItem"); - } - JsonSchema propertySchema = schemas.entrySet().iterator().next().getKey(); - @Nullable Object propertyInstance = propertySchema.getNewInstance(value, propertyPathToItem, pathToSchemas); - properties.put(propertyName, propertyInstance); - } - FrozenMap<@Nullable Object> castProperties = new FrozenMap<>(properties); - return castProperties; - } - - public FrozenMap<@Nullable Object> validate(Map arg, SchemaConfiguration configuration) throws ValidationException { - Set> pathSet = new HashSet<>(); - List pathToItem = List.of("args[0]"); - Map castArg = castToAllowedTypes(arg, pathToItem, pathSet); - SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().build())); - PathToSchemasMap validatedPathToSchemas = new PathToSchemasMap(); - ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, new LinkedHashSet<>()); - PathToSchemasMap pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet); - return getNewInstance(castArg, validationMetadata.pathToItem(), pathToSchemasMap); - } - - @Override - public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { - if (arg == null) { - return validate((Nothing?) null, configuration); - } else if (arg instanceof Boolean) { - boolean boolArg = (Boolean) arg; - return validate(boolArg, configuration); - } else if (arg instanceof Number) { - return validate((Number) arg, configuration); - } else if (arg instanceof String) { - return validate((String) arg, configuration); - } else if (arg instanceof List) { - return validate((List) arg, 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"); - } - @Override - public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { - if (arg == null) { - return getNewInstance((Nothing?) null, pathToItem, pathToSchemas); - } else if (arg instanceof Boolean) { - boolean boolArg = (Boolean) arg; - return getNewInstance(boolArg, pathToItem, pathToSchemas); - } else if (arg instanceof Number) { - return getNewInstance((Number) arg, pathToItem, pathToSchemas); - } else if (arg instanceof String) { - return getNewInstance((String) arg, pathToItem, pathToSchemas); - } else if (arg instanceof List) { - return getNewInstance((List) arg, 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"); - } - @Override - public SimpleQuadrilateral1BoxedVoid validateAndBox(Nothing? arg, SchemaConfiguration configuration) throws ValidationException { - return new SimpleQuadrilateral1BoxedVoid(validate(arg, configuration)); - } - @Override - 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 { - return new SimpleQuadrilateral1BoxedNumber(validate(arg, configuration)); - } - @Override - 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 { - return new SimpleQuadrilateral1BoxedList(validate(arg, configuration)); - } - @Override - 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 { - if (arg == null) { - Nothing? castArg = (Nothing?) arg; - return validateAndBox(castArg, configuration); - } else if (arg instanceof Boolean booleanArg) { - boolean castArg = booleanArg; - return validateAndBox(castArg, configuration); - } else if (arg instanceof String castArg) { - return validateAndBox(castArg, configuration); - } else if (arg instanceof Number castArg) { - return validateAndBox(castArg, configuration); - } else if (arg instanceof List castArg) { - 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"); - } - } -} diff --git a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/schemas/SomeObject.kt b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/schemas/SomeObject.kt deleted file mode 100644 index daeed20c11e..00000000000 --- a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/schemas/SomeObject.kt +++ /dev/null @@ -1,329 +0,0 @@ -package org.openapijsonschematools.client.components.schemas; -import java.time.LocalDate; -import java.time.ZonedDateTime; -import java.util.ArrayList; -import java.util.HashSet; -import java.util.LinkedHashMap; -import java.util.LinkedHashSet; -import java.util.List; -import java.util.Map; -import java.util.Objects; -import java.util.Set; -import java.util.UUID; -import org.checkerframework.checker.nullness.qual.Nullable; -import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags; -import org.openapijsonschematools.client.configurations.SchemaConfiguration; -import org.openapijsonschematools.client.exceptions.InvalidAdditionalPropertyException; -import org.openapijsonschematools.client.exceptions.UnsetPropertyException; -import org.openapijsonschematools.client.exceptions.ValidationException; -import org.openapijsonschematools.client.schemas.UnsetAddPropsSetter; -import org.openapijsonschematools.client.schemas.validation.BooleanSchemaValidator; -import org.openapijsonschematools.client.schemas.validation.FrozenList; -import org.openapijsonschematools.client.schemas.validation.FrozenMap; -import org.openapijsonschematools.client.schemas.validation.JsonSchema; -import org.openapijsonschematools.client.schemas.validation.JsonSchemaInfo; -import org.openapijsonschematools.client.schemas.validation.ListSchemaValidator; -import org.openapijsonschematools.client.schemas.validation.MapSchemaValidator; -import org.openapijsonschematools.client.schemas.validation.NullSchemaValidator; -import org.openapijsonschematools.client.schemas.validation.NumberSchemaValidator; -import org.openapijsonschematools.client.schemas.validation.PathToSchemasMap; -import org.openapijsonschematools.client.schemas.validation.StringSchemaValidator; -import org.openapijsonschematools.client.schemas.validation.ValidationMetadata; - -public class SomeObject { - // nest classes so all schemas and input/output classes can be public - - - public sealed interface SomeObject1Boxed permits SomeObject1BoxedVoid, SomeObject1BoxedBoolean, SomeObject1BoxedNumber, SomeObject1BoxedString, SomeObject1BoxedList, SomeObject1BoxedMap { - @Nullable Object getData(); - } - - public record SomeObject1BoxedVoid(Nothing? data) implements SomeObject1Boxed { - @Override - public @Nullable Object getData() { - return data; - } - } - - public record SomeObject1BoxedBoolean(boolean data) implements SomeObject1Boxed { - @Override - public @Nullable Object getData() { - return data; - } - } - - public record SomeObject1BoxedNumber(Number data) implements SomeObject1Boxed { - @Override - public @Nullable Object getData() { - return data; - } - } - - public record SomeObject1BoxedString(String data) implements SomeObject1Boxed { - @Override - public @Nullable Object getData() { - return data; - } - } - - public record SomeObject1BoxedList(FrozenList<@Nullable Object> data) implements SomeObject1Boxed { - @Override - public @Nullable Object getData() { - return data; - } - } - - public record SomeObject1BoxedMap(FrozenMap<@Nullable Object> data) implements SomeObject1Boxed { - @Override - public @Nullable Object getData() { - return data; - } - } - - - public static class SomeObject1 extends JsonSchema implements NullSchemaValidator, BooleanSchemaValidator, NumberSchemaValidator, StringSchemaValidator, ListSchemaValidator, SomeObject1BoxedList>, MapSchemaValidator, SomeObject1BoxedMap> { - /* - NOTE: This class is auto generated by OpenAPI JSON Schema Generator. - Ref: https://github.com/openapi-json-schema-tools/openapi-json-schema-generator - - Do not edit the class manually. - */ - private static @Nullable SomeObject1 instance = null; - - protected SomeObject1() { - super(new JsonSchemaInfo() - .allOf(List.of( - ObjectInterface.ObjectInterface1.class - )) - ); - } - - public static SomeObject1 getInstance() { - if (instance == null) { - instance = new SomeObject1(); - } - return instance; - } - - @Override - public Nothing? validate(Nothing? arg, SchemaConfiguration configuration) throws ValidationException { - Set> pathSet = new HashSet<>(); - List pathToItem = List.of("args[0]"); - Nothing? castArg = castToAllowedTypes(arg, pathToItem, pathSet); - SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().build())); - PathToSchemasMap validatedPathToSchemas = new PathToSchemasMap(); - ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, new LinkedHashSet<>()); - getPathToSchemas(this, castArg, validationMetadata, pathSet); - return castArg; - } - - @Override - public boolean validate(boolean arg, SchemaConfiguration configuration) throws ValidationException { - Set> pathSet = new HashSet<>(); - List pathToItem = List.of("args[0]"); - boolean castArg = castToAllowedTypes(arg, pathToItem, pathSet); - SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().build())); - PathToSchemasMap validatedPathToSchemas = new PathToSchemasMap(); - ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, new LinkedHashSet<>()); - getPathToSchemas(this, castArg, validationMetadata, pathSet); - return castArg; - } - - @Override - public Number validate(Number arg, SchemaConfiguration configuration) throws ValidationException { - Set> pathSet = new HashSet<>(); - List pathToItem = List.of("args[0]"); - Number castArg = castToAllowedTypes(arg, pathToItem, pathSet); - SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().build())); - PathToSchemasMap validatedPathToSchemas = new PathToSchemasMap(); - ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, new LinkedHashSet<>()); - getPathToSchemas(this, castArg, validationMetadata, pathSet); - return castArg; - } - - public int validate(int arg, SchemaConfiguration configuration) throws ValidationException { - return (int) validate((Number) arg, configuration); - } - - public long validate(long arg, SchemaConfiguration configuration) throws ValidationException { - return (long) validate((Number) arg, configuration); - } - - public float validate(float arg, SchemaConfiguration configuration) throws ValidationException { - return (float) validate((Number) arg, configuration); - } - - public double validate(double arg, SchemaConfiguration configuration) throws ValidationException { - return (double) validate((Number) arg, configuration); - } - - @Override - public String validate(String arg, SchemaConfiguration configuration) throws ValidationException { - Set> pathSet = new HashSet<>(); - List pathToItem = List.of("args[0]"); - String castArg = castToAllowedTypes(arg, pathToItem, pathSet); - SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().build())); - PathToSchemasMap validatedPathToSchemas = new PathToSchemasMap(); - ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, new LinkedHashSet<>()); - getPathToSchemas(this, castArg, validationMetadata, pathSet); - return castArg; - } - - public String validate(LocalDate arg, SchemaConfiguration configuration) throws ValidationException { - return validate(arg.toString(), configuration); - } - - public String validate(ZonedDateTime arg, SchemaConfiguration configuration) throws ValidationException { - return validate(arg.toString(), configuration); - } - - public String validate(UUID arg, SchemaConfiguration configuration) throws ValidationException { - return validate(arg.toString(), configuration); - } - - @Override - public FrozenList<@Nullable Object> getNewInstance(List arg, List pathToItem, PathToSchemasMap pathToSchemas) { - List<@Nullable Object> items = new ArrayList<>(); - int i = 0; - for (Object item: arg) { - List itemPathToItem = new ArrayList<>(pathToItem); - itemPathToItem.add(i); - LinkedHashMap, Nothing?> schemas = pathToSchemas.get(itemPathToItem); - if (schemas == null) { - throw new RuntimeException("Validation result is invalid, schemas must exist for a pathToItem"); - } - JsonSchema itemSchema = schemas.entrySet().iterator().next().getKey(); - @Nullable Object itemInstance = itemSchema.getNewInstance(item, itemPathToItem, pathToSchemas); - items.add(itemInstance); - i += 1; - } - FrozenList<@Nullable Object> newInstanceItems = new FrozenList<>(items); - return newInstanceItems; - } - - 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); - SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().build())); - ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, new PathToSchemasMap(), new LinkedHashSet<>()); - PathToSchemasMap pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet); - return getNewInstance(castArg, validationMetadata.pathToItem(), pathToSchemasMap); - } - - @Override - 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 RuntimeException("Invalid non-string key value"); - } - String propertyName = (String) entryKey; - List propertyPathToItem = new ArrayList<>(pathToItem); - propertyPathToItem.add(propertyName); - Object value = entry.getValue(); - LinkedHashMap, Nothing?> schemas = pathToSchemas.get(propertyPathToItem); - if (schemas == null) { - throw new RuntimeException("Validation result is invalid, schemas must exist for a pathToItem"); - } - JsonSchema propertySchema = schemas.entrySet().iterator().next().getKey(); - @Nullable Object propertyInstance = propertySchema.getNewInstance(value, propertyPathToItem, pathToSchemas); - properties.put(propertyName, propertyInstance); - } - FrozenMap<@Nullable Object> castProperties = new FrozenMap<>(properties); - return castProperties; - } - - public FrozenMap<@Nullable Object> validate(Map arg, SchemaConfiguration configuration) throws ValidationException { - Set> pathSet = new HashSet<>(); - List pathToItem = List.of("args[0]"); - Map castArg = castToAllowedTypes(arg, pathToItem, pathSet); - SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().build())); - PathToSchemasMap validatedPathToSchemas = new PathToSchemasMap(); - ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, new LinkedHashSet<>()); - PathToSchemasMap pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet); - return getNewInstance(castArg, validationMetadata.pathToItem(), pathToSchemasMap); - } - - @Override - public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { - if (arg == null) { - return validate((Nothing?) null, configuration); - } else if (arg instanceof Boolean) { - boolean boolArg = (Boolean) arg; - return validate(boolArg, configuration); - } else if (arg instanceof Number) { - return validate((Number) arg, configuration); - } else if (arg instanceof String) { - return validate((String) arg, configuration); - } else if (arg instanceof List) { - return validate((List) arg, 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"); - } - @Override - public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { - if (arg == null) { - return getNewInstance((Nothing?) null, pathToItem, pathToSchemas); - } else if (arg instanceof Boolean) { - boolean boolArg = (Boolean) arg; - return getNewInstance(boolArg, pathToItem, pathToSchemas); - } else if (arg instanceof Number) { - return getNewInstance((Number) arg, pathToItem, pathToSchemas); - } else if (arg instanceof String) { - return getNewInstance((String) arg, pathToItem, pathToSchemas); - } else if (arg instanceof List) { - return getNewInstance((List) arg, 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"); - } - @Override - public SomeObject1BoxedVoid validateAndBox(Nothing? arg, SchemaConfiguration configuration) throws ValidationException { - return new SomeObject1BoxedVoid(validate(arg, configuration)); - } - @Override - 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 { - return new SomeObject1BoxedNumber(validate(arg, configuration)); - } - @Override - 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 { - return new SomeObject1BoxedList(validate(arg, configuration)); - } - @Override - 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 { - if (arg == null) { - Nothing? castArg = (Nothing?) arg; - return validateAndBox(castArg, configuration); - } else if (arg instanceof Boolean booleanArg) { - boolean castArg = booleanArg; - return validateAndBox(castArg, configuration); - } else if (arg instanceof String castArg) { - return validateAndBox(castArg, configuration); - } else if (arg instanceof Number castArg) { - return validateAndBox(castArg, configuration); - } else if (arg instanceof List castArg) { - 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"); - } - } -} diff --git a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/schemas/SpecialModelname.kt b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/schemas/SpecialModelname.kt deleted file mode 100644 index bb17489d327..00000000000 --- a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/schemas/SpecialModelname.kt +++ /dev/null @@ -1,208 +0,0 @@ -package org.openapijsonschematools.client.components.schemas; -import java.util.ArrayList; -import java.util.HashSet; -import java.util.LinkedHashMap; -import java.util.LinkedHashSet; -import java.util.List; -import java.util.Map; -import java.util.Objects; -import java.util.Set; -import org.checkerframework.checker.nullness.qual.Nullable; -import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags; -import org.openapijsonschematools.client.configurations.SchemaConfiguration; -import org.openapijsonschematools.client.exceptions.InvalidAdditionalPropertyException; -import org.openapijsonschematools.client.exceptions.UnsetPropertyException; -import org.openapijsonschematools.client.exceptions.ValidationException; -import org.openapijsonschematools.client.schemas.GenericBuilder; -import org.openapijsonschematools.client.schemas.StringJsonSchema; -import org.openapijsonschematools.client.schemas.UnsetAddPropsSetter; -import org.openapijsonschematools.client.schemas.validation.FrozenMap; -import org.openapijsonschematools.client.schemas.validation.JsonSchema; -import org.openapijsonschematools.client.schemas.validation.JsonSchemaInfo; -import org.openapijsonschematools.client.schemas.validation.MapSchemaValidator; -import org.openapijsonschematools.client.schemas.validation.PathToSchemasMap; -import org.openapijsonschematools.client.schemas.validation.PropertyEntry; -import org.openapijsonschematools.client.schemas.validation.ValidationMetadata; - -public class SpecialModelname { - // nest classes so all schemas and input/output classes can be public - - - public static class A extends StringJsonSchema.StringJsonSchema1 { - private static @Nullable A instance = null; - public static A getInstance() { - if (instance == null) { - instance = new A(); - } - return instance; - } - } - - - public static class SpecialModelnameMap extends FrozenMap<@Nullable Object> { - protected SpecialModelnameMap(FrozenMap<@Nullable Object> m) { - super(m); - } - public static final Set requiredKeys = Set.of(); - public static final Set optionalKeys = Set.of( - "a" - ); - public static SpecialModelnameMap of(Map arg, SchemaConfiguration configuration) throws ValidationException { - return SpecialModelname1.getInstance().validate(arg, configuration); - } - - public String a() throws UnsetPropertyException { - String key = "a"; - throwIfKeyNotPresent(key); - @Nullable Object value = get(key); - if (!(value instanceof String)) { - throw new RuntimeException("Invalid value stored for a"); - } - return (String) value; - } - - public @Nullable Object getAdditionalProperty(String name) throws UnsetPropertyException, InvalidAdditionalPropertyException { - throwIfKeyKnown(name, requiredKeys, optionalKeys); - throwIfKeyNotPresent(name); - return get(name); - } - } - - public interface SetterForA { - Map getInstance(); - T getBuilderAfterA(Map instance); - - default T a(String value) { - var instance = getInstance(); - instance.put("a", value); - return getBuilderAfterA(instance); - } - } - - public static class SpecialModelnameMapBuilder extends UnsetAddPropsSetter implements GenericBuilder>, SetterForA { - private final Map instance; - private static final Set knownKeys = Set.of( - "a" - ); - public Set getKnownKeys() { - return knownKeys; - } - public SpecialModelnameMapBuilder() { - this.instance = new LinkedHashMap<>(); - } - public Map build() { - return instance; - } - public Map getInstance() { - return instance; - } - public SpecialModelnameMapBuilder getBuilderAfterA(Map instance) { - return this; - } - public SpecialModelnameMapBuilder getBuilderAfterAdditionalProperty(Map instance) { - return this; - } - } - - - public sealed interface SpecialModelname1Boxed permits SpecialModelname1BoxedMap { - @Nullable Object getData(); - } - - public record SpecialModelname1BoxedMap(SpecialModelnameMap data) implements SpecialModelname1Boxed { - @Override - public @Nullable Object getData() { - return data; - } - } - - - public static class SpecialModelname1 extends JsonSchema implements MapSchemaValidator { - /* - NOTE: This class is auto generated by OpenAPI JSON Schema Generator. - Ref: https://github.com/openapi-json-schema-tools/openapi-json-schema-generator - - Do not edit the class manually. - - model with an invalid class name for python - */ - private static @Nullable SpecialModelname1 instance = null; - - protected SpecialModelname1() { - super(new JsonSchemaInfo() - .type(Set.of(Map.class)) - .properties(Map.ofEntries( - new PropertyEntry("a", A.class) - )) - ); - } - - public static SpecialModelname1 getInstance() { - if (instance == null) { - instance = new SpecialModelname1(); - } - return instance; - } - - 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 RuntimeException("Invalid non-string key value"); - } - String propertyName = (String) entryKey; - List propertyPathToItem = new ArrayList<>(pathToItem); - propertyPathToItem.add(propertyName); - Object value = entry.getValue(); - LinkedHashMap, Nothing?> schemas = pathToSchemas.get(propertyPathToItem); - if (schemas == null) { - throw new RuntimeException("Validation result is invalid, schemas must exist for a pathToItem"); - } - JsonSchema propertySchema = schemas.entrySet().iterator().next().getKey(); - @Nullable Object propertyInstance = propertySchema.getNewInstance(value, propertyPathToItem, pathToSchemas); - properties.put(propertyName, propertyInstance); - } - FrozenMap<@Nullable Object> castProperties = new FrozenMap<>(properties); - return new SpecialModelnameMap(castProperties); - } - - 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); - SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().build())); - ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, new PathToSchemasMap(), new LinkedHashSet<>()); - PathToSchemasMap pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet); - return getNewInstance(castArg, validationMetadata.pathToItem(), pathToSchemasMap); - } - - - @Override - public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws 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"); - } - @Override - public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { - if (arg instanceof Map) { - return getNewInstance((Map) arg, pathToItem, pathToSchemas); - } - 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 { - return new SpecialModelname1BoxedMap(validate(arg, configuration)); - } - @Override - public SpecialModelname1Boxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { - 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"); - } - } - -} diff --git a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/schemas/StringBooleanMap.kt b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/schemas/StringBooleanMap.kt deleted file mode 100644 index bba1d435632..00000000000 --- a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/schemas/StringBooleanMap.kt +++ /dev/null @@ -1,194 +0,0 @@ -package org.openapijsonschematools.client.components.schemas; -import java.util.ArrayList; -import java.util.HashSet; -import java.util.LinkedHashMap; -import java.util.LinkedHashSet; -import java.util.List; -import java.util.Map; -import java.util.Objects; -import java.util.Set; -import org.checkerframework.checker.nullness.qual.Nullable; -import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags; -import org.openapijsonschematools.client.configurations.SchemaConfiguration; -import org.openapijsonschematools.client.exceptions.InvalidAdditionalPropertyException; -import org.openapijsonschematools.client.exceptions.UnsetPropertyException; -import org.openapijsonschematools.client.exceptions.ValidationException; -import org.openapijsonschematools.client.schemas.BooleanJsonSchema; -import org.openapijsonschematools.client.schemas.GenericBuilder; -import org.openapijsonschematools.client.schemas.validation.FrozenMap; -import org.openapijsonschematools.client.schemas.validation.JsonSchema; -import org.openapijsonschematools.client.schemas.validation.JsonSchemaInfo; -import org.openapijsonschematools.client.schemas.validation.MapSchemaValidator; -import org.openapijsonschematools.client.schemas.validation.MapUtils; -import org.openapijsonschematools.client.schemas.validation.PathToSchemasMap; -import org.openapijsonschematools.client.schemas.validation.ValidationMetadata; - -public class StringBooleanMap { - // nest classes so all schemas and input/output classes can be public - - - public static class AdditionalProperties extends BooleanJsonSchema.BooleanJsonSchema1 { - private static @Nullable AdditionalProperties instance = null; - public static AdditionalProperties getInstance() { - if (instance == null) { - instance = new AdditionalProperties(); - } - return instance; - } - } - - - public static class StringBooleanMapMap extends FrozenMap { - protected StringBooleanMapMap(FrozenMap m) { - super(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 { - return StringBooleanMap1.getInstance().validate(arg, configuration); - } - - public boolean getAdditionalProperty(String name) throws UnsetPropertyException { - throwIfKeyNotPresent(name); - Boolean value = get(name); - if (value == null) { - throw new RuntimeException("Value may not be null"); - } - return (boolean) value; - } - } - - public interface SetterForAdditionalProperties { - Set getKnownKeys(); - Map getInstance(); - T getBuilderAfterAdditionalProperty(Map instance); - - default T additionalProperty(String key, boolean value) throws InvalidAdditionalPropertyException { - MapUtils.throwIfKeyKnown(key, getKnownKeys(), true); - var instance = getInstance(); - instance.put(key, value); - return getBuilderAfterAdditionalProperty(instance); - } - } - - public static class StringBooleanMapMapBuilder implements GenericBuilder>, SetterForAdditionalProperties { - private final Map instance; - private static final Set knownKeys = Set.of(); - public Set getKnownKeys() { - return knownKeys; - } - public StringBooleanMapMapBuilder() { - this.instance = new LinkedHashMap<>(); - } - public Map build() { - return instance; - } - public Map getInstance() { - return instance; - } - public StringBooleanMapMapBuilder getBuilderAfterAdditionalProperty(Map instance) { - return this; - } - } - - - public sealed interface StringBooleanMap1Boxed permits StringBooleanMap1BoxedMap { - @Nullable Object getData(); - } - - public record StringBooleanMap1BoxedMap(StringBooleanMapMap data) implements StringBooleanMap1Boxed { - @Override - public @Nullable Object getData() { - return data; - } - } - - - public static class StringBooleanMap1 extends JsonSchema implements MapSchemaValidator { - /* - NOTE: This class is auto generated by OpenAPI JSON Schema Generator. - Ref: https://github.com/openapi-json-schema-tools/openapi-json-schema-generator - - Do not edit the class manually. - */ - private static @Nullable StringBooleanMap1 instance = null; - - protected StringBooleanMap1() { - super(new JsonSchemaInfo() - .type(Set.of(Map.class)) - .additionalProperties(AdditionalProperties.class) - ); - } - - public static StringBooleanMap1 getInstance() { - if (instance == null) { - instance = new StringBooleanMap1(); - } - return instance; - } - - 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 RuntimeException("Invalid non-string key value"); - } - String propertyName = (String) entryKey; - List propertyPathToItem = new ArrayList<>(pathToItem); - propertyPathToItem.add(propertyName); - Object value = entry.getValue(); - LinkedHashMap, Nothing?> schemas = pathToSchemas.get(propertyPathToItem); - if (schemas == null) { - throw new RuntimeException("Validation 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"); - } - properties.put(propertyName, (Boolean) propertyInstance); - } - FrozenMap castProperties = new FrozenMap<>(properties); - return new StringBooleanMapMap(castProperties); - } - - 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); - SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().build())); - ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, new PathToSchemasMap(), new LinkedHashSet<>()); - PathToSchemasMap pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet); - return getNewInstance(castArg, validationMetadata.pathToItem(), pathToSchemasMap); - } - - - @Override - public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws 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"); - } - @Override - public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { - if (arg instanceof Map) { - return getNewInstance((Map) arg, pathToItem, pathToSchemas); - } - 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 { - return new StringBooleanMap1BoxedMap(validate(arg, configuration)); - } - @Override - public StringBooleanMap1Boxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { - 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"); - } - } - -} diff --git a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/schemas/StringEnum.kt b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/schemas/StringEnum.kt deleted file mode 100644 index 39c7da3e835..00000000000 --- a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/schemas/StringEnum.kt +++ /dev/null @@ -1,180 +0,0 @@ -package org.openapijsonschematools.client.components.schemas; -import java.util.HashSet; -import java.util.LinkedHashSet; -import java.util.List; -import java.util.Map; -import java.util.Objects; -import java.util.Set; -import org.checkerframework.checker.nullness.qual.Nullable; -import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags; -import org.openapijsonschematools.client.configurations.SchemaConfiguration; -import org.openapijsonschematools.client.exceptions.ValidationException; -import org.openapijsonschematools.client.schemas.SetMaker; -import org.openapijsonschematools.client.schemas.validation.JsonSchema; -import org.openapijsonschematools.client.schemas.validation.JsonSchemaInfo; -import org.openapijsonschematools.client.schemas.validation.NullEnumValidator; -import org.openapijsonschematools.client.schemas.validation.NullSchemaValidator; -import org.openapijsonschematools.client.schemas.validation.NullValueMethod; -import org.openapijsonschematools.client.schemas.validation.PathToSchemasMap; -import org.openapijsonschematools.client.schemas.validation.StringEnumValidator; -import org.openapijsonschematools.client.schemas.validation.StringSchemaValidator; -import org.openapijsonschematools.client.schemas.validation.StringValueMethod; -import org.openapijsonschematools.client.schemas.validation.ValidationMetadata; - -public class StringEnum { - // nest classes so all schemas and input/output classes can be public - - public enum StringStringEnumEnums implements StringValueMethod { - PLACED("placed"), - APPROVED("approved"), - DELIVERED("delivered"), - SINGLE_QUOTED("single quoted"), - MULTIPLE_LINE_FEED_LF_LINES("multiple\nlines"), - DOUBLE_QUOTE_LINE_FEED_LF_WITH_NEWLINE("double quote \n with newline"); - private final String value; - - StringStringEnumEnums(String value) { - this.value = value; - } - public String value() { - return this.value; - } - } - - public enum NullStringEnumEnums implements NullValueMethod { - NONE(null); - private final Nothing? value; - - NullStringEnumEnums(Nothing? value) { - this.value = value; - } - public Nothing? value() { - return this.value; - } - } - - - public sealed interface StringEnum1Boxed permits StringEnum1BoxedNothing?, StringEnum1BoxedString { - @Nullable Object getData(); - } - - public record StringEnum1BoxedVoid(Nothing? data) implements StringEnum1Boxed { - @Override - public @Nullable Object getData() { - return data; - } - } - - public record StringEnum1BoxedString(String data) implements StringEnum1Boxed { - @Override - public @Nullable Object getData() { - return data; - } - } - - - - public static class StringEnum1 extends JsonSchema implements NullEnumValidator, StringEnumValidator, NullSchemaValidator, StringSchemaValidator { - /* - NOTE: This class is auto generated by OpenAPI JSON Schema Generator. - Ref: https://github.com/openapi-json-schema-tools/openapi-json-schema-generator - - Do not edit the class manually. - */ - private static @Nullable StringEnum1 instance = null; - - protected StringEnum1() { - super(new JsonSchemaInfo() - .type(Set.of( - Nothing?.class, - String.class - )) - .enumValues(SetMaker.makeSet( - "placed", - "approved", - "delivered", - "single quoted", - "multiple\nlines", - "double quote \n with newline", - null - )) - ); - } - - public static StringEnum1 getInstance() { - if (instance == null) { - instance = new StringEnum1(); - } - return instance; - } - - @Override - public Nothing? validate(Nothing? arg, SchemaConfiguration configuration) throws ValidationException { - Set> pathSet = new HashSet<>(); - List pathToItem = List.of("args[0"); - Nothing? castArg = castToAllowedTypes(arg, pathToItem, pathSet); - SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().build())); - ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, new PathToSchemasMap(), new LinkedHashSet<>()); - getPathToSchemas(this, castArg, validationMetadata, pathSet); - return castArg; - } - - @Override - public String validate(String arg, SchemaConfiguration configuration) throws ValidationException { - Set> pathSet = new HashSet<>(); - List pathToItem = List.of("args[0"); - String castArg = castToAllowedTypes(arg, pathToItem, pathSet); - SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().build())); - ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, new PathToSchemasMap(), new LinkedHashSet<>()); - getPathToSchemas(this, castArg, validationMetadata, pathSet); - return castArg; - } - - @Override - public Nothing? validate(NullStringEnumEnums arg,SchemaConfiguration configuration) throws ValidationException { - return validate(arg.value(), configuration); - } - - @Override - 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 { - if (arg == null) { - return validate((Nothing?) 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"); - } - @Override - public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { - if (arg == null) { - return getNewInstance((Nothing?) 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"); - } - @Override - public StringEnum1BoxedVoid validateAndBox(Nothing? arg, SchemaConfiguration configuration) throws ValidationException { - return new StringEnum1BoxedVoid(validate(arg, configuration)); - } - @Override - 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 { - if (arg == null) { - Nothing? castArg = (Nothing?) 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"); - } - } -} diff --git a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/schemas/StringEnumWithDefaultValue.kt b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/schemas/StringEnumWithDefaultValue.kt deleted file mode 100644 index 96e3eee226b..00000000000 --- a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/schemas/StringEnumWithDefaultValue.kt +++ /dev/null @@ -1,130 +0,0 @@ -package org.openapijsonschematools.client.components.schemas; -import java.util.HashSet; -import java.util.LinkedHashSet; -import java.util.List; -import java.util.Objects; -import java.util.Set; -import org.checkerframework.checker.nullness.qual.Nullable; -import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags; -import org.openapijsonschematools.client.configurations.SchemaConfiguration; -import org.openapijsonschematools.client.exceptions.ValidationException; -import org.openapijsonschematools.client.schemas.SetMaker; -import org.openapijsonschematools.client.schemas.validation.DefaultValueMethod; -import org.openapijsonschematools.client.schemas.validation.JsonSchema; -import org.openapijsonschematools.client.schemas.validation.JsonSchemaInfo; -import org.openapijsonschematools.client.schemas.validation.PathToSchemasMap; -import org.openapijsonschematools.client.schemas.validation.StringEnumValidator; -import org.openapijsonschematools.client.schemas.validation.StringSchemaValidator; -import org.openapijsonschematools.client.schemas.validation.StringValueMethod; -import org.openapijsonschematools.client.schemas.validation.ValidationMetadata; - -public class StringEnumWithDefaultValue { - // nest classes so all schemas and input/output classes can be public - - public enum StringStringEnumWithDefaultValueEnums implements StringValueMethod { - PLACED("placed"), - APPROVED("approved"), - DELIVERED("delivered"); - private final String value; - - StringStringEnumWithDefaultValueEnums(String value) { - this.value = value; - } - public String value() { - return this.value; - } - } - - - public sealed interface StringEnumWithDefaultValue1Boxed permits StringEnumWithDefaultValue1BoxedString { - @Nullable Object getData(); - } - - public record StringEnumWithDefaultValue1BoxedString(String data) implements StringEnumWithDefaultValue1Boxed { - @Override - public @Nullable Object getData() { - return data; - } - } - - - - public static class StringEnumWithDefaultValue1 extends JsonSchema implements StringSchemaValidator, StringEnumValidator, DefaultValueMethod { - /* - NOTE: This class is auto generated by OpenAPI JSON Schema Generator. - Ref: https://github.com/openapi-json-schema-tools/openapi-json-schema-generator - - Do not edit the class manually. - */ - private static @Nullable StringEnumWithDefaultValue1 instance = null; - - protected StringEnumWithDefaultValue1() { - super(new JsonSchemaInfo() - .type(Set.of( - String.class - )) - .enumValues(SetMaker.makeSet( - "placed", - "approved", - "delivered" - )) - .defaultValue("placed") - ); - } - - public static StringEnumWithDefaultValue1 getInstance() { - if (instance == null) { - instance = new StringEnumWithDefaultValue1(); - } - return instance; - } - - @Override - public String validate(String arg, SchemaConfiguration configuration) throws ValidationException { - Set> pathSet = new HashSet<>(); - List pathToItem = List.of("args[0"); - String castArg = castToAllowedTypes(arg, pathToItem, pathSet); - SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().build())); - ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, new PathToSchemasMap(), new LinkedHashSet<>()); - getPathToSchemas(this, castArg, validationMetadata, pathSet); - return castArg; - } - - @Override - 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 { - 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"); - } - @Override - public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { - 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"); - } - public String defaultValue() throws ValidationException { - if (defaultValue instanceof String) { - return (String) defaultValue; - } - throw new ValidationException("Invalid type stored in defaultValue"); - } - @Override - 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 { - 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"); - } - } -} diff --git a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/schemas/StringSchema.kt b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/schemas/StringSchema.kt deleted file mode 100644 index 29f80f23a68..00000000000 --- a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/schemas/StringSchema.kt +++ /dev/null @@ -1,19 +0,0 @@ -package org.openapijsonschematools.client.components.schemas; -import org.checkerframework.checker.nullness.qual.Nullable; -import org.openapijsonschematools.client.schemas.StringJsonSchema; - -public class StringSchema extends StringJsonSchema { - // nest classes so all schemas and input/output classes can be public - - - public static class StringSchema1 extends StringJsonSchema.StringJsonSchema1 { - private static @Nullable StringSchema1 instance = null; - public static StringSchema1 getInstance() { - if (instance == null) { - instance = new StringSchema1(); - } - return instance; - } - } - -} diff --git a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/schemas/StringWithValidation.kt b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/schemas/StringWithValidation.kt deleted file mode 100644 index 9771f084f29..00000000000 --- a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/schemas/StringWithValidation.kt +++ /dev/null @@ -1,96 +0,0 @@ -package org.openapijsonschematools.client.components.schemas; -import java.util.HashSet; -import java.util.LinkedHashSet; -import java.util.List; -import java.util.Objects; -import java.util.Set; -import org.checkerframework.checker.nullness.qual.Nullable; -import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags; -import org.openapijsonschematools.client.configurations.SchemaConfiguration; -import org.openapijsonschematools.client.exceptions.ValidationException; -import org.openapijsonschematools.client.schemas.validation.JsonSchema; -import org.openapijsonschematools.client.schemas.validation.JsonSchemaInfo; -import org.openapijsonschematools.client.schemas.validation.PathToSchemasMap; -import org.openapijsonschematools.client.schemas.validation.StringSchemaValidator; -import org.openapijsonschematools.client.schemas.validation.ValidationMetadata; - -public class StringWithValidation { - // nest classes so all schemas and input/output classes can be public - - - public sealed interface StringWithValidation1Boxed permits StringWithValidation1BoxedString { - @Nullable Object getData(); - } - - public record StringWithValidation1BoxedString(String data) implements StringWithValidation1Boxed { - @Override - public @Nullable Object getData() { - return data; - } - } - - - - public static class StringWithValidation1 extends JsonSchema implements StringSchemaValidator { - /* - NOTE: This class is auto generated by OpenAPI JSON Schema Generator. - Ref: https://github.com/openapi-json-schema-tools/openapi-json-schema-generator - - Do not edit the class manually. - */ - private static @Nullable StringWithValidation1 instance = null; - - protected StringWithValidation1() { - super(new JsonSchemaInfo() - .type(Set.of( - String.class - )) - .minLength(7) - ); - } - - public static StringWithValidation1 getInstance() { - if (instance == null) { - instance = new StringWithValidation1(); - } - return instance; - } - - @Override - public String validate(String arg, SchemaConfiguration configuration) throws ValidationException { - Set> pathSet = new HashSet<>(); - List pathToItem = List.of("args[0"); - String castArg = castToAllowedTypes(arg, pathToItem, pathSet); - SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().build())); - ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, new PathToSchemasMap(), new LinkedHashSet<>()); - getPathToSchemas(this, castArg, validationMetadata, pathSet); - return castArg; - } - - @Override - public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws 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"); - } - @Override - public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { - 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"); - } - @Override - 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 { - 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"); - } - } -} diff --git a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/schemas/Tag.kt b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/schemas/Tag.kt deleted file mode 100644 index e00dca0a596..00000000000 --- a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/schemas/Tag.kt +++ /dev/null @@ -1,263 +0,0 @@ -package org.openapijsonschematools.client.components.schemas; -import java.util.ArrayList; -import java.util.HashSet; -import java.util.LinkedHashMap; -import java.util.LinkedHashSet; -import java.util.List; -import java.util.Map; -import java.util.Objects; -import java.util.Set; -import org.checkerframework.checker.nullness.qual.Nullable; -import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags; -import org.openapijsonschematools.client.configurations.SchemaConfiguration; -import org.openapijsonschematools.client.exceptions.InvalidAdditionalPropertyException; -import org.openapijsonschematools.client.exceptions.UnsetPropertyException; -import org.openapijsonschematools.client.exceptions.ValidationException; -import org.openapijsonschematools.client.schemas.GenericBuilder; -import org.openapijsonschematools.client.schemas.Int64JsonSchema; -import org.openapijsonschematools.client.schemas.StringJsonSchema; -import org.openapijsonschematools.client.schemas.UnsetAddPropsSetter; -import org.openapijsonschematools.client.schemas.validation.FrozenMap; -import org.openapijsonschematools.client.schemas.validation.JsonSchema; -import org.openapijsonschematools.client.schemas.validation.JsonSchemaInfo; -import org.openapijsonschematools.client.schemas.validation.MapSchemaValidator; -import org.openapijsonschematools.client.schemas.validation.PathToSchemasMap; -import org.openapijsonschematools.client.schemas.validation.PropertyEntry; -import org.openapijsonschematools.client.schemas.validation.ValidationMetadata; - -public class Tag { - // nest classes so all schemas and input/output classes can be public - - - public static class Id extends Int64JsonSchema.Int64JsonSchema1 { - private static @Nullable Id instance = null; - public static Id getInstance() { - if (instance == null) { - instance = new Id(); - } - return instance; - } - } - - - public static class Name extends StringJsonSchema.StringJsonSchema1 { - private static @Nullable Name instance = null; - public static Name getInstance() { - if (instance == null) { - instance = new Name(); - } - return instance; - } - } - - - public static class TagMap extends FrozenMap<@Nullable Object> { - protected TagMap(FrozenMap<@Nullable Object> m) { - super(m); - } - public static final Set requiredKeys = Set.of(); - public static final Set optionalKeys = Set.of( - "id", - "name" - ); - public static TagMap of(Map arg, SchemaConfiguration configuration) throws ValidationException { - return Tag1.getInstance().validate(arg, configuration); - } - - public Number id() throws UnsetPropertyException { - String key = "id"; - throwIfKeyNotPresent(key); - @Nullable Object value = get(key); - if (!(value instanceof Number)) { - throw new RuntimeException("Invalid value stored for id"); - } - return (Number) value; - } - - public String name() throws UnsetPropertyException { - String key = "name"; - throwIfKeyNotPresent(key); - @Nullable Object value = get(key); - if (!(value instanceof String)) { - throw new RuntimeException("Invalid value stored for name"); - } - return (String) value; - } - - public @Nullable Object getAdditionalProperty(String name) throws UnsetPropertyException, InvalidAdditionalPropertyException { - throwIfKeyKnown(name, requiredKeys, optionalKeys); - throwIfKeyNotPresent(name); - return get(name); - } - } - - public interface SetterForId { - Map getInstance(); - T getBuilderAfterId(Map instance); - - default T id(int value) { - var instance = getInstance(); - instance.put("id", value); - return getBuilderAfterId(instance); - } - - default T id(float value) { - var instance = getInstance(); - instance.put("id", value); - return getBuilderAfterId(instance); - } - - default T id(long value) { - var instance = getInstance(); - instance.put("id", value); - return getBuilderAfterId(instance); - } - - default T id(double value) { - var instance = getInstance(); - instance.put("id", value); - return getBuilderAfterId(instance); - } - } - - public interface SetterForName { - Map getInstance(); - T getBuilderAfterName(Map instance); - - default T name(String value) { - var instance = getInstance(); - instance.put("name", value); - return getBuilderAfterName(instance); - } - } - - public static class TagMapBuilder extends UnsetAddPropsSetter implements GenericBuilder>, SetterForId, SetterForName { - private final Map instance; - private static final Set knownKeys = Set.of( - "id", - "name" - ); - public Set getKnownKeys() { - return knownKeys; - } - public TagMapBuilder() { - this.instance = new LinkedHashMap<>(); - } - public Map build() { - return instance; - } - public Map getInstance() { - return instance; - } - public TagMapBuilder getBuilderAfterId(Map instance) { - return this; - } - public TagMapBuilder getBuilderAfterName(Map instance) { - return this; - } - public TagMapBuilder getBuilderAfterAdditionalProperty(Map instance) { - return this; - } - } - - - public sealed interface Tag1Boxed permits Tag1BoxedMap { - @Nullable Object getData(); - } - - public record Tag1BoxedMap(TagMap data) implements Tag1Boxed { - @Override - public @Nullable Object getData() { - return data; - } - } - - - public static class Tag1 extends JsonSchema implements MapSchemaValidator { - /* - NOTE: This class is auto generated by OpenAPI JSON Schema Generator. - Ref: https://github.com/openapi-json-schema-tools/openapi-json-schema-generator - - Do not edit the class manually. - */ - private static @Nullable Tag1 instance = null; - - protected Tag1() { - super(new JsonSchemaInfo() - .type(Set.of(Map.class)) - .properties(Map.ofEntries( - new PropertyEntry("id", Id.class), - new PropertyEntry("name", Name.class) - )) - ); - } - - public static Tag1 getInstance() { - if (instance == null) { - instance = new Tag1(); - } - return instance; - } - - 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 RuntimeException("Invalid non-string key value"); - } - String propertyName = (String) entryKey; - List propertyPathToItem = new ArrayList<>(pathToItem); - propertyPathToItem.add(propertyName); - Object value = entry.getValue(); - LinkedHashMap, Nothing?> schemas = pathToSchemas.get(propertyPathToItem); - if (schemas == null) { - throw new RuntimeException("Validation result is invalid, schemas must exist for a pathToItem"); - } - JsonSchema propertySchema = schemas.entrySet().iterator().next().getKey(); - @Nullable Object propertyInstance = propertySchema.getNewInstance(value, propertyPathToItem, pathToSchemas); - properties.put(propertyName, propertyInstance); - } - FrozenMap<@Nullable Object> castProperties = new FrozenMap<>(properties); - return new TagMap(castProperties); - } - - 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); - SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().build())); - ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, new PathToSchemasMap(), new LinkedHashSet<>()); - PathToSchemasMap pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet); - return getNewInstance(castArg, validationMetadata.pathToItem(), pathToSchemasMap); - } - - - @Override - public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws 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"); - } - @Override - public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { - if (arg instanceof Map) { - return getNewInstance((Map) arg, pathToItem, pathToSchemas); - } - 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 { - return new Tag1BoxedMap(validate(arg, configuration)); - } - @Override - public Tag1Boxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { - 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"); - } - } - -} diff --git a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/schemas/Triangle.kt b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/schemas/Triangle.kt deleted file mode 100644 index 3cdcd687786..00000000000 --- a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/schemas/Triangle.kt +++ /dev/null @@ -1,331 +0,0 @@ -package org.openapijsonschematools.client.components.schemas; -import java.time.LocalDate; -import java.time.ZonedDateTime; -import java.util.ArrayList; -import java.util.HashSet; -import java.util.LinkedHashMap; -import java.util.LinkedHashSet; -import java.util.List; -import java.util.Map; -import java.util.Objects; -import java.util.Set; -import java.util.UUID; -import org.checkerframework.checker.nullness.qual.Nullable; -import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags; -import org.openapijsonschematools.client.configurations.SchemaConfiguration; -import org.openapijsonschematools.client.exceptions.InvalidAdditionalPropertyException; -import org.openapijsonschematools.client.exceptions.UnsetPropertyException; -import org.openapijsonschematools.client.exceptions.ValidationException; -import org.openapijsonschematools.client.schemas.UnsetAddPropsSetter; -import org.openapijsonschematools.client.schemas.validation.BooleanSchemaValidator; -import org.openapijsonschematools.client.schemas.validation.FrozenList; -import org.openapijsonschematools.client.schemas.validation.FrozenMap; -import org.openapijsonschematools.client.schemas.validation.JsonSchema; -import org.openapijsonschematools.client.schemas.validation.JsonSchemaInfo; -import org.openapijsonschematools.client.schemas.validation.ListSchemaValidator; -import org.openapijsonschematools.client.schemas.validation.MapSchemaValidator; -import org.openapijsonschematools.client.schemas.validation.NullSchemaValidator; -import org.openapijsonschematools.client.schemas.validation.NumberSchemaValidator; -import org.openapijsonschematools.client.schemas.validation.PathToSchemasMap; -import org.openapijsonschematools.client.schemas.validation.StringSchemaValidator; -import org.openapijsonschematools.client.schemas.validation.ValidationMetadata; - -public class Triangle { - // nest classes so all schemas and input/output classes can be public - - - public sealed interface Triangle1Boxed permits Triangle1BoxedVoid, Triangle1BoxedBoolean, Triangle1BoxedNumber, Triangle1BoxedString, Triangle1BoxedList, Triangle1BoxedMap { - @Nullable Object getData(); - } - - public record Triangle1BoxedVoid(Nothing? data) implements Triangle1Boxed { - @Override - public @Nullable Object getData() { - return data; - } - } - - public record Triangle1BoxedBoolean(boolean data) implements Triangle1Boxed { - @Override - public @Nullable Object getData() { - return data; - } - } - - public record Triangle1BoxedNumber(Number data) implements Triangle1Boxed { - @Override - public @Nullable Object getData() { - return data; - } - } - - public record Triangle1BoxedString(String data) implements Triangle1Boxed { - @Override - public @Nullable Object getData() { - return data; - } - } - - public record Triangle1BoxedList(FrozenList<@Nullable Object> data) implements Triangle1Boxed { - @Override - public @Nullable Object getData() { - return data; - } - } - - public record Triangle1BoxedMap(FrozenMap<@Nullable Object> data) implements Triangle1Boxed { - @Override - public @Nullable Object getData() { - return data; - } - } - - - public static class Triangle1 extends JsonSchema implements NullSchemaValidator, BooleanSchemaValidator, NumberSchemaValidator, StringSchemaValidator, ListSchemaValidator, Triangle1BoxedList>, MapSchemaValidator, Triangle1BoxedMap> { - /* - NOTE: This class is auto generated by OpenAPI JSON Schema Generator. - Ref: https://github.com/openapi-json-schema-tools/openapi-json-schema-generator - - Do not edit the class manually. - */ - private static @Nullable Triangle1 instance = null; - - protected Triangle1() { - super(new JsonSchemaInfo() - .oneOf(List.of( - EquilateralTriangle.EquilateralTriangle1.class, - IsoscelesTriangle.IsoscelesTriangle1.class, - ScaleneTriangle.ScaleneTriangle1.class - )) - ); - } - - public static Triangle1 getInstance() { - if (instance == null) { - instance = new Triangle1(); - } - return instance; - } - - @Override - public Nothing? validate(Nothing? arg, SchemaConfiguration configuration) throws ValidationException { - Set> pathSet = new HashSet<>(); - List pathToItem = List.of("args[0]"); - Nothing? castArg = castToAllowedTypes(arg, pathToItem, pathSet); - SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().build())); - PathToSchemasMap validatedPathToSchemas = new PathToSchemasMap(); - ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, new LinkedHashSet<>()); - getPathToSchemas(this, castArg, validationMetadata, pathSet); - return castArg; - } - - @Override - public boolean validate(boolean arg, SchemaConfiguration configuration) throws ValidationException { - Set> pathSet = new HashSet<>(); - List pathToItem = List.of("args[0]"); - boolean castArg = castToAllowedTypes(arg, pathToItem, pathSet); - SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().build())); - PathToSchemasMap validatedPathToSchemas = new PathToSchemasMap(); - ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, new LinkedHashSet<>()); - getPathToSchemas(this, castArg, validationMetadata, pathSet); - return castArg; - } - - @Override - public Number validate(Number arg, SchemaConfiguration configuration) throws ValidationException { - Set> pathSet = new HashSet<>(); - List pathToItem = List.of("args[0]"); - Number castArg = castToAllowedTypes(arg, pathToItem, pathSet); - SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().build())); - PathToSchemasMap validatedPathToSchemas = new PathToSchemasMap(); - ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, new LinkedHashSet<>()); - getPathToSchemas(this, castArg, validationMetadata, pathSet); - return castArg; - } - - public int validate(int arg, SchemaConfiguration configuration) throws ValidationException { - return (int) validate((Number) arg, configuration); - } - - public long validate(long arg, SchemaConfiguration configuration) throws ValidationException { - return (long) validate((Number) arg, configuration); - } - - public float validate(float arg, SchemaConfiguration configuration) throws ValidationException { - return (float) validate((Number) arg, configuration); - } - - public double validate(double arg, SchemaConfiguration configuration) throws ValidationException { - return (double) validate((Number) arg, configuration); - } - - @Override - public String validate(String arg, SchemaConfiguration configuration) throws ValidationException { - Set> pathSet = new HashSet<>(); - List pathToItem = List.of("args[0]"); - String castArg = castToAllowedTypes(arg, pathToItem, pathSet); - SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().build())); - PathToSchemasMap validatedPathToSchemas = new PathToSchemasMap(); - ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, new LinkedHashSet<>()); - getPathToSchemas(this, castArg, validationMetadata, pathSet); - return castArg; - } - - public String validate(LocalDate arg, SchemaConfiguration configuration) throws ValidationException { - return validate(arg.toString(), configuration); - } - - public String validate(ZonedDateTime arg, SchemaConfiguration configuration) throws ValidationException { - return validate(arg.toString(), configuration); - } - - public String validate(UUID arg, SchemaConfiguration configuration) throws ValidationException { - return validate(arg.toString(), configuration); - } - - @Override - public FrozenList<@Nullable Object> getNewInstance(List arg, List pathToItem, PathToSchemasMap pathToSchemas) { - List<@Nullable Object> items = new ArrayList<>(); - int i = 0; - for (Object item: arg) { - List itemPathToItem = new ArrayList<>(pathToItem); - itemPathToItem.add(i); - LinkedHashMap, Nothing?> schemas = pathToSchemas.get(itemPathToItem); - if (schemas == null) { - throw new RuntimeException("Validation result is invalid, schemas must exist for a pathToItem"); - } - JsonSchema itemSchema = schemas.entrySet().iterator().next().getKey(); - @Nullable Object itemInstance = itemSchema.getNewInstance(item, itemPathToItem, pathToSchemas); - items.add(itemInstance); - i += 1; - } - FrozenList<@Nullable Object> newInstanceItems = new FrozenList<>(items); - return newInstanceItems; - } - - 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); - SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().build())); - ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, new PathToSchemasMap(), new LinkedHashSet<>()); - PathToSchemasMap pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet); - return getNewInstance(castArg, validationMetadata.pathToItem(), pathToSchemasMap); - } - - @Override - 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 RuntimeException("Invalid non-string key value"); - } - String propertyName = (String) entryKey; - List propertyPathToItem = new ArrayList<>(pathToItem); - propertyPathToItem.add(propertyName); - Object value = entry.getValue(); - LinkedHashMap, Nothing?> schemas = pathToSchemas.get(propertyPathToItem); - if (schemas == null) { - throw new RuntimeException("Validation result is invalid, schemas must exist for a pathToItem"); - } - JsonSchema propertySchema = schemas.entrySet().iterator().next().getKey(); - @Nullable Object propertyInstance = propertySchema.getNewInstance(value, propertyPathToItem, pathToSchemas); - properties.put(propertyName, propertyInstance); - } - FrozenMap<@Nullable Object> castProperties = new FrozenMap<>(properties); - return castProperties; - } - - public FrozenMap<@Nullable Object> validate(Map arg, SchemaConfiguration configuration) throws ValidationException { - Set> pathSet = new HashSet<>(); - List pathToItem = List.of("args[0]"); - Map castArg = castToAllowedTypes(arg, pathToItem, pathSet); - SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().build())); - PathToSchemasMap validatedPathToSchemas = new PathToSchemasMap(); - ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, new LinkedHashSet<>()); - PathToSchemasMap pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet); - return getNewInstance(castArg, validationMetadata.pathToItem(), pathToSchemasMap); - } - - @Override - public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { - if (arg == null) { - return validate((Nothing?) null, configuration); - } else if (arg instanceof Boolean) { - boolean boolArg = (Boolean) arg; - return validate(boolArg, configuration); - } else if (arg instanceof Number) { - return validate((Number) arg, configuration); - } else if (arg instanceof String) { - return validate((String) arg, configuration); - } else if (arg instanceof List) { - return validate((List) arg, 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"); - } - @Override - public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { - if (arg == null) { - return getNewInstance((Nothing?) null, pathToItem, pathToSchemas); - } else if (arg instanceof Boolean) { - boolean boolArg = (Boolean) arg; - return getNewInstance(boolArg, pathToItem, pathToSchemas); - } else if (arg instanceof Number) { - return getNewInstance((Number) arg, pathToItem, pathToSchemas); - } else if (arg instanceof String) { - return getNewInstance((String) arg, pathToItem, pathToSchemas); - } else if (arg instanceof List) { - return getNewInstance((List) arg, 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"); - } - @Override - public Triangle1BoxedVoid validateAndBox(Nothing? arg, SchemaConfiguration configuration) throws ValidationException { - return new Triangle1BoxedVoid(validate(arg, configuration)); - } - @Override - 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 { - return new Triangle1BoxedNumber(validate(arg, configuration)); - } - @Override - 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 { - return new Triangle1BoxedList(validate(arg, configuration)); - } - @Override - 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 { - if (arg == null) { - Nothing? castArg = (Nothing?) arg; - return validateAndBox(castArg, configuration); - } else if (arg instanceof Boolean booleanArg) { - boolean castArg = booleanArg; - return validateAndBox(castArg, configuration); - } else if (arg instanceof String castArg) { - return validateAndBox(castArg, configuration); - } else if (arg instanceof Number castArg) { - return validateAndBox(castArg, configuration); - } else if (arg instanceof List castArg) { - 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"); - } - } -} diff --git a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/schemas/TriangleInterface.kt b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/schemas/TriangleInterface.kt deleted file mode 100644 index e495953694a..00000000000 --- a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/schemas/TriangleInterface.kt +++ /dev/null @@ -1,570 +0,0 @@ -package org.openapijsonschematools.client.components.schemas; -import java.time.LocalDate; -import java.time.ZonedDateTime; -import java.util.ArrayList; -import java.util.HashSet; -import java.util.LinkedHashMap; -import java.util.LinkedHashSet; -import java.util.List; -import java.util.Map; -import java.util.Objects; -import java.util.Set; -import java.util.UUID; -import org.checkerframework.checker.nullness.qual.Nullable; -import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags; -import org.openapijsonschematools.client.configurations.SchemaConfiguration; -import org.openapijsonschematools.client.exceptions.InvalidAdditionalPropertyException; -import org.openapijsonschematools.client.exceptions.UnsetPropertyException; -import org.openapijsonschematools.client.exceptions.ValidationException; -import org.openapijsonschematools.client.schemas.GenericBuilder; -import org.openapijsonschematools.client.schemas.SetMaker; -import org.openapijsonschematools.client.schemas.StringJsonSchema; -import org.openapijsonschematools.client.schemas.UnsetAddPropsSetter; -import org.openapijsonschematools.client.schemas.validation.BooleanSchemaValidator; -import org.openapijsonschematools.client.schemas.validation.FrozenList; -import org.openapijsonschematools.client.schemas.validation.FrozenMap; -import org.openapijsonschematools.client.schemas.validation.JsonSchema; -import org.openapijsonschematools.client.schemas.validation.JsonSchemaInfo; -import org.openapijsonschematools.client.schemas.validation.ListSchemaValidator; -import org.openapijsonschematools.client.schemas.validation.MapSchemaValidator; -import org.openapijsonschematools.client.schemas.validation.NullSchemaValidator; -import org.openapijsonschematools.client.schemas.validation.NumberSchemaValidator; -import org.openapijsonschematools.client.schemas.validation.PathToSchemasMap; -import org.openapijsonschematools.client.schemas.validation.PropertyEntry; -import org.openapijsonschematools.client.schemas.validation.StringEnumValidator; -import org.openapijsonschematools.client.schemas.validation.StringSchemaValidator; -import org.openapijsonschematools.client.schemas.validation.StringValueMethod; -import org.openapijsonschematools.client.schemas.validation.ValidationMetadata; - -public class TriangleInterface { - // nest classes so all schemas and input/output classes can be public - - public enum StringShapeTypeEnums implements StringValueMethod { - TRIANGLE("Triangle"); - private final String value; - - StringShapeTypeEnums(String value) { - this.value = value; - } - public String value() { - return this.value; - } - } - - - public sealed interface ShapeTypeBoxed permits ShapeTypeBoxedString { - @Nullable Object getData(); - } - - public record ShapeTypeBoxedString(String data) implements ShapeTypeBoxed { - @Override - public @Nullable Object getData() { - return data; - } - } - - - - public static class ShapeType extends JsonSchema implements StringSchemaValidator, StringEnumValidator { - private static @Nullable ShapeType instance = null; - - protected ShapeType() { - super(new JsonSchemaInfo() - .type(Set.of( - String.class - )) - .enumValues(SetMaker.makeSet( - "Triangle" - )) - ); - } - - public static ShapeType getInstance() { - if (instance == null) { - instance = new ShapeType(); - } - return instance; - } - - @Override - public String validate(String arg, SchemaConfiguration configuration) throws ValidationException { - Set> pathSet = new HashSet<>(); - List pathToItem = List.of("args[0"); - String castArg = castToAllowedTypes(arg, pathToItem, pathSet); - SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().build())); - ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, new PathToSchemasMap(), new LinkedHashSet<>()); - getPathToSchemas(this, castArg, validationMetadata, pathSet); - return castArg; - } - - @Override - 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 { - 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"); - } - @Override - public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { - 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"); - } - @Override - 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 { - 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"); - } - } - - public static class TriangleType extends StringJsonSchema.StringJsonSchema1 { - private static @Nullable TriangleType instance = null; - public static TriangleType getInstance() { - if (instance == null) { - instance = new TriangleType(); - } - return instance; - } - } - - - public static class TriangleInterfaceMap extends FrozenMap<@Nullable Object> { - protected TriangleInterfaceMap(FrozenMap<@Nullable Object> m) { - super(m); - } - public static final Set requiredKeys = Set.of( - "shapeType", - "triangleType" - ); - public static final Set optionalKeys = Set.of(); - public static TriangleInterfaceMap of(Map arg, SchemaConfiguration configuration) throws ValidationException { - return TriangleInterface1.getInstance().validate(arg, configuration); - } - - public String shapeType() { - @Nullable Object value = get("shapeType"); - if (!(value instanceof String)) { - throw new RuntimeException("Invalid value stored for shapeType"); - } - return (String) value; - } - - public String triangleType() { - @Nullable Object value = get("triangleType"); - if (!(value instanceof String)) { - throw new RuntimeException("Invalid value stored for triangleType"); - } - return (String) value; - } - - public @Nullable Object getAdditionalProperty(String name) throws UnsetPropertyException, InvalidAdditionalPropertyException { - throwIfKeyKnown(name, requiredKeys, optionalKeys); - throwIfKeyNotPresent(name); - return get(name); - } - } - - public interface SetterForShapeType { - Map getInstance(); - T getBuilderAfterShapeType(Map instance); - - default T shapeType(String value) { - var instance = getInstance(); - instance.put("shapeType", value); - return getBuilderAfterShapeType(instance); - } - - default T shapeType(StringShapeTypeEnums value) { - var instance = getInstance(); - instance.put("shapeType", value.value()); - return getBuilderAfterShapeType(instance); - } - } - - public interface SetterForTriangleType { - Map getInstance(); - T getBuilderAfterTriangleType(Map instance); - - default T triangleType(String value) { - var instance = getInstance(); - instance.put("triangleType", value); - return getBuilderAfterTriangleType(instance); - } - } - - public static class TriangleInterfaceMap00Builder extends UnsetAddPropsSetter implements GenericBuilder> { - private final Map instance; - private static final Set knownKeys = Set.of( - "shapeType", - "triangleType" - ); - public Set getKnownKeys() { - return knownKeys; - } - public TriangleInterfaceMap00Builder(Map instance) { - this.instance = instance; - } - public Map build() { - return instance; - } - public Map getInstance() { - return instance; - } - public TriangleInterfaceMap00Builder getBuilderAfterAdditionalProperty(Map instance) { - return this; - } - } - - public static class TriangleInterfaceMap01Builder implements SetterForTriangleType { - private final Map instance; - public TriangleInterfaceMap01Builder(Map instance) { - this.instance = instance; - } - public Map getInstance() { - return instance; - } - public TriangleInterfaceMap00Builder getBuilderAfterTriangleType(Map instance) { - return new TriangleInterfaceMap00Builder(instance); - } - } - - public static class TriangleInterfaceMap10Builder implements SetterForShapeType { - private final Map instance; - public TriangleInterfaceMap10Builder(Map instance) { - this.instance = instance; - } - public Map getInstance() { - return instance; - } - public TriangleInterfaceMap00Builder getBuilderAfterShapeType(Map instance) { - return new TriangleInterfaceMap00Builder(instance); - } - } - - public static class TriangleInterfaceMapBuilder implements SetterForShapeType, SetterForTriangleType { - private final Map instance; - public TriangleInterfaceMapBuilder() { - this.instance = new LinkedHashMap<>(); - } - public Map getInstance() { - return instance; - } - public TriangleInterfaceMap01Builder getBuilderAfterShapeType(Map instance) { - return new TriangleInterfaceMap01Builder(instance); - } - public TriangleInterfaceMap10Builder getBuilderAfterTriangleType(Map instance) { - return new TriangleInterfaceMap10Builder(instance); - } - } - - - public sealed interface TriangleInterface1Boxed permits TriangleInterface1BoxedVoid, TriangleInterface1BoxedBoolean, TriangleInterface1BoxedNumber, TriangleInterface1BoxedString, TriangleInterface1BoxedList, TriangleInterface1BoxedMap { - @Nullable Object getData(); - } - - public record TriangleInterface1BoxedVoid(Nothing? data) implements TriangleInterface1Boxed { - @Override - public @Nullable Object getData() { - return data; - } - } - - public record TriangleInterface1BoxedBoolean(boolean data) implements TriangleInterface1Boxed { - @Override - public @Nullable Object getData() { - return data; - } - } - - public record TriangleInterface1BoxedNumber(Number data) implements TriangleInterface1Boxed { - @Override - public @Nullable Object getData() { - return data; - } - } - - public record TriangleInterface1BoxedString(String data) implements TriangleInterface1Boxed { - @Override - public @Nullable Object getData() { - return data; - } - } - - public record TriangleInterface1BoxedList(FrozenList<@Nullable Object> data) implements TriangleInterface1Boxed { - @Override - public @Nullable Object getData() { - return data; - } - } - - public record TriangleInterface1BoxedMap(TriangleInterfaceMap data) implements TriangleInterface1Boxed { - @Override - public @Nullable Object getData() { - return data; - } - } - - - public static class TriangleInterface1 extends JsonSchema implements NullSchemaValidator, BooleanSchemaValidator, NumberSchemaValidator, StringSchemaValidator, ListSchemaValidator, TriangleInterface1BoxedList>, MapSchemaValidator { - /* - NOTE: This class is auto generated by OpenAPI JSON Schema Generator. - Ref: https://github.com/openapi-json-schema-tools/openapi-json-schema-generator - - Do not edit the class manually. - */ - private static @Nullable TriangleInterface1 instance = null; - - protected TriangleInterface1() { - super(new JsonSchemaInfo() - .properties(Map.ofEntries( - new PropertyEntry("shapeType", ShapeType.class), - new PropertyEntry("triangleType", TriangleType.class) - )) - .required(Set.of( - "shapeType", - "triangleType" - )) - ); - } - - public static TriangleInterface1 getInstance() { - if (instance == null) { - instance = new TriangleInterface1(); - } - return instance; - } - - @Override - public Nothing? validate(Nothing? arg, SchemaConfiguration configuration) throws ValidationException { - Set> pathSet = new HashSet<>(); - List pathToItem = List.of("args[0]"); - Nothing? castArg = castToAllowedTypes(arg, pathToItem, pathSet); - SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().build())); - PathToSchemasMap validatedPathToSchemas = new PathToSchemasMap(); - ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, new LinkedHashSet<>()); - getPathToSchemas(this, castArg, validationMetadata, pathSet); - return castArg; - } - - @Override - public boolean validate(boolean arg, SchemaConfiguration configuration) throws ValidationException { - Set> pathSet = new HashSet<>(); - List pathToItem = List.of("args[0]"); - boolean castArg = castToAllowedTypes(arg, pathToItem, pathSet); - SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().build())); - PathToSchemasMap validatedPathToSchemas = new PathToSchemasMap(); - ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, new LinkedHashSet<>()); - getPathToSchemas(this, castArg, validationMetadata, pathSet); - return castArg; - } - - @Override - public Number validate(Number arg, SchemaConfiguration configuration) throws ValidationException { - Set> pathSet = new HashSet<>(); - List pathToItem = List.of("args[0]"); - Number castArg = castToAllowedTypes(arg, pathToItem, pathSet); - SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().build())); - PathToSchemasMap validatedPathToSchemas = new PathToSchemasMap(); - ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, new LinkedHashSet<>()); - getPathToSchemas(this, castArg, validationMetadata, pathSet); - return castArg; - } - - public int validate(int arg, SchemaConfiguration configuration) throws ValidationException { - return (int) validate((Number) arg, configuration); - } - - public long validate(long arg, SchemaConfiguration configuration) throws ValidationException { - return (long) validate((Number) arg, configuration); - } - - public float validate(float arg, SchemaConfiguration configuration) throws ValidationException { - return (float) validate((Number) arg, configuration); - } - - public double validate(double arg, SchemaConfiguration configuration) throws ValidationException { - return (double) validate((Number) arg, configuration); - } - - @Override - public String validate(String arg, SchemaConfiguration configuration) throws ValidationException { - Set> pathSet = new HashSet<>(); - List pathToItem = List.of("args[0]"); - String castArg = castToAllowedTypes(arg, pathToItem, pathSet); - SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().build())); - PathToSchemasMap validatedPathToSchemas = new PathToSchemasMap(); - ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, new LinkedHashSet<>()); - getPathToSchemas(this, castArg, validationMetadata, pathSet); - return castArg; - } - - public String validate(LocalDate arg, SchemaConfiguration configuration) throws ValidationException { - return validate(arg.toString(), configuration); - } - - public String validate(ZonedDateTime arg, SchemaConfiguration configuration) throws ValidationException { - return validate(arg.toString(), configuration); - } - - public String validate(UUID arg, SchemaConfiguration configuration) throws ValidationException { - return validate(arg.toString(), configuration); - } - - @Override - public FrozenList<@Nullable Object> getNewInstance(List arg, List pathToItem, PathToSchemasMap pathToSchemas) { - List<@Nullable Object> items = new ArrayList<>(); - int i = 0; - for (Object item: arg) { - List itemPathToItem = new ArrayList<>(pathToItem); - itemPathToItem.add(i); - LinkedHashMap, Nothing?> schemas = pathToSchemas.get(itemPathToItem); - if (schemas == null) { - throw new RuntimeException("Validation result is invalid, schemas must exist for a pathToItem"); - } - JsonSchema itemSchema = schemas.entrySet().iterator().next().getKey(); - @Nullable Object itemInstance = itemSchema.getNewInstance(item, itemPathToItem, pathToSchemas); - items.add(itemInstance); - i += 1; - } - FrozenList<@Nullable Object> newInstanceItems = new FrozenList<>(items); - return newInstanceItems; - } - - 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); - SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().build())); - ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, new PathToSchemasMap(), new LinkedHashSet<>()); - PathToSchemasMap pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet); - return getNewInstance(castArg, validationMetadata.pathToItem(), pathToSchemasMap); - } - - @Override - 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 RuntimeException("Invalid non-string key value"); - } - String propertyName = (String) entryKey; - List propertyPathToItem = new ArrayList<>(pathToItem); - propertyPathToItem.add(propertyName); - Object value = entry.getValue(); - LinkedHashMap, Nothing?> schemas = pathToSchemas.get(propertyPathToItem); - if (schemas == null) { - throw new RuntimeException("Validation result is invalid, schemas must exist for a pathToItem"); - } - JsonSchema propertySchema = schemas.entrySet().iterator().next().getKey(); - @Nullable Object propertyInstance = propertySchema.getNewInstance(value, propertyPathToItem, pathToSchemas); - properties.put(propertyName, propertyInstance); - } - FrozenMap<@Nullable Object> castProperties = new FrozenMap<>(properties); - return new TriangleInterfaceMap(castProperties); - } - - 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); - SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().build())); - PathToSchemasMap validatedPathToSchemas = new PathToSchemasMap(); - ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, new LinkedHashSet<>()); - PathToSchemasMap pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet); - return getNewInstance(castArg, validationMetadata.pathToItem(), pathToSchemasMap); - } - - @Override - public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { - if (arg == null) { - return validate((Nothing?) null, configuration); - } else if (arg instanceof Boolean) { - boolean boolArg = (Boolean) arg; - return validate(boolArg, configuration); - } else if (arg instanceof Number) { - return validate((Number) arg, configuration); - } else if (arg instanceof String) { - return validate((String) arg, configuration); - } else if (arg instanceof List) { - return validate((List) arg, 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"); - } - @Override - public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { - if (arg == null) { - return getNewInstance((Nothing?) null, pathToItem, pathToSchemas); - } else if (arg instanceof Boolean) { - boolean boolArg = (Boolean) arg; - return getNewInstance(boolArg, pathToItem, pathToSchemas); - } else if (arg instanceof Number) { - return getNewInstance((Number) arg, pathToItem, pathToSchemas); - } else if (arg instanceof String) { - return getNewInstance((String) arg, pathToItem, pathToSchemas); - } else if (arg instanceof List) { - return getNewInstance((List) arg, 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"); - } - @Override - public TriangleInterface1BoxedVoid validateAndBox(Nothing? arg, SchemaConfiguration configuration) throws ValidationException { - return new TriangleInterface1BoxedVoid(validate(arg, configuration)); - } - @Override - 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 { - return new TriangleInterface1BoxedNumber(validate(arg, configuration)); - } - @Override - 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 { - return new TriangleInterface1BoxedList(validate(arg, configuration)); - } - @Override - 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 { - if (arg == null) { - Nothing? castArg = (Nothing?) arg; - return validateAndBox(castArg, configuration); - } else if (arg instanceof Boolean booleanArg) { - boolean castArg = booleanArg; - return validateAndBox(castArg, configuration); - } else if (arg instanceof String castArg) { - return validateAndBox(castArg, configuration); - } else if (arg instanceof Number castArg) { - return validateAndBox(castArg, configuration); - } else if (arg instanceof List castArg) { - 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"); - } - } -} diff --git a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/schemas/UUIDString.kt b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/schemas/UUIDString.kt deleted file mode 100644 index d3cb5ec4d9b..00000000000 --- a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/schemas/UUIDString.kt +++ /dev/null @@ -1,98 +0,0 @@ -package org.openapijsonschematools.client.components.schemas; -import java.util.HashSet; -import java.util.LinkedHashSet; -import java.util.List; -import java.util.Objects; -import java.util.Set; -import java.util.UUID; -import org.checkerframework.checker.nullness.qual.Nullable; -import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags; -import org.openapijsonschematools.client.configurations.SchemaConfiguration; -import org.openapijsonschematools.client.exceptions.ValidationException; -import org.openapijsonschematools.client.schemas.validation.JsonSchema; -import org.openapijsonschematools.client.schemas.validation.JsonSchemaInfo; -import org.openapijsonschematools.client.schemas.validation.PathToSchemasMap; -import org.openapijsonschematools.client.schemas.validation.StringSchemaValidator; -import org.openapijsonschematools.client.schemas.validation.ValidationMetadata; - -public class UUIDString { - // nest classes so all schemas and input/output classes can be public - - - public sealed interface UUIDString1Boxed permits UUIDString1BoxedString { - @Nullable Object getData(); - } - - public record UUIDString1BoxedString(String data) implements UUIDString1Boxed { - @Override - public @Nullable Object getData() { - return data; - } - } - - - - public static class UUIDString1 extends JsonSchema implements StringSchemaValidator { - /* - NOTE: This class is auto generated by OpenAPI JSON Schema Generator. - Ref: https://github.com/openapi-json-schema-tools/openapi-json-schema-generator - - Do not edit the class manually. - */ - private static @Nullable UUIDString1 instance = null; - - protected UUIDString1() { - super(new JsonSchemaInfo() - .type(Set.of( - String.class - )) - .format("uuid") - .minLength(1) - ); - } - - public static UUIDString1 getInstance() { - if (instance == null) { - instance = new UUIDString1(); - } - return instance; - } - - @Override - public String validate(String arg, SchemaConfiguration configuration) throws ValidationException { - Set> pathSet = new HashSet<>(); - List pathToItem = List.of("args[0"); - String castArg = castToAllowedTypes(arg, pathToItem, pathSet); - SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().build())); - ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, new PathToSchemasMap(), new LinkedHashSet<>()); - getPathToSchemas(this, castArg, validationMetadata, pathSet); - return castArg; - } - - @Override - public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws 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"); - } - @Override - public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { - 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"); - } - @Override - 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 { - 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"); - } - } -} diff --git a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/schemas/User.kt b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/schemas/User.kt deleted file mode 100644 index d64db7e4fc0..00000000000 --- a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/schemas/User.kt +++ /dev/null @@ -1,1227 +0,0 @@ -package org.openapijsonschematools.client.components.schemas; -import java.time.LocalDate; -import java.time.ZonedDateTime; -import java.util.ArrayList; -import java.util.HashSet; -import java.util.LinkedHashMap; -import java.util.LinkedHashSet; -import java.util.List; -import java.util.Map; -import java.util.Objects; -import java.util.Set; -import java.util.UUID; -import org.checkerframework.checker.nullness.qual.Nullable; -import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags; -import org.openapijsonschematools.client.configurations.SchemaConfiguration; -import org.openapijsonschematools.client.exceptions.InvalidAdditionalPropertyException; -import org.openapijsonschematools.client.exceptions.UnsetPropertyException; -import org.openapijsonschematools.client.exceptions.ValidationException; -import org.openapijsonschematools.client.schemas.AnyTypeJsonSchema; -import org.openapijsonschematools.client.schemas.GenericBuilder; -import org.openapijsonschematools.client.schemas.Int32JsonSchema; -import org.openapijsonschematools.client.schemas.Int64JsonSchema; -import org.openapijsonschematools.client.schemas.MapJsonSchema; -import org.openapijsonschematools.client.schemas.NullJsonSchema; -import org.openapijsonschematools.client.schemas.StringJsonSchema; -import org.openapijsonschematools.client.schemas.UnsetAddPropsSetter; -import org.openapijsonschematools.client.schemas.validation.BooleanSchemaValidator; -import org.openapijsonschematools.client.schemas.validation.FrozenList; -import org.openapijsonschematools.client.schemas.validation.FrozenMap; -import org.openapijsonschematools.client.schemas.validation.JsonSchema; -import org.openapijsonschematools.client.schemas.validation.JsonSchemaInfo; -import org.openapijsonschematools.client.schemas.validation.ListSchemaValidator; -import org.openapijsonschematools.client.schemas.validation.MapSchemaValidator; -import org.openapijsonschematools.client.schemas.validation.NullSchemaValidator; -import org.openapijsonschematools.client.schemas.validation.NumberSchemaValidator; -import org.openapijsonschematools.client.schemas.validation.PathToSchemasMap; -import org.openapijsonschematools.client.schemas.validation.PropertyEntry; -import org.openapijsonschematools.client.schemas.validation.StringSchemaValidator; -import org.openapijsonschematools.client.schemas.validation.ValidationMetadata; - -public class User { - // nest classes so all schemas and input/output classes can be public - - - public static class Id extends Int64JsonSchema.Int64JsonSchema1 { - private static @Nullable Id instance = null; - public static Id getInstance() { - if (instance == null) { - instance = new Id(); - } - return instance; - } - } - - - public static class Username extends StringJsonSchema.StringJsonSchema1 { - private static @Nullable Username instance = null; - public static Username getInstance() { - if (instance == null) { - instance = new Username(); - } - return instance; - } - } - - - public static class FirstName extends StringJsonSchema.StringJsonSchema1 { - private static @Nullable FirstName instance = null; - public static FirstName getInstance() { - if (instance == null) { - instance = new FirstName(); - } - return instance; - } - } - - - public static class LastName extends StringJsonSchema.StringJsonSchema1 { - private static @Nullable LastName instance = null; - public static LastName getInstance() { - if (instance == null) { - instance = new LastName(); - } - return instance; - } - } - - - public static class Email extends StringJsonSchema.StringJsonSchema1 { - private static @Nullable Email instance = null; - public static Email getInstance() { - if (instance == null) { - instance = new Email(); - } - return instance; - } - } - - - public static class Password extends StringJsonSchema.StringJsonSchema1 { - private static @Nullable Password instance = null; - public static Password getInstance() { - if (instance == null) { - instance = new Password(); - } - return instance; - } - } - - - public static class Phone extends StringJsonSchema.StringJsonSchema1 { - private static @Nullable Phone instance = null; - public static Phone getInstance() { - if (instance == null) { - instance = new Phone(); - } - return instance; - } - } - - - public static class UserStatus extends Int32JsonSchema.Int32JsonSchema1 { - private static @Nullable UserStatus instance = null; - public static UserStatus getInstance() { - if (instance == null) { - instance = new UserStatus(); - } - return instance; - } - } - - - public static class ObjectWithNoDeclaredProps extends MapJsonSchema.MapJsonSchema1 { - private static @Nullable ObjectWithNoDeclaredProps instance = null; - public static ObjectWithNoDeclaredProps getInstance() { - if (instance == null) { - instance = new ObjectWithNoDeclaredProps(); - } - return instance; - } - } - - - public sealed interface ObjectWithNoDeclaredPropsNullableBoxed permits ObjectWithNoDeclaredPropsNullableBoxedNothing?, ObjectWithNoDeclaredPropsNullableBoxedMap { - @Nullable Object getData(); - } - - public record ObjectWithNoDeclaredPropsNullableBoxedVoid(Nothing? data) implements ObjectWithNoDeclaredPropsNullableBoxed { - @Override - public @Nullable Object getData() { - return data; - } - } - - public record ObjectWithNoDeclaredPropsNullableBoxedMap(FrozenMap<@Nullable Object> data) implements ObjectWithNoDeclaredPropsNullableBoxed { - @Override - public @Nullable Object getData() { - return data; - } - } - - - public static class ObjectWithNoDeclaredPropsNullable extends JsonSchema implements NullSchemaValidator, MapSchemaValidator, ObjectWithNoDeclaredPropsNullableBoxedMap> { - private static @Nullable ObjectWithNoDeclaredPropsNullable instance = null; - - protected ObjectWithNoDeclaredPropsNullable() { - super(new JsonSchemaInfo() - .type(Set.of( - Nothing?.class, - Map.class - )) - ); - } - - public static ObjectWithNoDeclaredPropsNullable getInstance() { - if (instance == null) { - instance = new ObjectWithNoDeclaredPropsNullable(); - } - return instance; - } - - @Override - public Nothing? validate(Nothing? arg, SchemaConfiguration configuration) throws ValidationException { - Set> pathSet = new HashSet<>(); - List pathToItem = List.of("args[0"); - Nothing? castArg = castToAllowedTypes(arg, pathToItem, pathSet); - SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().build())); - ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, new PathToSchemasMap(), new LinkedHashSet<>()); - getPathToSchemas(this, castArg, validationMetadata, pathSet); - return castArg; - } - - 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 RuntimeException("Invalid non-string key value"); - } - String propertyName = (String) entryKey; - List propertyPathToItem = new ArrayList<>(pathToItem); - propertyPathToItem.add(propertyName); - Object value = entry.getValue(); - LinkedHashMap, Nothing?> schemas = pathToSchemas.get(propertyPathToItem); - if (schemas == null) { - throw new RuntimeException("Validation result is invalid, schemas must exist for a pathToItem"); - } - JsonSchema propertySchema = schemas.entrySet().iterator().next().getKey(); - @Nullable Object propertyInstance = propertySchema.getNewInstance(value, propertyPathToItem, pathToSchemas); - properties.put(propertyName, propertyInstance); - } - FrozenMap<@Nullable Object> castProperties = new FrozenMap<>(properties); - return castProperties; - } - - public FrozenMap<@Nullable Object> validate(Map arg, SchemaConfiguration configuration) throws ValidationException { - Set> pathSet = new HashSet<>(); - List pathToItem = List.of("args[0"); - Map castArg = castToAllowedTypes(arg, pathToItem, pathSet); - SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().build())); - ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, new PathToSchemasMap(), new LinkedHashSet<>()); - PathToSchemasMap pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet); - return getNewInstance(castArg, validationMetadata.pathToItem(), pathToSchemasMap); - } - - - @Override - public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { - if (arg == null) { - return validate((Nothing?) 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"); - } - @Override - public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { - if (arg == null) { - return getNewInstance((Nothing?) 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"); - } - @Override - public ObjectWithNoDeclaredPropsNullableBoxedVoid validateAndBox(Nothing? arg, SchemaConfiguration configuration) throws ValidationException { - return new ObjectWithNoDeclaredPropsNullableBoxedVoid(validate(arg, configuration)); - } - @Override - 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 { - if (arg == null) { - Nothing? castArg = (Nothing?) 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"); - } - } - - public static class AnyTypeProp extends AnyTypeJsonSchema.AnyTypeJsonSchema1 { - private static @Nullable AnyTypeProp instance = null; - public static AnyTypeProp getInstance() { - if (instance == null) { - instance = new AnyTypeProp(); - } - return instance; - } - } - - - public static class Not extends NullJsonSchema.NullJsonSchema1 { - private static @Nullable Not instance = null; - public static Not getInstance() { - if (instance == null) { - instance = new Not(); - } - return instance; - } - } - - - public sealed interface AnyTypeExceptNullPropBoxed permits AnyTypeExceptNullPropBoxedVoid, AnyTypeExceptNullPropBoxedBoolean, AnyTypeExceptNullPropBoxedNumber, AnyTypeExceptNullPropBoxedString, AnyTypeExceptNullPropBoxedList, AnyTypeExceptNullPropBoxedMap { - @Nullable Object getData(); - } - - public record AnyTypeExceptNullPropBoxedVoid(Nothing? data) implements AnyTypeExceptNullPropBoxed { - @Override - public @Nullable Object getData() { - return data; - } - } - - public record AnyTypeExceptNullPropBoxedBoolean(boolean data) implements AnyTypeExceptNullPropBoxed { - @Override - public @Nullable Object getData() { - return data; - } - } - - public record AnyTypeExceptNullPropBoxedNumber(Number data) implements AnyTypeExceptNullPropBoxed { - @Override - public @Nullable Object getData() { - return data; - } - } - - public record AnyTypeExceptNullPropBoxedString(String data) implements AnyTypeExceptNullPropBoxed { - @Override - public @Nullable Object getData() { - return data; - } - } - - public record AnyTypeExceptNullPropBoxedList(FrozenList<@Nullable Object> data) implements AnyTypeExceptNullPropBoxed { - @Override - public @Nullable Object getData() { - return data; - } - } - - public record AnyTypeExceptNullPropBoxedMap(FrozenMap<@Nullable Object> data) implements AnyTypeExceptNullPropBoxed { - @Override - public @Nullable Object getData() { - return data; - } - } - - - public static class AnyTypeExceptNullProp extends JsonSchema implements NullSchemaValidator, BooleanSchemaValidator, NumberSchemaValidator, StringSchemaValidator, ListSchemaValidator, AnyTypeExceptNullPropBoxedList>, MapSchemaValidator, AnyTypeExceptNullPropBoxedMap> { - private static @Nullable AnyTypeExceptNullProp instance = null; - - protected AnyTypeExceptNullProp() { - super(new JsonSchemaInfo() - .not(Not.class) - ); - } - - public static AnyTypeExceptNullProp getInstance() { - if (instance == null) { - instance = new AnyTypeExceptNullProp(); - } - return instance; - } - - @Override - public Nothing? validate(Nothing? arg, SchemaConfiguration configuration) throws ValidationException { - Set> pathSet = new HashSet<>(); - List pathToItem = List.of("args[0]"); - Nothing? castArg = castToAllowedTypes(arg, pathToItem, pathSet); - SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().build())); - PathToSchemasMap validatedPathToSchemas = new PathToSchemasMap(); - ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, new LinkedHashSet<>()); - getPathToSchemas(this, castArg, validationMetadata, pathSet); - return castArg; - } - - @Override - public boolean validate(boolean arg, SchemaConfiguration configuration) throws ValidationException { - Set> pathSet = new HashSet<>(); - List pathToItem = List.of("args[0]"); - boolean castArg = castToAllowedTypes(arg, pathToItem, pathSet); - SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().build())); - PathToSchemasMap validatedPathToSchemas = new PathToSchemasMap(); - ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, new LinkedHashSet<>()); - getPathToSchemas(this, castArg, validationMetadata, pathSet); - return castArg; - } - - @Override - public Number validate(Number arg, SchemaConfiguration configuration) throws ValidationException { - Set> pathSet = new HashSet<>(); - List pathToItem = List.of("args[0]"); - Number castArg = castToAllowedTypes(arg, pathToItem, pathSet); - SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().build())); - PathToSchemasMap validatedPathToSchemas = new PathToSchemasMap(); - ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, new LinkedHashSet<>()); - getPathToSchemas(this, castArg, validationMetadata, pathSet); - return castArg; - } - - public int validate(int arg, SchemaConfiguration configuration) throws ValidationException { - return (int) validate((Number) arg, configuration); - } - - public long validate(long arg, SchemaConfiguration configuration) throws ValidationException { - return (long) validate((Number) arg, configuration); - } - - public float validate(float arg, SchemaConfiguration configuration) throws ValidationException { - return (float) validate((Number) arg, configuration); - } - - public double validate(double arg, SchemaConfiguration configuration) throws ValidationException { - return (double) validate((Number) arg, configuration); - } - - @Override - public String validate(String arg, SchemaConfiguration configuration) throws ValidationException { - Set> pathSet = new HashSet<>(); - List pathToItem = List.of("args[0]"); - String castArg = castToAllowedTypes(arg, pathToItem, pathSet); - SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().build())); - PathToSchemasMap validatedPathToSchemas = new PathToSchemasMap(); - ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, new LinkedHashSet<>()); - getPathToSchemas(this, castArg, validationMetadata, pathSet); - return castArg; - } - - public String validate(LocalDate arg, SchemaConfiguration configuration) throws ValidationException { - return validate(arg.toString(), configuration); - } - - public String validate(ZonedDateTime arg, SchemaConfiguration configuration) throws ValidationException { - return validate(arg.toString(), configuration); - } - - public String validate(UUID arg, SchemaConfiguration configuration) throws ValidationException { - return validate(arg.toString(), configuration); - } - - @Override - public FrozenList<@Nullable Object> getNewInstance(List arg, List pathToItem, PathToSchemasMap pathToSchemas) { - List<@Nullable Object> items = new ArrayList<>(); - int i = 0; - for (Object item: arg) { - List itemPathToItem = new ArrayList<>(pathToItem); - itemPathToItem.add(i); - LinkedHashMap, Nothing?> schemas = pathToSchemas.get(itemPathToItem); - if (schemas == null) { - throw new RuntimeException("Validation result is invalid, schemas must exist for a pathToItem"); - } - JsonSchema itemSchema = schemas.entrySet().iterator().next().getKey(); - @Nullable Object itemInstance = itemSchema.getNewInstance(item, itemPathToItem, pathToSchemas); - items.add(itemInstance); - i += 1; - } - FrozenList<@Nullable Object> newInstanceItems = new FrozenList<>(items); - return newInstanceItems; - } - - 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); - SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().build())); - ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, new PathToSchemasMap(), new LinkedHashSet<>()); - PathToSchemasMap pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet); - return getNewInstance(castArg, validationMetadata.pathToItem(), pathToSchemasMap); - } - - @Override - 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 RuntimeException("Invalid non-string key value"); - } - String propertyName = (String) entryKey; - List propertyPathToItem = new ArrayList<>(pathToItem); - propertyPathToItem.add(propertyName); - Object value = entry.getValue(); - LinkedHashMap, Nothing?> schemas = pathToSchemas.get(propertyPathToItem); - if (schemas == null) { - throw new RuntimeException("Validation result is invalid, schemas must exist for a pathToItem"); - } - JsonSchema propertySchema = schemas.entrySet().iterator().next().getKey(); - @Nullable Object propertyInstance = propertySchema.getNewInstance(value, propertyPathToItem, pathToSchemas); - properties.put(propertyName, propertyInstance); - } - FrozenMap<@Nullable Object> castProperties = new FrozenMap<>(properties); - return castProperties; - } - - public FrozenMap<@Nullable Object> validate(Map arg, SchemaConfiguration configuration) throws ValidationException { - Set> pathSet = new HashSet<>(); - List pathToItem = List.of("args[0]"); - Map castArg = castToAllowedTypes(arg, pathToItem, pathSet); - SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().build())); - PathToSchemasMap validatedPathToSchemas = new PathToSchemasMap(); - ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, new LinkedHashSet<>()); - PathToSchemasMap pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet); - return getNewInstance(castArg, validationMetadata.pathToItem(), pathToSchemasMap); - } - - @Override - public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { - if (arg == null) { - return validate((Nothing?) null, configuration); - } else if (arg instanceof Boolean) { - boolean boolArg = (Boolean) arg; - return validate(boolArg, configuration); - } else if (arg instanceof Number) { - return validate((Number) arg, configuration); - } else if (arg instanceof String) { - return validate((String) arg, configuration); - } else if (arg instanceof List) { - return validate((List) arg, 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"); - } - @Override - public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { - if (arg == null) { - return getNewInstance((Nothing?) null, pathToItem, pathToSchemas); - } else if (arg instanceof Boolean) { - boolean boolArg = (Boolean) arg; - return getNewInstance(boolArg, pathToItem, pathToSchemas); - } else if (arg instanceof Number) { - return getNewInstance((Number) arg, pathToItem, pathToSchemas); - } else if (arg instanceof String) { - return getNewInstance((String) arg, pathToItem, pathToSchemas); - } else if (arg instanceof List) { - return getNewInstance((List) arg, 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"); - } - @Override - public AnyTypeExceptNullPropBoxedVoid validateAndBox(Nothing? arg, SchemaConfiguration configuration) throws ValidationException { - return new AnyTypeExceptNullPropBoxedVoid(validate(arg, configuration)); - } - @Override - 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 { - return new AnyTypeExceptNullPropBoxedNumber(validate(arg, configuration)); - } - @Override - 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 { - return new AnyTypeExceptNullPropBoxedList(validate(arg, configuration)); - } - @Override - 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 { - if (arg == null) { - Nothing? castArg = (Nothing?) arg; - return validateAndBox(castArg, configuration); - } else if (arg instanceof Boolean booleanArg) { - boolean castArg = booleanArg; - return validateAndBox(castArg, configuration); - } else if (arg instanceof String castArg) { - return validateAndBox(castArg, configuration); - } else if (arg instanceof Number castArg) { - return validateAndBox(castArg, configuration); - } else if (arg instanceof List castArg) { - 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"); - } - } - - public static class AnyTypePropNullable extends AnyTypeJsonSchema.AnyTypeJsonSchema1 { - private static @Nullable AnyTypePropNullable instance = null; - public static AnyTypePropNullable getInstance() { - if (instance == null) { - instance = new AnyTypePropNullable(); - } - return instance; - } - } - - - public static class UserMap extends FrozenMap<@Nullable Object> { - protected UserMap(FrozenMap<@Nullable Object> m) { - super(m); - } - public static final Set requiredKeys = Set.of(); - public static final Set optionalKeys = Set.of( - "id", - "username", - "firstName", - "lastName", - "email", - "password", - "phone", - "userStatus", - "objectWithNoDeclaredProps", - "objectWithNoDeclaredPropsNullable", - "anyTypeProp", - "anyTypeExceptNullProp", - "anyTypePropNullable" - ); - public static UserMap of(Map arg, SchemaConfiguration configuration) throws ValidationException { - return User1.getInstance().validate(arg, configuration); - } - - public Number id() throws UnsetPropertyException { - String key = "id"; - throwIfKeyNotPresent(key); - @Nullable Object value = get(key); - if (!(value instanceof Number)) { - throw new RuntimeException("Invalid value stored for id"); - } - return (Number) value; - } - - public String username() throws UnsetPropertyException { - String key = "username"; - throwIfKeyNotPresent(key); - @Nullable Object value = get(key); - if (!(value instanceof String)) { - throw new RuntimeException("Invalid value stored for username"); - } - return (String) value; - } - - public String firstName() throws UnsetPropertyException { - String key = "firstName"; - throwIfKeyNotPresent(key); - @Nullable Object value = get(key); - if (!(value instanceof String)) { - throw new RuntimeException("Invalid value stored for firstName"); - } - return (String) value; - } - - public String lastName() throws UnsetPropertyException { - String key = "lastName"; - throwIfKeyNotPresent(key); - @Nullable Object value = get(key); - if (!(value instanceof String)) { - throw new RuntimeException("Invalid value stored for lastName"); - } - return (String) value; - } - - public String email() throws UnsetPropertyException { - String key = "email"; - throwIfKeyNotPresent(key); - @Nullable Object value = get(key); - if (!(value instanceof String)) { - throw new RuntimeException("Invalid value stored for email"); - } - return (String) value; - } - - public String password() throws UnsetPropertyException { - String key = "password"; - throwIfKeyNotPresent(key); - @Nullable Object value = get(key); - if (!(value instanceof String)) { - throw new RuntimeException("Invalid value stored for password"); - } - return (String) value; - } - - public String phone() throws UnsetPropertyException { - String key = "phone"; - throwIfKeyNotPresent(key); - @Nullable Object value = get(key); - if (!(value instanceof String)) { - throw new RuntimeException("Invalid value stored for phone"); - } - return (String) value; - } - - public Number userStatus() throws UnsetPropertyException { - String key = "userStatus"; - throwIfKeyNotPresent(key); - @Nullable Object value = get(key); - if (!(value instanceof Number)) { - throw new RuntimeException("Invalid value stored for userStatus"); - } - return (Number) value; - } - - public FrozenMap objectWithNoDeclaredProps() throws UnsetPropertyException { - String key = "objectWithNoDeclaredProps"; - throwIfKeyNotPresent(key); - @Nullable Object value = get(key); - if (!(value instanceof FrozenMap)) { - throw new RuntimeException("Invalid value stored for objectWithNoDeclaredProps"); - } - return (FrozenMap) value; - } - - public @Nullable FrozenMap objectWithNoDeclaredPropsNullable() throws UnsetPropertyException { - String key = "objectWithNoDeclaredPropsNullable"; - throwIfKeyNotPresent(key); - @Nullable Object value = get(key); - if (!(value == null || value instanceof FrozenMap)) { - throw new RuntimeException("Invalid value stored for objectWithNoDeclaredPropsNullable"); - } - return (@Nullable FrozenMap) value; - } - - public @Nullable Object anyTypeProp() throws UnsetPropertyException { - return getOrThrow("anyTypeProp"); - } - - public @Nullable Object anyTypeExceptNullProp() throws UnsetPropertyException { - return getOrThrow("anyTypeExceptNullProp"); - } - - public @Nullable Object anyTypePropNullable() throws UnsetPropertyException { - return getOrThrow("anyTypePropNullable"); - } - - public @Nullable Object getAdditionalProperty(String name) throws UnsetPropertyException, InvalidAdditionalPropertyException { - throwIfKeyKnown(name, requiredKeys, optionalKeys); - throwIfKeyNotPresent(name); - return get(name); - } - } - - public interface SetterForId { - Map getInstance(); - T getBuilderAfterId(Map instance); - - default T id(int value) { - var instance = getInstance(); - instance.put("id", value); - return getBuilderAfterId(instance); - } - - default T id(float value) { - var instance = getInstance(); - instance.put("id", value); - return getBuilderAfterId(instance); - } - - default T id(long value) { - var instance = getInstance(); - instance.put("id", value); - return getBuilderAfterId(instance); - } - - default T id(double value) { - var instance = getInstance(); - instance.put("id", value); - return getBuilderAfterId(instance); - } - } - - public interface SetterForUsername { - Map getInstance(); - T getBuilderAfterUsername(Map instance); - - default T username(String value) { - var instance = getInstance(); - instance.put("username", value); - return getBuilderAfterUsername(instance); - } - } - - public interface SetterForFirstName { - Map getInstance(); - T getBuilderAfterFirstName(Map instance); - - default T firstName(String value) { - var instance = getInstance(); - instance.put("firstName", value); - return getBuilderAfterFirstName(instance); - } - } - - public interface SetterForLastName { - Map getInstance(); - T getBuilderAfterLastName(Map instance); - - default T lastName(String value) { - var instance = getInstance(); - instance.put("lastName", value); - return getBuilderAfterLastName(instance); - } - } - - public interface SetterForEmail { - Map getInstance(); - T getBuilderAfterEmail(Map instance); - - default T email(String value) { - var instance = getInstance(); - instance.put("email", value); - return getBuilderAfterEmail(instance); - } - } - - public interface SetterForPassword { - Map getInstance(); - T getBuilderAfterPassword(Map instance); - - default T password(String value) { - var instance = getInstance(); - instance.put("password", value); - return getBuilderAfterPassword(instance); - } - } - - public interface SetterForPhone { - Map getInstance(); - T getBuilderAfterPhone(Map instance); - - default T phone(String value) { - var instance = getInstance(); - instance.put("phone", value); - return getBuilderAfterPhone(instance); - } - } - - public interface SetterForUserStatus { - Map getInstance(); - T getBuilderAfterUserStatus(Map instance); - - default T userStatus(int value) { - var instance = getInstance(); - instance.put("userStatus", value); - return getBuilderAfterUserStatus(instance); - } - - default T userStatus(float value) { - var instance = getInstance(); - instance.put("userStatus", value); - return getBuilderAfterUserStatus(instance); - } - } - - public interface SetterForObjectWithNoDeclaredProps { - Map getInstance(); - T getBuilderAfterObjectWithNoDeclaredProps(Map instance); - - default T objectWithNoDeclaredProps(Map value) { - var instance = getInstance(); - instance.put("objectWithNoDeclaredProps", value); - return getBuilderAfterObjectWithNoDeclaredProps(instance); - } - } - - public interface SetterForObjectWithNoDeclaredPropsNullable { - Map getInstance(); - T getBuilderAfterObjectWithNoDeclaredPropsNullable(Map instance); - - default T objectWithNoDeclaredPropsNullable(Nothing? value) { - var instance = getInstance(); - instance.put("objectWithNoDeclaredPropsNullable", null); - return getBuilderAfterObjectWithNoDeclaredPropsNullable(instance); - } - - default T objectWithNoDeclaredPropsNullable(Map value) { - var instance = getInstance(); - instance.put("objectWithNoDeclaredPropsNullable", value); - return getBuilderAfterObjectWithNoDeclaredPropsNullable(instance); - } - } - - public interface SetterForAnyTypeProp { - Map getInstance(); - T getBuilderAfterAnyTypeProp(Map instance); - - default T anyTypeProp(Nothing? value) { - var instance = getInstance(); - instance.put("anyTypeProp", null); - return getBuilderAfterAnyTypeProp(instance); - } - - default T anyTypeProp(boolean value) { - var instance = getInstance(); - instance.put("anyTypeProp", value); - return getBuilderAfterAnyTypeProp(instance); - } - - default T anyTypeProp(String value) { - var instance = getInstance(); - instance.put("anyTypeProp", value); - return getBuilderAfterAnyTypeProp(instance); - } - - default T anyTypeProp(int value) { - var instance = getInstance(); - instance.put("anyTypeProp", value); - return getBuilderAfterAnyTypeProp(instance); - } - - default T anyTypeProp(float value) { - var instance = getInstance(); - instance.put("anyTypeProp", value); - return getBuilderAfterAnyTypeProp(instance); - } - - default T anyTypeProp(long value) { - var instance = getInstance(); - instance.put("anyTypeProp", value); - return getBuilderAfterAnyTypeProp(instance); - } - - default T anyTypeProp(double value) { - var instance = getInstance(); - instance.put("anyTypeProp", value); - return getBuilderAfterAnyTypeProp(instance); - } - - default T anyTypeProp(List value) { - var instance = getInstance(); - instance.put("anyTypeProp", value); - return getBuilderAfterAnyTypeProp(instance); - } - - default T anyTypeProp(Map value) { - var instance = getInstance(); - instance.put("anyTypeProp", value); - return getBuilderAfterAnyTypeProp(instance); - } - } - - public interface SetterForAnyTypeExceptNullProp { - Map getInstance(); - T getBuilderAfterAnyTypeExceptNullProp(Map instance); - - default T anyTypeExceptNullProp(Nothing? value) { - var instance = getInstance(); - instance.put("anyTypeExceptNullProp", null); - return getBuilderAfterAnyTypeExceptNullProp(instance); - } - - default T anyTypeExceptNullProp(boolean value) { - var instance = getInstance(); - instance.put("anyTypeExceptNullProp", value); - return getBuilderAfterAnyTypeExceptNullProp(instance); - } - - default T anyTypeExceptNullProp(String value) { - var instance = getInstance(); - instance.put("anyTypeExceptNullProp", value); - return getBuilderAfterAnyTypeExceptNullProp(instance); - } - - default T anyTypeExceptNullProp(int value) { - var instance = getInstance(); - instance.put("anyTypeExceptNullProp", value); - return getBuilderAfterAnyTypeExceptNullProp(instance); - } - - default T anyTypeExceptNullProp(float value) { - var instance = getInstance(); - instance.put("anyTypeExceptNullProp", value); - return getBuilderAfterAnyTypeExceptNullProp(instance); - } - - default T anyTypeExceptNullProp(long value) { - var instance = getInstance(); - instance.put("anyTypeExceptNullProp", value); - return getBuilderAfterAnyTypeExceptNullProp(instance); - } - - default T anyTypeExceptNullProp(double value) { - var instance = getInstance(); - instance.put("anyTypeExceptNullProp", value); - return getBuilderAfterAnyTypeExceptNullProp(instance); - } - - default T anyTypeExceptNullProp(List value) { - var instance = getInstance(); - instance.put("anyTypeExceptNullProp", value); - return getBuilderAfterAnyTypeExceptNullProp(instance); - } - - default T anyTypeExceptNullProp(Map value) { - var instance = getInstance(); - instance.put("anyTypeExceptNullProp", value); - return getBuilderAfterAnyTypeExceptNullProp(instance); - } - } - - public interface SetterForAnyTypePropNullable { - Map getInstance(); - T getBuilderAfterAnyTypePropNullable(Map instance); - - default T anyTypePropNullable(Nothing? value) { - var instance = getInstance(); - instance.put("anyTypePropNullable", null); - return getBuilderAfterAnyTypePropNullable(instance); - } - - default T anyTypePropNullable(boolean value) { - var instance = getInstance(); - instance.put("anyTypePropNullable", value); - return getBuilderAfterAnyTypePropNullable(instance); - } - - default T anyTypePropNullable(String value) { - var instance = getInstance(); - instance.put("anyTypePropNullable", value); - return getBuilderAfterAnyTypePropNullable(instance); - } - - default T anyTypePropNullable(int value) { - var instance = getInstance(); - instance.put("anyTypePropNullable", value); - return getBuilderAfterAnyTypePropNullable(instance); - } - - default T anyTypePropNullable(float value) { - var instance = getInstance(); - instance.put("anyTypePropNullable", value); - return getBuilderAfterAnyTypePropNullable(instance); - } - - default T anyTypePropNullable(long value) { - var instance = getInstance(); - instance.put("anyTypePropNullable", value); - return getBuilderAfterAnyTypePropNullable(instance); - } - - default T anyTypePropNullable(double value) { - var instance = getInstance(); - instance.put("anyTypePropNullable", value); - return getBuilderAfterAnyTypePropNullable(instance); - } - - default T anyTypePropNullable(List value) { - var instance = getInstance(); - instance.put("anyTypePropNullable", value); - return getBuilderAfterAnyTypePropNullable(instance); - } - - default T anyTypePropNullable(Map value) { - var instance = getInstance(); - instance.put("anyTypePropNullable", value); - return getBuilderAfterAnyTypePropNullable(instance); - } - } - - public static class UserMapBuilder extends UnsetAddPropsSetter implements GenericBuilder>, SetterForId, SetterForUsername, SetterForFirstName, SetterForLastName, SetterForEmail, SetterForPassword, SetterForPhone, SetterForUserStatus, SetterForObjectWithNoDeclaredProps, SetterForObjectWithNoDeclaredPropsNullable, SetterForAnyTypeProp, SetterForAnyTypeExceptNullProp, SetterForAnyTypePropNullable { - private final Map instance; - private static final Set knownKeys = Set.of( - "id", - "username", - "firstName", - "lastName", - "email", - "password", - "phone", - "userStatus", - "objectWithNoDeclaredProps", - "objectWithNoDeclaredPropsNullable", - "anyTypeProp", - "anyTypeExceptNullProp", - "anyTypePropNullable" - ); - public Set getKnownKeys() { - return knownKeys; - } - public UserMapBuilder() { - this.instance = new LinkedHashMap<>(); - } - public Map build() { - return instance; - } - public Map getInstance() { - return instance; - } - public UserMapBuilder getBuilderAfterId(Map instance) { - return this; - } - public UserMapBuilder getBuilderAfterUsername(Map instance) { - return this; - } - public UserMapBuilder getBuilderAfterFirstName(Map instance) { - return this; - } - public UserMapBuilder getBuilderAfterLastName(Map instance) { - return this; - } - public UserMapBuilder getBuilderAfterEmail(Map instance) { - return this; - } - public UserMapBuilder getBuilderAfterPassword(Map instance) { - return this; - } - public UserMapBuilder getBuilderAfterPhone(Map instance) { - return this; - } - public UserMapBuilder getBuilderAfterUserStatus(Map instance) { - return this; - } - public UserMapBuilder getBuilderAfterObjectWithNoDeclaredProps(Map instance) { - return this; - } - public UserMapBuilder getBuilderAfterObjectWithNoDeclaredPropsNullable(Map instance) { - return this; - } - public UserMapBuilder getBuilderAfterAnyTypeProp(Map instance) { - return this; - } - public UserMapBuilder getBuilderAfterAnyTypeExceptNullProp(Map instance) { - return this; - } - public UserMapBuilder getBuilderAfterAnyTypePropNullable(Map instance) { - return this; - } - public UserMapBuilder getBuilderAfterAdditionalProperty(Map instance) { - return this; - } - } - - - public sealed interface User1Boxed permits User1BoxedMap { - @Nullable Object getData(); - } - - public record User1BoxedMap(UserMap data) implements User1Boxed { - @Override - public @Nullable Object getData() { - return data; - } - } - - - public static class User1 extends JsonSchema implements MapSchemaValidator { - /* - NOTE: This class is auto generated by OpenAPI JSON Schema Generator. - Ref: https://github.com/openapi-json-schema-tools/openapi-json-schema-generator - - Do not edit the class manually. - */ - private static @Nullable User1 instance = null; - - protected User1() { - super(new JsonSchemaInfo() - .type(Set.of(Map.class)) - .properties(Map.ofEntries( - new PropertyEntry("id", Id.class), - new PropertyEntry("username", Username.class), - new PropertyEntry("firstName", FirstName.class), - new PropertyEntry("lastName", LastName.class), - new PropertyEntry("email", Email.class), - new PropertyEntry("password", Password.class), - new PropertyEntry("phone", Phone.class), - new PropertyEntry("userStatus", UserStatus.class), - new PropertyEntry("objectWithNoDeclaredProps", ObjectWithNoDeclaredProps.class), - new PropertyEntry("objectWithNoDeclaredPropsNullable", ObjectWithNoDeclaredPropsNullable.class), - new PropertyEntry("anyTypeProp", AnyTypeProp.class), - new PropertyEntry("anyTypeExceptNullProp", AnyTypeExceptNullProp.class), - new PropertyEntry("anyTypePropNullable", AnyTypePropNullable.class) - )) - ); - } - - public static User1 getInstance() { - if (instance == null) { - instance = new User1(); - } - return instance; - } - - 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 RuntimeException("Invalid non-string key value"); - } - String propertyName = (String) entryKey; - List propertyPathToItem = new ArrayList<>(pathToItem); - propertyPathToItem.add(propertyName); - Object value = entry.getValue(); - LinkedHashMap, Nothing?> schemas = pathToSchemas.get(propertyPathToItem); - if (schemas == null) { - throw new RuntimeException("Validation result is invalid, schemas must exist for a pathToItem"); - } - JsonSchema propertySchema = schemas.entrySet().iterator().next().getKey(); - @Nullable Object propertyInstance = propertySchema.getNewInstance(value, propertyPathToItem, pathToSchemas); - properties.put(propertyName, propertyInstance); - } - FrozenMap<@Nullable Object> castProperties = new FrozenMap<>(properties); - return new UserMap(castProperties); - } - - 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); - SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().build())); - ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, new PathToSchemasMap(), new LinkedHashSet<>()); - PathToSchemasMap pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet); - return getNewInstance(castArg, validationMetadata.pathToItem(), pathToSchemasMap); - } - - - @Override - public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws 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"); - } - @Override - public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { - if (arg instanceof Map) { - return getNewInstance((Map) arg, pathToItem, pathToSchemas); - } - 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 { - return new User1BoxedMap(validate(arg, configuration)); - } - @Override - public User1Boxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { - 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"); - } - } - -} diff --git a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/schemas/Whale.kt b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/schemas/Whale.kt deleted file mode 100644 index e2061712213..00000000000 --- a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/schemas/Whale.kt +++ /dev/null @@ -1,382 +0,0 @@ -package org.openapijsonschematools.client.components.schemas; -import java.util.ArrayList; -import java.util.HashSet; -import java.util.LinkedHashMap; -import java.util.LinkedHashSet; -import java.util.List; -import java.util.Map; -import java.util.Objects; -import java.util.Set; -import org.checkerframework.checker.nullness.qual.Nullable; -import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags; -import org.openapijsonschematools.client.configurations.SchemaConfiguration; -import org.openapijsonschematools.client.exceptions.InvalidAdditionalPropertyException; -import org.openapijsonschematools.client.exceptions.UnsetPropertyException; -import org.openapijsonschematools.client.exceptions.ValidationException; -import org.openapijsonschematools.client.schemas.BooleanJsonSchema; -import org.openapijsonschematools.client.schemas.GenericBuilder; -import org.openapijsonschematools.client.schemas.SetMaker; -import org.openapijsonschematools.client.schemas.UnsetAddPropsSetter; -import org.openapijsonschematools.client.schemas.validation.FrozenMap; -import org.openapijsonschematools.client.schemas.validation.JsonSchema; -import org.openapijsonschematools.client.schemas.validation.JsonSchemaInfo; -import org.openapijsonschematools.client.schemas.validation.MapSchemaValidator; -import org.openapijsonschematools.client.schemas.validation.PathToSchemasMap; -import org.openapijsonschematools.client.schemas.validation.PropertyEntry; -import org.openapijsonschematools.client.schemas.validation.StringEnumValidator; -import org.openapijsonschematools.client.schemas.validation.StringSchemaValidator; -import org.openapijsonschematools.client.schemas.validation.StringValueMethod; -import org.openapijsonschematools.client.schemas.validation.ValidationMetadata; - -public class Whale { - // nest classes so all schemas and input/output classes can be public - - - public static class HasBaleen extends BooleanJsonSchema.BooleanJsonSchema1 { - private static @Nullable HasBaleen instance = null; - public static HasBaleen getInstance() { - if (instance == null) { - instance = new HasBaleen(); - } - return instance; - } - } - - - public static class HasTeeth extends BooleanJsonSchema.BooleanJsonSchema1 { - private static @Nullable HasTeeth instance = null; - public static HasTeeth getInstance() { - if (instance == null) { - instance = new HasTeeth(); - } - return instance; - } - } - - public enum StringClassNameEnums implements StringValueMethod { - WHALE("whale"); - private final String value; - - StringClassNameEnums(String value) { - this.value = value; - } - public String value() { - return this.value; - } - } - - - public sealed interface ClassNameBoxed permits ClassNameBoxedString { - @Nullable Object getData(); - } - - public record ClassNameBoxedString(String data) implements ClassNameBoxed { - @Override - public @Nullable Object getData() { - return data; - } - } - - - - public static class ClassName extends JsonSchema implements StringSchemaValidator, StringEnumValidator { - private static @Nullable ClassName instance = null; - - protected ClassName() { - super(new JsonSchemaInfo() - .type(Set.of( - String.class - )) - .enumValues(SetMaker.makeSet( - "whale" - )) - ); - } - - public static ClassName getInstance() { - if (instance == null) { - instance = new ClassName(); - } - return instance; - } - - @Override - public String validate(String arg, SchemaConfiguration configuration) throws ValidationException { - Set> pathSet = new HashSet<>(); - List pathToItem = List.of("args[0"); - String castArg = castToAllowedTypes(arg, pathToItem, pathSet); - SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().build())); - ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, new PathToSchemasMap(), new LinkedHashSet<>()); - getPathToSchemas(this, castArg, validationMetadata, pathSet); - return castArg; - } - - @Override - 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 { - 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"); - } - @Override - public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { - 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"); - } - @Override - 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 { - 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"); - } - } - - public static class WhaleMap extends FrozenMap<@Nullable Object> { - protected WhaleMap(FrozenMap<@Nullable Object> m) { - super(m); - } - public static final Set requiredKeys = Set.of( - "className" - ); - public static final Set optionalKeys = Set.of( - "hasBaleen", - "hasTeeth" - ); - public static WhaleMap of(Map arg, SchemaConfiguration configuration) throws ValidationException { - return Whale1.getInstance().validate(arg, configuration); - } - - public String className() { - @Nullable Object value = get("className"); - if (!(value instanceof String)) { - throw new RuntimeException("Invalid value stored for className"); - } - return (String) value; - } - - public boolean hasBaleen() throws UnsetPropertyException { - String key = "hasBaleen"; - throwIfKeyNotPresent(key); - @Nullable Object value = get(key); - if (!(value instanceof Boolean)) { - throw new RuntimeException("Invalid value stored for hasBaleen"); - } - return (boolean) value; - } - - public boolean hasTeeth() throws UnsetPropertyException { - String key = "hasTeeth"; - throwIfKeyNotPresent(key); - @Nullable Object value = get(key); - if (!(value instanceof Boolean)) { - throw new RuntimeException("Invalid value stored for hasTeeth"); - } - return (boolean) value; - } - - public @Nullable Object getAdditionalProperty(String name) throws UnsetPropertyException, InvalidAdditionalPropertyException { - throwIfKeyKnown(name, requiredKeys, optionalKeys); - throwIfKeyNotPresent(name); - return get(name); - } - } - - public interface SetterForClassName { - Map getInstance(); - T getBuilderAfterClassName(Map instance); - - default T className(String value) { - var instance = getInstance(); - instance.put("className", value); - return getBuilderAfterClassName(instance); - } - - default T className(StringClassNameEnums value) { - var instance = getInstance(); - instance.put("className", value.value()); - return getBuilderAfterClassName(instance); - } - } - - public interface SetterForHasBaleen { - Map getInstance(); - T getBuilderAfterHasBaleen(Map instance); - - default T hasBaleen(boolean value) { - var instance = getInstance(); - instance.put("hasBaleen", value); - return getBuilderAfterHasBaleen(instance); - } - } - - public interface SetterForHasTeeth { - Map getInstance(); - T getBuilderAfterHasTeeth(Map instance); - - default T hasTeeth(boolean value) { - var instance = getInstance(); - instance.put("hasTeeth", value); - return getBuilderAfterHasTeeth(instance); - } - } - - public static class WhaleMap0Builder extends UnsetAddPropsSetter implements GenericBuilder>, SetterForHasBaleen, SetterForHasTeeth { - private final Map instance; - private static final Set knownKeys = Set.of( - "className", - "hasBaleen", - "hasTeeth" - ); - public Set getKnownKeys() { - return knownKeys; - } - public WhaleMap0Builder(Map instance) { - this.instance = instance; - } - public Map build() { - return instance; - } - public Map getInstance() { - return instance; - } - public WhaleMap0Builder getBuilderAfterHasBaleen(Map instance) { - return this; - } - public WhaleMap0Builder getBuilderAfterHasTeeth(Map instance) { - return this; - } - public WhaleMap0Builder getBuilderAfterAdditionalProperty(Map instance) { - return this; - } - } - - public static class WhaleMapBuilder implements SetterForClassName { - private final Map instance; - public WhaleMapBuilder() { - this.instance = new LinkedHashMap<>(); - } - public Map getInstance() { - return instance; - } - public WhaleMap0Builder getBuilderAfterClassName(Map instance) { - return new WhaleMap0Builder(instance); - } - } - - - public sealed interface Whale1Boxed permits Whale1BoxedMap { - @Nullable Object getData(); - } - - public record Whale1BoxedMap(WhaleMap data) implements Whale1Boxed { - @Override - public @Nullable Object getData() { - return data; - } - } - - - public static class Whale1 extends JsonSchema implements MapSchemaValidator { - /* - NOTE: This class is auto generated by OpenAPI JSON Schema Generator. - Ref: https://github.com/openapi-json-schema-tools/openapi-json-schema-generator - - Do not edit the class manually. - */ - private static @Nullable Whale1 instance = null; - - protected Whale1() { - super(new JsonSchemaInfo() - .type(Set.of(Map.class)) - .properties(Map.ofEntries( - new PropertyEntry("hasBaleen", HasBaleen.class), - new PropertyEntry("hasTeeth", HasTeeth.class), - new PropertyEntry("className", ClassName.class) - )) - .required(Set.of( - "className" - )) - ); - } - - public static Whale1 getInstance() { - if (instance == null) { - instance = new Whale1(); - } - return instance; - } - - 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 RuntimeException("Invalid non-string key value"); - } - String propertyName = (String) entryKey; - List propertyPathToItem = new ArrayList<>(pathToItem); - propertyPathToItem.add(propertyName); - Object value = entry.getValue(); - LinkedHashMap, Nothing?> schemas = pathToSchemas.get(propertyPathToItem); - if (schemas == null) { - throw new RuntimeException("Validation result is invalid, schemas must exist for a pathToItem"); - } - JsonSchema propertySchema = schemas.entrySet().iterator().next().getKey(); - @Nullable Object propertyInstance = propertySchema.getNewInstance(value, propertyPathToItem, pathToSchemas); - properties.put(propertyName, propertyInstance); - } - FrozenMap<@Nullable Object> castProperties = new FrozenMap<>(properties); - return new WhaleMap(castProperties); - } - - 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); - SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().build())); - ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, new PathToSchemasMap(), new LinkedHashSet<>()); - PathToSchemasMap pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet); - return getNewInstance(castArg, validationMetadata.pathToItem(), pathToSchemasMap); - } - - - @Override - public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws 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"); - } - @Override - public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { - if (arg instanceof Map) { - return getNewInstance((Map) arg, pathToItem, pathToSchemas); - } - 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 { - return new Whale1BoxedMap(validate(arg, configuration)); - } - @Override - public Whale1Boxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { - 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"); - } - } - -} diff --git a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/schemas/Zebra.kt b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/schemas/Zebra.kt deleted file mode 100644 index ffe081605f0..00000000000 --- a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/schemas/Zebra.kt +++ /dev/null @@ -1,512 +0,0 @@ -package org.openapijsonschematools.client.components.schemas; -import java.util.ArrayList; -import java.util.HashSet; -import java.util.LinkedHashMap; -import java.util.LinkedHashSet; -import java.util.List; -import java.util.Map; -import java.util.Objects; -import java.util.Set; -import org.checkerframework.checker.nullness.qual.Nullable; -import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags; -import org.openapijsonschematools.client.configurations.SchemaConfiguration; -import org.openapijsonschematools.client.exceptions.InvalidAdditionalPropertyException; -import org.openapijsonschematools.client.exceptions.UnsetPropertyException; -import org.openapijsonschematools.client.exceptions.ValidationException; -import org.openapijsonschematools.client.schemas.AnyTypeJsonSchema; -import org.openapijsonschematools.client.schemas.GenericBuilder; -import org.openapijsonschematools.client.schemas.SetMaker; -import org.openapijsonschematools.client.schemas.validation.FrozenMap; -import org.openapijsonschematools.client.schemas.validation.JsonSchema; -import org.openapijsonschematools.client.schemas.validation.JsonSchemaInfo; -import org.openapijsonschematools.client.schemas.validation.MapSchemaValidator; -import org.openapijsonschematools.client.schemas.validation.MapUtils; -import org.openapijsonschematools.client.schemas.validation.PathToSchemasMap; -import org.openapijsonschematools.client.schemas.validation.PropertyEntry; -import org.openapijsonschematools.client.schemas.validation.StringEnumValidator; -import org.openapijsonschematools.client.schemas.validation.StringSchemaValidator; -import org.openapijsonschematools.client.schemas.validation.StringValueMethod; -import org.openapijsonschematools.client.schemas.validation.ValidationMetadata; - -public class Zebra { - // nest classes so all schemas and input/output classes can be public - - - public static class AdditionalProperties extends AnyTypeJsonSchema.AnyTypeJsonSchema1 { - private static @Nullable AdditionalProperties instance = null; - public static AdditionalProperties getInstance() { - if (instance == null) { - instance = new AdditionalProperties(); - } - return instance; - } - } - - public enum StringTypeEnums implements StringValueMethod { - PLAINS("plains"), - MOUNTAIN("mountain"), - GREVYS("grevys"); - private final String value; - - StringTypeEnums(String value) { - this.value = value; - } - public String value() { - return this.value; - } - } - - - public sealed interface TypeBoxed permits TypeBoxedString { - @Nullable Object getData(); - } - - public record TypeBoxedString(String data) implements TypeBoxed { - @Override - public @Nullable Object getData() { - return data; - } - } - - - - public static class Type extends JsonSchema implements StringSchemaValidator, StringEnumValidator { - private static @Nullable Type instance = null; - - protected Type() { - super(new JsonSchemaInfo() - .type(Set.of( - String.class - )) - .enumValues(SetMaker.makeSet( - "plains", - "mountain", - "grevys" - )) - ); - } - - public static Type getInstance() { - if (instance == null) { - instance = new Type(); - } - return instance; - } - - @Override - public String validate(String arg, SchemaConfiguration configuration) throws ValidationException { - Set> pathSet = new HashSet<>(); - List pathToItem = List.of("args[0"); - String castArg = castToAllowedTypes(arg, pathToItem, pathSet); - SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().build())); - ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, new PathToSchemasMap(), new LinkedHashSet<>()); - getPathToSchemas(this, castArg, validationMetadata, pathSet); - return castArg; - } - - @Override - 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 { - 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"); - } - @Override - public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { - 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"); - } - @Override - 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 { - 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"); - } - } - public enum StringClassNameEnums implements StringValueMethod { - ZEBRA("zebra"); - private final String value; - - StringClassNameEnums(String value) { - this.value = value; - } - public String value() { - return this.value; - } - } - - - public sealed interface ClassNameBoxed permits ClassNameBoxedString { - @Nullable Object getData(); - } - - public record ClassNameBoxedString(String data) implements ClassNameBoxed { - @Override - public @Nullable Object getData() { - return data; - } - } - - - - public static class ClassName extends JsonSchema implements StringSchemaValidator, StringEnumValidator { - private static @Nullable ClassName instance = null; - - protected ClassName() { - super(new JsonSchemaInfo() - .type(Set.of( - String.class - )) - .enumValues(SetMaker.makeSet( - "zebra" - )) - ); - } - - public static ClassName getInstance() { - if (instance == null) { - instance = new ClassName(); - } - return instance; - } - - @Override - public String validate(String arg, SchemaConfiguration configuration) throws ValidationException { - Set> pathSet = new HashSet<>(); - List pathToItem = List.of("args[0"); - String castArg = castToAllowedTypes(arg, pathToItem, pathSet); - SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().build())); - ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, new PathToSchemasMap(), new LinkedHashSet<>()); - getPathToSchemas(this, castArg, validationMetadata, pathSet); - return castArg; - } - - @Override - 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 { - 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"); - } - @Override - public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { - 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"); - } - @Override - 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 { - 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"); - } - } - - public static class ZebraMap extends FrozenMap<@Nullable Object> { - protected ZebraMap(FrozenMap<@Nullable Object> m) { - super(m); - } - public static final Set requiredKeys = Set.of( - "className" - ); - public static final Set optionalKeys = Set.of( - "type" - ); - public static ZebraMap of(Map arg, SchemaConfiguration configuration) throws ValidationException { - return Zebra1.getInstance().validate(arg, configuration); - } - - public String className() { - @Nullable Object value = get("className"); - if (!(value instanceof String)) { - throw new RuntimeException("Invalid value stored for className"); - } - return (String) value; - } - - public String type() throws UnsetPropertyException { - String key = "type"; - throwIfKeyNotPresent(key); - @Nullable Object value = get(key); - if (!(value instanceof String)) { - throw new RuntimeException("Invalid value stored for type"); - } - return (String) value; - } - - public @Nullable Object getAdditionalProperty(String name) throws UnsetPropertyException, InvalidAdditionalPropertyException { - throwIfKeyKnown(name, requiredKeys, optionalKeys); - return getOrThrow(name); - } - } - - public interface SetterForClassName { - Map getInstance(); - T getBuilderAfterClassName(Map instance); - - default T className(String value) { - var instance = getInstance(); - instance.put("className", value); - return getBuilderAfterClassName(instance); - } - - default T className(StringClassNameEnums value) { - var instance = getInstance(); - instance.put("className", value.value()); - return getBuilderAfterClassName(instance); - } - } - - public interface SetterForType { - Map getInstance(); - T getBuilderAfterType(Map instance); - - default T type(String value) { - var instance = getInstance(); - instance.put("type", value); - return getBuilderAfterType(instance); - } - - default T type(StringTypeEnums value) { - var instance = getInstance(); - instance.put("type", value.value()); - return getBuilderAfterType(instance); - } - } - - public interface SetterForAdditionalProperties { - Set getKnownKeys(); - Map getInstance(); - T getBuilderAfterAdditionalProperty(Map instance); - - default T additionalProperty(String key, Nothing? value) throws InvalidAdditionalPropertyException { - MapUtils.throwIfKeyKnown(key, getKnownKeys(), true); - var instance = getInstance(); - instance.put(key, null); - return getBuilderAfterAdditionalProperty(instance); - } - - default T additionalProperty(String key, boolean value) throws InvalidAdditionalPropertyException { - MapUtils.throwIfKeyKnown(key, getKnownKeys(), true); - var instance = getInstance(); - instance.put(key, value); - return getBuilderAfterAdditionalProperty(instance); - } - - default T additionalProperty(String key, String value) throws InvalidAdditionalPropertyException { - MapUtils.throwIfKeyKnown(key, getKnownKeys(), true); - var instance = getInstance(); - instance.put(key, value); - return getBuilderAfterAdditionalProperty(instance); - } - - default T additionalProperty(String key, int value) throws InvalidAdditionalPropertyException { - MapUtils.throwIfKeyKnown(key, getKnownKeys(), true); - var instance = getInstance(); - instance.put(key, value); - return getBuilderAfterAdditionalProperty(instance); - } - - default T additionalProperty(String key, float value) throws InvalidAdditionalPropertyException { - MapUtils.throwIfKeyKnown(key, getKnownKeys(), true); - var instance = getInstance(); - instance.put(key, value); - return getBuilderAfterAdditionalProperty(instance); - } - - default T additionalProperty(String key, long value) throws InvalidAdditionalPropertyException { - MapUtils.throwIfKeyKnown(key, getKnownKeys(), true); - var instance = getInstance(); - instance.put(key, value); - return getBuilderAfterAdditionalProperty(instance); - } - - default T additionalProperty(String key, double value) throws InvalidAdditionalPropertyException { - MapUtils.throwIfKeyKnown(key, getKnownKeys(), true); - var instance = getInstance(); - instance.put(key, value); - return getBuilderAfterAdditionalProperty(instance); - } - - default T additionalProperty(String key, List value) throws InvalidAdditionalPropertyException { - MapUtils.throwIfKeyKnown(key, getKnownKeys(), true); - var instance = getInstance(); - instance.put(key, value); - return getBuilderAfterAdditionalProperty(instance); - } - - default T additionalProperty(String key, Map value) throws InvalidAdditionalPropertyException { - MapUtils.throwIfKeyKnown(key, getKnownKeys(), true); - var instance = getInstance(); - instance.put(key, value); - return getBuilderAfterAdditionalProperty(instance); - } - } - - public static class ZebraMap0Builder implements GenericBuilder>, SetterForType, SetterForAdditionalProperties { - private final Map instance; - private static final Set knownKeys = Set.of( - "className", - "type" - ); - public Set getKnownKeys() { - return knownKeys; - } - public ZebraMap0Builder(Map instance) { - this.instance = instance; - } - public Map build() { - return instance; - } - public Map getInstance() { - return instance; - } - public ZebraMap0Builder getBuilderAfterType(Map instance) { - return this; - } - public ZebraMap0Builder getBuilderAfterAdditionalProperty(Map instance) { - return this; - } - } - - public static class ZebraMapBuilder implements SetterForClassName { - private final Map instance; - public ZebraMapBuilder() { - this.instance = new LinkedHashMap<>(); - } - public Map getInstance() { - return instance; - } - public ZebraMap0Builder getBuilderAfterClassName(Map instance) { - return new ZebraMap0Builder(instance); - } - } - - - public sealed interface Zebra1Boxed permits Zebra1BoxedMap { - @Nullable Object getData(); - } - - public record Zebra1BoxedMap(ZebraMap data) implements Zebra1Boxed { - @Override - public @Nullable Object getData() { - return data; - } - } - - - public static class Zebra1 extends JsonSchema implements MapSchemaValidator { - /* - NOTE: This class is auto generated by OpenAPI JSON Schema Generator. - Ref: https://github.com/openapi-json-schema-tools/openapi-json-schema-generator - - Do not edit the class manually. - */ - private static @Nullable Zebra1 instance = null; - - protected Zebra1() { - super(new JsonSchemaInfo() - .type(Set.of(Map.class)) - .properties(Map.ofEntries( - new PropertyEntry("type", Type.class), - new PropertyEntry("className", ClassName.class) - )) - .required(Set.of( - "className" - )) - .additionalProperties(AdditionalProperties.class) - ); - } - - public static Zebra1 getInstance() { - if (instance == null) { - instance = new Zebra1(); - } - return instance; - } - - 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 RuntimeException("Invalid non-string key value"); - } - String propertyName = (String) entryKey; - List propertyPathToItem = new ArrayList<>(pathToItem); - propertyPathToItem.add(propertyName); - Object value = entry.getValue(); - LinkedHashMap, Nothing?> schemas = pathToSchemas.get(propertyPathToItem); - if (schemas == null) { - throw new RuntimeException("Validation result is invalid, schemas must exist for a pathToItem"); - } - JsonSchema propertySchema = schemas.entrySet().iterator().next().getKey(); - @Nullable Object propertyInstance = propertySchema.getNewInstance(value, propertyPathToItem, pathToSchemas); - properties.put(propertyName, propertyInstance); - } - FrozenMap<@Nullable Object> castProperties = new FrozenMap<>(properties); - return new ZebraMap(castProperties); - } - - 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); - SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().build())); - ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, new PathToSchemasMap(), new LinkedHashSet<>()); - PathToSchemasMap pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet); - return getNewInstance(castArg, validationMetadata.pathToItem(), pathToSchemasMap); - } - - - @Override - public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws 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"); - } - @Override - public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { - if (arg instanceof Map) { - return getNewInstance((Map) arg, pathToItem, pathToSchemas); - } - 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 { - return new Zebra1BoxedMap(validate(arg, configuration)); - } - @Override - public Zebra1Boxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { - 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"); - } - } - -} diff --git a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/securityschemes/ApiKey.kt b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/securityschemes/ApiKey.kt deleted file mode 100644 index 201d3a69593..00000000000 --- a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/securityschemes/ApiKey.kt +++ /dev/null @@ -1,12 +0,0 @@ -package org.openapijsonschematools.client.components.securityschemes; - -import org.openapijsonschematools.client.securityschemes.ApiKeyHeaderSecurityScheme; - -public class ApiKey extends ApiKeyHeaderSecurityScheme { - /* - apiKey in header - */ - public ApiKey(String apiKey) { - super(apiKey, "api_key"); - } -} diff --git a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/securityschemes/ApiKeyQuery.kt b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/securityschemes/ApiKeyQuery.kt deleted file mode 100644 index 2f33bbf5799..00000000000 --- a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/securityschemes/ApiKeyQuery.kt +++ /dev/null @@ -1,12 +0,0 @@ -package org.openapijsonschematools.client.components.securityschemes; - -import org.openapijsonschematools.client.securityschemes.ApiKeyQuerySecurityScheme; - -public class ApiKeyQuery extends ApiKeyQuerySecurityScheme { - /* - apiKey in query - */ - public ApiKeyQuery(String apiKey) { - super(apiKey, "api_key_query"); - } -} diff --git a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/securityschemes/BearerTest.kt b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/securityschemes/BearerTest.kt deleted file mode 100644 index 9ed5b4700b4..00000000000 --- a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/securityschemes/BearerTest.kt +++ /dev/null @@ -1,12 +0,0 @@ -package org.openapijsonschematools.client.components.securityschemes; - -import org.openapijsonschematools.client.securityschemes.HttpBearerSecurityScheme; - -public class BearerTest extends HttpBearerSecurityScheme { - /* - http bearer with JWT bearer format - */ - public BearerTest(String accessToken) { - super(accessToken, "JWT"); - } -} diff --git a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/securityschemes/HttpBasicTest.kt b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/securityschemes/HttpBasicTest.kt deleted file mode 100644 index 2e01c07d4a7..00000000000 --- a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/securityschemes/HttpBasicTest.kt +++ /dev/null @@ -1,12 +0,0 @@ -package org.openapijsonschematools.client.components.securityschemes; - -import org.openapijsonschematools.client.securityschemes.HttpBasicSecurityScheme; - -public class HttpBasicTest extends HttpBasicSecurityScheme { - /* - http basic - */ - public HttpBasicTest(String userId, String password) { - super(userId, password); - } -} diff --git a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/securityschemes/HttpSignatureTest.kt b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/securityschemes/HttpSignatureTest.kt deleted file mode 100644 index 07e6c3ab676..00000000000 --- a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/securityschemes/HttpSignatureTest.kt +++ /dev/null @@ -1,9 +0,0 @@ -package org.openapijsonschematools.client.components.securityschemes; - -import org.openapijsonschematools.client.securityschemes.HttpSignatureSecurityScheme; - -public class HttpSignatureTest extends HttpSignatureSecurityScheme { - /* - http + signature - */ -} diff --git a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/securityschemes/OpenIdConnectTest.kt b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/securityschemes/OpenIdConnectTest.kt deleted file mode 100644 index 204c2c47cab..00000000000 --- a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/securityschemes/OpenIdConnectTest.kt +++ /dev/null @@ -1,9 +0,0 @@ -package org.openapijsonschematools.client.components.securityschemes; - -import org.openapijsonschematools.client.securityschemes.OpenIdConnectSecurityScheme; - -public class OpenIdConnectTest extends OpenIdConnectSecurityScheme { - /* - openIdConnect - */ -} diff --git a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/securityschemes/PetstoreAuth.kt b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/securityschemes/PetstoreAuth.kt deleted file mode 100644 index ad84bd017f6..00000000000 --- a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/securityschemes/PetstoreAuth.kt +++ /dev/null @@ -1,10 +0,0 @@ -package org.openapijsonschematools.client.components.securityschemes; - -import org.openapijsonschematools.client.securityschemes.OAuth2SecurityScheme; - -public class PetstoreAuth extends OAuth2SecurityScheme { - /* - oauth2 implicit flow with two scopes - */ - // todo add flows info -} diff --git a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/configurations/ApiConfiguration.kt b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/configurations/ApiConfiguration.kt deleted file mode 100644 index 30ee3f8d415..00000000000 --- a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/configurations/ApiConfiguration.kt +++ /dev/null @@ -1,500 +0,0 @@ -package org.openapijsonschematools.client.configurations; - -import org.openapijsonschematools.client.securityrequirementobjects.SecurityRequirementObject; -import org.openapijsonschematools.client.servers.Server; -import org.openapijsonschematools.client.paths.foo.get.FooGetServerInfo; -import org.openapijsonschematools.client.paths.petfindbystatus.PetfindbystatusServerInfo; -import org.openapijsonschematools.client.RootServerInfo; -import org.openapijsonschematools.client.paths.fake.delete.FakeDeleteSecurityInfo; -import org.openapijsonschematools.client.paths.fake.post.FakePostSecurityInfo; -import org.openapijsonschematools.client.paths.fakeclassnametest.patch.FakeclassnametestPatchSecurityInfo; -import org.openapijsonschematools.client.paths.fakemultiplesecurities.get.FakemultiplesecuritiesGetSecurityInfo; -import org.openapijsonschematools.client.paths.fakepetiduploadimagewithrequiredfile.post.FakepetiduploadimagewithrequiredfilePostSecurityInfo; -import org.openapijsonschematools.client.paths.pet.post.PetPostSecurityInfo; -import org.openapijsonschematools.client.paths.pet.put.PetPutSecurityInfo; -import org.openapijsonschematools.client.paths.petfindbystatus.get.PetfindbystatusGetSecurityInfo; -import org.openapijsonschematools.client.paths.petfindbytags.get.PetfindbytagsGetSecurityInfo; -import org.openapijsonschematools.client.paths.petpetid.delete.PetpetidDeleteSecurityInfo; -import org.openapijsonschematools.client.paths.petpetid.get.PetpetidGetSecurityInfo; -import org.openapijsonschematools.client.paths.petpetid.post.PetpetidPostSecurityInfo; -import org.openapijsonschematools.client.paths.petpetiduploadimage.post.PetpetiduploadimagePostSecurityInfo; -import org.openapijsonschematools.client.paths.storeinventory.get.StoreinventoryGetSecurityInfo; -import org.openapijsonschematools.client.securityschemes.SecurityScheme; -import org.checkerframework.checker.nullness.qual.Nullable; - -import java.time.Duration; -import java.util.List; -import java.util.Map; -import java.util.Objects; -import java.util.HashMap; - -public class ApiConfiguration { - private final ServerInfo serverInfo; - private final ServerIndexInfo serverIndexInfo; - private final SecurityInfo securityInfo; - private final SecurityIndexInfo securityIndexInfo; - private final @Nullable Duration timeout; - private final Map, SecurityScheme> securitySchemeInfo; - private final Map> defaultHeaders; - - public ApiConfiguration() { - serverInfo = new ServerInfoBuilder().build(); - serverIndexInfo = new ServerIndexInfoBuilder().build(); - securityInfo = new SecurityInfo(); - securityIndexInfo = new SecurityIndexInfoBuilder().build(); - securitySchemeInfo = new HashMap<>(); - timeout = null; - defaultHeaders = new HashMap<>(); - } - - public ApiConfiguration(ServerInfo serverInfo, ServerIndexInfo serverIndexInfo, List securitySchemes, SecurityIndexInfo securityIndexInfo, Duration timeout, Map> defaultHeaders) { - this.serverInfo = serverInfo; - this.serverIndexInfo = serverIndexInfo; - this.securityInfo = new SecurityInfo(); - this.securityIndexInfo = securityIndexInfo; - securitySchemeInfo = new HashMap<>(); - for (SecurityScheme securityScheme: securitySchemes) { - securitySchemeInfo.put(securityScheme.getClass(), securityScheme); - } - this.timeout = timeout; - this.defaultHeaders = defaultHeaders; - } - - public static class ServerInfo { - final FooGetServerInfo.FooGetServerInfo1 fooGetServerInfo; - final PetfindbystatusServerInfo.PetfindbystatusServerInfo1 petfindbystatusServerInfo; - final RootServerInfo.RootServerInfo1 rootServerInfo; - - ServerInfo( - FooGetServerInfo. @Nullable FooGetServerInfo1 fooGetServerInfo, - PetfindbystatusServerInfo. @Nullable PetfindbystatusServerInfo1 petfindbystatusServerInfo, - RootServerInfo. @Nullable RootServerInfo1 rootServerInfo - ) { - this.fooGetServerInfo = Objects.requireNonNullElse(fooGetServerInfo, new FooGetServerInfo.FooGetServerInfoBuilder().build()); - this.petfindbystatusServerInfo = Objects.requireNonNullElse(petfindbystatusServerInfo, new PetfindbystatusServerInfo.PetfindbystatusServerInfoBuilder().build()); - this.rootServerInfo = Objects.requireNonNullElse(rootServerInfo, new RootServerInfo.RootServerInfoBuilder().build()); - } - } - - public static class ServerInfoBuilder { - private FooGetServerInfo. @Nullable FooGetServerInfo1 fooGetServerInfo; - private PetfindbystatusServerInfo. @Nullable PetfindbystatusServerInfo1 petfindbystatusServerInfo; - private RootServerInfo. @Nullable RootServerInfo1 rootServerInfo; - public ServerInfoBuilder() {} - - public ServerInfoBuilder fooGetServerInfo(FooGetServerInfo.FooGetServerInfo1 fooGetServerInfo) { - this.fooGetServerInfo = fooGetServerInfo; - return this; - } - - public ServerInfoBuilder petfindbystatusServerInfo(PetfindbystatusServerInfo.PetfindbystatusServerInfo1 petfindbystatusServerInfo) { - this.petfindbystatusServerInfo = petfindbystatusServerInfo; - return this; - } - - public ServerInfoBuilder rootServerInfo(RootServerInfo.RootServerInfo1 rootServerInfo) { - this.rootServerInfo = rootServerInfo; - return this; - } - - public ServerInfo build() { - return new ServerInfo( - fooGetServerInfo, - petfindbystatusServerInfo, - rootServerInfo - ); - } - } - - public static class ServerIndexInfo { - final FooGetServerInfo.ServerIndex fooGetServerInfoServerIndex; - final PetfindbystatusServerInfo.ServerIndex petfindbystatusServerInfoServerIndex; - final RootServerInfo.ServerIndex rootServerInfoServerIndex; - - ServerIndexInfo( - FooGetServerInfo. @Nullable ServerIndex fooGetServerInfoServerIndex, - PetfindbystatusServerInfo. @Nullable ServerIndex petfindbystatusServerInfoServerIndex, - RootServerInfo. @Nullable ServerIndex rootServerInfoServerIndex - ) { - this.fooGetServerInfoServerIndex = Objects.requireNonNullElse(fooGetServerInfoServerIndex, FooGetServerInfo.ServerIndex.SERVER_0); - this.petfindbystatusServerInfoServerIndex = Objects.requireNonNullElse(petfindbystatusServerInfoServerIndex, PetfindbystatusServerInfo.ServerIndex.SERVER_0); - this.rootServerInfoServerIndex = Objects.requireNonNullElse(rootServerInfoServerIndex, RootServerInfo.ServerIndex.SERVER_0); - } - } - - public static class ServerIndexInfoBuilder { - private FooGetServerInfo. @Nullable ServerIndex fooGetServerInfoServerIndex; - private PetfindbystatusServerInfo. @Nullable ServerIndex petfindbystatusServerInfoServerIndex; - private RootServerInfo. @Nullable ServerIndex rootServerInfoServerIndex; - public ServerIndexInfoBuilder() {} - - public ServerIndexInfoBuilder fooGetServerInfoServerIndex(FooGetServerInfo.ServerIndex serverIndex) { - this.fooGetServerInfoServerIndex = serverIndex; - return this; - } - - public ServerIndexInfoBuilder petfindbystatusServerInfoServerIndex(PetfindbystatusServerInfo.ServerIndex serverIndex) { - this.petfindbystatusServerInfoServerIndex = serverIndex; - return this; - } - - public ServerIndexInfoBuilder rootServerInfoServerIndex(RootServerInfo.ServerIndex serverIndex) { - this.rootServerInfoServerIndex = serverIndex; - return this; - } - - public ServerIndexInfo build() { - return new ServerIndexInfo( - fooGetServerInfoServerIndex, - petfindbystatusServerInfoServerIndex, - rootServerInfoServerIndex - ); - } - } - - public Server getServer(FooGetServerInfo. @Nullable ServerIndex serverIndex) { - var serverProvider = serverInfo.fooGetServerInfo; - if (serverIndex == null) { - FooGetServerInfo.ServerIndex configServerIndex = serverIndexInfo.fooGetServerInfoServerIndex; - return serverProvider.getServer(configServerIndex); - } - return serverProvider.getServer(serverIndex); - } - - public Server getServer(PetfindbystatusServerInfo. @Nullable ServerIndex serverIndex) { - var serverProvider = serverInfo.petfindbystatusServerInfo; - if (serverIndex == null) { - PetfindbystatusServerInfo.ServerIndex configServerIndex = serverIndexInfo.petfindbystatusServerInfoServerIndex; - return serverProvider.getServer(configServerIndex); - } - return serverProvider.getServer(serverIndex); - } - - public Server getServer(RootServerInfo. @Nullable ServerIndex serverIndex) { - var serverProvider = serverInfo.rootServerInfo; - if (serverIndex == null) { - RootServerInfo.ServerIndex configServerIndex = serverIndexInfo.rootServerInfoServerIndex; - return serverProvider.getServer(configServerIndex); - } - return serverProvider.getServer(serverIndex); - } - - public static class SecurityInfo { - protected final FakeDeleteSecurityInfo.FakeDeleteSecurityInfo1 fakeDeleteSecurityInfo; - protected final FakePostSecurityInfo.FakePostSecurityInfo1 fakePostSecurityInfo; - protected final FakeclassnametestPatchSecurityInfo.FakeclassnametestPatchSecurityInfo1 fakeclassnametestPatchSecurityInfo; - protected final FakemultiplesecuritiesGetSecurityInfo.FakemultiplesecuritiesGetSecurityInfo1 fakemultiplesecuritiesGetSecurityInfo; - protected final FakepetiduploadimagewithrequiredfilePostSecurityInfo.FakepetiduploadimagewithrequiredfilePostSecurityInfo1 fakepetiduploadimagewithrequiredfilePostSecurityInfo; - protected final PetPostSecurityInfo.PetPostSecurityInfo1 petPostSecurityInfo; - protected final PetPutSecurityInfo.PetPutSecurityInfo1 petPutSecurityInfo; - protected final PetfindbystatusGetSecurityInfo.PetfindbystatusGetSecurityInfo1 petfindbystatusGetSecurityInfo; - protected final PetfindbytagsGetSecurityInfo.PetfindbytagsGetSecurityInfo1 petfindbytagsGetSecurityInfo; - protected final PetpetidDeleteSecurityInfo.PetpetidDeleteSecurityInfo1 petpetidDeleteSecurityInfo; - protected final PetpetidGetSecurityInfo.PetpetidGetSecurityInfo1 petpetidGetSecurityInfo; - protected final PetpetidPostSecurityInfo.PetpetidPostSecurityInfo1 petpetidPostSecurityInfo; - protected final PetpetiduploadimagePostSecurityInfo.PetpetiduploadimagePostSecurityInfo1 petpetiduploadimagePostSecurityInfo; - protected final StoreinventoryGetSecurityInfo.StoreinventoryGetSecurityInfo1 storeinventoryGetSecurityInfo; - - public SecurityInfo() { - this.fakeDeleteSecurityInfo = new FakeDeleteSecurityInfo.FakeDeleteSecurityInfo1(); - this.fakePostSecurityInfo = new FakePostSecurityInfo.FakePostSecurityInfo1(); - this.fakeclassnametestPatchSecurityInfo = new FakeclassnametestPatchSecurityInfo.FakeclassnametestPatchSecurityInfo1(); - this.fakemultiplesecuritiesGetSecurityInfo = new FakemultiplesecuritiesGetSecurityInfo.FakemultiplesecuritiesGetSecurityInfo1(); - this.fakepetiduploadimagewithrequiredfilePostSecurityInfo = new FakepetiduploadimagewithrequiredfilePostSecurityInfo.FakepetiduploadimagewithrequiredfilePostSecurityInfo1(); - this.petPostSecurityInfo = new PetPostSecurityInfo.PetPostSecurityInfo1(); - this.petPutSecurityInfo = new PetPutSecurityInfo.PetPutSecurityInfo1(); - this.petfindbystatusGetSecurityInfo = new PetfindbystatusGetSecurityInfo.PetfindbystatusGetSecurityInfo1(); - this.petfindbytagsGetSecurityInfo = new PetfindbytagsGetSecurityInfo.PetfindbytagsGetSecurityInfo1(); - this.petpetidDeleteSecurityInfo = new PetpetidDeleteSecurityInfo.PetpetidDeleteSecurityInfo1(); - this.petpetidGetSecurityInfo = new PetpetidGetSecurityInfo.PetpetidGetSecurityInfo1(); - this.petpetidPostSecurityInfo = new PetpetidPostSecurityInfo.PetpetidPostSecurityInfo1(); - this.petpetiduploadimagePostSecurityInfo = new PetpetiduploadimagePostSecurityInfo.PetpetiduploadimagePostSecurityInfo1(); - this.storeinventoryGetSecurityInfo = new StoreinventoryGetSecurityInfo.StoreinventoryGetSecurityInfo1(); - } - } - - public static class SecurityIndexInfo { - final FakeDeleteSecurityInfo.SecurityIndex fakeDeleteSecurityInfoSecurityIndex; - final FakePostSecurityInfo.SecurityIndex fakePostSecurityInfoSecurityIndex; - final FakeclassnametestPatchSecurityInfo.SecurityIndex fakeclassnametestPatchSecurityInfoSecurityIndex; - final FakemultiplesecuritiesGetSecurityInfo.SecurityIndex fakemultiplesecuritiesGetSecurityInfoSecurityIndex; - final FakepetiduploadimagewithrequiredfilePostSecurityInfo.SecurityIndex fakepetiduploadimagewithrequiredfilePostSecurityInfoSecurityIndex; - final PetPostSecurityInfo.SecurityIndex petPostSecurityInfoSecurityIndex; - final PetPutSecurityInfo.SecurityIndex petPutSecurityInfoSecurityIndex; - final PetfindbystatusGetSecurityInfo.SecurityIndex petfindbystatusGetSecurityInfoSecurityIndex; - final PetfindbytagsGetSecurityInfo.SecurityIndex petfindbytagsGetSecurityInfoSecurityIndex; - final PetpetidDeleteSecurityInfo.SecurityIndex petpetidDeleteSecurityInfoSecurityIndex; - final PetpetidGetSecurityInfo.SecurityIndex petpetidGetSecurityInfoSecurityIndex; - final PetpetidPostSecurityInfo.SecurityIndex petpetidPostSecurityInfoSecurityIndex; - final PetpetiduploadimagePostSecurityInfo.SecurityIndex petpetiduploadimagePostSecurityInfoSecurityIndex; - final StoreinventoryGetSecurityInfo.SecurityIndex storeinventoryGetSecurityInfoSecurityIndex; - - SecurityIndexInfo( - FakeDeleteSecurityInfo. @Nullable SecurityIndex fakeDeleteSecurityInfoSecurityIndex, - FakePostSecurityInfo. @Nullable SecurityIndex fakePostSecurityInfoSecurityIndex, - FakeclassnametestPatchSecurityInfo. @Nullable SecurityIndex fakeclassnametestPatchSecurityInfoSecurityIndex, - FakemultiplesecuritiesGetSecurityInfo. @Nullable SecurityIndex fakemultiplesecuritiesGetSecurityInfoSecurityIndex, - FakepetiduploadimagewithrequiredfilePostSecurityInfo. @Nullable SecurityIndex fakepetiduploadimagewithrequiredfilePostSecurityInfoSecurityIndex, - PetPostSecurityInfo. @Nullable SecurityIndex petPostSecurityInfoSecurityIndex, - PetPutSecurityInfo. @Nullable SecurityIndex petPutSecurityInfoSecurityIndex, - PetfindbystatusGetSecurityInfo. @Nullable SecurityIndex petfindbystatusGetSecurityInfoSecurityIndex, - PetfindbytagsGetSecurityInfo. @Nullable SecurityIndex petfindbytagsGetSecurityInfoSecurityIndex, - PetpetidDeleteSecurityInfo. @Nullable SecurityIndex petpetidDeleteSecurityInfoSecurityIndex, - PetpetidGetSecurityInfo. @Nullable SecurityIndex petpetidGetSecurityInfoSecurityIndex, - PetpetidPostSecurityInfo. @Nullable SecurityIndex petpetidPostSecurityInfoSecurityIndex, - PetpetiduploadimagePostSecurityInfo. @Nullable SecurityIndex petpetiduploadimagePostSecurityInfoSecurityIndex, - StoreinventoryGetSecurityInfo. @Nullable SecurityIndex storeinventoryGetSecurityInfoSecurityIndex - ) { - this.fakeDeleteSecurityInfoSecurityIndex = Objects.requireNonNullElse(fakeDeleteSecurityInfoSecurityIndex, FakeDeleteSecurityInfo.SecurityIndex.SECURITY_0); - this.fakePostSecurityInfoSecurityIndex = Objects.requireNonNullElse(fakePostSecurityInfoSecurityIndex, FakePostSecurityInfo.SecurityIndex.SECURITY_0); - this.fakeclassnametestPatchSecurityInfoSecurityIndex = Objects.requireNonNullElse(fakeclassnametestPatchSecurityInfoSecurityIndex, FakeclassnametestPatchSecurityInfo.SecurityIndex.SECURITY_0); - this.fakemultiplesecuritiesGetSecurityInfoSecurityIndex = Objects.requireNonNullElse(fakemultiplesecuritiesGetSecurityInfoSecurityIndex, FakemultiplesecuritiesGetSecurityInfo.SecurityIndex.SECURITY_0); - this.fakepetiduploadimagewithrequiredfilePostSecurityInfoSecurityIndex = Objects.requireNonNullElse(fakepetiduploadimagewithrequiredfilePostSecurityInfoSecurityIndex, FakepetiduploadimagewithrequiredfilePostSecurityInfo.SecurityIndex.SECURITY_0); - this.petPostSecurityInfoSecurityIndex = Objects.requireNonNullElse(petPostSecurityInfoSecurityIndex, PetPostSecurityInfo.SecurityIndex.SECURITY_0); - this.petPutSecurityInfoSecurityIndex = Objects.requireNonNullElse(petPutSecurityInfoSecurityIndex, PetPutSecurityInfo.SecurityIndex.SECURITY_0); - this.petfindbystatusGetSecurityInfoSecurityIndex = Objects.requireNonNullElse(petfindbystatusGetSecurityInfoSecurityIndex, PetfindbystatusGetSecurityInfo.SecurityIndex.SECURITY_0); - this.petfindbytagsGetSecurityInfoSecurityIndex = Objects.requireNonNullElse(petfindbytagsGetSecurityInfoSecurityIndex, PetfindbytagsGetSecurityInfo.SecurityIndex.SECURITY_0); - this.petpetidDeleteSecurityInfoSecurityIndex = Objects.requireNonNullElse(petpetidDeleteSecurityInfoSecurityIndex, PetpetidDeleteSecurityInfo.SecurityIndex.SECURITY_0); - this.petpetidGetSecurityInfoSecurityIndex = Objects.requireNonNullElse(petpetidGetSecurityInfoSecurityIndex, PetpetidGetSecurityInfo.SecurityIndex.SECURITY_0); - this.petpetidPostSecurityInfoSecurityIndex = Objects.requireNonNullElse(petpetidPostSecurityInfoSecurityIndex, PetpetidPostSecurityInfo.SecurityIndex.SECURITY_0); - this.petpetiduploadimagePostSecurityInfoSecurityIndex = Objects.requireNonNullElse(petpetiduploadimagePostSecurityInfoSecurityIndex, PetpetiduploadimagePostSecurityInfo.SecurityIndex.SECURITY_0); - this.storeinventoryGetSecurityInfoSecurityIndex = Objects.requireNonNullElse(storeinventoryGetSecurityInfoSecurityIndex, StoreinventoryGetSecurityInfo.SecurityIndex.SECURITY_0); - } - } - - public static class SecurityIndexInfoBuilder { - private FakeDeleteSecurityInfo. @Nullable SecurityIndex fakeDeleteSecurityInfoSecurityIndex; - private FakePostSecurityInfo. @Nullable SecurityIndex fakePostSecurityInfoSecurityIndex; - private FakeclassnametestPatchSecurityInfo. @Nullable SecurityIndex fakeclassnametestPatchSecurityInfoSecurityIndex; - private FakemultiplesecuritiesGetSecurityInfo. @Nullable SecurityIndex fakemultiplesecuritiesGetSecurityInfoSecurityIndex; - private FakepetiduploadimagewithrequiredfilePostSecurityInfo. @Nullable SecurityIndex fakepetiduploadimagewithrequiredfilePostSecurityInfoSecurityIndex; - private PetPostSecurityInfo. @Nullable SecurityIndex petPostSecurityInfoSecurityIndex; - private PetPutSecurityInfo. @Nullable SecurityIndex petPutSecurityInfoSecurityIndex; - private PetfindbystatusGetSecurityInfo. @Nullable SecurityIndex petfindbystatusGetSecurityInfoSecurityIndex; - private PetfindbytagsGetSecurityInfo. @Nullable SecurityIndex petfindbytagsGetSecurityInfoSecurityIndex; - private PetpetidDeleteSecurityInfo. @Nullable SecurityIndex petpetidDeleteSecurityInfoSecurityIndex; - private PetpetidGetSecurityInfo. @Nullable SecurityIndex petpetidGetSecurityInfoSecurityIndex; - private PetpetidPostSecurityInfo. @Nullable SecurityIndex petpetidPostSecurityInfoSecurityIndex; - private PetpetiduploadimagePostSecurityInfo. @Nullable SecurityIndex petpetiduploadimagePostSecurityInfoSecurityIndex; - private StoreinventoryGetSecurityInfo. @Nullable SecurityIndex storeinventoryGetSecurityInfoSecurityIndex; - public SecurityIndexInfoBuilder() {} - - public SecurityIndexInfoBuilder fakeDeleteSecurityInfoSecurityIndex(FakeDeleteSecurityInfo.SecurityIndex securityIndex) { - this.fakeDeleteSecurityInfoSecurityIndex = securityIndex; - return this; - } - - public SecurityIndexInfoBuilder fakePostSecurityInfoSecurityIndex(FakePostSecurityInfo.SecurityIndex securityIndex) { - this.fakePostSecurityInfoSecurityIndex = securityIndex; - return this; - } - - public SecurityIndexInfoBuilder fakeclassnametestPatchSecurityInfoSecurityIndex(FakeclassnametestPatchSecurityInfo.SecurityIndex securityIndex) { - this.fakeclassnametestPatchSecurityInfoSecurityIndex = securityIndex; - return this; - } - - public SecurityIndexInfoBuilder fakemultiplesecuritiesGetSecurityInfoSecurityIndex(FakemultiplesecuritiesGetSecurityInfo.SecurityIndex securityIndex) { - this.fakemultiplesecuritiesGetSecurityInfoSecurityIndex = securityIndex; - return this; - } - - public SecurityIndexInfoBuilder fakepetiduploadimagewithrequiredfilePostSecurityInfoSecurityIndex(FakepetiduploadimagewithrequiredfilePostSecurityInfo.SecurityIndex securityIndex) { - this.fakepetiduploadimagewithrequiredfilePostSecurityInfoSecurityIndex = securityIndex; - return this; - } - - public SecurityIndexInfoBuilder petPostSecurityInfoSecurityIndex(PetPostSecurityInfo.SecurityIndex securityIndex) { - this.petPostSecurityInfoSecurityIndex = securityIndex; - return this; - } - - public SecurityIndexInfoBuilder petPutSecurityInfoSecurityIndex(PetPutSecurityInfo.SecurityIndex securityIndex) { - this.petPutSecurityInfoSecurityIndex = securityIndex; - return this; - } - - public SecurityIndexInfoBuilder petfindbystatusGetSecurityInfoSecurityIndex(PetfindbystatusGetSecurityInfo.SecurityIndex securityIndex) { - this.petfindbystatusGetSecurityInfoSecurityIndex = securityIndex; - return this; - } - - public SecurityIndexInfoBuilder petfindbytagsGetSecurityInfoSecurityIndex(PetfindbytagsGetSecurityInfo.SecurityIndex securityIndex) { - this.petfindbytagsGetSecurityInfoSecurityIndex = securityIndex; - return this; - } - - public SecurityIndexInfoBuilder petpetidDeleteSecurityInfoSecurityIndex(PetpetidDeleteSecurityInfo.SecurityIndex securityIndex) { - this.petpetidDeleteSecurityInfoSecurityIndex = securityIndex; - return this; - } - - public SecurityIndexInfoBuilder petpetidGetSecurityInfoSecurityIndex(PetpetidGetSecurityInfo.SecurityIndex securityIndex) { - this.petpetidGetSecurityInfoSecurityIndex = securityIndex; - return this; - } - - public SecurityIndexInfoBuilder petpetidPostSecurityInfoSecurityIndex(PetpetidPostSecurityInfo.SecurityIndex securityIndex) { - this.petpetidPostSecurityInfoSecurityIndex = securityIndex; - return this; - } - - public SecurityIndexInfoBuilder petpetiduploadimagePostSecurityInfoSecurityIndex(PetpetiduploadimagePostSecurityInfo.SecurityIndex securityIndex) { - this.petpetiduploadimagePostSecurityInfoSecurityIndex = securityIndex; - return this; - } - - public SecurityIndexInfoBuilder storeinventoryGetSecurityInfoSecurityIndex(StoreinventoryGetSecurityInfo.SecurityIndex securityIndex) { - this.storeinventoryGetSecurityInfoSecurityIndex = securityIndex; - return this; - } - - public SecurityIndexInfo build() { - return new SecurityIndexInfo( - fakeDeleteSecurityInfoSecurityIndex, - fakePostSecurityInfoSecurityIndex, - fakeclassnametestPatchSecurityInfoSecurityIndex, - fakemultiplesecuritiesGetSecurityInfoSecurityIndex, - fakepetiduploadimagewithrequiredfilePostSecurityInfoSecurityIndex, - petPostSecurityInfoSecurityIndex, - petPutSecurityInfoSecurityIndex, - petfindbystatusGetSecurityInfoSecurityIndex, - petfindbytagsGetSecurityInfoSecurityIndex, - petpetidDeleteSecurityInfoSecurityIndex, - petpetidGetSecurityInfoSecurityIndex, - petpetidPostSecurityInfoSecurityIndex, - petpetiduploadimagePostSecurityInfoSecurityIndex, - storeinventoryGetSecurityInfoSecurityIndex - ); - } - } - - public SecurityRequirementObject getSecurityRequirementObject(FakeDeleteSecurityInfo. @Nullable SecurityIndex securityIndex) { - var securityInfoInstance = securityInfo.fakeDeleteSecurityInfo; - if (securityIndex == null) { - FakeDeleteSecurityInfo.SecurityIndex configSecurityIndex = securityIndexInfo.fakeDeleteSecurityInfoSecurityIndex; - return securityInfoInstance.getSecurityRequirementObject(configSecurityIndex); - } - return securityInfoInstance.getSecurityRequirementObject(securityIndex); - } - public SecurityRequirementObject getSecurityRequirementObject(FakePostSecurityInfo. @Nullable SecurityIndex securityIndex) { - var securityInfoInstance = securityInfo.fakePostSecurityInfo; - if (securityIndex == null) { - FakePostSecurityInfo.SecurityIndex configSecurityIndex = securityIndexInfo.fakePostSecurityInfoSecurityIndex; - return securityInfoInstance.getSecurityRequirementObject(configSecurityIndex); - } - return securityInfoInstance.getSecurityRequirementObject(securityIndex); - } - public SecurityRequirementObject getSecurityRequirementObject(FakeclassnametestPatchSecurityInfo. @Nullable SecurityIndex securityIndex) { - var securityInfoInstance = securityInfo.fakeclassnametestPatchSecurityInfo; - if (securityIndex == null) { - FakeclassnametestPatchSecurityInfo.SecurityIndex configSecurityIndex = securityIndexInfo.fakeclassnametestPatchSecurityInfoSecurityIndex; - return securityInfoInstance.getSecurityRequirementObject(configSecurityIndex); - } - return securityInfoInstance.getSecurityRequirementObject(securityIndex); - } - public SecurityRequirementObject getSecurityRequirementObject(FakemultiplesecuritiesGetSecurityInfo. @Nullable SecurityIndex securityIndex) { - var securityInfoInstance = securityInfo.fakemultiplesecuritiesGetSecurityInfo; - if (securityIndex == null) { - FakemultiplesecuritiesGetSecurityInfo.SecurityIndex configSecurityIndex = securityIndexInfo.fakemultiplesecuritiesGetSecurityInfoSecurityIndex; - return securityInfoInstance.getSecurityRequirementObject(configSecurityIndex); - } - return securityInfoInstance.getSecurityRequirementObject(securityIndex); - } - public SecurityRequirementObject getSecurityRequirementObject(FakepetiduploadimagewithrequiredfilePostSecurityInfo. @Nullable SecurityIndex securityIndex) { - var securityInfoInstance = securityInfo.fakepetiduploadimagewithrequiredfilePostSecurityInfo; - if (securityIndex == null) { - FakepetiduploadimagewithrequiredfilePostSecurityInfo.SecurityIndex configSecurityIndex = securityIndexInfo.fakepetiduploadimagewithrequiredfilePostSecurityInfoSecurityIndex; - return securityInfoInstance.getSecurityRequirementObject(configSecurityIndex); - } - return securityInfoInstance.getSecurityRequirementObject(securityIndex); - } - public SecurityRequirementObject getSecurityRequirementObject(PetPostSecurityInfo. @Nullable SecurityIndex securityIndex) { - var securityInfoInstance = securityInfo.petPostSecurityInfo; - if (securityIndex == null) { - PetPostSecurityInfo.SecurityIndex configSecurityIndex = securityIndexInfo.petPostSecurityInfoSecurityIndex; - return securityInfoInstance.getSecurityRequirementObject(configSecurityIndex); - } - return securityInfoInstance.getSecurityRequirementObject(securityIndex); - } - public SecurityRequirementObject getSecurityRequirementObject(PetPutSecurityInfo. @Nullable SecurityIndex securityIndex) { - var securityInfoInstance = securityInfo.petPutSecurityInfo; - if (securityIndex == null) { - PetPutSecurityInfo.SecurityIndex configSecurityIndex = securityIndexInfo.petPutSecurityInfoSecurityIndex; - return securityInfoInstance.getSecurityRequirementObject(configSecurityIndex); - } - return securityInfoInstance.getSecurityRequirementObject(securityIndex); - } - public SecurityRequirementObject getSecurityRequirementObject(PetfindbystatusGetSecurityInfo. @Nullable SecurityIndex securityIndex) { - var securityInfoInstance = securityInfo.petfindbystatusGetSecurityInfo; - if (securityIndex == null) { - PetfindbystatusGetSecurityInfo.SecurityIndex configSecurityIndex = securityIndexInfo.petfindbystatusGetSecurityInfoSecurityIndex; - return securityInfoInstance.getSecurityRequirementObject(configSecurityIndex); - } - return securityInfoInstance.getSecurityRequirementObject(securityIndex); - } - public SecurityRequirementObject getSecurityRequirementObject(PetfindbytagsGetSecurityInfo. @Nullable SecurityIndex securityIndex) { - var securityInfoInstance = securityInfo.petfindbytagsGetSecurityInfo; - if (securityIndex == null) { - PetfindbytagsGetSecurityInfo.SecurityIndex configSecurityIndex = securityIndexInfo.petfindbytagsGetSecurityInfoSecurityIndex; - return securityInfoInstance.getSecurityRequirementObject(configSecurityIndex); - } - return securityInfoInstance.getSecurityRequirementObject(securityIndex); - } - public SecurityRequirementObject getSecurityRequirementObject(PetpetidDeleteSecurityInfo. @Nullable SecurityIndex securityIndex) { - var securityInfoInstance = securityInfo.petpetidDeleteSecurityInfo; - if (securityIndex == null) { - PetpetidDeleteSecurityInfo.SecurityIndex configSecurityIndex = securityIndexInfo.petpetidDeleteSecurityInfoSecurityIndex; - return securityInfoInstance.getSecurityRequirementObject(configSecurityIndex); - } - return securityInfoInstance.getSecurityRequirementObject(securityIndex); - } - public SecurityRequirementObject getSecurityRequirementObject(PetpetidGetSecurityInfo. @Nullable SecurityIndex securityIndex) { - var securityInfoInstance = securityInfo.petpetidGetSecurityInfo; - if (securityIndex == null) { - PetpetidGetSecurityInfo.SecurityIndex configSecurityIndex = securityIndexInfo.petpetidGetSecurityInfoSecurityIndex; - return securityInfoInstance.getSecurityRequirementObject(configSecurityIndex); - } - return securityInfoInstance.getSecurityRequirementObject(securityIndex); - } - public SecurityRequirementObject getSecurityRequirementObject(PetpetidPostSecurityInfo. @Nullable SecurityIndex securityIndex) { - var securityInfoInstance = securityInfo.petpetidPostSecurityInfo; - if (securityIndex == null) { - PetpetidPostSecurityInfo.SecurityIndex configSecurityIndex = securityIndexInfo.petpetidPostSecurityInfoSecurityIndex; - return securityInfoInstance.getSecurityRequirementObject(configSecurityIndex); - } - return securityInfoInstance.getSecurityRequirementObject(securityIndex); - } - public SecurityRequirementObject getSecurityRequirementObject(PetpetiduploadimagePostSecurityInfo. @Nullable SecurityIndex securityIndex) { - var securityInfoInstance = securityInfo.petpetiduploadimagePostSecurityInfo; - if (securityIndex == null) { - PetpetiduploadimagePostSecurityInfo.SecurityIndex configSecurityIndex = securityIndexInfo.petpetiduploadimagePostSecurityInfoSecurityIndex; - return securityInfoInstance.getSecurityRequirementObject(configSecurityIndex); - } - return securityInfoInstance.getSecurityRequirementObject(securityIndex); - } - public SecurityRequirementObject getSecurityRequirementObject(StoreinventoryGetSecurityInfo. @Nullable SecurityIndex securityIndex) { - var securityInfoInstance = securityInfo.storeinventoryGetSecurityInfo; - if (securityIndex == null) { - StoreinventoryGetSecurityInfo.SecurityIndex configSecurityIndex = securityIndexInfo.storeinventoryGetSecurityInfoSecurityIndex; - return securityInfoInstance.getSecurityRequirementObject(configSecurityIndex); - } - return securityInfoInstance.getSecurityRequirementObject(securityIndex); - } - - public SecurityScheme getSecurityScheme(Class securitySchemeClass) { - @Nullable SecurityScheme securityScheme = securitySchemeInfo.get(securitySchemeClass); - if (securityScheme == null) { - throw new RuntimeException("SecurityScheme of class " + securitySchemeClass + "cannot be returned because it is unset. Pass in an instance of it in securitySchemes when instantiating ApiConfiguration."); - } - return securityScheme; - } - - public Map> getDefaultHeaders() { - return defaultHeaders; - } - - public @Nullable Duration getTimeout() { - return timeout; - } -} \ No newline at end of file diff --git a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/configurations/SchemaConfiguration.kt b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/configurations/SchemaConfiguration.kt deleted file mode 100644 index 1f1a5a422ff..00000000000 --- a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/configurations/SchemaConfiguration.kt +++ /dev/null @@ -1,4 +0,0 @@ -package org.openapijsonschematools.client.configurations - - -data class SchemaConfiguration(val disabledKeywordFlags: JsonSchemaKeywordFlags) \ No newline at end of file diff --git a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/contenttype/ContentTypeDeserializer.kt b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/contenttype/ContentTypeDeserializer.kt deleted file mode 100644 index f9ef315ea84..00000000000 --- a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/contenttype/ContentTypeDeserializer.kt +++ /dev/null @@ -1,18 +0,0 @@ -package org.openapijsonschematools.client.contenttype; - -import com.google.gson.Gson; -import com.google.gson.GsonBuilder; -import com.google.gson.ToNumberPolicy; -import org.checkerframework.checker.nullness.qual.Nullable; - -public class ContentTypeDeserializer { - private static final Gson gson = new GsonBuilder() - .setObjectToNumberStrategy(ToNumberPolicy.LONG_OR_DOUBLE) - .setNumberToNumberStrategy(ToNumberPolicy.LONG_OR_DOUBLE) - .create(); - - @SuppressWarnings("nullness") - public static @Nullable Object fromJson(String json) { - return gson.fromJson(json, Object.class); - } -} diff --git a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/contenttype/ContentTypeDetector.kt b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/contenttype/ContentTypeDetector.kt deleted file mode 100644 index 6625c193f6a..00000000000 --- a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/contenttype/ContentTypeDetector.kt +++ /dev/null @@ -1,18 +0,0 @@ -package org.openapijsonschematools.client.contenttype; - -import java.util.regex.Pattern; - -public class ContentTypeDetector { - private static final Pattern jsonContentTypePattern = Pattern.compile( - "application/[^+]*[+]?(json);?.*" - ); - private static final String textPlainContentType = "text/plain"; - - public static boolean contentTypeIsJson(String contentType) { - return jsonContentTypePattern.matcher(contentType).find(); - } - - public static boolean contentTypeIsTextPlain(String contentType) { - return textPlainContentType.equals(contentType); - } -} \ No newline at end of file diff --git a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/contenttype/ContentTypeSerializer.kt b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/contenttype/ContentTypeSerializer.kt deleted file mode 100644 index 51bcdeeddaf..00000000000 --- a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/contenttype/ContentTypeSerializer.kt +++ /dev/null @@ -1,18 +0,0 @@ -package org.openapijsonschematools.client.contenttype; - -import com.google.gson.Gson; -import com.google.gson.GsonBuilder; -import com.google.gson.ToNumberPolicy; -import org.checkerframework.checker.nullness.qual.Nullable; - -public class ContentTypeSerializer { - private static final Gson gson = new GsonBuilder() - .setObjectToNumberStrategy(ToNumberPolicy.LONG_OR_DOUBLE) - .setNumberToNumberStrategy(ToNumberPolicy.LONG_OR_DOUBLE) - .create(); - - @SuppressWarnings("nullness") - public static String toJson(@Nullable Object body) { - return gson.toJson(body); - } -} diff --git a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/exceptions/ApiException.kt b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/exceptions/ApiException.kt deleted file mode 100644 index e02ddae608d..00000000000 --- a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/exceptions/ApiException.kt +++ /dev/null @@ -1,5 +0,0 @@ -package org.openapijsonschematools.client.exceptions - -import java.net.http.HttpResponse - -class ApiException(s: String?, val response: HttpResponse) : BaseException(s) \ No newline at end of file diff --git a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/exceptions/BaseException.kt b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/exceptions/BaseException.kt deleted file mode 100644 index 302d2a3c510..00000000000 --- a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/exceptions/BaseException.kt +++ /dev/null @@ -1,3 +0,0 @@ -package org.openapijsonschematools.client.exceptions - -open class BaseException(s: String?) : Exception(s) \ No newline at end of file diff --git a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/exceptions/NotImplementedException.kt b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/exceptions/NotImplementedException.kt deleted file mode 100644 index a6a98ed8136..00000000000 --- a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/exceptions/NotImplementedException.kt +++ /dev/null @@ -1,3 +0,0 @@ -package org.openapijsonschematools.client.exceptions - -class NotImplementedException(s: String?) : BaseException(s) \ No newline at end of file diff --git a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/exceptions/UnsetPropertyException.kt b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/exceptions/UnsetPropertyException.kt deleted file mode 100644 index 7c889056e9c..00000000000 --- a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/exceptions/UnsetPropertyException.kt +++ /dev/null @@ -1,3 +0,0 @@ -package org.openapijsonschematools.client.exceptions - -class UnsetPropertyException(s: String?) : BaseException(s) \ No newline at end of file diff --git a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/exceptions/ValidationException.kt b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/exceptions/ValidationException.kt deleted file mode 100644 index 66dabda704b..00000000000 --- a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/exceptions/ValidationException.kt +++ /dev/null @@ -1,3 +0,0 @@ -package org.openapijsonschematools.client.exceptions - -class ValidationException(s: String?) : BaseException(s) \ No newline at end of file diff --git a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/header/ContentHeader.kt b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/header/ContentHeader.kt deleted file mode 100644 index 0fc91100784..00000000000 --- a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/header/ContentHeader.kt +++ /dev/null @@ -1,59 +0,0 @@ -package org.openapijsonschematools.client.header; - -import org.checkerframework.checker.nullness.qual.Nullable; -import org.openapijsonschematools.client.configurations.SchemaConfiguration; -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 ContentHeader(boolean required, @Nullable Boolean allowReserved, @Nullable Boolean explode, AbstractMap.SimpleEntry> content) { - super(required, ParameterStyle.SIMPLE, explode, allowReserved); - this.content = content; - } - - private static HttpHeaders toHeaders(String name, String value) { - Map> map = Map.of(name, List.of(value)); - BiPredicate headerFilter = (key, val) -> true; - return HttpHeaders.of(map, headerFilter); - } - - @Override - public HttpHeaders serialize(@Nullable Object inData, String name, boolean validate, SchemaConfiguration configuration) throws NotImplementedException, ValidationException { - var castInData = validate ? content.getValue().schema().validate(inData, configuration) : inData ; - String contentType = content.getKey(); - if (ContentTypeDetector.contentTypeIsJson(contentType)) { - var value = ContentTypeSerializer.toJson(castInData); - return toHeaders(name, value); - } else { - throw new NotImplementedException("Serialization of "+contentType+" has not yet been implemented"); - } - } - - @Override - public @Nullable Object deserialize(List inData, boolean validate, SchemaConfiguration configuration) throws NotImplementedException, ValidationException { - String inDataJoined = String.join(",", inData); // unsure if this is needed - @Nullable Object deserializedJson = ContentTypeDeserializer.fromJson(inDataJoined); - if (validate) { - String contentType = content.getKey(); - if (ContentTypeDetector.contentTypeIsJson(contentType)) { - return content.getValue().schema().validate(deserializedJson, configuration); - } else { - throw new NotImplementedException("Header deserialization of "+contentType+" has not yet been implemented"); - } - } - return deserializedJson; - } -} \ No newline at end of file diff --git a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/header/Header.kt b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/header/Header.kt deleted file mode 100644 index 42387a7859b..00000000000 --- a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/header/Header.kt +++ /dev/null @@ -1,14 +0,0 @@ -package org.openapijsonschematools.client.header; - -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; -} \ No newline at end of file diff --git a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/header/HeaderBase.kt b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/header/HeaderBase.kt deleted file mode 100644 index 23f22ebcf39..00000000000 --- a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/header/HeaderBase.kt +++ /dev/null @@ -1,18 +0,0 @@ -package org.openapijsonschematools.client.header; - -import org.checkerframework.checker.nullness.qual.Nullable; -import org.openapijsonschematools.client.parameter.ParameterStyle; - -public class HeaderBase { - public final boolean required; - public final @Nullable ParameterStyle style; - public final @Nullable Boolean explode; - public final @Nullable Boolean allowReserved; - - public HeaderBase(boolean required, @Nullable ParameterStyle style, @Nullable Boolean explode, @Nullable Boolean allowReserved) { - this.required = required; - this.style = style; - this.explode = explode; - this.allowReserved = allowReserved; - } -} \ No newline at end of file diff --git a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/header/PrefixSeparatorIterator.kt b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/header/PrefixSeparatorIterator.kt deleted file mode 100644 index 522e71dfce4..00000000000 --- a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/header/PrefixSeparatorIterator.kt +++ /dev/null @@ -1,27 +0,0 @@ -package org.openapijsonschematools.client.header; - -import java.util.Set; - -public class PrefixSeparatorIterator { - // A class to store prefixes and separators for rfc6570 expansions - public final String prefix; - public final String separator; - private boolean first; - public final String itemSeparator; - private static final Set reusedSeparators = Set.of(".", "|", "%20"); - - public PrefixSeparatorIterator(String prefix, String separator) { - this.prefix = prefix; - this.separator = separator; - itemSeparator = reusedSeparators.contains(separator) ? separator : ","; - first = true; - } - - public String next() { - if (first) { - first = false; - return prefix; - } - return separator; - } -} diff --git a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/header/Rfc6570Serializer.kt b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/header/Rfc6570Serializer.kt deleted file mode 100644 index 5f1d6cc179f..00000000000 --- a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/header/Rfc6570Serializer.kt +++ /dev/null @@ -1,197 +0,0 @@ -package org.openapijsonschematools.client.header; - -import org.checkerframework.checker.nullness.qual.Nullable; -import org.openapijsonschematools.client.exceptions.NotImplementedException; - -import java.io.UnsupportedEncodingException; -import java.net.URLEncoder; -import java.util.ArrayList; -import java.util.LinkedHashMap; -import java.util.List; -import java.util.Map; -import java.util.Set; -import java.util.stream.Collectors; - -public class Rfc6570Serializer { - private static final String ENCODING = "UTF-8"; - private static final Set namedParameterSeparators = Set.of("&", ";"); - - private static String percentEncode(String s) throws NotImplementedException { - if (s == null) { - return ""; - } - try { - return URLEncoder.encode(s, ENCODING) - // OAuth encodes some characters differently: - .replace("+", "%20").replace("*", "%2A") - .replace("%7E", "~"); - // This could be done faster with more hand-crafted code. - } catch (UnsupportedEncodingException wow) { - @Nullable String msg = wow.getMessage(); - if (msg == null) { - throw new NotImplementedException("UnsupportedEncodingException thrown"); - } - throw new NotImplementedException(msg); - } - } - - private static @Nullable String rfc6570ItemValue(@Nullable Object item, boolean percentEncode) throws NotImplementedException { - /* - Get representation if str/float/int/None/items in list/ values in dict - None is returned if an item is undefined, use cases are value= - - None - - [] - - {} - - [None, None None] - - {'a': None, 'b': None} - */ - if (item instanceof String stringItem) { - if (percentEncode) { - return percentEncode(stringItem); - } - return stringItem; - } else if (item instanceof Number numberItem) { - return numberItem.toString(); - } else if (item == null) { - // ignored by the expansion process https://datatracker.ietf.org/doc/html/rfc6570#section-3.2.1 - return null; - } else if (item instanceof List && ((List) item).isEmpty()) { - // ignored by the expansion process https://datatracker.ietf.org/doc/html/rfc6570#section-3.2.1 - return null; - } else if (item instanceof Map && ((Map) item).isEmpty()) { - // ignored by the expansion process https://datatracker.ietf.org/doc/html/rfc6570#section-3.2.1 - return null; - } - throw new NotImplementedException("Unable to generate a rfc6570 item representation of "+item); - } - - private static String rfc6570StrNumberExpansion( - @Nullable Object inData, - boolean percentEncode, - PrefixSeparatorIterator prefixSeparatorIterator, - String varNamePiece, - boolean namedParameterExpansion - ) throws NotImplementedException { - var itemValue = rfc6570ItemValue(inData, percentEncode); - if (itemValue == null || (itemValue.isEmpty() && prefixSeparatorIterator.separator.equals(";"))) { - return prefixSeparatorIterator.next() + varNamePiece; - } - var valuePairEquals = namedParameterExpansion ? "=" : ""; - return prefixSeparatorIterator.next() + varNamePiece + valuePairEquals + itemValue; - } - - private static String rfc6570ListExpansion( - List inData, - boolean explode, - boolean percentEncode, - PrefixSeparatorIterator prefixSeparatorIterator, - String varNamePiece, - boolean namedParameterExpansion - ) throws NotImplementedException { - List itemValues = new ArrayList<>(); - for (Object v: inData) { - @Nullable String value = rfc6570ItemValue(v, percentEncode); - if (value == null) { - continue; - } - itemValues.add(value); - } - if (itemValues.isEmpty()) { - // ignored by the expansion process https://datatracker.ietf.org/doc/html/rfc6570#section-3.2.1 - return ""; - } - var valuePairEquals = namedParameterExpansion ? "=" : ""; - if (!explode) { - return ( - prefixSeparatorIterator.next() + - varNamePiece + - valuePairEquals + - String.join(prefixSeparatorIterator.itemSeparator, itemValues) - ); - } - // exploded - return prefixSeparatorIterator.next() + itemValues.stream().map(v -> varNamePiece + valuePairEquals + v).collect(Collectors.joining(prefixSeparatorIterator.next())); - } - - private static String rfc6570MapExpansion( - Map inData, - boolean explode, - boolean percentEncode, - PrefixSeparatorIterator prefixSeparatorIterator, - String varNamePiece, - boolean namedParameterExpansion - ) throws NotImplementedException { - Map inDataMap = new LinkedHashMap<>(); - for (Map.Entry entry: inData.entrySet()) { - @Nullable String value = rfc6570ItemValue(entry.getValue(), percentEncode); - if (value == null) { - continue; - } - @Nullable Object key = entry.getKey(); - if (!(key instanceof String strKey)) { - continue; - } - inDataMap.put(strKey, value); - } - if (inDataMap.isEmpty()) { - // ignored by the expansion process https://datatracker.ietf.org/doc/html/rfc6570#section-3.2.1 - return ""; - } - var valuePairEquals = namedParameterExpansion ? "=" : ""; - if (!explode) { - return prefixSeparatorIterator.next() + - varNamePiece + - valuePairEquals + - inDataMap.entrySet().stream().map(e -> e.getKey()+prefixSeparatorIterator.itemSeparator+e.getValue()).collect(Collectors.joining(prefixSeparatorIterator.itemSeparator)); - } - // exploded - return prefixSeparatorIterator.next() + inDataMap.entrySet().stream().map(e -> e.getKey() + "=" + e.getValue()).collect(Collectors.joining(prefixSeparatorIterator.next())); - } - - protected static String rfc6570Expansion( - String variableName, - @Nullable Object inData, - boolean explode, - boolean percentEncode, - PrefixSeparatorIterator prefixSeparatorIterator - ) throws NotImplementedException { - /* - Separator is for separate variables like dict with explode true, - not for array item separation - */ - var namedParameterExpansion = namedParameterSeparators.contains(prefixSeparatorIterator.separator); - var varNamePiece = namedParameterExpansion ? variableName : ""; - if (inData instanceof Number || inData instanceof String) { - return rfc6570StrNumberExpansion( - inData, - percentEncode, - prefixSeparatorIterator, - varNamePiece, - namedParameterExpansion - ); - } else if (inData == null) { - // ignored by the expansion process https://datatracker.ietf.org/doc/html/rfc6570#section-3.2.1 - return ""; - } else if (inData instanceof List listData) { - return rfc6570ListExpansion( - listData, - explode, - percentEncode, - prefixSeparatorIterator, - varNamePiece, - namedParameterExpansion - ); - } else if (inData instanceof Map mapData) { - return rfc6570MapExpansion( - mapData, - explode, - percentEncode, - prefixSeparatorIterator, - varNamePiece, - namedParameterExpansion - ); - } - // bool, bytes, etc - throw new NotImplementedException("Unable to generate a rfc6570 representation of "+inData); - } -} \ No newline at end of file diff --git a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/header/SchemaHeader.kt b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/header/SchemaHeader.kt deleted file mode 100644 index 176485c7ed8..00000000000 --- a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/header/SchemaHeader.kt +++ /dev/null @@ -1,97 +0,0 @@ -package org.openapijsonschematools.client.header; - -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; -import org.openapijsonschematools.client.schemas.validation.UnsetAnyTypeJsonSchema; - -import java.net.http.HttpHeaders; -import java.util.ArrayList; -import java.util.List; -import java.util.Map; -import java.util.Set; -import java.util.function.BiPredicate; - -public class SchemaHeader extends HeaderBase implements Header { - public final JsonSchema schema; - - public SchemaHeader(boolean required, @Nullable Boolean allowReserved, @Nullable Boolean explode, JsonSchema schema) { - super(required, ParameterStyle.SIMPLE, explode, allowReserved); - this.schema = schema; - } - - private static HttpHeaders toHeaders(String name, String value) { - Map> map = Map.of(name, List.of(value)); - BiPredicate headerFilter = (key, val) -> true; - return HttpHeaders.of(map, headerFilter); - } - - @Override - public HttpHeaders serialize(@Nullable Object inData, String name, boolean validate, SchemaConfiguration configuration) throws NotImplementedException, ValidationException { - var castInData = validate ? schema.validate(inData, configuration) : inData; - boolean usedExplode = explode != null && explode; - var value = StyleSerializer.serializeSimple(castInData, name, usedExplode, false); - return toHeaders(name, value); - } - - private static final Set> VOID_TYPES = Set.of(Nothing?.class); - private static final Set> BOOLEAN_TYPES = Set.of(Boolean.class); - private static final Set> NUMERIC_TYPES = Set.of( - Integer.class, - Long.class, - Float.class, - Double.class - ); - private static final Set> STRING_TYPES = Set.of(String.class); - private static final Set> LIST_TYPES = Set.of(List.class); - private static final Set> MAP_TYPES = Set.of(Map.class); - - private List<@Nullable Object> getList(JsonSchema schema, List inData) throws NotImplementedException { - Class> itemsSchemaCls = schema.items == null ? UnsetAnyTypeJsonSchema.UnsetAnyTypeJsonSchema1.class : schema.items; - JsonSchema itemSchema = JsonSchemaFactory.getInstance(itemsSchemaCls); - List<@Nullable Object> castList = new ArrayList<>(); - for (String inDataItem: inData) { - @Nullable Object castInDataItem = getCastInData(itemSchema, List.of(inDataItem)); - castList.add(castInDataItem); - } - return castList; - } - - private @Nullable Object getCastInData(JsonSchema schema, List inData) throws NotImplementedException { - if (schema.type == null) { - if (inData.size() == 1) { - return inData.get(0); - } - return getList(schema, inData); - } else if (schema.type.size() == 1) { - if (schema.type.equals(BOOLEAN_TYPES)) { - throw new NotImplementedException("Boolean serialization is not defined in Rfc6570, there is no agreed upon way to sent a boolean, send a string enum instead"); - } else if (schema.type.equals(VOID_TYPES) && inData.size() == 1 && inData.get(0).isEmpty()) { - return null; - } else if (schema.type.equals(STRING_TYPES) && inData.size() == 1) { - return inData.get(0); - } else if (schema.type.equals(LIST_TYPES)) { - return getList(schema, inData); - } else if (schema.type.equals(MAP_TYPES)) { - throw new NotImplementedException("Header map deserialization has not yet been implemented"); - } - } else if (schema.type.size() == 4 && schema.type.equals(NUMERIC_TYPES) && inData.size() == 1) { - return ContentTypeDeserializer.fromJson(inData.get(0)); - } - throw new NotImplementedException("Header deserialization for schemas with multiple types has not yet been implemented"); - } - - @Override - public @Nullable Object deserialize(List inData, boolean validate, SchemaConfiguration configuration) throws NotImplementedException, ValidationException { - @Nullable Object castInData = getCastInData(schema, inData); - if (validate) { - return schema.validate(castInData, configuration); - } - return castInData; - } -} \ No newline at end of file diff --git a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/header/StyleSerializer.kt b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/header/StyleSerializer.kt deleted file mode 100644 index f5fa5a0a75b..00000000000 --- a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/header/StyleSerializer.kt +++ /dev/null @@ -1,99 +0,0 @@ -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( - @Nullable Object inData, - String name, - boolean explode, - boolean percentEncode - ) throws NotImplementedException { - var prefixSeparatorIterator = new PrefixSeparatorIterator("", ","); - return rfc6570Expansion( - name, - inData, - explode, - percentEncode, - prefixSeparatorIterator - ); - } - - public static String serializeForm( - @Nullable Object inData, - String name, - boolean explode, - boolean percentEncode - ) throws NotImplementedException { - // todo check that the prefix and suffix matches this one - PrefixSeparatorIterator iterator = new PrefixSeparatorIterator("", "&"); - return rfc6570Expansion( - name, - inData, - explode, - percentEncode, - iterator - ); - } - - public static String serializeMatrix( - @Nullable Object inData, - String name, - boolean explode - ) throws NotImplementedException { - PrefixSeparatorIterator usedIterator = new PrefixSeparatorIterator(";", ";"); - return rfc6570Expansion( - name, - inData, - explode, - true, - usedIterator - ); - } - - public static String serializeLabel( - @Nullable Object inData, - String name, - boolean explode - ) throws NotImplementedException { - PrefixSeparatorIterator usedIterator = new PrefixSeparatorIterator(".", "."); - return rfc6570Expansion( - name, - inData, - explode, - true, - usedIterator - ); - } - - public static String serializeSpaceDelimited( - @Nullable Object inData, - String name, - boolean explode - ) throws NotImplementedException { - PrefixSeparatorIterator usedIterator = new PrefixSeparatorIterator("", "%20"); - return rfc6570Expansion( - name, - inData, - explode, - true, - usedIterator - ); - } - - public static String serializePipeDelimited( - @Nullable Object inData, - String name, - boolean explode - ) throws NotImplementedException { - PrefixSeparatorIterator usedIterator = new PrefixSeparatorIterator("", "|"); - return rfc6570Expansion( - name, - inData, - explode, - true, - usedIterator - ); - } -} \ No newline at end of file diff --git a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/mediatype/Encoding.kt b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/mediatype/Encoding.kt deleted file mode 100644 index 41a088888e8..00000000000 --- a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/mediatype/Encoding.kt +++ /dev/null @@ -1,30 +0,0 @@ -package org.openapijsonschematools.client.mediatype; - -import org.checkerframework.checker.nullness.qual.Nullable; -import org.openapijsonschematools.client.parameter.ParameterStyle; -import org.openapijsonschematools.client.header.Header; - -import java.util.Map; - -public class Encoding { - public final String contentType; - public final @Nullable Map headers; - public final @Nullable ParameterStyle style; - public final boolean explode; - public final boolean allowReserved; - - public Encoding(String contentType) { - this.contentType = contentType; - headers = null; - style = null; - explode = false; - allowReserved = false; - } - public Encoding(String contentType, @Nullable Map headers) { - this.contentType = contentType; - this.headers = headers; - style = null; - explode = false; - allowReserved = false; - } -} \ No newline at end of file diff --git a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/mediatype/MediaType.kt b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/mediatype/MediaType.kt deleted file mode 100644 index e8392d15eda..00000000000 --- a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/mediatype/MediaType.kt +++ /dev/null @@ -1,16 +0,0 @@ -package org.openapijsonschematools.client.mediatype; - -import org.openapijsonschematools.client.schemas.validation.JsonSchema; - -public interface MediaType, U> { - /* - * Used to store request and response body schema information - * encoding: - * A map between a property name and its encoding information. - * The key, being the property name, MUST exist in the schema as a property. - * The encoding object SHALL only apply to requestBody objects when the media type is - * multipart or application/x-www-form-urlencoded. - */ - T schema(); - U encoding(); -} \ No newline at end of file diff --git a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/parameter/ContentParameter.kt b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/parameter/ContentParameter.kt deleted file mode 100644 index d5e00cc2fa9..00000000000 --- a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/parameter/ContentParameter.kt +++ /dev/null @@ -1,30 +0,0 @@ -package org.openapijsonschematools.client.parameter; - -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 ContentParameter(String name, ParameterInType inType, boolean required, @Nullable ParameterStyle style, @Nullable Boolean explode, @Nullable Boolean allowReserved, AbstractMap.SimpleEntry> content) { - super(name, inType, required, style, explode, allowReserved); - this.content = content; - } - - @Override - public AbstractMap.SimpleEntry serialize(@Nullable Object inData) throws NotImplementedException { - String contentType = content.getKey(); - if (ContentTypeDetector.contentTypeIsJson(contentType)) { - var value = ContentTypeSerializer.toJson(inData); - return new AbstractMap.SimpleEntry<>(name, value); - } else { - throw new NotImplementedException("Serialization of "+contentType+" has not yet been implemented"); - } - } -} \ No newline at end of file diff --git a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/parameter/CookieSerializer.kt b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/parameter/CookieSerializer.kt deleted file mode 100644 index 4ec9f6ef59d..00000000000 --- a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/parameter/CookieSerializer.kt +++ /dev/null @@ -1,36 +0,0 @@ -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; -import java.util.TreeMap; - -public abstract class CookieSerializer { - private final Map parameters; - - protected CookieSerializer(Map parameters) { - this.parameters = parameters; - } - - public String serialize(Map inData) throws NotImplementedException { - String result = ""; - Map sortedData = new TreeMap<>(inData); - for (Map.Entry entry: sortedData.entrySet()) { - String mapKey = entry.getKey(); - @Nullable Parameter parameter = parameters.get(mapKey); - if (parameter == null) { - throw new RuntimeException("Invalid state, a parameter must exist for every key"); - } - @Nullable Object value = entry.getValue(); - AbstractMap.SimpleEntry serialized = parameter.serialize(value); - if (result.isEmpty()) { - result = serialized.getValue(); - } else { - result = result + "; " + serialized.getValue(); - } - } - return result; - } -} diff --git a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/parameter/HeadersSerializer.kt b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/parameter/HeadersSerializer.kt deleted file mode 100644 index 1969f2c0b21..00000000000 --- a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/parameter/HeadersSerializer.kt +++ /dev/null @@ -1,32 +0,0 @@ -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; -import java.util.Map; -import java.util.List; - -public abstract class HeadersSerializer { - private final Map parameters; - - protected HeadersSerializer(Map parameters) { - this.parameters = parameters; - } - - public Map> serialize(Map inData) throws NotImplementedException { - Map> results = new LinkedHashMap<>(); - for (Map.Entry entry: inData.entrySet()) { - String mapKey = entry.getKey(); - @Nullable Parameter parameter = parameters.get(mapKey); - if (parameter == null) { - throw new RuntimeException("Invalid state, a parameter must exist for every key"); - } - @Nullable Object value = entry.getValue(); - AbstractMap.SimpleEntry serialized = parameter.serialize(value); - results.put(serialized.getKey(), List.of(serialized.getValue())); - } - return results; - } -} diff --git a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/parameter/Parameter.kt b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/parameter/Parameter.kt deleted file mode 100644 index adf3896d557..00000000000 --- a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/parameter/Parameter.kt +++ /dev/null @@ -1,10 +0,0 @@ -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; -} \ No newline at end of file diff --git a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/parameter/ParameterBase.kt b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/parameter/ParameterBase.kt deleted file mode 100644 index 8d79129b765..00000000000 --- a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/parameter/ParameterBase.kt +++ /dev/null @@ -1,15 +0,0 @@ -package org.openapijsonschematools.client.parameter; - -import org.checkerframework.checker.nullness.qual.Nullable; -import org.openapijsonschematools.client.header.HeaderBase; - -public class ParameterBase extends HeaderBase { - public final String name; - public final ParameterInType inType; - - public ParameterBase(String name, ParameterInType inType, boolean required, @Nullable ParameterStyle style, @Nullable Boolean explode, @Nullable Boolean allowReserved) { - super(required, style, explode, allowReserved); - this.name = name; - this.inType = inType; - } -} \ No newline at end of file diff --git a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/parameter/ParameterInType.kt b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/parameter/ParameterInType.kt deleted file mode 100644 index cb8f4b18ba2..00000000000 --- a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/parameter/ParameterInType.kt +++ /dev/null @@ -1,8 +0,0 @@ -package org.openapijsonschematools.client.parameter; - -public enum ParameterInType { - QUERY, - HEADER, - PATH, - COOKIE -} \ No newline at end of file diff --git a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/parameter/ParameterStyle.kt b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/parameter/ParameterStyle.kt deleted file mode 100644 index 4e402ade76c..00000000000 --- a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/parameter/ParameterStyle.kt +++ /dev/null @@ -1,11 +0,0 @@ -package org.openapijsonschematools.client.parameter; - -public enum ParameterStyle { - MATRIX, - LABEL, - FORM, - SIMPLE, - SPACE_DELIMITED, - PIPE_DELIMITED, - DEEP_OBJECT -} \ No newline at end of file diff --git a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/parameter/PathSerializer.kt b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/parameter/PathSerializer.kt deleted file mode 100644 index 78015037211..00000000000 --- a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/parameter/PathSerializer.kt +++ /dev/null @@ -1,30 +0,0 @@ -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; - -public abstract class PathSerializer { - private final Map parameters; - - protected PathSerializer(Map parameters) { - this.parameters = parameters; - } - - public String serialize(Map inData, String pathWithPlaceholders) throws NotImplementedException { - String result = pathWithPlaceholders; - for (Map.Entry entry: inData.entrySet()) { - String mapKey = entry.getKey(); - @Nullable Parameter parameter = parameters.get(mapKey); - if (parameter == null) { - throw new RuntimeException("Invalid state, a parameter must exist for every key"); - } - @Nullable Object value = entry.getValue(); - AbstractMap.SimpleEntry serialized = parameter.serialize(value); - result = result.replace("{" + mapKey + "}", serialized.getValue()); - } - return result; - } -} diff --git a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/parameter/QuerySerializer.kt b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/parameter/QuerySerializer.kt deleted file mode 100644 index 880151ed144..00000000000 --- a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/parameter/QuerySerializer.kt +++ /dev/null @@ -1,48 +0,0 @@ -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; -import java.util.Map; -import java.util.TreeMap; - -public abstract class QuerySerializer { - private final Map parameters; - - protected QuerySerializer(Map parameters) { - this.parameters = parameters; - } - - public Map getQueryMap(Map inData) throws NotImplementedException { - Map results = new HashMap<>(); - for (Map.Entry entry: inData.entrySet()) { - String mapKey = entry.getKey(); - @Nullable Parameter parameter = parameters.get(mapKey); - if (parameter == null) { - throw new RuntimeException("Invalid state, a parameter must exist for every key"); - } - @Nullable Object value = entry.getValue(); - AbstractMap.SimpleEntry serialized = parameter.serialize(value); - results.put(serialized.getKey(), serialized.getValue()); - } - return new TreeMap<>(results); - } - - public String serialize(Map queryMap) { - if (queryMap.isEmpty()) { - return ""; - } - String result = "?"; - for (String serializedValue: queryMap.values()) { - if (result.length() == 1) { - result = result + serializedValue; - } else { - result = result + "&" + serializedValue; - } - } - // TODO what if the style is not FORM? - return result; - } -} diff --git a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/parameter/SchemaParameter.kt b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/parameter/SchemaParameter.kt deleted file mode 100644 index eef0b6bc371..00000000000 --- a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/parameter/SchemaParameter.kt +++ /dev/null @@ -1,60 +0,0 @@ -package org.openapijsonschematools.client.parameter; - -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; - -public class SchemaParameter extends ParameterBase implements Parameter { - public final JsonSchema schema; - - public SchemaParameter(String name, ParameterInType inType, boolean required, @Nullable ParameterStyle style, @Nullable Boolean explode, @Nullable Boolean allowReserved, JsonSchema schema) { - super(name, inType, required, style, explode, allowReserved); - this.schema = schema; - } - - private ParameterStyle getStyle() { - if (style != null) { - return style; - } - if (inType == ParameterInType.QUERY || inType == ParameterInType.COOKIE) { - return ParameterStyle.FORM; - } - // ParameterInType.HEADER || ParameterInType.PATH - return ParameterStyle.SIMPLE; - } - - @Override - public AbstractMap.SimpleEntry serialize(@Nullable Object inData) throws NotImplementedException { - ParameterStyle usedStyle = getStyle(); - boolean percentEncode = inType == ParameterInType.QUERY || inType == ParameterInType.PATH; - String value; - boolean usedExplode = explode == null ? usedStyle == ParameterStyle.FORM : explode; - if (usedStyle == ParameterStyle.SIMPLE) { - // header OR path - value = StyleSerializer.serializeSimple(inData, name, usedExplode, percentEncode); - } else if (usedStyle == ParameterStyle.FORM) { - // query OR cookie - value = StyleSerializer.serializeForm(inData, name, usedExplode, percentEncode); - } else if (usedStyle == ParameterStyle.LABEL) { - // path - value = StyleSerializer.serializeLabel(inData, name, usedExplode); - } else if (usedStyle == ParameterStyle.MATRIX) { - // path - value = StyleSerializer.serializeMatrix(inData, name, usedExplode); - } else if (usedStyle == ParameterStyle.SPACE_DELIMITED) { - // query - value = StyleSerializer.serializeSpaceDelimited(inData, name, usedExplode); - } else if (usedStyle == ParameterStyle.PIPE_DELIMITED) { - // query - value = StyleSerializer.serializePipeDelimited(inData, name, usedExplode); - } else { - // usedStyle == ParameterStyle.DEEP_OBJECT - // query - throw new NotImplementedException("Style deep object serialization has not yet been implemented."); - } - return new AbstractMap.SimpleEntry<>(name, value); - } -} \ No newline at end of file diff --git a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/Anotherfakedummy.kt b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/Anotherfakedummy.kt deleted file mode 100644 index f89bfb988ac..00000000000 --- a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/Anotherfakedummy.kt +++ /dev/null @@ -1,5 +0,0 @@ -package org.openapijsonschematools.client.paths; - -public class Anotherfakedummy { - public static final String path = "/another-fake/dummy"; -} diff --git a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/Commonparamsubdir.kt b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/Commonparamsubdir.kt deleted file mode 100644 index 56057955e78..00000000000 --- a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/Commonparamsubdir.kt +++ /dev/null @@ -1,5 +0,0 @@ -package org.openapijsonschematools.client.paths; - -public class Commonparamsubdir { - public static final String path = "/commonParam/{subDir}/"; -} diff --git a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/Fake.kt b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/Fake.kt deleted file mode 100644 index 46cde76f450..00000000000 --- a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/Fake.kt +++ /dev/null @@ -1,5 +0,0 @@ -package org.openapijsonschematools.client.paths; - -public class Fake { - public static final String path = "/fake"; -} diff --git a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/Fakeadditionalpropertieswitharrayofenums.kt b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/Fakeadditionalpropertieswitharrayofenums.kt deleted file mode 100644 index 43effb28488..00000000000 --- a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/Fakeadditionalpropertieswitharrayofenums.kt +++ /dev/null @@ -1,5 +0,0 @@ -package org.openapijsonschematools.client.paths; - -public class Fakeadditionalpropertieswitharrayofenums { - public static final String path = "/fake/additional-properties-with-array-of-enums"; -} diff --git a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/Fakebodywithfileschema.kt b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/Fakebodywithfileschema.kt deleted file mode 100644 index ce66c23f4f0..00000000000 --- a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/Fakebodywithfileschema.kt +++ /dev/null @@ -1,5 +0,0 @@ -package org.openapijsonschematools.client.paths; - -public class Fakebodywithfileschema { - public static final String path = "/fake/body-with-file-schema"; -} diff --git a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/Fakebodywithqueryparams.kt b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/Fakebodywithqueryparams.kt deleted file mode 100644 index 8a4d20a641a..00000000000 --- a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/Fakebodywithqueryparams.kt +++ /dev/null @@ -1,5 +0,0 @@ -package org.openapijsonschematools.client.paths; - -public class Fakebodywithqueryparams { - public static final String path = "/fake/body-with-query-params"; -} diff --git a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/Fakecasesensitiveparams.kt b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/Fakecasesensitiveparams.kt deleted file mode 100644 index c82acc6d50b..00000000000 --- a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/Fakecasesensitiveparams.kt +++ /dev/null @@ -1,5 +0,0 @@ -package org.openapijsonschematools.client.paths; - -public class Fakecasesensitiveparams { - public static final String path = "/fake/case-sensitive-params"; -} diff --git a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/Fakeclassnametest.kt b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/Fakeclassnametest.kt deleted file mode 100644 index 2ad877f4897..00000000000 --- a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/Fakeclassnametest.kt +++ /dev/null @@ -1,5 +0,0 @@ -package org.openapijsonschematools.client.paths; - -public class Fakeclassnametest { - public static final String path = "/fake_classname_test"; -} diff --git a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/Fakedeletecoffeeid.kt b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/Fakedeletecoffeeid.kt deleted file mode 100644 index 30eebc6d353..00000000000 --- a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/Fakedeletecoffeeid.kt +++ /dev/null @@ -1,5 +0,0 @@ -package org.openapijsonschematools.client.paths; - -public class Fakedeletecoffeeid { - public static final String path = "/fake/deleteCoffee/{id}"; -} diff --git a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/Fakehealth.kt b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/Fakehealth.kt deleted file mode 100644 index 73fc63a1954..00000000000 --- a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/Fakehealth.kt +++ /dev/null @@ -1,5 +0,0 @@ -package org.openapijsonschematools.client.paths; - -public class Fakehealth { - public static final String path = "/fake/health"; -} diff --git a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/Fakeinlineadditionalproperties.kt b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/Fakeinlineadditionalproperties.kt deleted file mode 100644 index 26347f6ed75..00000000000 --- a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/Fakeinlineadditionalproperties.kt +++ /dev/null @@ -1,5 +0,0 @@ -package org.openapijsonschematools.client.paths; - -public class Fakeinlineadditionalproperties { - public static final String path = "/fake/inline-additionalProperties"; -} diff --git a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/Fakeinlinecomposition.kt b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/Fakeinlinecomposition.kt deleted file mode 100644 index 4c39d95f065..00000000000 --- a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/Fakeinlinecomposition.kt +++ /dev/null @@ -1,5 +0,0 @@ -package org.openapijsonschematools.client.paths; - -public class Fakeinlinecomposition { - public static final String path = "/fake/inlineComposition/"; -} diff --git a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/Fakejsonformdata.kt b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/Fakejsonformdata.kt deleted file mode 100644 index f2c24afc0ef..00000000000 --- a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/Fakejsonformdata.kt +++ /dev/null @@ -1,5 +0,0 @@ -package org.openapijsonschematools.client.paths; - -public class Fakejsonformdata { - public static final String path = "/fake/jsonFormData"; -} diff --git a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/Fakejsonpatch.kt b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/Fakejsonpatch.kt deleted file mode 100644 index 2dfcbc73d55..00000000000 --- a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/Fakejsonpatch.kt +++ /dev/null @@ -1,5 +0,0 @@ -package org.openapijsonschematools.client.paths; - -public class Fakejsonpatch { - public static final String path = "/fake/jsonPatch"; -} diff --git a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/Fakejsonwithcharset.kt b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/Fakejsonwithcharset.kt deleted file mode 100644 index 63ba857f0a0..00000000000 --- a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/Fakejsonwithcharset.kt +++ /dev/null @@ -1,5 +0,0 @@ -package org.openapijsonschematools.client.paths; - -public class Fakejsonwithcharset { - public static final String path = "/fake/jsonWithCharset"; -} diff --git a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/Fakemultiplerequestbodycontenttypes.kt b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/Fakemultiplerequestbodycontenttypes.kt deleted file mode 100644 index 85fbe08971a..00000000000 --- a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/Fakemultiplerequestbodycontenttypes.kt +++ /dev/null @@ -1,5 +0,0 @@ -package org.openapijsonschematools.client.paths; - -public class Fakemultiplerequestbodycontenttypes { - public static final String path = "/fake/multipleRequestBodyContentTypes/"; -} diff --git a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/Fakemultipleresponsebodies.kt b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/Fakemultipleresponsebodies.kt deleted file mode 100644 index 47bbeb0dbbf..00000000000 --- a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/Fakemultipleresponsebodies.kt +++ /dev/null @@ -1,5 +0,0 @@ -package org.openapijsonschematools.client.paths; - -public class Fakemultipleresponsebodies { - public static final String path = "/fake/multipleResponseBodies"; -} diff --git a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/Fakemultiplesecurities.kt b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/Fakemultiplesecurities.kt deleted file mode 100644 index 4052ed98bd0..00000000000 --- a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/Fakemultiplesecurities.kt +++ /dev/null @@ -1,5 +0,0 @@ -package org.openapijsonschematools.client.paths; - -public class Fakemultiplesecurities { - public static final String path = "/fake/multipleSecurities"; -} diff --git a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/Fakeobjinquery.kt b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/Fakeobjinquery.kt deleted file mode 100644 index a4a39ca83b9..00000000000 --- a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/Fakeobjinquery.kt +++ /dev/null @@ -1,5 +0,0 @@ -package org.openapijsonschematools.client.paths; - -public class Fakeobjinquery { - public static final String path = "/fake/objInQuery"; -} diff --git a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/Fakeparametercollisions1ababselfab.kt b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/Fakeparametercollisions1ababselfab.kt deleted file mode 100644 index abcc4667520..00000000000 --- a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/Fakeparametercollisions1ababselfab.kt +++ /dev/null @@ -1,5 +0,0 @@ -package org.openapijsonschematools.client.paths; - -public class Fakeparametercollisions1ababselfab { - public static final String path = "/fake/parameterCollisions/{1}/{aB}/{Ab}/{self}/{A-B}/"; -} diff --git a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/Fakepemcontenttype.kt b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/Fakepemcontenttype.kt deleted file mode 100644 index b48b1522786..00000000000 --- a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/Fakepemcontenttype.kt +++ /dev/null @@ -1,5 +0,0 @@ -package org.openapijsonschematools.client.paths; - -public class Fakepemcontenttype { - public static final String path = "/fake/pemContentType"; -} diff --git a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/Fakepetiduploadimagewithrequiredfile.kt b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/Fakepetiduploadimagewithrequiredfile.kt deleted file mode 100644 index fe1c8da62ed..00000000000 --- a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/Fakepetiduploadimagewithrequiredfile.kt +++ /dev/null @@ -1,5 +0,0 @@ -package org.openapijsonschematools.client.paths; - -public class Fakepetiduploadimagewithrequiredfile { - public static final String path = "/fake/{petId}/uploadImageWithRequiredFile"; -} diff --git a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/Fakequeryparamwithjsoncontenttype.kt b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/Fakequeryparamwithjsoncontenttype.kt deleted file mode 100644 index adc814cd4e1..00000000000 --- a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/Fakequeryparamwithjsoncontenttype.kt +++ /dev/null @@ -1,5 +0,0 @@ -package org.openapijsonschematools.client.paths; - -public class Fakequeryparamwithjsoncontenttype { - public static final String path = "/fake/queryParamWithJsonContentType"; -} diff --git a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/Fakeredirection.kt b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/Fakeredirection.kt deleted file mode 100644 index 96ced57ff91..00000000000 --- a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/Fakeredirection.kt +++ /dev/null @@ -1,5 +0,0 @@ -package org.openapijsonschematools.client.paths; - -public class Fakeredirection { - public static final String path = "/fake/redirection"; -} diff --git a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/Fakerefobjinquery.kt b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/Fakerefobjinquery.kt deleted file mode 100644 index 96194250be7..00000000000 --- a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/Fakerefobjinquery.kt +++ /dev/null @@ -1,5 +0,0 @@ -package org.openapijsonschematools.client.paths; - -public class Fakerefobjinquery { - public static final String path = "/fake/refObjInQuery"; -} diff --git a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/Fakerefsarraymodel.kt b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/Fakerefsarraymodel.kt deleted file mode 100644 index c4e1f2d71ba..00000000000 --- a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/Fakerefsarraymodel.kt +++ /dev/null @@ -1,5 +0,0 @@ -package org.openapijsonschematools.client.paths; - -public class Fakerefsarraymodel { - public static final String path = "/fake/refs/arraymodel"; -} diff --git a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/Fakerefsarrayofenums.kt b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/Fakerefsarrayofenums.kt deleted file mode 100644 index 2479d833c60..00000000000 --- a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/Fakerefsarrayofenums.kt +++ /dev/null @@ -1,5 +0,0 @@ -package org.openapijsonschematools.client.paths; - -public class Fakerefsarrayofenums { - public static final String path = "/fake/refs/array-of-enums"; -} diff --git a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/Fakerefsboolean.kt b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/Fakerefsboolean.kt deleted file mode 100644 index b795df7fe6b..00000000000 --- a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/Fakerefsboolean.kt +++ /dev/null @@ -1,5 +0,0 @@ -package org.openapijsonschematools.client.paths; - -public class Fakerefsboolean { - public static final String path = "/fake/refs/boolean"; -} diff --git a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/Fakerefscomposedoneofnumberwithvalidations.kt b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/Fakerefscomposedoneofnumberwithvalidations.kt deleted file mode 100644 index 9146b51293f..00000000000 --- a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/Fakerefscomposedoneofnumberwithvalidations.kt +++ /dev/null @@ -1,5 +0,0 @@ -package org.openapijsonschematools.client.paths; - -public class Fakerefscomposedoneofnumberwithvalidations { - public static final String path = "/fake/refs/composed_one_of_number_with_validations"; -} diff --git a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/Fakerefsenum.kt b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/Fakerefsenum.kt deleted file mode 100644 index 5eeb04f8d37..00000000000 --- a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/Fakerefsenum.kt +++ /dev/null @@ -1,5 +0,0 @@ -package org.openapijsonschematools.client.paths; - -public class Fakerefsenum { - public static final String path = "/fake/refs/enum"; -} diff --git a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/Fakerefsmammal.kt b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/Fakerefsmammal.kt deleted file mode 100644 index b6271a3061f..00000000000 --- a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/Fakerefsmammal.kt +++ /dev/null @@ -1,5 +0,0 @@ -package org.openapijsonschematools.client.paths; - -public class Fakerefsmammal { - public static final String path = "/fake/refs/mammal"; -} diff --git a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/Fakerefsnumber.kt b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/Fakerefsnumber.kt deleted file mode 100644 index 7dd2b5ace64..00000000000 --- a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/Fakerefsnumber.kt +++ /dev/null @@ -1,5 +0,0 @@ -package org.openapijsonschematools.client.paths; - -public class Fakerefsnumber { - public static final String path = "/fake/refs/number"; -} diff --git a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/Fakerefsobjectmodelwithrefprops.kt b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/Fakerefsobjectmodelwithrefprops.kt deleted file mode 100644 index 64dd88b6a6a..00000000000 --- a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/Fakerefsobjectmodelwithrefprops.kt +++ /dev/null @@ -1,5 +0,0 @@ -package org.openapijsonschematools.client.paths; - -public class Fakerefsobjectmodelwithrefprops { - public static final String path = "/fake/refs/object_model_with_ref_props"; -} diff --git a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/Fakerefsstring.kt b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/Fakerefsstring.kt deleted file mode 100644 index 08aa4a9afaa..00000000000 --- a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/Fakerefsstring.kt +++ /dev/null @@ -1,5 +0,0 @@ -package org.openapijsonschematools.client.paths; - -public class Fakerefsstring { - public static final String path = "/fake/refs/string"; -} diff --git a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/Fakeresponsewithoutschema.kt b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/Fakeresponsewithoutschema.kt deleted file mode 100644 index 78ae099c8a1..00000000000 --- a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/Fakeresponsewithoutschema.kt +++ /dev/null @@ -1,5 +0,0 @@ -package org.openapijsonschematools.client.paths; - -public class Fakeresponsewithoutschema { - public static final String path = "/fake/responseWithoutSchema"; -} diff --git a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/Faketestqueryparamters.kt b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/Faketestqueryparamters.kt deleted file mode 100644 index 487d92b4122..00000000000 --- a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/Faketestqueryparamters.kt +++ /dev/null @@ -1,5 +0,0 @@ -package org.openapijsonschematools.client.paths; - -public class Faketestqueryparamters { - public static final String path = "/fake/test-query-paramters"; -} diff --git a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/Fakeuploaddownloadfile.kt b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/Fakeuploaddownloadfile.kt deleted file mode 100644 index 06871695fc4..00000000000 --- a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/Fakeuploaddownloadfile.kt +++ /dev/null @@ -1,5 +0,0 @@ -package org.openapijsonschematools.client.paths; - -public class Fakeuploaddownloadfile { - public static final String path = "/fake/uploadDownloadFile"; -} diff --git a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/Fakeuploadfile.kt b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/Fakeuploadfile.kt deleted file mode 100644 index 4f754cd5d46..00000000000 --- a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/Fakeuploadfile.kt +++ /dev/null @@ -1,5 +0,0 @@ -package org.openapijsonschematools.client.paths; - -public class Fakeuploadfile { - public static final String path = "/fake/uploadFile"; -} diff --git a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/Fakeuploadfiles.kt b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/Fakeuploadfiles.kt deleted file mode 100644 index 4c2ba0ab9a5..00000000000 --- a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/Fakeuploadfiles.kt +++ /dev/null @@ -1,5 +0,0 @@ -package org.openapijsonschematools.client.paths; - -public class Fakeuploadfiles { - public static final String path = "/fake/uploadFiles"; -} diff --git a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/Fakewildcardresponses.kt b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/Fakewildcardresponses.kt deleted file mode 100644 index 991d78912aa..00000000000 --- a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/Fakewildcardresponses.kt +++ /dev/null @@ -1,5 +0,0 @@ -package org.openapijsonschematools.client.paths; - -public class Fakewildcardresponses { - public static final String path = "/fake/wildCardResponses"; -} diff --git a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/Foo.kt b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/Foo.kt deleted file mode 100644 index 42d8262a389..00000000000 --- a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/Foo.kt +++ /dev/null @@ -1,5 +0,0 @@ -package org.openapijsonschematools.client.paths; - -public class Foo { - public static final String path = "/foo"; -} diff --git a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/Pet.kt b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/Pet.kt deleted file mode 100644 index 96fb5bcdaf9..00000000000 --- a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/Pet.kt +++ /dev/null @@ -1,5 +0,0 @@ -package org.openapijsonschematools.client.paths; - -public class Pet { - public static final String path = "/pet"; -} diff --git a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/Petfindbystatus.kt b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/Petfindbystatus.kt deleted file mode 100644 index 7fe26528c22..00000000000 --- a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/Petfindbystatus.kt +++ /dev/null @@ -1,5 +0,0 @@ -package org.openapijsonschematools.client.paths; - -public class Petfindbystatus { - public static final String path = "/pet/findByStatus"; -} diff --git a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/Petfindbytags.kt b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/Petfindbytags.kt deleted file mode 100644 index 634991ab867..00000000000 --- a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/Petfindbytags.kt +++ /dev/null @@ -1,5 +0,0 @@ -package org.openapijsonschematools.client.paths; - -public class Petfindbytags { - public static final String path = "/pet/findByTags"; -} diff --git a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/Petpetid.kt b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/Petpetid.kt deleted file mode 100644 index e376b2b5531..00000000000 --- a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/Petpetid.kt +++ /dev/null @@ -1,5 +0,0 @@ -package org.openapijsonschematools.client.paths; - -public class Petpetid { - public static final String path = "/pet/{petId}"; -} diff --git a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/Petpetiduploadimage.kt b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/Petpetiduploadimage.kt deleted file mode 100644 index 0c266715daf..00000000000 --- a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/Petpetiduploadimage.kt +++ /dev/null @@ -1,5 +0,0 @@ -package org.openapijsonschematools.client.paths; - -public class Petpetiduploadimage { - public static final String path = "/pet/{petId}/uploadImage"; -} diff --git a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/Solidus.kt b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/Solidus.kt deleted file mode 100644 index b378bf8aa10..00000000000 --- a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/Solidus.kt +++ /dev/null @@ -1,5 +0,0 @@ -package org.openapijsonschematools.client.paths; - -public class Solidus { - public static final String path = "/"; -} diff --git a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/Storeinventory.kt b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/Storeinventory.kt deleted file mode 100644 index 38824a730f6..00000000000 --- a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/Storeinventory.kt +++ /dev/null @@ -1,5 +0,0 @@ -package org.openapijsonschematools.client.paths; - -public class Storeinventory { - public static final String path = "/store/inventory"; -} diff --git a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/Storeorder.kt b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/Storeorder.kt deleted file mode 100644 index 7e037639b4d..00000000000 --- a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/Storeorder.kt +++ /dev/null @@ -1,5 +0,0 @@ -package org.openapijsonschematools.client.paths; - -public class Storeorder { - public static final String path = "/store/order"; -} diff --git a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/Storeorderorderid.kt b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/Storeorderorderid.kt deleted file mode 100644 index b3d78f384d7..00000000000 --- a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/Storeorderorderid.kt +++ /dev/null @@ -1,5 +0,0 @@ -package org.openapijsonschematools.client.paths; - -public class Storeorderorderid { - public static final String path = "/store/order/{order_id}"; -} diff --git a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/User.kt b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/User.kt deleted file mode 100644 index c39366684bd..00000000000 --- a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/User.kt +++ /dev/null @@ -1,5 +0,0 @@ -package org.openapijsonschematools.client.paths; - -public class User { - public static final String path = "/user"; -} diff --git a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/Usercreatewitharray.kt b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/Usercreatewitharray.kt deleted file mode 100644 index 999508b3d42..00000000000 --- a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/Usercreatewitharray.kt +++ /dev/null @@ -1,5 +0,0 @@ -package org.openapijsonschematools.client.paths; - -public class Usercreatewitharray { - public static final String path = "/user/createWithArray"; -} diff --git a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/Usercreatewithlist.kt b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/Usercreatewithlist.kt deleted file mode 100644 index a59a7d908a9..00000000000 --- a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/Usercreatewithlist.kt +++ /dev/null @@ -1,5 +0,0 @@ -package org.openapijsonschematools.client.paths; - -public class Usercreatewithlist { - public static final String path = "/user/createWithList"; -} diff --git a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/Userlogin.kt b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/Userlogin.kt deleted file mode 100644 index b0d7e4c93f8..00000000000 --- a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/Userlogin.kt +++ /dev/null @@ -1,5 +0,0 @@ -package org.openapijsonschematools.client.paths; - -public class Userlogin { - public static final String path = "/user/login"; -} diff --git a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/Userlogout.kt b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/Userlogout.kt deleted file mode 100644 index f98e8b3231b..00000000000 --- a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/Userlogout.kt +++ /dev/null @@ -1,5 +0,0 @@ -package org.openapijsonschematools.client.paths; - -public class Userlogout { - public static final String path = "/user/logout"; -} diff --git a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/Userusername.kt b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/Userusername.kt deleted file mode 100644 index 4a78ea16ff8..00000000000 --- a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/Userusername.kt +++ /dev/null @@ -1,5 +0,0 @@ -package org.openapijsonschematools.client.paths; - -public class Userusername { - public static final String path = "/user/{username}"; -} diff --git a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/anotherfakedummy/AnotherfakedummyPatch.kt b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/anotherfakedummy/AnotherfakedummyPatch.kt deleted file mode 100644 index 3351c5abf40..00000000000 --- a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/anotherfakedummy/AnotherfakedummyPatch.kt +++ /dev/null @@ -1,183 +0,0 @@ -package org.openapijsonschematools.client.paths.anotherfakedummy; - -import org.checkerframework.checker.nullness.qual.Nullable; -import org.openapijsonschematools.client.RootServerInfo; -import org.openapijsonschematools.client.paths.anotherfakedummy.patch.AnotherfakedummyPatchRequestBody; -import org.openapijsonschematools.client.paths.anotherfakedummy.patch.AnotherfakedummyPatchResponses; -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.requestbody.SerializedRequestBody; -import org.openapijsonschematools.client.paths.Anotherfakedummy; - -import java.io.IOException; -import java.util.ArrayList; -import java.net.http.HttpClient; -import java.net.http.HttpRequest; -import java.time.Duration; -import java.util.List; -import java.util.Map; - -public class AnotherfakedummyPatch { - private static class PatchProvider { - private static final String method = "patch"; - - public static AnotherfakedummyPatchResponses.EndpointResponse patch( - PatchRequest request, - ApiConfiguration apiConfiguration, - SchemaConfiguration schemaConfiguration, - HttpClient client - ) throws IOException, InterruptedException, ValidationException, NotImplementedException, ApiException { - Map> headers = apiConfiguration.getDefaultHeaders(); - - SerializedRequestBody serializedRequestBody = new AnotherfakedummyPatchRequestBody.AnotherfakedummyPatchRequestBody1().serialize( - request.requestBody - ); - var contentTypeHeaderValues = headers.getOrDefault("Content-Type", new ArrayList<>()); - contentTypeHeaderValues.add(serializedRequestBody.contentType); - HttpRequest.BodyPublisher bodyPublisher = serializedRequestBody.bodyPublisher; - // TODO set this to a map if there is a query security scheme - @Nullable Map queryMap = null; - String host = apiConfiguration.getServer(request.serverIndex).url(); - - String url = host + Anotherfakedummy.path; - var httpRequest = RestClient.getRequest( - url, - method, - bodyPublisher, - headers, - request.timeout - ); - var response = RestClient.getResponse(httpRequest, client); - var responsesDeserializer = new AnotherfakedummyPatchResponses.AnotherfakedummyPatchResponses1(); - return responsesDeserializer.deserialize(response, schemaConfiguration); - } - } - - public interface PatchOperation { - ApiConfiguration getApiConfiguration(); - SchemaConfiguration getSchemaConfiguration(); - HttpClient getClient(); - default AnotherfakedummyPatchResponses.EndpointResponse patch(PatchRequest request) throws IOException, InterruptedException, ValidationException, NotImplementedException, ApiException { - return PatchProvider.patch(request, getApiConfiguration(), getSchemaConfiguration(), getClient()); - } - } - - public interface Model123TestSpecialTagsOperation { - ApiConfiguration getApiConfiguration(); - SchemaConfiguration getSchemaConfiguration(); - HttpClient getClient(); - default AnotherfakedummyPatchResponses.EndpointResponse model123TestSpecialTags(PatchRequest request) throws IOException, InterruptedException, ValidationException, NotImplementedException, ApiException { - return PatchProvider.patch(request, getApiConfiguration(), getSchemaConfiguration(), getClient()); - } - } - - public static class Patch extends ApiClient implements PatchOperation { - public Patch(ApiConfiguration apiConfiguration, SchemaConfiguration schemaConfiguration) { - super(apiConfiguration, schemaConfiguration); - } - } - - public static class PatchRequest { - public AnotherfakedummyPatchRequestBody.SealedRequestBody requestBody; - public RootServerInfo.@Nullable ServerIndex serverIndex; - public @Nullable Duration timeout; - - public PatchRequest( - AnotherfakedummyPatchRequestBody.SealedRequestBody requestBody, - RootServerInfo.@Nullable ServerIndex serverIndex, - @Nullable Duration timeout - ) { - this.requestBody = requestBody; - this.serverIndex = serverIndex; - this.timeout = timeout; - } - } - - public static class PatchNullableRequest { - public AnotherfakedummyPatchRequestBody.@Nullable SealedRequestBody requestBody; - public RootServerInfo.@Nullable ServerIndex serverIndex; - public @Nullable Duration timeout; - } - - public interface SetterForServerIndex { - PatchNullableRequest getInstance(); - T getBuilderAfterServerIndex(PatchNullableRequest instance); - default T serverIndex(RootServerInfo.ServerIndex serverIndex) { - var instance = getInstance(); - instance.serverIndex = serverIndex; - return getBuilderAfterServerIndex(instance); - } - } - - public interface SetterForTimeout { - PatchNullableRequest getInstance(); - T getBuilderAfterTimeout(PatchNullableRequest instance); - default T timeout(Duration timeout) { - var instance = getInstance(); - instance.timeout = timeout; - return getBuilderAfterTimeout(instance); - } - } - - public interface SetterForRequestBody { - PatchNullableRequest getInstance(); - T getBuilderAfterRequestBody(PatchNullableRequest instance); - default T requestBody(AnotherfakedummyPatchRequestBody.SealedRequestBody requestBody) { - var instance = getInstance(); - instance.requestBody = requestBody; - return getBuilderAfterRequestBody(instance); - } - } - - public static class Patch0RequestBuilder implements SetterForServerIndex, SetterForTimeout { - private final PatchNullableRequest instance; - - public Patch0RequestBuilder(PatchNullableRequest instance) { - this.instance = instance; - } - - public PatchRequest build() { - var requestBody = instance.requestBody; - if (requestBody == null) { - throw new RuntimeException("invalid null value for required parameter"); - } - return new PatchRequest( - requestBody, - instance.serverIndex, - instance.timeout - ); - } - - public PatchNullableRequest getInstance() { - return instance; - } - - public Patch0RequestBuilder getBuilderAfterServerIndex(PatchNullableRequest instance) { - return this; - } - - public Patch0RequestBuilder getBuilderAfterTimeout(PatchNullableRequest instance) { - return this; - } - } - public static class PatchRequestBuilder implements SetterForRequestBody { - private final PatchNullableRequest instance; - - public PatchRequestBuilder() { - this.instance = new PatchNullableRequest(); - } - - public PatchNullableRequest getInstance() { - return instance; - } - - public Patch0RequestBuilder getBuilderAfterRequestBody(PatchNullableRequest instance) { - return new Patch0RequestBuilder(instance); - } - } -} diff --git a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/anotherfakedummy/patch/AnotherfakedummyPatchRequestBody.kt b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/anotherfakedummy/patch/AnotherfakedummyPatchRequestBody.kt deleted file mode 100644 index cc759c48ee1..00000000000 --- a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/anotherfakedummy/patch/AnotherfakedummyPatchRequestBody.kt +++ /dev/null @@ -1,7 +0,0 @@ -package org.openapijsonschematools.client.paths.anotherfakedummy.patch; - -import org.openapijsonschematools.client.components.requestbodies.Client; - -public class AnotherfakedummyPatchRequestBody extends Client { - public static class AnotherfakedummyPatchRequestBody1 extends Client1 {} -} diff --git a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/anotherfakedummy/patch/AnotherfakedummyPatchResponses.kt b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/anotherfakedummy/patch/AnotherfakedummyPatchResponses.kt deleted file mode 100644 index 00b2eda830a..00000000000 --- a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/anotherfakedummy/patch/AnotherfakedummyPatchResponses.kt +++ /dev/null @@ -1,53 +0,0 @@ -package org.openapijsonschematools.client.paths.anotherfakedummy.patch; - -import org.openapijsonschematools.client.paths.anotherfakedummy.patch.responses.AnotherfakedummyPatchCode200Response; -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; -import org.checkerframework.checker.nullness.qual.Nullable; - -import java.net.http.HttpResponse; -import java.util.Map; -import java.util.AbstractMap; - -public class AnotherfakedummyPatchResponses { - public sealed interface EndpointResponse permits EndpointAnotherfakedummyPatchCode200Response {} - - public record EndpointAnotherfakedummyPatchCode200Response( - HttpResponse response, - AnotherfakedummyPatchCode200Response.SealedResponseBody body, - Nothing? headers - ) implements EndpointResponse, ApiResponse{ - } - - public sealed interface StatusCodeResponseDeserializer permits StatusAnotherfakedummyPatchCode200ResponseDeserializer {} - - public static final class StatusAnotherfakedummyPatchCode200ResponseDeserializer extends AnotherfakedummyPatchCode200Response.AnotherfakedummyPatchCode200Response1 implements StatusCodeResponseDeserializer { - } - - public static final class AnotherfakedummyPatchResponses1 implements ResponsesDeserializer { - private final Map statusCodeToResponseDeserializer; - public AnotherfakedummyPatchResponses1() { - this.statusCodeToResponseDeserializer = Map.ofEntries( - new AbstractMap.SimpleEntry<>("200", new StatusAnotherfakedummyPatchCode200ResponseDeserializer()) - ); - } - - 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) { - throw new ApiException( - "Invalid response statusCode="+statusCode+" has no response defined in the openapi document", - response - ); - } - StatusAnotherfakedummyPatchCode200ResponseDeserializer castDeserializer = (StatusAnotherfakedummyPatchCode200ResponseDeserializer) statusCodeDeserializer; - var deserializedResponse = castDeserializer.deserialize(response, configuration); - return new EndpointAnotherfakedummyPatchCode200Response(response, deserializedResponse.body(), deserializedResponse.headers()); - } - } -} diff --git a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/anotherfakedummy/patch/responses/AnotherfakedummyPatchCode200Response.kt b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/anotherfakedummy/patch/responses/AnotherfakedummyPatchCode200Response.kt deleted file mode 100644 index f437e943c6e..00000000000 --- a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/anotherfakedummy/patch/responses/AnotherfakedummyPatchCode200Response.kt +++ /dev/null @@ -1,63 +0,0 @@ -package org.openapijsonschematools.client.paths.anotherfakedummy.patch.responses; - -import org.openapijsonschematools.client.configurations.SchemaConfiguration; -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; - -import java.util.AbstractMap; -import java.util.Map; -import java.net.http.HttpResponse; -import java.net.http.HttpHeaders; - -public class AnotherfakedummyPatchCode200Response { - public sealed interface SealedMediaType permits ApplicationjsonMediaType {} - - public record ApplicationjsonMediaType(ApplicationjsonSchema.ApplicationjsonSchema1 schema) implements SealedMediaType, MediaType { - public ApplicationjsonMediaType() { - this(ApplicationjsonSchema.ApplicationjsonSchema1.getInstance()); - } - @Override - public Nothing? encoding() { - return null; - } - } - public sealed interface SealedResponseBody permits ApplicationjsonResponseBody {} - public record ApplicationjsonResponseBody(ApplicationjsonSchema.Client1Boxed body) implements SealedResponseBody { } - - public static class AnotherfakedummyPatchCode200Response1 extends ResponseDeserializer { - public AnotherfakedummyPatchCode200Response1() { - super( - Map.ofEntries( - new AbstractMap.SimpleEntry<>("application/json", new ApplicationjsonMediaType()) - ) - ); - } - - @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); - } - - @Override - protected Nothing? getHeaders(HttpHeaders headers, SchemaConfiguration configuration) { - return null; - } - } - - @SuppressWarnings("serial") - public static class ResponseApiException extends ApiException { - public DeserializedHttpResponse deserializedResponse; - - public ResponseApiException(String s, HttpResponse response, DeserializedHttpResponse deserializedResponse) { - super(s, response); - this.deserializedResponse = deserializedResponse; - } - } -} diff --git a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/anotherfakedummy/patch/responses/code200response/content/applicationjson/ApplicationjsonSchema.kt b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/anotherfakedummy/patch/responses/code200response/content/applicationjson/ApplicationjsonSchema.kt deleted file mode 100644 index 8e0f8a56f68..00000000000 --- a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/anotherfakedummy/patch/responses/code200response/content/applicationjson/ApplicationjsonSchema.kt +++ /dev/null @@ -1,19 +0,0 @@ -package org.openapijsonschematools.client.paths.anotherfakedummy.patch.responses.code200response.content.applicationjson; - -import org.checkerframework.checker.nullness.qual.Nullable; -import org.openapijsonschematools.client.components.schemas.Client; - -public class ApplicationjsonSchema extends Client { - // $refed class - - - public static class ApplicationjsonSchema1 extends Client1 { - private static @Nullable ApplicationjsonSchema1 instance = null; - public static ApplicationjsonSchema1 getInstance() { - if (instance == null) { - instance = new ApplicationjsonSchema1(); - } - return instance; - } - } -} diff --git a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/commonparamsubdir/CommonparamsubdirDelete.kt b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/commonparamsubdir/CommonparamsubdirDelete.kt deleted file mode 100644 index 082ed31af1a..00000000000 --- a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/commonparamsubdir/CommonparamsubdirDelete.kt +++ /dev/null @@ -1,205 +0,0 @@ -package org.openapijsonschematools.client.paths.commonparamsubdir; - -import org.checkerframework.checker.nullness.qual.Nullable; -import org.openapijsonschematools.client.paths.commonparamsubdir.delete.CommonparamsubdirDeleteHeaderParameters; -import org.openapijsonschematools.client.RootServerInfo; -import org.openapijsonschematools.client.paths.commonparamsubdir.delete.CommonparamsubdirDeletePathParameters; -import org.openapijsonschematools.client.paths.commonparamsubdir.delete.Parameters; -import org.openapijsonschematools.client.paths.commonparamsubdir.delete.CommonparamsubdirDeleteResponses; -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.paths.Commonparamsubdir; - -import java.io.IOException; -import java.net.http.HttpClient; -import java.net.http.HttpRequest; -import java.time.Duration; -import java.util.List; -import java.util.Map; - -public class CommonparamsubdirDelete { - private static class DeleteProvider { - private static final String method = "delete"; - - public static CommonparamsubdirDeleteResponses.EndpointResponse delete( - DeleteRequest request, - ApiConfiguration apiConfiguration, - SchemaConfiguration schemaConfiguration, - HttpClient client - ) throws IOException, InterruptedException, ValidationException, NotImplementedException, ApiException { - Map> headers = apiConfiguration.getDefaultHeaders(); - HttpRequest.BodyPublisher bodyPublisher = HttpRequest.BodyPublishers.noBody(); - - if (request.headerParameters != null) { - var headersSerializer = new Parameters.HeaderParametersSerializer(); - Map> serializedHeaders = headersSerializer.serialize(request.headerParameters); - headers.putAll(serializedHeaders); - } - - var pathSerializer = new Parameters.PathParametersSerializer(); - String updatedPath = pathSerializer.serialize(request.pathParameters, Commonparamsubdir.path); - // TODO set this to a map if there is a query security scheme - @Nullable Map queryMap = null; - String host = apiConfiguration.getServer(request.serverIndex).url(); - - String url = host + updatedPath; - var httpRequest = RestClient.getRequest( - url, - method, - bodyPublisher, - headers, - request.timeout - ); - var response = RestClient.getResponse(httpRequest, client); - var responsesDeserializer = new CommonparamsubdirDeleteResponses.CommonparamsubdirDeleteResponses1(); - return responsesDeserializer.deserialize(response, schemaConfiguration); - } - } - - public interface DeleteOperation { - ApiConfiguration getApiConfiguration(); - SchemaConfiguration getSchemaConfiguration(); - HttpClient getClient(); - default CommonparamsubdirDeleteResponses.EndpointResponse delete(DeleteRequest request) throws IOException, InterruptedException, ValidationException, NotImplementedException, ApiException { - return DeleteProvider.delete(request, getApiConfiguration(), getSchemaConfiguration(), getClient()); - } - } - - public interface DeleteCommonParamOperation { - ApiConfiguration getApiConfiguration(); - SchemaConfiguration getSchemaConfiguration(); - HttpClient getClient(); - default CommonparamsubdirDeleteResponses.EndpointResponse deleteCommonParam(DeleteRequest request) throws IOException, InterruptedException, ValidationException, NotImplementedException, ApiException { - return DeleteProvider.delete(request, getApiConfiguration(), getSchemaConfiguration(), getClient()); - } - } - - public static class Delete extends ApiClient implements DeleteOperation { - public Delete(ApiConfiguration apiConfiguration, SchemaConfiguration schemaConfiguration) { - super(apiConfiguration, schemaConfiguration); - } - } - - public static class DeleteRequest { - public CommonparamsubdirDeletePathParameters.PathParametersMap pathParameters; - public CommonparamsubdirDeleteHeaderParameters.@Nullable HeaderParametersMap headerParameters; - public RootServerInfo.@Nullable ServerIndex serverIndex; - public @Nullable Duration timeout; - - public DeleteRequest( - CommonparamsubdirDeletePathParameters.PathParametersMap pathParameters, - CommonparamsubdirDeleteHeaderParameters.@Nullable HeaderParametersMap headerParameters, - RootServerInfo.@Nullable ServerIndex serverIndex, - @Nullable Duration timeout - ) { - this.pathParameters = pathParameters; - this.headerParameters = headerParameters; - this.serverIndex = serverIndex; - this.timeout = timeout; - } - } - - public static class DeleteNullableRequest { - public CommonparamsubdirDeletePathParameters.@Nullable PathParametersMap pathParameters; - public CommonparamsubdirDeleteHeaderParameters.@Nullable HeaderParametersMap headerParameters; - public RootServerInfo.@Nullable ServerIndex serverIndex; - public @Nullable Duration timeout; - } - - public interface SetterForHeaderParameters { - DeleteNullableRequest getInstance(); - T getBuilderAfterHeaderParameters(DeleteNullableRequest instance); - default T headerParameters(CommonparamsubdirDeleteHeaderParameters.HeaderParametersMap headerParameters) { - var instance = getInstance(); - instance.headerParameters = headerParameters; - return getBuilderAfterHeaderParameters(instance); - } - } - - public interface SetterForServerIndex { - DeleteNullableRequest getInstance(); - T getBuilderAfterServerIndex(DeleteNullableRequest instance); - default T serverIndex(RootServerInfo.ServerIndex serverIndex) { - var instance = getInstance(); - instance.serverIndex = serverIndex; - return getBuilderAfterServerIndex(instance); - } - } - - public interface SetterForTimeout { - DeleteNullableRequest getInstance(); - T getBuilderAfterTimeout(DeleteNullableRequest instance); - default T timeout(Duration timeout) { - var instance = getInstance(); - instance.timeout = timeout; - return getBuilderAfterTimeout(instance); - } - } - - public interface SetterForPathParameters { - DeleteNullableRequest getInstance(); - T getBuilderAfterPathParameters(DeleteNullableRequest instance); - default T pathParameters(CommonparamsubdirDeletePathParameters.PathParametersMap pathParameters) { - var instance = getInstance(); - instance.pathParameters = pathParameters; - return getBuilderAfterPathParameters(instance); - } - } - - public static class Delete0RequestBuilder implements SetterForHeaderParameters, SetterForServerIndex, SetterForTimeout { - private final DeleteNullableRequest instance; - - public Delete0RequestBuilder(DeleteNullableRequest instance) { - this.instance = instance; - } - - public DeleteRequest build() { - var pathParameters = instance.pathParameters; - if (pathParameters == null) { - throw new RuntimeException("invalid null value for required parameter"); - } - return new DeleteRequest( - pathParameters, - instance.headerParameters, - instance.serverIndex, - instance.timeout - ); - } - - public DeleteNullableRequest getInstance() { - return instance; - } - - public Delete0RequestBuilder getBuilderAfterHeaderParameters(DeleteNullableRequest instance) { - return this; - } - - public Delete0RequestBuilder getBuilderAfterServerIndex(DeleteNullableRequest instance) { - return this; - } - - public Delete0RequestBuilder getBuilderAfterTimeout(DeleteNullableRequest instance) { - return this; - } - } - public static class DeleteRequestBuilder implements SetterForPathParameters { - private final DeleteNullableRequest instance; - - public DeleteRequestBuilder() { - this.instance = new DeleteNullableRequest(); - } - - public DeleteNullableRequest getInstance() { - return instance; - } - - public Delete0RequestBuilder getBuilderAfterPathParameters(DeleteNullableRequest instance) { - return new Delete0RequestBuilder(instance); - } - } -} diff --git a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/commonparamsubdir/CommonparamsubdirGet.kt b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/commonparamsubdir/CommonparamsubdirGet.kt deleted file mode 100644 index 87ac84e93c4..00000000000 --- a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/commonparamsubdir/CommonparamsubdirGet.kt +++ /dev/null @@ -1,206 +0,0 @@ -package org.openapijsonschematools.client.paths.commonparamsubdir; - -import org.checkerframework.checker.nullness.qual.Nullable; -import org.openapijsonschematools.client.paths.commonparamsubdir.get.CommonparamsubdirGetQueryParameters; -import org.openapijsonschematools.client.RootServerInfo; -import org.openapijsonschematools.client.paths.commonparamsubdir.get.CommonparamsubdirGetPathParameters; -import org.openapijsonschematools.client.paths.commonparamsubdir.get.Parameters; -import org.openapijsonschematools.client.paths.commonparamsubdir.get.CommonparamsubdirGetResponses; -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.paths.Commonparamsubdir; - -import java.io.IOException; -import java.net.http.HttpClient; -import java.net.http.HttpRequest; -import java.time.Duration; -import java.util.List; -import java.util.Map; - -public class CommonparamsubdirGet { - private static class GetProvider { - private static final String method = "get"; - - public static CommonparamsubdirGetResponses.EndpointResponse get( - GetRequest request, - ApiConfiguration apiConfiguration, - SchemaConfiguration schemaConfiguration, - HttpClient client - ) throws IOException, InterruptedException, ValidationException, NotImplementedException, ApiException { - Map> headers = apiConfiguration.getDefaultHeaders(); - HttpRequest.BodyPublisher bodyPublisher = HttpRequest.BodyPublishers.noBody(); - - var pathSerializer = new Parameters.PathParametersSerializer(); - String updatedPath = pathSerializer.serialize(request.pathParameters, Commonparamsubdir.path); - - var querySerializer = new Parameters.QueryParametersSerializer(); - @Nullable Map queryMap = null; - if (request.queryParameters != null) { - queryMap = querySerializer.getQueryMap(request.queryParameters); - } - String host = apiConfiguration.getServer(request.serverIndex).url(); - - String url = host + updatedPath; - if (queryMap != null) { - url = url + querySerializer.serialize(queryMap); - } - var httpRequest = RestClient.getRequest( - url, - method, - bodyPublisher, - headers, - request.timeout - ); - var response = RestClient.getResponse(httpRequest, client); - var responsesDeserializer = new CommonparamsubdirGetResponses.CommonparamsubdirGetResponses1(); - return responsesDeserializer.deserialize(response, schemaConfiguration); - } - } - - public interface GetOperation { - ApiConfiguration getApiConfiguration(); - SchemaConfiguration getSchemaConfiguration(); - HttpClient getClient(); - default CommonparamsubdirGetResponses.EndpointResponse get(GetRequest request) throws IOException, InterruptedException, ValidationException, NotImplementedException, ApiException { - return GetProvider.get(request, getApiConfiguration(), getSchemaConfiguration(), getClient()); - } - } - - public interface GetCommonParamOperation { - ApiConfiguration getApiConfiguration(); - SchemaConfiguration getSchemaConfiguration(); - HttpClient getClient(); - default CommonparamsubdirGetResponses.EndpointResponse getCommonParam(GetRequest request) throws IOException, InterruptedException, ValidationException, NotImplementedException, ApiException { - return GetProvider.get(request, getApiConfiguration(), getSchemaConfiguration(), getClient()); - } - } - - public static class Get extends ApiClient implements GetOperation { - public Get(ApiConfiguration apiConfiguration, SchemaConfiguration schemaConfiguration) { - super(apiConfiguration, schemaConfiguration); - } - } - - public static class GetRequest { - public CommonparamsubdirGetPathParameters.PathParametersMap pathParameters; - public CommonparamsubdirGetQueryParameters.@Nullable QueryParametersMap queryParameters; - public RootServerInfo.@Nullable ServerIndex serverIndex; - public @Nullable Duration timeout; - - public GetRequest( - CommonparamsubdirGetPathParameters.PathParametersMap pathParameters, - CommonparamsubdirGetQueryParameters.@Nullable QueryParametersMap queryParameters, - RootServerInfo.@Nullable ServerIndex serverIndex, - @Nullable Duration timeout - ) { - this.pathParameters = pathParameters; - this.queryParameters = queryParameters; - this.serverIndex = serverIndex; - this.timeout = timeout; - } - } - - public static class GetNullableRequest { - public CommonparamsubdirGetPathParameters.@Nullable PathParametersMap pathParameters; - public CommonparamsubdirGetQueryParameters.@Nullable QueryParametersMap queryParameters; - public RootServerInfo.@Nullable ServerIndex serverIndex; - public @Nullable Duration timeout; - } - - public interface SetterForQueryParameters { - GetNullableRequest getInstance(); - T getBuilderAfterQueryParameters(GetNullableRequest instance); - default T queryParameters(CommonparamsubdirGetQueryParameters.QueryParametersMap queryParameters) { - var instance = getInstance(); - instance.queryParameters = queryParameters; - return getBuilderAfterQueryParameters(instance); - } - } - - public interface SetterForServerIndex { - GetNullableRequest getInstance(); - T getBuilderAfterServerIndex(GetNullableRequest instance); - default T serverIndex(RootServerInfo.ServerIndex serverIndex) { - var instance = getInstance(); - instance.serverIndex = serverIndex; - return getBuilderAfterServerIndex(instance); - } - } - - public interface SetterForTimeout { - GetNullableRequest getInstance(); - T getBuilderAfterTimeout(GetNullableRequest instance); - default T timeout(Duration timeout) { - var instance = getInstance(); - instance.timeout = timeout; - return getBuilderAfterTimeout(instance); - } - } - - public interface SetterForPathParameters { - GetNullableRequest getInstance(); - T getBuilderAfterPathParameters(GetNullableRequest instance); - default T pathParameters(CommonparamsubdirGetPathParameters.PathParametersMap pathParameters) { - var instance = getInstance(); - instance.pathParameters = pathParameters; - return getBuilderAfterPathParameters(instance); - } - } - - public static class Get0RequestBuilder implements SetterForQueryParameters, SetterForServerIndex, SetterForTimeout { - private final GetNullableRequest instance; - - public Get0RequestBuilder(GetNullableRequest instance) { - this.instance = instance; - } - - public GetRequest build() { - var pathParameters = instance.pathParameters; - if (pathParameters == null) { - throw new RuntimeException("invalid null value for required parameter"); - } - return new GetRequest( - pathParameters, - instance.queryParameters, - instance.serverIndex, - instance.timeout - ); - } - - public GetNullableRequest getInstance() { - return instance; - } - - public Get0RequestBuilder getBuilderAfterQueryParameters(GetNullableRequest instance) { - return this; - } - - public Get0RequestBuilder getBuilderAfterServerIndex(GetNullableRequest instance) { - return this; - } - - public Get0RequestBuilder getBuilderAfterTimeout(GetNullableRequest instance) { - return this; - } - } - public static class GetRequestBuilder implements SetterForPathParameters { - private final GetNullableRequest instance; - - public GetRequestBuilder() { - this.instance = new GetNullableRequest(); - } - - public GetNullableRequest getInstance() { - return instance; - } - - public Get0RequestBuilder getBuilderAfterPathParameters(GetNullableRequest instance) { - return new Get0RequestBuilder(instance); - } - } -} diff --git a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/commonparamsubdir/CommonparamsubdirPost.kt b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/commonparamsubdir/CommonparamsubdirPost.kt deleted file mode 100644 index 82954fa4a74..00000000000 --- a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/commonparamsubdir/CommonparamsubdirPost.kt +++ /dev/null @@ -1,205 +0,0 @@ -package org.openapijsonschematools.client.paths.commonparamsubdir; - -import org.checkerframework.checker.nullness.qual.Nullable; -import org.openapijsonschematools.client.paths.commonparamsubdir.post.CommonparamsubdirPostHeaderParameters; -import org.openapijsonschematools.client.RootServerInfo; -import org.openapijsonschematools.client.paths.commonparamsubdir.post.CommonparamsubdirPostPathParameters; -import org.openapijsonschematools.client.paths.commonparamsubdir.post.Parameters; -import org.openapijsonschematools.client.paths.commonparamsubdir.post.CommonparamsubdirPostResponses; -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.paths.Commonparamsubdir; - -import java.io.IOException; -import java.net.http.HttpClient; -import java.net.http.HttpRequest; -import java.time.Duration; -import java.util.List; -import java.util.Map; - -public class CommonparamsubdirPost { - private static class PostProvider { - private static final String method = "post"; - - public static CommonparamsubdirPostResponses.EndpointResponse post( - PostRequest request, - ApiConfiguration apiConfiguration, - SchemaConfiguration schemaConfiguration, - HttpClient client - ) throws IOException, InterruptedException, ValidationException, NotImplementedException, ApiException { - Map> headers = apiConfiguration.getDefaultHeaders(); - HttpRequest.BodyPublisher bodyPublisher = HttpRequest.BodyPublishers.noBody(); - - if (request.headerParameters != null) { - var headersSerializer = new Parameters.HeaderParametersSerializer(); - Map> serializedHeaders = headersSerializer.serialize(request.headerParameters); - headers.putAll(serializedHeaders); - } - - var pathSerializer = new Parameters.PathParametersSerializer(); - String updatedPath = pathSerializer.serialize(request.pathParameters, Commonparamsubdir.path); - // TODO set this to a map if there is a query security scheme - @Nullable Map queryMap = null; - String host = apiConfiguration.getServer(request.serverIndex).url(); - - String url = host + updatedPath; - var httpRequest = RestClient.getRequest( - url, - method, - bodyPublisher, - headers, - request.timeout - ); - var response = RestClient.getResponse(httpRequest, client); - var responsesDeserializer = new CommonparamsubdirPostResponses.CommonparamsubdirPostResponses1(); - return responsesDeserializer.deserialize(response, schemaConfiguration); - } - } - - public interface PostOperation { - ApiConfiguration getApiConfiguration(); - SchemaConfiguration getSchemaConfiguration(); - HttpClient getClient(); - default CommonparamsubdirPostResponses.EndpointResponse post(PostRequest request) throws IOException, InterruptedException, ValidationException, NotImplementedException, ApiException { - return PostProvider.post(request, getApiConfiguration(), getSchemaConfiguration(), getClient()); - } - } - - public interface PostCommonParamOperation { - ApiConfiguration getApiConfiguration(); - SchemaConfiguration getSchemaConfiguration(); - HttpClient getClient(); - default CommonparamsubdirPostResponses.EndpointResponse postCommonParam(PostRequest request) throws IOException, InterruptedException, ValidationException, NotImplementedException, ApiException { - return PostProvider.post(request, getApiConfiguration(), getSchemaConfiguration(), getClient()); - } - } - - public static class Post extends ApiClient implements PostOperation { - public Post(ApiConfiguration apiConfiguration, SchemaConfiguration schemaConfiguration) { - super(apiConfiguration, schemaConfiguration); - } - } - - public static class PostRequest { - public CommonparamsubdirPostPathParameters.PathParametersMap pathParameters; - public CommonparamsubdirPostHeaderParameters.@Nullable HeaderParametersMap headerParameters; - public RootServerInfo.@Nullable ServerIndex serverIndex; - public @Nullable Duration timeout; - - public PostRequest( - CommonparamsubdirPostPathParameters.PathParametersMap pathParameters, - CommonparamsubdirPostHeaderParameters.@Nullable HeaderParametersMap headerParameters, - RootServerInfo.@Nullable ServerIndex serverIndex, - @Nullable Duration timeout - ) { - this.pathParameters = pathParameters; - this.headerParameters = headerParameters; - this.serverIndex = serverIndex; - this.timeout = timeout; - } - } - - public static class PostNullableRequest { - public CommonparamsubdirPostPathParameters.@Nullable PathParametersMap pathParameters; - public CommonparamsubdirPostHeaderParameters.@Nullable HeaderParametersMap headerParameters; - public RootServerInfo.@Nullable ServerIndex serverIndex; - public @Nullable Duration timeout; - } - - public interface SetterForHeaderParameters { - PostNullableRequest getInstance(); - T getBuilderAfterHeaderParameters(PostNullableRequest instance); - default T headerParameters(CommonparamsubdirPostHeaderParameters.HeaderParametersMap headerParameters) { - var instance = getInstance(); - instance.headerParameters = headerParameters; - return getBuilderAfterHeaderParameters(instance); - } - } - - public interface SetterForServerIndex { - PostNullableRequest getInstance(); - T getBuilderAfterServerIndex(PostNullableRequest instance); - default T serverIndex(RootServerInfo.ServerIndex serverIndex) { - var instance = getInstance(); - instance.serverIndex = serverIndex; - return getBuilderAfterServerIndex(instance); - } - } - - public interface SetterForTimeout { - PostNullableRequest getInstance(); - T getBuilderAfterTimeout(PostNullableRequest instance); - default T timeout(Duration timeout) { - var instance = getInstance(); - instance.timeout = timeout; - return getBuilderAfterTimeout(instance); - } - } - - public interface SetterForPathParameters { - PostNullableRequest getInstance(); - T getBuilderAfterPathParameters(PostNullableRequest instance); - default T pathParameters(CommonparamsubdirPostPathParameters.PathParametersMap pathParameters) { - var instance = getInstance(); - instance.pathParameters = pathParameters; - return getBuilderAfterPathParameters(instance); - } - } - - public static class Post0RequestBuilder implements SetterForHeaderParameters, SetterForServerIndex, SetterForTimeout { - private final PostNullableRequest instance; - - public Post0RequestBuilder(PostNullableRequest instance) { - this.instance = instance; - } - - public PostRequest build() { - var pathParameters = instance.pathParameters; - if (pathParameters == null) { - throw new RuntimeException("invalid null value for required parameter"); - } - return new PostRequest( - pathParameters, - instance.headerParameters, - instance.serverIndex, - instance.timeout - ); - } - - public PostNullableRequest getInstance() { - return instance; - } - - public Post0RequestBuilder getBuilderAfterHeaderParameters(PostNullableRequest instance) { - return this; - } - - public Post0RequestBuilder getBuilderAfterServerIndex(PostNullableRequest instance) { - return this; - } - - public Post0RequestBuilder getBuilderAfterTimeout(PostNullableRequest instance) { - return this; - } - } - public static class PostRequestBuilder implements SetterForPathParameters { - private final PostNullableRequest instance; - - public PostRequestBuilder() { - this.instance = new PostNullableRequest(); - } - - public PostNullableRequest getInstance() { - return instance; - } - - public Post0RequestBuilder getBuilderAfterPathParameters(PostNullableRequest instance) { - return new Post0RequestBuilder(instance); - } - } -} diff --git a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/commonparamsubdir/delete/CommonparamsubdirDeleteHeaderParameters.kt b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/commonparamsubdir/delete/CommonparamsubdirDeleteHeaderParameters.kt deleted file mode 100644 index 4eeec2ff8d9..00000000000 --- a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/commonparamsubdir/delete/CommonparamsubdirDeleteHeaderParameters.kt +++ /dev/null @@ -1,191 +0,0 @@ -package org.openapijsonschematools.client.paths.commonparamsubdir.delete; -import java.util.ArrayList; -import java.util.HashSet; -import java.util.LinkedHashMap; -import java.util.LinkedHashSet; -import java.util.List; -import java.util.Map; -import java.util.Objects; -import java.util.Set; -import org.checkerframework.checker.nullness.qual.Nullable; -import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags; -import org.openapijsonschematools.client.configurations.SchemaConfiguration; -import org.openapijsonschematools.client.exceptions.UnsetPropertyException; -import org.openapijsonschematools.client.exceptions.ValidationException; -import org.openapijsonschematools.client.paths.commonparamsubdir.delete.parameters.parameter0.Schema0; -import org.openapijsonschematools.client.schemas.AnyTypeJsonSchema; -import org.openapijsonschematools.client.schemas.GenericBuilder; -import org.openapijsonschematools.client.schemas.NotAnyTypeJsonSchema; -import org.openapijsonschematools.client.schemas.validation.FrozenMap; -import org.openapijsonschematools.client.schemas.validation.JsonSchema; -import org.openapijsonschematools.client.schemas.validation.JsonSchemaInfo; -import org.openapijsonschematools.client.schemas.validation.MapSchemaValidator; -import org.openapijsonschematools.client.schemas.validation.MapUtils; -import org.openapijsonschematools.client.schemas.validation.PathToSchemasMap; -import org.openapijsonschematools.client.schemas.validation.PropertyEntry; -import org.openapijsonschematools.client.schemas.validation.ValidationMetadata; - -public class CommonparamsubdirDeleteHeaderParameters { - // nest classes so all schemas and input/output classes can be public - - - public static class AdditionalProperties extends NotAnyTypeJsonSchema.NotAnyTypeJsonSchema1 { - // NotAnyTypeSchema - private static @Nullable AdditionalProperties instance = null; - public static AdditionalProperties getInstance() { - if (instance == null) { - instance = new AdditionalProperties(); - } - return instance; - } - } - - - public static class HeaderParametersMap extends FrozenMap { - protected HeaderParametersMap(FrozenMap m) { - super(m); - } - public static final Set requiredKeys = Set.of(); - public static final Set optionalKeys = Set.of( - "someHeader" - ); - public static HeaderParametersMap of(Map arg, SchemaConfiguration configuration) throws ValidationException { - return CommonparamsubdirDeleteHeaderParameters1.getInstance().validate(arg, configuration); - } - - public String someHeader() throws UnsetPropertyException { - return getOrThrow("someHeader"); - } - } - - public interface SetterForSomeHeader { - Map getInstance(); - T getBuilderAfterSomeHeader(Map instance); - - default T someHeader(String value) { - var instance = getInstance(); - instance.put("someHeader", value); - return getBuilderAfterSomeHeader(instance); - } - } - - public static class HeaderParametersMapBuilder implements GenericBuilder>, SetterForSomeHeader { - private final Map instance; - private static final Set knownKeys = Set.of( - "someHeader" - ); - public Set getKnownKeys() { - return knownKeys; - } - public HeaderParametersMapBuilder() { - this.instance = new LinkedHashMap<>(); - } - public Map build() { - return instance; - } - public Map getInstance() { - return instance; - } - public HeaderParametersMapBuilder getBuilderAfterSomeHeader(Map instance) { - return this; - } - } - - - public sealed interface CommonparamsubdirDeleteHeaderParameters1Boxed permits CommonparamsubdirDeleteHeaderParameters1BoxedMap { - @Nullable Object getData(); - } - - public record CommonparamsubdirDeleteHeaderParameters1BoxedMap(HeaderParametersMap data) implements CommonparamsubdirDeleteHeaderParameters1Boxed { - @Override - public @Nullable Object getData() { - return data; - } - } - - - public static class CommonparamsubdirDeleteHeaderParameters1 extends JsonSchema implements MapSchemaValidator { - private static @Nullable CommonparamsubdirDeleteHeaderParameters1 instance = null; - - protected CommonparamsubdirDeleteHeaderParameters1() { - super(new JsonSchemaInfo() - .type(Set.of(Map.class)) - .properties(Map.ofEntries( - new PropertyEntry("someHeader", Schema0.Schema01.class) - )) - .additionalProperties(AdditionalProperties.class) - ); - } - - public static CommonparamsubdirDeleteHeaderParameters1 getInstance() { - if (instance == null) { - instance = new CommonparamsubdirDeleteHeaderParameters1(); - } - return instance; - } - - 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 RuntimeException("Invalid non-string key value"); - } - String propertyName = (String) entryKey; - List propertyPathToItem = new ArrayList<>(pathToItem); - propertyPathToItem.add(propertyName); - Object value = entry.getValue(); - LinkedHashMap, Nothing?> schemas = pathToSchemas.get(propertyPathToItem); - if (schemas == null) { - throw new RuntimeException("Validation 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"); - } - properties.put(propertyName, (String) propertyInstance); - } - FrozenMap castProperties = new FrozenMap<>(properties); - return new HeaderParametersMap(castProperties); - } - - 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); - SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().build())); - ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, new PathToSchemasMap(), new LinkedHashSet<>()); - PathToSchemasMap pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet); - return getNewInstance(castArg, validationMetadata.pathToItem(), pathToSchemasMap); - } - - - @Override - public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws 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"); - } - @Override - public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { - if (arg instanceof Map) { - return getNewInstance((Map) arg, pathToItem, pathToSchemas); - } - throw new RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); - } - @Override - public CommonparamsubdirDeleteHeaderParameters1BoxedMap validateAndBox(Map arg, SchemaConfiguration configuration) throws ValidationException { - return new CommonparamsubdirDeleteHeaderParameters1BoxedMap(validate(arg, configuration)); - } - @Override - public CommonparamsubdirDeleteHeaderParameters1Boxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { - 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"); - } - } - -} diff --git a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/commonparamsubdir/delete/CommonparamsubdirDeletePathParameters.kt b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/commonparamsubdir/delete/CommonparamsubdirDeletePathParameters.kt deleted file mode 100644 index d8aa1e6e637..00000000000 --- a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/commonparamsubdir/delete/CommonparamsubdirDeletePathParameters.kt +++ /dev/null @@ -1,211 +0,0 @@ -package org.openapijsonschematools.client.paths.commonparamsubdir.delete; -import java.util.ArrayList; -import java.util.HashSet; -import java.util.LinkedHashMap; -import java.util.LinkedHashSet; -import java.util.List; -import java.util.Map; -import java.util.Objects; -import java.util.Set; -import org.checkerframework.checker.nullness.qual.Nullable; -import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags; -import org.openapijsonschematools.client.configurations.SchemaConfiguration; -import org.openapijsonschematools.client.exceptions.UnsetPropertyException; -import org.openapijsonschematools.client.exceptions.ValidationException; -import org.openapijsonschematools.client.paths.commonparamsubdir.delete.parameters.parameter1.Schema1; -import org.openapijsonschematools.client.schemas.AnyTypeJsonSchema; -import org.openapijsonschematools.client.schemas.GenericBuilder; -import org.openapijsonschematools.client.schemas.NotAnyTypeJsonSchema; -import org.openapijsonschematools.client.schemas.validation.FrozenMap; -import org.openapijsonschematools.client.schemas.validation.JsonSchema; -import org.openapijsonschematools.client.schemas.validation.JsonSchemaInfo; -import org.openapijsonschematools.client.schemas.validation.MapSchemaValidator; -import org.openapijsonschematools.client.schemas.validation.MapUtils; -import org.openapijsonschematools.client.schemas.validation.PathToSchemasMap; -import org.openapijsonschematools.client.schemas.validation.PropertyEntry; -import org.openapijsonschematools.client.schemas.validation.ValidationMetadata; - -public class CommonparamsubdirDeletePathParameters { - // nest classes so all schemas and input/output classes can be public - - - public static class AdditionalProperties extends NotAnyTypeJsonSchema.NotAnyTypeJsonSchema1 { - // NotAnyTypeSchema - private static @Nullable AdditionalProperties instance = null; - public static AdditionalProperties getInstance() { - if (instance == null) { - instance = new AdditionalProperties(); - } - return instance; - } - } - - - public static class PathParametersMap extends FrozenMap { - protected PathParametersMap(FrozenMap m) { - super(m); - } - public static final Set requiredKeys = Set.of( - "subDir" - ); - public static final Set optionalKeys = Set.of(); - public static PathParametersMap of(Map arg, SchemaConfiguration configuration) throws ValidationException { - return CommonparamsubdirDeletePathParameters1.getInstance().validate(arg, configuration); - } - - public String subDir() { - try { - return getOrThrow("version"); - } catch (UnsetPropertyException e) { - throw new RuntimeException(e); - } - } - } - - public interface SetterForSubDir { - Map getInstance(); - T getBuilderAfterSubDir(Map instance); - - default T subDir(String value) { - var instance = getInstance(); - instance.put("subDir", value); - return getBuilderAfterSubDir(instance); - } - - default T subDir(Schema1.StringSchemaEnums1 value) { - var instance = getInstance(); - instance.put("subDir", value.value()); - return getBuilderAfterSubDir(instance); - } - } - - public static class PathParametersMap0Builder implements GenericBuilder> { - private final Map instance; - private static final Set knownKeys = Set.of( - "subDir" - ); - public Set getKnownKeys() { - return knownKeys; - } - public PathParametersMap0Builder(Map instance) { - this.instance = instance; - } - public Map build() { - return instance; - } - } - - public static class PathParametersMapBuilder implements SetterForSubDir { - private final Map instance; - public PathParametersMapBuilder() { - this.instance = new LinkedHashMap<>(); - } - public Map getInstance() { - return instance; - } - public PathParametersMap0Builder getBuilderAfterSubDir(Map instance) { - return new PathParametersMap0Builder(instance); - } - } - - - public sealed interface CommonparamsubdirDeletePathParameters1Boxed permits CommonparamsubdirDeletePathParameters1BoxedMap { - @Nullable Object getData(); - } - - public record CommonparamsubdirDeletePathParameters1BoxedMap(PathParametersMap data) implements CommonparamsubdirDeletePathParameters1Boxed { - @Override - public @Nullable Object getData() { - return data; - } - } - - - public static class CommonparamsubdirDeletePathParameters1 extends JsonSchema implements MapSchemaValidator { - private static @Nullable CommonparamsubdirDeletePathParameters1 instance = null; - - protected CommonparamsubdirDeletePathParameters1() { - super(new JsonSchemaInfo() - .type(Set.of(Map.class)) - .properties(Map.ofEntries( - new PropertyEntry("subDir", Schema1.Schema11.class) - )) - .required(Set.of( - "subDir" - )) - .additionalProperties(AdditionalProperties.class) - ); - } - - public static CommonparamsubdirDeletePathParameters1 getInstance() { - if (instance == null) { - instance = new CommonparamsubdirDeletePathParameters1(); - } - return instance; - } - - 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 RuntimeException("Invalid non-string key value"); - } - String propertyName = (String) entryKey; - List propertyPathToItem = new ArrayList<>(pathToItem); - propertyPathToItem.add(propertyName); - Object value = entry.getValue(); - LinkedHashMap, Nothing?> schemas = pathToSchemas.get(propertyPathToItem); - if (schemas == null) { - throw new RuntimeException("Validation 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"); - } - properties.put(propertyName, (String) propertyInstance); - } - FrozenMap castProperties = new FrozenMap<>(properties); - return new PathParametersMap(castProperties); - } - - 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); - SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().build())); - ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, new PathToSchemasMap(), new LinkedHashSet<>()); - PathToSchemasMap pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet); - return getNewInstance(castArg, validationMetadata.pathToItem(), pathToSchemasMap); - } - - - @Override - public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws 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"); - } - @Override - public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { - if (arg instanceof Map) { - return getNewInstance((Map) arg, pathToItem, pathToSchemas); - } - throw new RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); - } - @Override - public CommonparamsubdirDeletePathParameters1BoxedMap validateAndBox(Map arg, SchemaConfiguration configuration) throws ValidationException { - return new CommonparamsubdirDeletePathParameters1BoxedMap(validate(arg, configuration)); - } - @Override - public CommonparamsubdirDeletePathParameters1Boxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { - 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"); - } - } - -} diff --git a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/commonparamsubdir/delete/CommonparamsubdirDeleteResponses.kt b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/commonparamsubdir/delete/CommonparamsubdirDeleteResponses.kt deleted file mode 100644 index e7eb08de6dc..00000000000 --- a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/commonparamsubdir/delete/CommonparamsubdirDeleteResponses.kt +++ /dev/null @@ -1,53 +0,0 @@ -package org.openapijsonschematools.client.paths.commonparamsubdir.delete; - -import org.openapijsonschematools.client.paths.commonparamsubdir.delete.responses.CommonparamsubdirDeleteCode200Response; -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; -import org.checkerframework.checker.nullness.qual.Nullable; - -import java.net.http.HttpResponse; -import java.util.Map; -import java.util.AbstractMap; - -public class CommonparamsubdirDeleteResponses { - public sealed interface EndpointResponse permits EndpointCommonparamsubdirDeleteCode200Response {} - - public record EndpointCommonparamsubdirDeleteCode200Response( - HttpResponse response, - Nothing? body, - Nothing? headers - ) implements EndpointResponse, ApiResponse{ - } - - public sealed interface StatusCodeResponseDeserializer permits StatusCommonparamsubdirDeleteCode200ResponseDeserializer {} - - public static final class StatusCommonparamsubdirDeleteCode200ResponseDeserializer extends CommonparamsubdirDeleteCode200Response.CommonparamsubdirDeleteCode200Response1 implements StatusCodeResponseDeserializer { - } - - public static final class CommonparamsubdirDeleteResponses1 implements ResponsesDeserializer { - private final Map statusCodeToResponseDeserializer; - public CommonparamsubdirDeleteResponses1() { - this.statusCodeToResponseDeserializer = Map.ofEntries( - new AbstractMap.SimpleEntry<>("200", new StatusCommonparamsubdirDeleteCode200ResponseDeserializer()) - ); - } - - 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) { - throw new ApiException( - "Invalid response statusCode="+statusCode+" has no response defined in the openapi document", - response - ); - } - StatusCommonparamsubdirDeleteCode200ResponseDeserializer castDeserializer = (StatusCommonparamsubdirDeleteCode200ResponseDeserializer) statusCodeDeserializer; - var deserializedResponse = castDeserializer.deserialize(response, configuration); - return new EndpointCommonparamsubdirDeleteCode200Response(response, deserializedResponse.body(), deserializedResponse.headers()); - } - } -} diff --git a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/commonparamsubdir/delete/Parameters.kt b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/commonparamsubdir/delete/Parameters.kt deleted file mode 100644 index 361ce042d3a..00000000000 --- a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/commonparamsubdir/delete/Parameters.kt +++ /dev/null @@ -1,32 +0,0 @@ -package org.openapijsonschematools.client.paths.commonparamsubdir.delete; - -import org.openapijsonschematools.client.paths.commonparamsubdir.delete.parameters.Parameter0; -import org.openapijsonschematools.client.paths.commonparamsubdir.delete.parameters.Parameter1; -import org.openapijsonschematools.client.parameter.PathSerializer; -import org.openapijsonschematools.client.parameter.HeadersSerializer; - -import java.util.Map; -import java.util.AbstractMap; - -public class Parameters { - - public static class PathParametersSerializer extends PathSerializer { - public PathParametersSerializer() { - super( - Map.ofEntries( - new AbstractMap.SimpleEntry<>("subDir", new Parameter1.Parameter11()) - ) - ); - } - } - - public static class HeaderParametersSerializer extends HeadersSerializer { - public HeaderParametersSerializer() { - super( - Map.ofEntries( - new AbstractMap.SimpleEntry<>("someHeader", new Parameter0.Parameter01()) - ) - ); - } - } -} diff --git a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/commonparamsubdir/delete/parameters/Parameter0.kt b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/commonparamsubdir/delete/parameters/Parameter0.kt deleted file mode 100644 index 1385ce8e488..00000000000 --- a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/commonparamsubdir/delete/parameters/Parameter0.kt +++ /dev/null @@ -1,23 +0,0 @@ -package org.openapijsonschematools.client.paths.commonparamsubdir.delete.parameters; - -import org.openapijsonschematools.client.parameter.ParameterStyle; -import org.openapijsonschematools.client.parameter.ParameterInType; -import org.openapijsonschematools.client.parameter.SchemaParameter; -import org.openapijsonschematools.client.paths.commonparamsubdir.delete.parameters.parameter0.Schema0; - -public class Parameter0 { - - public static class Parameter01 extends SchemaParameter { - public Parameter01() { - super( - "someHeader", - ParameterInType.HEADER, - false, - ParameterStyle.SIMPLE, - false, - false, - Schema0.Schema01.getInstance() - ); - } - } -} diff --git a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/commonparamsubdir/delete/parameters/Parameter1.kt b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/commonparamsubdir/delete/parameters/Parameter1.kt deleted file mode 100644 index 13efa3b6c1d..00000000000 --- a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/commonparamsubdir/delete/parameters/Parameter1.kt +++ /dev/null @@ -1,23 +0,0 @@ -package org.openapijsonschematools.client.paths.commonparamsubdir.delete.parameters; - -import org.openapijsonschematools.client.parameter.ParameterStyle; -import org.openapijsonschematools.client.parameter.ParameterInType; -import org.openapijsonschematools.client.parameter.SchemaParameter; -import org.openapijsonschematools.client.paths.commonparamsubdir.delete.parameters.parameter1.Schema1; - -public class Parameter1 { - - public static class Parameter11 extends SchemaParameter { - public Parameter11() { - super( - "subDir", - ParameterInType.PATH, - true, - ParameterStyle.SIMPLE, - false, - false, - Schema1.Schema11.getInstance() - ); - } - } -} diff --git a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/commonparamsubdir/delete/parameters/parameter0/Schema0.kt b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/commonparamsubdir/delete/parameters/parameter0/Schema0.kt deleted file mode 100644 index a3f940b6e0e..00000000000 --- a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/commonparamsubdir/delete/parameters/parameter0/Schema0.kt +++ /dev/null @@ -1,19 +0,0 @@ -package org.openapijsonschematools.client.paths.commonparamsubdir.delete.parameters.parameter0; -import org.checkerframework.checker.nullness.qual.Nullable; -import org.openapijsonschematools.client.schemas.StringJsonSchema; - -public class Schema0 extends StringJsonSchema { - // nest classes so all schemas and input/output classes can be public - - - public static class Schema01 extends StringJsonSchema.StringJsonSchema1 { - private static @Nullable Schema01 instance = null; - public static Schema01 getInstance() { - if (instance == null) { - instance = new Schema01(); - } - return instance; - } - } - -} diff --git a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/commonparamsubdir/delete/parameters/parameter1/Schema1.kt b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/commonparamsubdir/delete/parameters/parameter1/Schema1.kt deleted file mode 100644 index 5e27e6693ae..00000000000 --- a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/commonparamsubdir/delete/parameters/parameter1/Schema1.kt +++ /dev/null @@ -1,114 +0,0 @@ -package org.openapijsonschematools.client.paths.commonparamsubdir.delete.parameters.parameter1; -import java.util.HashSet; -import java.util.LinkedHashSet; -import java.util.List; -import java.util.Objects; -import java.util.Set; -import org.checkerframework.checker.nullness.qual.Nullable; -import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags; -import org.openapijsonschematools.client.configurations.SchemaConfiguration; -import org.openapijsonschematools.client.exceptions.ValidationException; -import org.openapijsonschematools.client.schemas.SetMaker; -import org.openapijsonschematools.client.schemas.validation.JsonSchema; -import org.openapijsonschematools.client.schemas.validation.JsonSchemaInfo; -import org.openapijsonschematools.client.schemas.validation.PathToSchemasMap; -import org.openapijsonschematools.client.schemas.validation.StringEnumValidator; -import org.openapijsonschematools.client.schemas.validation.StringSchemaValidator; -import org.openapijsonschematools.client.schemas.validation.StringValueMethod; -import org.openapijsonschematools.client.schemas.validation.ValidationMetadata; - -public class Schema1 { - // nest classes so all schemas and input/output classes can be public - - public enum StringSchemaEnums1 implements StringValueMethod { - C("c"), - D("d"); - private final String value; - - StringSchemaEnums1(String value) { - this.value = value; - } - public String value() { - return this.value; - } - } - - - public sealed interface Schema11Boxed permits Schema11BoxedString { - @Nullable Object getData(); - } - - public record Schema11BoxedString(String data) implements Schema11Boxed { - @Override - public @Nullable Object getData() { - return data; - } - } - - - - public static class Schema11 extends JsonSchema implements StringSchemaValidator, StringEnumValidator { - private static @Nullable Schema11 instance = null; - - protected Schema11() { - super(new JsonSchemaInfo() - .type(Set.of( - String.class - )) - .enumValues(SetMaker.makeSet( - "c", - "d" - )) - ); - } - - public static Schema11 getInstance() { - if (instance == null) { - instance = new Schema11(); - } - return instance; - } - - @Override - public String validate(String arg, SchemaConfiguration configuration) throws ValidationException { - Set> pathSet = new HashSet<>(); - List pathToItem = List.of("args[0"); - String castArg = castToAllowedTypes(arg, pathToItem, pathSet); - SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().build())); - ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, new PathToSchemasMap(), new LinkedHashSet<>()); - getPathToSchemas(this, castArg, validationMetadata, pathSet); - return castArg; - } - - @Override - 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 { - 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"); - } - @Override - public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { - 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"); - } - @Override - 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 { - 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"); - } - } -} diff --git a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/commonparamsubdir/delete/responses/CommonparamsubdirDeleteCode200Response.kt b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/commonparamsubdir/delete/responses/CommonparamsubdirDeleteCode200Response.kt deleted file mode 100644 index ed6bcceb216..00000000000 --- a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/commonparamsubdir/delete/responses/CommonparamsubdirDeleteCode200Response.kt +++ /dev/null @@ -1,7 +0,0 @@ -package org.openapijsonschematools.client.paths.commonparamsubdir.delete.responses; - -import org.openapijsonschematools.client.components.responses.SuccessDescriptionOnly; - -public class CommonparamsubdirDeleteCode200Response extends SuccessDescriptionOnly { - public static class CommonparamsubdirDeleteCode200Response1 extends SuccessDescriptionOnly1 {} -} diff --git a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/commonparamsubdir/get/CommonparamsubdirGetPathParameters.kt b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/commonparamsubdir/get/CommonparamsubdirGetPathParameters.kt deleted file mode 100644 index caace3d1041..00000000000 --- a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/commonparamsubdir/get/CommonparamsubdirGetPathParameters.kt +++ /dev/null @@ -1,211 +0,0 @@ -package org.openapijsonschematools.client.paths.commonparamsubdir.get; -import java.util.ArrayList; -import java.util.HashSet; -import java.util.LinkedHashMap; -import java.util.LinkedHashSet; -import java.util.List; -import java.util.Map; -import java.util.Objects; -import java.util.Set; -import org.checkerframework.checker.nullness.qual.Nullable; -import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags; -import org.openapijsonschematools.client.configurations.SchemaConfiguration; -import org.openapijsonschematools.client.exceptions.UnsetPropertyException; -import org.openapijsonschematools.client.exceptions.ValidationException; -import org.openapijsonschematools.client.paths.commonparamsubdir.parameters.routeparameter0.RouteParamSchema0; -import org.openapijsonschematools.client.schemas.AnyTypeJsonSchema; -import org.openapijsonschematools.client.schemas.GenericBuilder; -import org.openapijsonschematools.client.schemas.NotAnyTypeJsonSchema; -import org.openapijsonschematools.client.schemas.validation.FrozenMap; -import org.openapijsonschematools.client.schemas.validation.JsonSchema; -import org.openapijsonschematools.client.schemas.validation.JsonSchemaInfo; -import org.openapijsonschematools.client.schemas.validation.MapSchemaValidator; -import org.openapijsonschematools.client.schemas.validation.MapUtils; -import org.openapijsonschematools.client.schemas.validation.PathToSchemasMap; -import org.openapijsonschematools.client.schemas.validation.PropertyEntry; -import org.openapijsonschematools.client.schemas.validation.ValidationMetadata; - -public class CommonparamsubdirGetPathParameters { - // nest classes so all schemas and input/output classes can be public - - - public static class AdditionalProperties extends NotAnyTypeJsonSchema.NotAnyTypeJsonSchema1 { - // NotAnyTypeSchema - private static @Nullable AdditionalProperties instance = null; - public static AdditionalProperties getInstance() { - if (instance == null) { - instance = new AdditionalProperties(); - } - return instance; - } - } - - - public static class PathParametersMap extends FrozenMap { - protected PathParametersMap(FrozenMap m) { - super(m); - } - public static final Set requiredKeys = Set.of( - "subDir" - ); - public static final Set optionalKeys = Set.of(); - public static PathParametersMap of(Map arg, SchemaConfiguration configuration) throws ValidationException { - return CommonparamsubdirGetPathParameters1.getInstance().validate(arg, configuration); - } - - public String subDir() { - try { - return getOrThrow("version"); - } catch (UnsetPropertyException e) { - throw new RuntimeException(e); - } - } - } - - public interface SetterForSubDir { - Map getInstance(); - T getBuilderAfterSubDir(Map instance); - - default T subDir(String value) { - var instance = getInstance(); - instance.put("subDir", value); - return getBuilderAfterSubDir(instance); - } - - default T subDir(RouteParamSchema0.StringRouteParamSchemaEnums0 value) { - var instance = getInstance(); - instance.put("subDir", value.value()); - return getBuilderAfterSubDir(instance); - } - } - - public static class PathParametersMap0Builder implements GenericBuilder> { - private final Map instance; - private static final Set knownKeys = Set.of( - "subDir" - ); - public Set getKnownKeys() { - return knownKeys; - } - public PathParametersMap0Builder(Map instance) { - this.instance = instance; - } - public Map build() { - return instance; - } - } - - public static class PathParametersMapBuilder implements SetterForSubDir { - private final Map instance; - public PathParametersMapBuilder() { - this.instance = new LinkedHashMap<>(); - } - public Map getInstance() { - return instance; - } - public PathParametersMap0Builder getBuilderAfterSubDir(Map instance) { - return new PathParametersMap0Builder(instance); - } - } - - - public sealed interface CommonparamsubdirGetPathParameters1Boxed permits CommonparamsubdirGetPathParameters1BoxedMap { - @Nullable Object getData(); - } - - public record CommonparamsubdirGetPathParameters1BoxedMap(PathParametersMap data) implements CommonparamsubdirGetPathParameters1Boxed { - @Override - public @Nullable Object getData() { - return data; - } - } - - - public static class CommonparamsubdirGetPathParameters1 extends JsonSchema implements MapSchemaValidator { - private static @Nullable CommonparamsubdirGetPathParameters1 instance = null; - - protected CommonparamsubdirGetPathParameters1() { - super(new JsonSchemaInfo() - .type(Set.of(Map.class)) - .properties(Map.ofEntries( - new PropertyEntry("subDir", RouteParamSchema0.RouteParamSchema01.class) - )) - .required(Set.of( - "subDir" - )) - .additionalProperties(AdditionalProperties.class) - ); - } - - public static CommonparamsubdirGetPathParameters1 getInstance() { - if (instance == null) { - instance = new CommonparamsubdirGetPathParameters1(); - } - return instance; - } - - 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 RuntimeException("Invalid non-string key value"); - } - String propertyName = (String) entryKey; - List propertyPathToItem = new ArrayList<>(pathToItem); - propertyPathToItem.add(propertyName); - Object value = entry.getValue(); - LinkedHashMap, Nothing?> schemas = pathToSchemas.get(propertyPathToItem); - if (schemas == null) { - throw new RuntimeException("Validation 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"); - } - properties.put(propertyName, (String) propertyInstance); - } - FrozenMap castProperties = new FrozenMap<>(properties); - return new PathParametersMap(castProperties); - } - - 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); - SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().build())); - ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, new PathToSchemasMap(), new LinkedHashSet<>()); - PathToSchemasMap pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet); - return getNewInstance(castArg, validationMetadata.pathToItem(), pathToSchemasMap); - } - - - @Override - public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws 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"); - } - @Override - public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { - if (arg instanceof Map) { - return getNewInstance((Map) arg, pathToItem, pathToSchemas); - } - throw new RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); - } - @Override - public CommonparamsubdirGetPathParameters1BoxedMap validateAndBox(Map arg, SchemaConfiguration configuration) throws ValidationException { - return new CommonparamsubdirGetPathParameters1BoxedMap(validate(arg, configuration)); - } - @Override - public CommonparamsubdirGetPathParameters1Boxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { - 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"); - } - } - -} diff --git a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/commonparamsubdir/get/CommonparamsubdirGetQueryParameters.kt b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/commonparamsubdir/get/CommonparamsubdirGetQueryParameters.kt deleted file mode 100644 index 194dbc8ba22..00000000000 --- a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/commonparamsubdir/get/CommonparamsubdirGetQueryParameters.kt +++ /dev/null @@ -1,191 +0,0 @@ -package org.openapijsonschematools.client.paths.commonparamsubdir.get; -import java.util.ArrayList; -import java.util.HashSet; -import java.util.LinkedHashMap; -import java.util.LinkedHashSet; -import java.util.List; -import java.util.Map; -import java.util.Objects; -import java.util.Set; -import org.checkerframework.checker.nullness.qual.Nullable; -import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags; -import org.openapijsonschematools.client.configurations.SchemaConfiguration; -import org.openapijsonschematools.client.exceptions.UnsetPropertyException; -import org.openapijsonschematools.client.exceptions.ValidationException; -import org.openapijsonschematools.client.paths.commonparamsubdir.get.parameters.parameter0.Schema0; -import org.openapijsonschematools.client.schemas.AnyTypeJsonSchema; -import org.openapijsonschematools.client.schemas.GenericBuilder; -import org.openapijsonschematools.client.schemas.NotAnyTypeJsonSchema; -import org.openapijsonschematools.client.schemas.validation.FrozenMap; -import org.openapijsonschematools.client.schemas.validation.JsonSchema; -import org.openapijsonschematools.client.schemas.validation.JsonSchemaInfo; -import org.openapijsonschematools.client.schemas.validation.MapSchemaValidator; -import org.openapijsonschematools.client.schemas.validation.MapUtils; -import org.openapijsonschematools.client.schemas.validation.PathToSchemasMap; -import org.openapijsonschematools.client.schemas.validation.PropertyEntry; -import org.openapijsonschematools.client.schemas.validation.ValidationMetadata; - -public class CommonparamsubdirGetQueryParameters { - // nest classes so all schemas and input/output classes can be public - - - public static class AdditionalProperties extends NotAnyTypeJsonSchema.NotAnyTypeJsonSchema1 { - // NotAnyTypeSchema - private static @Nullable AdditionalProperties instance = null; - public static AdditionalProperties getInstance() { - if (instance == null) { - instance = new AdditionalProperties(); - } - return instance; - } - } - - - public static class QueryParametersMap extends FrozenMap { - protected QueryParametersMap(FrozenMap m) { - super(m); - } - public static final Set requiredKeys = Set.of(); - public static final Set optionalKeys = Set.of( - "searchStr" - ); - public static QueryParametersMap of(Map arg, SchemaConfiguration configuration) throws ValidationException { - return CommonparamsubdirGetQueryParameters1.getInstance().validate(arg, configuration); - } - - public String searchStr() throws UnsetPropertyException { - return getOrThrow("searchStr"); - } - } - - public interface SetterForSearchStr { - Map getInstance(); - T getBuilderAfterSearchStr(Map instance); - - default T searchStr(String value) { - var instance = getInstance(); - instance.put("searchStr", value); - return getBuilderAfterSearchStr(instance); - } - } - - public static class QueryParametersMapBuilder implements GenericBuilder>, SetterForSearchStr { - private final Map instance; - private static final Set knownKeys = Set.of( - "searchStr" - ); - public Set getKnownKeys() { - return knownKeys; - } - public QueryParametersMapBuilder() { - this.instance = new LinkedHashMap<>(); - } - public Map build() { - return instance; - } - public Map getInstance() { - return instance; - } - public QueryParametersMapBuilder getBuilderAfterSearchStr(Map instance) { - return this; - } - } - - - public sealed interface CommonparamsubdirGetQueryParameters1Boxed permits CommonparamsubdirGetQueryParameters1BoxedMap { - @Nullable Object getData(); - } - - public record CommonparamsubdirGetQueryParameters1BoxedMap(QueryParametersMap data) implements CommonparamsubdirGetQueryParameters1Boxed { - @Override - public @Nullable Object getData() { - return data; - } - } - - - public static class CommonparamsubdirGetQueryParameters1 extends JsonSchema implements MapSchemaValidator { - private static @Nullable CommonparamsubdirGetQueryParameters1 instance = null; - - protected CommonparamsubdirGetQueryParameters1() { - super(new JsonSchemaInfo() - .type(Set.of(Map.class)) - .properties(Map.ofEntries( - new PropertyEntry("searchStr", Schema0.Schema01.class) - )) - .additionalProperties(AdditionalProperties.class) - ); - } - - public static CommonparamsubdirGetQueryParameters1 getInstance() { - if (instance == null) { - instance = new CommonparamsubdirGetQueryParameters1(); - } - return instance; - } - - 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 RuntimeException("Invalid non-string key value"); - } - String propertyName = (String) entryKey; - List propertyPathToItem = new ArrayList<>(pathToItem); - propertyPathToItem.add(propertyName); - Object value = entry.getValue(); - LinkedHashMap, Nothing?> schemas = pathToSchemas.get(propertyPathToItem); - if (schemas == null) { - throw new RuntimeException("Validation 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"); - } - properties.put(propertyName, (String) propertyInstance); - } - FrozenMap castProperties = new FrozenMap<>(properties); - return new QueryParametersMap(castProperties); - } - - 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); - SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().build())); - ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, new PathToSchemasMap(), new LinkedHashSet<>()); - PathToSchemasMap pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet); - return getNewInstance(castArg, validationMetadata.pathToItem(), pathToSchemasMap); - } - - - @Override - public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws 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"); - } - @Override - public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { - if (arg instanceof Map) { - return getNewInstance((Map) arg, pathToItem, pathToSchemas); - } - throw new RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); - } - @Override - public CommonparamsubdirGetQueryParameters1BoxedMap validateAndBox(Map arg, SchemaConfiguration configuration) throws ValidationException { - return new CommonparamsubdirGetQueryParameters1BoxedMap(validate(arg, configuration)); - } - @Override - public CommonparamsubdirGetQueryParameters1Boxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { - 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"); - } - } - -} diff --git a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/commonparamsubdir/get/CommonparamsubdirGetResponses.kt b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/commonparamsubdir/get/CommonparamsubdirGetResponses.kt deleted file mode 100644 index 32e81e43751..00000000000 --- a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/commonparamsubdir/get/CommonparamsubdirGetResponses.kt +++ /dev/null @@ -1,53 +0,0 @@ -package org.openapijsonschematools.client.paths.commonparamsubdir.get; - -import org.openapijsonschematools.client.paths.commonparamsubdir.get.responses.CommonparamsubdirGetCode200Response; -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; -import org.checkerframework.checker.nullness.qual.Nullable; - -import java.net.http.HttpResponse; -import java.util.Map; -import java.util.AbstractMap; - -public class CommonparamsubdirGetResponses { - public sealed interface EndpointResponse permits EndpointCommonparamsubdirGetCode200Response {} - - public record EndpointCommonparamsubdirGetCode200Response( - HttpResponse response, - Nothing? body, - Nothing? headers - ) implements EndpointResponse, ApiResponse{ - } - - public sealed interface StatusCodeResponseDeserializer permits StatusCommonparamsubdirGetCode200ResponseDeserializer {} - - public static final class StatusCommonparamsubdirGetCode200ResponseDeserializer extends CommonparamsubdirGetCode200Response.CommonparamsubdirGetCode200Response1 implements StatusCodeResponseDeserializer { - } - - public static final class CommonparamsubdirGetResponses1 implements ResponsesDeserializer { - private final Map statusCodeToResponseDeserializer; - public CommonparamsubdirGetResponses1() { - this.statusCodeToResponseDeserializer = Map.ofEntries( - new AbstractMap.SimpleEntry<>("200", new StatusCommonparamsubdirGetCode200ResponseDeserializer()) - ); - } - - 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) { - throw new ApiException( - "Invalid response statusCode="+statusCode+" has no response defined in the openapi document", - response - ); - } - StatusCommonparamsubdirGetCode200ResponseDeserializer castDeserializer = (StatusCommonparamsubdirGetCode200ResponseDeserializer) statusCodeDeserializer; - var deserializedResponse = castDeserializer.deserialize(response, configuration); - return new EndpointCommonparamsubdirGetCode200Response(response, deserializedResponse.body(), deserializedResponse.headers()); - } - } -} diff --git a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/commonparamsubdir/get/Parameters.kt b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/commonparamsubdir/get/Parameters.kt deleted file mode 100644 index a06b3e8445a..00000000000 --- a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/commonparamsubdir/get/Parameters.kt +++ /dev/null @@ -1,32 +0,0 @@ -package org.openapijsonschematools.client.paths.commonparamsubdir.get; - -import org.openapijsonschematools.client.paths.commonparamsubdir.parameters.RouteParameter0; -import org.openapijsonschematools.client.paths.commonparamsubdir.get.parameters.Parameter0; -import org.openapijsonschematools.client.parameter.PathSerializer; -import org.openapijsonschematools.client.parameter.QuerySerializer; - -import java.util.Map; -import java.util.AbstractMap; - -public class Parameters { - - public static class PathParametersSerializer extends PathSerializer { - public PathParametersSerializer() { - super( - Map.ofEntries( - new AbstractMap.SimpleEntry<>("subDir", new RouteParameter0.RouteParameter01()) - ) - ); - } - } - - public static class QueryParametersSerializer extends QuerySerializer { - public QueryParametersSerializer() { - super( - Map.ofEntries( - new AbstractMap.SimpleEntry<>("searchStr", new Parameter0.Parameter01()) - ) - ); - } - } -} diff --git a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/commonparamsubdir/get/parameters/Parameter0.kt b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/commonparamsubdir/get/parameters/Parameter0.kt deleted file mode 100644 index 0559a9deb6e..00000000000 --- a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/commonparamsubdir/get/parameters/Parameter0.kt +++ /dev/null @@ -1,23 +0,0 @@ -package org.openapijsonschematools.client.paths.commonparamsubdir.get.parameters; - -import org.openapijsonschematools.client.parameter.ParameterStyle; -import org.openapijsonschematools.client.parameter.ParameterInType; -import org.openapijsonschematools.client.parameter.SchemaParameter; -import org.openapijsonschematools.client.paths.commonparamsubdir.get.parameters.parameter0.Schema0; - -public class Parameter0 { - - public static class Parameter01 extends SchemaParameter { - public Parameter01() { - super( - "searchStr", - ParameterInType.QUERY, - false, - ParameterStyle.FORM, - true, - false, - Schema0.Schema01.getInstance() - ); - } - } -} diff --git a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/commonparamsubdir/get/parameters/parameter0/Schema0.kt b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/commonparamsubdir/get/parameters/parameter0/Schema0.kt deleted file mode 100644 index cd9df3f6b63..00000000000 --- a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/commonparamsubdir/get/parameters/parameter0/Schema0.kt +++ /dev/null @@ -1,19 +0,0 @@ -package org.openapijsonschematools.client.paths.commonparamsubdir.get.parameters.parameter0; -import org.checkerframework.checker.nullness.qual.Nullable; -import org.openapijsonschematools.client.schemas.StringJsonSchema; - -public class Schema0 extends StringJsonSchema { - // nest classes so all schemas and input/output classes can be public - - - public static class Schema01 extends StringJsonSchema.StringJsonSchema1 { - private static @Nullable Schema01 instance = null; - public static Schema01 getInstance() { - if (instance == null) { - instance = new Schema01(); - } - return instance; - } - } - -} diff --git a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/commonparamsubdir/get/responses/CommonparamsubdirGetCode200Response.kt b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/commonparamsubdir/get/responses/CommonparamsubdirGetCode200Response.kt deleted file mode 100644 index 87e8201489f..00000000000 --- a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/commonparamsubdir/get/responses/CommonparamsubdirGetCode200Response.kt +++ /dev/null @@ -1,7 +0,0 @@ -package org.openapijsonschematools.client.paths.commonparamsubdir.get.responses; - -import org.openapijsonschematools.client.components.responses.SuccessDescriptionOnly; - -public class CommonparamsubdirGetCode200Response extends SuccessDescriptionOnly { - public static class CommonparamsubdirGetCode200Response1 extends SuccessDescriptionOnly1 {} -} diff --git a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/commonparamsubdir/parameters/RouteParameter0.kt b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/commonparamsubdir/parameters/RouteParameter0.kt deleted file mode 100644 index ad645a82164..00000000000 --- a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/commonparamsubdir/parameters/RouteParameter0.kt +++ /dev/null @@ -1,23 +0,0 @@ -package org.openapijsonschematools.client.paths.commonparamsubdir.parameters; - -import org.openapijsonschematools.client.parameter.ParameterStyle; -import org.openapijsonschematools.client.parameter.ParameterInType; -import org.openapijsonschematools.client.parameter.SchemaParameter; -import org.openapijsonschematools.client.paths.commonparamsubdir.parameters.routeparameter0.RouteParamSchema0; - -public class RouteParameter0 { - - public static class RouteParameter01 extends SchemaParameter { - public RouteParameter01() { - super( - "subDir", - ParameterInType.PATH, - true, - ParameterStyle.SIMPLE, - false, - false, - RouteParamSchema0.RouteParamSchema01.getInstance() - ); - } - } -} diff --git a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/commonparamsubdir/parameters/routeparameter0/RouteParamSchema0.kt b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/commonparamsubdir/parameters/routeparameter0/RouteParamSchema0.kt deleted file mode 100644 index bd8854610b9..00000000000 --- a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/commonparamsubdir/parameters/routeparameter0/RouteParamSchema0.kt +++ /dev/null @@ -1,114 +0,0 @@ -package org.openapijsonschematools.client.paths.commonparamsubdir.parameters.routeparameter0; -import java.util.HashSet; -import java.util.LinkedHashSet; -import java.util.List; -import java.util.Objects; -import java.util.Set; -import org.checkerframework.checker.nullness.qual.Nullable; -import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags; -import org.openapijsonschematools.client.configurations.SchemaConfiguration; -import org.openapijsonschematools.client.exceptions.ValidationException; -import org.openapijsonschematools.client.schemas.SetMaker; -import org.openapijsonschematools.client.schemas.validation.JsonSchema; -import org.openapijsonschematools.client.schemas.validation.JsonSchemaInfo; -import org.openapijsonschematools.client.schemas.validation.PathToSchemasMap; -import org.openapijsonschematools.client.schemas.validation.StringEnumValidator; -import org.openapijsonschematools.client.schemas.validation.StringSchemaValidator; -import org.openapijsonschematools.client.schemas.validation.StringValueMethod; -import org.openapijsonschematools.client.schemas.validation.ValidationMetadata; - -public class RouteParamSchema0 { - // nest classes so all schemas and input/output classes can be public - - public enum StringRouteParamSchemaEnums0 implements StringValueMethod { - A("a"), - B("b"); - private final String value; - - StringRouteParamSchemaEnums0(String value) { - this.value = value; - } - public String value() { - return this.value; - } - } - - - public sealed interface RouteParamSchema01Boxed permits RouteParamSchema01BoxedString { - @Nullable Object getData(); - } - - public record RouteParamSchema01BoxedString(String data) implements RouteParamSchema01Boxed { - @Override - public @Nullable Object getData() { - return data; - } - } - - - - public static class RouteParamSchema01 extends JsonSchema implements StringSchemaValidator, StringEnumValidator { - private static @Nullable RouteParamSchema01 instance = null; - - protected RouteParamSchema01() { - super(new JsonSchemaInfo() - .type(Set.of( - String.class - )) - .enumValues(SetMaker.makeSet( - "a", - "b" - )) - ); - } - - public static RouteParamSchema01 getInstance() { - if (instance == null) { - instance = new RouteParamSchema01(); - } - return instance; - } - - @Override - public String validate(String arg, SchemaConfiguration configuration) throws ValidationException { - Set> pathSet = new HashSet<>(); - List pathToItem = List.of("args[0"); - String castArg = castToAllowedTypes(arg, pathToItem, pathSet); - SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().build())); - ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, new PathToSchemasMap(), new LinkedHashSet<>()); - getPathToSchemas(this, castArg, validationMetadata, pathSet); - return castArg; - } - - @Override - 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 { - 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"); - } - @Override - public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { - 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"); - } - @Override - 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 { - 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"); - } - } -} diff --git a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/commonparamsubdir/post/CommonparamsubdirPostHeaderParameters.kt b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/commonparamsubdir/post/CommonparamsubdirPostHeaderParameters.kt deleted file mode 100644 index 548f0e42828..00000000000 --- a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/commonparamsubdir/post/CommonparamsubdirPostHeaderParameters.kt +++ /dev/null @@ -1,191 +0,0 @@ -package org.openapijsonschematools.client.paths.commonparamsubdir.post; -import java.util.ArrayList; -import java.util.HashSet; -import java.util.LinkedHashMap; -import java.util.LinkedHashSet; -import java.util.List; -import java.util.Map; -import java.util.Objects; -import java.util.Set; -import org.checkerframework.checker.nullness.qual.Nullable; -import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags; -import org.openapijsonschematools.client.configurations.SchemaConfiguration; -import org.openapijsonschematools.client.exceptions.UnsetPropertyException; -import org.openapijsonschematools.client.exceptions.ValidationException; -import org.openapijsonschematools.client.paths.commonparamsubdir.post.parameters.parameter0.Schema0; -import org.openapijsonschematools.client.schemas.AnyTypeJsonSchema; -import org.openapijsonschematools.client.schemas.GenericBuilder; -import org.openapijsonschematools.client.schemas.NotAnyTypeJsonSchema; -import org.openapijsonschematools.client.schemas.validation.FrozenMap; -import org.openapijsonschematools.client.schemas.validation.JsonSchema; -import org.openapijsonschematools.client.schemas.validation.JsonSchemaInfo; -import org.openapijsonschematools.client.schemas.validation.MapSchemaValidator; -import org.openapijsonschematools.client.schemas.validation.MapUtils; -import org.openapijsonschematools.client.schemas.validation.PathToSchemasMap; -import org.openapijsonschematools.client.schemas.validation.PropertyEntry; -import org.openapijsonschematools.client.schemas.validation.ValidationMetadata; - -public class CommonparamsubdirPostHeaderParameters { - // nest classes so all schemas and input/output classes can be public - - - public static class AdditionalProperties extends NotAnyTypeJsonSchema.NotAnyTypeJsonSchema1 { - // NotAnyTypeSchema - private static @Nullable AdditionalProperties instance = null; - public static AdditionalProperties getInstance() { - if (instance == null) { - instance = new AdditionalProperties(); - } - return instance; - } - } - - - public static class HeaderParametersMap extends FrozenMap { - protected HeaderParametersMap(FrozenMap m) { - super(m); - } - public static final Set requiredKeys = Set.of(); - public static final Set optionalKeys = Set.of( - "someHeader" - ); - public static HeaderParametersMap of(Map arg, SchemaConfiguration configuration) throws ValidationException { - return CommonparamsubdirPostHeaderParameters1.getInstance().validate(arg, configuration); - } - - public String someHeader() throws UnsetPropertyException { - return getOrThrow("someHeader"); - } - } - - public interface SetterForSomeHeader { - Map getInstance(); - T getBuilderAfterSomeHeader(Map instance); - - default T someHeader(String value) { - var instance = getInstance(); - instance.put("someHeader", value); - return getBuilderAfterSomeHeader(instance); - } - } - - public static class HeaderParametersMapBuilder implements GenericBuilder>, SetterForSomeHeader { - private final Map instance; - private static final Set knownKeys = Set.of( - "someHeader" - ); - public Set getKnownKeys() { - return knownKeys; - } - public HeaderParametersMapBuilder() { - this.instance = new LinkedHashMap<>(); - } - public Map build() { - return instance; - } - public Map getInstance() { - return instance; - } - public HeaderParametersMapBuilder getBuilderAfterSomeHeader(Map instance) { - return this; - } - } - - - public sealed interface CommonparamsubdirPostHeaderParameters1Boxed permits CommonparamsubdirPostHeaderParameters1BoxedMap { - @Nullable Object getData(); - } - - public record CommonparamsubdirPostHeaderParameters1BoxedMap(HeaderParametersMap data) implements CommonparamsubdirPostHeaderParameters1Boxed { - @Override - public @Nullable Object getData() { - return data; - } - } - - - public static class CommonparamsubdirPostHeaderParameters1 extends JsonSchema implements MapSchemaValidator { - private static @Nullable CommonparamsubdirPostHeaderParameters1 instance = null; - - protected CommonparamsubdirPostHeaderParameters1() { - super(new JsonSchemaInfo() - .type(Set.of(Map.class)) - .properties(Map.ofEntries( - new PropertyEntry("someHeader", Schema0.Schema01.class) - )) - .additionalProperties(AdditionalProperties.class) - ); - } - - public static CommonparamsubdirPostHeaderParameters1 getInstance() { - if (instance == null) { - instance = new CommonparamsubdirPostHeaderParameters1(); - } - return instance; - } - - 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 RuntimeException("Invalid non-string key value"); - } - String propertyName = (String) entryKey; - List propertyPathToItem = new ArrayList<>(pathToItem); - propertyPathToItem.add(propertyName); - Object value = entry.getValue(); - LinkedHashMap, Nothing?> schemas = pathToSchemas.get(propertyPathToItem); - if (schemas == null) { - throw new RuntimeException("Validation 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"); - } - properties.put(propertyName, (String) propertyInstance); - } - FrozenMap castProperties = new FrozenMap<>(properties); - return new HeaderParametersMap(castProperties); - } - - 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); - SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().build())); - ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, new PathToSchemasMap(), new LinkedHashSet<>()); - PathToSchemasMap pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet); - return getNewInstance(castArg, validationMetadata.pathToItem(), pathToSchemasMap); - } - - - @Override - public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws 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"); - } - @Override - public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { - if (arg instanceof Map) { - return getNewInstance((Map) arg, pathToItem, pathToSchemas); - } - throw new RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); - } - @Override - public CommonparamsubdirPostHeaderParameters1BoxedMap validateAndBox(Map arg, SchemaConfiguration configuration) throws ValidationException { - return new CommonparamsubdirPostHeaderParameters1BoxedMap(validate(arg, configuration)); - } - @Override - public CommonparamsubdirPostHeaderParameters1Boxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { - 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"); - } - } - -} diff --git a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/commonparamsubdir/post/CommonparamsubdirPostPathParameters.kt b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/commonparamsubdir/post/CommonparamsubdirPostPathParameters.kt deleted file mode 100644 index ad75166f4bb..00000000000 --- a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/commonparamsubdir/post/CommonparamsubdirPostPathParameters.kt +++ /dev/null @@ -1,211 +0,0 @@ -package org.openapijsonschematools.client.paths.commonparamsubdir.post; -import java.util.ArrayList; -import java.util.HashSet; -import java.util.LinkedHashMap; -import java.util.LinkedHashSet; -import java.util.List; -import java.util.Map; -import java.util.Objects; -import java.util.Set; -import org.checkerframework.checker.nullness.qual.Nullable; -import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags; -import org.openapijsonschematools.client.configurations.SchemaConfiguration; -import org.openapijsonschematools.client.exceptions.UnsetPropertyException; -import org.openapijsonschematools.client.exceptions.ValidationException; -import org.openapijsonschematools.client.paths.commonparamsubdir.parameters.routeparameter0.RouteParamSchema0; -import org.openapijsonschematools.client.schemas.AnyTypeJsonSchema; -import org.openapijsonschematools.client.schemas.GenericBuilder; -import org.openapijsonschematools.client.schemas.NotAnyTypeJsonSchema; -import org.openapijsonschematools.client.schemas.validation.FrozenMap; -import org.openapijsonschematools.client.schemas.validation.JsonSchema; -import org.openapijsonschematools.client.schemas.validation.JsonSchemaInfo; -import org.openapijsonschematools.client.schemas.validation.MapSchemaValidator; -import org.openapijsonschematools.client.schemas.validation.MapUtils; -import org.openapijsonschematools.client.schemas.validation.PathToSchemasMap; -import org.openapijsonschematools.client.schemas.validation.PropertyEntry; -import org.openapijsonschematools.client.schemas.validation.ValidationMetadata; - -public class CommonparamsubdirPostPathParameters { - // nest classes so all schemas and input/output classes can be public - - - public static class AdditionalProperties extends NotAnyTypeJsonSchema.NotAnyTypeJsonSchema1 { - // NotAnyTypeSchema - private static @Nullable AdditionalProperties instance = null; - public static AdditionalProperties getInstance() { - if (instance == null) { - instance = new AdditionalProperties(); - } - return instance; - } - } - - - public static class PathParametersMap extends FrozenMap { - protected PathParametersMap(FrozenMap m) { - super(m); - } - public static final Set requiredKeys = Set.of( - "subDir" - ); - public static final Set optionalKeys = Set.of(); - public static PathParametersMap of(Map arg, SchemaConfiguration configuration) throws ValidationException { - return CommonparamsubdirPostPathParameters1.getInstance().validate(arg, configuration); - } - - public String subDir() { - try { - return getOrThrow("version"); - } catch (UnsetPropertyException e) { - throw new RuntimeException(e); - } - } - } - - public interface SetterForSubDir { - Map getInstance(); - T getBuilderAfterSubDir(Map instance); - - default T subDir(String value) { - var instance = getInstance(); - instance.put("subDir", value); - return getBuilderAfterSubDir(instance); - } - - default T subDir(RouteParamSchema0.StringRouteParamSchemaEnums0 value) { - var instance = getInstance(); - instance.put("subDir", value.value()); - return getBuilderAfterSubDir(instance); - } - } - - public static class PathParametersMap0Builder implements GenericBuilder> { - private final Map instance; - private static final Set knownKeys = Set.of( - "subDir" - ); - public Set getKnownKeys() { - return knownKeys; - } - public PathParametersMap0Builder(Map instance) { - this.instance = instance; - } - public Map build() { - return instance; - } - } - - public static class PathParametersMapBuilder implements SetterForSubDir { - private final Map instance; - public PathParametersMapBuilder() { - this.instance = new LinkedHashMap<>(); - } - public Map getInstance() { - return instance; - } - public PathParametersMap0Builder getBuilderAfterSubDir(Map instance) { - return new PathParametersMap0Builder(instance); - } - } - - - public sealed interface CommonparamsubdirPostPathParameters1Boxed permits CommonparamsubdirPostPathParameters1BoxedMap { - @Nullable Object getData(); - } - - public record CommonparamsubdirPostPathParameters1BoxedMap(PathParametersMap data) implements CommonparamsubdirPostPathParameters1Boxed { - @Override - public @Nullable Object getData() { - return data; - } - } - - - public static class CommonparamsubdirPostPathParameters1 extends JsonSchema implements MapSchemaValidator { - private static @Nullable CommonparamsubdirPostPathParameters1 instance = null; - - protected CommonparamsubdirPostPathParameters1() { - super(new JsonSchemaInfo() - .type(Set.of(Map.class)) - .properties(Map.ofEntries( - new PropertyEntry("subDir", RouteParamSchema0.RouteParamSchema01.class) - )) - .required(Set.of( - "subDir" - )) - .additionalProperties(AdditionalProperties.class) - ); - } - - public static CommonparamsubdirPostPathParameters1 getInstance() { - if (instance == null) { - instance = new CommonparamsubdirPostPathParameters1(); - } - return instance; - } - - 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 RuntimeException("Invalid non-string key value"); - } - String propertyName = (String) entryKey; - List propertyPathToItem = new ArrayList<>(pathToItem); - propertyPathToItem.add(propertyName); - Object value = entry.getValue(); - LinkedHashMap, Nothing?> schemas = pathToSchemas.get(propertyPathToItem); - if (schemas == null) { - throw new RuntimeException("Validation 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"); - } - properties.put(propertyName, (String) propertyInstance); - } - FrozenMap castProperties = new FrozenMap<>(properties); - return new PathParametersMap(castProperties); - } - - 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); - SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().build())); - ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, new PathToSchemasMap(), new LinkedHashSet<>()); - PathToSchemasMap pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet); - return getNewInstance(castArg, validationMetadata.pathToItem(), pathToSchemasMap); - } - - - @Override - public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws 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"); - } - @Override - public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { - if (arg instanceof Map) { - return getNewInstance((Map) arg, pathToItem, pathToSchemas); - } - throw new RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); - } - @Override - public CommonparamsubdirPostPathParameters1BoxedMap validateAndBox(Map arg, SchemaConfiguration configuration) throws ValidationException { - return new CommonparamsubdirPostPathParameters1BoxedMap(validate(arg, configuration)); - } - @Override - public CommonparamsubdirPostPathParameters1Boxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { - 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"); - } - } - -} diff --git a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/commonparamsubdir/post/CommonparamsubdirPostResponses.kt b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/commonparamsubdir/post/CommonparamsubdirPostResponses.kt deleted file mode 100644 index 428cbc9949b..00000000000 --- a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/commonparamsubdir/post/CommonparamsubdirPostResponses.kt +++ /dev/null @@ -1,53 +0,0 @@ -package org.openapijsonschematools.client.paths.commonparamsubdir.post; - -import org.openapijsonschematools.client.paths.commonparamsubdir.post.responses.CommonparamsubdirPostCode200Response; -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; -import org.checkerframework.checker.nullness.qual.Nullable; - -import java.net.http.HttpResponse; -import java.util.Map; -import java.util.AbstractMap; - -public class CommonparamsubdirPostResponses { - public sealed interface EndpointResponse permits EndpointCommonparamsubdirPostCode200Response {} - - public record EndpointCommonparamsubdirPostCode200Response( - HttpResponse response, - Nothing? body, - Nothing? headers - ) implements EndpointResponse, ApiResponse{ - } - - public sealed interface StatusCodeResponseDeserializer permits StatusCommonparamsubdirPostCode200ResponseDeserializer {} - - public static final class StatusCommonparamsubdirPostCode200ResponseDeserializer extends CommonparamsubdirPostCode200Response.CommonparamsubdirPostCode200Response1 implements StatusCodeResponseDeserializer { - } - - public static final class CommonparamsubdirPostResponses1 implements ResponsesDeserializer { - private final Map statusCodeToResponseDeserializer; - public CommonparamsubdirPostResponses1() { - this.statusCodeToResponseDeserializer = Map.ofEntries( - new AbstractMap.SimpleEntry<>("200", new StatusCommonparamsubdirPostCode200ResponseDeserializer()) - ); - } - - 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) { - throw new ApiException( - "Invalid response statusCode="+statusCode+" has no response defined in the openapi document", - response - ); - } - StatusCommonparamsubdirPostCode200ResponseDeserializer castDeserializer = (StatusCommonparamsubdirPostCode200ResponseDeserializer) statusCodeDeserializer; - var deserializedResponse = castDeserializer.deserialize(response, configuration); - return new EndpointCommonparamsubdirPostCode200Response(response, deserializedResponse.body(), deserializedResponse.headers()); - } - } -} diff --git a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/commonparamsubdir/post/Parameters.kt b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/commonparamsubdir/post/Parameters.kt deleted file mode 100644 index 22e2acd3b26..00000000000 --- a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/commonparamsubdir/post/Parameters.kt +++ /dev/null @@ -1,32 +0,0 @@ -package org.openapijsonschematools.client.paths.commonparamsubdir.post; - -import org.openapijsonschematools.client.paths.commonparamsubdir.parameters.RouteParameter0; -import org.openapijsonschematools.client.paths.commonparamsubdir.post.parameters.Parameter0; -import org.openapijsonschematools.client.parameter.PathSerializer; -import org.openapijsonschematools.client.parameter.HeadersSerializer; - -import java.util.Map; -import java.util.AbstractMap; - -public class Parameters { - - public static class PathParametersSerializer extends PathSerializer { - public PathParametersSerializer() { - super( - Map.ofEntries( - new AbstractMap.SimpleEntry<>("subDir", new RouteParameter0.RouteParameter01()) - ) - ); - } - } - - public static class HeaderParametersSerializer extends HeadersSerializer { - public HeaderParametersSerializer() { - super( - Map.ofEntries( - new AbstractMap.SimpleEntry<>("someHeader", new Parameter0.Parameter01()) - ) - ); - } - } -} diff --git a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/commonparamsubdir/post/parameters/Parameter0.kt b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/commonparamsubdir/post/parameters/Parameter0.kt deleted file mode 100644 index 48a0d5b37bb..00000000000 --- a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/commonparamsubdir/post/parameters/Parameter0.kt +++ /dev/null @@ -1,23 +0,0 @@ -package org.openapijsonschematools.client.paths.commonparamsubdir.post.parameters; - -import org.openapijsonschematools.client.parameter.ParameterStyle; -import org.openapijsonschematools.client.parameter.ParameterInType; -import org.openapijsonschematools.client.parameter.SchemaParameter; -import org.openapijsonschematools.client.paths.commonparamsubdir.post.parameters.parameter0.Schema0; - -public class Parameter0 { - - public static class Parameter01 extends SchemaParameter { - public Parameter01() { - super( - "someHeader", - ParameterInType.HEADER, - false, - ParameterStyle.SIMPLE, - false, - false, - Schema0.Schema01.getInstance() - ); - } - } -} diff --git a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/commonparamsubdir/post/parameters/parameter0/Schema0.kt b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/commonparamsubdir/post/parameters/parameter0/Schema0.kt deleted file mode 100644 index ff8948ab37f..00000000000 --- a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/commonparamsubdir/post/parameters/parameter0/Schema0.kt +++ /dev/null @@ -1,19 +0,0 @@ -package org.openapijsonschematools.client.paths.commonparamsubdir.post.parameters.parameter0; -import org.checkerframework.checker.nullness.qual.Nullable; -import org.openapijsonschematools.client.schemas.StringJsonSchema; - -public class Schema0 extends StringJsonSchema { - // nest classes so all schemas and input/output classes can be public - - - public static class Schema01 extends StringJsonSchema.StringJsonSchema1 { - private static @Nullable Schema01 instance = null; - public static Schema01 getInstance() { - if (instance == null) { - instance = new Schema01(); - } - return instance; - } - } - -} diff --git a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/commonparamsubdir/post/responses/CommonparamsubdirPostCode200Response.kt b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/commonparamsubdir/post/responses/CommonparamsubdirPostCode200Response.kt deleted file mode 100644 index 85eac21263a..00000000000 --- a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/commonparamsubdir/post/responses/CommonparamsubdirPostCode200Response.kt +++ /dev/null @@ -1,7 +0,0 @@ -package org.openapijsonschematools.client.paths.commonparamsubdir.post.responses; - -import org.openapijsonschematools.client.components.responses.SuccessDescriptionOnly; - -public class CommonparamsubdirPostCode200Response extends SuccessDescriptionOnly { - public static class CommonparamsubdirPostCode200Response1 extends SuccessDescriptionOnly1 {} -} diff --git a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/fake/FakeDelete.kt b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/fake/FakeDelete.kt deleted file mode 100644 index 1e9699662da..00000000000 --- a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/fake/FakeDelete.kt +++ /dev/null @@ -1,270 +0,0 @@ -package org.openapijsonschematools.client.paths.fake; - -import org.checkerframework.checker.nullness.qual.Nullable; -import org.openapijsonschematools.client.RootServerInfo; -import org.openapijsonschematools.client.paths.fake.delete.FakeDeleteSecurityInfo; -import org.openapijsonschematools.client.paths.fake.delete.FakeDeleteHeaderParameters; -import org.openapijsonschematools.client.paths.fake.delete.FakeDeleteQueryParameters; -import org.openapijsonschematools.client.paths.fake.delete.Parameters; -import org.openapijsonschematools.client.paths.fake.delete.FakeDeleteResponses; -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.paths.Fake; -import org.openapijsonschematools.client.securityrequirementobjects.SecurityRequirementObject; -import org.openapijsonschematools.client.securityrequirementobjects.AuthApplier; - -import java.io.IOException; -import java.net.http.HttpClient; -import java.net.http.HttpRequest; -import java.time.Duration; -import java.util.List; -import java.util.Map; - -public class FakeDelete { - private static class DeleteProvider extends AuthApplier { - private static final String method = "delete"; - - public static FakeDeleteResponses.EndpointResponse delete( - DeleteRequest request, - ApiConfiguration apiConfiguration, - SchemaConfiguration schemaConfiguration, - HttpClient client - ) throws IOException, InterruptedException, ValidationException, NotImplementedException, ApiException { - Map> headers = apiConfiguration.getDefaultHeaders(); - HttpRequest.BodyPublisher bodyPublisher = HttpRequest.BodyPublishers.noBody(); - - var headersSerializer = new Parameters.HeaderParametersSerializer(); - Map> serializedHeaders = headersSerializer.serialize(request.headerParameters); - headers.putAll(serializedHeaders); - - var querySerializer = new Parameters.QueryParametersSerializer(); - @Nullable Map queryMap = querySerializer.getQueryMap(request.queryParameters); - String host = apiConfiguration.getServer(request.serverIndex).url(); - SecurityRequirementObject securityRequirementObject = apiConfiguration.getSecurityRequirementObject(request.securityIndex); - updateParamsForAuth( - securityRequirementObject, - headers, - Fake.path, - method, - bodyPublisher, - queryMap, - apiConfiguration - ); - - String url = host + Fake.path; - if (queryMap != null) { - url = url + querySerializer.serialize(queryMap); - } - var httpRequest = RestClient.getRequest( - url, - method, - bodyPublisher, - headers, - request.timeout - ); - var response = RestClient.getResponse(httpRequest, client); - var responsesDeserializer = new FakeDeleteResponses.FakeDeleteResponses1(); - return responsesDeserializer.deserialize(response, schemaConfiguration); - } - } - - public interface DeleteOperation { - ApiConfiguration getApiConfiguration(); - SchemaConfiguration getSchemaConfiguration(); - HttpClient getClient(); - default FakeDeleteResponses.EndpointResponse delete(DeleteRequest request) throws IOException, InterruptedException, ValidationException, NotImplementedException, ApiException { - return DeleteProvider.delete(request, getApiConfiguration(), getSchemaConfiguration(), getClient()); - } - } - - public interface GroupParametersOperation { - ApiConfiguration getApiConfiguration(); - SchemaConfiguration getSchemaConfiguration(); - HttpClient getClient(); - default FakeDeleteResponses.EndpointResponse groupParameters(DeleteRequest request) throws IOException, InterruptedException, ValidationException, NotImplementedException, ApiException { - return DeleteProvider.delete(request, getApiConfiguration(), getSchemaConfiguration(), getClient()); - } - } - - public static class Delete extends ApiClient implements DeleteOperation { - public Delete(ApiConfiguration apiConfiguration, SchemaConfiguration schemaConfiguration) { - super(apiConfiguration, schemaConfiguration); - } - } - - public static class DeleteRequest { - public FakeDeleteHeaderParameters.HeaderParametersMap headerParameters; - public FakeDeleteQueryParameters.QueryParametersMap queryParameters; - public RootServerInfo.@Nullable ServerIndex serverIndex; - public FakeDeleteSecurityInfo.@Nullable SecurityIndex securityIndex; - public @Nullable Duration timeout; - - public DeleteRequest( - FakeDeleteHeaderParameters.HeaderParametersMap headerParameters, - FakeDeleteQueryParameters.QueryParametersMap queryParameters, - RootServerInfo.@Nullable ServerIndex serverIndex, - FakeDeleteSecurityInfo.@Nullable SecurityIndex securityIndex, - @Nullable Duration timeout - ) { - this.headerParameters = headerParameters; - this.queryParameters = queryParameters; - this.serverIndex = serverIndex; - this.securityIndex = securityIndex; - this.timeout = timeout; - } - } - - public static class DeleteNullableRequest { - public FakeDeleteHeaderParameters.@Nullable HeaderParametersMap headerParameters; - public FakeDeleteQueryParameters.@Nullable QueryParametersMap queryParameters; - public RootServerInfo.@Nullable ServerIndex serverIndex; - public FakeDeleteSecurityInfo.@Nullable SecurityIndex securityIndex; - public @Nullable Duration timeout; - } - - public interface SetterForServerIndex { - DeleteNullableRequest getInstance(); - T getBuilderAfterServerIndex(DeleteNullableRequest instance); - default T serverIndex(RootServerInfo.ServerIndex serverIndex) { - var instance = getInstance(); - instance.serverIndex = serverIndex; - return getBuilderAfterServerIndex(instance); - } - } - - public interface SetterForSecurityIndex { - DeleteNullableRequest getInstance(); - T getBuilderAfterSecurityIndex(DeleteNullableRequest instance); - default T securityIndex(FakeDeleteSecurityInfo.SecurityIndex securityIndex) { - var instance = getInstance(); - instance.securityIndex = securityIndex; - return getBuilderAfterSecurityIndex(instance); - } - } - - public interface SetterForTimeout { - DeleteNullableRequest getInstance(); - T getBuilderAfterTimeout(DeleteNullableRequest instance); - default T timeout(Duration timeout) { - var instance = getInstance(); - instance.timeout = timeout; - return getBuilderAfterTimeout(instance); - } - } - - public interface SetterForHeaderParameters { - DeleteNullableRequest getInstance(); - T getBuilderAfterHeaderParameters(DeleteNullableRequest instance); - default T headerParameters(FakeDeleteHeaderParameters.HeaderParametersMap headerParameters) { - var instance = getInstance(); - instance.headerParameters = headerParameters; - return getBuilderAfterHeaderParameters(instance); - } - } - - public interface SetterForQueryParameters { - DeleteNullableRequest getInstance(); - T getBuilderAfterQueryParameters(DeleteNullableRequest instance); - default T queryParameters(FakeDeleteQueryParameters.QueryParametersMap queryParameters) { - var instance = getInstance(); - instance.queryParameters = queryParameters; - return getBuilderAfterQueryParameters(instance); - } - } - - public static class Delete00RequestBuilder implements SetterForServerIndex, SetterForSecurityIndex, SetterForTimeout { - private final DeleteNullableRequest instance; - - public Delete00RequestBuilder(DeleteNullableRequest instance) { - this.instance = instance; - } - - public DeleteRequest build() { - var headerParameters = instance.headerParameters; - if (headerParameters == null) { - throw new RuntimeException("invalid null value for required parameter"); - } - var queryParameters = instance.queryParameters; - if (queryParameters == null) { - throw new RuntimeException("invalid null value for required parameter"); - } - return new DeleteRequest( - headerParameters, - queryParameters, - instance.serverIndex, - instance.securityIndex, - instance.timeout - ); - } - - public DeleteNullableRequest getInstance() { - return instance; - } - - public Delete00RequestBuilder getBuilderAfterServerIndex(DeleteNullableRequest instance) { - return this; - } - - public Delete00RequestBuilder getBuilderAfterSecurityIndex(DeleteNullableRequest instance) { - return this; - } - - public Delete00RequestBuilder getBuilderAfterTimeout(DeleteNullableRequest instance) { - return this; - } - } - public static class Delete01RequestBuilder implements SetterForQueryParameters { - private final DeleteNullableRequest instance; - - public Delete01RequestBuilder(DeleteNullableRequest instance) { - this.instance = instance; - } - - public DeleteNullableRequest getInstance() { - return instance; - } - - public Delete00RequestBuilder getBuilderAfterQueryParameters(DeleteNullableRequest instance) { - return new Delete00RequestBuilder(instance); - } - } - public static class Delete10RequestBuilder implements SetterForHeaderParameters { - private final DeleteNullableRequest instance; - - public Delete10RequestBuilder(DeleteNullableRequest instance) { - this.instance = instance; - } - - public DeleteNullableRequest getInstance() { - return instance; - } - - public Delete00RequestBuilder getBuilderAfterHeaderParameters(DeleteNullableRequest instance) { - return new Delete00RequestBuilder(instance); - } - } - public static class DeleteRequestBuilder implements SetterForHeaderParameters, SetterForQueryParameters { - private final DeleteNullableRequest instance; - - public DeleteRequestBuilder() { - this.instance = new DeleteNullableRequest(); - } - - public DeleteNullableRequest getInstance() { - return instance; - } - - public Delete01RequestBuilder getBuilderAfterHeaderParameters(DeleteNullableRequest instance) { - return new Delete01RequestBuilder(instance); - } - - public Delete10RequestBuilder getBuilderAfterQueryParameters(DeleteNullableRequest instance) { - return new Delete10RequestBuilder(instance); - } - } -} diff --git a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/fake/FakeGet.kt b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/fake/FakeGet.kt deleted file mode 100644 index 9239b256da7..00000000000 --- a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/fake/FakeGet.kt +++ /dev/null @@ -1,198 +0,0 @@ -package org.openapijsonschematools.client.paths.fake; - -import org.checkerframework.checker.nullness.qual.Nullable; -import org.openapijsonschematools.client.paths.fake.get.FakeGetRequestBody; -import org.openapijsonschematools.client.paths.fake.get.FakeGetHeaderParameters; -import org.openapijsonschematools.client.paths.fake.get.FakeGetQueryParameters; -import org.openapijsonschematools.client.RootServerInfo; -import org.openapijsonschematools.client.paths.fake.get.Parameters; -import org.openapijsonschematools.client.paths.fake.get.FakeGetResponses; -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.requestbody.SerializedRequestBody; -import org.openapijsonschematools.client.paths.Fake; - -import java.io.IOException; -import java.util.ArrayList; -import java.net.http.HttpClient; -import java.net.http.HttpRequest; -import java.time.Duration; -import java.util.List; -import java.util.Map; - -public class FakeGet { - private static class GetProvider { - private static final String method = "get"; - - public static FakeGetResponses.EndpointResponse get( - GetRequest request, - ApiConfiguration apiConfiguration, - SchemaConfiguration schemaConfiguration, - HttpClient client - ) throws IOException, InterruptedException, ValidationException, NotImplementedException, ApiException { - Map> headers = apiConfiguration.getDefaultHeaders(); - - @Nullable SerializedRequestBody serializedRequestBody; - HttpRequest.BodyPublisher bodyPublisher = HttpRequest.BodyPublishers.noBody(); - if (request.requestBody != null) { - serializedRequestBody = new FakeGetRequestBody.FakeGetRequestBody1().serialize( - request.requestBody - ); - var contentTypeHeaderValues = headers.getOrDefault("Content-Type", new ArrayList<>()); - contentTypeHeaderValues.add(serializedRequestBody.contentType); - bodyPublisher = serializedRequestBody.bodyPublisher; - } - - if (request.headerParameters != null) { - var headersSerializer = new Parameters.HeaderParametersSerializer(); - Map> serializedHeaders = headersSerializer.serialize(request.headerParameters); - headers.putAll(serializedHeaders); - } - - var querySerializer = new Parameters.QueryParametersSerializer(); - @Nullable Map queryMap = null; - if (request.queryParameters != null) { - queryMap = querySerializer.getQueryMap(request.queryParameters); - } - String host = apiConfiguration.getServer(request.serverIndex).url(); - - String url = host + Fake.path; - if (queryMap != null) { - url = url + querySerializer.serialize(queryMap); - } - var httpRequest = RestClient.getRequest( - url, - method, - bodyPublisher, - headers, - request.timeout - ); - var response = RestClient.getResponse(httpRequest, client); - var responsesDeserializer = new FakeGetResponses.FakeGetResponses1(); - return responsesDeserializer.deserialize(response, schemaConfiguration); - } - } - - public interface GetOperation { - ApiConfiguration getApiConfiguration(); - SchemaConfiguration getSchemaConfiguration(); - HttpClient getClient(); - default FakeGetResponses.EndpointResponse get(GetRequest request) throws IOException, InterruptedException, ValidationException, NotImplementedException, ApiException { - return GetProvider.get(request, getApiConfiguration(), getSchemaConfiguration(), getClient()); - } - } - - public interface EnumParametersOperation { - ApiConfiguration getApiConfiguration(); - SchemaConfiguration getSchemaConfiguration(); - HttpClient getClient(); - default FakeGetResponses.EndpointResponse enumParameters(GetRequest request) throws IOException, InterruptedException, ValidationException, NotImplementedException, ApiException { - return GetProvider.get(request, getApiConfiguration(), getSchemaConfiguration(), getClient()); - } - } - - public static class Get extends ApiClient implements GetOperation { - public Get(ApiConfiguration apiConfiguration, SchemaConfiguration schemaConfiguration) { - super(apiConfiguration, schemaConfiguration); - } - } - - public static class GetRequest { - public FakeGetRequestBody.@Nullable SealedRequestBody requestBody; - public FakeGetHeaderParameters.@Nullable HeaderParametersMap headerParameters; - public FakeGetQueryParameters.@Nullable QueryParametersMap queryParameters; - public RootServerInfo.@Nullable ServerIndex serverIndex; - public @Nullable Duration timeout; - } - - public interface SetterForRequestBody { - GetRequest getInstance(); - T getBuilderAfterRequestBody(GetRequest instance); - default T requestBody(FakeGetRequestBody.SealedRequestBody requestBody) { - var instance = getInstance(); - instance.requestBody = requestBody; - return getBuilderAfterRequestBody(instance); - } - } - - public interface SetterForHeaderParameters { - GetRequest getInstance(); - T getBuilderAfterHeaderParameters(GetRequest instance); - default T headerParameters(FakeGetHeaderParameters.HeaderParametersMap headerParameters) { - var instance = getInstance(); - instance.headerParameters = headerParameters; - return getBuilderAfterHeaderParameters(instance); - } - } - - public interface SetterForQueryParameters { - GetRequest getInstance(); - T getBuilderAfterQueryParameters(GetRequest instance); - default T queryParameters(FakeGetQueryParameters.QueryParametersMap queryParameters) { - var instance = getInstance(); - instance.queryParameters = queryParameters; - return getBuilderAfterQueryParameters(instance); - } - } - - public interface SetterForServerIndex { - GetRequest getInstance(); - T getBuilderAfterServerIndex(GetRequest instance); - default T serverIndex(RootServerInfo.ServerIndex serverIndex) { - var instance = getInstance(); - instance.serverIndex = serverIndex; - return getBuilderAfterServerIndex(instance); - } - } - - public interface SetterForTimeout { - GetRequest getInstance(); - T getBuilderAfterTimeout(GetRequest instance); - default T timeout(Duration timeout) { - var instance = getInstance(); - instance.timeout = timeout; - return getBuilderAfterTimeout(instance); - } - } - - public static class GetRequestBuilder implements SetterForRequestBody, SetterForHeaderParameters, SetterForQueryParameters, SetterForServerIndex, SetterForTimeout { - private final GetRequest instance; - - public GetRequestBuilder() { - this.instance = new GetRequest(); - } - - public GetRequest build() { - return instance; - } - - public GetRequest getInstance() { - return instance; - } - - public GetRequestBuilder getBuilderAfterRequestBody(GetRequest instance) { - return this; - } - - public GetRequestBuilder getBuilderAfterHeaderParameters(GetRequest instance) { - return this; - } - - public GetRequestBuilder getBuilderAfterQueryParameters(GetRequest instance) { - return this; - } - - public GetRequestBuilder getBuilderAfterServerIndex(GetRequest instance) { - return this; - } - - public GetRequestBuilder getBuilderAfterTimeout(GetRequest instance) { - return this; - } - } -} diff --git a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/fake/FakePatch.kt b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/fake/FakePatch.kt deleted file mode 100644 index e723af46b95..00000000000 --- a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/fake/FakePatch.kt +++ /dev/null @@ -1,183 +0,0 @@ -package org.openapijsonschematools.client.paths.fake; - -import org.checkerframework.checker.nullness.qual.Nullable; -import org.openapijsonschematools.client.RootServerInfo; -import org.openapijsonschematools.client.paths.fake.patch.FakePatchRequestBody; -import org.openapijsonschematools.client.paths.fake.patch.FakePatchResponses; -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.requestbody.SerializedRequestBody; -import org.openapijsonschematools.client.paths.Fake; - -import java.io.IOException; -import java.util.ArrayList; -import java.net.http.HttpClient; -import java.net.http.HttpRequest; -import java.time.Duration; -import java.util.List; -import java.util.Map; - -public class FakePatch { - private static class PatchProvider { - private static final String method = "patch"; - - public static FakePatchResponses.EndpointResponse patch( - PatchRequest request, - ApiConfiguration apiConfiguration, - SchemaConfiguration schemaConfiguration, - HttpClient client - ) throws IOException, InterruptedException, ValidationException, NotImplementedException, ApiException { - Map> headers = apiConfiguration.getDefaultHeaders(); - - SerializedRequestBody serializedRequestBody = new FakePatchRequestBody.FakePatchRequestBody1().serialize( - request.requestBody - ); - var contentTypeHeaderValues = headers.getOrDefault("Content-Type", new ArrayList<>()); - contentTypeHeaderValues.add(serializedRequestBody.contentType); - HttpRequest.BodyPublisher bodyPublisher = serializedRequestBody.bodyPublisher; - // TODO set this to a map if there is a query security scheme - @Nullable Map queryMap = null; - String host = apiConfiguration.getServer(request.serverIndex).url(); - - String url = host + Fake.path; - var httpRequest = RestClient.getRequest( - url, - method, - bodyPublisher, - headers, - request.timeout - ); - var response = RestClient.getResponse(httpRequest, client); - var responsesDeserializer = new FakePatchResponses.FakePatchResponses1(); - return responsesDeserializer.deserialize(response, schemaConfiguration); - } - } - - public interface PatchOperation { - ApiConfiguration getApiConfiguration(); - SchemaConfiguration getSchemaConfiguration(); - HttpClient getClient(); - default FakePatchResponses.EndpointResponse patch(PatchRequest request) throws IOException, InterruptedException, ValidationException, NotImplementedException, ApiException { - return PatchProvider.patch(request, getApiConfiguration(), getSchemaConfiguration(), getClient()); - } - } - - public interface ClientModelOperation { - ApiConfiguration getApiConfiguration(); - SchemaConfiguration getSchemaConfiguration(); - HttpClient getClient(); - default FakePatchResponses.EndpointResponse clientModel(PatchRequest request) throws IOException, InterruptedException, ValidationException, NotImplementedException, ApiException { - return PatchProvider.patch(request, getApiConfiguration(), getSchemaConfiguration(), getClient()); - } - } - - public static class Patch extends ApiClient implements PatchOperation { - public Patch(ApiConfiguration apiConfiguration, SchemaConfiguration schemaConfiguration) { - super(apiConfiguration, schemaConfiguration); - } - } - - public static class PatchRequest { - public FakePatchRequestBody.SealedRequestBody requestBody; - public RootServerInfo.@Nullable ServerIndex serverIndex; - public @Nullable Duration timeout; - - public PatchRequest( - FakePatchRequestBody.SealedRequestBody requestBody, - RootServerInfo.@Nullable ServerIndex serverIndex, - @Nullable Duration timeout - ) { - this.requestBody = requestBody; - this.serverIndex = serverIndex; - this.timeout = timeout; - } - } - - public static class PatchNullableRequest { - public FakePatchRequestBody.@Nullable SealedRequestBody requestBody; - public RootServerInfo.@Nullable ServerIndex serverIndex; - public @Nullable Duration timeout; - } - - public interface SetterForServerIndex { - PatchNullableRequest getInstance(); - T getBuilderAfterServerIndex(PatchNullableRequest instance); - default T serverIndex(RootServerInfo.ServerIndex serverIndex) { - var instance = getInstance(); - instance.serverIndex = serverIndex; - return getBuilderAfterServerIndex(instance); - } - } - - public interface SetterForTimeout { - PatchNullableRequest getInstance(); - T getBuilderAfterTimeout(PatchNullableRequest instance); - default T timeout(Duration timeout) { - var instance = getInstance(); - instance.timeout = timeout; - return getBuilderAfterTimeout(instance); - } - } - - public interface SetterForRequestBody { - PatchNullableRequest getInstance(); - T getBuilderAfterRequestBody(PatchNullableRequest instance); - default T requestBody(FakePatchRequestBody.SealedRequestBody requestBody) { - var instance = getInstance(); - instance.requestBody = requestBody; - return getBuilderAfterRequestBody(instance); - } - } - - public static class Patch0RequestBuilder implements SetterForServerIndex, SetterForTimeout { - private final PatchNullableRequest instance; - - public Patch0RequestBuilder(PatchNullableRequest instance) { - this.instance = instance; - } - - public PatchRequest build() { - var requestBody = instance.requestBody; - if (requestBody == null) { - throw new RuntimeException("invalid null value for required parameter"); - } - return new PatchRequest( - requestBody, - instance.serverIndex, - instance.timeout - ); - } - - public PatchNullableRequest getInstance() { - return instance; - } - - public Patch0RequestBuilder getBuilderAfterServerIndex(PatchNullableRequest instance) { - return this; - } - - public Patch0RequestBuilder getBuilderAfterTimeout(PatchNullableRequest instance) { - return this; - } - } - public static class PatchRequestBuilder implements SetterForRequestBody { - private final PatchNullableRequest instance; - - public PatchRequestBuilder() { - this.instance = new PatchNullableRequest(); - } - - public PatchNullableRequest getInstance() { - return instance; - } - - public Patch0RequestBuilder getBuilderAfterRequestBody(PatchNullableRequest instance) { - return new Patch0RequestBuilder(instance); - } - } -} diff --git a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/fake/FakePost.kt b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/fake/FakePost.kt deleted file mode 100644 index 7772656bdfe..00000000000 --- a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/fake/FakePost.kt +++ /dev/null @@ -1,180 +0,0 @@ -package org.openapijsonschematools.client.paths.fake; - -import org.checkerframework.checker.nullness.qual.Nullable; -import org.openapijsonschematools.client.paths.fake.post.FakePostRequestBody; -import org.openapijsonschematools.client.RootServerInfo; -import org.openapijsonschematools.client.paths.fake.post.FakePostSecurityInfo; -import org.openapijsonschematools.client.paths.fake.post.FakePostResponses; -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.requestbody.SerializedRequestBody; -import org.openapijsonschematools.client.paths.Fake; -import org.openapijsonschematools.client.securityrequirementobjects.SecurityRequirementObject; -import org.openapijsonschematools.client.securityrequirementobjects.AuthApplier; - -import java.io.IOException; -import java.util.ArrayList; -import java.net.http.HttpClient; -import java.net.http.HttpRequest; -import java.time.Duration; -import java.util.List; -import java.util.Map; - -public class FakePost { - private static class PostProvider extends AuthApplier { - private static final String method = "post"; - - public static FakePostResponses.EndpointResponse post( - PostRequest request, - ApiConfiguration apiConfiguration, - SchemaConfiguration schemaConfiguration, - HttpClient client - ) throws IOException, InterruptedException, ValidationException, NotImplementedException, ApiException { - Map> headers = apiConfiguration.getDefaultHeaders(); - - @Nullable SerializedRequestBody serializedRequestBody; - HttpRequest.BodyPublisher bodyPublisher = HttpRequest.BodyPublishers.noBody(); - if (request.requestBody != null) { - serializedRequestBody = new FakePostRequestBody.FakePostRequestBody1().serialize( - request.requestBody - ); - var contentTypeHeaderValues = headers.getOrDefault("Content-Type", new ArrayList<>()); - contentTypeHeaderValues.add(serializedRequestBody.contentType); - bodyPublisher = serializedRequestBody.bodyPublisher; - } - // TODO set this to a map if there is a query security scheme - @Nullable Map queryMap = null; - String host = apiConfiguration.getServer(request.serverIndex).url(); - SecurityRequirementObject securityRequirementObject = apiConfiguration.getSecurityRequirementObject(request.securityIndex); - updateParamsForAuth( - securityRequirementObject, - headers, - Fake.path, - method, - bodyPublisher, - queryMap, - apiConfiguration - ); - - String url = host + Fake.path; - var httpRequest = RestClient.getRequest( - url, - method, - bodyPublisher, - headers, - request.timeout - ); - var response = RestClient.getResponse(httpRequest, client); - var responsesDeserializer = new FakePostResponses.FakePostResponses1(); - return responsesDeserializer.deserialize(response, schemaConfiguration); - } - } - - public interface PostOperation { - ApiConfiguration getApiConfiguration(); - SchemaConfiguration getSchemaConfiguration(); - HttpClient getClient(); - default FakePostResponses.EndpointResponse post(PostRequest request) throws IOException, InterruptedException, ValidationException, NotImplementedException, ApiException { - return PostProvider.post(request, getApiConfiguration(), getSchemaConfiguration(), getClient()); - } - } - - public interface EndpointParametersOperation { - ApiConfiguration getApiConfiguration(); - SchemaConfiguration getSchemaConfiguration(); - HttpClient getClient(); - default FakePostResponses.EndpointResponse endpointParameters(PostRequest request) throws IOException, InterruptedException, ValidationException, NotImplementedException, ApiException { - return PostProvider.post(request, getApiConfiguration(), getSchemaConfiguration(), getClient()); - } - } - - public static class Post extends ApiClient implements PostOperation { - public Post(ApiConfiguration apiConfiguration, SchemaConfiguration schemaConfiguration) { - super(apiConfiguration, schemaConfiguration); - } - } - - public static class PostRequest { - public FakePostRequestBody.@Nullable SealedRequestBody requestBody; - public RootServerInfo.@Nullable ServerIndex serverIndex; - public FakePostSecurityInfo.@Nullable SecurityIndex securityIndex; - public @Nullable Duration timeout; - } - - public interface SetterForRequestBody { - PostRequest getInstance(); - T getBuilderAfterRequestBody(PostRequest instance); - default T requestBody(FakePostRequestBody.SealedRequestBody requestBody) { - var instance = getInstance(); - instance.requestBody = requestBody; - return getBuilderAfterRequestBody(instance); - } - } - - public interface SetterForServerIndex { - PostRequest getInstance(); - T getBuilderAfterServerIndex(PostRequest instance); - default T serverIndex(RootServerInfo.ServerIndex serverIndex) { - var instance = getInstance(); - instance.serverIndex = serverIndex; - return getBuilderAfterServerIndex(instance); - } - } - - public interface SetterForSecurityIndex { - PostRequest getInstance(); - T getBuilderAfterSecurityIndex(PostRequest instance); - default T securityIndex(FakePostSecurityInfo.SecurityIndex securityIndex) { - var instance = getInstance(); - instance.securityIndex = securityIndex; - return getBuilderAfterSecurityIndex(instance); - } - } - - public interface SetterForTimeout { - PostRequest getInstance(); - T getBuilderAfterTimeout(PostRequest instance); - default T timeout(Duration timeout) { - var instance = getInstance(); - instance.timeout = timeout; - return getBuilderAfterTimeout(instance); - } - } - - public static class PostRequestBuilder implements SetterForRequestBody, SetterForServerIndex, SetterForSecurityIndex, SetterForTimeout { - private final PostRequest instance; - - public PostRequestBuilder() { - this.instance = new PostRequest(); - } - - public PostRequest build() { - return instance; - } - - public PostRequest getInstance() { - return instance; - } - - public PostRequestBuilder getBuilderAfterRequestBody(PostRequest instance) { - return this; - } - - public PostRequestBuilder getBuilderAfterServerIndex(PostRequest instance) { - return this; - } - - public PostRequestBuilder getBuilderAfterSecurityIndex(PostRequest instance) { - return this; - } - - public PostRequestBuilder getBuilderAfterTimeout(PostRequest instance) { - return this; - } - } -} diff --git a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/fake/delete/FakeDeleteHeaderParameters.kt b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/fake/delete/FakeDeleteHeaderParameters.kt deleted file mode 100644 index c63bc8e9304..00000000000 --- a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/fake/delete/FakeDeleteHeaderParameters.kt +++ /dev/null @@ -1,246 +0,0 @@ -package org.openapijsonschematools.client.paths.fake.delete; -import java.util.ArrayList; -import java.util.HashSet; -import java.util.LinkedHashMap; -import java.util.LinkedHashSet; -import java.util.List; -import java.util.Map; -import java.util.Objects; -import java.util.Set; -import org.checkerframework.checker.nullness.qual.Nullable; -import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags; -import org.openapijsonschematools.client.configurations.SchemaConfiguration; -import org.openapijsonschematools.client.exceptions.UnsetPropertyException; -import org.openapijsonschematools.client.exceptions.ValidationException; -import org.openapijsonschematools.client.paths.fake.delete.parameters.parameter1.Schema1; -import org.openapijsonschematools.client.paths.fake.delete.parameters.parameter4.Schema4; -import org.openapijsonschematools.client.schemas.AnyTypeJsonSchema; -import org.openapijsonschematools.client.schemas.GenericBuilder; -import org.openapijsonschematools.client.schemas.NotAnyTypeJsonSchema; -import org.openapijsonschematools.client.schemas.validation.FrozenMap; -import org.openapijsonschematools.client.schemas.validation.JsonSchema; -import org.openapijsonschematools.client.schemas.validation.JsonSchemaInfo; -import org.openapijsonschematools.client.schemas.validation.MapSchemaValidator; -import org.openapijsonschematools.client.schemas.validation.MapUtils; -import org.openapijsonschematools.client.schemas.validation.PathToSchemasMap; -import org.openapijsonschematools.client.schemas.validation.PropertyEntry; -import org.openapijsonschematools.client.schemas.validation.ValidationMetadata; - -public class FakeDeleteHeaderParameters { - // nest classes so all schemas and input/output classes can be public - - - public static class AdditionalProperties extends NotAnyTypeJsonSchema.NotAnyTypeJsonSchema1 { - // NotAnyTypeSchema - private static @Nullable AdditionalProperties instance = null; - public static AdditionalProperties getInstance() { - if (instance == null) { - instance = new AdditionalProperties(); - } - return instance; - } - } - - - public static class HeaderParametersMap extends FrozenMap<@Nullable Object> { - protected HeaderParametersMap(FrozenMap<@Nullable Object> m) { - super(m); - } - public static final Set requiredKeys = Set.of( - "required_boolean_group" - ); - public static final Set optionalKeys = Set.of( - "boolean_group" - ); - public static HeaderParametersMap of(Map arg, SchemaConfiguration configuration) throws ValidationException { - return FakeDeleteHeaderParameters1.getInstance().validate(arg, configuration); - } - - 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"); - } - return (String) value; - } - - public String boolean_group() throws UnsetPropertyException { - String key = "boolean_group"; - throwIfKeyNotPresent(key); - @Nullable Object value = get(key); - if (!(value instanceof String)) { - throw new RuntimeException("Invalid value stored for boolean_group"); - } - return (String) value; - } - } - - public interface SetterForRequiredBooleanGroup { - Map getInstance(); - T getBuilderAfterRequiredBooleanGroup(Map instance); - - default T required_boolean_group(String value) { - var instance = getInstance(); - instance.put("required_boolean_group", value); - return getBuilderAfterRequiredBooleanGroup(instance); - } - - default T required_boolean_group(Schema1.StringSchemaEnums1 value) { - var instance = getInstance(); - instance.put("required_boolean_group", value.value()); - return getBuilderAfterRequiredBooleanGroup(instance); - } - } - - public interface SetterForBooleanGroup { - Map getInstance(); - T getBuilderAfterBooleanGroup(Map instance); - - default T boolean_group(String value) { - var instance = getInstance(); - instance.put("boolean_group", value); - return getBuilderAfterBooleanGroup(instance); - } - - default T boolean_group(Schema4.StringSchemaEnums4 value) { - var instance = getInstance(); - instance.put("boolean_group", value.value()); - return getBuilderAfterBooleanGroup(instance); - } - } - - public static class HeaderParametersMap0Builder implements GenericBuilder>, SetterForBooleanGroup { - private final Map instance; - private static final Set knownKeys = Set.of( - "required_boolean_group", - "boolean_group" - ); - public Set getKnownKeys() { - return knownKeys; - } - public HeaderParametersMap0Builder(Map instance) { - this.instance = instance; - } - public Map build() { - return instance; - } - public Map getInstance() { - return instance; - } - public HeaderParametersMap0Builder getBuilderAfterBooleanGroup(Map instance) { - return this; - } - } - - public static class HeaderParametersMapBuilder implements SetterForRequiredBooleanGroup { - private final Map instance; - public HeaderParametersMapBuilder() { - this.instance = new LinkedHashMap<>(); - } - public Map getInstance() { - return instance; - } - public HeaderParametersMap0Builder getBuilderAfterRequiredBooleanGroup(Map instance) { - return new HeaderParametersMap0Builder(instance); - } - } - - - public sealed interface FakeDeleteHeaderParameters1Boxed permits FakeDeleteHeaderParameters1BoxedMap { - @Nullable Object getData(); - } - - public record FakeDeleteHeaderParameters1BoxedMap(HeaderParametersMap data) implements FakeDeleteHeaderParameters1Boxed { - @Override - public @Nullable Object getData() { - return data; - } - } - - - public static class FakeDeleteHeaderParameters1 extends JsonSchema implements MapSchemaValidator { - private static @Nullable FakeDeleteHeaderParameters1 instance = null; - - protected FakeDeleteHeaderParameters1() { - super(new JsonSchemaInfo() - .type(Set.of(Map.class)) - .properties(Map.ofEntries( - new PropertyEntry("required_boolean_group", Schema1.Schema11.class), - new PropertyEntry("boolean_group", Schema4.Schema41.class) - )) - .required(Set.of( - "required_boolean_group" - )) - .additionalProperties(AdditionalProperties.class) - ); - } - - public static FakeDeleteHeaderParameters1 getInstance() { - if (instance == null) { - instance = new FakeDeleteHeaderParameters1(); - } - return instance; - } - - 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 RuntimeException("Invalid non-string key value"); - } - String propertyName = (String) entryKey; - List propertyPathToItem = new ArrayList<>(pathToItem); - propertyPathToItem.add(propertyName); - Object value = entry.getValue(); - LinkedHashMap, Nothing?> schemas = pathToSchemas.get(propertyPathToItem); - if (schemas == null) { - throw new RuntimeException("Validation result is invalid, schemas must exist for a pathToItem"); - } - JsonSchema propertySchema = schemas.entrySet().iterator().next().getKey(); - @Nullable Object propertyInstance = propertySchema.getNewInstance(value, propertyPathToItem, pathToSchemas); - properties.put(propertyName, propertyInstance); - } - FrozenMap<@Nullable Object> castProperties = new FrozenMap<>(properties); - return new HeaderParametersMap(castProperties); - } - - 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); - SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().build())); - ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, new PathToSchemasMap(), new LinkedHashSet<>()); - PathToSchemasMap pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet); - return getNewInstance(castArg, validationMetadata.pathToItem(), pathToSchemasMap); - } - - - @Override - public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws 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"); - } - @Override - public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { - if (arg instanceof Map) { - return getNewInstance((Map) arg, pathToItem, pathToSchemas); - } - throw new RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); - } - @Override - public FakeDeleteHeaderParameters1BoxedMap validateAndBox(Map arg, SchemaConfiguration configuration) throws ValidationException { - return new FakeDeleteHeaderParameters1BoxedMap(validate(arg, configuration)); - } - @Override - public FakeDeleteHeaderParameters1Boxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { - 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"); - } - } - -} diff --git a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/fake/delete/FakeDeleteQueryParameters.kt b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/fake/delete/FakeDeleteQueryParameters.kt deleted file mode 100644 index f8e90e07df8..00000000000 --- a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/fake/delete/FakeDeleteQueryParameters.kt +++ /dev/null @@ -1,351 +0,0 @@ -package org.openapijsonschematools.client.paths.fake.delete; -import java.util.ArrayList; -import java.util.HashSet; -import java.util.LinkedHashMap; -import java.util.LinkedHashSet; -import java.util.List; -import java.util.Map; -import java.util.Objects; -import java.util.Set; -import org.checkerframework.checker.nullness.qual.Nullable; -import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags; -import org.openapijsonschematools.client.configurations.SchemaConfiguration; -import org.openapijsonschematools.client.exceptions.UnsetPropertyException; -import org.openapijsonschematools.client.exceptions.ValidationException; -import org.openapijsonschematools.client.paths.fake.delete.parameters.parameter0.Schema0; -import org.openapijsonschematools.client.paths.fake.delete.parameters.parameter2.Schema2; -import org.openapijsonschematools.client.paths.fake.delete.parameters.parameter3.Schema3; -import org.openapijsonschematools.client.paths.fake.delete.parameters.parameter5.Schema5; -import org.openapijsonschematools.client.schemas.AnyTypeJsonSchema; -import org.openapijsonschematools.client.schemas.GenericBuilder; -import org.openapijsonschematools.client.schemas.NotAnyTypeJsonSchema; -import org.openapijsonschematools.client.schemas.validation.FrozenMap; -import org.openapijsonschematools.client.schemas.validation.JsonSchema; -import org.openapijsonschematools.client.schemas.validation.JsonSchemaInfo; -import org.openapijsonschematools.client.schemas.validation.MapSchemaValidator; -import org.openapijsonschematools.client.schemas.validation.MapUtils; -import org.openapijsonschematools.client.schemas.validation.PathToSchemasMap; -import org.openapijsonschematools.client.schemas.validation.PropertyEntry; -import org.openapijsonschematools.client.schemas.validation.ValidationMetadata; - -public class FakeDeleteQueryParameters { - // nest classes so all schemas and input/output classes can be public - - - public static class AdditionalProperties extends NotAnyTypeJsonSchema.NotAnyTypeJsonSchema1 { - // NotAnyTypeSchema - private static @Nullable AdditionalProperties instance = null; - public static AdditionalProperties getInstance() { - if (instance == null) { - instance = new AdditionalProperties(); - } - return instance; - } - } - - - public static class QueryParametersMap extends FrozenMap<@Nullable Object> { - protected QueryParametersMap(FrozenMap<@Nullable Object> m) { - super(m); - } - public static final Set requiredKeys = Set.of( - "required_int64_group", - "required_string_group" - ); - public static final Set optionalKeys = Set.of( - "int64_group", - "string_group" - ); - public static QueryParametersMap of(Map arg, SchemaConfiguration configuration) throws ValidationException { - return FakeDeleteQueryParameters1.getInstance().validate(arg, configuration); - } - - 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"); - } - return (Number) value; - } - - 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"); - } - return (String) value; - } - - public Number int64_group() throws UnsetPropertyException { - String key = "int64_group"; - throwIfKeyNotPresent(key); - @Nullable Object value = get(key); - if (!(value instanceof Number)) { - throw new RuntimeException("Invalid value stored for int64_group"); - } - return (Number) value; - } - - public String string_group() throws UnsetPropertyException { - String key = "string_group"; - throwIfKeyNotPresent(key); - @Nullable Object value = get(key); - if (!(value instanceof String)) { - throw new RuntimeException("Invalid value stored for string_group"); - } - return (String) value; - } - } - - public interface SetterForRequiredInt64Group { - Map getInstance(); - T getBuilderAfterRequiredInt64Group(Map instance); - - default T required_int64_group(int value) { - var instance = getInstance(); - instance.put("required_int64_group", value); - return getBuilderAfterRequiredInt64Group(instance); - } - - default T required_int64_group(float value) { - var instance = getInstance(); - instance.put("required_int64_group", value); - return getBuilderAfterRequiredInt64Group(instance); - } - - default T required_int64_group(long value) { - var instance = getInstance(); - instance.put("required_int64_group", value); - return getBuilderAfterRequiredInt64Group(instance); - } - - default T required_int64_group(double value) { - var instance = getInstance(); - instance.put("required_int64_group", value); - return getBuilderAfterRequiredInt64Group(instance); - } - } - - public interface SetterForRequiredStringGroup { - Map getInstance(); - T getBuilderAfterRequiredStringGroup(Map instance); - - default T required_string_group(String value) { - var instance = getInstance(); - instance.put("required_string_group", value); - return getBuilderAfterRequiredStringGroup(instance); - } - } - - public interface SetterForInt64Group { - Map getInstance(); - T getBuilderAfterInt64Group(Map instance); - - default T int64_group(int value) { - var instance = getInstance(); - instance.put("int64_group", value); - return getBuilderAfterInt64Group(instance); - } - - default T int64_group(float value) { - var instance = getInstance(); - instance.put("int64_group", value); - return getBuilderAfterInt64Group(instance); - } - - default T int64_group(long value) { - var instance = getInstance(); - instance.put("int64_group", value); - return getBuilderAfterInt64Group(instance); - } - - default T int64_group(double value) { - var instance = getInstance(); - instance.put("int64_group", value); - return getBuilderAfterInt64Group(instance); - } - } - - public interface SetterForStringGroup { - Map getInstance(); - T getBuilderAfterStringGroup(Map instance); - - default T string_group(String value) { - var instance = getInstance(); - instance.put("string_group", value); - return getBuilderAfterStringGroup(instance); - } - } - - public static class QueryParametersMap00Builder implements GenericBuilder>, SetterForInt64Group, SetterForStringGroup { - private final Map instance; - private static final Set knownKeys = Set.of( - "required_int64_group", - "required_string_group", - "int64_group", - "string_group" - ); - public Set getKnownKeys() { - return knownKeys; - } - public QueryParametersMap00Builder(Map instance) { - this.instance = instance; - } - public Map build() { - return instance; - } - public Map getInstance() { - return instance; - } - public QueryParametersMap00Builder getBuilderAfterInt64Group(Map instance) { - return this; - } - public QueryParametersMap00Builder getBuilderAfterStringGroup(Map instance) { - return this; - } - } - - public static class QueryParametersMap01Builder implements SetterForRequiredStringGroup { - private final Map instance; - public QueryParametersMap01Builder(Map instance) { - this.instance = instance; - } - public Map getInstance() { - return instance; - } - public QueryParametersMap00Builder getBuilderAfterRequiredStringGroup(Map instance) { - return new QueryParametersMap00Builder(instance); - } - } - - public static class QueryParametersMap10Builder implements SetterForRequiredInt64Group { - private final Map instance; - public QueryParametersMap10Builder(Map instance) { - this.instance = instance; - } - public Map getInstance() { - return instance; - } - public QueryParametersMap00Builder getBuilderAfterRequiredInt64Group(Map instance) { - return new QueryParametersMap00Builder(instance); - } - } - - public static class QueryParametersMapBuilder implements SetterForRequiredInt64Group, SetterForRequiredStringGroup { - private final Map instance; - public QueryParametersMapBuilder() { - this.instance = new LinkedHashMap<>(); - } - public Map getInstance() { - return instance; - } - public QueryParametersMap01Builder getBuilderAfterRequiredInt64Group(Map instance) { - return new QueryParametersMap01Builder(instance); - } - public QueryParametersMap10Builder getBuilderAfterRequiredStringGroup(Map instance) { - return new QueryParametersMap10Builder(instance); - } - } - - - public sealed interface FakeDeleteQueryParameters1Boxed permits FakeDeleteQueryParameters1BoxedMap { - @Nullable Object getData(); - } - - public record FakeDeleteQueryParameters1BoxedMap(QueryParametersMap data) implements FakeDeleteQueryParameters1Boxed { - @Override - public @Nullable Object getData() { - return data; - } - } - - - public static class FakeDeleteQueryParameters1 extends JsonSchema implements MapSchemaValidator { - private static @Nullable FakeDeleteQueryParameters1 instance = null; - - protected FakeDeleteQueryParameters1() { - super(new JsonSchemaInfo() - .type(Set.of(Map.class)) - .properties(Map.ofEntries( - new PropertyEntry("required_string_group", Schema0.Schema01.class), - new PropertyEntry("int64_group", Schema5.Schema51.class), - new PropertyEntry("string_group", Schema3.Schema31.class), - new PropertyEntry("required_int64_group", Schema2.Schema21.class) - )) - .required(Set.of( - "required_int64_group", - "required_string_group" - )) - .additionalProperties(AdditionalProperties.class) - ); - } - - public static FakeDeleteQueryParameters1 getInstance() { - if (instance == null) { - instance = new FakeDeleteQueryParameters1(); - } - return instance; - } - - 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 RuntimeException("Invalid non-string key value"); - } - String propertyName = (String) entryKey; - List propertyPathToItem = new ArrayList<>(pathToItem); - propertyPathToItem.add(propertyName); - Object value = entry.getValue(); - LinkedHashMap, Nothing?> schemas = pathToSchemas.get(propertyPathToItem); - if (schemas == null) { - throw new RuntimeException("Validation result is invalid, schemas must exist for a pathToItem"); - } - JsonSchema propertySchema = schemas.entrySet().iterator().next().getKey(); - @Nullable Object propertyInstance = propertySchema.getNewInstance(value, propertyPathToItem, pathToSchemas); - properties.put(propertyName, propertyInstance); - } - FrozenMap<@Nullable Object> castProperties = new FrozenMap<>(properties); - return new QueryParametersMap(castProperties); - } - - 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); - SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().build())); - ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, new PathToSchemasMap(), new LinkedHashSet<>()); - PathToSchemasMap pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet); - return getNewInstance(castArg, validationMetadata.pathToItem(), pathToSchemasMap); - } - - - @Override - public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws 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"); - } - @Override - public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { - if (arg instanceof Map) { - return getNewInstance((Map) arg, pathToItem, pathToSchemas); - } - throw new RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); - } - @Override - public FakeDeleteQueryParameters1BoxedMap validateAndBox(Map arg, SchemaConfiguration configuration) throws ValidationException { - return new FakeDeleteQueryParameters1BoxedMap(validate(arg, configuration)); - } - @Override - public FakeDeleteQueryParameters1Boxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { - 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"); - } - } - -} diff --git a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/fake/delete/FakeDeleteResponses.kt b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/fake/delete/FakeDeleteResponses.kt deleted file mode 100644 index 24b7f3ebd46..00000000000 --- a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/fake/delete/FakeDeleteResponses.kt +++ /dev/null @@ -1,53 +0,0 @@ -package org.openapijsonschematools.client.paths.fake.delete; - -import org.openapijsonschematools.client.paths.fake.delete.responses.FakeDeleteCode200Response; -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; -import org.checkerframework.checker.nullness.qual.Nullable; - -import java.net.http.HttpResponse; -import java.util.Map; -import java.util.AbstractMap; - -public class FakeDeleteResponses { - public sealed interface EndpointResponse permits EndpointFakeDeleteCode200Response {} - - public record EndpointFakeDeleteCode200Response( - HttpResponse response, - Nothing? body, - Nothing? headers - ) implements EndpointResponse, ApiResponse{ - } - - public sealed interface StatusCodeResponseDeserializer permits StatusFakeDeleteCode200ResponseDeserializer {} - - public static final class StatusFakeDeleteCode200ResponseDeserializer extends FakeDeleteCode200Response.FakeDeleteCode200Response1 implements StatusCodeResponseDeserializer { - } - - public static final class FakeDeleteResponses1 implements ResponsesDeserializer { - private final Map statusCodeToResponseDeserializer; - public FakeDeleteResponses1() { - this.statusCodeToResponseDeserializer = Map.ofEntries( - new AbstractMap.SimpleEntry<>("200", new StatusFakeDeleteCode200ResponseDeserializer()) - ); - } - - 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) { - throw new ApiException( - "Invalid response statusCode="+statusCode+" has no response defined in the openapi document", - response - ); - } - StatusFakeDeleteCode200ResponseDeserializer castDeserializer = (StatusFakeDeleteCode200ResponseDeserializer) statusCodeDeserializer; - var deserializedResponse = castDeserializer.deserialize(response, configuration); - return new EndpointFakeDeleteCode200Response(response, deserializedResponse.body(), deserializedResponse.headers()); - } - } -} diff --git a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/fake/delete/FakeDeleteSecurityInfo.kt b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/fake/delete/FakeDeleteSecurityInfo.kt deleted file mode 100644 index 1d8502b4091..00000000000 --- a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/fake/delete/FakeDeleteSecurityInfo.kt +++ /dev/null @@ -1,24 +0,0 @@ -package org.openapijsonschematools.client.paths.fake.delete; - -import org.openapijsonschematools.client.paths.fake.delete.security.FakeDeleteSecurityRequirementObject0; -import org.openapijsonschematools.client.securityrequirementobjects.SecurityRequirementObject; -import org.openapijsonschematools.client.securityrequirementobjects.SecurityRequirementObjectProvider; - -public class FakeDeleteSecurityInfo { - public static class FakeDeleteSecurityInfo1 implements SecurityRequirementObjectProvider { - public final FakeDeleteSecurityRequirementObject0 security0; - - public FakeDeleteSecurityInfo1() { - security0 = new FakeDeleteSecurityRequirementObject0(); - } - - @Override - public SecurityRequirementObject getSecurityRequirementObject(SecurityIndex securityIndex) { - return security0; - } - } - - public enum SecurityIndex { - SECURITY_0 - } -} \ No newline at end of file diff --git a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/fake/delete/Parameters.kt b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/fake/delete/Parameters.kt deleted file mode 100644 index ba70280cca5..00000000000 --- a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/fake/delete/Parameters.kt +++ /dev/null @@ -1,40 +0,0 @@ -package org.openapijsonschematools.client.paths.fake.delete; - -import org.openapijsonschematools.client.paths.fake.delete.parameters.Parameter0; -import org.openapijsonschematools.client.paths.fake.delete.parameters.Parameter1; -import org.openapijsonschematools.client.paths.fake.delete.parameters.Parameter2; -import org.openapijsonschematools.client.paths.fake.delete.parameters.Parameter3; -import org.openapijsonschematools.client.paths.fake.delete.parameters.Parameter4; -import org.openapijsonschematools.client.paths.fake.delete.parameters.Parameter5; -import org.openapijsonschematools.client.parameter.HeadersSerializer; -import org.openapijsonschematools.client.parameter.QuerySerializer; - -import java.util.Map; -import java.util.AbstractMap; - -public class Parameters { - - public static class QueryParametersSerializer extends QuerySerializer { - public QueryParametersSerializer() { - super( - Map.ofEntries( - new AbstractMap.SimpleEntry<>("required_string_group", new Parameter0.Parameter01()), - new AbstractMap.SimpleEntry<>("required_int64_group", new Parameter2.Parameter21()), - new AbstractMap.SimpleEntry<>("string_group", new Parameter3.Parameter31()), - new AbstractMap.SimpleEntry<>("int64_group", new Parameter5.Parameter51()) - ) - ); - } - } - - public static class HeaderParametersSerializer extends HeadersSerializer { - public HeaderParametersSerializer() { - super( - Map.ofEntries( - new AbstractMap.SimpleEntry<>("required_boolean_group", new Parameter1.Parameter11()), - new AbstractMap.SimpleEntry<>("boolean_group", new Parameter4.Parameter41()) - ) - ); - } - } -} diff --git a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/fake/delete/parameters/Parameter0.kt b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/fake/delete/parameters/Parameter0.kt deleted file mode 100644 index 5872e87f523..00000000000 --- a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/fake/delete/parameters/Parameter0.kt +++ /dev/null @@ -1,23 +0,0 @@ -package org.openapijsonschematools.client.paths.fake.delete.parameters; - -import org.openapijsonschematools.client.parameter.ParameterStyle; -import org.openapijsonschematools.client.parameter.ParameterInType; -import org.openapijsonschematools.client.parameter.SchemaParameter; -import org.openapijsonschematools.client.paths.fake.delete.parameters.parameter0.Schema0; - -public class Parameter0 { - - public static class Parameter01 extends SchemaParameter { - public Parameter01() { - super( - "required_string_group", - ParameterInType.QUERY, - true, - ParameterStyle.FORM, - true, - false, - Schema0.Schema01.getInstance() - ); - } - } -} diff --git a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/fake/delete/parameters/Parameter1.kt b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/fake/delete/parameters/Parameter1.kt deleted file mode 100644 index d74937b4fc9..00000000000 --- a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/fake/delete/parameters/Parameter1.kt +++ /dev/null @@ -1,23 +0,0 @@ -package org.openapijsonschematools.client.paths.fake.delete.parameters; - -import org.openapijsonschematools.client.parameter.ParameterStyle; -import org.openapijsonschematools.client.parameter.ParameterInType; -import org.openapijsonschematools.client.parameter.SchemaParameter; -import org.openapijsonschematools.client.paths.fake.delete.parameters.parameter1.Schema1; - -public class Parameter1 { - - public static class Parameter11 extends SchemaParameter { - public Parameter11() { - super( - "required_boolean_group", - ParameterInType.HEADER, - true, - ParameterStyle.SIMPLE, - false, - false, - Schema1.Schema11.getInstance() - ); - } - } -} diff --git a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/fake/delete/parameters/Parameter2.kt b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/fake/delete/parameters/Parameter2.kt deleted file mode 100644 index 9453ce7bcb3..00000000000 --- a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/fake/delete/parameters/Parameter2.kt +++ /dev/null @@ -1,23 +0,0 @@ -package org.openapijsonschematools.client.paths.fake.delete.parameters; - -import org.openapijsonschematools.client.parameter.ParameterStyle; -import org.openapijsonschematools.client.parameter.ParameterInType; -import org.openapijsonschematools.client.parameter.SchemaParameter; -import org.openapijsonschematools.client.paths.fake.delete.parameters.parameter2.Schema2; - -public class Parameter2 { - - public static class Parameter21 extends SchemaParameter { - public Parameter21() { - super( - "required_int64_group", - ParameterInType.QUERY, - true, - ParameterStyle.FORM, - true, - false, - Schema2.Schema21.getInstance() - ); - } - } -} diff --git a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/fake/delete/parameters/Parameter3.kt b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/fake/delete/parameters/Parameter3.kt deleted file mode 100644 index c2121467a18..00000000000 --- a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/fake/delete/parameters/Parameter3.kt +++ /dev/null @@ -1,23 +0,0 @@ -package org.openapijsonschematools.client.paths.fake.delete.parameters; - -import org.openapijsonschematools.client.parameter.ParameterStyle; -import org.openapijsonschematools.client.parameter.ParameterInType; -import org.openapijsonschematools.client.parameter.SchemaParameter; -import org.openapijsonschematools.client.paths.fake.delete.parameters.parameter3.Schema3; - -public class Parameter3 { - - public static class Parameter31 extends SchemaParameter { - public Parameter31() { - super( - "string_group", - ParameterInType.QUERY, - false, - ParameterStyle.FORM, - true, - false, - Schema3.Schema31.getInstance() - ); - } - } -} diff --git a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/fake/delete/parameters/Parameter4.kt b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/fake/delete/parameters/Parameter4.kt deleted file mode 100644 index c755206ddac..00000000000 --- a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/fake/delete/parameters/Parameter4.kt +++ /dev/null @@ -1,23 +0,0 @@ -package org.openapijsonschematools.client.paths.fake.delete.parameters; - -import org.openapijsonschematools.client.parameter.ParameterStyle; -import org.openapijsonschematools.client.parameter.ParameterInType; -import org.openapijsonschematools.client.parameter.SchemaParameter; -import org.openapijsonschematools.client.paths.fake.delete.parameters.parameter4.Schema4; - -public class Parameter4 { - - public static class Parameter41 extends SchemaParameter { - public Parameter41() { - super( - "boolean_group", - ParameterInType.HEADER, - false, - ParameterStyle.SIMPLE, - false, - false, - Schema4.Schema41.getInstance() - ); - } - } -} diff --git a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/fake/delete/parameters/Parameter5.kt b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/fake/delete/parameters/Parameter5.kt deleted file mode 100644 index 91ea65b5be7..00000000000 --- a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/fake/delete/parameters/Parameter5.kt +++ /dev/null @@ -1,23 +0,0 @@ -package org.openapijsonschematools.client.paths.fake.delete.parameters; - -import org.openapijsonschematools.client.parameter.ParameterStyle; -import org.openapijsonschematools.client.parameter.ParameterInType; -import org.openapijsonschematools.client.parameter.SchemaParameter; -import org.openapijsonschematools.client.paths.fake.delete.parameters.parameter5.Schema5; - -public class Parameter5 { - - public static class Parameter51 extends SchemaParameter { - public Parameter51() { - super( - "int64_group", - ParameterInType.QUERY, - false, - ParameterStyle.FORM, - true, - false, - Schema5.Schema51.getInstance() - ); - } - } -} diff --git a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/fake/delete/parameters/parameter0/Schema0.kt b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/fake/delete/parameters/parameter0/Schema0.kt deleted file mode 100644 index 85b207cd05f..00000000000 --- a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/fake/delete/parameters/parameter0/Schema0.kt +++ /dev/null @@ -1,19 +0,0 @@ -package org.openapijsonschematools.client.paths.fake.delete.parameters.parameter0; -import org.checkerframework.checker.nullness.qual.Nullable; -import org.openapijsonschematools.client.schemas.StringJsonSchema; - -public class Schema0 extends StringJsonSchema { - // nest classes so all schemas and input/output classes can be public - - - public static class Schema01 extends StringJsonSchema.StringJsonSchema1 { - private static @Nullable Schema01 instance = null; - public static Schema01 getInstance() { - if (instance == null) { - instance = new Schema01(); - } - return instance; - } - } - -} diff --git a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/fake/delete/parameters/parameter1/Schema1.kt b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/fake/delete/parameters/parameter1/Schema1.kt deleted file mode 100644 index ec9ab334ddc..00000000000 --- a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/fake/delete/parameters/parameter1/Schema1.kt +++ /dev/null @@ -1,114 +0,0 @@ -package org.openapijsonschematools.client.paths.fake.delete.parameters.parameter1; -import java.util.HashSet; -import java.util.LinkedHashSet; -import java.util.List; -import java.util.Objects; -import java.util.Set; -import org.checkerframework.checker.nullness.qual.Nullable; -import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags; -import org.openapijsonschematools.client.configurations.SchemaConfiguration; -import org.openapijsonschematools.client.exceptions.ValidationException; -import org.openapijsonschematools.client.schemas.SetMaker; -import org.openapijsonschematools.client.schemas.validation.JsonSchema; -import org.openapijsonschematools.client.schemas.validation.JsonSchemaInfo; -import org.openapijsonschematools.client.schemas.validation.PathToSchemasMap; -import org.openapijsonschematools.client.schemas.validation.StringEnumValidator; -import org.openapijsonschematools.client.schemas.validation.StringSchemaValidator; -import org.openapijsonschematools.client.schemas.validation.StringValueMethod; -import org.openapijsonschematools.client.schemas.validation.ValidationMetadata; - -public class Schema1 { - // nest classes so all schemas and input/output classes can be public - - public enum StringSchemaEnums1 implements StringValueMethod { - TRUE("true"), - FALSE("false"); - private final String value; - - StringSchemaEnums1(String value) { - this.value = value; - } - public String value() { - return this.value; - } - } - - - public sealed interface Schema11Boxed permits Schema11BoxedString { - @Nullable Object getData(); - } - - public record Schema11BoxedString(String data) implements Schema11Boxed { - @Override - public @Nullable Object getData() { - return data; - } - } - - - - public static class Schema11 extends JsonSchema implements StringSchemaValidator, StringEnumValidator { - private static @Nullable Schema11 instance = null; - - protected Schema11() { - super(new JsonSchemaInfo() - .type(Set.of( - String.class - )) - .enumValues(SetMaker.makeSet( - "true", - "false" - )) - ); - } - - public static Schema11 getInstance() { - if (instance == null) { - instance = new Schema11(); - } - return instance; - } - - @Override - public String validate(String arg, SchemaConfiguration configuration) throws ValidationException { - Set> pathSet = new HashSet<>(); - List pathToItem = List.of("args[0"); - String castArg = castToAllowedTypes(arg, pathToItem, pathSet); - SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().build())); - ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, new PathToSchemasMap(), new LinkedHashSet<>()); - getPathToSchemas(this, castArg, validationMetadata, pathSet); - return castArg; - } - - @Override - 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 { - 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"); - } - @Override - public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { - 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"); - } - @Override - 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 { - 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"); - } - } -} diff --git a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/fake/delete/parameters/parameter2/Schema2.kt b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/fake/delete/parameters/parameter2/Schema2.kt deleted file mode 100644 index 93cb91de837..00000000000 --- a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/fake/delete/parameters/parameter2/Schema2.kt +++ /dev/null @@ -1,19 +0,0 @@ -package org.openapijsonschematools.client.paths.fake.delete.parameters.parameter2; -import org.checkerframework.checker.nullness.qual.Nullable; -import org.openapijsonschematools.client.schemas.Int64JsonSchema; - -public class Schema2 extends Int64JsonSchema { - // nest classes so all schemas and input/output classes can be public - - - public static class Schema21 extends Int64JsonSchema.Int64JsonSchema1 { - private static @Nullable Schema21 instance = null; - public static Schema21 getInstance() { - if (instance == null) { - instance = new Schema21(); - } - return instance; - } - } - -} diff --git a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/fake/delete/parameters/parameter3/Schema3.kt b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/fake/delete/parameters/parameter3/Schema3.kt deleted file mode 100644 index 4ec69a80fc9..00000000000 --- a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/fake/delete/parameters/parameter3/Schema3.kt +++ /dev/null @@ -1,19 +0,0 @@ -package org.openapijsonschematools.client.paths.fake.delete.parameters.parameter3; -import org.checkerframework.checker.nullness.qual.Nullable; -import org.openapijsonschematools.client.schemas.StringJsonSchema; - -public class Schema3 extends StringJsonSchema { - // nest classes so all schemas and input/output classes can be public - - - public static class Schema31 extends StringJsonSchema.StringJsonSchema1 { - private static @Nullable Schema31 instance = null; - public static Schema31 getInstance() { - if (instance == null) { - instance = new Schema31(); - } - return instance; - } - } - -} diff --git a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/fake/delete/parameters/parameter4/Schema4.kt b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/fake/delete/parameters/parameter4/Schema4.kt deleted file mode 100644 index 023f18175d6..00000000000 --- a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/fake/delete/parameters/parameter4/Schema4.kt +++ /dev/null @@ -1,114 +0,0 @@ -package org.openapijsonschematools.client.paths.fake.delete.parameters.parameter4; -import java.util.HashSet; -import java.util.LinkedHashSet; -import java.util.List; -import java.util.Objects; -import java.util.Set; -import org.checkerframework.checker.nullness.qual.Nullable; -import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags; -import org.openapijsonschematools.client.configurations.SchemaConfiguration; -import org.openapijsonschematools.client.exceptions.ValidationException; -import org.openapijsonschematools.client.schemas.SetMaker; -import org.openapijsonschematools.client.schemas.validation.JsonSchema; -import org.openapijsonschematools.client.schemas.validation.JsonSchemaInfo; -import org.openapijsonschematools.client.schemas.validation.PathToSchemasMap; -import org.openapijsonschematools.client.schemas.validation.StringEnumValidator; -import org.openapijsonschematools.client.schemas.validation.StringSchemaValidator; -import org.openapijsonschematools.client.schemas.validation.StringValueMethod; -import org.openapijsonschematools.client.schemas.validation.ValidationMetadata; - -public class Schema4 { - // nest classes so all schemas and input/output classes can be public - - public enum StringSchemaEnums4 implements StringValueMethod { - TRUE("true"), - FALSE("false"); - private final String value; - - StringSchemaEnums4(String value) { - this.value = value; - } - public String value() { - return this.value; - } - } - - - public sealed interface Schema41Boxed permits Schema41BoxedString { - @Nullable Object getData(); - } - - public record Schema41BoxedString(String data) implements Schema41Boxed { - @Override - public @Nullable Object getData() { - return data; - } - } - - - - public static class Schema41 extends JsonSchema implements StringSchemaValidator, StringEnumValidator { - private static @Nullable Schema41 instance = null; - - protected Schema41() { - super(new JsonSchemaInfo() - .type(Set.of( - String.class - )) - .enumValues(SetMaker.makeSet( - "true", - "false" - )) - ); - } - - public static Schema41 getInstance() { - if (instance == null) { - instance = new Schema41(); - } - return instance; - } - - @Override - public String validate(String arg, SchemaConfiguration configuration) throws ValidationException { - Set> pathSet = new HashSet<>(); - List pathToItem = List.of("args[0"); - String castArg = castToAllowedTypes(arg, pathToItem, pathSet); - SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().build())); - ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, new PathToSchemasMap(), new LinkedHashSet<>()); - getPathToSchemas(this, castArg, validationMetadata, pathSet); - return castArg; - } - - @Override - 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 { - 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"); - } - @Override - public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { - 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"); - } - @Override - 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 { - 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"); - } - } -} diff --git a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/fake/delete/parameters/parameter5/Schema5.kt b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/fake/delete/parameters/parameter5/Schema5.kt deleted file mode 100644 index a15a29b9222..00000000000 --- a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/fake/delete/parameters/parameter5/Schema5.kt +++ /dev/null @@ -1,19 +0,0 @@ -package org.openapijsonschematools.client.paths.fake.delete.parameters.parameter5; -import org.checkerframework.checker.nullness.qual.Nullable; -import org.openapijsonschematools.client.schemas.Int64JsonSchema; - -public class Schema5 extends Int64JsonSchema { - // nest classes so all schemas and input/output classes can be public - - - public static class Schema51 extends Int64JsonSchema.Int64JsonSchema1 { - private static @Nullable Schema51 instance = null; - public static Schema51 getInstance() { - if (instance == null) { - instance = new Schema51(); - } - return instance; - } - } - -} diff --git a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/fake/delete/responses/FakeDeleteCode200Response.kt b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/fake/delete/responses/FakeDeleteCode200Response.kt deleted file mode 100644 index a9caf9729de..00000000000 --- a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/fake/delete/responses/FakeDeleteCode200Response.kt +++ /dev/null @@ -1,7 +0,0 @@ -package org.openapijsonschematools.client.paths.fake.delete.responses; - -import org.openapijsonschematools.client.components.responses.SuccessDescriptionOnly; - -public class FakeDeleteCode200Response extends SuccessDescriptionOnly { - public static class FakeDeleteCode200Response1 extends SuccessDescriptionOnly1 {} -} diff --git a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/fake/delete/security/FakeDeleteSecurityRequirementObject0.kt b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/fake/delete/security/FakeDeleteSecurityRequirementObject0.kt deleted file mode 100644 index a615af7f968..00000000000 --- a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/fake/delete/security/FakeDeleteSecurityRequirementObject0.kt +++ /dev/null @@ -1,24 +0,0 @@ -package org.openapijsonschematools.client.paths.fake.delete.security; - -import org.checkerframework.checker.nullness.qual.Nullable; -import org.openapijsonschematools.client.securityrequirementobjects.SecurityRequirementObject; -import org.openapijsonschematools.client.securityschemes.SecurityScheme; -import org.openapijsonschematools.client.components.securityschemes.BearerTest; - -import java.util.List; -import java.util.Map; -import java.util.AbstractMap; - -public class FakeDeleteSecurityRequirementObject0 extends SecurityRequirementObject { - - public FakeDeleteSecurityRequirementObject0() { - super( - Map.ofEntries( - new AbstractMap.SimpleEntry, List>( - BearerTest.class, - List.of() - ) - ) - ); - } -} diff --git a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/fake/get/FakeGetHeaderParameters.kt b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/fake/get/FakeGetHeaderParameters.kt deleted file mode 100644 index 03b879576ac..00000000000 --- a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/fake/get/FakeGetHeaderParameters.kt +++ /dev/null @@ -1,228 +0,0 @@ -package org.openapijsonschematools.client.paths.fake.get; -import java.util.ArrayList; -import java.util.HashSet; -import java.util.LinkedHashMap; -import java.util.LinkedHashSet; -import java.util.List; -import java.util.Map; -import java.util.Objects; -import java.util.Set; -import org.checkerframework.checker.nullness.qual.Nullable; -import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags; -import org.openapijsonschematools.client.configurations.SchemaConfiguration; -import org.openapijsonschematools.client.exceptions.UnsetPropertyException; -import org.openapijsonschematools.client.exceptions.ValidationException; -import org.openapijsonschematools.client.paths.fake.get.parameters.parameter0.Schema0; -import org.openapijsonschematools.client.paths.fake.get.parameters.parameter1.Schema1; -import org.openapijsonschematools.client.schemas.AnyTypeJsonSchema; -import org.openapijsonschematools.client.schemas.GenericBuilder; -import org.openapijsonschematools.client.schemas.NotAnyTypeJsonSchema; -import org.openapijsonschematools.client.schemas.validation.FrozenMap; -import org.openapijsonschematools.client.schemas.validation.JsonSchema; -import org.openapijsonschematools.client.schemas.validation.JsonSchemaInfo; -import org.openapijsonschematools.client.schemas.validation.MapSchemaValidator; -import org.openapijsonschematools.client.schemas.validation.MapUtils; -import org.openapijsonschematools.client.schemas.validation.PathToSchemasMap; -import org.openapijsonschematools.client.schemas.validation.PropertyEntry; -import org.openapijsonschematools.client.schemas.validation.ValidationMetadata; - -public class FakeGetHeaderParameters { - // nest classes so all schemas and input/output classes can be public - - - public static class AdditionalProperties extends NotAnyTypeJsonSchema.NotAnyTypeJsonSchema1 { - // NotAnyTypeSchema - private static @Nullable AdditionalProperties instance = null; - public static AdditionalProperties getInstance() { - if (instance == null) { - instance = new AdditionalProperties(); - } - return instance; - } - } - - - public static class HeaderParametersMap extends FrozenMap<@Nullable Object> { - protected HeaderParametersMap(FrozenMap<@Nullable Object> m) { - super(m); - } - public static final Set requiredKeys = Set.of(); - public static final Set optionalKeys = Set.of( - "enum_header_string", - "enum_header_string_array" - ); - public static HeaderParametersMap of(Map arg, SchemaConfiguration configuration) throws ValidationException { - return FakeGetHeaderParameters1.getInstance().validate(arg, configuration); - } - - public String enum_header_string() throws UnsetPropertyException { - String key = "enum_header_string"; - throwIfKeyNotPresent(key); - @Nullable Object value = get(key); - if (!(value instanceof String)) { - throw new RuntimeException("Invalid value stored for enum_header_string"); - } - return (String) value; - } - - public Schema0.SchemaList0 enum_header_string_array() throws UnsetPropertyException { - String key = "enum_header_string_array"; - throwIfKeyNotPresent(key); - @Nullable Object value = get(key); - if (!(value instanceof Schema0.SchemaList0)) { - throw new RuntimeException("Invalid value stored for enum_header_string_array"); - } - return (Schema0.SchemaList0) value; - } - } - - public interface SetterForEnumHeaderString { - Map getInstance(); - T getBuilderAfterEnumHeaderString(Map instance); - - default T enum_header_string(String value) { - var instance = getInstance(); - instance.put("enum_header_string", value); - return getBuilderAfterEnumHeaderString(instance); - } - - default T enum_header_string(Schema1.StringSchemaEnums1 value) { - var instance = getInstance(); - instance.put("enum_header_string", value.value()); - return getBuilderAfterEnumHeaderString(instance); - } - } - - public interface SetterForEnumHeaderStringArray { - Map getInstance(); - T getBuilderAfterEnumHeaderStringArray(Map instance); - - default T enum_header_string_array(List value) { - var instance = getInstance(); - instance.put("enum_header_string_array", value); - return getBuilderAfterEnumHeaderStringArray(instance); - } - } - - public static class HeaderParametersMapBuilder implements GenericBuilder>, SetterForEnumHeaderString, SetterForEnumHeaderStringArray { - private final Map instance; - private static final Set knownKeys = Set.of( - "enum_header_string", - "enum_header_string_array" - ); - public Set getKnownKeys() { - return knownKeys; - } - public HeaderParametersMapBuilder() { - this.instance = new LinkedHashMap<>(); - } - public Map build() { - return instance; - } - public Map getInstance() { - return instance; - } - public HeaderParametersMapBuilder getBuilderAfterEnumHeaderString(Map instance) { - return this; - } - public HeaderParametersMapBuilder getBuilderAfterEnumHeaderStringArray(Map instance) { - return this; - } - } - - - public sealed interface FakeGetHeaderParameters1Boxed permits FakeGetHeaderParameters1BoxedMap { - @Nullable Object getData(); - } - - public record FakeGetHeaderParameters1BoxedMap(HeaderParametersMap data) implements FakeGetHeaderParameters1Boxed { - @Override - public @Nullable Object getData() { - return data; - } - } - - - public static class FakeGetHeaderParameters1 extends JsonSchema implements MapSchemaValidator { - private static @Nullable FakeGetHeaderParameters1 instance = null; - - protected FakeGetHeaderParameters1() { - super(new JsonSchemaInfo() - .type(Set.of(Map.class)) - .properties(Map.ofEntries( - new PropertyEntry("enum_header_string", Schema1.Schema11.class), - new PropertyEntry("enum_header_string_array", Schema0.Schema01.class) - )) - .additionalProperties(AdditionalProperties.class) - ); - } - - public static FakeGetHeaderParameters1 getInstance() { - if (instance == null) { - instance = new FakeGetHeaderParameters1(); - } - return instance; - } - - 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 RuntimeException("Invalid non-string key value"); - } - String propertyName = (String) entryKey; - List propertyPathToItem = new ArrayList<>(pathToItem); - propertyPathToItem.add(propertyName); - Object value = entry.getValue(); - LinkedHashMap, Nothing?> schemas = pathToSchemas.get(propertyPathToItem); - if (schemas == null) { - throw new RuntimeException("Validation result is invalid, schemas must exist for a pathToItem"); - } - JsonSchema propertySchema = schemas.entrySet().iterator().next().getKey(); - @Nullable Object propertyInstance = propertySchema.getNewInstance(value, propertyPathToItem, pathToSchemas); - properties.put(propertyName, propertyInstance); - } - FrozenMap<@Nullable Object> castProperties = new FrozenMap<>(properties); - return new HeaderParametersMap(castProperties); - } - - 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); - SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().build())); - ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, new PathToSchemasMap(), new LinkedHashSet<>()); - PathToSchemasMap pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet); - return getNewInstance(castArg, validationMetadata.pathToItem(), pathToSchemasMap); - } - - - @Override - public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws 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"); - } - @Override - public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { - if (arg instanceof Map) { - return getNewInstance((Map) arg, pathToItem, pathToSchemas); - } - throw new RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); - } - @Override - public FakeGetHeaderParameters1BoxedMap validateAndBox(Map arg, SchemaConfiguration configuration) throws ValidationException { - return new FakeGetHeaderParameters1BoxedMap(validate(arg, configuration)); - } - @Override - public FakeGetHeaderParameters1Boxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { - 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"); - } - } - -} diff --git a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/fake/get/FakeGetQueryParameters.kt b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/fake/get/FakeGetQueryParameters.kt deleted file mode 100644 index 9a2cb296ff6..00000000000 --- a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/fake/get/FakeGetQueryParameters.kt +++ /dev/null @@ -1,344 +0,0 @@ -package org.openapijsonschematools.client.paths.fake.get; -import java.util.ArrayList; -import java.util.HashSet; -import java.util.LinkedHashMap; -import java.util.LinkedHashSet; -import java.util.List; -import java.util.Map; -import java.util.Objects; -import java.util.Set; -import org.checkerframework.checker.nullness.qual.Nullable; -import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags; -import org.openapijsonschematools.client.configurations.SchemaConfiguration; -import org.openapijsonschematools.client.exceptions.UnsetPropertyException; -import org.openapijsonschematools.client.exceptions.ValidationException; -import org.openapijsonschematools.client.paths.fake.get.parameters.parameter2.Schema2; -import org.openapijsonschematools.client.paths.fake.get.parameters.parameter3.Schema3; -import org.openapijsonschematools.client.paths.fake.get.parameters.parameter4.Schema4; -import org.openapijsonschematools.client.paths.fake.get.parameters.parameter5.Schema5; -import org.openapijsonschematools.client.schemas.AnyTypeJsonSchema; -import org.openapijsonschematools.client.schemas.GenericBuilder; -import org.openapijsonschematools.client.schemas.NotAnyTypeJsonSchema; -import org.openapijsonschematools.client.schemas.validation.FrozenMap; -import org.openapijsonschematools.client.schemas.validation.JsonSchema; -import org.openapijsonschematools.client.schemas.validation.JsonSchemaInfo; -import org.openapijsonschematools.client.schemas.validation.MapSchemaValidator; -import org.openapijsonschematools.client.schemas.validation.MapUtils; -import org.openapijsonschematools.client.schemas.validation.PathToSchemasMap; -import org.openapijsonschematools.client.schemas.validation.PropertyEntry; -import org.openapijsonschematools.client.schemas.validation.ValidationMetadata; - -public class FakeGetQueryParameters { - // nest classes so all schemas and input/output classes can be public - - - public static class AdditionalProperties extends NotAnyTypeJsonSchema.NotAnyTypeJsonSchema1 { - // NotAnyTypeSchema - private static @Nullable AdditionalProperties instance = null; - public static AdditionalProperties getInstance() { - if (instance == null) { - instance = new AdditionalProperties(); - } - return instance; - } - } - - - public static class QueryParametersMap extends FrozenMap<@Nullable Object> { - protected QueryParametersMap(FrozenMap<@Nullable Object> m) { - super(m); - } - public static final Set requiredKeys = Set.of(); - public static final Set optionalKeys = Set.of( - "enum_query_double", - "enum_query_string", - "enum_query_integer", - "enum_query_string_array" - ); - public static QueryParametersMap of(Map arg, SchemaConfiguration configuration) throws ValidationException { - return FakeGetQueryParameters1.getInstance().validate(arg, configuration); - } - - public Number enum_query_double() throws UnsetPropertyException { - String key = "enum_query_double"; - throwIfKeyNotPresent(key); - @Nullable Object value = get(key); - if (!(value instanceof Number)) { - throw new RuntimeException("Invalid value stored for enum_query_double"); - } - return (Number) value; - } - - public String enum_query_string() throws UnsetPropertyException { - String key = "enum_query_string"; - throwIfKeyNotPresent(key); - @Nullable Object value = get(key); - if (!(value instanceof String)) { - throw new RuntimeException("Invalid value stored for enum_query_string"); - } - return (String) value; - } - - public Number enum_query_integer() throws UnsetPropertyException { - String key = "enum_query_integer"; - throwIfKeyNotPresent(key); - @Nullable Object value = get(key); - if (!(value instanceof Number)) { - throw new RuntimeException("Invalid value stored for enum_query_integer"); - } - return (Number) value; - } - - public Schema2.SchemaList2 enum_query_string_array() throws UnsetPropertyException { - String key = "enum_query_string_array"; - throwIfKeyNotPresent(key); - @Nullable Object value = get(key); - if (!(value instanceof Schema2.SchemaList2)) { - throw new RuntimeException("Invalid value stored for enum_query_string_array"); - } - return (Schema2.SchemaList2) value; - } - } - - public interface SetterForEnumQueryDouble { - Map getInstance(); - T getBuilderAfterEnumQueryDouble(Map instance); - - default T enum_query_double(int value) { - var instance = getInstance(); - instance.put("enum_query_double", value); - return getBuilderAfterEnumQueryDouble(instance); - } - - default T enum_query_double(float value) { - var instance = getInstance(); - instance.put("enum_query_double", value); - return getBuilderAfterEnumQueryDouble(instance); - } - - default T enum_query_double(long value) { - var instance = getInstance(); - instance.put("enum_query_double", value); - return getBuilderAfterEnumQueryDouble(instance); - } - - default T enum_query_double(double value) { - var instance = getInstance(); - instance.put("enum_query_double", value); - return getBuilderAfterEnumQueryDouble(instance); - } - - default T enum_query_double(Schema5.DoubleSchemaEnums5 value) { - var instance = getInstance(); - instance.put("enum_query_double", value.value()); - return getBuilderAfterEnumQueryDouble(instance); - } - - default T enum_query_double(Schema5.FloatSchemaEnums5 value) { - var instance = getInstance(); - instance.put("enum_query_double", value.value()); - return getBuilderAfterEnumQueryDouble(instance); - } - } - - public interface SetterForEnumQueryString { - Map getInstance(); - T getBuilderAfterEnumQueryString(Map instance); - - default T enum_query_string(String value) { - var instance = getInstance(); - instance.put("enum_query_string", value); - return getBuilderAfterEnumQueryString(instance); - } - - default T enum_query_string(Schema3.StringSchemaEnums3 value) { - var instance = getInstance(); - instance.put("enum_query_string", value.value()); - return getBuilderAfterEnumQueryString(instance); - } - } - - public interface SetterForEnumQueryInteger { - Map getInstance(); - T getBuilderAfterEnumQueryInteger(Map instance); - - default T enum_query_integer(int value) { - var instance = getInstance(); - instance.put("enum_query_integer", value); - return getBuilderAfterEnumQueryInteger(instance); - } - - default T enum_query_integer(float value) { - var instance = getInstance(); - instance.put("enum_query_integer", value); - return getBuilderAfterEnumQueryInteger(instance); - } - - default T enum_query_integer(Schema4.IntegerSchemaEnums4 value) { - var instance = getInstance(); - instance.put("enum_query_integer", value.value()); - return getBuilderAfterEnumQueryInteger(instance); - } - - default T enum_query_integer(Schema4.LongSchemaEnums4 value) { - var instance = getInstance(); - instance.put("enum_query_integer", value.value()); - return getBuilderAfterEnumQueryInteger(instance); - } - - default T enum_query_integer(Schema4.FloatSchemaEnums4 value) { - var instance = getInstance(); - instance.put("enum_query_integer", value.value()); - return getBuilderAfterEnumQueryInteger(instance); - } - - default T enum_query_integer(Schema4.DoubleSchemaEnums4 value) { - var instance = getInstance(); - instance.put("enum_query_integer", value.value()); - return getBuilderAfterEnumQueryInteger(instance); - } - } - - public interface SetterForEnumQueryStringArray { - Map getInstance(); - T getBuilderAfterEnumQueryStringArray(Map instance); - - default T enum_query_string_array(List value) { - var instance = getInstance(); - instance.put("enum_query_string_array", value); - return getBuilderAfterEnumQueryStringArray(instance); - } - } - - public static class QueryParametersMapBuilder implements GenericBuilder>, SetterForEnumQueryDouble, SetterForEnumQueryString, SetterForEnumQueryInteger, SetterForEnumQueryStringArray { - private final Map instance; - private static final Set knownKeys = Set.of( - "enum_query_double", - "enum_query_string", - "enum_query_integer", - "enum_query_string_array" - ); - public Set getKnownKeys() { - return knownKeys; - } - public QueryParametersMapBuilder() { - this.instance = new LinkedHashMap<>(); - } - public Map build() { - return instance; - } - public Map getInstance() { - return instance; - } - public QueryParametersMapBuilder getBuilderAfterEnumQueryDouble(Map instance) { - return this; - } - public QueryParametersMapBuilder getBuilderAfterEnumQueryString(Map instance) { - return this; - } - public QueryParametersMapBuilder getBuilderAfterEnumQueryInteger(Map instance) { - return this; - } - public QueryParametersMapBuilder getBuilderAfterEnumQueryStringArray(Map instance) { - return this; - } - } - - - public sealed interface FakeGetQueryParameters1Boxed permits FakeGetQueryParameters1BoxedMap { - @Nullable Object getData(); - } - - public record FakeGetQueryParameters1BoxedMap(QueryParametersMap data) implements FakeGetQueryParameters1Boxed { - @Override - public @Nullable Object getData() { - return data; - } - } - - - public static class FakeGetQueryParameters1 extends JsonSchema implements MapSchemaValidator { - private static @Nullable FakeGetQueryParameters1 instance = null; - - protected FakeGetQueryParameters1() { - super(new JsonSchemaInfo() - .type(Set.of(Map.class)) - .properties(Map.ofEntries( - new PropertyEntry("enum_query_double", Schema5.Schema51.class), - new PropertyEntry("enum_query_string", Schema3.Schema31.class), - new PropertyEntry("enum_query_integer", Schema4.Schema41.class), - new PropertyEntry("enum_query_string_array", Schema2.Schema21.class) - )) - .additionalProperties(AdditionalProperties.class) - ); - } - - public static FakeGetQueryParameters1 getInstance() { - if (instance == null) { - instance = new FakeGetQueryParameters1(); - } - return instance; - } - - 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 RuntimeException("Invalid non-string key value"); - } - String propertyName = (String) entryKey; - List propertyPathToItem = new ArrayList<>(pathToItem); - propertyPathToItem.add(propertyName); - Object value = entry.getValue(); - LinkedHashMap, Nothing?> schemas = pathToSchemas.get(propertyPathToItem); - if (schemas == null) { - throw new RuntimeException("Validation result is invalid, schemas must exist for a pathToItem"); - } - JsonSchema propertySchema = schemas.entrySet().iterator().next().getKey(); - @Nullable Object propertyInstance = propertySchema.getNewInstance(value, propertyPathToItem, pathToSchemas); - properties.put(propertyName, propertyInstance); - } - FrozenMap<@Nullable Object> castProperties = new FrozenMap<>(properties); - return new QueryParametersMap(castProperties); - } - - 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); - SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().build())); - ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, new PathToSchemasMap(), new LinkedHashSet<>()); - PathToSchemasMap pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet); - return getNewInstance(castArg, validationMetadata.pathToItem(), pathToSchemasMap); - } - - - @Override - public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws 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"); - } - @Override - public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { - if (arg instanceof Map) { - return getNewInstance((Map) arg, pathToItem, pathToSchemas); - } - throw new RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); - } - @Override - public FakeGetQueryParameters1BoxedMap validateAndBox(Map arg, SchemaConfiguration configuration) throws ValidationException { - return new FakeGetQueryParameters1BoxedMap(validate(arg, configuration)); - } - @Override - public FakeGetQueryParameters1Boxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { - 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"); - } - } - -} diff --git a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/fake/get/FakeGetRequestBody.kt b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/fake/get/FakeGetRequestBody.kt deleted file mode 100644 index 8bc6fc506a3..00000000000 --- a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/fake/get/FakeGetRequestBody.kt +++ /dev/null @@ -1,49 +0,0 @@ -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; -import org.openapijsonschematools.client.mediatype.MediaType; -import org.openapijsonschematools.client.paths.fake.get.requestbody.content.applicationxwwwformurlencoded.ApplicationxwwwformurlencodedSchema; - -import java.util.AbstractMap; -import java.util.Map; - -public class FakeGetRequestBody { - public sealed interface SealedMediaType permits ApplicationxwwwformurlencodedMediaType {} - - public record ApplicationxwwwformurlencodedMediaType(ApplicationxwwwformurlencodedSchema.ApplicationxwwwformurlencodedSchema1 schema) implements SealedMediaType, MediaType { - public ApplicationxwwwformurlencodedMediaType() { - this(ApplicationxwwwformurlencodedSchema.ApplicationxwwwformurlencodedSchema1.getInstance()); - } - @Override - public Nothing? encoding() { - return null; - } - } - - public static class FakeGetRequestBody1 extends RequestBodySerializer { - public FakeGetRequestBody1() { - super( - Map.ofEntries( - new AbstractMap.SimpleEntry<>("application/x-www-form-urlencoded", new ApplicationxwwwformurlencodedMediaType()) - ), - false - ); - } - - public SerializedRequestBody serialize(SealedRequestBody requestBody) throws NotImplementedException { - ApplicationxwwwformurlencodedRequestBody requestBody0 = (ApplicationxwwwformurlencodedRequestBody) requestBody; - return serialize(requestBody0.contentType(), requestBody0.body().getData()); - } - } - - public sealed interface SealedRequestBody permits ApplicationxwwwformurlencodedRequestBody {} - public record ApplicationxwwwformurlencodedRequestBody(ApplicationxwwwformurlencodedSchema.ApplicationxwwwformurlencodedSchema1Boxed body) implements SealedRequestBody, GenericRequestBody { - @Override - public String contentType() { - return "application/x-www-form-urlencoded"; - } - } -} diff --git a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/fake/get/FakeGetResponses.kt b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/fake/get/FakeGetResponses.kt deleted file mode 100644 index d275daaec8a..00000000000 --- a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/fake/get/FakeGetResponses.kt +++ /dev/null @@ -1,66 +0,0 @@ -package org.openapijsonschematools.client.paths.fake.get; - -import org.openapijsonschematools.client.paths.fake.get.responses.FakeGetCode200Response; -import org.openapijsonschematools.client.paths.fake.get.responses.FakeGetCode404Response; -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; -import org.checkerframework.checker.nullness.qual.Nullable; - -import java.net.http.HttpResponse; -import java.util.Map; -import java.util.AbstractMap; - -public class FakeGetResponses { - public sealed interface EndpointResponse permits EndpointFakeGetCode200Response {} - - public record EndpointFakeGetCode200Response( - HttpResponse response, - Nothing? body, - Nothing? headers - ) implements EndpointResponse, ApiResponse{ - } - - public sealed interface StatusCodeResponseDeserializer permits StatusFakeGetCode200ResponseDeserializer, StatusFakeGetCode404ResponseDeserializer {} - - public static final class StatusFakeGetCode200ResponseDeserializer extends FakeGetCode200Response.FakeGetCode200Response1 implements StatusCodeResponseDeserializer { - } - public static final class StatusFakeGetCode404ResponseDeserializer extends FakeGetCode404Response.FakeGetCode404Response1 implements StatusCodeResponseDeserializer { - } - - public static final class FakeGetResponses1 implements ResponsesDeserializer { - private final Map statusCodeToResponseDeserializer; - public FakeGetResponses1() { - this.statusCodeToResponseDeserializer = Map.ofEntries( - new AbstractMap.SimpleEntry<>("200", new StatusFakeGetCode200ResponseDeserializer()), - new AbstractMap.SimpleEntry<>("404", new StatusFakeGetCode404ResponseDeserializer()) - ); - } - - 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) { - throw new ApiException( - "Invalid response statusCode="+statusCode+" has no response defined in the openapi document", - response - ); - } - if (statusCodeDeserializer instanceof StatusFakeGetCode200ResponseDeserializer castDeserializer) { - var deserializedResponse = castDeserializer.deserialize(response, configuration); - return new EndpointFakeGetCode200Response(response, deserializedResponse.body(), deserializedResponse.headers()); - } else { - StatusFakeGetCode404ResponseDeserializer castDeserializer = (StatusFakeGetCode404ResponseDeserializer) statusCodeDeserializer; - var deserializedResponse = castDeserializer.deserialize(response, configuration); - throw new FakeGetCode404Response.ResponseApiException( - "Received error statusCode response from server", - response, - deserializedResponse - ); - } - } - } -} diff --git a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/fake/get/Parameters.kt b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/fake/get/Parameters.kt deleted file mode 100644 index c5b3e142015..00000000000 --- a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/fake/get/Parameters.kt +++ /dev/null @@ -1,40 +0,0 @@ -package org.openapijsonschematools.client.paths.fake.get; - -import org.openapijsonschematools.client.paths.fake.get.parameters.Parameter0; -import org.openapijsonschematools.client.paths.fake.get.parameters.Parameter1; -import org.openapijsonschematools.client.paths.fake.get.parameters.Parameter2; -import org.openapijsonschematools.client.paths.fake.get.parameters.Parameter3; -import org.openapijsonschematools.client.paths.fake.get.parameters.Parameter4; -import org.openapijsonschematools.client.paths.fake.get.parameters.Parameter5; -import org.openapijsonschematools.client.parameter.HeadersSerializer; -import org.openapijsonschematools.client.parameter.QuerySerializer; - -import java.util.Map; -import java.util.AbstractMap; - -public class Parameters { - - public static class QueryParametersSerializer extends QuerySerializer { - public QueryParametersSerializer() { - super( - Map.ofEntries( - new AbstractMap.SimpleEntry<>("enum_query_string_array", new Parameter2.Parameter21()), - new AbstractMap.SimpleEntry<>("enum_query_string", new Parameter3.Parameter31()), - new AbstractMap.SimpleEntry<>("enum_query_integer", new Parameter4.Parameter41()), - new AbstractMap.SimpleEntry<>("enum_query_double", new Parameter5.Parameter51()) - ) - ); - } - } - - public static class HeaderParametersSerializer extends HeadersSerializer { - public HeaderParametersSerializer() { - super( - Map.ofEntries( - new AbstractMap.SimpleEntry<>("enum_header_string_array", new Parameter0.Parameter01()), - new AbstractMap.SimpleEntry<>("enum_header_string", new Parameter1.Parameter11()) - ) - ); - } - } -} diff --git a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/fake/get/parameters/Parameter0.kt b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/fake/get/parameters/Parameter0.kt deleted file mode 100644 index 3a8537f7fd1..00000000000 --- a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/fake/get/parameters/Parameter0.kt +++ /dev/null @@ -1,23 +0,0 @@ -package org.openapijsonschematools.client.paths.fake.get.parameters; - -import org.openapijsonschematools.client.parameter.ParameterStyle; -import org.openapijsonschematools.client.parameter.ParameterInType; -import org.openapijsonschematools.client.parameter.SchemaParameter; -import org.openapijsonschematools.client.paths.fake.get.parameters.parameter0.Schema0; - -public class Parameter0 { - - public static class Parameter01 extends SchemaParameter { - public Parameter01() { - super( - "enum_header_string_array", - ParameterInType.HEADER, - false, - ParameterStyle.SIMPLE, - false, - false, - Schema0.Schema01.getInstance() - ); - } - } -} diff --git a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/fake/get/parameters/Parameter1.kt b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/fake/get/parameters/Parameter1.kt deleted file mode 100644 index 49e947d6399..00000000000 --- a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/fake/get/parameters/Parameter1.kt +++ /dev/null @@ -1,23 +0,0 @@ -package org.openapijsonschematools.client.paths.fake.get.parameters; - -import org.openapijsonschematools.client.parameter.ParameterStyle; -import org.openapijsonschematools.client.parameter.ParameterInType; -import org.openapijsonschematools.client.parameter.SchemaParameter; -import org.openapijsonschematools.client.paths.fake.get.parameters.parameter1.Schema1; - -public class Parameter1 { - - public static class Parameter11 extends SchemaParameter { - public Parameter11() { - super( - "enum_header_string", - ParameterInType.HEADER, - false, - ParameterStyle.SIMPLE, - false, - false, - Schema1.Schema11.getInstance() - ); - } - } -} diff --git a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/fake/get/parameters/Parameter2.kt b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/fake/get/parameters/Parameter2.kt deleted file mode 100644 index 71e3f589257..00000000000 --- a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/fake/get/parameters/Parameter2.kt +++ /dev/null @@ -1,23 +0,0 @@ -package org.openapijsonschematools.client.paths.fake.get.parameters; - -import org.openapijsonschematools.client.parameter.ParameterStyle; -import org.openapijsonschematools.client.parameter.ParameterInType; -import org.openapijsonschematools.client.parameter.SchemaParameter; -import org.openapijsonschematools.client.paths.fake.get.parameters.parameter2.Schema2; - -public class Parameter2 { - - public static class Parameter21 extends SchemaParameter { - public Parameter21() { - super( - "enum_query_string_array", - ParameterInType.QUERY, - false, - ParameterStyle.FORM, - true, - false, - Schema2.Schema21.getInstance() - ); - } - } -} diff --git a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/fake/get/parameters/Parameter3.kt b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/fake/get/parameters/Parameter3.kt deleted file mode 100644 index 9903092e80d..00000000000 --- a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/fake/get/parameters/Parameter3.kt +++ /dev/null @@ -1,23 +0,0 @@ -package org.openapijsonschematools.client.paths.fake.get.parameters; - -import org.openapijsonschematools.client.parameter.ParameterStyle; -import org.openapijsonschematools.client.parameter.ParameterInType; -import org.openapijsonschematools.client.parameter.SchemaParameter; -import org.openapijsonschematools.client.paths.fake.get.parameters.parameter3.Schema3; - -public class Parameter3 { - - public static class Parameter31 extends SchemaParameter { - public Parameter31() { - super( - "enum_query_string", - ParameterInType.QUERY, - false, - ParameterStyle.FORM, - true, - false, - Schema3.Schema31.getInstance() - ); - } - } -} diff --git a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/fake/get/parameters/Parameter4.kt b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/fake/get/parameters/Parameter4.kt deleted file mode 100644 index 21bf1787d8a..00000000000 --- a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/fake/get/parameters/Parameter4.kt +++ /dev/null @@ -1,23 +0,0 @@ -package org.openapijsonschematools.client.paths.fake.get.parameters; - -import org.openapijsonschematools.client.parameter.ParameterStyle; -import org.openapijsonschematools.client.parameter.ParameterInType; -import org.openapijsonschematools.client.parameter.SchemaParameter; -import org.openapijsonschematools.client.paths.fake.get.parameters.parameter4.Schema4; - -public class Parameter4 { - - public static class Parameter41 extends SchemaParameter { - public Parameter41() { - super( - "enum_query_integer", - ParameterInType.QUERY, - false, - ParameterStyle.FORM, - true, - false, - Schema4.Schema41.getInstance() - ); - } - } -} diff --git a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/fake/get/parameters/Parameter5.kt b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/fake/get/parameters/Parameter5.kt deleted file mode 100644 index 7fb91fb88f0..00000000000 --- a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/fake/get/parameters/Parameter5.kt +++ /dev/null @@ -1,23 +0,0 @@ -package org.openapijsonschematools.client.paths.fake.get.parameters; - -import org.openapijsonschematools.client.parameter.ParameterStyle; -import org.openapijsonschematools.client.parameter.ParameterInType; -import org.openapijsonschematools.client.parameter.SchemaParameter; -import org.openapijsonschematools.client.paths.fake.get.parameters.parameter5.Schema5; - -public class Parameter5 { - - public static class Parameter51 extends SchemaParameter { - public Parameter51() { - super( - "enum_query_double", - ParameterInType.QUERY, - false, - ParameterStyle.FORM, - true, - false, - Schema5.Schema51.getInstance() - ); - } - } -} diff --git a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/fake/get/parameters/parameter0/Schema0.kt b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/fake/get/parameters/parameter0/Schema0.kt deleted file mode 100644 index 0fcf8beed4c..00000000000 --- a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/fake/get/parameters/parameter0/Schema0.kt +++ /dev/null @@ -1,253 +0,0 @@ -package org.openapijsonschematools.client.paths.fake.get.parameters.parameter0; -import java.util.ArrayList; -import java.util.HashSet; -import java.util.LinkedHashMap; -import java.util.LinkedHashSet; -import java.util.List; -import java.util.Objects; -import java.util.Set; -import org.checkerframework.checker.nullness.qual.Nullable; -import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags; -import org.openapijsonschematools.client.configurations.SchemaConfiguration; -import org.openapijsonschematools.client.exceptions.ValidationException; -import org.openapijsonschematools.client.schemas.SetMaker; -import org.openapijsonschematools.client.schemas.validation.DefaultValueMethod; -import org.openapijsonschematools.client.schemas.validation.FrozenList; -import org.openapijsonschematools.client.schemas.validation.JsonSchema; -import org.openapijsonschematools.client.schemas.validation.JsonSchemaInfo; -import org.openapijsonschematools.client.schemas.validation.ListSchemaValidator; -import org.openapijsonschematools.client.schemas.validation.PathToSchemasMap; -import org.openapijsonschematools.client.schemas.validation.StringEnumValidator; -import org.openapijsonschematools.client.schemas.validation.StringSchemaValidator; -import org.openapijsonschematools.client.schemas.validation.StringValueMethod; -import org.openapijsonschematools.client.schemas.validation.ValidationMetadata; - -public class Schema0 { - // nest classes so all schemas and input/output classes can be public - - public enum StringItemsEnums0 implements StringValueMethod { - GREATER_THAN_SIGN(">"), - DOLLAR_SIGN("$"); - private final String value; - - StringItemsEnums0(String value) { - this.value = value; - } - public String value() { - return this.value; - } - } - - - public sealed interface Items0Boxed permits Items0BoxedString { - @Nullable Object getData(); - } - - public record Items0BoxedString(String data) implements Items0Boxed { - @Override - public @Nullable Object getData() { - return data; - } - } - - - - public static class Items0 extends JsonSchema implements StringSchemaValidator, StringEnumValidator, DefaultValueMethod { - private static @Nullable Items0 instance = null; - - protected Items0() { - super(new JsonSchemaInfo() - .type(Set.of( - String.class - )) - .enumValues(SetMaker.makeSet( - ">", - "$" - )) - .defaultValue("$") - ); - } - - public static Items0 getInstance() { - if (instance == null) { - instance = new Items0(); - } - return instance; - } - - @Override - public String validate(String arg, SchemaConfiguration configuration) throws ValidationException { - Set> pathSet = new HashSet<>(); - List pathToItem = List.of("args[0"); - String castArg = castToAllowedTypes(arg, pathToItem, pathSet); - SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().build())); - ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, new PathToSchemasMap(), new LinkedHashSet<>()); - getPathToSchemas(this, castArg, validationMetadata, pathSet); - return castArg; - } - - @Override - 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 { - 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"); - } - @Override - public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { - 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"); - } - public String defaultValue() throws ValidationException { - if (defaultValue instanceof String) { - return (String) defaultValue; - } - throw new ValidationException("Invalid type stored in defaultValue"); - } - @Override - 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 { - 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"); - } - } - - public static class SchemaList0 extends FrozenList { - protected SchemaList0(FrozenList m) { - super(m); - } - public static SchemaList0 of(List arg, SchemaConfiguration configuration) throws ValidationException { - return Schema01.getInstance().validate(arg, configuration); - } - } - - public static class SchemaListBuilder0 { - // class to build List - private final List list; - - public SchemaListBuilder0() { - list = new ArrayList<>(); - } - - public SchemaListBuilder0(List list) { - this.list = list; - } - - public SchemaListBuilder0 add(String item) { - list.add(item); - return this; - } - - public SchemaListBuilder0 add(StringItemsEnums0 item) { - list.add(item.value()); - return this; - } - - public List build() { - return list; - } - } - - - public sealed interface Schema01Boxed permits Schema01BoxedList { - @Nullable Object getData(); - } - - public record Schema01BoxedList(SchemaList0 data) implements Schema01Boxed { - @Override - public @Nullable Object getData() { - return data; - } - } - - - - public static class Schema01 extends JsonSchema implements ListSchemaValidator { - private static @Nullable Schema01 instance = null; - - protected Schema01() { - super(new JsonSchemaInfo() - .type(Set.of(List.class)) - .items(Items0.class) - ); - } - - public static Schema01 getInstance() { - if (instance == null) { - instance = new Schema01(); - } - return instance; - } - - @Override - public SchemaList0 getNewInstance(List arg, List pathToItem, PathToSchemasMap pathToSchemas) { - List items = new ArrayList<>(); - int i = 0; - for (Object item: arg) { - List itemPathToItem = new ArrayList<>(pathToItem); - itemPathToItem.add(i); - LinkedHashMap, Nothing?> schemas = pathToSchemas.get(itemPathToItem); - if (schemas == null) { - throw new RuntimeException("Validation 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"); - } - items.add((String) itemInstance); - i += 1; - } - FrozenList newInstanceItems = new FrozenList<>(items); - return new SchemaList0(newInstanceItems); - } - - 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); - SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().build())); - ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, new PathToSchemasMap(), new LinkedHashSet<>()); - PathToSchemasMap pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet); - return getNewInstance(castArg, validationMetadata.pathToItem(), pathToSchemasMap); - } - - @Override - public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws 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"); - } - @Override - public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { - 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"); - } - @Override - 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 { - 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"); - } - } -} diff --git a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/fake/get/parameters/parameter1/Schema1.kt b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/fake/get/parameters/parameter1/Schema1.kt deleted file mode 100644 index c11fb1b0bf8..00000000000 --- a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/fake/get/parameters/parameter1/Schema1.kt +++ /dev/null @@ -1,124 +0,0 @@ -package org.openapijsonschematools.client.paths.fake.get.parameters.parameter1; -import java.util.HashSet; -import java.util.LinkedHashSet; -import java.util.List; -import java.util.Objects; -import java.util.Set; -import org.checkerframework.checker.nullness.qual.Nullable; -import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags; -import org.openapijsonschematools.client.configurations.SchemaConfiguration; -import org.openapijsonschematools.client.exceptions.ValidationException; -import org.openapijsonschematools.client.schemas.SetMaker; -import org.openapijsonschematools.client.schemas.validation.DefaultValueMethod; -import org.openapijsonschematools.client.schemas.validation.JsonSchema; -import org.openapijsonschematools.client.schemas.validation.JsonSchemaInfo; -import org.openapijsonschematools.client.schemas.validation.PathToSchemasMap; -import org.openapijsonschematools.client.schemas.validation.StringEnumValidator; -import org.openapijsonschematools.client.schemas.validation.StringSchemaValidator; -import org.openapijsonschematools.client.schemas.validation.StringValueMethod; -import org.openapijsonschematools.client.schemas.validation.ValidationMetadata; - -public class Schema1 { - // nest classes so all schemas and input/output classes can be public - - public enum StringSchemaEnums1 implements StringValueMethod { - LOW_LINE_ABC("_abc"), - HYPHEN_MINUS_EFG("-efg"), - LEFT_PARENTHESIS_XYZ_RIGHT_PARENTHESIS("(xyz)"); - private final String value; - - StringSchemaEnums1(String value) { - this.value = value; - } - public String value() { - return this.value; - } - } - - - public sealed interface Schema11Boxed permits Schema11BoxedString { - @Nullable Object getData(); - } - - public record Schema11BoxedString(String data) implements Schema11Boxed { - @Override - public @Nullable Object getData() { - return data; - } - } - - - - public static class Schema11 extends JsonSchema implements StringSchemaValidator, StringEnumValidator, DefaultValueMethod { - private static @Nullable Schema11 instance = null; - - protected Schema11() { - super(new JsonSchemaInfo() - .type(Set.of( - String.class - )) - .enumValues(SetMaker.makeSet( - "_abc", - "-efg", - "(xyz)" - )) - .defaultValue("-efg") - ); - } - - public static Schema11 getInstance() { - if (instance == null) { - instance = new Schema11(); - } - return instance; - } - - @Override - public String validate(String arg, SchemaConfiguration configuration) throws ValidationException { - Set> pathSet = new HashSet<>(); - List pathToItem = List.of("args[0"); - String castArg = castToAllowedTypes(arg, pathToItem, pathSet); - SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().build())); - ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, new PathToSchemasMap(), new LinkedHashSet<>()); - getPathToSchemas(this, castArg, validationMetadata, pathSet); - return castArg; - } - - @Override - 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 { - 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"); - } - @Override - public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { - 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"); - } - public String defaultValue() throws ValidationException { - if (defaultValue instanceof String) { - return (String) defaultValue; - } - throw new ValidationException("Invalid type stored in defaultValue"); - } - @Override - 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 { - 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"); - } - } -} diff --git a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/fake/get/parameters/parameter2/Schema2.kt b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/fake/get/parameters/parameter2/Schema2.kt deleted file mode 100644 index 5677396d474..00000000000 --- a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/fake/get/parameters/parameter2/Schema2.kt +++ /dev/null @@ -1,253 +0,0 @@ -package org.openapijsonschematools.client.paths.fake.get.parameters.parameter2; -import java.util.ArrayList; -import java.util.HashSet; -import java.util.LinkedHashMap; -import java.util.LinkedHashSet; -import java.util.List; -import java.util.Objects; -import java.util.Set; -import org.checkerframework.checker.nullness.qual.Nullable; -import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags; -import org.openapijsonschematools.client.configurations.SchemaConfiguration; -import org.openapijsonschematools.client.exceptions.ValidationException; -import org.openapijsonschematools.client.schemas.SetMaker; -import org.openapijsonschematools.client.schemas.validation.DefaultValueMethod; -import org.openapijsonschematools.client.schemas.validation.FrozenList; -import org.openapijsonschematools.client.schemas.validation.JsonSchema; -import org.openapijsonschematools.client.schemas.validation.JsonSchemaInfo; -import org.openapijsonschematools.client.schemas.validation.ListSchemaValidator; -import org.openapijsonschematools.client.schemas.validation.PathToSchemasMap; -import org.openapijsonschematools.client.schemas.validation.StringEnumValidator; -import org.openapijsonschematools.client.schemas.validation.StringSchemaValidator; -import org.openapijsonschematools.client.schemas.validation.StringValueMethod; -import org.openapijsonschematools.client.schemas.validation.ValidationMetadata; - -public class Schema2 { - // nest classes so all schemas and input/output classes can be public - - public enum StringItemsEnums2 implements StringValueMethod { - GREATER_THAN_SIGN(">"), - DOLLAR_SIGN("$"); - private final String value; - - StringItemsEnums2(String value) { - this.value = value; - } - public String value() { - return this.value; - } - } - - - public sealed interface Items2Boxed permits Items2BoxedString { - @Nullable Object getData(); - } - - public record Items2BoxedString(String data) implements Items2Boxed { - @Override - public @Nullable Object getData() { - return data; - } - } - - - - public static class Items2 extends JsonSchema implements StringSchemaValidator, StringEnumValidator, DefaultValueMethod { - private static @Nullable Items2 instance = null; - - protected Items2() { - super(new JsonSchemaInfo() - .type(Set.of( - String.class - )) - .enumValues(SetMaker.makeSet( - ">", - "$" - )) - .defaultValue("$") - ); - } - - public static Items2 getInstance() { - if (instance == null) { - instance = new Items2(); - } - return instance; - } - - @Override - public String validate(String arg, SchemaConfiguration configuration) throws ValidationException { - Set> pathSet = new HashSet<>(); - List pathToItem = List.of("args[0"); - String castArg = castToAllowedTypes(arg, pathToItem, pathSet); - SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().build())); - ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, new PathToSchemasMap(), new LinkedHashSet<>()); - getPathToSchemas(this, castArg, validationMetadata, pathSet); - return castArg; - } - - @Override - 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 { - 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"); - } - @Override - public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { - 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"); - } - public String defaultValue() throws ValidationException { - if (defaultValue instanceof String) { - return (String) defaultValue; - } - throw new ValidationException("Invalid type stored in defaultValue"); - } - @Override - 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 { - 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"); - } - } - - public static class SchemaList2 extends FrozenList { - protected SchemaList2(FrozenList m) { - super(m); - } - public static SchemaList2 of(List arg, SchemaConfiguration configuration) throws ValidationException { - return Schema21.getInstance().validate(arg, configuration); - } - } - - public static class SchemaListBuilder2 { - // class to build List - private final List list; - - public SchemaListBuilder2() { - list = new ArrayList<>(); - } - - public SchemaListBuilder2(List list) { - this.list = list; - } - - public SchemaListBuilder2 add(String item) { - list.add(item); - return this; - } - - public SchemaListBuilder2 add(StringItemsEnums2 item) { - list.add(item.value()); - return this; - } - - public List build() { - return list; - } - } - - - public sealed interface Schema21Boxed permits Schema21BoxedList { - @Nullable Object getData(); - } - - public record Schema21BoxedList(SchemaList2 data) implements Schema21Boxed { - @Override - public @Nullable Object getData() { - return data; - } - } - - - - public static class Schema21 extends JsonSchema implements ListSchemaValidator { - private static @Nullable Schema21 instance = null; - - protected Schema21() { - super(new JsonSchemaInfo() - .type(Set.of(List.class)) - .items(Items2.class) - ); - } - - public static Schema21 getInstance() { - if (instance == null) { - instance = new Schema21(); - } - return instance; - } - - @Override - public SchemaList2 getNewInstance(List arg, List pathToItem, PathToSchemasMap pathToSchemas) { - List items = new ArrayList<>(); - int i = 0; - for (Object item: arg) { - List itemPathToItem = new ArrayList<>(pathToItem); - itemPathToItem.add(i); - LinkedHashMap, Nothing?> schemas = pathToSchemas.get(itemPathToItem); - if (schemas == null) { - throw new RuntimeException("Validation 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"); - } - items.add((String) itemInstance); - i += 1; - } - FrozenList newInstanceItems = new FrozenList<>(items); - return new SchemaList2(newInstanceItems); - } - - 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); - SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().build())); - ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, new PathToSchemasMap(), new LinkedHashSet<>()); - PathToSchemasMap pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet); - return getNewInstance(castArg, validationMetadata.pathToItem(), pathToSchemasMap); - } - - @Override - public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws 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"); - } - @Override - public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { - 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"); - } - @Override - 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 { - 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"); - } - } -} diff --git a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/fake/get/parameters/parameter3/Schema3.kt b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/fake/get/parameters/parameter3/Schema3.kt deleted file mode 100644 index 10b29f05566..00000000000 --- a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/fake/get/parameters/parameter3/Schema3.kt +++ /dev/null @@ -1,124 +0,0 @@ -package org.openapijsonschematools.client.paths.fake.get.parameters.parameter3; -import java.util.HashSet; -import java.util.LinkedHashSet; -import java.util.List; -import java.util.Objects; -import java.util.Set; -import org.checkerframework.checker.nullness.qual.Nullable; -import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags; -import org.openapijsonschematools.client.configurations.SchemaConfiguration; -import org.openapijsonschematools.client.exceptions.ValidationException; -import org.openapijsonschematools.client.schemas.SetMaker; -import org.openapijsonschematools.client.schemas.validation.DefaultValueMethod; -import org.openapijsonschematools.client.schemas.validation.JsonSchema; -import org.openapijsonschematools.client.schemas.validation.JsonSchemaInfo; -import org.openapijsonschematools.client.schemas.validation.PathToSchemasMap; -import org.openapijsonschematools.client.schemas.validation.StringEnumValidator; -import org.openapijsonschematools.client.schemas.validation.StringSchemaValidator; -import org.openapijsonschematools.client.schemas.validation.StringValueMethod; -import org.openapijsonschematools.client.schemas.validation.ValidationMetadata; - -public class Schema3 { - // nest classes so all schemas and input/output classes can be public - - public enum StringSchemaEnums3 implements StringValueMethod { - LOW_LINE_ABC("_abc"), - HYPHEN_MINUS_EFG("-efg"), - LEFT_PARENTHESIS_XYZ_RIGHT_PARENTHESIS("(xyz)"); - private final String value; - - StringSchemaEnums3(String value) { - this.value = value; - } - public String value() { - return this.value; - } - } - - - public sealed interface Schema31Boxed permits Schema31BoxedString { - @Nullable Object getData(); - } - - public record Schema31BoxedString(String data) implements Schema31Boxed { - @Override - public @Nullable Object getData() { - return data; - } - } - - - - public static class Schema31 extends JsonSchema implements StringSchemaValidator, StringEnumValidator, DefaultValueMethod { - private static @Nullable Schema31 instance = null; - - protected Schema31() { - super(new JsonSchemaInfo() - .type(Set.of( - String.class - )) - .enumValues(SetMaker.makeSet( - "_abc", - "-efg", - "(xyz)" - )) - .defaultValue("-efg") - ); - } - - public static Schema31 getInstance() { - if (instance == null) { - instance = new Schema31(); - } - return instance; - } - - @Override - public String validate(String arg, SchemaConfiguration configuration) throws ValidationException { - Set> pathSet = new HashSet<>(); - List pathToItem = List.of("args[0"); - String castArg = castToAllowedTypes(arg, pathToItem, pathSet); - SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().build())); - ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, new PathToSchemasMap(), new LinkedHashSet<>()); - getPathToSchemas(this, castArg, validationMetadata, pathSet); - return castArg; - } - - @Override - 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 { - 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"); - } - @Override - public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { - 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"); - } - public String defaultValue() throws ValidationException { - if (defaultValue instanceof String) { - return (String) defaultValue; - } - throw new ValidationException("Invalid type stored in defaultValue"); - } - @Override - 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 { - 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"); - } - } -} diff --git a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/fake/get/parameters/parameter4/Schema4.kt b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/fake/get/parameters/parameter4/Schema4.kt deleted file mode 100644 index 31ffdbc7fef..00000000000 --- a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/fake/get/parameters/parameter4/Schema4.kt +++ /dev/null @@ -1,187 +0,0 @@ -package org.openapijsonschematools.client.paths.fake.get.parameters.parameter4; -import java.math.BigDecimal; -import java.util.HashSet; -import java.util.LinkedHashSet; -import java.util.List; -import java.util.Objects; -import java.util.Set; -import org.checkerframework.checker.nullness.qual.Nullable; -import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags; -import org.openapijsonschematools.client.configurations.SchemaConfiguration; -import org.openapijsonschematools.client.exceptions.ValidationException; -import org.openapijsonschematools.client.schemas.SetMaker; -import org.openapijsonschematools.client.schemas.validation.DoubleEnumValidator; -import org.openapijsonschematools.client.schemas.validation.DoubleValueMethod; -import org.openapijsonschematools.client.schemas.validation.FloatEnumValidator; -import org.openapijsonschematools.client.schemas.validation.FloatValueMethod; -import org.openapijsonschematools.client.schemas.validation.IntegerEnumValidator; -import org.openapijsonschematools.client.schemas.validation.IntegerValueMethod; -import org.openapijsonschematools.client.schemas.validation.JsonSchema; -import org.openapijsonschematools.client.schemas.validation.JsonSchemaInfo; -import org.openapijsonschematools.client.schemas.validation.LongEnumValidator; -import org.openapijsonschematools.client.schemas.validation.LongValueMethod; -import org.openapijsonschematools.client.schemas.validation.NumberSchemaValidator; -import org.openapijsonschematools.client.schemas.validation.PathToSchemasMap; -import org.openapijsonschematools.client.schemas.validation.ValidationMetadata; - -public class Schema4 { - // nest classes so all schemas and input/output classes can be public - - public enum IntegerSchemaEnums4 implements IntegerValueMethod { - POSITIVE_1(1), - NEGATIVE_2(-2); - private final int value; - - IntegerSchemaEnums4(int value) { - this.value = value; - } - public int value() { - return this.value; - } - } - - public enum LongSchemaEnums4 implements LongValueMethod { - POSITIVE_1(1L), - NEGATIVE_2(-2L); - private final long value; - - LongSchemaEnums4(long value) { - this.value = value; - } - public long value() { - return this.value; - } - } - - public enum FloatSchemaEnums4 implements FloatValueMethod { - POSITIVE_1(1.0f), - NEGATIVE_2(-2.0f); - private final float value; - - FloatSchemaEnums4(float value) { - this.value = value; - } - public float value() { - return this.value; - } - } - - public enum DoubleSchemaEnums4 implements DoubleValueMethod { - POSITIVE_1(1.0d), - NEGATIVE_2(-2.0d); - private final double value; - - DoubleSchemaEnums4(double value) { - this.value = value; - } - public double value() { - return this.value; - } - } - - - public sealed interface Schema41Boxed permits Schema41BoxedNumber { - @Nullable Object getData(); - } - - public record Schema41BoxedNumber(Number data) implements Schema41Boxed { - @Override - public @Nullable Object getData() { - return data; - } - } - - - - public static class Schema41 extends JsonSchema implements IntegerEnumValidator, LongEnumValidator, FloatEnumValidator, DoubleEnumValidator, NumberSchemaValidator { - private static @Nullable Schema41 instance = null; - - protected Schema41() { - super(new JsonSchemaInfo() - .type(Set.of( - Integer.class, - Long.class, - Float.class, - Double.class - )) - .format("int32") - .enumValues(SetMaker.makeSet( - new BigDecimal("1"), - new BigDecimal("-2") - )) - ); - } - - public static Schema41 getInstance() { - if (instance == null) { - instance = new Schema41(); - } - return instance; - } - - @Override - public Number validate(Number arg, SchemaConfiguration configuration) throws ValidationException { - Set> pathSet = new HashSet<>(); - List pathToItem = List.of("args[0"); - Number castArg = castToAllowedTypes(arg, pathToItem, pathSet); - SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().build())); - ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, new PathToSchemasMap(), new LinkedHashSet<>()); - getPathToSchemas(this, castArg, validationMetadata, pathSet); - return castArg; - } - - public int validate(int arg, SchemaConfiguration configuration) throws ValidationException { - return (int) validate((Number) arg, configuration); - } - - public float validate(float arg, SchemaConfiguration configuration) throws ValidationException { - return (float) validate((Number) arg, configuration); - } - - @Override - 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 ValidationException { - return (long) validate((Number) arg.value(), configuration); - } - - @Override - 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 ValidationException { - return (double) validate((Number) arg.value(), configuration); - } - - @Override - public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws 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"); - } - @Override - public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { - 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"); - } - @Override - 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 { - 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"); - } - } -} diff --git a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/fake/get/parameters/parameter5/Schema5.kt b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/fake/get/parameters/parameter5/Schema5.kt deleted file mode 100644 index 061a755133a..00000000000 --- a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/fake/get/parameters/parameter5/Schema5.kt +++ /dev/null @@ -1,142 +0,0 @@ -package org.openapijsonschematools.client.paths.fake.get.parameters.parameter5; -import java.math.BigDecimal; -import java.util.HashSet; -import java.util.LinkedHashSet; -import java.util.List; -import java.util.Objects; -import java.util.Set; -import org.checkerframework.checker.nullness.qual.Nullable; -import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags; -import org.openapijsonschematools.client.configurations.SchemaConfiguration; -import org.openapijsonschematools.client.exceptions.ValidationException; -import org.openapijsonschematools.client.schemas.SetMaker; -import org.openapijsonschematools.client.schemas.validation.DoubleEnumValidator; -import org.openapijsonschematools.client.schemas.validation.DoubleValueMethod; -import org.openapijsonschematools.client.schemas.validation.FloatEnumValidator; -import org.openapijsonschematools.client.schemas.validation.FloatValueMethod; -import org.openapijsonschematools.client.schemas.validation.JsonSchema; -import org.openapijsonschematools.client.schemas.validation.JsonSchemaInfo; -import org.openapijsonschematools.client.schemas.validation.NumberSchemaValidator; -import org.openapijsonschematools.client.schemas.validation.PathToSchemasMap; -import org.openapijsonschematools.client.schemas.validation.ValidationMetadata; - -public class Schema5 { - // nest classes so all schemas and input/output classes can be public - - public enum DoubleSchemaEnums5 implements DoubleValueMethod { - POSITIVE_1_PT_1(1.1d), - NEGATIVE_1_PT_2(-1.2d); - private final double value; - - DoubleSchemaEnums5(double value) { - this.value = value; - } - public double value() { - return this.value; - } - } - - public enum FloatSchemaEnums5 implements FloatValueMethod { - POSITIVE_1_PT_1(1.1f), - NEGATIVE_1_PT_2(-1.2f); - private final float value; - - FloatSchemaEnums5(float value) { - this.value = value; - } - public float value() { - return this.value; - } - } - - - public sealed interface Schema51Boxed permits Schema51BoxedNumber { - @Nullable Object getData(); - } - - public record Schema51BoxedNumber(Number data) implements Schema51Boxed { - @Override - public @Nullable Object getData() { - return data; - } - } - - - - public static class Schema51 extends JsonSchema implements FloatEnumValidator, DoubleEnumValidator, NumberSchemaValidator { - private static @Nullable Schema51 instance = null; - - protected Schema51() { - super(new JsonSchemaInfo() - .type(Set.of( - Integer.class, - Long.class, - Float.class, - Double.class - )) - .format("double") - .enumValues(SetMaker.makeSet( - new BigDecimal("1.1"), - new BigDecimal("-1.2") - )) - ); - } - - public static Schema51 getInstance() { - if (instance == null) { - instance = new Schema51(); - } - return instance; - } - - @Override - public Number validate(Number arg, SchemaConfiguration configuration) throws ValidationException { - Set> pathSet = new HashSet<>(); - List pathToItem = List.of("args[0"); - Number castArg = castToAllowedTypes(arg, pathToItem, pathSet); - SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().build())); - ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, new PathToSchemasMap(), new LinkedHashSet<>()); - PathToSchemasMap pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet); - return castArg; - } - public double validate(double arg, SchemaConfiguration configuration) throws ValidationException { - return (double) validate((Number) arg, configuration); - } - - @Override - 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 ValidationException { - return (double) validate((Number) arg.value(), configuration); - } - - @Override - public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws 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"); - } - @Override - public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { - 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"); - } - @Override - 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 { - 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"); - } - } -} diff --git a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/fake/get/requestbody/content/applicationxwwwformurlencoded/ApplicationxwwwformurlencodedSchema.kt b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/fake/get/requestbody/content/applicationxwwwformurlencoded/ApplicationxwwwformurlencodedSchema.kt deleted file mode 100644 index 74125c1f747..00000000000 --- a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/fake/get/requestbody/content/applicationxwwwformurlencoded/ApplicationxwwwformurlencodedSchema.kt +++ /dev/null @@ -1,553 +0,0 @@ -package org.openapijsonschematools.client.paths.fake.get.requestbody.content.applicationxwwwformurlencoded; -import java.util.ArrayList; -import java.util.HashSet; -import java.util.LinkedHashMap; -import java.util.LinkedHashSet; -import java.util.List; -import java.util.Map; -import java.util.Objects; -import java.util.Set; -import org.checkerframework.checker.nullness.qual.Nullable; -import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags; -import org.openapijsonschematools.client.configurations.SchemaConfiguration; -import org.openapijsonschematools.client.exceptions.InvalidAdditionalPropertyException; -import org.openapijsonschematools.client.exceptions.UnsetPropertyException; -import org.openapijsonschematools.client.exceptions.ValidationException; -import org.openapijsonschematools.client.schemas.GenericBuilder; -import org.openapijsonschematools.client.schemas.SetMaker; -import org.openapijsonschematools.client.schemas.UnsetAddPropsSetter; -import org.openapijsonschematools.client.schemas.validation.DefaultValueMethod; -import org.openapijsonschematools.client.schemas.validation.FrozenList; -import org.openapijsonschematools.client.schemas.validation.FrozenMap; -import org.openapijsonschematools.client.schemas.validation.JsonSchema; -import org.openapijsonschematools.client.schemas.validation.JsonSchemaInfo; -import org.openapijsonschematools.client.schemas.validation.ListSchemaValidator; -import org.openapijsonschematools.client.schemas.validation.MapSchemaValidator; -import org.openapijsonschematools.client.schemas.validation.PathToSchemasMap; -import org.openapijsonschematools.client.schemas.validation.PropertyEntry; -import org.openapijsonschematools.client.schemas.validation.StringEnumValidator; -import org.openapijsonschematools.client.schemas.validation.StringSchemaValidator; -import org.openapijsonschematools.client.schemas.validation.StringValueMethod; -import org.openapijsonschematools.client.schemas.validation.ValidationMetadata; - -public class ApplicationxwwwformurlencodedSchema { - // nest classes so all schemas and input/output classes can be public - - public enum StringApplicationxwwwformurlencodedItemsEnums implements StringValueMethod { - GREATER_THAN_SIGN(">"), - DOLLAR_SIGN("$"); - private final String value; - - StringApplicationxwwwformurlencodedItemsEnums(String value) { - this.value = value; - } - public String value() { - return this.value; - } - } - - - public sealed interface ApplicationxwwwformurlencodedItemsBoxed permits ApplicationxwwwformurlencodedItemsBoxedString { - @Nullable Object getData(); - } - - public record ApplicationxwwwformurlencodedItemsBoxedString(String data) implements ApplicationxwwwformurlencodedItemsBoxed { - @Override - public @Nullable Object getData() { - return data; - } - } - - - - public static class ApplicationxwwwformurlencodedItems extends JsonSchema implements StringSchemaValidator, StringEnumValidator, DefaultValueMethod { - private static @Nullable ApplicationxwwwformurlencodedItems instance = null; - - protected ApplicationxwwwformurlencodedItems() { - super(new JsonSchemaInfo() - .type(Set.of( - String.class - )) - .enumValues(SetMaker.makeSet( - ">", - "$" - )) - .defaultValue("$") - ); - } - - public static ApplicationxwwwformurlencodedItems getInstance() { - if (instance == null) { - instance = new ApplicationxwwwformurlencodedItems(); - } - return instance; - } - - @Override - public String validate(String arg, SchemaConfiguration configuration) throws ValidationException { - Set> pathSet = new HashSet<>(); - List pathToItem = List.of("args[0"); - String castArg = castToAllowedTypes(arg, pathToItem, pathSet); - SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().build())); - ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, new PathToSchemasMap(), new LinkedHashSet<>()); - getPathToSchemas(this, castArg, validationMetadata, pathSet); - return castArg; - } - - @Override - 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 { - 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"); - } - @Override - public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { - 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"); - } - public String defaultValue() throws ValidationException { - if (defaultValue instanceof String) { - return (String) defaultValue; - } - throw new ValidationException("Invalid type stored in defaultValue"); - } - @Override - 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 { - 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"); - } - } - - public static class ApplicationxwwwformurlencodedEnumFormStringArrayList extends FrozenList { - protected ApplicationxwwwformurlencodedEnumFormStringArrayList(FrozenList m) { - super(m); - } - public static ApplicationxwwwformurlencodedEnumFormStringArrayList of(List arg, SchemaConfiguration configuration) throws ValidationException { - return ApplicationxwwwformurlencodedEnumFormStringArray.getInstance().validate(arg, configuration); - } - } - - public static class ApplicationxwwwformurlencodedEnumFormStringArrayListBuilder { - // class to build List - private final List list; - - public ApplicationxwwwformurlencodedEnumFormStringArrayListBuilder() { - list = new ArrayList<>(); - } - - public ApplicationxwwwformurlencodedEnumFormStringArrayListBuilder(List list) { - this.list = list; - } - - public ApplicationxwwwformurlencodedEnumFormStringArrayListBuilder add(String item) { - list.add(item); - return this; - } - - public ApplicationxwwwformurlencodedEnumFormStringArrayListBuilder add(StringApplicationxwwwformurlencodedItemsEnums item) { - list.add(item.value()); - return this; - } - - public List build() { - return list; - } - } - - - public sealed interface ApplicationxwwwformurlencodedEnumFormStringArrayBoxed permits ApplicationxwwwformurlencodedEnumFormStringArrayBoxedList { - @Nullable Object getData(); - } - - public record ApplicationxwwwformurlencodedEnumFormStringArrayBoxedList(ApplicationxwwwformurlencodedEnumFormStringArrayList data) implements ApplicationxwwwformurlencodedEnumFormStringArrayBoxed { - @Override - public @Nullable Object getData() { - return data; - } - } - - - - public static class ApplicationxwwwformurlencodedEnumFormStringArray extends JsonSchema implements ListSchemaValidator { - private static @Nullable ApplicationxwwwformurlencodedEnumFormStringArray instance = null; - - protected ApplicationxwwwformurlencodedEnumFormStringArray() { - super(new JsonSchemaInfo() - .type(Set.of(List.class)) - .items(ApplicationxwwwformurlencodedItems.class) - ); - } - - public static ApplicationxwwwformurlencodedEnumFormStringArray getInstance() { - if (instance == null) { - instance = new ApplicationxwwwformurlencodedEnumFormStringArray(); - } - return instance; - } - - @Override - public ApplicationxwwwformurlencodedEnumFormStringArrayList getNewInstance(List arg, List pathToItem, PathToSchemasMap pathToSchemas) { - List items = new ArrayList<>(); - int i = 0; - for (Object item: arg) { - List itemPathToItem = new ArrayList<>(pathToItem); - itemPathToItem.add(i); - LinkedHashMap, Nothing?> schemas = pathToSchemas.get(itemPathToItem); - if (schemas == null) { - throw new RuntimeException("Validation 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"); - } - items.add((String) itemInstance); - i += 1; - } - FrozenList newInstanceItems = new FrozenList<>(items); - return new ApplicationxwwwformurlencodedEnumFormStringArrayList(newInstanceItems); - } - - 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); - SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().build())); - ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, new PathToSchemasMap(), new LinkedHashSet<>()); - PathToSchemasMap pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet); - return getNewInstance(castArg, validationMetadata.pathToItem(), pathToSchemasMap); - } - - @Override - public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws 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"); - } - @Override - public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { - 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"); - } - @Override - 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 { - 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"); - } - } - public enum StringApplicationxwwwformurlencodedEnumFormStringEnums implements StringValueMethod { - LOW_LINE_ABC("_abc"), - HYPHEN_MINUS_EFG("-efg"), - LEFT_PARENTHESIS_XYZ_RIGHT_PARENTHESIS("(xyz)"); - private final String value; - - StringApplicationxwwwformurlencodedEnumFormStringEnums(String value) { - this.value = value; - } - public String value() { - return this.value; - } - } - - - public sealed interface ApplicationxwwwformurlencodedEnumFormStringBoxed permits ApplicationxwwwformurlencodedEnumFormStringBoxedString { - @Nullable Object getData(); - } - - public record ApplicationxwwwformurlencodedEnumFormStringBoxedString(String data) implements ApplicationxwwwformurlencodedEnumFormStringBoxed { - @Override - public @Nullable Object getData() { - return data; - } - } - - - - public static class ApplicationxwwwformurlencodedEnumFormString extends JsonSchema implements StringSchemaValidator, StringEnumValidator, DefaultValueMethod { - private static @Nullable ApplicationxwwwformurlencodedEnumFormString instance = null; - - protected ApplicationxwwwformurlencodedEnumFormString() { - super(new JsonSchemaInfo() - .type(Set.of( - String.class - )) - .enumValues(SetMaker.makeSet( - "_abc", - "-efg", - "(xyz)" - )) - .defaultValue("-efg") - ); - } - - public static ApplicationxwwwformurlencodedEnumFormString getInstance() { - if (instance == null) { - instance = new ApplicationxwwwformurlencodedEnumFormString(); - } - return instance; - } - - @Override - public String validate(String arg, SchemaConfiguration configuration) throws ValidationException { - Set> pathSet = new HashSet<>(); - List pathToItem = List.of("args[0"); - String castArg = castToAllowedTypes(arg, pathToItem, pathSet); - SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().build())); - ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, new PathToSchemasMap(), new LinkedHashSet<>()); - getPathToSchemas(this, castArg, validationMetadata, pathSet); - return castArg; - } - - @Override - 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 { - 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"); - } - @Override - public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { - 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"); - } - public String defaultValue() throws ValidationException { - if (defaultValue instanceof String) { - return (String) defaultValue; - } - throw new ValidationException("Invalid type stored in defaultValue"); - } - @Override - 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 { - 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"); - } - } - - public static class ApplicationxwwwformurlencodedSchemaMap extends FrozenMap<@Nullable Object> { - protected ApplicationxwwwformurlencodedSchemaMap(FrozenMap<@Nullable Object> m) { - super(m); - } - public static final Set requiredKeys = Set.of(); - public static final Set optionalKeys = Set.of( - "enum_form_string_array", - "enum_form_string" - ); - public static ApplicationxwwwformurlencodedSchemaMap of(Map arg, SchemaConfiguration configuration) throws ValidationException { - return ApplicationxwwwformurlencodedSchema1.getInstance().validate(arg, configuration); - } - - public ApplicationxwwwformurlencodedEnumFormStringArrayList enum_form_string_array() throws UnsetPropertyException { - String key = "enum_form_string_array"; - throwIfKeyNotPresent(key); - @Nullable Object value = get(key); - if (!(value instanceof ApplicationxwwwformurlencodedEnumFormStringArrayList)) { - throw new RuntimeException("Invalid value stored for enum_form_string_array"); - } - return (ApplicationxwwwformurlencodedEnumFormStringArrayList) value; - } - - public String enum_form_string() throws UnsetPropertyException { - String key = "enum_form_string"; - throwIfKeyNotPresent(key); - @Nullable Object value = get(key); - if (!(value instanceof String)) { - throw new RuntimeException("Invalid value stored for enum_form_string"); - } - return (String) value; - } - - public @Nullable Object getAdditionalProperty(String name) throws UnsetPropertyException, InvalidAdditionalPropertyException { - throwIfKeyKnown(name, requiredKeys, optionalKeys); - throwIfKeyNotPresent(name); - return get(name); - } - } - - public interface SetterForApplicationxwwwformurlencodedEnumFormStringArray { - Map getInstance(); - T getBuilderAfterApplicationxwwwformurlencodedEnumFormStringArray(Map instance); - - default T enum_form_string_array(List value) { - var instance = getInstance(); - instance.put("enum_form_string_array", value); - return getBuilderAfterApplicationxwwwformurlencodedEnumFormStringArray(instance); - } - } - - public interface SetterForApplicationxwwwformurlencodedEnumFormString { - Map getInstance(); - T getBuilderAfterApplicationxwwwformurlencodedEnumFormString(Map instance); - - default T enum_form_string(String value) { - var instance = getInstance(); - instance.put("enum_form_string", value); - return getBuilderAfterApplicationxwwwformurlencodedEnumFormString(instance); - } - - default T enum_form_string(StringApplicationxwwwformurlencodedEnumFormStringEnums value) { - var instance = getInstance(); - instance.put("enum_form_string", value.value()); - return getBuilderAfterApplicationxwwwformurlencodedEnumFormString(instance); - } - } - - public static class ApplicationxwwwformurlencodedSchemaMapBuilder extends UnsetAddPropsSetter implements GenericBuilder>, SetterForApplicationxwwwformurlencodedEnumFormStringArray, SetterForApplicationxwwwformurlencodedEnumFormString { - private final Map instance; - private static final Set knownKeys = Set.of( - "enum_form_string_array", - "enum_form_string" - ); - public Set getKnownKeys() { - return knownKeys; - } - public ApplicationxwwwformurlencodedSchemaMapBuilder() { - this.instance = new LinkedHashMap<>(); - } - public Map build() { - return instance; - } - public Map getInstance() { - return instance; - } - public ApplicationxwwwformurlencodedSchemaMapBuilder getBuilderAfterApplicationxwwwformurlencodedEnumFormStringArray(Map instance) { - return this; - } - public ApplicationxwwwformurlencodedSchemaMapBuilder getBuilderAfterApplicationxwwwformurlencodedEnumFormString(Map instance) { - return this; - } - public ApplicationxwwwformurlencodedSchemaMapBuilder getBuilderAfterAdditionalProperty(Map instance) { - return this; - } - } - - - public sealed interface ApplicationxwwwformurlencodedSchema1Boxed permits ApplicationxwwwformurlencodedSchema1BoxedMap { - @Nullable Object getData(); - } - - public record ApplicationxwwwformurlencodedSchema1BoxedMap(ApplicationxwwwformurlencodedSchemaMap data) implements ApplicationxwwwformurlencodedSchema1Boxed { - @Override - public @Nullable Object getData() { - return data; - } - } - - - public static class ApplicationxwwwformurlencodedSchema1 extends JsonSchema implements MapSchemaValidator { - private static @Nullable ApplicationxwwwformurlencodedSchema1 instance = null; - - protected ApplicationxwwwformurlencodedSchema1() { - super(new JsonSchemaInfo() - .type(Set.of(Map.class)) - .properties(Map.ofEntries( - new PropertyEntry("enum_form_string_array", ApplicationxwwwformurlencodedEnumFormStringArray.class), - new PropertyEntry("enum_form_string", ApplicationxwwwformurlencodedEnumFormString.class) - )) - ); - } - - public static ApplicationxwwwformurlencodedSchema1 getInstance() { - if (instance == null) { - instance = new ApplicationxwwwformurlencodedSchema1(); - } - return instance; - } - - 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 RuntimeException("Invalid non-string key value"); - } - String propertyName = (String) entryKey; - List propertyPathToItem = new ArrayList<>(pathToItem); - propertyPathToItem.add(propertyName); - Object value = entry.getValue(); - LinkedHashMap, Nothing?> schemas = pathToSchemas.get(propertyPathToItem); - if (schemas == null) { - throw new RuntimeException("Validation result is invalid, schemas must exist for a pathToItem"); - } - JsonSchema propertySchema = schemas.entrySet().iterator().next().getKey(); - @Nullable Object propertyInstance = propertySchema.getNewInstance(value, propertyPathToItem, pathToSchemas); - properties.put(propertyName, propertyInstance); - } - FrozenMap<@Nullable Object> castProperties = new FrozenMap<>(properties); - return new ApplicationxwwwformurlencodedSchemaMap(castProperties); - } - - 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); - SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().build())); - ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, new PathToSchemasMap(), new LinkedHashSet<>()); - PathToSchemasMap pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet); - return getNewInstance(castArg, validationMetadata.pathToItem(), pathToSchemasMap); - } - - - @Override - public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws 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"); - } - @Override - public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { - if (arg instanceof Map) { - return getNewInstance((Map) arg, pathToItem, pathToSchemas); - } - 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 { - return new ApplicationxwwwformurlencodedSchema1BoxedMap(validate(arg, configuration)); - } - @Override - public ApplicationxwwwformurlencodedSchema1Boxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { - 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"); - } - } - -} diff --git a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/fake/get/responses/FakeGetCode200Response.kt b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/fake/get/responses/FakeGetCode200Response.kt deleted file mode 100644 index 5787a626bfc..00000000000 --- a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/fake/get/responses/FakeGetCode200Response.kt +++ /dev/null @@ -1,7 +0,0 @@ -package org.openapijsonschematools.client.paths.fake.get.responses; - -import org.openapijsonschematools.client.components.responses.SuccessDescriptionOnly; - -public class FakeGetCode200Response extends SuccessDescriptionOnly { - public static class FakeGetCode200Response1 extends SuccessDescriptionOnly1 {} -} diff --git a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/fake/get/responses/FakeGetCode404Response.kt b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/fake/get/responses/FakeGetCode404Response.kt deleted file mode 100644 index 40d6b5a0263..00000000000 --- a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/fake/get/responses/FakeGetCode404Response.kt +++ /dev/null @@ -1,63 +0,0 @@ -package org.openapijsonschematools.client.paths.fake.get.responses; - -import org.openapijsonschematools.client.configurations.SchemaConfiguration; -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; - -import java.util.AbstractMap; -import java.util.Map; -import java.net.http.HttpResponse; -import java.net.http.HttpHeaders; - -public class FakeGetCode404Response { - public sealed interface SealedMediaType permits ApplicationjsonMediaType {} - - public record ApplicationjsonMediaType(ApplicationjsonSchema.ApplicationjsonSchema1 schema) implements SealedMediaType, MediaType { - public ApplicationjsonMediaType() { - this(ApplicationjsonSchema.ApplicationjsonSchema1.getInstance()); - } - @Override - public Nothing? encoding() { - return null; - } - } - public sealed interface SealedResponseBody permits ApplicationjsonResponseBody {} - public record ApplicationjsonResponseBody(ApplicationjsonSchema.MapJsonSchema1Boxed body) implements SealedResponseBody { } - - public static class FakeGetCode404Response1 extends ResponseDeserializer { - public FakeGetCode404Response1() { - super( - Map.ofEntries( - new AbstractMap.SimpleEntry<>("application/json", new ApplicationjsonMediaType()) - ) - ); - } - - @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); - } - - @Override - protected Nothing? getHeaders(HttpHeaders headers, SchemaConfiguration configuration) { - return null; - } - } - - @SuppressWarnings("serial") - public static class ResponseApiException extends ApiException { - public DeserializedHttpResponse deserializedResponse; - - public ResponseApiException(String s, HttpResponse response, DeserializedHttpResponse deserializedResponse) { - super(s, response); - this.deserializedResponse = deserializedResponse; - } - } -} diff --git a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/fake/get/responses/code404response/content/applicationjson/ApplicationjsonSchema.kt b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/fake/get/responses/code404response/content/applicationjson/ApplicationjsonSchema.kt deleted file mode 100644 index b9a4b76bd20..00000000000 --- a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/fake/get/responses/code404response/content/applicationjson/ApplicationjsonSchema.kt +++ /dev/null @@ -1,20 +0,0 @@ -package org.openapijsonschematools.client.paths.fake.get.responses.code404response.content.applicationjson; -import org.checkerframework.checker.nullness.qual.Nullable; -import org.openapijsonschematools.client.schemas.MapJsonSchema; -import org.openapijsonschematools.client.schemas.validation.FrozenMap; - -public class ApplicationjsonSchema extends MapJsonSchema { - // nest classes so all schemas and input/output classes can be public - - - public static class ApplicationjsonSchema1 extends MapJsonSchema.MapJsonSchema1 { - private static @Nullable ApplicationjsonSchema1 instance = null; - public static ApplicationjsonSchema1 getInstance() { - if (instance == null) { - instance = new ApplicationjsonSchema1(); - } - return instance; - } - } - -} diff --git a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/fake/patch/FakePatchRequestBody.kt b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/fake/patch/FakePatchRequestBody.kt deleted file mode 100644 index a31bc3e33c1..00000000000 --- a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/fake/patch/FakePatchRequestBody.kt +++ /dev/null @@ -1,7 +0,0 @@ -package org.openapijsonschematools.client.paths.fake.patch; - -import org.openapijsonschematools.client.components.requestbodies.Client; - -public class FakePatchRequestBody extends Client { - public static class FakePatchRequestBody1 extends Client1 {} -} diff --git a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/fake/patch/FakePatchResponses.kt b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/fake/patch/FakePatchResponses.kt deleted file mode 100644 index 8c4a049a4f2..00000000000 --- a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/fake/patch/FakePatchResponses.kt +++ /dev/null @@ -1,53 +0,0 @@ -package org.openapijsonschematools.client.paths.fake.patch; - -import org.openapijsonschematools.client.paths.fake.patch.responses.FakePatchCode200Response; -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; -import org.checkerframework.checker.nullness.qual.Nullable; - -import java.net.http.HttpResponse; -import java.util.Map; -import java.util.AbstractMap; - -public class FakePatchResponses { - public sealed interface EndpointResponse permits EndpointFakePatchCode200Response {} - - public record EndpointFakePatchCode200Response( - HttpResponse response, - FakePatchCode200Response.SealedResponseBody body, - Nothing? headers - ) implements EndpointResponse, ApiResponse{ - } - - public sealed interface StatusCodeResponseDeserializer permits StatusFakePatchCode200ResponseDeserializer {} - - public static final class StatusFakePatchCode200ResponseDeserializer extends FakePatchCode200Response.FakePatchCode200Response1 implements StatusCodeResponseDeserializer { - } - - public static final class FakePatchResponses1 implements ResponsesDeserializer { - private final Map statusCodeToResponseDeserializer; - public FakePatchResponses1() { - this.statusCodeToResponseDeserializer = Map.ofEntries( - new AbstractMap.SimpleEntry<>("200", new StatusFakePatchCode200ResponseDeserializer()) - ); - } - - 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) { - throw new ApiException( - "Invalid response statusCode="+statusCode+" has no response defined in the openapi document", - response - ); - } - StatusFakePatchCode200ResponseDeserializer castDeserializer = (StatusFakePatchCode200ResponseDeserializer) statusCodeDeserializer; - var deserializedResponse = castDeserializer.deserialize(response, configuration); - return new EndpointFakePatchCode200Response(response, deserializedResponse.body(), deserializedResponse.headers()); - } - } -} diff --git a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/fake/patch/responses/FakePatchCode200Response.kt b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/fake/patch/responses/FakePatchCode200Response.kt deleted file mode 100644 index baa1eed3da9..00000000000 --- a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/fake/patch/responses/FakePatchCode200Response.kt +++ /dev/null @@ -1,63 +0,0 @@ -package org.openapijsonschematools.client.paths.fake.patch.responses; - -import org.openapijsonschematools.client.configurations.SchemaConfiguration; -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; - -import java.util.AbstractMap; -import java.util.Map; -import java.net.http.HttpResponse; -import java.net.http.HttpHeaders; - -public class FakePatchCode200Response { - public sealed interface SealedMediaType permits ApplicationjsonMediaType {} - - public record ApplicationjsonMediaType(ApplicationjsonSchema.ApplicationjsonSchema1 schema) implements SealedMediaType, MediaType { - public ApplicationjsonMediaType() { - this(ApplicationjsonSchema.ApplicationjsonSchema1.getInstance()); - } - @Override - public Nothing? encoding() { - return null; - } - } - public sealed interface SealedResponseBody permits ApplicationjsonResponseBody {} - public record ApplicationjsonResponseBody(ApplicationjsonSchema.Client1Boxed body) implements SealedResponseBody { } - - public static class FakePatchCode200Response1 extends ResponseDeserializer { - public FakePatchCode200Response1() { - super( - Map.ofEntries( - new AbstractMap.SimpleEntry<>("application/json", new ApplicationjsonMediaType()) - ) - ); - } - - @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); - } - - @Override - protected Nothing? getHeaders(HttpHeaders headers, SchemaConfiguration configuration) { - return null; - } - } - - @SuppressWarnings("serial") - public static class ResponseApiException extends ApiException { - public DeserializedHttpResponse deserializedResponse; - - public ResponseApiException(String s, HttpResponse response, DeserializedHttpResponse deserializedResponse) { - super(s, response); - this.deserializedResponse = deserializedResponse; - } - } -} diff --git a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/fake/patch/responses/code200response/content/applicationjson/ApplicationjsonSchema.kt b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/fake/patch/responses/code200response/content/applicationjson/ApplicationjsonSchema.kt deleted file mode 100644 index f61bbf1fe44..00000000000 --- a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/fake/patch/responses/code200response/content/applicationjson/ApplicationjsonSchema.kt +++ /dev/null @@ -1,19 +0,0 @@ -package org.openapijsonschematools.client.paths.fake.patch.responses.code200response.content.applicationjson; - -import org.checkerframework.checker.nullness.qual.Nullable; -import org.openapijsonschematools.client.components.schemas.Client; - -public class ApplicationjsonSchema extends Client { - // $refed class - - - public static class ApplicationjsonSchema1 extends Client1 { - private static @Nullable ApplicationjsonSchema1 instance = null; - public static ApplicationjsonSchema1 getInstance() { - if (instance == null) { - instance = new ApplicationjsonSchema1(); - } - return instance; - } - } -} diff --git a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/fake/post/FakePostRequestBody.kt b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/fake/post/FakePostRequestBody.kt deleted file mode 100644 index 904242daaff..00000000000 --- a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/fake/post/FakePostRequestBody.kt +++ /dev/null @@ -1,49 +0,0 @@ -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; -import org.openapijsonschematools.client.mediatype.MediaType; -import org.openapijsonschematools.client.paths.fake.post.requestbody.content.applicationxwwwformurlencoded.ApplicationxwwwformurlencodedSchema; - -import java.util.AbstractMap; -import java.util.Map; - -public class FakePostRequestBody { - public sealed interface SealedMediaType permits ApplicationxwwwformurlencodedMediaType {} - - public record ApplicationxwwwformurlencodedMediaType(ApplicationxwwwformurlencodedSchema.ApplicationxwwwformurlencodedSchema1 schema) implements SealedMediaType, MediaType { - public ApplicationxwwwformurlencodedMediaType() { - this(ApplicationxwwwformurlencodedSchema.ApplicationxwwwformurlencodedSchema1.getInstance()); - } - @Override - public Nothing? encoding() { - return null; - } - } - - public static class FakePostRequestBody1 extends RequestBodySerializer { - public FakePostRequestBody1() { - super( - Map.ofEntries( - new AbstractMap.SimpleEntry<>("application/x-www-form-urlencoded", new ApplicationxwwwformurlencodedMediaType()) - ), - false - ); - } - - public SerializedRequestBody serialize(SealedRequestBody requestBody) throws NotImplementedException { - ApplicationxwwwformurlencodedRequestBody requestBody0 = (ApplicationxwwwformurlencodedRequestBody) requestBody; - return serialize(requestBody0.contentType(), requestBody0.body().getData()); - } - } - - public sealed interface SealedRequestBody permits ApplicationxwwwformurlencodedRequestBody {} - public record ApplicationxwwwformurlencodedRequestBody(ApplicationxwwwformurlencodedSchema.ApplicationxwwwformurlencodedSchema1Boxed body) implements SealedRequestBody, GenericRequestBody { - @Override - public String contentType() { - return "application/x-www-form-urlencoded"; - } - } -} diff --git a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/fake/post/FakePostResponses.kt b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/fake/post/FakePostResponses.kt deleted file mode 100644 index 62981b6b97f..00000000000 --- a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/fake/post/FakePostResponses.kt +++ /dev/null @@ -1,66 +0,0 @@ -package org.openapijsonschematools.client.paths.fake.post; - -import org.openapijsonschematools.client.paths.fake.post.responses.FakePostCode200Response; -import org.openapijsonschematools.client.paths.fake.post.responses.FakePostCode404Response; -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; -import org.checkerframework.checker.nullness.qual.Nullable; - -import java.net.http.HttpResponse; -import java.util.Map; -import java.util.AbstractMap; - -public class FakePostResponses { - public sealed interface EndpointResponse permits EndpointFakePostCode200Response {} - - public record EndpointFakePostCode200Response( - HttpResponse response, - Nothing? body, - Nothing? headers - ) implements EndpointResponse, ApiResponse{ - } - - public sealed interface StatusCodeResponseDeserializer permits StatusFakePostCode200ResponseDeserializer, StatusFakePostCode404ResponseDeserializer {} - - public static final class StatusFakePostCode200ResponseDeserializer extends FakePostCode200Response.FakePostCode200Response1 implements StatusCodeResponseDeserializer { - } - public static final class StatusFakePostCode404ResponseDeserializer extends FakePostCode404Response.FakePostCode404Response1 implements StatusCodeResponseDeserializer { - } - - public static final class FakePostResponses1 implements ResponsesDeserializer { - private final Map statusCodeToResponseDeserializer; - public FakePostResponses1() { - this.statusCodeToResponseDeserializer = Map.ofEntries( - new AbstractMap.SimpleEntry<>("200", new StatusFakePostCode200ResponseDeserializer()), - new AbstractMap.SimpleEntry<>("404", new StatusFakePostCode404ResponseDeserializer()) - ); - } - - 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) { - throw new ApiException( - "Invalid response statusCode="+statusCode+" has no response defined in the openapi document", - response - ); - } - if (statusCodeDeserializer instanceof StatusFakePostCode200ResponseDeserializer castDeserializer) { - var deserializedResponse = castDeserializer.deserialize(response, configuration); - return new EndpointFakePostCode200Response(response, deserializedResponse.body(), deserializedResponse.headers()); - } else { - StatusFakePostCode404ResponseDeserializer castDeserializer = (StatusFakePostCode404ResponseDeserializer) statusCodeDeserializer; - var deserializedResponse = castDeserializer.deserialize(response, configuration); - throw new FakePostCode404Response.ResponseApiException( - "Received error statusCode response from server", - response, - deserializedResponse - ); - } - } - } -} diff --git a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/fake/post/FakePostSecurityInfo.kt b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/fake/post/FakePostSecurityInfo.kt deleted file mode 100644 index 013b581a6d4..00000000000 --- a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/fake/post/FakePostSecurityInfo.kt +++ /dev/null @@ -1,24 +0,0 @@ -package org.openapijsonschematools.client.paths.fake.post; - -import org.openapijsonschematools.client.paths.fake.post.security.FakePostSecurityRequirementObject0; -import org.openapijsonschematools.client.securityrequirementobjects.SecurityRequirementObject; -import org.openapijsonschematools.client.securityrequirementobjects.SecurityRequirementObjectProvider; - -public class FakePostSecurityInfo { - public static class FakePostSecurityInfo1 implements SecurityRequirementObjectProvider { - public final FakePostSecurityRequirementObject0 security0; - - public FakePostSecurityInfo1() { - security0 = new FakePostSecurityRequirementObject0(); - } - - @Override - public SecurityRequirementObject getSecurityRequirementObject(SecurityIndex securityIndex) { - return security0; - } - } - - public enum SecurityIndex { - SECURITY_0 - } -} \ No newline at end of file diff --git a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/fake/post/requestbody/content/applicationxwwwformurlencoded/ApplicationxwwwformurlencodedSchema.kt b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/fake/post/requestbody/content/applicationxwwwformurlencoded/ApplicationxwwwformurlencodedSchema.kt deleted file mode 100644 index 4c57be2635e..00000000000 --- a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/fake/post/requestbody/content/applicationxwwwformurlencoded/ApplicationxwwwformurlencodedSchema.kt +++ /dev/null @@ -1,1591 +0,0 @@ -package org.openapijsonschematools.client.paths.fake.post.requestbody.content.applicationxwwwformurlencoded; -import java.time.ZonedDateTime; -import java.util.ArrayList; -import java.util.HashSet; -import java.util.LinkedHashMap; -import java.util.LinkedHashSet; -import java.util.List; -import java.util.Map; -import java.util.Objects; -import java.util.Set; -import java.util.regex.Pattern; -import org.checkerframework.checker.nullness.qual.Nullable; -import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags; -import org.openapijsonschematools.client.configurations.SchemaConfiguration; -import org.openapijsonschematools.client.exceptions.InvalidAdditionalPropertyException; -import org.openapijsonschematools.client.exceptions.UnsetPropertyException; -import org.openapijsonschematools.client.exceptions.ValidationException; -import org.openapijsonschematools.client.schemas.DateJsonSchema; -import org.openapijsonschematools.client.schemas.GenericBuilder; -import org.openapijsonschematools.client.schemas.Int64JsonSchema; -import org.openapijsonschematools.client.schemas.StringJsonSchema; -import org.openapijsonschematools.client.schemas.UnsetAddPropsSetter; -import org.openapijsonschematools.client.schemas.validation.DefaultValueMethod; -import org.openapijsonschematools.client.schemas.validation.FrozenMap; -import org.openapijsonschematools.client.schemas.validation.JsonSchema; -import org.openapijsonschematools.client.schemas.validation.JsonSchemaInfo; -import org.openapijsonschematools.client.schemas.validation.MapSchemaValidator; -import org.openapijsonschematools.client.schemas.validation.NumberSchemaValidator; -import org.openapijsonschematools.client.schemas.validation.PathToSchemasMap; -import org.openapijsonschematools.client.schemas.validation.PropertyEntry; -import org.openapijsonschematools.client.schemas.validation.StringSchemaValidator; -import org.openapijsonschematools.client.schemas.validation.ValidationMetadata; - -public class ApplicationxwwwformurlencodedSchema { - // nest classes so all schemas and input/output classes can be public - - - public sealed interface ApplicationxwwwformurlencodedIntegerBoxed permits ApplicationxwwwformurlencodedIntegerBoxedNumber { - @Nullable Object getData(); - } - - public record ApplicationxwwwformurlencodedIntegerBoxedNumber(Number data) implements ApplicationxwwwformurlencodedIntegerBoxed { - @Override - public @Nullable Object getData() { - return data; - } - } - - - - public static class ApplicationxwwwformurlencodedInteger extends JsonSchema implements NumberSchemaValidator { - private static @Nullable ApplicationxwwwformurlencodedInteger instance = null; - - protected ApplicationxwwwformurlencodedInteger() { - super(new JsonSchemaInfo() - .type(Set.of( - Integer.class, - Long.class, - Float.class, - Double.class - )) - .format("int") - .maximum(100) - .minimum(10) - ); - } - - public static ApplicationxwwwformurlencodedInteger getInstance() { - if (instance == null) { - instance = new ApplicationxwwwformurlencodedInteger(); - } - return instance; - } - - @Override - public Number validate(Number arg, SchemaConfiguration configuration) throws ValidationException { - Set> pathSet = new HashSet<>(); - List pathToItem = List.of("args[0"); - Number castArg = castToAllowedTypes(arg, pathToItem, pathSet); - SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().build())); - ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, new PathToSchemasMap(), new LinkedHashSet<>()); - getPathToSchemas(this, castArg, validationMetadata, pathSet); - return castArg; - } - - public int validate(int arg, SchemaConfiguration configuration) throws ValidationException { - return (int) validate((Number) arg, configuration); - } - - public float validate(float arg, SchemaConfiguration configuration) throws ValidationException { - return (float) validate((Number) arg, configuration); - } - - public long validate(long arg, SchemaConfiguration configuration) throws ValidationException { - return (long) validate((Number) arg, configuration); - } - - 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 { - 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"); - } - @Override - public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { - 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"); - } - @Override - 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 { - 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"); - } - } - - public sealed interface ApplicationxwwwformurlencodedInt32Boxed permits ApplicationxwwwformurlencodedInt32BoxedNumber { - @Nullable Object getData(); - } - - public record ApplicationxwwwformurlencodedInt32BoxedNumber(Number data) implements ApplicationxwwwformurlencodedInt32Boxed { - @Override - public @Nullable Object getData() { - return data; - } - } - - - - public static class ApplicationxwwwformurlencodedInt32 extends JsonSchema implements NumberSchemaValidator { - private static @Nullable ApplicationxwwwformurlencodedInt32 instance = null; - - protected ApplicationxwwwformurlencodedInt32() { - super(new JsonSchemaInfo() - .type(Set.of( - Integer.class, - Long.class, - Float.class, - Double.class - )) - .format("int32") - .maximum(200) - .minimum(20) - ); - } - - public static ApplicationxwwwformurlencodedInt32 getInstance() { - if (instance == null) { - instance = new ApplicationxwwwformurlencodedInt32(); - } - return instance; - } - - @Override - public Number validate(Number arg, SchemaConfiguration configuration) throws ValidationException { - Set> pathSet = new HashSet<>(); - List pathToItem = List.of("args[0"); - Number castArg = castToAllowedTypes(arg, pathToItem, pathSet); - SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().build())); - ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, new PathToSchemasMap(), new LinkedHashSet<>()); - getPathToSchemas(this, castArg, validationMetadata, pathSet); - return castArg; - } - - public int validate(int arg, SchemaConfiguration configuration) throws ValidationException { - return (int) validate((Number) arg, configuration); - } - - 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 { - 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"); - } - @Override - public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { - 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"); - } - @Override - 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 { - 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"); - } - } - - public static class ApplicationxwwwformurlencodedInt64 extends Int64JsonSchema.Int64JsonSchema1 { - private static @Nullable ApplicationxwwwformurlencodedInt64 instance = null; - public static ApplicationxwwwformurlencodedInt64 getInstance() { - if (instance == null) { - instance = new ApplicationxwwwformurlencodedInt64(); - } - return instance; - } - } - - - public sealed interface ApplicationxwwwformurlencodedNumberBoxed permits ApplicationxwwwformurlencodedNumberBoxedNumber { - @Nullable Object getData(); - } - - public record ApplicationxwwwformurlencodedNumberBoxedNumber(Number data) implements ApplicationxwwwformurlencodedNumberBoxed { - @Override - public @Nullable Object getData() { - return data; - } - } - - - - public static class ApplicationxwwwformurlencodedNumber extends JsonSchema implements NumberSchemaValidator { - private static @Nullable ApplicationxwwwformurlencodedNumber instance = null; - - protected ApplicationxwwwformurlencodedNumber() { - super(new JsonSchemaInfo() - .type(Set.of( - Integer.class, - Long.class, - Float.class, - Double.class - )) - .maximum(543.2) - .minimum(32.1) - ); - } - - public static ApplicationxwwwformurlencodedNumber getInstance() { - if (instance == null) { - instance = new ApplicationxwwwformurlencodedNumber(); - } - return instance; - } - - @Override - public Number validate(Number arg, SchemaConfiguration configuration) throws ValidationException { - Set> pathSet = new HashSet<>(); - List pathToItem = List.of("args[0"); - Number castArg = castToAllowedTypes(arg, pathToItem, pathSet); - SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().build())); - ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, new PathToSchemasMap(), new LinkedHashSet<>()); - PathToSchemasMap pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet); - return castArg; - } - - public int validate(int arg, SchemaConfiguration configuration) throws ValidationException { - return (int) validate((Number) arg, configuration); - } - - public long validate(long arg, SchemaConfiguration configuration) throws ValidationException { - return (long) validate((Number) arg, configuration); - } - - public float validate(float arg, SchemaConfiguration configuration) throws ValidationException { - return (float) validate((Number) arg, configuration); - } - - 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 { - 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"); - } - @Override - public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { - 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"); - } - @Override - 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 { - 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"); - } - } - - public sealed interface ApplicationxwwwformurlencodedFloatBoxed permits ApplicationxwwwformurlencodedFloatBoxedNumber { - @Nullable Object getData(); - } - - public record ApplicationxwwwformurlencodedFloatBoxedNumber(Number data) implements ApplicationxwwwformurlencodedFloatBoxed { - @Override - public @Nullable Object getData() { - return data; - } - } - - - - public static class ApplicationxwwwformurlencodedFloat extends JsonSchema implements NumberSchemaValidator { - private static @Nullable ApplicationxwwwformurlencodedFloat instance = null; - - protected ApplicationxwwwformurlencodedFloat() { - super(new JsonSchemaInfo() - .type(Set.of( - Integer.class, - Long.class, - Float.class, - Double.class - )) - .format("float") - .maximum(987.6) - ); - } - - public static ApplicationxwwwformurlencodedFloat getInstance() { - if (instance == null) { - instance = new ApplicationxwwwformurlencodedFloat(); - } - return instance; - } - - @Override - public Number validate(Number arg, SchemaConfiguration configuration) throws ValidationException { - Set> pathSet = new HashSet<>(); - List pathToItem = List.of("args[0"); - Number castArg = castToAllowedTypes(arg, pathToItem, pathSet); - SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().build())); - ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, new PathToSchemasMap(), new LinkedHashSet<>()); - PathToSchemasMap pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet); - return castArg; - } - 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 { - 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"); - } - @Override - public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { - 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"); - } - @Override - 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 { - 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"); - } - } - - public sealed interface ApplicationxwwwformurlencodedDoubleBoxed permits ApplicationxwwwformurlencodedDoubleBoxedNumber { - @Nullable Object getData(); - } - - public record ApplicationxwwwformurlencodedDoubleBoxedNumber(Number data) implements ApplicationxwwwformurlencodedDoubleBoxed { - @Override - public @Nullable Object getData() { - return data; - } - } - - - - public static class ApplicationxwwwformurlencodedDouble extends JsonSchema implements NumberSchemaValidator { - private static @Nullable ApplicationxwwwformurlencodedDouble instance = null; - - protected ApplicationxwwwformurlencodedDouble() { - super(new JsonSchemaInfo() - .type(Set.of( - Integer.class, - Long.class, - Float.class, - Double.class - )) - .format("double") - .maximum(123.4) - .minimum(67.8) - ); - } - - public static ApplicationxwwwformurlencodedDouble getInstance() { - if (instance == null) { - instance = new ApplicationxwwwformurlencodedDouble(); - } - return instance; - } - - @Override - public Number validate(Number arg, SchemaConfiguration configuration) throws ValidationException { - Set> pathSet = new HashSet<>(); - List pathToItem = List.of("args[0"); - Number castArg = castToAllowedTypes(arg, pathToItem, pathSet); - SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().build())); - ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, new PathToSchemasMap(), new LinkedHashSet<>()); - PathToSchemasMap pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet); - return castArg; - } - 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 { - 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"); - } - @Override - public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { - 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"); - } - @Override - 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 { - 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"); - } - } - - public sealed interface ApplicationxwwwformurlencodedStringBoxed permits ApplicationxwwwformurlencodedStringBoxedString { - @Nullable Object getData(); - } - - public record ApplicationxwwwformurlencodedStringBoxedString(String data) implements ApplicationxwwwformurlencodedStringBoxed { - @Override - public @Nullable Object getData() { - return data; - } - } - - - - public static class ApplicationxwwwformurlencodedString extends JsonSchema implements StringSchemaValidator { - private static @Nullable ApplicationxwwwformurlencodedString instance = null; - - protected ApplicationxwwwformurlencodedString() { - super(new JsonSchemaInfo() - .type(Set.of( - String.class - )) - .pattern(Pattern.compile( - "[a-z]", - Pattern.CASE_INSENSITIVE - )) - ); - } - - public static ApplicationxwwwformurlencodedString getInstance() { - if (instance == null) { - instance = new ApplicationxwwwformurlencodedString(); - } - return instance; - } - - @Override - public String validate(String arg, SchemaConfiguration configuration) throws ValidationException { - Set> pathSet = new HashSet<>(); - List pathToItem = List.of("args[0"); - String castArg = castToAllowedTypes(arg, pathToItem, pathSet); - SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().build())); - ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, new PathToSchemasMap(), new LinkedHashSet<>()); - getPathToSchemas(this, castArg, validationMetadata, pathSet); - return castArg; - } - - @Override - public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws 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"); - } - @Override - public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { - 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"); - } - @Override - 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 { - 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"); - } - } - - public sealed interface ApplicationxwwwformurlencodedPatternWithoutDelimiterBoxed permits ApplicationxwwwformurlencodedPatternWithoutDelimiterBoxedString { - @Nullable Object getData(); - } - - public record ApplicationxwwwformurlencodedPatternWithoutDelimiterBoxedString(String data) implements ApplicationxwwwformurlencodedPatternWithoutDelimiterBoxed { - @Override - public @Nullable Object getData() { - return data; - } - } - - - - public static class ApplicationxwwwformurlencodedPatternWithoutDelimiter extends JsonSchema implements StringSchemaValidator { - private static @Nullable ApplicationxwwwformurlencodedPatternWithoutDelimiter instance = null; - - protected ApplicationxwwwformurlencodedPatternWithoutDelimiter() { - super(new JsonSchemaInfo() - .type(Set.of( - String.class - )) - .pattern(Pattern.compile( - "^[A-Z].*" - )) - ); - } - - public static ApplicationxwwwformurlencodedPatternWithoutDelimiter getInstance() { - if (instance == null) { - instance = new ApplicationxwwwformurlencodedPatternWithoutDelimiter(); - } - return instance; - } - - @Override - public String validate(String arg, SchemaConfiguration configuration) throws ValidationException { - Set> pathSet = new HashSet<>(); - List pathToItem = List.of("args[0"); - String castArg = castToAllowedTypes(arg, pathToItem, pathSet); - SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().build())); - ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, new PathToSchemasMap(), new LinkedHashSet<>()); - getPathToSchemas(this, castArg, validationMetadata, pathSet); - return castArg; - } - - @Override - public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws 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"); - } - @Override - public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { - 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"); - } - @Override - 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 { - 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"); - } - } - - public static class ApplicationxwwwformurlencodedByte extends StringJsonSchema.StringJsonSchema1 { - private static @Nullable ApplicationxwwwformurlencodedByte instance = null; - public static ApplicationxwwwformurlencodedByte getInstance() { - if (instance == null) { - instance = new ApplicationxwwwformurlencodedByte(); - } - return instance; - } - } - - - public static class ApplicationxwwwformurlencodedBinary extends StringJsonSchema.StringJsonSchema1 { - // BinarySchema - private static @Nullable ApplicationxwwwformurlencodedBinary instance = null; - public static ApplicationxwwwformurlencodedBinary getInstance() { - if (instance == null) { - instance = new ApplicationxwwwformurlencodedBinary(); - } - return instance; - } - } - - - public static class ApplicationxwwwformurlencodedDate extends DateJsonSchema.DateJsonSchema1 { - private static @Nullable ApplicationxwwwformurlencodedDate instance = null; - public static ApplicationxwwwformurlencodedDate getInstance() { - if (instance == null) { - instance = new ApplicationxwwwformurlencodedDate(); - } - return instance; - } - } - - - public sealed interface ApplicationxwwwformurlencodedDateTimeBoxed permits ApplicationxwwwformurlencodedDateTimeBoxedString { - @Nullable Object getData(); - } - - public record ApplicationxwwwformurlencodedDateTimeBoxedString(String data) implements ApplicationxwwwformurlencodedDateTimeBoxed { - @Override - public @Nullable Object getData() { - return data; - } - } - - - - public static class ApplicationxwwwformurlencodedDateTime extends JsonSchema implements StringSchemaValidator, DefaultValueMethod { - private static @Nullable ApplicationxwwwformurlencodedDateTime instance = null; - - protected ApplicationxwwwformurlencodedDateTime() { - super(new JsonSchemaInfo() - .type(Set.of( - String.class - )) - .format("date-time") - .defaultValue("2010-02-01T10:20:10.111110+01:00") - ); - } - - public static ApplicationxwwwformurlencodedDateTime getInstance() { - if (instance == null) { - instance = new ApplicationxwwwformurlencodedDateTime(); - } - return instance; - } - - @Override - public String validate(String arg, SchemaConfiguration configuration) throws ValidationException { - Set> pathSet = new HashSet<>(); - List pathToItem = List.of("args[0"); - String castArg = castToAllowedTypes(arg, pathToItem, pathSet); - SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().build())); - ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, new PathToSchemasMap(), new LinkedHashSet<>()); - getPathToSchemas(this, castArg, validationMetadata, pathSet); - return castArg; - } - - @Override - public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws 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"); - } - @Override - public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { - 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"); - } - public String defaultValue() throws ValidationException { - if (defaultValue instanceof String) { - return (String) defaultValue; - } - throw new ValidationException("Invalid type stored in defaultValue"); - } - @Override - 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 { - 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"); - } - } - - public sealed interface ApplicationxwwwformurlencodedPasswordBoxed permits ApplicationxwwwformurlencodedPasswordBoxedString { - @Nullable Object getData(); - } - - public record ApplicationxwwwformurlencodedPasswordBoxedString(String data) implements ApplicationxwwwformurlencodedPasswordBoxed { - @Override - public @Nullable Object getData() { - return data; - } - } - - - - public static class ApplicationxwwwformurlencodedPassword extends JsonSchema implements StringSchemaValidator { - private static @Nullable ApplicationxwwwformurlencodedPassword instance = null; - - protected ApplicationxwwwformurlencodedPassword() { - super(new JsonSchemaInfo() - .type(Set.of( - String.class - )) - .format("password") - .maxLength(64) - .minLength(10) - ); - } - - public static ApplicationxwwwformurlencodedPassword getInstance() { - if (instance == null) { - instance = new ApplicationxwwwformurlencodedPassword(); - } - return instance; - } - - @Override - public String validate(String arg, SchemaConfiguration configuration) throws ValidationException { - Set> pathSet = new HashSet<>(); - List pathToItem = List.of("args[0"); - String castArg = castToAllowedTypes(arg, pathToItem, pathSet); - SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().build())); - ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, new PathToSchemasMap(), new LinkedHashSet<>()); - getPathToSchemas(this, castArg, validationMetadata, pathSet); - return castArg; - } - - @Override - public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws 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"); - } - @Override - public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { - 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"); - } - @Override - 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 { - 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"); - } - } - - public static class ApplicationxwwwformurlencodedCallback extends StringJsonSchema.StringJsonSchema1 { - private static @Nullable ApplicationxwwwformurlencodedCallback instance = null; - public static ApplicationxwwwformurlencodedCallback getInstance() { - if (instance == null) { - instance = new ApplicationxwwwformurlencodedCallback(); - } - return instance; - } - } - - - public static class ApplicationxwwwformurlencodedSchemaMap extends FrozenMap<@Nullable Object> { - protected ApplicationxwwwformurlencodedSchemaMap(FrozenMap<@Nullable Object> m) { - super(m); - } - public static final Set requiredKeys = Set.of( - "byte", - "double", - "number", - "pattern_without_delimiter" - ); - public static final Set optionalKeys = Set.of( - "integer", - "int32", - "int64", - "float", - "string", - "binary", - "date", - "dateTime", - "password", - "callback" - ); - public static ApplicationxwwwformurlencodedSchemaMap of(Map arg, SchemaConfiguration configuration) throws ValidationException { - return ApplicationxwwwformurlencodedSchema1.getInstance().validate(arg, configuration); - } - - public String pattern_without_delimiter() { - @Nullable Object value = get("pattern_without_delimiter"); - if (!(value instanceof String)) { - throw new RuntimeException("Invalid value stored for pattern_without_delimiter"); - } - return (String) value; - } - - public Number int32() throws UnsetPropertyException { - String key = "int32"; - throwIfKeyNotPresent(key); - @Nullable Object value = get(key); - if (!(value instanceof Number)) { - throw new RuntimeException("Invalid value stored for int32"); - } - return (Number) value; - } - - public Number int64() throws UnsetPropertyException { - String key = "int64"; - throwIfKeyNotPresent(key); - @Nullable Object value = get(key); - if (!(value instanceof Number)) { - throw new RuntimeException("Invalid value stored for int64"); - } - return (Number) value; - } - - public String binary() throws UnsetPropertyException { - String key = "binary"; - throwIfKeyNotPresent(key); - @Nullable Object value = get(key); - if (!(value instanceof String)) { - throw new RuntimeException("Invalid value stored for binary"); - } - return (String) value; - } - - public String date() throws UnsetPropertyException { - String key = "date"; - throwIfKeyNotPresent(key); - @Nullable Object value = get(key); - if (!(value instanceof String)) { - throw new RuntimeException("Invalid value stored for date"); - } - return (String) value; - } - - public String dateTime() throws UnsetPropertyException { - String key = "dateTime"; - throwIfKeyNotPresent(key); - @Nullable Object value = get(key); - if (!(value instanceof String)) { - throw new RuntimeException("Invalid value stored for dateTime"); - } - return (String) value; - } - - public String password() throws UnsetPropertyException { - String key = "password"; - throwIfKeyNotPresent(key); - @Nullable Object value = get(key); - if (!(value instanceof String)) { - throw new RuntimeException("Invalid value stored for password"); - } - return (String) value; - } - - public String callback() throws UnsetPropertyException { - String key = "callback"; - throwIfKeyNotPresent(key); - @Nullable Object value = get(key); - if (!(value instanceof String)) { - throw new RuntimeException("Invalid value stored for callback"); - } - return (String) value; - } - - public @Nullable Object getAdditionalProperty(String name) throws UnsetPropertyException, InvalidAdditionalPropertyException { - throwIfKeyKnown(name, requiredKeys, optionalKeys); - throwIfKeyNotPresent(name); - return get(name); - } - } - - public interface SetterForApplicationxwwwformurlencodedByte { - Map getInstance(); - T getBuilderAfterApplicationxwwwformurlencodedByte(Map instance); - - default T setByte(String value) { - var instance = getInstance(); - instance.put("byte", value); - return getBuilderAfterApplicationxwwwformurlencodedByte(instance); - } - } - - public interface SetterForApplicationxwwwformurlencodedDouble { - Map getInstance(); - T getBuilderAfterApplicationxwwwformurlencodedDouble(Map instance); - - default T setDouble(int value) { - var instance = getInstance(); - instance.put("double", value); - return getBuilderAfterApplicationxwwwformurlencodedDouble(instance); - } - - default T setDouble(float value) { - var instance = getInstance(); - instance.put("double", value); - return getBuilderAfterApplicationxwwwformurlencodedDouble(instance); - } - - default T setDouble(long value) { - var instance = getInstance(); - instance.put("double", value); - return getBuilderAfterApplicationxwwwformurlencodedDouble(instance); - } - - default T setDouble(double value) { - var instance = getInstance(); - instance.put("double", value); - return getBuilderAfterApplicationxwwwformurlencodedDouble(instance); - } - } - - public interface SetterForApplicationxwwwformurlencodedNumber { - Map getInstance(); - T getBuilderAfterApplicationxwwwformurlencodedNumber(Map instance); - - default T setNumber(int value) { - var instance = getInstance(); - instance.put("number", value); - return getBuilderAfterApplicationxwwwformurlencodedNumber(instance); - } - - default T setNumber(float value) { - var instance = getInstance(); - instance.put("number", value); - return getBuilderAfterApplicationxwwwformurlencodedNumber(instance); - } - - default T setNumber(long value) { - var instance = getInstance(); - instance.put("number", value); - return getBuilderAfterApplicationxwwwformurlencodedNumber(instance); - } - - default T setNumber(double value) { - var instance = getInstance(); - instance.put("number", value); - return getBuilderAfterApplicationxwwwformurlencodedNumber(instance); - } - } - - public interface SetterForApplicationxwwwformurlencodedPatternWithoutDelimiter { - Map getInstance(); - T getBuilderAfterApplicationxwwwformurlencodedPatternWithoutDelimiter(Map instance); - - default T pattern_without_delimiter(String value) { - var instance = getInstance(); - instance.put("pattern_without_delimiter", value); - return getBuilderAfterApplicationxwwwformurlencodedPatternWithoutDelimiter(instance); - } - } - - public interface SetterForApplicationxwwwformurlencodedInteger { - Map getInstance(); - T getBuilderAfterApplicationxwwwformurlencodedInteger(Map instance); - - default T setInteger(int value) { - var instance = getInstance(); - instance.put("integer", value); - return getBuilderAfterApplicationxwwwformurlencodedInteger(instance); - } - - default T setInteger(float value) { - var instance = getInstance(); - instance.put("integer", value); - return getBuilderAfterApplicationxwwwformurlencodedInteger(instance); - } - - default T setInteger(long value) { - var instance = getInstance(); - instance.put("integer", value); - return getBuilderAfterApplicationxwwwformurlencodedInteger(instance); - } - - default T setInteger(double value) { - var instance = getInstance(); - instance.put("integer", value); - return getBuilderAfterApplicationxwwwformurlencodedInteger(instance); - } - } - - public interface SetterForApplicationxwwwformurlencodedInt32 { - Map getInstance(); - T getBuilderAfterApplicationxwwwformurlencodedInt32(Map instance); - - default T int32(int value) { - var instance = getInstance(); - instance.put("int32", value); - return getBuilderAfterApplicationxwwwformurlencodedInt32(instance); - } - - default T int32(float value) { - var instance = getInstance(); - instance.put("int32", value); - return getBuilderAfterApplicationxwwwformurlencodedInt32(instance); - } - } - - public interface SetterForApplicationxwwwformurlencodedInt64 { - Map getInstance(); - T getBuilderAfterApplicationxwwwformurlencodedInt64(Map instance); - - default T int64(int value) { - var instance = getInstance(); - instance.put("int64", value); - return getBuilderAfterApplicationxwwwformurlencodedInt64(instance); - } - - default T int64(float value) { - var instance = getInstance(); - instance.put("int64", value); - return getBuilderAfterApplicationxwwwformurlencodedInt64(instance); - } - - default T int64(long value) { - var instance = getInstance(); - instance.put("int64", value); - return getBuilderAfterApplicationxwwwformurlencodedInt64(instance); - } - - default T int64(double value) { - var instance = getInstance(); - instance.put("int64", value); - return getBuilderAfterApplicationxwwwformurlencodedInt64(instance); - } - } - - public interface SetterForApplicationxwwwformurlencodedFloat { - Map getInstance(); - T getBuilderAfterApplicationxwwwformurlencodedFloat(Map instance); - - default T setFloat(int value) { - var instance = getInstance(); - instance.put("float", value); - return getBuilderAfterApplicationxwwwformurlencodedFloat(instance); - } - - default T setFloat(float value) { - var instance = getInstance(); - instance.put("float", value); - return getBuilderAfterApplicationxwwwformurlencodedFloat(instance); - } - - default T setFloat(long value) { - var instance = getInstance(); - instance.put("float", value); - return getBuilderAfterApplicationxwwwformurlencodedFloat(instance); - } - - default T setFloat(double value) { - var instance = getInstance(); - instance.put("float", value); - return getBuilderAfterApplicationxwwwformurlencodedFloat(instance); - } - } - - public interface SetterForApplicationxwwwformurlencodedString { - Map getInstance(); - T getBuilderAfterApplicationxwwwformurlencodedString(Map instance); - - default T setString(String value) { - var instance = getInstance(); - instance.put("string", value); - return getBuilderAfterApplicationxwwwformurlencodedString(instance); - } - } - - public interface SetterForApplicationxwwwformurlencodedBinary { - Map getInstance(); - T getBuilderAfterApplicationxwwwformurlencodedBinary(Map instance); - - default T binary(String value) { - var instance = getInstance(); - instance.put("binary", value); - return getBuilderAfterApplicationxwwwformurlencodedBinary(instance); - } - } - - public interface SetterForApplicationxwwwformurlencodedDate { - Map getInstance(); - T getBuilderAfterApplicationxwwwformurlencodedDate(Map instance); - - default T date(String value) { - var instance = getInstance(); - instance.put("date", value); - return getBuilderAfterApplicationxwwwformurlencodedDate(instance); - } - } - - public interface SetterForApplicationxwwwformurlencodedDateTime { - Map getInstance(); - T getBuilderAfterApplicationxwwwformurlencodedDateTime(Map instance); - - default T dateTime(String value) { - var instance = getInstance(); - instance.put("dateTime", value); - return getBuilderAfterApplicationxwwwformurlencodedDateTime(instance); - } - } - - public interface SetterForApplicationxwwwformurlencodedPassword { - Map getInstance(); - T getBuilderAfterApplicationxwwwformurlencodedPassword(Map instance); - - default T password(String value) { - var instance = getInstance(); - instance.put("password", value); - return getBuilderAfterApplicationxwwwformurlencodedPassword(instance); - } - } - - public interface SetterForApplicationxwwwformurlencodedCallback { - Map getInstance(); - T getBuilderAfterApplicationxwwwformurlencodedCallback(Map instance); - - default T callback(String value) { - var instance = getInstance(); - instance.put("callback", value); - return getBuilderAfterApplicationxwwwformurlencodedCallback(instance); - } - } - - public static class ApplicationxwwwformurlencodedSchemaMap0000Builder extends UnsetAddPropsSetter implements GenericBuilder>, SetterForApplicationxwwwformurlencodedInteger, SetterForApplicationxwwwformurlencodedInt32, SetterForApplicationxwwwformurlencodedInt64, SetterForApplicationxwwwformurlencodedFloat, SetterForApplicationxwwwformurlencodedString, SetterForApplicationxwwwformurlencodedBinary, SetterForApplicationxwwwformurlencodedDate, SetterForApplicationxwwwformurlencodedDateTime, SetterForApplicationxwwwformurlencodedPassword, SetterForApplicationxwwwformurlencodedCallback { - private final Map instance; - private static final Set knownKeys = Set.of( - "byte", - "double", - "number", - "pattern_without_delimiter", - "integer", - "int32", - "int64", - "float", - "string", - "binary", - "date", - "dateTime", - "password", - "callback" - ); - public Set getKnownKeys() { - return knownKeys; - } - public ApplicationxwwwformurlencodedSchemaMap0000Builder(Map instance) { - this.instance = instance; - } - public Map build() { - return instance; - } - public Map getInstance() { - return instance; - } - public ApplicationxwwwformurlencodedSchemaMap0000Builder getBuilderAfterApplicationxwwwformurlencodedInteger(Map instance) { - return this; - } - public ApplicationxwwwformurlencodedSchemaMap0000Builder getBuilderAfterApplicationxwwwformurlencodedInt32(Map instance) { - return this; - } - public ApplicationxwwwformurlencodedSchemaMap0000Builder getBuilderAfterApplicationxwwwformurlencodedInt64(Map instance) { - return this; - } - public ApplicationxwwwformurlencodedSchemaMap0000Builder getBuilderAfterApplicationxwwwformurlencodedFloat(Map instance) { - return this; - } - public ApplicationxwwwformurlencodedSchemaMap0000Builder getBuilderAfterApplicationxwwwformurlencodedString(Map instance) { - return this; - } - public ApplicationxwwwformurlencodedSchemaMap0000Builder getBuilderAfterApplicationxwwwformurlencodedBinary(Map instance) { - return this; - } - public ApplicationxwwwformurlencodedSchemaMap0000Builder getBuilderAfterApplicationxwwwformurlencodedDate(Map instance) { - return this; - } - public ApplicationxwwwformurlencodedSchemaMap0000Builder getBuilderAfterApplicationxwwwformurlencodedDateTime(Map instance) { - return this; - } - public ApplicationxwwwformurlencodedSchemaMap0000Builder getBuilderAfterApplicationxwwwformurlencodedPassword(Map instance) { - return this; - } - public ApplicationxwwwformurlencodedSchemaMap0000Builder getBuilderAfterApplicationxwwwformurlencodedCallback(Map instance) { - return this; - } - public ApplicationxwwwformurlencodedSchemaMap0000Builder getBuilderAfterAdditionalProperty(Map instance) { - return this; - } - } - - public static class ApplicationxwwwformurlencodedSchemaMap0001Builder implements SetterForApplicationxwwwformurlencodedPatternWithoutDelimiter { - private final Map instance; - public ApplicationxwwwformurlencodedSchemaMap0001Builder(Map instance) { - this.instance = instance; - } - public Map getInstance() { - return instance; - } - public ApplicationxwwwformurlencodedSchemaMap0000Builder getBuilderAfterApplicationxwwwformurlencodedPatternWithoutDelimiter(Map instance) { - return new ApplicationxwwwformurlencodedSchemaMap0000Builder(instance); - } - } - - public static class ApplicationxwwwformurlencodedSchemaMap0010Builder implements SetterForApplicationxwwwformurlencodedNumber { - private final Map instance; - public ApplicationxwwwformurlencodedSchemaMap0010Builder(Map instance) { - this.instance = instance; - } - public Map getInstance() { - return instance; - } - public ApplicationxwwwformurlencodedSchemaMap0000Builder getBuilderAfterApplicationxwwwformurlencodedNumber(Map instance) { - return new ApplicationxwwwformurlencodedSchemaMap0000Builder(instance); - } - } - - public static class ApplicationxwwwformurlencodedSchemaMap0011Builder implements SetterForApplicationxwwwformurlencodedNumber, SetterForApplicationxwwwformurlencodedPatternWithoutDelimiter { - private final Map instance; - public ApplicationxwwwformurlencodedSchemaMap0011Builder(Map instance) { - this.instance = instance; - } - public Map getInstance() { - return instance; - } - public ApplicationxwwwformurlencodedSchemaMap0001Builder getBuilderAfterApplicationxwwwformurlencodedNumber(Map instance) { - return new ApplicationxwwwformurlencodedSchemaMap0001Builder(instance); - } - public ApplicationxwwwformurlencodedSchemaMap0010Builder getBuilderAfterApplicationxwwwformurlencodedPatternWithoutDelimiter(Map instance) { - return new ApplicationxwwwformurlencodedSchemaMap0010Builder(instance); - } - } - - public static class ApplicationxwwwformurlencodedSchemaMap0100Builder implements SetterForApplicationxwwwformurlencodedDouble { - private final Map instance; - public ApplicationxwwwformurlencodedSchemaMap0100Builder(Map instance) { - this.instance = instance; - } - public Map getInstance() { - return instance; - } - public ApplicationxwwwformurlencodedSchemaMap0000Builder getBuilderAfterApplicationxwwwformurlencodedDouble(Map instance) { - return new ApplicationxwwwformurlencodedSchemaMap0000Builder(instance); - } - } - - public static class ApplicationxwwwformurlencodedSchemaMap0101Builder implements SetterForApplicationxwwwformurlencodedDouble, SetterForApplicationxwwwformurlencodedPatternWithoutDelimiter { - private final Map instance; - public ApplicationxwwwformurlencodedSchemaMap0101Builder(Map instance) { - this.instance = instance; - } - public Map getInstance() { - return instance; - } - public ApplicationxwwwformurlencodedSchemaMap0001Builder getBuilderAfterApplicationxwwwformurlencodedDouble(Map instance) { - return new ApplicationxwwwformurlencodedSchemaMap0001Builder(instance); - } - public ApplicationxwwwformurlencodedSchemaMap0100Builder getBuilderAfterApplicationxwwwformurlencodedPatternWithoutDelimiter(Map instance) { - return new ApplicationxwwwformurlencodedSchemaMap0100Builder(instance); - } - } - - public static class ApplicationxwwwformurlencodedSchemaMap0110Builder implements SetterForApplicationxwwwformurlencodedDouble, SetterForApplicationxwwwformurlencodedNumber { - private final Map instance; - public ApplicationxwwwformurlencodedSchemaMap0110Builder(Map instance) { - this.instance = instance; - } - public Map getInstance() { - return instance; - } - public ApplicationxwwwformurlencodedSchemaMap0010Builder getBuilderAfterApplicationxwwwformurlencodedDouble(Map instance) { - return new ApplicationxwwwformurlencodedSchemaMap0010Builder(instance); - } - public ApplicationxwwwformurlencodedSchemaMap0100Builder getBuilderAfterApplicationxwwwformurlencodedNumber(Map instance) { - return new ApplicationxwwwformurlencodedSchemaMap0100Builder(instance); - } - } - - public static class ApplicationxwwwformurlencodedSchemaMap0111Builder implements SetterForApplicationxwwwformurlencodedDouble, SetterForApplicationxwwwformurlencodedNumber, SetterForApplicationxwwwformurlencodedPatternWithoutDelimiter { - private final Map instance; - public ApplicationxwwwformurlencodedSchemaMap0111Builder(Map instance) { - this.instance = instance; - } - public Map getInstance() { - return instance; - } - public ApplicationxwwwformurlencodedSchemaMap0011Builder getBuilderAfterApplicationxwwwformurlencodedDouble(Map instance) { - return new ApplicationxwwwformurlencodedSchemaMap0011Builder(instance); - } - public ApplicationxwwwformurlencodedSchemaMap0101Builder getBuilderAfterApplicationxwwwformurlencodedNumber(Map instance) { - return new ApplicationxwwwformurlencodedSchemaMap0101Builder(instance); - } - public ApplicationxwwwformurlencodedSchemaMap0110Builder getBuilderAfterApplicationxwwwformurlencodedPatternWithoutDelimiter(Map instance) { - return new ApplicationxwwwformurlencodedSchemaMap0110Builder(instance); - } - } - - public static class ApplicationxwwwformurlencodedSchemaMap1000Builder implements SetterForApplicationxwwwformurlencodedByte { - private final Map instance; - public ApplicationxwwwformurlencodedSchemaMap1000Builder(Map instance) { - this.instance = instance; - } - public Map getInstance() { - return instance; - } - public ApplicationxwwwformurlencodedSchemaMap0000Builder getBuilderAfterApplicationxwwwformurlencodedByte(Map instance) { - return new ApplicationxwwwformurlencodedSchemaMap0000Builder(instance); - } - } - - public static class ApplicationxwwwformurlencodedSchemaMap1001Builder implements SetterForApplicationxwwwformurlencodedByte, SetterForApplicationxwwwformurlencodedPatternWithoutDelimiter { - private final Map instance; - public ApplicationxwwwformurlencodedSchemaMap1001Builder(Map instance) { - this.instance = instance; - } - public Map getInstance() { - return instance; - } - public ApplicationxwwwformurlencodedSchemaMap0001Builder getBuilderAfterApplicationxwwwformurlencodedByte(Map instance) { - return new ApplicationxwwwformurlencodedSchemaMap0001Builder(instance); - } - public ApplicationxwwwformurlencodedSchemaMap1000Builder getBuilderAfterApplicationxwwwformurlencodedPatternWithoutDelimiter(Map instance) { - return new ApplicationxwwwformurlencodedSchemaMap1000Builder(instance); - } - } - - public static class ApplicationxwwwformurlencodedSchemaMap1010Builder implements SetterForApplicationxwwwformurlencodedByte, SetterForApplicationxwwwformurlencodedNumber { - private final Map instance; - public ApplicationxwwwformurlencodedSchemaMap1010Builder(Map instance) { - this.instance = instance; - } - public Map getInstance() { - return instance; - } - public ApplicationxwwwformurlencodedSchemaMap0010Builder getBuilderAfterApplicationxwwwformurlencodedByte(Map instance) { - return new ApplicationxwwwformurlencodedSchemaMap0010Builder(instance); - } - public ApplicationxwwwformurlencodedSchemaMap1000Builder getBuilderAfterApplicationxwwwformurlencodedNumber(Map instance) { - return new ApplicationxwwwformurlencodedSchemaMap1000Builder(instance); - } - } - - public static class ApplicationxwwwformurlencodedSchemaMap1011Builder implements SetterForApplicationxwwwformurlencodedByte, SetterForApplicationxwwwformurlencodedNumber, SetterForApplicationxwwwformurlencodedPatternWithoutDelimiter { - private final Map instance; - public ApplicationxwwwformurlencodedSchemaMap1011Builder(Map instance) { - this.instance = instance; - } - public Map getInstance() { - return instance; - } - public ApplicationxwwwformurlencodedSchemaMap0011Builder getBuilderAfterApplicationxwwwformurlencodedByte(Map instance) { - return new ApplicationxwwwformurlencodedSchemaMap0011Builder(instance); - } - public ApplicationxwwwformurlencodedSchemaMap1001Builder getBuilderAfterApplicationxwwwformurlencodedNumber(Map instance) { - return new ApplicationxwwwformurlencodedSchemaMap1001Builder(instance); - } - public ApplicationxwwwformurlencodedSchemaMap1010Builder getBuilderAfterApplicationxwwwformurlencodedPatternWithoutDelimiter(Map instance) { - return new ApplicationxwwwformurlencodedSchemaMap1010Builder(instance); - } - } - - public static class ApplicationxwwwformurlencodedSchemaMap1100Builder implements SetterForApplicationxwwwformurlencodedByte, SetterForApplicationxwwwformurlencodedDouble { - private final Map instance; - public ApplicationxwwwformurlencodedSchemaMap1100Builder(Map instance) { - this.instance = instance; - } - public Map getInstance() { - return instance; - } - public ApplicationxwwwformurlencodedSchemaMap0100Builder getBuilderAfterApplicationxwwwformurlencodedByte(Map instance) { - return new ApplicationxwwwformurlencodedSchemaMap0100Builder(instance); - } - public ApplicationxwwwformurlencodedSchemaMap1000Builder getBuilderAfterApplicationxwwwformurlencodedDouble(Map instance) { - return new ApplicationxwwwformurlencodedSchemaMap1000Builder(instance); - } - } - - public static class ApplicationxwwwformurlencodedSchemaMap1101Builder implements SetterForApplicationxwwwformurlencodedByte, SetterForApplicationxwwwformurlencodedDouble, SetterForApplicationxwwwformurlencodedPatternWithoutDelimiter { - private final Map instance; - public ApplicationxwwwformurlencodedSchemaMap1101Builder(Map instance) { - this.instance = instance; - } - public Map getInstance() { - return instance; - } - public ApplicationxwwwformurlencodedSchemaMap0101Builder getBuilderAfterApplicationxwwwformurlencodedByte(Map instance) { - return new ApplicationxwwwformurlencodedSchemaMap0101Builder(instance); - } - public ApplicationxwwwformurlencodedSchemaMap1001Builder getBuilderAfterApplicationxwwwformurlencodedDouble(Map instance) { - return new ApplicationxwwwformurlencodedSchemaMap1001Builder(instance); - } - public ApplicationxwwwformurlencodedSchemaMap1100Builder getBuilderAfterApplicationxwwwformurlencodedPatternWithoutDelimiter(Map instance) { - return new ApplicationxwwwformurlencodedSchemaMap1100Builder(instance); - } - } - - public static class ApplicationxwwwformurlencodedSchemaMap1110Builder implements SetterForApplicationxwwwformurlencodedByte, SetterForApplicationxwwwformurlencodedDouble, SetterForApplicationxwwwformurlencodedNumber { - private final Map instance; - public ApplicationxwwwformurlencodedSchemaMap1110Builder(Map instance) { - this.instance = instance; - } - public Map getInstance() { - return instance; - } - public ApplicationxwwwformurlencodedSchemaMap0110Builder getBuilderAfterApplicationxwwwformurlencodedByte(Map instance) { - return new ApplicationxwwwformurlencodedSchemaMap0110Builder(instance); - } - public ApplicationxwwwformurlencodedSchemaMap1010Builder getBuilderAfterApplicationxwwwformurlencodedDouble(Map instance) { - return new ApplicationxwwwformurlencodedSchemaMap1010Builder(instance); - } - public ApplicationxwwwformurlencodedSchemaMap1100Builder getBuilderAfterApplicationxwwwformurlencodedNumber(Map instance) { - return new ApplicationxwwwformurlencodedSchemaMap1100Builder(instance); - } - } - - public static class ApplicationxwwwformurlencodedSchemaMapBuilder implements SetterForApplicationxwwwformurlencodedByte, SetterForApplicationxwwwformurlencodedDouble, SetterForApplicationxwwwformurlencodedNumber, SetterForApplicationxwwwformurlencodedPatternWithoutDelimiter { - private final Map instance; - public ApplicationxwwwformurlencodedSchemaMapBuilder() { - this.instance = new LinkedHashMap<>(); - } - public Map getInstance() { - return instance; - } - public ApplicationxwwwformurlencodedSchemaMap0111Builder getBuilderAfterApplicationxwwwformurlencodedByte(Map instance) { - return new ApplicationxwwwformurlencodedSchemaMap0111Builder(instance); - } - public ApplicationxwwwformurlencodedSchemaMap1011Builder getBuilderAfterApplicationxwwwformurlencodedDouble(Map instance) { - return new ApplicationxwwwformurlencodedSchemaMap1011Builder(instance); - } - public ApplicationxwwwformurlencodedSchemaMap1101Builder getBuilderAfterApplicationxwwwformurlencodedNumber(Map instance) { - return new ApplicationxwwwformurlencodedSchemaMap1101Builder(instance); - } - public ApplicationxwwwformurlencodedSchemaMap1110Builder getBuilderAfterApplicationxwwwformurlencodedPatternWithoutDelimiter(Map instance) { - return new ApplicationxwwwformurlencodedSchemaMap1110Builder(instance); - } - } - - - public sealed interface ApplicationxwwwformurlencodedSchema1Boxed permits ApplicationxwwwformurlencodedSchema1BoxedMap { - @Nullable Object getData(); - } - - public record ApplicationxwwwformurlencodedSchema1BoxedMap(ApplicationxwwwformurlencodedSchemaMap data) implements ApplicationxwwwformurlencodedSchema1Boxed { - @Override - public @Nullable Object getData() { - return data; - } - } - - - public static class ApplicationxwwwformurlencodedSchema1 extends JsonSchema implements MapSchemaValidator { - private static @Nullable ApplicationxwwwformurlencodedSchema1 instance = null; - - protected ApplicationxwwwformurlencodedSchema1() { - super(new JsonSchemaInfo() - .type(Set.of(Map.class)) - .properties(Map.ofEntries( - new PropertyEntry("integer", ApplicationxwwwformurlencodedInteger.class), - new PropertyEntry("int32", ApplicationxwwwformurlencodedInt32.class), - new PropertyEntry("int64", ApplicationxwwwformurlencodedInt64.class), - new PropertyEntry("number", ApplicationxwwwformurlencodedNumber.class), - new PropertyEntry("float", ApplicationxwwwformurlencodedFloat.class), - new PropertyEntry("double", ApplicationxwwwformurlencodedDouble.class), - new PropertyEntry("string", ApplicationxwwwformurlencodedString.class), - new PropertyEntry("pattern_without_delimiter", ApplicationxwwwformurlencodedPatternWithoutDelimiter.class), - new PropertyEntry("byte", ApplicationxwwwformurlencodedByte.class), - new PropertyEntry("binary", ApplicationxwwwformurlencodedBinary.class), - new PropertyEntry("date", ApplicationxwwwformurlencodedDate.class), - new PropertyEntry("dateTime", ApplicationxwwwformurlencodedDateTime.class), - new PropertyEntry("password", ApplicationxwwwformurlencodedPassword.class), - new PropertyEntry("callback", ApplicationxwwwformurlencodedCallback.class) - )) - .required(Set.of( - "byte", - "double", - "number", - "pattern_without_delimiter" - )) - ); - } - - public static ApplicationxwwwformurlencodedSchema1 getInstance() { - if (instance == null) { - instance = new ApplicationxwwwformurlencodedSchema1(); - } - return instance; - } - - 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 RuntimeException("Invalid non-string key value"); - } - String propertyName = (String) entryKey; - List propertyPathToItem = new ArrayList<>(pathToItem); - propertyPathToItem.add(propertyName); - Object value = entry.getValue(); - LinkedHashMap, Nothing?> schemas = pathToSchemas.get(propertyPathToItem); - if (schemas == null) { - throw new RuntimeException("Validation result is invalid, schemas must exist for a pathToItem"); - } - JsonSchema propertySchema = schemas.entrySet().iterator().next().getKey(); - @Nullable Object propertyInstance = propertySchema.getNewInstance(value, propertyPathToItem, pathToSchemas); - properties.put(propertyName, propertyInstance); - } - FrozenMap<@Nullable Object> castProperties = new FrozenMap<>(properties); - return new ApplicationxwwwformurlencodedSchemaMap(castProperties); - } - - 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); - SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().build())); - ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, new PathToSchemasMap(), new LinkedHashSet<>()); - PathToSchemasMap pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet); - return getNewInstance(castArg, validationMetadata.pathToItem(), pathToSchemasMap); - } - - - @Override - public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws 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"); - } - @Override - public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { - if (arg instanceof Map) { - return getNewInstance((Map) arg, pathToItem, pathToSchemas); - } - 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 { - return new ApplicationxwwwformurlencodedSchema1BoxedMap(validate(arg, configuration)); - } - @Override - public ApplicationxwwwformurlencodedSchema1Boxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { - 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"); - } - } - -} diff --git a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/fake/post/responses/FakePostCode200Response.kt b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/fake/post/responses/FakePostCode200Response.kt deleted file mode 100644 index 1806211707c..00000000000 --- a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/fake/post/responses/FakePostCode200Response.kt +++ /dev/null @@ -1,7 +0,0 @@ -package org.openapijsonschematools.client.paths.fake.post.responses; - -import org.openapijsonschematools.client.components.responses.SuccessDescriptionOnly; - -public class FakePostCode200Response extends SuccessDescriptionOnly { - public static class FakePostCode200Response1 extends SuccessDescriptionOnly1 {} -} diff --git a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/fake/post/responses/FakePostCode404Response.kt b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/fake/post/responses/FakePostCode404Response.kt deleted file mode 100644 index 77b0cb64b02..00000000000 --- a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/fake/post/responses/FakePostCode404Response.kt +++ /dev/null @@ -1,45 +0,0 @@ -package org.openapijsonschematools.client.paths.fake.post.responses; - -import org.openapijsonschematools.client.configurations.SchemaConfiguration; -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; -import java.net.http.HttpResponse; -import java.net.http.HttpHeaders; - -public class FakePostCode404Response { - - public static class FakePostCode404Response1 extends ResponseDeserializer { - public FakePostCode404Response1() { - super( - MapUtils.makeMap( - ) - ); - } - - @Override - protected Nothing? getBody(String contentType, Nothing? mediaType, byte[] body, SchemaConfiguration configuration) { - return null; - } - - @Override - protected Nothing? getHeaders(HttpHeaders headers, SchemaConfiguration configuration) { - return null; - } - } - - @SuppressWarnings("serial") - public static class ResponseApiException extends ApiException { - public DeserializedHttpResponse deserializedResponse; - - public ResponseApiException(String s, HttpResponse response, DeserializedHttpResponse deserializedResponse) { - super(s, response); - this.deserializedResponse = deserializedResponse; - } - } -} diff --git a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/fake/post/security/FakePostSecurityRequirementObject0.kt b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/fake/post/security/FakePostSecurityRequirementObject0.kt deleted file mode 100644 index b1305742ad4..00000000000 --- a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/fake/post/security/FakePostSecurityRequirementObject0.kt +++ /dev/null @@ -1,24 +0,0 @@ -package org.openapijsonschematools.client.paths.fake.post.security; - -import org.checkerframework.checker.nullness.qual.Nullable; -import org.openapijsonschematools.client.securityrequirementobjects.SecurityRequirementObject; -import org.openapijsonschematools.client.securityschemes.SecurityScheme; -import org.openapijsonschematools.client.components.securityschemes.HttpBasicTest; - -import java.util.List; -import java.util.Map; -import java.util.AbstractMap; - -public class FakePostSecurityRequirementObject0 extends SecurityRequirementObject { - - public FakePostSecurityRequirementObject0() { - super( - Map.ofEntries( - new AbstractMap.SimpleEntry, List>( - HttpBasicTest.class, - List.of() - ) - ) - ); - } -} diff --git a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/fakeadditionalpropertieswitharrayofenums/FakeadditionalpropertieswitharrayofenumsGet.kt b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/fakeadditionalpropertieswitharrayofenums/FakeadditionalpropertieswitharrayofenumsGet.kt deleted file mode 100644 index 7cf5a80ec37..00000000000 --- a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/fakeadditionalpropertieswitharrayofenums/FakeadditionalpropertieswitharrayofenumsGet.kt +++ /dev/null @@ -1,152 +0,0 @@ -package org.openapijsonschematools.client.paths.fakeadditionalpropertieswitharrayofenums; - -import org.checkerframework.checker.nullness.qual.Nullable; -import org.openapijsonschematools.client.paths.fakeadditionalpropertieswitharrayofenums.get.FakeadditionalpropertieswitharrayofenumsGetRequestBody; -import org.openapijsonschematools.client.RootServerInfo; -import org.openapijsonschematools.client.paths.fakeadditionalpropertieswitharrayofenums.get.FakeadditionalpropertieswitharrayofenumsGetResponses; -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.requestbody.SerializedRequestBody; -import org.openapijsonschematools.client.paths.Fakeadditionalpropertieswitharrayofenums; - -import java.io.IOException; -import java.util.ArrayList; -import java.net.http.HttpClient; -import java.net.http.HttpRequest; -import java.time.Duration; -import java.util.List; -import java.util.Map; - -public class FakeadditionalpropertieswitharrayofenumsGet { - private static class GetProvider { - private static final String method = "get"; - - public static FakeadditionalpropertieswitharrayofenumsGetResponses.EndpointResponse get( - GetRequest request, - ApiConfiguration apiConfiguration, - SchemaConfiguration schemaConfiguration, - HttpClient client - ) throws IOException, InterruptedException, ValidationException, NotImplementedException, ApiException { - Map> headers = apiConfiguration.getDefaultHeaders(); - - @Nullable SerializedRequestBody serializedRequestBody; - HttpRequest.BodyPublisher bodyPublisher = HttpRequest.BodyPublishers.noBody(); - if (request.requestBody != null) { - serializedRequestBody = new FakeadditionalpropertieswitharrayofenumsGetRequestBody.FakeadditionalpropertieswitharrayofenumsGetRequestBody1().serialize( - request.requestBody - ); - var contentTypeHeaderValues = headers.getOrDefault("Content-Type", new ArrayList<>()); - contentTypeHeaderValues.add(serializedRequestBody.contentType); - bodyPublisher = serializedRequestBody.bodyPublisher; - } - // TODO set this to a map if there is a query security scheme - @Nullable Map queryMap = null; - String host = apiConfiguration.getServer(request.serverIndex).url(); - - String url = host + Fakeadditionalpropertieswitharrayofenums.path; - var httpRequest = RestClient.getRequest( - url, - method, - bodyPublisher, - headers, - request.timeout - ); - var response = RestClient.getResponse(httpRequest, client); - var responsesDeserializer = new FakeadditionalpropertieswitharrayofenumsGetResponses.FakeadditionalpropertieswitharrayofenumsGetResponses1(); - return responsesDeserializer.deserialize(response, schemaConfiguration); - } - } - - public interface GetOperation { - ApiConfiguration getApiConfiguration(); - SchemaConfiguration getSchemaConfiguration(); - HttpClient getClient(); - default FakeadditionalpropertieswitharrayofenumsGetResponses.EndpointResponse get(GetRequest request) throws IOException, InterruptedException, ValidationException, NotImplementedException, ApiException { - return GetProvider.get(request, getApiConfiguration(), getSchemaConfiguration(), getClient()); - } - } - - public interface AdditionalPropertiesWithArrayOfEnumsOperation { - ApiConfiguration getApiConfiguration(); - SchemaConfiguration getSchemaConfiguration(); - HttpClient getClient(); - default FakeadditionalpropertieswitharrayofenumsGetResponses.EndpointResponse additionalPropertiesWithArrayOfEnums(GetRequest request) throws IOException, InterruptedException, ValidationException, NotImplementedException, ApiException { - return GetProvider.get(request, getApiConfiguration(), getSchemaConfiguration(), getClient()); - } - } - - public static class Get extends ApiClient implements GetOperation { - public Get(ApiConfiguration apiConfiguration, SchemaConfiguration schemaConfiguration) { - super(apiConfiguration, schemaConfiguration); - } - } - - public static class GetRequest { - public FakeadditionalpropertieswitharrayofenumsGetRequestBody.@Nullable SealedRequestBody requestBody; - public RootServerInfo.@Nullable ServerIndex serverIndex; - public @Nullable Duration timeout; - } - - public interface SetterForRequestBody { - GetRequest getInstance(); - T getBuilderAfterRequestBody(GetRequest instance); - default T requestBody(FakeadditionalpropertieswitharrayofenumsGetRequestBody.SealedRequestBody requestBody) { - var instance = getInstance(); - instance.requestBody = requestBody; - return getBuilderAfterRequestBody(instance); - } - } - - public interface SetterForServerIndex { - GetRequest getInstance(); - T getBuilderAfterServerIndex(GetRequest instance); - default T serverIndex(RootServerInfo.ServerIndex serverIndex) { - var instance = getInstance(); - instance.serverIndex = serverIndex; - return getBuilderAfterServerIndex(instance); - } - } - - public interface SetterForTimeout { - GetRequest getInstance(); - T getBuilderAfterTimeout(GetRequest instance); - default T timeout(Duration timeout) { - var instance = getInstance(); - instance.timeout = timeout; - return getBuilderAfterTimeout(instance); - } - } - - public static class GetRequestBuilder implements SetterForRequestBody, SetterForServerIndex, SetterForTimeout { - private final GetRequest instance; - - public GetRequestBuilder() { - this.instance = new GetRequest(); - } - - public GetRequest build() { - return instance; - } - - public GetRequest getInstance() { - return instance; - } - - public GetRequestBuilder getBuilderAfterRequestBody(GetRequest instance) { - return this; - } - - public GetRequestBuilder getBuilderAfterServerIndex(GetRequest instance) { - return this; - } - - public GetRequestBuilder getBuilderAfterTimeout(GetRequest instance) { - return this; - } - } -} diff --git a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/fakeadditionalpropertieswitharrayofenums/get/FakeadditionalpropertieswitharrayofenumsGetRequestBody.kt b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/fakeadditionalpropertieswitharrayofenums/get/FakeadditionalpropertieswitharrayofenumsGetRequestBody.kt deleted file mode 100644 index b14c6782c60..00000000000 --- a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/fakeadditionalpropertieswitharrayofenums/get/FakeadditionalpropertieswitharrayofenumsGetRequestBody.kt +++ /dev/null @@ -1,49 +0,0 @@ -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; -import org.openapijsonschematools.client.mediatype.MediaType; -import org.openapijsonschematools.client.paths.fakeadditionalpropertieswitharrayofenums.get.requestbody.content.applicationjson.ApplicationjsonSchema; - -import java.util.AbstractMap; -import java.util.Map; - -public class FakeadditionalpropertieswitharrayofenumsGetRequestBody { - public sealed interface SealedMediaType permits ApplicationjsonMediaType {} - - public record ApplicationjsonMediaType(ApplicationjsonSchema.ApplicationjsonSchema1 schema) implements SealedMediaType, MediaType { - public ApplicationjsonMediaType() { - this(ApplicationjsonSchema.ApplicationjsonSchema1.getInstance()); - } - @Override - public Nothing? encoding() { - return null; - } - } - - public static class FakeadditionalpropertieswitharrayofenumsGetRequestBody1 extends RequestBodySerializer { - public FakeadditionalpropertieswitharrayofenumsGetRequestBody1() { - super( - Map.ofEntries( - new AbstractMap.SimpleEntry<>("application/json", new ApplicationjsonMediaType()) - ), - false - ); - } - - public SerializedRequestBody serialize(SealedRequestBody requestBody) throws NotImplementedException { - ApplicationjsonRequestBody requestBody0 = (ApplicationjsonRequestBody) requestBody; - return serialize(requestBody0.contentType(), requestBody0.body().getData()); - } - } - - public sealed interface SealedRequestBody permits ApplicationjsonRequestBody {} - public record ApplicationjsonRequestBody(ApplicationjsonSchema.AdditionalPropertiesWithArrayOfEnums1Boxed body) implements SealedRequestBody, GenericRequestBody { - @Override - public String contentType() { - return "application/json"; - } - } -} diff --git a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/fakeadditionalpropertieswitharrayofenums/get/FakeadditionalpropertieswitharrayofenumsGetResponses.kt b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/fakeadditionalpropertieswitharrayofenums/get/FakeadditionalpropertieswitharrayofenumsGetResponses.kt deleted file mode 100644 index a8c311e2da9..00000000000 --- a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/fakeadditionalpropertieswitharrayofenums/get/FakeadditionalpropertieswitharrayofenumsGetResponses.kt +++ /dev/null @@ -1,53 +0,0 @@ -package org.openapijsonschematools.client.paths.fakeadditionalpropertieswitharrayofenums.get; - -import org.openapijsonschematools.client.paths.fakeadditionalpropertieswitharrayofenums.get.responses.FakeadditionalpropertieswitharrayofenumsGetCode200Response; -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; -import org.checkerframework.checker.nullness.qual.Nullable; - -import java.net.http.HttpResponse; -import java.util.Map; -import java.util.AbstractMap; - -public class FakeadditionalpropertieswitharrayofenumsGetResponses { - public sealed interface EndpointResponse permits EndpointFakeadditionalpropertieswitharrayofenumsGetCode200Response {} - - public record EndpointFakeadditionalpropertieswitharrayofenumsGetCode200Response( - HttpResponse response, - FakeadditionalpropertieswitharrayofenumsGetCode200Response.SealedResponseBody body, - Nothing? headers - ) implements EndpointResponse, ApiResponse{ - } - - public sealed interface StatusCodeResponseDeserializer permits StatusFakeadditionalpropertieswitharrayofenumsGetCode200ResponseDeserializer {} - - public static final class StatusFakeadditionalpropertieswitharrayofenumsGetCode200ResponseDeserializer extends FakeadditionalpropertieswitharrayofenumsGetCode200Response.FakeadditionalpropertieswitharrayofenumsGetCode200Response1 implements StatusCodeResponseDeserializer { - } - - public static final class FakeadditionalpropertieswitharrayofenumsGetResponses1 implements ResponsesDeserializer { - private final Map statusCodeToResponseDeserializer; - public FakeadditionalpropertieswitharrayofenumsGetResponses1() { - this.statusCodeToResponseDeserializer = Map.ofEntries( - new AbstractMap.SimpleEntry<>("200", new StatusFakeadditionalpropertieswitharrayofenumsGetCode200ResponseDeserializer()) - ); - } - - 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) { - throw new ApiException( - "Invalid response statusCode="+statusCode+" has no response defined in the openapi document", - response - ); - } - StatusFakeadditionalpropertieswitharrayofenumsGetCode200ResponseDeserializer castDeserializer = (StatusFakeadditionalpropertieswitharrayofenumsGetCode200ResponseDeserializer) statusCodeDeserializer; - var deserializedResponse = castDeserializer.deserialize(response, configuration); - return new EndpointFakeadditionalpropertieswitharrayofenumsGetCode200Response(response, deserializedResponse.body(), deserializedResponse.headers()); - } - } -} diff --git a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/fakeadditionalpropertieswitharrayofenums/get/requestbody/content/applicationjson/ApplicationjsonSchema.kt b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/fakeadditionalpropertieswitharrayofenums/get/requestbody/content/applicationjson/ApplicationjsonSchema.kt deleted file mode 100644 index 23661b2fb49..00000000000 --- a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/fakeadditionalpropertieswitharrayofenums/get/requestbody/content/applicationjson/ApplicationjsonSchema.kt +++ /dev/null @@ -1,19 +0,0 @@ -package org.openapijsonschematools.client.paths.fakeadditionalpropertieswitharrayofenums.get.requestbody.content.applicationjson; - -import org.checkerframework.checker.nullness.qual.Nullable; -import org.openapijsonschematools.client.components.schemas.AdditionalPropertiesWithArrayOfEnums; - -public class ApplicationjsonSchema extends AdditionalPropertiesWithArrayOfEnums { - // $refed class - - - public static class ApplicationjsonSchema1 extends AdditionalPropertiesWithArrayOfEnums1 { - private static @Nullable ApplicationjsonSchema1 instance = null; - public static ApplicationjsonSchema1 getInstance() { - if (instance == null) { - instance = new ApplicationjsonSchema1(); - } - return instance; - } - } -} diff --git a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/fakeadditionalpropertieswitharrayofenums/get/responses/FakeadditionalpropertieswitharrayofenumsGetCode200Response.kt b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/fakeadditionalpropertieswitharrayofenums/get/responses/FakeadditionalpropertieswitharrayofenumsGetCode200Response.kt deleted file mode 100644 index 8a290d06008..00000000000 --- a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/fakeadditionalpropertieswitharrayofenums/get/responses/FakeadditionalpropertieswitharrayofenumsGetCode200Response.kt +++ /dev/null @@ -1,63 +0,0 @@ -package org.openapijsonschematools.client.paths.fakeadditionalpropertieswitharrayofenums.get.responses; - -import org.openapijsonschematools.client.configurations.SchemaConfiguration; -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; - -import java.util.AbstractMap; -import java.util.Map; -import java.net.http.HttpResponse; -import java.net.http.HttpHeaders; - -public class FakeadditionalpropertieswitharrayofenumsGetCode200Response { - public sealed interface SealedMediaType permits ApplicationjsonMediaType {} - - public record ApplicationjsonMediaType(ApplicationjsonSchema.ApplicationjsonSchema1 schema) implements SealedMediaType, MediaType { - public ApplicationjsonMediaType() { - this(ApplicationjsonSchema.ApplicationjsonSchema1.getInstance()); - } - @Override - public Nothing? encoding() { - return null; - } - } - public sealed interface SealedResponseBody permits ApplicationjsonResponseBody {} - public record ApplicationjsonResponseBody(ApplicationjsonSchema.AdditionalPropertiesWithArrayOfEnums1Boxed body) implements SealedResponseBody { } - - public static class FakeadditionalpropertieswitharrayofenumsGetCode200Response1 extends ResponseDeserializer { - public FakeadditionalpropertieswitharrayofenumsGetCode200Response1() { - super( - Map.ofEntries( - new AbstractMap.SimpleEntry<>("application/json", new ApplicationjsonMediaType()) - ) - ); - } - - @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); - } - - @Override - protected Nothing? getHeaders(HttpHeaders headers, SchemaConfiguration configuration) { - return null; - } - } - - @SuppressWarnings("serial") - public static class ResponseApiException extends ApiException { - public DeserializedHttpResponse deserializedResponse; - - public ResponseApiException(String s, HttpResponse response, DeserializedHttpResponse deserializedResponse) { - super(s, response); - this.deserializedResponse = deserializedResponse; - } - } -} diff --git a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/fakeadditionalpropertieswitharrayofenums/get/responses/code200response/content/applicationjson/ApplicationjsonSchema.kt b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/fakeadditionalpropertieswitharrayofenums/get/responses/code200response/content/applicationjson/ApplicationjsonSchema.kt deleted file mode 100644 index 365fe1691e1..00000000000 --- a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/fakeadditionalpropertieswitharrayofenums/get/responses/code200response/content/applicationjson/ApplicationjsonSchema.kt +++ /dev/null @@ -1,19 +0,0 @@ -package org.openapijsonschematools.client.paths.fakeadditionalpropertieswitharrayofenums.get.responses.code200response.content.applicationjson; - -import org.checkerframework.checker.nullness.qual.Nullable; -import org.openapijsonschematools.client.components.schemas.AdditionalPropertiesWithArrayOfEnums; - -public class ApplicationjsonSchema extends AdditionalPropertiesWithArrayOfEnums { - // $refed class - - - public static class ApplicationjsonSchema1 extends AdditionalPropertiesWithArrayOfEnums1 { - private static @Nullable ApplicationjsonSchema1 instance = null; - public static ApplicationjsonSchema1 getInstance() { - if (instance == null) { - instance = new ApplicationjsonSchema1(); - } - return instance; - } - } -} diff --git a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/fakebodywithfileschema/FakebodywithfileschemaPut.kt b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/fakebodywithfileschema/FakebodywithfileschemaPut.kt deleted file mode 100644 index 7c9a7ce3ef7..00000000000 --- a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/fakebodywithfileschema/FakebodywithfileschemaPut.kt +++ /dev/null @@ -1,183 +0,0 @@ -package org.openapijsonschematools.client.paths.fakebodywithfileschema; - -import org.checkerframework.checker.nullness.qual.Nullable; -import org.openapijsonschematools.client.RootServerInfo; -import org.openapijsonschematools.client.paths.fakebodywithfileschema.put.FakebodywithfileschemaPutRequestBody; -import org.openapijsonschematools.client.paths.fakebodywithfileschema.put.FakebodywithfileschemaPutResponses; -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.requestbody.SerializedRequestBody; -import org.openapijsonschematools.client.paths.Fakebodywithfileschema; - -import java.io.IOException; -import java.util.ArrayList; -import java.net.http.HttpClient; -import java.net.http.HttpRequest; -import java.time.Duration; -import java.util.List; -import java.util.Map; - -public class FakebodywithfileschemaPut { - private static class PutProvider { - private static final String method = "put"; - - public static FakebodywithfileschemaPutResponses.EndpointResponse put( - PutRequest request, - ApiConfiguration apiConfiguration, - SchemaConfiguration schemaConfiguration, - HttpClient client - ) throws IOException, InterruptedException, ValidationException, NotImplementedException, ApiException { - Map> headers = apiConfiguration.getDefaultHeaders(); - - SerializedRequestBody serializedRequestBody = new FakebodywithfileschemaPutRequestBody.FakebodywithfileschemaPutRequestBody1().serialize( - request.requestBody - ); - var contentTypeHeaderValues = headers.getOrDefault("Content-Type", new ArrayList<>()); - contentTypeHeaderValues.add(serializedRequestBody.contentType); - HttpRequest.BodyPublisher bodyPublisher = serializedRequestBody.bodyPublisher; - // TODO set this to a map if there is a query security scheme - @Nullable Map queryMap = null; - String host = apiConfiguration.getServer(request.serverIndex).url(); - - String url = host + Fakebodywithfileschema.path; - var httpRequest = RestClient.getRequest( - url, - method, - bodyPublisher, - headers, - request.timeout - ); - var response = RestClient.getResponse(httpRequest, client); - var responsesDeserializer = new FakebodywithfileschemaPutResponses.FakebodywithfileschemaPutResponses1(); - return responsesDeserializer.deserialize(response, schemaConfiguration); - } - } - - public interface PutOperation { - ApiConfiguration getApiConfiguration(); - SchemaConfiguration getSchemaConfiguration(); - HttpClient getClient(); - default FakebodywithfileschemaPutResponses.EndpointResponse put(PutRequest request) throws IOException, InterruptedException, ValidationException, NotImplementedException, ApiException { - return PutProvider.put(request, getApiConfiguration(), getSchemaConfiguration(), getClient()); - } - } - - public interface BodyWithFileSchemaOperation { - ApiConfiguration getApiConfiguration(); - SchemaConfiguration getSchemaConfiguration(); - HttpClient getClient(); - default FakebodywithfileschemaPutResponses.EndpointResponse bodyWithFileSchema(PutRequest request) throws IOException, InterruptedException, ValidationException, NotImplementedException, ApiException { - return PutProvider.put(request, getApiConfiguration(), getSchemaConfiguration(), getClient()); - } - } - - public static class Put extends ApiClient implements PutOperation { - public Put(ApiConfiguration apiConfiguration, SchemaConfiguration schemaConfiguration) { - super(apiConfiguration, schemaConfiguration); - } - } - - public static class PutRequest { - public FakebodywithfileschemaPutRequestBody.SealedRequestBody requestBody; - public RootServerInfo.@Nullable ServerIndex serverIndex; - public @Nullable Duration timeout; - - public PutRequest( - FakebodywithfileschemaPutRequestBody.SealedRequestBody requestBody, - RootServerInfo.@Nullable ServerIndex serverIndex, - @Nullable Duration timeout - ) { - this.requestBody = requestBody; - this.serverIndex = serverIndex; - this.timeout = timeout; - } - } - - public static class PutNullableRequest { - public FakebodywithfileschemaPutRequestBody.@Nullable SealedRequestBody requestBody; - public RootServerInfo.@Nullable ServerIndex serverIndex; - public @Nullable Duration timeout; - } - - public interface SetterForServerIndex { - PutNullableRequest getInstance(); - T getBuilderAfterServerIndex(PutNullableRequest instance); - default T serverIndex(RootServerInfo.ServerIndex serverIndex) { - var instance = getInstance(); - instance.serverIndex = serverIndex; - return getBuilderAfterServerIndex(instance); - } - } - - public interface SetterForTimeout { - PutNullableRequest getInstance(); - T getBuilderAfterTimeout(PutNullableRequest instance); - default T timeout(Duration timeout) { - var instance = getInstance(); - instance.timeout = timeout; - return getBuilderAfterTimeout(instance); - } - } - - public interface SetterForRequestBody { - PutNullableRequest getInstance(); - T getBuilderAfterRequestBody(PutNullableRequest instance); - default T requestBody(FakebodywithfileschemaPutRequestBody.SealedRequestBody requestBody) { - var instance = getInstance(); - instance.requestBody = requestBody; - return getBuilderAfterRequestBody(instance); - } - } - - public static class Put0RequestBuilder implements SetterForServerIndex, SetterForTimeout { - private final PutNullableRequest instance; - - public Put0RequestBuilder(PutNullableRequest instance) { - this.instance = instance; - } - - public PutRequest build() { - var requestBody = instance.requestBody; - if (requestBody == null) { - throw new RuntimeException("invalid null value for required parameter"); - } - return new PutRequest( - requestBody, - instance.serverIndex, - instance.timeout - ); - } - - public PutNullableRequest getInstance() { - return instance; - } - - public Put0RequestBuilder getBuilderAfterServerIndex(PutNullableRequest instance) { - return this; - } - - public Put0RequestBuilder getBuilderAfterTimeout(PutNullableRequest instance) { - return this; - } - } - public static class PutRequestBuilder implements SetterForRequestBody { - private final PutNullableRequest instance; - - public PutRequestBuilder() { - this.instance = new PutNullableRequest(); - } - - public PutNullableRequest getInstance() { - return instance; - } - - public Put0RequestBuilder getBuilderAfterRequestBody(PutNullableRequest instance) { - return new Put0RequestBuilder(instance); - } - } -} diff --git a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/fakebodywithfileschema/put/FakebodywithfileschemaPutRequestBody.kt b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/fakebodywithfileschema/put/FakebodywithfileschemaPutRequestBody.kt deleted file mode 100644 index f4b0941c508..00000000000 --- a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/fakebodywithfileschema/put/FakebodywithfileschemaPutRequestBody.kt +++ /dev/null @@ -1,49 +0,0 @@ -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; -import org.openapijsonschematools.client.mediatype.MediaType; -import org.openapijsonschematools.client.paths.fakebodywithfileschema.put.requestbody.content.applicationjson.ApplicationjsonSchema; - -import java.util.AbstractMap; -import java.util.Map; - -public class FakebodywithfileschemaPutRequestBody { - public sealed interface SealedMediaType permits ApplicationjsonMediaType {} - - public record ApplicationjsonMediaType(ApplicationjsonSchema.ApplicationjsonSchema1 schema) implements SealedMediaType, MediaType { - public ApplicationjsonMediaType() { - this(ApplicationjsonSchema.ApplicationjsonSchema1.getInstance()); - } - @Override - public Nothing? encoding() { - return null; - } - } - - public static class FakebodywithfileschemaPutRequestBody1 extends RequestBodySerializer { - public FakebodywithfileschemaPutRequestBody1() { - super( - Map.ofEntries( - new AbstractMap.SimpleEntry<>("application/json", new ApplicationjsonMediaType()) - ), - true - ); - } - - public SerializedRequestBody serialize(SealedRequestBody requestBody) throws NotImplementedException { - ApplicationjsonRequestBody requestBody0 = (ApplicationjsonRequestBody) requestBody; - return serialize(requestBody0.contentType(), requestBody0.body().getData()); - } - } - - public sealed interface SealedRequestBody permits ApplicationjsonRequestBody {} - public record ApplicationjsonRequestBody(ApplicationjsonSchema.FileSchemaTestClass1Boxed body) implements SealedRequestBody, GenericRequestBody { - @Override - public String contentType() { - return "application/json"; - } - } -} diff --git a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/fakebodywithfileschema/put/FakebodywithfileschemaPutResponses.kt b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/fakebodywithfileschema/put/FakebodywithfileschemaPutResponses.kt deleted file mode 100644 index c015dad663e..00000000000 --- a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/fakebodywithfileschema/put/FakebodywithfileschemaPutResponses.kt +++ /dev/null @@ -1,53 +0,0 @@ -package org.openapijsonschematools.client.paths.fakebodywithfileschema.put; - -import org.openapijsonschematools.client.paths.fakebodywithfileschema.put.responses.FakebodywithfileschemaPutCode200Response; -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; -import org.checkerframework.checker.nullness.qual.Nullable; - -import java.net.http.HttpResponse; -import java.util.Map; -import java.util.AbstractMap; - -public class FakebodywithfileschemaPutResponses { - public sealed interface EndpointResponse permits EndpointFakebodywithfileschemaPutCode200Response {} - - public record EndpointFakebodywithfileschemaPutCode200Response( - HttpResponse response, - Nothing? body, - Nothing? headers - ) implements EndpointResponse, ApiResponse{ - } - - public sealed interface StatusCodeResponseDeserializer permits StatusFakebodywithfileschemaPutCode200ResponseDeserializer {} - - public static final class StatusFakebodywithfileschemaPutCode200ResponseDeserializer extends FakebodywithfileschemaPutCode200Response.FakebodywithfileschemaPutCode200Response1 implements StatusCodeResponseDeserializer { - } - - public static final class FakebodywithfileschemaPutResponses1 implements ResponsesDeserializer { - private final Map statusCodeToResponseDeserializer; - public FakebodywithfileschemaPutResponses1() { - this.statusCodeToResponseDeserializer = Map.ofEntries( - new AbstractMap.SimpleEntry<>("200", new StatusFakebodywithfileschemaPutCode200ResponseDeserializer()) - ); - } - - 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) { - throw new ApiException( - "Invalid response statusCode="+statusCode+" has no response defined in the openapi document", - response - ); - } - StatusFakebodywithfileschemaPutCode200ResponseDeserializer castDeserializer = (StatusFakebodywithfileschemaPutCode200ResponseDeserializer) statusCodeDeserializer; - var deserializedResponse = castDeserializer.deserialize(response, configuration); - return new EndpointFakebodywithfileschemaPutCode200Response(response, deserializedResponse.body(), deserializedResponse.headers()); - } - } -} diff --git a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/fakebodywithfileschema/put/requestbody/content/applicationjson/ApplicationjsonSchema.kt b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/fakebodywithfileschema/put/requestbody/content/applicationjson/ApplicationjsonSchema.kt deleted file mode 100644 index 0bf7ab945f1..00000000000 --- a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/fakebodywithfileschema/put/requestbody/content/applicationjson/ApplicationjsonSchema.kt +++ /dev/null @@ -1,19 +0,0 @@ -package org.openapijsonschematools.client.paths.fakebodywithfileschema.put.requestbody.content.applicationjson; - -import org.checkerframework.checker.nullness.qual.Nullable; -import org.openapijsonschematools.client.components.schemas.FileSchemaTestClass; - -public class ApplicationjsonSchema extends FileSchemaTestClass { - // $refed class - - - public static class ApplicationjsonSchema1 extends FileSchemaTestClass1 { - private static @Nullable ApplicationjsonSchema1 instance = null; - public static ApplicationjsonSchema1 getInstance() { - if (instance == null) { - instance = new ApplicationjsonSchema1(); - } - return instance; - } - } -} diff --git a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/fakebodywithfileschema/put/responses/FakebodywithfileschemaPutCode200Response.kt b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/fakebodywithfileschema/put/responses/FakebodywithfileschemaPutCode200Response.kt deleted file mode 100644 index 83a4cc26665..00000000000 --- a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/fakebodywithfileschema/put/responses/FakebodywithfileschemaPutCode200Response.kt +++ /dev/null @@ -1,7 +0,0 @@ -package org.openapijsonschematools.client.paths.fakebodywithfileschema.put.responses; - -import org.openapijsonschematools.client.components.responses.SuccessDescriptionOnly; - -public class FakebodywithfileschemaPutCode200Response extends SuccessDescriptionOnly { - public static class FakebodywithfileschemaPutCode200Response1 extends SuccessDescriptionOnly1 {} -} diff --git a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/fakebodywithqueryparams/FakebodywithqueryparamsPut.kt b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/fakebodywithqueryparams/FakebodywithqueryparamsPut.kt deleted file mode 100644 index 1fd7a628436..00000000000 --- a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/fakebodywithqueryparams/FakebodywithqueryparamsPut.kt +++ /dev/null @@ -1,242 +0,0 @@ -package org.openapijsonschematools.client.paths.fakebodywithqueryparams; - -import org.checkerframework.checker.nullness.qual.Nullable; -import org.openapijsonschematools.client.RootServerInfo; -import org.openapijsonschematools.client.paths.fakebodywithqueryparams.put.FakebodywithqueryparamsPutRequestBody; -import org.openapijsonschematools.client.paths.fakebodywithqueryparams.put.FakebodywithqueryparamsPutQueryParameters; -import org.openapijsonschematools.client.paths.fakebodywithqueryparams.put.Parameters; -import org.openapijsonschematools.client.paths.fakebodywithqueryparams.put.FakebodywithqueryparamsPutResponses; -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.requestbody.SerializedRequestBody; -import org.openapijsonschematools.client.paths.Fakebodywithqueryparams; - -import java.io.IOException; -import java.util.ArrayList; -import java.net.http.HttpClient; -import java.net.http.HttpRequest; -import java.time.Duration; -import java.util.List; -import java.util.Map; - -public class FakebodywithqueryparamsPut { - private static class PutProvider { - private static final String method = "put"; - - public static FakebodywithqueryparamsPutResponses.EndpointResponse put( - PutRequest request, - ApiConfiguration apiConfiguration, - SchemaConfiguration schemaConfiguration, - HttpClient client - ) throws IOException, InterruptedException, ValidationException, NotImplementedException, ApiException { - Map> headers = apiConfiguration.getDefaultHeaders(); - - SerializedRequestBody serializedRequestBody = new FakebodywithqueryparamsPutRequestBody.FakebodywithqueryparamsPutRequestBody1().serialize( - request.requestBody - ); - var contentTypeHeaderValues = headers.getOrDefault("Content-Type", new ArrayList<>()); - contentTypeHeaderValues.add(serializedRequestBody.contentType); - HttpRequest.BodyPublisher bodyPublisher = serializedRequestBody.bodyPublisher; - - var querySerializer = new Parameters.QueryParametersSerializer(); - @Nullable Map queryMap = querySerializer.getQueryMap(request.queryParameters); - String host = apiConfiguration.getServer(request.serverIndex).url(); - - String url = host + Fakebodywithqueryparams.path; - if (queryMap != null) { - url = url + querySerializer.serialize(queryMap); - } - var httpRequest = RestClient.getRequest( - url, - method, - bodyPublisher, - headers, - request.timeout - ); - var response = RestClient.getResponse(httpRequest, client); - var responsesDeserializer = new FakebodywithqueryparamsPutResponses.FakebodywithqueryparamsPutResponses1(); - return responsesDeserializer.deserialize(response, schemaConfiguration); - } - } - - public interface PutOperation { - ApiConfiguration getApiConfiguration(); - SchemaConfiguration getSchemaConfiguration(); - HttpClient getClient(); - default FakebodywithqueryparamsPutResponses.EndpointResponse put(PutRequest request) throws IOException, InterruptedException, ValidationException, NotImplementedException, ApiException { - return PutProvider.put(request, getApiConfiguration(), getSchemaConfiguration(), getClient()); - } - } - - public interface BodyWithQueryParamsOperation { - ApiConfiguration getApiConfiguration(); - SchemaConfiguration getSchemaConfiguration(); - HttpClient getClient(); - default FakebodywithqueryparamsPutResponses.EndpointResponse bodyWithQueryParams(PutRequest request) throws IOException, InterruptedException, ValidationException, NotImplementedException, ApiException { - return PutProvider.put(request, getApiConfiguration(), getSchemaConfiguration(), getClient()); - } - } - - public static class Put extends ApiClient implements PutOperation { - public Put(ApiConfiguration apiConfiguration, SchemaConfiguration schemaConfiguration) { - super(apiConfiguration, schemaConfiguration); - } - } - - public static class PutRequest { - public FakebodywithqueryparamsPutRequestBody.SealedRequestBody requestBody; - public FakebodywithqueryparamsPutQueryParameters.QueryParametersMap queryParameters; - public RootServerInfo.@Nullable ServerIndex serverIndex; - public @Nullable Duration timeout; - - public PutRequest( - FakebodywithqueryparamsPutRequestBody.SealedRequestBody requestBody, - FakebodywithqueryparamsPutQueryParameters.QueryParametersMap queryParameters, - RootServerInfo.@Nullable ServerIndex serverIndex, - @Nullable Duration timeout - ) { - this.requestBody = requestBody; - this.queryParameters = queryParameters; - this.serverIndex = serverIndex; - this.timeout = timeout; - } - } - - public static class PutNullableRequest { - public FakebodywithqueryparamsPutRequestBody.@Nullable SealedRequestBody requestBody; - public FakebodywithqueryparamsPutQueryParameters.@Nullable QueryParametersMap queryParameters; - public RootServerInfo.@Nullable ServerIndex serverIndex; - public @Nullable Duration timeout; - } - - public interface SetterForServerIndex { - PutNullableRequest getInstance(); - T getBuilderAfterServerIndex(PutNullableRequest instance); - default T serverIndex(RootServerInfo.ServerIndex serverIndex) { - var instance = getInstance(); - instance.serverIndex = serverIndex; - return getBuilderAfterServerIndex(instance); - } - } - - public interface SetterForTimeout { - PutNullableRequest getInstance(); - T getBuilderAfterTimeout(PutNullableRequest instance); - default T timeout(Duration timeout) { - var instance = getInstance(); - instance.timeout = timeout; - return getBuilderAfterTimeout(instance); - } - } - - public interface SetterForRequestBody { - PutNullableRequest getInstance(); - T getBuilderAfterRequestBody(PutNullableRequest instance); - default T requestBody(FakebodywithqueryparamsPutRequestBody.SealedRequestBody requestBody) { - var instance = getInstance(); - instance.requestBody = requestBody; - return getBuilderAfterRequestBody(instance); - } - } - - public interface SetterForQueryParameters { - PutNullableRequest getInstance(); - T getBuilderAfterQueryParameters(PutNullableRequest instance); - default T queryParameters(FakebodywithqueryparamsPutQueryParameters.QueryParametersMap queryParameters) { - var instance = getInstance(); - instance.queryParameters = queryParameters; - return getBuilderAfterQueryParameters(instance); - } - } - - public static class Put00RequestBuilder implements SetterForServerIndex, SetterForTimeout { - private final PutNullableRequest instance; - - public Put00RequestBuilder(PutNullableRequest instance) { - this.instance = instance; - } - - public PutRequest build() { - var requestBody = instance.requestBody; - if (requestBody == null) { - throw new RuntimeException("invalid null value for required parameter"); - } - var queryParameters = instance.queryParameters; - if (queryParameters == null) { - throw new RuntimeException("invalid null value for required parameter"); - } - return new PutRequest( - requestBody, - queryParameters, - instance.serverIndex, - instance.timeout - ); - } - - public PutNullableRequest getInstance() { - return instance; - } - - public Put00RequestBuilder getBuilderAfterServerIndex(PutNullableRequest instance) { - return this; - } - - public Put00RequestBuilder getBuilderAfterTimeout(PutNullableRequest instance) { - return this; - } - } - public static class Put01RequestBuilder implements SetterForQueryParameters { - private final PutNullableRequest instance; - - public Put01RequestBuilder(PutNullableRequest instance) { - this.instance = instance; - } - - public PutNullableRequest getInstance() { - return instance; - } - - public Put00RequestBuilder getBuilderAfterQueryParameters(PutNullableRequest instance) { - return new Put00RequestBuilder(instance); - } - } - public static class Put10RequestBuilder implements SetterForRequestBody { - private final PutNullableRequest instance; - - public Put10RequestBuilder(PutNullableRequest instance) { - this.instance = instance; - } - - public PutNullableRequest getInstance() { - return instance; - } - - public Put00RequestBuilder getBuilderAfterRequestBody(PutNullableRequest instance) { - return new Put00RequestBuilder(instance); - } - } - public static class PutRequestBuilder implements SetterForRequestBody, SetterForQueryParameters { - private final PutNullableRequest instance; - - public PutRequestBuilder() { - this.instance = new PutNullableRequest(); - } - - public PutNullableRequest getInstance() { - return instance; - } - - public Put01RequestBuilder getBuilderAfterRequestBody(PutNullableRequest instance) { - return new Put01RequestBuilder(instance); - } - - public Put10RequestBuilder getBuilderAfterQueryParameters(PutNullableRequest instance) { - return new Put10RequestBuilder(instance); - } - } -} diff --git a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/fakebodywithqueryparams/put/FakebodywithqueryparamsPutQueryParameters.kt b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/fakebodywithqueryparams/put/FakebodywithqueryparamsPutQueryParameters.kt deleted file mode 100644 index 03a6f9411f5..00000000000 --- a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/fakebodywithqueryparams/put/FakebodywithqueryparamsPutQueryParameters.kt +++ /dev/null @@ -1,205 +0,0 @@ -package org.openapijsonschematools.client.paths.fakebodywithqueryparams.put; -import java.util.ArrayList; -import java.util.HashSet; -import java.util.LinkedHashMap; -import java.util.LinkedHashSet; -import java.util.List; -import java.util.Map; -import java.util.Objects; -import java.util.Set; -import org.checkerframework.checker.nullness.qual.Nullable; -import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags; -import org.openapijsonschematools.client.configurations.SchemaConfiguration; -import org.openapijsonschematools.client.exceptions.UnsetPropertyException; -import org.openapijsonschematools.client.exceptions.ValidationException; -import org.openapijsonschematools.client.paths.fakebodywithqueryparams.put.parameters.parameter0.Schema0; -import org.openapijsonschematools.client.schemas.AnyTypeJsonSchema; -import org.openapijsonschematools.client.schemas.GenericBuilder; -import org.openapijsonschematools.client.schemas.NotAnyTypeJsonSchema; -import org.openapijsonschematools.client.schemas.validation.FrozenMap; -import org.openapijsonschematools.client.schemas.validation.JsonSchema; -import org.openapijsonschematools.client.schemas.validation.JsonSchemaInfo; -import org.openapijsonschematools.client.schemas.validation.MapSchemaValidator; -import org.openapijsonschematools.client.schemas.validation.MapUtils; -import org.openapijsonschematools.client.schemas.validation.PathToSchemasMap; -import org.openapijsonschematools.client.schemas.validation.PropertyEntry; -import org.openapijsonschematools.client.schemas.validation.ValidationMetadata; - -public class FakebodywithqueryparamsPutQueryParameters { - // nest classes so all schemas and input/output classes can be public - - - public static class AdditionalProperties extends NotAnyTypeJsonSchema.NotAnyTypeJsonSchema1 { - // NotAnyTypeSchema - private static @Nullable AdditionalProperties instance = null; - public static AdditionalProperties getInstance() { - if (instance == null) { - instance = new AdditionalProperties(); - } - return instance; - } - } - - - public static class QueryParametersMap extends FrozenMap { - protected QueryParametersMap(FrozenMap m) { - super(m); - } - public static final Set requiredKeys = Set.of( - "query" - ); - public static final Set optionalKeys = Set.of(); - public static QueryParametersMap of(Map arg, SchemaConfiguration configuration) throws ValidationException { - return FakebodywithqueryparamsPutQueryParameters1.getInstance().validate(arg, configuration); - } - - public String query() { - try { - return getOrThrow("version"); - } catch (UnsetPropertyException e) { - throw new RuntimeException(e); - } - } - } - - public interface SetterForQuery { - Map getInstance(); - T getBuilderAfterQuery(Map instance); - - default T query(String value) { - var instance = getInstance(); - instance.put("query", value); - return getBuilderAfterQuery(instance); - } - } - - public static class QueryParametersMap0Builder implements GenericBuilder> { - private final Map instance; - private static final Set knownKeys = Set.of( - "query" - ); - public Set getKnownKeys() { - return knownKeys; - } - public QueryParametersMap0Builder(Map instance) { - this.instance = instance; - } - public Map build() { - return instance; - } - } - - public static class QueryParametersMapBuilder implements SetterForQuery { - private final Map instance; - public QueryParametersMapBuilder() { - this.instance = new LinkedHashMap<>(); - } - public Map getInstance() { - return instance; - } - public QueryParametersMap0Builder getBuilderAfterQuery(Map instance) { - return new QueryParametersMap0Builder(instance); - } - } - - - public sealed interface FakebodywithqueryparamsPutQueryParameters1Boxed permits FakebodywithqueryparamsPutQueryParameters1BoxedMap { - @Nullable Object getData(); - } - - public record FakebodywithqueryparamsPutQueryParameters1BoxedMap(QueryParametersMap data) implements FakebodywithqueryparamsPutQueryParameters1Boxed { - @Override - public @Nullable Object getData() { - return data; - } - } - - - public static class FakebodywithqueryparamsPutQueryParameters1 extends JsonSchema implements MapSchemaValidator { - private static @Nullable FakebodywithqueryparamsPutQueryParameters1 instance = null; - - protected FakebodywithqueryparamsPutQueryParameters1() { - super(new JsonSchemaInfo() - .type(Set.of(Map.class)) - .properties(Map.ofEntries( - new PropertyEntry("query", Schema0.Schema01.class) - )) - .required(Set.of( - "query" - )) - .additionalProperties(AdditionalProperties.class) - ); - } - - public static FakebodywithqueryparamsPutQueryParameters1 getInstance() { - if (instance == null) { - instance = new FakebodywithqueryparamsPutQueryParameters1(); - } - return instance; - } - - 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 RuntimeException("Invalid non-string key value"); - } - String propertyName = (String) entryKey; - List propertyPathToItem = new ArrayList<>(pathToItem); - propertyPathToItem.add(propertyName); - Object value = entry.getValue(); - LinkedHashMap, Nothing?> schemas = pathToSchemas.get(propertyPathToItem); - if (schemas == null) { - throw new RuntimeException("Validation 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"); - } - properties.put(propertyName, (String) propertyInstance); - } - FrozenMap castProperties = new FrozenMap<>(properties); - return new QueryParametersMap(castProperties); - } - - 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); - SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().build())); - ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, new PathToSchemasMap(), new LinkedHashSet<>()); - PathToSchemasMap pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet); - return getNewInstance(castArg, validationMetadata.pathToItem(), pathToSchemasMap); - } - - - @Override - public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws 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"); - } - @Override - public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { - if (arg instanceof Map) { - return getNewInstance((Map) arg, pathToItem, pathToSchemas); - } - throw new RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); - } - @Override - public FakebodywithqueryparamsPutQueryParameters1BoxedMap validateAndBox(Map arg, SchemaConfiguration configuration) throws ValidationException { - return new FakebodywithqueryparamsPutQueryParameters1BoxedMap(validate(arg, configuration)); - } - @Override - public FakebodywithqueryparamsPutQueryParameters1Boxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { - 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"); - } - } - -} diff --git a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/fakebodywithqueryparams/put/FakebodywithqueryparamsPutRequestBody.kt b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/fakebodywithqueryparams/put/FakebodywithqueryparamsPutRequestBody.kt deleted file mode 100644 index 441c4f06469..00000000000 --- a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/fakebodywithqueryparams/put/FakebodywithqueryparamsPutRequestBody.kt +++ /dev/null @@ -1,49 +0,0 @@ -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; -import org.openapijsonschematools.client.mediatype.MediaType; -import org.openapijsonschematools.client.paths.fakebodywithqueryparams.put.requestbody.content.applicationjson.ApplicationjsonSchema; - -import java.util.AbstractMap; -import java.util.Map; - -public class FakebodywithqueryparamsPutRequestBody { - public sealed interface SealedMediaType permits ApplicationjsonMediaType {} - - public record ApplicationjsonMediaType(ApplicationjsonSchema.ApplicationjsonSchema1 schema) implements SealedMediaType, MediaType { - public ApplicationjsonMediaType() { - this(ApplicationjsonSchema.ApplicationjsonSchema1.getInstance()); - } - @Override - public Nothing? encoding() { - return null; - } - } - - public static class FakebodywithqueryparamsPutRequestBody1 extends RequestBodySerializer { - public FakebodywithqueryparamsPutRequestBody1() { - super( - Map.ofEntries( - new AbstractMap.SimpleEntry<>("application/json", new ApplicationjsonMediaType()) - ), - true - ); - } - - public SerializedRequestBody serialize(SealedRequestBody requestBody) throws NotImplementedException { - ApplicationjsonRequestBody requestBody0 = (ApplicationjsonRequestBody) requestBody; - return serialize(requestBody0.contentType(), requestBody0.body().getData()); - } - } - - public sealed interface SealedRequestBody permits ApplicationjsonRequestBody {} - public record ApplicationjsonRequestBody(ApplicationjsonSchema.User1Boxed body) implements SealedRequestBody, GenericRequestBody { - @Override - public String contentType() { - return "application/json"; - } - } -} diff --git a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/fakebodywithqueryparams/put/FakebodywithqueryparamsPutResponses.kt b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/fakebodywithqueryparams/put/FakebodywithqueryparamsPutResponses.kt deleted file mode 100644 index 795ee1ec004..00000000000 --- a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/fakebodywithqueryparams/put/FakebodywithqueryparamsPutResponses.kt +++ /dev/null @@ -1,53 +0,0 @@ -package org.openapijsonschematools.client.paths.fakebodywithqueryparams.put; - -import org.openapijsonschematools.client.paths.fakebodywithqueryparams.put.responses.FakebodywithqueryparamsPutCode200Response; -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; -import org.checkerframework.checker.nullness.qual.Nullable; - -import java.net.http.HttpResponse; -import java.util.Map; -import java.util.AbstractMap; - -public class FakebodywithqueryparamsPutResponses { - public sealed interface EndpointResponse permits EndpointFakebodywithqueryparamsPutCode200Response {} - - public record EndpointFakebodywithqueryparamsPutCode200Response( - HttpResponse response, - Nothing? body, - Nothing? headers - ) implements EndpointResponse, ApiResponse{ - } - - public sealed interface StatusCodeResponseDeserializer permits StatusFakebodywithqueryparamsPutCode200ResponseDeserializer {} - - public static final class StatusFakebodywithqueryparamsPutCode200ResponseDeserializer extends FakebodywithqueryparamsPutCode200Response.FakebodywithqueryparamsPutCode200Response1 implements StatusCodeResponseDeserializer { - } - - public static final class FakebodywithqueryparamsPutResponses1 implements ResponsesDeserializer { - private final Map statusCodeToResponseDeserializer; - public FakebodywithqueryparamsPutResponses1() { - this.statusCodeToResponseDeserializer = Map.ofEntries( - new AbstractMap.SimpleEntry<>("200", new StatusFakebodywithqueryparamsPutCode200ResponseDeserializer()) - ); - } - - 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) { - throw new ApiException( - "Invalid response statusCode="+statusCode+" has no response defined in the openapi document", - response - ); - } - StatusFakebodywithqueryparamsPutCode200ResponseDeserializer castDeserializer = (StatusFakebodywithqueryparamsPutCode200ResponseDeserializer) statusCodeDeserializer; - var deserializedResponse = castDeserializer.deserialize(response, configuration); - return new EndpointFakebodywithqueryparamsPutCode200Response(response, deserializedResponse.body(), deserializedResponse.headers()); - } - } -} diff --git a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/fakebodywithqueryparams/put/Parameters.kt b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/fakebodywithqueryparams/put/Parameters.kt deleted file mode 100644 index d796a88eb1d..00000000000 --- a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/fakebodywithqueryparams/put/Parameters.kt +++ /dev/null @@ -1,20 +0,0 @@ -package org.openapijsonschematools.client.paths.fakebodywithqueryparams.put; - -import org.openapijsonschematools.client.paths.fakebodywithqueryparams.put.parameters.Parameter0; -import org.openapijsonschematools.client.parameter.QuerySerializer; - -import java.util.Map; -import java.util.AbstractMap; - -public class Parameters { - - public static class QueryParametersSerializer extends QuerySerializer { - public QueryParametersSerializer() { - super( - Map.ofEntries( - new AbstractMap.SimpleEntry<>("query", new Parameter0.Parameter01()) - ) - ); - } - } -} diff --git a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/fakebodywithqueryparams/put/parameters/Parameter0.kt b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/fakebodywithqueryparams/put/parameters/Parameter0.kt deleted file mode 100644 index b89f34112a4..00000000000 --- a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/fakebodywithqueryparams/put/parameters/Parameter0.kt +++ /dev/null @@ -1,23 +0,0 @@ -package org.openapijsonschematools.client.paths.fakebodywithqueryparams.put.parameters; - -import org.openapijsonschematools.client.parameter.ParameterStyle; -import org.openapijsonschematools.client.parameter.ParameterInType; -import org.openapijsonschematools.client.parameter.SchemaParameter; -import org.openapijsonschematools.client.paths.fakebodywithqueryparams.put.parameters.parameter0.Schema0; - -public class Parameter0 { - - public static class Parameter01 extends SchemaParameter { - public Parameter01() { - super( - "query", - ParameterInType.QUERY, - true, - ParameterStyle.FORM, - true, - false, - Schema0.Schema01.getInstance() - ); - } - } -} diff --git a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/fakebodywithqueryparams/put/parameters/parameter0/Schema0.kt b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/fakebodywithqueryparams/put/parameters/parameter0/Schema0.kt deleted file mode 100644 index 57b1bddf802..00000000000 --- a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/fakebodywithqueryparams/put/parameters/parameter0/Schema0.kt +++ /dev/null @@ -1,19 +0,0 @@ -package org.openapijsonschematools.client.paths.fakebodywithqueryparams.put.parameters.parameter0; -import org.checkerframework.checker.nullness.qual.Nullable; -import org.openapijsonschematools.client.schemas.StringJsonSchema; - -public class Schema0 extends StringJsonSchema { - // nest classes so all schemas and input/output classes can be public - - - public static class Schema01 extends StringJsonSchema.StringJsonSchema1 { - private static @Nullable Schema01 instance = null; - public static Schema01 getInstance() { - if (instance == null) { - instance = new Schema01(); - } - return instance; - } - } - -} diff --git a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/fakebodywithqueryparams/put/requestbody/content/applicationjson/ApplicationjsonSchema.kt b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/fakebodywithqueryparams/put/requestbody/content/applicationjson/ApplicationjsonSchema.kt deleted file mode 100644 index c3506f9a79a..00000000000 --- a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/fakebodywithqueryparams/put/requestbody/content/applicationjson/ApplicationjsonSchema.kt +++ /dev/null @@ -1,19 +0,0 @@ -package org.openapijsonschematools.client.paths.fakebodywithqueryparams.put.requestbody.content.applicationjson; - -import org.checkerframework.checker.nullness.qual.Nullable; -import org.openapijsonschematools.client.components.schemas.User; - -public class ApplicationjsonSchema extends User { - // $refed class - - - public static class ApplicationjsonSchema1 extends User1 { - private static @Nullable ApplicationjsonSchema1 instance = null; - public static ApplicationjsonSchema1 getInstance() { - if (instance == null) { - instance = new ApplicationjsonSchema1(); - } - return instance; - } - } -} diff --git a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/fakebodywithqueryparams/put/responses/FakebodywithqueryparamsPutCode200Response.kt b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/fakebodywithqueryparams/put/responses/FakebodywithqueryparamsPutCode200Response.kt deleted file mode 100644 index b193efb7bee..00000000000 --- a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/fakebodywithqueryparams/put/responses/FakebodywithqueryparamsPutCode200Response.kt +++ /dev/null @@ -1,7 +0,0 @@ -package org.openapijsonschematools.client.paths.fakebodywithqueryparams.put.responses; - -import org.openapijsonschematools.client.components.responses.SuccessDescriptionOnly; - -public class FakebodywithqueryparamsPutCode200Response extends SuccessDescriptionOnly { - public static class FakebodywithqueryparamsPutCode200Response1 extends SuccessDescriptionOnly1 {} -} diff --git a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/fakecasesensitiveparams/FakecasesensitiveparamsPut.kt b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/fakecasesensitiveparams/FakecasesensitiveparamsPut.kt deleted file mode 100644 index 35d386df605..00000000000 --- a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/fakecasesensitiveparams/FakecasesensitiveparamsPut.kt +++ /dev/null @@ -1,180 +0,0 @@ -package org.openapijsonschematools.client.paths.fakecasesensitiveparams; - -import org.checkerframework.checker.nullness.qual.Nullable; -import org.openapijsonschematools.client.RootServerInfo; -import org.openapijsonschematools.client.paths.fakecasesensitiveparams.put.FakecasesensitiveparamsPutQueryParameters; -import org.openapijsonschematools.client.paths.fakecasesensitiveparams.put.Parameters; -import org.openapijsonschematools.client.paths.fakecasesensitiveparams.put.FakecasesensitiveparamsPutResponses; -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.paths.Fakecasesensitiveparams; - -import java.io.IOException; -import java.net.http.HttpClient; -import java.net.http.HttpRequest; -import java.time.Duration; -import java.util.List; -import java.util.Map; - -public class FakecasesensitiveparamsPut { - private static class PutProvider { - private static final String method = "put"; - - public static FakecasesensitiveparamsPutResponses.EndpointResponse put( - PutRequest request, - ApiConfiguration apiConfiguration, - SchemaConfiguration schemaConfiguration, - HttpClient client - ) throws IOException, InterruptedException, ValidationException, NotImplementedException, ApiException { - Map> headers = apiConfiguration.getDefaultHeaders(); - HttpRequest.BodyPublisher bodyPublisher = HttpRequest.BodyPublishers.noBody(); - - var querySerializer = new Parameters.QueryParametersSerializer(); - @Nullable Map queryMap = querySerializer.getQueryMap(request.queryParameters); - String host = apiConfiguration.getServer(request.serverIndex).url(); - - String url = host + Fakecasesensitiveparams.path; - if (queryMap != null) { - url = url + querySerializer.serialize(queryMap); - } - var httpRequest = RestClient.getRequest( - url, - method, - bodyPublisher, - headers, - request.timeout - ); - var response = RestClient.getResponse(httpRequest, client); - var responsesDeserializer = new FakecasesensitiveparamsPutResponses.FakecasesensitiveparamsPutResponses1(); - return responsesDeserializer.deserialize(response, schemaConfiguration); - } - } - - public interface PutOperation { - ApiConfiguration getApiConfiguration(); - SchemaConfiguration getSchemaConfiguration(); - HttpClient getClient(); - default FakecasesensitiveparamsPutResponses.EndpointResponse put(PutRequest request) throws IOException, InterruptedException, ValidationException, NotImplementedException, ApiException { - return PutProvider.put(request, getApiConfiguration(), getSchemaConfiguration(), getClient()); - } - } - - public interface CaseSensitiveParamsOperation { - ApiConfiguration getApiConfiguration(); - SchemaConfiguration getSchemaConfiguration(); - HttpClient getClient(); - default FakecasesensitiveparamsPutResponses.EndpointResponse caseSensitiveParams(PutRequest request) throws IOException, InterruptedException, ValidationException, NotImplementedException, ApiException { - return PutProvider.put(request, getApiConfiguration(), getSchemaConfiguration(), getClient()); - } - } - - public static class Put extends ApiClient implements PutOperation { - public Put(ApiConfiguration apiConfiguration, SchemaConfiguration schemaConfiguration) { - super(apiConfiguration, schemaConfiguration); - } - } - - public static class PutRequest { - public FakecasesensitiveparamsPutQueryParameters.QueryParametersMap queryParameters; - public RootServerInfo.@Nullable ServerIndex serverIndex; - public @Nullable Duration timeout; - - public PutRequest( - FakecasesensitiveparamsPutQueryParameters.QueryParametersMap queryParameters, - RootServerInfo.@Nullable ServerIndex serverIndex, - @Nullable Duration timeout - ) { - this.queryParameters = queryParameters; - this.serverIndex = serverIndex; - this.timeout = timeout; - } - } - - public static class PutNullableRequest { - public FakecasesensitiveparamsPutQueryParameters.@Nullable QueryParametersMap queryParameters; - public RootServerInfo.@Nullable ServerIndex serverIndex; - public @Nullable Duration timeout; - } - - public interface SetterForServerIndex { - PutNullableRequest getInstance(); - T getBuilderAfterServerIndex(PutNullableRequest instance); - default T serverIndex(RootServerInfo.ServerIndex serverIndex) { - var instance = getInstance(); - instance.serverIndex = serverIndex; - return getBuilderAfterServerIndex(instance); - } - } - - public interface SetterForTimeout { - PutNullableRequest getInstance(); - T getBuilderAfterTimeout(PutNullableRequest instance); - default T timeout(Duration timeout) { - var instance = getInstance(); - instance.timeout = timeout; - return getBuilderAfterTimeout(instance); - } - } - - public interface SetterForQueryParameters { - PutNullableRequest getInstance(); - T getBuilderAfterQueryParameters(PutNullableRequest instance); - default T queryParameters(FakecasesensitiveparamsPutQueryParameters.QueryParametersMap queryParameters) { - var instance = getInstance(); - instance.queryParameters = queryParameters; - return getBuilderAfterQueryParameters(instance); - } - } - - public static class Put0RequestBuilder implements SetterForServerIndex, SetterForTimeout { - private final PutNullableRequest instance; - - public Put0RequestBuilder(PutNullableRequest instance) { - this.instance = instance; - } - - public PutRequest build() { - var queryParameters = instance.queryParameters; - if (queryParameters == null) { - throw new RuntimeException("invalid null value for required parameter"); - } - return new PutRequest( - queryParameters, - instance.serverIndex, - instance.timeout - ); - } - - public PutNullableRequest getInstance() { - return instance; - } - - public Put0RequestBuilder getBuilderAfterServerIndex(PutNullableRequest instance) { - return this; - } - - public Put0RequestBuilder getBuilderAfterTimeout(PutNullableRequest instance) { - return this; - } - } - public static class PutRequestBuilder implements SetterForQueryParameters { - private final PutNullableRequest instance; - - public PutRequestBuilder() { - this.instance = new PutNullableRequest(); - } - - public PutNullableRequest getInstance() { - return instance; - } - - public Put0RequestBuilder getBuilderAfterQueryParameters(PutNullableRequest instance) { - return new Put0RequestBuilder(instance); - } - } -} diff --git a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/fakecasesensitiveparams/put/FakecasesensitiveparamsPutQueryParameters.kt b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/fakecasesensitiveparams/put/FakecasesensitiveparamsPutQueryParameters.kt deleted file mode 100644 index 3618c76bc36..00000000000 --- a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/fakecasesensitiveparams/put/FakecasesensitiveparamsPutQueryParameters.kt +++ /dev/null @@ -1,343 +0,0 @@ -package org.openapijsonschematools.client.paths.fakecasesensitiveparams.put; -import java.util.ArrayList; -import java.util.HashSet; -import java.util.LinkedHashMap; -import java.util.LinkedHashSet; -import java.util.List; -import java.util.Map; -import java.util.Objects; -import java.util.Set; -import org.checkerframework.checker.nullness.qual.Nullable; -import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags; -import org.openapijsonschematools.client.configurations.SchemaConfiguration; -import org.openapijsonschematools.client.exceptions.UnsetPropertyException; -import org.openapijsonschematools.client.exceptions.ValidationException; -import org.openapijsonschematools.client.paths.fakecasesensitiveparams.put.parameters.parameter0.Schema0; -import org.openapijsonschematools.client.paths.fakecasesensitiveparams.put.parameters.parameter1.Schema1; -import org.openapijsonschematools.client.paths.fakecasesensitiveparams.put.parameters.parameter2.Schema2; -import org.openapijsonschematools.client.schemas.AnyTypeJsonSchema; -import org.openapijsonschematools.client.schemas.GenericBuilder; -import org.openapijsonschematools.client.schemas.NotAnyTypeJsonSchema; -import org.openapijsonschematools.client.schemas.validation.FrozenMap; -import org.openapijsonschematools.client.schemas.validation.JsonSchema; -import org.openapijsonschematools.client.schemas.validation.JsonSchemaInfo; -import org.openapijsonschematools.client.schemas.validation.MapSchemaValidator; -import org.openapijsonschematools.client.schemas.validation.MapUtils; -import org.openapijsonschematools.client.schemas.validation.PathToSchemasMap; -import org.openapijsonschematools.client.schemas.validation.PropertyEntry; -import org.openapijsonschematools.client.schemas.validation.ValidationMetadata; - -public class FakecasesensitiveparamsPutQueryParameters { - // nest classes so all schemas and input/output classes can be public - - - public static class AdditionalProperties extends NotAnyTypeJsonSchema.NotAnyTypeJsonSchema1 { - // NotAnyTypeSchema - private static @Nullable AdditionalProperties instance = null; - public static AdditionalProperties getInstance() { - if (instance == null) { - instance = new AdditionalProperties(); - } - return instance; - } - } - - - public static class QueryParametersMap extends FrozenMap<@Nullable Object> { - protected QueryParametersMap(FrozenMap<@Nullable Object> m) { - super(m); - } - public static final Set requiredKeys = Set.of( - "SomeVar", - "someVar", - "some_var" - ); - public static final Set optionalKeys = Set.of(); - public static QueryParametersMap of(Map arg, SchemaConfiguration configuration) throws ValidationException { - return FakecasesensitiveparamsPutQueryParameters1.getInstance().validate(arg, configuration); - } - - public String SomeVar() { - @Nullable Object value = get("SomeVar"); - if (!(value instanceof String)) { - throw new RuntimeException("Invalid value stored for SomeVar"); - } - return (String) value; - } - - public String someVar() { - @Nullable Object value = get("someVar"); - if (!(value instanceof String)) { - throw new RuntimeException("Invalid value stored for someVar"); - } - return (String) value; - } - - public String some_var() { - @Nullable Object value = get("some_var"); - if (!(value instanceof String)) { - throw new RuntimeException("Invalid value stored for some_var"); - } - return (String) value; - } - } - - public interface SetterForSomeVar2 { - Map getInstance(); - T getBuilderAfterSomeVar2(Map instance); - - default T SomeVar(String value) { - var instance = getInstance(); - instance.put("SomeVar", value); - return getBuilderAfterSomeVar2(instance); - } - } - - public interface SetterForSomeVar { - Map getInstance(); - T getBuilderAfterSomeVar(Map instance); - - default T someVar(String value) { - var instance = getInstance(); - instance.put("someVar", value); - return getBuilderAfterSomeVar(instance); - } - } - - public interface SetterForSomeVar1 { - Map getInstance(); - T getBuilderAfterSomeVar1(Map instance); - - default T some_var(String value) { - var instance = getInstance(); - instance.put("some_var", value); - return getBuilderAfterSomeVar1(instance); - } - } - - public static class QueryParametersMap000Builder implements GenericBuilder> { - private final Map instance; - private static final Set knownKeys = Set.of( - "SomeVar", - "someVar", - "some_var" - ); - public Set getKnownKeys() { - return knownKeys; - } - public QueryParametersMap000Builder(Map instance) { - this.instance = instance; - } - public Map build() { - return instance; - } - } - - public static class QueryParametersMap001Builder implements SetterForSomeVar1 { - private final Map instance; - public QueryParametersMap001Builder(Map instance) { - this.instance = instance; - } - public Map getInstance() { - return instance; - } - public QueryParametersMap000Builder getBuilderAfterSomeVar1(Map instance) { - return new QueryParametersMap000Builder(instance); - } - } - - public static class QueryParametersMap010Builder implements SetterForSomeVar { - private final Map instance; - public QueryParametersMap010Builder(Map instance) { - this.instance = instance; - } - public Map getInstance() { - return instance; - } - public QueryParametersMap000Builder getBuilderAfterSomeVar(Map instance) { - return new QueryParametersMap000Builder(instance); - } - } - - public static class QueryParametersMap011Builder implements SetterForSomeVar, SetterForSomeVar1 { - private final Map instance; - public QueryParametersMap011Builder(Map instance) { - this.instance = instance; - } - public Map getInstance() { - return instance; - } - public QueryParametersMap001Builder getBuilderAfterSomeVar(Map instance) { - return new QueryParametersMap001Builder(instance); - } - public QueryParametersMap010Builder getBuilderAfterSomeVar1(Map instance) { - return new QueryParametersMap010Builder(instance); - } - } - - public static class QueryParametersMap100Builder implements SetterForSomeVar2 { - private final Map instance; - public QueryParametersMap100Builder(Map instance) { - this.instance = instance; - } - public Map getInstance() { - return instance; - } - public QueryParametersMap000Builder getBuilderAfterSomeVar2(Map instance) { - return new QueryParametersMap000Builder(instance); - } - } - - public static class QueryParametersMap101Builder implements SetterForSomeVar2, SetterForSomeVar1 { - private final Map instance; - public QueryParametersMap101Builder(Map instance) { - this.instance = instance; - } - public Map getInstance() { - return instance; - } - public QueryParametersMap001Builder getBuilderAfterSomeVar2(Map instance) { - return new QueryParametersMap001Builder(instance); - } - public QueryParametersMap100Builder getBuilderAfterSomeVar1(Map instance) { - return new QueryParametersMap100Builder(instance); - } - } - - public static class QueryParametersMap110Builder implements SetterForSomeVar2, SetterForSomeVar { - private final Map instance; - public QueryParametersMap110Builder(Map instance) { - this.instance = instance; - } - public Map getInstance() { - return instance; - } - public QueryParametersMap010Builder getBuilderAfterSomeVar2(Map instance) { - return new QueryParametersMap010Builder(instance); - } - public QueryParametersMap100Builder getBuilderAfterSomeVar(Map instance) { - return new QueryParametersMap100Builder(instance); - } - } - - public static class QueryParametersMapBuilder implements SetterForSomeVar2, SetterForSomeVar, SetterForSomeVar1 { - private final Map instance; - public QueryParametersMapBuilder() { - this.instance = new LinkedHashMap<>(); - } - public Map getInstance() { - return instance; - } - public QueryParametersMap011Builder getBuilderAfterSomeVar2(Map instance) { - return new QueryParametersMap011Builder(instance); - } - public QueryParametersMap101Builder getBuilderAfterSomeVar(Map instance) { - return new QueryParametersMap101Builder(instance); - } - public QueryParametersMap110Builder getBuilderAfterSomeVar1(Map instance) { - return new QueryParametersMap110Builder(instance); - } - } - - - public sealed interface FakecasesensitiveparamsPutQueryParameters1Boxed permits FakecasesensitiveparamsPutQueryParameters1BoxedMap { - @Nullable Object getData(); - } - - public record FakecasesensitiveparamsPutQueryParameters1BoxedMap(QueryParametersMap data) implements FakecasesensitiveparamsPutQueryParameters1Boxed { - @Override - public @Nullable Object getData() { - return data; - } - } - - - public static class FakecasesensitiveparamsPutQueryParameters1 extends JsonSchema implements MapSchemaValidator { - private static @Nullable FakecasesensitiveparamsPutQueryParameters1 instance = null; - - protected FakecasesensitiveparamsPutQueryParameters1() { - super(new JsonSchemaInfo() - .type(Set.of(Map.class)) - .properties(Map.ofEntries( - new PropertyEntry("someVar", Schema0.Schema01.class), - new PropertyEntry("some_var", Schema2.Schema21.class), - new PropertyEntry("SomeVar", Schema1.Schema11.class) - )) - .required(Set.of( - "SomeVar", - "someVar", - "some_var" - )) - .additionalProperties(AdditionalProperties.class) - ); - } - - public static FakecasesensitiveparamsPutQueryParameters1 getInstance() { - if (instance == null) { - instance = new FakecasesensitiveparamsPutQueryParameters1(); - } - return instance; - } - - 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 RuntimeException("Invalid non-string key value"); - } - String propertyName = (String) entryKey; - List propertyPathToItem = new ArrayList<>(pathToItem); - propertyPathToItem.add(propertyName); - Object value = entry.getValue(); - LinkedHashMap, Nothing?> schemas = pathToSchemas.get(propertyPathToItem); - if (schemas == null) { - throw new RuntimeException("Validation result is invalid, schemas must exist for a pathToItem"); - } - JsonSchema propertySchema = schemas.entrySet().iterator().next().getKey(); - @Nullable Object propertyInstance = propertySchema.getNewInstance(value, propertyPathToItem, pathToSchemas); - properties.put(propertyName, propertyInstance); - } - FrozenMap<@Nullable Object> castProperties = new FrozenMap<>(properties); - return new QueryParametersMap(castProperties); - } - - 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); - SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().build())); - ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, new PathToSchemasMap(), new LinkedHashSet<>()); - PathToSchemasMap pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet); - return getNewInstance(castArg, validationMetadata.pathToItem(), pathToSchemasMap); - } - - - @Override - public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws 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"); - } - @Override - public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { - if (arg instanceof Map) { - return getNewInstance((Map) arg, pathToItem, pathToSchemas); - } - throw new RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); - } - @Override - public FakecasesensitiveparamsPutQueryParameters1BoxedMap validateAndBox(Map arg, SchemaConfiguration configuration) throws ValidationException { - return new FakecasesensitiveparamsPutQueryParameters1BoxedMap(validate(arg, configuration)); - } - @Override - public FakecasesensitiveparamsPutQueryParameters1Boxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { - 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"); - } - } - -} diff --git a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/fakecasesensitiveparams/put/FakecasesensitiveparamsPutResponses.kt b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/fakecasesensitiveparams/put/FakecasesensitiveparamsPutResponses.kt deleted file mode 100644 index daed34aa092..00000000000 --- a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/fakecasesensitiveparams/put/FakecasesensitiveparamsPutResponses.kt +++ /dev/null @@ -1,53 +0,0 @@ -package org.openapijsonschematools.client.paths.fakecasesensitiveparams.put; - -import org.openapijsonschematools.client.paths.fakecasesensitiveparams.put.responses.FakecasesensitiveparamsPutCode200Response; -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; -import org.checkerframework.checker.nullness.qual.Nullable; - -import java.net.http.HttpResponse; -import java.util.Map; -import java.util.AbstractMap; - -public class FakecasesensitiveparamsPutResponses { - public sealed interface EndpointResponse permits EndpointFakecasesensitiveparamsPutCode200Response {} - - public record EndpointFakecasesensitiveparamsPutCode200Response( - HttpResponse response, - Nothing? body, - Nothing? headers - ) implements EndpointResponse, ApiResponse{ - } - - public sealed interface StatusCodeResponseDeserializer permits StatusFakecasesensitiveparamsPutCode200ResponseDeserializer {} - - public static final class StatusFakecasesensitiveparamsPutCode200ResponseDeserializer extends FakecasesensitiveparamsPutCode200Response.FakecasesensitiveparamsPutCode200Response1 implements StatusCodeResponseDeserializer { - } - - public static final class FakecasesensitiveparamsPutResponses1 implements ResponsesDeserializer { - private final Map statusCodeToResponseDeserializer; - public FakecasesensitiveparamsPutResponses1() { - this.statusCodeToResponseDeserializer = Map.ofEntries( - new AbstractMap.SimpleEntry<>("200", new StatusFakecasesensitiveparamsPutCode200ResponseDeserializer()) - ); - } - - 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) { - throw new ApiException( - "Invalid response statusCode="+statusCode+" has no response defined in the openapi document", - response - ); - } - StatusFakecasesensitiveparamsPutCode200ResponseDeserializer castDeserializer = (StatusFakecasesensitiveparamsPutCode200ResponseDeserializer) statusCodeDeserializer; - var deserializedResponse = castDeserializer.deserialize(response, configuration); - return new EndpointFakecasesensitiveparamsPutCode200Response(response, deserializedResponse.body(), deserializedResponse.headers()); - } - } -} diff --git a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/fakecasesensitiveparams/put/Parameters.kt b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/fakecasesensitiveparams/put/Parameters.kt deleted file mode 100644 index e153b47414a..00000000000 --- a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/fakecasesensitiveparams/put/Parameters.kt +++ /dev/null @@ -1,24 +0,0 @@ -package org.openapijsonschematools.client.paths.fakecasesensitiveparams.put; - -import org.openapijsonschematools.client.paths.fakecasesensitiveparams.put.parameters.Parameter0; -import org.openapijsonschematools.client.paths.fakecasesensitiveparams.put.parameters.Parameter1; -import org.openapijsonschematools.client.paths.fakecasesensitiveparams.put.parameters.Parameter2; -import org.openapijsonschematools.client.parameter.QuerySerializer; - -import java.util.Map; -import java.util.AbstractMap; - -public class Parameters { - - public static class QueryParametersSerializer extends QuerySerializer { - public QueryParametersSerializer() { - super( - Map.ofEntries( - new AbstractMap.SimpleEntry<>("someVar", new Parameter0.Parameter01()), - new AbstractMap.SimpleEntry<>("SomeVar", new Parameter1.Parameter11()), - new AbstractMap.SimpleEntry<>("some_var", new Parameter2.Parameter21()) - ) - ); - } - } -} diff --git a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/fakecasesensitiveparams/put/parameters/Parameter0.kt b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/fakecasesensitiveparams/put/parameters/Parameter0.kt deleted file mode 100644 index 96db6d8662c..00000000000 --- a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/fakecasesensitiveparams/put/parameters/Parameter0.kt +++ /dev/null @@ -1,23 +0,0 @@ -package org.openapijsonschematools.client.paths.fakecasesensitiveparams.put.parameters; - -import org.openapijsonschematools.client.parameter.ParameterStyle; -import org.openapijsonschematools.client.parameter.ParameterInType; -import org.openapijsonschematools.client.parameter.SchemaParameter; -import org.openapijsonschematools.client.paths.fakecasesensitiveparams.put.parameters.parameter0.Schema0; - -public class Parameter0 { - - public static class Parameter01 extends SchemaParameter { - public Parameter01() { - super( - "someVar", - ParameterInType.QUERY, - true, - ParameterStyle.FORM, - true, - false, - Schema0.Schema01.getInstance() - ); - } - } -} diff --git a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/fakecasesensitiveparams/put/parameters/Parameter1.kt b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/fakecasesensitiveparams/put/parameters/Parameter1.kt deleted file mode 100644 index 9923c6e1aee..00000000000 --- a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/fakecasesensitiveparams/put/parameters/Parameter1.kt +++ /dev/null @@ -1,23 +0,0 @@ -package org.openapijsonschematools.client.paths.fakecasesensitiveparams.put.parameters; - -import org.openapijsonschematools.client.parameter.ParameterStyle; -import org.openapijsonschematools.client.parameter.ParameterInType; -import org.openapijsonschematools.client.parameter.SchemaParameter; -import org.openapijsonschematools.client.paths.fakecasesensitiveparams.put.parameters.parameter1.Schema1; - -public class Parameter1 { - - public static class Parameter11 extends SchemaParameter { - public Parameter11() { - super( - "SomeVar", - ParameterInType.QUERY, - true, - ParameterStyle.FORM, - true, - false, - Schema1.Schema11.getInstance() - ); - } - } -} diff --git a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/fakecasesensitiveparams/put/parameters/Parameter2.kt b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/fakecasesensitiveparams/put/parameters/Parameter2.kt deleted file mode 100644 index c3b8320db0f..00000000000 --- a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/fakecasesensitiveparams/put/parameters/Parameter2.kt +++ /dev/null @@ -1,23 +0,0 @@ -package org.openapijsonschematools.client.paths.fakecasesensitiveparams.put.parameters; - -import org.openapijsonschematools.client.parameter.ParameterStyle; -import org.openapijsonschematools.client.parameter.ParameterInType; -import org.openapijsonschematools.client.parameter.SchemaParameter; -import org.openapijsonschematools.client.paths.fakecasesensitiveparams.put.parameters.parameter2.Schema2; - -public class Parameter2 { - - public static class Parameter21 extends SchemaParameter { - public Parameter21() { - super( - "some_var", - ParameterInType.QUERY, - true, - ParameterStyle.FORM, - true, - false, - Schema2.Schema21.getInstance() - ); - } - } -} diff --git a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/fakecasesensitiveparams/put/parameters/parameter0/Schema0.kt b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/fakecasesensitiveparams/put/parameters/parameter0/Schema0.kt deleted file mode 100644 index 82b36aec229..00000000000 --- a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/fakecasesensitiveparams/put/parameters/parameter0/Schema0.kt +++ /dev/null @@ -1,19 +0,0 @@ -package org.openapijsonschematools.client.paths.fakecasesensitiveparams.put.parameters.parameter0; -import org.checkerframework.checker.nullness.qual.Nullable; -import org.openapijsonschematools.client.schemas.StringJsonSchema; - -public class Schema0 extends StringJsonSchema { - // nest classes so all schemas and input/output classes can be public - - - public static class Schema01 extends StringJsonSchema.StringJsonSchema1 { - private static @Nullable Schema01 instance = null; - public static Schema01 getInstance() { - if (instance == null) { - instance = new Schema01(); - } - return instance; - } - } - -} diff --git a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/fakecasesensitiveparams/put/parameters/parameter1/Schema1.kt b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/fakecasesensitiveparams/put/parameters/parameter1/Schema1.kt deleted file mode 100644 index 8fe5c279258..00000000000 --- a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/fakecasesensitiveparams/put/parameters/parameter1/Schema1.kt +++ /dev/null @@ -1,19 +0,0 @@ -package org.openapijsonschematools.client.paths.fakecasesensitiveparams.put.parameters.parameter1; -import org.checkerframework.checker.nullness.qual.Nullable; -import org.openapijsonschematools.client.schemas.StringJsonSchema; - -public class Schema1 extends StringJsonSchema { - // nest classes so all schemas and input/output classes can be public - - - public static class Schema11 extends StringJsonSchema.StringJsonSchema1 { - private static @Nullable Schema11 instance = null; - public static Schema11 getInstance() { - if (instance == null) { - instance = new Schema11(); - } - return instance; - } - } - -} diff --git a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/fakecasesensitiveparams/put/parameters/parameter2/Schema2.kt b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/fakecasesensitiveparams/put/parameters/parameter2/Schema2.kt deleted file mode 100644 index ce17de1e932..00000000000 --- a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/fakecasesensitiveparams/put/parameters/parameter2/Schema2.kt +++ /dev/null @@ -1,19 +0,0 @@ -package org.openapijsonschematools.client.paths.fakecasesensitiveparams.put.parameters.parameter2; -import org.checkerframework.checker.nullness.qual.Nullable; -import org.openapijsonschematools.client.schemas.StringJsonSchema; - -public class Schema2 extends StringJsonSchema { - // nest classes so all schemas and input/output classes can be public - - - public static class Schema21 extends StringJsonSchema.StringJsonSchema1 { - private static @Nullable Schema21 instance = null; - public static Schema21 getInstance() { - if (instance == null) { - instance = new Schema21(); - } - return instance; - } - } - -} diff --git a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/fakecasesensitiveparams/put/responses/FakecasesensitiveparamsPutCode200Response.kt b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/fakecasesensitiveparams/put/responses/FakecasesensitiveparamsPutCode200Response.kt deleted file mode 100644 index 72eb0975e3a..00000000000 --- a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/fakecasesensitiveparams/put/responses/FakecasesensitiveparamsPutCode200Response.kt +++ /dev/null @@ -1,7 +0,0 @@ -package org.openapijsonschematools.client.paths.fakecasesensitiveparams.put.responses; - -import org.openapijsonschematools.client.components.responses.SuccessDescriptionOnly; - -public class FakecasesensitiveparamsPutCode200Response extends SuccessDescriptionOnly { - public static class FakecasesensitiveparamsPutCode200Response1 extends SuccessDescriptionOnly1 {} -} diff --git a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/fakeclassnametest/FakeclassnametestPatch.kt b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/fakeclassnametest/FakeclassnametestPatch.kt deleted file mode 100644 index 798f569e7ab..00000000000 --- a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/fakeclassnametest/FakeclassnametestPatch.kt +++ /dev/null @@ -1,215 +0,0 @@ -package org.openapijsonschematools.client.paths.fakeclassnametest; - -import org.checkerframework.checker.nullness.qual.Nullable; -import org.openapijsonschematools.client.RootServerInfo; -import org.openapijsonschematools.client.paths.fakeclassnametest.patch.FakeclassnametestPatchSecurityInfo; -import org.openapijsonschematools.client.paths.fakeclassnametest.patch.FakeclassnametestPatchRequestBody; -import org.openapijsonschematools.client.paths.fakeclassnametest.patch.FakeclassnametestPatchResponses; -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.requestbody.SerializedRequestBody; -import org.openapijsonschematools.client.paths.Fakeclassnametest; -import org.openapijsonschematools.client.securityrequirementobjects.SecurityRequirementObject; -import org.openapijsonschematools.client.securityrequirementobjects.AuthApplier; - -import java.io.IOException; -import java.util.ArrayList; -import java.net.http.HttpClient; -import java.net.http.HttpRequest; -import java.time.Duration; -import java.util.List; -import java.util.Map; - -public class FakeclassnametestPatch { - private static class PatchProvider extends AuthApplier { - private static final String method = "patch"; - - public static FakeclassnametestPatchResponses.EndpointResponse patch( - PatchRequest request, - ApiConfiguration apiConfiguration, - SchemaConfiguration schemaConfiguration, - HttpClient client - ) throws IOException, InterruptedException, ValidationException, NotImplementedException, ApiException { - Map> headers = apiConfiguration.getDefaultHeaders(); - - SerializedRequestBody serializedRequestBody = new FakeclassnametestPatchRequestBody.FakeclassnametestPatchRequestBody1().serialize( - request.requestBody - ); - var contentTypeHeaderValues = headers.getOrDefault("Content-Type", new ArrayList<>()); - contentTypeHeaderValues.add(serializedRequestBody.contentType); - HttpRequest.BodyPublisher bodyPublisher = serializedRequestBody.bodyPublisher; - // TODO set this to a map if there is a query security scheme - @Nullable Map queryMap = null; - String host = apiConfiguration.getServer(request.serverIndex).url(); - SecurityRequirementObject securityRequirementObject = apiConfiguration.getSecurityRequirementObject(request.securityIndex); - updateParamsForAuth( - securityRequirementObject, - headers, - Fakeclassnametest.path, - method, - bodyPublisher, - queryMap, - apiConfiguration - ); - - String url = host + Fakeclassnametest.path; - var httpRequest = RestClient.getRequest( - url, - method, - bodyPublisher, - headers, - request.timeout - ); - var response = RestClient.getResponse(httpRequest, client); - var responsesDeserializer = new FakeclassnametestPatchResponses.FakeclassnametestPatchResponses1(); - return responsesDeserializer.deserialize(response, schemaConfiguration); - } - } - - public interface PatchOperation { - ApiConfiguration getApiConfiguration(); - SchemaConfiguration getSchemaConfiguration(); - HttpClient getClient(); - default FakeclassnametestPatchResponses.EndpointResponse patch(PatchRequest request) throws IOException, InterruptedException, ValidationException, NotImplementedException, ApiException { - return PatchProvider.patch(request, getApiConfiguration(), getSchemaConfiguration(), getClient()); - } - } - - public interface ClassnameOperation { - ApiConfiguration getApiConfiguration(); - SchemaConfiguration getSchemaConfiguration(); - HttpClient getClient(); - default FakeclassnametestPatchResponses.EndpointResponse classname(PatchRequest request) throws IOException, InterruptedException, ValidationException, NotImplementedException, ApiException { - return PatchProvider.patch(request, getApiConfiguration(), getSchemaConfiguration(), getClient()); - } - } - - public static class Patch extends ApiClient implements PatchOperation { - public Patch(ApiConfiguration apiConfiguration, SchemaConfiguration schemaConfiguration) { - super(apiConfiguration, schemaConfiguration); - } - } - - public static class PatchRequest { - public FakeclassnametestPatchRequestBody.SealedRequestBody requestBody; - public RootServerInfo.@Nullable ServerIndex serverIndex; - public FakeclassnametestPatchSecurityInfo.@Nullable SecurityIndex securityIndex; - public @Nullable Duration timeout; - - public PatchRequest( - FakeclassnametestPatchRequestBody.SealedRequestBody requestBody, - RootServerInfo.@Nullable ServerIndex serverIndex, - FakeclassnametestPatchSecurityInfo.@Nullable SecurityIndex securityIndex, - @Nullable Duration timeout - ) { - this.requestBody = requestBody; - this.serverIndex = serverIndex; - this.securityIndex = securityIndex; - this.timeout = timeout; - } - } - - public static class PatchNullableRequest { - public FakeclassnametestPatchRequestBody.@Nullable SealedRequestBody requestBody; - public RootServerInfo.@Nullable ServerIndex serverIndex; - public FakeclassnametestPatchSecurityInfo.@Nullable SecurityIndex securityIndex; - public @Nullable Duration timeout; - } - - public interface SetterForServerIndex { - PatchNullableRequest getInstance(); - T getBuilderAfterServerIndex(PatchNullableRequest instance); - default T serverIndex(RootServerInfo.ServerIndex serverIndex) { - var instance = getInstance(); - instance.serverIndex = serverIndex; - return getBuilderAfterServerIndex(instance); - } - } - - public interface SetterForSecurityIndex { - PatchNullableRequest getInstance(); - T getBuilderAfterSecurityIndex(PatchNullableRequest instance); - default T securityIndex(FakeclassnametestPatchSecurityInfo.SecurityIndex securityIndex) { - var instance = getInstance(); - instance.securityIndex = securityIndex; - return getBuilderAfterSecurityIndex(instance); - } - } - - public interface SetterForTimeout { - PatchNullableRequest getInstance(); - T getBuilderAfterTimeout(PatchNullableRequest instance); - default T timeout(Duration timeout) { - var instance = getInstance(); - instance.timeout = timeout; - return getBuilderAfterTimeout(instance); - } - } - - public interface SetterForRequestBody { - PatchNullableRequest getInstance(); - T getBuilderAfterRequestBody(PatchNullableRequest instance); - default T requestBody(FakeclassnametestPatchRequestBody.SealedRequestBody requestBody) { - var instance = getInstance(); - instance.requestBody = requestBody; - return getBuilderAfterRequestBody(instance); - } - } - - public static class Patch0RequestBuilder implements SetterForServerIndex, SetterForSecurityIndex, SetterForTimeout { - private final PatchNullableRequest instance; - - public Patch0RequestBuilder(PatchNullableRequest instance) { - this.instance = instance; - } - - public PatchRequest build() { - var requestBody = instance.requestBody; - if (requestBody == null) { - throw new RuntimeException("invalid null value for required parameter"); - } - return new PatchRequest( - requestBody, - instance.serverIndex, - instance.securityIndex, - instance.timeout - ); - } - - public PatchNullableRequest getInstance() { - return instance; - } - - public Patch0RequestBuilder getBuilderAfterServerIndex(PatchNullableRequest instance) { - return this; - } - - public Patch0RequestBuilder getBuilderAfterSecurityIndex(PatchNullableRequest instance) { - return this; - } - - public Patch0RequestBuilder getBuilderAfterTimeout(PatchNullableRequest instance) { - return this; - } - } - public static class PatchRequestBuilder implements SetterForRequestBody { - private final PatchNullableRequest instance; - - public PatchRequestBuilder() { - this.instance = new PatchNullableRequest(); - } - - public PatchNullableRequest getInstance() { - return instance; - } - - public Patch0RequestBuilder getBuilderAfterRequestBody(PatchNullableRequest instance) { - return new Patch0RequestBuilder(instance); - } - } -} diff --git a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/fakeclassnametest/patch/FakeclassnametestPatchRequestBody.kt b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/fakeclassnametest/patch/FakeclassnametestPatchRequestBody.kt deleted file mode 100644 index 69e81d0f4bc..00000000000 --- a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/fakeclassnametest/patch/FakeclassnametestPatchRequestBody.kt +++ /dev/null @@ -1,7 +0,0 @@ -package org.openapijsonschematools.client.paths.fakeclassnametest.patch; - -import org.openapijsonschematools.client.components.requestbodies.Client; - -public class FakeclassnametestPatchRequestBody extends Client { - public static class FakeclassnametestPatchRequestBody1 extends Client1 {} -} diff --git a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/fakeclassnametest/patch/FakeclassnametestPatchResponses.kt b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/fakeclassnametest/patch/FakeclassnametestPatchResponses.kt deleted file mode 100644 index 7428a4013dc..00000000000 --- a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/fakeclassnametest/patch/FakeclassnametestPatchResponses.kt +++ /dev/null @@ -1,53 +0,0 @@ -package org.openapijsonschematools.client.paths.fakeclassnametest.patch; - -import org.openapijsonschematools.client.paths.fakeclassnametest.patch.responses.FakeclassnametestPatchCode200Response; -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; -import org.checkerframework.checker.nullness.qual.Nullable; - -import java.net.http.HttpResponse; -import java.util.Map; -import java.util.AbstractMap; - -public class FakeclassnametestPatchResponses { - public sealed interface EndpointResponse permits EndpointFakeclassnametestPatchCode200Response {} - - public record EndpointFakeclassnametestPatchCode200Response( - HttpResponse response, - FakeclassnametestPatchCode200Response.SealedResponseBody body, - Nothing? headers - ) implements EndpointResponse, ApiResponse{ - } - - public sealed interface StatusCodeResponseDeserializer permits StatusFakeclassnametestPatchCode200ResponseDeserializer {} - - public static final class StatusFakeclassnametestPatchCode200ResponseDeserializer extends FakeclassnametestPatchCode200Response.FakeclassnametestPatchCode200Response1 implements StatusCodeResponseDeserializer { - } - - public static final class FakeclassnametestPatchResponses1 implements ResponsesDeserializer { - private final Map statusCodeToResponseDeserializer; - public FakeclassnametestPatchResponses1() { - this.statusCodeToResponseDeserializer = Map.ofEntries( - new AbstractMap.SimpleEntry<>("200", new StatusFakeclassnametestPatchCode200ResponseDeserializer()) - ); - } - - 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) { - throw new ApiException( - "Invalid response statusCode="+statusCode+" has no response defined in the openapi document", - response - ); - } - StatusFakeclassnametestPatchCode200ResponseDeserializer castDeserializer = (StatusFakeclassnametestPatchCode200ResponseDeserializer) statusCodeDeserializer; - var deserializedResponse = castDeserializer.deserialize(response, configuration); - return new EndpointFakeclassnametestPatchCode200Response(response, deserializedResponse.body(), deserializedResponse.headers()); - } - } -} diff --git a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/fakeclassnametest/patch/FakeclassnametestPatchSecurityInfo.kt b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/fakeclassnametest/patch/FakeclassnametestPatchSecurityInfo.kt deleted file mode 100644 index a4a739aad43..00000000000 --- a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/fakeclassnametest/patch/FakeclassnametestPatchSecurityInfo.kt +++ /dev/null @@ -1,24 +0,0 @@ -package org.openapijsonschematools.client.paths.fakeclassnametest.patch; - -import org.openapijsonschematools.client.paths.fakeclassnametest.patch.security.FakeclassnametestPatchSecurityRequirementObject0; -import org.openapijsonschematools.client.securityrequirementobjects.SecurityRequirementObject; -import org.openapijsonschematools.client.securityrequirementobjects.SecurityRequirementObjectProvider; - -public class FakeclassnametestPatchSecurityInfo { - public static class FakeclassnametestPatchSecurityInfo1 implements SecurityRequirementObjectProvider { - public final FakeclassnametestPatchSecurityRequirementObject0 security0; - - public FakeclassnametestPatchSecurityInfo1() { - security0 = new FakeclassnametestPatchSecurityRequirementObject0(); - } - - @Override - public SecurityRequirementObject getSecurityRequirementObject(SecurityIndex securityIndex) { - return security0; - } - } - - public enum SecurityIndex { - SECURITY_0 - } -} \ No newline at end of file diff --git a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/fakeclassnametest/patch/responses/FakeclassnametestPatchCode200Response.kt b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/fakeclassnametest/patch/responses/FakeclassnametestPatchCode200Response.kt deleted file mode 100644 index 9c3f649fdf4..00000000000 --- a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/fakeclassnametest/patch/responses/FakeclassnametestPatchCode200Response.kt +++ /dev/null @@ -1,63 +0,0 @@ -package org.openapijsonschematools.client.paths.fakeclassnametest.patch.responses; - -import org.openapijsonschematools.client.configurations.SchemaConfiguration; -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; - -import java.util.AbstractMap; -import java.util.Map; -import java.net.http.HttpResponse; -import java.net.http.HttpHeaders; - -public class FakeclassnametestPatchCode200Response { - public sealed interface SealedMediaType permits ApplicationjsonMediaType {} - - public record ApplicationjsonMediaType(ApplicationjsonSchema.ApplicationjsonSchema1 schema) implements SealedMediaType, MediaType { - public ApplicationjsonMediaType() { - this(ApplicationjsonSchema.ApplicationjsonSchema1.getInstance()); - } - @Override - public Nothing? encoding() { - return null; - } - } - public sealed interface SealedResponseBody permits ApplicationjsonResponseBody {} - public record ApplicationjsonResponseBody(ApplicationjsonSchema.Client1Boxed body) implements SealedResponseBody { } - - public static class FakeclassnametestPatchCode200Response1 extends ResponseDeserializer { - public FakeclassnametestPatchCode200Response1() { - super( - Map.ofEntries( - new AbstractMap.SimpleEntry<>("application/json", new ApplicationjsonMediaType()) - ) - ); - } - - @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); - } - - @Override - protected Nothing? getHeaders(HttpHeaders headers, SchemaConfiguration configuration) { - return null; - } - } - - @SuppressWarnings("serial") - public static class ResponseApiException extends ApiException { - public DeserializedHttpResponse deserializedResponse; - - public ResponseApiException(String s, HttpResponse response, DeserializedHttpResponse deserializedResponse) { - super(s, response); - this.deserializedResponse = deserializedResponse; - } - } -} diff --git a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/fakeclassnametest/patch/responses/code200response/content/applicationjson/ApplicationjsonSchema.kt b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/fakeclassnametest/patch/responses/code200response/content/applicationjson/ApplicationjsonSchema.kt deleted file mode 100644 index ba79861d2e9..00000000000 --- a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/fakeclassnametest/patch/responses/code200response/content/applicationjson/ApplicationjsonSchema.kt +++ /dev/null @@ -1,19 +0,0 @@ -package org.openapijsonschematools.client.paths.fakeclassnametest.patch.responses.code200response.content.applicationjson; - -import org.checkerframework.checker.nullness.qual.Nullable; -import org.openapijsonschematools.client.components.schemas.Client; - -public class ApplicationjsonSchema extends Client { - // $refed class - - - public static class ApplicationjsonSchema1 extends Client1 { - private static @Nullable ApplicationjsonSchema1 instance = null; - public static ApplicationjsonSchema1 getInstance() { - if (instance == null) { - instance = new ApplicationjsonSchema1(); - } - return instance; - } - } -} diff --git a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/fakeclassnametest/patch/security/FakeclassnametestPatchSecurityRequirementObject0.kt b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/fakeclassnametest/patch/security/FakeclassnametestPatchSecurityRequirementObject0.kt deleted file mode 100644 index 6b61b1b9a00..00000000000 --- a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/fakeclassnametest/patch/security/FakeclassnametestPatchSecurityRequirementObject0.kt +++ /dev/null @@ -1,24 +0,0 @@ -package org.openapijsonschematools.client.paths.fakeclassnametest.patch.security; - -import org.checkerframework.checker.nullness.qual.Nullable; -import org.openapijsonschematools.client.securityrequirementobjects.SecurityRequirementObject; -import org.openapijsonschematools.client.securityschemes.SecurityScheme; -import org.openapijsonschematools.client.components.securityschemes.ApiKeyQuery; - -import java.util.List; -import java.util.Map; -import java.util.AbstractMap; - -public class FakeclassnametestPatchSecurityRequirementObject0 extends SecurityRequirementObject { - - public FakeclassnametestPatchSecurityRequirementObject0() { - super( - Map.ofEntries( - new AbstractMap.SimpleEntry, List>( - ApiKeyQuery.class, - List.of() - ) - ) - ); - } -} diff --git a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/fakedeletecoffeeid/FakedeletecoffeeidDelete.kt b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/fakedeletecoffeeid/FakedeletecoffeeidDelete.kt deleted file mode 100644 index 09b216880c7..00000000000 --- a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/fakedeletecoffeeid/FakedeletecoffeeidDelete.kt +++ /dev/null @@ -1,179 +0,0 @@ -package org.openapijsonschematools.client.paths.fakedeletecoffeeid; - -import org.checkerframework.checker.nullness.qual.Nullable; -import org.openapijsonschematools.client.RootServerInfo; -import org.openapijsonschematools.client.paths.fakedeletecoffeeid.delete.FakedeletecoffeeidDeletePathParameters; -import org.openapijsonschematools.client.paths.fakedeletecoffeeid.delete.Parameters; -import org.openapijsonschematools.client.paths.fakedeletecoffeeid.delete.FakedeletecoffeeidDeleteResponses; -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.paths.Fakedeletecoffeeid; - -import java.io.IOException; -import java.net.http.HttpClient; -import java.net.http.HttpRequest; -import java.time.Duration; -import java.util.List; -import java.util.Map; - -public class FakedeletecoffeeidDelete { - private static class DeleteProvider { - private static final String method = "delete"; - - public static FakedeletecoffeeidDeleteResponses.EndpointResponse delete( - DeleteRequest request, - ApiConfiguration apiConfiguration, - SchemaConfiguration schemaConfiguration, - HttpClient client - ) throws IOException, InterruptedException, ValidationException, NotImplementedException, ApiException { - Map> headers = apiConfiguration.getDefaultHeaders(); - HttpRequest.BodyPublisher bodyPublisher = HttpRequest.BodyPublishers.noBody(); - - var pathSerializer = new Parameters.PathParametersSerializer(); - String updatedPath = pathSerializer.serialize(request.pathParameters, Fakedeletecoffeeid.path); - // TODO set this to a map if there is a query security scheme - @Nullable Map queryMap = null; - String host = apiConfiguration.getServer(request.serverIndex).url(); - - String url = host + updatedPath; - var httpRequest = RestClient.getRequest( - url, - method, - bodyPublisher, - headers, - request.timeout - ); - var response = RestClient.getResponse(httpRequest, client); - var responsesDeserializer = new FakedeletecoffeeidDeleteResponses.FakedeletecoffeeidDeleteResponses1(); - return responsesDeserializer.deserialize(response, schemaConfiguration); - } - } - - public interface DeleteOperation { - ApiConfiguration getApiConfiguration(); - SchemaConfiguration getSchemaConfiguration(); - HttpClient getClient(); - default FakedeletecoffeeidDeleteResponses.EndpointResponse delete(DeleteRequest request) throws IOException, InterruptedException, ValidationException, NotImplementedException, ApiException { - return DeleteProvider.delete(request, getApiConfiguration(), getSchemaConfiguration(), getClient()); - } - } - - public interface DeleteCoffeeOperation { - ApiConfiguration getApiConfiguration(); - SchemaConfiguration getSchemaConfiguration(); - HttpClient getClient(); - default FakedeletecoffeeidDeleteResponses.EndpointResponse deleteCoffee(DeleteRequest request) throws IOException, InterruptedException, ValidationException, NotImplementedException, ApiException { - return DeleteProvider.delete(request, getApiConfiguration(), getSchemaConfiguration(), getClient()); - } - } - - public static class Delete extends ApiClient implements DeleteOperation { - public Delete(ApiConfiguration apiConfiguration, SchemaConfiguration schemaConfiguration) { - super(apiConfiguration, schemaConfiguration); - } - } - - public static class DeleteRequest { - public FakedeletecoffeeidDeletePathParameters.PathParametersMap pathParameters; - public RootServerInfo.@Nullable ServerIndex serverIndex; - public @Nullable Duration timeout; - - public DeleteRequest( - FakedeletecoffeeidDeletePathParameters.PathParametersMap pathParameters, - RootServerInfo.@Nullable ServerIndex serverIndex, - @Nullable Duration timeout - ) { - this.pathParameters = pathParameters; - this.serverIndex = serverIndex; - this.timeout = timeout; - } - } - - public static class DeleteNullableRequest { - public FakedeletecoffeeidDeletePathParameters.@Nullable PathParametersMap pathParameters; - public RootServerInfo.@Nullable ServerIndex serverIndex; - public @Nullable Duration timeout; - } - - public interface SetterForServerIndex { - DeleteNullableRequest getInstance(); - T getBuilderAfterServerIndex(DeleteNullableRequest instance); - default T serverIndex(RootServerInfo.ServerIndex serverIndex) { - var instance = getInstance(); - instance.serverIndex = serverIndex; - return getBuilderAfterServerIndex(instance); - } - } - - public interface SetterForTimeout { - DeleteNullableRequest getInstance(); - T getBuilderAfterTimeout(DeleteNullableRequest instance); - default T timeout(Duration timeout) { - var instance = getInstance(); - instance.timeout = timeout; - return getBuilderAfterTimeout(instance); - } - } - - public interface SetterForPathParameters { - DeleteNullableRequest getInstance(); - T getBuilderAfterPathParameters(DeleteNullableRequest instance); - default T pathParameters(FakedeletecoffeeidDeletePathParameters.PathParametersMap pathParameters) { - var instance = getInstance(); - instance.pathParameters = pathParameters; - return getBuilderAfterPathParameters(instance); - } - } - - public static class Delete0RequestBuilder implements SetterForServerIndex, SetterForTimeout { - private final DeleteNullableRequest instance; - - public Delete0RequestBuilder(DeleteNullableRequest instance) { - this.instance = instance; - } - - public DeleteRequest build() { - var pathParameters = instance.pathParameters; - if (pathParameters == null) { - throw new RuntimeException("invalid null value for required parameter"); - } - return new DeleteRequest( - pathParameters, - instance.serverIndex, - instance.timeout - ); - } - - public DeleteNullableRequest getInstance() { - return instance; - } - - public Delete0RequestBuilder getBuilderAfterServerIndex(DeleteNullableRequest instance) { - return this; - } - - public Delete0RequestBuilder getBuilderAfterTimeout(DeleteNullableRequest instance) { - return this; - } - } - public static class DeleteRequestBuilder implements SetterForPathParameters { - private final DeleteNullableRequest instance; - - public DeleteRequestBuilder() { - this.instance = new DeleteNullableRequest(); - } - - public DeleteNullableRequest getInstance() { - return instance; - } - - public Delete0RequestBuilder getBuilderAfterPathParameters(DeleteNullableRequest instance) { - return new Delete0RequestBuilder(instance); - } - } -} diff --git a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/fakedeletecoffeeid/delete/FakedeletecoffeeidDeletePathParameters.kt b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/fakedeletecoffeeid/delete/FakedeletecoffeeidDeletePathParameters.kt deleted file mode 100644 index 5801380e873..00000000000 --- a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/fakedeletecoffeeid/delete/FakedeletecoffeeidDeletePathParameters.kt +++ /dev/null @@ -1,205 +0,0 @@ -package org.openapijsonschematools.client.paths.fakedeletecoffeeid.delete; -import java.util.ArrayList; -import java.util.HashSet; -import java.util.LinkedHashMap; -import java.util.LinkedHashSet; -import java.util.List; -import java.util.Map; -import java.util.Objects; -import java.util.Set; -import org.checkerframework.checker.nullness.qual.Nullable; -import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags; -import org.openapijsonschematools.client.configurations.SchemaConfiguration; -import org.openapijsonschematools.client.exceptions.UnsetPropertyException; -import org.openapijsonschematools.client.exceptions.ValidationException; -import org.openapijsonschematools.client.paths.fakedeletecoffeeid.delete.parameters.parameter0.Schema0; -import org.openapijsonschematools.client.schemas.AnyTypeJsonSchema; -import org.openapijsonschematools.client.schemas.GenericBuilder; -import org.openapijsonschematools.client.schemas.NotAnyTypeJsonSchema; -import org.openapijsonschematools.client.schemas.validation.FrozenMap; -import org.openapijsonschematools.client.schemas.validation.JsonSchema; -import org.openapijsonschematools.client.schemas.validation.JsonSchemaInfo; -import org.openapijsonschematools.client.schemas.validation.MapSchemaValidator; -import org.openapijsonschematools.client.schemas.validation.MapUtils; -import org.openapijsonschematools.client.schemas.validation.PathToSchemasMap; -import org.openapijsonschematools.client.schemas.validation.PropertyEntry; -import org.openapijsonschematools.client.schemas.validation.ValidationMetadata; - -public class FakedeletecoffeeidDeletePathParameters { - // nest classes so all schemas and input/output classes can be public - - - public static class AdditionalProperties extends NotAnyTypeJsonSchema.NotAnyTypeJsonSchema1 { - // NotAnyTypeSchema - private static @Nullable AdditionalProperties instance = null; - public static AdditionalProperties getInstance() { - if (instance == null) { - instance = new AdditionalProperties(); - } - return instance; - } - } - - - public static class PathParametersMap extends FrozenMap { - protected PathParametersMap(FrozenMap m) { - super(m); - } - public static final Set requiredKeys = Set.of( - "id" - ); - public static final Set optionalKeys = Set.of(); - public static PathParametersMap of(Map arg, SchemaConfiguration configuration) throws ValidationException { - return FakedeletecoffeeidDeletePathParameters1.getInstance().validate(arg, configuration); - } - - public String id() { - try { - return getOrThrow("version"); - } catch (UnsetPropertyException e) { - throw new RuntimeException(e); - } - } - } - - public interface SetterForId { - Map getInstance(); - T getBuilderAfterId(Map instance); - - default T id(String value) { - var instance = getInstance(); - instance.put("id", value); - return getBuilderAfterId(instance); - } - } - - public static class PathParametersMap0Builder implements GenericBuilder> { - private final Map instance; - private static final Set knownKeys = Set.of( - "id" - ); - public Set getKnownKeys() { - return knownKeys; - } - public PathParametersMap0Builder(Map instance) { - this.instance = instance; - } - public Map build() { - return instance; - } - } - - public static class PathParametersMapBuilder implements SetterForId { - private final Map instance; - public PathParametersMapBuilder() { - this.instance = new LinkedHashMap<>(); - } - public Map getInstance() { - return instance; - } - public PathParametersMap0Builder getBuilderAfterId(Map instance) { - return new PathParametersMap0Builder(instance); - } - } - - - public sealed interface FakedeletecoffeeidDeletePathParameters1Boxed permits FakedeletecoffeeidDeletePathParameters1BoxedMap { - @Nullable Object getData(); - } - - public record FakedeletecoffeeidDeletePathParameters1BoxedMap(PathParametersMap data) implements FakedeletecoffeeidDeletePathParameters1Boxed { - @Override - public @Nullable Object getData() { - return data; - } - } - - - public static class FakedeletecoffeeidDeletePathParameters1 extends JsonSchema implements MapSchemaValidator { - private static @Nullable FakedeletecoffeeidDeletePathParameters1 instance = null; - - protected FakedeletecoffeeidDeletePathParameters1() { - super(new JsonSchemaInfo() - .type(Set.of(Map.class)) - .properties(Map.ofEntries( - new PropertyEntry("id", Schema0.Schema01.class) - )) - .required(Set.of( - "id" - )) - .additionalProperties(AdditionalProperties.class) - ); - } - - public static FakedeletecoffeeidDeletePathParameters1 getInstance() { - if (instance == null) { - instance = new FakedeletecoffeeidDeletePathParameters1(); - } - return instance; - } - - 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 RuntimeException("Invalid non-string key value"); - } - String propertyName = (String) entryKey; - List propertyPathToItem = new ArrayList<>(pathToItem); - propertyPathToItem.add(propertyName); - Object value = entry.getValue(); - LinkedHashMap, Nothing?> schemas = pathToSchemas.get(propertyPathToItem); - if (schemas == null) { - throw new RuntimeException("Validation 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"); - } - properties.put(propertyName, (String) propertyInstance); - } - FrozenMap castProperties = new FrozenMap<>(properties); - return new PathParametersMap(castProperties); - } - - 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); - SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().build())); - ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, new PathToSchemasMap(), new LinkedHashSet<>()); - PathToSchemasMap pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet); - return getNewInstance(castArg, validationMetadata.pathToItem(), pathToSchemasMap); - } - - - @Override - public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws 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"); - } - @Override - public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { - if (arg instanceof Map) { - return getNewInstance((Map) arg, pathToItem, pathToSchemas); - } - throw new RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); - } - @Override - public FakedeletecoffeeidDeletePathParameters1BoxedMap validateAndBox(Map arg, SchemaConfiguration configuration) throws ValidationException { - return new FakedeletecoffeeidDeletePathParameters1BoxedMap(validate(arg, configuration)); - } - @Override - public FakedeletecoffeeidDeletePathParameters1Boxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { - 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"); - } - } - -} diff --git a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/fakedeletecoffeeid/delete/FakedeletecoffeeidDeleteResponses.kt b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/fakedeletecoffeeid/delete/FakedeletecoffeeidDeleteResponses.kt deleted file mode 100644 index 846100a92f2..00000000000 --- a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/fakedeletecoffeeid/delete/FakedeletecoffeeidDeleteResponses.kt +++ /dev/null @@ -1,61 +0,0 @@ -package org.openapijsonschematools.client.paths.fakedeletecoffeeid.delete; - -import org.openapijsonschematools.client.paths.fakedeletecoffeeid.delete.responses.FakedeletecoffeeidDeleteCode200Response; -import org.openapijsonschematools.client.paths.fakedeletecoffeeid.delete.responses.FakedeletecoffeeidDeleteCodedefaultResponse; -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; -import org.checkerframework.checker.nullness.qual.Nullable; - -import java.net.http.HttpResponse; -import java.util.Map; -import java.util.AbstractMap; - -public class FakedeletecoffeeidDeleteResponses { - public sealed interface EndpointResponse permits EndpointFakedeletecoffeeidDeleteCode200Response, EndpointFakedeletecoffeeidDeleteCodedefaultResponse {} - - public record EndpointFakedeletecoffeeidDeleteCode200Response( - HttpResponse response, - Nothing? body, - Nothing? headers - ) implements EndpointResponse, ApiResponse{ - } - - public record EndpointFakedeletecoffeeidDeleteCodedefaultResponse( - HttpResponse response, - Nothing? body, - Nothing? headers - ) implements EndpointResponse, ApiResponse{ - } - - public sealed interface StatusCodeResponseDeserializer permits StatusFakedeletecoffeeidDeleteCode200ResponseDeserializer {} - - public static final class StatusFakedeletecoffeeidDeleteCode200ResponseDeserializer extends FakedeletecoffeeidDeleteCode200Response.FakedeletecoffeeidDeleteCode200Response1 implements StatusCodeResponseDeserializer { - } - - public static final class FakedeletecoffeeidDeleteResponses1 implements ResponsesDeserializer { - private final Map statusCodeToResponseDeserializer; - private final FakedeletecoffeeidDeleteCodedefaultResponse.FakedeletecoffeeidDeleteCodedefaultResponse1 defaultResponseDeserializer; - public FakedeletecoffeeidDeleteResponses1() { - this.statusCodeToResponseDeserializer = Map.ofEntries( - new AbstractMap.SimpleEntry<>("200", new StatusFakedeletecoffeeidDeleteCode200ResponseDeserializer()) - ); - this.defaultResponseDeserializer = new FakedeletecoffeeidDeleteCodedefaultResponse.FakedeletecoffeeidDeleteCodedefaultResponse1(); - } - - 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) { - StatusFakedeletecoffeeidDeleteCode200ResponseDeserializer castDeserializer = (StatusFakedeletecoffeeidDeleteCode200ResponseDeserializer) statusCodeDeserializer; - var deserializedResponse = castDeserializer.deserialize(response, configuration); - return new EndpointFakedeletecoffeeidDeleteCode200Response(response, deserializedResponse.body(), deserializedResponse.headers()); - } - var deserializedResponse = defaultResponseDeserializer.deserialize(response, configuration); - return new EndpointFakedeletecoffeeidDeleteCodedefaultResponse(response, deserializedResponse.body(), deserializedResponse.headers()); - } - } -} diff --git a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/fakedeletecoffeeid/delete/Parameters.kt b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/fakedeletecoffeeid/delete/Parameters.kt deleted file mode 100644 index 6e068eebfbc..00000000000 --- a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/fakedeletecoffeeid/delete/Parameters.kt +++ /dev/null @@ -1,20 +0,0 @@ -package org.openapijsonschematools.client.paths.fakedeletecoffeeid.delete; - -import org.openapijsonschematools.client.paths.fakedeletecoffeeid.delete.parameters.Parameter0; -import org.openapijsonschematools.client.parameter.PathSerializer; - -import java.util.Map; -import java.util.AbstractMap; - -public class Parameters { - - public static class PathParametersSerializer extends PathSerializer { - public PathParametersSerializer() { - super( - Map.ofEntries( - new AbstractMap.SimpleEntry<>("id", new Parameter0.Parameter01()) - ) - ); - } - } -} diff --git a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/fakedeletecoffeeid/delete/parameters/Parameter0.kt b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/fakedeletecoffeeid/delete/parameters/Parameter0.kt deleted file mode 100644 index d16f6b00036..00000000000 --- a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/fakedeletecoffeeid/delete/parameters/Parameter0.kt +++ /dev/null @@ -1,23 +0,0 @@ -package org.openapijsonschematools.client.paths.fakedeletecoffeeid.delete.parameters; - -import org.openapijsonschematools.client.parameter.ParameterStyle; -import org.openapijsonschematools.client.parameter.ParameterInType; -import org.openapijsonschematools.client.parameter.SchemaParameter; -import org.openapijsonschematools.client.paths.fakedeletecoffeeid.delete.parameters.parameter0.Schema0; - -public class Parameter0 { - - public static class Parameter01 extends SchemaParameter { - public Parameter01() { - super( - "id", - ParameterInType.PATH, - true, - ParameterStyle.SIMPLE, - false, - false, - Schema0.Schema01.getInstance() - ); - } - } -} diff --git a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/fakedeletecoffeeid/delete/parameters/parameter0/Schema0.kt b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/fakedeletecoffeeid/delete/parameters/parameter0/Schema0.kt deleted file mode 100644 index 587228fa824..00000000000 --- a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/fakedeletecoffeeid/delete/parameters/parameter0/Schema0.kt +++ /dev/null @@ -1,19 +0,0 @@ -package org.openapijsonschematools.client.paths.fakedeletecoffeeid.delete.parameters.parameter0; -import org.checkerframework.checker.nullness.qual.Nullable; -import org.openapijsonschematools.client.schemas.StringJsonSchema; - -public class Schema0 extends StringJsonSchema { - // nest classes so all schemas and input/output classes can be public - - - public static class Schema01 extends StringJsonSchema.StringJsonSchema1 { - private static @Nullable Schema01 instance = null; - public static Schema01 getInstance() { - if (instance == null) { - instance = new Schema01(); - } - return instance; - } - } - -} diff --git a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/fakedeletecoffeeid/delete/responses/FakedeletecoffeeidDeleteCode200Response.kt b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/fakedeletecoffeeid/delete/responses/FakedeletecoffeeidDeleteCode200Response.kt deleted file mode 100644 index 56f5f4b8774..00000000000 --- a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/fakedeletecoffeeid/delete/responses/FakedeletecoffeeidDeleteCode200Response.kt +++ /dev/null @@ -1,7 +0,0 @@ -package org.openapijsonschematools.client.paths.fakedeletecoffeeid.delete.responses; - -import org.openapijsonschematools.client.components.responses.SuccessDescriptionOnly; - -public class FakedeletecoffeeidDeleteCode200Response extends SuccessDescriptionOnly { - public static class FakedeletecoffeeidDeleteCode200Response1 extends SuccessDescriptionOnly1 {} -} diff --git a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/fakedeletecoffeeid/delete/responses/FakedeletecoffeeidDeleteCodedefaultResponse.kt b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/fakedeletecoffeeid/delete/responses/FakedeletecoffeeidDeleteCodedefaultResponse.kt deleted file mode 100644 index 8ef0d71e55e..00000000000 --- a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/fakedeletecoffeeid/delete/responses/FakedeletecoffeeidDeleteCodedefaultResponse.kt +++ /dev/null @@ -1,45 +0,0 @@ -package org.openapijsonschematools.client.paths.fakedeletecoffeeid.delete.responses; - -import org.openapijsonschematools.client.configurations.SchemaConfiguration; -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; -import java.net.http.HttpResponse; -import java.net.http.HttpHeaders; - -public class FakedeletecoffeeidDeleteCodedefaultResponse { - - public static class FakedeletecoffeeidDeleteCodedefaultResponse1 extends ResponseDeserializer { - public FakedeletecoffeeidDeleteCodedefaultResponse1() { - super( - MapUtils.makeMap( - ) - ); - } - - @Override - protected Nothing? getBody(String contentType, Nothing? mediaType, byte[] body, SchemaConfiguration configuration) { - return null; - } - - @Override - protected Nothing? getHeaders(HttpHeaders headers, SchemaConfiguration configuration) { - return null; - } - } - - @SuppressWarnings("serial") - public static class ResponseApiException extends ApiException { - public DeserializedHttpResponse deserializedResponse; - - public ResponseApiException(String s, HttpResponse response, DeserializedHttpResponse deserializedResponse) { - super(s, response); - this.deserializedResponse = deserializedResponse; - } - } -} diff --git a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/fakehealth/FakehealthGet.kt b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/fakehealth/FakehealthGet.kt deleted file mode 100644 index 49b0d51d461..00000000000 --- a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/fakehealth/FakehealthGet.kt +++ /dev/null @@ -1,124 +0,0 @@ -package org.openapijsonschematools.client.paths.fakehealth; - -import org.checkerframework.checker.nullness.qual.Nullable; -import org.openapijsonschematools.client.RootServerInfo; -import org.openapijsonschematools.client.paths.fakehealth.get.FakehealthGetResponses; -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.paths.Fakehealth; - -import java.io.IOException; -import java.net.http.HttpClient; -import java.net.http.HttpRequest; -import java.time.Duration; -import java.util.List; -import java.util.Map; - -public class FakehealthGet { - private static class GetProvider { - private static final String method = "get"; - - public static FakehealthGetResponses.EndpointResponse get( - GetRequest request, - ApiConfiguration apiConfiguration, - SchemaConfiguration schemaConfiguration, - HttpClient client - ) 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 - @Nullable Map queryMap = null; - String host = apiConfiguration.getServer(request.serverIndex).url(); - - String url = host + Fakehealth.path; - var httpRequest = RestClient.getRequest( - url, - method, - bodyPublisher, - headers, - request.timeout - ); - var response = RestClient.getResponse(httpRequest, client); - var responsesDeserializer = new FakehealthGetResponses.FakehealthGetResponses1(); - return responsesDeserializer.deserialize(response, schemaConfiguration); - } - } - - public interface GetOperation { - ApiConfiguration getApiConfiguration(); - SchemaConfiguration getSchemaConfiguration(); - HttpClient getClient(); - default FakehealthGetResponses.EndpointResponse get(GetRequest request) throws IOException, InterruptedException, ValidationException, NotImplementedException, ApiException { - return GetProvider.get(request, getApiConfiguration(), getSchemaConfiguration(), getClient()); - } - } - - public interface FakeHealthGetOperation { - ApiConfiguration getApiConfiguration(); - SchemaConfiguration getSchemaConfiguration(); - HttpClient getClient(); - default FakehealthGetResponses.EndpointResponse fakeHealthGet(GetRequest request) throws IOException, InterruptedException, ValidationException, NotImplementedException, ApiException { - return GetProvider.get(request, getApiConfiguration(), getSchemaConfiguration(), getClient()); - } - } - - public static class Get extends ApiClient implements GetOperation { - public Get(ApiConfiguration apiConfiguration, SchemaConfiguration schemaConfiguration) { - super(apiConfiguration, schemaConfiguration); - } - } - - public static class GetRequest { - public RootServerInfo.@Nullable ServerIndex serverIndex; - public @Nullable Duration timeout; - } - - public interface SetterForServerIndex { - GetRequest getInstance(); - T getBuilderAfterServerIndex(GetRequest instance); - default T serverIndex(RootServerInfo.ServerIndex serverIndex) { - var instance = getInstance(); - instance.serverIndex = serverIndex; - return getBuilderAfterServerIndex(instance); - } - } - - public interface SetterForTimeout { - GetRequest getInstance(); - T getBuilderAfterTimeout(GetRequest instance); - default T timeout(Duration timeout) { - var instance = getInstance(); - instance.timeout = timeout; - return getBuilderAfterTimeout(instance); - } - } - - public static class GetRequestBuilder implements SetterForServerIndex, SetterForTimeout { - private final GetRequest instance; - - public GetRequestBuilder() { - this.instance = new GetRequest(); - } - - public GetRequest build() { - return instance; - } - - public GetRequest getInstance() { - return instance; - } - - public GetRequestBuilder getBuilderAfterServerIndex(GetRequest instance) { - return this; - } - - public GetRequestBuilder getBuilderAfterTimeout(GetRequest instance) { - return this; - } - } -} diff --git a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/fakehealth/get/FakehealthGetResponses.kt b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/fakehealth/get/FakehealthGetResponses.kt deleted file mode 100644 index 2b0fdb8c86e..00000000000 --- a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/fakehealth/get/FakehealthGetResponses.kt +++ /dev/null @@ -1,53 +0,0 @@ -package org.openapijsonschematools.client.paths.fakehealth.get; - -import org.openapijsonschematools.client.paths.fakehealth.get.responses.FakehealthGetCode200Response; -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; -import org.checkerframework.checker.nullness.qual.Nullable; - -import java.net.http.HttpResponse; -import java.util.Map; -import java.util.AbstractMap; - -public class FakehealthGetResponses { - public sealed interface EndpointResponse permits EndpointFakehealthGetCode200Response {} - - public record EndpointFakehealthGetCode200Response( - HttpResponse response, - FakehealthGetCode200Response.SealedResponseBody body, - Nothing? headers - ) implements EndpointResponse, ApiResponse{ - } - - public sealed interface StatusCodeResponseDeserializer permits StatusFakehealthGetCode200ResponseDeserializer {} - - public static final class StatusFakehealthGetCode200ResponseDeserializer extends FakehealthGetCode200Response.FakehealthGetCode200Response1 implements StatusCodeResponseDeserializer { - } - - public static final class FakehealthGetResponses1 implements ResponsesDeserializer { - private final Map statusCodeToResponseDeserializer; - public FakehealthGetResponses1() { - this.statusCodeToResponseDeserializer = Map.ofEntries( - new AbstractMap.SimpleEntry<>("200", new StatusFakehealthGetCode200ResponseDeserializer()) - ); - } - - 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) { - throw new ApiException( - "Invalid response statusCode="+statusCode+" has no response defined in the openapi document", - response - ); - } - StatusFakehealthGetCode200ResponseDeserializer castDeserializer = (StatusFakehealthGetCode200ResponseDeserializer) statusCodeDeserializer; - var deserializedResponse = castDeserializer.deserialize(response, configuration); - return new EndpointFakehealthGetCode200Response(response, deserializedResponse.body(), deserializedResponse.headers()); - } - } -} diff --git a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/fakehealth/get/responses/FakehealthGetCode200Response.kt b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/fakehealth/get/responses/FakehealthGetCode200Response.kt deleted file mode 100644 index e497c5f845a..00000000000 --- a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/fakehealth/get/responses/FakehealthGetCode200Response.kt +++ /dev/null @@ -1,63 +0,0 @@ -package org.openapijsonschematools.client.paths.fakehealth.get.responses; - -import org.openapijsonschematools.client.configurations.SchemaConfiguration; -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; - -import java.util.AbstractMap; -import java.util.Map; -import java.net.http.HttpResponse; -import java.net.http.HttpHeaders; - -public class FakehealthGetCode200Response { - public sealed interface SealedMediaType permits ApplicationjsonMediaType {} - - public record ApplicationjsonMediaType(ApplicationjsonSchema.ApplicationjsonSchema1 schema) implements SealedMediaType, MediaType { - public ApplicationjsonMediaType() { - this(ApplicationjsonSchema.ApplicationjsonSchema1.getInstance()); - } - @Override - public Nothing? encoding() { - return null; - } - } - public sealed interface SealedResponseBody permits ApplicationjsonResponseBody {} - public record ApplicationjsonResponseBody(ApplicationjsonSchema.HealthCheckResult1Boxed body) implements SealedResponseBody { } - - public static class FakehealthGetCode200Response1 extends ResponseDeserializer { - public FakehealthGetCode200Response1() { - super( - Map.ofEntries( - new AbstractMap.SimpleEntry<>("application/json", new ApplicationjsonMediaType()) - ) - ); - } - - @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); - } - - @Override - protected Nothing? getHeaders(HttpHeaders headers, SchemaConfiguration configuration) { - return null; - } - } - - @SuppressWarnings("serial") - public static class ResponseApiException extends ApiException { - public DeserializedHttpResponse deserializedResponse; - - public ResponseApiException(String s, HttpResponse response, DeserializedHttpResponse deserializedResponse) { - super(s, response); - this.deserializedResponse = deserializedResponse; - } - } -} diff --git a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/fakehealth/get/responses/code200response/content/applicationjson/ApplicationjsonSchema.kt b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/fakehealth/get/responses/code200response/content/applicationjson/ApplicationjsonSchema.kt deleted file mode 100644 index e9d84e9a57a..00000000000 --- a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/fakehealth/get/responses/code200response/content/applicationjson/ApplicationjsonSchema.kt +++ /dev/null @@ -1,19 +0,0 @@ -package org.openapijsonschematools.client.paths.fakehealth.get.responses.code200response.content.applicationjson; - -import org.checkerframework.checker.nullness.qual.Nullable; -import org.openapijsonschematools.client.components.schemas.HealthCheckResult; - -public class ApplicationjsonSchema extends HealthCheckResult { - // $refed class - - - public static class ApplicationjsonSchema1 extends HealthCheckResult1 { - private static @Nullable ApplicationjsonSchema1 instance = null; - public static ApplicationjsonSchema1 getInstance() { - if (instance == null) { - instance = new ApplicationjsonSchema1(); - } - return instance; - } - } -} diff --git a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/fakeinlineadditionalproperties/FakeinlineadditionalpropertiesPost.kt b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/fakeinlineadditionalproperties/FakeinlineadditionalpropertiesPost.kt deleted file mode 100644 index 9eaf3f07fe2..00000000000 --- a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/fakeinlineadditionalproperties/FakeinlineadditionalpropertiesPost.kt +++ /dev/null @@ -1,183 +0,0 @@ -package org.openapijsonschematools.client.paths.fakeinlineadditionalproperties; - -import org.checkerframework.checker.nullness.qual.Nullable; -import org.openapijsonschematools.client.RootServerInfo; -import org.openapijsonschematools.client.paths.fakeinlineadditionalproperties.post.FakeinlineadditionalpropertiesPostRequestBody; -import org.openapijsonschematools.client.paths.fakeinlineadditionalproperties.post.FakeinlineadditionalpropertiesPostResponses; -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.requestbody.SerializedRequestBody; -import org.openapijsonschematools.client.paths.Fakeinlineadditionalproperties; - -import java.io.IOException; -import java.util.ArrayList; -import java.net.http.HttpClient; -import java.net.http.HttpRequest; -import java.time.Duration; -import java.util.List; -import java.util.Map; - -public class FakeinlineadditionalpropertiesPost { - private static class PostProvider { - private static final String method = "post"; - - public static FakeinlineadditionalpropertiesPostResponses.EndpointResponse post( - PostRequest request, - ApiConfiguration apiConfiguration, - SchemaConfiguration schemaConfiguration, - HttpClient client - ) throws IOException, InterruptedException, ValidationException, NotImplementedException, ApiException { - Map> headers = apiConfiguration.getDefaultHeaders(); - - SerializedRequestBody serializedRequestBody = new FakeinlineadditionalpropertiesPostRequestBody.FakeinlineadditionalpropertiesPostRequestBody1().serialize( - request.requestBody - ); - var contentTypeHeaderValues = headers.getOrDefault("Content-Type", new ArrayList<>()); - contentTypeHeaderValues.add(serializedRequestBody.contentType); - HttpRequest.BodyPublisher bodyPublisher = serializedRequestBody.bodyPublisher; - // TODO set this to a map if there is a query security scheme - @Nullable Map queryMap = null; - String host = apiConfiguration.getServer(request.serverIndex).url(); - - String url = host + Fakeinlineadditionalproperties.path; - var httpRequest = RestClient.getRequest( - url, - method, - bodyPublisher, - headers, - request.timeout - ); - var response = RestClient.getResponse(httpRequest, client); - var responsesDeserializer = new FakeinlineadditionalpropertiesPostResponses.FakeinlineadditionalpropertiesPostResponses1(); - return responsesDeserializer.deserialize(response, schemaConfiguration); - } - } - - public interface PostOperation { - ApiConfiguration getApiConfiguration(); - SchemaConfiguration getSchemaConfiguration(); - HttpClient getClient(); - default FakeinlineadditionalpropertiesPostResponses.EndpointResponse post(PostRequest request) throws IOException, InterruptedException, ValidationException, NotImplementedException, ApiException { - return PostProvider.post(request, getApiConfiguration(), getSchemaConfiguration(), getClient()); - } - } - - public interface InlineAdditionalPropertiesOperation { - ApiConfiguration getApiConfiguration(); - SchemaConfiguration getSchemaConfiguration(); - HttpClient getClient(); - default FakeinlineadditionalpropertiesPostResponses.EndpointResponse inlineAdditionalProperties(PostRequest request) throws IOException, InterruptedException, ValidationException, NotImplementedException, ApiException { - return PostProvider.post(request, getApiConfiguration(), getSchemaConfiguration(), getClient()); - } - } - - public static class Post extends ApiClient implements PostOperation { - public Post(ApiConfiguration apiConfiguration, SchemaConfiguration schemaConfiguration) { - super(apiConfiguration, schemaConfiguration); - } - } - - public static class PostRequest { - public FakeinlineadditionalpropertiesPostRequestBody.SealedRequestBody requestBody; - public RootServerInfo.@Nullable ServerIndex serverIndex; - public @Nullable Duration timeout; - - public PostRequest( - FakeinlineadditionalpropertiesPostRequestBody.SealedRequestBody requestBody, - RootServerInfo.@Nullable ServerIndex serverIndex, - @Nullable Duration timeout - ) { - this.requestBody = requestBody; - this.serverIndex = serverIndex; - this.timeout = timeout; - } - } - - public static class PostNullableRequest { - public FakeinlineadditionalpropertiesPostRequestBody.@Nullable SealedRequestBody requestBody; - public RootServerInfo.@Nullable ServerIndex serverIndex; - public @Nullable Duration timeout; - } - - public interface SetterForServerIndex { - PostNullableRequest getInstance(); - T getBuilderAfterServerIndex(PostNullableRequest instance); - default T serverIndex(RootServerInfo.ServerIndex serverIndex) { - var instance = getInstance(); - instance.serverIndex = serverIndex; - return getBuilderAfterServerIndex(instance); - } - } - - public interface SetterForTimeout { - PostNullableRequest getInstance(); - T getBuilderAfterTimeout(PostNullableRequest instance); - default T timeout(Duration timeout) { - var instance = getInstance(); - instance.timeout = timeout; - return getBuilderAfterTimeout(instance); - } - } - - public interface SetterForRequestBody { - PostNullableRequest getInstance(); - T getBuilderAfterRequestBody(PostNullableRequest instance); - default T requestBody(FakeinlineadditionalpropertiesPostRequestBody.SealedRequestBody requestBody) { - var instance = getInstance(); - instance.requestBody = requestBody; - return getBuilderAfterRequestBody(instance); - } - } - - public static class Post0RequestBuilder implements SetterForServerIndex, SetterForTimeout { - private final PostNullableRequest instance; - - public Post0RequestBuilder(PostNullableRequest instance) { - this.instance = instance; - } - - public PostRequest build() { - var requestBody = instance.requestBody; - if (requestBody == null) { - throw new RuntimeException("invalid null value for required parameter"); - } - return new PostRequest( - requestBody, - instance.serverIndex, - instance.timeout - ); - } - - public PostNullableRequest getInstance() { - return instance; - } - - public Post0RequestBuilder getBuilderAfterServerIndex(PostNullableRequest instance) { - return this; - } - - public Post0RequestBuilder getBuilderAfterTimeout(PostNullableRequest instance) { - return this; - } - } - public static class PostRequestBuilder implements SetterForRequestBody { - private final PostNullableRequest instance; - - public PostRequestBuilder() { - this.instance = new PostNullableRequest(); - } - - public PostNullableRequest getInstance() { - return instance; - } - - public Post0RequestBuilder getBuilderAfterRequestBody(PostNullableRequest instance) { - return new Post0RequestBuilder(instance); - } - } -} diff --git a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/fakeinlineadditionalproperties/post/FakeinlineadditionalpropertiesPostRequestBody.kt b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/fakeinlineadditionalproperties/post/FakeinlineadditionalpropertiesPostRequestBody.kt deleted file mode 100644 index ca439f264aa..00000000000 --- a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/fakeinlineadditionalproperties/post/FakeinlineadditionalpropertiesPostRequestBody.kt +++ /dev/null @@ -1,49 +0,0 @@ -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; -import org.openapijsonschematools.client.mediatype.MediaType; -import org.openapijsonschematools.client.paths.fakeinlineadditionalproperties.post.requestbody.content.applicationjson.ApplicationjsonSchema; - -import java.util.AbstractMap; -import java.util.Map; - -public class FakeinlineadditionalpropertiesPostRequestBody { - public sealed interface SealedMediaType permits ApplicationjsonMediaType {} - - public record ApplicationjsonMediaType(ApplicationjsonSchema.ApplicationjsonSchema1 schema) implements SealedMediaType, MediaType { - public ApplicationjsonMediaType() { - this(ApplicationjsonSchema.ApplicationjsonSchema1.getInstance()); - } - @Override - public Nothing? encoding() { - return null; - } - } - - public static class FakeinlineadditionalpropertiesPostRequestBody1 extends RequestBodySerializer { - public FakeinlineadditionalpropertiesPostRequestBody1() { - super( - Map.ofEntries( - new AbstractMap.SimpleEntry<>("application/json", new ApplicationjsonMediaType()) - ), - true - ); - } - - public SerializedRequestBody serialize(SealedRequestBody requestBody) throws NotImplementedException { - ApplicationjsonRequestBody requestBody0 = (ApplicationjsonRequestBody) requestBody; - return serialize(requestBody0.contentType(), requestBody0.body().getData()); - } - } - - public sealed interface SealedRequestBody permits ApplicationjsonRequestBody {} - public record ApplicationjsonRequestBody(ApplicationjsonSchema.ApplicationjsonSchema1Boxed body) implements SealedRequestBody, GenericRequestBody { - @Override - public String contentType() { - return "application/json"; - } - } -} diff --git a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/fakeinlineadditionalproperties/post/FakeinlineadditionalpropertiesPostResponses.kt b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/fakeinlineadditionalproperties/post/FakeinlineadditionalpropertiesPostResponses.kt deleted file mode 100644 index 47519601d10..00000000000 --- a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/fakeinlineadditionalproperties/post/FakeinlineadditionalpropertiesPostResponses.kt +++ /dev/null @@ -1,53 +0,0 @@ -package org.openapijsonschematools.client.paths.fakeinlineadditionalproperties.post; - -import org.openapijsonschematools.client.paths.fakeinlineadditionalproperties.post.responses.FakeinlineadditionalpropertiesPostCode200Response; -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; -import org.checkerframework.checker.nullness.qual.Nullable; - -import java.net.http.HttpResponse; -import java.util.Map; -import java.util.AbstractMap; - -public class FakeinlineadditionalpropertiesPostResponses { - public sealed interface EndpointResponse permits EndpointFakeinlineadditionalpropertiesPostCode200Response {} - - public record EndpointFakeinlineadditionalpropertiesPostCode200Response( - HttpResponse response, - Nothing? body, - Nothing? headers - ) implements EndpointResponse, ApiResponse{ - } - - public sealed interface StatusCodeResponseDeserializer permits StatusFakeinlineadditionalpropertiesPostCode200ResponseDeserializer {} - - public static final class StatusFakeinlineadditionalpropertiesPostCode200ResponseDeserializer extends FakeinlineadditionalpropertiesPostCode200Response.FakeinlineadditionalpropertiesPostCode200Response1 implements StatusCodeResponseDeserializer { - } - - public static final class FakeinlineadditionalpropertiesPostResponses1 implements ResponsesDeserializer { - private final Map statusCodeToResponseDeserializer; - public FakeinlineadditionalpropertiesPostResponses1() { - this.statusCodeToResponseDeserializer = Map.ofEntries( - new AbstractMap.SimpleEntry<>("200", new StatusFakeinlineadditionalpropertiesPostCode200ResponseDeserializer()) - ); - } - - 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) { - throw new ApiException( - "Invalid response statusCode="+statusCode+" has no response defined in the openapi document", - response - ); - } - StatusFakeinlineadditionalpropertiesPostCode200ResponseDeserializer castDeserializer = (StatusFakeinlineadditionalpropertiesPostCode200ResponseDeserializer) statusCodeDeserializer; - var deserializedResponse = castDeserializer.deserialize(response, configuration); - return new EndpointFakeinlineadditionalpropertiesPostCode200Response(response, deserializedResponse.body(), deserializedResponse.headers()); - } - } -} diff --git a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/fakeinlineadditionalproperties/post/requestbody/content/applicationjson/ApplicationjsonSchema.kt b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/fakeinlineadditionalproperties/post/requestbody/content/applicationjson/ApplicationjsonSchema.kt deleted file mode 100644 index f4c818afa93..00000000000 --- a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/fakeinlineadditionalproperties/post/requestbody/content/applicationjson/ApplicationjsonSchema.kt +++ /dev/null @@ -1,183 +0,0 @@ -package org.openapijsonschematools.client.paths.fakeinlineadditionalproperties.post.requestbody.content.applicationjson; -import java.util.ArrayList; -import java.util.HashSet; -import java.util.LinkedHashMap; -import java.util.LinkedHashSet; -import java.util.List; -import java.util.Map; -import java.util.Objects; -import java.util.Set; -import org.checkerframework.checker.nullness.qual.Nullable; -import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags; -import org.openapijsonschematools.client.configurations.SchemaConfiguration; -import org.openapijsonschematools.client.exceptions.InvalidAdditionalPropertyException; -import org.openapijsonschematools.client.exceptions.UnsetPropertyException; -import org.openapijsonschematools.client.exceptions.ValidationException; -import org.openapijsonschematools.client.schemas.GenericBuilder; -import org.openapijsonschematools.client.schemas.StringJsonSchema; -import org.openapijsonschematools.client.schemas.validation.FrozenMap; -import org.openapijsonschematools.client.schemas.validation.JsonSchema; -import org.openapijsonschematools.client.schemas.validation.JsonSchemaInfo; -import org.openapijsonschematools.client.schemas.validation.MapSchemaValidator; -import org.openapijsonschematools.client.schemas.validation.MapUtils; -import org.openapijsonschematools.client.schemas.validation.PathToSchemasMap; -import org.openapijsonschematools.client.schemas.validation.ValidationMetadata; - -public class ApplicationjsonSchema { - // nest classes so all schemas and input/output classes can be public - - - public static class ApplicationjsonAdditionalProperties extends StringJsonSchema.StringJsonSchema1 { - private static @Nullable ApplicationjsonAdditionalProperties instance = null; - public static ApplicationjsonAdditionalProperties getInstance() { - if (instance == null) { - instance = new ApplicationjsonAdditionalProperties(); - } - return instance; - } - } - - - public static class ApplicationjsonSchemaMap extends FrozenMap { - protected ApplicationjsonSchemaMap(FrozenMap m) { - super(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 { - return ApplicationjsonSchema1.getInstance().validate(arg, configuration); - } - - public String getAdditionalProperty(String name) throws UnsetPropertyException { - return getOrThrow(name); - } - } - - public interface SetterForApplicationjsonAdditionalProperties { - Set getKnownKeys(); - Map getInstance(); - T getBuilderAfterAdditionalProperty(Map instance); - - default T additionalProperty(String key, String value) throws InvalidAdditionalPropertyException { - MapUtils.throwIfKeyKnown(key, getKnownKeys(), true); - var instance = getInstance(); - instance.put(key, value); - return getBuilderAfterAdditionalProperty(instance); - } - } - - public static class ApplicationjsonSchemaMapBuilder implements GenericBuilder>, SetterForApplicationjsonAdditionalProperties { - private final Map instance; - private static final Set knownKeys = Set.of(); - public Set getKnownKeys() { - return knownKeys; - } - public ApplicationjsonSchemaMapBuilder() { - this.instance = new LinkedHashMap<>(); - } - public Map build() { - return instance; - } - public Map getInstance() { - return instance; - } - public ApplicationjsonSchemaMapBuilder getBuilderAfterAdditionalProperty(Map instance) { - return this; - } - } - - - public sealed interface ApplicationjsonSchema1Boxed permits ApplicationjsonSchema1BoxedMap { - @Nullable Object getData(); - } - - public record ApplicationjsonSchema1BoxedMap(ApplicationjsonSchemaMap data) implements ApplicationjsonSchema1Boxed { - @Override - public @Nullable Object getData() { - return data; - } - } - - - public static class ApplicationjsonSchema1 extends JsonSchema implements MapSchemaValidator { - private static @Nullable ApplicationjsonSchema1 instance = null; - - protected ApplicationjsonSchema1() { - super(new JsonSchemaInfo() - .type(Set.of(Map.class)) - .additionalProperties(ApplicationjsonAdditionalProperties.class) - ); - } - - public static ApplicationjsonSchema1 getInstance() { - if (instance == null) { - instance = new ApplicationjsonSchema1(); - } - return instance; - } - - 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 RuntimeException("Invalid non-string key value"); - } - String propertyName = (String) entryKey; - List propertyPathToItem = new ArrayList<>(pathToItem); - propertyPathToItem.add(propertyName); - Object value = entry.getValue(); - LinkedHashMap, Nothing?> schemas = pathToSchemas.get(propertyPathToItem); - if (schemas == null) { - throw new RuntimeException("Validation 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"); - } - properties.put(propertyName, (String) propertyInstance); - } - FrozenMap castProperties = new FrozenMap<>(properties); - return new ApplicationjsonSchemaMap(castProperties); - } - - 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); - SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().build())); - ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, new PathToSchemasMap(), new LinkedHashSet<>()); - PathToSchemasMap pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet); - return getNewInstance(castArg, validationMetadata.pathToItem(), pathToSchemasMap); - } - - - @Override - public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws 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"); - } - @Override - public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { - if (arg instanceof Map) { - return getNewInstance((Map) arg, pathToItem, pathToSchemas); - } - 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 { - return new ApplicationjsonSchema1BoxedMap(validate(arg, configuration)); - } - @Override - public ApplicationjsonSchema1Boxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { - 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"); - } - } - -} diff --git a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/fakeinlineadditionalproperties/post/responses/FakeinlineadditionalpropertiesPostCode200Response.kt b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/fakeinlineadditionalproperties/post/responses/FakeinlineadditionalpropertiesPostCode200Response.kt deleted file mode 100644 index f3f0c8ae16c..00000000000 --- a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/fakeinlineadditionalproperties/post/responses/FakeinlineadditionalpropertiesPostCode200Response.kt +++ /dev/null @@ -1,7 +0,0 @@ -package org.openapijsonschematools.client.paths.fakeinlineadditionalproperties.post.responses; - -import org.openapijsonschematools.client.components.responses.SuccessDescriptionOnly; - -public class FakeinlineadditionalpropertiesPostCode200Response extends SuccessDescriptionOnly { - public static class FakeinlineadditionalpropertiesPostCode200Response1 extends SuccessDescriptionOnly1 {} -} diff --git a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/fakeinlinecomposition/FakeinlinecompositionPost.kt b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/fakeinlinecomposition/FakeinlinecompositionPost.kt deleted file mode 100644 index 0a51b2c0c01..00000000000 --- a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/fakeinlinecomposition/FakeinlinecompositionPost.kt +++ /dev/null @@ -1,176 +0,0 @@ -package org.openapijsonschematools.client.paths.fakeinlinecomposition; - -import org.checkerframework.checker.nullness.qual.Nullable; -import org.openapijsonschematools.client.paths.fakeinlinecomposition.post.FakeinlinecompositionPostRequestBody; -import org.openapijsonschematools.client.paths.fakeinlinecomposition.post.FakeinlinecompositionPostQueryParameters; -import org.openapijsonschematools.client.RootServerInfo; -import org.openapijsonschematools.client.paths.fakeinlinecomposition.post.Parameters; -import org.openapijsonschematools.client.paths.fakeinlinecomposition.post.FakeinlinecompositionPostResponses; -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.requestbody.SerializedRequestBody; -import org.openapijsonschematools.client.paths.Fakeinlinecomposition; - -import java.io.IOException; -import java.util.ArrayList; -import java.net.http.HttpClient; -import java.net.http.HttpRequest; -import java.time.Duration; -import java.util.List; -import java.util.Map; - -public class FakeinlinecompositionPost { - private static class PostProvider { - private static final String method = "post"; - - public static FakeinlinecompositionPostResponses.EndpointResponse post( - PostRequest request, - ApiConfiguration apiConfiguration, - SchemaConfiguration schemaConfiguration, - HttpClient client - ) throws IOException, InterruptedException, ValidationException, NotImplementedException, ApiException { - Map> headers = apiConfiguration.getDefaultHeaders(); - - @Nullable SerializedRequestBody serializedRequestBody; - HttpRequest.BodyPublisher bodyPublisher = HttpRequest.BodyPublishers.noBody(); - if (request.requestBody != null) { - serializedRequestBody = new FakeinlinecompositionPostRequestBody.FakeinlinecompositionPostRequestBody1().serialize( - request.requestBody - ); - var contentTypeHeaderValues = headers.getOrDefault("Content-Type", new ArrayList<>()); - contentTypeHeaderValues.add(serializedRequestBody.contentType); - bodyPublisher = serializedRequestBody.bodyPublisher; - } - - var querySerializer = new Parameters.QueryParametersSerializer(); - @Nullable Map queryMap = null; - if (request.queryParameters != null) { - queryMap = querySerializer.getQueryMap(request.queryParameters); - } - String host = apiConfiguration.getServer(request.serverIndex).url(); - - String url = host + Fakeinlinecomposition.path; - if (queryMap != null) { - url = url + querySerializer.serialize(queryMap); - } - var httpRequest = RestClient.getRequest( - url, - method, - bodyPublisher, - headers, - request.timeout - ); - var response = RestClient.getResponse(httpRequest, client); - var responsesDeserializer = new FakeinlinecompositionPostResponses.FakeinlinecompositionPostResponses1(); - return responsesDeserializer.deserialize(response, schemaConfiguration); - } - } - - public interface PostOperation { - ApiConfiguration getApiConfiguration(); - SchemaConfiguration getSchemaConfiguration(); - HttpClient getClient(); - default FakeinlinecompositionPostResponses.EndpointResponse post(PostRequest request) throws IOException, InterruptedException, ValidationException, NotImplementedException, ApiException { - return PostProvider.post(request, getApiConfiguration(), getSchemaConfiguration(), getClient()); - } - } - - public interface InlineCompositionOperation { - ApiConfiguration getApiConfiguration(); - SchemaConfiguration getSchemaConfiguration(); - HttpClient getClient(); - default FakeinlinecompositionPostResponses.EndpointResponse inlineComposition(PostRequest request) throws IOException, InterruptedException, ValidationException, NotImplementedException, ApiException { - return PostProvider.post(request, getApiConfiguration(), getSchemaConfiguration(), getClient()); - } - } - - public static class Post extends ApiClient implements PostOperation { - public Post(ApiConfiguration apiConfiguration, SchemaConfiguration schemaConfiguration) { - super(apiConfiguration, schemaConfiguration); - } - } - - public static class PostRequest { - public FakeinlinecompositionPostRequestBody.@Nullable SealedRequestBody requestBody; - public FakeinlinecompositionPostQueryParameters.@Nullable QueryParametersMap queryParameters; - public RootServerInfo.@Nullable ServerIndex serverIndex; - public @Nullable Duration timeout; - } - - public interface SetterForRequestBody { - PostRequest getInstance(); - T getBuilderAfterRequestBody(PostRequest instance); - default T requestBody(FakeinlinecompositionPostRequestBody.SealedRequestBody requestBody) { - var instance = getInstance(); - instance.requestBody = requestBody; - return getBuilderAfterRequestBody(instance); - } - } - - public interface SetterForQueryParameters { - PostRequest getInstance(); - T getBuilderAfterQueryParameters(PostRequest instance); - default T queryParameters(FakeinlinecompositionPostQueryParameters.QueryParametersMap queryParameters) { - var instance = getInstance(); - instance.queryParameters = queryParameters; - return getBuilderAfterQueryParameters(instance); - } - } - - public interface SetterForServerIndex { - PostRequest getInstance(); - T getBuilderAfterServerIndex(PostRequest instance); - default T serverIndex(RootServerInfo.ServerIndex serverIndex) { - var instance = getInstance(); - instance.serverIndex = serverIndex; - return getBuilderAfterServerIndex(instance); - } - } - - public interface SetterForTimeout { - PostRequest getInstance(); - T getBuilderAfterTimeout(PostRequest instance); - default T timeout(Duration timeout) { - var instance = getInstance(); - instance.timeout = timeout; - return getBuilderAfterTimeout(instance); - } - } - - public static class PostRequestBuilder implements SetterForRequestBody, SetterForQueryParameters, SetterForServerIndex, SetterForTimeout { - private final PostRequest instance; - - public PostRequestBuilder() { - this.instance = new PostRequest(); - } - - public PostRequest build() { - return instance; - } - - public PostRequest getInstance() { - return instance; - } - - public PostRequestBuilder getBuilderAfterRequestBody(PostRequest instance) { - return this; - } - - public PostRequestBuilder getBuilderAfterQueryParameters(PostRequest instance) { - return this; - } - - public PostRequestBuilder getBuilderAfterServerIndex(PostRequest instance) { - return this; - } - - public PostRequestBuilder getBuilderAfterTimeout(PostRequest instance) { - return this; - } - } -} diff --git a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/fakeinlinecomposition/post/FakeinlinecompositionPostQueryParameters.kt b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/fakeinlinecomposition/post/FakeinlinecompositionPostQueryParameters.kt deleted file mode 100644 index bc59678ea69..00000000000 --- a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/fakeinlinecomposition/post/FakeinlinecompositionPostQueryParameters.kt +++ /dev/null @@ -1,270 +0,0 @@ -package org.openapijsonschematools.client.paths.fakeinlinecomposition.post; -import java.util.ArrayList; -import java.util.HashSet; -import java.util.LinkedHashMap; -import java.util.LinkedHashSet; -import java.util.List; -import java.util.Map; -import java.util.Objects; -import java.util.Set; -import org.checkerframework.checker.nullness.qual.Nullable; -import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags; -import org.openapijsonschematools.client.configurations.SchemaConfiguration; -import org.openapijsonschematools.client.exceptions.UnsetPropertyException; -import org.openapijsonschematools.client.exceptions.ValidationException; -import org.openapijsonschematools.client.paths.fakeinlinecomposition.post.parameters.parameter0.Schema0; -import org.openapijsonschematools.client.paths.fakeinlinecomposition.post.parameters.parameter1.Schema1; -import org.openapijsonschematools.client.schemas.AnyTypeJsonSchema; -import org.openapijsonschematools.client.schemas.GenericBuilder; -import org.openapijsonschematools.client.schemas.NotAnyTypeJsonSchema; -import org.openapijsonschematools.client.schemas.validation.FrozenMap; -import org.openapijsonschematools.client.schemas.validation.JsonSchema; -import org.openapijsonschematools.client.schemas.validation.JsonSchemaInfo; -import org.openapijsonschematools.client.schemas.validation.MapSchemaValidator; -import org.openapijsonschematools.client.schemas.validation.MapUtils; -import org.openapijsonschematools.client.schemas.validation.PathToSchemasMap; -import org.openapijsonschematools.client.schemas.validation.PropertyEntry; -import org.openapijsonschematools.client.schemas.validation.ValidationMetadata; - -public class FakeinlinecompositionPostQueryParameters { - // nest classes so all schemas and input/output classes can be public - - - public static class AdditionalProperties extends NotAnyTypeJsonSchema.NotAnyTypeJsonSchema1 { - // NotAnyTypeSchema - private static @Nullable AdditionalProperties instance = null; - public static AdditionalProperties getInstance() { - if (instance == null) { - instance = new AdditionalProperties(); - } - return instance; - } - } - - - public static class QueryParametersMap extends FrozenMap<@Nullable Object> { - protected QueryParametersMap(FrozenMap<@Nullable Object> m) { - super(m); - } - public static final Set requiredKeys = Set.of(); - public static final Set optionalKeys = Set.of( - "compositionAtRoot", - "compositionInProperty" - ); - public static QueryParametersMap of(Map arg, SchemaConfiguration configuration) throws ValidationException { - return FakeinlinecompositionPostQueryParameters1.getInstance().validate(arg, configuration); - } - - public @Nullable Object compositionAtRoot() throws UnsetPropertyException { - String key = "compositionAtRoot"; - throwIfKeyNotPresent(key); - @Nullable Object value = get(key); - if (!(value instanceof Object)) { - throw new RuntimeException("Invalid value stored for compositionAtRoot"); - } - return (@Nullable Object) value; - } - - public Schema1.SchemaMap1 compositionInProperty() throws UnsetPropertyException { - String key = "compositionInProperty"; - throwIfKeyNotPresent(key); - @Nullable Object value = get(key); - if (!(value instanceof Schema1.SchemaMap1)) { - throw new RuntimeException("Invalid value stored for compositionInProperty"); - } - return (Schema1.SchemaMap1) value; - } - } - - public interface SetterForCompositionAtRoot { - Map getInstance(); - T getBuilderAfterCompositionAtRoot(Map instance); - - default T compositionAtRoot(Nothing? value) { - var instance = getInstance(); - instance.put("compositionAtRoot", null); - return getBuilderAfterCompositionAtRoot(instance); - } - - default T compositionAtRoot(boolean value) { - var instance = getInstance(); - instance.put("compositionAtRoot", value); - return getBuilderAfterCompositionAtRoot(instance); - } - - default T compositionAtRoot(String value) { - var instance = getInstance(); - instance.put("compositionAtRoot", value); - return getBuilderAfterCompositionAtRoot(instance); - } - - default T compositionAtRoot(int value) { - var instance = getInstance(); - instance.put("compositionAtRoot", value); - return getBuilderAfterCompositionAtRoot(instance); - } - - default T compositionAtRoot(float value) { - var instance = getInstance(); - instance.put("compositionAtRoot", value); - return getBuilderAfterCompositionAtRoot(instance); - } - - default T compositionAtRoot(long value) { - var instance = getInstance(); - instance.put("compositionAtRoot", value); - return getBuilderAfterCompositionAtRoot(instance); - } - - default T compositionAtRoot(double value) { - var instance = getInstance(); - instance.put("compositionAtRoot", value); - return getBuilderAfterCompositionAtRoot(instance); - } - - default T compositionAtRoot(List value) { - var instance = getInstance(); - instance.put("compositionAtRoot", value); - return getBuilderAfterCompositionAtRoot(instance); - } - - default T compositionAtRoot(Map value) { - var instance = getInstance(); - instance.put("compositionAtRoot", value); - return getBuilderAfterCompositionAtRoot(instance); - } - } - - public interface SetterForCompositionInProperty { - Map getInstance(); - T getBuilderAfterCompositionInProperty(Map instance); - - default T compositionInProperty(Map value) { - var instance = getInstance(); - instance.put("compositionInProperty", value); - return getBuilderAfterCompositionInProperty(instance); - } - } - - public static class QueryParametersMapBuilder implements GenericBuilder>, SetterForCompositionAtRoot, SetterForCompositionInProperty { - private final Map instance; - private static final Set knownKeys = Set.of( - "compositionAtRoot", - "compositionInProperty" - ); - public Set getKnownKeys() { - return knownKeys; - } - public QueryParametersMapBuilder() { - this.instance = new LinkedHashMap<>(); - } - public Map build() { - return instance; - } - public Map getInstance() { - return instance; - } - public QueryParametersMapBuilder getBuilderAfterCompositionAtRoot(Map instance) { - return this; - } - public QueryParametersMapBuilder getBuilderAfterCompositionInProperty(Map instance) { - return this; - } - } - - - public sealed interface FakeinlinecompositionPostQueryParameters1Boxed permits FakeinlinecompositionPostQueryParameters1BoxedMap { - @Nullable Object getData(); - } - - public record FakeinlinecompositionPostQueryParameters1BoxedMap(QueryParametersMap data) implements FakeinlinecompositionPostQueryParameters1Boxed { - @Override - public @Nullable Object getData() { - return data; - } - } - - - public static class FakeinlinecompositionPostQueryParameters1 extends JsonSchema implements MapSchemaValidator { - private static @Nullable FakeinlinecompositionPostQueryParameters1 instance = null; - - protected FakeinlinecompositionPostQueryParameters1() { - super(new JsonSchemaInfo() - .type(Set.of(Map.class)) - .properties(Map.ofEntries( - new PropertyEntry("compositionAtRoot", Schema0.Schema01.class), - new PropertyEntry("compositionInProperty", Schema1.Schema11.class) - )) - .additionalProperties(AdditionalProperties.class) - ); - } - - public static FakeinlinecompositionPostQueryParameters1 getInstance() { - if (instance == null) { - instance = new FakeinlinecompositionPostQueryParameters1(); - } - return instance; - } - - 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 RuntimeException("Invalid non-string key value"); - } - String propertyName = (String) entryKey; - List propertyPathToItem = new ArrayList<>(pathToItem); - propertyPathToItem.add(propertyName); - Object value = entry.getValue(); - LinkedHashMap, Nothing?> schemas = pathToSchemas.get(propertyPathToItem); - if (schemas == null) { - throw new RuntimeException("Validation result is invalid, schemas must exist for a pathToItem"); - } - JsonSchema propertySchema = schemas.entrySet().iterator().next().getKey(); - @Nullable Object propertyInstance = propertySchema.getNewInstance(value, propertyPathToItem, pathToSchemas); - properties.put(propertyName, propertyInstance); - } - FrozenMap<@Nullable Object> castProperties = new FrozenMap<>(properties); - return new QueryParametersMap(castProperties); - } - - 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); - SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().build())); - ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, new PathToSchemasMap(), new LinkedHashSet<>()); - PathToSchemasMap pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet); - return getNewInstance(castArg, validationMetadata.pathToItem(), pathToSchemasMap); - } - - - @Override - public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws 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"); - } - @Override - public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { - if (arg instanceof Map) { - return getNewInstance((Map) arg, pathToItem, pathToSchemas); - } - throw new RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); - } - @Override - public FakeinlinecompositionPostQueryParameters1BoxedMap validateAndBox(Map arg, SchemaConfiguration configuration) throws ValidationException { - return new FakeinlinecompositionPostQueryParameters1BoxedMap(validate(arg, configuration)); - } - @Override - public FakeinlinecompositionPostQueryParameters1Boxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { - 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"); - } - } - -} diff --git a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/fakeinlinecomposition/post/FakeinlinecompositionPostRequestBody.kt b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/fakeinlinecomposition/post/FakeinlinecompositionPostRequestBody.kt deleted file mode 100644 index f3aef379fd3..00000000000 --- a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/fakeinlinecomposition/post/FakeinlinecompositionPostRequestBody.kt +++ /dev/null @@ -1,71 +0,0 @@ -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; -import org.openapijsonschematools.client.mediatype.MediaType; -import org.openapijsonschematools.client.paths.fakeinlinecomposition.post.requestbody.content.applicationjson.ApplicationjsonSchema; -import org.openapijsonschematools.client.paths.fakeinlinecomposition.post.requestbody.content.multipartformdata.MultipartformdataSchema; - -import java.util.AbstractMap; -import java.util.Map; - -public class FakeinlinecompositionPostRequestBody { - public sealed interface SealedMediaType permits ApplicationjsonMediaType, MultipartformdataMediaType {} - - public record ApplicationjsonMediaType(ApplicationjsonSchema.ApplicationjsonSchema1 schema) implements SealedMediaType, MediaType { - public ApplicationjsonMediaType() { - this(ApplicationjsonSchema.ApplicationjsonSchema1.getInstance()); - } - @Override - public Nothing? encoding() { - return null; - } - } - - public record MultipartformdataMediaType(MultipartformdataSchema.MultipartformdataSchema1 schema) implements SealedMediaType, MediaType { - public MultipartformdataMediaType() { - this(MultipartformdataSchema.MultipartformdataSchema1.getInstance()); - } - @Override - public Nothing? encoding() { - return null; - } - } - - public static class FakeinlinecompositionPostRequestBody1 extends RequestBodySerializer { - public FakeinlinecompositionPostRequestBody1() { - super( - Map.ofEntries( - new AbstractMap.SimpleEntry<>("application/json", new ApplicationjsonMediaType()), - new AbstractMap.SimpleEntry<>("multipart/form-data", new MultipartformdataMediaType()) - ), - false - ); - } - - public SerializedRequestBody serialize(SealedRequestBody requestBody) throws NotImplementedException { - if (requestBody instanceof ApplicationjsonRequestBody requestBody0) { - return serialize(requestBody0.contentType(), requestBody0.body().getData()); - } else { - MultipartformdataRequestBody requestBody1 = (MultipartformdataRequestBody) requestBody; - return serialize(requestBody1.contentType(), requestBody1.body().getData()); - } - } - } - - public sealed interface SealedRequestBody permits ApplicationjsonRequestBody, MultipartformdataRequestBody {} - public record ApplicationjsonRequestBody(ApplicationjsonSchema.ApplicationjsonSchema1Boxed body) implements SealedRequestBody, GenericRequestBody { - @Override - public String contentType() { - return "application/json"; - } - } - public record MultipartformdataRequestBody(MultipartformdataSchema.MultipartformdataSchema1Boxed body) implements SealedRequestBody, GenericRequestBody { - @Override - public String contentType() { - return "multipart/form-data"; - } - } -} diff --git a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/fakeinlinecomposition/post/FakeinlinecompositionPostResponses.kt b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/fakeinlinecomposition/post/FakeinlinecompositionPostResponses.kt deleted file mode 100644 index 2899ee99c20..00000000000 --- a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/fakeinlinecomposition/post/FakeinlinecompositionPostResponses.kt +++ /dev/null @@ -1,53 +0,0 @@ -package org.openapijsonschematools.client.paths.fakeinlinecomposition.post; - -import org.openapijsonschematools.client.paths.fakeinlinecomposition.post.responses.FakeinlinecompositionPostCode200Response; -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; -import org.checkerframework.checker.nullness.qual.Nullable; - -import java.net.http.HttpResponse; -import java.util.Map; -import java.util.AbstractMap; - -public class FakeinlinecompositionPostResponses { - public sealed interface EndpointResponse permits EndpointFakeinlinecompositionPostCode200Response {} - - public record EndpointFakeinlinecompositionPostCode200Response( - HttpResponse response, - FakeinlinecompositionPostCode200Response.SealedResponseBody body, - Nothing? headers - ) implements EndpointResponse, ApiResponse{ - } - - public sealed interface StatusCodeResponseDeserializer permits StatusFakeinlinecompositionPostCode200ResponseDeserializer {} - - public static final class StatusFakeinlinecompositionPostCode200ResponseDeserializer extends FakeinlinecompositionPostCode200Response.FakeinlinecompositionPostCode200Response1 implements StatusCodeResponseDeserializer { - } - - public static final class FakeinlinecompositionPostResponses1 implements ResponsesDeserializer { - private final Map statusCodeToResponseDeserializer; - public FakeinlinecompositionPostResponses1() { - this.statusCodeToResponseDeserializer = Map.ofEntries( - new AbstractMap.SimpleEntry<>("200", new StatusFakeinlinecompositionPostCode200ResponseDeserializer()) - ); - } - - 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) { - throw new ApiException( - "Invalid response statusCode="+statusCode+" has no response defined in the openapi document", - response - ); - } - StatusFakeinlinecompositionPostCode200ResponseDeserializer castDeserializer = (StatusFakeinlinecompositionPostCode200ResponseDeserializer) statusCodeDeserializer; - var deserializedResponse = castDeserializer.deserialize(response, configuration); - return new EndpointFakeinlinecompositionPostCode200Response(response, deserializedResponse.body(), deserializedResponse.headers()); - } - } -} diff --git a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/fakeinlinecomposition/post/Parameters.kt b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/fakeinlinecomposition/post/Parameters.kt deleted file mode 100644 index 358e05fde21..00000000000 --- a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/fakeinlinecomposition/post/Parameters.kt +++ /dev/null @@ -1,22 +0,0 @@ -package org.openapijsonschematools.client.paths.fakeinlinecomposition.post; - -import org.openapijsonschematools.client.paths.fakeinlinecomposition.post.parameters.Parameter0; -import org.openapijsonschematools.client.paths.fakeinlinecomposition.post.parameters.Parameter1; -import org.openapijsonschematools.client.parameter.QuerySerializer; - -import java.util.Map; -import java.util.AbstractMap; - -public class Parameters { - - public static class QueryParametersSerializer extends QuerySerializer { - public QueryParametersSerializer() { - super( - Map.ofEntries( - new AbstractMap.SimpleEntry<>("compositionAtRoot", new Parameter0.Parameter01()), - new AbstractMap.SimpleEntry<>("compositionInProperty", new Parameter1.Parameter11()) - ) - ); - } - } -} diff --git a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/fakeinlinecomposition/post/parameters/Parameter0.kt b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/fakeinlinecomposition/post/parameters/Parameter0.kt deleted file mode 100644 index 020d186ab95..00000000000 --- a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/fakeinlinecomposition/post/parameters/Parameter0.kt +++ /dev/null @@ -1,23 +0,0 @@ -package org.openapijsonschematools.client.paths.fakeinlinecomposition.post.parameters; - -import org.openapijsonschematools.client.parameter.ParameterStyle; -import org.openapijsonschematools.client.parameter.ParameterInType; -import org.openapijsonschematools.client.parameter.SchemaParameter; -import org.openapijsonschematools.client.paths.fakeinlinecomposition.post.parameters.parameter0.Schema0; - -public class Parameter0 { - - public static class Parameter01 extends SchemaParameter { - public Parameter01() { - super( - "compositionAtRoot", - ParameterInType.QUERY, - false, - ParameterStyle.FORM, - true, - false, - Schema0.Schema01.getInstance() - ); - } - } -} diff --git a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/fakeinlinecomposition/post/parameters/Parameter1.kt b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/fakeinlinecomposition/post/parameters/Parameter1.kt deleted file mode 100644 index 94e5c75ccf6..00000000000 --- a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/fakeinlinecomposition/post/parameters/Parameter1.kt +++ /dev/null @@ -1,23 +0,0 @@ -package org.openapijsonschematools.client.paths.fakeinlinecomposition.post.parameters; - -import org.openapijsonschematools.client.parameter.ParameterStyle; -import org.openapijsonschematools.client.parameter.ParameterInType; -import org.openapijsonschematools.client.parameter.SchemaParameter; -import org.openapijsonschematools.client.paths.fakeinlinecomposition.post.parameters.parameter1.Schema1; - -public class Parameter1 { - - public static class Parameter11 extends SchemaParameter { - public Parameter11() { - super( - "compositionInProperty", - ParameterInType.QUERY, - false, - ParameterStyle.FORM, - true, - false, - Schema1.Schema11.getInstance() - ); - } - } -} diff --git a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/fakeinlinecomposition/post/parameters/parameter0/Schema0.kt b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/fakeinlinecomposition/post/parameters/parameter0/Schema0.kt deleted file mode 100644 index 8655febbd57..00000000000 --- a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/fakeinlinecomposition/post/parameters/parameter0/Schema0.kt +++ /dev/null @@ -1,393 +0,0 @@ -package org.openapijsonschematools.client.paths.fakeinlinecomposition.post.parameters.parameter0; -import java.time.LocalDate; -import java.time.ZonedDateTime; -import java.util.ArrayList; -import java.util.HashSet; -import java.util.LinkedHashMap; -import java.util.LinkedHashSet; -import java.util.List; -import java.util.Map; -import java.util.Objects; -import java.util.Set; -import java.util.UUID; -import org.checkerframework.checker.nullness.qual.Nullable; -import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags; -import org.openapijsonschematools.client.configurations.SchemaConfiguration; -import org.openapijsonschematools.client.exceptions.InvalidAdditionalPropertyException; -import org.openapijsonschematools.client.exceptions.UnsetPropertyException; -import org.openapijsonschematools.client.exceptions.ValidationException; -import org.openapijsonschematools.client.schemas.UnsetAddPropsSetter; -import org.openapijsonschematools.client.schemas.validation.BooleanSchemaValidator; -import org.openapijsonschematools.client.schemas.validation.FrozenList; -import org.openapijsonschematools.client.schemas.validation.FrozenMap; -import org.openapijsonschematools.client.schemas.validation.JsonSchema; -import org.openapijsonschematools.client.schemas.validation.JsonSchemaInfo; -import org.openapijsonschematools.client.schemas.validation.ListSchemaValidator; -import org.openapijsonschematools.client.schemas.validation.MapSchemaValidator; -import org.openapijsonschematools.client.schemas.validation.NullSchemaValidator; -import org.openapijsonschematools.client.schemas.validation.NumberSchemaValidator; -import org.openapijsonschematools.client.schemas.validation.PathToSchemasMap; -import org.openapijsonschematools.client.schemas.validation.StringSchemaValidator; -import org.openapijsonschematools.client.schemas.validation.ValidationMetadata; - -public class Schema0 { - // nest classes so all schemas and input/output classes can be public - - - public sealed interface Schema00Boxed permits Schema00BoxedString { - @Nullable Object getData(); - } - - public record Schema00BoxedString(String data) implements Schema00Boxed { - @Override - public @Nullable Object getData() { - return data; - } - } - - - - public static class Schema00 extends JsonSchema implements StringSchemaValidator { - private static @Nullable Schema00 instance = null; - - protected Schema00() { - super(new JsonSchemaInfo() - .type(Set.of( - String.class - )) - .minLength(1) - ); - } - - public static Schema00 getInstance() { - if (instance == null) { - instance = new Schema00(); - } - return instance; - } - - @Override - public String validate(String arg, SchemaConfiguration configuration) throws ValidationException { - Set> pathSet = new HashSet<>(); - List pathToItem = List.of("args[0"); - String castArg = castToAllowedTypes(arg, pathToItem, pathSet); - SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().build())); - ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, new PathToSchemasMap(), new LinkedHashSet<>()); - getPathToSchemas(this, castArg, validationMetadata, pathSet); - return castArg; - } - - @Override - public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws 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"); - } - @Override - public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { - 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"); - } - @Override - 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 { - 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"); - } - } - - public sealed interface Schema01Boxed permits Schema01BoxedVoid, Schema01BoxedBoolean, Schema01BoxedNumber, Schema01BoxedString, Schema01BoxedList, Schema01BoxedMap { - @Nullable Object getData(); - } - - public record Schema01BoxedVoid(Nothing? data) implements Schema01Boxed { - @Override - public @Nullable Object getData() { - return data; - } - } - - public record Schema01BoxedBoolean(boolean data) implements Schema01Boxed { - @Override - public @Nullable Object getData() { - return data; - } - } - - public record Schema01BoxedNumber(Number data) implements Schema01Boxed { - @Override - public @Nullable Object getData() { - return data; - } - } - - public record Schema01BoxedString(String data) implements Schema01Boxed { - @Override - public @Nullable Object getData() { - return data; - } - } - - public record Schema01BoxedList(FrozenList<@Nullable Object> data) implements Schema01Boxed { - @Override - public @Nullable Object getData() { - return data; - } - } - - public record Schema01BoxedMap(FrozenMap<@Nullable Object> data) implements Schema01Boxed { - @Override - public @Nullable Object getData() { - return data; - } - } - - - public static class Schema01 extends JsonSchema implements NullSchemaValidator, BooleanSchemaValidator, NumberSchemaValidator, StringSchemaValidator, ListSchemaValidator, Schema01BoxedList>, MapSchemaValidator, Schema01BoxedMap> { - private static @Nullable Schema01 instance = null; - - protected Schema01() { - super(new JsonSchemaInfo() - .allOf(List.of( - Schema00.class - )) - ); - } - - public static Schema01 getInstance() { - if (instance == null) { - instance = new Schema01(); - } - return instance; - } - - @Override - public Nothing? validate(Nothing? arg, SchemaConfiguration configuration) throws ValidationException { - Set> pathSet = new HashSet<>(); - List pathToItem = List.of("args[0]"); - Nothing? castArg = castToAllowedTypes(arg, pathToItem, pathSet); - SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().build())); - PathToSchemasMap validatedPathToSchemas = new PathToSchemasMap(); - ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, new LinkedHashSet<>()); - getPathToSchemas(this, castArg, validationMetadata, pathSet); - return castArg; - } - - @Override - public boolean validate(boolean arg, SchemaConfiguration configuration) throws ValidationException { - Set> pathSet = new HashSet<>(); - List pathToItem = List.of("args[0]"); - boolean castArg = castToAllowedTypes(arg, pathToItem, pathSet); - SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().build())); - PathToSchemasMap validatedPathToSchemas = new PathToSchemasMap(); - ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, new LinkedHashSet<>()); - getPathToSchemas(this, castArg, validationMetadata, pathSet); - return castArg; - } - - @Override - public Number validate(Number arg, SchemaConfiguration configuration) throws ValidationException { - Set> pathSet = new HashSet<>(); - List pathToItem = List.of("args[0]"); - Number castArg = castToAllowedTypes(arg, pathToItem, pathSet); - SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().build())); - PathToSchemasMap validatedPathToSchemas = new PathToSchemasMap(); - ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, new LinkedHashSet<>()); - getPathToSchemas(this, castArg, validationMetadata, pathSet); - return castArg; - } - - public int validate(int arg, SchemaConfiguration configuration) throws ValidationException { - return (int) validate((Number) arg, configuration); - } - - public long validate(long arg, SchemaConfiguration configuration) throws ValidationException { - return (long) validate((Number) arg, configuration); - } - - public float validate(float arg, SchemaConfiguration configuration) throws ValidationException { - return (float) validate((Number) arg, configuration); - } - - public double validate(double arg, SchemaConfiguration configuration) throws ValidationException { - return (double) validate((Number) arg, configuration); - } - - @Override - public String validate(String arg, SchemaConfiguration configuration) throws ValidationException { - Set> pathSet = new HashSet<>(); - List pathToItem = List.of("args[0]"); - String castArg = castToAllowedTypes(arg, pathToItem, pathSet); - SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().build())); - PathToSchemasMap validatedPathToSchemas = new PathToSchemasMap(); - ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, new LinkedHashSet<>()); - getPathToSchemas(this, castArg, validationMetadata, pathSet); - return castArg; - } - - public String validate(LocalDate arg, SchemaConfiguration configuration) throws ValidationException { - return validate(arg.toString(), configuration); - } - - public String validate(ZonedDateTime arg, SchemaConfiguration configuration) throws ValidationException { - return validate(arg.toString(), configuration); - } - - public String validate(UUID arg, SchemaConfiguration configuration) throws ValidationException { - return validate(arg.toString(), configuration); - } - - @Override - public FrozenList<@Nullable Object> getNewInstance(List arg, List pathToItem, PathToSchemasMap pathToSchemas) { - List<@Nullable Object> items = new ArrayList<>(); - int i = 0; - for (Object item: arg) { - List itemPathToItem = new ArrayList<>(pathToItem); - itemPathToItem.add(i); - LinkedHashMap, Nothing?> schemas = pathToSchemas.get(itemPathToItem); - if (schemas == null) { - throw new RuntimeException("Validation result is invalid, schemas must exist for a pathToItem"); - } - JsonSchema itemSchema = schemas.entrySet().iterator().next().getKey(); - @Nullable Object itemInstance = itemSchema.getNewInstance(item, itemPathToItem, pathToSchemas); - items.add(itemInstance); - i += 1; - } - FrozenList<@Nullable Object> newInstanceItems = new FrozenList<>(items); - return newInstanceItems; - } - - 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); - SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().build())); - ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, new PathToSchemasMap(), new LinkedHashSet<>()); - PathToSchemasMap pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet); - return getNewInstance(castArg, validationMetadata.pathToItem(), pathToSchemasMap); - } - - @Override - 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 RuntimeException("Invalid non-string key value"); - } - String propertyName = (String) entryKey; - List propertyPathToItem = new ArrayList<>(pathToItem); - propertyPathToItem.add(propertyName); - Object value = entry.getValue(); - LinkedHashMap, Nothing?> schemas = pathToSchemas.get(propertyPathToItem); - if (schemas == null) { - throw new RuntimeException("Validation result is invalid, schemas must exist for a pathToItem"); - } - JsonSchema propertySchema = schemas.entrySet().iterator().next().getKey(); - @Nullable Object propertyInstance = propertySchema.getNewInstance(value, propertyPathToItem, pathToSchemas); - properties.put(propertyName, propertyInstance); - } - FrozenMap<@Nullable Object> castProperties = new FrozenMap<>(properties); - return castProperties; - } - - public FrozenMap<@Nullable Object> validate(Map arg, SchemaConfiguration configuration) throws ValidationException { - Set> pathSet = new HashSet<>(); - List pathToItem = List.of("args[0]"); - Map castArg = castToAllowedTypes(arg, pathToItem, pathSet); - SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().build())); - PathToSchemasMap validatedPathToSchemas = new PathToSchemasMap(); - ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, new LinkedHashSet<>()); - PathToSchemasMap pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet); - return getNewInstance(castArg, validationMetadata.pathToItem(), pathToSchemasMap); - } - - @Override - public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { - if (arg == null) { - return validate((Nothing?) null, configuration); - } else if (arg instanceof Boolean) { - boolean boolArg = (Boolean) arg; - return validate(boolArg, configuration); - } else if (arg instanceof Number) { - return validate((Number) arg, configuration); - } else if (arg instanceof String) { - return validate((String) arg, configuration); - } else if (arg instanceof List) { - return validate((List) arg, 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"); - } - @Override - public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { - if (arg == null) { - return getNewInstance((Nothing?) null, pathToItem, pathToSchemas); - } else if (arg instanceof Boolean) { - boolean boolArg = (Boolean) arg; - return getNewInstance(boolArg, pathToItem, pathToSchemas); - } else if (arg instanceof Number) { - return getNewInstance((Number) arg, pathToItem, pathToSchemas); - } else if (arg instanceof String) { - return getNewInstance((String) arg, pathToItem, pathToSchemas); - } else if (arg instanceof List) { - return getNewInstance((List) arg, 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"); - } - @Override - public Schema01BoxedVoid validateAndBox(Nothing? arg, SchemaConfiguration configuration) throws ValidationException { - return new Schema01BoxedVoid(validate(arg, configuration)); - } - @Override - 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 { - return new Schema01BoxedNumber(validate(arg, configuration)); - } - @Override - 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 { - return new Schema01BoxedList(validate(arg, configuration)); - } - @Override - 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 { - if (arg == null) { - Nothing? castArg = (Nothing?) arg; - return validateAndBox(castArg, configuration); - } else if (arg instanceof Boolean booleanArg) { - boolean castArg = booleanArg; - return validateAndBox(castArg, configuration); - } else if (arg instanceof String castArg) { - return validateAndBox(castArg, configuration); - } else if (arg instanceof Number castArg) { - return validateAndBox(castArg, configuration); - } else if (arg instanceof List castArg) { - 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"); - } - } -} diff --git a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/fakeinlinecomposition/post/parameters/parameter1/Schema1.kt b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/fakeinlinecomposition/post/parameters/parameter1/Schema1.kt deleted file mode 100644 index be97d1c22f3..00000000000 --- a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/fakeinlinecomposition/post/parameters/parameter1/Schema1.kt +++ /dev/null @@ -1,596 +0,0 @@ -package org.openapijsonschematools.client.paths.fakeinlinecomposition.post.parameters.parameter1; -import java.time.LocalDate; -import java.time.ZonedDateTime; -import java.util.ArrayList; -import java.util.HashSet; -import java.util.LinkedHashMap; -import java.util.LinkedHashSet; -import java.util.List; -import java.util.Map; -import java.util.Objects; -import java.util.Set; -import java.util.UUID; -import org.checkerframework.checker.nullness.qual.Nullable; -import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags; -import org.openapijsonschematools.client.configurations.SchemaConfiguration; -import org.openapijsonschematools.client.exceptions.InvalidAdditionalPropertyException; -import org.openapijsonschematools.client.exceptions.UnsetPropertyException; -import org.openapijsonschematools.client.exceptions.ValidationException; -import org.openapijsonschematools.client.schemas.GenericBuilder; -import org.openapijsonschematools.client.schemas.UnsetAddPropsSetter; -import org.openapijsonschematools.client.schemas.validation.BooleanSchemaValidator; -import org.openapijsonschematools.client.schemas.validation.FrozenList; -import org.openapijsonschematools.client.schemas.validation.FrozenMap; -import org.openapijsonschematools.client.schemas.validation.JsonSchema; -import org.openapijsonschematools.client.schemas.validation.JsonSchemaInfo; -import org.openapijsonschematools.client.schemas.validation.ListSchemaValidator; -import org.openapijsonschematools.client.schemas.validation.MapSchemaValidator; -import org.openapijsonschematools.client.schemas.validation.NullSchemaValidator; -import org.openapijsonschematools.client.schemas.validation.NumberSchemaValidator; -import org.openapijsonschematools.client.schemas.validation.PathToSchemasMap; -import org.openapijsonschematools.client.schemas.validation.PropertyEntry; -import org.openapijsonschematools.client.schemas.validation.StringSchemaValidator; -import org.openapijsonschematools.client.schemas.validation.ValidationMetadata; - -public class Schema1 { - // nest classes so all schemas and input/output classes can be public - - - public sealed interface Schema01Boxed permits Schema01BoxedString { - @Nullable Object getData(); - } - - public record Schema01BoxedString(String data) implements Schema01Boxed { - @Override - public @Nullable Object getData() { - return data; - } - } - - - - public static class Schema01 extends JsonSchema implements StringSchemaValidator { - private static @Nullable Schema01 instance = null; - - protected Schema01() { - super(new JsonSchemaInfo() - .type(Set.of( - String.class - )) - .minLength(1) - ); - } - - public static Schema01 getInstance() { - if (instance == null) { - instance = new Schema01(); - } - return instance; - } - - @Override - public String validate(String arg, SchemaConfiguration configuration) throws ValidationException { - Set> pathSet = new HashSet<>(); - List pathToItem = List.of("args[0"); - String castArg = castToAllowedTypes(arg, pathToItem, pathSet); - SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().build())); - ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, new PathToSchemasMap(), new LinkedHashSet<>()); - getPathToSchemas(this, castArg, validationMetadata, pathSet); - return castArg; - } - - @Override - public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws 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"); - } - @Override - public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { - 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"); - } - @Override - 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 { - 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"); - } - } - - public sealed interface SomeProp1Boxed permits SomeProp1BoxedVoid, SomeProp1BoxedBoolean, SomeProp1BoxedNumber, SomeProp1BoxedString, SomeProp1BoxedList, SomeProp1BoxedMap { - @Nullable Object getData(); - } - - public record SomeProp1BoxedVoid(Nothing? data) implements SomeProp1Boxed { - @Override - public @Nullable Object getData() { - return data; - } - } - - public record SomeProp1BoxedBoolean(boolean data) implements SomeProp1Boxed { - @Override - public @Nullable Object getData() { - return data; - } - } - - public record SomeProp1BoxedNumber(Number data) implements SomeProp1Boxed { - @Override - public @Nullable Object getData() { - return data; - } - } - - public record SomeProp1BoxedString(String data) implements SomeProp1Boxed { - @Override - public @Nullable Object getData() { - return data; - } - } - - public record SomeProp1BoxedList(FrozenList<@Nullable Object> data) implements SomeProp1Boxed { - @Override - public @Nullable Object getData() { - return data; - } - } - - public record SomeProp1BoxedMap(FrozenMap<@Nullable Object> data) implements SomeProp1Boxed { - @Override - public @Nullable Object getData() { - return data; - } - } - - - public static class SomeProp1 extends JsonSchema implements NullSchemaValidator, BooleanSchemaValidator, NumberSchemaValidator, StringSchemaValidator, ListSchemaValidator, SomeProp1BoxedList>, MapSchemaValidator, SomeProp1BoxedMap> { - private static @Nullable SomeProp1 instance = null; - - protected SomeProp1() { - super(new JsonSchemaInfo() - .allOf(List.of( - Schema01.class - )) - ); - } - - public static SomeProp1 getInstance() { - if (instance == null) { - instance = new SomeProp1(); - } - return instance; - } - - @Override - public Nothing? validate(Nothing? arg, SchemaConfiguration configuration) throws ValidationException { - Set> pathSet = new HashSet<>(); - List pathToItem = List.of("args[0]"); - Nothing? castArg = castToAllowedTypes(arg, pathToItem, pathSet); - SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().build())); - PathToSchemasMap validatedPathToSchemas = new PathToSchemasMap(); - ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, new LinkedHashSet<>()); - getPathToSchemas(this, castArg, validationMetadata, pathSet); - return castArg; - } - - @Override - public boolean validate(boolean arg, SchemaConfiguration configuration) throws ValidationException { - Set> pathSet = new HashSet<>(); - List pathToItem = List.of("args[0]"); - boolean castArg = castToAllowedTypes(arg, pathToItem, pathSet); - SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().build())); - PathToSchemasMap validatedPathToSchemas = new PathToSchemasMap(); - ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, new LinkedHashSet<>()); - getPathToSchemas(this, castArg, validationMetadata, pathSet); - return castArg; - } - - @Override - public Number validate(Number arg, SchemaConfiguration configuration) throws ValidationException { - Set> pathSet = new HashSet<>(); - List pathToItem = List.of("args[0]"); - Number castArg = castToAllowedTypes(arg, pathToItem, pathSet); - SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().build())); - PathToSchemasMap validatedPathToSchemas = new PathToSchemasMap(); - ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, new LinkedHashSet<>()); - getPathToSchemas(this, castArg, validationMetadata, pathSet); - return castArg; - } - - public int validate(int arg, SchemaConfiguration configuration) throws ValidationException { - return (int) validate((Number) arg, configuration); - } - - public long validate(long arg, SchemaConfiguration configuration) throws ValidationException { - return (long) validate((Number) arg, configuration); - } - - public float validate(float arg, SchemaConfiguration configuration) throws ValidationException { - return (float) validate((Number) arg, configuration); - } - - public double validate(double arg, SchemaConfiguration configuration) throws ValidationException { - return (double) validate((Number) arg, configuration); - } - - @Override - public String validate(String arg, SchemaConfiguration configuration) throws ValidationException { - Set> pathSet = new HashSet<>(); - List pathToItem = List.of("args[0]"); - String castArg = castToAllowedTypes(arg, pathToItem, pathSet); - SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().build())); - PathToSchemasMap validatedPathToSchemas = new PathToSchemasMap(); - ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, new LinkedHashSet<>()); - getPathToSchemas(this, castArg, validationMetadata, pathSet); - return castArg; - } - - public String validate(LocalDate arg, SchemaConfiguration configuration) throws ValidationException { - return validate(arg.toString(), configuration); - } - - public String validate(ZonedDateTime arg, SchemaConfiguration configuration) throws ValidationException { - return validate(arg.toString(), configuration); - } - - public String validate(UUID arg, SchemaConfiguration configuration) throws ValidationException { - return validate(arg.toString(), configuration); - } - - @Override - public FrozenList<@Nullable Object> getNewInstance(List arg, List pathToItem, PathToSchemasMap pathToSchemas) { - List<@Nullable Object> items = new ArrayList<>(); - int i = 0; - for (Object item: arg) { - List itemPathToItem = new ArrayList<>(pathToItem); - itemPathToItem.add(i); - LinkedHashMap, Nothing?> schemas = pathToSchemas.get(itemPathToItem); - if (schemas == null) { - throw new RuntimeException("Validation result is invalid, schemas must exist for a pathToItem"); - } - JsonSchema itemSchema = schemas.entrySet().iterator().next().getKey(); - @Nullable Object itemInstance = itemSchema.getNewInstance(item, itemPathToItem, pathToSchemas); - items.add(itemInstance); - i += 1; - } - FrozenList<@Nullable Object> newInstanceItems = new FrozenList<>(items); - return newInstanceItems; - } - - 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); - SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().build())); - ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, new PathToSchemasMap(), new LinkedHashSet<>()); - PathToSchemasMap pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet); - return getNewInstance(castArg, validationMetadata.pathToItem(), pathToSchemasMap); - } - - @Override - 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 RuntimeException("Invalid non-string key value"); - } - String propertyName = (String) entryKey; - List propertyPathToItem = new ArrayList<>(pathToItem); - propertyPathToItem.add(propertyName); - Object value = entry.getValue(); - LinkedHashMap, Nothing?> schemas = pathToSchemas.get(propertyPathToItem); - if (schemas == null) { - throw new RuntimeException("Validation result is invalid, schemas must exist for a pathToItem"); - } - JsonSchema propertySchema = schemas.entrySet().iterator().next().getKey(); - @Nullable Object propertyInstance = propertySchema.getNewInstance(value, propertyPathToItem, pathToSchemas); - properties.put(propertyName, propertyInstance); - } - FrozenMap<@Nullable Object> castProperties = new FrozenMap<>(properties); - return castProperties; - } - - public FrozenMap<@Nullable Object> validate(Map arg, SchemaConfiguration configuration) throws ValidationException { - Set> pathSet = new HashSet<>(); - List pathToItem = List.of("args[0]"); - Map castArg = castToAllowedTypes(arg, pathToItem, pathSet); - SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().build())); - PathToSchemasMap validatedPathToSchemas = new PathToSchemasMap(); - ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, new LinkedHashSet<>()); - PathToSchemasMap pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet); - return getNewInstance(castArg, validationMetadata.pathToItem(), pathToSchemasMap); - } - - @Override - public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { - if (arg == null) { - return validate((Nothing?) null, configuration); - } else if (arg instanceof Boolean) { - boolean boolArg = (Boolean) arg; - return validate(boolArg, configuration); - } else if (arg instanceof Number) { - return validate((Number) arg, configuration); - } else if (arg instanceof String) { - return validate((String) arg, configuration); - } else if (arg instanceof List) { - return validate((List) arg, 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"); - } - @Override - public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { - if (arg == null) { - return getNewInstance((Nothing?) null, pathToItem, pathToSchemas); - } else if (arg instanceof Boolean) { - boolean boolArg = (Boolean) arg; - return getNewInstance(boolArg, pathToItem, pathToSchemas); - } else if (arg instanceof Number) { - return getNewInstance((Number) arg, pathToItem, pathToSchemas); - } else if (arg instanceof String) { - return getNewInstance((String) arg, pathToItem, pathToSchemas); - } else if (arg instanceof List) { - return getNewInstance((List) arg, 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"); - } - @Override - public SomeProp1BoxedVoid validateAndBox(Nothing? arg, SchemaConfiguration configuration) throws ValidationException { - return new SomeProp1BoxedVoid(validate(arg, configuration)); - } - @Override - 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 { - return new SomeProp1BoxedNumber(validate(arg, configuration)); - } - @Override - 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 { - return new SomeProp1BoxedList(validate(arg, configuration)); - } - @Override - 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 { - if (arg == null) { - Nothing? castArg = (Nothing?) arg; - return validateAndBox(castArg, configuration); - } else if (arg instanceof Boolean booleanArg) { - boolean castArg = booleanArg; - return validateAndBox(castArg, configuration); - } else if (arg instanceof String castArg) { - return validateAndBox(castArg, configuration); - } else if (arg instanceof Number castArg) { - return validateAndBox(castArg, configuration); - } else if (arg instanceof List castArg) { - 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"); - } - } - - public static class SchemaMap1 extends FrozenMap<@Nullable Object> { - protected SchemaMap1(FrozenMap<@Nullable Object> m) { - super(m); - } - public static final Set requiredKeys = Set.of(); - public static final Set optionalKeys = Set.of( - "someProp" - ); - public static SchemaMap1 of(Map arg, SchemaConfiguration configuration) throws ValidationException { - return Schema11.getInstance().validate(arg, configuration); - } - - public @Nullable Object someProp() throws UnsetPropertyException { - return getOrThrow("someProp"); - } - - public @Nullable Object getAdditionalProperty(String name) throws UnsetPropertyException, InvalidAdditionalPropertyException { - throwIfKeyKnown(name, requiredKeys, optionalKeys); - throwIfKeyNotPresent(name); - return get(name); - } - } - - public interface SetterForSomeProp1 { - Map getInstance(); - T getBuilderAfterSomeProp1(Map instance); - - default T someProp(Nothing? value) { - var instance = getInstance(); - instance.put("someProp", null); - return getBuilderAfterSomeProp1(instance); - } - - default T someProp(boolean value) { - var instance = getInstance(); - instance.put("someProp", value); - return getBuilderAfterSomeProp1(instance); - } - - default T someProp(String value) { - var instance = getInstance(); - instance.put("someProp", value); - return getBuilderAfterSomeProp1(instance); - } - - default T someProp(int value) { - var instance = getInstance(); - instance.put("someProp", value); - return getBuilderAfterSomeProp1(instance); - } - - default T someProp(float value) { - var instance = getInstance(); - instance.put("someProp", value); - return getBuilderAfterSomeProp1(instance); - } - - default T someProp(long value) { - var instance = getInstance(); - instance.put("someProp", value); - return getBuilderAfterSomeProp1(instance); - } - - default T someProp(double value) { - var instance = getInstance(); - instance.put("someProp", value); - return getBuilderAfterSomeProp1(instance); - } - - default T someProp(List value) { - var instance = getInstance(); - instance.put("someProp", value); - return getBuilderAfterSomeProp1(instance); - } - - default T someProp(Map value) { - var instance = getInstance(); - instance.put("someProp", value); - return getBuilderAfterSomeProp1(instance); - } - } - - public static class SchemaMapBuilder1 extends UnsetAddPropsSetter implements GenericBuilder>, SetterForSomeProp1 { - private final Map instance; - private static final Set knownKeys = Set.of( - "someProp" - ); - public Set getKnownKeys() { - return knownKeys; - } - public SchemaMapBuilder1() { - this.instance = new LinkedHashMap<>(); - } - public Map build() { - return instance; - } - public Map getInstance() { - return instance; - } - public SchemaMapBuilder1 getBuilderAfterSomeProp1(Map instance) { - return this; - } - public SchemaMapBuilder1 getBuilderAfterAdditionalProperty(Map instance) { - return this; - } - } - - - public sealed interface Schema11Boxed permits Schema11BoxedMap { - @Nullable Object getData(); - } - - public record Schema11BoxedMap(SchemaMap1 data) implements Schema11Boxed { - @Override - public @Nullable Object getData() { - return data; - } - } - - - public static class Schema11 extends JsonSchema implements MapSchemaValidator { - private static @Nullable Schema11 instance = null; - - protected Schema11() { - super(new JsonSchemaInfo() - .type(Set.of(Map.class)) - .properties(Map.ofEntries( - new PropertyEntry("someProp", SomeProp1.class) - )) - ); - } - - public static Schema11 getInstance() { - if (instance == null) { - instance = new Schema11(); - } - return instance; - } - - 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 RuntimeException("Invalid non-string key value"); - } - String propertyName = (String) entryKey; - List propertyPathToItem = new ArrayList<>(pathToItem); - propertyPathToItem.add(propertyName); - Object value = entry.getValue(); - LinkedHashMap, Nothing?> schemas = pathToSchemas.get(propertyPathToItem); - if (schemas == null) { - throw new RuntimeException("Validation result is invalid, schemas must exist for a pathToItem"); - } - JsonSchema propertySchema = schemas.entrySet().iterator().next().getKey(); - @Nullable Object propertyInstance = propertySchema.getNewInstance(value, propertyPathToItem, pathToSchemas); - properties.put(propertyName, propertyInstance); - } - FrozenMap<@Nullable Object> castProperties = new FrozenMap<>(properties); - return new SchemaMap1(castProperties); - } - - 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); - SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().build())); - ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, new PathToSchemasMap(), new LinkedHashSet<>()); - PathToSchemasMap pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet); - return getNewInstance(castArg, validationMetadata.pathToItem(), pathToSchemasMap); - } - - - @Override - public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws 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"); - } - @Override - public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { - if (arg instanceof Map) { - return getNewInstance((Map) arg, pathToItem, pathToSchemas); - } - 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 { - return new Schema11BoxedMap(validate(arg, configuration)); - } - @Override - public Schema11Boxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { - 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"); - } - } - -} diff --git a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/fakeinlinecomposition/post/requestbody/content/applicationjson/ApplicationjsonSchema.kt b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/fakeinlinecomposition/post/requestbody/content/applicationjson/ApplicationjsonSchema.kt deleted file mode 100644 index f23e78142b3..00000000000 --- a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/fakeinlinecomposition/post/requestbody/content/applicationjson/ApplicationjsonSchema.kt +++ /dev/null @@ -1,393 +0,0 @@ -package org.openapijsonschematools.client.paths.fakeinlinecomposition.post.requestbody.content.applicationjson; -import java.time.LocalDate; -import java.time.ZonedDateTime; -import java.util.ArrayList; -import java.util.HashSet; -import java.util.LinkedHashMap; -import java.util.LinkedHashSet; -import java.util.List; -import java.util.Map; -import java.util.Objects; -import java.util.Set; -import java.util.UUID; -import org.checkerframework.checker.nullness.qual.Nullable; -import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags; -import org.openapijsonschematools.client.configurations.SchemaConfiguration; -import org.openapijsonschematools.client.exceptions.InvalidAdditionalPropertyException; -import org.openapijsonschematools.client.exceptions.UnsetPropertyException; -import org.openapijsonschematools.client.exceptions.ValidationException; -import org.openapijsonschematools.client.schemas.UnsetAddPropsSetter; -import org.openapijsonschematools.client.schemas.validation.BooleanSchemaValidator; -import org.openapijsonschematools.client.schemas.validation.FrozenList; -import org.openapijsonschematools.client.schemas.validation.FrozenMap; -import org.openapijsonschematools.client.schemas.validation.JsonSchema; -import org.openapijsonschematools.client.schemas.validation.JsonSchemaInfo; -import org.openapijsonschematools.client.schemas.validation.ListSchemaValidator; -import org.openapijsonschematools.client.schemas.validation.MapSchemaValidator; -import org.openapijsonschematools.client.schemas.validation.NullSchemaValidator; -import org.openapijsonschematools.client.schemas.validation.NumberSchemaValidator; -import org.openapijsonschematools.client.schemas.validation.PathToSchemasMap; -import org.openapijsonschematools.client.schemas.validation.StringSchemaValidator; -import org.openapijsonschematools.client.schemas.validation.ValidationMetadata; - -public class ApplicationjsonSchema { - // nest classes so all schemas and input/output classes can be public - - - public sealed interface Applicationjson0Boxed permits Applicationjson0BoxedString { - @Nullable Object getData(); - } - - public record Applicationjson0BoxedString(String data) implements Applicationjson0Boxed { - @Override - public @Nullable Object getData() { - return data; - } - } - - - - public static class Applicationjson0 extends JsonSchema implements StringSchemaValidator { - private static @Nullable Applicationjson0 instance = null; - - protected Applicationjson0() { - super(new JsonSchemaInfo() - .type(Set.of( - String.class - )) - .minLength(1) - ); - } - - public static Applicationjson0 getInstance() { - if (instance == null) { - instance = new Applicationjson0(); - } - return instance; - } - - @Override - public String validate(String arg, SchemaConfiguration configuration) throws ValidationException { - Set> pathSet = new HashSet<>(); - List pathToItem = List.of("args[0"); - String castArg = castToAllowedTypes(arg, pathToItem, pathSet); - SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().build())); - ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, new PathToSchemasMap(), new LinkedHashSet<>()); - getPathToSchemas(this, castArg, validationMetadata, pathSet); - return castArg; - } - - @Override - public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws 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"); - } - @Override - public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { - 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"); - } - @Override - 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 { - 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"); - } - } - - public sealed interface ApplicationjsonSchema1Boxed permits ApplicationjsonSchema1BoxedVoid, ApplicationjsonSchema1BoxedBoolean, ApplicationjsonSchema1BoxedNumber, ApplicationjsonSchema1BoxedString, ApplicationjsonSchema1BoxedList, ApplicationjsonSchema1BoxedMap { - @Nullable Object getData(); - } - - public record ApplicationjsonSchema1BoxedVoid(Nothing? data) implements ApplicationjsonSchema1Boxed { - @Override - public @Nullable Object getData() { - return data; - } - } - - public record ApplicationjsonSchema1BoxedBoolean(boolean data) implements ApplicationjsonSchema1Boxed { - @Override - public @Nullable Object getData() { - return data; - } - } - - public record ApplicationjsonSchema1BoxedNumber(Number data) implements ApplicationjsonSchema1Boxed { - @Override - public @Nullable Object getData() { - return data; - } - } - - public record ApplicationjsonSchema1BoxedString(String data) implements ApplicationjsonSchema1Boxed { - @Override - public @Nullable Object getData() { - return data; - } - } - - public record ApplicationjsonSchema1BoxedList(FrozenList<@Nullable Object> data) implements ApplicationjsonSchema1Boxed { - @Override - public @Nullable Object getData() { - return data; - } - } - - public record ApplicationjsonSchema1BoxedMap(FrozenMap<@Nullable Object> data) implements ApplicationjsonSchema1Boxed { - @Override - public @Nullable Object getData() { - return data; - } - } - - - public static class ApplicationjsonSchema1 extends JsonSchema implements NullSchemaValidator, BooleanSchemaValidator, NumberSchemaValidator, StringSchemaValidator, ListSchemaValidator, ApplicationjsonSchema1BoxedList>, MapSchemaValidator, ApplicationjsonSchema1BoxedMap> { - private static @Nullable ApplicationjsonSchema1 instance = null; - - protected ApplicationjsonSchema1() { - super(new JsonSchemaInfo() - .allOf(List.of( - Applicationjson0.class - )) - ); - } - - public static ApplicationjsonSchema1 getInstance() { - if (instance == null) { - instance = new ApplicationjsonSchema1(); - } - return instance; - } - - @Override - public Nothing? validate(Nothing? arg, SchemaConfiguration configuration) throws ValidationException { - Set> pathSet = new HashSet<>(); - List pathToItem = List.of("args[0]"); - Nothing? castArg = castToAllowedTypes(arg, pathToItem, pathSet); - SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().build())); - PathToSchemasMap validatedPathToSchemas = new PathToSchemasMap(); - ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, new LinkedHashSet<>()); - getPathToSchemas(this, castArg, validationMetadata, pathSet); - return castArg; - } - - @Override - public boolean validate(boolean arg, SchemaConfiguration configuration) throws ValidationException { - Set> pathSet = new HashSet<>(); - List pathToItem = List.of("args[0]"); - boolean castArg = castToAllowedTypes(arg, pathToItem, pathSet); - SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().build())); - PathToSchemasMap validatedPathToSchemas = new PathToSchemasMap(); - ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, new LinkedHashSet<>()); - getPathToSchemas(this, castArg, validationMetadata, pathSet); - return castArg; - } - - @Override - public Number validate(Number arg, SchemaConfiguration configuration) throws ValidationException { - Set> pathSet = new HashSet<>(); - List pathToItem = List.of("args[0]"); - Number castArg = castToAllowedTypes(arg, pathToItem, pathSet); - SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().build())); - PathToSchemasMap validatedPathToSchemas = new PathToSchemasMap(); - ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, new LinkedHashSet<>()); - getPathToSchemas(this, castArg, validationMetadata, pathSet); - return castArg; - } - - public int validate(int arg, SchemaConfiguration configuration) throws ValidationException { - return (int) validate((Number) arg, configuration); - } - - public long validate(long arg, SchemaConfiguration configuration) throws ValidationException { - return (long) validate((Number) arg, configuration); - } - - public float validate(float arg, SchemaConfiguration configuration) throws ValidationException { - return (float) validate((Number) arg, configuration); - } - - public double validate(double arg, SchemaConfiguration configuration) throws ValidationException { - return (double) validate((Number) arg, configuration); - } - - @Override - public String validate(String arg, SchemaConfiguration configuration) throws ValidationException { - Set> pathSet = new HashSet<>(); - List pathToItem = List.of("args[0]"); - String castArg = castToAllowedTypes(arg, pathToItem, pathSet); - SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().build())); - PathToSchemasMap validatedPathToSchemas = new PathToSchemasMap(); - ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, new LinkedHashSet<>()); - getPathToSchemas(this, castArg, validationMetadata, pathSet); - return castArg; - } - - public String validate(LocalDate arg, SchemaConfiguration configuration) throws ValidationException { - return validate(arg.toString(), configuration); - } - - public String validate(ZonedDateTime arg, SchemaConfiguration configuration) throws ValidationException { - return validate(arg.toString(), configuration); - } - - public String validate(UUID arg, SchemaConfiguration configuration) throws ValidationException { - return validate(arg.toString(), configuration); - } - - @Override - public FrozenList<@Nullable Object> getNewInstance(List arg, List pathToItem, PathToSchemasMap pathToSchemas) { - List<@Nullable Object> items = new ArrayList<>(); - int i = 0; - for (Object item: arg) { - List itemPathToItem = new ArrayList<>(pathToItem); - itemPathToItem.add(i); - LinkedHashMap, Nothing?> schemas = pathToSchemas.get(itemPathToItem); - if (schemas == null) { - throw new RuntimeException("Validation result is invalid, schemas must exist for a pathToItem"); - } - JsonSchema itemSchema = schemas.entrySet().iterator().next().getKey(); - @Nullable Object itemInstance = itemSchema.getNewInstance(item, itemPathToItem, pathToSchemas); - items.add(itemInstance); - i += 1; - } - FrozenList<@Nullable Object> newInstanceItems = new FrozenList<>(items); - return newInstanceItems; - } - - 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); - SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().build())); - ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, new PathToSchemasMap(), new LinkedHashSet<>()); - PathToSchemasMap pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet); - return getNewInstance(castArg, validationMetadata.pathToItem(), pathToSchemasMap); - } - - @Override - 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 RuntimeException("Invalid non-string key value"); - } - String propertyName = (String) entryKey; - List propertyPathToItem = new ArrayList<>(pathToItem); - propertyPathToItem.add(propertyName); - Object value = entry.getValue(); - LinkedHashMap, Nothing?> schemas = pathToSchemas.get(propertyPathToItem); - if (schemas == null) { - throw new RuntimeException("Validation result is invalid, schemas must exist for a pathToItem"); - } - JsonSchema propertySchema = schemas.entrySet().iterator().next().getKey(); - @Nullable Object propertyInstance = propertySchema.getNewInstance(value, propertyPathToItem, pathToSchemas); - properties.put(propertyName, propertyInstance); - } - FrozenMap<@Nullable Object> castProperties = new FrozenMap<>(properties); - return castProperties; - } - - public FrozenMap<@Nullable Object> validate(Map arg, SchemaConfiguration configuration) throws ValidationException { - Set> pathSet = new HashSet<>(); - List pathToItem = List.of("args[0]"); - Map castArg = castToAllowedTypes(arg, pathToItem, pathSet); - SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().build())); - PathToSchemasMap validatedPathToSchemas = new PathToSchemasMap(); - ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, new LinkedHashSet<>()); - PathToSchemasMap pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet); - return getNewInstance(castArg, validationMetadata.pathToItem(), pathToSchemasMap); - } - - @Override - public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { - if (arg == null) { - return validate((Nothing?) null, configuration); - } else if (arg instanceof Boolean) { - boolean boolArg = (Boolean) arg; - return validate(boolArg, configuration); - } else if (arg instanceof Number) { - return validate((Number) arg, configuration); - } else if (arg instanceof String) { - return validate((String) arg, configuration); - } else if (arg instanceof List) { - return validate((List) arg, 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"); - } - @Override - public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { - if (arg == null) { - return getNewInstance((Nothing?) null, pathToItem, pathToSchemas); - } else if (arg instanceof Boolean) { - boolean boolArg = (Boolean) arg; - return getNewInstance(boolArg, pathToItem, pathToSchemas); - } else if (arg instanceof Number) { - return getNewInstance((Number) arg, pathToItem, pathToSchemas); - } else if (arg instanceof String) { - return getNewInstance((String) arg, pathToItem, pathToSchemas); - } else if (arg instanceof List) { - return getNewInstance((List) arg, 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"); - } - @Override - public ApplicationjsonSchema1BoxedVoid validateAndBox(Nothing? arg, SchemaConfiguration configuration) throws ValidationException { - return new ApplicationjsonSchema1BoxedVoid(validate(arg, configuration)); - } - @Override - 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 { - return new ApplicationjsonSchema1BoxedNumber(validate(arg, configuration)); - } - @Override - 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 { - return new ApplicationjsonSchema1BoxedList(validate(arg, configuration)); - } - @Override - 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 { - if (arg == null) { - Nothing? castArg = (Nothing?) arg; - return validateAndBox(castArg, configuration); - } else if (arg instanceof Boolean booleanArg) { - boolean castArg = booleanArg; - return validateAndBox(castArg, configuration); - } else if (arg instanceof String castArg) { - return validateAndBox(castArg, configuration); - } else if (arg instanceof Number castArg) { - return validateAndBox(castArg, configuration); - } else if (arg instanceof List castArg) { - 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"); - } - } -} diff --git a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/fakeinlinecomposition/post/requestbody/content/multipartformdata/MultipartformdataSchema.kt b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/fakeinlinecomposition/post/requestbody/content/multipartformdata/MultipartformdataSchema.kt deleted file mode 100644 index 0f7b66a3d8a..00000000000 --- a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/fakeinlinecomposition/post/requestbody/content/multipartformdata/MultipartformdataSchema.kt +++ /dev/null @@ -1,596 +0,0 @@ -package org.openapijsonschematools.client.paths.fakeinlinecomposition.post.requestbody.content.multipartformdata; -import java.time.LocalDate; -import java.time.ZonedDateTime; -import java.util.ArrayList; -import java.util.HashSet; -import java.util.LinkedHashMap; -import java.util.LinkedHashSet; -import java.util.List; -import java.util.Map; -import java.util.Objects; -import java.util.Set; -import java.util.UUID; -import org.checkerframework.checker.nullness.qual.Nullable; -import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags; -import org.openapijsonschematools.client.configurations.SchemaConfiguration; -import org.openapijsonschematools.client.exceptions.InvalidAdditionalPropertyException; -import org.openapijsonschematools.client.exceptions.UnsetPropertyException; -import org.openapijsonschematools.client.exceptions.ValidationException; -import org.openapijsonschematools.client.schemas.GenericBuilder; -import org.openapijsonschematools.client.schemas.UnsetAddPropsSetter; -import org.openapijsonschematools.client.schemas.validation.BooleanSchemaValidator; -import org.openapijsonschematools.client.schemas.validation.FrozenList; -import org.openapijsonschematools.client.schemas.validation.FrozenMap; -import org.openapijsonschematools.client.schemas.validation.JsonSchema; -import org.openapijsonschematools.client.schemas.validation.JsonSchemaInfo; -import org.openapijsonschematools.client.schemas.validation.ListSchemaValidator; -import org.openapijsonschematools.client.schemas.validation.MapSchemaValidator; -import org.openapijsonschematools.client.schemas.validation.NullSchemaValidator; -import org.openapijsonschematools.client.schemas.validation.NumberSchemaValidator; -import org.openapijsonschematools.client.schemas.validation.PathToSchemasMap; -import org.openapijsonschematools.client.schemas.validation.PropertyEntry; -import org.openapijsonschematools.client.schemas.validation.StringSchemaValidator; -import org.openapijsonschematools.client.schemas.validation.ValidationMetadata; - -public class MultipartformdataSchema { - // nest classes so all schemas and input/output classes can be public - - - public sealed interface Multipartformdata0Boxed permits Multipartformdata0BoxedString { - @Nullable Object getData(); - } - - public record Multipartformdata0BoxedString(String data) implements Multipartformdata0Boxed { - @Override - public @Nullable Object getData() { - return data; - } - } - - - - public static class Multipartformdata0 extends JsonSchema implements StringSchemaValidator { - private static @Nullable Multipartformdata0 instance = null; - - protected Multipartformdata0() { - super(new JsonSchemaInfo() - .type(Set.of( - String.class - )) - .minLength(1) - ); - } - - public static Multipartformdata0 getInstance() { - if (instance == null) { - instance = new Multipartformdata0(); - } - return instance; - } - - @Override - public String validate(String arg, SchemaConfiguration configuration) throws ValidationException { - Set> pathSet = new HashSet<>(); - List pathToItem = List.of("args[0"); - String castArg = castToAllowedTypes(arg, pathToItem, pathSet); - SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().build())); - ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, new PathToSchemasMap(), new LinkedHashSet<>()); - getPathToSchemas(this, castArg, validationMetadata, pathSet); - return castArg; - } - - @Override - public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws 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"); - } - @Override - public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { - 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"); - } - @Override - 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 { - 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"); - } - } - - public sealed interface MultipartformdataSomePropBoxed permits MultipartformdataSomePropBoxedVoid, MultipartformdataSomePropBoxedBoolean, MultipartformdataSomePropBoxedNumber, MultipartformdataSomePropBoxedString, MultipartformdataSomePropBoxedList, MultipartformdataSomePropBoxedMap { - @Nullable Object getData(); - } - - public record MultipartformdataSomePropBoxedVoid(Nothing? data) implements MultipartformdataSomePropBoxed { - @Override - public @Nullable Object getData() { - return data; - } - } - - public record MultipartformdataSomePropBoxedBoolean(boolean data) implements MultipartformdataSomePropBoxed { - @Override - public @Nullable Object getData() { - return data; - } - } - - public record MultipartformdataSomePropBoxedNumber(Number data) implements MultipartformdataSomePropBoxed { - @Override - public @Nullable Object getData() { - return data; - } - } - - public record MultipartformdataSomePropBoxedString(String data) implements MultipartformdataSomePropBoxed { - @Override - public @Nullable Object getData() { - return data; - } - } - - public record MultipartformdataSomePropBoxedList(FrozenList<@Nullable Object> data) implements MultipartformdataSomePropBoxed { - @Override - public @Nullable Object getData() { - return data; - } - } - - public record MultipartformdataSomePropBoxedMap(FrozenMap<@Nullable Object> data) implements MultipartformdataSomePropBoxed { - @Override - public @Nullable Object getData() { - return data; - } - } - - - public static class MultipartformdataSomeProp extends JsonSchema implements NullSchemaValidator, BooleanSchemaValidator, NumberSchemaValidator, StringSchemaValidator, ListSchemaValidator, MultipartformdataSomePropBoxedList>, MapSchemaValidator, MultipartformdataSomePropBoxedMap> { - private static @Nullable MultipartformdataSomeProp instance = null; - - protected MultipartformdataSomeProp() { - super(new JsonSchemaInfo() - .allOf(List.of( - Multipartformdata0.class - )) - ); - } - - public static MultipartformdataSomeProp getInstance() { - if (instance == null) { - instance = new MultipartformdataSomeProp(); - } - return instance; - } - - @Override - public Nothing? validate(Nothing? arg, SchemaConfiguration configuration) throws ValidationException { - Set> pathSet = new HashSet<>(); - List pathToItem = List.of("args[0]"); - Nothing? castArg = castToAllowedTypes(arg, pathToItem, pathSet); - SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().build())); - PathToSchemasMap validatedPathToSchemas = new PathToSchemasMap(); - ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, new LinkedHashSet<>()); - getPathToSchemas(this, castArg, validationMetadata, pathSet); - return castArg; - } - - @Override - public boolean validate(boolean arg, SchemaConfiguration configuration) throws ValidationException { - Set> pathSet = new HashSet<>(); - List pathToItem = List.of("args[0]"); - boolean castArg = castToAllowedTypes(arg, pathToItem, pathSet); - SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().build())); - PathToSchemasMap validatedPathToSchemas = new PathToSchemasMap(); - ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, new LinkedHashSet<>()); - getPathToSchemas(this, castArg, validationMetadata, pathSet); - return castArg; - } - - @Override - public Number validate(Number arg, SchemaConfiguration configuration) throws ValidationException { - Set> pathSet = new HashSet<>(); - List pathToItem = List.of("args[0]"); - Number castArg = castToAllowedTypes(arg, pathToItem, pathSet); - SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().build())); - PathToSchemasMap validatedPathToSchemas = new PathToSchemasMap(); - ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, new LinkedHashSet<>()); - getPathToSchemas(this, castArg, validationMetadata, pathSet); - return castArg; - } - - public int validate(int arg, SchemaConfiguration configuration) throws ValidationException { - return (int) validate((Number) arg, configuration); - } - - public long validate(long arg, SchemaConfiguration configuration) throws ValidationException { - return (long) validate((Number) arg, configuration); - } - - public float validate(float arg, SchemaConfiguration configuration) throws ValidationException { - return (float) validate((Number) arg, configuration); - } - - public double validate(double arg, SchemaConfiguration configuration) throws ValidationException { - return (double) validate((Number) arg, configuration); - } - - @Override - public String validate(String arg, SchemaConfiguration configuration) throws ValidationException { - Set> pathSet = new HashSet<>(); - List pathToItem = List.of("args[0]"); - String castArg = castToAllowedTypes(arg, pathToItem, pathSet); - SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().build())); - PathToSchemasMap validatedPathToSchemas = new PathToSchemasMap(); - ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, new LinkedHashSet<>()); - getPathToSchemas(this, castArg, validationMetadata, pathSet); - return castArg; - } - - public String validate(LocalDate arg, SchemaConfiguration configuration) throws ValidationException { - return validate(arg.toString(), configuration); - } - - public String validate(ZonedDateTime arg, SchemaConfiguration configuration) throws ValidationException { - return validate(arg.toString(), configuration); - } - - public String validate(UUID arg, SchemaConfiguration configuration) throws ValidationException { - return validate(arg.toString(), configuration); - } - - @Override - public FrozenList<@Nullable Object> getNewInstance(List arg, List pathToItem, PathToSchemasMap pathToSchemas) { - List<@Nullable Object> items = new ArrayList<>(); - int i = 0; - for (Object item: arg) { - List itemPathToItem = new ArrayList<>(pathToItem); - itemPathToItem.add(i); - LinkedHashMap, Nothing?> schemas = pathToSchemas.get(itemPathToItem); - if (schemas == null) { - throw new RuntimeException("Validation result is invalid, schemas must exist for a pathToItem"); - } - JsonSchema itemSchema = schemas.entrySet().iterator().next().getKey(); - @Nullable Object itemInstance = itemSchema.getNewInstance(item, itemPathToItem, pathToSchemas); - items.add(itemInstance); - i += 1; - } - FrozenList<@Nullable Object> newInstanceItems = new FrozenList<>(items); - return newInstanceItems; - } - - 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); - SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().build())); - ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, new PathToSchemasMap(), new LinkedHashSet<>()); - PathToSchemasMap pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet); - return getNewInstance(castArg, validationMetadata.pathToItem(), pathToSchemasMap); - } - - @Override - 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 RuntimeException("Invalid non-string key value"); - } - String propertyName = (String) entryKey; - List propertyPathToItem = new ArrayList<>(pathToItem); - propertyPathToItem.add(propertyName); - Object value = entry.getValue(); - LinkedHashMap, Nothing?> schemas = pathToSchemas.get(propertyPathToItem); - if (schemas == null) { - throw new RuntimeException("Validation result is invalid, schemas must exist for a pathToItem"); - } - JsonSchema propertySchema = schemas.entrySet().iterator().next().getKey(); - @Nullable Object propertyInstance = propertySchema.getNewInstance(value, propertyPathToItem, pathToSchemas); - properties.put(propertyName, propertyInstance); - } - FrozenMap<@Nullable Object> castProperties = new FrozenMap<>(properties); - return castProperties; - } - - public FrozenMap<@Nullable Object> validate(Map arg, SchemaConfiguration configuration) throws ValidationException { - Set> pathSet = new HashSet<>(); - List pathToItem = List.of("args[0]"); - Map castArg = castToAllowedTypes(arg, pathToItem, pathSet); - SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().build())); - PathToSchemasMap validatedPathToSchemas = new PathToSchemasMap(); - ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, new LinkedHashSet<>()); - PathToSchemasMap pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet); - return getNewInstance(castArg, validationMetadata.pathToItem(), pathToSchemasMap); - } - - @Override - public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { - if (arg == null) { - return validate((Nothing?) null, configuration); - } else if (arg instanceof Boolean) { - boolean boolArg = (Boolean) arg; - return validate(boolArg, configuration); - } else if (arg instanceof Number) { - return validate((Number) arg, configuration); - } else if (arg instanceof String) { - return validate((String) arg, configuration); - } else if (arg instanceof List) { - return validate((List) arg, 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"); - } - @Override - public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { - if (arg == null) { - return getNewInstance((Nothing?) null, pathToItem, pathToSchemas); - } else if (arg instanceof Boolean) { - boolean boolArg = (Boolean) arg; - return getNewInstance(boolArg, pathToItem, pathToSchemas); - } else if (arg instanceof Number) { - return getNewInstance((Number) arg, pathToItem, pathToSchemas); - } else if (arg instanceof String) { - return getNewInstance((String) arg, pathToItem, pathToSchemas); - } else if (arg instanceof List) { - return getNewInstance((List) arg, 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"); - } - @Override - public MultipartformdataSomePropBoxedVoid validateAndBox(Nothing? arg, SchemaConfiguration configuration) throws ValidationException { - return new MultipartformdataSomePropBoxedVoid(validate(arg, configuration)); - } - @Override - 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 { - return new MultipartformdataSomePropBoxedNumber(validate(arg, configuration)); - } - @Override - 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 { - return new MultipartformdataSomePropBoxedList(validate(arg, configuration)); - } - @Override - 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 { - if (arg == null) { - Nothing? castArg = (Nothing?) arg; - return validateAndBox(castArg, configuration); - } else if (arg instanceof Boolean booleanArg) { - boolean castArg = booleanArg; - return validateAndBox(castArg, configuration); - } else if (arg instanceof String castArg) { - return validateAndBox(castArg, configuration); - } else if (arg instanceof Number castArg) { - return validateAndBox(castArg, configuration); - } else if (arg instanceof List castArg) { - 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"); - } - } - - public static class MultipartformdataSchemaMap extends FrozenMap<@Nullable Object> { - protected MultipartformdataSchemaMap(FrozenMap<@Nullable Object> m) { - super(m); - } - public static final Set requiredKeys = Set.of(); - public static final Set optionalKeys = Set.of( - "someProp" - ); - public static MultipartformdataSchemaMap of(Map arg, SchemaConfiguration configuration) throws ValidationException { - return MultipartformdataSchema1.getInstance().validate(arg, configuration); - } - - public @Nullable Object someProp() throws UnsetPropertyException { - return getOrThrow("someProp"); - } - - public @Nullable Object getAdditionalProperty(String name) throws UnsetPropertyException, InvalidAdditionalPropertyException { - throwIfKeyKnown(name, requiredKeys, optionalKeys); - throwIfKeyNotPresent(name); - return get(name); - } - } - - public interface SetterForMultipartformdataSomeProp { - Map getInstance(); - T getBuilderAfterMultipartformdataSomeProp(Map instance); - - default T someProp(Nothing? value) { - var instance = getInstance(); - instance.put("someProp", null); - return getBuilderAfterMultipartformdataSomeProp(instance); - } - - default T someProp(boolean value) { - var instance = getInstance(); - instance.put("someProp", value); - return getBuilderAfterMultipartformdataSomeProp(instance); - } - - default T someProp(String value) { - var instance = getInstance(); - instance.put("someProp", value); - return getBuilderAfterMultipartformdataSomeProp(instance); - } - - default T someProp(int value) { - var instance = getInstance(); - instance.put("someProp", value); - return getBuilderAfterMultipartformdataSomeProp(instance); - } - - default T someProp(float value) { - var instance = getInstance(); - instance.put("someProp", value); - return getBuilderAfterMultipartformdataSomeProp(instance); - } - - default T someProp(long value) { - var instance = getInstance(); - instance.put("someProp", value); - return getBuilderAfterMultipartformdataSomeProp(instance); - } - - default T someProp(double value) { - var instance = getInstance(); - instance.put("someProp", value); - return getBuilderAfterMultipartformdataSomeProp(instance); - } - - default T someProp(List value) { - var instance = getInstance(); - instance.put("someProp", value); - return getBuilderAfterMultipartformdataSomeProp(instance); - } - - default T someProp(Map value) { - var instance = getInstance(); - instance.put("someProp", value); - return getBuilderAfterMultipartformdataSomeProp(instance); - } - } - - public static class MultipartformdataSchemaMapBuilder extends UnsetAddPropsSetter implements GenericBuilder>, SetterForMultipartformdataSomeProp { - private final Map instance; - private static final Set knownKeys = Set.of( - "someProp" - ); - public Set getKnownKeys() { - return knownKeys; - } - public MultipartformdataSchemaMapBuilder() { - this.instance = new LinkedHashMap<>(); - } - public Map build() { - return instance; - } - public Map getInstance() { - return instance; - } - public MultipartformdataSchemaMapBuilder getBuilderAfterMultipartformdataSomeProp(Map instance) { - return this; - } - public MultipartformdataSchemaMapBuilder getBuilderAfterAdditionalProperty(Map instance) { - return this; - } - } - - - public sealed interface MultipartformdataSchema1Boxed permits MultipartformdataSchema1BoxedMap { - @Nullable Object getData(); - } - - public record MultipartformdataSchema1BoxedMap(MultipartformdataSchemaMap data) implements MultipartformdataSchema1Boxed { - @Override - public @Nullable Object getData() { - return data; - } - } - - - public static class MultipartformdataSchema1 extends JsonSchema implements MapSchemaValidator { - private static @Nullable MultipartformdataSchema1 instance = null; - - protected MultipartformdataSchema1() { - super(new JsonSchemaInfo() - .type(Set.of(Map.class)) - .properties(Map.ofEntries( - new PropertyEntry("someProp", MultipartformdataSomeProp.class) - )) - ); - } - - public static MultipartformdataSchema1 getInstance() { - if (instance == null) { - instance = new MultipartformdataSchema1(); - } - return instance; - } - - 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 RuntimeException("Invalid non-string key value"); - } - String propertyName = (String) entryKey; - List propertyPathToItem = new ArrayList<>(pathToItem); - propertyPathToItem.add(propertyName); - Object value = entry.getValue(); - LinkedHashMap, Nothing?> schemas = pathToSchemas.get(propertyPathToItem); - if (schemas == null) { - throw new RuntimeException("Validation result is invalid, schemas must exist for a pathToItem"); - } - JsonSchema propertySchema = schemas.entrySet().iterator().next().getKey(); - @Nullable Object propertyInstance = propertySchema.getNewInstance(value, propertyPathToItem, pathToSchemas); - properties.put(propertyName, propertyInstance); - } - FrozenMap<@Nullable Object> castProperties = new FrozenMap<>(properties); - return new MultipartformdataSchemaMap(castProperties); - } - - 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); - SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().build())); - ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, new PathToSchemasMap(), new LinkedHashSet<>()); - PathToSchemasMap pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet); - return getNewInstance(castArg, validationMetadata.pathToItem(), pathToSchemasMap); - } - - - @Override - public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws 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"); - } - @Override - public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { - if (arg instanceof Map) { - return getNewInstance((Map) arg, pathToItem, pathToSchemas); - } - 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 { - return new MultipartformdataSchema1BoxedMap(validate(arg, configuration)); - } - @Override - public MultipartformdataSchema1Boxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { - 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"); - } - } - -} diff --git a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/fakeinlinecomposition/post/responses/FakeinlinecompositionPostCode200Response.kt b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/fakeinlinecomposition/post/responses/FakeinlinecompositionPostCode200Response.kt deleted file mode 100644 index 297826c2fc6..00000000000 --- a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/fakeinlinecomposition/post/responses/FakeinlinecompositionPostCode200Response.kt +++ /dev/null @@ -1,81 +0,0 @@ -package org.openapijsonschematools.client.paths.fakeinlinecomposition.post.responses; - -import org.openapijsonschematools.client.configurations.SchemaConfiguration; -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; - -import java.util.AbstractMap; -import java.util.Map; -import java.net.http.HttpResponse; -import java.net.http.HttpHeaders; - -public class FakeinlinecompositionPostCode200Response { - public sealed interface SealedMediaType permits ApplicationjsonMediaType, MultipartformdataMediaType {} - - public record ApplicationjsonMediaType(ApplicationjsonSchema.ApplicationjsonSchema1 schema) implements SealedMediaType, MediaType { - public ApplicationjsonMediaType() { - this(ApplicationjsonSchema.ApplicationjsonSchema1.getInstance()); - } - @Override - public Nothing? encoding() { - return null; - } - } - - public record MultipartformdataMediaType(MultipartformdataSchema.MultipartformdataSchema1 schema) implements SealedMediaType, MediaType { - public MultipartformdataMediaType() { - this(MultipartformdataSchema.MultipartformdataSchema1.getInstance()); - } - @Override - public Nothing? encoding() { - return null; - } - } - public sealed interface SealedResponseBody permits ApplicationjsonResponseBody, MultipartformdataResponseBody {} - public record ApplicationjsonResponseBody(ApplicationjsonSchema.ApplicationjsonSchema1Boxed body) implements SealedResponseBody { } - public record MultipartformdataResponseBody(MultipartformdataSchema.MultipartformdataSchema1Boxed body) implements SealedResponseBody { } - - public static class FakeinlinecompositionPostCode200Response1 extends ResponseDeserializer { - public FakeinlinecompositionPostCode200Response1() { - super( - Map.ofEntries( - new AbstractMap.SimpleEntry<>("application/json", new ApplicationjsonMediaType()), - new AbstractMap.SimpleEntry<>("multipart/form-data", new MultipartformdataMediaType()) - ) - ); - } - - @Override - protected SealedResponseBody getBody(String contentType, SealedMediaType mediaType, byte[] body, SchemaConfiguration configuration) throws ValidationException, NotImplementedException { - if (mediaType instanceof ApplicationjsonMediaType thisMediaType) { - var deserializedBody = deserializeBody(contentType, body, thisMediaType.schema(), configuration); - return new ApplicationjsonResponseBody(deserializedBody); - } else { - MultipartformdataMediaType thisMediaType = (MultipartformdataMediaType) mediaType; - var deserializedBody = deserializeBody(contentType, body, thisMediaType.schema(), configuration); - return new MultipartformdataResponseBody(deserializedBody); - } - } - - @Override - protected Nothing? getHeaders(HttpHeaders headers, SchemaConfiguration configuration) { - return null; - } - } - - @SuppressWarnings("serial") - public static class ResponseApiException extends ApiException { - public DeserializedHttpResponse deserializedResponse; - - public ResponseApiException(String s, HttpResponse response, DeserializedHttpResponse deserializedResponse) { - super(s, response); - this.deserializedResponse = deserializedResponse; - } - } -} diff --git a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/fakeinlinecomposition/post/responses/code200response/content/applicationjson/ApplicationjsonSchema.kt b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/fakeinlinecomposition/post/responses/code200response/content/applicationjson/ApplicationjsonSchema.kt deleted file mode 100644 index b26596933ed..00000000000 --- a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/fakeinlinecomposition/post/responses/code200response/content/applicationjson/ApplicationjsonSchema.kt +++ /dev/null @@ -1,393 +0,0 @@ -package org.openapijsonschematools.client.paths.fakeinlinecomposition.post.responses.code200response.content.applicationjson; -import java.time.LocalDate; -import java.time.ZonedDateTime; -import java.util.ArrayList; -import java.util.HashSet; -import java.util.LinkedHashMap; -import java.util.LinkedHashSet; -import java.util.List; -import java.util.Map; -import java.util.Objects; -import java.util.Set; -import java.util.UUID; -import org.checkerframework.checker.nullness.qual.Nullable; -import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags; -import org.openapijsonschematools.client.configurations.SchemaConfiguration; -import org.openapijsonschematools.client.exceptions.InvalidAdditionalPropertyException; -import org.openapijsonschematools.client.exceptions.UnsetPropertyException; -import org.openapijsonschematools.client.exceptions.ValidationException; -import org.openapijsonschematools.client.schemas.UnsetAddPropsSetter; -import org.openapijsonschematools.client.schemas.validation.BooleanSchemaValidator; -import org.openapijsonschematools.client.schemas.validation.FrozenList; -import org.openapijsonschematools.client.schemas.validation.FrozenMap; -import org.openapijsonschematools.client.schemas.validation.JsonSchema; -import org.openapijsonschematools.client.schemas.validation.JsonSchemaInfo; -import org.openapijsonschematools.client.schemas.validation.ListSchemaValidator; -import org.openapijsonschematools.client.schemas.validation.MapSchemaValidator; -import org.openapijsonschematools.client.schemas.validation.NullSchemaValidator; -import org.openapijsonschematools.client.schemas.validation.NumberSchemaValidator; -import org.openapijsonschematools.client.schemas.validation.PathToSchemasMap; -import org.openapijsonschematools.client.schemas.validation.StringSchemaValidator; -import org.openapijsonschematools.client.schemas.validation.ValidationMetadata; - -public class ApplicationjsonSchema { - // nest classes so all schemas and input/output classes can be public - - - public sealed interface Applicationjson0Boxed permits Applicationjson0BoxedString { - @Nullable Object getData(); - } - - public record Applicationjson0BoxedString(String data) implements Applicationjson0Boxed { - @Override - public @Nullable Object getData() { - return data; - } - } - - - - public static class Applicationjson0 extends JsonSchema implements StringSchemaValidator { - private static @Nullable Applicationjson0 instance = null; - - protected Applicationjson0() { - super(new JsonSchemaInfo() - .type(Set.of( - String.class - )) - .minLength(1) - ); - } - - public static Applicationjson0 getInstance() { - if (instance == null) { - instance = new Applicationjson0(); - } - return instance; - } - - @Override - public String validate(String arg, SchemaConfiguration configuration) throws ValidationException { - Set> pathSet = new HashSet<>(); - List pathToItem = List.of("args[0"); - String castArg = castToAllowedTypes(arg, pathToItem, pathSet); - SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().build())); - ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, new PathToSchemasMap(), new LinkedHashSet<>()); - getPathToSchemas(this, castArg, validationMetadata, pathSet); - return castArg; - } - - @Override - public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws 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"); - } - @Override - public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { - 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"); - } - @Override - 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 { - 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"); - } - } - - public sealed interface ApplicationjsonSchema1Boxed permits ApplicationjsonSchema1BoxedVoid, ApplicationjsonSchema1BoxedBoolean, ApplicationjsonSchema1BoxedNumber, ApplicationjsonSchema1BoxedString, ApplicationjsonSchema1BoxedList, ApplicationjsonSchema1BoxedMap { - @Nullable Object getData(); - } - - public record ApplicationjsonSchema1BoxedVoid(Nothing? data) implements ApplicationjsonSchema1Boxed { - @Override - public @Nullable Object getData() { - return data; - } - } - - public record ApplicationjsonSchema1BoxedBoolean(boolean data) implements ApplicationjsonSchema1Boxed { - @Override - public @Nullable Object getData() { - return data; - } - } - - public record ApplicationjsonSchema1BoxedNumber(Number data) implements ApplicationjsonSchema1Boxed { - @Override - public @Nullable Object getData() { - return data; - } - } - - public record ApplicationjsonSchema1BoxedString(String data) implements ApplicationjsonSchema1Boxed { - @Override - public @Nullable Object getData() { - return data; - } - } - - public record ApplicationjsonSchema1BoxedList(FrozenList<@Nullable Object> data) implements ApplicationjsonSchema1Boxed { - @Override - public @Nullable Object getData() { - return data; - } - } - - public record ApplicationjsonSchema1BoxedMap(FrozenMap<@Nullable Object> data) implements ApplicationjsonSchema1Boxed { - @Override - public @Nullable Object getData() { - return data; - } - } - - - public static class ApplicationjsonSchema1 extends JsonSchema implements NullSchemaValidator, BooleanSchemaValidator, NumberSchemaValidator, StringSchemaValidator, ListSchemaValidator, ApplicationjsonSchema1BoxedList>, MapSchemaValidator, ApplicationjsonSchema1BoxedMap> { - private static @Nullable ApplicationjsonSchema1 instance = null; - - protected ApplicationjsonSchema1() { - super(new JsonSchemaInfo() - .allOf(List.of( - Applicationjson0.class - )) - ); - } - - public static ApplicationjsonSchema1 getInstance() { - if (instance == null) { - instance = new ApplicationjsonSchema1(); - } - return instance; - } - - @Override - public Nothing? validate(Nothing? arg, SchemaConfiguration configuration) throws ValidationException { - Set> pathSet = new HashSet<>(); - List pathToItem = List.of("args[0]"); - Nothing? castArg = castToAllowedTypes(arg, pathToItem, pathSet); - SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().build())); - PathToSchemasMap validatedPathToSchemas = new PathToSchemasMap(); - ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, new LinkedHashSet<>()); - getPathToSchemas(this, castArg, validationMetadata, pathSet); - return castArg; - } - - @Override - public boolean validate(boolean arg, SchemaConfiguration configuration) throws ValidationException { - Set> pathSet = new HashSet<>(); - List pathToItem = List.of("args[0]"); - boolean castArg = castToAllowedTypes(arg, pathToItem, pathSet); - SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().build())); - PathToSchemasMap validatedPathToSchemas = new PathToSchemasMap(); - ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, new LinkedHashSet<>()); - getPathToSchemas(this, castArg, validationMetadata, pathSet); - return castArg; - } - - @Override - public Number validate(Number arg, SchemaConfiguration configuration) throws ValidationException { - Set> pathSet = new HashSet<>(); - List pathToItem = List.of("args[0]"); - Number castArg = castToAllowedTypes(arg, pathToItem, pathSet); - SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().build())); - PathToSchemasMap validatedPathToSchemas = new PathToSchemasMap(); - ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, new LinkedHashSet<>()); - getPathToSchemas(this, castArg, validationMetadata, pathSet); - return castArg; - } - - public int validate(int arg, SchemaConfiguration configuration) throws ValidationException { - return (int) validate((Number) arg, configuration); - } - - public long validate(long arg, SchemaConfiguration configuration) throws ValidationException { - return (long) validate((Number) arg, configuration); - } - - public float validate(float arg, SchemaConfiguration configuration) throws ValidationException { - return (float) validate((Number) arg, configuration); - } - - public double validate(double arg, SchemaConfiguration configuration) throws ValidationException { - return (double) validate((Number) arg, configuration); - } - - @Override - public String validate(String arg, SchemaConfiguration configuration) throws ValidationException { - Set> pathSet = new HashSet<>(); - List pathToItem = List.of("args[0]"); - String castArg = castToAllowedTypes(arg, pathToItem, pathSet); - SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().build())); - PathToSchemasMap validatedPathToSchemas = new PathToSchemasMap(); - ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, new LinkedHashSet<>()); - getPathToSchemas(this, castArg, validationMetadata, pathSet); - return castArg; - } - - public String validate(LocalDate arg, SchemaConfiguration configuration) throws ValidationException { - return validate(arg.toString(), configuration); - } - - public String validate(ZonedDateTime arg, SchemaConfiguration configuration) throws ValidationException { - return validate(arg.toString(), configuration); - } - - public String validate(UUID arg, SchemaConfiguration configuration) throws ValidationException { - return validate(arg.toString(), configuration); - } - - @Override - public FrozenList<@Nullable Object> getNewInstance(List arg, List pathToItem, PathToSchemasMap pathToSchemas) { - List<@Nullable Object> items = new ArrayList<>(); - int i = 0; - for (Object item: arg) { - List itemPathToItem = new ArrayList<>(pathToItem); - itemPathToItem.add(i); - LinkedHashMap, Nothing?> schemas = pathToSchemas.get(itemPathToItem); - if (schemas == null) { - throw new RuntimeException("Validation result is invalid, schemas must exist for a pathToItem"); - } - JsonSchema itemSchema = schemas.entrySet().iterator().next().getKey(); - @Nullable Object itemInstance = itemSchema.getNewInstance(item, itemPathToItem, pathToSchemas); - items.add(itemInstance); - i += 1; - } - FrozenList<@Nullable Object> newInstanceItems = new FrozenList<>(items); - return newInstanceItems; - } - - 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); - SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().build())); - ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, new PathToSchemasMap(), new LinkedHashSet<>()); - PathToSchemasMap pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet); - return getNewInstance(castArg, validationMetadata.pathToItem(), pathToSchemasMap); - } - - @Override - 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 RuntimeException("Invalid non-string key value"); - } - String propertyName = (String) entryKey; - List propertyPathToItem = new ArrayList<>(pathToItem); - propertyPathToItem.add(propertyName); - Object value = entry.getValue(); - LinkedHashMap, Nothing?> schemas = pathToSchemas.get(propertyPathToItem); - if (schemas == null) { - throw new RuntimeException("Validation result is invalid, schemas must exist for a pathToItem"); - } - JsonSchema propertySchema = schemas.entrySet().iterator().next().getKey(); - @Nullable Object propertyInstance = propertySchema.getNewInstance(value, propertyPathToItem, pathToSchemas); - properties.put(propertyName, propertyInstance); - } - FrozenMap<@Nullable Object> castProperties = new FrozenMap<>(properties); - return castProperties; - } - - public FrozenMap<@Nullable Object> validate(Map arg, SchemaConfiguration configuration) throws ValidationException { - Set> pathSet = new HashSet<>(); - List pathToItem = List.of("args[0]"); - Map castArg = castToAllowedTypes(arg, pathToItem, pathSet); - SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().build())); - PathToSchemasMap validatedPathToSchemas = new PathToSchemasMap(); - ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, new LinkedHashSet<>()); - PathToSchemasMap pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet); - return getNewInstance(castArg, validationMetadata.pathToItem(), pathToSchemasMap); - } - - @Override - public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { - if (arg == null) { - return validate((Nothing?) null, configuration); - } else if (arg instanceof Boolean) { - boolean boolArg = (Boolean) arg; - return validate(boolArg, configuration); - } else if (arg instanceof Number) { - return validate((Number) arg, configuration); - } else if (arg instanceof String) { - return validate((String) arg, configuration); - } else if (arg instanceof List) { - return validate((List) arg, 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"); - } - @Override - public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { - if (arg == null) { - return getNewInstance((Nothing?) null, pathToItem, pathToSchemas); - } else if (arg instanceof Boolean) { - boolean boolArg = (Boolean) arg; - return getNewInstance(boolArg, pathToItem, pathToSchemas); - } else if (arg instanceof Number) { - return getNewInstance((Number) arg, pathToItem, pathToSchemas); - } else if (arg instanceof String) { - return getNewInstance((String) arg, pathToItem, pathToSchemas); - } else if (arg instanceof List) { - return getNewInstance((List) arg, 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"); - } - @Override - public ApplicationjsonSchema1BoxedVoid validateAndBox(Nothing? arg, SchemaConfiguration configuration) throws ValidationException { - return new ApplicationjsonSchema1BoxedVoid(validate(arg, configuration)); - } - @Override - 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 { - return new ApplicationjsonSchema1BoxedNumber(validate(arg, configuration)); - } - @Override - 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 { - return new ApplicationjsonSchema1BoxedList(validate(arg, configuration)); - } - @Override - 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 { - if (arg == null) { - Nothing? castArg = (Nothing?) arg; - return validateAndBox(castArg, configuration); - } else if (arg instanceof Boolean booleanArg) { - boolean castArg = booleanArg; - return validateAndBox(castArg, configuration); - } else if (arg instanceof String castArg) { - return validateAndBox(castArg, configuration); - } else if (arg instanceof Number castArg) { - return validateAndBox(castArg, configuration); - } else if (arg instanceof List castArg) { - 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"); - } - } -} diff --git a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/fakeinlinecomposition/post/responses/code200response/content/multipartformdata/MultipartformdataSchema.kt b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/fakeinlinecomposition/post/responses/code200response/content/multipartformdata/MultipartformdataSchema.kt deleted file mode 100644 index fe47b48226b..00000000000 --- a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/fakeinlinecomposition/post/responses/code200response/content/multipartformdata/MultipartformdataSchema.kt +++ /dev/null @@ -1,596 +0,0 @@ -package org.openapijsonschematools.client.paths.fakeinlinecomposition.post.responses.code200response.content.multipartformdata; -import java.time.LocalDate; -import java.time.ZonedDateTime; -import java.util.ArrayList; -import java.util.HashSet; -import java.util.LinkedHashMap; -import java.util.LinkedHashSet; -import java.util.List; -import java.util.Map; -import java.util.Objects; -import java.util.Set; -import java.util.UUID; -import org.checkerframework.checker.nullness.qual.Nullable; -import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags; -import org.openapijsonschematools.client.configurations.SchemaConfiguration; -import org.openapijsonschematools.client.exceptions.InvalidAdditionalPropertyException; -import org.openapijsonschematools.client.exceptions.UnsetPropertyException; -import org.openapijsonschematools.client.exceptions.ValidationException; -import org.openapijsonschematools.client.schemas.GenericBuilder; -import org.openapijsonschematools.client.schemas.UnsetAddPropsSetter; -import org.openapijsonschematools.client.schemas.validation.BooleanSchemaValidator; -import org.openapijsonschematools.client.schemas.validation.FrozenList; -import org.openapijsonschematools.client.schemas.validation.FrozenMap; -import org.openapijsonschematools.client.schemas.validation.JsonSchema; -import org.openapijsonschematools.client.schemas.validation.JsonSchemaInfo; -import org.openapijsonschematools.client.schemas.validation.ListSchemaValidator; -import org.openapijsonschematools.client.schemas.validation.MapSchemaValidator; -import org.openapijsonschematools.client.schemas.validation.NullSchemaValidator; -import org.openapijsonschematools.client.schemas.validation.NumberSchemaValidator; -import org.openapijsonschematools.client.schemas.validation.PathToSchemasMap; -import org.openapijsonschematools.client.schemas.validation.PropertyEntry; -import org.openapijsonschematools.client.schemas.validation.StringSchemaValidator; -import org.openapijsonschematools.client.schemas.validation.ValidationMetadata; - -public class MultipartformdataSchema { - // nest classes so all schemas and input/output classes can be public - - - public sealed interface Multipartformdata0Boxed permits Multipartformdata0BoxedString { - @Nullable Object getData(); - } - - public record Multipartformdata0BoxedString(String data) implements Multipartformdata0Boxed { - @Override - public @Nullable Object getData() { - return data; - } - } - - - - public static class Multipartformdata0 extends JsonSchema implements StringSchemaValidator { - private static @Nullable Multipartformdata0 instance = null; - - protected Multipartformdata0() { - super(new JsonSchemaInfo() - .type(Set.of( - String.class - )) - .minLength(1) - ); - } - - public static Multipartformdata0 getInstance() { - if (instance == null) { - instance = new Multipartformdata0(); - } - return instance; - } - - @Override - public String validate(String arg, SchemaConfiguration configuration) throws ValidationException { - Set> pathSet = new HashSet<>(); - List pathToItem = List.of("args[0"); - String castArg = castToAllowedTypes(arg, pathToItem, pathSet); - SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().build())); - ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, new PathToSchemasMap(), new LinkedHashSet<>()); - getPathToSchemas(this, castArg, validationMetadata, pathSet); - return castArg; - } - - @Override - public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws 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"); - } - @Override - public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { - 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"); - } - @Override - 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 { - 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"); - } - } - - public sealed interface MultipartformdataSomePropBoxed permits MultipartformdataSomePropBoxedVoid, MultipartformdataSomePropBoxedBoolean, MultipartformdataSomePropBoxedNumber, MultipartformdataSomePropBoxedString, MultipartformdataSomePropBoxedList, MultipartformdataSomePropBoxedMap { - @Nullable Object getData(); - } - - public record MultipartformdataSomePropBoxedVoid(Nothing? data) implements MultipartformdataSomePropBoxed { - @Override - public @Nullable Object getData() { - return data; - } - } - - public record MultipartformdataSomePropBoxedBoolean(boolean data) implements MultipartformdataSomePropBoxed { - @Override - public @Nullable Object getData() { - return data; - } - } - - public record MultipartformdataSomePropBoxedNumber(Number data) implements MultipartformdataSomePropBoxed { - @Override - public @Nullable Object getData() { - return data; - } - } - - public record MultipartformdataSomePropBoxedString(String data) implements MultipartformdataSomePropBoxed { - @Override - public @Nullable Object getData() { - return data; - } - } - - public record MultipartformdataSomePropBoxedList(FrozenList<@Nullable Object> data) implements MultipartformdataSomePropBoxed { - @Override - public @Nullable Object getData() { - return data; - } - } - - public record MultipartformdataSomePropBoxedMap(FrozenMap<@Nullable Object> data) implements MultipartformdataSomePropBoxed { - @Override - public @Nullable Object getData() { - return data; - } - } - - - public static class MultipartformdataSomeProp extends JsonSchema implements NullSchemaValidator, BooleanSchemaValidator, NumberSchemaValidator, StringSchemaValidator, ListSchemaValidator, MultipartformdataSomePropBoxedList>, MapSchemaValidator, MultipartformdataSomePropBoxedMap> { - private static @Nullable MultipartformdataSomeProp instance = null; - - protected MultipartformdataSomeProp() { - super(new JsonSchemaInfo() - .allOf(List.of( - Multipartformdata0.class - )) - ); - } - - public static MultipartformdataSomeProp getInstance() { - if (instance == null) { - instance = new MultipartformdataSomeProp(); - } - return instance; - } - - @Override - public Nothing? validate(Nothing? arg, SchemaConfiguration configuration) throws ValidationException { - Set> pathSet = new HashSet<>(); - List pathToItem = List.of("args[0]"); - Nothing? castArg = castToAllowedTypes(arg, pathToItem, pathSet); - SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().build())); - PathToSchemasMap validatedPathToSchemas = new PathToSchemasMap(); - ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, new LinkedHashSet<>()); - getPathToSchemas(this, castArg, validationMetadata, pathSet); - return castArg; - } - - @Override - public boolean validate(boolean arg, SchemaConfiguration configuration) throws ValidationException { - Set> pathSet = new HashSet<>(); - List pathToItem = List.of("args[0]"); - boolean castArg = castToAllowedTypes(arg, pathToItem, pathSet); - SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().build())); - PathToSchemasMap validatedPathToSchemas = new PathToSchemasMap(); - ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, new LinkedHashSet<>()); - getPathToSchemas(this, castArg, validationMetadata, pathSet); - return castArg; - } - - @Override - public Number validate(Number arg, SchemaConfiguration configuration) throws ValidationException { - Set> pathSet = new HashSet<>(); - List pathToItem = List.of("args[0]"); - Number castArg = castToAllowedTypes(arg, pathToItem, pathSet); - SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().build())); - PathToSchemasMap validatedPathToSchemas = new PathToSchemasMap(); - ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, new LinkedHashSet<>()); - getPathToSchemas(this, castArg, validationMetadata, pathSet); - return castArg; - } - - public int validate(int arg, SchemaConfiguration configuration) throws ValidationException { - return (int) validate((Number) arg, configuration); - } - - public long validate(long arg, SchemaConfiguration configuration) throws ValidationException { - return (long) validate((Number) arg, configuration); - } - - public float validate(float arg, SchemaConfiguration configuration) throws ValidationException { - return (float) validate((Number) arg, configuration); - } - - public double validate(double arg, SchemaConfiguration configuration) throws ValidationException { - return (double) validate((Number) arg, configuration); - } - - @Override - public String validate(String arg, SchemaConfiguration configuration) throws ValidationException { - Set> pathSet = new HashSet<>(); - List pathToItem = List.of("args[0]"); - String castArg = castToAllowedTypes(arg, pathToItem, pathSet); - SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().build())); - PathToSchemasMap validatedPathToSchemas = new PathToSchemasMap(); - ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, new LinkedHashSet<>()); - getPathToSchemas(this, castArg, validationMetadata, pathSet); - return castArg; - } - - public String validate(LocalDate arg, SchemaConfiguration configuration) throws ValidationException { - return validate(arg.toString(), configuration); - } - - public String validate(ZonedDateTime arg, SchemaConfiguration configuration) throws ValidationException { - return validate(arg.toString(), configuration); - } - - public String validate(UUID arg, SchemaConfiguration configuration) throws ValidationException { - return validate(arg.toString(), configuration); - } - - @Override - public FrozenList<@Nullable Object> getNewInstance(List arg, List pathToItem, PathToSchemasMap pathToSchemas) { - List<@Nullable Object> items = new ArrayList<>(); - int i = 0; - for (Object item: arg) { - List itemPathToItem = new ArrayList<>(pathToItem); - itemPathToItem.add(i); - LinkedHashMap, Nothing?> schemas = pathToSchemas.get(itemPathToItem); - if (schemas == null) { - throw new RuntimeException("Validation result is invalid, schemas must exist for a pathToItem"); - } - JsonSchema itemSchema = schemas.entrySet().iterator().next().getKey(); - @Nullable Object itemInstance = itemSchema.getNewInstance(item, itemPathToItem, pathToSchemas); - items.add(itemInstance); - i += 1; - } - FrozenList<@Nullable Object> newInstanceItems = new FrozenList<>(items); - return newInstanceItems; - } - - 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); - SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().build())); - ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, new PathToSchemasMap(), new LinkedHashSet<>()); - PathToSchemasMap pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet); - return getNewInstance(castArg, validationMetadata.pathToItem(), pathToSchemasMap); - } - - @Override - 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 RuntimeException("Invalid non-string key value"); - } - String propertyName = (String) entryKey; - List propertyPathToItem = new ArrayList<>(pathToItem); - propertyPathToItem.add(propertyName); - Object value = entry.getValue(); - LinkedHashMap, Nothing?> schemas = pathToSchemas.get(propertyPathToItem); - if (schemas == null) { - throw new RuntimeException("Validation result is invalid, schemas must exist for a pathToItem"); - } - JsonSchema propertySchema = schemas.entrySet().iterator().next().getKey(); - @Nullable Object propertyInstance = propertySchema.getNewInstance(value, propertyPathToItem, pathToSchemas); - properties.put(propertyName, propertyInstance); - } - FrozenMap<@Nullable Object> castProperties = new FrozenMap<>(properties); - return castProperties; - } - - public FrozenMap<@Nullable Object> validate(Map arg, SchemaConfiguration configuration) throws ValidationException { - Set> pathSet = new HashSet<>(); - List pathToItem = List.of("args[0]"); - Map castArg = castToAllowedTypes(arg, pathToItem, pathSet); - SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().build())); - PathToSchemasMap validatedPathToSchemas = new PathToSchemasMap(); - ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, new LinkedHashSet<>()); - PathToSchemasMap pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet); - return getNewInstance(castArg, validationMetadata.pathToItem(), pathToSchemasMap); - } - - @Override - public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { - if (arg == null) { - return validate((Nothing?) null, configuration); - } else if (arg instanceof Boolean) { - boolean boolArg = (Boolean) arg; - return validate(boolArg, configuration); - } else if (arg instanceof Number) { - return validate((Number) arg, configuration); - } else if (arg instanceof String) { - return validate((String) arg, configuration); - } else if (arg instanceof List) { - return validate((List) arg, 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"); - } - @Override - public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { - if (arg == null) { - return getNewInstance((Nothing?) null, pathToItem, pathToSchemas); - } else if (arg instanceof Boolean) { - boolean boolArg = (Boolean) arg; - return getNewInstance(boolArg, pathToItem, pathToSchemas); - } else if (arg instanceof Number) { - return getNewInstance((Number) arg, pathToItem, pathToSchemas); - } else if (arg instanceof String) { - return getNewInstance((String) arg, pathToItem, pathToSchemas); - } else if (arg instanceof List) { - return getNewInstance((List) arg, 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"); - } - @Override - public MultipartformdataSomePropBoxedVoid validateAndBox(Nothing? arg, SchemaConfiguration configuration) throws ValidationException { - return new MultipartformdataSomePropBoxedVoid(validate(arg, configuration)); - } - @Override - 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 { - return new MultipartformdataSomePropBoxedNumber(validate(arg, configuration)); - } - @Override - 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 { - return new MultipartformdataSomePropBoxedList(validate(arg, configuration)); - } - @Override - 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 { - if (arg == null) { - Nothing? castArg = (Nothing?) arg; - return validateAndBox(castArg, configuration); - } else if (arg instanceof Boolean booleanArg) { - boolean castArg = booleanArg; - return validateAndBox(castArg, configuration); - } else if (arg instanceof String castArg) { - return validateAndBox(castArg, configuration); - } else if (arg instanceof Number castArg) { - return validateAndBox(castArg, configuration); - } else if (arg instanceof List castArg) { - 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"); - } - } - - public static class MultipartformdataSchemaMap extends FrozenMap<@Nullable Object> { - protected MultipartformdataSchemaMap(FrozenMap<@Nullable Object> m) { - super(m); - } - public static final Set requiredKeys = Set.of(); - public static final Set optionalKeys = Set.of( - "someProp" - ); - public static MultipartformdataSchemaMap of(Map arg, SchemaConfiguration configuration) throws ValidationException { - return MultipartformdataSchema1.getInstance().validate(arg, configuration); - } - - public @Nullable Object someProp() throws UnsetPropertyException { - return getOrThrow("someProp"); - } - - public @Nullable Object getAdditionalProperty(String name) throws UnsetPropertyException, InvalidAdditionalPropertyException { - throwIfKeyKnown(name, requiredKeys, optionalKeys); - throwIfKeyNotPresent(name); - return get(name); - } - } - - public interface SetterForMultipartformdataSomeProp { - Map getInstance(); - T getBuilderAfterMultipartformdataSomeProp(Map instance); - - default T someProp(Nothing? value) { - var instance = getInstance(); - instance.put("someProp", null); - return getBuilderAfterMultipartformdataSomeProp(instance); - } - - default T someProp(boolean value) { - var instance = getInstance(); - instance.put("someProp", value); - return getBuilderAfterMultipartformdataSomeProp(instance); - } - - default T someProp(String value) { - var instance = getInstance(); - instance.put("someProp", value); - return getBuilderAfterMultipartformdataSomeProp(instance); - } - - default T someProp(int value) { - var instance = getInstance(); - instance.put("someProp", value); - return getBuilderAfterMultipartformdataSomeProp(instance); - } - - default T someProp(float value) { - var instance = getInstance(); - instance.put("someProp", value); - return getBuilderAfterMultipartformdataSomeProp(instance); - } - - default T someProp(long value) { - var instance = getInstance(); - instance.put("someProp", value); - return getBuilderAfterMultipartformdataSomeProp(instance); - } - - default T someProp(double value) { - var instance = getInstance(); - instance.put("someProp", value); - return getBuilderAfterMultipartformdataSomeProp(instance); - } - - default T someProp(List value) { - var instance = getInstance(); - instance.put("someProp", value); - return getBuilderAfterMultipartformdataSomeProp(instance); - } - - default T someProp(Map value) { - var instance = getInstance(); - instance.put("someProp", value); - return getBuilderAfterMultipartformdataSomeProp(instance); - } - } - - public static class MultipartformdataSchemaMapBuilder extends UnsetAddPropsSetter implements GenericBuilder>, SetterForMultipartformdataSomeProp { - private final Map instance; - private static final Set knownKeys = Set.of( - "someProp" - ); - public Set getKnownKeys() { - return knownKeys; - } - public MultipartformdataSchemaMapBuilder() { - this.instance = new LinkedHashMap<>(); - } - public Map build() { - return instance; - } - public Map getInstance() { - return instance; - } - public MultipartformdataSchemaMapBuilder getBuilderAfterMultipartformdataSomeProp(Map instance) { - return this; - } - public MultipartformdataSchemaMapBuilder getBuilderAfterAdditionalProperty(Map instance) { - return this; - } - } - - - public sealed interface MultipartformdataSchema1Boxed permits MultipartformdataSchema1BoxedMap { - @Nullable Object getData(); - } - - public record MultipartformdataSchema1BoxedMap(MultipartformdataSchemaMap data) implements MultipartformdataSchema1Boxed { - @Override - public @Nullable Object getData() { - return data; - } - } - - - public static class MultipartformdataSchema1 extends JsonSchema implements MapSchemaValidator { - private static @Nullable MultipartformdataSchema1 instance = null; - - protected MultipartformdataSchema1() { - super(new JsonSchemaInfo() - .type(Set.of(Map.class)) - .properties(Map.ofEntries( - new PropertyEntry("someProp", MultipartformdataSomeProp.class) - )) - ); - } - - public static MultipartformdataSchema1 getInstance() { - if (instance == null) { - instance = new MultipartformdataSchema1(); - } - return instance; - } - - 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 RuntimeException("Invalid non-string key value"); - } - String propertyName = (String) entryKey; - List propertyPathToItem = new ArrayList<>(pathToItem); - propertyPathToItem.add(propertyName); - Object value = entry.getValue(); - LinkedHashMap, Nothing?> schemas = pathToSchemas.get(propertyPathToItem); - if (schemas == null) { - throw new RuntimeException("Validation result is invalid, schemas must exist for a pathToItem"); - } - JsonSchema propertySchema = schemas.entrySet().iterator().next().getKey(); - @Nullable Object propertyInstance = propertySchema.getNewInstance(value, propertyPathToItem, pathToSchemas); - properties.put(propertyName, propertyInstance); - } - FrozenMap<@Nullable Object> castProperties = new FrozenMap<>(properties); - return new MultipartformdataSchemaMap(castProperties); - } - - 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); - SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().build())); - ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, new PathToSchemasMap(), new LinkedHashSet<>()); - PathToSchemasMap pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet); - return getNewInstance(castArg, validationMetadata.pathToItem(), pathToSchemasMap); - } - - - @Override - public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws 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"); - } - @Override - public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { - if (arg instanceof Map) { - return getNewInstance((Map) arg, pathToItem, pathToSchemas); - } - 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 { - return new MultipartformdataSchema1BoxedMap(validate(arg, configuration)); - } - @Override - public MultipartformdataSchema1Boxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { - 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"); - } - } - -} diff --git a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/fakejsonformdata/FakejsonformdataGet.kt b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/fakejsonformdata/FakejsonformdataGet.kt deleted file mode 100644 index d0ab6bd7642..00000000000 --- a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/fakejsonformdata/FakejsonformdataGet.kt +++ /dev/null @@ -1,152 +0,0 @@ -package org.openapijsonschematools.client.paths.fakejsonformdata; - -import org.checkerframework.checker.nullness.qual.Nullable; -import org.openapijsonschematools.client.paths.fakejsonformdata.get.FakejsonformdataGetRequestBody; -import org.openapijsonschematools.client.RootServerInfo; -import org.openapijsonschematools.client.paths.fakejsonformdata.get.FakejsonformdataGetResponses; -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.requestbody.SerializedRequestBody; -import org.openapijsonschematools.client.paths.Fakejsonformdata; - -import java.io.IOException; -import java.util.ArrayList; -import java.net.http.HttpClient; -import java.net.http.HttpRequest; -import java.time.Duration; -import java.util.List; -import java.util.Map; - -public class FakejsonformdataGet { - private static class GetProvider { - private static final String method = "get"; - - public static FakejsonformdataGetResponses.EndpointResponse get( - GetRequest request, - ApiConfiguration apiConfiguration, - SchemaConfiguration schemaConfiguration, - HttpClient client - ) throws IOException, InterruptedException, ValidationException, NotImplementedException, ApiException { - Map> headers = apiConfiguration.getDefaultHeaders(); - - @Nullable SerializedRequestBody serializedRequestBody; - HttpRequest.BodyPublisher bodyPublisher = HttpRequest.BodyPublishers.noBody(); - if (request.requestBody != null) { - serializedRequestBody = new FakejsonformdataGetRequestBody.FakejsonformdataGetRequestBody1().serialize( - request.requestBody - ); - var contentTypeHeaderValues = headers.getOrDefault("Content-Type", new ArrayList<>()); - contentTypeHeaderValues.add(serializedRequestBody.contentType); - bodyPublisher = serializedRequestBody.bodyPublisher; - } - // TODO set this to a map if there is a query security scheme - @Nullable Map queryMap = null; - String host = apiConfiguration.getServer(request.serverIndex).url(); - - String url = host + Fakejsonformdata.path; - var httpRequest = RestClient.getRequest( - url, - method, - bodyPublisher, - headers, - request.timeout - ); - var response = RestClient.getResponse(httpRequest, client); - var responsesDeserializer = new FakejsonformdataGetResponses.FakejsonformdataGetResponses1(); - return responsesDeserializer.deserialize(response, schemaConfiguration); - } - } - - public interface GetOperation { - ApiConfiguration getApiConfiguration(); - SchemaConfiguration getSchemaConfiguration(); - HttpClient getClient(); - default FakejsonformdataGetResponses.EndpointResponse get(GetRequest request) throws IOException, InterruptedException, ValidationException, NotImplementedException, ApiException { - return GetProvider.get(request, getApiConfiguration(), getSchemaConfiguration(), getClient()); - } - } - - public interface JsonFormDataOperation { - ApiConfiguration getApiConfiguration(); - SchemaConfiguration getSchemaConfiguration(); - HttpClient getClient(); - default FakejsonformdataGetResponses.EndpointResponse jsonFormData(GetRequest request) throws IOException, InterruptedException, ValidationException, NotImplementedException, ApiException { - return GetProvider.get(request, getApiConfiguration(), getSchemaConfiguration(), getClient()); - } - } - - public static class Get extends ApiClient implements GetOperation { - public Get(ApiConfiguration apiConfiguration, SchemaConfiguration schemaConfiguration) { - super(apiConfiguration, schemaConfiguration); - } - } - - public static class GetRequest { - public FakejsonformdataGetRequestBody.@Nullable SealedRequestBody requestBody; - public RootServerInfo.@Nullable ServerIndex serverIndex; - public @Nullable Duration timeout; - } - - public interface SetterForRequestBody { - GetRequest getInstance(); - T getBuilderAfterRequestBody(GetRequest instance); - default T requestBody(FakejsonformdataGetRequestBody.SealedRequestBody requestBody) { - var instance = getInstance(); - instance.requestBody = requestBody; - return getBuilderAfterRequestBody(instance); - } - } - - public interface SetterForServerIndex { - GetRequest getInstance(); - T getBuilderAfterServerIndex(GetRequest instance); - default T serverIndex(RootServerInfo.ServerIndex serverIndex) { - var instance = getInstance(); - instance.serverIndex = serverIndex; - return getBuilderAfterServerIndex(instance); - } - } - - public interface SetterForTimeout { - GetRequest getInstance(); - T getBuilderAfterTimeout(GetRequest instance); - default T timeout(Duration timeout) { - var instance = getInstance(); - instance.timeout = timeout; - return getBuilderAfterTimeout(instance); - } - } - - public static class GetRequestBuilder implements SetterForRequestBody, SetterForServerIndex, SetterForTimeout { - private final GetRequest instance; - - public GetRequestBuilder() { - this.instance = new GetRequest(); - } - - public GetRequest build() { - return instance; - } - - public GetRequest getInstance() { - return instance; - } - - public GetRequestBuilder getBuilderAfterRequestBody(GetRequest instance) { - return this; - } - - public GetRequestBuilder getBuilderAfterServerIndex(GetRequest instance) { - return this; - } - - public GetRequestBuilder getBuilderAfterTimeout(GetRequest instance) { - return this; - } - } -} diff --git a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/fakejsonformdata/get/FakejsonformdataGetRequestBody.kt b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/fakejsonformdata/get/FakejsonformdataGetRequestBody.kt deleted file mode 100644 index e96364f4f74..00000000000 --- a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/fakejsonformdata/get/FakejsonformdataGetRequestBody.kt +++ /dev/null @@ -1,49 +0,0 @@ -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; -import org.openapijsonschematools.client.mediatype.MediaType; -import org.openapijsonschematools.client.paths.fakejsonformdata.get.requestbody.content.applicationxwwwformurlencoded.ApplicationxwwwformurlencodedSchema; - -import java.util.AbstractMap; -import java.util.Map; - -public class FakejsonformdataGetRequestBody { - public sealed interface SealedMediaType permits ApplicationxwwwformurlencodedMediaType {} - - public record ApplicationxwwwformurlencodedMediaType(ApplicationxwwwformurlencodedSchema.ApplicationxwwwformurlencodedSchema1 schema) implements SealedMediaType, MediaType { - public ApplicationxwwwformurlencodedMediaType() { - this(ApplicationxwwwformurlencodedSchema.ApplicationxwwwformurlencodedSchema1.getInstance()); - } - @Override - public Nothing? encoding() { - return null; - } - } - - public static class FakejsonformdataGetRequestBody1 extends RequestBodySerializer { - public FakejsonformdataGetRequestBody1() { - super( - Map.ofEntries( - new AbstractMap.SimpleEntry<>("application/x-www-form-urlencoded", new ApplicationxwwwformurlencodedMediaType()) - ), - false - ); - } - - public SerializedRequestBody serialize(SealedRequestBody requestBody) throws NotImplementedException { - ApplicationxwwwformurlencodedRequestBody requestBody0 = (ApplicationxwwwformurlencodedRequestBody) requestBody; - return serialize(requestBody0.contentType(), requestBody0.body().getData()); - } - } - - public sealed interface SealedRequestBody permits ApplicationxwwwformurlencodedRequestBody {} - public record ApplicationxwwwformurlencodedRequestBody(ApplicationxwwwformurlencodedSchema.ApplicationxwwwformurlencodedSchema1Boxed body) implements SealedRequestBody, GenericRequestBody { - @Override - public String contentType() { - return "application/x-www-form-urlencoded"; - } - } -} diff --git a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/fakejsonformdata/get/FakejsonformdataGetResponses.kt b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/fakejsonformdata/get/FakejsonformdataGetResponses.kt deleted file mode 100644 index 345afc917a5..00000000000 --- a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/fakejsonformdata/get/FakejsonformdataGetResponses.kt +++ /dev/null @@ -1,53 +0,0 @@ -package org.openapijsonschematools.client.paths.fakejsonformdata.get; - -import org.openapijsonschematools.client.paths.fakejsonformdata.get.responses.FakejsonformdataGetCode200Response; -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; -import org.checkerframework.checker.nullness.qual.Nullable; - -import java.net.http.HttpResponse; -import java.util.Map; -import java.util.AbstractMap; - -public class FakejsonformdataGetResponses { - public sealed interface EndpointResponse permits EndpointFakejsonformdataGetCode200Response {} - - public record EndpointFakejsonformdataGetCode200Response( - HttpResponse response, - Nothing? body, - Nothing? headers - ) implements EndpointResponse, ApiResponse{ - } - - public sealed interface StatusCodeResponseDeserializer permits StatusFakejsonformdataGetCode200ResponseDeserializer {} - - public static final class StatusFakejsonformdataGetCode200ResponseDeserializer extends FakejsonformdataGetCode200Response.FakejsonformdataGetCode200Response1 implements StatusCodeResponseDeserializer { - } - - public static final class FakejsonformdataGetResponses1 implements ResponsesDeserializer { - private final Map statusCodeToResponseDeserializer; - public FakejsonformdataGetResponses1() { - this.statusCodeToResponseDeserializer = Map.ofEntries( - new AbstractMap.SimpleEntry<>("200", new StatusFakejsonformdataGetCode200ResponseDeserializer()) - ); - } - - 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) { - throw new ApiException( - "Invalid response statusCode="+statusCode+" has no response defined in the openapi document", - response - ); - } - StatusFakejsonformdataGetCode200ResponseDeserializer castDeserializer = (StatusFakejsonformdataGetCode200ResponseDeserializer) statusCodeDeserializer; - var deserializedResponse = castDeserializer.deserialize(response, configuration); - return new EndpointFakejsonformdataGetCode200Response(response, deserializedResponse.body(), deserializedResponse.headers()); - } - } -} diff --git a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/fakejsonformdata/get/requestbody/content/applicationxwwwformurlencoded/ApplicationxwwwformurlencodedSchema.kt b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/fakejsonformdata/get/requestbody/content/applicationxwwwformurlencoded/ApplicationxwwwformurlencodedSchema.kt deleted file mode 100644 index d36bfe68e9b..00000000000 --- a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/fakejsonformdata/get/requestbody/content/applicationxwwwformurlencoded/ApplicationxwwwformurlencodedSchema.kt +++ /dev/null @@ -1,274 +0,0 @@ -package org.openapijsonschematools.client.paths.fakejsonformdata.get.requestbody.content.applicationxwwwformurlencoded; -import java.util.ArrayList; -import java.util.HashSet; -import java.util.LinkedHashMap; -import java.util.LinkedHashSet; -import java.util.List; -import java.util.Map; -import java.util.Objects; -import java.util.Set; -import org.checkerframework.checker.nullness.qual.Nullable; -import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags; -import org.openapijsonschematools.client.configurations.SchemaConfiguration; -import org.openapijsonschematools.client.exceptions.InvalidAdditionalPropertyException; -import org.openapijsonschematools.client.exceptions.UnsetPropertyException; -import org.openapijsonschematools.client.exceptions.ValidationException; -import org.openapijsonschematools.client.schemas.GenericBuilder; -import org.openapijsonschematools.client.schemas.StringJsonSchema; -import org.openapijsonschematools.client.schemas.UnsetAddPropsSetter; -import org.openapijsonschematools.client.schemas.validation.FrozenMap; -import org.openapijsonschematools.client.schemas.validation.JsonSchema; -import org.openapijsonschematools.client.schemas.validation.JsonSchemaInfo; -import org.openapijsonschematools.client.schemas.validation.MapSchemaValidator; -import org.openapijsonschematools.client.schemas.validation.PathToSchemasMap; -import org.openapijsonschematools.client.schemas.validation.PropertyEntry; -import org.openapijsonschematools.client.schemas.validation.ValidationMetadata; - -public class ApplicationxwwwformurlencodedSchema { - // nest classes so all schemas and input/output classes can be public - - - public static class ApplicationxwwwformurlencodedParam extends StringJsonSchema.StringJsonSchema1 { - private static @Nullable ApplicationxwwwformurlencodedParam instance = null; - public static ApplicationxwwwformurlencodedParam getInstance() { - if (instance == null) { - instance = new ApplicationxwwwformurlencodedParam(); - } - return instance; - } - } - - - public static class ApplicationxwwwformurlencodedParam2 extends StringJsonSchema.StringJsonSchema1 { - private static @Nullable ApplicationxwwwformurlencodedParam2 instance = null; - public static ApplicationxwwwformurlencodedParam2 getInstance() { - if (instance == null) { - instance = new ApplicationxwwwformurlencodedParam2(); - } - return instance; - } - } - - - public static class ApplicationxwwwformurlencodedSchemaMap extends FrozenMap<@Nullable Object> { - protected ApplicationxwwwformurlencodedSchemaMap(FrozenMap<@Nullable Object> m) { - super(m); - } - public static final Set requiredKeys = Set.of( - "param", - "param2" - ); - public static final Set optionalKeys = Set.of(); - public static ApplicationxwwwformurlencodedSchemaMap of(Map arg, SchemaConfiguration configuration) throws ValidationException { - return ApplicationxwwwformurlencodedSchema1.getInstance().validate(arg, configuration); - } - - public String param() { - @Nullable Object value = get("param"); - if (!(value instanceof String)) { - throw new RuntimeException("Invalid value stored for param"); - } - return (String) value; - } - - public String param2() { - @Nullable Object value = get("param2"); - if (!(value instanceof String)) { - throw new RuntimeException("Invalid value stored for param2"); - } - return (String) value; - } - - public @Nullable Object getAdditionalProperty(String name) throws UnsetPropertyException, InvalidAdditionalPropertyException { - throwIfKeyKnown(name, requiredKeys, optionalKeys); - throwIfKeyNotPresent(name); - return get(name); - } - } - - public interface SetterForApplicationxwwwformurlencodedParam { - Map getInstance(); - T getBuilderAfterApplicationxwwwformurlencodedParam(Map instance); - - default T param(String value) { - var instance = getInstance(); - instance.put("param", value); - return getBuilderAfterApplicationxwwwformurlencodedParam(instance); - } - } - - public interface SetterForApplicationxwwwformurlencodedParam2 { - Map getInstance(); - T getBuilderAfterApplicationxwwwformurlencodedParam2(Map instance); - - default T param2(String value) { - var instance = getInstance(); - instance.put("param2", value); - return getBuilderAfterApplicationxwwwformurlencodedParam2(instance); - } - } - - public static class ApplicationxwwwformurlencodedSchemaMap00Builder extends UnsetAddPropsSetter implements GenericBuilder> { - private final Map instance; - private static final Set knownKeys = Set.of( - "param", - "param2" - ); - public Set getKnownKeys() { - return knownKeys; - } - public ApplicationxwwwformurlencodedSchemaMap00Builder(Map instance) { - this.instance = instance; - } - public Map build() { - return instance; - } - public Map getInstance() { - return instance; - } - public ApplicationxwwwformurlencodedSchemaMap00Builder getBuilderAfterAdditionalProperty(Map instance) { - return this; - } - } - - public static class ApplicationxwwwformurlencodedSchemaMap01Builder implements SetterForApplicationxwwwformurlencodedParam2 { - private final Map instance; - public ApplicationxwwwformurlencodedSchemaMap01Builder(Map instance) { - this.instance = instance; - } - public Map getInstance() { - return instance; - } - public ApplicationxwwwformurlencodedSchemaMap00Builder getBuilderAfterApplicationxwwwformurlencodedParam2(Map instance) { - return new ApplicationxwwwformurlencodedSchemaMap00Builder(instance); - } - } - - public static class ApplicationxwwwformurlencodedSchemaMap10Builder implements SetterForApplicationxwwwformurlencodedParam { - private final Map instance; - public ApplicationxwwwformurlencodedSchemaMap10Builder(Map instance) { - this.instance = instance; - } - public Map getInstance() { - return instance; - } - public ApplicationxwwwformurlencodedSchemaMap00Builder getBuilderAfterApplicationxwwwformurlencodedParam(Map instance) { - return new ApplicationxwwwformurlencodedSchemaMap00Builder(instance); - } - } - - public static class ApplicationxwwwformurlencodedSchemaMapBuilder implements SetterForApplicationxwwwformurlencodedParam, SetterForApplicationxwwwformurlencodedParam2 { - private final Map instance; - public ApplicationxwwwformurlencodedSchemaMapBuilder() { - this.instance = new LinkedHashMap<>(); - } - public Map getInstance() { - return instance; - } - public ApplicationxwwwformurlencodedSchemaMap01Builder getBuilderAfterApplicationxwwwformurlencodedParam(Map instance) { - return new ApplicationxwwwformurlencodedSchemaMap01Builder(instance); - } - public ApplicationxwwwformurlencodedSchemaMap10Builder getBuilderAfterApplicationxwwwformurlencodedParam2(Map instance) { - return new ApplicationxwwwformurlencodedSchemaMap10Builder(instance); - } - } - - - public sealed interface ApplicationxwwwformurlencodedSchema1Boxed permits ApplicationxwwwformurlencodedSchema1BoxedMap { - @Nullable Object getData(); - } - - public record ApplicationxwwwformurlencodedSchema1BoxedMap(ApplicationxwwwformurlencodedSchemaMap data) implements ApplicationxwwwformurlencodedSchema1Boxed { - @Override - public @Nullable Object getData() { - return data; - } - } - - - public static class ApplicationxwwwformurlencodedSchema1 extends JsonSchema implements MapSchemaValidator { - private static @Nullable ApplicationxwwwformurlencodedSchema1 instance = null; - - protected ApplicationxwwwformurlencodedSchema1() { - super(new JsonSchemaInfo() - .type(Set.of(Map.class)) - .properties(Map.ofEntries( - new PropertyEntry("param", ApplicationxwwwformurlencodedParam.class), - new PropertyEntry("param2", ApplicationxwwwformurlencodedParam2.class) - )) - .required(Set.of( - "param", - "param2" - )) - ); - } - - public static ApplicationxwwwformurlencodedSchema1 getInstance() { - if (instance == null) { - instance = new ApplicationxwwwformurlencodedSchema1(); - } - return instance; - } - - 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 RuntimeException("Invalid non-string key value"); - } - String propertyName = (String) entryKey; - List propertyPathToItem = new ArrayList<>(pathToItem); - propertyPathToItem.add(propertyName); - Object value = entry.getValue(); - LinkedHashMap, Nothing?> schemas = pathToSchemas.get(propertyPathToItem); - if (schemas == null) { - throw new RuntimeException("Validation result is invalid, schemas must exist for a pathToItem"); - } - JsonSchema propertySchema = schemas.entrySet().iterator().next().getKey(); - @Nullable Object propertyInstance = propertySchema.getNewInstance(value, propertyPathToItem, pathToSchemas); - properties.put(propertyName, propertyInstance); - } - FrozenMap<@Nullable Object> castProperties = new FrozenMap<>(properties); - return new ApplicationxwwwformurlencodedSchemaMap(castProperties); - } - - 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); - SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().build())); - ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, new PathToSchemasMap(), new LinkedHashSet<>()); - PathToSchemasMap pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet); - return getNewInstance(castArg, validationMetadata.pathToItem(), pathToSchemasMap); - } - - - @Override - public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws 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"); - } - @Override - public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { - if (arg instanceof Map) { - return getNewInstance((Map) arg, pathToItem, pathToSchemas); - } - 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 { - return new ApplicationxwwwformurlencodedSchema1BoxedMap(validate(arg, configuration)); - } - @Override - public ApplicationxwwwformurlencodedSchema1Boxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { - 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"); - } - } - -} diff --git a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/fakejsonformdata/get/responses/FakejsonformdataGetCode200Response.kt b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/fakejsonformdata/get/responses/FakejsonformdataGetCode200Response.kt deleted file mode 100644 index ea7665e2152..00000000000 --- a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/fakejsonformdata/get/responses/FakejsonformdataGetCode200Response.kt +++ /dev/null @@ -1,7 +0,0 @@ -package org.openapijsonschematools.client.paths.fakejsonformdata.get.responses; - -import org.openapijsonschematools.client.components.responses.SuccessDescriptionOnly; - -public class FakejsonformdataGetCode200Response extends SuccessDescriptionOnly { - public static class FakejsonformdataGetCode200Response1 extends SuccessDescriptionOnly1 {} -} diff --git a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/fakejsonpatch/FakejsonpatchPatch.kt b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/fakejsonpatch/FakejsonpatchPatch.kt deleted file mode 100644 index a13ac896280..00000000000 --- a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/fakejsonpatch/FakejsonpatchPatch.kt +++ /dev/null @@ -1,152 +0,0 @@ -package org.openapijsonschematools.client.paths.fakejsonpatch; - -import org.checkerframework.checker.nullness.qual.Nullable; -import org.openapijsonschematools.client.paths.fakejsonpatch.patch.FakejsonpatchPatchRequestBody; -import org.openapijsonschematools.client.RootServerInfo; -import org.openapijsonschematools.client.paths.fakejsonpatch.patch.FakejsonpatchPatchResponses; -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.requestbody.SerializedRequestBody; -import org.openapijsonschematools.client.paths.Fakejsonpatch; - -import java.io.IOException; -import java.util.ArrayList; -import java.net.http.HttpClient; -import java.net.http.HttpRequest; -import java.time.Duration; -import java.util.List; -import java.util.Map; - -public class FakejsonpatchPatch { - private static class PatchProvider { - private static final String method = "patch"; - - public static FakejsonpatchPatchResponses.EndpointResponse patch( - PatchRequest request, - ApiConfiguration apiConfiguration, - SchemaConfiguration schemaConfiguration, - HttpClient client - ) throws IOException, InterruptedException, ValidationException, NotImplementedException, ApiException { - Map> headers = apiConfiguration.getDefaultHeaders(); - - @Nullable SerializedRequestBody serializedRequestBody; - HttpRequest.BodyPublisher bodyPublisher = HttpRequest.BodyPublishers.noBody(); - if (request.requestBody != null) { - serializedRequestBody = new FakejsonpatchPatchRequestBody.FakejsonpatchPatchRequestBody1().serialize( - request.requestBody - ); - var contentTypeHeaderValues = headers.getOrDefault("Content-Type", new ArrayList<>()); - contentTypeHeaderValues.add(serializedRequestBody.contentType); - bodyPublisher = serializedRequestBody.bodyPublisher; - } - // TODO set this to a map if there is a query security scheme - @Nullable Map queryMap = null; - String host = apiConfiguration.getServer(request.serverIndex).url(); - - String url = host + Fakejsonpatch.path; - var httpRequest = RestClient.getRequest( - url, - method, - bodyPublisher, - headers, - request.timeout - ); - var response = RestClient.getResponse(httpRequest, client); - var responsesDeserializer = new FakejsonpatchPatchResponses.FakejsonpatchPatchResponses1(); - return responsesDeserializer.deserialize(response, schemaConfiguration); - } - } - - public interface PatchOperation { - ApiConfiguration getApiConfiguration(); - SchemaConfiguration getSchemaConfiguration(); - HttpClient getClient(); - default FakejsonpatchPatchResponses.EndpointResponse patch(PatchRequest request) throws IOException, InterruptedException, ValidationException, NotImplementedException, ApiException { - return PatchProvider.patch(request, getApiConfiguration(), getSchemaConfiguration(), getClient()); - } - } - - public interface JsonPatchOperation { - ApiConfiguration getApiConfiguration(); - SchemaConfiguration getSchemaConfiguration(); - HttpClient getClient(); - default FakejsonpatchPatchResponses.EndpointResponse jsonPatch(PatchRequest request) throws IOException, InterruptedException, ValidationException, NotImplementedException, ApiException { - return PatchProvider.patch(request, getApiConfiguration(), getSchemaConfiguration(), getClient()); - } - } - - public static class Patch extends ApiClient implements PatchOperation { - public Patch(ApiConfiguration apiConfiguration, SchemaConfiguration schemaConfiguration) { - super(apiConfiguration, schemaConfiguration); - } - } - - public static class PatchRequest { - public FakejsonpatchPatchRequestBody.@Nullable SealedRequestBody requestBody; - public RootServerInfo.@Nullable ServerIndex serverIndex; - public @Nullable Duration timeout; - } - - public interface SetterForRequestBody { - PatchRequest getInstance(); - T getBuilderAfterRequestBody(PatchRequest instance); - default T requestBody(FakejsonpatchPatchRequestBody.SealedRequestBody requestBody) { - var instance = getInstance(); - instance.requestBody = requestBody; - return getBuilderAfterRequestBody(instance); - } - } - - public interface SetterForServerIndex { - PatchRequest getInstance(); - T getBuilderAfterServerIndex(PatchRequest instance); - default T serverIndex(RootServerInfo.ServerIndex serverIndex) { - var instance = getInstance(); - instance.serverIndex = serverIndex; - return getBuilderAfterServerIndex(instance); - } - } - - public interface SetterForTimeout { - PatchRequest getInstance(); - T getBuilderAfterTimeout(PatchRequest instance); - default T timeout(Duration timeout) { - var instance = getInstance(); - instance.timeout = timeout; - return getBuilderAfterTimeout(instance); - } - } - - public static class PatchRequestBuilder implements SetterForRequestBody, SetterForServerIndex, SetterForTimeout { - private final PatchRequest instance; - - public PatchRequestBuilder() { - this.instance = new PatchRequest(); - } - - public PatchRequest build() { - return instance; - } - - public PatchRequest getInstance() { - return instance; - } - - public PatchRequestBuilder getBuilderAfterRequestBody(PatchRequest instance) { - return this; - } - - public PatchRequestBuilder getBuilderAfterServerIndex(PatchRequest instance) { - return this; - } - - public PatchRequestBuilder getBuilderAfterTimeout(PatchRequest instance) { - return this; - } - } -} diff --git a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/fakejsonpatch/patch/FakejsonpatchPatchRequestBody.kt b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/fakejsonpatch/patch/FakejsonpatchPatchRequestBody.kt deleted file mode 100644 index 7151e0e3bcd..00000000000 --- a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/fakejsonpatch/patch/FakejsonpatchPatchRequestBody.kt +++ /dev/null @@ -1,49 +0,0 @@ -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; -import org.openapijsonschematools.client.mediatype.MediaType; -import org.openapijsonschematools.client.paths.fakejsonpatch.patch.requestbody.content.applicationjsonpatchjson.ApplicationjsonpatchjsonSchema; - -import java.util.AbstractMap; -import java.util.Map; - -public class FakejsonpatchPatchRequestBody { - public sealed interface SealedMediaType permits ApplicationjsonpatchjsonMediaType {} - - public record ApplicationjsonpatchjsonMediaType(ApplicationjsonpatchjsonSchema.ApplicationjsonpatchjsonSchema1 schema) implements SealedMediaType, MediaType { - public ApplicationjsonpatchjsonMediaType() { - this(ApplicationjsonpatchjsonSchema.ApplicationjsonpatchjsonSchema1.getInstance()); - } - @Override - public Nothing? encoding() { - return null; - } - } - - public static class FakejsonpatchPatchRequestBody1 extends RequestBodySerializer { - public FakejsonpatchPatchRequestBody1() { - super( - Map.ofEntries( - new AbstractMap.SimpleEntry<>("application/json-patch+json", new ApplicationjsonpatchjsonMediaType()) - ), - false - ); - } - - public SerializedRequestBody serialize(SealedRequestBody requestBody) throws NotImplementedException { - ApplicationjsonpatchjsonRequestBody requestBody0 = (ApplicationjsonpatchjsonRequestBody) requestBody; - return serialize(requestBody0.contentType(), requestBody0.body().getData()); - } - } - - public sealed interface SealedRequestBody permits ApplicationjsonpatchjsonRequestBody {} - public record ApplicationjsonpatchjsonRequestBody(ApplicationjsonpatchjsonSchema.JSONPatchRequest1Boxed body) implements SealedRequestBody, GenericRequestBody { - @Override - public String contentType() { - return "application/json-patch+json"; - } - } -} diff --git a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/fakejsonpatch/patch/FakejsonpatchPatchResponses.kt b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/fakejsonpatch/patch/FakejsonpatchPatchResponses.kt deleted file mode 100644 index 8710f344caf..00000000000 --- a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/fakejsonpatch/patch/FakejsonpatchPatchResponses.kt +++ /dev/null @@ -1,53 +0,0 @@ -package org.openapijsonschematools.client.paths.fakejsonpatch.patch; - -import org.openapijsonschematools.client.paths.fakejsonpatch.patch.responses.FakejsonpatchPatchCode200Response; -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; -import org.checkerframework.checker.nullness.qual.Nullable; - -import java.net.http.HttpResponse; -import java.util.Map; -import java.util.AbstractMap; - -public class FakejsonpatchPatchResponses { - public sealed interface EndpointResponse permits EndpointFakejsonpatchPatchCode200Response {} - - public record EndpointFakejsonpatchPatchCode200Response( - HttpResponse response, - Nothing? body, - Nothing? headers - ) implements EndpointResponse, ApiResponse{ - } - - public sealed interface StatusCodeResponseDeserializer permits StatusFakejsonpatchPatchCode200ResponseDeserializer {} - - public static final class StatusFakejsonpatchPatchCode200ResponseDeserializer extends FakejsonpatchPatchCode200Response.FakejsonpatchPatchCode200Response1 implements StatusCodeResponseDeserializer { - } - - public static final class FakejsonpatchPatchResponses1 implements ResponsesDeserializer { - private final Map statusCodeToResponseDeserializer; - public FakejsonpatchPatchResponses1() { - this.statusCodeToResponseDeserializer = Map.ofEntries( - new AbstractMap.SimpleEntry<>("200", new StatusFakejsonpatchPatchCode200ResponseDeserializer()) - ); - } - - 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) { - throw new ApiException( - "Invalid response statusCode="+statusCode+" has no response defined in the openapi document", - response - ); - } - StatusFakejsonpatchPatchCode200ResponseDeserializer castDeserializer = (StatusFakejsonpatchPatchCode200ResponseDeserializer) statusCodeDeserializer; - var deserializedResponse = castDeserializer.deserialize(response, configuration); - return new EndpointFakejsonpatchPatchCode200Response(response, deserializedResponse.body(), deserializedResponse.headers()); - } - } -} diff --git a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/fakejsonpatch/patch/requestbody/content/applicationjsonpatchjson/ApplicationjsonpatchjsonSchema.kt b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/fakejsonpatch/patch/requestbody/content/applicationjsonpatchjson/ApplicationjsonpatchjsonSchema.kt deleted file mode 100644 index cd05f887749..00000000000 --- a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/fakejsonpatch/patch/requestbody/content/applicationjsonpatchjson/ApplicationjsonpatchjsonSchema.kt +++ /dev/null @@ -1,19 +0,0 @@ -package org.openapijsonschematools.client.paths.fakejsonpatch.patch.requestbody.content.applicationjsonpatchjson; - -import org.checkerframework.checker.nullness.qual.Nullable; -import org.openapijsonschematools.client.components.schemas.JSONPatchRequest; - -public class ApplicationjsonpatchjsonSchema extends JSONPatchRequest { - // $refed class - - - public static class ApplicationjsonpatchjsonSchema1 extends JSONPatchRequest1 { - private static @Nullable ApplicationjsonpatchjsonSchema1 instance = null; - public static ApplicationjsonpatchjsonSchema1 getInstance() { - if (instance == null) { - instance = new ApplicationjsonpatchjsonSchema1(); - } - return instance; - } - } -} diff --git a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/fakejsonpatch/patch/responses/FakejsonpatchPatchCode200Response.kt b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/fakejsonpatch/patch/responses/FakejsonpatchPatchCode200Response.kt deleted file mode 100644 index 9c5391108b0..00000000000 --- a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/fakejsonpatch/patch/responses/FakejsonpatchPatchCode200Response.kt +++ /dev/null @@ -1,7 +0,0 @@ -package org.openapijsonschematools.client.paths.fakejsonpatch.patch.responses; - -import org.openapijsonschematools.client.components.responses.SuccessDescriptionOnly; - -public class FakejsonpatchPatchCode200Response extends SuccessDescriptionOnly { - public static class FakejsonpatchPatchCode200Response1 extends SuccessDescriptionOnly1 {} -} diff --git a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/fakejsonwithcharset/FakejsonwithcharsetPost.kt b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/fakejsonwithcharset/FakejsonwithcharsetPost.kt deleted file mode 100644 index 480a7570011..00000000000 --- a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/fakejsonwithcharset/FakejsonwithcharsetPost.kt +++ /dev/null @@ -1,152 +0,0 @@ -package org.openapijsonschematools.client.paths.fakejsonwithcharset; - -import org.checkerframework.checker.nullness.qual.Nullable; -import org.openapijsonschematools.client.paths.fakejsonwithcharset.post.FakejsonwithcharsetPostRequestBody; -import org.openapijsonschematools.client.RootServerInfo; -import org.openapijsonschematools.client.paths.fakejsonwithcharset.post.FakejsonwithcharsetPostResponses; -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.requestbody.SerializedRequestBody; -import org.openapijsonschematools.client.paths.Fakejsonwithcharset; - -import java.io.IOException; -import java.util.ArrayList; -import java.net.http.HttpClient; -import java.net.http.HttpRequest; -import java.time.Duration; -import java.util.List; -import java.util.Map; - -public class FakejsonwithcharsetPost { - private static class PostProvider { - private static final String method = "post"; - - public static FakejsonwithcharsetPostResponses.EndpointResponse post( - PostRequest request, - ApiConfiguration apiConfiguration, - SchemaConfiguration schemaConfiguration, - HttpClient client - ) throws IOException, InterruptedException, ValidationException, NotImplementedException, ApiException { - Map> headers = apiConfiguration.getDefaultHeaders(); - - @Nullable SerializedRequestBody serializedRequestBody; - HttpRequest.BodyPublisher bodyPublisher = HttpRequest.BodyPublishers.noBody(); - if (request.requestBody != null) { - serializedRequestBody = new FakejsonwithcharsetPostRequestBody.FakejsonwithcharsetPostRequestBody1().serialize( - request.requestBody - ); - var contentTypeHeaderValues = headers.getOrDefault("Content-Type", new ArrayList<>()); - contentTypeHeaderValues.add(serializedRequestBody.contentType); - bodyPublisher = serializedRequestBody.bodyPublisher; - } - // TODO set this to a map if there is a query security scheme - @Nullable Map queryMap = null; - String host = apiConfiguration.getServer(request.serverIndex).url(); - - String url = host + Fakejsonwithcharset.path; - var httpRequest = RestClient.getRequest( - url, - method, - bodyPublisher, - headers, - request.timeout - ); - var response = RestClient.getResponse(httpRequest, client); - var responsesDeserializer = new FakejsonwithcharsetPostResponses.FakejsonwithcharsetPostResponses1(); - return responsesDeserializer.deserialize(response, schemaConfiguration); - } - } - - public interface PostOperation { - ApiConfiguration getApiConfiguration(); - SchemaConfiguration getSchemaConfiguration(); - HttpClient getClient(); - default FakejsonwithcharsetPostResponses.EndpointResponse post(PostRequest request) throws IOException, InterruptedException, ValidationException, NotImplementedException, ApiException { - return PostProvider.post(request, getApiConfiguration(), getSchemaConfiguration(), getClient()); - } - } - - public interface JsonWithCharsetOperation { - ApiConfiguration getApiConfiguration(); - SchemaConfiguration getSchemaConfiguration(); - HttpClient getClient(); - default FakejsonwithcharsetPostResponses.EndpointResponse jsonWithCharset(PostRequest request) throws IOException, InterruptedException, ValidationException, NotImplementedException, ApiException { - return PostProvider.post(request, getApiConfiguration(), getSchemaConfiguration(), getClient()); - } - } - - public static class Post extends ApiClient implements PostOperation { - public Post(ApiConfiguration apiConfiguration, SchemaConfiguration schemaConfiguration) { - super(apiConfiguration, schemaConfiguration); - } - } - - public static class PostRequest { - public FakejsonwithcharsetPostRequestBody.@Nullable SealedRequestBody requestBody; - public RootServerInfo.@Nullable ServerIndex serverIndex; - public @Nullable Duration timeout; - } - - public interface SetterForRequestBody { - PostRequest getInstance(); - T getBuilderAfterRequestBody(PostRequest instance); - default T requestBody(FakejsonwithcharsetPostRequestBody.SealedRequestBody requestBody) { - var instance = getInstance(); - instance.requestBody = requestBody; - return getBuilderAfterRequestBody(instance); - } - } - - public interface SetterForServerIndex { - PostRequest getInstance(); - T getBuilderAfterServerIndex(PostRequest instance); - default T serverIndex(RootServerInfo.ServerIndex serverIndex) { - var instance = getInstance(); - instance.serverIndex = serverIndex; - return getBuilderAfterServerIndex(instance); - } - } - - public interface SetterForTimeout { - PostRequest getInstance(); - T getBuilderAfterTimeout(PostRequest instance); - default T timeout(Duration timeout) { - var instance = getInstance(); - instance.timeout = timeout; - return getBuilderAfterTimeout(instance); - } - } - - public static class PostRequestBuilder implements SetterForRequestBody, SetterForServerIndex, SetterForTimeout { - private final PostRequest instance; - - public PostRequestBuilder() { - this.instance = new PostRequest(); - } - - public PostRequest build() { - return instance; - } - - public PostRequest getInstance() { - return instance; - } - - public PostRequestBuilder getBuilderAfterRequestBody(PostRequest instance) { - return this; - } - - public PostRequestBuilder getBuilderAfterServerIndex(PostRequest instance) { - return this; - } - - public PostRequestBuilder getBuilderAfterTimeout(PostRequest instance) { - return this; - } - } -} diff --git a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/fakejsonwithcharset/post/FakejsonwithcharsetPostRequestBody.kt b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/fakejsonwithcharset/post/FakejsonwithcharsetPostRequestBody.kt deleted file mode 100644 index fa673212daa..00000000000 --- a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/fakejsonwithcharset/post/FakejsonwithcharsetPostRequestBody.kt +++ /dev/null @@ -1,49 +0,0 @@ -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; -import org.openapijsonschematools.client.mediatype.MediaType; -import org.openapijsonschematools.client.paths.fakejsonwithcharset.post.requestbody.content.applicationjsoncharsetutf8.Applicationjsoncharsetutf8Schema; - -import java.util.AbstractMap; -import java.util.Map; - -public class FakejsonwithcharsetPostRequestBody { - public sealed interface SealedMediaType permits Applicationjsoncharsetutf8MediaType {} - - public record Applicationjsoncharsetutf8MediaType(Applicationjsoncharsetutf8Schema.Applicationjsoncharsetutf8Schema1 schema) implements SealedMediaType, MediaType { - public Applicationjsoncharsetutf8MediaType() { - this(Applicationjsoncharsetutf8Schema.Applicationjsoncharsetutf8Schema1.getInstance()); - } - @Override - public Nothing? encoding() { - return null; - } - } - - public static class FakejsonwithcharsetPostRequestBody1 extends RequestBodySerializer { - public FakejsonwithcharsetPostRequestBody1() { - super( - Map.ofEntries( - new AbstractMap.SimpleEntry<>("application/json; charset=utf-8", new Applicationjsoncharsetutf8MediaType()) - ), - false - ); - } - - public SerializedRequestBody serialize(SealedRequestBody requestBody) throws NotImplementedException { - Applicationjsoncharsetutf8RequestBody requestBody0 = (Applicationjsoncharsetutf8RequestBody) requestBody; - return serialize(requestBody0.contentType(), requestBody0.body().getData()); - } - } - - public sealed interface SealedRequestBody permits Applicationjsoncharsetutf8RequestBody {} - public record Applicationjsoncharsetutf8RequestBody(Applicationjsoncharsetutf8Schema.AnyTypeJsonSchema1Boxed body) implements SealedRequestBody, GenericRequestBody { - @Override - public String contentType() { - return "application/json; charset=utf-8"; - } - } -} diff --git a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/fakejsonwithcharset/post/FakejsonwithcharsetPostResponses.kt b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/fakejsonwithcharset/post/FakejsonwithcharsetPostResponses.kt deleted file mode 100644 index 64c157fdca5..00000000000 --- a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/fakejsonwithcharset/post/FakejsonwithcharsetPostResponses.kt +++ /dev/null @@ -1,53 +0,0 @@ -package org.openapijsonschematools.client.paths.fakejsonwithcharset.post; - -import org.openapijsonschematools.client.paths.fakejsonwithcharset.post.responses.FakejsonwithcharsetPostCode200Response; -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; -import org.checkerframework.checker.nullness.qual.Nullable; - -import java.net.http.HttpResponse; -import java.util.Map; -import java.util.AbstractMap; - -public class FakejsonwithcharsetPostResponses { - public sealed interface EndpointResponse permits EndpointFakejsonwithcharsetPostCode200Response {} - - public record EndpointFakejsonwithcharsetPostCode200Response( - HttpResponse response, - FakejsonwithcharsetPostCode200Response.SealedResponseBody body, - Nothing? headers - ) implements EndpointResponse, ApiResponse{ - } - - public sealed interface StatusCodeResponseDeserializer permits StatusFakejsonwithcharsetPostCode200ResponseDeserializer {} - - public static final class StatusFakejsonwithcharsetPostCode200ResponseDeserializer extends FakejsonwithcharsetPostCode200Response.FakejsonwithcharsetPostCode200Response1 implements StatusCodeResponseDeserializer { - } - - public static final class FakejsonwithcharsetPostResponses1 implements ResponsesDeserializer { - private final Map statusCodeToResponseDeserializer; - public FakejsonwithcharsetPostResponses1() { - this.statusCodeToResponseDeserializer = Map.ofEntries( - new AbstractMap.SimpleEntry<>("200", new StatusFakejsonwithcharsetPostCode200ResponseDeserializer()) - ); - } - - 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) { - throw new ApiException( - "Invalid response statusCode="+statusCode+" has no response defined in the openapi document", - response - ); - } - StatusFakejsonwithcharsetPostCode200ResponseDeserializer castDeserializer = (StatusFakejsonwithcharsetPostCode200ResponseDeserializer) statusCodeDeserializer; - var deserializedResponse = castDeserializer.deserialize(response, configuration); - return new EndpointFakejsonwithcharsetPostCode200Response(response, deserializedResponse.body(), deserializedResponse.headers()); - } - } -} diff --git a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/fakejsonwithcharset/post/requestbody/content/applicationjsoncharsetutf8/Applicationjsoncharsetutf8Schema.kt b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/fakejsonwithcharset/post/requestbody/content/applicationjsoncharsetutf8/Applicationjsoncharsetutf8Schema.kt deleted file mode 100644 index 86ea755b112..00000000000 --- a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/fakejsonwithcharset/post/requestbody/content/applicationjsoncharsetutf8/Applicationjsoncharsetutf8Schema.kt +++ /dev/null @@ -1,19 +0,0 @@ -package org.openapijsonschematools.client.paths.fakejsonwithcharset.post.requestbody.content.applicationjsoncharsetutf8; -import org.checkerframework.checker.nullness.qual.Nullable; -import org.openapijsonschematools.client.schemas.AnyTypeJsonSchema; - -public class Applicationjsoncharsetutf8Schema extends AnyTypeJsonSchema { - // nest classes so all schemas and input/output classes can be public - - - public static class Applicationjsoncharsetutf8Schema1 extends AnyTypeJsonSchema.AnyTypeJsonSchema1 { - private static @Nullable Applicationjsoncharsetutf8Schema1 instance = null; - public static Applicationjsoncharsetutf8Schema1 getInstance() { - if (instance == null) { - instance = new Applicationjsoncharsetutf8Schema1(); - } - return instance; - } - } - -} diff --git a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/fakejsonwithcharset/post/responses/FakejsonwithcharsetPostCode200Response.kt b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/fakejsonwithcharset/post/responses/FakejsonwithcharsetPostCode200Response.kt deleted file mode 100644 index 66ecf567a5a..00000000000 --- a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/fakejsonwithcharset/post/responses/FakejsonwithcharsetPostCode200Response.kt +++ /dev/null @@ -1,63 +0,0 @@ -package org.openapijsonschematools.client.paths.fakejsonwithcharset.post.responses; - -import org.openapijsonschematools.client.configurations.SchemaConfiguration; -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; - -import java.util.AbstractMap; -import java.util.Map; -import java.net.http.HttpResponse; -import java.net.http.HttpHeaders; - -public class FakejsonwithcharsetPostCode200Response { - public sealed interface SealedMediaType permits Applicationjsoncharsetutf8MediaType {} - - public record Applicationjsoncharsetutf8MediaType(Applicationjsoncharsetutf8Schema.Applicationjsoncharsetutf8Schema1 schema) implements SealedMediaType, MediaType { - public Applicationjsoncharsetutf8MediaType() { - this(Applicationjsoncharsetutf8Schema.Applicationjsoncharsetutf8Schema1.getInstance()); - } - @Override - public Nothing? encoding() { - return null; - } - } - public sealed interface SealedResponseBody permits Applicationjsoncharsetutf8ResponseBody {} - public record Applicationjsoncharsetutf8ResponseBody(Applicationjsoncharsetutf8Schema.AnyTypeJsonSchema1Boxed body) implements SealedResponseBody { } - - public static class FakejsonwithcharsetPostCode200Response1 extends ResponseDeserializer { - public FakejsonwithcharsetPostCode200Response1() { - super( - Map.ofEntries( - new AbstractMap.SimpleEntry<>("application/json; charset=utf-8", new Applicationjsoncharsetutf8MediaType()) - ) - ); - } - - @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); - } - - @Override - protected Nothing? getHeaders(HttpHeaders headers, SchemaConfiguration configuration) { - return null; - } - } - - @SuppressWarnings("serial") - public static class ResponseApiException extends ApiException { - public DeserializedHttpResponse deserializedResponse; - - public ResponseApiException(String s, HttpResponse response, DeserializedHttpResponse deserializedResponse) { - super(s, response); - this.deserializedResponse = deserializedResponse; - } - } -} diff --git a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/fakejsonwithcharset/post/responses/code200response/content/applicationjsoncharsetutf8/Applicationjsoncharsetutf8Schema.kt b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/fakejsonwithcharset/post/responses/code200response/content/applicationjsoncharsetutf8/Applicationjsoncharsetutf8Schema.kt deleted file mode 100644 index 8e4d5dbf902..00000000000 --- a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/fakejsonwithcharset/post/responses/code200response/content/applicationjsoncharsetutf8/Applicationjsoncharsetutf8Schema.kt +++ /dev/null @@ -1,19 +0,0 @@ -package org.openapijsonschematools.client.paths.fakejsonwithcharset.post.responses.code200response.content.applicationjsoncharsetutf8; -import org.checkerframework.checker.nullness.qual.Nullable; -import org.openapijsonschematools.client.schemas.AnyTypeJsonSchema; - -public class Applicationjsoncharsetutf8Schema extends AnyTypeJsonSchema { - // nest classes so all schemas and input/output classes can be public - - - public static class Applicationjsoncharsetutf8Schema1 extends AnyTypeJsonSchema.AnyTypeJsonSchema1 { - private static @Nullable Applicationjsoncharsetutf8Schema1 instance = null; - public static Applicationjsoncharsetutf8Schema1 getInstance() { - if (instance == null) { - instance = new Applicationjsoncharsetutf8Schema1(); - } - return instance; - } - } - -} diff --git a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/fakemultiplerequestbodycontenttypes/FakemultiplerequestbodycontenttypesPost.kt b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/fakemultiplerequestbodycontenttypes/FakemultiplerequestbodycontenttypesPost.kt deleted file mode 100644 index 585ea8c5680..00000000000 --- a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/fakemultiplerequestbodycontenttypes/FakemultiplerequestbodycontenttypesPost.kt +++ /dev/null @@ -1,152 +0,0 @@ -package org.openapijsonschematools.client.paths.fakemultiplerequestbodycontenttypes; - -import org.checkerframework.checker.nullness.qual.Nullable; -import org.openapijsonschematools.client.paths.fakemultiplerequestbodycontenttypes.post.FakemultiplerequestbodycontenttypesPostRequestBody; -import org.openapijsonschematools.client.RootServerInfo; -import org.openapijsonschematools.client.paths.fakemultiplerequestbodycontenttypes.post.FakemultiplerequestbodycontenttypesPostResponses; -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.requestbody.SerializedRequestBody; -import org.openapijsonschematools.client.paths.Fakemultiplerequestbodycontenttypes; - -import java.io.IOException; -import java.util.ArrayList; -import java.net.http.HttpClient; -import java.net.http.HttpRequest; -import java.time.Duration; -import java.util.List; -import java.util.Map; - -public class FakemultiplerequestbodycontenttypesPost { - private static class PostProvider { - private static final String method = "post"; - - public static FakemultiplerequestbodycontenttypesPostResponses.EndpointResponse post( - PostRequest request, - ApiConfiguration apiConfiguration, - SchemaConfiguration schemaConfiguration, - HttpClient client - ) throws IOException, InterruptedException, ValidationException, NotImplementedException, ApiException { - Map> headers = apiConfiguration.getDefaultHeaders(); - - @Nullable SerializedRequestBody serializedRequestBody; - HttpRequest.BodyPublisher bodyPublisher = HttpRequest.BodyPublishers.noBody(); - if (request.requestBody != null) { - serializedRequestBody = new FakemultiplerequestbodycontenttypesPostRequestBody.FakemultiplerequestbodycontenttypesPostRequestBody1().serialize( - request.requestBody - ); - var contentTypeHeaderValues = headers.getOrDefault("Content-Type", new ArrayList<>()); - contentTypeHeaderValues.add(serializedRequestBody.contentType); - bodyPublisher = serializedRequestBody.bodyPublisher; - } - // TODO set this to a map if there is a query security scheme - @Nullable Map queryMap = null; - String host = apiConfiguration.getServer(request.serverIndex).url(); - - String url = host + Fakemultiplerequestbodycontenttypes.path; - var httpRequest = RestClient.getRequest( - url, - method, - bodyPublisher, - headers, - request.timeout - ); - var response = RestClient.getResponse(httpRequest, client); - var responsesDeserializer = new FakemultiplerequestbodycontenttypesPostResponses.FakemultiplerequestbodycontenttypesPostResponses1(); - return responsesDeserializer.deserialize(response, schemaConfiguration); - } - } - - public interface PostOperation { - ApiConfiguration getApiConfiguration(); - SchemaConfiguration getSchemaConfiguration(); - HttpClient getClient(); - default FakemultiplerequestbodycontenttypesPostResponses.EndpointResponse post(PostRequest request) throws IOException, InterruptedException, ValidationException, NotImplementedException, ApiException { - return PostProvider.post(request, getApiConfiguration(), getSchemaConfiguration(), getClient()); - } - } - - public interface MultipleRequestBodyContentTypesOperation { - ApiConfiguration getApiConfiguration(); - SchemaConfiguration getSchemaConfiguration(); - HttpClient getClient(); - default FakemultiplerequestbodycontenttypesPostResponses.EndpointResponse multipleRequestBodyContentTypes(PostRequest request) throws IOException, InterruptedException, ValidationException, NotImplementedException, ApiException { - return PostProvider.post(request, getApiConfiguration(), getSchemaConfiguration(), getClient()); - } - } - - public static class Post extends ApiClient implements PostOperation { - public Post(ApiConfiguration apiConfiguration, SchemaConfiguration schemaConfiguration) { - super(apiConfiguration, schemaConfiguration); - } - } - - public static class PostRequest { - public FakemultiplerequestbodycontenttypesPostRequestBody.@Nullable SealedRequestBody requestBody; - public RootServerInfo.@Nullable ServerIndex serverIndex; - public @Nullable Duration timeout; - } - - public interface SetterForRequestBody { - PostRequest getInstance(); - T getBuilderAfterRequestBody(PostRequest instance); - default T requestBody(FakemultiplerequestbodycontenttypesPostRequestBody.SealedRequestBody requestBody) { - var instance = getInstance(); - instance.requestBody = requestBody; - return getBuilderAfterRequestBody(instance); - } - } - - public interface SetterForServerIndex { - PostRequest getInstance(); - T getBuilderAfterServerIndex(PostRequest instance); - default T serverIndex(RootServerInfo.ServerIndex serverIndex) { - var instance = getInstance(); - instance.serverIndex = serverIndex; - return getBuilderAfterServerIndex(instance); - } - } - - public interface SetterForTimeout { - PostRequest getInstance(); - T getBuilderAfterTimeout(PostRequest instance); - default T timeout(Duration timeout) { - var instance = getInstance(); - instance.timeout = timeout; - return getBuilderAfterTimeout(instance); - } - } - - public static class PostRequestBuilder implements SetterForRequestBody, SetterForServerIndex, SetterForTimeout { - private final PostRequest instance; - - public PostRequestBuilder() { - this.instance = new PostRequest(); - } - - public PostRequest build() { - return instance; - } - - public PostRequest getInstance() { - return instance; - } - - public PostRequestBuilder getBuilderAfterRequestBody(PostRequest instance) { - return this; - } - - public PostRequestBuilder getBuilderAfterServerIndex(PostRequest instance) { - return this; - } - - public PostRequestBuilder getBuilderAfterTimeout(PostRequest instance) { - return this; - } - } -} diff --git a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/fakemultiplerequestbodycontenttypes/post/FakemultiplerequestbodycontenttypesPostRequestBody.kt b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/fakemultiplerequestbodycontenttypes/post/FakemultiplerequestbodycontenttypesPostRequestBody.kt deleted file mode 100644 index 361d2de4a7d..00000000000 --- a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/fakemultiplerequestbodycontenttypes/post/FakemultiplerequestbodycontenttypesPostRequestBody.kt +++ /dev/null @@ -1,71 +0,0 @@ -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; -import org.openapijsonschematools.client.mediatype.MediaType; -import org.openapijsonschematools.client.paths.fakemultiplerequestbodycontenttypes.post.requestbody.content.applicationjson.ApplicationjsonSchema; -import org.openapijsonschematools.client.paths.fakemultiplerequestbodycontenttypes.post.requestbody.content.multipartformdata.MultipartformdataSchema; - -import java.util.AbstractMap; -import java.util.Map; - -public class FakemultiplerequestbodycontenttypesPostRequestBody { - public sealed interface SealedMediaType permits ApplicationjsonMediaType, MultipartformdataMediaType {} - - public record ApplicationjsonMediaType(ApplicationjsonSchema.ApplicationjsonSchema1 schema) implements SealedMediaType, MediaType { - public ApplicationjsonMediaType() { - this(ApplicationjsonSchema.ApplicationjsonSchema1.getInstance()); - } - @Override - public Nothing? encoding() { - return null; - } - } - - public record MultipartformdataMediaType(MultipartformdataSchema.MultipartformdataSchema1 schema) implements SealedMediaType, MediaType { - public MultipartformdataMediaType() { - this(MultipartformdataSchema.MultipartformdataSchema1.getInstance()); - } - @Override - public Nothing? encoding() { - return null; - } - } - - public static class FakemultiplerequestbodycontenttypesPostRequestBody1 extends RequestBodySerializer { - public FakemultiplerequestbodycontenttypesPostRequestBody1() { - super( - Map.ofEntries( - new AbstractMap.SimpleEntry<>("application/json", new ApplicationjsonMediaType()), - new AbstractMap.SimpleEntry<>("multipart/form-data", new MultipartformdataMediaType()) - ), - false - ); - } - - public SerializedRequestBody serialize(SealedRequestBody requestBody) throws NotImplementedException { - if (requestBody instanceof ApplicationjsonRequestBody requestBody0) { - return serialize(requestBody0.contentType(), requestBody0.body().getData()); - } else { - MultipartformdataRequestBody requestBody1 = (MultipartformdataRequestBody) requestBody; - return serialize(requestBody1.contentType(), requestBody1.body().getData()); - } - } - } - - public sealed interface SealedRequestBody permits ApplicationjsonRequestBody, MultipartformdataRequestBody {} - public record ApplicationjsonRequestBody(ApplicationjsonSchema.ApplicationjsonSchema1Boxed body) implements SealedRequestBody, GenericRequestBody { - @Override - public String contentType() { - return "application/json"; - } - } - public record MultipartformdataRequestBody(MultipartformdataSchema.MultipartformdataSchema1Boxed body) implements SealedRequestBody, GenericRequestBody { - @Override - public String contentType() { - return "multipart/form-data"; - } - } -} diff --git a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/fakemultiplerequestbodycontenttypes/post/FakemultiplerequestbodycontenttypesPostResponses.kt b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/fakemultiplerequestbodycontenttypes/post/FakemultiplerequestbodycontenttypesPostResponses.kt deleted file mode 100644 index 9ec3bfac4a8..00000000000 --- a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/fakemultiplerequestbodycontenttypes/post/FakemultiplerequestbodycontenttypesPostResponses.kt +++ /dev/null @@ -1,53 +0,0 @@ -package org.openapijsonschematools.client.paths.fakemultiplerequestbodycontenttypes.post; - -import org.openapijsonschematools.client.paths.fakemultiplerequestbodycontenttypes.post.responses.FakemultiplerequestbodycontenttypesPostCode200Response; -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; -import org.checkerframework.checker.nullness.qual.Nullable; - -import java.net.http.HttpResponse; -import java.util.Map; -import java.util.AbstractMap; - -public class FakemultiplerequestbodycontenttypesPostResponses { - public sealed interface EndpointResponse permits EndpointFakemultiplerequestbodycontenttypesPostCode200Response {} - - public record EndpointFakemultiplerequestbodycontenttypesPostCode200Response( - HttpResponse response, - FakemultiplerequestbodycontenttypesPostCode200Response.SealedResponseBody body, - Nothing? headers - ) implements EndpointResponse, ApiResponse{ - } - - public sealed interface StatusCodeResponseDeserializer permits StatusFakemultiplerequestbodycontenttypesPostCode200ResponseDeserializer {} - - public static final class StatusFakemultiplerequestbodycontenttypesPostCode200ResponseDeserializer extends FakemultiplerequestbodycontenttypesPostCode200Response.FakemultiplerequestbodycontenttypesPostCode200Response1 implements StatusCodeResponseDeserializer { - } - - public static final class FakemultiplerequestbodycontenttypesPostResponses1 implements ResponsesDeserializer { - private final Map statusCodeToResponseDeserializer; - public FakemultiplerequestbodycontenttypesPostResponses1() { - this.statusCodeToResponseDeserializer = Map.ofEntries( - new AbstractMap.SimpleEntry<>("200", new StatusFakemultiplerequestbodycontenttypesPostCode200ResponseDeserializer()) - ); - } - - 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) { - throw new ApiException( - "Invalid response statusCode="+statusCode+" has no response defined in the openapi document", - response - ); - } - StatusFakemultiplerequestbodycontenttypesPostCode200ResponseDeserializer castDeserializer = (StatusFakemultiplerequestbodycontenttypesPostCode200ResponseDeserializer) statusCodeDeserializer; - var deserializedResponse = castDeserializer.deserialize(response, configuration); - return new EndpointFakemultiplerequestbodycontenttypesPostCode200Response(response, deserializedResponse.body(), deserializedResponse.headers()); - } - } -} diff --git a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/fakemultiplerequestbodycontenttypes/post/requestbody/content/applicationjson/ApplicationjsonSchema.kt b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/fakemultiplerequestbodycontenttypes/post/requestbody/content/applicationjson/ApplicationjsonSchema.kt deleted file mode 100644 index 40be39d7f2e..00000000000 --- a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/fakemultiplerequestbodycontenttypes/post/requestbody/content/applicationjson/ApplicationjsonSchema.kt +++ /dev/null @@ -1,200 +0,0 @@ -package org.openapijsonschematools.client.paths.fakemultiplerequestbodycontenttypes.post.requestbody.content.applicationjson; -import java.util.ArrayList; -import java.util.HashSet; -import java.util.LinkedHashMap; -import java.util.LinkedHashSet; -import java.util.List; -import java.util.Map; -import java.util.Objects; -import java.util.Set; -import org.checkerframework.checker.nullness.qual.Nullable; -import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags; -import org.openapijsonschematools.client.configurations.SchemaConfiguration; -import org.openapijsonschematools.client.exceptions.InvalidAdditionalPropertyException; -import org.openapijsonschematools.client.exceptions.UnsetPropertyException; -import org.openapijsonschematools.client.exceptions.ValidationException; -import org.openapijsonschematools.client.schemas.GenericBuilder; -import org.openapijsonschematools.client.schemas.StringJsonSchema; -import org.openapijsonschematools.client.schemas.UnsetAddPropsSetter; -import org.openapijsonschematools.client.schemas.validation.FrozenMap; -import org.openapijsonschematools.client.schemas.validation.JsonSchema; -import org.openapijsonschematools.client.schemas.validation.JsonSchemaInfo; -import org.openapijsonschematools.client.schemas.validation.MapSchemaValidator; -import org.openapijsonschematools.client.schemas.validation.PathToSchemasMap; -import org.openapijsonschematools.client.schemas.validation.PropertyEntry; -import org.openapijsonschematools.client.schemas.validation.ValidationMetadata; - -public class ApplicationjsonSchema { - // nest classes so all schemas and input/output classes can be public - - - public static class ApplicationjsonA extends StringJsonSchema.StringJsonSchema1 { - private static @Nullable ApplicationjsonA instance = null; - public static ApplicationjsonA getInstance() { - if (instance == null) { - instance = new ApplicationjsonA(); - } - return instance; - } - } - - - public static class ApplicationjsonSchemaMap extends FrozenMap<@Nullable Object> { - protected ApplicationjsonSchemaMap(FrozenMap<@Nullable Object> m) { - super(m); - } - public static final Set requiredKeys = Set.of(); - public static final Set optionalKeys = Set.of( - "a" - ); - public static ApplicationjsonSchemaMap of(Map arg, SchemaConfiguration configuration) throws ValidationException { - return ApplicationjsonSchema1.getInstance().validate(arg, configuration); - } - - public String a() throws UnsetPropertyException { - String key = "a"; - throwIfKeyNotPresent(key); - @Nullable Object value = get(key); - if (!(value instanceof String)) { - throw new RuntimeException("Invalid value stored for a"); - } - return (String) value; - } - - public @Nullable Object getAdditionalProperty(String name) throws UnsetPropertyException, InvalidAdditionalPropertyException { - throwIfKeyKnown(name, requiredKeys, optionalKeys); - throwIfKeyNotPresent(name); - return get(name); - } - } - - public interface SetterForApplicationjsonA { - Map getInstance(); - T getBuilderAfterApplicationjsonA(Map instance); - - default T a(String value) { - var instance = getInstance(); - instance.put("a", value); - return getBuilderAfterApplicationjsonA(instance); - } - } - - public static class ApplicationjsonSchemaMapBuilder extends UnsetAddPropsSetter implements GenericBuilder>, SetterForApplicationjsonA { - private final Map instance; - private static final Set knownKeys = Set.of( - "a" - ); - public Set getKnownKeys() { - return knownKeys; - } - public ApplicationjsonSchemaMapBuilder() { - this.instance = new LinkedHashMap<>(); - } - public Map build() { - return instance; - } - public Map getInstance() { - return instance; - } - public ApplicationjsonSchemaMapBuilder getBuilderAfterApplicationjsonA(Map instance) { - return this; - } - public ApplicationjsonSchemaMapBuilder getBuilderAfterAdditionalProperty(Map instance) { - return this; - } - } - - - public sealed interface ApplicationjsonSchema1Boxed permits ApplicationjsonSchema1BoxedMap { - @Nullable Object getData(); - } - - public record ApplicationjsonSchema1BoxedMap(ApplicationjsonSchemaMap data) implements ApplicationjsonSchema1Boxed { - @Override - public @Nullable Object getData() { - return data; - } - } - - - public static class ApplicationjsonSchema1 extends JsonSchema implements MapSchemaValidator { - private static @Nullable ApplicationjsonSchema1 instance = null; - - protected ApplicationjsonSchema1() { - super(new JsonSchemaInfo() - .type(Set.of(Map.class)) - .properties(Map.ofEntries( - new PropertyEntry("a", ApplicationjsonA.class) - )) - ); - } - - public static ApplicationjsonSchema1 getInstance() { - if (instance == null) { - instance = new ApplicationjsonSchema1(); - } - return instance; - } - - 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 RuntimeException("Invalid non-string key value"); - } - String propertyName = (String) entryKey; - List propertyPathToItem = new ArrayList<>(pathToItem); - propertyPathToItem.add(propertyName); - Object value = entry.getValue(); - LinkedHashMap, Nothing?> schemas = pathToSchemas.get(propertyPathToItem); - if (schemas == null) { - throw new RuntimeException("Validation result is invalid, schemas must exist for a pathToItem"); - } - JsonSchema propertySchema = schemas.entrySet().iterator().next().getKey(); - @Nullable Object propertyInstance = propertySchema.getNewInstance(value, propertyPathToItem, pathToSchemas); - properties.put(propertyName, propertyInstance); - } - FrozenMap<@Nullable Object> castProperties = new FrozenMap<>(properties); - return new ApplicationjsonSchemaMap(castProperties); - } - - 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); - SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().build())); - ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, new PathToSchemasMap(), new LinkedHashSet<>()); - PathToSchemasMap pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet); - return getNewInstance(castArg, validationMetadata.pathToItem(), pathToSchemasMap); - } - - - @Override - public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws 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"); - } - @Override - public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { - if (arg instanceof Map) { - return getNewInstance((Map) arg, pathToItem, pathToSchemas); - } - 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 { - return new ApplicationjsonSchema1BoxedMap(validate(arg, configuration)); - } - @Override - public ApplicationjsonSchema1Boxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { - 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"); - } - } - -} diff --git a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/fakemultiplerequestbodycontenttypes/post/requestbody/content/multipartformdata/MultipartformdataSchema.kt b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/fakemultiplerequestbodycontenttypes/post/requestbody/content/multipartformdata/MultipartformdataSchema.kt deleted file mode 100644 index 47d56affb46..00000000000 --- a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/fakemultiplerequestbodycontenttypes/post/requestbody/content/multipartformdata/MultipartformdataSchema.kt +++ /dev/null @@ -1,200 +0,0 @@ -package org.openapijsonschematools.client.paths.fakemultiplerequestbodycontenttypes.post.requestbody.content.multipartformdata; -import java.util.ArrayList; -import java.util.HashSet; -import java.util.LinkedHashMap; -import java.util.LinkedHashSet; -import java.util.List; -import java.util.Map; -import java.util.Objects; -import java.util.Set; -import org.checkerframework.checker.nullness.qual.Nullable; -import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags; -import org.openapijsonschematools.client.configurations.SchemaConfiguration; -import org.openapijsonschematools.client.exceptions.InvalidAdditionalPropertyException; -import org.openapijsonschematools.client.exceptions.UnsetPropertyException; -import org.openapijsonschematools.client.exceptions.ValidationException; -import org.openapijsonschematools.client.schemas.GenericBuilder; -import org.openapijsonschematools.client.schemas.StringJsonSchema; -import org.openapijsonschematools.client.schemas.UnsetAddPropsSetter; -import org.openapijsonschematools.client.schemas.validation.FrozenMap; -import org.openapijsonschematools.client.schemas.validation.JsonSchema; -import org.openapijsonschematools.client.schemas.validation.JsonSchemaInfo; -import org.openapijsonschematools.client.schemas.validation.MapSchemaValidator; -import org.openapijsonschematools.client.schemas.validation.PathToSchemasMap; -import org.openapijsonschematools.client.schemas.validation.PropertyEntry; -import org.openapijsonschematools.client.schemas.validation.ValidationMetadata; - -public class MultipartformdataSchema { - // nest classes so all schemas and input/output classes can be public - - - public static class MultipartformdataB extends StringJsonSchema.StringJsonSchema1 { - private static @Nullable MultipartformdataB instance = null; - public static MultipartformdataB getInstance() { - if (instance == null) { - instance = new MultipartformdataB(); - } - return instance; - } - } - - - public static class MultipartformdataSchemaMap extends FrozenMap<@Nullable Object> { - protected MultipartformdataSchemaMap(FrozenMap<@Nullable Object> m) { - super(m); - } - public static final Set requiredKeys = Set.of(); - public static final Set optionalKeys = Set.of( - "b" - ); - public static MultipartformdataSchemaMap of(Map arg, SchemaConfiguration configuration) throws ValidationException { - return MultipartformdataSchema1.getInstance().validate(arg, configuration); - } - - public String b() throws UnsetPropertyException { - String key = "b"; - throwIfKeyNotPresent(key); - @Nullable Object value = get(key); - if (!(value instanceof String)) { - throw new RuntimeException("Invalid value stored for b"); - } - return (String) value; - } - - public @Nullable Object getAdditionalProperty(String name) throws UnsetPropertyException, InvalidAdditionalPropertyException { - throwIfKeyKnown(name, requiredKeys, optionalKeys); - throwIfKeyNotPresent(name); - return get(name); - } - } - - public interface SetterForMultipartformdataB { - Map getInstance(); - T getBuilderAfterMultipartformdataB(Map instance); - - default T b(String value) { - var instance = getInstance(); - instance.put("b", value); - return getBuilderAfterMultipartformdataB(instance); - } - } - - public static class MultipartformdataSchemaMapBuilder extends UnsetAddPropsSetter implements GenericBuilder>, SetterForMultipartformdataB { - private final Map instance; - private static final Set knownKeys = Set.of( - "b" - ); - public Set getKnownKeys() { - return knownKeys; - } - public MultipartformdataSchemaMapBuilder() { - this.instance = new LinkedHashMap<>(); - } - public Map build() { - return instance; - } - public Map getInstance() { - return instance; - } - public MultipartformdataSchemaMapBuilder getBuilderAfterMultipartformdataB(Map instance) { - return this; - } - public MultipartformdataSchemaMapBuilder getBuilderAfterAdditionalProperty(Map instance) { - return this; - } - } - - - public sealed interface MultipartformdataSchema1Boxed permits MultipartformdataSchema1BoxedMap { - @Nullable Object getData(); - } - - public record MultipartformdataSchema1BoxedMap(MultipartformdataSchemaMap data) implements MultipartformdataSchema1Boxed { - @Override - public @Nullable Object getData() { - return data; - } - } - - - public static class MultipartformdataSchema1 extends JsonSchema implements MapSchemaValidator { - private static @Nullable MultipartformdataSchema1 instance = null; - - protected MultipartformdataSchema1() { - super(new JsonSchemaInfo() - .type(Set.of(Map.class)) - .properties(Map.ofEntries( - new PropertyEntry("b", MultipartformdataB.class) - )) - ); - } - - public static MultipartformdataSchema1 getInstance() { - if (instance == null) { - instance = new MultipartformdataSchema1(); - } - return instance; - } - - 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 RuntimeException("Invalid non-string key value"); - } - String propertyName = (String) entryKey; - List propertyPathToItem = new ArrayList<>(pathToItem); - propertyPathToItem.add(propertyName); - Object value = entry.getValue(); - LinkedHashMap, Nothing?> schemas = pathToSchemas.get(propertyPathToItem); - if (schemas == null) { - throw new RuntimeException("Validation result is invalid, schemas must exist for a pathToItem"); - } - JsonSchema propertySchema = schemas.entrySet().iterator().next().getKey(); - @Nullable Object propertyInstance = propertySchema.getNewInstance(value, propertyPathToItem, pathToSchemas); - properties.put(propertyName, propertyInstance); - } - FrozenMap<@Nullable Object> castProperties = new FrozenMap<>(properties); - return new MultipartformdataSchemaMap(castProperties); - } - - 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); - SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().build())); - ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, new PathToSchemasMap(), new LinkedHashSet<>()); - PathToSchemasMap pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet); - return getNewInstance(castArg, validationMetadata.pathToItem(), pathToSchemasMap); - } - - - @Override - public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws 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"); - } - @Override - public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { - if (arg instanceof Map) { - return getNewInstance((Map) arg, pathToItem, pathToSchemas); - } - 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 { - return new MultipartformdataSchema1BoxedMap(validate(arg, configuration)); - } - @Override - public MultipartformdataSchema1Boxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { - 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"); - } - } - -} diff --git a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/fakemultiplerequestbodycontenttypes/post/responses/FakemultiplerequestbodycontenttypesPostCode200Response.kt b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/fakemultiplerequestbodycontenttypes/post/responses/FakemultiplerequestbodycontenttypesPostCode200Response.kt deleted file mode 100644 index 1a1eabf4bfd..00000000000 --- a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/fakemultiplerequestbodycontenttypes/post/responses/FakemultiplerequestbodycontenttypesPostCode200Response.kt +++ /dev/null @@ -1,63 +0,0 @@ -package org.openapijsonschematools.client.paths.fakemultiplerequestbodycontenttypes.post.responses; - -import org.openapijsonschematools.client.configurations.SchemaConfiguration; -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; - -import java.util.AbstractMap; -import java.util.Map; -import java.net.http.HttpResponse; -import java.net.http.HttpHeaders; - -public class FakemultiplerequestbodycontenttypesPostCode200Response { - public sealed interface SealedMediaType permits ApplicationjsonMediaType {} - - public record ApplicationjsonMediaType(ApplicationjsonSchema.ApplicationjsonSchema1 schema) implements SealedMediaType, MediaType { - public ApplicationjsonMediaType() { - this(ApplicationjsonSchema.ApplicationjsonSchema1.getInstance()); - } - @Override - public Nothing? encoding() { - return null; - } - } - public sealed interface SealedResponseBody permits ApplicationjsonResponseBody {} - public record ApplicationjsonResponseBody(ApplicationjsonSchema.AnyTypeJsonSchema1Boxed body) implements SealedResponseBody { } - - public static class FakemultiplerequestbodycontenttypesPostCode200Response1 extends ResponseDeserializer { - public FakemultiplerequestbodycontenttypesPostCode200Response1() { - super( - Map.ofEntries( - new AbstractMap.SimpleEntry<>("application/json", new ApplicationjsonMediaType()) - ) - ); - } - - @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); - } - - @Override - protected Nothing? getHeaders(HttpHeaders headers, SchemaConfiguration configuration) { - return null; - } - } - - @SuppressWarnings("serial") - public static class ResponseApiException extends ApiException { - public DeserializedHttpResponse deserializedResponse; - - public ResponseApiException(String s, HttpResponse response, DeserializedHttpResponse deserializedResponse) { - super(s, response); - this.deserializedResponse = deserializedResponse; - } - } -} diff --git a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/fakemultiplerequestbodycontenttypes/post/responses/code200response/content/applicationjson/ApplicationjsonSchema.kt b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/fakemultiplerequestbodycontenttypes/post/responses/code200response/content/applicationjson/ApplicationjsonSchema.kt deleted file mode 100644 index 68f600e23d6..00000000000 --- a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/fakemultiplerequestbodycontenttypes/post/responses/code200response/content/applicationjson/ApplicationjsonSchema.kt +++ /dev/null @@ -1,19 +0,0 @@ -package org.openapijsonschematools.client.paths.fakemultiplerequestbodycontenttypes.post.responses.code200response.content.applicationjson; -import org.checkerframework.checker.nullness.qual.Nullable; -import org.openapijsonschematools.client.schemas.AnyTypeJsonSchema; - -public class ApplicationjsonSchema extends AnyTypeJsonSchema { - // nest classes so all schemas and input/output classes can be public - - - public static class ApplicationjsonSchema1 extends AnyTypeJsonSchema.AnyTypeJsonSchema1 { - private static @Nullable ApplicationjsonSchema1 instance = null; - public static ApplicationjsonSchema1 getInstance() { - if (instance == null) { - instance = new ApplicationjsonSchema1(); - } - return instance; - } - } - -} diff --git a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/fakemultipleresponsebodies/FakemultipleresponsebodiesGet.kt b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/fakemultipleresponsebodies/FakemultipleresponsebodiesGet.kt deleted file mode 100644 index 78be3b0ebe6..00000000000 --- a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/fakemultipleresponsebodies/FakemultipleresponsebodiesGet.kt +++ /dev/null @@ -1,124 +0,0 @@ -package org.openapijsonschematools.client.paths.fakemultipleresponsebodies; - -import org.checkerframework.checker.nullness.qual.Nullable; -import org.openapijsonschematools.client.RootServerInfo; -import org.openapijsonschematools.client.paths.fakemultipleresponsebodies.get.FakemultipleresponsebodiesGetResponses; -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.paths.Fakemultipleresponsebodies; - -import java.io.IOException; -import java.net.http.HttpClient; -import java.net.http.HttpRequest; -import java.time.Duration; -import java.util.List; -import java.util.Map; - -public class FakemultipleresponsebodiesGet { - private static class GetProvider { - private static final String method = "get"; - - public static FakemultipleresponsebodiesGetResponses.EndpointResponse get( - GetRequest request, - ApiConfiguration apiConfiguration, - SchemaConfiguration schemaConfiguration, - HttpClient client - ) 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 - @Nullable Map queryMap = null; - String host = apiConfiguration.getServer(request.serverIndex).url(); - - String url = host + Fakemultipleresponsebodies.path; - var httpRequest = RestClient.getRequest( - url, - method, - bodyPublisher, - headers, - request.timeout - ); - var response = RestClient.getResponse(httpRequest, client); - var responsesDeserializer = new FakemultipleresponsebodiesGetResponses.FakemultipleresponsebodiesGetResponses1(); - return responsesDeserializer.deserialize(response, schemaConfiguration); - } - } - - public interface GetOperation { - ApiConfiguration getApiConfiguration(); - SchemaConfiguration getSchemaConfiguration(); - HttpClient getClient(); - default FakemultipleresponsebodiesGetResponses.EndpointResponse get(GetRequest request) throws IOException, InterruptedException, ValidationException, NotImplementedException, ApiException { - return GetProvider.get(request, getApiConfiguration(), getSchemaConfiguration(), getClient()); - } - } - - public interface MultipleResponseBodiesOperation { - ApiConfiguration getApiConfiguration(); - SchemaConfiguration getSchemaConfiguration(); - HttpClient getClient(); - default FakemultipleresponsebodiesGetResponses.EndpointResponse multipleResponseBodies(GetRequest request) throws IOException, InterruptedException, ValidationException, NotImplementedException, ApiException { - return GetProvider.get(request, getApiConfiguration(), getSchemaConfiguration(), getClient()); - } - } - - public static class Get extends ApiClient implements GetOperation { - public Get(ApiConfiguration apiConfiguration, SchemaConfiguration schemaConfiguration) { - super(apiConfiguration, schemaConfiguration); - } - } - - public static class GetRequest { - public RootServerInfo.@Nullable ServerIndex serverIndex; - public @Nullable Duration timeout; - } - - public interface SetterForServerIndex { - GetRequest getInstance(); - T getBuilderAfterServerIndex(GetRequest instance); - default T serverIndex(RootServerInfo.ServerIndex serverIndex) { - var instance = getInstance(); - instance.serverIndex = serverIndex; - return getBuilderAfterServerIndex(instance); - } - } - - public interface SetterForTimeout { - GetRequest getInstance(); - T getBuilderAfterTimeout(GetRequest instance); - default T timeout(Duration timeout) { - var instance = getInstance(); - instance.timeout = timeout; - return getBuilderAfterTimeout(instance); - } - } - - public static class GetRequestBuilder implements SetterForServerIndex, SetterForTimeout { - private final GetRequest instance; - - public GetRequestBuilder() { - this.instance = new GetRequest(); - } - - public GetRequest build() { - return instance; - } - - public GetRequest getInstance() { - return instance; - } - - public GetRequestBuilder getBuilderAfterServerIndex(GetRequest instance) { - return this; - } - - public GetRequestBuilder getBuilderAfterTimeout(GetRequest instance) { - return this; - } - } -} diff --git a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/fakemultipleresponsebodies/get/FakemultipleresponsebodiesGetResponses.kt b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/fakemultipleresponsebodies/get/FakemultipleresponsebodiesGetResponses.kt deleted file mode 100644 index b6cf2e60c46..00000000000 --- a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/fakemultipleresponsebodies/get/FakemultipleresponsebodiesGetResponses.kt +++ /dev/null @@ -1,69 +0,0 @@ -package org.openapijsonschematools.client.paths.fakemultipleresponsebodies.get; - -import org.openapijsonschematools.client.paths.fakemultipleresponsebodies.get.responses.FakemultipleresponsebodiesGetCode200Response; -import org.openapijsonschematools.client.paths.fakemultipleresponsebodies.get.responses.FakemultipleresponsebodiesGetCode202Response; -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; -import org.checkerframework.checker.nullness.qual.Nullable; - -import java.net.http.HttpResponse; -import java.util.Map; -import java.util.AbstractMap; - -public class FakemultipleresponsebodiesGetResponses { - public sealed interface EndpointResponse permits EndpointFakemultipleresponsebodiesGetCode200Response, EndpointFakemultipleresponsebodiesGetCode202Response {} - - public record EndpointFakemultipleresponsebodiesGetCode200Response( - HttpResponse response, - FakemultipleresponsebodiesGetCode200Response.SealedResponseBody body, - Nothing? headers - ) implements EndpointResponse, ApiResponse{ - } - - public record EndpointFakemultipleresponsebodiesGetCode202Response( - HttpResponse response, - FakemultipleresponsebodiesGetCode202Response.SealedResponseBody body, - Nothing? headers - ) implements EndpointResponse, ApiResponse{ - } - - public sealed interface StatusCodeResponseDeserializer permits StatusFakemultipleresponsebodiesGetCode200ResponseDeserializer, StatusFakemultipleresponsebodiesGetCode202ResponseDeserializer {} - - public static final class StatusFakemultipleresponsebodiesGetCode200ResponseDeserializer extends FakemultipleresponsebodiesGetCode200Response.FakemultipleresponsebodiesGetCode200Response1 implements StatusCodeResponseDeserializer { - } - public static final class StatusFakemultipleresponsebodiesGetCode202ResponseDeserializer extends FakemultipleresponsebodiesGetCode202Response.FakemultipleresponsebodiesGetCode202Response1 implements StatusCodeResponseDeserializer { - } - - public static final class FakemultipleresponsebodiesGetResponses1 implements ResponsesDeserializer { - private final Map statusCodeToResponseDeserializer; - public FakemultipleresponsebodiesGetResponses1() { - this.statusCodeToResponseDeserializer = Map.ofEntries( - new AbstractMap.SimpleEntry<>("200", new StatusFakemultipleresponsebodiesGetCode200ResponseDeserializer()), - new AbstractMap.SimpleEntry<>("202", new StatusFakemultipleresponsebodiesGetCode202ResponseDeserializer()) - ); - } - - 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) { - throw new ApiException( - "Invalid response statusCode="+statusCode+" has no response defined in the openapi document", - response - ); - } - if (statusCodeDeserializer instanceof StatusFakemultipleresponsebodiesGetCode200ResponseDeserializer castDeserializer) { - var deserializedResponse = castDeserializer.deserialize(response, configuration); - return new EndpointFakemultipleresponsebodiesGetCode200Response(response, deserializedResponse.body(), deserializedResponse.headers()); - } else { - StatusFakemultipleresponsebodiesGetCode202ResponseDeserializer castDeserializer = (StatusFakemultipleresponsebodiesGetCode202ResponseDeserializer) statusCodeDeserializer; - var deserializedResponse = castDeserializer.deserialize(response, configuration); - return new EndpointFakemultipleresponsebodiesGetCode202Response(response, deserializedResponse.body(), deserializedResponse.headers()); - } - } - } -} diff --git a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/fakemultipleresponsebodies/get/responses/FakemultipleresponsebodiesGetCode200Response.kt b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/fakemultipleresponsebodies/get/responses/FakemultipleresponsebodiesGetCode200Response.kt deleted file mode 100644 index d519083c162..00000000000 --- a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/fakemultipleresponsebodies/get/responses/FakemultipleresponsebodiesGetCode200Response.kt +++ /dev/null @@ -1,63 +0,0 @@ -package org.openapijsonschematools.client.paths.fakemultipleresponsebodies.get.responses; - -import org.openapijsonschematools.client.configurations.SchemaConfiguration; -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; - -import java.util.AbstractMap; -import java.util.Map; -import java.net.http.HttpResponse; -import java.net.http.HttpHeaders; - -public class FakemultipleresponsebodiesGetCode200Response { - public sealed interface SealedMediaType permits ApplicationjsonMediaType {} - - public record ApplicationjsonMediaType(ApplicationjsonSchema.ApplicationjsonSchema1 schema) implements SealedMediaType, MediaType { - public ApplicationjsonMediaType() { - this(ApplicationjsonSchema.ApplicationjsonSchema1.getInstance()); - } - @Override - public Nothing? encoding() { - return null; - } - } - public sealed interface SealedResponseBody permits ApplicationjsonResponseBody {} - public record ApplicationjsonResponseBody(ApplicationjsonSchema.AnyTypeJsonSchema1Boxed body) implements SealedResponseBody { } - - public static class FakemultipleresponsebodiesGetCode200Response1 extends ResponseDeserializer { - public FakemultipleresponsebodiesGetCode200Response1() { - super( - Map.ofEntries( - new AbstractMap.SimpleEntry<>("application/json", new ApplicationjsonMediaType()) - ) - ); - } - - @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); - } - - @Override - protected Nothing? getHeaders(HttpHeaders headers, SchemaConfiguration configuration) { - return null; - } - } - - @SuppressWarnings("serial") - public static class ResponseApiException extends ApiException { - public DeserializedHttpResponse deserializedResponse; - - public ResponseApiException(String s, HttpResponse response, DeserializedHttpResponse deserializedResponse) { - super(s, response); - this.deserializedResponse = deserializedResponse; - } - } -} diff --git a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/fakemultipleresponsebodies/get/responses/FakemultipleresponsebodiesGetCode202Response.kt b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/fakemultipleresponsebodies/get/responses/FakemultipleresponsebodiesGetCode202Response.kt deleted file mode 100644 index 410f236f118..00000000000 --- a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/fakemultipleresponsebodies/get/responses/FakemultipleresponsebodiesGetCode202Response.kt +++ /dev/null @@ -1,63 +0,0 @@ -package org.openapijsonschematools.client.paths.fakemultipleresponsebodies.get.responses; - -import org.openapijsonschematools.client.configurations.SchemaConfiguration; -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; - -import java.util.AbstractMap; -import java.util.Map; -import java.net.http.HttpResponse; -import java.net.http.HttpHeaders; - -public class FakemultipleresponsebodiesGetCode202Response { - public sealed interface SealedMediaType permits ApplicationjsonMediaType {} - - public record ApplicationjsonMediaType(ApplicationjsonSchema.ApplicationjsonSchema1 schema) implements SealedMediaType, MediaType { - public ApplicationjsonMediaType() { - this(ApplicationjsonSchema.ApplicationjsonSchema1.getInstance()); - } - @Override - public Nothing? encoding() { - return null; - } - } - public sealed interface SealedResponseBody permits ApplicationjsonResponseBody {} - public record ApplicationjsonResponseBody(ApplicationjsonSchema.AnyTypeJsonSchema1Boxed body) implements SealedResponseBody { } - - public static class FakemultipleresponsebodiesGetCode202Response1 extends ResponseDeserializer { - public FakemultipleresponsebodiesGetCode202Response1() { - super( - Map.ofEntries( - new AbstractMap.SimpleEntry<>("application/json", new ApplicationjsonMediaType()) - ) - ); - } - - @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); - } - - @Override - protected Nothing? getHeaders(HttpHeaders headers, SchemaConfiguration configuration) { - return null; - } - } - - @SuppressWarnings("serial") - public static class ResponseApiException extends ApiException { - public DeserializedHttpResponse deserializedResponse; - - public ResponseApiException(String s, HttpResponse response, DeserializedHttpResponse deserializedResponse) { - super(s, response); - this.deserializedResponse = deserializedResponse; - } - } -} diff --git a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/fakemultipleresponsebodies/get/responses/code200response/content/applicationjson/ApplicationjsonSchema.kt b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/fakemultipleresponsebodies/get/responses/code200response/content/applicationjson/ApplicationjsonSchema.kt deleted file mode 100644 index 0a2a9520c57..00000000000 --- a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/fakemultipleresponsebodies/get/responses/code200response/content/applicationjson/ApplicationjsonSchema.kt +++ /dev/null @@ -1,19 +0,0 @@ -package org.openapijsonschematools.client.paths.fakemultipleresponsebodies.get.responses.code200response.content.applicationjson; -import org.checkerframework.checker.nullness.qual.Nullable; -import org.openapijsonschematools.client.schemas.AnyTypeJsonSchema; - -public class ApplicationjsonSchema extends AnyTypeJsonSchema { - // nest classes so all schemas and input/output classes can be public - - - public static class ApplicationjsonSchema1 extends AnyTypeJsonSchema.AnyTypeJsonSchema1 { - private static @Nullable ApplicationjsonSchema1 instance = null; - public static ApplicationjsonSchema1 getInstance() { - if (instance == null) { - instance = new ApplicationjsonSchema1(); - } - return instance; - } - } - -} diff --git a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/fakemultipleresponsebodies/get/responses/code202response/content/applicationjson/ApplicationjsonSchema.kt b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/fakemultipleresponsebodies/get/responses/code202response/content/applicationjson/ApplicationjsonSchema.kt deleted file mode 100644 index 53ce26bfe16..00000000000 --- a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/fakemultipleresponsebodies/get/responses/code202response/content/applicationjson/ApplicationjsonSchema.kt +++ /dev/null @@ -1,19 +0,0 @@ -package org.openapijsonschematools.client.paths.fakemultipleresponsebodies.get.responses.code202response.content.applicationjson; -import org.checkerframework.checker.nullness.qual.Nullable; -import org.openapijsonschematools.client.schemas.AnyTypeJsonSchema; - -public class ApplicationjsonSchema extends AnyTypeJsonSchema { - // nest classes so all schemas and input/output classes can be public - - - public static class ApplicationjsonSchema1 extends AnyTypeJsonSchema.AnyTypeJsonSchema1 { - private static @Nullable ApplicationjsonSchema1 instance = null; - public static ApplicationjsonSchema1 getInstance() { - if (instance == null) { - instance = new ApplicationjsonSchema1(); - } - return instance; - } - } - -} diff --git a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/fakemultiplesecurities/FakemultiplesecuritiesGet.kt b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/fakemultiplesecurities/FakemultiplesecuritiesGet.kt deleted file mode 100644 index 99652396c14..00000000000 --- a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/fakemultiplesecurities/FakemultiplesecuritiesGet.kt +++ /dev/null @@ -1,152 +0,0 @@ -package org.openapijsonschematools.client.paths.fakemultiplesecurities; - -import org.checkerframework.checker.nullness.qual.Nullable; -import org.openapijsonschematools.client.RootServerInfo; -import org.openapijsonschematools.client.paths.fakemultiplesecurities.get.FakemultiplesecuritiesGetSecurityInfo; -import org.openapijsonschematools.client.paths.fakemultiplesecurities.get.FakemultiplesecuritiesGetResponses; -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.paths.Fakemultiplesecurities; -import org.openapijsonschematools.client.securityrequirementobjects.SecurityRequirementObject; -import org.openapijsonschematools.client.securityrequirementobjects.AuthApplier; - -import java.io.IOException; -import java.net.http.HttpClient; -import java.net.http.HttpRequest; -import java.time.Duration; -import java.util.List; -import java.util.Map; - -public class FakemultiplesecuritiesGet { - private static class GetProvider extends AuthApplier { - private static final String method = "get"; - - public static FakemultiplesecuritiesGetResponses.EndpointResponse get( - GetRequest request, - ApiConfiguration apiConfiguration, - SchemaConfiguration schemaConfiguration, - HttpClient client - ) 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 - @Nullable Map queryMap = null; - String host = apiConfiguration.getServer(request.serverIndex).url(); - SecurityRequirementObject securityRequirementObject = apiConfiguration.getSecurityRequirementObject(request.securityIndex); - updateParamsForAuth( - securityRequirementObject, - headers, - Fakemultiplesecurities.path, - method, - bodyPublisher, - queryMap, - apiConfiguration - ); - - String url = host + Fakemultiplesecurities.path; - var httpRequest = RestClient.getRequest( - url, - method, - bodyPublisher, - headers, - request.timeout - ); - var response = RestClient.getResponse(httpRequest, client); - var responsesDeserializer = new FakemultiplesecuritiesGetResponses.FakemultiplesecuritiesGetResponses1(); - return responsesDeserializer.deserialize(response, schemaConfiguration); - } - } - - public interface GetOperation { - ApiConfiguration getApiConfiguration(); - SchemaConfiguration getSchemaConfiguration(); - HttpClient getClient(); - default FakemultiplesecuritiesGetResponses.EndpointResponse get(GetRequest request) throws IOException, InterruptedException, ValidationException, NotImplementedException, ApiException { - return GetProvider.get(request, getApiConfiguration(), getSchemaConfiguration(), getClient()); - } - } - - public interface MultipleSecuritiesOperation { - ApiConfiguration getApiConfiguration(); - SchemaConfiguration getSchemaConfiguration(); - HttpClient getClient(); - default FakemultiplesecuritiesGetResponses.EndpointResponse multipleSecurities(GetRequest request) throws IOException, InterruptedException, ValidationException, NotImplementedException, ApiException { - return GetProvider.get(request, getApiConfiguration(), getSchemaConfiguration(), getClient()); - } - } - - public static class Get extends ApiClient implements GetOperation { - public Get(ApiConfiguration apiConfiguration, SchemaConfiguration schemaConfiguration) { - super(apiConfiguration, schemaConfiguration); - } - } - - public static class GetRequest { - public RootServerInfo.@Nullable ServerIndex serverIndex; - public FakemultiplesecuritiesGetSecurityInfo.@Nullable SecurityIndex securityIndex; - public @Nullable Duration timeout; - } - - public interface SetterForServerIndex { - GetRequest getInstance(); - T getBuilderAfterServerIndex(GetRequest instance); - default T serverIndex(RootServerInfo.ServerIndex serverIndex) { - var instance = getInstance(); - instance.serverIndex = serverIndex; - return getBuilderAfterServerIndex(instance); - } - } - - public interface SetterForSecurityIndex { - GetRequest getInstance(); - T getBuilderAfterSecurityIndex(GetRequest instance); - default T securityIndex(FakemultiplesecuritiesGetSecurityInfo.SecurityIndex securityIndex) { - var instance = getInstance(); - instance.securityIndex = securityIndex; - return getBuilderAfterSecurityIndex(instance); - } - } - - public interface SetterForTimeout { - GetRequest getInstance(); - T getBuilderAfterTimeout(GetRequest instance); - default T timeout(Duration timeout) { - var instance = getInstance(); - instance.timeout = timeout; - return getBuilderAfterTimeout(instance); - } - } - - public static class GetRequestBuilder implements SetterForServerIndex, SetterForSecurityIndex, SetterForTimeout { - private final GetRequest instance; - - public GetRequestBuilder() { - this.instance = new GetRequest(); - } - - public GetRequest build() { - return instance; - } - - public GetRequest getInstance() { - return instance; - } - - public GetRequestBuilder getBuilderAfterServerIndex(GetRequest instance) { - return this; - } - - public GetRequestBuilder getBuilderAfterSecurityIndex(GetRequest instance) { - return this; - } - - public GetRequestBuilder getBuilderAfterTimeout(GetRequest instance) { - return this; - } - } -} diff --git a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/fakemultiplesecurities/get/FakemultiplesecuritiesGetResponses.kt b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/fakemultiplesecurities/get/FakemultiplesecuritiesGetResponses.kt deleted file mode 100644 index 6f1e48a4644..00000000000 --- a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/fakemultiplesecurities/get/FakemultiplesecuritiesGetResponses.kt +++ /dev/null @@ -1,53 +0,0 @@ -package org.openapijsonschematools.client.paths.fakemultiplesecurities.get; - -import org.openapijsonschematools.client.paths.fakemultiplesecurities.get.responses.FakemultiplesecuritiesGetCode200Response; -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; -import org.checkerframework.checker.nullness.qual.Nullable; - -import java.net.http.HttpResponse; -import java.util.Map; -import java.util.AbstractMap; - -public class FakemultiplesecuritiesGetResponses { - public sealed interface EndpointResponse permits EndpointFakemultiplesecuritiesGetCode200Response {} - - public record EndpointFakemultiplesecuritiesGetCode200Response( - HttpResponse response, - FakemultiplesecuritiesGetCode200Response.SealedResponseBody body, - Nothing? headers - ) implements EndpointResponse, ApiResponse{ - } - - public sealed interface StatusCodeResponseDeserializer permits StatusFakemultiplesecuritiesGetCode200ResponseDeserializer {} - - public static final class StatusFakemultiplesecuritiesGetCode200ResponseDeserializer extends FakemultiplesecuritiesGetCode200Response.FakemultiplesecuritiesGetCode200Response1 implements StatusCodeResponseDeserializer { - } - - public static final class FakemultiplesecuritiesGetResponses1 implements ResponsesDeserializer { - private final Map statusCodeToResponseDeserializer; - public FakemultiplesecuritiesGetResponses1() { - this.statusCodeToResponseDeserializer = Map.ofEntries( - new AbstractMap.SimpleEntry<>("200", new StatusFakemultiplesecuritiesGetCode200ResponseDeserializer()) - ); - } - - 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) { - throw new ApiException( - "Invalid response statusCode="+statusCode+" has no response defined in the openapi document", - response - ); - } - StatusFakemultiplesecuritiesGetCode200ResponseDeserializer castDeserializer = (StatusFakemultiplesecuritiesGetCode200ResponseDeserializer) statusCodeDeserializer; - var deserializedResponse = castDeserializer.deserialize(response, configuration); - return new EndpointFakemultiplesecuritiesGetCode200Response(response, deserializedResponse.body(), deserializedResponse.headers()); - } - } -} diff --git a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/fakemultiplesecurities/get/FakemultiplesecuritiesGetSecurityInfo.kt b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/fakemultiplesecurities/get/FakemultiplesecuritiesGetSecurityInfo.kt deleted file mode 100644 index ed1fd5216aa..00000000000 --- a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/fakemultiplesecurities/get/FakemultiplesecuritiesGetSecurityInfo.kt +++ /dev/null @@ -1,39 +0,0 @@ -package org.openapijsonschematools.client.paths.fakemultiplesecurities.get; - -import org.openapijsonschematools.client.paths.fakemultiplesecurities.get.security.FakemultiplesecuritiesGetSecurityRequirementObject0; -import org.openapijsonschematools.client.paths.fakemultiplesecurities.get.security.FakemultiplesecuritiesGetSecurityRequirementObject1; -import org.openapijsonschematools.client.paths.fakemultiplesecurities.get.security.FakemultiplesecuritiesGetSecurityRequirementObject2; -import org.openapijsonschematools.client.securityrequirementobjects.SecurityRequirementObject; -import org.openapijsonschematools.client.securityrequirementobjects.SecurityRequirementObjectProvider; - -public class FakemultiplesecuritiesGetSecurityInfo { - public static class FakemultiplesecuritiesGetSecurityInfo1 implements SecurityRequirementObjectProvider { - public final FakemultiplesecuritiesGetSecurityRequirementObject0 security0; - public final FakemultiplesecuritiesGetSecurityRequirementObject1 security1; - public final FakemultiplesecuritiesGetSecurityRequirementObject2 security2; - - public FakemultiplesecuritiesGetSecurityInfo1() { - security0 = new FakemultiplesecuritiesGetSecurityRequirementObject0(); - security1 = new FakemultiplesecuritiesGetSecurityRequirementObject1(); - security2 = new FakemultiplesecuritiesGetSecurityRequirementObject2(); - } - - @Override - public SecurityRequirementObject getSecurityRequirementObject(SecurityIndex securityIndex) { - switch (securityIndex) { - case SECURITY_0: - return security0; - case SECURITY_1: - return security1; - default: - return security2; - } - } - } - - public enum SecurityIndex { - SECURITY_0, - SECURITY_1, - SECURITY_2 - } -} \ No newline at end of file diff --git a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/fakemultiplesecurities/get/responses/FakemultiplesecuritiesGetCode200Response.kt b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/fakemultiplesecurities/get/responses/FakemultiplesecuritiesGetCode200Response.kt deleted file mode 100644 index 30816b17b52..00000000000 --- a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/fakemultiplesecurities/get/responses/FakemultiplesecuritiesGetCode200Response.kt +++ /dev/null @@ -1,63 +0,0 @@ -package org.openapijsonschematools.client.paths.fakemultiplesecurities.get.responses; - -import org.openapijsonschematools.client.configurations.SchemaConfiguration; -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; - -import java.util.AbstractMap; -import java.util.Map; -import java.net.http.HttpResponse; -import java.net.http.HttpHeaders; - -public class FakemultiplesecuritiesGetCode200Response { - public sealed interface SealedMediaType permits ApplicationjsonMediaType {} - - public record ApplicationjsonMediaType(ApplicationjsonSchema.ApplicationjsonSchema1 schema) implements SealedMediaType, MediaType { - public ApplicationjsonMediaType() { - this(ApplicationjsonSchema.ApplicationjsonSchema1.getInstance()); - } - @Override - public Nothing? encoding() { - return null; - } - } - public sealed interface SealedResponseBody permits ApplicationjsonResponseBody {} - public record ApplicationjsonResponseBody(ApplicationjsonSchema.AnyTypeJsonSchema1Boxed body) implements SealedResponseBody { } - - public static class FakemultiplesecuritiesGetCode200Response1 extends ResponseDeserializer { - public FakemultiplesecuritiesGetCode200Response1() { - super( - Map.ofEntries( - new AbstractMap.SimpleEntry<>("application/json", new ApplicationjsonMediaType()) - ) - ); - } - - @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); - } - - @Override - protected Nothing? getHeaders(HttpHeaders headers, SchemaConfiguration configuration) { - return null; - } - } - - @SuppressWarnings("serial") - public static class ResponseApiException extends ApiException { - public DeserializedHttpResponse deserializedResponse; - - public ResponseApiException(String s, HttpResponse response, DeserializedHttpResponse deserializedResponse) { - super(s, response); - this.deserializedResponse = deserializedResponse; - } - } -} diff --git a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/fakemultiplesecurities/get/responses/code200response/content/applicationjson/ApplicationjsonSchema.kt b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/fakemultiplesecurities/get/responses/code200response/content/applicationjson/ApplicationjsonSchema.kt deleted file mode 100644 index 19cca1a1b80..00000000000 --- a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/fakemultiplesecurities/get/responses/code200response/content/applicationjson/ApplicationjsonSchema.kt +++ /dev/null @@ -1,19 +0,0 @@ -package org.openapijsonschematools.client.paths.fakemultiplesecurities.get.responses.code200response.content.applicationjson; -import org.checkerframework.checker.nullness.qual.Nullable; -import org.openapijsonschematools.client.schemas.AnyTypeJsonSchema; - -public class ApplicationjsonSchema extends AnyTypeJsonSchema { - // nest classes so all schemas and input/output classes can be public - - - public static class ApplicationjsonSchema1 extends AnyTypeJsonSchema.AnyTypeJsonSchema1 { - private static @Nullable ApplicationjsonSchema1 instance = null; - public static ApplicationjsonSchema1 getInstance() { - if (instance == null) { - instance = new ApplicationjsonSchema1(); - } - return instance; - } - } - -} diff --git a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/fakemultiplesecurities/get/security/FakemultiplesecuritiesGetSecurityRequirementObject0.kt b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/fakemultiplesecurities/get/security/FakemultiplesecuritiesGetSecurityRequirementObject0.kt deleted file mode 100644 index bc95dd4ca2b..00000000000 --- a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/fakemultiplesecurities/get/security/FakemultiplesecuritiesGetSecurityRequirementObject0.kt +++ /dev/null @@ -1,5 +0,0 @@ -package org.openapijsonschematools.client.paths.fakemultiplesecurities.get.security; - -import org.openapijsonschematools.client.securityrequirementobjects.EmptySecurityRequirementObject; - -public class FakemultiplesecuritiesGetSecurityRequirementObject0 extends EmptySecurityRequirementObject {} diff --git a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/fakemultiplesecurities/get/security/FakemultiplesecuritiesGetSecurityRequirementObject1.kt b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/fakemultiplesecurities/get/security/FakemultiplesecuritiesGetSecurityRequirementObject1.kt deleted file mode 100644 index 4b2a7c9737a..00000000000 --- a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/fakemultiplesecurities/get/security/FakemultiplesecuritiesGetSecurityRequirementObject1.kt +++ /dev/null @@ -1,29 +0,0 @@ -package org.openapijsonschematools.client.paths.fakemultiplesecurities.get.security; - -import org.checkerframework.checker.nullness.qual.Nullable; -import org.openapijsonschematools.client.securityrequirementobjects.SecurityRequirementObject; -import org.openapijsonschematools.client.securityschemes.SecurityScheme; -import org.openapijsonschematools.client.components.securityschemes.ApiKey; -import org.openapijsonschematools.client.components.securityschemes.HttpBasicTest; - -import java.util.List; -import java.util.Map; -import java.util.AbstractMap; - -public class FakemultiplesecuritiesGetSecurityRequirementObject1 extends SecurityRequirementObject { - - public FakemultiplesecuritiesGetSecurityRequirementObject1() { - super( - Map.ofEntries( - new AbstractMap.SimpleEntry, List>( - HttpBasicTest.class, - List.of() - ), - new AbstractMap.SimpleEntry, List>( - ApiKey.class, - List.of() - ) - ) - ); - } -} diff --git a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/fakemultiplesecurities/get/security/FakemultiplesecuritiesGetSecurityRequirementObject2.kt b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/fakemultiplesecurities/get/security/FakemultiplesecuritiesGetSecurityRequirementObject2.kt deleted file mode 100644 index b59a0f9bb32..00000000000 --- a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/fakemultiplesecurities/get/security/FakemultiplesecuritiesGetSecurityRequirementObject2.kt +++ /dev/null @@ -1,24 +0,0 @@ -package org.openapijsonschematools.client.paths.fakemultiplesecurities.get.security; - -import org.checkerframework.checker.nullness.qual.Nullable; -import org.openapijsonschematools.client.securityrequirementobjects.SecurityRequirementObject; -import org.openapijsonschematools.client.securityschemes.SecurityScheme; -import org.openapijsonschematools.client.components.securityschemes.PetstoreAuth; - -import java.util.List; -import java.util.Map; -import java.util.AbstractMap; - -public class FakemultiplesecuritiesGetSecurityRequirementObject2 extends SecurityRequirementObject { - - public FakemultiplesecuritiesGetSecurityRequirementObject2() { - super( - Map.ofEntries( - new AbstractMap.SimpleEntry, List>( - PetstoreAuth.class, - List.of("write:pets", "read:pets") - ) - ) - ); - } -} diff --git a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/fakeobjinquery/FakeobjinqueryGet.kt b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/fakeobjinquery/FakeobjinqueryGet.kt deleted file mode 100644 index b4fa0a4edbd..00000000000 --- a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/fakeobjinquery/FakeobjinqueryGet.kt +++ /dev/null @@ -1,148 +0,0 @@ -package org.openapijsonschematools.client.paths.fakeobjinquery; - -import org.checkerframework.checker.nullness.qual.Nullable; -import org.openapijsonschematools.client.paths.fakeobjinquery.get.FakeobjinqueryGetQueryParameters; -import org.openapijsonschematools.client.RootServerInfo; -import org.openapijsonschematools.client.paths.fakeobjinquery.get.Parameters; -import org.openapijsonschematools.client.paths.fakeobjinquery.get.FakeobjinqueryGetResponses; -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.paths.Fakeobjinquery; - -import java.io.IOException; -import java.net.http.HttpClient; -import java.net.http.HttpRequest; -import java.time.Duration; -import java.util.List; -import java.util.Map; - -public class FakeobjinqueryGet { - private static class GetProvider { - private static final String method = "get"; - - public static FakeobjinqueryGetResponses.EndpointResponse get( - GetRequest request, - ApiConfiguration apiConfiguration, - SchemaConfiguration schemaConfiguration, - HttpClient client - ) throws IOException, InterruptedException, ValidationException, NotImplementedException, ApiException { - Map> headers = apiConfiguration.getDefaultHeaders(); - HttpRequest.BodyPublisher bodyPublisher = HttpRequest.BodyPublishers.noBody(); - - var querySerializer = new Parameters.QueryParametersSerializer(); - @Nullable Map queryMap = null; - if (request.queryParameters != null) { - queryMap = querySerializer.getQueryMap(request.queryParameters); - } - String host = apiConfiguration.getServer(request.serverIndex).url(); - - String url = host + Fakeobjinquery.path; - if (queryMap != null) { - url = url + querySerializer.serialize(queryMap); - } - var httpRequest = RestClient.getRequest( - url, - method, - bodyPublisher, - headers, - request.timeout - ); - var response = RestClient.getResponse(httpRequest, client); - var responsesDeserializer = new FakeobjinqueryGetResponses.FakeobjinqueryGetResponses1(); - return responsesDeserializer.deserialize(response, schemaConfiguration); - } - } - - public interface GetOperation { - ApiConfiguration getApiConfiguration(); - SchemaConfiguration getSchemaConfiguration(); - HttpClient getClient(); - default FakeobjinqueryGetResponses.EndpointResponse get(GetRequest request) throws IOException, InterruptedException, ValidationException, NotImplementedException, ApiException { - return GetProvider.get(request, getApiConfiguration(), getSchemaConfiguration(), getClient()); - } - } - - public interface ObjectInQueryOperation { - ApiConfiguration getApiConfiguration(); - SchemaConfiguration getSchemaConfiguration(); - HttpClient getClient(); - default FakeobjinqueryGetResponses.EndpointResponse objectInQuery(GetRequest request) throws IOException, InterruptedException, ValidationException, NotImplementedException, ApiException { - return GetProvider.get(request, getApiConfiguration(), getSchemaConfiguration(), getClient()); - } - } - - public static class Get extends ApiClient implements GetOperation { - public Get(ApiConfiguration apiConfiguration, SchemaConfiguration schemaConfiguration) { - super(apiConfiguration, schemaConfiguration); - } - } - - public static class GetRequest { - public FakeobjinqueryGetQueryParameters.@Nullable QueryParametersMap queryParameters; - public RootServerInfo.@Nullable ServerIndex serverIndex; - public @Nullable Duration timeout; - } - - public interface SetterForQueryParameters { - GetRequest getInstance(); - T getBuilderAfterQueryParameters(GetRequest instance); - default T queryParameters(FakeobjinqueryGetQueryParameters.QueryParametersMap queryParameters) { - var instance = getInstance(); - instance.queryParameters = queryParameters; - return getBuilderAfterQueryParameters(instance); - } - } - - public interface SetterForServerIndex { - GetRequest getInstance(); - T getBuilderAfterServerIndex(GetRequest instance); - default T serverIndex(RootServerInfo.ServerIndex serverIndex) { - var instance = getInstance(); - instance.serverIndex = serverIndex; - return getBuilderAfterServerIndex(instance); - } - } - - public interface SetterForTimeout { - GetRequest getInstance(); - T getBuilderAfterTimeout(GetRequest instance); - default T timeout(Duration timeout) { - var instance = getInstance(); - instance.timeout = timeout; - return getBuilderAfterTimeout(instance); - } - } - - public static class GetRequestBuilder implements SetterForQueryParameters, SetterForServerIndex, SetterForTimeout { - private final GetRequest instance; - - public GetRequestBuilder() { - this.instance = new GetRequest(); - } - - public GetRequest build() { - return instance; - } - - public GetRequest getInstance() { - return instance; - } - - public GetRequestBuilder getBuilderAfterQueryParameters(GetRequest instance) { - return this; - } - - public GetRequestBuilder getBuilderAfterServerIndex(GetRequest instance) { - return this; - } - - public GetRequestBuilder getBuilderAfterTimeout(GetRequest instance) { - return this; - } - } -} diff --git a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/fakeobjinquery/get/FakeobjinqueryGetQueryParameters.kt b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/fakeobjinquery/get/FakeobjinqueryGetQueryParameters.kt deleted file mode 100644 index 7a1622cc81d..00000000000 --- a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/fakeobjinquery/get/FakeobjinqueryGetQueryParameters.kt +++ /dev/null @@ -1,191 +0,0 @@ -package org.openapijsonschematools.client.paths.fakeobjinquery.get; -import java.util.ArrayList; -import java.util.HashSet; -import java.util.LinkedHashMap; -import java.util.LinkedHashSet; -import java.util.List; -import java.util.Map; -import java.util.Objects; -import java.util.Set; -import org.checkerframework.checker.nullness.qual.Nullable; -import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags; -import org.openapijsonschematools.client.configurations.SchemaConfiguration; -import org.openapijsonschematools.client.exceptions.UnsetPropertyException; -import org.openapijsonschematools.client.exceptions.ValidationException; -import org.openapijsonschematools.client.paths.fakeobjinquery.get.parameters.parameter0.Schema0; -import org.openapijsonschematools.client.schemas.AnyTypeJsonSchema; -import org.openapijsonschematools.client.schemas.GenericBuilder; -import org.openapijsonschematools.client.schemas.NotAnyTypeJsonSchema; -import org.openapijsonschematools.client.schemas.validation.FrozenMap; -import org.openapijsonschematools.client.schemas.validation.JsonSchema; -import org.openapijsonschematools.client.schemas.validation.JsonSchemaInfo; -import org.openapijsonschematools.client.schemas.validation.MapSchemaValidator; -import org.openapijsonschematools.client.schemas.validation.MapUtils; -import org.openapijsonschematools.client.schemas.validation.PathToSchemasMap; -import org.openapijsonschematools.client.schemas.validation.PropertyEntry; -import org.openapijsonschematools.client.schemas.validation.ValidationMetadata; - -public class FakeobjinqueryGetQueryParameters { - // nest classes so all schemas and input/output classes can be public - - - public static class AdditionalProperties extends NotAnyTypeJsonSchema.NotAnyTypeJsonSchema1 { - // NotAnyTypeSchema - private static @Nullable AdditionalProperties instance = null; - public static AdditionalProperties getInstance() { - if (instance == null) { - instance = new AdditionalProperties(); - } - return instance; - } - } - - - public static class QueryParametersMap extends FrozenMap { - protected QueryParametersMap(FrozenMap m) { - super(m); - } - public static final Set requiredKeys = Set.of(); - public static final Set optionalKeys = Set.of( - "mapBean" - ); - public static QueryParametersMap of(Map> arg, SchemaConfiguration configuration) throws ValidationException { - return FakeobjinqueryGetQueryParameters1.getInstance().validate(arg, configuration); - } - - public Schema0.SchemaMap0 mapBean() throws UnsetPropertyException { - return getOrThrow("mapBean"); - } - } - - public interface SetterForMapBean { - Map> getInstance(); - T getBuilderAfterMapBean(Map> instance); - - default T mapBean(Map value) { - var instance = getInstance(); - instance.put("mapBean", value); - return getBuilderAfterMapBean(instance); - } - } - - public static class QueryParametersMapBuilder implements GenericBuilder>>, SetterForMapBean { - private final Map> instance; - private static final Set knownKeys = Set.of( - "mapBean" - ); - public Set getKnownKeys() { - return knownKeys; - } - public QueryParametersMapBuilder() { - this.instance = new LinkedHashMap<>(); - } - public Map> build() { - return instance; - } - public Map> getInstance() { - return instance; - } - public QueryParametersMapBuilder getBuilderAfterMapBean(Map> instance) { - return this; - } - } - - - public sealed interface FakeobjinqueryGetQueryParameters1Boxed permits FakeobjinqueryGetQueryParameters1BoxedMap { - @Nullable Object getData(); - } - - public record FakeobjinqueryGetQueryParameters1BoxedMap(QueryParametersMap data) implements FakeobjinqueryGetQueryParameters1Boxed { - @Override - public @Nullable Object getData() { - return data; - } - } - - - public static class FakeobjinqueryGetQueryParameters1 extends JsonSchema implements MapSchemaValidator { - private static @Nullable FakeobjinqueryGetQueryParameters1 instance = null; - - protected FakeobjinqueryGetQueryParameters1() { - super(new JsonSchemaInfo() - .type(Set.of(Map.class)) - .properties(Map.ofEntries( - new PropertyEntry("mapBean", Schema0.Schema01.class) - )) - .additionalProperties(AdditionalProperties.class) - ); - } - - public static FakeobjinqueryGetQueryParameters1 getInstance() { - if (instance == null) { - instance = new FakeobjinqueryGetQueryParameters1(); - } - return instance; - } - - 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 RuntimeException("Invalid non-string key value"); - } - String propertyName = (String) entryKey; - List propertyPathToItem = new ArrayList<>(pathToItem); - propertyPathToItem.add(propertyName); - Object value = entry.getValue(); - LinkedHashMap, Nothing?> schemas = pathToSchemas.get(propertyPathToItem); - if (schemas == null) { - throw new RuntimeException("Validation 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"); - } - properties.put(propertyName, (Schema0.SchemaMap0) propertyInstance); - } - FrozenMap castProperties = new FrozenMap<>(properties); - return new QueryParametersMap(castProperties); - } - - 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); - SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().build())); - ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, new PathToSchemasMap(), new LinkedHashSet<>()); - PathToSchemasMap pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet); - return getNewInstance(castArg, validationMetadata.pathToItem(), pathToSchemasMap); - } - - - @Override - public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws 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"); - } - @Override - public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { - if (arg instanceof Map) { - return getNewInstance((Map) arg, pathToItem, pathToSchemas); - } - throw new RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); - } - @Override - public FakeobjinqueryGetQueryParameters1BoxedMap validateAndBox(Map arg, SchemaConfiguration configuration) throws ValidationException { - return new FakeobjinqueryGetQueryParameters1BoxedMap(validate(arg, configuration)); - } - @Override - public FakeobjinqueryGetQueryParameters1Boxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { - 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"); - } - } - -} diff --git a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/fakeobjinquery/get/FakeobjinqueryGetResponses.kt b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/fakeobjinquery/get/FakeobjinqueryGetResponses.kt deleted file mode 100644 index 70aa9c5574f..00000000000 --- a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/fakeobjinquery/get/FakeobjinqueryGetResponses.kt +++ /dev/null @@ -1,53 +0,0 @@ -package org.openapijsonschematools.client.paths.fakeobjinquery.get; - -import org.openapijsonschematools.client.paths.fakeobjinquery.get.responses.FakeobjinqueryGetCode200Response; -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; -import org.checkerframework.checker.nullness.qual.Nullable; - -import java.net.http.HttpResponse; -import java.util.Map; -import java.util.AbstractMap; - -public class FakeobjinqueryGetResponses { - public sealed interface EndpointResponse permits EndpointFakeobjinqueryGetCode200Response {} - - public record EndpointFakeobjinqueryGetCode200Response( - HttpResponse response, - Nothing? body, - Nothing? headers - ) implements EndpointResponse, ApiResponse{ - } - - public sealed interface StatusCodeResponseDeserializer permits StatusFakeobjinqueryGetCode200ResponseDeserializer {} - - public static final class StatusFakeobjinqueryGetCode200ResponseDeserializer extends FakeobjinqueryGetCode200Response.FakeobjinqueryGetCode200Response1 implements StatusCodeResponseDeserializer { - } - - public static final class FakeobjinqueryGetResponses1 implements ResponsesDeserializer { - private final Map statusCodeToResponseDeserializer; - public FakeobjinqueryGetResponses1() { - this.statusCodeToResponseDeserializer = Map.ofEntries( - new AbstractMap.SimpleEntry<>("200", new StatusFakeobjinqueryGetCode200ResponseDeserializer()) - ); - } - - 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) { - throw new ApiException( - "Invalid response statusCode="+statusCode+" has no response defined in the openapi document", - response - ); - } - StatusFakeobjinqueryGetCode200ResponseDeserializer castDeserializer = (StatusFakeobjinqueryGetCode200ResponseDeserializer) statusCodeDeserializer; - var deserializedResponse = castDeserializer.deserialize(response, configuration); - return new EndpointFakeobjinqueryGetCode200Response(response, deserializedResponse.body(), deserializedResponse.headers()); - } - } -} diff --git a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/fakeobjinquery/get/Parameters.kt b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/fakeobjinquery/get/Parameters.kt deleted file mode 100644 index 58e787df688..00000000000 --- a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/fakeobjinquery/get/Parameters.kt +++ /dev/null @@ -1,20 +0,0 @@ -package org.openapijsonschematools.client.paths.fakeobjinquery.get; - -import org.openapijsonschematools.client.paths.fakeobjinquery.get.parameters.Parameter0; -import org.openapijsonschematools.client.parameter.QuerySerializer; - -import java.util.Map; -import java.util.AbstractMap; - -public class Parameters { - - public static class QueryParametersSerializer extends QuerySerializer { - public QueryParametersSerializer() { - super( - Map.ofEntries( - new AbstractMap.SimpleEntry<>("mapBean", new Parameter0.Parameter01()) - ) - ); - } - } -} diff --git a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/fakeobjinquery/get/parameters/Parameter0.kt b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/fakeobjinquery/get/parameters/Parameter0.kt deleted file mode 100644 index 75d3713a0bb..00000000000 --- a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/fakeobjinquery/get/parameters/Parameter0.kt +++ /dev/null @@ -1,23 +0,0 @@ -package org.openapijsonschematools.client.paths.fakeobjinquery.get.parameters; - -import org.openapijsonschematools.client.parameter.ParameterStyle; -import org.openapijsonschematools.client.parameter.ParameterInType; -import org.openapijsonschematools.client.parameter.SchemaParameter; -import org.openapijsonschematools.client.paths.fakeobjinquery.get.parameters.parameter0.Schema0; - -public class Parameter0 { - - public static class Parameter01 extends SchemaParameter { - public Parameter01() { - super( - "mapBean", - ParameterInType.QUERY, - false, - ParameterStyle.DEEP_OBJECT, - true, - false, - Schema0.Schema01.getInstance() - ); - } - } -} diff --git a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/fakeobjinquery/get/parameters/parameter0/Schema0.kt b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/fakeobjinquery/get/parameters/parameter0/Schema0.kt deleted file mode 100644 index d8638a10a71..00000000000 --- a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/fakeobjinquery/get/parameters/parameter0/Schema0.kt +++ /dev/null @@ -1,200 +0,0 @@ -package org.openapijsonschematools.client.paths.fakeobjinquery.get.parameters.parameter0; -import java.util.ArrayList; -import java.util.HashSet; -import java.util.LinkedHashMap; -import java.util.LinkedHashSet; -import java.util.List; -import java.util.Map; -import java.util.Objects; -import java.util.Set; -import org.checkerframework.checker.nullness.qual.Nullable; -import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags; -import org.openapijsonschematools.client.configurations.SchemaConfiguration; -import org.openapijsonschematools.client.exceptions.InvalidAdditionalPropertyException; -import org.openapijsonschematools.client.exceptions.UnsetPropertyException; -import org.openapijsonschematools.client.exceptions.ValidationException; -import org.openapijsonschematools.client.schemas.GenericBuilder; -import org.openapijsonschematools.client.schemas.StringJsonSchema; -import org.openapijsonschematools.client.schemas.UnsetAddPropsSetter; -import org.openapijsonschematools.client.schemas.validation.FrozenMap; -import org.openapijsonschematools.client.schemas.validation.JsonSchema; -import org.openapijsonschematools.client.schemas.validation.JsonSchemaInfo; -import org.openapijsonschematools.client.schemas.validation.MapSchemaValidator; -import org.openapijsonschematools.client.schemas.validation.PathToSchemasMap; -import org.openapijsonschematools.client.schemas.validation.PropertyEntry; -import org.openapijsonschematools.client.schemas.validation.ValidationMetadata; - -public class Schema0 { - // nest classes so all schemas and input/output classes can be public - - - public static class Keyword0 extends StringJsonSchema.StringJsonSchema1 { - private static @Nullable Keyword0 instance = null; - public static Keyword0 getInstance() { - if (instance == null) { - instance = new Keyword0(); - } - return instance; - } - } - - - public static class SchemaMap0 extends FrozenMap<@Nullable Object> { - protected SchemaMap0(FrozenMap<@Nullable Object> m) { - super(m); - } - public static final Set requiredKeys = Set.of(); - public static final Set optionalKeys = Set.of( - "keyword" - ); - public static SchemaMap0 of(Map arg, SchemaConfiguration configuration) throws ValidationException { - return Schema01.getInstance().validate(arg, configuration); - } - - public String keyword() throws UnsetPropertyException { - String key = "keyword"; - throwIfKeyNotPresent(key); - @Nullable Object value = get(key); - if (!(value instanceof String)) { - throw new RuntimeException("Invalid value stored for keyword"); - } - return (String) value; - } - - public @Nullable Object getAdditionalProperty(String name) throws UnsetPropertyException, InvalidAdditionalPropertyException { - throwIfKeyKnown(name, requiredKeys, optionalKeys); - throwIfKeyNotPresent(name); - return get(name); - } - } - - public interface SetterForKeyword0 { - Map getInstance(); - T getBuilderAfterKeyword0(Map instance); - - default T keyword(String value) { - var instance = getInstance(); - instance.put("keyword", value); - return getBuilderAfterKeyword0(instance); - } - } - - public static class SchemaMapBuilder0 extends UnsetAddPropsSetter implements GenericBuilder>, SetterForKeyword0 { - private final Map instance; - private static final Set knownKeys = Set.of( - "keyword" - ); - public Set getKnownKeys() { - return knownKeys; - } - public SchemaMapBuilder0() { - this.instance = new LinkedHashMap<>(); - } - public Map build() { - return instance; - } - public Map getInstance() { - return instance; - } - public SchemaMapBuilder0 getBuilderAfterKeyword0(Map instance) { - return this; - } - public SchemaMapBuilder0 getBuilderAfterAdditionalProperty(Map instance) { - return this; - } - } - - - public sealed interface Schema01Boxed permits Schema01BoxedMap { - @Nullable Object getData(); - } - - public record Schema01BoxedMap(SchemaMap0 data) implements Schema01Boxed { - @Override - public @Nullable Object getData() { - return data; - } - } - - - public static class Schema01 extends JsonSchema implements MapSchemaValidator { - private static @Nullable Schema01 instance = null; - - protected Schema01() { - super(new JsonSchemaInfo() - .type(Set.of(Map.class)) - .properties(Map.ofEntries( - new PropertyEntry("keyword", Keyword0.class) - )) - ); - } - - public static Schema01 getInstance() { - if (instance == null) { - instance = new Schema01(); - } - return instance; - } - - 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 RuntimeException("Invalid non-string key value"); - } - String propertyName = (String) entryKey; - List propertyPathToItem = new ArrayList<>(pathToItem); - propertyPathToItem.add(propertyName); - Object value = entry.getValue(); - LinkedHashMap, Nothing?> schemas = pathToSchemas.get(propertyPathToItem); - if (schemas == null) { - throw new RuntimeException("Validation result is invalid, schemas must exist for a pathToItem"); - } - JsonSchema propertySchema = schemas.entrySet().iterator().next().getKey(); - @Nullable Object propertyInstance = propertySchema.getNewInstance(value, propertyPathToItem, pathToSchemas); - properties.put(propertyName, propertyInstance); - } - FrozenMap<@Nullable Object> castProperties = new FrozenMap<>(properties); - return new SchemaMap0(castProperties); - } - - 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); - SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().build())); - ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, new PathToSchemasMap(), new LinkedHashSet<>()); - PathToSchemasMap pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet); - return getNewInstance(castArg, validationMetadata.pathToItem(), pathToSchemasMap); - } - - - @Override - public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws 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"); - } - @Override - public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { - if (arg instanceof Map) { - return getNewInstance((Map) arg, pathToItem, pathToSchemas); - } - 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 { - return new Schema01BoxedMap(validate(arg, configuration)); - } - @Override - public Schema01Boxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { - 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"); - } - } - -} diff --git a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/fakeobjinquery/get/responses/FakeobjinqueryGetCode200Response.kt b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/fakeobjinquery/get/responses/FakeobjinqueryGetCode200Response.kt deleted file mode 100644 index ea4029a4cb2..00000000000 --- a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/fakeobjinquery/get/responses/FakeobjinqueryGetCode200Response.kt +++ /dev/null @@ -1,7 +0,0 @@ -package org.openapijsonschematools.client.paths.fakeobjinquery.get.responses; - -import org.openapijsonschematools.client.components.responses.SuccessDescriptionOnly; - -public class FakeobjinqueryGetCode200Response extends SuccessDescriptionOnly { - public static class FakeobjinqueryGetCode200Response1 extends SuccessDescriptionOnly1 {} -} diff --git a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/fakeparametercollisions1ababselfab/Fakeparametercollisions1ababselfabPost.kt b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/fakeparametercollisions1ababselfab/Fakeparametercollisions1ababselfabPost.kt deleted file mode 100644 index 0b245fa60d0..00000000000 --- a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/fakeparametercollisions1ababselfab/Fakeparametercollisions1ababselfabPost.kt +++ /dev/null @@ -1,291 +0,0 @@ -package org.openapijsonschematools.client.paths.fakeparametercollisions1ababselfab; - -import org.checkerframework.checker.nullness.qual.Nullable; -import org.openapijsonschematools.client.paths.fakeparametercollisions1ababselfab.post.Fakeparametercollisions1ababselfabPostRequestBody; -import org.openapijsonschematools.client.paths.fakeparametercollisions1ababselfab.post.Fakeparametercollisions1ababselfabPostHeaderParameters; -import org.openapijsonschematools.client.paths.fakeparametercollisions1ababselfab.post.Fakeparametercollisions1ababselfabPostQueryParameters; -import org.openapijsonschematools.client.paths.fakeparametercollisions1ababselfab.post.Fakeparametercollisions1ababselfabPostCookieParameters; -import org.openapijsonschematools.client.RootServerInfo; -import org.openapijsonschematools.client.paths.fakeparametercollisions1ababselfab.post.Fakeparametercollisions1ababselfabPostPathParameters; -import org.openapijsonschematools.client.paths.fakeparametercollisions1ababselfab.post.Parameters; -import org.openapijsonschematools.client.paths.fakeparametercollisions1ababselfab.post.Fakeparametercollisions1ababselfabPostResponses; -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.requestbody.SerializedRequestBody; -import org.openapijsonschematools.client.paths.Fakeparametercollisions1ababselfab; - -import java.io.IOException; -import java.util.ArrayList; -import java.net.http.HttpClient; -import java.net.http.HttpRequest; -import java.time.Duration; -import java.util.List; -import java.util.Map; - -public class Fakeparametercollisions1ababselfabPost { - private static class PostProvider { - private static final String method = "post"; - - public static Fakeparametercollisions1ababselfabPostResponses.EndpointResponse post( - PostRequest request, - ApiConfiguration apiConfiguration, - SchemaConfiguration schemaConfiguration, - HttpClient client - ) throws IOException, InterruptedException, ValidationException, NotImplementedException, ApiException { - Map> headers = apiConfiguration.getDefaultHeaders(); - - @Nullable SerializedRequestBody serializedRequestBody; - HttpRequest.BodyPublisher bodyPublisher = HttpRequest.BodyPublishers.noBody(); - if (request.requestBody != null) { - serializedRequestBody = new Fakeparametercollisions1ababselfabPostRequestBody.Fakeparametercollisions1ababselfabPostRequestBody1().serialize( - request.requestBody - ); - var contentTypeHeaderValues = headers.getOrDefault("Content-Type", new ArrayList<>()); - contentTypeHeaderValues.add(serializedRequestBody.contentType); - bodyPublisher = serializedRequestBody.bodyPublisher; - } - - if (request.headerParameters != null) { - var headersSerializer = new Parameters.HeaderParametersSerializer(); - Map> serializedHeaders = headersSerializer.serialize(request.headerParameters); - headers.putAll(serializedHeaders); - } - - if (request.cookieParameters != null) { - var cookieSerializer = new Parameters.CookieParametersSerializer(); - String serializedCookie = cookieSerializer.serialize(request.cookieParameters); - var cookieHeaderValues = headers.getOrDefault("Cookie", new ArrayList<>()); - cookieHeaderValues.add(serializedCookie); - } - - var pathSerializer = new Parameters.PathParametersSerializer(); - String updatedPath = pathSerializer.serialize(request.pathParameters, Fakeparametercollisions1ababselfab.path); - - var querySerializer = new Parameters.QueryParametersSerializer(); - @Nullable Map queryMap = null; - if (request.queryParameters != null) { - queryMap = querySerializer.getQueryMap(request.queryParameters); - } - String host = apiConfiguration.getServer(request.serverIndex).url(); - - String url = host + updatedPath; - if (queryMap != null) { - url = url + querySerializer.serialize(queryMap); - } - var httpRequest = RestClient.getRequest( - url, - method, - bodyPublisher, - headers, - request.timeout - ); - var response = RestClient.getResponse(httpRequest, client); - var responsesDeserializer = new Fakeparametercollisions1ababselfabPostResponses.Fakeparametercollisions1ababselfabPostResponses1(); - return responsesDeserializer.deserialize(response, schemaConfiguration); - } - } - - public interface PostOperation { - ApiConfiguration getApiConfiguration(); - SchemaConfiguration getSchemaConfiguration(); - HttpClient getClient(); - default Fakeparametercollisions1ababselfabPostResponses.EndpointResponse post(PostRequest request) throws IOException, InterruptedException, ValidationException, NotImplementedException, ApiException { - return PostProvider.post(request, getApiConfiguration(), getSchemaConfiguration(), getClient()); - } - } - - public interface ParameterCollisionsOperation { - ApiConfiguration getApiConfiguration(); - SchemaConfiguration getSchemaConfiguration(); - HttpClient getClient(); - default Fakeparametercollisions1ababselfabPostResponses.EndpointResponse parameterCollisions(PostRequest request) throws IOException, InterruptedException, ValidationException, NotImplementedException, ApiException { - return PostProvider.post(request, getApiConfiguration(), getSchemaConfiguration(), getClient()); - } - } - - public static class Post extends ApiClient implements PostOperation { - public Post(ApiConfiguration apiConfiguration, SchemaConfiguration schemaConfiguration) { - super(apiConfiguration, schemaConfiguration); - } - } - - public static class PostRequest { - public Fakeparametercollisions1ababselfabPostPathParameters.PathParametersMap pathParameters; - public Fakeparametercollisions1ababselfabPostRequestBody.@Nullable SealedRequestBody requestBody; - public Fakeparametercollisions1ababselfabPostHeaderParameters.@Nullable HeaderParametersMap headerParameters; - public Fakeparametercollisions1ababselfabPostQueryParameters.@Nullable QueryParametersMap queryParameters; - public Fakeparametercollisions1ababselfabPostCookieParameters.@Nullable CookieParametersMap cookieParameters; - public RootServerInfo.@Nullable ServerIndex serverIndex; - public @Nullable Duration timeout; - - public PostRequest( - Fakeparametercollisions1ababselfabPostPathParameters.PathParametersMap pathParameters, - Fakeparametercollisions1ababselfabPostRequestBody.@Nullable SealedRequestBody requestBody, - Fakeparametercollisions1ababselfabPostHeaderParameters.@Nullable HeaderParametersMap headerParameters, - Fakeparametercollisions1ababselfabPostQueryParameters.@Nullable QueryParametersMap queryParameters, - Fakeparametercollisions1ababselfabPostCookieParameters.@Nullable CookieParametersMap cookieParameters, - RootServerInfo.@Nullable ServerIndex serverIndex, - @Nullable Duration timeout - ) { - this.pathParameters = pathParameters; - this.requestBody = requestBody; - this.headerParameters = headerParameters; - this.queryParameters = queryParameters; - this.cookieParameters = cookieParameters; - this.serverIndex = serverIndex; - this.timeout = timeout; - } - } - - public static class PostNullableRequest { - public Fakeparametercollisions1ababselfabPostPathParameters.@Nullable PathParametersMap pathParameters; - public Fakeparametercollisions1ababselfabPostRequestBody.@Nullable SealedRequestBody requestBody; - public Fakeparametercollisions1ababselfabPostHeaderParameters.@Nullable HeaderParametersMap headerParameters; - public Fakeparametercollisions1ababselfabPostQueryParameters.@Nullable QueryParametersMap queryParameters; - public Fakeparametercollisions1ababselfabPostCookieParameters.@Nullable CookieParametersMap cookieParameters; - public RootServerInfo.@Nullable ServerIndex serverIndex; - public @Nullable Duration timeout; - } - - public interface SetterForRequestBody { - PostNullableRequest getInstance(); - T getBuilderAfterRequestBody(PostNullableRequest instance); - default T requestBody(Fakeparametercollisions1ababselfabPostRequestBody.SealedRequestBody requestBody) { - var instance = getInstance(); - instance.requestBody = requestBody; - return getBuilderAfterRequestBody(instance); - } - } - - public interface SetterForHeaderParameters { - PostNullableRequest getInstance(); - T getBuilderAfterHeaderParameters(PostNullableRequest instance); - default T headerParameters(Fakeparametercollisions1ababselfabPostHeaderParameters.HeaderParametersMap headerParameters) { - var instance = getInstance(); - instance.headerParameters = headerParameters; - return getBuilderAfterHeaderParameters(instance); - } - } - - public interface SetterForQueryParameters { - PostNullableRequest getInstance(); - T getBuilderAfterQueryParameters(PostNullableRequest instance); - default T queryParameters(Fakeparametercollisions1ababselfabPostQueryParameters.QueryParametersMap queryParameters) { - var instance = getInstance(); - instance.queryParameters = queryParameters; - return getBuilderAfterQueryParameters(instance); - } - } - - public interface SetterForCookieParameters { - PostNullableRequest getInstance(); - T getBuilderAfterCookieParameters(PostNullableRequest instance); - default T cookieParameters(Fakeparametercollisions1ababselfabPostCookieParameters.CookieParametersMap cookieParameters) { - var instance = getInstance(); - instance.cookieParameters = cookieParameters; - return getBuilderAfterCookieParameters(instance); - } - } - - public interface SetterForServerIndex { - PostNullableRequest getInstance(); - T getBuilderAfterServerIndex(PostNullableRequest instance); - default T serverIndex(RootServerInfo.ServerIndex serverIndex) { - var instance = getInstance(); - instance.serverIndex = serverIndex; - return getBuilderAfterServerIndex(instance); - } - } - - public interface SetterForTimeout { - PostNullableRequest getInstance(); - T getBuilderAfterTimeout(PostNullableRequest instance); - default T timeout(Duration timeout) { - var instance = getInstance(); - instance.timeout = timeout; - return getBuilderAfterTimeout(instance); - } - } - - public interface SetterForPathParameters { - PostNullableRequest getInstance(); - T getBuilderAfterPathParameters(PostNullableRequest instance); - default T pathParameters(Fakeparametercollisions1ababselfabPostPathParameters.PathParametersMap pathParameters) { - var instance = getInstance(); - instance.pathParameters = pathParameters; - return getBuilderAfterPathParameters(instance); - } - } - - public static class Post0RequestBuilder implements SetterForRequestBody, SetterForHeaderParameters, SetterForQueryParameters, SetterForCookieParameters, SetterForServerIndex, SetterForTimeout { - private final PostNullableRequest instance; - - public Post0RequestBuilder(PostNullableRequest instance) { - this.instance = instance; - } - - public PostRequest build() { - var pathParameters = instance.pathParameters; - if (pathParameters == null) { - throw new RuntimeException("invalid null value for required parameter"); - } - return new PostRequest( - pathParameters, - instance.requestBody, - instance.headerParameters, - instance.queryParameters, - instance.cookieParameters, - instance.serverIndex, - instance.timeout - ); - } - - public PostNullableRequest getInstance() { - return instance; - } - - public Post0RequestBuilder getBuilderAfterRequestBody(PostNullableRequest instance) { - return this; - } - - public Post0RequestBuilder getBuilderAfterHeaderParameters(PostNullableRequest instance) { - return this; - } - - public Post0RequestBuilder getBuilderAfterQueryParameters(PostNullableRequest instance) { - return this; - } - - public Post0RequestBuilder getBuilderAfterCookieParameters(PostNullableRequest instance) { - return this; - } - - public Post0RequestBuilder getBuilderAfterServerIndex(PostNullableRequest instance) { - return this; - } - - public Post0RequestBuilder getBuilderAfterTimeout(PostNullableRequest instance) { - return this; - } - } - public static class PostRequestBuilder implements SetterForPathParameters { - private final PostNullableRequest instance; - - public PostRequestBuilder() { - this.instance = new PostNullableRequest(); - } - - public PostNullableRequest getInstance() { - return instance; - } - - public Post0RequestBuilder getBuilderAfterPathParameters(PostNullableRequest instance) { - return new Post0RequestBuilder(instance); - } - } -} diff --git a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/fakeparametercollisions1ababselfab/post/Fakeparametercollisions1ababselfabPostCookieParameters.kt b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/fakeparametercollisions1ababselfab/post/Fakeparametercollisions1ababselfabPostCookieParameters.kt deleted file mode 100644 index 58740e77f24..00000000000 --- a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/fakeparametercollisions1ababselfab/post/Fakeparametercollisions1ababselfabPostCookieParameters.kt +++ /dev/null @@ -1,286 +0,0 @@ -package org.openapijsonschematools.client.paths.fakeparametercollisions1ababselfab.post; -import java.util.ArrayList; -import java.util.HashSet; -import java.util.LinkedHashMap; -import java.util.LinkedHashSet; -import java.util.List; -import java.util.Map; -import java.util.Objects; -import java.util.Set; -import org.checkerframework.checker.nullness.qual.Nullable; -import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags; -import org.openapijsonschematools.client.configurations.SchemaConfiguration; -import org.openapijsonschematools.client.exceptions.UnsetPropertyException; -import org.openapijsonschematools.client.exceptions.ValidationException; -import org.openapijsonschematools.client.paths.fakeparametercollisions1ababselfab.post.parameters.parameter14.Schema14; -import org.openapijsonschematools.client.paths.fakeparametercollisions1ababselfab.post.parameters.parameter15.Schema15; -import org.openapijsonschematools.client.paths.fakeparametercollisions1ababselfab.post.parameters.parameter16.Schema16; -import org.openapijsonschematools.client.paths.fakeparametercollisions1ababselfab.post.parameters.parameter17.Schema17; -import org.openapijsonschematools.client.paths.fakeparametercollisions1ababselfab.post.parameters.parameter18.Schema18; -import org.openapijsonschematools.client.schemas.AnyTypeJsonSchema; -import org.openapijsonschematools.client.schemas.GenericBuilder; -import org.openapijsonschematools.client.schemas.NotAnyTypeJsonSchema; -import org.openapijsonschematools.client.schemas.validation.FrozenMap; -import org.openapijsonschematools.client.schemas.validation.JsonSchema; -import org.openapijsonschematools.client.schemas.validation.JsonSchemaInfo; -import org.openapijsonschematools.client.schemas.validation.MapSchemaValidator; -import org.openapijsonschematools.client.schemas.validation.MapUtils; -import org.openapijsonschematools.client.schemas.validation.PathToSchemasMap; -import org.openapijsonschematools.client.schemas.validation.PropertyEntry; -import org.openapijsonschematools.client.schemas.validation.ValidationMetadata; - -public class Fakeparametercollisions1ababselfabPostCookieParameters { - // nest classes so all schemas and input/output classes can be public - - - public static class AdditionalProperties extends NotAnyTypeJsonSchema.NotAnyTypeJsonSchema1 { - // NotAnyTypeSchema - private static @Nullable AdditionalProperties instance = null; - public static AdditionalProperties getInstance() { - if (instance == null) { - instance = new AdditionalProperties(); - } - return instance; - } - } - - - public static class CookieParametersMap extends FrozenMap<@Nullable Object> { - protected CookieParametersMap(FrozenMap<@Nullable Object> m) { - super(m); - } - public static final Set requiredKeys = Set.of(); - public static final Set optionalKeys = Set.of( - "1", - "aB", - "Ab", - "A-B", - "self" - ); - public static CookieParametersMap of(Map arg, SchemaConfiguration configuration) throws ValidationException { - return Fakeparametercollisions1ababselfabPostCookieParameters1.getInstance().validate(arg, configuration); - } - - public String aB() throws UnsetPropertyException { - String key = "aB"; - throwIfKeyNotPresent(key); - @Nullable Object value = get(key); - if (!(value instanceof String)) { - throw new RuntimeException("Invalid value stored for aB"); - } - return (String) value; - } - - public String Ab() throws UnsetPropertyException { - String key = "Ab"; - throwIfKeyNotPresent(key); - @Nullable Object value = get(key); - if (!(value instanceof String)) { - throw new RuntimeException("Invalid value stored for Ab"); - } - return (String) value; - } - - public String self() throws UnsetPropertyException { - String key = "self"; - throwIfKeyNotPresent(key); - @Nullable Object value = get(key); - if (!(value instanceof String)) { - throw new RuntimeException("Invalid value stored for self"); - } - return (String) value; - } - } - - public interface SetterForSchema1 { - Map getInstance(); - T getBuilderAfterSchema1(Map instance); - - default T positive1(String value) { - var instance = getInstance(); - instance.put("1", value); - return getBuilderAfterSchema1(instance); - } - } - - public interface SetterForAB { - Map getInstance(); - T getBuilderAfterAB(Map instance); - - default T aB(String value) { - var instance = getInstance(); - instance.put("aB", value); - return getBuilderAfterAB(instance); - } - } - - public interface SetterForAb { - Map getInstance(); - T getBuilderAfterAb(Map instance); - - default T Ab(String value) { - var instance = getInstance(); - instance.put("Ab", value); - return getBuilderAfterAb(instance); - } - } - - public interface SetterForAB1 { - Map getInstance(); - T getBuilderAfterAB1(Map instance); - - default T aHyphenMinusB(String value) { - var instance = getInstance(); - instance.put("A-B", value); - return getBuilderAfterAB1(instance); - } - } - - public interface SetterForSelf { - Map getInstance(); - T getBuilderAfterSelf(Map instance); - - default T self(String value) { - var instance = getInstance(); - instance.put("self", value); - return getBuilderAfterSelf(instance); - } - } - - public static class CookieParametersMapBuilder implements GenericBuilder>, SetterForSchema1, SetterForAB, SetterForAb, SetterForAB1, SetterForSelf { - private final Map instance; - private static final Set knownKeys = Set.of( - "1", - "aB", - "Ab", - "A-B", - "self" - ); - public Set getKnownKeys() { - return knownKeys; - } - public CookieParametersMapBuilder() { - this.instance = new LinkedHashMap<>(); - } - public Map build() { - return instance; - } - public Map getInstance() { - return instance; - } - public CookieParametersMapBuilder getBuilderAfterSchema1(Map instance) { - return this; - } - public CookieParametersMapBuilder getBuilderAfterAB(Map instance) { - return this; - } - public CookieParametersMapBuilder getBuilderAfterAb(Map instance) { - return this; - } - public CookieParametersMapBuilder getBuilderAfterAB1(Map instance) { - return this; - } - public CookieParametersMapBuilder getBuilderAfterSelf(Map instance) { - return this; - } - } - - - public sealed interface Fakeparametercollisions1ababselfabPostCookieParameters1Boxed permits Fakeparametercollisions1ababselfabPostCookieParameters1BoxedMap { - @Nullable Object getData(); - } - - public record Fakeparametercollisions1ababselfabPostCookieParameters1BoxedMap(CookieParametersMap data) implements Fakeparametercollisions1ababselfabPostCookieParameters1Boxed { - @Override - public @Nullable Object getData() { - return data; - } - } - - - public static class Fakeparametercollisions1ababselfabPostCookieParameters1 extends JsonSchema implements MapSchemaValidator { - private static @Nullable Fakeparametercollisions1ababselfabPostCookieParameters1 instance = null; - - protected Fakeparametercollisions1ababselfabPostCookieParameters1() { - super(new JsonSchemaInfo() - .type(Set.of(Map.class)) - .properties(Map.ofEntries( - new PropertyEntry("1", Schema14.Schema141.class), - new PropertyEntry("aB", Schema15.Schema151.class), - new PropertyEntry("Ab", Schema16.Schema161.class), - new PropertyEntry("A-B", Schema18.Schema181.class), - new PropertyEntry("self", Schema17.Schema171.class) - )) - .additionalProperties(AdditionalProperties.class) - ); - } - - public static Fakeparametercollisions1ababselfabPostCookieParameters1 getInstance() { - if (instance == null) { - instance = new Fakeparametercollisions1ababselfabPostCookieParameters1(); - } - return instance; - } - - 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 RuntimeException("Invalid non-string key value"); - } - String propertyName = (String) entryKey; - List propertyPathToItem = new ArrayList<>(pathToItem); - propertyPathToItem.add(propertyName); - Object value = entry.getValue(); - LinkedHashMap, Nothing?> schemas = pathToSchemas.get(propertyPathToItem); - if (schemas == null) { - throw new RuntimeException("Validation result is invalid, schemas must exist for a pathToItem"); - } - JsonSchema propertySchema = schemas.entrySet().iterator().next().getKey(); - @Nullable Object propertyInstance = propertySchema.getNewInstance(value, propertyPathToItem, pathToSchemas); - properties.put(propertyName, propertyInstance); - } - FrozenMap<@Nullable Object> castProperties = new FrozenMap<>(properties); - return new CookieParametersMap(castProperties); - } - - 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); - SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().build())); - ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, new PathToSchemasMap(), new LinkedHashSet<>()); - PathToSchemasMap pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet); - return getNewInstance(castArg, validationMetadata.pathToItem(), pathToSchemasMap); - } - - - @Override - public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws 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"); - } - @Override - public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { - if (arg instanceof Map) { - return getNewInstance((Map) arg, pathToItem, pathToSchemas); - } - throw new RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); - } - @Override - public Fakeparametercollisions1ababselfabPostCookieParameters1BoxedMap validateAndBox(Map arg, SchemaConfiguration configuration) throws ValidationException { - return new Fakeparametercollisions1ababselfabPostCookieParameters1BoxedMap(validate(arg, configuration)); - } - @Override - public Fakeparametercollisions1ababselfabPostCookieParameters1Boxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { - 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"); - } - } - -} diff --git a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/fakeparametercollisions1ababselfab/post/Fakeparametercollisions1ababselfabPostHeaderParameters.kt b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/fakeparametercollisions1ababselfab/post/Fakeparametercollisions1ababselfabPostHeaderParameters.kt deleted file mode 100644 index 82c97010a1a..00000000000 --- a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/fakeparametercollisions1ababselfab/post/Fakeparametercollisions1ababselfabPostHeaderParameters.kt +++ /dev/null @@ -1,258 +0,0 @@ -package org.openapijsonschematools.client.paths.fakeparametercollisions1ababselfab.post; -import java.util.ArrayList; -import java.util.HashSet; -import java.util.LinkedHashMap; -import java.util.LinkedHashSet; -import java.util.List; -import java.util.Map; -import java.util.Objects; -import java.util.Set; -import org.checkerframework.checker.nullness.qual.Nullable; -import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags; -import org.openapijsonschematools.client.configurations.SchemaConfiguration; -import org.openapijsonschematools.client.exceptions.UnsetPropertyException; -import org.openapijsonschematools.client.exceptions.ValidationException; -import org.openapijsonschematools.client.paths.fakeparametercollisions1ababselfab.post.parameters.parameter5.Schema5; -import org.openapijsonschematools.client.paths.fakeparametercollisions1ababselfab.post.parameters.parameter6.Schema6; -import org.openapijsonschematools.client.paths.fakeparametercollisions1ababselfab.post.parameters.parameter7.Schema7; -import org.openapijsonschematools.client.paths.fakeparametercollisions1ababselfab.post.parameters.parameter8.Schema8; -import org.openapijsonschematools.client.schemas.AnyTypeJsonSchema; -import org.openapijsonschematools.client.schemas.GenericBuilder; -import org.openapijsonschematools.client.schemas.NotAnyTypeJsonSchema; -import org.openapijsonschematools.client.schemas.validation.FrozenMap; -import org.openapijsonschematools.client.schemas.validation.JsonSchema; -import org.openapijsonschematools.client.schemas.validation.JsonSchemaInfo; -import org.openapijsonschematools.client.schemas.validation.MapSchemaValidator; -import org.openapijsonschematools.client.schemas.validation.MapUtils; -import org.openapijsonschematools.client.schemas.validation.PathToSchemasMap; -import org.openapijsonschematools.client.schemas.validation.PropertyEntry; -import org.openapijsonschematools.client.schemas.validation.ValidationMetadata; - -public class Fakeparametercollisions1ababselfabPostHeaderParameters { - // nest classes so all schemas and input/output classes can be public - - - public static class AdditionalProperties extends NotAnyTypeJsonSchema.NotAnyTypeJsonSchema1 { - // NotAnyTypeSchema - private static @Nullable AdditionalProperties instance = null; - public static AdditionalProperties getInstance() { - if (instance == null) { - instance = new AdditionalProperties(); - } - return instance; - } - } - - - public static class HeaderParametersMap extends FrozenMap<@Nullable Object> { - protected HeaderParametersMap(FrozenMap<@Nullable Object> m) { - super(m); - } - public static final Set requiredKeys = Set.of(); - public static final Set optionalKeys = Set.of( - "1", - "aB", - "A-B", - "self" - ); - public static HeaderParametersMap of(Map arg, SchemaConfiguration configuration) throws ValidationException { - return Fakeparametercollisions1ababselfabPostHeaderParameters1.getInstance().validate(arg, configuration); - } - - public String aB() throws UnsetPropertyException { - String key = "aB"; - throwIfKeyNotPresent(key); - @Nullable Object value = get(key); - if (!(value instanceof String)) { - throw new RuntimeException("Invalid value stored for aB"); - } - return (String) value; - } - - public String self() throws UnsetPropertyException { - String key = "self"; - throwIfKeyNotPresent(key); - @Nullable Object value = get(key); - if (!(value instanceof String)) { - throw new RuntimeException("Invalid value stored for self"); - } - return (String) value; - } - } - - public interface SetterForSchema1 { - Map getInstance(); - T getBuilderAfterSchema1(Map instance); - - default T positive1(String value) { - var instance = getInstance(); - instance.put("1", value); - return getBuilderAfterSchema1(instance); - } - } - - public interface SetterForAB { - Map getInstance(); - T getBuilderAfterAB(Map instance); - - default T aB(String value) { - var instance = getInstance(); - instance.put("aB", value); - return getBuilderAfterAB(instance); - } - } - - public interface SetterForAB1 { - Map getInstance(); - T getBuilderAfterAB1(Map instance); - - default T aHyphenMinusB(String value) { - var instance = getInstance(); - instance.put("A-B", value); - return getBuilderAfterAB1(instance); - } - } - - public interface SetterForSelf { - Map getInstance(); - T getBuilderAfterSelf(Map instance); - - default T self(String value) { - var instance = getInstance(); - instance.put("self", value); - return getBuilderAfterSelf(instance); - } - } - - public static class HeaderParametersMapBuilder implements GenericBuilder>, SetterForSchema1, SetterForAB, SetterForAB1, SetterForSelf { - private final Map instance; - private static final Set knownKeys = Set.of( - "1", - "aB", - "A-B", - "self" - ); - public Set getKnownKeys() { - return knownKeys; - } - public HeaderParametersMapBuilder() { - this.instance = new LinkedHashMap<>(); - } - public Map build() { - return instance; - } - public Map getInstance() { - return instance; - } - public HeaderParametersMapBuilder getBuilderAfterSchema1(Map instance) { - return this; - } - public HeaderParametersMapBuilder getBuilderAfterAB(Map instance) { - return this; - } - public HeaderParametersMapBuilder getBuilderAfterAB1(Map instance) { - return this; - } - public HeaderParametersMapBuilder getBuilderAfterSelf(Map instance) { - return this; - } - } - - - public sealed interface Fakeparametercollisions1ababselfabPostHeaderParameters1Boxed permits Fakeparametercollisions1ababselfabPostHeaderParameters1BoxedMap { - @Nullable Object getData(); - } - - public record Fakeparametercollisions1ababselfabPostHeaderParameters1BoxedMap(HeaderParametersMap data) implements Fakeparametercollisions1ababselfabPostHeaderParameters1Boxed { - @Override - public @Nullable Object getData() { - return data; - } - } - - - public static class Fakeparametercollisions1ababselfabPostHeaderParameters1 extends JsonSchema implements MapSchemaValidator { - private static @Nullable Fakeparametercollisions1ababselfabPostHeaderParameters1 instance = null; - - protected Fakeparametercollisions1ababselfabPostHeaderParameters1() { - super(new JsonSchemaInfo() - .type(Set.of(Map.class)) - .properties(Map.ofEntries( - new PropertyEntry("1", Schema5.Schema51.class), - new PropertyEntry("aB", Schema6.Schema61.class), - new PropertyEntry("A-B", Schema8.Schema81.class), - new PropertyEntry("self", Schema7.Schema71.class) - )) - .additionalProperties(AdditionalProperties.class) - ); - } - - public static Fakeparametercollisions1ababselfabPostHeaderParameters1 getInstance() { - if (instance == null) { - instance = new Fakeparametercollisions1ababselfabPostHeaderParameters1(); - } - return instance; - } - - 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 RuntimeException("Invalid non-string key value"); - } - String propertyName = (String) entryKey; - List propertyPathToItem = new ArrayList<>(pathToItem); - propertyPathToItem.add(propertyName); - Object value = entry.getValue(); - LinkedHashMap, Nothing?> schemas = pathToSchemas.get(propertyPathToItem); - if (schemas == null) { - throw new RuntimeException("Validation result is invalid, schemas must exist for a pathToItem"); - } - JsonSchema propertySchema = schemas.entrySet().iterator().next().getKey(); - @Nullable Object propertyInstance = propertySchema.getNewInstance(value, propertyPathToItem, pathToSchemas); - properties.put(propertyName, propertyInstance); - } - FrozenMap<@Nullable Object> castProperties = new FrozenMap<>(properties); - return new HeaderParametersMap(castProperties); - } - - 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); - SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().build())); - ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, new PathToSchemasMap(), new LinkedHashSet<>()); - PathToSchemasMap pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet); - return getNewInstance(castArg, validationMetadata.pathToItem(), pathToSchemasMap); - } - - - @Override - public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws 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"); - } - @Override - public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { - if (arg instanceof Map) { - return getNewInstance((Map) arg, pathToItem, pathToSchemas); - } - throw new RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); - } - @Override - public Fakeparametercollisions1ababselfabPostHeaderParameters1BoxedMap validateAndBox(Map arg, SchemaConfiguration configuration) throws ValidationException { - return new Fakeparametercollisions1ababselfabPostHeaderParameters1BoxedMap(validate(arg, configuration)); - } - @Override - public Fakeparametercollisions1ababselfabPostHeaderParameters1Boxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { - 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"); - } - } - -} diff --git a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/fakeparametercollisions1ababselfab/post/Fakeparametercollisions1ababselfabPostPathParameters.kt b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/fakeparametercollisions1ababselfab/post/Fakeparametercollisions1ababselfabPostPathParameters.kt deleted file mode 100644 index db3204d98b9..00000000000 --- a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/fakeparametercollisions1ababselfab/post/Fakeparametercollisions1ababselfabPostPathParameters.kt +++ /dev/null @@ -1,819 +0,0 @@ -package org.openapijsonschematools.client.paths.fakeparametercollisions1ababselfab.post; -import java.util.ArrayList; -import java.util.HashSet; -import java.util.LinkedHashMap; -import java.util.LinkedHashSet; -import java.util.List; -import java.util.Map; -import java.util.Objects; -import java.util.Set; -import org.checkerframework.checker.nullness.qual.Nullable; -import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags; -import org.openapijsonschematools.client.configurations.SchemaConfiguration; -import org.openapijsonschematools.client.exceptions.UnsetPropertyException; -import org.openapijsonschematools.client.exceptions.ValidationException; -import org.openapijsonschematools.client.paths.fakeparametercollisions1ababselfab.post.parameters.parameter10.Schema10; -import org.openapijsonschematools.client.paths.fakeparametercollisions1ababselfab.post.parameters.parameter11.Schema11; -import org.openapijsonschematools.client.paths.fakeparametercollisions1ababselfab.post.parameters.parameter12.Schema12; -import org.openapijsonschematools.client.paths.fakeparametercollisions1ababselfab.post.parameters.parameter13.Schema13; -import org.openapijsonschematools.client.paths.fakeparametercollisions1ababselfab.post.parameters.parameter9.Schema9; -import org.openapijsonschematools.client.schemas.AnyTypeJsonSchema; -import org.openapijsonschematools.client.schemas.GenericBuilder; -import org.openapijsonschematools.client.schemas.NotAnyTypeJsonSchema; -import org.openapijsonschematools.client.schemas.validation.FrozenMap; -import org.openapijsonschematools.client.schemas.validation.JsonSchema; -import org.openapijsonschematools.client.schemas.validation.JsonSchemaInfo; -import org.openapijsonschematools.client.schemas.validation.MapSchemaValidator; -import org.openapijsonschematools.client.schemas.validation.MapUtils; -import org.openapijsonschematools.client.schemas.validation.PathToSchemasMap; -import org.openapijsonschematools.client.schemas.validation.PropertyEntry; -import org.openapijsonschematools.client.schemas.validation.ValidationMetadata; - -public class Fakeparametercollisions1ababselfabPostPathParameters { - // nest classes so all schemas and input/output classes can be public - - - public static class AdditionalProperties extends NotAnyTypeJsonSchema.NotAnyTypeJsonSchema1 { - // NotAnyTypeSchema - private static @Nullable AdditionalProperties instance = null; - public static AdditionalProperties getInstance() { - if (instance == null) { - instance = new AdditionalProperties(); - } - return instance; - } - } - - - public static class PathParametersMap extends FrozenMap<@Nullable Object> { - protected PathParametersMap(FrozenMap<@Nullable Object> m) { - super(m); - } - public static final Set requiredKeys = Set.of( - "1", - "A-B", - "Ab", - "aB", - "self" - ); - public static final Set optionalKeys = Set.of(); - public static PathParametersMap of(Map arg, SchemaConfiguration configuration) throws ValidationException { - return Fakeparametercollisions1ababselfabPostPathParameters1.getInstance().validate(arg, configuration); - } - - public String Ab() { - @Nullable Object value = get("Ab"); - if (!(value instanceof String)) { - throw new RuntimeException("Invalid value stored for Ab"); - } - return (String) value; - } - - public String aB() { - @Nullable Object value = get("aB"); - if (!(value instanceof String)) { - throw new RuntimeException("Invalid value stored for aB"); - } - return (String) value; - } - - public String self() { - @Nullable Object value = get("self"); - if (!(value instanceof String)) { - throw new RuntimeException("Invalid value stored for self"); - } - return (String) value; - } - } - - public interface SetterForSchema1 { - Map getInstance(); - T getBuilderAfterSchema1(Map instance); - - default T positive1(String value) { - var instance = getInstance(); - instance.put("1", value); - return getBuilderAfterSchema1(instance); - } - } - - public interface SetterForAB1 { - Map getInstance(); - T getBuilderAfterAB1(Map instance); - - default T aHyphenMinusB(String value) { - var instance = getInstance(); - instance.put("A-B", value); - return getBuilderAfterAB1(instance); - } - } - - public interface SetterForAb { - Map getInstance(); - T getBuilderAfterAb(Map instance); - - default T Ab(String value) { - var instance = getInstance(); - instance.put("Ab", value); - return getBuilderAfterAb(instance); - } - } - - public interface SetterForAB { - Map getInstance(); - T getBuilderAfterAB(Map instance); - - default T aB(String value) { - var instance = getInstance(); - instance.put("aB", value); - return getBuilderAfterAB(instance); - } - } - - public interface SetterForSelf { - Map getInstance(); - T getBuilderAfterSelf(Map instance); - - default T self(String value) { - var instance = getInstance(); - instance.put("self", value); - return getBuilderAfterSelf(instance); - } - } - - public static class PathParametersMap00000Builder implements GenericBuilder> { - private final Map instance; - private static final Set knownKeys = Set.of( - "1", - "A-B", - "Ab", - "aB", - "self" - ); - public Set getKnownKeys() { - return knownKeys; - } - public PathParametersMap00000Builder(Map instance) { - this.instance = instance; - } - public Map build() { - return instance; - } - } - - public static class PathParametersMap00001Builder implements SetterForSelf { - private final Map instance; - public PathParametersMap00001Builder(Map instance) { - this.instance = instance; - } - public Map getInstance() { - return instance; - } - public PathParametersMap00000Builder getBuilderAfterSelf(Map instance) { - return new PathParametersMap00000Builder(instance); - } - } - - public static class PathParametersMap00010Builder implements SetterForAB { - private final Map instance; - public PathParametersMap00010Builder(Map instance) { - this.instance = instance; - } - public Map getInstance() { - return instance; - } - public PathParametersMap00000Builder getBuilderAfterAB(Map instance) { - return new PathParametersMap00000Builder(instance); - } - } - - public static class PathParametersMap00011Builder implements SetterForAB, SetterForSelf { - private final Map instance; - public PathParametersMap00011Builder(Map instance) { - this.instance = instance; - } - public Map getInstance() { - return instance; - } - public PathParametersMap00001Builder getBuilderAfterAB(Map instance) { - return new PathParametersMap00001Builder(instance); - } - public PathParametersMap00010Builder getBuilderAfterSelf(Map instance) { - return new PathParametersMap00010Builder(instance); - } - } - - public static class PathParametersMap00100Builder implements SetterForAb { - private final Map instance; - public PathParametersMap00100Builder(Map instance) { - this.instance = instance; - } - public Map getInstance() { - return instance; - } - public PathParametersMap00000Builder getBuilderAfterAb(Map instance) { - return new PathParametersMap00000Builder(instance); - } - } - - public static class PathParametersMap00101Builder implements SetterForAb, SetterForSelf { - private final Map instance; - public PathParametersMap00101Builder(Map instance) { - this.instance = instance; - } - public Map getInstance() { - return instance; - } - public PathParametersMap00001Builder getBuilderAfterAb(Map instance) { - return new PathParametersMap00001Builder(instance); - } - public PathParametersMap00100Builder getBuilderAfterSelf(Map instance) { - return new PathParametersMap00100Builder(instance); - } - } - - public static class PathParametersMap00110Builder implements SetterForAb, SetterForAB { - private final Map instance; - public PathParametersMap00110Builder(Map instance) { - this.instance = instance; - } - public Map getInstance() { - return instance; - } - public PathParametersMap00010Builder getBuilderAfterAb(Map instance) { - return new PathParametersMap00010Builder(instance); - } - public PathParametersMap00100Builder getBuilderAfterAB(Map instance) { - return new PathParametersMap00100Builder(instance); - } - } - - public static class PathParametersMap00111Builder implements SetterForAb, SetterForAB, SetterForSelf { - private final Map instance; - public PathParametersMap00111Builder(Map instance) { - this.instance = instance; - } - public Map getInstance() { - return instance; - } - public PathParametersMap00011Builder getBuilderAfterAb(Map instance) { - return new PathParametersMap00011Builder(instance); - } - public PathParametersMap00101Builder getBuilderAfterAB(Map instance) { - return new PathParametersMap00101Builder(instance); - } - public PathParametersMap00110Builder getBuilderAfterSelf(Map instance) { - return new PathParametersMap00110Builder(instance); - } - } - - public static class PathParametersMap01000Builder implements SetterForAB1 { - private final Map instance; - public PathParametersMap01000Builder(Map instance) { - this.instance = instance; - } - public Map getInstance() { - return instance; - } - public PathParametersMap00000Builder getBuilderAfterAB1(Map instance) { - return new PathParametersMap00000Builder(instance); - } - } - - public static class PathParametersMap01001Builder implements SetterForAB1, SetterForSelf { - private final Map instance; - public PathParametersMap01001Builder(Map instance) { - this.instance = instance; - } - public Map getInstance() { - return instance; - } - public PathParametersMap00001Builder getBuilderAfterAB1(Map instance) { - return new PathParametersMap00001Builder(instance); - } - public PathParametersMap01000Builder getBuilderAfterSelf(Map instance) { - return new PathParametersMap01000Builder(instance); - } - } - - public static class PathParametersMap01010Builder implements SetterForAB1, SetterForAB { - private final Map instance; - public PathParametersMap01010Builder(Map instance) { - this.instance = instance; - } - public Map getInstance() { - return instance; - } - public PathParametersMap00010Builder getBuilderAfterAB1(Map instance) { - return new PathParametersMap00010Builder(instance); - } - public PathParametersMap01000Builder getBuilderAfterAB(Map instance) { - return new PathParametersMap01000Builder(instance); - } - } - - public static class PathParametersMap01011Builder implements SetterForAB1, SetterForAB, SetterForSelf { - private final Map instance; - public PathParametersMap01011Builder(Map instance) { - this.instance = instance; - } - public Map getInstance() { - return instance; - } - public PathParametersMap00011Builder getBuilderAfterAB1(Map instance) { - return new PathParametersMap00011Builder(instance); - } - public PathParametersMap01001Builder getBuilderAfterAB(Map instance) { - return new PathParametersMap01001Builder(instance); - } - public PathParametersMap01010Builder getBuilderAfterSelf(Map instance) { - return new PathParametersMap01010Builder(instance); - } - } - - public static class PathParametersMap01100Builder implements SetterForAB1, SetterForAb { - private final Map instance; - public PathParametersMap01100Builder(Map instance) { - this.instance = instance; - } - public Map getInstance() { - return instance; - } - public PathParametersMap00100Builder getBuilderAfterAB1(Map instance) { - return new PathParametersMap00100Builder(instance); - } - public PathParametersMap01000Builder getBuilderAfterAb(Map instance) { - return new PathParametersMap01000Builder(instance); - } - } - - public static class PathParametersMap01101Builder implements SetterForAB1, SetterForAb, SetterForSelf { - private final Map instance; - public PathParametersMap01101Builder(Map instance) { - this.instance = instance; - } - public Map getInstance() { - return instance; - } - public PathParametersMap00101Builder getBuilderAfterAB1(Map instance) { - return new PathParametersMap00101Builder(instance); - } - public PathParametersMap01001Builder getBuilderAfterAb(Map instance) { - return new PathParametersMap01001Builder(instance); - } - public PathParametersMap01100Builder getBuilderAfterSelf(Map instance) { - return new PathParametersMap01100Builder(instance); - } - } - - public static class PathParametersMap01110Builder implements SetterForAB1, SetterForAb, SetterForAB { - private final Map instance; - public PathParametersMap01110Builder(Map instance) { - this.instance = instance; - } - public Map getInstance() { - return instance; - } - public PathParametersMap00110Builder getBuilderAfterAB1(Map instance) { - return new PathParametersMap00110Builder(instance); - } - public PathParametersMap01010Builder getBuilderAfterAb(Map instance) { - return new PathParametersMap01010Builder(instance); - } - public PathParametersMap01100Builder getBuilderAfterAB(Map instance) { - return new PathParametersMap01100Builder(instance); - } - } - - public static class PathParametersMap01111Builder implements SetterForAB1, SetterForAb, SetterForAB, SetterForSelf { - private final Map instance; - public PathParametersMap01111Builder(Map instance) { - this.instance = instance; - } - public Map getInstance() { - return instance; - } - public PathParametersMap00111Builder getBuilderAfterAB1(Map instance) { - return new PathParametersMap00111Builder(instance); - } - public PathParametersMap01011Builder getBuilderAfterAb(Map instance) { - return new PathParametersMap01011Builder(instance); - } - public PathParametersMap01101Builder getBuilderAfterAB(Map instance) { - return new PathParametersMap01101Builder(instance); - } - public PathParametersMap01110Builder getBuilderAfterSelf(Map instance) { - return new PathParametersMap01110Builder(instance); - } - } - - public static class PathParametersMap10000Builder implements SetterForSchema1 { - private final Map instance; - public PathParametersMap10000Builder(Map instance) { - this.instance = instance; - } - public Map getInstance() { - return instance; - } - public PathParametersMap00000Builder getBuilderAfterSchema1(Map instance) { - return new PathParametersMap00000Builder(instance); - } - } - - public static class PathParametersMap10001Builder implements SetterForSchema1, SetterForSelf { - private final Map instance; - public PathParametersMap10001Builder(Map instance) { - this.instance = instance; - } - public Map getInstance() { - return instance; - } - public PathParametersMap00001Builder getBuilderAfterSchema1(Map instance) { - return new PathParametersMap00001Builder(instance); - } - public PathParametersMap10000Builder getBuilderAfterSelf(Map instance) { - return new PathParametersMap10000Builder(instance); - } - } - - public static class PathParametersMap10010Builder implements SetterForSchema1, SetterForAB { - private final Map instance; - public PathParametersMap10010Builder(Map instance) { - this.instance = instance; - } - public Map getInstance() { - return instance; - } - public PathParametersMap00010Builder getBuilderAfterSchema1(Map instance) { - return new PathParametersMap00010Builder(instance); - } - public PathParametersMap10000Builder getBuilderAfterAB(Map instance) { - return new PathParametersMap10000Builder(instance); - } - } - - public static class PathParametersMap10011Builder implements SetterForSchema1, SetterForAB, SetterForSelf { - private final Map instance; - public PathParametersMap10011Builder(Map instance) { - this.instance = instance; - } - public Map getInstance() { - return instance; - } - public PathParametersMap00011Builder getBuilderAfterSchema1(Map instance) { - return new PathParametersMap00011Builder(instance); - } - public PathParametersMap10001Builder getBuilderAfterAB(Map instance) { - return new PathParametersMap10001Builder(instance); - } - public PathParametersMap10010Builder getBuilderAfterSelf(Map instance) { - return new PathParametersMap10010Builder(instance); - } - } - - public static class PathParametersMap10100Builder implements SetterForSchema1, SetterForAb { - private final Map instance; - public PathParametersMap10100Builder(Map instance) { - this.instance = instance; - } - public Map getInstance() { - return instance; - } - public PathParametersMap00100Builder getBuilderAfterSchema1(Map instance) { - return new PathParametersMap00100Builder(instance); - } - public PathParametersMap10000Builder getBuilderAfterAb(Map instance) { - return new PathParametersMap10000Builder(instance); - } - } - - public static class PathParametersMap10101Builder implements SetterForSchema1, SetterForAb, SetterForSelf { - private final Map instance; - public PathParametersMap10101Builder(Map instance) { - this.instance = instance; - } - public Map getInstance() { - return instance; - } - public PathParametersMap00101Builder getBuilderAfterSchema1(Map instance) { - return new PathParametersMap00101Builder(instance); - } - public PathParametersMap10001Builder getBuilderAfterAb(Map instance) { - return new PathParametersMap10001Builder(instance); - } - public PathParametersMap10100Builder getBuilderAfterSelf(Map instance) { - return new PathParametersMap10100Builder(instance); - } - } - - public static class PathParametersMap10110Builder implements SetterForSchema1, SetterForAb, SetterForAB { - private final Map instance; - public PathParametersMap10110Builder(Map instance) { - this.instance = instance; - } - public Map getInstance() { - return instance; - } - public PathParametersMap00110Builder getBuilderAfterSchema1(Map instance) { - return new PathParametersMap00110Builder(instance); - } - public PathParametersMap10010Builder getBuilderAfterAb(Map instance) { - return new PathParametersMap10010Builder(instance); - } - public PathParametersMap10100Builder getBuilderAfterAB(Map instance) { - return new PathParametersMap10100Builder(instance); - } - } - - public static class PathParametersMap10111Builder implements SetterForSchema1, SetterForAb, SetterForAB, SetterForSelf { - private final Map instance; - public PathParametersMap10111Builder(Map instance) { - this.instance = instance; - } - public Map getInstance() { - return instance; - } - public PathParametersMap00111Builder getBuilderAfterSchema1(Map instance) { - return new PathParametersMap00111Builder(instance); - } - public PathParametersMap10011Builder getBuilderAfterAb(Map instance) { - return new PathParametersMap10011Builder(instance); - } - public PathParametersMap10101Builder getBuilderAfterAB(Map instance) { - return new PathParametersMap10101Builder(instance); - } - public PathParametersMap10110Builder getBuilderAfterSelf(Map instance) { - return new PathParametersMap10110Builder(instance); - } - } - - public static class PathParametersMap11000Builder implements SetterForSchema1, SetterForAB1 { - private final Map instance; - public PathParametersMap11000Builder(Map instance) { - this.instance = instance; - } - public Map getInstance() { - return instance; - } - public PathParametersMap01000Builder getBuilderAfterSchema1(Map instance) { - return new PathParametersMap01000Builder(instance); - } - public PathParametersMap10000Builder getBuilderAfterAB1(Map instance) { - return new PathParametersMap10000Builder(instance); - } - } - - public static class PathParametersMap11001Builder implements SetterForSchema1, SetterForAB1, SetterForSelf { - private final Map instance; - public PathParametersMap11001Builder(Map instance) { - this.instance = instance; - } - public Map getInstance() { - return instance; - } - public PathParametersMap01001Builder getBuilderAfterSchema1(Map instance) { - return new PathParametersMap01001Builder(instance); - } - public PathParametersMap10001Builder getBuilderAfterAB1(Map instance) { - return new PathParametersMap10001Builder(instance); - } - public PathParametersMap11000Builder getBuilderAfterSelf(Map instance) { - return new PathParametersMap11000Builder(instance); - } - } - - public static class PathParametersMap11010Builder implements SetterForSchema1, SetterForAB1, SetterForAB { - private final Map instance; - public PathParametersMap11010Builder(Map instance) { - this.instance = instance; - } - public Map getInstance() { - return instance; - } - public PathParametersMap01010Builder getBuilderAfterSchema1(Map instance) { - return new PathParametersMap01010Builder(instance); - } - public PathParametersMap10010Builder getBuilderAfterAB1(Map instance) { - return new PathParametersMap10010Builder(instance); - } - public PathParametersMap11000Builder getBuilderAfterAB(Map instance) { - return new PathParametersMap11000Builder(instance); - } - } - - public static class PathParametersMap11011Builder implements SetterForSchema1, SetterForAB1, SetterForAB, SetterForSelf { - private final Map instance; - public PathParametersMap11011Builder(Map instance) { - this.instance = instance; - } - public Map getInstance() { - return instance; - } - public PathParametersMap01011Builder getBuilderAfterSchema1(Map instance) { - return new PathParametersMap01011Builder(instance); - } - public PathParametersMap10011Builder getBuilderAfterAB1(Map instance) { - return new PathParametersMap10011Builder(instance); - } - public PathParametersMap11001Builder getBuilderAfterAB(Map instance) { - return new PathParametersMap11001Builder(instance); - } - public PathParametersMap11010Builder getBuilderAfterSelf(Map instance) { - return new PathParametersMap11010Builder(instance); - } - } - - public static class PathParametersMap11100Builder implements SetterForSchema1, SetterForAB1, SetterForAb { - private final Map instance; - public PathParametersMap11100Builder(Map instance) { - this.instance = instance; - } - public Map getInstance() { - return instance; - } - public PathParametersMap01100Builder getBuilderAfterSchema1(Map instance) { - return new PathParametersMap01100Builder(instance); - } - public PathParametersMap10100Builder getBuilderAfterAB1(Map instance) { - return new PathParametersMap10100Builder(instance); - } - public PathParametersMap11000Builder getBuilderAfterAb(Map instance) { - return new PathParametersMap11000Builder(instance); - } - } - - public static class PathParametersMap11101Builder implements SetterForSchema1, SetterForAB1, SetterForAb, SetterForSelf { - private final Map instance; - public PathParametersMap11101Builder(Map instance) { - this.instance = instance; - } - public Map getInstance() { - return instance; - } - public PathParametersMap01101Builder getBuilderAfterSchema1(Map instance) { - return new PathParametersMap01101Builder(instance); - } - public PathParametersMap10101Builder getBuilderAfterAB1(Map instance) { - return new PathParametersMap10101Builder(instance); - } - public PathParametersMap11001Builder getBuilderAfterAb(Map instance) { - return new PathParametersMap11001Builder(instance); - } - public PathParametersMap11100Builder getBuilderAfterSelf(Map instance) { - return new PathParametersMap11100Builder(instance); - } - } - - public static class PathParametersMap11110Builder implements SetterForSchema1, SetterForAB1, SetterForAb, SetterForAB { - private final Map instance; - public PathParametersMap11110Builder(Map instance) { - this.instance = instance; - } - public Map getInstance() { - return instance; - } - public PathParametersMap01110Builder getBuilderAfterSchema1(Map instance) { - return new PathParametersMap01110Builder(instance); - } - public PathParametersMap10110Builder getBuilderAfterAB1(Map instance) { - return new PathParametersMap10110Builder(instance); - } - public PathParametersMap11010Builder getBuilderAfterAb(Map instance) { - return new PathParametersMap11010Builder(instance); - } - public PathParametersMap11100Builder getBuilderAfterAB(Map instance) { - return new PathParametersMap11100Builder(instance); - } - } - - public static class PathParametersMapBuilder implements SetterForSchema1, SetterForAB1, SetterForAb, SetterForAB, SetterForSelf { - private final Map instance; - public PathParametersMapBuilder() { - this.instance = new LinkedHashMap<>(); - } - public Map getInstance() { - return instance; - } - public PathParametersMap01111Builder getBuilderAfterSchema1(Map instance) { - return new PathParametersMap01111Builder(instance); - } - public PathParametersMap10111Builder getBuilderAfterAB1(Map instance) { - return new PathParametersMap10111Builder(instance); - } - public PathParametersMap11011Builder getBuilderAfterAb(Map instance) { - return new PathParametersMap11011Builder(instance); - } - public PathParametersMap11101Builder getBuilderAfterAB(Map instance) { - return new PathParametersMap11101Builder(instance); - } - public PathParametersMap11110Builder getBuilderAfterSelf(Map instance) { - return new PathParametersMap11110Builder(instance); - } - } - - - public sealed interface Fakeparametercollisions1ababselfabPostPathParameters1Boxed permits Fakeparametercollisions1ababselfabPostPathParameters1BoxedMap { - @Nullable Object getData(); - } - - public record Fakeparametercollisions1ababselfabPostPathParameters1BoxedMap(PathParametersMap data) implements Fakeparametercollisions1ababselfabPostPathParameters1Boxed { - @Override - public @Nullable Object getData() { - return data; - } - } - - - public static class Fakeparametercollisions1ababselfabPostPathParameters1 extends JsonSchema implements MapSchemaValidator { - private static @Nullable Fakeparametercollisions1ababselfabPostPathParameters1 instance = null; - - protected Fakeparametercollisions1ababselfabPostPathParameters1() { - super(new JsonSchemaInfo() - .type(Set.of(Map.class)) - .properties(Map.ofEntries( - new PropertyEntry("1", Schema9.Schema91.class), - new PropertyEntry("aB", Schema10.Schema101.class), - new PropertyEntry("Ab", Schema11.Schema111.class), - new PropertyEntry("A-B", Schema13.Schema131.class), - new PropertyEntry("self", Schema12.Schema121.class) - )) - .required(Set.of( - "1", - "A-B", - "Ab", - "aB", - "self" - )) - .additionalProperties(AdditionalProperties.class) - ); - } - - public static Fakeparametercollisions1ababselfabPostPathParameters1 getInstance() { - if (instance == null) { - instance = new Fakeparametercollisions1ababselfabPostPathParameters1(); - } - return instance; - } - - 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 RuntimeException("Invalid non-string key value"); - } - String propertyName = (String) entryKey; - List propertyPathToItem = new ArrayList<>(pathToItem); - propertyPathToItem.add(propertyName); - Object value = entry.getValue(); - LinkedHashMap, Nothing?> schemas = pathToSchemas.get(propertyPathToItem); - if (schemas == null) { - throw new RuntimeException("Validation result is invalid, schemas must exist for a pathToItem"); - } - JsonSchema propertySchema = schemas.entrySet().iterator().next().getKey(); - @Nullable Object propertyInstance = propertySchema.getNewInstance(value, propertyPathToItem, pathToSchemas); - properties.put(propertyName, propertyInstance); - } - FrozenMap<@Nullable Object> castProperties = new FrozenMap<>(properties); - return new PathParametersMap(castProperties); - } - - 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); - SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().build())); - ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, new PathToSchemasMap(), new LinkedHashSet<>()); - PathToSchemasMap pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet); - return getNewInstance(castArg, validationMetadata.pathToItem(), pathToSchemasMap); - } - - - @Override - public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws 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"); - } - @Override - public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { - if (arg instanceof Map) { - return getNewInstance((Map) arg, pathToItem, pathToSchemas); - } - throw new RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); - } - @Override - public Fakeparametercollisions1ababselfabPostPathParameters1BoxedMap validateAndBox(Map arg, SchemaConfiguration configuration) throws ValidationException { - return new Fakeparametercollisions1ababselfabPostPathParameters1BoxedMap(validate(arg, configuration)); - } - @Override - public Fakeparametercollisions1ababselfabPostPathParameters1Boxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { - 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"); - } - } - -} diff --git a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/fakeparametercollisions1ababselfab/post/Fakeparametercollisions1ababselfabPostQueryParameters.kt b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/fakeparametercollisions1ababselfab/post/Fakeparametercollisions1ababselfabPostQueryParameters.kt deleted file mode 100644 index 56a11aa79c6..00000000000 --- a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/fakeparametercollisions1ababselfab/post/Fakeparametercollisions1ababselfabPostQueryParameters.kt +++ /dev/null @@ -1,286 +0,0 @@ -package org.openapijsonschematools.client.paths.fakeparametercollisions1ababselfab.post; -import java.util.ArrayList; -import java.util.HashSet; -import java.util.LinkedHashMap; -import java.util.LinkedHashSet; -import java.util.List; -import java.util.Map; -import java.util.Objects; -import java.util.Set; -import org.checkerframework.checker.nullness.qual.Nullable; -import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags; -import org.openapijsonschematools.client.configurations.SchemaConfiguration; -import org.openapijsonschematools.client.exceptions.UnsetPropertyException; -import org.openapijsonschematools.client.exceptions.ValidationException; -import org.openapijsonschematools.client.paths.fakeparametercollisions1ababselfab.post.parameters.parameter0.Schema0; -import org.openapijsonschematools.client.paths.fakeparametercollisions1ababselfab.post.parameters.parameter1.Schema1; -import org.openapijsonschematools.client.paths.fakeparametercollisions1ababselfab.post.parameters.parameter2.Schema2; -import org.openapijsonschematools.client.paths.fakeparametercollisions1ababselfab.post.parameters.parameter3.Schema3; -import org.openapijsonschematools.client.paths.fakeparametercollisions1ababselfab.post.parameters.parameter4.Schema4; -import org.openapijsonschematools.client.schemas.AnyTypeJsonSchema; -import org.openapijsonschematools.client.schemas.GenericBuilder; -import org.openapijsonschematools.client.schemas.NotAnyTypeJsonSchema; -import org.openapijsonschematools.client.schemas.validation.FrozenMap; -import org.openapijsonschematools.client.schemas.validation.JsonSchema; -import org.openapijsonschematools.client.schemas.validation.JsonSchemaInfo; -import org.openapijsonschematools.client.schemas.validation.MapSchemaValidator; -import org.openapijsonschematools.client.schemas.validation.MapUtils; -import org.openapijsonschematools.client.schemas.validation.PathToSchemasMap; -import org.openapijsonschematools.client.schemas.validation.PropertyEntry; -import org.openapijsonschematools.client.schemas.validation.ValidationMetadata; - -public class Fakeparametercollisions1ababselfabPostQueryParameters { - // nest classes so all schemas and input/output classes can be public - - - public static class AdditionalProperties extends NotAnyTypeJsonSchema.NotAnyTypeJsonSchema1 { - // NotAnyTypeSchema - private static @Nullable AdditionalProperties instance = null; - public static AdditionalProperties getInstance() { - if (instance == null) { - instance = new AdditionalProperties(); - } - return instance; - } - } - - - public static class QueryParametersMap extends FrozenMap<@Nullable Object> { - protected QueryParametersMap(FrozenMap<@Nullable Object> m) { - super(m); - } - public static final Set requiredKeys = Set.of(); - public static final Set optionalKeys = Set.of( - "1", - "aB", - "Ab", - "A-B", - "self" - ); - public static QueryParametersMap of(Map arg, SchemaConfiguration configuration) throws ValidationException { - return Fakeparametercollisions1ababselfabPostQueryParameters1.getInstance().validate(arg, configuration); - } - - public String aB() throws UnsetPropertyException { - String key = "aB"; - throwIfKeyNotPresent(key); - @Nullable Object value = get(key); - if (!(value instanceof String)) { - throw new RuntimeException("Invalid value stored for aB"); - } - return (String) value; - } - - public String Ab() throws UnsetPropertyException { - String key = "Ab"; - throwIfKeyNotPresent(key); - @Nullable Object value = get(key); - if (!(value instanceof String)) { - throw new RuntimeException("Invalid value stored for Ab"); - } - return (String) value; - } - - public String self() throws UnsetPropertyException { - String key = "self"; - throwIfKeyNotPresent(key); - @Nullable Object value = get(key); - if (!(value instanceof String)) { - throw new RuntimeException("Invalid value stored for self"); - } - return (String) value; - } - } - - public interface SetterForSchema1 { - Map getInstance(); - T getBuilderAfterSchema1(Map instance); - - default T positive1(String value) { - var instance = getInstance(); - instance.put("1", value); - return getBuilderAfterSchema1(instance); - } - } - - public interface SetterForAB { - Map getInstance(); - T getBuilderAfterAB(Map instance); - - default T aB(String value) { - var instance = getInstance(); - instance.put("aB", value); - return getBuilderAfterAB(instance); - } - } - - public interface SetterForAb { - Map getInstance(); - T getBuilderAfterAb(Map instance); - - default T Ab(String value) { - var instance = getInstance(); - instance.put("Ab", value); - return getBuilderAfterAb(instance); - } - } - - public interface SetterForAB1 { - Map getInstance(); - T getBuilderAfterAB1(Map instance); - - default T aHyphenMinusB(String value) { - var instance = getInstance(); - instance.put("A-B", value); - return getBuilderAfterAB1(instance); - } - } - - public interface SetterForSelf { - Map getInstance(); - T getBuilderAfterSelf(Map instance); - - default T self(String value) { - var instance = getInstance(); - instance.put("self", value); - return getBuilderAfterSelf(instance); - } - } - - public static class QueryParametersMapBuilder implements GenericBuilder>, SetterForSchema1, SetterForAB, SetterForAb, SetterForAB1, SetterForSelf { - private final Map instance; - private static final Set knownKeys = Set.of( - "1", - "aB", - "Ab", - "A-B", - "self" - ); - public Set getKnownKeys() { - return knownKeys; - } - public QueryParametersMapBuilder() { - this.instance = new LinkedHashMap<>(); - } - public Map build() { - return instance; - } - public Map getInstance() { - return instance; - } - public QueryParametersMapBuilder getBuilderAfterSchema1(Map instance) { - return this; - } - public QueryParametersMapBuilder getBuilderAfterAB(Map instance) { - return this; - } - public QueryParametersMapBuilder getBuilderAfterAb(Map instance) { - return this; - } - public QueryParametersMapBuilder getBuilderAfterAB1(Map instance) { - return this; - } - public QueryParametersMapBuilder getBuilderAfterSelf(Map instance) { - return this; - } - } - - - public sealed interface Fakeparametercollisions1ababselfabPostQueryParameters1Boxed permits Fakeparametercollisions1ababselfabPostQueryParameters1BoxedMap { - @Nullable Object getData(); - } - - public record Fakeparametercollisions1ababselfabPostQueryParameters1BoxedMap(QueryParametersMap data) implements Fakeparametercollisions1ababselfabPostQueryParameters1Boxed { - @Override - public @Nullable Object getData() { - return data; - } - } - - - public static class Fakeparametercollisions1ababselfabPostQueryParameters1 extends JsonSchema implements MapSchemaValidator { - private static @Nullable Fakeparametercollisions1ababselfabPostQueryParameters1 instance = null; - - protected Fakeparametercollisions1ababselfabPostQueryParameters1() { - super(new JsonSchemaInfo() - .type(Set.of(Map.class)) - .properties(Map.ofEntries( - new PropertyEntry("1", Schema0.Schema01.class), - new PropertyEntry("aB", Schema1.Schema11.class), - new PropertyEntry("Ab", Schema2.Schema21.class), - new PropertyEntry("A-B", Schema4.Schema41.class), - new PropertyEntry("self", Schema3.Schema31.class) - )) - .additionalProperties(AdditionalProperties.class) - ); - } - - public static Fakeparametercollisions1ababselfabPostQueryParameters1 getInstance() { - if (instance == null) { - instance = new Fakeparametercollisions1ababselfabPostQueryParameters1(); - } - return instance; - } - - 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 RuntimeException("Invalid non-string key value"); - } - String propertyName = (String) entryKey; - List propertyPathToItem = new ArrayList<>(pathToItem); - propertyPathToItem.add(propertyName); - Object value = entry.getValue(); - LinkedHashMap, Nothing?> schemas = pathToSchemas.get(propertyPathToItem); - if (schemas == null) { - throw new RuntimeException("Validation result is invalid, schemas must exist for a pathToItem"); - } - JsonSchema propertySchema = schemas.entrySet().iterator().next().getKey(); - @Nullable Object propertyInstance = propertySchema.getNewInstance(value, propertyPathToItem, pathToSchemas); - properties.put(propertyName, propertyInstance); - } - FrozenMap<@Nullable Object> castProperties = new FrozenMap<>(properties); - return new QueryParametersMap(castProperties); - } - - 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); - SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().build())); - ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, new PathToSchemasMap(), new LinkedHashSet<>()); - PathToSchemasMap pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet); - return getNewInstance(castArg, validationMetadata.pathToItem(), pathToSchemasMap); - } - - - @Override - public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws 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"); - } - @Override - public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { - if (arg instanceof Map) { - return getNewInstance((Map) arg, pathToItem, pathToSchemas); - } - throw new RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); - } - @Override - public Fakeparametercollisions1ababselfabPostQueryParameters1BoxedMap validateAndBox(Map arg, SchemaConfiguration configuration) throws ValidationException { - return new Fakeparametercollisions1ababselfabPostQueryParameters1BoxedMap(validate(arg, configuration)); - } - @Override - public Fakeparametercollisions1ababselfabPostQueryParameters1Boxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { - 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"); - } - } - -} diff --git a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/fakeparametercollisions1ababselfab/post/Fakeparametercollisions1ababselfabPostRequestBody.kt b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/fakeparametercollisions1ababselfab/post/Fakeparametercollisions1ababselfabPostRequestBody.kt deleted file mode 100644 index 3e2d6ec3449..00000000000 --- a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/fakeparametercollisions1ababselfab/post/Fakeparametercollisions1ababselfabPostRequestBody.kt +++ /dev/null @@ -1,49 +0,0 @@ -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; -import org.openapijsonschematools.client.mediatype.MediaType; -import org.openapijsonschematools.client.paths.fakeparametercollisions1ababselfab.post.requestbody.content.applicationjson.ApplicationjsonSchema; - -import java.util.AbstractMap; -import java.util.Map; - -public class Fakeparametercollisions1ababselfabPostRequestBody { - public sealed interface SealedMediaType permits ApplicationjsonMediaType {} - - public record ApplicationjsonMediaType(ApplicationjsonSchema.ApplicationjsonSchema1 schema) implements SealedMediaType, MediaType { - public ApplicationjsonMediaType() { - this(ApplicationjsonSchema.ApplicationjsonSchema1.getInstance()); - } - @Override - public Nothing? encoding() { - return null; - } - } - - public static class Fakeparametercollisions1ababselfabPostRequestBody1 extends RequestBodySerializer { - public Fakeparametercollisions1ababselfabPostRequestBody1() { - super( - Map.ofEntries( - new AbstractMap.SimpleEntry<>("application/json", new ApplicationjsonMediaType()) - ), - false - ); - } - - public SerializedRequestBody serialize(SealedRequestBody requestBody) throws NotImplementedException { - ApplicationjsonRequestBody requestBody0 = (ApplicationjsonRequestBody) requestBody; - return serialize(requestBody0.contentType(), requestBody0.body().getData()); - } - } - - public sealed interface SealedRequestBody permits ApplicationjsonRequestBody {} - public record ApplicationjsonRequestBody(ApplicationjsonSchema.AnyTypeJsonSchema1Boxed body) implements SealedRequestBody, GenericRequestBody { - @Override - public String contentType() { - return "application/json"; - } - } -} diff --git a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/fakeparametercollisions1ababselfab/post/Fakeparametercollisions1ababselfabPostResponses.kt b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/fakeparametercollisions1ababselfab/post/Fakeparametercollisions1ababselfabPostResponses.kt deleted file mode 100644 index 9d0ddd74419..00000000000 --- a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/fakeparametercollisions1ababselfab/post/Fakeparametercollisions1ababselfabPostResponses.kt +++ /dev/null @@ -1,53 +0,0 @@ -package org.openapijsonschematools.client.paths.fakeparametercollisions1ababselfab.post; - -import org.openapijsonschematools.client.paths.fakeparametercollisions1ababselfab.post.responses.Fakeparametercollisions1ababselfabPostCode200Response; -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; -import org.checkerframework.checker.nullness.qual.Nullable; - -import java.net.http.HttpResponse; -import java.util.Map; -import java.util.AbstractMap; - -public class Fakeparametercollisions1ababselfabPostResponses { - public sealed interface EndpointResponse permits EndpointFakeparametercollisions1ababselfabPostCode200Response {} - - public record EndpointFakeparametercollisions1ababselfabPostCode200Response( - HttpResponse response, - Fakeparametercollisions1ababselfabPostCode200Response.SealedResponseBody body, - Nothing? headers - ) implements EndpointResponse, ApiResponse{ - } - - public sealed interface StatusCodeResponseDeserializer permits StatusFakeparametercollisions1ababselfabPostCode200ResponseDeserializer {} - - public static final class StatusFakeparametercollisions1ababselfabPostCode200ResponseDeserializer extends Fakeparametercollisions1ababselfabPostCode200Response.Fakeparametercollisions1ababselfabPostCode200Response1 implements StatusCodeResponseDeserializer { - } - - public static final class Fakeparametercollisions1ababselfabPostResponses1 implements ResponsesDeserializer { - private final Map statusCodeToResponseDeserializer; - public Fakeparametercollisions1ababselfabPostResponses1() { - this.statusCodeToResponseDeserializer = Map.ofEntries( - new AbstractMap.SimpleEntry<>("200", new StatusFakeparametercollisions1ababselfabPostCode200ResponseDeserializer()) - ); - } - - 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) { - throw new ApiException( - "Invalid response statusCode="+statusCode+" has no response defined in the openapi document", - response - ); - } - StatusFakeparametercollisions1ababselfabPostCode200ResponseDeserializer castDeserializer = (StatusFakeparametercollisions1ababselfabPostCode200ResponseDeserializer) statusCodeDeserializer; - var deserializedResponse = castDeserializer.deserialize(response, configuration); - return new EndpointFakeparametercollisions1ababselfabPostCode200Response(response, deserializedResponse.body(), deserializedResponse.headers()); - } - } -} diff --git a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/fakeparametercollisions1ababselfab/post/Parameters.kt b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/fakeparametercollisions1ababselfab/post/Parameters.kt deleted file mode 100644 index 6b1d6be5242..00000000000 --- a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/fakeparametercollisions1ababselfab/post/Parameters.kt +++ /dev/null @@ -1,86 +0,0 @@ -package org.openapijsonschematools.client.paths.fakeparametercollisions1ababselfab.post; - -import org.openapijsonschematools.client.paths.fakeparametercollisions1ababselfab.post.parameters.Parameter0; -import org.openapijsonschematools.client.paths.fakeparametercollisions1ababselfab.post.parameters.Parameter1; -import org.openapijsonschematools.client.paths.fakeparametercollisions1ababselfab.post.parameters.Parameter2; -import org.openapijsonschematools.client.paths.fakeparametercollisions1ababselfab.post.parameters.Parameter3; -import org.openapijsonschematools.client.paths.fakeparametercollisions1ababselfab.post.parameters.Parameter4; -import org.openapijsonschematools.client.paths.fakeparametercollisions1ababselfab.post.parameters.Parameter5; -import org.openapijsonschematools.client.paths.fakeparametercollisions1ababselfab.post.parameters.Parameter6; -import org.openapijsonschematools.client.paths.fakeparametercollisions1ababselfab.post.parameters.Parameter7; -import org.openapijsonschematools.client.paths.fakeparametercollisions1ababselfab.post.parameters.Parameter8; -import org.openapijsonschematools.client.paths.fakeparametercollisions1ababselfab.post.parameters.Parameter9; -import org.openapijsonschematools.client.paths.fakeparametercollisions1ababselfab.post.parameters.Parameter10; -import org.openapijsonschematools.client.paths.fakeparametercollisions1ababselfab.post.parameters.Parameter11; -import org.openapijsonschematools.client.paths.fakeparametercollisions1ababselfab.post.parameters.Parameter12; -import org.openapijsonschematools.client.paths.fakeparametercollisions1ababselfab.post.parameters.Parameter13; -import org.openapijsonschematools.client.paths.fakeparametercollisions1ababselfab.post.parameters.Parameter14; -import org.openapijsonschematools.client.paths.fakeparametercollisions1ababselfab.post.parameters.Parameter15; -import org.openapijsonschematools.client.paths.fakeparametercollisions1ababselfab.post.parameters.Parameter16; -import org.openapijsonschematools.client.paths.fakeparametercollisions1ababselfab.post.parameters.Parameter17; -import org.openapijsonschematools.client.paths.fakeparametercollisions1ababselfab.post.parameters.Parameter18; -import org.openapijsonschematools.client.parameter.PathSerializer; -import org.openapijsonschematools.client.parameter.HeadersSerializer; -import org.openapijsonschematools.client.parameter.QuerySerializer; -import org.openapijsonschematools.client.parameter.CookieSerializer; - -import java.util.Map; -import java.util.AbstractMap; - -public class Parameters { - - public static class PathParametersSerializer extends PathSerializer { - public PathParametersSerializer() { - super( - Map.ofEntries( - new AbstractMap.SimpleEntry<>("1", new Parameter9.Parameter91()), - new AbstractMap.SimpleEntry<>("aB", new Parameter10.Parameter101()), - new AbstractMap.SimpleEntry<>("Ab", new Parameter11.Parameter111()), - new AbstractMap.SimpleEntry<>("self", new Parameter12.Parameter121()), - new AbstractMap.SimpleEntry<>("A-B", new Parameter13.Parameter131()) - ) - ); - } - } - - public static class QueryParametersSerializer extends QuerySerializer { - public QueryParametersSerializer() { - super( - Map.ofEntries( - new AbstractMap.SimpleEntry<>("1", new Parameter0.Parameter01()), - new AbstractMap.SimpleEntry<>("aB", new Parameter1.Parameter11()), - new AbstractMap.SimpleEntry<>("Ab", new Parameter2.Parameter21()), - new AbstractMap.SimpleEntry<>("self", new Parameter3.Parameter31()), - new AbstractMap.SimpleEntry<>("A-B", new Parameter4.Parameter41()) - ) - ); - } - } - - public static class HeaderParametersSerializer extends HeadersSerializer { - public HeaderParametersSerializer() { - super( - Map.ofEntries( - new AbstractMap.SimpleEntry<>("1", new Parameter5.Parameter51()), - new AbstractMap.SimpleEntry<>("aB", new Parameter6.Parameter61()), - new AbstractMap.SimpleEntry<>("self", new Parameter7.Parameter71()), - new AbstractMap.SimpleEntry<>("A-B", new Parameter8.Parameter81()) - ) - ); - } - } - - public static class CookieParametersSerializer extends CookieSerializer { - public CookieParametersSerializer() { - super( - Map.ofEntries( - new AbstractMap.SimpleEntry<>("1", new Parameter14.Parameter141()), - new AbstractMap.SimpleEntry<>("aB", new Parameter15.Parameter151()), - new AbstractMap.SimpleEntry<>("Ab", new Parameter16.Parameter161()), - new AbstractMap.SimpleEntry<>("self", new Parameter17.Parameter171()), - new AbstractMap.SimpleEntry<>("A-B", new Parameter18.Parameter181()) - ) - ); - } - } -} diff --git a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/fakeparametercollisions1ababselfab/post/parameters/Parameter0.kt b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/fakeparametercollisions1ababselfab/post/parameters/Parameter0.kt deleted file mode 100644 index a92fdc8a8c2..00000000000 --- a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/fakeparametercollisions1ababselfab/post/parameters/Parameter0.kt +++ /dev/null @@ -1,23 +0,0 @@ -package org.openapijsonschematools.client.paths.fakeparametercollisions1ababselfab.post.parameters; - -import org.openapijsonschematools.client.parameter.ParameterStyle; -import org.openapijsonschematools.client.parameter.ParameterInType; -import org.openapijsonschematools.client.parameter.SchemaParameter; -import org.openapijsonschematools.client.paths.fakeparametercollisions1ababselfab.post.parameters.parameter0.Schema0; - -public class Parameter0 { - - public static class Parameter01 extends SchemaParameter { - public Parameter01() { - super( - "1", - ParameterInType.QUERY, - false, - ParameterStyle.FORM, - true, - false, - Schema0.Schema01.getInstance() - ); - } - } -} diff --git a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/fakeparametercollisions1ababselfab/post/parameters/Parameter1.kt b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/fakeparametercollisions1ababselfab/post/parameters/Parameter1.kt deleted file mode 100644 index f630ae29b8f..00000000000 --- a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/fakeparametercollisions1ababselfab/post/parameters/Parameter1.kt +++ /dev/null @@ -1,23 +0,0 @@ -package org.openapijsonschematools.client.paths.fakeparametercollisions1ababselfab.post.parameters; - -import org.openapijsonschematools.client.parameter.ParameterStyle; -import org.openapijsonschematools.client.parameter.ParameterInType; -import org.openapijsonschematools.client.parameter.SchemaParameter; -import org.openapijsonschematools.client.paths.fakeparametercollisions1ababselfab.post.parameters.parameter1.Schema1; - -public class Parameter1 { - - public static class Parameter11 extends SchemaParameter { - public Parameter11() { - super( - "aB", - ParameterInType.QUERY, - false, - ParameterStyle.FORM, - true, - false, - Schema1.Schema11.getInstance() - ); - } - } -} diff --git a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/fakeparametercollisions1ababselfab/post/parameters/Parameter10.kt b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/fakeparametercollisions1ababselfab/post/parameters/Parameter10.kt deleted file mode 100644 index 0aa44d3eda8..00000000000 --- a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/fakeparametercollisions1ababselfab/post/parameters/Parameter10.kt +++ /dev/null @@ -1,23 +0,0 @@ -package org.openapijsonschematools.client.paths.fakeparametercollisions1ababselfab.post.parameters; - -import org.openapijsonschematools.client.parameter.ParameterStyle; -import org.openapijsonschematools.client.parameter.ParameterInType; -import org.openapijsonschematools.client.parameter.SchemaParameter; -import org.openapijsonschematools.client.paths.fakeparametercollisions1ababselfab.post.parameters.parameter10.Schema10; - -public class Parameter10 { - - public static class Parameter101 extends SchemaParameter { - public Parameter101() { - super( - "aB", - ParameterInType.PATH, - true, - ParameterStyle.SIMPLE, - false, - false, - Schema10.Schema101.getInstance() - ); - } - } -} diff --git a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/fakeparametercollisions1ababselfab/post/parameters/Parameter11.kt b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/fakeparametercollisions1ababselfab/post/parameters/Parameter11.kt deleted file mode 100644 index a86856ac32b..00000000000 --- a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/fakeparametercollisions1ababselfab/post/parameters/Parameter11.kt +++ /dev/null @@ -1,23 +0,0 @@ -package org.openapijsonschematools.client.paths.fakeparametercollisions1ababselfab.post.parameters; - -import org.openapijsonschematools.client.parameter.ParameterStyle; -import org.openapijsonschematools.client.parameter.ParameterInType; -import org.openapijsonschematools.client.parameter.SchemaParameter; -import org.openapijsonschematools.client.paths.fakeparametercollisions1ababselfab.post.parameters.parameter11.Schema11; - -public class Parameter11 { - - public static class Parameter111 extends SchemaParameter { - public Parameter111() { - super( - "Ab", - ParameterInType.PATH, - true, - ParameterStyle.SIMPLE, - false, - false, - Schema11.Schema111.getInstance() - ); - } - } -} diff --git a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/fakeparametercollisions1ababselfab/post/parameters/Parameter12.kt b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/fakeparametercollisions1ababselfab/post/parameters/Parameter12.kt deleted file mode 100644 index ee76bac70af..00000000000 --- a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/fakeparametercollisions1ababselfab/post/parameters/Parameter12.kt +++ /dev/null @@ -1,23 +0,0 @@ -package org.openapijsonschematools.client.paths.fakeparametercollisions1ababselfab.post.parameters; - -import org.openapijsonschematools.client.parameter.ParameterStyle; -import org.openapijsonschematools.client.parameter.ParameterInType; -import org.openapijsonschematools.client.parameter.SchemaParameter; -import org.openapijsonschematools.client.paths.fakeparametercollisions1ababselfab.post.parameters.parameter12.Schema12; - -public class Parameter12 { - - public static class Parameter121 extends SchemaParameter { - public Parameter121() { - super( - "self", - ParameterInType.PATH, - true, - ParameterStyle.SIMPLE, - false, - false, - Schema12.Schema121.getInstance() - ); - } - } -} diff --git a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/fakeparametercollisions1ababselfab/post/parameters/Parameter13.kt b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/fakeparametercollisions1ababselfab/post/parameters/Parameter13.kt deleted file mode 100644 index de212f1563d..00000000000 --- a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/fakeparametercollisions1ababselfab/post/parameters/Parameter13.kt +++ /dev/null @@ -1,23 +0,0 @@ -package org.openapijsonschematools.client.paths.fakeparametercollisions1ababselfab.post.parameters; - -import org.openapijsonschematools.client.parameter.ParameterStyle; -import org.openapijsonschematools.client.parameter.ParameterInType; -import org.openapijsonschematools.client.parameter.SchemaParameter; -import org.openapijsonschematools.client.paths.fakeparametercollisions1ababselfab.post.parameters.parameter13.Schema13; - -public class Parameter13 { - - public static class Parameter131 extends SchemaParameter { - public Parameter131() { - super( - "A-B", - ParameterInType.PATH, - true, - ParameterStyle.SIMPLE, - false, - false, - Schema13.Schema131.getInstance() - ); - } - } -} diff --git a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/fakeparametercollisions1ababselfab/post/parameters/Parameter14.kt b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/fakeparametercollisions1ababselfab/post/parameters/Parameter14.kt deleted file mode 100644 index a29010916ac..00000000000 --- a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/fakeparametercollisions1ababselfab/post/parameters/Parameter14.kt +++ /dev/null @@ -1,23 +0,0 @@ -package org.openapijsonschematools.client.paths.fakeparametercollisions1ababselfab.post.parameters; - -import org.openapijsonschematools.client.parameter.ParameterStyle; -import org.openapijsonschematools.client.parameter.ParameterInType; -import org.openapijsonschematools.client.parameter.SchemaParameter; -import org.openapijsonschematools.client.paths.fakeparametercollisions1ababselfab.post.parameters.parameter14.Schema14; - -public class Parameter14 { - - public static class Parameter141 extends SchemaParameter { - public Parameter141() { - super( - "1", - ParameterInType.COOKIE, - false, - ParameterStyle.FORM, - true, - false, - Schema14.Schema141.getInstance() - ); - } - } -} diff --git a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/fakeparametercollisions1ababselfab/post/parameters/Parameter15.kt b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/fakeparametercollisions1ababselfab/post/parameters/Parameter15.kt deleted file mode 100644 index 54bf5140899..00000000000 --- a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/fakeparametercollisions1ababselfab/post/parameters/Parameter15.kt +++ /dev/null @@ -1,23 +0,0 @@ -package org.openapijsonschematools.client.paths.fakeparametercollisions1ababselfab.post.parameters; - -import org.openapijsonschematools.client.parameter.ParameterStyle; -import org.openapijsonschematools.client.parameter.ParameterInType; -import org.openapijsonschematools.client.parameter.SchemaParameter; -import org.openapijsonschematools.client.paths.fakeparametercollisions1ababselfab.post.parameters.parameter15.Schema15; - -public class Parameter15 { - - public static class Parameter151 extends SchemaParameter { - public Parameter151() { - super( - "aB", - ParameterInType.COOKIE, - false, - ParameterStyle.FORM, - true, - false, - Schema15.Schema151.getInstance() - ); - } - } -} diff --git a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/fakeparametercollisions1ababselfab/post/parameters/Parameter16.kt b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/fakeparametercollisions1ababselfab/post/parameters/Parameter16.kt deleted file mode 100644 index f1b8e71d686..00000000000 --- a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/fakeparametercollisions1ababselfab/post/parameters/Parameter16.kt +++ /dev/null @@ -1,23 +0,0 @@ -package org.openapijsonschematools.client.paths.fakeparametercollisions1ababselfab.post.parameters; - -import org.openapijsonschematools.client.parameter.ParameterStyle; -import org.openapijsonschematools.client.parameter.ParameterInType; -import org.openapijsonschematools.client.parameter.SchemaParameter; -import org.openapijsonschematools.client.paths.fakeparametercollisions1ababselfab.post.parameters.parameter16.Schema16; - -public class Parameter16 { - - public static class Parameter161 extends SchemaParameter { - public Parameter161() { - super( - "Ab", - ParameterInType.COOKIE, - false, - ParameterStyle.FORM, - true, - false, - Schema16.Schema161.getInstance() - ); - } - } -} diff --git a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/fakeparametercollisions1ababselfab/post/parameters/Parameter17.kt b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/fakeparametercollisions1ababselfab/post/parameters/Parameter17.kt deleted file mode 100644 index b856a27eb1e..00000000000 --- a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/fakeparametercollisions1ababselfab/post/parameters/Parameter17.kt +++ /dev/null @@ -1,23 +0,0 @@ -package org.openapijsonschematools.client.paths.fakeparametercollisions1ababselfab.post.parameters; - -import org.openapijsonschematools.client.parameter.ParameterStyle; -import org.openapijsonschematools.client.parameter.ParameterInType; -import org.openapijsonschematools.client.parameter.SchemaParameter; -import org.openapijsonschematools.client.paths.fakeparametercollisions1ababselfab.post.parameters.parameter17.Schema17; - -public class Parameter17 { - - public static class Parameter171 extends SchemaParameter { - public Parameter171() { - super( - "self", - ParameterInType.COOKIE, - false, - ParameterStyle.FORM, - true, - false, - Schema17.Schema171.getInstance() - ); - } - } -} diff --git a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/fakeparametercollisions1ababselfab/post/parameters/Parameter18.kt b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/fakeparametercollisions1ababselfab/post/parameters/Parameter18.kt deleted file mode 100644 index b43ebbe5664..00000000000 --- a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/fakeparametercollisions1ababselfab/post/parameters/Parameter18.kt +++ /dev/null @@ -1,23 +0,0 @@ -package org.openapijsonschematools.client.paths.fakeparametercollisions1ababselfab.post.parameters; - -import org.openapijsonschematools.client.parameter.ParameterStyle; -import org.openapijsonschematools.client.parameter.ParameterInType; -import org.openapijsonschematools.client.parameter.SchemaParameter; -import org.openapijsonschematools.client.paths.fakeparametercollisions1ababselfab.post.parameters.parameter18.Schema18; - -public class Parameter18 { - - public static class Parameter181 extends SchemaParameter { - public Parameter181() { - super( - "A-B", - ParameterInType.COOKIE, - false, - ParameterStyle.FORM, - true, - false, - Schema18.Schema181.getInstance() - ); - } - } -} diff --git a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/fakeparametercollisions1ababselfab/post/parameters/Parameter2.kt b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/fakeparametercollisions1ababselfab/post/parameters/Parameter2.kt deleted file mode 100644 index bb193d95ba3..00000000000 --- a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/fakeparametercollisions1ababselfab/post/parameters/Parameter2.kt +++ /dev/null @@ -1,23 +0,0 @@ -package org.openapijsonschematools.client.paths.fakeparametercollisions1ababselfab.post.parameters; - -import org.openapijsonschematools.client.parameter.ParameterStyle; -import org.openapijsonschematools.client.parameter.ParameterInType; -import org.openapijsonschematools.client.parameter.SchemaParameter; -import org.openapijsonschematools.client.paths.fakeparametercollisions1ababselfab.post.parameters.parameter2.Schema2; - -public class Parameter2 { - - public static class Parameter21 extends SchemaParameter { - public Parameter21() { - super( - "Ab", - ParameterInType.QUERY, - false, - ParameterStyle.FORM, - true, - false, - Schema2.Schema21.getInstance() - ); - } - } -} diff --git a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/fakeparametercollisions1ababselfab/post/parameters/Parameter3.kt b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/fakeparametercollisions1ababselfab/post/parameters/Parameter3.kt deleted file mode 100644 index b4233c96a02..00000000000 --- a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/fakeparametercollisions1ababselfab/post/parameters/Parameter3.kt +++ /dev/null @@ -1,23 +0,0 @@ -package org.openapijsonschematools.client.paths.fakeparametercollisions1ababselfab.post.parameters; - -import org.openapijsonschematools.client.parameter.ParameterStyle; -import org.openapijsonschematools.client.parameter.ParameterInType; -import org.openapijsonschematools.client.parameter.SchemaParameter; -import org.openapijsonschematools.client.paths.fakeparametercollisions1ababselfab.post.parameters.parameter3.Schema3; - -public class Parameter3 { - - public static class Parameter31 extends SchemaParameter { - public Parameter31() { - super( - "self", - ParameterInType.QUERY, - false, - ParameterStyle.FORM, - true, - false, - Schema3.Schema31.getInstance() - ); - } - } -} diff --git a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/fakeparametercollisions1ababselfab/post/parameters/Parameter4.kt b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/fakeparametercollisions1ababselfab/post/parameters/Parameter4.kt deleted file mode 100644 index 459cdc6a234..00000000000 --- a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/fakeparametercollisions1ababselfab/post/parameters/Parameter4.kt +++ /dev/null @@ -1,23 +0,0 @@ -package org.openapijsonschematools.client.paths.fakeparametercollisions1ababselfab.post.parameters; - -import org.openapijsonschematools.client.parameter.ParameterStyle; -import org.openapijsonschematools.client.parameter.ParameterInType; -import org.openapijsonschematools.client.parameter.SchemaParameter; -import org.openapijsonschematools.client.paths.fakeparametercollisions1ababselfab.post.parameters.parameter4.Schema4; - -public class Parameter4 { - - public static class Parameter41 extends SchemaParameter { - public Parameter41() { - super( - "A-B", - ParameterInType.QUERY, - false, - ParameterStyle.FORM, - true, - false, - Schema4.Schema41.getInstance() - ); - } - } -} diff --git a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/fakeparametercollisions1ababselfab/post/parameters/Parameter5.kt b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/fakeparametercollisions1ababselfab/post/parameters/Parameter5.kt deleted file mode 100644 index a589c0c385b..00000000000 --- a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/fakeparametercollisions1ababselfab/post/parameters/Parameter5.kt +++ /dev/null @@ -1,23 +0,0 @@ -package org.openapijsonschematools.client.paths.fakeparametercollisions1ababselfab.post.parameters; - -import org.openapijsonschematools.client.parameter.ParameterStyle; -import org.openapijsonschematools.client.parameter.ParameterInType; -import org.openapijsonschematools.client.parameter.SchemaParameter; -import org.openapijsonschematools.client.paths.fakeparametercollisions1ababselfab.post.parameters.parameter5.Schema5; - -public class Parameter5 { - - public static class Parameter51 extends SchemaParameter { - public Parameter51() { - super( - "1", - ParameterInType.HEADER, - false, - ParameterStyle.SIMPLE, - false, - false, - Schema5.Schema51.getInstance() - ); - } - } -} diff --git a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/fakeparametercollisions1ababselfab/post/parameters/Parameter6.kt b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/fakeparametercollisions1ababselfab/post/parameters/Parameter6.kt deleted file mode 100644 index dafa85cb493..00000000000 --- a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/fakeparametercollisions1ababselfab/post/parameters/Parameter6.kt +++ /dev/null @@ -1,23 +0,0 @@ -package org.openapijsonschematools.client.paths.fakeparametercollisions1ababselfab.post.parameters; - -import org.openapijsonschematools.client.parameter.ParameterStyle; -import org.openapijsonschematools.client.parameter.ParameterInType; -import org.openapijsonschematools.client.parameter.SchemaParameter; -import org.openapijsonschematools.client.paths.fakeparametercollisions1ababselfab.post.parameters.parameter6.Schema6; - -public class Parameter6 { - - public static class Parameter61 extends SchemaParameter { - public Parameter61() { - super( - "aB", - ParameterInType.HEADER, - false, - ParameterStyle.SIMPLE, - false, - false, - Schema6.Schema61.getInstance() - ); - } - } -} diff --git a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/fakeparametercollisions1ababselfab/post/parameters/Parameter7.kt b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/fakeparametercollisions1ababselfab/post/parameters/Parameter7.kt deleted file mode 100644 index 9d5589c95e6..00000000000 --- a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/fakeparametercollisions1ababselfab/post/parameters/Parameter7.kt +++ /dev/null @@ -1,23 +0,0 @@ -package org.openapijsonschematools.client.paths.fakeparametercollisions1ababselfab.post.parameters; - -import org.openapijsonschematools.client.parameter.ParameterStyle; -import org.openapijsonschematools.client.parameter.ParameterInType; -import org.openapijsonschematools.client.parameter.SchemaParameter; -import org.openapijsonschematools.client.paths.fakeparametercollisions1ababselfab.post.parameters.parameter7.Schema7; - -public class Parameter7 { - - public static class Parameter71 extends SchemaParameter { - public Parameter71() { - super( - "self", - ParameterInType.HEADER, - false, - ParameterStyle.SIMPLE, - false, - false, - Schema7.Schema71.getInstance() - ); - } - } -} diff --git a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/fakeparametercollisions1ababselfab/post/parameters/Parameter8.kt b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/fakeparametercollisions1ababselfab/post/parameters/Parameter8.kt deleted file mode 100644 index 259cab30459..00000000000 --- a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/fakeparametercollisions1ababselfab/post/parameters/Parameter8.kt +++ /dev/null @@ -1,23 +0,0 @@ -package org.openapijsonschematools.client.paths.fakeparametercollisions1ababselfab.post.parameters; - -import org.openapijsonschematools.client.parameter.ParameterStyle; -import org.openapijsonschematools.client.parameter.ParameterInType; -import org.openapijsonschematools.client.parameter.SchemaParameter; -import org.openapijsonschematools.client.paths.fakeparametercollisions1ababselfab.post.parameters.parameter8.Schema8; - -public class Parameter8 { - - public static class Parameter81 extends SchemaParameter { - public Parameter81() { - super( - "A-B", - ParameterInType.HEADER, - false, - ParameterStyle.SIMPLE, - false, - false, - Schema8.Schema81.getInstance() - ); - } - } -} diff --git a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/fakeparametercollisions1ababselfab/post/parameters/Parameter9.kt b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/fakeparametercollisions1ababselfab/post/parameters/Parameter9.kt deleted file mode 100644 index 450bbdbfc8d..00000000000 --- a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/fakeparametercollisions1ababselfab/post/parameters/Parameter9.kt +++ /dev/null @@ -1,23 +0,0 @@ -package org.openapijsonschematools.client.paths.fakeparametercollisions1ababselfab.post.parameters; - -import org.openapijsonschematools.client.parameter.ParameterStyle; -import org.openapijsonschematools.client.parameter.ParameterInType; -import org.openapijsonschematools.client.parameter.SchemaParameter; -import org.openapijsonschematools.client.paths.fakeparametercollisions1ababselfab.post.parameters.parameter9.Schema9; - -public class Parameter9 { - - public static class Parameter91 extends SchemaParameter { - public Parameter91() { - super( - "1", - ParameterInType.PATH, - true, - ParameterStyle.SIMPLE, - false, - false, - Schema9.Schema91.getInstance() - ); - } - } -} diff --git a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/fakeparametercollisions1ababselfab/post/parameters/parameter0/Schema0.kt b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/fakeparametercollisions1ababselfab/post/parameters/parameter0/Schema0.kt deleted file mode 100644 index 0de8ca499eb..00000000000 --- a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/fakeparametercollisions1ababselfab/post/parameters/parameter0/Schema0.kt +++ /dev/null @@ -1,19 +0,0 @@ -package org.openapijsonschematools.client.paths.fakeparametercollisions1ababselfab.post.parameters.parameter0; -import org.checkerframework.checker.nullness.qual.Nullable; -import org.openapijsonschematools.client.schemas.StringJsonSchema; - -public class Schema0 extends StringJsonSchema { - // nest classes so all schemas and input/output classes can be public - - - public static class Schema01 extends StringJsonSchema.StringJsonSchema1 { - private static @Nullable Schema01 instance = null; - public static Schema01 getInstance() { - if (instance == null) { - instance = new Schema01(); - } - return instance; - } - } - -} diff --git a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/fakeparametercollisions1ababselfab/post/parameters/parameter1/Schema1.kt b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/fakeparametercollisions1ababselfab/post/parameters/parameter1/Schema1.kt deleted file mode 100644 index bc5b4d4e46b..00000000000 --- a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/fakeparametercollisions1ababselfab/post/parameters/parameter1/Schema1.kt +++ /dev/null @@ -1,19 +0,0 @@ -package org.openapijsonschematools.client.paths.fakeparametercollisions1ababselfab.post.parameters.parameter1; -import org.checkerframework.checker.nullness.qual.Nullable; -import org.openapijsonschematools.client.schemas.StringJsonSchema; - -public class Schema1 extends StringJsonSchema { - // nest classes so all schemas and input/output classes can be public - - - public static class Schema11 extends StringJsonSchema.StringJsonSchema1 { - private static @Nullable Schema11 instance = null; - public static Schema11 getInstance() { - if (instance == null) { - instance = new Schema11(); - } - return instance; - } - } - -} diff --git a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/fakeparametercollisions1ababselfab/post/parameters/parameter10/Schema10.kt b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/fakeparametercollisions1ababselfab/post/parameters/parameter10/Schema10.kt deleted file mode 100644 index dbf0ed076f7..00000000000 --- a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/fakeparametercollisions1ababselfab/post/parameters/parameter10/Schema10.kt +++ /dev/null @@ -1,19 +0,0 @@ -package org.openapijsonschematools.client.paths.fakeparametercollisions1ababselfab.post.parameters.parameter10; -import org.checkerframework.checker.nullness.qual.Nullable; -import org.openapijsonschematools.client.schemas.StringJsonSchema; - -public class Schema10 extends StringJsonSchema { - // nest classes so all schemas and input/output classes can be public - - - public static class Schema101 extends StringJsonSchema.StringJsonSchema1 { - private static @Nullable Schema101 instance = null; - public static Schema101 getInstance() { - if (instance == null) { - instance = new Schema101(); - } - return instance; - } - } - -} diff --git a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/fakeparametercollisions1ababselfab/post/parameters/parameter11/Schema11.kt b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/fakeparametercollisions1ababselfab/post/parameters/parameter11/Schema11.kt deleted file mode 100644 index 910dbc61dfd..00000000000 --- a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/fakeparametercollisions1ababselfab/post/parameters/parameter11/Schema11.kt +++ /dev/null @@ -1,19 +0,0 @@ -package org.openapijsonschematools.client.paths.fakeparametercollisions1ababselfab.post.parameters.parameter11; -import org.checkerframework.checker.nullness.qual.Nullable; -import org.openapijsonschematools.client.schemas.StringJsonSchema; - -public class Schema11 extends StringJsonSchema { - // nest classes so all schemas and input/output classes can be public - - - public static class Schema111 extends StringJsonSchema.StringJsonSchema1 { - private static @Nullable Schema111 instance = null; - public static Schema111 getInstance() { - if (instance == null) { - instance = new Schema111(); - } - return instance; - } - } - -} diff --git a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/fakeparametercollisions1ababselfab/post/parameters/parameter12/Schema12.kt b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/fakeparametercollisions1ababselfab/post/parameters/parameter12/Schema12.kt deleted file mode 100644 index fc04e87b2f8..00000000000 --- a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/fakeparametercollisions1ababselfab/post/parameters/parameter12/Schema12.kt +++ /dev/null @@ -1,19 +0,0 @@ -package org.openapijsonschematools.client.paths.fakeparametercollisions1ababselfab.post.parameters.parameter12; -import org.checkerframework.checker.nullness.qual.Nullable; -import org.openapijsonschematools.client.schemas.StringJsonSchema; - -public class Schema12 extends StringJsonSchema { - // nest classes so all schemas and input/output classes can be public - - - public static class Schema121 extends StringJsonSchema.StringJsonSchema1 { - private static @Nullable Schema121 instance = null; - public static Schema121 getInstance() { - if (instance == null) { - instance = new Schema121(); - } - return instance; - } - } - -} diff --git a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/fakeparametercollisions1ababselfab/post/parameters/parameter13/Schema13.kt b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/fakeparametercollisions1ababselfab/post/parameters/parameter13/Schema13.kt deleted file mode 100644 index 22022466c4c..00000000000 --- a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/fakeparametercollisions1ababselfab/post/parameters/parameter13/Schema13.kt +++ /dev/null @@ -1,19 +0,0 @@ -package org.openapijsonschematools.client.paths.fakeparametercollisions1ababselfab.post.parameters.parameter13; -import org.checkerframework.checker.nullness.qual.Nullable; -import org.openapijsonschematools.client.schemas.StringJsonSchema; - -public class Schema13 extends StringJsonSchema { - // nest classes so all schemas and input/output classes can be public - - - public static class Schema131 extends StringJsonSchema.StringJsonSchema1 { - private static @Nullable Schema131 instance = null; - public static Schema131 getInstance() { - if (instance == null) { - instance = new Schema131(); - } - return instance; - } - } - -} diff --git a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/fakeparametercollisions1ababselfab/post/parameters/parameter14/Schema14.kt b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/fakeparametercollisions1ababselfab/post/parameters/parameter14/Schema14.kt deleted file mode 100644 index 3f5d7772daf..00000000000 --- a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/fakeparametercollisions1ababselfab/post/parameters/parameter14/Schema14.kt +++ /dev/null @@ -1,19 +0,0 @@ -package org.openapijsonschematools.client.paths.fakeparametercollisions1ababselfab.post.parameters.parameter14; -import org.checkerframework.checker.nullness.qual.Nullable; -import org.openapijsonschematools.client.schemas.StringJsonSchema; - -public class Schema14 extends StringJsonSchema { - // nest classes so all schemas and input/output classes can be public - - - public static class Schema141 extends StringJsonSchema.StringJsonSchema1 { - private static @Nullable Schema141 instance = null; - public static Schema141 getInstance() { - if (instance == null) { - instance = new Schema141(); - } - return instance; - } - } - -} diff --git a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/fakeparametercollisions1ababselfab/post/parameters/parameter15/Schema15.kt b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/fakeparametercollisions1ababselfab/post/parameters/parameter15/Schema15.kt deleted file mode 100644 index 3242acd48bc..00000000000 --- a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/fakeparametercollisions1ababselfab/post/parameters/parameter15/Schema15.kt +++ /dev/null @@ -1,19 +0,0 @@ -package org.openapijsonschematools.client.paths.fakeparametercollisions1ababselfab.post.parameters.parameter15; -import org.checkerframework.checker.nullness.qual.Nullable; -import org.openapijsonschematools.client.schemas.StringJsonSchema; - -public class Schema15 extends StringJsonSchema { - // nest classes so all schemas and input/output classes can be public - - - public static class Schema151 extends StringJsonSchema.StringJsonSchema1 { - private static @Nullable Schema151 instance = null; - public static Schema151 getInstance() { - if (instance == null) { - instance = new Schema151(); - } - return instance; - } - } - -} diff --git a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/fakeparametercollisions1ababselfab/post/parameters/parameter16/Schema16.kt b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/fakeparametercollisions1ababselfab/post/parameters/parameter16/Schema16.kt deleted file mode 100644 index 185b383c86b..00000000000 --- a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/fakeparametercollisions1ababselfab/post/parameters/parameter16/Schema16.kt +++ /dev/null @@ -1,19 +0,0 @@ -package org.openapijsonschematools.client.paths.fakeparametercollisions1ababselfab.post.parameters.parameter16; -import org.checkerframework.checker.nullness.qual.Nullable; -import org.openapijsonschematools.client.schemas.StringJsonSchema; - -public class Schema16 extends StringJsonSchema { - // nest classes so all schemas and input/output classes can be public - - - public static class Schema161 extends StringJsonSchema.StringJsonSchema1 { - private static @Nullable Schema161 instance = null; - public static Schema161 getInstance() { - if (instance == null) { - instance = new Schema161(); - } - return instance; - } - } - -} diff --git a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/fakeparametercollisions1ababselfab/post/parameters/parameter17/Schema17.kt b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/fakeparametercollisions1ababselfab/post/parameters/parameter17/Schema17.kt deleted file mode 100644 index 227874f5a09..00000000000 --- a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/fakeparametercollisions1ababselfab/post/parameters/parameter17/Schema17.kt +++ /dev/null @@ -1,19 +0,0 @@ -package org.openapijsonschematools.client.paths.fakeparametercollisions1ababselfab.post.parameters.parameter17; -import org.checkerframework.checker.nullness.qual.Nullable; -import org.openapijsonschematools.client.schemas.StringJsonSchema; - -public class Schema17 extends StringJsonSchema { - // nest classes so all schemas and input/output classes can be public - - - public static class Schema171 extends StringJsonSchema.StringJsonSchema1 { - private static @Nullable Schema171 instance = null; - public static Schema171 getInstance() { - if (instance == null) { - instance = new Schema171(); - } - return instance; - } - } - -} diff --git a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/fakeparametercollisions1ababselfab/post/parameters/parameter18/Schema18.kt b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/fakeparametercollisions1ababselfab/post/parameters/parameter18/Schema18.kt deleted file mode 100644 index dc0578087e4..00000000000 --- a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/fakeparametercollisions1ababselfab/post/parameters/parameter18/Schema18.kt +++ /dev/null @@ -1,19 +0,0 @@ -package org.openapijsonschematools.client.paths.fakeparametercollisions1ababselfab.post.parameters.parameter18; -import org.checkerframework.checker.nullness.qual.Nullable; -import org.openapijsonschematools.client.schemas.StringJsonSchema; - -public class Schema18 extends StringJsonSchema { - // nest classes so all schemas and input/output classes can be public - - - public static class Schema181 extends StringJsonSchema.StringJsonSchema1 { - private static @Nullable Schema181 instance = null; - public static Schema181 getInstance() { - if (instance == null) { - instance = new Schema181(); - } - return instance; - } - } - -} diff --git a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/fakeparametercollisions1ababselfab/post/parameters/parameter2/Schema2.kt b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/fakeparametercollisions1ababselfab/post/parameters/parameter2/Schema2.kt deleted file mode 100644 index 0b74b673d7d..00000000000 --- a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/fakeparametercollisions1ababselfab/post/parameters/parameter2/Schema2.kt +++ /dev/null @@ -1,19 +0,0 @@ -package org.openapijsonschematools.client.paths.fakeparametercollisions1ababselfab.post.parameters.parameter2; -import org.checkerframework.checker.nullness.qual.Nullable; -import org.openapijsonschematools.client.schemas.StringJsonSchema; - -public class Schema2 extends StringJsonSchema { - // nest classes so all schemas and input/output classes can be public - - - public static class Schema21 extends StringJsonSchema.StringJsonSchema1 { - private static @Nullable Schema21 instance = null; - public static Schema21 getInstance() { - if (instance == null) { - instance = new Schema21(); - } - return instance; - } - } - -} diff --git a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/fakeparametercollisions1ababselfab/post/parameters/parameter3/Schema3.kt b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/fakeparametercollisions1ababselfab/post/parameters/parameter3/Schema3.kt deleted file mode 100644 index 1fc6abc98d8..00000000000 --- a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/fakeparametercollisions1ababselfab/post/parameters/parameter3/Schema3.kt +++ /dev/null @@ -1,19 +0,0 @@ -package org.openapijsonschematools.client.paths.fakeparametercollisions1ababselfab.post.parameters.parameter3; -import org.checkerframework.checker.nullness.qual.Nullable; -import org.openapijsonschematools.client.schemas.StringJsonSchema; - -public class Schema3 extends StringJsonSchema { - // nest classes so all schemas and input/output classes can be public - - - public static class Schema31 extends StringJsonSchema.StringJsonSchema1 { - private static @Nullable Schema31 instance = null; - public static Schema31 getInstance() { - if (instance == null) { - instance = new Schema31(); - } - return instance; - } - } - -} diff --git a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/fakeparametercollisions1ababselfab/post/parameters/parameter4/Schema4.kt b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/fakeparametercollisions1ababselfab/post/parameters/parameter4/Schema4.kt deleted file mode 100644 index d853e72abf0..00000000000 --- a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/fakeparametercollisions1ababselfab/post/parameters/parameter4/Schema4.kt +++ /dev/null @@ -1,19 +0,0 @@ -package org.openapijsonschematools.client.paths.fakeparametercollisions1ababselfab.post.parameters.parameter4; -import org.checkerframework.checker.nullness.qual.Nullable; -import org.openapijsonschematools.client.schemas.StringJsonSchema; - -public class Schema4 extends StringJsonSchema { - // nest classes so all schemas and input/output classes can be public - - - public static class Schema41 extends StringJsonSchema.StringJsonSchema1 { - private static @Nullable Schema41 instance = null; - public static Schema41 getInstance() { - if (instance == null) { - instance = new Schema41(); - } - return instance; - } - } - -} diff --git a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/fakeparametercollisions1ababselfab/post/parameters/parameter5/Schema5.kt b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/fakeparametercollisions1ababselfab/post/parameters/parameter5/Schema5.kt deleted file mode 100644 index 46b9065a054..00000000000 --- a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/fakeparametercollisions1ababselfab/post/parameters/parameter5/Schema5.kt +++ /dev/null @@ -1,19 +0,0 @@ -package org.openapijsonschematools.client.paths.fakeparametercollisions1ababselfab.post.parameters.parameter5; -import org.checkerframework.checker.nullness.qual.Nullable; -import org.openapijsonschematools.client.schemas.StringJsonSchema; - -public class Schema5 extends StringJsonSchema { - // nest classes so all schemas and input/output classes can be public - - - public static class Schema51 extends StringJsonSchema.StringJsonSchema1 { - private static @Nullable Schema51 instance = null; - public static Schema51 getInstance() { - if (instance == null) { - instance = new Schema51(); - } - return instance; - } - } - -} diff --git a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/fakeparametercollisions1ababselfab/post/parameters/parameter6/Schema6.kt b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/fakeparametercollisions1ababselfab/post/parameters/parameter6/Schema6.kt deleted file mode 100644 index 8d9b2537445..00000000000 --- a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/fakeparametercollisions1ababselfab/post/parameters/parameter6/Schema6.kt +++ /dev/null @@ -1,19 +0,0 @@ -package org.openapijsonschematools.client.paths.fakeparametercollisions1ababselfab.post.parameters.parameter6; -import org.checkerframework.checker.nullness.qual.Nullable; -import org.openapijsonschematools.client.schemas.StringJsonSchema; - -public class Schema6 extends StringJsonSchema { - // nest classes so all schemas and input/output classes can be public - - - public static class Schema61 extends StringJsonSchema.StringJsonSchema1 { - private static @Nullable Schema61 instance = null; - public static Schema61 getInstance() { - if (instance == null) { - instance = new Schema61(); - } - return instance; - } - } - -} diff --git a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/fakeparametercollisions1ababselfab/post/parameters/parameter7/Schema7.kt b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/fakeparametercollisions1ababselfab/post/parameters/parameter7/Schema7.kt deleted file mode 100644 index dd7706f9c60..00000000000 --- a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/fakeparametercollisions1ababselfab/post/parameters/parameter7/Schema7.kt +++ /dev/null @@ -1,19 +0,0 @@ -package org.openapijsonschematools.client.paths.fakeparametercollisions1ababselfab.post.parameters.parameter7; -import org.checkerframework.checker.nullness.qual.Nullable; -import org.openapijsonschematools.client.schemas.StringJsonSchema; - -public class Schema7 extends StringJsonSchema { - // nest classes so all schemas and input/output classes can be public - - - public static class Schema71 extends StringJsonSchema.StringJsonSchema1 { - private static @Nullable Schema71 instance = null; - public static Schema71 getInstance() { - if (instance == null) { - instance = new Schema71(); - } - return instance; - } - } - -} diff --git a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/fakeparametercollisions1ababselfab/post/parameters/parameter8/Schema8.kt b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/fakeparametercollisions1ababselfab/post/parameters/parameter8/Schema8.kt deleted file mode 100644 index 23df1c2744c..00000000000 --- a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/fakeparametercollisions1ababselfab/post/parameters/parameter8/Schema8.kt +++ /dev/null @@ -1,19 +0,0 @@ -package org.openapijsonschematools.client.paths.fakeparametercollisions1ababselfab.post.parameters.parameter8; -import org.checkerframework.checker.nullness.qual.Nullable; -import org.openapijsonschematools.client.schemas.StringJsonSchema; - -public class Schema8 extends StringJsonSchema { - // nest classes so all schemas and input/output classes can be public - - - public static class Schema81 extends StringJsonSchema.StringJsonSchema1 { - private static @Nullable Schema81 instance = null; - public static Schema81 getInstance() { - if (instance == null) { - instance = new Schema81(); - } - return instance; - } - } - -} diff --git a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/fakeparametercollisions1ababselfab/post/parameters/parameter9/Schema9.kt b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/fakeparametercollisions1ababselfab/post/parameters/parameter9/Schema9.kt deleted file mode 100644 index 1b334c178e1..00000000000 --- a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/fakeparametercollisions1ababselfab/post/parameters/parameter9/Schema9.kt +++ /dev/null @@ -1,19 +0,0 @@ -package org.openapijsonschematools.client.paths.fakeparametercollisions1ababselfab.post.parameters.parameter9; -import org.checkerframework.checker.nullness.qual.Nullable; -import org.openapijsonschematools.client.schemas.StringJsonSchema; - -public class Schema9 extends StringJsonSchema { - // nest classes so all schemas and input/output classes can be public - - - public static class Schema91 extends StringJsonSchema.StringJsonSchema1 { - private static @Nullable Schema91 instance = null; - public static Schema91 getInstance() { - if (instance == null) { - instance = new Schema91(); - } - return instance; - } - } - -} diff --git a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/fakeparametercollisions1ababselfab/post/requestbody/content/applicationjson/ApplicationjsonSchema.kt b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/fakeparametercollisions1ababselfab/post/requestbody/content/applicationjson/ApplicationjsonSchema.kt deleted file mode 100644 index b67706b3437..00000000000 --- a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/fakeparametercollisions1ababselfab/post/requestbody/content/applicationjson/ApplicationjsonSchema.kt +++ /dev/null @@ -1,19 +0,0 @@ -package org.openapijsonschematools.client.paths.fakeparametercollisions1ababselfab.post.requestbody.content.applicationjson; -import org.checkerframework.checker.nullness.qual.Nullable; -import org.openapijsonschematools.client.schemas.AnyTypeJsonSchema; - -public class ApplicationjsonSchema extends AnyTypeJsonSchema { - // nest classes so all schemas and input/output classes can be public - - - public static class ApplicationjsonSchema1 extends AnyTypeJsonSchema.AnyTypeJsonSchema1 { - private static @Nullable ApplicationjsonSchema1 instance = null; - public static ApplicationjsonSchema1 getInstance() { - if (instance == null) { - instance = new ApplicationjsonSchema1(); - } - return instance; - } - } - -} diff --git a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/fakeparametercollisions1ababselfab/post/responses/Fakeparametercollisions1ababselfabPostCode200Response.kt b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/fakeparametercollisions1ababselfab/post/responses/Fakeparametercollisions1ababselfabPostCode200Response.kt deleted file mode 100644 index 27bd226bc25..00000000000 --- a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/fakeparametercollisions1ababselfab/post/responses/Fakeparametercollisions1ababselfabPostCode200Response.kt +++ /dev/null @@ -1,63 +0,0 @@ -package org.openapijsonschematools.client.paths.fakeparametercollisions1ababselfab.post.responses; - -import org.openapijsonschematools.client.configurations.SchemaConfiguration; -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; - -import java.util.AbstractMap; -import java.util.Map; -import java.net.http.HttpResponse; -import java.net.http.HttpHeaders; - -public class Fakeparametercollisions1ababselfabPostCode200Response { - public sealed interface SealedMediaType permits ApplicationjsonMediaType {} - - public record ApplicationjsonMediaType(ApplicationjsonSchema.ApplicationjsonSchema1 schema) implements SealedMediaType, MediaType { - public ApplicationjsonMediaType() { - this(ApplicationjsonSchema.ApplicationjsonSchema1.getInstance()); - } - @Override - public Nothing? encoding() { - return null; - } - } - public sealed interface SealedResponseBody permits ApplicationjsonResponseBody {} - public record ApplicationjsonResponseBody(ApplicationjsonSchema.AnyTypeJsonSchema1Boxed body) implements SealedResponseBody { } - - public static class Fakeparametercollisions1ababselfabPostCode200Response1 extends ResponseDeserializer { - public Fakeparametercollisions1ababselfabPostCode200Response1() { - super( - Map.ofEntries( - new AbstractMap.SimpleEntry<>("application/json", new ApplicationjsonMediaType()) - ) - ); - } - - @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); - } - - @Override - protected Nothing? getHeaders(HttpHeaders headers, SchemaConfiguration configuration) { - return null; - } - } - - @SuppressWarnings("serial") - public static class ResponseApiException extends ApiException { - public DeserializedHttpResponse deserializedResponse; - - public ResponseApiException(String s, HttpResponse response, DeserializedHttpResponse deserializedResponse) { - super(s, response); - this.deserializedResponse = deserializedResponse; - } - } -} diff --git a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/fakeparametercollisions1ababselfab/post/responses/code200response/content/applicationjson/ApplicationjsonSchema.kt b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/fakeparametercollisions1ababselfab/post/responses/code200response/content/applicationjson/ApplicationjsonSchema.kt deleted file mode 100644 index bb2a30a2a2e..00000000000 --- a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/fakeparametercollisions1ababselfab/post/responses/code200response/content/applicationjson/ApplicationjsonSchema.kt +++ /dev/null @@ -1,19 +0,0 @@ -package org.openapijsonschematools.client.paths.fakeparametercollisions1ababselfab.post.responses.code200response.content.applicationjson; -import org.checkerframework.checker.nullness.qual.Nullable; -import org.openapijsonschematools.client.schemas.AnyTypeJsonSchema; - -public class ApplicationjsonSchema extends AnyTypeJsonSchema { - // nest classes so all schemas and input/output classes can be public - - - public static class ApplicationjsonSchema1 extends AnyTypeJsonSchema.AnyTypeJsonSchema1 { - private static @Nullable ApplicationjsonSchema1 instance = null; - public static ApplicationjsonSchema1 getInstance() { - if (instance == null) { - instance = new ApplicationjsonSchema1(); - } - return instance; - } - } - -} diff --git a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/fakepemcontenttype/FakepemcontenttypeGet.kt b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/fakepemcontenttype/FakepemcontenttypeGet.kt deleted file mode 100644 index 5c627fe0093..00000000000 --- a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/fakepemcontenttype/FakepemcontenttypeGet.kt +++ /dev/null @@ -1,152 +0,0 @@ -package org.openapijsonschematools.client.paths.fakepemcontenttype; - -import org.checkerframework.checker.nullness.qual.Nullable; -import org.openapijsonschematools.client.paths.fakepemcontenttype.get.FakepemcontenttypeGetRequestBody; -import org.openapijsonschematools.client.RootServerInfo; -import org.openapijsonschematools.client.paths.fakepemcontenttype.get.FakepemcontenttypeGetResponses; -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.requestbody.SerializedRequestBody; -import org.openapijsonschematools.client.paths.Fakepemcontenttype; - -import java.io.IOException; -import java.util.ArrayList; -import java.net.http.HttpClient; -import java.net.http.HttpRequest; -import java.time.Duration; -import java.util.List; -import java.util.Map; - -public class FakepemcontenttypeGet { - private static class GetProvider { - private static final String method = "get"; - - public static FakepemcontenttypeGetResponses.EndpointResponse get( - GetRequest request, - ApiConfiguration apiConfiguration, - SchemaConfiguration schemaConfiguration, - HttpClient client - ) throws IOException, InterruptedException, ValidationException, NotImplementedException, ApiException { - Map> headers = apiConfiguration.getDefaultHeaders(); - - @Nullable SerializedRequestBody serializedRequestBody; - HttpRequest.BodyPublisher bodyPublisher = HttpRequest.BodyPublishers.noBody(); - if (request.requestBody != null) { - serializedRequestBody = new FakepemcontenttypeGetRequestBody.FakepemcontenttypeGetRequestBody1().serialize( - request.requestBody - ); - var contentTypeHeaderValues = headers.getOrDefault("Content-Type", new ArrayList<>()); - contentTypeHeaderValues.add(serializedRequestBody.contentType); - bodyPublisher = serializedRequestBody.bodyPublisher; - } - // TODO set this to a map if there is a query security scheme - @Nullable Map queryMap = null; - String host = apiConfiguration.getServer(request.serverIndex).url(); - - String url = host + Fakepemcontenttype.path; - var httpRequest = RestClient.getRequest( - url, - method, - bodyPublisher, - headers, - request.timeout - ); - var response = RestClient.getResponse(httpRequest, client); - var responsesDeserializer = new FakepemcontenttypeGetResponses.FakepemcontenttypeGetResponses1(); - return responsesDeserializer.deserialize(response, schemaConfiguration); - } - } - - public interface GetOperation { - ApiConfiguration getApiConfiguration(); - SchemaConfiguration getSchemaConfiguration(); - HttpClient getClient(); - default FakepemcontenttypeGetResponses.EndpointResponse get(GetRequest request) throws IOException, InterruptedException, ValidationException, NotImplementedException, ApiException { - return GetProvider.get(request, getApiConfiguration(), getSchemaConfiguration(), getClient()); - } - } - - public interface PemContentTypeOperation { - ApiConfiguration getApiConfiguration(); - SchemaConfiguration getSchemaConfiguration(); - HttpClient getClient(); - default FakepemcontenttypeGetResponses.EndpointResponse pemContentType(GetRequest request) throws IOException, InterruptedException, ValidationException, NotImplementedException, ApiException { - return GetProvider.get(request, getApiConfiguration(), getSchemaConfiguration(), getClient()); - } - } - - public static class Get extends ApiClient implements GetOperation { - public Get(ApiConfiguration apiConfiguration, SchemaConfiguration schemaConfiguration) { - super(apiConfiguration, schemaConfiguration); - } - } - - public static class GetRequest { - public FakepemcontenttypeGetRequestBody.@Nullable SealedRequestBody requestBody; - public RootServerInfo.@Nullable ServerIndex serverIndex; - public @Nullable Duration timeout; - } - - public interface SetterForRequestBody { - GetRequest getInstance(); - T getBuilderAfterRequestBody(GetRequest instance); - default T requestBody(FakepemcontenttypeGetRequestBody.SealedRequestBody requestBody) { - var instance = getInstance(); - instance.requestBody = requestBody; - return getBuilderAfterRequestBody(instance); - } - } - - public interface SetterForServerIndex { - GetRequest getInstance(); - T getBuilderAfterServerIndex(GetRequest instance); - default T serverIndex(RootServerInfo.ServerIndex serverIndex) { - var instance = getInstance(); - instance.serverIndex = serverIndex; - return getBuilderAfterServerIndex(instance); - } - } - - public interface SetterForTimeout { - GetRequest getInstance(); - T getBuilderAfterTimeout(GetRequest instance); - default T timeout(Duration timeout) { - var instance = getInstance(); - instance.timeout = timeout; - return getBuilderAfterTimeout(instance); - } - } - - public static class GetRequestBuilder implements SetterForRequestBody, SetterForServerIndex, SetterForTimeout { - private final GetRequest instance; - - public GetRequestBuilder() { - this.instance = new GetRequest(); - } - - public GetRequest build() { - return instance; - } - - public GetRequest getInstance() { - return instance; - } - - public GetRequestBuilder getBuilderAfterRequestBody(GetRequest instance) { - return this; - } - - public GetRequestBuilder getBuilderAfterServerIndex(GetRequest instance) { - return this; - } - - public GetRequestBuilder getBuilderAfterTimeout(GetRequest instance) { - return this; - } - } -} diff --git a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/fakepemcontenttype/get/FakepemcontenttypeGetRequestBody.kt b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/fakepemcontenttype/get/FakepemcontenttypeGetRequestBody.kt deleted file mode 100644 index c0d16ea083b..00000000000 --- a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/fakepemcontenttype/get/FakepemcontenttypeGetRequestBody.kt +++ /dev/null @@ -1,49 +0,0 @@ -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; -import org.openapijsonschematools.client.mediatype.MediaType; -import org.openapijsonschematools.client.paths.fakepemcontenttype.get.requestbody.content.applicationxpemfile.ApplicationxpemfileSchema; - -import java.util.AbstractMap; -import java.util.Map; - -public class FakepemcontenttypeGetRequestBody { - public sealed interface SealedMediaType permits ApplicationxpemfileMediaType {} - - public record ApplicationxpemfileMediaType(ApplicationxpemfileSchema.ApplicationxpemfileSchema1 schema) implements SealedMediaType, MediaType { - public ApplicationxpemfileMediaType() { - this(ApplicationxpemfileSchema.ApplicationxpemfileSchema1.getInstance()); - } - @Override - public Nothing? encoding() { - return null; - } - } - - public static class FakepemcontenttypeGetRequestBody1 extends RequestBodySerializer { - public FakepemcontenttypeGetRequestBody1() { - super( - Map.ofEntries( - new AbstractMap.SimpleEntry<>("application/x-pem-file", new ApplicationxpemfileMediaType()) - ), - false - ); - } - - public SerializedRequestBody serialize(SealedRequestBody requestBody) throws NotImplementedException { - ApplicationxpemfileRequestBody requestBody0 = (ApplicationxpemfileRequestBody) requestBody; - return serialize(requestBody0.contentType(), requestBody0.body().getData()); - } - } - - public sealed interface SealedRequestBody permits ApplicationxpemfileRequestBody {} - public record ApplicationxpemfileRequestBody(ApplicationxpemfileSchema.StringJsonSchema1Boxed body) implements SealedRequestBody, GenericRequestBody { - @Override - public String contentType() { - return "application/x-pem-file"; - } - } -} diff --git a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/fakepemcontenttype/get/FakepemcontenttypeGetResponses.kt b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/fakepemcontenttype/get/FakepemcontenttypeGetResponses.kt deleted file mode 100644 index f7d5df3c39d..00000000000 --- a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/fakepemcontenttype/get/FakepemcontenttypeGetResponses.kt +++ /dev/null @@ -1,53 +0,0 @@ -package org.openapijsonschematools.client.paths.fakepemcontenttype.get; - -import org.openapijsonschematools.client.paths.fakepemcontenttype.get.responses.FakepemcontenttypeGetCode200Response; -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; -import org.checkerframework.checker.nullness.qual.Nullable; - -import java.net.http.HttpResponse; -import java.util.Map; -import java.util.AbstractMap; - -public class FakepemcontenttypeGetResponses { - public sealed interface EndpointResponse permits EndpointFakepemcontenttypeGetCode200Response {} - - public record EndpointFakepemcontenttypeGetCode200Response( - HttpResponse response, - FakepemcontenttypeGetCode200Response.SealedResponseBody body, - Nothing? headers - ) implements EndpointResponse, ApiResponse{ - } - - public sealed interface StatusCodeResponseDeserializer permits StatusFakepemcontenttypeGetCode200ResponseDeserializer {} - - public static final class StatusFakepemcontenttypeGetCode200ResponseDeserializer extends FakepemcontenttypeGetCode200Response.FakepemcontenttypeGetCode200Response1 implements StatusCodeResponseDeserializer { - } - - public static final class FakepemcontenttypeGetResponses1 implements ResponsesDeserializer { - private final Map statusCodeToResponseDeserializer; - public FakepemcontenttypeGetResponses1() { - this.statusCodeToResponseDeserializer = Map.ofEntries( - new AbstractMap.SimpleEntry<>("200", new StatusFakepemcontenttypeGetCode200ResponseDeserializer()) - ); - } - - 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) { - throw new ApiException( - "Invalid response statusCode="+statusCode+" has no response defined in the openapi document", - response - ); - } - StatusFakepemcontenttypeGetCode200ResponseDeserializer castDeserializer = (StatusFakepemcontenttypeGetCode200ResponseDeserializer) statusCodeDeserializer; - var deserializedResponse = castDeserializer.deserialize(response, configuration); - return new EndpointFakepemcontenttypeGetCode200Response(response, deserializedResponse.body(), deserializedResponse.headers()); - } - } -} diff --git a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/fakepemcontenttype/get/requestbody/content/applicationxpemfile/ApplicationxpemfileSchema.kt b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/fakepemcontenttype/get/requestbody/content/applicationxpemfile/ApplicationxpemfileSchema.kt deleted file mode 100644 index 125b14dd81c..00000000000 --- a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/fakepemcontenttype/get/requestbody/content/applicationxpemfile/ApplicationxpemfileSchema.kt +++ /dev/null @@ -1,19 +0,0 @@ -package org.openapijsonschematools.client.paths.fakepemcontenttype.get.requestbody.content.applicationxpemfile; -import org.checkerframework.checker.nullness.qual.Nullable; -import org.openapijsonschematools.client.schemas.StringJsonSchema; - -public class ApplicationxpemfileSchema extends StringJsonSchema { - // nest classes so all schemas and input/output classes can be public - - - public static class ApplicationxpemfileSchema1 extends StringJsonSchema.StringJsonSchema1 { - private static @Nullable ApplicationxpemfileSchema1 instance = null; - public static ApplicationxpemfileSchema1 getInstance() { - if (instance == null) { - instance = new ApplicationxpemfileSchema1(); - } - return instance; - } - } - -} diff --git a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/fakepemcontenttype/get/responses/FakepemcontenttypeGetCode200Response.kt b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/fakepemcontenttype/get/responses/FakepemcontenttypeGetCode200Response.kt deleted file mode 100644 index e5dd073c7fa..00000000000 --- a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/fakepemcontenttype/get/responses/FakepemcontenttypeGetCode200Response.kt +++ /dev/null @@ -1,63 +0,0 @@ -package org.openapijsonschematools.client.paths.fakepemcontenttype.get.responses; - -import org.openapijsonschematools.client.configurations.SchemaConfiguration; -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; - -import java.util.AbstractMap; -import java.util.Map; -import java.net.http.HttpResponse; -import java.net.http.HttpHeaders; - -public class FakepemcontenttypeGetCode200Response { - public sealed interface SealedMediaType permits ApplicationxpemfileMediaType {} - - public record ApplicationxpemfileMediaType(ApplicationxpemfileSchema.ApplicationxpemfileSchema1 schema) implements SealedMediaType, MediaType { - public ApplicationxpemfileMediaType() { - this(ApplicationxpemfileSchema.ApplicationxpemfileSchema1.getInstance()); - } - @Override - public Nothing? encoding() { - return null; - } - } - public sealed interface SealedResponseBody permits ApplicationxpemfileResponseBody {} - public record ApplicationxpemfileResponseBody(ApplicationxpemfileSchema.StringJsonSchema1Boxed body) implements SealedResponseBody { } - - public static class FakepemcontenttypeGetCode200Response1 extends ResponseDeserializer { - public FakepemcontenttypeGetCode200Response1() { - super( - Map.ofEntries( - new AbstractMap.SimpleEntry<>("application/x-pem-file", new ApplicationxpemfileMediaType()) - ) - ); - } - - @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); - } - - @Override - protected Nothing? getHeaders(HttpHeaders headers, SchemaConfiguration configuration) { - return null; - } - } - - @SuppressWarnings("serial") - public static class ResponseApiException extends ApiException { - public DeserializedHttpResponse deserializedResponse; - - public ResponseApiException(String s, HttpResponse response, DeserializedHttpResponse deserializedResponse) { - super(s, response); - this.deserializedResponse = deserializedResponse; - } - } -} diff --git a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/fakepemcontenttype/get/responses/code200response/content/applicationxpemfile/ApplicationxpemfileSchema.kt b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/fakepemcontenttype/get/responses/code200response/content/applicationxpemfile/ApplicationxpemfileSchema.kt deleted file mode 100644 index 0d12b96b19a..00000000000 --- a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/fakepemcontenttype/get/responses/code200response/content/applicationxpemfile/ApplicationxpemfileSchema.kt +++ /dev/null @@ -1,19 +0,0 @@ -package org.openapijsonschematools.client.paths.fakepemcontenttype.get.responses.code200response.content.applicationxpemfile; -import org.checkerframework.checker.nullness.qual.Nullable; -import org.openapijsonschematools.client.schemas.StringJsonSchema; - -public class ApplicationxpemfileSchema extends StringJsonSchema { - // nest classes so all schemas and input/output classes can be public - - - public static class ApplicationxpemfileSchema1 extends StringJsonSchema.StringJsonSchema1 { - private static @Nullable ApplicationxpemfileSchema1 instance = null; - public static ApplicationxpemfileSchema1 getInstance() { - if (instance == null) { - instance = new ApplicationxpemfileSchema1(); - } - return instance; - } - } - -} diff --git a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/fakepetiduploadimagewithrequiredfile/FakepetiduploadimagewithrequiredfilePost.kt b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/fakepetiduploadimagewithrequiredfile/FakepetiduploadimagewithrequiredfilePost.kt deleted file mode 100644 index 79603a6ddc6..00000000000 --- a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/fakepetiduploadimagewithrequiredfile/FakepetiduploadimagewithrequiredfilePost.kt +++ /dev/null @@ -1,243 +0,0 @@ -package org.openapijsonschematools.client.paths.fakepetiduploadimagewithrequiredfile; - -import org.checkerframework.checker.nullness.qual.Nullable; -import org.openapijsonschematools.client.paths.fakepetiduploadimagewithrequiredfile.post.FakepetiduploadimagewithrequiredfilePostRequestBody; -import org.openapijsonschematools.client.RootServerInfo; -import org.openapijsonschematools.client.paths.fakepetiduploadimagewithrequiredfile.post.FakepetiduploadimagewithrequiredfilePostSecurityInfo; -import org.openapijsonschematools.client.paths.fakepetiduploadimagewithrequiredfile.post.FakepetiduploadimagewithrequiredfilePostPathParameters; -import org.openapijsonschematools.client.paths.fakepetiduploadimagewithrequiredfile.post.Parameters; -import org.openapijsonschematools.client.paths.fakepetiduploadimagewithrequiredfile.post.FakepetiduploadimagewithrequiredfilePostResponses; -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.requestbody.SerializedRequestBody; -import org.openapijsonschematools.client.paths.Fakepetiduploadimagewithrequiredfile; -import org.openapijsonschematools.client.securityrequirementobjects.SecurityRequirementObject; -import org.openapijsonschematools.client.securityrequirementobjects.AuthApplier; - -import java.io.IOException; -import java.util.ArrayList; -import java.net.http.HttpClient; -import java.net.http.HttpRequest; -import java.time.Duration; -import java.util.List; -import java.util.Map; - -public class FakepetiduploadimagewithrequiredfilePost { - private static class PostProvider extends AuthApplier { - private static final String method = "post"; - - public static FakepetiduploadimagewithrequiredfilePostResponses.EndpointResponse post( - PostRequest request, - ApiConfiguration apiConfiguration, - SchemaConfiguration schemaConfiguration, - HttpClient client - ) throws IOException, InterruptedException, ValidationException, NotImplementedException, ApiException { - Map> headers = apiConfiguration.getDefaultHeaders(); - - @Nullable SerializedRequestBody serializedRequestBody; - HttpRequest.BodyPublisher bodyPublisher = HttpRequest.BodyPublishers.noBody(); - if (request.requestBody != null) { - serializedRequestBody = new FakepetiduploadimagewithrequiredfilePostRequestBody.FakepetiduploadimagewithrequiredfilePostRequestBody1().serialize( - request.requestBody - ); - var contentTypeHeaderValues = headers.getOrDefault("Content-Type", new ArrayList<>()); - contentTypeHeaderValues.add(serializedRequestBody.contentType); - bodyPublisher = serializedRequestBody.bodyPublisher; - } - - var pathSerializer = new Parameters.PathParametersSerializer(); - String updatedPath = pathSerializer.serialize(request.pathParameters, Fakepetiduploadimagewithrequiredfile.path); - // TODO set this to a map if there is a query security scheme - @Nullable Map queryMap = null; - String host = apiConfiguration.getServer(request.serverIndex).url(); - SecurityRequirementObject securityRequirementObject = apiConfiguration.getSecurityRequirementObject(request.securityIndex); - updateParamsForAuth( - securityRequirementObject, - headers, - updatedPath, - method, - bodyPublisher, - queryMap, - apiConfiguration - ); - - String url = host + updatedPath; - var httpRequest = RestClient.getRequest( - url, - method, - bodyPublisher, - headers, - request.timeout - ); - var response = RestClient.getResponse(httpRequest, client); - var responsesDeserializer = new FakepetiduploadimagewithrequiredfilePostResponses.FakepetiduploadimagewithrequiredfilePostResponses1(); - return responsesDeserializer.deserialize(response, schemaConfiguration); - } - } - - public interface PostOperation { - ApiConfiguration getApiConfiguration(); - SchemaConfiguration getSchemaConfiguration(); - HttpClient getClient(); - default FakepetiduploadimagewithrequiredfilePostResponses.EndpointResponse post(PostRequest request) throws IOException, InterruptedException, ValidationException, NotImplementedException, ApiException { - return PostProvider.post(request, getApiConfiguration(), getSchemaConfiguration(), getClient()); - } - } - - public interface UploadFileWithRequiredFileOperation { - ApiConfiguration getApiConfiguration(); - SchemaConfiguration getSchemaConfiguration(); - HttpClient getClient(); - default FakepetiduploadimagewithrequiredfilePostResponses.EndpointResponse uploadFileWithRequiredFile(PostRequest request) throws IOException, InterruptedException, ValidationException, NotImplementedException, ApiException { - return PostProvider.post(request, getApiConfiguration(), getSchemaConfiguration(), getClient()); - } - } - - public static class Post extends ApiClient implements PostOperation { - public Post(ApiConfiguration apiConfiguration, SchemaConfiguration schemaConfiguration) { - super(apiConfiguration, schemaConfiguration); - } - } - - public static class PostRequest { - public FakepetiduploadimagewithrequiredfilePostPathParameters.PathParametersMap pathParameters; - public FakepetiduploadimagewithrequiredfilePostRequestBody.@Nullable SealedRequestBody requestBody; - public RootServerInfo.@Nullable ServerIndex serverIndex; - public FakepetiduploadimagewithrequiredfilePostSecurityInfo.@Nullable SecurityIndex securityIndex; - public @Nullable Duration timeout; - - public PostRequest( - FakepetiduploadimagewithrequiredfilePostPathParameters.PathParametersMap pathParameters, - FakepetiduploadimagewithrequiredfilePostRequestBody.@Nullable SealedRequestBody requestBody, - RootServerInfo.@Nullable ServerIndex serverIndex, - FakepetiduploadimagewithrequiredfilePostSecurityInfo.@Nullable SecurityIndex securityIndex, - @Nullable Duration timeout - ) { - this.pathParameters = pathParameters; - this.requestBody = requestBody; - this.serverIndex = serverIndex; - this.securityIndex = securityIndex; - this.timeout = timeout; - } - } - - public static class PostNullableRequest { - public FakepetiduploadimagewithrequiredfilePostPathParameters.@Nullable PathParametersMap pathParameters; - public FakepetiduploadimagewithrequiredfilePostRequestBody.@Nullable SealedRequestBody requestBody; - public RootServerInfo.@Nullable ServerIndex serverIndex; - public FakepetiduploadimagewithrequiredfilePostSecurityInfo.@Nullable SecurityIndex securityIndex; - public @Nullable Duration timeout; - } - - public interface SetterForRequestBody { - PostNullableRequest getInstance(); - T getBuilderAfterRequestBody(PostNullableRequest instance); - default T requestBody(FakepetiduploadimagewithrequiredfilePostRequestBody.SealedRequestBody requestBody) { - var instance = getInstance(); - instance.requestBody = requestBody; - return getBuilderAfterRequestBody(instance); - } - } - - public interface SetterForServerIndex { - PostNullableRequest getInstance(); - T getBuilderAfterServerIndex(PostNullableRequest instance); - default T serverIndex(RootServerInfo.ServerIndex serverIndex) { - var instance = getInstance(); - instance.serverIndex = serverIndex; - return getBuilderAfterServerIndex(instance); - } - } - - public interface SetterForSecurityIndex { - PostNullableRequest getInstance(); - T getBuilderAfterSecurityIndex(PostNullableRequest instance); - default T securityIndex(FakepetiduploadimagewithrequiredfilePostSecurityInfo.SecurityIndex securityIndex) { - var instance = getInstance(); - instance.securityIndex = securityIndex; - return getBuilderAfterSecurityIndex(instance); - } - } - - public interface SetterForTimeout { - PostNullableRequest getInstance(); - T getBuilderAfterTimeout(PostNullableRequest instance); - default T timeout(Duration timeout) { - var instance = getInstance(); - instance.timeout = timeout; - return getBuilderAfterTimeout(instance); - } - } - - public interface SetterForPathParameters { - PostNullableRequest getInstance(); - T getBuilderAfterPathParameters(PostNullableRequest instance); - default T pathParameters(FakepetiduploadimagewithrequiredfilePostPathParameters.PathParametersMap pathParameters) { - var instance = getInstance(); - instance.pathParameters = pathParameters; - return getBuilderAfterPathParameters(instance); - } - } - - public static class Post0RequestBuilder implements SetterForRequestBody, SetterForServerIndex, SetterForSecurityIndex, SetterForTimeout { - private final PostNullableRequest instance; - - public Post0RequestBuilder(PostNullableRequest instance) { - this.instance = instance; - } - - public PostRequest build() { - var pathParameters = instance.pathParameters; - if (pathParameters == null) { - throw new RuntimeException("invalid null value for required parameter"); - } - return new PostRequest( - pathParameters, - instance.requestBody, - instance.serverIndex, - instance.securityIndex, - instance.timeout - ); - } - - public PostNullableRequest getInstance() { - return instance; - } - - public Post0RequestBuilder getBuilderAfterRequestBody(PostNullableRequest instance) { - return this; - } - - public Post0RequestBuilder getBuilderAfterServerIndex(PostNullableRequest instance) { - return this; - } - - public Post0RequestBuilder getBuilderAfterSecurityIndex(PostNullableRequest instance) { - return this; - } - - public Post0RequestBuilder getBuilderAfterTimeout(PostNullableRequest instance) { - return this; - } - } - public static class PostRequestBuilder implements SetterForPathParameters { - private final PostNullableRequest instance; - - public PostRequestBuilder() { - this.instance = new PostNullableRequest(); - } - - public PostNullableRequest getInstance() { - return instance; - } - - public Post0RequestBuilder getBuilderAfterPathParameters(PostNullableRequest instance) { - return new Post0RequestBuilder(instance); - } - } -} diff --git a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/fakepetiduploadimagewithrequiredfile/post/FakepetiduploadimagewithrequiredfilePostPathParameters.kt b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/fakepetiduploadimagewithrequiredfile/post/FakepetiduploadimagewithrequiredfilePostPathParameters.kt deleted file mode 100644 index 4bb71a8399d..00000000000 --- a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/fakepetiduploadimagewithrequiredfile/post/FakepetiduploadimagewithrequiredfilePostPathParameters.kt +++ /dev/null @@ -1,223 +0,0 @@ -package org.openapijsonschematools.client.paths.fakepetiduploadimagewithrequiredfile.post; -import java.util.ArrayList; -import java.util.HashSet; -import java.util.LinkedHashMap; -import java.util.LinkedHashSet; -import java.util.List; -import java.util.Map; -import java.util.Objects; -import java.util.Set; -import org.checkerframework.checker.nullness.qual.Nullable; -import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags; -import org.openapijsonschematools.client.configurations.SchemaConfiguration; -import org.openapijsonschematools.client.exceptions.UnsetPropertyException; -import org.openapijsonschematools.client.exceptions.ValidationException; -import org.openapijsonschematools.client.paths.fakepetiduploadimagewithrequiredfile.post.parameters.parameter0.Schema0; -import org.openapijsonschematools.client.schemas.AnyTypeJsonSchema; -import org.openapijsonschematools.client.schemas.GenericBuilder; -import org.openapijsonschematools.client.schemas.NotAnyTypeJsonSchema; -import org.openapijsonschematools.client.schemas.validation.FrozenMap; -import org.openapijsonschematools.client.schemas.validation.JsonSchema; -import org.openapijsonschematools.client.schemas.validation.JsonSchemaInfo; -import org.openapijsonschematools.client.schemas.validation.MapSchemaValidator; -import org.openapijsonschematools.client.schemas.validation.MapUtils; -import org.openapijsonschematools.client.schemas.validation.PathToSchemasMap; -import org.openapijsonschematools.client.schemas.validation.PropertyEntry; -import org.openapijsonschematools.client.schemas.validation.ValidationMetadata; - -public class FakepetiduploadimagewithrequiredfilePostPathParameters { - // nest classes so all schemas and input/output classes can be public - - - public static class AdditionalProperties extends NotAnyTypeJsonSchema.NotAnyTypeJsonSchema1 { - // NotAnyTypeSchema - private static @Nullable AdditionalProperties instance = null; - public static AdditionalProperties getInstance() { - if (instance == null) { - instance = new AdditionalProperties(); - } - return instance; - } - } - - - public static class PathParametersMap extends FrozenMap { - protected PathParametersMap(FrozenMap m) { - super(m); - } - public static final Set requiredKeys = Set.of( - "petId" - ); - public static final Set optionalKeys = Set.of(); - public static PathParametersMap of(Map arg, SchemaConfiguration configuration) throws ValidationException { - return FakepetiduploadimagewithrequiredfilePostPathParameters1.getInstance().validate(arg, configuration); - } - - public Number petId() { - try { - return getOrThrow("version"); - } catch (UnsetPropertyException e) { - throw new RuntimeException(e); - } - } - } - - public interface SetterForPetId { - Map getInstance(); - T getBuilderAfterPetId(Map instance); - - default T petId(int value) { - var instance = getInstance(); - instance.put("petId", value); - return getBuilderAfterPetId(instance); - } - - default T petId(float value) { - var instance = getInstance(); - instance.put("petId", value); - return getBuilderAfterPetId(instance); - } - - default T petId(long value) { - var instance = getInstance(); - instance.put("petId", value); - return getBuilderAfterPetId(instance); - } - - default T petId(double value) { - var instance = getInstance(); - instance.put("petId", value); - return getBuilderAfterPetId(instance); - } - } - - public static class PathParametersMap0Builder implements GenericBuilder> { - private final Map instance; - private static final Set knownKeys = Set.of( - "petId" - ); - public Set getKnownKeys() { - return knownKeys; - } - public PathParametersMap0Builder(Map instance) { - this.instance = instance; - } - public Map build() { - return instance; - } - } - - public static class PathParametersMapBuilder implements SetterForPetId { - private final Map instance; - public PathParametersMapBuilder() { - this.instance = new LinkedHashMap<>(); - } - public Map getInstance() { - return instance; - } - public PathParametersMap0Builder getBuilderAfterPetId(Map instance) { - return new PathParametersMap0Builder(instance); - } - } - - - public sealed interface FakepetiduploadimagewithrequiredfilePostPathParameters1Boxed permits FakepetiduploadimagewithrequiredfilePostPathParameters1BoxedMap { - @Nullable Object getData(); - } - - public record FakepetiduploadimagewithrequiredfilePostPathParameters1BoxedMap(PathParametersMap data) implements FakepetiduploadimagewithrequiredfilePostPathParameters1Boxed { - @Override - public @Nullable Object getData() { - return data; - } - } - - - public static class FakepetiduploadimagewithrequiredfilePostPathParameters1 extends JsonSchema implements MapSchemaValidator { - private static @Nullable FakepetiduploadimagewithrequiredfilePostPathParameters1 instance = null; - - protected FakepetiduploadimagewithrequiredfilePostPathParameters1() { - super(new JsonSchemaInfo() - .type(Set.of(Map.class)) - .properties(Map.ofEntries( - new PropertyEntry("petId", Schema0.Schema01.class) - )) - .required(Set.of( - "petId" - )) - .additionalProperties(AdditionalProperties.class) - ); - } - - public static FakepetiduploadimagewithrequiredfilePostPathParameters1 getInstance() { - if (instance == null) { - instance = new FakepetiduploadimagewithrequiredfilePostPathParameters1(); - } - return instance; - } - - 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 RuntimeException("Invalid non-string key value"); - } - String propertyName = (String) entryKey; - List propertyPathToItem = new ArrayList<>(pathToItem); - propertyPathToItem.add(propertyName); - Object value = entry.getValue(); - LinkedHashMap, Nothing?> schemas = pathToSchemas.get(propertyPathToItem); - if (schemas == null) { - throw new RuntimeException("Validation 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"); - } - properties.put(propertyName, (Number) propertyInstance); - } - FrozenMap castProperties = new FrozenMap<>(properties); - return new PathParametersMap(castProperties); - } - - 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); - SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().build())); - ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, new PathToSchemasMap(), new LinkedHashSet<>()); - PathToSchemasMap pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet); - return getNewInstance(castArg, validationMetadata.pathToItem(), pathToSchemasMap); - } - - - @Override - public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws 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"); - } - @Override - public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { - if (arg instanceof Map) { - return getNewInstance((Map) arg, pathToItem, pathToSchemas); - } - throw new RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); - } - @Override - public FakepetiduploadimagewithrequiredfilePostPathParameters1BoxedMap validateAndBox(Map arg, SchemaConfiguration configuration) throws ValidationException { - return new FakepetiduploadimagewithrequiredfilePostPathParameters1BoxedMap(validate(arg, configuration)); - } - @Override - public FakepetiduploadimagewithrequiredfilePostPathParameters1Boxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { - 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"); - } - } - -} diff --git a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/fakepetiduploadimagewithrequiredfile/post/FakepetiduploadimagewithrequiredfilePostRequestBody.kt b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/fakepetiduploadimagewithrequiredfile/post/FakepetiduploadimagewithrequiredfilePostRequestBody.kt deleted file mode 100644 index 00e2cb435f1..00000000000 --- a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/fakepetiduploadimagewithrequiredfile/post/FakepetiduploadimagewithrequiredfilePostRequestBody.kt +++ /dev/null @@ -1,49 +0,0 @@ -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; -import org.openapijsonschematools.client.mediatype.MediaType; -import org.openapijsonschematools.client.paths.fakepetiduploadimagewithrequiredfile.post.requestbody.content.multipartformdata.MultipartformdataSchema; - -import java.util.AbstractMap; -import java.util.Map; - -public class FakepetiduploadimagewithrequiredfilePostRequestBody { - public sealed interface SealedMediaType permits MultipartformdataMediaType {} - - public record MultipartformdataMediaType(MultipartformdataSchema.MultipartformdataSchema1 schema) implements SealedMediaType, MediaType { - public MultipartformdataMediaType() { - this(MultipartformdataSchema.MultipartformdataSchema1.getInstance()); - } - @Override - public Nothing? encoding() { - return null; - } - } - - public static class FakepetiduploadimagewithrequiredfilePostRequestBody1 extends RequestBodySerializer { - public FakepetiduploadimagewithrequiredfilePostRequestBody1() { - super( - Map.ofEntries( - new AbstractMap.SimpleEntry<>("multipart/form-data", new MultipartformdataMediaType()) - ), - false - ); - } - - public SerializedRequestBody serialize(SealedRequestBody requestBody) throws NotImplementedException { - MultipartformdataRequestBody requestBody0 = (MultipartformdataRequestBody) requestBody; - return serialize(requestBody0.contentType(), requestBody0.body().getData()); - } - } - - public sealed interface SealedRequestBody permits MultipartformdataRequestBody {} - public record MultipartformdataRequestBody(MultipartformdataSchema.MultipartformdataSchema1Boxed body) implements SealedRequestBody, GenericRequestBody { - @Override - public String contentType() { - return "multipart/form-data"; - } - } -} diff --git a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/fakepetiduploadimagewithrequiredfile/post/FakepetiduploadimagewithrequiredfilePostResponses.kt b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/fakepetiduploadimagewithrequiredfile/post/FakepetiduploadimagewithrequiredfilePostResponses.kt deleted file mode 100644 index 07044539763..00000000000 --- a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/fakepetiduploadimagewithrequiredfile/post/FakepetiduploadimagewithrequiredfilePostResponses.kt +++ /dev/null @@ -1,53 +0,0 @@ -package org.openapijsonschematools.client.paths.fakepetiduploadimagewithrequiredfile.post; - -import org.openapijsonschematools.client.paths.fakepetiduploadimagewithrequiredfile.post.responses.FakepetiduploadimagewithrequiredfilePostCode200Response; -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; -import org.checkerframework.checker.nullness.qual.Nullable; - -import java.net.http.HttpResponse; -import java.util.Map; -import java.util.AbstractMap; - -public class FakepetiduploadimagewithrequiredfilePostResponses { - public sealed interface EndpointResponse permits EndpointFakepetiduploadimagewithrequiredfilePostCode200Response {} - - public record EndpointFakepetiduploadimagewithrequiredfilePostCode200Response( - HttpResponse response, - FakepetiduploadimagewithrequiredfilePostCode200Response.SealedResponseBody body, - Nothing? headers - ) implements EndpointResponse, ApiResponse{ - } - - public sealed interface StatusCodeResponseDeserializer permits StatusFakepetiduploadimagewithrequiredfilePostCode200ResponseDeserializer {} - - public static final class StatusFakepetiduploadimagewithrequiredfilePostCode200ResponseDeserializer extends FakepetiduploadimagewithrequiredfilePostCode200Response.FakepetiduploadimagewithrequiredfilePostCode200Response1 implements StatusCodeResponseDeserializer { - } - - public static final class FakepetiduploadimagewithrequiredfilePostResponses1 implements ResponsesDeserializer { - private final Map statusCodeToResponseDeserializer; - public FakepetiduploadimagewithrequiredfilePostResponses1() { - this.statusCodeToResponseDeserializer = Map.ofEntries( - new AbstractMap.SimpleEntry<>("200", new StatusFakepetiduploadimagewithrequiredfilePostCode200ResponseDeserializer()) - ); - } - - 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) { - throw new ApiException( - "Invalid response statusCode="+statusCode+" has no response defined in the openapi document", - response - ); - } - StatusFakepetiduploadimagewithrequiredfilePostCode200ResponseDeserializer castDeserializer = (StatusFakepetiduploadimagewithrequiredfilePostCode200ResponseDeserializer) statusCodeDeserializer; - var deserializedResponse = castDeserializer.deserialize(response, configuration); - return new EndpointFakepetiduploadimagewithrequiredfilePostCode200Response(response, deserializedResponse.body(), deserializedResponse.headers()); - } - } -} diff --git a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/fakepetiduploadimagewithrequiredfile/post/FakepetiduploadimagewithrequiredfilePostSecurityInfo.kt b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/fakepetiduploadimagewithrequiredfile/post/FakepetiduploadimagewithrequiredfilePostSecurityInfo.kt deleted file mode 100644 index 8dab76a488c..00000000000 --- a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/fakepetiduploadimagewithrequiredfile/post/FakepetiduploadimagewithrequiredfilePostSecurityInfo.kt +++ /dev/null @@ -1,24 +0,0 @@ -package org.openapijsonschematools.client.paths.fakepetiduploadimagewithrequiredfile.post; - -import org.openapijsonschematools.client.paths.fakepetiduploadimagewithrequiredfile.post.security.FakepetiduploadimagewithrequiredfilePostSecurityRequirementObject0; -import org.openapijsonschematools.client.securityrequirementobjects.SecurityRequirementObject; -import org.openapijsonschematools.client.securityrequirementobjects.SecurityRequirementObjectProvider; - -public class FakepetiduploadimagewithrequiredfilePostSecurityInfo { - public static class FakepetiduploadimagewithrequiredfilePostSecurityInfo1 implements SecurityRequirementObjectProvider { - public final FakepetiduploadimagewithrequiredfilePostSecurityRequirementObject0 security0; - - public FakepetiduploadimagewithrequiredfilePostSecurityInfo1() { - security0 = new FakepetiduploadimagewithrequiredfilePostSecurityRequirementObject0(); - } - - @Override - public SecurityRequirementObject getSecurityRequirementObject(SecurityIndex securityIndex) { - return security0; - } - } - - public enum SecurityIndex { - SECURITY_0 - } -} \ No newline at end of file diff --git a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/fakepetiduploadimagewithrequiredfile/post/Parameters.kt b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/fakepetiduploadimagewithrequiredfile/post/Parameters.kt deleted file mode 100644 index 69a6d736bc6..00000000000 --- a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/fakepetiduploadimagewithrequiredfile/post/Parameters.kt +++ /dev/null @@ -1,20 +0,0 @@ -package org.openapijsonschematools.client.paths.fakepetiduploadimagewithrequiredfile.post; - -import org.openapijsonschematools.client.paths.fakepetiduploadimagewithrequiredfile.post.parameters.Parameter0; -import org.openapijsonschematools.client.parameter.PathSerializer; - -import java.util.Map; -import java.util.AbstractMap; - -public class Parameters { - - public static class PathParametersSerializer extends PathSerializer { - public PathParametersSerializer() { - super( - Map.ofEntries( - new AbstractMap.SimpleEntry<>("petId", new Parameter0.Parameter01()) - ) - ); - } - } -} diff --git a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/fakepetiduploadimagewithrequiredfile/post/parameters/Parameter0.kt b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/fakepetiduploadimagewithrequiredfile/post/parameters/Parameter0.kt deleted file mode 100644 index 58b60c686b2..00000000000 --- a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/fakepetiduploadimagewithrequiredfile/post/parameters/Parameter0.kt +++ /dev/null @@ -1,23 +0,0 @@ -package org.openapijsonschematools.client.paths.fakepetiduploadimagewithrequiredfile.post.parameters; - -import org.openapijsonschematools.client.parameter.ParameterStyle; -import org.openapijsonschematools.client.parameter.ParameterInType; -import org.openapijsonschematools.client.parameter.SchemaParameter; -import org.openapijsonschematools.client.paths.fakepetiduploadimagewithrequiredfile.post.parameters.parameter0.Schema0; - -public class Parameter0 { - - public static class Parameter01 extends SchemaParameter { - public Parameter01() { - super( - "petId", - ParameterInType.PATH, - true, - ParameterStyle.SIMPLE, - false, - false, - Schema0.Schema01.getInstance() - ); - } - } -} diff --git a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/fakepetiduploadimagewithrequiredfile/post/parameters/parameter0/Schema0.kt b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/fakepetiduploadimagewithrequiredfile/post/parameters/parameter0/Schema0.kt deleted file mode 100644 index 2c458c3ee9c..00000000000 --- a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/fakepetiduploadimagewithrequiredfile/post/parameters/parameter0/Schema0.kt +++ /dev/null @@ -1,19 +0,0 @@ -package org.openapijsonschematools.client.paths.fakepetiduploadimagewithrequiredfile.post.parameters.parameter0; -import org.checkerframework.checker.nullness.qual.Nullable; -import org.openapijsonschematools.client.schemas.Int64JsonSchema; - -public class Schema0 extends Int64JsonSchema { - // nest classes so all schemas and input/output classes can be public - - - public static class Schema01 extends Int64JsonSchema.Int64JsonSchema1 { - private static @Nullable Schema01 instance = null; - public static Schema01 getInstance() { - if (instance == null) { - instance = new Schema01(); - } - return instance; - } - } - -} diff --git a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/fakepetiduploadimagewithrequiredfile/post/requestbody/content/multipartformdata/MultipartformdataSchema.kt b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/fakepetiduploadimagewithrequiredfile/post/requestbody/content/multipartformdata/MultipartformdataSchema.kt deleted file mode 100644 index 9336cb1b219..00000000000 --- a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/fakepetiduploadimagewithrequiredfile/post/requestbody/content/multipartformdata/MultipartformdataSchema.kt +++ /dev/null @@ -1,251 +0,0 @@ -package org.openapijsonschematools.client.paths.fakepetiduploadimagewithrequiredfile.post.requestbody.content.multipartformdata; -import java.util.ArrayList; -import java.util.HashSet; -import java.util.LinkedHashMap; -import java.util.LinkedHashSet; -import java.util.List; -import java.util.Map; -import java.util.Objects; -import java.util.Set; -import org.checkerframework.checker.nullness.qual.Nullable; -import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags; -import org.openapijsonschematools.client.configurations.SchemaConfiguration; -import org.openapijsonschematools.client.exceptions.InvalidAdditionalPropertyException; -import org.openapijsonschematools.client.exceptions.UnsetPropertyException; -import org.openapijsonschematools.client.exceptions.ValidationException; -import org.openapijsonschematools.client.schemas.GenericBuilder; -import org.openapijsonschematools.client.schemas.StringJsonSchema; -import org.openapijsonschematools.client.schemas.UnsetAddPropsSetter; -import org.openapijsonschematools.client.schemas.validation.FrozenMap; -import org.openapijsonschematools.client.schemas.validation.JsonSchema; -import org.openapijsonschematools.client.schemas.validation.JsonSchemaInfo; -import org.openapijsonschematools.client.schemas.validation.MapSchemaValidator; -import org.openapijsonschematools.client.schemas.validation.PathToSchemasMap; -import org.openapijsonschematools.client.schemas.validation.PropertyEntry; -import org.openapijsonschematools.client.schemas.validation.ValidationMetadata; - -public class MultipartformdataSchema { - // nest classes so all schemas and input/output classes can be public - - - public static class MultipartformdataAdditionalMetadata extends StringJsonSchema.StringJsonSchema1 { - private static @Nullable MultipartformdataAdditionalMetadata instance = null; - public static MultipartformdataAdditionalMetadata getInstance() { - if (instance == null) { - instance = new MultipartformdataAdditionalMetadata(); - } - return instance; - } - } - - - public static class MultipartformdataRequiredFile extends StringJsonSchema.StringJsonSchema1 { - // BinarySchema - private static @Nullable MultipartformdataRequiredFile instance = null; - public static MultipartformdataRequiredFile getInstance() { - if (instance == null) { - instance = new MultipartformdataRequiredFile(); - } - return instance; - } - } - - - public static class MultipartformdataSchemaMap extends FrozenMap<@Nullable Object> { - protected MultipartformdataSchemaMap(FrozenMap<@Nullable Object> m) { - super(m); - } - public static final Set requiredKeys = Set.of( - "requiredFile" - ); - public static final Set optionalKeys = Set.of( - "additionalMetadata" - ); - public static MultipartformdataSchemaMap of(Map arg, SchemaConfiguration configuration) throws ValidationException { - return MultipartformdataSchema1.getInstance().validate(arg, configuration); - } - - public String requiredFile() { - @Nullable Object value = get("requiredFile"); - if (!(value instanceof String)) { - throw new RuntimeException("Invalid value stored for requiredFile"); - } - return (String) value; - } - - public String additionalMetadata() throws UnsetPropertyException { - String key = "additionalMetadata"; - throwIfKeyNotPresent(key); - @Nullable Object value = get(key); - if (!(value instanceof String)) { - throw new RuntimeException("Invalid value stored for additionalMetadata"); - } - return (String) value; - } - - public @Nullable Object getAdditionalProperty(String name) throws UnsetPropertyException, InvalidAdditionalPropertyException { - throwIfKeyKnown(name, requiredKeys, optionalKeys); - throwIfKeyNotPresent(name); - return get(name); - } - } - - public interface SetterForMultipartformdataRequiredFile { - Map getInstance(); - T getBuilderAfterMultipartformdataRequiredFile(Map instance); - - default T requiredFile(String value) { - var instance = getInstance(); - instance.put("requiredFile", value); - return getBuilderAfterMultipartformdataRequiredFile(instance); - } - } - - public interface SetterForMultipartformdataAdditionalMetadata { - Map getInstance(); - T getBuilderAfterMultipartformdataAdditionalMetadata(Map instance); - - default T additionalMetadata(String value) { - var instance = getInstance(); - instance.put("additionalMetadata", value); - return getBuilderAfterMultipartformdataAdditionalMetadata(instance); - } - } - - public static class MultipartformdataSchemaMap0Builder extends UnsetAddPropsSetter implements GenericBuilder>, SetterForMultipartformdataAdditionalMetadata { - private final Map instance; - private static final Set knownKeys = Set.of( - "requiredFile", - "additionalMetadata" - ); - public Set getKnownKeys() { - return knownKeys; - } - public MultipartformdataSchemaMap0Builder(Map instance) { - this.instance = instance; - } - public Map build() { - return instance; - } - public Map getInstance() { - return instance; - } - public MultipartformdataSchemaMap0Builder getBuilderAfterMultipartformdataAdditionalMetadata(Map instance) { - return this; - } - public MultipartformdataSchemaMap0Builder getBuilderAfterAdditionalProperty(Map instance) { - return this; - } - } - - public static class MultipartformdataSchemaMapBuilder implements SetterForMultipartformdataRequiredFile { - private final Map instance; - public MultipartformdataSchemaMapBuilder() { - this.instance = new LinkedHashMap<>(); - } - public Map getInstance() { - return instance; - } - public MultipartformdataSchemaMap0Builder getBuilderAfterMultipartformdataRequiredFile(Map instance) { - return new MultipartformdataSchemaMap0Builder(instance); - } - } - - - public sealed interface MultipartformdataSchema1Boxed permits MultipartformdataSchema1BoxedMap { - @Nullable Object getData(); - } - - public record MultipartformdataSchema1BoxedMap(MultipartformdataSchemaMap data) implements MultipartformdataSchema1Boxed { - @Override - public @Nullable Object getData() { - return data; - } - } - - - public static class MultipartformdataSchema1 extends JsonSchema implements MapSchemaValidator { - private static @Nullable MultipartformdataSchema1 instance = null; - - protected MultipartformdataSchema1() { - super(new JsonSchemaInfo() - .type(Set.of(Map.class)) - .properties(Map.ofEntries( - new PropertyEntry("additionalMetadata", MultipartformdataAdditionalMetadata.class), - new PropertyEntry("requiredFile", MultipartformdataRequiredFile.class) - )) - .required(Set.of( - "requiredFile" - )) - ); - } - - public static MultipartformdataSchema1 getInstance() { - if (instance == null) { - instance = new MultipartformdataSchema1(); - } - return instance; - } - - 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 RuntimeException("Invalid non-string key value"); - } - String propertyName = (String) entryKey; - List propertyPathToItem = new ArrayList<>(pathToItem); - propertyPathToItem.add(propertyName); - Object value = entry.getValue(); - LinkedHashMap, Nothing?> schemas = pathToSchemas.get(propertyPathToItem); - if (schemas == null) { - throw new RuntimeException("Validation result is invalid, schemas must exist for a pathToItem"); - } - JsonSchema propertySchema = schemas.entrySet().iterator().next().getKey(); - @Nullable Object propertyInstance = propertySchema.getNewInstance(value, propertyPathToItem, pathToSchemas); - properties.put(propertyName, propertyInstance); - } - FrozenMap<@Nullable Object> castProperties = new FrozenMap<>(properties); - return new MultipartformdataSchemaMap(castProperties); - } - - 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); - SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().build())); - ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, new PathToSchemasMap(), new LinkedHashSet<>()); - PathToSchemasMap pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet); - return getNewInstance(castArg, validationMetadata.pathToItem(), pathToSchemasMap); - } - - - @Override - public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws 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"); - } - @Override - public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { - if (arg instanceof Map) { - return getNewInstance((Map) arg, pathToItem, pathToSchemas); - } - 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 { - return new MultipartformdataSchema1BoxedMap(validate(arg, configuration)); - } - @Override - public MultipartformdataSchema1Boxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { - 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"); - } - } - -} diff --git a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/fakepetiduploadimagewithrequiredfile/post/responses/FakepetiduploadimagewithrequiredfilePostCode200Response.kt b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/fakepetiduploadimagewithrequiredfile/post/responses/FakepetiduploadimagewithrequiredfilePostCode200Response.kt deleted file mode 100644 index daa415e6ac3..00000000000 --- a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/fakepetiduploadimagewithrequiredfile/post/responses/FakepetiduploadimagewithrequiredfilePostCode200Response.kt +++ /dev/null @@ -1,63 +0,0 @@ -package org.openapijsonschematools.client.paths.fakepetiduploadimagewithrequiredfile.post.responses; - -import org.openapijsonschematools.client.configurations.SchemaConfiguration; -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; - -import java.util.AbstractMap; -import java.util.Map; -import java.net.http.HttpResponse; -import java.net.http.HttpHeaders; - -public class FakepetiduploadimagewithrequiredfilePostCode200Response { - public sealed interface SealedMediaType permits ApplicationjsonMediaType {} - - public record ApplicationjsonMediaType(ApplicationjsonSchema.ApplicationjsonSchema1 schema) implements SealedMediaType, MediaType { - public ApplicationjsonMediaType() { - this(ApplicationjsonSchema.ApplicationjsonSchema1.getInstance()); - } - @Override - public Nothing? encoding() { - return null; - } - } - public sealed interface SealedResponseBody permits ApplicationjsonResponseBody {} - public record ApplicationjsonResponseBody(ApplicationjsonSchema.ApiResponseSchema1Boxed body) implements SealedResponseBody { } - - public static class FakepetiduploadimagewithrequiredfilePostCode200Response1 extends ResponseDeserializer { - public FakepetiduploadimagewithrequiredfilePostCode200Response1() { - super( - Map.ofEntries( - new AbstractMap.SimpleEntry<>("application/json", new ApplicationjsonMediaType()) - ) - ); - } - - @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); - } - - @Override - protected Nothing? getHeaders(HttpHeaders headers, SchemaConfiguration configuration) { - return null; - } - } - - @SuppressWarnings("serial") - public static class ResponseApiException extends ApiException { - public DeserializedHttpResponse deserializedResponse; - - public ResponseApiException(String s, HttpResponse response, DeserializedHttpResponse deserializedResponse) { - super(s, response); - this.deserializedResponse = deserializedResponse; - } - } -} diff --git a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/fakepetiduploadimagewithrequiredfile/post/responses/code200response/content/applicationjson/ApplicationjsonSchema.kt b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/fakepetiduploadimagewithrequiredfile/post/responses/code200response/content/applicationjson/ApplicationjsonSchema.kt deleted file mode 100644 index 42e57377e16..00000000000 --- a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/fakepetiduploadimagewithrequiredfile/post/responses/code200response/content/applicationjson/ApplicationjsonSchema.kt +++ /dev/null @@ -1,19 +0,0 @@ -package org.openapijsonschematools.client.paths.fakepetiduploadimagewithrequiredfile.post.responses.code200response.content.applicationjson; - -import org.checkerframework.checker.nullness.qual.Nullable; -import org.openapijsonschematools.client.components.schemas.ApiResponseSchema; - -public class ApplicationjsonSchema extends ApiResponseSchema { - // $refed class - - - public static class ApplicationjsonSchema1 extends ApiResponseSchema1 { - private static @Nullable ApplicationjsonSchema1 instance = null; - public static ApplicationjsonSchema1 getInstance() { - if (instance == null) { - instance = new ApplicationjsonSchema1(); - } - return instance; - } - } -} diff --git a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/fakepetiduploadimagewithrequiredfile/post/security/FakepetiduploadimagewithrequiredfilePostSecurityRequirementObject0.kt b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/fakepetiduploadimagewithrequiredfile/post/security/FakepetiduploadimagewithrequiredfilePostSecurityRequirementObject0.kt deleted file mode 100644 index d1c684c5779..00000000000 --- a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/fakepetiduploadimagewithrequiredfile/post/security/FakepetiduploadimagewithrequiredfilePostSecurityRequirementObject0.kt +++ /dev/null @@ -1,24 +0,0 @@ -package org.openapijsonschematools.client.paths.fakepetiduploadimagewithrequiredfile.post.security; - -import org.checkerframework.checker.nullness.qual.Nullable; -import org.openapijsonschematools.client.securityrequirementobjects.SecurityRequirementObject; -import org.openapijsonschematools.client.securityschemes.SecurityScheme; -import org.openapijsonschematools.client.components.securityschemes.PetstoreAuth; - -import java.util.List; -import java.util.Map; -import java.util.AbstractMap; - -public class FakepetiduploadimagewithrequiredfilePostSecurityRequirementObject0 extends SecurityRequirementObject { - - public FakepetiduploadimagewithrequiredfilePostSecurityRequirementObject0() { - super( - Map.ofEntries( - new AbstractMap.SimpleEntry, List>( - PetstoreAuth.class, - List.of("write:pets", "read:pets") - ) - ) - ); - } -} diff --git a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/fakequeryparamwithjsoncontenttype/FakequeryparamwithjsoncontenttypeGet.kt b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/fakequeryparamwithjsoncontenttype/FakequeryparamwithjsoncontenttypeGet.kt deleted file mode 100644 index 29c289ffc4c..00000000000 --- a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/fakequeryparamwithjsoncontenttype/FakequeryparamwithjsoncontenttypeGet.kt +++ /dev/null @@ -1,180 +0,0 @@ -package org.openapijsonschematools.client.paths.fakequeryparamwithjsoncontenttype; - -import org.checkerframework.checker.nullness.qual.Nullable; -import org.openapijsonschematools.client.RootServerInfo; -import org.openapijsonschematools.client.paths.fakequeryparamwithjsoncontenttype.get.FakequeryparamwithjsoncontenttypeGetQueryParameters; -import org.openapijsonschematools.client.paths.fakequeryparamwithjsoncontenttype.get.Parameters; -import org.openapijsonschematools.client.paths.fakequeryparamwithjsoncontenttype.get.FakequeryparamwithjsoncontenttypeGetResponses; -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.paths.Fakequeryparamwithjsoncontenttype; - -import java.io.IOException; -import java.net.http.HttpClient; -import java.net.http.HttpRequest; -import java.time.Duration; -import java.util.List; -import java.util.Map; - -public class FakequeryparamwithjsoncontenttypeGet { - private static class GetProvider { - private static final String method = "get"; - - public static FakequeryparamwithjsoncontenttypeGetResponses.EndpointResponse get( - GetRequest request, - ApiConfiguration apiConfiguration, - SchemaConfiguration schemaConfiguration, - HttpClient client - ) throws IOException, InterruptedException, ValidationException, NotImplementedException, ApiException { - Map> headers = apiConfiguration.getDefaultHeaders(); - HttpRequest.BodyPublisher bodyPublisher = HttpRequest.BodyPublishers.noBody(); - - var querySerializer = new Parameters.QueryParametersSerializer(); - @Nullable Map queryMap = querySerializer.getQueryMap(request.queryParameters); - String host = apiConfiguration.getServer(request.serverIndex).url(); - - String url = host + Fakequeryparamwithjsoncontenttype.path; - if (queryMap != null) { - url = url + querySerializer.serialize(queryMap); - } - var httpRequest = RestClient.getRequest( - url, - method, - bodyPublisher, - headers, - request.timeout - ); - var response = RestClient.getResponse(httpRequest, client); - var responsesDeserializer = new FakequeryparamwithjsoncontenttypeGetResponses.FakequeryparamwithjsoncontenttypeGetResponses1(); - return responsesDeserializer.deserialize(response, schemaConfiguration); - } - } - - public interface GetOperation { - ApiConfiguration getApiConfiguration(); - SchemaConfiguration getSchemaConfiguration(); - HttpClient getClient(); - default FakequeryparamwithjsoncontenttypeGetResponses.EndpointResponse get(GetRequest request) throws IOException, InterruptedException, ValidationException, NotImplementedException, ApiException { - return GetProvider.get(request, getApiConfiguration(), getSchemaConfiguration(), getClient()); - } - } - - public interface QueryParamWithJsonContentTypeOperation { - ApiConfiguration getApiConfiguration(); - SchemaConfiguration getSchemaConfiguration(); - HttpClient getClient(); - default FakequeryparamwithjsoncontenttypeGetResponses.EndpointResponse queryParamWithJsonContentType(GetRequest request) throws IOException, InterruptedException, ValidationException, NotImplementedException, ApiException { - return GetProvider.get(request, getApiConfiguration(), getSchemaConfiguration(), getClient()); - } - } - - public static class Get extends ApiClient implements GetOperation { - public Get(ApiConfiguration apiConfiguration, SchemaConfiguration schemaConfiguration) { - super(apiConfiguration, schemaConfiguration); - } - } - - public static class GetRequest { - public FakequeryparamwithjsoncontenttypeGetQueryParameters.QueryParametersMap queryParameters; - public RootServerInfo.@Nullable ServerIndex serverIndex; - public @Nullable Duration timeout; - - public GetRequest( - FakequeryparamwithjsoncontenttypeGetQueryParameters.QueryParametersMap queryParameters, - RootServerInfo.@Nullable ServerIndex serverIndex, - @Nullable Duration timeout - ) { - this.queryParameters = queryParameters; - this.serverIndex = serverIndex; - this.timeout = timeout; - } - } - - public static class GetNullableRequest { - public FakequeryparamwithjsoncontenttypeGetQueryParameters.@Nullable QueryParametersMap queryParameters; - public RootServerInfo.@Nullable ServerIndex serverIndex; - public @Nullable Duration timeout; - } - - public interface SetterForServerIndex { - GetNullableRequest getInstance(); - T getBuilderAfterServerIndex(GetNullableRequest instance); - default T serverIndex(RootServerInfo.ServerIndex serverIndex) { - var instance = getInstance(); - instance.serverIndex = serverIndex; - return getBuilderAfterServerIndex(instance); - } - } - - public interface SetterForTimeout { - GetNullableRequest getInstance(); - T getBuilderAfterTimeout(GetNullableRequest instance); - default T timeout(Duration timeout) { - var instance = getInstance(); - instance.timeout = timeout; - return getBuilderAfterTimeout(instance); - } - } - - public interface SetterForQueryParameters { - GetNullableRequest getInstance(); - T getBuilderAfterQueryParameters(GetNullableRequest instance); - default T queryParameters(FakequeryparamwithjsoncontenttypeGetQueryParameters.QueryParametersMap queryParameters) { - var instance = getInstance(); - instance.queryParameters = queryParameters; - return getBuilderAfterQueryParameters(instance); - } - } - - public static class Get0RequestBuilder implements SetterForServerIndex, SetterForTimeout { - private final GetNullableRequest instance; - - public Get0RequestBuilder(GetNullableRequest instance) { - this.instance = instance; - } - - public GetRequest build() { - var queryParameters = instance.queryParameters; - if (queryParameters == null) { - throw new RuntimeException("invalid null value for required parameter"); - } - return new GetRequest( - queryParameters, - instance.serverIndex, - instance.timeout - ); - } - - public GetNullableRequest getInstance() { - return instance; - } - - public Get0RequestBuilder getBuilderAfterServerIndex(GetNullableRequest instance) { - return this; - } - - public Get0RequestBuilder getBuilderAfterTimeout(GetNullableRequest instance) { - return this; - } - } - public static class GetRequestBuilder implements SetterForQueryParameters { - private final GetNullableRequest instance; - - public GetRequestBuilder() { - this.instance = new GetNullableRequest(); - } - - public GetNullableRequest getInstance() { - return instance; - } - - public Get0RequestBuilder getBuilderAfterQueryParameters(GetNullableRequest instance) { - return new Get0RequestBuilder(instance); - } - } -} diff --git a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/fakequeryparamwithjsoncontenttype/get/FakequeryparamwithjsoncontenttypeGetQueryParameters.kt b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/fakequeryparamwithjsoncontenttype/get/FakequeryparamwithjsoncontenttypeGetQueryParameters.kt deleted file mode 100644 index b1f809396c2..00000000000 --- a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/fakequeryparamwithjsoncontenttype/get/FakequeryparamwithjsoncontenttypeGetQueryParameters.kt +++ /dev/null @@ -1,253 +0,0 @@ -package org.openapijsonschematools.client.paths.fakequeryparamwithjsoncontenttype.get; -import java.util.ArrayList; -import java.util.HashSet; -import java.util.LinkedHashMap; -import java.util.LinkedHashSet; -import java.util.List; -import java.util.Map; -import java.util.Objects; -import java.util.Set; -import org.checkerframework.checker.nullness.qual.Nullable; -import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags; -import org.openapijsonschematools.client.configurations.SchemaConfiguration; -import org.openapijsonschematools.client.exceptions.UnsetPropertyException; -import org.openapijsonschematools.client.exceptions.ValidationException; -import org.openapijsonschematools.client.paths.fakequeryparamwithjsoncontenttype.get.parameters.parameter0.content.applicationjson.Schema0; -import org.openapijsonschematools.client.schemas.AnyTypeJsonSchema; -import org.openapijsonschematools.client.schemas.GenericBuilder; -import org.openapijsonschematools.client.schemas.NotAnyTypeJsonSchema; -import org.openapijsonschematools.client.schemas.validation.FrozenMap; -import org.openapijsonschematools.client.schemas.validation.JsonSchema; -import org.openapijsonschematools.client.schemas.validation.JsonSchemaInfo; -import org.openapijsonschematools.client.schemas.validation.MapSchemaValidator; -import org.openapijsonschematools.client.schemas.validation.MapUtils; -import org.openapijsonschematools.client.schemas.validation.PathToSchemasMap; -import org.openapijsonschematools.client.schemas.validation.PropertyEntry; -import org.openapijsonschematools.client.schemas.validation.ValidationMetadata; - -public class FakequeryparamwithjsoncontenttypeGetQueryParameters { - // nest classes so all schemas and input/output classes can be public - - - public static class AdditionalProperties extends NotAnyTypeJsonSchema.NotAnyTypeJsonSchema1 { - // NotAnyTypeSchema - private static @Nullable AdditionalProperties instance = null; - public static AdditionalProperties getInstance() { - if (instance == null) { - instance = new AdditionalProperties(); - } - return instance; - } - } - - - public static class QueryParametersMap extends FrozenMap<@Nullable Object> { - protected QueryParametersMap(FrozenMap<@Nullable Object> m) { - super(m); - } - public static final Set requiredKeys = Set.of( - "someParam" - ); - public static final Set optionalKeys = Set.of(); - public static QueryParametersMap of(Map arg, SchemaConfiguration configuration) throws ValidationException { - return FakequeryparamwithjsoncontenttypeGetQueryParameters1.getInstance().validate(arg, configuration); - } - - public @Nullable Object someParam() { - try { - return getOrThrow("version"); - } catch (UnsetPropertyException e) { - throw new RuntimeException(e); - } - } - } - - public interface SetterForSomeParam { - Map getInstance(); - T getBuilderAfterSomeParam(Map instance); - - default T someParam(Nothing? value) { - var instance = getInstance(); - instance.put("someParam", null); - return getBuilderAfterSomeParam(instance); - } - - default T someParam(boolean value) { - var instance = getInstance(); - instance.put("someParam", value); - return getBuilderAfterSomeParam(instance); - } - - default T someParam(String value) { - var instance = getInstance(); - instance.put("someParam", value); - return getBuilderAfterSomeParam(instance); - } - - default T someParam(int value) { - var instance = getInstance(); - instance.put("someParam", value); - return getBuilderAfterSomeParam(instance); - } - - default T someParam(float value) { - var instance = getInstance(); - instance.put("someParam", value); - return getBuilderAfterSomeParam(instance); - } - - default T someParam(long value) { - var instance = getInstance(); - instance.put("someParam", value); - return getBuilderAfterSomeParam(instance); - } - - default T someParam(double value) { - var instance = getInstance(); - instance.put("someParam", value); - return getBuilderAfterSomeParam(instance); - } - - default T someParam(List value) { - var instance = getInstance(); - instance.put("someParam", value); - return getBuilderAfterSomeParam(instance); - } - - default T someParam(Map value) { - var instance = getInstance(); - instance.put("someParam", value); - return getBuilderAfterSomeParam(instance); - } - } - - public static class QueryParametersMap0Builder implements GenericBuilder> { - private final Map instance; - private static final Set knownKeys = Set.of( - "someParam" - ); - public Set getKnownKeys() { - return knownKeys; - } - public QueryParametersMap0Builder(Map instance) { - this.instance = instance; - } - public Map build() { - return instance; - } - } - - public static class QueryParametersMapBuilder implements SetterForSomeParam { - private final Map instance; - public QueryParametersMapBuilder() { - this.instance = new LinkedHashMap<>(); - } - public Map getInstance() { - return instance; - } - public QueryParametersMap0Builder getBuilderAfterSomeParam(Map instance) { - return new QueryParametersMap0Builder(instance); - } - } - - - public sealed interface FakequeryparamwithjsoncontenttypeGetQueryParameters1Boxed permits FakequeryparamwithjsoncontenttypeGetQueryParameters1BoxedMap { - @Nullable Object getData(); - } - - public record FakequeryparamwithjsoncontenttypeGetQueryParameters1BoxedMap(QueryParametersMap data) implements FakequeryparamwithjsoncontenttypeGetQueryParameters1Boxed { - @Override - public @Nullable Object getData() { - return data; - } - } - - - public static class FakequeryparamwithjsoncontenttypeGetQueryParameters1 extends JsonSchema implements MapSchemaValidator { - private static @Nullable FakequeryparamwithjsoncontenttypeGetQueryParameters1 instance = null; - - protected FakequeryparamwithjsoncontenttypeGetQueryParameters1() { - super(new JsonSchemaInfo() - .type(Set.of(Map.class)) - .properties(Map.ofEntries( - new PropertyEntry("someParam", Schema0.Schema01.class) - )) - .required(Set.of( - "someParam" - )) - .additionalProperties(AdditionalProperties.class) - ); - } - - public static FakequeryparamwithjsoncontenttypeGetQueryParameters1 getInstance() { - if (instance == null) { - instance = new FakequeryparamwithjsoncontenttypeGetQueryParameters1(); - } - return instance; - } - - 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 RuntimeException("Invalid non-string key value"); - } - String propertyName = (String) entryKey; - List propertyPathToItem = new ArrayList<>(pathToItem); - propertyPathToItem.add(propertyName); - Object value = entry.getValue(); - LinkedHashMap, Nothing?> schemas = pathToSchemas.get(propertyPathToItem); - if (schemas == null) { - throw new RuntimeException("Validation 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"); - } - properties.put(propertyName, (@Nullable Object) propertyInstance); - } - FrozenMap<@Nullable Object> castProperties = new FrozenMap<>(properties); - return new QueryParametersMap(castProperties); - } - - 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); - SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().build())); - ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, new PathToSchemasMap(), new LinkedHashSet<>()); - PathToSchemasMap pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet); - return getNewInstance(castArg, validationMetadata.pathToItem(), pathToSchemasMap); - } - - - @Override - public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws 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"); - } - @Override - public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { - if (arg instanceof Map) { - return getNewInstance((Map) arg, pathToItem, pathToSchemas); - } - throw new RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); - } - @Override - public FakequeryparamwithjsoncontenttypeGetQueryParameters1BoxedMap validateAndBox(Map arg, SchemaConfiguration configuration) throws ValidationException { - return new FakequeryparamwithjsoncontenttypeGetQueryParameters1BoxedMap(validate(arg, configuration)); - } - @Override - public FakequeryparamwithjsoncontenttypeGetQueryParameters1Boxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { - 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"); - } - } - -} diff --git a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/fakequeryparamwithjsoncontenttype/get/FakequeryparamwithjsoncontenttypeGetResponses.kt b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/fakequeryparamwithjsoncontenttype/get/FakequeryparamwithjsoncontenttypeGetResponses.kt deleted file mode 100644 index 3f548a6f962..00000000000 --- a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/fakequeryparamwithjsoncontenttype/get/FakequeryparamwithjsoncontenttypeGetResponses.kt +++ /dev/null @@ -1,53 +0,0 @@ -package org.openapijsonschematools.client.paths.fakequeryparamwithjsoncontenttype.get; - -import org.openapijsonschematools.client.paths.fakequeryparamwithjsoncontenttype.get.responses.FakequeryparamwithjsoncontenttypeGetCode200Response; -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; -import org.checkerframework.checker.nullness.qual.Nullable; - -import java.net.http.HttpResponse; -import java.util.Map; -import java.util.AbstractMap; - -public class FakequeryparamwithjsoncontenttypeGetResponses { - public sealed interface EndpointResponse permits EndpointFakequeryparamwithjsoncontenttypeGetCode200Response {} - - public record EndpointFakequeryparamwithjsoncontenttypeGetCode200Response( - HttpResponse response, - FakequeryparamwithjsoncontenttypeGetCode200Response.SealedResponseBody body, - Nothing? headers - ) implements EndpointResponse, ApiResponse{ - } - - public sealed interface StatusCodeResponseDeserializer permits StatusFakequeryparamwithjsoncontenttypeGetCode200ResponseDeserializer {} - - public static final class StatusFakequeryparamwithjsoncontenttypeGetCode200ResponseDeserializer extends FakequeryparamwithjsoncontenttypeGetCode200Response.FakequeryparamwithjsoncontenttypeGetCode200Response1 implements StatusCodeResponseDeserializer { - } - - public static final class FakequeryparamwithjsoncontenttypeGetResponses1 implements ResponsesDeserializer { - private final Map statusCodeToResponseDeserializer; - public FakequeryparamwithjsoncontenttypeGetResponses1() { - this.statusCodeToResponseDeserializer = Map.ofEntries( - new AbstractMap.SimpleEntry<>("200", new StatusFakequeryparamwithjsoncontenttypeGetCode200ResponseDeserializer()) - ); - } - - 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) { - throw new ApiException( - "Invalid response statusCode="+statusCode+" has no response defined in the openapi document", - response - ); - } - StatusFakequeryparamwithjsoncontenttypeGetCode200ResponseDeserializer castDeserializer = (StatusFakequeryparamwithjsoncontenttypeGetCode200ResponseDeserializer) statusCodeDeserializer; - var deserializedResponse = castDeserializer.deserialize(response, configuration); - return new EndpointFakequeryparamwithjsoncontenttypeGetCode200Response(response, deserializedResponse.body(), deserializedResponse.headers()); - } - } -} diff --git a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/fakequeryparamwithjsoncontenttype/get/Parameters.kt b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/fakequeryparamwithjsoncontenttype/get/Parameters.kt deleted file mode 100644 index 713b9540cea..00000000000 --- a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/fakequeryparamwithjsoncontenttype/get/Parameters.kt +++ /dev/null @@ -1,20 +0,0 @@ -package org.openapijsonschematools.client.paths.fakequeryparamwithjsoncontenttype.get; - -import org.openapijsonschematools.client.paths.fakequeryparamwithjsoncontenttype.get.parameters.Parameter0; -import org.openapijsonschematools.client.parameter.QuerySerializer; - -import java.util.Map; -import java.util.AbstractMap; - -public class Parameters { - - public static class QueryParametersSerializer extends QuerySerializer { - public QueryParametersSerializer() { - super( - Map.ofEntries( - new AbstractMap.SimpleEntry<>("someParam", new Parameter0.Parameter01()) - ) - ); - } - } -} diff --git a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/fakequeryparamwithjsoncontenttype/get/parameters/Parameter0.kt b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/fakequeryparamwithjsoncontenttype/get/parameters/Parameter0.kt deleted file mode 100644 index 9dfb791abaf..00000000000 --- a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/fakequeryparamwithjsoncontenttype/get/parameters/Parameter0.kt +++ /dev/null @@ -1,35 +0,0 @@ -package org.openapijsonschematools.client.paths.fakequeryparamwithjsoncontenttype.get.parameters; - -import org.openapijsonschematools.client.parameter.ParameterInType; -import org.openapijsonschematools.client.parameter.ContentParameter; -import org.openapijsonschematools.client.mediatype.MediaType; -import org.openapijsonschematools.client.paths.fakequeryparamwithjsoncontenttype.get.parameters.parameter0.content.applicationjson.Schema0; - -import java.util.AbstractMap; - -public class Parameter0 { - - public record ApplicationjsonMediaType(Schema0.Schema01 schema) implements MediaType { - public ApplicationjsonMediaType() { - this(Schema0.Schema01.getInstance()); - } - @Override - public Nothing? encoding() { - return null; - } - } - - public static class Parameter01 extends ContentParameter { - public Parameter01() { - super( - "someParam", - ParameterInType.QUERY, - true, - null, - null, - false, - new AbstractMap.SimpleEntry<>("application/json", new ApplicationjsonMediaType()) - ); - } - } -} diff --git a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/fakequeryparamwithjsoncontenttype/get/parameters/parameter0/content/applicationjson/Schema0.kt b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/fakequeryparamwithjsoncontenttype/get/parameters/parameter0/content/applicationjson/Schema0.kt deleted file mode 100644 index 98f404bf94b..00000000000 --- a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/fakequeryparamwithjsoncontenttype/get/parameters/parameter0/content/applicationjson/Schema0.kt +++ /dev/null @@ -1,19 +0,0 @@ -package org.openapijsonschematools.client.paths.fakequeryparamwithjsoncontenttype.get.parameters.parameter0.content.applicationjson; -import org.checkerframework.checker.nullness.qual.Nullable; -import org.openapijsonschematools.client.schemas.AnyTypeJsonSchema; - -public class Schema0 extends AnyTypeJsonSchema { - // nest classes so all schemas and input/output classes can be public - - - public static class Schema01 extends AnyTypeJsonSchema.AnyTypeJsonSchema1 { - private static @Nullable Schema01 instance = null; - public static Schema01 getInstance() { - if (instance == null) { - instance = new Schema01(); - } - return instance; - } - } - -} diff --git a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/fakequeryparamwithjsoncontenttype/get/responses/FakequeryparamwithjsoncontenttypeGetCode200Response.kt b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/fakequeryparamwithjsoncontenttype/get/responses/FakequeryparamwithjsoncontenttypeGetCode200Response.kt deleted file mode 100644 index c046371efa9..00000000000 --- a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/fakequeryparamwithjsoncontenttype/get/responses/FakequeryparamwithjsoncontenttypeGetCode200Response.kt +++ /dev/null @@ -1,63 +0,0 @@ -package org.openapijsonschematools.client.paths.fakequeryparamwithjsoncontenttype.get.responses; - -import org.openapijsonschematools.client.configurations.SchemaConfiguration; -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; - -import java.util.AbstractMap; -import java.util.Map; -import java.net.http.HttpResponse; -import java.net.http.HttpHeaders; - -public class FakequeryparamwithjsoncontenttypeGetCode200Response { - public sealed interface SealedMediaType permits ApplicationjsonMediaType {} - - public record ApplicationjsonMediaType(ApplicationjsonSchema.ApplicationjsonSchema1 schema) implements SealedMediaType, MediaType { - public ApplicationjsonMediaType() { - this(ApplicationjsonSchema.ApplicationjsonSchema1.getInstance()); - } - @Override - public Nothing? encoding() { - return null; - } - } - public sealed interface SealedResponseBody permits ApplicationjsonResponseBody {} - public record ApplicationjsonResponseBody(ApplicationjsonSchema.AnyTypeJsonSchema1Boxed body) implements SealedResponseBody { } - - public static class FakequeryparamwithjsoncontenttypeGetCode200Response1 extends ResponseDeserializer { - public FakequeryparamwithjsoncontenttypeGetCode200Response1() { - super( - Map.ofEntries( - new AbstractMap.SimpleEntry<>("application/json", new ApplicationjsonMediaType()) - ) - ); - } - - @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); - } - - @Override - protected Nothing? getHeaders(HttpHeaders headers, SchemaConfiguration configuration) { - return null; - } - } - - @SuppressWarnings("serial") - public static class ResponseApiException extends ApiException { - public DeserializedHttpResponse deserializedResponse; - - public ResponseApiException(String s, HttpResponse response, DeserializedHttpResponse deserializedResponse) { - super(s, response); - this.deserializedResponse = deserializedResponse; - } - } -} diff --git a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/fakequeryparamwithjsoncontenttype/get/responses/code200response/content/applicationjson/ApplicationjsonSchema.kt b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/fakequeryparamwithjsoncontenttype/get/responses/code200response/content/applicationjson/ApplicationjsonSchema.kt deleted file mode 100644 index b9b66780181..00000000000 --- a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/fakequeryparamwithjsoncontenttype/get/responses/code200response/content/applicationjson/ApplicationjsonSchema.kt +++ /dev/null @@ -1,19 +0,0 @@ -package org.openapijsonschematools.client.paths.fakequeryparamwithjsoncontenttype.get.responses.code200response.content.applicationjson; -import org.checkerframework.checker.nullness.qual.Nullable; -import org.openapijsonschematools.client.schemas.AnyTypeJsonSchema; - -public class ApplicationjsonSchema extends AnyTypeJsonSchema { - // nest classes so all schemas and input/output classes can be public - - - public static class ApplicationjsonSchema1 extends AnyTypeJsonSchema.AnyTypeJsonSchema1 { - private static @Nullable ApplicationjsonSchema1 instance = null; - public static ApplicationjsonSchema1 getInstance() { - if (instance == null) { - instance = new ApplicationjsonSchema1(); - } - return instance; - } - } - -} diff --git a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/fakeredirection/FakeredirectionGet.kt b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/fakeredirection/FakeredirectionGet.kt deleted file mode 100644 index f73a54d32b6..00000000000 --- a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/fakeredirection/FakeredirectionGet.kt +++ /dev/null @@ -1,124 +0,0 @@ -package org.openapijsonschematools.client.paths.fakeredirection; - -import org.checkerframework.checker.nullness.qual.Nullable; -import org.openapijsonschematools.client.RootServerInfo; -import org.openapijsonschematools.client.paths.fakeredirection.get.FakeredirectionGetResponses; -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.paths.Fakeredirection; - -import java.io.IOException; -import java.net.http.HttpClient; -import java.net.http.HttpRequest; -import java.time.Duration; -import java.util.List; -import java.util.Map; - -public class FakeredirectionGet { - private static class GetProvider { - private static final String method = "get"; - - public static FakeredirectionGetResponses.EndpointResponse get( - GetRequest request, - ApiConfiguration apiConfiguration, - SchemaConfiguration schemaConfiguration, - HttpClient client - ) 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 - @Nullable Map queryMap = null; - String host = apiConfiguration.getServer(request.serverIndex).url(); - - String url = host + Fakeredirection.path; - var httpRequest = RestClient.getRequest( - url, - method, - bodyPublisher, - headers, - request.timeout - ); - var response = RestClient.getResponse(httpRequest, client); - var responsesDeserializer = new FakeredirectionGetResponses.FakeredirectionGetResponses1(); - return responsesDeserializer.deserialize(response, schemaConfiguration); - } - } - - public interface GetOperation { - ApiConfiguration getApiConfiguration(); - SchemaConfiguration getSchemaConfiguration(); - HttpClient getClient(); - default FakeredirectionGetResponses.EndpointResponse get(GetRequest request) throws IOException, InterruptedException, ValidationException, NotImplementedException, ApiException { - return GetProvider.get(request, getApiConfiguration(), getSchemaConfiguration(), getClient()); - } - } - - public interface RedirectionOperation { - ApiConfiguration getApiConfiguration(); - SchemaConfiguration getSchemaConfiguration(); - HttpClient getClient(); - default FakeredirectionGetResponses.EndpointResponse redirection(GetRequest request) throws IOException, InterruptedException, ValidationException, NotImplementedException, ApiException { - return GetProvider.get(request, getApiConfiguration(), getSchemaConfiguration(), getClient()); - } - } - - public static class Get extends ApiClient implements GetOperation { - public Get(ApiConfiguration apiConfiguration, SchemaConfiguration schemaConfiguration) { - super(apiConfiguration, schemaConfiguration); - } - } - - public static class GetRequest { - public RootServerInfo.@Nullable ServerIndex serverIndex; - public @Nullable Duration timeout; - } - - public interface SetterForServerIndex { - GetRequest getInstance(); - T getBuilderAfterServerIndex(GetRequest instance); - default T serverIndex(RootServerInfo.ServerIndex serverIndex) { - var instance = getInstance(); - instance.serverIndex = serverIndex; - return getBuilderAfterServerIndex(instance); - } - } - - public interface SetterForTimeout { - GetRequest getInstance(); - T getBuilderAfterTimeout(GetRequest instance); - default T timeout(Duration timeout) { - var instance = getInstance(); - instance.timeout = timeout; - return getBuilderAfterTimeout(instance); - } - } - - public static class GetRequestBuilder implements SetterForServerIndex, SetterForTimeout { - private final GetRequest instance; - - public GetRequestBuilder() { - this.instance = new GetRequest(); - } - - public GetRequest build() { - return instance; - } - - public GetRequest getInstance() { - return instance; - } - - public GetRequestBuilder getBuilderAfterServerIndex(GetRequest instance) { - return this; - } - - public GetRequestBuilder getBuilderAfterTimeout(GetRequest instance) { - return this; - } - } -} diff --git a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/fakeredirection/get/FakeredirectionGetResponses.kt b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/fakeredirection/get/FakeredirectionGetResponses.kt deleted file mode 100644 index 1aa823bc3d3..00000000000 --- a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/fakeredirection/get/FakeredirectionGetResponses.kt +++ /dev/null @@ -1,79 +0,0 @@ -package org.openapijsonschematools.client.paths.fakeredirection.get; - -import org.openapijsonschematools.client.paths.fakeredirection.get.responses.FakeredirectionGetCode303Response; -import org.openapijsonschematools.client.paths.fakeredirection.get.responses.FakeredirectionGetCode3XXResponse; -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; -import org.checkerframework.checker.nullness.qual.Nullable; - -import java.net.http.HttpResponse; -import java.util.Map; -import java.util.AbstractMap; - -public class FakeredirectionGetResponses { - public sealed interface EndpointResponse permits EndpointFakeredirectionGetCode3XXResponse, EndpointFakeredirectionGetCode303Response {} - - public record EndpointFakeredirectionGetCode3XXResponse( - HttpResponse response, - Nothing? body, - Nothing? headers - ) implements EndpointResponse, ApiResponse{ - } - - public record EndpointFakeredirectionGetCode303Response( - HttpResponse response, - Nothing? body, - Nothing? headers - ) implements EndpointResponse, ApiResponse{ - } - - public sealed interface StatusCodeResponseDeserializer permits StatusFakeredirectionGetCode303ResponseDeserializer {} - - public static final class StatusFakeredirectionGetCode303ResponseDeserializer extends FakeredirectionGetCode303Response.FakeredirectionGetCode303Response1 implements StatusCodeResponseDeserializer { - } - public sealed interface WildcardCodeResponseDeserializer permits WildcardFakeredirectionGetCode3XXResponseDeserializer {} - - public static final class WildcardFakeredirectionGetCode3XXResponseDeserializer extends FakeredirectionGetCode3XXResponse.FakeredirectionGetCode3XXResponse1 implements WildcardCodeResponseDeserializer { - } - - public static final class FakeredirectionGetResponses1 implements ResponsesDeserializer { - private final Map statusCodeToResponseDeserializer; - private final Map wildcardCodeToResponseDeserializer; - public FakeredirectionGetResponses1() { - this.statusCodeToResponseDeserializer = Map.ofEntries( - new AbstractMap.SimpleEntry<>("303", new StatusFakeredirectionGetCode303ResponseDeserializer()) - ); - this.wildcardCodeToResponseDeserializer = Map.ofEntries( - new AbstractMap.SimpleEntry<>("3", new WildcardFakeredirectionGetCode3XXResponseDeserializer()) - ); - } - - 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) { - StatusFakeredirectionGetCode303ResponseDeserializer castDeserializer = (StatusFakeredirectionGetCode303ResponseDeserializer) statusCodeDeserializer; - var deserializedResponse = castDeserializer.deserialize(response, configuration); - return new EndpointFakeredirectionGetCode303Response(response, deserializedResponse.body(), deserializedResponse.headers()); - } - @Nullable WildcardCodeResponseDeserializer wildcardCodeDeserializer = wildcardCodeToResponseDeserializer.get(statusCode); - if (wildcardCodeDeserializer == null) { - throw new ApiException( - "Invalid response statusCode="+statusCode+" has no response defined in the openapi document", - response - ); - } - WildcardFakeredirectionGetCode3XXResponseDeserializer castDeserializer = (WildcardFakeredirectionGetCode3XXResponseDeserializer) wildcardCodeDeserializer; - var deserializedResponse = castDeserializer.deserialize(response, configuration); - throw new FakeredirectionGetCode3XXResponse.ResponseApiException( - "Received error statusCode response from server", - response, - deserializedResponse - ); - } - } -} diff --git a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/fakeredirection/get/responses/FakeredirectionGetCode303Response.kt b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/fakeredirection/get/responses/FakeredirectionGetCode303Response.kt deleted file mode 100644 index 21e48b31b11..00000000000 --- a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/fakeredirection/get/responses/FakeredirectionGetCode303Response.kt +++ /dev/null @@ -1,45 +0,0 @@ -package org.openapijsonschematools.client.paths.fakeredirection.get.responses; - -import org.openapijsonschematools.client.configurations.SchemaConfiguration; -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; -import java.net.http.HttpResponse; -import java.net.http.HttpHeaders; - -public class FakeredirectionGetCode303Response { - - public static class FakeredirectionGetCode303Response1 extends ResponseDeserializer { - public FakeredirectionGetCode303Response1() { - super( - MapUtils.makeMap( - ) - ); - } - - @Override - protected Nothing? getBody(String contentType, Nothing? mediaType, byte[] body, SchemaConfiguration configuration) { - return null; - } - - @Override - protected Nothing? getHeaders(HttpHeaders headers, SchemaConfiguration configuration) { - return null; - } - } - - @SuppressWarnings("serial") - public static class ResponseApiException extends ApiException { - public DeserializedHttpResponse deserializedResponse; - - public ResponseApiException(String s, HttpResponse response, DeserializedHttpResponse deserializedResponse) { - super(s, response); - this.deserializedResponse = deserializedResponse; - } - } -} diff --git a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/fakeredirection/get/responses/FakeredirectionGetCode3XXResponse.kt b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/fakeredirection/get/responses/FakeredirectionGetCode3XXResponse.kt deleted file mode 100644 index 34f0978b7d8..00000000000 --- a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/fakeredirection/get/responses/FakeredirectionGetCode3XXResponse.kt +++ /dev/null @@ -1,45 +0,0 @@ -package org.openapijsonschematools.client.paths.fakeredirection.get.responses; - -import org.openapijsonschematools.client.configurations.SchemaConfiguration; -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; -import java.net.http.HttpResponse; -import java.net.http.HttpHeaders; - -public class FakeredirectionGetCode3XXResponse { - - public static class FakeredirectionGetCode3XXResponse1 extends ResponseDeserializer { - public FakeredirectionGetCode3XXResponse1() { - super( - MapUtils.makeMap( - ) - ); - } - - @Override - protected Nothing? getBody(String contentType, Nothing? mediaType, byte[] body, SchemaConfiguration configuration) { - return null; - } - - @Override - protected Nothing? getHeaders(HttpHeaders headers, SchemaConfiguration configuration) { - return null; - } - } - - @SuppressWarnings("serial") - public static class ResponseApiException extends ApiException { - public DeserializedHttpResponse deserializedResponse; - - public ResponseApiException(String s, HttpResponse response, DeserializedHttpResponse deserializedResponse) { - super(s, response); - this.deserializedResponse = deserializedResponse; - } - } -} diff --git a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/fakerefobjinquery/FakerefobjinqueryGet.kt b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/fakerefobjinquery/FakerefobjinqueryGet.kt deleted file mode 100644 index 56e42d4d5c2..00000000000 --- a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/fakerefobjinquery/FakerefobjinqueryGet.kt +++ /dev/null @@ -1,148 +0,0 @@ -package org.openapijsonschematools.client.paths.fakerefobjinquery; - -import org.checkerframework.checker.nullness.qual.Nullable; -import org.openapijsonschematools.client.paths.fakerefobjinquery.get.FakerefobjinqueryGetQueryParameters; -import org.openapijsonschematools.client.RootServerInfo; -import org.openapijsonschematools.client.paths.fakerefobjinquery.get.Parameters; -import org.openapijsonschematools.client.paths.fakerefobjinquery.get.FakerefobjinqueryGetResponses; -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.paths.Fakerefobjinquery; - -import java.io.IOException; -import java.net.http.HttpClient; -import java.net.http.HttpRequest; -import java.time.Duration; -import java.util.List; -import java.util.Map; - -public class FakerefobjinqueryGet { - private static class GetProvider { - private static final String method = "get"; - - public static FakerefobjinqueryGetResponses.EndpointResponse get( - GetRequest request, - ApiConfiguration apiConfiguration, - SchemaConfiguration schemaConfiguration, - HttpClient client - ) throws IOException, InterruptedException, ValidationException, NotImplementedException, ApiException { - Map> headers = apiConfiguration.getDefaultHeaders(); - HttpRequest.BodyPublisher bodyPublisher = HttpRequest.BodyPublishers.noBody(); - - var querySerializer = new Parameters.QueryParametersSerializer(); - @Nullable Map queryMap = null; - if (request.queryParameters != null) { - queryMap = querySerializer.getQueryMap(request.queryParameters); - } - String host = apiConfiguration.getServer(request.serverIndex).url(); - - String url = host + Fakerefobjinquery.path; - if (queryMap != null) { - url = url + querySerializer.serialize(queryMap); - } - var httpRequest = RestClient.getRequest( - url, - method, - bodyPublisher, - headers, - request.timeout - ); - var response = RestClient.getResponse(httpRequest, client); - var responsesDeserializer = new FakerefobjinqueryGetResponses.FakerefobjinqueryGetResponses1(); - return responsesDeserializer.deserialize(response, schemaConfiguration); - } - } - - public interface GetOperation { - ApiConfiguration getApiConfiguration(); - SchemaConfiguration getSchemaConfiguration(); - HttpClient getClient(); - default FakerefobjinqueryGetResponses.EndpointResponse get(GetRequest request) throws IOException, InterruptedException, ValidationException, NotImplementedException, ApiException { - return GetProvider.get(request, getApiConfiguration(), getSchemaConfiguration(), getClient()); - } - } - - public interface RefObjectInQueryOperation { - ApiConfiguration getApiConfiguration(); - SchemaConfiguration getSchemaConfiguration(); - HttpClient getClient(); - default FakerefobjinqueryGetResponses.EndpointResponse refObjectInQuery(GetRequest request) throws IOException, InterruptedException, ValidationException, NotImplementedException, ApiException { - return GetProvider.get(request, getApiConfiguration(), getSchemaConfiguration(), getClient()); - } - } - - public static class Get extends ApiClient implements GetOperation { - public Get(ApiConfiguration apiConfiguration, SchemaConfiguration schemaConfiguration) { - super(apiConfiguration, schemaConfiguration); - } - } - - public static class GetRequest { - public FakerefobjinqueryGetQueryParameters.@Nullable QueryParametersMap queryParameters; - public RootServerInfo.@Nullable ServerIndex serverIndex; - public @Nullable Duration timeout; - } - - public interface SetterForQueryParameters { - GetRequest getInstance(); - T getBuilderAfterQueryParameters(GetRequest instance); - default T queryParameters(FakerefobjinqueryGetQueryParameters.QueryParametersMap queryParameters) { - var instance = getInstance(); - instance.queryParameters = queryParameters; - return getBuilderAfterQueryParameters(instance); - } - } - - public interface SetterForServerIndex { - GetRequest getInstance(); - T getBuilderAfterServerIndex(GetRequest instance); - default T serverIndex(RootServerInfo.ServerIndex serverIndex) { - var instance = getInstance(); - instance.serverIndex = serverIndex; - return getBuilderAfterServerIndex(instance); - } - } - - public interface SetterForTimeout { - GetRequest getInstance(); - T getBuilderAfterTimeout(GetRequest instance); - default T timeout(Duration timeout) { - var instance = getInstance(); - instance.timeout = timeout; - return getBuilderAfterTimeout(instance); - } - } - - public static class GetRequestBuilder implements SetterForQueryParameters, SetterForServerIndex, SetterForTimeout { - private final GetRequest instance; - - public GetRequestBuilder() { - this.instance = new GetRequest(); - } - - public GetRequest build() { - return instance; - } - - public GetRequest getInstance() { - return instance; - } - - public GetRequestBuilder getBuilderAfterQueryParameters(GetRequest instance) { - return this; - } - - public GetRequestBuilder getBuilderAfterServerIndex(GetRequest instance) { - return this; - } - - public GetRequestBuilder getBuilderAfterTimeout(GetRequest instance) { - return this; - } - } -} diff --git a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/fakerefobjinquery/get/FakerefobjinqueryGetQueryParameters.kt b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/fakerefobjinquery/get/FakerefobjinqueryGetQueryParameters.kt deleted file mode 100644 index d9369761fde..00000000000 --- a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/fakerefobjinquery/get/FakerefobjinqueryGetQueryParameters.kt +++ /dev/null @@ -1,191 +0,0 @@ -package org.openapijsonschematools.client.paths.fakerefobjinquery.get; -import java.util.ArrayList; -import java.util.HashSet; -import java.util.LinkedHashMap; -import java.util.LinkedHashSet; -import java.util.List; -import java.util.Map; -import java.util.Objects; -import java.util.Set; -import org.checkerframework.checker.nullness.qual.Nullable; -import org.openapijsonschematools.client.components.schemas.Foo; -import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags; -import org.openapijsonschematools.client.configurations.SchemaConfiguration; -import org.openapijsonschematools.client.exceptions.UnsetPropertyException; -import org.openapijsonschematools.client.exceptions.ValidationException; -import org.openapijsonschematools.client.schemas.AnyTypeJsonSchema; -import org.openapijsonschematools.client.schemas.GenericBuilder; -import org.openapijsonschematools.client.schemas.NotAnyTypeJsonSchema; -import org.openapijsonschematools.client.schemas.validation.FrozenMap; -import org.openapijsonschematools.client.schemas.validation.JsonSchema; -import org.openapijsonschematools.client.schemas.validation.JsonSchemaInfo; -import org.openapijsonschematools.client.schemas.validation.MapSchemaValidator; -import org.openapijsonschematools.client.schemas.validation.MapUtils; -import org.openapijsonschematools.client.schemas.validation.PathToSchemasMap; -import org.openapijsonschematools.client.schemas.validation.PropertyEntry; -import org.openapijsonschematools.client.schemas.validation.ValidationMetadata; - -public class FakerefobjinqueryGetQueryParameters { - // nest classes so all schemas and input/output classes can be public - - - public static class AdditionalProperties extends NotAnyTypeJsonSchema.NotAnyTypeJsonSchema1 { - // NotAnyTypeSchema - private static @Nullable AdditionalProperties instance = null; - public static AdditionalProperties getInstance() { - if (instance == null) { - instance = new AdditionalProperties(); - } - return instance; - } - } - - - public static class QueryParametersMap extends FrozenMap { - protected QueryParametersMap(FrozenMap m) { - super(m); - } - public static final Set requiredKeys = Set.of(); - public static final Set optionalKeys = Set.of( - "mapBean" - ); - public static QueryParametersMap of(Map> arg, SchemaConfiguration configuration) throws ValidationException { - return FakerefobjinqueryGetQueryParameters1.getInstance().validate(arg, configuration); - } - - public Foo.FooMap mapBean() throws UnsetPropertyException { - return getOrThrow("mapBean"); - } - } - - public interface SetterForMapBean { - Map> getInstance(); - T getBuilderAfterMapBean(Map> instance); - - default T mapBean(Map value) { - var instance = getInstance(); - instance.put("mapBean", value); - return getBuilderAfterMapBean(instance); - } - } - - public static class QueryParametersMapBuilder implements GenericBuilder>>, SetterForMapBean { - private final Map> instance; - private static final Set knownKeys = Set.of( - "mapBean" - ); - public Set getKnownKeys() { - return knownKeys; - } - public QueryParametersMapBuilder() { - this.instance = new LinkedHashMap<>(); - } - public Map> build() { - return instance; - } - public Map> getInstance() { - return instance; - } - public QueryParametersMapBuilder getBuilderAfterMapBean(Map> instance) { - return this; - } - } - - - public sealed interface FakerefobjinqueryGetQueryParameters1Boxed permits FakerefobjinqueryGetQueryParameters1BoxedMap { - @Nullable Object getData(); - } - - public record FakerefobjinqueryGetQueryParameters1BoxedMap(QueryParametersMap data) implements FakerefobjinqueryGetQueryParameters1Boxed { - @Override - public @Nullable Object getData() { - return data; - } - } - - - public static class FakerefobjinqueryGetQueryParameters1 extends JsonSchema implements MapSchemaValidator { - private static @Nullable FakerefobjinqueryGetQueryParameters1 instance = null; - - protected FakerefobjinqueryGetQueryParameters1() { - super(new JsonSchemaInfo() - .type(Set.of(Map.class)) - .properties(Map.ofEntries( - new PropertyEntry("mapBean", Foo.Foo1.class) - )) - .additionalProperties(AdditionalProperties.class) - ); - } - - public static FakerefobjinqueryGetQueryParameters1 getInstance() { - if (instance == null) { - instance = new FakerefobjinqueryGetQueryParameters1(); - } - return instance; - } - - 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 RuntimeException("Invalid non-string key value"); - } - String propertyName = (String) entryKey; - List propertyPathToItem = new ArrayList<>(pathToItem); - propertyPathToItem.add(propertyName); - Object value = entry.getValue(); - LinkedHashMap, Nothing?> schemas = pathToSchemas.get(propertyPathToItem); - if (schemas == null) { - throw new RuntimeException("Validation 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"); - } - properties.put(propertyName, (Foo.FooMap) propertyInstance); - } - FrozenMap castProperties = new FrozenMap<>(properties); - return new QueryParametersMap(castProperties); - } - - 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); - SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().build())); - ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, new PathToSchemasMap(), new LinkedHashSet<>()); - PathToSchemasMap pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet); - return getNewInstance(castArg, validationMetadata.pathToItem(), pathToSchemasMap); - } - - - @Override - public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws 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"); - } - @Override - public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { - if (arg instanceof Map) { - return getNewInstance((Map) arg, pathToItem, pathToSchemas); - } - throw new RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); - } - @Override - public FakerefobjinqueryGetQueryParameters1BoxedMap validateAndBox(Map arg, SchemaConfiguration configuration) throws ValidationException { - return new FakerefobjinqueryGetQueryParameters1BoxedMap(validate(arg, configuration)); - } - @Override - public FakerefobjinqueryGetQueryParameters1Boxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { - 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"); - } - } - -} diff --git a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/fakerefobjinquery/get/FakerefobjinqueryGetResponses.kt b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/fakerefobjinquery/get/FakerefobjinqueryGetResponses.kt deleted file mode 100644 index bb044c27053..00000000000 --- a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/fakerefobjinquery/get/FakerefobjinqueryGetResponses.kt +++ /dev/null @@ -1,53 +0,0 @@ -package org.openapijsonschematools.client.paths.fakerefobjinquery.get; - -import org.openapijsonschematools.client.paths.fakerefobjinquery.get.responses.FakerefobjinqueryGetCode200Response; -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; -import org.checkerframework.checker.nullness.qual.Nullable; - -import java.net.http.HttpResponse; -import java.util.Map; -import java.util.AbstractMap; - -public class FakerefobjinqueryGetResponses { - public sealed interface EndpointResponse permits EndpointFakerefobjinqueryGetCode200Response {} - - public record EndpointFakerefobjinqueryGetCode200Response( - HttpResponse response, - Nothing? body, - Nothing? headers - ) implements EndpointResponse, ApiResponse{ - } - - public sealed interface StatusCodeResponseDeserializer permits StatusFakerefobjinqueryGetCode200ResponseDeserializer {} - - public static final class StatusFakerefobjinqueryGetCode200ResponseDeserializer extends FakerefobjinqueryGetCode200Response.FakerefobjinqueryGetCode200Response1 implements StatusCodeResponseDeserializer { - } - - public static final class FakerefobjinqueryGetResponses1 implements ResponsesDeserializer { - private final Map statusCodeToResponseDeserializer; - public FakerefobjinqueryGetResponses1() { - this.statusCodeToResponseDeserializer = Map.ofEntries( - new AbstractMap.SimpleEntry<>("200", new StatusFakerefobjinqueryGetCode200ResponseDeserializer()) - ); - } - - 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) { - throw new ApiException( - "Invalid response statusCode="+statusCode+" has no response defined in the openapi document", - response - ); - } - StatusFakerefobjinqueryGetCode200ResponseDeserializer castDeserializer = (StatusFakerefobjinqueryGetCode200ResponseDeserializer) statusCodeDeserializer; - var deserializedResponse = castDeserializer.deserialize(response, configuration); - return new EndpointFakerefobjinqueryGetCode200Response(response, deserializedResponse.body(), deserializedResponse.headers()); - } - } -} diff --git a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/fakerefobjinquery/get/Parameters.kt b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/fakerefobjinquery/get/Parameters.kt deleted file mode 100644 index c237004cd7e..00000000000 --- a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/fakerefobjinquery/get/Parameters.kt +++ /dev/null @@ -1,20 +0,0 @@ -package org.openapijsonschematools.client.paths.fakerefobjinquery.get; - -import org.openapijsonschematools.client.paths.fakerefobjinquery.get.parameters.Parameter0; -import org.openapijsonschematools.client.parameter.QuerySerializer; - -import java.util.Map; -import java.util.AbstractMap; - -public class Parameters { - - public static class QueryParametersSerializer extends QuerySerializer { - public QueryParametersSerializer() { - super( - Map.ofEntries( - new AbstractMap.SimpleEntry<>("mapBean", new Parameter0.Parameter01()) - ) - ); - } - } -} diff --git a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/fakerefobjinquery/get/parameters/Parameter0.kt b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/fakerefobjinquery/get/parameters/Parameter0.kt deleted file mode 100644 index f1b8a6d8720..00000000000 --- a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/fakerefobjinquery/get/parameters/Parameter0.kt +++ /dev/null @@ -1,23 +0,0 @@ -package org.openapijsonschematools.client.paths.fakerefobjinquery.get.parameters; - -import org.openapijsonschematools.client.parameter.ParameterStyle; -import org.openapijsonschematools.client.parameter.ParameterInType; -import org.openapijsonschematools.client.parameter.SchemaParameter; -import org.openapijsonschematools.client.paths.fakerefobjinquery.get.parameters.parameter0.Schema0; - -public class Parameter0 { - - public static class Parameter01 extends SchemaParameter { - public Parameter01() { - super( - "mapBean", - ParameterInType.QUERY, - false, - ParameterStyle.DEEP_OBJECT, - true, - false, - Schema0.Schema01.getInstance() - ); - } - } -} diff --git a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/fakerefobjinquery/get/parameters/parameter0/Schema0.kt b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/fakerefobjinquery/get/parameters/parameter0/Schema0.kt deleted file mode 100644 index 55405e37a30..00000000000 --- a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/fakerefobjinquery/get/parameters/parameter0/Schema0.kt +++ /dev/null @@ -1,19 +0,0 @@ -package org.openapijsonschematools.client.paths.fakerefobjinquery.get.parameters.parameter0; - -import org.checkerframework.checker.nullness.qual.Nullable; -import org.openapijsonschematools.client.components.schemas.Foo; - -public class Schema0 extends Foo { - // $refed class - - - public static class Schema01 extends Foo1 { - private static @Nullable Schema01 instance = null; - public static Schema01 getInstance() { - if (instance == null) { - instance = new Schema01(); - } - return instance; - } - } -} diff --git a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/fakerefobjinquery/get/responses/FakerefobjinqueryGetCode200Response.kt b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/fakerefobjinquery/get/responses/FakerefobjinqueryGetCode200Response.kt deleted file mode 100644 index 7ae25fb0e12..00000000000 --- a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/fakerefobjinquery/get/responses/FakerefobjinqueryGetCode200Response.kt +++ /dev/null @@ -1,7 +0,0 @@ -package org.openapijsonschematools.client.paths.fakerefobjinquery.get.responses; - -import org.openapijsonschematools.client.components.responses.SuccessDescriptionOnly; - -public class FakerefobjinqueryGetCode200Response extends SuccessDescriptionOnly { - public static class FakerefobjinqueryGetCode200Response1 extends SuccessDescriptionOnly1 {} -} diff --git a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/fakerefsarraymodel/FakerefsarraymodelPost.kt b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/fakerefsarraymodel/FakerefsarraymodelPost.kt deleted file mode 100644 index 07af16ea8b6..00000000000 --- a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/fakerefsarraymodel/FakerefsarraymodelPost.kt +++ /dev/null @@ -1,152 +0,0 @@ -package org.openapijsonschematools.client.paths.fakerefsarraymodel; - -import org.checkerframework.checker.nullness.qual.Nullable; -import org.openapijsonschematools.client.paths.fakerefsarraymodel.post.FakerefsarraymodelPostRequestBody; -import org.openapijsonschematools.client.RootServerInfo; -import org.openapijsonschematools.client.paths.fakerefsarraymodel.post.FakerefsarraymodelPostResponses; -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.requestbody.SerializedRequestBody; -import org.openapijsonschematools.client.paths.Fakerefsarraymodel; - -import java.io.IOException; -import java.util.ArrayList; -import java.net.http.HttpClient; -import java.net.http.HttpRequest; -import java.time.Duration; -import java.util.List; -import java.util.Map; - -public class FakerefsarraymodelPost { - private static class PostProvider { - private static final String method = "post"; - - public static FakerefsarraymodelPostResponses.EndpointResponse post( - PostRequest request, - ApiConfiguration apiConfiguration, - SchemaConfiguration schemaConfiguration, - HttpClient client - ) throws IOException, InterruptedException, ValidationException, NotImplementedException, ApiException { - Map> headers = apiConfiguration.getDefaultHeaders(); - - @Nullable SerializedRequestBody serializedRequestBody; - HttpRequest.BodyPublisher bodyPublisher = HttpRequest.BodyPublishers.noBody(); - if (request.requestBody != null) { - serializedRequestBody = new FakerefsarraymodelPostRequestBody.FakerefsarraymodelPostRequestBody1().serialize( - request.requestBody - ); - var contentTypeHeaderValues = headers.getOrDefault("Content-Type", new ArrayList<>()); - contentTypeHeaderValues.add(serializedRequestBody.contentType); - bodyPublisher = serializedRequestBody.bodyPublisher; - } - // TODO set this to a map if there is a query security scheme - @Nullable Map queryMap = null; - String host = apiConfiguration.getServer(request.serverIndex).url(); - - String url = host + Fakerefsarraymodel.path; - var httpRequest = RestClient.getRequest( - url, - method, - bodyPublisher, - headers, - request.timeout - ); - var response = RestClient.getResponse(httpRequest, client); - var responsesDeserializer = new FakerefsarraymodelPostResponses.FakerefsarraymodelPostResponses1(); - return responsesDeserializer.deserialize(response, schemaConfiguration); - } - } - - public interface PostOperation { - ApiConfiguration getApiConfiguration(); - SchemaConfiguration getSchemaConfiguration(); - HttpClient getClient(); - default FakerefsarraymodelPostResponses.EndpointResponse post(PostRequest request) throws IOException, InterruptedException, ValidationException, NotImplementedException, ApiException { - return PostProvider.post(request, getApiConfiguration(), getSchemaConfiguration(), getClient()); - } - } - - public interface ArrayModelOperation { - ApiConfiguration getApiConfiguration(); - SchemaConfiguration getSchemaConfiguration(); - HttpClient getClient(); - default FakerefsarraymodelPostResponses.EndpointResponse arrayModel(PostRequest request) throws IOException, InterruptedException, ValidationException, NotImplementedException, ApiException { - return PostProvider.post(request, getApiConfiguration(), getSchemaConfiguration(), getClient()); - } - } - - public static class Post extends ApiClient implements PostOperation { - public Post(ApiConfiguration apiConfiguration, SchemaConfiguration schemaConfiguration) { - super(apiConfiguration, schemaConfiguration); - } - } - - public static class PostRequest { - public FakerefsarraymodelPostRequestBody.@Nullable SealedRequestBody requestBody; - public RootServerInfo.@Nullable ServerIndex serverIndex; - public @Nullable Duration timeout; - } - - public interface SetterForRequestBody { - PostRequest getInstance(); - T getBuilderAfterRequestBody(PostRequest instance); - default T requestBody(FakerefsarraymodelPostRequestBody.SealedRequestBody requestBody) { - var instance = getInstance(); - instance.requestBody = requestBody; - return getBuilderAfterRequestBody(instance); - } - } - - public interface SetterForServerIndex { - PostRequest getInstance(); - T getBuilderAfterServerIndex(PostRequest instance); - default T serverIndex(RootServerInfo.ServerIndex serverIndex) { - var instance = getInstance(); - instance.serverIndex = serverIndex; - return getBuilderAfterServerIndex(instance); - } - } - - public interface SetterForTimeout { - PostRequest getInstance(); - T getBuilderAfterTimeout(PostRequest instance); - default T timeout(Duration timeout) { - var instance = getInstance(); - instance.timeout = timeout; - return getBuilderAfterTimeout(instance); - } - } - - public static class PostRequestBuilder implements SetterForRequestBody, SetterForServerIndex, SetterForTimeout { - private final PostRequest instance; - - public PostRequestBuilder() { - this.instance = new PostRequest(); - } - - public PostRequest build() { - return instance; - } - - public PostRequest getInstance() { - return instance; - } - - public PostRequestBuilder getBuilderAfterRequestBody(PostRequest instance) { - return this; - } - - public PostRequestBuilder getBuilderAfterServerIndex(PostRequest instance) { - return this; - } - - public PostRequestBuilder getBuilderAfterTimeout(PostRequest instance) { - return this; - } - } -} diff --git a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/fakerefsarraymodel/post/FakerefsarraymodelPostRequestBody.kt b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/fakerefsarraymodel/post/FakerefsarraymodelPostRequestBody.kt deleted file mode 100644 index 0109dd1aae7..00000000000 --- a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/fakerefsarraymodel/post/FakerefsarraymodelPostRequestBody.kt +++ /dev/null @@ -1,49 +0,0 @@ -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; -import org.openapijsonschematools.client.mediatype.MediaType; -import org.openapijsonschematools.client.paths.fakerefsarraymodel.post.requestbody.content.applicationjson.ApplicationjsonSchema; - -import java.util.AbstractMap; -import java.util.Map; - -public class FakerefsarraymodelPostRequestBody { - public sealed interface SealedMediaType permits ApplicationjsonMediaType {} - - public record ApplicationjsonMediaType(ApplicationjsonSchema.ApplicationjsonSchema1 schema) implements SealedMediaType, MediaType { - public ApplicationjsonMediaType() { - this(ApplicationjsonSchema.ApplicationjsonSchema1.getInstance()); - } - @Override - public Nothing? encoding() { - return null; - } - } - - public static class FakerefsarraymodelPostRequestBody1 extends RequestBodySerializer { - public FakerefsarraymodelPostRequestBody1() { - super( - Map.ofEntries( - new AbstractMap.SimpleEntry<>("application/json", new ApplicationjsonMediaType()) - ), - false - ); - } - - public SerializedRequestBody serialize(SealedRequestBody requestBody) throws NotImplementedException { - ApplicationjsonRequestBody requestBody0 = (ApplicationjsonRequestBody) requestBody; - return serialize(requestBody0.contentType(), requestBody0.body().getData()); - } - } - - public sealed interface SealedRequestBody permits ApplicationjsonRequestBody {} - public record ApplicationjsonRequestBody(ApplicationjsonSchema.AnimalFarm1Boxed body) implements SealedRequestBody, GenericRequestBody { - @Override - public String contentType() { - return "application/json"; - } - } -} diff --git a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/fakerefsarraymodel/post/FakerefsarraymodelPostResponses.kt b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/fakerefsarraymodel/post/FakerefsarraymodelPostResponses.kt deleted file mode 100644 index c1a0d439502..00000000000 --- a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/fakerefsarraymodel/post/FakerefsarraymodelPostResponses.kt +++ /dev/null @@ -1,53 +0,0 @@ -package org.openapijsonschematools.client.paths.fakerefsarraymodel.post; - -import org.openapijsonschematools.client.paths.fakerefsarraymodel.post.responses.FakerefsarraymodelPostCode200Response; -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; -import org.checkerframework.checker.nullness.qual.Nullable; - -import java.net.http.HttpResponse; -import java.util.Map; -import java.util.AbstractMap; - -public class FakerefsarraymodelPostResponses { - public sealed interface EndpointResponse permits EndpointFakerefsarraymodelPostCode200Response {} - - public record EndpointFakerefsarraymodelPostCode200Response( - HttpResponse response, - FakerefsarraymodelPostCode200Response.SealedResponseBody body, - Nothing? headers - ) implements EndpointResponse, ApiResponse{ - } - - public sealed interface StatusCodeResponseDeserializer permits StatusFakerefsarraymodelPostCode200ResponseDeserializer {} - - public static final class StatusFakerefsarraymodelPostCode200ResponseDeserializer extends FakerefsarraymodelPostCode200Response.FakerefsarraymodelPostCode200Response1 implements StatusCodeResponseDeserializer { - } - - public static final class FakerefsarraymodelPostResponses1 implements ResponsesDeserializer { - private final Map statusCodeToResponseDeserializer; - public FakerefsarraymodelPostResponses1() { - this.statusCodeToResponseDeserializer = Map.ofEntries( - new AbstractMap.SimpleEntry<>("200", new StatusFakerefsarraymodelPostCode200ResponseDeserializer()) - ); - } - - 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) { - throw new ApiException( - "Invalid response statusCode="+statusCode+" has no response defined in the openapi document", - response - ); - } - StatusFakerefsarraymodelPostCode200ResponseDeserializer castDeserializer = (StatusFakerefsarraymodelPostCode200ResponseDeserializer) statusCodeDeserializer; - var deserializedResponse = castDeserializer.deserialize(response, configuration); - return new EndpointFakerefsarraymodelPostCode200Response(response, deserializedResponse.body(), deserializedResponse.headers()); - } - } -} diff --git a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/fakerefsarraymodel/post/requestbody/content/applicationjson/ApplicationjsonSchema.kt b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/fakerefsarraymodel/post/requestbody/content/applicationjson/ApplicationjsonSchema.kt deleted file mode 100644 index 702bfe3e25a..00000000000 --- a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/fakerefsarraymodel/post/requestbody/content/applicationjson/ApplicationjsonSchema.kt +++ /dev/null @@ -1,19 +0,0 @@ -package org.openapijsonschematools.client.paths.fakerefsarraymodel.post.requestbody.content.applicationjson; - -import org.checkerframework.checker.nullness.qual.Nullable; -import org.openapijsonschematools.client.components.schemas.AnimalFarm; - -public class ApplicationjsonSchema extends AnimalFarm { - // $refed class - - - public static class ApplicationjsonSchema1 extends AnimalFarm1 { - private static @Nullable ApplicationjsonSchema1 instance = null; - public static ApplicationjsonSchema1 getInstance() { - if (instance == null) { - instance = new ApplicationjsonSchema1(); - } - return instance; - } - } -} diff --git a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/fakerefsarraymodel/post/responses/FakerefsarraymodelPostCode200Response.kt b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/fakerefsarraymodel/post/responses/FakerefsarraymodelPostCode200Response.kt deleted file mode 100644 index 081bfee2f44..00000000000 --- a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/fakerefsarraymodel/post/responses/FakerefsarraymodelPostCode200Response.kt +++ /dev/null @@ -1,63 +0,0 @@ -package org.openapijsonschematools.client.paths.fakerefsarraymodel.post.responses; - -import org.openapijsonschematools.client.configurations.SchemaConfiguration; -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; - -import java.util.AbstractMap; -import java.util.Map; -import java.net.http.HttpResponse; -import java.net.http.HttpHeaders; - -public class FakerefsarraymodelPostCode200Response { - public sealed interface SealedMediaType permits ApplicationjsonMediaType {} - - public record ApplicationjsonMediaType(ApplicationjsonSchema.ApplicationjsonSchema1 schema) implements SealedMediaType, MediaType { - public ApplicationjsonMediaType() { - this(ApplicationjsonSchema.ApplicationjsonSchema1.getInstance()); - } - @Override - public Nothing? encoding() { - return null; - } - } - public sealed interface SealedResponseBody permits ApplicationjsonResponseBody {} - public record ApplicationjsonResponseBody(ApplicationjsonSchema.AnimalFarm1Boxed body) implements SealedResponseBody { } - - public static class FakerefsarraymodelPostCode200Response1 extends ResponseDeserializer { - public FakerefsarraymodelPostCode200Response1() { - super( - Map.ofEntries( - new AbstractMap.SimpleEntry<>("application/json", new ApplicationjsonMediaType()) - ) - ); - } - - @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); - } - - @Override - protected Nothing? getHeaders(HttpHeaders headers, SchemaConfiguration configuration) { - return null; - } - } - - @SuppressWarnings("serial") - public static class ResponseApiException extends ApiException { - public DeserializedHttpResponse deserializedResponse; - - public ResponseApiException(String s, HttpResponse response, DeserializedHttpResponse deserializedResponse) { - super(s, response); - this.deserializedResponse = deserializedResponse; - } - } -} diff --git a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/fakerefsarraymodel/post/responses/code200response/content/applicationjson/ApplicationjsonSchema.kt b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/fakerefsarraymodel/post/responses/code200response/content/applicationjson/ApplicationjsonSchema.kt deleted file mode 100644 index 3183986a750..00000000000 --- a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/fakerefsarraymodel/post/responses/code200response/content/applicationjson/ApplicationjsonSchema.kt +++ /dev/null @@ -1,19 +0,0 @@ -package org.openapijsonschematools.client.paths.fakerefsarraymodel.post.responses.code200response.content.applicationjson; - -import org.checkerframework.checker.nullness.qual.Nullable; -import org.openapijsonschematools.client.components.schemas.AnimalFarm; - -public class ApplicationjsonSchema extends AnimalFarm { - // $refed class - - - public static class ApplicationjsonSchema1 extends AnimalFarm1 { - private static @Nullable ApplicationjsonSchema1 instance = null; - public static ApplicationjsonSchema1 getInstance() { - if (instance == null) { - instance = new ApplicationjsonSchema1(); - } - return instance; - } - } -} diff --git a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/fakerefsarrayofenums/FakerefsarrayofenumsPost.kt b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/fakerefsarrayofenums/FakerefsarrayofenumsPost.kt deleted file mode 100644 index 2e562146fb3..00000000000 --- a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/fakerefsarrayofenums/FakerefsarrayofenumsPost.kt +++ /dev/null @@ -1,152 +0,0 @@ -package org.openapijsonschematools.client.paths.fakerefsarrayofenums; - -import org.checkerframework.checker.nullness.qual.Nullable; -import org.openapijsonschematools.client.paths.fakerefsarrayofenums.post.FakerefsarrayofenumsPostRequestBody; -import org.openapijsonschematools.client.RootServerInfo; -import org.openapijsonschematools.client.paths.fakerefsarrayofenums.post.FakerefsarrayofenumsPostResponses; -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.requestbody.SerializedRequestBody; -import org.openapijsonschematools.client.paths.Fakerefsarrayofenums; - -import java.io.IOException; -import java.util.ArrayList; -import java.net.http.HttpClient; -import java.net.http.HttpRequest; -import java.time.Duration; -import java.util.List; -import java.util.Map; - -public class FakerefsarrayofenumsPost { - private static class PostProvider { - private static final String method = "post"; - - public static FakerefsarrayofenumsPostResponses.EndpointResponse post( - PostRequest request, - ApiConfiguration apiConfiguration, - SchemaConfiguration schemaConfiguration, - HttpClient client - ) throws IOException, InterruptedException, ValidationException, NotImplementedException, ApiException { - Map> headers = apiConfiguration.getDefaultHeaders(); - - @Nullable SerializedRequestBody serializedRequestBody; - HttpRequest.BodyPublisher bodyPublisher = HttpRequest.BodyPublishers.noBody(); - if (request.requestBody != null) { - serializedRequestBody = new FakerefsarrayofenumsPostRequestBody.FakerefsarrayofenumsPostRequestBody1().serialize( - request.requestBody - ); - var contentTypeHeaderValues = headers.getOrDefault("Content-Type", new ArrayList<>()); - contentTypeHeaderValues.add(serializedRequestBody.contentType); - bodyPublisher = serializedRequestBody.bodyPublisher; - } - // TODO set this to a map if there is a query security scheme - @Nullable Map queryMap = null; - String host = apiConfiguration.getServer(request.serverIndex).url(); - - String url = host + Fakerefsarrayofenums.path; - var httpRequest = RestClient.getRequest( - url, - method, - bodyPublisher, - headers, - request.timeout - ); - var response = RestClient.getResponse(httpRequest, client); - var responsesDeserializer = new FakerefsarrayofenumsPostResponses.FakerefsarrayofenumsPostResponses1(); - return responsesDeserializer.deserialize(response, schemaConfiguration); - } - } - - public interface PostOperation { - ApiConfiguration getApiConfiguration(); - SchemaConfiguration getSchemaConfiguration(); - HttpClient getClient(); - default FakerefsarrayofenumsPostResponses.EndpointResponse post(PostRequest request) throws IOException, InterruptedException, ValidationException, NotImplementedException, ApiException { - return PostProvider.post(request, getApiConfiguration(), getSchemaConfiguration(), getClient()); - } - } - - public interface ArrayOfEnumsOperation { - ApiConfiguration getApiConfiguration(); - SchemaConfiguration getSchemaConfiguration(); - HttpClient getClient(); - default FakerefsarrayofenumsPostResponses.EndpointResponse arrayOfEnums(PostRequest request) throws IOException, InterruptedException, ValidationException, NotImplementedException, ApiException { - return PostProvider.post(request, getApiConfiguration(), getSchemaConfiguration(), getClient()); - } - } - - public static class Post extends ApiClient implements PostOperation { - public Post(ApiConfiguration apiConfiguration, SchemaConfiguration schemaConfiguration) { - super(apiConfiguration, schemaConfiguration); - } - } - - public static class PostRequest { - public FakerefsarrayofenumsPostRequestBody.@Nullable SealedRequestBody requestBody; - public RootServerInfo.@Nullable ServerIndex serverIndex; - public @Nullable Duration timeout; - } - - public interface SetterForRequestBody { - PostRequest getInstance(); - T getBuilderAfterRequestBody(PostRequest instance); - default T requestBody(FakerefsarrayofenumsPostRequestBody.SealedRequestBody requestBody) { - var instance = getInstance(); - instance.requestBody = requestBody; - return getBuilderAfterRequestBody(instance); - } - } - - public interface SetterForServerIndex { - PostRequest getInstance(); - T getBuilderAfterServerIndex(PostRequest instance); - default T serverIndex(RootServerInfo.ServerIndex serverIndex) { - var instance = getInstance(); - instance.serverIndex = serverIndex; - return getBuilderAfterServerIndex(instance); - } - } - - public interface SetterForTimeout { - PostRequest getInstance(); - T getBuilderAfterTimeout(PostRequest instance); - default T timeout(Duration timeout) { - var instance = getInstance(); - instance.timeout = timeout; - return getBuilderAfterTimeout(instance); - } - } - - public static class PostRequestBuilder implements SetterForRequestBody, SetterForServerIndex, SetterForTimeout { - private final PostRequest instance; - - public PostRequestBuilder() { - this.instance = new PostRequest(); - } - - public PostRequest build() { - return instance; - } - - public PostRequest getInstance() { - return instance; - } - - public PostRequestBuilder getBuilderAfterRequestBody(PostRequest instance) { - return this; - } - - public PostRequestBuilder getBuilderAfterServerIndex(PostRequest instance) { - return this; - } - - public PostRequestBuilder getBuilderAfterTimeout(PostRequest instance) { - return this; - } - } -} diff --git a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/fakerefsarrayofenums/post/FakerefsarrayofenumsPostRequestBody.kt b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/fakerefsarrayofenums/post/FakerefsarrayofenumsPostRequestBody.kt deleted file mode 100644 index aedcac2d3a4..00000000000 --- a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/fakerefsarrayofenums/post/FakerefsarrayofenumsPostRequestBody.kt +++ /dev/null @@ -1,49 +0,0 @@ -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; -import org.openapijsonschematools.client.mediatype.MediaType; -import org.openapijsonschematools.client.paths.fakerefsarrayofenums.post.requestbody.content.applicationjson.ApplicationjsonSchema; - -import java.util.AbstractMap; -import java.util.Map; - -public class FakerefsarrayofenumsPostRequestBody { - public sealed interface SealedMediaType permits ApplicationjsonMediaType {} - - public record ApplicationjsonMediaType(ApplicationjsonSchema.ApplicationjsonSchema1 schema) implements SealedMediaType, MediaType { - public ApplicationjsonMediaType() { - this(ApplicationjsonSchema.ApplicationjsonSchema1.getInstance()); - } - @Override - public Nothing? encoding() { - return null; - } - } - - public static class FakerefsarrayofenumsPostRequestBody1 extends RequestBodySerializer { - public FakerefsarrayofenumsPostRequestBody1() { - super( - Map.ofEntries( - new AbstractMap.SimpleEntry<>("application/json", new ApplicationjsonMediaType()) - ), - false - ); - } - - public SerializedRequestBody serialize(SealedRequestBody requestBody) throws NotImplementedException { - ApplicationjsonRequestBody requestBody0 = (ApplicationjsonRequestBody) requestBody; - return serialize(requestBody0.contentType(), requestBody0.body().getData()); - } - } - - public sealed interface SealedRequestBody permits ApplicationjsonRequestBody {} - public record ApplicationjsonRequestBody(ApplicationjsonSchema.ArrayOfEnums1Boxed body) implements SealedRequestBody, GenericRequestBody { - @Override - public String contentType() { - return "application/json"; - } - } -} diff --git a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/fakerefsarrayofenums/post/FakerefsarrayofenumsPostResponses.kt b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/fakerefsarrayofenums/post/FakerefsarrayofenumsPostResponses.kt deleted file mode 100644 index 6f339c6eaa5..00000000000 --- a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/fakerefsarrayofenums/post/FakerefsarrayofenumsPostResponses.kt +++ /dev/null @@ -1,53 +0,0 @@ -package org.openapijsonschematools.client.paths.fakerefsarrayofenums.post; - -import org.openapijsonschematools.client.paths.fakerefsarrayofenums.post.responses.FakerefsarrayofenumsPostCode200Response; -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; -import org.checkerframework.checker.nullness.qual.Nullable; - -import java.net.http.HttpResponse; -import java.util.Map; -import java.util.AbstractMap; - -public class FakerefsarrayofenumsPostResponses { - public sealed interface EndpointResponse permits EndpointFakerefsarrayofenumsPostCode200Response {} - - public record EndpointFakerefsarrayofenumsPostCode200Response( - HttpResponse response, - FakerefsarrayofenumsPostCode200Response.SealedResponseBody body, - Nothing? headers - ) implements EndpointResponse, ApiResponse{ - } - - public sealed interface StatusCodeResponseDeserializer permits StatusFakerefsarrayofenumsPostCode200ResponseDeserializer {} - - public static final class StatusFakerefsarrayofenumsPostCode200ResponseDeserializer extends FakerefsarrayofenumsPostCode200Response.FakerefsarrayofenumsPostCode200Response1 implements StatusCodeResponseDeserializer { - } - - public static final class FakerefsarrayofenumsPostResponses1 implements ResponsesDeserializer { - private final Map statusCodeToResponseDeserializer; - public FakerefsarrayofenumsPostResponses1() { - this.statusCodeToResponseDeserializer = Map.ofEntries( - new AbstractMap.SimpleEntry<>("200", new StatusFakerefsarrayofenumsPostCode200ResponseDeserializer()) - ); - } - - 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) { - throw new ApiException( - "Invalid response statusCode="+statusCode+" has no response defined in the openapi document", - response - ); - } - StatusFakerefsarrayofenumsPostCode200ResponseDeserializer castDeserializer = (StatusFakerefsarrayofenumsPostCode200ResponseDeserializer) statusCodeDeserializer; - var deserializedResponse = castDeserializer.deserialize(response, configuration); - return new EndpointFakerefsarrayofenumsPostCode200Response(response, deserializedResponse.body(), deserializedResponse.headers()); - } - } -} diff --git a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/fakerefsarrayofenums/post/requestbody/content/applicationjson/ApplicationjsonSchema.kt b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/fakerefsarrayofenums/post/requestbody/content/applicationjson/ApplicationjsonSchema.kt deleted file mode 100644 index 460518d6f87..00000000000 --- a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/fakerefsarrayofenums/post/requestbody/content/applicationjson/ApplicationjsonSchema.kt +++ /dev/null @@ -1,19 +0,0 @@ -package org.openapijsonschematools.client.paths.fakerefsarrayofenums.post.requestbody.content.applicationjson; - -import org.checkerframework.checker.nullness.qual.Nullable; -import org.openapijsonschematools.client.components.schemas.ArrayOfEnums; - -public class ApplicationjsonSchema extends ArrayOfEnums { - // $refed class - - - public static class ApplicationjsonSchema1 extends ArrayOfEnums1 { - private static @Nullable ApplicationjsonSchema1 instance = null; - public static ApplicationjsonSchema1 getInstance() { - if (instance == null) { - instance = new ApplicationjsonSchema1(); - } - return instance; - } - } -} diff --git a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/fakerefsarrayofenums/post/responses/FakerefsarrayofenumsPostCode200Response.kt b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/fakerefsarrayofenums/post/responses/FakerefsarrayofenumsPostCode200Response.kt deleted file mode 100644 index 2e36c4fb9da..00000000000 --- a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/fakerefsarrayofenums/post/responses/FakerefsarrayofenumsPostCode200Response.kt +++ /dev/null @@ -1,63 +0,0 @@ -package org.openapijsonschematools.client.paths.fakerefsarrayofenums.post.responses; - -import org.openapijsonschematools.client.configurations.SchemaConfiguration; -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; - -import java.util.AbstractMap; -import java.util.Map; -import java.net.http.HttpResponse; -import java.net.http.HttpHeaders; - -public class FakerefsarrayofenumsPostCode200Response { - public sealed interface SealedMediaType permits ApplicationjsonMediaType {} - - public record ApplicationjsonMediaType(ApplicationjsonSchema.ApplicationjsonSchema1 schema) implements SealedMediaType, MediaType { - public ApplicationjsonMediaType() { - this(ApplicationjsonSchema.ApplicationjsonSchema1.getInstance()); - } - @Override - public Nothing? encoding() { - return null; - } - } - public sealed interface SealedResponseBody permits ApplicationjsonResponseBody {} - public record ApplicationjsonResponseBody(ApplicationjsonSchema.ArrayOfEnums1Boxed body) implements SealedResponseBody { } - - public static class FakerefsarrayofenumsPostCode200Response1 extends ResponseDeserializer { - public FakerefsarrayofenumsPostCode200Response1() { - super( - Map.ofEntries( - new AbstractMap.SimpleEntry<>("application/json", new ApplicationjsonMediaType()) - ) - ); - } - - @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); - } - - @Override - protected Nothing? getHeaders(HttpHeaders headers, SchemaConfiguration configuration) { - return null; - } - } - - @SuppressWarnings("serial") - public static class ResponseApiException extends ApiException { - public DeserializedHttpResponse deserializedResponse; - - public ResponseApiException(String s, HttpResponse response, DeserializedHttpResponse deserializedResponse) { - super(s, response); - this.deserializedResponse = deserializedResponse; - } - } -} diff --git a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/fakerefsarrayofenums/post/responses/code200response/content/applicationjson/ApplicationjsonSchema.kt b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/fakerefsarrayofenums/post/responses/code200response/content/applicationjson/ApplicationjsonSchema.kt deleted file mode 100644 index aae5071d1b6..00000000000 --- a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/fakerefsarrayofenums/post/responses/code200response/content/applicationjson/ApplicationjsonSchema.kt +++ /dev/null @@ -1,19 +0,0 @@ -package org.openapijsonschematools.client.paths.fakerefsarrayofenums.post.responses.code200response.content.applicationjson; - -import org.checkerframework.checker.nullness.qual.Nullable; -import org.openapijsonschematools.client.components.schemas.ArrayOfEnums; - -public class ApplicationjsonSchema extends ArrayOfEnums { - // $refed class - - - public static class ApplicationjsonSchema1 extends ArrayOfEnums1 { - private static @Nullable ApplicationjsonSchema1 instance = null; - public static ApplicationjsonSchema1 getInstance() { - if (instance == null) { - instance = new ApplicationjsonSchema1(); - } - return instance; - } - } -} diff --git a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/fakerefsboolean/FakerefsbooleanPost.kt b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/fakerefsboolean/FakerefsbooleanPost.kt deleted file mode 100644 index 48e40534184..00000000000 --- a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/fakerefsboolean/FakerefsbooleanPost.kt +++ /dev/null @@ -1,152 +0,0 @@ -package org.openapijsonschematools.client.paths.fakerefsboolean; - -import org.checkerframework.checker.nullness.qual.Nullable; -import org.openapijsonschematools.client.paths.fakerefsboolean.post.FakerefsbooleanPostRequestBody; -import org.openapijsonschematools.client.RootServerInfo; -import org.openapijsonschematools.client.paths.fakerefsboolean.post.FakerefsbooleanPostResponses; -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.requestbody.SerializedRequestBody; -import org.openapijsonschematools.client.paths.Fakerefsboolean; - -import java.io.IOException; -import java.util.ArrayList; -import java.net.http.HttpClient; -import java.net.http.HttpRequest; -import java.time.Duration; -import java.util.List; -import java.util.Map; - -public class FakerefsbooleanPost { - private static class PostProvider { - private static final String method = "post"; - - public static FakerefsbooleanPostResponses.EndpointResponse post( - PostRequest request, - ApiConfiguration apiConfiguration, - SchemaConfiguration schemaConfiguration, - HttpClient client - ) throws IOException, InterruptedException, ValidationException, NotImplementedException, ApiException { - Map> headers = apiConfiguration.getDefaultHeaders(); - - @Nullable SerializedRequestBody serializedRequestBody; - HttpRequest.BodyPublisher bodyPublisher = HttpRequest.BodyPublishers.noBody(); - if (request.requestBody != null) { - serializedRequestBody = new FakerefsbooleanPostRequestBody.FakerefsbooleanPostRequestBody1().serialize( - request.requestBody - ); - var contentTypeHeaderValues = headers.getOrDefault("Content-Type", new ArrayList<>()); - contentTypeHeaderValues.add(serializedRequestBody.contentType); - bodyPublisher = serializedRequestBody.bodyPublisher; - } - // TODO set this to a map if there is a query security scheme - @Nullable Map queryMap = null; - String host = apiConfiguration.getServer(request.serverIndex).url(); - - String url = host + Fakerefsboolean.path; - var httpRequest = RestClient.getRequest( - url, - method, - bodyPublisher, - headers, - request.timeout - ); - var response = RestClient.getResponse(httpRequest, client); - var responsesDeserializer = new FakerefsbooleanPostResponses.FakerefsbooleanPostResponses1(); - return responsesDeserializer.deserialize(response, schemaConfiguration); - } - } - - public interface PostOperation { - ApiConfiguration getApiConfiguration(); - SchemaConfiguration getSchemaConfiguration(); - HttpClient getClient(); - default FakerefsbooleanPostResponses.EndpointResponse post(PostRequest request) throws IOException, InterruptedException, ValidationException, NotImplementedException, ApiException { - return PostProvider.post(request, getApiConfiguration(), getSchemaConfiguration(), getClient()); - } - } - - public interface ModelBooleanOperation { - ApiConfiguration getApiConfiguration(); - SchemaConfiguration getSchemaConfiguration(); - HttpClient getClient(); - default FakerefsbooleanPostResponses.EndpointResponse modelBoolean(PostRequest request) throws IOException, InterruptedException, ValidationException, NotImplementedException, ApiException { - return PostProvider.post(request, getApiConfiguration(), getSchemaConfiguration(), getClient()); - } - } - - public static class Post extends ApiClient implements PostOperation { - public Post(ApiConfiguration apiConfiguration, SchemaConfiguration schemaConfiguration) { - super(apiConfiguration, schemaConfiguration); - } - } - - public static class PostRequest { - public FakerefsbooleanPostRequestBody.@Nullable SealedRequestBody requestBody; - public RootServerInfo.@Nullable ServerIndex serverIndex; - public @Nullable Duration timeout; - } - - public interface SetterForRequestBody { - PostRequest getInstance(); - T getBuilderAfterRequestBody(PostRequest instance); - default T requestBody(FakerefsbooleanPostRequestBody.SealedRequestBody requestBody) { - var instance = getInstance(); - instance.requestBody = requestBody; - return getBuilderAfterRequestBody(instance); - } - } - - public interface SetterForServerIndex { - PostRequest getInstance(); - T getBuilderAfterServerIndex(PostRequest instance); - default T serverIndex(RootServerInfo.ServerIndex serverIndex) { - var instance = getInstance(); - instance.serverIndex = serverIndex; - return getBuilderAfterServerIndex(instance); - } - } - - public interface SetterForTimeout { - PostRequest getInstance(); - T getBuilderAfterTimeout(PostRequest instance); - default T timeout(Duration timeout) { - var instance = getInstance(); - instance.timeout = timeout; - return getBuilderAfterTimeout(instance); - } - } - - public static class PostRequestBuilder implements SetterForRequestBody, SetterForServerIndex, SetterForTimeout { - private final PostRequest instance; - - public PostRequestBuilder() { - this.instance = new PostRequest(); - } - - public PostRequest build() { - return instance; - } - - public PostRequest getInstance() { - return instance; - } - - public PostRequestBuilder getBuilderAfterRequestBody(PostRequest instance) { - return this; - } - - public PostRequestBuilder getBuilderAfterServerIndex(PostRequest instance) { - return this; - } - - public PostRequestBuilder getBuilderAfterTimeout(PostRequest instance) { - return this; - } - } -} diff --git a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/fakerefsboolean/post/FakerefsbooleanPostRequestBody.kt b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/fakerefsboolean/post/FakerefsbooleanPostRequestBody.kt deleted file mode 100644 index f05c18199a0..00000000000 --- a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/fakerefsboolean/post/FakerefsbooleanPostRequestBody.kt +++ /dev/null @@ -1,49 +0,0 @@ -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; -import org.openapijsonschematools.client.mediatype.MediaType; -import org.openapijsonschematools.client.paths.fakerefsboolean.post.requestbody.content.applicationjson.ApplicationjsonSchema; - -import java.util.AbstractMap; -import java.util.Map; - -public class FakerefsbooleanPostRequestBody { - public sealed interface SealedMediaType permits ApplicationjsonMediaType {} - - public record ApplicationjsonMediaType(ApplicationjsonSchema.ApplicationjsonSchema1 schema) implements SealedMediaType, MediaType { - public ApplicationjsonMediaType() { - this(ApplicationjsonSchema.ApplicationjsonSchema1.getInstance()); - } - @Override - public Nothing? encoding() { - return null; - } - } - - public static class FakerefsbooleanPostRequestBody1 extends RequestBodySerializer { - public FakerefsbooleanPostRequestBody1() { - super( - Map.ofEntries( - new AbstractMap.SimpleEntry<>("application/json", new ApplicationjsonMediaType()) - ), - false - ); - } - - public SerializedRequestBody serialize(SealedRequestBody requestBody) throws NotImplementedException { - ApplicationjsonRequestBody requestBody0 = (ApplicationjsonRequestBody) requestBody; - return serialize(requestBody0.contentType(), requestBody0.body().getData()); - } - } - - public sealed interface SealedRequestBody permits ApplicationjsonRequestBody {} - public record ApplicationjsonRequestBody(ApplicationjsonSchema.BooleanJsonSchema1Boxed body) implements SealedRequestBody, GenericRequestBody { - @Override - public String contentType() { - return "application/json"; - } - } -} diff --git a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/fakerefsboolean/post/FakerefsbooleanPostResponses.kt b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/fakerefsboolean/post/FakerefsbooleanPostResponses.kt deleted file mode 100644 index 7107926ba5e..00000000000 --- a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/fakerefsboolean/post/FakerefsbooleanPostResponses.kt +++ /dev/null @@ -1,53 +0,0 @@ -package org.openapijsonschematools.client.paths.fakerefsboolean.post; - -import org.openapijsonschematools.client.paths.fakerefsboolean.post.responses.FakerefsbooleanPostCode200Response; -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; -import org.checkerframework.checker.nullness.qual.Nullable; - -import java.net.http.HttpResponse; -import java.util.Map; -import java.util.AbstractMap; - -public class FakerefsbooleanPostResponses { - public sealed interface EndpointResponse permits EndpointFakerefsbooleanPostCode200Response {} - - public record EndpointFakerefsbooleanPostCode200Response( - HttpResponse response, - FakerefsbooleanPostCode200Response.SealedResponseBody body, - Nothing? headers - ) implements EndpointResponse, ApiResponse{ - } - - public sealed interface StatusCodeResponseDeserializer permits StatusFakerefsbooleanPostCode200ResponseDeserializer {} - - public static final class StatusFakerefsbooleanPostCode200ResponseDeserializer extends FakerefsbooleanPostCode200Response.FakerefsbooleanPostCode200Response1 implements StatusCodeResponseDeserializer { - } - - public static final class FakerefsbooleanPostResponses1 implements ResponsesDeserializer { - private final Map statusCodeToResponseDeserializer; - public FakerefsbooleanPostResponses1() { - this.statusCodeToResponseDeserializer = Map.ofEntries( - new AbstractMap.SimpleEntry<>("200", new StatusFakerefsbooleanPostCode200ResponseDeserializer()) - ); - } - - 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) { - throw new ApiException( - "Invalid response statusCode="+statusCode+" has no response defined in the openapi document", - response - ); - } - StatusFakerefsbooleanPostCode200ResponseDeserializer castDeserializer = (StatusFakerefsbooleanPostCode200ResponseDeserializer) statusCodeDeserializer; - var deserializedResponse = castDeserializer.deserialize(response, configuration); - return new EndpointFakerefsbooleanPostCode200Response(response, deserializedResponse.body(), deserializedResponse.headers()); - } - } -} diff --git a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/fakerefsboolean/post/requestbody/content/applicationjson/ApplicationjsonSchema.kt b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/fakerefsboolean/post/requestbody/content/applicationjson/ApplicationjsonSchema.kt deleted file mode 100644 index 6c465dba460..00000000000 --- a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/fakerefsboolean/post/requestbody/content/applicationjson/ApplicationjsonSchema.kt +++ /dev/null @@ -1,19 +0,0 @@ -package org.openapijsonschematools.client.paths.fakerefsboolean.post.requestbody.content.applicationjson; - -import org.checkerframework.checker.nullness.qual.Nullable; -import org.openapijsonschematools.client.components.schemas.BooleanSchema; - -public class ApplicationjsonSchema extends BooleanSchema { - // $refed class - - - public static class ApplicationjsonSchema1 extends BooleanSchema1 { - private static @Nullable ApplicationjsonSchema1 instance = null; - public static ApplicationjsonSchema1 getInstance() { - if (instance == null) { - instance = new ApplicationjsonSchema1(); - } - return instance; - } - } -} diff --git a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/fakerefsboolean/post/responses/FakerefsbooleanPostCode200Response.kt b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/fakerefsboolean/post/responses/FakerefsbooleanPostCode200Response.kt deleted file mode 100644 index b88873f707c..00000000000 --- a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/fakerefsboolean/post/responses/FakerefsbooleanPostCode200Response.kt +++ /dev/null @@ -1,63 +0,0 @@ -package org.openapijsonschematools.client.paths.fakerefsboolean.post.responses; - -import org.openapijsonschematools.client.configurations.SchemaConfiguration; -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; - -import java.util.AbstractMap; -import java.util.Map; -import java.net.http.HttpResponse; -import java.net.http.HttpHeaders; - -public class FakerefsbooleanPostCode200Response { - public sealed interface SealedMediaType permits ApplicationjsonMediaType {} - - public record ApplicationjsonMediaType(ApplicationjsonSchema.ApplicationjsonSchema1 schema) implements SealedMediaType, MediaType { - public ApplicationjsonMediaType() { - this(ApplicationjsonSchema.ApplicationjsonSchema1.getInstance()); - } - @Override - public Nothing? encoding() { - return null; - } - } - public sealed interface SealedResponseBody permits ApplicationjsonResponseBody {} - public record ApplicationjsonResponseBody(ApplicationjsonSchema.BooleanJsonSchema1Boxed body) implements SealedResponseBody { } - - public static class FakerefsbooleanPostCode200Response1 extends ResponseDeserializer { - public FakerefsbooleanPostCode200Response1() { - super( - Map.ofEntries( - new AbstractMap.SimpleEntry<>("application/json", new ApplicationjsonMediaType()) - ) - ); - } - - @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); - } - - @Override - protected Nothing? getHeaders(HttpHeaders headers, SchemaConfiguration configuration) { - return null; - } - } - - @SuppressWarnings("serial") - public static class ResponseApiException extends ApiException { - public DeserializedHttpResponse deserializedResponse; - - public ResponseApiException(String s, HttpResponse response, DeserializedHttpResponse deserializedResponse) { - super(s, response); - this.deserializedResponse = deserializedResponse; - } - } -} diff --git a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/fakerefsboolean/post/responses/code200response/content/applicationjson/ApplicationjsonSchema.kt b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/fakerefsboolean/post/responses/code200response/content/applicationjson/ApplicationjsonSchema.kt deleted file mode 100644 index 064050b09bf..00000000000 --- a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/fakerefsboolean/post/responses/code200response/content/applicationjson/ApplicationjsonSchema.kt +++ /dev/null @@ -1,19 +0,0 @@ -package org.openapijsonschematools.client.paths.fakerefsboolean.post.responses.code200response.content.applicationjson; - -import org.checkerframework.checker.nullness.qual.Nullable; -import org.openapijsonschematools.client.components.schemas.BooleanSchema; - -public class ApplicationjsonSchema extends BooleanSchema { - // $refed class - - - public static class ApplicationjsonSchema1 extends BooleanSchema1 { - private static @Nullable ApplicationjsonSchema1 instance = null; - public static ApplicationjsonSchema1 getInstance() { - if (instance == null) { - instance = new ApplicationjsonSchema1(); - } - return instance; - } - } -} diff --git a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/fakerefscomposedoneofnumberwithvalidations/FakerefscomposedoneofnumberwithvalidationsPost.kt b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/fakerefscomposedoneofnumberwithvalidations/FakerefscomposedoneofnumberwithvalidationsPost.kt deleted file mode 100644 index 6b1f0e40677..00000000000 --- a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/fakerefscomposedoneofnumberwithvalidations/FakerefscomposedoneofnumberwithvalidationsPost.kt +++ /dev/null @@ -1,152 +0,0 @@ -package org.openapijsonschematools.client.paths.fakerefscomposedoneofnumberwithvalidations; - -import org.checkerframework.checker.nullness.qual.Nullable; -import org.openapijsonschematools.client.paths.fakerefscomposedoneofnumberwithvalidations.post.FakerefscomposedoneofnumberwithvalidationsPostRequestBody; -import org.openapijsonschematools.client.RootServerInfo; -import org.openapijsonschematools.client.paths.fakerefscomposedoneofnumberwithvalidations.post.FakerefscomposedoneofnumberwithvalidationsPostResponses; -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.requestbody.SerializedRequestBody; -import org.openapijsonschematools.client.paths.Fakerefscomposedoneofnumberwithvalidations; - -import java.io.IOException; -import java.util.ArrayList; -import java.net.http.HttpClient; -import java.net.http.HttpRequest; -import java.time.Duration; -import java.util.List; -import java.util.Map; - -public class FakerefscomposedoneofnumberwithvalidationsPost { - private static class PostProvider { - private static final String method = "post"; - - public static FakerefscomposedoneofnumberwithvalidationsPostResponses.EndpointResponse post( - PostRequest request, - ApiConfiguration apiConfiguration, - SchemaConfiguration schemaConfiguration, - HttpClient client - ) throws IOException, InterruptedException, ValidationException, NotImplementedException, ApiException { - Map> headers = apiConfiguration.getDefaultHeaders(); - - @Nullable SerializedRequestBody serializedRequestBody; - HttpRequest.BodyPublisher bodyPublisher = HttpRequest.BodyPublishers.noBody(); - if (request.requestBody != null) { - serializedRequestBody = new FakerefscomposedoneofnumberwithvalidationsPostRequestBody.FakerefscomposedoneofnumberwithvalidationsPostRequestBody1().serialize( - request.requestBody - ); - var contentTypeHeaderValues = headers.getOrDefault("Content-Type", new ArrayList<>()); - contentTypeHeaderValues.add(serializedRequestBody.contentType); - bodyPublisher = serializedRequestBody.bodyPublisher; - } - // TODO set this to a map if there is a query security scheme - @Nullable Map queryMap = null; - String host = apiConfiguration.getServer(request.serverIndex).url(); - - String url = host + Fakerefscomposedoneofnumberwithvalidations.path; - var httpRequest = RestClient.getRequest( - url, - method, - bodyPublisher, - headers, - request.timeout - ); - var response = RestClient.getResponse(httpRequest, client); - var responsesDeserializer = new FakerefscomposedoneofnumberwithvalidationsPostResponses.FakerefscomposedoneofnumberwithvalidationsPostResponses1(); - return responsesDeserializer.deserialize(response, schemaConfiguration); - } - } - - public interface PostOperation { - ApiConfiguration getApiConfiguration(); - SchemaConfiguration getSchemaConfiguration(); - HttpClient getClient(); - default FakerefscomposedoneofnumberwithvalidationsPostResponses.EndpointResponse post(PostRequest request) throws IOException, InterruptedException, ValidationException, NotImplementedException, ApiException { - return PostProvider.post(request, getApiConfiguration(), getSchemaConfiguration(), getClient()); - } - } - - public interface ComposedOneOfDifferentTypesOperation { - ApiConfiguration getApiConfiguration(); - SchemaConfiguration getSchemaConfiguration(); - HttpClient getClient(); - default FakerefscomposedoneofnumberwithvalidationsPostResponses.EndpointResponse composedOneOfDifferentTypes(PostRequest request) throws IOException, InterruptedException, ValidationException, NotImplementedException, ApiException { - return PostProvider.post(request, getApiConfiguration(), getSchemaConfiguration(), getClient()); - } - } - - public static class Post extends ApiClient implements PostOperation { - public Post(ApiConfiguration apiConfiguration, SchemaConfiguration schemaConfiguration) { - super(apiConfiguration, schemaConfiguration); - } - } - - public static class PostRequest { - public FakerefscomposedoneofnumberwithvalidationsPostRequestBody.@Nullable SealedRequestBody requestBody; - public RootServerInfo.@Nullable ServerIndex serverIndex; - public @Nullable Duration timeout; - } - - public interface SetterForRequestBody { - PostRequest getInstance(); - T getBuilderAfterRequestBody(PostRequest instance); - default T requestBody(FakerefscomposedoneofnumberwithvalidationsPostRequestBody.SealedRequestBody requestBody) { - var instance = getInstance(); - instance.requestBody = requestBody; - return getBuilderAfterRequestBody(instance); - } - } - - public interface SetterForServerIndex { - PostRequest getInstance(); - T getBuilderAfterServerIndex(PostRequest instance); - default T serverIndex(RootServerInfo.ServerIndex serverIndex) { - var instance = getInstance(); - instance.serverIndex = serverIndex; - return getBuilderAfterServerIndex(instance); - } - } - - public interface SetterForTimeout { - PostRequest getInstance(); - T getBuilderAfterTimeout(PostRequest instance); - default T timeout(Duration timeout) { - var instance = getInstance(); - instance.timeout = timeout; - return getBuilderAfterTimeout(instance); - } - } - - public static class PostRequestBuilder implements SetterForRequestBody, SetterForServerIndex, SetterForTimeout { - private final PostRequest instance; - - public PostRequestBuilder() { - this.instance = new PostRequest(); - } - - public PostRequest build() { - return instance; - } - - public PostRequest getInstance() { - return instance; - } - - public PostRequestBuilder getBuilderAfterRequestBody(PostRequest instance) { - return this; - } - - public PostRequestBuilder getBuilderAfterServerIndex(PostRequest instance) { - return this; - } - - public PostRequestBuilder getBuilderAfterTimeout(PostRequest instance) { - return this; - } - } -} diff --git a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/fakerefscomposedoneofnumberwithvalidations/post/FakerefscomposedoneofnumberwithvalidationsPostRequestBody.kt b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/fakerefscomposedoneofnumberwithvalidations/post/FakerefscomposedoneofnumberwithvalidationsPostRequestBody.kt deleted file mode 100644 index 4950e00af58..00000000000 --- a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/fakerefscomposedoneofnumberwithvalidations/post/FakerefscomposedoneofnumberwithvalidationsPostRequestBody.kt +++ /dev/null @@ -1,49 +0,0 @@ -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; -import org.openapijsonschematools.client.mediatype.MediaType; -import org.openapijsonschematools.client.paths.fakerefscomposedoneofnumberwithvalidations.post.requestbody.content.applicationjson.ApplicationjsonSchema; - -import java.util.AbstractMap; -import java.util.Map; - -public class FakerefscomposedoneofnumberwithvalidationsPostRequestBody { - public sealed interface SealedMediaType permits ApplicationjsonMediaType {} - - public record ApplicationjsonMediaType(ApplicationjsonSchema.ApplicationjsonSchema1 schema) implements SealedMediaType, MediaType { - public ApplicationjsonMediaType() { - this(ApplicationjsonSchema.ApplicationjsonSchema1.getInstance()); - } - @Override - public Nothing? encoding() { - return null; - } - } - - public static class FakerefscomposedoneofnumberwithvalidationsPostRequestBody1 extends RequestBodySerializer { - public FakerefscomposedoneofnumberwithvalidationsPostRequestBody1() { - super( - Map.ofEntries( - new AbstractMap.SimpleEntry<>("application/json", new ApplicationjsonMediaType()) - ), - false - ); - } - - public SerializedRequestBody serialize(SealedRequestBody requestBody) throws NotImplementedException { - ApplicationjsonRequestBody requestBody0 = (ApplicationjsonRequestBody) requestBody; - return serialize(requestBody0.contentType(), requestBody0.body().getData()); - } - } - - public sealed interface SealedRequestBody permits ApplicationjsonRequestBody {} - public record ApplicationjsonRequestBody(ApplicationjsonSchema.ComposedOneOfDifferentTypes1Boxed body) implements SealedRequestBody, GenericRequestBody { - @Override - public String contentType() { - return "application/json"; - } - } -} diff --git a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/fakerefscomposedoneofnumberwithvalidations/post/FakerefscomposedoneofnumberwithvalidationsPostResponses.kt b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/fakerefscomposedoneofnumberwithvalidations/post/FakerefscomposedoneofnumberwithvalidationsPostResponses.kt deleted file mode 100644 index fe889d3065d..00000000000 --- a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/fakerefscomposedoneofnumberwithvalidations/post/FakerefscomposedoneofnumberwithvalidationsPostResponses.kt +++ /dev/null @@ -1,53 +0,0 @@ -package org.openapijsonschematools.client.paths.fakerefscomposedoneofnumberwithvalidations.post; - -import org.openapijsonschematools.client.paths.fakerefscomposedoneofnumberwithvalidations.post.responses.FakerefscomposedoneofnumberwithvalidationsPostCode200Response; -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; -import org.checkerframework.checker.nullness.qual.Nullable; - -import java.net.http.HttpResponse; -import java.util.Map; -import java.util.AbstractMap; - -public class FakerefscomposedoneofnumberwithvalidationsPostResponses { - public sealed interface EndpointResponse permits EndpointFakerefscomposedoneofnumberwithvalidationsPostCode200Response {} - - public record EndpointFakerefscomposedoneofnumberwithvalidationsPostCode200Response( - HttpResponse response, - FakerefscomposedoneofnumberwithvalidationsPostCode200Response.SealedResponseBody body, - Nothing? headers - ) implements EndpointResponse, ApiResponse{ - } - - public sealed interface StatusCodeResponseDeserializer permits StatusFakerefscomposedoneofnumberwithvalidationsPostCode200ResponseDeserializer {} - - public static final class StatusFakerefscomposedoneofnumberwithvalidationsPostCode200ResponseDeserializer extends FakerefscomposedoneofnumberwithvalidationsPostCode200Response.FakerefscomposedoneofnumberwithvalidationsPostCode200Response1 implements StatusCodeResponseDeserializer { - } - - public static final class FakerefscomposedoneofnumberwithvalidationsPostResponses1 implements ResponsesDeserializer { - private final Map statusCodeToResponseDeserializer; - public FakerefscomposedoneofnumberwithvalidationsPostResponses1() { - this.statusCodeToResponseDeserializer = Map.ofEntries( - new AbstractMap.SimpleEntry<>("200", new StatusFakerefscomposedoneofnumberwithvalidationsPostCode200ResponseDeserializer()) - ); - } - - 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) { - throw new ApiException( - "Invalid response statusCode="+statusCode+" has no response defined in the openapi document", - response - ); - } - StatusFakerefscomposedoneofnumberwithvalidationsPostCode200ResponseDeserializer castDeserializer = (StatusFakerefscomposedoneofnumberwithvalidationsPostCode200ResponseDeserializer) statusCodeDeserializer; - var deserializedResponse = castDeserializer.deserialize(response, configuration); - return new EndpointFakerefscomposedoneofnumberwithvalidationsPostCode200Response(response, deserializedResponse.body(), deserializedResponse.headers()); - } - } -} diff --git a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/fakerefscomposedoneofnumberwithvalidations/post/requestbody/content/applicationjson/ApplicationjsonSchema.kt b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/fakerefscomposedoneofnumberwithvalidations/post/requestbody/content/applicationjson/ApplicationjsonSchema.kt deleted file mode 100644 index 312ee20f0d4..00000000000 --- a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/fakerefscomposedoneofnumberwithvalidations/post/requestbody/content/applicationjson/ApplicationjsonSchema.kt +++ /dev/null @@ -1,19 +0,0 @@ -package org.openapijsonschematools.client.paths.fakerefscomposedoneofnumberwithvalidations.post.requestbody.content.applicationjson; - -import org.checkerframework.checker.nullness.qual.Nullable; -import org.openapijsonschematools.client.components.schemas.ComposedOneOfDifferentTypes; - -public class ApplicationjsonSchema extends ComposedOneOfDifferentTypes { - // $refed class - - - public static class ApplicationjsonSchema1 extends ComposedOneOfDifferentTypes1 { - private static @Nullable ApplicationjsonSchema1 instance = null; - public static ApplicationjsonSchema1 getInstance() { - if (instance == null) { - instance = new ApplicationjsonSchema1(); - } - return instance; - } - } -} diff --git a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/fakerefscomposedoneofnumberwithvalidations/post/responses/FakerefscomposedoneofnumberwithvalidationsPostCode200Response.kt b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/fakerefscomposedoneofnumberwithvalidations/post/responses/FakerefscomposedoneofnumberwithvalidationsPostCode200Response.kt deleted file mode 100644 index 365fee0a507..00000000000 --- a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/fakerefscomposedoneofnumberwithvalidations/post/responses/FakerefscomposedoneofnumberwithvalidationsPostCode200Response.kt +++ /dev/null @@ -1,63 +0,0 @@ -package org.openapijsonschematools.client.paths.fakerefscomposedoneofnumberwithvalidations.post.responses; - -import org.openapijsonschematools.client.configurations.SchemaConfiguration; -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; - -import java.util.AbstractMap; -import java.util.Map; -import java.net.http.HttpResponse; -import java.net.http.HttpHeaders; - -public class FakerefscomposedoneofnumberwithvalidationsPostCode200Response { - public sealed interface SealedMediaType permits ApplicationjsonMediaType {} - - public record ApplicationjsonMediaType(ApplicationjsonSchema.ApplicationjsonSchema1 schema) implements SealedMediaType, MediaType { - public ApplicationjsonMediaType() { - this(ApplicationjsonSchema.ApplicationjsonSchema1.getInstance()); - } - @Override - public Nothing? encoding() { - return null; - } - } - public sealed interface SealedResponseBody permits ApplicationjsonResponseBody {} - public record ApplicationjsonResponseBody(ApplicationjsonSchema.ComposedOneOfDifferentTypes1Boxed body) implements SealedResponseBody { } - - public static class FakerefscomposedoneofnumberwithvalidationsPostCode200Response1 extends ResponseDeserializer { - public FakerefscomposedoneofnumberwithvalidationsPostCode200Response1() { - super( - Map.ofEntries( - new AbstractMap.SimpleEntry<>("application/json", new ApplicationjsonMediaType()) - ) - ); - } - - @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); - } - - @Override - protected Nothing? getHeaders(HttpHeaders headers, SchemaConfiguration configuration) { - return null; - } - } - - @SuppressWarnings("serial") - public static class ResponseApiException extends ApiException { - public DeserializedHttpResponse deserializedResponse; - - public ResponseApiException(String s, HttpResponse response, DeserializedHttpResponse deserializedResponse) { - super(s, response); - this.deserializedResponse = deserializedResponse; - } - } -} diff --git a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/fakerefscomposedoneofnumberwithvalidations/post/responses/code200response/content/applicationjson/ApplicationjsonSchema.kt b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/fakerefscomposedoneofnumberwithvalidations/post/responses/code200response/content/applicationjson/ApplicationjsonSchema.kt deleted file mode 100644 index 075b7ade4dd..00000000000 --- a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/fakerefscomposedoneofnumberwithvalidations/post/responses/code200response/content/applicationjson/ApplicationjsonSchema.kt +++ /dev/null @@ -1,19 +0,0 @@ -package org.openapijsonschematools.client.paths.fakerefscomposedoneofnumberwithvalidations.post.responses.code200response.content.applicationjson; - -import org.checkerframework.checker.nullness.qual.Nullable; -import org.openapijsonschematools.client.components.schemas.ComposedOneOfDifferentTypes; - -public class ApplicationjsonSchema extends ComposedOneOfDifferentTypes { - // $refed class - - - public static class ApplicationjsonSchema1 extends ComposedOneOfDifferentTypes1 { - private static @Nullable ApplicationjsonSchema1 instance = null; - public static ApplicationjsonSchema1 getInstance() { - if (instance == null) { - instance = new ApplicationjsonSchema1(); - } - return instance; - } - } -} diff --git a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/fakerefsenum/FakerefsenumPost.kt b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/fakerefsenum/FakerefsenumPost.kt deleted file mode 100644 index 83b9713931f..00000000000 --- a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/fakerefsenum/FakerefsenumPost.kt +++ /dev/null @@ -1,152 +0,0 @@ -package org.openapijsonschematools.client.paths.fakerefsenum; - -import org.checkerframework.checker.nullness.qual.Nullable; -import org.openapijsonschematools.client.paths.fakerefsenum.post.FakerefsenumPostRequestBody; -import org.openapijsonschematools.client.RootServerInfo; -import org.openapijsonschematools.client.paths.fakerefsenum.post.FakerefsenumPostResponses; -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.requestbody.SerializedRequestBody; -import org.openapijsonschematools.client.paths.Fakerefsenum; - -import java.io.IOException; -import java.util.ArrayList; -import java.net.http.HttpClient; -import java.net.http.HttpRequest; -import java.time.Duration; -import java.util.List; -import java.util.Map; - -public class FakerefsenumPost { - private static class PostProvider { - private static final String method = "post"; - - public static FakerefsenumPostResponses.EndpointResponse post( - PostRequest request, - ApiConfiguration apiConfiguration, - SchemaConfiguration schemaConfiguration, - HttpClient client - ) throws IOException, InterruptedException, ValidationException, NotImplementedException, ApiException { - Map> headers = apiConfiguration.getDefaultHeaders(); - - @Nullable SerializedRequestBody serializedRequestBody; - HttpRequest.BodyPublisher bodyPublisher = HttpRequest.BodyPublishers.noBody(); - if (request.requestBody != null) { - serializedRequestBody = new FakerefsenumPostRequestBody.FakerefsenumPostRequestBody1().serialize( - request.requestBody - ); - var contentTypeHeaderValues = headers.getOrDefault("Content-Type", new ArrayList<>()); - contentTypeHeaderValues.add(serializedRequestBody.contentType); - bodyPublisher = serializedRequestBody.bodyPublisher; - } - // TODO set this to a map if there is a query security scheme - @Nullable Map queryMap = null; - String host = apiConfiguration.getServer(request.serverIndex).url(); - - String url = host + Fakerefsenum.path; - var httpRequest = RestClient.getRequest( - url, - method, - bodyPublisher, - headers, - request.timeout - ); - var response = RestClient.getResponse(httpRequest, client); - var responsesDeserializer = new FakerefsenumPostResponses.FakerefsenumPostResponses1(); - return responsesDeserializer.deserialize(response, schemaConfiguration); - } - } - - public interface PostOperation { - ApiConfiguration getApiConfiguration(); - SchemaConfiguration getSchemaConfiguration(); - HttpClient getClient(); - default FakerefsenumPostResponses.EndpointResponse post(PostRequest request) throws IOException, InterruptedException, ValidationException, NotImplementedException, ApiException { - return PostProvider.post(request, getApiConfiguration(), getSchemaConfiguration(), getClient()); - } - } - - public interface StringEnumOperation { - ApiConfiguration getApiConfiguration(); - SchemaConfiguration getSchemaConfiguration(); - HttpClient getClient(); - default FakerefsenumPostResponses.EndpointResponse stringEnum(PostRequest request) throws IOException, InterruptedException, ValidationException, NotImplementedException, ApiException { - return PostProvider.post(request, getApiConfiguration(), getSchemaConfiguration(), getClient()); - } - } - - public static class Post extends ApiClient implements PostOperation { - public Post(ApiConfiguration apiConfiguration, SchemaConfiguration schemaConfiguration) { - super(apiConfiguration, schemaConfiguration); - } - } - - public static class PostRequest { - public FakerefsenumPostRequestBody.@Nullable SealedRequestBody requestBody; - public RootServerInfo.@Nullable ServerIndex serverIndex; - public @Nullable Duration timeout; - } - - public interface SetterForRequestBody { - PostRequest getInstance(); - T getBuilderAfterRequestBody(PostRequest instance); - default T requestBody(FakerefsenumPostRequestBody.SealedRequestBody requestBody) { - var instance = getInstance(); - instance.requestBody = requestBody; - return getBuilderAfterRequestBody(instance); - } - } - - public interface SetterForServerIndex { - PostRequest getInstance(); - T getBuilderAfterServerIndex(PostRequest instance); - default T serverIndex(RootServerInfo.ServerIndex serverIndex) { - var instance = getInstance(); - instance.serverIndex = serverIndex; - return getBuilderAfterServerIndex(instance); - } - } - - public interface SetterForTimeout { - PostRequest getInstance(); - T getBuilderAfterTimeout(PostRequest instance); - default T timeout(Duration timeout) { - var instance = getInstance(); - instance.timeout = timeout; - return getBuilderAfterTimeout(instance); - } - } - - public static class PostRequestBuilder implements SetterForRequestBody, SetterForServerIndex, SetterForTimeout { - private final PostRequest instance; - - public PostRequestBuilder() { - this.instance = new PostRequest(); - } - - public PostRequest build() { - return instance; - } - - public PostRequest getInstance() { - return instance; - } - - public PostRequestBuilder getBuilderAfterRequestBody(PostRequest instance) { - return this; - } - - public PostRequestBuilder getBuilderAfterServerIndex(PostRequest instance) { - return this; - } - - public PostRequestBuilder getBuilderAfterTimeout(PostRequest instance) { - return this; - } - } -} diff --git a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/fakerefsenum/post/FakerefsenumPostRequestBody.kt b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/fakerefsenum/post/FakerefsenumPostRequestBody.kt deleted file mode 100644 index 03be0960455..00000000000 --- a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/fakerefsenum/post/FakerefsenumPostRequestBody.kt +++ /dev/null @@ -1,49 +0,0 @@ -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; -import org.openapijsonschematools.client.mediatype.MediaType; -import org.openapijsonschematools.client.paths.fakerefsenum.post.requestbody.content.applicationjson.ApplicationjsonSchema; - -import java.util.AbstractMap; -import java.util.Map; - -public class FakerefsenumPostRequestBody { - public sealed interface SealedMediaType permits ApplicationjsonMediaType {} - - public record ApplicationjsonMediaType(ApplicationjsonSchema.ApplicationjsonSchema1 schema) implements SealedMediaType, MediaType { - public ApplicationjsonMediaType() { - this(ApplicationjsonSchema.ApplicationjsonSchema1.getInstance()); - } - @Override - public Nothing? encoding() { - return null; - } - } - - public static class FakerefsenumPostRequestBody1 extends RequestBodySerializer { - public FakerefsenumPostRequestBody1() { - super( - Map.ofEntries( - new AbstractMap.SimpleEntry<>("application/json", new ApplicationjsonMediaType()) - ), - false - ); - } - - public SerializedRequestBody serialize(SealedRequestBody requestBody) throws NotImplementedException { - ApplicationjsonRequestBody requestBody0 = (ApplicationjsonRequestBody) requestBody; - return serialize(requestBody0.contentType(), requestBody0.body().getData()); - } - } - - public sealed interface SealedRequestBody permits ApplicationjsonRequestBody {} - public record ApplicationjsonRequestBody(ApplicationjsonSchema.StringEnum1Boxed body) implements SealedRequestBody, GenericRequestBody { - @Override - public String contentType() { - return "application/json"; - } - } -} diff --git a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/fakerefsenum/post/FakerefsenumPostResponses.kt b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/fakerefsenum/post/FakerefsenumPostResponses.kt deleted file mode 100644 index 7975189f2a4..00000000000 --- a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/fakerefsenum/post/FakerefsenumPostResponses.kt +++ /dev/null @@ -1,53 +0,0 @@ -package org.openapijsonschematools.client.paths.fakerefsenum.post; - -import org.openapijsonschematools.client.paths.fakerefsenum.post.responses.FakerefsenumPostCode200Response; -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; -import org.checkerframework.checker.nullness.qual.Nullable; - -import java.net.http.HttpResponse; -import java.util.Map; -import java.util.AbstractMap; - -public class FakerefsenumPostResponses { - public sealed interface EndpointResponse permits EndpointFakerefsenumPostCode200Response {} - - public record EndpointFakerefsenumPostCode200Response( - HttpResponse response, - FakerefsenumPostCode200Response.SealedResponseBody body, - Nothing? headers - ) implements EndpointResponse, ApiResponse{ - } - - public sealed interface StatusCodeResponseDeserializer permits StatusFakerefsenumPostCode200ResponseDeserializer {} - - public static final class StatusFakerefsenumPostCode200ResponseDeserializer extends FakerefsenumPostCode200Response.FakerefsenumPostCode200Response1 implements StatusCodeResponseDeserializer { - } - - public static final class FakerefsenumPostResponses1 implements ResponsesDeserializer { - private final Map statusCodeToResponseDeserializer; - public FakerefsenumPostResponses1() { - this.statusCodeToResponseDeserializer = Map.ofEntries( - new AbstractMap.SimpleEntry<>("200", new StatusFakerefsenumPostCode200ResponseDeserializer()) - ); - } - - 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) { - throw new ApiException( - "Invalid response statusCode="+statusCode+" has no response defined in the openapi document", - response - ); - } - StatusFakerefsenumPostCode200ResponseDeserializer castDeserializer = (StatusFakerefsenumPostCode200ResponseDeserializer) statusCodeDeserializer; - var deserializedResponse = castDeserializer.deserialize(response, configuration); - return new EndpointFakerefsenumPostCode200Response(response, deserializedResponse.body(), deserializedResponse.headers()); - } - } -} diff --git a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/fakerefsenum/post/requestbody/content/applicationjson/ApplicationjsonSchema.kt b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/fakerefsenum/post/requestbody/content/applicationjson/ApplicationjsonSchema.kt deleted file mode 100644 index 556d7c6a72f..00000000000 --- a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/fakerefsenum/post/requestbody/content/applicationjson/ApplicationjsonSchema.kt +++ /dev/null @@ -1,19 +0,0 @@ -package org.openapijsonschematools.client.paths.fakerefsenum.post.requestbody.content.applicationjson; - -import org.checkerframework.checker.nullness.qual.Nullable; -import org.openapijsonschematools.client.components.schemas.StringEnum; - -public class ApplicationjsonSchema extends StringEnum { - // $refed class - - - public static class ApplicationjsonSchema1 extends StringEnum1 { - private static @Nullable ApplicationjsonSchema1 instance = null; - public static ApplicationjsonSchema1 getInstance() { - if (instance == null) { - instance = new ApplicationjsonSchema1(); - } - return instance; - } - } -} diff --git a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/fakerefsenum/post/responses/FakerefsenumPostCode200Response.kt b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/fakerefsenum/post/responses/FakerefsenumPostCode200Response.kt deleted file mode 100644 index ed3c3e7deb2..00000000000 --- a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/fakerefsenum/post/responses/FakerefsenumPostCode200Response.kt +++ /dev/null @@ -1,63 +0,0 @@ -package org.openapijsonschematools.client.paths.fakerefsenum.post.responses; - -import org.openapijsonschematools.client.configurations.SchemaConfiguration; -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; - -import java.util.AbstractMap; -import java.util.Map; -import java.net.http.HttpResponse; -import java.net.http.HttpHeaders; - -public class FakerefsenumPostCode200Response { - public sealed interface SealedMediaType permits ApplicationjsonMediaType {} - - public record ApplicationjsonMediaType(ApplicationjsonSchema.ApplicationjsonSchema1 schema) implements SealedMediaType, MediaType { - public ApplicationjsonMediaType() { - this(ApplicationjsonSchema.ApplicationjsonSchema1.getInstance()); - } - @Override - public Nothing? encoding() { - return null; - } - } - public sealed interface SealedResponseBody permits ApplicationjsonResponseBody {} - public record ApplicationjsonResponseBody(ApplicationjsonSchema.StringEnum1Boxed body) implements SealedResponseBody { } - - public static class FakerefsenumPostCode200Response1 extends ResponseDeserializer { - public FakerefsenumPostCode200Response1() { - super( - Map.ofEntries( - new AbstractMap.SimpleEntry<>("application/json", new ApplicationjsonMediaType()) - ) - ); - } - - @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); - } - - @Override - protected Nothing? getHeaders(HttpHeaders headers, SchemaConfiguration configuration) { - return null; - } - } - - @SuppressWarnings("serial") - public static class ResponseApiException extends ApiException { - public DeserializedHttpResponse deserializedResponse; - - public ResponseApiException(String s, HttpResponse response, DeserializedHttpResponse deserializedResponse) { - super(s, response); - this.deserializedResponse = deserializedResponse; - } - } -} diff --git a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/fakerefsenum/post/responses/code200response/content/applicationjson/ApplicationjsonSchema.kt b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/fakerefsenum/post/responses/code200response/content/applicationjson/ApplicationjsonSchema.kt deleted file mode 100644 index f32e80d609f..00000000000 --- a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/fakerefsenum/post/responses/code200response/content/applicationjson/ApplicationjsonSchema.kt +++ /dev/null @@ -1,19 +0,0 @@ -package org.openapijsonschematools.client.paths.fakerefsenum.post.responses.code200response.content.applicationjson; - -import org.checkerframework.checker.nullness.qual.Nullable; -import org.openapijsonschematools.client.components.schemas.StringEnum; - -public class ApplicationjsonSchema extends StringEnum { - // $refed class - - - public static class ApplicationjsonSchema1 extends StringEnum1 { - private static @Nullable ApplicationjsonSchema1 instance = null; - public static ApplicationjsonSchema1 getInstance() { - if (instance == null) { - instance = new ApplicationjsonSchema1(); - } - return instance; - } - } -} diff --git a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/fakerefsmammal/FakerefsmammalPost.kt b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/fakerefsmammal/FakerefsmammalPost.kt deleted file mode 100644 index 1107280199a..00000000000 --- a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/fakerefsmammal/FakerefsmammalPost.kt +++ /dev/null @@ -1,183 +0,0 @@ -package org.openapijsonschematools.client.paths.fakerefsmammal; - -import org.checkerframework.checker.nullness.qual.Nullable; -import org.openapijsonschematools.client.RootServerInfo; -import org.openapijsonschematools.client.paths.fakerefsmammal.post.FakerefsmammalPostRequestBody; -import org.openapijsonschematools.client.paths.fakerefsmammal.post.FakerefsmammalPostResponses; -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.requestbody.SerializedRequestBody; -import org.openapijsonschematools.client.paths.Fakerefsmammal; - -import java.io.IOException; -import java.util.ArrayList; -import java.net.http.HttpClient; -import java.net.http.HttpRequest; -import java.time.Duration; -import java.util.List; -import java.util.Map; - -public class FakerefsmammalPost { - private static class PostProvider { - private static final String method = "post"; - - public static FakerefsmammalPostResponses.EndpointResponse post( - PostRequest request, - ApiConfiguration apiConfiguration, - SchemaConfiguration schemaConfiguration, - HttpClient client - ) throws IOException, InterruptedException, ValidationException, NotImplementedException, ApiException { - Map> headers = apiConfiguration.getDefaultHeaders(); - - SerializedRequestBody serializedRequestBody = new FakerefsmammalPostRequestBody.FakerefsmammalPostRequestBody1().serialize( - request.requestBody - ); - var contentTypeHeaderValues = headers.getOrDefault("Content-Type", new ArrayList<>()); - contentTypeHeaderValues.add(serializedRequestBody.contentType); - HttpRequest.BodyPublisher bodyPublisher = serializedRequestBody.bodyPublisher; - // TODO set this to a map if there is a query security scheme - @Nullable Map queryMap = null; - String host = apiConfiguration.getServer(request.serverIndex).url(); - - String url = host + Fakerefsmammal.path; - var httpRequest = RestClient.getRequest( - url, - method, - bodyPublisher, - headers, - request.timeout - ); - var response = RestClient.getResponse(httpRequest, client); - var responsesDeserializer = new FakerefsmammalPostResponses.FakerefsmammalPostResponses1(); - return responsesDeserializer.deserialize(response, schemaConfiguration); - } - } - - public interface PostOperation { - ApiConfiguration getApiConfiguration(); - SchemaConfiguration getSchemaConfiguration(); - HttpClient getClient(); - default FakerefsmammalPostResponses.EndpointResponse post(PostRequest request) throws IOException, InterruptedException, ValidationException, NotImplementedException, ApiException { - return PostProvider.post(request, getApiConfiguration(), getSchemaConfiguration(), getClient()); - } - } - - public interface MammalOperation { - ApiConfiguration getApiConfiguration(); - SchemaConfiguration getSchemaConfiguration(); - HttpClient getClient(); - default FakerefsmammalPostResponses.EndpointResponse mammal(PostRequest request) throws IOException, InterruptedException, ValidationException, NotImplementedException, ApiException { - return PostProvider.post(request, getApiConfiguration(), getSchemaConfiguration(), getClient()); - } - } - - public static class Post extends ApiClient implements PostOperation { - public Post(ApiConfiguration apiConfiguration, SchemaConfiguration schemaConfiguration) { - super(apiConfiguration, schemaConfiguration); - } - } - - public static class PostRequest { - public FakerefsmammalPostRequestBody.SealedRequestBody requestBody; - public RootServerInfo.@Nullable ServerIndex serverIndex; - public @Nullable Duration timeout; - - public PostRequest( - FakerefsmammalPostRequestBody.SealedRequestBody requestBody, - RootServerInfo.@Nullable ServerIndex serverIndex, - @Nullable Duration timeout - ) { - this.requestBody = requestBody; - this.serverIndex = serverIndex; - this.timeout = timeout; - } - } - - public static class PostNullableRequest { - public FakerefsmammalPostRequestBody.@Nullable SealedRequestBody requestBody; - public RootServerInfo.@Nullable ServerIndex serverIndex; - public @Nullable Duration timeout; - } - - public interface SetterForServerIndex { - PostNullableRequest getInstance(); - T getBuilderAfterServerIndex(PostNullableRequest instance); - default T serverIndex(RootServerInfo.ServerIndex serverIndex) { - var instance = getInstance(); - instance.serverIndex = serverIndex; - return getBuilderAfterServerIndex(instance); - } - } - - public interface SetterForTimeout { - PostNullableRequest getInstance(); - T getBuilderAfterTimeout(PostNullableRequest instance); - default T timeout(Duration timeout) { - var instance = getInstance(); - instance.timeout = timeout; - return getBuilderAfterTimeout(instance); - } - } - - public interface SetterForRequestBody { - PostNullableRequest getInstance(); - T getBuilderAfterRequestBody(PostNullableRequest instance); - default T requestBody(FakerefsmammalPostRequestBody.SealedRequestBody requestBody) { - var instance = getInstance(); - instance.requestBody = requestBody; - return getBuilderAfterRequestBody(instance); - } - } - - public static class Post0RequestBuilder implements SetterForServerIndex, SetterForTimeout { - private final PostNullableRequest instance; - - public Post0RequestBuilder(PostNullableRequest instance) { - this.instance = instance; - } - - public PostRequest build() { - var requestBody = instance.requestBody; - if (requestBody == null) { - throw new RuntimeException("invalid null value for required parameter"); - } - return new PostRequest( - requestBody, - instance.serverIndex, - instance.timeout - ); - } - - public PostNullableRequest getInstance() { - return instance; - } - - public Post0RequestBuilder getBuilderAfterServerIndex(PostNullableRequest instance) { - return this; - } - - public Post0RequestBuilder getBuilderAfterTimeout(PostNullableRequest instance) { - return this; - } - } - public static class PostRequestBuilder implements SetterForRequestBody { - private final PostNullableRequest instance; - - public PostRequestBuilder() { - this.instance = new PostNullableRequest(); - } - - public PostNullableRequest getInstance() { - return instance; - } - - public Post0RequestBuilder getBuilderAfterRequestBody(PostNullableRequest instance) { - return new Post0RequestBuilder(instance); - } - } -} diff --git a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/fakerefsmammal/post/FakerefsmammalPostRequestBody.kt b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/fakerefsmammal/post/FakerefsmammalPostRequestBody.kt deleted file mode 100644 index 0ab73e9ef73..00000000000 --- a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/fakerefsmammal/post/FakerefsmammalPostRequestBody.kt +++ /dev/null @@ -1,49 +0,0 @@ -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; -import org.openapijsonschematools.client.mediatype.MediaType; -import org.openapijsonschematools.client.paths.fakerefsmammal.post.requestbody.content.applicationjson.ApplicationjsonSchema; - -import java.util.AbstractMap; -import java.util.Map; - -public class FakerefsmammalPostRequestBody { - public sealed interface SealedMediaType permits ApplicationjsonMediaType {} - - public record ApplicationjsonMediaType(ApplicationjsonSchema.ApplicationjsonSchema1 schema) implements SealedMediaType, MediaType { - public ApplicationjsonMediaType() { - this(ApplicationjsonSchema.ApplicationjsonSchema1.getInstance()); - } - @Override - public Nothing? encoding() { - return null; - } - } - - public static class FakerefsmammalPostRequestBody1 extends RequestBodySerializer { - public FakerefsmammalPostRequestBody1() { - super( - Map.ofEntries( - new AbstractMap.SimpleEntry<>("application/json", new ApplicationjsonMediaType()) - ), - true - ); - } - - public SerializedRequestBody serialize(SealedRequestBody requestBody) throws NotImplementedException { - ApplicationjsonRequestBody requestBody0 = (ApplicationjsonRequestBody) requestBody; - return serialize(requestBody0.contentType(), requestBody0.body().getData()); - } - } - - public sealed interface SealedRequestBody permits ApplicationjsonRequestBody {} - public record ApplicationjsonRequestBody(ApplicationjsonSchema.Mammal1Boxed body) implements SealedRequestBody, GenericRequestBody { - @Override - public String contentType() { - return "application/json"; - } - } -} diff --git a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/fakerefsmammal/post/FakerefsmammalPostResponses.kt b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/fakerefsmammal/post/FakerefsmammalPostResponses.kt deleted file mode 100644 index c563c208719..00000000000 --- a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/fakerefsmammal/post/FakerefsmammalPostResponses.kt +++ /dev/null @@ -1,53 +0,0 @@ -package org.openapijsonschematools.client.paths.fakerefsmammal.post; - -import org.openapijsonschematools.client.paths.fakerefsmammal.post.responses.FakerefsmammalPostCode200Response; -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; -import org.checkerframework.checker.nullness.qual.Nullable; - -import java.net.http.HttpResponse; -import java.util.Map; -import java.util.AbstractMap; - -public class FakerefsmammalPostResponses { - public sealed interface EndpointResponse permits EndpointFakerefsmammalPostCode200Response {} - - public record EndpointFakerefsmammalPostCode200Response( - HttpResponse response, - FakerefsmammalPostCode200Response.SealedResponseBody body, - Nothing? headers - ) implements EndpointResponse, ApiResponse{ - } - - public sealed interface StatusCodeResponseDeserializer permits StatusFakerefsmammalPostCode200ResponseDeserializer {} - - public static final class StatusFakerefsmammalPostCode200ResponseDeserializer extends FakerefsmammalPostCode200Response.FakerefsmammalPostCode200Response1 implements StatusCodeResponseDeserializer { - } - - public static final class FakerefsmammalPostResponses1 implements ResponsesDeserializer { - private final Map statusCodeToResponseDeserializer; - public FakerefsmammalPostResponses1() { - this.statusCodeToResponseDeserializer = Map.ofEntries( - new AbstractMap.SimpleEntry<>("200", new StatusFakerefsmammalPostCode200ResponseDeserializer()) - ); - } - - 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) { - throw new ApiException( - "Invalid response statusCode="+statusCode+" has no response defined in the openapi document", - response - ); - } - StatusFakerefsmammalPostCode200ResponseDeserializer castDeserializer = (StatusFakerefsmammalPostCode200ResponseDeserializer) statusCodeDeserializer; - var deserializedResponse = castDeserializer.deserialize(response, configuration); - return new EndpointFakerefsmammalPostCode200Response(response, deserializedResponse.body(), deserializedResponse.headers()); - } - } -} diff --git a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/fakerefsmammal/post/requestbody/content/applicationjson/ApplicationjsonSchema.kt b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/fakerefsmammal/post/requestbody/content/applicationjson/ApplicationjsonSchema.kt deleted file mode 100644 index a85a80fb124..00000000000 --- a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/fakerefsmammal/post/requestbody/content/applicationjson/ApplicationjsonSchema.kt +++ /dev/null @@ -1,19 +0,0 @@ -package org.openapijsonschematools.client.paths.fakerefsmammal.post.requestbody.content.applicationjson; - -import org.checkerframework.checker.nullness.qual.Nullable; -import org.openapijsonschematools.client.components.schemas.Mammal; - -public class ApplicationjsonSchema extends Mammal { - // $refed class - - - public static class ApplicationjsonSchema1 extends Mammal1 { - private static @Nullable ApplicationjsonSchema1 instance = null; - public static ApplicationjsonSchema1 getInstance() { - if (instance == null) { - instance = new ApplicationjsonSchema1(); - } - return instance; - } - } -} diff --git a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/fakerefsmammal/post/responses/FakerefsmammalPostCode200Response.kt b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/fakerefsmammal/post/responses/FakerefsmammalPostCode200Response.kt deleted file mode 100644 index 4f41b969e6b..00000000000 --- a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/fakerefsmammal/post/responses/FakerefsmammalPostCode200Response.kt +++ /dev/null @@ -1,63 +0,0 @@ -package org.openapijsonschematools.client.paths.fakerefsmammal.post.responses; - -import org.openapijsonschematools.client.configurations.SchemaConfiguration; -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; - -import java.util.AbstractMap; -import java.util.Map; -import java.net.http.HttpResponse; -import java.net.http.HttpHeaders; - -public class FakerefsmammalPostCode200Response { - public sealed interface SealedMediaType permits ApplicationjsonMediaType {} - - public record ApplicationjsonMediaType(ApplicationjsonSchema.ApplicationjsonSchema1 schema) implements SealedMediaType, MediaType { - public ApplicationjsonMediaType() { - this(ApplicationjsonSchema.ApplicationjsonSchema1.getInstance()); - } - @Override - public Nothing? encoding() { - return null; - } - } - public sealed interface SealedResponseBody permits ApplicationjsonResponseBody {} - public record ApplicationjsonResponseBody(ApplicationjsonSchema.Mammal1Boxed body) implements SealedResponseBody { } - - public static class FakerefsmammalPostCode200Response1 extends ResponseDeserializer { - public FakerefsmammalPostCode200Response1() { - super( - Map.ofEntries( - new AbstractMap.SimpleEntry<>("application/json", new ApplicationjsonMediaType()) - ) - ); - } - - @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); - } - - @Override - protected Nothing? getHeaders(HttpHeaders headers, SchemaConfiguration configuration) { - return null; - } - } - - @SuppressWarnings("serial") - public static class ResponseApiException extends ApiException { - public DeserializedHttpResponse deserializedResponse; - - public ResponseApiException(String s, HttpResponse response, DeserializedHttpResponse deserializedResponse) { - super(s, response); - this.deserializedResponse = deserializedResponse; - } - } -} diff --git a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/fakerefsmammal/post/responses/code200response/content/applicationjson/ApplicationjsonSchema.kt b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/fakerefsmammal/post/responses/code200response/content/applicationjson/ApplicationjsonSchema.kt deleted file mode 100644 index 89dac1bf71a..00000000000 --- a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/fakerefsmammal/post/responses/code200response/content/applicationjson/ApplicationjsonSchema.kt +++ /dev/null @@ -1,19 +0,0 @@ -package org.openapijsonschematools.client.paths.fakerefsmammal.post.responses.code200response.content.applicationjson; - -import org.checkerframework.checker.nullness.qual.Nullable; -import org.openapijsonschematools.client.components.schemas.Mammal; - -public class ApplicationjsonSchema extends Mammal { - // $refed class - - - public static class ApplicationjsonSchema1 extends Mammal1 { - private static @Nullable ApplicationjsonSchema1 instance = null; - public static ApplicationjsonSchema1 getInstance() { - if (instance == null) { - instance = new ApplicationjsonSchema1(); - } - return instance; - } - } -} diff --git a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/fakerefsnumber/FakerefsnumberPost.kt b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/fakerefsnumber/FakerefsnumberPost.kt deleted file mode 100644 index 1d1a42bd13b..00000000000 --- a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/fakerefsnumber/FakerefsnumberPost.kt +++ /dev/null @@ -1,152 +0,0 @@ -package org.openapijsonschematools.client.paths.fakerefsnumber; - -import org.checkerframework.checker.nullness.qual.Nullable; -import org.openapijsonschematools.client.paths.fakerefsnumber.post.FakerefsnumberPostRequestBody; -import org.openapijsonschematools.client.RootServerInfo; -import org.openapijsonschematools.client.paths.fakerefsnumber.post.FakerefsnumberPostResponses; -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.requestbody.SerializedRequestBody; -import org.openapijsonschematools.client.paths.Fakerefsnumber; - -import java.io.IOException; -import java.util.ArrayList; -import java.net.http.HttpClient; -import java.net.http.HttpRequest; -import java.time.Duration; -import java.util.List; -import java.util.Map; - -public class FakerefsnumberPost { - private static class PostProvider { - private static final String method = "post"; - - public static FakerefsnumberPostResponses.EndpointResponse post( - PostRequest request, - ApiConfiguration apiConfiguration, - SchemaConfiguration schemaConfiguration, - HttpClient client - ) throws IOException, InterruptedException, ValidationException, NotImplementedException, ApiException { - Map> headers = apiConfiguration.getDefaultHeaders(); - - @Nullable SerializedRequestBody serializedRequestBody; - HttpRequest.BodyPublisher bodyPublisher = HttpRequest.BodyPublishers.noBody(); - if (request.requestBody != null) { - serializedRequestBody = new FakerefsnumberPostRequestBody.FakerefsnumberPostRequestBody1().serialize( - request.requestBody - ); - var contentTypeHeaderValues = headers.getOrDefault("Content-Type", new ArrayList<>()); - contentTypeHeaderValues.add(serializedRequestBody.contentType); - bodyPublisher = serializedRequestBody.bodyPublisher; - } - // TODO set this to a map if there is a query security scheme - @Nullable Map queryMap = null; - String host = apiConfiguration.getServer(request.serverIndex).url(); - - String url = host + Fakerefsnumber.path; - var httpRequest = RestClient.getRequest( - url, - method, - bodyPublisher, - headers, - request.timeout - ); - var response = RestClient.getResponse(httpRequest, client); - var responsesDeserializer = new FakerefsnumberPostResponses.FakerefsnumberPostResponses1(); - return responsesDeserializer.deserialize(response, schemaConfiguration); - } - } - - public interface PostOperation { - ApiConfiguration getApiConfiguration(); - SchemaConfiguration getSchemaConfiguration(); - HttpClient getClient(); - default FakerefsnumberPostResponses.EndpointResponse post(PostRequest request) throws IOException, InterruptedException, ValidationException, NotImplementedException, ApiException { - return PostProvider.post(request, getApiConfiguration(), getSchemaConfiguration(), getClient()); - } - } - - public interface NumberWithValidationsOperation { - ApiConfiguration getApiConfiguration(); - SchemaConfiguration getSchemaConfiguration(); - HttpClient getClient(); - default FakerefsnumberPostResponses.EndpointResponse numberWithValidations(PostRequest request) throws IOException, InterruptedException, ValidationException, NotImplementedException, ApiException { - return PostProvider.post(request, getApiConfiguration(), getSchemaConfiguration(), getClient()); - } - } - - public static class Post extends ApiClient implements PostOperation { - public Post(ApiConfiguration apiConfiguration, SchemaConfiguration schemaConfiguration) { - super(apiConfiguration, schemaConfiguration); - } - } - - public static class PostRequest { - public FakerefsnumberPostRequestBody.@Nullable SealedRequestBody requestBody; - public RootServerInfo.@Nullable ServerIndex serverIndex; - public @Nullable Duration timeout; - } - - public interface SetterForRequestBody { - PostRequest getInstance(); - T getBuilderAfterRequestBody(PostRequest instance); - default T requestBody(FakerefsnumberPostRequestBody.SealedRequestBody requestBody) { - var instance = getInstance(); - instance.requestBody = requestBody; - return getBuilderAfterRequestBody(instance); - } - } - - public interface SetterForServerIndex { - PostRequest getInstance(); - T getBuilderAfterServerIndex(PostRequest instance); - default T serverIndex(RootServerInfo.ServerIndex serverIndex) { - var instance = getInstance(); - instance.serverIndex = serverIndex; - return getBuilderAfterServerIndex(instance); - } - } - - public interface SetterForTimeout { - PostRequest getInstance(); - T getBuilderAfterTimeout(PostRequest instance); - default T timeout(Duration timeout) { - var instance = getInstance(); - instance.timeout = timeout; - return getBuilderAfterTimeout(instance); - } - } - - public static class PostRequestBuilder implements SetterForRequestBody, SetterForServerIndex, SetterForTimeout { - private final PostRequest instance; - - public PostRequestBuilder() { - this.instance = new PostRequest(); - } - - public PostRequest build() { - return instance; - } - - public PostRequest getInstance() { - return instance; - } - - public PostRequestBuilder getBuilderAfterRequestBody(PostRequest instance) { - return this; - } - - public PostRequestBuilder getBuilderAfterServerIndex(PostRequest instance) { - return this; - } - - public PostRequestBuilder getBuilderAfterTimeout(PostRequest instance) { - return this; - } - } -} diff --git a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/fakerefsnumber/post/FakerefsnumberPostRequestBody.kt b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/fakerefsnumber/post/FakerefsnumberPostRequestBody.kt deleted file mode 100644 index e3963edfc91..00000000000 --- a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/fakerefsnumber/post/FakerefsnumberPostRequestBody.kt +++ /dev/null @@ -1,49 +0,0 @@ -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; -import org.openapijsonschematools.client.mediatype.MediaType; -import org.openapijsonschematools.client.paths.fakerefsnumber.post.requestbody.content.applicationjson.ApplicationjsonSchema; - -import java.util.AbstractMap; -import java.util.Map; - -public class FakerefsnumberPostRequestBody { - public sealed interface SealedMediaType permits ApplicationjsonMediaType {} - - public record ApplicationjsonMediaType(ApplicationjsonSchema.ApplicationjsonSchema1 schema) implements SealedMediaType, MediaType { - public ApplicationjsonMediaType() { - this(ApplicationjsonSchema.ApplicationjsonSchema1.getInstance()); - } - @Override - public Nothing? encoding() { - return null; - } - } - - public static class FakerefsnumberPostRequestBody1 extends RequestBodySerializer { - public FakerefsnumberPostRequestBody1() { - super( - Map.ofEntries( - new AbstractMap.SimpleEntry<>("application/json", new ApplicationjsonMediaType()) - ), - false - ); - } - - public SerializedRequestBody serialize(SealedRequestBody requestBody) throws NotImplementedException { - ApplicationjsonRequestBody requestBody0 = (ApplicationjsonRequestBody) requestBody; - return serialize(requestBody0.contentType(), requestBody0.body().getData()); - } - } - - public sealed interface SealedRequestBody permits ApplicationjsonRequestBody {} - public record ApplicationjsonRequestBody(ApplicationjsonSchema.NumberWithValidations1Boxed body) implements SealedRequestBody, GenericRequestBody { - @Override - public String contentType() { - return "application/json"; - } - } -} diff --git a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/fakerefsnumber/post/FakerefsnumberPostResponses.kt b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/fakerefsnumber/post/FakerefsnumberPostResponses.kt deleted file mode 100644 index ea9d264a5b1..00000000000 --- a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/fakerefsnumber/post/FakerefsnumberPostResponses.kt +++ /dev/null @@ -1,53 +0,0 @@ -package org.openapijsonschematools.client.paths.fakerefsnumber.post; - -import org.openapijsonschematools.client.paths.fakerefsnumber.post.responses.FakerefsnumberPostCode200Response; -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; -import org.checkerframework.checker.nullness.qual.Nullable; - -import java.net.http.HttpResponse; -import java.util.Map; -import java.util.AbstractMap; - -public class FakerefsnumberPostResponses { - public sealed interface EndpointResponse permits EndpointFakerefsnumberPostCode200Response {} - - public record EndpointFakerefsnumberPostCode200Response( - HttpResponse response, - FakerefsnumberPostCode200Response.SealedResponseBody body, - Nothing? headers - ) implements EndpointResponse, ApiResponse{ - } - - public sealed interface StatusCodeResponseDeserializer permits StatusFakerefsnumberPostCode200ResponseDeserializer {} - - public static final class StatusFakerefsnumberPostCode200ResponseDeserializer extends FakerefsnumberPostCode200Response.FakerefsnumberPostCode200Response1 implements StatusCodeResponseDeserializer { - } - - public static final class FakerefsnumberPostResponses1 implements ResponsesDeserializer { - private final Map statusCodeToResponseDeserializer; - public FakerefsnumberPostResponses1() { - this.statusCodeToResponseDeserializer = Map.ofEntries( - new AbstractMap.SimpleEntry<>("200", new StatusFakerefsnumberPostCode200ResponseDeserializer()) - ); - } - - 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) { - throw new ApiException( - "Invalid response statusCode="+statusCode+" has no response defined in the openapi document", - response - ); - } - StatusFakerefsnumberPostCode200ResponseDeserializer castDeserializer = (StatusFakerefsnumberPostCode200ResponseDeserializer) statusCodeDeserializer; - var deserializedResponse = castDeserializer.deserialize(response, configuration); - return new EndpointFakerefsnumberPostCode200Response(response, deserializedResponse.body(), deserializedResponse.headers()); - } - } -} diff --git a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/fakerefsnumber/post/requestbody/content/applicationjson/ApplicationjsonSchema.kt b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/fakerefsnumber/post/requestbody/content/applicationjson/ApplicationjsonSchema.kt deleted file mode 100644 index 0444065de0f..00000000000 --- a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/fakerefsnumber/post/requestbody/content/applicationjson/ApplicationjsonSchema.kt +++ /dev/null @@ -1,19 +0,0 @@ -package org.openapijsonschematools.client.paths.fakerefsnumber.post.requestbody.content.applicationjson; - -import org.checkerframework.checker.nullness.qual.Nullable; -import org.openapijsonschematools.client.components.schemas.NumberWithValidations; - -public class ApplicationjsonSchema extends NumberWithValidations { - // $refed class - - - public static class ApplicationjsonSchema1 extends NumberWithValidations1 { - private static @Nullable ApplicationjsonSchema1 instance = null; - public static ApplicationjsonSchema1 getInstance() { - if (instance == null) { - instance = new ApplicationjsonSchema1(); - } - return instance; - } - } -} diff --git a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/fakerefsnumber/post/responses/FakerefsnumberPostCode200Response.kt b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/fakerefsnumber/post/responses/FakerefsnumberPostCode200Response.kt deleted file mode 100644 index b5764b2cdc7..00000000000 --- a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/fakerefsnumber/post/responses/FakerefsnumberPostCode200Response.kt +++ /dev/null @@ -1,63 +0,0 @@ -package org.openapijsonschematools.client.paths.fakerefsnumber.post.responses; - -import org.openapijsonschematools.client.configurations.SchemaConfiguration; -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; - -import java.util.AbstractMap; -import java.util.Map; -import java.net.http.HttpResponse; -import java.net.http.HttpHeaders; - -public class FakerefsnumberPostCode200Response { - public sealed interface SealedMediaType permits ApplicationjsonMediaType {} - - public record ApplicationjsonMediaType(ApplicationjsonSchema.ApplicationjsonSchema1 schema) implements SealedMediaType, MediaType { - public ApplicationjsonMediaType() { - this(ApplicationjsonSchema.ApplicationjsonSchema1.getInstance()); - } - @Override - public Nothing? encoding() { - return null; - } - } - public sealed interface SealedResponseBody permits ApplicationjsonResponseBody {} - public record ApplicationjsonResponseBody(ApplicationjsonSchema.NumberWithValidations1Boxed body) implements SealedResponseBody { } - - public static class FakerefsnumberPostCode200Response1 extends ResponseDeserializer { - public FakerefsnumberPostCode200Response1() { - super( - Map.ofEntries( - new AbstractMap.SimpleEntry<>("application/json", new ApplicationjsonMediaType()) - ) - ); - } - - @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); - } - - @Override - protected Nothing? getHeaders(HttpHeaders headers, SchemaConfiguration configuration) { - return null; - } - } - - @SuppressWarnings("serial") - public static class ResponseApiException extends ApiException { - public DeserializedHttpResponse deserializedResponse; - - public ResponseApiException(String s, HttpResponse response, DeserializedHttpResponse deserializedResponse) { - super(s, response); - this.deserializedResponse = deserializedResponse; - } - } -} diff --git a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/fakerefsnumber/post/responses/code200response/content/applicationjson/ApplicationjsonSchema.kt b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/fakerefsnumber/post/responses/code200response/content/applicationjson/ApplicationjsonSchema.kt deleted file mode 100644 index 735f78f40f2..00000000000 --- a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/fakerefsnumber/post/responses/code200response/content/applicationjson/ApplicationjsonSchema.kt +++ /dev/null @@ -1,19 +0,0 @@ -package org.openapijsonschematools.client.paths.fakerefsnumber.post.responses.code200response.content.applicationjson; - -import org.checkerframework.checker.nullness.qual.Nullable; -import org.openapijsonschematools.client.components.schemas.NumberWithValidations; - -public class ApplicationjsonSchema extends NumberWithValidations { - // $refed class - - - public static class ApplicationjsonSchema1 extends NumberWithValidations1 { - private static @Nullable ApplicationjsonSchema1 instance = null; - public static ApplicationjsonSchema1 getInstance() { - if (instance == null) { - instance = new ApplicationjsonSchema1(); - } - return instance; - } - } -} diff --git a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/fakerefsobjectmodelwithrefprops/FakerefsobjectmodelwithrefpropsPost.kt b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/fakerefsobjectmodelwithrefprops/FakerefsobjectmodelwithrefpropsPost.kt deleted file mode 100644 index a0d92eb73a6..00000000000 --- a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/fakerefsobjectmodelwithrefprops/FakerefsobjectmodelwithrefpropsPost.kt +++ /dev/null @@ -1,152 +0,0 @@ -package org.openapijsonschematools.client.paths.fakerefsobjectmodelwithrefprops; - -import org.checkerframework.checker.nullness.qual.Nullable; -import org.openapijsonschematools.client.paths.fakerefsobjectmodelwithrefprops.post.FakerefsobjectmodelwithrefpropsPostRequestBody; -import org.openapijsonschematools.client.RootServerInfo; -import org.openapijsonschematools.client.paths.fakerefsobjectmodelwithrefprops.post.FakerefsobjectmodelwithrefpropsPostResponses; -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.requestbody.SerializedRequestBody; -import org.openapijsonschematools.client.paths.Fakerefsobjectmodelwithrefprops; - -import java.io.IOException; -import java.util.ArrayList; -import java.net.http.HttpClient; -import java.net.http.HttpRequest; -import java.time.Duration; -import java.util.List; -import java.util.Map; - -public class FakerefsobjectmodelwithrefpropsPost { - private static class PostProvider { - private static final String method = "post"; - - public static FakerefsobjectmodelwithrefpropsPostResponses.EndpointResponse post( - PostRequest request, - ApiConfiguration apiConfiguration, - SchemaConfiguration schemaConfiguration, - HttpClient client - ) throws IOException, InterruptedException, ValidationException, NotImplementedException, ApiException { - Map> headers = apiConfiguration.getDefaultHeaders(); - - @Nullable SerializedRequestBody serializedRequestBody; - HttpRequest.BodyPublisher bodyPublisher = HttpRequest.BodyPublishers.noBody(); - if (request.requestBody != null) { - serializedRequestBody = new FakerefsobjectmodelwithrefpropsPostRequestBody.FakerefsobjectmodelwithrefpropsPostRequestBody1().serialize( - request.requestBody - ); - var contentTypeHeaderValues = headers.getOrDefault("Content-Type", new ArrayList<>()); - contentTypeHeaderValues.add(serializedRequestBody.contentType); - bodyPublisher = serializedRequestBody.bodyPublisher; - } - // TODO set this to a map if there is a query security scheme - @Nullable Map queryMap = null; - String host = apiConfiguration.getServer(request.serverIndex).url(); - - String url = host + Fakerefsobjectmodelwithrefprops.path; - var httpRequest = RestClient.getRequest( - url, - method, - bodyPublisher, - headers, - request.timeout - ); - var response = RestClient.getResponse(httpRequest, client); - var responsesDeserializer = new FakerefsobjectmodelwithrefpropsPostResponses.FakerefsobjectmodelwithrefpropsPostResponses1(); - return responsesDeserializer.deserialize(response, schemaConfiguration); - } - } - - public interface PostOperation { - ApiConfiguration getApiConfiguration(); - SchemaConfiguration getSchemaConfiguration(); - HttpClient getClient(); - default FakerefsobjectmodelwithrefpropsPostResponses.EndpointResponse post(PostRequest request) throws IOException, InterruptedException, ValidationException, NotImplementedException, ApiException { - return PostProvider.post(request, getApiConfiguration(), getSchemaConfiguration(), getClient()); - } - } - - public interface ObjectModelWithRefPropsOperation { - ApiConfiguration getApiConfiguration(); - SchemaConfiguration getSchemaConfiguration(); - HttpClient getClient(); - default FakerefsobjectmodelwithrefpropsPostResponses.EndpointResponse objectModelWithRefProps(PostRequest request) throws IOException, InterruptedException, ValidationException, NotImplementedException, ApiException { - return PostProvider.post(request, getApiConfiguration(), getSchemaConfiguration(), getClient()); - } - } - - public static class Post extends ApiClient implements PostOperation { - public Post(ApiConfiguration apiConfiguration, SchemaConfiguration schemaConfiguration) { - super(apiConfiguration, schemaConfiguration); - } - } - - public static class PostRequest { - public FakerefsobjectmodelwithrefpropsPostRequestBody.@Nullable SealedRequestBody requestBody; - public RootServerInfo.@Nullable ServerIndex serverIndex; - public @Nullable Duration timeout; - } - - public interface SetterForRequestBody { - PostRequest getInstance(); - T getBuilderAfterRequestBody(PostRequest instance); - default T requestBody(FakerefsobjectmodelwithrefpropsPostRequestBody.SealedRequestBody requestBody) { - var instance = getInstance(); - instance.requestBody = requestBody; - return getBuilderAfterRequestBody(instance); - } - } - - public interface SetterForServerIndex { - PostRequest getInstance(); - T getBuilderAfterServerIndex(PostRequest instance); - default T serverIndex(RootServerInfo.ServerIndex serverIndex) { - var instance = getInstance(); - instance.serverIndex = serverIndex; - return getBuilderAfterServerIndex(instance); - } - } - - public interface SetterForTimeout { - PostRequest getInstance(); - T getBuilderAfterTimeout(PostRequest instance); - default T timeout(Duration timeout) { - var instance = getInstance(); - instance.timeout = timeout; - return getBuilderAfterTimeout(instance); - } - } - - public static class PostRequestBuilder implements SetterForRequestBody, SetterForServerIndex, SetterForTimeout { - private final PostRequest instance; - - public PostRequestBuilder() { - this.instance = new PostRequest(); - } - - public PostRequest build() { - return instance; - } - - public PostRequest getInstance() { - return instance; - } - - public PostRequestBuilder getBuilderAfterRequestBody(PostRequest instance) { - return this; - } - - public PostRequestBuilder getBuilderAfterServerIndex(PostRequest instance) { - return this; - } - - public PostRequestBuilder getBuilderAfterTimeout(PostRequest instance) { - return this; - } - } -} diff --git a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/fakerefsobjectmodelwithrefprops/post/FakerefsobjectmodelwithrefpropsPostRequestBody.kt b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/fakerefsobjectmodelwithrefprops/post/FakerefsobjectmodelwithrefpropsPostRequestBody.kt deleted file mode 100644 index b224ddd2c60..00000000000 --- a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/fakerefsobjectmodelwithrefprops/post/FakerefsobjectmodelwithrefpropsPostRequestBody.kt +++ /dev/null @@ -1,49 +0,0 @@ -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; -import org.openapijsonschematools.client.mediatype.MediaType; -import org.openapijsonschematools.client.paths.fakerefsobjectmodelwithrefprops.post.requestbody.content.applicationjson.ApplicationjsonSchema; - -import java.util.AbstractMap; -import java.util.Map; - -public class FakerefsobjectmodelwithrefpropsPostRequestBody { - public sealed interface SealedMediaType permits ApplicationjsonMediaType {} - - public record ApplicationjsonMediaType(ApplicationjsonSchema.ApplicationjsonSchema1 schema) implements SealedMediaType, MediaType { - public ApplicationjsonMediaType() { - this(ApplicationjsonSchema.ApplicationjsonSchema1.getInstance()); - } - @Override - public Nothing? encoding() { - return null; - } - } - - public static class FakerefsobjectmodelwithrefpropsPostRequestBody1 extends RequestBodySerializer { - public FakerefsobjectmodelwithrefpropsPostRequestBody1() { - super( - Map.ofEntries( - new AbstractMap.SimpleEntry<>("application/json", new ApplicationjsonMediaType()) - ), - false - ); - } - - public SerializedRequestBody serialize(SealedRequestBody requestBody) throws NotImplementedException { - ApplicationjsonRequestBody requestBody0 = (ApplicationjsonRequestBody) requestBody; - return serialize(requestBody0.contentType(), requestBody0.body().getData()); - } - } - - public sealed interface SealedRequestBody permits ApplicationjsonRequestBody {} - public record ApplicationjsonRequestBody(ApplicationjsonSchema.ObjectModelWithRefProps1Boxed body) implements SealedRequestBody, GenericRequestBody { - @Override - public String contentType() { - return "application/json"; - } - } -} diff --git a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/fakerefsobjectmodelwithrefprops/post/FakerefsobjectmodelwithrefpropsPostResponses.kt b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/fakerefsobjectmodelwithrefprops/post/FakerefsobjectmodelwithrefpropsPostResponses.kt deleted file mode 100644 index 05c3f275e1b..00000000000 --- a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/fakerefsobjectmodelwithrefprops/post/FakerefsobjectmodelwithrefpropsPostResponses.kt +++ /dev/null @@ -1,53 +0,0 @@ -package org.openapijsonschematools.client.paths.fakerefsobjectmodelwithrefprops.post; - -import org.openapijsonschematools.client.paths.fakerefsobjectmodelwithrefprops.post.responses.FakerefsobjectmodelwithrefpropsPostCode200Response; -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; -import org.checkerframework.checker.nullness.qual.Nullable; - -import java.net.http.HttpResponse; -import java.util.Map; -import java.util.AbstractMap; - -public class FakerefsobjectmodelwithrefpropsPostResponses { - public sealed interface EndpointResponse permits EndpointFakerefsobjectmodelwithrefpropsPostCode200Response {} - - public record EndpointFakerefsobjectmodelwithrefpropsPostCode200Response( - HttpResponse response, - FakerefsobjectmodelwithrefpropsPostCode200Response.SealedResponseBody body, - Nothing? headers - ) implements EndpointResponse, ApiResponse{ - } - - public sealed interface StatusCodeResponseDeserializer permits StatusFakerefsobjectmodelwithrefpropsPostCode200ResponseDeserializer {} - - public static final class StatusFakerefsobjectmodelwithrefpropsPostCode200ResponseDeserializer extends FakerefsobjectmodelwithrefpropsPostCode200Response.FakerefsobjectmodelwithrefpropsPostCode200Response1 implements StatusCodeResponseDeserializer { - } - - public static final class FakerefsobjectmodelwithrefpropsPostResponses1 implements ResponsesDeserializer { - private final Map statusCodeToResponseDeserializer; - public FakerefsobjectmodelwithrefpropsPostResponses1() { - this.statusCodeToResponseDeserializer = Map.ofEntries( - new AbstractMap.SimpleEntry<>("200", new StatusFakerefsobjectmodelwithrefpropsPostCode200ResponseDeserializer()) - ); - } - - 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) { - throw new ApiException( - "Invalid response statusCode="+statusCode+" has no response defined in the openapi document", - response - ); - } - StatusFakerefsobjectmodelwithrefpropsPostCode200ResponseDeserializer castDeserializer = (StatusFakerefsobjectmodelwithrefpropsPostCode200ResponseDeserializer) statusCodeDeserializer; - var deserializedResponse = castDeserializer.deserialize(response, configuration); - return new EndpointFakerefsobjectmodelwithrefpropsPostCode200Response(response, deserializedResponse.body(), deserializedResponse.headers()); - } - } -} diff --git a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/fakerefsobjectmodelwithrefprops/post/requestbody/content/applicationjson/ApplicationjsonSchema.kt b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/fakerefsobjectmodelwithrefprops/post/requestbody/content/applicationjson/ApplicationjsonSchema.kt deleted file mode 100644 index 1e9e2b7db85..00000000000 --- a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/fakerefsobjectmodelwithrefprops/post/requestbody/content/applicationjson/ApplicationjsonSchema.kt +++ /dev/null @@ -1,19 +0,0 @@ -package org.openapijsonschematools.client.paths.fakerefsobjectmodelwithrefprops.post.requestbody.content.applicationjson; - -import org.checkerframework.checker.nullness.qual.Nullable; -import org.openapijsonschematools.client.components.schemas.ObjectModelWithRefProps; - -public class ApplicationjsonSchema extends ObjectModelWithRefProps { - // $refed class - - - public static class ApplicationjsonSchema1 extends ObjectModelWithRefProps1 { - private static @Nullable ApplicationjsonSchema1 instance = null; - public static ApplicationjsonSchema1 getInstance() { - if (instance == null) { - instance = new ApplicationjsonSchema1(); - } - return instance; - } - } -} diff --git a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/fakerefsobjectmodelwithrefprops/post/responses/FakerefsobjectmodelwithrefpropsPostCode200Response.kt b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/fakerefsobjectmodelwithrefprops/post/responses/FakerefsobjectmodelwithrefpropsPostCode200Response.kt deleted file mode 100644 index adb7d0955c0..00000000000 --- a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/fakerefsobjectmodelwithrefprops/post/responses/FakerefsobjectmodelwithrefpropsPostCode200Response.kt +++ /dev/null @@ -1,63 +0,0 @@ -package org.openapijsonschematools.client.paths.fakerefsobjectmodelwithrefprops.post.responses; - -import org.openapijsonschematools.client.configurations.SchemaConfiguration; -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; - -import java.util.AbstractMap; -import java.util.Map; -import java.net.http.HttpResponse; -import java.net.http.HttpHeaders; - -public class FakerefsobjectmodelwithrefpropsPostCode200Response { - public sealed interface SealedMediaType permits ApplicationjsonMediaType {} - - public record ApplicationjsonMediaType(ApplicationjsonSchema.ApplicationjsonSchema1 schema) implements SealedMediaType, MediaType { - public ApplicationjsonMediaType() { - this(ApplicationjsonSchema.ApplicationjsonSchema1.getInstance()); - } - @Override - public Nothing? encoding() { - return null; - } - } - public sealed interface SealedResponseBody permits ApplicationjsonResponseBody {} - public record ApplicationjsonResponseBody(ApplicationjsonSchema.ObjectModelWithRefProps1Boxed body) implements SealedResponseBody { } - - public static class FakerefsobjectmodelwithrefpropsPostCode200Response1 extends ResponseDeserializer { - public FakerefsobjectmodelwithrefpropsPostCode200Response1() { - super( - Map.ofEntries( - new AbstractMap.SimpleEntry<>("application/json", new ApplicationjsonMediaType()) - ) - ); - } - - @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); - } - - @Override - protected Nothing? getHeaders(HttpHeaders headers, SchemaConfiguration configuration) { - return null; - } - } - - @SuppressWarnings("serial") - public static class ResponseApiException extends ApiException { - public DeserializedHttpResponse deserializedResponse; - - public ResponseApiException(String s, HttpResponse response, DeserializedHttpResponse deserializedResponse) { - super(s, response); - this.deserializedResponse = deserializedResponse; - } - } -} diff --git a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/fakerefsobjectmodelwithrefprops/post/responses/code200response/content/applicationjson/ApplicationjsonSchema.kt b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/fakerefsobjectmodelwithrefprops/post/responses/code200response/content/applicationjson/ApplicationjsonSchema.kt deleted file mode 100644 index ae20e625adc..00000000000 --- a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/fakerefsobjectmodelwithrefprops/post/responses/code200response/content/applicationjson/ApplicationjsonSchema.kt +++ /dev/null @@ -1,19 +0,0 @@ -package org.openapijsonschematools.client.paths.fakerefsobjectmodelwithrefprops.post.responses.code200response.content.applicationjson; - -import org.checkerframework.checker.nullness.qual.Nullable; -import org.openapijsonschematools.client.components.schemas.ObjectModelWithRefProps; - -public class ApplicationjsonSchema extends ObjectModelWithRefProps { - // $refed class - - - public static class ApplicationjsonSchema1 extends ObjectModelWithRefProps1 { - private static @Nullable ApplicationjsonSchema1 instance = null; - public static ApplicationjsonSchema1 getInstance() { - if (instance == null) { - instance = new ApplicationjsonSchema1(); - } - return instance; - } - } -} diff --git a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/fakerefsstring/FakerefsstringPost.kt b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/fakerefsstring/FakerefsstringPost.kt deleted file mode 100644 index adc7818a1fa..00000000000 --- a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/fakerefsstring/FakerefsstringPost.kt +++ /dev/null @@ -1,152 +0,0 @@ -package org.openapijsonschematools.client.paths.fakerefsstring; - -import org.checkerframework.checker.nullness.qual.Nullable; -import org.openapijsonschematools.client.paths.fakerefsstring.post.FakerefsstringPostRequestBody; -import org.openapijsonschematools.client.RootServerInfo; -import org.openapijsonschematools.client.paths.fakerefsstring.post.FakerefsstringPostResponses; -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.requestbody.SerializedRequestBody; -import org.openapijsonschematools.client.paths.Fakerefsstring; - -import java.io.IOException; -import java.util.ArrayList; -import java.net.http.HttpClient; -import java.net.http.HttpRequest; -import java.time.Duration; -import java.util.List; -import java.util.Map; - -public class FakerefsstringPost { - private static class PostProvider { - private static final String method = "post"; - - public static FakerefsstringPostResponses.EndpointResponse post( - PostRequest request, - ApiConfiguration apiConfiguration, - SchemaConfiguration schemaConfiguration, - HttpClient client - ) throws IOException, InterruptedException, ValidationException, NotImplementedException, ApiException { - Map> headers = apiConfiguration.getDefaultHeaders(); - - @Nullable SerializedRequestBody serializedRequestBody; - HttpRequest.BodyPublisher bodyPublisher = HttpRequest.BodyPublishers.noBody(); - if (request.requestBody != null) { - serializedRequestBody = new FakerefsstringPostRequestBody.FakerefsstringPostRequestBody1().serialize( - request.requestBody - ); - var contentTypeHeaderValues = headers.getOrDefault("Content-Type", new ArrayList<>()); - contentTypeHeaderValues.add(serializedRequestBody.contentType); - bodyPublisher = serializedRequestBody.bodyPublisher; - } - // TODO set this to a map if there is a query security scheme - @Nullable Map queryMap = null; - String host = apiConfiguration.getServer(request.serverIndex).url(); - - String url = host + Fakerefsstring.path; - var httpRequest = RestClient.getRequest( - url, - method, - bodyPublisher, - headers, - request.timeout - ); - var response = RestClient.getResponse(httpRequest, client); - var responsesDeserializer = new FakerefsstringPostResponses.FakerefsstringPostResponses1(); - return responsesDeserializer.deserialize(response, schemaConfiguration); - } - } - - public interface PostOperation { - ApiConfiguration getApiConfiguration(); - SchemaConfiguration getSchemaConfiguration(); - HttpClient getClient(); - default FakerefsstringPostResponses.EndpointResponse post(PostRequest request) throws IOException, InterruptedException, ValidationException, NotImplementedException, ApiException { - return PostProvider.post(request, getApiConfiguration(), getSchemaConfiguration(), getClient()); - } - } - - public interface ModelStringOperation { - ApiConfiguration getApiConfiguration(); - SchemaConfiguration getSchemaConfiguration(); - HttpClient getClient(); - default FakerefsstringPostResponses.EndpointResponse modelString(PostRequest request) throws IOException, InterruptedException, ValidationException, NotImplementedException, ApiException { - return PostProvider.post(request, getApiConfiguration(), getSchemaConfiguration(), getClient()); - } - } - - public static class Post extends ApiClient implements PostOperation { - public Post(ApiConfiguration apiConfiguration, SchemaConfiguration schemaConfiguration) { - super(apiConfiguration, schemaConfiguration); - } - } - - public static class PostRequest { - public FakerefsstringPostRequestBody.@Nullable SealedRequestBody requestBody; - public RootServerInfo.@Nullable ServerIndex serverIndex; - public @Nullable Duration timeout; - } - - public interface SetterForRequestBody { - PostRequest getInstance(); - T getBuilderAfterRequestBody(PostRequest instance); - default T requestBody(FakerefsstringPostRequestBody.SealedRequestBody requestBody) { - var instance = getInstance(); - instance.requestBody = requestBody; - return getBuilderAfterRequestBody(instance); - } - } - - public interface SetterForServerIndex { - PostRequest getInstance(); - T getBuilderAfterServerIndex(PostRequest instance); - default T serverIndex(RootServerInfo.ServerIndex serverIndex) { - var instance = getInstance(); - instance.serverIndex = serverIndex; - return getBuilderAfterServerIndex(instance); - } - } - - public interface SetterForTimeout { - PostRequest getInstance(); - T getBuilderAfterTimeout(PostRequest instance); - default T timeout(Duration timeout) { - var instance = getInstance(); - instance.timeout = timeout; - return getBuilderAfterTimeout(instance); - } - } - - public static class PostRequestBuilder implements SetterForRequestBody, SetterForServerIndex, SetterForTimeout { - private final PostRequest instance; - - public PostRequestBuilder() { - this.instance = new PostRequest(); - } - - public PostRequest build() { - return instance; - } - - public PostRequest getInstance() { - return instance; - } - - public PostRequestBuilder getBuilderAfterRequestBody(PostRequest instance) { - return this; - } - - public PostRequestBuilder getBuilderAfterServerIndex(PostRequest instance) { - return this; - } - - public PostRequestBuilder getBuilderAfterTimeout(PostRequest instance) { - return this; - } - } -} diff --git a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/fakerefsstring/post/FakerefsstringPostRequestBody.kt b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/fakerefsstring/post/FakerefsstringPostRequestBody.kt deleted file mode 100644 index f01d4f22e20..00000000000 --- a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/fakerefsstring/post/FakerefsstringPostRequestBody.kt +++ /dev/null @@ -1,49 +0,0 @@ -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; -import org.openapijsonschematools.client.mediatype.MediaType; -import org.openapijsonschematools.client.paths.fakerefsstring.post.requestbody.content.applicationjson.ApplicationjsonSchema; - -import java.util.AbstractMap; -import java.util.Map; - -public class FakerefsstringPostRequestBody { - public sealed interface SealedMediaType permits ApplicationjsonMediaType {} - - public record ApplicationjsonMediaType(ApplicationjsonSchema.ApplicationjsonSchema1 schema) implements SealedMediaType, MediaType { - public ApplicationjsonMediaType() { - this(ApplicationjsonSchema.ApplicationjsonSchema1.getInstance()); - } - @Override - public Nothing? encoding() { - return null; - } - } - - public static class FakerefsstringPostRequestBody1 extends RequestBodySerializer { - public FakerefsstringPostRequestBody1() { - super( - Map.ofEntries( - new AbstractMap.SimpleEntry<>("application/json", new ApplicationjsonMediaType()) - ), - false - ); - } - - public SerializedRequestBody serialize(SealedRequestBody requestBody) throws NotImplementedException { - ApplicationjsonRequestBody requestBody0 = (ApplicationjsonRequestBody) requestBody; - return serialize(requestBody0.contentType(), requestBody0.body().getData()); - } - } - - public sealed interface SealedRequestBody permits ApplicationjsonRequestBody {} - public record ApplicationjsonRequestBody(ApplicationjsonSchema.StringJsonSchema1Boxed body) implements SealedRequestBody, GenericRequestBody { - @Override - public String contentType() { - return "application/json"; - } - } -} diff --git a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/fakerefsstring/post/FakerefsstringPostResponses.kt b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/fakerefsstring/post/FakerefsstringPostResponses.kt deleted file mode 100644 index 28a0b9c0873..00000000000 --- a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/fakerefsstring/post/FakerefsstringPostResponses.kt +++ /dev/null @@ -1,53 +0,0 @@ -package org.openapijsonschematools.client.paths.fakerefsstring.post; - -import org.openapijsonschematools.client.paths.fakerefsstring.post.responses.FakerefsstringPostCode200Response; -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; -import org.checkerframework.checker.nullness.qual.Nullable; - -import java.net.http.HttpResponse; -import java.util.Map; -import java.util.AbstractMap; - -public class FakerefsstringPostResponses { - public sealed interface EndpointResponse permits EndpointFakerefsstringPostCode200Response {} - - public record EndpointFakerefsstringPostCode200Response( - HttpResponse response, - FakerefsstringPostCode200Response.SealedResponseBody body, - Nothing? headers - ) implements EndpointResponse, ApiResponse{ - } - - public sealed interface StatusCodeResponseDeserializer permits StatusFakerefsstringPostCode200ResponseDeserializer {} - - public static final class StatusFakerefsstringPostCode200ResponseDeserializer extends FakerefsstringPostCode200Response.FakerefsstringPostCode200Response1 implements StatusCodeResponseDeserializer { - } - - public static final class FakerefsstringPostResponses1 implements ResponsesDeserializer { - private final Map statusCodeToResponseDeserializer; - public FakerefsstringPostResponses1() { - this.statusCodeToResponseDeserializer = Map.ofEntries( - new AbstractMap.SimpleEntry<>("200", new StatusFakerefsstringPostCode200ResponseDeserializer()) - ); - } - - 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) { - throw new ApiException( - "Invalid response statusCode="+statusCode+" has no response defined in the openapi document", - response - ); - } - StatusFakerefsstringPostCode200ResponseDeserializer castDeserializer = (StatusFakerefsstringPostCode200ResponseDeserializer) statusCodeDeserializer; - var deserializedResponse = castDeserializer.deserialize(response, configuration); - return new EndpointFakerefsstringPostCode200Response(response, deserializedResponse.body(), deserializedResponse.headers()); - } - } -} diff --git a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/fakerefsstring/post/requestbody/content/applicationjson/ApplicationjsonSchema.kt b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/fakerefsstring/post/requestbody/content/applicationjson/ApplicationjsonSchema.kt deleted file mode 100644 index 7ebeea7dcd3..00000000000 --- a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/fakerefsstring/post/requestbody/content/applicationjson/ApplicationjsonSchema.kt +++ /dev/null @@ -1,19 +0,0 @@ -package org.openapijsonschematools.client.paths.fakerefsstring.post.requestbody.content.applicationjson; - -import org.checkerframework.checker.nullness.qual.Nullable; -import org.openapijsonschematools.client.components.schemas.StringSchema; - -public class ApplicationjsonSchema extends StringSchema { - // $refed class - - - public static class ApplicationjsonSchema1 extends StringSchema1 { - private static @Nullable ApplicationjsonSchema1 instance = null; - public static ApplicationjsonSchema1 getInstance() { - if (instance == null) { - instance = new ApplicationjsonSchema1(); - } - return instance; - } - } -} diff --git a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/fakerefsstring/post/responses/FakerefsstringPostCode200Response.kt b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/fakerefsstring/post/responses/FakerefsstringPostCode200Response.kt deleted file mode 100644 index ea29c0a6b22..00000000000 --- a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/fakerefsstring/post/responses/FakerefsstringPostCode200Response.kt +++ /dev/null @@ -1,63 +0,0 @@ -package org.openapijsonschematools.client.paths.fakerefsstring.post.responses; - -import org.openapijsonschematools.client.configurations.SchemaConfiguration; -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; - -import java.util.AbstractMap; -import java.util.Map; -import java.net.http.HttpResponse; -import java.net.http.HttpHeaders; - -public class FakerefsstringPostCode200Response { - public sealed interface SealedMediaType permits ApplicationjsonMediaType {} - - public record ApplicationjsonMediaType(ApplicationjsonSchema.ApplicationjsonSchema1 schema) implements SealedMediaType, MediaType { - public ApplicationjsonMediaType() { - this(ApplicationjsonSchema.ApplicationjsonSchema1.getInstance()); - } - @Override - public Nothing? encoding() { - return null; - } - } - public sealed interface SealedResponseBody permits ApplicationjsonResponseBody {} - public record ApplicationjsonResponseBody(ApplicationjsonSchema.StringJsonSchema1Boxed body) implements SealedResponseBody { } - - public static class FakerefsstringPostCode200Response1 extends ResponseDeserializer { - public FakerefsstringPostCode200Response1() { - super( - Map.ofEntries( - new AbstractMap.SimpleEntry<>("application/json", new ApplicationjsonMediaType()) - ) - ); - } - - @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); - } - - @Override - protected Nothing? getHeaders(HttpHeaders headers, SchemaConfiguration configuration) { - return null; - } - } - - @SuppressWarnings("serial") - public static class ResponseApiException extends ApiException { - public DeserializedHttpResponse deserializedResponse; - - public ResponseApiException(String s, HttpResponse response, DeserializedHttpResponse deserializedResponse) { - super(s, response); - this.deserializedResponse = deserializedResponse; - } - } -} diff --git a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/fakerefsstring/post/responses/code200response/content/applicationjson/ApplicationjsonSchema.kt b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/fakerefsstring/post/responses/code200response/content/applicationjson/ApplicationjsonSchema.kt deleted file mode 100644 index 9f140dc31c3..00000000000 --- a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/fakerefsstring/post/responses/code200response/content/applicationjson/ApplicationjsonSchema.kt +++ /dev/null @@ -1,19 +0,0 @@ -package org.openapijsonschematools.client.paths.fakerefsstring.post.responses.code200response.content.applicationjson; - -import org.checkerframework.checker.nullness.qual.Nullable; -import org.openapijsonschematools.client.components.schemas.StringSchema; - -public class ApplicationjsonSchema extends StringSchema { - // $refed class - - - public static class ApplicationjsonSchema1 extends StringSchema1 { - private static @Nullable ApplicationjsonSchema1 instance = null; - public static ApplicationjsonSchema1 getInstance() { - if (instance == null) { - instance = new ApplicationjsonSchema1(); - } - return instance; - } - } -} diff --git a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/fakeresponsewithoutschema/FakeresponsewithoutschemaGet.kt b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/fakeresponsewithoutschema/FakeresponsewithoutschemaGet.kt deleted file mode 100644 index 284c2b3309e..00000000000 --- a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/fakeresponsewithoutschema/FakeresponsewithoutschemaGet.kt +++ /dev/null @@ -1,124 +0,0 @@ -package org.openapijsonschematools.client.paths.fakeresponsewithoutschema; - -import org.checkerframework.checker.nullness.qual.Nullable; -import org.openapijsonschematools.client.RootServerInfo; -import org.openapijsonschematools.client.paths.fakeresponsewithoutschema.get.FakeresponsewithoutschemaGetResponses; -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.paths.Fakeresponsewithoutschema; - -import java.io.IOException; -import java.net.http.HttpClient; -import java.net.http.HttpRequest; -import java.time.Duration; -import java.util.List; -import java.util.Map; - -public class FakeresponsewithoutschemaGet { - private static class GetProvider { - private static final String method = "get"; - - public static FakeresponsewithoutschemaGetResponses.EndpointResponse get( - GetRequest request, - ApiConfiguration apiConfiguration, - SchemaConfiguration schemaConfiguration, - HttpClient client - ) 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 - @Nullable Map queryMap = null; - String host = apiConfiguration.getServer(request.serverIndex).url(); - - String url = host + Fakeresponsewithoutschema.path; - var httpRequest = RestClient.getRequest( - url, - method, - bodyPublisher, - headers, - request.timeout - ); - var response = RestClient.getResponse(httpRequest, client); - var responsesDeserializer = new FakeresponsewithoutschemaGetResponses.FakeresponsewithoutschemaGetResponses1(); - return responsesDeserializer.deserialize(response, schemaConfiguration); - } - } - - public interface GetOperation { - ApiConfiguration getApiConfiguration(); - SchemaConfiguration getSchemaConfiguration(); - HttpClient getClient(); - default FakeresponsewithoutschemaGetResponses.EndpointResponse get(GetRequest request) throws IOException, InterruptedException, ValidationException, NotImplementedException, ApiException { - return GetProvider.get(request, getApiConfiguration(), getSchemaConfiguration(), getClient()); - } - } - - public interface ResponseWithoutSchemaOperation { - ApiConfiguration getApiConfiguration(); - SchemaConfiguration getSchemaConfiguration(); - HttpClient getClient(); - default FakeresponsewithoutschemaGetResponses.EndpointResponse responseWithoutSchema(GetRequest request) throws IOException, InterruptedException, ValidationException, NotImplementedException, ApiException { - return GetProvider.get(request, getApiConfiguration(), getSchemaConfiguration(), getClient()); - } - } - - public static class Get extends ApiClient implements GetOperation { - public Get(ApiConfiguration apiConfiguration, SchemaConfiguration schemaConfiguration) { - super(apiConfiguration, schemaConfiguration); - } - } - - public static class GetRequest { - public RootServerInfo.@Nullable ServerIndex serverIndex; - public @Nullable Duration timeout; - } - - public interface SetterForServerIndex { - GetRequest getInstance(); - T getBuilderAfterServerIndex(GetRequest instance); - default T serverIndex(RootServerInfo.ServerIndex serverIndex) { - var instance = getInstance(); - instance.serverIndex = serverIndex; - return getBuilderAfterServerIndex(instance); - } - } - - public interface SetterForTimeout { - GetRequest getInstance(); - T getBuilderAfterTimeout(GetRequest instance); - default T timeout(Duration timeout) { - var instance = getInstance(); - instance.timeout = timeout; - return getBuilderAfterTimeout(instance); - } - } - - public static class GetRequestBuilder implements SetterForServerIndex, SetterForTimeout { - private final GetRequest instance; - - public GetRequestBuilder() { - this.instance = new GetRequest(); - } - - public GetRequest build() { - return instance; - } - - public GetRequest getInstance() { - return instance; - } - - public GetRequestBuilder getBuilderAfterServerIndex(GetRequest instance) { - return this; - } - - public GetRequestBuilder getBuilderAfterTimeout(GetRequest instance) { - return this; - } - } -} diff --git a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/fakeresponsewithoutschema/get/FakeresponsewithoutschemaGetResponses.kt b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/fakeresponsewithoutschema/get/FakeresponsewithoutschemaGetResponses.kt deleted file mode 100644 index ec3ff1a85b8..00000000000 --- a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/fakeresponsewithoutschema/get/FakeresponsewithoutschemaGetResponses.kt +++ /dev/null @@ -1,53 +0,0 @@ -package org.openapijsonschematools.client.paths.fakeresponsewithoutschema.get; - -import org.openapijsonschematools.client.paths.fakeresponsewithoutschema.get.responses.FakeresponsewithoutschemaGetCode200Response; -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; -import org.checkerframework.checker.nullness.qual.Nullable; - -import java.net.http.HttpResponse; -import java.util.Map; -import java.util.AbstractMap; - -public class FakeresponsewithoutschemaGetResponses { - public sealed interface EndpointResponse permits EndpointFakeresponsewithoutschemaGetCode200Response {} - - public record EndpointFakeresponsewithoutschemaGetCode200Response( - HttpResponse response, - Nothing? body, - Nothing? headers - ) implements EndpointResponse, ApiResponse{ - } - - public sealed interface StatusCodeResponseDeserializer permits StatusFakeresponsewithoutschemaGetCode200ResponseDeserializer {} - - public static final class StatusFakeresponsewithoutschemaGetCode200ResponseDeserializer extends FakeresponsewithoutschemaGetCode200Response.FakeresponsewithoutschemaGetCode200Response1 implements StatusCodeResponseDeserializer { - } - - public static final class FakeresponsewithoutschemaGetResponses1 implements ResponsesDeserializer { - private final Map statusCodeToResponseDeserializer; - public FakeresponsewithoutschemaGetResponses1() { - this.statusCodeToResponseDeserializer = Map.ofEntries( - new AbstractMap.SimpleEntry<>("200", new StatusFakeresponsewithoutschemaGetCode200ResponseDeserializer()) - ); - } - - 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) { - throw new ApiException( - "Invalid response statusCode="+statusCode+" has no response defined in the openapi document", - response - ); - } - StatusFakeresponsewithoutschemaGetCode200ResponseDeserializer castDeserializer = (StatusFakeresponsewithoutschemaGetCode200ResponseDeserializer) statusCodeDeserializer; - var deserializedResponse = castDeserializer.deserialize(response, configuration); - return new EndpointFakeresponsewithoutschemaGetCode200Response(response, deserializedResponse.body(), deserializedResponse.headers()); - } - } -} diff --git a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/fakeresponsewithoutschema/get/responses/FakeresponsewithoutschemaGetCode200Response.kt b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/fakeresponsewithoutschema/get/responses/FakeresponsewithoutschemaGetCode200Response.kt deleted file mode 100644 index 7e0440694cd..00000000000 --- a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/fakeresponsewithoutschema/get/responses/FakeresponsewithoutschemaGetCode200Response.kt +++ /dev/null @@ -1,48 +0,0 @@ -package org.openapijsonschematools.client.paths.fakeresponsewithoutschema.get.responses; - -import org.openapijsonschematools.client.configurations.SchemaConfiguration; -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; -import java.util.Map; -import java.net.http.HttpResponse; -import java.net.http.HttpHeaders; - -public class FakeresponsewithoutschemaGetCode200Response { - - public static class FakeresponsewithoutschemaGetCode200Response1 extends ResponseDeserializer { - public FakeresponsewithoutschemaGetCode200Response1() { - super( - MapUtils.makeMap( - new AbstractMap.SimpleEntry("application/json", null), - new AbstractMap.SimpleEntry("application/xml", null) - ) - ); - } - - @Override - protected Nothing? getBody(String contentType, Nothing? mediaType, byte[] body, SchemaConfiguration configuration) { - return null; - } - - @Override - protected Nothing? getHeaders(HttpHeaders headers, SchemaConfiguration configuration) { - return null; - } - } - - @SuppressWarnings("serial") - public static class ResponseApiException extends ApiException { - public DeserializedHttpResponse deserializedResponse; - - public ResponseApiException(String s, HttpResponse response, DeserializedHttpResponse deserializedResponse) { - super(s, response); - this.deserializedResponse = deserializedResponse; - } - } -} diff --git a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/faketestqueryparamters/FaketestqueryparamtersPut.kt b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/faketestqueryparamters/FaketestqueryparamtersPut.kt deleted file mode 100644 index 3957ca24485..00000000000 --- a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/faketestqueryparamters/FaketestqueryparamtersPut.kt +++ /dev/null @@ -1,180 +0,0 @@ -package org.openapijsonschematools.client.paths.faketestqueryparamters; - -import org.checkerframework.checker.nullness.qual.Nullable; -import org.openapijsonschematools.client.RootServerInfo; -import org.openapijsonschematools.client.paths.faketestqueryparamters.put.FaketestqueryparamtersPutQueryParameters; -import org.openapijsonschematools.client.paths.faketestqueryparamters.put.Parameters; -import org.openapijsonschematools.client.paths.faketestqueryparamters.put.FaketestqueryparamtersPutResponses; -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.paths.Faketestqueryparamters; - -import java.io.IOException; -import java.net.http.HttpClient; -import java.net.http.HttpRequest; -import java.time.Duration; -import java.util.List; -import java.util.Map; - -public class FaketestqueryparamtersPut { - private static class PutProvider { - private static final String method = "put"; - - public static FaketestqueryparamtersPutResponses.EndpointResponse put( - PutRequest request, - ApiConfiguration apiConfiguration, - SchemaConfiguration schemaConfiguration, - HttpClient client - ) throws IOException, InterruptedException, ValidationException, NotImplementedException, ApiException { - Map> headers = apiConfiguration.getDefaultHeaders(); - HttpRequest.BodyPublisher bodyPublisher = HttpRequest.BodyPublishers.noBody(); - - var querySerializer = new Parameters.QueryParametersSerializer(); - @Nullable Map queryMap = querySerializer.getQueryMap(request.queryParameters); - String host = apiConfiguration.getServer(request.serverIndex).url(); - - String url = host + Faketestqueryparamters.path; - if (queryMap != null) { - url = url + querySerializer.serialize(queryMap); - } - var httpRequest = RestClient.getRequest( - url, - method, - bodyPublisher, - headers, - request.timeout - ); - var response = RestClient.getResponse(httpRequest, client); - var responsesDeserializer = new FaketestqueryparamtersPutResponses.FaketestqueryparamtersPutResponses1(); - return responsesDeserializer.deserialize(response, schemaConfiguration); - } - } - - public interface PutOperation { - ApiConfiguration getApiConfiguration(); - SchemaConfiguration getSchemaConfiguration(); - HttpClient getClient(); - default FaketestqueryparamtersPutResponses.EndpointResponse put(PutRequest request) throws IOException, InterruptedException, ValidationException, NotImplementedException, ApiException { - return PutProvider.put(request, getApiConfiguration(), getSchemaConfiguration(), getClient()); - } - } - - public interface QueryParameterCollectionFormatOperation { - ApiConfiguration getApiConfiguration(); - SchemaConfiguration getSchemaConfiguration(); - HttpClient getClient(); - default FaketestqueryparamtersPutResponses.EndpointResponse queryParameterCollectionFormat(PutRequest request) throws IOException, InterruptedException, ValidationException, NotImplementedException, ApiException { - return PutProvider.put(request, getApiConfiguration(), getSchemaConfiguration(), getClient()); - } - } - - public static class Put extends ApiClient implements PutOperation { - public Put(ApiConfiguration apiConfiguration, SchemaConfiguration schemaConfiguration) { - super(apiConfiguration, schemaConfiguration); - } - } - - public static class PutRequest { - public FaketestqueryparamtersPutQueryParameters.QueryParametersMap queryParameters; - public RootServerInfo.@Nullable ServerIndex serverIndex; - public @Nullable Duration timeout; - - public PutRequest( - FaketestqueryparamtersPutQueryParameters.QueryParametersMap queryParameters, - RootServerInfo.@Nullable ServerIndex serverIndex, - @Nullable Duration timeout - ) { - this.queryParameters = queryParameters; - this.serverIndex = serverIndex; - this.timeout = timeout; - } - } - - public static class PutNullableRequest { - public FaketestqueryparamtersPutQueryParameters.@Nullable QueryParametersMap queryParameters; - public RootServerInfo.@Nullable ServerIndex serverIndex; - public @Nullable Duration timeout; - } - - public interface SetterForServerIndex { - PutNullableRequest getInstance(); - T getBuilderAfterServerIndex(PutNullableRequest instance); - default T serverIndex(RootServerInfo.ServerIndex serverIndex) { - var instance = getInstance(); - instance.serverIndex = serverIndex; - return getBuilderAfterServerIndex(instance); - } - } - - public interface SetterForTimeout { - PutNullableRequest getInstance(); - T getBuilderAfterTimeout(PutNullableRequest instance); - default T timeout(Duration timeout) { - var instance = getInstance(); - instance.timeout = timeout; - return getBuilderAfterTimeout(instance); - } - } - - public interface SetterForQueryParameters { - PutNullableRequest getInstance(); - T getBuilderAfterQueryParameters(PutNullableRequest instance); - default T queryParameters(FaketestqueryparamtersPutQueryParameters.QueryParametersMap queryParameters) { - var instance = getInstance(); - instance.queryParameters = queryParameters; - return getBuilderAfterQueryParameters(instance); - } - } - - public static class Put0RequestBuilder implements SetterForServerIndex, SetterForTimeout { - private final PutNullableRequest instance; - - public Put0RequestBuilder(PutNullableRequest instance) { - this.instance = instance; - } - - public PutRequest build() { - var queryParameters = instance.queryParameters; - if (queryParameters == null) { - throw new RuntimeException("invalid null value for required parameter"); - } - return new PutRequest( - queryParameters, - instance.serverIndex, - instance.timeout - ); - } - - public PutNullableRequest getInstance() { - return instance; - } - - public Put0RequestBuilder getBuilderAfterServerIndex(PutNullableRequest instance) { - return this; - } - - public Put0RequestBuilder getBuilderAfterTimeout(PutNullableRequest instance) { - return this; - } - } - public static class PutRequestBuilder implements SetterForQueryParameters { - private final PutNullableRequest instance; - - public PutRequestBuilder() { - this.instance = new PutNullableRequest(); - } - - public PutNullableRequest getInstance() { - return instance; - } - - public Put0RequestBuilder getBuilderAfterQueryParameters(PutNullableRequest instance) { - return new Put0RequestBuilder(instance); - } - } -} diff --git a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/faketestqueryparamters/put/FaketestqueryparamtersPutQueryParameters.kt b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/faketestqueryparamters/put/FaketestqueryparamtersPutQueryParameters.kt deleted file mode 100644 index 2ed109f1869..00000000000 --- a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/faketestqueryparamters/put/FaketestqueryparamtersPutQueryParameters.kt +++ /dev/null @@ -1,1515 +0,0 @@ -package org.openapijsonschematools.client.paths.faketestqueryparamters.put; -import java.util.ArrayList; -import java.util.HashSet; -import java.util.LinkedHashMap; -import java.util.LinkedHashSet; -import java.util.List; -import java.util.Map; -import java.util.Objects; -import java.util.Set; -import org.checkerframework.checker.nullness.qual.Nullable; -import org.openapijsonschematools.client.components.schemas.StringWithValidation; -import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags; -import org.openapijsonschematools.client.configurations.SchemaConfiguration; -import org.openapijsonschematools.client.exceptions.UnsetPropertyException; -import org.openapijsonschematools.client.exceptions.ValidationException; -import org.openapijsonschematools.client.paths.faketestqueryparamters.put.parameters.parameter0.Schema0; -import org.openapijsonschematools.client.paths.faketestqueryparamters.put.parameters.parameter1.Schema1; -import org.openapijsonschematools.client.paths.faketestqueryparamters.put.parameters.parameter2.Schema2; -import org.openapijsonschematools.client.paths.faketestqueryparamters.put.parameters.parameter3.Schema3; -import org.openapijsonschematools.client.paths.faketestqueryparamters.put.parameters.parameter4.Schema4; -import org.openapijsonschematools.client.schemas.AnyTypeJsonSchema; -import org.openapijsonschematools.client.schemas.GenericBuilder; -import org.openapijsonschematools.client.schemas.NotAnyTypeJsonSchema; -import org.openapijsonschematools.client.schemas.validation.FrozenMap; -import org.openapijsonschematools.client.schemas.validation.JsonSchema; -import org.openapijsonschematools.client.schemas.validation.JsonSchemaInfo; -import org.openapijsonschematools.client.schemas.validation.MapSchemaValidator; -import org.openapijsonschematools.client.schemas.validation.MapUtils; -import org.openapijsonschematools.client.schemas.validation.PathToSchemasMap; -import org.openapijsonschematools.client.schemas.validation.PropertyEntry; -import org.openapijsonschematools.client.schemas.validation.ValidationMetadata; - -public class FaketestqueryparamtersPutQueryParameters { - // nest classes so all schemas and input/output classes can be public - - - public static class AdditionalProperties extends NotAnyTypeJsonSchema.NotAnyTypeJsonSchema1 { - // NotAnyTypeSchema - private static @Nullable AdditionalProperties instance = null; - public static AdditionalProperties getInstance() { - if (instance == null) { - instance = new AdditionalProperties(); - } - return instance; - } - } - - - public static class QueryParametersMap extends FrozenMap<@Nullable Object> { - protected QueryParametersMap(FrozenMap<@Nullable Object> m) { - super(m); - } - public static final Set requiredKeys = Set.of( - "context", - "http", - "ioutil", - "pipe", - "refParam", - "url" - ); - public static final Set optionalKeys = Set.of(); - public static QueryParametersMap of(Map arg, SchemaConfiguration configuration) throws ValidationException { - return FaketestqueryparamtersPutQueryParameters1.getInstance().validate(arg, configuration); - } - - public Schema4.SchemaList4 context() { - @Nullable Object value = get("context"); - if (!(value instanceof Schema4.SchemaList4)) { - throw new RuntimeException("Invalid value stored for context"); - } - return (Schema4.SchemaList4) value; - } - - public Schema2.SchemaList2 http() { - @Nullable Object value = get("http"); - if (!(value instanceof Schema2.SchemaList2)) { - throw new RuntimeException("Invalid value stored for http"); - } - return (Schema2.SchemaList2) value; - } - - public Schema1.SchemaList1 ioutil() { - @Nullable Object value = get("ioutil"); - if (!(value instanceof Schema1.SchemaList1)) { - throw new RuntimeException("Invalid value stored for ioutil"); - } - return (Schema1.SchemaList1) value; - } - - public Schema0.SchemaList0 pipe() { - @Nullable Object value = get("pipe"); - if (!(value instanceof Schema0.SchemaList0)) { - throw new RuntimeException("Invalid value stored for pipe"); - } - return (Schema0.SchemaList0) value; - } - - public String refParam() { - @Nullable Object value = get("refParam"); - if (!(value instanceof String)) { - throw new RuntimeException("Invalid value stored for refParam"); - } - return (String) value; - } - - public Schema3.SchemaList3 url() { - @Nullable Object value = get("url"); - if (!(value instanceof Schema3.SchemaList3)) { - throw new RuntimeException("Invalid value stored for url"); - } - return (Schema3.SchemaList3) value; - } - } - - public interface SetterForContext { - Map getInstance(); - T getBuilderAfterContext(Map instance); - - default T context(List value) { - var instance = getInstance(); - instance.put("context", value); - return getBuilderAfterContext(instance); - } - } - - public interface SetterForHttp { - Map getInstance(); - T getBuilderAfterHttp(Map instance); - - default T http(List value) { - var instance = getInstance(); - instance.put("http", value); - return getBuilderAfterHttp(instance); - } - } - - public interface SetterForIoutil { - Map getInstance(); - T getBuilderAfterIoutil(Map instance); - - default T ioutil(List value) { - var instance = getInstance(); - instance.put("ioutil", value); - return getBuilderAfterIoutil(instance); - } - } - - public interface SetterForPipe { - Map getInstance(); - T getBuilderAfterPipe(Map instance); - - default T pipe(List value) { - var instance = getInstance(); - instance.put("pipe", value); - return getBuilderAfterPipe(instance); - } - } - - public interface SetterForRefParam { - Map getInstance(); - T getBuilderAfterRefParam(Map instance); - - default T refParam(String value) { - var instance = getInstance(); - instance.put("refParam", value); - return getBuilderAfterRefParam(instance); - } - } - - public interface SetterForUrl { - Map getInstance(); - T getBuilderAfterUrl(Map instance); - - default T url(List value) { - var instance = getInstance(); - instance.put("url", value); - return getBuilderAfterUrl(instance); - } - } - - public static class QueryParametersMap000000Builder implements GenericBuilder> { - private final Map instance; - private static final Set knownKeys = Set.of( - "context", - "http", - "ioutil", - "pipe", - "refParam", - "url" - ); - public Set getKnownKeys() { - return knownKeys; - } - public QueryParametersMap000000Builder(Map instance) { - this.instance = instance; - } - public Map build() { - return instance; - } - } - - public static class QueryParametersMap000001Builder implements SetterForUrl { - private final Map instance; - public QueryParametersMap000001Builder(Map instance) { - this.instance = instance; - } - public Map getInstance() { - return instance; - } - public QueryParametersMap000000Builder getBuilderAfterUrl(Map instance) { - return new QueryParametersMap000000Builder(instance); - } - } - - public static class QueryParametersMap000010Builder implements SetterForRefParam { - private final Map instance; - public QueryParametersMap000010Builder(Map instance) { - this.instance = instance; - } - public Map getInstance() { - return instance; - } - public QueryParametersMap000000Builder getBuilderAfterRefParam(Map instance) { - return new QueryParametersMap000000Builder(instance); - } - } - - public static class QueryParametersMap000011Builder implements SetterForRefParam, SetterForUrl { - private final Map instance; - public QueryParametersMap000011Builder(Map instance) { - this.instance = instance; - } - public Map getInstance() { - return instance; - } - public QueryParametersMap000001Builder getBuilderAfterRefParam(Map instance) { - return new QueryParametersMap000001Builder(instance); - } - public QueryParametersMap000010Builder getBuilderAfterUrl(Map instance) { - return new QueryParametersMap000010Builder(instance); - } - } - - public static class QueryParametersMap000100Builder implements SetterForPipe { - private final Map instance; - public QueryParametersMap000100Builder(Map instance) { - this.instance = instance; - } - public Map getInstance() { - return instance; - } - public QueryParametersMap000000Builder getBuilderAfterPipe(Map instance) { - return new QueryParametersMap000000Builder(instance); - } - } - - public static class QueryParametersMap000101Builder implements SetterForPipe, SetterForUrl { - private final Map instance; - public QueryParametersMap000101Builder(Map instance) { - this.instance = instance; - } - public Map getInstance() { - return instance; - } - public QueryParametersMap000001Builder getBuilderAfterPipe(Map instance) { - return new QueryParametersMap000001Builder(instance); - } - public QueryParametersMap000100Builder getBuilderAfterUrl(Map instance) { - return new QueryParametersMap000100Builder(instance); - } - } - - public static class QueryParametersMap000110Builder implements SetterForPipe, SetterForRefParam { - private final Map instance; - public QueryParametersMap000110Builder(Map instance) { - this.instance = instance; - } - public Map getInstance() { - return instance; - } - public QueryParametersMap000010Builder getBuilderAfterPipe(Map instance) { - return new QueryParametersMap000010Builder(instance); - } - public QueryParametersMap000100Builder getBuilderAfterRefParam(Map instance) { - return new QueryParametersMap000100Builder(instance); - } - } - - public static class QueryParametersMap000111Builder implements SetterForPipe, SetterForRefParam, SetterForUrl { - private final Map instance; - public QueryParametersMap000111Builder(Map instance) { - this.instance = instance; - } - public Map getInstance() { - return instance; - } - public QueryParametersMap000011Builder getBuilderAfterPipe(Map instance) { - return new QueryParametersMap000011Builder(instance); - } - public QueryParametersMap000101Builder getBuilderAfterRefParam(Map instance) { - return new QueryParametersMap000101Builder(instance); - } - public QueryParametersMap000110Builder getBuilderAfterUrl(Map instance) { - return new QueryParametersMap000110Builder(instance); - } - } - - public static class QueryParametersMap001000Builder implements SetterForIoutil { - private final Map instance; - public QueryParametersMap001000Builder(Map instance) { - this.instance = instance; - } - public Map getInstance() { - return instance; - } - public QueryParametersMap000000Builder getBuilderAfterIoutil(Map instance) { - return new QueryParametersMap000000Builder(instance); - } - } - - public static class QueryParametersMap001001Builder implements SetterForIoutil, SetterForUrl { - private final Map instance; - public QueryParametersMap001001Builder(Map instance) { - this.instance = instance; - } - public Map getInstance() { - return instance; - } - public QueryParametersMap000001Builder getBuilderAfterIoutil(Map instance) { - return new QueryParametersMap000001Builder(instance); - } - public QueryParametersMap001000Builder getBuilderAfterUrl(Map instance) { - return new QueryParametersMap001000Builder(instance); - } - } - - public static class QueryParametersMap001010Builder implements SetterForIoutil, SetterForRefParam { - private final Map instance; - public QueryParametersMap001010Builder(Map instance) { - this.instance = instance; - } - public Map getInstance() { - return instance; - } - public QueryParametersMap000010Builder getBuilderAfterIoutil(Map instance) { - return new QueryParametersMap000010Builder(instance); - } - public QueryParametersMap001000Builder getBuilderAfterRefParam(Map instance) { - return new QueryParametersMap001000Builder(instance); - } - } - - public static class QueryParametersMap001011Builder implements SetterForIoutil, SetterForRefParam, SetterForUrl { - private final Map instance; - public QueryParametersMap001011Builder(Map instance) { - this.instance = instance; - } - public Map getInstance() { - return instance; - } - public QueryParametersMap000011Builder getBuilderAfterIoutil(Map instance) { - return new QueryParametersMap000011Builder(instance); - } - public QueryParametersMap001001Builder getBuilderAfterRefParam(Map instance) { - return new QueryParametersMap001001Builder(instance); - } - public QueryParametersMap001010Builder getBuilderAfterUrl(Map instance) { - return new QueryParametersMap001010Builder(instance); - } - } - - public static class QueryParametersMap001100Builder implements SetterForIoutil, SetterForPipe { - private final Map instance; - public QueryParametersMap001100Builder(Map instance) { - this.instance = instance; - } - public Map getInstance() { - return instance; - } - public QueryParametersMap000100Builder getBuilderAfterIoutil(Map instance) { - return new QueryParametersMap000100Builder(instance); - } - public QueryParametersMap001000Builder getBuilderAfterPipe(Map instance) { - return new QueryParametersMap001000Builder(instance); - } - } - - public static class QueryParametersMap001101Builder implements SetterForIoutil, SetterForPipe, SetterForUrl { - private final Map instance; - public QueryParametersMap001101Builder(Map instance) { - this.instance = instance; - } - public Map getInstance() { - return instance; - } - public QueryParametersMap000101Builder getBuilderAfterIoutil(Map instance) { - return new QueryParametersMap000101Builder(instance); - } - public QueryParametersMap001001Builder getBuilderAfterPipe(Map instance) { - return new QueryParametersMap001001Builder(instance); - } - public QueryParametersMap001100Builder getBuilderAfterUrl(Map instance) { - return new QueryParametersMap001100Builder(instance); - } - } - - public static class QueryParametersMap001110Builder implements SetterForIoutil, SetterForPipe, SetterForRefParam { - private final Map instance; - public QueryParametersMap001110Builder(Map instance) { - this.instance = instance; - } - public Map getInstance() { - return instance; - } - public QueryParametersMap000110Builder getBuilderAfterIoutil(Map instance) { - return new QueryParametersMap000110Builder(instance); - } - public QueryParametersMap001010Builder getBuilderAfterPipe(Map instance) { - return new QueryParametersMap001010Builder(instance); - } - public QueryParametersMap001100Builder getBuilderAfterRefParam(Map instance) { - return new QueryParametersMap001100Builder(instance); - } - } - - public static class QueryParametersMap001111Builder implements SetterForIoutil, SetterForPipe, SetterForRefParam, SetterForUrl { - private final Map instance; - public QueryParametersMap001111Builder(Map instance) { - this.instance = instance; - } - public Map getInstance() { - return instance; - } - public QueryParametersMap000111Builder getBuilderAfterIoutil(Map instance) { - return new QueryParametersMap000111Builder(instance); - } - public QueryParametersMap001011Builder getBuilderAfterPipe(Map instance) { - return new QueryParametersMap001011Builder(instance); - } - public QueryParametersMap001101Builder getBuilderAfterRefParam(Map instance) { - return new QueryParametersMap001101Builder(instance); - } - public QueryParametersMap001110Builder getBuilderAfterUrl(Map instance) { - return new QueryParametersMap001110Builder(instance); - } - } - - public static class QueryParametersMap010000Builder implements SetterForHttp { - private final Map instance; - public QueryParametersMap010000Builder(Map instance) { - this.instance = instance; - } - public Map getInstance() { - return instance; - } - public QueryParametersMap000000Builder getBuilderAfterHttp(Map instance) { - return new QueryParametersMap000000Builder(instance); - } - } - - public static class QueryParametersMap010001Builder implements SetterForHttp, SetterForUrl { - private final Map instance; - public QueryParametersMap010001Builder(Map instance) { - this.instance = instance; - } - public Map getInstance() { - return instance; - } - public QueryParametersMap000001Builder getBuilderAfterHttp(Map instance) { - return new QueryParametersMap000001Builder(instance); - } - public QueryParametersMap010000Builder getBuilderAfterUrl(Map instance) { - return new QueryParametersMap010000Builder(instance); - } - } - - public static class QueryParametersMap010010Builder implements SetterForHttp, SetterForRefParam { - private final Map instance; - public QueryParametersMap010010Builder(Map instance) { - this.instance = instance; - } - public Map getInstance() { - return instance; - } - public QueryParametersMap000010Builder getBuilderAfterHttp(Map instance) { - return new QueryParametersMap000010Builder(instance); - } - public QueryParametersMap010000Builder getBuilderAfterRefParam(Map instance) { - return new QueryParametersMap010000Builder(instance); - } - } - - public static class QueryParametersMap010011Builder implements SetterForHttp, SetterForRefParam, SetterForUrl { - private final Map instance; - public QueryParametersMap010011Builder(Map instance) { - this.instance = instance; - } - public Map getInstance() { - return instance; - } - public QueryParametersMap000011Builder getBuilderAfterHttp(Map instance) { - return new QueryParametersMap000011Builder(instance); - } - public QueryParametersMap010001Builder getBuilderAfterRefParam(Map instance) { - return new QueryParametersMap010001Builder(instance); - } - public QueryParametersMap010010Builder getBuilderAfterUrl(Map instance) { - return new QueryParametersMap010010Builder(instance); - } - } - - public static class QueryParametersMap010100Builder implements SetterForHttp, SetterForPipe { - private final Map instance; - public QueryParametersMap010100Builder(Map instance) { - this.instance = instance; - } - public Map getInstance() { - return instance; - } - public QueryParametersMap000100Builder getBuilderAfterHttp(Map instance) { - return new QueryParametersMap000100Builder(instance); - } - public QueryParametersMap010000Builder getBuilderAfterPipe(Map instance) { - return new QueryParametersMap010000Builder(instance); - } - } - - public static class QueryParametersMap010101Builder implements SetterForHttp, SetterForPipe, SetterForUrl { - private final Map instance; - public QueryParametersMap010101Builder(Map instance) { - this.instance = instance; - } - public Map getInstance() { - return instance; - } - public QueryParametersMap000101Builder getBuilderAfterHttp(Map instance) { - return new QueryParametersMap000101Builder(instance); - } - public QueryParametersMap010001Builder getBuilderAfterPipe(Map instance) { - return new QueryParametersMap010001Builder(instance); - } - public QueryParametersMap010100Builder getBuilderAfterUrl(Map instance) { - return new QueryParametersMap010100Builder(instance); - } - } - - public static class QueryParametersMap010110Builder implements SetterForHttp, SetterForPipe, SetterForRefParam { - private final Map instance; - public QueryParametersMap010110Builder(Map instance) { - this.instance = instance; - } - public Map getInstance() { - return instance; - } - public QueryParametersMap000110Builder getBuilderAfterHttp(Map instance) { - return new QueryParametersMap000110Builder(instance); - } - public QueryParametersMap010010Builder getBuilderAfterPipe(Map instance) { - return new QueryParametersMap010010Builder(instance); - } - public QueryParametersMap010100Builder getBuilderAfterRefParam(Map instance) { - return new QueryParametersMap010100Builder(instance); - } - } - - public static class QueryParametersMap010111Builder implements SetterForHttp, SetterForPipe, SetterForRefParam, SetterForUrl { - private final Map instance; - public QueryParametersMap010111Builder(Map instance) { - this.instance = instance; - } - public Map getInstance() { - return instance; - } - public QueryParametersMap000111Builder getBuilderAfterHttp(Map instance) { - return new QueryParametersMap000111Builder(instance); - } - public QueryParametersMap010011Builder getBuilderAfterPipe(Map instance) { - return new QueryParametersMap010011Builder(instance); - } - public QueryParametersMap010101Builder getBuilderAfterRefParam(Map instance) { - return new QueryParametersMap010101Builder(instance); - } - public QueryParametersMap010110Builder getBuilderAfterUrl(Map instance) { - return new QueryParametersMap010110Builder(instance); - } - } - - public static class QueryParametersMap011000Builder implements SetterForHttp, SetterForIoutil { - private final Map instance; - public QueryParametersMap011000Builder(Map instance) { - this.instance = instance; - } - public Map getInstance() { - return instance; - } - public QueryParametersMap001000Builder getBuilderAfterHttp(Map instance) { - return new QueryParametersMap001000Builder(instance); - } - public QueryParametersMap010000Builder getBuilderAfterIoutil(Map instance) { - return new QueryParametersMap010000Builder(instance); - } - } - - public static class QueryParametersMap011001Builder implements SetterForHttp, SetterForIoutil, SetterForUrl { - private final Map instance; - public QueryParametersMap011001Builder(Map instance) { - this.instance = instance; - } - public Map getInstance() { - return instance; - } - public QueryParametersMap001001Builder getBuilderAfterHttp(Map instance) { - return new QueryParametersMap001001Builder(instance); - } - public QueryParametersMap010001Builder getBuilderAfterIoutil(Map instance) { - return new QueryParametersMap010001Builder(instance); - } - public QueryParametersMap011000Builder getBuilderAfterUrl(Map instance) { - return new QueryParametersMap011000Builder(instance); - } - } - - public static class QueryParametersMap011010Builder implements SetterForHttp, SetterForIoutil, SetterForRefParam { - private final Map instance; - public QueryParametersMap011010Builder(Map instance) { - this.instance = instance; - } - public Map getInstance() { - return instance; - } - public QueryParametersMap001010Builder getBuilderAfterHttp(Map instance) { - return new QueryParametersMap001010Builder(instance); - } - public QueryParametersMap010010Builder getBuilderAfterIoutil(Map instance) { - return new QueryParametersMap010010Builder(instance); - } - public QueryParametersMap011000Builder getBuilderAfterRefParam(Map instance) { - return new QueryParametersMap011000Builder(instance); - } - } - - public static class QueryParametersMap011011Builder implements SetterForHttp, SetterForIoutil, SetterForRefParam, SetterForUrl { - private final Map instance; - public QueryParametersMap011011Builder(Map instance) { - this.instance = instance; - } - public Map getInstance() { - return instance; - } - public QueryParametersMap001011Builder getBuilderAfterHttp(Map instance) { - return new QueryParametersMap001011Builder(instance); - } - public QueryParametersMap010011Builder getBuilderAfterIoutil(Map instance) { - return new QueryParametersMap010011Builder(instance); - } - public QueryParametersMap011001Builder getBuilderAfterRefParam(Map instance) { - return new QueryParametersMap011001Builder(instance); - } - public QueryParametersMap011010Builder getBuilderAfterUrl(Map instance) { - return new QueryParametersMap011010Builder(instance); - } - } - - public static class QueryParametersMap011100Builder implements SetterForHttp, SetterForIoutil, SetterForPipe { - private final Map instance; - public QueryParametersMap011100Builder(Map instance) { - this.instance = instance; - } - public Map getInstance() { - return instance; - } - public QueryParametersMap001100Builder getBuilderAfterHttp(Map instance) { - return new QueryParametersMap001100Builder(instance); - } - public QueryParametersMap010100Builder getBuilderAfterIoutil(Map instance) { - return new QueryParametersMap010100Builder(instance); - } - public QueryParametersMap011000Builder getBuilderAfterPipe(Map instance) { - return new QueryParametersMap011000Builder(instance); - } - } - - public static class QueryParametersMap011101Builder implements SetterForHttp, SetterForIoutil, SetterForPipe, SetterForUrl { - private final Map instance; - public QueryParametersMap011101Builder(Map instance) { - this.instance = instance; - } - public Map getInstance() { - return instance; - } - public QueryParametersMap001101Builder getBuilderAfterHttp(Map instance) { - return new QueryParametersMap001101Builder(instance); - } - public QueryParametersMap010101Builder getBuilderAfterIoutil(Map instance) { - return new QueryParametersMap010101Builder(instance); - } - public QueryParametersMap011001Builder getBuilderAfterPipe(Map instance) { - return new QueryParametersMap011001Builder(instance); - } - public QueryParametersMap011100Builder getBuilderAfterUrl(Map instance) { - return new QueryParametersMap011100Builder(instance); - } - } - - public static class QueryParametersMap011110Builder implements SetterForHttp, SetterForIoutil, SetterForPipe, SetterForRefParam { - private final Map instance; - public QueryParametersMap011110Builder(Map instance) { - this.instance = instance; - } - public Map getInstance() { - return instance; - } - public QueryParametersMap001110Builder getBuilderAfterHttp(Map instance) { - return new QueryParametersMap001110Builder(instance); - } - public QueryParametersMap010110Builder getBuilderAfterIoutil(Map instance) { - return new QueryParametersMap010110Builder(instance); - } - public QueryParametersMap011010Builder getBuilderAfterPipe(Map instance) { - return new QueryParametersMap011010Builder(instance); - } - public QueryParametersMap011100Builder getBuilderAfterRefParam(Map instance) { - return new QueryParametersMap011100Builder(instance); - } - } - - public static class QueryParametersMap011111Builder implements SetterForHttp, SetterForIoutil, SetterForPipe, SetterForRefParam, SetterForUrl { - private final Map instance; - public QueryParametersMap011111Builder(Map instance) { - this.instance = instance; - } - public Map getInstance() { - return instance; - } - public QueryParametersMap001111Builder getBuilderAfterHttp(Map instance) { - return new QueryParametersMap001111Builder(instance); - } - public QueryParametersMap010111Builder getBuilderAfterIoutil(Map instance) { - return new QueryParametersMap010111Builder(instance); - } - public QueryParametersMap011011Builder getBuilderAfterPipe(Map instance) { - return new QueryParametersMap011011Builder(instance); - } - public QueryParametersMap011101Builder getBuilderAfterRefParam(Map instance) { - return new QueryParametersMap011101Builder(instance); - } - public QueryParametersMap011110Builder getBuilderAfterUrl(Map instance) { - return new QueryParametersMap011110Builder(instance); - } - } - - public static class QueryParametersMap100000Builder implements SetterForContext { - private final Map instance; - public QueryParametersMap100000Builder(Map instance) { - this.instance = instance; - } - public Map getInstance() { - return instance; - } - public QueryParametersMap000000Builder getBuilderAfterContext(Map instance) { - return new QueryParametersMap000000Builder(instance); - } - } - - public static class QueryParametersMap100001Builder implements SetterForContext, SetterForUrl { - private final Map instance; - public QueryParametersMap100001Builder(Map instance) { - this.instance = instance; - } - public Map getInstance() { - return instance; - } - public QueryParametersMap000001Builder getBuilderAfterContext(Map instance) { - return new QueryParametersMap000001Builder(instance); - } - public QueryParametersMap100000Builder getBuilderAfterUrl(Map instance) { - return new QueryParametersMap100000Builder(instance); - } - } - - public static class QueryParametersMap100010Builder implements SetterForContext, SetterForRefParam { - private final Map instance; - public QueryParametersMap100010Builder(Map instance) { - this.instance = instance; - } - public Map getInstance() { - return instance; - } - public QueryParametersMap000010Builder getBuilderAfterContext(Map instance) { - return new QueryParametersMap000010Builder(instance); - } - public QueryParametersMap100000Builder getBuilderAfterRefParam(Map instance) { - return new QueryParametersMap100000Builder(instance); - } - } - - public static class QueryParametersMap100011Builder implements SetterForContext, SetterForRefParam, SetterForUrl { - private final Map instance; - public QueryParametersMap100011Builder(Map instance) { - this.instance = instance; - } - public Map getInstance() { - return instance; - } - public QueryParametersMap000011Builder getBuilderAfterContext(Map instance) { - return new QueryParametersMap000011Builder(instance); - } - public QueryParametersMap100001Builder getBuilderAfterRefParam(Map instance) { - return new QueryParametersMap100001Builder(instance); - } - public QueryParametersMap100010Builder getBuilderAfterUrl(Map instance) { - return new QueryParametersMap100010Builder(instance); - } - } - - public static class QueryParametersMap100100Builder implements SetterForContext, SetterForPipe { - private final Map instance; - public QueryParametersMap100100Builder(Map instance) { - this.instance = instance; - } - public Map getInstance() { - return instance; - } - public QueryParametersMap000100Builder getBuilderAfterContext(Map instance) { - return new QueryParametersMap000100Builder(instance); - } - public QueryParametersMap100000Builder getBuilderAfterPipe(Map instance) { - return new QueryParametersMap100000Builder(instance); - } - } - - public static class QueryParametersMap100101Builder implements SetterForContext, SetterForPipe, SetterForUrl { - private final Map instance; - public QueryParametersMap100101Builder(Map instance) { - this.instance = instance; - } - public Map getInstance() { - return instance; - } - public QueryParametersMap000101Builder getBuilderAfterContext(Map instance) { - return new QueryParametersMap000101Builder(instance); - } - public QueryParametersMap100001Builder getBuilderAfterPipe(Map instance) { - return new QueryParametersMap100001Builder(instance); - } - public QueryParametersMap100100Builder getBuilderAfterUrl(Map instance) { - return new QueryParametersMap100100Builder(instance); - } - } - - public static class QueryParametersMap100110Builder implements SetterForContext, SetterForPipe, SetterForRefParam { - private final Map instance; - public QueryParametersMap100110Builder(Map instance) { - this.instance = instance; - } - public Map getInstance() { - return instance; - } - public QueryParametersMap000110Builder getBuilderAfterContext(Map instance) { - return new QueryParametersMap000110Builder(instance); - } - public QueryParametersMap100010Builder getBuilderAfterPipe(Map instance) { - return new QueryParametersMap100010Builder(instance); - } - public QueryParametersMap100100Builder getBuilderAfterRefParam(Map instance) { - return new QueryParametersMap100100Builder(instance); - } - } - - public static class QueryParametersMap100111Builder implements SetterForContext, SetterForPipe, SetterForRefParam, SetterForUrl { - private final Map instance; - public QueryParametersMap100111Builder(Map instance) { - this.instance = instance; - } - public Map getInstance() { - return instance; - } - public QueryParametersMap000111Builder getBuilderAfterContext(Map instance) { - return new QueryParametersMap000111Builder(instance); - } - public QueryParametersMap100011Builder getBuilderAfterPipe(Map instance) { - return new QueryParametersMap100011Builder(instance); - } - public QueryParametersMap100101Builder getBuilderAfterRefParam(Map instance) { - return new QueryParametersMap100101Builder(instance); - } - public QueryParametersMap100110Builder getBuilderAfterUrl(Map instance) { - return new QueryParametersMap100110Builder(instance); - } - } - - public static class QueryParametersMap101000Builder implements SetterForContext, SetterForIoutil { - private final Map instance; - public QueryParametersMap101000Builder(Map instance) { - this.instance = instance; - } - public Map getInstance() { - return instance; - } - public QueryParametersMap001000Builder getBuilderAfterContext(Map instance) { - return new QueryParametersMap001000Builder(instance); - } - public QueryParametersMap100000Builder getBuilderAfterIoutil(Map instance) { - return new QueryParametersMap100000Builder(instance); - } - } - - public static class QueryParametersMap101001Builder implements SetterForContext, SetterForIoutil, SetterForUrl { - private final Map instance; - public QueryParametersMap101001Builder(Map instance) { - this.instance = instance; - } - public Map getInstance() { - return instance; - } - public QueryParametersMap001001Builder getBuilderAfterContext(Map instance) { - return new QueryParametersMap001001Builder(instance); - } - public QueryParametersMap100001Builder getBuilderAfterIoutil(Map instance) { - return new QueryParametersMap100001Builder(instance); - } - public QueryParametersMap101000Builder getBuilderAfterUrl(Map instance) { - return new QueryParametersMap101000Builder(instance); - } - } - - public static class QueryParametersMap101010Builder implements SetterForContext, SetterForIoutil, SetterForRefParam { - private final Map instance; - public QueryParametersMap101010Builder(Map instance) { - this.instance = instance; - } - public Map getInstance() { - return instance; - } - public QueryParametersMap001010Builder getBuilderAfterContext(Map instance) { - return new QueryParametersMap001010Builder(instance); - } - public QueryParametersMap100010Builder getBuilderAfterIoutil(Map instance) { - return new QueryParametersMap100010Builder(instance); - } - public QueryParametersMap101000Builder getBuilderAfterRefParam(Map instance) { - return new QueryParametersMap101000Builder(instance); - } - } - - public static class QueryParametersMap101011Builder implements SetterForContext, SetterForIoutil, SetterForRefParam, SetterForUrl { - private final Map instance; - public QueryParametersMap101011Builder(Map instance) { - this.instance = instance; - } - public Map getInstance() { - return instance; - } - public QueryParametersMap001011Builder getBuilderAfterContext(Map instance) { - return new QueryParametersMap001011Builder(instance); - } - public QueryParametersMap100011Builder getBuilderAfterIoutil(Map instance) { - return new QueryParametersMap100011Builder(instance); - } - public QueryParametersMap101001Builder getBuilderAfterRefParam(Map instance) { - return new QueryParametersMap101001Builder(instance); - } - public QueryParametersMap101010Builder getBuilderAfterUrl(Map instance) { - return new QueryParametersMap101010Builder(instance); - } - } - - public static class QueryParametersMap101100Builder implements SetterForContext, SetterForIoutil, SetterForPipe { - private final Map instance; - public QueryParametersMap101100Builder(Map instance) { - this.instance = instance; - } - public Map getInstance() { - return instance; - } - public QueryParametersMap001100Builder getBuilderAfterContext(Map instance) { - return new QueryParametersMap001100Builder(instance); - } - public QueryParametersMap100100Builder getBuilderAfterIoutil(Map instance) { - return new QueryParametersMap100100Builder(instance); - } - public QueryParametersMap101000Builder getBuilderAfterPipe(Map instance) { - return new QueryParametersMap101000Builder(instance); - } - } - - public static class QueryParametersMap101101Builder implements SetterForContext, SetterForIoutil, SetterForPipe, SetterForUrl { - private final Map instance; - public QueryParametersMap101101Builder(Map instance) { - this.instance = instance; - } - public Map getInstance() { - return instance; - } - public QueryParametersMap001101Builder getBuilderAfterContext(Map instance) { - return new QueryParametersMap001101Builder(instance); - } - public QueryParametersMap100101Builder getBuilderAfterIoutil(Map instance) { - return new QueryParametersMap100101Builder(instance); - } - public QueryParametersMap101001Builder getBuilderAfterPipe(Map instance) { - return new QueryParametersMap101001Builder(instance); - } - public QueryParametersMap101100Builder getBuilderAfterUrl(Map instance) { - return new QueryParametersMap101100Builder(instance); - } - } - - public static class QueryParametersMap101110Builder implements SetterForContext, SetterForIoutil, SetterForPipe, SetterForRefParam { - private final Map instance; - public QueryParametersMap101110Builder(Map instance) { - this.instance = instance; - } - public Map getInstance() { - return instance; - } - public QueryParametersMap001110Builder getBuilderAfterContext(Map instance) { - return new QueryParametersMap001110Builder(instance); - } - public QueryParametersMap100110Builder getBuilderAfterIoutil(Map instance) { - return new QueryParametersMap100110Builder(instance); - } - public QueryParametersMap101010Builder getBuilderAfterPipe(Map instance) { - return new QueryParametersMap101010Builder(instance); - } - public QueryParametersMap101100Builder getBuilderAfterRefParam(Map instance) { - return new QueryParametersMap101100Builder(instance); - } - } - - public static class QueryParametersMap101111Builder implements SetterForContext, SetterForIoutil, SetterForPipe, SetterForRefParam, SetterForUrl { - private final Map instance; - public QueryParametersMap101111Builder(Map instance) { - this.instance = instance; - } - public Map getInstance() { - return instance; - } - public QueryParametersMap001111Builder getBuilderAfterContext(Map instance) { - return new QueryParametersMap001111Builder(instance); - } - public QueryParametersMap100111Builder getBuilderAfterIoutil(Map instance) { - return new QueryParametersMap100111Builder(instance); - } - public QueryParametersMap101011Builder getBuilderAfterPipe(Map instance) { - return new QueryParametersMap101011Builder(instance); - } - public QueryParametersMap101101Builder getBuilderAfterRefParam(Map instance) { - return new QueryParametersMap101101Builder(instance); - } - public QueryParametersMap101110Builder getBuilderAfterUrl(Map instance) { - return new QueryParametersMap101110Builder(instance); - } - } - - public static class QueryParametersMap110000Builder implements SetterForContext, SetterForHttp { - private final Map instance; - public QueryParametersMap110000Builder(Map instance) { - this.instance = instance; - } - public Map getInstance() { - return instance; - } - public QueryParametersMap010000Builder getBuilderAfterContext(Map instance) { - return new QueryParametersMap010000Builder(instance); - } - public QueryParametersMap100000Builder getBuilderAfterHttp(Map instance) { - return new QueryParametersMap100000Builder(instance); - } - } - - public static class QueryParametersMap110001Builder implements SetterForContext, SetterForHttp, SetterForUrl { - private final Map instance; - public QueryParametersMap110001Builder(Map instance) { - this.instance = instance; - } - public Map getInstance() { - return instance; - } - public QueryParametersMap010001Builder getBuilderAfterContext(Map instance) { - return new QueryParametersMap010001Builder(instance); - } - public QueryParametersMap100001Builder getBuilderAfterHttp(Map instance) { - return new QueryParametersMap100001Builder(instance); - } - public QueryParametersMap110000Builder getBuilderAfterUrl(Map instance) { - return new QueryParametersMap110000Builder(instance); - } - } - - public static class QueryParametersMap110010Builder implements SetterForContext, SetterForHttp, SetterForRefParam { - private final Map instance; - public QueryParametersMap110010Builder(Map instance) { - this.instance = instance; - } - public Map getInstance() { - return instance; - } - public QueryParametersMap010010Builder getBuilderAfterContext(Map instance) { - return new QueryParametersMap010010Builder(instance); - } - public QueryParametersMap100010Builder getBuilderAfterHttp(Map instance) { - return new QueryParametersMap100010Builder(instance); - } - public QueryParametersMap110000Builder getBuilderAfterRefParam(Map instance) { - return new QueryParametersMap110000Builder(instance); - } - } - - public static class QueryParametersMap110011Builder implements SetterForContext, SetterForHttp, SetterForRefParam, SetterForUrl { - private final Map instance; - public QueryParametersMap110011Builder(Map instance) { - this.instance = instance; - } - public Map getInstance() { - return instance; - } - public QueryParametersMap010011Builder getBuilderAfterContext(Map instance) { - return new QueryParametersMap010011Builder(instance); - } - public QueryParametersMap100011Builder getBuilderAfterHttp(Map instance) { - return new QueryParametersMap100011Builder(instance); - } - public QueryParametersMap110001Builder getBuilderAfterRefParam(Map instance) { - return new QueryParametersMap110001Builder(instance); - } - public QueryParametersMap110010Builder getBuilderAfterUrl(Map instance) { - return new QueryParametersMap110010Builder(instance); - } - } - - public static class QueryParametersMap110100Builder implements SetterForContext, SetterForHttp, SetterForPipe { - private final Map instance; - public QueryParametersMap110100Builder(Map instance) { - this.instance = instance; - } - public Map getInstance() { - return instance; - } - public QueryParametersMap010100Builder getBuilderAfterContext(Map instance) { - return new QueryParametersMap010100Builder(instance); - } - public QueryParametersMap100100Builder getBuilderAfterHttp(Map instance) { - return new QueryParametersMap100100Builder(instance); - } - public QueryParametersMap110000Builder getBuilderAfterPipe(Map instance) { - return new QueryParametersMap110000Builder(instance); - } - } - - public static class QueryParametersMap110101Builder implements SetterForContext, SetterForHttp, SetterForPipe, SetterForUrl { - private final Map instance; - public QueryParametersMap110101Builder(Map instance) { - this.instance = instance; - } - public Map getInstance() { - return instance; - } - public QueryParametersMap010101Builder getBuilderAfterContext(Map instance) { - return new QueryParametersMap010101Builder(instance); - } - public QueryParametersMap100101Builder getBuilderAfterHttp(Map instance) { - return new QueryParametersMap100101Builder(instance); - } - public QueryParametersMap110001Builder getBuilderAfterPipe(Map instance) { - return new QueryParametersMap110001Builder(instance); - } - public QueryParametersMap110100Builder getBuilderAfterUrl(Map instance) { - return new QueryParametersMap110100Builder(instance); - } - } - - public static class QueryParametersMap110110Builder implements SetterForContext, SetterForHttp, SetterForPipe, SetterForRefParam { - private final Map instance; - public QueryParametersMap110110Builder(Map instance) { - this.instance = instance; - } - public Map getInstance() { - return instance; - } - public QueryParametersMap010110Builder getBuilderAfterContext(Map instance) { - return new QueryParametersMap010110Builder(instance); - } - public QueryParametersMap100110Builder getBuilderAfterHttp(Map instance) { - return new QueryParametersMap100110Builder(instance); - } - public QueryParametersMap110010Builder getBuilderAfterPipe(Map instance) { - return new QueryParametersMap110010Builder(instance); - } - public QueryParametersMap110100Builder getBuilderAfterRefParam(Map instance) { - return new QueryParametersMap110100Builder(instance); - } - } - - public static class QueryParametersMap110111Builder implements SetterForContext, SetterForHttp, SetterForPipe, SetterForRefParam, SetterForUrl { - private final Map instance; - public QueryParametersMap110111Builder(Map instance) { - this.instance = instance; - } - public Map getInstance() { - return instance; - } - public QueryParametersMap010111Builder getBuilderAfterContext(Map instance) { - return new QueryParametersMap010111Builder(instance); - } - public QueryParametersMap100111Builder getBuilderAfterHttp(Map instance) { - return new QueryParametersMap100111Builder(instance); - } - public QueryParametersMap110011Builder getBuilderAfterPipe(Map instance) { - return new QueryParametersMap110011Builder(instance); - } - public QueryParametersMap110101Builder getBuilderAfterRefParam(Map instance) { - return new QueryParametersMap110101Builder(instance); - } - public QueryParametersMap110110Builder getBuilderAfterUrl(Map instance) { - return new QueryParametersMap110110Builder(instance); - } - } - - public static class QueryParametersMap111000Builder implements SetterForContext, SetterForHttp, SetterForIoutil { - private final Map instance; - public QueryParametersMap111000Builder(Map instance) { - this.instance = instance; - } - public Map getInstance() { - return instance; - } - public QueryParametersMap011000Builder getBuilderAfterContext(Map instance) { - return new QueryParametersMap011000Builder(instance); - } - public QueryParametersMap101000Builder getBuilderAfterHttp(Map instance) { - return new QueryParametersMap101000Builder(instance); - } - public QueryParametersMap110000Builder getBuilderAfterIoutil(Map instance) { - return new QueryParametersMap110000Builder(instance); - } - } - - public static class QueryParametersMap111001Builder implements SetterForContext, SetterForHttp, SetterForIoutil, SetterForUrl { - private final Map instance; - public QueryParametersMap111001Builder(Map instance) { - this.instance = instance; - } - public Map getInstance() { - return instance; - } - public QueryParametersMap011001Builder getBuilderAfterContext(Map instance) { - return new QueryParametersMap011001Builder(instance); - } - public QueryParametersMap101001Builder getBuilderAfterHttp(Map instance) { - return new QueryParametersMap101001Builder(instance); - } - public QueryParametersMap110001Builder getBuilderAfterIoutil(Map instance) { - return new QueryParametersMap110001Builder(instance); - } - public QueryParametersMap111000Builder getBuilderAfterUrl(Map instance) { - return new QueryParametersMap111000Builder(instance); - } - } - - public static class QueryParametersMap111010Builder implements SetterForContext, SetterForHttp, SetterForIoutil, SetterForRefParam { - private final Map instance; - public QueryParametersMap111010Builder(Map instance) { - this.instance = instance; - } - public Map getInstance() { - return instance; - } - public QueryParametersMap011010Builder getBuilderAfterContext(Map instance) { - return new QueryParametersMap011010Builder(instance); - } - public QueryParametersMap101010Builder getBuilderAfterHttp(Map instance) { - return new QueryParametersMap101010Builder(instance); - } - public QueryParametersMap110010Builder getBuilderAfterIoutil(Map instance) { - return new QueryParametersMap110010Builder(instance); - } - public QueryParametersMap111000Builder getBuilderAfterRefParam(Map instance) { - return new QueryParametersMap111000Builder(instance); - } - } - - public static class QueryParametersMap111011Builder implements SetterForContext, SetterForHttp, SetterForIoutil, SetterForRefParam, SetterForUrl { - private final Map instance; - public QueryParametersMap111011Builder(Map instance) { - this.instance = instance; - } - public Map getInstance() { - return instance; - } - public QueryParametersMap011011Builder getBuilderAfterContext(Map instance) { - return new QueryParametersMap011011Builder(instance); - } - public QueryParametersMap101011Builder getBuilderAfterHttp(Map instance) { - return new QueryParametersMap101011Builder(instance); - } - public QueryParametersMap110011Builder getBuilderAfterIoutil(Map instance) { - return new QueryParametersMap110011Builder(instance); - } - public QueryParametersMap111001Builder getBuilderAfterRefParam(Map instance) { - return new QueryParametersMap111001Builder(instance); - } - public QueryParametersMap111010Builder getBuilderAfterUrl(Map instance) { - return new QueryParametersMap111010Builder(instance); - } - } - - public static class QueryParametersMap111100Builder implements SetterForContext, SetterForHttp, SetterForIoutil, SetterForPipe { - private final Map instance; - public QueryParametersMap111100Builder(Map instance) { - this.instance = instance; - } - public Map getInstance() { - return instance; - } - public QueryParametersMap011100Builder getBuilderAfterContext(Map instance) { - return new QueryParametersMap011100Builder(instance); - } - public QueryParametersMap101100Builder getBuilderAfterHttp(Map instance) { - return new QueryParametersMap101100Builder(instance); - } - public QueryParametersMap110100Builder getBuilderAfterIoutil(Map instance) { - return new QueryParametersMap110100Builder(instance); - } - public QueryParametersMap111000Builder getBuilderAfterPipe(Map instance) { - return new QueryParametersMap111000Builder(instance); - } - } - - public static class QueryParametersMap111101Builder implements SetterForContext, SetterForHttp, SetterForIoutil, SetterForPipe, SetterForUrl { - private final Map instance; - public QueryParametersMap111101Builder(Map instance) { - this.instance = instance; - } - public Map getInstance() { - return instance; - } - public QueryParametersMap011101Builder getBuilderAfterContext(Map instance) { - return new QueryParametersMap011101Builder(instance); - } - public QueryParametersMap101101Builder getBuilderAfterHttp(Map instance) { - return new QueryParametersMap101101Builder(instance); - } - public QueryParametersMap110101Builder getBuilderAfterIoutil(Map instance) { - return new QueryParametersMap110101Builder(instance); - } - public QueryParametersMap111001Builder getBuilderAfterPipe(Map instance) { - return new QueryParametersMap111001Builder(instance); - } - public QueryParametersMap111100Builder getBuilderAfterUrl(Map instance) { - return new QueryParametersMap111100Builder(instance); - } - } - - public static class QueryParametersMap111110Builder implements SetterForContext, SetterForHttp, SetterForIoutil, SetterForPipe, SetterForRefParam { - private final Map instance; - public QueryParametersMap111110Builder(Map instance) { - this.instance = instance; - } - public Map getInstance() { - return instance; - } - public QueryParametersMap011110Builder getBuilderAfterContext(Map instance) { - return new QueryParametersMap011110Builder(instance); - } - public QueryParametersMap101110Builder getBuilderAfterHttp(Map instance) { - return new QueryParametersMap101110Builder(instance); - } - public QueryParametersMap110110Builder getBuilderAfterIoutil(Map instance) { - return new QueryParametersMap110110Builder(instance); - } - public QueryParametersMap111010Builder getBuilderAfterPipe(Map instance) { - return new QueryParametersMap111010Builder(instance); - } - public QueryParametersMap111100Builder getBuilderAfterRefParam(Map instance) { - return new QueryParametersMap111100Builder(instance); - } - } - - public static class QueryParametersMapBuilder implements SetterForContext, SetterForHttp, SetterForIoutil, SetterForPipe, SetterForRefParam, SetterForUrl { - private final Map instance; - public QueryParametersMapBuilder() { - this.instance = new LinkedHashMap<>(); - } - public Map getInstance() { - return instance; - } - public QueryParametersMap011111Builder getBuilderAfterContext(Map instance) { - return new QueryParametersMap011111Builder(instance); - } - public QueryParametersMap101111Builder getBuilderAfterHttp(Map instance) { - return new QueryParametersMap101111Builder(instance); - } - public QueryParametersMap110111Builder getBuilderAfterIoutil(Map instance) { - return new QueryParametersMap110111Builder(instance); - } - public QueryParametersMap111011Builder getBuilderAfterPipe(Map instance) { - return new QueryParametersMap111011Builder(instance); - } - public QueryParametersMap111101Builder getBuilderAfterRefParam(Map instance) { - return new QueryParametersMap111101Builder(instance); - } - public QueryParametersMap111110Builder getBuilderAfterUrl(Map instance) { - return new QueryParametersMap111110Builder(instance); - } - } - - - public sealed interface FaketestqueryparamtersPutQueryParameters1Boxed permits FaketestqueryparamtersPutQueryParameters1BoxedMap { - @Nullable Object getData(); - } - - public record FaketestqueryparamtersPutQueryParameters1BoxedMap(QueryParametersMap data) implements FaketestqueryparamtersPutQueryParameters1Boxed { - @Override - public @Nullable Object getData() { - return data; - } - } - - - public static class FaketestqueryparamtersPutQueryParameters1 extends JsonSchema implements MapSchemaValidator { - private static @Nullable FaketestqueryparamtersPutQueryParameters1 instance = null; - - protected FaketestqueryparamtersPutQueryParameters1() { - super(new JsonSchemaInfo() - .type(Set.of(Map.class)) - .properties(Map.ofEntries( - new PropertyEntry("refParam", StringWithValidation.StringWithValidation1.class), - new PropertyEntry("ioutil", Schema1.Schema11.class), - new PropertyEntry("context", Schema4.Schema41.class), - new PropertyEntry("http", Schema2.Schema21.class), - new PropertyEntry("pipe", Schema0.Schema01.class), - new PropertyEntry("url", Schema3.Schema31.class) - )) - .required(Set.of( - "context", - "http", - "ioutil", - "pipe", - "refParam", - "url" - )) - .additionalProperties(AdditionalProperties.class) - ); - } - - public static FaketestqueryparamtersPutQueryParameters1 getInstance() { - if (instance == null) { - instance = new FaketestqueryparamtersPutQueryParameters1(); - } - return instance; - } - - 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 RuntimeException("Invalid non-string key value"); - } - String propertyName = (String) entryKey; - List propertyPathToItem = new ArrayList<>(pathToItem); - propertyPathToItem.add(propertyName); - Object value = entry.getValue(); - LinkedHashMap, Nothing?> schemas = pathToSchemas.get(propertyPathToItem); - if (schemas == null) { - throw new RuntimeException("Validation result is invalid, schemas must exist for a pathToItem"); - } - JsonSchema propertySchema = schemas.entrySet().iterator().next().getKey(); - @Nullable Object propertyInstance = propertySchema.getNewInstance(value, propertyPathToItem, pathToSchemas); - properties.put(propertyName, propertyInstance); - } - FrozenMap<@Nullable Object> castProperties = new FrozenMap<>(properties); - return new QueryParametersMap(castProperties); - } - - 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); - SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().build())); - ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, new PathToSchemasMap(), new LinkedHashSet<>()); - PathToSchemasMap pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet); - return getNewInstance(castArg, validationMetadata.pathToItem(), pathToSchemasMap); - } - - - @Override - public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws 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"); - } - @Override - public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { - if (arg instanceof Map) { - return getNewInstance((Map) arg, pathToItem, pathToSchemas); - } - throw new RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); - } - @Override - public FaketestqueryparamtersPutQueryParameters1BoxedMap validateAndBox(Map arg, SchemaConfiguration configuration) throws ValidationException { - return new FaketestqueryparamtersPutQueryParameters1BoxedMap(validate(arg, configuration)); - } - @Override - public FaketestqueryparamtersPutQueryParameters1Boxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { - 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"); - } - } - -} diff --git a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/faketestqueryparamters/put/FaketestqueryparamtersPutResponses.kt b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/faketestqueryparamters/put/FaketestqueryparamtersPutResponses.kt deleted file mode 100644 index 9dcc42af24b..00000000000 --- a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/faketestqueryparamters/put/FaketestqueryparamtersPutResponses.kt +++ /dev/null @@ -1,53 +0,0 @@ -package org.openapijsonschematools.client.paths.faketestqueryparamters.put; - -import org.openapijsonschematools.client.paths.faketestqueryparamters.put.responses.FaketestqueryparamtersPutCode200Response; -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; -import org.checkerframework.checker.nullness.qual.Nullable; - -import java.net.http.HttpResponse; -import java.util.Map; -import java.util.AbstractMap; - -public class FaketestqueryparamtersPutResponses { - public sealed interface EndpointResponse permits EndpointFaketestqueryparamtersPutCode200Response {} - - public record EndpointFaketestqueryparamtersPutCode200Response( - HttpResponse response, - Nothing? body, - Nothing? headers - ) implements EndpointResponse, ApiResponse{ - } - - public sealed interface StatusCodeResponseDeserializer permits StatusFaketestqueryparamtersPutCode200ResponseDeserializer {} - - public static final class StatusFaketestqueryparamtersPutCode200ResponseDeserializer extends FaketestqueryparamtersPutCode200Response.FaketestqueryparamtersPutCode200Response1 implements StatusCodeResponseDeserializer { - } - - public static final class FaketestqueryparamtersPutResponses1 implements ResponsesDeserializer { - private final Map statusCodeToResponseDeserializer; - public FaketestqueryparamtersPutResponses1() { - this.statusCodeToResponseDeserializer = Map.ofEntries( - new AbstractMap.SimpleEntry<>("200", new StatusFaketestqueryparamtersPutCode200ResponseDeserializer()) - ); - } - - 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) { - throw new ApiException( - "Invalid response statusCode="+statusCode+" has no response defined in the openapi document", - response - ); - } - StatusFaketestqueryparamtersPutCode200ResponseDeserializer castDeserializer = (StatusFaketestqueryparamtersPutCode200ResponseDeserializer) statusCodeDeserializer; - var deserializedResponse = castDeserializer.deserialize(response, configuration); - return new EndpointFaketestqueryparamtersPutCode200Response(response, deserializedResponse.body(), deserializedResponse.headers()); - } - } -} diff --git a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/faketestqueryparamters/put/Parameters.kt b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/faketestqueryparamters/put/Parameters.kt deleted file mode 100644 index 447f578a330..00000000000 --- a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/faketestqueryparamters/put/Parameters.kt +++ /dev/null @@ -1,30 +0,0 @@ -package org.openapijsonschematools.client.paths.faketestqueryparamters.put; - -import org.openapijsonschematools.client.paths.faketestqueryparamters.put.parameters.Parameter0; -import org.openapijsonschematools.client.paths.faketestqueryparamters.put.parameters.Parameter1; -import org.openapijsonschematools.client.paths.faketestqueryparamters.put.parameters.Parameter2; -import org.openapijsonschematools.client.paths.faketestqueryparamters.put.parameters.Parameter3; -import org.openapijsonschematools.client.paths.faketestqueryparamters.put.parameters.Parameter4; -import org.openapijsonschematools.client.paths.faketestqueryparamters.put.parameters.Parameter5; -import org.openapijsonschematools.client.parameter.QuerySerializer; - -import java.util.Map; -import java.util.AbstractMap; - -public class Parameters { - - public static class QueryParametersSerializer extends QuerySerializer { - public QueryParametersSerializer() { - super( - Map.ofEntries( - new AbstractMap.SimpleEntry<>("pipe", new Parameter0.Parameter01()), - new AbstractMap.SimpleEntry<>("ioutil", new Parameter1.Parameter11()), - new AbstractMap.SimpleEntry<>("http", new Parameter2.Parameter21()), - new AbstractMap.SimpleEntry<>("url", new Parameter3.Parameter31()), - new AbstractMap.SimpleEntry<>("context", new Parameter4.Parameter41()), - new AbstractMap.SimpleEntry<>("refParam", new Parameter5.Parameter51()) - ) - ); - } - } -} diff --git a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/faketestqueryparamters/put/parameters/Parameter0.kt b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/faketestqueryparamters/put/parameters/Parameter0.kt deleted file mode 100644 index fb818182444..00000000000 --- a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/faketestqueryparamters/put/parameters/Parameter0.kt +++ /dev/null @@ -1,23 +0,0 @@ -package org.openapijsonschematools.client.paths.faketestqueryparamters.put.parameters; - -import org.openapijsonschematools.client.parameter.ParameterStyle; -import org.openapijsonschematools.client.parameter.ParameterInType; -import org.openapijsonschematools.client.parameter.SchemaParameter; -import org.openapijsonschematools.client.paths.faketestqueryparamters.put.parameters.parameter0.Schema0; - -public class Parameter0 { - - public static class Parameter01 extends SchemaParameter { - public Parameter01() { - super( - "pipe", - ParameterInType.QUERY, - true, - ParameterStyle.FORM, - true, - false, - Schema0.Schema01.getInstance() - ); - } - } -} diff --git a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/faketestqueryparamters/put/parameters/Parameter1.kt b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/faketestqueryparamters/put/parameters/Parameter1.kt deleted file mode 100644 index c835f8982f0..00000000000 --- a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/faketestqueryparamters/put/parameters/Parameter1.kt +++ /dev/null @@ -1,23 +0,0 @@ -package org.openapijsonschematools.client.paths.faketestqueryparamters.put.parameters; - -import org.openapijsonschematools.client.parameter.ParameterStyle; -import org.openapijsonschematools.client.parameter.ParameterInType; -import org.openapijsonschematools.client.parameter.SchemaParameter; -import org.openapijsonschematools.client.paths.faketestqueryparamters.put.parameters.parameter1.Schema1; - -public class Parameter1 { - - public static class Parameter11 extends SchemaParameter { - public Parameter11() { - super( - "ioutil", - ParameterInType.QUERY, - true, - ParameterStyle.FORM, - false, - false, - Schema1.Schema11.getInstance() - ); - } - } -} diff --git a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/faketestqueryparamters/put/parameters/Parameter2.kt b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/faketestqueryparamters/put/parameters/Parameter2.kt deleted file mode 100644 index a4718b73134..00000000000 --- a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/faketestqueryparamters/put/parameters/Parameter2.kt +++ /dev/null @@ -1,23 +0,0 @@ -package org.openapijsonschematools.client.paths.faketestqueryparamters.put.parameters; - -import org.openapijsonschematools.client.parameter.ParameterStyle; -import org.openapijsonschematools.client.parameter.ParameterInType; -import org.openapijsonschematools.client.parameter.SchemaParameter; -import org.openapijsonschematools.client.paths.faketestqueryparamters.put.parameters.parameter2.Schema2; - -public class Parameter2 { - - public static class Parameter21 extends SchemaParameter { - public Parameter21() { - super( - "http", - ParameterInType.QUERY, - true, - ParameterStyle.SPACE_DELIMITED, - false, - false, - Schema2.Schema21.getInstance() - ); - } - } -} diff --git a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/faketestqueryparamters/put/parameters/Parameter3.kt b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/faketestqueryparamters/put/parameters/Parameter3.kt deleted file mode 100644 index 243be0b3e0f..00000000000 --- a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/faketestqueryparamters/put/parameters/Parameter3.kt +++ /dev/null @@ -1,23 +0,0 @@ -package org.openapijsonschematools.client.paths.faketestqueryparamters.put.parameters; - -import org.openapijsonschematools.client.parameter.ParameterStyle; -import org.openapijsonschematools.client.parameter.ParameterInType; -import org.openapijsonschematools.client.parameter.SchemaParameter; -import org.openapijsonschematools.client.paths.faketestqueryparamters.put.parameters.parameter3.Schema3; - -public class Parameter3 { - - public static class Parameter31 extends SchemaParameter { - public Parameter31() { - super( - "url", - ParameterInType.QUERY, - true, - ParameterStyle.FORM, - false, - false, - Schema3.Schema31.getInstance() - ); - } - } -} diff --git a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/faketestqueryparamters/put/parameters/Parameter4.kt b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/faketestqueryparamters/put/parameters/Parameter4.kt deleted file mode 100644 index 449ae175083..00000000000 --- a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/faketestqueryparamters/put/parameters/Parameter4.kt +++ /dev/null @@ -1,23 +0,0 @@ -package org.openapijsonschematools.client.paths.faketestqueryparamters.put.parameters; - -import org.openapijsonschematools.client.parameter.ParameterStyle; -import org.openapijsonschematools.client.parameter.ParameterInType; -import org.openapijsonschematools.client.parameter.SchemaParameter; -import org.openapijsonschematools.client.paths.faketestqueryparamters.put.parameters.parameter4.Schema4; - -public class Parameter4 { - - public static class Parameter41 extends SchemaParameter { - public Parameter41() { - super( - "context", - ParameterInType.QUERY, - true, - ParameterStyle.FORM, - true, - false, - Schema4.Schema41.getInstance() - ); - } - } -} diff --git a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/faketestqueryparamters/put/parameters/Parameter5.kt b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/faketestqueryparamters/put/parameters/Parameter5.kt deleted file mode 100644 index 1575ac4c084..00000000000 --- a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/faketestqueryparamters/put/parameters/Parameter5.kt +++ /dev/null @@ -1,23 +0,0 @@ -package org.openapijsonschematools.client.paths.faketestqueryparamters.put.parameters; - -import org.openapijsonschematools.client.parameter.ParameterStyle; -import org.openapijsonschematools.client.parameter.ParameterInType; -import org.openapijsonschematools.client.parameter.SchemaParameter; -import org.openapijsonschematools.client.paths.faketestqueryparamters.put.parameters.parameter5.Schema5; - -public class Parameter5 { - - public static class Parameter51 extends SchemaParameter { - public Parameter51() { - super( - "refParam", - ParameterInType.QUERY, - true, - ParameterStyle.FORM, - true, - false, - Schema5.Schema51.getInstance() - ); - } - } -} diff --git a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/faketestqueryparamters/put/parameters/parameter0/Schema0.kt b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/faketestqueryparamters/put/parameters/parameter0/Schema0.kt deleted file mode 100644 index 035a7ed35a6..00000000000 --- a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/faketestqueryparamters/put/parameters/parameter0/Schema0.kt +++ /dev/null @@ -1,157 +0,0 @@ -package org.openapijsonschematools.client.paths.faketestqueryparamters.put.parameters.parameter0; -import java.util.ArrayList; -import java.util.HashSet; -import java.util.LinkedHashMap; -import java.util.LinkedHashSet; -import java.util.List; -import java.util.Objects; -import java.util.Set; -import org.checkerframework.checker.nullness.qual.Nullable; -import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags; -import org.openapijsonschematools.client.configurations.SchemaConfiguration; -import org.openapijsonschematools.client.exceptions.ValidationException; -import org.openapijsonschematools.client.schemas.StringJsonSchema; -import org.openapijsonschematools.client.schemas.validation.FrozenList; -import org.openapijsonschematools.client.schemas.validation.JsonSchema; -import org.openapijsonschematools.client.schemas.validation.JsonSchemaInfo; -import org.openapijsonschematools.client.schemas.validation.ListSchemaValidator; -import org.openapijsonschematools.client.schemas.validation.PathToSchemasMap; -import org.openapijsonschematools.client.schemas.validation.ValidationMetadata; - -public class Schema0 { - // nest classes so all schemas and input/output classes can be public - - - public static class Items0 extends StringJsonSchema.StringJsonSchema1 { - private static @Nullable Items0 instance = null; - public static Items0 getInstance() { - if (instance == null) { - instance = new Items0(); - } - return instance; - } - } - - - public static class SchemaList0 extends FrozenList { - protected SchemaList0(FrozenList m) { - super(m); - } - public static SchemaList0 of(List arg, SchemaConfiguration configuration) throws ValidationException { - return Schema01.getInstance().validate(arg, configuration); - } - } - - public static class SchemaListBuilder0 { - // class to build List - private final List list; - - public SchemaListBuilder0() { - list = new ArrayList<>(); - } - - public SchemaListBuilder0(List list) { - this.list = list; - } - - public SchemaListBuilder0 add(String item) { - list.add(item); - return this; - } - - public List build() { - return list; - } - } - - - public sealed interface Schema01Boxed permits Schema01BoxedList { - @Nullable Object getData(); - } - - public record Schema01BoxedList(SchemaList0 data) implements Schema01Boxed { - @Override - public @Nullable Object getData() { - return data; - } - } - - - - public static class Schema01 extends JsonSchema implements ListSchemaValidator { - private static @Nullable Schema01 instance = null; - - protected Schema01() { - super(new JsonSchemaInfo() - .type(Set.of(List.class)) - .items(Items0.class) - ); - } - - public static Schema01 getInstance() { - if (instance == null) { - instance = new Schema01(); - } - return instance; - } - - @Override - public SchemaList0 getNewInstance(List arg, List pathToItem, PathToSchemasMap pathToSchemas) { - List items = new ArrayList<>(); - int i = 0; - for (Object item: arg) { - List itemPathToItem = new ArrayList<>(pathToItem); - itemPathToItem.add(i); - LinkedHashMap, Nothing?> schemas = pathToSchemas.get(itemPathToItem); - if (schemas == null) { - throw new RuntimeException("Validation 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"); - } - items.add((String) itemInstance); - i += 1; - } - FrozenList newInstanceItems = new FrozenList<>(items); - return new SchemaList0(newInstanceItems); - } - - 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); - SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().build())); - ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, new PathToSchemasMap(), new LinkedHashSet<>()); - PathToSchemasMap pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet); - return getNewInstance(castArg, validationMetadata.pathToItem(), pathToSchemasMap); - } - - @Override - public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws 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"); - } - @Override - public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { - 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"); - } - @Override - 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 { - 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"); - } - } -} diff --git a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/faketestqueryparamters/put/parameters/parameter1/Schema1.kt b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/faketestqueryparamters/put/parameters/parameter1/Schema1.kt deleted file mode 100644 index 0855dc90fb5..00000000000 --- a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/faketestqueryparamters/put/parameters/parameter1/Schema1.kt +++ /dev/null @@ -1,157 +0,0 @@ -package org.openapijsonschematools.client.paths.faketestqueryparamters.put.parameters.parameter1; -import java.util.ArrayList; -import java.util.HashSet; -import java.util.LinkedHashMap; -import java.util.LinkedHashSet; -import java.util.List; -import java.util.Objects; -import java.util.Set; -import org.checkerframework.checker.nullness.qual.Nullable; -import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags; -import org.openapijsonschematools.client.configurations.SchemaConfiguration; -import org.openapijsonschematools.client.exceptions.ValidationException; -import org.openapijsonschematools.client.schemas.StringJsonSchema; -import org.openapijsonschematools.client.schemas.validation.FrozenList; -import org.openapijsonschematools.client.schemas.validation.JsonSchema; -import org.openapijsonschematools.client.schemas.validation.JsonSchemaInfo; -import org.openapijsonschematools.client.schemas.validation.ListSchemaValidator; -import org.openapijsonschematools.client.schemas.validation.PathToSchemasMap; -import org.openapijsonschematools.client.schemas.validation.ValidationMetadata; - -public class Schema1 { - // nest classes so all schemas and input/output classes can be public - - - public static class Items1 extends StringJsonSchema.StringJsonSchema1 { - private static @Nullable Items1 instance = null; - public static Items1 getInstance() { - if (instance == null) { - instance = new Items1(); - } - return instance; - } - } - - - public static class SchemaList1 extends FrozenList { - protected SchemaList1(FrozenList m) { - super(m); - } - public static SchemaList1 of(List arg, SchemaConfiguration configuration) throws ValidationException { - return Schema11.getInstance().validate(arg, configuration); - } - } - - public static class SchemaListBuilder1 { - // class to build List - private final List list; - - public SchemaListBuilder1() { - list = new ArrayList<>(); - } - - public SchemaListBuilder1(List list) { - this.list = list; - } - - public SchemaListBuilder1 add(String item) { - list.add(item); - return this; - } - - public List build() { - return list; - } - } - - - public sealed interface Schema11Boxed permits Schema11BoxedList { - @Nullable Object getData(); - } - - public record Schema11BoxedList(SchemaList1 data) implements Schema11Boxed { - @Override - public @Nullable Object getData() { - return data; - } - } - - - - public static class Schema11 extends JsonSchema implements ListSchemaValidator { - private static @Nullable Schema11 instance = null; - - protected Schema11() { - super(new JsonSchemaInfo() - .type(Set.of(List.class)) - .items(Items1.class) - ); - } - - public static Schema11 getInstance() { - if (instance == null) { - instance = new Schema11(); - } - return instance; - } - - @Override - public SchemaList1 getNewInstance(List arg, List pathToItem, PathToSchemasMap pathToSchemas) { - List items = new ArrayList<>(); - int i = 0; - for (Object item: arg) { - List itemPathToItem = new ArrayList<>(pathToItem); - itemPathToItem.add(i); - LinkedHashMap, Nothing?> schemas = pathToSchemas.get(itemPathToItem); - if (schemas == null) { - throw new RuntimeException("Validation 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"); - } - items.add((String) itemInstance); - i += 1; - } - FrozenList newInstanceItems = new FrozenList<>(items); - return new SchemaList1(newInstanceItems); - } - - 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); - SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().build())); - ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, new PathToSchemasMap(), new LinkedHashSet<>()); - PathToSchemasMap pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet); - return getNewInstance(castArg, validationMetadata.pathToItem(), pathToSchemasMap); - } - - @Override - public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws 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"); - } - @Override - public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { - 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"); - } - @Override - 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 { - 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"); - } - } -} diff --git a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/faketestqueryparamters/put/parameters/parameter2/Schema2.kt b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/faketestqueryparamters/put/parameters/parameter2/Schema2.kt deleted file mode 100644 index 8eb3b72309e..00000000000 --- a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/faketestqueryparamters/put/parameters/parameter2/Schema2.kt +++ /dev/null @@ -1,157 +0,0 @@ -package org.openapijsonschematools.client.paths.faketestqueryparamters.put.parameters.parameter2; -import java.util.ArrayList; -import java.util.HashSet; -import java.util.LinkedHashMap; -import java.util.LinkedHashSet; -import java.util.List; -import java.util.Objects; -import java.util.Set; -import org.checkerframework.checker.nullness.qual.Nullable; -import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags; -import org.openapijsonschematools.client.configurations.SchemaConfiguration; -import org.openapijsonschematools.client.exceptions.ValidationException; -import org.openapijsonschematools.client.schemas.StringJsonSchema; -import org.openapijsonschematools.client.schemas.validation.FrozenList; -import org.openapijsonschematools.client.schemas.validation.JsonSchema; -import org.openapijsonschematools.client.schemas.validation.JsonSchemaInfo; -import org.openapijsonschematools.client.schemas.validation.ListSchemaValidator; -import org.openapijsonschematools.client.schemas.validation.PathToSchemasMap; -import org.openapijsonschematools.client.schemas.validation.ValidationMetadata; - -public class Schema2 { - // nest classes so all schemas and input/output classes can be public - - - public static class Items2 extends StringJsonSchema.StringJsonSchema1 { - private static @Nullable Items2 instance = null; - public static Items2 getInstance() { - if (instance == null) { - instance = new Items2(); - } - return instance; - } - } - - - public static class SchemaList2 extends FrozenList { - protected SchemaList2(FrozenList m) { - super(m); - } - public static SchemaList2 of(List arg, SchemaConfiguration configuration) throws ValidationException { - return Schema21.getInstance().validate(arg, configuration); - } - } - - public static class SchemaListBuilder2 { - // class to build List - private final List list; - - public SchemaListBuilder2() { - list = new ArrayList<>(); - } - - public SchemaListBuilder2(List list) { - this.list = list; - } - - public SchemaListBuilder2 add(String item) { - list.add(item); - return this; - } - - public List build() { - return list; - } - } - - - public sealed interface Schema21Boxed permits Schema21BoxedList { - @Nullable Object getData(); - } - - public record Schema21BoxedList(SchemaList2 data) implements Schema21Boxed { - @Override - public @Nullable Object getData() { - return data; - } - } - - - - public static class Schema21 extends JsonSchema implements ListSchemaValidator { - private static @Nullable Schema21 instance = null; - - protected Schema21() { - super(new JsonSchemaInfo() - .type(Set.of(List.class)) - .items(Items2.class) - ); - } - - public static Schema21 getInstance() { - if (instance == null) { - instance = new Schema21(); - } - return instance; - } - - @Override - public SchemaList2 getNewInstance(List arg, List pathToItem, PathToSchemasMap pathToSchemas) { - List items = new ArrayList<>(); - int i = 0; - for (Object item: arg) { - List itemPathToItem = new ArrayList<>(pathToItem); - itemPathToItem.add(i); - LinkedHashMap, Nothing?> schemas = pathToSchemas.get(itemPathToItem); - if (schemas == null) { - throw new RuntimeException("Validation 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"); - } - items.add((String) itemInstance); - i += 1; - } - FrozenList newInstanceItems = new FrozenList<>(items); - return new SchemaList2(newInstanceItems); - } - - 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); - SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().build())); - ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, new PathToSchemasMap(), new LinkedHashSet<>()); - PathToSchemasMap pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet); - return getNewInstance(castArg, validationMetadata.pathToItem(), pathToSchemasMap); - } - - @Override - public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws 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"); - } - @Override - public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { - 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"); - } - @Override - 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 { - 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"); - } - } -} diff --git a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/faketestqueryparamters/put/parameters/parameter3/Schema3.kt b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/faketestqueryparamters/put/parameters/parameter3/Schema3.kt deleted file mode 100644 index 83206f47e29..00000000000 --- a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/faketestqueryparamters/put/parameters/parameter3/Schema3.kt +++ /dev/null @@ -1,157 +0,0 @@ -package org.openapijsonschematools.client.paths.faketestqueryparamters.put.parameters.parameter3; -import java.util.ArrayList; -import java.util.HashSet; -import java.util.LinkedHashMap; -import java.util.LinkedHashSet; -import java.util.List; -import java.util.Objects; -import java.util.Set; -import org.checkerframework.checker.nullness.qual.Nullable; -import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags; -import org.openapijsonschematools.client.configurations.SchemaConfiguration; -import org.openapijsonschematools.client.exceptions.ValidationException; -import org.openapijsonschematools.client.schemas.StringJsonSchema; -import org.openapijsonschematools.client.schemas.validation.FrozenList; -import org.openapijsonschematools.client.schemas.validation.JsonSchema; -import org.openapijsonschematools.client.schemas.validation.JsonSchemaInfo; -import org.openapijsonschematools.client.schemas.validation.ListSchemaValidator; -import org.openapijsonschematools.client.schemas.validation.PathToSchemasMap; -import org.openapijsonschematools.client.schemas.validation.ValidationMetadata; - -public class Schema3 { - // nest classes so all schemas and input/output classes can be public - - - public static class Items3 extends StringJsonSchema.StringJsonSchema1 { - private static @Nullable Items3 instance = null; - public static Items3 getInstance() { - if (instance == null) { - instance = new Items3(); - } - return instance; - } - } - - - public static class SchemaList3 extends FrozenList { - protected SchemaList3(FrozenList m) { - super(m); - } - public static SchemaList3 of(List arg, SchemaConfiguration configuration) throws ValidationException { - return Schema31.getInstance().validate(arg, configuration); - } - } - - public static class SchemaListBuilder3 { - // class to build List - private final List list; - - public SchemaListBuilder3() { - list = new ArrayList<>(); - } - - public SchemaListBuilder3(List list) { - this.list = list; - } - - public SchemaListBuilder3 add(String item) { - list.add(item); - return this; - } - - public List build() { - return list; - } - } - - - public sealed interface Schema31Boxed permits Schema31BoxedList { - @Nullable Object getData(); - } - - public record Schema31BoxedList(SchemaList3 data) implements Schema31Boxed { - @Override - public @Nullable Object getData() { - return data; - } - } - - - - public static class Schema31 extends JsonSchema implements ListSchemaValidator { - private static @Nullable Schema31 instance = null; - - protected Schema31() { - super(new JsonSchemaInfo() - .type(Set.of(List.class)) - .items(Items3.class) - ); - } - - public static Schema31 getInstance() { - if (instance == null) { - instance = new Schema31(); - } - return instance; - } - - @Override - public SchemaList3 getNewInstance(List arg, List pathToItem, PathToSchemasMap pathToSchemas) { - List items = new ArrayList<>(); - int i = 0; - for (Object item: arg) { - List itemPathToItem = new ArrayList<>(pathToItem); - itemPathToItem.add(i); - LinkedHashMap, Nothing?> schemas = pathToSchemas.get(itemPathToItem); - if (schemas == null) { - throw new RuntimeException("Validation 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"); - } - items.add((String) itemInstance); - i += 1; - } - FrozenList newInstanceItems = new FrozenList<>(items); - return new SchemaList3(newInstanceItems); - } - - 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); - SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().build())); - ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, new PathToSchemasMap(), new LinkedHashSet<>()); - PathToSchemasMap pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet); - return getNewInstance(castArg, validationMetadata.pathToItem(), pathToSchemasMap); - } - - @Override - public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws 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"); - } - @Override - public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { - 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"); - } - @Override - 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 { - 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"); - } - } -} diff --git a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/faketestqueryparamters/put/parameters/parameter4/Schema4.kt b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/faketestqueryparamters/put/parameters/parameter4/Schema4.kt deleted file mode 100644 index 24ccc3af5ab..00000000000 --- a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/faketestqueryparamters/put/parameters/parameter4/Schema4.kt +++ /dev/null @@ -1,157 +0,0 @@ -package org.openapijsonschematools.client.paths.faketestqueryparamters.put.parameters.parameter4; -import java.util.ArrayList; -import java.util.HashSet; -import java.util.LinkedHashMap; -import java.util.LinkedHashSet; -import java.util.List; -import java.util.Objects; -import java.util.Set; -import org.checkerframework.checker.nullness.qual.Nullable; -import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags; -import org.openapijsonschematools.client.configurations.SchemaConfiguration; -import org.openapijsonschematools.client.exceptions.ValidationException; -import org.openapijsonschematools.client.schemas.StringJsonSchema; -import org.openapijsonschematools.client.schemas.validation.FrozenList; -import org.openapijsonschematools.client.schemas.validation.JsonSchema; -import org.openapijsonschematools.client.schemas.validation.JsonSchemaInfo; -import org.openapijsonschematools.client.schemas.validation.ListSchemaValidator; -import org.openapijsonschematools.client.schemas.validation.PathToSchemasMap; -import org.openapijsonschematools.client.schemas.validation.ValidationMetadata; - -public class Schema4 { - // nest classes so all schemas and input/output classes can be public - - - public static class Items4 extends StringJsonSchema.StringJsonSchema1 { - private static @Nullable Items4 instance = null; - public static Items4 getInstance() { - if (instance == null) { - instance = new Items4(); - } - return instance; - } - } - - - public static class SchemaList4 extends FrozenList { - protected SchemaList4(FrozenList m) { - super(m); - } - public static SchemaList4 of(List arg, SchemaConfiguration configuration) throws ValidationException { - return Schema41.getInstance().validate(arg, configuration); - } - } - - public static class SchemaListBuilder4 { - // class to build List - private final List list; - - public SchemaListBuilder4() { - list = new ArrayList<>(); - } - - public SchemaListBuilder4(List list) { - this.list = list; - } - - public SchemaListBuilder4 add(String item) { - list.add(item); - return this; - } - - public List build() { - return list; - } - } - - - public sealed interface Schema41Boxed permits Schema41BoxedList { - @Nullable Object getData(); - } - - public record Schema41BoxedList(SchemaList4 data) implements Schema41Boxed { - @Override - public @Nullable Object getData() { - return data; - } - } - - - - public static class Schema41 extends JsonSchema implements ListSchemaValidator { - private static @Nullable Schema41 instance = null; - - protected Schema41() { - super(new JsonSchemaInfo() - .type(Set.of(List.class)) - .items(Items4.class) - ); - } - - public static Schema41 getInstance() { - if (instance == null) { - instance = new Schema41(); - } - return instance; - } - - @Override - public SchemaList4 getNewInstance(List arg, List pathToItem, PathToSchemasMap pathToSchemas) { - List items = new ArrayList<>(); - int i = 0; - for (Object item: arg) { - List itemPathToItem = new ArrayList<>(pathToItem); - itemPathToItem.add(i); - LinkedHashMap, Nothing?> schemas = pathToSchemas.get(itemPathToItem); - if (schemas == null) { - throw new RuntimeException("Validation 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"); - } - items.add((String) itemInstance); - i += 1; - } - FrozenList newInstanceItems = new FrozenList<>(items); - return new SchemaList4(newInstanceItems); - } - - 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); - SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().build())); - ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, new PathToSchemasMap(), new LinkedHashSet<>()); - PathToSchemasMap pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet); - return getNewInstance(castArg, validationMetadata.pathToItem(), pathToSchemasMap); - } - - @Override - public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws 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"); - } - @Override - public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { - 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"); - } - @Override - 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 { - 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"); - } - } -} diff --git a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/faketestqueryparamters/put/parameters/parameter5/Schema5.kt b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/faketestqueryparamters/put/parameters/parameter5/Schema5.kt deleted file mode 100644 index a2af162b5a6..00000000000 --- a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/faketestqueryparamters/put/parameters/parameter5/Schema5.kt +++ /dev/null @@ -1,19 +0,0 @@ -package org.openapijsonschematools.client.paths.faketestqueryparamters.put.parameters.parameter5; - -import org.checkerframework.checker.nullness.qual.Nullable; -import org.openapijsonschematools.client.components.schemas.StringWithValidation; - -public class Schema5 extends StringWithValidation { - // $refed class - - - public static class Schema51 extends StringWithValidation1 { - private static @Nullable Schema51 instance = null; - public static Schema51 getInstance() { - if (instance == null) { - instance = new Schema51(); - } - return instance; - } - } -} diff --git a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/faketestqueryparamters/put/responses/FaketestqueryparamtersPutCode200Response.kt b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/faketestqueryparamters/put/responses/FaketestqueryparamtersPutCode200Response.kt deleted file mode 100644 index 180a1f4d934..00000000000 --- a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/faketestqueryparamters/put/responses/FaketestqueryparamtersPutCode200Response.kt +++ /dev/null @@ -1,7 +0,0 @@ -package org.openapijsonschematools.client.paths.faketestqueryparamters.put.responses; - -import org.openapijsonschematools.client.components.responses.SuccessDescriptionOnly; - -public class FaketestqueryparamtersPutCode200Response extends SuccessDescriptionOnly { - public static class FaketestqueryparamtersPutCode200Response1 extends SuccessDescriptionOnly1 {} -} diff --git a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/fakeuploaddownloadfile/FakeuploaddownloadfilePost.kt b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/fakeuploaddownloadfile/FakeuploaddownloadfilePost.kt deleted file mode 100644 index 40b05b37b3a..00000000000 --- a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/fakeuploaddownloadfile/FakeuploaddownloadfilePost.kt +++ /dev/null @@ -1,183 +0,0 @@ -package org.openapijsonschematools.client.paths.fakeuploaddownloadfile; - -import org.checkerframework.checker.nullness.qual.Nullable; -import org.openapijsonschematools.client.RootServerInfo; -import org.openapijsonschematools.client.paths.fakeuploaddownloadfile.post.FakeuploaddownloadfilePostRequestBody; -import org.openapijsonschematools.client.paths.fakeuploaddownloadfile.post.FakeuploaddownloadfilePostResponses; -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.requestbody.SerializedRequestBody; -import org.openapijsonschematools.client.paths.Fakeuploaddownloadfile; - -import java.io.IOException; -import java.util.ArrayList; -import java.net.http.HttpClient; -import java.net.http.HttpRequest; -import java.time.Duration; -import java.util.List; -import java.util.Map; - -public class FakeuploaddownloadfilePost { - private static class PostProvider { - private static final String method = "post"; - - public static FakeuploaddownloadfilePostResponses.EndpointResponse post( - PostRequest request, - ApiConfiguration apiConfiguration, - SchemaConfiguration schemaConfiguration, - HttpClient client - ) throws IOException, InterruptedException, ValidationException, NotImplementedException, ApiException { - Map> headers = apiConfiguration.getDefaultHeaders(); - - SerializedRequestBody serializedRequestBody = new FakeuploaddownloadfilePostRequestBody.FakeuploaddownloadfilePostRequestBody1().serialize( - request.requestBody - ); - var contentTypeHeaderValues = headers.getOrDefault("Content-Type", new ArrayList<>()); - contentTypeHeaderValues.add(serializedRequestBody.contentType); - HttpRequest.BodyPublisher bodyPublisher = serializedRequestBody.bodyPublisher; - // TODO set this to a map if there is a query security scheme - @Nullable Map queryMap = null; - String host = apiConfiguration.getServer(request.serverIndex).url(); - - String url = host + Fakeuploaddownloadfile.path; - var httpRequest = RestClient.getRequest( - url, - method, - bodyPublisher, - headers, - request.timeout - ); - var response = RestClient.getResponse(httpRequest, client); - var responsesDeserializer = new FakeuploaddownloadfilePostResponses.FakeuploaddownloadfilePostResponses1(); - return responsesDeserializer.deserialize(response, schemaConfiguration); - } - } - - public interface PostOperation { - ApiConfiguration getApiConfiguration(); - SchemaConfiguration getSchemaConfiguration(); - HttpClient getClient(); - default FakeuploaddownloadfilePostResponses.EndpointResponse post(PostRequest request) throws IOException, InterruptedException, ValidationException, NotImplementedException, ApiException { - return PostProvider.post(request, getApiConfiguration(), getSchemaConfiguration(), getClient()); - } - } - - public interface UploadDownloadFileOperation { - ApiConfiguration getApiConfiguration(); - SchemaConfiguration getSchemaConfiguration(); - HttpClient getClient(); - default FakeuploaddownloadfilePostResponses.EndpointResponse uploadDownloadFile(PostRequest request) throws IOException, InterruptedException, ValidationException, NotImplementedException, ApiException { - return PostProvider.post(request, getApiConfiguration(), getSchemaConfiguration(), getClient()); - } - } - - public static class Post extends ApiClient implements PostOperation { - public Post(ApiConfiguration apiConfiguration, SchemaConfiguration schemaConfiguration) { - super(apiConfiguration, schemaConfiguration); - } - } - - public static class PostRequest { - public FakeuploaddownloadfilePostRequestBody.SealedRequestBody requestBody; - public RootServerInfo.@Nullable ServerIndex serverIndex; - public @Nullable Duration timeout; - - public PostRequest( - FakeuploaddownloadfilePostRequestBody.SealedRequestBody requestBody, - RootServerInfo.@Nullable ServerIndex serverIndex, - @Nullable Duration timeout - ) { - this.requestBody = requestBody; - this.serverIndex = serverIndex; - this.timeout = timeout; - } - } - - public static class PostNullableRequest { - public FakeuploaddownloadfilePostRequestBody.@Nullable SealedRequestBody requestBody; - public RootServerInfo.@Nullable ServerIndex serverIndex; - public @Nullable Duration timeout; - } - - public interface SetterForServerIndex { - PostNullableRequest getInstance(); - T getBuilderAfterServerIndex(PostNullableRequest instance); - default T serverIndex(RootServerInfo.ServerIndex serverIndex) { - var instance = getInstance(); - instance.serverIndex = serverIndex; - return getBuilderAfterServerIndex(instance); - } - } - - public interface SetterForTimeout { - PostNullableRequest getInstance(); - T getBuilderAfterTimeout(PostNullableRequest instance); - default T timeout(Duration timeout) { - var instance = getInstance(); - instance.timeout = timeout; - return getBuilderAfterTimeout(instance); - } - } - - public interface SetterForRequestBody { - PostNullableRequest getInstance(); - T getBuilderAfterRequestBody(PostNullableRequest instance); - default T requestBody(FakeuploaddownloadfilePostRequestBody.SealedRequestBody requestBody) { - var instance = getInstance(); - instance.requestBody = requestBody; - return getBuilderAfterRequestBody(instance); - } - } - - public static class Post0RequestBuilder implements SetterForServerIndex, SetterForTimeout { - private final PostNullableRequest instance; - - public Post0RequestBuilder(PostNullableRequest instance) { - this.instance = instance; - } - - public PostRequest build() { - var requestBody = instance.requestBody; - if (requestBody == null) { - throw new RuntimeException("invalid null value for required parameter"); - } - return new PostRequest( - requestBody, - instance.serverIndex, - instance.timeout - ); - } - - public PostNullableRequest getInstance() { - return instance; - } - - public Post0RequestBuilder getBuilderAfterServerIndex(PostNullableRequest instance) { - return this; - } - - public Post0RequestBuilder getBuilderAfterTimeout(PostNullableRequest instance) { - return this; - } - } - public static class PostRequestBuilder implements SetterForRequestBody { - private final PostNullableRequest instance; - - public PostRequestBuilder() { - this.instance = new PostNullableRequest(); - } - - public PostNullableRequest getInstance() { - return instance; - } - - public Post0RequestBuilder getBuilderAfterRequestBody(PostNullableRequest instance) { - return new Post0RequestBuilder(instance); - } - } -} diff --git a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/fakeuploaddownloadfile/post/FakeuploaddownloadfilePostRequestBody.kt b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/fakeuploaddownloadfile/post/FakeuploaddownloadfilePostRequestBody.kt deleted file mode 100644 index d54f6dffe6b..00000000000 --- a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/fakeuploaddownloadfile/post/FakeuploaddownloadfilePostRequestBody.kt +++ /dev/null @@ -1,49 +0,0 @@ -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; -import org.openapijsonschematools.client.mediatype.MediaType; -import org.openapijsonschematools.client.paths.fakeuploaddownloadfile.post.requestbody.content.applicationoctetstream.ApplicationoctetstreamSchema; - -import java.util.AbstractMap; -import java.util.Map; - -public class FakeuploaddownloadfilePostRequestBody { - public sealed interface SealedMediaType permits ApplicationoctetstreamMediaType {} - - public record ApplicationoctetstreamMediaType(ApplicationoctetstreamSchema.ApplicationoctetstreamSchema1 schema) implements SealedMediaType, MediaType { - public ApplicationoctetstreamMediaType() { - this(ApplicationoctetstreamSchema.ApplicationoctetstreamSchema1.getInstance()); - } - @Override - public Nothing? encoding() { - return null; - } - } - - public static class FakeuploaddownloadfilePostRequestBody1 extends RequestBodySerializer { - public FakeuploaddownloadfilePostRequestBody1() { - super( - Map.ofEntries( - new AbstractMap.SimpleEntry<>("application/octet-stream", new ApplicationoctetstreamMediaType()) - ), - true - ); - } - - public SerializedRequestBody serialize(SealedRequestBody requestBody) throws NotImplementedException { - ApplicationoctetstreamRequestBody requestBody0 = (ApplicationoctetstreamRequestBody) requestBody; - return serialize(requestBody0.contentType(), requestBody0.body().getData()); - } - } - - public sealed interface SealedRequestBody permits ApplicationoctetstreamRequestBody {} - public record ApplicationoctetstreamRequestBody(ApplicationoctetstreamSchema.StringJsonSchema1Boxed body) implements SealedRequestBody, GenericRequestBody { - @Override - public String contentType() { - return "application/octet-stream"; - } - } -} diff --git a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/fakeuploaddownloadfile/post/FakeuploaddownloadfilePostResponses.kt b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/fakeuploaddownloadfile/post/FakeuploaddownloadfilePostResponses.kt deleted file mode 100644 index 1af4ec1e048..00000000000 --- a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/fakeuploaddownloadfile/post/FakeuploaddownloadfilePostResponses.kt +++ /dev/null @@ -1,53 +0,0 @@ -package org.openapijsonschematools.client.paths.fakeuploaddownloadfile.post; - -import org.openapijsonschematools.client.paths.fakeuploaddownloadfile.post.responses.FakeuploaddownloadfilePostCode200Response; -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; -import org.checkerframework.checker.nullness.qual.Nullable; - -import java.net.http.HttpResponse; -import java.util.Map; -import java.util.AbstractMap; - -public class FakeuploaddownloadfilePostResponses { - public sealed interface EndpointResponse permits EndpointFakeuploaddownloadfilePostCode200Response {} - - public record EndpointFakeuploaddownloadfilePostCode200Response( - HttpResponse response, - FakeuploaddownloadfilePostCode200Response.SealedResponseBody body, - Nothing? headers - ) implements EndpointResponse, ApiResponse{ - } - - public sealed interface StatusCodeResponseDeserializer permits StatusFakeuploaddownloadfilePostCode200ResponseDeserializer {} - - public static final class StatusFakeuploaddownloadfilePostCode200ResponseDeserializer extends FakeuploaddownloadfilePostCode200Response.FakeuploaddownloadfilePostCode200Response1 implements StatusCodeResponseDeserializer { - } - - public static final class FakeuploaddownloadfilePostResponses1 implements ResponsesDeserializer { - private final Map statusCodeToResponseDeserializer; - public FakeuploaddownloadfilePostResponses1() { - this.statusCodeToResponseDeserializer = Map.ofEntries( - new AbstractMap.SimpleEntry<>("200", new StatusFakeuploaddownloadfilePostCode200ResponseDeserializer()) - ); - } - - 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) { - throw new ApiException( - "Invalid response statusCode="+statusCode+" has no response defined in the openapi document", - response - ); - } - StatusFakeuploaddownloadfilePostCode200ResponseDeserializer castDeserializer = (StatusFakeuploaddownloadfilePostCode200ResponseDeserializer) statusCodeDeserializer; - var deserializedResponse = castDeserializer.deserialize(response, configuration); - return new EndpointFakeuploaddownloadfilePostCode200Response(response, deserializedResponse.body(), deserializedResponse.headers()); - } - } -} diff --git a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/fakeuploaddownloadfile/post/requestbody/content/applicationoctetstream/ApplicationoctetstreamSchema.kt b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/fakeuploaddownloadfile/post/requestbody/content/applicationoctetstream/ApplicationoctetstreamSchema.kt deleted file mode 100644 index 1dded2752b5..00000000000 --- a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/fakeuploaddownloadfile/post/requestbody/content/applicationoctetstream/ApplicationoctetstreamSchema.kt +++ /dev/null @@ -1,20 +0,0 @@ -package org.openapijsonschematools.client.paths.fakeuploaddownloadfile.post.requestbody.content.applicationoctetstream; -import org.checkerframework.checker.nullness.qual.Nullable; -import org.openapijsonschematools.client.schemas.StringJsonSchema; - -public class ApplicationoctetstreamSchema extends StringJsonSchema { - // nest classes so all schemas and input/output classes can be public - - - public static class ApplicationoctetstreamSchema1 extends StringJsonSchema.StringJsonSchema1 { - // BinarySchema - private static @Nullable ApplicationoctetstreamSchema1 instance = null; - public static ApplicationoctetstreamSchema1 getInstance() { - if (instance == null) { - instance = new ApplicationoctetstreamSchema1(); - } - return instance; - } - } - -} diff --git a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/fakeuploaddownloadfile/post/responses/FakeuploaddownloadfilePostCode200Response.kt b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/fakeuploaddownloadfile/post/responses/FakeuploaddownloadfilePostCode200Response.kt deleted file mode 100644 index 4f4f8e6947d..00000000000 --- a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/fakeuploaddownloadfile/post/responses/FakeuploaddownloadfilePostCode200Response.kt +++ /dev/null @@ -1,63 +0,0 @@ -package org.openapijsonschematools.client.paths.fakeuploaddownloadfile.post.responses; - -import org.openapijsonschematools.client.configurations.SchemaConfiguration; -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; - -import java.util.AbstractMap; -import java.util.Map; -import java.net.http.HttpResponse; -import java.net.http.HttpHeaders; - -public class FakeuploaddownloadfilePostCode200Response { - public sealed interface SealedMediaType permits ApplicationoctetstreamMediaType {} - - public record ApplicationoctetstreamMediaType(ApplicationoctetstreamSchema.ApplicationoctetstreamSchema1 schema) implements SealedMediaType, MediaType { - public ApplicationoctetstreamMediaType() { - this(ApplicationoctetstreamSchema.ApplicationoctetstreamSchema1.getInstance()); - } - @Override - public Nothing? encoding() { - return null; - } - } - public sealed interface SealedResponseBody permits ApplicationoctetstreamResponseBody {} - public record ApplicationoctetstreamResponseBody(ApplicationoctetstreamSchema.StringJsonSchema1Boxed body) implements SealedResponseBody { } - - public static class FakeuploaddownloadfilePostCode200Response1 extends ResponseDeserializer { - public FakeuploaddownloadfilePostCode200Response1() { - super( - Map.ofEntries( - new AbstractMap.SimpleEntry<>("application/octet-stream", new ApplicationoctetstreamMediaType()) - ) - ); - } - - @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); - } - - @Override - protected Nothing? getHeaders(HttpHeaders headers, SchemaConfiguration configuration) { - return null; - } - } - - @SuppressWarnings("serial") - public static class ResponseApiException extends ApiException { - public DeserializedHttpResponse deserializedResponse; - - public ResponseApiException(String s, HttpResponse response, DeserializedHttpResponse deserializedResponse) { - super(s, response); - this.deserializedResponse = deserializedResponse; - } - } -} diff --git a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/fakeuploaddownloadfile/post/responses/code200response/content/applicationoctetstream/ApplicationoctetstreamSchema.kt b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/fakeuploaddownloadfile/post/responses/code200response/content/applicationoctetstream/ApplicationoctetstreamSchema.kt deleted file mode 100644 index 4560be3af67..00000000000 --- a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/fakeuploaddownloadfile/post/responses/code200response/content/applicationoctetstream/ApplicationoctetstreamSchema.kt +++ /dev/null @@ -1,20 +0,0 @@ -package org.openapijsonschematools.client.paths.fakeuploaddownloadfile.post.responses.code200response.content.applicationoctetstream; -import org.checkerframework.checker.nullness.qual.Nullable; -import org.openapijsonschematools.client.schemas.StringJsonSchema; - -public class ApplicationoctetstreamSchema extends StringJsonSchema { - // nest classes so all schemas and input/output classes can be public - - - public static class ApplicationoctetstreamSchema1 extends StringJsonSchema.StringJsonSchema1 { - // BinarySchema - private static @Nullable ApplicationoctetstreamSchema1 instance = null; - public static ApplicationoctetstreamSchema1 getInstance() { - if (instance == null) { - instance = new ApplicationoctetstreamSchema1(); - } - return instance; - } - } - -} diff --git a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/fakeuploadfile/FakeuploadfilePost.kt b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/fakeuploadfile/FakeuploadfilePost.kt deleted file mode 100644 index 4a90826a6bd..00000000000 --- a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/fakeuploadfile/FakeuploadfilePost.kt +++ /dev/null @@ -1,152 +0,0 @@ -package org.openapijsonschematools.client.paths.fakeuploadfile; - -import org.checkerframework.checker.nullness.qual.Nullable; -import org.openapijsonschematools.client.paths.fakeuploadfile.post.FakeuploadfilePostRequestBody; -import org.openapijsonschematools.client.RootServerInfo; -import org.openapijsonschematools.client.paths.fakeuploadfile.post.FakeuploadfilePostResponses; -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.requestbody.SerializedRequestBody; -import org.openapijsonschematools.client.paths.Fakeuploadfile; - -import java.io.IOException; -import java.util.ArrayList; -import java.net.http.HttpClient; -import java.net.http.HttpRequest; -import java.time.Duration; -import java.util.List; -import java.util.Map; - -public class FakeuploadfilePost { - private static class PostProvider { - private static final String method = "post"; - - public static FakeuploadfilePostResponses.EndpointResponse post( - PostRequest request, - ApiConfiguration apiConfiguration, - SchemaConfiguration schemaConfiguration, - HttpClient client - ) throws IOException, InterruptedException, ValidationException, NotImplementedException, ApiException { - Map> headers = apiConfiguration.getDefaultHeaders(); - - @Nullable SerializedRequestBody serializedRequestBody; - HttpRequest.BodyPublisher bodyPublisher = HttpRequest.BodyPublishers.noBody(); - if (request.requestBody != null) { - serializedRequestBody = new FakeuploadfilePostRequestBody.FakeuploadfilePostRequestBody1().serialize( - request.requestBody - ); - var contentTypeHeaderValues = headers.getOrDefault("Content-Type", new ArrayList<>()); - contentTypeHeaderValues.add(serializedRequestBody.contentType); - bodyPublisher = serializedRequestBody.bodyPublisher; - } - // TODO set this to a map if there is a query security scheme - @Nullable Map queryMap = null; - String host = apiConfiguration.getServer(request.serverIndex).url(); - - String url = host + Fakeuploadfile.path; - var httpRequest = RestClient.getRequest( - url, - method, - bodyPublisher, - headers, - request.timeout - ); - var response = RestClient.getResponse(httpRequest, client); - var responsesDeserializer = new FakeuploadfilePostResponses.FakeuploadfilePostResponses1(); - return responsesDeserializer.deserialize(response, schemaConfiguration); - } - } - - public interface PostOperation { - ApiConfiguration getApiConfiguration(); - SchemaConfiguration getSchemaConfiguration(); - HttpClient getClient(); - default FakeuploadfilePostResponses.EndpointResponse post(PostRequest request) throws IOException, InterruptedException, ValidationException, NotImplementedException, ApiException { - return PostProvider.post(request, getApiConfiguration(), getSchemaConfiguration(), getClient()); - } - } - - public interface UploadFileOperation { - ApiConfiguration getApiConfiguration(); - SchemaConfiguration getSchemaConfiguration(); - HttpClient getClient(); - default FakeuploadfilePostResponses.EndpointResponse uploadFile(PostRequest request) throws IOException, InterruptedException, ValidationException, NotImplementedException, ApiException { - return PostProvider.post(request, getApiConfiguration(), getSchemaConfiguration(), getClient()); - } - } - - public static class Post extends ApiClient implements PostOperation { - public Post(ApiConfiguration apiConfiguration, SchemaConfiguration schemaConfiguration) { - super(apiConfiguration, schemaConfiguration); - } - } - - public static class PostRequest { - public FakeuploadfilePostRequestBody.@Nullable SealedRequestBody requestBody; - public RootServerInfo.@Nullable ServerIndex serverIndex; - public @Nullable Duration timeout; - } - - public interface SetterForRequestBody { - PostRequest getInstance(); - T getBuilderAfterRequestBody(PostRequest instance); - default T requestBody(FakeuploadfilePostRequestBody.SealedRequestBody requestBody) { - var instance = getInstance(); - instance.requestBody = requestBody; - return getBuilderAfterRequestBody(instance); - } - } - - public interface SetterForServerIndex { - PostRequest getInstance(); - T getBuilderAfterServerIndex(PostRequest instance); - default T serverIndex(RootServerInfo.ServerIndex serverIndex) { - var instance = getInstance(); - instance.serverIndex = serverIndex; - return getBuilderAfterServerIndex(instance); - } - } - - public interface SetterForTimeout { - PostRequest getInstance(); - T getBuilderAfterTimeout(PostRequest instance); - default T timeout(Duration timeout) { - var instance = getInstance(); - instance.timeout = timeout; - return getBuilderAfterTimeout(instance); - } - } - - public static class PostRequestBuilder implements SetterForRequestBody, SetterForServerIndex, SetterForTimeout { - private final PostRequest instance; - - public PostRequestBuilder() { - this.instance = new PostRequest(); - } - - public PostRequest build() { - return instance; - } - - public PostRequest getInstance() { - return instance; - } - - public PostRequestBuilder getBuilderAfterRequestBody(PostRequest instance) { - return this; - } - - public PostRequestBuilder getBuilderAfterServerIndex(PostRequest instance) { - return this; - } - - public PostRequestBuilder getBuilderAfterTimeout(PostRequest instance) { - return this; - } - } -} diff --git a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/fakeuploadfile/post/FakeuploadfilePostRequestBody.kt b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/fakeuploadfile/post/FakeuploadfilePostRequestBody.kt deleted file mode 100644 index a975d519495..00000000000 --- a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/fakeuploadfile/post/FakeuploadfilePostRequestBody.kt +++ /dev/null @@ -1,49 +0,0 @@ -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; -import org.openapijsonschematools.client.mediatype.MediaType; -import org.openapijsonschematools.client.paths.fakeuploadfile.post.requestbody.content.multipartformdata.MultipartformdataSchema; - -import java.util.AbstractMap; -import java.util.Map; - -public class FakeuploadfilePostRequestBody { - public sealed interface SealedMediaType permits MultipartformdataMediaType {} - - public record MultipartformdataMediaType(MultipartformdataSchema.MultipartformdataSchema1 schema) implements SealedMediaType, MediaType { - public MultipartformdataMediaType() { - this(MultipartformdataSchema.MultipartformdataSchema1.getInstance()); - } - @Override - public Nothing? encoding() { - return null; - } - } - - public static class FakeuploadfilePostRequestBody1 extends RequestBodySerializer { - public FakeuploadfilePostRequestBody1() { - super( - Map.ofEntries( - new AbstractMap.SimpleEntry<>("multipart/form-data", new MultipartformdataMediaType()) - ), - false - ); - } - - public SerializedRequestBody serialize(SealedRequestBody requestBody) throws NotImplementedException { - MultipartformdataRequestBody requestBody0 = (MultipartformdataRequestBody) requestBody; - return serialize(requestBody0.contentType(), requestBody0.body().getData()); - } - } - - public sealed interface SealedRequestBody permits MultipartformdataRequestBody {} - public record MultipartformdataRequestBody(MultipartformdataSchema.MultipartformdataSchema1Boxed body) implements SealedRequestBody, GenericRequestBody { - @Override - public String contentType() { - return "multipart/form-data"; - } - } -} diff --git a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/fakeuploadfile/post/FakeuploadfilePostResponses.kt b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/fakeuploadfile/post/FakeuploadfilePostResponses.kt deleted file mode 100644 index b40e2b5ea2c..00000000000 --- a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/fakeuploadfile/post/FakeuploadfilePostResponses.kt +++ /dev/null @@ -1,53 +0,0 @@ -package org.openapijsonschematools.client.paths.fakeuploadfile.post; - -import org.openapijsonschematools.client.paths.fakeuploadfile.post.responses.FakeuploadfilePostCode200Response; -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; -import org.checkerframework.checker.nullness.qual.Nullable; - -import java.net.http.HttpResponse; -import java.util.Map; -import java.util.AbstractMap; - -public class FakeuploadfilePostResponses { - public sealed interface EndpointResponse permits EndpointFakeuploadfilePostCode200Response {} - - public record EndpointFakeuploadfilePostCode200Response( - HttpResponse response, - FakeuploadfilePostCode200Response.SealedResponseBody body, - Nothing? headers - ) implements EndpointResponse, ApiResponse{ - } - - public sealed interface StatusCodeResponseDeserializer permits StatusFakeuploadfilePostCode200ResponseDeserializer {} - - public static final class StatusFakeuploadfilePostCode200ResponseDeserializer extends FakeuploadfilePostCode200Response.FakeuploadfilePostCode200Response1 implements StatusCodeResponseDeserializer { - } - - public static final class FakeuploadfilePostResponses1 implements ResponsesDeserializer { - private final Map statusCodeToResponseDeserializer; - public FakeuploadfilePostResponses1() { - this.statusCodeToResponseDeserializer = Map.ofEntries( - new AbstractMap.SimpleEntry<>("200", new StatusFakeuploadfilePostCode200ResponseDeserializer()) - ); - } - - 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) { - throw new ApiException( - "Invalid response statusCode="+statusCode+" has no response defined in the openapi document", - response - ); - } - StatusFakeuploadfilePostCode200ResponseDeserializer castDeserializer = (StatusFakeuploadfilePostCode200ResponseDeserializer) statusCodeDeserializer; - var deserializedResponse = castDeserializer.deserialize(response, configuration); - return new EndpointFakeuploadfilePostCode200Response(response, deserializedResponse.body(), deserializedResponse.headers()); - } - } -} diff --git a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/fakeuploadfile/post/requestbody/content/multipartformdata/MultipartformdataSchema.kt b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/fakeuploadfile/post/requestbody/content/multipartformdata/MultipartformdataSchema.kt deleted file mode 100644 index d5b2b0606da..00000000000 --- a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/fakeuploadfile/post/requestbody/content/multipartformdata/MultipartformdataSchema.kt +++ /dev/null @@ -1,251 +0,0 @@ -package org.openapijsonschematools.client.paths.fakeuploadfile.post.requestbody.content.multipartformdata; -import java.util.ArrayList; -import java.util.HashSet; -import java.util.LinkedHashMap; -import java.util.LinkedHashSet; -import java.util.List; -import java.util.Map; -import java.util.Objects; -import java.util.Set; -import org.checkerframework.checker.nullness.qual.Nullable; -import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags; -import org.openapijsonschematools.client.configurations.SchemaConfiguration; -import org.openapijsonschematools.client.exceptions.InvalidAdditionalPropertyException; -import org.openapijsonschematools.client.exceptions.UnsetPropertyException; -import org.openapijsonschematools.client.exceptions.ValidationException; -import org.openapijsonschematools.client.schemas.GenericBuilder; -import org.openapijsonschematools.client.schemas.StringJsonSchema; -import org.openapijsonschematools.client.schemas.UnsetAddPropsSetter; -import org.openapijsonschematools.client.schemas.validation.FrozenMap; -import org.openapijsonschematools.client.schemas.validation.JsonSchema; -import org.openapijsonschematools.client.schemas.validation.JsonSchemaInfo; -import org.openapijsonschematools.client.schemas.validation.MapSchemaValidator; -import org.openapijsonschematools.client.schemas.validation.PathToSchemasMap; -import org.openapijsonschematools.client.schemas.validation.PropertyEntry; -import org.openapijsonschematools.client.schemas.validation.ValidationMetadata; - -public class MultipartformdataSchema { - // nest classes so all schemas and input/output classes can be public - - - public static class MultipartformdataAdditionalMetadata extends StringJsonSchema.StringJsonSchema1 { - private static @Nullable MultipartformdataAdditionalMetadata instance = null; - public static MultipartformdataAdditionalMetadata getInstance() { - if (instance == null) { - instance = new MultipartformdataAdditionalMetadata(); - } - return instance; - } - } - - - public static class MultipartformdataFile extends StringJsonSchema.StringJsonSchema1 { - // BinarySchema - private static @Nullable MultipartformdataFile instance = null; - public static MultipartformdataFile getInstance() { - if (instance == null) { - instance = new MultipartformdataFile(); - } - return instance; - } - } - - - public static class MultipartformdataSchemaMap extends FrozenMap<@Nullable Object> { - protected MultipartformdataSchemaMap(FrozenMap<@Nullable Object> m) { - super(m); - } - public static final Set requiredKeys = Set.of( - "file" - ); - public static final Set optionalKeys = Set.of( - "additionalMetadata" - ); - public static MultipartformdataSchemaMap of(Map arg, SchemaConfiguration configuration) throws ValidationException { - return MultipartformdataSchema1.getInstance().validate(arg, configuration); - } - - public String file() { - @Nullable Object value = get("file"); - if (!(value instanceof String)) { - throw new RuntimeException("Invalid value stored for file"); - } - return (String) value; - } - - public String additionalMetadata() throws UnsetPropertyException { - String key = "additionalMetadata"; - throwIfKeyNotPresent(key); - @Nullable Object value = get(key); - if (!(value instanceof String)) { - throw new RuntimeException("Invalid value stored for additionalMetadata"); - } - return (String) value; - } - - public @Nullable Object getAdditionalProperty(String name) throws UnsetPropertyException, InvalidAdditionalPropertyException { - throwIfKeyKnown(name, requiredKeys, optionalKeys); - throwIfKeyNotPresent(name); - return get(name); - } - } - - public interface SetterForMultipartformdataFile { - Map getInstance(); - T getBuilderAfterMultipartformdataFile(Map instance); - - default T file(String value) { - var instance = getInstance(); - instance.put("file", value); - return getBuilderAfterMultipartformdataFile(instance); - } - } - - public interface SetterForMultipartformdataAdditionalMetadata { - Map getInstance(); - T getBuilderAfterMultipartformdataAdditionalMetadata(Map instance); - - default T additionalMetadata(String value) { - var instance = getInstance(); - instance.put("additionalMetadata", value); - return getBuilderAfterMultipartformdataAdditionalMetadata(instance); - } - } - - public static class MultipartformdataSchemaMap0Builder extends UnsetAddPropsSetter implements GenericBuilder>, SetterForMultipartformdataAdditionalMetadata { - private final Map instance; - private static final Set knownKeys = Set.of( - "file", - "additionalMetadata" - ); - public Set getKnownKeys() { - return knownKeys; - } - public MultipartformdataSchemaMap0Builder(Map instance) { - this.instance = instance; - } - public Map build() { - return instance; - } - public Map getInstance() { - return instance; - } - public MultipartformdataSchemaMap0Builder getBuilderAfterMultipartformdataAdditionalMetadata(Map instance) { - return this; - } - public MultipartformdataSchemaMap0Builder getBuilderAfterAdditionalProperty(Map instance) { - return this; - } - } - - public static class MultipartformdataSchemaMapBuilder implements SetterForMultipartformdataFile { - private final Map instance; - public MultipartformdataSchemaMapBuilder() { - this.instance = new LinkedHashMap<>(); - } - public Map getInstance() { - return instance; - } - public MultipartformdataSchemaMap0Builder getBuilderAfterMultipartformdataFile(Map instance) { - return new MultipartformdataSchemaMap0Builder(instance); - } - } - - - public sealed interface MultipartformdataSchema1Boxed permits MultipartformdataSchema1BoxedMap { - @Nullable Object getData(); - } - - public record MultipartformdataSchema1BoxedMap(MultipartformdataSchemaMap data) implements MultipartformdataSchema1Boxed { - @Override - public @Nullable Object getData() { - return data; - } - } - - - public static class MultipartformdataSchema1 extends JsonSchema implements MapSchemaValidator { - private static @Nullable MultipartformdataSchema1 instance = null; - - protected MultipartformdataSchema1() { - super(new JsonSchemaInfo() - .type(Set.of(Map.class)) - .properties(Map.ofEntries( - new PropertyEntry("additionalMetadata", MultipartformdataAdditionalMetadata.class), - new PropertyEntry("file", MultipartformdataFile.class) - )) - .required(Set.of( - "file" - )) - ); - } - - public static MultipartformdataSchema1 getInstance() { - if (instance == null) { - instance = new MultipartformdataSchema1(); - } - return instance; - } - - 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 RuntimeException("Invalid non-string key value"); - } - String propertyName = (String) entryKey; - List propertyPathToItem = new ArrayList<>(pathToItem); - propertyPathToItem.add(propertyName); - Object value = entry.getValue(); - LinkedHashMap, Nothing?> schemas = pathToSchemas.get(propertyPathToItem); - if (schemas == null) { - throw new RuntimeException("Validation result is invalid, schemas must exist for a pathToItem"); - } - JsonSchema propertySchema = schemas.entrySet().iterator().next().getKey(); - @Nullable Object propertyInstance = propertySchema.getNewInstance(value, propertyPathToItem, pathToSchemas); - properties.put(propertyName, propertyInstance); - } - FrozenMap<@Nullable Object> castProperties = new FrozenMap<>(properties); - return new MultipartformdataSchemaMap(castProperties); - } - - 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); - SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().build())); - ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, new PathToSchemasMap(), new LinkedHashSet<>()); - PathToSchemasMap pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet); - return getNewInstance(castArg, validationMetadata.pathToItem(), pathToSchemasMap); - } - - - @Override - public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws 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"); - } - @Override - public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { - if (arg instanceof Map) { - return getNewInstance((Map) arg, pathToItem, pathToSchemas); - } - 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 { - return new MultipartformdataSchema1BoxedMap(validate(arg, configuration)); - } - @Override - public MultipartformdataSchema1Boxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { - 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"); - } - } - -} diff --git a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/fakeuploadfile/post/responses/FakeuploadfilePostCode200Response.kt b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/fakeuploadfile/post/responses/FakeuploadfilePostCode200Response.kt deleted file mode 100644 index 0be951312e2..00000000000 --- a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/fakeuploadfile/post/responses/FakeuploadfilePostCode200Response.kt +++ /dev/null @@ -1,63 +0,0 @@ -package org.openapijsonschematools.client.paths.fakeuploadfile.post.responses; - -import org.openapijsonschematools.client.configurations.SchemaConfiguration; -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; - -import java.util.AbstractMap; -import java.util.Map; -import java.net.http.HttpResponse; -import java.net.http.HttpHeaders; - -public class FakeuploadfilePostCode200Response { - public sealed interface SealedMediaType permits ApplicationjsonMediaType {} - - public record ApplicationjsonMediaType(ApplicationjsonSchema.ApplicationjsonSchema1 schema) implements SealedMediaType, MediaType { - public ApplicationjsonMediaType() { - this(ApplicationjsonSchema.ApplicationjsonSchema1.getInstance()); - } - @Override - public Nothing? encoding() { - return null; - } - } - public sealed interface SealedResponseBody permits ApplicationjsonResponseBody {} - public record ApplicationjsonResponseBody(ApplicationjsonSchema.ApiResponseSchema1Boxed body) implements SealedResponseBody { } - - public static class FakeuploadfilePostCode200Response1 extends ResponseDeserializer { - public FakeuploadfilePostCode200Response1() { - super( - Map.ofEntries( - new AbstractMap.SimpleEntry<>("application/json", new ApplicationjsonMediaType()) - ) - ); - } - - @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); - } - - @Override - protected Nothing? getHeaders(HttpHeaders headers, SchemaConfiguration configuration) { - return null; - } - } - - @SuppressWarnings("serial") - public static class ResponseApiException extends ApiException { - public DeserializedHttpResponse deserializedResponse; - - public ResponseApiException(String s, HttpResponse response, DeserializedHttpResponse deserializedResponse) { - super(s, response); - this.deserializedResponse = deserializedResponse; - } - } -} diff --git a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/fakeuploadfile/post/responses/code200response/content/applicationjson/ApplicationjsonSchema.kt b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/fakeuploadfile/post/responses/code200response/content/applicationjson/ApplicationjsonSchema.kt deleted file mode 100644 index efbbe4fc405..00000000000 --- a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/fakeuploadfile/post/responses/code200response/content/applicationjson/ApplicationjsonSchema.kt +++ /dev/null @@ -1,19 +0,0 @@ -package org.openapijsonschematools.client.paths.fakeuploadfile.post.responses.code200response.content.applicationjson; - -import org.checkerframework.checker.nullness.qual.Nullable; -import org.openapijsonschematools.client.components.schemas.ApiResponseSchema; - -public class ApplicationjsonSchema extends ApiResponseSchema { - // $refed class - - - public static class ApplicationjsonSchema1 extends ApiResponseSchema1 { - private static @Nullable ApplicationjsonSchema1 instance = null; - public static ApplicationjsonSchema1 getInstance() { - if (instance == null) { - instance = new ApplicationjsonSchema1(); - } - return instance; - } - } -} diff --git a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/fakeuploadfiles/FakeuploadfilesPost.kt b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/fakeuploadfiles/FakeuploadfilesPost.kt deleted file mode 100644 index e35ade51c50..00000000000 --- a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/fakeuploadfiles/FakeuploadfilesPost.kt +++ /dev/null @@ -1,152 +0,0 @@ -package org.openapijsonschematools.client.paths.fakeuploadfiles; - -import org.checkerframework.checker.nullness.qual.Nullable; -import org.openapijsonschematools.client.paths.fakeuploadfiles.post.FakeuploadfilesPostRequestBody; -import org.openapijsonschematools.client.RootServerInfo; -import org.openapijsonschematools.client.paths.fakeuploadfiles.post.FakeuploadfilesPostResponses; -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.requestbody.SerializedRequestBody; -import org.openapijsonschematools.client.paths.Fakeuploadfiles; - -import java.io.IOException; -import java.util.ArrayList; -import java.net.http.HttpClient; -import java.net.http.HttpRequest; -import java.time.Duration; -import java.util.List; -import java.util.Map; - -public class FakeuploadfilesPost { - private static class PostProvider { - private static final String method = "post"; - - public static FakeuploadfilesPostResponses.EndpointResponse post( - PostRequest request, - ApiConfiguration apiConfiguration, - SchemaConfiguration schemaConfiguration, - HttpClient client - ) throws IOException, InterruptedException, ValidationException, NotImplementedException, ApiException { - Map> headers = apiConfiguration.getDefaultHeaders(); - - @Nullable SerializedRequestBody serializedRequestBody; - HttpRequest.BodyPublisher bodyPublisher = HttpRequest.BodyPublishers.noBody(); - if (request.requestBody != null) { - serializedRequestBody = new FakeuploadfilesPostRequestBody.FakeuploadfilesPostRequestBody1().serialize( - request.requestBody - ); - var contentTypeHeaderValues = headers.getOrDefault("Content-Type", new ArrayList<>()); - contentTypeHeaderValues.add(serializedRequestBody.contentType); - bodyPublisher = serializedRequestBody.bodyPublisher; - } - // TODO set this to a map if there is a query security scheme - @Nullable Map queryMap = null; - String host = apiConfiguration.getServer(request.serverIndex).url(); - - String url = host + Fakeuploadfiles.path; - var httpRequest = RestClient.getRequest( - url, - method, - bodyPublisher, - headers, - request.timeout - ); - var response = RestClient.getResponse(httpRequest, client); - var responsesDeserializer = new FakeuploadfilesPostResponses.FakeuploadfilesPostResponses1(); - return responsesDeserializer.deserialize(response, schemaConfiguration); - } - } - - public interface PostOperation { - ApiConfiguration getApiConfiguration(); - SchemaConfiguration getSchemaConfiguration(); - HttpClient getClient(); - default FakeuploadfilesPostResponses.EndpointResponse post(PostRequest request) throws IOException, InterruptedException, ValidationException, NotImplementedException, ApiException { - return PostProvider.post(request, getApiConfiguration(), getSchemaConfiguration(), getClient()); - } - } - - public interface UploadFilesOperation { - ApiConfiguration getApiConfiguration(); - SchemaConfiguration getSchemaConfiguration(); - HttpClient getClient(); - default FakeuploadfilesPostResponses.EndpointResponse uploadFiles(PostRequest request) throws IOException, InterruptedException, ValidationException, NotImplementedException, ApiException { - return PostProvider.post(request, getApiConfiguration(), getSchemaConfiguration(), getClient()); - } - } - - public static class Post extends ApiClient implements PostOperation { - public Post(ApiConfiguration apiConfiguration, SchemaConfiguration schemaConfiguration) { - super(apiConfiguration, schemaConfiguration); - } - } - - public static class PostRequest { - public FakeuploadfilesPostRequestBody.@Nullable SealedRequestBody requestBody; - public RootServerInfo.@Nullable ServerIndex serverIndex; - public @Nullable Duration timeout; - } - - public interface SetterForRequestBody { - PostRequest getInstance(); - T getBuilderAfterRequestBody(PostRequest instance); - default T requestBody(FakeuploadfilesPostRequestBody.SealedRequestBody requestBody) { - var instance = getInstance(); - instance.requestBody = requestBody; - return getBuilderAfterRequestBody(instance); - } - } - - public interface SetterForServerIndex { - PostRequest getInstance(); - T getBuilderAfterServerIndex(PostRequest instance); - default T serverIndex(RootServerInfo.ServerIndex serverIndex) { - var instance = getInstance(); - instance.serverIndex = serverIndex; - return getBuilderAfterServerIndex(instance); - } - } - - public interface SetterForTimeout { - PostRequest getInstance(); - T getBuilderAfterTimeout(PostRequest instance); - default T timeout(Duration timeout) { - var instance = getInstance(); - instance.timeout = timeout; - return getBuilderAfterTimeout(instance); - } - } - - public static class PostRequestBuilder implements SetterForRequestBody, SetterForServerIndex, SetterForTimeout { - private final PostRequest instance; - - public PostRequestBuilder() { - this.instance = new PostRequest(); - } - - public PostRequest build() { - return instance; - } - - public PostRequest getInstance() { - return instance; - } - - public PostRequestBuilder getBuilderAfterRequestBody(PostRequest instance) { - return this; - } - - public PostRequestBuilder getBuilderAfterServerIndex(PostRequest instance) { - return this; - } - - public PostRequestBuilder getBuilderAfterTimeout(PostRequest instance) { - return this; - } - } -} diff --git a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/fakeuploadfiles/post/FakeuploadfilesPostRequestBody.kt b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/fakeuploadfiles/post/FakeuploadfilesPostRequestBody.kt deleted file mode 100644 index 0a1d1e5c658..00000000000 --- a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/fakeuploadfiles/post/FakeuploadfilesPostRequestBody.kt +++ /dev/null @@ -1,49 +0,0 @@ -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; -import org.openapijsonschematools.client.mediatype.MediaType; -import org.openapijsonschematools.client.paths.fakeuploadfiles.post.requestbody.content.multipartformdata.MultipartformdataSchema; - -import java.util.AbstractMap; -import java.util.Map; - -public class FakeuploadfilesPostRequestBody { - public sealed interface SealedMediaType permits MultipartformdataMediaType {} - - public record MultipartformdataMediaType(MultipartformdataSchema.MultipartformdataSchema1 schema) implements SealedMediaType, MediaType { - public MultipartformdataMediaType() { - this(MultipartformdataSchema.MultipartformdataSchema1.getInstance()); - } - @Override - public Nothing? encoding() { - return null; - } - } - - public static class FakeuploadfilesPostRequestBody1 extends RequestBodySerializer { - public FakeuploadfilesPostRequestBody1() { - super( - Map.ofEntries( - new AbstractMap.SimpleEntry<>("multipart/form-data", new MultipartformdataMediaType()) - ), - false - ); - } - - public SerializedRequestBody serialize(SealedRequestBody requestBody) throws NotImplementedException { - MultipartformdataRequestBody requestBody0 = (MultipartformdataRequestBody) requestBody; - return serialize(requestBody0.contentType(), requestBody0.body().getData()); - } - } - - public sealed interface SealedRequestBody permits MultipartformdataRequestBody {} - public record MultipartformdataRequestBody(MultipartformdataSchema.MultipartformdataSchema1Boxed body) implements SealedRequestBody, GenericRequestBody { - @Override - public String contentType() { - return "multipart/form-data"; - } - } -} diff --git a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/fakeuploadfiles/post/FakeuploadfilesPostResponses.kt b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/fakeuploadfiles/post/FakeuploadfilesPostResponses.kt deleted file mode 100644 index ffff5ed7b3e..00000000000 --- a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/fakeuploadfiles/post/FakeuploadfilesPostResponses.kt +++ /dev/null @@ -1,53 +0,0 @@ -package org.openapijsonschematools.client.paths.fakeuploadfiles.post; - -import org.openapijsonschematools.client.paths.fakeuploadfiles.post.responses.FakeuploadfilesPostCode200Response; -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; -import org.checkerframework.checker.nullness.qual.Nullable; - -import java.net.http.HttpResponse; -import java.util.Map; -import java.util.AbstractMap; - -public class FakeuploadfilesPostResponses { - public sealed interface EndpointResponse permits EndpointFakeuploadfilesPostCode200Response {} - - public record EndpointFakeuploadfilesPostCode200Response( - HttpResponse response, - FakeuploadfilesPostCode200Response.SealedResponseBody body, - Nothing? headers - ) implements EndpointResponse, ApiResponse{ - } - - public sealed interface StatusCodeResponseDeserializer permits StatusFakeuploadfilesPostCode200ResponseDeserializer {} - - public static final class StatusFakeuploadfilesPostCode200ResponseDeserializer extends FakeuploadfilesPostCode200Response.FakeuploadfilesPostCode200Response1 implements StatusCodeResponseDeserializer { - } - - public static final class FakeuploadfilesPostResponses1 implements ResponsesDeserializer { - private final Map statusCodeToResponseDeserializer; - public FakeuploadfilesPostResponses1() { - this.statusCodeToResponseDeserializer = Map.ofEntries( - new AbstractMap.SimpleEntry<>("200", new StatusFakeuploadfilesPostCode200ResponseDeserializer()) - ); - } - - 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) { - throw new ApiException( - "Invalid response statusCode="+statusCode+" has no response defined in the openapi document", - response - ); - } - StatusFakeuploadfilesPostCode200ResponseDeserializer castDeserializer = (StatusFakeuploadfilesPostCode200ResponseDeserializer) statusCodeDeserializer; - var deserializedResponse = castDeserializer.deserialize(response, configuration); - return new EndpointFakeuploadfilesPostCode200Response(response, deserializedResponse.body(), deserializedResponse.headers()); - } - } -} diff --git a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/fakeuploadfiles/post/requestbody/content/multipartformdata/MultipartformdataSchema.kt b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/fakeuploadfiles/post/requestbody/content/multipartformdata/MultipartformdataSchema.kt deleted file mode 100644 index 1121d2a2a11..00000000000 --- a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/fakeuploadfiles/post/requestbody/content/multipartformdata/MultipartformdataSchema.kt +++ /dev/null @@ -1,325 +0,0 @@ -package org.openapijsonschematools.client.paths.fakeuploadfiles.post.requestbody.content.multipartformdata; -import java.util.ArrayList; -import java.util.HashSet; -import java.util.LinkedHashMap; -import java.util.LinkedHashSet; -import java.util.List; -import java.util.Map; -import java.util.Objects; -import java.util.Set; -import org.checkerframework.checker.nullness.qual.Nullable; -import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags; -import org.openapijsonschematools.client.configurations.SchemaConfiguration; -import org.openapijsonschematools.client.exceptions.InvalidAdditionalPropertyException; -import org.openapijsonschematools.client.exceptions.UnsetPropertyException; -import org.openapijsonschematools.client.exceptions.ValidationException; -import org.openapijsonschematools.client.schemas.GenericBuilder; -import org.openapijsonschematools.client.schemas.StringJsonSchema; -import org.openapijsonschematools.client.schemas.UnsetAddPropsSetter; -import org.openapijsonschematools.client.schemas.validation.FrozenList; -import org.openapijsonschematools.client.schemas.validation.FrozenMap; -import org.openapijsonschematools.client.schemas.validation.JsonSchema; -import org.openapijsonschematools.client.schemas.validation.JsonSchemaInfo; -import org.openapijsonschematools.client.schemas.validation.ListSchemaValidator; -import org.openapijsonschematools.client.schemas.validation.MapSchemaValidator; -import org.openapijsonschematools.client.schemas.validation.PathToSchemasMap; -import org.openapijsonschematools.client.schemas.validation.PropertyEntry; -import org.openapijsonschematools.client.schemas.validation.ValidationMetadata; - -public class MultipartformdataSchema { - // nest classes so all schemas and input/output classes can be public - - - public static class MultipartformdataItems extends StringJsonSchema.StringJsonSchema1 { - // BinarySchema - private static @Nullable MultipartformdataItems instance = null; - public static MultipartformdataItems getInstance() { - if (instance == null) { - instance = new MultipartformdataItems(); - } - return instance; - } - } - - - public static class MultipartformdataFilesList extends FrozenList { - protected MultipartformdataFilesList(FrozenList m) { - super(m); - } - public static MultipartformdataFilesList of(List arg, SchemaConfiguration configuration) throws ValidationException { - return MultipartformdataFiles.getInstance().validate(arg, configuration); - } - } - - public static class MultipartformdataFilesListBuilder { - // class to build List - private final List list; - - public MultipartformdataFilesListBuilder() { - list = new ArrayList<>(); - } - - public MultipartformdataFilesListBuilder(List list) { - this.list = list; - } - - public MultipartformdataFilesListBuilder add(String item) { - list.add(item); - return this; - } - - public List build() { - return list; - } - } - - - public sealed interface MultipartformdataFilesBoxed permits MultipartformdataFilesBoxedList { - @Nullable Object getData(); - } - - public record MultipartformdataFilesBoxedList(MultipartformdataFilesList data) implements MultipartformdataFilesBoxed { - @Override - public @Nullable Object getData() { - return data; - } - } - - - - public static class MultipartformdataFiles extends JsonSchema implements ListSchemaValidator { - private static @Nullable MultipartformdataFiles instance = null; - - protected MultipartformdataFiles() { - super(new JsonSchemaInfo() - .type(Set.of(List.class)) - .items(MultipartformdataItems.class) - ); - } - - public static MultipartformdataFiles getInstance() { - if (instance == null) { - instance = new MultipartformdataFiles(); - } - return instance; - } - - @Override - public MultipartformdataFilesList getNewInstance(List arg, List pathToItem, PathToSchemasMap pathToSchemas) { - List items = new ArrayList<>(); - int i = 0; - for (Object item: arg) { - List itemPathToItem = new ArrayList<>(pathToItem); - itemPathToItem.add(i); - LinkedHashMap, Nothing?> schemas = pathToSchemas.get(itemPathToItem); - if (schemas == null) { - throw new RuntimeException("Validation 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"); - } - items.add((String) itemInstance); - i += 1; - } - FrozenList newInstanceItems = new FrozenList<>(items); - return new MultipartformdataFilesList(newInstanceItems); - } - - 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); - SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().build())); - ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, new PathToSchemasMap(), new LinkedHashSet<>()); - PathToSchemasMap pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet); - return getNewInstance(castArg, validationMetadata.pathToItem(), pathToSchemasMap); - } - - @Override - public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws 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"); - } - @Override - public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { - 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"); - } - @Override - 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 { - 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"); - } - } - - public static class MultipartformdataSchemaMap extends FrozenMap<@Nullable Object> { - protected MultipartformdataSchemaMap(FrozenMap<@Nullable Object> m) { - super(m); - } - public static final Set requiredKeys = Set.of(); - public static final Set optionalKeys = Set.of( - "files" - ); - public static MultipartformdataSchemaMap of(Map arg, SchemaConfiguration configuration) throws ValidationException { - return MultipartformdataSchema1.getInstance().validate(arg, configuration); - } - - public MultipartformdataFilesList files() throws UnsetPropertyException { - String key = "files"; - throwIfKeyNotPresent(key); - @Nullable Object value = get(key); - if (!(value instanceof MultipartformdataFilesList)) { - throw new RuntimeException("Invalid value stored for files"); - } - return (MultipartformdataFilesList) value; - } - - public @Nullable Object getAdditionalProperty(String name) throws UnsetPropertyException, InvalidAdditionalPropertyException { - throwIfKeyKnown(name, requiredKeys, optionalKeys); - throwIfKeyNotPresent(name); - return get(name); - } - } - - public interface SetterForMultipartformdataFiles { - Map getInstance(); - T getBuilderAfterMultipartformdataFiles(Map instance); - - default T files(List value) { - var instance = getInstance(); - instance.put("files", value); - return getBuilderAfterMultipartformdataFiles(instance); - } - } - - public static class MultipartformdataSchemaMapBuilder extends UnsetAddPropsSetter implements GenericBuilder>, SetterForMultipartformdataFiles { - private final Map instance; - private static final Set knownKeys = Set.of( - "files" - ); - public Set getKnownKeys() { - return knownKeys; - } - public MultipartformdataSchemaMapBuilder() { - this.instance = new LinkedHashMap<>(); - } - public Map build() { - return instance; - } - public Map getInstance() { - return instance; - } - public MultipartformdataSchemaMapBuilder getBuilderAfterMultipartformdataFiles(Map instance) { - return this; - } - public MultipartformdataSchemaMapBuilder getBuilderAfterAdditionalProperty(Map instance) { - return this; - } - } - - - public sealed interface MultipartformdataSchema1Boxed permits MultipartformdataSchema1BoxedMap { - @Nullable Object getData(); - } - - public record MultipartformdataSchema1BoxedMap(MultipartformdataSchemaMap data) implements MultipartformdataSchema1Boxed { - @Override - public @Nullable Object getData() { - return data; - } - } - - - public static class MultipartformdataSchema1 extends JsonSchema implements MapSchemaValidator { - private static @Nullable MultipartformdataSchema1 instance = null; - - protected MultipartformdataSchema1() { - super(new JsonSchemaInfo() - .type(Set.of(Map.class)) - .properties(Map.ofEntries( - new PropertyEntry("files", MultipartformdataFiles.class) - )) - ); - } - - public static MultipartformdataSchema1 getInstance() { - if (instance == null) { - instance = new MultipartformdataSchema1(); - } - return instance; - } - - 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 RuntimeException("Invalid non-string key value"); - } - String propertyName = (String) entryKey; - List propertyPathToItem = new ArrayList<>(pathToItem); - propertyPathToItem.add(propertyName); - Object value = entry.getValue(); - LinkedHashMap, Nothing?> schemas = pathToSchemas.get(propertyPathToItem); - if (schemas == null) { - throw new RuntimeException("Validation result is invalid, schemas must exist for a pathToItem"); - } - JsonSchema propertySchema = schemas.entrySet().iterator().next().getKey(); - @Nullable Object propertyInstance = propertySchema.getNewInstance(value, propertyPathToItem, pathToSchemas); - properties.put(propertyName, propertyInstance); - } - FrozenMap<@Nullable Object> castProperties = new FrozenMap<>(properties); - return new MultipartformdataSchemaMap(castProperties); - } - - 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); - SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().build())); - ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, new PathToSchemasMap(), new LinkedHashSet<>()); - PathToSchemasMap pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet); - return getNewInstance(castArg, validationMetadata.pathToItem(), pathToSchemasMap); - } - - - @Override - public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws 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"); - } - @Override - public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { - if (arg instanceof Map) { - return getNewInstance((Map) arg, pathToItem, pathToSchemas); - } - 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 { - return new MultipartformdataSchema1BoxedMap(validate(arg, configuration)); - } - @Override - public MultipartformdataSchema1Boxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { - 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"); - } - } - -} diff --git a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/fakeuploadfiles/post/responses/FakeuploadfilesPostCode200Response.kt b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/fakeuploadfiles/post/responses/FakeuploadfilesPostCode200Response.kt deleted file mode 100644 index 82642288d7c..00000000000 --- a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/fakeuploadfiles/post/responses/FakeuploadfilesPostCode200Response.kt +++ /dev/null @@ -1,63 +0,0 @@ -package org.openapijsonschematools.client.paths.fakeuploadfiles.post.responses; - -import org.openapijsonschematools.client.configurations.SchemaConfiguration; -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; - -import java.util.AbstractMap; -import java.util.Map; -import java.net.http.HttpResponse; -import java.net.http.HttpHeaders; - -public class FakeuploadfilesPostCode200Response { - public sealed interface SealedMediaType permits ApplicationjsonMediaType {} - - public record ApplicationjsonMediaType(ApplicationjsonSchema.ApplicationjsonSchema1 schema) implements SealedMediaType, MediaType { - public ApplicationjsonMediaType() { - this(ApplicationjsonSchema.ApplicationjsonSchema1.getInstance()); - } - @Override - public Nothing? encoding() { - return null; - } - } - public sealed interface SealedResponseBody permits ApplicationjsonResponseBody {} - public record ApplicationjsonResponseBody(ApplicationjsonSchema.ApiResponseSchema1Boxed body) implements SealedResponseBody { } - - public static class FakeuploadfilesPostCode200Response1 extends ResponseDeserializer { - public FakeuploadfilesPostCode200Response1() { - super( - Map.ofEntries( - new AbstractMap.SimpleEntry<>("application/json", new ApplicationjsonMediaType()) - ) - ); - } - - @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); - } - - @Override - protected Nothing? getHeaders(HttpHeaders headers, SchemaConfiguration configuration) { - return null; - } - } - - @SuppressWarnings("serial") - public static class ResponseApiException extends ApiException { - public DeserializedHttpResponse deserializedResponse; - - public ResponseApiException(String s, HttpResponse response, DeserializedHttpResponse deserializedResponse) { - super(s, response); - this.deserializedResponse = deserializedResponse; - } - } -} diff --git a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/fakeuploadfiles/post/responses/code200response/content/applicationjson/ApplicationjsonSchema.kt b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/fakeuploadfiles/post/responses/code200response/content/applicationjson/ApplicationjsonSchema.kt deleted file mode 100644 index df28450acdb..00000000000 --- a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/fakeuploadfiles/post/responses/code200response/content/applicationjson/ApplicationjsonSchema.kt +++ /dev/null @@ -1,19 +0,0 @@ -package org.openapijsonschematools.client.paths.fakeuploadfiles.post.responses.code200response.content.applicationjson; - -import org.checkerframework.checker.nullness.qual.Nullable; -import org.openapijsonschematools.client.components.schemas.ApiResponseSchema; - -public class ApplicationjsonSchema extends ApiResponseSchema { - // $refed class - - - public static class ApplicationjsonSchema1 extends ApiResponseSchema1 { - private static @Nullable ApplicationjsonSchema1 instance = null; - public static ApplicationjsonSchema1 getInstance() { - if (instance == null) { - instance = new ApplicationjsonSchema1(); - } - return instance; - } - } -} diff --git a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/fakewildcardresponses/FakewildcardresponsesGet.kt b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/fakewildcardresponses/FakewildcardresponsesGet.kt deleted file mode 100644 index 1f7aab70481..00000000000 --- a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/fakewildcardresponses/FakewildcardresponsesGet.kt +++ /dev/null @@ -1,124 +0,0 @@ -package org.openapijsonschematools.client.paths.fakewildcardresponses; - -import org.checkerframework.checker.nullness.qual.Nullable; -import org.openapijsonschematools.client.RootServerInfo; -import org.openapijsonschematools.client.paths.fakewildcardresponses.get.FakewildcardresponsesGetResponses; -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.paths.Fakewildcardresponses; - -import java.io.IOException; -import java.net.http.HttpClient; -import java.net.http.HttpRequest; -import java.time.Duration; -import java.util.List; -import java.util.Map; - -public class FakewildcardresponsesGet { - private static class GetProvider { - private static final String method = "get"; - - public static FakewildcardresponsesGetResponses.EndpointResponse get( - GetRequest request, - ApiConfiguration apiConfiguration, - SchemaConfiguration schemaConfiguration, - HttpClient client - ) 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 - @Nullable Map queryMap = null; - String host = apiConfiguration.getServer(request.serverIndex).url(); - - String url = host + Fakewildcardresponses.path; - var httpRequest = RestClient.getRequest( - url, - method, - bodyPublisher, - headers, - request.timeout - ); - var response = RestClient.getResponse(httpRequest, client); - var responsesDeserializer = new FakewildcardresponsesGetResponses.FakewildcardresponsesGetResponses1(); - return responsesDeserializer.deserialize(response, schemaConfiguration); - } - } - - public interface GetOperation { - ApiConfiguration getApiConfiguration(); - SchemaConfiguration getSchemaConfiguration(); - HttpClient getClient(); - default FakewildcardresponsesGetResponses.EndpointResponse get(GetRequest request) throws IOException, InterruptedException, ValidationException, NotImplementedException, ApiException { - return GetProvider.get(request, getApiConfiguration(), getSchemaConfiguration(), getClient()); - } - } - - public interface WildCardResponsesOperation { - ApiConfiguration getApiConfiguration(); - SchemaConfiguration getSchemaConfiguration(); - HttpClient getClient(); - default FakewildcardresponsesGetResponses.EndpointResponse wildCardResponses(GetRequest request) throws IOException, InterruptedException, ValidationException, NotImplementedException, ApiException { - return GetProvider.get(request, getApiConfiguration(), getSchemaConfiguration(), getClient()); - } - } - - public static class Get extends ApiClient implements GetOperation { - public Get(ApiConfiguration apiConfiguration, SchemaConfiguration schemaConfiguration) { - super(apiConfiguration, schemaConfiguration); - } - } - - public static class GetRequest { - public RootServerInfo.@Nullable ServerIndex serverIndex; - public @Nullable Duration timeout; - } - - public interface SetterForServerIndex { - GetRequest getInstance(); - T getBuilderAfterServerIndex(GetRequest instance); - default T serverIndex(RootServerInfo.ServerIndex serverIndex) { - var instance = getInstance(); - instance.serverIndex = serverIndex; - return getBuilderAfterServerIndex(instance); - } - } - - public interface SetterForTimeout { - GetRequest getInstance(); - T getBuilderAfterTimeout(GetRequest instance); - default T timeout(Duration timeout) { - var instance = getInstance(); - instance.timeout = timeout; - return getBuilderAfterTimeout(instance); - } - } - - public static class GetRequestBuilder implements SetterForServerIndex, SetterForTimeout { - private final GetRequest instance; - - public GetRequestBuilder() { - this.instance = new GetRequest(); - } - - public GetRequest build() { - return instance; - } - - public GetRequest getInstance() { - return instance; - } - - public GetRequestBuilder getBuilderAfterServerIndex(GetRequest instance) { - return this; - } - - public GetRequestBuilder getBuilderAfterTimeout(GetRequest instance) { - return this; - } - } -} diff --git a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/fakewildcardresponses/get/FakewildcardresponsesGetResponses.kt b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/fakewildcardresponses/get/FakewildcardresponsesGetResponses.kt deleted file mode 100644 index ba1f9d5ac09..00000000000 --- a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/fakewildcardresponses/get/FakewildcardresponsesGetResponses.kt +++ /dev/null @@ -1,139 +0,0 @@ -package org.openapijsonschematools.client.paths.fakewildcardresponses.get; - -import org.openapijsonschematools.client.paths.fakewildcardresponses.get.responses.FakewildcardresponsesGetCode1XXResponse; -import org.openapijsonschematools.client.paths.fakewildcardresponses.get.responses.FakewildcardresponsesGetCode200Response; -import org.openapijsonschematools.client.paths.fakewildcardresponses.get.responses.FakewildcardresponsesGetCode2XXResponse; -import org.openapijsonschematools.client.paths.fakewildcardresponses.get.responses.FakewildcardresponsesGetCode3XXResponse; -import org.openapijsonschematools.client.paths.fakewildcardresponses.get.responses.FakewildcardresponsesGetCode4XXResponse; -import org.openapijsonschematools.client.paths.fakewildcardresponses.get.responses.FakewildcardresponsesGetCode5XXResponse; -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; -import org.checkerframework.checker.nullness.qual.Nullable; - -import java.net.http.HttpResponse; -import java.util.Map; -import java.util.AbstractMap; - -public class FakewildcardresponsesGetResponses { - public sealed interface EndpointResponse permits EndpointFakewildcardresponsesGetCode1XXResponse, EndpointFakewildcardresponsesGetCode2XXResponse, EndpointFakewildcardresponsesGetCode200Response, EndpointFakewildcardresponsesGetCode3XXResponse {} - - public record EndpointFakewildcardresponsesGetCode1XXResponse( - HttpResponse response, - FakewildcardresponsesGetCode1XXResponse.SealedResponseBody body, - Nothing? headers - ) implements EndpointResponse, ApiResponse{ - } - - public record EndpointFakewildcardresponsesGetCode2XXResponse( - HttpResponse response, - FakewildcardresponsesGetCode2XXResponse.SealedResponseBody body, - Nothing? headers - ) implements EndpointResponse, ApiResponse{ - } - - public record EndpointFakewildcardresponsesGetCode200Response( - HttpResponse response, - FakewildcardresponsesGetCode200Response.SealedResponseBody body, - Nothing? headers - ) implements EndpointResponse, ApiResponse{ - } - - public record EndpointFakewildcardresponsesGetCode3XXResponse( - HttpResponse response, - FakewildcardresponsesGetCode3XXResponse.SealedResponseBody body, - Nothing? headers - ) implements EndpointResponse, ApiResponse{ - } - - public sealed interface StatusCodeResponseDeserializer permits StatusFakewildcardresponsesGetCode200ResponseDeserializer {} - - public static final class StatusFakewildcardresponsesGetCode200ResponseDeserializer extends FakewildcardresponsesGetCode200Response.FakewildcardresponsesGetCode200Response1 implements StatusCodeResponseDeserializer { - } - public sealed interface WildcardCodeResponseDeserializer permits WildcardFakewildcardresponsesGetCode1XXResponseDeserializer, WildcardFakewildcardresponsesGetCode2XXResponseDeserializer, WildcardFakewildcardresponsesGetCode3XXResponseDeserializer, WildcardFakewildcardresponsesGetCode4XXResponseDeserializer, WildcardFakewildcardresponsesGetCode5XXResponseDeserializer {} - - public static final class WildcardFakewildcardresponsesGetCode1XXResponseDeserializer extends FakewildcardresponsesGetCode1XXResponse.FakewildcardresponsesGetCode1XXResponse1 implements WildcardCodeResponseDeserializer { - } - public static final class WildcardFakewildcardresponsesGetCode2XXResponseDeserializer extends FakewildcardresponsesGetCode2XXResponse.FakewildcardresponsesGetCode2XXResponse1 implements WildcardCodeResponseDeserializer { - } - public static final class WildcardFakewildcardresponsesGetCode3XXResponseDeserializer extends FakewildcardresponsesGetCode3XXResponse.FakewildcardresponsesGetCode3XXResponse1 implements WildcardCodeResponseDeserializer { - } - public static final class WildcardFakewildcardresponsesGetCode4XXResponseDeserializer extends FakewildcardresponsesGetCode4XXResponse.FakewildcardresponsesGetCode4XXResponse1 implements WildcardCodeResponseDeserializer { - } - public static final class WildcardFakewildcardresponsesGetCode5XXResponseDeserializer extends FakewildcardresponsesGetCode5XXResponse.FakewildcardresponsesGetCode5XXResponse1 implements WildcardCodeResponseDeserializer { - } - - public static final class FakewildcardresponsesGetResponses1 implements ResponsesDeserializer { - private final Map statusCodeToResponseDeserializer; - private final Map wildcardCodeToResponseDeserializer; - public FakewildcardresponsesGetResponses1() { - this.statusCodeToResponseDeserializer = Map.ofEntries( - new AbstractMap.SimpleEntry<>("200", new StatusFakewildcardresponsesGetCode200ResponseDeserializer()) - ); - this.wildcardCodeToResponseDeserializer = Map.ofEntries( - new AbstractMap.SimpleEntry<>("1", new WildcardFakewildcardresponsesGetCode1XXResponseDeserializer()), - new AbstractMap.SimpleEntry<>("2", new WildcardFakewildcardresponsesGetCode2XXResponseDeserializer()), - new AbstractMap.SimpleEntry<>("3", new WildcardFakewildcardresponsesGetCode3XXResponseDeserializer()), - new AbstractMap.SimpleEntry<>("4", new WildcardFakewildcardresponsesGetCode4XXResponseDeserializer()), - new AbstractMap.SimpleEntry<>("5", new WildcardFakewildcardresponsesGetCode5XXResponseDeserializer()) - ); - } - - 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) { - StatusFakewildcardresponsesGetCode200ResponseDeserializer castDeserializer = (StatusFakewildcardresponsesGetCode200ResponseDeserializer) statusCodeDeserializer; - var deserializedResponse = castDeserializer.deserialize(response, configuration); - return new EndpointFakewildcardresponsesGetCode200Response(response, deserializedResponse.body(), deserializedResponse.headers()); - } - @Nullable WildcardCodeResponseDeserializer wildcardCodeDeserializer = wildcardCodeToResponseDeserializer.get(statusCode); - if (wildcardCodeDeserializer == null) { - throw new ApiException( - "Invalid response statusCode="+statusCode+" has no response defined in the openapi document", - response - ); - } - if (wildcardCodeDeserializer instanceof WildcardFakewildcardresponsesGetCode1XXResponseDeserializer castDeserializer) { - var deserializedResponse = castDeserializer.deserialize(response, configuration); - throw new FakewildcardresponsesGetCode1XXResponse.ResponseApiException( - "Received error statusCode response from server", - response, - deserializedResponse - ); - } else if (wildcardCodeDeserializer instanceof WildcardFakewildcardresponsesGetCode2XXResponseDeserializer castDeserializer) { - var deserializedResponse = castDeserializer.deserialize(response, configuration); - throw new FakewildcardresponsesGetCode2XXResponse.ResponseApiException( - "Received error statusCode response from server", - response, - deserializedResponse - ); - } else if (wildcardCodeDeserializer instanceof WildcardFakewildcardresponsesGetCode3XXResponseDeserializer castDeserializer) { - var deserializedResponse = castDeserializer.deserialize(response, configuration); - throw new FakewildcardresponsesGetCode3XXResponse.ResponseApiException( - "Received error statusCode response from server", - response, - deserializedResponse - ); - } else if (wildcardCodeDeserializer instanceof WildcardFakewildcardresponsesGetCode4XXResponseDeserializer castDeserializer) { - var deserializedResponse = castDeserializer.deserialize(response, configuration); - throw new FakewildcardresponsesGetCode4XXResponse.ResponseApiException( - "Received error statusCode response from server", - response, - deserializedResponse - ); - } else { - WildcardFakewildcardresponsesGetCode5XXResponseDeserializer castDeserializer = (WildcardFakewildcardresponsesGetCode5XXResponseDeserializer) wildcardCodeDeserializer; - var deserializedResponse = castDeserializer.deserialize(response, configuration); - throw new FakewildcardresponsesGetCode5XXResponse.ResponseApiException( - "Received error statusCode response from server", - response, - deserializedResponse - ); - } - } - } -} diff --git a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/fakewildcardresponses/get/responses/FakewildcardresponsesGetCode1XXResponse.kt b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/fakewildcardresponses/get/responses/FakewildcardresponsesGetCode1XXResponse.kt deleted file mode 100644 index 10f6929b9f5..00000000000 --- a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/fakewildcardresponses/get/responses/FakewildcardresponsesGetCode1XXResponse.kt +++ /dev/null @@ -1,63 +0,0 @@ -package org.openapijsonschematools.client.paths.fakewildcardresponses.get.responses; - -import org.openapijsonschematools.client.configurations.SchemaConfiguration; -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; - -import java.util.AbstractMap; -import java.util.Map; -import java.net.http.HttpResponse; -import java.net.http.HttpHeaders; - -public class FakewildcardresponsesGetCode1XXResponse { - public sealed interface SealedMediaType permits ApplicationjsonMediaType {} - - public record ApplicationjsonMediaType(ApplicationjsonSchema.ApplicationjsonSchema1 schema) implements SealedMediaType, MediaType { - public ApplicationjsonMediaType() { - this(ApplicationjsonSchema.ApplicationjsonSchema1.getInstance()); - } - @Override - public Nothing? encoding() { - return null; - } - } - public sealed interface SealedResponseBody permits ApplicationjsonResponseBody {} - public record ApplicationjsonResponseBody(ApplicationjsonSchema.AnyTypeJsonSchema1Boxed body) implements SealedResponseBody { } - - public static class FakewildcardresponsesGetCode1XXResponse1 extends ResponseDeserializer { - public FakewildcardresponsesGetCode1XXResponse1() { - super( - Map.ofEntries( - new AbstractMap.SimpleEntry<>("application/json", new ApplicationjsonMediaType()) - ) - ); - } - - @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); - } - - @Override - protected Nothing? getHeaders(HttpHeaders headers, SchemaConfiguration configuration) { - return null; - } - } - - @SuppressWarnings("serial") - public static class ResponseApiException extends ApiException { - public DeserializedHttpResponse deserializedResponse; - - public ResponseApiException(String s, HttpResponse response, DeserializedHttpResponse deserializedResponse) { - super(s, response); - this.deserializedResponse = deserializedResponse; - } - } -} diff --git a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/fakewildcardresponses/get/responses/FakewildcardresponsesGetCode200Response.kt b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/fakewildcardresponses/get/responses/FakewildcardresponsesGetCode200Response.kt deleted file mode 100644 index 160aa2aea1d..00000000000 --- a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/fakewildcardresponses/get/responses/FakewildcardresponsesGetCode200Response.kt +++ /dev/null @@ -1,63 +0,0 @@ -package org.openapijsonschematools.client.paths.fakewildcardresponses.get.responses; - -import org.openapijsonschematools.client.configurations.SchemaConfiguration; -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; - -import java.util.AbstractMap; -import java.util.Map; -import java.net.http.HttpResponse; -import java.net.http.HttpHeaders; - -public class FakewildcardresponsesGetCode200Response { - public sealed interface SealedMediaType permits ApplicationjsonMediaType {} - - public record ApplicationjsonMediaType(ApplicationjsonSchema.ApplicationjsonSchema1 schema) implements SealedMediaType, MediaType { - public ApplicationjsonMediaType() { - this(ApplicationjsonSchema.ApplicationjsonSchema1.getInstance()); - } - @Override - public Nothing? encoding() { - return null; - } - } - public sealed interface SealedResponseBody permits ApplicationjsonResponseBody {} - public record ApplicationjsonResponseBody(ApplicationjsonSchema.AnyTypeJsonSchema1Boxed body) implements SealedResponseBody { } - - public static class FakewildcardresponsesGetCode200Response1 extends ResponseDeserializer { - public FakewildcardresponsesGetCode200Response1() { - super( - Map.ofEntries( - new AbstractMap.SimpleEntry<>("application/json", new ApplicationjsonMediaType()) - ) - ); - } - - @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); - } - - @Override - protected Nothing? getHeaders(HttpHeaders headers, SchemaConfiguration configuration) { - return null; - } - } - - @SuppressWarnings("serial") - public static class ResponseApiException extends ApiException { - public DeserializedHttpResponse deserializedResponse; - - public ResponseApiException(String s, HttpResponse response, DeserializedHttpResponse deserializedResponse) { - super(s, response); - this.deserializedResponse = deserializedResponse; - } - } -} diff --git a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/fakewildcardresponses/get/responses/FakewildcardresponsesGetCode2XXResponse.kt b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/fakewildcardresponses/get/responses/FakewildcardresponsesGetCode2XXResponse.kt deleted file mode 100644 index 8e47472d7b3..00000000000 --- a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/fakewildcardresponses/get/responses/FakewildcardresponsesGetCode2XXResponse.kt +++ /dev/null @@ -1,63 +0,0 @@ -package org.openapijsonschematools.client.paths.fakewildcardresponses.get.responses; - -import org.openapijsonschematools.client.configurations.SchemaConfiguration; -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; - -import java.util.AbstractMap; -import java.util.Map; -import java.net.http.HttpResponse; -import java.net.http.HttpHeaders; - -public class FakewildcardresponsesGetCode2XXResponse { - public sealed interface SealedMediaType permits ApplicationjsonMediaType {} - - public record ApplicationjsonMediaType(ApplicationjsonSchema.ApplicationjsonSchema1 schema) implements SealedMediaType, MediaType { - public ApplicationjsonMediaType() { - this(ApplicationjsonSchema.ApplicationjsonSchema1.getInstance()); - } - @Override - public Nothing? encoding() { - return null; - } - } - public sealed interface SealedResponseBody permits ApplicationjsonResponseBody {} - public record ApplicationjsonResponseBody(ApplicationjsonSchema.AnyTypeJsonSchema1Boxed body) implements SealedResponseBody { } - - public static class FakewildcardresponsesGetCode2XXResponse1 extends ResponseDeserializer { - public FakewildcardresponsesGetCode2XXResponse1() { - super( - Map.ofEntries( - new AbstractMap.SimpleEntry<>("application/json", new ApplicationjsonMediaType()) - ) - ); - } - - @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); - } - - @Override - protected Nothing? getHeaders(HttpHeaders headers, SchemaConfiguration configuration) { - return null; - } - } - - @SuppressWarnings("serial") - public static class ResponseApiException extends ApiException { - public DeserializedHttpResponse deserializedResponse; - - public ResponseApiException(String s, HttpResponse response, DeserializedHttpResponse deserializedResponse) { - super(s, response); - this.deserializedResponse = deserializedResponse; - } - } -} diff --git a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/fakewildcardresponses/get/responses/FakewildcardresponsesGetCode3XXResponse.kt b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/fakewildcardresponses/get/responses/FakewildcardresponsesGetCode3XXResponse.kt deleted file mode 100644 index 5264b1dfbd4..00000000000 --- a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/fakewildcardresponses/get/responses/FakewildcardresponsesGetCode3XXResponse.kt +++ /dev/null @@ -1,63 +0,0 @@ -package org.openapijsonschematools.client.paths.fakewildcardresponses.get.responses; - -import org.openapijsonschematools.client.configurations.SchemaConfiguration; -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; - -import java.util.AbstractMap; -import java.util.Map; -import java.net.http.HttpResponse; -import java.net.http.HttpHeaders; - -public class FakewildcardresponsesGetCode3XXResponse { - public sealed interface SealedMediaType permits ApplicationjsonMediaType {} - - public record ApplicationjsonMediaType(ApplicationjsonSchema.ApplicationjsonSchema1 schema) implements SealedMediaType, MediaType { - public ApplicationjsonMediaType() { - this(ApplicationjsonSchema.ApplicationjsonSchema1.getInstance()); - } - @Override - public Nothing? encoding() { - return null; - } - } - public sealed interface SealedResponseBody permits ApplicationjsonResponseBody {} - public record ApplicationjsonResponseBody(ApplicationjsonSchema.AnyTypeJsonSchema1Boxed body) implements SealedResponseBody { } - - public static class FakewildcardresponsesGetCode3XXResponse1 extends ResponseDeserializer { - public FakewildcardresponsesGetCode3XXResponse1() { - super( - Map.ofEntries( - new AbstractMap.SimpleEntry<>("application/json", new ApplicationjsonMediaType()) - ) - ); - } - - @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); - } - - @Override - protected Nothing? getHeaders(HttpHeaders headers, SchemaConfiguration configuration) { - return null; - } - } - - @SuppressWarnings("serial") - public static class ResponseApiException extends ApiException { - public DeserializedHttpResponse deserializedResponse; - - public ResponseApiException(String s, HttpResponse response, DeserializedHttpResponse deserializedResponse) { - super(s, response); - this.deserializedResponse = deserializedResponse; - } - } -} diff --git a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/fakewildcardresponses/get/responses/FakewildcardresponsesGetCode4XXResponse.kt b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/fakewildcardresponses/get/responses/FakewildcardresponsesGetCode4XXResponse.kt deleted file mode 100644 index c0f80c6ebfa..00000000000 --- a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/fakewildcardresponses/get/responses/FakewildcardresponsesGetCode4XXResponse.kt +++ /dev/null @@ -1,63 +0,0 @@ -package org.openapijsonschematools.client.paths.fakewildcardresponses.get.responses; - -import org.openapijsonschematools.client.configurations.SchemaConfiguration; -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; - -import java.util.AbstractMap; -import java.util.Map; -import java.net.http.HttpResponse; -import java.net.http.HttpHeaders; - -public class FakewildcardresponsesGetCode4XXResponse { - public sealed interface SealedMediaType permits ApplicationjsonMediaType {} - - public record ApplicationjsonMediaType(ApplicationjsonSchema.ApplicationjsonSchema1 schema) implements SealedMediaType, MediaType { - public ApplicationjsonMediaType() { - this(ApplicationjsonSchema.ApplicationjsonSchema1.getInstance()); - } - @Override - public Nothing? encoding() { - return null; - } - } - public sealed interface SealedResponseBody permits ApplicationjsonResponseBody {} - public record ApplicationjsonResponseBody(ApplicationjsonSchema.AnyTypeJsonSchema1Boxed body) implements SealedResponseBody { } - - public static class FakewildcardresponsesGetCode4XXResponse1 extends ResponseDeserializer { - public FakewildcardresponsesGetCode4XXResponse1() { - super( - Map.ofEntries( - new AbstractMap.SimpleEntry<>("application/json", new ApplicationjsonMediaType()) - ) - ); - } - - @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); - } - - @Override - protected Nothing? getHeaders(HttpHeaders headers, SchemaConfiguration configuration) { - return null; - } - } - - @SuppressWarnings("serial") - public static class ResponseApiException extends ApiException { - public DeserializedHttpResponse deserializedResponse; - - public ResponseApiException(String s, HttpResponse response, DeserializedHttpResponse deserializedResponse) { - super(s, response); - this.deserializedResponse = deserializedResponse; - } - } -} diff --git a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/fakewildcardresponses/get/responses/FakewildcardresponsesGetCode5XXResponse.kt b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/fakewildcardresponses/get/responses/FakewildcardresponsesGetCode5XXResponse.kt deleted file mode 100644 index 483615c2822..00000000000 --- a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/fakewildcardresponses/get/responses/FakewildcardresponsesGetCode5XXResponse.kt +++ /dev/null @@ -1,63 +0,0 @@ -package org.openapijsonschematools.client.paths.fakewildcardresponses.get.responses; - -import org.openapijsonschematools.client.configurations.SchemaConfiguration; -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; - -import java.util.AbstractMap; -import java.util.Map; -import java.net.http.HttpResponse; -import java.net.http.HttpHeaders; - -public class FakewildcardresponsesGetCode5XXResponse { - public sealed interface SealedMediaType permits ApplicationjsonMediaType {} - - public record ApplicationjsonMediaType(ApplicationjsonSchema.ApplicationjsonSchema1 schema) implements SealedMediaType, MediaType { - public ApplicationjsonMediaType() { - this(ApplicationjsonSchema.ApplicationjsonSchema1.getInstance()); - } - @Override - public Nothing? encoding() { - return null; - } - } - public sealed interface SealedResponseBody permits ApplicationjsonResponseBody {} - public record ApplicationjsonResponseBody(ApplicationjsonSchema.AnyTypeJsonSchema1Boxed body) implements SealedResponseBody { } - - public static class FakewildcardresponsesGetCode5XXResponse1 extends ResponseDeserializer { - public FakewildcardresponsesGetCode5XXResponse1() { - super( - Map.ofEntries( - new AbstractMap.SimpleEntry<>("application/json", new ApplicationjsonMediaType()) - ) - ); - } - - @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); - } - - @Override - protected Nothing? getHeaders(HttpHeaders headers, SchemaConfiguration configuration) { - return null; - } - } - - @SuppressWarnings("serial") - public static class ResponseApiException extends ApiException { - public DeserializedHttpResponse deserializedResponse; - - public ResponseApiException(String s, HttpResponse response, DeserializedHttpResponse deserializedResponse) { - super(s, response); - this.deserializedResponse = deserializedResponse; - } - } -} diff --git a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/fakewildcardresponses/get/responses/code1xxresponse/content/applicationjson/ApplicationjsonSchema.kt b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/fakewildcardresponses/get/responses/code1xxresponse/content/applicationjson/ApplicationjsonSchema.kt deleted file mode 100644 index bc6d5118003..00000000000 --- a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/fakewildcardresponses/get/responses/code1xxresponse/content/applicationjson/ApplicationjsonSchema.kt +++ /dev/null @@ -1,19 +0,0 @@ -package org.openapijsonschematools.client.paths.fakewildcardresponses.get.responses.code1xxresponse.content.applicationjson; -import org.checkerframework.checker.nullness.qual.Nullable; -import org.openapijsonschematools.client.schemas.AnyTypeJsonSchema; - -public class ApplicationjsonSchema extends AnyTypeJsonSchema { - // nest classes so all schemas and input/output classes can be public - - - public static class ApplicationjsonSchema1 extends AnyTypeJsonSchema.AnyTypeJsonSchema1 { - private static @Nullable ApplicationjsonSchema1 instance = null; - public static ApplicationjsonSchema1 getInstance() { - if (instance == null) { - instance = new ApplicationjsonSchema1(); - } - return instance; - } - } - -} diff --git a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/fakewildcardresponses/get/responses/code200response/content/applicationjson/ApplicationjsonSchema.kt b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/fakewildcardresponses/get/responses/code200response/content/applicationjson/ApplicationjsonSchema.kt deleted file mode 100644 index 7e12b7b922a..00000000000 --- a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/fakewildcardresponses/get/responses/code200response/content/applicationjson/ApplicationjsonSchema.kt +++ /dev/null @@ -1,19 +0,0 @@ -package org.openapijsonschematools.client.paths.fakewildcardresponses.get.responses.code200response.content.applicationjson; -import org.checkerframework.checker.nullness.qual.Nullable; -import org.openapijsonschematools.client.schemas.AnyTypeJsonSchema; - -public class ApplicationjsonSchema extends AnyTypeJsonSchema { - // nest classes so all schemas and input/output classes can be public - - - public static class ApplicationjsonSchema1 extends AnyTypeJsonSchema.AnyTypeJsonSchema1 { - private static @Nullable ApplicationjsonSchema1 instance = null; - public static ApplicationjsonSchema1 getInstance() { - if (instance == null) { - instance = new ApplicationjsonSchema1(); - } - return instance; - } - } - -} diff --git a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/fakewildcardresponses/get/responses/code2xxresponse/content/applicationjson/ApplicationjsonSchema.kt b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/fakewildcardresponses/get/responses/code2xxresponse/content/applicationjson/ApplicationjsonSchema.kt deleted file mode 100644 index a5d19b2fa85..00000000000 --- a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/fakewildcardresponses/get/responses/code2xxresponse/content/applicationjson/ApplicationjsonSchema.kt +++ /dev/null @@ -1,19 +0,0 @@ -package org.openapijsonschematools.client.paths.fakewildcardresponses.get.responses.code2xxresponse.content.applicationjson; -import org.checkerframework.checker.nullness.qual.Nullable; -import org.openapijsonschematools.client.schemas.AnyTypeJsonSchema; - -public class ApplicationjsonSchema extends AnyTypeJsonSchema { - // nest classes so all schemas and input/output classes can be public - - - public static class ApplicationjsonSchema1 extends AnyTypeJsonSchema.AnyTypeJsonSchema1 { - private static @Nullable ApplicationjsonSchema1 instance = null; - public static ApplicationjsonSchema1 getInstance() { - if (instance == null) { - instance = new ApplicationjsonSchema1(); - } - return instance; - } - } - -} diff --git a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/fakewildcardresponses/get/responses/code3xxresponse/content/applicationjson/ApplicationjsonSchema.kt b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/fakewildcardresponses/get/responses/code3xxresponse/content/applicationjson/ApplicationjsonSchema.kt deleted file mode 100644 index 3b4a18033e7..00000000000 --- a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/fakewildcardresponses/get/responses/code3xxresponse/content/applicationjson/ApplicationjsonSchema.kt +++ /dev/null @@ -1,19 +0,0 @@ -package org.openapijsonschematools.client.paths.fakewildcardresponses.get.responses.code3xxresponse.content.applicationjson; -import org.checkerframework.checker.nullness.qual.Nullable; -import org.openapijsonschematools.client.schemas.AnyTypeJsonSchema; - -public class ApplicationjsonSchema extends AnyTypeJsonSchema { - // nest classes so all schemas and input/output classes can be public - - - public static class ApplicationjsonSchema1 extends AnyTypeJsonSchema.AnyTypeJsonSchema1 { - private static @Nullable ApplicationjsonSchema1 instance = null; - public static ApplicationjsonSchema1 getInstance() { - if (instance == null) { - instance = new ApplicationjsonSchema1(); - } - return instance; - } - } - -} diff --git a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/fakewildcardresponses/get/responses/code4xxresponse/content/applicationjson/ApplicationjsonSchema.kt b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/fakewildcardresponses/get/responses/code4xxresponse/content/applicationjson/ApplicationjsonSchema.kt deleted file mode 100644 index 346bbf338f9..00000000000 --- a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/fakewildcardresponses/get/responses/code4xxresponse/content/applicationjson/ApplicationjsonSchema.kt +++ /dev/null @@ -1,19 +0,0 @@ -package org.openapijsonschematools.client.paths.fakewildcardresponses.get.responses.code4xxresponse.content.applicationjson; -import org.checkerframework.checker.nullness.qual.Nullable; -import org.openapijsonschematools.client.schemas.AnyTypeJsonSchema; - -public class ApplicationjsonSchema extends AnyTypeJsonSchema { - // nest classes so all schemas and input/output classes can be public - - - public static class ApplicationjsonSchema1 extends AnyTypeJsonSchema.AnyTypeJsonSchema1 { - private static @Nullable ApplicationjsonSchema1 instance = null; - public static ApplicationjsonSchema1 getInstance() { - if (instance == null) { - instance = new ApplicationjsonSchema1(); - } - return instance; - } - } - -} diff --git a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/fakewildcardresponses/get/responses/code5xxresponse/content/applicationjson/ApplicationjsonSchema.kt b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/fakewildcardresponses/get/responses/code5xxresponse/content/applicationjson/ApplicationjsonSchema.kt deleted file mode 100644 index 6b9394e4858..00000000000 --- a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/fakewildcardresponses/get/responses/code5xxresponse/content/applicationjson/ApplicationjsonSchema.kt +++ /dev/null @@ -1,19 +0,0 @@ -package org.openapijsonschematools.client.paths.fakewildcardresponses.get.responses.code5xxresponse.content.applicationjson; -import org.checkerframework.checker.nullness.qual.Nullable; -import org.openapijsonschematools.client.schemas.AnyTypeJsonSchema; - -public class ApplicationjsonSchema extends AnyTypeJsonSchema { - // nest classes so all schemas and input/output classes can be public - - - public static class ApplicationjsonSchema1 extends AnyTypeJsonSchema.AnyTypeJsonSchema1 { - private static @Nullable ApplicationjsonSchema1 instance = null; - public static ApplicationjsonSchema1 getInstance() { - if (instance == null) { - instance = new ApplicationjsonSchema1(); - } - return instance; - } - } - -} diff --git a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/foo/FooGet.kt b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/foo/FooGet.kt deleted file mode 100644 index e5828e4cfe5..00000000000 --- a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/foo/FooGet.kt +++ /dev/null @@ -1,124 +0,0 @@ -package org.openapijsonschematools.client.paths.foo; - -import org.checkerframework.checker.nullness.qual.Nullable; -import org.openapijsonschematools.client.paths.foo.get.FooGetServerInfo; -import org.openapijsonschematools.client.paths.foo.get.FooGetResponses; -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.paths.Foo; - -import java.io.IOException; -import java.net.http.HttpClient; -import java.net.http.HttpRequest; -import java.time.Duration; -import java.util.List; -import java.util.Map; - -public class FooGet { - private static class GetProvider { - private static final String method = "get"; - - public static FooGetResponses.EndpointResponse get( - GetRequest request, - ApiConfiguration apiConfiguration, - SchemaConfiguration schemaConfiguration, - HttpClient client - ) 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 - @Nullable Map queryMap = null; - String host = apiConfiguration.getServer(request.serverIndex).url(); - - String url = host + Foo.path; - var httpRequest = RestClient.getRequest( - url, - method, - bodyPublisher, - headers, - request.timeout - ); - var response = RestClient.getResponse(httpRequest, client); - var responsesDeserializer = new FooGetResponses.FooGetResponses1(); - return responsesDeserializer.deserialize(response, schemaConfiguration); - } - } - - public interface GetOperation { - ApiConfiguration getApiConfiguration(); - SchemaConfiguration getSchemaConfiguration(); - HttpClient getClient(); - default FooGetResponses.EndpointResponse get(GetRequest request) throws IOException, InterruptedException, ValidationException, NotImplementedException, ApiException { - return GetProvider.get(request, getApiConfiguration(), getSchemaConfiguration(), getClient()); - } - } - - public interface FooGetOperation { - ApiConfiguration getApiConfiguration(); - SchemaConfiguration getSchemaConfiguration(); - HttpClient getClient(); - default FooGetResponses.EndpointResponse fooGet(GetRequest request) throws IOException, InterruptedException, ValidationException, NotImplementedException, ApiException { - return GetProvider.get(request, getApiConfiguration(), getSchemaConfiguration(), getClient()); - } - } - - public static class Get extends ApiClient implements GetOperation { - public Get(ApiConfiguration apiConfiguration, SchemaConfiguration schemaConfiguration) { - super(apiConfiguration, schemaConfiguration); - } - } - - public static class GetRequest { - public FooGetServerInfo.@Nullable ServerIndex serverIndex; - public @Nullable Duration timeout; - } - - public interface SetterForServerIndex { - GetRequest getInstance(); - T getBuilderAfterServerIndex(GetRequest instance); - default T serverIndex(FooGetServerInfo.ServerIndex serverIndex) { - var instance = getInstance(); - instance.serverIndex = serverIndex; - return getBuilderAfterServerIndex(instance); - } - } - - public interface SetterForTimeout { - GetRequest getInstance(); - T getBuilderAfterTimeout(GetRequest instance); - default T timeout(Duration timeout) { - var instance = getInstance(); - instance.timeout = timeout; - return getBuilderAfterTimeout(instance); - } - } - - public static class GetRequestBuilder implements SetterForServerIndex, SetterForTimeout { - private final GetRequest instance; - - public GetRequestBuilder() { - this.instance = new GetRequest(); - } - - public GetRequest build() { - return instance; - } - - public GetRequest getInstance() { - return instance; - } - - public GetRequestBuilder getBuilderAfterServerIndex(GetRequest instance) { - return this; - } - - public GetRequestBuilder getBuilderAfterTimeout(GetRequest instance) { - return this; - } - } -} diff --git a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/foo/get/FooGetResponses.kt b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/foo/get/FooGetResponses.kt deleted file mode 100644 index a1de2d65b66..00000000000 --- a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/foo/get/FooGetResponses.kt +++ /dev/null @@ -1,37 +0,0 @@ -package org.openapijsonschematools.client.paths.foo.get; - -import org.openapijsonschematools.client.paths.foo.get.responses.FooGetCodedefaultResponse; -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; -import org.checkerframework.checker.nullness.qual.Nullable; - -import java.net.http.HttpResponse; -import java.util.Map; -import java.util.AbstractMap; - -public class FooGetResponses { - public sealed interface EndpointResponse permits EndpointFooGetCodedefaultResponse {} - - public record EndpointFooGetCodedefaultResponse( - HttpResponse response, - FooGetCodedefaultResponse.SealedResponseBody body, - Nothing? headers - ) implements EndpointResponse, ApiResponse{ - } - - public static final class FooGetResponses1 implements ResponsesDeserializer { - private final FooGetCodedefaultResponse.FooGetCodedefaultResponse1 defaultResponseDeserializer; - public FooGetResponses1() { - this.defaultResponseDeserializer = new FooGetCodedefaultResponse.FooGetCodedefaultResponse1(); - } - - public EndpointResponse deserialize(HttpResponse response, SchemaConfiguration configuration) throws ValidationException, NotImplementedException, ApiException { - var deserializedResponse = defaultResponseDeserializer.deserialize(response, configuration); - return new EndpointFooGetCodedefaultResponse(response, deserializedResponse.body(), deserializedResponse.headers()); - } - } -} diff --git a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/foo/get/FooGetServerInfo.kt b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/foo/get/FooGetServerInfo.kt deleted file mode 100644 index ca1bc261831..00000000000 --- a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/foo/get/FooGetServerInfo.kt +++ /dev/null @@ -1,63 +0,0 @@ -package org.openapijsonschematools.client.paths.foo.get; - -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.Objects; - -public class FooGetServerInfo { - public static class FooGetServerInfo1 implements ServerProvider { - private final FooGetServer0 server0; - private final FooGetServer1 server1; - - FooGetServerInfo1( - @Nullable FooGetServer0 server0, - @Nullable FooGetServer1 server1 - ) { - this.server0 = Objects.requireNonNullElseGet(server0, FooGetServer0::new); - this.server1 = Objects.requireNonNullElseGet(server1, FooGetServer1::new); - } - - @Override - public Server getServer(ServerIndex serverIndex) { - switch (serverIndex) { - case SERVER_0: - return server0; - default: - return server1; - } - } - } - - public static class FooGetServerInfoBuilder { - private @Nullable FooGetServer0 server0; - private @Nullable FooGetServer1 server1; - - public FooGetServerInfoBuilder() {} - - public FooGetServerInfoBuilder fooGetServer0(FooGetServer0 server0) { - this.server0 = server0; - return this; - } - - public FooGetServerInfoBuilder fooGetServer1(FooGetServer1 server1) { - this.server1 = server1; - return this; - } - - public FooGetServerInfo1 build() { - return new FooGetServerInfo1( - server0, - server1 - ); - } - } - - public enum ServerIndex { - SERVER_0, - SERVER_1 - } -} \ No newline at end of file diff --git a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/foo/get/responses/FooGetCodedefaultResponse.kt b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/foo/get/responses/FooGetCodedefaultResponse.kt deleted file mode 100644 index 8ee177ea363..00000000000 --- a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/foo/get/responses/FooGetCodedefaultResponse.kt +++ /dev/null @@ -1,63 +0,0 @@ -package org.openapijsonschematools.client.paths.foo.get.responses; - -import org.openapijsonschematools.client.configurations.SchemaConfiguration; -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; - -import java.util.AbstractMap; -import java.util.Map; -import java.net.http.HttpResponse; -import java.net.http.HttpHeaders; - -public class FooGetCodedefaultResponse { - public sealed interface SealedMediaType permits ApplicationjsonMediaType {} - - public record ApplicationjsonMediaType(ApplicationjsonSchema.ApplicationjsonSchema1 schema) implements SealedMediaType, MediaType { - public ApplicationjsonMediaType() { - this(ApplicationjsonSchema.ApplicationjsonSchema1.getInstance()); - } - @Override - public Nothing? encoding() { - return null; - } - } - public sealed interface SealedResponseBody permits ApplicationjsonResponseBody {} - public record ApplicationjsonResponseBody(ApplicationjsonSchema.ApplicationjsonSchema1Boxed body) implements SealedResponseBody { } - - public static class FooGetCodedefaultResponse1 extends ResponseDeserializer { - public FooGetCodedefaultResponse1() { - super( - Map.ofEntries( - new AbstractMap.SimpleEntry<>("application/json", new ApplicationjsonMediaType()) - ) - ); - } - - @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); - } - - @Override - protected Nothing? getHeaders(HttpHeaders headers, SchemaConfiguration configuration) { - return null; - } - } - - @SuppressWarnings("serial") - public static class ResponseApiException extends ApiException { - public DeserializedHttpResponse deserializedResponse; - - public ResponseApiException(String s, HttpResponse response, DeserializedHttpResponse deserializedResponse) { - super(s, response); - this.deserializedResponse = deserializedResponse; - } - } -} diff --git a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/foo/get/responses/codedefaultresponse/content/applicationjson/ApplicationjsonSchema.kt b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/foo/get/responses/codedefaultresponse/content/applicationjson/ApplicationjsonSchema.kt deleted file mode 100644 index 9867420cf75..00000000000 --- a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/foo/get/responses/codedefaultresponse/content/applicationjson/ApplicationjsonSchema.kt +++ /dev/null @@ -1,179 +0,0 @@ -package org.openapijsonschematools.client.paths.foo.get.responses.codedefaultresponse.content.applicationjson; -import java.util.ArrayList; -import java.util.HashSet; -import java.util.LinkedHashMap; -import java.util.LinkedHashSet; -import java.util.List; -import java.util.Map; -import java.util.Objects; -import java.util.Set; -import org.checkerframework.checker.nullness.qual.Nullable; -import org.openapijsonschematools.client.components.schemas.Foo; -import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags; -import org.openapijsonschematools.client.configurations.SchemaConfiguration; -import org.openapijsonschematools.client.exceptions.InvalidAdditionalPropertyException; -import org.openapijsonschematools.client.exceptions.UnsetPropertyException; -import org.openapijsonschematools.client.exceptions.ValidationException; -import org.openapijsonschematools.client.schemas.GenericBuilder; -import org.openapijsonschematools.client.schemas.UnsetAddPropsSetter; -import org.openapijsonschematools.client.schemas.validation.FrozenMap; -import org.openapijsonschematools.client.schemas.validation.JsonSchema; -import org.openapijsonschematools.client.schemas.validation.JsonSchemaInfo; -import org.openapijsonschematools.client.schemas.validation.MapSchemaValidator; -import org.openapijsonschematools.client.schemas.validation.PathToSchemasMap; -import org.openapijsonschematools.client.schemas.validation.PropertyEntry; -import org.openapijsonschematools.client.schemas.validation.ValidationMetadata; - -public class ApplicationjsonSchema { - // nest classes so all schemas and input/output classes can be public - - - public static class ApplicationjsonSchemaMap extends FrozenMap<@Nullable Object> { - protected ApplicationjsonSchemaMap(FrozenMap<@Nullable Object> m) { - super(m); - } - public static final Set requiredKeys = Set.of(); - public static final Set optionalKeys = Set.of( - "string" - ); - public static ApplicationjsonSchemaMap of(Map arg, SchemaConfiguration configuration) throws ValidationException { - return ApplicationjsonSchema1.getInstance().validate(arg, configuration); - } - - public @Nullable Object getAdditionalProperty(String name) throws UnsetPropertyException, InvalidAdditionalPropertyException { - throwIfKeyKnown(name, requiredKeys, optionalKeys); - throwIfKeyNotPresent(name); - return get(name); - } - } - - public interface SetterForApplicationjsonString { - Map getInstance(); - T getBuilderAfterApplicationjsonString(Map instance); - - default T setString(Map value) { - var instance = getInstance(); - instance.put("string", value); - return getBuilderAfterApplicationjsonString(instance); - } - } - - public static class ApplicationjsonSchemaMapBuilder extends UnsetAddPropsSetter implements GenericBuilder>, SetterForApplicationjsonString { - private final Map instance; - private static final Set knownKeys = Set.of( - "string" - ); - public Set getKnownKeys() { - return knownKeys; - } - public ApplicationjsonSchemaMapBuilder() { - this.instance = new LinkedHashMap<>(); - } - public Map build() { - return instance; - } - public Map getInstance() { - return instance; - } - public ApplicationjsonSchemaMapBuilder getBuilderAfterApplicationjsonString(Map instance) { - return this; - } - public ApplicationjsonSchemaMapBuilder getBuilderAfterAdditionalProperty(Map instance) { - return this; - } - } - - - public sealed interface ApplicationjsonSchema1Boxed permits ApplicationjsonSchema1BoxedMap { - @Nullable Object getData(); - } - - public record ApplicationjsonSchema1BoxedMap(ApplicationjsonSchemaMap data) implements ApplicationjsonSchema1Boxed { - @Override - public @Nullable Object getData() { - return data; - } - } - - - public static class ApplicationjsonSchema1 extends JsonSchema implements MapSchemaValidator { - private static @Nullable ApplicationjsonSchema1 instance = null; - - protected ApplicationjsonSchema1() { - super(new JsonSchemaInfo() - .type(Set.of(Map.class)) - .properties(Map.ofEntries( - new PropertyEntry("string", Foo.Foo1.class) - )) - ); - } - - public static ApplicationjsonSchema1 getInstance() { - if (instance == null) { - instance = new ApplicationjsonSchema1(); - } - return instance; - } - - 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 RuntimeException("Invalid non-string key value"); - } - String propertyName = (String) entryKey; - List propertyPathToItem = new ArrayList<>(pathToItem); - propertyPathToItem.add(propertyName); - Object value = entry.getValue(); - LinkedHashMap, Nothing?> schemas = pathToSchemas.get(propertyPathToItem); - if (schemas == null) { - throw new RuntimeException("Validation result is invalid, schemas must exist for a pathToItem"); - } - JsonSchema propertySchema = schemas.entrySet().iterator().next().getKey(); - @Nullable Object propertyInstance = propertySchema.getNewInstance(value, propertyPathToItem, pathToSchemas); - properties.put(propertyName, propertyInstance); - } - FrozenMap<@Nullable Object> castProperties = new FrozenMap<>(properties); - return new ApplicationjsonSchemaMap(castProperties); - } - - 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); - SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().build())); - ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, new PathToSchemasMap(), new LinkedHashSet<>()); - PathToSchemasMap pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet); - return getNewInstance(castArg, validationMetadata.pathToItem(), pathToSchemasMap); - } - - - @Override - public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws 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"); - } - @Override - public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { - if (arg instanceof Map) { - return getNewInstance((Map) arg, pathToItem, pathToSchemas); - } - 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 { - return new ApplicationjsonSchema1BoxedMap(validate(arg, configuration)); - } - @Override - public ApplicationjsonSchema1Boxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { - 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"); - } - } - -} diff --git a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/foo/get/servers/FooGetServer0.kt b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/foo/get/servers/FooGetServer0.kt deleted file mode 100644 index 1ea6b69b607..00000000000 --- a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/foo/get/servers/FooGetServer0.kt +++ /dev/null @@ -1,9 +0,0 @@ -package org.openapijsonschematools.client.paths.foo.get.servers; - -import org.openapijsonschematools.client.servers.ServerWithoutVariables; - -public class FooGetServer0 extends ServerWithoutVariables { - public FooGetServer0() { - super("https://path-server-test.petstore.local/v2"); - } -} diff --git a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/foo/get/servers/FooGetServer1.kt b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/foo/get/servers/FooGetServer1.kt deleted file mode 100644 index 06657dc917f..00000000000 --- a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/foo/get/servers/FooGetServer1.kt +++ /dev/null @@ -1,35 +0,0 @@ -package org.openapijsonschematools.client.paths.foo.get.servers; - -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.FooGetServer1Variables; - -import java.util.AbstractMap; - -public class FooGetServer1 extends ServerWithVariables { - private static FooGetServer1Variables.VariablesMap getVariables() { - try { - return FooGetServer1Variables.FooGetServer1Variables1.getInstance().validate( - MapUtils.makeMap( - new AbstractMap.SimpleEntry<>("version", FooGetServer1Variables.Version.getInstance().defaultValue()) - ), - new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().build()) - ); - } catch (ValidationException e) { - throw new RuntimeException(e); - } - } - - public FooGetServer1() { - super( - "https://petstore.swagger.io/{version}", - getVariables() - ); - } - public FooGetServer1(FooGetServer1Variables.VariablesMap variables) { - super("https://petstore.swagger.io/{version}", variables); - } -} diff --git a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/foo/get/servers/server1/FooGetServer1Variables.kt b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/foo/get/servers/server1/FooGetServer1Variables.kt deleted file mode 100644 index 25a4f1a4dd2..00000000000 --- a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/foo/get/servers/server1/FooGetServer1Variables.kt +++ /dev/null @@ -1,313 +0,0 @@ -package org.openapijsonschematools.client.paths.foo.get.servers.server1; -import java.util.ArrayList; -import java.util.HashSet; -import java.util.LinkedHashMap; -import java.util.LinkedHashSet; -import java.util.List; -import java.util.Map; -import java.util.Objects; -import java.util.Set; -import org.checkerframework.checker.nullness.qual.Nullable; -import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags; -import org.openapijsonschematools.client.configurations.SchemaConfiguration; -import org.openapijsonschematools.client.exceptions.UnsetPropertyException; -import org.openapijsonschematools.client.exceptions.ValidationException; -import org.openapijsonschematools.client.schemas.AnyTypeJsonSchema; -import org.openapijsonschematools.client.schemas.GenericBuilder; -import org.openapijsonschematools.client.schemas.NotAnyTypeJsonSchema; -import org.openapijsonschematools.client.schemas.SetMaker; -import org.openapijsonschematools.client.schemas.validation.DefaultValueMethod; -import org.openapijsonschematools.client.schemas.validation.FrozenMap; -import org.openapijsonschematools.client.schemas.validation.JsonSchema; -import org.openapijsonschematools.client.schemas.validation.JsonSchemaInfo; -import org.openapijsonschematools.client.schemas.validation.MapSchemaValidator; -import org.openapijsonschematools.client.schemas.validation.MapUtils; -import org.openapijsonschematools.client.schemas.validation.PathToSchemasMap; -import org.openapijsonschematools.client.schemas.validation.PropertyEntry; -import org.openapijsonschematools.client.schemas.validation.StringEnumValidator; -import org.openapijsonschematools.client.schemas.validation.StringSchemaValidator; -import org.openapijsonschematools.client.schemas.validation.StringValueMethod; -import org.openapijsonschematools.client.schemas.validation.ValidationMetadata; - -public class FooGetServer1Variables { - // nest classes so all schemas and input/output classes can be public - - - public static class AdditionalProperties extends NotAnyTypeJsonSchema.NotAnyTypeJsonSchema1 { - // NotAnyTypeSchema - private static @Nullable AdditionalProperties instance = null; - public static AdditionalProperties getInstance() { - if (instance == null) { - instance = new AdditionalProperties(); - } - return instance; - } - } - - public enum StringVersionEnums implements StringValueMethod { - V1("v1"), - V2("v2"); - private final String value; - - StringVersionEnums(String value) { - this.value = value; - } - public String value() { - return this.value; - } - } - - - public sealed interface VersionBoxed permits VersionBoxedString { - @Nullable Object getData(); - } - - public record VersionBoxedString(String data) implements VersionBoxed { - @Override - public @Nullable Object getData() { - return data; - } - } - - - - public static class Version extends JsonSchema implements StringSchemaValidator, StringEnumValidator, DefaultValueMethod { - private static @Nullable Version instance = null; - - protected Version() { - super(new JsonSchemaInfo() - .type(Set.of( - String.class - )) - .enumValues(SetMaker.makeSet( - "v1", - "v2" - )) - .defaultValue("v1") - ); - } - - public static Version getInstance() { - if (instance == null) { - instance = new Version(); - } - return instance; - } - - @Override - public String validate(String arg, SchemaConfiguration configuration) throws ValidationException { - Set> pathSet = new HashSet<>(); - List pathToItem = List.of("args[0"); - String castArg = castToAllowedTypes(arg, pathToItem, pathSet); - SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().build())); - ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, new PathToSchemasMap(), new LinkedHashSet<>()); - getPathToSchemas(this, castArg, validationMetadata, pathSet); - return castArg; - } - - @Override - 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 { - 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"); - } - @Override - public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { - 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"); - } - public String defaultValue() throws ValidationException { - if (defaultValue instanceof String) { - return (String) defaultValue; - } - throw new ValidationException("Invalid type stored in defaultValue"); - } - @Override - 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 { - 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"); - } - } - - public static class VariablesMap extends FrozenMap { - protected VariablesMap(FrozenMap m) { - super(m); - } - public static final Set requiredKeys = Set.of( - "version" - ); - public static final Set optionalKeys = Set.of(); - public static VariablesMap of(Map arg, SchemaConfiguration configuration) throws ValidationException { - return FooGetServer1Variables1.getInstance().validate(arg, configuration); - } - - public String version() { - try { - return getOrThrow("version"); - } catch (UnsetPropertyException e) { - throw new RuntimeException(e); - } - } - } - - public interface SetterForVersion { - Map getInstance(); - T getBuilderAfterVersion(Map instance); - - default T version(String value) { - var instance = getInstance(); - instance.put("version", value); - return getBuilderAfterVersion(instance); - } - - default T version(StringVersionEnums value) { - var instance = getInstance(); - instance.put("version", value.value()); - return getBuilderAfterVersion(instance); - } - } - - public static class VariablesMap0Builder implements GenericBuilder> { - private final Map instance; - private static final Set knownKeys = Set.of( - "version" - ); - public Set getKnownKeys() { - return knownKeys; - } - public VariablesMap0Builder(Map instance) { - this.instance = instance; - } - public Map build() { - return instance; - } - } - - public static class VariablesMapBuilder implements SetterForVersion { - private final Map instance; - public VariablesMapBuilder() { - this.instance = new LinkedHashMap<>(); - } - public Map getInstance() { - return instance; - } - public VariablesMap0Builder getBuilderAfterVersion(Map instance) { - return new VariablesMap0Builder(instance); - } - } - - - public sealed interface FooGetServer1Variables1Boxed permits FooGetServer1Variables1BoxedMap { - @Nullable Object getData(); - } - - public record FooGetServer1Variables1BoxedMap(VariablesMap data) implements FooGetServer1Variables1Boxed { - @Override - public @Nullable Object getData() { - return data; - } - } - - - public static class FooGetServer1Variables1 extends JsonSchema implements MapSchemaValidator { - private static @Nullable FooGetServer1Variables1 instance = null; - - protected FooGetServer1Variables1() { - super(new JsonSchemaInfo() - .type(Set.of(Map.class)) - .properties(Map.ofEntries( - new PropertyEntry("version", Version.class) - )) - .required(Set.of( - "version" - )) - .additionalProperties(AdditionalProperties.class) - ); - } - - public static FooGetServer1Variables1 getInstance() { - if (instance == null) { - instance = new FooGetServer1Variables1(); - } - return instance; - } - - 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 RuntimeException("Invalid non-string key value"); - } - String propertyName = (String) entryKey; - List propertyPathToItem = new ArrayList<>(pathToItem); - propertyPathToItem.add(propertyName); - Object value = entry.getValue(); - LinkedHashMap, Nothing?> schemas = pathToSchemas.get(propertyPathToItem); - if (schemas == null) { - throw new RuntimeException("Validation 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"); - } - properties.put(propertyName, (String) propertyInstance); - } - FrozenMap castProperties = new FrozenMap<>(properties); - return new VariablesMap(castProperties); - } - - 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); - SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().build())); - ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, new PathToSchemasMap(), new LinkedHashSet<>()); - PathToSchemasMap pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet); - return getNewInstance(castArg, validationMetadata.pathToItem(), pathToSchemasMap); - } - - - @Override - public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws 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"); - } - @Override - public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { - if (arg instanceof Map) { - return getNewInstance((Map) arg, pathToItem, pathToSchemas); - } - throw new RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); - } - @Override - public FooGetServer1Variables1BoxedMap validateAndBox(Map arg, SchemaConfiguration configuration) throws ValidationException { - return new FooGetServer1Variables1BoxedMap(validate(arg, configuration)); - } - @Override - public FooGetServer1Variables1Boxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { - 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"); - } - } - -} diff --git a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/pet/PetPost.kt b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/pet/PetPost.kt deleted file mode 100644 index 1f9d0dc8431..00000000000 --- a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/pet/PetPost.kt +++ /dev/null @@ -1,215 +0,0 @@ -package org.openapijsonschematools.client.paths.pet; - -import org.checkerframework.checker.nullness.qual.Nullable; -import org.openapijsonschematools.client.RootServerInfo; -import org.openapijsonschematools.client.paths.pet.post.PetPostSecurityInfo; -import org.openapijsonschematools.client.paths.pet.post.PetPostRequestBody; -import org.openapijsonschematools.client.paths.pet.post.PetPostResponses; -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.requestbody.SerializedRequestBody; -import org.openapijsonschematools.client.paths.Pet; -import org.openapijsonschematools.client.securityrequirementobjects.SecurityRequirementObject; -import org.openapijsonschematools.client.securityrequirementobjects.AuthApplier; - -import java.io.IOException; -import java.util.ArrayList; -import java.net.http.HttpClient; -import java.net.http.HttpRequest; -import java.time.Duration; -import java.util.List; -import java.util.Map; - -public class PetPost { - private static class PostProvider extends AuthApplier { - private static final String method = "post"; - - public static PetPostResponses.EndpointResponse post( - PostRequest request, - ApiConfiguration apiConfiguration, - SchemaConfiguration schemaConfiguration, - HttpClient client - ) throws IOException, InterruptedException, ValidationException, NotImplementedException, ApiException { - Map> headers = apiConfiguration.getDefaultHeaders(); - - SerializedRequestBody serializedRequestBody = new PetPostRequestBody.PetPostRequestBody1().serialize( - request.requestBody - ); - var contentTypeHeaderValues = headers.getOrDefault("Content-Type", new ArrayList<>()); - contentTypeHeaderValues.add(serializedRequestBody.contentType); - HttpRequest.BodyPublisher bodyPublisher = serializedRequestBody.bodyPublisher; - // TODO set this to a map if there is a query security scheme - @Nullable Map queryMap = null; - String host = apiConfiguration.getServer(request.serverIndex).url(); - SecurityRequirementObject securityRequirementObject = apiConfiguration.getSecurityRequirementObject(request.securityIndex); - updateParamsForAuth( - securityRequirementObject, - headers, - Pet.path, - method, - bodyPublisher, - queryMap, - apiConfiguration - ); - - String url = host + Pet.path; - var httpRequest = RestClient.getRequest( - url, - method, - bodyPublisher, - headers, - request.timeout - ); - var response = RestClient.getResponse(httpRequest, client); - var responsesDeserializer = new PetPostResponses.PetPostResponses1(); - return responsesDeserializer.deserialize(response, schemaConfiguration); - } - } - - public interface PostOperation { - ApiConfiguration getApiConfiguration(); - SchemaConfiguration getSchemaConfiguration(); - HttpClient getClient(); - default PetPostResponses.EndpointResponse post(PostRequest request) throws IOException, InterruptedException, ValidationException, NotImplementedException, ApiException { - return PostProvider.post(request, getApiConfiguration(), getSchemaConfiguration(), getClient()); - } - } - - public interface AddPetOperation { - ApiConfiguration getApiConfiguration(); - SchemaConfiguration getSchemaConfiguration(); - HttpClient getClient(); - default PetPostResponses.EndpointResponse addPet(PostRequest request) throws IOException, InterruptedException, ValidationException, NotImplementedException, ApiException { - return PostProvider.post(request, getApiConfiguration(), getSchemaConfiguration(), getClient()); - } - } - - public static class Post extends ApiClient implements PostOperation { - public Post(ApiConfiguration apiConfiguration, SchemaConfiguration schemaConfiguration) { - super(apiConfiguration, schemaConfiguration); - } - } - - public static class PostRequest { - public PetPostRequestBody.SealedRequestBody requestBody; - public RootServerInfo.@Nullable ServerIndex serverIndex; - public PetPostSecurityInfo.@Nullable SecurityIndex securityIndex; - public @Nullable Duration timeout; - - public PostRequest( - PetPostRequestBody.SealedRequestBody requestBody, - RootServerInfo.@Nullable ServerIndex serverIndex, - PetPostSecurityInfo.@Nullable SecurityIndex securityIndex, - @Nullable Duration timeout - ) { - this.requestBody = requestBody; - this.serverIndex = serverIndex; - this.securityIndex = securityIndex; - this.timeout = timeout; - } - } - - public static class PostNullableRequest { - public PetPostRequestBody.@Nullable SealedRequestBody requestBody; - public RootServerInfo.@Nullable ServerIndex serverIndex; - public PetPostSecurityInfo.@Nullable SecurityIndex securityIndex; - public @Nullable Duration timeout; - } - - public interface SetterForServerIndex { - PostNullableRequest getInstance(); - T getBuilderAfterServerIndex(PostNullableRequest instance); - default T serverIndex(RootServerInfo.ServerIndex serverIndex) { - var instance = getInstance(); - instance.serverIndex = serverIndex; - return getBuilderAfterServerIndex(instance); - } - } - - public interface SetterForSecurityIndex { - PostNullableRequest getInstance(); - T getBuilderAfterSecurityIndex(PostNullableRequest instance); - default T securityIndex(PetPostSecurityInfo.SecurityIndex securityIndex) { - var instance = getInstance(); - instance.securityIndex = securityIndex; - return getBuilderAfterSecurityIndex(instance); - } - } - - public interface SetterForTimeout { - PostNullableRequest getInstance(); - T getBuilderAfterTimeout(PostNullableRequest instance); - default T timeout(Duration timeout) { - var instance = getInstance(); - instance.timeout = timeout; - return getBuilderAfterTimeout(instance); - } - } - - public interface SetterForRequestBody { - PostNullableRequest getInstance(); - T getBuilderAfterRequestBody(PostNullableRequest instance); - default T requestBody(PetPostRequestBody.SealedRequestBody requestBody) { - var instance = getInstance(); - instance.requestBody = requestBody; - return getBuilderAfterRequestBody(instance); - } - } - - public static class Post0RequestBuilder implements SetterForServerIndex, SetterForSecurityIndex, SetterForTimeout { - private final PostNullableRequest instance; - - public Post0RequestBuilder(PostNullableRequest instance) { - this.instance = instance; - } - - public PostRequest build() { - var requestBody = instance.requestBody; - if (requestBody == null) { - throw new RuntimeException("invalid null value for required parameter"); - } - return new PostRequest( - requestBody, - instance.serverIndex, - instance.securityIndex, - instance.timeout - ); - } - - public PostNullableRequest getInstance() { - return instance; - } - - public Post0RequestBuilder getBuilderAfterServerIndex(PostNullableRequest instance) { - return this; - } - - public Post0RequestBuilder getBuilderAfterSecurityIndex(PostNullableRequest instance) { - return this; - } - - public Post0RequestBuilder getBuilderAfterTimeout(PostNullableRequest instance) { - return this; - } - } - public static class PostRequestBuilder implements SetterForRequestBody { - private final PostNullableRequest instance; - - public PostRequestBuilder() { - this.instance = new PostNullableRequest(); - } - - public PostNullableRequest getInstance() { - return instance; - } - - public Post0RequestBuilder getBuilderAfterRequestBody(PostNullableRequest instance) { - return new Post0RequestBuilder(instance); - } - } -} diff --git a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/pet/PetPut.kt b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/pet/PetPut.kt deleted file mode 100644 index dcf715f2067..00000000000 --- a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/pet/PetPut.kt +++ /dev/null @@ -1,214 +0,0 @@ -package org.openapijsonschematools.client.paths.pet; - -import org.checkerframework.checker.nullness.qual.Nullable; -import org.openapijsonschematools.client.RootServerInfo; -import org.openapijsonschematools.client.paths.pet.put.PetPutSecurityInfo; -import org.openapijsonschematools.client.paths.pet.put.PetPutRequestBody; -import org.openapijsonschematools.client.paths.pet.put.PetPutResponses; -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.requestbody.SerializedRequestBody; -import org.openapijsonschematools.client.paths.Pet; -import org.openapijsonschematools.client.securityrequirementobjects.SecurityRequirementObject; -import org.openapijsonschematools.client.securityrequirementobjects.AuthApplier; - -import java.io.IOException; -import java.util.ArrayList; -import java.net.http.HttpClient; -import java.net.http.HttpRequest; -import java.time.Duration; -import java.util.List; -import java.util.Map; - -public class PetPut { - private static class PutProvider extends AuthApplier { - private static final String method = "put"; - - public static Nothing? put( - PutRequest request, - ApiConfiguration apiConfiguration, - SchemaConfiguration schemaConfiguration, - HttpClient client - ) throws IOException, InterruptedException, ValidationException, NotImplementedException, ApiException { - Map> headers = apiConfiguration.getDefaultHeaders(); - - SerializedRequestBody serializedRequestBody = new PetPutRequestBody.PetPutRequestBody1().serialize( - request.requestBody - ); - var contentTypeHeaderValues = headers.getOrDefault("Content-Type", new ArrayList<>()); - contentTypeHeaderValues.add(serializedRequestBody.contentType); - HttpRequest.BodyPublisher bodyPublisher = serializedRequestBody.bodyPublisher; - // TODO set this to a map if there is a query security scheme - @Nullable Map queryMap = null; - String host = apiConfiguration.getServer(request.serverIndex).url(); - SecurityRequirementObject securityRequirementObject = apiConfiguration.getSecurityRequirementObject(request.securityIndex); - updateParamsForAuth( - securityRequirementObject, - headers, - Pet.path, - method, - bodyPublisher, - queryMap, - apiConfiguration - ); - - String url = host + Pet.path; - var httpRequest = RestClient.getRequest( - url, - method, - bodyPublisher, - headers, - request.timeout - ); - var response = RestClient.getResponse(httpRequest, client); - return (Nothing?) null; - } - } - - public interface PutOperation { - ApiConfiguration getApiConfiguration(); - SchemaConfiguration getSchemaConfiguration(); - HttpClient getClient(); - default Nothing? put(PutRequest request) throws IOException, InterruptedException, ValidationException, NotImplementedException, ApiException { - return PutProvider.put(request, getApiConfiguration(), getSchemaConfiguration(), getClient()); - } - } - - public interface UpdatePetOperation { - ApiConfiguration getApiConfiguration(); - SchemaConfiguration getSchemaConfiguration(); - HttpClient getClient(); - default Nothing? updatePet(PutRequest request) throws IOException, InterruptedException, ValidationException, NotImplementedException, ApiException { - return PutProvider.put(request, getApiConfiguration(), getSchemaConfiguration(), getClient()); - } - } - - public static class Put extends ApiClient implements PutOperation { - public Put(ApiConfiguration apiConfiguration, SchemaConfiguration schemaConfiguration) { - super(apiConfiguration, schemaConfiguration); - } - } - - public static class PutRequest { - public PetPutRequestBody.SealedRequestBody requestBody; - public RootServerInfo.@Nullable ServerIndex serverIndex; - public PetPutSecurityInfo.@Nullable SecurityIndex securityIndex; - public @Nullable Duration timeout; - - public PutRequest( - PetPutRequestBody.SealedRequestBody requestBody, - RootServerInfo.@Nullable ServerIndex serverIndex, - PetPutSecurityInfo.@Nullable SecurityIndex securityIndex, - @Nullable Duration timeout - ) { - this.requestBody = requestBody; - this.serverIndex = serverIndex; - this.securityIndex = securityIndex; - this.timeout = timeout; - } - } - - public static class PutNullableRequest { - public PetPutRequestBody.@Nullable SealedRequestBody requestBody; - public RootServerInfo.@Nullable ServerIndex serverIndex; - public PetPutSecurityInfo.@Nullable SecurityIndex securityIndex; - public @Nullable Duration timeout; - } - - public interface SetterForServerIndex { - PutNullableRequest getInstance(); - T getBuilderAfterServerIndex(PutNullableRequest instance); - default T serverIndex(RootServerInfo.ServerIndex serverIndex) { - var instance = getInstance(); - instance.serverIndex = serverIndex; - return getBuilderAfterServerIndex(instance); - } - } - - public interface SetterForSecurityIndex { - PutNullableRequest getInstance(); - T getBuilderAfterSecurityIndex(PutNullableRequest instance); - default T securityIndex(PetPutSecurityInfo.SecurityIndex securityIndex) { - var instance = getInstance(); - instance.securityIndex = securityIndex; - return getBuilderAfterSecurityIndex(instance); - } - } - - public interface SetterForTimeout { - PutNullableRequest getInstance(); - T getBuilderAfterTimeout(PutNullableRequest instance); - default T timeout(Duration timeout) { - var instance = getInstance(); - instance.timeout = timeout; - return getBuilderAfterTimeout(instance); - } - } - - public interface SetterForRequestBody { - PutNullableRequest getInstance(); - T getBuilderAfterRequestBody(PutNullableRequest instance); - default T requestBody(PetPutRequestBody.SealedRequestBody requestBody) { - var instance = getInstance(); - instance.requestBody = requestBody; - return getBuilderAfterRequestBody(instance); - } - } - - public static class Put0RequestBuilder implements SetterForServerIndex, SetterForSecurityIndex, SetterForTimeout { - private final PutNullableRequest instance; - - public Put0RequestBuilder(PutNullableRequest instance) { - this.instance = instance; - } - - public PutRequest build() { - var requestBody = instance.requestBody; - if (requestBody == null) { - throw new RuntimeException("invalid null value for required parameter"); - } - return new PutRequest( - requestBody, - instance.serverIndex, - instance.securityIndex, - instance.timeout - ); - } - - public PutNullableRequest getInstance() { - return instance; - } - - public Put0RequestBuilder getBuilderAfterServerIndex(PutNullableRequest instance) { - return this; - } - - public Put0RequestBuilder getBuilderAfterSecurityIndex(PutNullableRequest instance) { - return this; - } - - public Put0RequestBuilder getBuilderAfterTimeout(PutNullableRequest instance) { - return this; - } - } - public static class PutRequestBuilder implements SetterForRequestBody { - private final PutNullableRequest instance; - - public PutRequestBuilder() { - this.instance = new PutNullableRequest(); - } - - public PutNullableRequest getInstance() { - return instance; - } - - public Put0RequestBuilder getBuilderAfterRequestBody(PutNullableRequest instance) { - return new Put0RequestBuilder(instance); - } - } -} diff --git a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/pet/post/PetPostRequestBody.kt b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/pet/post/PetPostRequestBody.kt deleted file mode 100644 index f2304ccf791..00000000000 --- a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/pet/post/PetPostRequestBody.kt +++ /dev/null @@ -1,7 +0,0 @@ -package org.openapijsonschematools.client.paths.pet.post; - -import org.openapijsonschematools.client.components.requestbodies.Pet; - -public class PetPostRequestBody extends Pet { - public static class PetPostRequestBody1 extends Pet1 {} -} diff --git a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/pet/post/PetPostResponses.kt b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/pet/post/PetPostResponses.kt deleted file mode 100644 index c7a1bc85d00..00000000000 --- a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/pet/post/PetPostResponses.kt +++ /dev/null @@ -1,66 +0,0 @@ -package org.openapijsonschematools.client.paths.pet.post; - -import org.openapijsonschematools.client.paths.pet.post.responses.PetPostCode200Response; -import org.openapijsonschematools.client.paths.pet.post.responses.PetPostCode405Response; -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; -import org.checkerframework.checker.nullness.qual.Nullable; - -import java.net.http.HttpResponse; -import java.util.Map; -import java.util.AbstractMap; - -public class PetPostResponses { - public sealed interface EndpointResponse permits EndpointPetPostCode200Response {} - - public record EndpointPetPostCode200Response( - HttpResponse response, - Nothing? body, - Nothing? headers - ) implements EndpointResponse, ApiResponse{ - } - - public sealed interface StatusCodeResponseDeserializer permits StatusPetPostCode200ResponseDeserializer, StatusPetPostCode405ResponseDeserializer {} - - public static final class StatusPetPostCode200ResponseDeserializer extends PetPostCode200Response.PetPostCode200Response1 implements StatusCodeResponseDeserializer { - } - public static final class StatusPetPostCode405ResponseDeserializer extends PetPostCode405Response.PetPostCode405Response1 implements StatusCodeResponseDeserializer { - } - - public static final class PetPostResponses1 implements ResponsesDeserializer { - private final Map statusCodeToResponseDeserializer; - public PetPostResponses1() { - this.statusCodeToResponseDeserializer = Map.ofEntries( - new AbstractMap.SimpleEntry<>("200", new StatusPetPostCode200ResponseDeserializer()), - new AbstractMap.SimpleEntry<>("405", new StatusPetPostCode405ResponseDeserializer()) - ); - } - - 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) { - throw new ApiException( - "Invalid response statusCode="+statusCode+" has no response defined in the openapi document", - response - ); - } - if (statusCodeDeserializer instanceof StatusPetPostCode200ResponseDeserializer castDeserializer) { - var deserializedResponse = castDeserializer.deserialize(response, configuration); - return new EndpointPetPostCode200Response(response, deserializedResponse.body(), deserializedResponse.headers()); - } else { - StatusPetPostCode405ResponseDeserializer castDeserializer = (StatusPetPostCode405ResponseDeserializer) statusCodeDeserializer; - var deserializedResponse = castDeserializer.deserialize(response, configuration); - throw new PetPostCode405Response.ResponseApiException( - "Received error statusCode response from server", - response, - deserializedResponse - ); - } - } - } -} diff --git a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/pet/post/PetPostSecurityInfo.kt b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/pet/post/PetPostSecurityInfo.kt deleted file mode 100644 index 91df6b3f3e8..00000000000 --- a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/pet/post/PetPostSecurityInfo.kt +++ /dev/null @@ -1,39 +0,0 @@ -package org.openapijsonschematools.client.paths.pet.post; - -import org.openapijsonschematools.client.paths.pet.post.security.PetPostSecurityRequirementObject0; -import org.openapijsonschematools.client.paths.pet.post.security.PetPostSecurityRequirementObject1; -import org.openapijsonschematools.client.paths.pet.post.security.PetPostSecurityRequirementObject2; -import org.openapijsonschematools.client.securityrequirementobjects.SecurityRequirementObject; -import org.openapijsonschematools.client.securityrequirementobjects.SecurityRequirementObjectProvider; - -public class PetPostSecurityInfo { - public static class PetPostSecurityInfo1 implements SecurityRequirementObjectProvider { - public final PetPostSecurityRequirementObject0 security0; - public final PetPostSecurityRequirementObject1 security1; - public final PetPostSecurityRequirementObject2 security2; - - public PetPostSecurityInfo1() { - security0 = new PetPostSecurityRequirementObject0(); - security1 = new PetPostSecurityRequirementObject1(); - security2 = new PetPostSecurityRequirementObject2(); - } - - @Override - public SecurityRequirementObject getSecurityRequirementObject(SecurityIndex securityIndex) { - switch (securityIndex) { - case SECURITY_0: - return security0; - case SECURITY_1: - return security1; - default: - return security2; - } - } - } - - public enum SecurityIndex { - SECURITY_0, - SECURITY_1, - SECURITY_2 - } -} \ No newline at end of file diff --git a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/pet/post/responses/PetPostCode200Response.kt b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/pet/post/responses/PetPostCode200Response.kt deleted file mode 100644 index d32f61af7bc..00000000000 --- a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/pet/post/responses/PetPostCode200Response.kt +++ /dev/null @@ -1,7 +0,0 @@ -package org.openapijsonschematools.client.paths.pet.post.responses; - -import org.openapijsonschematools.client.components.responses.SuccessDescriptionOnly; - -public class PetPostCode200Response extends SuccessDescriptionOnly { - public static class PetPostCode200Response1 extends SuccessDescriptionOnly1 {} -} diff --git a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/pet/post/responses/PetPostCode405Response.kt b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/pet/post/responses/PetPostCode405Response.kt deleted file mode 100644 index 67823c333ef..00000000000 --- a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/pet/post/responses/PetPostCode405Response.kt +++ /dev/null @@ -1,45 +0,0 @@ -package org.openapijsonschematools.client.paths.pet.post.responses; - -import org.openapijsonschematools.client.configurations.SchemaConfiguration; -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; -import java.net.http.HttpResponse; -import java.net.http.HttpHeaders; - -public class PetPostCode405Response { - - public static class PetPostCode405Response1 extends ResponseDeserializer { - public PetPostCode405Response1() { - super( - MapUtils.makeMap( - ) - ); - } - - @Override - protected Nothing? getBody(String contentType, Nothing? mediaType, byte[] body, SchemaConfiguration configuration) { - return null; - } - - @Override - protected Nothing? getHeaders(HttpHeaders headers, SchemaConfiguration configuration) { - return null; - } - } - - @SuppressWarnings("serial") - public static class ResponseApiException extends ApiException { - public DeserializedHttpResponse deserializedResponse; - - public ResponseApiException(String s, HttpResponse response, DeserializedHttpResponse deserializedResponse) { - super(s, response); - this.deserializedResponse = deserializedResponse; - } - } -} diff --git a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/pet/post/security/PetPostSecurityRequirementObject0.kt b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/pet/post/security/PetPostSecurityRequirementObject0.kt deleted file mode 100644 index b1e63c8cdde..00000000000 --- a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/pet/post/security/PetPostSecurityRequirementObject0.kt +++ /dev/null @@ -1,24 +0,0 @@ -package org.openapijsonschematools.client.paths.pet.post.security; - -import org.checkerframework.checker.nullness.qual.Nullable; -import org.openapijsonschematools.client.securityrequirementobjects.SecurityRequirementObject; -import org.openapijsonschematools.client.securityschemes.SecurityScheme; -import org.openapijsonschematools.client.components.securityschemes.ApiKey; - -import java.util.List; -import java.util.Map; -import java.util.AbstractMap; - -public class PetPostSecurityRequirementObject0 extends SecurityRequirementObject { - - public PetPostSecurityRequirementObject0() { - super( - Map.ofEntries( - new AbstractMap.SimpleEntry, List>( - ApiKey.class, - List.of() - ) - ) - ); - } -} diff --git a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/pet/post/security/PetPostSecurityRequirementObject1.kt b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/pet/post/security/PetPostSecurityRequirementObject1.kt deleted file mode 100644 index 3d9d95fe223..00000000000 --- a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/pet/post/security/PetPostSecurityRequirementObject1.kt +++ /dev/null @@ -1,24 +0,0 @@ -package org.openapijsonschematools.client.paths.pet.post.security; - -import org.checkerframework.checker.nullness.qual.Nullable; -import org.openapijsonschematools.client.securityrequirementobjects.SecurityRequirementObject; -import org.openapijsonschematools.client.securityschemes.SecurityScheme; -import org.openapijsonschematools.client.components.securityschemes.HttpSignatureTest; - -import java.util.List; -import java.util.Map; -import java.util.AbstractMap; - -public class PetPostSecurityRequirementObject1 extends SecurityRequirementObject { - - public PetPostSecurityRequirementObject1() { - super( - Map.ofEntries( - new AbstractMap.SimpleEntry, List>( - HttpSignatureTest.class, - List.of() - ) - ) - ); - } -} diff --git a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/pet/post/security/PetPostSecurityRequirementObject2.kt b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/pet/post/security/PetPostSecurityRequirementObject2.kt deleted file mode 100644 index 81ac4bb60b1..00000000000 --- a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/pet/post/security/PetPostSecurityRequirementObject2.kt +++ /dev/null @@ -1,24 +0,0 @@ -package org.openapijsonschematools.client.paths.pet.post.security; - -import org.checkerframework.checker.nullness.qual.Nullable; -import org.openapijsonschematools.client.securityrequirementobjects.SecurityRequirementObject; -import org.openapijsonschematools.client.securityschemes.SecurityScheme; -import org.openapijsonschematools.client.components.securityschemes.PetstoreAuth; - -import java.util.List; -import java.util.Map; -import java.util.AbstractMap; - -public class PetPostSecurityRequirementObject2 extends SecurityRequirementObject { - - public PetPostSecurityRequirementObject2() { - super( - Map.ofEntries( - new AbstractMap.SimpleEntry, List>( - PetstoreAuth.class, - List.of("write:pets", "read:pets") - ) - ) - ); - } -} diff --git a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/pet/put/PetPutRequestBody.kt b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/pet/put/PetPutRequestBody.kt deleted file mode 100644 index 4faecd10dc9..00000000000 --- a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/pet/put/PetPutRequestBody.kt +++ /dev/null @@ -1,7 +0,0 @@ -package org.openapijsonschematools.client.paths.pet.put; - -import org.openapijsonschematools.client.components.requestbodies.Pet; - -public class PetPutRequestBody extends Pet { - public static class PetPutRequestBody1 extends Pet1 {} -} diff --git a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/pet/put/PetPutResponses.kt b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/pet/put/PetPutResponses.kt deleted file mode 100644 index 32e8a7c200c..00000000000 --- a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/pet/put/PetPutResponses.kt +++ /dev/null @@ -1,72 +0,0 @@ -package org.openapijsonschematools.client.paths.pet.put; - -import org.openapijsonschematools.client.paths.pet.put.responses.PetPutCode400Response; -import org.openapijsonschematools.client.paths.pet.put.responses.PetPutCode404Response; -import org.openapijsonschematools.client.paths.pet.put.responses.PetPutCode405Response; -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; - -import java.net.http.HttpResponse; -import java.util.Map; -import java.util.AbstractMap; - -public class PetPutResponses { - - public sealed interface StatusCodeResponseDeserializer permits StatusPetPutCode400ResponseDeserializer, StatusPetPutCode404ResponseDeserializer, StatusPetPutCode405ResponseDeserializer {} - - public static final class StatusPetPutCode400ResponseDeserializer extends PetPutCode400Response.PetPutCode400Response1 implements StatusCodeResponseDeserializer { - } - public static final class StatusPetPutCode404ResponseDeserializer extends PetPutCode404Response.PetPutCode404Response1 implements StatusCodeResponseDeserializer { - } - public static final class StatusPetPutCode405ResponseDeserializer extends PetPutCode405Response.PetPutCode405Response1 implements StatusCodeResponseDeserializer { - } - - public static final class PetPutResponses1 implements ResponsesDeserializer { - private final Map statusCodeToResponseDeserializer; - public PetPutResponses1() { - this.statusCodeToResponseDeserializer = Map.ofEntries( - new AbstractMap.SimpleEntry<>("400", new StatusPetPutCode400ResponseDeserializer()), - new AbstractMap.SimpleEntry<>("404", new StatusPetPutCode404ResponseDeserializer()), - new AbstractMap.SimpleEntry<>("405", new StatusPetPutCode405ResponseDeserializer()) - ); - } - - public Nothing? deserialize(HttpResponse response, SchemaConfiguration configuration) throws ValidationException, NotImplementedException, ApiException { - String statusCode = String.valueOf(response.statusCode()); - @Nullable StatusCodeResponseDeserializer statusCodeDeserializer = statusCodeToResponseDeserializer.get(statusCode); - if (statusCodeDeserializer == null) { - throw new ApiException( - "Invalid response statusCode="+statusCode+" has no response defined in the openapi document", - response - ); - } - if (statusCodeDeserializer instanceof StatusPetPutCode400ResponseDeserializer castDeserializer) { - var deserializedResponse = castDeserializer.deserialize(response, configuration); - throw new PetPutCode400Response.ResponseApiException( - "Received error statusCode response from server", - response, - deserializedResponse - ); - } else if (statusCodeDeserializer instanceof StatusPetPutCode404ResponseDeserializer castDeserializer) { - var deserializedResponse = castDeserializer.deserialize(response, configuration); - throw new PetPutCode404Response.ResponseApiException( - "Received error statusCode response from server", - response, - deserializedResponse - ); - } else { - StatusPetPutCode405ResponseDeserializer castDeserializer = (StatusPetPutCode405ResponseDeserializer) statusCodeDeserializer; - var deserializedResponse = castDeserializer.deserialize(response, configuration); - throw new PetPutCode405Response.ResponseApiException( - "Received error statusCode response from server", - response, - deserializedResponse - ); - } - } - } -} diff --git a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/pet/put/PetPutSecurityInfo.kt b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/pet/put/PetPutSecurityInfo.kt deleted file mode 100644 index 35d27e66846..00000000000 --- a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/pet/put/PetPutSecurityInfo.kt +++ /dev/null @@ -1,33 +0,0 @@ -package org.openapijsonschematools.client.paths.pet.put; - -import org.openapijsonschematools.client.paths.pet.put.security.PetPutSecurityRequirementObject0; -import org.openapijsonschematools.client.paths.pet.put.security.PetPutSecurityRequirementObject1; -import org.openapijsonschematools.client.securityrequirementobjects.SecurityRequirementObject; -import org.openapijsonschematools.client.securityrequirementobjects.SecurityRequirementObjectProvider; - -public class PetPutSecurityInfo { - public static class PetPutSecurityInfo1 implements SecurityRequirementObjectProvider { - public final PetPutSecurityRequirementObject0 security0; - public final PetPutSecurityRequirementObject1 security1; - - public PetPutSecurityInfo1() { - security0 = new PetPutSecurityRequirementObject0(); - security1 = new PetPutSecurityRequirementObject1(); - } - - @Override - public SecurityRequirementObject getSecurityRequirementObject(SecurityIndex securityIndex) { - switch (securityIndex) { - case SECURITY_0: - return security0; - default: - return security1; - } - } - } - - public enum SecurityIndex { - SECURITY_0, - SECURITY_1 - } -} \ No newline at end of file diff --git a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/pet/put/responses/PetPutCode400Response.kt b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/pet/put/responses/PetPutCode400Response.kt deleted file mode 100644 index 0d555ebc3c6..00000000000 --- a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/pet/put/responses/PetPutCode400Response.kt +++ /dev/null @@ -1,45 +0,0 @@ -package org.openapijsonschematools.client.paths.pet.put.responses; - -import org.openapijsonschematools.client.configurations.SchemaConfiguration; -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; -import java.net.http.HttpResponse; -import java.net.http.HttpHeaders; - -public class PetPutCode400Response { - - public static class PetPutCode400Response1 extends ResponseDeserializer { - public PetPutCode400Response1() { - super( - MapUtils.makeMap( - ) - ); - } - - @Override - protected Nothing? getBody(String contentType, Nothing? mediaType, byte[] body, SchemaConfiguration configuration) { - return null; - } - - @Override - protected Nothing? getHeaders(HttpHeaders headers, SchemaConfiguration configuration) { - return null; - } - } - - @SuppressWarnings("serial") - public static class ResponseApiException extends ApiException { - public DeserializedHttpResponse deserializedResponse; - - public ResponseApiException(String s, HttpResponse response, DeserializedHttpResponse deserializedResponse) { - super(s, response); - this.deserializedResponse = deserializedResponse; - } - } -} diff --git a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/pet/put/responses/PetPutCode404Response.kt b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/pet/put/responses/PetPutCode404Response.kt deleted file mode 100644 index b55109a4bb1..00000000000 --- a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/pet/put/responses/PetPutCode404Response.kt +++ /dev/null @@ -1,45 +0,0 @@ -package org.openapijsonschematools.client.paths.pet.put.responses; - -import org.openapijsonschematools.client.configurations.SchemaConfiguration; -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; -import java.net.http.HttpResponse; -import java.net.http.HttpHeaders; - -public class PetPutCode404Response { - - public static class PetPutCode404Response1 extends ResponseDeserializer { - public PetPutCode404Response1() { - super( - MapUtils.makeMap( - ) - ); - } - - @Override - protected Nothing? getBody(String contentType, Nothing? mediaType, byte[] body, SchemaConfiguration configuration) { - return null; - } - - @Override - protected Nothing? getHeaders(HttpHeaders headers, SchemaConfiguration configuration) { - return null; - } - } - - @SuppressWarnings("serial") - public static class ResponseApiException extends ApiException { - public DeserializedHttpResponse deserializedResponse; - - public ResponseApiException(String s, HttpResponse response, DeserializedHttpResponse deserializedResponse) { - super(s, response); - this.deserializedResponse = deserializedResponse; - } - } -} diff --git a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/pet/put/responses/PetPutCode405Response.kt b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/pet/put/responses/PetPutCode405Response.kt deleted file mode 100644 index 09f2946c097..00000000000 --- a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/pet/put/responses/PetPutCode405Response.kt +++ /dev/null @@ -1,45 +0,0 @@ -package org.openapijsonschematools.client.paths.pet.put.responses; - -import org.openapijsonschematools.client.configurations.SchemaConfiguration; -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; -import java.net.http.HttpResponse; -import java.net.http.HttpHeaders; - -public class PetPutCode405Response { - - public static class PetPutCode405Response1 extends ResponseDeserializer { - public PetPutCode405Response1() { - super( - MapUtils.makeMap( - ) - ); - } - - @Override - protected Nothing? getBody(String contentType, Nothing? mediaType, byte[] body, SchemaConfiguration configuration) { - return null; - } - - @Override - protected Nothing? getHeaders(HttpHeaders headers, SchemaConfiguration configuration) { - return null; - } - } - - @SuppressWarnings("serial") - public static class ResponseApiException extends ApiException { - public DeserializedHttpResponse deserializedResponse; - - public ResponseApiException(String s, HttpResponse response, DeserializedHttpResponse deserializedResponse) { - super(s, response); - this.deserializedResponse = deserializedResponse; - } - } -} diff --git a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/pet/put/security/PetPutSecurityRequirementObject0.kt b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/pet/put/security/PetPutSecurityRequirementObject0.kt deleted file mode 100644 index e1e15505dca..00000000000 --- a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/pet/put/security/PetPutSecurityRequirementObject0.kt +++ /dev/null @@ -1,24 +0,0 @@ -package org.openapijsonschematools.client.paths.pet.put.security; - -import org.checkerframework.checker.nullness.qual.Nullable; -import org.openapijsonschematools.client.securityrequirementobjects.SecurityRequirementObject; -import org.openapijsonschematools.client.securityschemes.SecurityScheme; -import org.openapijsonschematools.client.components.securityschemes.HttpSignatureTest; - -import java.util.List; -import java.util.Map; -import java.util.AbstractMap; - -public class PetPutSecurityRequirementObject0 extends SecurityRequirementObject { - - public PetPutSecurityRequirementObject0() { - super( - Map.ofEntries( - new AbstractMap.SimpleEntry, List>( - HttpSignatureTest.class, - List.of() - ) - ) - ); - } -} diff --git a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/pet/put/security/PetPutSecurityRequirementObject1.kt b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/pet/put/security/PetPutSecurityRequirementObject1.kt deleted file mode 100644 index e2264fa535c..00000000000 --- a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/pet/put/security/PetPutSecurityRequirementObject1.kt +++ /dev/null @@ -1,24 +0,0 @@ -package org.openapijsonschematools.client.paths.pet.put.security; - -import org.checkerframework.checker.nullness.qual.Nullable; -import org.openapijsonschematools.client.securityrequirementobjects.SecurityRequirementObject; -import org.openapijsonschematools.client.securityschemes.SecurityScheme; -import org.openapijsonschematools.client.components.securityschemes.PetstoreAuth; - -import java.util.List; -import java.util.Map; -import java.util.AbstractMap; - -public class PetPutSecurityRequirementObject1 extends SecurityRequirementObject { - - public PetPutSecurityRequirementObject1() { - super( - Map.ofEntries( - new AbstractMap.SimpleEntry, List>( - PetstoreAuth.class, - List.of("write:pets", "read:pets") - ) - ) - ); - } -} diff --git a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/petfindbystatus/PetfindbystatusGet.kt b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/petfindbystatus/PetfindbystatusGet.kt deleted file mode 100644 index d4b8b02fa41..00000000000 --- a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/petfindbystatus/PetfindbystatusGet.kt +++ /dev/null @@ -1,212 +0,0 @@ -package org.openapijsonschematools.client.paths.petfindbystatus; - -import org.checkerframework.checker.nullness.qual.Nullable; -import org.openapijsonschematools.client.paths.petfindbystatus.PetfindbystatusServerInfo; -import org.openapijsonschematools.client.paths.petfindbystatus.get.PetfindbystatusGetSecurityInfo; -import org.openapijsonschematools.client.paths.petfindbystatus.get.PetfindbystatusGetQueryParameters; -import org.openapijsonschematools.client.paths.petfindbystatus.get.Parameters; -import org.openapijsonschematools.client.paths.petfindbystatus.get.PetfindbystatusGetResponses; -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.paths.Petfindbystatus; -import org.openapijsonschematools.client.securityrequirementobjects.SecurityRequirementObject; -import org.openapijsonschematools.client.securityrequirementobjects.AuthApplier; - -import java.io.IOException; -import java.net.http.HttpClient; -import java.net.http.HttpRequest; -import java.time.Duration; -import java.util.List; -import java.util.Map; - -public class PetfindbystatusGet { - private static class GetProvider extends AuthApplier { - private static final String method = "get"; - - public static PetfindbystatusGetResponses.EndpointResponse get( - GetRequest request, - ApiConfiguration apiConfiguration, - SchemaConfiguration schemaConfiguration, - HttpClient client - ) throws IOException, InterruptedException, ValidationException, NotImplementedException, ApiException { - Map> headers = apiConfiguration.getDefaultHeaders(); - HttpRequest.BodyPublisher bodyPublisher = HttpRequest.BodyPublishers.noBody(); - - var querySerializer = new Parameters.QueryParametersSerializer(); - @Nullable Map queryMap = querySerializer.getQueryMap(request.queryParameters); - String host = apiConfiguration.getServer(request.serverIndex).url(); - SecurityRequirementObject securityRequirementObject = apiConfiguration.getSecurityRequirementObject(request.securityIndex); - updateParamsForAuth( - securityRequirementObject, - headers, - Petfindbystatus.path, - method, - bodyPublisher, - queryMap, - apiConfiguration - ); - - String url = host + Petfindbystatus.path; - if (queryMap != null) { - url = url + querySerializer.serialize(queryMap); - } - var httpRequest = RestClient.getRequest( - url, - method, - bodyPublisher, - headers, - request.timeout - ); - var response = RestClient.getResponse(httpRequest, client); - var responsesDeserializer = new PetfindbystatusGetResponses.PetfindbystatusGetResponses1(); - return responsesDeserializer.deserialize(response, schemaConfiguration); - } - } - - public interface GetOperation { - ApiConfiguration getApiConfiguration(); - SchemaConfiguration getSchemaConfiguration(); - HttpClient getClient(); - default PetfindbystatusGetResponses.EndpointResponse get(GetRequest request) throws IOException, InterruptedException, ValidationException, NotImplementedException, ApiException { - return GetProvider.get(request, getApiConfiguration(), getSchemaConfiguration(), getClient()); - } - } - - public interface FindPetsByStatusOperation { - ApiConfiguration getApiConfiguration(); - SchemaConfiguration getSchemaConfiguration(); - HttpClient getClient(); - default PetfindbystatusGetResponses.EndpointResponse findPetsByStatus(GetRequest request) throws IOException, InterruptedException, ValidationException, NotImplementedException, ApiException { - return GetProvider.get(request, getApiConfiguration(), getSchemaConfiguration(), getClient()); - } - } - - public static class Get extends ApiClient implements GetOperation { - public Get(ApiConfiguration apiConfiguration, SchemaConfiguration schemaConfiguration) { - super(apiConfiguration, schemaConfiguration); - } - } - - public static class GetRequest { - public PetfindbystatusGetQueryParameters.QueryParametersMap queryParameters; - public PetfindbystatusServerInfo.@Nullable ServerIndex serverIndex; - public PetfindbystatusGetSecurityInfo.@Nullable SecurityIndex securityIndex; - public @Nullable Duration timeout; - - public GetRequest( - PetfindbystatusGetQueryParameters.QueryParametersMap queryParameters, - PetfindbystatusServerInfo.@Nullable ServerIndex serverIndex, - PetfindbystatusGetSecurityInfo.@Nullable SecurityIndex securityIndex, - @Nullable Duration timeout - ) { - this.queryParameters = queryParameters; - this.serverIndex = serverIndex; - this.securityIndex = securityIndex; - this.timeout = timeout; - } - } - - public static class GetNullableRequest { - public PetfindbystatusGetQueryParameters.@Nullable QueryParametersMap queryParameters; - public PetfindbystatusServerInfo.@Nullable ServerIndex serverIndex; - public PetfindbystatusGetSecurityInfo.@Nullable SecurityIndex securityIndex; - public @Nullable Duration timeout; - } - - public interface SetterForServerIndex { - GetNullableRequest getInstance(); - T getBuilderAfterServerIndex(GetNullableRequest instance); - default T serverIndex(PetfindbystatusServerInfo.ServerIndex serverIndex) { - var instance = getInstance(); - instance.serverIndex = serverIndex; - return getBuilderAfterServerIndex(instance); - } - } - - public interface SetterForSecurityIndex { - GetNullableRequest getInstance(); - T getBuilderAfterSecurityIndex(GetNullableRequest instance); - default T securityIndex(PetfindbystatusGetSecurityInfo.SecurityIndex securityIndex) { - var instance = getInstance(); - instance.securityIndex = securityIndex; - return getBuilderAfterSecurityIndex(instance); - } - } - - public interface SetterForTimeout { - GetNullableRequest getInstance(); - T getBuilderAfterTimeout(GetNullableRequest instance); - default T timeout(Duration timeout) { - var instance = getInstance(); - instance.timeout = timeout; - return getBuilderAfterTimeout(instance); - } - } - - public interface SetterForQueryParameters { - GetNullableRequest getInstance(); - T getBuilderAfterQueryParameters(GetNullableRequest instance); - default T queryParameters(PetfindbystatusGetQueryParameters.QueryParametersMap queryParameters) { - var instance = getInstance(); - instance.queryParameters = queryParameters; - return getBuilderAfterQueryParameters(instance); - } - } - - public static class Get0RequestBuilder implements SetterForServerIndex, SetterForSecurityIndex, SetterForTimeout { - private final GetNullableRequest instance; - - public Get0RequestBuilder(GetNullableRequest instance) { - this.instance = instance; - } - - public GetRequest build() { - var queryParameters = instance.queryParameters; - if (queryParameters == null) { - throw new RuntimeException("invalid null value for required parameter"); - } - return new GetRequest( - queryParameters, - instance.serverIndex, - instance.securityIndex, - instance.timeout - ); - } - - public GetNullableRequest getInstance() { - return instance; - } - - public Get0RequestBuilder getBuilderAfterServerIndex(GetNullableRequest instance) { - return this; - } - - public Get0RequestBuilder getBuilderAfterSecurityIndex(GetNullableRequest instance) { - return this; - } - - public Get0RequestBuilder getBuilderAfterTimeout(GetNullableRequest instance) { - return this; - } - } - public static class GetRequestBuilder implements SetterForQueryParameters { - private final GetNullableRequest instance; - - public GetRequestBuilder() { - this.instance = new GetNullableRequest(); - } - - public GetNullableRequest getInstance() { - return instance; - } - - public Get0RequestBuilder getBuilderAfterQueryParameters(GetNullableRequest instance) { - return new Get0RequestBuilder(instance); - } - } -} diff --git a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/petfindbystatus/PetfindbystatusServerInfo.kt b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/petfindbystatus/PetfindbystatusServerInfo.kt deleted file mode 100644 index e0ed6efd6f2..00000000000 --- a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/petfindbystatus/PetfindbystatusServerInfo.kt +++ /dev/null @@ -1,63 +0,0 @@ -package org.openapijsonschematools.client.paths.petfindbystatus; - -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.Objects; - -public class PetfindbystatusServerInfo { - public static class PetfindbystatusServerInfo1 implements ServerProvider { - private final PetfindbystatusServer0 server0; - private final PetfindbystatusServer1 server1; - - PetfindbystatusServerInfo1( - @Nullable PetfindbystatusServer0 server0, - @Nullable PetfindbystatusServer1 server1 - ) { - this.server0 = Objects.requireNonNullElseGet(server0, PetfindbystatusServer0::new); - this.server1 = Objects.requireNonNullElseGet(server1, PetfindbystatusServer1::new); - } - - @Override - public Server getServer(ServerIndex serverIndex) { - switch (serverIndex) { - case SERVER_0: - return server0; - default: - return server1; - } - } - } - - public static class PetfindbystatusServerInfoBuilder { - private @Nullable PetfindbystatusServer0 server0; - private @Nullable PetfindbystatusServer1 server1; - - public PetfindbystatusServerInfoBuilder() {} - - public PetfindbystatusServerInfoBuilder petfindbystatusServer0(PetfindbystatusServer0 server0) { - this.server0 = server0; - return this; - } - - public PetfindbystatusServerInfoBuilder petfindbystatusServer1(PetfindbystatusServer1 server1) { - this.server1 = server1; - return this; - } - - public PetfindbystatusServerInfo1 build() { - return new PetfindbystatusServerInfo1( - server0, - server1 - ); - } - } - - public enum ServerIndex { - SERVER_0, - SERVER_1 - } -} \ No newline at end of file diff --git a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/petfindbystatus/get/Parameters.kt b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/petfindbystatus/get/Parameters.kt deleted file mode 100644 index e1ac9de45c5..00000000000 --- a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/petfindbystatus/get/Parameters.kt +++ /dev/null @@ -1,20 +0,0 @@ -package org.openapijsonschematools.client.paths.petfindbystatus.get; - -import org.openapijsonschematools.client.paths.petfindbystatus.get.parameters.Parameter0; -import org.openapijsonschematools.client.parameter.QuerySerializer; - -import java.util.Map; -import java.util.AbstractMap; - -public class Parameters { - - public static class QueryParametersSerializer extends QuerySerializer { - public QueryParametersSerializer() { - super( - Map.ofEntries( - new AbstractMap.SimpleEntry<>("status", new Parameter0.Parameter01()) - ) - ); - } - } -} diff --git a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/petfindbystatus/get/PetfindbystatusGetQueryParameters.kt b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/petfindbystatus/get/PetfindbystatusGetQueryParameters.kt deleted file mode 100644 index b62d34090e5..00000000000 --- a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/petfindbystatus/get/PetfindbystatusGetQueryParameters.kt +++ /dev/null @@ -1,206 +0,0 @@ -package org.openapijsonschematools.client.paths.petfindbystatus.get; -import java.util.ArrayList; -import java.util.HashSet; -import java.util.LinkedHashMap; -import java.util.LinkedHashSet; -import java.util.List; -import java.util.Map; -import java.util.Objects; -import java.util.Set; -import org.checkerframework.checker.nullness.qual.Nullable; -import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags; -import org.openapijsonschematools.client.configurations.SchemaConfiguration; -import org.openapijsonschematools.client.exceptions.UnsetPropertyException; -import org.openapijsonschematools.client.exceptions.ValidationException; -import org.openapijsonschematools.client.paths.petfindbystatus.get.parameters.parameter0.Schema0; -import org.openapijsonschematools.client.schemas.AnyTypeJsonSchema; -import org.openapijsonschematools.client.schemas.GenericBuilder; -import org.openapijsonschematools.client.schemas.NotAnyTypeJsonSchema; -import org.openapijsonschematools.client.schemas.validation.FrozenList; -import org.openapijsonschematools.client.schemas.validation.FrozenMap; -import org.openapijsonschematools.client.schemas.validation.JsonSchema; -import org.openapijsonschematools.client.schemas.validation.JsonSchemaInfo; -import org.openapijsonschematools.client.schemas.validation.MapSchemaValidator; -import org.openapijsonschematools.client.schemas.validation.MapUtils; -import org.openapijsonschematools.client.schemas.validation.PathToSchemasMap; -import org.openapijsonschematools.client.schemas.validation.PropertyEntry; -import org.openapijsonschematools.client.schemas.validation.ValidationMetadata; - -public class PetfindbystatusGetQueryParameters { - // nest classes so all schemas and input/output classes can be public - - - public static class AdditionalProperties extends NotAnyTypeJsonSchema.NotAnyTypeJsonSchema1 { - // NotAnyTypeSchema - private static @Nullable AdditionalProperties instance = null; - public static AdditionalProperties getInstance() { - if (instance == null) { - instance = new AdditionalProperties(); - } - return instance; - } - } - - - public static class QueryParametersMap extends FrozenMap { - protected QueryParametersMap(FrozenMap m) { - super(m); - } - public static final Set requiredKeys = Set.of( - "status" - ); - public static final Set optionalKeys = Set.of(); - public static QueryParametersMap of(Map> arg, SchemaConfiguration configuration) throws ValidationException { - return PetfindbystatusGetQueryParameters1.getInstance().validate(arg, configuration); - } - - public Schema0.SchemaList0 status() { - try { - return getOrThrow("version"); - } catch (UnsetPropertyException e) { - throw new RuntimeException(e); - } - } - } - - public interface SetterForStatus { - Map> getInstance(); - T getBuilderAfterStatus(Map> instance); - - default T status(List value) { - var instance = getInstance(); - instance.put("status", value); - return getBuilderAfterStatus(instance); - } - } - - public static class QueryParametersMap0Builder implements GenericBuilder>> { - private final Map> instance; - private static final Set knownKeys = Set.of( - "status" - ); - public Set getKnownKeys() { - return knownKeys; - } - public QueryParametersMap0Builder(Map> instance) { - this.instance = instance; - } - public Map> build() { - return instance; - } - } - - public static class QueryParametersMapBuilder implements SetterForStatus { - private final Map> instance; - public QueryParametersMapBuilder() { - this.instance = new LinkedHashMap<>(); - } - public Map> getInstance() { - return instance; - } - public QueryParametersMap0Builder getBuilderAfterStatus(Map> instance) { - return new QueryParametersMap0Builder(instance); - } - } - - - public sealed interface PetfindbystatusGetQueryParameters1Boxed permits PetfindbystatusGetQueryParameters1BoxedMap { - @Nullable Object getData(); - } - - public record PetfindbystatusGetQueryParameters1BoxedMap(QueryParametersMap data) implements PetfindbystatusGetQueryParameters1Boxed { - @Override - public @Nullable Object getData() { - return data; - } - } - - - public static class PetfindbystatusGetQueryParameters1 extends JsonSchema implements MapSchemaValidator { - private static @Nullable PetfindbystatusGetQueryParameters1 instance = null; - - protected PetfindbystatusGetQueryParameters1() { - super(new JsonSchemaInfo() - .type(Set.of(Map.class)) - .properties(Map.ofEntries( - new PropertyEntry("status", Schema0.Schema01.class) - )) - .required(Set.of( - "status" - )) - .additionalProperties(AdditionalProperties.class) - ); - } - - public static PetfindbystatusGetQueryParameters1 getInstance() { - if (instance == null) { - instance = new PetfindbystatusGetQueryParameters1(); - } - return instance; - } - - 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 RuntimeException("Invalid non-string key value"); - } - String propertyName = (String) entryKey; - List propertyPathToItem = new ArrayList<>(pathToItem); - propertyPathToItem.add(propertyName); - Object value = entry.getValue(); - LinkedHashMap, Nothing?> schemas = pathToSchemas.get(propertyPathToItem); - if (schemas == null) { - throw new RuntimeException("Validation 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"); - } - properties.put(propertyName, (Schema0.SchemaList0) propertyInstance); - } - FrozenMap castProperties = new FrozenMap<>(properties); - return new QueryParametersMap(castProperties); - } - - 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); - SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().build())); - ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, new PathToSchemasMap(), new LinkedHashSet<>()); - PathToSchemasMap pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet); - return getNewInstance(castArg, validationMetadata.pathToItem(), pathToSchemasMap); - } - - - @Override - public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws 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"); - } - @Override - public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { - if (arg instanceof Map) { - return getNewInstance((Map) arg, pathToItem, pathToSchemas); - } - throw new RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); - } - @Override - public PetfindbystatusGetQueryParameters1BoxedMap validateAndBox(Map arg, SchemaConfiguration configuration) throws ValidationException { - return new PetfindbystatusGetQueryParameters1BoxedMap(validate(arg, configuration)); - } - @Override - public PetfindbystatusGetQueryParameters1Boxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { - 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"); - } - } - -} diff --git a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/petfindbystatus/get/PetfindbystatusGetResponses.kt b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/petfindbystatus/get/PetfindbystatusGetResponses.kt deleted file mode 100644 index 18b7e3343a7..00000000000 --- a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/petfindbystatus/get/PetfindbystatusGetResponses.kt +++ /dev/null @@ -1,66 +0,0 @@ -package org.openapijsonschematools.client.paths.petfindbystatus.get; - -import org.openapijsonschematools.client.paths.petfindbystatus.get.responses.PetfindbystatusGetCode200Response; -import org.openapijsonschematools.client.paths.petfindbystatus.get.responses.PetfindbystatusGetCode400Response; -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; -import org.checkerframework.checker.nullness.qual.Nullable; - -import java.net.http.HttpResponse; -import java.util.Map; -import java.util.AbstractMap; - -public class PetfindbystatusGetResponses { - public sealed interface EndpointResponse permits EndpointPetfindbystatusGetCode200Response {} - - public record EndpointPetfindbystatusGetCode200Response( - HttpResponse response, - PetfindbystatusGetCode200Response.SealedResponseBody body, - Nothing? headers - ) implements EndpointResponse, ApiResponse{ - } - - public sealed interface StatusCodeResponseDeserializer permits StatusPetfindbystatusGetCode200ResponseDeserializer, StatusPetfindbystatusGetCode400ResponseDeserializer {} - - public static final class StatusPetfindbystatusGetCode200ResponseDeserializer extends PetfindbystatusGetCode200Response.PetfindbystatusGetCode200Response1 implements StatusCodeResponseDeserializer { - } - public static final class StatusPetfindbystatusGetCode400ResponseDeserializer extends PetfindbystatusGetCode400Response.PetfindbystatusGetCode400Response1 implements StatusCodeResponseDeserializer { - } - - public static final class PetfindbystatusGetResponses1 implements ResponsesDeserializer { - private final Map statusCodeToResponseDeserializer; - public PetfindbystatusGetResponses1() { - this.statusCodeToResponseDeserializer = Map.ofEntries( - new AbstractMap.SimpleEntry<>("200", new StatusPetfindbystatusGetCode200ResponseDeserializer()), - new AbstractMap.SimpleEntry<>("400", new StatusPetfindbystatusGetCode400ResponseDeserializer()) - ); - } - - 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) { - throw new ApiException( - "Invalid response statusCode="+statusCode+" has no response defined in the openapi document", - response - ); - } - if (statusCodeDeserializer instanceof StatusPetfindbystatusGetCode200ResponseDeserializer castDeserializer) { - var deserializedResponse = castDeserializer.deserialize(response, configuration); - return new EndpointPetfindbystatusGetCode200Response(response, deserializedResponse.body(), deserializedResponse.headers()); - } else { - StatusPetfindbystatusGetCode400ResponseDeserializer castDeserializer = (StatusPetfindbystatusGetCode400ResponseDeserializer) statusCodeDeserializer; - var deserializedResponse = castDeserializer.deserialize(response, configuration); - throw new PetfindbystatusGetCode400Response.ResponseApiException( - "Received error statusCode response from server", - response, - deserializedResponse - ); - } - } - } -} diff --git a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/petfindbystatus/get/PetfindbystatusGetSecurityInfo.kt b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/petfindbystatus/get/PetfindbystatusGetSecurityInfo.kt deleted file mode 100644 index 7e2dd18d844..00000000000 --- a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/petfindbystatus/get/PetfindbystatusGetSecurityInfo.kt +++ /dev/null @@ -1,39 +0,0 @@ -package org.openapijsonschematools.client.paths.petfindbystatus.get; - -import org.openapijsonschematools.client.paths.petfindbystatus.get.security.PetfindbystatusGetSecurityRequirementObject0; -import org.openapijsonschematools.client.paths.petfindbystatus.get.security.PetfindbystatusGetSecurityRequirementObject1; -import org.openapijsonschematools.client.paths.petfindbystatus.get.security.PetfindbystatusGetSecurityRequirementObject2; -import org.openapijsonschematools.client.securityrequirementobjects.SecurityRequirementObject; -import org.openapijsonschematools.client.securityrequirementobjects.SecurityRequirementObjectProvider; - -public class PetfindbystatusGetSecurityInfo { - public static class PetfindbystatusGetSecurityInfo1 implements SecurityRequirementObjectProvider { - public final PetfindbystatusGetSecurityRequirementObject0 security0; - public final PetfindbystatusGetSecurityRequirementObject1 security1; - public final PetfindbystatusGetSecurityRequirementObject2 security2; - - public PetfindbystatusGetSecurityInfo1() { - security0 = new PetfindbystatusGetSecurityRequirementObject0(); - security1 = new PetfindbystatusGetSecurityRequirementObject1(); - security2 = new PetfindbystatusGetSecurityRequirementObject2(); - } - - @Override - public SecurityRequirementObject getSecurityRequirementObject(SecurityIndex securityIndex) { - switch (securityIndex) { - case SECURITY_0: - return security0; - case SECURITY_1: - return security1; - default: - return security2; - } - } - } - - public enum SecurityIndex { - SECURITY_0, - SECURITY_1, - SECURITY_2 - } -} \ No newline at end of file diff --git a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/petfindbystatus/get/parameters/Parameter0.kt b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/petfindbystatus/get/parameters/Parameter0.kt deleted file mode 100644 index b77d3c07561..00000000000 --- a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/petfindbystatus/get/parameters/Parameter0.kt +++ /dev/null @@ -1,23 +0,0 @@ -package org.openapijsonschematools.client.paths.petfindbystatus.get.parameters; - -import org.openapijsonschematools.client.parameter.ParameterStyle; -import org.openapijsonschematools.client.parameter.ParameterInType; -import org.openapijsonschematools.client.parameter.SchemaParameter; -import org.openapijsonschematools.client.paths.petfindbystatus.get.parameters.parameter0.Schema0; - -public class Parameter0 { - - public static class Parameter01 extends SchemaParameter { - public Parameter01() { - super( - "status", - ParameterInType.QUERY, - true, - ParameterStyle.FORM, - false, - false, - Schema0.Schema01.getInstance() - ); - } - } -} diff --git a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/petfindbystatus/get/parameters/parameter0/Schema0.kt b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/petfindbystatus/get/parameters/parameter0/Schema0.kt deleted file mode 100644 index fb0b03d7068..00000000000 --- a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/petfindbystatus/get/parameters/parameter0/Schema0.kt +++ /dev/null @@ -1,255 +0,0 @@ -package org.openapijsonschematools.client.paths.petfindbystatus.get.parameters.parameter0; -import java.util.ArrayList; -import java.util.HashSet; -import java.util.LinkedHashMap; -import java.util.LinkedHashSet; -import java.util.List; -import java.util.Objects; -import java.util.Set; -import org.checkerframework.checker.nullness.qual.Nullable; -import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags; -import org.openapijsonschematools.client.configurations.SchemaConfiguration; -import org.openapijsonschematools.client.exceptions.ValidationException; -import org.openapijsonschematools.client.schemas.SetMaker; -import org.openapijsonschematools.client.schemas.validation.DefaultValueMethod; -import org.openapijsonschematools.client.schemas.validation.FrozenList; -import org.openapijsonschematools.client.schemas.validation.JsonSchema; -import org.openapijsonschematools.client.schemas.validation.JsonSchemaInfo; -import org.openapijsonschematools.client.schemas.validation.ListSchemaValidator; -import org.openapijsonschematools.client.schemas.validation.PathToSchemasMap; -import org.openapijsonschematools.client.schemas.validation.StringEnumValidator; -import org.openapijsonschematools.client.schemas.validation.StringSchemaValidator; -import org.openapijsonschematools.client.schemas.validation.StringValueMethod; -import org.openapijsonschematools.client.schemas.validation.ValidationMetadata; - -public class Schema0 { - // nest classes so all schemas and input/output classes can be public - - public enum StringItemsEnums0 implements StringValueMethod { - AVAILABLE("available"), - PENDING("pending"), - SOLD("sold"); - private final String value; - - StringItemsEnums0(String value) { - this.value = value; - } - public String value() { - return this.value; - } - } - - - public sealed interface Items0Boxed permits Items0BoxedString { - @Nullable Object getData(); - } - - public record Items0BoxedString(String data) implements Items0Boxed { - @Override - public @Nullable Object getData() { - return data; - } - } - - - - public static class Items0 extends JsonSchema implements StringSchemaValidator, StringEnumValidator, DefaultValueMethod { - private static @Nullable Items0 instance = null; - - protected Items0() { - super(new JsonSchemaInfo() - .type(Set.of( - String.class - )) - .enumValues(SetMaker.makeSet( - "available", - "pending", - "sold" - )) - .defaultValue("available") - ); - } - - public static Items0 getInstance() { - if (instance == null) { - instance = new Items0(); - } - return instance; - } - - @Override - public String validate(String arg, SchemaConfiguration configuration) throws ValidationException { - Set> pathSet = new HashSet<>(); - List pathToItem = List.of("args[0"); - String castArg = castToAllowedTypes(arg, pathToItem, pathSet); - SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().build())); - ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, new PathToSchemasMap(), new LinkedHashSet<>()); - getPathToSchemas(this, castArg, validationMetadata, pathSet); - return castArg; - } - - @Override - 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 { - 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"); - } - @Override - public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { - 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"); - } - public String defaultValue() throws ValidationException { - if (defaultValue instanceof String) { - return (String) defaultValue; - } - throw new ValidationException("Invalid type stored in defaultValue"); - } - @Override - 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 { - 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"); - } - } - - public static class SchemaList0 extends FrozenList { - protected SchemaList0(FrozenList m) { - super(m); - } - public static SchemaList0 of(List arg, SchemaConfiguration configuration) throws ValidationException { - return Schema01.getInstance().validate(arg, configuration); - } - } - - public static class SchemaListBuilder0 { - // class to build List - private final List list; - - public SchemaListBuilder0() { - list = new ArrayList<>(); - } - - public SchemaListBuilder0(List list) { - this.list = list; - } - - public SchemaListBuilder0 add(String item) { - list.add(item); - return this; - } - - public SchemaListBuilder0 add(StringItemsEnums0 item) { - list.add(item.value()); - return this; - } - - public List build() { - return list; - } - } - - - public sealed interface Schema01Boxed permits Schema01BoxedList { - @Nullable Object getData(); - } - - public record Schema01BoxedList(SchemaList0 data) implements Schema01Boxed { - @Override - public @Nullable Object getData() { - return data; - } - } - - - - public static class Schema01 extends JsonSchema implements ListSchemaValidator { - private static @Nullable Schema01 instance = null; - - protected Schema01() { - super(new JsonSchemaInfo() - .type(Set.of(List.class)) - .items(Items0.class) - ); - } - - public static Schema01 getInstance() { - if (instance == null) { - instance = new Schema01(); - } - return instance; - } - - @Override - public SchemaList0 getNewInstance(List arg, List pathToItem, PathToSchemasMap pathToSchemas) { - List items = new ArrayList<>(); - int i = 0; - for (Object item: arg) { - List itemPathToItem = new ArrayList<>(pathToItem); - itemPathToItem.add(i); - LinkedHashMap, Nothing?> schemas = pathToSchemas.get(itemPathToItem); - if (schemas == null) { - throw new RuntimeException("Validation 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"); - } - items.add((String) itemInstance); - i += 1; - } - FrozenList newInstanceItems = new FrozenList<>(items); - return new SchemaList0(newInstanceItems); - } - - 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); - SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().build())); - ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, new PathToSchemasMap(), new LinkedHashSet<>()); - PathToSchemasMap pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet); - return getNewInstance(castArg, validationMetadata.pathToItem(), pathToSchemasMap); - } - - @Override - public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws 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"); - } - @Override - public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { - 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"); - } - @Override - 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 { - 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"); - } - } -} diff --git a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/petfindbystatus/get/responses/PetfindbystatusGetCode200Response.kt b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/petfindbystatus/get/responses/PetfindbystatusGetCode200Response.kt deleted file mode 100644 index 824d60a6907..00000000000 --- a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/petfindbystatus/get/responses/PetfindbystatusGetCode200Response.kt +++ /dev/null @@ -1,7 +0,0 @@ -package org.openapijsonschematools.client.paths.petfindbystatus.get.responses; - -import org.openapijsonschematools.client.components.responses.SuccessfulXmlAndJsonArrayOfPet; - -public class PetfindbystatusGetCode200Response extends SuccessfulXmlAndJsonArrayOfPet { - public static class PetfindbystatusGetCode200Response1 extends SuccessfulXmlAndJsonArrayOfPet1 {} -} diff --git a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/petfindbystatus/get/responses/PetfindbystatusGetCode400Response.kt b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/petfindbystatus/get/responses/PetfindbystatusGetCode400Response.kt deleted file mode 100644 index b4e876d37af..00000000000 --- a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/petfindbystatus/get/responses/PetfindbystatusGetCode400Response.kt +++ /dev/null @@ -1,45 +0,0 @@ -package org.openapijsonschematools.client.paths.petfindbystatus.get.responses; - -import org.openapijsonschematools.client.configurations.SchemaConfiguration; -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; -import java.net.http.HttpResponse; -import java.net.http.HttpHeaders; - -public class PetfindbystatusGetCode400Response { - - public static class PetfindbystatusGetCode400Response1 extends ResponseDeserializer { - public PetfindbystatusGetCode400Response1() { - super( - MapUtils.makeMap( - ) - ); - } - - @Override - protected Nothing? getBody(String contentType, Nothing? mediaType, byte[] body, SchemaConfiguration configuration) { - return null; - } - - @Override - protected Nothing? getHeaders(HttpHeaders headers, SchemaConfiguration configuration) { - return null; - } - } - - @SuppressWarnings("serial") - public static class ResponseApiException extends ApiException { - public DeserializedHttpResponse deserializedResponse; - - public ResponseApiException(String s, HttpResponse response, DeserializedHttpResponse deserializedResponse) { - super(s, response); - this.deserializedResponse = deserializedResponse; - } - } -} diff --git a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/petfindbystatus/get/security/PetfindbystatusGetSecurityRequirementObject0.kt b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/petfindbystatus/get/security/PetfindbystatusGetSecurityRequirementObject0.kt deleted file mode 100644 index 0f8bcbc46b0..00000000000 --- a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/petfindbystatus/get/security/PetfindbystatusGetSecurityRequirementObject0.kt +++ /dev/null @@ -1,24 +0,0 @@ -package org.openapijsonschematools.client.paths.petfindbystatus.get.security; - -import org.checkerframework.checker.nullness.qual.Nullable; -import org.openapijsonschematools.client.securityrequirementobjects.SecurityRequirementObject; -import org.openapijsonschematools.client.securityschemes.SecurityScheme; -import org.openapijsonschematools.client.components.securityschemes.ApiKey; - -import java.util.List; -import java.util.Map; -import java.util.AbstractMap; - -public class PetfindbystatusGetSecurityRequirementObject0 extends SecurityRequirementObject { - - public PetfindbystatusGetSecurityRequirementObject0() { - super( - Map.ofEntries( - new AbstractMap.SimpleEntry, List>( - ApiKey.class, - List.of() - ) - ) - ); - } -} diff --git a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/petfindbystatus/get/security/PetfindbystatusGetSecurityRequirementObject1.kt b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/petfindbystatus/get/security/PetfindbystatusGetSecurityRequirementObject1.kt deleted file mode 100644 index d96864b78a1..00000000000 --- a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/petfindbystatus/get/security/PetfindbystatusGetSecurityRequirementObject1.kt +++ /dev/null @@ -1,24 +0,0 @@ -package org.openapijsonschematools.client.paths.petfindbystatus.get.security; - -import org.checkerframework.checker.nullness.qual.Nullable; -import org.openapijsonschematools.client.securityrequirementobjects.SecurityRequirementObject; -import org.openapijsonschematools.client.securityschemes.SecurityScheme; -import org.openapijsonschematools.client.components.securityschemes.HttpSignatureTest; - -import java.util.List; -import java.util.Map; -import java.util.AbstractMap; - -public class PetfindbystatusGetSecurityRequirementObject1 extends SecurityRequirementObject { - - public PetfindbystatusGetSecurityRequirementObject1() { - super( - Map.ofEntries( - new AbstractMap.SimpleEntry, List>( - HttpSignatureTest.class, - List.of() - ) - ) - ); - } -} diff --git a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/petfindbystatus/get/security/PetfindbystatusGetSecurityRequirementObject2.kt b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/petfindbystatus/get/security/PetfindbystatusGetSecurityRequirementObject2.kt deleted file mode 100644 index d5da83b6640..00000000000 --- a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/petfindbystatus/get/security/PetfindbystatusGetSecurityRequirementObject2.kt +++ /dev/null @@ -1,24 +0,0 @@ -package org.openapijsonschematools.client.paths.petfindbystatus.get.security; - -import org.checkerframework.checker.nullness.qual.Nullable; -import org.openapijsonschematools.client.securityrequirementobjects.SecurityRequirementObject; -import org.openapijsonschematools.client.securityschemes.SecurityScheme; -import org.openapijsonschematools.client.components.securityschemes.PetstoreAuth; - -import java.util.List; -import java.util.Map; -import java.util.AbstractMap; - -public class PetfindbystatusGetSecurityRequirementObject2 extends SecurityRequirementObject { - - public PetfindbystatusGetSecurityRequirementObject2() { - super( - Map.ofEntries( - new AbstractMap.SimpleEntry, List>( - PetstoreAuth.class, - List.of("write:pets", "read:pets") - ) - ) - ); - } -} diff --git a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/petfindbystatus/servers/PetfindbystatusServer0.kt b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/petfindbystatus/servers/PetfindbystatusServer0.kt deleted file mode 100644 index d548b1da5db..00000000000 --- a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/petfindbystatus/servers/PetfindbystatusServer0.kt +++ /dev/null @@ -1,9 +0,0 @@ -package org.openapijsonschematools.client.paths.petfindbystatus.servers; - -import org.openapijsonschematools.client.servers.ServerWithoutVariables; - -public class PetfindbystatusServer0 extends ServerWithoutVariables { - public PetfindbystatusServer0() { - super("https://path-server-test.petstore.local/v2"); - } -} diff --git a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/petfindbystatus/servers/PetfindbystatusServer1.kt b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/petfindbystatus/servers/PetfindbystatusServer1.kt deleted file mode 100644 index 5d73d07d98b..00000000000 --- a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/petfindbystatus/servers/PetfindbystatusServer1.kt +++ /dev/null @@ -1,35 +0,0 @@ -package org.openapijsonschematools.client.paths.petfindbystatus.servers; - -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.PetfindbystatusServer1Variables; - -import java.util.AbstractMap; - -public class PetfindbystatusServer1 extends ServerWithVariables { - private static PetfindbystatusServer1Variables.VariablesMap getVariables() { - try { - return PetfindbystatusServer1Variables.PetfindbystatusServer1Variables1.getInstance().validate( - MapUtils.makeMap( - new AbstractMap.SimpleEntry<>("version", PetfindbystatusServer1Variables.Version.getInstance().defaultValue()) - ), - new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().build()) - ); - } catch (ValidationException e) { - throw new RuntimeException(e); - } - } - - public PetfindbystatusServer1() { - super( - "https://petstore.swagger.io/{version}", - getVariables() - ); - } - public PetfindbystatusServer1(PetfindbystatusServer1Variables.VariablesMap variables) { - super("https://petstore.swagger.io/{version}", variables); - } -} diff --git a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/petfindbystatus/servers/server1/PetfindbystatusServer1Variables.kt b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/petfindbystatus/servers/server1/PetfindbystatusServer1Variables.kt deleted file mode 100644 index b2bfb8eb040..00000000000 --- a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/petfindbystatus/servers/server1/PetfindbystatusServer1Variables.kt +++ /dev/null @@ -1,313 +0,0 @@ -package org.openapijsonschematools.client.paths.petfindbystatus.servers.server1; -import java.util.ArrayList; -import java.util.HashSet; -import java.util.LinkedHashMap; -import java.util.LinkedHashSet; -import java.util.List; -import java.util.Map; -import java.util.Objects; -import java.util.Set; -import org.checkerframework.checker.nullness.qual.Nullable; -import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags; -import org.openapijsonschematools.client.configurations.SchemaConfiguration; -import org.openapijsonschematools.client.exceptions.UnsetPropertyException; -import org.openapijsonschematools.client.exceptions.ValidationException; -import org.openapijsonschematools.client.schemas.AnyTypeJsonSchema; -import org.openapijsonschematools.client.schemas.GenericBuilder; -import org.openapijsonschematools.client.schemas.NotAnyTypeJsonSchema; -import org.openapijsonschematools.client.schemas.SetMaker; -import org.openapijsonschematools.client.schemas.validation.DefaultValueMethod; -import org.openapijsonschematools.client.schemas.validation.FrozenMap; -import org.openapijsonschematools.client.schemas.validation.JsonSchema; -import org.openapijsonschematools.client.schemas.validation.JsonSchemaInfo; -import org.openapijsonschematools.client.schemas.validation.MapSchemaValidator; -import org.openapijsonschematools.client.schemas.validation.MapUtils; -import org.openapijsonschematools.client.schemas.validation.PathToSchemasMap; -import org.openapijsonschematools.client.schemas.validation.PropertyEntry; -import org.openapijsonschematools.client.schemas.validation.StringEnumValidator; -import org.openapijsonschematools.client.schemas.validation.StringSchemaValidator; -import org.openapijsonschematools.client.schemas.validation.StringValueMethod; -import org.openapijsonschematools.client.schemas.validation.ValidationMetadata; - -public class PetfindbystatusServer1Variables { - // nest classes so all schemas and input/output classes can be public - - - public static class AdditionalProperties extends NotAnyTypeJsonSchema.NotAnyTypeJsonSchema1 { - // NotAnyTypeSchema - private static @Nullable AdditionalProperties instance = null; - public static AdditionalProperties getInstance() { - if (instance == null) { - instance = new AdditionalProperties(); - } - return instance; - } - } - - public enum StringVersionEnums implements StringValueMethod { - V1("v1"), - V2("v2"); - private final String value; - - StringVersionEnums(String value) { - this.value = value; - } - public String value() { - return this.value; - } - } - - - public sealed interface VersionBoxed permits VersionBoxedString { - @Nullable Object getData(); - } - - public record VersionBoxedString(String data) implements VersionBoxed { - @Override - public @Nullable Object getData() { - return data; - } - } - - - - public static class Version extends JsonSchema implements StringSchemaValidator, StringEnumValidator, DefaultValueMethod { - private static @Nullable Version instance = null; - - protected Version() { - super(new JsonSchemaInfo() - .type(Set.of( - String.class - )) - .enumValues(SetMaker.makeSet( - "v1", - "v2" - )) - .defaultValue("v1") - ); - } - - public static Version getInstance() { - if (instance == null) { - instance = new Version(); - } - return instance; - } - - @Override - public String validate(String arg, SchemaConfiguration configuration) throws ValidationException { - Set> pathSet = new HashSet<>(); - List pathToItem = List.of("args[0"); - String castArg = castToAllowedTypes(arg, pathToItem, pathSet); - SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().build())); - ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, new PathToSchemasMap(), new LinkedHashSet<>()); - getPathToSchemas(this, castArg, validationMetadata, pathSet); - return castArg; - } - - @Override - 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 { - 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"); - } - @Override - public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { - 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"); - } - public String defaultValue() throws ValidationException { - if (defaultValue instanceof String) { - return (String) defaultValue; - } - throw new ValidationException("Invalid type stored in defaultValue"); - } - @Override - 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 { - 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"); - } - } - - public static class VariablesMap extends FrozenMap { - protected VariablesMap(FrozenMap m) { - super(m); - } - public static final Set requiredKeys = Set.of( - "version" - ); - public static final Set optionalKeys = Set.of(); - public static VariablesMap of(Map arg, SchemaConfiguration configuration) throws ValidationException { - return PetfindbystatusServer1Variables1.getInstance().validate(arg, configuration); - } - - public String version() { - try { - return getOrThrow("version"); - } catch (UnsetPropertyException e) { - throw new RuntimeException(e); - } - } - } - - public interface SetterForVersion { - Map getInstance(); - T getBuilderAfterVersion(Map instance); - - default T version(String value) { - var instance = getInstance(); - instance.put("version", value); - return getBuilderAfterVersion(instance); - } - - default T version(StringVersionEnums value) { - var instance = getInstance(); - instance.put("version", value.value()); - return getBuilderAfterVersion(instance); - } - } - - public static class VariablesMap0Builder implements GenericBuilder> { - private final Map instance; - private static final Set knownKeys = Set.of( - "version" - ); - public Set getKnownKeys() { - return knownKeys; - } - public VariablesMap0Builder(Map instance) { - this.instance = instance; - } - public Map build() { - return instance; - } - } - - public static class VariablesMapBuilder implements SetterForVersion { - private final Map instance; - public VariablesMapBuilder() { - this.instance = new LinkedHashMap<>(); - } - public Map getInstance() { - return instance; - } - public VariablesMap0Builder getBuilderAfterVersion(Map instance) { - return new VariablesMap0Builder(instance); - } - } - - - public sealed interface PetfindbystatusServer1Variables1Boxed permits PetfindbystatusServer1Variables1BoxedMap { - @Nullable Object getData(); - } - - public record PetfindbystatusServer1Variables1BoxedMap(VariablesMap data) implements PetfindbystatusServer1Variables1Boxed { - @Override - public @Nullable Object getData() { - return data; - } - } - - - public static class PetfindbystatusServer1Variables1 extends JsonSchema implements MapSchemaValidator { - private static @Nullable PetfindbystatusServer1Variables1 instance = null; - - protected PetfindbystatusServer1Variables1() { - super(new JsonSchemaInfo() - .type(Set.of(Map.class)) - .properties(Map.ofEntries( - new PropertyEntry("version", Version.class) - )) - .required(Set.of( - "version" - )) - .additionalProperties(AdditionalProperties.class) - ); - } - - public static PetfindbystatusServer1Variables1 getInstance() { - if (instance == null) { - instance = new PetfindbystatusServer1Variables1(); - } - return instance; - } - - 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 RuntimeException("Invalid non-string key value"); - } - String propertyName = (String) entryKey; - List propertyPathToItem = new ArrayList<>(pathToItem); - propertyPathToItem.add(propertyName); - Object value = entry.getValue(); - LinkedHashMap, Nothing?> schemas = pathToSchemas.get(propertyPathToItem); - if (schemas == null) { - throw new RuntimeException("Validation 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"); - } - properties.put(propertyName, (String) propertyInstance); - } - FrozenMap castProperties = new FrozenMap<>(properties); - return new VariablesMap(castProperties); - } - - 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); - SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().build())); - ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, new PathToSchemasMap(), new LinkedHashSet<>()); - PathToSchemasMap pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet); - return getNewInstance(castArg, validationMetadata.pathToItem(), pathToSchemasMap); - } - - - @Override - public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws 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"); - } - @Override - public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { - if (arg instanceof Map) { - return getNewInstance((Map) arg, pathToItem, pathToSchemas); - } - throw new RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); - } - @Override - public PetfindbystatusServer1Variables1BoxedMap validateAndBox(Map arg, SchemaConfiguration configuration) throws ValidationException { - return new PetfindbystatusServer1Variables1BoxedMap(validate(arg, configuration)); - } - @Override - public PetfindbystatusServer1Variables1Boxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { - 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"); - } - } - -} diff --git a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/petfindbytags/PetfindbytagsGet.kt b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/petfindbytags/PetfindbytagsGet.kt deleted file mode 100644 index d747aca39f8..00000000000 --- a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/petfindbytags/PetfindbytagsGet.kt +++ /dev/null @@ -1,212 +0,0 @@ -package org.openapijsonschematools.client.paths.petfindbytags; - -import org.checkerframework.checker.nullness.qual.Nullable; -import org.openapijsonschematools.client.RootServerInfo; -import org.openapijsonschematools.client.paths.petfindbytags.get.PetfindbytagsGetSecurityInfo; -import org.openapijsonschematools.client.paths.petfindbytags.get.PetfindbytagsGetQueryParameters; -import org.openapijsonschematools.client.paths.petfindbytags.get.Parameters; -import org.openapijsonschematools.client.paths.petfindbytags.get.PetfindbytagsGetResponses; -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.paths.Petfindbytags; -import org.openapijsonschematools.client.securityrequirementobjects.SecurityRequirementObject; -import org.openapijsonschematools.client.securityrequirementobjects.AuthApplier; - -import java.io.IOException; -import java.net.http.HttpClient; -import java.net.http.HttpRequest; -import java.time.Duration; -import java.util.List; -import java.util.Map; - -public class PetfindbytagsGet { - private static class GetProvider extends AuthApplier { - private static final String method = "get"; - - public static PetfindbytagsGetResponses.EndpointResponse get( - GetRequest request, - ApiConfiguration apiConfiguration, - SchemaConfiguration schemaConfiguration, - HttpClient client - ) throws IOException, InterruptedException, ValidationException, NotImplementedException, ApiException { - Map> headers = apiConfiguration.getDefaultHeaders(); - HttpRequest.BodyPublisher bodyPublisher = HttpRequest.BodyPublishers.noBody(); - - var querySerializer = new Parameters.QueryParametersSerializer(); - @Nullable Map queryMap = querySerializer.getQueryMap(request.queryParameters); - String host = apiConfiguration.getServer(request.serverIndex).url(); - SecurityRequirementObject securityRequirementObject = apiConfiguration.getSecurityRequirementObject(request.securityIndex); - updateParamsForAuth( - securityRequirementObject, - headers, - Petfindbytags.path, - method, - bodyPublisher, - queryMap, - apiConfiguration - ); - - String url = host + Petfindbytags.path; - if (queryMap != null) { - url = url + querySerializer.serialize(queryMap); - } - var httpRequest = RestClient.getRequest( - url, - method, - bodyPublisher, - headers, - request.timeout - ); - var response = RestClient.getResponse(httpRequest, client); - var responsesDeserializer = new PetfindbytagsGetResponses.PetfindbytagsGetResponses1(); - return responsesDeserializer.deserialize(response, schemaConfiguration); - } - } - - public interface GetOperation { - ApiConfiguration getApiConfiguration(); - SchemaConfiguration getSchemaConfiguration(); - HttpClient getClient(); - default PetfindbytagsGetResponses.EndpointResponse get(GetRequest request) throws IOException, InterruptedException, ValidationException, NotImplementedException, ApiException { - return GetProvider.get(request, getApiConfiguration(), getSchemaConfiguration(), getClient()); - } - } - - public interface FindPetsByTagsOperation { - ApiConfiguration getApiConfiguration(); - SchemaConfiguration getSchemaConfiguration(); - HttpClient getClient(); - default PetfindbytagsGetResponses.EndpointResponse findPetsByTags(GetRequest request) throws IOException, InterruptedException, ValidationException, NotImplementedException, ApiException { - return GetProvider.get(request, getApiConfiguration(), getSchemaConfiguration(), getClient()); - } - } - - public static class Get extends ApiClient implements GetOperation { - public Get(ApiConfiguration apiConfiguration, SchemaConfiguration schemaConfiguration) { - super(apiConfiguration, schemaConfiguration); - } - } - - public static class GetRequest { - public PetfindbytagsGetQueryParameters.QueryParametersMap queryParameters; - public RootServerInfo.@Nullable ServerIndex serverIndex; - public PetfindbytagsGetSecurityInfo.@Nullable SecurityIndex securityIndex; - public @Nullable Duration timeout; - - public GetRequest( - PetfindbytagsGetQueryParameters.QueryParametersMap queryParameters, - RootServerInfo.@Nullable ServerIndex serverIndex, - PetfindbytagsGetSecurityInfo.@Nullable SecurityIndex securityIndex, - @Nullable Duration timeout - ) { - this.queryParameters = queryParameters; - this.serverIndex = serverIndex; - this.securityIndex = securityIndex; - this.timeout = timeout; - } - } - - public static class GetNullableRequest { - public PetfindbytagsGetQueryParameters.@Nullable QueryParametersMap queryParameters; - public RootServerInfo.@Nullable ServerIndex serverIndex; - public PetfindbytagsGetSecurityInfo.@Nullable SecurityIndex securityIndex; - public @Nullable Duration timeout; - } - - public interface SetterForServerIndex { - GetNullableRequest getInstance(); - T getBuilderAfterServerIndex(GetNullableRequest instance); - default T serverIndex(RootServerInfo.ServerIndex serverIndex) { - var instance = getInstance(); - instance.serverIndex = serverIndex; - return getBuilderAfterServerIndex(instance); - } - } - - public interface SetterForSecurityIndex { - GetNullableRequest getInstance(); - T getBuilderAfterSecurityIndex(GetNullableRequest instance); - default T securityIndex(PetfindbytagsGetSecurityInfo.SecurityIndex securityIndex) { - var instance = getInstance(); - instance.securityIndex = securityIndex; - return getBuilderAfterSecurityIndex(instance); - } - } - - public interface SetterForTimeout { - GetNullableRequest getInstance(); - T getBuilderAfterTimeout(GetNullableRequest instance); - default T timeout(Duration timeout) { - var instance = getInstance(); - instance.timeout = timeout; - return getBuilderAfterTimeout(instance); - } - } - - public interface SetterForQueryParameters { - GetNullableRequest getInstance(); - T getBuilderAfterQueryParameters(GetNullableRequest instance); - default T queryParameters(PetfindbytagsGetQueryParameters.QueryParametersMap queryParameters) { - var instance = getInstance(); - instance.queryParameters = queryParameters; - return getBuilderAfterQueryParameters(instance); - } - } - - public static class Get0RequestBuilder implements SetterForServerIndex, SetterForSecurityIndex, SetterForTimeout { - private final GetNullableRequest instance; - - public Get0RequestBuilder(GetNullableRequest instance) { - this.instance = instance; - } - - public GetRequest build() { - var queryParameters = instance.queryParameters; - if (queryParameters == null) { - throw new RuntimeException("invalid null value for required parameter"); - } - return new GetRequest( - queryParameters, - instance.serverIndex, - instance.securityIndex, - instance.timeout - ); - } - - public GetNullableRequest getInstance() { - return instance; - } - - public Get0RequestBuilder getBuilderAfterServerIndex(GetNullableRequest instance) { - return this; - } - - public Get0RequestBuilder getBuilderAfterSecurityIndex(GetNullableRequest instance) { - return this; - } - - public Get0RequestBuilder getBuilderAfterTimeout(GetNullableRequest instance) { - return this; - } - } - public static class GetRequestBuilder implements SetterForQueryParameters { - private final GetNullableRequest instance; - - public GetRequestBuilder() { - this.instance = new GetNullableRequest(); - } - - public GetNullableRequest getInstance() { - return instance; - } - - public Get0RequestBuilder getBuilderAfterQueryParameters(GetNullableRequest instance) { - return new Get0RequestBuilder(instance); - } - } -} diff --git a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/petfindbytags/get/Parameters.kt b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/petfindbytags/get/Parameters.kt deleted file mode 100644 index 5974cc73733..00000000000 --- a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/petfindbytags/get/Parameters.kt +++ /dev/null @@ -1,20 +0,0 @@ -package org.openapijsonschematools.client.paths.petfindbytags.get; - -import org.openapijsonschematools.client.paths.petfindbytags.get.parameters.Parameter0; -import org.openapijsonschematools.client.parameter.QuerySerializer; - -import java.util.Map; -import java.util.AbstractMap; - -public class Parameters { - - public static class QueryParametersSerializer extends QuerySerializer { - public QueryParametersSerializer() { - super( - Map.ofEntries( - new AbstractMap.SimpleEntry<>("tags", new Parameter0.Parameter01()) - ) - ); - } - } -} diff --git a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/petfindbytags/get/PetfindbytagsGetQueryParameters.kt b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/petfindbytags/get/PetfindbytagsGetQueryParameters.kt deleted file mode 100644 index fde4fec0230..00000000000 --- a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/petfindbytags/get/PetfindbytagsGetQueryParameters.kt +++ /dev/null @@ -1,206 +0,0 @@ -package org.openapijsonschematools.client.paths.petfindbytags.get; -import java.util.ArrayList; -import java.util.HashSet; -import java.util.LinkedHashMap; -import java.util.LinkedHashSet; -import java.util.List; -import java.util.Map; -import java.util.Objects; -import java.util.Set; -import org.checkerframework.checker.nullness.qual.Nullable; -import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags; -import org.openapijsonschematools.client.configurations.SchemaConfiguration; -import org.openapijsonschematools.client.exceptions.UnsetPropertyException; -import org.openapijsonschematools.client.exceptions.ValidationException; -import org.openapijsonschematools.client.paths.petfindbytags.get.parameters.parameter0.Schema0; -import org.openapijsonschematools.client.schemas.AnyTypeJsonSchema; -import org.openapijsonschematools.client.schemas.GenericBuilder; -import org.openapijsonschematools.client.schemas.NotAnyTypeJsonSchema; -import org.openapijsonschematools.client.schemas.validation.FrozenList; -import org.openapijsonschematools.client.schemas.validation.FrozenMap; -import org.openapijsonschematools.client.schemas.validation.JsonSchema; -import org.openapijsonschematools.client.schemas.validation.JsonSchemaInfo; -import org.openapijsonschematools.client.schemas.validation.MapSchemaValidator; -import org.openapijsonschematools.client.schemas.validation.MapUtils; -import org.openapijsonschematools.client.schemas.validation.PathToSchemasMap; -import org.openapijsonschematools.client.schemas.validation.PropertyEntry; -import org.openapijsonschematools.client.schemas.validation.ValidationMetadata; - -public class PetfindbytagsGetQueryParameters { - // nest classes so all schemas and input/output classes can be public - - - public static class AdditionalProperties extends NotAnyTypeJsonSchema.NotAnyTypeJsonSchema1 { - // NotAnyTypeSchema - private static @Nullable AdditionalProperties instance = null; - public static AdditionalProperties getInstance() { - if (instance == null) { - instance = new AdditionalProperties(); - } - return instance; - } - } - - - public static class QueryParametersMap extends FrozenMap { - protected QueryParametersMap(FrozenMap m) { - super(m); - } - public static final Set requiredKeys = Set.of( - "tags" - ); - public static final Set optionalKeys = Set.of(); - public static QueryParametersMap of(Map> arg, SchemaConfiguration configuration) throws ValidationException { - return PetfindbytagsGetQueryParameters1.getInstance().validate(arg, configuration); - } - - public Schema0.SchemaList0 tags() { - try { - return getOrThrow("version"); - } catch (UnsetPropertyException e) { - throw new RuntimeException(e); - } - } - } - - public interface SetterForTags { - Map> getInstance(); - T getBuilderAfterTags(Map> instance); - - default T tags(List value) { - var instance = getInstance(); - instance.put("tags", value); - return getBuilderAfterTags(instance); - } - } - - public static class QueryParametersMap0Builder implements GenericBuilder>> { - private final Map> instance; - private static final Set knownKeys = Set.of( - "tags" - ); - public Set getKnownKeys() { - return knownKeys; - } - public QueryParametersMap0Builder(Map> instance) { - this.instance = instance; - } - public Map> build() { - return instance; - } - } - - public static class QueryParametersMapBuilder implements SetterForTags { - private final Map> instance; - public QueryParametersMapBuilder() { - this.instance = new LinkedHashMap<>(); - } - public Map> getInstance() { - return instance; - } - public QueryParametersMap0Builder getBuilderAfterTags(Map> instance) { - return new QueryParametersMap0Builder(instance); - } - } - - - public sealed interface PetfindbytagsGetQueryParameters1Boxed permits PetfindbytagsGetQueryParameters1BoxedMap { - @Nullable Object getData(); - } - - public record PetfindbytagsGetQueryParameters1BoxedMap(QueryParametersMap data) implements PetfindbytagsGetQueryParameters1Boxed { - @Override - public @Nullable Object getData() { - return data; - } - } - - - public static class PetfindbytagsGetQueryParameters1 extends JsonSchema implements MapSchemaValidator { - private static @Nullable PetfindbytagsGetQueryParameters1 instance = null; - - protected PetfindbytagsGetQueryParameters1() { - super(new JsonSchemaInfo() - .type(Set.of(Map.class)) - .properties(Map.ofEntries( - new PropertyEntry("tags", Schema0.Schema01.class) - )) - .required(Set.of( - "tags" - )) - .additionalProperties(AdditionalProperties.class) - ); - } - - public static PetfindbytagsGetQueryParameters1 getInstance() { - if (instance == null) { - instance = new PetfindbytagsGetQueryParameters1(); - } - return instance; - } - - 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 RuntimeException("Invalid non-string key value"); - } - String propertyName = (String) entryKey; - List propertyPathToItem = new ArrayList<>(pathToItem); - propertyPathToItem.add(propertyName); - Object value = entry.getValue(); - LinkedHashMap, Nothing?> schemas = pathToSchemas.get(propertyPathToItem); - if (schemas == null) { - throw new RuntimeException("Validation 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"); - } - properties.put(propertyName, (Schema0.SchemaList0) propertyInstance); - } - FrozenMap castProperties = new FrozenMap<>(properties); - return new QueryParametersMap(castProperties); - } - - 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); - SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().build())); - ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, new PathToSchemasMap(), new LinkedHashSet<>()); - PathToSchemasMap pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet); - return getNewInstance(castArg, validationMetadata.pathToItem(), pathToSchemasMap); - } - - - @Override - public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws 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"); - } - @Override - public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { - if (arg instanceof Map) { - return getNewInstance((Map) arg, pathToItem, pathToSchemas); - } - throw new RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); - } - @Override - public PetfindbytagsGetQueryParameters1BoxedMap validateAndBox(Map arg, SchemaConfiguration configuration) throws ValidationException { - return new PetfindbytagsGetQueryParameters1BoxedMap(validate(arg, configuration)); - } - @Override - public PetfindbytagsGetQueryParameters1Boxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { - 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"); - } - } - -} diff --git a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/petfindbytags/get/PetfindbytagsGetResponses.kt b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/petfindbytags/get/PetfindbytagsGetResponses.kt deleted file mode 100644 index 2070049e403..00000000000 --- a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/petfindbytags/get/PetfindbytagsGetResponses.kt +++ /dev/null @@ -1,66 +0,0 @@ -package org.openapijsonschematools.client.paths.petfindbytags.get; - -import org.openapijsonschematools.client.paths.petfindbytags.get.responses.PetfindbytagsGetCode200Response; -import org.openapijsonschematools.client.paths.petfindbytags.get.responses.PetfindbytagsGetCode400Response; -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; -import org.checkerframework.checker.nullness.qual.Nullable; - -import java.net.http.HttpResponse; -import java.util.Map; -import java.util.AbstractMap; - -public class PetfindbytagsGetResponses { - public sealed interface EndpointResponse permits EndpointPetfindbytagsGetCode200Response {} - - public record EndpointPetfindbytagsGetCode200Response( - HttpResponse response, - PetfindbytagsGetCode200Response.SealedResponseBody body, - Nothing? headers - ) implements EndpointResponse, ApiResponse{ - } - - public sealed interface StatusCodeResponseDeserializer permits StatusPetfindbytagsGetCode200ResponseDeserializer, StatusPetfindbytagsGetCode400ResponseDeserializer {} - - public static final class StatusPetfindbytagsGetCode200ResponseDeserializer extends PetfindbytagsGetCode200Response.PetfindbytagsGetCode200Response1 implements StatusCodeResponseDeserializer { - } - public static final class StatusPetfindbytagsGetCode400ResponseDeserializer extends PetfindbytagsGetCode400Response.PetfindbytagsGetCode400Response1 implements StatusCodeResponseDeserializer { - } - - public static final class PetfindbytagsGetResponses1 implements ResponsesDeserializer { - private final Map statusCodeToResponseDeserializer; - public PetfindbytagsGetResponses1() { - this.statusCodeToResponseDeserializer = Map.ofEntries( - new AbstractMap.SimpleEntry<>("200", new StatusPetfindbytagsGetCode200ResponseDeserializer()), - new AbstractMap.SimpleEntry<>("400", new StatusPetfindbytagsGetCode400ResponseDeserializer()) - ); - } - - 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) { - throw new ApiException( - "Invalid response statusCode="+statusCode+" has no response defined in the openapi document", - response - ); - } - if (statusCodeDeserializer instanceof StatusPetfindbytagsGetCode200ResponseDeserializer castDeserializer) { - var deserializedResponse = castDeserializer.deserialize(response, configuration); - return new EndpointPetfindbytagsGetCode200Response(response, deserializedResponse.body(), deserializedResponse.headers()); - } else { - StatusPetfindbytagsGetCode400ResponseDeserializer castDeserializer = (StatusPetfindbytagsGetCode400ResponseDeserializer) statusCodeDeserializer; - var deserializedResponse = castDeserializer.deserialize(response, configuration); - throw new PetfindbytagsGetCode400Response.ResponseApiException( - "Received error statusCode response from server", - response, - deserializedResponse - ); - } - } - } -} diff --git a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/petfindbytags/get/PetfindbytagsGetSecurityInfo.kt b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/petfindbytags/get/PetfindbytagsGetSecurityInfo.kt deleted file mode 100644 index 4c4856f98eb..00000000000 --- a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/petfindbytags/get/PetfindbytagsGetSecurityInfo.kt +++ /dev/null @@ -1,33 +0,0 @@ -package org.openapijsonschematools.client.paths.petfindbytags.get; - -import org.openapijsonschematools.client.paths.petfindbytags.get.security.PetfindbytagsGetSecurityRequirementObject0; -import org.openapijsonschematools.client.paths.petfindbytags.get.security.PetfindbytagsGetSecurityRequirementObject1; -import org.openapijsonschematools.client.securityrequirementobjects.SecurityRequirementObject; -import org.openapijsonschematools.client.securityrequirementobjects.SecurityRequirementObjectProvider; - -public class PetfindbytagsGetSecurityInfo { - public static class PetfindbytagsGetSecurityInfo1 implements SecurityRequirementObjectProvider { - public final PetfindbytagsGetSecurityRequirementObject0 security0; - public final PetfindbytagsGetSecurityRequirementObject1 security1; - - public PetfindbytagsGetSecurityInfo1() { - security0 = new PetfindbytagsGetSecurityRequirementObject0(); - security1 = new PetfindbytagsGetSecurityRequirementObject1(); - } - - @Override - public SecurityRequirementObject getSecurityRequirementObject(SecurityIndex securityIndex) { - switch (securityIndex) { - case SECURITY_0: - return security0; - default: - return security1; - } - } - } - - public enum SecurityIndex { - SECURITY_0, - SECURITY_1 - } -} \ No newline at end of file diff --git a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/petfindbytags/get/parameters/Parameter0.kt b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/petfindbytags/get/parameters/Parameter0.kt deleted file mode 100644 index 43633e1742d..00000000000 --- a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/petfindbytags/get/parameters/Parameter0.kt +++ /dev/null @@ -1,23 +0,0 @@ -package org.openapijsonschematools.client.paths.petfindbytags.get.parameters; - -import org.openapijsonschematools.client.parameter.ParameterStyle; -import org.openapijsonschematools.client.parameter.ParameterInType; -import org.openapijsonschematools.client.parameter.SchemaParameter; -import org.openapijsonschematools.client.paths.petfindbytags.get.parameters.parameter0.Schema0; - -public class Parameter0 { - - public static class Parameter01 extends SchemaParameter { - public Parameter01() { - super( - "tags", - ParameterInType.QUERY, - true, - ParameterStyle.FORM, - false, - false, - Schema0.Schema01.getInstance() - ); - } - } -} diff --git a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/petfindbytags/get/parameters/parameter0/Schema0.kt b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/petfindbytags/get/parameters/parameter0/Schema0.kt deleted file mode 100644 index 51bfffac734..00000000000 --- a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/petfindbytags/get/parameters/parameter0/Schema0.kt +++ /dev/null @@ -1,157 +0,0 @@ -package org.openapijsonschematools.client.paths.petfindbytags.get.parameters.parameter0; -import java.util.ArrayList; -import java.util.HashSet; -import java.util.LinkedHashMap; -import java.util.LinkedHashSet; -import java.util.List; -import java.util.Objects; -import java.util.Set; -import org.checkerframework.checker.nullness.qual.Nullable; -import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags; -import org.openapijsonschematools.client.configurations.SchemaConfiguration; -import org.openapijsonschematools.client.exceptions.ValidationException; -import org.openapijsonschematools.client.schemas.StringJsonSchema; -import org.openapijsonschematools.client.schemas.validation.FrozenList; -import org.openapijsonschematools.client.schemas.validation.JsonSchema; -import org.openapijsonschematools.client.schemas.validation.JsonSchemaInfo; -import org.openapijsonschematools.client.schemas.validation.ListSchemaValidator; -import org.openapijsonschematools.client.schemas.validation.PathToSchemasMap; -import org.openapijsonschematools.client.schemas.validation.ValidationMetadata; - -public class Schema0 { - // nest classes so all schemas and input/output classes can be public - - - public static class Items0 extends StringJsonSchema.StringJsonSchema1 { - private static @Nullable Items0 instance = null; - public static Items0 getInstance() { - if (instance == null) { - instance = new Items0(); - } - return instance; - } - } - - - public static class SchemaList0 extends FrozenList { - protected SchemaList0(FrozenList m) { - super(m); - } - public static SchemaList0 of(List arg, SchemaConfiguration configuration) throws ValidationException { - return Schema01.getInstance().validate(arg, configuration); - } - } - - public static class SchemaListBuilder0 { - // class to build List - private final List list; - - public SchemaListBuilder0() { - list = new ArrayList<>(); - } - - public SchemaListBuilder0(List list) { - this.list = list; - } - - public SchemaListBuilder0 add(String item) { - list.add(item); - return this; - } - - public List build() { - return list; - } - } - - - public sealed interface Schema01Boxed permits Schema01BoxedList { - @Nullable Object getData(); - } - - public record Schema01BoxedList(SchemaList0 data) implements Schema01Boxed { - @Override - public @Nullable Object getData() { - return data; - } - } - - - - public static class Schema01 extends JsonSchema implements ListSchemaValidator { - private static @Nullable Schema01 instance = null; - - protected Schema01() { - super(new JsonSchemaInfo() - .type(Set.of(List.class)) - .items(Items0.class) - ); - } - - public static Schema01 getInstance() { - if (instance == null) { - instance = new Schema01(); - } - return instance; - } - - @Override - public SchemaList0 getNewInstance(List arg, List pathToItem, PathToSchemasMap pathToSchemas) { - List items = new ArrayList<>(); - int i = 0; - for (Object item: arg) { - List itemPathToItem = new ArrayList<>(pathToItem); - itemPathToItem.add(i); - LinkedHashMap, Nothing?> schemas = pathToSchemas.get(itemPathToItem); - if (schemas == null) { - throw new RuntimeException("Validation 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"); - } - items.add((String) itemInstance); - i += 1; - } - FrozenList newInstanceItems = new FrozenList<>(items); - return new SchemaList0(newInstanceItems); - } - - 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); - SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().build())); - ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, new PathToSchemasMap(), new LinkedHashSet<>()); - PathToSchemasMap pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet); - return getNewInstance(castArg, validationMetadata.pathToItem(), pathToSchemasMap); - } - - @Override - public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws 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"); - } - @Override - public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { - 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"); - } - @Override - 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 { - 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"); - } - } -} diff --git a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/petfindbytags/get/responses/PetfindbytagsGetCode200Response.kt b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/petfindbytags/get/responses/PetfindbytagsGetCode200Response.kt deleted file mode 100644 index bd576d29b7e..00000000000 --- a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/petfindbytags/get/responses/PetfindbytagsGetCode200Response.kt +++ /dev/null @@ -1,7 +0,0 @@ -package org.openapijsonschematools.client.paths.petfindbytags.get.responses; - -import org.openapijsonschematools.client.components.responses.RefSuccessfulXmlAndJsonArrayOfPet; - -public class PetfindbytagsGetCode200Response extends RefSuccessfulXmlAndJsonArrayOfPet { - public static class PetfindbytagsGetCode200Response1 extends RefSuccessfulXmlAndJsonArrayOfPet1 {} -} diff --git a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/petfindbytags/get/responses/PetfindbytagsGetCode400Response.kt b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/petfindbytags/get/responses/PetfindbytagsGetCode400Response.kt deleted file mode 100644 index e54e8b95c8a..00000000000 --- a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/petfindbytags/get/responses/PetfindbytagsGetCode400Response.kt +++ /dev/null @@ -1,45 +0,0 @@ -package org.openapijsonschematools.client.paths.petfindbytags.get.responses; - -import org.openapijsonschematools.client.configurations.SchemaConfiguration; -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; -import java.net.http.HttpResponse; -import java.net.http.HttpHeaders; - -public class PetfindbytagsGetCode400Response { - - public static class PetfindbytagsGetCode400Response1 extends ResponseDeserializer { - public PetfindbytagsGetCode400Response1() { - super( - MapUtils.makeMap( - ) - ); - } - - @Override - protected Nothing? getBody(String contentType, Nothing? mediaType, byte[] body, SchemaConfiguration configuration) { - return null; - } - - @Override - protected Nothing? getHeaders(HttpHeaders headers, SchemaConfiguration configuration) { - return null; - } - } - - @SuppressWarnings("serial") - public static class ResponseApiException extends ApiException { - public DeserializedHttpResponse deserializedResponse; - - public ResponseApiException(String s, HttpResponse response, DeserializedHttpResponse deserializedResponse) { - super(s, response); - this.deserializedResponse = deserializedResponse; - } - } -} diff --git a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/petfindbytags/get/security/PetfindbytagsGetSecurityRequirementObject0.kt b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/petfindbytags/get/security/PetfindbytagsGetSecurityRequirementObject0.kt deleted file mode 100644 index 5ce1d1f7054..00000000000 --- a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/petfindbytags/get/security/PetfindbytagsGetSecurityRequirementObject0.kt +++ /dev/null @@ -1,24 +0,0 @@ -package org.openapijsonschematools.client.paths.petfindbytags.get.security; - -import org.checkerframework.checker.nullness.qual.Nullable; -import org.openapijsonschematools.client.securityrequirementobjects.SecurityRequirementObject; -import org.openapijsonschematools.client.securityschemes.SecurityScheme; -import org.openapijsonschematools.client.components.securityschemes.HttpSignatureTest; - -import java.util.List; -import java.util.Map; -import java.util.AbstractMap; - -public class PetfindbytagsGetSecurityRequirementObject0 extends SecurityRequirementObject { - - public PetfindbytagsGetSecurityRequirementObject0() { - super( - Map.ofEntries( - new AbstractMap.SimpleEntry, List>( - HttpSignatureTest.class, - List.of() - ) - ) - ); - } -} diff --git a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/petfindbytags/get/security/PetfindbytagsGetSecurityRequirementObject1.kt b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/petfindbytags/get/security/PetfindbytagsGetSecurityRequirementObject1.kt deleted file mode 100644 index 2f7ef1e7674..00000000000 --- a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/petfindbytags/get/security/PetfindbytagsGetSecurityRequirementObject1.kt +++ /dev/null @@ -1,24 +0,0 @@ -package org.openapijsonschematools.client.paths.petfindbytags.get.security; - -import org.checkerframework.checker.nullness.qual.Nullable; -import org.openapijsonschematools.client.securityrequirementobjects.SecurityRequirementObject; -import org.openapijsonschematools.client.securityschemes.SecurityScheme; -import org.openapijsonschematools.client.components.securityschemes.PetstoreAuth; - -import java.util.List; -import java.util.Map; -import java.util.AbstractMap; - -public class PetfindbytagsGetSecurityRequirementObject1 extends SecurityRequirementObject { - - public PetfindbytagsGetSecurityRequirementObject1() { - super( - Map.ofEntries( - new AbstractMap.SimpleEntry, List>( - PetstoreAuth.class, - List.of("write:pets", "read:pets") - ) - ) - ); - } -} diff --git a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/petpetid/PetpetidDelete.kt b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/petpetid/PetpetidDelete.kt deleted file mode 100644 index 1a7e142619e..00000000000 --- a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/petpetid/PetpetidDelete.kt +++ /dev/null @@ -1,236 +0,0 @@ -package org.openapijsonschematools.client.paths.petpetid; - -import org.checkerframework.checker.nullness.qual.Nullable; -import org.openapijsonschematools.client.paths.petpetid.delete.PetpetidDeleteHeaderParameters; -import org.openapijsonschematools.client.RootServerInfo; -import org.openapijsonschematools.client.paths.petpetid.delete.PetpetidDeleteSecurityInfo; -import org.openapijsonschematools.client.paths.petpetid.delete.PetpetidDeletePathParameters; -import org.openapijsonschematools.client.paths.petpetid.delete.Parameters; -import org.openapijsonschematools.client.paths.petpetid.delete.PetpetidDeleteResponses; -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.paths.Petpetid; -import org.openapijsonschematools.client.securityrequirementobjects.SecurityRequirementObject; -import org.openapijsonschematools.client.securityrequirementobjects.AuthApplier; - -import java.io.IOException; -import java.net.http.HttpClient; -import java.net.http.HttpRequest; -import java.time.Duration; -import java.util.List; -import java.util.Map; - -public class PetpetidDelete { - private static class DeleteProvider extends AuthApplier { - private static final String method = "delete"; - - public static Nothing? delete( - DeleteRequest request, - ApiConfiguration apiConfiguration, - SchemaConfiguration schemaConfiguration, - HttpClient client - ) throws IOException, InterruptedException, ValidationException, NotImplementedException, ApiException { - Map> headers = apiConfiguration.getDefaultHeaders(); - HttpRequest.BodyPublisher bodyPublisher = HttpRequest.BodyPublishers.noBody(); - - if (request.headerParameters != null) { - var headersSerializer = new Parameters.HeaderParametersSerializer(); - Map> serializedHeaders = headersSerializer.serialize(request.headerParameters); - headers.putAll(serializedHeaders); - } - - var pathSerializer = new Parameters.PathParametersSerializer(); - String updatedPath = pathSerializer.serialize(request.pathParameters, Petpetid.path); - // TODO set this to a map if there is a query security scheme - @Nullable Map queryMap = null; - String host = apiConfiguration.getServer(request.serverIndex).url(); - SecurityRequirementObject securityRequirementObject = apiConfiguration.getSecurityRequirementObject(request.securityIndex); - updateParamsForAuth( - securityRequirementObject, - headers, - updatedPath, - method, - bodyPublisher, - queryMap, - apiConfiguration - ); - - String url = host + updatedPath; - var httpRequest = RestClient.getRequest( - url, - method, - bodyPublisher, - headers, - request.timeout - ); - var response = RestClient.getResponse(httpRequest, client); - return (Nothing?) null; - } - } - - public interface DeleteOperation { - ApiConfiguration getApiConfiguration(); - SchemaConfiguration getSchemaConfiguration(); - HttpClient getClient(); - default Nothing? delete(DeleteRequest request) throws IOException, InterruptedException, ValidationException, NotImplementedException, ApiException { - return DeleteProvider.delete(request, getApiConfiguration(), getSchemaConfiguration(), getClient()); - } - } - - public interface DeletePetOperation { - ApiConfiguration getApiConfiguration(); - SchemaConfiguration getSchemaConfiguration(); - HttpClient getClient(); - default Nothing? deletePet(DeleteRequest request) throws IOException, InterruptedException, ValidationException, NotImplementedException, ApiException { - return DeleteProvider.delete(request, getApiConfiguration(), getSchemaConfiguration(), getClient()); - } - } - - public static class Delete extends ApiClient implements DeleteOperation { - public Delete(ApiConfiguration apiConfiguration, SchemaConfiguration schemaConfiguration) { - super(apiConfiguration, schemaConfiguration); - } - } - - public static class DeleteRequest { - public PetpetidDeletePathParameters.PathParametersMap pathParameters; - public PetpetidDeleteHeaderParameters.@Nullable HeaderParametersMap headerParameters; - public RootServerInfo.@Nullable ServerIndex serverIndex; - public PetpetidDeleteSecurityInfo.@Nullable SecurityIndex securityIndex; - public @Nullable Duration timeout; - - public DeleteRequest( - PetpetidDeletePathParameters.PathParametersMap pathParameters, - PetpetidDeleteHeaderParameters.@Nullable HeaderParametersMap headerParameters, - RootServerInfo.@Nullable ServerIndex serverIndex, - PetpetidDeleteSecurityInfo.@Nullable SecurityIndex securityIndex, - @Nullable Duration timeout - ) { - this.pathParameters = pathParameters; - this.headerParameters = headerParameters; - this.serverIndex = serverIndex; - this.securityIndex = securityIndex; - this.timeout = timeout; - } - } - - public static class DeleteNullableRequest { - public PetpetidDeletePathParameters.@Nullable PathParametersMap pathParameters; - public PetpetidDeleteHeaderParameters.@Nullable HeaderParametersMap headerParameters; - public RootServerInfo.@Nullable ServerIndex serverIndex; - public PetpetidDeleteSecurityInfo.@Nullable SecurityIndex securityIndex; - public @Nullable Duration timeout; - } - - public interface SetterForHeaderParameters { - DeleteNullableRequest getInstance(); - T getBuilderAfterHeaderParameters(DeleteNullableRequest instance); - default T headerParameters(PetpetidDeleteHeaderParameters.HeaderParametersMap headerParameters) { - var instance = getInstance(); - instance.headerParameters = headerParameters; - return getBuilderAfterHeaderParameters(instance); - } - } - - public interface SetterForServerIndex { - DeleteNullableRequest getInstance(); - T getBuilderAfterServerIndex(DeleteNullableRequest instance); - default T serverIndex(RootServerInfo.ServerIndex serverIndex) { - var instance = getInstance(); - instance.serverIndex = serverIndex; - return getBuilderAfterServerIndex(instance); - } - } - - public interface SetterForSecurityIndex { - DeleteNullableRequest getInstance(); - T getBuilderAfterSecurityIndex(DeleteNullableRequest instance); - default T securityIndex(PetpetidDeleteSecurityInfo.SecurityIndex securityIndex) { - var instance = getInstance(); - instance.securityIndex = securityIndex; - return getBuilderAfterSecurityIndex(instance); - } - } - - public interface SetterForTimeout { - DeleteNullableRequest getInstance(); - T getBuilderAfterTimeout(DeleteNullableRequest instance); - default T timeout(Duration timeout) { - var instance = getInstance(); - instance.timeout = timeout; - return getBuilderAfterTimeout(instance); - } - } - - public interface SetterForPathParameters { - DeleteNullableRequest getInstance(); - T getBuilderAfterPathParameters(DeleteNullableRequest instance); - default T pathParameters(PetpetidDeletePathParameters.PathParametersMap pathParameters) { - var instance = getInstance(); - instance.pathParameters = pathParameters; - return getBuilderAfterPathParameters(instance); - } - } - - public static class Delete0RequestBuilder implements SetterForHeaderParameters, SetterForServerIndex, SetterForSecurityIndex, SetterForTimeout { - private final DeleteNullableRequest instance; - - public Delete0RequestBuilder(DeleteNullableRequest instance) { - this.instance = instance; - } - - public DeleteRequest build() { - var pathParameters = instance.pathParameters; - if (pathParameters == null) { - throw new RuntimeException("invalid null value for required parameter"); - } - return new DeleteRequest( - pathParameters, - instance.headerParameters, - instance.serverIndex, - instance.securityIndex, - instance.timeout - ); - } - - public DeleteNullableRequest getInstance() { - return instance; - } - - public Delete0RequestBuilder getBuilderAfterHeaderParameters(DeleteNullableRequest instance) { - return this; - } - - public Delete0RequestBuilder getBuilderAfterServerIndex(DeleteNullableRequest instance) { - return this; - } - - public Delete0RequestBuilder getBuilderAfterSecurityIndex(DeleteNullableRequest instance) { - return this; - } - - public Delete0RequestBuilder getBuilderAfterTimeout(DeleteNullableRequest instance) { - return this; - } - } - public static class DeleteRequestBuilder implements SetterForPathParameters { - private final DeleteNullableRequest instance; - - public DeleteRequestBuilder() { - this.instance = new DeleteNullableRequest(); - } - - public DeleteNullableRequest getInstance() { - return instance; - } - - public Delete0RequestBuilder getBuilderAfterPathParameters(DeleteNullableRequest instance) { - return new Delete0RequestBuilder(instance); - } - } -} diff --git a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/petpetid/PetpetidGet.kt b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/petpetid/PetpetidGet.kt deleted file mode 100644 index b7cdbb9ddc1..00000000000 --- a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/petpetid/PetpetidGet.kt +++ /dev/null @@ -1,211 +0,0 @@ -package org.openapijsonschematools.client.paths.petpetid; - -import org.checkerframework.checker.nullness.qual.Nullable; -import org.openapijsonschematools.client.RootServerInfo; -import org.openapijsonschematools.client.paths.petpetid.get.PetpetidGetSecurityInfo; -import org.openapijsonschematools.client.paths.petpetid.get.PetpetidGetPathParameters; -import org.openapijsonschematools.client.paths.petpetid.get.Parameters; -import org.openapijsonschematools.client.paths.petpetid.get.PetpetidGetResponses; -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.paths.Petpetid; -import org.openapijsonschematools.client.securityrequirementobjects.SecurityRequirementObject; -import org.openapijsonschematools.client.securityrequirementobjects.AuthApplier; - -import java.io.IOException; -import java.net.http.HttpClient; -import java.net.http.HttpRequest; -import java.time.Duration; -import java.util.List; -import java.util.Map; - -public class PetpetidGet { - private static class GetProvider extends AuthApplier { - private static final String method = "get"; - - public static PetpetidGetResponses.EndpointResponse get( - GetRequest request, - ApiConfiguration apiConfiguration, - SchemaConfiguration schemaConfiguration, - HttpClient client - ) throws IOException, InterruptedException, ValidationException, NotImplementedException, ApiException { - Map> headers = apiConfiguration.getDefaultHeaders(); - HttpRequest.BodyPublisher bodyPublisher = HttpRequest.BodyPublishers.noBody(); - - var pathSerializer = new Parameters.PathParametersSerializer(); - String updatedPath = pathSerializer.serialize(request.pathParameters, Petpetid.path); - // TODO set this to a map if there is a query security scheme - @Nullable Map queryMap = null; - String host = apiConfiguration.getServer(request.serverIndex).url(); - SecurityRequirementObject securityRequirementObject = apiConfiguration.getSecurityRequirementObject(request.securityIndex); - updateParamsForAuth( - securityRequirementObject, - headers, - updatedPath, - method, - bodyPublisher, - queryMap, - apiConfiguration - ); - - String url = host + updatedPath; - var httpRequest = RestClient.getRequest( - url, - method, - bodyPublisher, - headers, - request.timeout - ); - var response = RestClient.getResponse(httpRequest, client); - var responsesDeserializer = new PetpetidGetResponses.PetpetidGetResponses1(); - return responsesDeserializer.deserialize(response, schemaConfiguration); - } - } - - public interface GetOperation { - ApiConfiguration getApiConfiguration(); - SchemaConfiguration getSchemaConfiguration(); - HttpClient getClient(); - default PetpetidGetResponses.EndpointResponse get(GetRequest request) throws IOException, InterruptedException, ValidationException, NotImplementedException, ApiException { - return GetProvider.get(request, getApiConfiguration(), getSchemaConfiguration(), getClient()); - } - } - - public interface GetPetByIdOperation { - ApiConfiguration getApiConfiguration(); - SchemaConfiguration getSchemaConfiguration(); - HttpClient getClient(); - default PetpetidGetResponses.EndpointResponse getPetById(GetRequest request) throws IOException, InterruptedException, ValidationException, NotImplementedException, ApiException { - return GetProvider.get(request, getApiConfiguration(), getSchemaConfiguration(), getClient()); - } - } - - public static class Get extends ApiClient implements GetOperation { - public Get(ApiConfiguration apiConfiguration, SchemaConfiguration schemaConfiguration) { - super(apiConfiguration, schemaConfiguration); - } - } - - public static class GetRequest { - public PetpetidGetPathParameters.PathParametersMap pathParameters; - public RootServerInfo.@Nullable ServerIndex serverIndex; - public PetpetidGetSecurityInfo.@Nullable SecurityIndex securityIndex; - public @Nullable Duration timeout; - - public GetRequest( - PetpetidGetPathParameters.PathParametersMap pathParameters, - RootServerInfo.@Nullable ServerIndex serverIndex, - PetpetidGetSecurityInfo.@Nullable SecurityIndex securityIndex, - @Nullable Duration timeout - ) { - this.pathParameters = pathParameters; - this.serverIndex = serverIndex; - this.securityIndex = securityIndex; - this.timeout = timeout; - } - } - - public static class GetNullableRequest { - public PetpetidGetPathParameters.@Nullable PathParametersMap pathParameters; - public RootServerInfo.@Nullable ServerIndex serverIndex; - public PetpetidGetSecurityInfo.@Nullable SecurityIndex securityIndex; - public @Nullable Duration timeout; - } - - public interface SetterForServerIndex { - GetNullableRequest getInstance(); - T getBuilderAfterServerIndex(GetNullableRequest instance); - default T serverIndex(RootServerInfo.ServerIndex serverIndex) { - var instance = getInstance(); - instance.serverIndex = serverIndex; - return getBuilderAfterServerIndex(instance); - } - } - - public interface SetterForSecurityIndex { - GetNullableRequest getInstance(); - T getBuilderAfterSecurityIndex(GetNullableRequest instance); - default T securityIndex(PetpetidGetSecurityInfo.SecurityIndex securityIndex) { - var instance = getInstance(); - instance.securityIndex = securityIndex; - return getBuilderAfterSecurityIndex(instance); - } - } - - public interface SetterForTimeout { - GetNullableRequest getInstance(); - T getBuilderAfterTimeout(GetNullableRequest instance); - default T timeout(Duration timeout) { - var instance = getInstance(); - instance.timeout = timeout; - return getBuilderAfterTimeout(instance); - } - } - - public interface SetterForPathParameters { - GetNullableRequest getInstance(); - T getBuilderAfterPathParameters(GetNullableRequest instance); - default T pathParameters(PetpetidGetPathParameters.PathParametersMap pathParameters) { - var instance = getInstance(); - instance.pathParameters = pathParameters; - return getBuilderAfterPathParameters(instance); - } - } - - public static class Get0RequestBuilder implements SetterForServerIndex, SetterForSecurityIndex, SetterForTimeout { - private final GetNullableRequest instance; - - public Get0RequestBuilder(GetNullableRequest instance) { - this.instance = instance; - } - - public GetRequest build() { - var pathParameters = instance.pathParameters; - if (pathParameters == null) { - throw new RuntimeException("invalid null value for required parameter"); - } - return new GetRequest( - pathParameters, - instance.serverIndex, - instance.securityIndex, - instance.timeout - ); - } - - public GetNullableRequest getInstance() { - return instance; - } - - public Get0RequestBuilder getBuilderAfterServerIndex(GetNullableRequest instance) { - return this; - } - - public Get0RequestBuilder getBuilderAfterSecurityIndex(GetNullableRequest instance) { - return this; - } - - public Get0RequestBuilder getBuilderAfterTimeout(GetNullableRequest instance) { - return this; - } - } - public static class GetRequestBuilder implements SetterForPathParameters { - private final GetNullableRequest instance; - - public GetRequestBuilder() { - this.instance = new GetNullableRequest(); - } - - public GetNullableRequest getInstance() { - return instance; - } - - public Get0RequestBuilder getBuilderAfterPathParameters(GetNullableRequest instance) { - return new Get0RequestBuilder(instance); - } - } -} diff --git a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/petpetid/PetpetidPost.kt b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/petpetid/PetpetidPost.kt deleted file mode 100644 index 536613af171..00000000000 --- a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/petpetid/PetpetidPost.kt +++ /dev/null @@ -1,242 +0,0 @@ -package org.openapijsonschematools.client.paths.petpetid; - -import org.checkerframework.checker.nullness.qual.Nullable; -import org.openapijsonschematools.client.paths.petpetid.post.PetpetidPostRequestBody; -import org.openapijsonschematools.client.RootServerInfo; -import org.openapijsonschematools.client.paths.petpetid.post.PetpetidPostSecurityInfo; -import org.openapijsonschematools.client.paths.petpetid.post.PetpetidPostPathParameters; -import org.openapijsonschematools.client.paths.petpetid.post.Parameters; -import org.openapijsonschematools.client.paths.petpetid.post.PetpetidPostResponses; -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.requestbody.SerializedRequestBody; -import org.openapijsonschematools.client.paths.Petpetid; -import org.openapijsonschematools.client.securityrequirementobjects.SecurityRequirementObject; -import org.openapijsonschematools.client.securityrequirementobjects.AuthApplier; - -import java.io.IOException; -import java.util.ArrayList; -import java.net.http.HttpClient; -import java.net.http.HttpRequest; -import java.time.Duration; -import java.util.List; -import java.util.Map; - -public class PetpetidPost { - private static class PostProvider extends AuthApplier { - private static final String method = "post"; - - public static Nothing? post( - PostRequest request, - ApiConfiguration apiConfiguration, - SchemaConfiguration schemaConfiguration, - HttpClient client - ) throws IOException, InterruptedException, ValidationException, NotImplementedException, ApiException { - Map> headers = apiConfiguration.getDefaultHeaders(); - - @Nullable SerializedRequestBody serializedRequestBody; - HttpRequest.BodyPublisher bodyPublisher = HttpRequest.BodyPublishers.noBody(); - if (request.requestBody != null) { - serializedRequestBody = new PetpetidPostRequestBody.PetpetidPostRequestBody1().serialize( - request.requestBody - ); - var contentTypeHeaderValues = headers.getOrDefault("Content-Type", new ArrayList<>()); - contentTypeHeaderValues.add(serializedRequestBody.contentType); - bodyPublisher = serializedRequestBody.bodyPublisher; - } - - var pathSerializer = new Parameters.PathParametersSerializer(); - String updatedPath = pathSerializer.serialize(request.pathParameters, Petpetid.path); - // TODO set this to a map if there is a query security scheme - @Nullable Map queryMap = null; - String host = apiConfiguration.getServer(request.serverIndex).url(); - SecurityRequirementObject securityRequirementObject = apiConfiguration.getSecurityRequirementObject(request.securityIndex); - updateParamsForAuth( - securityRequirementObject, - headers, - updatedPath, - method, - bodyPublisher, - queryMap, - apiConfiguration - ); - - String url = host + updatedPath; - var httpRequest = RestClient.getRequest( - url, - method, - bodyPublisher, - headers, - request.timeout - ); - var response = RestClient.getResponse(httpRequest, client); - return (Nothing?) null; - } - } - - public interface PostOperation { - ApiConfiguration getApiConfiguration(); - SchemaConfiguration getSchemaConfiguration(); - HttpClient getClient(); - default Nothing? post(PostRequest request) throws IOException, InterruptedException, ValidationException, NotImplementedException, ApiException { - return PostProvider.post(request, getApiConfiguration(), getSchemaConfiguration(), getClient()); - } - } - - public interface UpdatePetWithFormOperation { - ApiConfiguration getApiConfiguration(); - SchemaConfiguration getSchemaConfiguration(); - HttpClient getClient(); - default Nothing? updatePetWithForm(PostRequest request) throws IOException, InterruptedException, ValidationException, NotImplementedException, ApiException { - return PostProvider.post(request, getApiConfiguration(), getSchemaConfiguration(), getClient()); - } - } - - public static class Post extends ApiClient implements PostOperation { - public Post(ApiConfiguration apiConfiguration, SchemaConfiguration schemaConfiguration) { - super(apiConfiguration, schemaConfiguration); - } - } - - public static class PostRequest { - public PetpetidPostPathParameters.PathParametersMap pathParameters; - public PetpetidPostRequestBody.@Nullable SealedRequestBody requestBody; - public RootServerInfo.@Nullable ServerIndex serverIndex; - public PetpetidPostSecurityInfo.@Nullable SecurityIndex securityIndex; - public @Nullable Duration timeout; - - public PostRequest( - PetpetidPostPathParameters.PathParametersMap pathParameters, - PetpetidPostRequestBody.@Nullable SealedRequestBody requestBody, - RootServerInfo.@Nullable ServerIndex serverIndex, - PetpetidPostSecurityInfo.@Nullable SecurityIndex securityIndex, - @Nullable Duration timeout - ) { - this.pathParameters = pathParameters; - this.requestBody = requestBody; - this.serverIndex = serverIndex; - this.securityIndex = securityIndex; - this.timeout = timeout; - } - } - - public static class PostNullableRequest { - public PetpetidPostPathParameters.@Nullable PathParametersMap pathParameters; - public PetpetidPostRequestBody.@Nullable SealedRequestBody requestBody; - public RootServerInfo.@Nullable ServerIndex serverIndex; - public PetpetidPostSecurityInfo.@Nullable SecurityIndex securityIndex; - public @Nullable Duration timeout; - } - - public interface SetterForRequestBody { - PostNullableRequest getInstance(); - T getBuilderAfterRequestBody(PostNullableRequest instance); - default T requestBody(PetpetidPostRequestBody.SealedRequestBody requestBody) { - var instance = getInstance(); - instance.requestBody = requestBody; - return getBuilderAfterRequestBody(instance); - } - } - - public interface SetterForServerIndex { - PostNullableRequest getInstance(); - T getBuilderAfterServerIndex(PostNullableRequest instance); - default T serverIndex(RootServerInfo.ServerIndex serverIndex) { - var instance = getInstance(); - instance.serverIndex = serverIndex; - return getBuilderAfterServerIndex(instance); - } - } - - public interface SetterForSecurityIndex { - PostNullableRequest getInstance(); - T getBuilderAfterSecurityIndex(PostNullableRequest instance); - default T securityIndex(PetpetidPostSecurityInfo.SecurityIndex securityIndex) { - var instance = getInstance(); - instance.securityIndex = securityIndex; - return getBuilderAfterSecurityIndex(instance); - } - } - - public interface SetterForTimeout { - PostNullableRequest getInstance(); - T getBuilderAfterTimeout(PostNullableRequest instance); - default T timeout(Duration timeout) { - var instance = getInstance(); - instance.timeout = timeout; - return getBuilderAfterTimeout(instance); - } - } - - public interface SetterForPathParameters { - PostNullableRequest getInstance(); - T getBuilderAfterPathParameters(PostNullableRequest instance); - default T pathParameters(PetpetidPostPathParameters.PathParametersMap pathParameters) { - var instance = getInstance(); - instance.pathParameters = pathParameters; - return getBuilderAfterPathParameters(instance); - } - } - - public static class Post0RequestBuilder implements SetterForRequestBody, SetterForServerIndex, SetterForSecurityIndex, SetterForTimeout { - private final PostNullableRequest instance; - - public Post0RequestBuilder(PostNullableRequest instance) { - this.instance = instance; - } - - public PostRequest build() { - var pathParameters = instance.pathParameters; - if (pathParameters == null) { - throw new RuntimeException("invalid null value for required parameter"); - } - return new PostRequest( - pathParameters, - instance.requestBody, - instance.serverIndex, - instance.securityIndex, - instance.timeout - ); - } - - public PostNullableRequest getInstance() { - return instance; - } - - public Post0RequestBuilder getBuilderAfterRequestBody(PostNullableRequest instance) { - return this; - } - - public Post0RequestBuilder getBuilderAfterServerIndex(PostNullableRequest instance) { - return this; - } - - public Post0RequestBuilder getBuilderAfterSecurityIndex(PostNullableRequest instance) { - return this; - } - - public Post0RequestBuilder getBuilderAfterTimeout(PostNullableRequest instance) { - return this; - } - } - public static class PostRequestBuilder implements SetterForPathParameters { - private final PostNullableRequest instance; - - public PostRequestBuilder() { - this.instance = new PostNullableRequest(); - } - - public PostNullableRequest getInstance() { - return instance; - } - - public Post0RequestBuilder getBuilderAfterPathParameters(PostNullableRequest instance) { - return new Post0RequestBuilder(instance); - } - } -} diff --git a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/petpetid/delete/Parameters.kt b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/petpetid/delete/Parameters.kt deleted file mode 100644 index d8775b677aa..00000000000 --- a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/petpetid/delete/Parameters.kt +++ /dev/null @@ -1,32 +0,0 @@ -package org.openapijsonschematools.client.paths.petpetid.delete; - -import org.openapijsonschematools.client.paths.petpetid.delete.parameters.Parameter0; -import org.openapijsonschematools.client.paths.petpetid.delete.parameters.Parameter1; -import org.openapijsonschematools.client.parameter.PathSerializer; -import org.openapijsonschematools.client.parameter.HeadersSerializer; - -import java.util.Map; -import java.util.AbstractMap; - -public class Parameters { - - public static class PathParametersSerializer extends PathSerializer { - public PathParametersSerializer() { - super( - Map.ofEntries( - new AbstractMap.SimpleEntry<>("petId", new Parameter1.Parameter11()) - ) - ); - } - } - - public static class HeaderParametersSerializer extends HeadersSerializer { - public HeaderParametersSerializer() { - super( - Map.ofEntries( - new AbstractMap.SimpleEntry<>("api_key", new Parameter0.Parameter01()) - ) - ); - } - } -} diff --git a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/petpetid/delete/PetpetidDeleteHeaderParameters.kt b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/petpetid/delete/PetpetidDeleteHeaderParameters.kt deleted file mode 100644 index 42d57bc3772..00000000000 --- a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/petpetid/delete/PetpetidDeleteHeaderParameters.kt +++ /dev/null @@ -1,191 +0,0 @@ -package org.openapijsonschematools.client.paths.petpetid.delete; -import java.util.ArrayList; -import java.util.HashSet; -import java.util.LinkedHashMap; -import java.util.LinkedHashSet; -import java.util.List; -import java.util.Map; -import java.util.Objects; -import java.util.Set; -import org.checkerframework.checker.nullness.qual.Nullable; -import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags; -import org.openapijsonschematools.client.configurations.SchemaConfiguration; -import org.openapijsonschematools.client.exceptions.UnsetPropertyException; -import org.openapijsonschematools.client.exceptions.ValidationException; -import org.openapijsonschematools.client.paths.petpetid.delete.parameters.parameter0.Schema0; -import org.openapijsonschematools.client.schemas.AnyTypeJsonSchema; -import org.openapijsonschematools.client.schemas.GenericBuilder; -import org.openapijsonschematools.client.schemas.NotAnyTypeJsonSchema; -import org.openapijsonschematools.client.schemas.validation.FrozenMap; -import org.openapijsonschematools.client.schemas.validation.JsonSchema; -import org.openapijsonschematools.client.schemas.validation.JsonSchemaInfo; -import org.openapijsonschematools.client.schemas.validation.MapSchemaValidator; -import org.openapijsonschematools.client.schemas.validation.MapUtils; -import org.openapijsonschematools.client.schemas.validation.PathToSchemasMap; -import org.openapijsonschematools.client.schemas.validation.PropertyEntry; -import org.openapijsonschematools.client.schemas.validation.ValidationMetadata; - -public class PetpetidDeleteHeaderParameters { - // nest classes so all schemas and input/output classes can be public - - - public static class AdditionalProperties extends NotAnyTypeJsonSchema.NotAnyTypeJsonSchema1 { - // NotAnyTypeSchema - private static @Nullable AdditionalProperties instance = null; - public static AdditionalProperties getInstance() { - if (instance == null) { - instance = new AdditionalProperties(); - } - return instance; - } - } - - - public static class HeaderParametersMap extends FrozenMap { - protected HeaderParametersMap(FrozenMap m) { - super(m); - } - public static final Set requiredKeys = Set.of(); - public static final Set optionalKeys = Set.of( - "api_key" - ); - public static HeaderParametersMap of(Map arg, SchemaConfiguration configuration) throws ValidationException { - return PetpetidDeleteHeaderParameters1.getInstance().validate(arg, configuration); - } - - public String api_key() throws UnsetPropertyException { - return getOrThrow("api_key"); - } - } - - public interface SetterForApiKey { - Map getInstance(); - T getBuilderAfterApiKey(Map instance); - - default T api_key(String value) { - var instance = getInstance(); - instance.put("api_key", value); - return getBuilderAfterApiKey(instance); - } - } - - public static class HeaderParametersMapBuilder implements GenericBuilder>, SetterForApiKey { - private final Map instance; - private static final Set knownKeys = Set.of( - "api_key" - ); - public Set getKnownKeys() { - return knownKeys; - } - public HeaderParametersMapBuilder() { - this.instance = new LinkedHashMap<>(); - } - public Map build() { - return instance; - } - public Map getInstance() { - return instance; - } - public HeaderParametersMapBuilder getBuilderAfterApiKey(Map instance) { - return this; - } - } - - - public sealed interface PetpetidDeleteHeaderParameters1Boxed permits PetpetidDeleteHeaderParameters1BoxedMap { - @Nullable Object getData(); - } - - public record PetpetidDeleteHeaderParameters1BoxedMap(HeaderParametersMap data) implements PetpetidDeleteHeaderParameters1Boxed { - @Override - public @Nullable Object getData() { - return data; - } - } - - - public static class PetpetidDeleteHeaderParameters1 extends JsonSchema implements MapSchemaValidator { - private static @Nullable PetpetidDeleteHeaderParameters1 instance = null; - - protected PetpetidDeleteHeaderParameters1() { - super(new JsonSchemaInfo() - .type(Set.of(Map.class)) - .properties(Map.ofEntries( - new PropertyEntry("api_key", Schema0.Schema01.class) - )) - .additionalProperties(AdditionalProperties.class) - ); - } - - public static PetpetidDeleteHeaderParameters1 getInstance() { - if (instance == null) { - instance = new PetpetidDeleteHeaderParameters1(); - } - return instance; - } - - 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 RuntimeException("Invalid non-string key value"); - } - String propertyName = (String) entryKey; - List propertyPathToItem = new ArrayList<>(pathToItem); - propertyPathToItem.add(propertyName); - Object value = entry.getValue(); - LinkedHashMap, Nothing?> schemas = pathToSchemas.get(propertyPathToItem); - if (schemas == null) { - throw new RuntimeException("Validation 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"); - } - properties.put(propertyName, (String) propertyInstance); - } - FrozenMap castProperties = new FrozenMap<>(properties); - return new HeaderParametersMap(castProperties); - } - - 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); - SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().build())); - ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, new PathToSchemasMap(), new LinkedHashSet<>()); - PathToSchemasMap pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet); - return getNewInstance(castArg, validationMetadata.pathToItem(), pathToSchemasMap); - } - - - @Override - public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws 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"); - } - @Override - public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { - if (arg instanceof Map) { - return getNewInstance((Map) arg, pathToItem, pathToSchemas); - } - throw new RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); - } - @Override - public PetpetidDeleteHeaderParameters1BoxedMap validateAndBox(Map arg, SchemaConfiguration configuration) throws ValidationException { - return new PetpetidDeleteHeaderParameters1BoxedMap(validate(arg, configuration)); - } - @Override - public PetpetidDeleteHeaderParameters1Boxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { - 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"); - } - } - -} diff --git a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/petpetid/delete/PetpetidDeletePathParameters.kt b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/petpetid/delete/PetpetidDeletePathParameters.kt deleted file mode 100644 index 1438d8e8d8a..00000000000 --- a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/petpetid/delete/PetpetidDeletePathParameters.kt +++ /dev/null @@ -1,223 +0,0 @@ -package org.openapijsonschematools.client.paths.petpetid.delete; -import java.util.ArrayList; -import java.util.HashSet; -import java.util.LinkedHashMap; -import java.util.LinkedHashSet; -import java.util.List; -import java.util.Map; -import java.util.Objects; -import java.util.Set; -import org.checkerframework.checker.nullness.qual.Nullable; -import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags; -import org.openapijsonschematools.client.configurations.SchemaConfiguration; -import org.openapijsonschematools.client.exceptions.UnsetPropertyException; -import org.openapijsonschematools.client.exceptions.ValidationException; -import org.openapijsonschematools.client.paths.petpetid.delete.parameters.parameter1.Schema1; -import org.openapijsonschematools.client.schemas.AnyTypeJsonSchema; -import org.openapijsonschematools.client.schemas.GenericBuilder; -import org.openapijsonschematools.client.schemas.NotAnyTypeJsonSchema; -import org.openapijsonschematools.client.schemas.validation.FrozenMap; -import org.openapijsonschematools.client.schemas.validation.JsonSchema; -import org.openapijsonschematools.client.schemas.validation.JsonSchemaInfo; -import org.openapijsonschematools.client.schemas.validation.MapSchemaValidator; -import org.openapijsonschematools.client.schemas.validation.MapUtils; -import org.openapijsonschematools.client.schemas.validation.PathToSchemasMap; -import org.openapijsonschematools.client.schemas.validation.PropertyEntry; -import org.openapijsonschematools.client.schemas.validation.ValidationMetadata; - -public class PetpetidDeletePathParameters { - // nest classes so all schemas and input/output classes can be public - - - public static class AdditionalProperties extends NotAnyTypeJsonSchema.NotAnyTypeJsonSchema1 { - // NotAnyTypeSchema - private static @Nullable AdditionalProperties instance = null; - public static AdditionalProperties getInstance() { - if (instance == null) { - instance = new AdditionalProperties(); - } - return instance; - } - } - - - public static class PathParametersMap extends FrozenMap { - protected PathParametersMap(FrozenMap m) { - super(m); - } - public static final Set requiredKeys = Set.of( - "petId" - ); - public static final Set optionalKeys = Set.of(); - public static PathParametersMap of(Map arg, SchemaConfiguration configuration) throws ValidationException { - return PetpetidDeletePathParameters1.getInstance().validate(arg, configuration); - } - - public Number petId() { - try { - return getOrThrow("version"); - } catch (UnsetPropertyException e) { - throw new RuntimeException(e); - } - } - } - - public interface SetterForPetId { - Map getInstance(); - T getBuilderAfterPetId(Map instance); - - default T petId(int value) { - var instance = getInstance(); - instance.put("petId", value); - return getBuilderAfterPetId(instance); - } - - default T petId(float value) { - var instance = getInstance(); - instance.put("petId", value); - return getBuilderAfterPetId(instance); - } - - default T petId(long value) { - var instance = getInstance(); - instance.put("petId", value); - return getBuilderAfterPetId(instance); - } - - default T petId(double value) { - var instance = getInstance(); - instance.put("petId", value); - return getBuilderAfterPetId(instance); - } - } - - public static class PathParametersMap0Builder implements GenericBuilder> { - private final Map instance; - private static final Set knownKeys = Set.of( - "petId" - ); - public Set getKnownKeys() { - return knownKeys; - } - public PathParametersMap0Builder(Map instance) { - this.instance = instance; - } - public Map build() { - return instance; - } - } - - public static class PathParametersMapBuilder implements SetterForPetId { - private final Map instance; - public PathParametersMapBuilder() { - this.instance = new LinkedHashMap<>(); - } - public Map getInstance() { - return instance; - } - public PathParametersMap0Builder getBuilderAfterPetId(Map instance) { - return new PathParametersMap0Builder(instance); - } - } - - - public sealed interface PetpetidDeletePathParameters1Boxed permits PetpetidDeletePathParameters1BoxedMap { - @Nullable Object getData(); - } - - public record PetpetidDeletePathParameters1BoxedMap(PathParametersMap data) implements PetpetidDeletePathParameters1Boxed { - @Override - public @Nullable Object getData() { - return data; - } - } - - - public static class PetpetidDeletePathParameters1 extends JsonSchema implements MapSchemaValidator { - private static @Nullable PetpetidDeletePathParameters1 instance = null; - - protected PetpetidDeletePathParameters1() { - super(new JsonSchemaInfo() - .type(Set.of(Map.class)) - .properties(Map.ofEntries( - new PropertyEntry("petId", Schema1.Schema11.class) - )) - .required(Set.of( - "petId" - )) - .additionalProperties(AdditionalProperties.class) - ); - } - - public static PetpetidDeletePathParameters1 getInstance() { - if (instance == null) { - instance = new PetpetidDeletePathParameters1(); - } - return instance; - } - - 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 RuntimeException("Invalid non-string key value"); - } - String propertyName = (String) entryKey; - List propertyPathToItem = new ArrayList<>(pathToItem); - propertyPathToItem.add(propertyName); - Object value = entry.getValue(); - LinkedHashMap, Nothing?> schemas = pathToSchemas.get(propertyPathToItem); - if (schemas == null) { - throw new RuntimeException("Validation 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"); - } - properties.put(propertyName, (Number) propertyInstance); - } - FrozenMap castProperties = new FrozenMap<>(properties); - return new PathParametersMap(castProperties); - } - - 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); - SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().build())); - ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, new PathToSchemasMap(), new LinkedHashSet<>()); - PathToSchemasMap pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet); - return getNewInstance(castArg, validationMetadata.pathToItem(), pathToSchemasMap); - } - - - @Override - public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws 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"); - } - @Override - public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { - if (arg instanceof Map) { - return getNewInstance((Map) arg, pathToItem, pathToSchemas); - } - throw new RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); - } - @Override - public PetpetidDeletePathParameters1BoxedMap validateAndBox(Map arg, SchemaConfiguration configuration) throws ValidationException { - return new PetpetidDeletePathParameters1BoxedMap(validate(arg, configuration)); - } - @Override - public PetpetidDeletePathParameters1Boxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { - 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"); - } - } - -} diff --git a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/petpetid/delete/PetpetidDeleteResponses.kt b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/petpetid/delete/PetpetidDeleteResponses.kt deleted file mode 100644 index d88b2e51e90..00000000000 --- a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/petpetid/delete/PetpetidDeleteResponses.kt +++ /dev/null @@ -1,48 +0,0 @@ -package org.openapijsonschematools.client.paths.petpetid.delete; - -import org.openapijsonschematools.client.paths.petpetid.delete.responses.PetpetidDeleteCode400Response; -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; - -import java.net.http.HttpResponse; -import java.util.Map; -import java.util.AbstractMap; - -public class PetpetidDeleteResponses { - - public sealed interface StatusCodeResponseDeserializer permits StatusPetpetidDeleteCode400ResponseDeserializer {} - - public static final class StatusPetpetidDeleteCode400ResponseDeserializer extends PetpetidDeleteCode400Response.PetpetidDeleteCode400Response1 implements StatusCodeResponseDeserializer { - } - - public static final class PetpetidDeleteResponses1 implements ResponsesDeserializer { - private final Map statusCodeToResponseDeserializer; - public PetpetidDeleteResponses1() { - this.statusCodeToResponseDeserializer = Map.ofEntries( - new AbstractMap.SimpleEntry<>("400", new StatusPetpetidDeleteCode400ResponseDeserializer()) - ); - } - - public Nothing? deserialize(HttpResponse response, SchemaConfiguration configuration) throws ValidationException, NotImplementedException, ApiException { - String statusCode = String.valueOf(response.statusCode()); - @Nullable StatusCodeResponseDeserializer statusCodeDeserializer = statusCodeToResponseDeserializer.get(statusCode); - if (statusCodeDeserializer == null) { - throw new ApiException( - "Invalid response statusCode="+statusCode+" has no response defined in the openapi document", - response - ); - } - StatusPetpetidDeleteCode400ResponseDeserializer castDeserializer = (StatusPetpetidDeleteCode400ResponseDeserializer) statusCodeDeserializer; - var deserializedResponse = castDeserializer.deserialize(response, configuration); - throw new PetpetidDeleteCode400Response.ResponseApiException( - "Received error statusCode response from server", - response, - deserializedResponse - ); - } - } -} diff --git a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/petpetid/delete/PetpetidDeleteSecurityInfo.kt b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/petpetid/delete/PetpetidDeleteSecurityInfo.kt deleted file mode 100644 index 941f3f23abf..00000000000 --- a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/petpetid/delete/PetpetidDeleteSecurityInfo.kt +++ /dev/null @@ -1,33 +0,0 @@ -package org.openapijsonschematools.client.paths.petpetid.delete; - -import org.openapijsonschematools.client.paths.petpetid.delete.security.PetpetidDeleteSecurityRequirementObject0; -import org.openapijsonschematools.client.paths.petpetid.delete.security.PetpetidDeleteSecurityRequirementObject1; -import org.openapijsonschematools.client.securityrequirementobjects.SecurityRequirementObject; -import org.openapijsonschematools.client.securityrequirementobjects.SecurityRequirementObjectProvider; - -public class PetpetidDeleteSecurityInfo { - public static class PetpetidDeleteSecurityInfo1 implements SecurityRequirementObjectProvider { - public final PetpetidDeleteSecurityRequirementObject0 security0; - public final PetpetidDeleteSecurityRequirementObject1 security1; - - public PetpetidDeleteSecurityInfo1() { - security0 = new PetpetidDeleteSecurityRequirementObject0(); - security1 = new PetpetidDeleteSecurityRequirementObject1(); - } - - @Override - public SecurityRequirementObject getSecurityRequirementObject(SecurityIndex securityIndex) { - switch (securityIndex) { - case SECURITY_0: - return security0; - default: - return security1; - } - } - } - - public enum SecurityIndex { - SECURITY_0, - SECURITY_1 - } -} \ No newline at end of file diff --git a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/petpetid/delete/parameters/Parameter0.kt b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/petpetid/delete/parameters/Parameter0.kt deleted file mode 100644 index 48e40ea5596..00000000000 --- a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/petpetid/delete/parameters/Parameter0.kt +++ /dev/null @@ -1,23 +0,0 @@ -package org.openapijsonschematools.client.paths.petpetid.delete.parameters; - -import org.openapijsonschematools.client.parameter.ParameterStyle; -import org.openapijsonschematools.client.parameter.ParameterInType; -import org.openapijsonschematools.client.parameter.SchemaParameter; -import org.openapijsonschematools.client.paths.petpetid.delete.parameters.parameter0.Schema0; - -public class Parameter0 { - - public static class Parameter01 extends SchemaParameter { - public Parameter01() { - super( - "api_key", - ParameterInType.HEADER, - false, - ParameterStyle.SIMPLE, - false, - false, - Schema0.Schema01.getInstance() - ); - } - } -} diff --git a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/petpetid/delete/parameters/Parameter1.kt b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/petpetid/delete/parameters/Parameter1.kt deleted file mode 100644 index c40da80fec8..00000000000 --- a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/petpetid/delete/parameters/Parameter1.kt +++ /dev/null @@ -1,23 +0,0 @@ -package org.openapijsonschematools.client.paths.petpetid.delete.parameters; - -import org.openapijsonschematools.client.parameter.ParameterStyle; -import org.openapijsonschematools.client.parameter.ParameterInType; -import org.openapijsonschematools.client.parameter.SchemaParameter; -import org.openapijsonschematools.client.paths.petpetid.delete.parameters.parameter1.Schema1; - -public class Parameter1 { - - public static class Parameter11 extends SchemaParameter { - public Parameter11() { - super( - "petId", - ParameterInType.PATH, - true, - ParameterStyle.SIMPLE, - false, - false, - Schema1.Schema11.getInstance() - ); - } - } -} diff --git a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/petpetid/delete/parameters/parameter0/Schema0.kt b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/petpetid/delete/parameters/parameter0/Schema0.kt deleted file mode 100644 index c4b34bf4f68..00000000000 --- a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/petpetid/delete/parameters/parameter0/Schema0.kt +++ /dev/null @@ -1,19 +0,0 @@ -package org.openapijsonschematools.client.paths.petpetid.delete.parameters.parameter0; -import org.checkerframework.checker.nullness.qual.Nullable; -import org.openapijsonschematools.client.schemas.StringJsonSchema; - -public class Schema0 extends StringJsonSchema { - // nest classes so all schemas and input/output classes can be public - - - public static class Schema01 extends StringJsonSchema.StringJsonSchema1 { - private static @Nullable Schema01 instance = null; - public static Schema01 getInstance() { - if (instance == null) { - instance = new Schema01(); - } - return instance; - } - } - -} diff --git a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/petpetid/delete/parameters/parameter1/Schema1.kt b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/petpetid/delete/parameters/parameter1/Schema1.kt deleted file mode 100644 index 3ec2f12b279..00000000000 --- a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/petpetid/delete/parameters/parameter1/Schema1.kt +++ /dev/null @@ -1,19 +0,0 @@ -package org.openapijsonschematools.client.paths.petpetid.delete.parameters.parameter1; -import org.checkerframework.checker.nullness.qual.Nullable; -import org.openapijsonschematools.client.schemas.Int64JsonSchema; - -public class Schema1 extends Int64JsonSchema { - // nest classes so all schemas and input/output classes can be public - - - public static class Schema11 extends Int64JsonSchema.Int64JsonSchema1 { - private static @Nullable Schema11 instance = null; - public static Schema11 getInstance() { - if (instance == null) { - instance = new Schema11(); - } - return instance; - } - } - -} diff --git a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/petpetid/delete/responses/PetpetidDeleteCode400Response.kt b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/petpetid/delete/responses/PetpetidDeleteCode400Response.kt deleted file mode 100644 index 1a540e2cfc5..00000000000 --- a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/petpetid/delete/responses/PetpetidDeleteCode400Response.kt +++ /dev/null @@ -1,45 +0,0 @@ -package org.openapijsonschematools.client.paths.petpetid.delete.responses; - -import org.openapijsonschematools.client.configurations.SchemaConfiguration; -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; -import java.net.http.HttpResponse; -import java.net.http.HttpHeaders; - -public class PetpetidDeleteCode400Response { - - public static class PetpetidDeleteCode400Response1 extends ResponseDeserializer { - public PetpetidDeleteCode400Response1() { - super( - MapUtils.makeMap( - ) - ); - } - - @Override - protected Nothing? getBody(String contentType, Nothing? mediaType, byte[] body, SchemaConfiguration configuration) { - return null; - } - - @Override - protected Nothing? getHeaders(HttpHeaders headers, SchemaConfiguration configuration) { - return null; - } - } - - @SuppressWarnings("serial") - public static class ResponseApiException extends ApiException { - public DeserializedHttpResponse deserializedResponse; - - public ResponseApiException(String s, HttpResponse response, DeserializedHttpResponse deserializedResponse) { - super(s, response); - this.deserializedResponse = deserializedResponse; - } - } -} diff --git a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/petpetid/delete/security/PetpetidDeleteSecurityRequirementObject0.kt b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/petpetid/delete/security/PetpetidDeleteSecurityRequirementObject0.kt deleted file mode 100644 index 320b2cffa63..00000000000 --- a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/petpetid/delete/security/PetpetidDeleteSecurityRequirementObject0.kt +++ /dev/null @@ -1,24 +0,0 @@ -package org.openapijsonschematools.client.paths.petpetid.delete.security; - -import org.checkerframework.checker.nullness.qual.Nullable; -import org.openapijsonschematools.client.securityrequirementobjects.SecurityRequirementObject; -import org.openapijsonschematools.client.securityschemes.SecurityScheme; -import org.openapijsonschematools.client.components.securityschemes.ApiKey; - -import java.util.List; -import java.util.Map; -import java.util.AbstractMap; - -public class PetpetidDeleteSecurityRequirementObject0 extends SecurityRequirementObject { - - public PetpetidDeleteSecurityRequirementObject0() { - super( - Map.ofEntries( - new AbstractMap.SimpleEntry, List>( - ApiKey.class, - List.of() - ) - ) - ); - } -} diff --git a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/petpetid/delete/security/PetpetidDeleteSecurityRequirementObject1.kt b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/petpetid/delete/security/PetpetidDeleteSecurityRequirementObject1.kt deleted file mode 100644 index f7e6f70df99..00000000000 --- a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/petpetid/delete/security/PetpetidDeleteSecurityRequirementObject1.kt +++ /dev/null @@ -1,24 +0,0 @@ -package org.openapijsonschematools.client.paths.petpetid.delete.security; - -import org.checkerframework.checker.nullness.qual.Nullable; -import org.openapijsonschematools.client.securityrequirementobjects.SecurityRequirementObject; -import org.openapijsonschematools.client.securityschemes.SecurityScheme; -import org.openapijsonschematools.client.components.securityschemes.PetstoreAuth; - -import java.util.List; -import java.util.Map; -import java.util.AbstractMap; - -public class PetpetidDeleteSecurityRequirementObject1 extends SecurityRequirementObject { - - public PetpetidDeleteSecurityRequirementObject1() { - super( - Map.ofEntries( - new AbstractMap.SimpleEntry, List>( - PetstoreAuth.class, - List.of("write:pets", "read:pets") - ) - ) - ); - } -} diff --git a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/petpetid/get/Parameters.kt b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/petpetid/get/Parameters.kt deleted file mode 100644 index f5e28725665..00000000000 --- a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/petpetid/get/Parameters.kt +++ /dev/null @@ -1,20 +0,0 @@ -package org.openapijsonschematools.client.paths.petpetid.get; - -import org.openapijsonschematools.client.paths.petpetid.get.parameters.Parameter0; -import org.openapijsonschematools.client.parameter.PathSerializer; - -import java.util.Map; -import java.util.AbstractMap; - -public class Parameters { - - public static class PathParametersSerializer extends PathSerializer { - public PathParametersSerializer() { - super( - Map.ofEntries( - new AbstractMap.SimpleEntry<>("petId", new Parameter0.Parameter01()) - ) - ); - } - } -} diff --git a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/petpetid/get/PetpetidGetPathParameters.kt b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/petpetid/get/PetpetidGetPathParameters.kt deleted file mode 100644 index 12b3b104c7d..00000000000 --- a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/petpetid/get/PetpetidGetPathParameters.kt +++ /dev/null @@ -1,223 +0,0 @@ -package org.openapijsonschematools.client.paths.petpetid.get; -import java.util.ArrayList; -import java.util.HashSet; -import java.util.LinkedHashMap; -import java.util.LinkedHashSet; -import java.util.List; -import java.util.Map; -import java.util.Objects; -import java.util.Set; -import org.checkerframework.checker.nullness.qual.Nullable; -import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags; -import org.openapijsonschematools.client.configurations.SchemaConfiguration; -import org.openapijsonschematools.client.exceptions.UnsetPropertyException; -import org.openapijsonschematools.client.exceptions.ValidationException; -import org.openapijsonschematools.client.paths.petpetid.get.parameters.parameter0.Schema0; -import org.openapijsonschematools.client.schemas.AnyTypeJsonSchema; -import org.openapijsonschematools.client.schemas.GenericBuilder; -import org.openapijsonschematools.client.schemas.NotAnyTypeJsonSchema; -import org.openapijsonschematools.client.schemas.validation.FrozenMap; -import org.openapijsonschematools.client.schemas.validation.JsonSchema; -import org.openapijsonschematools.client.schemas.validation.JsonSchemaInfo; -import org.openapijsonschematools.client.schemas.validation.MapSchemaValidator; -import org.openapijsonschematools.client.schemas.validation.MapUtils; -import org.openapijsonschematools.client.schemas.validation.PathToSchemasMap; -import org.openapijsonschematools.client.schemas.validation.PropertyEntry; -import org.openapijsonschematools.client.schemas.validation.ValidationMetadata; - -public class PetpetidGetPathParameters { - // nest classes so all schemas and input/output classes can be public - - - public static class AdditionalProperties extends NotAnyTypeJsonSchema.NotAnyTypeJsonSchema1 { - // NotAnyTypeSchema - private static @Nullable AdditionalProperties instance = null; - public static AdditionalProperties getInstance() { - if (instance == null) { - instance = new AdditionalProperties(); - } - return instance; - } - } - - - public static class PathParametersMap extends FrozenMap { - protected PathParametersMap(FrozenMap m) { - super(m); - } - public static final Set requiredKeys = Set.of( - "petId" - ); - public static final Set optionalKeys = Set.of(); - public static PathParametersMap of(Map arg, SchemaConfiguration configuration) throws ValidationException { - return PetpetidGetPathParameters1.getInstance().validate(arg, configuration); - } - - public Number petId() { - try { - return getOrThrow("version"); - } catch (UnsetPropertyException e) { - throw new RuntimeException(e); - } - } - } - - public interface SetterForPetId { - Map getInstance(); - T getBuilderAfterPetId(Map instance); - - default T petId(int value) { - var instance = getInstance(); - instance.put("petId", value); - return getBuilderAfterPetId(instance); - } - - default T petId(float value) { - var instance = getInstance(); - instance.put("petId", value); - return getBuilderAfterPetId(instance); - } - - default T petId(long value) { - var instance = getInstance(); - instance.put("petId", value); - return getBuilderAfterPetId(instance); - } - - default T petId(double value) { - var instance = getInstance(); - instance.put("petId", value); - return getBuilderAfterPetId(instance); - } - } - - public static class PathParametersMap0Builder implements GenericBuilder> { - private final Map instance; - private static final Set knownKeys = Set.of( - "petId" - ); - public Set getKnownKeys() { - return knownKeys; - } - public PathParametersMap0Builder(Map instance) { - this.instance = instance; - } - public Map build() { - return instance; - } - } - - public static class PathParametersMapBuilder implements SetterForPetId { - private final Map instance; - public PathParametersMapBuilder() { - this.instance = new LinkedHashMap<>(); - } - public Map getInstance() { - return instance; - } - public PathParametersMap0Builder getBuilderAfterPetId(Map instance) { - return new PathParametersMap0Builder(instance); - } - } - - - public sealed interface PetpetidGetPathParameters1Boxed permits PetpetidGetPathParameters1BoxedMap { - @Nullable Object getData(); - } - - public record PetpetidGetPathParameters1BoxedMap(PathParametersMap data) implements PetpetidGetPathParameters1Boxed { - @Override - public @Nullable Object getData() { - return data; - } - } - - - public static class PetpetidGetPathParameters1 extends JsonSchema implements MapSchemaValidator { - private static @Nullable PetpetidGetPathParameters1 instance = null; - - protected PetpetidGetPathParameters1() { - super(new JsonSchemaInfo() - .type(Set.of(Map.class)) - .properties(Map.ofEntries( - new PropertyEntry("petId", Schema0.Schema01.class) - )) - .required(Set.of( - "petId" - )) - .additionalProperties(AdditionalProperties.class) - ); - } - - public static PetpetidGetPathParameters1 getInstance() { - if (instance == null) { - instance = new PetpetidGetPathParameters1(); - } - return instance; - } - - 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 RuntimeException("Invalid non-string key value"); - } - String propertyName = (String) entryKey; - List propertyPathToItem = new ArrayList<>(pathToItem); - propertyPathToItem.add(propertyName); - Object value = entry.getValue(); - LinkedHashMap, Nothing?> schemas = pathToSchemas.get(propertyPathToItem); - if (schemas == null) { - throw new RuntimeException("Validation 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"); - } - properties.put(propertyName, (Number) propertyInstance); - } - FrozenMap castProperties = new FrozenMap<>(properties); - return new PathParametersMap(castProperties); - } - - 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); - SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().build())); - ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, new PathToSchemasMap(), new LinkedHashSet<>()); - PathToSchemasMap pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet); - return getNewInstance(castArg, validationMetadata.pathToItem(), pathToSchemasMap); - } - - - @Override - public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws 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"); - } - @Override - public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { - if (arg instanceof Map) { - return getNewInstance((Map) arg, pathToItem, pathToSchemas); - } - throw new RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); - } - @Override - public PetpetidGetPathParameters1BoxedMap validateAndBox(Map arg, SchemaConfiguration configuration) throws ValidationException { - return new PetpetidGetPathParameters1BoxedMap(validate(arg, configuration)); - } - @Override - public PetpetidGetPathParameters1Boxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { - 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"); - } - } - -} diff --git a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/petpetid/get/PetpetidGetResponses.kt b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/petpetid/get/PetpetidGetResponses.kt deleted file mode 100644 index 42b83c92cc2..00000000000 --- a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/petpetid/get/PetpetidGetResponses.kt +++ /dev/null @@ -1,77 +0,0 @@ -package org.openapijsonschematools.client.paths.petpetid.get; - -import org.openapijsonschematools.client.paths.petpetid.get.responses.PetpetidGetCode200Response; -import org.openapijsonschematools.client.paths.petpetid.get.responses.PetpetidGetCode400Response; -import org.openapijsonschematools.client.paths.petpetid.get.responses.PetpetidGetCode404Response; -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; -import org.checkerframework.checker.nullness.qual.Nullable; - -import java.net.http.HttpResponse; -import java.util.Map; -import java.util.AbstractMap; - -public class PetpetidGetResponses { - public sealed interface EndpointResponse permits EndpointPetpetidGetCode200Response {} - - public record EndpointPetpetidGetCode200Response( - HttpResponse response, - PetpetidGetCode200Response.SealedResponseBody body, - Nothing? headers - ) implements EndpointResponse, ApiResponse{ - } - - public sealed interface StatusCodeResponseDeserializer permits StatusPetpetidGetCode200ResponseDeserializer, StatusPetpetidGetCode400ResponseDeserializer, StatusPetpetidGetCode404ResponseDeserializer {} - - public static final class StatusPetpetidGetCode200ResponseDeserializer extends PetpetidGetCode200Response.PetpetidGetCode200Response1 implements StatusCodeResponseDeserializer { - } - public static final class StatusPetpetidGetCode400ResponseDeserializer extends PetpetidGetCode400Response.PetpetidGetCode400Response1 implements StatusCodeResponseDeserializer { - } - public static final class StatusPetpetidGetCode404ResponseDeserializer extends PetpetidGetCode404Response.PetpetidGetCode404Response1 implements StatusCodeResponseDeserializer { - } - - public static final class PetpetidGetResponses1 implements ResponsesDeserializer { - private final Map statusCodeToResponseDeserializer; - public PetpetidGetResponses1() { - this.statusCodeToResponseDeserializer = Map.ofEntries( - new AbstractMap.SimpleEntry<>("200", new StatusPetpetidGetCode200ResponseDeserializer()), - new AbstractMap.SimpleEntry<>("400", new StatusPetpetidGetCode400ResponseDeserializer()), - new AbstractMap.SimpleEntry<>("404", new StatusPetpetidGetCode404ResponseDeserializer()) - ); - } - - 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) { - throw new ApiException( - "Invalid response statusCode="+statusCode+" has no response defined in the openapi document", - response - ); - } - if (statusCodeDeserializer instanceof StatusPetpetidGetCode200ResponseDeserializer castDeserializer) { - var deserializedResponse = castDeserializer.deserialize(response, configuration); - return new EndpointPetpetidGetCode200Response(response, deserializedResponse.body(), deserializedResponse.headers()); - } else if (statusCodeDeserializer instanceof StatusPetpetidGetCode400ResponseDeserializer castDeserializer) { - var deserializedResponse = castDeserializer.deserialize(response, configuration); - throw new PetpetidGetCode400Response.ResponseApiException( - "Received error statusCode response from server", - response, - deserializedResponse - ); - } else { - StatusPetpetidGetCode404ResponseDeserializer castDeserializer = (StatusPetpetidGetCode404ResponseDeserializer) statusCodeDeserializer; - var deserializedResponse = castDeserializer.deserialize(response, configuration); - throw new PetpetidGetCode404Response.ResponseApiException( - "Received error statusCode response from server", - response, - deserializedResponse - ); - } - } - } -} diff --git a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/petpetid/get/PetpetidGetSecurityInfo.kt b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/petpetid/get/PetpetidGetSecurityInfo.kt deleted file mode 100644 index 4d21d88f82e..00000000000 --- a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/petpetid/get/PetpetidGetSecurityInfo.kt +++ /dev/null @@ -1,24 +0,0 @@ -package org.openapijsonschematools.client.paths.petpetid.get; - -import org.openapijsonschematools.client.paths.petpetid.get.security.PetpetidGetSecurityRequirementObject0; -import org.openapijsonschematools.client.securityrequirementobjects.SecurityRequirementObject; -import org.openapijsonschematools.client.securityrequirementobjects.SecurityRequirementObjectProvider; - -public class PetpetidGetSecurityInfo { - public static class PetpetidGetSecurityInfo1 implements SecurityRequirementObjectProvider { - public final PetpetidGetSecurityRequirementObject0 security0; - - public PetpetidGetSecurityInfo1() { - security0 = new PetpetidGetSecurityRequirementObject0(); - } - - @Override - public SecurityRequirementObject getSecurityRequirementObject(SecurityIndex securityIndex) { - return security0; - } - } - - public enum SecurityIndex { - SECURITY_0 - } -} \ No newline at end of file diff --git a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/petpetid/get/parameters/Parameter0.kt b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/petpetid/get/parameters/Parameter0.kt deleted file mode 100644 index 7b03160b9a4..00000000000 --- a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/petpetid/get/parameters/Parameter0.kt +++ /dev/null @@ -1,23 +0,0 @@ -package org.openapijsonschematools.client.paths.petpetid.get.parameters; - -import org.openapijsonschematools.client.parameter.ParameterStyle; -import org.openapijsonschematools.client.parameter.ParameterInType; -import org.openapijsonschematools.client.parameter.SchemaParameter; -import org.openapijsonschematools.client.paths.petpetid.get.parameters.parameter0.Schema0; - -public class Parameter0 { - - public static class Parameter01 extends SchemaParameter { - public Parameter01() { - super( - "petId", - ParameterInType.PATH, - true, - ParameterStyle.SIMPLE, - false, - false, - Schema0.Schema01.getInstance() - ); - } - } -} diff --git a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/petpetid/get/parameters/parameter0/Schema0.kt b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/petpetid/get/parameters/parameter0/Schema0.kt deleted file mode 100644 index 2131549a0b8..00000000000 --- a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/petpetid/get/parameters/parameter0/Schema0.kt +++ /dev/null @@ -1,19 +0,0 @@ -package org.openapijsonschematools.client.paths.petpetid.get.parameters.parameter0; -import org.checkerframework.checker.nullness.qual.Nullable; -import org.openapijsonschematools.client.schemas.Int64JsonSchema; - -public class Schema0 extends Int64JsonSchema { - // nest classes so all schemas and input/output classes can be public - - - public static class Schema01 extends Int64JsonSchema.Int64JsonSchema1 { - private static @Nullable Schema01 instance = null; - public static Schema01 getInstance() { - if (instance == null) { - instance = new Schema01(); - } - return instance; - } - } - -} diff --git a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/petpetid/get/responses/PetpetidGetCode200Response.kt b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/petpetid/get/responses/PetpetidGetCode200Response.kt deleted file mode 100644 index 7daf7176e0e..00000000000 --- a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/petpetid/get/responses/PetpetidGetCode200Response.kt +++ /dev/null @@ -1,81 +0,0 @@ -package org.openapijsonschematools.client.paths.petpetid.get.responses; - -import org.openapijsonschematools.client.configurations.SchemaConfiguration; -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; - -import java.util.AbstractMap; -import java.util.Map; -import java.net.http.HttpResponse; -import java.net.http.HttpHeaders; - -public class PetpetidGetCode200Response { - public sealed interface SealedMediaType permits ApplicationxmlMediaType, ApplicationjsonMediaType {} - - public record ApplicationxmlMediaType(ApplicationxmlSchema.ApplicationxmlSchema1 schema) implements SealedMediaType, MediaType { - public ApplicationxmlMediaType() { - this(ApplicationxmlSchema.ApplicationxmlSchema1.getInstance()); - } - @Override - public Nothing? encoding() { - return null; - } - } - - public record ApplicationjsonMediaType(ApplicationjsonSchema.ApplicationjsonSchema1 schema) implements SealedMediaType, MediaType { - public ApplicationjsonMediaType() { - this(ApplicationjsonSchema.ApplicationjsonSchema1.getInstance()); - } - @Override - public Nothing? encoding() { - return null; - } - } - public sealed interface SealedResponseBody permits ApplicationxmlResponseBody, ApplicationjsonResponseBody {} - public record ApplicationxmlResponseBody(ApplicationxmlSchema.Pet1Boxed body) implements SealedResponseBody { } - public record ApplicationjsonResponseBody(ApplicationjsonSchema.Pet1Boxed body) implements SealedResponseBody { } - - public static class PetpetidGetCode200Response1 extends ResponseDeserializer { - public PetpetidGetCode200Response1() { - super( - Map.ofEntries( - new AbstractMap.SimpleEntry<>("application/xml", new ApplicationxmlMediaType()), - new AbstractMap.SimpleEntry<>("application/json", new ApplicationjsonMediaType()) - ) - ); - } - - @Override - 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 { - ApplicationjsonMediaType thisMediaType = (ApplicationjsonMediaType) mediaType; - var deserializedBody = deserializeBody(contentType, body, thisMediaType.schema(), configuration); - return new ApplicationjsonResponseBody(deserializedBody); - } - } - - @Override - protected Nothing? getHeaders(HttpHeaders headers, SchemaConfiguration configuration) { - return null; - } - } - - @SuppressWarnings("serial") - public static class ResponseApiException extends ApiException { - public DeserializedHttpResponse deserializedResponse; - - public ResponseApiException(String s, HttpResponse response, DeserializedHttpResponse deserializedResponse) { - super(s, response); - this.deserializedResponse = deserializedResponse; - } - } -} diff --git a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/petpetid/get/responses/PetpetidGetCode400Response.kt b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/petpetid/get/responses/PetpetidGetCode400Response.kt deleted file mode 100644 index d52d1f64675..00000000000 --- a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/petpetid/get/responses/PetpetidGetCode400Response.kt +++ /dev/null @@ -1,45 +0,0 @@ -package org.openapijsonschematools.client.paths.petpetid.get.responses; - -import org.openapijsonschematools.client.configurations.SchemaConfiguration; -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; -import java.net.http.HttpResponse; -import java.net.http.HttpHeaders; - -public class PetpetidGetCode400Response { - - public static class PetpetidGetCode400Response1 extends ResponseDeserializer { - public PetpetidGetCode400Response1() { - super( - MapUtils.makeMap( - ) - ); - } - - @Override - protected Nothing? getBody(String contentType, Nothing? mediaType, byte[] body, SchemaConfiguration configuration) { - return null; - } - - @Override - protected Nothing? getHeaders(HttpHeaders headers, SchemaConfiguration configuration) { - return null; - } - } - - @SuppressWarnings("serial") - public static class ResponseApiException extends ApiException { - public DeserializedHttpResponse deserializedResponse; - - public ResponseApiException(String s, HttpResponse response, DeserializedHttpResponse deserializedResponse) { - super(s, response); - this.deserializedResponse = deserializedResponse; - } - } -} diff --git a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/petpetid/get/responses/PetpetidGetCode404Response.kt b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/petpetid/get/responses/PetpetidGetCode404Response.kt deleted file mode 100644 index f8e3854f670..00000000000 --- a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/petpetid/get/responses/PetpetidGetCode404Response.kt +++ /dev/null @@ -1,45 +0,0 @@ -package org.openapijsonschematools.client.paths.petpetid.get.responses; - -import org.openapijsonschematools.client.configurations.SchemaConfiguration; -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; -import java.net.http.HttpResponse; -import java.net.http.HttpHeaders; - -public class PetpetidGetCode404Response { - - public static class PetpetidGetCode404Response1 extends ResponseDeserializer { - public PetpetidGetCode404Response1() { - super( - MapUtils.makeMap( - ) - ); - } - - @Override - protected Nothing? getBody(String contentType, Nothing? mediaType, byte[] body, SchemaConfiguration configuration) { - return null; - } - - @Override - protected Nothing? getHeaders(HttpHeaders headers, SchemaConfiguration configuration) { - return null; - } - } - - @SuppressWarnings("serial") - public static class ResponseApiException extends ApiException { - public DeserializedHttpResponse deserializedResponse; - - public ResponseApiException(String s, HttpResponse response, DeserializedHttpResponse deserializedResponse) { - super(s, response); - this.deserializedResponse = deserializedResponse; - } - } -} diff --git a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/petpetid/get/responses/code200response/content/applicationjson/ApplicationjsonSchema.kt b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/petpetid/get/responses/code200response/content/applicationjson/ApplicationjsonSchema.kt deleted file mode 100644 index 1409b9ae6dd..00000000000 --- a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/petpetid/get/responses/code200response/content/applicationjson/ApplicationjsonSchema.kt +++ /dev/null @@ -1,20 +0,0 @@ -package org.openapijsonschematools.client.paths.petpetid.get.responses.code200response.content.applicationjson; - -import org.checkerframework.checker.nullness.qual.Nullable; -import org.openapijsonschematools.client.components.schemas.Pet; -import org.openapijsonschematools.client.components.schemas.RefPet; - -public class ApplicationjsonSchema extends RefPet { - // $refed class - - - public static class ApplicationjsonSchema1 extends Pet1 { - private static @Nullable ApplicationjsonSchema1 instance = null; - public static ApplicationjsonSchema1 getInstance() { - if (instance == null) { - instance = new ApplicationjsonSchema1(); - } - return instance; - } - } -} diff --git a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/petpetid/get/responses/code200response/content/applicationxml/ApplicationxmlSchema.kt b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/petpetid/get/responses/code200response/content/applicationxml/ApplicationxmlSchema.kt deleted file mode 100644 index 2c49b59c0e5..00000000000 --- a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/petpetid/get/responses/code200response/content/applicationxml/ApplicationxmlSchema.kt +++ /dev/null @@ -1,19 +0,0 @@ -package org.openapijsonschematools.client.paths.petpetid.get.responses.code200response.content.applicationxml; - -import org.checkerframework.checker.nullness.qual.Nullable; -import org.openapijsonschematools.client.components.schemas.Pet; - -public class ApplicationxmlSchema extends Pet { - // $refed class - - - public static class ApplicationxmlSchema1 extends Pet1 { - private static @Nullable ApplicationxmlSchema1 instance = null; - public static ApplicationxmlSchema1 getInstance() { - if (instance == null) { - instance = new ApplicationxmlSchema1(); - } - return instance; - } - } -} diff --git a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/petpetid/get/security/PetpetidGetSecurityRequirementObject0.kt b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/petpetid/get/security/PetpetidGetSecurityRequirementObject0.kt deleted file mode 100644 index 00903fe643c..00000000000 --- a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/petpetid/get/security/PetpetidGetSecurityRequirementObject0.kt +++ /dev/null @@ -1,24 +0,0 @@ -package org.openapijsonschematools.client.paths.petpetid.get.security; - -import org.checkerframework.checker.nullness.qual.Nullable; -import org.openapijsonschematools.client.securityrequirementobjects.SecurityRequirementObject; -import org.openapijsonschematools.client.securityschemes.SecurityScheme; -import org.openapijsonschematools.client.components.securityschemes.ApiKey; - -import java.util.List; -import java.util.Map; -import java.util.AbstractMap; - -public class PetpetidGetSecurityRequirementObject0 extends SecurityRequirementObject { - - public PetpetidGetSecurityRequirementObject0() { - super( - Map.ofEntries( - new AbstractMap.SimpleEntry, List>( - ApiKey.class, - List.of() - ) - ) - ); - } -} diff --git a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/petpetid/post/Parameters.kt b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/petpetid/post/Parameters.kt deleted file mode 100644 index 04772587103..00000000000 --- a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/petpetid/post/Parameters.kt +++ /dev/null @@ -1,20 +0,0 @@ -package org.openapijsonschematools.client.paths.petpetid.post; - -import org.openapijsonschematools.client.paths.petpetid.post.parameters.Parameter0; -import org.openapijsonschematools.client.parameter.PathSerializer; - -import java.util.Map; -import java.util.AbstractMap; - -public class Parameters { - - public static class PathParametersSerializer extends PathSerializer { - public PathParametersSerializer() { - super( - Map.ofEntries( - new AbstractMap.SimpleEntry<>("petId", new Parameter0.Parameter01()) - ) - ); - } - } -} diff --git a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/petpetid/post/PetpetidPostPathParameters.kt b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/petpetid/post/PetpetidPostPathParameters.kt deleted file mode 100644 index 370d00c3e4f..00000000000 --- a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/petpetid/post/PetpetidPostPathParameters.kt +++ /dev/null @@ -1,223 +0,0 @@ -package org.openapijsonschematools.client.paths.petpetid.post; -import java.util.ArrayList; -import java.util.HashSet; -import java.util.LinkedHashMap; -import java.util.LinkedHashSet; -import java.util.List; -import java.util.Map; -import java.util.Objects; -import java.util.Set; -import org.checkerframework.checker.nullness.qual.Nullable; -import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags; -import org.openapijsonschematools.client.configurations.SchemaConfiguration; -import org.openapijsonschematools.client.exceptions.UnsetPropertyException; -import org.openapijsonschematools.client.exceptions.ValidationException; -import org.openapijsonschematools.client.paths.petpetid.post.parameters.parameter0.Schema0; -import org.openapijsonschematools.client.schemas.AnyTypeJsonSchema; -import org.openapijsonschematools.client.schemas.GenericBuilder; -import org.openapijsonschematools.client.schemas.NotAnyTypeJsonSchema; -import org.openapijsonschematools.client.schemas.validation.FrozenMap; -import org.openapijsonschematools.client.schemas.validation.JsonSchema; -import org.openapijsonschematools.client.schemas.validation.JsonSchemaInfo; -import org.openapijsonschematools.client.schemas.validation.MapSchemaValidator; -import org.openapijsonschematools.client.schemas.validation.MapUtils; -import org.openapijsonschematools.client.schemas.validation.PathToSchemasMap; -import org.openapijsonschematools.client.schemas.validation.PropertyEntry; -import org.openapijsonschematools.client.schemas.validation.ValidationMetadata; - -public class PetpetidPostPathParameters { - // nest classes so all schemas and input/output classes can be public - - - public static class AdditionalProperties extends NotAnyTypeJsonSchema.NotAnyTypeJsonSchema1 { - // NotAnyTypeSchema - private static @Nullable AdditionalProperties instance = null; - public static AdditionalProperties getInstance() { - if (instance == null) { - instance = new AdditionalProperties(); - } - return instance; - } - } - - - public static class PathParametersMap extends FrozenMap { - protected PathParametersMap(FrozenMap m) { - super(m); - } - public static final Set requiredKeys = Set.of( - "petId" - ); - public static final Set optionalKeys = Set.of(); - public static PathParametersMap of(Map arg, SchemaConfiguration configuration) throws ValidationException { - return PetpetidPostPathParameters1.getInstance().validate(arg, configuration); - } - - public Number petId() { - try { - return getOrThrow("version"); - } catch (UnsetPropertyException e) { - throw new RuntimeException(e); - } - } - } - - public interface SetterForPetId { - Map getInstance(); - T getBuilderAfterPetId(Map instance); - - default T petId(int value) { - var instance = getInstance(); - instance.put("petId", value); - return getBuilderAfterPetId(instance); - } - - default T petId(float value) { - var instance = getInstance(); - instance.put("petId", value); - return getBuilderAfterPetId(instance); - } - - default T petId(long value) { - var instance = getInstance(); - instance.put("petId", value); - return getBuilderAfterPetId(instance); - } - - default T petId(double value) { - var instance = getInstance(); - instance.put("petId", value); - return getBuilderAfterPetId(instance); - } - } - - public static class PathParametersMap0Builder implements GenericBuilder> { - private final Map instance; - private static final Set knownKeys = Set.of( - "petId" - ); - public Set getKnownKeys() { - return knownKeys; - } - public PathParametersMap0Builder(Map instance) { - this.instance = instance; - } - public Map build() { - return instance; - } - } - - public static class PathParametersMapBuilder implements SetterForPetId { - private final Map instance; - public PathParametersMapBuilder() { - this.instance = new LinkedHashMap<>(); - } - public Map getInstance() { - return instance; - } - public PathParametersMap0Builder getBuilderAfterPetId(Map instance) { - return new PathParametersMap0Builder(instance); - } - } - - - public sealed interface PetpetidPostPathParameters1Boxed permits PetpetidPostPathParameters1BoxedMap { - @Nullable Object getData(); - } - - public record PetpetidPostPathParameters1BoxedMap(PathParametersMap data) implements PetpetidPostPathParameters1Boxed { - @Override - public @Nullable Object getData() { - return data; - } - } - - - public static class PetpetidPostPathParameters1 extends JsonSchema implements MapSchemaValidator { - private static @Nullable PetpetidPostPathParameters1 instance = null; - - protected PetpetidPostPathParameters1() { - super(new JsonSchemaInfo() - .type(Set.of(Map.class)) - .properties(Map.ofEntries( - new PropertyEntry("petId", Schema0.Schema01.class) - )) - .required(Set.of( - "petId" - )) - .additionalProperties(AdditionalProperties.class) - ); - } - - public static PetpetidPostPathParameters1 getInstance() { - if (instance == null) { - instance = new PetpetidPostPathParameters1(); - } - return instance; - } - - 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 RuntimeException("Invalid non-string key value"); - } - String propertyName = (String) entryKey; - List propertyPathToItem = new ArrayList<>(pathToItem); - propertyPathToItem.add(propertyName); - Object value = entry.getValue(); - LinkedHashMap, Nothing?> schemas = pathToSchemas.get(propertyPathToItem); - if (schemas == null) { - throw new RuntimeException("Validation 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"); - } - properties.put(propertyName, (Number) propertyInstance); - } - FrozenMap castProperties = new FrozenMap<>(properties); - return new PathParametersMap(castProperties); - } - - 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); - SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().build())); - ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, new PathToSchemasMap(), new LinkedHashSet<>()); - PathToSchemasMap pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet); - return getNewInstance(castArg, validationMetadata.pathToItem(), pathToSchemasMap); - } - - - @Override - public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws 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"); - } - @Override - public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { - if (arg instanceof Map) { - return getNewInstance((Map) arg, pathToItem, pathToSchemas); - } - throw new RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); - } - @Override - public PetpetidPostPathParameters1BoxedMap validateAndBox(Map arg, SchemaConfiguration configuration) throws ValidationException { - return new PetpetidPostPathParameters1BoxedMap(validate(arg, configuration)); - } - @Override - public PetpetidPostPathParameters1Boxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { - 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"); - } - } - -} diff --git a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/petpetid/post/PetpetidPostRequestBody.kt b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/petpetid/post/PetpetidPostRequestBody.kt deleted file mode 100644 index 640478d98a0..00000000000 --- a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/petpetid/post/PetpetidPostRequestBody.kt +++ /dev/null @@ -1,49 +0,0 @@ -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; -import org.openapijsonschematools.client.mediatype.MediaType; -import org.openapijsonschematools.client.paths.petpetid.post.requestbody.content.applicationxwwwformurlencoded.ApplicationxwwwformurlencodedSchema; - -import java.util.AbstractMap; -import java.util.Map; - -public class PetpetidPostRequestBody { - public sealed interface SealedMediaType permits ApplicationxwwwformurlencodedMediaType {} - - public record ApplicationxwwwformurlencodedMediaType(ApplicationxwwwformurlencodedSchema.ApplicationxwwwformurlencodedSchema1 schema) implements SealedMediaType, MediaType { - public ApplicationxwwwformurlencodedMediaType() { - this(ApplicationxwwwformurlencodedSchema.ApplicationxwwwformurlencodedSchema1.getInstance()); - } - @Override - public Nothing? encoding() { - return null; - } - } - - public static class PetpetidPostRequestBody1 extends RequestBodySerializer { - public PetpetidPostRequestBody1() { - super( - Map.ofEntries( - new AbstractMap.SimpleEntry<>("application/x-www-form-urlencoded", new ApplicationxwwwformurlencodedMediaType()) - ), - false - ); - } - - public SerializedRequestBody serialize(SealedRequestBody requestBody) throws NotImplementedException { - ApplicationxwwwformurlencodedRequestBody requestBody0 = (ApplicationxwwwformurlencodedRequestBody) requestBody; - return serialize(requestBody0.contentType(), requestBody0.body().getData()); - } - } - - public sealed interface SealedRequestBody permits ApplicationxwwwformurlencodedRequestBody {} - public record ApplicationxwwwformurlencodedRequestBody(ApplicationxwwwformurlencodedSchema.ApplicationxwwwformurlencodedSchema1Boxed body) implements SealedRequestBody, GenericRequestBody { - @Override - public String contentType() { - return "application/x-www-form-urlencoded"; - } - } -} diff --git a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/petpetid/post/PetpetidPostResponses.kt b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/petpetid/post/PetpetidPostResponses.kt deleted file mode 100644 index d1b3baa65f1..00000000000 --- a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/petpetid/post/PetpetidPostResponses.kt +++ /dev/null @@ -1,48 +0,0 @@ -package org.openapijsonschematools.client.paths.petpetid.post; - -import org.openapijsonschematools.client.paths.petpetid.post.responses.PetpetidPostCode405Response; -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; - -import java.net.http.HttpResponse; -import java.util.Map; -import java.util.AbstractMap; - -public class PetpetidPostResponses { - - public sealed interface StatusCodeResponseDeserializer permits StatusPetpetidPostCode405ResponseDeserializer {} - - public static final class StatusPetpetidPostCode405ResponseDeserializer extends PetpetidPostCode405Response.PetpetidPostCode405Response1 implements StatusCodeResponseDeserializer { - } - - public static final class PetpetidPostResponses1 implements ResponsesDeserializer { - private final Map statusCodeToResponseDeserializer; - public PetpetidPostResponses1() { - this.statusCodeToResponseDeserializer = Map.ofEntries( - new AbstractMap.SimpleEntry<>("405", new StatusPetpetidPostCode405ResponseDeserializer()) - ); - } - - public Nothing? deserialize(HttpResponse response, SchemaConfiguration configuration) throws ValidationException, NotImplementedException, ApiException { - String statusCode = String.valueOf(response.statusCode()); - @Nullable StatusCodeResponseDeserializer statusCodeDeserializer = statusCodeToResponseDeserializer.get(statusCode); - if (statusCodeDeserializer == null) { - throw new ApiException( - "Invalid response statusCode="+statusCode+" has no response defined in the openapi document", - response - ); - } - StatusPetpetidPostCode405ResponseDeserializer castDeserializer = (StatusPetpetidPostCode405ResponseDeserializer) statusCodeDeserializer; - var deserializedResponse = castDeserializer.deserialize(response, configuration); - throw new PetpetidPostCode405Response.ResponseApiException( - "Received error statusCode response from server", - response, - deserializedResponse - ); - } - } -} diff --git a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/petpetid/post/PetpetidPostSecurityInfo.kt b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/petpetid/post/PetpetidPostSecurityInfo.kt deleted file mode 100644 index 3763c38088a..00000000000 --- a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/petpetid/post/PetpetidPostSecurityInfo.kt +++ /dev/null @@ -1,33 +0,0 @@ -package org.openapijsonschematools.client.paths.petpetid.post; - -import org.openapijsonschematools.client.paths.petpetid.post.security.PetpetidPostSecurityRequirementObject0; -import org.openapijsonschematools.client.paths.petpetid.post.security.PetpetidPostSecurityRequirementObject1; -import org.openapijsonschematools.client.securityrequirementobjects.SecurityRequirementObject; -import org.openapijsonschematools.client.securityrequirementobjects.SecurityRequirementObjectProvider; - -public class PetpetidPostSecurityInfo { - public static class PetpetidPostSecurityInfo1 implements SecurityRequirementObjectProvider { - public final PetpetidPostSecurityRequirementObject0 security0; - public final PetpetidPostSecurityRequirementObject1 security1; - - public PetpetidPostSecurityInfo1() { - security0 = new PetpetidPostSecurityRequirementObject0(); - security1 = new PetpetidPostSecurityRequirementObject1(); - } - - @Override - public SecurityRequirementObject getSecurityRequirementObject(SecurityIndex securityIndex) { - switch (securityIndex) { - case SECURITY_0: - return security0; - default: - return security1; - } - } - } - - public enum SecurityIndex { - SECURITY_0, - SECURITY_1 - } -} \ No newline at end of file diff --git a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/petpetid/post/parameters/Parameter0.kt b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/petpetid/post/parameters/Parameter0.kt deleted file mode 100644 index 13a19320b60..00000000000 --- a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/petpetid/post/parameters/Parameter0.kt +++ /dev/null @@ -1,23 +0,0 @@ -package org.openapijsonschematools.client.paths.petpetid.post.parameters; - -import org.openapijsonschematools.client.parameter.ParameterStyle; -import org.openapijsonschematools.client.parameter.ParameterInType; -import org.openapijsonschematools.client.parameter.SchemaParameter; -import org.openapijsonschematools.client.paths.petpetid.post.parameters.parameter0.Schema0; - -public class Parameter0 { - - public static class Parameter01 extends SchemaParameter { - public Parameter01() { - super( - "petId", - ParameterInType.PATH, - true, - ParameterStyle.SIMPLE, - false, - false, - Schema0.Schema01.getInstance() - ); - } - } -} diff --git a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/petpetid/post/parameters/parameter0/Schema0.kt b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/petpetid/post/parameters/parameter0/Schema0.kt deleted file mode 100644 index 2bcfb59b424..00000000000 --- a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/petpetid/post/parameters/parameter0/Schema0.kt +++ /dev/null @@ -1,19 +0,0 @@ -package org.openapijsonschematools.client.paths.petpetid.post.parameters.parameter0; -import org.checkerframework.checker.nullness.qual.Nullable; -import org.openapijsonschematools.client.schemas.Int64JsonSchema; - -public class Schema0 extends Int64JsonSchema { - // nest classes so all schemas and input/output classes can be public - - - public static class Schema01 extends Int64JsonSchema.Int64JsonSchema1 { - private static @Nullable Schema01 instance = null; - public static Schema01 getInstance() { - if (instance == null) { - instance = new Schema01(); - } - return instance; - } - } - -} diff --git a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/petpetid/post/requestbody/content/applicationxwwwformurlencoded/ApplicationxwwwformurlencodedSchema.kt b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/petpetid/post/requestbody/content/applicationxwwwformurlencoded/ApplicationxwwwformurlencodedSchema.kt deleted file mode 100644 index 66d56b3ba33..00000000000 --- a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/petpetid/post/requestbody/content/applicationxwwwformurlencoded/ApplicationxwwwformurlencodedSchema.kt +++ /dev/null @@ -1,238 +0,0 @@ -package org.openapijsonschematools.client.paths.petpetid.post.requestbody.content.applicationxwwwformurlencoded; -import java.util.ArrayList; -import java.util.HashSet; -import java.util.LinkedHashMap; -import java.util.LinkedHashSet; -import java.util.List; -import java.util.Map; -import java.util.Objects; -import java.util.Set; -import org.checkerframework.checker.nullness.qual.Nullable; -import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags; -import org.openapijsonschematools.client.configurations.SchemaConfiguration; -import org.openapijsonschematools.client.exceptions.InvalidAdditionalPropertyException; -import org.openapijsonschematools.client.exceptions.UnsetPropertyException; -import org.openapijsonschematools.client.exceptions.ValidationException; -import org.openapijsonschematools.client.schemas.GenericBuilder; -import org.openapijsonschematools.client.schemas.StringJsonSchema; -import org.openapijsonschematools.client.schemas.UnsetAddPropsSetter; -import org.openapijsonschematools.client.schemas.validation.FrozenMap; -import org.openapijsonschematools.client.schemas.validation.JsonSchema; -import org.openapijsonschematools.client.schemas.validation.JsonSchemaInfo; -import org.openapijsonschematools.client.schemas.validation.MapSchemaValidator; -import org.openapijsonschematools.client.schemas.validation.PathToSchemasMap; -import org.openapijsonschematools.client.schemas.validation.PropertyEntry; -import org.openapijsonschematools.client.schemas.validation.ValidationMetadata; - -public class ApplicationxwwwformurlencodedSchema { - // nest classes so all schemas and input/output classes can be public - - - public static class ApplicationxwwwformurlencodedName extends StringJsonSchema.StringJsonSchema1 { - private static @Nullable ApplicationxwwwformurlencodedName instance = null; - public static ApplicationxwwwformurlencodedName getInstance() { - if (instance == null) { - instance = new ApplicationxwwwformurlencodedName(); - } - return instance; - } - } - - - public static class ApplicationxwwwformurlencodedStatus extends StringJsonSchema.StringJsonSchema1 { - private static @Nullable ApplicationxwwwformurlencodedStatus instance = null; - public static ApplicationxwwwformurlencodedStatus getInstance() { - if (instance == null) { - instance = new ApplicationxwwwformurlencodedStatus(); - } - return instance; - } - } - - - public static class ApplicationxwwwformurlencodedSchemaMap extends FrozenMap<@Nullable Object> { - protected ApplicationxwwwformurlencodedSchemaMap(FrozenMap<@Nullable Object> m) { - super(m); - } - public static final Set requiredKeys = Set.of(); - public static final Set optionalKeys = Set.of( - "name", - "status" - ); - public static ApplicationxwwwformurlencodedSchemaMap of(Map arg, SchemaConfiguration configuration) throws ValidationException { - return ApplicationxwwwformurlencodedSchema1.getInstance().validate(arg, configuration); - } - - public String name() throws UnsetPropertyException { - String key = "name"; - throwIfKeyNotPresent(key); - @Nullable Object value = get(key); - if (!(value instanceof String)) { - throw new RuntimeException("Invalid value stored for name"); - } - return (String) value; - } - - public String status() throws UnsetPropertyException { - String key = "status"; - throwIfKeyNotPresent(key); - @Nullable Object value = get(key); - if (!(value instanceof String)) { - throw new RuntimeException("Invalid value stored for status"); - } - return (String) value; - } - - public @Nullable Object getAdditionalProperty(String name) throws UnsetPropertyException, InvalidAdditionalPropertyException { - throwIfKeyKnown(name, requiredKeys, optionalKeys); - throwIfKeyNotPresent(name); - return get(name); - } - } - - public interface SetterForApplicationxwwwformurlencodedName { - Map getInstance(); - T getBuilderAfterApplicationxwwwformurlencodedName(Map instance); - - default T name(String value) { - var instance = getInstance(); - instance.put("name", value); - return getBuilderAfterApplicationxwwwformurlencodedName(instance); - } - } - - public interface SetterForApplicationxwwwformurlencodedStatus { - Map getInstance(); - T getBuilderAfterApplicationxwwwformurlencodedStatus(Map instance); - - default T status(String value) { - var instance = getInstance(); - instance.put("status", value); - return getBuilderAfterApplicationxwwwformurlencodedStatus(instance); - } - } - - public static class ApplicationxwwwformurlencodedSchemaMapBuilder extends UnsetAddPropsSetter implements GenericBuilder>, SetterForApplicationxwwwformurlencodedName, SetterForApplicationxwwwformurlencodedStatus { - private final Map instance; - private static final Set knownKeys = Set.of( - "name", - "status" - ); - public Set getKnownKeys() { - return knownKeys; - } - public ApplicationxwwwformurlencodedSchemaMapBuilder() { - this.instance = new LinkedHashMap<>(); - } - public Map build() { - return instance; - } - public Map getInstance() { - return instance; - } - public ApplicationxwwwformurlencodedSchemaMapBuilder getBuilderAfterApplicationxwwwformurlencodedName(Map instance) { - return this; - } - public ApplicationxwwwformurlencodedSchemaMapBuilder getBuilderAfterApplicationxwwwformurlencodedStatus(Map instance) { - return this; - } - public ApplicationxwwwformurlencodedSchemaMapBuilder getBuilderAfterAdditionalProperty(Map instance) { - return this; - } - } - - - public sealed interface ApplicationxwwwformurlencodedSchema1Boxed permits ApplicationxwwwformurlencodedSchema1BoxedMap { - @Nullable Object getData(); - } - - public record ApplicationxwwwformurlencodedSchema1BoxedMap(ApplicationxwwwformurlencodedSchemaMap data) implements ApplicationxwwwformurlencodedSchema1Boxed { - @Override - public @Nullable Object getData() { - return data; - } - } - - - public static class ApplicationxwwwformurlencodedSchema1 extends JsonSchema implements MapSchemaValidator { - private static @Nullable ApplicationxwwwformurlencodedSchema1 instance = null; - - protected ApplicationxwwwformurlencodedSchema1() { - super(new JsonSchemaInfo() - .type(Set.of(Map.class)) - .properties(Map.ofEntries( - new PropertyEntry("name", ApplicationxwwwformurlencodedName.class), - new PropertyEntry("status", ApplicationxwwwformurlencodedStatus.class) - )) - ); - } - - public static ApplicationxwwwformurlencodedSchema1 getInstance() { - if (instance == null) { - instance = new ApplicationxwwwformurlencodedSchema1(); - } - return instance; - } - - 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 RuntimeException("Invalid non-string key value"); - } - String propertyName = (String) entryKey; - List propertyPathToItem = new ArrayList<>(pathToItem); - propertyPathToItem.add(propertyName); - Object value = entry.getValue(); - LinkedHashMap, Nothing?> schemas = pathToSchemas.get(propertyPathToItem); - if (schemas == null) { - throw new RuntimeException("Validation result is invalid, schemas must exist for a pathToItem"); - } - JsonSchema propertySchema = schemas.entrySet().iterator().next().getKey(); - @Nullable Object propertyInstance = propertySchema.getNewInstance(value, propertyPathToItem, pathToSchemas); - properties.put(propertyName, propertyInstance); - } - FrozenMap<@Nullable Object> castProperties = new FrozenMap<>(properties); - return new ApplicationxwwwformurlencodedSchemaMap(castProperties); - } - - 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); - SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().build())); - ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, new PathToSchemasMap(), new LinkedHashSet<>()); - PathToSchemasMap pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet); - return getNewInstance(castArg, validationMetadata.pathToItem(), pathToSchemasMap); - } - - - @Override - public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws 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"); - } - @Override - public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { - if (arg instanceof Map) { - return getNewInstance((Map) arg, pathToItem, pathToSchemas); - } - 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 { - return new ApplicationxwwwformurlencodedSchema1BoxedMap(validate(arg, configuration)); - } - @Override - public ApplicationxwwwformurlencodedSchema1Boxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { - 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"); - } - } - -} diff --git a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/petpetid/post/responses/PetpetidPostCode405Response.kt b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/petpetid/post/responses/PetpetidPostCode405Response.kt deleted file mode 100644 index 18f5a708fac..00000000000 --- a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/petpetid/post/responses/PetpetidPostCode405Response.kt +++ /dev/null @@ -1,45 +0,0 @@ -package org.openapijsonschematools.client.paths.petpetid.post.responses; - -import org.openapijsonschematools.client.configurations.SchemaConfiguration; -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; -import java.net.http.HttpResponse; -import java.net.http.HttpHeaders; - -public class PetpetidPostCode405Response { - - public static class PetpetidPostCode405Response1 extends ResponseDeserializer { - public PetpetidPostCode405Response1() { - super( - MapUtils.makeMap( - ) - ); - } - - @Override - protected Nothing? getBody(String contentType, Nothing? mediaType, byte[] body, SchemaConfiguration configuration) { - return null; - } - - @Override - protected Nothing? getHeaders(HttpHeaders headers, SchemaConfiguration configuration) { - return null; - } - } - - @SuppressWarnings("serial") - public static class ResponseApiException extends ApiException { - public DeserializedHttpResponse deserializedResponse; - - public ResponseApiException(String s, HttpResponse response, DeserializedHttpResponse deserializedResponse) { - super(s, response); - this.deserializedResponse = deserializedResponse; - } - } -} diff --git a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/petpetid/post/security/PetpetidPostSecurityRequirementObject0.kt b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/petpetid/post/security/PetpetidPostSecurityRequirementObject0.kt deleted file mode 100644 index 5362c41579c..00000000000 --- a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/petpetid/post/security/PetpetidPostSecurityRequirementObject0.kt +++ /dev/null @@ -1,24 +0,0 @@ -package org.openapijsonschematools.client.paths.petpetid.post.security; - -import org.checkerframework.checker.nullness.qual.Nullable; -import org.openapijsonschematools.client.securityrequirementobjects.SecurityRequirementObject; -import org.openapijsonschematools.client.securityschemes.SecurityScheme; -import org.openapijsonschematools.client.components.securityschemes.ApiKey; - -import java.util.List; -import java.util.Map; -import java.util.AbstractMap; - -public class PetpetidPostSecurityRequirementObject0 extends SecurityRequirementObject { - - public PetpetidPostSecurityRequirementObject0() { - super( - Map.ofEntries( - new AbstractMap.SimpleEntry, List>( - ApiKey.class, - List.of() - ) - ) - ); - } -} diff --git a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/petpetid/post/security/PetpetidPostSecurityRequirementObject1.kt b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/petpetid/post/security/PetpetidPostSecurityRequirementObject1.kt deleted file mode 100644 index 377bdaffd38..00000000000 --- a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/petpetid/post/security/PetpetidPostSecurityRequirementObject1.kt +++ /dev/null @@ -1,24 +0,0 @@ -package org.openapijsonschematools.client.paths.petpetid.post.security; - -import org.checkerframework.checker.nullness.qual.Nullable; -import org.openapijsonschematools.client.securityrequirementobjects.SecurityRequirementObject; -import org.openapijsonschematools.client.securityschemes.SecurityScheme; -import org.openapijsonschematools.client.components.securityschemes.PetstoreAuth; - -import java.util.List; -import java.util.Map; -import java.util.AbstractMap; - -public class PetpetidPostSecurityRequirementObject1 extends SecurityRequirementObject { - - public PetpetidPostSecurityRequirementObject1() { - super( - Map.ofEntries( - new AbstractMap.SimpleEntry, List>( - PetstoreAuth.class, - List.of("write:pets", "read:pets") - ) - ) - ); - } -} diff --git a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/petpetiduploadimage/PetpetiduploadimagePost.kt b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/petpetiduploadimage/PetpetiduploadimagePost.kt deleted file mode 100644 index 82c0dce116b..00000000000 --- a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/petpetiduploadimage/PetpetiduploadimagePost.kt +++ /dev/null @@ -1,243 +0,0 @@ -package org.openapijsonschematools.client.paths.petpetiduploadimage; - -import org.checkerframework.checker.nullness.qual.Nullable; -import org.openapijsonschematools.client.paths.petpetiduploadimage.post.PetpetiduploadimagePostRequestBody; -import org.openapijsonschematools.client.RootServerInfo; -import org.openapijsonschematools.client.paths.petpetiduploadimage.post.PetpetiduploadimagePostSecurityInfo; -import org.openapijsonschematools.client.paths.petpetiduploadimage.post.PetpetiduploadimagePostPathParameters; -import org.openapijsonschematools.client.paths.petpetiduploadimage.post.Parameters; -import org.openapijsonschematools.client.paths.petpetiduploadimage.post.PetpetiduploadimagePostResponses; -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.requestbody.SerializedRequestBody; -import org.openapijsonschematools.client.paths.Petpetiduploadimage; -import org.openapijsonschematools.client.securityrequirementobjects.SecurityRequirementObject; -import org.openapijsonschematools.client.securityrequirementobjects.AuthApplier; - -import java.io.IOException; -import java.util.ArrayList; -import java.net.http.HttpClient; -import java.net.http.HttpRequest; -import java.time.Duration; -import java.util.List; -import java.util.Map; - -public class PetpetiduploadimagePost { - private static class PostProvider extends AuthApplier { - private static final String method = "post"; - - public static PetpetiduploadimagePostResponses.EndpointResponse post( - PostRequest request, - ApiConfiguration apiConfiguration, - SchemaConfiguration schemaConfiguration, - HttpClient client - ) throws IOException, InterruptedException, ValidationException, NotImplementedException, ApiException { - Map> headers = apiConfiguration.getDefaultHeaders(); - - @Nullable SerializedRequestBody serializedRequestBody; - HttpRequest.BodyPublisher bodyPublisher = HttpRequest.BodyPublishers.noBody(); - if (request.requestBody != null) { - serializedRequestBody = new PetpetiduploadimagePostRequestBody.PetpetiduploadimagePostRequestBody1().serialize( - request.requestBody - ); - var contentTypeHeaderValues = headers.getOrDefault("Content-Type", new ArrayList<>()); - contentTypeHeaderValues.add(serializedRequestBody.contentType); - bodyPublisher = serializedRequestBody.bodyPublisher; - } - - var pathSerializer = new Parameters.PathParametersSerializer(); - String updatedPath = pathSerializer.serialize(request.pathParameters, Petpetiduploadimage.path); - // TODO set this to a map if there is a query security scheme - @Nullable Map queryMap = null; - String host = apiConfiguration.getServer(request.serverIndex).url(); - SecurityRequirementObject securityRequirementObject = apiConfiguration.getSecurityRequirementObject(request.securityIndex); - updateParamsForAuth( - securityRequirementObject, - headers, - updatedPath, - method, - bodyPublisher, - queryMap, - apiConfiguration - ); - - String url = host + updatedPath; - var httpRequest = RestClient.getRequest( - url, - method, - bodyPublisher, - headers, - request.timeout - ); - var response = RestClient.getResponse(httpRequest, client); - var responsesDeserializer = new PetpetiduploadimagePostResponses.PetpetiduploadimagePostResponses1(); - return responsesDeserializer.deserialize(response, schemaConfiguration); - } - } - - public interface PostOperation { - ApiConfiguration getApiConfiguration(); - SchemaConfiguration getSchemaConfiguration(); - HttpClient getClient(); - default PetpetiduploadimagePostResponses.EndpointResponse post(PostRequest request) throws IOException, InterruptedException, ValidationException, NotImplementedException, ApiException { - return PostProvider.post(request, getApiConfiguration(), getSchemaConfiguration(), getClient()); - } - } - - public interface UploadImageOperation { - ApiConfiguration getApiConfiguration(); - SchemaConfiguration getSchemaConfiguration(); - HttpClient getClient(); - default PetpetiduploadimagePostResponses.EndpointResponse uploadImage(PostRequest request) throws IOException, InterruptedException, ValidationException, NotImplementedException, ApiException { - return PostProvider.post(request, getApiConfiguration(), getSchemaConfiguration(), getClient()); - } - } - - public static class Post extends ApiClient implements PostOperation { - public Post(ApiConfiguration apiConfiguration, SchemaConfiguration schemaConfiguration) { - super(apiConfiguration, schemaConfiguration); - } - } - - public static class PostRequest { - public PetpetiduploadimagePostPathParameters.PathParametersMap pathParameters; - public PetpetiduploadimagePostRequestBody.@Nullable SealedRequestBody requestBody; - public RootServerInfo.@Nullable ServerIndex serverIndex; - public PetpetiduploadimagePostSecurityInfo.@Nullable SecurityIndex securityIndex; - public @Nullable Duration timeout; - - public PostRequest( - PetpetiduploadimagePostPathParameters.PathParametersMap pathParameters, - PetpetiduploadimagePostRequestBody.@Nullable SealedRequestBody requestBody, - RootServerInfo.@Nullable ServerIndex serverIndex, - PetpetiduploadimagePostSecurityInfo.@Nullable SecurityIndex securityIndex, - @Nullable Duration timeout - ) { - this.pathParameters = pathParameters; - this.requestBody = requestBody; - this.serverIndex = serverIndex; - this.securityIndex = securityIndex; - this.timeout = timeout; - } - } - - public static class PostNullableRequest { - public PetpetiduploadimagePostPathParameters.@Nullable PathParametersMap pathParameters; - public PetpetiduploadimagePostRequestBody.@Nullable SealedRequestBody requestBody; - public RootServerInfo.@Nullable ServerIndex serverIndex; - public PetpetiduploadimagePostSecurityInfo.@Nullable SecurityIndex securityIndex; - public @Nullable Duration timeout; - } - - public interface SetterForRequestBody { - PostNullableRequest getInstance(); - T getBuilderAfterRequestBody(PostNullableRequest instance); - default T requestBody(PetpetiduploadimagePostRequestBody.SealedRequestBody requestBody) { - var instance = getInstance(); - instance.requestBody = requestBody; - return getBuilderAfterRequestBody(instance); - } - } - - public interface SetterForServerIndex { - PostNullableRequest getInstance(); - T getBuilderAfterServerIndex(PostNullableRequest instance); - default T serverIndex(RootServerInfo.ServerIndex serverIndex) { - var instance = getInstance(); - instance.serverIndex = serverIndex; - return getBuilderAfterServerIndex(instance); - } - } - - public interface SetterForSecurityIndex { - PostNullableRequest getInstance(); - T getBuilderAfterSecurityIndex(PostNullableRequest instance); - default T securityIndex(PetpetiduploadimagePostSecurityInfo.SecurityIndex securityIndex) { - var instance = getInstance(); - instance.securityIndex = securityIndex; - return getBuilderAfterSecurityIndex(instance); - } - } - - public interface SetterForTimeout { - PostNullableRequest getInstance(); - T getBuilderAfterTimeout(PostNullableRequest instance); - default T timeout(Duration timeout) { - var instance = getInstance(); - instance.timeout = timeout; - return getBuilderAfterTimeout(instance); - } - } - - public interface SetterForPathParameters { - PostNullableRequest getInstance(); - T getBuilderAfterPathParameters(PostNullableRequest instance); - default T pathParameters(PetpetiduploadimagePostPathParameters.PathParametersMap pathParameters) { - var instance = getInstance(); - instance.pathParameters = pathParameters; - return getBuilderAfterPathParameters(instance); - } - } - - public static class Post0RequestBuilder implements SetterForRequestBody, SetterForServerIndex, SetterForSecurityIndex, SetterForTimeout { - private final PostNullableRequest instance; - - public Post0RequestBuilder(PostNullableRequest instance) { - this.instance = instance; - } - - public PostRequest build() { - var pathParameters = instance.pathParameters; - if (pathParameters == null) { - throw new RuntimeException("invalid null value for required parameter"); - } - return new PostRequest( - pathParameters, - instance.requestBody, - instance.serverIndex, - instance.securityIndex, - instance.timeout - ); - } - - public PostNullableRequest getInstance() { - return instance; - } - - public Post0RequestBuilder getBuilderAfterRequestBody(PostNullableRequest instance) { - return this; - } - - public Post0RequestBuilder getBuilderAfterServerIndex(PostNullableRequest instance) { - return this; - } - - public Post0RequestBuilder getBuilderAfterSecurityIndex(PostNullableRequest instance) { - return this; - } - - public Post0RequestBuilder getBuilderAfterTimeout(PostNullableRequest instance) { - return this; - } - } - public static class PostRequestBuilder implements SetterForPathParameters { - private final PostNullableRequest instance; - - public PostRequestBuilder() { - this.instance = new PostNullableRequest(); - } - - public PostNullableRequest getInstance() { - return instance; - } - - public Post0RequestBuilder getBuilderAfterPathParameters(PostNullableRequest instance) { - return new Post0RequestBuilder(instance); - } - } -} diff --git a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/petpetiduploadimage/post/Parameters.kt b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/petpetiduploadimage/post/Parameters.kt deleted file mode 100644 index 739ed320360..00000000000 --- a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/petpetiduploadimage/post/Parameters.kt +++ /dev/null @@ -1,20 +0,0 @@ -package org.openapijsonschematools.client.paths.petpetiduploadimage.post; - -import org.openapijsonschematools.client.paths.petpetiduploadimage.post.parameters.Parameter0; -import org.openapijsonschematools.client.parameter.PathSerializer; - -import java.util.Map; -import java.util.AbstractMap; - -public class Parameters { - - public static class PathParametersSerializer extends PathSerializer { - public PathParametersSerializer() { - super( - Map.ofEntries( - new AbstractMap.SimpleEntry<>("petId", new Parameter0.Parameter01()) - ) - ); - } - } -} diff --git a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/petpetiduploadimage/post/PetpetiduploadimagePostPathParameters.kt b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/petpetiduploadimage/post/PetpetiduploadimagePostPathParameters.kt deleted file mode 100644 index 466490e8f6e..00000000000 --- a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/petpetiduploadimage/post/PetpetiduploadimagePostPathParameters.kt +++ /dev/null @@ -1,223 +0,0 @@ -package org.openapijsonschematools.client.paths.petpetiduploadimage.post; -import java.util.ArrayList; -import java.util.HashSet; -import java.util.LinkedHashMap; -import java.util.LinkedHashSet; -import java.util.List; -import java.util.Map; -import java.util.Objects; -import java.util.Set; -import org.checkerframework.checker.nullness.qual.Nullable; -import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags; -import org.openapijsonschematools.client.configurations.SchemaConfiguration; -import org.openapijsonschematools.client.exceptions.UnsetPropertyException; -import org.openapijsonschematools.client.exceptions.ValidationException; -import org.openapijsonschematools.client.paths.petpetiduploadimage.post.parameters.parameter0.Schema0; -import org.openapijsonschematools.client.schemas.AnyTypeJsonSchema; -import org.openapijsonschematools.client.schemas.GenericBuilder; -import org.openapijsonschematools.client.schemas.NotAnyTypeJsonSchema; -import org.openapijsonschematools.client.schemas.validation.FrozenMap; -import org.openapijsonschematools.client.schemas.validation.JsonSchema; -import org.openapijsonschematools.client.schemas.validation.JsonSchemaInfo; -import org.openapijsonschematools.client.schemas.validation.MapSchemaValidator; -import org.openapijsonschematools.client.schemas.validation.MapUtils; -import org.openapijsonschematools.client.schemas.validation.PathToSchemasMap; -import org.openapijsonschematools.client.schemas.validation.PropertyEntry; -import org.openapijsonschematools.client.schemas.validation.ValidationMetadata; - -public class PetpetiduploadimagePostPathParameters { - // nest classes so all schemas and input/output classes can be public - - - public static class AdditionalProperties extends NotAnyTypeJsonSchema.NotAnyTypeJsonSchema1 { - // NotAnyTypeSchema - private static @Nullable AdditionalProperties instance = null; - public static AdditionalProperties getInstance() { - if (instance == null) { - instance = new AdditionalProperties(); - } - return instance; - } - } - - - public static class PathParametersMap extends FrozenMap { - protected PathParametersMap(FrozenMap m) { - super(m); - } - public static final Set requiredKeys = Set.of( - "petId" - ); - public static final Set optionalKeys = Set.of(); - public static PathParametersMap of(Map arg, SchemaConfiguration configuration) throws ValidationException { - return PetpetiduploadimagePostPathParameters1.getInstance().validate(arg, configuration); - } - - public Number petId() { - try { - return getOrThrow("version"); - } catch (UnsetPropertyException e) { - throw new RuntimeException(e); - } - } - } - - public interface SetterForPetId { - Map getInstance(); - T getBuilderAfterPetId(Map instance); - - default T petId(int value) { - var instance = getInstance(); - instance.put("petId", value); - return getBuilderAfterPetId(instance); - } - - default T petId(float value) { - var instance = getInstance(); - instance.put("petId", value); - return getBuilderAfterPetId(instance); - } - - default T petId(long value) { - var instance = getInstance(); - instance.put("petId", value); - return getBuilderAfterPetId(instance); - } - - default T petId(double value) { - var instance = getInstance(); - instance.put("petId", value); - return getBuilderAfterPetId(instance); - } - } - - public static class PathParametersMap0Builder implements GenericBuilder> { - private final Map instance; - private static final Set knownKeys = Set.of( - "petId" - ); - public Set getKnownKeys() { - return knownKeys; - } - public PathParametersMap0Builder(Map instance) { - this.instance = instance; - } - public Map build() { - return instance; - } - } - - public static class PathParametersMapBuilder implements SetterForPetId { - private final Map instance; - public PathParametersMapBuilder() { - this.instance = new LinkedHashMap<>(); - } - public Map getInstance() { - return instance; - } - public PathParametersMap0Builder getBuilderAfterPetId(Map instance) { - return new PathParametersMap0Builder(instance); - } - } - - - public sealed interface PetpetiduploadimagePostPathParameters1Boxed permits PetpetiduploadimagePostPathParameters1BoxedMap { - @Nullable Object getData(); - } - - public record PetpetiduploadimagePostPathParameters1BoxedMap(PathParametersMap data) implements PetpetiduploadimagePostPathParameters1Boxed { - @Override - public @Nullable Object getData() { - return data; - } - } - - - public static class PetpetiduploadimagePostPathParameters1 extends JsonSchema implements MapSchemaValidator { - private static @Nullable PetpetiduploadimagePostPathParameters1 instance = null; - - protected PetpetiduploadimagePostPathParameters1() { - super(new JsonSchemaInfo() - .type(Set.of(Map.class)) - .properties(Map.ofEntries( - new PropertyEntry("petId", Schema0.Schema01.class) - )) - .required(Set.of( - "petId" - )) - .additionalProperties(AdditionalProperties.class) - ); - } - - public static PetpetiduploadimagePostPathParameters1 getInstance() { - if (instance == null) { - instance = new PetpetiduploadimagePostPathParameters1(); - } - return instance; - } - - 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 RuntimeException("Invalid non-string key value"); - } - String propertyName = (String) entryKey; - List propertyPathToItem = new ArrayList<>(pathToItem); - propertyPathToItem.add(propertyName); - Object value = entry.getValue(); - LinkedHashMap, Nothing?> schemas = pathToSchemas.get(propertyPathToItem); - if (schemas == null) { - throw new RuntimeException("Validation 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"); - } - properties.put(propertyName, (Number) propertyInstance); - } - FrozenMap castProperties = new FrozenMap<>(properties); - return new PathParametersMap(castProperties); - } - - 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); - SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().build())); - ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, new PathToSchemasMap(), new LinkedHashSet<>()); - PathToSchemasMap pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet); - return getNewInstance(castArg, validationMetadata.pathToItem(), pathToSchemasMap); - } - - - @Override - public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws 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"); - } - @Override - public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { - if (arg instanceof Map) { - return getNewInstance((Map) arg, pathToItem, pathToSchemas); - } - throw new RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); - } - @Override - public PetpetiduploadimagePostPathParameters1BoxedMap validateAndBox(Map arg, SchemaConfiguration configuration) throws ValidationException { - return new PetpetiduploadimagePostPathParameters1BoxedMap(validate(arg, configuration)); - } - @Override - public PetpetiduploadimagePostPathParameters1Boxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { - 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"); - } - } - -} diff --git a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/petpetiduploadimage/post/PetpetiduploadimagePostRequestBody.kt b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/petpetiduploadimage/post/PetpetiduploadimagePostRequestBody.kt deleted file mode 100644 index c116b828c24..00000000000 --- a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/petpetiduploadimage/post/PetpetiduploadimagePostRequestBody.kt +++ /dev/null @@ -1,49 +0,0 @@ -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; -import org.openapijsonschematools.client.mediatype.MediaType; -import org.openapijsonschematools.client.paths.petpetiduploadimage.post.requestbody.content.multipartformdata.MultipartformdataSchema; - -import java.util.AbstractMap; -import java.util.Map; - -public class PetpetiduploadimagePostRequestBody { - public sealed interface SealedMediaType permits MultipartformdataMediaType {} - - public record MultipartformdataMediaType(MultipartformdataSchema.MultipartformdataSchema1 schema) implements SealedMediaType, MediaType { - public MultipartformdataMediaType() { - this(MultipartformdataSchema.MultipartformdataSchema1.getInstance()); - } - @Override - public Nothing? encoding() { - return null; - } - } - - public static class PetpetiduploadimagePostRequestBody1 extends RequestBodySerializer { - public PetpetiduploadimagePostRequestBody1() { - super( - Map.ofEntries( - new AbstractMap.SimpleEntry<>("multipart/form-data", new MultipartformdataMediaType()) - ), - false - ); - } - - public SerializedRequestBody serialize(SealedRequestBody requestBody) throws NotImplementedException { - MultipartformdataRequestBody requestBody0 = (MultipartformdataRequestBody) requestBody; - return serialize(requestBody0.contentType(), requestBody0.body().getData()); - } - } - - public sealed interface SealedRequestBody permits MultipartformdataRequestBody {} - public record MultipartformdataRequestBody(MultipartformdataSchema.MultipartformdataSchema1Boxed body) implements SealedRequestBody, GenericRequestBody { - @Override - public String contentType() { - return "multipart/form-data"; - } - } -} diff --git a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/petpetiduploadimage/post/PetpetiduploadimagePostResponses.kt b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/petpetiduploadimage/post/PetpetiduploadimagePostResponses.kt deleted file mode 100644 index ef9ecbb0b8a..00000000000 --- a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/petpetiduploadimage/post/PetpetiduploadimagePostResponses.kt +++ /dev/null @@ -1,54 +0,0 @@ -package org.openapijsonschematools.client.paths.petpetiduploadimage.post; - -import org.openapijsonschematools.client.paths.petpetiduploadimage.post.responses.PetpetiduploadimagePostCode200Response; -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; -import org.checkerframework.checker.nullness.qual.Nullable; - -import java.net.http.HttpResponse; -import java.util.Map; -import java.util.AbstractMap; - -public class PetpetiduploadimagePostResponses { - public sealed interface EndpointResponse permits EndpointPetpetiduploadimagePostCode200Response {} - - public record EndpointPetpetiduploadimagePostCode200Response( - HttpResponse response, - PetpetiduploadimagePostCode200Response.SealedResponseBody body, - SuccessWithJsonApiResponseHeadersSchema.SuccessWithJsonApiResponseHeadersSchemaMap headers - ) implements EndpointResponse, ApiResponse{ - } - - public sealed interface StatusCodeResponseDeserializer permits StatusPetpetiduploadimagePostCode200ResponseDeserializer {} - - public static final class StatusPetpetiduploadimagePostCode200ResponseDeserializer extends PetpetiduploadimagePostCode200Response.PetpetiduploadimagePostCode200Response1 implements StatusCodeResponseDeserializer { - } - - public static final class PetpetiduploadimagePostResponses1 implements ResponsesDeserializer { - private final Map statusCodeToResponseDeserializer; - public PetpetiduploadimagePostResponses1() { - this.statusCodeToResponseDeserializer = Map.ofEntries( - new AbstractMap.SimpleEntry<>("200", new StatusPetpetiduploadimagePostCode200ResponseDeserializer()) - ); - } - - 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) { - throw new ApiException( - "Invalid response statusCode="+statusCode+" has no response defined in the openapi document", - response - ); - } - StatusPetpetiduploadimagePostCode200ResponseDeserializer castDeserializer = (StatusPetpetiduploadimagePostCode200ResponseDeserializer) statusCodeDeserializer; - var deserializedResponse = castDeserializer.deserialize(response, configuration); - return new EndpointPetpetiduploadimagePostCode200Response(response, deserializedResponse.body(), deserializedResponse.headers()); - } - } -} diff --git a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/petpetiduploadimage/post/PetpetiduploadimagePostSecurityInfo.kt b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/petpetiduploadimage/post/PetpetiduploadimagePostSecurityInfo.kt deleted file mode 100644 index 0418c7b90c0..00000000000 --- a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/petpetiduploadimage/post/PetpetiduploadimagePostSecurityInfo.kt +++ /dev/null @@ -1,24 +0,0 @@ -package org.openapijsonschematools.client.paths.petpetiduploadimage.post; - -import org.openapijsonschematools.client.paths.petpetiduploadimage.post.security.PetpetiduploadimagePostSecurityRequirementObject0; -import org.openapijsonschematools.client.securityrequirementobjects.SecurityRequirementObject; -import org.openapijsonschematools.client.securityrequirementobjects.SecurityRequirementObjectProvider; - -public class PetpetiduploadimagePostSecurityInfo { - public static class PetpetiduploadimagePostSecurityInfo1 implements SecurityRequirementObjectProvider { - public final PetpetiduploadimagePostSecurityRequirementObject0 security0; - - public PetpetiduploadimagePostSecurityInfo1() { - security0 = new PetpetiduploadimagePostSecurityRequirementObject0(); - } - - @Override - public SecurityRequirementObject getSecurityRequirementObject(SecurityIndex securityIndex) { - return security0; - } - } - - public enum SecurityIndex { - SECURITY_0 - } -} \ No newline at end of file diff --git a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/petpetiduploadimage/post/parameters/Parameter0.kt b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/petpetiduploadimage/post/parameters/Parameter0.kt deleted file mode 100644 index e6002b4ec9d..00000000000 --- a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/petpetiduploadimage/post/parameters/Parameter0.kt +++ /dev/null @@ -1,23 +0,0 @@ -package org.openapijsonschematools.client.paths.petpetiduploadimage.post.parameters; - -import org.openapijsonschematools.client.parameter.ParameterStyle; -import org.openapijsonschematools.client.parameter.ParameterInType; -import org.openapijsonschematools.client.parameter.SchemaParameter; -import org.openapijsonschematools.client.paths.petpetiduploadimage.post.parameters.parameter0.Schema0; - -public class Parameter0 { - - public static class Parameter01 extends SchemaParameter { - public Parameter01() { - super( - "petId", - ParameterInType.PATH, - true, - ParameterStyle.SIMPLE, - false, - false, - Schema0.Schema01.getInstance() - ); - } - } -} diff --git a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/petpetiduploadimage/post/parameters/parameter0/Schema0.kt b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/petpetiduploadimage/post/parameters/parameter0/Schema0.kt deleted file mode 100644 index e314fe44ae4..00000000000 --- a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/petpetiduploadimage/post/parameters/parameter0/Schema0.kt +++ /dev/null @@ -1,19 +0,0 @@ -package org.openapijsonschematools.client.paths.petpetiduploadimage.post.parameters.parameter0; -import org.checkerframework.checker.nullness.qual.Nullable; -import org.openapijsonschematools.client.schemas.Int64JsonSchema; - -public class Schema0 extends Int64JsonSchema { - // nest classes so all schemas and input/output classes can be public - - - public static class Schema01 extends Int64JsonSchema.Int64JsonSchema1 { - private static @Nullable Schema01 instance = null; - public static Schema01 getInstance() { - if (instance == null) { - instance = new Schema01(); - } - return instance; - } - } - -} diff --git a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/petpetiduploadimage/post/requestbody/content/multipartformdata/MultipartformdataSchema.kt b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/petpetiduploadimage/post/requestbody/content/multipartformdata/MultipartformdataSchema.kt deleted file mode 100644 index f4aef640a30..00000000000 --- a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/petpetiduploadimage/post/requestbody/content/multipartformdata/MultipartformdataSchema.kt +++ /dev/null @@ -1,239 +0,0 @@ -package org.openapijsonschematools.client.paths.petpetiduploadimage.post.requestbody.content.multipartformdata; -import java.util.ArrayList; -import java.util.HashSet; -import java.util.LinkedHashMap; -import java.util.LinkedHashSet; -import java.util.List; -import java.util.Map; -import java.util.Objects; -import java.util.Set; -import org.checkerframework.checker.nullness.qual.Nullable; -import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags; -import org.openapijsonschematools.client.configurations.SchemaConfiguration; -import org.openapijsonschematools.client.exceptions.InvalidAdditionalPropertyException; -import org.openapijsonschematools.client.exceptions.UnsetPropertyException; -import org.openapijsonschematools.client.exceptions.ValidationException; -import org.openapijsonschematools.client.schemas.GenericBuilder; -import org.openapijsonschematools.client.schemas.StringJsonSchema; -import org.openapijsonschematools.client.schemas.UnsetAddPropsSetter; -import org.openapijsonschematools.client.schemas.validation.FrozenMap; -import org.openapijsonschematools.client.schemas.validation.JsonSchema; -import org.openapijsonschematools.client.schemas.validation.JsonSchemaInfo; -import org.openapijsonschematools.client.schemas.validation.MapSchemaValidator; -import org.openapijsonschematools.client.schemas.validation.PathToSchemasMap; -import org.openapijsonschematools.client.schemas.validation.PropertyEntry; -import org.openapijsonschematools.client.schemas.validation.ValidationMetadata; - -public class MultipartformdataSchema { - // nest classes so all schemas and input/output classes can be public - - - public static class MultipartformdataAdditionalMetadata extends StringJsonSchema.StringJsonSchema1 { - private static @Nullable MultipartformdataAdditionalMetadata instance = null; - public static MultipartformdataAdditionalMetadata getInstance() { - if (instance == null) { - instance = new MultipartformdataAdditionalMetadata(); - } - return instance; - } - } - - - public static class MultipartformdataFile extends StringJsonSchema.StringJsonSchema1 { - // BinarySchema - private static @Nullable MultipartformdataFile instance = null; - public static MultipartformdataFile getInstance() { - if (instance == null) { - instance = new MultipartformdataFile(); - } - return instance; - } - } - - - public static class MultipartformdataSchemaMap extends FrozenMap<@Nullable Object> { - protected MultipartformdataSchemaMap(FrozenMap<@Nullable Object> m) { - super(m); - } - public static final Set requiredKeys = Set.of(); - public static final Set optionalKeys = Set.of( - "additionalMetadata", - "file" - ); - public static MultipartformdataSchemaMap of(Map arg, SchemaConfiguration configuration) throws ValidationException { - return MultipartformdataSchema1.getInstance().validate(arg, configuration); - } - - public String additionalMetadata() throws UnsetPropertyException { - String key = "additionalMetadata"; - throwIfKeyNotPresent(key); - @Nullable Object value = get(key); - if (!(value instanceof String)) { - throw new RuntimeException("Invalid value stored for additionalMetadata"); - } - return (String) value; - } - - public String file() throws UnsetPropertyException { - String key = "file"; - throwIfKeyNotPresent(key); - @Nullable Object value = get(key); - if (!(value instanceof String)) { - throw new RuntimeException("Invalid value stored for file"); - } - return (String) value; - } - - public @Nullable Object getAdditionalProperty(String name) throws UnsetPropertyException, InvalidAdditionalPropertyException { - throwIfKeyKnown(name, requiredKeys, optionalKeys); - throwIfKeyNotPresent(name); - return get(name); - } - } - - public interface SetterForMultipartformdataAdditionalMetadata { - Map getInstance(); - T getBuilderAfterMultipartformdataAdditionalMetadata(Map instance); - - default T additionalMetadata(String value) { - var instance = getInstance(); - instance.put("additionalMetadata", value); - return getBuilderAfterMultipartformdataAdditionalMetadata(instance); - } - } - - public interface SetterForMultipartformdataFile { - Map getInstance(); - T getBuilderAfterMultipartformdataFile(Map instance); - - default T file(String value) { - var instance = getInstance(); - instance.put("file", value); - return getBuilderAfterMultipartformdataFile(instance); - } - } - - public static class MultipartformdataSchemaMapBuilder extends UnsetAddPropsSetter implements GenericBuilder>, SetterForMultipartformdataAdditionalMetadata, SetterForMultipartformdataFile { - private final Map instance; - private static final Set knownKeys = Set.of( - "additionalMetadata", - "file" - ); - public Set getKnownKeys() { - return knownKeys; - } - public MultipartformdataSchemaMapBuilder() { - this.instance = new LinkedHashMap<>(); - } - public Map build() { - return instance; - } - public Map getInstance() { - return instance; - } - public MultipartformdataSchemaMapBuilder getBuilderAfterMultipartformdataAdditionalMetadata(Map instance) { - return this; - } - public MultipartformdataSchemaMapBuilder getBuilderAfterMultipartformdataFile(Map instance) { - return this; - } - public MultipartformdataSchemaMapBuilder getBuilderAfterAdditionalProperty(Map instance) { - return this; - } - } - - - public sealed interface MultipartformdataSchema1Boxed permits MultipartformdataSchema1BoxedMap { - @Nullable Object getData(); - } - - public record MultipartformdataSchema1BoxedMap(MultipartformdataSchemaMap data) implements MultipartformdataSchema1Boxed { - @Override - public @Nullable Object getData() { - return data; - } - } - - - public static class MultipartformdataSchema1 extends JsonSchema implements MapSchemaValidator { - private static @Nullable MultipartformdataSchema1 instance = null; - - protected MultipartformdataSchema1() { - super(new JsonSchemaInfo() - .type(Set.of(Map.class)) - .properties(Map.ofEntries( - new PropertyEntry("additionalMetadata", MultipartformdataAdditionalMetadata.class), - new PropertyEntry("file", MultipartformdataFile.class) - )) - ); - } - - public static MultipartformdataSchema1 getInstance() { - if (instance == null) { - instance = new MultipartformdataSchema1(); - } - return instance; - } - - 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 RuntimeException("Invalid non-string key value"); - } - String propertyName = (String) entryKey; - List propertyPathToItem = new ArrayList<>(pathToItem); - propertyPathToItem.add(propertyName); - Object value = entry.getValue(); - LinkedHashMap, Nothing?> schemas = pathToSchemas.get(propertyPathToItem); - if (schemas == null) { - throw new RuntimeException("Validation result is invalid, schemas must exist for a pathToItem"); - } - JsonSchema propertySchema = schemas.entrySet().iterator().next().getKey(); - @Nullable Object propertyInstance = propertySchema.getNewInstance(value, propertyPathToItem, pathToSchemas); - properties.put(propertyName, propertyInstance); - } - FrozenMap<@Nullable Object> castProperties = new FrozenMap<>(properties); - return new MultipartformdataSchemaMap(castProperties); - } - - 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); - SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().build())); - ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, new PathToSchemasMap(), new LinkedHashSet<>()); - PathToSchemasMap pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet); - return getNewInstance(castArg, validationMetadata.pathToItem(), pathToSchemasMap); - } - - - @Override - public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws 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"); - } - @Override - public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { - if (arg instanceof Map) { - return getNewInstance((Map) arg, pathToItem, pathToSchemas); - } - 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 { - return new MultipartformdataSchema1BoxedMap(validate(arg, configuration)); - } - @Override - public MultipartformdataSchema1Boxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { - 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"); - } - } - -} diff --git a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/petpetiduploadimage/post/responses/PetpetiduploadimagePostCode200Response.kt b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/petpetiduploadimage/post/responses/PetpetiduploadimagePostCode200Response.kt deleted file mode 100644 index c597f9f42d7..00000000000 --- a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/petpetiduploadimage/post/responses/PetpetiduploadimagePostCode200Response.kt +++ /dev/null @@ -1,7 +0,0 @@ -package org.openapijsonschematools.client.paths.petpetiduploadimage.post.responses; - -import org.openapijsonschematools.client.components.responses.SuccessWithJsonApiResponse; - -public class PetpetiduploadimagePostCode200Response extends SuccessWithJsonApiResponse { - public static class PetpetiduploadimagePostCode200Response1 extends SuccessWithJsonApiResponse1 {} -} diff --git a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/petpetiduploadimage/post/security/PetpetiduploadimagePostSecurityRequirementObject0.kt b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/petpetiduploadimage/post/security/PetpetiduploadimagePostSecurityRequirementObject0.kt deleted file mode 100644 index 2a6e237ed37..00000000000 --- a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/petpetiduploadimage/post/security/PetpetiduploadimagePostSecurityRequirementObject0.kt +++ /dev/null @@ -1,24 +0,0 @@ -package org.openapijsonschematools.client.paths.petpetiduploadimage.post.security; - -import org.checkerframework.checker.nullness.qual.Nullable; -import org.openapijsonschematools.client.securityrequirementobjects.SecurityRequirementObject; -import org.openapijsonschematools.client.securityschemes.SecurityScheme; -import org.openapijsonschematools.client.components.securityschemes.PetstoreAuth; - -import java.util.List; -import java.util.Map; -import java.util.AbstractMap; - -public class PetpetiduploadimagePostSecurityRequirementObject0 extends SecurityRequirementObject { - - public PetpetiduploadimagePostSecurityRequirementObject0() { - super( - Map.ofEntries( - new AbstractMap.SimpleEntry, List>( - PetstoreAuth.class, - List.of("write:pets", "read:pets") - ) - ) - ); - } -} diff --git a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/solidus/SolidusGet.kt b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/solidus/SolidusGet.kt deleted file mode 100644 index 6d03a9384b5..00000000000 --- a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/solidus/SolidusGet.kt +++ /dev/null @@ -1,124 +0,0 @@ -package org.openapijsonschematools.client.paths.solidus; - -import org.checkerframework.checker.nullness.qual.Nullable; -import org.openapijsonschematools.client.RootServerInfo; -import org.openapijsonschematools.client.paths.solidus.get.SolidusGetResponses; -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.paths.Solidus; - -import java.io.IOException; -import java.net.http.HttpClient; -import java.net.http.HttpRequest; -import java.time.Duration; -import java.util.List; -import java.util.Map; - -public class SolidusGet { - private static class GetProvider { - private static final String method = "get"; - - public static SolidusGetResponses.EndpointResponse get( - GetRequest request, - ApiConfiguration apiConfiguration, - SchemaConfiguration schemaConfiguration, - HttpClient client - ) 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 - @Nullable Map queryMap = null; - String host = apiConfiguration.getServer(request.serverIndex).url(); - - String url = host + Solidus.path; - var httpRequest = RestClient.getRequest( - url, - method, - bodyPublisher, - headers, - request.timeout - ); - var response = RestClient.getResponse(httpRequest, client); - var responsesDeserializer = new SolidusGetResponses.SolidusGetResponses1(); - return responsesDeserializer.deserialize(response, schemaConfiguration); - } - } - - public interface GetOperation { - ApiConfiguration getApiConfiguration(); - SchemaConfiguration getSchemaConfiguration(); - HttpClient getClient(); - default SolidusGetResponses.EndpointResponse get(GetRequest request) throws IOException, InterruptedException, ValidationException, NotImplementedException, ApiException { - return GetProvider.get(request, getApiConfiguration(), getSchemaConfiguration(), getClient()); - } - } - - public interface SlashRouteOperation { - ApiConfiguration getApiConfiguration(); - SchemaConfiguration getSchemaConfiguration(); - HttpClient getClient(); - default SolidusGetResponses.EndpointResponse slashRoute(GetRequest request) throws IOException, InterruptedException, ValidationException, NotImplementedException, ApiException { - return GetProvider.get(request, getApiConfiguration(), getSchemaConfiguration(), getClient()); - } - } - - public static class Get extends ApiClient implements GetOperation { - public Get(ApiConfiguration apiConfiguration, SchemaConfiguration schemaConfiguration) { - super(apiConfiguration, schemaConfiguration); - } - } - - public static class GetRequest { - public RootServerInfo.@Nullable ServerIndex serverIndex; - public @Nullable Duration timeout; - } - - public interface SetterForServerIndex { - GetRequest getInstance(); - T getBuilderAfterServerIndex(GetRequest instance); - default T serverIndex(RootServerInfo.ServerIndex serverIndex) { - var instance = getInstance(); - instance.serverIndex = serverIndex; - return getBuilderAfterServerIndex(instance); - } - } - - public interface SetterForTimeout { - GetRequest getInstance(); - T getBuilderAfterTimeout(GetRequest instance); - default T timeout(Duration timeout) { - var instance = getInstance(); - instance.timeout = timeout; - return getBuilderAfterTimeout(instance); - } - } - - public static class GetRequestBuilder implements SetterForServerIndex, SetterForTimeout { - private final GetRequest instance; - - public GetRequestBuilder() { - this.instance = new GetRequest(); - } - - public GetRequest build() { - return instance; - } - - public GetRequest getInstance() { - return instance; - } - - public GetRequestBuilder getBuilderAfterServerIndex(GetRequest instance) { - return this; - } - - public GetRequestBuilder getBuilderAfterTimeout(GetRequest instance) { - return this; - } - } -} diff --git a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/solidus/get/SolidusGetResponses.kt b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/solidus/get/SolidusGetResponses.kt deleted file mode 100644 index 1e7023c2427..00000000000 --- a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/solidus/get/SolidusGetResponses.kt +++ /dev/null @@ -1,53 +0,0 @@ -package org.openapijsonschematools.client.paths.solidus.get; - -import org.openapijsonschematools.client.paths.solidus.get.responses.SolidusGetCode200Response; -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; -import org.checkerframework.checker.nullness.qual.Nullable; - -import java.net.http.HttpResponse; -import java.util.Map; -import java.util.AbstractMap; - -public class SolidusGetResponses { - public sealed interface EndpointResponse permits EndpointSolidusGetCode200Response {} - - public record EndpointSolidusGetCode200Response( - HttpResponse response, - Nothing? body, - Nothing? headers - ) implements EndpointResponse, ApiResponse{ - } - - public sealed interface StatusCodeResponseDeserializer permits StatusSolidusGetCode200ResponseDeserializer {} - - public static final class StatusSolidusGetCode200ResponseDeserializer extends SolidusGetCode200Response.SolidusGetCode200Response1 implements StatusCodeResponseDeserializer { - } - - public static final class SolidusGetResponses1 implements ResponsesDeserializer { - private final Map statusCodeToResponseDeserializer; - public SolidusGetResponses1() { - this.statusCodeToResponseDeserializer = Map.ofEntries( - new AbstractMap.SimpleEntry<>("200", new StatusSolidusGetCode200ResponseDeserializer()) - ); - } - - 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) { - throw new ApiException( - "Invalid response statusCode="+statusCode+" has no response defined in the openapi document", - response - ); - } - StatusSolidusGetCode200ResponseDeserializer castDeserializer = (StatusSolidusGetCode200ResponseDeserializer) statusCodeDeserializer; - var deserializedResponse = castDeserializer.deserialize(response, configuration); - return new EndpointSolidusGetCode200Response(response, deserializedResponse.body(), deserializedResponse.headers()); - } - } -} diff --git a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/solidus/get/responses/SolidusGetCode200Response.kt b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/solidus/get/responses/SolidusGetCode200Response.kt deleted file mode 100644 index 9560cc160dd..00000000000 --- a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/solidus/get/responses/SolidusGetCode200Response.kt +++ /dev/null @@ -1,7 +0,0 @@ -package org.openapijsonschematools.client.paths.solidus.get.responses; - -import org.openapijsonschematools.client.components.responses.SuccessDescriptionOnly; - -public class SolidusGetCode200Response extends SuccessDescriptionOnly { - public static class SolidusGetCode200Response1 extends SuccessDescriptionOnly1 {} -} diff --git a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/storeinventory/StoreinventoryGet.kt b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/storeinventory/StoreinventoryGet.kt deleted file mode 100644 index 13cf7cda7a6..00000000000 --- a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/storeinventory/StoreinventoryGet.kt +++ /dev/null @@ -1,152 +0,0 @@ -package org.openapijsonschematools.client.paths.storeinventory; - -import org.checkerframework.checker.nullness.qual.Nullable; -import org.openapijsonschematools.client.RootServerInfo; -import org.openapijsonschematools.client.paths.storeinventory.get.StoreinventoryGetSecurityInfo; -import org.openapijsonschematools.client.paths.storeinventory.get.StoreinventoryGetResponses; -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.paths.Storeinventory; -import org.openapijsonschematools.client.securityrequirementobjects.SecurityRequirementObject; -import org.openapijsonschematools.client.securityrequirementobjects.AuthApplier; - -import java.io.IOException; -import java.net.http.HttpClient; -import java.net.http.HttpRequest; -import java.time.Duration; -import java.util.List; -import java.util.Map; - -public class StoreinventoryGet { - private static class GetProvider extends AuthApplier { - private static final String method = "get"; - - public static StoreinventoryGetResponses.EndpointResponse get( - GetRequest request, - ApiConfiguration apiConfiguration, - SchemaConfiguration schemaConfiguration, - HttpClient client - ) 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 - @Nullable Map queryMap = null; - String host = apiConfiguration.getServer(request.serverIndex).url(); - SecurityRequirementObject securityRequirementObject = apiConfiguration.getSecurityRequirementObject(request.securityIndex); - updateParamsForAuth( - securityRequirementObject, - headers, - Storeinventory.path, - method, - bodyPublisher, - queryMap, - apiConfiguration - ); - - String url = host + Storeinventory.path; - var httpRequest = RestClient.getRequest( - url, - method, - bodyPublisher, - headers, - request.timeout - ); - var response = RestClient.getResponse(httpRequest, client); - var responsesDeserializer = new StoreinventoryGetResponses.StoreinventoryGetResponses1(); - return responsesDeserializer.deserialize(response, schemaConfiguration); - } - } - - public interface GetOperation { - ApiConfiguration getApiConfiguration(); - SchemaConfiguration getSchemaConfiguration(); - HttpClient getClient(); - default StoreinventoryGetResponses.EndpointResponse get(GetRequest request) throws IOException, InterruptedException, ValidationException, NotImplementedException, ApiException { - return GetProvider.get(request, getApiConfiguration(), getSchemaConfiguration(), getClient()); - } - } - - public interface GetInventoryOperation { - ApiConfiguration getApiConfiguration(); - SchemaConfiguration getSchemaConfiguration(); - HttpClient getClient(); - default StoreinventoryGetResponses.EndpointResponse getInventory(GetRequest request) throws IOException, InterruptedException, ValidationException, NotImplementedException, ApiException { - return GetProvider.get(request, getApiConfiguration(), getSchemaConfiguration(), getClient()); - } - } - - public static class Get extends ApiClient implements GetOperation { - public Get(ApiConfiguration apiConfiguration, SchemaConfiguration schemaConfiguration) { - super(apiConfiguration, schemaConfiguration); - } - } - - public static class GetRequest { - public RootServerInfo.@Nullable ServerIndex serverIndex; - public StoreinventoryGetSecurityInfo.@Nullable SecurityIndex securityIndex; - public @Nullable Duration timeout; - } - - public interface SetterForServerIndex { - GetRequest getInstance(); - T getBuilderAfterServerIndex(GetRequest instance); - default T serverIndex(RootServerInfo.ServerIndex serverIndex) { - var instance = getInstance(); - instance.serverIndex = serverIndex; - return getBuilderAfterServerIndex(instance); - } - } - - public interface SetterForSecurityIndex { - GetRequest getInstance(); - T getBuilderAfterSecurityIndex(GetRequest instance); - default T securityIndex(StoreinventoryGetSecurityInfo.SecurityIndex securityIndex) { - var instance = getInstance(); - instance.securityIndex = securityIndex; - return getBuilderAfterSecurityIndex(instance); - } - } - - public interface SetterForTimeout { - GetRequest getInstance(); - T getBuilderAfterTimeout(GetRequest instance); - default T timeout(Duration timeout) { - var instance = getInstance(); - instance.timeout = timeout; - return getBuilderAfterTimeout(instance); - } - } - - public static class GetRequestBuilder implements SetterForServerIndex, SetterForSecurityIndex, SetterForTimeout { - private final GetRequest instance; - - public GetRequestBuilder() { - this.instance = new GetRequest(); - } - - public GetRequest build() { - return instance; - } - - public GetRequest getInstance() { - return instance; - } - - public GetRequestBuilder getBuilderAfterServerIndex(GetRequest instance) { - return this; - } - - public GetRequestBuilder getBuilderAfterSecurityIndex(GetRequest instance) { - return this; - } - - public GetRequestBuilder getBuilderAfterTimeout(GetRequest instance) { - return this; - } - } -} diff --git a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/storeinventory/get/StoreinventoryGetResponses.kt b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/storeinventory/get/StoreinventoryGetResponses.kt deleted file mode 100644 index 389cb0617a3..00000000000 --- a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/storeinventory/get/StoreinventoryGetResponses.kt +++ /dev/null @@ -1,54 +0,0 @@ -package org.openapijsonschematools.client.paths.storeinventory.get; - -import org.openapijsonschematools.client.paths.storeinventory.get.responses.StoreinventoryGetCode200Response; -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; -import org.checkerframework.checker.nullness.qual.Nullable; - -import java.net.http.HttpResponse; -import java.util.Map; -import java.util.AbstractMap; - -public class StoreinventoryGetResponses { - public sealed interface EndpointResponse permits EndpointStoreinventoryGetCode200Response {} - - public record EndpointStoreinventoryGetCode200Response( - HttpResponse response, - StoreinventoryGetCode200Response.SealedResponseBody body, - SuccessInlineContentAndHeaderHeadersSchema.SuccessInlineContentAndHeaderHeadersSchemaMap headers - ) implements EndpointResponse, ApiResponse{ - } - - public sealed interface StatusCodeResponseDeserializer permits StatusStoreinventoryGetCode200ResponseDeserializer {} - - public static final class StatusStoreinventoryGetCode200ResponseDeserializer extends StoreinventoryGetCode200Response.StoreinventoryGetCode200Response1 implements StatusCodeResponseDeserializer { - } - - public static final class StoreinventoryGetResponses1 implements ResponsesDeserializer { - private final Map statusCodeToResponseDeserializer; - public StoreinventoryGetResponses1() { - this.statusCodeToResponseDeserializer = Map.ofEntries( - new AbstractMap.SimpleEntry<>("200", new StatusStoreinventoryGetCode200ResponseDeserializer()) - ); - } - - 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) { - throw new ApiException( - "Invalid response statusCode="+statusCode+" has no response defined in the openapi document", - response - ); - } - StatusStoreinventoryGetCode200ResponseDeserializer castDeserializer = (StatusStoreinventoryGetCode200ResponseDeserializer) statusCodeDeserializer; - var deserializedResponse = castDeserializer.deserialize(response, configuration); - return new EndpointStoreinventoryGetCode200Response(response, deserializedResponse.body(), deserializedResponse.headers()); - } - } -} diff --git a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/storeinventory/get/StoreinventoryGetSecurityInfo.kt b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/storeinventory/get/StoreinventoryGetSecurityInfo.kt deleted file mode 100644 index 5c661cfd67c..00000000000 --- a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/storeinventory/get/StoreinventoryGetSecurityInfo.kt +++ /dev/null @@ -1,24 +0,0 @@ -package org.openapijsonschematools.client.paths.storeinventory.get; - -import org.openapijsonschematools.client.paths.storeinventory.get.security.StoreinventoryGetSecurityRequirementObject0; -import org.openapijsonschematools.client.securityrequirementobjects.SecurityRequirementObject; -import org.openapijsonschematools.client.securityrequirementobjects.SecurityRequirementObjectProvider; - -public class StoreinventoryGetSecurityInfo { - public static class StoreinventoryGetSecurityInfo1 implements SecurityRequirementObjectProvider { - public final StoreinventoryGetSecurityRequirementObject0 security0; - - public StoreinventoryGetSecurityInfo1() { - security0 = new StoreinventoryGetSecurityRequirementObject0(); - } - - @Override - public SecurityRequirementObject getSecurityRequirementObject(SecurityIndex securityIndex) { - return security0; - } - } - - public enum SecurityIndex { - SECURITY_0 - } -} \ No newline at end of file diff --git a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/storeinventory/get/responses/StoreinventoryGetCode200Response.kt b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/storeinventory/get/responses/StoreinventoryGetCode200Response.kt deleted file mode 100644 index 16275bedfdf..00000000000 --- a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/storeinventory/get/responses/StoreinventoryGetCode200Response.kt +++ /dev/null @@ -1,7 +0,0 @@ -package org.openapijsonschematools.client.paths.storeinventory.get.responses; - -import org.openapijsonschematools.client.components.responses.SuccessInlineContentAndHeader; - -public class StoreinventoryGetCode200Response extends SuccessInlineContentAndHeader { - public static class StoreinventoryGetCode200Response1 extends SuccessInlineContentAndHeader1 {} -} diff --git a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/storeinventory/get/security/StoreinventoryGetSecurityRequirementObject0.kt b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/storeinventory/get/security/StoreinventoryGetSecurityRequirementObject0.kt deleted file mode 100644 index 12e9ef453a2..00000000000 --- a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/storeinventory/get/security/StoreinventoryGetSecurityRequirementObject0.kt +++ /dev/null @@ -1,24 +0,0 @@ -package org.openapijsonschematools.client.paths.storeinventory.get.security; - -import org.checkerframework.checker.nullness.qual.Nullable; -import org.openapijsonschematools.client.securityrequirementobjects.SecurityRequirementObject; -import org.openapijsonschematools.client.securityschemes.SecurityScheme; -import org.openapijsonschematools.client.components.securityschemes.ApiKey; - -import java.util.List; -import java.util.Map; -import java.util.AbstractMap; - -public class StoreinventoryGetSecurityRequirementObject0 extends SecurityRequirementObject { - - public StoreinventoryGetSecurityRequirementObject0() { - super( - Map.ofEntries( - new AbstractMap.SimpleEntry, List>( - ApiKey.class, - List.of() - ) - ) - ); - } -} diff --git a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/storeorder/StoreorderPost.kt b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/storeorder/StoreorderPost.kt deleted file mode 100644 index 7a9de50a73b..00000000000 --- a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/storeorder/StoreorderPost.kt +++ /dev/null @@ -1,183 +0,0 @@ -package org.openapijsonschematools.client.paths.storeorder; - -import org.checkerframework.checker.nullness.qual.Nullable; -import org.openapijsonschematools.client.RootServerInfo; -import org.openapijsonschematools.client.paths.storeorder.post.StoreorderPostRequestBody; -import org.openapijsonschematools.client.paths.storeorder.post.StoreorderPostResponses; -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.requestbody.SerializedRequestBody; -import org.openapijsonschematools.client.paths.Storeorder; - -import java.io.IOException; -import java.util.ArrayList; -import java.net.http.HttpClient; -import java.net.http.HttpRequest; -import java.time.Duration; -import java.util.List; -import java.util.Map; - -public class StoreorderPost { - private static class PostProvider { - private static final String method = "post"; - - public static StoreorderPostResponses.EndpointResponse post( - PostRequest request, - ApiConfiguration apiConfiguration, - SchemaConfiguration schemaConfiguration, - HttpClient client - ) throws IOException, InterruptedException, ValidationException, NotImplementedException, ApiException { - Map> headers = apiConfiguration.getDefaultHeaders(); - - SerializedRequestBody serializedRequestBody = new StoreorderPostRequestBody.StoreorderPostRequestBody1().serialize( - request.requestBody - ); - var contentTypeHeaderValues = headers.getOrDefault("Content-Type", new ArrayList<>()); - contentTypeHeaderValues.add(serializedRequestBody.contentType); - HttpRequest.BodyPublisher bodyPublisher = serializedRequestBody.bodyPublisher; - // TODO set this to a map if there is a query security scheme - @Nullable Map queryMap = null; - String host = apiConfiguration.getServer(request.serverIndex).url(); - - String url = host + Storeorder.path; - var httpRequest = RestClient.getRequest( - url, - method, - bodyPublisher, - headers, - request.timeout - ); - var response = RestClient.getResponse(httpRequest, client); - var responsesDeserializer = new StoreorderPostResponses.StoreorderPostResponses1(); - return responsesDeserializer.deserialize(response, schemaConfiguration); - } - } - - public interface PostOperation { - ApiConfiguration getApiConfiguration(); - SchemaConfiguration getSchemaConfiguration(); - HttpClient getClient(); - default StoreorderPostResponses.EndpointResponse post(PostRequest request) throws IOException, InterruptedException, ValidationException, NotImplementedException, ApiException { - return PostProvider.post(request, getApiConfiguration(), getSchemaConfiguration(), getClient()); - } - } - - public interface PlaceOrderOperation { - ApiConfiguration getApiConfiguration(); - SchemaConfiguration getSchemaConfiguration(); - HttpClient getClient(); - default StoreorderPostResponses.EndpointResponse placeOrder(PostRequest request) throws IOException, InterruptedException, ValidationException, NotImplementedException, ApiException { - return PostProvider.post(request, getApiConfiguration(), getSchemaConfiguration(), getClient()); - } - } - - public static class Post extends ApiClient implements PostOperation { - public Post(ApiConfiguration apiConfiguration, SchemaConfiguration schemaConfiguration) { - super(apiConfiguration, schemaConfiguration); - } - } - - public static class PostRequest { - public StoreorderPostRequestBody.SealedRequestBody requestBody; - public RootServerInfo.@Nullable ServerIndex serverIndex; - public @Nullable Duration timeout; - - public PostRequest( - StoreorderPostRequestBody.SealedRequestBody requestBody, - RootServerInfo.@Nullable ServerIndex serverIndex, - @Nullable Duration timeout - ) { - this.requestBody = requestBody; - this.serverIndex = serverIndex; - this.timeout = timeout; - } - } - - public static class PostNullableRequest { - public StoreorderPostRequestBody.@Nullable SealedRequestBody requestBody; - public RootServerInfo.@Nullable ServerIndex serverIndex; - public @Nullable Duration timeout; - } - - public interface SetterForServerIndex { - PostNullableRequest getInstance(); - T getBuilderAfterServerIndex(PostNullableRequest instance); - default T serverIndex(RootServerInfo.ServerIndex serverIndex) { - var instance = getInstance(); - instance.serverIndex = serverIndex; - return getBuilderAfterServerIndex(instance); - } - } - - public interface SetterForTimeout { - PostNullableRequest getInstance(); - T getBuilderAfterTimeout(PostNullableRequest instance); - default T timeout(Duration timeout) { - var instance = getInstance(); - instance.timeout = timeout; - return getBuilderAfterTimeout(instance); - } - } - - public interface SetterForRequestBody { - PostNullableRequest getInstance(); - T getBuilderAfterRequestBody(PostNullableRequest instance); - default T requestBody(StoreorderPostRequestBody.SealedRequestBody requestBody) { - var instance = getInstance(); - instance.requestBody = requestBody; - return getBuilderAfterRequestBody(instance); - } - } - - public static class Post0RequestBuilder implements SetterForServerIndex, SetterForTimeout { - private final PostNullableRequest instance; - - public Post0RequestBuilder(PostNullableRequest instance) { - this.instance = instance; - } - - public PostRequest build() { - var requestBody = instance.requestBody; - if (requestBody == null) { - throw new RuntimeException("invalid null value for required parameter"); - } - return new PostRequest( - requestBody, - instance.serverIndex, - instance.timeout - ); - } - - public PostNullableRequest getInstance() { - return instance; - } - - public Post0RequestBuilder getBuilderAfterServerIndex(PostNullableRequest instance) { - return this; - } - - public Post0RequestBuilder getBuilderAfterTimeout(PostNullableRequest instance) { - return this; - } - } - public static class PostRequestBuilder implements SetterForRequestBody { - private final PostNullableRequest instance; - - public PostRequestBuilder() { - this.instance = new PostNullableRequest(); - } - - public PostNullableRequest getInstance() { - return instance; - } - - public Post0RequestBuilder getBuilderAfterRequestBody(PostNullableRequest instance) { - return new Post0RequestBuilder(instance); - } - } -} diff --git a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/storeorder/post/StoreorderPostRequestBody.kt b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/storeorder/post/StoreorderPostRequestBody.kt deleted file mode 100644 index a3d93353f38..00000000000 --- a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/storeorder/post/StoreorderPostRequestBody.kt +++ /dev/null @@ -1,49 +0,0 @@ -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; -import org.openapijsonschematools.client.mediatype.MediaType; -import org.openapijsonschematools.client.paths.storeorder.post.requestbody.content.applicationjson.ApplicationjsonSchema; - -import java.util.AbstractMap; -import java.util.Map; - -public class StoreorderPostRequestBody { - public sealed interface SealedMediaType permits ApplicationjsonMediaType {} - - public record ApplicationjsonMediaType(ApplicationjsonSchema.ApplicationjsonSchema1 schema) implements SealedMediaType, MediaType { - public ApplicationjsonMediaType() { - this(ApplicationjsonSchema.ApplicationjsonSchema1.getInstance()); - } - @Override - public Nothing? encoding() { - return null; - } - } - - public static class StoreorderPostRequestBody1 extends RequestBodySerializer { - public StoreorderPostRequestBody1() { - super( - Map.ofEntries( - new AbstractMap.SimpleEntry<>("application/json", new ApplicationjsonMediaType()) - ), - true - ); - } - - public SerializedRequestBody serialize(SealedRequestBody requestBody) throws NotImplementedException { - ApplicationjsonRequestBody requestBody0 = (ApplicationjsonRequestBody) requestBody; - return serialize(requestBody0.contentType(), requestBody0.body().getData()); - } - } - - public sealed interface SealedRequestBody permits ApplicationjsonRequestBody {} - public record ApplicationjsonRequestBody(ApplicationjsonSchema.Order1Boxed body) implements SealedRequestBody, GenericRequestBody { - @Override - public String contentType() { - return "application/json"; - } - } -} diff --git a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/storeorder/post/StoreorderPostResponses.kt b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/storeorder/post/StoreorderPostResponses.kt deleted file mode 100644 index da6cecf09e8..00000000000 --- a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/storeorder/post/StoreorderPostResponses.kt +++ /dev/null @@ -1,66 +0,0 @@ -package org.openapijsonschematools.client.paths.storeorder.post; - -import org.openapijsonschematools.client.paths.storeorder.post.responses.StoreorderPostCode200Response; -import org.openapijsonschematools.client.paths.storeorder.post.responses.StoreorderPostCode400Response; -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; -import org.checkerframework.checker.nullness.qual.Nullable; - -import java.net.http.HttpResponse; -import java.util.Map; -import java.util.AbstractMap; - -public class StoreorderPostResponses { - public sealed interface EndpointResponse permits EndpointStoreorderPostCode200Response {} - - public record EndpointStoreorderPostCode200Response( - HttpResponse response, - StoreorderPostCode200Response.SealedResponseBody body, - Nothing? headers - ) implements EndpointResponse, ApiResponse{ - } - - public sealed interface StatusCodeResponseDeserializer permits StatusStoreorderPostCode200ResponseDeserializer, StatusStoreorderPostCode400ResponseDeserializer {} - - public static final class StatusStoreorderPostCode200ResponseDeserializer extends StoreorderPostCode200Response.StoreorderPostCode200Response1 implements StatusCodeResponseDeserializer { - } - public static final class StatusStoreorderPostCode400ResponseDeserializer extends StoreorderPostCode400Response.StoreorderPostCode400Response1 implements StatusCodeResponseDeserializer { - } - - public static final class StoreorderPostResponses1 implements ResponsesDeserializer { - private final Map statusCodeToResponseDeserializer; - public StoreorderPostResponses1() { - this.statusCodeToResponseDeserializer = Map.ofEntries( - new AbstractMap.SimpleEntry<>("200", new StatusStoreorderPostCode200ResponseDeserializer()), - new AbstractMap.SimpleEntry<>("400", new StatusStoreorderPostCode400ResponseDeserializer()) - ); - } - - 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) { - throw new ApiException( - "Invalid response statusCode="+statusCode+" has no response defined in the openapi document", - response - ); - } - if (statusCodeDeserializer instanceof StatusStoreorderPostCode200ResponseDeserializer castDeserializer) { - var deserializedResponse = castDeserializer.deserialize(response, configuration); - return new EndpointStoreorderPostCode200Response(response, deserializedResponse.body(), deserializedResponse.headers()); - } else { - StatusStoreorderPostCode400ResponseDeserializer castDeserializer = (StatusStoreorderPostCode400ResponseDeserializer) statusCodeDeserializer; - var deserializedResponse = castDeserializer.deserialize(response, configuration); - throw new StoreorderPostCode400Response.ResponseApiException( - "Received error statusCode response from server", - response, - deserializedResponse - ); - } - } - } -} diff --git a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/storeorder/post/requestbody/content/applicationjson/ApplicationjsonSchema.kt b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/storeorder/post/requestbody/content/applicationjson/ApplicationjsonSchema.kt deleted file mode 100644 index acc568b81b4..00000000000 --- a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/storeorder/post/requestbody/content/applicationjson/ApplicationjsonSchema.kt +++ /dev/null @@ -1,19 +0,0 @@ -package org.openapijsonschematools.client.paths.storeorder.post.requestbody.content.applicationjson; - -import org.checkerframework.checker.nullness.qual.Nullable; -import org.openapijsonschematools.client.components.schemas.Order; - -public class ApplicationjsonSchema extends Order { - // $refed class - - - public static class ApplicationjsonSchema1 extends Order1 { - private static @Nullable ApplicationjsonSchema1 instance = null; - public static ApplicationjsonSchema1 getInstance() { - if (instance == null) { - instance = new ApplicationjsonSchema1(); - } - return instance; - } - } -} diff --git a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/storeorder/post/responses/StoreorderPostCode200Response.kt b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/storeorder/post/responses/StoreorderPostCode200Response.kt deleted file mode 100644 index 7fd2a8dac2e..00000000000 --- a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/storeorder/post/responses/StoreorderPostCode200Response.kt +++ /dev/null @@ -1,81 +0,0 @@ -package org.openapijsonschematools.client.paths.storeorder.post.responses; - -import org.openapijsonschematools.client.configurations.SchemaConfiguration; -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; - -import java.util.AbstractMap; -import java.util.Map; -import java.net.http.HttpResponse; -import java.net.http.HttpHeaders; - -public class StoreorderPostCode200Response { - public sealed interface SealedMediaType permits ApplicationxmlMediaType, ApplicationjsonMediaType {} - - public record ApplicationxmlMediaType(ApplicationxmlSchema.ApplicationxmlSchema1 schema) implements SealedMediaType, MediaType { - public ApplicationxmlMediaType() { - this(ApplicationxmlSchema.ApplicationxmlSchema1.getInstance()); - } - @Override - public Nothing? encoding() { - return null; - } - } - - public record ApplicationjsonMediaType(ApplicationjsonSchema.ApplicationjsonSchema1 schema) implements SealedMediaType, MediaType { - public ApplicationjsonMediaType() { - this(ApplicationjsonSchema.ApplicationjsonSchema1.getInstance()); - } - @Override - public Nothing? encoding() { - return null; - } - } - public sealed interface SealedResponseBody permits ApplicationxmlResponseBody, ApplicationjsonResponseBody {} - public record ApplicationxmlResponseBody(ApplicationxmlSchema.Order1Boxed body) implements SealedResponseBody { } - public record ApplicationjsonResponseBody(ApplicationjsonSchema.Order1Boxed body) implements SealedResponseBody { } - - public static class StoreorderPostCode200Response1 extends ResponseDeserializer { - public StoreorderPostCode200Response1() { - super( - Map.ofEntries( - new AbstractMap.SimpleEntry<>("application/xml", new ApplicationxmlMediaType()), - new AbstractMap.SimpleEntry<>("application/json", new ApplicationjsonMediaType()) - ) - ); - } - - @Override - 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 { - ApplicationjsonMediaType thisMediaType = (ApplicationjsonMediaType) mediaType; - var deserializedBody = deserializeBody(contentType, body, thisMediaType.schema(), configuration); - return new ApplicationjsonResponseBody(deserializedBody); - } - } - - @Override - protected Nothing? getHeaders(HttpHeaders headers, SchemaConfiguration configuration) { - return null; - } - } - - @SuppressWarnings("serial") - public static class ResponseApiException extends ApiException { - public DeserializedHttpResponse deserializedResponse; - - public ResponseApiException(String s, HttpResponse response, DeserializedHttpResponse deserializedResponse) { - super(s, response); - this.deserializedResponse = deserializedResponse; - } - } -} diff --git a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/storeorder/post/responses/StoreorderPostCode400Response.kt b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/storeorder/post/responses/StoreorderPostCode400Response.kt deleted file mode 100644 index 38442a7d50e..00000000000 --- a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/storeorder/post/responses/StoreorderPostCode400Response.kt +++ /dev/null @@ -1,45 +0,0 @@ -package org.openapijsonschematools.client.paths.storeorder.post.responses; - -import org.openapijsonschematools.client.configurations.SchemaConfiguration; -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; -import java.net.http.HttpResponse; -import java.net.http.HttpHeaders; - -public class StoreorderPostCode400Response { - - public static class StoreorderPostCode400Response1 extends ResponseDeserializer { - public StoreorderPostCode400Response1() { - super( - MapUtils.makeMap( - ) - ); - } - - @Override - protected Nothing? getBody(String contentType, Nothing? mediaType, byte[] body, SchemaConfiguration configuration) { - return null; - } - - @Override - protected Nothing? getHeaders(HttpHeaders headers, SchemaConfiguration configuration) { - return null; - } - } - - @SuppressWarnings("serial") - public static class ResponseApiException extends ApiException { - public DeserializedHttpResponse deserializedResponse; - - public ResponseApiException(String s, HttpResponse response, DeserializedHttpResponse deserializedResponse) { - super(s, response); - this.deserializedResponse = deserializedResponse; - } - } -} diff --git a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/storeorder/post/responses/code200response/content/applicationjson/ApplicationjsonSchema.kt b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/storeorder/post/responses/code200response/content/applicationjson/ApplicationjsonSchema.kt deleted file mode 100644 index c7b1d3035af..00000000000 --- a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/storeorder/post/responses/code200response/content/applicationjson/ApplicationjsonSchema.kt +++ /dev/null @@ -1,19 +0,0 @@ -package org.openapijsonschematools.client.paths.storeorder.post.responses.code200response.content.applicationjson; - -import org.checkerframework.checker.nullness.qual.Nullable; -import org.openapijsonschematools.client.components.schemas.Order; - -public class ApplicationjsonSchema extends Order { - // $refed class - - - public static class ApplicationjsonSchema1 extends Order1 { - private static @Nullable ApplicationjsonSchema1 instance = null; - public static ApplicationjsonSchema1 getInstance() { - if (instance == null) { - instance = new ApplicationjsonSchema1(); - } - return instance; - } - } -} diff --git a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/storeorder/post/responses/code200response/content/applicationxml/ApplicationxmlSchema.kt b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/storeorder/post/responses/code200response/content/applicationxml/ApplicationxmlSchema.kt deleted file mode 100644 index d0a1692555b..00000000000 --- a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/storeorder/post/responses/code200response/content/applicationxml/ApplicationxmlSchema.kt +++ /dev/null @@ -1,19 +0,0 @@ -package org.openapijsonschematools.client.paths.storeorder.post.responses.code200response.content.applicationxml; - -import org.checkerframework.checker.nullness.qual.Nullable; -import org.openapijsonschematools.client.components.schemas.Order; - -public class ApplicationxmlSchema extends Order { - // $refed class - - - public static class ApplicationxmlSchema1 extends Order1 { - private static @Nullable ApplicationxmlSchema1 instance = null; - public static ApplicationxmlSchema1 getInstance() { - if (instance == null) { - instance = new ApplicationxmlSchema1(); - } - return instance; - } - } -} diff --git a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/storeorderorderid/StoreorderorderidDelete.kt b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/storeorderorderid/StoreorderorderidDelete.kt deleted file mode 100644 index a75520d87a8..00000000000 --- a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/storeorderorderid/StoreorderorderidDelete.kt +++ /dev/null @@ -1,178 +0,0 @@ -package org.openapijsonschematools.client.paths.storeorderorderid; - -import org.checkerframework.checker.nullness.qual.Nullable; -import org.openapijsonschematools.client.RootServerInfo; -import org.openapijsonschematools.client.paths.storeorderorderid.delete.StoreorderorderidDeletePathParameters; -import org.openapijsonschematools.client.paths.storeorderorderid.delete.Parameters; -import org.openapijsonschematools.client.paths.storeorderorderid.delete.StoreorderorderidDeleteResponses; -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.paths.Storeorderorderid; - -import java.io.IOException; -import java.net.http.HttpClient; -import java.net.http.HttpRequest; -import java.time.Duration; -import java.util.List; -import java.util.Map; - -public class StoreorderorderidDelete { - private static class DeleteProvider { - private static final String method = "delete"; - - public static Nothing? delete( - DeleteRequest request, - ApiConfiguration apiConfiguration, - SchemaConfiguration schemaConfiguration, - HttpClient client - ) throws IOException, InterruptedException, ValidationException, NotImplementedException, ApiException { - Map> headers = apiConfiguration.getDefaultHeaders(); - HttpRequest.BodyPublisher bodyPublisher = HttpRequest.BodyPublishers.noBody(); - - var pathSerializer = new Parameters.PathParametersSerializer(); - String updatedPath = pathSerializer.serialize(request.pathParameters, Storeorderorderid.path); - // TODO set this to a map if there is a query security scheme - @Nullable Map queryMap = null; - String host = apiConfiguration.getServer(request.serverIndex).url(); - - String url = host + updatedPath; - var httpRequest = RestClient.getRequest( - url, - method, - bodyPublisher, - headers, - request.timeout - ); - var response = RestClient.getResponse(httpRequest, client); - return (Nothing?) null; - } - } - - public interface DeleteOperation { - ApiConfiguration getApiConfiguration(); - SchemaConfiguration getSchemaConfiguration(); - HttpClient getClient(); - default Nothing? delete(DeleteRequest request) throws IOException, InterruptedException, ValidationException, NotImplementedException, ApiException { - return DeleteProvider.delete(request, getApiConfiguration(), getSchemaConfiguration(), getClient()); - } - } - - public interface DeleteOrderOperation { - ApiConfiguration getApiConfiguration(); - SchemaConfiguration getSchemaConfiguration(); - HttpClient getClient(); - default Nothing? deleteOrder(DeleteRequest request) throws IOException, InterruptedException, ValidationException, NotImplementedException, ApiException { - return DeleteProvider.delete(request, getApiConfiguration(), getSchemaConfiguration(), getClient()); - } - } - - public static class Delete extends ApiClient implements DeleteOperation { - public Delete(ApiConfiguration apiConfiguration, SchemaConfiguration schemaConfiguration) { - super(apiConfiguration, schemaConfiguration); - } - } - - public static class DeleteRequest { - public StoreorderorderidDeletePathParameters.PathParametersMap pathParameters; - public RootServerInfo.@Nullable ServerIndex serverIndex; - public @Nullable Duration timeout; - - public DeleteRequest( - StoreorderorderidDeletePathParameters.PathParametersMap pathParameters, - RootServerInfo.@Nullable ServerIndex serverIndex, - @Nullable Duration timeout - ) { - this.pathParameters = pathParameters; - this.serverIndex = serverIndex; - this.timeout = timeout; - } - } - - public static class DeleteNullableRequest { - public StoreorderorderidDeletePathParameters.@Nullable PathParametersMap pathParameters; - public RootServerInfo.@Nullable ServerIndex serverIndex; - public @Nullable Duration timeout; - } - - public interface SetterForServerIndex { - DeleteNullableRequest getInstance(); - T getBuilderAfterServerIndex(DeleteNullableRequest instance); - default T serverIndex(RootServerInfo.ServerIndex serverIndex) { - var instance = getInstance(); - instance.serverIndex = serverIndex; - return getBuilderAfterServerIndex(instance); - } - } - - public interface SetterForTimeout { - DeleteNullableRequest getInstance(); - T getBuilderAfterTimeout(DeleteNullableRequest instance); - default T timeout(Duration timeout) { - var instance = getInstance(); - instance.timeout = timeout; - return getBuilderAfterTimeout(instance); - } - } - - public interface SetterForPathParameters { - DeleteNullableRequest getInstance(); - T getBuilderAfterPathParameters(DeleteNullableRequest instance); - default T pathParameters(StoreorderorderidDeletePathParameters.PathParametersMap pathParameters) { - var instance = getInstance(); - instance.pathParameters = pathParameters; - return getBuilderAfterPathParameters(instance); - } - } - - public static class Delete0RequestBuilder implements SetterForServerIndex, SetterForTimeout { - private final DeleteNullableRequest instance; - - public Delete0RequestBuilder(DeleteNullableRequest instance) { - this.instance = instance; - } - - public DeleteRequest build() { - var pathParameters = instance.pathParameters; - if (pathParameters == null) { - throw new RuntimeException("invalid null value for required parameter"); - } - return new DeleteRequest( - pathParameters, - instance.serverIndex, - instance.timeout - ); - } - - public DeleteNullableRequest getInstance() { - return instance; - } - - public Delete0RequestBuilder getBuilderAfterServerIndex(DeleteNullableRequest instance) { - return this; - } - - public Delete0RequestBuilder getBuilderAfterTimeout(DeleteNullableRequest instance) { - return this; - } - } - public static class DeleteRequestBuilder implements SetterForPathParameters { - private final DeleteNullableRequest instance; - - public DeleteRequestBuilder() { - this.instance = new DeleteNullableRequest(); - } - - public DeleteNullableRequest getInstance() { - return instance; - } - - public Delete0RequestBuilder getBuilderAfterPathParameters(DeleteNullableRequest instance) { - return new Delete0RequestBuilder(instance); - } - } -} diff --git a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/storeorderorderid/StoreorderorderidGet.kt b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/storeorderorderid/StoreorderorderidGet.kt deleted file mode 100644 index e7b57253441..00000000000 --- a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/storeorderorderid/StoreorderorderidGet.kt +++ /dev/null @@ -1,179 +0,0 @@ -package org.openapijsonschematools.client.paths.storeorderorderid; - -import org.checkerframework.checker.nullness.qual.Nullable; -import org.openapijsonschematools.client.RootServerInfo; -import org.openapijsonschematools.client.paths.storeorderorderid.get.StoreorderorderidGetPathParameters; -import org.openapijsonschematools.client.paths.storeorderorderid.get.Parameters; -import org.openapijsonschematools.client.paths.storeorderorderid.get.StoreorderorderidGetResponses; -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.paths.Storeorderorderid; - -import java.io.IOException; -import java.net.http.HttpClient; -import java.net.http.HttpRequest; -import java.time.Duration; -import java.util.List; -import java.util.Map; - -public class StoreorderorderidGet { - private static class GetProvider { - private static final String method = "get"; - - public static StoreorderorderidGetResponses.EndpointResponse get( - GetRequest request, - ApiConfiguration apiConfiguration, - SchemaConfiguration schemaConfiguration, - HttpClient client - ) throws IOException, InterruptedException, ValidationException, NotImplementedException, ApiException { - Map> headers = apiConfiguration.getDefaultHeaders(); - HttpRequest.BodyPublisher bodyPublisher = HttpRequest.BodyPublishers.noBody(); - - var pathSerializer = new Parameters.PathParametersSerializer(); - String updatedPath = pathSerializer.serialize(request.pathParameters, Storeorderorderid.path); - // TODO set this to a map if there is a query security scheme - @Nullable Map queryMap = null; - String host = apiConfiguration.getServer(request.serverIndex).url(); - - String url = host + updatedPath; - var httpRequest = RestClient.getRequest( - url, - method, - bodyPublisher, - headers, - request.timeout - ); - var response = RestClient.getResponse(httpRequest, client); - var responsesDeserializer = new StoreorderorderidGetResponses.StoreorderorderidGetResponses1(); - return responsesDeserializer.deserialize(response, schemaConfiguration); - } - } - - public interface GetOperation { - ApiConfiguration getApiConfiguration(); - SchemaConfiguration getSchemaConfiguration(); - HttpClient getClient(); - default StoreorderorderidGetResponses.EndpointResponse get(GetRequest request) throws IOException, InterruptedException, ValidationException, NotImplementedException, ApiException { - return GetProvider.get(request, getApiConfiguration(), getSchemaConfiguration(), getClient()); - } - } - - public interface GetOrderByIdOperation { - ApiConfiguration getApiConfiguration(); - SchemaConfiguration getSchemaConfiguration(); - HttpClient getClient(); - default StoreorderorderidGetResponses.EndpointResponse getOrderById(GetRequest request) throws IOException, InterruptedException, ValidationException, NotImplementedException, ApiException { - return GetProvider.get(request, getApiConfiguration(), getSchemaConfiguration(), getClient()); - } - } - - public static class Get extends ApiClient implements GetOperation { - public Get(ApiConfiguration apiConfiguration, SchemaConfiguration schemaConfiguration) { - super(apiConfiguration, schemaConfiguration); - } - } - - public static class GetRequest { - public StoreorderorderidGetPathParameters.PathParametersMap pathParameters; - public RootServerInfo.@Nullable ServerIndex serverIndex; - public @Nullable Duration timeout; - - public GetRequest( - StoreorderorderidGetPathParameters.PathParametersMap pathParameters, - RootServerInfo.@Nullable ServerIndex serverIndex, - @Nullable Duration timeout - ) { - this.pathParameters = pathParameters; - this.serverIndex = serverIndex; - this.timeout = timeout; - } - } - - public static class GetNullableRequest { - public StoreorderorderidGetPathParameters.@Nullable PathParametersMap pathParameters; - public RootServerInfo.@Nullable ServerIndex serverIndex; - public @Nullable Duration timeout; - } - - public interface SetterForServerIndex { - GetNullableRequest getInstance(); - T getBuilderAfterServerIndex(GetNullableRequest instance); - default T serverIndex(RootServerInfo.ServerIndex serverIndex) { - var instance = getInstance(); - instance.serverIndex = serverIndex; - return getBuilderAfterServerIndex(instance); - } - } - - public interface SetterForTimeout { - GetNullableRequest getInstance(); - T getBuilderAfterTimeout(GetNullableRequest instance); - default T timeout(Duration timeout) { - var instance = getInstance(); - instance.timeout = timeout; - return getBuilderAfterTimeout(instance); - } - } - - public interface SetterForPathParameters { - GetNullableRequest getInstance(); - T getBuilderAfterPathParameters(GetNullableRequest instance); - default T pathParameters(StoreorderorderidGetPathParameters.PathParametersMap pathParameters) { - var instance = getInstance(); - instance.pathParameters = pathParameters; - return getBuilderAfterPathParameters(instance); - } - } - - public static class Get0RequestBuilder implements SetterForServerIndex, SetterForTimeout { - private final GetNullableRequest instance; - - public Get0RequestBuilder(GetNullableRequest instance) { - this.instance = instance; - } - - public GetRequest build() { - var pathParameters = instance.pathParameters; - if (pathParameters == null) { - throw new RuntimeException("invalid null value for required parameter"); - } - return new GetRequest( - pathParameters, - instance.serverIndex, - instance.timeout - ); - } - - public GetNullableRequest getInstance() { - return instance; - } - - public Get0RequestBuilder getBuilderAfterServerIndex(GetNullableRequest instance) { - return this; - } - - public Get0RequestBuilder getBuilderAfterTimeout(GetNullableRequest instance) { - return this; - } - } - public static class GetRequestBuilder implements SetterForPathParameters { - private final GetNullableRequest instance; - - public GetRequestBuilder() { - this.instance = new GetNullableRequest(); - } - - public GetNullableRequest getInstance() { - return instance; - } - - public Get0RequestBuilder getBuilderAfterPathParameters(GetNullableRequest instance) { - return new Get0RequestBuilder(instance); - } - } -} diff --git a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/storeorderorderid/delete/Parameters.kt b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/storeorderorderid/delete/Parameters.kt deleted file mode 100644 index be0db492e8e..00000000000 --- a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/storeorderorderid/delete/Parameters.kt +++ /dev/null @@ -1,20 +0,0 @@ -package org.openapijsonschematools.client.paths.storeorderorderid.delete; - -import org.openapijsonschematools.client.paths.storeorderorderid.delete.parameters.Parameter0; -import org.openapijsonschematools.client.parameter.PathSerializer; - -import java.util.Map; -import java.util.AbstractMap; - -public class Parameters { - - public static class PathParametersSerializer extends PathSerializer { - public PathParametersSerializer() { - super( - Map.ofEntries( - new AbstractMap.SimpleEntry<>("order_id", new Parameter0.Parameter01()) - ) - ); - } - } -} diff --git a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/storeorderorderid/delete/StoreorderorderidDeletePathParameters.kt b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/storeorderorderid/delete/StoreorderorderidDeletePathParameters.kt deleted file mode 100644 index 44b4f774faa..00000000000 --- a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/storeorderorderid/delete/StoreorderorderidDeletePathParameters.kt +++ /dev/null @@ -1,205 +0,0 @@ -package org.openapijsonschematools.client.paths.storeorderorderid.delete; -import java.util.ArrayList; -import java.util.HashSet; -import java.util.LinkedHashMap; -import java.util.LinkedHashSet; -import java.util.List; -import java.util.Map; -import java.util.Objects; -import java.util.Set; -import org.checkerframework.checker.nullness.qual.Nullable; -import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags; -import org.openapijsonschematools.client.configurations.SchemaConfiguration; -import org.openapijsonschematools.client.exceptions.UnsetPropertyException; -import org.openapijsonschematools.client.exceptions.ValidationException; -import org.openapijsonschematools.client.paths.storeorderorderid.delete.parameters.parameter0.Schema0; -import org.openapijsonschematools.client.schemas.AnyTypeJsonSchema; -import org.openapijsonschematools.client.schemas.GenericBuilder; -import org.openapijsonschematools.client.schemas.NotAnyTypeJsonSchema; -import org.openapijsonschematools.client.schemas.validation.FrozenMap; -import org.openapijsonschematools.client.schemas.validation.JsonSchema; -import org.openapijsonschematools.client.schemas.validation.JsonSchemaInfo; -import org.openapijsonschematools.client.schemas.validation.MapSchemaValidator; -import org.openapijsonschematools.client.schemas.validation.MapUtils; -import org.openapijsonschematools.client.schemas.validation.PathToSchemasMap; -import org.openapijsonschematools.client.schemas.validation.PropertyEntry; -import org.openapijsonschematools.client.schemas.validation.ValidationMetadata; - -public class StoreorderorderidDeletePathParameters { - // nest classes so all schemas and input/output classes can be public - - - public static class AdditionalProperties extends NotAnyTypeJsonSchema.NotAnyTypeJsonSchema1 { - // NotAnyTypeSchema - private static @Nullable AdditionalProperties instance = null; - public static AdditionalProperties getInstance() { - if (instance == null) { - instance = new AdditionalProperties(); - } - return instance; - } - } - - - public static class PathParametersMap extends FrozenMap { - protected PathParametersMap(FrozenMap m) { - super(m); - } - public static final Set requiredKeys = Set.of( - "order_id" - ); - public static final Set optionalKeys = Set.of(); - public static PathParametersMap of(Map arg, SchemaConfiguration configuration) throws ValidationException { - return StoreorderorderidDeletePathParameters1.getInstance().validate(arg, configuration); - } - - public String order_id() { - try { - return getOrThrow("version"); - } catch (UnsetPropertyException e) { - throw new RuntimeException(e); - } - } - } - - public interface SetterForOrderId { - Map getInstance(); - T getBuilderAfterOrderId(Map instance); - - default T order_id(String value) { - var instance = getInstance(); - instance.put("order_id", value); - return getBuilderAfterOrderId(instance); - } - } - - public static class PathParametersMap0Builder implements GenericBuilder> { - private final Map instance; - private static final Set knownKeys = Set.of( - "order_id" - ); - public Set getKnownKeys() { - return knownKeys; - } - public PathParametersMap0Builder(Map instance) { - this.instance = instance; - } - public Map build() { - return instance; - } - } - - public static class PathParametersMapBuilder implements SetterForOrderId { - private final Map instance; - public PathParametersMapBuilder() { - this.instance = new LinkedHashMap<>(); - } - public Map getInstance() { - return instance; - } - public PathParametersMap0Builder getBuilderAfterOrderId(Map instance) { - return new PathParametersMap0Builder(instance); - } - } - - - public sealed interface StoreorderorderidDeletePathParameters1Boxed permits StoreorderorderidDeletePathParameters1BoxedMap { - @Nullable Object getData(); - } - - public record StoreorderorderidDeletePathParameters1BoxedMap(PathParametersMap data) implements StoreorderorderidDeletePathParameters1Boxed { - @Override - public @Nullable Object getData() { - return data; - } - } - - - public static class StoreorderorderidDeletePathParameters1 extends JsonSchema implements MapSchemaValidator { - private static @Nullable StoreorderorderidDeletePathParameters1 instance = null; - - protected StoreorderorderidDeletePathParameters1() { - super(new JsonSchemaInfo() - .type(Set.of(Map.class)) - .properties(Map.ofEntries( - new PropertyEntry("order_id", Schema0.Schema01.class) - )) - .required(Set.of( - "order_id" - )) - .additionalProperties(AdditionalProperties.class) - ); - } - - public static StoreorderorderidDeletePathParameters1 getInstance() { - if (instance == null) { - instance = new StoreorderorderidDeletePathParameters1(); - } - return instance; - } - - 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 RuntimeException("Invalid non-string key value"); - } - String propertyName = (String) entryKey; - List propertyPathToItem = new ArrayList<>(pathToItem); - propertyPathToItem.add(propertyName); - Object value = entry.getValue(); - LinkedHashMap, Nothing?> schemas = pathToSchemas.get(propertyPathToItem); - if (schemas == null) { - throw new RuntimeException("Validation 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"); - } - properties.put(propertyName, (String) propertyInstance); - } - FrozenMap castProperties = new FrozenMap<>(properties); - return new PathParametersMap(castProperties); - } - - 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); - SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().build())); - ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, new PathToSchemasMap(), new LinkedHashSet<>()); - PathToSchemasMap pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet); - return getNewInstance(castArg, validationMetadata.pathToItem(), pathToSchemasMap); - } - - - @Override - public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws 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"); - } - @Override - public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { - if (arg instanceof Map) { - return getNewInstance((Map) arg, pathToItem, pathToSchemas); - } - throw new RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); - } - @Override - public StoreorderorderidDeletePathParameters1BoxedMap validateAndBox(Map arg, SchemaConfiguration configuration) throws ValidationException { - return new StoreorderorderidDeletePathParameters1BoxedMap(validate(arg, configuration)); - } - @Override - public StoreorderorderidDeletePathParameters1Boxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { - 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"); - } - } - -} diff --git a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/storeorderorderid/delete/StoreorderorderidDeleteResponses.kt b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/storeorderorderid/delete/StoreorderorderidDeleteResponses.kt deleted file mode 100644 index f3f6061c926..00000000000 --- a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/storeorderorderid/delete/StoreorderorderidDeleteResponses.kt +++ /dev/null @@ -1,61 +0,0 @@ -package org.openapijsonschematools.client.paths.storeorderorderid.delete; - -import org.openapijsonschematools.client.paths.storeorderorderid.delete.responses.StoreorderorderidDeleteCode400Response; -import org.openapijsonschematools.client.paths.storeorderorderid.delete.responses.StoreorderorderidDeleteCode404Response; -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; - -import java.net.http.HttpResponse; -import java.util.Map; -import java.util.AbstractMap; - -public class StoreorderorderidDeleteResponses { - - public sealed interface StatusCodeResponseDeserializer permits StatusStoreorderorderidDeleteCode400ResponseDeserializer, StatusStoreorderorderidDeleteCode404ResponseDeserializer {} - - public static final class StatusStoreorderorderidDeleteCode400ResponseDeserializer extends StoreorderorderidDeleteCode400Response.StoreorderorderidDeleteCode400Response1 implements StatusCodeResponseDeserializer { - } - public static final class StatusStoreorderorderidDeleteCode404ResponseDeserializer extends StoreorderorderidDeleteCode404Response.StoreorderorderidDeleteCode404Response1 implements StatusCodeResponseDeserializer { - } - - public static final class StoreorderorderidDeleteResponses1 implements ResponsesDeserializer { - private final Map statusCodeToResponseDeserializer; - public StoreorderorderidDeleteResponses1() { - this.statusCodeToResponseDeserializer = Map.ofEntries( - new AbstractMap.SimpleEntry<>("400", new StatusStoreorderorderidDeleteCode400ResponseDeserializer()), - new AbstractMap.SimpleEntry<>("404", new StatusStoreorderorderidDeleteCode404ResponseDeserializer()) - ); - } - - public Nothing? deserialize(HttpResponse response, SchemaConfiguration configuration) throws ValidationException, NotImplementedException, ApiException { - String statusCode = String.valueOf(response.statusCode()); - @Nullable StatusCodeResponseDeserializer statusCodeDeserializer = statusCodeToResponseDeserializer.get(statusCode); - if (statusCodeDeserializer == null) { - throw new ApiException( - "Invalid response statusCode="+statusCode+" has no response defined in the openapi document", - response - ); - } - if (statusCodeDeserializer instanceof StatusStoreorderorderidDeleteCode400ResponseDeserializer castDeserializer) { - var deserializedResponse = castDeserializer.deserialize(response, configuration); - throw new StoreorderorderidDeleteCode400Response.ResponseApiException( - "Received error statusCode response from server", - response, - deserializedResponse - ); - } else { - StatusStoreorderorderidDeleteCode404ResponseDeserializer castDeserializer = (StatusStoreorderorderidDeleteCode404ResponseDeserializer) statusCodeDeserializer; - var deserializedResponse = castDeserializer.deserialize(response, configuration); - throw new StoreorderorderidDeleteCode404Response.ResponseApiException( - "Received error statusCode response from server", - response, - deserializedResponse - ); - } - } - } -} diff --git a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/storeorderorderid/delete/parameters/Parameter0.kt b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/storeorderorderid/delete/parameters/Parameter0.kt deleted file mode 100644 index 3f27fb09e43..00000000000 --- a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/storeorderorderid/delete/parameters/Parameter0.kt +++ /dev/null @@ -1,23 +0,0 @@ -package org.openapijsonschematools.client.paths.storeorderorderid.delete.parameters; - -import org.openapijsonschematools.client.parameter.ParameterStyle; -import org.openapijsonschematools.client.parameter.ParameterInType; -import org.openapijsonschematools.client.parameter.SchemaParameter; -import org.openapijsonschematools.client.paths.storeorderorderid.delete.parameters.parameter0.Schema0; - -public class Parameter0 { - - public static class Parameter01 extends SchemaParameter { - public Parameter01() { - super( - "order_id", - ParameterInType.PATH, - true, - ParameterStyle.SIMPLE, - false, - false, - Schema0.Schema01.getInstance() - ); - } - } -} diff --git a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/storeorderorderid/delete/parameters/parameter0/Schema0.kt b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/storeorderorderid/delete/parameters/parameter0/Schema0.kt deleted file mode 100644 index f1ef8de93ef..00000000000 --- a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/storeorderorderid/delete/parameters/parameter0/Schema0.kt +++ /dev/null @@ -1,19 +0,0 @@ -package org.openapijsonschematools.client.paths.storeorderorderid.delete.parameters.parameter0; -import org.checkerframework.checker.nullness.qual.Nullable; -import org.openapijsonschematools.client.schemas.StringJsonSchema; - -public class Schema0 extends StringJsonSchema { - // nest classes so all schemas and input/output classes can be public - - - public static class Schema01 extends StringJsonSchema.StringJsonSchema1 { - private static @Nullable Schema01 instance = null; - public static Schema01 getInstance() { - if (instance == null) { - instance = new Schema01(); - } - return instance; - } - } - -} diff --git a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/storeorderorderid/delete/responses/StoreorderorderidDeleteCode400Response.kt b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/storeorderorderid/delete/responses/StoreorderorderidDeleteCode400Response.kt deleted file mode 100644 index cd598b23d0e..00000000000 --- a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/storeorderorderid/delete/responses/StoreorderorderidDeleteCode400Response.kt +++ /dev/null @@ -1,45 +0,0 @@ -package org.openapijsonschematools.client.paths.storeorderorderid.delete.responses; - -import org.openapijsonschematools.client.configurations.SchemaConfiguration; -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; -import java.net.http.HttpResponse; -import java.net.http.HttpHeaders; - -public class StoreorderorderidDeleteCode400Response { - - public static class StoreorderorderidDeleteCode400Response1 extends ResponseDeserializer { - public StoreorderorderidDeleteCode400Response1() { - super( - MapUtils.makeMap( - ) - ); - } - - @Override - protected Nothing? getBody(String contentType, Nothing? mediaType, byte[] body, SchemaConfiguration configuration) { - return null; - } - - @Override - protected Nothing? getHeaders(HttpHeaders headers, SchemaConfiguration configuration) { - return null; - } - } - - @SuppressWarnings("serial") - public static class ResponseApiException extends ApiException { - public DeserializedHttpResponse deserializedResponse; - - public ResponseApiException(String s, HttpResponse response, DeserializedHttpResponse deserializedResponse) { - super(s, response); - this.deserializedResponse = deserializedResponse; - } - } -} diff --git a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/storeorderorderid/delete/responses/StoreorderorderidDeleteCode404Response.kt b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/storeorderorderid/delete/responses/StoreorderorderidDeleteCode404Response.kt deleted file mode 100644 index 53fe42a5f0b..00000000000 --- a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/storeorderorderid/delete/responses/StoreorderorderidDeleteCode404Response.kt +++ /dev/null @@ -1,45 +0,0 @@ -package org.openapijsonschematools.client.paths.storeorderorderid.delete.responses; - -import org.openapijsonschematools.client.configurations.SchemaConfiguration; -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; -import java.net.http.HttpResponse; -import java.net.http.HttpHeaders; - -public class StoreorderorderidDeleteCode404Response { - - public static class StoreorderorderidDeleteCode404Response1 extends ResponseDeserializer { - public StoreorderorderidDeleteCode404Response1() { - super( - MapUtils.makeMap( - ) - ); - } - - @Override - protected Nothing? getBody(String contentType, Nothing? mediaType, byte[] body, SchemaConfiguration configuration) { - return null; - } - - @Override - protected Nothing? getHeaders(HttpHeaders headers, SchemaConfiguration configuration) { - return null; - } - } - - @SuppressWarnings("serial") - public static class ResponseApiException extends ApiException { - public DeserializedHttpResponse deserializedResponse; - - public ResponseApiException(String s, HttpResponse response, DeserializedHttpResponse deserializedResponse) { - super(s, response); - this.deserializedResponse = deserializedResponse; - } - } -} diff --git a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/storeorderorderid/get/Parameters.kt b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/storeorderorderid/get/Parameters.kt deleted file mode 100644 index 5e6d9bb0b5d..00000000000 --- a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/storeorderorderid/get/Parameters.kt +++ /dev/null @@ -1,20 +0,0 @@ -package org.openapijsonschematools.client.paths.storeorderorderid.get; - -import org.openapijsonschematools.client.paths.storeorderorderid.get.parameters.Parameter0; -import org.openapijsonschematools.client.parameter.PathSerializer; - -import java.util.Map; -import java.util.AbstractMap; - -public class Parameters { - - public static class PathParametersSerializer extends PathSerializer { - public PathParametersSerializer() { - super( - Map.ofEntries( - new AbstractMap.SimpleEntry<>("order_id", new Parameter0.Parameter01()) - ) - ); - } - } -} diff --git a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/storeorderorderid/get/StoreorderorderidGetPathParameters.kt b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/storeorderorderid/get/StoreorderorderidGetPathParameters.kt deleted file mode 100644 index 473df313a16..00000000000 --- a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/storeorderorderid/get/StoreorderorderidGetPathParameters.kt +++ /dev/null @@ -1,223 +0,0 @@ -package org.openapijsonschematools.client.paths.storeorderorderid.get; -import java.util.ArrayList; -import java.util.HashSet; -import java.util.LinkedHashMap; -import java.util.LinkedHashSet; -import java.util.List; -import java.util.Map; -import java.util.Objects; -import java.util.Set; -import org.checkerframework.checker.nullness.qual.Nullable; -import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags; -import org.openapijsonschematools.client.configurations.SchemaConfiguration; -import org.openapijsonschematools.client.exceptions.UnsetPropertyException; -import org.openapijsonschematools.client.exceptions.ValidationException; -import org.openapijsonschematools.client.paths.storeorderorderid.get.parameters.parameter0.Schema0; -import org.openapijsonschematools.client.schemas.AnyTypeJsonSchema; -import org.openapijsonschematools.client.schemas.GenericBuilder; -import org.openapijsonschematools.client.schemas.NotAnyTypeJsonSchema; -import org.openapijsonschematools.client.schemas.validation.FrozenMap; -import org.openapijsonschematools.client.schemas.validation.JsonSchema; -import org.openapijsonschematools.client.schemas.validation.JsonSchemaInfo; -import org.openapijsonschematools.client.schemas.validation.MapSchemaValidator; -import org.openapijsonschematools.client.schemas.validation.MapUtils; -import org.openapijsonschematools.client.schemas.validation.PathToSchemasMap; -import org.openapijsonschematools.client.schemas.validation.PropertyEntry; -import org.openapijsonschematools.client.schemas.validation.ValidationMetadata; - -public class StoreorderorderidGetPathParameters { - // nest classes so all schemas and input/output classes can be public - - - public static class AdditionalProperties extends NotAnyTypeJsonSchema.NotAnyTypeJsonSchema1 { - // NotAnyTypeSchema - private static @Nullable AdditionalProperties instance = null; - public static AdditionalProperties getInstance() { - if (instance == null) { - instance = new AdditionalProperties(); - } - return instance; - } - } - - - public static class PathParametersMap extends FrozenMap { - protected PathParametersMap(FrozenMap m) { - super(m); - } - public static final Set requiredKeys = Set.of( - "order_id" - ); - public static final Set optionalKeys = Set.of(); - public static PathParametersMap of(Map arg, SchemaConfiguration configuration) throws ValidationException { - return StoreorderorderidGetPathParameters1.getInstance().validate(arg, configuration); - } - - public Number order_id() { - try { - return getOrThrow("version"); - } catch (UnsetPropertyException e) { - throw new RuntimeException(e); - } - } - } - - public interface SetterForOrderId { - Map getInstance(); - T getBuilderAfterOrderId(Map instance); - - default T order_id(int value) { - var instance = getInstance(); - instance.put("order_id", value); - return getBuilderAfterOrderId(instance); - } - - default T order_id(float value) { - var instance = getInstance(); - instance.put("order_id", value); - return getBuilderAfterOrderId(instance); - } - - default T order_id(long value) { - var instance = getInstance(); - instance.put("order_id", value); - return getBuilderAfterOrderId(instance); - } - - default T order_id(double value) { - var instance = getInstance(); - instance.put("order_id", value); - return getBuilderAfterOrderId(instance); - } - } - - public static class PathParametersMap0Builder implements GenericBuilder> { - private final Map instance; - private static final Set knownKeys = Set.of( - "order_id" - ); - public Set getKnownKeys() { - return knownKeys; - } - public PathParametersMap0Builder(Map instance) { - this.instance = instance; - } - public Map build() { - return instance; - } - } - - public static class PathParametersMapBuilder implements SetterForOrderId { - private final Map instance; - public PathParametersMapBuilder() { - this.instance = new LinkedHashMap<>(); - } - public Map getInstance() { - return instance; - } - public PathParametersMap0Builder getBuilderAfterOrderId(Map instance) { - return new PathParametersMap0Builder(instance); - } - } - - - public sealed interface StoreorderorderidGetPathParameters1Boxed permits StoreorderorderidGetPathParameters1BoxedMap { - @Nullable Object getData(); - } - - public record StoreorderorderidGetPathParameters1BoxedMap(PathParametersMap data) implements StoreorderorderidGetPathParameters1Boxed { - @Override - public @Nullable Object getData() { - return data; - } - } - - - public static class StoreorderorderidGetPathParameters1 extends JsonSchema implements MapSchemaValidator { - private static @Nullable StoreorderorderidGetPathParameters1 instance = null; - - protected StoreorderorderidGetPathParameters1() { - super(new JsonSchemaInfo() - .type(Set.of(Map.class)) - .properties(Map.ofEntries( - new PropertyEntry("order_id", Schema0.Schema01.class) - )) - .required(Set.of( - "order_id" - )) - .additionalProperties(AdditionalProperties.class) - ); - } - - public static StoreorderorderidGetPathParameters1 getInstance() { - if (instance == null) { - instance = new StoreorderorderidGetPathParameters1(); - } - return instance; - } - - 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 RuntimeException("Invalid non-string key value"); - } - String propertyName = (String) entryKey; - List propertyPathToItem = new ArrayList<>(pathToItem); - propertyPathToItem.add(propertyName); - Object value = entry.getValue(); - LinkedHashMap, Nothing?> schemas = pathToSchemas.get(propertyPathToItem); - if (schemas == null) { - throw new RuntimeException("Validation 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"); - } - properties.put(propertyName, (Number) propertyInstance); - } - FrozenMap castProperties = new FrozenMap<>(properties); - return new PathParametersMap(castProperties); - } - - 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); - SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().build())); - ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, new PathToSchemasMap(), new LinkedHashSet<>()); - PathToSchemasMap pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet); - return getNewInstance(castArg, validationMetadata.pathToItem(), pathToSchemasMap); - } - - - @Override - public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws 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"); - } - @Override - public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { - if (arg instanceof Map) { - return getNewInstance((Map) arg, pathToItem, pathToSchemas); - } - throw new RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); - } - @Override - public StoreorderorderidGetPathParameters1BoxedMap validateAndBox(Map arg, SchemaConfiguration configuration) throws ValidationException { - return new StoreorderorderidGetPathParameters1BoxedMap(validate(arg, configuration)); - } - @Override - public StoreorderorderidGetPathParameters1Boxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { - 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"); - } - } - -} diff --git a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/storeorderorderid/get/StoreorderorderidGetResponses.kt b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/storeorderorderid/get/StoreorderorderidGetResponses.kt deleted file mode 100644 index 773ffcb50ab..00000000000 --- a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/storeorderorderid/get/StoreorderorderidGetResponses.kt +++ /dev/null @@ -1,77 +0,0 @@ -package org.openapijsonschematools.client.paths.storeorderorderid.get; - -import org.openapijsonschematools.client.paths.storeorderorderid.get.responses.StoreorderorderidGetCode200Response; -import org.openapijsonschematools.client.paths.storeorderorderid.get.responses.StoreorderorderidGetCode400Response; -import org.openapijsonschematools.client.paths.storeorderorderid.get.responses.StoreorderorderidGetCode404Response; -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; -import org.checkerframework.checker.nullness.qual.Nullable; - -import java.net.http.HttpResponse; -import java.util.Map; -import java.util.AbstractMap; - -public class StoreorderorderidGetResponses { - public sealed interface EndpointResponse permits EndpointStoreorderorderidGetCode200Response {} - - public record EndpointStoreorderorderidGetCode200Response( - HttpResponse response, - StoreorderorderidGetCode200Response.SealedResponseBody body, - Nothing? headers - ) implements EndpointResponse, ApiResponse{ - } - - public sealed interface StatusCodeResponseDeserializer permits StatusStoreorderorderidGetCode200ResponseDeserializer, StatusStoreorderorderidGetCode400ResponseDeserializer, StatusStoreorderorderidGetCode404ResponseDeserializer {} - - public static final class StatusStoreorderorderidGetCode200ResponseDeserializer extends StoreorderorderidGetCode200Response.StoreorderorderidGetCode200Response1 implements StatusCodeResponseDeserializer { - } - public static final class StatusStoreorderorderidGetCode400ResponseDeserializer extends StoreorderorderidGetCode400Response.StoreorderorderidGetCode400Response1 implements StatusCodeResponseDeserializer { - } - public static final class StatusStoreorderorderidGetCode404ResponseDeserializer extends StoreorderorderidGetCode404Response.StoreorderorderidGetCode404Response1 implements StatusCodeResponseDeserializer { - } - - public static final class StoreorderorderidGetResponses1 implements ResponsesDeserializer { - private final Map statusCodeToResponseDeserializer; - public StoreorderorderidGetResponses1() { - this.statusCodeToResponseDeserializer = Map.ofEntries( - new AbstractMap.SimpleEntry<>("200", new StatusStoreorderorderidGetCode200ResponseDeserializer()), - new AbstractMap.SimpleEntry<>("400", new StatusStoreorderorderidGetCode400ResponseDeserializer()), - new AbstractMap.SimpleEntry<>("404", new StatusStoreorderorderidGetCode404ResponseDeserializer()) - ); - } - - 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) { - throw new ApiException( - "Invalid response statusCode="+statusCode+" has no response defined in the openapi document", - response - ); - } - if (statusCodeDeserializer instanceof StatusStoreorderorderidGetCode200ResponseDeserializer castDeserializer) { - var deserializedResponse = castDeserializer.deserialize(response, configuration); - return new EndpointStoreorderorderidGetCode200Response(response, deserializedResponse.body(), deserializedResponse.headers()); - } else if (statusCodeDeserializer instanceof StatusStoreorderorderidGetCode400ResponseDeserializer castDeserializer) { - var deserializedResponse = castDeserializer.deserialize(response, configuration); - throw new StoreorderorderidGetCode400Response.ResponseApiException( - "Received error statusCode response from server", - response, - deserializedResponse - ); - } else { - StatusStoreorderorderidGetCode404ResponseDeserializer castDeserializer = (StatusStoreorderorderidGetCode404ResponseDeserializer) statusCodeDeserializer; - var deserializedResponse = castDeserializer.deserialize(response, configuration); - throw new StoreorderorderidGetCode404Response.ResponseApiException( - "Received error statusCode response from server", - response, - deserializedResponse - ); - } - } - } -} diff --git a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/storeorderorderid/get/parameters/Parameter0.kt b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/storeorderorderid/get/parameters/Parameter0.kt deleted file mode 100644 index e1ad2e999a1..00000000000 --- a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/storeorderorderid/get/parameters/Parameter0.kt +++ /dev/null @@ -1,23 +0,0 @@ -package org.openapijsonschematools.client.paths.storeorderorderid.get.parameters; - -import org.openapijsonschematools.client.parameter.ParameterStyle; -import org.openapijsonschematools.client.parameter.ParameterInType; -import org.openapijsonschematools.client.parameter.SchemaParameter; -import org.openapijsonschematools.client.paths.storeorderorderid.get.parameters.parameter0.Schema0; - -public class Parameter0 { - - public static class Parameter01 extends SchemaParameter { - public Parameter01() { - super( - "order_id", - ParameterInType.PATH, - true, - ParameterStyle.SIMPLE, - false, - false, - Schema0.Schema01.getInstance() - ); - } - } -} diff --git a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/storeorderorderid/get/parameters/parameter0/Schema0.kt b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/storeorderorderid/get/parameters/parameter0/Schema0.kt deleted file mode 100644 index b81d0724b97..00000000000 --- a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/storeorderorderid/get/parameters/parameter0/Schema0.kt +++ /dev/null @@ -1,111 +0,0 @@ -package org.openapijsonschematools.client.paths.storeorderorderid.get.parameters.parameter0; -import java.util.HashSet; -import java.util.LinkedHashSet; -import java.util.List; -import java.util.Objects; -import java.util.Set; -import org.checkerframework.checker.nullness.qual.Nullable; -import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags; -import org.openapijsonschematools.client.configurations.SchemaConfiguration; -import org.openapijsonschematools.client.exceptions.ValidationException; -import org.openapijsonschematools.client.schemas.validation.JsonSchema; -import org.openapijsonschematools.client.schemas.validation.JsonSchemaInfo; -import org.openapijsonschematools.client.schemas.validation.NumberSchemaValidator; -import org.openapijsonschematools.client.schemas.validation.PathToSchemasMap; -import org.openapijsonschematools.client.schemas.validation.ValidationMetadata; - -public class Schema0 { - // nest classes so all schemas and input/output classes can be public - - - public sealed interface Schema01Boxed permits Schema01BoxedNumber { - @Nullable Object getData(); - } - - public record Schema01BoxedNumber(Number data) implements Schema01Boxed { - @Override - public @Nullable Object getData() { - return data; - } - } - - - - public static class Schema01 extends JsonSchema implements NumberSchemaValidator { - private static @Nullable Schema01 instance = null; - - protected Schema01() { - super(new JsonSchemaInfo() - .type(Set.of( - Integer.class, - Long.class, - Float.class, - Double.class - )) - .format("int64") - .maximum(5) - .minimum(1) - ); - } - - public static Schema01 getInstance() { - if (instance == null) { - instance = new Schema01(); - } - return instance; - } - - @Override - public Number validate(Number arg, SchemaConfiguration configuration) throws ValidationException { - Set> pathSet = new HashSet<>(); - List pathToItem = List.of("args[0"); - Number castArg = castToAllowedTypes(arg, pathToItem, pathSet); - SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().build())); - ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, new PathToSchemasMap(), new LinkedHashSet<>()); - getPathToSchemas(this, castArg, validationMetadata, pathSet); - return castArg; - } - - public int validate(int arg, SchemaConfiguration configuration) throws ValidationException { - return (int) validate((Number) arg, configuration); - } - - public float validate(float arg, SchemaConfiguration configuration) throws ValidationException { - return (float) validate((Number) arg, configuration); - } - - public long validate(long arg, SchemaConfiguration configuration) throws ValidationException { - return (long) validate((Number) arg, configuration); - } - - 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 { - 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"); - } - @Override - public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { - 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"); - } - @Override - 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 { - 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"); - } - } -} diff --git a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/storeorderorderid/get/responses/StoreorderorderidGetCode200Response.kt b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/storeorderorderid/get/responses/StoreorderorderidGetCode200Response.kt deleted file mode 100644 index f8e7d5476c3..00000000000 --- a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/storeorderorderid/get/responses/StoreorderorderidGetCode200Response.kt +++ /dev/null @@ -1,81 +0,0 @@ -package org.openapijsonschematools.client.paths.storeorderorderid.get.responses; - -import org.openapijsonschematools.client.configurations.SchemaConfiguration; -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; - -import java.util.AbstractMap; -import java.util.Map; -import java.net.http.HttpResponse; -import java.net.http.HttpHeaders; - -public class StoreorderorderidGetCode200Response { - public sealed interface SealedMediaType permits ApplicationxmlMediaType, ApplicationjsonMediaType {} - - public record ApplicationxmlMediaType(ApplicationxmlSchema.ApplicationxmlSchema1 schema) implements SealedMediaType, MediaType { - public ApplicationxmlMediaType() { - this(ApplicationxmlSchema.ApplicationxmlSchema1.getInstance()); - } - @Override - public Nothing? encoding() { - return null; - } - } - - public record ApplicationjsonMediaType(ApplicationjsonSchema.ApplicationjsonSchema1 schema) implements SealedMediaType, MediaType { - public ApplicationjsonMediaType() { - this(ApplicationjsonSchema.ApplicationjsonSchema1.getInstance()); - } - @Override - public Nothing? encoding() { - return null; - } - } - public sealed interface SealedResponseBody permits ApplicationxmlResponseBody, ApplicationjsonResponseBody {} - public record ApplicationxmlResponseBody(ApplicationxmlSchema.Order1Boxed body) implements SealedResponseBody { } - public record ApplicationjsonResponseBody(ApplicationjsonSchema.Order1Boxed body) implements SealedResponseBody { } - - public static class StoreorderorderidGetCode200Response1 extends ResponseDeserializer { - public StoreorderorderidGetCode200Response1() { - super( - Map.ofEntries( - new AbstractMap.SimpleEntry<>("application/xml", new ApplicationxmlMediaType()), - new AbstractMap.SimpleEntry<>("application/json", new ApplicationjsonMediaType()) - ) - ); - } - - @Override - 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 { - ApplicationjsonMediaType thisMediaType = (ApplicationjsonMediaType) mediaType; - var deserializedBody = deserializeBody(contentType, body, thisMediaType.schema(), configuration); - return new ApplicationjsonResponseBody(deserializedBody); - } - } - - @Override - protected Nothing? getHeaders(HttpHeaders headers, SchemaConfiguration configuration) { - return null; - } - } - - @SuppressWarnings("serial") - public static class ResponseApiException extends ApiException { - public DeserializedHttpResponse deserializedResponse; - - public ResponseApiException(String s, HttpResponse response, DeserializedHttpResponse deserializedResponse) { - super(s, response); - this.deserializedResponse = deserializedResponse; - } - } -} diff --git a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/storeorderorderid/get/responses/StoreorderorderidGetCode400Response.kt b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/storeorderorderid/get/responses/StoreorderorderidGetCode400Response.kt deleted file mode 100644 index 9872ebd4dc1..00000000000 --- a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/storeorderorderid/get/responses/StoreorderorderidGetCode400Response.kt +++ /dev/null @@ -1,45 +0,0 @@ -package org.openapijsonschematools.client.paths.storeorderorderid.get.responses; - -import org.openapijsonschematools.client.configurations.SchemaConfiguration; -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; -import java.net.http.HttpResponse; -import java.net.http.HttpHeaders; - -public class StoreorderorderidGetCode400Response { - - public static class StoreorderorderidGetCode400Response1 extends ResponseDeserializer { - public StoreorderorderidGetCode400Response1() { - super( - MapUtils.makeMap( - ) - ); - } - - @Override - protected Nothing? getBody(String contentType, Nothing? mediaType, byte[] body, SchemaConfiguration configuration) { - return null; - } - - @Override - protected Nothing? getHeaders(HttpHeaders headers, SchemaConfiguration configuration) { - return null; - } - } - - @SuppressWarnings("serial") - public static class ResponseApiException extends ApiException { - public DeserializedHttpResponse deserializedResponse; - - public ResponseApiException(String s, HttpResponse response, DeserializedHttpResponse deserializedResponse) { - super(s, response); - this.deserializedResponse = deserializedResponse; - } - } -} diff --git a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/storeorderorderid/get/responses/StoreorderorderidGetCode404Response.kt b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/storeorderorderid/get/responses/StoreorderorderidGetCode404Response.kt deleted file mode 100644 index 75d169d6caf..00000000000 --- a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/storeorderorderid/get/responses/StoreorderorderidGetCode404Response.kt +++ /dev/null @@ -1,45 +0,0 @@ -package org.openapijsonschematools.client.paths.storeorderorderid.get.responses; - -import org.openapijsonschematools.client.configurations.SchemaConfiguration; -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; -import java.net.http.HttpResponse; -import java.net.http.HttpHeaders; - -public class StoreorderorderidGetCode404Response { - - public static class StoreorderorderidGetCode404Response1 extends ResponseDeserializer { - public StoreorderorderidGetCode404Response1() { - super( - MapUtils.makeMap( - ) - ); - } - - @Override - protected Nothing? getBody(String contentType, Nothing? mediaType, byte[] body, SchemaConfiguration configuration) { - return null; - } - - @Override - protected Nothing? getHeaders(HttpHeaders headers, SchemaConfiguration configuration) { - return null; - } - } - - @SuppressWarnings("serial") - public static class ResponseApiException extends ApiException { - public DeserializedHttpResponse deserializedResponse; - - public ResponseApiException(String s, HttpResponse response, DeserializedHttpResponse deserializedResponse) { - super(s, response); - this.deserializedResponse = deserializedResponse; - } - } -} diff --git a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/storeorderorderid/get/responses/code200response/content/applicationjson/ApplicationjsonSchema.kt b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/storeorderorderid/get/responses/code200response/content/applicationjson/ApplicationjsonSchema.kt deleted file mode 100644 index b1b2c0183b4..00000000000 --- a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/storeorderorderid/get/responses/code200response/content/applicationjson/ApplicationjsonSchema.kt +++ /dev/null @@ -1,19 +0,0 @@ -package org.openapijsonschematools.client.paths.storeorderorderid.get.responses.code200response.content.applicationjson; - -import org.checkerframework.checker.nullness.qual.Nullable; -import org.openapijsonschematools.client.components.schemas.Order; - -public class ApplicationjsonSchema extends Order { - // $refed class - - - public static class ApplicationjsonSchema1 extends Order1 { - private static @Nullable ApplicationjsonSchema1 instance = null; - public static ApplicationjsonSchema1 getInstance() { - if (instance == null) { - instance = new ApplicationjsonSchema1(); - } - return instance; - } - } -} diff --git a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/storeorderorderid/get/responses/code200response/content/applicationxml/ApplicationxmlSchema.kt b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/storeorderorderid/get/responses/code200response/content/applicationxml/ApplicationxmlSchema.kt deleted file mode 100644 index 91ca54812cd..00000000000 --- a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/storeorderorderid/get/responses/code200response/content/applicationxml/ApplicationxmlSchema.kt +++ /dev/null @@ -1,19 +0,0 @@ -package org.openapijsonschematools.client.paths.storeorderorderid.get.responses.code200response.content.applicationxml; - -import org.checkerframework.checker.nullness.qual.Nullable; -import org.openapijsonschematools.client.components.schemas.Order; - -public class ApplicationxmlSchema extends Order { - // $refed class - - - public static class ApplicationxmlSchema1 extends Order1 { - private static @Nullable ApplicationxmlSchema1 instance = null; - public static ApplicationxmlSchema1 getInstance() { - if (instance == null) { - instance = new ApplicationxmlSchema1(); - } - return instance; - } - } -} diff --git a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/user/UserPost.kt b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/user/UserPost.kt deleted file mode 100644 index 9881c39c507..00000000000 --- a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/user/UserPost.kt +++ /dev/null @@ -1,183 +0,0 @@ -package org.openapijsonschematools.client.paths.user; - -import org.checkerframework.checker.nullness.qual.Nullable; -import org.openapijsonschematools.client.RootServerInfo; -import org.openapijsonschematools.client.paths.user.post.UserPostRequestBody; -import org.openapijsonschematools.client.paths.user.post.UserPostResponses; -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.requestbody.SerializedRequestBody; -import org.openapijsonschematools.client.paths.User; - -import java.io.IOException; -import java.util.ArrayList; -import java.net.http.HttpClient; -import java.net.http.HttpRequest; -import java.time.Duration; -import java.util.List; -import java.util.Map; - -public class UserPost { - private static class PostProvider { - private static final String method = "post"; - - public static UserPostResponses.EndpointResponse post( - PostRequest request, - ApiConfiguration apiConfiguration, - SchemaConfiguration schemaConfiguration, - HttpClient client - ) throws IOException, InterruptedException, ValidationException, NotImplementedException, ApiException { - Map> headers = apiConfiguration.getDefaultHeaders(); - - SerializedRequestBody serializedRequestBody = new UserPostRequestBody.UserPostRequestBody1().serialize( - request.requestBody - ); - var contentTypeHeaderValues = headers.getOrDefault("Content-Type", new ArrayList<>()); - contentTypeHeaderValues.add(serializedRequestBody.contentType); - HttpRequest.BodyPublisher bodyPublisher = serializedRequestBody.bodyPublisher; - // TODO set this to a map if there is a query security scheme - @Nullable Map queryMap = null; - String host = apiConfiguration.getServer(request.serverIndex).url(); - - String url = host + User.path; - var httpRequest = RestClient.getRequest( - url, - method, - bodyPublisher, - headers, - request.timeout - ); - var response = RestClient.getResponse(httpRequest, client); - var responsesDeserializer = new UserPostResponses.UserPostResponses1(); - return responsesDeserializer.deserialize(response, schemaConfiguration); - } - } - - public interface PostOperation { - ApiConfiguration getApiConfiguration(); - SchemaConfiguration getSchemaConfiguration(); - HttpClient getClient(); - default UserPostResponses.EndpointResponse post(PostRequest request) throws IOException, InterruptedException, ValidationException, NotImplementedException, ApiException { - return PostProvider.post(request, getApiConfiguration(), getSchemaConfiguration(), getClient()); - } - } - - public interface CreateUserOperation { - ApiConfiguration getApiConfiguration(); - SchemaConfiguration getSchemaConfiguration(); - HttpClient getClient(); - default UserPostResponses.EndpointResponse createUser(PostRequest request) throws IOException, InterruptedException, ValidationException, NotImplementedException, ApiException { - return PostProvider.post(request, getApiConfiguration(), getSchemaConfiguration(), getClient()); - } - } - - public static class Post extends ApiClient implements PostOperation { - public Post(ApiConfiguration apiConfiguration, SchemaConfiguration schemaConfiguration) { - super(apiConfiguration, schemaConfiguration); - } - } - - public static class PostRequest { - public UserPostRequestBody.SealedRequestBody requestBody; - public RootServerInfo.@Nullable ServerIndex serverIndex; - public @Nullable Duration timeout; - - public PostRequest( - UserPostRequestBody.SealedRequestBody requestBody, - RootServerInfo.@Nullable ServerIndex serverIndex, - @Nullable Duration timeout - ) { - this.requestBody = requestBody; - this.serverIndex = serverIndex; - this.timeout = timeout; - } - } - - public static class PostNullableRequest { - public UserPostRequestBody.@Nullable SealedRequestBody requestBody; - public RootServerInfo.@Nullable ServerIndex serverIndex; - public @Nullable Duration timeout; - } - - public interface SetterForServerIndex { - PostNullableRequest getInstance(); - T getBuilderAfterServerIndex(PostNullableRequest instance); - default T serverIndex(RootServerInfo.ServerIndex serverIndex) { - var instance = getInstance(); - instance.serverIndex = serverIndex; - return getBuilderAfterServerIndex(instance); - } - } - - public interface SetterForTimeout { - PostNullableRequest getInstance(); - T getBuilderAfterTimeout(PostNullableRequest instance); - default T timeout(Duration timeout) { - var instance = getInstance(); - instance.timeout = timeout; - return getBuilderAfterTimeout(instance); - } - } - - public interface SetterForRequestBody { - PostNullableRequest getInstance(); - T getBuilderAfterRequestBody(PostNullableRequest instance); - default T requestBody(UserPostRequestBody.SealedRequestBody requestBody) { - var instance = getInstance(); - instance.requestBody = requestBody; - return getBuilderAfterRequestBody(instance); - } - } - - public static class Post0RequestBuilder implements SetterForServerIndex, SetterForTimeout { - private final PostNullableRequest instance; - - public Post0RequestBuilder(PostNullableRequest instance) { - this.instance = instance; - } - - public PostRequest build() { - var requestBody = instance.requestBody; - if (requestBody == null) { - throw new RuntimeException("invalid null value for required parameter"); - } - return new PostRequest( - requestBody, - instance.serverIndex, - instance.timeout - ); - } - - public PostNullableRequest getInstance() { - return instance; - } - - public Post0RequestBuilder getBuilderAfterServerIndex(PostNullableRequest instance) { - return this; - } - - public Post0RequestBuilder getBuilderAfterTimeout(PostNullableRequest instance) { - return this; - } - } - public static class PostRequestBuilder implements SetterForRequestBody { - private final PostNullableRequest instance; - - public PostRequestBuilder() { - this.instance = new PostNullableRequest(); - } - - public PostNullableRequest getInstance() { - return instance; - } - - public Post0RequestBuilder getBuilderAfterRequestBody(PostNullableRequest instance) { - return new Post0RequestBuilder(instance); - } - } -} diff --git a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/user/post/UserPostRequestBody.kt b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/user/post/UserPostRequestBody.kt deleted file mode 100644 index 37eeb3e4d44..00000000000 --- a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/user/post/UserPostRequestBody.kt +++ /dev/null @@ -1,49 +0,0 @@ -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; -import org.openapijsonschematools.client.mediatype.MediaType; -import org.openapijsonschematools.client.paths.user.post.requestbody.content.applicationjson.ApplicationjsonSchema; - -import java.util.AbstractMap; -import java.util.Map; - -public class UserPostRequestBody { - public sealed interface SealedMediaType permits ApplicationjsonMediaType {} - - public record ApplicationjsonMediaType(ApplicationjsonSchema.ApplicationjsonSchema1 schema) implements SealedMediaType, MediaType { - public ApplicationjsonMediaType() { - this(ApplicationjsonSchema.ApplicationjsonSchema1.getInstance()); - } - @Override - public Nothing? encoding() { - return null; - } - } - - public static class UserPostRequestBody1 extends RequestBodySerializer { - public UserPostRequestBody1() { - super( - Map.ofEntries( - new AbstractMap.SimpleEntry<>("application/json", new ApplicationjsonMediaType()) - ), - true - ); - } - - public SerializedRequestBody serialize(SealedRequestBody requestBody) throws NotImplementedException { - ApplicationjsonRequestBody requestBody0 = (ApplicationjsonRequestBody) requestBody; - return serialize(requestBody0.contentType(), requestBody0.body().getData()); - } - } - - public sealed interface SealedRequestBody permits ApplicationjsonRequestBody {} - public record ApplicationjsonRequestBody(ApplicationjsonSchema.User1Boxed body) implements SealedRequestBody, GenericRequestBody { - @Override - public String contentType() { - return "application/json"; - } - } -} diff --git a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/user/post/UserPostResponses.kt b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/user/post/UserPostResponses.kt deleted file mode 100644 index 696e30302ee..00000000000 --- a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/user/post/UserPostResponses.kt +++ /dev/null @@ -1,37 +0,0 @@ -package org.openapijsonschematools.client.paths.user.post; - -import org.openapijsonschematools.client.paths.user.post.responses.UserPostCodedefaultResponse; -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; -import org.checkerframework.checker.nullness.qual.Nullable; - -import java.net.http.HttpResponse; -import java.util.Map; -import java.util.AbstractMap; - -public class UserPostResponses { - public sealed interface EndpointResponse permits EndpointUserPostCodedefaultResponse {} - - public record EndpointUserPostCodedefaultResponse( - HttpResponse response, - Nothing? body, - Nothing? headers - ) implements EndpointResponse, ApiResponse{ - } - - public static final class UserPostResponses1 implements ResponsesDeserializer { - private final UserPostCodedefaultResponse.UserPostCodedefaultResponse1 defaultResponseDeserializer; - public UserPostResponses1() { - this.defaultResponseDeserializer = new UserPostCodedefaultResponse.UserPostCodedefaultResponse1(); - } - - public EndpointResponse deserialize(HttpResponse response, SchemaConfiguration configuration) throws ValidationException, NotImplementedException, ApiException { - var deserializedResponse = defaultResponseDeserializer.deserialize(response, configuration); - return new EndpointUserPostCodedefaultResponse(response, deserializedResponse.body(), deserializedResponse.headers()); - } - } -} diff --git a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/user/post/requestbody/content/applicationjson/ApplicationjsonSchema.kt b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/user/post/requestbody/content/applicationjson/ApplicationjsonSchema.kt deleted file mode 100644 index b23c171aa6e..00000000000 --- a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/user/post/requestbody/content/applicationjson/ApplicationjsonSchema.kt +++ /dev/null @@ -1,19 +0,0 @@ -package org.openapijsonschematools.client.paths.user.post.requestbody.content.applicationjson; - -import org.checkerframework.checker.nullness.qual.Nullable; -import org.openapijsonschematools.client.components.schemas.User; - -public class ApplicationjsonSchema extends User { - // $refed class - - - public static class ApplicationjsonSchema1 extends User1 { - private static @Nullable ApplicationjsonSchema1 instance = null; - public static ApplicationjsonSchema1 getInstance() { - if (instance == null) { - instance = new ApplicationjsonSchema1(); - } - return instance; - } - } -} diff --git a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/user/post/responses/UserPostCodedefaultResponse.kt b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/user/post/responses/UserPostCodedefaultResponse.kt deleted file mode 100644 index d33f504ecbc..00000000000 --- a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/user/post/responses/UserPostCodedefaultResponse.kt +++ /dev/null @@ -1,45 +0,0 @@ -package org.openapijsonschematools.client.paths.user.post.responses; - -import org.openapijsonschematools.client.configurations.SchemaConfiguration; -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; -import java.net.http.HttpResponse; -import java.net.http.HttpHeaders; - -public class UserPostCodedefaultResponse { - - public static class UserPostCodedefaultResponse1 extends ResponseDeserializer { - public UserPostCodedefaultResponse1() { - super( - MapUtils.makeMap( - ) - ); - } - - @Override - protected Nothing? getBody(String contentType, Nothing? mediaType, byte[] body, SchemaConfiguration configuration) { - return null; - } - - @Override - protected Nothing? getHeaders(HttpHeaders headers, SchemaConfiguration configuration) { - return null; - } - } - - @SuppressWarnings("serial") - public static class ResponseApiException extends ApiException { - public DeserializedHttpResponse deserializedResponse; - - public ResponseApiException(String s, HttpResponse response, DeserializedHttpResponse deserializedResponse) { - super(s, response); - this.deserializedResponse = deserializedResponse; - } - } -} diff --git a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/usercreatewitharray/UsercreatewitharrayPost.kt b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/usercreatewitharray/UsercreatewitharrayPost.kt deleted file mode 100644 index e3c07ef1234..00000000000 --- a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/usercreatewitharray/UsercreatewitharrayPost.kt +++ /dev/null @@ -1,183 +0,0 @@ -package org.openapijsonschematools.client.paths.usercreatewitharray; - -import org.checkerframework.checker.nullness.qual.Nullable; -import org.openapijsonschematools.client.RootServerInfo; -import org.openapijsonschematools.client.paths.usercreatewitharray.post.UsercreatewitharrayPostRequestBody; -import org.openapijsonschematools.client.paths.usercreatewitharray.post.UsercreatewitharrayPostResponses; -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.requestbody.SerializedRequestBody; -import org.openapijsonschematools.client.paths.Usercreatewitharray; - -import java.io.IOException; -import java.util.ArrayList; -import java.net.http.HttpClient; -import java.net.http.HttpRequest; -import java.time.Duration; -import java.util.List; -import java.util.Map; - -public class UsercreatewitharrayPost { - private static class PostProvider { - private static final String method = "post"; - - public static UsercreatewitharrayPostResponses.EndpointResponse post( - PostRequest request, - ApiConfiguration apiConfiguration, - SchemaConfiguration schemaConfiguration, - HttpClient client - ) throws IOException, InterruptedException, ValidationException, NotImplementedException, ApiException { - Map> headers = apiConfiguration.getDefaultHeaders(); - - SerializedRequestBody serializedRequestBody = new UsercreatewitharrayPostRequestBody.UsercreatewitharrayPostRequestBody1().serialize( - request.requestBody - ); - var contentTypeHeaderValues = headers.getOrDefault("Content-Type", new ArrayList<>()); - contentTypeHeaderValues.add(serializedRequestBody.contentType); - HttpRequest.BodyPublisher bodyPublisher = serializedRequestBody.bodyPublisher; - // TODO set this to a map if there is a query security scheme - @Nullable Map queryMap = null; - String host = apiConfiguration.getServer(request.serverIndex).url(); - - String url = host + Usercreatewitharray.path; - var httpRequest = RestClient.getRequest( - url, - method, - bodyPublisher, - headers, - request.timeout - ); - var response = RestClient.getResponse(httpRequest, client); - var responsesDeserializer = new UsercreatewitharrayPostResponses.UsercreatewitharrayPostResponses1(); - return responsesDeserializer.deserialize(response, schemaConfiguration); - } - } - - public interface PostOperation { - ApiConfiguration getApiConfiguration(); - SchemaConfiguration getSchemaConfiguration(); - HttpClient getClient(); - default UsercreatewitharrayPostResponses.EndpointResponse post(PostRequest request) throws IOException, InterruptedException, ValidationException, NotImplementedException, ApiException { - return PostProvider.post(request, getApiConfiguration(), getSchemaConfiguration(), getClient()); - } - } - - public interface CreateUsersWithArrayInputOperation { - ApiConfiguration getApiConfiguration(); - SchemaConfiguration getSchemaConfiguration(); - HttpClient getClient(); - default UsercreatewitharrayPostResponses.EndpointResponse createUsersWithArrayInput(PostRequest request) throws IOException, InterruptedException, ValidationException, NotImplementedException, ApiException { - return PostProvider.post(request, getApiConfiguration(), getSchemaConfiguration(), getClient()); - } - } - - public static class Post extends ApiClient implements PostOperation { - public Post(ApiConfiguration apiConfiguration, SchemaConfiguration schemaConfiguration) { - super(apiConfiguration, schemaConfiguration); - } - } - - public static class PostRequest { - public UsercreatewitharrayPostRequestBody.SealedRequestBody requestBody; - public RootServerInfo.@Nullable ServerIndex serverIndex; - public @Nullable Duration timeout; - - public PostRequest( - UsercreatewitharrayPostRequestBody.SealedRequestBody requestBody, - RootServerInfo.@Nullable ServerIndex serverIndex, - @Nullable Duration timeout - ) { - this.requestBody = requestBody; - this.serverIndex = serverIndex; - this.timeout = timeout; - } - } - - public static class PostNullableRequest { - public UsercreatewitharrayPostRequestBody.@Nullable SealedRequestBody requestBody; - public RootServerInfo.@Nullable ServerIndex serverIndex; - public @Nullable Duration timeout; - } - - public interface SetterForServerIndex { - PostNullableRequest getInstance(); - T getBuilderAfterServerIndex(PostNullableRequest instance); - default T serverIndex(RootServerInfo.ServerIndex serverIndex) { - var instance = getInstance(); - instance.serverIndex = serverIndex; - return getBuilderAfterServerIndex(instance); - } - } - - public interface SetterForTimeout { - PostNullableRequest getInstance(); - T getBuilderAfterTimeout(PostNullableRequest instance); - default T timeout(Duration timeout) { - var instance = getInstance(); - instance.timeout = timeout; - return getBuilderAfterTimeout(instance); - } - } - - public interface SetterForRequestBody { - PostNullableRequest getInstance(); - T getBuilderAfterRequestBody(PostNullableRequest instance); - default T requestBody(UsercreatewitharrayPostRequestBody.SealedRequestBody requestBody) { - var instance = getInstance(); - instance.requestBody = requestBody; - return getBuilderAfterRequestBody(instance); - } - } - - public static class Post0RequestBuilder implements SetterForServerIndex, SetterForTimeout { - private final PostNullableRequest instance; - - public Post0RequestBuilder(PostNullableRequest instance) { - this.instance = instance; - } - - public PostRequest build() { - var requestBody = instance.requestBody; - if (requestBody == null) { - throw new RuntimeException("invalid null value for required parameter"); - } - return new PostRequest( - requestBody, - instance.serverIndex, - instance.timeout - ); - } - - public PostNullableRequest getInstance() { - return instance; - } - - public Post0RequestBuilder getBuilderAfterServerIndex(PostNullableRequest instance) { - return this; - } - - public Post0RequestBuilder getBuilderAfterTimeout(PostNullableRequest instance) { - return this; - } - } - public static class PostRequestBuilder implements SetterForRequestBody { - private final PostNullableRequest instance; - - public PostRequestBuilder() { - this.instance = new PostNullableRequest(); - } - - public PostNullableRequest getInstance() { - return instance; - } - - public Post0RequestBuilder getBuilderAfterRequestBody(PostNullableRequest instance) { - return new Post0RequestBuilder(instance); - } - } -} diff --git a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/usercreatewitharray/post/UsercreatewitharrayPostRequestBody.kt b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/usercreatewitharray/post/UsercreatewitharrayPostRequestBody.kt deleted file mode 100644 index 50224dc5a1c..00000000000 --- a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/usercreatewitharray/post/UsercreatewitharrayPostRequestBody.kt +++ /dev/null @@ -1,7 +0,0 @@ -package org.openapijsonschematools.client.paths.usercreatewitharray.post; - -import org.openapijsonschematools.client.components.requestbodies.UserArray; - -public class UsercreatewitharrayPostRequestBody extends UserArray { - public static class UsercreatewitharrayPostRequestBody1 extends UserArray1 {} -} diff --git a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/usercreatewitharray/post/UsercreatewitharrayPostResponses.kt b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/usercreatewitharray/post/UsercreatewitharrayPostResponses.kt deleted file mode 100644 index dac09d18a04..00000000000 --- a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/usercreatewitharray/post/UsercreatewitharrayPostResponses.kt +++ /dev/null @@ -1,37 +0,0 @@ -package org.openapijsonschematools.client.paths.usercreatewitharray.post; - -import org.openapijsonschematools.client.paths.usercreatewitharray.post.responses.UsercreatewitharrayPostCodedefaultResponse; -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; -import org.checkerframework.checker.nullness.qual.Nullable; - -import java.net.http.HttpResponse; -import java.util.Map; -import java.util.AbstractMap; - -public class UsercreatewitharrayPostResponses { - public sealed interface EndpointResponse permits EndpointUsercreatewitharrayPostCodedefaultResponse {} - - public record EndpointUsercreatewitharrayPostCodedefaultResponse( - HttpResponse response, - Nothing? body, - Nothing? headers - ) implements EndpointResponse, ApiResponse{ - } - - public static final class UsercreatewitharrayPostResponses1 implements ResponsesDeserializer { - private final UsercreatewitharrayPostCodedefaultResponse.UsercreatewitharrayPostCodedefaultResponse1 defaultResponseDeserializer; - public UsercreatewitharrayPostResponses1() { - this.defaultResponseDeserializer = new UsercreatewitharrayPostCodedefaultResponse.UsercreatewitharrayPostCodedefaultResponse1(); - } - - public EndpointResponse deserialize(HttpResponse response, SchemaConfiguration configuration) throws ValidationException, NotImplementedException, ApiException { - var deserializedResponse = defaultResponseDeserializer.deserialize(response, configuration); - return new EndpointUsercreatewitharrayPostCodedefaultResponse(response, deserializedResponse.body(), deserializedResponse.headers()); - } - } -} diff --git a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/usercreatewitharray/post/responses/UsercreatewitharrayPostCodedefaultResponse.kt b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/usercreatewitharray/post/responses/UsercreatewitharrayPostCodedefaultResponse.kt deleted file mode 100644 index fe3e9c56390..00000000000 --- a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/usercreatewitharray/post/responses/UsercreatewitharrayPostCodedefaultResponse.kt +++ /dev/null @@ -1,45 +0,0 @@ -package org.openapijsonschematools.client.paths.usercreatewitharray.post.responses; - -import org.openapijsonschematools.client.configurations.SchemaConfiguration; -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; -import java.net.http.HttpResponse; -import java.net.http.HttpHeaders; - -public class UsercreatewitharrayPostCodedefaultResponse { - - public static class UsercreatewitharrayPostCodedefaultResponse1 extends ResponseDeserializer { - public UsercreatewitharrayPostCodedefaultResponse1() { - super( - MapUtils.makeMap( - ) - ); - } - - @Override - protected Nothing? getBody(String contentType, Nothing? mediaType, byte[] body, SchemaConfiguration configuration) { - return null; - } - - @Override - protected Nothing? getHeaders(HttpHeaders headers, SchemaConfiguration configuration) { - return null; - } - } - - @SuppressWarnings("serial") - public static class ResponseApiException extends ApiException { - public DeserializedHttpResponse deserializedResponse; - - public ResponseApiException(String s, HttpResponse response, DeserializedHttpResponse deserializedResponse) { - super(s, response); - this.deserializedResponse = deserializedResponse; - } - } -} diff --git a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/usercreatewithlist/UsercreatewithlistPost.kt b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/usercreatewithlist/UsercreatewithlistPost.kt deleted file mode 100644 index 0d346b0d866..00000000000 --- a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/usercreatewithlist/UsercreatewithlistPost.kt +++ /dev/null @@ -1,183 +0,0 @@ -package org.openapijsonschematools.client.paths.usercreatewithlist; - -import org.checkerframework.checker.nullness.qual.Nullable; -import org.openapijsonschematools.client.RootServerInfo; -import org.openapijsonschematools.client.paths.usercreatewithlist.post.UsercreatewithlistPostRequestBody; -import org.openapijsonschematools.client.paths.usercreatewithlist.post.UsercreatewithlistPostResponses; -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.requestbody.SerializedRequestBody; -import org.openapijsonschematools.client.paths.Usercreatewithlist; - -import java.io.IOException; -import java.util.ArrayList; -import java.net.http.HttpClient; -import java.net.http.HttpRequest; -import java.time.Duration; -import java.util.List; -import java.util.Map; - -public class UsercreatewithlistPost { - private static class PostProvider { - private static final String method = "post"; - - public static UsercreatewithlistPostResponses.EndpointResponse post( - PostRequest request, - ApiConfiguration apiConfiguration, - SchemaConfiguration schemaConfiguration, - HttpClient client - ) throws IOException, InterruptedException, ValidationException, NotImplementedException, ApiException { - Map> headers = apiConfiguration.getDefaultHeaders(); - - SerializedRequestBody serializedRequestBody = new UsercreatewithlistPostRequestBody.UsercreatewithlistPostRequestBody1().serialize( - request.requestBody - ); - var contentTypeHeaderValues = headers.getOrDefault("Content-Type", new ArrayList<>()); - contentTypeHeaderValues.add(serializedRequestBody.contentType); - HttpRequest.BodyPublisher bodyPublisher = serializedRequestBody.bodyPublisher; - // TODO set this to a map if there is a query security scheme - @Nullable Map queryMap = null; - String host = apiConfiguration.getServer(request.serverIndex).url(); - - String url = host + Usercreatewithlist.path; - var httpRequest = RestClient.getRequest( - url, - method, - bodyPublisher, - headers, - request.timeout - ); - var response = RestClient.getResponse(httpRequest, client); - var responsesDeserializer = new UsercreatewithlistPostResponses.UsercreatewithlistPostResponses1(); - return responsesDeserializer.deserialize(response, schemaConfiguration); - } - } - - public interface PostOperation { - ApiConfiguration getApiConfiguration(); - SchemaConfiguration getSchemaConfiguration(); - HttpClient getClient(); - default UsercreatewithlistPostResponses.EndpointResponse post(PostRequest request) throws IOException, InterruptedException, ValidationException, NotImplementedException, ApiException { - return PostProvider.post(request, getApiConfiguration(), getSchemaConfiguration(), getClient()); - } - } - - public interface CreateUsersWithListInputOperation { - ApiConfiguration getApiConfiguration(); - SchemaConfiguration getSchemaConfiguration(); - HttpClient getClient(); - default UsercreatewithlistPostResponses.EndpointResponse createUsersWithListInput(PostRequest request) throws IOException, InterruptedException, ValidationException, NotImplementedException, ApiException { - return PostProvider.post(request, getApiConfiguration(), getSchemaConfiguration(), getClient()); - } - } - - public static class Post extends ApiClient implements PostOperation { - public Post(ApiConfiguration apiConfiguration, SchemaConfiguration schemaConfiguration) { - super(apiConfiguration, schemaConfiguration); - } - } - - public static class PostRequest { - public UsercreatewithlistPostRequestBody.SealedRequestBody requestBody; - public RootServerInfo.@Nullable ServerIndex serverIndex; - public @Nullable Duration timeout; - - public PostRequest( - UsercreatewithlistPostRequestBody.SealedRequestBody requestBody, - RootServerInfo.@Nullable ServerIndex serverIndex, - @Nullable Duration timeout - ) { - this.requestBody = requestBody; - this.serverIndex = serverIndex; - this.timeout = timeout; - } - } - - public static class PostNullableRequest { - public UsercreatewithlistPostRequestBody.@Nullable SealedRequestBody requestBody; - public RootServerInfo.@Nullable ServerIndex serverIndex; - public @Nullable Duration timeout; - } - - public interface SetterForServerIndex { - PostNullableRequest getInstance(); - T getBuilderAfterServerIndex(PostNullableRequest instance); - default T serverIndex(RootServerInfo.ServerIndex serverIndex) { - var instance = getInstance(); - instance.serverIndex = serverIndex; - return getBuilderAfterServerIndex(instance); - } - } - - public interface SetterForTimeout { - PostNullableRequest getInstance(); - T getBuilderAfterTimeout(PostNullableRequest instance); - default T timeout(Duration timeout) { - var instance = getInstance(); - instance.timeout = timeout; - return getBuilderAfterTimeout(instance); - } - } - - public interface SetterForRequestBody { - PostNullableRequest getInstance(); - T getBuilderAfterRequestBody(PostNullableRequest instance); - default T requestBody(UsercreatewithlistPostRequestBody.SealedRequestBody requestBody) { - var instance = getInstance(); - instance.requestBody = requestBody; - return getBuilderAfterRequestBody(instance); - } - } - - public static class Post0RequestBuilder implements SetterForServerIndex, SetterForTimeout { - private final PostNullableRequest instance; - - public Post0RequestBuilder(PostNullableRequest instance) { - this.instance = instance; - } - - public PostRequest build() { - var requestBody = instance.requestBody; - if (requestBody == null) { - throw new RuntimeException("invalid null value for required parameter"); - } - return new PostRequest( - requestBody, - instance.serverIndex, - instance.timeout - ); - } - - public PostNullableRequest getInstance() { - return instance; - } - - public Post0RequestBuilder getBuilderAfterServerIndex(PostNullableRequest instance) { - return this; - } - - public Post0RequestBuilder getBuilderAfterTimeout(PostNullableRequest instance) { - return this; - } - } - public static class PostRequestBuilder implements SetterForRequestBody { - private final PostNullableRequest instance; - - public PostRequestBuilder() { - this.instance = new PostNullableRequest(); - } - - public PostNullableRequest getInstance() { - return instance; - } - - public Post0RequestBuilder getBuilderAfterRequestBody(PostNullableRequest instance) { - return new Post0RequestBuilder(instance); - } - } -} diff --git a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/usercreatewithlist/post/UsercreatewithlistPostRequestBody.kt b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/usercreatewithlist/post/UsercreatewithlistPostRequestBody.kt deleted file mode 100644 index 1d84fbcdb44..00000000000 --- a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/usercreatewithlist/post/UsercreatewithlistPostRequestBody.kt +++ /dev/null @@ -1,7 +0,0 @@ -package org.openapijsonschematools.client.paths.usercreatewithlist.post; - -import org.openapijsonschematools.client.components.requestbodies.RefUserArray; - -public class UsercreatewithlistPostRequestBody extends RefUserArray { - public static class UsercreatewithlistPostRequestBody1 extends RefUserArray1 {} -} diff --git a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/usercreatewithlist/post/UsercreatewithlistPostResponses.kt b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/usercreatewithlist/post/UsercreatewithlistPostResponses.kt deleted file mode 100644 index f1d18a083ec..00000000000 --- a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/usercreatewithlist/post/UsercreatewithlistPostResponses.kt +++ /dev/null @@ -1,37 +0,0 @@ -package org.openapijsonschematools.client.paths.usercreatewithlist.post; - -import org.openapijsonschematools.client.paths.usercreatewithlist.post.responses.UsercreatewithlistPostCodedefaultResponse; -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; -import org.checkerframework.checker.nullness.qual.Nullable; - -import java.net.http.HttpResponse; -import java.util.Map; -import java.util.AbstractMap; - -public class UsercreatewithlistPostResponses { - public sealed interface EndpointResponse permits EndpointUsercreatewithlistPostCodedefaultResponse {} - - public record EndpointUsercreatewithlistPostCodedefaultResponse( - HttpResponse response, - Nothing? body, - Nothing? headers - ) implements EndpointResponse, ApiResponse{ - } - - public static final class UsercreatewithlistPostResponses1 implements ResponsesDeserializer { - private final UsercreatewithlistPostCodedefaultResponse.UsercreatewithlistPostCodedefaultResponse1 defaultResponseDeserializer; - public UsercreatewithlistPostResponses1() { - this.defaultResponseDeserializer = new UsercreatewithlistPostCodedefaultResponse.UsercreatewithlistPostCodedefaultResponse1(); - } - - public EndpointResponse deserialize(HttpResponse response, SchemaConfiguration configuration) throws ValidationException, NotImplementedException, ApiException { - var deserializedResponse = defaultResponseDeserializer.deserialize(response, configuration); - return new EndpointUsercreatewithlistPostCodedefaultResponse(response, deserializedResponse.body(), deserializedResponse.headers()); - } - } -} diff --git a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/usercreatewithlist/post/responses/UsercreatewithlistPostCodedefaultResponse.kt b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/usercreatewithlist/post/responses/UsercreatewithlistPostCodedefaultResponse.kt deleted file mode 100644 index c9a33a2d2a8..00000000000 --- a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/usercreatewithlist/post/responses/UsercreatewithlistPostCodedefaultResponse.kt +++ /dev/null @@ -1,45 +0,0 @@ -package org.openapijsonschematools.client.paths.usercreatewithlist.post.responses; - -import org.openapijsonschematools.client.configurations.SchemaConfiguration; -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; -import java.net.http.HttpResponse; -import java.net.http.HttpHeaders; - -public class UsercreatewithlistPostCodedefaultResponse { - - public static class UsercreatewithlistPostCodedefaultResponse1 extends ResponseDeserializer { - public UsercreatewithlistPostCodedefaultResponse1() { - super( - MapUtils.makeMap( - ) - ); - } - - @Override - protected Nothing? getBody(String contentType, Nothing? mediaType, byte[] body, SchemaConfiguration configuration) { - return null; - } - - @Override - protected Nothing? getHeaders(HttpHeaders headers, SchemaConfiguration configuration) { - return null; - } - } - - @SuppressWarnings("serial") - public static class ResponseApiException extends ApiException { - public DeserializedHttpResponse deserializedResponse; - - public ResponseApiException(String s, HttpResponse response, DeserializedHttpResponse deserializedResponse) { - super(s, response); - this.deserializedResponse = deserializedResponse; - } - } -} diff --git a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/userlogin/UserloginGet.kt b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/userlogin/UserloginGet.kt deleted file mode 100644 index 5a65e591c6d..00000000000 --- a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/userlogin/UserloginGet.kt +++ /dev/null @@ -1,180 +0,0 @@ -package org.openapijsonschematools.client.paths.userlogin; - -import org.checkerframework.checker.nullness.qual.Nullable; -import org.openapijsonschematools.client.RootServerInfo; -import org.openapijsonschematools.client.paths.userlogin.get.UserloginGetQueryParameters; -import org.openapijsonschematools.client.paths.userlogin.get.Parameters; -import org.openapijsonschematools.client.paths.userlogin.get.UserloginGetResponses; -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.paths.Userlogin; - -import java.io.IOException; -import java.net.http.HttpClient; -import java.net.http.HttpRequest; -import java.time.Duration; -import java.util.List; -import java.util.Map; - -public class UserloginGet { - private static class GetProvider { - private static final String method = "get"; - - public static UserloginGetResponses.EndpointResponse get( - GetRequest request, - ApiConfiguration apiConfiguration, - SchemaConfiguration schemaConfiguration, - HttpClient client - ) throws IOException, InterruptedException, ValidationException, NotImplementedException, ApiException { - Map> headers = apiConfiguration.getDefaultHeaders(); - HttpRequest.BodyPublisher bodyPublisher = HttpRequest.BodyPublishers.noBody(); - - var querySerializer = new Parameters.QueryParametersSerializer(); - @Nullable Map queryMap = querySerializer.getQueryMap(request.queryParameters); - String host = apiConfiguration.getServer(request.serverIndex).url(); - - String url = host + Userlogin.path; - if (queryMap != null) { - url = url + querySerializer.serialize(queryMap); - } - var httpRequest = RestClient.getRequest( - url, - method, - bodyPublisher, - headers, - request.timeout - ); - var response = RestClient.getResponse(httpRequest, client); - var responsesDeserializer = new UserloginGetResponses.UserloginGetResponses1(); - return responsesDeserializer.deserialize(response, schemaConfiguration); - } - } - - public interface GetOperation { - ApiConfiguration getApiConfiguration(); - SchemaConfiguration getSchemaConfiguration(); - HttpClient getClient(); - default UserloginGetResponses.EndpointResponse get(GetRequest request) throws IOException, InterruptedException, ValidationException, NotImplementedException, ApiException { - return GetProvider.get(request, getApiConfiguration(), getSchemaConfiguration(), getClient()); - } - } - - public interface LoginUserOperation { - ApiConfiguration getApiConfiguration(); - SchemaConfiguration getSchemaConfiguration(); - HttpClient getClient(); - default UserloginGetResponses.EndpointResponse loginUser(GetRequest request) throws IOException, InterruptedException, ValidationException, NotImplementedException, ApiException { - return GetProvider.get(request, getApiConfiguration(), getSchemaConfiguration(), getClient()); - } - } - - public static class Get extends ApiClient implements GetOperation { - public Get(ApiConfiguration apiConfiguration, SchemaConfiguration schemaConfiguration) { - super(apiConfiguration, schemaConfiguration); - } - } - - public static class GetRequest { - public UserloginGetQueryParameters.QueryParametersMap queryParameters; - public RootServerInfo.@Nullable ServerIndex serverIndex; - public @Nullable Duration timeout; - - public GetRequest( - UserloginGetQueryParameters.QueryParametersMap queryParameters, - RootServerInfo.@Nullable ServerIndex serverIndex, - @Nullable Duration timeout - ) { - this.queryParameters = queryParameters; - this.serverIndex = serverIndex; - this.timeout = timeout; - } - } - - public static class GetNullableRequest { - public UserloginGetQueryParameters.@Nullable QueryParametersMap queryParameters; - public RootServerInfo.@Nullable ServerIndex serverIndex; - public @Nullable Duration timeout; - } - - public interface SetterForServerIndex { - GetNullableRequest getInstance(); - T getBuilderAfterServerIndex(GetNullableRequest instance); - default T serverIndex(RootServerInfo.ServerIndex serverIndex) { - var instance = getInstance(); - instance.serverIndex = serverIndex; - return getBuilderAfterServerIndex(instance); - } - } - - public interface SetterForTimeout { - GetNullableRequest getInstance(); - T getBuilderAfterTimeout(GetNullableRequest instance); - default T timeout(Duration timeout) { - var instance = getInstance(); - instance.timeout = timeout; - return getBuilderAfterTimeout(instance); - } - } - - public interface SetterForQueryParameters { - GetNullableRequest getInstance(); - T getBuilderAfterQueryParameters(GetNullableRequest instance); - default T queryParameters(UserloginGetQueryParameters.QueryParametersMap queryParameters) { - var instance = getInstance(); - instance.queryParameters = queryParameters; - return getBuilderAfterQueryParameters(instance); - } - } - - public static class Get0RequestBuilder implements SetterForServerIndex, SetterForTimeout { - private final GetNullableRequest instance; - - public Get0RequestBuilder(GetNullableRequest instance) { - this.instance = instance; - } - - public GetRequest build() { - var queryParameters = instance.queryParameters; - if (queryParameters == null) { - throw new RuntimeException("invalid null value for required parameter"); - } - return new GetRequest( - queryParameters, - instance.serverIndex, - instance.timeout - ); - } - - public GetNullableRequest getInstance() { - return instance; - } - - public Get0RequestBuilder getBuilderAfterServerIndex(GetNullableRequest instance) { - return this; - } - - public Get0RequestBuilder getBuilderAfterTimeout(GetNullableRequest instance) { - return this; - } - } - public static class GetRequestBuilder implements SetterForQueryParameters { - private final GetNullableRequest instance; - - public GetRequestBuilder() { - this.instance = new GetNullableRequest(); - } - - public GetNullableRequest getInstance() { - return instance; - } - - public Get0RequestBuilder getBuilderAfterQueryParameters(GetNullableRequest instance) { - return new Get0RequestBuilder(instance); - } - } -} diff --git a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/userlogin/get/Parameters.kt b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/userlogin/get/Parameters.kt deleted file mode 100644 index 0e29f41858d..00000000000 --- a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/userlogin/get/Parameters.kt +++ /dev/null @@ -1,22 +0,0 @@ -package org.openapijsonschematools.client.paths.userlogin.get; - -import org.openapijsonschematools.client.paths.userlogin.get.parameters.Parameter0; -import org.openapijsonschematools.client.paths.userlogin.get.parameters.Parameter1; -import org.openapijsonschematools.client.parameter.QuerySerializer; - -import java.util.Map; -import java.util.AbstractMap; - -public class Parameters { - - public static class QueryParametersSerializer extends QuerySerializer { - public QueryParametersSerializer() { - super( - Map.ofEntries( - new AbstractMap.SimpleEntry<>("username", new Parameter0.Parameter01()), - new AbstractMap.SimpleEntry<>("password", new Parameter1.Parameter11()) - ) - ); - } - } -} diff --git a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/userlogin/get/UserloginGetQueryParameters.kt b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/userlogin/get/UserloginGetQueryParameters.kt deleted file mode 100644 index dba33bd9efc..00000000000 --- a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/userlogin/get/UserloginGetQueryParameters.kt +++ /dev/null @@ -1,255 +0,0 @@ -package org.openapijsonschematools.client.paths.userlogin.get; -import java.util.ArrayList; -import java.util.HashSet; -import java.util.LinkedHashMap; -import java.util.LinkedHashSet; -import java.util.List; -import java.util.Map; -import java.util.Objects; -import java.util.Set; -import org.checkerframework.checker.nullness.qual.Nullable; -import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags; -import org.openapijsonschematools.client.configurations.SchemaConfiguration; -import org.openapijsonschematools.client.exceptions.UnsetPropertyException; -import org.openapijsonschematools.client.exceptions.ValidationException; -import org.openapijsonschematools.client.paths.userlogin.get.parameters.parameter0.Schema0; -import org.openapijsonschematools.client.paths.userlogin.get.parameters.parameter1.Schema1; -import org.openapijsonschematools.client.schemas.AnyTypeJsonSchema; -import org.openapijsonschematools.client.schemas.GenericBuilder; -import org.openapijsonschematools.client.schemas.NotAnyTypeJsonSchema; -import org.openapijsonschematools.client.schemas.validation.FrozenMap; -import org.openapijsonschematools.client.schemas.validation.JsonSchema; -import org.openapijsonschematools.client.schemas.validation.JsonSchemaInfo; -import org.openapijsonschematools.client.schemas.validation.MapSchemaValidator; -import org.openapijsonschematools.client.schemas.validation.MapUtils; -import org.openapijsonschematools.client.schemas.validation.PathToSchemasMap; -import org.openapijsonschematools.client.schemas.validation.PropertyEntry; -import org.openapijsonschematools.client.schemas.validation.ValidationMetadata; - -public class UserloginGetQueryParameters { - // nest classes so all schemas and input/output classes can be public - - - public static class AdditionalProperties extends NotAnyTypeJsonSchema.NotAnyTypeJsonSchema1 { - // NotAnyTypeSchema - private static @Nullable AdditionalProperties instance = null; - public static AdditionalProperties getInstance() { - if (instance == null) { - instance = new AdditionalProperties(); - } - return instance; - } - } - - - public static class QueryParametersMap extends FrozenMap<@Nullable Object> { - protected QueryParametersMap(FrozenMap<@Nullable Object> m) { - super(m); - } - public static final Set requiredKeys = Set.of( - "password", - "username" - ); - public static final Set optionalKeys = Set.of(); - public static QueryParametersMap of(Map arg, SchemaConfiguration configuration) throws ValidationException { - return UserloginGetQueryParameters1.getInstance().validate(arg, configuration); - } - - public String password() { - @Nullable Object value = get("password"); - if (!(value instanceof String)) { - throw new RuntimeException("Invalid value stored for password"); - } - return (String) value; - } - - public String username() { - @Nullable Object value = get("username"); - if (!(value instanceof String)) { - throw new RuntimeException("Invalid value stored for username"); - } - return (String) value; - } - } - - public interface SetterForPassword { - Map getInstance(); - T getBuilderAfterPassword(Map instance); - - default T password(String value) { - var instance = getInstance(); - instance.put("password", value); - return getBuilderAfterPassword(instance); - } - } - - public interface SetterForUsername { - Map getInstance(); - T getBuilderAfterUsername(Map instance); - - default T username(String value) { - var instance = getInstance(); - instance.put("username", value); - return getBuilderAfterUsername(instance); - } - } - - public static class QueryParametersMap00Builder implements GenericBuilder> { - private final Map instance; - private static final Set knownKeys = Set.of( - "password", - "username" - ); - public Set getKnownKeys() { - return knownKeys; - } - public QueryParametersMap00Builder(Map instance) { - this.instance = instance; - } - public Map build() { - return instance; - } - } - - public static class QueryParametersMap01Builder implements SetterForUsername { - private final Map instance; - public QueryParametersMap01Builder(Map instance) { - this.instance = instance; - } - public Map getInstance() { - return instance; - } - public QueryParametersMap00Builder getBuilderAfterUsername(Map instance) { - return new QueryParametersMap00Builder(instance); - } - } - - public static class QueryParametersMap10Builder implements SetterForPassword { - private final Map instance; - public QueryParametersMap10Builder(Map instance) { - this.instance = instance; - } - public Map getInstance() { - return instance; - } - public QueryParametersMap00Builder getBuilderAfterPassword(Map instance) { - return new QueryParametersMap00Builder(instance); - } - } - - public static class QueryParametersMapBuilder implements SetterForPassword, SetterForUsername { - private final Map instance; - public QueryParametersMapBuilder() { - this.instance = new LinkedHashMap<>(); - } - public Map getInstance() { - return instance; - } - public QueryParametersMap01Builder getBuilderAfterPassword(Map instance) { - return new QueryParametersMap01Builder(instance); - } - public QueryParametersMap10Builder getBuilderAfterUsername(Map instance) { - return new QueryParametersMap10Builder(instance); - } - } - - - public sealed interface UserloginGetQueryParameters1Boxed permits UserloginGetQueryParameters1BoxedMap { - @Nullable Object getData(); - } - - public record UserloginGetQueryParameters1BoxedMap(QueryParametersMap data) implements UserloginGetQueryParameters1Boxed { - @Override - public @Nullable Object getData() { - return data; - } - } - - - public static class UserloginGetQueryParameters1 extends JsonSchema implements MapSchemaValidator { - private static @Nullable UserloginGetQueryParameters1 instance = null; - - protected UserloginGetQueryParameters1() { - super(new JsonSchemaInfo() - .type(Set.of(Map.class)) - .properties(Map.ofEntries( - new PropertyEntry("password", Schema1.Schema11.class), - new PropertyEntry("username", Schema0.Schema01.class) - )) - .required(Set.of( - "password", - "username" - )) - .additionalProperties(AdditionalProperties.class) - ); - } - - public static UserloginGetQueryParameters1 getInstance() { - if (instance == null) { - instance = new UserloginGetQueryParameters1(); - } - return instance; - } - - 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 RuntimeException("Invalid non-string key value"); - } - String propertyName = (String) entryKey; - List propertyPathToItem = new ArrayList<>(pathToItem); - propertyPathToItem.add(propertyName); - Object value = entry.getValue(); - LinkedHashMap, Nothing?> schemas = pathToSchemas.get(propertyPathToItem); - if (schemas == null) { - throw new RuntimeException("Validation result is invalid, schemas must exist for a pathToItem"); - } - JsonSchema propertySchema = schemas.entrySet().iterator().next().getKey(); - @Nullable Object propertyInstance = propertySchema.getNewInstance(value, propertyPathToItem, pathToSchemas); - properties.put(propertyName, propertyInstance); - } - FrozenMap<@Nullable Object> castProperties = new FrozenMap<>(properties); - return new QueryParametersMap(castProperties); - } - - 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); - SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().build())); - ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, new PathToSchemasMap(), new LinkedHashSet<>()); - PathToSchemasMap pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet); - return getNewInstance(castArg, validationMetadata.pathToItem(), pathToSchemasMap); - } - - - @Override - public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws 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"); - } - @Override - public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { - if (arg instanceof Map) { - return getNewInstance((Map) arg, pathToItem, pathToSchemas); - } - throw new RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); - } - @Override - public UserloginGetQueryParameters1BoxedMap validateAndBox(Map arg, SchemaConfiguration configuration) throws ValidationException { - return new UserloginGetQueryParameters1BoxedMap(validate(arg, configuration)); - } - @Override - public UserloginGetQueryParameters1Boxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { - 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"); - } - } - -} diff --git a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/userlogin/get/UserloginGetResponses.kt b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/userlogin/get/UserloginGetResponses.kt deleted file mode 100644 index 8e5613c7641..00000000000 --- a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/userlogin/get/UserloginGetResponses.kt +++ /dev/null @@ -1,67 +0,0 @@ -package org.openapijsonschematools.client.paths.userlogin.get; - -import org.openapijsonschematools.client.paths.userlogin.get.responses.UserloginGetCode200Response; -import org.openapijsonschematools.client.paths.userlogin.get.responses.code200response.UserloginGetCode200ResponseHeadersSchema; -import org.openapijsonschematools.client.paths.userlogin.get.responses.UserloginGetCode400Response; -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; -import org.checkerframework.checker.nullness.qual.Nullable; - -import java.net.http.HttpResponse; -import java.util.Map; -import java.util.AbstractMap; - -public class UserloginGetResponses { - public sealed interface EndpointResponse permits EndpointUserloginGetCode200Response {} - - public record EndpointUserloginGetCode200Response( - HttpResponse response, - UserloginGetCode200Response.SealedResponseBody body, - UserloginGetCode200ResponseHeadersSchema.UserloginGetCode200ResponseHeadersSchemaMap headers - ) implements EndpointResponse, ApiResponse{ - } - - public sealed interface StatusCodeResponseDeserializer permits StatusUserloginGetCode200ResponseDeserializer, StatusUserloginGetCode400ResponseDeserializer {} - - public static final class StatusUserloginGetCode200ResponseDeserializer extends UserloginGetCode200Response.UserloginGetCode200Response1 implements StatusCodeResponseDeserializer { - } - public static final class StatusUserloginGetCode400ResponseDeserializer extends UserloginGetCode400Response.UserloginGetCode400Response1 implements StatusCodeResponseDeserializer { - } - - public static final class UserloginGetResponses1 implements ResponsesDeserializer { - private final Map statusCodeToResponseDeserializer; - public UserloginGetResponses1() { - this.statusCodeToResponseDeserializer = Map.ofEntries( - new AbstractMap.SimpleEntry<>("200", new StatusUserloginGetCode200ResponseDeserializer()), - new AbstractMap.SimpleEntry<>("400", new StatusUserloginGetCode400ResponseDeserializer()) - ); - } - - 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) { - throw new ApiException( - "Invalid response statusCode="+statusCode+" has no response defined in the openapi document", - response - ); - } - if (statusCodeDeserializer instanceof StatusUserloginGetCode200ResponseDeserializer castDeserializer) { - var deserializedResponse = castDeserializer.deserialize(response, configuration); - return new EndpointUserloginGetCode200Response(response, deserializedResponse.body(), deserializedResponse.headers()); - } else { - StatusUserloginGetCode400ResponseDeserializer castDeserializer = (StatusUserloginGetCode400ResponseDeserializer) statusCodeDeserializer; - var deserializedResponse = castDeserializer.deserialize(response, configuration); - throw new UserloginGetCode400Response.ResponseApiException( - "Received error statusCode response from server", - response, - deserializedResponse - ); - } - } - } -} diff --git a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/userlogin/get/parameters/Parameter0.kt b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/userlogin/get/parameters/Parameter0.kt deleted file mode 100644 index db4b2c26b2e..00000000000 --- a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/userlogin/get/parameters/Parameter0.kt +++ /dev/null @@ -1,23 +0,0 @@ -package org.openapijsonschematools.client.paths.userlogin.get.parameters; - -import org.openapijsonschematools.client.parameter.ParameterStyle; -import org.openapijsonschematools.client.parameter.ParameterInType; -import org.openapijsonschematools.client.parameter.SchemaParameter; -import org.openapijsonschematools.client.paths.userlogin.get.parameters.parameter0.Schema0; - -public class Parameter0 { - - public static class Parameter01 extends SchemaParameter { - public Parameter01() { - super( - "username", - ParameterInType.QUERY, - true, - ParameterStyle.FORM, - true, - false, - Schema0.Schema01.getInstance() - ); - } - } -} diff --git a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/userlogin/get/parameters/Parameter1.kt b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/userlogin/get/parameters/Parameter1.kt deleted file mode 100644 index 958cf010fab..00000000000 --- a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/userlogin/get/parameters/Parameter1.kt +++ /dev/null @@ -1,23 +0,0 @@ -package org.openapijsonschematools.client.paths.userlogin.get.parameters; - -import org.openapijsonschematools.client.parameter.ParameterStyle; -import org.openapijsonschematools.client.parameter.ParameterInType; -import org.openapijsonschematools.client.parameter.SchemaParameter; -import org.openapijsonschematools.client.paths.userlogin.get.parameters.parameter1.Schema1; - -public class Parameter1 { - - public static class Parameter11 extends SchemaParameter { - public Parameter11() { - super( - "password", - ParameterInType.QUERY, - true, - ParameterStyle.FORM, - true, - false, - Schema1.Schema11.getInstance() - ); - } - } -} diff --git a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/userlogin/get/parameters/parameter0/Schema0.kt b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/userlogin/get/parameters/parameter0/Schema0.kt deleted file mode 100644 index 8450f67fc2b..00000000000 --- a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/userlogin/get/parameters/parameter0/Schema0.kt +++ /dev/null @@ -1,19 +0,0 @@ -package org.openapijsonschematools.client.paths.userlogin.get.parameters.parameter0; -import org.checkerframework.checker.nullness.qual.Nullable; -import org.openapijsonschematools.client.schemas.StringJsonSchema; - -public class Schema0 extends StringJsonSchema { - // nest classes so all schemas and input/output classes can be public - - - public static class Schema01 extends StringJsonSchema.StringJsonSchema1 { - private static @Nullable Schema01 instance = null; - public static Schema01 getInstance() { - if (instance == null) { - instance = new Schema01(); - } - return instance; - } - } - -} diff --git a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/userlogin/get/parameters/parameter1/Schema1.kt b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/userlogin/get/parameters/parameter1/Schema1.kt deleted file mode 100644 index 9eed3552b1f..00000000000 --- a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/userlogin/get/parameters/parameter1/Schema1.kt +++ /dev/null @@ -1,19 +0,0 @@ -package org.openapijsonschematools.client.paths.userlogin.get.parameters.parameter1; -import org.checkerframework.checker.nullness.qual.Nullable; -import org.openapijsonschematools.client.schemas.StringJsonSchema; - -public class Schema1 extends StringJsonSchema { - // nest classes so all schemas and input/output classes can be public - - - public static class Schema11 extends StringJsonSchema.StringJsonSchema1 { - private static @Nullable Schema11 instance = null; - public static Schema11 getInstance() { - if (instance == null) { - instance = new Schema11(); - } - return instance; - } - } - -} diff --git a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/userlogin/get/responses/UserloginGetCode200Response.kt b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/userlogin/get/responses/UserloginGetCode200Response.kt deleted file mode 100644 index e03383d6139..00000000000 --- a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/userlogin/get/responses/UserloginGetCode200Response.kt +++ /dev/null @@ -1,83 +0,0 @@ -package org.openapijsonschematools.client.paths.userlogin.get.responses; - -import org.openapijsonschematools.client.configurations.SchemaConfiguration; -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; -import org.openapijsonschematools.client.paths.userlogin.get.responses.code200response.UserloginGetCode200ResponseHeadersSchema; -import org.openapijsonschematools.client.paths.userlogin.get.responses.code200response.Headers; - -import java.util.AbstractMap; -import java.util.Map; -import java.net.http.HttpResponse; -import java.net.http.HttpHeaders; - -public class UserloginGetCode200Response { - public sealed interface SealedMediaType permits ApplicationxmlMediaType, ApplicationjsonMediaType {} - - public record ApplicationxmlMediaType(ApplicationxmlSchema.ApplicationxmlSchema1 schema) implements SealedMediaType, MediaType { - public ApplicationxmlMediaType() { - this(ApplicationxmlSchema.ApplicationxmlSchema1.getInstance()); - } - @Override - public Nothing? encoding() { - return null; - } - } - - public record ApplicationjsonMediaType(ApplicationjsonSchema.ApplicationjsonSchema1 schema) implements SealedMediaType, MediaType { - public ApplicationjsonMediaType() { - this(ApplicationjsonSchema.ApplicationjsonSchema1.getInstance()); - } - @Override - public Nothing? encoding() { - return null; - } - } - public sealed interface SealedResponseBody permits ApplicationxmlResponseBody, ApplicationjsonResponseBody {} - public record ApplicationxmlResponseBody(ApplicationxmlSchema.StringJsonSchema1Boxed body) implements SealedResponseBody { } - public record ApplicationjsonResponseBody(ApplicationjsonSchema.StringJsonSchema1Boxed body) implements SealedResponseBody { } - - public static class UserloginGetCode200Response1 extends ResponseDeserializer { - public UserloginGetCode200Response1() { - super( - Map.ofEntries( - new AbstractMap.SimpleEntry<>("application/xml", new ApplicationxmlMediaType()), - new AbstractMap.SimpleEntry<>("application/json", new ApplicationjsonMediaType()) - ) - ); - } - - @Override - 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 { - ApplicationjsonMediaType thisMediaType = (ApplicationjsonMediaType) mediaType; - var deserializedBody = deserializeBody(contentType, body, thisMediaType.schema(), configuration); - return new ApplicationjsonResponseBody(deserializedBody); - } - } - - @Override - protected UserloginGetCode200ResponseHeadersSchema.UserloginGetCode200ResponseHeadersSchemaMap getHeaders(HttpHeaders headers, SchemaConfiguration configuration) throws ValidationException, NotImplementedException { - return new Headers().deserialize(headers, configuration); - } - } - - @SuppressWarnings("serial") - public static class ResponseApiException extends ApiException { - public DeserializedHttpResponse deserializedResponse; - - public ResponseApiException(String s, HttpResponse response, DeserializedHttpResponse deserializedResponse) { - super(s, response); - this.deserializedResponse = deserializedResponse; - } - } -} diff --git a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/userlogin/get/responses/UserloginGetCode400Response.kt b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/userlogin/get/responses/UserloginGetCode400Response.kt deleted file mode 100644 index 22bfaaa2ddd..00000000000 --- a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/userlogin/get/responses/UserloginGetCode400Response.kt +++ /dev/null @@ -1,45 +0,0 @@ -package org.openapijsonschematools.client.paths.userlogin.get.responses; - -import org.openapijsonschematools.client.configurations.SchemaConfiguration; -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; -import java.net.http.HttpResponse; -import java.net.http.HttpHeaders; - -public class UserloginGetCode400Response { - - public static class UserloginGetCode400Response1 extends ResponseDeserializer { - public UserloginGetCode400Response1() { - super( - MapUtils.makeMap( - ) - ); - } - - @Override - protected Nothing? getBody(String contentType, Nothing? mediaType, byte[] body, SchemaConfiguration configuration) { - return null; - } - - @Override - protected Nothing? getHeaders(HttpHeaders headers, SchemaConfiguration configuration) { - return null; - } - } - - @SuppressWarnings("serial") - public static class ResponseApiException extends ApiException { - public DeserializedHttpResponse deserializedResponse; - - public ResponseApiException(String s, HttpResponse response, DeserializedHttpResponse deserializedResponse) { - super(s, response); - this.deserializedResponse = deserializedResponse; - } - } -} diff --git a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/userlogin/get/responses/code200response/Headers.kt b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/userlogin/get/responses/code200response/Headers.kt deleted file mode 100644 index 5c6b5922c54..00000000000 --- a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/userlogin/get/responses/code200response/Headers.kt +++ /dev/null @@ -1,26 +0,0 @@ -package org.openapijsonschematools.client.paths.userlogin.get.responses.code200response; - -import org.openapijsonschematools.client.response.HeadersDeserializer; -import org.openapijsonschematools.client.paths.userlogin.get.responses.code200response.headers.XRateLimit; -import org.openapijsonschematools.client.paths.userlogin.get.responses.code200response.headers.Int32; -import org.openapijsonschematools.client.paths.userlogin.get.responses.code200response.headers.XExpiresAfter; -import org.openapijsonschematools.client.paths.userlogin.get.responses.code200response.headers.Refcontentschemaheader; -import org.openapijsonschematools.client.paths.userlogin.get.responses.code200response.headers.NumberHeader; - -import java.util.Map; -import java.util.AbstractMap; - -public class Headers extends HeadersDeserializer { - public Headers() { - super( - Map.ofEntries( - new AbstractMap.SimpleEntry<>("X-Rate-Limit", new XRateLimit.XRateLimit1()), - new AbstractMap.SimpleEntry<>("int32", new Int32.Int321()), - new AbstractMap.SimpleEntry<>("X-Expires-After", new XExpiresAfter.XExpiresAfter1()), - new AbstractMap.SimpleEntry<>("ref-content-schema-header", new Refcontentschemaheader.Refcontentschemaheader1()), - new AbstractMap.SimpleEntry<>("numberHeader", new NumberHeader.NumberHeader1()) - ), - UserloginGetCode200ResponseHeadersSchema.UserloginGetCode200ResponseHeadersSchema1.getInstance() - ); - } -} \ No newline at end of file diff --git a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/userlogin/get/responses/code200response/UserloginGetCode200ResponseHeadersSchema.kt b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/userlogin/get/responses/code200response/UserloginGetCode200ResponseHeadersSchema.kt deleted file mode 100644 index 6a846409e2d..00000000000 --- a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/userlogin/get/responses/code200response/UserloginGetCode200ResponseHeadersSchema.kt +++ /dev/null @@ -1,389 +0,0 @@ -package org.openapijsonschematools.client.paths.userlogin.get.responses.code200response; -import java.util.ArrayList; -import java.util.HashSet; -import java.util.LinkedHashMap; -import java.util.LinkedHashSet; -import java.util.List; -import java.util.Map; -import java.util.Objects; -import java.util.Set; -import org.checkerframework.checker.nullness.qual.Nullable; -import org.openapijsonschematools.client.components.headers.int32jsoncontenttypeheader.content.applicationjson.Int32JsonContentTypeHeaderSchema; -import org.openapijsonschematools.client.components.headers.numberheader.NumberHeaderSchema; -import org.openapijsonschematools.client.components.schemas.StringWithValidation; -import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags; -import org.openapijsonschematools.client.configurations.SchemaConfiguration; -import org.openapijsonschematools.client.exceptions.UnsetPropertyException; -import org.openapijsonschematools.client.exceptions.ValidationException; -import org.openapijsonschematools.client.paths.userlogin.get.responses.code200response.headers.xexpiresafter.XExpiresAfterSchema; -import org.openapijsonschematools.client.paths.userlogin.get.responses.code200response.headers.xratelimit.content.applicationjson.XRateLimitSchema; -import org.openapijsonschematools.client.schemas.AnyTypeJsonSchema; -import org.openapijsonschematools.client.schemas.GenericBuilder; -import org.openapijsonschematools.client.schemas.NotAnyTypeJsonSchema; -import org.openapijsonschematools.client.schemas.validation.FrozenMap; -import org.openapijsonschematools.client.schemas.validation.JsonSchema; -import org.openapijsonschematools.client.schemas.validation.JsonSchemaInfo; -import org.openapijsonschematools.client.schemas.validation.MapSchemaValidator; -import org.openapijsonschematools.client.schemas.validation.MapUtils; -import org.openapijsonschematools.client.schemas.validation.PathToSchemasMap; -import org.openapijsonschematools.client.schemas.validation.PropertyEntry; -import org.openapijsonschematools.client.schemas.validation.ValidationMetadata; - -public class UserloginGetCode200ResponseHeadersSchema { - // nest classes so all schemas and input/output classes can be public - - - public static class UserloginGetCode200ResponseAdditionalProperties extends NotAnyTypeJsonSchema.NotAnyTypeJsonSchema1 { - // NotAnyTypeSchema - private static @Nullable UserloginGetCode200ResponseAdditionalProperties instance = null; - public static UserloginGetCode200ResponseAdditionalProperties getInstance() { - if (instance == null) { - instance = new UserloginGetCode200ResponseAdditionalProperties(); - } - return instance; - } - } - - - public static class UserloginGetCode200ResponseHeadersSchemaMap extends FrozenMap<@Nullable Object> { - protected UserloginGetCode200ResponseHeadersSchemaMap(FrozenMap<@Nullable Object> m) { - super(m); - } - public static final Set requiredKeys = Set.of( - "X-Rate-Limit", - "int32", - "ref-content-schema-header" - ); - public static final Set optionalKeys = Set.of( - "X-Expires-After", - "numberHeader" - ); - public static UserloginGetCode200ResponseHeadersSchemaMap of(Map arg, SchemaConfiguration configuration) throws ValidationException { - return UserloginGetCode200ResponseHeadersSchema1.getInstance().validate(arg, configuration); - } - - public Number int32() { - @Nullable Object value = get("int32"); - if (!(value instanceof Number)) { - throw new RuntimeException("Invalid value stored for int32"); - } - return (Number) value; - } - - public String numberHeader() throws UnsetPropertyException { - String key = "numberHeader"; - throwIfKeyNotPresent(key); - @Nullable Object value = get(key); - if (!(value instanceof String)) { - throw new RuntimeException("Invalid value stored for numberHeader"); - } - return (String) value; - } - } - - public interface SetterForUserloginGetCode200ResponseXRateLimit { - Map getInstance(); - T getBuilderAfterUserloginGetCode200ResponseXRateLimit(Map instance); - - default T xHyphenMinusRateHyphenMinusLimit(int value) { - var instance = getInstance(); - instance.put("X-Rate-Limit", value); - return getBuilderAfterUserloginGetCode200ResponseXRateLimit(instance); - } - - default T xHyphenMinusRateHyphenMinusLimit(float value) { - var instance = getInstance(); - instance.put("X-Rate-Limit", value); - return getBuilderAfterUserloginGetCode200ResponseXRateLimit(instance); - } - } - - public interface SetterForUserloginGetCode200ResponseInt32 { - Map getInstance(); - T getBuilderAfterUserloginGetCode200ResponseInt32(Map instance); - - default T int32(int value) { - var instance = getInstance(); - instance.put("int32", value); - return getBuilderAfterUserloginGetCode200ResponseInt32(instance); - } - - default T int32(float value) { - var instance = getInstance(); - instance.put("int32", value); - return getBuilderAfterUserloginGetCode200ResponseInt32(instance); - } - } - - public interface SetterForUserloginGetCode200ResponseRefcontentschemaheader { - Map getInstance(); - T getBuilderAfterUserloginGetCode200ResponseRefcontentschemaheader(Map instance); - - default T refHyphenMinusContentHyphenMinusSchemaHyphenMinusHeader(String value) { - var instance = getInstance(); - instance.put("ref-content-schema-header", value); - return getBuilderAfterUserloginGetCode200ResponseRefcontentschemaheader(instance); - } - } - - public interface SetterForUserloginGetCode200ResponseXExpiresAfter { - Map getInstance(); - T getBuilderAfterUserloginGetCode200ResponseXExpiresAfter(Map instance); - - default T xHyphenMinusExpiresHyphenMinusAfter(String value) { - var instance = getInstance(); - instance.put("X-Expires-After", value); - return getBuilderAfterUserloginGetCode200ResponseXExpiresAfter(instance); - } - } - - public interface SetterForUserloginGetCode200ResponseNumberHeader { - Map getInstance(); - T getBuilderAfterUserloginGetCode200ResponseNumberHeader(Map instance); - - default T numberHeader(String value) { - var instance = getInstance(); - instance.put("numberHeader", value); - return getBuilderAfterUserloginGetCode200ResponseNumberHeader(instance); - } - } - - public static class UserloginGetCode200ResponseHeadersSchemaMap000Builder implements GenericBuilder>, SetterForUserloginGetCode200ResponseXExpiresAfter, SetterForUserloginGetCode200ResponseNumberHeader { - private final Map instance; - private static final Set knownKeys = Set.of( - "X-Rate-Limit", - "int32", - "ref-content-schema-header", - "X-Expires-After", - "numberHeader" - ); - public Set getKnownKeys() { - return knownKeys; - } - public UserloginGetCode200ResponseHeadersSchemaMap000Builder(Map instance) { - this.instance = instance; - } - public Map build() { - return instance; - } - public Map getInstance() { - return instance; - } - public UserloginGetCode200ResponseHeadersSchemaMap000Builder getBuilderAfterUserloginGetCode200ResponseXExpiresAfter(Map instance) { - return this; - } - public UserloginGetCode200ResponseHeadersSchemaMap000Builder getBuilderAfterUserloginGetCode200ResponseNumberHeader(Map instance) { - return this; - } - } - - public static class UserloginGetCode200ResponseHeadersSchemaMap001Builder implements SetterForUserloginGetCode200ResponseRefcontentschemaheader { - private final Map instance; - public UserloginGetCode200ResponseHeadersSchemaMap001Builder(Map instance) { - this.instance = instance; - } - public Map getInstance() { - return instance; - } - public UserloginGetCode200ResponseHeadersSchemaMap000Builder getBuilderAfterUserloginGetCode200ResponseRefcontentschemaheader(Map instance) { - return new UserloginGetCode200ResponseHeadersSchemaMap000Builder(instance); - } - } - - public static class UserloginGetCode200ResponseHeadersSchemaMap010Builder implements SetterForUserloginGetCode200ResponseInt32 { - private final Map instance; - public UserloginGetCode200ResponseHeadersSchemaMap010Builder(Map instance) { - this.instance = instance; - } - public Map getInstance() { - return instance; - } - public UserloginGetCode200ResponseHeadersSchemaMap000Builder getBuilderAfterUserloginGetCode200ResponseInt32(Map instance) { - return new UserloginGetCode200ResponseHeadersSchemaMap000Builder(instance); - } - } - - public static class UserloginGetCode200ResponseHeadersSchemaMap011Builder implements SetterForUserloginGetCode200ResponseInt32, SetterForUserloginGetCode200ResponseRefcontentschemaheader { - private final Map instance; - public UserloginGetCode200ResponseHeadersSchemaMap011Builder(Map instance) { - this.instance = instance; - } - public Map getInstance() { - return instance; - } - public UserloginGetCode200ResponseHeadersSchemaMap001Builder getBuilderAfterUserloginGetCode200ResponseInt32(Map instance) { - return new UserloginGetCode200ResponseHeadersSchemaMap001Builder(instance); - } - public UserloginGetCode200ResponseHeadersSchemaMap010Builder getBuilderAfterUserloginGetCode200ResponseRefcontentschemaheader(Map instance) { - return new UserloginGetCode200ResponseHeadersSchemaMap010Builder(instance); - } - } - - public static class UserloginGetCode200ResponseHeadersSchemaMap100Builder implements SetterForUserloginGetCode200ResponseXRateLimit { - private final Map instance; - public UserloginGetCode200ResponseHeadersSchemaMap100Builder(Map instance) { - this.instance = instance; - } - public Map getInstance() { - return instance; - } - public UserloginGetCode200ResponseHeadersSchemaMap000Builder getBuilderAfterUserloginGetCode200ResponseXRateLimit(Map instance) { - return new UserloginGetCode200ResponseHeadersSchemaMap000Builder(instance); - } - } - - public static class UserloginGetCode200ResponseHeadersSchemaMap101Builder implements SetterForUserloginGetCode200ResponseXRateLimit, SetterForUserloginGetCode200ResponseRefcontentschemaheader { - private final Map instance; - public UserloginGetCode200ResponseHeadersSchemaMap101Builder(Map instance) { - this.instance = instance; - } - public Map getInstance() { - return instance; - } - public UserloginGetCode200ResponseHeadersSchemaMap001Builder getBuilderAfterUserloginGetCode200ResponseXRateLimit(Map instance) { - return new UserloginGetCode200ResponseHeadersSchemaMap001Builder(instance); - } - public UserloginGetCode200ResponseHeadersSchemaMap100Builder getBuilderAfterUserloginGetCode200ResponseRefcontentschemaheader(Map instance) { - return new UserloginGetCode200ResponseHeadersSchemaMap100Builder(instance); - } - } - - public static class UserloginGetCode200ResponseHeadersSchemaMap110Builder implements SetterForUserloginGetCode200ResponseXRateLimit, SetterForUserloginGetCode200ResponseInt32 { - private final Map instance; - public UserloginGetCode200ResponseHeadersSchemaMap110Builder(Map instance) { - this.instance = instance; - } - public Map getInstance() { - return instance; - } - public UserloginGetCode200ResponseHeadersSchemaMap010Builder getBuilderAfterUserloginGetCode200ResponseXRateLimit(Map instance) { - return new UserloginGetCode200ResponseHeadersSchemaMap010Builder(instance); - } - public UserloginGetCode200ResponseHeadersSchemaMap100Builder getBuilderAfterUserloginGetCode200ResponseInt32(Map instance) { - return new UserloginGetCode200ResponseHeadersSchemaMap100Builder(instance); - } - } - - public static class UserloginGetCode200ResponseHeadersSchemaMapBuilder implements SetterForUserloginGetCode200ResponseXRateLimit, SetterForUserloginGetCode200ResponseInt32, SetterForUserloginGetCode200ResponseRefcontentschemaheader { - private final Map instance; - public UserloginGetCode200ResponseHeadersSchemaMapBuilder() { - this.instance = new LinkedHashMap<>(); - } - public Map getInstance() { - return instance; - } - public UserloginGetCode200ResponseHeadersSchemaMap011Builder getBuilderAfterUserloginGetCode200ResponseXRateLimit(Map instance) { - return new UserloginGetCode200ResponseHeadersSchemaMap011Builder(instance); - } - public UserloginGetCode200ResponseHeadersSchemaMap101Builder getBuilderAfterUserloginGetCode200ResponseInt32(Map instance) { - return new UserloginGetCode200ResponseHeadersSchemaMap101Builder(instance); - } - public UserloginGetCode200ResponseHeadersSchemaMap110Builder getBuilderAfterUserloginGetCode200ResponseRefcontentschemaheader(Map instance) { - return new UserloginGetCode200ResponseHeadersSchemaMap110Builder(instance); - } - } - - - public sealed interface UserloginGetCode200ResponseHeadersSchema1Boxed permits UserloginGetCode200ResponseHeadersSchema1BoxedMap { - @Nullable Object getData(); - } - - public record UserloginGetCode200ResponseHeadersSchema1BoxedMap(UserloginGetCode200ResponseHeadersSchemaMap data) implements UserloginGetCode200ResponseHeadersSchema1Boxed { - @Override - public @Nullable Object getData() { - return data; - } - } - - - public static class UserloginGetCode200ResponseHeadersSchema1 extends JsonSchema implements MapSchemaValidator { - private static @Nullable UserloginGetCode200ResponseHeadersSchema1 instance = null; - - protected UserloginGetCode200ResponseHeadersSchema1() { - super(new JsonSchemaInfo() - .type(Set.of(Map.class)) - .properties(Map.ofEntries( - new PropertyEntry("X-Rate-Limit", XRateLimitSchema.XRateLimitSchema1.class), - new PropertyEntry("int32", Int32JsonContentTypeHeaderSchema.Int32JsonContentTypeHeaderSchema1.class), - new PropertyEntry("X-Expires-After", XExpiresAfterSchema.XExpiresAfterSchema1.class), - new PropertyEntry("ref-content-schema-header", StringWithValidation.StringWithValidation1.class), - new PropertyEntry("numberHeader", NumberHeaderSchema.NumberHeaderSchema1.class) - )) - .required(Set.of( - "X-Rate-Limit", - "int32", - "ref-content-schema-header" - )) - .additionalProperties(UserloginGetCode200ResponseAdditionalProperties.class) - ); - } - - public static UserloginGetCode200ResponseHeadersSchema1 getInstance() { - if (instance == null) { - instance = new UserloginGetCode200ResponseHeadersSchema1(); - } - return instance; - } - - public UserloginGetCode200ResponseHeadersSchemaMap 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 RuntimeException("Invalid non-string key value"); - } - String propertyName = (String) entryKey; - List propertyPathToItem = new ArrayList<>(pathToItem); - propertyPathToItem.add(propertyName); - Object value = entry.getValue(); - LinkedHashMap, Nothing?> schemas = pathToSchemas.get(propertyPathToItem); - if (schemas == null) { - throw new RuntimeException("Validation result is invalid, schemas must exist for a pathToItem"); - } - JsonSchema propertySchema = schemas.entrySet().iterator().next().getKey(); - @Nullable Object propertyInstance = propertySchema.getNewInstance(value, propertyPathToItem, pathToSchemas); - properties.put(propertyName, propertyInstance); - } - FrozenMap<@Nullable Object> castProperties = new FrozenMap<>(properties); - return new UserloginGetCode200ResponseHeadersSchemaMap(castProperties); - } - - public UserloginGetCode200ResponseHeadersSchemaMap validate(Map arg, SchemaConfiguration configuration) throws ValidationException { - Set> pathSet = new HashSet<>(); - List pathToItem = List.of("args[0"); - Map castArg = castToAllowedTypes(arg, pathToItem, pathSet); - SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().build())); - ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, new PathToSchemasMap(), new LinkedHashSet<>()); - PathToSchemasMap pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet); - return getNewInstance(castArg, validationMetadata.pathToItem(), pathToSchemasMap); - } - - - @Override - public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws 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"); - } - @Override - public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { - if (arg instanceof Map) { - return getNewInstance((Map) arg, pathToItem, pathToSchemas); - } - throw new RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); - } - @Override - public UserloginGetCode200ResponseHeadersSchema1BoxedMap validateAndBox(Map arg, SchemaConfiguration configuration) throws ValidationException { - return new UserloginGetCode200ResponseHeadersSchema1BoxedMap(validate(arg, configuration)); - } - @Override - public UserloginGetCode200ResponseHeadersSchema1Boxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { - 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"); - } - } - -} diff --git a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/userlogin/get/responses/code200response/content/applicationjson/ApplicationjsonSchema.kt b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/userlogin/get/responses/code200response/content/applicationjson/ApplicationjsonSchema.kt deleted file mode 100644 index 93f4ea3148c..00000000000 --- a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/userlogin/get/responses/code200response/content/applicationjson/ApplicationjsonSchema.kt +++ /dev/null @@ -1,19 +0,0 @@ -package org.openapijsonschematools.client.paths.userlogin.get.responses.code200response.content.applicationjson; -import org.checkerframework.checker.nullness.qual.Nullable; -import org.openapijsonschematools.client.schemas.StringJsonSchema; - -public class ApplicationjsonSchema extends StringJsonSchema { - // nest classes so all schemas and input/output classes can be public - - - public static class ApplicationjsonSchema1 extends StringJsonSchema.StringJsonSchema1 { - private static @Nullable ApplicationjsonSchema1 instance = null; - public static ApplicationjsonSchema1 getInstance() { - if (instance == null) { - instance = new ApplicationjsonSchema1(); - } - return instance; - } - } - -} diff --git a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/userlogin/get/responses/code200response/content/applicationxml/ApplicationxmlSchema.kt b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/userlogin/get/responses/code200response/content/applicationxml/ApplicationxmlSchema.kt deleted file mode 100644 index 557f1fbe8d1..00000000000 --- a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/userlogin/get/responses/code200response/content/applicationxml/ApplicationxmlSchema.kt +++ /dev/null @@ -1,19 +0,0 @@ -package org.openapijsonschematools.client.paths.userlogin.get.responses.code200response.content.applicationxml; -import org.checkerframework.checker.nullness.qual.Nullable; -import org.openapijsonschematools.client.schemas.StringJsonSchema; - -public class ApplicationxmlSchema extends StringJsonSchema { - // nest classes so all schemas and input/output classes can be public - - - public static class ApplicationxmlSchema1 extends StringJsonSchema.StringJsonSchema1 { - private static @Nullable ApplicationxmlSchema1 instance = null; - public static ApplicationxmlSchema1 getInstance() { - if (instance == null) { - instance = new ApplicationxmlSchema1(); - } - return instance; - } - } - -} diff --git a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/userlogin/get/responses/code200response/headers/Int32.kt b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/userlogin/get/responses/code200response/headers/Int32.kt deleted file mode 100644 index e58a6bc7a89..00000000000 --- a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/userlogin/get/responses/code200response/headers/Int32.kt +++ /dev/null @@ -1,7 +0,0 @@ -package org.openapijsonschematools.client.paths.userlogin.get.responses.code200response.headers; - -import org.openapijsonschematools.client.components.headers.Int32JsonContentTypeHeader; - -public class Int32 extends Int32JsonContentTypeHeader { - public static class Int321 extends Int32JsonContentTypeHeader1 {} -} diff --git a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/userlogin/get/responses/code200response/headers/NumberHeader.kt b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/userlogin/get/responses/code200response/headers/NumberHeader.kt deleted file mode 100644 index 32207ae7232..00000000000 --- a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/userlogin/get/responses/code200response/headers/NumberHeader.kt +++ /dev/null @@ -1,3 +0,0 @@ -package org.openapijsonschematools.client.paths.userlogin.get.responses.code200response.headers; - -public class NumberHeader extends org.openapijsonschematools.client.components.headers.NumberHeader {} diff --git a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/userlogin/get/responses/code200response/headers/Refcontentschemaheader.kt b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/userlogin/get/responses/code200response/headers/Refcontentschemaheader.kt deleted file mode 100644 index 2e61fb18770..00000000000 --- a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/userlogin/get/responses/code200response/headers/Refcontentschemaheader.kt +++ /dev/null @@ -1,7 +0,0 @@ -package org.openapijsonschematools.client.paths.userlogin.get.responses.code200response.headers; - -import org.openapijsonschematools.client.components.headers.RefContentSchemaHeader; - -public class Refcontentschemaheader extends RefContentSchemaHeader { - public static class Refcontentschemaheader1 extends RefContentSchemaHeader1 {} -} diff --git a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/userlogin/get/responses/code200response/headers/XExpiresAfter.kt b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/userlogin/get/responses/code200response/headers/XExpiresAfter.kt deleted file mode 100644 index 16c17845941..00000000000 --- a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/userlogin/get/responses/code200response/headers/XExpiresAfter.kt +++ /dev/null @@ -1,18 +0,0 @@ -package org.openapijsonschematools.client.paths.userlogin.get.responses.code200response.headers; - -import org.openapijsonschematools.client.header.SchemaHeader; -import org.openapijsonschematools.client.paths.userlogin.get.responses.code200response.headers.xexpiresafter.XExpiresAfterSchema; - -public class XExpiresAfter { - - public static class XExpiresAfter1 extends SchemaHeader { - public XExpiresAfter1() { - super( - false, - null, - false, - XExpiresAfterSchema.XExpiresAfterSchema1.getInstance() - ); - } - } -} diff --git a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/userlogin/get/responses/code200response/headers/XRateLimit.kt b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/userlogin/get/responses/code200response/headers/XRateLimit.kt deleted file mode 100644 index d239bf7a481..00000000000 --- a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/userlogin/get/responses/code200response/headers/XRateLimit.kt +++ /dev/null @@ -1,31 +0,0 @@ -package org.openapijsonschematools.client.paths.userlogin.get.responses.code200response.headers; - -import org.openapijsonschematools.client.header.ContentHeader; -import org.openapijsonschematools.client.mediatype.MediaType; -import org.openapijsonschematools.client.paths.userlogin.get.responses.code200response.headers.xratelimit.content.applicationjson.XRateLimitSchema; - -import java.util.AbstractMap; - -public class XRateLimit { - - public record ApplicationjsonMediaType(XRateLimitSchema.XRateLimitSchema1 schema) implements MediaType { - public ApplicationjsonMediaType() { - this(XRateLimitSchema.XRateLimitSchema1.getInstance()); - } - @Override - public Nothing? encoding() { - return null; - } - } - - public static class XRateLimit1 extends ContentHeader { - public XRateLimit1() { - super( - true, - null, - false, - new AbstractMap.SimpleEntry<>("application/json", new ApplicationjsonMediaType()) - ); - } - } -} diff --git a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/userlogin/get/responses/code200response/headers/xexpiresafter/XExpiresAfterSchema.kt b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/userlogin/get/responses/code200response/headers/xexpiresafter/XExpiresAfterSchema.kt deleted file mode 100644 index 13ec38f4440..00000000000 --- a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/userlogin/get/responses/code200response/headers/xexpiresafter/XExpiresAfterSchema.kt +++ /dev/null @@ -1,19 +0,0 @@ -package org.openapijsonschematools.client.paths.userlogin.get.responses.code200response.headers.xexpiresafter; -import org.checkerframework.checker.nullness.qual.Nullable; -import org.openapijsonschematools.client.schemas.DateTimeJsonSchema; - -public class XExpiresAfterSchema extends DateTimeJsonSchema { - // nest classes so all schemas and input/output classes can be public - - - public static class XExpiresAfterSchema1 extends DateTimeJsonSchema.DateTimeJsonSchema1 { - private static @Nullable XExpiresAfterSchema1 instance = null; - public static XExpiresAfterSchema1 getInstance() { - if (instance == null) { - instance = new XExpiresAfterSchema1(); - } - return instance; - } - } - -} diff --git a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/userlogin/get/responses/code200response/headers/xratelimit/content/applicationjson/XRateLimitSchema.kt b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/userlogin/get/responses/code200response/headers/xratelimit/content/applicationjson/XRateLimitSchema.kt deleted file mode 100644 index 9ce160e834c..00000000000 --- a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/userlogin/get/responses/code200response/headers/xratelimit/content/applicationjson/XRateLimitSchema.kt +++ /dev/null @@ -1,19 +0,0 @@ -package org.openapijsonschematools.client.paths.userlogin.get.responses.code200response.headers.xratelimit.content.applicationjson; -import org.checkerframework.checker.nullness.qual.Nullable; -import org.openapijsonschematools.client.schemas.Int32JsonSchema; - -public class XRateLimitSchema extends Int32JsonSchema { - // nest classes so all schemas and input/output classes can be public - - - public static class XRateLimitSchema1 extends Int32JsonSchema.Int32JsonSchema1 { - private static @Nullable XRateLimitSchema1 instance = null; - public static XRateLimitSchema1 getInstance() { - if (instance == null) { - instance = new XRateLimitSchema1(); - } - return instance; - } - } - -} diff --git a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/userlogout/UserlogoutGet.kt b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/userlogout/UserlogoutGet.kt deleted file mode 100644 index b55850dcc33..00000000000 --- a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/userlogout/UserlogoutGet.kt +++ /dev/null @@ -1,124 +0,0 @@ -package org.openapijsonschematools.client.paths.userlogout; - -import org.checkerframework.checker.nullness.qual.Nullable; -import org.openapijsonschematools.client.RootServerInfo; -import org.openapijsonschematools.client.paths.userlogout.get.UserlogoutGetResponses; -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.paths.Userlogout; - -import java.io.IOException; -import java.net.http.HttpClient; -import java.net.http.HttpRequest; -import java.time.Duration; -import java.util.List; -import java.util.Map; - -public class UserlogoutGet { - private static class GetProvider { - private static final String method = "get"; - - public static UserlogoutGetResponses.EndpointResponse get( - GetRequest request, - ApiConfiguration apiConfiguration, - SchemaConfiguration schemaConfiguration, - HttpClient client - ) 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 - @Nullable Map queryMap = null; - String host = apiConfiguration.getServer(request.serverIndex).url(); - - String url = host + Userlogout.path; - var httpRequest = RestClient.getRequest( - url, - method, - bodyPublisher, - headers, - request.timeout - ); - var response = RestClient.getResponse(httpRequest, client); - var responsesDeserializer = new UserlogoutGetResponses.UserlogoutGetResponses1(); - return responsesDeserializer.deserialize(response, schemaConfiguration); - } - } - - public interface GetOperation { - ApiConfiguration getApiConfiguration(); - SchemaConfiguration getSchemaConfiguration(); - HttpClient getClient(); - default UserlogoutGetResponses.EndpointResponse get(GetRequest request) throws IOException, InterruptedException, ValidationException, NotImplementedException, ApiException { - return GetProvider.get(request, getApiConfiguration(), getSchemaConfiguration(), getClient()); - } - } - - public interface LogoutUserOperation { - ApiConfiguration getApiConfiguration(); - SchemaConfiguration getSchemaConfiguration(); - HttpClient getClient(); - default UserlogoutGetResponses.EndpointResponse logoutUser(GetRequest request) throws IOException, InterruptedException, ValidationException, NotImplementedException, ApiException { - return GetProvider.get(request, getApiConfiguration(), getSchemaConfiguration(), getClient()); - } - } - - public static class Get extends ApiClient implements GetOperation { - public Get(ApiConfiguration apiConfiguration, SchemaConfiguration schemaConfiguration) { - super(apiConfiguration, schemaConfiguration); - } - } - - public static class GetRequest { - public RootServerInfo.@Nullable ServerIndex serverIndex; - public @Nullable Duration timeout; - } - - public interface SetterForServerIndex { - GetRequest getInstance(); - T getBuilderAfterServerIndex(GetRequest instance); - default T serverIndex(RootServerInfo.ServerIndex serverIndex) { - var instance = getInstance(); - instance.serverIndex = serverIndex; - return getBuilderAfterServerIndex(instance); - } - } - - public interface SetterForTimeout { - GetRequest getInstance(); - T getBuilderAfterTimeout(GetRequest instance); - default T timeout(Duration timeout) { - var instance = getInstance(); - instance.timeout = timeout; - return getBuilderAfterTimeout(instance); - } - } - - public static class GetRequestBuilder implements SetterForServerIndex, SetterForTimeout { - private final GetRequest instance; - - public GetRequestBuilder() { - this.instance = new GetRequest(); - } - - public GetRequest build() { - return instance; - } - - public GetRequest getInstance() { - return instance; - } - - public GetRequestBuilder getBuilderAfterServerIndex(GetRequest instance) { - return this; - } - - public GetRequestBuilder getBuilderAfterTimeout(GetRequest instance) { - return this; - } - } -} diff --git a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/userlogout/get/UserlogoutGetResponses.kt b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/userlogout/get/UserlogoutGetResponses.kt deleted file mode 100644 index 7f25fa19019..00000000000 --- a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/userlogout/get/UserlogoutGetResponses.kt +++ /dev/null @@ -1,37 +0,0 @@ -package org.openapijsonschematools.client.paths.userlogout.get; - -import org.openapijsonschematools.client.paths.userlogout.get.responses.UserlogoutGetCodedefaultResponse; -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; -import org.checkerframework.checker.nullness.qual.Nullable; - -import java.net.http.HttpResponse; -import java.util.Map; -import java.util.AbstractMap; - -public class UserlogoutGetResponses { - public sealed interface EndpointResponse permits EndpointUserlogoutGetCodedefaultResponse {} - - public record EndpointUserlogoutGetCodedefaultResponse( - HttpResponse response, - Nothing? body, - Nothing? headers - ) implements EndpointResponse, ApiResponse{ - } - - public static final class UserlogoutGetResponses1 implements ResponsesDeserializer { - private final UserlogoutGetCodedefaultResponse.UserlogoutGetCodedefaultResponse1 defaultResponseDeserializer; - public UserlogoutGetResponses1() { - this.defaultResponseDeserializer = new UserlogoutGetCodedefaultResponse.UserlogoutGetCodedefaultResponse1(); - } - - public EndpointResponse deserialize(HttpResponse response, SchemaConfiguration configuration) throws ValidationException, NotImplementedException, ApiException { - var deserializedResponse = defaultResponseDeserializer.deserialize(response, configuration); - return new EndpointUserlogoutGetCodedefaultResponse(response, deserializedResponse.body(), deserializedResponse.headers()); - } - } -} diff --git a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/userlogout/get/responses/UserlogoutGetCodedefaultResponse.kt b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/userlogout/get/responses/UserlogoutGetCodedefaultResponse.kt deleted file mode 100644 index 18fa2331b9a..00000000000 --- a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/userlogout/get/responses/UserlogoutGetCodedefaultResponse.kt +++ /dev/null @@ -1,7 +0,0 @@ -package org.openapijsonschematools.client.paths.userlogout.get.responses; - -import org.openapijsonschematools.client.components.responses.RefSuccessDescriptionOnly; - -public class UserlogoutGetCodedefaultResponse extends RefSuccessDescriptionOnly { - public static class UserlogoutGetCodedefaultResponse1 extends RefSuccessDescriptionOnly1 {} -} diff --git a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/userusername/UserusernameDelete.kt b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/userusername/UserusernameDelete.kt deleted file mode 100644 index 62d4bc7efe2..00000000000 --- a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/userusername/UserusernameDelete.kt +++ /dev/null @@ -1,179 +0,0 @@ -package org.openapijsonschematools.client.paths.userusername; - -import org.checkerframework.checker.nullness.qual.Nullable; -import org.openapijsonschematools.client.RootServerInfo; -import org.openapijsonschematools.client.paths.userusername.delete.UserusernameDeletePathParameters; -import org.openapijsonschematools.client.paths.userusername.delete.Parameters; -import org.openapijsonschematools.client.paths.userusername.delete.UserusernameDeleteResponses; -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.paths.Userusername; - -import java.io.IOException; -import java.net.http.HttpClient; -import java.net.http.HttpRequest; -import java.time.Duration; -import java.util.List; -import java.util.Map; - -public class UserusernameDelete { - private static class DeleteProvider { - private static final String method = "delete"; - - public static UserusernameDeleteResponses.EndpointResponse delete( - DeleteRequest request, - ApiConfiguration apiConfiguration, - SchemaConfiguration schemaConfiguration, - HttpClient client - ) throws IOException, InterruptedException, ValidationException, NotImplementedException, ApiException { - Map> headers = apiConfiguration.getDefaultHeaders(); - HttpRequest.BodyPublisher bodyPublisher = HttpRequest.BodyPublishers.noBody(); - - var pathSerializer = new Parameters.PathParametersSerializer(); - String updatedPath = pathSerializer.serialize(request.pathParameters, Userusername.path); - // TODO set this to a map if there is a query security scheme - @Nullable Map queryMap = null; - String host = apiConfiguration.getServer(request.serverIndex).url(); - - String url = host + updatedPath; - var httpRequest = RestClient.getRequest( - url, - method, - bodyPublisher, - headers, - request.timeout - ); - var response = RestClient.getResponse(httpRequest, client); - var responsesDeserializer = new UserusernameDeleteResponses.UserusernameDeleteResponses1(); - return responsesDeserializer.deserialize(response, schemaConfiguration); - } - } - - public interface DeleteOperation { - ApiConfiguration getApiConfiguration(); - SchemaConfiguration getSchemaConfiguration(); - HttpClient getClient(); - default UserusernameDeleteResponses.EndpointResponse delete(DeleteRequest request) throws IOException, InterruptedException, ValidationException, NotImplementedException, ApiException { - return DeleteProvider.delete(request, getApiConfiguration(), getSchemaConfiguration(), getClient()); - } - } - - public interface DeleteUserOperation { - ApiConfiguration getApiConfiguration(); - SchemaConfiguration getSchemaConfiguration(); - HttpClient getClient(); - default UserusernameDeleteResponses.EndpointResponse deleteUser(DeleteRequest request) throws IOException, InterruptedException, ValidationException, NotImplementedException, ApiException { - return DeleteProvider.delete(request, getApiConfiguration(), getSchemaConfiguration(), getClient()); - } - } - - public static class Delete extends ApiClient implements DeleteOperation { - public Delete(ApiConfiguration apiConfiguration, SchemaConfiguration schemaConfiguration) { - super(apiConfiguration, schemaConfiguration); - } - } - - public static class DeleteRequest { - public UserusernameDeletePathParameters.PathParametersMap pathParameters; - public RootServerInfo.@Nullable ServerIndex serverIndex; - public @Nullable Duration timeout; - - public DeleteRequest( - UserusernameDeletePathParameters.PathParametersMap pathParameters, - RootServerInfo.@Nullable ServerIndex serverIndex, - @Nullable Duration timeout - ) { - this.pathParameters = pathParameters; - this.serverIndex = serverIndex; - this.timeout = timeout; - } - } - - public static class DeleteNullableRequest { - public UserusernameDeletePathParameters.@Nullable PathParametersMap pathParameters; - public RootServerInfo.@Nullable ServerIndex serverIndex; - public @Nullable Duration timeout; - } - - public interface SetterForServerIndex { - DeleteNullableRequest getInstance(); - T getBuilderAfterServerIndex(DeleteNullableRequest instance); - default T serverIndex(RootServerInfo.ServerIndex serverIndex) { - var instance = getInstance(); - instance.serverIndex = serverIndex; - return getBuilderAfterServerIndex(instance); - } - } - - public interface SetterForTimeout { - DeleteNullableRequest getInstance(); - T getBuilderAfterTimeout(DeleteNullableRequest instance); - default T timeout(Duration timeout) { - var instance = getInstance(); - instance.timeout = timeout; - return getBuilderAfterTimeout(instance); - } - } - - public interface SetterForPathParameters { - DeleteNullableRequest getInstance(); - T getBuilderAfterPathParameters(DeleteNullableRequest instance); - default T pathParameters(UserusernameDeletePathParameters.PathParametersMap pathParameters) { - var instance = getInstance(); - instance.pathParameters = pathParameters; - return getBuilderAfterPathParameters(instance); - } - } - - public static class Delete0RequestBuilder implements SetterForServerIndex, SetterForTimeout { - private final DeleteNullableRequest instance; - - public Delete0RequestBuilder(DeleteNullableRequest instance) { - this.instance = instance; - } - - public DeleteRequest build() { - var pathParameters = instance.pathParameters; - if (pathParameters == null) { - throw new RuntimeException("invalid null value for required parameter"); - } - return new DeleteRequest( - pathParameters, - instance.serverIndex, - instance.timeout - ); - } - - public DeleteNullableRequest getInstance() { - return instance; - } - - public Delete0RequestBuilder getBuilderAfterServerIndex(DeleteNullableRequest instance) { - return this; - } - - public Delete0RequestBuilder getBuilderAfterTimeout(DeleteNullableRequest instance) { - return this; - } - } - public static class DeleteRequestBuilder implements SetterForPathParameters { - private final DeleteNullableRequest instance; - - public DeleteRequestBuilder() { - this.instance = new DeleteNullableRequest(); - } - - public DeleteNullableRequest getInstance() { - return instance; - } - - public Delete0RequestBuilder getBuilderAfterPathParameters(DeleteNullableRequest instance) { - return new Delete0RequestBuilder(instance); - } - } -} diff --git a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/userusername/UserusernameGet.kt b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/userusername/UserusernameGet.kt deleted file mode 100644 index 9f49051e830..00000000000 --- a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/userusername/UserusernameGet.kt +++ /dev/null @@ -1,179 +0,0 @@ -package org.openapijsonschematools.client.paths.userusername; - -import org.checkerframework.checker.nullness.qual.Nullable; -import org.openapijsonschematools.client.RootServerInfo; -import org.openapijsonschematools.client.paths.userusername.get.UserusernameGetPathParameters; -import org.openapijsonschematools.client.paths.userusername.get.Parameters; -import org.openapijsonschematools.client.paths.userusername.get.UserusernameGetResponses; -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.paths.Userusername; - -import java.io.IOException; -import java.net.http.HttpClient; -import java.net.http.HttpRequest; -import java.time.Duration; -import java.util.List; -import java.util.Map; - -public class UserusernameGet { - private static class GetProvider { - private static final String method = "get"; - - public static UserusernameGetResponses.EndpointResponse get( - GetRequest request, - ApiConfiguration apiConfiguration, - SchemaConfiguration schemaConfiguration, - HttpClient client - ) throws IOException, InterruptedException, ValidationException, NotImplementedException, ApiException { - Map> headers = apiConfiguration.getDefaultHeaders(); - HttpRequest.BodyPublisher bodyPublisher = HttpRequest.BodyPublishers.noBody(); - - var pathSerializer = new Parameters.PathParametersSerializer(); - String updatedPath = pathSerializer.serialize(request.pathParameters, Userusername.path); - // TODO set this to a map if there is a query security scheme - @Nullable Map queryMap = null; - String host = apiConfiguration.getServer(request.serverIndex).url(); - - String url = host + updatedPath; - var httpRequest = RestClient.getRequest( - url, - method, - bodyPublisher, - headers, - request.timeout - ); - var response = RestClient.getResponse(httpRequest, client); - var responsesDeserializer = new UserusernameGetResponses.UserusernameGetResponses1(); - return responsesDeserializer.deserialize(response, schemaConfiguration); - } - } - - public interface GetOperation { - ApiConfiguration getApiConfiguration(); - SchemaConfiguration getSchemaConfiguration(); - HttpClient getClient(); - default UserusernameGetResponses.EndpointResponse get(GetRequest request) throws IOException, InterruptedException, ValidationException, NotImplementedException, ApiException { - return GetProvider.get(request, getApiConfiguration(), getSchemaConfiguration(), getClient()); - } - } - - public interface GetUserByNameOperation { - ApiConfiguration getApiConfiguration(); - SchemaConfiguration getSchemaConfiguration(); - HttpClient getClient(); - default UserusernameGetResponses.EndpointResponse getUserByName(GetRequest request) throws IOException, InterruptedException, ValidationException, NotImplementedException, ApiException { - return GetProvider.get(request, getApiConfiguration(), getSchemaConfiguration(), getClient()); - } - } - - public static class Get extends ApiClient implements GetOperation { - public Get(ApiConfiguration apiConfiguration, SchemaConfiguration schemaConfiguration) { - super(apiConfiguration, schemaConfiguration); - } - } - - public static class GetRequest { - public UserusernameGetPathParameters.PathParametersMap pathParameters; - public RootServerInfo.@Nullable ServerIndex serverIndex; - public @Nullable Duration timeout; - - public GetRequest( - UserusernameGetPathParameters.PathParametersMap pathParameters, - RootServerInfo.@Nullable ServerIndex serverIndex, - @Nullable Duration timeout - ) { - this.pathParameters = pathParameters; - this.serverIndex = serverIndex; - this.timeout = timeout; - } - } - - public static class GetNullableRequest { - public UserusernameGetPathParameters.@Nullable PathParametersMap pathParameters; - public RootServerInfo.@Nullable ServerIndex serverIndex; - public @Nullable Duration timeout; - } - - public interface SetterForServerIndex { - GetNullableRequest getInstance(); - T getBuilderAfterServerIndex(GetNullableRequest instance); - default T serverIndex(RootServerInfo.ServerIndex serverIndex) { - var instance = getInstance(); - instance.serverIndex = serverIndex; - return getBuilderAfterServerIndex(instance); - } - } - - public interface SetterForTimeout { - GetNullableRequest getInstance(); - T getBuilderAfterTimeout(GetNullableRequest instance); - default T timeout(Duration timeout) { - var instance = getInstance(); - instance.timeout = timeout; - return getBuilderAfterTimeout(instance); - } - } - - public interface SetterForPathParameters { - GetNullableRequest getInstance(); - T getBuilderAfterPathParameters(GetNullableRequest instance); - default T pathParameters(UserusernameGetPathParameters.PathParametersMap pathParameters) { - var instance = getInstance(); - instance.pathParameters = pathParameters; - return getBuilderAfterPathParameters(instance); - } - } - - public static class Get0RequestBuilder implements SetterForServerIndex, SetterForTimeout { - private final GetNullableRequest instance; - - public Get0RequestBuilder(GetNullableRequest instance) { - this.instance = instance; - } - - public GetRequest build() { - var pathParameters = instance.pathParameters; - if (pathParameters == null) { - throw new RuntimeException("invalid null value for required parameter"); - } - return new GetRequest( - pathParameters, - instance.serverIndex, - instance.timeout - ); - } - - public GetNullableRequest getInstance() { - return instance; - } - - public Get0RequestBuilder getBuilderAfterServerIndex(GetNullableRequest instance) { - return this; - } - - public Get0RequestBuilder getBuilderAfterTimeout(GetNullableRequest instance) { - return this; - } - } - public static class GetRequestBuilder implements SetterForPathParameters { - private final GetNullableRequest instance; - - public GetRequestBuilder() { - this.instance = new GetNullableRequest(); - } - - public GetNullableRequest getInstance() { - return instance; - } - - public Get0RequestBuilder getBuilderAfterPathParameters(GetNullableRequest instance) { - return new Get0RequestBuilder(instance); - } - } -} diff --git a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/userusername/UserusernamePut.kt b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/userusername/UserusernamePut.kt deleted file mode 100644 index 0aba85a3cba..00000000000 --- a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/userusername/UserusernamePut.kt +++ /dev/null @@ -1,240 +0,0 @@ -package org.openapijsonschematools.client.paths.userusername; - -import org.checkerframework.checker.nullness.qual.Nullable; -import org.openapijsonschematools.client.RootServerInfo; -import org.openapijsonschematools.client.paths.userusername.put.UserusernamePutRequestBody; -import org.openapijsonschematools.client.paths.userusername.put.UserusernamePutPathParameters; -import org.openapijsonschematools.client.paths.userusername.put.Parameters; -import org.openapijsonschematools.client.paths.userusername.put.UserusernamePutResponses; -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.requestbody.SerializedRequestBody; -import org.openapijsonschematools.client.paths.Userusername; - -import java.io.IOException; -import java.util.ArrayList; -import java.net.http.HttpClient; -import java.net.http.HttpRequest; -import java.time.Duration; -import java.util.List; -import java.util.Map; - -public class UserusernamePut { - private static class PutProvider { - private static final String method = "put"; - - public static Nothing? put( - PutRequest request, - ApiConfiguration apiConfiguration, - SchemaConfiguration schemaConfiguration, - HttpClient client - ) throws IOException, InterruptedException, ValidationException, NotImplementedException, ApiException { - Map> headers = apiConfiguration.getDefaultHeaders(); - - SerializedRequestBody serializedRequestBody = new UserusernamePutRequestBody.UserusernamePutRequestBody1().serialize( - request.requestBody - ); - var contentTypeHeaderValues = headers.getOrDefault("Content-Type", new ArrayList<>()); - contentTypeHeaderValues.add(serializedRequestBody.contentType); - HttpRequest.BodyPublisher bodyPublisher = serializedRequestBody.bodyPublisher; - - var pathSerializer = new Parameters.PathParametersSerializer(); - String updatedPath = pathSerializer.serialize(request.pathParameters, Userusername.path); - // TODO set this to a map if there is a query security scheme - @Nullable Map queryMap = null; - String host = apiConfiguration.getServer(request.serverIndex).url(); - - String url = host + updatedPath; - var httpRequest = RestClient.getRequest( - url, - method, - bodyPublisher, - headers, - request.timeout - ); - var response = RestClient.getResponse(httpRequest, client); - return (Nothing?) null; - } - } - - public interface PutOperation { - ApiConfiguration getApiConfiguration(); - SchemaConfiguration getSchemaConfiguration(); - HttpClient getClient(); - default Nothing? put(PutRequest request) throws IOException, InterruptedException, ValidationException, NotImplementedException, ApiException { - return PutProvider.put(request, getApiConfiguration(), getSchemaConfiguration(), getClient()); - } - } - - public interface UpdateUserOperation { - ApiConfiguration getApiConfiguration(); - SchemaConfiguration getSchemaConfiguration(); - HttpClient getClient(); - default Nothing? updateUser(PutRequest request) throws IOException, InterruptedException, ValidationException, NotImplementedException, ApiException { - return PutProvider.put(request, getApiConfiguration(), getSchemaConfiguration(), getClient()); - } - } - - public static class Put extends ApiClient implements PutOperation { - public Put(ApiConfiguration apiConfiguration, SchemaConfiguration schemaConfiguration) { - super(apiConfiguration, schemaConfiguration); - } - } - - public static class PutRequest { - public UserusernamePutRequestBody.SealedRequestBody requestBody; - public UserusernamePutPathParameters.PathParametersMap pathParameters; - public RootServerInfo.@Nullable ServerIndex serverIndex; - public @Nullable Duration timeout; - - public PutRequest( - UserusernamePutRequestBody.SealedRequestBody requestBody, - UserusernamePutPathParameters.PathParametersMap pathParameters, - RootServerInfo.@Nullable ServerIndex serverIndex, - @Nullable Duration timeout - ) { - this.requestBody = requestBody; - this.pathParameters = pathParameters; - this.serverIndex = serverIndex; - this.timeout = timeout; - } - } - - public static class PutNullableRequest { - public UserusernamePutRequestBody.@Nullable SealedRequestBody requestBody; - public UserusernamePutPathParameters.@Nullable PathParametersMap pathParameters; - public RootServerInfo.@Nullable ServerIndex serverIndex; - public @Nullable Duration timeout; - } - - public interface SetterForServerIndex { - PutNullableRequest getInstance(); - T getBuilderAfterServerIndex(PutNullableRequest instance); - default T serverIndex(RootServerInfo.ServerIndex serverIndex) { - var instance = getInstance(); - instance.serverIndex = serverIndex; - return getBuilderAfterServerIndex(instance); - } - } - - public interface SetterForTimeout { - PutNullableRequest getInstance(); - T getBuilderAfterTimeout(PutNullableRequest instance); - default T timeout(Duration timeout) { - var instance = getInstance(); - instance.timeout = timeout; - return getBuilderAfterTimeout(instance); - } - } - - public interface SetterForRequestBody { - PutNullableRequest getInstance(); - T getBuilderAfterRequestBody(PutNullableRequest instance); - default T requestBody(UserusernamePutRequestBody.SealedRequestBody requestBody) { - var instance = getInstance(); - instance.requestBody = requestBody; - return getBuilderAfterRequestBody(instance); - } - } - - public interface SetterForPathParameters { - PutNullableRequest getInstance(); - T getBuilderAfterPathParameters(PutNullableRequest instance); - default T pathParameters(UserusernamePutPathParameters.PathParametersMap pathParameters) { - var instance = getInstance(); - instance.pathParameters = pathParameters; - return getBuilderAfterPathParameters(instance); - } - } - - public static class Put00RequestBuilder implements SetterForServerIndex, SetterForTimeout { - private final PutNullableRequest instance; - - public Put00RequestBuilder(PutNullableRequest instance) { - this.instance = instance; - } - - public PutRequest build() { - var requestBody = instance.requestBody; - if (requestBody == null) { - throw new RuntimeException("invalid null value for required parameter"); - } - var pathParameters = instance.pathParameters; - if (pathParameters == null) { - throw new RuntimeException("invalid null value for required parameter"); - } - return new PutRequest( - requestBody, - pathParameters, - instance.serverIndex, - instance.timeout - ); - } - - public PutNullableRequest getInstance() { - return instance; - } - - public Put00RequestBuilder getBuilderAfterServerIndex(PutNullableRequest instance) { - return this; - } - - public Put00RequestBuilder getBuilderAfterTimeout(PutNullableRequest instance) { - return this; - } - } - public static class Put01RequestBuilder implements SetterForPathParameters { - private final PutNullableRequest instance; - - public Put01RequestBuilder(PutNullableRequest instance) { - this.instance = instance; - } - - public PutNullableRequest getInstance() { - return instance; - } - - public Put00RequestBuilder getBuilderAfterPathParameters(PutNullableRequest instance) { - return new Put00RequestBuilder(instance); - } - } - public static class Put10RequestBuilder implements SetterForRequestBody { - private final PutNullableRequest instance; - - public Put10RequestBuilder(PutNullableRequest instance) { - this.instance = instance; - } - - public PutNullableRequest getInstance() { - return instance; - } - - public Put00RequestBuilder getBuilderAfterRequestBody(PutNullableRequest instance) { - return new Put00RequestBuilder(instance); - } - } - public static class PutRequestBuilder implements SetterForRequestBody, SetterForPathParameters { - private final PutNullableRequest instance; - - public PutRequestBuilder() { - this.instance = new PutNullableRequest(); - } - - public PutNullableRequest getInstance() { - return instance; - } - - public Put01RequestBuilder getBuilderAfterRequestBody(PutNullableRequest instance) { - return new Put01RequestBuilder(instance); - } - - public Put10RequestBuilder getBuilderAfterPathParameters(PutNullableRequest instance) { - return new Put10RequestBuilder(instance); - } - } -} diff --git a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/userusername/delete/Parameters.kt b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/userusername/delete/Parameters.kt deleted file mode 100644 index ea0e063d89c..00000000000 --- a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/userusername/delete/Parameters.kt +++ /dev/null @@ -1,20 +0,0 @@ -package org.openapijsonschematools.client.paths.userusername.delete; - -import org.openapijsonschematools.client.paths.userusername.delete.parameters.Parameter0; -import org.openapijsonschematools.client.parameter.PathSerializer; - -import java.util.Map; -import java.util.AbstractMap; - -public class Parameters { - - public static class PathParametersSerializer extends PathSerializer { - public PathParametersSerializer() { - super( - Map.ofEntries( - new AbstractMap.SimpleEntry<>("username", new Parameter0.Parameter01()) - ) - ); - } - } -} diff --git a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/userusername/delete/UserusernameDeletePathParameters.kt b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/userusername/delete/UserusernameDeletePathParameters.kt deleted file mode 100644 index 28dd5ffb5b8..00000000000 --- a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/userusername/delete/UserusernameDeletePathParameters.kt +++ /dev/null @@ -1,205 +0,0 @@ -package org.openapijsonschematools.client.paths.userusername.delete; -import java.util.ArrayList; -import java.util.HashSet; -import java.util.LinkedHashMap; -import java.util.LinkedHashSet; -import java.util.List; -import java.util.Map; -import java.util.Objects; -import java.util.Set; -import org.checkerframework.checker.nullness.qual.Nullable; -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.UnsetPropertyException; -import org.openapijsonschematools.client.exceptions.ValidationException; -import org.openapijsonschematools.client.schemas.AnyTypeJsonSchema; -import org.openapijsonschematools.client.schemas.GenericBuilder; -import org.openapijsonschematools.client.schemas.NotAnyTypeJsonSchema; -import org.openapijsonschematools.client.schemas.validation.FrozenMap; -import org.openapijsonschematools.client.schemas.validation.JsonSchema; -import org.openapijsonschematools.client.schemas.validation.JsonSchemaInfo; -import org.openapijsonschematools.client.schemas.validation.MapSchemaValidator; -import org.openapijsonschematools.client.schemas.validation.MapUtils; -import org.openapijsonschematools.client.schemas.validation.PathToSchemasMap; -import org.openapijsonschematools.client.schemas.validation.PropertyEntry; -import org.openapijsonschematools.client.schemas.validation.ValidationMetadata; - -public class UserusernameDeletePathParameters { - // nest classes so all schemas and input/output classes can be public - - - public static class AdditionalProperties extends NotAnyTypeJsonSchema.NotAnyTypeJsonSchema1 { - // NotAnyTypeSchema - private static @Nullable AdditionalProperties instance = null; - public static AdditionalProperties getInstance() { - if (instance == null) { - instance = new AdditionalProperties(); - } - return instance; - } - } - - - public static class PathParametersMap extends FrozenMap { - protected PathParametersMap(FrozenMap m) { - super(m); - } - public static final Set requiredKeys = Set.of( - "username" - ); - public static final Set optionalKeys = Set.of(); - public static PathParametersMap of(Map arg, SchemaConfiguration configuration) throws ValidationException { - return UserusernameDeletePathParameters1.getInstance().validate(arg, configuration); - } - - public String username() { - try { - return getOrThrow("version"); - } catch (UnsetPropertyException e) { - throw new RuntimeException(e); - } - } - } - - public interface SetterForUsername { - Map getInstance(); - T getBuilderAfterUsername(Map instance); - - default T username(String value) { - var instance = getInstance(); - instance.put("username", value); - return getBuilderAfterUsername(instance); - } - } - - public static class PathParametersMap0Builder implements GenericBuilder> { - private final Map instance; - private static final Set knownKeys = Set.of( - "username" - ); - public Set getKnownKeys() { - return knownKeys; - } - public PathParametersMap0Builder(Map instance) { - this.instance = instance; - } - public Map build() { - return instance; - } - } - - public static class PathParametersMapBuilder implements SetterForUsername { - private final Map instance; - public PathParametersMapBuilder() { - this.instance = new LinkedHashMap<>(); - } - public Map getInstance() { - return instance; - } - public PathParametersMap0Builder getBuilderAfterUsername(Map instance) { - return new PathParametersMap0Builder(instance); - } - } - - - public sealed interface UserusernameDeletePathParameters1Boxed permits UserusernameDeletePathParameters1BoxedMap { - @Nullable Object getData(); - } - - public record UserusernameDeletePathParameters1BoxedMap(PathParametersMap data) implements UserusernameDeletePathParameters1Boxed { - @Override - public @Nullable Object getData() { - return data; - } - } - - - public static class UserusernameDeletePathParameters1 extends JsonSchema implements MapSchemaValidator { - private static @Nullable UserusernameDeletePathParameters1 instance = null; - - protected UserusernameDeletePathParameters1() { - super(new JsonSchemaInfo() - .type(Set.of(Map.class)) - .properties(Map.ofEntries( - new PropertyEntry("username", Schema.Schema1.class) - )) - .required(Set.of( - "username" - )) - .additionalProperties(AdditionalProperties.class) - ); - } - - public static UserusernameDeletePathParameters1 getInstance() { - if (instance == null) { - instance = new UserusernameDeletePathParameters1(); - } - return instance; - } - - 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 RuntimeException("Invalid non-string key value"); - } - String propertyName = (String) entryKey; - List propertyPathToItem = new ArrayList<>(pathToItem); - propertyPathToItem.add(propertyName); - Object value = entry.getValue(); - LinkedHashMap, Nothing?> schemas = pathToSchemas.get(propertyPathToItem); - if (schemas == null) { - throw new RuntimeException("Validation 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"); - } - properties.put(propertyName, (String) propertyInstance); - } - FrozenMap castProperties = new FrozenMap<>(properties); - return new PathParametersMap(castProperties); - } - - 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); - SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().build())); - ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, new PathToSchemasMap(), new LinkedHashSet<>()); - PathToSchemasMap pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet); - return getNewInstance(castArg, validationMetadata.pathToItem(), pathToSchemasMap); - } - - - @Override - public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws 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"); - } - @Override - public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { - if (arg instanceof Map) { - return getNewInstance((Map) arg, pathToItem, pathToSchemas); - } - throw new RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); - } - @Override - public UserusernameDeletePathParameters1BoxedMap validateAndBox(Map arg, SchemaConfiguration configuration) throws ValidationException { - return new UserusernameDeletePathParameters1BoxedMap(validate(arg, configuration)); - } - @Override - public UserusernameDeletePathParameters1Boxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { - 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"); - } - } - -} diff --git a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/userusername/delete/UserusernameDeleteResponses.kt b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/userusername/delete/UserusernameDeleteResponses.kt deleted file mode 100644 index 8be04cfbc4b..00000000000 --- a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/userusername/delete/UserusernameDeleteResponses.kt +++ /dev/null @@ -1,66 +0,0 @@ -package org.openapijsonschematools.client.paths.userusername.delete; - -import org.openapijsonschematools.client.paths.userusername.delete.responses.UserusernameDeleteCode200Response; -import org.openapijsonschematools.client.paths.userusername.delete.responses.UserusernameDeleteCode404Response; -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; -import org.checkerframework.checker.nullness.qual.Nullable; - -import java.net.http.HttpResponse; -import java.util.Map; -import java.util.AbstractMap; - -public class UserusernameDeleteResponses { - public sealed interface EndpointResponse permits EndpointUserusernameDeleteCode200Response {} - - public record EndpointUserusernameDeleteCode200Response( - HttpResponse response, - Nothing? body, - Nothing? headers - ) implements EndpointResponse, ApiResponse{ - } - - public sealed interface StatusCodeResponseDeserializer permits StatusUserusernameDeleteCode200ResponseDeserializer, StatusUserusernameDeleteCode404ResponseDeserializer {} - - public static final class StatusUserusernameDeleteCode200ResponseDeserializer extends UserusernameDeleteCode200Response.UserusernameDeleteCode200Response1 implements StatusCodeResponseDeserializer { - } - public static final class StatusUserusernameDeleteCode404ResponseDeserializer extends UserusernameDeleteCode404Response.UserusernameDeleteCode404Response1 implements StatusCodeResponseDeserializer { - } - - public static final class UserusernameDeleteResponses1 implements ResponsesDeserializer { - private final Map statusCodeToResponseDeserializer; - public UserusernameDeleteResponses1() { - this.statusCodeToResponseDeserializer = Map.ofEntries( - new AbstractMap.SimpleEntry<>("200", new StatusUserusernameDeleteCode200ResponseDeserializer()), - new AbstractMap.SimpleEntry<>("404", new StatusUserusernameDeleteCode404ResponseDeserializer()) - ); - } - - 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) { - throw new ApiException( - "Invalid response statusCode="+statusCode+" has no response defined in the openapi document", - response - ); - } - if (statusCodeDeserializer instanceof StatusUserusernameDeleteCode200ResponseDeserializer castDeserializer) { - var deserializedResponse = castDeserializer.deserialize(response, configuration); - return new EndpointUserusernameDeleteCode200Response(response, deserializedResponse.body(), deserializedResponse.headers()); - } else { - StatusUserusernameDeleteCode404ResponseDeserializer castDeserializer = (StatusUserusernameDeleteCode404ResponseDeserializer) statusCodeDeserializer; - var deserializedResponse = castDeserializer.deserialize(response, configuration); - throw new UserusernameDeleteCode404Response.ResponseApiException( - "Received error statusCode response from server", - response, - deserializedResponse - ); - } - } - } -} diff --git a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/userusername/delete/parameters/Parameter0.kt b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/userusername/delete/parameters/Parameter0.kt deleted file mode 100644 index e95aee523c4..00000000000 --- a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/userusername/delete/parameters/Parameter0.kt +++ /dev/null @@ -1,7 +0,0 @@ -package org.openapijsonschematools.client.paths.userusername.delete.parameters; - -import org.openapijsonschematools.client.components.parameters.RefPathUserName; - -public class Parameter0 extends RefPathUserName { - public static class Parameter01 extends RefPathUserName1 {} -} diff --git a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/userusername/delete/responses/UserusernameDeleteCode200Response.kt b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/userusername/delete/responses/UserusernameDeleteCode200Response.kt deleted file mode 100644 index 680a51cb08b..00000000000 --- a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/userusername/delete/responses/UserusernameDeleteCode200Response.kt +++ /dev/null @@ -1,7 +0,0 @@ -package org.openapijsonschematools.client.paths.userusername.delete.responses; - -import org.openapijsonschematools.client.components.responses.SuccessDescriptionOnly; - -public class UserusernameDeleteCode200Response extends SuccessDescriptionOnly { - public static class UserusernameDeleteCode200Response1 extends SuccessDescriptionOnly1 {} -} diff --git a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/userusername/delete/responses/UserusernameDeleteCode404Response.kt b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/userusername/delete/responses/UserusernameDeleteCode404Response.kt deleted file mode 100644 index c7299032219..00000000000 --- a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/userusername/delete/responses/UserusernameDeleteCode404Response.kt +++ /dev/null @@ -1,45 +0,0 @@ -package org.openapijsonschematools.client.paths.userusername.delete.responses; - -import org.openapijsonschematools.client.configurations.SchemaConfiguration; -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; -import java.net.http.HttpResponse; -import java.net.http.HttpHeaders; - -public class UserusernameDeleteCode404Response { - - public static class UserusernameDeleteCode404Response1 extends ResponseDeserializer { - public UserusernameDeleteCode404Response1() { - super( - MapUtils.makeMap( - ) - ); - } - - @Override - protected Nothing? getBody(String contentType, Nothing? mediaType, byte[] body, SchemaConfiguration configuration) { - return null; - } - - @Override - protected Nothing? getHeaders(HttpHeaders headers, SchemaConfiguration configuration) { - return null; - } - } - - @SuppressWarnings("serial") - public static class ResponseApiException extends ApiException { - public DeserializedHttpResponse deserializedResponse; - - public ResponseApiException(String s, HttpResponse response, DeserializedHttpResponse deserializedResponse) { - super(s, response); - this.deserializedResponse = deserializedResponse; - } - } -} diff --git a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/userusername/get/Parameters.kt b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/userusername/get/Parameters.kt deleted file mode 100644 index 65c65d5d3b9..00000000000 --- a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/userusername/get/Parameters.kt +++ /dev/null @@ -1,20 +0,0 @@ -package org.openapijsonschematools.client.paths.userusername.get; - -import org.openapijsonschematools.client.paths.userusername.get.parameters.Parameter0; -import org.openapijsonschematools.client.parameter.PathSerializer; - -import java.util.Map; -import java.util.AbstractMap; - -public class Parameters { - - public static class PathParametersSerializer extends PathSerializer { - public PathParametersSerializer() { - super( - Map.ofEntries( - new AbstractMap.SimpleEntry<>("username", new Parameter0.Parameter01()) - ) - ); - } - } -} diff --git a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/userusername/get/UserusernameGetPathParameters.kt b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/userusername/get/UserusernameGetPathParameters.kt deleted file mode 100644 index 97e3023c38e..00000000000 --- a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/userusername/get/UserusernameGetPathParameters.kt +++ /dev/null @@ -1,205 +0,0 @@ -package org.openapijsonschematools.client.paths.userusername.get; -import java.util.ArrayList; -import java.util.HashSet; -import java.util.LinkedHashMap; -import java.util.LinkedHashSet; -import java.util.List; -import java.util.Map; -import java.util.Objects; -import java.util.Set; -import org.checkerframework.checker.nullness.qual.Nullable; -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.UnsetPropertyException; -import org.openapijsonschematools.client.exceptions.ValidationException; -import org.openapijsonschematools.client.schemas.AnyTypeJsonSchema; -import org.openapijsonschematools.client.schemas.GenericBuilder; -import org.openapijsonschematools.client.schemas.NotAnyTypeJsonSchema; -import org.openapijsonschematools.client.schemas.validation.FrozenMap; -import org.openapijsonschematools.client.schemas.validation.JsonSchema; -import org.openapijsonschematools.client.schemas.validation.JsonSchemaInfo; -import org.openapijsonschematools.client.schemas.validation.MapSchemaValidator; -import org.openapijsonschematools.client.schemas.validation.MapUtils; -import org.openapijsonschematools.client.schemas.validation.PathToSchemasMap; -import org.openapijsonschematools.client.schemas.validation.PropertyEntry; -import org.openapijsonschematools.client.schemas.validation.ValidationMetadata; - -public class UserusernameGetPathParameters { - // nest classes so all schemas and input/output classes can be public - - - public static class AdditionalProperties extends NotAnyTypeJsonSchema.NotAnyTypeJsonSchema1 { - // NotAnyTypeSchema - private static @Nullable AdditionalProperties instance = null; - public static AdditionalProperties getInstance() { - if (instance == null) { - instance = new AdditionalProperties(); - } - return instance; - } - } - - - public static class PathParametersMap extends FrozenMap { - protected PathParametersMap(FrozenMap m) { - super(m); - } - public static final Set requiredKeys = Set.of( - "username" - ); - public static final Set optionalKeys = Set.of(); - public static PathParametersMap of(Map arg, SchemaConfiguration configuration) throws ValidationException { - return UserusernameGetPathParameters1.getInstance().validate(arg, configuration); - } - - public String username() { - try { - return getOrThrow("version"); - } catch (UnsetPropertyException e) { - throw new RuntimeException(e); - } - } - } - - public interface SetterForUsername { - Map getInstance(); - T getBuilderAfterUsername(Map instance); - - default T username(String value) { - var instance = getInstance(); - instance.put("username", value); - return getBuilderAfterUsername(instance); - } - } - - public static class PathParametersMap0Builder implements GenericBuilder> { - private final Map instance; - private static final Set knownKeys = Set.of( - "username" - ); - public Set getKnownKeys() { - return knownKeys; - } - public PathParametersMap0Builder(Map instance) { - this.instance = instance; - } - public Map build() { - return instance; - } - } - - public static class PathParametersMapBuilder implements SetterForUsername { - private final Map instance; - public PathParametersMapBuilder() { - this.instance = new LinkedHashMap<>(); - } - public Map getInstance() { - return instance; - } - public PathParametersMap0Builder getBuilderAfterUsername(Map instance) { - return new PathParametersMap0Builder(instance); - } - } - - - public sealed interface UserusernameGetPathParameters1Boxed permits UserusernameGetPathParameters1BoxedMap { - @Nullable Object getData(); - } - - public record UserusernameGetPathParameters1BoxedMap(PathParametersMap data) implements UserusernameGetPathParameters1Boxed { - @Override - public @Nullable Object getData() { - return data; - } - } - - - public static class UserusernameGetPathParameters1 extends JsonSchema implements MapSchemaValidator { - private static @Nullable UserusernameGetPathParameters1 instance = null; - - protected UserusernameGetPathParameters1() { - super(new JsonSchemaInfo() - .type(Set.of(Map.class)) - .properties(Map.ofEntries( - new PropertyEntry("username", Schema.Schema1.class) - )) - .required(Set.of( - "username" - )) - .additionalProperties(AdditionalProperties.class) - ); - } - - public static UserusernameGetPathParameters1 getInstance() { - if (instance == null) { - instance = new UserusernameGetPathParameters1(); - } - return instance; - } - - 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 RuntimeException("Invalid non-string key value"); - } - String propertyName = (String) entryKey; - List propertyPathToItem = new ArrayList<>(pathToItem); - propertyPathToItem.add(propertyName); - Object value = entry.getValue(); - LinkedHashMap, Nothing?> schemas = pathToSchemas.get(propertyPathToItem); - if (schemas == null) { - throw new RuntimeException("Validation 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"); - } - properties.put(propertyName, (String) propertyInstance); - } - FrozenMap castProperties = new FrozenMap<>(properties); - return new PathParametersMap(castProperties); - } - - 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); - SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().build())); - ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, new PathToSchemasMap(), new LinkedHashSet<>()); - PathToSchemasMap pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet); - return getNewInstance(castArg, validationMetadata.pathToItem(), pathToSchemasMap); - } - - - @Override - public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws 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"); - } - @Override - public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { - if (arg instanceof Map) { - return getNewInstance((Map) arg, pathToItem, pathToSchemas); - } - throw new RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); - } - @Override - public UserusernameGetPathParameters1BoxedMap validateAndBox(Map arg, SchemaConfiguration configuration) throws ValidationException { - return new UserusernameGetPathParameters1BoxedMap(validate(arg, configuration)); - } - @Override - public UserusernameGetPathParameters1Boxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { - 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"); - } - } - -} diff --git a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/userusername/get/UserusernameGetResponses.kt b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/userusername/get/UserusernameGetResponses.kt deleted file mode 100644 index 44f74afa40e..00000000000 --- a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/userusername/get/UserusernameGetResponses.kt +++ /dev/null @@ -1,77 +0,0 @@ -package org.openapijsonschematools.client.paths.userusername.get; - -import org.openapijsonschematools.client.paths.userusername.get.responses.UserusernameGetCode200Response; -import org.openapijsonschematools.client.paths.userusername.get.responses.UserusernameGetCode400Response; -import org.openapijsonschematools.client.paths.userusername.get.responses.UserusernameGetCode404Response; -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; -import org.checkerframework.checker.nullness.qual.Nullable; - -import java.net.http.HttpResponse; -import java.util.Map; -import java.util.AbstractMap; - -public class UserusernameGetResponses { - public sealed interface EndpointResponse permits EndpointUserusernameGetCode200Response {} - - public record EndpointUserusernameGetCode200Response( - HttpResponse response, - UserusernameGetCode200Response.SealedResponseBody body, - Nothing? headers - ) implements EndpointResponse, ApiResponse{ - } - - public sealed interface StatusCodeResponseDeserializer permits StatusUserusernameGetCode200ResponseDeserializer, StatusUserusernameGetCode400ResponseDeserializer, StatusUserusernameGetCode404ResponseDeserializer {} - - public static final class StatusUserusernameGetCode200ResponseDeserializer extends UserusernameGetCode200Response.UserusernameGetCode200Response1 implements StatusCodeResponseDeserializer { - } - public static final class StatusUserusernameGetCode400ResponseDeserializer extends UserusernameGetCode400Response.UserusernameGetCode400Response1 implements StatusCodeResponseDeserializer { - } - public static final class StatusUserusernameGetCode404ResponseDeserializer extends UserusernameGetCode404Response.UserusernameGetCode404Response1 implements StatusCodeResponseDeserializer { - } - - public static final class UserusernameGetResponses1 implements ResponsesDeserializer { - private final Map statusCodeToResponseDeserializer; - public UserusernameGetResponses1() { - this.statusCodeToResponseDeserializer = Map.ofEntries( - new AbstractMap.SimpleEntry<>("200", new StatusUserusernameGetCode200ResponseDeserializer()), - new AbstractMap.SimpleEntry<>("400", new StatusUserusernameGetCode400ResponseDeserializer()), - new AbstractMap.SimpleEntry<>("404", new StatusUserusernameGetCode404ResponseDeserializer()) - ); - } - - 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) { - throw new ApiException( - "Invalid response statusCode="+statusCode+" has no response defined in the openapi document", - response - ); - } - if (statusCodeDeserializer instanceof StatusUserusernameGetCode200ResponseDeserializer castDeserializer) { - var deserializedResponse = castDeserializer.deserialize(response, configuration); - return new EndpointUserusernameGetCode200Response(response, deserializedResponse.body(), deserializedResponse.headers()); - } else if (statusCodeDeserializer instanceof StatusUserusernameGetCode400ResponseDeserializer castDeserializer) { - var deserializedResponse = castDeserializer.deserialize(response, configuration); - throw new UserusernameGetCode400Response.ResponseApiException( - "Received error statusCode response from server", - response, - deserializedResponse - ); - } else { - StatusUserusernameGetCode404ResponseDeserializer castDeserializer = (StatusUserusernameGetCode404ResponseDeserializer) statusCodeDeserializer; - var deserializedResponse = castDeserializer.deserialize(response, configuration); - throw new UserusernameGetCode404Response.ResponseApiException( - "Received error statusCode response from server", - response, - deserializedResponse - ); - } - } - } -} diff --git a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/userusername/get/parameters/Parameter0.kt b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/userusername/get/parameters/Parameter0.kt deleted file mode 100644 index d100ccf2d2b..00000000000 --- a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/userusername/get/parameters/Parameter0.kt +++ /dev/null @@ -1,7 +0,0 @@ -package org.openapijsonschematools.client.paths.userusername.get.parameters; - -import org.openapijsonschematools.client.components.parameters.PathUserName; - -public class Parameter0 extends PathUserName { - public static class Parameter01 extends PathUserName1 {} -} diff --git a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/userusername/get/responses/UserusernameGetCode200Response.kt b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/userusername/get/responses/UserusernameGetCode200Response.kt deleted file mode 100644 index 4adda3162b4..00000000000 --- a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/userusername/get/responses/UserusernameGetCode200Response.kt +++ /dev/null @@ -1,81 +0,0 @@ -package org.openapijsonschematools.client.paths.userusername.get.responses; - -import org.openapijsonschematools.client.configurations.SchemaConfiguration; -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; - -import java.util.AbstractMap; -import java.util.Map; -import java.net.http.HttpResponse; -import java.net.http.HttpHeaders; - -public class UserusernameGetCode200Response { - public sealed interface SealedMediaType permits ApplicationxmlMediaType, ApplicationjsonMediaType {} - - public record ApplicationxmlMediaType(ApplicationxmlSchema.ApplicationxmlSchema1 schema) implements SealedMediaType, MediaType { - public ApplicationxmlMediaType() { - this(ApplicationxmlSchema.ApplicationxmlSchema1.getInstance()); - } - @Override - public Nothing? encoding() { - return null; - } - } - - public record ApplicationjsonMediaType(ApplicationjsonSchema.ApplicationjsonSchema1 schema) implements SealedMediaType, MediaType { - public ApplicationjsonMediaType() { - this(ApplicationjsonSchema.ApplicationjsonSchema1.getInstance()); - } - @Override - public Nothing? encoding() { - return null; - } - } - public sealed interface SealedResponseBody permits ApplicationxmlResponseBody, ApplicationjsonResponseBody {} - public record ApplicationxmlResponseBody(ApplicationxmlSchema.User1Boxed body) implements SealedResponseBody { } - public record ApplicationjsonResponseBody(ApplicationjsonSchema.User1Boxed body) implements SealedResponseBody { } - - public static class UserusernameGetCode200Response1 extends ResponseDeserializer { - public UserusernameGetCode200Response1() { - super( - Map.ofEntries( - new AbstractMap.SimpleEntry<>("application/xml", new ApplicationxmlMediaType()), - new AbstractMap.SimpleEntry<>("application/json", new ApplicationjsonMediaType()) - ) - ); - } - - @Override - 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 { - ApplicationjsonMediaType thisMediaType = (ApplicationjsonMediaType) mediaType; - var deserializedBody = deserializeBody(contentType, body, thisMediaType.schema(), configuration); - return new ApplicationjsonResponseBody(deserializedBody); - } - } - - @Override - protected Nothing? getHeaders(HttpHeaders headers, SchemaConfiguration configuration) { - return null; - } - } - - @SuppressWarnings("serial") - public static class ResponseApiException extends ApiException { - public DeserializedHttpResponse deserializedResponse; - - public ResponseApiException(String s, HttpResponse response, DeserializedHttpResponse deserializedResponse) { - super(s, response); - this.deserializedResponse = deserializedResponse; - } - } -} diff --git a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/userusername/get/responses/UserusernameGetCode400Response.kt b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/userusername/get/responses/UserusernameGetCode400Response.kt deleted file mode 100644 index 2b55ddee017..00000000000 --- a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/userusername/get/responses/UserusernameGetCode400Response.kt +++ /dev/null @@ -1,45 +0,0 @@ -package org.openapijsonschematools.client.paths.userusername.get.responses; - -import org.openapijsonschematools.client.configurations.SchemaConfiguration; -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; -import java.net.http.HttpResponse; -import java.net.http.HttpHeaders; - -public class UserusernameGetCode400Response { - - public static class UserusernameGetCode400Response1 extends ResponseDeserializer { - public UserusernameGetCode400Response1() { - super( - MapUtils.makeMap( - ) - ); - } - - @Override - protected Nothing? getBody(String contentType, Nothing? mediaType, byte[] body, SchemaConfiguration configuration) { - return null; - } - - @Override - protected Nothing? getHeaders(HttpHeaders headers, SchemaConfiguration configuration) { - return null; - } - } - - @SuppressWarnings("serial") - public static class ResponseApiException extends ApiException { - public DeserializedHttpResponse deserializedResponse; - - public ResponseApiException(String s, HttpResponse response, DeserializedHttpResponse deserializedResponse) { - super(s, response); - this.deserializedResponse = deserializedResponse; - } - } -} diff --git a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/userusername/get/responses/UserusernameGetCode404Response.kt b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/userusername/get/responses/UserusernameGetCode404Response.kt deleted file mode 100644 index 2724e62eeb0..00000000000 --- a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/userusername/get/responses/UserusernameGetCode404Response.kt +++ /dev/null @@ -1,45 +0,0 @@ -package org.openapijsonschematools.client.paths.userusername.get.responses; - -import org.openapijsonschematools.client.configurations.SchemaConfiguration; -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; -import java.net.http.HttpResponse; -import java.net.http.HttpHeaders; - -public class UserusernameGetCode404Response { - - public static class UserusernameGetCode404Response1 extends ResponseDeserializer { - public UserusernameGetCode404Response1() { - super( - MapUtils.makeMap( - ) - ); - } - - @Override - protected Nothing? getBody(String contentType, Nothing? mediaType, byte[] body, SchemaConfiguration configuration) { - return null; - } - - @Override - protected Nothing? getHeaders(HttpHeaders headers, SchemaConfiguration configuration) { - return null; - } - } - - @SuppressWarnings("serial") - public static class ResponseApiException extends ApiException { - public DeserializedHttpResponse deserializedResponse; - - public ResponseApiException(String s, HttpResponse response, DeserializedHttpResponse deserializedResponse) { - super(s, response); - this.deserializedResponse = deserializedResponse; - } - } -} diff --git a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/userusername/get/responses/code200response/content/applicationjson/ApplicationjsonSchema.kt b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/userusername/get/responses/code200response/content/applicationjson/ApplicationjsonSchema.kt deleted file mode 100644 index 910120ee863..00000000000 --- a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/userusername/get/responses/code200response/content/applicationjson/ApplicationjsonSchema.kt +++ /dev/null @@ -1,19 +0,0 @@ -package org.openapijsonschematools.client.paths.userusername.get.responses.code200response.content.applicationjson; - -import org.checkerframework.checker.nullness.qual.Nullable; -import org.openapijsonschematools.client.components.schemas.User; - -public class ApplicationjsonSchema extends User { - // $refed class - - - public static class ApplicationjsonSchema1 extends User1 { - private static @Nullable ApplicationjsonSchema1 instance = null; - public static ApplicationjsonSchema1 getInstance() { - if (instance == null) { - instance = new ApplicationjsonSchema1(); - } - return instance; - } - } -} diff --git a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/userusername/get/responses/code200response/content/applicationxml/ApplicationxmlSchema.kt b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/userusername/get/responses/code200response/content/applicationxml/ApplicationxmlSchema.kt deleted file mode 100644 index 0d8e9cf0d9a..00000000000 --- a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/userusername/get/responses/code200response/content/applicationxml/ApplicationxmlSchema.kt +++ /dev/null @@ -1,19 +0,0 @@ -package org.openapijsonschematools.client.paths.userusername.get.responses.code200response.content.applicationxml; - -import org.checkerframework.checker.nullness.qual.Nullable; -import org.openapijsonschematools.client.components.schemas.User; - -public class ApplicationxmlSchema extends User { - // $refed class - - - public static class ApplicationxmlSchema1 extends User1 { - private static @Nullable ApplicationxmlSchema1 instance = null; - public static ApplicationxmlSchema1 getInstance() { - if (instance == null) { - instance = new ApplicationxmlSchema1(); - } - return instance; - } - } -} diff --git a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/userusername/put/Parameters.kt b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/userusername/put/Parameters.kt deleted file mode 100644 index bd698da0d9d..00000000000 --- a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/userusername/put/Parameters.kt +++ /dev/null @@ -1,20 +0,0 @@ -package org.openapijsonschematools.client.paths.userusername.put; - -import org.openapijsonschematools.client.paths.userusername.put.parameters.Parameter0; -import org.openapijsonschematools.client.parameter.PathSerializer; - -import java.util.Map; -import java.util.AbstractMap; - -public class Parameters { - - public static class PathParametersSerializer extends PathSerializer { - public PathParametersSerializer() { - super( - Map.ofEntries( - new AbstractMap.SimpleEntry<>("username", new Parameter0.Parameter01()) - ) - ); - } - } -} diff --git a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/userusername/put/UserusernamePutPathParameters.kt b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/userusername/put/UserusernamePutPathParameters.kt deleted file mode 100644 index 3c5d2314b2f..00000000000 --- a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/userusername/put/UserusernamePutPathParameters.kt +++ /dev/null @@ -1,205 +0,0 @@ -package org.openapijsonschematools.client.paths.userusername.put; -import java.util.ArrayList; -import java.util.HashSet; -import java.util.LinkedHashMap; -import java.util.LinkedHashSet; -import java.util.List; -import java.util.Map; -import java.util.Objects; -import java.util.Set; -import org.checkerframework.checker.nullness.qual.Nullable; -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.UnsetPropertyException; -import org.openapijsonschematools.client.exceptions.ValidationException; -import org.openapijsonschematools.client.schemas.AnyTypeJsonSchema; -import org.openapijsonschematools.client.schemas.GenericBuilder; -import org.openapijsonschematools.client.schemas.NotAnyTypeJsonSchema; -import org.openapijsonschematools.client.schemas.validation.FrozenMap; -import org.openapijsonschematools.client.schemas.validation.JsonSchema; -import org.openapijsonschematools.client.schemas.validation.JsonSchemaInfo; -import org.openapijsonschematools.client.schemas.validation.MapSchemaValidator; -import org.openapijsonschematools.client.schemas.validation.MapUtils; -import org.openapijsonschematools.client.schemas.validation.PathToSchemasMap; -import org.openapijsonschematools.client.schemas.validation.PropertyEntry; -import org.openapijsonschematools.client.schemas.validation.ValidationMetadata; - -public class UserusernamePutPathParameters { - // nest classes so all schemas and input/output classes can be public - - - public static class AdditionalProperties extends NotAnyTypeJsonSchema.NotAnyTypeJsonSchema1 { - // NotAnyTypeSchema - private static @Nullable AdditionalProperties instance = null; - public static AdditionalProperties getInstance() { - if (instance == null) { - instance = new AdditionalProperties(); - } - return instance; - } - } - - - public static class PathParametersMap extends FrozenMap { - protected PathParametersMap(FrozenMap m) { - super(m); - } - public static final Set requiredKeys = Set.of( - "username" - ); - public static final Set optionalKeys = Set.of(); - public static PathParametersMap of(Map arg, SchemaConfiguration configuration) throws ValidationException { - return UserusernamePutPathParameters1.getInstance().validate(arg, configuration); - } - - public String username() { - try { - return getOrThrow("version"); - } catch (UnsetPropertyException e) { - throw new RuntimeException(e); - } - } - } - - public interface SetterForUsername { - Map getInstance(); - T getBuilderAfterUsername(Map instance); - - default T username(String value) { - var instance = getInstance(); - instance.put("username", value); - return getBuilderAfterUsername(instance); - } - } - - public static class PathParametersMap0Builder implements GenericBuilder> { - private final Map instance; - private static final Set knownKeys = Set.of( - "username" - ); - public Set getKnownKeys() { - return knownKeys; - } - public PathParametersMap0Builder(Map instance) { - this.instance = instance; - } - public Map build() { - return instance; - } - } - - public static class PathParametersMapBuilder implements SetterForUsername { - private final Map instance; - public PathParametersMapBuilder() { - this.instance = new LinkedHashMap<>(); - } - public Map getInstance() { - return instance; - } - public PathParametersMap0Builder getBuilderAfterUsername(Map instance) { - return new PathParametersMap0Builder(instance); - } - } - - - public sealed interface UserusernamePutPathParameters1Boxed permits UserusernamePutPathParameters1BoxedMap { - @Nullable Object getData(); - } - - public record UserusernamePutPathParameters1BoxedMap(PathParametersMap data) implements UserusernamePutPathParameters1Boxed { - @Override - public @Nullable Object getData() { - return data; - } - } - - - public static class UserusernamePutPathParameters1 extends JsonSchema implements MapSchemaValidator { - private static @Nullable UserusernamePutPathParameters1 instance = null; - - protected UserusernamePutPathParameters1() { - super(new JsonSchemaInfo() - .type(Set.of(Map.class)) - .properties(Map.ofEntries( - new PropertyEntry("username", Schema.Schema1.class) - )) - .required(Set.of( - "username" - )) - .additionalProperties(AdditionalProperties.class) - ); - } - - public static UserusernamePutPathParameters1 getInstance() { - if (instance == null) { - instance = new UserusernamePutPathParameters1(); - } - return instance; - } - - 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 RuntimeException("Invalid non-string key value"); - } - String propertyName = (String) entryKey; - List propertyPathToItem = new ArrayList<>(pathToItem); - propertyPathToItem.add(propertyName); - Object value = entry.getValue(); - LinkedHashMap, Nothing?> schemas = pathToSchemas.get(propertyPathToItem); - if (schemas == null) { - throw new RuntimeException("Validation 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"); - } - properties.put(propertyName, (String) propertyInstance); - } - FrozenMap castProperties = new FrozenMap<>(properties); - return new PathParametersMap(castProperties); - } - - 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); - SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().build())); - ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, new PathToSchemasMap(), new LinkedHashSet<>()); - PathToSchemasMap pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet); - return getNewInstance(castArg, validationMetadata.pathToItem(), pathToSchemasMap); - } - - - @Override - public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws 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"); - } - @Override - public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { - if (arg instanceof Map) { - return getNewInstance((Map) arg, pathToItem, pathToSchemas); - } - throw new RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); - } - @Override - public UserusernamePutPathParameters1BoxedMap validateAndBox(Map arg, SchemaConfiguration configuration) throws ValidationException { - return new UserusernamePutPathParameters1BoxedMap(validate(arg, configuration)); - } - @Override - public UserusernamePutPathParameters1Boxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { - 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"); - } - } - -} diff --git a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/userusername/put/UserusernamePutRequestBody.kt b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/userusername/put/UserusernamePutRequestBody.kt deleted file mode 100644 index 0826c38059e..00000000000 --- a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/userusername/put/UserusernamePutRequestBody.kt +++ /dev/null @@ -1,49 +0,0 @@ -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; -import org.openapijsonschematools.client.mediatype.MediaType; -import org.openapijsonschematools.client.paths.userusername.put.requestbody.content.applicationjson.ApplicationjsonSchema; - -import java.util.AbstractMap; -import java.util.Map; - -public class UserusernamePutRequestBody { - public sealed interface SealedMediaType permits ApplicationjsonMediaType {} - - public record ApplicationjsonMediaType(ApplicationjsonSchema.ApplicationjsonSchema1 schema) implements SealedMediaType, MediaType { - public ApplicationjsonMediaType() { - this(ApplicationjsonSchema.ApplicationjsonSchema1.getInstance()); - } - @Override - public Nothing? encoding() { - return null; - } - } - - public static class UserusernamePutRequestBody1 extends RequestBodySerializer { - public UserusernamePutRequestBody1() { - super( - Map.ofEntries( - new AbstractMap.SimpleEntry<>("application/json", new ApplicationjsonMediaType()) - ), - true - ); - } - - public SerializedRequestBody serialize(SealedRequestBody requestBody) throws NotImplementedException { - ApplicationjsonRequestBody requestBody0 = (ApplicationjsonRequestBody) requestBody; - return serialize(requestBody0.contentType(), requestBody0.body().getData()); - } - } - - public sealed interface SealedRequestBody permits ApplicationjsonRequestBody {} - public record ApplicationjsonRequestBody(ApplicationjsonSchema.User1Boxed body) implements SealedRequestBody, GenericRequestBody { - @Override - public String contentType() { - return "application/json"; - } - } -} diff --git a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/userusername/put/UserusernamePutResponses.kt b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/userusername/put/UserusernamePutResponses.kt deleted file mode 100644 index 3c59a9a43da..00000000000 --- a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/userusername/put/UserusernamePutResponses.kt +++ /dev/null @@ -1,61 +0,0 @@ -package org.openapijsonschematools.client.paths.userusername.put; - -import org.openapijsonschematools.client.paths.userusername.put.responses.UserusernamePutCode400Response; -import org.openapijsonschematools.client.paths.userusername.put.responses.UserusernamePutCode404Response; -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; - -import java.net.http.HttpResponse; -import java.util.Map; -import java.util.AbstractMap; - -public class UserusernamePutResponses { - - public sealed interface StatusCodeResponseDeserializer permits StatusUserusernamePutCode400ResponseDeserializer, StatusUserusernamePutCode404ResponseDeserializer {} - - public static final class StatusUserusernamePutCode400ResponseDeserializer extends UserusernamePutCode400Response.UserusernamePutCode400Response1 implements StatusCodeResponseDeserializer { - } - public static final class StatusUserusernamePutCode404ResponseDeserializer extends UserusernamePutCode404Response.UserusernamePutCode404Response1 implements StatusCodeResponseDeserializer { - } - - public static final class UserusernamePutResponses1 implements ResponsesDeserializer { - private final Map statusCodeToResponseDeserializer; - public UserusernamePutResponses1() { - this.statusCodeToResponseDeserializer = Map.ofEntries( - new AbstractMap.SimpleEntry<>("400", new StatusUserusernamePutCode400ResponseDeserializer()), - new AbstractMap.SimpleEntry<>("404", new StatusUserusernamePutCode404ResponseDeserializer()) - ); - } - - public Nothing? deserialize(HttpResponse response, SchemaConfiguration configuration) throws ValidationException, NotImplementedException, ApiException { - String statusCode = String.valueOf(response.statusCode()); - @Nullable StatusCodeResponseDeserializer statusCodeDeserializer = statusCodeToResponseDeserializer.get(statusCode); - if (statusCodeDeserializer == null) { - throw new ApiException( - "Invalid response statusCode="+statusCode+" has no response defined in the openapi document", - response - ); - } - if (statusCodeDeserializer instanceof StatusUserusernamePutCode400ResponseDeserializer castDeserializer) { - var deserializedResponse = castDeserializer.deserialize(response, configuration); - throw new UserusernamePutCode400Response.ResponseApiException( - "Received error statusCode response from server", - response, - deserializedResponse - ); - } else { - StatusUserusernamePutCode404ResponseDeserializer castDeserializer = (StatusUserusernamePutCode404ResponseDeserializer) statusCodeDeserializer; - var deserializedResponse = castDeserializer.deserialize(response, configuration); - throw new UserusernamePutCode404Response.ResponseApiException( - "Received error statusCode response from server", - response, - deserializedResponse - ); - } - } - } -} diff --git a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/userusername/put/parameters/Parameter0.kt b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/userusername/put/parameters/Parameter0.kt deleted file mode 100644 index cf1add59f0d..00000000000 --- a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/userusername/put/parameters/Parameter0.kt +++ /dev/null @@ -1,7 +0,0 @@ -package org.openapijsonschematools.client.paths.userusername.put.parameters; - -import org.openapijsonschematools.client.components.parameters.PathUserName; - -public class Parameter0 extends PathUserName { - public static class Parameter01 extends PathUserName1 {} -} diff --git a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/userusername/put/requestbody/content/applicationjson/ApplicationjsonSchema.kt b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/userusername/put/requestbody/content/applicationjson/ApplicationjsonSchema.kt deleted file mode 100644 index 80f49dd652b..00000000000 --- a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/userusername/put/requestbody/content/applicationjson/ApplicationjsonSchema.kt +++ /dev/null @@ -1,19 +0,0 @@ -package org.openapijsonschematools.client.paths.userusername.put.requestbody.content.applicationjson; - -import org.checkerframework.checker.nullness.qual.Nullable; -import org.openapijsonschematools.client.components.schemas.User; - -public class ApplicationjsonSchema extends User { - // $refed class - - - public static class ApplicationjsonSchema1 extends User1 { - private static @Nullable ApplicationjsonSchema1 instance = null; - public static ApplicationjsonSchema1 getInstance() { - if (instance == null) { - instance = new ApplicationjsonSchema1(); - } - return instance; - } - } -} diff --git a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/userusername/put/responses/UserusernamePutCode400Response.kt b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/userusername/put/responses/UserusernamePutCode400Response.kt deleted file mode 100644 index 665bac92d82..00000000000 --- a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/userusername/put/responses/UserusernamePutCode400Response.kt +++ /dev/null @@ -1,45 +0,0 @@ -package org.openapijsonschematools.client.paths.userusername.put.responses; - -import org.openapijsonschematools.client.configurations.SchemaConfiguration; -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; -import java.net.http.HttpResponse; -import java.net.http.HttpHeaders; - -public class UserusernamePutCode400Response { - - public static class UserusernamePutCode400Response1 extends ResponseDeserializer { - public UserusernamePutCode400Response1() { - super( - MapUtils.makeMap( - ) - ); - } - - @Override - protected Nothing? getBody(String contentType, Nothing? mediaType, byte[] body, SchemaConfiguration configuration) { - return null; - } - - @Override - protected Nothing? getHeaders(HttpHeaders headers, SchemaConfiguration configuration) { - return null; - } - } - - @SuppressWarnings("serial") - public static class ResponseApiException extends ApiException { - public DeserializedHttpResponse deserializedResponse; - - public ResponseApiException(String s, HttpResponse response, DeserializedHttpResponse deserializedResponse) { - super(s, response); - this.deserializedResponse = deserializedResponse; - } - } -} diff --git a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/userusername/put/responses/UserusernamePutCode404Response.kt b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/userusername/put/responses/UserusernamePutCode404Response.kt deleted file mode 100644 index 8e20ce56777..00000000000 --- a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/paths/userusername/put/responses/UserusernamePutCode404Response.kt +++ /dev/null @@ -1,45 +0,0 @@ -package org.openapijsonschematools.client.paths.userusername.put.responses; - -import org.openapijsonschematools.client.configurations.SchemaConfiguration; -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; -import java.net.http.HttpResponse; -import java.net.http.HttpHeaders; - -public class UserusernamePutCode404Response { - - public static class UserusernamePutCode404Response1 extends ResponseDeserializer { - public UserusernamePutCode404Response1() { - super( - MapUtils.makeMap( - ) - ); - } - - @Override - protected Nothing? getBody(String contentType, Nothing? mediaType, byte[] body, SchemaConfiguration configuration) { - return null; - } - - @Override - protected Nothing? getHeaders(HttpHeaders headers, SchemaConfiguration configuration) { - return null; - } - } - - @SuppressWarnings("serial") - public static class ResponseApiException extends ApiException { - public DeserializedHttpResponse deserializedResponse; - - public ResponseApiException(String s, HttpResponse response, DeserializedHttpResponse deserializedResponse) { - super(s, response); - this.deserializedResponse = deserializedResponse; - } - } -} diff --git a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/requestbody/GenericRequestBody.kt b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/requestbody/GenericRequestBody.kt deleted file mode 100644 index 69f2f72cb73..00000000000 --- a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/requestbody/GenericRequestBody.kt +++ /dev/null @@ -1,6 +0,0 @@ -package org.openapijsonschematools.client.requestbody; - -public interface GenericRequestBody { - String contentType(); - SealedSchemaOutputClass body(); -} \ No newline at end of file diff --git a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/requestbody/RequestBodySerializer.kt b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/requestbody/RequestBodySerializer.kt deleted file mode 100644 index 6be6cbffd80..00000000000 --- a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/requestbody/RequestBodySerializer.kt +++ /dev/null @@ -1,47 +0,0 @@ -package org.openapijsonschematools.client.requestbody; - -import java.net.http.HttpRequest; -import org.checkerframework.checker.nullness.qual.Nullable; -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; - -public abstract class RequestBodySerializer { - /* - * Describes a single request body - * content: contentType to MediaType schema info - */ - public final Map content; - public final boolean required; - - public RequestBodySerializer(Map content, boolean required) { - this.content = content; - this.required = required; - } - - private SerializedRequestBody serializeJson(String contentType, @Nullable Object body) { - String jsonText = ContentTypeSerializer.toJson(body); - return new SerializedRequestBody(contentType, HttpRequest.BodyPublishers.ofString(jsonText)); - } - - private SerializedRequestBody serializeTextPlain(String contentType, @Nullable Object body) { - if (body instanceof String stringBody) { - return new SerializedRequestBody(contentType, HttpRequest.BodyPublishers.ofString(stringBody)); - } - throw new RuntimeException("Invalid non-string data type of "+JsonSchema.getClass(body)+" for text/plain body serialization"); - } - - protected SerializedRequestBody serialize(String contentType, @Nullable Object body) throws NotImplementedException { - if (ContentTypeDetector.contentTypeIsJson(contentType)) { - return serializeJson(contentType, body); - } else if (ContentTypeDetector.contentTypeIsTextPlain(contentType)) { - return serializeTextPlain(contentType, body); - } - throw new NotImplementedException("Serialization has not yet been implemented for contentType="+contentType+". If you need it please file a PR"); - } - - public abstract SerializedRequestBody serialize(T requestBody) throws NotImplementedException; -} \ No newline at end of file diff --git a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/requestbody/SerializedRequestBody.kt b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/requestbody/SerializedRequestBody.kt deleted file mode 100644 index 62185c6f7aa..00000000000 --- a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/requestbody/SerializedRequestBody.kt +++ /dev/null @@ -1,13 +0,0 @@ -package org.openapijsonschematools.client.requestbody; - -import java.net.http.HttpRequest; - -public class SerializedRequestBody { - public final String contentType; - public final HttpRequest.BodyPublisher bodyPublisher; - - protected SerializedRequestBody(String contentType, HttpRequest.BodyPublisher bodyPublisher) { - this.contentType = contentType; - this.bodyPublisher = bodyPublisher; - } -} \ No newline at end of file diff --git a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/response/ApiResponse.kt b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/response/ApiResponse.kt deleted file mode 100644 index dab55e0f2da..00000000000 --- a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/response/ApiResponse.kt +++ /dev/null @@ -1,9 +0,0 @@ -package org.openapijsonschematools.client.response; - -import java.net.http.HttpResponse; - -public interface ApiResponse { - HttpResponse response(); - SealedBodyOutputClass body(); - HeaderOutputClass headers(); -} \ No newline at end of file diff --git a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/response/DeserializedHttpResponse.kt b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/response/DeserializedHttpResponse.kt deleted file mode 100644 index d9c62c28c70..00000000000 --- a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/response/DeserializedHttpResponse.kt +++ /dev/null @@ -1,6 +0,0 @@ -package org.openapijsonschematools.client.response; - -import java.net.http.HttpResponse; - -public record DeserializedHttpResponse(SealedBodyOutputClass body, HeaderOutputClass headers) { -} \ No newline at end of file diff --git a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/response/HeadersDeserializer.kt b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/response/HeadersDeserializer.kt deleted file mode 100644 index 9ec3e3c44a6..00000000000 --- a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/response/HeadersDeserializer.kt +++ /dev/null @@ -1,37 +0,0 @@ -package org.openapijsonschematools.client.response; - -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; - -import java.net.http.HttpHeaders; -import java.util.HashMap; -import java.util.List; -import java.util.Map; - -public abstract class HeadersDeserializer { - private final Map headers; - final private MapSchemaValidator headersSchema; - public HeadersDeserializer(Map headers, MapSchemaValidator headersSchema) { - this.headers = headers; - this.headersSchema = headersSchema; - } - - public OutType deserialize(HttpHeaders responseHeaders, SchemaConfiguration configuration) throws ValidationException, NotImplementedException { - Map headersToValidate = new HashMap<>(); - for (Map.Entry> entry: responseHeaders.map().entrySet()) { - String headerName = entry.getKey(); - Header headerDeserializer = headers.get(headerName); - if (headerDeserializer == null) { - // todo put this data in headersToValidate, if only one item in list load it in, otherwise join them with commas - continue; - } - @Nullable Object headerValue = headerDeserializer.deserialize(entry.getValue(), false, configuration); - headersToValidate.put(headerName, headerValue); - } - return headersSchema.validate(headersToValidate, configuration); - } -} diff --git a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/response/ResponseDeserializer.kt b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/response/ResponseDeserializer.kt deleted file mode 100644 index 640f2a96415..00000000000 --- a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/response/ResponseDeserializer.kt +++ /dev/null @@ -1,74 +0,0 @@ -package org.openapijsonschematools.client.response; - -import java.net.http.HttpHeaders; -import java.net.http.HttpResponse; -import java.nio.charset.StandardCharsets; -import java.util.Map; -import java.util.Optional; - -import org.checkerframework.checker.nullness.qual.Nullable; - -import 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; - - public ResponseDeserializer(Map content) { - this.content = content; - this.headers = null; - } - - protected abstract SealedBodyClass getBody(String contentType, SealedMediaTypeClass mediaType, byte[] body, SchemaConfiguration configuration) throws ValidationException, NotImplementedException; - protected abstract HeaderClass getHeaders(HttpHeaders headers, SchemaConfiguration configuration) throws ValidationException, NotImplementedException; - - protected @Nullable Object deserializeJson(byte[] body) { - String bodyStr = new String(body, StandardCharsets.UTF_8); - return ContentTypeDeserializer.fromJson(bodyStr); - } - - protected String deserializeTextPlain(byte[] body) { - return new String(body, StandardCharsets.UTF_8); - } - - protected T deserializeBody(String contentType, byte[] body, JsonSchema schema, SchemaConfiguration configuration) throws ValidationException, NotImplementedException { - if (ContentTypeDetector.contentTypeIsJson(contentType)) { - @Nullable Object bodyData = deserializeJson(body); - return schema.validateAndBox(bodyData, configuration); - } else if (ContentTypeDetector.contentTypeIsTextPlain(contentType)) { - String bodyData = deserializeTextPlain(body); - return schema.validateAndBox(bodyData, configuration); - } - throw new NotImplementedException("Deserialization for contentType="+contentType+" has not yet been implemented."); - } - - public DeserializedHttpResponse deserialize(HttpResponse response, SchemaConfiguration configuration) throws ValidationException, NotImplementedException, ApiException { - Optional contentTypeInfo = response.headers().firstValue("Content-Type"); - if (contentTypeInfo.isEmpty()) { - throw new ApiException( - "Invalid response returned, Content-Type header is missing and it must be included", - response - ); - } - String contentType = contentTypeInfo.get(); - @Nullable SealedMediaTypeClass mediaType = content.get(contentType); - if (mediaType == null) { - throw new ApiException( - "Invalid contentType returned. contentType="+contentType+" was returned "+ - "when only "+content.keySet()+" are defined for statusCode="+response.statusCode(), - response - ); - } - byte[] bodyBytes = response.body(); - SealedBodyClass body = getBody(contentType, mediaType, bodyBytes, configuration); - HeaderClass headers = getHeaders(response.headers(), configuration); - return new DeserializedHttpResponse<>(body, headers); - } -} \ No newline at end of file diff --git a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/response/ResponsesDeserializer.kt b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/response/ResponsesDeserializer.kt deleted file mode 100644 index f72be2313af..00000000000 --- a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/response/ResponsesDeserializer.kt +++ /dev/null @@ -1,11 +0,0 @@ -package org.openapijsonschematools.client.response; - -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; -} \ No newline at end of file diff --git a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/restclient/RestClient.kt b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/restclient/RestClient.kt deleted file mode 100644 index 3cfc70284ca..00000000000 --- a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/restclient/RestClient.kt +++ /dev/null @@ -1,67 +0,0 @@ -package org.openapijsonschematools.client.restclient; - -import org.checkerframework.checker.nullness.qual.Nullable; -import java.io.IOException; -import java.net.URI; -import java.net.http.HttpClient; -import java.net.http.HttpRequest; -import java.net.http.HttpResponse; -import java.time.Duration; -import java.util.List; -import java.util.Map; - -public class RestClient { - public static HttpRequest getRequest( - String serviceUrl, - String method, - HttpRequest.BodyPublisher bodyPublisher, - Map> headers, - @Nullable Duration timeout - ) { - HttpRequest.Builder request = HttpRequest.newBuilder(URI.create(serviceUrl)); - switch (method) { - case "get": - request.GET(); - break; - case "put": - request.method("PUT", bodyPublisher); - break; - case "patch": - request.method("PATCH", bodyPublisher); - break; - case "post": - request.method("POST", bodyPublisher); - break; - case "delete": - request.DELETE(); - break; - case "trace": - request.method("TRACE", bodyPublisher); - break; - case "options": - request.method("OPTIONS", bodyPublisher); - break; - case "head": - request.method("HEAD", bodyPublisher); - break; - case "connect": - request.method("CONNECT", bodyPublisher); - break; - default: - throw new RuntimeException("Invalid http method"); - } - for (Map.Entry> entry: headers.entrySet()) { - String headerName = entry.getKey(); - String headerValue = String.join(", ", entry.getValue()); - request.header(headerName, headerValue); - } - if (timeout != null) { - request.timeout(timeout); - } - return request.build(); - } - - public static HttpResponse getResponse(HttpRequest request, HttpClient client) throws IOException, InterruptedException { - return client.send(request, HttpResponse.BodyHandlers.ofByteArray()); - } -} diff --git a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/schemas/SetMaker.kt b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/schemas/SetMaker.kt deleted file mode 100644 index 02fb8ffb3be..00000000000 --- a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/schemas/SetMaker.kt +++ /dev/null @@ -1,20 +0,0 @@ -package org.openapijsonschematools.client.schemas; - -import java.util.HashSet; -import java.util.Set; - -/** - * A builder for maps that allows in null values - * Schema tests + doc code samples need it - */ -public class SetMaker { - @SafeVarargs - @SuppressWarnings("varargs") - public static Set makeSet(E... items) { - Set set = new HashSet<>(); - for (E item : items) { - set.add(item); - } - return set; - } -} \ No newline at end of file diff --git a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/schemas/UnsetAddPropsSetter.kt b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/schemas/UnsetAddPropsSetter.kt deleted file mode 100644 index 246e346cdac..00000000000 --- a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/schemas/UnsetAddPropsSetter.kt +++ /dev/null @@ -1,77 +0,0 @@ -package org.openapijsonschematools.client.schemas; - -import org.checkerframework.checker.nullness.qual.Nullable; -import org.openapijsonschematools.client.exceptions.InvalidAdditionalPropertyException; -import org.openapijsonschematools.client.schemas.validation.MapUtils; - -import java.util.List; -import java.util.Map; -import java.util.Set; - -public abstract class UnsetAddPropsSetter { - public abstract Map getInstance(); - public abstract Set getKnownKeys(); - public abstract T getBuilderAfterAdditionalProperty(Map instance); - public T additionalProperty(String key, Nothing? value) throws InvalidAdditionalPropertyException { - MapUtils.throwIfKeyKnown(key, getKnownKeys(), true); - var instance = getInstance(); - instance.put(key, value); - return getBuilderAfterAdditionalProperty(instance); - } - - public T additionalProperty(String key, boolean value) throws InvalidAdditionalPropertyException { - MapUtils.throwIfKeyKnown(key, getKnownKeys(), true); - var instance = getInstance(); - instance.put(key, value); - return getBuilderAfterAdditionalProperty(instance); - } - - public T additionalProperty(String key, String value) throws InvalidAdditionalPropertyException { - MapUtils.throwIfKeyKnown(key, getKnownKeys(), true); - var instance = getInstance(); - instance.put(key, value); - return getBuilderAfterAdditionalProperty(instance); - } - - public T additionalProperty(String key, int value) throws InvalidAdditionalPropertyException { - MapUtils.throwIfKeyKnown(key, getKnownKeys(), true); - var instance = getInstance(); - instance.put(key, value); - return getBuilderAfterAdditionalProperty(instance); - } - - public T additionalProperty(String key, float value) throws InvalidAdditionalPropertyException { - MapUtils.throwIfKeyKnown(key, getKnownKeys(), true); - var instance = getInstance(); - instance.put(key, value); - return getBuilderAfterAdditionalProperty(instance); - } - - public T additionalProperty(String key, long value) throws InvalidAdditionalPropertyException { - MapUtils.throwIfKeyKnown(key, getKnownKeys(), true); - var instance = getInstance(); - instance.put(key, value); - return getBuilderAfterAdditionalProperty(instance); - } - - public T additionalProperty(String key, double value) throws InvalidAdditionalPropertyException { - MapUtils.throwIfKeyKnown(key, getKnownKeys(), true); - var instance = getInstance(); - instance.put(key, value); - return getBuilderAfterAdditionalProperty(instance); - } - - public T additionalProperty(String key, List value) throws InvalidAdditionalPropertyException { - MapUtils.throwIfKeyKnown(key, getKnownKeys(), true); - var instance = getInstance(); - instance.put(key, value); - return getBuilderAfterAdditionalProperty(instance); - } - - public T additionalProperty(String key, Map value) throws InvalidAdditionalPropertyException { - MapUtils.throwIfKeyKnown(key, getKnownKeys(), true); - var instance = getInstance(); - instance.put(key, value); - return getBuilderAfterAdditionalProperty(instance); - } -} diff --git a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/schemas/UuidJsonSchema.kt b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/schemas/UuidJsonSchema.kt deleted file mode 100644 index c9ccef0420e..00000000000 --- a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/schemas/UuidJsonSchema.kt +++ /dev/null @@ -1,94 +0,0 @@ -package org.openapijsonschematools.client.schemas; - -import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags; -import org.openapijsonschematools.client.exceptions.ValidationException; -import org.openapijsonschematools.client.schemas.validation.JsonSchema; -import org.openapijsonschematools.client.schemas.validation.JsonSchemaInfo; -import org.openapijsonschematools.client.configurations.SchemaConfiguration; -import org.openapijsonschematools.client.schemas.validation.PathToSchemasMap; -import org.openapijsonschematools.client.schemas.validation.StringSchemaValidator; -import org.openapijsonschematools.client.schemas.validation.ValidationMetadata; -import org.checkerframework.checker.nullness.qual.Nullable; - -import java.util.HashSet; -import java.util.LinkedHashSet; -import java.util.List; -import java.util.Objects; -import java.util.Set; -import java.util.UUID; - -public class UuidJsonSchema { - public sealed interface UuidJsonSchema1Boxed permits UuidJsonSchema1BoxedString { - @Nullable Object getData(); - } - public record UuidJsonSchema1BoxedString(String data) implements UuidJsonSchema1Boxed { - @Override - public @Nullable Object getData() { - return data; - } - } - - public static class UuidJsonSchema1 extends JsonSchema implements StringSchemaValidator { - private static @Nullable UuidJsonSchema1 instance = null; - - protected UuidJsonSchema1() { - super(new JsonSchemaInfo() - .type(Set.of(String.class)) - .format("uuid") - ); - } - - public static UuidJsonSchema1 getInstance() { - if (instance == null) { - instance = new UuidJsonSchema1(); - } - return instance; - } - - @Override - public String validate(String arg, SchemaConfiguration configuration) throws ValidationException { - Set> pathSet = new HashSet<>(); - List pathToItem = List.of("args[0"); - String castArg = castToAllowedTypes(arg, pathToItem, pathSet); - SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().build())); - ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, new PathToSchemasMap(), new LinkedHashSet<>()); - PathToSchemasMap pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet); - return getNewInstance(castArg, validationMetadata.pathToItem(), pathToSchemasMap); - } - - public String validate(UUID arg, SchemaConfiguration configuration) throws ValidationException { - return validate(arg.toString(), configuration); - } - - @Override - public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { - 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"); - } - - @Override - 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 ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); - } - - @Override - 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 { - 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"); - } - } -} \ No newline at end of file diff --git a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/schemas/validation/BooleanEnumValidator.kt b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/schemas/validation/BooleanEnumValidator.kt deleted file mode 100644 index 7e80fd207c2..00000000000 --- a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/schemas/validation/BooleanEnumValidator.kt +++ /dev/null @@ -1,8 +0,0 @@ -package org.openapijsonschematools.client.schemas.validation; - -import org.openapijsonschematools.client.configurations.SchemaConfiguration; -import org.openapijsonschematools.client.exceptions.ValidationException; - -public interface BooleanEnumValidator { - boolean validate(EnumType arg, SchemaConfiguration configuration) throws ValidationException; -} \ No newline at end of file diff --git a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/schemas/validation/BooleanValueMethod.kt b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/schemas/validation/BooleanValueMethod.kt deleted file mode 100644 index 709b30f7227..00000000000 --- a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/schemas/validation/BooleanValueMethod.kt +++ /dev/null @@ -1,5 +0,0 @@ -package org.openapijsonschematools.client.schemas.validation; - -public interface BooleanValueMethod { - boolean value(); -} \ No newline at end of file diff --git a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/schemas/validation/DefaultValueMethod.kt b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/schemas/validation/DefaultValueMethod.kt deleted file mode 100644 index 1f1d1ba5e68..00000000000 --- a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/schemas/validation/DefaultValueMethod.kt +++ /dev/null @@ -1,7 +0,0 @@ -package org.openapijsonschematools.client.schemas.validation; - -import org.openapijsonschematools.client.exceptions.ValidationException; - -public interface DefaultValueMethod { - T defaultValue() throws ValidationException; -} \ No newline at end of file diff --git a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/schemas/validation/DoubleEnumValidator.kt b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/schemas/validation/DoubleEnumValidator.kt deleted file mode 100644 index f2b8b1e7d74..00000000000 --- a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/schemas/validation/DoubleEnumValidator.kt +++ /dev/null @@ -1,8 +0,0 @@ -package org.openapijsonschematools.client.schemas.validation; - -import org.openapijsonschematools.client.configurations.SchemaConfiguration; -import org.openapijsonschematools.client.exceptions.ValidationException; - -public interface DoubleEnumValidator { - double validate(EnumType arg, SchemaConfiguration configuration) throws ValidationException; -} \ No newline at end of file diff --git a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/schemas/validation/DoubleValueMethod.kt b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/schemas/validation/DoubleValueMethod.kt deleted file mode 100644 index 41c9e8e577a..00000000000 --- a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/schemas/validation/DoubleValueMethod.kt +++ /dev/null @@ -1,5 +0,0 @@ -package org.openapijsonschematools.client.schemas.validation; - -public interface DoubleValueMethod { - double value(); -} \ No newline at end of file diff --git a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/schemas/validation/FloatEnumValidator.kt b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/schemas/validation/FloatEnumValidator.kt deleted file mode 100644 index 17317003a34..00000000000 --- a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/schemas/validation/FloatEnumValidator.kt +++ /dev/null @@ -1,8 +0,0 @@ -package org.openapijsonschematools.client.schemas.validation; - -import org.openapijsonschematools.client.configurations.SchemaConfiguration; -import org.openapijsonschematools.client.exceptions.ValidationException; - -public interface FloatEnumValidator { - float validate(EnumType arg, SchemaConfiguration configuration) throws ValidationException; -} \ No newline at end of file diff --git a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/schemas/validation/FloatValueMethod.kt b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/schemas/validation/FloatValueMethod.kt deleted file mode 100644 index da72f3eac58..00000000000 --- a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/schemas/validation/FloatValueMethod.kt +++ /dev/null @@ -1,5 +0,0 @@ -package org.openapijsonschematools.client.schemas.validation; - -public interface FloatValueMethod { - float value(); -} \ No newline at end of file diff --git a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/schemas/validation/IntegerEnumValidator.kt b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/schemas/validation/IntegerEnumValidator.kt deleted file mode 100644 index cb20c832f9b..00000000000 --- a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/schemas/validation/IntegerEnumValidator.kt +++ /dev/null @@ -1,8 +0,0 @@ -package org.openapijsonschematools.client.schemas.validation; - -import org.openapijsonschematools.client.configurations.SchemaConfiguration; -import org.openapijsonschematools.client.exceptions.ValidationException; - -public interface IntegerEnumValidator { - int validate(EnumType arg, SchemaConfiguration configuration) throws ValidationException; -} \ No newline at end of file diff --git a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/schemas/validation/IntegerValueMethod.kt b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/schemas/validation/IntegerValueMethod.kt deleted file mode 100644 index dbfe29ce3f1..00000000000 --- a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/schemas/validation/IntegerValueMethod.kt +++ /dev/null @@ -1,5 +0,0 @@ -package org.openapijsonschematools.client.schemas.validation; - -public interface IntegerValueMethod { - int value(); -} \ No newline at end of file diff --git a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/schemas/validation/KeywordEntry.kt b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/schemas/validation/KeywordEntry.kt deleted file mode 100644 index c00f0c4804e..00000000000 --- a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/schemas/validation/KeywordEntry.kt +++ /dev/null @@ -1,10 +0,0 @@ -package org.openapijsonschematools.client.schemas.validation; - -import java.util.AbstractMap; - -@SuppressWarnings("serial") -public class KeywordEntry extends AbstractMap.SimpleEntry { - public KeywordEntry(String key, KeywordValidator value) { - super(key, value); - } -} diff --git a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/schemas/validation/LongEnumValidator.kt b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/schemas/validation/LongEnumValidator.kt deleted file mode 100644 index 6b6bcd88c47..00000000000 --- a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/schemas/validation/LongEnumValidator.kt +++ /dev/null @@ -1,8 +0,0 @@ -package org.openapijsonschematools.client.schemas.validation; - -import org.openapijsonschematools.client.configurations.SchemaConfiguration; -import org.openapijsonschematools.client.exceptions.ValidationException; - -public interface LongEnumValidator { - long validate(EnumType arg, SchemaConfiguration configuration) throws ValidationException; -} \ No newline at end of file diff --git a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/schemas/validation/LongValueMethod.kt b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/schemas/validation/LongValueMethod.kt deleted file mode 100644 index 866d0d3ed01..00000000000 --- a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/schemas/validation/LongValueMethod.kt +++ /dev/null @@ -1,5 +0,0 @@ -package org.openapijsonschematools.client.schemas.validation; - -public interface LongValueMethod { - long value(); -} \ No newline at end of file diff --git a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/schemas/validation/MapUtils.kt b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/schemas/validation/MapUtils.kt deleted file mode 100644 index e94182da537..00000000000 --- a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/schemas/validation/MapUtils.kt +++ /dev/null @@ -1,33 +0,0 @@ -package org.openapijsonschematools.client.schemas.validation - -import org.openapijsonschematools.client.exceptions.InvalidAdditionalPropertyException - -object MapUtils { - /** - * A builder for maps that allows in null values - * Schema tests + doc code samples need it - * @param entries items to add - * @return the output map - * @param key type - * @param value type - */ - @SafeVarargs - fun makeMap(vararg entries: Map.Entry): Map { - val map: MutableMap = HashMap() - for ((key, value) in entries) { - map[key] = value - } - return map - } - - @Throws(InvalidAdditionalPropertyException::class) - fun throwIfKeyKnown(key: String, knownKeys: Set, setting: Boolean) { - if (knownKeys.contains(key)) { - var verb = "getting" - if (setting) { - verb = "setting" - } - throw InvalidAdditionalPropertyException("The known key $key may not be passed in when $verb an additional property") - } - } -} \ No newline at end of file diff --git a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/schemas/validation/NullEnumValidator.kt b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/schemas/validation/NullEnumValidator.kt deleted file mode 100644 index 56cfc56c127..00000000000 --- a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/schemas/validation/NullEnumValidator.kt +++ /dev/null @@ -1,8 +0,0 @@ -package org.openapijsonschematools.client.schemas.validation; - -import org.openapijsonschematools.client.configurations.SchemaConfiguration; -import org.openapijsonschematools.client.exceptions.ValidationException; - -public interface NullEnumValidator { - Nothing? validate(EnumType arg, SchemaConfiguration configuration) throws ValidationException; -} \ No newline at end of file diff --git a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/schemas/validation/NullValueMethod.kt b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/schemas/validation/NullValueMethod.kt deleted file mode 100644 index dc704b437e9..00000000000 --- a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/schemas/validation/NullValueMethod.kt +++ /dev/null @@ -1,5 +0,0 @@ -package org.openapijsonschematools.client.schemas.validation; - -public interface NullValueMethod { - Nothing? value(); -} \ No newline at end of file diff --git a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/schemas/validation/PropertyEntry.kt b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/schemas/validation/PropertyEntry.kt deleted file mode 100644 index 8261eda6d49..00000000000 --- a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/schemas/validation/PropertyEntry.kt +++ /dev/null @@ -1,10 +0,0 @@ -package org.openapijsonschematools.client.schemas.validation; - -import java.util.AbstractMap; - -@SuppressWarnings("serial") -public class PropertyEntry extends AbstractMap.SimpleEntry>> { - public PropertyEntry(String key, Class> value) { - super(key, value); - } -} \ No newline at end of file diff --git a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/schemas/validation/StringEnumValidator.kt b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/schemas/validation/StringEnumValidator.kt deleted file mode 100644 index baf86081fd7..00000000000 --- a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/schemas/validation/StringEnumValidator.kt +++ /dev/null @@ -1,8 +0,0 @@ -package org.openapijsonschematools.client.schemas.validation; - -import org.openapijsonschematools.client.configurations.SchemaConfiguration; -import org.openapijsonschematools.client.exceptions.ValidationException; - -public interface StringEnumValidator { - String validate(EnumType arg, SchemaConfiguration configuration) throws ValidationException; -} \ No newline at end of file diff --git a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/schemas/validation/StringValueMethod.kt b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/schemas/validation/StringValueMethod.kt deleted file mode 100644 index c038476947f..00000000000 --- a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/schemas/validation/StringValueMethod.kt +++ /dev/null @@ -1,5 +0,0 @@ -package org.openapijsonschematools.client.schemas.validation; - -public interface StringValueMethod { - String value(); -} \ No newline at end of file diff --git a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/schemas/validation/ValidationData.kt b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/schemas/validation/ValidationData.kt deleted file mode 100644 index 4ac4e182fc6..00000000000 --- a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/schemas/validation/ValidationData.kt +++ /dev/null @@ -1,11 +0,0 @@ -package org.openapijsonschematools.client.schemas.validation - -data class ValidationData( - val schema: JsonSchema<*>, - val arg: Any?, - val validationMetadata: ValidationMetadata, - val containsPathToSchemas: List?, - val patternPropertiesPathToSchemas: PathToSchemasMap?, - val ifPathToSchemas: PathToSchemasMap?, - val knownPathToSchemas: PathToSchemasMap? -) \ No newline at end of file diff --git a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/securityrequirementobjects/AuthApplier.kt b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/securityrequirementobjects/AuthApplier.kt deleted file mode 100644 index b54493b928e..00000000000 --- a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/securityrequirementobjects/AuthApplier.kt +++ /dev/null @@ -1,40 +0,0 @@ -package org.openapijsonschematools.client.securityrequirementobjects; - -import org.checkerframework.checker.nullness.qual.Nullable; -import org.openapijsonschematools.client.securityschemes.SecurityScheme; -import org.openapijsonschematools.client.configurations.ApiConfiguration; - -import java.net.http.HttpRequest; -import java.util.List; -import java.util.Map; - -public class AuthApplier { - protected static void updateParamsForAuth( - @Nullable SecurityRequirementObject securityRequirementObject, - Map> headers, - String resourcePath, - String method, - HttpRequest.BodyPublisher bodyPublisher, - @Nullable Map queryMap, - ApiConfiguration apiConfiguration - ) { - if (securityRequirementObject == null) { - return; - } - // TODO change securityRequirementObject to be a map of enum to scopes - // TODO store the SecurityScheme instances in a map in apiConfiguration - for (Map.Entry, List> entry: securityRequirementObject.securitySchemeToScopes.entrySet()) { - Class securitySchemeClass = entry.getKey(); - SecurityScheme securityScheme = apiConfiguration.getSecurityScheme(securitySchemeClass); - List scopeNames = entry.getValue(); - securityScheme.applyAuth( - headers, - resourcePath, - method, - bodyPublisher, - queryMap, - scopeNames - ); - } - } -} diff --git a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/securityrequirementobjects/EmptySecurityRequirementObject.kt b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/securityrequirementobjects/EmptySecurityRequirementObject.kt deleted file mode 100644 index c51a0ae3b49..00000000000 --- a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/securityrequirementobjects/EmptySecurityRequirementObject.kt +++ /dev/null @@ -1,10 +0,0 @@ -package org.openapijsonschematools.client.securityrequirementobjects; - -import java.util.Map; - -public class EmptySecurityRequirementObject extends SecurityRequirementObject { - - public EmptySecurityRequirementObject() { - super(Map.of()); - } -} diff --git a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/securityrequirementobjects/SecurityRequirementObject.kt b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/securityrequirementobjects/SecurityRequirementObject.kt deleted file mode 100644 index bc0ffde6eed..00000000000 --- a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/securityrequirementobjects/SecurityRequirementObject.kt +++ /dev/null @@ -1,14 +0,0 @@ -package org.openapijsonschematools.client.securityrequirementobjects; - -import org.openapijsonschematools.client.securityschemes.SecurityScheme; - -import java.util.List; -import java.util.Map; - -public class SecurityRequirementObject { - public final Map, List> securitySchemeToScopes; - - public SecurityRequirementObject(Map, List> securitySchemeToScopes) { - this.securitySchemeToScopes = securitySchemeToScopes; - } -} diff --git a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/securityrequirementobjects/SecurityRequirementObjectProvider.kt b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/securityrequirementobjects/SecurityRequirementObjectProvider.kt deleted file mode 100644 index 9cf6147b8f1..00000000000 --- a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/securityrequirementobjects/SecurityRequirementObjectProvider.kt +++ /dev/null @@ -1,6 +0,0 @@ -package org.openapijsonschematools.client.securityrequirementobjects; - -public interface SecurityRequirementObjectProvider { - SecurityRequirementObject getSecurityRequirementObject(T securityIndex); -} - diff --git a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/securityschemes/ApiKeyCookieSecurityScheme.kt b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/securityschemes/ApiKeyCookieSecurityScheme.kt deleted file mode 100644 index fc81f2416a3..00000000000 --- a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/securityschemes/ApiKeyCookieSecurityScheme.kt +++ /dev/null @@ -1,35 +0,0 @@ -package org.openapijsonschematools.client.securityschemes; - -import org.checkerframework.checker.nullness.qual.Nullable; - -import java.net.http.HttpRequest; -import java.util.ArrayList; -import java.util.List; -import java.util.Map; - -public class ApiKeyCookieSecurityScheme implements SecurityScheme { - private final String apiKey; - private final String name; - - protected ApiKeyCookieSecurityScheme(String apiKey, String name) { - this.apiKey = apiKey; - this.name = name; - } - - @Override - public void applyAuth( - Map> headers, - String resourcePath, String method, - HttpRequest.BodyPublisher bodyPublisher, - @Nullable Map queryMap, - List scopeNames - ) { - List cookieHeaderValues = headers.getOrDefault("Cookie", new ArrayList<>()); - String cookieValue = name + "=" + apiKey; - if (cookieHeaderValues.isEmpty()) { - cookieHeaderValues.add(cookieValue); - } else { - cookieHeaderValues.set(0, cookieHeaderValues.get(0)+ "; " + cookieValue); - } - } -} \ No newline at end of file diff --git a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/securityschemes/ApiKeyHeaderSecurityScheme.kt b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/securityschemes/ApiKeyHeaderSecurityScheme.kt deleted file mode 100644 index 05f56190117..00000000000 --- a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/securityschemes/ApiKeyHeaderSecurityScheme.kt +++ /dev/null @@ -1,31 +0,0 @@ -package org.openapijsonschematools.client.securityschemes; - -import org.checkerframework.checker.nullness.qual.Nullable; - -import java.net.http.HttpRequest; -import java.util.ArrayList; -import java.util.List; -import java.util.Map; - -public class ApiKeyHeaderSecurityScheme implements SecurityScheme { - private final String apiKey; - private final String name; - - protected ApiKeyHeaderSecurityScheme(String apiKey, String name) { - this.apiKey = apiKey; - this.name = name; - } - - @Override - public void applyAuth( - Map> headers, - String resourcePath, - String method, - HttpRequest.BodyPublisher bodyPublisher, - @Nullable Map queryMap, - List scopeNames - ) { - List headerValue = headers.getOrDefault(name, new ArrayList<>()); - headerValue.add(apiKey); - } -} \ No newline at end of file diff --git a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/securityschemes/ApiKeyQuerySecurityScheme.kt b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/securityschemes/ApiKeyQuerySecurityScheme.kt deleted file mode 100644 index dd1114e9b4a..00000000000 --- a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/securityschemes/ApiKeyQuerySecurityScheme.kt +++ /dev/null @@ -1,33 +0,0 @@ -package org.openapijsonschematools.client.securityschemes; - -import org.checkerframework.checker.nullness.qual.Nullable; - -import java.net.http.HttpRequest; -import java.util.ArrayList; -import java.util.List; -import java.util.Map; - -public class ApiKeyQuerySecurityScheme implements SecurityScheme { - private final String apiKey; - private final String name; - - protected ApiKeyQuerySecurityScheme(String apiKey, String name) { - this.apiKey = apiKey; - this.name = name; - } - - @Override - public void applyAuth( - Map> headers, - String resourcePath, - String method, - HttpRequest.BodyPublisher bodyPublisher, - @Nullable Map queryMap, - List scopeNames - ) { - if (queryMap == null) { - throw new RuntimeException("Invalid null value for queryMap"); - } - queryMap.put(name, apiKey); - } -} \ No newline at end of file diff --git a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/securityschemes/HttpBasicSecurityScheme.kt b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/securityschemes/HttpBasicSecurityScheme.kt deleted file mode 100644 index 20b2d828145..00000000000 --- a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/securityschemes/HttpBasicSecurityScheme.kt +++ /dev/null @@ -1,39 +0,0 @@ -package org.openapijsonschematools.client.securityschemes; - -import org.checkerframework.checker.nullness.qual.Nullable; - -import java.net.http.HttpRequest; -import java.nio.charset.StandardCharsets; -import java.util.ArrayList; -import java.util.Base64; -import java.util.List; -import java.util.Map; - -public class HttpBasicSecurityScheme implements SecurityScheme { - private final String userId; - private final String password; - /* - scheme = BASIC, type = HTTP - https://www.rfc-editor.org/rfc/rfc7617.html - */ - - public HttpBasicSecurityScheme(String userId, String password) { - this.userId = userId; - this.password = password; - } - - @Override - public void applyAuth( - Map> headers, - String resourcePath, - String method, - HttpRequest.BodyPublisher bodyPublisher, - @Nullable Map queryMap, - List scopeNames - ) { - String userPass = userId + ":" + password; - String b64UserPass = Base64.getEncoder().encodeToString(userPass.getBytes(StandardCharsets.UTF_8)); - List headerValue = headers.getOrDefault("Authorization", new ArrayList<>()); - headerValue.add("Basic " + b64UserPass); - } -} \ No newline at end of file diff --git a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/securityschemes/HttpBearerSecurityScheme.kt b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/securityschemes/HttpBearerSecurityScheme.kt deleted file mode 100644 index ecc9c23b586..00000000000 --- a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/securityschemes/HttpBearerSecurityScheme.kt +++ /dev/null @@ -1,41 +0,0 @@ -package org.openapijsonschematools.client.securityschemes; - -import org.checkerframework.checker.nullness.qual.Nullable; - -import java.net.http.HttpRequest; -import java.util.ArrayList; -import java.util.Base64; -import java.util.List; -import java.util.Map; - -public class HttpBearerSecurityScheme implements SecurityScheme { - private final String accessToken; - private final @Nullable String bearerFormat; - /* - scheme = BEARER, type = HTTP - https://www.rfc-editor.org/rfc/rfc7617.html - */ - - protected HttpBearerSecurityScheme(String accessToken, @Nullable String bearerFormat) { - this.accessToken = accessToken; - this.bearerFormat = bearerFormat; - } - - protected HttpBearerSecurityScheme(String accessToken) { - this.accessToken = accessToken; - this.bearerFormat = null; - } - - @Override - public void applyAuth( - Map> headers, - String resourcePath, - String method, - HttpRequest.BodyPublisher bodyPublisher, - @Nullable Map queryMap, - List scopeNames - ) { - List headerValue = headers.getOrDefault("Authorization", new ArrayList<>()); - headerValue.add("Bearer " + accessToken); - } -} \ No newline at end of file diff --git a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/securityschemes/HttpDigestSecurityScheme.kt b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/securityschemes/HttpDigestSecurityScheme.kt deleted file mode 100644 index 6d5f67859c1..00000000000 --- a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/securityschemes/HttpDigestSecurityScheme.kt +++ /dev/null @@ -1,21 +0,0 @@ -package org.openapijsonschematools.client.securityschemes; - -import org.checkerframework.checker.nullness.qual.Nullable; - -import java.net.http.HttpRequest; -import java.util.List; -import java.util.Map; - -public class HttpDigestSecurityScheme implements SecurityScheme { - @Override - public void applyAuth( - Map> headers, - String resourcePath, - String method, - HttpRequest.BodyPublisher bodyPublisher, - @Nullable Map queryMap, - List scopeNames - ) { - throw new UnsupportedOperationException("If you need this, submit a PR adding this feature"); - } -} \ No newline at end of file diff --git a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/securityschemes/HttpSignatureSecurityScheme.kt b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/securityschemes/HttpSignatureSecurityScheme.kt deleted file mode 100644 index b59ca2475c4..00000000000 --- a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/securityschemes/HttpSignatureSecurityScheme.kt +++ /dev/null @@ -1,21 +0,0 @@ -package org.openapijsonschematools.client.securityschemes; - -import org.checkerframework.checker.nullness.qual.Nullable; - -import java.net.http.HttpRequest; -import java.util.List; -import java.util.Map; - -public class HttpSignatureSecurityScheme implements SecurityScheme { - @Override - public void applyAuth( - Map> headers, - String resourcePath, - String method, - HttpRequest.BodyPublisher bodyPublisher, - @Nullable Map queryMap, - List scopeNames - ) { - throw new UnsupportedOperationException("If you need this, submit a PR adding this feature"); - } -} \ No newline at end of file diff --git a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/securityschemes/MutualTlsSecurityScheme.kt b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/securityschemes/MutualTlsSecurityScheme.kt deleted file mode 100644 index ce5fc9cd1b5..00000000000 --- a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/securityschemes/MutualTlsSecurityScheme.kt +++ /dev/null @@ -1,20 +0,0 @@ -package org.openapijsonschematools.client.securityschemes; - -import org.checkerframework.checker.nullness.qual.Nullable; - -import java.net.http.HttpRequest; -import java.util.List; -import java.util.Map; - -public class MutualTlsSecurityScheme implements SecurityScheme { - @Override - public void applyAuth( - Map> headers, - String resourcePath, String method, - HttpRequest.BodyPublisher bodyPublisher, - @Nullable Map queryMap, - List scopeNames - ) { - throw new UnsupportedOperationException("If you need this, submit a PR adding this feature"); - } -} \ No newline at end of file diff --git a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/securityschemes/OAuth2SecurityScheme.kt b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/securityschemes/OAuth2SecurityScheme.kt deleted file mode 100644 index 82b1d63f7f7..00000000000 --- a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/securityschemes/OAuth2SecurityScheme.kt +++ /dev/null @@ -1,21 +0,0 @@ -package org.openapijsonschematools.client.securityschemes; - -import org.checkerframework.checker.nullness.qual.Nullable; - -import java.net.http.HttpRequest; -import java.util.List; -import java.util.Map; - -public class OAuth2SecurityScheme implements SecurityScheme { - @Override - public void applyAuth( - Map> headers, - String resourcePath, - String method, - HttpRequest.BodyPublisher bodyPublisher, - @Nullable Map queryMap, - List scopeNames - ) { - throw new UnsupportedOperationException("If you need this, submit a PR adding this feature"); - } -} \ No newline at end of file diff --git a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/securityschemes/OpenIdConnectSecurityScheme.kt b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/securityschemes/OpenIdConnectSecurityScheme.kt deleted file mode 100644 index a87d3e4eed6..00000000000 --- a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/securityschemes/OpenIdConnectSecurityScheme.kt +++ /dev/null @@ -1,21 +0,0 @@ -package org.openapijsonschematools.client.securityschemes; - -import org.checkerframework.checker.nullness.qual.Nullable; - -import java.net.http.HttpRequest; -import java.util.List; -import java.util.Map; - -public class OpenIdConnectSecurityScheme implements SecurityScheme { - @Override - public void applyAuth( - Map> headers, - String resourcePath, - String method, - HttpRequest.BodyPublisher bodyPublisher, - @Nullable Map queryMap, - List scopeNames - ) { - throw new UnsupportedOperationException("If you need this, submit a PR adding this feature"); - } -} \ No newline at end of file diff --git a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/securityschemes/SecurityScheme.kt b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/securityschemes/SecurityScheme.kt deleted file mode 100644 index 67c7f90736d..00000000000 --- a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/securityschemes/SecurityScheme.kt +++ /dev/null @@ -1,19 +0,0 @@ -package org.openapijsonschematools.client.securityschemes; - -import org.checkerframework.checker.nullness.qual.Nullable; - -import java.net.http.HttpRequest; -import java.util.List; -import java.util.Map; - -public interface SecurityScheme { - void applyAuth( - Map> headers, - String resourcePath, - String method, - HttpRequest.BodyPublisher bodyPublisher, - @Nullable Map queryMap, - List scopeNames - ); -} - diff --git a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/servers/RootServer0.kt b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/servers/RootServer0.kt deleted file mode 100644 index 1dddf7bf2fe..00000000000 --- a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/servers/RootServer0.kt +++ /dev/null @@ -1,38 +0,0 @@ -package org.openapijsonschematools.client.servers; - -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.rootserver0.RootServer0Variables; - -import java.util.AbstractMap; - -public class RootServer0 extends ServerWithVariables { - /* - petstore server - */ - private static RootServer0Variables.VariablesMap getVariables() { - try { - return RootServer0Variables.RootServer0Variables1.getInstance().validate( - MapUtils.makeMap( - new AbstractMap.SimpleEntry<>("port", RootServer0Variables.Port.getInstance().defaultValue()), - new AbstractMap.SimpleEntry<>("server", RootServer0Variables.Server.getInstance().defaultValue()) - ), - new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().build()) - ); - } catch (ValidationException e) { - throw new RuntimeException(e); - } - } - - public RootServer0() { - super( - "http://{server}.swagger.io:{port}/v2", - getVariables() - ); - } - public RootServer0(RootServer0Variables.VariablesMap variables) { - super("http://{server}.swagger.io:{port}/v2", variables); - } -} diff --git a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/servers/RootServer1.kt b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/servers/RootServer1.kt deleted file mode 100644 index 2ff8761b163..00000000000 --- a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/servers/RootServer1.kt +++ /dev/null @@ -1,37 +0,0 @@ -package org.openapijsonschematools.client.servers; - -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.rootserver1.RootServer1Variables; - -import java.util.AbstractMap; - -public class RootServer1 extends ServerWithVariables { - /* - The local server - */ - private static RootServer1Variables.VariablesMap getVariables() { - try { - return RootServer1Variables.RootServer1Variables1.getInstance().validate( - MapUtils.makeMap( - new AbstractMap.SimpleEntry<>("version", RootServer1Variables.Version.getInstance().defaultValue()) - ), - new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().build()) - ); - } catch (ValidationException e) { - throw new RuntimeException(e); - } - } - - public RootServer1() { - super( - "https://localhost:8080/{version}", - getVariables() - ); - } - public RootServer1(RootServer1Variables.VariablesMap variables) { - super("https://localhost:8080/{version}", variables); - } -} diff --git a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/servers/RootServer2.kt b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/servers/RootServer2.kt deleted file mode 100644 index 5292f414c65..00000000000 --- a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/servers/RootServer2.kt +++ /dev/null @@ -1,9 +0,0 @@ -package org.openapijsonschematools.client.servers; - -import org.openapijsonschematools.client.servers.ServerWithoutVariables; - -public class RootServer2 extends ServerWithoutVariables { - public RootServer2() { - super("https://localhost:8080"); - } -} diff --git a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/servers/ServerProvider.kt b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/servers/ServerProvider.kt deleted file mode 100644 index f736485870c..00000000000 --- a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/servers/ServerProvider.kt +++ /dev/null @@ -1,6 +0,0 @@ -package org.openapijsonschematools.client.servers; - -public interface ServerProvider { - Server getServer(T serverIndex); -} - diff --git a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/servers/ServerWithVariables.kt b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/servers/ServerWithVariables.kt deleted file mode 100644 index 68748bcfcae..00000000000 --- a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/servers/ServerWithVariables.kt +++ /dev/null @@ -1,21 +0,0 @@ -package org.openapijsonschematools.client.servers; - -import java.util.Map; - -public abstract class ServerWithVariables> implements Server { - public final String url; - public final T variables; - - protected ServerWithVariables(String url, T variables) { - this.variables = variables; - for (Map.Entry entry: variables.entrySet()) { - url = url.replace("{" + entry.getKey() + "}", entry.getValue()); - } - this.url = url; - } - - public String url(){ - return url; - } -} - diff --git a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/servers/ServerWithoutVariables.kt b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/servers/ServerWithoutVariables.kt deleted file mode 100644 index c41ac2e77e5..00000000000 --- a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/servers/ServerWithoutVariables.kt +++ /dev/null @@ -1,14 +0,0 @@ -package org.openapijsonschematools.client.servers; - -public abstract class ServerWithoutVariables implements Server { - public final String url; - - protected ServerWithoutVariables(String url) { - this.url = url; - } - - public String url(){ - return url; - } -} - diff --git a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/servers/rootserver0/RootServer0Variables.kt b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/servers/rootserver0/RootServer0Variables.kt deleted file mode 100644 index 0fbad424ec1..00000000000 --- a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/servers/rootserver0/RootServer0Variables.kt +++ /dev/null @@ -1,471 +0,0 @@ -package org.openapijsonschematools.client.servers.rootserver0; -import java.util.ArrayList; -import java.util.HashSet; -import java.util.LinkedHashMap; -import java.util.LinkedHashSet; -import java.util.List; -import java.util.Map; -import java.util.Objects; -import java.util.Set; -import org.checkerframework.checker.nullness.qual.Nullable; -import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags; -import org.openapijsonschematools.client.configurations.SchemaConfiguration; -import org.openapijsonschematools.client.exceptions.UnsetPropertyException; -import org.openapijsonschematools.client.exceptions.ValidationException; -import org.openapijsonschematools.client.schemas.AnyTypeJsonSchema; -import org.openapijsonschematools.client.schemas.GenericBuilder; -import org.openapijsonschematools.client.schemas.NotAnyTypeJsonSchema; -import org.openapijsonschematools.client.schemas.SetMaker; -import org.openapijsonschematools.client.schemas.validation.DefaultValueMethod; -import org.openapijsonschematools.client.schemas.validation.FrozenMap; -import org.openapijsonschematools.client.schemas.validation.JsonSchema; -import org.openapijsonschematools.client.schemas.validation.JsonSchemaInfo; -import org.openapijsonschematools.client.schemas.validation.MapSchemaValidator; -import org.openapijsonschematools.client.schemas.validation.MapUtils; -import org.openapijsonschematools.client.schemas.validation.PathToSchemasMap; -import org.openapijsonschematools.client.schemas.validation.PropertyEntry; -import org.openapijsonschematools.client.schemas.validation.StringEnumValidator; -import org.openapijsonschematools.client.schemas.validation.StringSchemaValidator; -import org.openapijsonschematools.client.schemas.validation.StringValueMethod; -import org.openapijsonschematools.client.schemas.validation.ValidationMetadata; - -public class RootServer0Variables { - // nest classes so all schemas and input/output classes can be public - - - public static class AdditionalProperties extends NotAnyTypeJsonSchema.NotAnyTypeJsonSchema1 { - // NotAnyTypeSchema - private static @Nullable AdditionalProperties instance = null; - public static AdditionalProperties getInstance() { - if (instance == null) { - instance = new AdditionalProperties(); - } - return instance; - } - } - - public enum StringServerEnums implements StringValueMethod { - PETSTORE("petstore"), - QA_HYPHEN_MINUS_PETSTORE("qa-petstore"), - DEV_HYPHEN_MINUS_PETSTORE("dev-petstore"); - private final String value; - - StringServerEnums(String value) { - this.value = value; - } - public String value() { - return this.value; - } - } - - - public sealed interface ServerBoxed permits ServerBoxedString { - @Nullable Object getData(); - } - - public record ServerBoxedString(String data) implements ServerBoxed { - @Override - public @Nullable Object getData() { - return data; - } - } - - - - public static class Server extends JsonSchema implements StringSchemaValidator, StringEnumValidator, DefaultValueMethod { - private static @Nullable Server instance = null; - - protected Server() { - super(new JsonSchemaInfo() - .type(Set.of( - String.class - )) - .enumValues(SetMaker.makeSet( - "petstore", - "qa-petstore", - "dev-petstore" - )) - .defaultValue("petstore") - ); - } - - public static Server getInstance() { - if (instance == null) { - instance = new Server(); - } - return instance; - } - - @Override - public String validate(String arg, SchemaConfiguration configuration) throws ValidationException { - Set> pathSet = new HashSet<>(); - List pathToItem = List.of("args[0"); - String castArg = castToAllowedTypes(arg, pathToItem, pathSet); - SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().build())); - ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, new PathToSchemasMap(), new LinkedHashSet<>()); - getPathToSchemas(this, castArg, validationMetadata, pathSet); - return castArg; - } - - @Override - 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 { - 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"); - } - @Override - public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { - 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"); - } - public String defaultValue() throws ValidationException { - if (defaultValue instanceof String) { - return (String) defaultValue; - } - throw new ValidationException("Invalid type stored in defaultValue"); - } - @Override - 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 { - 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"); - } - } - public enum StringPortEnums implements StringValueMethod { - POSITIVE_80("80"), - POSITIVE_8080("8080"); - private final String value; - - StringPortEnums(String value) { - this.value = value; - } - public String value() { - return this.value; - } - } - - - public sealed interface PortBoxed permits PortBoxedString { - @Nullable Object getData(); - } - - public record PortBoxedString(String data) implements PortBoxed { - @Override - public @Nullable Object getData() { - return data; - } - } - - - - public static class Port extends JsonSchema implements StringSchemaValidator, StringEnumValidator, DefaultValueMethod { - private static @Nullable Port instance = null; - - protected Port() { - super(new JsonSchemaInfo() - .type(Set.of( - String.class - )) - .enumValues(SetMaker.makeSet( - "80", - "8080" - )) - .defaultValue("80") - ); - } - - public static Port getInstance() { - if (instance == null) { - instance = new Port(); - } - return instance; - } - - @Override - public String validate(String arg, SchemaConfiguration configuration) throws ValidationException { - Set> pathSet = new HashSet<>(); - List pathToItem = List.of("args[0"); - String castArg = castToAllowedTypes(arg, pathToItem, pathSet); - SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().build())); - ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, new PathToSchemasMap(), new LinkedHashSet<>()); - getPathToSchemas(this, castArg, validationMetadata, pathSet); - return castArg; - } - - @Override - 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 { - 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"); - } - @Override - public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { - 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"); - } - public String defaultValue() throws ValidationException { - if (defaultValue instanceof String) { - return (String) defaultValue; - } - throw new ValidationException("Invalid type stored in defaultValue"); - } - @Override - 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 { - 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"); - } - } - - public static class VariablesMap extends FrozenMap { - protected VariablesMap(FrozenMap m) { - super(m); - } - public static final Set requiredKeys = Set.of( - "port", - "server" - ); - public static final Set optionalKeys = Set.of(); - public static VariablesMap of(Map arg, SchemaConfiguration configuration) throws ValidationException { - return RootServer0Variables1.getInstance().validate(arg, configuration); - } - - public String port() { - String value = get("port"); - if (!(value instanceof String)) { - throw new RuntimeException("Invalid value stored for port"); - } - return (String) value; - } - - public String server() { - String value = get("server"); - if (!(value instanceof String)) { - throw new RuntimeException("Invalid value stored for server"); - } - return (String) value; - } - } - - public interface SetterForPort { - Map getInstance(); - T getBuilderAfterPort(Map instance); - - default T port(String value) { - var instance = getInstance(); - instance.put("port", value); - return getBuilderAfterPort(instance); - } - - default T port(StringPortEnums value) { - var instance = getInstance(); - instance.put("port", value.value()); - return getBuilderAfterPort(instance); - } - } - - public interface SetterForServer { - Map getInstance(); - T getBuilderAfterServer(Map instance); - - default T server(String value) { - var instance = getInstance(); - instance.put("server", value); - return getBuilderAfterServer(instance); - } - - default T server(StringServerEnums value) { - var instance = getInstance(); - instance.put("server", value.value()); - return getBuilderAfterServer(instance); - } - } - - public static class VariablesMap00Builder implements GenericBuilder> { - private final Map instance; - private static final Set knownKeys = Set.of( - "port", - "server" - ); - public Set getKnownKeys() { - return knownKeys; - } - public VariablesMap00Builder(Map instance) { - this.instance = instance; - } - public Map build() { - return instance; - } - } - - public static class VariablesMap01Builder implements SetterForServer { - private final Map instance; - public VariablesMap01Builder(Map instance) { - this.instance = instance; - } - public Map getInstance() { - return instance; - } - public VariablesMap00Builder getBuilderAfterServer(Map instance) { - return new VariablesMap00Builder(instance); - } - } - - public static class VariablesMap10Builder implements SetterForPort { - private final Map instance; - public VariablesMap10Builder(Map instance) { - this.instance = instance; - } - public Map getInstance() { - return instance; - } - public VariablesMap00Builder getBuilderAfterPort(Map instance) { - return new VariablesMap00Builder(instance); - } - } - - public static class VariablesMapBuilder implements SetterForPort, SetterForServer { - private final Map instance; - public VariablesMapBuilder() { - this.instance = new LinkedHashMap<>(); - } - public Map getInstance() { - return instance; - } - public VariablesMap01Builder getBuilderAfterPort(Map instance) { - return new VariablesMap01Builder(instance); - } - public VariablesMap10Builder getBuilderAfterServer(Map instance) { - return new VariablesMap10Builder(instance); - } - } - - - public sealed interface RootServer0Variables1Boxed permits RootServer0Variables1BoxedMap { - @Nullable Object getData(); - } - - public record RootServer0Variables1BoxedMap(VariablesMap data) implements RootServer0Variables1Boxed { - @Override - public @Nullable Object getData() { - return data; - } - } - - - public static class RootServer0Variables1 extends JsonSchema implements MapSchemaValidator { - private static @Nullable RootServer0Variables1 instance = null; - - protected RootServer0Variables1() { - super(new JsonSchemaInfo() - .type(Set.of(Map.class)) - .properties(Map.ofEntries( - new PropertyEntry("server", Server.class), - new PropertyEntry("port", Port.class) - )) - .required(Set.of( - "port", - "server" - )) - .additionalProperties(AdditionalProperties.class) - ); - } - - public static RootServer0Variables1 getInstance() { - if (instance == null) { - instance = new RootServer0Variables1(); - } - return instance; - } - - 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 RuntimeException("Invalid non-string key value"); - } - String propertyName = (String) entryKey; - List propertyPathToItem = new ArrayList<>(pathToItem); - propertyPathToItem.add(propertyName); - Object value = entry.getValue(); - LinkedHashMap, Nothing?> schemas = pathToSchemas.get(propertyPathToItem); - if (schemas == null) { - throw new RuntimeException("Validation 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"); - } - properties.put(propertyName, (String) propertyInstance); - } - FrozenMap castProperties = new FrozenMap<>(properties); - return new VariablesMap(castProperties); - } - - 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); - SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().build())); - ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, new PathToSchemasMap(), new LinkedHashSet<>()); - PathToSchemasMap pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet); - return getNewInstance(castArg, validationMetadata.pathToItem(), pathToSchemasMap); - } - - - @Override - public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws 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"); - } - @Override - public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { - if (arg instanceof Map) { - return getNewInstance((Map) arg, pathToItem, pathToSchemas); - } - throw new RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); - } - @Override - public RootServer0Variables1BoxedMap validateAndBox(Map arg, SchemaConfiguration configuration) throws ValidationException { - return new RootServer0Variables1BoxedMap(validate(arg, configuration)); - } - @Override - public RootServer0Variables1Boxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { - 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"); - } - } - -} diff --git a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/servers/rootserver1/RootServer1Variables.kt b/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/servers/rootserver1/RootServer1Variables.kt deleted file mode 100644 index ff6b7de86dc..00000000000 --- a/samples/client/petstore/kotlin/src/main/kotlin/org/openapijsonschematools/client/servers/rootserver1/RootServer1Variables.kt +++ /dev/null @@ -1,313 +0,0 @@ -package org.openapijsonschematools.client.servers.rootserver1; -import java.util.ArrayList; -import java.util.HashSet; -import java.util.LinkedHashMap; -import java.util.LinkedHashSet; -import java.util.List; -import java.util.Map; -import java.util.Objects; -import java.util.Set; -import org.checkerframework.checker.nullness.qual.Nullable; -import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags; -import org.openapijsonschematools.client.configurations.SchemaConfiguration; -import org.openapijsonschematools.client.exceptions.UnsetPropertyException; -import org.openapijsonschematools.client.exceptions.ValidationException; -import org.openapijsonschematools.client.schemas.AnyTypeJsonSchema; -import org.openapijsonschematools.client.schemas.GenericBuilder; -import org.openapijsonschematools.client.schemas.NotAnyTypeJsonSchema; -import org.openapijsonschematools.client.schemas.SetMaker; -import org.openapijsonschematools.client.schemas.validation.DefaultValueMethod; -import org.openapijsonschematools.client.schemas.validation.FrozenMap; -import org.openapijsonschematools.client.schemas.validation.JsonSchema; -import org.openapijsonschematools.client.schemas.validation.JsonSchemaInfo; -import org.openapijsonschematools.client.schemas.validation.MapSchemaValidator; -import org.openapijsonschematools.client.schemas.validation.MapUtils; -import org.openapijsonschematools.client.schemas.validation.PathToSchemasMap; -import org.openapijsonschematools.client.schemas.validation.PropertyEntry; -import org.openapijsonschematools.client.schemas.validation.StringEnumValidator; -import org.openapijsonschematools.client.schemas.validation.StringSchemaValidator; -import org.openapijsonschematools.client.schemas.validation.StringValueMethod; -import org.openapijsonschematools.client.schemas.validation.ValidationMetadata; - -public class RootServer1Variables { - // nest classes so all schemas and input/output classes can be public - - - public static class AdditionalProperties extends NotAnyTypeJsonSchema.NotAnyTypeJsonSchema1 { - // NotAnyTypeSchema - private static @Nullable AdditionalProperties instance = null; - public static AdditionalProperties getInstance() { - if (instance == null) { - instance = new AdditionalProperties(); - } - return instance; - } - } - - public enum StringVersionEnums implements StringValueMethod { - V1("v1"), - V2("v2"); - private final String value; - - StringVersionEnums(String value) { - this.value = value; - } - public String value() { - return this.value; - } - } - - - public sealed interface VersionBoxed permits VersionBoxedString { - @Nullable Object getData(); - } - - public record VersionBoxedString(String data) implements VersionBoxed { - @Override - public @Nullable Object getData() { - return data; - } - } - - - - public static class Version extends JsonSchema implements StringSchemaValidator, StringEnumValidator, DefaultValueMethod { - private static @Nullable Version instance = null; - - protected Version() { - super(new JsonSchemaInfo() - .type(Set.of( - String.class - )) - .enumValues(SetMaker.makeSet( - "v1", - "v2" - )) - .defaultValue("v2") - ); - } - - public static Version getInstance() { - if (instance == null) { - instance = new Version(); - } - return instance; - } - - @Override - public String validate(String arg, SchemaConfiguration configuration) throws ValidationException { - Set> pathSet = new HashSet<>(); - List pathToItem = List.of("args[0"); - String castArg = castToAllowedTypes(arg, pathToItem, pathSet); - SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().build())); - ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, new PathToSchemasMap(), new LinkedHashSet<>()); - getPathToSchemas(this, castArg, validationMetadata, pathSet); - return castArg; - } - - @Override - 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 { - 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"); - } - @Override - public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { - 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"); - } - public String defaultValue() throws ValidationException { - if (defaultValue instanceof String) { - return (String) defaultValue; - } - throw new ValidationException("Invalid type stored in defaultValue"); - } - @Override - 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 { - 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"); - } - } - - public static class VariablesMap extends FrozenMap { - protected VariablesMap(FrozenMap m) { - super(m); - } - public static final Set requiredKeys = Set.of( - "version" - ); - public static final Set optionalKeys = Set.of(); - public static VariablesMap of(Map arg, SchemaConfiguration configuration) throws ValidationException { - return RootServer1Variables1.getInstance().validate(arg, configuration); - } - - public String version() { - try { - return getOrThrow("version"); - } catch (UnsetPropertyException e) { - throw new RuntimeException(e); - } - } - } - - public interface SetterForVersion { - Map getInstance(); - T getBuilderAfterVersion(Map instance); - - default T version(String value) { - var instance = getInstance(); - instance.put("version", value); - return getBuilderAfterVersion(instance); - } - - default T version(StringVersionEnums value) { - var instance = getInstance(); - instance.put("version", value.value()); - return getBuilderAfterVersion(instance); - } - } - - public static class VariablesMap0Builder implements GenericBuilder> { - private final Map instance; - private static final Set knownKeys = Set.of( - "version" - ); - public Set getKnownKeys() { - return knownKeys; - } - public VariablesMap0Builder(Map instance) { - this.instance = instance; - } - public Map build() { - return instance; - } - } - - public static class VariablesMapBuilder implements SetterForVersion { - private final Map instance; - public VariablesMapBuilder() { - this.instance = new LinkedHashMap<>(); - } - public Map getInstance() { - return instance; - } - public VariablesMap0Builder getBuilderAfterVersion(Map instance) { - return new VariablesMap0Builder(instance); - } - } - - - public sealed interface RootServer1Variables1Boxed permits RootServer1Variables1BoxedMap { - @Nullable Object getData(); - } - - public record RootServer1Variables1BoxedMap(VariablesMap data) implements RootServer1Variables1Boxed { - @Override - public @Nullable Object getData() { - return data; - } - } - - - public static class RootServer1Variables1 extends JsonSchema implements MapSchemaValidator { - private static @Nullable RootServer1Variables1 instance = null; - - protected RootServer1Variables1() { - super(new JsonSchemaInfo() - .type(Set.of(Map.class)) - .properties(Map.ofEntries( - new PropertyEntry("version", Version.class) - )) - .required(Set.of( - "version" - )) - .additionalProperties(AdditionalProperties.class) - ); - } - - public static RootServer1Variables1 getInstance() { - if (instance == null) { - instance = new RootServer1Variables1(); - } - return instance; - } - - 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 RuntimeException("Invalid non-string key value"); - } - String propertyName = (String) entryKey; - List propertyPathToItem = new ArrayList<>(pathToItem); - propertyPathToItem.add(propertyName); - Object value = entry.getValue(); - LinkedHashMap, Nothing?> schemas = pathToSchemas.get(propertyPathToItem); - if (schemas == null) { - throw new RuntimeException("Validation 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"); - } - properties.put(propertyName, (String) propertyInstance); - } - FrozenMap castProperties = new FrozenMap<>(properties); - return new VariablesMap(castProperties); - } - - 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); - SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().build())); - ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, new PathToSchemasMap(), new LinkedHashSet<>()); - PathToSchemasMap pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet); - return getNewInstance(castArg, validationMetadata.pathToItem(), pathToSchemasMap); - } - - - @Override - public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws 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"); - } - @Override - public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { - if (arg instanceof Map) { - return getNewInstance((Map) arg, pathToItem, pathToSchemas); - } - throw new RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); - } - @Override - public RootServer1Variables1BoxedMap validateAndBox(Map arg, SchemaConfiguration configuration) throws ValidationException { - return new RootServer1Variables1BoxedMap(validate(arg, configuration)); - } - @Override - public RootServer1Variables1Boxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { - 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"); - } - } - -} diff --git a/samples/client/petstore/kotlin/src/test/kotlin/org/openapijsonschematools/client/components/schemas/AbstractStepMessageTest.kt b/samples/client/petstore/kotlin/src/test/kotlin/org/openapijsonschematools/client/components/schemas/AbstractStepMessageTest.kt deleted file mode 100644 index 82590f8a704..00000000000 --- a/samples/client/petstore/kotlin/src/test/kotlin/org/openapijsonschematools/client/components/schemas/AbstractStepMessageTest.kt +++ /dev/null @@ -1,18 +0,0 @@ -package org.openapijsonschematools.client.components.schemas; - -import org.junit.Assert; -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.MapUtils; -import org.checkerframework.checker.nullness.qual.Nullable; - -import java.util.Arrays; -import java.util.List; -import java.util.Map; -import java.util.AbstractMap; - -public class AbstractStepMessageTest { - static final SchemaConfiguration configuration = new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().format().build()); -} diff --git a/samples/client/petstore/kotlin/src/test/kotlin/org/openapijsonschematools/client/components/schemas/AdditionalPropertiesClassTest.kt b/samples/client/petstore/kotlin/src/test/kotlin/org/openapijsonschematools/client/components/schemas/AdditionalPropertiesClassTest.kt deleted file mode 100644 index ef80b00c044..00000000000 --- a/samples/client/petstore/kotlin/src/test/kotlin/org/openapijsonschematools/client/components/schemas/AdditionalPropertiesClassTest.kt +++ /dev/null @@ -1,18 +0,0 @@ -package org.openapijsonschematools.client.components.schemas; - -import org.junit.Assert; -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.MapUtils; -import org.checkerframework.checker.nullness.qual.Nullable; - -import java.util.Arrays; -import java.util.List; -import java.util.Map; -import java.util.AbstractMap; - -public class AdditionalPropertiesClassTest { - static final SchemaConfiguration configuration = new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().format().build()); -} diff --git a/samples/client/petstore/kotlin/src/test/kotlin/org/openapijsonschematools/client/components/schemas/AdditionalPropertiesSchemaTest.kt b/samples/client/petstore/kotlin/src/test/kotlin/org/openapijsonschematools/client/components/schemas/AdditionalPropertiesSchemaTest.kt deleted file mode 100644 index de7861d3cb2..00000000000 --- a/samples/client/petstore/kotlin/src/test/kotlin/org/openapijsonschematools/client/components/schemas/AdditionalPropertiesSchemaTest.kt +++ /dev/null @@ -1,18 +0,0 @@ -package org.openapijsonschematools.client.components.schemas; - -import org.junit.Assert; -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.MapUtils; -import org.checkerframework.checker.nullness.qual.Nullable; - -import java.util.Arrays; -import java.util.List; -import java.util.Map; -import java.util.AbstractMap; - -public class AdditionalPropertiesSchemaTest { - static final SchemaConfiguration configuration = new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().format().build()); -} diff --git a/samples/client/petstore/kotlin/src/test/kotlin/org/openapijsonschematools/client/components/schemas/AdditionalPropertiesWithArrayOfEnumsTest.kt b/samples/client/petstore/kotlin/src/test/kotlin/org/openapijsonschematools/client/components/schemas/AdditionalPropertiesWithArrayOfEnumsTest.kt deleted file mode 100644 index f44a71eaea1..00000000000 --- a/samples/client/petstore/kotlin/src/test/kotlin/org/openapijsonschematools/client/components/schemas/AdditionalPropertiesWithArrayOfEnumsTest.kt +++ /dev/null @@ -1,18 +0,0 @@ -package org.openapijsonschematools.client.components.schemas; - -import org.junit.Assert; -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.MapUtils; -import org.checkerframework.checker.nullness.qual.Nullable; - -import java.util.Arrays; -import java.util.List; -import java.util.Map; -import java.util.AbstractMap; - -public class AdditionalPropertiesWithArrayOfEnumsTest { - static final SchemaConfiguration configuration = new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().format().build()); -} diff --git a/samples/client/petstore/kotlin/src/test/kotlin/org/openapijsonschematools/client/components/schemas/AddressTest.kt b/samples/client/petstore/kotlin/src/test/kotlin/org/openapijsonschematools/client/components/schemas/AddressTest.kt deleted file mode 100644 index eeb0dfc4626..00000000000 --- a/samples/client/petstore/kotlin/src/test/kotlin/org/openapijsonschematools/client/components/schemas/AddressTest.kt +++ /dev/null @@ -1,18 +0,0 @@ -package org.openapijsonschematools.client.components.schemas; - -import org.junit.Assert; -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.MapUtils; -import org.checkerframework.checker.nullness.qual.Nullable; - -import java.util.Arrays; -import java.util.List; -import java.util.Map; -import java.util.AbstractMap; - -public class AddressTest { - static final SchemaConfiguration configuration = new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().format().build()); -} diff --git a/samples/client/petstore/kotlin/src/test/kotlin/org/openapijsonschematools/client/components/schemas/AnimalFarmTest.kt b/samples/client/petstore/kotlin/src/test/kotlin/org/openapijsonschematools/client/components/schemas/AnimalFarmTest.kt deleted file mode 100644 index 28531089830..00000000000 --- a/samples/client/petstore/kotlin/src/test/kotlin/org/openapijsonschematools/client/components/schemas/AnimalFarmTest.kt +++ /dev/null @@ -1,18 +0,0 @@ -package org.openapijsonschematools.client.components.schemas; - -import org.junit.Assert; -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.MapUtils; -import org.checkerframework.checker.nullness.qual.Nullable; - -import java.util.Arrays; -import java.util.List; -import java.util.Map; -import java.util.AbstractMap; - -public class AnimalFarmTest { - static final SchemaConfiguration configuration = new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().format().build()); -} diff --git a/samples/client/petstore/kotlin/src/test/kotlin/org/openapijsonschematools/client/components/schemas/AnimalTest.kt b/samples/client/petstore/kotlin/src/test/kotlin/org/openapijsonschematools/client/components/schemas/AnimalTest.kt deleted file mode 100644 index f38c301e7f5..00000000000 --- a/samples/client/petstore/kotlin/src/test/kotlin/org/openapijsonschematools/client/components/schemas/AnimalTest.kt +++ /dev/null @@ -1,18 +0,0 @@ -package org.openapijsonschematools.client.components.schemas; - -import org.junit.Assert; -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.MapUtils; -import org.checkerframework.checker.nullness.qual.Nullable; - -import java.util.Arrays; -import java.util.List; -import java.util.Map; -import java.util.AbstractMap; - -public class AnimalTest { - static final SchemaConfiguration configuration = new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().format().build()); -} diff --git a/samples/client/petstore/kotlin/src/test/kotlin/org/openapijsonschematools/client/components/schemas/AnyTypeAndFormatTest.kt b/samples/client/petstore/kotlin/src/test/kotlin/org/openapijsonschematools/client/components/schemas/AnyTypeAndFormatTest.kt deleted file mode 100644 index d76fcfbd442..00000000000 --- a/samples/client/petstore/kotlin/src/test/kotlin/org/openapijsonschematools/client/components/schemas/AnyTypeAndFormatTest.kt +++ /dev/null @@ -1,18 +0,0 @@ -package org.openapijsonschematools.client.components.schemas; - -import org.junit.Assert; -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.MapUtils; -import org.checkerframework.checker.nullness.qual.Nullable; - -import java.util.Arrays; -import java.util.List; -import java.util.Map; -import java.util.AbstractMap; - -public class AnyTypeAndFormatTest { - static final SchemaConfiguration configuration = new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().format().build()); -} diff --git a/samples/client/petstore/kotlin/src/test/kotlin/org/openapijsonschematools/client/components/schemas/AnyTypeNotStringTest.kt b/samples/client/petstore/kotlin/src/test/kotlin/org/openapijsonschematools/client/components/schemas/AnyTypeNotStringTest.kt deleted file mode 100644 index 5af249aa1c1..00000000000 --- a/samples/client/petstore/kotlin/src/test/kotlin/org/openapijsonschematools/client/components/schemas/AnyTypeNotStringTest.kt +++ /dev/null @@ -1,18 +0,0 @@ -package org.openapijsonschematools.client.components.schemas; - -import org.junit.Assert; -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.MapUtils; -import org.checkerframework.checker.nullness.qual.Nullable; - -import java.util.Arrays; -import java.util.List; -import java.util.Map; -import java.util.AbstractMap; - -public class AnyTypeNotStringTest { - static final SchemaConfiguration configuration = new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().format().build()); -} diff --git a/samples/client/petstore/kotlin/src/test/kotlin/org/openapijsonschematools/client/components/schemas/ApiResponseSchemaTest.kt b/samples/client/petstore/kotlin/src/test/kotlin/org/openapijsonschematools/client/components/schemas/ApiResponseSchemaTest.kt deleted file mode 100644 index 70e59c3040f..00000000000 --- a/samples/client/petstore/kotlin/src/test/kotlin/org/openapijsonschematools/client/components/schemas/ApiResponseSchemaTest.kt +++ /dev/null @@ -1,18 +0,0 @@ -package org.openapijsonschematools.client.components.schemas; - -import org.junit.Assert; -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.MapUtils; -import org.checkerframework.checker.nullness.qual.Nullable; - -import java.util.Arrays; -import java.util.List; -import java.util.Map; -import java.util.AbstractMap; - -public class ApiResponseSchemaTest { - static final SchemaConfiguration configuration = new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().format().build()); -} diff --git a/samples/client/petstore/kotlin/src/test/kotlin/org/openapijsonschematools/client/components/schemas/AppleReqTest.kt b/samples/client/petstore/kotlin/src/test/kotlin/org/openapijsonschematools/client/components/schemas/AppleReqTest.kt deleted file mode 100644 index d7c45b1af68..00000000000 --- a/samples/client/petstore/kotlin/src/test/kotlin/org/openapijsonschematools/client/components/schemas/AppleReqTest.kt +++ /dev/null @@ -1,18 +0,0 @@ -package org.openapijsonschematools.client.components.schemas; - -import org.junit.Assert; -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.MapUtils; -import org.checkerframework.checker.nullness.qual.Nullable; - -import java.util.Arrays; -import java.util.List; -import java.util.Map; -import java.util.AbstractMap; - -public class AppleReqTest { - static final SchemaConfiguration configuration = new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().format().build()); -} diff --git a/samples/client/petstore/kotlin/src/test/kotlin/org/openapijsonschematools/client/components/schemas/AppleTest.kt b/samples/client/petstore/kotlin/src/test/kotlin/org/openapijsonschematools/client/components/schemas/AppleTest.kt deleted file mode 100644 index 491ab8ffb6d..00000000000 --- a/samples/client/petstore/kotlin/src/test/kotlin/org/openapijsonschematools/client/components/schemas/AppleTest.kt +++ /dev/null @@ -1,18 +0,0 @@ -package org.openapijsonschematools.client.components.schemas; - -import org.junit.Assert; -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.MapUtils; -import org.checkerframework.checker.nullness.qual.Nullable; - -import java.util.Arrays; -import java.util.List; -import java.util.Map; -import java.util.AbstractMap; - -public class AppleTest { - static final SchemaConfiguration configuration = new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().format().build()); -} diff --git a/samples/client/petstore/kotlin/src/test/kotlin/org/openapijsonschematools/client/components/schemas/ArrayHoldingAnyTypeTest.kt b/samples/client/petstore/kotlin/src/test/kotlin/org/openapijsonschematools/client/components/schemas/ArrayHoldingAnyTypeTest.kt deleted file mode 100644 index cae93de592c..00000000000 --- a/samples/client/petstore/kotlin/src/test/kotlin/org/openapijsonschematools/client/components/schemas/ArrayHoldingAnyTypeTest.kt +++ /dev/null @@ -1,18 +0,0 @@ -package org.openapijsonschematools.client.components.schemas; - -import org.junit.Assert; -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.MapUtils; -import org.checkerframework.checker.nullness.qual.Nullable; - -import java.util.Arrays; -import java.util.List; -import java.util.Map; -import java.util.AbstractMap; - -public class ArrayHoldingAnyTypeTest { - static final SchemaConfiguration configuration = new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().format().build()); -} diff --git a/samples/client/petstore/kotlin/src/test/kotlin/org/openapijsonschematools/client/components/schemas/ArrayOfArrayOfNumberOnlyTest.kt b/samples/client/petstore/kotlin/src/test/kotlin/org/openapijsonschematools/client/components/schemas/ArrayOfArrayOfNumberOnlyTest.kt deleted file mode 100644 index f826dc7742b..00000000000 --- a/samples/client/petstore/kotlin/src/test/kotlin/org/openapijsonschematools/client/components/schemas/ArrayOfArrayOfNumberOnlyTest.kt +++ /dev/null @@ -1,18 +0,0 @@ -package org.openapijsonschematools.client.components.schemas; - -import org.junit.Assert; -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.MapUtils; -import org.checkerframework.checker.nullness.qual.Nullable; - -import java.util.Arrays; -import java.util.List; -import java.util.Map; -import java.util.AbstractMap; - -public class ArrayOfArrayOfNumberOnlyTest { - static final SchemaConfiguration configuration = new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().format().build()); -} diff --git a/samples/client/petstore/kotlin/src/test/kotlin/org/openapijsonschematools/client/components/schemas/ArrayOfEnumsTest.kt b/samples/client/petstore/kotlin/src/test/kotlin/org/openapijsonschematools/client/components/schemas/ArrayOfEnumsTest.kt deleted file mode 100644 index 6e9a30567d4..00000000000 --- a/samples/client/petstore/kotlin/src/test/kotlin/org/openapijsonschematools/client/components/schemas/ArrayOfEnumsTest.kt +++ /dev/null @@ -1,18 +0,0 @@ -package org.openapijsonschematools.client.components.schemas; - -import org.junit.Assert; -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.MapUtils; -import org.checkerframework.checker.nullness.qual.Nullable; - -import java.util.Arrays; -import java.util.List; -import java.util.Map; -import java.util.AbstractMap; - -public class ArrayOfEnumsTest { - static final SchemaConfiguration configuration = new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().format().build()); -} diff --git a/samples/client/petstore/kotlin/src/test/kotlin/org/openapijsonschematools/client/components/schemas/ArrayOfNumberOnlyTest.kt b/samples/client/petstore/kotlin/src/test/kotlin/org/openapijsonschematools/client/components/schemas/ArrayOfNumberOnlyTest.kt deleted file mode 100644 index 46360228172..00000000000 --- a/samples/client/petstore/kotlin/src/test/kotlin/org/openapijsonschematools/client/components/schemas/ArrayOfNumberOnlyTest.kt +++ /dev/null @@ -1,18 +0,0 @@ -package org.openapijsonschematools.client.components.schemas; - -import org.junit.Assert; -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.MapUtils; -import org.checkerframework.checker.nullness.qual.Nullable; - -import java.util.Arrays; -import java.util.List; -import java.util.Map; -import java.util.AbstractMap; - -public class ArrayOfNumberOnlyTest { - static final SchemaConfiguration configuration = new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().format().build()); -} diff --git a/samples/client/petstore/kotlin/src/test/kotlin/org/openapijsonschematools/client/components/schemas/ArrayTestTest.kt b/samples/client/petstore/kotlin/src/test/kotlin/org/openapijsonschematools/client/components/schemas/ArrayTestTest.kt deleted file mode 100644 index d4f5c35dbad..00000000000 --- a/samples/client/petstore/kotlin/src/test/kotlin/org/openapijsonschematools/client/components/schemas/ArrayTestTest.kt +++ /dev/null @@ -1,18 +0,0 @@ -package org.openapijsonschematools.client.components.schemas; - -import org.junit.Assert; -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.MapUtils; -import org.checkerframework.checker.nullness.qual.Nullable; - -import java.util.Arrays; -import java.util.List; -import java.util.Map; -import java.util.AbstractMap; - -public class ArrayTestTest { - static final SchemaConfiguration configuration = new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().format().build()); -} diff --git a/samples/client/petstore/kotlin/src/test/kotlin/org/openapijsonschematools/client/components/schemas/ArrayWithValidationsInItemsTest.kt b/samples/client/petstore/kotlin/src/test/kotlin/org/openapijsonschematools/client/components/schemas/ArrayWithValidationsInItemsTest.kt deleted file mode 100644 index 8ac9ee9ecc6..00000000000 --- a/samples/client/petstore/kotlin/src/test/kotlin/org/openapijsonschematools/client/components/schemas/ArrayWithValidationsInItemsTest.kt +++ /dev/null @@ -1,18 +0,0 @@ -package org.openapijsonschematools.client.components.schemas; - -import org.junit.Assert; -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.MapUtils; -import org.checkerframework.checker.nullness.qual.Nullable; - -import java.util.Arrays; -import java.util.List; -import java.util.Map; -import java.util.AbstractMap; - -public class ArrayWithValidationsInItemsTest { - static final SchemaConfiguration configuration = new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().format().build()); -} diff --git a/samples/client/petstore/kotlin/src/test/kotlin/org/openapijsonschematools/client/components/schemas/BananaReqTest.kt b/samples/client/petstore/kotlin/src/test/kotlin/org/openapijsonschematools/client/components/schemas/BananaReqTest.kt deleted file mode 100644 index 4031dcb9c5c..00000000000 --- a/samples/client/petstore/kotlin/src/test/kotlin/org/openapijsonschematools/client/components/schemas/BananaReqTest.kt +++ /dev/null @@ -1,18 +0,0 @@ -package org.openapijsonschematools.client.components.schemas; - -import org.junit.Assert; -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.MapUtils; -import org.checkerframework.checker.nullness.qual.Nullable; - -import java.util.Arrays; -import java.util.List; -import java.util.Map; -import java.util.AbstractMap; - -public class BananaReqTest { - static final SchemaConfiguration configuration = new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().format().build()); -} diff --git a/samples/client/petstore/kotlin/src/test/kotlin/org/openapijsonschematools/client/components/schemas/BananaTest.kt b/samples/client/petstore/kotlin/src/test/kotlin/org/openapijsonschematools/client/components/schemas/BananaTest.kt deleted file mode 100644 index aa0ff28a5fb..00000000000 --- a/samples/client/petstore/kotlin/src/test/kotlin/org/openapijsonschematools/client/components/schemas/BananaTest.kt +++ /dev/null @@ -1,18 +0,0 @@ -package org.openapijsonschematools.client.components.schemas; - -import org.junit.Assert; -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.MapUtils; -import org.checkerframework.checker.nullness.qual.Nullable; - -import java.util.Arrays; -import java.util.List; -import java.util.Map; -import java.util.AbstractMap; - -public class BananaTest { - static final SchemaConfiguration configuration = new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().format().build()); -} diff --git a/samples/client/petstore/kotlin/src/test/kotlin/org/openapijsonschematools/client/components/schemas/BarTest.kt b/samples/client/petstore/kotlin/src/test/kotlin/org/openapijsonschematools/client/components/schemas/BarTest.kt deleted file mode 100644 index 0952ffc44fc..00000000000 --- a/samples/client/petstore/kotlin/src/test/kotlin/org/openapijsonschematools/client/components/schemas/BarTest.kt +++ /dev/null @@ -1,18 +0,0 @@ -package org.openapijsonschematools.client.components.schemas; - -import org.junit.Assert; -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.MapUtils; -import org.checkerframework.checker.nullness.qual.Nullable; - -import java.util.Arrays; -import java.util.List; -import java.util.Map; -import java.util.AbstractMap; - -public class BarTest { - static final SchemaConfiguration configuration = new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().format().build()); -} diff --git a/samples/client/petstore/kotlin/src/test/kotlin/org/openapijsonschematools/client/components/schemas/BasquePigTest.kt b/samples/client/petstore/kotlin/src/test/kotlin/org/openapijsonschematools/client/components/schemas/BasquePigTest.kt deleted file mode 100644 index c35138daf52..00000000000 --- a/samples/client/petstore/kotlin/src/test/kotlin/org/openapijsonschematools/client/components/schemas/BasquePigTest.kt +++ /dev/null @@ -1,18 +0,0 @@ -package org.openapijsonschematools.client.components.schemas; - -import org.junit.Assert; -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.MapUtils; -import org.checkerframework.checker.nullness.qual.Nullable; - -import java.util.Arrays; -import java.util.List; -import java.util.Map; -import java.util.AbstractMap; - -public class BasquePigTest { - static final SchemaConfiguration configuration = new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().format().build()); -} diff --git a/samples/client/petstore/kotlin/src/test/kotlin/org/openapijsonschematools/client/components/schemas/BooleanEnumTest.kt b/samples/client/petstore/kotlin/src/test/kotlin/org/openapijsonschematools/client/components/schemas/BooleanEnumTest.kt deleted file mode 100644 index 09beec02136..00000000000 --- a/samples/client/petstore/kotlin/src/test/kotlin/org/openapijsonschematools/client/components/schemas/BooleanEnumTest.kt +++ /dev/null @@ -1,18 +0,0 @@ -package org.openapijsonschematools.client.components.schemas; - -import org.junit.Assert; -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.MapUtils; -import org.checkerframework.checker.nullness.qual.Nullable; - -import java.util.Arrays; -import java.util.List; -import java.util.Map; -import java.util.AbstractMap; - -public class BooleanEnumTest { - static final SchemaConfiguration configuration = new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().format().build()); -} diff --git a/samples/client/petstore/kotlin/src/test/kotlin/org/openapijsonschematools/client/components/schemas/BooleanSchemaTest.kt b/samples/client/petstore/kotlin/src/test/kotlin/org/openapijsonschematools/client/components/schemas/BooleanSchemaTest.kt deleted file mode 100644 index ba183196bcd..00000000000 --- a/samples/client/petstore/kotlin/src/test/kotlin/org/openapijsonschematools/client/components/schemas/BooleanSchemaTest.kt +++ /dev/null @@ -1,18 +0,0 @@ -package org.openapijsonschematools.client.components.schemas; - -import org.junit.Assert; -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.MapUtils; -import org.checkerframework.checker.nullness.qual.Nullable; - -import java.util.Arrays; -import java.util.List; -import java.util.Map; -import java.util.AbstractMap; - -public class BooleanSchemaTest { - static final SchemaConfiguration configuration = new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().format().build()); -} diff --git a/samples/client/petstore/kotlin/src/test/kotlin/org/openapijsonschematools/client/components/schemas/CapitalizationTest.kt b/samples/client/petstore/kotlin/src/test/kotlin/org/openapijsonschematools/client/components/schemas/CapitalizationTest.kt deleted file mode 100644 index 37056fa373e..00000000000 --- a/samples/client/petstore/kotlin/src/test/kotlin/org/openapijsonschematools/client/components/schemas/CapitalizationTest.kt +++ /dev/null @@ -1,18 +0,0 @@ -package org.openapijsonschematools.client.components.schemas; - -import org.junit.Assert; -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.MapUtils; -import org.checkerframework.checker.nullness.qual.Nullable; - -import java.util.Arrays; -import java.util.List; -import java.util.Map; -import java.util.AbstractMap; - -public class CapitalizationTest { - static final SchemaConfiguration configuration = new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().format().build()); -} diff --git a/samples/client/petstore/kotlin/src/test/kotlin/org/openapijsonschematools/client/components/schemas/CatTest.kt b/samples/client/petstore/kotlin/src/test/kotlin/org/openapijsonschematools/client/components/schemas/CatTest.kt deleted file mode 100644 index 1dca84b8c97..00000000000 --- a/samples/client/petstore/kotlin/src/test/kotlin/org/openapijsonschematools/client/components/schemas/CatTest.kt +++ /dev/null @@ -1,18 +0,0 @@ -package org.openapijsonschematools.client.components.schemas; - -import org.junit.Assert; -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.MapUtils; -import org.checkerframework.checker.nullness.qual.Nullable; - -import java.util.Arrays; -import java.util.List; -import java.util.Map; -import java.util.AbstractMap; - -public class CatTest { - static final SchemaConfiguration configuration = new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().format().build()); -} diff --git a/samples/client/petstore/kotlin/src/test/kotlin/org/openapijsonschematools/client/components/schemas/CategoryTest.kt b/samples/client/petstore/kotlin/src/test/kotlin/org/openapijsonschematools/client/components/schemas/CategoryTest.kt deleted file mode 100644 index 884a6476615..00000000000 --- a/samples/client/petstore/kotlin/src/test/kotlin/org/openapijsonschematools/client/components/schemas/CategoryTest.kt +++ /dev/null @@ -1,18 +0,0 @@ -package org.openapijsonschematools.client.components.schemas; - -import org.junit.Assert; -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.MapUtils; -import org.checkerframework.checker.nullness.qual.Nullable; - -import java.util.Arrays; -import java.util.List; -import java.util.Map; -import java.util.AbstractMap; - -public class CategoryTest { - static final SchemaConfiguration configuration = new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().format().build()); -} diff --git a/samples/client/petstore/kotlin/src/test/kotlin/org/openapijsonschematools/client/components/schemas/ChildCatTest.kt b/samples/client/petstore/kotlin/src/test/kotlin/org/openapijsonschematools/client/components/schemas/ChildCatTest.kt deleted file mode 100644 index 79248832dc9..00000000000 --- a/samples/client/petstore/kotlin/src/test/kotlin/org/openapijsonschematools/client/components/schemas/ChildCatTest.kt +++ /dev/null @@ -1,18 +0,0 @@ -package org.openapijsonschematools.client.components.schemas; - -import org.junit.Assert; -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.MapUtils; -import org.checkerframework.checker.nullness.qual.Nullable; - -import java.util.Arrays; -import java.util.List; -import java.util.Map; -import java.util.AbstractMap; - -public class ChildCatTest { - static final SchemaConfiguration configuration = new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().format().build()); -} diff --git a/samples/client/petstore/kotlin/src/test/kotlin/org/openapijsonschematools/client/components/schemas/ClassModelTest.kt b/samples/client/petstore/kotlin/src/test/kotlin/org/openapijsonschematools/client/components/schemas/ClassModelTest.kt deleted file mode 100644 index be07f306c54..00000000000 --- a/samples/client/petstore/kotlin/src/test/kotlin/org/openapijsonschematools/client/components/schemas/ClassModelTest.kt +++ /dev/null @@ -1,18 +0,0 @@ -package org.openapijsonschematools.client.components.schemas; - -import org.junit.Assert; -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.MapUtils; -import org.checkerframework.checker.nullness.qual.Nullable; - -import java.util.Arrays; -import java.util.List; -import java.util.Map; -import java.util.AbstractMap; - -public class ClassModelTest { - static final SchemaConfiguration configuration = new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().format().build()); -} diff --git a/samples/client/petstore/kotlin/src/test/kotlin/org/openapijsonschematools/client/components/schemas/ClientTest.kt b/samples/client/petstore/kotlin/src/test/kotlin/org/openapijsonschematools/client/components/schemas/ClientTest.kt deleted file mode 100644 index 8f798029f4f..00000000000 --- a/samples/client/petstore/kotlin/src/test/kotlin/org/openapijsonschematools/client/components/schemas/ClientTest.kt +++ /dev/null @@ -1,18 +0,0 @@ -package org.openapijsonschematools.client.components.schemas; - -import org.junit.Assert; -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.MapUtils; -import org.checkerframework.checker.nullness.qual.Nullable; - -import java.util.Arrays; -import java.util.List; -import java.util.Map; -import java.util.AbstractMap; - -public class ClientTest { - static final SchemaConfiguration configuration = new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().format().build()); -} diff --git a/samples/client/petstore/kotlin/src/test/kotlin/org/openapijsonschematools/client/components/schemas/ComplexQuadrilateralTest.kt b/samples/client/petstore/kotlin/src/test/kotlin/org/openapijsonschematools/client/components/schemas/ComplexQuadrilateralTest.kt deleted file mode 100644 index a511c075f80..00000000000 --- a/samples/client/petstore/kotlin/src/test/kotlin/org/openapijsonschematools/client/components/schemas/ComplexQuadrilateralTest.kt +++ /dev/null @@ -1,18 +0,0 @@ -package org.openapijsonschematools.client.components.schemas; - -import org.junit.Assert; -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.MapUtils; -import org.checkerframework.checker.nullness.qual.Nullable; - -import java.util.Arrays; -import java.util.List; -import java.util.Map; -import java.util.AbstractMap; - -public class ComplexQuadrilateralTest { - static final SchemaConfiguration configuration = new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().format().build()); -} diff --git a/samples/client/petstore/kotlin/src/test/kotlin/org/openapijsonschematools/client/components/schemas/ComposedAnyOfDifferentTypesNoValidationsTest.kt b/samples/client/petstore/kotlin/src/test/kotlin/org/openapijsonschematools/client/components/schemas/ComposedAnyOfDifferentTypesNoValidationsTest.kt deleted file mode 100644 index 867b1ef54a2..00000000000 --- a/samples/client/petstore/kotlin/src/test/kotlin/org/openapijsonschematools/client/components/schemas/ComposedAnyOfDifferentTypesNoValidationsTest.kt +++ /dev/null @@ -1,18 +0,0 @@ -package org.openapijsonschematools.client.components.schemas; - -import org.junit.Assert; -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.MapUtils; -import org.checkerframework.checker.nullness.qual.Nullable; - -import java.util.Arrays; -import java.util.List; -import java.util.Map; -import java.util.AbstractMap; - -public class ComposedAnyOfDifferentTypesNoValidationsTest { - static final SchemaConfiguration configuration = new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().format().build()); -} diff --git a/samples/client/petstore/kotlin/src/test/kotlin/org/openapijsonschematools/client/components/schemas/ComposedArrayTest.kt b/samples/client/petstore/kotlin/src/test/kotlin/org/openapijsonschematools/client/components/schemas/ComposedArrayTest.kt deleted file mode 100644 index 88b3b85df5c..00000000000 --- a/samples/client/petstore/kotlin/src/test/kotlin/org/openapijsonschematools/client/components/schemas/ComposedArrayTest.kt +++ /dev/null @@ -1,18 +0,0 @@ -package org.openapijsonschematools.client.components.schemas; - -import org.junit.Assert; -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.MapUtils; -import org.checkerframework.checker.nullness.qual.Nullable; - -import java.util.Arrays; -import java.util.List; -import java.util.Map; -import java.util.AbstractMap; - -public class ComposedArrayTest { - static final SchemaConfiguration configuration = new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().format().build()); -} diff --git a/samples/client/petstore/kotlin/src/test/kotlin/org/openapijsonschematools/client/components/schemas/ComposedBoolTest.kt b/samples/client/petstore/kotlin/src/test/kotlin/org/openapijsonschematools/client/components/schemas/ComposedBoolTest.kt deleted file mode 100644 index a76023fc9b2..00000000000 --- a/samples/client/petstore/kotlin/src/test/kotlin/org/openapijsonschematools/client/components/schemas/ComposedBoolTest.kt +++ /dev/null @@ -1,18 +0,0 @@ -package org.openapijsonschematools.client.components.schemas; - -import org.junit.Assert; -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.MapUtils; -import org.checkerframework.checker.nullness.qual.Nullable; - -import java.util.Arrays; -import java.util.List; -import java.util.Map; -import java.util.AbstractMap; - -public class ComposedBoolTest { - static final SchemaConfiguration configuration = new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().format().build()); -} diff --git a/samples/client/petstore/kotlin/src/test/kotlin/org/openapijsonschematools/client/components/schemas/ComposedNoneTest.kt b/samples/client/petstore/kotlin/src/test/kotlin/org/openapijsonschematools/client/components/schemas/ComposedNoneTest.kt deleted file mode 100644 index 0ccbf3b44f9..00000000000 --- a/samples/client/petstore/kotlin/src/test/kotlin/org/openapijsonschematools/client/components/schemas/ComposedNoneTest.kt +++ /dev/null @@ -1,18 +0,0 @@ -package org.openapijsonschematools.client.components.schemas; - -import org.junit.Assert; -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.MapUtils; -import org.checkerframework.checker.nullness.qual.Nullable; - -import java.util.Arrays; -import java.util.List; -import java.util.Map; -import java.util.AbstractMap; - -public class ComposedNoneTest { - static final SchemaConfiguration configuration = new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().format().build()); -} diff --git a/samples/client/petstore/kotlin/src/test/kotlin/org/openapijsonschematools/client/components/schemas/ComposedNumberTest.kt b/samples/client/petstore/kotlin/src/test/kotlin/org/openapijsonschematools/client/components/schemas/ComposedNumberTest.kt deleted file mode 100644 index a410679ea58..00000000000 --- a/samples/client/petstore/kotlin/src/test/kotlin/org/openapijsonschematools/client/components/schemas/ComposedNumberTest.kt +++ /dev/null @@ -1,18 +0,0 @@ -package org.openapijsonschematools.client.components.schemas; - -import org.junit.Assert; -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.MapUtils; -import org.checkerframework.checker.nullness.qual.Nullable; - -import java.util.Arrays; -import java.util.List; -import java.util.Map; -import java.util.AbstractMap; - -public class ComposedNumberTest { - static final SchemaConfiguration configuration = new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().format().build()); -} diff --git a/samples/client/petstore/kotlin/src/test/kotlin/org/openapijsonschematools/client/components/schemas/ComposedObjectTest.kt b/samples/client/petstore/kotlin/src/test/kotlin/org/openapijsonschematools/client/components/schemas/ComposedObjectTest.kt deleted file mode 100644 index 0aacfd84f50..00000000000 --- a/samples/client/petstore/kotlin/src/test/kotlin/org/openapijsonschematools/client/components/schemas/ComposedObjectTest.kt +++ /dev/null @@ -1,18 +0,0 @@ -package org.openapijsonschematools.client.components.schemas; - -import org.junit.Assert; -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.MapUtils; -import org.checkerframework.checker.nullness.qual.Nullable; - -import java.util.Arrays; -import java.util.List; -import java.util.Map; -import java.util.AbstractMap; - -public class ComposedObjectTest { - static final SchemaConfiguration configuration = new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().format().build()); -} diff --git a/samples/client/petstore/kotlin/src/test/kotlin/org/openapijsonschematools/client/components/schemas/ComposedOneOfDifferentTypesTest.kt b/samples/client/petstore/kotlin/src/test/kotlin/org/openapijsonschematools/client/components/schemas/ComposedOneOfDifferentTypesTest.kt deleted file mode 100644 index 8c630e0b5cd..00000000000 --- a/samples/client/petstore/kotlin/src/test/kotlin/org/openapijsonschematools/client/components/schemas/ComposedOneOfDifferentTypesTest.kt +++ /dev/null @@ -1,18 +0,0 @@ -package org.openapijsonschematools.client.components.schemas; - -import org.junit.Assert; -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.MapUtils; -import org.checkerframework.checker.nullness.qual.Nullable; - -import java.util.Arrays; -import java.util.List; -import java.util.Map; -import java.util.AbstractMap; - -public class ComposedOneOfDifferentTypesTest { - static final SchemaConfiguration configuration = new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().format().build()); -} diff --git a/samples/client/petstore/kotlin/src/test/kotlin/org/openapijsonschematools/client/components/schemas/ComposedStringTest.kt b/samples/client/petstore/kotlin/src/test/kotlin/org/openapijsonschematools/client/components/schemas/ComposedStringTest.kt deleted file mode 100644 index b9be19bd3cf..00000000000 --- a/samples/client/petstore/kotlin/src/test/kotlin/org/openapijsonschematools/client/components/schemas/ComposedStringTest.kt +++ /dev/null @@ -1,18 +0,0 @@ -package org.openapijsonschematools.client.components.schemas; - -import org.junit.Assert; -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.MapUtils; -import org.checkerframework.checker.nullness.qual.Nullable; - -import java.util.Arrays; -import java.util.List; -import java.util.Map; -import java.util.AbstractMap; - -public class ComposedStringTest { - static final SchemaConfiguration configuration = new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().format().build()); -} diff --git a/samples/client/petstore/kotlin/src/test/kotlin/org/openapijsonschematools/client/components/schemas/CurrencyTest.kt b/samples/client/petstore/kotlin/src/test/kotlin/org/openapijsonschematools/client/components/schemas/CurrencyTest.kt deleted file mode 100644 index a262a65cde1..00000000000 --- a/samples/client/petstore/kotlin/src/test/kotlin/org/openapijsonschematools/client/components/schemas/CurrencyTest.kt +++ /dev/null @@ -1,18 +0,0 @@ -package org.openapijsonschematools.client.components.schemas; - -import org.junit.Assert; -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.MapUtils; -import org.checkerframework.checker.nullness.qual.Nullable; - -import java.util.Arrays; -import java.util.List; -import java.util.Map; -import java.util.AbstractMap; - -public class CurrencyTest { - static final SchemaConfiguration configuration = new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().format().build()); -} diff --git a/samples/client/petstore/kotlin/src/test/kotlin/org/openapijsonschematools/client/components/schemas/DanishPigTest.kt b/samples/client/petstore/kotlin/src/test/kotlin/org/openapijsonschematools/client/components/schemas/DanishPigTest.kt deleted file mode 100644 index 327ffa70e1e..00000000000 --- a/samples/client/petstore/kotlin/src/test/kotlin/org/openapijsonschematools/client/components/schemas/DanishPigTest.kt +++ /dev/null @@ -1,18 +0,0 @@ -package org.openapijsonschematools.client.components.schemas; - -import org.junit.Assert; -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.MapUtils; -import org.checkerframework.checker.nullness.qual.Nullable; - -import java.util.Arrays; -import java.util.List; -import java.util.Map; -import java.util.AbstractMap; - -public class DanishPigTest { - static final SchemaConfiguration configuration = new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().format().build()); -} diff --git a/samples/client/petstore/kotlin/src/test/kotlin/org/openapijsonschematools/client/components/schemas/DateTimeTestTest.kt b/samples/client/petstore/kotlin/src/test/kotlin/org/openapijsonschematools/client/components/schemas/DateTimeTestTest.kt deleted file mode 100644 index 383bdc5fee1..00000000000 --- a/samples/client/petstore/kotlin/src/test/kotlin/org/openapijsonschematools/client/components/schemas/DateTimeTestTest.kt +++ /dev/null @@ -1,18 +0,0 @@ -package org.openapijsonschematools.client.components.schemas; - -import org.junit.Assert; -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.MapUtils; -import org.checkerframework.checker.nullness.qual.Nullable; - -import java.util.Arrays; -import java.util.List; -import java.util.Map; -import java.util.AbstractMap; - -public class DateTimeTestTest { - static final SchemaConfiguration configuration = new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().format().build()); -} diff --git a/samples/client/petstore/kotlin/src/test/kotlin/org/openapijsonschematools/client/components/schemas/DateTimeWithValidationsTest.kt b/samples/client/petstore/kotlin/src/test/kotlin/org/openapijsonschematools/client/components/schemas/DateTimeWithValidationsTest.kt deleted file mode 100644 index c7f15d7866b..00000000000 --- a/samples/client/petstore/kotlin/src/test/kotlin/org/openapijsonschematools/client/components/schemas/DateTimeWithValidationsTest.kt +++ /dev/null @@ -1,18 +0,0 @@ -package org.openapijsonschematools.client.components.schemas; - -import org.junit.Assert; -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.MapUtils; -import org.checkerframework.checker.nullness.qual.Nullable; - -import java.util.Arrays; -import java.util.List; -import java.util.Map; -import java.util.AbstractMap; - -public class DateTimeWithValidationsTest { - static final SchemaConfiguration configuration = new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().format().build()); -} diff --git a/samples/client/petstore/kotlin/src/test/kotlin/org/openapijsonschematools/client/components/schemas/DateWithValidationsTest.kt b/samples/client/petstore/kotlin/src/test/kotlin/org/openapijsonschematools/client/components/schemas/DateWithValidationsTest.kt deleted file mode 100644 index cec992f3cd6..00000000000 --- a/samples/client/petstore/kotlin/src/test/kotlin/org/openapijsonschematools/client/components/schemas/DateWithValidationsTest.kt +++ /dev/null @@ -1,18 +0,0 @@ -package org.openapijsonschematools.client.components.schemas; - -import org.junit.Assert; -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.MapUtils; -import org.checkerframework.checker.nullness.qual.Nullable; - -import java.util.Arrays; -import java.util.List; -import java.util.Map; -import java.util.AbstractMap; - -public class DateWithValidationsTest { - static final SchemaConfiguration configuration = new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().format().build()); -} diff --git a/samples/client/petstore/kotlin/src/test/kotlin/org/openapijsonschematools/client/components/schemas/DecimalPayloadTest.kt b/samples/client/petstore/kotlin/src/test/kotlin/org/openapijsonschematools/client/components/schemas/DecimalPayloadTest.kt deleted file mode 100644 index 450ac6beb0e..00000000000 --- a/samples/client/petstore/kotlin/src/test/kotlin/org/openapijsonschematools/client/components/schemas/DecimalPayloadTest.kt +++ /dev/null @@ -1,18 +0,0 @@ -package org.openapijsonschematools.client.components.schemas; - -import org.junit.Assert; -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.MapUtils; -import org.checkerframework.checker.nullness.qual.Nullable; - -import java.util.Arrays; -import java.util.List; -import java.util.Map; -import java.util.AbstractMap; - -public class DecimalPayloadTest { - static final SchemaConfiguration configuration = new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().format().build()); -} diff --git a/samples/client/petstore/kotlin/src/test/kotlin/org/openapijsonschematools/client/components/schemas/DogTest.kt b/samples/client/petstore/kotlin/src/test/kotlin/org/openapijsonschematools/client/components/schemas/DogTest.kt deleted file mode 100644 index 1698e6b82ad..00000000000 --- a/samples/client/petstore/kotlin/src/test/kotlin/org/openapijsonschematools/client/components/schemas/DogTest.kt +++ /dev/null @@ -1,18 +0,0 @@ -package org.openapijsonschematools.client.components.schemas; - -import org.junit.Assert; -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.MapUtils; -import org.checkerframework.checker.nullness.qual.Nullable; - -import java.util.Arrays; -import java.util.List; -import java.util.Map; -import java.util.AbstractMap; - -public class DogTest { - static final SchemaConfiguration configuration = new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().format().build()); -} diff --git a/samples/client/petstore/kotlin/src/test/kotlin/org/openapijsonschematools/client/components/schemas/DrawingTest.kt b/samples/client/petstore/kotlin/src/test/kotlin/org/openapijsonschematools/client/components/schemas/DrawingTest.kt deleted file mode 100644 index 9589e7e326f..00000000000 --- a/samples/client/petstore/kotlin/src/test/kotlin/org/openapijsonschematools/client/components/schemas/DrawingTest.kt +++ /dev/null @@ -1,18 +0,0 @@ -package org.openapijsonschematools.client.components.schemas; - -import org.junit.Assert; -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.MapUtils; -import org.checkerframework.checker.nullness.qual.Nullable; - -import java.util.Arrays; -import java.util.List; -import java.util.Map; -import java.util.AbstractMap; - -public class DrawingTest { - static final SchemaConfiguration configuration = new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().format().build()); -} diff --git a/samples/client/petstore/kotlin/src/test/kotlin/org/openapijsonschematools/client/components/schemas/EnumArraysTest.kt b/samples/client/petstore/kotlin/src/test/kotlin/org/openapijsonschematools/client/components/schemas/EnumArraysTest.kt deleted file mode 100644 index 9bfba584c0c..00000000000 --- a/samples/client/petstore/kotlin/src/test/kotlin/org/openapijsonschematools/client/components/schemas/EnumArraysTest.kt +++ /dev/null @@ -1,18 +0,0 @@ -package org.openapijsonschematools.client.components.schemas; - -import org.junit.Assert; -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.MapUtils; -import org.checkerframework.checker.nullness.qual.Nullable; - -import java.util.Arrays; -import java.util.List; -import java.util.Map; -import java.util.AbstractMap; - -public class EnumArraysTest { - static final SchemaConfiguration configuration = new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().format().build()); -} diff --git a/samples/client/petstore/kotlin/src/test/kotlin/org/openapijsonschematools/client/components/schemas/EnumClassTest.kt b/samples/client/petstore/kotlin/src/test/kotlin/org/openapijsonschematools/client/components/schemas/EnumClassTest.kt deleted file mode 100644 index 2202d623476..00000000000 --- a/samples/client/petstore/kotlin/src/test/kotlin/org/openapijsonschematools/client/components/schemas/EnumClassTest.kt +++ /dev/null @@ -1,18 +0,0 @@ -package org.openapijsonschematools.client.components.schemas; - -import org.junit.Assert; -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.MapUtils; -import org.checkerframework.checker.nullness.qual.Nullable; - -import java.util.Arrays; -import java.util.List; -import java.util.Map; -import java.util.AbstractMap; - -public class EnumClassTest { - static final SchemaConfiguration configuration = new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().format().build()); -} diff --git a/samples/client/petstore/kotlin/src/test/kotlin/org/openapijsonschematools/client/components/schemas/EnumTestTest.kt b/samples/client/petstore/kotlin/src/test/kotlin/org/openapijsonschematools/client/components/schemas/EnumTestTest.kt deleted file mode 100644 index 9676b34d4ce..00000000000 --- a/samples/client/petstore/kotlin/src/test/kotlin/org/openapijsonschematools/client/components/schemas/EnumTestTest.kt +++ /dev/null @@ -1,18 +0,0 @@ -package org.openapijsonschematools.client.components.schemas; - -import org.junit.Assert; -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.MapUtils; -import org.checkerframework.checker.nullness.qual.Nullable; - -import java.util.Arrays; -import java.util.List; -import java.util.Map; -import java.util.AbstractMap; - -public class EnumTestTest { - static final SchemaConfiguration configuration = new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().format().build()); -} diff --git a/samples/client/petstore/kotlin/src/test/kotlin/org/openapijsonschematools/client/components/schemas/EquilateralTriangleTest.kt b/samples/client/petstore/kotlin/src/test/kotlin/org/openapijsonschematools/client/components/schemas/EquilateralTriangleTest.kt deleted file mode 100644 index 6d75d2d7e3b..00000000000 --- a/samples/client/petstore/kotlin/src/test/kotlin/org/openapijsonschematools/client/components/schemas/EquilateralTriangleTest.kt +++ /dev/null @@ -1,18 +0,0 @@ -package org.openapijsonschematools.client.components.schemas; - -import org.junit.Assert; -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.MapUtils; -import org.checkerframework.checker.nullness.qual.Nullable; - -import java.util.Arrays; -import java.util.List; -import java.util.Map; -import java.util.AbstractMap; - -public class EquilateralTriangleTest { - static final SchemaConfiguration configuration = new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().format().build()); -} diff --git a/samples/client/petstore/kotlin/src/test/kotlin/org/openapijsonschematools/client/components/schemas/FileSchemaTestClassTest.kt b/samples/client/petstore/kotlin/src/test/kotlin/org/openapijsonschematools/client/components/schemas/FileSchemaTestClassTest.kt deleted file mode 100644 index 1d5bc8b29f5..00000000000 --- a/samples/client/petstore/kotlin/src/test/kotlin/org/openapijsonschematools/client/components/schemas/FileSchemaTestClassTest.kt +++ /dev/null @@ -1,18 +0,0 @@ -package org.openapijsonschematools.client.components.schemas; - -import org.junit.Assert; -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.MapUtils; -import org.checkerframework.checker.nullness.qual.Nullable; - -import java.util.Arrays; -import java.util.List; -import java.util.Map; -import java.util.AbstractMap; - -public class FileSchemaTestClassTest { - static final SchemaConfiguration configuration = new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().format().build()); -} diff --git a/samples/client/petstore/kotlin/src/test/kotlin/org/openapijsonschematools/client/components/schemas/FileTest.kt b/samples/client/petstore/kotlin/src/test/kotlin/org/openapijsonschematools/client/components/schemas/FileTest.kt deleted file mode 100644 index 54ce06dc444..00000000000 --- a/samples/client/petstore/kotlin/src/test/kotlin/org/openapijsonschematools/client/components/schemas/FileTest.kt +++ /dev/null @@ -1,18 +0,0 @@ -package org.openapijsonschematools.client.components.schemas; - -import org.junit.Assert; -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.MapUtils; -import org.checkerframework.checker.nullness.qual.Nullable; - -import java.util.Arrays; -import java.util.List; -import java.util.Map; -import java.util.AbstractMap; - -public class FileTest { - static final SchemaConfiguration configuration = new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().format().build()); -} diff --git a/samples/client/petstore/kotlin/src/test/kotlin/org/openapijsonschematools/client/components/schemas/FooTest.kt b/samples/client/petstore/kotlin/src/test/kotlin/org/openapijsonschematools/client/components/schemas/FooTest.kt deleted file mode 100644 index 2feb1595fc9..00000000000 --- a/samples/client/petstore/kotlin/src/test/kotlin/org/openapijsonschematools/client/components/schemas/FooTest.kt +++ /dev/null @@ -1,18 +0,0 @@ -package org.openapijsonschematools.client.components.schemas; - -import org.junit.Assert; -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.MapUtils; -import org.checkerframework.checker.nullness.qual.Nullable; - -import java.util.Arrays; -import java.util.List; -import java.util.Map; -import java.util.AbstractMap; - -public class FooTest { - static final SchemaConfiguration configuration = new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().format().build()); -} diff --git a/samples/client/petstore/kotlin/src/test/kotlin/org/openapijsonschematools/client/components/schemas/FormatTestTest.kt b/samples/client/petstore/kotlin/src/test/kotlin/org/openapijsonschematools/client/components/schemas/FormatTestTest.kt deleted file mode 100644 index 7d017bb8eef..00000000000 --- a/samples/client/petstore/kotlin/src/test/kotlin/org/openapijsonschematools/client/components/schemas/FormatTestTest.kt +++ /dev/null @@ -1,18 +0,0 @@ -package org.openapijsonschematools.client.components.schemas; - -import org.junit.Assert; -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.MapUtils; -import org.checkerframework.checker.nullness.qual.Nullable; - -import java.util.Arrays; -import java.util.List; -import java.util.Map; -import java.util.AbstractMap; - -public class FormatTestTest { - static final SchemaConfiguration configuration = new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().format().build()); -} diff --git a/samples/client/petstore/kotlin/src/test/kotlin/org/openapijsonschematools/client/components/schemas/FromSchemaTest.kt b/samples/client/petstore/kotlin/src/test/kotlin/org/openapijsonschematools/client/components/schemas/FromSchemaTest.kt deleted file mode 100644 index 378ffb904f6..00000000000 --- a/samples/client/petstore/kotlin/src/test/kotlin/org/openapijsonschematools/client/components/schemas/FromSchemaTest.kt +++ /dev/null @@ -1,18 +0,0 @@ -package org.openapijsonschematools.client.components.schemas; - -import org.junit.Assert; -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.MapUtils; -import org.checkerframework.checker.nullness.qual.Nullable; - -import java.util.Arrays; -import java.util.List; -import java.util.Map; -import java.util.AbstractMap; - -public class FromSchemaTest { - static final SchemaConfiguration configuration = new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().format().build()); -} diff --git a/samples/client/petstore/kotlin/src/test/kotlin/org/openapijsonschematools/client/components/schemas/FruitReqTest.kt b/samples/client/petstore/kotlin/src/test/kotlin/org/openapijsonschematools/client/components/schemas/FruitReqTest.kt deleted file mode 100644 index f299cf8cbbb..00000000000 --- a/samples/client/petstore/kotlin/src/test/kotlin/org/openapijsonschematools/client/components/schemas/FruitReqTest.kt +++ /dev/null @@ -1,18 +0,0 @@ -package org.openapijsonschematools.client.components.schemas; - -import org.junit.Assert; -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.MapUtils; -import org.checkerframework.checker.nullness.qual.Nullable; - -import java.util.Arrays; -import java.util.List; -import java.util.Map; -import java.util.AbstractMap; - -public class FruitReqTest { - static final SchemaConfiguration configuration = new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().format().build()); -} diff --git a/samples/client/petstore/kotlin/src/test/kotlin/org/openapijsonschematools/client/components/schemas/FruitTest.kt b/samples/client/petstore/kotlin/src/test/kotlin/org/openapijsonschematools/client/components/schemas/FruitTest.kt deleted file mode 100644 index 9d6594733dd..00000000000 --- a/samples/client/petstore/kotlin/src/test/kotlin/org/openapijsonschematools/client/components/schemas/FruitTest.kt +++ /dev/null @@ -1,18 +0,0 @@ -package org.openapijsonschematools.client.components.schemas; - -import org.junit.Assert; -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.MapUtils; -import org.checkerframework.checker.nullness.qual.Nullable; - -import java.util.Arrays; -import java.util.List; -import java.util.Map; -import java.util.AbstractMap; - -public class FruitTest { - static final SchemaConfiguration configuration = new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().format().build()); -} diff --git a/samples/client/petstore/kotlin/src/test/kotlin/org/openapijsonschematools/client/components/schemas/GmFruitTest.kt b/samples/client/petstore/kotlin/src/test/kotlin/org/openapijsonschematools/client/components/schemas/GmFruitTest.kt deleted file mode 100644 index bf570ab57e6..00000000000 --- a/samples/client/petstore/kotlin/src/test/kotlin/org/openapijsonschematools/client/components/schemas/GmFruitTest.kt +++ /dev/null @@ -1,18 +0,0 @@ -package org.openapijsonschematools.client.components.schemas; - -import org.junit.Assert; -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.MapUtils; -import org.checkerframework.checker.nullness.qual.Nullable; - -import java.util.Arrays; -import java.util.List; -import java.util.Map; -import java.util.AbstractMap; - -public class GmFruitTest { - static final SchemaConfiguration configuration = new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().format().build()); -} diff --git a/samples/client/petstore/kotlin/src/test/kotlin/org/openapijsonschematools/client/components/schemas/GrandparentAnimalTest.kt b/samples/client/petstore/kotlin/src/test/kotlin/org/openapijsonschematools/client/components/schemas/GrandparentAnimalTest.kt deleted file mode 100644 index 930d4fe4049..00000000000 --- a/samples/client/petstore/kotlin/src/test/kotlin/org/openapijsonschematools/client/components/schemas/GrandparentAnimalTest.kt +++ /dev/null @@ -1,18 +0,0 @@ -package org.openapijsonschematools.client.components.schemas; - -import org.junit.Assert; -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.MapUtils; -import org.checkerframework.checker.nullness.qual.Nullable; - -import java.util.Arrays; -import java.util.List; -import java.util.Map; -import java.util.AbstractMap; - -public class GrandparentAnimalTest { - static final SchemaConfiguration configuration = new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().format().build()); -} diff --git a/samples/client/petstore/kotlin/src/test/kotlin/org/openapijsonschematools/client/components/schemas/HasOnlyReadOnlyTest.kt b/samples/client/petstore/kotlin/src/test/kotlin/org/openapijsonschematools/client/components/schemas/HasOnlyReadOnlyTest.kt deleted file mode 100644 index 3a286d0ff01..00000000000 --- a/samples/client/petstore/kotlin/src/test/kotlin/org/openapijsonschematools/client/components/schemas/HasOnlyReadOnlyTest.kt +++ /dev/null @@ -1,18 +0,0 @@ -package org.openapijsonschematools.client.components.schemas; - -import org.junit.Assert; -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.MapUtils; -import org.checkerframework.checker.nullness.qual.Nullable; - -import java.util.Arrays; -import java.util.List; -import java.util.Map; -import java.util.AbstractMap; - -public class HasOnlyReadOnlyTest { - static final SchemaConfiguration configuration = new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().format().build()); -} diff --git a/samples/client/petstore/kotlin/src/test/kotlin/org/openapijsonschematools/client/components/schemas/HealthCheckResultTest.kt b/samples/client/petstore/kotlin/src/test/kotlin/org/openapijsonschematools/client/components/schemas/HealthCheckResultTest.kt deleted file mode 100644 index 279d614f9fe..00000000000 --- a/samples/client/petstore/kotlin/src/test/kotlin/org/openapijsonschematools/client/components/schemas/HealthCheckResultTest.kt +++ /dev/null @@ -1,18 +0,0 @@ -package org.openapijsonschematools.client.components.schemas; - -import org.junit.Assert; -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.MapUtils; -import org.checkerframework.checker.nullness.qual.Nullable; - -import java.util.Arrays; -import java.util.List; -import java.util.Map; -import java.util.AbstractMap; - -public class HealthCheckResultTest { - static final SchemaConfiguration configuration = new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().format().build()); -} diff --git a/samples/client/petstore/kotlin/src/test/kotlin/org/openapijsonschematools/client/components/schemas/IntegerEnumBigTest.kt b/samples/client/petstore/kotlin/src/test/kotlin/org/openapijsonschematools/client/components/schemas/IntegerEnumBigTest.kt deleted file mode 100644 index 77ed6c4d822..00000000000 --- a/samples/client/petstore/kotlin/src/test/kotlin/org/openapijsonschematools/client/components/schemas/IntegerEnumBigTest.kt +++ /dev/null @@ -1,18 +0,0 @@ -package org.openapijsonschematools.client.components.schemas; - -import org.junit.Assert; -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.MapUtils; -import org.checkerframework.checker.nullness.qual.Nullable; - -import java.util.Arrays; -import java.util.List; -import java.util.Map; -import java.util.AbstractMap; - -public class IntegerEnumBigTest { - static final SchemaConfiguration configuration = new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().format().build()); -} diff --git a/samples/client/petstore/kotlin/src/test/kotlin/org/openapijsonschematools/client/components/schemas/IntegerEnumOneValueTest.kt b/samples/client/petstore/kotlin/src/test/kotlin/org/openapijsonschematools/client/components/schemas/IntegerEnumOneValueTest.kt deleted file mode 100644 index 8a005624d3f..00000000000 --- a/samples/client/petstore/kotlin/src/test/kotlin/org/openapijsonschematools/client/components/schemas/IntegerEnumOneValueTest.kt +++ /dev/null @@ -1,18 +0,0 @@ -package org.openapijsonschematools.client.components.schemas; - -import org.junit.Assert; -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.MapUtils; -import org.checkerframework.checker.nullness.qual.Nullable; - -import java.util.Arrays; -import java.util.List; -import java.util.Map; -import java.util.AbstractMap; - -public class IntegerEnumOneValueTest { - static final SchemaConfiguration configuration = new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().format().build()); -} diff --git a/samples/client/petstore/kotlin/src/test/kotlin/org/openapijsonschematools/client/components/schemas/IntegerEnumTest.kt b/samples/client/petstore/kotlin/src/test/kotlin/org/openapijsonschematools/client/components/schemas/IntegerEnumTest.kt deleted file mode 100644 index 898b123a094..00000000000 --- a/samples/client/petstore/kotlin/src/test/kotlin/org/openapijsonschematools/client/components/schemas/IntegerEnumTest.kt +++ /dev/null @@ -1,18 +0,0 @@ -package org.openapijsonschematools.client.components.schemas; - -import org.junit.Assert; -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.MapUtils; -import org.checkerframework.checker.nullness.qual.Nullable; - -import java.util.Arrays; -import java.util.List; -import java.util.Map; -import java.util.AbstractMap; - -public class IntegerEnumTest { - static final SchemaConfiguration configuration = new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().format().build()); -} diff --git a/samples/client/petstore/kotlin/src/test/kotlin/org/openapijsonschematools/client/components/schemas/IntegerEnumWithDefaultValueTest.kt b/samples/client/petstore/kotlin/src/test/kotlin/org/openapijsonschematools/client/components/schemas/IntegerEnumWithDefaultValueTest.kt deleted file mode 100644 index df79ff7d437..00000000000 --- a/samples/client/petstore/kotlin/src/test/kotlin/org/openapijsonschematools/client/components/schemas/IntegerEnumWithDefaultValueTest.kt +++ /dev/null @@ -1,18 +0,0 @@ -package org.openapijsonschematools.client.components.schemas; - -import org.junit.Assert; -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.MapUtils; -import org.checkerframework.checker.nullness.qual.Nullable; - -import java.util.Arrays; -import java.util.List; -import java.util.Map; -import java.util.AbstractMap; - -public class IntegerEnumWithDefaultValueTest { - static final SchemaConfiguration configuration = new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().format().build()); -} diff --git a/samples/client/petstore/kotlin/src/test/kotlin/org/openapijsonschematools/client/components/schemas/IntegerMax10Test.kt b/samples/client/petstore/kotlin/src/test/kotlin/org/openapijsonschematools/client/components/schemas/IntegerMax10Test.kt deleted file mode 100644 index 4e809cd1c84..00000000000 --- a/samples/client/petstore/kotlin/src/test/kotlin/org/openapijsonschematools/client/components/schemas/IntegerMax10Test.kt +++ /dev/null @@ -1,18 +0,0 @@ -package org.openapijsonschematools.client.components.schemas; - -import org.junit.Assert; -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.MapUtils; -import org.checkerframework.checker.nullness.qual.Nullable; - -import java.util.Arrays; -import java.util.List; -import java.util.Map; -import java.util.AbstractMap; - -public class IntegerMax10Test { - static final SchemaConfiguration configuration = new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().format().build()); -} diff --git a/samples/client/petstore/kotlin/src/test/kotlin/org/openapijsonschematools/client/components/schemas/IntegerMin15Test.kt b/samples/client/petstore/kotlin/src/test/kotlin/org/openapijsonschematools/client/components/schemas/IntegerMin15Test.kt deleted file mode 100644 index ead4611e53b..00000000000 --- a/samples/client/petstore/kotlin/src/test/kotlin/org/openapijsonschematools/client/components/schemas/IntegerMin15Test.kt +++ /dev/null @@ -1,18 +0,0 @@ -package org.openapijsonschematools.client.components.schemas; - -import org.junit.Assert; -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.MapUtils; -import org.checkerframework.checker.nullness.qual.Nullable; - -import java.util.Arrays; -import java.util.List; -import java.util.Map; -import java.util.AbstractMap; - -public class IntegerMin15Test { - static final SchemaConfiguration configuration = new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().format().build()); -} diff --git a/samples/client/petstore/kotlin/src/test/kotlin/org/openapijsonschematools/client/components/schemas/IsoscelesTriangleTest.kt b/samples/client/petstore/kotlin/src/test/kotlin/org/openapijsonschematools/client/components/schemas/IsoscelesTriangleTest.kt deleted file mode 100644 index 7c0bd3d8ca2..00000000000 --- a/samples/client/petstore/kotlin/src/test/kotlin/org/openapijsonschematools/client/components/schemas/IsoscelesTriangleTest.kt +++ /dev/null @@ -1,18 +0,0 @@ -package org.openapijsonschematools.client.components.schemas; - -import org.junit.Assert; -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.MapUtils; -import org.checkerframework.checker.nullness.qual.Nullable; - -import java.util.Arrays; -import java.util.List; -import java.util.Map; -import java.util.AbstractMap; - -public class IsoscelesTriangleTest { - static final SchemaConfiguration configuration = new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().format().build()); -} diff --git a/samples/client/petstore/kotlin/src/test/kotlin/org/openapijsonschematools/client/components/schemas/ItemsSchemaTest.kt b/samples/client/petstore/kotlin/src/test/kotlin/org/openapijsonschematools/client/components/schemas/ItemsSchemaTest.kt deleted file mode 100644 index e75838f4e6a..00000000000 --- a/samples/client/petstore/kotlin/src/test/kotlin/org/openapijsonschematools/client/components/schemas/ItemsSchemaTest.kt +++ /dev/null @@ -1,18 +0,0 @@ -package org.openapijsonschematools.client.components.schemas; - -import org.junit.Assert; -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.MapUtils; -import org.checkerframework.checker.nullness.qual.Nullable; - -import java.util.Arrays; -import java.util.List; -import java.util.Map; -import java.util.AbstractMap; - -public class ItemsSchemaTest { - static final SchemaConfiguration configuration = new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().format().build()); -} diff --git a/samples/client/petstore/kotlin/src/test/kotlin/org/openapijsonschematools/client/components/schemas/ItemsTest.kt b/samples/client/petstore/kotlin/src/test/kotlin/org/openapijsonschematools/client/components/schemas/ItemsTest.kt deleted file mode 100644 index d6d26bc51b1..00000000000 --- a/samples/client/petstore/kotlin/src/test/kotlin/org/openapijsonschematools/client/components/schemas/ItemsTest.kt +++ /dev/null @@ -1,18 +0,0 @@ -package org.openapijsonschematools.client.components.schemas; - -import org.junit.Assert; -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.MapUtils; -import org.checkerframework.checker.nullness.qual.Nullable; - -import java.util.Arrays; -import java.util.List; -import java.util.Map; -import java.util.AbstractMap; - -public class ItemsTest { - static final SchemaConfiguration configuration = new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().format().build()); -} diff --git a/samples/client/petstore/kotlin/src/test/kotlin/org/openapijsonschematools/client/components/schemas/JSONPatchRequestAddReplaceTestTest.kt b/samples/client/petstore/kotlin/src/test/kotlin/org/openapijsonschematools/client/components/schemas/JSONPatchRequestAddReplaceTestTest.kt deleted file mode 100644 index 7ac8dc5d85e..00000000000 --- a/samples/client/petstore/kotlin/src/test/kotlin/org/openapijsonschematools/client/components/schemas/JSONPatchRequestAddReplaceTestTest.kt +++ /dev/null @@ -1,18 +0,0 @@ -package org.openapijsonschematools.client.components.schemas; - -import org.junit.Assert; -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.MapUtils; -import org.checkerframework.checker.nullness.qual.Nullable; - -import java.util.Arrays; -import java.util.List; -import java.util.Map; -import java.util.AbstractMap; - -public class JSONPatchRequestAddReplaceTestTest { - static final SchemaConfiguration configuration = new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().format().build()); -} diff --git a/samples/client/petstore/kotlin/src/test/kotlin/org/openapijsonschematools/client/components/schemas/JSONPatchRequestMoveCopyTest.kt b/samples/client/petstore/kotlin/src/test/kotlin/org/openapijsonschematools/client/components/schemas/JSONPatchRequestMoveCopyTest.kt deleted file mode 100644 index 8f01a7c1b97..00000000000 --- a/samples/client/petstore/kotlin/src/test/kotlin/org/openapijsonschematools/client/components/schemas/JSONPatchRequestMoveCopyTest.kt +++ /dev/null @@ -1,18 +0,0 @@ -package org.openapijsonschematools.client.components.schemas; - -import org.junit.Assert; -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.MapUtils; -import org.checkerframework.checker.nullness.qual.Nullable; - -import java.util.Arrays; -import java.util.List; -import java.util.Map; -import java.util.AbstractMap; - -public class JSONPatchRequestMoveCopyTest { - static final SchemaConfiguration configuration = new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().format().build()); -} diff --git a/samples/client/petstore/kotlin/src/test/kotlin/org/openapijsonschematools/client/components/schemas/JSONPatchRequestRemoveTest.kt b/samples/client/petstore/kotlin/src/test/kotlin/org/openapijsonschematools/client/components/schemas/JSONPatchRequestRemoveTest.kt deleted file mode 100644 index d896defd64a..00000000000 --- a/samples/client/petstore/kotlin/src/test/kotlin/org/openapijsonschematools/client/components/schemas/JSONPatchRequestRemoveTest.kt +++ /dev/null @@ -1,18 +0,0 @@ -package org.openapijsonschematools.client.components.schemas; - -import org.junit.Assert; -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.MapUtils; -import org.checkerframework.checker.nullness.qual.Nullable; - -import java.util.Arrays; -import java.util.List; -import java.util.Map; -import java.util.AbstractMap; - -public class JSONPatchRequestRemoveTest { - static final SchemaConfiguration configuration = new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().format().build()); -} diff --git a/samples/client/petstore/kotlin/src/test/kotlin/org/openapijsonschematools/client/components/schemas/JSONPatchRequestTest.kt b/samples/client/petstore/kotlin/src/test/kotlin/org/openapijsonschematools/client/components/schemas/JSONPatchRequestTest.kt deleted file mode 100644 index 64f57bc881e..00000000000 --- a/samples/client/petstore/kotlin/src/test/kotlin/org/openapijsonschematools/client/components/schemas/JSONPatchRequestTest.kt +++ /dev/null @@ -1,18 +0,0 @@ -package org.openapijsonschematools.client.components.schemas; - -import org.junit.Assert; -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.MapUtils; -import org.checkerframework.checker.nullness.qual.Nullable; - -import java.util.Arrays; -import java.util.List; -import java.util.Map; -import java.util.AbstractMap; - -public class JSONPatchRequestTest { - static final SchemaConfiguration configuration = new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().format().build()); -} diff --git a/samples/client/petstore/kotlin/src/test/kotlin/org/openapijsonschematools/client/components/schemas/MammalTest.kt b/samples/client/petstore/kotlin/src/test/kotlin/org/openapijsonschematools/client/components/schemas/MammalTest.kt deleted file mode 100644 index 54525d02af1..00000000000 --- a/samples/client/petstore/kotlin/src/test/kotlin/org/openapijsonschematools/client/components/schemas/MammalTest.kt +++ /dev/null @@ -1,18 +0,0 @@ -package org.openapijsonschematools.client.components.schemas; - -import org.junit.Assert; -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.MapUtils; -import org.checkerframework.checker.nullness.qual.Nullable; - -import java.util.Arrays; -import java.util.List; -import java.util.Map; -import java.util.AbstractMap; - -public class MammalTest { - static final SchemaConfiguration configuration = new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().format().build()); -} diff --git a/samples/client/petstore/kotlin/src/test/kotlin/org/openapijsonschematools/client/components/schemas/MapTestTest.kt b/samples/client/petstore/kotlin/src/test/kotlin/org/openapijsonschematools/client/components/schemas/MapTestTest.kt deleted file mode 100644 index 3b8e6f70bfa..00000000000 --- a/samples/client/petstore/kotlin/src/test/kotlin/org/openapijsonschematools/client/components/schemas/MapTestTest.kt +++ /dev/null @@ -1,18 +0,0 @@ -package org.openapijsonschematools.client.components.schemas; - -import org.junit.Assert; -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.MapUtils; -import org.checkerframework.checker.nullness.qual.Nullable; - -import java.util.Arrays; -import java.util.List; -import java.util.Map; -import java.util.AbstractMap; - -public class MapTestTest { - static final SchemaConfiguration configuration = new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().format().build()); -} diff --git a/samples/client/petstore/kotlin/src/test/kotlin/org/openapijsonschematools/client/components/schemas/MixedPropertiesAndAdditionalPropertiesClassTest.kt b/samples/client/petstore/kotlin/src/test/kotlin/org/openapijsonschematools/client/components/schemas/MixedPropertiesAndAdditionalPropertiesClassTest.kt deleted file mode 100644 index 64fd5bbbbc4..00000000000 --- a/samples/client/petstore/kotlin/src/test/kotlin/org/openapijsonschematools/client/components/schemas/MixedPropertiesAndAdditionalPropertiesClassTest.kt +++ /dev/null @@ -1,18 +0,0 @@ -package org.openapijsonschematools.client.components.schemas; - -import org.junit.Assert; -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.MapUtils; -import org.checkerframework.checker.nullness.qual.Nullable; - -import java.util.Arrays; -import java.util.List; -import java.util.Map; -import java.util.AbstractMap; - -public class MixedPropertiesAndAdditionalPropertiesClassTest { - static final SchemaConfiguration configuration = new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().format().build()); -} diff --git a/samples/client/petstore/kotlin/src/test/kotlin/org/openapijsonschematools/client/components/schemas/MoneyTest.kt b/samples/client/petstore/kotlin/src/test/kotlin/org/openapijsonschematools/client/components/schemas/MoneyTest.kt deleted file mode 100644 index 74495479867..00000000000 --- a/samples/client/petstore/kotlin/src/test/kotlin/org/openapijsonschematools/client/components/schemas/MoneyTest.kt +++ /dev/null @@ -1,18 +0,0 @@ -package org.openapijsonschematools.client.components.schemas; - -import org.junit.Assert; -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.MapUtils; -import org.checkerframework.checker.nullness.qual.Nullable; - -import java.util.Arrays; -import java.util.List; -import java.util.Map; -import java.util.AbstractMap; - -public class MoneyTest { - static final SchemaConfiguration configuration = new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().format().build()); -} diff --git a/samples/client/petstore/kotlin/src/test/kotlin/org/openapijsonschematools/client/components/schemas/MultiPropertiesSchemaTest.kt b/samples/client/petstore/kotlin/src/test/kotlin/org/openapijsonschematools/client/components/schemas/MultiPropertiesSchemaTest.kt deleted file mode 100644 index d838324a427..00000000000 --- a/samples/client/petstore/kotlin/src/test/kotlin/org/openapijsonschematools/client/components/schemas/MultiPropertiesSchemaTest.kt +++ /dev/null @@ -1,18 +0,0 @@ -package org.openapijsonschematools.client.components.schemas; - -import org.junit.Assert; -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.MapUtils; -import org.checkerframework.checker.nullness.qual.Nullable; - -import java.util.Arrays; -import java.util.List; -import java.util.Map; -import java.util.AbstractMap; - -public class MultiPropertiesSchemaTest { - static final SchemaConfiguration configuration = new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().format().build()); -} diff --git a/samples/client/petstore/kotlin/src/test/kotlin/org/openapijsonschematools/client/components/schemas/MyObjectDtoTest.kt b/samples/client/petstore/kotlin/src/test/kotlin/org/openapijsonschematools/client/components/schemas/MyObjectDtoTest.kt deleted file mode 100644 index 87f7d053a13..00000000000 --- a/samples/client/petstore/kotlin/src/test/kotlin/org/openapijsonschematools/client/components/schemas/MyObjectDtoTest.kt +++ /dev/null @@ -1,18 +0,0 @@ -package org.openapijsonschematools.client.components.schemas; - -import org.junit.Assert; -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.MapUtils; -import org.checkerframework.checker.nullness.qual.Nullable; - -import java.util.Arrays; -import java.util.List; -import java.util.Map; -import java.util.AbstractMap; - -public class MyObjectDtoTest { - static final SchemaConfiguration configuration = new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().format().build()); -} diff --git a/samples/client/petstore/kotlin/src/test/kotlin/org/openapijsonschematools/client/components/schemas/NameTest.kt b/samples/client/petstore/kotlin/src/test/kotlin/org/openapijsonschematools/client/components/schemas/NameTest.kt deleted file mode 100644 index 76a95741398..00000000000 --- a/samples/client/petstore/kotlin/src/test/kotlin/org/openapijsonschematools/client/components/schemas/NameTest.kt +++ /dev/null @@ -1,18 +0,0 @@ -package org.openapijsonschematools.client.components.schemas; - -import org.junit.Assert; -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.MapUtils; -import org.checkerframework.checker.nullness.qual.Nullable; - -import java.util.Arrays; -import java.util.List; -import java.util.Map; -import java.util.AbstractMap; - -public class NameTest { - static final SchemaConfiguration configuration = new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().format().build()); -} diff --git a/samples/client/petstore/kotlin/src/test/kotlin/org/openapijsonschematools/client/components/schemas/NoAdditionalPropertiesTest.kt b/samples/client/petstore/kotlin/src/test/kotlin/org/openapijsonschematools/client/components/schemas/NoAdditionalPropertiesTest.kt deleted file mode 100644 index d79e22490ff..00000000000 --- a/samples/client/petstore/kotlin/src/test/kotlin/org/openapijsonschematools/client/components/schemas/NoAdditionalPropertiesTest.kt +++ /dev/null @@ -1,18 +0,0 @@ -package org.openapijsonschematools.client.components.schemas; - -import org.junit.Assert; -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.MapUtils; -import org.checkerframework.checker.nullness.qual.Nullable; - -import java.util.Arrays; -import java.util.List; -import java.util.Map; -import java.util.AbstractMap; - -public class NoAdditionalPropertiesTest { - static final SchemaConfiguration configuration = new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().format().build()); -} diff --git a/samples/client/petstore/kotlin/src/test/kotlin/org/openapijsonschematools/client/components/schemas/NullableClassTest.kt b/samples/client/petstore/kotlin/src/test/kotlin/org/openapijsonschematools/client/components/schemas/NullableClassTest.kt deleted file mode 100644 index 0c581203075..00000000000 --- a/samples/client/petstore/kotlin/src/test/kotlin/org/openapijsonschematools/client/components/schemas/NullableClassTest.kt +++ /dev/null @@ -1,18 +0,0 @@ -package org.openapijsonschematools.client.components.schemas; - -import org.junit.Assert; -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.MapUtils; -import org.checkerframework.checker.nullness.qual.Nullable; - -import java.util.Arrays; -import java.util.List; -import java.util.Map; -import java.util.AbstractMap; - -public class NullableClassTest { - static final SchemaConfiguration configuration = new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().format().build()); -} diff --git a/samples/client/petstore/kotlin/src/test/kotlin/org/openapijsonschematools/client/components/schemas/NullableShapeTest.kt b/samples/client/petstore/kotlin/src/test/kotlin/org/openapijsonschematools/client/components/schemas/NullableShapeTest.kt deleted file mode 100644 index ad28aa7079a..00000000000 --- a/samples/client/petstore/kotlin/src/test/kotlin/org/openapijsonschematools/client/components/schemas/NullableShapeTest.kt +++ /dev/null @@ -1,18 +0,0 @@ -package org.openapijsonschematools.client.components.schemas; - -import org.junit.Assert; -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.MapUtils; -import org.checkerframework.checker.nullness.qual.Nullable; - -import java.util.Arrays; -import java.util.List; -import java.util.Map; -import java.util.AbstractMap; - -public class NullableShapeTest { - static final SchemaConfiguration configuration = new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().format().build()); -} diff --git a/samples/client/petstore/kotlin/src/test/kotlin/org/openapijsonschematools/client/components/schemas/NullableStringTest.kt b/samples/client/petstore/kotlin/src/test/kotlin/org/openapijsonschematools/client/components/schemas/NullableStringTest.kt deleted file mode 100644 index 5b1d78012e4..00000000000 --- a/samples/client/petstore/kotlin/src/test/kotlin/org/openapijsonschematools/client/components/schemas/NullableStringTest.kt +++ /dev/null @@ -1,18 +0,0 @@ -package org.openapijsonschematools.client.components.schemas; - -import org.junit.Assert; -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.MapUtils; -import org.checkerframework.checker.nullness.qual.Nullable; - -import java.util.Arrays; -import java.util.List; -import java.util.Map; -import java.util.AbstractMap; - -public class NullableStringTest { - static final SchemaConfiguration configuration = new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().format().build()); -} diff --git a/samples/client/petstore/kotlin/src/test/kotlin/org/openapijsonschematools/client/components/schemas/NumberOnlyTest.kt b/samples/client/petstore/kotlin/src/test/kotlin/org/openapijsonschematools/client/components/schemas/NumberOnlyTest.kt deleted file mode 100644 index 0ac1388ab72..00000000000 --- a/samples/client/petstore/kotlin/src/test/kotlin/org/openapijsonschematools/client/components/schemas/NumberOnlyTest.kt +++ /dev/null @@ -1,18 +0,0 @@ -package org.openapijsonschematools.client.components.schemas; - -import org.junit.Assert; -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.MapUtils; -import org.checkerframework.checker.nullness.qual.Nullable; - -import java.util.Arrays; -import java.util.List; -import java.util.Map; -import java.util.AbstractMap; - -public class NumberOnlyTest { - static final SchemaConfiguration configuration = new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().format().build()); -} diff --git a/samples/client/petstore/kotlin/src/test/kotlin/org/openapijsonschematools/client/components/schemas/NumberSchemaTest.kt b/samples/client/petstore/kotlin/src/test/kotlin/org/openapijsonschematools/client/components/schemas/NumberSchemaTest.kt deleted file mode 100644 index ddf1eb7a687..00000000000 --- a/samples/client/petstore/kotlin/src/test/kotlin/org/openapijsonschematools/client/components/schemas/NumberSchemaTest.kt +++ /dev/null @@ -1,18 +0,0 @@ -package org.openapijsonschematools.client.components.schemas; - -import org.junit.Assert; -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.MapUtils; -import org.checkerframework.checker.nullness.qual.Nullable; - -import java.util.Arrays; -import java.util.List; -import java.util.Map; -import java.util.AbstractMap; - -public class NumberSchemaTest { - static final SchemaConfiguration configuration = new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().format().build()); -} diff --git a/samples/client/petstore/kotlin/src/test/kotlin/org/openapijsonschematools/client/components/schemas/NumberWithExclusiveMinMaxTest.kt b/samples/client/petstore/kotlin/src/test/kotlin/org/openapijsonschematools/client/components/schemas/NumberWithExclusiveMinMaxTest.kt deleted file mode 100644 index 7ea2fffdb56..00000000000 --- a/samples/client/petstore/kotlin/src/test/kotlin/org/openapijsonschematools/client/components/schemas/NumberWithExclusiveMinMaxTest.kt +++ /dev/null @@ -1,18 +0,0 @@ -package org.openapijsonschematools.client.components.schemas; - -import org.junit.Assert; -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.MapUtils; -import org.checkerframework.checker.nullness.qual.Nullable; - -import java.util.Arrays; -import java.util.List; -import java.util.Map; -import java.util.AbstractMap; - -public class NumberWithExclusiveMinMaxTest { - static final SchemaConfiguration configuration = new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().format().build()); -} diff --git a/samples/client/petstore/kotlin/src/test/kotlin/org/openapijsonschematools/client/components/schemas/NumberWithValidationsTest.kt b/samples/client/petstore/kotlin/src/test/kotlin/org/openapijsonschematools/client/components/schemas/NumberWithValidationsTest.kt deleted file mode 100644 index b0e61f9802c..00000000000 --- a/samples/client/petstore/kotlin/src/test/kotlin/org/openapijsonschematools/client/components/schemas/NumberWithValidationsTest.kt +++ /dev/null @@ -1,18 +0,0 @@ -package org.openapijsonschematools.client.components.schemas; - -import org.junit.Assert; -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.MapUtils; -import org.checkerframework.checker.nullness.qual.Nullable; - -import java.util.Arrays; -import java.util.List; -import java.util.Map; -import java.util.AbstractMap; - -public class NumberWithValidationsTest { - static final SchemaConfiguration configuration = new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().format().build()); -} diff --git a/samples/client/petstore/kotlin/src/test/kotlin/org/openapijsonschematools/client/components/schemas/ObjWithRequiredPropsBaseTest.kt b/samples/client/petstore/kotlin/src/test/kotlin/org/openapijsonschematools/client/components/schemas/ObjWithRequiredPropsBaseTest.kt deleted file mode 100644 index 3b15661c054..00000000000 --- a/samples/client/petstore/kotlin/src/test/kotlin/org/openapijsonschematools/client/components/schemas/ObjWithRequiredPropsBaseTest.kt +++ /dev/null @@ -1,18 +0,0 @@ -package org.openapijsonschematools.client.components.schemas; - -import org.junit.Assert; -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.MapUtils; -import org.checkerframework.checker.nullness.qual.Nullable; - -import java.util.Arrays; -import java.util.List; -import java.util.Map; -import java.util.AbstractMap; - -public class ObjWithRequiredPropsBaseTest { - static final SchemaConfiguration configuration = new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().format().build()); -} diff --git a/samples/client/petstore/kotlin/src/test/kotlin/org/openapijsonschematools/client/components/schemas/ObjWithRequiredPropsTest.kt b/samples/client/petstore/kotlin/src/test/kotlin/org/openapijsonschematools/client/components/schemas/ObjWithRequiredPropsTest.kt deleted file mode 100644 index 105eb63fe1e..00000000000 --- a/samples/client/petstore/kotlin/src/test/kotlin/org/openapijsonschematools/client/components/schemas/ObjWithRequiredPropsTest.kt +++ /dev/null @@ -1,18 +0,0 @@ -package org.openapijsonschematools.client.components.schemas; - -import org.junit.Assert; -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.MapUtils; -import org.checkerframework.checker.nullness.qual.Nullable; - -import java.util.Arrays; -import java.util.List; -import java.util.Map; -import java.util.AbstractMap; - -public class ObjWithRequiredPropsTest { - static final SchemaConfiguration configuration = new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().format().build()); -} diff --git a/samples/client/petstore/kotlin/src/test/kotlin/org/openapijsonschematools/client/components/schemas/ObjectInterfaceTest.kt b/samples/client/petstore/kotlin/src/test/kotlin/org/openapijsonschematools/client/components/schemas/ObjectInterfaceTest.kt deleted file mode 100644 index 10a0a08b90d..00000000000 --- a/samples/client/petstore/kotlin/src/test/kotlin/org/openapijsonschematools/client/components/schemas/ObjectInterfaceTest.kt +++ /dev/null @@ -1,18 +0,0 @@ -package org.openapijsonschematools.client.components.schemas; - -import org.junit.Assert; -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.MapUtils; -import org.checkerframework.checker.nullness.qual.Nullable; - -import java.util.Arrays; -import java.util.List; -import java.util.Map; -import java.util.AbstractMap; - -public class ObjectInterfaceTest { - static final SchemaConfiguration configuration = new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().format().build()); -} diff --git a/samples/client/petstore/kotlin/src/test/kotlin/org/openapijsonschematools/client/components/schemas/ObjectModelWithArgAndArgsPropertiesTest.kt b/samples/client/petstore/kotlin/src/test/kotlin/org/openapijsonschematools/client/components/schemas/ObjectModelWithArgAndArgsPropertiesTest.kt deleted file mode 100644 index 1d20ae276a9..00000000000 --- a/samples/client/petstore/kotlin/src/test/kotlin/org/openapijsonschematools/client/components/schemas/ObjectModelWithArgAndArgsPropertiesTest.kt +++ /dev/null @@ -1,18 +0,0 @@ -package org.openapijsonschematools.client.components.schemas; - -import org.junit.Assert; -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.MapUtils; -import org.checkerframework.checker.nullness.qual.Nullable; - -import java.util.Arrays; -import java.util.List; -import java.util.Map; -import java.util.AbstractMap; - -public class ObjectModelWithArgAndArgsPropertiesTest { - static final SchemaConfiguration configuration = new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().format().build()); -} diff --git a/samples/client/petstore/kotlin/src/test/kotlin/org/openapijsonschematools/client/components/schemas/ObjectModelWithRefPropsTest.kt b/samples/client/petstore/kotlin/src/test/kotlin/org/openapijsonschematools/client/components/schemas/ObjectModelWithRefPropsTest.kt deleted file mode 100644 index b6423a6441e..00000000000 --- a/samples/client/petstore/kotlin/src/test/kotlin/org/openapijsonschematools/client/components/schemas/ObjectModelWithRefPropsTest.kt +++ /dev/null @@ -1,18 +0,0 @@ -package org.openapijsonschematools.client.components.schemas; - -import org.junit.Assert; -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.MapUtils; -import org.checkerframework.checker.nullness.qual.Nullable; - -import java.util.Arrays; -import java.util.List; -import java.util.Map; -import java.util.AbstractMap; - -public class ObjectModelWithRefPropsTest { - static final SchemaConfiguration configuration = new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().format().build()); -} diff --git a/samples/client/petstore/kotlin/src/test/kotlin/org/openapijsonschematools/client/components/schemas/ObjectWithAllOfWithReqTestPropFromUnsetAddPropTest.kt b/samples/client/petstore/kotlin/src/test/kotlin/org/openapijsonschematools/client/components/schemas/ObjectWithAllOfWithReqTestPropFromUnsetAddPropTest.kt deleted file mode 100644 index 846af3fd6b0..00000000000 --- a/samples/client/petstore/kotlin/src/test/kotlin/org/openapijsonschematools/client/components/schemas/ObjectWithAllOfWithReqTestPropFromUnsetAddPropTest.kt +++ /dev/null @@ -1,18 +0,0 @@ -package org.openapijsonschematools.client.components.schemas; - -import org.junit.Assert; -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.MapUtils; -import org.checkerframework.checker.nullness.qual.Nullable; - -import java.util.Arrays; -import java.util.List; -import java.util.Map; -import java.util.AbstractMap; - -public class ObjectWithAllOfWithReqTestPropFromUnsetAddPropTest { - static final SchemaConfiguration configuration = new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().format().build()); -} diff --git a/samples/client/petstore/kotlin/src/test/kotlin/org/openapijsonschematools/client/components/schemas/ObjectWithCollidingPropertiesTest.kt b/samples/client/petstore/kotlin/src/test/kotlin/org/openapijsonschematools/client/components/schemas/ObjectWithCollidingPropertiesTest.kt deleted file mode 100644 index 2ae79b4633e..00000000000 --- a/samples/client/petstore/kotlin/src/test/kotlin/org/openapijsonschematools/client/components/schemas/ObjectWithCollidingPropertiesTest.kt +++ /dev/null @@ -1,18 +0,0 @@ -package org.openapijsonschematools.client.components.schemas; - -import org.junit.Assert; -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.MapUtils; -import org.checkerframework.checker.nullness.qual.Nullable; - -import java.util.Arrays; -import java.util.List; -import java.util.Map; -import java.util.AbstractMap; - -public class ObjectWithCollidingPropertiesTest { - static final SchemaConfiguration configuration = new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().format().build()); -} diff --git a/samples/client/petstore/kotlin/src/test/kotlin/org/openapijsonschematools/client/components/schemas/ObjectWithDecimalPropertiesTest.kt b/samples/client/petstore/kotlin/src/test/kotlin/org/openapijsonschematools/client/components/schemas/ObjectWithDecimalPropertiesTest.kt deleted file mode 100644 index f024635f998..00000000000 --- a/samples/client/petstore/kotlin/src/test/kotlin/org/openapijsonschematools/client/components/schemas/ObjectWithDecimalPropertiesTest.kt +++ /dev/null @@ -1,18 +0,0 @@ -package org.openapijsonschematools.client.components.schemas; - -import org.junit.Assert; -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.MapUtils; -import org.checkerframework.checker.nullness.qual.Nullable; - -import java.util.Arrays; -import java.util.List; -import java.util.Map; -import java.util.AbstractMap; - -public class ObjectWithDecimalPropertiesTest { - static final SchemaConfiguration configuration = new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().format().build()); -} diff --git a/samples/client/petstore/kotlin/src/test/kotlin/org/openapijsonschematools/client/components/schemas/ObjectWithDifficultlyNamedPropsTest.kt b/samples/client/petstore/kotlin/src/test/kotlin/org/openapijsonschematools/client/components/schemas/ObjectWithDifficultlyNamedPropsTest.kt deleted file mode 100644 index 3411862b9f3..00000000000 --- a/samples/client/petstore/kotlin/src/test/kotlin/org/openapijsonschematools/client/components/schemas/ObjectWithDifficultlyNamedPropsTest.kt +++ /dev/null @@ -1,18 +0,0 @@ -package org.openapijsonschematools.client.components.schemas; - -import org.junit.Assert; -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.MapUtils; -import org.checkerframework.checker.nullness.qual.Nullable; - -import java.util.Arrays; -import java.util.List; -import java.util.Map; -import java.util.AbstractMap; - -public class ObjectWithDifficultlyNamedPropsTest { - static final SchemaConfiguration configuration = new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().format().build()); -} diff --git a/samples/client/petstore/kotlin/src/test/kotlin/org/openapijsonschematools/client/components/schemas/ObjectWithInlineCompositionPropertyTest.kt b/samples/client/petstore/kotlin/src/test/kotlin/org/openapijsonschematools/client/components/schemas/ObjectWithInlineCompositionPropertyTest.kt deleted file mode 100644 index 9218c238074..00000000000 --- a/samples/client/petstore/kotlin/src/test/kotlin/org/openapijsonschematools/client/components/schemas/ObjectWithInlineCompositionPropertyTest.kt +++ /dev/null @@ -1,18 +0,0 @@ -package org.openapijsonschematools.client.components.schemas; - -import org.junit.Assert; -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.MapUtils; -import org.checkerframework.checker.nullness.qual.Nullable; - -import java.util.Arrays; -import java.util.List; -import java.util.Map; -import java.util.AbstractMap; - -public class ObjectWithInlineCompositionPropertyTest { - static final SchemaConfiguration configuration = new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().format().build()); -} diff --git a/samples/client/petstore/kotlin/src/test/kotlin/org/openapijsonschematools/client/components/schemas/ObjectWithInvalidNamedRefedPropertiesTest.kt b/samples/client/petstore/kotlin/src/test/kotlin/org/openapijsonschematools/client/components/schemas/ObjectWithInvalidNamedRefedPropertiesTest.kt deleted file mode 100644 index 57023085317..00000000000 --- a/samples/client/petstore/kotlin/src/test/kotlin/org/openapijsonschematools/client/components/schemas/ObjectWithInvalidNamedRefedPropertiesTest.kt +++ /dev/null @@ -1,18 +0,0 @@ -package org.openapijsonschematools.client.components.schemas; - -import org.junit.Assert; -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.MapUtils; -import org.checkerframework.checker.nullness.qual.Nullable; - -import java.util.Arrays; -import java.util.List; -import java.util.Map; -import java.util.AbstractMap; - -public class ObjectWithInvalidNamedRefedPropertiesTest { - static final SchemaConfiguration configuration = new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().format().build()); -} diff --git a/samples/client/petstore/kotlin/src/test/kotlin/org/openapijsonschematools/client/components/schemas/ObjectWithNonIntersectingValuesTest.kt b/samples/client/petstore/kotlin/src/test/kotlin/org/openapijsonschematools/client/components/schemas/ObjectWithNonIntersectingValuesTest.kt deleted file mode 100644 index 0ec9e09a45a..00000000000 --- a/samples/client/petstore/kotlin/src/test/kotlin/org/openapijsonschematools/client/components/schemas/ObjectWithNonIntersectingValuesTest.kt +++ /dev/null @@ -1,18 +0,0 @@ -package org.openapijsonschematools.client.components.schemas; - -import org.junit.Assert; -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.MapUtils; -import org.checkerframework.checker.nullness.qual.Nullable; - -import java.util.Arrays; -import java.util.List; -import java.util.Map; -import java.util.AbstractMap; - -public class ObjectWithNonIntersectingValuesTest { - static final SchemaConfiguration configuration = new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().format().build()); -} diff --git a/samples/client/petstore/kotlin/src/test/kotlin/org/openapijsonschematools/client/components/schemas/ObjectWithOnlyOptionalPropsTest.kt b/samples/client/petstore/kotlin/src/test/kotlin/org/openapijsonschematools/client/components/schemas/ObjectWithOnlyOptionalPropsTest.kt deleted file mode 100644 index 16859d34c5d..00000000000 --- a/samples/client/petstore/kotlin/src/test/kotlin/org/openapijsonschematools/client/components/schemas/ObjectWithOnlyOptionalPropsTest.kt +++ /dev/null @@ -1,18 +0,0 @@ -package org.openapijsonschematools.client.components.schemas; - -import org.junit.Assert; -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.MapUtils; -import org.checkerframework.checker.nullness.qual.Nullable; - -import java.util.Arrays; -import java.util.List; -import java.util.Map; -import java.util.AbstractMap; - -public class ObjectWithOnlyOptionalPropsTest { - static final SchemaConfiguration configuration = new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().format().build()); -} diff --git a/samples/client/petstore/kotlin/src/test/kotlin/org/openapijsonschematools/client/components/schemas/ObjectWithOptionalTestPropTest.kt b/samples/client/petstore/kotlin/src/test/kotlin/org/openapijsonschematools/client/components/schemas/ObjectWithOptionalTestPropTest.kt deleted file mode 100644 index fbfbd396a61..00000000000 --- a/samples/client/petstore/kotlin/src/test/kotlin/org/openapijsonschematools/client/components/schemas/ObjectWithOptionalTestPropTest.kt +++ /dev/null @@ -1,18 +0,0 @@ -package org.openapijsonschematools.client.components.schemas; - -import org.junit.Assert; -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.MapUtils; -import org.checkerframework.checker.nullness.qual.Nullable; - -import java.util.Arrays; -import java.util.List; -import java.util.Map; -import java.util.AbstractMap; - -public class ObjectWithOptionalTestPropTest { - static final SchemaConfiguration configuration = new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().format().build()); -} diff --git a/samples/client/petstore/kotlin/src/test/kotlin/org/openapijsonschematools/client/components/schemas/ObjectWithValidationsTest.kt b/samples/client/petstore/kotlin/src/test/kotlin/org/openapijsonschematools/client/components/schemas/ObjectWithValidationsTest.kt deleted file mode 100644 index 9d02a043155..00000000000 --- a/samples/client/petstore/kotlin/src/test/kotlin/org/openapijsonschematools/client/components/schemas/ObjectWithValidationsTest.kt +++ /dev/null @@ -1,18 +0,0 @@ -package org.openapijsonschematools.client.components.schemas; - -import org.junit.Assert; -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.MapUtils; -import org.checkerframework.checker.nullness.qual.Nullable; - -import java.util.Arrays; -import java.util.List; -import java.util.Map; -import java.util.AbstractMap; - -public class ObjectWithValidationsTest { - static final SchemaConfiguration configuration = new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().format().build()); -} diff --git a/samples/client/petstore/kotlin/src/test/kotlin/org/openapijsonschematools/client/components/schemas/OrderTest.kt b/samples/client/petstore/kotlin/src/test/kotlin/org/openapijsonschematools/client/components/schemas/OrderTest.kt deleted file mode 100644 index 6f89d9bbcbe..00000000000 --- a/samples/client/petstore/kotlin/src/test/kotlin/org/openapijsonschematools/client/components/schemas/OrderTest.kt +++ /dev/null @@ -1,18 +0,0 @@ -package org.openapijsonschematools.client.components.schemas; - -import org.junit.Assert; -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.MapUtils; -import org.checkerframework.checker.nullness.qual.Nullable; - -import java.util.Arrays; -import java.util.List; -import java.util.Map; -import java.util.AbstractMap; - -public class OrderTest { - static final SchemaConfiguration configuration = new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().format().build()); -} diff --git a/samples/client/petstore/kotlin/src/test/kotlin/org/openapijsonschematools/client/components/schemas/PaginatedResultMyObjectDtoTest.kt b/samples/client/petstore/kotlin/src/test/kotlin/org/openapijsonschematools/client/components/schemas/PaginatedResultMyObjectDtoTest.kt deleted file mode 100644 index d786673816b..00000000000 --- a/samples/client/petstore/kotlin/src/test/kotlin/org/openapijsonschematools/client/components/schemas/PaginatedResultMyObjectDtoTest.kt +++ /dev/null @@ -1,18 +0,0 @@ -package org.openapijsonschematools.client.components.schemas; - -import org.junit.Assert; -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.MapUtils; -import org.checkerframework.checker.nullness.qual.Nullable; - -import java.util.Arrays; -import java.util.List; -import java.util.Map; -import java.util.AbstractMap; - -public class PaginatedResultMyObjectDtoTest { - static final SchemaConfiguration configuration = new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().format().build()); -} diff --git a/samples/client/petstore/kotlin/src/test/kotlin/org/openapijsonschematools/client/components/schemas/ParentPetTest.kt b/samples/client/petstore/kotlin/src/test/kotlin/org/openapijsonschematools/client/components/schemas/ParentPetTest.kt deleted file mode 100644 index 8850228ea48..00000000000 --- a/samples/client/petstore/kotlin/src/test/kotlin/org/openapijsonschematools/client/components/schemas/ParentPetTest.kt +++ /dev/null @@ -1,18 +0,0 @@ -package org.openapijsonschematools.client.components.schemas; - -import org.junit.Assert; -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.MapUtils; -import org.checkerframework.checker.nullness.qual.Nullable; - -import java.util.Arrays; -import java.util.List; -import java.util.Map; -import java.util.AbstractMap; - -public class ParentPetTest { - static final SchemaConfiguration configuration = new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().format().build()); -} diff --git a/samples/client/petstore/kotlin/src/test/kotlin/org/openapijsonschematools/client/components/schemas/PetTest.kt b/samples/client/petstore/kotlin/src/test/kotlin/org/openapijsonschematools/client/components/schemas/PetTest.kt deleted file mode 100644 index c9188d89ccb..00000000000 --- a/samples/client/petstore/kotlin/src/test/kotlin/org/openapijsonschematools/client/components/schemas/PetTest.kt +++ /dev/null @@ -1,18 +0,0 @@ -package org.openapijsonschematools.client.components.schemas; - -import org.junit.Assert; -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.MapUtils; -import org.checkerframework.checker.nullness.qual.Nullable; - -import java.util.Arrays; -import java.util.List; -import java.util.Map; -import java.util.AbstractMap; - -public class PetTest { - static final SchemaConfiguration configuration = new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().format().build()); -} diff --git a/samples/client/petstore/kotlin/src/test/kotlin/org/openapijsonschematools/client/components/schemas/PigTest.kt b/samples/client/petstore/kotlin/src/test/kotlin/org/openapijsonschematools/client/components/schemas/PigTest.kt deleted file mode 100644 index 15fa50b9931..00000000000 --- a/samples/client/petstore/kotlin/src/test/kotlin/org/openapijsonschematools/client/components/schemas/PigTest.kt +++ /dev/null @@ -1,18 +0,0 @@ -package org.openapijsonschematools.client.components.schemas; - -import org.junit.Assert; -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.MapUtils; -import org.checkerframework.checker.nullness.qual.Nullable; - -import java.util.Arrays; -import java.util.List; -import java.util.Map; -import java.util.AbstractMap; - -public class PigTest { - static final SchemaConfiguration configuration = new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().format().build()); -} diff --git a/samples/client/petstore/kotlin/src/test/kotlin/org/openapijsonschematools/client/components/schemas/PlayerTest.kt b/samples/client/petstore/kotlin/src/test/kotlin/org/openapijsonschematools/client/components/schemas/PlayerTest.kt deleted file mode 100644 index f3a60c5761d..00000000000 --- a/samples/client/petstore/kotlin/src/test/kotlin/org/openapijsonschematools/client/components/schemas/PlayerTest.kt +++ /dev/null @@ -1,18 +0,0 @@ -package org.openapijsonschematools.client.components.schemas; - -import org.junit.Assert; -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.MapUtils; -import org.checkerframework.checker.nullness.qual.Nullable; - -import java.util.Arrays; -import java.util.List; -import java.util.Map; -import java.util.AbstractMap; - -public class PlayerTest { - static final SchemaConfiguration configuration = new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().format().build()); -} diff --git a/samples/client/petstore/kotlin/src/test/kotlin/org/openapijsonschematools/client/components/schemas/PublicKeyTest.kt b/samples/client/petstore/kotlin/src/test/kotlin/org/openapijsonschematools/client/components/schemas/PublicKeyTest.kt deleted file mode 100644 index 01422255c9e..00000000000 --- a/samples/client/petstore/kotlin/src/test/kotlin/org/openapijsonschematools/client/components/schemas/PublicKeyTest.kt +++ /dev/null @@ -1,18 +0,0 @@ -package org.openapijsonschematools.client.components.schemas; - -import org.junit.Assert; -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.MapUtils; -import org.checkerframework.checker.nullness.qual.Nullable; - -import java.util.Arrays; -import java.util.List; -import java.util.Map; -import java.util.AbstractMap; - -public class PublicKeyTest { - static final SchemaConfiguration configuration = new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().format().build()); -} diff --git a/samples/client/petstore/kotlin/src/test/kotlin/org/openapijsonschematools/client/components/schemas/QuadrilateralInterfaceTest.kt b/samples/client/petstore/kotlin/src/test/kotlin/org/openapijsonschematools/client/components/schemas/QuadrilateralInterfaceTest.kt deleted file mode 100644 index 457533d9723..00000000000 --- a/samples/client/petstore/kotlin/src/test/kotlin/org/openapijsonschematools/client/components/schemas/QuadrilateralInterfaceTest.kt +++ /dev/null @@ -1,18 +0,0 @@ -package org.openapijsonschematools.client.components.schemas; - -import org.junit.Assert; -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.MapUtils; -import org.checkerframework.checker.nullness.qual.Nullable; - -import java.util.Arrays; -import java.util.List; -import java.util.Map; -import java.util.AbstractMap; - -public class QuadrilateralInterfaceTest { - static final SchemaConfiguration configuration = new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().format().build()); -} diff --git a/samples/client/petstore/kotlin/src/test/kotlin/org/openapijsonschematools/client/components/schemas/QuadrilateralTest.kt b/samples/client/petstore/kotlin/src/test/kotlin/org/openapijsonschematools/client/components/schemas/QuadrilateralTest.kt deleted file mode 100644 index 930bf3ff189..00000000000 --- a/samples/client/petstore/kotlin/src/test/kotlin/org/openapijsonschematools/client/components/schemas/QuadrilateralTest.kt +++ /dev/null @@ -1,18 +0,0 @@ -package org.openapijsonschematools.client.components.schemas; - -import org.junit.Assert; -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.MapUtils; -import org.checkerframework.checker.nullness.qual.Nullable; - -import java.util.Arrays; -import java.util.List; -import java.util.Map; -import java.util.AbstractMap; - -public class QuadrilateralTest { - static final SchemaConfiguration configuration = new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().format().build()); -} diff --git a/samples/client/petstore/kotlin/src/test/kotlin/org/openapijsonschematools/client/components/schemas/ReadOnlyFirstTest.kt b/samples/client/petstore/kotlin/src/test/kotlin/org/openapijsonschematools/client/components/schemas/ReadOnlyFirstTest.kt deleted file mode 100644 index 51415cd0e25..00000000000 --- a/samples/client/petstore/kotlin/src/test/kotlin/org/openapijsonschematools/client/components/schemas/ReadOnlyFirstTest.kt +++ /dev/null @@ -1,18 +0,0 @@ -package org.openapijsonschematools.client.components.schemas; - -import org.junit.Assert; -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.MapUtils; -import org.checkerframework.checker.nullness.qual.Nullable; - -import java.util.Arrays; -import java.util.List; -import java.util.Map; -import java.util.AbstractMap; - -public class ReadOnlyFirstTest { - static final SchemaConfiguration configuration = new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().format().build()); -} diff --git a/samples/client/petstore/kotlin/src/test/kotlin/org/openapijsonschematools/client/components/schemas/RefPetTest.kt b/samples/client/petstore/kotlin/src/test/kotlin/org/openapijsonschematools/client/components/schemas/RefPetTest.kt deleted file mode 100644 index e745fbfe372..00000000000 --- a/samples/client/petstore/kotlin/src/test/kotlin/org/openapijsonschematools/client/components/schemas/RefPetTest.kt +++ /dev/null @@ -1,18 +0,0 @@ -package org.openapijsonschematools.client.components.schemas; - -import org.junit.Assert; -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.MapUtils; -import org.checkerframework.checker.nullness.qual.Nullable; - -import java.util.Arrays; -import java.util.List; -import java.util.Map; -import java.util.AbstractMap; - -public class RefPetTest { - static final SchemaConfiguration configuration = new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().format().build()); -} diff --git a/samples/client/petstore/kotlin/src/test/kotlin/org/openapijsonschematools/client/components/schemas/ReqPropsFromExplicitAddPropsTest.kt b/samples/client/petstore/kotlin/src/test/kotlin/org/openapijsonschematools/client/components/schemas/ReqPropsFromExplicitAddPropsTest.kt deleted file mode 100644 index 29805a43b33..00000000000 --- a/samples/client/petstore/kotlin/src/test/kotlin/org/openapijsonschematools/client/components/schemas/ReqPropsFromExplicitAddPropsTest.kt +++ /dev/null @@ -1,18 +0,0 @@ -package org.openapijsonschematools.client.components.schemas; - -import org.junit.Assert; -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.MapUtils; -import org.checkerframework.checker.nullness.qual.Nullable; - -import java.util.Arrays; -import java.util.List; -import java.util.Map; -import java.util.AbstractMap; - -public class ReqPropsFromExplicitAddPropsTest { - static final SchemaConfiguration configuration = new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().format().build()); -} diff --git a/samples/client/petstore/kotlin/src/test/kotlin/org/openapijsonschematools/client/components/schemas/ReqPropsFromTrueAddPropsTest.kt b/samples/client/petstore/kotlin/src/test/kotlin/org/openapijsonschematools/client/components/schemas/ReqPropsFromTrueAddPropsTest.kt deleted file mode 100644 index abcf4962d81..00000000000 --- a/samples/client/petstore/kotlin/src/test/kotlin/org/openapijsonschematools/client/components/schemas/ReqPropsFromTrueAddPropsTest.kt +++ /dev/null @@ -1,18 +0,0 @@ -package org.openapijsonschematools.client.components.schemas; - -import org.junit.Assert; -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.MapUtils; -import org.checkerframework.checker.nullness.qual.Nullable; - -import java.util.Arrays; -import java.util.List; -import java.util.Map; -import java.util.AbstractMap; - -public class ReqPropsFromTrueAddPropsTest { - static final SchemaConfiguration configuration = new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().format().build()); -} diff --git a/samples/client/petstore/kotlin/src/test/kotlin/org/openapijsonschematools/client/components/schemas/ReqPropsFromUnsetAddPropsTest.kt b/samples/client/petstore/kotlin/src/test/kotlin/org/openapijsonschematools/client/components/schemas/ReqPropsFromUnsetAddPropsTest.kt deleted file mode 100644 index a777a2ee5ca..00000000000 --- a/samples/client/petstore/kotlin/src/test/kotlin/org/openapijsonschematools/client/components/schemas/ReqPropsFromUnsetAddPropsTest.kt +++ /dev/null @@ -1,18 +0,0 @@ -package org.openapijsonschematools.client.components.schemas; - -import org.junit.Assert; -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.MapUtils; -import org.checkerframework.checker.nullness.qual.Nullable; - -import java.util.Arrays; -import java.util.List; -import java.util.Map; -import java.util.AbstractMap; - -public class ReqPropsFromUnsetAddPropsTest { - static final SchemaConfiguration configuration = new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().format().build()); -} diff --git a/samples/client/petstore/kotlin/src/test/kotlin/org/openapijsonschematools/client/components/schemas/ReturnSchemaTest.kt b/samples/client/petstore/kotlin/src/test/kotlin/org/openapijsonschematools/client/components/schemas/ReturnSchemaTest.kt deleted file mode 100644 index 12a41f23c6d..00000000000 --- a/samples/client/petstore/kotlin/src/test/kotlin/org/openapijsonschematools/client/components/schemas/ReturnSchemaTest.kt +++ /dev/null @@ -1,18 +0,0 @@ -package org.openapijsonschematools.client.components.schemas; - -import org.junit.Assert; -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.MapUtils; -import org.checkerframework.checker.nullness.qual.Nullable; - -import java.util.Arrays; -import java.util.List; -import java.util.Map; -import java.util.AbstractMap; - -public class ReturnSchemaTest { - static final SchemaConfiguration configuration = new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().format().build()); -} diff --git a/samples/client/petstore/kotlin/src/test/kotlin/org/openapijsonschematools/client/components/schemas/ScaleneTriangleTest.kt b/samples/client/petstore/kotlin/src/test/kotlin/org/openapijsonschematools/client/components/schemas/ScaleneTriangleTest.kt deleted file mode 100644 index d60ac9bd407..00000000000 --- a/samples/client/petstore/kotlin/src/test/kotlin/org/openapijsonschematools/client/components/schemas/ScaleneTriangleTest.kt +++ /dev/null @@ -1,18 +0,0 @@ -package org.openapijsonschematools.client.components.schemas; - -import org.junit.Assert; -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.MapUtils; -import org.checkerframework.checker.nullness.qual.Nullable; - -import java.util.Arrays; -import java.util.List; -import java.util.Map; -import java.util.AbstractMap; - -public class ScaleneTriangleTest { - static final SchemaConfiguration configuration = new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().format().build()); -} diff --git a/samples/client/petstore/kotlin/src/test/kotlin/org/openapijsonschematools/client/components/schemas/Schema200ResponseTest.kt b/samples/client/petstore/kotlin/src/test/kotlin/org/openapijsonschematools/client/components/schemas/Schema200ResponseTest.kt deleted file mode 100644 index 4833132cc77..00000000000 --- a/samples/client/petstore/kotlin/src/test/kotlin/org/openapijsonschematools/client/components/schemas/Schema200ResponseTest.kt +++ /dev/null @@ -1,18 +0,0 @@ -package org.openapijsonschematools.client.components.schemas; - -import org.junit.Assert; -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.MapUtils; -import org.checkerframework.checker.nullness.qual.Nullable; - -import java.util.Arrays; -import java.util.List; -import java.util.Map; -import java.util.AbstractMap; - -public class Schema200ResponseTest { - static final SchemaConfiguration configuration = new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().format().build()); -} diff --git a/samples/client/petstore/kotlin/src/test/kotlin/org/openapijsonschematools/client/components/schemas/SelfReferencingArrayModelTest.kt b/samples/client/petstore/kotlin/src/test/kotlin/org/openapijsonschematools/client/components/schemas/SelfReferencingArrayModelTest.kt deleted file mode 100644 index 8aa9425537e..00000000000 --- a/samples/client/petstore/kotlin/src/test/kotlin/org/openapijsonschematools/client/components/schemas/SelfReferencingArrayModelTest.kt +++ /dev/null @@ -1,18 +0,0 @@ -package org.openapijsonschematools.client.components.schemas; - -import org.junit.Assert; -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.MapUtils; -import org.checkerframework.checker.nullness.qual.Nullable; - -import java.util.Arrays; -import java.util.List; -import java.util.Map; -import java.util.AbstractMap; - -public class SelfReferencingArrayModelTest { - static final SchemaConfiguration configuration = new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().format().build()); -} diff --git a/samples/client/petstore/kotlin/src/test/kotlin/org/openapijsonschematools/client/components/schemas/SelfReferencingObjectModelTest.kt b/samples/client/petstore/kotlin/src/test/kotlin/org/openapijsonschematools/client/components/schemas/SelfReferencingObjectModelTest.kt deleted file mode 100644 index 9c615b0f705..00000000000 --- a/samples/client/petstore/kotlin/src/test/kotlin/org/openapijsonschematools/client/components/schemas/SelfReferencingObjectModelTest.kt +++ /dev/null @@ -1,18 +0,0 @@ -package org.openapijsonschematools.client.components.schemas; - -import org.junit.Assert; -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.MapUtils; -import org.checkerframework.checker.nullness.qual.Nullable; - -import java.util.Arrays; -import java.util.List; -import java.util.Map; -import java.util.AbstractMap; - -public class SelfReferencingObjectModelTest { - static final SchemaConfiguration configuration = new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().format().build()); -} diff --git a/samples/client/petstore/kotlin/src/test/kotlin/org/openapijsonschematools/client/components/schemas/ShapeOrNullTest.kt b/samples/client/petstore/kotlin/src/test/kotlin/org/openapijsonschematools/client/components/schemas/ShapeOrNullTest.kt deleted file mode 100644 index 1dd467f87d4..00000000000 --- a/samples/client/petstore/kotlin/src/test/kotlin/org/openapijsonschematools/client/components/schemas/ShapeOrNullTest.kt +++ /dev/null @@ -1,18 +0,0 @@ -package org.openapijsonschematools.client.components.schemas; - -import org.junit.Assert; -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.MapUtils; -import org.checkerframework.checker.nullness.qual.Nullable; - -import java.util.Arrays; -import java.util.List; -import java.util.Map; -import java.util.AbstractMap; - -public class ShapeOrNullTest { - static final SchemaConfiguration configuration = new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().format().build()); -} diff --git a/samples/client/petstore/kotlin/src/test/kotlin/org/openapijsonschematools/client/components/schemas/ShapeTest.kt b/samples/client/petstore/kotlin/src/test/kotlin/org/openapijsonschematools/client/components/schemas/ShapeTest.kt deleted file mode 100644 index 820879988cf..00000000000 --- a/samples/client/petstore/kotlin/src/test/kotlin/org/openapijsonschematools/client/components/schemas/ShapeTest.kt +++ /dev/null @@ -1,18 +0,0 @@ -package org.openapijsonschematools.client.components.schemas; - -import org.junit.Assert; -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.MapUtils; -import org.checkerframework.checker.nullness.qual.Nullable; - -import java.util.Arrays; -import java.util.List; -import java.util.Map; -import java.util.AbstractMap; - -public class ShapeTest { - static final SchemaConfiguration configuration = new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().format().build()); -} diff --git a/samples/client/petstore/kotlin/src/test/kotlin/org/openapijsonschematools/client/components/schemas/SimpleQuadrilateralTest.kt b/samples/client/petstore/kotlin/src/test/kotlin/org/openapijsonschematools/client/components/schemas/SimpleQuadrilateralTest.kt deleted file mode 100644 index 4d2222c704a..00000000000 --- a/samples/client/petstore/kotlin/src/test/kotlin/org/openapijsonschematools/client/components/schemas/SimpleQuadrilateralTest.kt +++ /dev/null @@ -1,18 +0,0 @@ -package org.openapijsonschematools.client.components.schemas; - -import org.junit.Assert; -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.MapUtils; -import org.checkerframework.checker.nullness.qual.Nullable; - -import java.util.Arrays; -import java.util.List; -import java.util.Map; -import java.util.AbstractMap; - -public class SimpleQuadrilateralTest { - static final SchemaConfiguration configuration = new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().format().build()); -} diff --git a/samples/client/petstore/kotlin/src/test/kotlin/org/openapijsonschematools/client/components/schemas/SomeObjectTest.kt b/samples/client/petstore/kotlin/src/test/kotlin/org/openapijsonschematools/client/components/schemas/SomeObjectTest.kt deleted file mode 100644 index a57621c0667..00000000000 --- a/samples/client/petstore/kotlin/src/test/kotlin/org/openapijsonschematools/client/components/schemas/SomeObjectTest.kt +++ /dev/null @@ -1,18 +0,0 @@ -package org.openapijsonschematools.client.components.schemas; - -import org.junit.Assert; -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.MapUtils; -import org.checkerframework.checker.nullness.qual.Nullable; - -import java.util.Arrays; -import java.util.List; -import java.util.Map; -import java.util.AbstractMap; - -public class SomeObjectTest { - static final SchemaConfiguration configuration = new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().format().build()); -} diff --git a/samples/client/petstore/kotlin/src/test/kotlin/org/openapijsonschematools/client/components/schemas/SpecialModelnameTest.kt b/samples/client/petstore/kotlin/src/test/kotlin/org/openapijsonschematools/client/components/schemas/SpecialModelnameTest.kt deleted file mode 100644 index 7434c9f5316..00000000000 --- a/samples/client/petstore/kotlin/src/test/kotlin/org/openapijsonschematools/client/components/schemas/SpecialModelnameTest.kt +++ /dev/null @@ -1,18 +0,0 @@ -package org.openapijsonschematools.client.components.schemas; - -import org.junit.Assert; -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.MapUtils; -import org.checkerframework.checker.nullness.qual.Nullable; - -import java.util.Arrays; -import java.util.List; -import java.util.Map; -import java.util.AbstractMap; - -public class SpecialModelnameTest { - static final SchemaConfiguration configuration = new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().format().build()); -} diff --git a/samples/client/petstore/kotlin/src/test/kotlin/org/openapijsonschematools/client/components/schemas/StringBooleanMapTest.kt b/samples/client/petstore/kotlin/src/test/kotlin/org/openapijsonschematools/client/components/schemas/StringBooleanMapTest.kt deleted file mode 100644 index c75df4cbc46..00000000000 --- a/samples/client/petstore/kotlin/src/test/kotlin/org/openapijsonschematools/client/components/schemas/StringBooleanMapTest.kt +++ /dev/null @@ -1,18 +0,0 @@ -package org.openapijsonschematools.client.components.schemas; - -import org.junit.Assert; -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.MapUtils; -import org.checkerframework.checker.nullness.qual.Nullable; - -import java.util.Arrays; -import java.util.List; -import java.util.Map; -import java.util.AbstractMap; - -public class StringBooleanMapTest { - static final SchemaConfiguration configuration = new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().format().build()); -} diff --git a/samples/client/petstore/kotlin/src/test/kotlin/org/openapijsonschematools/client/components/schemas/StringEnumTest.kt b/samples/client/petstore/kotlin/src/test/kotlin/org/openapijsonschematools/client/components/schemas/StringEnumTest.kt deleted file mode 100644 index c569016b2fb..00000000000 --- a/samples/client/petstore/kotlin/src/test/kotlin/org/openapijsonschematools/client/components/schemas/StringEnumTest.kt +++ /dev/null @@ -1,18 +0,0 @@ -package org.openapijsonschematools.client.components.schemas; - -import org.junit.Assert; -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.MapUtils; -import org.checkerframework.checker.nullness.qual.Nullable; - -import java.util.Arrays; -import java.util.List; -import java.util.Map; -import java.util.AbstractMap; - -public class StringEnumTest { - static final SchemaConfiguration configuration = new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().format().build()); -} diff --git a/samples/client/petstore/kotlin/src/test/kotlin/org/openapijsonschematools/client/components/schemas/StringEnumWithDefaultValueTest.kt b/samples/client/petstore/kotlin/src/test/kotlin/org/openapijsonschematools/client/components/schemas/StringEnumWithDefaultValueTest.kt deleted file mode 100644 index 27b9cfa0b45..00000000000 --- a/samples/client/petstore/kotlin/src/test/kotlin/org/openapijsonschematools/client/components/schemas/StringEnumWithDefaultValueTest.kt +++ /dev/null @@ -1,18 +0,0 @@ -package org.openapijsonschematools.client.components.schemas; - -import org.junit.Assert; -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.MapUtils; -import org.checkerframework.checker.nullness.qual.Nullable; - -import java.util.Arrays; -import java.util.List; -import java.util.Map; -import java.util.AbstractMap; - -public class StringEnumWithDefaultValueTest { - static final SchemaConfiguration configuration = new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().format().build()); -} diff --git a/samples/client/petstore/kotlin/src/test/kotlin/org/openapijsonschematools/client/components/schemas/StringSchemaTest.kt b/samples/client/petstore/kotlin/src/test/kotlin/org/openapijsonschematools/client/components/schemas/StringSchemaTest.kt deleted file mode 100644 index b8ec5d22b05..00000000000 --- a/samples/client/petstore/kotlin/src/test/kotlin/org/openapijsonschematools/client/components/schemas/StringSchemaTest.kt +++ /dev/null @@ -1,18 +0,0 @@ -package org.openapijsonschematools.client.components.schemas; - -import org.junit.Assert; -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.MapUtils; -import org.checkerframework.checker.nullness.qual.Nullable; - -import java.util.Arrays; -import java.util.List; -import java.util.Map; -import java.util.AbstractMap; - -public class StringSchemaTest { - static final SchemaConfiguration configuration = new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().format().build()); -} diff --git a/samples/client/petstore/kotlin/src/test/kotlin/org/openapijsonschematools/client/components/schemas/StringWithValidationTest.kt b/samples/client/petstore/kotlin/src/test/kotlin/org/openapijsonschematools/client/components/schemas/StringWithValidationTest.kt deleted file mode 100644 index a870e7edd7d..00000000000 --- a/samples/client/petstore/kotlin/src/test/kotlin/org/openapijsonschematools/client/components/schemas/StringWithValidationTest.kt +++ /dev/null @@ -1,18 +0,0 @@ -package org.openapijsonschematools.client.components.schemas; - -import org.junit.Assert; -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.MapUtils; -import org.checkerframework.checker.nullness.qual.Nullable; - -import java.util.Arrays; -import java.util.List; -import java.util.Map; -import java.util.AbstractMap; - -public class StringWithValidationTest { - static final SchemaConfiguration configuration = new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().format().build()); -} diff --git a/samples/client/petstore/kotlin/src/test/kotlin/org/openapijsonschematools/client/components/schemas/TagTest.kt b/samples/client/petstore/kotlin/src/test/kotlin/org/openapijsonschematools/client/components/schemas/TagTest.kt deleted file mode 100644 index c2159d54437..00000000000 --- a/samples/client/petstore/kotlin/src/test/kotlin/org/openapijsonschematools/client/components/schemas/TagTest.kt +++ /dev/null @@ -1,18 +0,0 @@ -package org.openapijsonschematools.client.components.schemas; - -import org.junit.Assert; -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.MapUtils; -import org.checkerframework.checker.nullness.qual.Nullable; - -import java.util.Arrays; -import java.util.List; -import java.util.Map; -import java.util.AbstractMap; - -public class TagTest { - static final SchemaConfiguration configuration = new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().format().build()); -} diff --git a/samples/client/petstore/kotlin/src/test/kotlin/org/openapijsonschematools/client/components/schemas/TriangleInterfaceTest.kt b/samples/client/petstore/kotlin/src/test/kotlin/org/openapijsonschematools/client/components/schemas/TriangleInterfaceTest.kt deleted file mode 100644 index a0bfa6346c2..00000000000 --- a/samples/client/petstore/kotlin/src/test/kotlin/org/openapijsonschematools/client/components/schemas/TriangleInterfaceTest.kt +++ /dev/null @@ -1,18 +0,0 @@ -package org.openapijsonschematools.client.components.schemas; - -import org.junit.Assert; -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.MapUtils; -import org.checkerframework.checker.nullness.qual.Nullable; - -import java.util.Arrays; -import java.util.List; -import java.util.Map; -import java.util.AbstractMap; - -public class TriangleInterfaceTest { - static final SchemaConfiguration configuration = new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().format().build()); -} diff --git a/samples/client/petstore/kotlin/src/test/kotlin/org/openapijsonschematools/client/components/schemas/TriangleTest.kt b/samples/client/petstore/kotlin/src/test/kotlin/org/openapijsonschematools/client/components/schemas/TriangleTest.kt deleted file mode 100644 index 827ce35050f..00000000000 --- a/samples/client/petstore/kotlin/src/test/kotlin/org/openapijsonschematools/client/components/schemas/TriangleTest.kt +++ /dev/null @@ -1,18 +0,0 @@ -package org.openapijsonschematools.client.components.schemas; - -import org.junit.Assert; -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.MapUtils; -import org.checkerframework.checker.nullness.qual.Nullable; - -import java.util.Arrays; -import java.util.List; -import java.util.Map; -import java.util.AbstractMap; - -public class TriangleTest { - static final SchemaConfiguration configuration = new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().format().build()); -} diff --git a/samples/client/petstore/kotlin/src/test/kotlin/org/openapijsonschematools/client/components/schemas/UUIDStringTest.kt b/samples/client/petstore/kotlin/src/test/kotlin/org/openapijsonschematools/client/components/schemas/UUIDStringTest.kt deleted file mode 100644 index c86ba04ef40..00000000000 --- a/samples/client/petstore/kotlin/src/test/kotlin/org/openapijsonschematools/client/components/schemas/UUIDStringTest.kt +++ /dev/null @@ -1,18 +0,0 @@ -package org.openapijsonschematools.client.components.schemas; - -import org.junit.Assert; -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.MapUtils; -import org.checkerframework.checker.nullness.qual.Nullable; - -import java.util.Arrays; -import java.util.List; -import java.util.Map; -import java.util.AbstractMap; - -public class UUIDStringTest { - static final SchemaConfiguration configuration = new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().format().build()); -} diff --git a/samples/client/petstore/kotlin/src/test/kotlin/org/openapijsonschematools/client/components/schemas/UserTest.kt b/samples/client/petstore/kotlin/src/test/kotlin/org/openapijsonschematools/client/components/schemas/UserTest.kt deleted file mode 100644 index 940968976d5..00000000000 --- a/samples/client/petstore/kotlin/src/test/kotlin/org/openapijsonschematools/client/components/schemas/UserTest.kt +++ /dev/null @@ -1,18 +0,0 @@ -package org.openapijsonschematools.client.components.schemas; - -import org.junit.Assert; -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.MapUtils; -import org.checkerframework.checker.nullness.qual.Nullable; - -import java.util.Arrays; -import java.util.List; -import java.util.Map; -import java.util.AbstractMap; - -public class UserTest { - static final SchemaConfiguration configuration = new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().format().build()); -} diff --git a/samples/client/petstore/kotlin/src/test/kotlin/org/openapijsonschematools/client/components/schemas/WhaleTest.kt b/samples/client/petstore/kotlin/src/test/kotlin/org/openapijsonschematools/client/components/schemas/WhaleTest.kt deleted file mode 100644 index 234c293f88d..00000000000 --- a/samples/client/petstore/kotlin/src/test/kotlin/org/openapijsonschematools/client/components/schemas/WhaleTest.kt +++ /dev/null @@ -1,18 +0,0 @@ -package org.openapijsonschematools.client.components.schemas; - -import org.junit.Assert; -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.MapUtils; -import org.checkerframework.checker.nullness.qual.Nullable; - -import java.util.Arrays; -import java.util.List; -import java.util.Map; -import java.util.AbstractMap; - -public class WhaleTest { - static final SchemaConfiguration configuration = new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().format().build()); -} diff --git a/samples/client/petstore/kotlin/src/test/kotlin/org/openapijsonschematools/client/components/schemas/ZebraTest.kt b/samples/client/petstore/kotlin/src/test/kotlin/org/openapijsonschematools/client/components/schemas/ZebraTest.kt deleted file mode 100644 index e88737726e2..00000000000 --- a/samples/client/petstore/kotlin/src/test/kotlin/org/openapijsonschematools/client/components/schemas/ZebraTest.kt +++ /dev/null @@ -1,18 +0,0 @@ -package org.openapijsonschematools.client.components.schemas; - -import org.junit.Assert; -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.MapUtils; -import org.checkerframework.checker.nullness.qual.Nullable; - -import java.util.Arrays; -import java.util.List; -import java.util.Map; -import java.util.AbstractMap; - -public class ZebraTest { - static final SchemaConfiguration configuration = new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().format().build()); -} diff --git a/samples/client/petstore/kotlin/src/test/kotlin/org/openapijsonschematools/client/configurations/JsonSchemaKeywordFlagsTest.kt b/samples/client/petstore/kotlin/src/test/kotlin/org/openapijsonschematools/client/configurations/JsonSchemaKeywordFlagsTest.kt deleted file mode 100644 index a4d3da31623..00000000000 --- a/samples/client/petstore/kotlin/src/test/kotlin/org/openapijsonschematools/client/configurations/JsonSchemaKeywordFlagsTest.kt +++ /dev/null @@ -1,143 +0,0 @@ -package org.openapijsonschematools.client.configurations; - -import org.junit.Assert; -import org.junit.Test; -import java.util.LinkedHashSet; - -public final class JsonSchemaKeywordFlagsTest { - - @Test - public void testGetEnabledKeywords() { - final JsonSchemaKeywordFlags jsonSchemaKeywordFlags = new JsonSchemaKeywordFlags( - true, - true, - true, - true, - true, - true, - true, - true, - true, - true, - true, - true, - true, - true, - true, - true, - true, - true, - true, - true, - true, - true, - true, - true, - true, - true, - true, - true, - true, - true, - true, - true, - true, - true, - true, - true, - true, - true, - true - ); - LinkedHashSet enabledKeywords = jsonSchemaKeywordFlags.getKeywords(); - LinkedHashSet expectedEnabledKeywords = new LinkedHashSet<>(); - expectedEnabledKeywords.add("additionalProperties"); - expectedEnabledKeywords.add("allOf"); - expectedEnabledKeywords.add("anyOf"); - expectedEnabledKeywords.add("const"); - expectedEnabledKeywords.add("contains"); - expectedEnabledKeywords.add("dependentRequired"); - expectedEnabledKeywords.add("dependentSchemas"); - expectedEnabledKeywords.add("discriminator"); - expectedEnabledKeywords.add("else_"); - expectedEnabledKeywords.add("enum_"); - expectedEnabledKeywords.add("exclusiveMaximum"); - expectedEnabledKeywords.add("exclusiveMinimum"); - expectedEnabledKeywords.add("format"); - expectedEnabledKeywords.add("if_"); - expectedEnabledKeywords.add("maximum"); - expectedEnabledKeywords.add("minimum"); - expectedEnabledKeywords.add("items"); - expectedEnabledKeywords.add("maxContains"); - expectedEnabledKeywords.add("maxItems"); - expectedEnabledKeywords.add("maxLength"); - expectedEnabledKeywords.add("maxProperties"); - expectedEnabledKeywords.add("minContains"); - expectedEnabledKeywords.add("minItems"); - expectedEnabledKeywords.add("minLength"); - expectedEnabledKeywords.add("minProperties"); - expectedEnabledKeywords.add("multipleOf"); - expectedEnabledKeywords.add("not"); - expectedEnabledKeywords.add("oneOf"); - expectedEnabledKeywords.add("pattern"); - expectedEnabledKeywords.add("patternProperties"); - expectedEnabledKeywords.add("prefixItems"); - expectedEnabledKeywords.add("properties"); - expectedEnabledKeywords.add("propertyNames"); - expectedEnabledKeywords.add("required"); - expectedEnabledKeywords.add("then"); - expectedEnabledKeywords.add("type"); - expectedEnabledKeywords.add("uniqueItems"); - expectedEnabledKeywords.add("unevaluatedItems"); - expectedEnabledKeywords.add("unevaluatedProperties"); - Assert.assertEquals(enabledKeywords, expectedEnabledKeywords); - } - - @Test - public void testGetNoEnabledKeywords() { - final JsonSchemaKeywordFlags jsonSchemaKeywordFlags = new JsonSchemaKeywordFlags( - false, - false, - false, - false, - false, - false, - false, - false, - false, - false, - false, - false, - false, - false, - false, - false, - false, - false, - false, - false, - false, - false, - false, - false, - false, - false, - false, - false, - false, - false, - false, - false, - false, - false, - false, - false, - false, - false, - false - ); - LinkedHashSet enabledKeywords = jsonSchemaKeywordFlags.getKeywords(); - LinkedHashSet expectedEnabledKeywords = new LinkedHashSet<>(); - Assert.assertEquals(enabledKeywords, expectedEnabledKeywords); - } -} diff --git a/samples/client/petstore/kotlin/src/test/kotlin/org/openapijsonschematools/client/header/ContentHeaderTest.kt b/samples/client/petstore/kotlin/src/test/kotlin/org/openapijsonschematools/client/header/ContentHeaderTest.kt deleted file mode 100644 index abba1db4b46..00000000000 --- a/samples/client/petstore/kotlin/src/test/kotlin/org/openapijsonschematools/client/header/ContentHeaderTest.kt +++ /dev/null @@ -1,120 +0,0 @@ -package org.openapijsonschematools.client.header; - -import org.checkerframework.checker.nullness.qual.Nullable; -import org.junit.Assert; -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; -import java.util.function.BiPredicate; - -public class ContentHeaderTest { - public record ParamTestCase(@Nullable Object payload, Map> expectedSerialization, @Nullable Boolean explode) { - public ParamTestCase(@Nullable Object payload, Map> expectedSerialization) { - this(payload, expectedSerialization, null); - } - } - - @Test - public void testSerialization() throws ValidationException, NotImplementedException { - var mapPayload = new LinkedHashMap(); - mapPayload.put("R", 100); - mapPayload.put("G", 200); - mapPayload.put("B", 150); - List testCases = List.of( - new ParamTestCase( - null, - Map.of("color", List.of("null")) - ), - new ParamTestCase( - true, - Map.of("color", List.of("true")) - ), - new ParamTestCase( - false, - Map.of("color", List.of("false")) - ), - new ParamTestCase( - 1, - Map.of("color", List.of("1")) - ), - new ParamTestCase( - 3.14, - Map.of("color",List.of("3.14")) - ), - new ParamTestCase( - "blue", - Map.of("color", List.of("\"blue\"")) - ), - new ParamTestCase( - "hello world", - Map.of("color", List.of("\"hello world\"")) - ), - new ParamTestCase( - "", - Map.of("color", List.of("\"\"")) - ), - new ParamTestCase( - List.of(), - Map.of("color", List.of("[]")) - ), - new ParamTestCase( - List.of("blue", "black", "brown"), - Map.of("color", List.of("[\"blue\",\"black\",\"brown\"]")) - ), - new ParamTestCase( - List.of("blue", "black", "brown"), - Map.of("color", List.of("[\"blue\",\"black\",\"brown\"]")), - true - ), - new ParamTestCase( - Map.of(), - Map.of("color", List.of("{}")) - ), - new ParamTestCase( - mapPayload, - Map.of("color", List.of("{\"R\":100,\"G\":200,\"B\":150}")) - ), - new ParamTestCase( - mapPayload, - Map.of("color", List.of("{\"R\":100,\"G\":200,\"B\":150}")), - true - ) - ); - SchemaConfiguration configuration = new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().build()); - BiPredicate headerFilter = (key, val) -> true; - class ApplicationJsonMediaType implements MediaType { - @Override - public AnyTypeJsonSchema.AnyTypeJsonSchema1 schema() { - return AnyTypeJsonSchema.AnyTypeJsonSchema1.getInstance(); - } - - @Override - public Nothing? encoding() { - return null; - } - } - AbstractMap.SimpleEntry> content = new AbstractMap.SimpleEntry<>( - "application/json", new ApplicationJsonMediaType() - ); - for (ParamTestCase testCase: testCases) { - var header = new ContentHeader( - true, - false, - testCase.explode, - content - ); - var serialization = header.serialize(testCase.payload, "color", false, configuration); - Assert.assertEquals(HttpHeaders.of(testCase.expectedSerialization, headerFilter), serialization); - } - } -} diff --git a/samples/client/petstore/kotlin/src/test/kotlin/org/openapijsonschematools/client/header/SchemaHeaderTest.kt b/samples/client/petstore/kotlin/src/test/kotlin/org/openapijsonschematools/client/header/SchemaHeaderTest.kt deleted file mode 100644 index 954d0e33a6b..00000000000 --- a/samples/client/petstore/kotlin/src/test/kotlin/org/openapijsonschematools/client/header/SchemaHeaderTest.kt +++ /dev/null @@ -1,177 +0,0 @@ -package org.openapijsonschematools.client.header; - -import org.checkerframework.checker.nullness.qual.Nullable; -import org.junit.Assert; -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.schemas.AnyTypeJsonSchema; -import org.openapijsonschematools.client.schemas.ListJsonSchema; -import org.openapijsonschematools.client.schemas.NullJsonSchema; -import org.openapijsonschematools.client.schemas.NumberJsonSchema; -import org.openapijsonschematools.client.schemas.StringJsonSchema; -import org.openapijsonschematools.client.schemas.validation.JsonSchema; - -import java.net.http.HttpHeaders; -import java.util.LinkedHashMap; -import java.util.List; -import java.util.Map; -import java.util.Set; -import java.util.function.BiPredicate; - -public class SchemaHeaderTest { - public record ParamTestCase(@Nullable Object payload, Map> expectedSerialization, @Nullable Boolean explode) { - public ParamTestCase(@Nullable Object payload, Map> expectedSerialization) { - this(payload, expectedSerialization, null); - } - } - - @Test - public void testSerialization() throws ValidationException, NotImplementedException { - var mapPayload = new LinkedHashMap(); - mapPayload.put("R", 100); - mapPayload.put("G", 200); - mapPayload.put("B", 150); - List testCases = List.of( - new ParamTestCase( - null, - Map.of("color", List.of("")) - ), - new ParamTestCase( - 1, - Map.of("color", List.of("1")) - ), - new ParamTestCase( - 3.14, - Map.of("color",List.of("3.14")) - ), - new ParamTestCase( - "blue", - Map.of("color", List.of("blue")) - ), - new ParamTestCase( - "hello world", - Map.of("color", List.of("hello world")) - ), - new ParamTestCase( - "", - Map.of("color", List.of("")) - ), - new ParamTestCase( - List.of(), - Map.of("color", List.of("")) - ), - new ParamTestCase( - List.of("blue", "black", "brown"), - Map.of("color", List.of("blue,black,brown")) - ), - new ParamTestCase( - List.of("blue", "black", "brown"), - Map.of("color", List.of("blue,black,brown")), - true - ), - new ParamTestCase( - Map.of(), - Map.of("color", List.of("")) - ), - new ParamTestCase( - mapPayload, - Map.of("color", List.of("R,100,G,200,B,150")) - ), - new ParamTestCase( - mapPayload, - Map.of("color", List.of("R=100,G=200,B=150")), - true - ) - ); - SchemaConfiguration configuration = new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().build()); - BiPredicate headerFilter = (key, val) -> true; - for (ParamTestCase testCase: testCases) { - var header = new SchemaHeader( - true, - false, - testCase.explode, - AnyTypeJsonSchema.AnyTypeJsonSchema1.getInstance() - ); - var serialization = header.serialize(testCase.payload, "color", false, configuration); - Assert.assertEquals(HttpHeaders.of(testCase.expectedSerialization, headerFilter), serialization); - } - SchemaHeader boolHeader = new SchemaHeader( - true, - false, - false, - AnyTypeJsonSchema.AnyTypeJsonSchema1.getInstance() - ); - for (boolean value: Set.of(true, false)) { - Assert.assertThrows( - NotImplementedException.class, - () -> boolHeader.serialize(value, "color", false, configuration) - ); - } - } - - private static SchemaHeader getHeader(JsonSchema schema) { - return new SchemaHeader( - true, - false, - false, - schema - ); - } - - @SuppressWarnings("nullness") - private void assertNull(@Nullable Object object) { - Assert.assertNull(object); - } - - @Test - public void testDeserialization() throws ValidationException, NotImplementedException { - SchemaConfiguration configuration = new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().build()); - - SchemaHeader header = getHeader(NullJsonSchema.NullJsonSchema1.getInstance()); - @Nullable Object deserialized = header.deserialize(List.of(""), false, configuration); - assertNull(deserialized); - - header = getHeader(NumberJsonSchema.NumberJsonSchema1.getInstance()); - var deserializedOne = header.deserialize(List.of("1"), false, configuration); - if (deserializedOne == null) { - throw new RuntimeException("invalid value"); - } - @Nullable Object expected = 1L; - Assert.assertEquals(expected, deserializedOne); - - header = getHeader(NumberJsonSchema.NumberJsonSchema1.getInstance()); - var deserialized314 = header.deserialize(List.of("3.14"), false, configuration); - if (deserialized314 == null) { - throw new RuntimeException("invalid value"); - } - expected = 3.14d; - Assert.assertEquals(expected, deserialized314); - - header = getHeader(StringJsonSchema.StringJsonSchema1.getInstance()); - var deserializedBlue = header.deserialize(List.of("blue"), false, configuration); - if (deserializedBlue == null) { - throw new RuntimeException("invalid value"); - } - expected = "blue"; - Assert.assertEquals(expected, deserializedBlue); - - header = getHeader(StringJsonSchema.StringJsonSchema1.getInstance()); - var deserializedHelloWorld = header.deserialize(List.of("hello world"), false, configuration); - if (deserializedHelloWorld == null) { - throw new RuntimeException("invalid value"); - } - expected = "hello world"; - Assert.assertEquals(expected, deserializedHelloWorld); - - header = getHeader(ListJsonSchema.ListJsonSchema1.getInstance()); - var deserializedList = header.deserialize(List.of("blue", "black", "brown"), false, configuration); - if (deserializedList == null) { - throw new RuntimeException("invalid value"); - } - expected = List.of("blue", "black", "brown"); - Assert.assertEquals(expected, deserializedList); - } -} diff --git a/samples/client/petstore/kotlin/src/test/kotlin/org/openapijsonschematools/client/parameter/CookieSerializerTest.kt b/samples/client/petstore/kotlin/src/test/kotlin/org/openapijsonschematools/client/parameter/CookieSerializerTest.kt deleted file mode 100644 index a46f7fbb5f7..00000000000 --- a/samples/client/petstore/kotlin/src/test/kotlin/org/openapijsonschematools/client/parameter/CookieSerializerTest.kt +++ /dev/null @@ -1,45 +0,0 @@ -package org.openapijsonschematools.client.parameter; - -import org.junit.Assert; -import org.junit.Test; -import org.openapijsonschematools.client.exceptions.NotImplementedException; -import org.openapijsonschematools.client.schemas.AnyTypeJsonSchema; - -import java.util.AbstractMap; -import java.util.Map; - -public class CookieSerializerTest { - public static class Parameter1 extends SchemaParameter { - public Parameter1() { - super("param1", ParameterInType.COOKIE, true, null, null, null, AnyTypeJsonSchema.AnyTypeJsonSchema1.getInstance()); - } - } - - public static class Parameter2 extends SchemaParameter { - public Parameter2() { - super("param2", ParameterInType.COOKIE, true, null, null, null, AnyTypeJsonSchema.AnyTypeJsonSchema1.getInstance()); - } - } - - public static class CookieParametersSerializer extends CookieSerializer { - protected CookieParametersSerializer() { - super( - Map.ofEntries( - new AbstractMap.SimpleEntry<>("param1", new Parameter1()), - new AbstractMap.SimpleEntry<>("param2", new Parameter2()) - ) - ); - } - } - - @Test - public void testSerialization() throws NotImplementedException { - Map inData = Map.ofEntries( - new AbstractMap.SimpleEntry<>("param1", "a"), - new AbstractMap.SimpleEntry<>("param2", 3.14d) - ); - String cookie = new CookieParametersSerializer().serialize(inData); - String expectedCookie = "param1=a; param2=3.14"; - Assert.assertEquals(expectedCookie, cookie); - } -} \ No newline at end of file diff --git a/samples/client/petstore/kotlin/src/test/kotlin/org/openapijsonschematools/client/parameter/HeadersSerializerTest.kt b/samples/client/petstore/kotlin/src/test/kotlin/org/openapijsonschematools/client/parameter/HeadersSerializerTest.kt deleted file mode 100644 index 2a9acf14219..00000000000 --- a/samples/client/petstore/kotlin/src/test/kotlin/org/openapijsonschematools/client/parameter/HeadersSerializerTest.kt +++ /dev/null @@ -1,49 +0,0 @@ -package org.openapijsonschematools.client.parameter; - -import org.junit.Assert; -import org.junit.Test; -import org.openapijsonschematools.client.exceptions.NotImplementedException; -import org.openapijsonschematools.client.schemas.AnyTypeJsonSchema; - -import java.util.AbstractMap; -import java.util.Map; -import java.util.List; - -public class HeadersSerializerTest { - public static class Param1HeaderParameter extends SchemaParameter { - public Param1HeaderParameter() { - super("param1", ParameterInType.HEADER, true, null, null, null, AnyTypeJsonSchema.AnyTypeJsonSchema1.getInstance()); - } - } - - public static class Param2HeaderParameter extends SchemaParameter { - public Param2HeaderParameter() { - super("param2", ParameterInType.HEADER, true, null, null, null, AnyTypeJsonSchema.AnyTypeJsonSchema1.getInstance()); - } - } - - public static class HeaderParametersSerializer extends HeadersSerializer { - protected HeaderParametersSerializer() { - super( - Map.ofEntries( - new AbstractMap.SimpleEntry<>("param1", new Param1HeaderParameter()), - new AbstractMap.SimpleEntry<>("param2", new Param2HeaderParameter()) - ) - ); - } - } - - @Test - public void testSerialization() throws NotImplementedException { - Map inData = Map.ofEntries( - new AbstractMap.SimpleEntry<>("param1", "a"), - new AbstractMap.SimpleEntry<>("param2", 3.14d) - ); - Map> expectedHeaders = Map.ofEntries( - new AbstractMap.SimpleEntry<>("param1", List.of("a")), - new AbstractMap.SimpleEntry<>("param2", List.of("3.14")) - ); - Map> headers = new HeaderParametersSerializer().serialize(inData); - Assert.assertEquals(expectedHeaders, headers); - } -} \ No newline at end of file diff --git a/samples/client/petstore/kotlin/src/test/kotlin/org/openapijsonschematools/client/parameter/PathSerializerTest.kt b/samples/client/petstore/kotlin/src/test/kotlin/org/openapijsonschematools/client/parameter/PathSerializerTest.kt deleted file mode 100644 index 3ff2ac5ed88..00000000000 --- a/samples/client/petstore/kotlin/src/test/kotlin/org/openapijsonschematools/client/parameter/PathSerializerTest.kt +++ /dev/null @@ -1,46 +0,0 @@ -package org.openapijsonschematools.client.parameter; - -import org.junit.Assert; -import org.junit.Test; -import org.openapijsonschematools.client.exceptions.NotImplementedException; -import org.openapijsonschematools.client.schemas.AnyTypeJsonSchema; - -import java.util.AbstractMap; -import java.util.Map; - -public class PathSerializerTest { - public static class Parameter1 extends SchemaParameter { - public Parameter1() { - super("param1", ParameterInType.PATH, true, null, null, null, AnyTypeJsonSchema.AnyTypeJsonSchema1.getInstance()); - } - } - - public static class Parameter2 extends SchemaParameter { - public Parameter2() { - super("param2", ParameterInType.PATH, true, null, null, null, AnyTypeJsonSchema.AnyTypeJsonSchema1.getInstance()); - } - } - - public static class PathParametersSerializer extends PathSerializer { - protected PathParametersSerializer() { - super( - Map.ofEntries( - new AbstractMap.SimpleEntry<>("param1", new Parameter1()), - new AbstractMap.SimpleEntry<>("param2", new Parameter2()) - ) - ); - } - } - - @Test - public void testSerialization() throws NotImplementedException { - Map inData = Map.ofEntries( - new AbstractMap.SimpleEntry<>("param1", "a"), - new AbstractMap.SimpleEntry<>("param2", 3.14d) - ); - String pathWithPlaceholders = "/{param1}/{param2}"; - String path = new PathParametersSerializer().serialize(inData, pathWithPlaceholders); - String expectedPath = "/a/3.14"; - Assert.assertEquals(expectedPath, path); - } -} \ No newline at end of file diff --git a/samples/client/petstore/kotlin/src/test/kotlin/org/openapijsonschematools/client/parameter/QuerySerializerTest.kt b/samples/client/petstore/kotlin/src/test/kotlin/org/openapijsonschematools/client/parameter/QuerySerializerTest.kt deleted file mode 100644 index 7cb559fef3c..00000000000 --- a/samples/client/petstore/kotlin/src/test/kotlin/org/openapijsonschematools/client/parameter/QuerySerializerTest.kt +++ /dev/null @@ -1,52 +0,0 @@ -package org.openapijsonschematools.client.parameter; - -import org.junit.Assert; -import org.junit.Test; -import org.openapijsonschematools.client.exceptions.NotImplementedException; -import org.openapijsonschematools.client.schemas.AnyTypeJsonSchema; - -import java.util.AbstractMap; -import java.util.Map; - -public class QuerySerializerTest { - public static class Param1QueryParameter extends SchemaParameter { - public Param1QueryParameter() { - super("param1", ParameterInType.QUERY, true, null, null, null, AnyTypeJsonSchema.AnyTypeJsonSchema1.getInstance()); - } - } - - public static class Param2QueryParameter extends SchemaParameter { - public Param2QueryParameter() { - super("param2", ParameterInType.QUERY, true, null, null, null, AnyTypeJsonSchema.AnyTypeJsonSchema1.getInstance()); - } - } - - public static class QueryParametersSerializer extends QuerySerializer { - protected QueryParametersSerializer() { - super( - Map.ofEntries( - new AbstractMap.SimpleEntry<>("param1", new Param1QueryParameter()), - new AbstractMap.SimpleEntry<>("param2", new Param2QueryParameter()) - ) - ); - } - } - - @Test - public void testSerialization() throws NotImplementedException { - Map inData = Map.ofEntries( - new AbstractMap.SimpleEntry<>("param1", "a"), - new AbstractMap.SimpleEntry<>("param2", 3.14d) - ); - var serializer = new QueryParametersSerializer(); - var queryMap = serializer.getQueryMap(inData); - Map expectedQueryMap = Map.ofEntries( - new AbstractMap.SimpleEntry<>("param1", "param1=a"), - new AbstractMap.SimpleEntry<>("param2", "param2=3.14") - ); - Assert.assertEquals(expectedQueryMap, queryMap); - String query = serializer.serialize(queryMap); - String expectedQuery = "?param1=a¶m2=3.14"; - Assert.assertEquals(expectedQuery, query); - } -} \ No newline at end of file diff --git a/samples/client/petstore/kotlin/src/test/kotlin/org/openapijsonschematools/client/parameter/SchemaNonQueryParameterTest.kt b/samples/client/petstore/kotlin/src/test/kotlin/org/openapijsonschematools/client/parameter/SchemaNonQueryParameterTest.kt deleted file mode 100644 index 4d799c14c72..00000000000 --- a/samples/client/petstore/kotlin/src/test/kotlin/org/openapijsonschematools/client/parameter/SchemaNonQueryParameterTest.kt +++ /dev/null @@ -1,397 +0,0 @@ -package org.openapijsonschematools.client.parameter; - -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.schemas.AnyTypeJsonSchema; - -import java.util.LinkedHashMap; -import java.util.List; -import java.util.Map; -import java.util.AbstractMap; -import java.util.Set; - -public class SchemaNonQueryParameterTest { - public record ParamTestCase(@Nullable Object payload, AbstractMap.SimpleEntry expectedSerialization, @Nullable Boolean explode) { - public ParamTestCase(@Nullable Object payload, AbstractMap.SimpleEntry expectedSerialization) { - this(payload, expectedSerialization, null); - } - } - - public static class HeaderParameter extends SchemaParameter { - public HeaderParameter(@Nullable Boolean explode) { - super("color", ParameterInType.HEADER, true, null, explode, null, AnyTypeJsonSchema.AnyTypeJsonSchema1.getInstance()); - } - } - - @Test - public void testHeaderSerialization() throws NotImplementedException { - var mapPayload = new LinkedHashMap(); - mapPayload.put("R", 100); - mapPayload.put("G", 200); - mapPayload.put("B", 150); - List testCases = List.of( - new ParamTestCase( - null, - new AbstractMap.SimpleEntry<>("color", "") - ), - new ParamTestCase( - 1, - new AbstractMap.SimpleEntry<>("color", "1") - ), - new ParamTestCase( - 3.14, - new AbstractMap.SimpleEntry<>("color","3.14") - ), - new ParamTestCase( - "blue", - new AbstractMap.SimpleEntry<>("color", "blue") - ), - new ParamTestCase( - "hello world", - new AbstractMap.SimpleEntry<>("color", "hello world") - ), - new ParamTestCase( - "", - new AbstractMap.SimpleEntry<>("color", "") - ), - new ParamTestCase( - List.of(), - new AbstractMap.SimpleEntry<>("color", "") - ), - new ParamTestCase( - List.of("blue", "black", "brown"), - new AbstractMap.SimpleEntry<>("color", "blue,black,brown") - ), - new ParamTestCase( - List.of("blue", "black", "brown"), - new AbstractMap.SimpleEntry<>("color", "blue,black,brown"), - true - ), - new ParamTestCase( - Map.of(), - new AbstractMap.SimpleEntry<>("color", "") - ), - new ParamTestCase( - mapPayload, - new AbstractMap.SimpleEntry<>("color", "R,100,G,200,B,150") - ), - new ParamTestCase( - mapPayload, - new AbstractMap.SimpleEntry<>("color", "R=100,G=200,B=150"), - true - ) - ); - for (ParamTestCase testCase: testCases) { - var header = new HeaderParameter(testCase.explode); - var serialization = header.serialize(testCase.payload); - Assert.assertEquals(testCase.expectedSerialization, serialization); - } - var boolHeader = new HeaderParameter(false); - for (boolean value: Set.of(true, false)) { - Assert.assertThrows( - NotImplementedException.class, - () -> boolHeader.serialize(value) - ); - } - } - - public static class PathParameter extends SchemaParameter { - public PathParameter(@Nullable Boolean explode) { - super("color", ParameterInType.PATH, true, null, explode, null, AnyTypeJsonSchema.AnyTypeJsonSchema1.getInstance()); - } - } - - @Test - public void testPathSerialization() throws NotImplementedException { - var mapPayload = new LinkedHashMap(); - mapPayload.put("R", 100); - mapPayload.put("G", 200); - mapPayload.put("B", 150); - List testCases = List.of( - new ParamTestCase( - null, - new AbstractMap.SimpleEntry<>("color", "") - ), - new ParamTestCase( - 1, - new AbstractMap.SimpleEntry<>("color", "1") - ), - new ParamTestCase( - 3.14, - new AbstractMap.SimpleEntry<>("color","3.14") - ), - new ParamTestCase( - "blue", - new AbstractMap.SimpleEntry<>("color", "blue") - ), - new ParamTestCase( - "hello world", - new AbstractMap.SimpleEntry<>("color", "hello%20world") - ), - new ParamTestCase( - "", - new AbstractMap.SimpleEntry<>("color", "") - ), - new ParamTestCase( - List.of(), - new AbstractMap.SimpleEntry<>("color", "") - ), - new ParamTestCase( - List.of("blue", "black", "brown"), - new AbstractMap.SimpleEntry<>("color", "blue,black,brown") - ), - new ParamTestCase( - List.of("blue", "black", "brown"), - new AbstractMap.SimpleEntry<>("color", "blue,black,brown"), - true - ), - new ParamTestCase( - Map.of(), - new AbstractMap.SimpleEntry<>("color", "") - ), - new ParamTestCase( - mapPayload, - new AbstractMap.SimpleEntry<>("color", "R,100,G,200,B,150") - ), - new ParamTestCase( - mapPayload, - new AbstractMap.SimpleEntry<>("color", "R=100,G=200,B=150"), - true - ) - ); - for (ParamTestCase testCase: testCases) { - var pathParameter = new PathParameter(testCase.explode); - var serialization = pathParameter.serialize(testCase.payload); - Assert.assertEquals(testCase.expectedSerialization, serialization); - } - var pathParameter = new PathParameter(false); - for (boolean value: Set.of(true, false)) { - Assert.assertThrows( - NotImplementedException.class, - () -> pathParameter.serialize(value) - ); - } - } - - public static class CookieParameter extends SchemaParameter { - public CookieParameter(@Nullable Boolean explode) { - super("color", ParameterInType.COOKIE, true, null, explode, null, AnyTypeJsonSchema.AnyTypeJsonSchema1.getInstance()); - } - } - - @Test - public void testCookieSerialization() throws NotImplementedException { - var mapPayload = new LinkedHashMap(); - mapPayload.put("R", 100); - mapPayload.put("G", 200); - mapPayload.put("B", 150); - List testCases = List.of( - new ParamTestCase( - null, - new AbstractMap.SimpleEntry<>("color", "") - ), - new ParamTestCase( - 1, - new AbstractMap.SimpleEntry<>("color", "color=1") - ), - new ParamTestCase( - 3.14, - new AbstractMap.SimpleEntry<>("color","color=3.14") - ), - new ParamTestCase( - "blue", - new AbstractMap.SimpleEntry<>("color", "color=blue") - ), - new ParamTestCase( - "hello world", - new AbstractMap.SimpleEntry<>("color", "color=hello world") - ), - new ParamTestCase( - "", - new AbstractMap.SimpleEntry<>("color", "color=") - ), - new ParamTestCase( - List.of(), - new AbstractMap.SimpleEntry<>("color", "") - ), - new ParamTestCase( - List.of("blue", "black", "brown"), - new AbstractMap.SimpleEntry<>("color", "color=blue&color=black&color=brown") - ), - new ParamTestCase( - List.of("blue", "black", "brown"), - new AbstractMap.SimpleEntry<>("color", "color=blue&color=black&color=brown"), - true - ), - new ParamTestCase( - Map.of(), - new AbstractMap.SimpleEntry<>("color", "") - ), - new ParamTestCase( - mapPayload, - new AbstractMap.SimpleEntry<>("color", "R=100&G=200&B=150") - ), - new ParamTestCase( - mapPayload, - new AbstractMap.SimpleEntry<>("color", "R=100&G=200&B=150"), - true - ) - ); - for (ParamTestCase testCase: testCases) { - var cookieParameter = new CookieParameter(testCase.explode); - var serialization = cookieParameter.serialize(testCase.payload); - Assert.assertEquals(testCase.expectedSerialization, serialization); - } - var cookieParameter = new CookieParameter(false); - for (boolean value: Set.of(true, false)) { - Assert.assertThrows( - NotImplementedException.class, - () -> cookieParameter.serialize(value) - ); - } - } - - public static class PathMatrixParameter extends SchemaParameter { - public PathMatrixParameter(@Nullable Boolean explode) { - super("color", ParameterInType.PATH, true, ParameterStyle.MATRIX, explode, null, AnyTypeJsonSchema.AnyTypeJsonSchema1.getInstance()); - } - } - - @Test - public void testPathMatrixSerialization() throws NotImplementedException { - var mapPayload = new LinkedHashMap(); - mapPayload.put("R", 100); - mapPayload.put("G", 200); - mapPayload.put("B", 150); - List testCases = List.of( - new ParamTestCase( - null, - new AbstractMap.SimpleEntry<>("color", "") - ), - new ParamTestCase( - 1, - new AbstractMap.SimpleEntry<>("color", ";color=1") - ), - new ParamTestCase( - 3.14, - new AbstractMap.SimpleEntry<>("color",";color=3.14") - ), - new ParamTestCase( - "blue", - new AbstractMap.SimpleEntry<>("color", ";color=blue") - ), - new ParamTestCase( - "hello world", - new AbstractMap.SimpleEntry<>("color", ";color=hello%20world") - ), - new ParamTestCase( - "", - new AbstractMap.SimpleEntry<>("color", ";color") - ), - new ParamTestCase( - List.of(), - new AbstractMap.SimpleEntry<>("color", "") - ), - new ParamTestCase( - List.of("blue", "black", "brown"), - new AbstractMap.SimpleEntry<>("color", ";color=blue,black,brown") - ), - new ParamTestCase( - List.of("blue", "black", "brown"), - new AbstractMap.SimpleEntry<>("color", ";color=blue;color=black;color=brown"), - true - ), - new ParamTestCase( - Map.of(), - new AbstractMap.SimpleEntry<>("color", "") - ), - new ParamTestCase( - mapPayload, - new AbstractMap.SimpleEntry<>("color", ";color=R,100,G,200,B,150") - ), - new ParamTestCase( - mapPayload, - new AbstractMap.SimpleEntry<>("color", ";R=100;G=200;B=150"), - true - ) - ); - for (ParamTestCase testCase: testCases) { - var pathParameter = new PathMatrixParameter(testCase.explode); - var serialization = pathParameter.serialize(testCase.payload); - Assert.assertEquals(testCase.expectedSerialization, serialization); - } - } - - public static class PathLabelParameter extends SchemaParameter { - public PathLabelParameter(@Nullable Boolean explode) { - super("color", ParameterInType.PATH, true, ParameterStyle.LABEL, explode, null, AnyTypeJsonSchema.AnyTypeJsonSchema1.getInstance()); - } - } - - @Test - public void testPathLabelSerialization() throws NotImplementedException { - var mapPayload = new LinkedHashMap(); - mapPayload.put("R", 100); - mapPayload.put("G", 200); - mapPayload.put("B", 150); - List testCases = List.of( - new ParamTestCase( - null, - new AbstractMap.SimpleEntry<>("color", "") - ), - new ParamTestCase( - 1, - new AbstractMap.SimpleEntry<>("color", ".1") - ), - new ParamTestCase( - 3.14, - new AbstractMap.SimpleEntry<>("color",".3.14") - ), - new ParamTestCase( - "blue", - new AbstractMap.SimpleEntry<>("color", ".blue") - ), - new ParamTestCase( - "hello world", - new AbstractMap.SimpleEntry<>("color", ".hello%20world") - ), - new ParamTestCase( - "", - new AbstractMap.SimpleEntry<>("color", ".") - ), - new ParamTestCase( - List.of(), - new AbstractMap.SimpleEntry<>("color", "") - ), - new ParamTestCase( - List.of("blue", "black", "brown"), - new AbstractMap.SimpleEntry<>("color", ".blue.black.brown") - ), - new ParamTestCase( - List.of("blue", "black", "brown"), - new AbstractMap.SimpleEntry<>("color", ".blue.black.brown"), - true - ), - new ParamTestCase( - Map.of(), - new AbstractMap.SimpleEntry<>("color", "") - ), - new ParamTestCase( - mapPayload, - new AbstractMap.SimpleEntry<>("color", ".R.100.G.200.B.150") - ), - new ParamTestCase( - mapPayload, - new AbstractMap.SimpleEntry<>("color", ".R=100.G=200.B=150"), - true - ) - ); - for (ParamTestCase testCase: testCases) { - var pathParameter = new PathLabelParameter(testCase.explode); - var serialization = pathParameter.serialize(testCase.payload); - Assert.assertEquals(testCase.expectedSerialization, serialization); - } - } -} \ No newline at end of file diff --git a/samples/client/petstore/kotlin/src/test/kotlin/org/openapijsonschematools/client/parameter/SchemaQueryParameterTest.kt b/samples/client/petstore/kotlin/src/test/kotlin/org/openapijsonschematools/client/parameter/SchemaQueryParameterTest.kt deleted file mode 100644 index 413b092634f..00000000000 --- a/samples/client/petstore/kotlin/src/test/kotlin/org/openapijsonschematools/client/parameter/SchemaQueryParameterTest.kt +++ /dev/null @@ -1,193 +0,0 @@ -package org.openapijsonschematools.client.parameter; - -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.schemas.AnyTypeJsonSchema; - -import java.util.LinkedHashMap; -import java.util.List; -import java.util.AbstractMap; -import java.util.Map; -import java.util.Set; - -public class SchemaQueryParameterTest { - public record ParamTestCase(@Nullable Object payload, AbstractMap.SimpleEntry expectedSerialization, @Nullable Boolean explode) { - public ParamTestCase(@Nullable Object payload, AbstractMap.SimpleEntry expectedSerialization) { - this(payload, expectedSerialization, null); - } - } - - public static class QueryParameterNoStyle extends SchemaParameter { - public QueryParameterNoStyle(@Nullable Boolean explode) { - super("color", ParameterInType.QUERY, true, null, explode, null, AnyTypeJsonSchema.AnyTypeJsonSchema1.getInstance()); - } - } - - @Test - public void testQueryParameterNoStyleSerialization() throws NotImplementedException { - var mapPayload = new LinkedHashMap(); - mapPayload.put("R", 100); - mapPayload.put("G", 200); - mapPayload.put("B", 150); - List testCases = List.of( - new ParamTestCase( - null, - new AbstractMap.SimpleEntry<>("color", "") - ), - new ParamTestCase( - 1, - new AbstractMap.SimpleEntry<>("color", "color=1") - ), - new ParamTestCase( - 3.14, - new AbstractMap.SimpleEntry<>("color","color=3.14") - ), - new ParamTestCase( - "blue", - new AbstractMap.SimpleEntry<>("color", "color=blue") - ), - new ParamTestCase( - "hello world", - new AbstractMap.SimpleEntry<>("color", "color=hello%20world") - ), - new ParamTestCase( - "", - new AbstractMap.SimpleEntry<>("color", "color=") - ), - new ParamTestCase( - List.of(), - new AbstractMap.SimpleEntry<>("color", "") - ), - new ParamTestCase( - List.of("blue", "black", "brown"), - new AbstractMap.SimpleEntry<>("color", "color=blue&color=black&color=brown") - ), - new ParamTestCase( - List.of("blue", "black", "brown"), - new AbstractMap.SimpleEntry<>("color", "color=blue&color=black&color=brown"), - true - ), - new ParamTestCase( - Map.of(), - new AbstractMap.SimpleEntry<>("color", "") - ), - new ParamTestCase( - mapPayload, - new AbstractMap.SimpleEntry<>("color", "R=100&G=200&B=150") - ), - new ParamTestCase( - mapPayload, - new AbstractMap.SimpleEntry<>("color", "R=100&G=200&B=150"), - true - ) - ); - for (ParamTestCase testCase: testCases) { - var parameter = new QueryParameterNoStyle(testCase.explode); - var serialization = parameter.serialize(testCase.payload); - Assert.assertEquals(testCase.expectedSerialization, serialization); - } - var parameter = new QueryParameterNoStyle(false); - for (boolean value: Set.of(true, false)) { - Assert.assertThrows( - NotImplementedException.class, - () -> parameter.serialize(value) - ); - } - } - - public static class QueryParameterSpaceDelimited extends SchemaParameter { - public QueryParameterSpaceDelimited(@Nullable Boolean explode) { - super("color", ParameterInType.QUERY, true, ParameterStyle.SPACE_DELIMITED, explode, null, AnyTypeJsonSchema.AnyTypeJsonSchema1.getInstance()); - } - } - - @Test - public void testQueryParameterSpaceDelimitedSerialization() throws NotImplementedException { - var mapPayload = new LinkedHashMap(); - mapPayload.put("R", 100); - mapPayload.put("G", 200); - mapPayload.put("B", 150); - List testCases = List.of( - new ParamTestCase( - List.of(), - new AbstractMap.SimpleEntry<>("color", "") - ), - new ParamTestCase( - List.of("blue", "black", "brown"), - new AbstractMap.SimpleEntry<>("color", "blue%20black%20brown") - ), - new ParamTestCase( - List.of("blue", "black", "brown"), - new AbstractMap.SimpleEntry<>("color", "blue%20black%20brown"), - true - ), - new ParamTestCase( - Map.of(), - new AbstractMap.SimpleEntry<>("color", "") - ), - new ParamTestCase( - mapPayload, - new AbstractMap.SimpleEntry<>("color", "R%20100%20G%20200%20B%20150") - ), - new ParamTestCase( - mapPayload, - new AbstractMap.SimpleEntry<>("color", "R=100%20G=200%20B=150"), - true - ) - ); - for (ParamTestCase testCase: testCases) { - var parameter = new QueryParameterSpaceDelimited(testCase.explode); - var serialization = parameter.serialize(testCase.payload); - Assert.assertEquals(testCase.expectedSerialization, serialization); - } - } - - public static class QueryParameterPipeDelimited extends SchemaParameter { - public QueryParameterPipeDelimited(@Nullable Boolean explode) { - super("color", ParameterInType.QUERY, true, ParameterStyle.PIPE_DELIMITED, explode, null, AnyTypeJsonSchema.AnyTypeJsonSchema1.getInstance()); - } - } - - @Test - public void testQueryParameterPipeDelimitedSerialization() throws NotImplementedException { - var mapPayload = new LinkedHashMap(); - mapPayload.put("R", 100); - mapPayload.put("G", 200); - mapPayload.put("B", 150); - List testCases = List.of( - new ParamTestCase( - List.of(), - new AbstractMap.SimpleEntry<>("color", "") - ), - new ParamTestCase( - List.of("blue", "black", "brown"), - new AbstractMap.SimpleEntry<>("color", "blue|black|brown") - ), - new ParamTestCase( - List.of("blue", "black", "brown"), - new AbstractMap.SimpleEntry<>("color", "blue|black|brown"), - true - ), - new ParamTestCase( - Map.of(), - new AbstractMap.SimpleEntry<>("color", "") - ), - new ParamTestCase( - mapPayload, - new AbstractMap.SimpleEntry<>("color", "R|100|G|200|B|150") - ), - new ParamTestCase( - mapPayload, - new AbstractMap.SimpleEntry<>("color", "R=100|G=200|B=150"), - true - ) - ); - for (ParamTestCase testCase: testCases) { - var parameter = new QueryParameterPipeDelimited(testCase.explode); - var serialization = parameter.serialize(testCase.payload); - Assert.assertEquals(testCase.expectedSerialization, serialization); - } - } -} diff --git a/samples/client/petstore/kotlin/src/test/kotlin/org/openapijsonschematools/client/requestbody/RequestBodySerializerTest.kt b/samples/client/petstore/kotlin/src/test/kotlin/org/openapijsonschematools/client/requestbody/RequestBodySerializerTest.kt deleted file mode 100644 index 9594b4876f4..00000000000 --- a/samples/client/petstore/kotlin/src/test/kotlin/org/openapijsonschematools/client/requestbody/RequestBodySerializerTest.kt +++ /dev/null @@ -1,181 +0,0 @@ -package org.openapijsonschematools.client.requestbody; - -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; - -import org.checkerframework.checker.nullness.qual.Nullable; -import org.junit.Assert; -import org.junit.Test; - -import java.net.http.HttpResponse; -import java.nio.ByteBuffer; -import java.nio.charset.StandardCharsets; -import java.util.AbstractMap; -import java.util.List; -import java.util.Map; -import java.util.concurrent.Flow; - -public final class RequestBodySerializerTest { - public sealed interface SealedMediaType permits ApplicationjsonMediaType, TextplainMediaType {} - public record ApplicationjsonMediaType(AnyTypeJsonSchema.AnyTypeJsonSchema1 schema) implements SealedMediaType {} - public record TextplainMediaType(StringJsonSchema.StringJsonSchema1 schema) implements SealedMediaType {} - - public sealed interface SealedRequestBody permits ApplicationjsonRequestBody, TextplainRequestBody {} - public record ApplicationjsonRequestBody(AnyTypeJsonSchema.AnyTypeJsonSchema1Boxed body) implements SealedRequestBody, GenericRequestBody<@Nullable Object> { - @Override - public String contentType() { - return "application/json"; - } - } - public record TextplainRequestBody(StringJsonSchema.StringJsonSchema1Boxed body) implements SealedRequestBody, GenericRequestBody<@Nullable Object> { - @Override - public String contentType() { - return "text/plain"; - } - } - - public static class MyRequestBodySerializer extends RequestBodySerializer { - public MyRequestBodySerializer() { - super( - Map.ofEntries( - new AbstractMap.SimpleEntry<>("application/json", new ApplicationjsonMediaType(AnyTypeJsonSchema.AnyTypeJsonSchema1.getInstance())), - new AbstractMap.SimpleEntry<>("text/plain", new TextplainMediaType(StringJsonSchema.StringJsonSchema1.getInstance())) - ), - true); - } - - public SerializedRequestBody serialize(SealedRequestBody requestBody) throws NotImplementedException { - if (requestBody instanceof ApplicationjsonRequestBody requestBody0) { - return serialize(requestBody0.contentType(), requestBody0.body().getData()); - } else { - TextplainRequestBody requestBody1 = (TextplainRequestBody) requestBody; - return serialize(requestBody1.contentType(), requestBody1.body().getData()); - } - } - } - - @Test - public void testContentTypeIsJson() { - Assert.assertTrue(ContentTypeDetector.contentTypeIsJson("application/json")); - Assert.assertTrue(ContentTypeDetector.contentTypeIsJson("application/json; charset=UTF-8")); - Assert.assertTrue(ContentTypeDetector.contentTypeIsJson("application/json-patch+json")); - Assert.assertTrue(ContentTypeDetector.contentTypeIsJson("application/geo+json")); - - Assert.assertFalse(ContentTypeDetector.contentTypeIsJson("application/octet-stream")); - Assert.assertFalse(ContentTypeDetector.contentTypeIsJson("text/plain")); - } - - static final class StringSubscriber implements Flow.Subscriber { - final HttpResponse.BodySubscriber wrapped; - StringSubscriber(HttpResponse.BodySubscriber wrapped) { - this.wrapped = wrapped; - } - @Override - public void onSubscribe(Flow.Subscription subscription) { - wrapped.onSubscribe(subscription); - } - @Override - public void onNext(ByteBuffer item) { wrapped.onNext(List.of(item)); } - @Override - public void onError(Throwable throwable) { wrapped.onError(throwable); } - @Override - public void onComplete() { wrapped.onComplete(); } - } - - private String getJsonBody(SerializedRequestBody requestBody) { - var bodySubscriber = HttpResponse.BodySubscribers.ofString(StandardCharsets.UTF_8); - var flowSubscriber = new StringSubscriber(bodySubscriber); - requestBody.bodyPublisher.subscribe(flowSubscriber); - return bodySubscriber.getBody().toCompletableFuture().join(); - } - - @Test - public void testSerializeApplicationJson() throws ValidationException, NotImplementedException { - SchemaConfiguration configuration = new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().build()); - var serializer = new MyRequestBodySerializer(); - String jsonBody; - SerializedRequestBody requestBody = serializer.serialize( - new ApplicationjsonRequestBody( - AnyTypeJsonSchema.AnyTypeJsonSchema1.getInstance().validateAndBox(1, configuration) - ) - ); - Assert.assertEquals("application/json", requestBody.contentType); - jsonBody = getJsonBody(requestBody); - Assert.assertEquals(jsonBody, "1"); - - requestBody = serializer.serialize( - new ApplicationjsonRequestBody( - AnyTypeJsonSchema.AnyTypeJsonSchema1.getInstance().validateAndBox(3.14, configuration) - ) - ); - jsonBody = getJsonBody(requestBody); - Assert.assertEquals(jsonBody, "3.14"); - - requestBody = serializer.serialize( - new ApplicationjsonRequestBody( - AnyTypeJsonSchema.AnyTypeJsonSchema1.getInstance().validateAndBox((Nothing?) null, configuration) - ) - ); - jsonBody = getJsonBody(requestBody); - Assert.assertEquals(jsonBody, "null"); - - requestBody = serializer.serialize( - new ApplicationjsonRequestBody( - AnyTypeJsonSchema.AnyTypeJsonSchema1.getInstance().validateAndBox(true, configuration) - ) - ); - jsonBody = getJsonBody(requestBody); - Assert.assertEquals(jsonBody, "true"); - - requestBody = serializer.serialize( - new ApplicationjsonRequestBody( - AnyTypeJsonSchema.AnyTypeJsonSchema1.getInstance().validateAndBox(false, configuration) - ) - ); - jsonBody = getJsonBody(requestBody); - Assert.assertEquals(jsonBody, "false"); - - requestBody = serializer.serialize( - new ApplicationjsonRequestBody( - AnyTypeJsonSchema.AnyTypeJsonSchema1.getInstance().validateAndBox(List.of(), configuration) - ) - ); - jsonBody = getJsonBody(requestBody); - Assert.assertEquals(jsonBody, "[]"); - - requestBody = serializer.serialize( - new ApplicationjsonRequestBody( - AnyTypeJsonSchema.AnyTypeJsonSchema1.getInstance().validateAndBox(Map.of(), configuration) - ) - ); - jsonBody = getJsonBody(requestBody); - Assert.assertEquals(jsonBody, "{}"); - - requestBody = serializer.serialize( - new ApplicationjsonRequestBody( - AnyTypeJsonSchema.AnyTypeJsonSchema1.getInstance().validateAndBox(Map.of("k1", "v1", "k2", "v2"), configuration) - ) - ); - jsonBody = getJsonBody(requestBody); - Assert.assertEquals(jsonBody, "{\"k2\":\"v2\",\"k1\":\"v1\"}"); - } - - @Test - public void testSerializeTextPlain() throws ValidationException, NotImplementedException { - SchemaConfiguration configuration = new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().build()); - var serializer = new MyRequestBodySerializer(); - SerializedRequestBody requestBody = serializer.serialize( - new TextplainRequestBody( - StringJsonSchema.StringJsonSchema1.getInstance().validateAndBox("a", configuration) - ) - ); - Assert.assertEquals("text/plain", requestBody.contentType); - String textBody = getJsonBody(requestBody); - Assert.assertEquals(textBody, "a"); - } -} \ No newline at end of file diff --git a/samples/client/petstore/kotlin/src/test/kotlin/org/openapijsonschematools/client/response/ResponseDeserializerTest.kt b/samples/client/petstore/kotlin/src/test/kotlin/org/openapijsonschematools/client/response/ResponseDeserializerTest.kt deleted file mode 100644 index 50c9678a4a1..00000000000 --- a/samples/client/petstore/kotlin/src/test/kotlin/org/openapijsonschematools/client/response/ResponseDeserializerTest.kt +++ /dev/null @@ -1,248 +0,0 @@ -package org.openapijsonschematools.client.response; - -import com.google.gson.Gson; -import com.google.gson.GsonBuilder; -import com.google.gson.ToNumberPolicy; -import org.checkerframework.checker.nullness.qual.Nullable; -import org.junit.Assert; -import org.junit.Test; -import 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; - -import javax.net.ssl.SSLSession; -import java.net.URI; -import java.net.http.HttpClient; -import java.net.http.HttpHeaders; -import java.net.http.HttpRequest; -import java.net.http.HttpResponse; -import java.nio.charset.StandardCharsets; -import java.util.List; -import java.util.Map; -import java.util.Optional; -import java.util.function.BiPredicate; - -public class ResponseDeserializerTest { - private static final Gson gson = new GsonBuilder() - .setObjectToNumberStrategy(ToNumberPolicy.LONG_OR_DOUBLE) - .setNumberToNumberStrategy(ToNumberPolicy.LONG_OR_DOUBLE) - .create(); - public sealed interface SealedResponseBody permits ApplicationjsonBody, TextplainBody { } - - public record ApplicationjsonBody(AnyTypeJsonSchema.AnyTypeJsonSchema1Boxed body) implements SealedResponseBody { } - - public record TextplainBody(StringJsonSchema.StringJsonSchema1Boxed body) implements SealedResponseBody {} - - public sealed interface SealedMediaType permits ApplicationjsonMediatype, TextplainMediatype { } - - public record ApplicationjsonMediatype(AnyTypeJsonSchema.AnyTypeJsonSchema1 schema) implements SealedMediaType, MediaType { - public ApplicationjsonMediatype() { - this(AnyTypeJsonSchema.AnyTypeJsonSchema1.getInstance()); - } - @Override - public Nothing? encoding() { - return null; - } - } - - public record TextplainMediatype(StringJsonSchema.StringJsonSchema1 schema) implements SealedMediaType, MediaType { - public TextplainMediatype() { - this(StringJsonSchema.StringJsonSchema1.getInstance()); - } - @Override - public Nothing? encoding() { - return null; - } - } - - public static class MyResponseDeserializer extends ResponseDeserializer { - - public MyResponseDeserializer() { - super(Map.of("application/json", new ApplicationjsonMediatype(), "text/plain", new TextplainMediatype())); - } - - @Override - protected SealedResponseBody getBody(String contentType, SealedMediaType mediaType, byte[] body, SchemaConfiguration configuration) throws ValidationException, NotImplementedException { - if (mediaType instanceof ApplicationjsonMediatype thisMediaType) { - var deserializedBody = deserializeBody(contentType, body, thisMediaType.schema(), configuration); - return new ApplicationjsonBody(deserializedBody); - } else { - TextplainMediatype thisMediaType = (TextplainMediatype) mediaType; - var deserializedBody = deserializeBody(contentType, body, thisMediaType.schema(), configuration); - return new TextplainBody(deserializedBody); - } - } - - @Override - protected Nothing? getHeaders(HttpHeaders headers, SchemaConfiguration configuration) { - return null; - } - } - - public static class BytesHttpResponse implements HttpResponse { - private final byte[] body; - private final HttpHeaders headers; - private final HttpRequest request; - private final URI uri; - private final HttpClient.Version version; - public BytesHttpResponse(byte[] body, String contentType) { - this.body = body; - BiPredicate headerFilter = (key, val) -> true; - headers = HttpHeaders.of(Map.of("Content-Type", List.of(contentType)), headerFilter); - uri = URI.create("https://abc.com/"); - request = HttpRequest.newBuilder().uri(uri).build(); - version = HttpClient.Version.HTTP_2; - } - - @Override - public int statusCode() { - return 202; - } - - @Override - public HttpRequest request() { - return request; - } - - @Override - public Optional> previousResponse() { - return Optional.empty(); - } - - @Override - public HttpHeaders headers() { - return headers; - } - - @Override - public byte[] body() { - return body; - } - - @Override - public Optional sslSession() { - return Optional.empty(); - } - - @Override - public URI uri() { - return uri; - } - - @Override - public HttpClient.Version version() { - return version; - } - } - - @SuppressWarnings("nullness") - private String toJson(@Nullable Object body) { - return gson.toJson(body); - } - - @SuppressWarnings("nullness") - private void assertNull(@Nullable Object object) { - Assert.assertNull(object); - } - - @Test - public void testDeserializeApplicationJsonNull() throws ValidationException, ApiException, NotImplementedException { - var deserializer = new MyResponseDeserializer(); - byte[] bodyBytes = toJson(null).getBytes(StandardCharsets.UTF_8); - BytesHttpResponse response = new BytesHttpResponse(bodyBytes, "application/json"); - SchemaConfiguration configuration = new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().build()); - DeserializedHttpResponse apiResponse = deserializer.deserialize(response, configuration); - if (!(apiResponse.body() instanceof ApplicationjsonBody jsonBody)) { - throw new RuntimeException("body must be type ApplicationjsonBody"); - } - if (!(jsonBody.body() instanceof AnyTypeJsonSchema.AnyTypeJsonSchema1BoxedVoid boxedVoid)) { - throw new RuntimeException("body must be type AnyTypeJsonSchema1BoxedVoid"); - } - assertNull(boxedVoid.data()); - } - - @Test - public void testDeserializeApplicationJsonTrue() throws ValidationException, ApiException, NotImplementedException { - var deserializer = new MyResponseDeserializer(); - byte[] bodyBytes = toJson(true).getBytes(StandardCharsets.UTF_8); - BytesHttpResponse response = new BytesHttpResponse(bodyBytes, "application/json"); - SchemaConfiguration configuration = new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().build()); - DeserializedHttpResponse apiResponse = deserializer.deserialize(response, configuration); - if (!(apiResponse.body() instanceof ApplicationjsonBody jsonBody)) { - throw new RuntimeException("body must be type ApplicationjsonBody"); - } - if (!(jsonBody.body() instanceof AnyTypeJsonSchema.AnyTypeJsonSchema1BoxedBoolean boxedBoolean)) { - throw new RuntimeException("body must be type AnyTypeJsonSchema1BoxedBoolean"); - } - Assert.assertTrue(boxedBoolean.data()); - } - - @Test - public void testDeserializeApplicationJsonFalse() throws ValidationException, ApiException, NotImplementedException { - var deserializer = new MyResponseDeserializer(); - byte[] bodyBytes = toJson(false).getBytes(StandardCharsets.UTF_8); - BytesHttpResponse response = new BytesHttpResponse(bodyBytes, "application/json"); - SchemaConfiguration configuration = new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().build()); - DeserializedHttpResponse apiResponse = deserializer.deserialize(response, configuration); - if (!(apiResponse.body() instanceof ApplicationjsonBody jsonBody)) { - throw new RuntimeException("body must be type ApplicationjsonBody"); - } - if (!(jsonBody.body() instanceof AnyTypeJsonSchema.AnyTypeJsonSchema1BoxedBoolean boxedBoolean)) { - throw new RuntimeException("body must be type AnyTypeJsonSchema1BoxedBoolean"); - } - Assert.assertFalse(boxedBoolean.data()); - } - - @Test - public void testDeserializeApplicationJsonInt() throws ValidationException, ApiException, NotImplementedException { - var deserializer = new MyResponseDeserializer(); - byte[] bodyBytes = toJson(1).getBytes(StandardCharsets.UTF_8); - BytesHttpResponse response = new BytesHttpResponse(bodyBytes, "application/json"); - SchemaConfiguration configuration = new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().build()); - DeserializedHttpResponse apiResponse = deserializer.deserialize(response, configuration); - if (!(apiResponse.body() instanceof ApplicationjsonBody jsonBody)) { - throw new RuntimeException("body must be type ApplicationjsonBody"); - } - if (!(jsonBody.body() instanceof AnyTypeJsonSchema.AnyTypeJsonSchema1BoxedNumber boxedNumber)) { - throw new RuntimeException("body must be type AnyTypeJsonSchema1BoxedNumber"); - } - Assert.assertEquals(boxedNumber.data(), 1L); - } - - @Test - public void testDeserializeApplicationJsonFloat() throws ValidationException, ApiException, NotImplementedException { - var deserializer = new MyResponseDeserializer(); - byte[] bodyBytes = toJson(3.14).getBytes(StandardCharsets.UTF_8); - BytesHttpResponse response = new BytesHttpResponse(bodyBytes, "application/json"); - SchemaConfiguration configuration = new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().build()); - DeserializedHttpResponse apiResponse = deserializer.deserialize(response, configuration); - if (!(apiResponse.body() instanceof ApplicationjsonBody jsonBody)) { - throw new RuntimeException("body must be type ApplicationjsonBody"); - } - if (!(jsonBody.body() instanceof AnyTypeJsonSchema.AnyTypeJsonSchema1BoxedNumber boxedNumber)) { - throw new RuntimeException("body must be type AnyTypeJsonSchema1BoxedNumber"); - } - Assert.assertEquals(boxedNumber.data(), 3.14); - } - - @Test - public void testDeserializeApplicationJsonString() throws ValidationException, ApiException, NotImplementedException { - var deserializer = new MyResponseDeserializer(); - byte[] bodyBytes = toJson("a").getBytes(StandardCharsets.UTF_8); - BytesHttpResponse response = new BytesHttpResponse(bodyBytes, "application/json"); - SchemaConfiguration configuration = new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().build()); - DeserializedHttpResponse apiResponse = deserializer.deserialize(response, configuration); - if (!(apiResponse.body() instanceof ApplicationjsonBody jsonBody)) { - throw new RuntimeException("body must be type ApplicationjsonBody"); - } - if (!(jsonBody.body() instanceof AnyTypeJsonSchema.AnyTypeJsonSchema1BoxedString boxedString)) { - throw new RuntimeException("body must be type AnyTypeJsonSchema1BoxedString"); - } - Assert.assertEquals(boxedString.data(), "a"); - } -} \ No newline at end of file diff --git a/samples/client/petstore/kotlin/src/test/kotlin/org/openapijsonschematools/client/schemas/AnyTypeSchemaTest.kt b/samples/client/petstore/kotlin/src/test/kotlin/org/openapijsonschematools/client/schemas/AnyTypeSchemaTest.kt deleted file mode 100644 index 709c50913f1..00000000000 --- a/samples/client/petstore/kotlin/src/test/kotlin/org/openapijsonschematools/client/schemas/AnyTypeSchemaTest.kt +++ /dev/null @@ -1,106 +0,0 @@ -package org.openapijsonschematools.client.schemas; - -import org.checkerframework.checker.nullness.qual.Nullable; -import org.junit.Assert; -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; - -import java.time.LocalDate; -import java.time.ZoneId; -import java.time.ZonedDateTime; -import java.util.ArrayList; -import java.util.LinkedHashMap; - - -public class AnyTypeSchemaTest { - static final AnyTypeJsonSchema.AnyTypeJsonSchema1 schema = AnyTypeJsonSchema.AnyTypeJsonSchema1.getInstance(); - static final SchemaConfiguration configuration = new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().build()); - - @SuppressWarnings("nullness") - private Nothing? assertNull(@Nullable Object object) { - Assert.assertNull(object); - return null; - } - - @Test - public void testValidateNull() throws ValidationException { - Nothing? validatedValue = schema.validate((Nothing?) null, configuration); - assertNull(validatedValue); - } - - @Test - public void testValidateBoolean() throws ValidationException { - boolean trueValue = schema.validate(true, configuration); - Assert.assertTrue(trueValue); - - boolean falseValue = schema.validate(false, configuration); - Assert.assertFalse(falseValue); - } - - @Test - public void testValidateInteger() throws ValidationException { - int validatedValue = schema.validate(1, configuration); - Assert.assertEquals(validatedValue, 1); - } - - @Test - public void testValidateLong() throws ValidationException { - long validatedValue = schema.validate(1L, configuration); - Assert.assertEquals(validatedValue, 1L); - } - - @Test - 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 { - double validatedValue = schema.validate(70.6458763d, configuration); - Assert.assertEquals(Double.compare(validatedValue, 70.6458763d), 0); - } - - @Test - public void testValidateString() throws ValidationException { - String validatedValue = schema.validate("a", configuration); - Assert.assertEquals(validatedValue, "a"); - } - - @Test - 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 { - String validatedValue = schema.validate(LocalDate.of(2017, 7, 21), configuration); - Assert.assertEquals(validatedValue, "2017-07-21"); - } - - @Test - public void testValidateMap() throws ValidationException { - LinkedHashMap inMap = new LinkedHashMap<>(); - inMap.put("today", LocalDate.of(2017, 7, 21)); - FrozenMap validatedValue = schema.validate(inMap, configuration); - LinkedHashMap outMap = new LinkedHashMap<>(); - outMap.put("today", "2017-07-21"); - Assert.assertEquals(validatedValue, outMap); - } - - @Test - public void testValidateList() throws ValidationException { - ArrayList inList = new ArrayList<>(); - inList.add(LocalDate.of(2017, 7, 21)); - FrozenList validatedValue = schema.validate(inList, configuration); - ArrayList outList = new ArrayList<>(); - outList.add( "2017-07-21"); - Assert.assertEquals(validatedValue, outList); - } -} - diff --git a/samples/client/petstore/kotlin/src/test/kotlin/org/openapijsonschematools/client/schemas/ArrayTypeSchemaTest.kt b/samples/client/petstore/kotlin/src/test/kotlin/org/openapijsonschematools/client/schemas/ArrayTypeSchemaTest.kt deleted file mode 100644 index aea7234faae..00000000000 --- a/samples/client/petstore/kotlin/src/test/kotlin/org/openapijsonschematools/client/schemas/ArrayTypeSchemaTest.kt +++ /dev/null @@ -1,252 +0,0 @@ -package org.openapijsonschematools.client.schemas; - -import org.checkerframework.checker.nullness.qual.Nullable; -import org.junit.Assert; -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.JsonSchemaInfo; -import org.openapijsonschematools.client.schemas.validation.FrozenList; -import org.openapijsonschematools.client.schemas.validation.PathToSchemasMap; -import org.openapijsonschematools.client.schemas.validation.ListSchemaValidator; -import org.openapijsonschematools.client.schemas.validation.ValidationMetadata; - -import java.util.ArrayList; -import java.util.HashSet; -import java.util.LinkedHashMap; -import java.util.LinkedHashSet; -import java.util.List; -import java.util.Objects; -import java.util.Set; - -public class ArrayTypeSchemaTest { - static final SchemaConfiguration configuration = new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().build()); - static final ValidationMetadata validationMetadata = new ValidationMetadata( - List.of("args[0"), - configuration, - new PathToSchemasMap(), - new LinkedHashSet<>() - ); - - public sealed interface ArrayWithItemsSchemaBoxed permits ArrayWithItemsSchemaBoxedList { - } - public record ArrayWithItemsSchemaBoxedList(FrozenList data) implements ArrayWithItemsSchemaBoxed { - } - - public static class ArrayWithItemsSchema extends JsonSchema implements ListSchemaValidator, ArrayWithItemsSchemaBoxedList> { - public ArrayWithItemsSchema() { - super(new JsonSchemaInfo() - .type(Set.of(List.class)) - .items(StringJsonSchema.StringJsonSchema1.class) - ); - } - - @Override - public FrozenList getNewInstance(List arg, List pathToItem, PathToSchemasMap pathToSchemas) { - List items = new ArrayList<>(); - int i = 0; - for (Object item: arg) { - List itemPathToItem = new ArrayList<>(pathToItem); - itemPathToItem.add(i); - LinkedHashMap, Nothing?> schemas = pathToSchemas.get(itemPathToItem); - if (schemas == null) { - 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 RuntimeException("Instantiated type of item is invalid"); - } - items.add((String) castItem); - i += 1; - } - return new FrozenList<>(items); - } - - 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); - SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().build())); - ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, new PathToSchemasMap(), new LinkedHashSet<>()); - PathToSchemasMap pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet); - return getNewInstance(castArg, validationMetadata.pathToItem(), pathToSchemasMap); - } - - @Override - public ArrayWithItemsSchemaBoxedList validateAndBox(List arg, SchemaConfiguration configuration) throws ValidationException { - return new ArrayWithItemsSchemaBoxedList(validate(arg, configuration)); - } - - @Override - public Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { - 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"); - } - - @Override - public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws 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"); - } - - @Override - public ArrayWithItemsSchemaBoxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws 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"); - } - } - - public static class ArrayWithOutputClsSchemaList extends FrozenList { - protected ArrayWithOutputClsSchemaList(FrozenList m) { - super(m); - } - - public static ArrayWithOutputClsSchemaList of(List arg, SchemaConfiguration configuration) throws ValidationException { - return new ArrayWithOutputClsSchema().validate(arg, configuration); - } - } - - public sealed interface ArrayWithOutputClsSchemaBoxed permits ArrayWithOutputClsSchemaBoxedList { - } - public record ArrayWithOutputClsSchemaBoxedList(ArrayWithOutputClsSchemaList data) implements ArrayWithOutputClsSchemaBoxed { - } - public static class ArrayWithOutputClsSchema extends JsonSchema implements ListSchemaValidator { - public ArrayWithOutputClsSchema() { - super(new JsonSchemaInfo() - .type(Set.of(List.class)) - .items(StringJsonSchema.StringJsonSchema1.class) - ); - - } - - @Override - public ArrayWithOutputClsSchemaList getNewInstance(List arg, List pathToItem, PathToSchemasMap pathToSchemas) { - List items = new ArrayList<>(); - int i = 0; - for (Object item: arg) { - List itemPathToItem = new ArrayList<>(pathToItem); - itemPathToItem.add(i); - LinkedHashMap, Nothing?> schemas = pathToSchemas.get(itemPathToItem); - if (schemas == null) { - 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 RuntimeException("Instantiated type of item is invalid"); - } - items.add((String) castItem); - i += 1; - } - FrozenList newInstanceItems = new FrozenList<>(items); - return new ArrayWithOutputClsSchemaList(newInstanceItems); - } - - 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); - SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().build())); - ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, new PathToSchemasMap(), new LinkedHashSet<>()); - PathToSchemasMap pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet); - return getNewInstance(castArg, validationMetadata.pathToItem(), pathToSchemasMap); - } - - @Override - public ArrayWithOutputClsSchemaBoxedList validateAndBox(List arg, SchemaConfiguration configuration) throws ValidationException { - return new ArrayWithOutputClsSchemaBoxedList(validate(arg, configuration)); - } - - @Override - public Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { - 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"); - } - - @Override - public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws 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"); - } - - @Override - public ArrayWithOutputClsSchemaBoxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws 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"); - } - } - - @Test - public void testExceptionThrownForInvalidType() { - Assert.assertThrows(ValidationException.class, () -> JsonSchema.validate( - new ArrayWithItemsSchema(), - null, - validationMetadata - )); - } - - @Test - public void testValidateArrayWithItemsSchema() throws ValidationException { - // list with only item works - List inList = new ArrayList<>(); - inList.add("abc"); - FrozenList validatedValue = new ArrayWithItemsSchema().validate(inList, configuration); - List outList = new ArrayList<>(); - outList.add("abc"); - Assert.assertEquals(validatedValue, outList); - - // list with no items works - inList = new ArrayList<>(); - validatedValue = new ArrayWithItemsSchema().validate(inList, configuration); - outList = new ArrayList<>(); - Assert.assertEquals(validatedValue, outList); - - // invalid item type fails - List intList = List.of(1); - Assert.assertThrows(ValidationException.class, () -> JsonSchema.validate( - new ArrayWithItemsSchema(), - intList, - validationMetadata - )); - } - - @Test - public void testValidateArrayWithOutputClsSchema() throws ValidationException { - // list with only item works - List inList = new ArrayList<>(); - inList.add("abc"); - ArrayWithOutputClsSchemaList validatedValue = new ArrayWithOutputClsSchema().validate(inList, configuration); - List outList = new ArrayList<>(); - outList.add("abc"); - Assert.assertEquals(validatedValue, outList); - - // list with no items works - inList = new ArrayList<>(); - validatedValue = new ArrayWithOutputClsSchema().validate(inList, configuration); - outList = new ArrayList<>(); - Assert.assertEquals(validatedValue, outList); - - // invalid item type fails - List intList = List.of(1); - Assert.assertThrows(ValidationException.class, () -> JsonSchema.validate( - new ArrayWithOutputClsSchema(), - intList, - validationMetadata - )); - } -} \ No newline at end of file diff --git a/samples/client/petstore/kotlin/src/test/kotlin/org/openapijsonschematools/client/schemas/BooleanSchemaTest.kt b/samples/client/petstore/kotlin/src/test/kotlin/org/openapijsonschematools/client/schemas/BooleanSchemaTest.kt deleted file mode 100644 index d2990773fa7..00000000000 --- a/samples/client/petstore/kotlin/src/test/kotlin/org/openapijsonschematools/client/schemas/BooleanSchemaTest.kt +++ /dev/null @@ -1,45 +0,0 @@ -package org.openapijsonschematools.client.schemas; - -import org.junit.Assert; -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.PathToSchemasMap; -import org.openapijsonschematools.client.schemas.validation.ValidationMetadata; - -import java.util.LinkedHashSet; -import java.util.List; - -public class BooleanSchemaTest { - static final SchemaConfiguration configuration = new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().build()); - static final BooleanJsonSchema.BooleanJsonSchema1 booleanJsonSchema = BooleanJsonSchema.BooleanJsonSchema1.getInstance(); - static final ValidationMetadata validationMetadata = new ValidationMetadata( - List.of("args[0"), - configuration, - new PathToSchemasMap(), - new LinkedHashSet<>() - ); - - @Test - public void testValidateTrue() throws ValidationException { - boolean validatedValue = booleanJsonSchema.validate(true, configuration); - Assert.assertTrue(validatedValue); - } - - @Test - public void testValidateFalse() throws ValidationException { - boolean validatedValue = booleanJsonSchema.validate(false, configuration); - Assert.assertFalse(validatedValue); - } - - @Test - public void testExceptionThrownForInvalidType() { - Assert.assertThrows(ValidationException.class, () -> JsonSchema.validate( - booleanJsonSchema, - null, - validationMetadata - )); - } -} diff --git a/samples/client/petstore/kotlin/src/test/kotlin/org/openapijsonschematools/client/schemas/ListBuilderTest.kt b/samples/client/petstore/kotlin/src/test/kotlin/org/openapijsonschematools/client/schemas/ListBuilderTest.kt deleted file mode 100644 index 77fd8882ee5..00000000000 --- a/samples/client/petstore/kotlin/src/test/kotlin/org/openapijsonschematools/client/schemas/ListBuilderTest.kt +++ /dev/null @@ -1,61 +0,0 @@ -package org.openapijsonschematools.client.schemas; - -import org.checkerframework.checker.nullness.qual.Nullable; -import org.junit.Assert; -import org.junit.Test; - -import java.util.ArrayList; -import java.util.List; - -public class ListBuilderTest { - public static class NullableListWithNullableItemsListBuilder { - // class to build List<@Nullable List> - private final List<@Nullable List> list; - - public NullableListWithNullableItemsListBuilder() { - list = new ArrayList<>(); - } - - public NullableListWithNullableItemsListBuilder(List<@Nullable List> list) { - this.list = list; - } - - public NullableListWithNullableItemsListBuilder add(Nothing? item) { - list.add(null); - return this; - } - - public NullableListWithNullableItemsListBuilder add(List item) { - list.add(item); - return this; - } - - public List<@Nullable List> build() { - return list; - } - } - - @Test - public void testSucceedsWithNullInput() { - List<@Nullable List> inList = new ArrayList<>(); - inList.add(null); - var builder = new NullableListWithNullableItemsListBuilder(inList); - Assert.assertEquals(inList, builder.build()); - - builder = new NullableListWithNullableItemsListBuilder(); - builder.add((Nothing?) null); - Assert.assertEquals(inList, builder.build()); - } - - @Test - public void testSucceedsWithNonNullInput() { - List<@Nullable List> inList = new ArrayList<>(); - inList.add(List.of(1)); - var builder = new NullableListWithNullableItemsListBuilder(inList); - Assert.assertEquals(inList, builder.build()); - - builder = new NullableListWithNullableItemsListBuilder(); - builder.add(List.of(1)); - Assert.assertEquals(inList, builder.build()); - } -} \ No newline at end of file diff --git a/samples/client/petstore/kotlin/src/test/kotlin/org/openapijsonschematools/client/schemas/ListSchemaTest.kt b/samples/client/petstore/kotlin/src/test/kotlin/org/openapijsonschematools/client/schemas/ListSchemaTest.kt deleted file mode 100644 index 15967a549cc..00000000000 --- a/samples/client/petstore/kotlin/src/test/kotlin/org/openapijsonschematools/client/schemas/ListSchemaTest.kt +++ /dev/null @@ -1,46 +0,0 @@ -package org.openapijsonschematools.client.schemas; - -import org.checkerframework.checker.nullness.qual.Nullable; -import org.junit.Assert; -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.schemas.validation.PathToSchemasMap; -import org.openapijsonschematools.client.schemas.validation.ValidationMetadata; - -import java.util.ArrayList; -import java.util.LinkedHashSet; -import java.util.List; - -public class ListSchemaTest { - static final SchemaConfiguration configuration = new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().build()); - static final ListJsonSchema.ListJsonSchema1 listJsonSchema = ListJsonSchema.ListJsonSchema1.getInstance(); - static final ValidationMetadata validationMetadata = new ValidationMetadata( - List.of("args[0"), - configuration, - new PathToSchemasMap(), - new LinkedHashSet<>() - ); - - @Test - public void testExceptionThrownForInvalidType() { - Assert.assertThrows(ValidationException.class, () -> JsonSchema.validate( - listJsonSchema, - null, - validationMetadata - )); - } - - @Test - public void testValidateList() throws ValidationException { - List inList = new ArrayList<>(); - inList.add("today"); - FrozenList<@Nullable Object> validatedValue = listJsonSchema.validate(inList, configuration); - ArrayList outList = new ArrayList<>(); - outList.add("today"); - Assert.assertEquals(validatedValue, outList); - } -} diff --git a/samples/client/petstore/kotlin/src/test/kotlin/org/openapijsonschematools/client/schemas/MapSchemaTest.kt b/samples/client/petstore/kotlin/src/test/kotlin/org/openapijsonschematools/client/schemas/MapSchemaTest.kt deleted file mode 100644 index 68c00adfc8e..00000000000 --- a/samples/client/petstore/kotlin/src/test/kotlin/org/openapijsonschematools/client/schemas/MapSchemaTest.kt +++ /dev/null @@ -1,48 +0,0 @@ -package org.openapijsonschematools.client.schemas; - -import org.checkerframework.checker.nullness.qual.Nullable; -import org.junit.Assert; -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.schemas.validation.PathToSchemasMap; -import org.openapijsonschematools.client.schemas.validation.ValidationMetadata; - -import java.time.LocalDate; -import java.util.LinkedHashMap; -import java.util.LinkedHashSet; -import java.util.List; -import java.util.Map; - -public class MapSchemaTest { - static final SchemaConfiguration configuration = new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().build()); - static final MapJsonSchema.MapJsonSchema1 mapJsonSchema = MapJsonSchema.MapJsonSchema1.getInstance(); - static final ValidationMetadata validationMetadata = new ValidationMetadata( - List.of("args[0"), - configuration, - new PathToSchemasMap(), - new LinkedHashSet<>() - ); - - @Test - public void testExceptionThrownForInvalidType() { - Assert.assertThrows(ValidationException.class, () -> JsonSchema.validate( - mapJsonSchema, - null, - validationMetadata - )); - } - - @Test - 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); - LinkedHashMap outMap = new LinkedHashMap<>(); - outMap.put("today", "2017-07-21"); - Assert.assertEquals(validatedValue, outMap); - } -} diff --git a/samples/client/petstore/kotlin/src/test/kotlin/org/openapijsonschematools/client/schemas/NullSchemaTest.kt b/samples/client/petstore/kotlin/src/test/kotlin/org/openapijsonschematools/client/schemas/NullSchemaTest.kt deleted file mode 100644 index d3a6d83ffc4..00000000000 --- a/samples/client/petstore/kotlin/src/test/kotlin/org/openapijsonschematools/client/schemas/NullSchemaTest.kt +++ /dev/null @@ -1,41 +0,0 @@ -package org.openapijsonschematools.client.schemas; - -import org.junit.Assert; -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.PathToSchemasMap; -import org.openapijsonschematools.client.schemas.validation.ValidationMetadata; - -import java.util.LinkedHashSet; -import java.util.List; - -public class NullSchemaTest { - static final SchemaConfiguration configuration = new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().build()); - static final NullJsonSchema.NullJsonSchema1 nullJsonSchema = NullJsonSchema.NullJsonSchema1.getInstance(); - static final ValidationMetadata validationMetadata = new ValidationMetadata( - List.of("args[0"), - configuration, - new PathToSchemasMap(), - new LinkedHashSet<>() - ); - - - @Test - @SuppressWarnings("nullness") - public void testValidateNull() throws ValidationException { - Nothing? validatedValue = nullJsonSchema.validate(null, configuration); - Assert.assertNull(validatedValue); - } - - @Test - public void testExceptionThrownForInvalidType() { - Assert.assertThrows(ValidationException.class, () -> JsonSchema.validate( - nullJsonSchema, - Boolean.TRUE, - validationMetadata - )); - } -} diff --git a/samples/client/petstore/kotlin/src/test/kotlin/org/openapijsonschematools/client/schemas/NumberSchemaTest.kt b/samples/client/petstore/kotlin/src/test/kotlin/org/openapijsonschematools/client/schemas/NumberSchemaTest.kt deleted file mode 100644 index 46e3454809f..00000000000 --- a/samples/client/petstore/kotlin/src/test/kotlin/org/openapijsonschematools/client/schemas/NumberSchemaTest.kt +++ /dev/null @@ -1,57 +0,0 @@ -package org.openapijsonschematools.client.schemas; - -import org.junit.Assert; -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.PathToSchemasMap; -import org.openapijsonschematools.client.schemas.validation.ValidationMetadata; - -import java.util.LinkedHashSet; -import java.util.List; - -public class NumberSchemaTest { - static final SchemaConfiguration configuration = new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().build()); - static final NumberJsonSchema.NumberJsonSchema1 numberJsonSchema = NumberJsonSchema.NumberJsonSchema1.getInstance(); - static final ValidationMetadata validationMetadata = new ValidationMetadata( - List.of("args[0"), - configuration, - new PathToSchemasMap(), - new LinkedHashSet<>() - ); - - @Test - public void testValidateInteger() throws ValidationException { - int validatedValue = numberJsonSchema.validate(1, configuration); - Assert.assertEquals(validatedValue, 1); - } - - @Test - public void testValidateLong() throws ValidationException { - long validatedValue = numberJsonSchema.validate(1L, configuration); - Assert.assertEquals(validatedValue, 1L); - } - - @Test - 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 { - double validatedValue = numberJsonSchema.validate(3.14d, configuration); - Assert.assertEquals(Double.compare(validatedValue, 3.14d), 0); - } - - @Test - public void testExceptionThrownForInvalidType() { - Assert.assertThrows(ValidationException.class, () -> JsonSchema.validate( - numberJsonSchema, - null, - validationMetadata - )); - } -} diff --git a/samples/client/petstore/kotlin/src/test/kotlin/org/openapijsonschematools/client/schemas/ObjectTypeSchemaTest.kt b/samples/client/petstore/kotlin/src/test/kotlin/org/openapijsonschematools/client/schemas/ObjectTypeSchemaTest.kt deleted file mode 100644 index 91f322dfc93..00000000000 --- a/samples/client/petstore/kotlin/src/test/kotlin/org/openapijsonschematools/client/schemas/ObjectTypeSchemaTest.kt +++ /dev/null @@ -1,538 +0,0 @@ -package org.openapijsonschematools.client.schemas; - -import org.checkerframework.checker.nullness.qual.Nullable; -import org.junit.Assert; -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.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.schemas.validation.ValidationMetadata; - -import java.util.ArrayList; -import java.util.HashSet; -import java.util.LinkedHashMap; -import java.util.LinkedHashSet; -import java.util.List; -import java.util.Map; -import java.util.Objects; -import java.util.Set; - -public class ObjectTypeSchemaTest { - static final SchemaConfiguration configuration = new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().build()); - static final ValidationMetadata validationMetadata = new ValidationMetadata( - List.of("args[0"), - configuration, - new PathToSchemasMap(), - new LinkedHashSet<>() - ); - - public sealed interface ObjectWithPropsSchemaBoxed permits ObjectWithPropsSchemaBoxedMap { - } - public record ObjectWithPropsSchemaBoxedMap(FrozenMap<@Nullable Object> data) implements ObjectWithPropsSchemaBoxed { - } - public static class ObjectWithPropsSchema extends JsonSchema implements MapSchemaValidator, ObjectWithPropsSchemaBoxedMap> { - private static @Nullable ObjectWithPropsSchema instance = null; - private ObjectWithPropsSchema() { - super(new JsonSchemaInfo() - .type(Set.of(Map.class)) - .properties(Map.ofEntries( - new PropertyEntry("someString", StringJsonSchema.StringJsonSchema1.class) - )) - ); - - } - - public static ObjectWithPropsSchema getInstance() { - if (instance == null) { - instance = new ObjectWithPropsSchema(); - } - return instance; - } - - @Override - 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 RuntimeException("Invalid non-string key value"); - } - String propertyName = (String) entryKey; - List propertyPathToItem = new ArrayList<>(pathToItem); - propertyPathToItem.add(propertyName); - Object value = entry.getValue(); - LinkedHashMap, Nothing?> schemas = pathToSchemas.get(propertyPathToItem); - if (schemas == null) { - 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); - properties.put(propertyName, castValue); - } - return new FrozenMap<>(properties); - } - - public FrozenMap<@Nullable Object> validate(Map arg, SchemaConfiguration configuration) throws ValidationException { - Set> pathSet = new HashSet<>(); - List pathToItem = List.of("args[0"); - Map castArg = castToAllowedTypes(arg, pathToItem, pathSet); - SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().build())); - ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, new PathToSchemasMap(), new LinkedHashSet<>()); - PathToSchemasMap pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet); - return getNewInstance(castArg, validationMetadata.pathToItem(), pathToSchemasMap); - } - - @Override - public ObjectWithPropsSchemaBoxedMap validateAndBox(Map arg, SchemaConfiguration configuration) throws ValidationException { - return new ObjectWithPropsSchemaBoxedMap(validate(arg, configuration)); - } - - @Override - public Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { - if (arg instanceof Map) { - return getNewInstance((Map) arg, pathToItem, pathToSchemas); - } - 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 { - 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"); - } - - @Override - public ObjectWithPropsSchemaBoxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws 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"); - } - } - - public sealed interface ObjectWithAddpropsSchemaBoxed permits ObjectWithAddpropsSchemaBoxedMap { - } - public record ObjectWithAddpropsSchemaBoxedMap(FrozenMap data) implements ObjectWithAddpropsSchemaBoxed { - } - - public static class ObjectWithAddpropsSchema extends JsonSchema implements MapSchemaValidator, ObjectWithAddpropsSchemaBoxedMap> { - private static @Nullable ObjectWithAddpropsSchema instance = null; - private ObjectWithAddpropsSchema() { - super(new JsonSchemaInfo() - .type(Set.of(Map.class)) - .additionalProperties(StringJsonSchema.StringJsonSchema1.class) - ); - } - - public static ObjectWithAddpropsSchema getInstance() { - if (instance == null) { - instance = new ObjectWithAddpropsSchema(); - } - return instance; - } - - @Override - public FrozenMap 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 RuntimeException("Invalid non-string key value"); - } - String propertyName = (String) entryKey; - List propertyPathToItem = new ArrayList<>(pathToItem); - propertyPathToItem.add(propertyName); - Object value = entry.getValue(); - LinkedHashMap, Nothing?> schemas = pathToSchemas.get(propertyPathToItem); - if (schemas == null) { - 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 RuntimeException("Invalid type for property value"); - } - properties.put(propertyName, (String) castValue); - } - return new FrozenMap<>(properties); - } - - 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); - SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().build())); - ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, new PathToSchemasMap(), new LinkedHashSet<>()); - PathToSchemasMap pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet); - return getNewInstance(castArg, validationMetadata.pathToItem(), pathToSchemasMap); - } - - @Override - 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 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"); - } - - @Override - public ObjectWithAddpropsSchemaBoxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws 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"); - } - - @Override - public Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { - if (arg instanceof Map) { - return getNewInstance((Map) arg, pathToItem, pathToSchemas); - } - throw new RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); - } - } - - public sealed interface ObjectWithPropsAndAddpropsSchemaBoxed permits ObjectWithPropsAndAddpropsSchemaBoxedMap { - } - public record ObjectWithPropsAndAddpropsSchemaBoxedMap(FrozenMap<@Nullable Object> data) implements ObjectWithPropsAndAddpropsSchemaBoxed { - } - public static class ObjectWithPropsAndAddpropsSchema extends JsonSchema implements MapSchemaValidator, ObjectWithPropsAndAddpropsSchemaBoxedMap> { - private static @Nullable ObjectWithPropsAndAddpropsSchema instance = null; - private ObjectWithPropsAndAddpropsSchema() { - super(new JsonSchemaInfo() - .type(Set.of(Map.class)) - .properties(Map.ofEntries( - new PropertyEntry("someString", StringJsonSchema.StringJsonSchema1.class) - )) - .additionalProperties(BooleanJsonSchema.BooleanJsonSchema1.class) - ); - } - - public static ObjectWithPropsAndAddpropsSchema getInstance() { - if (instance == null) { - instance = new ObjectWithPropsAndAddpropsSchema(); - } - return instance; - } - - @Override - 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 RuntimeException("Invalid non-string key value"); - } - String propertyName = (String) entryKey; - List propertyPathToItem = new ArrayList<>(pathToItem); - propertyPathToItem.add(propertyName); - Object value = entry.getValue(); - LinkedHashMap, Nothing?> schemas = pathToSchemas.get(propertyPathToItem); - if (schemas == null) { - 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); - properties.put(propertyName, castValue); - } - return new FrozenMap<>(properties); - } - - public FrozenMap<@Nullable Object> validate(Map arg, SchemaConfiguration configuration) throws ValidationException { - Set> pathSet = new HashSet<>(); - List pathToItem = List.of("args[0"); - Map castArg = castToAllowedTypes(arg, pathToItem, pathSet); - SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().build())); - ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, new PathToSchemasMap(), new LinkedHashSet<>()); - PathToSchemasMap pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet); - return getNewInstance(castArg, validationMetadata.pathToItem(), pathToSchemasMap); - } - - @Override - 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 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"); - } - - @Override - public ObjectWithPropsAndAddpropsSchemaBoxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws 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"); - } - - @Override - public Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { - if (arg instanceof Map) { - return getNewInstance((Map) arg, pathToItem, pathToSchemas); - } - throw new RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); - } - } - - public static class ObjectWithOutputTypeSchemaMap extends FrozenMap<@Nullable Object> { - protected ObjectWithOutputTypeSchemaMap(FrozenMap<@Nullable Object> m) { - super(m); - } - - public static ObjectWithOutputTypeSchemaMap of(Map arg, SchemaConfiguration configuration) throws ValidationException { - return ObjectWithOutputTypeSchema.getInstance().validate(arg, configuration); - } - } - - public sealed interface ObjectWithOutputTypeSchemaBoxed permits ObjectWithOutputTypeSchemaBoxedMap { - } - public record ObjectWithOutputTypeSchemaBoxedMap(ObjectWithOutputTypeSchemaMap data) implements ObjectWithOutputTypeSchemaBoxed { - } - public static class ObjectWithOutputTypeSchema extends JsonSchema implements MapSchemaValidator { - private static @Nullable ObjectWithOutputTypeSchema instance = null; - public ObjectWithOutputTypeSchema() { - super(new JsonSchemaInfo() - .type(Set.of(Map.class)) - .properties(Map.ofEntries( - new PropertyEntry("someString", StringJsonSchema.StringJsonSchema1.class) - )) - ); - } - - public static ObjectWithOutputTypeSchema getInstance() { - if (instance == null) { - instance = new ObjectWithOutputTypeSchema(); - } - return instance; - } - - @Override - public ObjectWithOutputTypeSchemaMap 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 RuntimeException("Invalid non-string key value"); - } - String propertyName = (String) entryKey; - List propertyPathToItem = new ArrayList<>(pathToItem); - propertyPathToItem.add(propertyName); - Object value = entry.getValue(); - LinkedHashMap, Nothing?> schemas = pathToSchemas.get(propertyPathToItem); - if (schemas == null) { - 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); - properties.put(propertyName, castValue); - } - return new ObjectWithOutputTypeSchemaMap(new FrozenMap<>(properties)); - } - - 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); - SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().build())); - ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, new PathToSchemasMap(), new LinkedHashSet<>()); - PathToSchemasMap pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet); - return getNewInstance(castArg, validationMetadata.pathToItem(), pathToSchemasMap); - } - - @Override - 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 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"); - } - - @Override - public ObjectWithOutputTypeSchemaBoxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws 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"); - } - - @Override - public Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { - 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"); - } - } - - @Test - public void testExceptionThrownForInvalidType() { - ObjectWithPropsSchema schema = ObjectWithPropsSchema.getInstance(); - Assert.assertThrows(ValidationException.class, () -> JsonSchema.validate( - schema, - null, - validationMetadata - )); - } - - @Test - public void testValidateObjectWithPropsSchema() throws ValidationException { - ObjectWithPropsSchema schema = ObjectWithPropsSchema.getInstance(); - - // map with only property works - Map inMap = new LinkedHashMap<>(); - inMap.put("someString", "abc"); - FrozenMap<@Nullable Object> validatedValue = schema.validate(inMap, configuration); - LinkedHashMap outMap = new LinkedHashMap<>(); - outMap.put("someString", "abc"); - Assert.assertEquals(validatedValue, outMap); - - // map with additional unvalidated property works - inMap = new LinkedHashMap<>(); - inMap.put("someString", "abc"); - inMap.put("someOtherString", "def"); - validatedValue = schema.validate(inMap, configuration); - outMap = new LinkedHashMap<>(); - outMap.put("someString", "abc"); - outMap.put("someOtherString", "def"); - Assert.assertEquals(validatedValue, outMap); - - // invalid prop type fails - inMap = new LinkedHashMap<>(); - inMap.put("someString", 1); - Map finalInMap = inMap; - Assert.assertThrows(ValidationException.class, () -> schema.validate( - finalInMap, configuration - )); - } - - @Test - public void testValidateObjectWithAddpropsSchema() throws ValidationException { - ObjectWithAddpropsSchema schema = ObjectWithAddpropsSchema.getInstance(); - - // map with only property works - Map inMap = new LinkedHashMap<>(); - inMap.put("someString", "abc"); - FrozenMap validatedValue = schema.validate(inMap, configuration); - LinkedHashMap outMap = new LinkedHashMap<>(); - outMap.put("someString", "abc"); - Assert.assertEquals(validatedValue, outMap); - - // map with additional properties works - inMap = new LinkedHashMap<>(); - inMap.put("someString", "abc"); - inMap.put("someOtherString", "def"); - validatedValue = schema.validate(inMap, configuration); - outMap = new LinkedHashMap<>(); - outMap.put("someString", "abc"); - outMap.put("someOtherString", "def"); - Assert.assertEquals(validatedValue, outMap); - - // invalid addProp type fails - Map invalidInput = Map.of("someString", 1); - Assert.assertThrows(ValidationException.class, () -> JsonSchema.validate( - schema, - invalidInput, - validationMetadata - )); - } - - @Test - public void testValidateObjectWithPropsAndAddpropsSchema() throws ValidationException { - ObjectWithPropsAndAddpropsSchema schema = ObjectWithPropsAndAddpropsSchema.getInstance(); - - // map with only property works - Map inMap = new LinkedHashMap<>(); - inMap.put("someString", "abc"); - FrozenMap<@Nullable Object> validatedValue = schema.validate(inMap, configuration); - LinkedHashMap outMap = new LinkedHashMap<>(); - outMap.put("someString", "abc"); - Assert.assertEquals(validatedValue, outMap); - - // map with additional properties works - inMap = new LinkedHashMap<>(); - inMap.put("someString", "abc"); - inMap.put("someAddProp", true); - validatedValue = schema.validate(inMap, configuration); - outMap = new LinkedHashMap<>(); - outMap.put("someString", "abc"); - outMap.put("someAddProp", true); - Assert.assertEquals(validatedValue, outMap); - - // invalid prop type fails - inMap = new LinkedHashMap<>(); - inMap.put("someString", 1); - Map invalidPropMap = inMap; - Assert.assertThrows(ValidationException.class, () -> schema.validate( - invalidPropMap, configuration - )); - - // invalid addProp type fails - inMap = new LinkedHashMap<>(); - inMap.put("someAddProp", 1); - Map invalidAddpropMap = inMap; - Assert.assertThrows(ValidationException.class, () -> schema.validate( - invalidAddpropMap, configuration - )); - } - - @Test - public void testValidateObjectWithOutputTypeSchema() throws ValidationException { - ObjectWithOutputTypeSchema schema = ObjectWithOutputTypeSchema.getInstance(); - - // map with only property works - Map inMap = new LinkedHashMap<>(); - inMap.put("someString", "abc"); - ObjectWithOutputTypeSchemaMap validatedValue = schema.validate(inMap, configuration); - LinkedHashMap outMap = new LinkedHashMap<>(); - outMap.put("someString", "abc"); - Assert.assertEquals(validatedValue, outMap); - - // map with additional unvalidated property works - inMap = new LinkedHashMap<>(); - inMap.put("someString", "abc"); - inMap.put("someOtherString", "def"); - validatedValue = schema.validate(inMap, configuration); - outMap = new LinkedHashMap<>(); - outMap.put("someString", "abc"); - outMap.put("someOtherString", "def"); - Assert.assertEquals(validatedValue, outMap); - - // invalid prop type fails - inMap = new LinkedHashMap<>(); - inMap.put("someString", 1); - Map finalInMap = inMap; - Assert.assertThrows(ValidationException.class, () -> schema.validate( - finalInMap, configuration - )); - - // using output class directly works - inMap = new LinkedHashMap<>(); - inMap.put("someString", "abc"); - validatedValue = ObjectWithOutputTypeSchemaMap.of(inMap, configuration); - outMap = new LinkedHashMap<>(); - outMap.put("someString", "abc"); - Assert.assertEquals(validatedValue, outMap); - } -} diff --git a/samples/client/petstore/kotlin/src/test/kotlin/org/openapijsonschematools/client/schemas/RefBooleanSchemaTest.kt b/samples/client/petstore/kotlin/src/test/kotlin/org/openapijsonschematools/client/schemas/RefBooleanSchemaTest.kt deleted file mode 100644 index 23b73510e3f..00000000000 --- a/samples/client/petstore/kotlin/src/test/kotlin/org/openapijsonschematools/client/schemas/RefBooleanSchemaTest.kt +++ /dev/null @@ -1,49 +0,0 @@ -package org.openapijsonschematools.client.schemas; - -import org.junit.Assert; -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.PathToSchemasMap; -import org.openapijsonschematools.client.schemas.validation.ValidationMetadata; - -import java.util.LinkedHashSet; -import java.util.List; - -public class RefBooleanSchemaTest { - public static class RefBooleanSchema { - public static class RefBooleanSchema1 extends BooleanJsonSchema.BooleanJsonSchema1 {} - } - - static final SchemaConfiguration configuration = new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().build()); - static final BooleanJsonSchema.BooleanJsonSchema1 refBooleanJsonSchema = RefBooleanSchema.RefBooleanSchema1.getInstance(); - static final ValidationMetadata validationMetadata = new ValidationMetadata( - List.of("args[0"), - configuration, - new PathToSchemasMap(), - new LinkedHashSet<>() - ); - - @Test - public void testValidateTrue() throws ValidationException { - Boolean validatedValue = refBooleanJsonSchema.validate(true, configuration); - Assert.assertEquals(validatedValue, Boolean.TRUE); - } - - @Test - public void testValidateFalse() throws ValidationException { - Boolean validatedValue = refBooleanJsonSchema.validate(false, configuration); - Assert.assertEquals(validatedValue, Boolean.FALSE); - } - - @Test - public void testExceptionThrownForInvalidType() { - Assert.assertThrows(ValidationException.class, () -> JsonSchema.validate( - refBooleanJsonSchema, - null, - validationMetadata - )); - } -} \ No newline at end of file diff --git a/samples/client/petstore/kotlin/src/test/kotlin/org/openapijsonschematools/client/schemas/validation/AdditionalPropertiesValidatorTest.kt b/samples/client/petstore/kotlin/src/test/kotlin/org/openapijsonschematools/client/schemas/validation/AdditionalPropertiesValidatorTest.kt deleted file mode 100644 index e59f7dc095e..00000000000 --- a/samples/client/petstore/kotlin/src/test/kotlin/org/openapijsonschematools/client/schemas/validation/AdditionalPropertiesValidatorTest.kt +++ /dev/null @@ -1,149 +0,0 @@ -package org.openapijsonschematools.client.schemas.validation; - -import org.checkerframework.checker.nullness.qual.Nullable; -import org.junit.Assert; -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.MapJsonSchema; -import org.openapijsonschematools.client.schemas.StringJsonSchema; -import org.openapijsonschematools.client.exceptions.ValidationException; - -import java.util.ArrayList; -import java.util.LinkedHashMap; -import java.util.LinkedHashSet; -import java.util.List; -import java.util.Map; -import java.util.Set; - -public class AdditionalPropertiesValidatorTest { - public sealed interface ObjectWithPropsSchemaBoxed permits ObjectWithPropsSchemaBoxedMap {} - public record ObjectWithPropsSchemaBoxedMap() implements ObjectWithPropsSchemaBoxed {} - - public static class ObjectWithPropsSchema extends JsonSchema { - private static @Nullable ObjectWithPropsSchema instance = null; - private ObjectWithPropsSchema() { - super(new JsonSchemaInfo() - .type(Set.of(FrozenMap.class)) - .properties(Map.ofEntries( - new PropertyEntry("someString", StringJsonSchema.StringJsonSchema1.class) - )) - .additionalProperties(StringJsonSchema.StringJsonSchema1.class) - ); - - } - - public static ObjectWithPropsSchema getInstance() { - if (instance == null) { - instance = new ObjectWithPropsSchema(); - } - return instance; - } - - @Override - public Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { - if (arg instanceof Map) { - return arg; - } - 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 { - if (arg instanceof Map) { - return arg; - } - 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 ValidationException { - return new ObjectWithPropsSchemaBoxedMap(); - } - } - - @SuppressWarnings("nullness") - private Nothing? assertNull(@Nullable Object object) { - Assert.assertNull(object); - return null; - } - - @Test - public void testCorrectPropertySucceeds() throws ValidationException { - List pathToItem = List.of("args[0]"); - ValidationMetadata validationMetadata = new ValidationMetadata( - pathToItem, - new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().build()), - new PathToSchemasMap(), - new LinkedHashSet<>() - ); - LinkedHashMap mutableMap = new LinkedHashMap<>(); - mutableMap.put("someString", "abc"); - mutableMap.put("someAddProp", "def"); - FrozenMap arg = new FrozenMap<>(mutableMap); - final AdditionalPropertiesValidator validator = new AdditionalPropertiesValidator(); - PathToSchemasMap pathToSchemas = validator.validate( - new ValidationData( - ObjectWithPropsSchema.getInstance(), - arg, - validationMetadata - ) - ); - if (pathToSchemas == null) { - throw new RuntimeException("Invalid null value for pathToSchemas for this test case"); - } - List expectedPathToItem = new ArrayList<>(); - expectedPathToItem.add("args[0]"); - expectedPathToItem.add("someAddProp"); - LinkedHashMap, Nothing?> expectedClasses = new LinkedHashMap<>(); - StringJsonSchema.StringJsonSchema1 schema = JsonSchemaFactory.getInstance(StringJsonSchema.StringJsonSchema1.class); - expectedClasses.put(schema, null); - PathToSchemasMap expectedPathToSchemas = new PathToSchemasMap(); - expectedPathToSchemas.put(expectedPathToItem, expectedClasses); - Assert.assertEquals(pathToSchemas, expectedPathToSchemas); - } - - @Test - public void testNotApplicableTypeReturnsNull() throws ValidationException { - List pathToItem = List.of("args[0]"); - ValidationMetadata validationMetadata = new ValidationMetadata( - pathToItem, - new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().build()), - new PathToSchemasMap(), - new LinkedHashSet<>() - ); - final AdditionalPropertiesValidator validator = new AdditionalPropertiesValidator(); - PathToSchemasMap pathToSchemas = validator.validate( - new ValidationData( - MapJsonSchema.MapJsonSchema1.getInstance(), - 1, - validationMetadata - ) - ); - assertNull(pathToSchemas); - } - - @Test - public void testIncorrectPropertyValueFails() { - List pathToItem = List.of("args[0]"); - ValidationMetadata validationMetadata = new ValidationMetadata( - pathToItem, - new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().build()), - new PathToSchemasMap(), - new LinkedHashSet<>() - ); - LinkedHashMap mutableMap = new LinkedHashMap<>(); - mutableMap.put("someString", "abc"); - mutableMap.put("someAddProp", 1); - FrozenMap arg = new FrozenMap<>(mutableMap); - final AdditionalPropertiesValidator validator = new AdditionalPropertiesValidator(); - Assert.assertThrows(ValidationException.class, () -> validator.validate( - new ValidationData( - ObjectWithPropsSchema.getInstance(), - arg, - validationMetadata - ) - )); - } -} \ No newline at end of file diff --git a/samples/client/petstore/kotlin/src/test/kotlin/org/openapijsonschematools/client/schemas/validation/CustomIsoparserTest.kt b/samples/client/petstore/kotlin/src/test/kotlin/org/openapijsonschematools/client/schemas/validation/CustomIsoparserTest.kt deleted file mode 100644 index 686612d46c4..00000000000 --- a/samples/client/petstore/kotlin/src/test/kotlin/org/openapijsonschematools/client/schemas/validation/CustomIsoparserTest.kt +++ /dev/null @@ -1,28 +0,0 @@ -package org.openapijsonschematools.client.schemas.validation; - -import java.time.LocalDate; -import java.time.ZonedDateTime; -import java.time.ZoneId; -import org.junit.Assert; -import org.junit.Test; - -public final class CustomIsoparserTest { - - @Test - public void testParseIsodatetime() { - final CustomIsoparser parser = new CustomIsoparser(); - ZonedDateTime dateTime = parser.parseIsodatetime("2017-07-21T17:32:28Z"); - ZoneId zone = ZoneId.of("Z"); - ZonedDateTime expectedDateTime = ZonedDateTime.of(2017, 7, 21, 17, 32, 28, 0, zone); - Assert.assertEquals(dateTime, expectedDateTime); - } - - @Test - public void testParseIsodate() { - final CustomIsoparser parser = new CustomIsoparser(); - LocalDate date = parser.parseIsodate("2017-07-21"); - LocalDate expectedDate = LocalDate.of(2017, 7, 21); - Assert.assertEquals(date, expectedDate); - } - -} \ No newline at end of file diff --git a/samples/client/petstore/kotlin/src/test/kotlin/org/openapijsonschematools/client/schemas/validation/FormatValidatorTest.kt b/samples/client/petstore/kotlin/src/test/kotlin/org/openapijsonschematools/client/schemas/validation/FormatValidatorTest.kt deleted file mode 100644 index ca2ec5a1299..00000000000 --- a/samples/client/petstore/kotlin/src/test/kotlin/org/openapijsonschematools/client/schemas/validation/FormatValidatorTest.kt +++ /dev/null @@ -1,363 +0,0 @@ -package org.openapijsonschematools.client.schemas.validation; - -import org.checkerframework.checker.nullness.qual.Nullable; -import org.junit.Assert; -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.IntJsonSchema; -import org.openapijsonschematools.client.schemas.Int32JsonSchema; -import org.openapijsonschematools.client.schemas.Int64JsonSchema; -import org.openapijsonschematools.client.schemas.FloatJsonSchema; -import org.openapijsonschematools.client.schemas.DoubleJsonSchema; -import org.openapijsonschematools.client.schemas.DecimalJsonSchema; -import org.openapijsonschematools.client.schemas.DateJsonSchema; -import org.openapijsonschematools.client.schemas.DateTimeJsonSchema; - -import java.math.BigDecimal; -import java.math.BigInteger; -import java.util.ArrayList; -import java.util.LinkedHashSet; - -public class FormatValidatorTest { - static final ValidationMetadata validationMetadata = new ValidationMetadata( - new ArrayList<>(), - new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().build()), - new PathToSchemasMap(), - new LinkedHashSet<>() - ); - - @SuppressWarnings("nullness") - private void assertNull(@Nullable Object object) { - Assert.assertNull(object); - } - - @Test - public void testIntFormatSucceedsWithFloat() throws ValidationException { - final FormatValidator validator = new FormatValidator(); - PathToSchemasMap pathToSchemasMap = validator.validate( - new ValidationData( - IntJsonSchema.IntJsonSchema1.getInstance(), - 1.0f, - validationMetadata - ) - ); - assertNull(pathToSchemasMap); - } - - @Test - public void testIntFormatFailsWithFloat() { - final FormatValidator validator = new FormatValidator(); - Assert.assertThrows(ValidationException.class, () -> validator.validate( - new ValidationData( - IntJsonSchema.IntJsonSchema1.getInstance(), - 3.14f, - validationMetadata - ) - )); - } - - @Test - public void testIntFormatSucceedsWithInt() throws ValidationException { - final FormatValidator validator = new FormatValidator(); - PathToSchemasMap pathToSchemasMap = validator.validate( - new ValidationData( - IntJsonSchema.IntJsonSchema1.getInstance(), - 1, - validationMetadata - ) - ); - assertNull(pathToSchemasMap); - } - - @Test - public void testInt32UnderMinFails() { - final FormatValidator validator = new FormatValidator(); - Assert.assertThrows(ValidationException.class, () -> validator.validate( - new ValidationData( - Int32JsonSchema.Int32JsonSchema1.getInstance(), - -2147483649L, - validationMetadata - ) - )); - } - - @Test - public void testInt32InclusiveMinSucceeds() throws ValidationException { - final FormatValidator validator = new FormatValidator(); - PathToSchemasMap pathToSchemasMap = validator.validate( - new ValidationData( - Int32JsonSchema.Int32JsonSchema1.getInstance(), - -2147483648, - validationMetadata - ) - ); - assertNull(pathToSchemasMap); - } - - @Test - public void testInt32InclusiveMaxSucceeds() throws ValidationException { - final FormatValidator validator = new FormatValidator(); - PathToSchemasMap pathToSchemasMap = validator.validate( - new ValidationData( - Int32JsonSchema.Int32JsonSchema1.getInstance(), - 2147483647, - validationMetadata - ) - ); - assertNull(pathToSchemasMap); - } - - @Test - public void testInt32OverMaxFails() { - final FormatValidator validator = new FormatValidator(); - Assert.assertThrows(ValidationException.class, () -> validator.validate( - new ValidationData( - Int32JsonSchema.Int32JsonSchema1.getInstance(), - 2147483648L, - validationMetadata - ) - )); - } - - @Test - public void testInt64UnderMinFails() { - final FormatValidator validator = new FormatValidator(); - - Assert.assertThrows(ValidationException.class, () -> validator.validate( - new ValidationData( - Int64JsonSchema.Int64JsonSchema1.getInstance(), - new BigInteger("-9223372036854775809"), - validationMetadata - ) - )); - } - - @Test - public void testInt64InclusiveMinSucceeds() throws ValidationException { - final FormatValidator validator = new FormatValidator(); - PathToSchemasMap pathToSchemasMap = validator.validate( - new ValidationData( - Int64JsonSchema.Int64JsonSchema1.getInstance(), - -9223372036854775808L, - validationMetadata - ) - ); - assertNull(pathToSchemasMap); - } - - @Test - public void testInt64InclusiveMaxSucceeds() throws ValidationException { - final FormatValidator validator = new FormatValidator(); - PathToSchemasMap pathToSchemasMap = validator.validate( - new ValidationData( - Int64JsonSchema.Int64JsonSchema1.getInstance(), - 9223372036854775807L, - validationMetadata - ) - ); - assertNull(pathToSchemasMap); - } - - @Test - public void testInt64OverMaxFails() { - final FormatValidator validator = new FormatValidator(); - - Assert.assertThrows(ValidationException.class, () -> validator.validate( - new ValidationData( - Int64JsonSchema.Int64JsonSchema1.getInstance(), - new BigInteger("9223372036854775808"), - validationMetadata - ) - )); - } - - @Test - public void testFloatUnderMinFails() { - final FormatValidator validator = new FormatValidator(); - Assert.assertThrows(ValidationException.class, () -> validator.validate( - new ValidationData( - FloatJsonSchema.FloatJsonSchema1.getInstance(), - -3.402823466385289e+38d, - validationMetadata - ) - )); - } - - @Test - public void testFloatInclusiveMinSucceeds() throws ValidationException { - final FormatValidator validator = new FormatValidator(); - PathToSchemasMap pathToSchemasMap = validator.validate( - new ValidationData( - FloatJsonSchema.FloatJsonSchema1.getInstance(), - -3.4028234663852886e+38f, - validationMetadata - ) - ); - assertNull(pathToSchemasMap); - } - - @Test - public void testFloatInclusiveMaxSucceeds() throws ValidationException { - final FormatValidator validator = new FormatValidator(); - PathToSchemasMap pathToSchemasMap = validator.validate( - new ValidationData( - FloatJsonSchema.FloatJsonSchema1.getInstance(), - 3.4028234663852886e+38f, - validationMetadata - ) - ); - assertNull(pathToSchemasMap); - } - - @Test - public void testFloatOverMaxFails() { - final FormatValidator validator = new FormatValidator(); - Assert.assertThrows(ValidationException.class, () -> validator.validate( - new ValidationData( - FloatJsonSchema.FloatJsonSchema1.getInstance(), - 3.402823466385289e+38d, - validationMetadata - ) - )); - } - - @Test - public void testDoubleUnderMinFails() { - final FormatValidator validator = new FormatValidator(); - Assert.assertThrows(ValidationException.class, () -> validator.validate( - new ValidationData( - DoubleJsonSchema.DoubleJsonSchema1.getInstance(), - new BigDecimal("-1.7976931348623157082e+308"), - validationMetadata - ) - )); - } - - @Test - public void testDoubleInclusiveMinSucceeds() throws ValidationException { - final FormatValidator validator = new FormatValidator(); - PathToSchemasMap pathToSchemasMap = validator.validate( - new ValidationData( - DoubleJsonSchema.DoubleJsonSchema1.getInstance(), - -1.7976931348623157E+308d, - validationMetadata - ) - ); - assertNull(pathToSchemasMap); - } - - @Test - public void testDoubleInclusiveMaxSucceeds() throws ValidationException { - final FormatValidator validator = new FormatValidator(); - PathToSchemasMap pathToSchemasMap = validator.validate( - new ValidationData( - DoubleJsonSchema.DoubleJsonSchema1.getInstance(), - 1.7976931348623157E+308d, - validationMetadata - ) - ); - assertNull(pathToSchemasMap); - } - - @Test - public void testDoubleOverMaxFails() { - final FormatValidator validator = new FormatValidator(); - Assert.assertThrows(ValidationException.class, () -> validator.validate( - new ValidationData( - DoubleJsonSchema.DoubleJsonSchema1.getInstance(), - new BigDecimal("1.7976931348623157082e+308"), - validationMetadata - ) - )); - } - - @Test - public void testInvalidNumberStringFails() { - final FormatValidator validator = new FormatValidator(); - Assert.assertThrows(ValidationException.class, () -> validator.validate( - new ValidationData( - DecimalJsonSchema.DecimalJsonSchema1.getInstance(), - "abc", - validationMetadata - ) - )); - } - - @Test - public void testValidFloatNumberStringSucceeds() throws ValidationException { - final FormatValidator validator = new FormatValidator(); - PathToSchemasMap pathToSchemasMap = validator.validate( - new ValidationData( - DecimalJsonSchema.DecimalJsonSchema1.getInstance(), - "3.14", - validationMetadata - ) - ); - assertNull(pathToSchemasMap); - } - - @Test - public void testValidIntNumberStringSucceeds() throws ValidationException { - final FormatValidator validator = new FormatValidator(); - PathToSchemasMap pathToSchemasMap = validator.validate( - new ValidationData( - DecimalJsonSchema.DecimalJsonSchema1.getInstance(), - "1", - validationMetadata - ) - ); - assertNull(pathToSchemasMap); - } - - @Test - public void testInvalidDateStringFails() { - final FormatValidator validator = new FormatValidator(); - Assert.assertThrows(ValidationException.class, () -> validator.validate( - new ValidationData( - DateJsonSchema.DateJsonSchema1.getInstance(), - "abc", - validationMetadata - ) - )); - } - - @Test - public void testValidDateStringSucceeds() throws ValidationException { - final FormatValidator validator = new FormatValidator(); - PathToSchemasMap pathToSchemasMap = validator.validate( - new ValidationData( - DateJsonSchema.DateJsonSchema1.getInstance(), - "2017-01-20", - validationMetadata - ) - ); - assertNull(pathToSchemasMap); - } - - @Test - public void testInvalidDateTimeStringFails() { - final FormatValidator validator = new FormatValidator(); - Assert.assertThrows(ValidationException.class, () -> validator.validate( - new ValidationData( - DateTimeJsonSchema.DateTimeJsonSchema1.getInstance(), - "abc", - validationMetadata - ) - )); - } - - @Test - public void testValidDateTimeStringSucceeds() throws ValidationException { - final FormatValidator validator = new FormatValidator(); - PathToSchemasMap pathToSchemasMap = validator.validate( - new ValidationData( - DateTimeJsonSchema.DateTimeJsonSchema1.getInstance(), - "2017-07-21T17:32:28Z", - validationMetadata - ) - ); - assertNull(pathToSchemasMap); - } -} \ No newline at end of file diff --git a/samples/client/petstore/kotlin/src/test/kotlin/org/openapijsonschematools/client/schemas/validation/ItemsValidatorTest.kt b/samples/client/petstore/kotlin/src/test/kotlin/org/openapijsonschematools/client/schemas/validation/ItemsValidatorTest.kt deleted file mode 100644 index 061825c2a21..00000000000 --- a/samples/client/petstore/kotlin/src/test/kotlin/org/openapijsonschematools/client/schemas/validation/ItemsValidatorTest.kt +++ /dev/null @@ -1,131 +0,0 @@ -package org.openapijsonschematools.client.schemas.validation; - -import org.checkerframework.checker.nullness.qual.Nullable; -import org.junit.Assert; -import org.junit.Test; -import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags; -import org.openapijsonschematools.client.configurations.SchemaConfiguration; -import org.openapijsonschematools.client.schemas.StringJsonSchema; -import org.openapijsonschematools.client.exceptions.ValidationException; - -import java.util.ArrayList; -import java.util.LinkedHashMap; -import java.util.LinkedHashSet; -import java.util.List; -import java.util.Set; - -public class ItemsValidatorTest { - @SuppressWarnings("nullness") - private void assertNull(@Nullable Object object) { - Assert.assertNull(object); - } - - public sealed interface ArrayWithItemsSchemaBoxed permits ArrayWithItemsSchemaBoxedList {} - public record ArrayWithItemsSchemaBoxedList() implements ArrayWithItemsSchemaBoxed {} - - public static class ArrayWithItemsSchema extends JsonSchema { - public ArrayWithItemsSchema() { - super(new JsonSchemaInfo() - .type(Set.of(List.class)) - .items(StringJsonSchema.StringJsonSchema1.class) - ); - } - - @Override - public Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { - 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"); - } - - @Override - public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws 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"); - } - - @Override - public ArrayWithItemsSchemaBoxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { - return new ArrayWithItemsSchemaBoxedList(); - } - } - - @Test - public void testCorrectItemsSucceeds() throws ValidationException { - List pathToItem = List.of("args[0]"); - ValidationMetadata validationMetadata = new ValidationMetadata( - pathToItem, - new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().build()), - new PathToSchemasMap(), - new LinkedHashSet<>() - ); - List mutableList = new ArrayList<>(); - mutableList.add("a"); - FrozenList arg = new FrozenList<>(mutableList); - final ItemsValidator validator = new ItemsValidator(); - PathToSchemasMap pathToSchemas = validator.validate( - new ValidationData( - new ArrayWithItemsSchema(), - arg, - validationMetadata - ) - ); - if (pathToSchemas == null) { - throw new RuntimeException("Invalid null value in pathToSchemas for this test case"); - } - List expectedPathToItem = new ArrayList<>(); - expectedPathToItem.add("args[0]"); - expectedPathToItem.add(0); - LinkedHashMap, Nothing?> expectedClasses = new LinkedHashMap<>(); - StringJsonSchema.StringJsonSchema1 schema = JsonSchemaFactory.getInstance(StringJsonSchema.StringJsonSchema1.class); - expectedClasses.put(schema, null); - PathToSchemasMap expectedPathToSchemas = new PathToSchemasMap(); - expectedPathToSchemas.put(expectedPathToItem, expectedClasses); - Assert.assertEquals(pathToSchemas, expectedPathToSchemas); - } - - @Test - public void testNotApplicableTypeReturnsNull() throws ValidationException { - List pathToItem = List.of("args[0]"); - ValidationMetadata validationMetadata = new ValidationMetadata( - pathToItem, - new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().build()), - new PathToSchemasMap(), - new LinkedHashSet<>() - ); - final ItemsValidator validator = new ItemsValidator(); - PathToSchemasMap pathToSchemas = validator.validate( - new ValidationData( - new ArrayWithItemsSchema(), - 1, - validationMetadata - ) - ); - assertNull(pathToSchemas); - } - - @Test - public void testIncorrectItemFails() { - List pathToItem = List.of("args[0]"); - ValidationMetadata validationMetadata = new ValidationMetadata( - pathToItem, - new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().build()), - new PathToSchemasMap(), - new LinkedHashSet<>() - ); - List mutableList = new ArrayList<>(); - mutableList.add(1); - FrozenList arg = new FrozenList<>(mutableList); - final ItemsValidator validator = new ItemsValidator(); - Assert.assertThrows(ValidationException.class, () -> validator.validate( - new ValidationData( - new ArrayWithItemsSchema(), - arg, - validationMetadata - ) - )); - } -} \ No newline at end of file diff --git a/samples/client/petstore/kotlin/src/test/kotlin/org/openapijsonschematools/client/schemas/validation/JsonSchemaTest.kt b/samples/client/petstore/kotlin/src/test/kotlin/org/openapijsonschematools/client/schemas/validation/JsonSchemaTest.kt deleted file mode 100644 index a6d145b87b9..00000000000 --- a/samples/client/petstore/kotlin/src/test/kotlin/org/openapijsonschematools/client/schemas/validation/JsonSchemaTest.kt +++ /dev/null @@ -1,80 +0,0 @@ -package org.openapijsonschematools.client.schemas.validation; - -import org.checkerframework.checker.nullness.qual.Nullable; -import org.junit.Assert; -import org.junit.Test; -import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags; -import org.openapijsonschematools.client.configurations.SchemaConfiguration; -import org.openapijsonschematools.client.exceptions.ValidationException; - -import java.util.LinkedHashMap; -import java.util.LinkedHashSet; -import java.util.List; -import java.util.Set; - -sealed interface SomeSchemaBoxed permits SomeSchemaBoxedString {} -record SomeSchemaBoxedString() implements SomeSchemaBoxed {} - -public class JsonSchemaTest { - sealed interface SomeSchemaBoxed permits SomeSchemaBoxedString {} - record SomeSchemaBoxedString() implements SomeSchemaBoxed {} - - static class SomeSchema extends JsonSchema { - private static @Nullable SomeSchema instance = null; - protected SomeSchema() { - super(new JsonSchemaInfo() - .type(Set.of(String.class)) - ); - } - - public static SomeSchema getInstance() { - if (instance == null) { - instance = new SomeSchema(); - } - return instance; - } - - @Override - public Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { - if (arg instanceof String) { - return arg; - } - 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 { - if (arg instanceof String) { - return arg; - } - 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 ValidationException { - return new SomeSchemaBoxedString(); - } - } - - @Test - public void testValidateSucceeds() throws ValidationException { - List pathToItem = List.of("args[0]"); - ValidationMetadata validationMetadata = new ValidationMetadata( - pathToItem, - new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().build()), - new PathToSchemasMap(), - new LinkedHashSet<>() - ); - SomeSchema schema = JsonSchemaFactory.getInstance(SomeSchema.class); - PathToSchemasMap pathToSchemas = JsonSchema.validate( - schema, - "hi", - validationMetadata - ); - PathToSchemasMap expectedPathToSchemas = new PathToSchemasMap(); - LinkedHashMap, Nothing?> validatedClasses = new LinkedHashMap<>(); - validatedClasses.put(schema, null); - expectedPathToSchemas.put(pathToItem, validatedClasses); - Assert.assertEquals(pathToSchemas, expectedPathToSchemas); - } -} \ No newline at end of file diff --git a/samples/client/petstore/kotlin/src/test/kotlin/org/openapijsonschematools/client/schemas/validation/PropertiesValidatorTest.kt b/samples/client/petstore/kotlin/src/test/kotlin/org/openapijsonschematools/client/schemas/validation/PropertiesValidatorTest.kt deleted file mode 100644 index 6e2108e64fa..00000000000 --- a/samples/client/petstore/kotlin/src/test/kotlin/org/openapijsonschematools/client/schemas/validation/PropertiesValidatorTest.kt +++ /dev/null @@ -1,134 +0,0 @@ -package org.openapijsonschematools.client.schemas.validation; - -import org.checkerframework.checker.nullness.qual.Nullable; -import org.junit.Assert; -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.StringJsonSchema; - -import java.util.ArrayList; -import java.util.LinkedHashMap; -import java.util.LinkedHashSet; -import java.util.List; -import java.util.Map; -import java.util.Set; - -public class PropertiesValidatorTest { - public sealed interface ObjectWithPropsSchemaBoxed permits ObjectWithPropsSchemaBoxedMap {} - public record ObjectWithPropsSchemaBoxedMap() implements ObjectWithPropsSchemaBoxed {} - - public static class ObjectWithPropsSchema extends JsonSchema { - private ObjectWithPropsSchema() { - super(new JsonSchemaInfo() - .type(Set.of(Map.class)) - .properties(Map.ofEntries( - new PropertyEntry("someString", StringJsonSchema.StringJsonSchema1.class) - )) - ); - - } - - @Override - public Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { - 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"); - } - - @Override - public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws 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"); - } - - @Override - public ObjectWithPropsSchemaBoxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { - return new ObjectWithPropsSchemaBoxedMap(); - } - } - - @SuppressWarnings("nullness") - private void assertNull(@Nullable Object object) { - Assert.assertNull(object); - } - - @Test - public void testCorrectPropertySucceeds() throws ValidationException { - final PropertiesValidator validator = new PropertiesValidator(); - List pathToItem = List.of("args[0]"); - ValidationMetadata validationMetadata = new ValidationMetadata( - pathToItem, - new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().build()), - new PathToSchemasMap(), - new LinkedHashSet<>() - ); - LinkedHashMap mutableMap = new LinkedHashMap<>(); - mutableMap.put("someString", "abc"); - FrozenMap arg = new FrozenMap<>(mutableMap); - PathToSchemasMap pathToSchemas = validator.validate( - new ValidationData( - new ObjectWithPropsSchema(), - arg, - validationMetadata - ) - ); - if (pathToSchemas == null) { - throw new RuntimeException("Invalid null value for pathToSchemas for this test case"); - } - List expectedPathToItem = new ArrayList<>(); - expectedPathToItem.add("args[0]"); - expectedPathToItem.add("someString"); - LinkedHashMap, Nothing?> expectedClasses = new LinkedHashMap<>(); - expectedClasses.put(JsonSchemaFactory.getInstance(StringJsonSchema.StringJsonSchema1.class), null); - PathToSchemasMap expectedPathToSchemas = new PathToSchemasMap(); - expectedPathToSchemas.put(expectedPathToItem, expectedClasses); - Assert.assertEquals(pathToSchemas, expectedPathToSchemas); - } - - @Test - public void testNotApplicableTypeReturnsNull() throws ValidationException { - final PropertiesValidator validator = new PropertiesValidator(); - List pathToItem = List.of("args[0]"); - ValidationMetadata validationMetadata = new ValidationMetadata( - pathToItem, - new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().build()), - new PathToSchemasMap(), - new LinkedHashSet<>() - ); - PathToSchemasMap pathToSchemas = validator.validate( - new ValidationData( - new ObjectWithPropsSchema(), - 1, - validationMetadata - ) - ); - assertNull(pathToSchemas); - } - - @Test - public void testIncorrectPropertyValueFails() { - final PropertiesValidator validator = new PropertiesValidator(); - List pathToItem = List.of("args[0]"); - ValidationMetadata validationMetadata = new ValidationMetadata( - pathToItem, - new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().build()), - new PathToSchemasMap(), - new LinkedHashSet<>() - ); - LinkedHashMap mutableMap = new LinkedHashMap<>(); - mutableMap.put("someString", 1); - FrozenMap arg = new FrozenMap<>(mutableMap); - Assert.assertThrows(ValidationException.class, () -> validator.validate( - new ValidationData( - new ObjectWithPropsSchema(), - arg, - validationMetadata - ) - )); - } -} \ No newline at end of file diff --git a/samples/client/petstore/kotlin/src/test/kotlin/org/openapijsonschematools/client/schemas/validation/RequiredValidatorTest.kt b/samples/client/petstore/kotlin/src/test/kotlin/org/openapijsonschematools/client/schemas/validation/RequiredValidatorTest.kt deleted file mode 100644 index 72d044cf4cf..00000000000 --- a/samples/client/petstore/kotlin/src/test/kotlin/org/openapijsonschematools/client/schemas/validation/RequiredValidatorTest.kt +++ /dev/null @@ -1,120 +0,0 @@ -package org.openapijsonschematools.client.schemas.validation; - -import org.checkerframework.checker.nullness.qual.Nullable; -import org.junit.Assert; -import org.junit.Test; -import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags; -import org.openapijsonschematools.client.configurations.SchemaConfiguration; -import org.openapijsonschematools.client.exceptions.ValidationException; - -import java.util.LinkedHashMap; -import java.util.LinkedHashSet; -import java.util.List; -import java.util.Map; -import java.util.Set; - -public class RequiredValidatorTest { - public sealed interface ObjectWithRequiredSchemaBoxed permits ObjectWithRequiredSchemaBoxedMap {} - public record ObjectWithRequiredSchemaBoxedMap() implements ObjectWithRequiredSchemaBoxed {} - - public static class ObjectWithRequiredSchema extends JsonSchema { - private ObjectWithRequiredSchema() { - super(new JsonSchemaInfo() - .type(Set.of(Map.class)) - .required(Set.of("someString")) - ); - - } - - @Override - public Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { - 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"); - } - - @Override - public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws 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"); - } - - @Override - public ObjectWithRequiredSchemaBoxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { - return new ObjectWithRequiredSchemaBoxedMap(); - } - } - - @SuppressWarnings("nullness") - private void assertNull(@Nullable Object object) { - Assert.assertNull(object); - } - - @Test - public void testCorrectPropertySucceeds() throws ValidationException { - List pathToItem = List.of("args[0]"); - ValidationMetadata validationMetadata = new ValidationMetadata( - pathToItem, - new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().build()), - new PathToSchemasMap(), - new LinkedHashSet<>() - ); - LinkedHashMap mutableMap = new LinkedHashMap<>(); - mutableMap.put("someString", "abc"); - FrozenMap arg = new FrozenMap<>(mutableMap); - final RequiredValidator validator = new RequiredValidator(); - PathToSchemasMap pathToSchemas = validator.validate( - new ValidationData( - new ObjectWithRequiredSchema(), - arg, - validationMetadata - ) - ); - assertNull(pathToSchemas); - } - - @Test - public void testNotApplicableTypeReturnsNull() throws ValidationException { - List pathToItem = List.of("args[0]"); - ValidationMetadata validationMetadata = new ValidationMetadata( - pathToItem, - new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().build()), - new PathToSchemasMap(), - new LinkedHashSet<>() - ); - final RequiredValidator validator = new RequiredValidator(); - PathToSchemasMap pathToSchemas = validator.validate( - new ValidationData( - new ObjectWithRequiredSchema(), - 1, - validationMetadata - ) - ); - assertNull(pathToSchemas); - } - - @Test - public void testIncorrectPropertyFails() { - List pathToItem = List.of("args[0]"); - ValidationMetadata validationMetadata = new ValidationMetadata( - pathToItem, - new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().build()), - new PathToSchemasMap(), - new LinkedHashSet<>() - ); - LinkedHashMap mutableMap = new LinkedHashMap<>(); - mutableMap.put("aDifferentProp", 1); - FrozenMap arg = new FrozenMap<>(mutableMap); - final RequiredValidator validator = new RequiredValidator(); - Assert.assertThrows(ValidationException.class, () -> validator.validate( - new ValidationData( - new ObjectWithRequiredSchema(), - arg, - validationMetadata - ) - )); - } -} \ No newline at end of file diff --git a/samples/client/petstore/kotlin/src/test/kotlin/org/openapijsonschematools/client/schemas/validation/TypeValidatorTest.kt b/samples/client/petstore/kotlin/src/test/kotlin/org/openapijsonschematools/client/schemas/validation/TypeValidatorTest.kt deleted file mode 100644 index 01378dd4d41..00000000000 --- a/samples/client/petstore/kotlin/src/test/kotlin/org/openapijsonschematools/client/schemas/validation/TypeValidatorTest.kt +++ /dev/null @@ -1,56 +0,0 @@ -package org.openapijsonschematools.client.schemas.validation; - -import org.checkerframework.checker.nullness.qual.Nullable; -import org.junit.Assert; -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.StringJsonSchema; - -import java.util.ArrayList; -import java.util.LinkedHashSet; - -public class TypeValidatorTest { - @SuppressWarnings("nullness") - private void assertNull(@Nullable Object object) { - Assert.assertNull(object); - } - - @Test - public void testValidateSucceeds() throws ValidationException { - final TypeValidator validator = new TypeValidator(); - ValidationMetadata validationMetadata = new ValidationMetadata( - new ArrayList<>(), - new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().build()), - new PathToSchemasMap(), - new LinkedHashSet<>() - ); - @Nullable PathToSchemasMap pathToSchemasMap = validator.validate( - new ValidationData( - StringJsonSchema.StringJsonSchema1.getInstance(), - "hi", - validationMetadata - ) - ); - assertNull(pathToSchemasMap); - } - - @Test - public void testValidateFailsIntIsNotString() { - final TypeValidator validator = new TypeValidator(); - ValidationMetadata validationMetadata = new ValidationMetadata( - new ArrayList<>(), - new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().build()), - new PathToSchemasMap(), - new LinkedHashSet<>() - ); - Assert.assertThrows(ValidationException.class, () -> validator.validate( - new ValidationData( - StringJsonSchema.StringJsonSchema1.getInstance(), - 1, - validationMetadata - ) - )); - } -} \ No newline at end of file diff --git a/src/main/java/org/openapijsonschematools/codegen/common/CodegenConstants.java b/src/main/java/org/openapijsonschematools/codegen/common/CodegenConstants.java index ef912629dca..fe8292e9a0c 100644 --- a/src/main/java/org/openapijsonschematools/codegen/common/CodegenConstants.java +++ b/src/main/java/org/openapijsonschematools/codegen/common/CodegenConstants.java @@ -220,7 +220,7 @@ public class CodegenConstants { public static enum PARAM_NAMING_TYPE {camelCase, PascalCase, snake_case, original} - public static enum JSON_PATH_LOCATION_TYPE {SCHEMA, REQUEST_BODY, PARAMETER, RESPONSE, HEADER, CONTENT, CONTENT_TYPE, HEADERS, PARAMETERS, RESPONSES, REQUEST_BODIES, SCHEMAS, PATHS, PATH, COMPONENTS, OPERATION, SECURITY_SCHEMES, SECURITY_SCHEME, SERVERS, SERVER, API_ROOT_FOLDER, API_PATH, API_TAG, API_PATHS, API_TAGS, SECURITY, SECURITIES, TEST_ROOT} + public static enum JSON_PATH_LOCATION_TYPE {SCHEMA, REQUEST_BODY, PARAMETER, RESPONSE, HEADER, CONTENT, CONTENT_TYPE, HEADERS, PARAMETERS, RESPONSES, REQUEST_BODIES, SCHEMAS, PATHS, PATH, COMPONENTS, OPERATION, SECURITY_SCHEMES, SECURITY_SCHEME, SERVERS, SERVER, API_ROOT_FOLDER, API_PATH, API_TAG, API_PATHS, API_TAGS, SECURITY, SECURITIES, TEST_ROOT, MEDIA_TYPE} public static enum MODEL_PROPERTY_NAMING_TYPE {camelCase, PascalCase, snake_case, original} diff --git a/src/main/java/org/openapijsonschematools/codegen/config/CodegenConfigurator.java b/src/main/java/org/openapijsonschematools/codegen/config/CodegenConfigurator.java index 1372062c08e..8058333cd8f 100644 --- a/src/main/java/org/openapijsonschematools/codegen/config/CodegenConfigurator.java +++ b/src/main/java/org/openapijsonschematools/codegen/config/CodegenConfigurator.java @@ -161,9 +161,6 @@ public CodegenConfigurator setApiPackage(String apiPackage) { } public CodegenConfigurator setArtifactId(String artifactId) { - if (StringUtils.isNotEmpty(artifactId)) { - addAdditionalProperty(CodegenConstants.ARTIFACT_ID, artifactId); - } generatorSettingsBuilder.withArtifactId(artifactId); return this; } @@ -301,9 +298,6 @@ public CodegenConfigurator setOutputDir(String outputDir) { } public CodegenConfigurator setPackageName(String packageName) { - if (StringUtils.isNotEmpty(packageName)) { - addAdditionalProperty(CodegenConstants.PACKAGE_NAME, packageName); - } generatorSettingsBuilder.withPackageName(packageName); return this; } diff --git a/src/main/java/org/openapijsonschematools/codegen/config/GeneratorSettings.java b/src/main/java/org/openapijsonschematools/codegen/config/GeneratorSettings.java index cd2557cdc09..b161b2a7977 100644 --- a/src/main/java/org/openapijsonschematools/codegen/config/GeneratorSettings.java +++ b/src/main/java/org/openapijsonschematools/codegen/config/GeneratorSettings.java @@ -268,15 +268,9 @@ private GeneratorSettings(Builder builder) { if (isNotEmpty(invokerPackage)) { additional.put("invokerPackage", invokerPackage); } - if (isNotEmpty(packageName)) { - additional.put("packageName", packageName); - } if (isNotEmpty(groupId)) { additional.put("groupId", groupId); } - if (isNotEmpty(artifactId)) { - additional.put("artifactId", artifactId); - } if (isNotEmpty(artifactVersion)) { additional.put("artifactVersion", artifactVersion); } diff --git a/src/main/java/org/openapijsonschematools/codegen/generatorrunner/DefaultGeneratorRunner.java b/src/main/java/org/openapijsonschematools/codegen/generatorrunner/DefaultGeneratorRunner.java index 3bf571adaba..575b50ba540 100644 --- a/src/main/java/org/openapijsonschematools/codegen/generatorrunner/DefaultGeneratorRunner.java +++ b/src/main/java/org/openapijsonschematools/codegen/generatorrunner/DefaultGeneratorRunner.java @@ -366,8 +366,7 @@ private void generateSchema(List files, CodegenSchema schema, String jsonP private void generateFile(Map templateData, String templateName, String outputFilename, List files, boolean shouldGenerate, String skippedByOption) { templateData.putAll(generator.additionalProperties()); - String packageName = generator.generatorSettings().packageName; - templateData.put("packageName", packageName); + templateData.put("packageName", generator.generatorSettings().packageName); templateData.put("generatorSettings", generator.generatorSettings()); try { File written = processTemplateToFile(templateData, templateName, outputFilename, shouldGenerate, skippedByOption); @@ -382,6 +381,7 @@ private void generateFile(Map templateData, String templateName, } } + @Deprecated private void generateFiles(List> processTemplateToFileInfos, boolean shouldGenerate, String skippedByOption, List files) { for (List processTemplateToFileInfo: processTemplateToFileInfos) { Map templateData = (Map) processTemplateToFileInfo.get(0); @@ -1343,7 +1343,9 @@ Map buildSupportFileBundle( CodegenList security) { Map bundle = new HashMap<>(generator.additionalProperties()); + bundle.put("packageName", generator.generatorSettings().packageName); bundle.put("generatorSettings", generator.generatorSettings()); + bundle.put("generatorMetadata", generator.getGeneratorMetadata()); bundle.put("apiPackage", generator.generatorSettings().apiPackage); URL url = URLPathUtils.getServerURL(openAPI, null); diff --git a/src/main/java/org/openapijsonschematools/codegen/generators/DefaultGenerator.java b/src/main/java/org/openapijsonschematools/codegen/generators/DefaultGenerator.java index 3990dc0bc3f..bf1750f0ea2 100644 --- a/src/main/java/org/openapijsonschematools/codegen/generators/DefaultGenerator.java +++ b/src/main/java/org/openapijsonschematools/codegen/generators/DefaultGenerator.java @@ -280,7 +280,7 @@ public DefaultGenerator(GeneratorSettings generatorSettings, WorkflowSettings wo Supporting files are those which aren't models, APIs, or docs. These get a different map of data bound to the templates. Supporting files are written once. */ - protected List supportingFiles = new ArrayList<>(); + protected Set supportingFiles = new LinkedHashSet<>(); protected List cliOptions = new ArrayList<>(); protected String removeOperationIdPrefixDelimiter = "_"; protected int removeOperationIdPrefixCount = 1; @@ -663,7 +663,7 @@ public CodeGeneratorSettings generatorSettings() { } @Override - public List supportingFiles() { + public Set supportingFiles() { return supportingFiles; } diff --git a/src/main/java/org/openapijsonschematools/codegen/generators/Generator.java b/src/main/java/org/openapijsonschematools/codegen/generators/Generator.java index c30a963da8e..2945426452a 100644 --- a/src/main/java/org/openapijsonschematools/codegen/generators/Generator.java +++ b/src/main/java/org/openapijsonschematools/codegen/generators/Generator.java @@ -75,7 +75,7 @@ public interface Generator extends OpenApiProcessor, Comparable { List cliOptions(); - List supportingFiles(); + Set supportingFiles(); CodegenKey getKey(String key, String keyType); diff --git a/src/main/java/org/openapijsonschematools/codegen/generators/KotlinClientGenerator.java b/src/main/java/org/openapijsonschematools/codegen/generators/KotlinClientGenerator.java index ccd4bc4fd14..2124dcf65c3 100644 --- a/src/main/java/org/openapijsonschematools/codegen/generators/KotlinClientGenerator.java +++ b/src/main/java/org/openapijsonschematools/codegen/generators/KotlinClientGenerator.java @@ -316,7 +316,7 @@ public KotlinClientGenerator(GeneratorSettings generatorSettings, WorkflowSettin public static final GeneratorMetadata generatorMetadata = GeneratorMetadata.newBuilder() .name("kotlin") .language(GeneratorLanguage.KOTLIN) - .languageVersion("17") + .languageVersion("1.9.23") .type(GeneratorType.CLIENT) .stability(Stability.EXPERIMENTAL) .featureSet(featureSet) @@ -356,24 +356,82 @@ public KotlinClientGenerator(GeneratorSettings generatorSettings, WorkflowSettin .postGenerationMsg(defaultPostGenerationMsg) .reservedWords( getLowerCaseWords( + // includes reserved words at https://github.com/JetBrains/kotlin/blob/master/core/descriptors/src/org/jetbrains/kotlin/renderer/KeywordStringsGenerated.java + // and keywords from https://kotlinlang.org/docs/reference/keyword-reference.html Arrays.asList( - // used as internal variables, can collide with parameter names - "localVarPath", "localVarQueryParams", "localVarCollectionQueryParams", - "localVarHeaderParams", "localVarCookieParams", "localVarFormParams", "localVarPostBody", - "localVarAccepts", "localVarAccept", "localVarContentTypes", - "localVarContentType", "localVarAuthNames", "localReturnType", - "ApiClient", "ApiException", "ApiResponse", "Configuration", "StringUtil", - - // language reserved words - "abstract", "continue", "for", "new", "switch", "assert", - "default", "if", "package", "synchronized", "boolean", "do", "goto", "private", - "this", "break", "double", "implements", "protected", "throw", "byte", "else", - "import", "public", "throws", "case", "enum", "instanceof", "return", "transient", - "catch", "extends", "int", "short", "try", "char", "final", "interface", "static", - "void", "class", "finally", "long", "strictfp", "volatile", "const", "float", - "native", "super", "while", "null", - // additional types - "localdate", "zoneddatetime", "list", "map", "linkedhashset", "void", "string", "uuid", "number", "integer", "toString" + "ApiResponse", + "abstract", + "actual", + "annotation", + "as", + "break", + "class", + "companion", + "const", + "constructor", + "continue", + "contract", + "crossinline", + "data", + "delegate", + "do", + "dynamic", + "else", + "enum", + "expect", + "external", + "false", + "field", + "final", + "finally", + "for", + "fun", + "if", + "import", + "in", + "infix", + "init", + "inline", + "inner", + "interface", + "internal", + "is", + "it", + "lateinit", + "noinline", + "null", + "object", + "open", + "operator", + "out", + "override", + "package", + "param", + "private", + "property", + "protected", + "public", + "receiver", + "reified", + "return", + "sealed", + "setparam", + "super", + "suspend", + "tailrec", + "this", + "throw", + "true", + "try", + "typealias", + "typeof", + "val", + "value", + "var", + "vararg", + "when", + "where", + "while" ) ) ) @@ -382,23 +440,24 @@ public KotlinClientGenerator(GeneratorSettings generatorSettings, WorkflowSettin new AbstractMap.SimpleEntry<>("object", "FrozenMap"), new AbstractMap.SimpleEntry<>("array", "FrozenList"), new AbstractMap.SimpleEntry<>("string", "String"), - new AbstractMap.SimpleEntry<>("number", "Number (int, long, float, double)"), - new AbstractMap.SimpleEntry<>("integer", "Number (int, long, float with integer values, double with integer values)"), - new AbstractMap.SimpleEntry<>("boolean", "boolean"), - new AbstractMap.SimpleEntry<>("null", "Void (null)") + new AbstractMap.SimpleEntry<>("number", "Number (Int, Long, Float, Double)"), + new AbstractMap.SimpleEntry<>("integer", "Number (Int, Long, Float with integer values, Double with integer values)"), + new AbstractMap.SimpleEntry<>("boolean", "Boolean"), + new AbstractMap.SimpleEntry<>("null", "Nothing? (null)") ) ) .languageSpecificPrimitives( Sets.newHashSet( "String", - "boolean", "Boolean", "Double", - "Integer", + "Int", "Long", "Float", - "Object", - "byte[]" + "Map", + "List", + "Any", + "Nothing" ) ) .build(); @@ -591,7 +650,6 @@ public void processOpts() { schemaSupportingFiles.add("NotAnyTypeJsonSchema"); schemaSupportingFiles.add("NullJsonSchema"); schemaSupportingFiles.add("NumberJsonSchema"); - schemaSupportingFiles.add("SetMaker"); schemaSupportingFiles.add("StringJsonSchema"); schemaSupportingFiles.add("UnsetAddPropsSetter"); schemaSupportingFiles.add("UuidJsonSchema"); @@ -683,7 +741,6 @@ public void processOpts() { keywordValidatorFiles.add("PatternValidator"); keywordValidatorFiles.add("PrefixItemsValidator"); keywordValidatorFiles.add("PropertiesValidator"); - keywordValidatorFiles.add("PropertyEntry"); keywordValidatorFiles.add("PropertyNamesValidator"); keywordValidatorFiles.add("RequiredValidator"); keywordValidatorFiles.add("StringEnumValidator"); @@ -722,10 +779,8 @@ public void processOpts() { // exceptions List exceptionClasses = new ArrayList<>(); - exceptionClasses.add("ApiException"); exceptionClasses.add("BaseException"); exceptionClasses.add("InvalidAdditionalPropertyException"); - exceptionClasses.add("NotImplementedException"); exceptionClasses.add("UnsetPropertyException"); exceptionClasses.add("ValidationException"); for (String exceptionClass: exceptionClasses) { @@ -749,188 +804,6 @@ public void processOpts() { "src/main/kotlin/packagename/configurations/SchemaConfiguration.hbs", packagePath() + File.separatorChar + "configurations", "SchemaConfiguration.kt")); - supportingFiles.add(new SupportingFile( - "src/main/kotlin/packagename/configurations/ApiConfiguration.hbs", - packagePath() + File.separatorChar + "configurations", - "ApiConfiguration.kt")); - // requestbody - supportingFiles.add(new SupportingFile( - "src/main/kotlin/packagename/requestbody/GenericRequestBody.hbs", - packagePath() + File.separatorChar + "requestbody", - "GenericRequestBody.kt")); - supportingFiles.add(new SupportingFile( - "src/main/kotlin/packagename/requestbody/RequestBodySerializer.hbs", - packagePath() + File.separatorChar + "requestbody", - "RequestBodySerializer.kt")); - supportingFiles.add(new SupportingFile( - "src/main/kotlin/packagename/requestbody/SerializedRequestBody.hbs", - packagePath() + File.separatorChar + "requestbody", - "SerializedRequestBody.kt")); - supportingFiles.add(new SupportingFile( - "src/test/kotlin/packagename/requestbody/RequestBodySerializerTest.hbs", - testPackagePath() + File.separatorChar + "requestbody", - "RequestBodySerializerTest.kt")); - // mediatype - supportingFiles.add(new SupportingFile( - "src/main/kotlin/packagename/mediatype/MediaType.hbs", - packagePath() + File.separatorChar + "mediatype", - "MediaType.kt")); - supportingFiles.add(new SupportingFile( - "src/main/kotlin/packagename/mediatype/Encoding.hbs", - packagePath() + File.separatorChar + "mediatype", - "Encoding.kt")); - // contenttype - supportingFiles.add(new SupportingFile( - "src/main/kotlin/packagename/contenttype/ContentTypeDetector.hbs", - packagePath() + File.separatorChar + "contenttype", - "ContentTypeDetector.kt")); - supportingFiles.add(new SupportingFile( - "src/main/kotlin/packagename/contenttype/ContentTypeSerializer.hbs", - packagePath() + File.separatorChar + "contenttype", - "ContentTypeSerializer.kt")); - supportingFiles.add(new SupportingFile( - "src/main/kotlin/packagename/contenttype/ContentTypeDeserializer.hbs", - packagePath() + File.separatorChar + "contenttype", - "ContentTypeDeserializer.kt")); - // header - supportingFiles.add(new SupportingFile( - "src/main/kotlin/packagename/header/Header.hbs", - packagePath() + File.separatorChar + "header", - "Header.kt")); - supportingFiles.add(new SupportingFile( - "src/main/kotlin/packagename/header/HeaderBase.hbs", - packagePath() + File.separatorChar + "header", - "HeaderBase.kt")); - supportingFiles.add(new SupportingFile( - "src/main/kotlin/packagename/header/SchemaHeader.hbs", - packagePath() + File.separatorChar + "header", - "SchemaHeader.kt")); - supportingFiles.add(new SupportingFile( - "src/main/kotlin/packagename/header/ContentHeader.hbs", - packagePath() + File.separatorChar + "header", - "ContentHeader.kt")); - supportingFiles.add(new SupportingFile( - "src/main/kotlin/packagename/header/StyleSerializer.hbs", - packagePath() + File.separatorChar + "header", - "StyleSerializer.kt")); - supportingFiles.add(new SupportingFile( - "src/main/kotlin/packagename/header/Rfc6570Serializer.hbs", - packagePath() + File.separatorChar + "header", - "Rfc6570Serializer.kt")); - supportingFiles.add(new SupportingFile( - "src/main/kotlin/packagename/header/PrefixSeparatorIterator.hbs", - packagePath() + File.separatorChar + "header", - "PrefixSeparatorIterator.kt")); - supportingFiles.add(new SupportingFile( - "src/test/kotlin/packagename/header/SchemaHeaderTest.hbs", - testPackagePath() + File.separatorChar + "header", - "SchemaHeaderTest.kt")); - supportingFiles.add(new SupportingFile( - "src/test/kotlin/packagename/header/ContentHeaderTest.hbs", - testPackagePath() + File.separatorChar + "header", - "ContentHeaderTest.kt")); - - // parameter - supportingFiles.add(new SupportingFile( - "src/main/kotlin/packagename/parameter/ContentParameter.hbs", - packagePath() + File.separatorChar + "parameter", - "ContentParameter.kt")); - supportingFiles.add(new SupportingFile( - "src/main/kotlin/packagename/parameter/CookieSerializer.hbs", - packagePath() + File.separatorChar + "parameter", - "CookieSerializer.kt")); - supportingFiles.add(new SupportingFile( - "src/main/kotlin/packagename/parameter/HeadersSerializer.hbs", - packagePath() + File.separatorChar + "parameter", - "HeadersSerializer.kt")); - supportingFiles.add(new SupportingFile( - "src/main/kotlin/packagename/parameter/Parameter.hbs", - packagePath() + File.separatorChar + "parameter", - "Parameter.kt")); - supportingFiles.add(new SupportingFile( - "src/main/kotlin/packagename/parameter/ParameterBase.hbs", - packagePath() + File.separatorChar + "parameter", - "ParameterBase.kt")); - supportingFiles.add(new SupportingFile( - "src/main/kotlin/packagename/parameter/ParameterInType.hbs", - packagePath() + File.separatorChar + "parameter", - "ParameterInType.kt")); - supportingFiles.add(new SupportingFile( - "src/main/kotlin/packagename/parameter/ParameterStyle.hbs", - packagePath() + File.separatorChar + "parameter", - "ParameterStyle.kt")); - supportingFiles.add(new SupportingFile( - "src/main/kotlin/packagename/parameter/PathSerializer.hbs", - packagePath() + File.separatorChar + "parameter", - "PathSerializer.kt")); - supportingFiles.add(new SupportingFile( - "src/main/kotlin/packagename/parameter/QuerySerializer.hbs", - packagePath() + File.separatorChar + "parameter", - "QuerySerializer.kt")); - supportingFiles.add(new SupportingFile( - "src/main/kotlin/packagename/parameter/SchemaParameter.hbs", - packagePath() + File.separatorChar + "parameter", - "SchemaParameter.kt")); - supportingFiles.add(new SupportingFile( - "src/test/kotlin/packagename/parameter/CookieSerializerTest.hbs", - testPackagePath() + File.separatorChar + "parameter", - "CookieSerializerTest.kt")); - supportingFiles.add(new SupportingFile( - "src/test/kotlin/packagename/parameter/HeadersSerializerTest.hbs", - testPackagePath() + File.separatorChar + "parameter", - "HeadersSerializerTest.kt")); - supportingFiles.add(new SupportingFile( - "src/test/kotlin/packagename/parameter/PathSerializerTest.hbs", - testPackagePath() + File.separatorChar + "parameter", - "PathSerializerTest.kt")); - supportingFiles.add(new SupportingFile( - "src/test/kotlin/packagename/parameter/QuerySerializerTest.hbs", - testPackagePath() + File.separatorChar + "parameter", - "QuerySerializerTest.kt")); - supportingFiles.add(new SupportingFile( - "src/test/kotlin/packagename/parameter/SchemaNonQueryParameterTest.hbs", - testPackagePath() + File.separatorChar + "parameter", - "SchemaNonQueryParameterTest.kt")); - supportingFiles.add(new SupportingFile( - "src/test/kotlin/packagename/parameter/SchemaQueryParameterTest.hbs", - testPackagePath() + File.separatorChar + "parameter", - "SchemaQueryParameterTest.kt")); - // apiclient - supportingFiles.add(new SupportingFile( - "src/main/kotlin/packagename/apiclient/ApiClient.hbs", - packagePath() + File.separatorChar + "apiclient", - "ApiClient.kt")); - // restclient - supportingFiles.add(new SupportingFile( - "src/main/kotlin/packagename/restclient/RestClient.hbs", - packagePath() + File.separatorChar + "restclient", - "RestClient.kt")); - - // response - supportingFiles.add(new SupportingFile( - "src/main/kotlin/packagename/response/ApiResponse.hbs", - packagePath() + File.separatorChar + "response", - "ApiResponse.kt")); - supportingFiles.add(new SupportingFile( - "src/main/kotlin/packagename/response/DeserializedHttpResponse.hbs", - packagePath() + File.separatorChar + "response", - "DeserializedHttpResponse.kt")); - supportingFiles.add(new SupportingFile( - "src/main/kotlin/packagename/response/HeadersDeserializer.hbs", - packagePath() + File.separatorChar + "response", - "HeadersDeserializer.kt")); - supportingFiles.add(new SupportingFile( - "src/main/kotlin/packagename/response/ResponseDeserializer.hbs", - packagePath() + File.separatorChar + "response", - "ResponseDeserializer.kt")); - supportingFiles.add(new SupportingFile( - "src/main/kotlin/packagename/response/ResponsesDeserializer.hbs", - packagePath() + File.separatorChar + "response", - "ResponsesDeserializer.kt")); - supportingFiles.add(new SupportingFile( - "src/test/kotlin/packagename/response/ResponseDeserializerTest.hbs", - testPackagePath() + File.separatorChar + "response", - "ResponseDeserializerTest.kt")); // jsonPaths // requestbodies @@ -1146,7 +1019,7 @@ public String escapeUnsafeCharacters(String value) { } String nullChar = "\0"; if (stringValue.contains(nullChar)) { - stringValue = stringValue.replace(nullChar, "\\0"); + stringValue = stringValue.replace(nullChar, "\\u0000"); } String doubleQuoteChar = "\""; if (stringValue.contains(doubleQuoteChar)) { @@ -1166,7 +1039,11 @@ public String escapeUnsafeCharacters(String value) { } String formFeed = "\f"; if (stringValue.contains(formFeed)) { - stringValue = stringValue.replace(formFeed, "\\f"); + stringValue = stringValue.replace(formFeed, "\\u000C"); + } + String dollarSign = "$"; + if (stringValue.contains(dollarSign)) { + stringValue = stringValue.replace(dollarSign, "\\$"); } return stringValue; } @@ -1462,22 +1339,17 @@ private Set getDeeperImports(String sourceJsonPath, CodegenSchema schema } if (schema.types != null) { if (schema.types.contains("array")) { - imports.add("import java.util.List;"); - imports.add("import "+ generatorSettings.packageName + ".schemas.validation.FrozenList;"); + imports.add("import "+ generatorSettings.packageName + ".schemas.validation.FrozenList"); if (schema.items != null) { imports.addAll(getDeeperImports(sourceJsonPath, schema.items)); } } if (schema.types.contains("object")) { - imports.add("import java.util.Map;"); - imports.add("import "+ generatorSettings.packageName + ".schemas.validation.FrozenMap;"); + imports.add("import "+ generatorSettings.packageName + ".schemas.validation.FrozenMap"); if (schema.mapValueSchema != null) { imports.addAll(getDeeperImports(sourceJsonPath, schema.mapValueSchema)); } } - } else { - imports.add("import java.util.List;"); - imports.add("import java.util.Map;"); } return imports; } @@ -1574,97 +1446,84 @@ public Set getImports(String sourceJsonPath, CodegenSchema schema, Featu } if (schema.refInfo != null) { // todo remove this when ref is supported with adjacent properties - imports.add("import org.checkerframework.checker.nullness.qual.Nullable;"); return imports; } if (schema.types != null) { if (schema.types.size() == 1) { if (schema.types.contains("boolean")) { if (schema.isSimpleBoolean()) { - imports.add("import "+ generatorSettings.packageName + ".schemas.BooleanJsonSchema;"); - imports.add("import org.checkerframework.checker.nullness.qual.Nullable;"); + imports.add("import "+ generatorSettings.packageName + ".schemas.BooleanJsonSchema"); } else { addCustomSchemaImports(imports, schema); - imports.add("import java.util.Set;"); addBooleanSchemaImports(imports, schema); } } else if (schema.types.contains("null")) { if (schema.isSimpleNull()) { - imports.add("import "+generatorSettings.packageName + ".schemas.NullJsonSchema;"); - imports.add("import org.checkerframework.checker.nullness.qual.Nullable;"); + imports.add("import "+generatorSettings.packageName + ".schemas.NullJsonSchema"); } else { addCustomSchemaImports(imports, schema); - imports.add("import java.util.Set;"); addNullSchemaImports(imports, schema); } } else if (schema.types.contains("integer")) { if (schema.isSimpleInteger()) { - imports.add("import org.checkerframework.checker.nullness.qual.Nullable;"); if (schema.format == null || schema.format.equals("int")) { - imports.add("import "+generatorSettings.packageName + ".schemas.IntJsonSchema;"); + imports.add("import "+generatorSettings.packageName + ".schemas.IntJsonSchema"); } else if (schema.format.equals("int32")) { - imports.add("import "+generatorSettings.packageName + ".schemas.Int32JsonSchema;"); + imports.add("import "+generatorSettings.packageName + ".schemas.Int32JsonSchema"); } else if (schema.format.equals("int64")) { - imports.add("import "+generatorSettings.packageName + ".schemas.Int64JsonSchema;"); + imports.add("import "+generatorSettings.packageName + ".schemas.Int64JsonSchema"); } } else { addCustomSchemaImports(imports, schema); - imports.add("import java.util.Set;"); addNumberSchemaImports(imports, schema); } } else if (schema.types.contains("number")) { if (schema.isSimpleNumber()) { - imports.add("import org.checkerframework.checker.nullness.qual.Nullable;"); if (schema.format == null) { - imports.add("import "+generatorSettings.packageName + ".schemas.NumberJsonSchema;"); + imports.add("import "+generatorSettings.packageName + ".schemas.NumberJsonSchema"); } else if (schema.format.equals("int32")) { - imports.add("import "+generatorSettings.packageName + ".schemas.Int32JsonSchema;"); + imports.add("import "+generatorSettings.packageName + ".schemas.Int32JsonSchema"); } else if (schema.format.equals("int64")) { - imports.add("import "+generatorSettings.packageName + ".schemas.Int64JsonSchema;"); + imports.add("import "+generatorSettings.packageName + ".schemas.Int64JsonSchema"); } else if (schema.format.equals("float")) { - imports.add("import "+generatorSettings.packageName + ".schemas.FloatJsonSchema;"); + imports.add("import "+generatorSettings.packageName + ".schemas.FloatJsonSchema"); } else if (schema.format.equals("double")) { - imports.add("import "+generatorSettings.packageName + ".schemas.DoubleJsonSchema;"); + imports.add("import "+generatorSettings.packageName + ".schemas.DoubleJsonSchema"); } } else { addCustomSchemaImports(imports, schema); - imports.add("import java.util.Set;"); addNumberSchemaImports(imports, schema); } } else if (schema.types.contains("string")) { if (schema.isSimpleString()) { - imports.add("import org.checkerframework.checker.nullness.qual.Nullable;"); if (schema.format == null) { - imports.add("import "+generatorSettings.packageName + ".schemas.StringJsonSchema;"); + imports.add("import "+generatorSettings.packageName + ".schemas.StringJsonSchema"); } else if (schema.format.equals("date")) { - imports.add("import "+generatorSettings.packageName + ".schemas.DateJsonSchema;"); + imports.add("import "+generatorSettings.packageName + ".schemas.DateJsonSchema"); } else if (schema.format.equals("date-time")) { - imports.add("import "+generatorSettings.packageName + ".schemas.DateTimeJsonSchema;"); + imports.add("import "+generatorSettings.packageName + ".schemas.DateTimeJsonSchema"); } else if (schema.format.equals("number")) { - imports.add("import "+generatorSettings.packageName + ".schemas.DecimalJsonSchema;"); + imports.add("import "+generatorSettings.packageName + ".schemas.DecimalJsonSchema"); } else if (schema.format.equals("uuid")) { - imports.add("import "+generatorSettings.packageName + ".schemas.UuidJsonSchema;"); + imports.add("import "+generatorSettings.packageName + ".schemas.UuidJsonSchema"); } else if (schema.format.equals("byte")) { // todo implement this - imports.add("import "+generatorSettings.packageName + ".schemas.StringJsonSchema;"); + imports.add("import "+generatorSettings.packageName + ".schemas.StringJsonSchema"); } else if (schema.format.equals("binary")) { // todo implement this - imports.add("import "+generatorSettings.packageName + ".schemas.StringJsonSchema;"); + imports.add("import "+generatorSettings.packageName + ".schemas.StringJsonSchema"); } } else { addCustomSchemaImports(imports, schema); - imports.add("import java.util.Set;"); addStringSchemaImports(imports, schema); } } else if (schema.types.contains("object")) { if (schema.isSimpleObject()) { - imports.add("import org.checkerframework.checker.nullness.qual.Nullable;"); - imports.add("import "+generatorSettings.packageName + ".schemas.MapJsonSchema;"); + imports.add("import "+generatorSettings.packageName + ".schemas.MapJsonSchema"); // add this in case the 1 higher schema is an array of FrozenMap - imports.add("import "+generatorSettings.packageName + ".schemas.validation.FrozenMap;"); + imports.add("import "+generatorSettings.packageName + ".schemas.validation.FrozenMap"); } else { addCustomSchemaImports(imports, schema); - imports.add("import java.util.Set;"); addMapSchemaImports(imports, schema); if (schema.mapValueSchema != null) { imports.addAll(getDeeperImports(sourceJsonPath, schema.mapValueSchema)); @@ -1672,13 +1531,11 @@ public Set getImports(String sourceJsonPath, CodegenSchema schema, Featu } } else if (schema.types.contains("array")) { if (schema.isSimpleArray()) { - imports.add("import org.checkerframework.checker.nullness.qual.Nullable;"); - imports.add("import "+generatorSettings.packageName + ".schemas.ListJsonSchema;"); + imports.add("import "+generatorSettings.packageName + ".schemas.ListJsonSchema"); // add this in case the 1 higher schema is a map of FrozenList - imports.add("import "+generatorSettings.packageName + ".schemas.validation.FrozenList;"); + imports.add("import "+generatorSettings.packageName + ".schemas.validation.FrozenList"); } else { addCustomSchemaImports(imports, schema); - imports.add("import java.util.Set;"); addListSchemaImports(imports, schema); if (schema.items != null) { imports.addAll(getDeeperImports(sourceJsonPath, schema.items)); @@ -1687,7 +1544,6 @@ public Set getImports(String sourceJsonPath, CodegenSchema schema, Featu } } else if (schema.types.size() > 1) { addCustomSchemaImports(imports, schema); - imports.add("import java.util.Set;"); if (schema.types.contains("string")) { addStringSchemaImports(imports, schema); } @@ -1716,37 +1572,27 @@ public Set getImports(String sourceJsonPath, CodegenSchema schema, Featu } else { // no types if (schema.isBooleanSchemaTrue) { - imports.add("import org.checkerframework.checker.nullness.qual.Nullable;"); - imports.add("import "+generatorSettings.packageName + ".schemas.AnyTypeJsonSchema;"); + imports.add("import "+generatorSettings.packageName + ".schemas.AnyTypeJsonSchema"); } else if (schema.isBooleanSchemaFalse) { - imports.add("import org.checkerframework.checker.nullness.qual.Nullable;"); - imports.add("import "+generatorSettings.packageName + ".schemas.NotAnyTypeJsonSchema;"); + imports.add("import "+generatorSettings.packageName + ".schemas.NotAnyTypeJsonSchema"); } else if (schema.isSimpleAnyType()) { - imports.add("import org.checkerframework.checker.nullness.qual.Nullable;"); - imports.add("import "+generatorSettings.packageName + ".schemas.AnyTypeJsonSchema;"); + imports.add("import "+generatorSettings.packageName + ".schemas.AnyTypeJsonSchema"); // in case higher schema is ListBuilder add List + Map } else { addCustomSchemaImports(imports, schema); - imports.add("import java.time.LocalDate;"); - imports.add("import java.time.ZonedDateTime;"); - imports.add("import java.util.UUID;"); - imports.add("import "+generatorSettings.packageName + ".schemas.validation.FrozenList;"); - imports.add("import java.util.List;"); - imports.add("import "+generatorSettings.packageName + ".schemas.validation.FrozenMap;"); - imports.add("import java.util.Map;"); - imports.add("import "+generatorSettings.packageName + ".schemas.validation.NullSchemaValidator;"); - imports.add("import "+generatorSettings.packageName + ".schemas.validation.BooleanSchemaValidator;"); - imports.add("import "+generatorSettings.packageName + ".schemas.validation.NumberSchemaValidator;"); - imports.add("import "+generatorSettings.packageName + ".schemas.validation.StringSchemaValidator;"); - imports.add("import "+generatorSettings.packageName + ".schemas.validation.ListSchemaValidator;"); - imports.add("import "+generatorSettings.packageName + ".schemas.validation.MapSchemaValidator;"); - imports.add("import java.util.LinkedHashMap;"); - imports.add("import java.util.ArrayList;"); // for validate + imports.add("import java.time.LocalDate"); + imports.add("import java.time.ZonedDateTime"); + imports.add("import java.util.UUID"); + imports.add("import "+generatorSettings.packageName + ".schemas.validation.FrozenList"); + imports.add("import "+generatorSettings.packageName + ".schemas.validation.FrozenMap"); + imports.add("import "+generatorSettings.packageName + ".schemas.validation.NullSchemaValidator"); + imports.add("import "+generatorSettings.packageName + ".schemas.validation.BooleanSchemaValidator"); + imports.add("import "+generatorSettings.packageName + ".schemas.validation.NumberSchemaValidator"); + imports.add("import "+generatorSettings.packageName + ".schemas.validation.StringSchemaValidator"); + imports.add("import "+generatorSettings.packageName + ".schemas.validation.ListSchemaValidator"); + imports.add("import "+generatorSettings.packageName + ".schemas.validation.MapSchemaValidator"); addPropertiesImports(schema, imports); addRequiredValidator(schema, imports); - addAllOfValidator(schema, imports); - addAnyOfValidator(schema, imports); - addOneOfValidator(schema, imports); addEnumValidator(schema, imports); addConstImports(schema, imports); addPatternValidator(schema, imports); @@ -1754,7 +1600,6 @@ public Set getImports(String sourceJsonPath, CodegenSchema schema, Featu addAdditionalPropertiesImports(schema, imports); addDefaultValueImport(schema, imports); addDependentRequiredImports(schema, imports); - addDependentSchemasImports(schema, imports); addPatternPropertiesImports(schema, imports); if (schema.mapValueSchema != null) { imports.addAll(getDeeperImports(sourceJsonPath, schema.mapValueSchema)); @@ -1763,8 +1608,8 @@ public Set getImports(String sourceJsonPath, CodegenSchema schema, Featu imports.addAll(getDeeperImports(sourceJsonPath, schema.items)); } if (schema.additionalProperties == null || !schema.additionalProperties.isBooleanSchemaFalse) { - imports.add("import "+generatorSettings.packageName + ".exceptions.UnsetPropertyException;"); - imports.add("import "+generatorSettings.packageName + ".exceptions.InvalidAdditionalPropertyException;"); + imports.add("import "+generatorSettings.packageName + ".exceptions.UnsetPropertyException"); + imports.add("import "+generatorSettings.packageName + ".exceptions.InvalidAdditionalPropertyException"); } } } @@ -1773,51 +1618,50 @@ public Set getImports(String sourceJsonPath, CodegenSchema schema, Featu private void addPatternValidator(CodegenSchema schema, Set imports) { if (schema.patternInfo != null) { - imports.add("import java.util.regex.Pattern;"); + imports.add("import java.util.regex.Pattern"); } } private void addDefaultValueImport(CodegenSchema schema, Set imports) { if (schema.defaultValue != null) { - imports.add("import "+generatorSettings.packageName + ".schemas.validation.DefaultValueMethod;"); + imports.add("import "+generatorSettings.packageName + ".schemas.validation.DefaultValueMethod"); } } private void addEnumValidator(CodegenSchema schema, Set imports) { if (schema.enumInfo != null) { - imports.add("import "+generatorSettings.packageName + ".schemas.SetMaker;"); if (schema.enumInfo.typeToValues.containsKey("null")) { - imports.add("import "+generatorSettings.packageName + ".schemas.validation.NullEnumValidator;"); - imports.add("import "+generatorSettings.packageName + ".schemas.validation.NullValueMethod;"); + imports.add("import "+generatorSettings.packageName + ".schemas.validation.NullEnumValidator"); + imports.add("import "+generatorSettings.packageName + ".schemas.validation.NullValueMethod"); } if (schema.enumInfo.typeToValues.containsKey("boolean")) { - imports.add("import "+generatorSettings.packageName + ".schemas.validation.BooleanEnumValidator;"); - imports.add("import "+generatorSettings.packageName + ".schemas.validation.BooleanValueMethod;"); + imports.add("import "+generatorSettings.packageName + ".schemas.validation.BooleanEnumValidator"); + imports.add("import "+generatorSettings.packageName + ".schemas.validation.BooleanValueMethod"); } if (schema.enumInfo.typeToValues.containsKey("string")) { - imports.add("import "+generatorSettings.packageName + ".schemas.validation.StringEnumValidator;"); - imports.add("import "+generatorSettings.packageName + ".schemas.validation.StringValueMethod;"); + imports.add("import "+generatorSettings.packageName + ".schemas.validation.StringEnumValidator"); + imports.add("import "+generatorSettings.packageName + ".schemas.validation.StringValueMethod"); } if (schema.enumInfo.typeToValues.containsKey("Integer")) { - imports.add("import java.math.BigDecimal;"); - imports.add("import "+generatorSettings.packageName + ".schemas.validation.IntegerEnumValidator;"); - imports.add("import "+generatorSettings.packageName + ".schemas.validation.IntegerValueMethod;"); + imports.add("import java.math.BigDecimal"); + imports.add("import "+generatorSettings.packageName + ".schemas.validation.IntegerEnumValidator"); + imports.add("import "+generatorSettings.packageName + ".schemas.validation.IntegerValueMethod"); } if (schema.enumInfo.typeToValues.containsKey("Long")) { - imports.add("import java.math.BigDecimal;"); - imports.add("import "+generatorSettings.packageName + ".schemas.validation.LongEnumValidator;"); - imports.add("import "+generatorSettings.packageName + ".schemas.validation.LongValueMethod;"); + imports.add("import java.math.BigDecimal"); + imports.add("import "+generatorSettings.packageName + ".schemas.validation.LongEnumValidator"); + imports.add("import "+generatorSettings.packageName + ".schemas.validation.LongValueMethod"); } if (schema.enumInfo.typeToValues.containsKey("Float")) { - imports.add("import java.math.BigDecimal;"); - imports.add("import "+generatorSettings.packageName + ".schemas.validation.FloatEnumValidator;"); - imports.add("import "+generatorSettings.packageName + ".schemas.validation.FloatValueMethod;"); + imports.add("import java.math.BigDecimal"); + imports.add("import "+generatorSettings.packageName + ".schemas.validation.FloatEnumValidator"); + imports.add("import "+generatorSettings.packageName + ".schemas.validation.FloatValueMethod"); } if (schema.enumInfo.typeToValues.containsKey("Double")) { - imports.add("import java.math.BigDecimal;"); - imports.add("import "+generatorSettings.packageName + ".schemas.validation.DoubleEnumValidator;"); - imports.add("import "+generatorSettings.packageName + ".schemas.validation.DoubleValueMethod;"); + imports.add("import java.math.BigDecimal"); + imports.add("import "+generatorSettings.packageName + ".schemas.validation.DoubleEnumValidator"); + imports.add("import "+generatorSettings.packageName + ".schemas.validation.DoubleValueMethod"); } } } @@ -1825,187 +1669,128 @@ private void addEnumValidator(CodegenSchema schema, Set imports) { private void addConstImports(CodegenSchema schema, Set imports) { if (schema.constInfo != null) { if (schema.constInfo.typeToValues.containsKey("null")) { - imports.add("import "+generatorSettings.packageName + ".schemas.validation.NullEnumValidator;"); - imports.add("import "+generatorSettings.packageName + ".schemas.validation.NullValueMethod;"); + imports.add("import "+generatorSettings.packageName + ".schemas.validation.NullEnumValidator"); + imports.add("import "+generatorSettings.packageName + ".schemas.validation.NullValueMethod"); } if (schema.constInfo.typeToValues.containsKey("boolean")) { - imports.add("import "+generatorSettings.packageName + ".schemas.validation.BooleanEnumValidator;"); - imports.add("import "+generatorSettings.packageName + ".schemas.validation.BooleanValueMethod;"); + imports.add("import "+generatorSettings.packageName + ".schemas.validation.BooleanEnumValidator"); + imports.add("import "+generatorSettings.packageName + ".schemas.validation.BooleanValueMethod"); } if (schema.constInfo.typeToValues.containsKey("string")) { - imports.add("import "+generatorSettings.packageName + ".schemas.validation.StringEnumValidator;"); - imports.add("import "+generatorSettings.packageName + ".schemas.validation.StringValueMethod;"); + imports.add("import "+generatorSettings.packageName + ".schemas.validation.StringEnumValidator"); + imports.add("import "+generatorSettings.packageName + ".schemas.validation.StringValueMethod"); } if (schema.constInfo.typeToValues.containsKey("Integer")) { - imports.add("import java.math.BigDecimal;"); - imports.add("import "+generatorSettings.packageName + ".schemas.validation.IntegerEnumValidator;"); - imports.add("import "+generatorSettings.packageName + ".schemas.validation.IntegerValueMethod;"); + imports.add("import java.math.BigDecimal"); + imports.add("import "+generatorSettings.packageName + ".schemas.validation.IntegerEnumValidator"); + imports.add("import "+generatorSettings.packageName + ".schemas.validation.IntegerValueMethod"); } if (schema.constInfo.typeToValues.containsKey("Long")) { - imports.add("import java.math.BigDecimal;"); - imports.add("import "+generatorSettings.packageName + ".schemas.validation.LongEnumValidator;"); - imports.add("import "+generatorSettings.packageName + ".schemas.validation.LongValueMethod;"); + imports.add("import java.math.BigDecimal"); + imports.add("import "+generatorSettings.packageName + ".schemas.validation.LongEnumValidator"); + imports.add("import "+generatorSettings.packageName + ".schemas.validation.LongValueMethod"); } if (schema.constInfo.typeToValues.containsKey("Float")) { - imports.add("import java.math.BigDecimal;"); - imports.add("import "+generatorSettings.packageName + ".schemas.validation.FloatEnumValidator;"); - imports.add("import "+generatorSettings.packageName + ".schemas.validation.FloatValueMethod;"); + imports.add("import java.math.BigDecimal"); + imports.add("import "+generatorSettings.packageName + ".schemas.validation.FloatEnumValidator"); + imports.add("import "+generatorSettings.packageName + ".schemas.validation.FloatValueMethod"); } if (schema.constInfo.typeToValues.containsKey("Double")) { - imports.add("import java.math.BigDecimal;"); - imports.add("import "+generatorSettings.packageName + ".schemas.validation.DoubleEnumValidator;"); - imports.add("import "+generatorSettings.packageName + ".schemas.validation.DoubleValueMethod;"); + imports.add("import java.math.BigDecimal"); + imports.add("import "+generatorSettings.packageName + ".schemas.validation.DoubleEnumValidator"); + imports.add("import "+generatorSettings.packageName + ".schemas.validation.DoubleValueMethod"); } } } private void addPropertiesImports(CodegenSchema schema, Set imports) { if (schema.properties != null) { - imports.add("import " + generatorSettings.packageName + ".schemas.validation.PropertyEntry;"); - imports.add("import java.util.Map;"); - imports.add("import java.util.Set;"); - imports.add("import " + generatorSettings.packageName + ".exceptions.UnsetPropertyException;"); - imports.add("import " + generatorSettings.packageName + ".schemas.GenericBuilder;"); + imports.add("import " + generatorSettings.packageName + ".exceptions.UnsetPropertyException"); + imports.add("import " + generatorSettings.packageName + ".schemas.GenericBuilder"); } } private void addPatternPropertiesImports(CodegenSchema schema, Set imports) { if (schema.patternProperties != null) { - imports.add("import java.util.AbstractMap;"); - imports.add("import java.util.Map;"); - imports.add("import java.util.regex.Pattern;"); - } - } - - private void addDependentSchemasImports(CodegenSchema schema, Set imports) { - if (schema.dependentSchemas != null) { - imports.add("import " + generatorSettings.packageName + ".schemas.validation.PropertyEntry;"); - imports.add("import java.util.Map;"); + imports.add("import java.util.AbstractMap"); + imports.add("import java.util.regex.Pattern"); } } private void addDependentRequiredImports(CodegenSchema schema, Set imports) { if (schema.dependentRequired != null) { - imports.add("import "+generatorSettings.packageName + ".schemas.validation.MapUtils;"); - imports.add("import java.util.AbstractMap;"); - imports.add("import "+generatorSettings.packageName + ".schemas.SetMaker;"); - } - } - - private void addAllOfValidator(CodegenSchema schema, Set imports) { - if (schema.allOf != null) { - imports.add("import java.util.List;"); - } - } - - private void addAnyOfValidator(CodegenSchema schema, Set imports) { - if (schema.anyOf != null) { - imports.add("import java.util.List;"); - } - } - - private void addOneOfValidator(CodegenSchema schema, Set imports) { - if (schema.oneOf != null) { - imports.add("import java.util.List;"); + imports.add("import "+generatorSettings.packageName + ".schemas.validation.MapUtils"); + imports.add("import java.util.AbstractMap"); } } private void addAdditionalPropertiesImports(CodegenSchema schema, Set imports) { if (schema.additionalProperties == null || !schema.additionalProperties.isBooleanSchemaFalse) { - imports.add("import "+generatorSettings.packageName + ".exceptions.UnsetPropertyException;"); - imports.add("import "+generatorSettings.packageName + ".exceptions.InvalidAdditionalPropertyException;"); + imports.add("import "+generatorSettings.packageName + ".exceptions.UnsetPropertyException"); + imports.add("import "+generatorSettings.packageName + ".exceptions.InvalidAdditionalPropertyException"); } if (schema.additionalProperties != null) { - imports.add("import "+generatorSettings.packageName + ".schemas.GenericBuilder;"); - imports.add("import "+generatorSettings.packageName + ".schemas.validation.MapUtils;"); + imports.add("import "+generatorSettings.packageName + ".schemas.GenericBuilder"); + imports.add("import "+generatorSettings.packageName + ".schemas.validation.MapUtils"); } else { - imports.add("import "+generatorSettings.packageName + ".schemas.UnsetAddPropsSetter;"); + imports.add("import "+generatorSettings.packageName + ".schemas.UnsetAddPropsSetter"); } } private void addRequiredValidator(CodegenSchema schema, Set imports) { if (schema.requiredProperties != null) { - imports.add("import java.util.Set;"); - imports.add("import "+generatorSettings.packageName + ".schemas.GenericBuilder;"); + imports.add("import "+generatorSettings.packageName + ".schemas.GenericBuilder"); } } private void addMultipleOfValidator(CodegenSchema schema, Set imports) { if (schema.multipleOf != null) { - imports.add("import java.math.BigDecimal;"); + imports.add("import java.math.BigDecimal"); } } private void addCustomSchemaImports(Set imports, CodegenSchema schema) { - imports.add("import " + generatorSettings.packageName + ".schemas.validation.JsonSchema;"); - imports.add("import " + generatorSettings.packageName + ".schemas.validation.JsonSchemaInfo;"); - imports.add("import "+generatorSettings.packageName + ".configurations.SchemaConfiguration;"); - imports.add("import "+generatorSettings.packageName + ".exceptions.ValidationException;"); - imports.add("import java.util.Set;"); // for validate - imports.add("import java.util.HashSet;"); // for validate - imports.add("import java.util.Objects;"); // for validate - imports.add("import java.util.LinkedHashSet;"); // for validate - imports.add("import java.util.List;"); // for castToAllowedTypes - imports.add("import "+generatorSettings.packageName + ".schemas.validation.PathToSchemasMap;"); // for getNewInstance - imports.add("import "+generatorSettings.packageName + ".schemas.validation.ValidationMetadata;"); // for getNewInstance - imports.add("import "+generatorSettings.packageName + ".configurations.JsonSchemaKeywordFlags;"); // for getNewInstance - imports.add("import org.checkerframework.checker.nullness.qual.Nullable;"); + imports.add("import " + generatorSettings.packageName + ".schemas.validation.JsonSchema"); + imports.add("import " + generatorSettings.packageName + ".schemas.validation.JsonSchemaInfo"); + imports.add("import "+generatorSettings.packageName + ".configurations.SchemaConfiguration"); + imports.add("import "+generatorSettings.packageName + ".exceptions.ValidationException"); + imports.add("import "+generatorSettings.packageName + ".schemas.validation.PathToSchemasMap"); // for getNewInstance + imports.add("import "+generatorSettings.packageName + ".schemas.validation.ValidationMetadata"); // for getNewInstance + imports.add("import "+generatorSettings.packageName + ".configurations.JsonSchemaKeywordFlags"); // for getNewInstance } private void addBooleanSchemaImports(Set imports, CodegenSchema schema) { - imports.add("import " + generatorSettings.packageName + ".schemas.validation.BooleanSchemaValidator;"); - addAllOfValidator(schema, imports); - addAnyOfValidator(schema, imports); - addOneOfValidator(schema, imports); + imports.add("import " + generatorSettings.packageName + ".schemas.validation.BooleanSchemaValidator"); addEnumValidator(schema, imports); addDefaultValueImport(schema, imports); addConstImports(schema, imports); } private void addNullSchemaImports(Set imports, CodegenSchema schema) { - imports.add("import " + generatorSettings.packageName + ".schemas.validation.NullSchemaValidator;"); - addAllOfValidator(schema, imports); - addAnyOfValidator(schema, imports); - addOneOfValidator(schema, imports); + imports.add("import " + generatorSettings.packageName + ".schemas.validation.NullSchemaValidator"); addEnumValidator(schema, imports); addDefaultValueImport(schema, imports); addConstImports(schema, imports); } private void addMapSchemaImports(Set imports, CodegenSchema schema) { - imports.add("import " + generatorSettings.packageName + ".schemas.validation.MapSchemaValidator;"); - imports.add("import "+generatorSettings.packageName + ".schemas.validation.FrozenMap;"); - imports.add("import java.util.Map;"); - imports.add("import java.util.ArrayList;"); // for castToAllowedTypes - imports.add("import java.util.LinkedHashMap;"); + imports.add("import " + generatorSettings.packageName + ".schemas.validation.MapSchemaValidator"); + imports.add("import "+generatorSettings.packageName + ".schemas.validation.FrozenMap"); addRequiredValidator(schema, imports); addPropertiesImports(schema, imports); - addAllOfValidator(schema, imports); - addAnyOfValidator(schema, imports); - addOneOfValidator(schema, imports); addAdditionalPropertiesImports(schema, imports); addDependentRequiredImports(schema, imports); - addDependentSchemasImports(schema, imports); addPatternPropertiesImports(schema, imports); } private void addListSchemaImports(Set imports, CodegenSchema schema) { - imports.add("import " + generatorSettings.packageName + ".schemas.validation.ListSchemaValidator;"); - imports.add("import "+generatorSettings.packageName + ".schemas.validation.FrozenList;"); - imports.add("import java.util.List;"); - imports.add("import java.util.ArrayList;"); // for castToAllowedTypes - imports.add("import java.util.LinkedHashMap;"); - addAllOfValidator(schema, imports); - addAnyOfValidator(schema, imports); - addOneOfValidator(schema, imports); + imports.add("import " + generatorSettings.packageName + ".schemas.validation.ListSchemaValidator"); + imports.add("import "+generatorSettings.packageName + ".schemas.validation.FrozenList"); } private void addNumberSchemaImports(Set imports, CodegenSchema schema) { - imports.add("import " + generatorSettings.packageName + ".schemas.validation.NumberSchemaValidator;"); - addAllOfValidator(schema, imports); - addAnyOfValidator(schema, imports); - addOneOfValidator(schema, imports); + imports.add("import " + generatorSettings.packageName + ".schemas.validation.NumberSchemaValidator"); addEnumValidator(schema, imports); addMultipleOfValidator(schema, imports); addDefaultValueImport(schema, imports); @@ -2016,20 +1801,17 @@ private void addStringSchemaImports(Set imports, CodegenSchema schema) { if (schema.format != null) { switch (schema.format) { case "date": - imports.add("import java.time.LocalDate;"); + imports.add("import java.time.LocalDate"); break; case "date-time": - imports.add("import java.time.ZonedDateTime;"); + imports.add("import java.time.ZonedDateTime"); break; case "uuid": - imports.add("import java.util.UUID;"); + imports.add("import java.util.UUID"); break; } } - imports.add("import " + generatorSettings.packageName + ".schemas.validation.StringSchemaValidator;"); - addAllOfValidator(schema, imports); - addAnyOfValidator(schema, imports); - addOneOfValidator(schema, imports); + imports.add("import " + generatorSettings.packageName + ".schemas.validation.StringSchemaValidator"); addEnumValidator(schema, imports); addPatternValidator(schema, imports); addDefaultValueImport(schema, imports); @@ -2042,20 +1824,20 @@ public String getImport(CodegenRefInfo refInfo) { String prefix = "import " + generatorSettings.packageName + ".components."; if (refInfo.ref instanceof CodegenSchema) { if (refInfo.refModuleAlias == null) { - return "import " + refInfo.refModuleLocation + "." + refInfo.refModule + ";"; + return "import " + refInfo.refModuleLocation + "." + refInfo.refModule; } else { - return "import " + refInfo.refModuleLocation + " import " + refInfo.refModule + " as " + refInfo.refModuleAlias + ";"; + return "import " + refInfo.refModuleLocation + " import " + refInfo.refModule + " as " + refInfo.refModuleAlias; } } else if (refInfo.ref instanceof CodegenRequestBody) { - return prefix + "requestbodies." + refInfo.refModule + ";"; + return prefix + "requestbodies." + refInfo.refModule; } else if (refInfo.ref instanceof CodegenHeader) { - return prefix + "headers." + refInfo.refModule + ";"; + return prefix + "headers." + refInfo.refModule; } else if (refInfo.ref instanceof CodegenResponse) { - return prefix + "responses." + refInfo.refModule + ";"; + return prefix + "responses." + refInfo.refModule; } else if (refInfo.ref instanceof CodegenParameter) { - return prefix + "parameters." + refInfo.refModule + ";"; + return prefix + "parameters." + refInfo.refModule; } else if (refInfo.ref instanceof CodegenSecurityScheme) { - return prefix + "securityschemes." + refInfo.refModule + ";"; + return prefix + "securityschemes." + refInfo.refModule; } return null; } @@ -2158,10 +1940,14 @@ public String toEnumVarName(String value, Schema prop) { matcher = nonWordPattern.matcher(usedValue); while (matcher.find()) { if (matcher.start() == 0) { - // skip adding first because it was already added - continue; + // skip adding first because it was already added for length 1 only + if (matcher.group().length() == 1) { + continue; + } + matchStartToGroup.add(new AbstractMap.SimpleEntry<>(1, matcher.group().substring(1))); + } else { + matchStartToGroup.add(new AbstractMap.SimpleEntry<>(matcher.start(), matcher.group())); } - matchStartToGroup.add(new AbstractMap.SimpleEntry<>(matcher.start(), matcher.group())); } char underscore = '_'; while (!matchStartToGroup.isEmpty()) { @@ -3063,148 +2849,406 @@ public void setOpenAPI(OpenAPI openAPI) { super.setOpenAPI(openAPI); Components components = openAPI.getComponents(); if (components != null && components.getSecuritySchemes() != null) { - supportingFiles.add(new SupportingFile( + addSupportingFiles(CodegenConstants.JSON_PATH_LOCATION_TYPE.SECURITY_SCHEMES); + } + List servers = openAPI.getServers(); + if (servers != null && !servers.isEmpty()) { + addSupportingFiles(CodegenConstants.JSON_PATH_LOCATION_TYPE.SERVERS); + } + boolean pathsExist = openAPI.getPaths() != null && !openAPI.getPaths().isEmpty(); + if (pathsExist) { + addSupportingFiles(CodegenConstants.JSON_PATH_LOCATION_TYPE.PATHS); + } + boolean componentResponsesExist = components != null && components.getResponses() != null && !components.getResponses().isEmpty(); + if (componentResponsesExist || pathsExist) { + addSupportingFiles(CodegenConstants.JSON_PATH_LOCATION_TYPE.RESPONSES); + } + boolean componentRequestBodiesExist = components != null && components.getRequestBodies() != null && !components.getRequestBodies().isEmpty(); + if (componentRequestBodiesExist || pathsExist) { + addSupportingFiles(CodegenConstants.JSON_PATH_LOCATION_TYPE.REQUEST_BODIES); + } + boolean componentParametersExist = components != null && components.getParameters() != null && !components.getParameters().isEmpty(); + if (componentParametersExist || pathsExist) { + addSupportingFiles(CodegenConstants.JSON_PATH_LOCATION_TYPE.PARAMETERS); + } + boolean componentHeadersExist = components != null && components.getHeaders() != null && !components.getHeaders().isEmpty(); + if (componentHeadersExist || pathsExist) { + addSupportingFiles(CodegenConstants.JSON_PATH_LOCATION_TYPE.HEADERS); + } + if (pathsExist || componentHeadersExist || componentParametersExist || componentRequestBodiesExist || componentResponsesExist) { + addSupportingFiles(CodegenConstants.JSON_PATH_LOCATION_TYPE.MEDIA_TYPE); + addSupportingFiles(CodegenConstants.JSON_PATH_LOCATION_TYPE.CONTENT_TYPE); + } + } + + private void addSupportingFiles(CodegenConstants.JSON_PATH_LOCATION_TYPE locationType) { + switch (locationType) { + case SECURITY_SCHEMES: + supportingFiles.add(new SupportingFile( + "src/main/kotlin/packagename/configurations/ApiConfiguration.hbs", + packagePath() + File.separatorChar + "configurations", + "ApiConfiguration.kt")); + supportingFiles.add(new SupportingFile( "src/main/kotlin/packagename/securityrequirementobjects/SecurityRequirementObject.hbs", packagePath() + File.separatorChar + "securityrequirementobjects", "SecurityRequirementObject.kt")); - supportingFiles.add(new SupportingFile( - "src/main/kotlin/packagename/securityrequirementobjects/AuthApplier.hbs", - packagePath() + File.separatorChar + "securityrequirementobjects", - "AuthApplier.kt")); - supportingFiles.add(new SupportingFile( + supportingFiles.add(new SupportingFile( + "src/main/kotlin/packagename/securityrequirementobjects/AuthApplier.hbs", + packagePath() + File.separatorChar + "securityrequirementobjects", + "AuthApplier.kt")); + supportingFiles.add(new SupportingFile( "src/main/kotlin/packagename/securityrequirementobjects/EmptySecurityRequirementObject.hbs", packagePath() + File.separatorChar + "securityrequirementobjects", "EmptySecurityRequirementObject.kt")); - supportingFiles.add(new SupportingFile( + supportingFiles.add(new SupportingFile( "src/main/kotlin/packagename/securityrequirementobjects/SecurityRequirementObjectProvider.hbs", packagePath() + File.separatorChar + "securityrequirementobjects", "SecurityRequirementObjectProvider.kt")); - supportingFiles.add(new SupportingFile( + supportingFiles.add(new SupportingFile( "src/main/kotlin/packagename/securityschemes/SecurityScheme.hbs", packagePath() + File.separatorChar + "securityschemes", "SecurityScheme.kt")); - supportingFiles.add(new SupportingFile( + supportingFiles.add(new SupportingFile( "src/main/kotlin/packagename/securityschemes/ApiKeyCookieSecurityScheme.hbs", packagePath() + File.separatorChar + "securityschemes", "ApiKeyCookieSecurityScheme.kt")); - supportingFiles.add(new SupportingFile( + supportingFiles.add(new SupportingFile( "src/main/kotlin/packagename/securityschemes/ApiKeyHeaderSecurityScheme.hbs", packagePath() + File.separatorChar + "securityschemes", "ApiKeyHeaderSecurityScheme.kt")); - supportingFiles.add(new SupportingFile( + supportingFiles.add(new SupportingFile( "src/main/kotlin/packagename/securityschemes/ApiKeyQuerySecurityScheme.hbs", packagePath() + File.separatorChar + "securityschemes", "ApiKeyQuerySecurityScheme.kt")); - supportingFiles.add(new SupportingFile( + supportingFiles.add(new SupportingFile( "src/main/kotlin/packagename/securityschemes/HttpBasicSecurityScheme.hbs", packagePath() + File.separatorChar + "securityschemes", "HttpBasicSecurityScheme.kt")); - supportingFiles.add(new SupportingFile( + supportingFiles.add(new SupportingFile( "src/main/kotlin/packagename/securityschemes/HttpBearerSecurityScheme.hbs", packagePath() + File.separatorChar + "securityschemes", "HttpBearerSecurityScheme.kt")); - supportingFiles.add(new SupportingFile( + supportingFiles.add(new SupportingFile( "src/main/kotlin/packagename/securityschemes/HttpSignatureSecurityScheme.hbs", packagePath() + File.separatorChar + "securityschemes", "HttpSignatureSecurityScheme.kt")); - supportingFiles.add(new SupportingFile( + supportingFiles.add(new SupportingFile( "src/main/kotlin/packagename/securityschemes/HttpDigestSecurityScheme.hbs", packagePath() + File.separatorChar + "securityschemes", "HttpDigestSecurityScheme.kt")); - supportingFiles.add(new SupportingFile( + supportingFiles.add(new SupportingFile( "src/main/kotlin/packagename/securityschemes/MutualTlsSecurityScheme.hbs", packagePath() + File.separatorChar + "securityschemes", "MutualTlsSecurityScheme.kt")); - supportingFiles.add(new SupportingFile( + supportingFiles.add(new SupportingFile( "src/main/kotlin/packagename/securityschemes/OAuth2SecurityScheme.hbs", packagePath() + File.separatorChar + "securityschemes", "OAuth2SecurityScheme.kt")); - supportingFiles.add(new SupportingFile( + supportingFiles.add(new SupportingFile( "src/main/kotlin/packagename/securityschemes/OpenIdConnectSecurityScheme.hbs", packagePath() + File.separatorChar + "securityschemes", "OpenIdConnectSecurityScheme.kt")); - jsonPathTemplateFiles.put( + jsonPathTemplateFiles.put( CodegenConstants.JSON_PATH_LOCATION_TYPE.SECURITY, new HashMap<>() {{ put("src/main/kotlin/packagename/securityrequirementobjects/SecurityRequirementObjectN.hbs", ".kt"); }} - ); - jsonPathDocTemplateFiles.put( - CodegenConstants.JSON_PATH_LOCATION_TYPE.SECURITY, - new HashMap<>() {{ - put("src/main/kotlin/packagename/securityrequirementobjects/SecurityRequirementObjectNDoc.hbs", ".md"); - }} - ); - jsonPathTemplateFiles.put( + ); + jsonPathDocTemplateFiles.put( + CodegenConstants.JSON_PATH_LOCATION_TYPE.SECURITY, + new HashMap<>() {{ + put("src/main/kotlin/packagename/securityrequirementobjects/SecurityRequirementObjectNDoc.hbs", ".md"); + }} + ); + jsonPathTemplateFiles.put( CodegenConstants.JSON_PATH_LOCATION_TYPE.SECURITIES, new HashMap<>() {{ put("src/main/kotlin/packagename/securityrequirementobjects/SecurityInfo.hbs", ".kt"); }} - ); - jsonPathDocTemplateFiles.put( - CodegenConstants.JSON_PATH_LOCATION_TYPE.SECURITIES, - new HashMap<>() {{ - put("src/main/kotlin/packagename/securityrequirementobjects/SecurityInfoDoc.hbs", ".md"); - }} - ); - jsonPathTemplateFiles.put( + ); + jsonPathDocTemplateFiles.put( + CodegenConstants.JSON_PATH_LOCATION_TYPE.SECURITIES, + new HashMap<>() {{ + put("src/main/kotlin/packagename/securityrequirementobjects/SecurityInfoDoc.hbs", ".md"); + }} + ); + jsonPathTemplateFiles.put( CodegenConstants.JSON_PATH_LOCATION_TYPE.SECURITY_SCHEME, new HashMap<>() {{ put("src/main/kotlin/packagename/components/securityschemes/SecurityScheme.hbs", ".kt"); }} - ); - jsonPathDocTemplateFiles.put( + ); + jsonPathDocTemplateFiles.put( CodegenConstants.JSON_PATH_LOCATION_TYPE.SECURITY_SCHEME, new HashMap<>() {{ put("src/main/kotlin/packagename/components/securityschemes/SecurityScheme_doc.hbs", ".md"); }} - ); - } - List servers = openAPI.getServers(); - if (servers != null && !servers.isEmpty()) { - supportingFiles.add(new SupportingFile( + ); + break; + case SERVERS: + supportingFiles.add(new SupportingFile( "src/main/kotlin/packagename/servers/Server.hbs", packagePath() + File.separatorChar + "servers", "Server.kt")); - supportingFiles.add(new SupportingFile( + supportingFiles.add(new SupportingFile( "src/main/kotlin/packagename/servers/ServerProvider.hbs", packagePath() + File.separatorChar + "servers", "ServerProvider.kt")); - supportingFiles.add(new SupportingFile( + supportingFiles.add(new SupportingFile( "src/main/kotlin/packagename/servers/ServerWithoutVariables.hbs", packagePath() + File.separatorChar + "servers", "ServerWithoutVariables.kt")); - supportingFiles.add(new SupportingFile( + supportingFiles.add(new SupportingFile( "src/main/kotlin/packagename/servers/ServerWithVariables.hbs", packagePath() + File.separatorChar + "servers", "ServerWithVariables.kt")); - jsonPathTemplateFiles.put( + jsonPathTemplateFiles.put( CodegenConstants.JSON_PATH_LOCATION_TYPE.SERVER, new HashMap<>() {{ put("src/main/kotlin/packagename/servers/ServerN.hbs", ".kt"); }} - ); - jsonPathTemplateFiles.put( + ); + jsonPathTemplateFiles.put( CodegenConstants.JSON_PATH_LOCATION_TYPE.SERVERS, new HashMap<>() {{ put("src/main/kotlin/packagename/servers/ServerInfo.hbs", ".kt"); }} - ); - jsonPathDocTemplateFiles.put( - CodegenConstants.JSON_PATH_LOCATION_TYPE.SERVERS, - new HashMap<>() {{ - put("src/main/kotlin/packagename/servers/ServerInfoDoc.hbs", ".md"); - }} - ); - jsonPathDocTemplateFiles.put( + ); + jsonPathDocTemplateFiles.put( + CodegenConstants.JSON_PATH_LOCATION_TYPE.SERVERS, + new HashMap<>() {{ + put("src/main/kotlin/packagename/servers/ServerInfoDoc.hbs", ".md"); + }} + ); + jsonPathDocTemplateFiles.put( CodegenConstants.JSON_PATH_LOCATION_TYPE.SERVER, new HashMap<>() {{ put("src/main/kotlin/packagename/servers/ServerDoc.hbs", ".md"); }} - ); + ); + break; + case PATHS: + supportingFiles.add(new SupportingFile( + "src/main/kotlin/packagename/exceptions/NotImplementedException.hbs", + packagePath() + File.separatorChar + "exceptions", + "NotImplementedException.kt")); + supportingFiles.add(new SupportingFile( + "src/main/kotlin/packagename/exceptions/ApiException.hbs", + packagePath() + File.separatorChar + "exceptions", + "ApiException.kt")); + supportingFiles.add(new SupportingFile( + "src/main/kotlin/packagename/configurations/ApiConfiguration.hbs", + packagePath() + File.separatorChar + "configurations", + "ApiConfiguration.kt")); + supportingFiles.add(new SupportingFile( + "src/main/kotlin/packagename/apiclient/ApiClient.hbs", + packagePath() + File.separatorChar + "apiclient", + "ApiClient.kt")); + // restclient + supportingFiles.add(new SupportingFile( + "src/main/kotlin/packagename/restclient/RestClient.hbs", + packagePath() + File.separatorChar + "restclient", + "RestClient.kt")); + break; + case RESPONSES: + supportingFiles.add(new SupportingFile( + "src/main/kotlin/packagename/exceptions/NotImplementedException.hbs", + packagePath() + File.separatorChar + "exceptions", + "NotImplementedException.kt")); + supportingFiles.add(new SupportingFile( + "src/main/kotlin/packagename/exceptions/ApiException.hbs", + packagePath() + File.separatorChar + "exceptions", + "ApiException.kt")); + supportingFiles.add(new SupportingFile( + "src/main/kotlin/packagename/configurations/ApiConfiguration.hbs", + packagePath() + File.separatorChar + "configurations", + "ApiConfiguration.kt")); + supportingFiles.add(new SupportingFile( + "src/main/kotlin/packagename/response/ApiResponse.hbs", + packagePath() + File.separatorChar + "response", + "ApiResponse.kt")); + supportingFiles.add(new SupportingFile( + "src/main/kotlin/packagename/response/DeserializedHttpResponse.hbs", + packagePath() + File.separatorChar + "response", + "DeserializedHttpResponse.kt")); + supportingFiles.add(new SupportingFile( + "src/main/kotlin/packagename/response/HeadersDeserializer.hbs", + packagePath() + File.separatorChar + "response", + "HeadersDeserializer.kt")); + supportingFiles.add(new SupportingFile( + "src/main/kotlin/packagename/response/ResponseDeserializer.hbs", + packagePath() + File.separatorChar + "response", + "ResponseDeserializer.kt")); + supportingFiles.add(new SupportingFile( + "src/main/kotlin/packagename/response/ResponsesDeserializer.hbs", + packagePath() + File.separatorChar + "response", + "ResponsesDeserializer.kt")); + supportingFiles.add(new SupportingFile( + "src/test/kotlin/packagename/response/ResponseDeserializerTest.hbs", + testPackagePath() + File.separatorChar + "response", + "ResponseDeserializerTest.kt")); + break; + case REQUEST_BODIES: + supportingFiles.add(new SupportingFile( + "src/main/kotlin/packagename/exceptions/NotImplementedException.hbs", + packagePath() + File.separatorChar + "exceptions", + "NotImplementedException.kt")); + supportingFiles.add(new SupportingFile( + "src/main/kotlin/packagename/requestbody/GenericRequestBody.hbs", + packagePath() + File.separatorChar + "requestbody", + "GenericRequestBody.kt")); + supportingFiles.add(new SupportingFile( + "src/main/kotlin/packagename/requestbody/RequestBodySerializer.hbs", + packagePath() + File.separatorChar + "requestbody", + "RequestBodySerializer.kt")); + supportingFiles.add(new SupportingFile( + "src/main/kotlin/packagename/requestbody/SerializedRequestBody.hbs", + packagePath() + File.separatorChar + "requestbody", + "SerializedRequestBody.kt")); + supportingFiles.add(new SupportingFile( + "src/test/kotlin/packagename/requestbody/RequestBodySerializerTest.hbs", + testPackagePath() + File.separatorChar + "requestbody", + "RequestBodySerializerTest.kt")); + break; + case CONTENT_TYPE: + supportingFiles.add(new SupportingFile( + "src/main/kotlin/packagename/contenttype/ContentTypeDetector.hbs", + packagePath() + File.separatorChar + "contenttype", + "ContentTypeDetector.kt")); + supportingFiles.add(new SupportingFile( + "src/main/kotlin/packagename/contenttype/ContentTypeSerializer.hbs", + packagePath() + File.separatorChar + "contenttype", + "ContentTypeSerializer.kt")); + supportingFiles.add(new SupportingFile( + "src/main/kotlin/packagename/contenttype/ContentTypeDeserializer.hbs", + packagePath() + File.separatorChar + "contenttype", + "ContentTypeDeserializer.kt")); + break; + case MEDIA_TYPE: + supportingFiles.add(new SupportingFile( + "src/main/kotlin/packagename/mediatype/MediaType.hbs", + packagePath() + File.separatorChar + "mediatype", + "MediaType.kt")); + supportingFiles.add(new SupportingFile( + "src/main/kotlin/packagename/mediatype/Encoding.hbs", + packagePath() + File.separatorChar + "mediatype", + "Encoding.kt")); + break; + case HEADERS: + supportingFiles.add(new SupportingFile( + "src/main/kotlin/packagename/exceptions/NotImplementedException.hbs", + packagePath() + File.separatorChar + "exceptions", + "NotImplementedException.kt")); + supportingFiles.add(new SupportingFile( + "src/main/kotlin/packagename/header/Header.hbs", + packagePath() + File.separatorChar + "header", + "Header.kt")); + supportingFiles.add(new SupportingFile( + "src/main/kotlin/packagename/header/HeaderBase.hbs", + packagePath() + File.separatorChar + "header", + "HeaderBase.kt")); + supportingFiles.add(new SupportingFile( + "src/main/kotlin/packagename/header/SchemaHeader.hbs", + packagePath() + File.separatorChar + "header", + "SchemaHeader.kt")); + supportingFiles.add(new SupportingFile( + "src/main/kotlin/packagename/header/ContentHeader.hbs", + packagePath() + File.separatorChar + "header", + "ContentHeader.kt")); + supportingFiles.add(new SupportingFile( + "src/main/kotlin/packagename/header/StyleSerializer.hbs", + packagePath() + File.separatorChar + "header", + "StyleSerializer.kt")); + supportingFiles.add(new SupportingFile( + "src/main/kotlin/packagename/header/Rfc6570Serializer.hbs", + packagePath() + File.separatorChar + "header", + "Rfc6570Serializer.kt")); + supportingFiles.add(new SupportingFile( + "src/main/kotlin/packagename/header/PrefixSeparatorIterator.hbs", + packagePath() + File.separatorChar + "header", + "PrefixSeparatorIterator.kt")); + supportingFiles.add(new SupportingFile( + "src/test/kotlin/packagename/header/SchemaHeaderTest.hbs", + testPackagePath() + File.separatorChar + "header", + "SchemaHeaderTest.kt")); + supportingFiles.add(new SupportingFile( + "src/test/kotlin/packagename/header/ContentHeaderTest.hbs", + testPackagePath() + File.separatorChar + "header", + "ContentHeaderTest.kt")); + break; + case PARAMETERS: + supportingFiles.add(new SupportingFile( + "src/main/kotlin/packagename/exceptions/NotImplementedException.hbs", + packagePath() + File.separatorChar + "exceptions", + "NotImplementedException.kt")); + supportingFiles.add(new SupportingFile( + "src/main/kotlin/packagename/parameter/ContentParameter.hbs", + packagePath() + File.separatorChar + "parameter", + "ContentParameter.kt")); + supportingFiles.add(new SupportingFile( + "src/main/kotlin/packagename/parameter/CookieSerializer.hbs", + packagePath() + File.separatorChar + "parameter", + "CookieSerializer.kt")); + supportingFiles.add(new SupportingFile( + "src/main/kotlin/packagename/parameter/HeadersSerializer.hbs", + packagePath() + File.separatorChar + "parameter", + "HeadersSerializer.kt")); + supportingFiles.add(new SupportingFile( + "src/main/kotlin/packagename/parameter/Parameter.hbs", + packagePath() + File.separatorChar + "parameter", + "Parameter.kt")); + supportingFiles.add(new SupportingFile( + "src/main/kotlin/packagename/parameter/ParameterBase.hbs", + packagePath() + File.separatorChar + "parameter", + "ParameterBase.kt")); + supportingFiles.add(new SupportingFile( + "src/main/kotlin/packagename/parameter/ParameterInType.hbs", + packagePath() + File.separatorChar + "parameter", + "ParameterInType.kt")); + supportingFiles.add(new SupportingFile( + "src/main/kotlin/packagename/parameter/ParameterStyle.hbs", + packagePath() + File.separatorChar + "parameter", + "ParameterStyle.kt")); + supportingFiles.add(new SupportingFile( + "src/main/kotlin/packagename/parameter/PathSerializer.hbs", + packagePath() + File.separatorChar + "parameter", + "PathSerializer.kt")); + supportingFiles.add(new SupportingFile( + "src/main/kotlin/packagename/parameter/QuerySerializer.hbs", + packagePath() + File.separatorChar + "parameter", + "QuerySerializer.kt")); + supportingFiles.add(new SupportingFile( + "src/main/kotlin/packagename/parameter/SchemaParameter.hbs", + packagePath() + File.separatorChar + "parameter", + "SchemaParameter.kt")); + supportingFiles.add(new SupportingFile( + "src/test/kotlin/packagename/parameter/CookieSerializerTest.hbs", + testPackagePath() + File.separatorChar + "parameter", + "CookieSerializerTest.kt")); + supportingFiles.add(new SupportingFile( + "src/test/kotlin/packagename/parameter/HeadersSerializerTest.hbs", + testPackagePath() + File.separatorChar + "parameter", + "HeadersSerializerTest.kt")); + supportingFiles.add(new SupportingFile( + "src/test/kotlin/packagename/parameter/PathSerializerTest.hbs", + testPackagePath() + File.separatorChar + "parameter", + "PathSerializerTest.kt")); + supportingFiles.add(new SupportingFile( + "src/test/kotlin/packagename/parameter/QuerySerializerTest.hbs", + testPackagePath() + File.separatorChar + "parameter", + "QuerySerializerTest.kt")); + supportingFiles.add(new SupportingFile( + "src/test/kotlin/packagename/parameter/SchemaNonQueryParameterTest.hbs", + testPackagePath() + File.separatorChar + "parameter", + "SchemaNonQueryParameterTest.kt")); + supportingFiles.add(new SupportingFile( + "src/test/kotlin/packagename/parameter/SchemaQueryParameterTest.hbs", + testPackagePath() + File.separatorChar + "parameter", + "SchemaQueryParameterTest.kt")); + break; } } diff --git a/src/main/resources/java/README.hbs b/src/main/resources/java/README.hbs index 022a99bd336..cab1927f0c8 100644 --- a/src/main/resources/java/README.hbs +++ b/src/main/resources/java/README.hbs @@ -1,4 +1,4 @@ -# {{artifactId}} +# {{generatorSettings.artifactId}} {{#if appDescription}} {{appDescription.original}} {{/if}} @@ -42,7 +42,7 @@ Add this dependency to your project's POM: ```xml {{{groupId}}} - {{{artifactId}}} + {{{generatorSettings.artifactId}}} {{{artifactVersion}}} compile @@ -60,12 +60,12 @@ Add this dependency to your project's build file: ``` repositories { - mavenCentral() // Needed if the '{{{artifactId}}}' jar has been published to maven centra - mavenLocal() // Needed if the '{{{artifactId}}}' jar has been published to the local maven repo + mavenCentral() // Needed if the '{{{generatorSettings.artifactId}}}' jar has been published to maven centra + mavenLocal() // Needed if the '{{{generatorSettings.artifactId}}}' jar has been published to the local maven repo } dependencies { - implementation "{{{groupId}}}:{{{artifactId}}}:{{{artifactVersion}}}" + implementation "{{{groupId}}}:{{{generatorSettings.artifactId}}}:{{{artifactVersion}}}" } ``` diff --git a/src/main/resources/java/build.gradle.hbs b/src/main/resources/java/build.gradle.hbs index 2b484053fcf..5071e968d9e 100644 --- a/src/main/resources/java/build.gradle.hbs +++ b/src/main/resources/java/build.gradle.hbs @@ -37,7 +37,7 @@ val testsJar by tasks.registering(Jar::class) { java { toolchain { - languageVersion.set(JavaLanguageVersion.of(17)) + languageVersion.set(JavaLanguageVersion.of({{generatorMetadata.languageVersion}})) } withSourcesJar() withJavadocJar() diff --git a/src/main/resources/java/pom.hbs b/src/main/resources/java/pom.hbs index 48db5cc9f02..9d9bdb2f128 100644 --- a/src/main/resources/java/pom.hbs +++ b/src/main/resources/java/pom.hbs @@ -2,9 +2,9 @@ xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd"> 4.0.0 {{groupId}} - {{artifactId}} + {{generatorSettings.artifactId}} jar - {{artifactId}} + {{generatorSettings.artifactId}} {{artifactVersion}} {{artifactUrl}} {{artifactDescription}} @@ -237,7 +237,7 @@ - 17 + {{generatorMetadata.languageVersion}} UTF-8 3.42.0 1.0.0 diff --git a/src/main/resources/java/settings.gradle.hbs b/src/main/resources/java/settings.gradle.hbs index 0a661d416eb..d83bd88e646 100644 --- a/src/main/resources/java/settings.gradle.hbs +++ b/src/main/resources/java/settings.gradle.hbs @@ -1,2 +1,2 @@ -rootProject.name = "{{artifactId}}" +rootProject.name = "{{generatorSettings.artifactId}}" diff --git a/src/main/resources/kotlin/README.hbs b/src/main/resources/kotlin/README.hbs index a3b9e61dd2b..5298ea78298 100644 --- a/src/main/resources/kotlin/README.hbs +++ b/src/main/resources/kotlin/README.hbs @@ -1,4 +1,4 @@ -# {{artifactId}} +# {{generatorSettings.artifactId}} {{#if appDescription}} {{appDescription.original}} {{/if}} @@ -33,12 +33,12 @@ Add this dependency to your project's build file: ``` repositories { - mavenCentral() // Needed if the '{{{artifactId}}}' jar has been published to maven centra - mavenLocal() // Needed if the '{{{artifactId}}}' jar has been published to the local maven repo + mavenCentral() // Needed if the '{{{generatorSettings.artifactId}}}' jar has been published to maven centra + mavenLocal() // Needed if the '{{{generatorSettings.artifactId}}}' jar has been published to the local maven repo } dependencies { - implementation "{{{groupId}}}:{{{artifactId}}}:{{{artifactVersion}}}" + implementation "{{{groupId}}}:{{{generatorSettings.artifactId}}}:{{{artifactVersion}}}" } ``` @@ -167,7 +167,7 @@ allowed input and output types. {{/with}} {{/each}} {{/if}} -{{#if paths}} +{{#and paths (gt paths.size 0)}} ## Endpoints All URIs are relative to the selected server @@ -182,7 +182,7 @@ All URIs are relative to the selected server | {{../@key.original}} **{{@key.original}}** | {{#each tags}}[{{className}}.{{../operationId.camelCase}}](docs/apis/tags/{{className}}.md#{{../operationId.kebabCase}}) {{/each}} [{{../jsonPathPiece.pascalCase}}.{{method.camelCase}}](docs/apis/paths/{{../jsonPathPiece.pascalCase}}.md#{{method.kebabCase}}) [{{jsonPathPiece.pascalCase}}.{{method.pascalCase}}.{{method.camelCase}}](docs/{{pathFromDocRoot}}.md#{{method.kebabCase}}) |{{#if summary}} {{summary.originalWithBr}}{{/if}} | {{/each}} {{/each}} -{{/if}} +{{/and}} {{#if schemas}} ## Component Schemas diff --git a/src/main/resources/kotlin/build.gradle.hbs b/src/main/resources/kotlin/build.gradle.hbs index a20733d7cde..5e65fb87a42 100644 --- a/src/main/resources/kotlin/build.gradle.hbs +++ b/src/main/resources/kotlin/build.gradle.hbs @@ -1,6 +1,5 @@ plugins { - kotlin("jvm") version "1.9.23" - id("org.checkerframework") version "0.6.33" + kotlin("jvm") version "{{generatorMetadata.languageVersion}}" } repositories { @@ -11,6 +10,8 @@ repositories { } dependencies { + implementation(kotlin("reflect")) + testImplementation(kotlin("test")) implementation("org.checkerframework:checker-qual:3.42.0") implementation("com.google.code.gson:gson:2.10.1") testImplementation("junit:junit:4.13.2") @@ -24,10 +25,15 @@ java { toolchain { languageVersion.set(JavaLanguageVersion.of(17)) } - withSourcesJar() - withJavadocJar() } tasks.wrapper { gradleVersion = "8.1.1" } + +tasks.test { + useJUnitPlatform() + testLogging { + events( "started", "passed", "skipped", "failed") + } +} diff --git a/src/main/resources/kotlin/settings.gradle.hbs b/src/main/resources/kotlin/settings.gradle.hbs index 0a661d416eb..d83bd88e646 100644 --- a/src/main/resources/kotlin/settings.gradle.hbs +++ b/src/main/resources/kotlin/settings.gradle.hbs @@ -1,2 +1,2 @@ -rootProject.name = "{{artifactId}}" +rootProject.name = "{{generatorSettings.artifactId}}" diff --git a/src/main/resources/kotlin/src/main/kotlin/packagename/components/schemas/Schema.hbs b/src/main/resources/kotlin/src/main/kotlin/packagename/components/schemas/Schema.hbs index 3c75927f42d..46ced448e49 100644 --- a/src/main/resources/kotlin/src/main/kotlin/packagename/components/schemas/Schema.hbs +++ b/src/main/resources/kotlin/src/main/kotlin/packagename/components/schemas/Schema.hbs @@ -1,17 +1,17 @@ {{#with schema}} -package {{packageName}}.{{subpackage}}; +package {{packageName}}.{{subpackage}} {{#if refInfo}} {{> _helper_imports }} -public class {{containerJsonPathPiece.pascalCase}} extends {{refInfo.refModule}} { +class {{containerJsonPathPiece.pascalCase}} : {{refInfo.refModule}} { // $refed class {{> src/main/kotlin/packagename/components/schemas/SchemaClass/SchemaClass identifierPieces=(append identifierPieces jsonPathPiece) simpleRef=true }} } {{else}} {{> _helper_imports }} -public class {{> src/main/kotlin/packagename/components/schemas/_containerClassName }} { +class {{> src/main/kotlin/packagename/components/schemas/_containerClassName }} { // nest classes so all schemas and input/output classes can be public {{> src/main/kotlin/packagename/components/schemas/Schema_getSchemas }} diff --git a/src/main/resources/kotlin/src/main/kotlin/packagename/components/schemas/SchemaClass/_Schema_anytypeOrMultitype.hbs b/src/main/resources/kotlin/src/main/kotlin/packagename/components/schemas/SchemaClass/_Schema_anytypeOrMultitype.hbs index 64aeee9b78b..3fbc8720d22 100644 --- a/src/main/resources/kotlin/src/main/kotlin/packagename/components/schemas/SchemaClass/_Schema_anytypeOrMultitype.hbs +++ b/src/main/resources/kotlin/src/main/kotlin/packagename/components/schemas/SchemaClass/_Schema_anytypeOrMultitype.hbs @@ -3,11 +3,126 @@ {{> src/main/kotlin/packagename/components/schemas/SchemaClass/_boxedClasses }} -{{#if types}} -public static class {{jsonPathPiece.pascalCase}} extends JsonSchema<{{jsonPathPiece.pascalCase}}Boxed> implements {{#with enumInfo}}{{#if typeToValues.null}}NullEnumValidator, {{/if}}{{#if typeToValues.boolean}}BooleanEnumValidator, {{/if}}{{#if typeToValues.string}}StringEnumValidator, {{/if}}{{#if typeToValues.Integer}}IntegerEnumValidator, {{/if}}{{#if typeToValues.Long}}LongEnumValidator, {{/if}}{{#if typeToValues.Float}}FloatEnumValidator, {{/if}}{{#if typeToValues.Double}}DoubleEnumValidator, {{/if}}{{/with}}{{#each types}}{{#eq this "null"}}NullSchemaValidator<{{jsonPathPiece.pascalCase}}BoxedVoid>{{else}}{{#eq this "boolean"}}BooleanSchemaValidator<{{jsonPathPiece.pascalCase}}BoxedBoolean>{{else}}{{#or (eq this "number") (eq this "integer")}}NumberSchemaValidator<{{jsonPathPiece.pascalCase}}BoxedNumber>{{else}}{{#eq this "string"}}StringSchemaValidator<{{jsonPathPiece.pascalCase}}BoxedString>{{else}}{{#eq this "array"}}ListSchemaValidator<{{#if arrayOutputJsonPathPiece}}{{arrayOutputJsonPathPiece.pascalCase}}{{else}}FrozenList<@Nullable Object>{{/if}}, {{jsonPathPiece.pascalCase}}BoxedList>{{else}}{{#eq this "object"}}MapSchemaValidator<{{#if mapOutputJsonPathPiece}}{{mapOutputJsonPathPiece.pascalCase}}{{else}}FrozenMap<{{#with mapValueSchema}}{{> src/main/kotlin/packagename/components/schemas/types/schema_output_type sourceJsonPath=../jsonPath forceNull=true }}{{else}}@Nullable Object{{/with}}>{{/if}}, {{jsonPathPiece.pascalCase}}BoxedMap>{{/eq}}{{/eq}}{{/eq}}{{/or}}{{/eq}}{{/eq}}{{#unless @last}}, {{/unless}}{{/each}} { -{{else}} -public static class {{jsonPathPiece.pascalCase}} extends JsonSchema<{{jsonPathPiece.pascalCase}}Boxed> implements {{#with enumInfo}}{{#if typeToValues.null}}NullEnumValidator, {{/if}}{{#if typeToValues.boolean}}BooleanEnumValidator, {{/if}}{{#if typeToValues.string}}StringEnumValidator, {{/if}}{{#if typeToValues.Integer}}IntegerEnumValidator, {{/if}}{{#if typeToValues.Long}}LongEnumValidator, {{/if}}{{#if typeToValues.Float}}FloatEnumValidator, {{/if}}{{#if typeToValues.Double}}DoubleEnumValidator, {{/if}}{{/with}}NullSchemaValidator<{{jsonPathPiece.pascalCase}}BoxedVoid>, BooleanSchemaValidator<{{jsonPathPiece.pascalCase}}BoxedBoolean>, NumberSchemaValidator<{{jsonPathPiece.pascalCase}}BoxedNumber>, StringSchemaValidator<{{jsonPathPiece.pascalCase}}BoxedString>, ListSchemaValidator<{{#if arrayOutputJsonPathPiece}}{{arrayOutputJsonPathPiece.pascalCase}}{{else}}FrozenList<@Nullable Object>{{/if}}, {{jsonPathPiece.pascalCase}}BoxedList>, MapSchemaValidator<{{#if mapOutputJsonPathPiece}}{{mapOutputJsonPathPiece.pascalCase}}{{else}}FrozenMap<{{#with mapValueSchema}}{{> src/main/kotlin/packagename/components/schemas/types/schema_output_type sourceJsonPath=../jsonPath forceNull=true }}{{else}}@Nullable Object{{/with}}>{{/if}}, {{jsonPathPiece.pascalCase}}BoxedMap> { -{{/if}} +class {{jsonPathPiece.pascalCase}} private constructor(): JsonSchema<{{jsonPathPiece.pascalCase}}Boxed>( + JsonSchemaInfo() + {{#if types}} + {{> src/main/kotlin/packagename/components/schemas/SchemaClass/_types }} + {{/if}} + {{#if format}} + {{> src/main/kotlin/packagename/components/schemas/SchemaClass/_format }} + {{/if}} + {{#if items}} + {{> src/main/kotlin/packagename/components/schemas/SchemaClass/_items }} + {{/if}} + {{#if properties}} + {{> src/main/kotlin/packagename/components/schemas/SchemaClass/_properties }} + {{/if}} + {{#if requiredProperties}} + {{> src/main/kotlin/packagename/components/schemas/SchemaClass/_required }} + {{/if}} + {{#neq exclusiveMaximum null}} + {{> src/main/kotlin/packagename/components/schemas/SchemaClass/_exclusiveMaximum }} + {{/neq}} + {{#neq exclusiveMinimum null}} + {{> src/main/kotlin/packagename/components/schemas/SchemaClass/_exclusiveMinimum }} + {{/neq}} + {{#neq maximum null}} + {{> src/main/kotlin/packagename/components/schemas/SchemaClass/_maximum }} + {{/neq}} + {{#neq minimum null}} + {{> src/main/kotlin/packagename/components/schemas/SchemaClass/_minimum }} + {{/neq}} + {{#neq multipleOf null}} + {{> src/main/kotlin/packagename/components/schemas/SchemaClass/_multipleOf }} + {{/neq}} + {{#neq maxItems null}} + {{> src/main/kotlin/packagename/components/schemas/SchemaClass/_maxItems }} + {{/neq}} + {{#neq minItems null}} + {{> src/main/kotlin/packagename/components/schemas/SchemaClass/_minItems }} + {{/neq}} + {{#neq maxLength null }} + {{> src/main/kotlin/packagename/components/schemas/SchemaClass/_maxLength }} + {{/neq}} + {{#neq minLength null }} + {{> src/main/kotlin/packagename/components/schemas/SchemaClass/_minLength }} + {{/neq}} + {{#neq maxProperties null}} + {{> src/main/kotlin/packagename/components/schemas/SchemaClass/_maxProperties }} + {{/neq}} + {{#neq minProperties null}} + {{> src/main/kotlin/packagename/components/schemas/SchemaClass/_minProperties }} + {{/neq}} + {{#if additionalProperties}} + {{> src/main/kotlin/packagename/components/schemas/SchemaClass/_additionalProperties }} + {{/if}} + {{#if allOf}} + {{> src/main/kotlin/packagename/components/schemas/SchemaClass/_allOf }} + {{/if}} + {{#if anyOf}} + {{> src/main/kotlin/packagename/components/schemas/SchemaClass/_anyOf }} + {{/if}} + {{#if oneOf}} + {{> src/main/kotlin/packagename/components/schemas/SchemaClass/_oneOf }} + {{/if}} + {{#if not}} + {{> src/main/kotlin/packagename/components/schemas/SchemaClass/_not }} + {{/if}} + {{#neq uniqueItems null}} + {{> src/main/kotlin/packagename/components/schemas/SchemaClass/_uniqueItems }} + {{/neq}} + {{#if enumInfo}} + {{> src/main/kotlin/packagename/components/schemas/SchemaClass/_enum }} + {{/if}} + {{#if patternInfo}} + {{> src/main/kotlin/packagename/components/schemas/SchemaClass/_pattern }} + {{/if}} + {{#if defaultValue}} + {{> src/main/kotlin/packagename/components/schemas/SchemaClass/_default }} + {{/if}} + {{#if constInfo}} + {{> src/main/kotlin/packagename/components/schemas/SchemaClass/_const }} + {{/if}} + {{#if contains}} + {{> src/main/kotlin/packagename/components/schemas/SchemaClass/_contains }} + {{/if}} + {{#neq maxContains null}} + {{> src/main/kotlin/packagename/components/schemas/SchemaClass/_maxContains }} + {{/neq}} + {{#neq minContains null}} + {{> src/main/kotlin/packagename/components/schemas/SchemaClass/_minContains }} + {{/neq}} + {{#if propertyNames}} + {{> src/main/kotlin/packagename/components/schemas/SchemaClass/_propertyNames }} + {{/if}} + {{#if dependentRequired}} + {{> src/main/kotlin/packagename/components/schemas/SchemaClass/_dependentRequired }} + {{/if}} + {{#if dependentSchemas}} + {{> src/main/kotlin/packagename/components/schemas/SchemaClass/_dependentSchemas }} + {{/if}} + {{#if patternProperties}} + {{> src/main/kotlin/packagename/components/schemas/SchemaClass/_patternProperties }} + {{/if}} + {{#if prefixItems}} + {{> src/main/kotlin/packagename/components/schemas/SchemaClass/_prefixItems }} + {{/if}} + {{#if if_}} + {{> src/main/kotlin/packagename/components/schemas/SchemaClass/_if }} + {{/if}} + {{#if then}} + {{> src/main/kotlin/packagename/components/schemas/SchemaClass/_then }} + {{/if}} + {{#if else_}} + {{> src/main/kotlin/packagename/components/schemas/SchemaClass/_else }} + {{/if}} + {{#if unevaluatedItems}} + {{> src/main/kotlin/packagename/components/schemas/SchemaClass/_unevaluatedItems }} + {{/if}} + {{#if unevaluatedProperties}} + {{> src/main/kotlin/packagename/components/schemas/SchemaClass/_unevaluatedProperties }} + {{/if}} +), {{#with enumInfo}}{{#if typeToValues.null}}NullEnumValidator, {{/if}}{{#if typeToValues.boolean}}BooleanEnumValidator, {{/if}}{{#if typeToValues.string}}StringEnumValidator, {{/if}}{{#if typeToValues.Integer}}IntegerEnumValidator, {{/if}}{{#if typeToValues.Long}}LongEnumValidator, {{/if}}{{#if typeToValues.Float}}FloatEnumValidator, {{/if}}{{#if typeToValues.Double}}DoubleEnumValidator, {{/if}}{{/with}}{{#each types}}{{#eq this "null"}}NullSchemaValidator<{{jsonPathPiece.pascalCase}}BoxedVoid>{{else}}{{#eq this "boolean"}}BooleanSchemaValidator<{{jsonPathPiece.pascalCase}}BoxedBoolean>{{else}}{{#or (eq this "number") (eq this "integer")}}NumberSchemaValidator<{{jsonPathPiece.pascalCase}}BoxedNumber>{{else}}{{#eq this "string"}}StringSchemaValidator<{{jsonPathPiece.pascalCase}}BoxedString>{{else}}{{#eq this "array"}}ListSchemaValidator<{{#if arrayOutputJsonPathPiece}}{{arrayOutputJsonPathPiece.pascalCase}}{{else}}FrozenList{{/if}}, {{jsonPathPiece.pascalCase}}BoxedList>{{else}}{{#eq this "object"}}MapSchemaValidator<{{#if mapOutputJsonPathPiece}}{{mapOutputJsonPathPiece.pascalCase}}{{else}}FrozenMap<{{#with mapValueSchema}}{{> src/main/kotlin/packagename/components/schemas/types/schema_output_type sourceJsonPath=../jsonPath forceNull=true }}{{else}}Any?{{/with}}>{{/if}}, {{jsonPathPiece.pascalCase}}BoxedMap>{{/eq}}{{/eq}}{{/eq}}{{/or}}{{/eq}}{{/eq}}{{#unless @last}}, {{/unless}}{{else}}NullSchemaValidator<{{jsonPathPiece.pascalCase}}BoxedVoid>, BooleanSchemaValidator<{{jsonPathPiece.pascalCase}}BoxedBoolean>, NumberSchemaValidator<{{jsonPathPiece.pascalCase}}BoxedNumber>, StringSchemaValidator<{{jsonPathPiece.pascalCase}}BoxedString>, ListSchemaValidator<{{#if arrayOutputJsonPathPiece}}{{arrayOutputJsonPathPiece.pascalCase}}{{else}}FrozenList{{/if}}, {{jsonPathPiece.pascalCase}}BoxedList>, MapSchemaValidator<{{#if mapOutputJsonPathPiece}}{{mapOutputJsonPathPiece.pascalCase}}{{else}}FrozenMap<{{#with mapValueSchema}}{{> src/main/kotlin/packagename/components/schemas/types/schema_output_type sourceJsonPath=../jsonPath forceNull=true }}{{else}}Any?{{/with}}>{{/if}}, {{jsonPathPiece.pascalCase}}BoxedMap>{{/each}} { {{#if componentModule}} /* NOTE: This class is auto generated by OpenAPI JSON Schema Generator. @@ -20,135 +135,15 @@ public static class {{jsonPathPiece.pascalCase}} extends JsonSchema<{{jsonPathPi {{/if}} */ {{/if}} - private static @Nullable {{jsonPathPiece.pascalCase}} instance = null; - protected {{../jsonPathPiece.pascalCase}}() { - super(new JsonSchemaInfo() - {{#if types}} - {{> src/main/kotlin/packagename/components/schemas/SchemaClass/_types }} - {{/if}} - {{#if format}} - {{> src/main/kotlin/packagename/components/schemas/SchemaClass/_format }} - {{/if}} - {{#if items}} - {{> src/main/kotlin/packagename/components/schemas/SchemaClass/_items }} - {{/if}} - {{#if properties}} - {{> src/main/kotlin/packagename/components/schemas/SchemaClass/_properties }} - {{/if}} - {{#if requiredProperties}} - {{> src/main/kotlin/packagename/components/schemas/SchemaClass/_required }} - {{/if}} - {{#neq exclusiveMaximum null}} - {{> src/main/kotlin/packagename/components/schemas/SchemaClass/_exclusiveMaximum }} - {{/neq}} - {{#neq exclusiveMinimum null}} - {{> src/main/kotlin/packagename/components/schemas/SchemaClass/_exclusiveMinimum }} - {{/neq}} - {{#neq maximum null}} - {{> src/main/kotlin/packagename/components/schemas/SchemaClass/_maximum }} - {{/neq}} - {{#neq minimum null}} - {{> src/main/kotlin/packagename/components/schemas/SchemaClass/_minimum }} - {{/neq}} - {{#neq multipleOf null}} - {{> src/main/kotlin/packagename/components/schemas/SchemaClass/_multipleOf }} - {{/neq}} - {{#neq maxItems null}} - {{> src/main/kotlin/packagename/components/schemas/SchemaClass/_maxItems }} - {{/neq}} - {{#neq minItems null}} - {{> src/main/kotlin/packagename/components/schemas/SchemaClass/_minItems }} - {{/neq}} - {{#neq maxLength null }} - {{> src/main/kotlin/packagename/components/schemas/SchemaClass/_maxLength }} - {{/neq}} - {{#neq minLength null }} - {{> src/main/kotlin/packagename/components/schemas/SchemaClass/_minLength }} - {{/neq}} - {{#neq maxProperties null}} - {{> src/main/kotlin/packagename/components/schemas/SchemaClass/_maxProperties }} - {{/neq}} - {{#neq minProperties null}} - {{> src/main/kotlin/packagename/components/schemas/SchemaClass/_minProperties }} - {{/neq}} - {{#if additionalProperties}} - {{> src/main/kotlin/packagename/components/schemas/SchemaClass/_additionalProperties }} - {{/if}} - {{#if allOf}} - {{> src/main/kotlin/packagename/components/schemas/SchemaClass/_allOf }} - {{/if}} - {{#if anyOf}} - {{> src/main/kotlin/packagename/components/schemas/SchemaClass/_anyOf }} - {{/if}} - {{#if oneOf}} - {{> src/main/kotlin/packagename/components/schemas/SchemaClass/_oneOf }} - {{/if}} - {{#if not}} - {{> src/main/kotlin/packagename/components/schemas/SchemaClass/_not }} - {{/if}} - {{#neq uniqueItems null}} - {{> src/main/kotlin/packagename/components/schemas/SchemaClass/_uniqueItems }} - {{/neq}} - {{#if enumInfo}} - {{> src/main/kotlin/packagename/components/schemas/SchemaClass/_enum }} - {{/if}} - {{#if patternInfo}} - {{> src/main/kotlin/packagename/components/schemas/SchemaClass/_pattern }} - {{/if}} - {{#if defaultValue}} - {{> src/main/kotlin/packagename/components/schemas/SchemaClass/_default }} - {{/if}} - {{#if constInfo}} - {{> src/main/kotlin/packagename/components/schemas/SchemaClass/_const }} - {{/if}} - {{#if contains}} - {{> src/main/kotlin/packagename/components/schemas/SchemaClass/_contains }} - {{/if}} - {{#neq maxContains null}} - {{> src/main/kotlin/packagename/components/schemas/SchemaClass/_maxContains }} - {{/neq}} - {{#neq minContains null}} - {{> src/main/kotlin/packagename/components/schemas/SchemaClass/_minContains }} - {{/neq}} - {{#if propertyNames}} - {{> src/main/kotlin/packagename/components/schemas/SchemaClass/_propertyNames }} - {{/if}} - {{#if dependentRequired}} - {{> src/main/kotlin/packagename/components/schemas/SchemaClass/_dependentRequired }} - {{/if}} - {{#if dependentSchemas}} - {{> src/main/kotlin/packagename/components/schemas/SchemaClass/_dependentSchemas }} - {{/if}} - {{#if patternProperties}} - {{> src/main/kotlin/packagename/components/schemas/SchemaClass/_patternProperties }} - {{/if}} - {{#if prefixItems}} - {{> src/main/kotlin/packagename/components/schemas/SchemaClass/_prefixItems }} - {{/if}} - {{#if if_}} - {{> src/main/kotlin/packagename/components/schemas/SchemaClass/_if }} - {{/if}} - {{#if then}} - {{> src/main/kotlin/packagename/components/schemas/SchemaClass/_then }} - {{/if}} - {{#if else_}} - {{> src/main/kotlin/packagename/components/schemas/SchemaClass/_else }} - {{/if}} - {{#if unevaluatedItems}} - {{> src/main/kotlin/packagename/components/schemas/SchemaClass/_unevaluatedItems }} - {{/if}} - {{#if unevaluatedProperties}} - {{> src/main/kotlin/packagename/components/schemas/SchemaClass/_unevaluatedProperties }} - {{/if}} - ); - } + companion object { + @Volatile + private var instance: {{jsonPathPiece.pascalCase}}? = null - public static {{jsonPathPiece.pascalCase}} getInstance() { - if (instance == null) { - instance = new {{jsonPathPiece.pascalCase}}(); - } - return instance; + fun getInstance() = + instance ?: synchronized(this) { + instance ?: {{jsonPathPiece.pascalCase}}().also { instance = it } + } } {{#if hasDiscriminatorWithNonEmptyMapping}} {{!> components/schemas/schema_cls/_discriminator }} diff --git a/src/main/resources/kotlin/src/main/kotlin/packagename/components/schemas/SchemaClass/_Schema_boolean.hbs b/src/main/resources/kotlin/src/main/kotlin/packagename/components/schemas/SchemaClass/_Schema_boolean.hbs index 614f45b2f7e..c03b46fe12e 100644 --- a/src/main/resources/kotlin/src/main/kotlin/packagename/components/schemas/SchemaClass/_Schema_boolean.hbs +++ b/src/main/resources/kotlin/src/main/kotlin/packagename/components/schemas/SchemaClass/_Schema_boolean.hbs @@ -3,7 +3,42 @@ {{> src/main/kotlin/packagename/components/schemas/SchemaClass/_boxedClasses }} -public static class {{jsonPathPiece.pascalCase}} extends JsonSchema<{{jsonPathPiece.pascalCase}}Boxed> implements BooleanSchemaValidator<{{jsonPathPiece.pascalCase}}BoxedBoolean>{{#and enumInfo enumInfo.typeToValues.boolean}}, BooleanEnumValidator{{/and}} { +class {{jsonPathPiece.pascalCase}} private constructor(): JsonSchema<{{jsonPathPiece.pascalCase}}Boxed>( + JsonSchemaInfo() + {{#if types}} + {{> src/main/kotlin/packagename/components/schemas/SchemaClass/_types }} + {{/if}} + {{#if allOf}} + {{> src/main/kotlin/packagename/components/schemas/SchemaClass/_allOf }} + {{/if}} + {{#if anyOf}} + {{> src/main/kotlin/packagename/components/schemas/SchemaClass/_anyOf }} + {{/if}} + {{#if oneOf}} + {{> src/main/kotlin/packagename/components/schemas/SchemaClass/_oneOf }} + {{/if}} + {{#if not}} + {{> src/main/kotlin/packagename/components/schemas/SchemaClass/_not }} + {{/if}} + {{#if enumInfo}} + {{> src/main/kotlin/packagename/components/schemas/SchemaClass/_enum }} + {{/if}} + {{#if defaultValue}} + {{> src/main/kotlin/packagename/components/schemas/SchemaClass/_default }} + {{/if}} + {{#if constInfo}} + {{> src/main/kotlin/packagename/components/schemas/SchemaClass/_const }} + {{/if}} + {{#if if_}} + {{> src/main/kotlin/packagename/components/schemas/SchemaClass/_if }} + {{/if}} + {{#if then}} + {{> src/main/kotlin/packagename/components/schemas/SchemaClass/_then }} + {{/if}} + {{#if else_}} + {{> src/main/kotlin/packagename/components/schemas/SchemaClass/_else }} + {{/if}} +), BooleanSchemaValidator<{{jsonPathPiece.pascalCase}}BoxedBoolean>{{#and enumInfo enumInfo.typeToValues.boolean}}, BooleanEnumValidator{{/and}} { {{#if componentModule}} /* NOTE: This class is auto generated by OpenAPI JSON Schema Generator. @@ -16,51 +51,15 @@ public static class {{jsonPathPiece.pascalCase}} extends JsonSchema<{{jsonPathPi {{/if}} */ {{/if}} - private static @Nullable {{jsonPathPiece.pascalCase}} instance = null; - protected {{../jsonPathPiece.pascalCase}}() { - super(new JsonSchemaInfo() - {{#if types}} - {{> src/main/kotlin/packagename/components/schemas/SchemaClass/_types }} - {{/if}} - {{#if allOf}} - {{> src/main/kotlin/packagename/components/schemas/SchemaClass/_allOf }} - {{/if}} - {{#if anyOf}} - {{> src/main/kotlin/packagename/components/schemas/SchemaClass/_anyOf }} - {{/if}} - {{#if oneOf}} - {{> src/main/kotlin/packagename/components/schemas/SchemaClass/_oneOf }} - {{/if}} - {{#if not}} - {{> src/main/kotlin/packagename/components/schemas/SchemaClass/_not }} - {{/if}} - {{#if enumInfo}} - {{> src/main/kotlin/packagename/components/schemas/SchemaClass/_enum }} - {{/if}} - {{#if defaultValue}} - {{> src/main/kotlin/packagename/components/schemas/SchemaClass/_default }} - {{/if}} - {{#if constInfo}} - {{> src/main/kotlin/packagename/components/schemas/SchemaClass/_const }} - {{/if}} - {{#if if_}} - {{> src/main/kotlin/packagename/components/schemas/SchemaClass/_if }} - {{/if}} - {{#if then}} - {{> src/main/kotlin/packagename/components/schemas/SchemaClass/_then }} - {{/if}} - {{#if else_}} - {{> src/main/kotlin/packagename/components/schemas/SchemaClass/_else }} - {{/if}} - ); - } + companion object { + @Volatile + private var instance: {{jsonPathPiece.pascalCase}}? = null - public static {{jsonPathPiece.pascalCase}} getInstance() { - if (instance == null) { - instance = new {{jsonPathPiece.pascalCase}}(); - } - return instance; + fun getInstance() = + instance ?: synchronized(this) { + instance ?: {{jsonPathPiece.pascalCase}}().also { instance = it } + } } {{> src/main/kotlin/packagename/components/schemas/SchemaClass/_validate_implementor }} {{> src/main/kotlin/packagename/components/schemas/SchemaClass/_getNewInstanceObject_implementor }} diff --git a/src/main/resources/kotlin/src/main/kotlin/packagename/components/schemas/SchemaClass/_Schema_list.hbs b/src/main/resources/kotlin/src/main/kotlin/packagename/components/schemas/SchemaClass/_Schema_list.hbs index 55235487f27..66a53ad2be6 100644 --- a/src/main/resources/kotlin/src/main/kotlin/packagename/components/schemas/SchemaClass/_Schema_list.hbs +++ b/src/main/resources/kotlin/src/main/kotlin/packagename/components/schemas/SchemaClass/_Schema_list.hbs @@ -3,7 +3,60 @@ {{> src/main/kotlin/packagename/components/schemas/SchemaClass/_boxedClasses }} -public static class {{jsonPathPiece.pascalCase}} extends JsonSchema<{{jsonPathPiece.pascalCase}}Boxed> implements ListSchemaValidator<{{#if arrayOutputJsonPathPiece}}{{arrayOutputJsonPathPiece.pascalCase}}{{else}}FrozenList<@Nullable Object>{{/if}}, {{jsonPathPiece.pascalCase}}BoxedList> { +class {{jsonPathPiece.pascalCase}} private constructor(): JsonSchema<{{jsonPathPiece.pascalCase}}Boxed>( + JsonSchemaInfo() + {{#if types}} + {{> src/main/kotlin/packagename/components/schemas/SchemaClass/_types }} + {{/if}} + {{#if items}} + {{> src/main/kotlin/packagename/components/schemas/SchemaClass/_items }} + {{/if}} + {{#neq maxItems null}} + {{> src/main/kotlin/packagename/components/schemas/SchemaClass/_maxItems }} + {{/neq}} + {{#neq minItems null}} + {{> src/main/kotlin/packagename/components/schemas/SchemaClass/_minItems }} + {{/neq}} + {{#if allOf}} + {{> src/main/kotlin/packagename/components/schemas/SchemaClass/_allOf }} + {{/if}} + {{#if anyOf}} + {{> src/main/kotlin/packagename/components/schemas/SchemaClass/_anyOf }} + {{/if}} + {{#if oneOf}} + {{> src/main/kotlin/packagename/components/schemas/SchemaClass/_oneOf }} + {{/if}} + {{#if not}} + {{> src/main/kotlin/packagename/components/schemas/SchemaClass/_not }} + {{/if}} + {{#neq uniqueItems null}} + {{> src/main/kotlin/packagename/components/schemas/SchemaClass/_uniqueItems }} + {{/neq}} + {{#if contains}} + {{> src/main/kotlin/packagename/components/schemas/SchemaClass/_contains }} + {{/if}} + {{#neq maxContains null}} + {{> src/main/kotlin/packagename/components/schemas/SchemaClass/_maxContains }} + {{/neq}} + {{#neq minContains null}} + {{> src/main/kotlin/packagename/components/schemas/SchemaClass/_minContains }} + {{/neq}} + {{#if prefixItems}} + {{> src/main/kotlin/packagename/components/schemas/SchemaClass/_prefixItems }} + {{/if}} + {{#if if_}} + {{> src/main/kotlin/packagename/components/schemas/SchemaClass/_if }} + {{/if}} + {{#if then}} + {{> src/main/kotlin/packagename/components/schemas/SchemaClass/_then }} + {{/if}} + {{#if else_}} + {{> src/main/kotlin/packagename/components/schemas/SchemaClass/_else }} + {{/if}} + {{#if unevaluatedItems}} + {{> src/main/kotlin/packagename/components/schemas/SchemaClass/_unevaluatedItems }} + {{/if}} +), ListSchemaValidator<{{#if arrayOutputJsonPathPiece}}{{arrayOutputJsonPathPiece.pascalCase}}{{else}}FrozenList{{/if}}, {{jsonPathPiece.pascalCase}}BoxedList> { {{#if componentModule}} /* NOTE: This class is auto generated by OpenAPI JSON Schema Generator. @@ -16,69 +69,15 @@ public static class {{jsonPathPiece.pascalCase}} extends JsonSchema<{{jsonPathPi {{/if}} */ {{/if}} - private static @Nullable {{jsonPathPiece.pascalCase}} instance = null; - protected {{../jsonPathPiece.pascalCase}}() { - super(new JsonSchemaInfo() - {{#if types}} - {{> src/main/kotlin/packagename/components/schemas/SchemaClass/_types }} - {{/if}} - {{#if items}} - {{> src/main/kotlin/packagename/components/schemas/SchemaClass/_items }} - {{/if}} - {{#neq maxItems null}} - {{> src/main/kotlin/packagename/components/schemas/SchemaClass/_maxItems }} - {{/neq}} - {{#neq minItems null}} - {{> src/main/kotlin/packagename/components/schemas/SchemaClass/_minItems }} - {{/neq}} - {{#if allOf}} - {{> src/main/kotlin/packagename/components/schemas/SchemaClass/_allOf }} - {{/if}} - {{#if anyOf}} - {{> src/main/kotlin/packagename/components/schemas/SchemaClass/_anyOf }} - {{/if}} - {{#if oneOf}} - {{> src/main/kotlin/packagename/components/schemas/SchemaClass/_oneOf }} - {{/if}} - {{#if not}} - {{> src/main/kotlin/packagename/components/schemas/SchemaClass/_not }} - {{/if}} - {{#neq uniqueItems null}} - {{> src/main/kotlin/packagename/components/schemas/SchemaClass/_uniqueItems }} - {{/neq}} - {{#if contains}} - {{> src/main/kotlin/packagename/components/schemas/SchemaClass/_contains }} - {{/if}} - {{#neq maxContains null}} - {{> src/main/kotlin/packagename/components/schemas/SchemaClass/_maxContains }} - {{/neq}} - {{#neq minContains null}} - {{> src/main/kotlin/packagename/components/schemas/SchemaClass/_minContains }} - {{/neq}} - {{#if prefixItems}} - {{> src/main/kotlin/packagename/components/schemas/SchemaClass/_prefixItems }} - {{/if}} - {{#if if_}} - {{> src/main/kotlin/packagename/components/schemas/SchemaClass/_if }} - {{/if}} - {{#if then}} - {{> src/main/kotlin/packagename/components/schemas/SchemaClass/_then }} - {{/if}} - {{#if else_}} - {{> src/main/kotlin/packagename/components/schemas/SchemaClass/_else }} - {{/if}} - {{#if unevaluatedItems}} - {{> src/main/kotlin/packagename/components/schemas/SchemaClass/_unevaluatedItems }} - {{/if}} - ); - } + companion object { + @Volatile + private var instance: {{jsonPathPiece.pascalCase}}? = null - public static {{jsonPathPiece.pascalCase}} getInstance() { - if (instance == null) { - instance = new {{jsonPathPiece.pascalCase}}(); - } - return instance; + fun getInstance() = + instance ?: synchronized(this) { + instance ?: {{jsonPathPiece.pascalCase}}().also { instance = it } + } } {{> src/main/kotlin/packagename/components/schemas/SchemaClass/_validate_implementor }} {{> src/main/kotlin/packagename/components/schemas/SchemaClass/_getNewInstanceObject_implementor }} diff --git a/src/main/resources/kotlin/src/main/kotlin/packagename/components/schemas/SchemaClass/_Schema_map.hbs b/src/main/resources/kotlin/src/main/kotlin/packagename/components/schemas/SchemaClass/_Schema_map.hbs index e309397f8fd..ffcaf69cad4 100644 --- a/src/main/resources/kotlin/src/main/kotlin/packagename/components/schemas/SchemaClass/_Schema_map.hbs +++ b/src/main/resources/kotlin/src/main/kotlin/packagename/components/schemas/SchemaClass/_Schema_map.hbs @@ -3,7 +3,63 @@ {{> src/main/kotlin/packagename/components/schemas/SchemaClass/_boxedClasses }} -public static class {{jsonPathPiece.pascalCase}} extends JsonSchema<{{jsonPathPiece.pascalCase}}Boxed> implements MapSchemaValidator<{{#if mapOutputJsonPathPiece}}{{mapOutputJsonPathPiece.pascalCase}}{{else}}FrozenMap<{{#with mapValueSchema}}{{> src/main/kotlin/packagename/components/schemas/types/schema_output_type sourceJsonPath=../jsonPath forceNull=true }}{{else}}@Nullable Object{{/with}}>{{/if}}, {{jsonPathPiece.pascalCase}}BoxedMap> { +class {{jsonPathPiece.pascalCase}} private constructor(): JsonSchema<{{jsonPathPiece.pascalCase}}Boxed>( + JsonSchemaInfo() + {{#if types}} + {{> src/main/kotlin/packagename/components/schemas/SchemaClass/_types }} + {{/if}} + {{#if properties}} + {{> src/main/kotlin/packagename/components/schemas/SchemaClass/_properties }} + {{/if}} + {{#if requiredProperties}} + {{> src/main/kotlin/packagename/components/schemas/SchemaClass/_required }} + {{/if}} + {{#neq maxProperties null}} + {{> src/main/kotlin/packagename/components/schemas/SchemaClass/_maxProperties }} + {{/neq}} + {{#neq minProperties null}} + {{> src/main/kotlin/packagename/components/schemas/SchemaClass/_minProperties }} + {{/neq}} + {{#if additionalProperties}} + {{> src/main/kotlin/packagename/components/schemas/SchemaClass/_additionalProperties }} + {{/if}} + {{#if allOf}} + {{> src/main/kotlin/packagename/components/schemas/SchemaClass/_allOf }} + {{/if}} + {{#if anyOf}} + {{> src/main/kotlin/packagename/components/schemas/SchemaClass/_anyOf }} + {{/if}} + {{#if oneOf}} + {{> src/main/kotlin/packagename/components/schemas/SchemaClass/_oneOf }} + {{/if}} + {{#if not}} + {{> src/main/kotlin/packagename/components/schemas/SchemaClass/_not }} + {{/if}} + {{#if propertyNames}} + {{> src/main/kotlin/packagename/components/schemas/SchemaClass/_propertyNames }} + {{/if}} + {{#if dependentRequired}} + {{> src/main/kotlin/packagename/components/schemas/SchemaClass/_dependentRequired }} + {{/if}} + {{#if dependentSchemas}} + {{> src/main/kotlin/packagename/components/schemas/SchemaClass/_dependentSchemas }} + {{/if}} + {{#if patternProperties}} + {{> src/main/kotlin/packagename/components/schemas/SchemaClass/_patternProperties }} + {{/if}} + {{#if if_}} + {{> src/main/kotlin/packagename/components/schemas/SchemaClass/_if }} + {{/if}} + {{#if then}} + {{> src/main/kotlin/packagename/components/schemas/SchemaClass/_then }} + {{/if}} + {{#if else_}} + {{> src/main/kotlin/packagename/components/schemas/SchemaClass/_else }} + {{/if}} + {{#if unevaluatedProperties}} + {{> src/main/kotlin/packagename/components/schemas/SchemaClass/_unevaluatedProperties }} + {{/if}} +), MapSchemaValidator<{{#if mapOutputJsonPathPiece}}{{mapOutputJsonPathPiece.pascalCase}}{{else}}FrozenMap<{{#with mapValueSchema}}{{> src/main/kotlin/packagename/components/schemas/types/schema_output_type sourceJsonPath=../jsonPath forceNull=true }}{{else}}Any?{{/with}}>{{/if}}, {{jsonPathPiece.pascalCase}}BoxedMap> { {{#if componentModule}} /* NOTE: This class is auto generated by OpenAPI JSON Schema Generator. @@ -16,72 +72,15 @@ public static class {{jsonPathPiece.pascalCase}} extends JsonSchema<{{jsonPathPi {{/if}} */ {{/if}} - private static @Nullable {{jsonPathPiece.pascalCase}} instance = null; - protected {{../jsonPathPiece.pascalCase}}() { - super(new JsonSchemaInfo() - {{#if types}} - {{> src/main/kotlin/packagename/components/schemas/SchemaClass/_types }} - {{/if}} - {{#if properties}} - {{> src/main/kotlin/packagename/components/schemas/SchemaClass/_properties }} - {{/if}} - {{#if requiredProperties}} - {{> src/main/kotlin/packagename/components/schemas/SchemaClass/_required }} - {{/if}} - {{#neq maxProperties null}} - {{> src/main/kotlin/packagename/components/schemas/SchemaClass/_maxProperties }} - {{/neq}} - {{#neq minProperties null}} - {{> src/main/kotlin/packagename/components/schemas/SchemaClass/_minProperties }} - {{/neq}} - {{#if additionalProperties}} - {{> src/main/kotlin/packagename/components/schemas/SchemaClass/_additionalProperties }} - {{/if}} - {{#if allOf}} - {{> src/main/kotlin/packagename/components/schemas/SchemaClass/_allOf }} - {{/if}} - {{#if anyOf}} - {{> src/main/kotlin/packagename/components/schemas/SchemaClass/_anyOf }} - {{/if}} - {{#if oneOf}} - {{> src/main/kotlin/packagename/components/schemas/SchemaClass/_oneOf }} - {{/if}} - {{#if not}} - {{> src/main/kotlin/packagename/components/schemas/SchemaClass/_not }} - {{/if}} - {{#if propertyNames}} - {{> src/main/kotlin/packagename/components/schemas/SchemaClass/_propertyNames }} - {{/if}} - {{#if dependentRequired}} - {{> src/main/kotlin/packagename/components/schemas/SchemaClass/_dependentRequired }} - {{/if}} - {{#if dependentSchemas}} - {{> src/main/kotlin/packagename/components/schemas/SchemaClass/_dependentSchemas }} - {{/if}} - {{#if patternProperties}} - {{> src/main/kotlin/packagename/components/schemas/SchemaClass/_patternProperties }} - {{/if}} - {{#if if_}} - {{> src/main/kotlin/packagename/components/schemas/SchemaClass/_if }} - {{/if}} - {{#if then}} - {{> src/main/kotlin/packagename/components/schemas/SchemaClass/_then }} - {{/if}} - {{#if else_}} - {{> src/main/kotlin/packagename/components/schemas/SchemaClass/_else }} - {{/if}} - {{#if unevaluatedProperties}} - {{> src/main/kotlin/packagename/components/schemas/SchemaClass/_unevaluatedProperties }} - {{/if}} - ); - } + companion object { + @Volatile + private var instance: {{jsonPathPiece.pascalCase}}? = null - public static {{jsonPathPiece.pascalCase}} getInstance() { - if (instance == null) { - instance = new {{jsonPathPiece.pascalCase}}(); - } - return instance; + fun getInstance() = + instance ?: synchronized(this) { + instance ?: {{jsonPathPiece.pascalCase}}().also { instance = it } + } } {{#if hasDiscriminatorWithNonEmptyMapping}} {{!> components/schemas/schema_cls/_discriminator }} diff --git a/src/main/resources/kotlin/src/main/kotlin/packagename/components/schemas/SchemaClass/_Schema_null.hbs b/src/main/resources/kotlin/src/main/kotlin/packagename/components/schemas/SchemaClass/_Schema_null.hbs index 891a45de9e7..5e911ef5152 100644 --- a/src/main/resources/kotlin/src/main/kotlin/packagename/components/schemas/SchemaClass/_Schema_null.hbs +++ b/src/main/resources/kotlin/src/main/kotlin/packagename/components/schemas/SchemaClass/_Schema_null.hbs @@ -3,7 +3,42 @@ {{> src/main/kotlin/packagename/components/schemas/SchemaClass/_boxedClasses }} -public static class {{jsonPathPiece.pascalCase}} extends JsonSchema<{{jsonPathPiece.pascalCase}}Boxed> implements NullSchemaValidator<{{jsonPathPiece.pascalCase}}BoxedVoid>{{#and enumInfo enumInfo.typeToValues.null}}, NullEnumValidator{{/and}} { +class {{jsonPathPiece.pascalCase}} private constructor(): JsonSchema<{{jsonPathPiece.pascalCase}}Boxed>( + JsonSchemaInfo() + {{#if types}} + {{> src/main/kotlin/packagename/components/schemas/SchemaClass/_types }} + {{/if}} + {{#if allOf}} + {{> src/main/kotlin/packagename/components/schemas/SchemaClass/_allOf }} + {{/if}} + {{#if anyOf}} + {{> src/main/kotlin/packagename/components/schemas/SchemaClass/_anyOf }} + {{/if}} + {{#if oneOf}} + {{> src/main/kotlin/packagename/components/schemas/SchemaClass/_oneOf }} + {{/if}} + {{#if not}} + {{> src/main/kotlin/packagename/components/schemas/SchemaClass/_not }} + {{/if}} + {{#if enumInfo}} + {{> src/main/kotlin/packagename/components/schemas/SchemaClass/_enum }} + {{/if}} + {{#if defaultValue}} + {{> src/main/kotlin/packagename/components/schemas/SchemaClass/_default }} + {{/if}} + {{#if constInfo}} + {{> src/main/kotlin/packagename/components/schemas/SchemaClass/_const }} + {{/if}} + {{#if if_}} + {{> src/main/kotlin/packagename/components/schemas/SchemaClass/_if }} + {{/if}} + {{#if then}} + {{> src/main/kotlin/packagename/components/schemas/SchemaClass/_then }} + {{/if}} + {{#if else_}} + {{> src/main/kotlin/packagename/components/schemas/SchemaClass/_else }} + {{/if}} +), NullSchemaValidator<{{jsonPathPiece.pascalCase}}BoxedVoid>{{#and enumInfo enumInfo.typeToValues.null}}, NullEnumValidator{{/and}} { {{#if componentModule}} /* NOTE: This class is auto generated by OpenAPI JSON Schema Generator. @@ -16,51 +51,15 @@ public static class {{jsonPathPiece.pascalCase}} extends JsonSchema<{{jsonPathPi {{/if}} */ {{/if}} - private static @Nullable {{jsonPathPiece.pascalCase}} instance = null; - protected {{../jsonPathPiece.pascalCase}}() { - super(new JsonSchemaInfo() - {{#if types}} - {{> src/main/kotlin/packagename/components/schemas/SchemaClass/_types }} - {{/if}} - {{#if allOf}} - {{> src/main/kotlin/packagename/components/schemas/SchemaClass/_allOf }} - {{/if}} - {{#if anyOf}} - {{> src/main/kotlin/packagename/components/schemas/SchemaClass/_anyOf }} - {{/if}} - {{#if oneOf}} - {{> src/main/kotlin/packagename/components/schemas/SchemaClass/_oneOf }} - {{/if}} - {{#if not}} - {{> src/main/kotlin/packagename/components/schemas/SchemaClass/_not }} - {{/if}} - {{#if enumInfo}} - {{> src/main/kotlin/packagename/components/schemas/SchemaClass/_enum }} - {{/if}} - {{#if defaultValue}} - {{> src/main/kotlin/packagename/components/schemas/SchemaClass/_default }} - {{/if}} - {{#if constInfo}} - {{> src/main/kotlin/packagename/components/schemas/SchemaClass/_const }} - {{/if}} - {{#if if_}} - {{> src/main/kotlin/packagename/components/schemas/SchemaClass/_if }} - {{/if}} - {{#if then}} - {{> src/main/kotlin/packagename/components/schemas/SchemaClass/_then }} - {{/if}} - {{#if else_}} - {{> src/main/kotlin/packagename/components/schemas/SchemaClass/_else }} - {{/if}} - ); - } + companion object { + @Volatile + private var instance: {{jsonPathPiece.pascalCase}}? = null - public static {{jsonPathPiece.pascalCase}} getInstance() { - if (instance == null) { - instance = new {{jsonPathPiece.pascalCase}}(); - } - return instance; + fun getInstance() = + instance ?: synchronized(this) { + instance ?: {{jsonPathPiece.pascalCase}}().also { instance = it } + } } {{> src/main/kotlin/packagename/components/schemas/SchemaClass/_validate_implementor }} {{> src/main/kotlin/packagename/components/schemas/SchemaClass/_getNewInstanceObject_implementor }} diff --git a/src/main/resources/kotlin/src/main/kotlin/packagename/components/schemas/SchemaClass/_Schema_number.hbs b/src/main/resources/kotlin/src/main/kotlin/packagename/components/schemas/SchemaClass/_Schema_number.hbs index ab27cdb3512..75f31e6851e 100644 --- a/src/main/resources/kotlin/src/main/kotlin/packagename/components/schemas/SchemaClass/_Schema_number.hbs +++ b/src/main/resources/kotlin/src/main/kotlin/packagename/components/schemas/SchemaClass/_Schema_number.hbs @@ -3,7 +3,60 @@ {{> src/main/kotlin/packagename/components/schemas/SchemaClass/_boxedClasses }} -public static class {{jsonPathPiece.pascalCase}} extends JsonSchema<{{jsonPathPiece.pascalCase}}Boxed> implements {{#with enumInfo}}{{#if typeToValues.Integer}}IntegerEnumValidator, {{/if}}{{#if typeToValues.Long}}LongEnumValidator, {{/if}}{{#if typeToValues.Float}}FloatEnumValidator, {{/if}}{{#if typeToValues.Double}}DoubleEnumValidator, {{/if}}{{/with}}NumberSchemaValidator<{{jsonPathPiece.pascalCase}}BoxedNumber> { +class {{jsonPathPiece.pascalCase}} private constructor(): JsonSchema<{{jsonPathPiece.pascalCase}}Boxed>( + JsonSchemaInfo() + {{#if types}} + {{> src/main/kotlin/packagename/components/schemas/SchemaClass/_types }} + {{/if}} + {{#if format}} + {{> src/main/kotlin/packagename/components/schemas/SchemaClass/_format }} + {{/if}} + {{#neq exclusiveMaximum null}} + {{> src/main/kotlin/packagename/components/schemas/SchemaClass/_exclusiveMaximum }} + {{/neq}} + {{#neq exclusiveMinimum null}} + {{> src/main/kotlin/packagename/components/schemas/SchemaClass/_exclusiveMinimum }} + {{/neq}} + {{#neq maximum null}} + {{> src/main/kotlin/packagename/components/schemas/SchemaClass/_maximum }} + {{/neq}} + {{#neq minimum null}} + {{> src/main/kotlin/packagename/components/schemas/SchemaClass/_minimum }} + {{/neq}} + {{#neq multipleOf null}} + {{> src/main/kotlin/packagename/components/schemas/SchemaClass/_multipleOf }} + {{/neq}} + {{#if allOf}} + {{> src/main/kotlin/packagename/components/schemas/SchemaClass/_allOf }} + {{/if}} + {{#if anyOf}} + {{> src/main/kotlin/packagename/components/schemas/SchemaClass/_anyOf }} + {{/if}} + {{#if oneOf}} + {{> src/main/kotlin/packagename/components/schemas/SchemaClass/_oneOf }} + {{/if}} + {{#if not}} + {{> src/main/kotlin/packagename/components/schemas/SchemaClass/_not }} + {{/if}} + {{#if enumInfo}} + {{> src/main/kotlin/packagename/components/schemas/SchemaClass/_enum }} + {{/if}} + {{#if defaultValue}} + {{> src/main/kotlin/packagename/components/schemas/SchemaClass/_default }} + {{/if}} + {{#if constInfo}} + {{> src/main/kotlin/packagename/components/schemas/SchemaClass/_const }} + {{/if}} + {{#if if_}} + {{> src/main/kotlin/packagename/components/schemas/SchemaClass/_if }} + {{/if}} + {{#if then}} + {{> src/main/kotlin/packagename/components/schemas/SchemaClass/_then }} + {{/if}} + {{#if else_}} + {{> src/main/kotlin/packagename/components/schemas/SchemaClass/_else }} + {{/if}} +), {{#with enumInfo}}{{#if typeToValues.Integer}}IntegerEnumValidator, {{/if}}{{#if typeToValues.Long}}LongEnumValidator, {{/if}}{{#if typeToValues.Float}}FloatEnumValidator, {{/if}}{{#if typeToValues.Double}}DoubleEnumValidator, {{/if}}{{/with}}NumberSchemaValidator<{{jsonPathPiece.pascalCase}}BoxedNumber> { {{#if componentModule}} /* NOTE: This class is auto generated by OpenAPI JSON Schema Generator. @@ -16,69 +69,15 @@ public static class {{jsonPathPiece.pascalCase}} extends JsonSchema<{{jsonPathPi {{/if}} */ {{/if}} - private static @Nullable {{jsonPathPiece.pascalCase}} instance = null; - protected {{../jsonPathPiece.pascalCase}}() { - super(new JsonSchemaInfo() - {{#if types}} - {{> src/main/kotlin/packagename/components/schemas/SchemaClass/_types }} - {{/if}} - {{#if format}} - {{> src/main/kotlin/packagename/components/schemas/SchemaClass/_format }} - {{/if}} - {{#neq exclusiveMaximum null}} - {{> src/main/kotlin/packagename/components/schemas/SchemaClass/_exclusiveMaximum }} - {{/neq}} - {{#neq exclusiveMinimum null}} - {{> src/main/kotlin/packagename/components/schemas/SchemaClass/_exclusiveMinimum }} - {{/neq}} - {{#neq maximum null}} - {{> src/main/kotlin/packagename/components/schemas/SchemaClass/_maximum }} - {{/neq}} - {{#neq minimum null}} - {{> src/main/kotlin/packagename/components/schemas/SchemaClass/_minimum }} - {{/neq}} - {{#neq multipleOf null}} - {{> src/main/kotlin/packagename/components/schemas/SchemaClass/_multipleOf }} - {{/neq}} - {{#if allOf}} - {{> src/main/kotlin/packagename/components/schemas/SchemaClass/_allOf }} - {{/if}} - {{#if anyOf}} - {{> src/main/kotlin/packagename/components/schemas/SchemaClass/_anyOf }} - {{/if}} - {{#if oneOf}} - {{> src/main/kotlin/packagename/components/schemas/SchemaClass/_oneOf }} - {{/if}} - {{#if not}} - {{> src/main/kotlin/packagename/components/schemas/SchemaClass/_not }} - {{/if}} - {{#if enumInfo}} - {{> src/main/kotlin/packagename/components/schemas/SchemaClass/_enum }} - {{/if}} - {{#if defaultValue}} - {{> src/main/kotlin/packagename/components/schemas/SchemaClass/_default }} - {{/if}} - {{#if constInfo}} - {{> src/main/kotlin/packagename/components/schemas/SchemaClass/_const }} - {{/if}} - {{#if if_}} - {{> src/main/kotlin/packagename/components/schemas/SchemaClass/_if }} - {{/if}} - {{#if then}} - {{> src/main/kotlin/packagename/components/schemas/SchemaClass/_then }} - {{/if}} - {{#if else_}} - {{> src/main/kotlin/packagename/components/schemas/SchemaClass/_else }} - {{/if}} - ); - } + companion object { + @Volatile + private var instance: {{jsonPathPiece.pascalCase}}? = null - public static {{jsonPathPiece.pascalCase}} getInstance() { - if (instance == null) { - instance = new {{jsonPathPiece.pascalCase}}(); - } - return instance; + fun getInstance() = + instance ?: synchronized(this) { + instance ?: {{jsonPathPiece.pascalCase}}().also { instance = it } + } } {{> src/main/kotlin/packagename/components/schemas/SchemaClass/_validate_implementor }} {{> src/main/kotlin/packagename/components/schemas/SchemaClass/_getNewInstanceObject_implementor }} diff --git a/src/main/resources/kotlin/src/main/kotlin/packagename/components/schemas/SchemaClass/_Schema_string.hbs b/src/main/resources/kotlin/src/main/kotlin/packagename/components/schemas/SchemaClass/_Schema_string.hbs index 1294000cd0d..d2e5bd67e1c 100644 --- a/src/main/resources/kotlin/src/main/kotlin/packagename/components/schemas/SchemaClass/_Schema_string.hbs +++ b/src/main/resources/kotlin/src/main/kotlin/packagename/components/schemas/SchemaClass/_Schema_string.hbs @@ -3,7 +3,54 @@ {{> src/main/kotlin/packagename/components/schemas/SchemaClass/_boxedClasses }} -public static class {{jsonPathPiece.pascalCase}} extends JsonSchema<{{jsonPathPiece.pascalCase}}Boxed> implements StringSchemaValidator<{{jsonPathPiece.pascalCase}}BoxedString>{{#and enumInfo enumInfo.typeToValues.string}}, StringEnumValidator{{/and}}{{#if defaultValue}}, DefaultValueMethod{{/if}} { +class {{jsonPathPiece.pascalCase}} private constructor(): JsonSchema<{{jsonPathPiece.pascalCase}}Boxed>( + JsonSchemaInfo() + {{#if types}} + {{> src/main/kotlin/packagename/components/schemas/SchemaClass/_types }} + {{/if}} + {{#if format}} + {{> src/main/kotlin/packagename/components/schemas/SchemaClass/_format }} + {{/if}} + {{#neq maxLength null }} + {{> src/main/kotlin/packagename/components/schemas/SchemaClass/_maxLength }} + {{/neq}} + {{#neq minLength null }} + {{> src/main/kotlin/packagename/components/schemas/SchemaClass/_minLength }} + {{/neq}} + {{#if allOf}} + {{> src/main/kotlin/packagename/components/schemas/SchemaClass/_allOf }} + {{/if}} + {{#if anyOf}} + {{> src/main/kotlin/packagename/components/schemas/SchemaClass/_anyOf }} + {{/if}} + {{#if oneOf}} + {{> src/main/kotlin/packagename/components/schemas/SchemaClass/_oneOf }} + {{/if}} + {{#if not}} + {{> src/main/kotlin/packagename/components/schemas/SchemaClass/_not }} + {{/if}} + {{#if enumInfo}} + {{> src/main/kotlin/packagename/components/schemas/SchemaClass/_enum }} + {{/if}} + {{#if patternInfo}} + {{> src/main/kotlin/packagename/components/schemas/SchemaClass/_pattern }} + {{/if}} + {{#if defaultValue}} + {{> src/main/kotlin/packagename/components/schemas/SchemaClass/_default }} + {{/if}} + {{#if constInfo}} + {{> src/main/kotlin/packagename/components/schemas/SchemaClass/_const }} + {{/if}} + {{#if if_}} + {{> src/main/kotlin/packagename/components/schemas/SchemaClass/_if }} + {{/if}} + {{#if then}} + {{> src/main/kotlin/packagename/components/schemas/SchemaClass/_then }} + {{/if}} + {{#if else_}} + {{> src/main/kotlin/packagename/components/schemas/SchemaClass/_else }} + {{/if}} +), StringSchemaValidator<{{jsonPathPiece.pascalCase}}BoxedString>{{#and enumInfo enumInfo.typeToValues.string}}, StringEnumValidator{{/and}}{{#if defaultValue}}, DefaultValueMethod{{/if}} { {{#if componentModule}} /* NOTE: This class is auto generated by OpenAPI JSON Schema Generator. @@ -16,72 +63,25 @@ public static class {{jsonPathPiece.pascalCase}} extends JsonSchema<{{jsonPathPi {{/if}} */ {{/if}} - private static @Nullable {{jsonPathPiece.pascalCase}} instance = null; - protected {{../jsonPathPiece.pascalCase}}() { - super(new JsonSchemaInfo() - {{#if types}} - {{> src/main/kotlin/packagename/components/schemas/SchemaClass/_types }} - {{/if}} - {{#if format}} - {{> src/main/kotlin/packagename/components/schemas/SchemaClass/_format }} - {{/if}} - {{#neq maxLength null }} - {{> src/main/kotlin/packagename/components/schemas/SchemaClass/_maxLength }} - {{/neq}} - {{#neq minLength null }} - {{> src/main/kotlin/packagename/components/schemas/SchemaClass/_minLength }} - {{/neq}} - {{#if allOf}} - {{> src/main/kotlin/packagename/components/schemas/SchemaClass/_allOf }} - {{/if}} - {{#if anyOf}} - {{> src/main/kotlin/packagename/components/schemas/SchemaClass/_anyOf }} - {{/if}} - {{#if oneOf}} - {{> src/main/kotlin/packagename/components/schemas/SchemaClass/_oneOf }} - {{/if}} - {{#if not}} - {{> src/main/kotlin/packagename/components/schemas/SchemaClass/_not }} - {{/if}} - {{#if enumInfo}} - {{> src/main/kotlin/packagename/components/schemas/SchemaClass/_enum }} - {{/if}} - {{#if patternInfo}} - {{> src/main/kotlin/packagename/components/schemas/SchemaClass/_pattern }} - {{/if}} - {{#if defaultValue}} - {{> src/main/kotlin/packagename/components/schemas/SchemaClass/_default }} - {{/if}} - {{#if constInfo}} - {{> src/main/kotlin/packagename/components/schemas/SchemaClass/_const }} - {{/if}} - {{#if if_}} - {{> src/main/kotlin/packagename/components/schemas/SchemaClass/_if }} - {{/if}} - {{#if then}} - {{> src/main/kotlin/packagename/components/schemas/SchemaClass/_then }} - {{/if}} - {{#if else_}} - {{> src/main/kotlin/packagename/components/schemas/SchemaClass/_else }} - {{/if}} - ); - } + companion object { + @Volatile + private var instance: {{jsonPathPiece.pascalCase}}? = null - public static {{jsonPathPiece.pascalCase}} getInstance() { - if (instance == null) { - instance = new {{jsonPathPiece.pascalCase}}(); - } - return instance; + fun getInstance() = + instance ?: synchronized(this) { + instance ?: {{jsonPathPiece.pascalCase}}().also { instance = it } + } } {{> src/main/kotlin/packagename/components/schemas/SchemaClass/_validate_implementor }} {{> src/main/kotlin/packagename/components/schemas/SchemaClass/_getNewInstanceObject_implementor }} {{#if defaultValue}} - public String defaultValue() throws ValidationException { - if (defaultValue instanceof String) { - return (String) defaultValue; + @Throws(ValidationException::class) + override fun defaultValue(): String { + if (defaultValue is String) { + return defaultValue } - throw new ValidationException("Invalid type stored in defaultValue"); + throw ValidationException("Invalid type stored in defaultValue") } {{/if}} {{> src/main/kotlin/packagename/components/schemas/SchemaClass/_validateAndBox }} diff --git a/src/main/resources/kotlin/src/main/kotlin/packagename/components/schemas/SchemaClass/_Schema_varEqualsClass.hbs b/src/main/resources/kotlin/src/main/kotlin/packagename/components/schemas/SchemaClass/_Schema_varEqualsClass.hbs index a3c7ff770a2..4750ba5ebad 100644 --- a/src/main/resources/kotlin/src/main/kotlin/packagename/components/schemas/SchemaClass/_Schema_varEqualsClass.hbs +++ b/src/main/resources/kotlin/src/main/kotlin/packagename/components/schemas/SchemaClass/_Schema_varEqualsClass.hbs @@ -2,9 +2,9 @@ {{#or isBooleanSchemaTrue isBooleanSchemaFalse}} {{#if isBooleanSchemaTrue}} -public static class {{../jsonPathPiece.pascalCase}} extends AnyTypeJsonSchema.AnyTypeJsonSchema1 { +class {{../jsonPathPiece.pascalCase}} : AnyTypeJsonSchema.AnyTypeJsonSchema1() { {{else}} -public static class {{jsonPathPiece.pascalCase}} extends NotAnyTypeJsonSchema.NotAnyTypeJsonSchema1 { +class {{jsonPathPiece.pascalCase}} : NotAnyTypeJsonSchema.NotAnyTypeJsonSchema1() { // NotAnyTypeSchema {{/if}} {{else}} @@ -12,11 +12,11 @@ public static class {{jsonPathPiece.pascalCase}} extends NotAnyTypeJsonSchema.No {{#if simpleRef}} {{#if refInfo.refModule}} {{#with getDeepestRef}} -public static class {{../jsonPathPiece.pascalCase}} extends {{jsonPathPiece.pascalCase}} { +class {{../jsonPathPiece.pascalCase}} : {{jsonPathPiece.pascalCase}}() { {{/with}} {{else}} {{#with refInfo.ref}} -public class {{../jsonPathPiece.pascalCase}} extends {{jsonPathPiece.pascalCase}} {} +class {{../jsonPathPiece.pascalCase}} : {{jsonPathPiece.pascalCase}}() {} {{/with}} {{/if}} {{else}} @@ -24,36 +24,36 @@ public class {{../jsonPathPiece.pascalCase}} extends {{jsonPathPiece.pascalCase} {{/if}} {{else}} {{#eq types null}} -public static class {{../jsonPathPiece.pascalCase}} extends AnyTypeJsonSchema.AnyTypeJsonSchema1 { +class {{../jsonPathPiece.pascalCase}} : AnyTypeJsonSchema.AnyTypeJsonSchema1() { {{else}} {{#each types}} {{#eq this "null"}} -public static class {{../jsonPathPiece.pascalCase}} extends NullJsonSchema.NullJsonSchema1 { +class {{../jsonPathPiece.pascalCase}} : NullJsonSchema.NullJsonSchema1() { {{/eq}} {{#eq this "object"}} -public static class {{../jsonPathPiece.pascalCase}} extends MapJsonSchema.MapJsonSchema1 { +class {{../jsonPathPiece.pascalCase}} : MapJsonSchema.MapJsonSchema1() { {{/eq}} {{#eq this "array"}} -public static class {{../jsonPathPiece.pascalCase}} extends ListJsonSchema.ListJsonSchema1 { +class {{../jsonPathPiece.pascalCase}} : ListJsonSchema.ListJsonSchema1() { {{/eq}} {{#eq this "boolean"}} -public static class {{../jsonPathPiece.pascalCase}} extends BooleanJsonSchema.BooleanJsonSchema1 { +class {{../jsonPathPiece.pascalCase}} : BooleanJsonSchema.BooleanJsonSchema1() { {{/eq}} {{#eq this "string"}} {{#eq ../format "date"}} -public static class {{../jsonPathPiece.pascalCase}} extends DateJsonSchema.DateJsonSchema1 { +class {{../jsonPathPiece.pascalCase}} : DateJsonSchema.DateJsonSchema1() { {{/eq}} {{#eq ../format "date-time"}} -public static class {{../jsonPathPiece.pascalCase}} extends DateTimeJsonSchema.DateTimeJsonSchema1 { +class {{../jsonPathPiece.pascalCase}} : DateTimeJsonSchema.DateTimeJsonSchema1() { {{/eq}} {{#eq ../format "uuid"}} -public static class {{../jsonPathPiece.pascalCase}} extends UuidJsonSchema.UuidJsonSchema1 { +class {{../jsonPathPiece.pascalCase}} : UuidJsonSchema.UuidJsonSchema1() { {{/eq}} {{#eq ../format "number"}} -public static class {{../jsonPathPiece.pascalCase}} extends DecimalJsonSchema.DecimalJsonSchema1 { +class {{../jsonPathPiece.pascalCase}} : DecimalJsonSchema.DecimalJsonSchema1() { {{/eq}} {{#eq ../format "binary"}} -public static class {{jsonPathPiece.pascalCase}} extends StringJsonSchema.StringJsonSchema1 { +class {{jsonPathPiece.pascalCase}} : StringJsonSchema.StringJsonSchema1() { // BinarySchema {{/eq}} {{#neq ../format "date"}} @@ -61,7 +61,7 @@ public static class {{jsonPathPiece.pascalCase}} extends StringJsonSchema.String {{#neq ../format "uuid"}} {{#neq ../format "number"}} {{#neq ../format "binary"}} -public static class {{../jsonPathPiece.pascalCase}} extends StringJsonSchema.StringJsonSchema1 { +class {{../jsonPathPiece.pascalCase}} : StringJsonSchema.StringJsonSchema1() { {{/neq}} {{/neq}} {{/neq}} @@ -70,26 +70,26 @@ public static class {{../jsonPathPiece.pascalCase}} extends StringJsonSchema.Str {{/eq}} {{#eq this "integer"}} {{#eq ../format "int32"}} -public static class {{../jsonPathPiece.pascalCase}} extends Int32JsonSchema.Int32JsonSchema1 { +class {{../jsonPathPiece.pascalCase}} : Int32JsonSchema.Int32JsonSchema1() { {{/eq}} {{#eq ../format "int64"}} -public static class {{../jsonPathPiece.pascalCase}} extends Int64JsonSchema.Int64JsonSchema1 { +class {{../jsonPathPiece.pascalCase}} : Int64JsonSchema.Int64JsonSchema1() { {{/eq}} {{#neq ../format "int32"}} {{#neq ../format "int64"}} -public static class {{../jsonPathPiece.pascalCase}} extends IntJsonSchema.IntJsonSchema1 { +class {{../jsonPathPiece.pascalCase}} : IntJsonSchema.IntJsonSchema1() { {{/neq}} {{/neq}} {{/eq}} {{#eq this "number"}} {{#eq ../format null}} -public static class {{../jsonPathPiece.pascalCase}} extends NumberJsonSchema.NumberJsonSchema1 { +class {{../jsonPathPiece.pascalCase}} : NumberJsonSchema.NumberJsonSchema1() { {{else}} {{#eq ../format "float"}} -public static class {{../jsonPathPiece.pascalCase}} extends FloatJsonSchema.FloatJsonSchema1 { +class {{../jsonPathPiece.pascalCase}} : FloatJsonSchema.FloatJsonSchema1() { {{else}} {{#eq ../format "double"}} -public static class {{../jsonPathPiece.pascalCase}} extends DoubleJsonSchema.DoubleJsonSchema1 { +class {{../jsonPathPiece.pascalCase}} : DoubleJsonSchema.DoubleJsonSchema1() { {{/eq}} {{/eq}} {{/eq}} @@ -98,11 +98,13 @@ public static class {{../jsonPathPiece.pascalCase}} extends DoubleJsonSchema.Dou {{/eq}} {{/if}} {{/or}} - private static @Nullable {{jsonPathPiece.pascalCase}} instance = null; - public static {{jsonPathPiece.pascalCase}} getInstance() { - if (instance == null) { - instance = new {{jsonPathPiece.pascalCase}}(); - } - return instance; + companion object { + @Volatile + private var instance: {{jsonPathPiece.pascalCase}}? = null + + fun getInstance() = + instance ?: synchronized(this) { + instance ?: {{jsonPathPiece.pascalCase}}().also { instance = it } + } } } diff --git a/src/main/resources/kotlin/src/main/kotlin/packagename/components/schemas/SchemaClass/_additionalProperties.hbs b/src/main/resources/kotlin/src/main/kotlin/packagename/components/schemas/SchemaClass/_additionalProperties.hbs index 01b618e5650..0f23c607c88 100644 --- a/src/main/resources/kotlin/src/main/kotlin/packagename/components/schemas/SchemaClass/_additionalProperties.hbs +++ b/src/main/resources/kotlin/src/main/kotlin/packagename/components/schemas/SchemaClass/_additionalProperties.hbs @@ -2,16 +2,16 @@ {{#with additionalProperties}} {{#if refInfo.refClass}} {{#if refInfo.refModule}} -additionalProperties = [{{refInfo.refModule}}.{{refInfo.refClass}}.class]({{docRoot}}{{refInfo.ref.pathFromDocRoot}}.md#{{refInfo.ref.jsonPathPiece.kebabCase}}) +additionalProperties = [{{refInfo.refModule}}.{{refInfo.refClass}}::class.java]({{docRoot}}{{refInfo.ref.pathFromDocRoot}}.md#{{refInfo.ref.jsonPathPiece.kebabCase}}) {{~else}} -additionalProperties = [{{refInfo.refClass}}.class](#{{refInfo.ref.jsonPathPiece.kebabCase}}) +additionalProperties = [{{refInfo.refClass}}::class.java](#{{refInfo.ref.jsonPathPiece.kebabCase}}) {{~/if}} {{else}} -additionalProperties = [{{jsonPathPiece.pascalCase}}.class](#{{jsonPathPiece.kebabCase}}) +additionalProperties = [{{jsonPathPiece.pascalCase}}::class.java](#{{jsonPathPiece.kebabCase}}) {{~/if}} {{~/with}} {{else}} {{#with additionalProperties}} -.additionalProperties({{#if refInfo.refClass}}{{#if refInfo.refModule}}{{refInfo.refModule}}.{{/if}}{{refInfo.refClass}}{{else}}{{jsonPathPiece.pascalCase}}{{/if}}.class) +.additionalProperties({{#if refInfo.refClass}}{{#if refInfo.refModule}}{{refInfo.refModule}}.{{/if}}{{refInfo.refClass}}{{else}}{{jsonPathPiece.pascalCase}}{{/if}}::class.java) {{/with}} {{/if}} \ No newline at end of file diff --git a/src/main/resources/kotlin/src/main/kotlin/packagename/components/schemas/SchemaClass/_allOf.hbs b/src/main/resources/kotlin/src/main/kotlin/packagename/components/schemas/SchemaClass/_allOf.hbs index cba0b06fac6..2af5d095d08 100644 --- a/src/main/resources/kotlin/src/main/kotlin/packagename/components/schemas/SchemaClass/_allOf.hbs +++ b/src/main/resources/kotlin/src/main/kotlin/packagename/components/schemas/SchemaClass/_allOf.hbs @@ -1,28 +1,28 @@ {{#if forDocs}} -allOf = List.of(
+allOf = listOf(
{{~#each allOf}} {{#if refInfo.refClass}} {{#if refInfo.refModule}} -    [{{refInfo.refModule}}.{{refInfo.refClass}}.class]({{docRoot}}{{refInfo.ref.pathFromDocRoot}}.md#{{refInfo.ref.jsonPathPiece.kebabCase}}){{#unless @last}},{{/unless}}
+    [{{refInfo.refModule}}.{{refInfo.refClass}}::class.java]({{docRoot}}{{refInfo.ref.pathFromDocRoot}}.md#{{refInfo.ref.jsonPathPiece.kebabCase}}){{#unless @last}},{{/unless}}
{{~else}} -    [{{refInfo.refClass}}.class](#{{refInfo.ref.jsonPathPiece.kebabCase}}){{#unless @last}},{{/unless}}
+    [{{refInfo.refClass}}::class.java](#{{refInfo.ref.jsonPathPiece.kebabCase}}){{#unless @last}},{{/unless}}
{{~/if}} {{else}} -    [{{jsonPathPiece.pascalCase}}.class](#{{jsonPathPiece.kebabCase}}){{#unless @last}},{{/unless}}
+    [{{jsonPathPiece.pascalCase}}::class.java](#{{jsonPathPiece.kebabCase}}){{#unless @last}},{{/unless}}
{{~/if}} {{/each}} ;)
{{~else}} -.allOf(List.of( +.allOf(listOf( {{#each allOf}} {{#if refInfo.refClass}} {{#if refInfo.refModule}} - {{refInfo.refModule}}.{{refInfo.refClass}}.class{{#unless @last}},{{/unless}} + {{refInfo.refModule}}.{{refInfo.refClass}}::class.java{{#unless @last}},{{/unless}} {{else}} - {{refInfo.refClass}}.class{{#unless @last}},{{/unless}} + {{refInfo.refClass}}::class.java{{#unless @last}},{{/unless}} {{/if}} {{else}} - {{jsonPathPiece.pascalCase}}.class{{#unless @last}},{{/unless}} + {{jsonPathPiece.pascalCase}}::class.java{{#unless @last}},{{/unless}} {{/if}} {{/each}} )) diff --git a/src/main/resources/kotlin/src/main/kotlin/packagename/components/schemas/SchemaClass/_anyOf.hbs b/src/main/resources/kotlin/src/main/kotlin/packagename/components/schemas/SchemaClass/_anyOf.hbs index ecfdebd360e..563c574a75a 100644 --- a/src/main/resources/kotlin/src/main/kotlin/packagename/components/schemas/SchemaClass/_anyOf.hbs +++ b/src/main/resources/kotlin/src/main/kotlin/packagename/components/schemas/SchemaClass/_anyOf.hbs @@ -1,28 +1,28 @@ {{#if forDocs}} -anyOf = List.of(
+anyOf = listOf(
{{~#each anyOf}} {{#if refInfo.refClass}} {{#if refInfo.refModule}} -    [{{refInfo.refModule}}.{{refInfo.refClass}}.class]({{docRoot}}{{refInfo.ref.pathFromDocRoot}}.md#{{refInfo.ref.jsonPathPiece.kebabCase}}){{#unless @last}},{{/unless}}
+    [{{refInfo.refModule}}.{{refInfo.refClass}}::class.java]({{docRoot}}{{refInfo.ref.pathFromDocRoot}}.md#{{refInfo.ref.jsonPathPiece.kebabCase}}){{#unless @last}},{{/unless}}
{{~else}} -    [{{refInfo.refClass}}.class](#{{refInfo.ref.jsonPathPiece.kebabCase}}){{#unless @last}},{{/unless}}
+    [{{refInfo.refClass}}::class.java](#{{refInfo.ref.jsonPathPiece.kebabCase}}){{#unless @last}},{{/unless}}
{{~/if}} {{else}} -    [{{jsonPathPiece.pascalCase}}.class](#{{jsonPathPiece.kebabCase}}){{#unless @last}},{{/unless}}
+    [{{jsonPathPiece.pascalCase}}::class.java](#{{jsonPathPiece.kebabCase}}){{#unless @last}},{{/unless}}
{{~/if}} {{/each}} )
{{~else}} -.anyOf(List.of( +.anyOf(listOf( {{#each anyOf}} {{#if refInfo.refClass}} {{#if refInfo.refModule}} - {{refInfo.refModule}}.{{refInfo.refClass}}.class{{#unless @last}},{{/unless}} + {{refInfo.refModule}}.{{refInfo.refClass}}::class.java{{#unless @last}},{{/unless}} {{else}} - {{refInfo.refClass}}.class{{#unless @last}},{{/unless}} + {{refInfo.refClass}}::class.java{{#unless @last}},{{/unless}} {{/if}} {{else}} - {{jsonPathPiece.pascalCase}}.class{{#unless @last}},{{/unless}} + {{jsonPathPiece.pascalCase}}::class.java{{#unless @last}},{{/unless}} {{/if}} {{/each}} )) diff --git a/src/main/resources/kotlin/src/main/kotlin/packagename/components/schemas/SchemaClass/_boxedBoolean.hbs b/src/main/resources/kotlin/src/main/kotlin/packagename/components/schemas/SchemaClass/_boxedBoolean.hbs index 6086ccbf430..4c2f62d3326 100644 --- a/src/main/resources/kotlin/src/main/kotlin/packagename/components/schemas/SchemaClass/_boxedBoolean.hbs +++ b/src/main/resources/kotlin/src/main/kotlin/packagename/components/schemas/SchemaClass/_boxedBoolean.hbs @@ -1,6 +1,6 @@ {{#if forDocs}} {{> src/main/kotlin/packagename/components/_helper_header_from_identifier_pieces headerSize=(join headerSize "#" "") identifierPieces=(append identifierPieces (join jsonPathPiece.pascalCase "BoxedBoolean" "")) }} -public record {{jsonPathPiece.pascalCase}}BoxedBoolean
+data class {{jsonPathPiece.pascalCase}}BoxedBoolean
implements [{{jsonPathPiece.pascalCase}}Boxed](#{{> src/main/kotlin/packagename/components/_helper_anchor_id identifierPieces=(append identifierPieces (join jsonPathPiece.kebabCase "boxed" "")) }}) record that stores validated boolean payloads, sealed permits implementation @@ -14,13 +14,12 @@ record that stores validated boolean payloads, sealed permits implementation | Modifier and Type | Method and Description | | ----------------- | ---------------------- | | boolean | data()
validated payload | -| @Nullable Object | getData()
validated payload | +| Any? | getData()
validated payload | {{else}} -public record {{jsonPathPiece.pascalCase}}BoxedBoolean(boolean data) implements {{jsonPathPiece.pascalCase}}Boxed { - @Override - public @Nullable Object getData() { - return data; +data class {{jsonPathPiece.pascalCase}}BoxedBoolean(val data: Boolean): {{jsonPathPiece.pascalCase}}Boxed { + override fun getData(): Any? { + return data } } diff --git a/src/main/resources/kotlin/src/main/kotlin/packagename/components/schemas/SchemaClass/_boxedClass.hbs b/src/main/resources/kotlin/src/main/kotlin/packagename/components/schemas/SchemaClass/_boxedClass.hbs index 9eef60920a3..f9d0dcf9f0d 100644 --- a/src/main/resources/kotlin/src/main/kotlin/packagename/components/schemas/SchemaClass/_boxedClass.hbs +++ b/src/main/resources/kotlin/src/main/kotlin/packagename/components/schemas/SchemaClass/_boxedClass.hbs @@ -1,6 +1,6 @@ {{#if forDocs}} {{> src/main/kotlin/packagename/components/_helper_header_from_identifier_pieces headerSize=(join headerSize "#" "") identifierPieces=(append identifierPieces (join jsonPathPiece.pascalCase "Boxed" "")) }} -public sealed interface {{jsonPathPiece.pascalCase}}Boxed
+sealed interface {{jsonPathPiece.pascalCase}}Boxed
permits
{{#each types}} {{#eq this "null"}} @@ -32,8 +32,8 @@ permits
sealed interface that stores validated payloads using boxed classes {{else}} -public sealed interface {{jsonPathPiece.pascalCase}}Boxed permits {{#each types}}{{jsonPathPiece.pascalCase}}Boxed{{#eq this "null"}}Nothing?{{/eq}}{{#eq this "boolean"}}Boolean{{/eq}}{{#or (eq this "number") (eq this "integer")}}Number{{/or}}{{#and (eq this "string") (neq ../format "binary") }}String{{/and}}{{#eq this "array"}}List{{/eq}}{{#eq this "object"}}Map{{/eq}}{{#unless @last}}, {{/unless}}{{else}}{{jsonPathPiece.pascalCase}}BoxedVoid, {{jsonPathPiece.pascalCase}}BoxedBoolean, {{jsonPathPiece.pascalCase}}BoxedNumber, {{jsonPathPiece.pascalCase}}BoxedString, {{jsonPathPiece.pascalCase}}BoxedList, {{jsonPathPiece.pascalCase}}BoxedMap{{/each}} { - @Nullable Object getData(); +sealed interface {{jsonPathPiece.pascalCase}}Boxed { + fun getData(): Any? } {{/if}} \ No newline at end of file diff --git a/src/main/resources/kotlin/src/main/kotlin/packagename/components/schemas/SchemaClass/_boxedList.hbs b/src/main/resources/kotlin/src/main/kotlin/packagename/components/schemas/SchemaClass/_boxedList.hbs index 5f9df442323..211a1edb6af 100644 --- a/src/main/resources/kotlin/src/main/kotlin/packagename/components/schemas/SchemaClass/_boxedList.hbs +++ b/src/main/resources/kotlin/src/main/kotlin/packagename/components/schemas/SchemaClass/_boxedList.hbs @@ -1,26 +1,25 @@ {{#if forDocs}} {{> src/main/kotlin/packagename/components/_helper_header_from_identifier_pieces headerSize=(join headerSize "#" "") identifierPieces=(append identifierPieces (join jsonPathPiece.pascalCase "BoxedList" "")) }} -public record {{jsonPathPiece.pascalCase}}BoxedList
+data class {{jsonPathPiece.pascalCase}}BoxedList
implements [{{jsonPathPiece.pascalCase}}Boxed](#{{> src/main/kotlin/packagename/components/_helper_anchor_id identifierPieces=(append identifierPieces (join jsonPathPiece.kebabCase "boxed" "")) }}) -record that stores validated List payloads, sealed permits implementation +data class that stores validated List payloads, sealed permits implementation {{headerSize}}## Constructor Summary | Constructor and Description | | --------------------------- | -| {{jsonPathPiece.pascalCase}}BoxedList({{#if arrayOutputJsonPathPiece}}[{{arrayOutputJsonPathPiece.pascalCase}}](#{{> src/main/kotlin/packagename/components/_helper_anchor_id identifierPieces=(append identifierPieces arrayOutputJsonPathPiece) }}){{else}}FrozenList<@Nullable Object>{{/if}} data)
Creates an instance, private visibility | +| {{jsonPathPiece.pascalCase}}BoxedList({{#if arrayOutputJsonPathPiece}}[{{arrayOutputJsonPathPiece.pascalCase}}](#{{> src/main/kotlin/packagename/components/_helper_anchor_id identifierPieces=(append identifierPieces arrayOutputJsonPathPiece) }}){{else}}FrozenList{{/if}} data)
Creates an instance, private visibility | {{headerSize}}## Method Summary | Modifier and Type | Method and Description | | ----------------- | ---------------------- | -| {{#if arrayOutputJsonPathPiece}}[{{arrayOutputJsonPathPiece.pascalCase}}](#{{> src/main/kotlin/packagename/components/_helper_anchor_id identifierPieces=(append identifierPieces arrayOutputJsonPathPiece) }}){{else}}FrozenList<@Nullable Object>{{/if}} | data()
validated payload | -| @Nullable Object | getData()
validated payload | +| {{#if arrayOutputJsonPathPiece}}[{{arrayOutputJsonPathPiece.pascalCase}}](#{{> src/main/kotlin/packagename/components/_helper_anchor_id identifierPieces=(append identifierPieces arrayOutputJsonPathPiece) }}){{else}}FrozenList{{/if}} | data()
validated payload | +| Any? | getData()
validated payload | {{else}} -public record {{jsonPathPiece.pascalCase}}BoxedList({{#if arrayOutputJsonPathPiece}}{{arrayOutputJsonPathPiece.pascalCase}}{{else}}FrozenList<@Nullable Object>{{/if}} data) implements {{jsonPathPiece.pascalCase}}Boxed { - @Override - public @Nullable Object getData() { - return data; +data class {{jsonPathPiece.pascalCase}}BoxedList(val data: {{#if arrayOutputJsonPathPiece}}{{arrayOutputJsonPathPiece.pascalCase}}{{else}}FrozenList{{/if}}) : {{jsonPathPiece.pascalCase}}Boxed { + override fun getData(): Any? { + return data } } diff --git a/src/main/resources/kotlin/src/main/kotlin/packagename/components/schemas/SchemaClass/_boxedMap.hbs b/src/main/resources/kotlin/src/main/kotlin/packagename/components/schemas/SchemaClass/_boxedMap.hbs index 3b8837b2656..5d0241d271c 100644 --- a/src/main/resources/kotlin/src/main/kotlin/packagename/components/schemas/SchemaClass/_boxedMap.hbs +++ b/src/main/resources/kotlin/src/main/kotlin/packagename/components/schemas/SchemaClass/_boxedMap.hbs @@ -1,26 +1,25 @@ {{#if forDocs}} {{> src/main/kotlin/packagename/components/_helper_header_from_identifier_pieces headerSize=(join headerSize "#" "") identifierPieces=(append identifierPieces (join jsonPathPiece.pascalCase "BoxedMap" "")) }} -public record {{jsonPathPiece.pascalCase}}BoxedMap
+data class {{jsonPathPiece.pascalCase}}BoxedMap
implements [{{jsonPathPiece.pascalCase}}Boxed](#{{> src/main/kotlin/packagename/components/_helper_anchor_id identifierPieces=(append identifierPieces (join jsonPathPiece.kebabCase "boxed" "")) }}) -record that stores validated Map payloads, sealed permits implementation +data class that stores validated Map payloads, sealed permits implementation {{headerSize}}## Constructor Summary | Constructor and Description | | --------------------------- | -| {{jsonPathPiece.pascalCase}}BoxedMap({{#if mapOutputJsonPathPiece}}[{{mapOutputJsonPathPiece.pascalCase}}](#{{> src/main/kotlin/packagename/components/_helper_anchor_id identifierPieces=(append identifierPieces mapOutputJsonPathPiece) }}){{else}}FrozenMap<@Nullable Object>{{/if}} data)
Creates an instance, private visibility | +| {{jsonPathPiece.pascalCase}}BoxedMap({{#if mapOutputJsonPathPiece}}[{{mapOutputJsonPathPiece.pascalCase}}](#{{> src/main/kotlin/packagename/components/_helper_anchor_id identifierPieces=(append identifierPieces mapOutputJsonPathPiece) }}){{else}}FrozenMap{{/if}} data)
Creates an instance, private visibility | {{headerSize}}## Method Summary | Modifier and Type | Method and Description | | ----------------- | ---------------------- | -| {{#if mapOutputJsonPathPiece}}[{{mapOutputJsonPathPiece.pascalCase}}](#{{> src/main/kotlin/packagename/components/_helper_anchor_id identifierPieces=(append identifierPieces mapOutputJsonPathPiece) }}){{else}}FrozenMap<@Nullable Object>{{/if}} | data()
validated payload | -| @Nullable Object | getData()
validated payload | +| {{#if mapOutputJsonPathPiece}}[{{mapOutputJsonPathPiece.pascalCase}}](#{{> src/main/kotlin/packagename/components/_helper_anchor_id identifierPieces=(append identifierPieces mapOutputJsonPathPiece) }}){{else}}FrozenMap{{/if}} | data()
validated payload | +| Any? | getData()
validated payload | {{else}} -public record {{jsonPathPiece.pascalCase}}BoxedMap({{#if mapOutputJsonPathPiece}}{{mapOutputJsonPathPiece.pascalCase}}{{else}}FrozenMap<@Nullable Object>{{/if}} data) implements {{jsonPathPiece.pascalCase}}Boxed { - @Override - public @Nullable Object getData() { - return data; +data class {{jsonPathPiece.pascalCase}}BoxedMap(val data: {{#if mapOutputJsonPathPiece}}{{mapOutputJsonPathPiece.pascalCase}}{{else}}FrozenMap{{/if}}) : {{jsonPathPiece.pascalCase}}Boxed { + override fun getData(): Any? { + return data } } {{/if}} diff --git a/src/main/resources/kotlin/src/main/kotlin/packagename/components/schemas/SchemaClass/_boxedNumber.hbs b/src/main/resources/kotlin/src/main/kotlin/packagename/components/schemas/SchemaClass/_boxedNumber.hbs index 0eda90cd528..b4469dd365f 100644 --- a/src/main/resources/kotlin/src/main/kotlin/packagename/components/schemas/SchemaClass/_boxedNumber.hbs +++ b/src/main/resources/kotlin/src/main/kotlin/packagename/components/schemas/SchemaClass/_boxedNumber.hbs @@ -1,9 +1,9 @@ {{#if forDocs}} {{> src/main/kotlin/packagename/components/_helper_header_from_identifier_pieces headerSize=(join headerSize "#" "") identifierPieces=(append identifierPieces (join jsonPathPiece.pascalCase "BoxedNumber" "")) }} -public record {{jsonPathPiece.pascalCase}}BoxedNumber
+data class {{jsonPathPiece.pascalCase}}BoxedNumber
implements [{{jsonPathPiece.pascalCase}}Boxed](#{{> src/main/kotlin/packagename/components/_helper_anchor_id identifierPieces=(append identifierPieces (join jsonPathPiece.kebabCase "boxed" "")) }}) -record that stores validated Number payloads, sealed permits implementation +data class that stores validated Number payloads, sealed permits implementation {{headerSize}}## Constructor Summary | Constructor and Description | @@ -14,13 +14,12 @@ record that stores validated Number payloads, sealed permits implementation | Modifier and Type | Method and Description | | ----------------- | ---------------------- | | Number | data()
validated payload | -| @Nullable Object | getData()
validated payload | +| Any? | getData()
validated payload | {{else}} -public record {{jsonPathPiece.pascalCase}}BoxedNumber(Number data) implements {{jsonPathPiece.pascalCase}}Boxed { - @Override - public @Nullable Object getData() { - return data; +data class {{jsonPathPiece.pascalCase}}BoxedNumber(val data: Number) : {{jsonPathPiece.pascalCase}}Boxed { + override fun getData(): Any? { + return data } } diff --git a/src/main/resources/kotlin/src/main/kotlin/packagename/components/schemas/SchemaClass/_boxedString.hbs b/src/main/resources/kotlin/src/main/kotlin/packagename/components/schemas/SchemaClass/_boxedString.hbs index 4b2b9c0615c..9ab56448c68 100644 --- a/src/main/resources/kotlin/src/main/kotlin/packagename/components/schemas/SchemaClass/_boxedString.hbs +++ b/src/main/resources/kotlin/src/main/kotlin/packagename/components/schemas/SchemaClass/_boxedString.hbs @@ -1,9 +1,9 @@ {{#if forDocs}} {{> src/main/kotlin/packagename/components/_helper_header_from_identifier_pieces headerSize=(join headerSize "#" "") identifierPieces=(append identifierPieces (join jsonPathPiece.pascalCase "BoxedString" "")) }} -public record {{jsonPathPiece.pascalCase}}BoxedString
+data class {{jsonPathPiece.pascalCase}}BoxedString
implements [{{jsonPathPiece.pascalCase}}Boxed](#{{> src/main/kotlin/packagename/components/_helper_anchor_id identifierPieces=(append identifierPieces (join jsonPathPiece.kebabCase "boxed" "")) }}) -record that stores validated String payloads, sealed permits implementation +data class that stores validated String payloads, sealed permits implementation {{headerSize}}## Constructor Summary | Constructor and Description | @@ -14,13 +14,12 @@ record that stores validated String payloads, sealed permits implementation | Modifier and Type | Method and Description | | ----------------- | ---------------------- | | String | data()
validated payload | -| @Nullable Object | getData()
validated payload | +| Any? | getData()
validated payload | {{else}} -public record {{jsonPathPiece.pascalCase}}BoxedString(String data) implements {{jsonPathPiece.pascalCase}}Boxed { - @Override - public @Nullable Object getData() { - return data; +data class {{jsonPathPiece.pascalCase}}BoxedString(val data: String) : {{jsonPathPiece.pascalCase}}Boxed { + override fun getData(): Any? { + return data } } diff --git a/src/main/resources/kotlin/src/main/kotlin/packagename/components/schemas/SchemaClass/_boxedVoid.hbs b/src/main/resources/kotlin/src/main/kotlin/packagename/components/schemas/SchemaClass/_boxedVoid.hbs index ab3557beb48..7b8d49eb0c6 100644 --- a/src/main/resources/kotlin/src/main/kotlin/packagename/components/schemas/SchemaClass/_boxedVoid.hbs +++ b/src/main/resources/kotlin/src/main/kotlin/packagename/components/schemas/SchemaClass/_boxedVoid.hbs @@ -1,9 +1,9 @@ {{#if forDocs}} {{> src/main/kotlin/packagename/components/_helper_header_from_identifier_pieces headerSize=(join headerSize "#" "") identifierPieces=(append identifierPieces (join jsonPathPiece.pascalCase "BoxedVoid" "")) }} -public record {{jsonPathPiece.pascalCase}}BoxedVoid
+data class {{jsonPathPiece.pascalCase}}BoxedVoid
implements [{{jsonPathPiece.pascalCase}}Boxed](#{{> src/main/kotlin/packagename/components/_helper_anchor_id identifierPieces=(append identifierPieces (join jsonPathPiece.kebabCase "boxed" "")) }}) -record that stores validated null payloads, sealed permits implementation +data class that stores validated null payloads, sealed permits implementation {{headerSize}}## Constructor Summary | Constructor and Description | @@ -14,13 +14,12 @@ record that stores validated null payloads, sealed permits implementation | Modifier and Type | Method and Description | | ----------------- | ---------------------- | | Nothing? | data()
validated payload | -| @Nullable Object | getData()
validated payload | +| Any? | getData()
validated payload | {{else}} -public record {{jsonPathPiece.pascalCase}}BoxedVoid(Nothing? data) implements {{jsonPathPiece.pascalCase}}Boxed { - @Override - public @Nullable Object getData() { - return data; +data class {{jsonPathPiece.pascalCase}}BoxedVoid(val data: Nothing?) : {{jsonPathPiece.pascalCase}}Boxed { + override fun getData(): Any? { + return data } } diff --git a/src/main/resources/kotlin/src/main/kotlin/packagename/components/schemas/SchemaClass/_contains.hbs b/src/main/resources/kotlin/src/main/kotlin/packagename/components/schemas/SchemaClass/_contains.hbs index d67e673a3b8..31bc9d757a1 100644 --- a/src/main/resources/kotlin/src/main/kotlin/packagename/components/schemas/SchemaClass/_contains.hbs +++ b/src/main/resources/kotlin/src/main/kotlin/packagename/components/schemas/SchemaClass/_contains.hbs @@ -2,16 +2,16 @@ {{#with contains}} {{#if refInfo.refClass}} {{#if refInfo.refModule}} -contains = [{{refInfo.refModule}}.{{refInfo.refClass}}.class]({{docRoot}}{{refInfo.ref.pathFromDocRoot}}.md#{{refInfo.ref.jsonPathPiece.kebabCase}}) +contains = [{{refInfo.refModule}}.{{refInfo.refClass}}::class.java]({{docRoot}}{{refInfo.ref.pathFromDocRoot}}.md#{{refInfo.ref.jsonPathPiece.kebabCase}}) {{~else}} -contains = [{{refInfo.refClass}}.class](#{{refInfo.ref.jsonPathPiece.kebabCase}}) +contains = [{{refInfo.refClass}}::class.java](#{{refInfo.ref.jsonPathPiece.kebabCase}}) {{~/if}} {{else}} -contains = [{{jsonPathPiece.pascalCase}}.class](#{{jsonPathPiece.kebabCase}}) +contains = [{{jsonPathPiece.pascalCase}}::class.java](#{{jsonPathPiece.kebabCase}}) {{~/if}} {{/with}} {{else}} {{#with contains}} -.contains({{#if refInfo.refClass}}{{#if refInfo.refModule}}{{refInfo.refModule}}.{{/if}}{{refInfo.refClass}}{{else}}{{jsonPathPiece.pascalCase}}{{/if}}.class) +.contains({{#if refInfo.refClass}}{{#if refInfo.refModule}}{{refInfo.refModule}}.{{/if}}{{refInfo.refClass}}{{else}}{{jsonPathPiece.pascalCase}}{{/if}}::class.java) {{/with}} {{/if}} \ No newline at end of file diff --git a/src/main/resources/kotlin/src/main/kotlin/packagename/components/schemas/SchemaClass/_dependentRequired.hbs b/src/main/resources/kotlin/src/main/kotlin/packagename/components/schemas/SchemaClass/_dependentRequired.hbs index b134b9fb065..3b507378010 100644 --- a/src/main/resources/kotlin/src/main/kotlin/packagename/components/schemas/SchemaClass/_dependentRequired.hbs +++ b/src/main/resources/kotlin/src/main/kotlin/packagename/components/schemas/SchemaClass/_dependentRequired.hbs @@ -3,7 +3,7 @@ dependentRequired = MapUtils.makeMap(
{{#each dependentRequired}}     new AbstractMap.SimpleEntry<>(
        "{{{@key}}}",
-        SetMaker.makeSet( +        setOf( {{#each this}}             "{{{this}}}"{{#unless @last}},{{/unless}}
{{/each}} @@ -16,7 +16,7 @@ dependentRequired = MapUtils.makeMap(
{{#each dependentRequired}} new AbstractMap.SimpleEntry<>( "{{{@key}}}", - SetMaker.makeSet( + setOf( {{#each this}} "{{{this}}}"{{#unless @last}},{{/unless}} {{/each}} diff --git a/src/main/resources/kotlin/src/main/kotlin/packagename/components/schemas/SchemaClass/_dependentSchemas.hbs b/src/main/resources/kotlin/src/main/kotlin/packagename/components/schemas/SchemaClass/_dependentSchemas.hbs index 0ed7ecdef8a..5a4696c388e 100644 --- a/src/main/resources/kotlin/src/main/kotlin/packagename/components/schemas/SchemaClass/_dependentSchemas.hbs +++ b/src/main/resources/kotlin/src/main/kotlin/packagename/components/schemas/SchemaClass/_dependentSchemas.hbs @@ -1,28 +1,28 @@ {{#if forDocs}} -dependentSchemas = Map.ofEntries(
+dependentSchemas = mapOf(
{{~#each dependentSchemas}} {{#if refInfo.refClass}} {{#if refInfo.refModule}} -    new PropertyEntry("{{{@key.original}}}", [{{refInfo.refModule}}.{{refInfo.refClass}}.class]({{docRoot}}{{refInfo.ref.pathFromDocRoot}}.md#{{refInfo.ref.jsonPathPiece.kebabCase}})){{#unless @last}},{{/unless}}
+    new PropertyEntry("{{{@key.original}}}", [{{refInfo.refModule}}.{{refInfo.refClass}}::class.java]({{docRoot}}{{refInfo.ref.pathFromDocRoot}}.md#{{refInfo.ref.jsonPathPiece.kebabCase}})){{#unless @last}},{{/unless}}
{{~else}} -    new PropertyEntry("{{{@key.original}}}", [{{refInfo.refClass}}.class](#{{refInfo.ref.jsonPathPiece.kebabCase}}))){{#unless @last}},{{/unless}}
+    new PropertyEntry("{{{@key.original}}}", [{{refInfo.refClass}}::class.java](#{{refInfo.ref.jsonPathPiece.kebabCase}}))){{#unless @last}},{{/unless}}
{{~/if}} {{else}} -    new PropertyEntry("{{{@key.original}}}", [{{jsonPathPiece.pascalCase}}.class](#{{jsonPathPiece.kebabCase}}))){{#unless @last}},{{/unless}}
+    new PropertyEntry("{{{@key.original}}}", [{{jsonPathPiece.pascalCase}}::class.java](#{{jsonPathPiece.kebabCase}}))){{#unless @last}},{{/unless}}
{{~/if}} {{/each}} )
{{~else}} -.dependentSchemas(Map.ofEntries( +.dependentSchemas(mapOf( {{#each dependentSchemas}} {{#if refInfo.refClass}} {{#if refInfo.refModule}} - new PropertyEntry("{{{@key.original}}}", {{refInfo.refModule}}.{{refInfo.refClass}}.class){{#unless @last}},{{/unless}} + new PropertyEntry("{{{@key.original}}}", {{refInfo.refModule}}.{{refInfo.refClass}}::class.java){{#unless @last}},{{/unless}} {{else}} - new PropertyEntry("{{{@key.original}}}", {{refInfo.refClass}}.class){{#unless @last}},{{/unless}} + new PropertyEntry("{{{@key.original}}}", {{refInfo.refClass}}::class.java){{#unless @last}},{{/unless}} {{/if}} {{else}} - new PropertyEntry("{{{@key.original}}}", {{jsonPathPiece.pascalCase}}.class){{#unless @last}},{{/unless}} + new PropertyEntry("{{{@key.original}}}", {{jsonPathPiece.pascalCase}}::class.java){{#unless @last}},{{/unless}} {{/if}} {{/each}} )) diff --git a/src/main/resources/kotlin/src/main/kotlin/packagename/components/schemas/SchemaClass/_else.hbs b/src/main/resources/kotlin/src/main/kotlin/packagename/components/schemas/SchemaClass/_else.hbs index 1175b6ce258..e5d245f1d41 100644 --- a/src/main/resources/kotlin/src/main/kotlin/packagename/components/schemas/SchemaClass/_else.hbs +++ b/src/main/resources/kotlin/src/main/kotlin/packagename/components/schemas/SchemaClass/_else.hbs @@ -2,16 +2,16 @@ {{#with else_}} {{#if refInfo.refClass}} {{#if refInfo.refModule}} -elseSchema = [{{refInfo.refModule}}.{{refInfo.refClass}}.class]({{docRoot}}{{refInfo.ref.pathFromDocRoot}}.md#{{refInfo.ref.jsonPathPiece.kebabCase}}) +elseSchema = [{{refInfo.refModule}}.{{refInfo.refClass}}::class.java]({{docRoot}}{{refInfo.ref.pathFromDocRoot}}.md#{{refInfo.ref.jsonPathPiece.kebabCase}}) {{~else}} -elseSchema = [{{refInfo.refClass}}.class](#{{refInfo.ref.jsonPathPiece.kebabCase}}) +elseSchema = [{{refInfo.refClass}}::class.java](#{{refInfo.ref.jsonPathPiece.kebabCase}}) {{~/if}} {{else}} -elseSchema = [{{jsonPathPiece.pascalCase}}.class](#{{jsonPathPiece.kebabCase}}) +elseSchema = [{{jsonPathPiece.pascalCase}}::class.java](#{{jsonPathPiece.kebabCase}}) {{~/if}} {{~/with}} {{else}} {{#with else_}} -.elseSchema({{#if refInfo.refClass}}{{#if refInfo.refModule}}{{refInfo.refModule}}.{{/if}}{{refInfo.refClass}}{{else}}{{jsonPathPiece.pascalCase}}{{/if}}.class) +.elseSchema({{#if refInfo.refClass}}{{#if refInfo.refModule}}{{refInfo.refModule}}.{{/if}}{{refInfo.refClass}}{{else}}{{jsonPathPiece.pascalCase}}{{/if}}::class.java) {{/with}} {{/if}} \ No newline at end of file diff --git a/src/main/resources/kotlin/src/main/kotlin/packagename/components/schemas/SchemaClass/_enum.hbs b/src/main/resources/kotlin/src/main/kotlin/packagename/components/schemas/SchemaClass/_enum.hbs index 7526c7e4751..b7715ddbe86 100644 --- a/src/main/resources/kotlin/src/main/kotlin/packagename/components/schemas/SchemaClass/_enum.hbs +++ b/src/main/resources/kotlin/src/main/kotlin/packagename/components/schemas/SchemaClass/_enum.hbs @@ -1,5 +1,5 @@ {{#if forDocs}} -enumValues = SetMaker.makeSet(
+enumValues = setOf(
{{~#each enumInfo.valueToName}} {{#with @key}} {{#eq type "string"}} @@ -15,7 +15,7 @@ enumValues = SetMaker.makeSet(
{{/each}} )
{{~else}} -.enumValues(SetMaker.makeSet( +.enumValues(setOf( {{#each enumInfo.valueToName}} {{#with @key}} {{#eq type "string"}} @@ -27,7 +27,7 @@ enumValues = SetMaker.makeSet(
{{#eq type "boolean"}} {{value}}{{#unless @last}},{{/unless}} {{else}} - new BigDecimal("{{value.toString}}"){{#unless @last}},{{/unless}} + BigDecimal("{{value.toString}}"){{#unless @last}},{{/unless}} {{/eq}} {{/eq}} {{/eq}} diff --git a/src/main/resources/kotlin/src/main/kotlin/packagename/components/schemas/SchemaClass/_getNewInstanceObject_implementor.hbs b/src/main/resources/kotlin/src/main/kotlin/packagename/components/schemas/SchemaClass/_getNewInstanceObject_implementor.hbs index d0f82d22adc..20e3b36ce7b 100644 --- a/src/main/resources/kotlin/src/main/kotlin/packagename/components/schemas/SchemaClass/_getNewInstanceObject_implementor.hbs +++ b/src/main/resources/kotlin/src/main/kotlin/packagename/components/schemas/SchemaClass/_getNewInstanceObject_implementor.hbs @@ -1,31 +1,29 @@ -@Override -public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { +override fun getNewInstance(arg: Any?, pathToItem: List, pathToSchemas: PathToSchemasMap): Any? { {{#if types}} {{#each types}} {{#if @first}} - if (arg {{#eq this "null"}}== null{{/eq}}{{#eq this "boolean"}}instanceof Boolean{{/eq}}{{#or (eq this "integer") (eq this "number")}}instanceof Number{{/or}}{{#eq this "string" }}instanceof String{{/eq}}{{#eq this "array"}}instanceof List{{/eq}}{{#eq this "object"}}instanceof Map{{/eq}}) { + if (arg {{#eq this "null"}}== null{{/eq}}{{#eq this "boolean"}}is Boolean{{/eq}}{{#or (eq this "integer") (eq this "number")}}is Number{{/or}}{{#eq this "string" }}is String{{/eq}}{{#eq this "array"}}is List<*>{{/eq}}{{#eq this "object"}}is Map<*, *>{{/eq}}) { {{else}} - } else if (arg {{#eq this "null"}}== null{{/eq}}{{#eq this "boolean"}}instanceof Boolean{{/eq}}{{#or (eq this "integer") (eq this "number")}}instanceof Number{{/or}}{{#eq this "string" }}instanceof String{{/eq}}{{#eq this "array"}}instanceof List{{/eq}}{{#eq this "object"}}instanceof Map{{/eq}}) { + } else if (arg {{#eq this "null"}}== null{{/eq}}{{#eq this "boolean"}}is Boolean{{/eq}}{{#or (eq this "integer") (eq this "number")}}is Number{{/or}}{{#eq this "string" }}is String{{/eq}}{{#eq this "array"}}is List<*>{{/eq}}{{#eq this "object"}}is Map<*, *>{{/eq}}) { {{/if}} {{#eq this "null"}} - return getNewInstance((Nothing?) null, pathToItem, pathToSchemas); + return getNewInstance(null, pathToItem, pathToSchemas) {{/eq}} {{#eq this "boolean"}} - boolean boolArg = (Boolean) arg; - return getNewInstance(boolArg, pathToItem, pathToSchemas); + return getNewInstance(arg, pathToItem, pathToSchemas) {{/eq}} {{#or (eq this "integer") (eq this "number")}} - return getNewInstance((Number) arg, pathToItem, pathToSchemas); + return getNewInstance(arg, pathToItem, pathToSchemas) {{/or}} {{#eq this "string" }} - return getNewInstance((String) arg, pathToItem, pathToSchemas); + return getNewInstance(arg, pathToItem, pathToSchemas) {{/eq}} {{#eq this "array"}} - return getNewInstance((List) arg, pathToItem, pathToSchemas); + return getNewInstance(arg, pathToItem, pathToSchemas) {{/eq}} {{#eq this "object"}} - return getNewInstance((Map) arg, pathToItem, pathToSchemas); + return getNewInstance(arg, pathToItem, pathToSchemas) {{/eq}} {{#if @last}} } @@ -33,19 +31,18 @@ public @Nullable Object getNewInstance(@Nullable Object arg, List pathTo {{/each}} {{else}} if (arg == null) { - return getNewInstance((Nothing?) null, pathToItem, pathToSchemas); - } else if (arg instanceof Boolean) { - boolean boolArg = (Boolean) arg; - return getNewInstance(boolArg, pathToItem, pathToSchemas); - } else if (arg instanceof Number) { - return getNewInstance((Number) arg, pathToItem, pathToSchemas); - } else if (arg instanceof String) { - return getNewInstance((String) arg, pathToItem, pathToSchemas); - } else if (arg instanceof List) { - return getNewInstance((List) arg, pathToItem, pathToSchemas); - } else if (arg instanceof Map) { - return getNewInstance((Map) arg, pathToItem, pathToSchemas); + return getNewInstance( null, pathToItem, pathToSchemas) + } else if (arg is Boolean) { + return getNewInstance(arg, pathToItem, pathToSchemas) + } else if (arg is Number) { + return getNewInstance(arg, pathToItem, pathToSchemas) + } else if (arg is String) { + return getNewInstance(arg, pathToItem, pathToSchemas) + } else if (arg is List<*>) { + return getNewInstance(arg, pathToItem, pathToSchemas) + } else if (arg is Map<*, *>) { + return getNewInstance(arg, pathToItem, pathToSchemas) } {{/if}} - throw new RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); + throw RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema") } diff --git a/src/main/resources/kotlin/src/main/kotlin/packagename/components/schemas/SchemaClass/_if.hbs b/src/main/resources/kotlin/src/main/kotlin/packagename/components/schemas/SchemaClass/_if.hbs index 249c6e24556..43e430e4a28 100644 --- a/src/main/resources/kotlin/src/main/kotlin/packagename/components/schemas/SchemaClass/_if.hbs +++ b/src/main/resources/kotlin/src/main/kotlin/packagename/components/schemas/SchemaClass/_if.hbs @@ -2,16 +2,16 @@ {{#with if_}} {{#if refInfo.refClass}} {{#if refInfo.refModule}} -if = [{{refInfo.refModule}}.{{refInfo.refClass}}.class]({{docRoot}}{{refInfo.ref.pathFromDocRoot}}.md#{{refInfo.ref.jsonPathPiece.kebabCase}}) +if = [{{refInfo.refModule}}.{{refInfo.refClass}}::class.java]({{docRoot}}{{refInfo.ref.pathFromDocRoot}}.md#{{refInfo.ref.jsonPathPiece.kebabCase}}) {{~else}} -if = [{{refInfo.refClass}}.class](#{{refInfo.ref.jsonPathPiece.kebabCase}}) +if = [{{refInfo.refClass}}::class.java](#{{refInfo.ref.jsonPathPiece.kebabCase}}) {{~/if}} {{else}} -if = [{{jsonPathPiece.pascalCase}}.class](#{{jsonPathPiece.kebabCase}}) +if = [{{jsonPathPiece.pascalCase}}::class.java](#{{jsonPathPiece.kebabCase}}) {{~/if}} {{~/with}} {{else}} {{#with if_}} -.ifSchema({{#if refInfo.refClass}}{{#if refInfo.refModule}}{{refInfo.refModule}}.{{/if}}{{refInfo.refClass}}{{else}}{{jsonPathPiece.pascalCase}}{{/if}}.class) +.ifSchema({{#if refInfo.refClass}}{{#if refInfo.refModule}}{{refInfo.refModule}}.{{/if}}{{refInfo.refClass}}{{else}}{{jsonPathPiece.pascalCase}}{{/if}}::class.java) {{/with}} {{/if}} \ No newline at end of file diff --git a/src/main/resources/kotlin/src/main/kotlin/packagename/components/schemas/SchemaClass/_items.hbs b/src/main/resources/kotlin/src/main/kotlin/packagename/components/schemas/SchemaClass/_items.hbs index 57590c062f2..99f78e3e4b9 100644 --- a/src/main/resources/kotlin/src/main/kotlin/packagename/components/schemas/SchemaClass/_items.hbs +++ b/src/main/resources/kotlin/src/main/kotlin/packagename/components/schemas/SchemaClass/_items.hbs @@ -2,16 +2,16 @@ {{#with items}} {{#if refInfo.refClass}} {{#if refInfo.refModule}} -items = [{{refInfo.refModule}}.{{refInfo.refClass}}.class]({{docRoot}}{{refInfo.ref.pathFromDocRoot}}.md#{{refInfo.ref.jsonPathPiece.kebabCase}}) +items = [{{refInfo.refModule}}.{{refInfo.refClass}}::class.java]({{docRoot}}{{refInfo.ref.pathFromDocRoot}}.md#{{refInfo.ref.jsonPathPiece.kebabCase}}) {{~else}} -items = [{{refInfo.refClass}}.class](#{{refInfo.ref.jsonPathPiece.kebabCase}}) +items = [{{refInfo.refClass}}::class.java](#{{refInfo.ref.jsonPathPiece.kebabCase}}) {{~/if}} {{else}} -items = [{{jsonPathPiece.pascalCase}}.class](#{{jsonPathPiece.kebabCase}}) +items = [{{jsonPathPiece.pascalCase}}::class.java](#{{jsonPathPiece.kebabCase}}) {{~/if}} {{/with}} {{else}} {{#with items}} -.items({{#if refInfo.refClass}}{{#if refInfo.refModule}}{{refInfo.refModule}}.{{/if}}{{refInfo.refClass}}{{else}}{{jsonPathPiece.pascalCase}}{{/if}}.class) +.items({{#if refInfo.refClass}}{{#if refInfo.refModule}}{{refInfo.refModule}}.{{/if}}{{refInfo.refClass}}{{else}}{{jsonPathPiece.pascalCase}}{{/if}}::class.java) {{/with}} {{/if}} \ No newline at end of file diff --git a/src/main/resources/kotlin/src/main/kotlin/packagename/components/schemas/SchemaClass/_multipleOf.hbs b/src/main/resources/kotlin/src/main/kotlin/packagename/components/schemas/SchemaClass/_multipleOf.hbs index 2ea22fbac37..0abc705144b 100644 --- a/src/main/resources/kotlin/src/main/kotlin/packagename/components/schemas/SchemaClass/_multipleOf.hbs +++ b/src/main/resources/kotlin/src/main/kotlin/packagename/components/schemas/SchemaClass/_multipleOf.hbs @@ -1,5 +1,5 @@ {{#if forDocs}} -multipleOf = new BigDecimal("{{multipleOf.toString}}") +multipleOf = BigDecimal("{{multipleOf.toString}}") {{~else}} -.multipleOf(new BigDecimal("{{multipleOf.toString}}")) +.multipleOf(BigDecimal("{{multipleOf.toString}}")) {{/if}} \ No newline at end of file diff --git a/src/main/resources/kotlin/src/main/kotlin/packagename/components/schemas/SchemaClass/_not.hbs b/src/main/resources/kotlin/src/main/kotlin/packagename/components/schemas/SchemaClass/_not.hbs index 6dc339bb2ad..0783404513d 100644 --- a/src/main/resources/kotlin/src/main/kotlin/packagename/components/schemas/SchemaClass/_not.hbs +++ b/src/main/resources/kotlin/src/main/kotlin/packagename/components/schemas/SchemaClass/_not.hbs @@ -2,16 +2,16 @@ {{#with not}} {{#if refInfo.refClass}} {{#if refInfo.refModule}} -not = [{{refInfo.refModule}}.{{refInfo.refClass}}.class]({{docRoot}}{{refInfo.ref.pathFromDocRoot}}.md#{{refInfo.ref.jsonPathPiece.kebabCase}}) +not = [{{refInfo.refModule}}.{{refInfo.refClass}}::class.java]({{docRoot}}{{refInfo.ref.pathFromDocRoot}}.md#{{refInfo.ref.jsonPathPiece.kebabCase}}) {{~else}} -not = [{{refInfo.refClass}}.class](#{{refInfo.ref.jsonPathPiece.kebabCase}}) +not = [{{refInfo.refClass}}::class.java](#{{refInfo.ref.jsonPathPiece.kebabCase}}) {{~/if}} {{else}} -not = [{{jsonPathPiece.pascalCase}}.class](#{{jsonPathPiece.kebabCase}}) +not = [{{jsonPathPiece.pascalCase}}::class.java](#{{jsonPathPiece.kebabCase}}) {{~/if}} {{~/with}} {{else}} {{#with not}} -.not({{#if refInfo.refClass}}{{#if refInfo.refModule}}{{refInfo.refModule}}.{{/if}}{{refInfo.refClass}}{{else}}{{jsonPathPiece.pascalCase}}{{/if}}.class) +.not({{#if refInfo.refClass}}{{#if refInfo.refModule}}{{refInfo.refModule}}.{{/if}}{{refInfo.refClass}}{{else}}{{jsonPathPiece.pascalCase}}{{/if}}::class.java) {{/with}} {{/if}} \ No newline at end of file diff --git a/src/main/resources/kotlin/src/main/kotlin/packagename/components/schemas/SchemaClass/_oneOf.hbs b/src/main/resources/kotlin/src/main/kotlin/packagename/components/schemas/SchemaClass/_oneOf.hbs index 218daeaab0d..3ccea84a7e9 100644 --- a/src/main/resources/kotlin/src/main/kotlin/packagename/components/schemas/SchemaClass/_oneOf.hbs +++ b/src/main/resources/kotlin/src/main/kotlin/packagename/components/schemas/SchemaClass/_oneOf.hbs @@ -1,28 +1,28 @@ {{#if forDocs}} -oneOf = List.of(
+oneOf = listOf(
{{~#each oneOf}} {{#if refInfo.refClass}} {{#if refInfo.refModule}} -    [{{refInfo.refModule}}.{{refInfo.refClass}}.class]({{docRoot}}{{refInfo.ref.pathFromDocRoot}}.md#{{refInfo.ref.jsonPathPiece.kebabCase}}){{#unless @last}},{{/unless}}
+    [{{refInfo.refModule}}.{{refInfo.refClass}}::class.java]({{docRoot}}{{refInfo.ref.pathFromDocRoot}}.md#{{refInfo.ref.jsonPathPiece.kebabCase}}){{#unless @last}},{{/unless}}
{{~else}} -    [{{refInfo.refClass}}.class](#{{refInfo.ref.jsonPathPiece.kebabCase}}){{#unless @last}},{{/unless}}
+    [{{refInfo.refClass}}::class.java](#{{refInfo.ref.jsonPathPiece.kebabCase}}){{#unless @last}},{{/unless}}
{{~/if}} {{else}} -    [{{jsonPathPiece.pascalCase}}.class](#{{jsonPathPiece.kebabCase}}){{#unless @last}},{{/unless}}
+    [{{jsonPathPiece.pascalCase}}::class.java](#{{jsonPathPiece.kebabCase}}){{#unless @last}},{{/unless}}
{{~/if}} {{/each}} ))
{{~else}} -.oneOf(List.of( +.oneOf(listOf( {{#each oneOf}} {{#if refInfo.refClass}} {{#if refInfo.refModule}} - {{refInfo.refModule}}.{{refInfo.refClass}}.class{{#unless @last}},{{/unless}} + {{refInfo.refModule}}.{{refInfo.refClass}}::class.java{{#unless @last}},{{/unless}} {{else}} - {{refInfo.refClass}}.class{{#unless @last}},{{/unless}} + {{refInfo.refClass}}::class.java{{#unless @last}},{{/unless}} {{/if}} {{else}} - {{jsonPathPiece.pascalCase}}.class{{#unless @last}},{{/unless}} + {{jsonPathPiece.pascalCase}}::class.java{{#unless @last}},{{/unless}} {{/if}} {{/each}} )) diff --git a/src/main/resources/kotlin/src/main/kotlin/packagename/components/schemas/SchemaClass/_patternProperties.hbs b/src/main/resources/kotlin/src/main/kotlin/packagename/components/schemas/SchemaClass/_patternProperties.hbs index 0d32c7ebe91..f281e22ac48 100644 --- a/src/main/resources/kotlin/src/main/kotlin/packagename/components/schemas/SchemaClass/_patternProperties.hbs +++ b/src/main/resources/kotlin/src/main/kotlin/packagename/components/schemas/SchemaClass/_patternProperties.hbs @@ -1,28 +1,28 @@ {{#if forDocs}} -patternProperties = Map.ofEntries(
+patternProperties = mapOf(
{{~#each patternProperties}} {{#if refInfo.refClass}} {{#if refInfo.refModule}} -    new AbstractMap.SimpleEntry<>(Pattern.compile("{{{@key.pattern.codeEscaped}}}"), [{{refInfo.refModule}}.{{refInfo.refClass}}.class]({{docRoot}}{{refInfo.ref.pathFromDocRoot}}.md#{{refInfo.ref.jsonPathPiece.kebabCase}})){{#unless @last}},{{/unless}}
+    new AbstractMap.SimpleEntry<>(Pattern.compile("{{{@key.pattern.codeEscaped}}}"), [{{refInfo.refModule}}.{{refInfo.refClass}}::class.java]({{docRoot}}{{refInfo.ref.pathFromDocRoot}}.md#{{refInfo.ref.jsonPathPiece.kebabCase}})){{#unless @last}},{{/unless}}
{{~else}} -    new AbstractMap.SimpleEntry<>(Pattern.compile("{{{@key.pattern.codeEscaped}}}"), [{{refInfo.refClass}}.class](#{{refInfo.ref.jsonPathPiece.kebabCase}}))){{#unless @last}},{{/unless}}
+    new AbstractMap.SimpleEntry<>(Pattern.compile("{{{@key.pattern.codeEscaped}}}"), [{{refInfo.refClass}}::class.java](#{{refInfo.ref.jsonPathPiece.kebabCase}}))){{#unless @last}},{{/unless}}
{{~/if}} {{else}} -    new AbstractMap.SimpleEntry<>(Pattern.compile("{{{@key.pattern.codeEscaped}}}"), [{{jsonPathPiece.pascalCase}}.class](#{{jsonPathPiece.kebabCase}}))){{#unless @last}},{{/unless}}
+    new AbstractMap.SimpleEntry<>(Pattern.compile("{{{@key.pattern.codeEscaped}}}"), [{{jsonPathPiece.pascalCase}}::class.java](#{{jsonPathPiece.kebabCase}}))){{#unless @last}},{{/unless}}
{{~/if}} {{/each}} )
{{~else}} -.patternProperties(Map.ofEntries( +.patternProperties(mapOf( {{#each patternProperties}} {{#if refInfo.refClass}} {{#if refInfo.refModule}} - new AbstractMap.SimpleEntry<>(Pattern.compile("{{{@key.pattern.codeEscaped}}}"), {{refInfo.refModule}}.{{refInfo.refClass}}.class){{#unless @last}},{{/unless}} + new AbstractMap.SimpleEntry<>(Pattern.compile("{{{@key.pattern.codeEscaped}}}"), {{refInfo.refModule}}.{{refInfo.refClass}}::class.java){{#unless @last}},{{/unless}} {{else}} - new AbstractMap.SimpleEntry<>(Pattern.compile("{{{@key.pattern.codeEscaped}}}"), {{refInfo.refClass}}.class){{#unless @last}},{{/unless}} + new AbstractMap.SimpleEntry<>(Pattern.compile("{{{@key.pattern.codeEscaped}}}"), {{refInfo.refClass}}::class.java){{#unless @last}},{{/unless}} {{/if}} {{else}} - new AbstractMap.SimpleEntry<>(Pattern.compile("{{{@key.pattern.codeEscaped}}}"), {{jsonPathPiece.pascalCase}}.class){{#unless @last}},{{/unless}} + new AbstractMap.SimpleEntry<>(Pattern.compile("{{{@key.pattern.codeEscaped}}}"), {{jsonPathPiece.pascalCase}}::class.java){{#unless @last}},{{/unless}} {{/if}} {{/each}} )) diff --git a/src/main/resources/kotlin/src/main/kotlin/packagename/components/schemas/SchemaClass/_prefixItems.hbs b/src/main/resources/kotlin/src/main/kotlin/packagename/components/schemas/SchemaClass/_prefixItems.hbs index a4eb8178e12..8f65e117883 100644 --- a/src/main/resources/kotlin/src/main/kotlin/packagename/components/schemas/SchemaClass/_prefixItems.hbs +++ b/src/main/resources/kotlin/src/main/kotlin/packagename/components/schemas/SchemaClass/_prefixItems.hbs @@ -1,28 +1,28 @@ {{#if forDocs}} -prefixItems = List.of(
+prefixItems = listOf(
{{~#each prefixItems}} {{#if refInfo.refClass}} {{#if refInfo.refModule}} -    [{{refInfo.refModule}}.{{refInfo.refClass}}.class]({{docRoot}}{{refInfo.ref.pathFromDocRoot}}.md#{{refInfo.ref.jsonPathPiece.kebabCase}}){{#unless @last}},{{/unless}}
+    [{{refInfo.refModule}}.{{refInfo.refClass}}::class.java]({{docRoot}}{{refInfo.ref.pathFromDocRoot}}.md#{{refInfo.ref.jsonPathPiece.kebabCase}}){{#unless @last}},{{/unless}}
{{~else}} -    [{{refInfo.refClass}}.class](#{{refInfo.ref.jsonPathPiece.kebabCase}}){{#unless @last}},{{/unless}}
+    [{{refInfo.refClass}}::class.java](#{{refInfo.ref.jsonPathPiece.kebabCase}}){{#unless @last}},{{/unless}}
{{~/if}} {{else}} -    [{{jsonPathPiece.pascalCase}}.class](#{{jsonPathPiece.kebabCase}}){{#unless @last}},{{/unless}}
+    [{{jsonPathPiece.pascalCase}}::class.java](#{{jsonPathPiece.kebabCase}}){{#unless @last}},{{/unless}}
{{~/if}} {{/each}} )
{{~else}} -.prefixItems(List.of( +.prefixItems(listOf( {{#each prefixItems}} {{#if refInfo.refClass}} {{#if refInfo.refModule}} - {{refInfo.refModule}}.{{refInfo.refClass}}.class{{#unless @last}},{{/unless}} + {{refInfo.refModule}}.{{refInfo.refClass}}::class.java{{#unless @last}},{{/unless}} {{else}} - {{refInfo.refClass}}.class{{#unless @last}},{{/unless}} + {{refInfo.refClass}}::class.java{{#unless @last}},{{/unless}} {{/if}} {{else}} - {{jsonPathPiece.pascalCase}}.class{{#unless @last}},{{/unless}} + {{jsonPathPiece.pascalCase}}::class.java{{#unless @last}},{{/unless}} {{/if}} {{/each}} )) diff --git a/src/main/resources/kotlin/src/main/kotlin/packagename/components/schemas/SchemaClass/_properties.hbs b/src/main/resources/kotlin/src/main/kotlin/packagename/components/schemas/SchemaClass/_properties.hbs index 0f6763a4a21..ed577dcefd1 100644 --- a/src/main/resources/kotlin/src/main/kotlin/packagename/components/schemas/SchemaClass/_properties.hbs +++ b/src/main/resources/kotlin/src/main/kotlin/packagename/components/schemas/SchemaClass/_properties.hbs @@ -1,28 +1,28 @@ {{#if forDocs}} -properties = Map.ofEntries(
+properties = mapOf(
{{~#each properties}} {{#if refInfo.refClass}} {{#if refInfo.refModule}} -    new PropertyEntry("{{{@key.original}}}", [{{refInfo.refModule}}.{{refInfo.refClass}}.class]({{docRoot}}{{refInfo.ref.pathFromDocRoot}}.md#{{refInfo.ref.jsonPathPiece.kebabCase}})){{#unless @last}},{{/unless}}
+    "{{{@key.original}}}" to [{{refInfo.refModule}}.{{refInfo.refClass}}::class.java]({{docRoot}}{{refInfo.ref.pathFromDocRoot}}.md#{{refInfo.ref.jsonPathPiece.kebabCase}}){{#unless @last}},{{/unless}}
{{~else}} -    new PropertyEntry("{{{@key.original}}}", [{{refInfo.refClass}}.class](#{{refInfo.ref.jsonPathPiece.kebabCase}}))){{#unless @last}},{{/unless}}
+    "{{{@key.original}}}" to [{{refInfo.refClass}}::class.java](#{{refInfo.ref.jsonPathPiece.kebabCase}})){{#unless @last}},{{/unless}}
{{~/if}} {{else}} -    new PropertyEntry("{{{@key.original}}}", [{{jsonPathPiece.pascalCase}}.class](#{{jsonPathPiece.kebabCase}}))){{#unless @last}},{{/unless}}
+    "{{{@key.original}}}" to [{{jsonPathPiece.pascalCase}}::class.java](#{{jsonPathPiece.kebabCase}})){{#unless @last}},{{/unless}}
{{~/if}} {{/each}} )
{{~else}} -.properties(Map.ofEntries( +.properties(mapOf( {{#each properties}} {{#if refInfo.refClass}} {{#if refInfo.refModule}} - new PropertyEntry("{{{@key.original}}}", {{refInfo.refModule}}.{{refInfo.refClass}}.class){{#unless @last}},{{/unless}} + "{{{@key.original}}}" to {{refInfo.refModule}}.{{refInfo.refClass}}::class.java{{#unless @last}},{{/unless}} {{else}} - new PropertyEntry("{{{@key.original}}}", {{refInfo.refClass}}.class){{#unless @last}},{{/unless}} + "{{{@key.original}}}" to {{refInfo.refClass}}::class.java{{#unless @last}},{{/unless}} {{/if}} {{else}} - new PropertyEntry("{{{@key.original}}}", {{jsonPathPiece.pascalCase}}.class){{#unless @last}},{{/unless}} + "{{{@key.original}}}" to {{jsonPathPiece.pascalCase}}::class.java{{#unless @last}},{{/unless}} {{/if}} {{/each}} )) diff --git a/src/main/resources/kotlin/src/main/kotlin/packagename/components/schemas/SchemaClass/_propertyNames.hbs b/src/main/resources/kotlin/src/main/kotlin/packagename/components/schemas/SchemaClass/_propertyNames.hbs index a403510199b..f9afdc76514 100644 --- a/src/main/resources/kotlin/src/main/kotlin/packagename/components/schemas/SchemaClass/_propertyNames.hbs +++ b/src/main/resources/kotlin/src/main/kotlin/packagename/components/schemas/SchemaClass/_propertyNames.hbs @@ -2,16 +2,16 @@ {{#with propertyNames}} {{#if refInfo.refClass}} {{#if refInfo.refModule}} -propertyNames = [{{refInfo.refModule}}.{{refInfo.refClass}}.class]({{docRoot}}{{refInfo.ref.pathFromDocRoot}}.md#{{refInfo.ref.jsonPathPiece.kebabCase}}) +propertyNames = [{{refInfo.refModule}}.{{refInfo.refClass}}::class.java]({{docRoot}}{{refInfo.ref.pathFromDocRoot}}.md#{{refInfo.ref.jsonPathPiece.kebabCase}}) {{~else}} -propertyNames = [{{refInfo.refClass}}.class](#{{refInfo.ref.jsonPathPiece.kebabCase}}) +propertyNames = [{{refInfo.refClass}}::class.java](#{{refInfo.ref.jsonPathPiece.kebabCase}}) {{~/if}} {{else}} -propertyNames = [{{jsonPathPiece.pascalCase}}.class](#{{jsonPathPiece.kebabCase}}) +propertyNames = [{{jsonPathPiece.pascalCase}}::class.java](#{{jsonPathPiece.kebabCase}}) {{~/if}} {{/with}} {{else}} {{#with propertyNames}} -.propertyNames({{#if refInfo.refClass}}{{#if refInfo.refModule}}{{refInfo.refModule}}.{{/if}}{{refInfo.refClass}}{{else}}{{jsonPathPiece.pascalCase}}{{/if}}.class) +.propertyNames({{#if refInfo.refClass}}{{#if refInfo.refModule}}{{refInfo.refModule}}.{{/if}}{{refInfo.refClass}}{{else}}{{jsonPathPiece.pascalCase}}{{/if}}::class.java) {{/with}} {{/if}} \ No newline at end of file diff --git a/src/main/resources/kotlin/src/main/kotlin/packagename/components/schemas/SchemaClass/_required.hbs b/src/main/resources/kotlin/src/main/kotlin/packagename/components/schemas/SchemaClass/_required.hbs index 01e48c566fa..63f6313577d 100644 --- a/src/main/resources/kotlin/src/main/kotlin/packagename/components/schemas/SchemaClass/_required.hbs +++ b/src/main/resources/kotlin/src/main/kotlin/packagename/components/schemas/SchemaClass/_required.hbs @@ -1,11 +1,11 @@ {{#if forDocs}} -required = Set.of(
+required = setOf(
{{~#each requiredProperties}}     "{{{@key.original}}}"{{#unless @last}},{{/unless}}
{{~/each}} )
{{~else}} -.required(Set.of( +.required(setOf( {{#each requiredProperties}} "{{{@key.original}}}"{{#unless @last}},{{/unless}} {{/each}} diff --git a/src/main/resources/kotlin/src/main/kotlin/packagename/components/schemas/SchemaClass/_then.hbs b/src/main/resources/kotlin/src/main/kotlin/packagename/components/schemas/SchemaClass/_then.hbs index 524f4c9e8b2..f06777500eb 100644 --- a/src/main/resources/kotlin/src/main/kotlin/packagename/components/schemas/SchemaClass/_then.hbs +++ b/src/main/resources/kotlin/src/main/kotlin/packagename/components/schemas/SchemaClass/_then.hbs @@ -2,16 +2,16 @@ {{#with then}} {{#if refInfo.refClass}} {{#if refInfo.refModule}} -then = [{{refInfo.refModule}}.{{refInfo.refClass}}.class]({{docRoot}}{{refInfo.ref.pathFromDocRoot}}.md#{{refInfo.ref.jsonPathPiece.kebabCase}}) +then = [{{refInfo.refModule}}.{{refInfo.refClass}}::class.java]({{docRoot}}{{refInfo.ref.pathFromDocRoot}}.md#{{refInfo.ref.jsonPathPiece.kebabCase}}) {{~else}} -then = [{{refInfo.refClass}}.class](#{{refInfo.ref.jsonPathPiece.kebabCase}}) +then = [{{refInfo.refClass}}::class.java](#{{refInfo.ref.jsonPathPiece.kebabCase}}) {{~/if}} {{else}} -then = [{{jsonPathPiece.pascalCase}}.class](#{{jsonPathPiece.kebabCase}}) +then = [{{jsonPathPiece.pascalCase}}::class.java](#{{jsonPathPiece.kebabCase}}) {{~/if}} {{~/with}} {{else}} {{#with then}} -.then({{#if refInfo.refClass}}{{#if refInfo.refModule}}{{refInfo.refModule}}.{{/if}}{{refInfo.refClass}}{{else}}{{jsonPathPiece.pascalCase}}{{/if}}.class) +.then({{#if refInfo.refClass}}{{#if refInfo.refModule}}{{refInfo.refModule}}.{{/if}}{{refInfo.refClass}}{{else}}{{jsonPathPiece.pascalCase}}{{/if}}::class.java) {{/with}} {{/if}} \ No newline at end of file diff --git a/src/main/resources/kotlin/src/main/kotlin/packagename/components/schemas/SchemaClass/_types.hbs b/src/main/resources/kotlin/src/main/kotlin/packagename/components/schemas/SchemaClass/_types.hbs index cbc06df66c2..4b67a923f1a 100644 --- a/src/main/resources/kotlin/src/main/kotlin/packagename/components/schemas/SchemaClass/_types.hbs +++ b/src/main/resources/kotlin/src/main/kotlin/packagename/components/schemas/SchemaClass/_types.hbs @@ -1,76 +1,76 @@ {{#if types}} {{#and (eq types.size 1) (or (contains types "null") (contains types "object") (contains types "array") (contains types "boolean"))}} {{#if forDocs}} -type = Set.of({{#contains types "null"}}Nothing?.class{{/contains}}{{#contains types "object"}}Map.class{{/contains}}{{#contains types "array"}}List.class{{/contains}}{{#contains types "boolean"}}Boolean.class{{/contains}}) +type = setOf({{#contains types "null"}}Void::class.java{{/contains}}{{#contains types "object"}}Map::class.java{{/contains}}{{#contains types "array"}}List::class.java{{/contains}}{{#contains types "boolean"}}Boolean::class.java{{/contains}}) {{~else}} -.type(Set.of({{#contains types "null"}}Nothing?.class{{/contains}}{{#contains types "object"}}Map.class{{/contains}}{{#contains types "array"}}List.class{{/contains}}{{#contains types "boolean"}}Boolean.class{{/contains}})) +.type(setOf({{#contains types "null"}}Void::class.java{{/contains}}{{#contains types "object"}}Map::class.java{{/contains}}{{#contains types "array"}}List::class.java{{/contains}}{{#contains types "boolean"}}Boolean::class.java{{/contains}})) {{/if}} {{else}} {{#if forDocs}} -type = Set.of(
+type = setOf(
{{~#each types}} {{#eq this "null"}} -    Nothing?.class{{#unless @last}},{{/unless}}
+    Void::class.java{{#unless @last}},{{/unless}}
{{~/eq}} {{#eq this "object"}} -    Map.class{{#unless @last}},{{/unless}}
+    Map::class.java{{#unless @last}},{{/unless}}
{{~/eq}} {{#eq this "array"}} -    List.class{{#unless @last}},{{/unless}}
+    List::class.java{{#unless @last}},{{/unless}}
{{~/eq}} {{#eq this "string" }} {{#eq ../format "binary"}} // FileIO, // bytes, {{else}} -    String.class{{#unless @last}},{{/unless}}
+    String::class.java{{#unless @last}},{{/unless}}
{{~/eq}} {{/eq}} {{#eq this "integer"}} -    Integer.class,
    Long.class,
    Float.class,
    Double.class{{#unless @last}},{{/unless}}
+    Int::class.java,
    Long::class.java,
    Float::class.java,
    Double::class.java{{#unless @last}},{{/unless}}
{{~/eq}} {{#eq this "number"}} -    Integer.class,
    Long.class,
    Float.class,
    Double.class{{#unless @last}},{{/unless}}
+    Int::class.java,
    Long::class.java,
    Float::class.java,
    Double::class.java{{#unless @last}},{{/unless}}
{{~/eq}} {{#eq this "boolean"}} -    Boolean.class{{#unless @last}},{{/unless}}
+    Boolean::class.java{{#unless @last}},{{/unless}}
{{~/eq}} {{/each}} )
{{~else}} -.type(Set.of( +.type(setOf( {{#each types}} {{#eq this "null"}} - Nothing?.class{{#unless @last}},{{/unless}} + Void::class.java{{#unless @last}},{{/unless}} {{/eq}} {{#eq this "object"}} - Map.class{{#unless @last}},{{/unless}} + Map::class.java{{#unless @last}},{{/unless}} {{/eq}} {{#eq this "array"}} - List.class{{#unless @last}},{{/unless}} + List::class.java{{#unless @last}},{{/unless}} {{/eq}} {{#eq this "string" }} {{#eq ../format "binary"}} // FileIO, // bytes, {{else}} - String.class{{#unless @last}},{{/unless}} + String::class.java{{#unless @last}},{{/unless}} {{/eq}} {{/eq}} {{#eq this "integer"}} - Integer.class, - Long.class, - Float.class, - Double.class{{#unless @last}},{{/unless}} + Int::class.java, + Long::class.java, + Float::class.java, + Double::class.java{{#unless @last}},{{/unless}} {{/eq}} {{#eq this "number"}} - Integer.class, - Long.class, - Float.class, - Double.class{{#unless @last}},{{/unless}} + Int::class.java, + Long::class.java, + Float::class.java, + Double::class.java{{#unless @last}},{{/unless}} {{/eq}} {{#eq this "boolean"}} - Boolean.class{{#unless @last}},{{/unless}} + Boolean::class.java{{#unless @last}},{{/unless}} {{/eq}} {{/each}} )) diff --git a/src/main/resources/kotlin/src/main/kotlin/packagename/components/schemas/SchemaClass/_unevaluatedItems.hbs b/src/main/resources/kotlin/src/main/kotlin/packagename/components/schemas/SchemaClass/_unevaluatedItems.hbs index 77b04ff5678..4aeffcfea2d 100644 --- a/src/main/resources/kotlin/src/main/kotlin/packagename/components/schemas/SchemaClass/_unevaluatedItems.hbs +++ b/src/main/resources/kotlin/src/main/kotlin/packagename/components/schemas/SchemaClass/_unevaluatedItems.hbs @@ -2,16 +2,16 @@ {{#with unevaluatedItems}} {{#if refInfo.refClass}} {{#if refInfo.refModule}} -unevaluatedItems = [{{refInfo.refModule}}.{{refInfo.refClass}}.class]({{docRoot}}{{refInfo.ref.pathFromDocRoot}}.md#{{refInfo.ref.jsonPathPiece.kebabCase}}) +unevaluatedItems = [{{refInfo.refModule}}.{{refInfo.refClass}}::class.java]({{docRoot}}{{refInfo.ref.pathFromDocRoot}}.md#{{refInfo.ref.jsonPathPiece.kebabCase}}) {{~else}} -unevaluatedItems = [{{refInfo.refClass}}.class](#{{refInfo.ref.jsonPathPiece.kebabCase}}) +unevaluatedItems = [{{refInfo.refClass}}::class.java](#{{refInfo.ref.jsonPathPiece.kebabCase}}) {{~/if}} {{else}} -unevaluatedItems = [{{jsonPathPiece.pascalCase}}.class](#{{jsonPathPiece.kebabCase}}) +unevaluatedItems = [{{jsonPathPiece.pascalCase}}::class.java](#{{jsonPathPiece.kebabCase}}) {{~/if}} {{/with}} {{else}} {{#with unevaluatedItems}} -.unevaluatedItems({{#if refInfo.refClass}}{{#if refInfo.refModule}}{{refInfo.refModule}}.{{/if}}{{refInfo.refClass}}{{else}}{{jsonPathPiece.pascalCase}}{{/if}}.class) +.unevaluatedItems({{#if refInfo.refClass}}{{#if refInfo.refModule}}{{refInfo.refModule}}.{{/if}}{{refInfo.refClass}}{{else}}{{jsonPathPiece.pascalCase}}{{/if}}::class.java) {{/with}} {{/if}} \ No newline at end of file diff --git a/src/main/resources/kotlin/src/main/kotlin/packagename/components/schemas/SchemaClass/_unevaluatedProperties.hbs b/src/main/resources/kotlin/src/main/kotlin/packagename/components/schemas/SchemaClass/_unevaluatedProperties.hbs index 83f5d06aad0..1dcc7ef2bbb 100644 --- a/src/main/resources/kotlin/src/main/kotlin/packagename/components/schemas/SchemaClass/_unevaluatedProperties.hbs +++ b/src/main/resources/kotlin/src/main/kotlin/packagename/components/schemas/SchemaClass/_unevaluatedProperties.hbs @@ -2,16 +2,16 @@ {{#with unevaluatedProperties}} {{#if refInfo.refClass}} {{#if refInfo.refModule}} -unevaluatedProperties = [{{refInfo.refModule}}.{{refInfo.refClass}}.class]({{docRoot}}{{refInfo.ref.pathFromDocRoot}}.md#{{refInfo.ref.jsonPathPiece.kebabCase}}) +unevaluatedProperties = [{{refInfo.refModule}}.{{refInfo.refClass}}::class.java]({{docRoot}}{{refInfo.ref.pathFromDocRoot}}.md#{{refInfo.ref.jsonPathPiece.kebabCase}}) {{~else}} -unevaluatedProperties = [{{refInfo.refClass}}.class](#{{refInfo.ref.jsonPathPiece.kebabCase}}) +unevaluatedProperties = [{{refInfo.refClass}}::class.java](#{{refInfo.ref.jsonPathPiece.kebabCase}}) {{~/if}} {{else}} -unevaluatedProperties = [{{jsonPathPiece.pascalCase}}.class](#{{jsonPathPiece.kebabCase}}) +unevaluatedProperties = [{{jsonPathPiece.pascalCase}}::class.java](#{{jsonPathPiece.kebabCase}}) {{~/if}} {{/with}} {{else}} {{#with unevaluatedProperties}} -.unevaluatedProperties({{#if refInfo.refClass}}{{#if refInfo.refModule}}{{refInfo.refModule}}.{{/if}}{{refInfo.refClass}}{{else}}{{jsonPathPiece.pascalCase}}{{/if}}.class) +.unevaluatedProperties({{#if refInfo.refClass}}{{#if refInfo.refModule}}{{refInfo.refModule}}.{{/if}}{{refInfo.refClass}}{{else}}{{jsonPathPiece.pascalCase}}{{/if}}::class.java) {{/with}} {{/if}} \ No newline at end of file diff --git a/src/main/resources/kotlin/src/main/kotlin/packagename/components/schemas/SchemaClass/_validateAndBox.hbs b/src/main/resources/kotlin/src/main/kotlin/packagename/components/schemas/SchemaClass/_validateAndBox.hbs index ce35e03a5f1..53b08438b10 100644 --- a/src/main/resources/kotlin/src/main/kotlin/packagename/components/schemas/SchemaClass/_validateAndBox.hbs +++ b/src/main/resources/kotlin/src/main/kotlin/packagename/components/schemas/SchemaClass/_validateAndBox.hbs @@ -19,56 +19,52 @@ {{> src/main/kotlin/packagename/components/schemas/SchemaClass/_validateAndBoxMap }} {{/eq}} {{/each}} -@Override -public {{jsonPathPiece.pascalCase}}Boxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { +@Throws(ValidationException::class) +override fun validateAndBox(arg: Any?, configuration: SchemaConfiguration?): {{jsonPathPiece.pascalCase}}Boxed { {{#each types}} {{#if @first}} {{#eq this "null"}} if (arg == null) { - Nothing? castArg = (Nothing?) arg; {{/eq}} {{#eq this "boolean"}} - if (arg instanceof Boolean booleanArg) { - boolean castArg = booleanArg; + if (arg is Boolean) { {{/eq}} {{#and (eq this "string") (neq ../format "binary") }} - if (arg instanceof String castArg) { + if (arg is String) { {{/and}} {{#or (eq this "number") (eq this "integer")}} - if (arg instanceof Number castArg) { + if (arg is Number) { {{/or}} {{#eq this "array"}} - if (arg instanceof List castArg) { + if (arg is List<*>) { {{/eq}} {{#eq this "object"}} - if (arg instanceof Map castArg) { + if (arg is Map<*, *>) { {{/eq}} {{else}} {{#eq this "null"}} } else if (arg == null) { - Nothing? castArg = (Nothing?) arg; {{/eq}} {{#eq this "boolean"}} - } else if (arg instanceof Boolean booleanArg) { - boolean castArg = booleanArg; + } else if (arg is Boolean) { {{/eq}} {{#and (eq this "string") (neq ../format "binary") }} - } else if (arg instanceof String castArg) { + } else if (arg is String) { {{/and}} {{#or (eq this "number") (eq this "integer")}} - } else if (arg instanceof Number castArg) { + } else if (arg is Number) { {{/or}} {{#eq this "array"}} - } else if (arg instanceof List castArg) { + } else if (arg is List<*>) { {{/eq}} {{#eq this "object"}} - } else if (arg instanceof Map castArg) { + } else if (arg is Map<*, *>) { {{/eq}} {{/if}} - return validateAndBox(castArg, configuration); + return validateAndBox(arg, configuration) {{/each}} } - throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema") } {{else}} {{> src/main/kotlin/packagename/components/schemas/SchemaClass/_validateAndBoxVoid }} @@ -77,23 +73,21 @@ public {{jsonPathPiece.pascalCase}}Boxed validateAndBox(@Nullable Object arg, Sc {{> src/main/kotlin/packagename/components/schemas/SchemaClass/_validateAndBoxString }} {{> src/main/kotlin/packagename/components/schemas/SchemaClass/_validateAndBoxList }} {{> src/main/kotlin/packagename/components/schemas/SchemaClass/_validateAndBoxMap }} -@Override -public {{jsonPathPiece.pascalCase}}Boxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { +@Throws(ValidationException::class) +override fun validateAndBox(arg: Any?, configuration: SchemaConfiguration?): {{jsonPathPiece.pascalCase}}Boxed { if (arg == null) { - Nothing? castArg = (Nothing?) arg; - return validateAndBox(castArg, configuration); - } else if (arg instanceof Boolean booleanArg) { - boolean castArg = booleanArg; - return validateAndBox(castArg, configuration); - } else if (arg instanceof String castArg) { - return validateAndBox(castArg, configuration); - } else if (arg instanceof Number castArg) { - return validateAndBox(castArg, configuration); - } else if (arg instanceof List castArg) { - return validateAndBox(castArg, configuration); - } else if (arg instanceof Map castArg) { - return validateAndBox(castArg, configuration); + return validateAndBox(null, configuration) + } else if (arg is Boolean) { + return validateAndBox(arg, configuration) + } else if (arg is String) { + return validateAndBox(arg, configuration) + } else if (arg is Number) { + return validateAndBox(arg, configuration) + } else if (arg is List<*>) { + return validateAndBox(arg, configuration) + } else if (arg is Map<*, *>) { + return validateAndBox(arg, configuration) } - throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema") } {{/if}} \ No newline at end of file diff --git a/src/main/resources/kotlin/src/main/kotlin/packagename/components/schemas/SchemaClass/_validateAndBoxBoolean.hbs b/src/main/resources/kotlin/src/main/kotlin/packagename/components/schemas/SchemaClass/_validateAndBoxBoolean.hbs index de40afe4e66..33b11c9b517 100644 --- a/src/main/resources/kotlin/src/main/kotlin/packagename/components/schemas/SchemaClass/_validateAndBoxBoolean.hbs +++ b/src/main/resources/kotlin/src/main/kotlin/packagename/components/schemas/SchemaClass/_validateAndBoxBoolean.hbs @@ -1,4 +1,4 @@ -@Override -public {{jsonPathPiece.pascalCase}}BoxedBoolean validateAndBox(boolean arg, SchemaConfiguration configuration) throws ValidationException { - return new {{jsonPathPiece.pascalCase}}BoxedBoolean(validate(arg, configuration)); +@Throws(ValidationException::class) +override fun validateAndBox(arg: Boolean, configuration: SchemaConfiguration?): {{jsonPathPiece.pascalCase}}BoxedBoolean { + return {{jsonPathPiece.pascalCase}}BoxedBoolean(validate(arg, configuration)) } diff --git a/src/main/resources/kotlin/src/main/kotlin/packagename/components/schemas/SchemaClass/_validateAndBoxList.hbs b/src/main/resources/kotlin/src/main/kotlin/packagename/components/schemas/SchemaClass/_validateAndBoxList.hbs index cda68ddbb60..8c78e956b5c 100644 --- a/src/main/resources/kotlin/src/main/kotlin/packagename/components/schemas/SchemaClass/_validateAndBoxList.hbs +++ b/src/main/resources/kotlin/src/main/kotlin/packagename/components/schemas/SchemaClass/_validateAndBoxList.hbs @@ -1,4 +1,4 @@ -@Override -public {{jsonPathPiece.pascalCase}}BoxedList validateAndBox(List arg, SchemaConfiguration configuration) throws ValidationException { - return new {{jsonPathPiece.pascalCase}}BoxedList(validate(arg, configuration)); +@Throws(ValidationException::class) +override fun validateAndBox(arg: List<*>, configuration: SchemaConfiguration?): {{jsonPathPiece.pascalCase}}BoxedList { + return {{jsonPathPiece.pascalCase}}BoxedList(validate(arg, configuration)) } diff --git a/src/main/resources/kotlin/src/main/kotlin/packagename/components/schemas/SchemaClass/_validateAndBoxMap.hbs b/src/main/resources/kotlin/src/main/kotlin/packagename/components/schemas/SchemaClass/_validateAndBoxMap.hbs index c84fc8d79cc..4c73115a95b 100644 --- a/src/main/resources/kotlin/src/main/kotlin/packagename/components/schemas/SchemaClass/_validateAndBoxMap.hbs +++ b/src/main/resources/kotlin/src/main/kotlin/packagename/components/schemas/SchemaClass/_validateAndBoxMap.hbs @@ -1,4 +1,4 @@ -@Override -public {{jsonPathPiece.pascalCase}}BoxedMap validateAndBox(Map arg, SchemaConfiguration configuration) throws ValidationException { - return new {{jsonPathPiece.pascalCase}}BoxedMap(validate(arg, configuration)); +@Throws(ValidationException::class) +override fun validateAndBox(arg: Map<*, *>, configuration: SchemaConfiguration?): {{jsonPathPiece.pascalCase}}BoxedMap { + return {{jsonPathPiece.pascalCase}}BoxedMap(validate(arg, configuration)) } diff --git a/src/main/resources/kotlin/src/main/kotlin/packagename/components/schemas/SchemaClass/_validateAndBoxNumber.hbs b/src/main/resources/kotlin/src/main/kotlin/packagename/components/schemas/SchemaClass/_validateAndBoxNumber.hbs index dae6e8f3f4a..5b13aae9add 100644 --- a/src/main/resources/kotlin/src/main/kotlin/packagename/components/schemas/SchemaClass/_validateAndBoxNumber.hbs +++ b/src/main/resources/kotlin/src/main/kotlin/packagename/components/schemas/SchemaClass/_validateAndBoxNumber.hbs @@ -1,4 +1,4 @@ -@Override -public {{jsonPathPiece.pascalCase}}BoxedNumber validateAndBox(Number arg, SchemaConfiguration configuration) throws ValidationException { - return new {{jsonPathPiece.pascalCase}}BoxedNumber(validate(arg, configuration)); +@Throws(ValidationException::class) +override fun validateAndBox(arg: Number, configuration: SchemaConfiguration?): {{jsonPathPiece.pascalCase}}BoxedNumber { + return {{jsonPathPiece.pascalCase}}BoxedNumber(validate(arg, configuration)) } diff --git a/src/main/resources/kotlin/src/main/kotlin/packagename/components/schemas/SchemaClass/_validateAndBoxString.hbs b/src/main/resources/kotlin/src/main/kotlin/packagename/components/schemas/SchemaClass/_validateAndBoxString.hbs index d64c59a5e94..b34537fed38 100644 --- a/src/main/resources/kotlin/src/main/kotlin/packagename/components/schemas/SchemaClass/_validateAndBoxString.hbs +++ b/src/main/resources/kotlin/src/main/kotlin/packagename/components/schemas/SchemaClass/_validateAndBoxString.hbs @@ -1,4 +1,4 @@ -@Override -public {{jsonPathPiece.pascalCase}}BoxedString validateAndBox(String arg, SchemaConfiguration configuration) throws ValidationException { - return new {{jsonPathPiece.pascalCase}}BoxedString(validate(arg, configuration)); +@Throws(ValidationException::class) +override fun validateAndBox(arg: String, configuration: SchemaConfiguration?): {{jsonPathPiece.pascalCase}}BoxedString { + return {{jsonPathPiece.pascalCase}}BoxedString(validate(arg, configuration)) } diff --git a/src/main/resources/kotlin/src/main/kotlin/packagename/components/schemas/SchemaClass/_validateAndBoxVoid.hbs b/src/main/resources/kotlin/src/main/kotlin/packagename/components/schemas/SchemaClass/_validateAndBoxVoid.hbs index 441b5c1caf9..0d856088609 100644 --- a/src/main/resources/kotlin/src/main/kotlin/packagename/components/schemas/SchemaClass/_validateAndBoxVoid.hbs +++ b/src/main/resources/kotlin/src/main/kotlin/packagename/components/schemas/SchemaClass/_validateAndBoxVoid.hbs @@ -1,4 +1,4 @@ -@Override -public {{jsonPathPiece.pascalCase}}BoxedVoid validateAndBox(Nothing? arg, SchemaConfiguration configuration) throws ValidationException { - return new {{jsonPathPiece.pascalCase}}BoxedVoid(validate(arg, configuration)); +@Throws(ValidationException::class) +override fun validateAndBox(arg: Nothing?, configuration: SchemaConfiguration?): {{jsonPathPiece.pascalCase}}BoxedVoid { + return {{jsonPathPiece.pascalCase}}BoxedVoid(validate(arg, configuration)) } diff --git a/src/main/resources/kotlin/src/main/kotlin/packagename/components/schemas/SchemaClass/_validate_implementor.hbs b/src/main/resources/kotlin/src/main/kotlin/packagename/components/schemas/SchemaClass/_validate_implementor.hbs index ddc49735032..84417d596e2 100644 --- a/src/main/resources/kotlin/src/main/kotlin/packagename/components/schemas/SchemaClass/_validate_implementor.hbs +++ b/src/main/resources/kotlin/src/main/kotlin/packagename/components/schemas/SchemaClass/_validate_implementor.hbs @@ -2,113 +2,109 @@ {{#each types}} {{#eq this "null"}} -@Override -public Nothing? validate(Nothing? arg, SchemaConfiguration configuration) throws ValidationException { - Set> pathSet = new HashSet<>(); - List pathToItem = List.of("args[0"); - Nothing? castArg = castToAllowedTypes(arg, pathToItem, pathSet); - SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().build())); - ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, new PathToSchemasMap(), new LinkedHashSet<>()); - getPathToSchemas(this, castArg, validationMetadata, pathSet); - return castArg; +@Throws(ValidationException::class) +override fun validate(arg: Nothing?, configuration: SchemaConfiguration?): Nothing? { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, PathToSchemasMap(), LinkedHashSet()) + getPathToSchemas(this, castArg, validationMetadata, pathSet) + return castArg } {{/eq}} {{#eq this "object"}} -public {{#if ../mapOutputJsonPathPiece}}{{../mapOutputJsonPathPiece.pascalCase}}{{else}}FrozenMap<@Nullable Object>{{/if}} getNewInstance(Map arg, List pathToItem, PathToSchemasMap pathToSchemas) { - LinkedHashMap src/main/kotlin/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 RuntimeException("Invalid non-string key value"); +override fun getNewInstance(arg: Map<*, *>, pathToItem: List, pathToSchemas: PathToSchemasMap): {{#if ../mapOutputJsonPathPiece}}{{../mapOutputJsonPathPiece.pascalCase}}{{else}}FrozenMap{{/if}} { + val properties: LinkedHashMap src/main/kotlin/packagename/components/schemas/types/schema_output_type sourceJsonPath=../jsonPath forceNull=true }}{{else}}Any?{{/with}}> = LinkedHashMap() + for((entryKey, value) in arg) { + if (!(entryKey is String)) { + throw RuntimeException("Invalid non-string key value") } - String propertyName = (String) entryKey; - List propertyPathToItem = new ArrayList<>(pathToItem); - propertyPathToItem.add(propertyName); - Object value = entry.getValue(); - LinkedHashMap, Nothing?> schemas = pathToSchemas.get(propertyPathToItem); + val propertyPathToItem: List = pathToItem + entryKey + val schemas: LinkedHashMap, Nothing?>? = pathToSchemas.get(propertyPathToItem) if (schemas == null) { - throw new RuntimeException("Validation result is invalid, schemas must exist for a pathToItem"); + throw RuntimeException("Validation result is invalid, schemas must exist for a pathToItem") } - JsonSchema propertySchema = schemas.entrySet().iterator().next().getKey(); - @Nullable Object propertyInstance = propertySchema.getNewInstance(value, propertyPathToItem, pathToSchemas); + val propertySchema: JsonSchema<*> = schemas.entries.iterator().next().key + val propertyInstance: Any? = propertySchema.getNewInstance(value, propertyPathToItem, pathToSchemas) {{#if ../mapValueSchema}} {{#if ../mapValueSchema.isNullableObject }} - properties.put(propertyName, propertyInstance); + properties[entryKey] = propertyInstance {{else}} - if (!({{#contains ../mapValueSchema.types "null" }}propertyInstance == null || {{/contains}}propertyInstance instanceof {{#with ../mapValueSchema}}{{> src/main/kotlin/packagename/components/schemas/types/schema_output_type sourceJsonPath=../jsonPath forceNull=true noAnnotations=true }}{{else}}Object{{/with}})) { - throw new RuntimeException("Invalid instantiated value"); + if (!({{#contains ../mapValueSchema.types "null" }}propertyInstance == null || {{/contains}}propertyInstance is {{#with ../mapValueSchema}}{{> src/main/kotlin/packagename/components/schemas/types/schema_output_type sourceJsonPath=../jsonPath forceNull=true noAnnotations=true }}{{else}}Any{{/with}})) { + throw RuntimeException("Invalid instantiated value") } - properties.put(propertyName, ({{#with ../mapValueSchema}}{{> src/main/kotlin/packagename/components/schemas/types/schema_output_type sourceJsonPath=../jsonPath forceNull=true }}{{else}}@Nullable Object{{/with}}) propertyInstance); + properties[entryKey] = propertyInstance {{/if}} {{else}} - properties.put(propertyName, propertyInstance); + properties[entryKey] = propertyInstance {{/if}} } - FrozenMap<{{#with ../mapValueSchema}}{{> src/main/kotlin/packagename/components/schemas/types/schema_output_type sourceJsonPath=../jsonPath forceNull=true }}{{else}}@Nullable Object{{/with}}> castProperties = new FrozenMap<>(properties); + val castProperties: FrozenMap<{{#with ../mapValueSchema}}{{> src/main/kotlin/packagename/components/schemas/types/schema_output_type sourceJsonPath=../jsonPath forceNull=true }}{{else}}Any?{{/with}}> = FrozenMap(properties) {{#if ../mapOutputJsonPathPiece}} - return new {{mapOutputJsonPathPiece.pascalCase}}(castProperties); + return {{mapOutputJsonPathPiece.pascalCase}}(castProperties) {{else}} - return castProperties; + return castProperties {{/if}} } -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); - SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().build())); - ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, new PathToSchemasMap(), new LinkedHashSet<>()); - PathToSchemasMap pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet); - return getNewInstance(castArg, validationMetadata.pathToItem(), pathToSchemasMap); +@Throws(ValidationException::class) +override fun validate(arg: Map<*, *>, configuration: SchemaConfiguration?): {{#if ../mapOutputJsonPathPiece}}{{../mapOutputJsonPathPiece.pascalCase}}{{else}}FrozenMap{{/if}} { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, PathToSchemasMap(), LinkedHashSet()) + val pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet) + return getNewInstance(castArg, validationMetadata.pathToItem, pathToSchemasMap) } {{/eq}} {{#eq this "array"}} -@Override -public {{#if ../arrayOutputJsonPathPiece}}{{../arrayOutputJsonPathPiece.pascalCase}}{{else}}FrozenList<{{#with ../listItemSchema}}{{> src/main/kotlin/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/kotlin/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) { - List itemPathToItem = new ArrayList<>(pathToItem); - itemPathToItem.add(i); - LinkedHashMap, Nothing?> schemas = pathToSchemas.get(itemPathToItem); +override fun getNewInstance(arg: List<*>, pathToItem: List, pathToSchemas: PathToSchemasMap): {{#if ../arrayOutputJsonPathPiece}}{{../arrayOutputJsonPathPiece.pascalCase}}{{else}}FrozenList<{{#with ../listItemSchema}}{{> src/main/kotlin/packagename/components/schemas/types/schema_output_type sourceJsonPath=../jsonPath forceNull=true }}{{else}}Any?{{/with}}>{{/if}} { + val items: MutableList<{{#with ../listItemSchema}}{{> src/main/kotlin/packagename/components/schemas/types/schema_output_type sourceJsonPath=../jsonPath forceNull=true }}{{else}}Any?{{/with}}> = ArrayList() + var i: Int = 0 + for (item: Any? in arg) { + val itemPathToItem: List = pathToItem + i + val schemas: LinkedHashMap, Nothing?>? = pathToSchemas.get(itemPathToItem) if (schemas == null) { - throw new RuntimeException("Validation result is invalid, schemas must exist for a pathToItem"); + throw RuntimeException("Validation result is invalid, schemas must exist for a pathToItem") } - JsonSchema itemSchema = schemas.entrySet().iterator().next().getKey(); - @Nullable Object itemInstance = itemSchema.getNewInstance(item, itemPathToItem, pathToSchemas); + val itemSchema: JsonSchema<*> = schemas.entries.iterator().next().key + val itemInstance: Any? = itemSchema.getNewInstance(item, itemPathToItem, pathToSchemas) {{#if ../listItemSchema}} {{#if ../listItemSchema.isNullableObject }} - items.add(itemInstance); + items.add(itemInstance) {{else}} - if (!({{#contains ../listItemSchema.types "null" }}itemInstance == null || {{/contains}}itemInstance instanceof {{#with ../listItemSchema}}{{> src/main/kotlin/packagename/components/schemas/types/schema_output_type sourceJsonPath=../jsonPath forceNull=true noAnnotations=true }}{{else}}Object{{/with}})) { - throw new RuntimeException("Invalid instantiated value"); + if (!({{#contains ../listItemSchema.types "null" }}itemInstance == null || {{/contains}}itemInstance is {{#with ../listItemSchema}}{{> src/main/kotlin/packagename/components/schemas/types/schema_output_type sourceJsonPath=../jsonPath forceNull=true noAnnotations=true }}{{else}}Any{{/with}})) { + throw RuntimeException("Invalid instantiated value") } - items.add(({{#with ../listItemSchema}}{{> src/main/kotlin/packagename/components/schemas/types/schema_output_type sourceJsonPath=../jsonPath forceNull=true }}{{else}}@Nullable Object{{/with}}) itemInstance); + items.add(itemInstance) {{/if}} {{else}} - items.add(itemInstance); + items.add(itemInstance) {{/if}} - i += 1; + i += 1 } - FrozenList<{{#with listItemSchema}}{{> src/main/kotlin/packagename/components/schemas/types/schema_output_type sourceJsonPath=../jsonPath forceNull=true }}{{else}}@Nullable Object{{/with}}> newInstanceItems = new FrozenList<>(items); + val newInstanceItems: FrozenList<{{#with listItemSchema}}{{> src/main/kotlin/packagename/components/schemas/types/schema_output_type sourceJsonPath=../jsonPath forceNull=true }}{{else}}Any?{{/with}}> = FrozenList(items) {{#if ../arrayOutputJsonPathPiece}} - return new {{../arrayOutputJsonPathPiece.pascalCase}}(newInstanceItems); + return {{../arrayOutputJsonPathPiece.pascalCase}}(newInstanceItems) {{else}} - return newInstanceItems; + return newInstanceItems {{/if}} } -public {{#if ../arrayOutputJsonPathPiece}}{{../arrayOutputJsonPathPiece.pascalCase}}{{else}}FrozenList<{{#with ../listItemSchema}}{{> src/main/kotlin/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); - SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().build())); - ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, new PathToSchemasMap(), new LinkedHashSet<>()); - PathToSchemasMap pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet); - return getNewInstance(castArg, validationMetadata.pathToItem(), pathToSchemasMap); +@Throws(ValidationException::class) +override fun validate(arg: List<*>, configuration: SchemaConfiguration?): {{#if ../arrayOutputJsonPathPiece}}{{../arrayOutputJsonPathPiece.pascalCase}}{{else}}FrozenList<{{#with ../listItemSchema}}{{> src/main/kotlin/packagename/components/schemas/types/schema_output_type sourceJsonPath=../jsonPath forceNull=true }}{{else}}Any?{{/with}}>{{/if}} { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, PathToSchemasMap(), LinkedHashSet()) + val pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet) + return getNewInstance(castArg, validationMetadata.pathToItem, pathToSchemasMap) } {{/eq}} {{#eq this "string" }} @@ -117,113 +113,129 @@ public {{#if ../arrayOutputJsonPathPiece}}{{../arrayOutputJsonPathPiece.pascalCa // bytes, {{else}} -@Override -public String validate(String arg, SchemaConfiguration configuration) throws ValidationException { - Set> pathSet = new HashSet<>(); - List pathToItem = List.of("args[0"); - String castArg = castToAllowedTypes(arg, pathToItem, pathSet); - SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().build())); - ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, new PathToSchemasMap(), new LinkedHashSet<>()); - getPathToSchemas(this, castArg, validationMetadata, pathSet); - return castArg; +@Throws(ValidationException::class) +override fun validate(arg: String, configuration: SchemaConfiguration?): String { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, PathToSchemasMap(), LinkedHashSet()) + getPathToSchemas(this, castArg, validationMetadata, pathSet) + return castArg } {{/eq}} {{/eq}} {{#eq this "integer"}} -@Override -public Number validate(Number arg, SchemaConfiguration configuration) throws ValidationException { - Set> pathSet = new HashSet<>(); - List pathToItem = List.of("args[0"); - Number castArg = castToAllowedTypes(arg, pathToItem, pathSet); - SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().build())); - ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, new PathToSchemasMap(), new LinkedHashSet<>()); - getPathToSchemas(this, castArg, validationMetadata, pathSet); - return castArg; +@Throws(ValidationException::class) +override fun validate(arg: Number, configuration: SchemaConfiguration?): Number { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, PathToSchemasMap(), LinkedHashSet()) + getPathToSchemas(this, castArg, validationMetadata, pathSet) + return castArg } -public int validate(int arg, SchemaConfiguration configuration) throws ValidationException { - return (int) validate((Number) arg, configuration); +@Throws(ValidationException::class) +fun validate(arg: Int, configuration: SchemaConfiguration?): Int { + return validate(arg as Number, configuration) as Int } -public float validate(float arg, SchemaConfiguration configuration) throws ValidationException { - return (float) validate((Number) arg, configuration); +@Throws(ValidationException::class) +fun validate(arg: Float, configuration: SchemaConfiguration?): Float { + return validate(arg as Number, configuration) as Float } {{#neq ../format "int32"}} -public long validate(long arg, SchemaConfiguration configuration) throws ValidationException { - return (long) validate((Number) arg, configuration); +@Throws(ValidationException::class) +fun validate(arg: Long, configuration: SchemaConfiguration?): Long { + return validate(arg as Number, configuration) as Long } -public double validate(double arg, SchemaConfiguration configuration) throws ValidationException { - return (double) validate((Number) arg, configuration); +@Throws(ValidationException::class) +fun validate(arg: Double, configuration: SchemaConfiguration?): Double { + return validate(arg as Number, configuration) as Double } {{/neq}} {{/eq}} {{#eq this "number"}} -@Override -public Number validate(Number arg, SchemaConfiguration configuration) throws ValidationException { - Set> pathSet = new HashSet<>(); - List pathToItem = List.of("args[0"); - Number castArg = castToAllowedTypes(arg, pathToItem, pathSet); - SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().build())); - ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, new PathToSchemasMap(), new LinkedHashSet<>()); - PathToSchemasMap pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet); - return castArg; +@Throws(ValidationException::class) +override fun validate(arg: Number, configuration: SchemaConfiguration?): Number { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, PathToSchemasMap(), LinkedHashSet()) + val pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet) + return castArg } {{#eq ../format null}} -public int validate(int arg, SchemaConfiguration configuration) throws ValidationException { - return (int) validate((Number) arg, configuration); +@Throws(ValidationException::class) +fun validate(arg: Int, configuration: SchemaConfiguration?): Int { + return validate(arg as Number, configuration) as Int } -public long validate(long arg, SchemaConfiguration configuration) throws ValidationException { - return (long) validate((Number) arg, configuration); +@Throws(ValidationException::class) +fun validate(arg: Long, configuration: SchemaConfiguration?): Long { + return validate(arg as Number, configuration) as Long } -public float validate(float arg, SchemaConfiguration configuration) throws ValidationException { - return (float) validate((Number) arg, configuration); +@Throws(ValidationException::class) +fun validate(arg: Float, configuration: SchemaConfiguration?): Float { + return validate(arg as Number, configuration) as Float } -public double validate(double arg, SchemaConfiguration configuration) throws ValidationException { - return (double) validate((Number) arg, configuration); +@Throws(ValidationException::class) +fun validate(arg: Double, configuration: SchemaConfiguration?): Double { + return validate(arg as Number, configuration) as Double } {{else}} {{#eq ../format "int32"}} -public int validate(int arg, SchemaConfiguration configuration) throws ValidationException { - return (int) validate((Number) arg, configuration); +@Throws(ValidationException::class) +fun validate(arg: Int, configuration: SchemaConfiguration?): Int { + return validate(arg as Number, configuration) as Int } -public float validate(float arg, SchemaConfiguration configuration) throws ValidationException { - return (float) validate((Number) arg, configuration); +@Throws(ValidationException::class) +fun validate(arg: Float, configuration: SchemaConfiguration?): Float { + return validate(arg as Number, configuration) as Float } {{else}} {{#eq ../format "int64"}} -public int validate(int arg, SchemaConfiguration configuration) throws ValidationException { - return (int) validate((Number) arg, configuration); +@Throws(ValidationException::class) +fun validate(arg: Int, configuration: SchemaConfiguration?): Int { + return validate(arg as Number, configuration) as Int } -public float validate(float arg, SchemaConfiguration configuration) throws ValidationException { - return (float) validate((Number) arg, configuration); +@Throws(ValidationException::class) +fun validate(arg: Long, configuration: SchemaConfiguration?): Long { + return validate(arg as Number, configuration) as Long } -public long validate(long arg, SchemaConfiguration configuration) throws ValidationException { - return (long) validate((Number) arg, configuration); +@Throws(ValidationException::class) +fun validate(arg: Float, configuration: SchemaConfiguration?): Float { + return validate(arg as Number, configuration) as Float } -public double validate(double arg, SchemaConfiguration configuration) throws ValidationException { - return (double) validate((Number) arg, configuration); +@Throws(ValidationException::class) +fun validate(arg: Double, configuration: SchemaConfiguration?): Double { + return validate(arg as Number, configuration) as Double } {{else}} {{#eq ../format "float"}} -public float validate(float arg, SchemaConfiguration configuration) throws ValidationException { - return (float) validate((Number) arg, configuration); +@Throws(ValidationException::class) +fun validate(arg: Float, configuration: SchemaConfiguration?): Float { + return validate(arg as Number, configuration) as Float } {{else}} {{#eq ../format "double"}} -public double validate(double arg, SchemaConfiguration configuration) throws ValidationException { - return (double) validate((Number) arg, configuration); +@Throws(ValidationException::class) +fun validate(arg: Double, configuration: SchemaConfiguration?): Double { + return validate(arg as Number, configuration) as Double } {{/eq}} {{/eq}} @@ -233,268 +245,269 @@ public double validate(double arg, SchemaConfiguration configuration) throws Val {{/eq}} {{#eq this "boolean"}} -@Override -public boolean validate(boolean arg, SchemaConfiguration configuration) throws ValidationException { - Set> pathSet = new HashSet<>(); - List pathToItem = List.of("args[0"); - boolean castArg = castToAllowedTypes(arg, pathToItem, pathSet); - SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().build())); - ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, new PathToSchemasMap(), new LinkedHashSet<>()); - getPathToSchemas(this, castArg, validationMetadata, pathSet); - return castArg; +@Throws(ValidationException::class) +override fun validate(arg: Boolean, configuration: SchemaConfiguration?): Boolean { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, PathToSchemasMap(), LinkedHashSet()) + getPathToSchemas(this, castArg, validationMetadata, pathSet) + return castArg } {{/eq}} {{/each}} {{else}} -@Override -public Nothing? validate(Nothing? arg, SchemaConfiguration configuration) throws ValidationException { - Set> pathSet = new HashSet<>(); - List pathToItem = List.of("args[0]"); - Nothing? castArg = castToAllowedTypes(arg, pathToItem, pathSet); - SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().build())); - PathToSchemasMap validatedPathToSchemas = new PathToSchemasMap(); - ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, new LinkedHashSet<>()); - getPathToSchemas(this, castArg, validationMetadata, pathSet); - return castArg; +@Throws(ValidationException::class) +override fun validate(arg: Nothing?, configuration: SchemaConfiguration?): Nothing? { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validatedPathToSchemas = PathToSchemasMap() + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, LinkedHashSet()) + getPathToSchemas(this, castArg, validationMetadata, pathSet) + return castArg } -@Override -public boolean validate(boolean arg, SchemaConfiguration configuration) throws ValidationException { - Set> pathSet = new HashSet<>(); - List pathToItem = List.of("args[0]"); - boolean castArg = castToAllowedTypes(arg, pathToItem, pathSet); - SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().build())); - PathToSchemasMap validatedPathToSchemas = new PathToSchemasMap(); - ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, new LinkedHashSet<>()); - getPathToSchemas(this, castArg, validationMetadata, pathSet); - return castArg; +@Throws(ValidationException::class) +override fun validate(arg: Boolean, configuration: SchemaConfiguration?): Boolean { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validatedPathToSchemas = PathToSchemasMap() + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, LinkedHashSet()) + getPathToSchemas(this, castArg, validationMetadata, pathSet) + return castArg } -@Override -public Number validate(Number arg, SchemaConfiguration configuration) throws ValidationException { - Set> pathSet = new HashSet<>(); - List pathToItem = List.of("args[0]"); - Number castArg = castToAllowedTypes(arg, pathToItem, pathSet); - SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().build())); - PathToSchemasMap validatedPathToSchemas = new PathToSchemasMap(); - ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, new LinkedHashSet<>()); - getPathToSchemas(this, castArg, validationMetadata, pathSet); - return castArg; +@Throws(ValidationException::class) +override fun validate(arg: Number, configuration: SchemaConfiguration?): Number { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validatedPathToSchemas = PathToSchemasMap() + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, LinkedHashSet()) + getPathToSchemas(this, castArg, validationMetadata, pathSet) + return castArg } -public int validate(int arg, SchemaConfiguration configuration) throws ValidationException { - return (int) validate((Number) arg, configuration); +@Throws(ValidationException::class) +fun validate(arg: Int, configuration: SchemaConfiguration?): Int { + return validate(arg as Number, configuration) as Int } -public long validate(long arg, SchemaConfiguration configuration) throws ValidationException { - return (long) validate((Number) arg, configuration); +@Throws(ValidationException::class) +fun validate(arg: Long, configuration: SchemaConfiguration?): Long { + return validate(arg as Number, configuration) as Long } -public float validate(float arg, SchemaConfiguration configuration) throws ValidationException { - return (float) validate((Number) arg, configuration); +@Throws(ValidationException::class) +fun validate(arg: Float, configuration: SchemaConfiguration?): Float { + return validate(arg as Number, configuration) as Float } -public double validate(double arg, SchemaConfiguration configuration) throws ValidationException { - return (double) validate((Number) arg, configuration); +@Throws(ValidationException::class) +fun validate(arg: Double, configuration: SchemaConfiguration?): Double { + return validate(arg as Number, configuration) as Double } -@Override -public String validate(String arg, SchemaConfiguration configuration) throws ValidationException { - Set> pathSet = new HashSet<>(); - List pathToItem = List.of("args[0]"); - String castArg = castToAllowedTypes(arg, pathToItem, pathSet); - SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().build())); - PathToSchemasMap validatedPathToSchemas = new PathToSchemasMap(); - ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, new LinkedHashSet<>()); - getPathToSchemas(this, castArg, validationMetadata, pathSet); - return castArg; +@Throws(ValidationException::class) +override fun validate(arg: String, configuration: SchemaConfiguration?): String { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validatedPathToSchemas = PathToSchemasMap() + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, LinkedHashSet()) + getPathToSchemas(this, castArg, validationMetadata, pathSet) + return castArg } -public String validate(LocalDate arg, SchemaConfiguration configuration) throws ValidationException { - return validate(arg.toString(), configuration); +@Throws(ValidationException::class) +fun validate(arg: LocalDate, configuration: SchemaConfiguration?): String { + return validate(arg.toString(), configuration) } -public String validate(ZonedDateTime arg, SchemaConfiguration configuration) throws ValidationException { - return validate(arg.toString(), configuration); +@Throws(ValidationException::class) +fun validate(arg: ZonedDateTime, configuration: SchemaConfiguration?): String { + return validate(arg.toString(), configuration) } -public String validate(UUID arg, SchemaConfiguration configuration) throws ValidationException { - return validate(arg.toString(), configuration); +@Throws(ValidationException::class) +fun validate(arg: UUID, configuration: SchemaConfiguration?): String { + return validate(arg.toString(), configuration) } -@Override -public {{#if arrayOutputJsonPathPiece}}{{arrayOutputJsonPathPiece.pascalCase}}{{else}}FrozenList<{{#with listItemSchema}}{{> src/main/kotlin/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/kotlin/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) { - List itemPathToItem = new ArrayList<>(pathToItem); - itemPathToItem.add(i); - LinkedHashMap, Nothing?> schemas = pathToSchemas.get(itemPathToItem); +override fun getNewInstance(arg: List<*>, pathToItem: List, pathToSchemas: PathToSchemasMap): {{#if arrayOutputJsonPathPiece}}{{arrayOutputJsonPathPiece.pascalCase}}{{else}}FrozenList<{{#with listItemSchema}}{{> src/main/kotlin/packagename/components/schemas/types/schema_output_type sourceJsonPath=../jsonPath forceNull=true }}{{else}}Any?{{/with}}>{{/if}} { + val items: MutableList<{{#with listItemSchema}}{{> src/main/kotlin/packagename/components/schemas/types/schema_output_type sourceJsonPath=../jsonPath forceNull=true }}{{else}}Any?{{/with}}> = ArrayList() + var i: Int = 0 + for (item: Any? in arg) { + val itemPathToItem = pathToItem + i + val schemas: LinkedHashMap, Nothing?>? = pathToSchemas.get(itemPathToItem) if (schemas == null) { - throw new RuntimeException("Validation result is invalid, schemas must exist for a pathToItem"); + throw RuntimeException("Validation result is invalid, schemas must exist for a pathToItem") } - JsonSchema itemSchema = schemas.entrySet().iterator().next().getKey(); - @Nullable Object itemInstance = itemSchema.getNewInstance(item, itemPathToItem, pathToSchemas); + val itemSchema: JsonSchema<*> = schemas.entries.iterator().next().key + val itemInstance: Any? = itemSchema.getNewInstance(item, itemPathToItem, pathToSchemas) {{#if listItemSchema}} {{#if listItemSchema.isNullableObject }} - items.add(itemInstance); + items.add(itemInstance) {{else}} - if (!({{#contains listItemSchema.types "null" }}itemInstance == null || {{/contains}}itemInstance instanceof {{#with listItemSchema}}{{> src/main/kotlin/packagename/components/schemas/types/schema_output_type sourceJsonPath=../jsonPath forceNull=true noAnnotations=true }}{{else}}Object{{/with}})) { - throw new RuntimeException("Invalid instantiated value"); + if (!({{#contains listItemSchema.types "null" }}itemInstance == null || {{/contains}}itemInstance is {{#with listItemSchema}}{{> src/main/kotlin/packagename/components/schemas/types/schema_output_type sourceJsonPath=../jsonPath forceNull=true noAnnotations=true }}{{else}}Any{{/with}})) { + throw RuntimeException("Invalid instantiated value") } - items.add(({{#with listItemSchema}}{{> src/main/kotlin/packagename/components/schemas/types/schema_output_type sourceJsonPath=../jsonPath forceNull=true }}{{else}}@Nullable Object{{/with}}) itemInstance); + items.add(itemInstance) {{/if}} {{else}} - items.add(itemInstance); + items.add(itemInstance) {{/if}} - i += 1; + i += 1 } - FrozenList<{{#with listItemSchema}}{{> src/main/kotlin/packagename/components/schemas/types/schema_output_type sourceJsonPath=../jsonPath forceNull=true }}{{else}}@Nullable Object{{/with}}> newInstanceItems = new FrozenList<>(items); + val newInstanceItems: FrozenList<{{#with listItemSchema}}{{> src/main/kotlin/packagename/components/schemas/types/schema_output_type sourceJsonPath=../jsonPath forceNull=true }}{{else}}Any?{{/with}}> = FrozenList(items) {{#if arrayOutputJsonPathPiece}} - return new {{arrayOutputJsonPathPiece.pascalCase}}(newInstanceItems); + return {{arrayOutputJsonPathPiece.pascalCase}}(newInstanceItems) {{else}} - return newInstanceItems; + return newInstanceItems {{/if}} } -public {{#if arrayOutputJsonPathPiece}}{{arrayOutputJsonPathPiece.pascalCase}}{{else}}FrozenList<{{#with ../listItemSchema}}{{> src/main/kotlin/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); - SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().build())); - ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, new PathToSchemasMap(), new LinkedHashSet<>()); - PathToSchemasMap pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet); - return getNewInstance(castArg, validationMetadata.pathToItem(), pathToSchemasMap); +@Throws(ValidationException::class) +override fun validate(arg: List<*>, configuration: SchemaConfiguration?): {{#if arrayOutputJsonPathPiece}}{{arrayOutputJsonPathPiece.pascalCase}}{{else}}FrozenList<{{#with ../listItemSchema}}{{> src/main/kotlin/packagename/components/schemas/types/schema_output_type sourceJsonPath=../jsonPath forceNull=true }}{{else}}Any?{{/with}}>{{/if}} { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, PathToSchemasMap(), LinkedHashSet()) + val pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet) + return getNewInstance(castArg, validationMetadata.pathToItem, pathToSchemasMap) } -@Override -public {{#if mapOutputJsonPathPiece}}{{mapOutputJsonPathPiece.pascalCase}}{{else}}FrozenMap<{{#with mapValueSchema}}{{> src/main/kotlin/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/kotlin/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 RuntimeException("Invalid non-string key value"); +override fun getNewInstance(arg: Map<*, *>, pathToItem: List, pathToSchemas: PathToSchemasMap): {{#if mapOutputJsonPathPiece}}{{mapOutputJsonPathPiece.pascalCase}}{{else}}FrozenMap<{{#with mapValueSchema}}{{> src/main/kotlin/packagename/components/schemas/types/schema_output_type sourceJsonPath=../jsonPath forceNull=true }}{{else}}Any?{{/with}}>{{/if}} { + val properties: LinkedHashMap src/main/kotlin/packagename/components/schemas/types/schema_output_type sourceJsonPath=../jsonPath forceNull=true }}{{else}}Any?{{/with}}> = LinkedHashMap() + for((propertyName, value) in arg) { + if (!(propertyName is String)) { + throw RuntimeException("Invalid non-string key value") } - String propertyName = (String) entryKey; - List propertyPathToItem = new ArrayList<>(pathToItem); - propertyPathToItem.add(propertyName); - Object value = entry.getValue(); - LinkedHashMap, Nothing?> schemas = pathToSchemas.get(propertyPathToItem); + val propertyPathToItem: List = pathToItem + propertyName + val schemas: LinkedHashMap, Nothing?>? = pathToSchemas.get(propertyPathToItem) if (schemas == null) { - throw new RuntimeException("Validation result is invalid, schemas must exist for a pathToItem"); + throw RuntimeException("Validation result is invalid, schemas must exist for a pathToItem") } - JsonSchema propertySchema = schemas.entrySet().iterator().next().getKey(); - @Nullable Object propertyInstance = propertySchema.getNewInstance(value, propertyPathToItem, pathToSchemas); + val propertySchema: JsonSchema<*> = schemas.entries.iterator().next().key + val propertyInstance: Any? = propertySchema.getNewInstance(value, propertyPathToItem, pathToSchemas) {{#if mapValueSchema}} {{#if mapValueSchema.isNullableObject }} - properties.put(propertyName, propertyInstance); + properties[propertyName] = propertyInstance {{else}} - if (!({{#contains mapValueSchema.types "null" }}propertyInstance == null || {{/contains}}propertyInstance instanceof {{#with mapValueSchema}}{{> src/main/kotlin/packagename/components/schemas/types/schema_output_type sourceJsonPath=../jsonPath forceNull=true noAnnotations=true }}{{else}}Object{{/with}})) { - throw new RuntimeException("Invalid instantiated value"); + if (!({{#contains mapValueSchema.types "null" }}propertyInstance == null || {{/contains}}propertyInstance is {{#with mapValueSchema}}{{> src/main/kotlin/packagename/components/schemas/types/schema_output_type sourceJsonPath=../jsonPath forceNull=true noAnnotations=true }}{{else}}Any{{/with}})) { + throw RuntimeException("Invalid instantiated value") } - properties.put(propertyName, ({{#with mapValueSchema}}{{> src/main/kotlin/packagename/components/schemas/types/schema_output_type sourceJsonPath=../jsonPath forceNull=true }}{{else}}@Nullable Object{{/with}}) propertyInstance); + properties[propertyName] = propertyInstance {{/if}} {{else}} - properties.put(propertyName, propertyInstance); + properties[propertyName] = propertyInstance {{/if}} } - FrozenMap<{{#with mapValueSchema}}{{> src/main/kotlin/packagename/components/schemas/types/schema_output_type sourceJsonPath=../jsonPath forceNull=true }}{{else}}@Nullable Object{{/with}}> castProperties = new FrozenMap<>(properties); + val castProperties: FrozenMap<{{#with mapValueSchema}}{{> src/main/kotlin/packagename/components/schemas/types/schema_output_type sourceJsonPath=../jsonPath forceNull=true }}{{else}}Any?{{/with}}> = FrozenMap(properties) {{#if ../mapOutputJsonPathPiece}} - return new {{mapOutputJsonPathPiece.pascalCase}}(castProperties); + return {{mapOutputJsonPathPiece.pascalCase}}(castProperties) {{else}} - return castProperties; + return castProperties {{/if}} } -public {{#if mapOutputJsonPathPiece}}{{mapOutputJsonPathPiece.pascalCase}}{{else}}FrozenMap<{{#with mapValueSchema}}{{> src/main/kotlin/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); - SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().build())); - PathToSchemasMap validatedPathToSchemas = new PathToSchemasMap(); - ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, new LinkedHashSet<>()); - PathToSchemasMap pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet); - return getNewInstance(castArg, validationMetadata.pathToItem(), pathToSchemasMap); +@Throws(ValidationException::class) +override fun validate(arg: Map<*, *>, configuration: SchemaConfiguration?): {{#if mapOutputJsonPathPiece}}{{mapOutputJsonPathPiece.pascalCase}}{{else}}FrozenMap<{{#with mapValueSchema}}{{> src/main/kotlin/packagename/components/schemas/types/schema_output_type sourceJsonPath=../jsonPath forceNull=true }}{{else}}? out Any?{{/with}}>{{/if}} { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validatedPathToSchemas = PathToSchemasMap() + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, LinkedHashSet()) + val pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet) + return getNewInstance(castArg, validationMetadata.pathToItem, pathToSchemasMap) } {{/if}} {{#and enumInfo enumInfo.typeToValues.null}} -@Override -public Nothing? validate(Null{{enumInfo.jsonPathPiece.pascalCase}} arg,SchemaConfiguration configuration) throws ValidationException { - return validate(arg.value(), configuration); +@Throws(ValidationException::class) +override fun validate(arg: Null{{enumInfo.jsonPathPiece.pascalCase}}, configuration: SchemaConfiguration?): Nothing? { + return validate(arg.value(), configuration) } {{/and}} {{#and enumInfo enumInfo.typeToValues.boolean}} -@Override -public boolean validate(Boolean{{enumInfo.jsonPathPiece.pascalCase}} arg,SchemaConfiguration configuration) throws ValidationException { - return validate(arg.value(), configuration); +@Throws(ValidationException::class) +override fun validate(arg: Boolean{{enumInfo.jsonPathPiece.pascalCase}}, configuration: SchemaConfiguration?): Boolean { + return validate(arg.value(), configuration) } {{/and}} {{#and enumInfo enumInfo.typeToValues.string}} -@Override -public String validate(String{{enumInfo.jsonPathPiece.pascalCase}} arg,SchemaConfiguration configuration) throws ValidationException { - return validate(arg.value(), configuration); +@Throws(ValidationException::class) +override fun validate(arg: String{{enumInfo.jsonPathPiece.pascalCase}}, configuration: SchemaConfiguration?): String { + return validate(arg.value(), configuration) } {{/and}} {{#and enumInfo enumInfo.typeToValues.Integer}} -@Override -public int validate(Integer{{enumInfo.jsonPathPiece.pascalCase}} arg,SchemaConfiguration configuration) throws ValidationException { - return (int) validate((Number) arg.value(), configuration); +@Throws(ValidationException::class) +override fun validate(arg: Integer{{enumInfo.jsonPathPiece.pascalCase}}, configuration: SchemaConfiguration?): Int { + return validate(arg.value() as Number, configuration) as Int } {{/and}} {{#and enumInfo enumInfo.typeToValues.Long}} -@Override -public long validate(Long{{enumInfo.jsonPathPiece.pascalCase}} arg,SchemaConfiguration configuration) throws ValidationException { - return (long) validate((Number) arg.value(), configuration); +@Throws(ValidationException::class) +override fun validate(arg: Long{{enumInfo.jsonPathPiece.pascalCase}}, configuration: SchemaConfiguration?): Long { + return validate(arg.value() as Number, configuration) as Long } {{/and}} {{#and enumInfo enumInfo.typeToValues.Float}} -@Override -public float validate(Float{{enumInfo.jsonPathPiece.pascalCase}} arg,SchemaConfiguration configuration) throws ValidationException { - return (float) validate((Number) arg.value(), configuration); +@Throws(ValidationException::class) +override fun validate(arg: Float{{enumInfo.jsonPathPiece.pascalCase}}, configuration: SchemaConfiguration?): Float { + return validate(arg.value() as Number, configuration) as Float } {{/and}} {{#and enumInfo enumInfo.typeToValues.Double}} -@Override -public double validate(Double{{enumInfo.jsonPathPiece.pascalCase}} arg,SchemaConfiguration configuration) throws ValidationException { - return (double) validate((Number) arg.value(), configuration); +@Throws(ValidationException::class) +override fun validate(arg: Double{{enumInfo.jsonPathPiece.pascalCase}}, configuration: SchemaConfiguration?): Double { + return validate(arg.value() as Number, configuration) as Double } {{/and}} -@Override -public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { +@Throws(ValidationException::class) +override fun validate(arg: Any?, configuration: SchemaConfiguration?): Any? { {{#if types}} {{#each types}} {{#if @first}} - if (arg {{#eq this "null"}}== null{{/eq}}{{#eq this "boolean"}}instanceof Boolean{{/eq}}{{#or (eq this "integer") (eq this "number")}}instanceof Number{{/or}}{{#eq this "string" }}instanceof String{{/eq}}{{#eq this "array"}}instanceof List{{/eq}}{{#eq this "object"}}instanceof Map{{/eq}}) { + if (arg {{#eq this "null"}}== null{{/eq}}{{#eq this "boolean"}}is Boolean{{/eq}}{{#or (eq this "integer") (eq this "number")}}is Number{{/or}}{{#eq this "string" }}is String{{/eq}}{{#eq this "array"}}is List<*>{{/eq}}{{#eq this "object"}}is Map<*, *>{{/eq}}) { {{else}} - } else if (arg {{#eq this "null"}}== null{{/eq}}{{#eq this "boolean"}}instanceof Boolean{{/eq}}{{#or (eq this "integer") (eq this "number")}}instanceof Number{{/or}}{{#eq this "string" }}instanceof String{{/eq}}{{#eq this "array"}}instanceof List{{/eq}}{{#eq this "object"}}instanceof Map{{/eq}}) { + } else if (arg {{#eq this "null"}}== null{{/eq}}{{#eq this "boolean"}}is Boolean{{/eq}}{{#or (eq this "integer") (eq this "number")}}is Number{{/or}}{{#eq this "string" }}is String{{/eq}}{{#eq this "array"}}is List<*>{{/eq}}{{#eq this "object"}}is Map<*, *>{{/eq}}) { {{/if}} {{#eq this "null"}} - return validate((Nothing?) null, configuration); + return validate(null, configuration) {{/eq}} {{#eq this "boolean"}} - boolean boolArg = (Boolean) arg; - return validate(boolArg, configuration); + return validate(arg, configuration) {{/eq}} {{#or (eq this "integer") (eq this "number")}} - return validate((Number) arg, configuration); + return validate(arg, configuration) {{/or}} {{#eq this "string" }} - return validate((String) arg, configuration); + return validate(arg, configuration) {{/eq}} {{#eq this "array"}} - return validate((List) arg, configuration); + return validate(arg, configuration) {{/eq}} {{#eq this "object"}} - return validate((Map) arg, configuration); + return validate(arg, configuration) {{/eq}} {{#if @last}} } @@ -502,19 +515,18 @@ public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration confi {{/each}} {{else}} if (arg == null) { - return validate((Nothing?) null, configuration); - } else if (arg instanceof Boolean) { - boolean boolArg = (Boolean) arg; - return validate(boolArg, configuration); - } else if (arg instanceof Number) { - return validate((Number) arg, configuration); - } else if (arg instanceof String) { - return validate((String) arg, configuration); - } else if (arg instanceof List) { - return validate((List) arg, configuration); - } else if (arg instanceof Map) { - return validate((Map) arg, configuration); + return validate(null, configuration) + } else if (arg is Boolean) { + return validate(arg, configuration) + } else if (arg is Number) { + return validate(arg, configuration) + } else if (arg is String) { + return validate(arg, configuration) + } else if (arg is List<*>) { + return validate(arg, configuration) + } else if (arg is Map<*, *>) { + return validate(arg, configuration) } {{/if}} - throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema") } \ No newline at end of file diff --git a/src/main/resources/kotlin/src/main/kotlin/packagename/components/schemas/Schema_doc.hbs b/src/main/resources/kotlin/src/main/kotlin/packagename/components/schemas/Schema_doc.hbs index ca13d32329c..6a76c303d1f 100644 --- a/src/main/resources/kotlin/src/main/kotlin/packagename/components/schemas/Schema_doc.hbs +++ b/src/main/resources/kotlin/src/main/kotlin/packagename/components/schemas/Schema_doc.hbs @@ -7,7 +7,7 @@ {{#if componentModule}} {{moduleLocation}}.java {{/if}} -public class {{containerJsonPathPiece.pascalCase}}
+class {{containerJsonPathPiece.pascalCase}}
{{#if refInfo}} extends [{{refInfo.refClass}}]({{docRoot}}{{#with refInfo.ref}}{{pathFromDocRoot}}.md#{{containerJsonPathPiece.kebabCase}}{{/with}}) {{/if}} @@ -122,7 +122,7 @@ A class that contains necessary nested {{> src/main/kotlin/packagename/components/schemas/SchemaClass/_boxedClasses forDocs=true }} {{/eq}} {{> src/main/kotlin/packagename/components/_helper_header_from_identifier_pieces headerSize=(join headerSize "#" "") identifierPieces=(append identifierPieces jsonPathPiece) }} -public static class {{jsonPathPiece.pascalCase}}
+class {{jsonPathPiece.pascalCase}}
{{> src/main/kotlin/packagename/components/schemas/docschema_extends }} A schema class that validates payloads @@ -169,15 +169,15 @@ static final SchemaConfiguration configuration = new SchemaConfiguration(new Jso {{#eq instanceType "propertiesOutputType"}} {{> src/main/kotlin/packagename/components/_helper_header_from_identifier_pieces headerSize=(join headerSize "#" "") identifierPieces=(append identifierPieces mapOutputJsonPathPiece) }} -public static class {{mapOutputJsonPathPiece.pascalCase}}
-extends FrozenMap src/main/kotlin/packagename/components/schemas/types/schema_output_type forceNull=true }}{{else}}Object{{/with}}> +class {{mapOutputJsonPathPiece.pascalCase}}
+extends FrozenMap src/main/kotlin/packagename/components/schemas/types/schema_output_type forceNull=true }}{{else}}Any{{/with}}> A class to store validated Map payloads {{headerSize}}## Method Summary | Modifier and Type | Method and Description | | ----------------- | ---------------------- | -| static [{{mapOutputJsonPathPiece.pascalCase}}](#{{> src/main/kotlin/packagename/components/_helper_anchor_id identifierPieces=(append identifierPieces mapOutputJsonPathPiece) }}) | of([Map src/main/kotlin/packagename/components/schemas/types/schema_input_type sourceJsonPath=../jsonPath forceNull=true }}{{else}}Object{{/with}}>](#{{> src/main/kotlin/packagename/components/_helper_anchor_id identifierPieces=(append identifierPieces mapInputJsonPathPiece) }}) arg, SchemaConfiguration configuration) | +| static [{{mapOutputJsonPathPiece.pascalCase}}](#{{> src/main/kotlin/packagename/components/_helper_anchor_id identifierPieces=(append identifierPieces mapOutputJsonPathPiece) }}) | of([Map src/main/kotlin/packagename/components/schemas/types/schema_input_type sourceJsonPath=../jsonPath forceNull=true }}{{else}}Any{{/with}}>](#{{> src/main/kotlin/packagename/components/_helper_anchor_id identifierPieces=(append identifierPieces mapInputJsonPathPiece) }}) arg, SchemaConfiguration configuration) | {{#each requiredProperties}} {{#if @key.isValid}} | {{> src/main/kotlin/packagename/components/schemas/types/schema_output_type sourceJsonPath=../jsonPath useLink=true }} | {{@key.original}}()
{{> src/main/kotlin/packagename/components/schemas/helpers/notes_msg defaultUser="server" }} | @@ -189,25 +189,25 @@ A class to store validated Map payloads {{/if}} {{/each}} {{#or (and requiredProperties requiredProperties.hasInvalidKey) (and optionalProperties optionalProperties.hasInvalidKey) }} -| {{#with mapValueSchema}}{{> src/main/kotlin/packagename/components/schemas/types/schema_output_type sourceJsonPath=../jsonPath useLink=true }}{{else}}Object{{/with}} | get(String key)
This schema has invalid Kotlin names so this method must be used when you access {{#each requiredProperties}}{{#unless @key.isValid}}instance["{{@key.original}}"], {{/unless}}{{/each}}{{#each optionalProperties}}{{#unless @key.isValid}}instance["{{@key.original}}"], {{/unless}}{{/each}} | +| {{#with mapValueSchema}}{{> src/main/kotlin/packagename/components/schemas/types/schema_output_type sourceJsonPath=../jsonPath useLink=true }}{{else}}Any{{/with}} | get(String key)
This schema has invalid Kotlin names so this method must be used when you access {{#each requiredProperties}}{{#unless @key.isValid}}instance["{{@key.original}}"], {{/unless}}{{/each}}{{#each optionalProperties}}{{#unless @key.isValid}}instance["{{@key.original}}"], {{/unless}}{{/each}} | {{/or}} {{#with additionalProperties}} {{#unless isBooleanSchemaFalse}} {{#if isBooleanSchemaTrue}} -| @Nullable Object | getAdditionalProperty(String name)
provides type safety for additional properties | +| Any? | getAdditionalProperty(String name)
provides type safety for additional properties | {{else}} | {{> src/main/kotlin/packagename/components/schemas/types/schema_output_type sourceJsonPath=../jsonPath useLink=true }} | getAdditionalProperty(String name)
provides type safety for additional properties | {{/if}} {{/unless}} {{else}} -| @Nullable Object | getAdditionalProperty(String name)
provides type safety for additional properties | +| Any? | getAdditionalProperty(String name)
provides type safety for additional properties | {{/with}} {{else}} {{#eq instanceType "arrayOutputType"}} {{> src/main/kotlin/packagename/components/_helper_header_from_identifier_pieces headerSize=(join headerSize "#" "") identifierPieces=(append identifierPieces arrayOutputJsonPathPiece) }} -public class {{arrayOutputJsonPathPiece.pascalCase}}
-extends `FrozenList<{{#with listItemSchema}}{{> src/main/kotlin/packagename/components/schemas/types/schema_output_type forceNull=true }}{{else}}Object{{/with}}>` +class {{arrayOutputJsonPathPiece.pascalCase}}
+extends `FrozenList<{{#with listItemSchema}}{{> src/main/kotlin/packagename/components/schemas/types/schema_output_type forceNull=true }}{{else}}Any{{/with}}>` A class to store validated List payloads diff --git a/src/main/resources/kotlin/src/main/kotlin/packagename/components/schemas/_arrayInputAddItem.hbs b/src/main/resources/kotlin/src/main/kotlin/packagename/components/schemas/_arrayInputAddItem.hbs index 79f0faab9b7..ce2062575c9 100644 --- a/src/main/resources/kotlin/src/main/kotlin/packagename/components/schemas/_arrayInputAddItem.hbs +++ b/src/main/resources/kotlin/src/main/kotlin/packagename/components/schemas/_arrayInputAddItem.hbs @@ -1,89 +1,89 @@ {{#each types}} {{#eq this "null"}} {{#if forDocs }} -| {{builderClass}} | add(Nothing? item) | +| {{builderClass}} | add(item: Nothing?) | {{else}} -public {{builderClass}} add(Nothing? item) { - list.add(null); - return this; +fun add(item: Nothing?): {{builderClass}} { + list.add(null) + return this } {{/if}} {{else}} {{#eq this "boolean"}} {{#if forDocs }} -| {{builderClass}} | add(boolean item) | +| {{builderClass}} | add(item: Boolean) | {{else}} -public {{builderClass}} add(boolean item) { - list.add(item); - return this; +fun add(item: Boolean): {{builderClass}} { + list.add(item) + return this } {{/if}} {{else}} {{#eq this "string"}} {{#if forDocs }} -| {{builderClass}} | add(String item) | +| {{builderClass}} | add(item: String) | {{else}} -public {{builderClass}} add(String item) { - list.add(item); - return this; +fun add(item: String): {{builderClass}} { + list.add(item) + return this } {{/if}} {{else}} {{#or (eq this "integer") (eq this "number") }} {{#if forDocs }} -| {{builderClass}} | add(int item) | -| {{builderClass}} | add(float item) | +| {{builderClass}} | add(item: Int) | +| {{builderClass}} | add(item: Float) | {{#neq ../format "int32"}} -| {{builderClass}} | add(long item) | -| {{builderClass}} | add(double item) | +| {{builderClass}} | add(item: Long) | +| {{builderClass}} | add(item: Double) | {{/neq}} {{else}} -public {{builderClass}} add(int item) { - list.add(item); - return this; +fun add(item: Int): {{builderClass}} { + list.add(item) + return this } -public {{builderClass}} add(float item) { - list.add(item); - return this; +fun add(item: Float): {{builderClass}} { + list.add(item) + return this } {{#neq ../format "int32"}} -public {{builderClass}} add(long item) { - list.add(item); - return this; +fun add(item: Long): {{builderClass}} { + list.add(item) + return this } -public {{builderClass}} add(double item) { - list.add(item); - return this; +fun add(item: Double): {{builderClass}} { + list.add(item) + return this } {{/neq}} {{/if}} {{else}} {{#eq this "array"}} {{#if forDocs }} -| {{builderClass}} | add(List<{{#with listItemSchema}}{{> src/main/kotlin/packagename/components/schemas/types/schema_input_type sourceJsonPath=../jsonPath forceNull=true noExtends=true }}{{else}}@Nullable Object{{/with}}> item) | +| {{builderClass}} | add(item: List<{{#with listItemSchema}}{{> src/main/kotlin/packagename/components/schemas/types/schema_input_type sourceJsonPath=../jsonPath forceNull=true noExtends=true }}{{else}}Any?{{/with}}>) | {{else}} -public {{builderClass}} add(List<{{#with listItemSchema}}{{> src/main/kotlin/packagename/components/schemas/types/schema_input_type sourceJsonPath=../jsonPath forceNull=true noExtends=true }}{{else}}@Nullable Object{{/with}}> item) { - list.add(item); - return this; +fun add(item: List<{{#with listItemSchema}}{{> src/main/kotlin/packagename/components/schemas/types/schema_input_type sourceJsonPath=../jsonPath forceNull=true noExtends=true }}{{else}}Any?{{/with}}>): {{builderClass}} { + list.add(item) + return this } {{/if}} {{else}} {{#eq this "object"}} {{#if forDocs }} -| {{builderClass}} | add(Map src/main/kotlin/packagename/components/schemas/types/schema_input_type sourceJsonPath=../jsonPath forceNull=true noExtends=true }}{{else}}@Nullable Object{{/with}}> item) | +| {{builderClass}} | add(item: Map src/main/kotlin/packagename/components/schemas/types/schema_input_type sourceJsonPath=../jsonPath forceNull=true noExtends=true }}{{else}}Any?{{/with}}>) | {{else}} -public {{builderClass}} add(Map src/main/kotlin/packagename/components/schemas/types/schema_input_type sourceJsonPath=../jsonPath forceNull=true noExtends=true }}{{else}}@Nullable Object{{/with}}> item) { - list.add(item); - return this; +fun add(item: Map src/main/kotlin/packagename/components/schemas/types/schema_input_type sourceJsonPath=../jsonPath forceNull=true noExtends=true }}{{else}}Any?{{/with}}>): {{builderClass}} { + list.add(item) + return this } {{/if}} {{/eq}} @@ -95,60 +95,60 @@ public {{builderClass}} add(Map src/main/kot {{else}} {{! no type defined }} {{#if forDocs }} -| {{builderClass}} | add(Nothing? item) | -| {{builderClass}} | add(boolean item) | -| {{builderClass}} | add(String item) | -| {{builderClass}} | add(int item) | -| {{builderClass}} | add(float item) | -| {{builderClass}} | add(long item) | -| {{builderClass}} | add(double item) | -| {{builderClass}} | add(List item) | -| {{builderClass}} | add(Map item) | +| {{builderClass}} | add(item: Nothing?) | +| {{builderClass}} | add(item: Boolean) | +| {{builderClass}} | add(item: String) | +| {{builderClass}} | add(item: Int) | +| {{builderClass}} | add(item: Float) | +| {{builderClass}} | add(item: Long) | +| {{builderClass}} | add(item: Double) | +| {{builderClass}} | add(item: List) | +| {{builderClass}} | add(item: Map) | {{else}} -public {{builderClass}} add(Nothing? item) { - list.add(null); - return this; +fun add(item: Nothing?): {{builderClass}} { + list.add(null) + return this } -public {{builderClass}} add(boolean item) { - list.add(item); - return this; +fun add(item: Boolean): {{builderClass}} { + list.add(item) + return this } -public {{builderClass}} add(String item) { - list.add(item); - return this; +fun add(item: String): {{builderClass}} { + list.add(item) + return this } -public {{builderClass}} add(int item) { - list.add(item); - return this; +fun add(item: Int): {{builderClass}} { + list.add(item) + return this } -public {{builderClass}} add(float item) { - list.add(item); - return this; +fun add(item: Float): {{builderClass}} { + list.add(item) + return this } -public {{builderClass}} add(long item) { - list.add(item); - return this; +fun add(item: Long): {{builderClass}} { + list.add(item) + return this } -public {{builderClass}} add(double item) { - list.add(item); - return this; +fun add(item: Double): {{builderClass}} { + list.add(item) + return this } -public {{builderClass}} add(List item) { - list.add(item); - return this; +fun add(item: List<*>): {{builderClass}} { + list.add(item) + return this } -public {{builderClass}} add(Map item) { - list.add(item); - return this; +fun add(item: Map): {{builderClass}} { + list.add(item) + return this } {{/if}} {{/each}} @@ -157,105 +157,105 @@ public {{builderClass}} add(Map item) { {{#eq @key "null"}} {{#if forDocs }} {{#if useContainer }} -| {{builderClass}} | add([{{../../containerJsonPathPiece.pascalCase}}.Null{{../jsonPathPiece.pascalCase}}]({{docRoot}}{{pathFromDocRoot}}.md#null{{../jsonPathPiece.kebabCase}}) item) | +| {{builderClass}} | add(item: [{{../../containerJsonPathPiece.pascalCase}}.Null{{../jsonPathPiece.pascalCase}}]({{docRoot}}{{pathFromDocRoot}}.md#null{{../jsonPathPiece.kebabCase}})) | {{else}} -| {{builderClass}} | add([Null{{../jsonPathPiece.pascalCase}}](#null{{../jsonPathPiece.kebabCase}}) item) | +| {{builderClass}} | add(item: [Null{{../jsonPathPiece.pascalCase}}](#null{{../jsonPathPiece.kebabCase}})) | {{/if}} {{else}} -public {{builderClass}} add({{#if useContainer}}{{../../containerJsonPathPiece.pascalCase}}.{{/if}}Null{{../jsonPathPiece.pascalCase}} item) { - list.add(null); - return this; +fun add(item: {{#if useContainer}}{{../../containerJsonPathPiece.pascalCase}}.{{/if}}Null{{../jsonPathPiece.pascalCase}}): {{builderClass}} { + list.add(null) + return this } {{/if}} {{else}} {{#eq @key "boolean"}} {{#if forDocs }} {{#if useContainer }} -| {{builderClass}} | add([{{../../containerJsonPathPiece.pascalCase}}.Boolean{{../jsonPathPiece.pascalCase}}]({{docRoot}}{{pathFromDocRoot}}.md#boolean{{../jsonPathPiece.kebabCase}}) item) | +| {{builderClass}} | add(item: [{{../../containerJsonPathPiece.pascalCase}}.Boolean{{../jsonPathPiece.pascalCase}}]({{docRoot}}{{pathFromDocRoot}}.md#boolean{{../jsonPathPiece.kebabCase}})) | {{else}} -| {{builderClass}} | add([Boolean{{../jsonPathPiece.pascalCase}}](#boolean{{../jsonPathPiece.kebabCase}}) item) | +| {{builderClass}} | add(item: [Boolean{{../jsonPathPiece.pascalCase}}](#boolean{{../jsonPathPiece.kebabCase}})) | {{/if}} {{else}} -public {{builderClass}} add({{#if useContainer}}{{../../containerJsonPathPiece.pascalCase}}.{{/if}}Boolean{{../jsonPathPiece.pascalCase}} item) { - list.add(item.value()); - return this; +fun add(item: {{#if useContainer}}{{../../containerJsonPathPiece.pascalCase}}.{{/if}}Boolean{{../jsonPathPiece.pascalCase}}): {{builderClass}} { + list.add(item.value()) + return this } {{/if}} {{else}} {{#eq @key "string"}} {{#if forDocs }} {{#if useContainer }} -| {{builderClass}} | add([{{../../containerJsonPathPiece.pascalCase}}.String{{../jsonPathPiece.pascalCase}}]({{docRoot}}{{pathFromDocRoot}}.md#string{{../jsonPathPiece.kebabCase}}) item) | +| {{builderClass}} | add(item: [{{../../containerJsonPathPiece.pascalCase}}.String{{../jsonPathPiece.pascalCase}}]({{docRoot}}{{pathFromDocRoot}}.md#string{{../jsonPathPiece.kebabCase}})) | {{else}} -| {{builderClass}} | add([String{{../jsonPathPiece.pascalCase}}](#string{{../jsonPathPiece.kebabCase}}) item) | +| {{builderClass}} | add(item: [String{{../jsonPathPiece.pascalCase}}](#string{{../jsonPathPiece.kebabCase}})) | {{/if}} {{else}} -public {{builderClass}} add({{#if useContainer}}{{../../containerJsonPathPiece.pascalCase}}.{{/if}}String{{../jsonPathPiece.pascalCase}} item) { - list.add(item.value()); - return this; +fun add(item: {{#if useContainer}}{{../../containerJsonPathPiece.pascalCase}}.{{/if}}String{{../jsonPathPiece.pascalCase}}): {{builderClass}} { + list.add(item.value()) + return this } {{/if}} {{else}} {{#eq @key "Integer"}} {{#if forDocs }} {{#if useContainer }} -| {{builderClass}} | add([{{../../containerJsonPathPiece.pascalCase}}.Integer{{../jsonPathPiece.pascalCase}}]({{docRoot}}{{pathFromDocRoot}}.md#integer{{../jsonPathPiece.kebabCase}}) item) | +| {{builderClass}} | add(item: [{{../../containerJsonPathPiece.pascalCase}}.Integer{{../jsonPathPiece.pascalCase}}]({{docRoot}}{{pathFromDocRoot}}.md#integer{{../jsonPathPiece.kebabCase}})) | {{else}} -| {{builderClass}} | add([Integer{{../jsonPathPiece.pascalCase}}](#integer{{../jsonPathPiece.kebabCase}}) item) | +| {{builderClass}} | add(item: [Integer{{../jsonPathPiece.pascalCase}}](#integer{{../jsonPathPiece.kebabCase}})) | {{/if}} {{else}} -public {{builderClass}} add({{#if useContainer}}{{../../containerJsonPathPiece.pascalCase}}.{{/if}}Integer{{../jsonPathPiece.pascalCase}} item) { - list.add(item.value()); - return this; +fun add(item: {{#if useContainer}}{{../../containerJsonPathPiece.pascalCase}}.{{/if}}Integer{{../jsonPathPiece.pascalCase}}): {{builderClass}} { + list.add(item.value()) + return this } {{/if}} {{else}} {{#eq @key "Long"}} {{#if forDocs }} {{#if useContainer }} -| {{builderClass}} | add([{{../../containerJsonPathPiece.pascalCase}}.Long{{../jsonPathPiece.pascalCase}}]({{docRoot}}{{pathFromDocRoot}}.md#long{{../jsonPathPiece.kebabCase}}) item) | +| {{builderClass}} | add(item: [{{../../containerJsonPathPiece.pascalCase}}.Long{{../jsonPathPiece.pascalCase}}]({{docRoot}}{{pathFromDocRoot}}.md#long{{../jsonPathPiece.kebabCase}})) | {{else}} -| {{builderClass}} | add([Long{{../jsonPathPiece.pascalCase}}](#long{{../jsonPathPiece.kebabCase}}) item) | +| {{builderClass}} | add(item: [Long{{../jsonPathPiece.pascalCase}}](#long{{../jsonPathPiece.kebabCase}})) | {{/if}} {{else}} -public {{builderClass}} add({{#if useContainer}}{{../../containerJsonPathPiece.pascalCase}}.{{/if}}Long{{../jsonPathPiece.pascalCase}} item) { - list.add(item.value()); - return this; +fun add(item: {{#if useContainer}}{{../../containerJsonPathPiece.pascalCase}}.{{/if}}Long{{../jsonPathPiece.pascalCase}}): {{builderClass}} { + list.add(item.value()) + return this } {{/if}} {{else}} {{#eq @key "Float"}} {{#if forDocs }} {{#if useContainer }} -| {{builderClass}} | add([{{../../containerJsonPathPiece.pascalCase}}.Float{{../jsonPathPiece.pascalCase}}]({{docRoot}}{{pathFromDocRoot}}.md#float{{../jsonPathPiece.kebabCase}}) item) | +| {{builderClass}} | add(item: [{{../../containerJsonPathPiece.pascalCase}}.Float{{../jsonPathPiece.pascalCase}}]({{docRoot}}{{pathFromDocRoot}}.md#float{{../jsonPathPiece.kebabCase}})) | {{else}} -| {{builderClass}} | add([Float{{../jsonPathPiece.pascalCase}}](#float{{../jsonPathPiece.kebabCase}}) item) | +| {{builderClass}} | add(item: [Float{{../jsonPathPiece.pascalCase}}](#float{{../jsonPathPiece.kebabCase}})) | {{/if}} {{else}} -public {{builderClass}} add({{#if useContainer}}{{../../containerJsonPathPiece.pascalCase}}.{{/if}}Float{{../jsonPathPiece.pascalCase}} item) { - list.add(item.value()); - return this; +fun add(item: {{#if useContainer}}{{../../containerJsonPathPiece.pascalCase}}.{{/if}}Float{{../jsonPathPiece.pascalCase}}): {{builderClass}} { + list.add(item.value()) + return this } {{/if}} {{else}} {{#eq @key "Double"}} {{#if forDocs }} {{#if useContainer }} -| {{builderClass}} | add([{{../../containerJsonPathPiece.pascalCase}}.Double{{../jsonPathPiece.pascalCase}}]({{docRoot}}{{pathFromDocRoot}}.md#double{{../jsonPathPiece.kebabCase}}) item) | +| {{builderClass}} | add(item: [{{../../containerJsonPathPiece.pascalCase}}.Double{{../jsonPathPiece.pascalCase}}]({{docRoot}}{{pathFromDocRoot}}.md#double{{../jsonPathPiece.kebabCase}})) | {{else}} -| {{builderClass}} | add([Double{{../jsonPathPiece.pascalCase}}](#double{{../jsonPathPiece.kebabCase}}) item) | +| {{builderClass}} | add(item: [Double{{../jsonPathPiece.pascalCase}}](#double{{../jsonPathPiece.kebabCase}})) | {{/if}} {{else}} -public {{builderClass}} add({{#if useContainer}}{{../../containerJsonPathPiece.pascalCase}}.{{/if}}Double{{../jsonPathPiece.pascalCase}} item) { - list.add(item.value()); - return this; +fun add(item: {{#if useContainer}}{{../../containerJsonPathPiece.pascalCase}}.{{/if}}Double{{../jsonPathPiece.pascalCase}}): {{builderClass}} { + list.add(item.value()) + return this } {{/if}} {{/eq}} diff --git a/src/main/resources/kotlin/src/main/kotlin/packagename/components/schemas/_arrayInputType.hbs b/src/main/resources/kotlin/src/main/kotlin/packagename/components/schemas/_arrayInputType.hbs index 31e65f584bf..e5b8c31cad2 100644 --- a/src/main/resources/kotlin/src/main/kotlin/packagename/components/schemas/_arrayInputType.hbs +++ b/src/main/resources/kotlin/src/main/kotlin/packagename/components/schemas/_arrayInputType.hbs @@ -1,16 +1,13 @@ {{#if listItemSchema}} -public static class {{arrayInputJsonPathPiece.pascalCase}} { +class {{arrayInputJsonPathPiece.pascalCase}} { // class to build List<{{#with listItemSchema}}{{> src/main/kotlin/packagename/components/schemas/types/schema_input_type sourceJsonPath=../jsonPath forceNull=true noExtends=true }}{{/with}}> - private final List<{{#with listItemSchema}}{{> src/main/kotlin/packagename/components/schemas/types/schema_input_type sourceJsonPath=../jsonPath forceNull=true noExtends=true }}{{/with}}> list; + private val list: MutableList<{{#with listItemSchema}}{{> src/main/kotlin/packagename/components/schemas/types/schema_input_type sourceJsonPath=../jsonPath forceNull=true noExtends=true }}{{/with}}> - public {{arrayInputJsonPathPiece.pascalCase}}() { - list = new ArrayList<>(); + init { + this.list = ArrayList() } - public {{arrayInputJsonPathPiece.pascalCase}}(List<{{#with listItemSchema}}{{> src/main/kotlin/packagename/components/schemas/types/schema_input_type sourceJsonPath=../jsonPath forceNull=true noExtends=true }}{{/with}}> list) { - this.list = list; - } {{#with listItemSchema}} {{#if refInfo }} {{#if refInfo.refModule}} @@ -20,9 +17,9 @@ public static class {{arrayInputJsonPathPiece.pascalCase}} { {{else}} {{! self reference} }} - public {{../arrayInputJsonPathPiece.pascalCase}} add(List item) { - list.add(item); - return this; + fun add(item: List<*>): {{../arrayInputJsonPathPiece.pascalCase}} { + list.add(item) + return this } {{/if}} {{else}} @@ -32,8 +29,8 @@ public static class {{arrayInputJsonPathPiece.pascalCase}} { {{! todo handle this, 3.1.0 document use-case }} {{/with}} - public List<{{#with listItemSchema}}{{> src/main/kotlin/packagename/components/schemas/types/schema_input_type sourceJsonPath=../jsonPath forceNull=true noExtends=true }}{{/with}}> build() { - return list; + fun build(): List<{{#with listItemSchema}}{{> src/main/kotlin/packagename/components/schemas/types/schema_input_type sourceJsonPath=../jsonPath forceNull=true noExtends=true }}{{/with}}> { + return list } } {{/if}} diff --git a/src/main/resources/kotlin/src/main/kotlin/packagename/components/schemas/_arrayOutputType.hbs b/src/main/resources/kotlin/src/main/kotlin/packagename/components/schemas/_arrayOutputType.hbs index a86bf806e3d..3925993c65d 100644 --- a/src/main/resources/kotlin/src/main/kotlin/packagename/components/schemas/_arrayOutputType.hbs +++ b/src/main/resources/kotlin/src/main/kotlin/packagename/components/schemas/_arrayOutputType.hbs @@ -1,10 +1,10 @@ -public static class {{arrayOutputJsonPathPiece.pascalCase}} extends FrozenList<{{#with listItemSchema}}{{> src/main/kotlin/packagename/components/schemas/types/schema_output_type fullRefModule="" forceNull=true }}{{/with}}> { - protected {{arrayOutputJsonPathPiece.pascalCase}}(FrozenList<{{#with listItemSchema}}{{> src/main/kotlin/packagename/components/schemas/types/schema_output_type fullRefModule="" forceNull=true }}{{/with}}> m) { - super(m); - } - public static {{arrayOutputJsonPathPiece.pascalCase}} of(List<{{#with listItemSchema}}{{> src/main/kotlin/packagename/components/schemas/types/schema_input_type sourceJsonPath=../jsonPath forceNull=true }}{{/with}}> arg, SchemaConfiguration configuration) throws ValidationException { - return {{jsonPathPiece.pascalCase}}.getInstance().validate(arg, configuration); +class {{arrayOutputJsonPathPiece.pascalCase}}(m: FrozenList<{{#with listItemSchema}}{{> src/main/kotlin/packagename/components/schemas/types/schema_output_type fullRefModule="" forceNull=true }}{{/with}}>) : FrozenList<{{#with listItemSchema}}{{> src/main/kotlin/packagename/components/schemas/types/schema_output_type fullRefModule="" forceNull=true }}{{/with}}>(m) { + companion object { + @Throws(ValidationException::class) + fun of(arg: List<{{#with listItemSchema}}{{> src/main/kotlin/packagename/components/schemas/types/schema_input_type sourceJsonPath=../jsonPath forceNull=true }}{{/with}}>, configuration: SchemaConfiguration?): {{arrayOutputJsonPathPiece.pascalCase}} { + return {{jsonPathPiece.pascalCase}}.getInstance().validate(arg, configuration) + } } } diff --git a/src/main/resources/kotlin/src/main/kotlin/packagename/components/schemas/_containerClassName.hbs b/src/main/resources/kotlin/src/main/kotlin/packagename/components/schemas/_containerClassName.hbs index 1006563f098..662585181e2 100644 --- a/src/main/resources/kotlin/src/main/kotlin/packagename/components/schemas/_containerClassName.hbs +++ b/src/main/resources/kotlin/src/main/kotlin/packagename/components/schemas/_containerClassName.hbs @@ -1,13 +1,13 @@ {{#or isBooleanSchemaFalse isBooleanSchemaTrue}} {{#if isBooleanSchemaTrue}} -{{containerJsonPathPiece.pascalCase}} extends AnyTypeJsonSchema +{{containerJsonPathPiece.pascalCase}}: AnyTypeJsonSchema() {{~else}} -{{containerJsonPathPiece.pascalCase}} extends NotAnyTypeJsonSchema +{{containerJsonPathPiece.pascalCase}}: NotAnyTypeJsonSchema() {{~/if}} {{else}} {{#eq types null }} {{#if isSimpleAnyType }} -{{containerJsonPathPiece.pascalCase}} extends AnyTypeJsonSchema +{{containerJsonPathPiece.pascalCase}}: AnyTypeJsonSchema() {{~else}} {{containerJsonPathPiece.pascalCase}} {{~/if}} @@ -18,21 +18,21 @@ {{#each types}} {{#eq this "object"}} {{#if isSimpleObject }} -{{containerJsonPathPiece.pascalCase}} extends MapJsonSchema +{{containerJsonPathPiece.pascalCase}}: MapJsonSchema() {{~else}} {{containerJsonPathPiece.pascalCase}} {{~/if}} {{else}} {{#eq this "array"}} {{#if isSimpleArray }} -{{containerJsonPathPiece.pascalCase}} extends ListJsonSchema +{{containerJsonPathPiece.pascalCase}}: ListJsonSchema() {{~else}} {{containerJsonPathPiece.pascalCase}} {{~/if}} {{else}} {{#eq this "boolean"}} {{#if isSimpleBoolean }} -{{containerJsonPathPiece.pascalCase}} extends BooleanJsonSchema +{{containerJsonPathPiece.pascalCase}}: BooleanJsonSchema() {{~else}} {{containerJsonPathPiece.pascalCase}} {{~/if}} @@ -41,16 +41,16 @@ {{#or isSimpleInteger isSimpleNumber }} {{#if isSimpleInteger}} {{#eq ../format "int32"}} -{{containerJsonPathPiece.pascalCase}} extends Int32JsonSchema +{{containerJsonPathPiece.pascalCase}}: Int32JsonSchema() {{~else}} {{#eq ../format "int64"}} -{{containerJsonPathPiece.pascalCase}} extends Int64JsonSchema +{{containerJsonPathPiece.pascalCase}}: Int64JsonSchema() {{~else}} -{{containerJsonPathPiece.pascalCase}} extends IntJsonSchema +{{containerJsonPathPiece.pascalCase}}: IntJsonSchema() {{~/eq}} {{/eq}} {{~else}} -{{containerJsonPathPiece.pascalCase}} extends NumberJsonSchema +{{containerJsonPathPiece.pascalCase}}: NumberJsonSchema() {{~/if}} {{else}} {{containerJsonPathPiece.pascalCase}} @@ -59,18 +59,18 @@ {{#eq this "string"}} {{#if isSimpleString}} {{#eq ../format "date"}} -{{containerJsonPathPiece.pascalCase}} extends DateJsonSchema +{{containerJsonPathPiece.pascalCase}}: DateJsonSchema() {{~else}} {{#eq ../format "date-time"}} -{{containerJsonPathPiece.pascalCase}} extends DateTimeJsonSchema +{{containerJsonPathPiece.pascalCase}}: DateTimeJsonSchema() {{~else}} {{#eq ../format "number"}} -{{containerJsonPathPiece.pascalCase}} extends DecimalJsonSchema +{{containerJsonPathPiece.pascalCase}}: DecimalJsonSchema() {{~else}} {{#eq ../format "uuid"}} -{{containerJsonPathPiece.pascalCase}} extends UuidJsonSchema +{{containerJsonPathPiece.pascalCase}}: UuidJsonSchema() {{~else}} -{{containerJsonPathPiece.pascalCase}} extends StringJsonSchema +{{containerJsonPathPiece.pascalCase}}: StringJsonSchema() {{~/eq}} {{/eq}} {{/eq}} @@ -80,7 +80,7 @@ {{~/if}} {{else}} {{#if isSimpleNull }} -{{containerJsonPathPiece.pascalCase}} extends NullJsonSchema +{{containerJsonPathPiece.pascalCase}}: NullJsonSchema() {{~else}} {{containerJsonPathPiece.pascalCase}} {{~/if}} diff --git a/src/main/resources/kotlin/src/main/kotlin/packagename/components/schemas/_enumTypes.hbs b/src/main/resources/kotlin/src/main/kotlin/packagename/components/schemas/_enumTypes.hbs index 6132f888b79..ce3c711afbe 100644 --- a/src/main/resources/kotlin/src/main/kotlin/packagename/components/schemas/_enumTypes.hbs +++ b/src/main/resources/kotlin/src/main/kotlin/packagename/components/schemas/_enumTypes.hbs @@ -2,25 +2,25 @@ {{#each typeToValues}} {{#eq @key "null"}} -public enum Null{{../jsonPathPiece.pascalCase}} implements NullValueMethod { +enum class Null{{../jsonPathPiece.pascalCase}}(private val value: Nothing?): NullValueMethod { {{else}} {{#eq @key "boolean"}} -public enum Boolean{{../jsonPathPiece.pascalCase}} implements BooleanValueMethod { +enum class Boolean{{../jsonPathPiece.pascalCase}}(private val value: Boolean): BooleanValueMethod { {{else}} {{#eq @key "string"}} -public enum String{{../jsonPathPiece.pascalCase}} implements StringValueMethod { +enum class String{{../jsonPathPiece.pascalCase}}(private val value: String): StringValueMethod { {{else}} {{#eq @key "Integer"}} -public enum Integer{{../jsonPathPiece.pascalCase}} implements IntegerValueMethod { +enum class Integer{{../jsonPathPiece.pascalCase}}(private val value: Int): IntegerValueMethod { {{else}} {{#eq @key "Long"}} -public enum Long{{../jsonPathPiece.pascalCase}} implements LongValueMethod { +enum class Long{{../jsonPathPiece.pascalCase}}(private val value: Long): LongValueMethod { {{else}} {{#eq @key "Float"}} -public enum Float{{../jsonPathPiece.pascalCase}} implements FloatValueMethod { +enum class Float{{../jsonPathPiece.pascalCase}}(private val value: Float): FloatValueMethod { {{else}} {{#eq @key "Double"}} -public enum Double{{../jsonPathPiece.pascalCase}} implements DoubleValueMethod { +enum class Double{{../jsonPathPiece.pascalCase}}(private val value: Double): DoubleValueMethod { {{/eq}} {{/eq}} {{/eq}} @@ -48,7 +48,7 @@ public enum Double{{../jsonPathPiece.pascalCase}} implements DoubleValueMethod { {{this}}({{@key.value}}f){{#unless @last}},{{else}};{{/unless}} {{else}} {{#eq ../@key "Double"}} - {{this}}({{@key.value}}d){{#unless @last}},{{else}};{{/unless}} + {{this}}({{@key.value}}){{#unless @last}},{{else}};{{/unless}} {{/eq}} {{/eq}} {{/eq}} @@ -58,73 +58,45 @@ public enum Double{{../jsonPathPiece.pascalCase}} implements DoubleValueMethod { {{/eq}} {{/each}} {{#eq @key "null"}} - private final Nothing? value; - Null{{../jsonPathPiece.pascalCase}}(Nothing? value) { - this.value = value; - } - public Nothing? value() { - return this.value; + override fun value(): Nothing? { + return this.value } {{else}} {{#eq @key "boolean"}} - private final boolean value; - Boolean{{../jsonPathPiece.pascalCase}}(boolean value) { - this.value = value; - } - public boolean value() { - return this.value; + override fun value(): Boolean { + return this.value } {{else}} {{#eq @key "string"}} - private final String value; - String{{../jsonPathPiece.pascalCase}}(String value) { - this.value = value; - } - public String value() { - return this.value; + override fun value(): String { + return this.value } {{else}} {{#eq @key "Integer"}} - private final int value; - Integer{{../jsonPathPiece.pascalCase}}(int value) { - this.value = value; - } - public int value() { - return this.value; + override fun value(): Int { + return this.value } {{else}} {{#eq @key "Long"}} - private final long value; - Long{{../jsonPathPiece.pascalCase}}(long value) { - this.value = value; - } - public long value() { - return this.value; + override fun value(): Long { + return this.value } {{else}} {{#eq @key "Float"}} - private final float value; - Float{{../jsonPathPiece.pascalCase}}(float value) { - this.value = value; - } - public float value() { - return this.value; + override fun value(): Float { + return this.value } {{else}} {{#eq @key "Double"}} - private final double value; - Double{{../jsonPathPiece.pascalCase}}(double value) { - this.value = value; - } - public double value() { - return this.value; + override fun value(): Double { + return this.value } {{/eq}} {{/eq}} diff --git a/src/main/resources/kotlin/src/main/kotlin/packagename/components/schemas/_objectInputAddPropSetter.hbs b/src/main/resources/kotlin/src/main/kotlin/packagename/components/schemas/_objectInputAddPropSetter.hbs index 33f0a4316a9..3cc1974ef77 100644 --- a/src/main/resources/kotlin/src/main/kotlin/packagename/components/schemas/_objectInputAddPropSetter.hbs +++ b/src/main/resources/kotlin/src/main/kotlin/packagename/components/schemas/_objectInputAddPropSetter.hbs @@ -13,107 +13,116 @@ {{#each types}} {{#eq this "null"}} {{#if forDocs }} -| [{{builderClass.pascalCase}}](#{{builderClass.kebabCase}}) | {{methodName}}(String key, Nothing? value) | +| [{{builderClass.pascalCase}}](#{{builderClass.kebabCase}}) | {{methodName}}(key: String, value: Nothing?) | {{else}} -default T {{methodName}}(String key, Nothing? value) throws InvalidAdditionalPropertyException { - MapUtils.throwIfKeyKnown(key, getKnownKeys(), true); - var instance = getInstance(); - instance.put(key, null); - return {{getBuilderMethod}}(instance); +@Throws(InvalidAdditionalPropertyException::class) +fun {{methodName}}(key: String, value: Nothing?): T { + MapUtils.throwIfKeyKnown(key, getKnownKeys(), true) + val instance = getInstance() + instance[key] = null + return {{getBuilderMethod}}(instance) } {{/if}} {{else}} {{#eq this "boolean"}} {{#if forDocs }} -| [{{builderClass.pascalCase}}](#{{builderClass.kebabCase}}) | {{methodName}}(String key, boolean value) | +| [{{builderClass.pascalCase}}](#{{builderClass.kebabCase}}) | {{methodName}}(key: String, value: Boolean) | {{else}} -default T {{methodName}}(String key, boolean value) throws InvalidAdditionalPropertyException { - MapUtils.throwIfKeyKnown(key, getKnownKeys(), true); - var instance = getInstance(); - instance.put(key, value); - return {{getBuilderMethod}}(instance); +@Throws(InvalidAdditionalPropertyException::class) +fun {{methodName}}(key: String, value: Boolean): T { + MapUtils.throwIfKeyKnown(key, getKnownKeys(), true) + val instance = getInstance() + instance[key] = value + return {{getBuilderMethod}}(instance) } {{/if}} {{else}} {{#eq this "string"}} {{#if forDocs }} -| [{{builderClass.pascalCase}}](#{{builderClass.kebabCase}}) | {{methodName}}(String key, String value) | +| [{{builderClass.pascalCase}}](#{{builderClass.kebabCase}}) | {{methodName}}(key: String, value: String) | {{else}} -default T {{methodName}}(String key, String value) throws InvalidAdditionalPropertyException { - MapUtils.throwIfKeyKnown(key, getKnownKeys(), true); - var instance = getInstance(); - instance.put(key, value); - return {{getBuilderMethod}}(instance); +@Throws(InvalidAdditionalPropertyException::class) +fun {{methodName}}(key: String, value: String): T { + MapUtils.throwIfKeyKnown(key, getKnownKeys(), true) + val instance = getInstance() + instance[key] = value + return {{getBuilderMethod}}(instance) } {{/if}} {{else}} {{#or (eq this "integer") (eq this "number") }} {{#if forDocs }} -| [{{builderClass.pascalCase}}](#{{builderClass.kebabCase}}) | {{methodName}}(String key, int value) | -| [{{builderClass.pascalCase}}](#{{builderClass.kebabCase}}) | {{methodName}}(String key, float value) | +| [{{builderClass.pascalCase}}](#{{builderClass.kebabCase}}) | {{methodName}}(key: String, value: Int) | +| [{{builderClass.pascalCase}}](#{{builderClass.kebabCase}}) | {{methodName}}(key: String, value: Float) | {{#neq ../format "int32"}} -| [{{builderClass.pascalCase}}](#{{builderClass.kebabCase}}) | {{methodName}}(String key, long value) | -| [{{builderClass.pascalCase}}](#{{builderClass.kebabCase}}) | {{methodName}}(String key, double value) | +| [{{builderClass.pascalCase}}](#{{builderClass.kebabCase}}) | {{methodName}}(key: String, value: Long) | +| [{{builderClass.pascalCase}}](#{{builderClass.kebabCase}}) | {{methodName}}(key: String, value: Double) | {{/neq}} {{else}} -default T {{methodName}}(String key, int value) throws InvalidAdditionalPropertyException { - MapUtils.throwIfKeyKnown(key, getKnownKeys(), true); - var instance = getInstance(); - instance.put(key, value); - return {{getBuilderMethod}}(instance); +@Throws(InvalidAdditionalPropertyException::class) +fun {{methodName}}(key: String, value: Int): T { + MapUtils.throwIfKeyKnown(key, getKnownKeys(), true) + val instance = getInstance() + instance[key] = value + return {{getBuilderMethod}}(instance) } -default T {{methodName}}(String key, float value) throws InvalidAdditionalPropertyException { - MapUtils.throwIfKeyKnown(key, getKnownKeys(), true); - var instance = getInstance(); - instance.put(key, value); - return {{getBuilderMethod}}(instance); +@Throws(InvalidAdditionalPropertyException::class) +fun {{methodName}}(key: String, value: Float): T { + MapUtils.throwIfKeyKnown(key, getKnownKeys(), true) + val instance = getInstance() + instance[key] = value + return {{getBuilderMethod}}(instance) } {{#neq ../format "int32"}} -default T {{methodName}}(String key, long value) throws InvalidAdditionalPropertyException { - MapUtils.throwIfKeyKnown(key, getKnownKeys(), true); - var instance = getInstance(); - instance.put(key, value); - return {{getBuilderMethod}}(instance); +@Throws(InvalidAdditionalPropertyException::class) +fun {{methodName}}(key: String, value: Long): T { + MapUtils.throwIfKeyKnown(key, getKnownKeys(), true) + val instance = getInstance() + instance[key] = value + return {{getBuilderMethod}}(instance) } -default T {{methodName}}(String key, double value) throws InvalidAdditionalPropertyException { - MapUtils.throwIfKeyKnown(key, getKnownKeys(), true); - var instance = getInstance(); - instance.put(key, value); - return {{getBuilderMethod}}(instance); +@Throws(InvalidAdditionalPropertyException::class) +fun {{methodName}}(key: String, value: Double): T { + MapUtils.throwIfKeyKnown(key, getKnownKeys(), true) + val instance = getInstance() + instance[key] = value + return {{getBuilderMethod}}(instance) } {{/neq}} {{/if}} {{else}} {{#eq this "array"}} {{#if forDocs }} -| [{{builderClass.pascalCase}}](#{{builderClass.kebabCase}}) | {{methodName}}(String key, List<{{#with items}}{{> src/main/kotlin/packagename/components/schemas/types/schema_input_type sourceJsonPath=../jsonPath forceNull=true noExtends=true }}{{else}}@Nullable Object{{/with}}> value) | +| [{{builderClass.pascalCase}}](#{{builderClass.kebabCase}}) | {{methodName}}(key: String, value: List<{{#with items}}{{> src/main/kotlin/packagename/components/schemas/types/schema_input_type sourceJsonPath=../jsonPath forceNull=true noExtends=true }}{{else}}Any?{{/with}}>) | {{else}} -default T {{methodName}}(String key, List<{{#with items}}{{> src/main/kotlin/packagename/components/schemas/types/schema_input_type sourceJsonPath=../jsonPath forceNull=true noExtends=true }}{{else}}@Nullable Object{{/with}}> value) throws InvalidAdditionalPropertyException { - MapUtils.throwIfKeyKnown(key, getKnownKeys(), true); - var instance = getInstance(); - instance.put(key, value); - return {{getBuilderMethod}}(instance); +@Throws(InvalidAdditionalPropertyException::class) +fun {{methodName}}(key: String, value: List<{{#with items}}{{> src/main/kotlin/packagename/components/schemas/types/schema_input_type sourceJsonPath=../jsonPath forceNull=true noExtends=true }}{{else}}Any?{{/with}}>): T { + MapUtils.throwIfKeyKnown(key, getKnownKeys(), true) + val instance = getInstance() + instance[key] = value + return {{getBuilderMethod}}(instance) } {{/if}} {{else}} {{#eq this "object"}} {{#if forDocs }} -| [{{builderClass.pascalCase}}](#{{builderClass.kebabCase}}) | {{methodName}}(String key, Map src/main/kotlin/packagename/components/schemas/types/schema_input_type sourceJsonPath=../jsonPath forceNull=true noExtends=true }}{{else}}@Nullable Object{{/with}}> value) | +| [{{builderClass.pascalCase}}](#{{builderClass.kebabCase}}) | {{methodName}}(key: String, value: Map src/main/kotlin/packagename/components/schemas/types/schema_input_type sourceJsonPath=../jsonPath forceNull=true noExtends=true }}{{else}}Any?{{/with}}>) | {{else}} -default T {{methodName}}(String key, Map src/main/kotlin/packagename/components/schemas/types/schema_input_type sourceJsonPath=../jsonPath forceNull=true noExtends=true }}{{else}}@Nullable Object{{/with}}> value) throws InvalidAdditionalPropertyException { - MapUtils.throwIfKeyKnown(key, getKnownKeys(), true); - var instance = getInstance(); - instance.put(key, value); - return {{getBuilderMethod}}(instance); +@Throws(InvalidAdditionalPropertyException::class) +fun {{methodName}}(key: String, value: Map src/main/kotlin/packagename/components/schemas/types/schema_input_type sourceJsonPath=../jsonPath forceNull=true noExtends=true }}{{else}}Any?{{/with}}>): T { + MapUtils.throwIfKeyKnown(key, getKnownKeys(), true) + val instance = getInstance() + instance[key] = value + return {{getBuilderMethod}}(instance) } {{/if}} {{/eq}} @@ -128,67 +137,76 @@ default T {{methodName}}(String key, Map src {{> src/main/kotlin/packagename/components/schemas/_objectInputAddPropUnsetSetterDocs }} {{else}} -default T {{methodName}}(String key, Nothing? value) throws InvalidAdditionalPropertyException { - MapUtils.throwIfKeyKnown(key, getKnownKeys(), true); - var instance = getInstance(); - instance.put(key, null); - return {{getBuilderMethod}}(instance); +@Throws(InvalidAdditionalPropertyException::class) +fun {{methodName}}(key: String, value: Nothing?): T { + MapUtils.throwIfKeyKnown(key, getKnownKeys(), true) + val instance = getInstance() + instance[key] = null + return {{getBuilderMethod}}(instance) } -default T {{methodName}}(String key, boolean value) throws InvalidAdditionalPropertyException { - MapUtils.throwIfKeyKnown(key, getKnownKeys(), true); - var instance = getInstance(); - instance.put(key, value); - return {{getBuilderMethod}}(instance); +@Throws(InvalidAdditionalPropertyException::class) +fun {{methodName}}(key: String, value: Boolean): T { + MapUtils.throwIfKeyKnown(key, getKnownKeys(), true) + val instance = getInstance() + instance[key] = value + return {{getBuilderMethod}}(instance) } -default T {{methodName}}(String key, String value) throws InvalidAdditionalPropertyException { - MapUtils.throwIfKeyKnown(key, getKnownKeys(), true); - var instance = getInstance(); - instance.put(key, value); - return {{getBuilderMethod}}(instance); +@Throws(InvalidAdditionalPropertyException::class) +fun {{methodName}}(key: String, value: String): T { + MapUtils.throwIfKeyKnown(key, getKnownKeys(), true) + val instance = getInstance() + instance[key] = value + return {{getBuilderMethod}}(instance) } -default T {{methodName}}(String key, int value) throws InvalidAdditionalPropertyException { - MapUtils.throwIfKeyKnown(key, getKnownKeys(), true); - var instance = getInstance(); - instance.put(key, value); - return {{getBuilderMethod}}(instance); +@Throws(InvalidAdditionalPropertyException::class) +fun {{methodName}}(key: String, value: Int): T { + MapUtils.throwIfKeyKnown(key, getKnownKeys(), true) + val instance = getInstance() + instance[key] = value + return {{getBuilderMethod}}(instance) } -default T {{methodName}}(String key, float value) throws InvalidAdditionalPropertyException { - MapUtils.throwIfKeyKnown(key, getKnownKeys(), true); - var instance = getInstance(); - instance.put(key, value); - return {{getBuilderMethod}}(instance); +@Throws(InvalidAdditionalPropertyException::class) +fun {{methodName}}(key: String, value: Float): T { + MapUtils.throwIfKeyKnown(key, getKnownKeys(), true) + val instance = getInstance() + instance[key] = value + return {{getBuilderMethod}}(instance) } -default T {{methodName}}(String key, long value) throws InvalidAdditionalPropertyException { - MapUtils.throwIfKeyKnown(key, getKnownKeys(), true); - var instance = getInstance(); - instance.put(key, value); - return {{getBuilderMethod}}(instance); +@Throws(InvalidAdditionalPropertyException::class) +fun {{methodName}}(key: String, value: Long): T { + MapUtils.throwIfKeyKnown(key, getKnownKeys(), true) + val instance = getInstance() + instance[key] = value + return {{getBuilderMethod}}(instance) } -default T {{methodName}}(String key, double value) throws InvalidAdditionalPropertyException { - MapUtils.throwIfKeyKnown(key, getKnownKeys(), true); - var instance = getInstance(); - instance.put(key, value); - return {{getBuilderMethod}}(instance); +@Throws(InvalidAdditionalPropertyException::class) +fun {{methodName}}(key: String, value: Double): T { + MapUtils.throwIfKeyKnown(key, getKnownKeys(), true) + val instance = getInstance() + instance[key] = value + return {{getBuilderMethod}}(instance) } -default T {{methodName}}(String key, List value) throws InvalidAdditionalPropertyException { - MapUtils.throwIfKeyKnown(key, getKnownKeys(), true); - var instance = getInstance(); - instance.put(key, value); - return {{getBuilderMethod}}(instance); +@Throws(InvalidAdditionalPropertyException::class) +fun {{methodName}}(key: String, value: List): T { + MapUtils.throwIfKeyKnown(key, getKnownKeys(), true) + val instance = getInstance() + instance[key] = value + return {{getBuilderMethod}}(instance) } -default T {{methodName}}(String key, Map value) throws InvalidAdditionalPropertyException { - MapUtils.throwIfKeyKnown(key, getKnownKeys(), true); - var instance = getInstance(); - instance.put(key, value); - return {{getBuilderMethod}}(instance); +@Throws(InvalidAdditionalPropertyException::class) +fun {{methodName}}(key: String, value: Map): T { + MapUtils.throwIfKeyKnown(key, getKnownKeys(), true) + val instance = getInstance() + instance[key] = value + return {{getBuilderMethod}}(instance) } {{/if}} {{/each}} @@ -197,119 +215,126 @@ default T {{methodName}}(String key, Map value) throws InvalidAdditio {{#eq @key "null"}} {{#if forDocs }} {{#if useContainer }} -| [{{builderClass.pascalCase}}](#{{builderClass.kebabCase}}) | {{methodName}}(String key, [{{../../containerJsonPathPiece.pascalCase}}.Null{{../jsonPathPiece.pascalCase}}]({{docRoot}}{{pathFromDocRoot}}.md#null{{../jsonPathPiece.kebabCase}}) value) | +| [{{builderClass.pascalCase}}](#{{builderClass.kebabCase}}) | {{methodName}}(key: String, value: [{{../../containerJsonPathPiece.pascalCase}}.Null{{../jsonPathPiece.pascalCase}}]({{docRoot}}{{pathFromDocRoot}}.md#null{{../jsonPathPiece.kebabCase}})) | {{else}} -| [{{builderClass.pascalCase}}](#{{builderClass.kebabCase}}) | {{methodName}}(String key, [Null{{../jsonPathPiece.pascalCase}}](#null{{../jsonPathPiece.kebabCase}}) value) | +| [{{builderClass.pascalCase}}](#{{builderClass.kebabCase}}) | {{methodName}}(key: String, value: [Null{{../jsonPathPiece.pascalCase}}](#null{{../jsonPathPiece.kebabCase}})) | {{/if}} {{else}} -default T {{methodName}}(String key, {{#if useContainer}}{{../../containerJsonPathPiece.pascalCase}}.{{/if}}Null{{../jsonPathPiece.pascalCase}} value) throws InvalidAdditionalPropertyException { - MapUtils.throwIfKeyKnown(key, getKnownKeys(), true); - var instance = getInstance(); - instance.put(key, null); - return {{getBuilderMethod}}(instance); +@Throws(InvalidAdditionalPropertyException::class) +fun {{methodName}}(key: String, value: {{#if useContainer}}{{../../containerJsonPathPiece.pascalCase}}.{{/if}}Null{{../jsonPathPiece.pascalCase}}): T { + MapUtils.throwIfKeyKnown(key, getKnownKeys(), true) + val instance = getInstance() + instance[key] = null + return {{getBuilderMethod}}(instance) } {{/if}} {{else}} {{#eq @key "boolean"}} {{#if forDocs }} {{#if useContainer }} -| [{{builderClass.pascalCase}}](#{{builderClass.kebabCase}}) | {{methodName}}(String key, [{{../../containerJsonPathPiece.pascalCase}}.Boolean{{../jsonPathPiece.pascalCase}}]({{docRoot}}{{pathFromDocRoot}}.md#boolean{{../jsonPathPiece.kebabCase}}) value) | +| [{{builderClass.pascalCase}}](#{{builderClass.kebabCase}}) | {{methodName}}(key: String, value: [{{../../containerJsonPathPiece.pascalCase}}.Boolean{{../jsonPathPiece.pascalCase}}]({{docRoot}}{{pathFromDocRoot}}.md#boolean{{../jsonPathPiece.kebabCase}})) | {{else}} -| [{{builderClass.pascalCase}}](#{{builderClass.kebabCase}}) | {{methodName}}(String key, [Boolean{{../jsonPathPiece.pascalCase}}](#boolean{{../jsonPathPiece.kebabCase}}) value) | +| [{{builderClass.pascalCase}}](#{{builderClass.kebabCase}}) | {{methodName}}(key: String, value: [Boolean{{../jsonPathPiece.pascalCase}}](#boolean{{../jsonPathPiece.kebabCase}})) | {{/if}} {{else}} -default T {{methodName}}(String key, {{#if useContainer}}{{../../containerJsonPathPiece.pascalCase}}.{{/if}}Boolean{{../jsonPathPiece.pascalCase}} value) throws InvalidAdditionalPropertyException { - MapUtils.throwIfKeyKnown(key, getKnownKeys(), true); - var instance = getInstance(); - instance.put(key, value.value()); - return {{getBuilderMethod}}(instance); +@Throws(InvalidAdditionalPropertyException::class) +fun {{methodName}}(key: String, value: {{#if useContainer}}{{../../containerJsonPathPiece.pascalCase}}.{{/if}}Boolean{{../jsonPathPiece.pascalCase}}): T { + MapUtils.throwIfKeyKnown(key, getKnownKeys(), true) + val instance = getInstance() + instance[key] = value.value() + return {{getBuilderMethod}}(instance) } {{/if}} {{else}} {{#eq @key "string"}} {{#if forDocs }} {{#if useContainer }} -| [{{builderClass.pascalCase}}](#{{builderClass.kebabCase}}) | {{methodName}}(String key, [{{../../containerJsonPathPiece.pascalCase}}.String{{../jsonPathPiece.pascalCase}}]({{docRoot}}{{pathFromDocRoot}}.md#string{{../jsonPathPiece.kebabCase}}) value) | +| [{{builderClass.pascalCase}}](#{{builderClass.kebabCase}}) | {{methodName}}(key: String, value: [{{../../containerJsonPathPiece.pascalCase}}.String{{../jsonPathPiece.pascalCase}}]({{docRoot}}{{pathFromDocRoot}}.md#string{{../jsonPathPiece.kebabCase}})) | {{else}} -| [{{builderClass.pascalCase}}](#{{builderClass.kebabCase}}) | {{methodName}}(String key, [String{{../jsonPathPiece.pascalCase}}](#string{{../jsonPathPiece.kebabCase}}) value) | +| [{{builderClass.pascalCase}}](#{{builderClass.kebabCase}}) | {{methodName}}(key: String, value: [String{{../jsonPathPiece.pascalCase}}](#string{{../jsonPathPiece.kebabCase}})) | {{/if}} {{else}} -default T {{methodName}}(String key, {{#if useContainer}}{{../../containerJsonPathPiece.pascalCase}}.{{/if}}String{{../jsonPathPiece.pascalCase}} value) throws InvalidAdditionalPropertyException { - MapUtils.throwIfKeyKnown(key, getKnownKeys(), true); - var instance = getInstance(); - instance.put(key, value.value()); - return {{getBuilderMethod}}(instance); +@Throws(InvalidAdditionalPropertyException::class) +fun {{methodName}}(key: String, value: {{#if useContainer}}{{../../containerJsonPathPiece.pascalCase}}.{{/if}}String{{../jsonPathPiece.pascalCase}}): T { + MapUtils.throwIfKeyKnown(key, getKnownKeys(), true) + val instance = getInstance() + instance[key] = value.value() + return {{getBuilderMethod}}(instance) } {{/if}} {{else}} {{#eq @key "Integer"}} {{#if forDocs }} {{#if useContainer }} -| [{{builderClass.pascalCase}}](#{{builderClass.kebabCase}}) | {{methodName}}(String key, [{{../../containerJsonPathPiece.pascalCase}}.Integer{{../jsonPathPiece.pascalCase}}]({{docRoot}}{{pathFromDocRoot}}.md#integer{{../jsonPathPiece.kebabCase}}) value) | +| [{{builderClass.pascalCase}}](#{{builderClass.kebabCase}}) | {{methodName}}(key: String, value: [{{../../containerJsonPathPiece.pascalCase}}.Integer{{../jsonPathPiece.pascalCase}}]({{docRoot}}{{pathFromDocRoot}}.md#integer{{../jsonPathPiece.kebabCase}})) | {{else}} -| [{{builderClass.pascalCase}}](#{{builderClass.kebabCase}}) | {{methodName}}(String key, [Integer{{../jsonPathPiece.pascalCase}}](#integer{{../jsonPathPiece.kebabCase}}) value) | +| [{{builderClass.pascalCase}}](#{{builderClass.kebabCase}}) | {{methodName}}(key: String, value: [Integer{{../jsonPathPiece.pascalCase}}](#integer{{../jsonPathPiece.kebabCase}})) | {{/if}} {{else}} -default T {{methodName}}(String key, {{#if useContainer}}{{../../containerJsonPathPiece.pascalCase}}.{{/if}}Integer{{../jsonPathPiece.pascalCase}} value) throws InvalidAdditionalPropertyException { - MapUtils.throwIfKeyKnown(key, getKnownKeys(), true); - var instance = getInstance(); - instance.put(key, value.value()); - return {{getBuilderMethod}}(instance); +@Throws(InvalidAdditionalPropertyException::class) +fun {{methodName}}(key: String, value: {{#if useContainer}}{{../../containerJsonPathPiece.pascalCase}}.{{/if}}Integer{{../jsonPathPiece.pascalCase}}): T { + MapUtils.throwIfKeyKnown(key, getKnownKeys(), true) + val instance = getInstance() + instance[key] = value.value() + return {{getBuilderMethod}}(instance) } {{/if}} {{else}} {{#eq @key "Long"}} {{#if forDocs }} {{#if useContainer }} -| [{{builderClass.pascalCase}}](#{{builderClass.kebabCase}}) | {{methodName}}(String key, [{{../../containerJsonPathPiece.pascalCase}}.Long{{../jsonPathPiece.pascalCase}}]({{docRoot}}{{pathFromDocRoot}}.md#long{{../jsonPathPiece.kebabCase}}) value) | +| [{{builderClass.pascalCase}}](#{{builderClass.kebabCase}}) | {{methodName}}(key: String, value: [{{../../containerJsonPathPiece.pascalCase}}.Long{{../jsonPathPiece.pascalCase}}]({{docRoot}}{{pathFromDocRoot}}.md#long{{../jsonPathPiece.kebabCase}})) | {{else}} -| [{{builderClass.pascalCase}}](#{{builderClass.kebabCase}}) | {{methodName}}(String key, [Long{{../jsonPathPiece.pascalCase}}](#long{{../jsonPathPiece.kebabCase}}) value) | +| [{{builderClass.pascalCase}}](#{{builderClass.kebabCase}}) | {{methodName}}(key: String, value: [Long{{../jsonPathPiece.pascalCase}}](#long{{../jsonPathPiece.kebabCase}})) | {{/if}} {{else}} -default T {{methodName}}(String key, {{#if useContainer}}{{../../containerJsonPathPiece.pascalCase}}.{{/if}}Long{{../jsonPathPiece.pascalCase}} value) throws InvalidAdditionalPropertyException { - MapUtils.throwIfKeyKnown(key, getKnownKeys(), true); - var instance = getInstance(); - instance.put(key, value.value()); - return {{getBuilderMethod}}(instance); +@Throws(InvalidAdditionalPropertyException::class) +fun {{methodName}}(key: String, value: {{#if useContainer}}{{../../containerJsonPathPiece.pascalCase}}.{{/if}}Long{{../jsonPathPiece.pascalCase}}): T { + MapUtils.throwIfKeyKnown(key, getKnownKeys(), true) + val instance = getInstance() + instance[key] = value.value() + return {{getBuilderMethod}}(instance) } {{/if}} {{else}} {{#eq @key "Float"}} {{#if forDocs }} {{#if useContainer }} -| [{{builderClass.pascalCase}}](#{{builderClass.kebabCase}}) | {{methodName}}(String key, [{{../../containerJsonPathPiece.pascalCase}}.Float{{../jsonPathPiece.pascalCase}}]({{docRoot}}{{pathFromDocRoot}}.md#float{{../jsonPathPiece.kebabCase}}) value) | +| [{{builderClass.pascalCase}}](#{{builderClass.kebabCase}}) | {{methodName}}(key: String, value: [{{../../containerJsonPathPiece.pascalCase}}.Float{{../jsonPathPiece.pascalCase}}]({{docRoot}}{{pathFromDocRoot}}.md#float{{../jsonPathPiece.kebabCase}})) | {{else}} -| [{{builderClass.pascalCase}}](#{{builderClass.kebabCase}}) | {{methodName}}(String key, [Float{{../jsonPathPiece.pascalCase}}](#float{{../jsonPathPiece.kebabCase}}) value) | +| [{{builderClass.pascalCase}}](#{{builderClass.kebabCase}}) | {{methodName}}(key: String, value: [Float{{../jsonPathPiece.pascalCase}}](#float{{../jsonPathPiece.kebabCase}})) | {{/if}} {{else}} -default T {{methodName}}(String key, {{#if useContainer}}{{../../containerJsonPathPiece.pascalCase}}.{{/if}}Float{{../jsonPathPiece.pascalCase}} value) throws InvalidAdditionalPropertyException { - MapUtils.throwIfKeyKnown(key, getKnownKeys(), true); - var instance = getInstance(); - instance.put(key, value.value()); - return {{getBuilderMethod}}(instance); +@Throws(InvalidAdditionalPropertyException::class) +fun {{methodName}}(key: String, value: {{#if useContainer}}{{../../containerJsonPathPiece.pascalCase}}.{{/if}}Float{{../jsonPathPiece.pascalCase}}): T { + MapUtils.throwIfKeyKnown(key, getKnownKeys(), true) + val instance = getInstance() + instance[key] = value.value() + return {{getBuilderMethod}}(instance) } {{/if}} {{else}} {{#eq @key "Double"}} {{#if forDocs }} {{#if useContainer }} -| [{{builderClass.pascalCase}}](#{{builderClass.kebabCase}}) | {{methodName}}(String key, [{{../../containerJsonPathPiece.pascalCase}}.Double{{../jsonPathPiece.pascalCase}}]({{docRoot}}{{pathFromDocRoot}}.md#double{{../jsonPathPiece.kebabCase}}) value) | +| [{{builderClass.pascalCase}}](#{{builderClass.kebabCase}}) | {{methodName}}(key: String, value: [{{../../containerJsonPathPiece.pascalCase}}.Double{{../jsonPathPiece.pascalCase}}]({{docRoot}}{{pathFromDocRoot}}.md#double{{../jsonPathPiece.kebabCase}})) | {{else}} -| [{{builderClass.pascalCase}}](#{{builderClass.kebabCase}}) | {{methodName}}(String key, [Double{{../jsonPathPiece.pascalCase}}](#double{{../jsonPathPiece.kebabCase}}) value) | +| [{{builderClass.pascalCase}}](#{{builderClass.kebabCase}}) | {{methodName}}(key: String, value: [Double{{../jsonPathPiece.pascalCase}}](#double{{../jsonPathPiece.kebabCase}})) | {{/if}} {{else}} -default T {{methodName}}(String key, {{#if useContainer}}{{../../containerJsonPathPiece.pascalCase}}.{{/if}}Double{{../jsonPathPiece.pascalCase}} value) throws InvalidAdditionalPropertyException { - MapUtils.throwIfKeyKnown(key, getKnownKeys(), true); - var instance = getInstance(); - instance.put(key, value.value()); - return {{getBuilderMethod}}(instance); +@Throws(InvalidAdditionalPropertyException::class) +fun {{methodName}}(key: String, value: {{#if useContainer}}{{../../containerJsonPathPiece.pascalCase}}.{{/if}}Double{{../jsonPathPiece.pascalCase}}): T { + MapUtils.throwIfKeyKnown(key, getKnownKeys(), true) + val instance = getInstance() + instance[key] = value.value() + return {{getBuilderMethod}}(instance) } {{/if}} {{/eq}} diff --git a/src/main/resources/kotlin/src/main/kotlin/packagename/components/schemas/_objectInputAddPropUnsetSetterDocs.hbs b/src/main/resources/kotlin/src/main/kotlin/packagename/components/schemas/_objectInputAddPropUnsetSetterDocs.hbs index b46a8d52f51..8c7c994aceb 100644 --- a/src/main/resources/kotlin/src/main/kotlin/packagename/components/schemas/_objectInputAddPropUnsetSetterDocs.hbs +++ b/src/main/resources/kotlin/src/main/kotlin/packagename/components/schemas/_objectInputAddPropUnsetSetterDocs.hbs @@ -1,9 +1,9 @@ -| [{{builderClass.pascalCase}}](#{{builderClass.kebabCase}}) | {{methodName}}(String key, Nothing? value) | -| [{{builderClass.pascalCase}}](#{{builderClass.kebabCase}}) | {{methodName}}(String key, boolean value) | -| [{{builderClass.pascalCase}}](#{{builderClass.kebabCase}}) | {{methodName}}(String key, String value) | -| [{{builderClass.pascalCase}}](#{{builderClass.kebabCase}}) | {{methodName}}(String key, int value) | -| [{{builderClass.pascalCase}}](#{{builderClass.kebabCase}}) | {{methodName}}(String key, float value) | -| [{{builderClass.pascalCase}}](#{{builderClass.kebabCase}}) | {{methodName}}(String key, long value) | -| [{{builderClass.pascalCase}}](#{{builderClass.kebabCase}}) | {{methodName}}(String key, double value) | -| [{{builderClass.pascalCase}}](#{{builderClass.kebabCase}}) | {{methodName}}(String key, List value) | -| [{{builderClass.pascalCase}}](#{{builderClass.kebabCase}}) | {{methodName}}(String key, Map value) | +| [{{builderClass.pascalCase}}](#{{builderClass.kebabCase}}) | {{methodName}}(key: String, value: Nothing?) | +| [{{builderClass.pascalCase}}](#{{builderClass.kebabCase}}) | {{methodName}}(key: String, value: Boolean) | +| [{{builderClass.pascalCase}}](#{{builderClass.kebabCase}}) | {{methodName}}(key: String, value: String) | +| [{{builderClass.pascalCase}}](#{{builderClass.kebabCase}}) | {{methodName}}(key: String, value: Int) | +| [{{builderClass.pascalCase}}](#{{builderClass.kebabCase}}) | {{methodName}}(key: String, value: Float) | +| [{{builderClass.pascalCase}}](#{{builderClass.kebabCase}}) | {{methodName}}(key: String, value: Long) | +| [{{builderClass.pascalCase}}](#{{builderClass.kebabCase}}) | {{methodName}}(key: String, value: Double) | +| [{{builderClass.pascalCase}}](#{{builderClass.kebabCase}}) | {{methodName}}(key: String, value: List) | +| [{{builderClass.pascalCase}}](#{{builderClass.kebabCase}}) | {{methodName}}(key: String, value: Map) | diff --git a/src/main/resources/kotlin/src/main/kotlin/packagename/components/schemas/_objectInputSetter.hbs b/src/main/resources/kotlin/src/main/kotlin/packagename/components/schemas/_objectInputSetter.hbs index 0f5c229429a..f3ebe457dd1 100644 --- a/src/main/resources/kotlin/src/main/kotlin/packagename/components/schemas/_objectInputSetter.hbs +++ b/src/main/resources/kotlin/src/main/kotlin/packagename/components/schemas/_objectInputSetter.hbs @@ -13,98 +13,98 @@ {{#each types}} {{#eq this "null"}} {{#if forDocs }} -| [{{builderClass.pascalCase}}](#{{builderClass.kebabCase}}) | {{methodName}}(Nothing? value) | +| [{{builderClass.pascalCase}}](#{{builderClass.kebabCase}}) | {{methodName}}(value: Nothing?) | {{else}} -default T {{methodName}}(Nothing? value) { - var instance = getInstance(); - instance.put("{{{key}}}", null); - return {{getBuilderMethod}}(instance); +fun {{methodName}}(value: Nothing?): T { + val instance = getInstance() + instance["{{{key}}}"] = null + return {{getBuilderMethod}}(instance) } {{/if}} {{else}} {{#eq this "boolean"}} {{#if forDocs }} -| [{{builderClass.pascalCase}}](#{{builderClass.kebabCase}}) | {{methodName}}(boolean value) | +| [{{builderClass.pascalCase}}](#{{builderClass.kebabCase}}) | {{methodName}}(value: Boolean) | {{else}} -default T {{methodName}}(boolean value) { - var instance = getInstance(); - instance.put("{{{key}}}", value); - return {{getBuilderMethod}}(instance); +fun {{methodName}}(value: Boolean): T { + val instance = getInstance() + instance["{{{key}}}"] = value + return {{getBuilderMethod}}(instance) } {{/if}} {{else}} {{#eq this "string"}} {{#if forDocs }} -| [{{builderClass.pascalCase}}](#{{builderClass.kebabCase}}) | {{methodName}}(String value) | +| [{{builderClass.pascalCase}}](#{{builderClass.kebabCase}}) | {{methodName}}(value: String) | {{else}} -default T {{methodName}}(String value) { - var instance = getInstance(); - instance.put("{{{key}}}", value); - return {{getBuilderMethod}}(instance); +fun {{methodName}}(value: String): T { + val instance = getInstance() + instance["{{{key}}}"] = value + return {{getBuilderMethod}}(instance) } {{/if}} {{else}} {{#or (eq this "integer") (eq this "number") }} {{#if forDocs }} -| [{{builderClass.pascalCase}}](#{{builderClass.kebabCase}}) | {{methodName}}(int value) | -| [{{builderClass.pascalCase}}](#{{builderClass.kebabCase}}) | {{methodName}}(float value) | +| [{{builderClass.pascalCase}}](#{{builderClass.kebabCase}}) | {{methodName}}(value: Int) | +| [{{builderClass.pascalCase}}](#{{builderClass.kebabCase}}) | {{methodName}}(value: Float) | {{#neq ../format "int32"}} -| [{{builderClass.pascalCase}}](#{{builderClass.kebabCase}}) | {{methodName}}(long value) | -| [{{builderClass.pascalCase}}](#{{builderClass.kebabCase}}) | {{methodName}}(double value) | +| [{{builderClass.pascalCase}}](#{{builderClass.kebabCase}}) | {{methodName}}(value: Long) | +| [{{builderClass.pascalCase}}](#{{builderClass.kebabCase}}) | {{methodName}}(value: Double) | {{/neq}} {{else}} -default T {{methodName}}(int value) { - var instance = getInstance(); - instance.put("{{{key}}}", value); - return {{getBuilderMethod}}(instance); +fun {{methodName}}(value: Int): T { + val instance = getInstance() + instance["{{{key}}}"] = value + return {{getBuilderMethod}}(instance) } -default T {{methodName}}(float value) { - var instance = getInstance(); - instance.put("{{{key}}}", value); - return {{getBuilderMethod}}(instance); +fun {{methodName}}(value: Float): T { + val instance = getInstance() + instance["{{{key}}}"] = value + return {{getBuilderMethod}}(instance) } {{#neq ../format "int32"}} -default T {{methodName}}(long value) { - var instance = getInstance(); - instance.put("{{{key}}}", value); - return {{getBuilderMethod}}(instance); +fun {{methodName}}(value: Long): T { + val instance = getInstance() + instance["{{{key}}}"] = value + return {{getBuilderMethod}}(instance) } -default T {{methodName}}(double value) { - var instance = getInstance(); - instance.put("{{{key}}}", value); - return {{getBuilderMethod}}(instance); +fun {{methodName}}(value: Double): T { + val instance = getInstance() + instance["{{{key}}}"] = value + return {{getBuilderMethod}}(instance) } {{/neq}} {{/if}} {{else}} {{#eq this "array"}} {{#if forDocs }} -| [{{builderClass.pascalCase}}](#{{builderClass.kebabCase}}) | {{methodName}}(List<{{#with items}}{{> src/main/kotlin/packagename/components/schemas/types/schema_input_type sourceJsonPath=../jsonPath forceNull=true noExtends=true }}{{else}}@Nullable Object{{/with}}> value) | +| [{{builderClass.pascalCase}}](#{{builderClass.kebabCase}}) | {{methodName}}(value: List<{{#with items}}{{> src/main/kotlin/packagename/components/schemas/types/schema_input_type sourceJsonPath=../jsonPath forceNull=true noExtends=true }}{{else}}Any?{{/with}}>) | {{else}} -default T {{methodName}}(List<{{#with items}}{{> src/main/kotlin/packagename/components/schemas/types/schema_input_type sourceJsonPath=../jsonPath forceNull=true noExtends=true }}{{else}}@Nullable Object{{/with}}> value) { - var instance = getInstance(); - instance.put("{{{key}}}", value); - return {{getBuilderMethod}}(instance); +fun {{methodName}}(value: List<{{#with items}}{{> src/main/kotlin/packagename/components/schemas/types/schema_input_type sourceJsonPath=../jsonPath forceNull=true noExtends=true }}{{else}}Any?{{/with}}>): T { + val instance = getInstance() + instance["{{{key}}}"] = value + return {{getBuilderMethod}}(instance) } {{/if}} {{else}} {{#eq this "object"}} {{#if forDocs }} -| [{{builderClass.pascalCase}}](#{{builderClass.kebabCase}}) | {{methodName}}(Map src/main/kotlin/packagename/components/schemas/types/schema_input_type sourceJsonPath=../jsonPath forceNull=true noExtends=true }}{{else}}@Nullable Object{{/with}}> value) | +| [{{builderClass.pascalCase}}](#{{builderClass.kebabCase}}) | {{methodName}}(value: Map src/main/kotlin/packagename/components/schemas/types/schema_input_type sourceJsonPath=../jsonPath forceNull=true noExtends=true }}{{else}}Any?{{/with}}>) | {{else}} -default T {{methodName}}(Map src/main/kotlin/packagename/components/schemas/types/schema_input_type sourceJsonPath=../jsonPath forceNull=true noExtends=true }}{{else}}@Nullable Object{{/with}}> value) { - var instance = getInstance(); - instance.put("{{{key}}}", value); - return {{getBuilderMethod}}(instance); +fun {{methodName}}(value: Map src/main/kotlin/packagename/components/schemas/types/schema_input_type sourceJsonPath=../jsonPath forceNull=true noExtends=true }}{{else}}Any?{{/with}}>): T { + val instance = getInstance() + instance["{{{key}}}"] = value + return {{getBuilderMethod}}(instance) } {{/if}} {{/eq}} @@ -116,69 +116,69 @@ default T {{methodName}}(Map src/main/kotlin {{else}} {{! no type defined }} {{#if forDocs }} -| [{{builderClass.pascalCase}}](#{{builderClass.kebabCase}}) | {{methodName}}(Nothing? value) | -| [{{builderClass.pascalCase}}](#{{builderClass.kebabCase}}) | {{methodName}}(boolean value) | -| [{{builderClass.pascalCase}}](#{{builderClass.kebabCase}}) | {{methodName}}(String value) | -| [{{builderClass.pascalCase}}](#{{builderClass.kebabCase}}) | {{methodName}}(int value) | -| [{{builderClass.pascalCase}}](#{{builderClass.kebabCase}}) | {{methodName}}(float value) | -| [{{builderClass.pascalCase}}](#{{builderClass.kebabCase}}) | {{methodName}}(long value) | -| [{{builderClass.pascalCase}}](#{{builderClass.kebabCase}}) | {{methodName}}(double value) | -| [{{builderClass.pascalCase}}](#{{builderClass.kebabCase}}) | {{methodName}}(List value) | -| [{{builderClass.pascalCase}}](#{{builderClass.kebabCase}}) | {{methodName}}(Map value) | +| [{{builderClass.pascalCase}}](#{{builderClass.kebabCase}}) | {{methodName}}(value: Nothing?) | +| [{{builderClass.pascalCase}}](#{{builderClass.kebabCase}}) | {{methodName}}(value: Boolean) | +| [{{builderClass.pascalCase}}](#{{builderClass.kebabCase}}) | {{methodName}}(value: String) | +| [{{builderClass.pascalCase}}](#{{builderClass.kebabCase}}) | {{methodName}}(value: Int) | +| [{{builderClass.pascalCase}}](#{{builderClass.kebabCase}}) | {{methodName}}(value: Float) | +| [{{builderClass.pascalCase}}](#{{builderClass.kebabCase}}) | {{methodName}}(value: Long) | +| [{{builderClass.pascalCase}}](#{{builderClass.kebabCase}}) | {{methodName}}(value: Double) | +| [{{builderClass.pascalCase}}](#{{builderClass.kebabCase}}) | {{methodName}}(value: List) | +| [{{builderClass.pascalCase}}](#{{builderClass.kebabCase}}) | {{methodName}}(value: Map) | {{else}} -default T {{methodName}}(Nothing? value) { - var instance = getInstance(); - instance.put("{{{key}}}", null); - return {{getBuilderMethod}}(instance); +fun {{methodName}}(value: Nothing?): T { + val instance = getInstance() + instance["{{{key}}}"] = null + return {{getBuilderMethod}}(instance) } -default T {{methodName}}(boolean value) { - var instance = getInstance(); - instance.put("{{{key}}}", value); - return {{getBuilderMethod}}(instance); +fun {{methodName}}(value: Boolean): T { + val instance = getInstance() + instance["{{{key}}}"] = value + return {{getBuilderMethod}}(instance) } -default T {{methodName}}(String value) { - var instance = getInstance(); - instance.put("{{{key}}}", value); - return {{getBuilderMethod}}(instance); +fun {{methodName}}(value: String): T { + val instance = getInstance() + instance["{{{key}}}"] = value + return {{getBuilderMethod}}(instance) } -default T {{methodName}}(int value) { - var instance = getInstance(); - instance.put("{{{key}}}", value); - return {{getBuilderMethod}}(instance); +fun {{methodName}}(value: Int): T { + val instance = getInstance() + instance["{{{key}}}"] = value + return {{getBuilderMethod}}(instance) } -default T {{methodName}}(float value) { - var instance = getInstance(); - instance.put("{{{key}}}", value); - return {{getBuilderMethod}}(instance); +fun {{methodName}}(value: Float): T { + val instance = getInstance() + instance["{{{key}}}"] = value + return {{getBuilderMethod}}(instance) } -default T {{methodName}}(long value) { - var instance = getInstance(); - instance.put("{{{key}}}", value); - return {{getBuilderMethod}}(instance); +fun {{methodName}}(value: Long): T { + val instance = getInstance() + instance["{{{key}}}"] = value + return {{getBuilderMethod}}(instance) } -default T {{methodName}}(double value) { - var instance = getInstance(); - instance.put("{{{key}}}", value); - return {{getBuilderMethod}}(instance); +fun {{methodName}}(value: Double): T { + val instance = getInstance() + instance["{{{key}}}"] = value + return {{getBuilderMethod}}(instance) } -default T {{methodName}}(List value) { - var instance = getInstance(); - instance.put("{{{key}}}", value); - return {{getBuilderMethod}}(instance); +fun {{methodName}}(value: List): T { + val instance = getInstance() + instance["{{{key}}}"] = value + return {{getBuilderMethod}}(instance) } -default T {{methodName}}(Map value) { - var instance = getInstance(); - instance.put("{{{key}}}", value); - return {{getBuilderMethod}}(instance); +fun {{methodName}}(value: Map): T { + val instance = getInstance() + instance["{{{key}}}"] = value + return {{getBuilderMethod}}(instance) } {{/if}} {{/each}} @@ -187,112 +187,112 @@ default T {{methodName}}(Map value) { {{#eq @key "null"}} {{#if forDocs }} {{#if useContainer }} -| [{{builderClass.pascalCase}}](#{{builderClass.kebabCase}}) | {{methodName}}([{{../../containerJsonPathPiece.pascalCase}}.Null{{../jsonPathPiece.pascalCase}}]({{docRoot}}{{pathFromDocRoot}}.md#null{{../jsonPathPiece.kebabCase}}) value) | +| [{{builderClass.pascalCase}}](#{{builderClass.kebabCase}}) | {{methodName}}(value: [{{../../containerJsonPathPiece.pascalCase}}.Null{{../jsonPathPiece.pascalCase}}]({{docRoot}}{{pathFromDocRoot}}.md#null{{../jsonPathPiece.kebabCase}})) | {{else}} -| [{{builderClass.pascalCase}}](#{{builderClass.kebabCase}}) | {{methodName}}([Null{{../jsonPathPiece.pascalCase}}](#null{{../jsonPathPiece.kebabCase}}) value) | +| [{{builderClass.pascalCase}}](#{{builderClass.kebabCase}}) | {{methodName}}(value: [Null{{../jsonPathPiece.pascalCase}}](#null{{../jsonPathPiece.kebabCase}})) | {{/if}} {{else}} -default T {{methodName}}({{#if useContainer}}{{../../containerJsonPathPiece.pascalCase}}.{{/if}}Null{{../jsonPathPiece.pascalCase}} value) { - var instance = getInstance(); - instance.put("{{{key}}}", null); - return {{getBuilderMethod}}(instance); +fun {{methodName}}(value: {{#if useContainer}}{{../../containerJsonPathPiece.pascalCase}}.{{/if}}Null{{../jsonPathPiece.pascalCase}}): T { + val instance = getInstance() + instance["{{{key}}}"] = null + return {{getBuilderMethod}}(instance) } {{/if}} {{else}} {{#eq @key "boolean"}} {{#if forDocs }} {{#if useContainer }} -| [{{builderClass.pascalCase}}](#{{builderClass.kebabCase}}) | {{methodName}}([{{../../containerJsonPathPiece.pascalCase}}.Boolean{{../jsonPathPiece.pascalCase}}]({{docRoot}}{{pathFromDocRoot}}.md#boolean{{../jsonPathPiece.kebabCase}}) value) | +| [{{builderClass.pascalCase}}](#{{builderClass.kebabCase}}) | {{methodName}}(value: [{{../../containerJsonPathPiece.pascalCase}}.Boolean{{../jsonPathPiece.pascalCase}}]({{docRoot}}{{pathFromDocRoot}}.md#boolean{{../jsonPathPiece.kebabCase}})) | {{else}} -| [{{builderClass.pascalCase}}](#{{builderClass.kebabCase}}) | {{methodName}}([Boolean{{../jsonPathPiece.pascalCase}}](#boolean{{../jsonPathPiece.kebabCase}}) value) | +| [{{builderClass.pascalCase}}](#{{builderClass.kebabCase}}) | {{methodName}}(value: [Boolean{{../jsonPathPiece.pascalCase}}](#boolean{{../jsonPathPiece.kebabCase}})) | {{/if}} {{else}} -default T {{methodName}}({{#if useContainer}}{{../../containerJsonPathPiece.pascalCase}}.{{/if}}Boolean{{../jsonPathPiece.pascalCase}} value) { - var instance = getInstance(); - instance.put("{{{key}}}", value.value()); - return {{getBuilderMethod}}(instance); +fun {{methodName}}(value: {{#if useContainer}}{{../../containerJsonPathPiece.pascalCase}}.{{/if}}Boolean{{../jsonPathPiece.pascalCase}}): T { + val instance = getInstance() + instance["{{{key}}}"] = value.value() + return {{getBuilderMethod}}(instance) } {{/if}} {{else}} {{#eq @key "string"}} {{#if forDocs }} {{#if useContainer }} -| [{{builderClass.pascalCase}}](#{{builderClass.kebabCase}}) | {{methodName}}([{{../../containerJsonPathPiece.pascalCase}}.String{{../jsonPathPiece.pascalCase}}]({{docRoot}}{{pathFromDocRoot}}.md#string{{../jsonPathPiece.kebabCase}}) value) | +| [{{builderClass.pascalCase}}](#{{builderClass.kebabCase}}) | {{methodName}}(value: [{{../../containerJsonPathPiece.pascalCase}}.String{{../jsonPathPiece.pascalCase}}]({{docRoot}}{{pathFromDocRoot}}.md#string{{../jsonPathPiece.kebabCase}})) | {{else}} -| [{{builderClass.pascalCase}}](#{{builderClass.kebabCase}}) | {{methodName}}([String{{../jsonPathPiece.pascalCase}}](#string{{../jsonPathPiece.kebabCase}}) value) | +| [{{builderClass.pascalCase}}](#{{builderClass.kebabCase}}) | {{methodName}}(value: [String{{../jsonPathPiece.pascalCase}}](#string{{../jsonPathPiece.kebabCase}})) | {{/if}} {{else}} -default T {{methodName}}({{#if useContainer}}{{../../containerJsonPathPiece.pascalCase}}.{{/if}}String{{../jsonPathPiece.pascalCase}} value) { - var instance = getInstance(); - instance.put("{{{key}}}", value.value()); - return {{getBuilderMethod}}(instance); +fun {{methodName}}(value: {{#if useContainer}}{{../../containerJsonPathPiece.pascalCase}}.{{/if}}String{{../jsonPathPiece.pascalCase}}): T { + val instance = getInstance() + instance["{{{key}}}"] = value.value() + return {{getBuilderMethod}}(instance) } {{/if}} {{else}} {{#eq @key "Integer"}} {{#if forDocs }} {{#if useContainer }} -| [{{builderClass.pascalCase}}](#{{builderClass.kebabCase}}) | {{methodName}}([{{../../containerJsonPathPiece.pascalCase}}.Integer{{../jsonPathPiece.pascalCase}}]({{docRoot}}{{pathFromDocRoot}}.md#integer{{../jsonPathPiece.kebabCase}}) value) | +| [{{builderClass.pascalCase}}](#{{builderClass.kebabCase}}) | {{methodName}}(value: [{{../../containerJsonPathPiece.pascalCase}}.Integer{{../jsonPathPiece.pascalCase}}]({{docRoot}}{{pathFromDocRoot}}.md#integer{{../jsonPathPiece.kebabCase}})) | {{else}} -| [{{builderClass.pascalCase}}](#{{builderClass.kebabCase}}) | {{methodName}}([Integer{{../jsonPathPiece.pascalCase}}](#integer{{../jsonPathPiece.kebabCase}}) value) | +| [{{builderClass.pascalCase}}](#{{builderClass.kebabCase}}) | {{methodName}}(value: [Integer{{../jsonPathPiece.pascalCase}}](#integer{{../jsonPathPiece.kebabCase}})) | {{/if}} {{else}} -default T {{methodName}}({{#if useContainer}}{{../../containerJsonPathPiece.pascalCase}}.{{/if}}Integer{{../jsonPathPiece.pascalCase}} value) { - var instance = getInstance(); - instance.put("{{{key}}}", value.value()); - return {{getBuilderMethod}}(instance); +fun {{methodName}}(value: {{#if useContainer}}{{../../containerJsonPathPiece.pascalCase}}.{{/if}}Integer{{../jsonPathPiece.pascalCase}}): T { + val instance = getInstance() + instance["{{{key}}}"] = value.value() + return {{getBuilderMethod}}(instance) } {{/if}} {{else}} {{#eq @key "Long"}} {{#if forDocs }} {{#if useContainer }} -| [{{builderClass.pascalCase}}](#{{builderClass.kebabCase}}) | {{methodName}}([{{../../containerJsonPathPiece.pascalCase}}.Long{{../jsonPathPiece.pascalCase}}]({{docRoot}}{{pathFromDocRoot}}.md#long{{../jsonPathPiece.kebabCase}}) value) | +| [{{builderClass.pascalCase}}](#{{builderClass.kebabCase}}) | {{methodName}}(value: [{{../../containerJsonPathPiece.pascalCase}}.Long{{../jsonPathPiece.pascalCase}}]({{docRoot}}{{pathFromDocRoot}}.md#long{{../jsonPathPiece.kebabCase}})) | {{else}} -| [{{builderClass.pascalCase}}](#{{builderClass.kebabCase}}) | {{methodName}}([Long{{../jsonPathPiece.pascalCase}}](#long{{../jsonPathPiece.kebabCase}}) value) | +| [{{builderClass.pascalCase}}](#{{builderClass.kebabCase}}) | {{methodName}}(value: [Long{{../jsonPathPiece.pascalCase}}](#long{{../jsonPathPiece.kebabCase}})) | {{/if}} {{else}} -default T {{methodName}}({{#if useContainer}}{{../../containerJsonPathPiece.pascalCase}}.{{/if}}Long{{../jsonPathPiece.pascalCase}} value) { - var instance = getInstance(); - instance.put("{{{key}}}", value.value()); - return {{getBuilderMethod}}(instance); +fun {{methodName}}(value: {{#if useContainer}}{{../../containerJsonPathPiece.pascalCase}}.{{/if}}Long{{../jsonPathPiece.pascalCase}}): T { + val instance = getInstance() + instance["{{{key}}}"] = value.value() + return {{getBuilderMethod}}(instance) } {{/if}} {{else}} {{#eq @key "Float"}} {{#if forDocs }} {{#if useContainer }} -| [{{builderClass.pascalCase}}](#{{builderClass.kebabCase}}) | {{methodName}}([{{../../containerJsonPathPiece.pascalCase}}.Float{{../jsonPathPiece.pascalCase}}]({{docRoot}}{{pathFromDocRoot}}.md#float{{../jsonPathPiece.kebabCase}}) value) | +| [{{builderClass.pascalCase}}](#{{builderClass.kebabCase}}) | {{methodName}}(value: [{{../../containerJsonPathPiece.pascalCase}}.Float{{../jsonPathPiece.pascalCase}}]({{docRoot}}{{pathFromDocRoot}}.md#float{{../jsonPathPiece.kebabCase}})) | {{else}} -| [{{builderClass.pascalCase}}](#{{builderClass.kebabCase}}) | {{methodName}}([Float{{../jsonPathPiece.pascalCase}}](#float{{../jsonPathPiece.kebabCase}}) value) | +| [{{builderClass.pascalCase}}](#{{builderClass.kebabCase}}) | {{methodName}}(value: [Float{{../jsonPathPiece.pascalCase}}](#float{{../jsonPathPiece.kebabCase}})) | {{/if}} {{else}} -default T {{methodName}}({{#if useContainer}}{{../../containerJsonPathPiece.pascalCase}}.{{/if}}Float{{../jsonPathPiece.pascalCase}} value) { - var instance = getInstance(); - instance.put("{{{key}}}", value.value()); - return {{getBuilderMethod}}(instance); +fun {{methodName}}(value: {{#if useContainer}}{{../../containerJsonPathPiece.pascalCase}}.{{/if}}Float{{../jsonPathPiece.pascalCase}}): T { + val instance = getInstance() + instance["{{{key}}}"] = value.value() + return {{getBuilderMethod}}(instance) } {{/if}} {{else}} {{#eq @key "Double"}} {{#if forDocs }} {{#if useContainer }} -| [{{builderClass.pascalCase}}](#{{builderClass.kebabCase}}) | {{methodName}}([{{../../containerJsonPathPiece.pascalCase}}.Double{{../jsonPathPiece.pascalCase}}]({{docRoot}}{{pathFromDocRoot}}.md#double{{../jsonPathPiece.kebabCase}}) value) | +| [{{builderClass.pascalCase}}](#{{builderClass.kebabCase}}) | {{methodName}}(value: [{{../../containerJsonPathPiece.pascalCase}}.Double{{../jsonPathPiece.pascalCase}}]({{docRoot}}{{pathFromDocRoot}}.md#double{{../jsonPathPiece.kebabCase}})) | {{else}} -| [{{builderClass.pascalCase}}](#{{builderClass.kebabCase}}) | {{methodName}}([Double{{../jsonPathPiece.pascalCase}}](#double{{../jsonPathPiece.kebabCase}}) value) | +| [{{builderClass.pascalCase}}](#{{builderClass.kebabCase}}) | {{methodName}}(value: [Double{{../jsonPathPiece.pascalCase}}](#double{{../jsonPathPiece.kebabCase}})) | {{/if}} {{else}} -default T {{methodName}}({{#if useContainer}}{{../../containerJsonPathPiece.pascalCase}}.{{/if}}Double{{../jsonPathPiece.pascalCase}} value) { - var instance = getInstance(); - instance.put("{{{key}}}", value.value()); - return {{getBuilderMethod}}(instance); +fun {{methodName}}(value: {{#if useContainer}}{{../../containerJsonPathPiece.pascalCase}}.{{/if}}Double{{../jsonPathPiece.pascalCase}}): T { + val instance = getInstance() + instance["{{{key}}}"] = value.value() + return {{getBuilderMethod}}(instance) } {{/if}} {{/eq}} diff --git a/src/main/resources/kotlin/src/main/kotlin/packagename/components/schemas/_objectInputType.hbs b/src/main/resources/kotlin/src/main/kotlin/packagename/components/schemas/_objectInputType.hbs index 2153d9f6596..84272674bf9 100644 --- a/src/main/resources/kotlin/src/main/kotlin/packagename/components/schemas/_objectInputType.hbs +++ b/src/main/resources/kotlin/src/main/kotlin/packagename/components/schemas/_objectInputType.hbs @@ -1,8 +1,8 @@ {{#each requiredProperties}} -public interface SetterFor{{@key.pascalCase}} { - Map src/main/kotlin/packagename/components/schemas/types/schema_input_type sourceJsonPath=../../jsonPath forceNull=true noExtends=true }}{{else}}@Nullable Object{{/with}}> getInstance(); - T getBuilderAfter{{@key.pascalCase}}(Map src/main/kotlin/packagename/components/schemas/types/schema_input_type sourceJsonPath=../../jsonPath forceNull=true noExtends=true }}{{else}}@Nullable Object{{/with}}> instance); +interface SetterFor{{@key.pascalCase}} { + fun getInstance(): MutableMap src/main/kotlin/packagename/components/schemas/types/schema_input_type sourceJsonPath=../../jsonPath forceNull=true noExtends=true }}{{else}}Any?{{/with}}> + fun getBuilderAfter{{@key.pascalCase}}(instance: MutableMap src/main/kotlin/packagename/components/schemas/types/schema_input_type sourceJsonPath=../../jsonPath forceNull=true noExtends=true }}{{else}}Any?{{/with}}>): T {{#if @key.isValid}} {{> src/main/kotlin/packagename/components/schemas/_objectInputSetter methodName=@key.original getBuilderMethod=(join "getBuilderAfter" @key.pascalCase "") key=@key.original }} {{else}} @@ -12,9 +12,9 @@ public interface SetterFor{{@key.pascalCase}} { {{/each}} {{#each optionalProperties}} -public interface SetterFor{{@key.pascalCase}} { - Map src/main/kotlin/packagename/components/schemas/types/schema_input_type sourceJsonPath=../../jsonPath forceNull=true noExtends=true }}{{else}}@Nullable Object{{/with}}> getInstance(); - T getBuilderAfter{{@key.pascalCase}}(Map src/main/kotlin/packagename/components/schemas/types/schema_input_type sourceJsonPath=../../jsonPath forceNull=true noExtends=true }}{{else}}@Nullable Object{{/with}}> instance); +interface SetterFor{{@key.pascalCase}} { + fun getInstance(): MutableMap src/main/kotlin/packagename/components/schemas/types/schema_input_type sourceJsonPath=../../jsonPath forceNull=true noExtends=true }}{{else}}Any?{{/with}}> + fun getBuilderAfter{{@key.pascalCase}}(instance: MutableMap src/main/kotlin/packagename/components/schemas/types/schema_input_type sourceJsonPath=../../jsonPath forceNull=true noExtends=true }}{{else}}Any?{{/with}}>): T {{#if @key.isValid}} {{> src/main/kotlin/packagename/components/schemas/_objectInputSetter methodName=@key.original getBuilderMethod=(join "getBuilderAfter" @key.pascalCase "") key=@key.original }} {{else}} @@ -25,83 +25,79 @@ public interface SetterFor{{@key.pascalCase}} { {{#with additionalProperties }} {{#eq isBooleanSchemaFalse false}} -public interface SetterFor{{jsonPathPiece.pascalCase}} { - Set getKnownKeys(); - Map src/main/kotlin/packagename/components/schemas/types/schema_input_type sourceJsonPath=../../jsonPath forceNull=true noExtends=true }}{{else}}@Nullable Object{{/with}}> getInstance(); - T getBuilderAfterAdditionalProperty(Map src/main/kotlin/packagename/components/schemas/types/schema_input_type sourceJsonPath=../../jsonPath forceNull=true noExtends=true }}{{else}}@Nullable Object{{/with}}> instance); +interface SetterFor{{jsonPathPiece.pascalCase}} { + fun getKnownKeys(): Set + fun getInstance(): MutableMap src/main/kotlin/packagename/components/schemas/types/schema_input_type sourceJsonPath=../../jsonPath forceNull=true noExtends=true }}{{else}}Any?{{/with}}> + fun getBuilderAfterAdditionalProperty(instance: MutableMap src/main/kotlin/packagename/components/schemas/types/schema_input_type sourceJsonPath=../../jsonPath forceNull=true noExtends=true }}{{else}}Any?{{/with}}>): T {{> src/main/kotlin/packagename/components/schemas/_objectInputAddPropSetter methodName="additionalProperty" getBuilderMethod="getBuilderAfterAdditionalProperty" }} } {{/eq}} {{/with}} {{#each mapBuilders}} -public static class {{className.pascalCase}}{{#and @first (eq ../additionalProperties null) }} extends UnsetAddPropsSetter<{{className.pascalCase}}>{{/and}} implements {{#if @first}}GenericBuilder src/main/kotlin/packagename/components/schemas/types/schema_input_type sourceJsonPath=../../jsonPath forceNull=true noExtends=true }}{{else}}@Nullable Object{{/with}}>>{{#if ../optionalProperties}}, {{/if}}{{/if}}{{#each keyToBuilder}}SetterFor{{@key.pascalCase}}<{{builder.className.pascalCase}}>{{#unless @last}}, {{/unless}}{{/each}}{{#and @first ../additionalProperties (eq ../additionalProperties.isBooleanSchemaFalse false) }}, SetterFor{{../additionalProperties.jsonPathPiece.pascalCase}}<{{className.pascalCase}}>{{/and}} { - private final Map src/main/kotlin/packagename/components/schemas/types/schema_input_type sourceJsonPath=../../jsonPath forceNull=true noExtends=true }}{{else}}@Nullable Object{{/with}}> instance; +class {{className.pascalCase}}{{#unless @last }}(private val instance: MutableMap src/main/kotlin/packagename/components/schemas/types/schema_input_type sourceJsonPath=../../jsonPath forceNull=true noExtends=true }}{{else}}Any?{{/with}}>){{/unless}}: {{#and @first (eq ../additionalProperties null) }}UnsetAddPropsSetter<{{className.pascalCase}}>, {{/and}}{{#if @first}}GenericBuilder src/main/kotlin/packagename/components/schemas/types/schema_input_type sourceJsonPath=../../jsonPath forceNull=true noExtends=true }}{{else}}Any?{{/with}}>>{{#if ../optionalProperties}}, {{/if}}{{/if}}{{#each keyToBuilder}}SetterFor{{@key.pascalCase}}<{{builder.className.pascalCase}}>{{#unless @last}}, {{/unless}}{{/each}}{{#and @first ../additionalProperties (eq ../additionalProperties.isBooleanSchemaFalse false) }}, SetterFor{{../additionalProperties.jsonPathPiece.pascalCase}}<{{className.pascalCase}}>{{/and}} { {{#if @first}} {{#and (eq ../requiredProperties null) (eq ../optionalProperties null) }} - private static final Set knownKeys = Set.of(); + private val knownKeys: Set = setOf() {{else}} {{#eq ../optionalProperties null }} - private static final Set knownKeys = Set.of( + private val knownKeys: Set = setOf( {{#each ../requiredProperties}} "{{{@key.original}}}"{{#unless @last}},{{/unless}} {{/each}} - ); + ) {{else}} {{#eq ../requiredProperties null }} - private static final Set knownKeys = Set.of( + private val knownKeys: Set = setOf( {{#each ../optionalProperties}} "{{{@key.original}}}"{{#unless @last}},{{/unless}} {{/each}} - ); + ) {{else}} - private static final Set knownKeys = Set.of( + private val knownKeys: Set = setOf( {{#each ../requiredProperties}} "{{{@key.original}}}", {{/each}} {{#each ../optionalProperties}} "{{{@key.original}}}"{{#unless @last}},{{/unless}} {{/each}} - ); + ) {{/eq}} {{/eq}} {{/and}} - public Set getKnownKeys() { - return knownKeys; + override fun getKnownKeys(): Set { + return knownKeys } {{/if}} {{#if @last }} - public {{className.pascalCase}}() { - this.instance = new LinkedHashMap<>(); - } - {{else}} - public {{className.pascalCase}}(Map src/main/kotlin/packagename/components/schemas/types/schema_input_type sourceJsonPath=../../jsonPath forceNull=true noExtends=true }}{{else}}@Nullable Object{{/with}}> instance) { - this.instance = instance; + private val instance: MutableMap src/main/kotlin/packagename/components/schemas/types/schema_input_type sourceJsonPath=../../jsonPath forceNull=true noExtends=true }}{{else}}Any?{{/with}}> + init { + this.instance = LinkedHashMap() } {{/if}} {{#if @first}} - public Map src/main/kotlin/packagename/components/schemas/types/schema_input_type sourceJsonPath=../../jsonPath forceNull=true noExtends=true }}{{else}}@Nullable Object{{/with}}> build() { - return instance; + override fun build(): Map src/main/kotlin/packagename/components/schemas/types/schema_input_type sourceJsonPath=../../jsonPath forceNull=true noExtends=true }}{{else}}Any?{{/with}}> { + return instance } {{/if}} {{#or (eq keyToBuilder.isEmpty false) (and @first ../additionalProperties (eq ../additionalProperties.isBooleanSchemaFalse false)) (and @first (eq ../additionalProperties null)) }} - public Map src/main/kotlin/packagename/components/schemas/types/schema_input_type sourceJsonPath=../../jsonPath forceNull=true noExtends=true }}{{else}}@Nullable Object{{/with}}> getInstance() { - return instance; + override fun getInstance(): MutableMap src/main/kotlin/packagename/components/schemas/types/schema_input_type sourceJsonPath=../../jsonPath forceNull=true noExtends=true }}{{else}}Any?{{/with}}> { + return instance } {{/or}} {{#each keyToBuilder}} - public {{builder.className.pascalCase}} getBuilderAfter{{@key.pascalCase}}(Map src/main/kotlin/packagename/components/schemas/types/schema_input_type sourceJsonPath=../../jsonPath forceNull=true noExtends=true }}{{else}}@Nullable Object{{/with}}> instance) { + override fun getBuilderAfter{{@key.pascalCase}}(instance: MutableMap src/main/kotlin/packagename/components/schemas/types/schema_input_type sourceJsonPath=../../jsonPath forceNull=true noExtends=true }}{{else}}Any?{{/with}}>): {{builder.className.pascalCase}} { {{#eq builder ../this}} {{! property in final builder }} - return this; + return this {{else}} - return new {{builder.className.pascalCase}}(instance); + return {{builder.className.pascalCase}}(instance) {{/eq}} } {{/each}} {{#and @first (or (and ../additionalProperties (eq ../additionalProperties.isBooleanSchemaFalse false)) (eq ../additionalProperties null)) }} - public {{className.pascalCase}} getBuilderAfterAdditionalProperty(Map src/main/kotlin/packagename/components/schemas/types/schema_input_type sourceJsonPath=../../jsonPath forceNull=true noExtends=true }}{{else}}@Nullable Object{{/with}}> instance) { - return this; + override fun getBuilderAfterAdditionalProperty(instance: MutableMap src/main/kotlin/packagename/components/schemas/types/schema_input_type sourceJsonPath=../../jsonPath forceNull=true noExtends=true }}{{else}}Any?{{/with}}>): {{className.pascalCase}} { + return this } {{/and}} } diff --git a/src/main/resources/kotlin/src/main/kotlin/packagename/components/schemas/_objectOutputGetProperty.hbs b/src/main/resources/kotlin/src/main/kotlin/packagename/components/schemas/_objectOutputGetProperty.hbs index 458364ccdb3..5cb6133f8d1 100644 --- a/src/main/resources/kotlin/src/main/kotlin/packagename/components/schemas/_objectOutputGetProperty.hbs +++ b/src/main/resources/kotlin/src/main/kotlin/packagename/components/schemas/_objectOutputGetProperty.hbs @@ -1,31 +1,31 @@ {{#if required}} {{#and ../../mapValueSchema (eq typeSchema ../../mapValueSchema.typeSchema) }} {{#contains ../../mapValueSchema "null"}} -return get("{{{@key.original}}}"); +return get("{{{@key.original}}}") {{else}} try { - return getOrThrow("version"); -} catch (UnsetPropertyException e) { - throw new RuntimeException(e); + return getOrThrow("version") +} catch (e: UnsetPropertyException) { + throw RuntimeException(e) } {{/contains}} {{else}} -{{#with ../../mapValueSchema}}{{> src/main/kotlin/packagename/components/schemas/types/schema_output_type fullRefModule="" }}{{/with}} value = get("{{{@key.original}}}"); -if (!({{#contains types "null" }}value == null || {{/contains}}value instanceof {{> src/main/kotlin/packagename/components/schemas/types/schema_output_type fullRefModule="" forceNull=true noAnnotations=true }})) { - throw new RuntimeException("Invalid value stored for {{{@key.original}}}"); +val value: {{#with ../../mapValueSchema}}{{> src/main/kotlin/packagename/components/schemas/types/schema_output_type fullRefModule="" }}{{/with}} = get("{{{@key.original}}}") +if (!({{#contains types "null" }}value == null || {{/contains}}value is {{> src/main/kotlin/packagename/components/schemas/types/schema_output_type fullRefModule="" forceNull=true noAnnotations=true }})) { + throw RuntimeException("Invalid value stored for {{{@key.original}}}") } -return ({{> src/main/kotlin/packagename/components/schemas/types/schema_output_type fullRefModule="" }}) value; +return value {{/and}} {{else}} {{#and ../../mapValueSchema (eq typeSchema ../../mapValueSchema.typeSchema) }} -return getOrThrow("{{{@key.original}}}"); +return getOrThrow("{{{@key.original}}}") {{else}} -String key = "{{{@key.original}}}"; -throwIfKeyNotPresent(key); -{{#with ../../mapValueSchema}}{{> src/main/kotlin/packagename/components/schemas/types/schema_output_type fullRefModule="" }}{{/with}} value = get(key); -if (!({{#contains types "null" }}value == null || {{/contains}}value instanceof {{> src/main/kotlin/packagename/components/schemas/types/schema_output_type fullRefModule="" forceNull=true noAnnotations=true }})) { - throw new RuntimeException("Invalid value stored for {{{@key.original}}}"); +val key = "{{{@key.original}}}" +throwIfKeyNotPresent(key) +val value: {{#with ../../mapValueSchema}}{{> src/main/kotlin/packagename/components/schemas/types/schema_output_type fullRefModule="" }}{{/with}} = get(key) +if (!({{#contains types "null" }}value == null || {{/contains}}value is {{> src/main/kotlin/packagename/components/schemas/types/schema_output_type fullRefModule="" forceNull=true noAnnotations=true }})) { + throw RuntimeException("Invalid value stored for {{{@key.original}}}") } -return ({{> src/main/kotlin/packagename/components/schemas/types/schema_output_type fullRefModule="" }}) value; +return value {{/and}} {{/if}} diff --git a/src/main/resources/kotlin/src/main/kotlin/packagename/components/schemas/_objectOutputProperties.hbs b/src/main/resources/kotlin/src/main/kotlin/packagename/components/schemas/_objectOutputProperties.hbs index 8a6300a407e..d61685fcd72 100644 --- a/src/main/resources/kotlin/src/main/kotlin/packagename/components/schemas/_objectOutputProperties.hbs +++ b/src/main/resources/kotlin/src/main/kotlin/packagename/components/schemas/_objectOutputProperties.hbs @@ -4,19 +4,19 @@ {{#with this}} {{#if refInfo.refClass}} -public {{> src/main/kotlin/packagename/components/schemas/types/schema_output_type fullRefModule="" }} {{{@key.original}}}() { +fun {{{@key.original}}}(): {{> src/main/kotlin/packagename/components/schemas/types/schema_output_type fullRefModule="" }} { {{> src/main/kotlin/packagename/components/schemas/_objectOutputGetProperty required=true }} } {{else}} {{#if jsonPathPiece}} -public {{> src/main/kotlin/packagename/components/schemas/types/schema_output_type fullRefModule=null }} {{{@key.original}}}() { +fun {{{@key.original}}}(): {{> src/main/kotlin/packagename/components/schemas/types/schema_output_type fullRefModule=null }} { {{> src/main/kotlin/packagename/components/schemas/_objectOutputGetProperty required=true }} } {{else}} {{! for when additionalProperties is unset, use OUTPUT_BASE_TYPES }} -public @Nullable Object {{@key.original}}() { +fun {{@key.original}}(): Any? { {{> src/main/kotlin/packagename/components/schemas/_objectOutputGetProperty required=true }} } {{/if}} @@ -30,7 +30,8 @@ public @Nullable Object {{@key.original}}() { {{#if @key.isValid}} {{#with this}} -public {{> src/main/kotlin/packagename/components/schemas/types/schema_output_type }} {{{@key.original}}}() throws UnsetPropertyException { +@Throws(UnsetPropertyException::class) +fun {{{@key.original}}}(): {{> src/main/kotlin/packagename/components/schemas/types/schema_output_type }} { {{> src/main/kotlin/packagename/components/schemas/_objectOutputGetProperty required=false }} } {{/with}} @@ -39,38 +40,40 @@ public {{> src/main/kotlin/packagename/components/schemas/types/schema_output_ty {{/if}} {{#eq additionalProperties null }} -public @Nullable Object getAdditionalProperty(String name) throws UnsetPropertyException, InvalidAdditionalPropertyException { +@Throws(UnsetPropertyException::class, InvalidAdditionalPropertyException::class) +fun getAdditionalProperty(name: String): Any? { {{#or optionalProperties requiredProperties}} - throwIfKeyKnown(name, requiredKeys, optionalKeys); + throwIfKeyKnown(name, requiredKeys, optionalKeys) {{/or}} - throwIfKeyNotPresent(name); - return get(name); + throwIfKeyNotPresent(name) + return get(name) } {{else}} {{#with additionalProperties}} {{#unless isBooleanSchemaFalse}} -public {{> src/main/kotlin/packagename/components/schemas/types/schema_output_type }} getAdditionalProperty(String name) throws UnsetPropertyException{{#or ../optionalProperties ../requiredProperties}}, InvalidAdditionalPropertyException{{/or}} { +@Throws(UnsetPropertyException::class{{#or ../optionalProperties ../requiredProperties}}, InvalidAdditionalPropertyException::class{{/or}}) +fun getAdditionalProperty(name: String): {{> src/main/kotlin/packagename/components/schemas/types/schema_output_type }} { {{#or ../optionalProperties ../requiredProperties}} - throwIfKeyKnown(name, requiredKeys, optionalKeys); + throwIfKeyKnown(name, requiredKeys, optionalKeys) {{/or}} {{#and ../../mapValueSchema (eq typeSchema ../../mapValueSchema.typeSchema) }} {{#and (neq types null) (eq types.size 1) (contains types "boolean") }} - throwIfKeyNotPresent(name); - Boolean value = get(name); + throwIfKeyNotPresent(name) + val value: Boolean? = get(name) if (value == null) { - throw new RuntimeException("Value may not be null"); + throw RuntimeException("Value may not be null") } - return (boolean) value; + return value {{else}} - return getOrThrow(name); + return getOrThrow(name) {{/and}} {{else}} - var value = getOrThrow(name); - if (!({{#contains types "null" }}value == null || {{/contains}}value instanceof {{> src/main/kotlin/packagename/components/schemas/types/schema_output_type fullRefModule="" forceNull=true noAnnotations=true }})) { - throw new RuntimeException("Invalid value stored for " + name); + val value = getOrThrow(name) + if (!({{#contains types "null" }}value == null || {{/contains}}value is {{> src/main/kotlin/packagename/components/schemas/types/schema_output_type fullRefModule="" forceNull=true noAnnotations=true }})) { + throw RuntimeException("Invalid value stored for " + name) } - return ({{> src/main/kotlin/packagename/components/schemas/types/schema_output_type fullRefModule="" }}) value; + return value {{/and}} } {{/unless}} diff --git a/src/main/resources/kotlin/src/main/kotlin/packagename/components/schemas/_objectOutputType.hbs b/src/main/resources/kotlin/src/main/kotlin/packagename/components/schemas/_objectOutputType.hbs index ea9ed11fd31..3d814933cf2 100644 --- a/src/main/resources/kotlin/src/main/kotlin/packagename/components/schemas/_objectOutputType.hbs +++ b/src/main/resources/kotlin/src/main/kotlin/packagename/components/schemas/_objectOutputType.hbs @@ -1,51 +1,48 @@ {{#if mapValueSchema}} -public static class {{mapOutputJsonPathPiece.pascalCase}} extends FrozenMap<{{#with mapValueSchema}}{{> src/main/kotlin/packagename/components/schemas/types/schema_output_type forceNull=true }}{{/with}}> { - protected {{mapOutputJsonPathPiece.pascalCase}}(FrozenMap<{{#with mapValueSchema}}{{> src/main/kotlin/packagename/components/schemas/types/schema_output_type forceNull=true }}{{/with}}> m) { - super(m); - } +class {{mapOutputJsonPathPiece.pascalCase}}(m: FrozenMap<{{#with mapValueSchema}}{{> src/main/kotlin/packagename/components/schemas/types/schema_output_type forceNull=true }}{{/with}}>) : FrozenMap<{{#with mapValueSchema}}{{> src/main/kotlin/packagename/components/schemas/types/schema_output_type forceNull=true }}{{/with}}>(m) { {{else}} -public static class {{mapOutputJsonPathPiece.pascalCase}} extends FrozenMap<@Nullable Object> { - protected {{mapOutputJsonPathPiece.pascalCase}}(FrozenMap<@Nullable Object> m) { - super(m); - } +class {{mapOutputJsonPathPiece.pascalCase}}(m: FrozenMap): FrozenMap(m) { {{/if}} + companion object { {{#if requiredProperties}} - public static final Set requiredKeys = Set.of( - {{#each requiredProperties}} - "{{{@key.original}}}"{{#unless @last}},{{/unless}} - {{/each}} - ); + val requiredKeys: Set = setOf( + {{#each requiredProperties}} + "{{{@key.original}}}"{{#unless @last}},{{/unless}} + {{/each}} + ) {{else}} - public static final Set requiredKeys = Set.of(); + val requiredKeys: Set = setOf() {{/if}} {{#if optionalProperties}} - public static final Set optionalKeys = Set.of( + val optionalKeys: Set = setOf( {{#each optionalProperties}} - "{{{@key.original}}}"{{#unless @last}},{{/unless}} + "{{{@key.original}}}"{{#unless @last}},{{/unless}} {{/each}} - ); + ) {{else}} - public static final Set optionalKeys = Set.of(); + val optionalKeys: Set = setOf() {{/if}} {{#eq optionalProperties null}} {{#eq requiredProperties null}} {{#if additionalProperties}} {{#if additionalProperties.isBooleanSchemaFalse}} - // map with no key value pairs + // map with no key value pairs {{/if}} {{/if}} {{/eq}} {{/eq}} + @Throws(ValidationException::class) {{#if mapValueSchema}} - public static {{mapOutputJsonPathPiece.pascalCase}} of(Map src/main/kotlin/packagename/components/schemas/types/schema_input_type sourceJsonPath=../jsonPath forceNull=true }}{{/with}}> arg, SchemaConfiguration configuration) throws ValidationException { - return {{jsonPathPiece.pascalCase}}.getInstance().validate(arg, configuration); - } + fun of(arg: Map src/main/kotlin/packagename/components/schemas/types/schema_input_type sourceJsonPath=../jsonPath forceNull=true }}{{/with}}>, configuration: SchemaConfiguration): {{mapOutputJsonPathPiece.pascalCase}} { + return {{jsonPathPiece.pascalCase}}.getInstance().validate(arg, configuration) + } {{else}} - public static {{mapOutputJsonPathPiece.pascalCase}} of(Map arg, SchemaConfiguration configuration) throws ValidationException { - return {{jsonPathPiece.pascalCase}}.getInstance().validate(arg, configuration); - } + fun of(arg: Map, configuration: SchemaConfiguration): {{mapOutputJsonPathPiece.pascalCase}} { + return {{jsonPathPiece.pascalCase}}.getInstance().validate(arg, configuration) + } {{/if}} + } {{> src/main/kotlin/packagename/components/schemas/_objectOutputProperties }} } diff --git a/src/main/resources/kotlin/src/main/kotlin/packagename/components/schemas/docschema_arrayInput.hbs b/src/main/resources/kotlin/src/main/kotlin/packagename/components/schemas/docschema_arrayInput.hbs index a310abe7f42..56fac34c805 100644 --- a/src/main/resources/kotlin/src/main/kotlin/packagename/components/schemas/docschema_arrayInput.hbs +++ b/src/main/resources/kotlin/src/main/kotlin/packagename/components/schemas/docschema_arrayInput.hbs @@ -1,7 +1,7 @@ {{> src/main/kotlin/packagename/components/_helper_header_from_identifier_pieces headerSize=(join headerSize "#" "") identifierPieces=(append identifierPieces arrayInputJsonPathPiece) }} -public class {{arrayInputJsonPathPiece.pascalCase}}
-builder for `List<{{#with listItemSchema}}{{> src/main/kotlin/packagename/components/schemas/types/schema_input_type sourceJsonPath=../jsonPath forceNull=true noExtends=true }}{{else}}@Nullable Object{{/with}}>` +class {{arrayInputJsonPathPiece.pascalCase}}
+builder for `List<{{#with listItemSchema}}{{> src/main/kotlin/packagename/components/schemas/types/schema_input_type sourceJsonPath=../jsonPath forceNull=true noExtends=true }}{{else}}Any?{{/with}}>` A class that builds the List input type @@ -9,7 +9,7 @@ A class that builds the List input type | Constructor and Description | | --------------------------- | | {{arrayInputJsonPathPiece.pascalCase}}()
Creates an empty list | -| {{arrayInputJsonPathPiece.pascalCase}}(List<{{#with listItemSchema}}{{> src/main/kotlin/packagename/components/schemas/types/schema_input_type sourceJsonPath=../jsonPath forceNull=true noExtends=true }}{{else}}@Nullable Object{{/with}}> items)
Stores the items in a list | +| {{arrayInputJsonPathPiece.pascalCase}}(List<{{#with listItemSchema}}{{> src/main/kotlin/packagename/components/schemas/types/schema_input_type sourceJsonPath=../jsonPath forceNull=true noExtends=true }}{{else}}Any?{{/with}}> items)
Stores the items in a list | {{headerSize}}## Method Summary | Modifier and Type | Method and Description | @@ -22,7 +22,7 @@ A class that builds the List input type {{/with}} {{else}} {{! self reference} }} -| {{../arrayInputJsonPathPiece.pascalCase}} | add(List item) | +| {{../arrayInputJsonPathPiece.pascalCase}} | add(List<*> item) | {{/if}} {{else}} {{> src/main/kotlin/packagename/components/schemas/_arrayInputAddItem builderClass=../arrayInputJsonPathPiece.pascalCase forDocs=true }} @@ -30,4 +30,4 @@ A class that builds the List input type {{else}} {{! todo handle this, 3.1.0 document use-case }} {{/with}} -| List<{{#with listItemSchema}}{{> src/main/kotlin/packagename/components/schemas/types/schema_input_type sourceJsonPath=../jsonPath forceNull=true noExtends=true }}{{else}}@Nullable Object{{/with}}> | build()
Returns list input that should be used with Schema.validate | +| List<{{#with listItemSchema}}{{> src/main/kotlin/packagename/components/schemas/types/schema_input_type sourceJsonPath=../jsonPath forceNull=true noExtends=true }}{{else}}Any?{{/with}}> | build()
Returns list input that should be used with Schema.validate | diff --git a/src/main/resources/kotlin/src/main/kotlin/packagename/components/schemas/docschema_fields_field.hbs b/src/main/resources/kotlin/src/main/kotlin/packagename/components/schemas/docschema_fields_field.hbs index ad5b377f84a..f3d44571e5a 100644 --- a/src/main/resources/kotlin/src/main/kotlin/packagename/components/schemas/docschema_fields_field.hbs +++ b/src/main/resources/kotlin/src/main/kotlin/packagename/components/schemas/docschema_fields_field.hbs @@ -65,13 +65,13 @@ | Boolean | {{> src/main/kotlin/packagename/components/schemas/SchemaClass/_uniqueItems }} | {{/neq}} {{#if enumInfo}} -| Set | {{> src/main/kotlin/packagename/components/schemas/SchemaClass/_enum }} | +| Set | {{> src/main/kotlin/packagename/components/schemas/SchemaClass/_enum }} | {{/if}} {{#if patternInfo}} | Pattern | {{> src/main/kotlin/packagename/components/schemas/SchemaClass/_pattern }} | {{/if}} {{#if defaultValue}} -| @Nullable Object | {{> src/main/kotlin/packagename/components/schemas/SchemaClass/_default }} | +| Any? | {{> src/main/kotlin/packagename/components/schemas/SchemaClass/_default }} | {{/if}} {{#if contains}} | Class | {{> src/main/kotlin/packagename/components/schemas/SchemaClass/_contains }} | @@ -107,7 +107,7 @@ | Class | {{> src/main/kotlin/packagename/components/schemas/SchemaClass/_else }} | {{/if}} {{#if constInfo}} -| @Nullable Object | {{> src/main/kotlin/packagename/components/schemas/SchemaClass/_const }} | +| Any? | {{> src/main/kotlin/packagename/components/schemas/SchemaClass/_const }} | {{/if}} {{#if unevaluatedItems}} | Class | {{> src/main/kotlin/packagename/components/schemas/SchemaClass/_unevaluatedItems }} | diff --git a/src/main/resources/kotlin/src/main/kotlin/packagename/components/schemas/docschema_io_types.hbs b/src/main/resources/kotlin/src/main/kotlin/packagename/components/schemas/docschema_io_types.hbs index cbbe076b7f4..ad6957e8a82 100644 --- a/src/main/resources/kotlin/src/main/kotlin/packagename/components/schemas/docschema_io_types.hbs +++ b/src/main/resources/kotlin/src/main/kotlin/packagename/components/schemas/docschema_io_types.hbs @@ -1,114 +1,114 @@ {{#eq types null}} -| String | validate(String arg, SchemaConfiguration configuration) | +| String | validate(arg: String, configuration: SchemaConfiguration) | {{#and enumInfo enumInfo.typeToValues.string}} -| String | validate([String{{enumInfo.jsonPathPiece.pascalCase}}](#string{{enumInfo.jsonPathPiece.kebabCase}}) arg, SchemaConfiguration configuration) | +| String | validate(arg: [String{{enumInfo.jsonPathPiece.pascalCase}}](#string{{enumInfo.jsonPathPiece.kebabCase}}), configuration: SchemaConfiguration) | {{/and}} -| Nothing? | validate(Nothing? arg, SchemaConfiguration configuration) | +| Nothing? | validate(arg: Nothing?, configuration: SchemaConfiguration) | {{#and enumInfo enumInfo.typeToValues.null}} -| Nothing? | validate([Null{{enumInfo.jsonPathPiece.pascalCase}}](#null{{enumInfo.jsonPathPiece.kebabCase}}) arg, SchemaConfiguration configuration) | +| Nothing? | validate(arg: [Null{{enumInfo.jsonPathPiece.pascalCase}}](#null{{enumInfo.jsonPathPiece.kebabCase}}), configuration: SchemaConfiguration) | {{/and}} -| int | validate(int arg, SchemaConfiguration configuration) | -| long | validate(long arg, SchemaConfiguration configuration) | -| float | validate(float arg, SchemaConfiguration configuration) | -| double | validate(double arg, SchemaConfiguration configuration) | -| Number | validate(Number arg, SchemaConfiguration configuration) | -| boolean | validate(boolean arg, SchemaConfiguration configuration) | +| int | validate(arg: int, configuration: SchemaConfiguration) | +| long | validate(arg: long, configuration: SchemaConfiguration) | +| float | validate(arg: float, configuration: SchemaConfiguration) | +| double | validate(arg: double, configuration: SchemaConfiguration) | +| Number | validate(arg: Number, configuration: SchemaConfiguration) | +| boolean | validate(arg: boolean, configuration: SchemaConfiguration) | {{#and enumInfo enumInfo.typeToValues.boolean}} -| boolean | validate([Boolean{{enumInfo.jsonPathPiece.pascalCase}}](#boolean{{enumInfo.jsonPathPiece.kebabCase}}) arg, SchemaConfiguration configuration) | +| boolean | validate(arg: [Boolean{{enumInfo.jsonPathPiece.pascalCase}}](#boolean{{enumInfo.jsonPathPiece.kebabCase}}), configuration: SchemaConfiguration) | {{/and}} {{#if mapOutputJsonPathPiece }} -| [{{mapOutputJsonPathPiece.pascalCase}}](#{{> src/main/kotlin/packagename/components/_helper_anchor_id identifierPieces=(append identifierPieces mapOutputJsonPathPiece) }}) | validate([Map<?, ?>](#{{> src/main/kotlin/packagename/components/_helper_anchor_id identifierPieces=(append identifierPieces mapInputJsonPathPiece) }}) arg, SchemaConfiguration configuration) | +| [{{mapOutputJsonPathPiece.pascalCase}}](#{{> src/main/kotlin/packagename/components/_helper_anchor_id identifierPieces=(append identifierPieces mapOutputJsonPathPiece) }}) | validate(arg: [Map<?, ?>](#{{> src/main/kotlin/packagename/components/_helper_anchor_id identifierPieces=(append identifierPieces mapInputJsonPathPiece) }}), configuration: SchemaConfiguration) | {{else}} -| FrozenMap<@Nullable Object> | validate(Map<?, ?> arg, SchemaConfiguration configuration) | +| FrozenMap | validate(arg: Map<?, ?>, configuration: SchemaConfiguration) | {{/if}} {{#if arrayOutputJsonPathPiece}} -| [{{arrayOutputJsonPathPiece.pascalCase}}](#{{> src/main/kotlin/packagename/components/_helper_anchor_id identifierPieces=(append identifierPieces arrayOutputJsonPathPiece) }}) | validate([List](#{{> src/main/kotlin/packagename/components/_helper_anchor_id identifierPieces=(append identifierPieces arrayInputJsonPathPiece) }}) arg, SchemaConfiguration configuration) | +| [{{arrayOutputJsonPathPiece.pascalCase}}](#{{> src/main/kotlin/packagename/components/_helper_anchor_id identifierPieces=(append identifierPieces arrayOutputJsonPathPiece) }}) | validate(arg: [List<*>](#{{> src/main/kotlin/packagename/components/_helper_anchor_id identifierPieces=(append identifierPieces arrayInputJsonPathPiece) }}), configuration: SchemaConfiguration) | {{else}} -| FrozenList<@Nullable Object> | validate(List arg, SchemaConfiguration configuration) | +| FrozenList | validate(arg: List<*>, configuration: SchemaConfiguration) | {{/if}} -| [{{jsonPathPiece.pascalCase}}BoxedString](#{{> src/main/kotlin/packagename/components/_helper_anchor_id identifierPieces=(append identifierPieces (join jsonPathPiece.kebabCase "boxedstring" ""))}}) | validateAndBox(String arg, SchemaConfiguration configuration) | -| [{{jsonPathPiece.pascalCase}}BoxedVoid](#{{> src/main/kotlin/packagename/components/_helper_anchor_id identifierPieces=(append identifierPieces (join jsonPathPiece.kebabCase "boxedvoid" ""))}}) | validateAndBox(Nothing? arg, SchemaConfiguration configuration) | -| [{{jsonPathPiece.pascalCase}}BoxedNumber](#{{> src/main/kotlin/packagename/components/_helper_anchor_id identifierPieces=(append identifierPieces (join jsonPathPiece.kebabCase "boxednumber" ""))}}) | validateAndBox(Number arg, SchemaConfiguration configuration) | -| [{{jsonPathPiece.pascalCase}}BoxedBoolean](#{{> src/main/kotlin/packagename/components/_helper_anchor_id identifierPieces=(append identifierPieces (join jsonPathPiece.kebabCase "boxedboolean" ""))}}) | validateAndBox(boolean arg, SchemaConfiguration configuration) | -| [{{jsonPathPiece.pascalCase}}BoxedMap](#{{> src/main/kotlin/packagename/components/_helper_anchor_id identifierPieces=(append identifierPieces (join jsonPathPiece.kebabCase "boxedmap" ""))}}) | validateAndBox({{#if mapInputJsonPathPiece}}[Map<?, ?>](#{{> src/main/kotlin/packagename/components/_helper_anchor_id identifierPieces=(append identifierPieces mapInputJsonPathPiece) }}){{else}}Map<?, ?>{{/if}} arg, SchemaConfiguration configuration) | -| [{{jsonPathPiece.pascalCase}}BoxedList](#{{> src/main/kotlin/packagename/components/_helper_anchor_id identifierPieces=(append identifierPieces (join jsonPathPiece.kebabCase "boxedlist" ""))}}) | validateAndBox({{#if arrayInputJsonPathPiece}}[List](#{{> src/main/kotlin/packagename/components/_helper_anchor_id identifierPieces=(append identifierPieces arrayInputJsonPathPiece) }}){{else}}List{{/if}} arg, SchemaConfiguration configuration) | +| [{{jsonPathPiece.pascalCase}}BoxedString](#{{> src/main/kotlin/packagename/components/_helper_anchor_id identifierPieces=(append identifierPieces (join jsonPathPiece.kebabCase "boxedstring" ""))}}) | validateAndBox(String, configuration: SchemaConfiguration) | +| [{{jsonPathPiece.pascalCase}}BoxedVoid](#{{> src/main/kotlin/packagename/components/_helper_anchor_id identifierPieces=(append identifierPieces (join jsonPathPiece.kebabCase "boxedvoid" ""))}}) | validateAndBox(Nothing?, configuration: SchemaConfiguration) | +| [{{jsonPathPiece.pascalCase}}BoxedNumber](#{{> src/main/kotlin/packagename/components/_helper_anchor_id identifierPieces=(append identifierPieces (join jsonPathPiece.kebabCase "boxednumber" ""))}}) | validateAndBox(Number, configuration: SchemaConfiguration) | +| [{{jsonPathPiece.pascalCase}}BoxedBoolean](#{{> src/main/kotlin/packagename/components/_helper_anchor_id identifierPieces=(append identifierPieces (join jsonPathPiece.kebabCase "boxedboolean" ""))}}) | validateAndBox(boolean, configuration: SchemaConfiguration) | +| [{{jsonPathPiece.pascalCase}}BoxedMap](#{{> src/main/kotlin/packagename/components/_helper_anchor_id identifierPieces=(append identifierPieces (join jsonPathPiece.kebabCase "boxedmap" ""))}}) | validateAndBox({{#if mapInputJsonPathPiece}}[Map<?, ?>](#{{> src/main/kotlin/packagename/components/_helper_anchor_id identifierPieces=(append identifierPieces mapInputJsonPathPiece) }}){{else}}Map<?, ?>{{/if}}, configuration: SchemaConfiguration) | +| [{{jsonPathPiece.pascalCase}}BoxedList](#{{> src/main/kotlin/packagename/components/_helper_anchor_id identifierPieces=(append identifierPieces (join jsonPathPiece.kebabCase "boxedlist" ""))}}) | validateAndBox({{#if arrayInputJsonPathPiece}}[List<*>](#{{> src/main/kotlin/packagename/components/_helper_anchor_id identifierPieces=(append identifierPieces arrayInputJsonPathPiece) }}){{else}}List<*>{{/if}}, configuration: SchemaConfiguration) | {{else}} {{#each types}} {{#eq this "boolean"}} -| boolean | validate(boolean arg, SchemaConfiguration configuration) | +| boolean | validate(arg: boolean, configuration: SchemaConfiguration) | {{#and ../enumInfo enumInfo.typeToValues.boolean}} -| boolean | validate([Boolean{{../enumInfo.jsonPathPiece.pascalCase}}](#boolean{{../enumInfo.jsonPathPiece.kebabCase}}) arg, SchemaConfiguration configuration) | +| boolean | validate(arg: [Boolean{{../enumInfo.jsonPathPiece.pascalCase}}](#boolean{{../enumInfo.jsonPathPiece.kebabCase}}), configuration: SchemaConfiguration) | {{/and}} -| [{{jsonPathPiece.pascalCase}}BoxedBoolean](#{{> src/main/kotlin/packagename/components/_helper_anchor_id identifierPieces=(append identifierPieces (join jsonPathPiece.kebabCase "boxedboolean" ""))}}) | validateAndBox(boolean arg, SchemaConfiguration configuration) | +| [{{jsonPathPiece.pascalCase}}BoxedBoolean](#{{> src/main/kotlin/packagename/components/_helper_anchor_id identifierPieces=(append identifierPieces (join jsonPathPiece.kebabCase "boxedboolean" ""))}}) | validateAndBox(boolean, configuration: SchemaConfiguration) | {{else}} {{#eq this "null"}} -| Nothing? | validate(Nothing? arg, SchemaConfiguration configuration) | +| Nothing? | validate(arg: Nothing?, configuration: SchemaConfiguration) | {{#and ../enumInfo ../enumInfo.typeToValues.null}} -| Nothing? | validate([Null{{../enumInfo.jsonPathPiece.pascalCase}}](#null{{../enumInfo.jsonPathPiece.kebabCase}}) arg, SchemaConfiguration configuration) | +| Nothing? | validate(arg: [Null{{../enumInfo.jsonPathPiece.pascalCase}}](#null{{../enumInfo.jsonPathPiece.kebabCase}}), configuration: SchemaConfiguration) | {{/and}} -| [{{jsonPathPiece.pascalCase}}BoxedVoid](#{{> src/main/kotlin/packagename/components/_helper_anchor_id identifierPieces=(append identifierPieces (join jsonPathPiece.kebabCase "boxedvoid" ""))}}) | validateAndBox(Nothing? arg, SchemaConfiguration configuration) | +| [{{jsonPathPiece.pascalCase}}BoxedVoid](#{{> src/main/kotlin/packagename/components/_helper_anchor_id identifierPieces=(append identifierPieces (join jsonPathPiece.kebabCase "boxedvoid" ""))}}) | validateAndBox(Nothing?, configuration: SchemaConfiguration) | {{else}} {{#eq this "string"}} {{#eq format "binary"}} {{! todo binary types}} -| BinaryString | validate(BinaryString arg, SchemaConfiguration configuration) | +| BinaryString | validate(arg: BinaryString, configuration: SchemaConfiguration) | {{else}} -| String | validate(String arg, SchemaConfiguration configuration) | +| String | validate(arg: String, configuration: SchemaConfiguration) | {{#and ../enumInfo ../enumInfo.typeToValues.string}} -| String | validate([String{{../enumInfo.jsonPathPiece.pascalCase}}](#string{{../enumInfo.jsonPathPiece.kebabCase}}) arg, SchemaConfiguration configuration) | +| String | validate(arg: [String{{../enumInfo.jsonPathPiece.pascalCase}}](#string{{../enumInfo.jsonPathPiece.kebabCase}}), configuration: SchemaConfiguration) | {{/and}} -| [{{jsonPathPiece.pascalCase}}BoxedString](#{{> src/main/kotlin/packagename/components/_helper_anchor_id identifierPieces=(append identifierPieces (join jsonPathPiece.kebabCase "boxedstring" ""))}}) | validateAndBox(String arg, SchemaConfiguration configuration) | +| [{{jsonPathPiece.pascalCase}}BoxedString](#{{> src/main/kotlin/packagename/components/_helper_anchor_id identifierPieces=(append identifierPieces (join jsonPathPiece.kebabCase "boxedstring" ""))}}) | validateAndBox(String, configuration: SchemaConfiguration) | {{/eq}} {{else}} {{#eq this "number"}} {{#eq ../format null}} -| Number | validate(Number arg, SchemaConfiguration configuration) | +| Number | validate(arg: Number, configuration: SchemaConfiguration) | {{else}} {{#eq ../format "float"}} -| float | validate(float arg, SchemaConfiguration configuration) | +| float | validate(arg: float, configuration: SchemaConfiguration) | {{else}} {{#eq ../format "double"}} -| double | validate(double arg, SchemaConfiguration configuration) | +| double | validate(arg: double, configuration: SchemaConfiguration) | {{else}} {{#eq ../format "int32"}} -| int | validate(int arg, SchemaConfiguration configuration) | +| int | validate(arg: int, configuration: SchemaConfiguration) | {{else}} {{#eq ../format "int64"}} -| long | validate(long arg, SchemaConfiguration configuration) | +| long | validate(arg: long, configuration: SchemaConfiguration) | {{/eq}} {{/eq}} {{/eq}} {{/eq}} {{/eq}} -| [{{jsonPathPiece.pascalCase}}BoxedNumber](#{{> src/main/kotlin/packagename/components/_helper_anchor_id identifierPieces=(append identifierPieces (join jsonPathPiece.kebabCase "boxednumber" ""))}}) | validateAndBox(Number arg, SchemaConfiguration configuration) | +| [{{jsonPathPiece.pascalCase}}BoxedNumber](#{{> src/main/kotlin/packagename/components/_helper_anchor_id identifierPieces=(append identifierPieces (join jsonPathPiece.kebabCase "boxednumber" ""))}}) | validateAndBox(Number, configuration: SchemaConfiguration) | {{else}} {{#eq this "integer"}} {{#eq ../format null}} -| long | validate(long arg, SchemaConfiguration configuration) | +| long | validate(arg: long, configuration: SchemaConfiguration) | {{else}} {{#eq ../format "int32"}} -| int | validate(int arg, SchemaConfiguration configuration) | +| int | validate(arg: int, configuration: SchemaConfiguration) | {{else}} -| long | validate(long arg, SchemaConfiguration configuration) | +| long | validate(arg: long, configuration: SchemaConfiguration) | {{/eq}} {{/eq}} -| [{{jsonPathPiece.pascalCase}}BoxedNumber](#{{> src/main/kotlin/packagename/components/_helper_anchor_id identifierPieces=(append identifierPieces (join jsonPathPiece.kebabCase "boxednumber" ""))}}) | validateAndBox(Number arg, SchemaConfiguration configuration) | +| [{{jsonPathPiece.pascalCase}}BoxedNumber](#{{> src/main/kotlin/packagename/components/_helper_anchor_id identifierPieces=(append identifierPieces (join jsonPathPiece.kebabCase "boxednumber" ""))}}) | validateAndBox(Number, configuration: SchemaConfiguration) | {{else}} {{#eq this "array"}} {{#if ../arrayOutputJsonPathPiece}} -| [{{../arrayOutputJsonPathPiece.pascalCase}}](#{{> src/main/kotlin/packagename/components/_helper_anchor_id identifierPieces=(append identifierPieces ../arrayOutputJsonPathPiece) }}) | validate([List](#{{> src/main/kotlin/packagename/components/_helper_anchor_id identifierPieces=(append identifierPieces arrayInputJsonPathPiece) }}) arg, SchemaConfiguration configuration) | +| [{{../arrayOutputJsonPathPiece.pascalCase}}](#{{> src/main/kotlin/packagename/components/_helper_anchor_id identifierPieces=(append identifierPieces ../arrayOutputJsonPathPiece) }}) | validate(arg: [List<*>](#{{> src/main/kotlin/packagename/components/_helper_anchor_id identifierPieces=(append identifierPieces arrayInputJsonPathPiece) }}), configuration: SchemaConfiguration) | {{else}} -| FrozenList<@Nullable Object> | validate(List arg, SchemaConfiguration configuration) | +| FrozenList | validate(arg: List<*>, configuration: SchemaConfiguration) | {{/if}} -| [{{jsonPathPiece.pascalCase}}BoxedList](#{{> src/main/kotlin/packagename/components/_helper_anchor_id identifierPieces=(append identifierPieces (join jsonPathPiece.kebabCase "boxedlist" ""))}}) | validateAndBox({{#if arrayInputJsonPathPiece}}[List](#{{> src/main/kotlin/packagename/components/_helper_anchor_id identifierPieces=(append identifierPieces arrayInputJsonPathPiece) }}){{else}}List{{/if}} arg, SchemaConfiguration configuration) | +| [{{jsonPathPiece.pascalCase}}BoxedList](#{{> src/main/kotlin/packagename/components/_helper_anchor_id identifierPieces=(append identifierPieces (join jsonPathPiece.kebabCase "boxedlist" ""))}}) | validateAndBox({{#if arrayInputJsonPathPiece}}[List<*>](#{{> src/main/kotlin/packagename/components/_helper_anchor_id identifierPieces=(append identifierPieces arrayInputJsonPathPiece) }}){{else}}List<*>{{/if}}, configuration: SchemaConfiguration) | {{else}} {{#eq this "object"}} {{#if ../mapOutputJsonPathPiece}} -| [{{../mapOutputJsonPathPiece.pascalCase}}](#{{> src/main/kotlin/packagename/components/_helper_anchor_id identifierPieces=(append identifierPieces ../mapOutputJsonPathPiece) }}) | validate([Map<?, ?>](#{{> src/main/kotlin/packagename/components/_helper_anchor_id identifierPieces=(append identifierPieces ../mapInputJsonPathPiece) }}) arg, SchemaConfiguration configuration) | +| [{{../mapOutputJsonPathPiece.pascalCase}}](#{{> src/main/kotlin/packagename/components/_helper_anchor_id identifierPieces=(append identifierPieces ../mapOutputJsonPathPiece) }}) | validate(arg: [Map<?, ?>](#{{> src/main/kotlin/packagename/components/_helper_anchor_id identifierPieces=(append identifierPieces ../mapInputJsonPathPiece) }}), configuration: SchemaConfiguration) | {{else}} -| FrozenMap | validate(Map<?, ?> arg, SchemaConfiguration configuration) | +| FrozenMap | validate(arg: Map<?, ?>, configuration: SchemaConfiguration) | {{/if}} -| [{{jsonPathPiece.pascalCase}}BoxedMap](#{{> src/main/kotlin/packagename/components/_helper_anchor_id identifierPieces=(append identifierPieces (join jsonPathPiece.kebabCase "boxedmap" ""))}}) | validateAndBox({{#if mapInputJsonPathPiece}}[Map<?, ?>](#{{> src/main/kotlin/packagename/components/_helper_anchor_id identifierPieces=(append identifierPieces mapInputJsonPathPiece) }}){{else}}Map<?, ?>{{/if}} arg, SchemaConfiguration configuration) | +| [{{jsonPathPiece.pascalCase}}BoxedMap](#{{> src/main/kotlin/packagename/components/_helper_anchor_id identifierPieces=(append identifierPieces (join jsonPathPiece.kebabCase "boxedmap" ""))}}) | validateAndBox({{#if mapInputJsonPathPiece}}[Map<?, ?>](#{{> src/main/kotlin/packagename/components/_helper_anchor_id identifierPieces=(append identifierPieces mapInputJsonPathPiece) }}){{else}}Map<?, ?>{{/if}}, configuration: SchemaConfiguration) | {{/eq}} {{/eq}} {{/eq}} @@ -118,5 +118,5 @@ {{/eq}} {{/each}} {{/eq}} -| [{{jsonPathPiece.pascalCase}}Boxed](#{{> src/main/kotlin/packagename/components/_helper_anchor_id identifierPieces=(append identifierPieces (join jsonPathPiece.kebabCase "boxed" ""))}}) | validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) | -| @Nullable Object | validate(@Nullable Object arg, SchemaConfiguration configuration) | +| [{{jsonPathPiece.pascalCase}}Boxed](#{{> src/main/kotlin/packagename/components/_helper_anchor_id identifierPieces=(append identifierPieces (join jsonPathPiece.kebabCase "boxed" ""))}}) | validateAndBox(Any?, configuration: SchemaConfiguration) | +| Any? | validate(arg: Any?, configuration: SchemaConfiguration) | diff --git a/src/main/resources/kotlin/src/main/kotlin/packagename/components/schemas/docschema_objectInput.hbs b/src/main/resources/kotlin/src/main/kotlin/packagename/components/schemas/docschema_objectInput.hbs index 08accbc7e53..92abc1821c3 100644 --- a/src/main/resources/kotlin/src/main/kotlin/packagename/components/schemas/docschema_objectInput.hbs +++ b/src/main/resources/kotlin/src/main/kotlin/packagename/components/schemas/docschema_objectInput.hbs @@ -1,11 +1,11 @@ {{#each mapBuilders}} {{> src/main/kotlin/packagename/components/_helper_header_from_identifier_pieces headerSize=(join headerSize "#" "") identifierPieces=(append identifierPieces className) }} -public class {{className.pascalCase}}
+class {{className.pascalCase}}
{{#if ../mapValueSchema}} builder for `Map src/main/kotlin/packagename/components/schemas/types/schema_input_type sourceJsonPath=../jsonPath forceNull=true noExtends=true }}{{/with}}>` {{else}} -builder for `Map` +builder for `Map` {{/if}} A class that builds the Map input type @@ -16,14 +16,14 @@ A class that builds the Map input type {{#if @last }} | {{className.pascalCase}}()
Creates a builder that contains an empty map | {{else}} -| {{className.pascalCase}}(Map src/main/kotlin/packagename/components/schemas/types/schema_input_type sourceJsonPath=../../jsonPath forceNull=true noExtends=true }}{{else}}@Nullable Object{{/with}}> instance)
Creates a builder that contains the passed instance | +| {{className.pascalCase}}(Map src/main/kotlin/packagename/components/schemas/types/schema_input_type sourceJsonPath=../../jsonPath forceNull=true noExtends=true }}{{else}}Any?{{/with}}> instance)
Creates a builder that contains the passed instance | {{/if}} {{headerSize}}## Method Summary | Modifier and Type | Method and Description | | ----------------- | ---------------------- | {{#if @first}} -| Map src/main/kotlin/packagename/components/schemas/types/schema_input_type sourceJsonPath=../../jsonPath forceNull=true noExtends=true }}{{else}}@Nullable Object{{/with}}> | build()
Returns map input that should be used with Schema.validate | +| Map src/main/kotlin/packagename/components/schemas/types/schema_input_type sourceJsonPath=../../jsonPath forceNull=true noExtends=true }}{{else}}Any?{{/with}}> | build()
Returns map input that should be used with Schema.validate | {{/if}} {{#each keyToBuilder}} {{#with property }} diff --git a/src/main/resources/kotlin/src/main/kotlin/packagename/components/schemas/helpers/payload_renderer.hbs b/src/main/resources/kotlin/src/main/kotlin/packagename/components/schemas/helpers/payload_renderer.hbs index db40dce3cd8..1ab042bffce 100644 --- a/src/main/resources/kotlin/src/main/kotlin/packagename/components/schemas/helpers/payload_renderer.hbs +++ b/src/main/resources/kotlin/src/main/kotlin/packagename/components/schemas/helpers/payload_renderer.hbs @@ -21,9 +21,9 @@ {{/or}} {{/each}} {{else}} -MapUtils.makeMap( +mapOf{{#eq value.size 0}}{{/eq}}( {{#each value}} - new AbstractMap.SimpleEntry src/main/kotlin/packagename/components/schemas/types/schema_input_type forceNull=true noExtends=true }}{{/with}}>( + Pair( {{#if @key.original }} "{{{@key.original}}}", {{else}} @@ -49,7 +49,7 @@ MapUtils.makeMap( {{/or}} {{/each}} {{else}} -Arrays.asList( +listOf{{#eq value.size 0}}{{/eq}}( {{#eq value.size 1}} {{#each value}} {{! list with single null needs to describe the item as (Nothing?) }} @@ -75,7 +75,7 @@ Arrays.asList( {{value}}f{{endChar}} {{else}} {{#eq javaType "Double"}} -{{value}}d{{endChar}} +{{value}}{{endChar}} {{else}} {{value}}{{endChar}}{{! Integer }} {{/eq}} @@ -89,7 +89,7 @@ Arrays.asList( {{value}}{{endChar}} {{/eq}} {{#eq type "null"}} -{{#unless noVoid}}(Nothing?) {{/unless}}null{{endChar}} +null{{endChar}} {{/eq}} {{#eq type "string"}} "{{{value}}}"{{endChar}} diff --git a/src/main/resources/kotlin/src/main/kotlin/packagename/components/schemas/types/_schema_input_type_base.hbs b/src/main/resources/kotlin/src/main/kotlin/packagename/components/schemas/types/_schema_input_type_base.hbs index 6be5a6b2c1a..476fdf9047a 100644 --- a/src/main/resources/kotlin/src/main/kotlin/packagename/components/schemas/types/_schema_input_type_base.hbs +++ b/src/main/resources/kotlin/src/main/kotlin/packagename/components/schemas/types/_schema_input_type_base.hbs @@ -2,12 +2,8 @@ {{#eq types.size 1}} {{#each types}} {{#eq this "boolean"}} - {{#if forceNull}} Boolean - {{~else}} -boolean - {{~/if}} - {{else}} + {{~else}} {{#eq this "null"}} Nothing? {{~else}} @@ -27,23 +23,23 @@ Number {{~else}} {{#eq this "array"}} {{#eq ../jsonPath sourceJsonPath}} -List +List {{~else}} {{#with items}} List<{{> src/main/kotlin/packagename/components/schemas/types/schema_input_type }}> {{~else}} -List<{{#unless noExtends}}? extends {{/unless}}@Nullable Object> +List {{~/with}} {{/eq}} {{else}} {{#eq this "object"}} {{#eq ../jsonPath sourceJsonPath}} -Map +Map {{~else}} {{#with mapValueSchema}} Map src/main/kotlin/packagename/components/schemas/types/schema_input_type }}> {{~else}} -Map +Map {{~/with}} {{/eq}} {{/eq}} @@ -60,41 +56,41 @@ Map {{! nullable types }} {{#each types}} {{#eq this "boolean"}} -{{#unless noExtends}}? extends {{/unless}}@Nullable Boolean +{{#unless noExtends}}out {{/unless}} Boolean? {{~else}} {{#eq this "string"}} {{#eq format "binary"}} {{! todo binary types}} -{{#unless noExtends}}? extends {{/unless}}@Nullable String +{{#unless noExtends}}out {{/unless}} String? {{~else}} -{{#unless noExtends}}? extends {{/unless}}@Nullable String +{{#unless noExtends}}out {{/unless}}String? {{~/eq}} {{else}} {{#eq this "number"}} -{{#unless noExtends}}? extends {{/unless}}@Nullable Number +{{#unless noExtends}}out {{/unless}} Number? {{~else}} {{#eq this "integer"}} -{{#unless noExtends}}? extends {{/unless}}@Nullable Number +{{#unless noExtends}}out {{/unless}} Number? {{~else}} {{#eq this "array"}} {{#eq ../jsonPath sourceJsonPath}} -{{#unless noExtends}}? extends {{/unless}}@Nullable List +{{#unless noExtends}}out {{/unless}} List? {{~else}} {{#with items}} -{{#unless noExtends}}? extends {{/unless}}@Nullable List<{{> src/main/kotlin/packagename/components/schemas/types/schema_input_type }}> +{{#unless noExtends}}out {{/unless}} List<{{> src/main/kotlin/packagename/components/schemas/types/schema_input_type }}>? {{~else}} -{{#unless noExtends}}? extends {{/unless}}@Nullable List<@Nullable Object> +{{#unless noExtends}}out {{/unless}} List? {{~/with}} {{/eq}} {{else}} {{#eq this "object"}} {{#eq ../jsonPath sourceJsonPath}} -{{#unless noExtends}}? extends {{/unless}}@Nullable Map +{{#unless noExtends}}out {{/unless}} Map? {{~else}} {{#with mapValueSchema}} -{{#unless noExtends}}? extends {{/unless}}@Nullable Map src/main/kotlin/packagename/components/schemas/types/schema_input_type }}> +{{#unless noExtends}}out {{/unless}} Map src/main/kotlin/packagename/components/schemas/types/schema_input_type }}>? {{~else}} -{{#unless noExtends}}? extends {{/unless}}@Nullable Map +{{#unless noExtends}}out {{/unless}} Map? {{~/with}} {{/eq}} {{/eq}} @@ -109,18 +105,18 @@ Map {{#and (contains types "integer") (contains types "number") }} Number {{~else}} -Object +Any {{~/and}} {{/contains}} {{else}} {{! 3 or more types }} {{#contains types "null"}} -{{#unless noExtends}}? extends {{/unless}}@Nullable Object +Any? {{~else}} -Object +Any {{~/contains}} {{/eq}} {{/eq}} {{else}} -{{#unless noExtends}}? extends {{/unless}}@Nullable Object +Any? {{~/if}} \ No newline at end of file diff --git a/src/main/resources/kotlin/src/main/kotlin/packagename/components/schemas/types/_schema_output_type_base.hbs b/src/main/resources/kotlin/src/main/kotlin/packagename/components/schemas/types/_schema_output_type_base.hbs index 2c2b687fda0..56abc7edf7f 100644 --- a/src/main/resources/kotlin/src/main/kotlin/packagename/components/schemas/types/_schema_output_type_base.hbs +++ b/src/main/resources/kotlin/src/main/kotlin/packagename/components/schemas/types/_schema_output_type_base.hbs @@ -2,12 +2,8 @@ {{#eq types.size 1}} {{#each types}} {{#eq this "boolean"}} - {{#if forceNull}} Boolean - {{~else}} -boolean - {{~/if}} - {{else}} + {{~else}} {{#eq this "null"}} Nothing? {{~else}} @@ -41,7 +37,7 @@ Number {{~/if}} {{/if}} {{else}} -FrozenList +FrozenList {{~/if}} {{else}} {{#eq this "object"}} @@ -60,7 +56,7 @@ FrozenList {{~/if}} {{/if}} {{~else}} -FrozenMap +FrozenMap {{~/if}} {{/eq}} {{/eq}} @@ -76,21 +72,21 @@ FrozenMap {{! nullable types }} {{#each types}} {{#eq this "boolean"}} -{{#unless noAnnotations}}@Nullable {{/unless}}Boolean +Boolean{{#unless noAnnotations}}?{{/unless}} {{~else}} {{#eq this "string"}} {{#eq format "binary"}} {{! todo binary types}} -{{#unless noAnnotations}}@Nullable {{/unless}}String +String{{#unless noAnnotations}}?{{/unless}} {{~else}} -{{#unless noAnnotations}}@Nullable {{/unless}}String +String{{#unless noAnnotations}}?{{/unless}} {{~/eq}} {{else}} {{#eq this "number"}} -{{#unless noAnnotations}}@Nullable {{/unless}}Number +Number{{#unless noAnnotations}}?{{/unless}} {{~else}} {{#eq this "integer"}} -{{#unless noAnnotations}}@Nullable {{/unless}}Number +Number{{#unless noAnnotations}}?{{/unless}} {{~else}} {{#eq this "array"}} {{#if arrayOutputJsonPathPiece}} @@ -102,13 +98,13 @@ FrozenMap {{~/if}} {{else}} {{#if fullRefModule}} -{{#unless noAnnotations}}@Nullable {{/unless}}{{fullRefModule}}.{{arrayOutputJsonPathPiece.pascalCase}} +{{fullRefModule}}.{{arrayOutputJsonPathPiece.pascalCase}}{{#unless noAnnotations}}?{{/unless}} {{~else}} -{{#unless noAnnotations}}@Nullable {{/unless}}{{arrayOutputJsonPathPiece.pascalCase}} +{{arrayOutputJsonPathPiece.pascalCase}}{{#unless noAnnotations}}?{{/unless}} {{~/if}} {{/if}} {{else}} -{{#unless noAnnotations}}@Nullable {{/unless}}FrozenList +FrozenList{{#unless noAnnotations}}?{{/unless}} {{~/if}} {{else}} {{#eq this "object"}} @@ -121,13 +117,13 @@ FrozenMap {{~/if}} {{else}} {{#if fullRefModule}} -{{#unless noAnnotations}}@Nullable {{/unless}}{{fullRefModule}}.{{mapOutputJsonPathPiece.pascalCase}} +{{fullRefModule}}.{{mapOutputJsonPathPiece.pascalCase}}{{#unless noAnnotations}}?{{/unless}} {{~else}} -{{#unless noAnnotations}}@Nullable {{/unless}}{{mapOutputJsonPathPiece.pascalCase}} +{{mapOutputJsonPathPiece.pascalCase}}{{#unless noAnnotations}}?{{/unless}} {{~/if}} {{/if}} {{~else}} -{{#unless noAnnotations}}@Nullable {{/unless}}FrozenMap +FrozenMap{{#unless noAnnotations}}?{{/unless}} {{~/if}} {{/eq}} {{/eq}} @@ -141,18 +137,18 @@ FrozenMap {{#and (contains types "integer") (contains types "number") }} Number {{~else}} -Object +Any {{~/and}} {{/contains}} {{else}} {{! 3 or more types }} {{#contains types "null"}} -{{#unless noAnnotations}}@Nullable {{/unless}}Object +Any{{#unless noAnnotations}}?{{/unless}} {{~else}} -Object +Any {{~/contains}} {{/eq}} {{/eq}} {{else}} -{{#unless noAnnotations}}@Nullable {{/unless}}Object +Any{{#unless noAnnotations}}?{{/unless}} {{~/if}} diff --git a/src/main/resources/kotlin/src/main/kotlin/packagename/components/schemas/validateSchemaCodeSample.hbs b/src/main/resources/kotlin/src/main/kotlin/packagename/components/schemas/validateSchemaCodeSample.hbs index c5a320a9bb7..7189cb85491 100644 --- a/src/main/resources/kotlin/src/main/kotlin/packagename/components/schemas/validateSchemaCodeSample.hbs +++ b/src/main/resources/kotlin/src/main/kotlin/packagename/components/schemas/validateSchemaCodeSample.hbs @@ -11,7 +11,7 @@ Nothing? {{../payloadVarName}} = {{../../../containerJsonPathPiece.pascalCase}}. {{../../../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"}} @@ -21,7 +21,7 @@ FrozenMap {{../payloadVarName}} = {{../../../containerJsonPathPi {{../../../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" }} diff --git a/src/main/resources/kotlin/src/main/kotlin/packagename/schemas/AnyTypeJsonSchema.hbs b/src/main/resources/kotlin/src/main/kotlin/packagename/schemas/AnyTypeJsonSchema.hbs index 7a47067791d..67596d88efe 100644 --- a/src/main/resources/kotlin/src/main/kotlin/packagename/schemas/AnyTypeJsonSchema.hbs +++ b/src/main/resources/kotlin/src/main/kotlin/packagename/schemas/AnyTypeJsonSchema.hbs @@ -1,26 +1,26 @@ -package {{{packageName}}}.schemas; - -import {{{packageName}}}.configurations.JsonSchemaKeywordFlags; -import {{{packageName}}}.configurations.SchemaConfiguration; -import {{{packageName}}}.exceptions.ValidationException; -import {{{packageName}}}.schemas.validation.FrozenList; -import {{{packageName}}}.schemas.validation.FrozenMap; -import {{{packageName}}}.schemas.validation.JsonSchema; -import {{{packageName}}}.schemas.validation.JsonSchemaInfo; -import {{{packageName}}}.schemas.validation.PathToSchemasMap; -import {{{packageName}}}.schemas.validation.NullSchemaValidator; -import {{{packageName}}}.schemas.validation.BooleanSchemaValidator; -import {{{packageName}}}.schemas.validation.NumberSchemaValidator; -import {{{packageName}}}.schemas.validation.StringSchemaValidator; -import {{{packageName}}}.schemas.validation.ListSchemaValidator; -import {{{packageName}}}.schemas.validation.MapSchemaValidator; -import {{{packageName}}}.schemas.validation.ValidationMetadata; +package {{{packageName}}}.schemas + +import {{{packageName}}}.configurations.JsonSchemaKeywordFlags +import {{{packageName}}}.configurations.SchemaConfiguration +import {{{packageName}}}.exceptions.ValidationException +import {{{packageName}}}.schemas.validation.FrozenList +import {{{packageName}}}.schemas.validation.FrozenMap +import {{{packageName}}}.schemas.validation.JsonSchema +import {{{packageName}}}.schemas.validation.JsonSchemaInfo +import {{{packageName}}}.schemas.validation.PathToSchemasMap +import {{{packageName}}}.schemas.validation.NullSchemaValidator +import {{{packageName}}}.schemas.validation.BooleanSchemaValidator +import {{{packageName}}}.schemas.validation.NumberSchemaValidator +import {{{packageName}}}.schemas.validation.StringSchemaValidator +import {{{packageName}}}.schemas.validation.ListSchemaValidator +import {{{packageName}}}.schemas.validation.MapSchemaValidator +import {{{packageName}}}.schemas.validation.ValidationMetadata import java.time.LocalDate import java.time.ZonedDateTime import java.util.UUID -class AnyTypeJsonSchema { +open class AnyTypeJsonSchema { sealed interface AnyTypeJsonSchema1Boxed { fun getData(): Any? } @@ -34,21 +34,21 @@ class AnyTypeJsonSchema { data class AnyTypeJsonSchema1BoxedBoolean(val data: Boolean) : AnyTypeJsonSchema1Boxed { - override fun getData(): Boolean { + override fun getData(): Any? { return data } } data class AnyTypeJsonSchema1BoxedNumber(val data: Number) : AnyTypeJsonSchema1Boxed { - override fun getData(): Number { + override fun getData(): Any? { return data } } data class AnyTypeJsonSchema1BoxedString(val data: String) : AnyTypeJsonSchema1Boxed { - override fun getData(): String { + override fun getData(): Any? { return data } @@ -56,19 +56,19 @@ class AnyTypeJsonSchema { data class AnyTypeJsonSchema1BoxedList(val data: FrozenList) : AnyTypeJsonSchema1Boxed { - override fun getData(): FrozenList { + override fun getData(): Any? { return data } } data class AnyTypeJsonSchema1BoxedMap(val data: FrozenMap) : AnyTypeJsonSchema1Boxed { - override fun getData(): FrozenMap { + override fun getData(): Any? { return data } } - class AnyTypeJsonSchema1 private constructor() : JsonSchema(JsonSchemaInfo()), + open class AnyTypeJsonSchema1 protected constructor() : JsonSchema(JsonSchemaInfo()), NullSchemaValidator, BooleanSchemaValidator, NumberSchemaValidator, StringSchemaValidator, ListSchemaValidator, AnyTypeJsonSchema1BoxedList>, @@ -235,11 +235,11 @@ class AnyTypeJsonSchema { } is Number -> { - return getNewInstance(arg as Number?, pathToItem, pathToSchemas) + return getNewInstance(arg, pathToItem, pathToSchemas) } is String -> { - return getNewInstance(arg as String?, pathToItem, pathToSchemas) + return getNewInstance(arg, pathToItem, pathToSchemas) } is List<*> -> { @@ -273,11 +273,11 @@ class AnyTypeJsonSchema { } is List<*> -> { - return validate(arg as List<*>?, configuration) + return validate(arg, configuration) } is Map<*, *> -> { - return validate(arg as Map<*, *>?, configuration) + return validate(arg, configuration) } else -> throw ValidationException("Invalid input type=$javaClass. It can't be validated by this schema") diff --git a/src/main/resources/kotlin/src/main/kotlin/packagename/schemas/BooleanJsonSchema.hbs b/src/main/resources/kotlin/src/main/kotlin/packagename/schemas/BooleanJsonSchema.hbs index 7341bffdec1..3750dfaff0a 100644 --- a/src/main/resources/kotlin/src/main/kotlin/packagename/schemas/BooleanJsonSchema.hbs +++ b/src/main/resources/kotlin/src/main/kotlin/packagename/schemas/BooleanJsonSchema.hbs @@ -1,26 +1,26 @@ -package {{{packageName}}}.schemas; +package {{{packageName}}}.schemas -import {{{packageName}}}.configurations.JsonSchemaKeywordFlags; -import {{{packageName}}}.configurations.SchemaConfiguration; -import {{{packageName}}}.exceptions.ValidationException; -import {{{packageName}}}.schemas.validation.JsonSchema; -import {{{packageName}}}.schemas.validation.JsonSchemaInfo; -import {{{packageName}}}.schemas.validation.PathToSchemasMap; -import {{{packageName}}}.schemas.validation.BooleanSchemaValidator; -import {{{packageName}}}.schemas.validation.ValidationMetadata; +import {{{packageName}}}.configurations.JsonSchemaKeywordFlags +import {{{packageName}}}.configurations.SchemaConfiguration +import {{{packageName}}}.exceptions.ValidationException +import {{{packageName}}}.schemas.validation.JsonSchema +import {{{packageName}}}.schemas.validation.JsonSchemaInfo +import {{{packageName}}}.schemas.validation.PathToSchemasMap +import {{{packageName}}}.schemas.validation.BooleanSchemaValidator +import {{{packageName}}}.schemas.validation.ValidationMetadata -class BooleanJsonSchema { +open class BooleanJsonSchema { sealed interface BooleanJsonSchema1Boxed { fun getData(): Any? } data class BooleanJsonSchema1BoxedBoolean(val data: Boolean) : BooleanJsonSchema1Boxed { - override fun getData(): Boolean { + override fun getData(): Any? { return data } } - class BooleanJsonSchema1 private constructor() : JsonSchema( + open class BooleanJsonSchema1 protected constructor() : JsonSchema( JsonSchemaInfo() .type(setOf(Boolean::class.java)) ), BooleanSchemaValidator { diff --git a/src/main/resources/kotlin/src/main/kotlin/packagename/schemas/DateJsonSchema.hbs b/src/main/resources/kotlin/src/main/kotlin/packagename/schemas/DateJsonSchema.hbs index 0fb1b4504ed..ceb377593f3 100644 --- a/src/main/resources/kotlin/src/main/kotlin/packagename/schemas/DateJsonSchema.hbs +++ b/src/main/resources/kotlin/src/main/kotlin/packagename/schemas/DateJsonSchema.hbs @@ -1,46 +1,42 @@ -package {{{packageName}}}.schemas; +package {{{packageName}}}.schemas -import {{{packageName}}}.configurations.JsonSchemaKeywordFlags; -import {{{packageName}}}.configurations.SchemaConfiguration; -import {{{packageName}}}.exceptions.ValidationException; -import {{{packageName}}}.schemas.validation.JsonSchema; -import {{{packageName}}}.schemas.validation.JsonSchemaInfo; -import {{{packageName}}}.schemas.validation.PathToSchemasMap; -import {{{packageName}}}.schemas.validation.StringSchemaValidator; -import {{{packageName}}}.schemas.validation.ValidationMetadata; +import {{{packageName}}}.configurations.JsonSchemaKeywordFlags +import {{{packageName}}}.configurations.SchemaConfiguration +import {{{packageName}}}.exceptions.ValidationException +import {{{packageName}}}.schemas.validation.JsonSchema +import {{{packageName}}}.schemas.validation.JsonSchemaInfo +import {{{packageName}}}.schemas.validation.PathToSchemasMap +import {{{packageName}}}.schemas.validation.StringSchemaValidator +import {{{packageName}}}.schemas.validation.ValidationMetadata -import java.time.LocalDate; +import java.time.LocalDate -class DateJsonSchema { +open class DateJsonSchema { sealed interface DateJsonSchema1Boxed { fun getData(): Any? } data class DateJsonSchema1BoxedString(val data: String) : DateJsonSchema1Boxed { - override fun getData(): String { + override fun getData(): Any? { return data } } - class DateJsonSchema1 private constructor() : JsonSchema( + open class DateJsonSchema1 protected constructor() : JsonSchema( JsonSchemaInfo() .type(setOf(String::class.java)) .format("date") ), StringSchemaValidator { @Throws(ValidationException::class) override fun validate(arg: String, configuration: SchemaConfiguration?): String { - val pathSet: Set> = HashSet() + val pathSet: MutableSet> = HashSet() val pathToItem = listOf("args[0") val castArg: String = castToAllowedTypes(arg, pathToItem, pathSet) - val usedConfiguration = Objects.requireNonNullElseGet(configuration) { - SchemaConfiguration( - JsonSchemaKeywordFlags.Builder().build() - ) - } + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) val validationMetadata = - ValidationMetadata(pathToItem, usedConfiguration!!, PathToSchemasMap(), LinkedHashSet()) + ValidationMetadata(pathToItem, usedConfiguration, PathToSchemasMap(), LinkedHashSet()) val pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet) - return getNewInstance(castArg, validationMetadata.pathToItem(), pathToSchemasMap) + return getNewInstance(castArg, validationMetadata.pathToItem, pathToSchemasMap) } @Throws(ValidationException::class) @@ -50,7 +46,7 @@ class DateJsonSchema { override fun getNewInstance(arg: Any?, pathToItem: List, pathToSchemas: PathToSchemasMap): Any? { if (arg is String) { - return getNewInstance(arg as String?, pathToItem, pathToSchemas) + return getNewInstance(arg, pathToItem, pathToSchemas) } throw RuntimeException("Invalid input type=$javaClass. It can't be instantiated by this schema") } diff --git a/src/main/resources/kotlin/src/main/kotlin/packagename/schemas/DateTimeJsonSchema.hbs b/src/main/resources/kotlin/src/main/kotlin/packagename/schemas/DateTimeJsonSchema.hbs index ba877d8217b..a05be510b42 100644 --- a/src/main/resources/kotlin/src/main/kotlin/packagename/schemas/DateTimeJsonSchema.hbs +++ b/src/main/resources/kotlin/src/main/kotlin/packagename/schemas/DateTimeJsonSchema.hbs @@ -1,28 +1,28 @@ -package {{{packageName}}}.schemas; +package {{{packageName}}}.schemas -import {{{packageName}}}.configurations.JsonSchemaKeywordFlags; -import {{{packageName}}}.configurations.SchemaConfiguration; -import {{{packageName}}}.exceptions.ValidationException; -import {{{packageName}}}.schemas.validation.JsonSchema; -import {{{packageName}}}.schemas.validation.JsonSchemaInfo; -import {{{packageName}}}.schemas.validation.PathToSchemasMap; -import {{{packageName}}}.schemas.validation.StringSchemaValidator; -import {{{packageName}}}.schemas.validation.ValidationMetadata; +import {{{packageName}}}.configurations.JsonSchemaKeywordFlags +import {{{packageName}}}.configurations.SchemaConfiguration +import {{{packageName}}}.exceptions.ValidationException +import {{{packageName}}}.schemas.validation.JsonSchema +import {{{packageName}}}.schemas.validation.JsonSchemaInfo +import {{{packageName}}}.schemas.validation.PathToSchemasMap +import {{{packageName}}}.schemas.validation.StringSchemaValidator +import {{{packageName}}}.schemas.validation.ValidationMetadata -import java.time.ZonedDateTime; +import java.time.ZonedDateTime -class DateTimeJsonSchema { +open class DateTimeJsonSchema { sealed interface DateTimeJsonSchema1Boxed { fun getData(): Any? } data class DateTimeJsonSchema1BoxedString(val data: String) : DateTimeJsonSchema1Boxed { - override fun getData(): String { + override fun getData(): Any? { return data } } - class DateTimeJsonSchema1 private constructor() : JsonSchema( + open class DateTimeJsonSchema1 protected constructor() : JsonSchema( JsonSchemaInfo() .type(setOf(String::class.java)) .format("date-time") @@ -46,7 +46,7 @@ class DateTimeJsonSchema { override fun getNewInstance(arg: Any?, pathToItem: List, pathToSchemas: PathToSchemasMap): Any? { if (arg is String) { - return getNewInstance(arg as String?, pathToItem, pathToSchemas) + return getNewInstance(arg, pathToItem, pathToSchemas) } throw RuntimeException("Invalid input type=$javaClass. It can't be instantiated by this schema") } diff --git a/src/main/resources/kotlin/src/main/kotlin/packagename/schemas/DecimalJsonSchema.hbs b/src/main/resources/kotlin/src/main/kotlin/packagename/schemas/DecimalJsonSchema.hbs index 15c0d9e4ee7..6171a40e4e5 100644 --- a/src/main/resources/kotlin/src/main/kotlin/packagename/schemas/DecimalJsonSchema.hbs +++ b/src/main/resources/kotlin/src/main/kotlin/packagename/schemas/DecimalJsonSchema.hbs @@ -1,26 +1,26 @@ -package {{{packageName}}}.schemas; +package {{{packageName}}}.schemas -import {{{packageName}}}.configurations.JsonSchemaKeywordFlags; -import {{{packageName}}}.configurations.SchemaConfiguration; -import {{{packageName}}}.exceptions.ValidationException; -import {{{packageName}}}.schemas.validation.JsonSchema; -import {{{packageName}}}.schemas.validation.JsonSchemaInfo; -import {{{packageName}}}.schemas.validation.PathToSchemasMap; -import {{{packageName}}}.schemas.validation.StringSchemaValidator; -import {{{packageName}}}.schemas.validation.ValidationMetadata; +import {{{packageName}}}.configurations.JsonSchemaKeywordFlags +import {{{packageName}}}.configurations.SchemaConfiguration +import {{{packageName}}}.exceptions.ValidationException +import {{{packageName}}}.schemas.validation.JsonSchema +import {{{packageName}}}.schemas.validation.JsonSchemaInfo +import {{{packageName}}}.schemas.validation.PathToSchemasMap +import {{{packageName}}}.schemas.validation.StringSchemaValidator +import {{{packageName}}}.schemas.validation.ValidationMetadata -class DecimalJsonSchema { +open class DecimalJsonSchema { sealed interface DecimalJsonSchema1Boxed { fun getData(): Any? } data class DecimalJsonSchema1BoxedString(val data: String) : DecimalJsonSchema1Boxed { - override fun getData(): String { + override fun getData(): Any? { return data } } - class DecimalJsonSchema1 private constructor() : JsonSchema( + open class DecimalJsonSchema1 protected constructor() : JsonSchema( JsonSchemaInfo() .type(setOf(String::class.java)) .format("number") @@ -39,7 +39,7 @@ class DecimalJsonSchema { override fun getNewInstance(arg: Any?, pathToItem: List, pathToSchemas: PathToSchemasMap): Any? { if (arg is String) { - return getNewInstance(arg as String?, pathToItem, pathToSchemas) + return getNewInstance(arg, pathToItem, pathToSchemas) } throw RuntimeException("Invalid input type=$javaClass. It can't be instantiated by this schema") } diff --git a/src/main/resources/kotlin/src/main/kotlin/packagename/schemas/DoubleJsonSchema.hbs b/src/main/resources/kotlin/src/main/kotlin/packagename/schemas/DoubleJsonSchema.hbs index 735177b6c6b..013cf67c617 100644 --- a/src/main/resources/kotlin/src/main/kotlin/packagename/schemas/DoubleJsonSchema.hbs +++ b/src/main/resources/kotlin/src/main/kotlin/packagename/schemas/DoubleJsonSchema.hbs @@ -1,30 +1,30 @@ -package {{{packageName}}}.schemas; +package {{{packageName}}}.schemas -import {{{packageName}}}.configurations.JsonSchemaKeywordFlags; -import {{{packageName}}}.configurations.SchemaConfiguration; -import {{{packageName}}}.exceptions.ValidationException; -import {{{packageName}}}.schemas.validation.JsonSchema; -import {{{packageName}}}.schemas.validation.JsonSchemaInfo; -import {{{packageName}}}.schemas.validation.PathToSchemasMap; -import {{{packageName}}}.schemas.validation.NumberSchemaValidator; -import {{{packageName}}}.schemas.validation.ValidationMetadata; +import {{{packageName}}}.configurations.JsonSchemaKeywordFlags +import {{{packageName}}}.configurations.SchemaConfiguration +import {{{packageName}}}.exceptions.ValidationException +import {{{packageName}}}.schemas.validation.JsonSchema +import {{{packageName}}}.schemas.validation.JsonSchemaInfo +import {{{packageName}}}.schemas.validation.PathToSchemasMap +import {{{packageName}}}.schemas.validation.NumberSchemaValidator +import {{{packageName}}}.schemas.validation.ValidationMetadata -class DoubleJsonSchema { +open class DoubleJsonSchema { sealed interface DoubleJsonSchema1Boxed { fun getData(): Any? } data class DoubleJsonSchema1BoxedNumber(val data: Number) : DoubleJsonSchema1Boxed { - override fun getData(): Number { + override fun getData(): Any? { return data } } - class DoubleJsonSchema1 private constructor() : JsonSchema( + open class DoubleJsonSchema1 protected constructor() : JsonSchema( JsonSchemaInfo() {{#if generatorSettings.intsAllowedForFloatDoubleFormats}} .type(setOf( - Integer::class.java, + Int::class.java, Long::class.java, Float::class.java, Double::class.java @@ -53,7 +53,7 @@ class DoubleJsonSchema { override fun getNewInstance(arg: Any?, pathToItem: List, pathToSchemas: PathToSchemasMap): Any? { if (arg is Number) { - return getNewInstance(arg as Number?, pathToItem, pathToSchemas) + return getNewInstance(arg, pathToItem, pathToSchemas) } throw RuntimeException("Invalid input type=$javaClass. It can't be instantiated by this schema") } diff --git a/src/main/resources/kotlin/src/main/kotlin/packagename/schemas/FloatJsonSchema.hbs b/src/main/resources/kotlin/src/main/kotlin/packagename/schemas/FloatJsonSchema.hbs index c8afaeb5684..bd09fff1f20 100644 --- a/src/main/resources/kotlin/src/main/kotlin/packagename/schemas/FloatJsonSchema.hbs +++ b/src/main/resources/kotlin/src/main/kotlin/packagename/schemas/FloatJsonSchema.hbs @@ -1,30 +1,30 @@ -package {{{packageName}}}.schemas; +package {{{packageName}}}.schemas -import {{{packageName}}}.configurations.JsonSchemaKeywordFlags; -import {{{packageName}}}.configurations.SchemaConfiguration; -import {{{packageName}}}.exceptions.ValidationException; -import {{{packageName}}}.schemas.validation.JsonSchema; -import {{{packageName}}}.schemas.validation.JsonSchemaInfo; -import {{{packageName}}}.schemas.validation.PathToSchemasMap; -import {{{packageName}}}.schemas.validation.NumberSchemaValidator; -import {{{packageName}}}.schemas.validation.ValidationMetadata; +import {{{packageName}}}.configurations.JsonSchemaKeywordFlags +import {{{packageName}}}.configurations.SchemaConfiguration +import {{{packageName}}}.exceptions.ValidationException +import {{{packageName}}}.schemas.validation.JsonSchema +import {{{packageName}}}.schemas.validation.JsonSchemaInfo +import {{{packageName}}}.schemas.validation.PathToSchemasMap +import {{{packageName}}}.schemas.validation.NumberSchemaValidator +import {{{packageName}}}.schemas.validation.ValidationMetadata -class FloatJsonSchema { +open class FloatJsonSchema { sealed interface FloatJsonSchema1Boxed { fun getData(): Any? } data class FloatJsonSchema1BoxedNumber(val data: Number) : FloatJsonSchema1Boxed { - override fun getData(): Number { + override fun getData(): Any? { return data } } - class FloatJsonSchema1 private constructor() : JsonSchema( + open class FloatJsonSchema1 protected constructor() : JsonSchema( JsonSchemaInfo() {{#if generatorSettings.intsAllowedForFloatDoubleFormats}} .type(setOf( - Integer::class.java, + Int::class.java, Float::class.java )) {{else}} @@ -51,7 +51,7 @@ class FloatJsonSchema { override fun getNewInstance(arg: Any?, pathToItem: List, pathToSchemas: PathToSchemasMap): Any? { if (arg is Number) { - return getNewInstance(arg as Number?, pathToItem, pathToSchemas) + return getNewInstance(arg, pathToItem, pathToSchemas) } throw RuntimeException("Invalid input type=$javaClass. It can't be instantiated by this schema") } diff --git a/src/main/resources/kotlin/src/main/kotlin/packagename/schemas/GenericBuilder.hbs b/src/main/resources/kotlin/src/main/kotlin/packagename/schemas/GenericBuilder.hbs index 7086941dfc0..fe3d5f4ae43 100644 --- a/src/main/resources/kotlin/src/main/kotlin/packagename/schemas/GenericBuilder.hbs +++ b/src/main/resources/kotlin/src/main/kotlin/packagename/schemas/GenericBuilder.hbs @@ -1,4 +1,4 @@ -package {{{packageName}}}.schemas; +package {{{packageName}}}.schemas /** * Builders must implement this class diff --git a/src/main/resources/kotlin/src/main/kotlin/packagename/schemas/Int32JsonSchema.hbs b/src/main/resources/kotlin/src/main/kotlin/packagename/schemas/Int32JsonSchema.hbs index fcdf3b0d9e5..b231ee210d0 100644 --- a/src/main/resources/kotlin/src/main/kotlin/packagename/schemas/Int32JsonSchema.hbs +++ b/src/main/resources/kotlin/src/main/kotlin/packagename/schemas/Int32JsonSchema.hbs @@ -1,26 +1,26 @@ -package {{{packageName}}}.schemas; +package {{{packageName}}}.schemas -import {{{packageName}}}.configurations.JsonSchemaKeywordFlags; -import {{{packageName}}}.exceptions.ValidationException; -import {{{packageName}}}.schemas.validation.JsonSchema; -import {{{packageName}}}.schemas.validation.JsonSchemaInfo; -import {{{packageName}}}.configurations.SchemaConfiguration; -import {{{packageName}}}.schemas.validation.PathToSchemasMap; -import {{{packageName}}}.schemas.validation.NumberSchemaValidator; -import {{{packageName}}}.schemas.validation.ValidationMetadata; +import {{{packageName}}}.configurations.JsonSchemaKeywordFlags +import {{{packageName}}}.exceptions.ValidationException +import {{{packageName}}}.schemas.validation.JsonSchema +import {{{packageName}}}.schemas.validation.JsonSchemaInfo +import {{{packageName}}}.configurations.SchemaConfiguration +import {{{packageName}}}.schemas.validation.PathToSchemasMap +import {{{packageName}}}.schemas.validation.NumberSchemaValidator +import {{{packageName}}}.schemas.validation.ValidationMetadata -class Int32JsonSchema { +open class Int32JsonSchema { sealed interface Int32JsonSchema1Boxed { fun getData(): Any? } data class Int32JsonSchema1BoxedNumber(val data: Number) : Int32JsonSchema1Boxed { - override fun getData(): Number { + override fun getData(): Any? { return data } } - class Int32JsonSchema1 private constructor() : JsonSchema( + open class Int32JsonSchema1 protected constructor() : JsonSchema( JsonSchemaInfo() .type( setOf( @@ -54,7 +54,7 @@ class Int32JsonSchema { override fun getNewInstance(arg: Any?, pathToItem: List, pathToSchemas: PathToSchemasMap): Any? { if (arg is Number) { - return getNewInstance(arg as Number?, pathToItem, pathToSchemas) + return getNewInstance(arg, pathToItem, pathToSchemas) } throw RuntimeException("Invalid input type=$javaClass. It can't be instantiated by this schema") } diff --git a/src/main/resources/kotlin/src/main/kotlin/packagename/schemas/Int64JsonSchema.hbs b/src/main/resources/kotlin/src/main/kotlin/packagename/schemas/Int64JsonSchema.hbs index 693695434ff..eed468f4a1f 100644 --- a/src/main/resources/kotlin/src/main/kotlin/packagename/schemas/Int64JsonSchema.hbs +++ b/src/main/resources/kotlin/src/main/kotlin/packagename/schemas/Int64JsonSchema.hbs @@ -1,26 +1,26 @@ -package {{{packageName}}}.schemas; +package {{{packageName}}}.schemas -import {{{packageName}}}.configurations.JsonSchemaKeywordFlags; -import {{{packageName}}}.exceptions.ValidationException; -import {{{packageName}}}.schemas.validation.JsonSchema; -import {{{packageName}}}.schemas.validation.JsonSchemaInfo; -import {{{packageName}}}.configurations.SchemaConfiguration; -import {{{packageName}}}.schemas.validation.PathToSchemasMap; -import {{{packageName}}}.schemas.validation.NumberSchemaValidator; -import {{{packageName}}}.schemas.validation.ValidationMetadata; +import {{{packageName}}}.configurations.JsonSchemaKeywordFlags +import {{{packageName}}}.exceptions.ValidationException +import {{{packageName}}}.schemas.validation.JsonSchema +import {{{packageName}}}.schemas.validation.JsonSchemaInfo +import {{{packageName}}}.configurations.SchemaConfiguration +import {{{packageName}}}.schemas.validation.PathToSchemasMap +import {{{packageName}}}.schemas.validation.NumberSchemaValidator +import {{{packageName}}}.schemas.validation.ValidationMetadata -class Int64JsonSchema { +open class Int64JsonSchema { sealed interface Int64JsonSchema1Boxed { fun getData(): Any? } data class Int64JsonSchema1BoxedNumber(val data: Number) : Int64JsonSchema1Boxed { - override fun getData(): Number { + override fun getData(): Any? { return data } } - class Int64JsonSchema1 private constructor() : JsonSchema( + open class Int64JsonSchema1 protected constructor() : JsonSchema( JsonSchemaInfo() .type( setOf( @@ -66,7 +66,7 @@ class Int64JsonSchema { override fun getNewInstance(arg: Any?, pathToItem: List, pathToSchemas: PathToSchemasMap): Any? { if (arg is Number) { - return getNewInstance(arg as Number?, pathToItem, pathToSchemas) + return getNewInstance(arg, pathToItem, pathToSchemas) } throw RuntimeException("Invalid input type=$javaClass. It can't be instantiated by this schema") } diff --git a/src/main/resources/kotlin/src/main/kotlin/packagename/schemas/IntJsonSchema.hbs b/src/main/resources/kotlin/src/main/kotlin/packagename/schemas/IntJsonSchema.hbs index 88b98067776..6678262375d 100644 --- a/src/main/resources/kotlin/src/main/kotlin/packagename/schemas/IntJsonSchema.hbs +++ b/src/main/resources/kotlin/src/main/kotlin/packagename/schemas/IntJsonSchema.hbs @@ -1,26 +1,26 @@ -package {{{packageName}}}.schemas; +package {{{packageName}}}.schemas -import {{{packageName}}}.configurations.JsonSchemaKeywordFlags; -import {{{packageName}}}.exceptions.ValidationException; -import {{{packageName}}}.schemas.validation.JsonSchema; -import {{{packageName}}}.schemas.validation.JsonSchemaInfo; -import {{{packageName}}}.configurations.SchemaConfiguration; -import {{{packageName}}}.schemas.validation.PathToSchemasMap; -import {{{packageName}}}.schemas.validation.NumberSchemaValidator; -import {{{packageName}}}.schemas.validation.ValidationMetadata; +import {{{packageName}}}.configurations.JsonSchemaKeywordFlags +import {{{packageName}}}.exceptions.ValidationException +import {{{packageName}}}.schemas.validation.JsonSchema +import {{{packageName}}}.schemas.validation.JsonSchemaInfo +import {{{packageName}}}.configurations.SchemaConfiguration +import {{{packageName}}}.schemas.validation.PathToSchemasMap +import {{{packageName}}}.schemas.validation.NumberSchemaValidator +import {{{packageName}}}.schemas.validation.ValidationMetadata -class IntJsonSchema { +open class IntJsonSchema { sealed interface IntJsonSchema1Boxed { fun getData(): Any? } data class IntJsonSchema1BoxedNumber(val data: Number) : IntJsonSchema1Boxed { - override fun getData(): Number { + override fun getData(): Any? { return data } } - class IntJsonSchema1 private constructor() : JsonSchema( + open class IntJsonSchema1 protected constructor() : JsonSchema( JsonSchemaInfo() .type( setOf( @@ -66,7 +66,7 @@ class IntJsonSchema { override fun getNewInstance(arg: Any?, pathToItem: List, pathToSchemas: PathToSchemasMap): Any? { if (arg is Number) { - return getNewInstance(arg as Number?, pathToItem, pathToSchemas) + return getNewInstance(arg, pathToItem, pathToSchemas) } throw RuntimeException("Invalid input type=$javaClass. It can't be instantiated by this schema") } diff --git a/src/main/resources/kotlin/src/main/kotlin/packagename/schemas/ListJsonSchema.hbs b/src/main/resources/kotlin/src/main/kotlin/packagename/schemas/ListJsonSchema.hbs index 3d44684252d..547576d4ae6 100644 --- a/src/main/resources/kotlin/src/main/kotlin/packagename/schemas/ListJsonSchema.hbs +++ b/src/main/resources/kotlin/src/main/kotlin/packagename/schemas/ListJsonSchema.hbs @@ -1,27 +1,27 @@ -package {{{packageName}}}.schemas; +package {{{packageName}}}.schemas -import {{{packageName}}}.configurations.JsonSchemaKeywordFlags; -import {{{packageName}}}.exceptions.ValidationException; -import {{{packageName}}}.schemas.validation.FrozenList; -import {{{packageName}}}.schemas.validation.JsonSchema; -import {{{packageName}}}.schemas.validation.JsonSchemaInfo; -import {{{packageName}}}.configurations.SchemaConfiguration; -import {{{packageName}}}.schemas.validation.PathToSchemasMap; -import {{{packageName}}}.schemas.validation.ListSchemaValidator; -import {{{packageName}}}.schemas.validation.ValidationMetadata; +import {{{packageName}}}.configurations.JsonSchemaKeywordFlags +import {{{packageName}}}.exceptions.ValidationException +import {{{packageName}}}.schemas.validation.FrozenList +import {{{packageName}}}.schemas.validation.JsonSchema +import {{{packageName}}}.schemas.validation.JsonSchemaInfo +import {{{packageName}}}.configurations.SchemaConfiguration +import {{{packageName}}}.schemas.validation.PathToSchemasMap +import {{{packageName}}}.schemas.validation.ListSchemaValidator +import {{{packageName}}}.schemas.validation.ValidationMetadata -class ListJsonSchema { +open class ListJsonSchema { sealed interface ListJsonSchema1Boxed { fun getData(): Any? } data class ListJsonSchema1BoxedList(val data: FrozenList) : ListJsonSchema1Boxed { - override fun getData(): FrozenList { + override fun getData(): Any? { return data } } - class ListJsonSchema1 private constructor() : JsonSchema( + open class ListJsonSchema1 protected constructor() : JsonSchema( JsonSchemaInfo() .type(setOf(List::class.java)) ), ListSchemaValidator, ListJsonSchema1BoxedList> { @@ -67,7 +67,7 @@ class ListJsonSchema { @Throws(ValidationException::class) override fun validate(arg: Any?, configuration: SchemaConfiguration?): Any? { if (arg is List<*>) { - return validate(arg as List<*>?, configuration) + return validate(arg, configuration) } throw ValidationException("Invalid input type=$javaClass. It can't be instantiated by this schema") } diff --git a/src/main/resources/kotlin/src/main/kotlin/packagename/schemas/MapJsonSchema.hbs b/src/main/resources/kotlin/src/main/kotlin/packagename/schemas/MapJsonSchema.hbs index 8f5768998a2..fbd87ba9816 100644 --- a/src/main/resources/kotlin/src/main/kotlin/packagename/schemas/MapJsonSchema.hbs +++ b/src/main/resources/kotlin/src/main/kotlin/packagename/schemas/MapJsonSchema.hbs @@ -1,27 +1,27 @@ -package {{{packageName}}}.schemas; +package {{{packageName}}}.schemas -import {{{packageName}}}.configurations.JsonSchemaKeywordFlags; -import {{{packageName}}}.exceptions.ValidationException; -import {{{packageName}}}.schemas.validation.FrozenMap; -import {{{packageName}}}.schemas.validation.JsonSchema; -import {{{packageName}}}.schemas.validation.JsonSchemaInfo; -import {{{packageName}}}.configurations.SchemaConfiguration; -import {{{packageName}}}.schemas.validation.PathToSchemasMap; -import {{{packageName}}}.schemas.validation.MapSchemaValidator; -import {{{packageName}}}.schemas.validation.ValidationMetadata; +import {{{packageName}}}.configurations.JsonSchemaKeywordFlags +import {{{packageName}}}.exceptions.ValidationException +import {{{packageName}}}.schemas.validation.FrozenMap +import {{{packageName}}}.schemas.validation.JsonSchema +import {{{packageName}}}.schemas.validation.JsonSchemaInfo +import {{{packageName}}}.configurations.SchemaConfiguration +import {{{packageName}}}.schemas.validation.PathToSchemasMap +import {{{packageName}}}.schemas.validation.MapSchemaValidator +import {{{packageName}}}.schemas.validation.ValidationMetadata -class MapJsonSchema { +open class MapJsonSchema { sealed interface MapJsonSchema1Boxed { fun getData(): Any? } data class MapJsonSchema1BoxedMap(val data: FrozenMap) : MapJsonSchema1Boxed { - override fun getData(): FrozenMap { + override fun getData(): Any? { return data } } - class MapJsonSchema1 private constructor() : JsonSchema( + open class MapJsonSchema1 protected constructor() : JsonSchema( JsonSchemaInfo() .type(setOf(Map::class.java)) ), MapSchemaValidator, MapJsonSchema1BoxedMap> { @@ -58,8 +58,8 @@ class MapJsonSchema { } override fun getNewInstance(arg: Any?, pathToItem: List, pathToSchemas: PathToSchemasMap): FrozenMap { - if (arg is FrozenMap<*>) { - return getNewInstance(arg as Map<*, *>, pathToItem, pathToSchemas) + if (arg is Map<*, *>) { + return getNewInstance(arg, pathToItem, pathToSchemas) } throw RuntimeException("Invalid input type=$javaClass. It can't be instantiated by this schema") } @@ -67,7 +67,7 @@ class MapJsonSchema { @Throws(ValidationException::class) override fun validate(arg: Any?, configuration: SchemaConfiguration?): Any? { if (arg is Map<*, *>) { - return validate(arg as Map<*, *>?, configuration) + return validate(arg, configuration) } throw ValidationException("Invalid input type=$javaClass. It can't be validated by this schema") } diff --git a/src/main/resources/kotlin/src/main/kotlin/packagename/schemas/NotAnyTypeJsonSchema.hbs b/src/main/resources/kotlin/src/main/kotlin/packagename/schemas/NotAnyTypeJsonSchema.hbs index 74a9621c013..57d7990bfeb 100644 --- a/src/main/resources/kotlin/src/main/kotlin/packagename/schemas/NotAnyTypeJsonSchema.hbs +++ b/src/main/resources/kotlin/src/main/kotlin/packagename/schemas/NotAnyTypeJsonSchema.hbs @@ -1,26 +1,26 @@ -package {{{packageName}}}.schemas; - -import {{{packageName}}}.configurations.JsonSchemaKeywordFlags; -import {{{packageName}}}.configurations.SchemaConfiguration; -import {{{packageName}}}.exceptions.ValidationException; -import {{{packageName}}}.schemas.validation.FrozenList; -import {{{packageName}}}.schemas.validation.FrozenMap; -import {{{packageName}}}.schemas.validation.JsonSchema; -import {{{packageName}}}.schemas.validation.JsonSchemaInfo; -import {{{packageName}}}.schemas.validation.PathToSchemasMap; -import {{{packageName}}}.schemas.validation.NullSchemaValidator; -import {{{packageName}}}.schemas.validation.BooleanSchemaValidator; -import {{{packageName}}}.schemas.validation.NumberSchemaValidator; -import {{{packageName}}}.schemas.validation.StringSchemaValidator; -import {{{packageName}}}.schemas.validation.ListSchemaValidator; -import {{{packageName}}}.schemas.validation.MapSchemaValidator; -import {{{packageName}}}.schemas.validation.ValidationMetadata; +package {{{packageName}}}.schemas + +import {{{packageName}}}.configurations.JsonSchemaKeywordFlags +import {{{packageName}}}.configurations.SchemaConfiguration +import {{{packageName}}}.exceptions.ValidationException +import {{{packageName}}}.schemas.validation.FrozenList +import {{{packageName}}}.schemas.validation.FrozenMap +import {{{packageName}}}.schemas.validation.JsonSchema +import {{{packageName}}}.schemas.validation.JsonSchemaInfo +import {{{packageName}}}.schemas.validation.PathToSchemasMap +import {{{packageName}}}.schemas.validation.NullSchemaValidator +import {{{packageName}}}.schemas.validation.BooleanSchemaValidator +import {{{packageName}}}.schemas.validation.NumberSchemaValidator +import {{{packageName}}}.schemas.validation.StringSchemaValidator +import {{{packageName}}}.schemas.validation.ListSchemaValidator +import {{{packageName}}}.schemas.validation.MapSchemaValidator +import {{{packageName}}}.schemas.validation.ValidationMetadata import java.time.LocalDate import java.time.ZonedDateTime import java.util.UUID -class NotAnyTypeJsonSchema { +open class NotAnyTypeJsonSchema { sealed interface NotAnyTypeJsonSchema1Boxed { fun getData(): Any? } @@ -34,7 +34,7 @@ class NotAnyTypeJsonSchema { data class NotAnyTypeJsonSchema1BoxedBoolean(val data: Boolean) : NotAnyTypeJsonSchema1Boxed { - override fun getData(): Boolean { + override fun getData(): Any? { return data } @@ -42,40 +42,40 @@ class NotAnyTypeJsonSchema { data class NotAnyTypeJsonSchema1BoxedNumber(val data: Number) : NotAnyTypeJsonSchema1Boxed { - override fun getData(): Number { + override fun getData(): Any? { return data } } data class NotAnyTypeJsonSchema1BoxedString(val data: String) : NotAnyTypeJsonSchema1Boxed { - override fun getData(): String { + override fun getData(): Any? { return data } } data class NotAnyTypeJsonSchema1BoxedList(val data: FrozenList) : NotAnyTypeJsonSchema1Boxed { - override fun getData(): FrozenList { + override fun getData(): Any? { return data } } data class NotAnyTypeJsonSchema1BoxedMap(val data: FrozenMap) : NotAnyTypeJsonSchema1Boxed { - override fun getData(): FrozenMap { + override fun getData(): Any? { return data } } - class NotAnyTypeJsonSchema1 private constructor() : JsonSchema( + open class NotAnyTypeJsonSchema1 protected constructor() : JsonSchema( JsonSchemaInfo() - .not(AnyTypeJsonSchema1::class.java) - ), NullSchemaValidator, BooleanSchemaValidator, - NumberSchemaValidator, - StringSchemaValidator, - ListSchemaValidator?, NotAnyTypeJsonSchema1BoxedList?>, - MapSchemaValidator?, NotAnyTypeJsonSchema1BoxedMap?> { + .not(AnyTypeJsonSchema.AnyTypeJsonSchema1::class.java) + ), NullSchemaValidator, BooleanSchemaValidator, + NumberSchemaValidator, + StringSchemaValidator, + ListSchemaValidator, NotAnyTypeJsonSchema1BoxedList>, + MapSchemaValidator, NotAnyTypeJsonSchema1BoxedMap> { @Throws(ValidationException::class) override fun validate(arg: Nothing?, configuration: SchemaConfiguration?): Nothing? { val pathSet: MutableSet> = HashSet() @@ -240,11 +240,11 @@ class NotAnyTypeJsonSchema { } is Number -> { - return getNewInstance(arg as Number?, pathToItem, pathToSchemas) + return getNewInstance(arg, pathToItem, pathToSchemas) } is String -> { - return getNewInstance(arg as String?, pathToItem, pathToSchemas) + return getNewInstance(arg, pathToItem, pathToSchemas) } is List<*> -> { @@ -278,11 +278,11 @@ class NotAnyTypeJsonSchema { } is List<*> -> { - return validate(arg as List<*>?, configuration) + return validate(arg, configuration) } is Map<*, *> -> { - return validate(arg as Map<*, *>?, configuration) + return validate(arg, configuration) } else -> throw ValidationException("Invalid input type=$javaClass. It can't be validated by this schema") diff --git a/src/main/resources/kotlin/src/main/kotlin/packagename/schemas/NullJsonSchema.hbs b/src/main/resources/kotlin/src/main/kotlin/packagename/schemas/NullJsonSchema.hbs index c7d5577fa85..46de713d3b7 100644 --- a/src/main/resources/kotlin/src/main/kotlin/packagename/schemas/NullJsonSchema.hbs +++ b/src/main/resources/kotlin/src/main/kotlin/packagename/schemas/NullJsonSchema.hbs @@ -1,15 +1,15 @@ -package {{{packageName}}}.schemas; +package {{{packageName}}}.schemas -import {{{packageName}}}.configurations.JsonSchemaKeywordFlags; -import {{{packageName}}}.configurations.SchemaConfiguration; -import {{{packageName}}}.exceptions.ValidationException; -import {{{packageName}}}.schemas.validation.JsonSchema; -import {{{packageName}}}.schemas.validation.JsonSchemaInfo; -import {{{packageName}}}.schemas.validation.PathToSchemasMap; -import {{{packageName}}}.schemas.validation.NullSchemaValidator; -import {{{packageName}}}.schemas.validation.ValidationMetadata; +import {{{packageName}}}.configurations.JsonSchemaKeywordFlags +import {{{packageName}}}.configurations.SchemaConfiguration +import {{{packageName}}}.exceptions.ValidationException +import {{{packageName}}}.schemas.validation.JsonSchema +import {{{packageName}}}.schemas.validation.JsonSchemaInfo +import {{{packageName}}}.schemas.validation.PathToSchemasMap +import {{{packageName}}}.schemas.validation.NullSchemaValidator +import {{{packageName}}}.schemas.validation.ValidationMetadata -class NullJsonSchema { +open class NullJsonSchema { sealed interface NullJsonSchema1Boxed { fun getData(): Any? } @@ -20,7 +20,7 @@ class NullJsonSchema { } } - class NullJsonSchema1 private constructor() : JsonSchema( + open class NullJsonSchema1 protected constructor() : JsonSchema( JsonSchemaInfo() .type(setOf(Void::class.java)) ), NullSchemaValidator { diff --git a/src/main/resources/kotlin/src/main/kotlin/packagename/schemas/NumberJsonSchema.hbs b/src/main/resources/kotlin/src/main/kotlin/packagename/schemas/NumberJsonSchema.hbs index 7964b5deb83..c589c785111 100644 --- a/src/main/resources/kotlin/src/main/kotlin/packagename/schemas/NumberJsonSchema.hbs +++ b/src/main/resources/kotlin/src/main/kotlin/packagename/schemas/NumberJsonSchema.hbs @@ -1,26 +1,26 @@ -package {{{packageName}}}.schemas; +package {{{packageName}}}.schemas -import {{{packageName}}}.configurations.JsonSchemaKeywordFlags; -import {{{packageName}}}.exceptions.ValidationException; -import {{{packageName}}}.schemas.validation.JsonSchema; -import {{{packageName}}}.schemas.validation.JsonSchemaInfo; -import {{{packageName}}}.configurations.SchemaConfiguration; -import {{{packageName}}}.schemas.validation.PathToSchemasMap; -import {{{packageName}}}.schemas.validation.NumberSchemaValidator; -import {{{packageName}}}.schemas.validation.ValidationMetadata; +import {{{packageName}}}.configurations.JsonSchemaKeywordFlags +import {{{packageName}}}.exceptions.ValidationException +import {{{packageName}}}.schemas.validation.JsonSchema +import {{{packageName}}}.schemas.validation.JsonSchemaInfo +import {{{packageName}}}.configurations.SchemaConfiguration +import {{{packageName}}}.schemas.validation.PathToSchemasMap +import {{{packageName}}}.schemas.validation.NumberSchemaValidator +import {{{packageName}}}.schemas.validation.ValidationMetadata -class NumberJsonSchema { +open class NumberJsonSchema { sealed interface NumberJsonSchema1Boxed { fun getData(): Any? } data class NumberJsonSchema1BoxedNumber(val data: Number) : NumberJsonSchema1Boxed { - override fun getData(): Number { + override fun getData(): Any? { return data } } - class NumberJsonSchema1 private constructor() : JsonSchema( + open class NumberJsonSchema1 protected constructor() : JsonSchema( JsonSchemaInfo() .type( setOf( @@ -65,7 +65,7 @@ class NumberJsonSchema { override fun getNewInstance(arg: Any?, pathToItem: List, pathToSchemas: PathToSchemasMap): Any? { if (arg is Number) { - return getNewInstance(arg as Number?, pathToItem, pathToSchemas) + return getNewInstance(arg, pathToItem, pathToSchemas) } throw RuntimeException("Invalid input type=$javaClass. It can't be instantiated by this schema") } diff --git a/src/main/resources/kotlin/src/main/kotlin/packagename/schemas/SetMaker.hbs b/src/main/resources/kotlin/src/main/kotlin/packagename/schemas/SetMaker.hbs deleted file mode 100644 index e87b98cfb1a..00000000000 --- a/src/main/resources/kotlin/src/main/kotlin/packagename/schemas/SetMaker.hbs +++ /dev/null @@ -1,20 +0,0 @@ -package {{{packageName}}}.schemas; - -import java.util.HashSet; -import java.util.Set; - -/** - * A builder for maps that allows in null values - * Schema tests + doc code samples need it - */ -public class SetMaker { - @SafeVarargs - @SuppressWarnings("varargs") - public static Set makeSet(E... items) { - Set set = new HashSet<>(); - for (E item : items) { - set.add(item); - } - return set; - } -} \ No newline at end of file diff --git a/src/main/resources/kotlin/src/main/kotlin/packagename/schemas/StringJsonSchema.hbs b/src/main/resources/kotlin/src/main/kotlin/packagename/schemas/StringJsonSchema.hbs index 135f242e72b..ab6aa26f6a7 100644 --- a/src/main/resources/kotlin/src/main/kotlin/packagename/schemas/StringJsonSchema.hbs +++ b/src/main/resources/kotlin/src/main/kotlin/packagename/schemas/StringJsonSchema.hbs @@ -1,30 +1,30 @@ -package {{{packageName}}}.schemas; +package {{{packageName}}}.schemas -import {{{packageName}}}.configurations.JsonSchemaKeywordFlags; -import {{{packageName}}}.configurations.SchemaConfiguration; -import {{{packageName}}}.exceptions.ValidationException; -import {{{packageName}}}.schemas.validation.JsonSchema; -import {{{packageName}}}.schemas.validation.JsonSchemaInfo; -import {{{packageName}}}.schemas.validation.PathToSchemasMap; -import {{{packageName}}}.schemas.validation.StringSchemaValidator; -import {{{packageName}}}.schemas.validation.ValidationMetadata; +import {{{packageName}}}.configurations.JsonSchemaKeywordFlags +import {{{packageName}}}.configurations.SchemaConfiguration +import {{{packageName}}}.exceptions.ValidationException +import {{{packageName}}}.schemas.validation.JsonSchema +import {{{packageName}}}.schemas.validation.JsonSchemaInfo +import {{{packageName}}}.schemas.validation.PathToSchemasMap +import {{{packageName}}}.schemas.validation.StringSchemaValidator +import {{{packageName}}}.schemas.validation.ValidationMetadata import java.time.LocalDate import java.time.ZonedDateTime import java.util.UUID -class StringJsonSchema { +open class StringJsonSchema { interface StringJsonSchema1Boxed { fun getData(): Any? } data class StringJsonSchema1BoxedString(val data: String) : StringJsonSchema1Boxed { - override fun getData(): String { + override fun getData(): Any? { return data } } - class StringJsonSchema1 private constructor() : JsonSchema( + open class StringJsonSchema1 protected constructor() : JsonSchema( JsonSchemaInfo() .type(setOf(String::class.java)) ), StringSchemaValidator { @@ -57,7 +57,7 @@ class StringJsonSchema { override fun getNewInstance(arg: Any?, pathToItem: List, pathToSchemas: PathToSchemasMap): Any? { if (arg is String) { - return getNewInstance(arg as String?, pathToItem, pathToSchemas) + return getNewInstance(arg, pathToItem, pathToSchemas) } throw RuntimeException("Invalid input type=$javaClass. It can't be instantiated by this schema") } diff --git a/src/main/resources/kotlin/src/main/kotlin/packagename/schemas/UnsetAddPropsSetter.hbs b/src/main/resources/kotlin/src/main/kotlin/packagename/schemas/UnsetAddPropsSetter.hbs index 1f6766a6196..fef64c9e967 100644 --- a/src/main/resources/kotlin/src/main/kotlin/packagename/schemas/UnsetAddPropsSetter.hbs +++ b/src/main/resources/kotlin/src/main/kotlin/packagename/schemas/UnsetAddPropsSetter.hbs @@ -1,77 +1,81 @@ -package {{{packageName}}}.schemas; +package {{{packageName}}}.schemas -import org.checkerframework.checker.nullness.qual.Nullable; -import {{{packageName}}}.exceptions.InvalidAdditionalPropertyException; -import {{{packageName}}}.schemas.validation.MapUtils; +import {{{packageName}}}.exceptions.InvalidAdditionalPropertyException +import {{{packageName}}}.schemas.validation.MapUtils -import java.util.List; -import java.util.Map; -import java.util.Set; - -public abstract class UnsetAddPropsSetter { - public abstract Map getInstance(); - public abstract Set getKnownKeys(); - public abstract T getBuilderAfterAdditionalProperty(Map instance); - public T additionalProperty(String key, Nothing? value) throws InvalidAdditionalPropertyException { - MapUtils.throwIfKeyKnown(key, getKnownKeys(), true); - var instance = getInstance(); - instance.put(key, value); - return getBuilderAfterAdditionalProperty(instance); +interface UnsetAddPropsSetter { + fun getInstance(): MutableMap + fun getKnownKeys(): Set + fun getBuilderAfterAdditionalProperty(instance: MutableMap): T + @Throws(InvalidAdditionalPropertyException::class) + fun additionalProperty(key: String, value: Void): T { + MapUtils.throwIfKeyKnown(key, getKnownKeys(), true) + val instance = getInstance() + instance[key] = value + return getBuilderAfterAdditionalProperty(instance) } - public T additionalProperty(String key, boolean value) throws InvalidAdditionalPropertyException { - MapUtils.throwIfKeyKnown(key, getKnownKeys(), true); - var instance = getInstance(); - instance.put(key, value); - return getBuilderAfterAdditionalProperty(instance); + @Throws(InvalidAdditionalPropertyException::class) + fun additionalProperty(key: String, value: Boolean): T { + MapUtils.throwIfKeyKnown(key, getKnownKeys(), true) + val instance = getInstance() + instance[key] = value + return getBuilderAfterAdditionalProperty(instance) } - public T additionalProperty(String key, String value) throws InvalidAdditionalPropertyException { - MapUtils.throwIfKeyKnown(key, getKnownKeys(), true); - var instance = getInstance(); - instance.put(key, value); - return getBuilderAfterAdditionalProperty(instance); + @Throws(InvalidAdditionalPropertyException::class) + fun additionalProperty(key: String, value: String): T { + MapUtils.throwIfKeyKnown(key, getKnownKeys(), true) + val instance = getInstance() + instance[key] = value + return getBuilderAfterAdditionalProperty(instance) } - public T additionalProperty(String key, int value) throws InvalidAdditionalPropertyException { - MapUtils.throwIfKeyKnown(key, getKnownKeys(), true); - var instance = getInstance(); - instance.put(key, value); - return getBuilderAfterAdditionalProperty(instance); + @Throws(InvalidAdditionalPropertyException::class) + fun additionalProperty(key: String, value: Int): T { + MapUtils.throwIfKeyKnown(key, getKnownKeys(), true) + val instance = getInstance() + instance[key] = value + return getBuilderAfterAdditionalProperty(instance) } - public T additionalProperty(String key, float value) throws InvalidAdditionalPropertyException { - MapUtils.throwIfKeyKnown(key, getKnownKeys(), true); - var instance = getInstance(); - instance.put(key, value); - return getBuilderAfterAdditionalProperty(instance); + @Throws(InvalidAdditionalPropertyException::class) + fun additionalProperty(key: String, value: Float): T { + MapUtils.throwIfKeyKnown(key, getKnownKeys(), true) + val instance = getInstance() + instance[key] = value + return getBuilderAfterAdditionalProperty(instance) } - public T additionalProperty(String key, long value) throws InvalidAdditionalPropertyException { - MapUtils.throwIfKeyKnown(key, getKnownKeys(), true); - var instance = getInstance(); - instance.put(key, value); - return getBuilderAfterAdditionalProperty(instance); + @Throws(InvalidAdditionalPropertyException::class) + fun additionalProperty(key: String, value: Long): T { + MapUtils.throwIfKeyKnown(key, getKnownKeys(), true) + val instance = getInstance() + instance[key] = value + return getBuilderAfterAdditionalProperty(instance) } - public T additionalProperty(String key, double value) throws InvalidAdditionalPropertyException { - MapUtils.throwIfKeyKnown(key, getKnownKeys(), true); - var instance = getInstance(); - instance.put(key, value); - return getBuilderAfterAdditionalProperty(instance); + @Throws(InvalidAdditionalPropertyException::class) + fun additionalProperty(key: String, value: Double): T { + MapUtils.throwIfKeyKnown(key, getKnownKeys(), true) + val instance = getInstance() + instance[key] = value + return getBuilderAfterAdditionalProperty(instance) } - public T additionalProperty(String key, List value) throws InvalidAdditionalPropertyException { - MapUtils.throwIfKeyKnown(key, getKnownKeys(), true); - var instance = getInstance(); - instance.put(key, value); - return getBuilderAfterAdditionalProperty(instance); + @Throws(InvalidAdditionalPropertyException::class) + fun additionalProperty(key: String, value: List<*>): T { + MapUtils.throwIfKeyKnown(key, getKnownKeys(), true) + val instance = getInstance() + instance[key] = value + return getBuilderAfterAdditionalProperty(instance) } - public T additionalProperty(String key, Map value) throws InvalidAdditionalPropertyException { - MapUtils.throwIfKeyKnown(key, getKnownKeys(), true); - var instance = getInstance(); - instance.put(key, value); - return getBuilderAfterAdditionalProperty(instance); + @Throws(InvalidAdditionalPropertyException::class) + fun additionalProperty(key: String, value: Map): T { + MapUtils.throwIfKeyKnown(key, getKnownKeys(), true) + val instance = getInstance() + instance[key] = value + return getBuilderAfterAdditionalProperty(instance) } -} +} \ No newline at end of file diff --git a/src/main/resources/kotlin/src/main/kotlin/packagename/schemas/UuidJsonSchema.hbs b/src/main/resources/kotlin/src/main/kotlin/packagename/schemas/UuidJsonSchema.hbs index 5a6f515c37f..ede93de721c 100644 --- a/src/main/resources/kotlin/src/main/kotlin/packagename/schemas/UuidJsonSchema.hbs +++ b/src/main/resources/kotlin/src/main/kotlin/packagename/schemas/UuidJsonSchema.hbs @@ -1,94 +1,87 @@ -package {{{packageName}}}.schemas; +package {{{packageName}}}.schemas -import {{{packageName}}}.configurations.JsonSchemaKeywordFlags; -import {{{packageName}}}.exceptions.ValidationException; -import {{{packageName}}}.schemas.validation.JsonSchema; -import {{{packageName}}}.schemas.validation.JsonSchemaInfo; -import {{{packageName}}}.configurations.SchemaConfiguration; -import {{{packageName}}}.schemas.validation.PathToSchemasMap; -import {{{packageName}}}.schemas.validation.StringSchemaValidator; -import {{{packageName}}}.schemas.validation.ValidationMetadata; -import org.checkerframework.checker.nullness.qual.Nullable; +import {{{packageName}}}.configurations.JsonSchemaKeywordFlags +import {{{packageName}}}.exceptions.ValidationException +import {{{packageName}}}.schemas.validation.JsonSchema +import {{{packageName}}}.schemas.validation.JsonSchemaInfo +import {{{packageName}}}.configurations.SchemaConfiguration +import {{{packageName}}}.schemas.validation.PathToSchemasMap +import {{{packageName}}}.schemas.validation.StringSchemaValidator +import {{{packageName}}}.schemas.validation.ValidationMetadata -import java.util.HashSet; -import java.util.LinkedHashSet; -import java.util.List; -import java.util.Objects; -import java.util.Set; -import java.util.UUID; +import java.util.UUID -public class UuidJsonSchema { - public sealed interface UuidJsonSchema1Boxed permits UuidJsonSchema1BoxedString { - @Nullable Object getData(); +open class UuidJsonSchema { + sealed interface UuidJsonSchema1Boxed { + fun getData(): Any? } - public record UuidJsonSchema1BoxedString(String data) implements UuidJsonSchema1Boxed { - @Override - public @Nullable Object getData() { - return data; + + data class UuidJsonSchema1BoxedString(val data: String) : UuidJsonSchema1Boxed { + override fun getData(): Any? { + return data } } - public static class UuidJsonSchema1 extends JsonSchema implements StringSchemaValidator { - private static @Nullable UuidJsonSchema1 instance = null; - - protected UuidJsonSchema1() { - super(new JsonSchemaInfo() - .type(Set.of(String.class)) - .format("uuid") - ); + open class UuidJsonSchema1 protected constructor() : JsonSchema( + JsonSchemaInfo() + .type(setOf(String::class.java)) + .format("uuid") + ), StringSchemaValidator { + @Throws(ValidationException::class) + override fun validate(arg: String, configuration: SchemaConfiguration?): String { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg: String = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validationMetadata = + ValidationMetadata(pathToItem, usedConfiguration, PathToSchemasMap(), LinkedHashSet()) + val pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet) + return getNewInstance(castArg, validationMetadata.pathToItem, pathToSchemasMap) } - public static UuidJsonSchema1 getInstance() { - if (instance == null) { - instance = new UuidJsonSchema1(); - } - return instance; + @Throws(ValidationException::class) + fun validate(arg: UUID, configuration: SchemaConfiguration?): String { + return validate(arg.toString(), configuration) } - @Override - public String validate(String arg, SchemaConfiguration configuration) throws ValidationException { - Set> pathSet = new HashSet<>(); - List pathToItem = List.of("args[0"); - String castArg = castToAllowedTypes(arg, pathToItem, pathSet); - SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().build())); - ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, new PathToSchemasMap(), new LinkedHashSet<>()); - PathToSchemasMap pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet); - return getNewInstance(castArg, validationMetadata.pathToItem(), pathToSchemasMap); + override fun getNewInstance(arg: Any?, pathToItem: List, pathToSchemas: PathToSchemasMap): String { + if (arg is String) { + return getNewInstance(arg, pathToItem, pathToSchemas) + } + throw RuntimeException("Invalid input type=$javaClass. It can't be instantiated by this schema") } - public String validate(UUID arg, SchemaConfiguration configuration) throws ValidationException { - return validate(arg.toString(), configuration); + @Throws(ValidationException::class) + override fun validate(arg: Any?, configuration: SchemaConfiguration?): String { + if (arg is UUID) { + return validate(arg, configuration) + } else if (arg is String) { + return validate(arg, configuration) + } + throw ValidationException("Invalid input type=$javaClass. It can't be validated by this schema") } - @Override - public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { - 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"); + @Throws(ValidationException::class) + override fun validateAndBox(arg: String, configuration: SchemaConfiguration?): UuidJsonSchema1BoxedString { + return UuidJsonSchema1BoxedString(validate(arg, configuration)) } - @Override - 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); + @Throws(ValidationException::class) + override fun validateAndBox(arg: Any?, configuration: SchemaConfiguration?): UuidJsonSchema1Boxed { + if (arg is String) { + return validateAndBox(arg, configuration) } - throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw ValidationException("Invalid input type=$javaClass. It can't be validated by this schema") } - @Override - public UuidJsonSchema1BoxedString validateAndBox(String arg, SchemaConfiguration configuration) throws ValidationException { - return new UuidJsonSchema1BoxedString(validate(arg, configuration)); - } + companion object { + @Volatile + private var instance: UuidJsonSchema1? = null - @Override - public UuidJsonSchema1Boxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { - 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"); + fun getInstance() = + instance ?: synchronized(this) { + instance ?: UuidJsonSchema1().also { instance = it } + } } } } \ No newline at end of file diff --git a/src/main/resources/kotlin/src/main/kotlin/packagename/schemas/validation/AdditionalPropertiesValidator.hbs b/src/main/resources/kotlin/src/main/kotlin/packagename/schemas/validation/AdditionalPropertiesValidator.hbs index daa4d7b5a20..de0c81c86e9 100644 --- a/src/main/resources/kotlin/src/main/kotlin/packagename/schemas/validation/AdditionalPropertiesValidator.hbs +++ b/src/main/resources/kotlin/src/main/kotlin/packagename/schemas/validation/AdditionalPropertiesValidator.hbs @@ -1,6 +1,6 @@ -package {{{packageName}}}.schemas.validation; +package {{{packageName}}}.schemas.validation -import {{{packageName}}}.exceptions.ValidationException; +import {{{packageName}}}.exceptions.ValidationException class AdditionalPropertiesValidator : KeywordValidator { @Throws(ValidationException::class) diff --git a/src/main/resources/kotlin/src/main/kotlin/packagename/schemas/validation/AllOfValidator.hbs b/src/main/resources/kotlin/src/main/kotlin/packagename/schemas/validation/AllOfValidator.hbs index 4ab7af7c450..93bc1983419 100644 --- a/src/main/resources/kotlin/src/main/kotlin/packagename/schemas/validation/AllOfValidator.hbs +++ b/src/main/resources/kotlin/src/main/kotlin/packagename/schemas/validation/AllOfValidator.hbs @@ -1,6 +1,6 @@ -package {{{packageName}}}.schemas.validation; +package {{{packageName}}}.schemas.validation -import {{{packageName}}}.exceptions.ValidationException; +import {{{packageName}}}.exceptions.ValidationException class AllOfValidator : KeywordValidator { @Throws(ValidationException::class) diff --git a/src/main/resources/kotlin/src/main/kotlin/packagename/schemas/validation/AnyOfValidator.hbs b/src/main/resources/kotlin/src/main/kotlin/packagename/schemas/validation/AnyOfValidator.hbs index 639db2e2061..7e07fb675e9 100644 --- a/src/main/resources/kotlin/src/main/kotlin/packagename/schemas/validation/AnyOfValidator.hbs +++ b/src/main/resources/kotlin/src/main/kotlin/packagename/schemas/validation/AnyOfValidator.hbs @@ -1,6 +1,6 @@ -package {{{packageName}}}.schemas.validation; +package {{{packageName}}}.schemas.validation -import {{{packageName}}}.exceptions.ValidationException; +import {{{packageName}}}.exceptions.ValidationException class AnyOfValidator : KeywordValidator { @Throws(ValidationException::class) diff --git a/src/main/resources/kotlin/src/main/kotlin/packagename/schemas/validation/BigDecimalValidator.hbs b/src/main/resources/kotlin/src/main/kotlin/packagename/schemas/validation/BigDecimalValidator.hbs index 96a4754e6b4..587abba4970 100644 --- a/src/main/resources/kotlin/src/main/kotlin/packagename/schemas/validation/BigDecimalValidator.hbs +++ b/src/main/resources/kotlin/src/main/kotlin/packagename/schemas/validation/BigDecimalValidator.hbs @@ -1,8 +1,8 @@ -package {{{packageName}}}.schemas.validation; +package {{{packageName}}}.schemas.validation -import {{{packageName}}}.exceptions.ValidationException; +import {{{packageName}}}.exceptions.ValidationException -import java.math.BigDecimal; +import java.math.BigDecimal abstract class BigDecimalValidator { @Throws(ValidationException::class) diff --git a/src/main/resources/kotlin/src/main/kotlin/packagename/schemas/validation/BooleanEnumValidator.hbs b/src/main/resources/kotlin/src/main/kotlin/packagename/schemas/validation/BooleanEnumValidator.hbs index f9ecf469846..4c58f485015 100644 --- a/src/main/resources/kotlin/src/main/kotlin/packagename/schemas/validation/BooleanEnumValidator.hbs +++ b/src/main/resources/kotlin/src/main/kotlin/packagename/schemas/validation/BooleanEnumValidator.hbs @@ -1,8 +1,9 @@ -package {{{packageName}}}.schemas.validation; +package {{{packageName}}}.schemas.validation -import {{{packageName}}}.configurations.SchemaConfiguration; -import {{{packageName}}}.exceptions.ValidationException; +import {{{packageName}}}.configurations.SchemaConfiguration +import {{{packageName}}}.exceptions.ValidationException -public interface BooleanEnumValidator { - boolean validate(EnumType arg, SchemaConfiguration configuration) throws ValidationException; +interface BooleanEnumValidator { + @Throws(ValidationException::class) + fun validate(arg: EnumType, configuration: SchemaConfiguration?): Boolean } \ No newline at end of file diff --git a/src/main/resources/kotlin/src/main/kotlin/packagename/schemas/validation/BooleanSchemaValidator.hbs b/src/main/resources/kotlin/src/main/kotlin/packagename/schemas/validation/BooleanSchemaValidator.hbs index d7104fd5bec..b2a472fc02e 100644 --- a/src/main/resources/kotlin/src/main/kotlin/packagename/schemas/validation/BooleanSchemaValidator.hbs +++ b/src/main/resources/kotlin/src/main/kotlin/packagename/schemas/validation/BooleanSchemaValidator.hbs @@ -1,7 +1,7 @@ -package {{{packageName}}}.schemas.validation; +package {{{packageName}}}.schemas.validation -import {{{packageName}}}.configurations.SchemaConfiguration; -import {{{packageName}}}.exceptions.ValidationException; +import {{{packageName}}}.configurations.SchemaConfiguration +import {{{packageName}}}.exceptions.ValidationException interface BooleanSchemaValidator { @Throws(ValidationException::class) diff --git a/src/main/resources/kotlin/src/main/kotlin/packagename/schemas/validation/BooleanValueMethod.hbs b/src/main/resources/kotlin/src/main/kotlin/packagename/schemas/validation/BooleanValueMethod.hbs index 6fc89580057..0304f1bc033 100644 --- a/src/main/resources/kotlin/src/main/kotlin/packagename/schemas/validation/BooleanValueMethod.hbs +++ b/src/main/resources/kotlin/src/main/kotlin/packagename/schemas/validation/BooleanValueMethod.hbs @@ -1,5 +1,5 @@ -package {{{packageName}}}.schemas.validation; +package {{{packageName}}}.schemas.validation -public interface BooleanValueMethod { - boolean value(); +interface BooleanValueMethod { + fun value(): Boolean } \ No newline at end of file diff --git a/src/main/resources/kotlin/src/main/kotlin/packagename/schemas/validation/ConstValidator.hbs b/src/main/resources/kotlin/src/main/kotlin/packagename/schemas/validation/ConstValidator.hbs index dc781da65c6..64bc4e9c261 100644 --- a/src/main/resources/kotlin/src/main/kotlin/packagename/schemas/validation/ConstValidator.hbs +++ b/src/main/resources/kotlin/src/main/kotlin/packagename/schemas/validation/ConstValidator.hbs @@ -1,8 +1,8 @@ -package {{{packageName}}}.schemas.validation; +package {{{packageName}}}.schemas.validation -import {{{packageName}}}.exceptions.ValidationException; +import {{{packageName}}}.exceptions.ValidationException -import java.math.BigDecimal; +import java.math.BigDecimal class ConstValidator : BigDecimalValidator(), KeywordValidator { @Throws(ValidationException::class) diff --git a/src/main/resources/kotlin/src/main/kotlin/packagename/schemas/validation/ContainsValidator.hbs b/src/main/resources/kotlin/src/main/kotlin/packagename/schemas/validation/ContainsValidator.hbs index 9e94ecf5b94..ca9b897fa03 100644 --- a/src/main/resources/kotlin/src/main/kotlin/packagename/schemas/validation/ContainsValidator.hbs +++ b/src/main/resources/kotlin/src/main/kotlin/packagename/schemas/validation/ContainsValidator.hbs @@ -1,6 +1,6 @@ -package {{{packageName}}}.schemas.validation; +package {{{packageName}}}.schemas.validation -import {{{packageName}}}.exceptions.ValidationException; +import {{{packageName}}}.exceptions.ValidationException class ContainsValidator : KeywordValidator { @Throws(ValidationException::class) diff --git a/src/main/resources/kotlin/src/main/kotlin/packagename/schemas/validation/CustomIsoparser.hbs b/src/main/resources/kotlin/src/main/kotlin/packagename/schemas/validation/CustomIsoparser.hbs index 0594d8e577a..9577ccef335 100644 --- a/src/main/resources/kotlin/src/main/kotlin/packagename/schemas/validation/CustomIsoparser.hbs +++ b/src/main/resources/kotlin/src/main/kotlin/packagename/schemas/validation/CustomIsoparser.hbs @@ -1,7 +1,7 @@ -package {{{packageName}}}.schemas.validation; +package {{{packageName}}}.schemas.validation -import java.time.ZonedDateTime; -import java.time.LocalDate; +import java.time.ZonedDateTime +import java.time.LocalDate class CustomIsoparser { companion object { diff --git a/src/main/resources/kotlin/src/main/kotlin/packagename/schemas/validation/DefaultValueMethod.hbs b/src/main/resources/kotlin/src/main/kotlin/packagename/schemas/validation/DefaultValueMethod.hbs index a362656402f..233f4681621 100644 --- a/src/main/resources/kotlin/src/main/kotlin/packagename/schemas/validation/DefaultValueMethod.hbs +++ b/src/main/resources/kotlin/src/main/kotlin/packagename/schemas/validation/DefaultValueMethod.hbs @@ -1,7 +1,8 @@ -package {{{packageName}}}.schemas.validation; +package {{{packageName}}}.schemas.validation -import {{{packageName}}}.exceptions.ValidationException; +import {{{packageName}}}.exceptions.ValidationException -public interface DefaultValueMethod { - T defaultValue() throws ValidationException; +interface DefaultValueMethod { + @Throws(ValidationException::class) + fun defaultValue(): T } \ No newline at end of file diff --git a/src/main/resources/kotlin/src/main/kotlin/packagename/schemas/validation/DependentRequiredValidator.hbs b/src/main/resources/kotlin/src/main/kotlin/packagename/schemas/validation/DependentRequiredValidator.hbs index 458f030ca12..aa87eca510c 100644 --- a/src/main/resources/kotlin/src/main/kotlin/packagename/schemas/validation/DependentRequiredValidator.hbs +++ b/src/main/resources/kotlin/src/main/kotlin/packagename/schemas/validation/DependentRequiredValidator.hbs @@ -1,6 +1,6 @@ -package {{{packageName}}}.schemas.validation; +package {{{packageName}}}.schemas.validation -import {{{packageName}}}.exceptions.ValidationException; +import {{{packageName}}}.exceptions.ValidationException class DependentRequiredValidator : KeywordValidator { @Throws(ValidationException::class) diff --git a/src/main/resources/kotlin/src/main/kotlin/packagename/schemas/validation/DependentSchemasValidator.hbs b/src/main/resources/kotlin/src/main/kotlin/packagename/schemas/validation/DependentSchemasValidator.hbs index 7148ef13d45..0f5bfb12c74 100644 --- a/src/main/resources/kotlin/src/main/kotlin/packagename/schemas/validation/DependentSchemasValidator.hbs +++ b/src/main/resources/kotlin/src/main/kotlin/packagename/schemas/validation/DependentSchemasValidator.hbs @@ -1,6 +1,6 @@ -package {{{packageName}}}.schemas.validation; +package {{{packageName}}}.schemas.validation -import {{{packageName}}}.exceptions.ValidationException; +import {{{packageName}}}.exceptions.ValidationException class DependentSchemasValidator : KeywordValidator { @Throws(ValidationException::class) @@ -22,7 +22,7 @@ class DependentSchemasValidator : KeywordValidator { if (!presentProperties.contains(propName)) { continue } - val dependentSchema = getInstance(dependentSchemaClass) + val dependentSchema = JsonSchemaFactory.getInstance(dependentSchemaClass) val otherPathToSchemas = JsonSchema.validate(dependentSchema, data.arg, data.validationMetadata) pathToSchemas.update(otherPathToSchemas) } diff --git a/src/main/resources/kotlin/src/main/kotlin/packagename/schemas/validation/DoubleEnumValidator.hbs b/src/main/resources/kotlin/src/main/kotlin/packagename/schemas/validation/DoubleEnumValidator.hbs index 9de5c58a990..62db4eac999 100644 --- a/src/main/resources/kotlin/src/main/kotlin/packagename/schemas/validation/DoubleEnumValidator.hbs +++ b/src/main/resources/kotlin/src/main/kotlin/packagename/schemas/validation/DoubleEnumValidator.hbs @@ -1,8 +1,9 @@ -package {{{packageName}}}.schemas.validation; +package {{{packageName}}}.schemas.validation -import {{{packageName}}}.configurations.SchemaConfiguration; -import {{{packageName}}}.exceptions.ValidationException; +import {{{packageName}}}.configurations.SchemaConfiguration +import {{{packageName}}}.exceptions.ValidationException -public interface DoubleEnumValidator { - double validate(EnumType arg, SchemaConfiguration configuration) throws ValidationException; +interface DoubleEnumValidator { + @Throws(ValidationException::class) + fun validate(arg: EnumType, configuration: SchemaConfiguration?): Double } \ No newline at end of file diff --git a/src/main/resources/kotlin/src/main/kotlin/packagename/schemas/validation/DoubleValueMethod.hbs b/src/main/resources/kotlin/src/main/kotlin/packagename/schemas/validation/DoubleValueMethod.hbs index 96e5aeb4f56..9cec46606fd 100644 --- a/src/main/resources/kotlin/src/main/kotlin/packagename/schemas/validation/DoubleValueMethod.hbs +++ b/src/main/resources/kotlin/src/main/kotlin/packagename/schemas/validation/DoubleValueMethod.hbs @@ -1,5 +1,5 @@ -package {{{packageName}}}.schemas.validation; +package {{{packageName}}}.schemas.validation -public interface DoubleValueMethod { - double value(); +interface DoubleValueMethod { + fun value(): Double } \ No newline at end of file diff --git a/src/main/resources/kotlin/src/main/kotlin/packagename/schemas/validation/ElseValidator.hbs b/src/main/resources/kotlin/src/main/kotlin/packagename/schemas/validation/ElseValidator.hbs index 554612910e3..9f9236a029b 100644 --- a/src/main/resources/kotlin/src/main/kotlin/packagename/schemas/validation/ElseValidator.hbs +++ b/src/main/resources/kotlin/src/main/kotlin/packagename/schemas/validation/ElseValidator.hbs @@ -1,6 +1,6 @@ -package {{{packageName}}}.schemas.validation; +package {{{packageName}}}.schemas.validation -import {{{packageName}}}.exceptions.ValidationException; +import {{{packageName}}}.exceptions.ValidationException class ElseValidator : KeywordValidator { @Throws(ValidationException::class) diff --git a/src/main/resources/kotlin/src/main/kotlin/packagename/schemas/validation/EnumValidator.hbs b/src/main/resources/kotlin/src/main/kotlin/packagename/schemas/validation/EnumValidator.hbs index b246a030560..66d7b169bb0 100644 --- a/src/main/resources/kotlin/src/main/kotlin/packagename/schemas/validation/EnumValidator.hbs +++ b/src/main/resources/kotlin/src/main/kotlin/packagename/schemas/validation/EnumValidator.hbs @@ -1,8 +1,8 @@ -package {{{packageName}}}.schemas.validation; +package {{{packageName}}}.schemas.validation -import {{{packageName}}}.exceptions.ValidationException; +import {{{packageName}}}.exceptions.ValidationException -import java.math.BigDecimal; +import java.math.BigDecimal class EnumValidator : BigDecimalValidator(), KeywordValidator { @Throws(ValidationException::class) diff --git a/src/main/resources/kotlin/src/main/kotlin/packagename/schemas/validation/ExclusiveMaximumValidator.hbs b/src/main/resources/kotlin/src/main/kotlin/packagename/schemas/validation/ExclusiveMaximumValidator.hbs index e07f3d81257..0419032fb43 100644 --- a/src/main/resources/kotlin/src/main/kotlin/packagename/schemas/validation/ExclusiveMaximumValidator.hbs +++ b/src/main/resources/kotlin/src/main/kotlin/packagename/schemas/validation/ExclusiveMaximumValidator.hbs @@ -1,6 +1,6 @@ -package {{{packageName}}}.schemas.validation; +package {{{packageName}}}.schemas.validation -import {{{packageName}}}.exceptions.ValidationException; +import {{{packageName}}}.exceptions.ValidationException class ExclusiveMaximumValidator : KeywordValidator { @Throws(ValidationException::class) diff --git a/src/main/resources/kotlin/src/main/kotlin/packagename/schemas/validation/ExclusiveMinimumValidator.hbs b/src/main/resources/kotlin/src/main/kotlin/packagename/schemas/validation/ExclusiveMinimumValidator.hbs index 60f62091701..8eefb7fa1ef 100644 --- a/src/main/resources/kotlin/src/main/kotlin/packagename/schemas/validation/ExclusiveMinimumValidator.hbs +++ b/src/main/resources/kotlin/src/main/kotlin/packagename/schemas/validation/ExclusiveMinimumValidator.hbs @@ -1,6 +1,6 @@ -package {{{packageName}}}.schemas.validation; +package {{{packageName}}}.schemas.validation -import {{{packageName}}}.exceptions.ValidationException; +import {{{packageName}}}.exceptions.ValidationException class ExclusiveMinimumValidator : KeywordValidator { @Throws(ValidationException::class) diff --git a/src/main/resources/kotlin/src/main/kotlin/packagename/schemas/validation/FloatEnumValidator.hbs b/src/main/resources/kotlin/src/main/kotlin/packagename/schemas/validation/FloatEnumValidator.hbs index 7d9d5a7fcce..bab089c3378 100644 --- a/src/main/resources/kotlin/src/main/kotlin/packagename/schemas/validation/FloatEnumValidator.hbs +++ b/src/main/resources/kotlin/src/main/kotlin/packagename/schemas/validation/FloatEnumValidator.hbs @@ -1,8 +1,9 @@ -package {{{packageName}}}.schemas.validation; +package {{{packageName}}}.schemas.validation -import {{{packageName}}}.configurations.SchemaConfiguration; -import {{{packageName}}}.exceptions.ValidationException; +import {{{packageName}}}.configurations.SchemaConfiguration +import {{{packageName}}}.exceptions.ValidationException -public interface FloatEnumValidator { - float validate(EnumType arg, SchemaConfiguration configuration) throws ValidationException; +interface FloatEnumValidator { + @Throws(ValidationException::class) + fun validate(arg: EnumType, configuration: SchemaConfiguration?): Float } \ No newline at end of file diff --git a/src/main/resources/kotlin/src/main/kotlin/packagename/schemas/validation/FloatValueMethod.hbs b/src/main/resources/kotlin/src/main/kotlin/packagename/schemas/validation/FloatValueMethod.hbs index 49ef3b3c1bd..24b319370ca 100644 --- a/src/main/resources/kotlin/src/main/kotlin/packagename/schemas/validation/FloatValueMethod.hbs +++ b/src/main/resources/kotlin/src/main/kotlin/packagename/schemas/validation/FloatValueMethod.hbs @@ -1,5 +1,5 @@ -package {{{packageName}}}.schemas.validation; +package {{{packageName}}}.schemas.validation -public interface FloatValueMethod { - float value(); +interface FloatValueMethod { + fun value(): Float } \ No newline at end of file diff --git a/src/main/resources/kotlin/src/main/kotlin/packagename/schemas/validation/FormatValidator.hbs b/src/main/resources/kotlin/src/main/kotlin/packagename/schemas/validation/FormatValidator.hbs index a1b8d7f6123..66286724376 100644 --- a/src/main/resources/kotlin/src/main/kotlin/packagename/schemas/validation/FormatValidator.hbs +++ b/src/main/resources/kotlin/src/main/kotlin/packagename/schemas/validation/FormatValidator.hbs @@ -1,6 +1,6 @@ -package {{{packageName}}}.schemas.validation; +package {{{packageName}}}.schemas.validation -import {{{packageName}}}.exceptions.ValidationException; +import {{{packageName}}}.exceptions.ValidationException import java.math.BigDecimal import java.math.BigInteger import java.time.format.DateTimeParseException diff --git a/src/main/resources/kotlin/src/main/kotlin/packagename/schemas/validation/FrozenList.hbs b/src/main/resources/kotlin/src/main/kotlin/packagename/schemas/validation/FrozenList.hbs index 443a488dbc2..b993d5e3958 100644 --- a/src/main/resources/kotlin/src/main/kotlin/packagename/schemas/validation/FrozenList.hbs +++ b/src/main/resources/kotlin/src/main/kotlin/packagename/schemas/validation/FrozenList.hbs @@ -1,4 +1,4 @@ -package {{{packageName}}}.schemas.validation; +package {{{packageName}}}.schemas.validation open class FrozenList(m: Collection) : AbstractList() { /* diff --git a/src/main/resources/kotlin/src/main/kotlin/packagename/schemas/validation/FrozenMap.hbs b/src/main/resources/kotlin/src/main/kotlin/packagename/schemas/validation/FrozenMap.hbs index 079e94b03d5..e48f5ce3c16 100644 --- a/src/main/resources/kotlin/src/main/kotlin/packagename/schemas/validation/FrozenMap.hbs +++ b/src/main/resources/kotlin/src/main/kotlin/packagename/schemas/validation/FrozenMap.hbs @@ -1,7 +1,7 @@ -package {{{packageName}}}.schemas.validation; +package {{{packageName}}}.schemas.validation -import {{{packageName}}}.exceptions.UnsetPropertyException; -import {{{packageName}}}.exceptions.InvalidAdditionalPropertyException; +import {{{packageName}}}.exceptions.UnsetPropertyException +import {{{packageName}}}.exceptions.InvalidAdditionalPropertyException open class FrozenMap(m: Map) : AbstractMap() { /* diff --git a/src/main/resources/kotlin/src/main/kotlin/packagename/schemas/validation/IfValidator.hbs b/src/main/resources/kotlin/src/main/kotlin/packagename/schemas/validation/IfValidator.hbs index b3c8e6d5515..d712b63d3e8 100644 --- a/src/main/resources/kotlin/src/main/kotlin/packagename/schemas/validation/IfValidator.hbs +++ b/src/main/resources/kotlin/src/main/kotlin/packagename/schemas/validation/IfValidator.hbs @@ -1,6 +1,6 @@ -package {{{packageName}}}.schemas.validation; +package {{{packageName}}}.schemas.validation -import {{{packageName}}}.exceptions.ValidationException; +import {{{packageName}}}.exceptions.ValidationException class IfValidator : KeywordValidator { @Throws(ValidationException::class) diff --git a/src/main/resources/kotlin/src/main/kotlin/packagename/schemas/validation/IntegerEnumValidator.hbs b/src/main/resources/kotlin/src/main/kotlin/packagename/schemas/validation/IntegerEnumValidator.hbs index 352afd6be56..70e33e6e87f 100644 --- a/src/main/resources/kotlin/src/main/kotlin/packagename/schemas/validation/IntegerEnumValidator.hbs +++ b/src/main/resources/kotlin/src/main/kotlin/packagename/schemas/validation/IntegerEnumValidator.hbs @@ -1,8 +1,9 @@ -package {{{packageName}}}.schemas.validation; +package {{{packageName}}}.schemas.validation -import {{{packageName}}}.configurations.SchemaConfiguration; -import {{{packageName}}}.exceptions.ValidationException; +import {{{packageName}}}.configurations.SchemaConfiguration +import {{{packageName}}}.exceptions.ValidationException -public interface IntegerEnumValidator { - int validate(EnumType arg, SchemaConfiguration configuration) throws ValidationException; +interface IntegerEnumValidator { + @Throws(ValidationException::class) + fun validate(arg: EnumType, configuration: SchemaConfiguration?): Int } \ No newline at end of file diff --git a/src/main/resources/kotlin/src/main/kotlin/packagename/schemas/validation/IntegerValueMethod.hbs b/src/main/resources/kotlin/src/main/kotlin/packagename/schemas/validation/IntegerValueMethod.hbs index 5c5a734783f..258f4df6118 100644 --- a/src/main/resources/kotlin/src/main/kotlin/packagename/schemas/validation/IntegerValueMethod.hbs +++ b/src/main/resources/kotlin/src/main/kotlin/packagename/schemas/validation/IntegerValueMethod.hbs @@ -1,5 +1,5 @@ -package {{{packageName}}}.schemas.validation; +package {{{packageName}}}.schemas.validation -public interface IntegerValueMethod { - int value(); +interface IntegerValueMethod { + fun value(): Int } \ No newline at end of file diff --git a/src/main/resources/kotlin/src/main/kotlin/packagename/schemas/validation/ItemsValidator.hbs b/src/main/resources/kotlin/src/main/kotlin/packagename/schemas/validation/ItemsValidator.hbs index b54a521b09d..7bbcc92d111 100644 --- a/src/main/resources/kotlin/src/main/kotlin/packagename/schemas/validation/ItemsValidator.hbs +++ b/src/main/resources/kotlin/src/main/kotlin/packagename/schemas/validation/ItemsValidator.hbs @@ -1,6 +1,6 @@ -package {{{packageName}}}.schemas.validation; +package {{{packageName}}}.schemas.validation -import {{{packageName}}}.exceptions.ValidationException; +import {{{packageName}}}.exceptions.ValidationException class ItemsValidator : KeywordValidator { @Throws(ValidationException::class) diff --git a/src/main/resources/kotlin/src/main/kotlin/packagename/schemas/validation/JsonSchema.hbs b/src/main/resources/kotlin/src/main/kotlin/packagename/schemas/validation/JsonSchema.hbs index da68b52c10d..73f6f421a19 100644 --- a/src/main/resources/kotlin/src/main/kotlin/packagename/schemas/validation/JsonSchema.hbs +++ b/src/main/resources/kotlin/src/main/kotlin/packagename/schemas/validation/JsonSchema.hbs @@ -1,7 +1,7 @@ -package {{{packageName}}}.schemas.validation; +package {{{packageName}}}.schemas.validation -import {{{packageName}}}.configurations.SchemaConfiguration; -import {{{packageName}}}.exceptions.ValidationException; +import {{{packageName}}}.configurations.SchemaConfiguration +import {{{packageName}}}.exceptions.ValidationException import java.math.BigDecimal import java.time.LocalDate @@ -399,19 +399,19 @@ abstract class JsonSchema protected constructor(jsonSchemaInfo: JsonSchemaInf } } - fun getNewInstance(arg: Nothing?, pathToItem: List, pathToSchemas: PathToSchemasMap): Nothing? { + protected fun getNewInstance(arg: Nothing?, pathToItem: List, pathToSchemas: PathToSchemasMap): Nothing? { return arg } - fun getNewInstance(arg: Boolean, pathToItem: List, pathToSchemas: PathToSchemasMap): Boolean { + protected fun getNewInstance(arg: Boolean, pathToItem: List, pathToSchemas: PathToSchemasMap): Boolean { return arg } - fun getNewInstance(arg: Number, pathToItem: List, pathToSchemas: PathToSchemasMap): Number { + protected fun getNewInstance(arg: Number, pathToItem: List, pathToSchemas: PathToSchemasMap): Number { return arg } - fun getNewInstance(arg: String, pathToItem: List, pathToSchemas: PathToSchemasMap): String { + protected fun getNewInstance(arg: String, pathToItem: List, pathToSchemas: PathToSchemasMap): String { return arg } diff --git a/src/main/resources/kotlin/src/main/kotlin/packagename/schemas/validation/JsonSchemaFactory.hbs b/src/main/resources/kotlin/src/main/kotlin/packagename/schemas/validation/JsonSchemaFactory.hbs index 0e7e1bc693b..e8d908d9d21 100644 --- a/src/main/resources/kotlin/src/main/kotlin/packagename/schemas/validation/JsonSchemaFactory.hbs +++ b/src/main/resources/kotlin/src/main/kotlin/packagename/schemas/validation/JsonSchemaFactory.hbs @@ -1,6 +1,6 @@ -package {{{packageName}}}.schemas.validation; +package {{{packageName}}}.schemas.validation -import java.lang.reflect.InvocationTargetException; +import java.lang.reflect.InvocationTargetException object JsonSchemaFactory { private var classToInstance: MutableMap>, JsonSchema<*>> = HashMap() @@ -12,8 +12,9 @@ object JsonSchemaFactory { return schemaCls.cast(it) } try { - val method = schemaCls.getMethod("getInstance") - val obj = method.invoke(null) + val companion = schemaCls.declaredClasses[0] + val method = companion.getMethod("getInstance") + val obj = method.invoke(companion.kotlin.objectInstance) assert(schemaCls.isInstance(obj)) val inst = schemaCls.cast(obj) classToInstance[schemaCls] = inst diff --git a/src/main/resources/kotlin/src/main/kotlin/packagename/schemas/validation/JsonSchemaInfo.hbs b/src/main/resources/kotlin/src/main/kotlin/packagename/schemas/validation/JsonSchemaInfo.hbs index ec4eb87de88..782c17f848f 100644 --- a/src/main/resources/kotlin/src/main/kotlin/packagename/schemas/validation/JsonSchemaInfo.hbs +++ b/src/main/resources/kotlin/src/main/kotlin/packagename/schemas/validation/JsonSchemaInfo.hbs @@ -1,149 +1,149 @@ -package {{{packageName}}}.schemas.validation; +package {{{packageName}}}.schemas.validation import java.math.BigDecimal import java.util.regex.Pattern class JsonSchemaInfo { var type: Set>? = null - fun type(type: Set>?): JsonSchemaInfo { + fun type(type: Set>): JsonSchemaInfo { this.type = type return this } var format: String? = null - fun format(format: String?): JsonSchemaInfo { + fun format(format: String): JsonSchemaInfo { this.format = format return this } - var items: Class?>? = null - fun items(items: Class?>?): JsonSchemaInfo { + var items: Class>? = null + fun items(items: Class>): JsonSchemaInfo { this.items = items return this } - var properties: Map?>>? = null - fun properties(properties: Map?>>?): JsonSchemaInfo { + var properties: Map>>? = null + fun properties(properties: Map>>): JsonSchemaInfo { this.properties = properties return this } var required: Set? = null - fun required(required: Set?): JsonSchemaInfo { + fun required(required: Set): JsonSchemaInfo { this.required = required return this } var exclusiveMaximum: Number? = null - fun exclusiveMaximum(exclusiveMaximum: Number?): JsonSchemaInfo { + fun exclusiveMaximum(exclusiveMaximum: Number): JsonSchemaInfo { this.exclusiveMaximum = exclusiveMaximum return this } var exclusiveMinimum: Number? = null - fun exclusiveMinimum(exclusiveMinimum: Number?): JsonSchemaInfo { + fun exclusiveMinimum(exclusiveMinimum: Number): JsonSchemaInfo { this.exclusiveMinimum = exclusiveMinimum return this } var maxItems: Int? = null - fun maxItems(maxItems: Int?): JsonSchemaInfo { + fun maxItems(maxItems: Int): JsonSchemaInfo { this.maxItems = maxItems return this } var minItems: Int? = null - fun minItems(minItems: Int?): JsonSchemaInfo { + fun minItems(minItems: Int): JsonSchemaInfo { this.minItems = minItems return this } var maxLength: Int? = null - fun maxLength(maxLength: Int?): JsonSchemaInfo { + fun maxLength(maxLength: Int): JsonSchemaInfo { this.maxLength = maxLength return this } var minLength: Int? = null - fun minLength(minLength: Int?): JsonSchemaInfo { + fun minLength(minLength: Int): JsonSchemaInfo { this.minLength = minLength return this } var maxProperties: Int? = null - fun maxProperties(maxProperties: Int?): JsonSchemaInfo { + fun maxProperties(maxProperties: Int): JsonSchemaInfo { this.maxProperties = maxProperties return this } var minProperties: Int? = null - fun minProperties(minProperties: Int?): JsonSchemaInfo { + fun minProperties(minProperties: Int): JsonSchemaInfo { this.minProperties = minProperties return this } var maximum: Number? = null - fun maximum(maximum: Number?): JsonSchemaInfo { + fun maximum(maximum: Number): JsonSchemaInfo { this.maximum = maximum return this } var minimum: Number? = null - fun minimum(minimum: Number?): JsonSchemaInfo { + fun minimum(minimum: Number): JsonSchemaInfo { this.minimum = minimum return this } var multipleOf: BigDecimal? = null - fun multipleOf(multipleOf: BigDecimal?): JsonSchemaInfo { + fun multipleOf(multipleOf: BigDecimal): JsonSchemaInfo { this.multipleOf = multipleOf return this } - var additionalProperties: Class?>? = null - fun additionalProperties(additionalProperties: Class?>?): JsonSchemaInfo { + var additionalProperties: Class>? = null + fun additionalProperties(additionalProperties: Class>): JsonSchemaInfo { this.additionalProperties = additionalProperties return this } - var allOf: List?>>? = null - fun allOf(allOf: List?>>?): JsonSchemaInfo { + var allOf: List>>? = null + fun allOf(allOf: List>>): JsonSchemaInfo { this.allOf = allOf return this } - var anyOf: List?>>? = null - fun anyOf(anyOf: List?>>?): JsonSchemaInfo { + var anyOf: List>>? = null + fun anyOf(anyOf: List>>): JsonSchemaInfo { this.anyOf = anyOf return this } - var oneOf: List?>>? = null - fun oneOf(oneOf: List?>>?): JsonSchemaInfo { + var oneOf: List>>? = null + fun oneOf(oneOf: List>>): JsonSchemaInfo { this.oneOf = oneOf return this } - var not: Class?>? = null - fun not(not: Class?>?): JsonSchemaInfo { + var not: Class>? = null + fun not(not: Class>): JsonSchemaInfo { this.not = not return this } var uniqueItems: Boolean? = null - fun uniqueItems(uniqueItems: Boolean?): JsonSchemaInfo { + fun uniqueItems(uniqueItems: Boolean): JsonSchemaInfo { this.uniqueItems = uniqueItems return this } var enumValues: Set? = null - fun enumValues(enumValues: Set?): JsonSchemaInfo { + fun enumValues(enumValues: Set): JsonSchemaInfo { this.enumValues = enumValues return this } var pattern: Pattern? = null - fun pattern(pattern: Pattern?): JsonSchemaInfo { + fun pattern(pattern: Pattern): JsonSchemaInfo { this.pattern = pattern return this } @@ -164,80 +164,80 @@ class JsonSchemaInfo { return this } - var contains: Class?>? = null - fun contains(contains: Class?>?): JsonSchemaInfo { + var contains: Class>? = null + fun contains(contains: Class>): JsonSchemaInfo { this.contains = contains return this } var maxContains: Int? = null - fun maxContains(maxContains: Int?): JsonSchemaInfo { + fun maxContains(maxContains: Int): JsonSchemaInfo { this.maxContains = maxContains return this } var minContains: Int? = null - fun minContains(minContains: Int?): JsonSchemaInfo { + fun minContains(minContains: Int): JsonSchemaInfo { this.minContains = minContains return this } - var propertyNames: Class?>? = null - fun propertyNames(propertyNames: Class?>?): JsonSchemaInfo { + var propertyNames: Class>? = null + fun propertyNames(propertyNames: Class>): JsonSchemaInfo { this.propertyNames = propertyNames return this } var dependentRequired: Map>? = null - fun dependentRequired(dependentRequired: Map>?): JsonSchemaInfo { + fun dependentRequired(dependentRequired: Map>): JsonSchemaInfo { this.dependentRequired = dependentRequired return this } - var dependentSchemas: Map?>>? = null - fun dependentSchemas(dependentSchemas: Map?>>?): JsonSchemaInfo { + var dependentSchemas: Map>>? = null + fun dependentSchemas(dependentSchemas: Map>>): JsonSchemaInfo { this.dependentSchemas = dependentSchemas return this } - var patternProperties: Map?>>? = null - fun patternProperties(patternProperties: Map?>>?): JsonSchemaInfo { + var patternProperties: Map>>? = null + fun patternProperties(patternProperties: Map>>): JsonSchemaInfo { this.patternProperties = patternProperties return this } - var prefixItems: List?>>? = null - fun prefixItems(prefixItems: List?>>?): JsonSchemaInfo { + var prefixItems: List>>? = null + fun prefixItems(prefixItems: List>>): JsonSchemaInfo { this.prefixItems = prefixItems return this } - var ifSchema: Class?>? = null - fun ifSchema(ifSchema: Class?>?): JsonSchemaInfo { + var ifSchema: Class>? = null + fun ifSchema(ifSchema: Class>): JsonSchemaInfo { this.ifSchema = ifSchema return this } - var then: Class?>? = null - fun then(then: Class?>?): JsonSchemaInfo { + var then: Class>? = null + fun then(then: Class>): JsonSchemaInfo { this.then = then return this } - var elseSchema: Class?>? = null - fun elseSchema(elseSchema: Class?>?): JsonSchemaInfo { + var elseSchema: Class>? = null + fun elseSchema(elseSchema: Class>): JsonSchemaInfo { this.elseSchema = elseSchema return this } - var unevaluatedItems: Class?>? = null - fun unevaluatedItems(unevaluatedItems: Class?>?): JsonSchemaInfo { + var unevaluatedItems: Class>? = null + fun unevaluatedItems(unevaluatedItems: Class>): JsonSchemaInfo { this.unevaluatedItems = unevaluatedItems return this } - var unevaluatedProperties: Class?>? = null - fun unevaluatedProperties(unevaluatedProperties: Class?>?): JsonSchemaInfo { + var unevaluatedProperties: Class>? = null + fun unevaluatedProperties(unevaluatedProperties: Class>): JsonSchemaInfo { this.unevaluatedProperties = unevaluatedProperties return this } diff --git a/src/main/resources/kotlin/src/main/kotlin/packagename/schemas/validation/KeywordEntry.hbs b/src/main/resources/kotlin/src/main/kotlin/packagename/schemas/validation/KeywordEntry.hbs index 7f5a8c70c02..ca41c306325 100644 --- a/src/main/resources/kotlin/src/main/kotlin/packagename/schemas/validation/KeywordEntry.hbs +++ b/src/main/resources/kotlin/src/main/kotlin/packagename/schemas/validation/KeywordEntry.hbs @@ -1,10 +1,6 @@ -package {{{packageName}}}.schemas.validation; +package {{{packageName}}}.schemas.validation -import java.util.AbstractMap; +import java.util.AbstractMap -@SuppressWarnings("serial") -public class KeywordEntry extends AbstractMap.SimpleEntry { - public KeywordEntry(String key, KeywordValidator value) { - super(key, value); - } -} +class KeywordEntry(key: String, value: KeywordValidator) : + AbstractMap.SimpleEntry(key, value) diff --git a/src/main/resources/kotlin/src/main/kotlin/packagename/schemas/validation/KeywordValidator.hbs b/src/main/resources/kotlin/src/main/kotlin/packagename/schemas/validation/KeywordValidator.hbs index 8ed6092e1a8..b48ee727513 100644 --- a/src/main/resources/kotlin/src/main/kotlin/packagename/schemas/validation/KeywordValidator.hbs +++ b/src/main/resources/kotlin/src/main/kotlin/packagename/schemas/validation/KeywordValidator.hbs @@ -1,6 +1,6 @@ -package {{{packageName}}}.schemas.validation; +package {{{packageName}}}.schemas.validation -import {{{packageName}}}.exceptions.ValidationException; +import {{{packageName}}}.exceptions.ValidationException fun interface KeywordValidator { @Throws(ValidationException::class) diff --git a/src/main/resources/kotlin/src/main/kotlin/packagename/schemas/validation/LengthValidator.hbs b/src/main/resources/kotlin/src/main/kotlin/packagename/schemas/validation/LengthValidator.hbs index 72987a9bb6b..dab328d0f7c 100644 --- a/src/main/resources/kotlin/src/main/kotlin/packagename/schemas/validation/LengthValidator.hbs +++ b/src/main/resources/kotlin/src/main/kotlin/packagename/schemas/validation/LengthValidator.hbs @@ -1,6 +1,6 @@ -package {{{packageName}}}.schemas.validation; +package {{{packageName}}}.schemas.validation -import java.text.BreakIterator; +import java.text.BreakIterator abstract class LengthValidator { protected fun getLength(text: String?): Int { diff --git a/src/main/resources/kotlin/src/main/kotlin/packagename/schemas/validation/ListMaker.hbs b/src/main/resources/kotlin/src/main/kotlin/packagename/schemas/validation/ListMaker.hbs index bda699db04e..3b76acdb91b 100644 --- a/src/main/resources/kotlin/src/main/kotlin/packagename/schemas/validation/ListMaker.hbs +++ b/src/main/resources/kotlin/src/main/kotlin/packagename/schemas/validation/ListMaker.hbs @@ -1,8 +1,8 @@ -package {{{packageName}}}.schemas.validation; +package {{{packageName}}}.schemas.validation -import java.util.ArrayList; -import java.util.Arrays; -import java.util.List; +import java.util.ArrayList +import java.util.Arrays +import java.util.List public class ListMaker { /** @@ -15,6 +15,6 @@ public class ListMaker { @SafeVarargs @SuppressWarnings("varargs") public static List makeList(E... entries) { - return new ArrayList<>(Arrays.stream(entries).toList()); + return new ArrayList<>(Arrays.stream(entries).toList()) } } \ No newline at end of file diff --git a/src/main/resources/kotlin/src/main/kotlin/packagename/schemas/validation/ListSchemaValidator.hbs b/src/main/resources/kotlin/src/main/kotlin/packagename/schemas/validation/ListSchemaValidator.hbs index 91d1f767cce..b6fc1529a8d 100644 --- a/src/main/resources/kotlin/src/main/kotlin/packagename/schemas/validation/ListSchemaValidator.hbs +++ b/src/main/resources/kotlin/src/main/kotlin/packagename/schemas/validation/ListSchemaValidator.hbs @@ -1,7 +1,7 @@ -package {{{packageName}}}.schemas.validation; +package {{{packageName}}}.schemas.validation -import {{{packageName}}}.configurations.SchemaConfiguration; -import {{{packageName}}}.exceptions.ValidationException; +import {{{packageName}}}.configurations.SchemaConfiguration +import {{{packageName}}}.exceptions.ValidationException interface ListSchemaValidator { @Throws(ValidationException::class) diff --git a/src/main/resources/kotlin/src/main/kotlin/packagename/schemas/validation/LongEnumValidator.hbs b/src/main/resources/kotlin/src/main/kotlin/packagename/schemas/validation/LongEnumValidator.hbs index f5045ca0e94..7cb21bf49b2 100644 --- a/src/main/resources/kotlin/src/main/kotlin/packagename/schemas/validation/LongEnumValidator.hbs +++ b/src/main/resources/kotlin/src/main/kotlin/packagename/schemas/validation/LongEnumValidator.hbs @@ -1,8 +1,9 @@ -package {{{packageName}}}.schemas.validation; +package {{{packageName}}}.schemas.validation -import {{{packageName}}}.configurations.SchemaConfiguration; -import {{{packageName}}}.exceptions.ValidationException; +import {{{packageName}}}.configurations.SchemaConfiguration +import {{{packageName}}}.exceptions.ValidationException -public interface LongEnumValidator { - long validate(EnumType arg, SchemaConfiguration configuration) throws ValidationException; +interface LongEnumValidator { + @Throws(ValidationException::class) + fun validate(arg: EnumType, configuration: SchemaConfiguration?): Long } \ No newline at end of file diff --git a/src/main/resources/kotlin/src/main/kotlin/packagename/schemas/validation/LongValueMethod.hbs b/src/main/resources/kotlin/src/main/kotlin/packagename/schemas/validation/LongValueMethod.hbs index c558ddb4ec8..e697905e149 100644 --- a/src/main/resources/kotlin/src/main/kotlin/packagename/schemas/validation/LongValueMethod.hbs +++ b/src/main/resources/kotlin/src/main/kotlin/packagename/schemas/validation/LongValueMethod.hbs @@ -1,5 +1,5 @@ -package {{{packageName}}}.schemas.validation; +package {{{packageName}}}.schemas.validation -public interface LongValueMethod { - long value(); +interface LongValueMethod { + fun value(): Long } \ No newline at end of file diff --git a/src/main/resources/kotlin/src/main/kotlin/packagename/schemas/validation/MapSchemaValidator.hbs b/src/main/resources/kotlin/src/main/kotlin/packagename/schemas/validation/MapSchemaValidator.hbs index f528f687e54..8c52d6bc351 100644 --- a/src/main/resources/kotlin/src/main/kotlin/packagename/schemas/validation/MapSchemaValidator.hbs +++ b/src/main/resources/kotlin/src/main/kotlin/packagename/schemas/validation/MapSchemaValidator.hbs @@ -1,7 +1,7 @@ -package {{{packageName}}}.schemas.validation; +package {{{packageName}}}.schemas.validation -import {{{packageName}}}.configurations.SchemaConfiguration; -import {{{packageName}}}.exceptions.ValidationException; +import {{{packageName}}}.configurations.SchemaConfiguration +import {{{packageName}}}.exceptions.ValidationException interface MapSchemaValidator { @Throws(ValidationException::class) diff --git a/src/main/resources/kotlin/src/main/kotlin/packagename/schemas/validation/MapUtils.hbs b/src/main/resources/kotlin/src/main/kotlin/packagename/schemas/validation/MapUtils.hbs index 2af65c47a9b..b1943ff3dd9 100644 --- a/src/main/resources/kotlin/src/main/kotlin/packagename/schemas/validation/MapUtils.hbs +++ b/src/main/resources/kotlin/src/main/kotlin/packagename/schemas/validation/MapUtils.hbs @@ -1,33 +1,35 @@ -package {{{packageName}}}.schemas.validation; +package {{{packageName}}}.schemas.validation -import {{{packageName}}}.exceptions.InvalidAdditionalPropertyException; +import {{{packageName}}}.exceptions.InvalidAdditionalPropertyException -object MapUtils { - /** - * A builder for maps that allows in null values - * Schema tests + doc code samples need it - * @param entries items to add - * @return the output map - * @param key type - * @param value type - */ - @SafeVarargs - fun makeMap(vararg entries: Map.Entry): Map { - val map: MutableMap = HashMap() - for ((key, value) in entries) { - map[key] = value +class MapUtils { + companion object { + /** + * A builder for maps that allows in null values + * Schema tests + doc code samples need it + * @param entries items to add + * @return the output map + * @param key type + * @param value type + */ + @SafeVarargs + fun makeMap(vararg entries: Map.Entry): Map { + val map: MutableMap = HashMap() + for ((key, value) in entries) { + map[key] = value + } + return map } - return map - } - @Throws(InvalidAdditionalPropertyException::class) - fun throwIfKeyKnown(key: String, knownKeys: Set, setting: Boolean) { - if (knownKeys.contains(key)) { - var verb = "getting" - if (setting) { - verb = "setting" + @Throws(InvalidAdditionalPropertyException::class) + fun throwIfKeyKnown(key: String, knownKeys: Set, setting: Boolean) { + if (knownKeys.contains(key)) { + var verb = "getting" + if (setting) { + verb = "setting" + } + throw InvalidAdditionalPropertyException("The known key $key may not be passed in when $verb an additional property") } - throw InvalidAdditionalPropertyException("The known key $key may not be passed in when $verb an additional property") } } } \ No newline at end of file diff --git a/src/main/resources/kotlin/src/main/kotlin/packagename/schemas/validation/MaxContainsValidator.hbs b/src/main/resources/kotlin/src/main/kotlin/packagename/schemas/validation/MaxContainsValidator.hbs index ab5917515bb..b8d2c2a0024 100644 --- a/src/main/resources/kotlin/src/main/kotlin/packagename/schemas/validation/MaxContainsValidator.hbs +++ b/src/main/resources/kotlin/src/main/kotlin/packagename/schemas/validation/MaxContainsValidator.hbs @@ -1,6 +1,6 @@ -package {{{packageName}}}.schemas.validation; +package {{{packageName}}}.schemas.validation -import {{{packageName}}}.exceptions.ValidationException; +import {{{packageName}}}.exceptions.ValidationException class MaxContainsValidator : KeywordValidator { @Throws(ValidationException::class) diff --git a/src/main/resources/kotlin/src/main/kotlin/packagename/schemas/validation/MaxItemsValidator.hbs b/src/main/resources/kotlin/src/main/kotlin/packagename/schemas/validation/MaxItemsValidator.hbs index b4d3898a42a..a5b8c62883e 100644 --- a/src/main/resources/kotlin/src/main/kotlin/packagename/schemas/validation/MaxItemsValidator.hbs +++ b/src/main/resources/kotlin/src/main/kotlin/packagename/schemas/validation/MaxItemsValidator.hbs @@ -1,6 +1,6 @@ -package {{{packageName}}}.schemas.validation; +package {{{packageName}}}.schemas.validation -import {{{packageName}}}.exceptions.ValidationException; +import {{{packageName}}}.exceptions.ValidationException class MaxItemsValidator : KeywordValidator { @Throws(ValidationException::class) diff --git a/src/main/resources/kotlin/src/main/kotlin/packagename/schemas/validation/MaxLengthValidator.hbs b/src/main/resources/kotlin/src/main/kotlin/packagename/schemas/validation/MaxLengthValidator.hbs index a2083b49177..49fc7f54203 100644 --- a/src/main/resources/kotlin/src/main/kotlin/packagename/schemas/validation/MaxLengthValidator.hbs +++ b/src/main/resources/kotlin/src/main/kotlin/packagename/schemas/validation/MaxLengthValidator.hbs @@ -1,6 +1,6 @@ -package {{{packageName}}}.schemas.validation; +package {{{packageName}}}.schemas.validation -import {{{packageName}}}.exceptions.ValidationException; +import {{{packageName}}}.exceptions.ValidationException class MaxLengthValidator : LengthValidator(), KeywordValidator { @Throws(ValidationException::class) diff --git a/src/main/resources/kotlin/src/main/kotlin/packagename/schemas/validation/MaxPropertiesValidator.hbs b/src/main/resources/kotlin/src/main/kotlin/packagename/schemas/validation/MaxPropertiesValidator.hbs index abc293b1cb2..5036a3c3c78 100644 --- a/src/main/resources/kotlin/src/main/kotlin/packagename/schemas/validation/MaxPropertiesValidator.hbs +++ b/src/main/resources/kotlin/src/main/kotlin/packagename/schemas/validation/MaxPropertiesValidator.hbs @@ -1,6 +1,6 @@ -package {{{packageName}}}.schemas.validation; +package {{{packageName}}}.schemas.validation -import {{{packageName}}}.exceptions.ValidationException; +import {{{packageName}}}.exceptions.ValidationException class MaxPropertiesValidator : KeywordValidator { @Throws(ValidationException::class) diff --git a/src/main/resources/kotlin/src/main/kotlin/packagename/schemas/validation/MaximumValidator.hbs b/src/main/resources/kotlin/src/main/kotlin/packagename/schemas/validation/MaximumValidator.hbs index f9c15d630f6..de5b60eba1f 100644 --- a/src/main/resources/kotlin/src/main/kotlin/packagename/schemas/validation/MaximumValidator.hbs +++ b/src/main/resources/kotlin/src/main/kotlin/packagename/schemas/validation/MaximumValidator.hbs @@ -1,6 +1,6 @@ -package {{{packageName}}}.schemas.validation; +package {{{packageName}}}.schemas.validation -import {{{packageName}}}.exceptions.ValidationException; +import {{{packageName}}}.exceptions.ValidationException class MaximumValidator : KeywordValidator { @Throws(ValidationException::class) diff --git a/src/main/resources/kotlin/src/main/kotlin/packagename/schemas/validation/MinContainsValidator.hbs b/src/main/resources/kotlin/src/main/kotlin/packagename/schemas/validation/MinContainsValidator.hbs index d355218d5b0..300bdfff8cf 100644 --- a/src/main/resources/kotlin/src/main/kotlin/packagename/schemas/validation/MinContainsValidator.hbs +++ b/src/main/resources/kotlin/src/main/kotlin/packagename/schemas/validation/MinContainsValidator.hbs @@ -1,6 +1,6 @@ -package {{{packageName}}}.schemas.validation; +package {{{packageName}}}.schemas.validation -import {{{packageName}}}.exceptions.ValidationException; +import {{{packageName}}}.exceptions.ValidationException class MinContainsValidator : KeywordValidator { @Throws(ValidationException::class) diff --git a/src/main/resources/kotlin/src/main/kotlin/packagename/schemas/validation/MinItemsValidator.hbs b/src/main/resources/kotlin/src/main/kotlin/packagename/schemas/validation/MinItemsValidator.hbs index 70f8f75a1aa..47f3c8efba7 100644 --- a/src/main/resources/kotlin/src/main/kotlin/packagename/schemas/validation/MinItemsValidator.hbs +++ b/src/main/resources/kotlin/src/main/kotlin/packagename/schemas/validation/MinItemsValidator.hbs @@ -1,6 +1,6 @@ -package {{{packageName}}}.schemas.validation; +package {{{packageName}}}.schemas.validation -import {{{packageName}}}.exceptions.ValidationException; +import {{{packageName}}}.exceptions.ValidationException class MinItemsValidator : KeywordValidator { @Throws(ValidationException::class) diff --git a/src/main/resources/kotlin/src/main/kotlin/packagename/schemas/validation/MinLengthValidator.hbs b/src/main/resources/kotlin/src/main/kotlin/packagename/schemas/validation/MinLengthValidator.hbs index 746efbbf76c..51bcaa41e6e 100644 --- a/src/main/resources/kotlin/src/main/kotlin/packagename/schemas/validation/MinLengthValidator.hbs +++ b/src/main/resources/kotlin/src/main/kotlin/packagename/schemas/validation/MinLengthValidator.hbs @@ -1,6 +1,6 @@ -package {{{packageName}}}.schemas.validation; +package {{{packageName}}}.schemas.validation -import {{{packageName}}}.exceptions.ValidationException; +import {{{packageName}}}.exceptions.ValidationException class MinLengthValidator : LengthValidator(), KeywordValidator { @Throws(ValidationException::class) diff --git a/src/main/resources/kotlin/src/main/kotlin/packagename/schemas/validation/MinPropertiesValidator.hbs b/src/main/resources/kotlin/src/main/kotlin/packagename/schemas/validation/MinPropertiesValidator.hbs index 63429267c2a..37c53191968 100644 --- a/src/main/resources/kotlin/src/main/kotlin/packagename/schemas/validation/MinPropertiesValidator.hbs +++ b/src/main/resources/kotlin/src/main/kotlin/packagename/schemas/validation/MinPropertiesValidator.hbs @@ -1,6 +1,6 @@ -package {{{packageName}}}.schemas.validation; +package {{{packageName}}}.schemas.validation -import {{{packageName}}}.exceptions.ValidationException; +import {{{packageName}}}.exceptions.ValidationException class MinPropertiesValidator : KeywordValidator { @Throws(ValidationException::class) diff --git a/src/main/resources/kotlin/src/main/kotlin/packagename/schemas/validation/MinimumValidator.hbs b/src/main/resources/kotlin/src/main/kotlin/packagename/schemas/validation/MinimumValidator.hbs index 962fe6be12a..770b9ea4fac 100644 --- a/src/main/resources/kotlin/src/main/kotlin/packagename/schemas/validation/MinimumValidator.hbs +++ b/src/main/resources/kotlin/src/main/kotlin/packagename/schemas/validation/MinimumValidator.hbs @@ -1,6 +1,6 @@ -package {{{packageName}}}.schemas.validation; +package {{{packageName}}}.schemas.validation -import {{{packageName}}}.exceptions.ValidationException; +import {{{packageName}}}.exceptions.ValidationException class MinimumValidator : KeywordValidator { @Throws(ValidationException::class) diff --git a/src/main/resources/kotlin/src/main/kotlin/packagename/schemas/validation/MultipleOfValidator.hbs b/src/main/resources/kotlin/src/main/kotlin/packagename/schemas/validation/MultipleOfValidator.hbs index 42575621098..9f5fafaa395 100644 --- a/src/main/resources/kotlin/src/main/kotlin/packagename/schemas/validation/MultipleOfValidator.hbs +++ b/src/main/resources/kotlin/src/main/kotlin/packagename/schemas/validation/MultipleOfValidator.hbs @@ -1,8 +1,8 @@ -package {{{packageName}}}.schemas.validation; +package {{{packageName}}}.schemas.validation -import {{{packageName}}}.exceptions.ValidationException; +import {{{packageName}}}.exceptions.ValidationException -import java.math.BigDecimal; +import java.math.BigDecimal class MultipleOfValidator : BigDecimalValidator(), KeywordValidator { @Throws(ValidationException::class) diff --git a/src/main/resources/kotlin/src/main/kotlin/packagename/schemas/validation/NotValidator.hbs b/src/main/resources/kotlin/src/main/kotlin/packagename/schemas/validation/NotValidator.hbs index a8f479b1a53..5dc57ee0643 100644 --- a/src/main/resources/kotlin/src/main/kotlin/packagename/schemas/validation/NotValidator.hbs +++ b/src/main/resources/kotlin/src/main/kotlin/packagename/schemas/validation/NotValidator.hbs @@ -1,6 +1,6 @@ -package {{{packageName}}}.schemas.validation; +package {{{packageName}}}.schemas.validation -import {{{packageName}}}.exceptions.ValidationException; +import {{{packageName}}}.exceptions.ValidationException class NotValidator : KeywordValidator { @Throws(ValidationException::class) diff --git a/src/main/resources/kotlin/src/main/kotlin/packagename/schemas/validation/NullEnumValidator.hbs b/src/main/resources/kotlin/src/main/kotlin/packagename/schemas/validation/NullEnumValidator.hbs index a51cac77805..ee7fd6ffa92 100644 --- a/src/main/resources/kotlin/src/main/kotlin/packagename/schemas/validation/NullEnumValidator.hbs +++ b/src/main/resources/kotlin/src/main/kotlin/packagename/schemas/validation/NullEnumValidator.hbs @@ -1,8 +1,9 @@ -package {{{packageName}}}.schemas.validation; +package {{{packageName}}}.schemas.validation -import {{{packageName}}}.configurations.SchemaConfiguration; -import {{{packageName}}}.exceptions.ValidationException; +import {{{packageName}}}.configurations.SchemaConfiguration +import {{{packageName}}}.exceptions.ValidationException -public interface NullEnumValidator { - Nothing? validate(EnumType arg, SchemaConfiguration configuration) throws ValidationException; +interface NullEnumValidator { + @Throws(ValidationException::class) + fun validate(arg: EnumType, configuration: SchemaConfiguration?): Nothing? } \ No newline at end of file diff --git a/src/main/resources/kotlin/src/main/kotlin/packagename/schemas/validation/NullSchemaValidator.hbs b/src/main/resources/kotlin/src/main/kotlin/packagename/schemas/validation/NullSchemaValidator.hbs index 6e655912dbf..32287211004 100644 --- a/src/main/resources/kotlin/src/main/kotlin/packagename/schemas/validation/NullSchemaValidator.hbs +++ b/src/main/resources/kotlin/src/main/kotlin/packagename/schemas/validation/NullSchemaValidator.hbs @@ -1,7 +1,7 @@ -package {{{packageName}}}.schemas.validation; +package {{{packageName}}}.schemas.validation -import {{{packageName}}}.configurations.SchemaConfiguration; -import {{{packageName}}}.exceptions.ValidationException; +import {{{packageName}}}.configurations.SchemaConfiguration +import {{{packageName}}}.exceptions.ValidationException interface NullSchemaValidator { @Throws(ValidationException::class) diff --git a/src/main/resources/kotlin/src/main/kotlin/packagename/schemas/validation/NullValueMethod.hbs b/src/main/resources/kotlin/src/main/kotlin/packagename/schemas/validation/NullValueMethod.hbs index e7336f0f0ad..4dae932a14c 100644 --- a/src/main/resources/kotlin/src/main/kotlin/packagename/schemas/validation/NullValueMethod.hbs +++ b/src/main/resources/kotlin/src/main/kotlin/packagename/schemas/validation/NullValueMethod.hbs @@ -1,5 +1,5 @@ -package {{{packageName}}}.schemas.validation; +package {{{packageName}}}.schemas.validation -public interface NullValueMethod { - Nothing? value(); +interface NullValueMethod { + fun value(): Nothing? } \ No newline at end of file diff --git a/src/main/resources/kotlin/src/main/kotlin/packagename/schemas/validation/NumberSchemaValidator.hbs b/src/main/resources/kotlin/src/main/kotlin/packagename/schemas/validation/NumberSchemaValidator.hbs index a5225ad8f86..66fbdace17b 100644 --- a/src/main/resources/kotlin/src/main/kotlin/packagename/schemas/validation/NumberSchemaValidator.hbs +++ b/src/main/resources/kotlin/src/main/kotlin/packagename/schemas/validation/NumberSchemaValidator.hbs @@ -1,7 +1,7 @@ -package {{{packageName}}}.schemas.validation; +package {{{packageName}}}.schemas.validation -import {{{packageName}}}.configurations.SchemaConfiguration; -import {{{packageName}}}.exceptions.ValidationException; +import {{{packageName}}}.configurations.SchemaConfiguration +import {{{packageName}}}.exceptions.ValidationException interface NumberSchemaValidator { @Throws(ValidationException::class) diff --git a/src/main/resources/kotlin/src/main/kotlin/packagename/schemas/validation/OneOfValidator.hbs b/src/main/resources/kotlin/src/main/kotlin/packagename/schemas/validation/OneOfValidator.hbs index a9e421b2262..2b92eba1d9b 100644 --- a/src/main/resources/kotlin/src/main/kotlin/packagename/schemas/validation/OneOfValidator.hbs +++ b/src/main/resources/kotlin/src/main/kotlin/packagename/schemas/validation/OneOfValidator.hbs @@ -1,6 +1,6 @@ -package {{{packageName}}}.schemas.validation; +package {{{packageName}}}.schemas.validation -import {{{packageName}}}.exceptions.ValidationException; +import {{{packageName}}}.exceptions.ValidationException class OneOfValidator : KeywordValidator { @Throws(ValidationException::class) diff --git a/src/main/resources/kotlin/src/main/kotlin/packagename/schemas/validation/PathToSchemasMap.hbs b/src/main/resources/kotlin/src/main/kotlin/packagename/schemas/validation/PathToSchemasMap.hbs index bdb4e341e59..206c726cab9 100644 --- a/src/main/resources/kotlin/src/main/kotlin/packagename/schemas/validation/PathToSchemasMap.hbs +++ b/src/main/resources/kotlin/src/main/kotlin/packagename/schemas/validation/PathToSchemasMap.hbs @@ -1,4 +1,4 @@ -package {{{packageName}}}.schemas.validation; +package {{{packageName}}}.schemas.validation class PathToSchemasMap : LinkedHashMap, LinkedHashMap, Nothing?>>() { fun update(other: PathToSchemasMap) { diff --git a/src/main/resources/kotlin/src/main/kotlin/packagename/schemas/validation/PatternPropertiesValidator.hbs b/src/main/resources/kotlin/src/main/kotlin/packagename/schemas/validation/PatternPropertiesValidator.hbs index cc06c1fb6a6..c27a1acbc85 100644 --- a/src/main/resources/kotlin/src/main/kotlin/packagename/schemas/validation/PatternPropertiesValidator.hbs +++ b/src/main/resources/kotlin/src/main/kotlin/packagename/schemas/validation/PatternPropertiesValidator.hbs @@ -1,4 +1,4 @@ -package {{{packageName}}}.schemas.validation; +package {{{packageName}}}.schemas.validation class PatternPropertiesValidator : KeywordValidator { override fun validate( diff --git a/src/main/resources/kotlin/src/main/kotlin/packagename/schemas/validation/PatternValidator.hbs b/src/main/resources/kotlin/src/main/kotlin/packagename/schemas/validation/PatternValidator.hbs index 690e7fe47cb..0708f8721d4 100644 --- a/src/main/resources/kotlin/src/main/kotlin/packagename/schemas/validation/PatternValidator.hbs +++ b/src/main/resources/kotlin/src/main/kotlin/packagename/schemas/validation/PatternValidator.hbs @@ -1,6 +1,8 @@ -package {{{packageName}}}.schemas.validation; +package {{{packageName}}}.schemas.validation -import {{{packageName}}}.exceptions.ValidationException; +import {{{packageName}}}.exceptions.ValidationException + +import java.util.regex.Pattern class PatternValidator : KeywordValidator { @Throws(ValidationException::class) diff --git a/src/main/resources/kotlin/src/main/kotlin/packagename/schemas/validation/PrefixItemsValidator.hbs b/src/main/resources/kotlin/src/main/kotlin/packagename/schemas/validation/PrefixItemsValidator.hbs index 83ca97fa5fc..6d6253f4885 100644 --- a/src/main/resources/kotlin/src/main/kotlin/packagename/schemas/validation/PrefixItemsValidator.hbs +++ b/src/main/resources/kotlin/src/main/kotlin/packagename/schemas/validation/PrefixItemsValidator.hbs @@ -1,6 +1,6 @@ -package {{{packageName}}}.schemas.validation; +package {{{packageName}}}.schemas.validation -import {{{packageName}}}.exceptions.ValidationException; +import {{{packageName}}}.exceptions.ValidationException import kotlin.math.min diff --git a/src/main/resources/kotlin/src/main/kotlin/packagename/schemas/validation/PropertiesValidator.hbs b/src/main/resources/kotlin/src/main/kotlin/packagename/schemas/validation/PropertiesValidator.hbs index 606b77c3959..853a520a5c6 100644 --- a/src/main/resources/kotlin/src/main/kotlin/packagename/schemas/validation/PropertiesValidator.hbs +++ b/src/main/resources/kotlin/src/main/kotlin/packagename/schemas/validation/PropertiesValidator.hbs @@ -1,6 +1,6 @@ -package {{{packageName}}}.schemas.validation; +package {{{packageName}}}.schemas.validation -import {{{packageName}}}.exceptions.ValidationException; +import {{{packageName}}}.exceptions.ValidationException class PropertiesValidator : KeywordValidator { @Throws(ValidationException::class) diff --git a/src/main/resources/kotlin/src/main/kotlin/packagename/schemas/validation/PropertyEntry.hbs b/src/main/resources/kotlin/src/main/kotlin/packagename/schemas/validation/PropertyEntry.hbs deleted file mode 100644 index e931cdbb0a4..00000000000 --- a/src/main/resources/kotlin/src/main/kotlin/packagename/schemas/validation/PropertyEntry.hbs +++ /dev/null @@ -1,10 +0,0 @@ -package {{{packageName}}}.schemas.validation; - -import java.util.AbstractMap; - -@SuppressWarnings("serial") -public class PropertyEntry extends AbstractMap.SimpleEntry>> { - public PropertyEntry(String key, Class> value) { - super(key, value); - } -} \ No newline at end of file diff --git a/src/main/resources/kotlin/src/main/kotlin/packagename/schemas/validation/PropertyNamesValidator.hbs b/src/main/resources/kotlin/src/main/kotlin/packagename/schemas/validation/PropertyNamesValidator.hbs index ff1b005e0c4..e7067a3c2c5 100644 --- a/src/main/resources/kotlin/src/main/kotlin/packagename/schemas/validation/PropertyNamesValidator.hbs +++ b/src/main/resources/kotlin/src/main/kotlin/packagename/schemas/validation/PropertyNamesValidator.hbs @@ -1,6 +1,6 @@ -package {{{packageName}}}.schemas.validation; +package {{{packageName}}}.schemas.validation -import {{{packageName}}}.exceptions.ValidationException; +import {{{packageName}}}.exceptions.ValidationException class PropertyNamesValidator : KeywordValidator { @Throws(ValidationException::class) diff --git a/src/main/resources/kotlin/src/main/kotlin/packagename/schemas/validation/RequiredValidator.hbs b/src/main/resources/kotlin/src/main/kotlin/packagename/schemas/validation/RequiredValidator.hbs index 27253408dee..c7c6f26a447 100644 --- a/src/main/resources/kotlin/src/main/kotlin/packagename/schemas/validation/RequiredValidator.hbs +++ b/src/main/resources/kotlin/src/main/kotlin/packagename/schemas/validation/RequiredValidator.hbs @@ -1,6 +1,6 @@ -package {{{packageName}}}.schemas.validation; +package {{{packageName}}}.schemas.validation -import {{{packageName}}}.exceptions.ValidationException; +import {{{packageName}}}.exceptions.ValidationException class RequiredValidator : KeywordValidator { @Throws(ValidationException::class) diff --git a/src/main/resources/kotlin/src/main/kotlin/packagename/schemas/validation/StringEnumValidator.hbs b/src/main/resources/kotlin/src/main/kotlin/packagename/schemas/validation/StringEnumValidator.hbs index 4731c6f1d9c..087da44dd8c 100644 --- a/src/main/resources/kotlin/src/main/kotlin/packagename/schemas/validation/StringEnumValidator.hbs +++ b/src/main/resources/kotlin/src/main/kotlin/packagename/schemas/validation/StringEnumValidator.hbs @@ -1,8 +1,9 @@ -package {{{packageName}}}.schemas.validation; +package {{{packageName}}}.schemas.validation -import {{{packageName}}}.configurations.SchemaConfiguration; -import {{{packageName}}}.exceptions.ValidationException; +import {{{packageName}}}.configurations.SchemaConfiguration +import {{{packageName}}}.exceptions.ValidationException -public interface StringEnumValidator { - String validate(EnumType arg, SchemaConfiguration configuration) throws ValidationException; +interface StringEnumValidator { + @Throws(ValidationException::class) + fun validate(arg: EnumType, configuration: SchemaConfiguration?): String } \ No newline at end of file diff --git a/src/main/resources/kotlin/src/main/kotlin/packagename/schemas/validation/StringSchemaValidator.hbs b/src/main/resources/kotlin/src/main/kotlin/packagename/schemas/validation/StringSchemaValidator.hbs index c750ce2bdaa..62f02ecb688 100644 --- a/src/main/resources/kotlin/src/main/kotlin/packagename/schemas/validation/StringSchemaValidator.hbs +++ b/src/main/resources/kotlin/src/main/kotlin/packagename/schemas/validation/StringSchemaValidator.hbs @@ -1,7 +1,7 @@ -package {{{packageName}}}.schemas.validation; +package {{{packageName}}}.schemas.validation -import {{{packageName}}}.configurations.SchemaConfiguration; -import {{{packageName}}}.exceptions.ValidationException; +import {{{packageName}}}.configurations.SchemaConfiguration +import {{{packageName}}}.exceptions.ValidationException interface StringSchemaValidator { @Throws(ValidationException::class) diff --git a/src/main/resources/kotlin/src/main/kotlin/packagename/schemas/validation/StringValueMethod.hbs b/src/main/resources/kotlin/src/main/kotlin/packagename/schemas/validation/StringValueMethod.hbs index 1378cd0ecaf..15e97bbf4a8 100644 --- a/src/main/resources/kotlin/src/main/kotlin/packagename/schemas/validation/StringValueMethod.hbs +++ b/src/main/resources/kotlin/src/main/kotlin/packagename/schemas/validation/StringValueMethod.hbs @@ -1,5 +1,5 @@ -package {{{packageName}}}.schemas.validation; +package {{{packageName}}}.schemas.validation -public interface StringValueMethod { - String value(); +interface StringValueMethod { + fun value(): String } \ No newline at end of file diff --git a/src/main/resources/kotlin/src/main/kotlin/packagename/schemas/validation/ThenValidator.hbs b/src/main/resources/kotlin/src/main/kotlin/packagename/schemas/validation/ThenValidator.hbs index 3f8872c70ac..7905ae2c727 100644 --- a/src/main/resources/kotlin/src/main/kotlin/packagename/schemas/validation/ThenValidator.hbs +++ b/src/main/resources/kotlin/src/main/kotlin/packagename/schemas/validation/ThenValidator.hbs @@ -1,6 +1,6 @@ -package {{{packageName}}}.schemas.validation; +package {{{packageName}}}.schemas.validation -import {{{packageName}}}.exceptions.ValidationException; +import {{{packageName}}}.exceptions.ValidationException class ThenValidator : KeywordValidator { @Throws(ValidationException::class) diff --git a/src/main/resources/kotlin/src/main/kotlin/packagename/schemas/validation/TypeValidator.hbs b/src/main/resources/kotlin/src/main/kotlin/packagename/schemas/validation/TypeValidator.hbs index c19ed0d810d..e99dfba4c9e 100644 --- a/src/main/resources/kotlin/src/main/kotlin/packagename/schemas/validation/TypeValidator.hbs +++ b/src/main/resources/kotlin/src/main/kotlin/packagename/schemas/validation/TypeValidator.hbs @@ -1,6 +1,6 @@ -package {{{packageName}}}.schemas.validation; +package {{{packageName}}}.schemas.validation -import {{{packageName}}}.exceptions.ValidationException; +import {{{packageName}}}.exceptions.ValidationException class TypeValidator : KeywordValidator { @Throws(ValidationException::class) @@ -15,11 +15,28 @@ class TypeValidator : KeywordValidator { Void::class.java } is List<*> -> { - MutableList::class.java + List::class.java } is Map<*, *> -> { - MutableMap::class.java + Map::class.java + } + + is Boolean -> { + Boolean::class.java + } + + is Int -> { + Int::class.java + } + is Long -> { + Long::class.java + } + is Double -> { + Double::class.java + } + is Float -> { + Float::class.java } else -> { diff --git a/src/main/resources/kotlin/src/main/kotlin/packagename/schemas/validation/UnevaluatedItemsValidator.hbs b/src/main/resources/kotlin/src/main/kotlin/packagename/schemas/validation/UnevaluatedItemsValidator.hbs index ef404a10906..de9a8e86f83 100644 --- a/src/main/resources/kotlin/src/main/kotlin/packagename/schemas/validation/UnevaluatedItemsValidator.hbs +++ b/src/main/resources/kotlin/src/main/kotlin/packagename/schemas/validation/UnevaluatedItemsValidator.hbs @@ -1,6 +1,6 @@ -package {{{packageName}}}.schemas.validation; +package {{{packageName}}}.schemas.validation -import {{{packageName}}}.exceptions.ValidationException; +import {{{packageName}}}.exceptions.ValidationException class UnevaluatedItemsValidator : KeywordValidator { @Throws(ValidationException::class) diff --git a/src/main/resources/kotlin/src/main/kotlin/packagename/schemas/validation/UnevaluatedPropertiesValidator.hbs b/src/main/resources/kotlin/src/main/kotlin/packagename/schemas/validation/UnevaluatedPropertiesValidator.hbs index 29ddb865016..6faab40d772 100644 --- a/src/main/resources/kotlin/src/main/kotlin/packagename/schemas/validation/UnevaluatedPropertiesValidator.hbs +++ b/src/main/resources/kotlin/src/main/kotlin/packagename/schemas/validation/UnevaluatedPropertiesValidator.hbs @@ -1,6 +1,6 @@ -package {{{packageName}}}.schemas.validation; +package {{{packageName}}}.schemas.validation -import {{{packageName}}}.exceptions.ValidationException; +import {{{packageName}}}.exceptions.ValidationException class UnevaluatedPropertiesValidator : KeywordValidator { @Throws(ValidationException::class) diff --git a/src/main/resources/kotlin/src/main/kotlin/packagename/schemas/validation/UniqueItemsValidator.hbs b/src/main/resources/kotlin/src/main/kotlin/packagename/schemas/validation/UniqueItemsValidator.hbs index 1ff48ea2f7c..2821d52a273 100644 --- a/src/main/resources/kotlin/src/main/kotlin/packagename/schemas/validation/UniqueItemsValidator.hbs +++ b/src/main/resources/kotlin/src/main/kotlin/packagename/schemas/validation/UniqueItemsValidator.hbs @@ -1,6 +1,6 @@ -package {{{packageName}}}.schemas.validation; +package {{{packageName}}}.schemas.validation -import {{{packageName}}}.exceptions.ValidationException; +import {{{packageName}}}.exceptions.ValidationException class UniqueItemsValidator : KeywordValidator { @Throws(ValidationException::class) diff --git a/src/main/resources/kotlin/src/main/kotlin/packagename/schemas/validation/UnsetAnyTypeJsonSchema.hbs b/src/main/resources/kotlin/src/main/kotlin/packagename/schemas/validation/UnsetAnyTypeJsonSchema.hbs index 380977e12f3..a7729c5cf29 100644 --- a/src/main/resources/kotlin/src/main/kotlin/packagename/schemas/validation/UnsetAnyTypeJsonSchema.hbs +++ b/src/main/resources/kotlin/src/main/kotlin/packagename/schemas/validation/UnsetAnyTypeJsonSchema.hbs @@ -1,8 +1,8 @@ -package {{{packageName}}}.schemas.validation; +package {{{packageName}}}.schemas.validation -import {{{packageName}}}.configurations.JsonSchemaKeywordFlags; -import {{{packageName}}}.configurations.SchemaConfiguration; -import {{{packageName}}}.exceptions.ValidationException; +import {{{packageName}}}.configurations.JsonSchemaKeywordFlags +import {{{packageName}}}.configurations.SchemaConfiguration +import {{{packageName}}}.exceptions.ValidationException import java.time.LocalDate import java.time.ZonedDateTime @@ -20,31 +20,31 @@ class UnsetAnyTypeJsonSchema { } data class UnsetAnyTypeJsonSchema1BoxedBoolean(val data: Boolean) : UnsetAnyTypeJsonSchema1Boxed { - override fun getData(): Boolean { + override fun getData(): Any? { return data } } data class UnsetAnyTypeJsonSchema1BoxedNumber(val data: Number) : UnsetAnyTypeJsonSchema1Boxed { - override fun getData(): Number { + override fun getData(): Any? { return data } } data class UnsetAnyTypeJsonSchema1BoxedString(val data: String) : UnsetAnyTypeJsonSchema1Boxed { - override fun getData(): String { + override fun getData(): Any? { return data } } data class UnsetAnyTypeJsonSchema1BoxedList(val data: FrozenList) : UnsetAnyTypeJsonSchema1Boxed { - override fun getData(): FrozenList { + override fun getData(): Any? { return data } } data class UnsetAnyTypeJsonSchema1BoxedMap(val data: FrozenMap) : UnsetAnyTypeJsonSchema1Boxed { - override fun getData(): FrozenMap { + override fun getData(): Any? { return data } } diff --git a/src/main/resources/kotlin/src/main/kotlin/packagename/schemas/validation/ValidationData.hbs b/src/main/resources/kotlin/src/main/kotlin/packagename/schemas/validation/ValidationData.hbs index bb09fee06d4..9509c2ac0d1 100644 --- a/src/main/resources/kotlin/src/main/kotlin/packagename/schemas/validation/ValidationData.hbs +++ b/src/main/resources/kotlin/src/main/kotlin/packagename/schemas/validation/ValidationData.hbs @@ -1,11 +1,11 @@ -package {{{packageName}}}.schemas.validation; +package {{{packageName}}}.schemas.validation data class ValidationData( val schema: JsonSchema<*>, val arg: Any?, val validationMetadata: ValidationMetadata, - val containsPathToSchemas: List?, - val patternPropertiesPathToSchemas: PathToSchemasMap?, - val ifPathToSchemas: PathToSchemasMap?, - val knownPathToSchemas: PathToSchemasMap? + val containsPathToSchemas: List? = null, + val patternPropertiesPathToSchemas: PathToSchemasMap? = null, + val ifPathToSchemas: PathToSchemasMap? = null, + val knownPathToSchemas: PathToSchemasMap? = null ) \ No newline at end of file diff --git a/src/main/resources/kotlin/src/main/kotlin/packagename/schemas/validation/ValidationMetadata.hbs b/src/main/resources/kotlin/src/main/kotlin/packagename/schemas/validation/ValidationMetadata.hbs index 6dc4e71ddda..70ce12ee9b6 100644 --- a/src/main/resources/kotlin/src/main/kotlin/packagename/schemas/validation/ValidationMetadata.hbs +++ b/src/main/resources/kotlin/src/main/kotlin/packagename/schemas/validation/ValidationMetadata.hbs @@ -1,6 +1,6 @@ -package {{{packageName}}}.schemas.validation; +package {{{packageName}}}.schemas.validation -import {{{packageName}}}.configurations.SchemaConfiguration; +import {{{packageName}}}.configurations.SchemaConfiguration data class ValidationMetadata( val pathToItem: List, @@ -9,7 +9,7 @@ data class ValidationMetadata( val seenClasses: Set> ) { fun validationRanEarlier(schema: JsonSchema<*>): Boolean { - val validatedSchemas: Map?, Nothing?>? = validatedPathToSchemas[pathToItem] + val validatedSchemas: Map, Nothing?>? = validatedPathToSchemas[pathToItem] if (validatedSchemas != null && validatedSchemas.containsKey(schema)) { return true } diff --git a/src/main/resources/kotlin/src/main/kotlin/packagename/servers/Server.hbs b/src/main/resources/kotlin/src/main/kotlin/packagename/servers/Server.hbs index 8d8405a8cd9..166458cf104 100644 --- a/src/main/resources/kotlin/src/main/kotlin/packagename/servers/Server.hbs +++ b/src/main/resources/kotlin/src/main/kotlin/packagename/servers/Server.hbs @@ -1,6 +1,5 @@ package {{{packageName}}}.servers; -public interface Server { - String url(); +interface Server { + fun url(): String } - diff --git a/src/main/resources/kotlin/src/main/kotlin/packagename/servers/ServerInfo.hbs b/src/main/resources/kotlin/src/main/kotlin/packagename/servers/ServerInfo.hbs index 5c5999cc15d..372cc59730e 100644 --- a/src/main/resources/kotlin/src/main/kotlin/packagename/servers/ServerInfo.hbs +++ b/src/main/resources/kotlin/src/main/kotlin/packagename/servers/ServerInfo.hbs @@ -1,38 +1,25 @@ {{#if servers.subpackage}} -package {{{packageName}}}.{{servers.subpackage}}; +package {{{packageName}}}.{{servers.subpackage}} {{else}} -package {{{packageName}}}; +package {{{packageName}}} {{/if}} {{#each servers}} -import {{{packageName}}}.{{subpackage}}.{{jsonPathPiece.pascalCase}}; +import {{{packageName}}}.{{subpackage}}.{{jsonPathPiece.pascalCase}} {{/each}} -import {{{packageName}}}.servers.Server; -import {{{packageName}}}.servers.ServerProvider; -import org.checkerframework.checker.nullness.qual.Nullable; +import {{{packageName}}}.servers.Server +import {{{packageName}}}.servers.ServerProvider -import java.util.Objects; - -public class {{servers.jsonPathPiece.pascalCase}} { - public static class {{servers.jsonPathPiece.pascalCase}}1 implements ServerProvider { - {{#each servers}} - private final {{jsonPathPiece.pascalCase}} server{{@index}}; - {{/each}} - - {{servers.jsonPathPiece.pascalCase}}1( - {{#each servers}} - @Nullable {{jsonPathPiece.pascalCase}} server{{@index}}{{#unless @last}},{{/unless}} - {{/each}} - ) { +class {{servers.jsonPathPiece.pascalCase}} { + class {{servers.jsonPathPiece.pascalCase}}1( {{#each servers}} - this.server{{@index}} = Objects.requireNonNullElseGet(server{{@index}}, {{jsonPathPiece.pascalCase}}::new); + private val server{{@index}}: {{jsonPathPiece.pascalCase}} = {{jsonPathPiece.pascalCase}}(){{#unless @last}},{{/unless}} {{/each}} - } + ) : ServerProvider { - @Override - public Server getServer(ServerIndex serverIndex) { + override fun getServer(serverIndex: ServerIndex): Server { {{#eq servers.size 1}} - return server0; + return server0 {{else}} switch (serverIndex) { {{#each servers}} @@ -49,30 +36,7 @@ public class {{servers.jsonPathPiece.pascalCase}} { } } - public static class {{servers.jsonPathPiece.pascalCase}}Builder { - {{#each servers}} - private @Nullable {{jsonPathPiece.pascalCase}} server{{@index}}; - {{/each}} - - public {{servers.jsonPathPiece.pascalCase}}Builder() {} - {{#each servers}} - - public {{../servers.jsonPathPiece.pascalCase}}Builder {{jsonPathPiece.camelCase}}({{jsonPathPiece.pascalCase}} server{{@index}}) { - this.server{{@index}} = server{{@index}}; - return this; - } - {{/each}} - - public {{servers.jsonPathPiece.pascalCase}}1 build() { - return new {{servers.jsonPathPiece.pascalCase}}1( - {{#each servers}} - server{{@index}}{{#unless @last}},{{/unless}} - {{/each}} - ); - } - } - - public enum ServerIndex { + enum class ServerIndex { {{#each servers}} SERVER_{{@index}}{{#unless @last}},{{/unless}} {{/each}} diff --git a/src/main/resources/kotlin/src/main/kotlin/packagename/servers/ServerN.hbs b/src/main/resources/kotlin/src/main/kotlin/packagename/servers/ServerN.hbs index 0a691bd2d1b..bf643cba542 100644 --- a/src/main/resources/kotlin/src/main/kotlin/packagename/servers/ServerN.hbs +++ b/src/main/resources/kotlin/src/main/kotlin/packagename/servers/ServerN.hbs @@ -13,7 +13,7 @@ import {{{packageName}}}.{{subpackage}}.{{containerJsonPathPiece.pascalCase}}; import java.util.AbstractMap; -public class {{../jsonPathPiece.pascalCase}} extends ServerWithVariables<{{containerJsonPathPiece.pascalCase}}.{{mapOutputJsonPathPiece.pascalCase}}> { +class {{../jsonPathPiece.pascalCase}} : ServerWithVariables<{{containerJsonPathPiece.pascalCase}}.{{mapOutputJsonPathPiece.pascalCase}}> { {{#if ../description}} /* {{../description.original}} @@ -49,15 +49,12 @@ public class {{../jsonPathPiece.pascalCase}} extends ServerWithVariables<{{conta import {{{packageName}}}.servers.ServerWithoutVariables; {{/neq}} -public class {{jsonPathPiece.pascalCase}} extends ServerWithoutVariables { +class {{jsonPathPiece.pascalCase}} : ServerWithoutVariables("{{url}}") { {{#if ../description}} /* {{../description.original}} */ {{/if}} - public {{jsonPathPiece.pascalCase}}() { - super("{{url}}"); - } } {{/with}} {{/with}} \ No newline at end of file diff --git a/src/main/resources/kotlin/src/main/kotlin/packagename/servers/ServerProvider.hbs b/src/main/resources/kotlin/src/main/kotlin/packagename/servers/ServerProvider.hbs index 68a0a9c4af5..3777b296e48 100644 --- a/src/main/resources/kotlin/src/main/kotlin/packagename/servers/ServerProvider.hbs +++ b/src/main/resources/kotlin/src/main/kotlin/packagename/servers/ServerProvider.hbs @@ -1,6 +1,6 @@ package {{{packageName}}}.servers; -public interface ServerProvider { - Server getServer(T serverIndex); +interface ServerProvider { + fun getServer(serverIndex: T): Server } diff --git a/src/main/resources/kotlin/src/main/kotlin/packagename/servers/ServerWithVariables.hbs b/src/main/resources/kotlin/src/main/kotlin/packagename/servers/ServerWithVariables.hbs index 973e0d6649a..1aeef2aff50 100644 --- a/src/main/resources/kotlin/src/main/kotlin/packagename/servers/ServerWithVariables.hbs +++ b/src/main/resources/kotlin/src/main/kotlin/packagename/servers/ServerWithVariables.hbs @@ -1,21 +1,20 @@ -package {{{packageName}}}.servers; +package {{{packageName}}}.servers -import java.util.Map; +abstract class ServerWithVariables> protected constructor(url: String, variables: T) : + Server { + val url: String + val variables: T -public abstract class ServerWithVariables> implements Server { - public final String url; - public final T variables; - - protected ServerWithVariables(String url, T variables) { - this.variables = variables; - for (Map.Entry entry: variables.entrySet()) { - url = url.replace("{" + entry.getKey() + "}", entry.getValue()); + init { + var url = url + this.variables = variables + for ((key, value) in variables) { + url = url.replace("{$key}", value) } - this.url = url; + this.url = url } - public String url(){ - return url; + override fun url(): String { + return url } } - diff --git a/src/main/resources/kotlin/src/main/kotlin/packagename/servers/ServerWithoutVariables.hbs b/src/main/resources/kotlin/src/main/kotlin/packagename/servers/ServerWithoutVariables.hbs index 8adff0b1825..963fb222752 100644 --- a/src/main/resources/kotlin/src/main/kotlin/packagename/servers/ServerWithoutVariables.hbs +++ b/src/main/resources/kotlin/src/main/kotlin/packagename/servers/ServerWithoutVariables.hbs @@ -1,14 +1,8 @@ package {{{packageName}}}.servers; -public abstract class ServerWithoutVariables implements Server { - public final String url; - - protected ServerWithoutVariables(String url) { - this.url = url; - } - - public String url(){ - return url; +abstract class ServerWithoutVariables protected constructor(val url: String) : Server { + override fun url(): String { + return url } } diff --git a/src/main/resources/kotlin/src/test/kotlin/packagename/components/schemas/Schema_test.hbs b/src/main/resources/kotlin/src/test/kotlin/packagename/components/schemas/Schema_test.hbs index 967d98d41b1..69bcfdafe93 100644 --- a/src/main/resources/kotlin/src/test/kotlin/packagename/components/schemas/Schema_test.hbs +++ b/src/main/resources/kotlin/src/test/kotlin/packagename/components/schemas/Schema_test.hbs @@ -1,33 +1,29 @@ -package {{{packageName}}}.components.schemas; +package {{{packageName}}}.components.schemas -import org.junit.Assert; -import org.junit.Test; -import {{{packageName}}}.configurations.JsonSchemaKeywordFlags; -import {{{packageName}}}.configurations.SchemaConfiguration; -import {{{packageName}}}.exceptions.ValidationException; -import {{{packageName}}}.schemas.validation.MapUtils; -import org.checkerframework.checker.nullness.qual.Nullable; +import {{{packageName}}}.configurations.JsonSchemaKeywordFlags +import {{{packageName}}}.configurations.SchemaConfiguration +import {{{packageName}}}.exceptions.ValidationException -import java.util.Arrays; -import java.util.List; -import java.util.Map; -import java.util.AbstractMap; +import kotlin.test.Test +import kotlin.test.assertFailsWith {{#with schema}} -public class {{containerJsonPathPiece.pascalCase}}Test { - static final SchemaConfiguration configuration = new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().format().build()); +class {{containerJsonPathPiece.pascalCase}}Test { + companion object { + val configuration = SchemaConfiguration(JsonSchemaKeywordFlags.Builder().format().build()) + } {{#each testCases}} {{#with this }} @Test - public void test{{@key}}{{#if valid}}Passes() throws ValidationException{{else}}Fails(){{/if}} { + fun test{{@key}}{{#if valid}}Passes(){{else}}Fails(){{/if}} { // {{description.codeEscaped}} - final var schema = {{containerJsonPathPiece.pascalCase}}.{{jsonPathPiece.pascalCase}}.getInstance(); + val schema = {{containerJsonPathPiece.pascalCase}}.{{jsonPathPiece.pascalCase}}.getInstance() {{#if valid}} schema.validate( {{#with data}} {{#and (eq type "array") ../arrayInputJsonPathPiece }} - new {{../containerJsonPathPiece.pascalCase}}.{{../arrayInputJsonPathPiece.pascalCase}}() + {{../containerJsonPathPiece.pascalCase}}.{{../arrayInputJsonPathPiece.pascalCase}}() {{> src/main/kotlin/packagename/components/schemas/helpers/payload_renderer constructor=true endChar="" }} .build(), {{else}} @@ -35,19 +31,18 @@ public class {{containerJsonPathPiece.pascalCase}}Test { {{/and}} {{/with}} configuration - ); + ) {{else}} - try { - schema.validate( - {{#with data}} - {{> src/main/kotlin/packagename/components/schemas/helpers/payload_renderer endChar="," }} - {{/with}} - configuration - ); - throw new RuntimeException("A different exception must be thrown"); - } catch (ValidationException ignored) { - ; - } + assertFailsWith( + block = { + schema.validate( + {{#with data}} + {{> src/main/kotlin/packagename/components/schemas/helpers/payload_renderer endChar="," }} + {{/with}} + configuration + ) + } + ) {{/if}} } {{/with}} diff --git a/src/main/resources/kotlin/src/test/kotlin/packagename/configurations/JsonSchemaKeywordFlagsTest.hbs b/src/main/resources/kotlin/src/test/kotlin/packagename/configurations/JsonSchemaKeywordFlagsTest.hbs index 273bcca5ce8..6aacfec5379 100644 --- a/src/main/resources/kotlin/src/test/kotlin/packagename/configurations/JsonSchemaKeywordFlagsTest.hbs +++ b/src/main/resources/kotlin/src/test/kotlin/packagename/configurations/JsonSchemaKeywordFlagsTest.hbs @@ -1,14 +1,12 @@ package {{{packageName}}}.configurations; -import org.junit.Assert; -import org.junit.Test; -import java.util.LinkedHashSet; - -public final class JsonSchemaKeywordFlagsTest { +import kotlin.test.Test +import kotlin.test.assertEquals +class JsonSchemaKeywordFlagsTest { @Test - public void testGetEnabledKeywords() { - final JsonSchemaKeywordFlags jsonSchemaKeywordFlags = new JsonSchemaKeywordFlags( + fun testGetEnabledKeywords() { + val jsonSchemaKeywordFlags = JsonSchemaKeywordFlags( true, true, true, @@ -48,96 +46,96 @@ public final class JsonSchemaKeywordFlagsTest { true, true, true - ); - LinkedHashSet enabledKeywords = jsonSchemaKeywordFlags.getKeywords(); - LinkedHashSet expectedEnabledKeywords = new LinkedHashSet<>(); - expectedEnabledKeywords.add("additionalProperties"); - expectedEnabledKeywords.add("allOf"); - expectedEnabledKeywords.add("anyOf"); - expectedEnabledKeywords.add("const"); - expectedEnabledKeywords.add("contains"); - expectedEnabledKeywords.add("dependentRequired"); - expectedEnabledKeywords.add("dependentSchemas"); - expectedEnabledKeywords.add("discriminator"); - expectedEnabledKeywords.add("else_"); - expectedEnabledKeywords.add("enum_"); - expectedEnabledKeywords.add("exclusiveMaximum"); - expectedEnabledKeywords.add("exclusiveMinimum"); - expectedEnabledKeywords.add("format"); - expectedEnabledKeywords.add("if_"); - expectedEnabledKeywords.add("maximum"); - expectedEnabledKeywords.add("minimum"); - expectedEnabledKeywords.add("items"); - expectedEnabledKeywords.add("maxContains"); - expectedEnabledKeywords.add("maxItems"); - expectedEnabledKeywords.add("maxLength"); - expectedEnabledKeywords.add("maxProperties"); - expectedEnabledKeywords.add("minContains"); - expectedEnabledKeywords.add("minItems"); - expectedEnabledKeywords.add("minLength"); - expectedEnabledKeywords.add("minProperties"); - expectedEnabledKeywords.add("multipleOf"); - expectedEnabledKeywords.add("not"); - expectedEnabledKeywords.add("oneOf"); - expectedEnabledKeywords.add("pattern"); - expectedEnabledKeywords.add("patternProperties"); - expectedEnabledKeywords.add("prefixItems"); - expectedEnabledKeywords.add("properties"); - expectedEnabledKeywords.add("propertyNames"); - expectedEnabledKeywords.add("required"); - expectedEnabledKeywords.add("then"); - expectedEnabledKeywords.add("type"); - expectedEnabledKeywords.add("uniqueItems"); - expectedEnabledKeywords.add("unevaluatedItems"); - expectedEnabledKeywords.add("unevaluatedProperties"); - Assert.assertEquals(enabledKeywords, expectedEnabledKeywords); + ) + val enabledKeywords = jsonSchemaKeywordFlags.keywords + val expectedEnabledKeywords = LinkedHashSet() + expectedEnabledKeywords.add("additionalProperties") + expectedEnabledKeywords.add("allOf") + expectedEnabledKeywords.add("anyOf") + expectedEnabledKeywords.add("const") + expectedEnabledKeywords.add("contains") + expectedEnabledKeywords.add("dependentRequired") + expectedEnabledKeywords.add("dependentSchemas") + expectedEnabledKeywords.add("discriminator") + expectedEnabledKeywords.add("else_") + expectedEnabledKeywords.add("enum_") + expectedEnabledKeywords.add("exclusiveMaximum") + expectedEnabledKeywords.add("exclusiveMinimum") + expectedEnabledKeywords.add("format") + expectedEnabledKeywords.add("if_") + expectedEnabledKeywords.add("maximum") + expectedEnabledKeywords.add("minimum") + expectedEnabledKeywords.add("items") + expectedEnabledKeywords.add("maxContains") + expectedEnabledKeywords.add("maxItems") + expectedEnabledKeywords.add("maxLength") + expectedEnabledKeywords.add("maxProperties") + expectedEnabledKeywords.add("minContains") + expectedEnabledKeywords.add("minItems") + expectedEnabledKeywords.add("minLength") + expectedEnabledKeywords.add("minProperties") + expectedEnabledKeywords.add("multipleOf") + expectedEnabledKeywords.add("not") + expectedEnabledKeywords.add("oneOf") + expectedEnabledKeywords.add("pattern") + expectedEnabledKeywords.add("patternProperties") + expectedEnabledKeywords.add("prefixItems") + expectedEnabledKeywords.add("properties") + expectedEnabledKeywords.add("propertyNames") + expectedEnabledKeywords.add("required") + expectedEnabledKeywords.add("then") + expectedEnabledKeywords.add("type") + expectedEnabledKeywords.add("uniqueItems") + expectedEnabledKeywords.add("unevaluatedItems") + expectedEnabledKeywords.add("unevaluatedProperties") + assertEquals(enabledKeywords, expectedEnabledKeywords) } @Test - public void testGetNoEnabledKeywords() { - final JsonSchemaKeywordFlags jsonSchemaKeywordFlags = new JsonSchemaKeywordFlags( - false, - false, - false, - false, - false, - false, - false, - false, - false, - false, - false, - false, - false, - false, - false, - false, - false, - false, - false, - false, - false, - false, - false, - false, - false, - false, - false, - false, - false, - false, - false, - false, - false, - false, - false, - false, - false, - false, - false - ); - LinkedHashSet enabledKeywords = jsonSchemaKeywordFlags.getKeywords(); - LinkedHashSet expectedEnabledKeywords = new LinkedHashSet<>(); - Assert.assertEquals(enabledKeywords, expectedEnabledKeywords); + fun testGetNoEnabledKeywords() { + val jsonSchemaKeywordFlags = JsonSchemaKeywordFlags( + false, + false, + false, + false, + false, + false, + false, + false, + false, + false, + false, + false, + false, + false, + false, + false, + false, + false, + false, + false, + false, + false, + false, + false, + false, + false, + false, + false, + false, + false, + false, + false, + false, + false, + false, + false, + false, + false, + false + ) + val enabledKeywords = jsonSchemaKeywordFlags.keywords + val expectedEnabledKeywords = LinkedHashSet() + assertEquals(enabledKeywords, expectedEnabledKeywords) } -} +} \ No newline at end of file diff --git a/src/main/resources/kotlin/src/test/kotlin/packagename/schemas/AnyTypeSchemaTest.hbs b/src/main/resources/kotlin/src/test/kotlin/packagename/schemas/AnyTypeSchemaTest.hbs index fc374e0b019..0fe31c6a596 100644 --- a/src/main/resources/kotlin/src/test/kotlin/packagename/schemas/AnyTypeSchemaTest.hbs +++ b/src/main/resources/kotlin/src/test/kotlin/packagename/schemas/AnyTypeSchemaTest.hbs @@ -1,106 +1,113 @@ -package {{{packageName}}}.schemas; - -import org.checkerframework.checker.nullness.qual.Nullable; -import org.junit.Assert; -import org.junit.Test; -import {{{packageName}}}.configurations.JsonSchemaKeywordFlags; -import {{{packageName}}}.configurations.SchemaConfiguration; -import {{{packageName}}}.exceptions.ValidationException; -import {{{packageName}}}.schemas.validation.FrozenList; -import {{{packageName}}}.schemas.validation.FrozenMap; - -import java.time.LocalDate; -import java.time.ZoneId; -import java.time.ZonedDateTime; -import java.util.ArrayList; -import java.util.LinkedHashMap; - - -public class AnyTypeSchemaTest { - static final AnyTypeJsonSchema.AnyTypeJsonSchema1 schema = AnyTypeJsonSchema.AnyTypeJsonSchema1.getInstance(); - static final SchemaConfiguration configuration = new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().build()); - - @SuppressWarnings("nullness") - private Nothing? assertNull(@Nullable Object object) { - Assert.assertNull(object); - return null; - } - +package {{{packageName}}}.schemas + +import {{{packageName}}}.configurations.JsonSchemaKeywordFlags +import {{{packageName}}}.configurations.SchemaConfiguration +import {{{packageName}}}.exceptions.ValidationException +import {{{packageName}}}.schemas.validation.FrozenList +import {{{packageName}}}.schemas.validation.FrozenMap + +import java.time.LocalDate +import java.time.ZoneId +import java.time.ZonedDateTime +import kotlin.test.Test +import kotlin.test.assertEquals +import kotlin.test.assertFalse +import kotlin.test.assertNull +import kotlin.test.assertTrue + +class AnyTypeSchemaTest { @Test - public void testValidateNull() throws ValidationException { - Nothing? validatedValue = schema.validate((Nothing?) null, configuration); - assertNull(validatedValue); + @Throws(ValidationException::class) + fun testValidateNull() { + val validatedValue: Nothing? = schema.validate(null, configuration) + assertNull(validatedValue) } @Test - public void testValidateBoolean() throws ValidationException { - boolean trueValue = schema.validate(true, configuration); - Assert.assertTrue(trueValue); - - boolean falseValue = schema.validate(false, configuration); - Assert.assertFalse(falseValue); + @Throws(ValidationException::class) + fun testValidateBoolean() { + val trueValue = schema.validate(true, configuration) + assertTrue(trueValue) + val falseValue = schema.validate(false, configuration) + assertFalse(falseValue) } @Test - public void testValidateInteger() throws ValidationException { - int validatedValue = schema.validate(1, configuration); - Assert.assertEquals(validatedValue, 1); + @Throws(ValidationException::class) + fun testValidateInteger() { + val validatedValue = schema.validate(1, configuration) + assertEquals(validatedValue.toLong(), 1) } @Test - public void testValidateLong() throws ValidationException { - long validatedValue = schema.validate(1L, configuration); - Assert.assertEquals(validatedValue, 1L); + @Throws(ValidationException::class) + fun testValidateLong() { + val validatedValue = schema.validate(1L, configuration) + assertEquals(validatedValue, 1L) } @Test - public void testValidateFloat() throws ValidationException { - float validatedValue = schema.validate(3.14f, configuration); - Assert.assertEquals(Float.compare(validatedValue, 3.14f), 0); + @Throws(ValidationException::class) + fun testValidateFloat() { + val validatedValue = schema.validate(3.14f, configuration) + assertEquals(validatedValue.compareTo(3.14f).toLong(), 0) } @Test - public void testValidateDouble() throws ValidationException { - double validatedValue = schema.validate(70.6458763d, configuration); - Assert.assertEquals(Double.compare(validatedValue, 70.6458763d), 0); + @Throws(ValidationException::class) + fun testValidateDouble() { + val validatedValue = schema.validate(70.6458763, configuration) + assertEquals(validatedValue.compareTo(70.6458763).toLong(), 0) } @Test - public void testValidateString() throws ValidationException { - String validatedValue = schema.validate("a", configuration); - Assert.assertEquals(validatedValue, "a"); + @Throws(ValidationException::class) + fun testValidateString() { + val validatedValue = schema.validate("a", configuration) + assertEquals(validatedValue, "a") } @Test - 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"); + @Throws(ValidationException::class) + fun testValidateZonedDateTime() { + val validatedValue = + schema.validate(ZonedDateTime.of(2017, 7, 21, 17, 32, 28, 0, ZoneId.of("Z")), configuration) + assertEquals(validatedValue, "2017-07-21T17:32:28Z") } @Test - public void testValidateLocalDate() throws ValidationException { - String validatedValue = schema.validate(LocalDate.of(2017, 7, 21), configuration); - Assert.assertEquals(validatedValue, "2017-07-21"); + @Throws(ValidationException::class) + fun testValidateLocalDate() { + val validatedValue = schema.validate(LocalDate.of(2017, 7, 21), configuration) + assertEquals(validatedValue, "2017-07-21") } @Test - public void testValidateMap() throws ValidationException { - LinkedHashMap inMap = new LinkedHashMap<>(); - inMap.put("today", LocalDate.of(2017, 7, 21)); - FrozenMap validatedValue = schema.validate(inMap, configuration); - LinkedHashMap outMap = new LinkedHashMap<>(); - outMap.put("today", "2017-07-21"); - Assert.assertEquals(validatedValue, outMap); + @Throws(ValidationException::class) + fun testValidateMap() { + val inMap = mapOf( + "today" to LocalDate.of(2017, 7, 21) + ) + val validatedValue: FrozenMap<*> = schema.validate(inMap, configuration) + val outMap: Map = mapOf( + "today" to "2017-07-21" + ) + assertEquals(validatedValue, outMap) } @Test - public void testValidateList() throws ValidationException { - ArrayList inList = new ArrayList<>(); - inList.add(LocalDate.of(2017, 7, 21)); - FrozenList validatedValue = schema.validate(inList, configuration); - ArrayList outList = new ArrayList<>(); - outList.add( "2017-07-21"); - Assert.assertEquals(validatedValue, outList); + @Throws(ValidationException::class) + fun testValidateList() { + val inList = listOf( + LocalDate.of(2017, 7, 21) + ) + val validatedValue: FrozenList<*> = schema.validate(inList, configuration) + val outList: List = listOf("2017-07-21") + assertEquals(validatedValue, outList) } -} + companion object { + val schema = AnyTypeJsonSchema.AnyTypeJsonSchema1.getInstance() + val configuration = SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + } +} \ No newline at end of file diff --git a/src/main/resources/kotlin/src/test/kotlin/packagename/schemas/ArrayTypeSchemaTest.hbs b/src/main/resources/kotlin/src/test/kotlin/packagename/schemas/ArrayTypeSchemaTest.hbs index b3ba44277e6..448476ab991 100644 --- a/src/main/resources/kotlin/src/test/kotlin/packagename/schemas/ArrayTypeSchemaTest.hbs +++ b/src/main/resources/kotlin/src/test/kotlin/packagename/schemas/ArrayTypeSchemaTest.hbs @@ -1,252 +1,251 @@ -package {{{packageName}}}.schemas; - -import org.checkerframework.checker.nullness.qual.Nullable; -import org.junit.Assert; -import org.junit.Test; -import {{{packageName}}}.configurations.JsonSchemaKeywordFlags; -import {{{packageName}}}.configurations.SchemaConfiguration; -import {{{packageName}}}.exceptions.ValidationException; -import {{{packageName}}}.schemas.validation.JsonSchema; -import {{{packageName}}}.schemas.validation.JsonSchemaInfo; -import {{{packageName}}}.schemas.validation.FrozenList; -import {{{packageName}}}.schemas.validation.PathToSchemasMap; -import {{{packageName}}}.schemas.validation.ListSchemaValidator; -import {{{packageName}}}.schemas.validation.ValidationMetadata; - -import java.util.ArrayList; -import java.util.HashSet; -import java.util.LinkedHashMap; -import java.util.LinkedHashSet; -import java.util.List; -import java.util.Objects; -import java.util.Set; - -public class ArrayTypeSchemaTest { - static final SchemaConfiguration configuration = new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().build()); - static final ValidationMetadata validationMetadata = new ValidationMetadata( - List.of("args[0"), - configuration, - new PathToSchemasMap(), - new LinkedHashSet<>() - ); - - public sealed interface ArrayWithItemsSchemaBoxed permits ArrayWithItemsSchemaBoxedList { - } - public record ArrayWithItemsSchemaBoxedList(FrozenList data) implements ArrayWithItemsSchemaBoxed { - } - - public static class ArrayWithItemsSchema extends JsonSchema implements ListSchemaValidator, ArrayWithItemsSchemaBoxedList> { - public ArrayWithItemsSchema() { - super(new JsonSchemaInfo() - .type(Set.of(List.class)) - .items(StringJsonSchema.StringJsonSchema1.class) - ); - } - - @Override - public FrozenList getNewInstance(List arg, List pathToItem, PathToSchemasMap pathToSchemas) { - List items = new ArrayList<>(); - int i = 0; - for (Object item: arg) { - List itemPathToItem = new ArrayList<>(pathToItem); - itemPathToItem.add(i); - LinkedHashMap, Nothing?> schemas = pathToSchemas.get(itemPathToItem); - if (schemas == null) { - 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 RuntimeException("Instantiated type of item is invalid"); - } - items.add((String) castItem); - i += 1; +package {{{packageName}}}.schemas + +import {{{packageName}}}.configurations.JsonSchemaKeywordFlags +import {{{packageName}}}.configurations.SchemaConfiguration +import {{{packageName}}}.exceptions.ValidationException +import {{{packageName}}}.schemas.validation.JsonSchema +import {{{packageName}}}.schemas.validation.JsonSchemaInfo +import {{{packageName}}}.schemas.validation.FrozenList +import {{{packageName}}}.schemas.validation.PathToSchemasMap +import {{{packageName}}}.schemas.validation.ListSchemaValidator +import {{{packageName}}}.schemas.validation.ValidationMetadata + +import kotlin.test.Test +import kotlin.test.assertEquals +import kotlin.test.assertFailsWith + +class ArrayTypeSchemaTest { + sealed interface ArrayWithItemsSchemaBoxed + + data class ArrayWithItemsSchemaBoxedList(val data: FrozenList) : ArrayWithItemsSchemaBoxed + class ArrayWithItemsSchema : JsonSchema( + JsonSchemaInfo() + .type(setOf(List::class.java)) + .items(StringJsonSchema.StringJsonSchema1::class.java) + ), ListSchemaValidator, ArrayWithItemsSchemaBoxedList> { + override fun getNewInstance( + arg: List<*>, + pathToItem: List, + pathToSchemas: PathToSchemasMap + ): FrozenList { + val items: MutableList = ArrayList() + var i = 0 + for (item in arg) { + val itemPathToItem: MutableList = ArrayList(pathToItem) + itemPathToItem.add(i) + val schemas = pathToSchemas[itemPathToItem] + ?: throw RuntimeException("Validation result is invalid, schemas must exist for a pathToItem") + val itemSchema = schemas.entries.iterator().next().key + val castItem = itemSchema.getNewInstance(item, itemPathToItem, pathToSchemas) as? String + ?: throw RuntimeException("Instantiated type of item is invalid") + items.add(castItem) + i += 1 } - return new FrozenList<>(items); + return FrozenList(items) } - 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); - SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().build())); - ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, new PathToSchemasMap(), new LinkedHashSet<>()); - PathToSchemasMap pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet); - return getNewInstance(castArg, validationMetadata.pathToItem(), pathToSchemasMap); + @Throws(ValidationException::class) + override fun validate(arg: List<*>, configuration: SchemaConfiguration?): FrozenList { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg: List<*> = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validationMetadata = + ValidationMetadata(pathToItem, usedConfiguration, PathToSchemasMap(), LinkedHashSet()) + val pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet) + return getNewInstance(castArg, validationMetadata.pathToItem, pathToSchemasMap) } - @Override - public ArrayWithItemsSchemaBoxedList validateAndBox(List arg, SchemaConfiguration configuration) throws ValidationException { - return new ArrayWithItemsSchemaBoxedList(validate(arg, configuration)); + @Throws(ValidationException::class) + override fun validateAndBox(arg: List<*>, configuration: SchemaConfiguration?): ArrayWithItemsSchemaBoxedList { + return ArrayWithItemsSchemaBoxedList(validate(arg, configuration)) } - @Override - public Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { - if (arg instanceof List) { - return getNewInstance((List) arg, pathToItem, pathToSchemas); + override fun getNewInstance(arg: Any?, pathToItem: List, pathToSchemas: PathToSchemasMap): Any? { + if (arg is List<*>) { + return getNewInstance(arg, pathToItem, pathToSchemas) } - throw new RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); + throw RuntimeException("Invalid input type=$javaClass. It can't be instantiated by this schema") } - @Override - public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { - if (arg instanceof List) { - return validate((List) arg, configuration); + @Throws(ValidationException::class) + override fun validate(arg: Any?, configuration: SchemaConfiguration?): Any? { + if (arg is List<*>) { + return validate(arg as List<*>?, configuration) } - throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw ValidationException("Invalid input type=$javaClass. It can't be validated by this schema") } - @Override - public ArrayWithItemsSchemaBoxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { - if (arg instanceof List listArg) { - return new ArrayWithItemsSchemaBoxedList(validate(listArg, configuration)); + @Throws(ValidationException::class) + override fun validateAndBox(arg: Any?, configuration: SchemaConfiguration?): ArrayWithItemsSchemaBoxed { + if (arg is List<*>) { + return ArrayWithItemsSchemaBoxedList(validate(arg, configuration)) } - throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw ValidationException("Invalid input type=$javaClass. It can't be validated by this schema") } } - public static class ArrayWithOutputClsSchemaList extends FrozenList { - protected ArrayWithOutputClsSchemaList(FrozenList m) { - super(m); - } - - public static ArrayWithOutputClsSchemaList of(List arg, SchemaConfiguration configuration) throws ValidationException { - return new ArrayWithOutputClsSchema().validate(arg, configuration); + class ArrayWithOutputClsSchemaList(m: FrozenList) : FrozenList(m) { + companion object { + @Throws(ValidationException::class) + fun of(arg: List, configuration: SchemaConfiguration?): ArrayWithOutputClsSchemaList { + return ArrayWithOutputClsSchema().validate(arg, configuration) + } } } - public sealed interface ArrayWithOutputClsSchemaBoxed permits ArrayWithOutputClsSchemaBoxedList { - } - public record ArrayWithOutputClsSchemaBoxedList(ArrayWithOutputClsSchemaList data) implements ArrayWithOutputClsSchemaBoxed { - } - public static class ArrayWithOutputClsSchema extends JsonSchema implements ListSchemaValidator { - public ArrayWithOutputClsSchema() { - super(new JsonSchemaInfo() - .type(Set.of(List.class)) - .items(StringJsonSchema.StringJsonSchema1.class) - ); - - } - - @Override - public ArrayWithOutputClsSchemaList getNewInstance(List arg, List pathToItem, PathToSchemasMap pathToSchemas) { - List items = new ArrayList<>(); - int i = 0; - for (Object item: arg) { - List itemPathToItem = new ArrayList<>(pathToItem); - itemPathToItem.add(i); - LinkedHashMap, Nothing?> schemas = pathToSchemas.get(itemPathToItem); - if (schemas == null) { - 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 RuntimeException("Instantiated type of item is invalid"); - } - items.add((String) castItem); - i += 1; + interface ArrayWithOutputClsSchemaBoxed + + data class ArrayWithOutputClsSchemaBoxedList(val data: ArrayWithOutputClsSchemaList) : + ArrayWithOutputClsSchemaBoxed + + class ArrayWithOutputClsSchema : JsonSchema( + JsonSchemaInfo() + .type(setOf(List::class.java)) + .items(StringJsonSchema.StringJsonSchema1::class.java) + ), ListSchemaValidator { + override fun getNewInstance( + arg: List<*>, + pathToItem: List, + pathToSchemas: PathToSchemasMap + ): ArrayWithOutputClsSchemaList { + val items: MutableList = ArrayList() + var i = 0 + for (item in arg) { + val itemPathToItem: MutableList = ArrayList(pathToItem) + itemPathToItem.add(i) + val schemas = pathToSchemas[itemPathToItem] + ?: throw RuntimeException("Validation result is invalid, schemas must exist for a pathToItem") + val itemSchema = schemas.entries.iterator().next().key + val castItem = itemSchema.getNewInstance(item, itemPathToItem, pathToSchemas) as? String + ?: throw RuntimeException("Instantiated type of item is invalid") + items.add(castItem) + i += 1 } - FrozenList newInstanceItems = new FrozenList<>(items); - return new ArrayWithOutputClsSchemaList(newInstanceItems); + val newInstanceItems = FrozenList(items) + return ArrayWithOutputClsSchemaList(newInstanceItems) } - 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); - SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().build())); - ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, new PathToSchemasMap(), new LinkedHashSet<>()); - PathToSchemasMap pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet); - return getNewInstance(castArg, validationMetadata.pathToItem(), pathToSchemasMap); + @Throws(ValidationException::class) + override fun validate(arg: List<*>, configuration: SchemaConfiguration?): ArrayWithOutputClsSchemaList { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg: List<*> = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validationMetadata = + ValidationMetadata(pathToItem, usedConfiguration, PathToSchemasMap(), LinkedHashSet()) + val pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet) + return getNewInstance(castArg, validationMetadata.pathToItem, pathToSchemasMap) } - @Override - public ArrayWithOutputClsSchemaBoxedList validateAndBox(List arg, SchemaConfiguration configuration) throws ValidationException { - return new ArrayWithOutputClsSchemaBoxedList(validate(arg, configuration)); + @Throws(ValidationException::class) + override fun validateAndBox( + arg: List<*>, + configuration: SchemaConfiguration? + ): ArrayWithOutputClsSchemaBoxedList { + return ArrayWithOutputClsSchemaBoxedList(validate(arg, configuration)) } - @Override - public Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { - if (arg instanceof List) { - return getNewInstance((List) arg, pathToItem, pathToSchemas); + override fun getNewInstance(arg: Any?, pathToItem: List, pathToSchemas: PathToSchemasMap): Any? { + if (arg is List<*>) { + return getNewInstance(arg, pathToItem, pathToSchemas) } - throw new RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); + throw RuntimeException("Invalid input type=$javaClass. It can't be instantiated by this schema") } - @Override - public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { - if (arg instanceof List) { - return validate((List) arg, configuration); + @Throws(ValidationException::class) + override fun validate(arg: Any?, configuration: SchemaConfiguration?): Any? { + if (arg is List<*>) { + return validate(arg as List<*>?, configuration) } - throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw ValidationException("Invalid input type=$javaClass. It can't be validated by this schema") } - @Override - public ArrayWithOutputClsSchemaBoxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { - if (arg instanceof List listArg) { - return new ArrayWithOutputClsSchemaBoxedList(validate(listArg, configuration)); + @Throws(ValidationException::class) + override fun validateAndBox(arg: Any?, configuration: SchemaConfiguration?): ArrayWithOutputClsSchemaBoxed { + if (arg is List<*>) { + return ArrayWithOutputClsSchemaBoxedList(validate(arg, configuration)) } - throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw ValidationException("Invalid input type=$javaClass. It can't be validated by this schema") } } @Test - public void testExceptionThrownForInvalidType() { - Assert.assertThrows(ValidationException.class, () -> JsonSchema.validate( - new ArrayWithItemsSchema(), - null, - validationMetadata - )); + fun testExceptionThrownForInvalidType() { + assertFailsWith( + block = { + JsonSchema.validate( + ArrayWithItemsSchema(), + null, + validationMetadata + ) + } + ) } @Test - public void testValidateArrayWithItemsSchema() throws ValidationException { + @Throws(ValidationException::class) + fun testValidateArrayWithItemsSchema() { // list with only item works - List inList = new ArrayList<>(); - inList.add("abc"); - FrozenList validatedValue = new ArrayWithItemsSchema().validate(inList, configuration); - List outList = new ArrayList<>(); - outList.add("abc"); - Assert.assertEquals(validatedValue, outList); + var inList: List = listOf("abc") + var validatedValue: FrozenList = ArrayWithItemsSchema().validate(inList, configuration) + var outList: List = listOf("abc") + assertEquals(validatedValue, outList) // list with no items works - inList = new ArrayList<>(); - validatedValue = new ArrayWithItemsSchema().validate(inList, configuration); - outList = new ArrayList<>(); - Assert.assertEquals(validatedValue, outList); + inList = listOf() + validatedValue = ArrayWithItemsSchema().validate(inList, configuration) + outList = listOf() + assertEquals(validatedValue, outList) // invalid item type fails - List intList = List.of(1); - Assert.assertThrows(ValidationException.class, () -> JsonSchema.validate( - new ArrayWithItemsSchema(), - intList, - validationMetadata - )); + val intList = listOf(1) + assertFailsWith( + block = { + JsonSchema.validate( + ArrayWithItemsSchema(), + intList, + validationMetadata + ) + } + ) } @Test - public void testValidateArrayWithOutputClsSchema() throws ValidationException { + @Throws(ValidationException::class) + fun testValidateArrayWithOutputClsSchema() { // list with only item works - List inList = new ArrayList<>(); - inList.add("abc"); - ArrayWithOutputClsSchemaList validatedValue = new ArrayWithOutputClsSchema().validate(inList, configuration); - List outList = new ArrayList<>(); - outList.add("abc"); - Assert.assertEquals(validatedValue, outList); + var inList: List = listOf("abc") + var validatedValue = ArrayWithOutputClsSchema().validate(inList, configuration) + var outList: List = listOf("abc") + assertEquals(validatedValue, outList) // list with no items works - inList = new ArrayList<>(); - validatedValue = new ArrayWithOutputClsSchema().validate(inList, configuration); - outList = new ArrayList<>(); - Assert.assertEquals(validatedValue, outList); + inList = listOf() + validatedValue = ArrayWithOutputClsSchema().validate(inList, configuration) + outList = listOf() + assertEquals(validatedValue, outList) // invalid item type fails - List intList = List.of(1); - Assert.assertThrows(ValidationException.class, () -> JsonSchema.validate( - new ArrayWithOutputClsSchema(), - intList, - validationMetadata - )); + val intList = listOf(1) + assertFailsWith( + block = { + JsonSchema.validate( + ArrayWithOutputClsSchema(), + intList, + validationMetadata + ) + } + ) + } + + companion object { + val configuration = SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validationMetadata = ValidationMetadata( + listOf("args[0"), + configuration, + PathToSchemasMap(), + LinkedHashSet() + ) } } \ No newline at end of file diff --git a/src/main/resources/kotlin/src/test/kotlin/packagename/schemas/BooleanSchemaTest.hbs b/src/main/resources/kotlin/src/test/kotlin/packagename/schemas/BooleanSchemaTest.hbs index a7a42e569fe..71cb0d28cac 100644 --- a/src/main/resources/kotlin/src/test/kotlin/packagename/schemas/BooleanSchemaTest.hbs +++ b/src/main/resources/kotlin/src/test/kotlin/packagename/schemas/BooleanSchemaTest.hbs @@ -1,45 +1,53 @@ -package {{{packageName}}}.schemas; +package {{{packageName}}}.schemas -import org.junit.Assert; -import org.junit.Test; -import {{{packageName}}}.configurations.JsonSchemaKeywordFlags; -import {{{packageName}}}.configurations.SchemaConfiguration; -import {{{packageName}}}.exceptions.ValidationException; -import {{{packageName}}}.schemas.validation.JsonSchema; -import {{{packageName}}}.schemas.validation.PathToSchemasMap; -import {{{packageName}}}.schemas.validation.ValidationMetadata; +import {{{packageName}}}.configurations.JsonSchemaKeywordFlags +import {{{packageName}}}.configurations.SchemaConfiguration +import {{{packageName}}}.exceptions.ValidationException +import {{{packageName}}}.schemas.validation.JsonSchema +import {{{packageName}}}.schemas.validation.PathToSchemasMap +import {{{packageName}}}.schemas.validation.ValidationMetadata -import java.util.LinkedHashSet; -import java.util.List; +import kotlin.test.Test +import kotlin.test.assertFailsWith +import kotlin.test.assertFalse +import kotlin.test.assertTrue -public class BooleanSchemaTest { - static final SchemaConfiguration configuration = new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().build()); - static final BooleanJsonSchema.BooleanJsonSchema1 booleanJsonSchema = BooleanJsonSchema.BooleanJsonSchema1.getInstance(); - static final ValidationMetadata validationMetadata = new ValidationMetadata( - List.of("args[0"), - configuration, - new PathToSchemasMap(), - new LinkedHashSet<>() - ); - +class BooleanSchemaTest { @Test - public void testValidateTrue() throws ValidationException { - boolean validatedValue = booleanJsonSchema.validate(true, configuration); - Assert.assertTrue(validatedValue); + @Throws(ValidationException::class) + fun testValidateTrue() { + val validatedValue = booleanJsonSchema.validate(true, configuration) + assertTrue(validatedValue) } @Test - public void testValidateFalse() throws ValidationException { - boolean validatedValue = booleanJsonSchema.validate(false, configuration); - Assert.assertFalse(validatedValue); + @Throws(ValidationException::class) + fun testValidateFalse() { + val validatedValue = booleanJsonSchema.validate(false, configuration) + assertFalse(validatedValue) } @Test - public void testExceptionThrownForInvalidType() { - Assert.assertThrows(ValidationException.class, () -> JsonSchema.validate( - booleanJsonSchema, - null, - validationMetadata - )); + fun testExceptionThrownForInvalidType() { + assertFailsWith( + block = { + JsonSchema.validate( + booleanJsonSchema, + null, + validationMetadata + ) + } + ) + } + + companion object { + val configuration = SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val booleanJsonSchema = BooleanJsonSchema.BooleanJsonSchema1.getInstance() + val validationMetadata = ValidationMetadata( + listOf("args[0"), + configuration, + PathToSchemasMap(), + LinkedHashSet() + ) } -} +} \ No newline at end of file diff --git a/src/main/resources/kotlin/src/test/kotlin/packagename/schemas/ListBuilderTest.hbs b/src/main/resources/kotlin/src/test/kotlin/packagename/schemas/ListBuilderTest.hbs index 3a5fd37c65c..dd1c86bd7f1 100644 --- a/src/main/resources/kotlin/src/test/kotlin/packagename/schemas/ListBuilderTest.hbs +++ b/src/main/resources/kotlin/src/test/kotlin/packagename/schemas/ListBuilderTest.hbs @@ -1,61 +1,55 @@ -package {{{packageName}}}.schemas; +package {{{packageName}}}.schemas -import org.checkerframework.checker.nullness.qual.Nullable; -import org.junit.Assert; -import org.junit.Test; +import kotlin.test.Test +import kotlin.test.assertEquals -import java.util.ArrayList; -import java.util.List; - -public class ListBuilderTest { - public static class NullableListWithNullableItemsListBuilder { +class ListBuilderTest { + class NullableListWithNullableItemsListBuilder { // class to build List<@Nullable List> - private final List<@Nullable List> list; + private val list: MutableList?> - public NullableListWithNullableItemsListBuilder() { - list = new ArrayList<>(); + constructor() { + list = ArrayList() } - public NullableListWithNullableItemsListBuilder(List<@Nullable List> list) { - this.list = list; + constructor(list: MutableList?>) { + this.list = list } - public NullableListWithNullableItemsListBuilder add(Nothing? item) { - list.add(null); - return this; + fun add(item: Nothing?): NullableListWithNullableItemsListBuilder { + list.add(item) + return this } - public NullableListWithNullableItemsListBuilder add(List item) { - list.add(item); - return this; + fun add(item: List): NullableListWithNullableItemsListBuilder { + list.add(item) + return this } - public List<@Nullable List> build() { - return list; + fun build(): List?> { + return list } } @Test - public void testSucceedsWithNullInput() { - List<@Nullable List> inList = new ArrayList<>(); - inList.add(null); - var builder = new NullableListWithNullableItemsListBuilder(inList); - Assert.assertEquals(inList, builder.build()); - - builder = new NullableListWithNullableItemsListBuilder(); - builder.add((Nothing?) null); - Assert.assertEquals(inList, builder.build()); + fun testSucceedsWithNullInput() { + val inList: MutableList?> = ArrayList() + inList.add(null) + var builder = NullableListWithNullableItemsListBuilder(inList) + assertEquals(inList, builder.build()) + builder = NullableListWithNullableItemsListBuilder() + builder.add(null) + assertEquals(inList, builder.build()) } @Test - public void testSucceedsWithNonNullInput() { - List<@Nullable List> inList = new ArrayList<>(); - inList.add(List.of(1)); - var builder = new NullableListWithNullableItemsListBuilder(inList); - Assert.assertEquals(inList, builder.build()); - - builder = new NullableListWithNullableItemsListBuilder(); - builder.add(List.of(1)); - Assert.assertEquals(inList, builder.build()); + fun testSucceedsWithNonNullInput() { + val inList: MutableList?> = ArrayList() + inList.add(listOf(1)) + var builder = NullableListWithNullableItemsListBuilder(inList) + assertEquals(inList, builder.build()) + builder = NullableListWithNullableItemsListBuilder() + builder.add(listOf(1)) + assertEquals(inList, builder.build()) } } \ No newline at end of file diff --git a/src/main/resources/kotlin/src/test/kotlin/packagename/schemas/ListSchemaTest.hbs b/src/main/resources/kotlin/src/test/kotlin/packagename/schemas/ListSchemaTest.hbs index 9d6d6c04740..b72f7ca5f9f 100644 --- a/src/main/resources/kotlin/src/test/kotlin/packagename/schemas/ListSchemaTest.hbs +++ b/src/main/resources/kotlin/src/test/kotlin/packagename/schemas/ListSchemaTest.hbs @@ -1,46 +1,49 @@ -package {{{packageName}}}.schemas; +package {{{packageName}}}.schemas -import org.checkerframework.checker.nullness.qual.Nullable; -import org.junit.Assert; -import org.junit.Test; -import {{{packageName}}}.configurations.JsonSchemaKeywordFlags; -import {{{packageName}}}.configurations.SchemaConfiguration; -import {{{packageName}}}.exceptions.ValidationException; -import {{{packageName}}}.schemas.validation.JsonSchema; -import {{{packageName}}}.schemas.validation.FrozenList; -import {{{packageName}}}.schemas.validation.PathToSchemasMap; -import {{{packageName}}}.schemas.validation.ValidationMetadata; +import {{{packageName}}}.configurations.JsonSchemaKeywordFlags +import {{{packageName}}}.configurations.SchemaConfiguration +import {{{packageName}}}.exceptions.ValidationException +import {{{packageName}}}.schemas.validation.JsonSchema +import {{{packageName}}}.schemas.validation.FrozenList +import {{{packageName}}}.schemas.validation.PathToSchemasMap +import {{{packageName}}}.schemas.validation.ValidationMetadata -import java.util.ArrayList; -import java.util.LinkedHashSet; -import java.util.List; +import kotlin.test.Test +import kotlin.test.assertEquals +import kotlin.test.assertFailsWith -public class ListSchemaTest { - static final SchemaConfiguration configuration = new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().build()); - static final ListJsonSchema.ListJsonSchema1 listJsonSchema = ListJsonSchema.ListJsonSchema1.getInstance(); - static final ValidationMetadata validationMetadata = new ValidationMetadata( - List.of("args[0"), - configuration, - new PathToSchemasMap(), - new LinkedHashSet<>() - ); - +class ListSchemaTest { @Test - public void testExceptionThrownForInvalidType() { - Assert.assertThrows(ValidationException.class, () -> JsonSchema.validate( - listJsonSchema, - null, - validationMetadata - )); + fun testExceptionThrownForInvalidType() { + assertFailsWith( + block = { + JsonSchema.validate( + listJsonSchema, + null, + validationMetadata + ) + } + ) } @Test - public void testValidateList() throws ValidationException { - List inList = new ArrayList<>(); - inList.add("today"); - FrozenList<@Nullable Object> validatedValue = listJsonSchema.validate(inList, configuration); - ArrayList outList = new ArrayList<>(); - outList.add("today"); - Assert.assertEquals(validatedValue, outList); + @Throws(ValidationException::class) + fun testValidateList() { + val inList: MutableList = ArrayList() + inList.add("today") + val validatedValue = listJsonSchema.validate(inList, configuration) + val outList: List = listOf("today") + assertEquals(validatedValue, outList) + } + + companion object { + val configuration = SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val listJsonSchema = ListJsonSchema.ListJsonSchema1.getInstance() + val validationMetadata = ValidationMetadata( + listOf("args[0"), + configuration, + PathToSchemasMap(), + LinkedHashSet() + ) } -} +} \ No newline at end of file diff --git a/src/main/resources/kotlin/src/test/kotlin/packagename/schemas/MapSchemaTest.hbs b/src/main/resources/kotlin/src/test/kotlin/packagename/schemas/MapSchemaTest.hbs index f904e88b564..440e4414def 100644 --- a/src/main/resources/kotlin/src/test/kotlin/packagename/schemas/MapSchemaTest.hbs +++ b/src/main/resources/kotlin/src/test/kotlin/packagename/schemas/MapSchemaTest.hbs @@ -1,48 +1,50 @@ -package {{{packageName}}}.schemas; +package {{{packageName}}}.schemas -import org.checkerframework.checker.nullness.qual.Nullable; -import org.junit.Assert; -import org.junit.Test; -import {{{packageName}}}.configurations.JsonSchemaKeywordFlags; -import {{{packageName}}}.configurations.SchemaConfiguration; -import {{{packageName}}}.exceptions.ValidationException; -import {{{packageName}}}.schemas.validation.JsonSchema; -import {{{packageName}}}.schemas.validation.FrozenMap; -import {{{packageName}}}.schemas.validation.PathToSchemasMap; -import {{{packageName}}}.schemas.validation.ValidationMetadata; +import {{{packageName}}}.configurations.JsonSchemaKeywordFlags +import {{{packageName}}}.configurations.SchemaConfiguration +import {{{packageName}}}.exceptions.ValidationException +import {{{packageName}}}.schemas.validation.JsonSchema +import {{{packageName}}}.schemas.validation.FrozenMap +import {{{packageName}}}.schemas.validation.PathToSchemasMap +import {{{packageName}}}.schemas.validation.ValidationMetadata -import java.time.LocalDate; -import java.util.LinkedHashMap; -import java.util.LinkedHashSet; -import java.util.List; -import java.util.Map; +import java.time.LocalDate +import kotlin.test.Test +import kotlin.test.assertEquals +import kotlin.test.assertFailsWith -public class MapSchemaTest { - static final SchemaConfiguration configuration = new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().build()); - static final MapJsonSchema.MapJsonSchema1 mapJsonSchema = MapJsonSchema.MapJsonSchema1.getInstance(); - static final ValidationMetadata validationMetadata = new ValidationMetadata( - List.of("args[0"), - configuration, - new PathToSchemasMap(), - new LinkedHashSet<>() - ); - +class MapSchemaTest { @Test - public void testExceptionThrownForInvalidType() { - Assert.assertThrows(ValidationException.class, () -> JsonSchema.validate( - mapJsonSchema, - null, - validationMetadata - )); + fun testExceptionThrownForInvalidType() { + assertFailsWith( + block = { + JsonSchema.validate( + mapJsonSchema, + null, + validationMetadata + ) + } + ) } @Test - 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); - LinkedHashMap outMap = new LinkedHashMap<>(); - outMap.put("today", "2017-07-21"); - Assert.assertEquals(validatedValue, outMap); + @Throws(ValidationException::class) + fun testValidateMap() { + val inMap: MutableMap = LinkedHashMap() + inMap["today"] = LocalDate.of(2017, 7, 21) + val validatedValue = mapJsonSchema.validate(inMap, configuration) + val outMap: Map = mapOf("today" to "2017-07-21") + assertEquals(validatedValue, outMap) + } + + companion object { + val configuration = SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val mapJsonSchema = MapJsonSchema.MapJsonSchema1.getInstance() + val validationMetadata = ValidationMetadata( + listOf("args[0"), + configuration, + PathToSchemasMap(), + LinkedHashSet() + ) } -} +} \ No newline at end of file diff --git a/src/main/resources/kotlin/src/test/kotlin/packagename/schemas/NullSchemaTest.hbs b/src/main/resources/kotlin/src/test/kotlin/packagename/schemas/NullSchemaTest.hbs index 074a74cafd7..2c950ef0776 100644 --- a/src/main/resources/kotlin/src/test/kotlin/packagename/schemas/NullSchemaTest.hbs +++ b/src/main/resources/kotlin/src/test/kotlin/packagename/schemas/NullSchemaTest.hbs @@ -1,41 +1,46 @@ -package {{{packageName}}}.schemas; +package {{{packageName}}}.schemas -import org.junit.Assert; -import org.junit.Test; -import {{{packageName}}}.configurations.JsonSchemaKeywordFlags; -import {{{packageName}}}.configurations.SchemaConfiguration; -import {{{packageName}}}.exceptions.ValidationException; -import {{{packageName}}}.schemas.validation.JsonSchema; -import {{{packageName}}}.schemas.validation.PathToSchemasMap; -import {{{packageName}}}.schemas.validation.ValidationMetadata; - -import java.util.LinkedHashSet; -import java.util.List; - -public class NullSchemaTest { - static final SchemaConfiguration configuration = new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().build()); - static final NullJsonSchema.NullJsonSchema1 nullJsonSchema = NullJsonSchema.NullJsonSchema1.getInstance(); - static final ValidationMetadata validationMetadata = new ValidationMetadata( - List.of("args[0"), - configuration, - new PathToSchemasMap(), - new LinkedHashSet<>() - ); +import {{{packageName}}}.configurations.JsonSchemaKeywordFlags +import {{{packageName}}}.configurations.SchemaConfiguration +import {{{packageName}}}.exceptions.ValidationException +import {{{packageName}}}.schemas.validation.JsonSchema +import {{{packageName}}}.schemas.validation.PathToSchemasMap +import {{{packageName}}}.schemas.validation.ValidationMetadata +import kotlin.Throws +import kotlin.test.Test +import kotlin.test.assertFailsWith +import kotlin.test.assertNull +class NullSchemaTest { @Test - @SuppressWarnings("nullness") - public void testValidateNull() throws ValidationException { - Nothing? validatedValue = nullJsonSchema.validate(null, configuration); - Assert.assertNull(validatedValue); + @Throws(ValidationException::class) + fun testValidateNull() { + val validatedValue: Nothing? = nullJsonSchema.validate(null, configuration) + assertNull(validatedValue) } @Test - public void testExceptionThrownForInvalidType() { - Assert.assertThrows(ValidationException.class, () -> JsonSchema.validate( - nullJsonSchema, - Boolean.TRUE, - validationMetadata - )); + fun testExceptionThrownForInvalidType() { + assertFailsWith( + block = { + JsonSchema.validate( + nullJsonSchema, + true, + validationMetadata + ) + } + ) + } + + companion object { + val configuration = SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val nullJsonSchema = NullJsonSchema.NullJsonSchema1.getInstance() + val validationMetadata = ValidationMetadata( + listOf("args[0"), + configuration, + PathToSchemasMap(), + LinkedHashSet() + ) } -} +} \ No newline at end of file diff --git a/src/main/resources/kotlin/src/test/kotlin/packagename/schemas/NumberSchemaTest.hbs b/src/main/resources/kotlin/src/test/kotlin/packagename/schemas/NumberSchemaTest.hbs index 9c3b46cd028..19d2a63c15d 100644 --- a/src/main/resources/kotlin/src/test/kotlin/packagename/schemas/NumberSchemaTest.hbs +++ b/src/main/resources/kotlin/src/test/kotlin/packagename/schemas/NumberSchemaTest.hbs @@ -1,57 +1,66 @@ -package {{{packageName}}}.schemas; - -import org.junit.Assert; -import org.junit.Test; -import {{{packageName}}}.configurations.JsonSchemaKeywordFlags; -import {{{packageName}}}.configurations.SchemaConfiguration; -import {{{packageName}}}.exceptions.ValidationException; -import {{{packageName}}}.schemas.validation.JsonSchema; -import {{{packageName}}}.schemas.validation.PathToSchemasMap; -import {{{packageName}}}.schemas.validation.ValidationMetadata; - -import java.util.LinkedHashSet; -import java.util.List; - -public class NumberSchemaTest { - static final SchemaConfiguration configuration = new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().build()); - static final NumberJsonSchema.NumberJsonSchema1 numberJsonSchema = NumberJsonSchema.NumberJsonSchema1.getInstance(); - static final ValidationMetadata validationMetadata = new ValidationMetadata( - List.of("args[0"), - configuration, - new PathToSchemasMap(), - new LinkedHashSet<>() - ); +package {{{packageName}}}.schemas + +import {{{packageName}}}.configurations.JsonSchemaKeywordFlags +import {{{packageName}}}.configurations.SchemaConfiguration +import {{{packageName}}}.exceptions.ValidationException +import {{{packageName}}}.schemas.validation.JsonSchema +import {{{packageName}}}.schemas.validation.PathToSchemasMap +import {{{packageName}}}.schemas.validation.ValidationMetadata + +import kotlin.test.Test +import kotlin.test.assertEquals +import kotlin.test.assertFailsWith +class NumberSchemaTest { @Test - public void testValidateInteger() throws ValidationException { - int validatedValue = numberJsonSchema.validate(1, configuration); - Assert.assertEquals(validatedValue, 1); + @Throws(ValidationException::class) + fun testValidateInteger() { + val validatedValue = numberJsonSchema.validate(1, configuration) + assertEquals(validatedValue.toLong(), 1) } @Test - public void testValidateLong() throws ValidationException { - long validatedValue = numberJsonSchema.validate(1L, configuration); - Assert.assertEquals(validatedValue, 1L); + @Throws(ValidationException::class) + fun testValidateLong() { + val validatedValue = numberJsonSchema.validate(1L, configuration) + assertEquals(validatedValue, 1L) } @Test - public void testValidateFloat() throws ValidationException { - float validatedValue = numberJsonSchema.validate(3.14f, configuration); - Assert.assertEquals(Float.compare(validatedValue, 3.14f), 0); + @Throws(ValidationException::class) + fun testValidateFloat() { + val validatedValue = numberJsonSchema.validate(3.14f, configuration) + assertEquals(validatedValue.compareTo(3.14f).toLong(), 0) } @Test - public void testValidateDouble() throws ValidationException { - double validatedValue = numberJsonSchema.validate(3.14d, configuration); - Assert.assertEquals(Double.compare(validatedValue, 3.14d), 0); + @Throws(ValidationException::class) + fun testValidateDouble() { + val validatedValue = numberJsonSchema.validate(3.14, configuration) + assertEquals(validatedValue.compareTo(3.14).toLong(), 0) } @Test - public void testExceptionThrownForInvalidType() { - Assert.assertThrows(ValidationException.class, () -> JsonSchema.validate( - numberJsonSchema, - null, - validationMetadata - )); + fun testExceptionThrownForInvalidType() { + assertFailsWith( + block = { + JsonSchema.validate( + numberJsonSchema, + null, + validationMetadata + ) + } + ) + } + + companion object { + val configuration = SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val numberJsonSchema = NumberJsonSchema.NumberJsonSchema1.getInstance() + val validationMetadata = ValidationMetadata( + listOf("args[0"), + configuration, + PathToSchemasMap(), + LinkedHashSet() + ) } -} +} \ No newline at end of file diff --git a/src/main/resources/kotlin/src/test/kotlin/packagename/schemas/ObjectTypeSchemaTest.hbs b/src/main/resources/kotlin/src/test/kotlin/packagename/schemas/ObjectTypeSchemaTest.hbs index 4648409144d..5cf30dc12cd 100644 --- a/src/main/resources/kotlin/src/test/kotlin/packagename/schemas/ObjectTypeSchemaTest.hbs +++ b/src/main/resources/kotlin/src/test/kotlin/packagename/schemas/ObjectTypeSchemaTest.hbs @@ -1,538 +1,569 @@ -package {{{packageName}}}.schemas; - -import org.checkerframework.checker.nullness.qual.Nullable; -import org.junit.Assert; -import org.junit.Test; -import {{{packageName}}}.configurations.JsonSchemaKeywordFlags; -import {{{packageName}}}.configurations.SchemaConfiguration; -import {{{packageName}}}.exceptions.ValidationException; -import {{{packageName}}}.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}}}.schemas.validation.ValidationMetadata; - -import java.util.ArrayList; -import java.util.HashSet; -import java.util.LinkedHashMap; -import java.util.LinkedHashSet; -import java.util.List; -import java.util.Map; -import java.util.Objects; -import java.util.Set; - -public class ObjectTypeSchemaTest { - static final SchemaConfiguration configuration = new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().build()); - static final ValidationMetadata validationMetadata = new ValidationMetadata( - List.of("args[0"), - configuration, - new PathToSchemasMap(), - new LinkedHashSet<>() - ); - - public sealed interface ObjectWithPropsSchemaBoxed permits ObjectWithPropsSchemaBoxedMap { - } - public record ObjectWithPropsSchemaBoxedMap(FrozenMap<@Nullable Object> data) implements ObjectWithPropsSchemaBoxed { - } - public static class ObjectWithPropsSchema extends JsonSchema implements MapSchemaValidator, ObjectWithPropsSchemaBoxedMap> { - private static @Nullable ObjectWithPropsSchema instance = null; - private ObjectWithPropsSchema() { - super(new JsonSchemaInfo() - .type(Set.of(Map.class)) - .properties(Map.ofEntries( - new PropertyEntry("someString", StringJsonSchema.StringJsonSchema1.class) - )) - ); - - } - - public static ObjectWithPropsSchema getInstance() { - if (instance == null) { - instance = new ObjectWithPropsSchema(); - } - return instance; - } - - @Override - 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 RuntimeException("Invalid non-string key value"); +package {{{packageName}}}.schemas + +import {{{packageName}}}.configurations.JsonSchemaKeywordFlags +import {{{packageName}}}.configurations.SchemaConfiguration +import {{{packageName}}}.exceptions.ValidationException +import {{{packageName}}}.schemas.validation.JsonSchema +import {{{packageName}}}.schemas.validation.JsonSchemaInfo +import {{{packageName}}}.schemas.validation.FrozenMap +import {{{packageName}}}.schemas.validation.PathToSchemasMap +import {{{packageName}}}.schemas.validation.MapSchemaValidator +import {{{packageName}}}.schemas.validation.ValidationMetadata + +import kotlin.test.Test +import kotlin.test.assertEquals +import kotlin.test.assertFailsWith + +class ObjectTypeSchemaTest { + interface ObjectWithPropsSchemaBoxed + + data class ObjectWithPropsSchemaBoxedMap(val data: FrozenMap) : ObjectWithPropsSchemaBoxed + class ObjectWithPropsSchema private constructor() : JsonSchema( + JsonSchemaInfo() + .type(setOf(Map::class.java)) + .properties( + mapOf( + "someString" to StringJsonSchema.StringJsonSchema1::class.java + ) + ) + ), MapSchemaValidator, ObjectWithPropsSchemaBoxedMap> { + override fun getNewInstance( + arg: Map<*, *>, + pathToItem: List, + pathToSchemas: PathToSchemasMap + ): FrozenMap { + val properties = LinkedHashMap() + for ((entryKey, value1) in arg) { + if (entryKey !is String) { + throw RuntimeException("Invalid non-string key value") } - String propertyName = (String) entryKey; - List propertyPathToItem = new ArrayList<>(pathToItem); - propertyPathToItem.add(propertyName); - Object value = entry.getValue(); - LinkedHashMap, Nothing?> schemas = pathToSchemas.get(propertyPathToItem); - if (schemas == null) { - 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); - properties.put(propertyName, castValue); + val propertyPathToItem: MutableList = ArrayList(pathToItem) + propertyPathToItem.add(entryKey) + val value = value1!! + val schemas = pathToSchemas[propertyPathToItem] + ?: throw RuntimeException("Validation result is invalid, schemas must exist for a pathToItem") + val propertySchema = schemas.entries.iterator().next().key + val castValue = propertySchema.getNewInstance(value, propertyPathToItem, pathToSchemas) + properties[entryKey] = castValue } - return new FrozenMap<>(properties); + return FrozenMap(properties) } - public FrozenMap<@Nullable Object> validate(Map arg, SchemaConfiguration configuration) throws ValidationException { - Set> pathSet = new HashSet<>(); - List pathToItem = List.of("args[0"); - Map castArg = castToAllowedTypes(arg, pathToItem, pathSet); - SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().build())); - ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, new PathToSchemasMap(), new LinkedHashSet<>()); - PathToSchemasMap pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet); - return getNewInstance(castArg, validationMetadata.pathToItem(), pathToSchemasMap); + @Throws(ValidationException::class) + override fun validate(arg: Map<*, *>, configuration: SchemaConfiguration?): FrozenMap { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg: Map<*, *> = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validationMetadata = + ValidationMetadata(pathToItem, usedConfiguration, PathToSchemasMap(), LinkedHashSet()) + val pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet) + return getNewInstance(castArg, validationMetadata.pathToItem, pathToSchemasMap) } - @Override - public ObjectWithPropsSchemaBoxedMap validateAndBox(Map arg, SchemaConfiguration configuration) throws ValidationException { - return new ObjectWithPropsSchemaBoxedMap(validate(arg, configuration)); + @Throws(ValidationException::class) + override fun validateAndBox( + arg: Map<*, *>, + configuration: SchemaConfiguration? + ): ObjectWithPropsSchemaBoxedMap { + return ObjectWithPropsSchemaBoxedMap(validate(arg, configuration)) } - @Override - public Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { - if (arg instanceof Map) { - return getNewInstance((Map) arg, pathToItem, pathToSchemas); + override fun getNewInstance(arg: Any?, pathToItem: List, pathToSchemas: PathToSchemasMap): Any? { + if (arg is Map<*, *>) { + return getNewInstance(arg, pathToItem, pathToSchemas) } - throw new RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); + throw RuntimeException("Invalid input type=$javaClass. It can't be instantiated by this schema") } - @Override - public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { - if (arg instanceof Map) { - return validate((Map) arg, configuration); + @Throws(ValidationException::class) + override fun validate(arg: Any?, configuration: SchemaConfiguration?): Any? { + if (arg is Map<*, *>) { + return validate(arg, configuration) } - throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw ValidationException("Invalid input type=$javaClass. It can't be validated by this schema") } - @Override - public ObjectWithPropsSchemaBoxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { - if (arg instanceof Map mapArg) { - return new ObjectWithPropsSchemaBoxedMap(validate(mapArg, configuration)); + @Throws(ValidationException::class) + override fun validateAndBox(arg: Any?, configuration: SchemaConfiguration?): ObjectWithPropsSchemaBoxed { + if (arg is Map<*, *>) { + return ObjectWithPropsSchemaBoxedMap( + validate(arg, configuration) + ) } - throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw ValidationException("Invalid input type=$javaClass. It can't be validated by this schema") } - } - public sealed interface ObjectWithAddpropsSchemaBoxed permits ObjectWithAddpropsSchemaBoxedMap { - } - public record ObjectWithAddpropsSchemaBoxedMap(FrozenMap data) implements ObjectWithAddpropsSchemaBoxed { - } + companion object { + @Volatile + private var instance: ObjectWithPropsSchema? = null - public static class ObjectWithAddpropsSchema extends JsonSchema implements MapSchemaValidator, ObjectWithAddpropsSchemaBoxedMap> { - private static @Nullable ObjectWithAddpropsSchema instance = null; - private ObjectWithAddpropsSchema() { - super(new JsonSchemaInfo() - .type(Set.of(Map.class)) - .additionalProperties(StringJsonSchema.StringJsonSchema1.class) - ); - } - - public static ObjectWithAddpropsSchema getInstance() { - if (instance == null) { - instance = new ObjectWithAddpropsSchema(); - } - return instance; + fun getInstance() = + instance ?: synchronized(this) { + instance ?: ObjectWithPropsSchema().also { instance = it } + } } + } - @Override - public FrozenMap 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 RuntimeException("Invalid non-string key value"); + interface ObjectWithAddpropsSchemaBoxed + + data class ObjectWithAddpropsSchemaBoxedMap(val data: FrozenMap) : ObjectWithAddpropsSchemaBoxed {} + + class ObjectWithAddpropsSchema private constructor() : JsonSchema( + JsonSchemaInfo() + .type(setOf(Map::class.java)) + .additionalProperties(StringJsonSchema.StringJsonSchema1::class.java) + ), MapSchemaValidator, ObjectWithAddpropsSchemaBoxedMap> { + override fun getNewInstance( + arg: Map<*, *>, + pathToItem: List, + pathToSchemas: PathToSchemasMap + ): FrozenMap { + val properties = LinkedHashMap() + for ((entryKey, value1) in arg) { + if (entryKey !is String) { + throw RuntimeException("Invalid non-string key value") } - String propertyName = (String) entryKey; - List propertyPathToItem = new ArrayList<>(pathToItem); - propertyPathToItem.add(propertyName); - Object value = entry.getValue(); - LinkedHashMap, Nothing?> schemas = pathToSchemas.get(propertyPathToItem); - if (schemas == null) { - 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 RuntimeException("Invalid type for property value"); - } - properties.put(propertyName, (String) castValue); + val propertyPathToItem: MutableList = ArrayList(pathToItem) + propertyPathToItem.add(entryKey) + val value = value1!! + val schemas = pathToSchemas[propertyPathToItem] + ?: throw RuntimeException("Validation result is invalid, schemas must exist for a pathToItem") + val propertySchema = schemas.entries.iterator().next().key + val castValue = propertySchema.getNewInstance(value, propertyPathToItem, pathToSchemas) as? String + ?: throw RuntimeException("Invalid type for property value") + properties[entryKey] = castValue } - return new FrozenMap<>(properties); + return FrozenMap(properties) } - 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); - SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().build())); - ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, new PathToSchemasMap(), new LinkedHashSet<>()); - PathToSchemasMap pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet); - return getNewInstance(castArg, validationMetadata.pathToItem(), pathToSchemasMap); + @Throws(ValidationException::class) + override fun validate(arg: Map<*, *>, configuration: SchemaConfiguration?): FrozenMap { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg: Map<*, *> = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validationMetadata = + ValidationMetadata(pathToItem, usedConfiguration, PathToSchemasMap(), LinkedHashSet()) + val pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet) + return getNewInstance(castArg, validationMetadata.pathToItem, pathToSchemasMap) } - @Override - public ObjectWithAddpropsSchemaBoxedMap validateAndBox(Map arg, SchemaConfiguration configuration) throws ValidationException { - return new ObjectWithAddpropsSchemaBoxedMap(validate(arg, configuration)); + @Throws(ValidationException::class) + override fun validateAndBox( + arg: Map<*, *>, + configuration: SchemaConfiguration? + ): ObjectWithAddpropsSchemaBoxedMap { + return ObjectWithAddpropsSchemaBoxedMap(validate(arg, configuration)) } - @Override - public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { - if (arg instanceof Map) { - return validate((Map) arg, configuration); + @Throws(ValidationException::class) + override fun validate(arg: Any?, configuration: SchemaConfiguration?): Any? { + if (arg is Map<*, *>) { + return validate(arg, configuration) } - throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw ValidationException("Invalid input type=$javaClass. It can't be validated by this schema") } - @Override - public ObjectWithAddpropsSchemaBoxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { - if (arg instanceof Map mapArg) { - return new ObjectWithAddpropsSchemaBoxedMap(validate(mapArg, configuration)); + @Throws(ValidationException::class) + override fun validateAndBox(arg: Any?, configuration: SchemaConfiguration?): ObjectWithAddpropsSchemaBoxed { + if (arg is Map<*, *>) { + return ObjectWithAddpropsSchemaBoxedMap(validate(arg, configuration)) } - throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw ValidationException("Invalid input type=$javaClass. It can't be validated by this schema") } - @Override - public Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { - if (arg instanceof Map) { - return getNewInstance((Map) arg, pathToItem, pathToSchemas); + override fun getNewInstance(arg: Any?, pathToItem: List, pathToSchemas: PathToSchemasMap): Any? { + if (arg is Map<*, *>) { + return getNewInstance(arg, pathToItem, pathToSchemas) } - throw new RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); + throw RuntimeException("Invalid input type=$javaClass. It can't be instantiated by this schema") } - } - public sealed interface ObjectWithPropsAndAddpropsSchemaBoxed permits ObjectWithPropsAndAddpropsSchemaBoxedMap { - } - public record ObjectWithPropsAndAddpropsSchemaBoxedMap(FrozenMap<@Nullable Object> data) implements ObjectWithPropsAndAddpropsSchemaBoxed { - } - public static class ObjectWithPropsAndAddpropsSchema extends JsonSchema implements MapSchemaValidator, ObjectWithPropsAndAddpropsSchemaBoxedMap> { - private static @Nullable ObjectWithPropsAndAddpropsSchema instance = null; - private ObjectWithPropsAndAddpropsSchema() { - super(new JsonSchemaInfo() - .type(Set.of(Map.class)) - .properties(Map.ofEntries( - new PropertyEntry("someString", StringJsonSchema.StringJsonSchema1.class) - )) - .additionalProperties(BooleanJsonSchema.BooleanJsonSchema1.class) - ); - } + companion object { + @Volatile + private var instance: ObjectWithAddpropsSchema? = null - public static ObjectWithPropsAndAddpropsSchema getInstance() { - if (instance == null) { - instance = new ObjectWithPropsAndAddpropsSchema(); - } - return instance; + fun getInstance() = + instance ?: synchronized(this) { + instance ?: ObjectWithAddpropsSchema().also { instance = it } + } } + } - @Override - 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 RuntimeException("Invalid non-string key value"); - } - String propertyName = (String) entryKey; - List propertyPathToItem = new ArrayList<>(pathToItem); - propertyPathToItem.add(propertyName); - Object value = entry.getValue(); - LinkedHashMap, Nothing?> schemas = pathToSchemas.get(propertyPathToItem); - if (schemas == null) { - throw new RuntimeException("Validation result is invalid, schemas must exist for a pathToItem"); + interface ObjectWithPropsAndAddpropsSchemaBoxed + + data class ObjectWithPropsAndAddpropsSchemaBoxedMap(val data: FrozenMap) : + ObjectWithPropsAndAddpropsSchemaBoxed { + } + + class ObjectWithPropsAndAddpropsSchema private constructor() : JsonSchema( + JsonSchemaInfo() + .type(setOf(Map::class.java)) + .properties( + mapOf( + "someString" to StringJsonSchema.StringJsonSchema1::class.java + ) + ) + .additionalProperties(BooleanJsonSchema.BooleanJsonSchema1::class.java) + ), MapSchemaValidator, ObjectWithPropsAndAddpropsSchemaBoxedMap> { + override fun getNewInstance( + arg: Map<*, *>, + pathToItem: List, + pathToSchemas: PathToSchemasMap + ): FrozenMap { + val properties = LinkedHashMap() + for ((entryKey, value1) in arg) { + if (entryKey !is String) { + throw RuntimeException("Invalid non-string key value") } - JsonSchema propertySchema = schemas.entrySet().iterator().next().getKey(); - @Nullable Object castValue = propertySchema.getNewInstance(value, propertyPathToItem, pathToSchemas); - properties.put(propertyName, castValue); + val propertyPathToItem: MutableList = ArrayList(pathToItem) + propertyPathToItem.add(entryKey) + val value = value1!! + val schemas = pathToSchemas[propertyPathToItem] + ?: throw RuntimeException("Validation result is invalid, schemas must exist for a pathToItem") + val propertySchema = schemas.entries.iterator().next().key + val castValue = propertySchema.getNewInstance(value, propertyPathToItem, pathToSchemas) + properties[entryKey] = castValue } - return new FrozenMap<>(properties); + return FrozenMap(properties) } - public FrozenMap<@Nullable Object> validate(Map arg, SchemaConfiguration configuration) throws ValidationException { - Set> pathSet = new HashSet<>(); - List pathToItem = List.of("args[0"); - Map castArg = castToAllowedTypes(arg, pathToItem, pathSet); - SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().build())); - ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, new PathToSchemasMap(), new LinkedHashSet<>()); - PathToSchemasMap pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet); - return getNewInstance(castArg, validationMetadata.pathToItem(), pathToSchemasMap); + @Throws(ValidationException::class) + override fun validate(arg: Map<*, *>, configuration: SchemaConfiguration?): FrozenMap { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg: Map<*, *> = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validationMetadata = + ValidationMetadata(pathToItem, usedConfiguration, PathToSchemasMap(), LinkedHashSet()) + val pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet) + return getNewInstance(castArg, validationMetadata.pathToItem, pathToSchemasMap) } - @Override - public ObjectWithPropsAndAddpropsSchemaBoxedMap validateAndBox(Map arg, SchemaConfiguration configuration) throws ValidationException { - return new ObjectWithPropsAndAddpropsSchemaBoxedMap(validate(arg, configuration)); + @Throws(ValidationException::class) + override fun validateAndBox( + arg: Map<*, *>, + configuration: SchemaConfiguration? + ): ObjectWithPropsAndAddpropsSchemaBoxedMap { + return ObjectWithPropsAndAddpropsSchemaBoxedMap(validate(arg, configuration)) } - @Override - public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { - if (arg instanceof Map) { - return validate((Map) arg, configuration); + @Throws(ValidationException::class) + override fun validate(arg: Any?, configuration: SchemaConfiguration?): Any? { + if (arg is Map<*, *>) { + return validate(arg, configuration) } - throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw ValidationException("Invalid input type=$javaClass. It can't be validated by this schema") } - @Override - public ObjectWithPropsAndAddpropsSchemaBoxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { - if (arg instanceof Map mapArg) { - return new ObjectWithPropsAndAddpropsSchemaBoxedMap(validate(mapArg, configuration)); + @Throws(ValidationException::class) + override fun validateAndBox( + arg: Any?, + configuration: SchemaConfiguration? + ): ObjectWithPropsAndAddpropsSchemaBoxed { + if (arg is Map<*, *>) { + return ObjectWithPropsAndAddpropsSchemaBoxedMap(validate(arg, configuration)) } - throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw ValidationException("Invalid input type=$javaClass. It can't be validated by this schema") } - @Override - public Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { - if (arg instanceof Map) { - return getNewInstance((Map) arg, pathToItem, pathToSchemas); + override fun getNewInstance(arg: Any?, pathToItem: List, pathToSchemas: PathToSchemasMap): Any? { + if (arg is Map<*, *>) { + return getNewInstance(arg, pathToItem, pathToSchemas) } - throw new RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); + throw RuntimeException("Invalid input type=$javaClass. It can't be instantiated by this schema") } - } - public static class ObjectWithOutputTypeSchemaMap extends FrozenMap<@Nullable Object> { - protected ObjectWithOutputTypeSchemaMap(FrozenMap<@Nullable Object> m) { - super(m); - } + companion object { + @Volatile + private var instance: ObjectWithPropsAndAddpropsSchema? = null - public static ObjectWithOutputTypeSchemaMap of(Map arg, SchemaConfiguration configuration) throws ValidationException { - return ObjectWithOutputTypeSchema.getInstance().validate(arg, configuration); + fun getInstance() = + instance ?: synchronized(this) { + instance ?: ObjectWithPropsAndAddpropsSchema().also { instance = it } + } } } - public sealed interface ObjectWithOutputTypeSchemaBoxed permits ObjectWithOutputTypeSchemaBoxedMap { - } - public record ObjectWithOutputTypeSchemaBoxedMap(ObjectWithOutputTypeSchemaMap data) implements ObjectWithOutputTypeSchemaBoxed { - } - public static class ObjectWithOutputTypeSchema extends JsonSchema implements MapSchemaValidator { - private static @Nullable ObjectWithOutputTypeSchema instance = null; - public ObjectWithOutputTypeSchema() { - super(new JsonSchemaInfo() - .type(Set.of(Map.class)) - .properties(Map.ofEntries( - new PropertyEntry("someString", StringJsonSchema.StringJsonSchema1.class) - )) - ); - } - - public static ObjectWithOutputTypeSchema getInstance() { - if (instance == null) { - instance = new ObjectWithOutputTypeSchema(); + class ObjectWithOutputTypeSchemaMap(m: FrozenMap) : FrozenMap(m) { + companion object { + @Throws(ValidationException::class) + fun of(arg: Map, configuration: SchemaConfiguration?): ObjectWithOutputTypeSchemaMap { + return ObjectWithOutputTypeSchema.getInstance().validate(arg, configuration) } - return instance; } + } - @Override - public ObjectWithOutputTypeSchemaMap 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 RuntimeException("Invalid non-string key value"); - } - String propertyName = (String) entryKey; - List propertyPathToItem = new ArrayList<>(pathToItem); - propertyPathToItem.add(propertyName); - Object value = entry.getValue(); - LinkedHashMap, Nothing?> schemas = pathToSchemas.get(propertyPathToItem); - if (schemas == null) { - throw new RuntimeException("Validation result is invalid, schemas must exist for a pathToItem"); + interface ObjectWithOutputTypeSchemaBoxed + + data class ObjectWithOutputTypeSchemaBoxedMap(val data: ObjectWithOutputTypeSchemaMap) : + ObjectWithOutputTypeSchemaBoxed { + } + + class ObjectWithOutputTypeSchema : JsonSchema( + JsonSchemaInfo() + .type(setOf(Map::class.java)) + .properties( + mapOf( + "someString" to StringJsonSchema.StringJsonSchema1::class.java + ) + ) + ), MapSchemaValidator { + override fun getNewInstance( + arg: Map<*, *>, + pathToItem: List, + pathToSchemas: PathToSchemasMap + ): ObjectWithOutputTypeSchemaMap { + val properties = LinkedHashMap() + for ((entryKey, value1) in arg) { + if (entryKey !is String) { + throw RuntimeException("Invalid non-string key value") } - JsonSchema propertySchema = schemas.entrySet().iterator().next().getKey(); - @Nullable Object castValue = propertySchema.getNewInstance(value, propertyPathToItem, pathToSchemas); - properties.put(propertyName, castValue); + val propertyPathToItem: MutableList = ArrayList(pathToItem) + propertyPathToItem.add(entryKey) + val value = value1!! + val schemas = pathToSchemas[propertyPathToItem] + ?: throw RuntimeException("Validation result is invalid, schemas must exist for a pathToItem") + val propertySchema = schemas.entries.iterator().next().key + val castValue = propertySchema.getNewInstance(value, propertyPathToItem, pathToSchemas) + properties[entryKey] = castValue } - return new ObjectWithOutputTypeSchemaMap(new FrozenMap<>(properties)); + return ObjectWithOutputTypeSchemaMap(FrozenMap(properties)) } - 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); - SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().build())); - ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, new PathToSchemasMap(), new LinkedHashSet<>()); - PathToSchemasMap pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet); - return getNewInstance(castArg, validationMetadata.pathToItem(), pathToSchemasMap); + @Throws(ValidationException::class) + override fun validate(arg: Map<*, *>, configuration: SchemaConfiguration?): ObjectWithOutputTypeSchemaMap { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg: Map<*, *> = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validationMetadata = + ValidationMetadata(pathToItem, usedConfiguration, PathToSchemasMap(), LinkedHashSet()) + val pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet) + return getNewInstance(castArg, validationMetadata.pathToItem, pathToSchemasMap) } - @Override - public ObjectWithOutputTypeSchemaBoxedMap validateAndBox(Map arg, SchemaConfiguration configuration) throws ValidationException { - return new ObjectWithOutputTypeSchemaBoxedMap(validate(arg, configuration)); + @Throws(ValidationException::class) + override fun validateAndBox( + arg: Map<*, *>, + configuration: SchemaConfiguration? + ): ObjectWithOutputTypeSchemaBoxedMap { + return ObjectWithOutputTypeSchemaBoxedMap(validate(arg, configuration)) } - @Override - public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { - if (arg instanceof Map) { - return validate((Map) arg, configuration); + @Throws(ValidationException::class) + override fun validate(arg: Any?, configuration: SchemaConfiguration?): Any? { + if (arg is Map<*, *>) { + return validate(arg, configuration) } - throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw ValidationException("Invalid input type=$javaClass. It can't be validated by this schema") } - @Override - public ObjectWithOutputTypeSchemaBoxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { - if (arg instanceof Map mapArg) { - return new ObjectWithOutputTypeSchemaBoxedMap(validate(mapArg, configuration)); + @Throws(ValidationException::class) + override fun validateAndBox(arg: Any?, configuration: SchemaConfiguration?): ObjectWithOutputTypeSchemaBoxed { + if (arg is Map<*, *>) { + return ObjectWithOutputTypeSchemaBoxedMap(validate(arg, configuration)) } - throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw ValidationException("Invalid input type=$javaClass. It can't be validated by this schema") } - @Override - public Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { - if (arg instanceof FrozenMap) { - return getNewInstance((Map) arg, pathToItem, pathToSchemas); + override fun getNewInstance(arg: Any?, pathToItem: List, pathToSchemas: PathToSchemasMap): Any? { + if (arg is FrozenMap<*>) { + return getNewInstance(arg, pathToItem, pathToSchemas) } - throw new RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); + throw RuntimeException("Invalid input type=$javaClass. It can't be instantiated by this schema") + } + + companion object { + @Volatile + private var instance: ObjectWithOutputTypeSchema? = null + + fun getInstance() = + instance ?: synchronized(this) { + instance ?: ObjectWithOutputTypeSchema().also { instance = it } + } } } @Test - public void testExceptionThrownForInvalidType() { - ObjectWithPropsSchema schema = ObjectWithPropsSchema.getInstance(); - Assert.assertThrows(ValidationException.class, () -> JsonSchema.validate( - schema, - null, - validationMetadata - )); + fun testExceptionThrownForInvalidType() { + val schema = ObjectWithPropsSchema.getInstance() + assertFailsWith( + block = { + JsonSchema.validate( + schema, + null, + validationMetadata + ) + } + ) } @Test - public void testValidateObjectWithPropsSchema() throws ValidationException { - ObjectWithPropsSchema schema = ObjectWithPropsSchema.getInstance(); + @Throws(ValidationException::class) + fun testValidateObjectWithPropsSchema() { + val schema = ObjectWithPropsSchema.getInstance() // map with only property works - Map inMap = new LinkedHashMap<>(); - inMap.put("someString", "abc"); - FrozenMap<@Nullable Object> validatedValue = schema.validate(inMap, configuration); - LinkedHashMap outMap = new LinkedHashMap<>(); - outMap.put("someString", "abc"); - Assert.assertEquals(validatedValue, outMap); + var inMap: Map = mapOf("someString" to "abc") + var validatedValue = schema.validate(inMap, configuration) + var outMap: Map = mapOf("someString" to "abc") + assertEquals(validatedValue, outMap) // map with additional unvalidated property works - inMap = new LinkedHashMap<>(); - inMap.put("someString", "abc"); - inMap.put("someOtherString", "def"); - validatedValue = schema.validate(inMap, configuration); - outMap = new LinkedHashMap<>(); - outMap.put("someString", "abc"); - outMap.put("someOtherString", "def"); - Assert.assertEquals(validatedValue, outMap); + inMap = mapOf( + "someString" to "abc", + "someOtherString" to "def" + ) + validatedValue = schema.validate(inMap, configuration) + val outMap1: Map = mapOf( + "someString" to "abc", + "someOtherString" to "def" + ) + assertEquals(validatedValue, outMap1) // invalid prop type fails - inMap = new LinkedHashMap<>(); - inMap.put("someString", 1); - Map finalInMap = inMap; - Assert.assertThrows(ValidationException.class, () -> schema.validate( - finalInMap, configuration - )); + val invalidMap = mapOf("someString" to 1) + assertFailsWith( + block = { + schema.validate( + invalidMap, configuration + ) + } + ) } @Test - public void testValidateObjectWithAddpropsSchema() throws ValidationException { - ObjectWithAddpropsSchema schema = ObjectWithAddpropsSchema.getInstance(); + @Throws(ValidationException::class) + fun testValidateObjectWithAddpropsSchema() { + val schema = ObjectWithAddpropsSchema.getInstance() // map with only property works - Map inMap = new LinkedHashMap<>(); - inMap.put("someString", "abc"); - FrozenMap validatedValue = schema.validate(inMap, configuration); - LinkedHashMap outMap = new LinkedHashMap<>(); - outMap.put("someString", "abc"); - Assert.assertEquals(validatedValue, outMap); + var inMap: MutableMap = LinkedHashMap() + inMap["someString"] = "abc" + var validatedValue = schema.validate(inMap, configuration) + var outMap: Map = mapOf("someString" to "abc") + assertEquals(validatedValue, outMap) // map with additional properties works - inMap = new LinkedHashMap<>(); - inMap.put("someString", "abc"); - inMap.put("someOtherString", "def"); - validatedValue = schema.validate(inMap, configuration); - outMap = new LinkedHashMap<>(); - outMap.put("someString", "abc"); - outMap.put("someOtherString", "def"); - Assert.assertEquals(validatedValue, outMap); + inMap = LinkedHashMap() + inMap["someString"] = "abc" + inMap["someOtherString"] = "def" + validatedValue = schema.validate(inMap, configuration) + outMap = mapOf( + "someString" to "abc", + "someOtherString" to "def" + ) + assertEquals(validatedValue, outMap) // invalid addProp type fails - Map invalidInput = Map.of("someString", 1); - Assert.assertThrows(ValidationException.class, () -> JsonSchema.validate( - schema, - invalidInput, - validationMetadata - )); + val invalidInput = java.util.Map.of("someString", 1) + assertFailsWith( + block = { + JsonSchema.validate( + schema, + invalidInput, + validationMetadata + ) + } + ) } @Test - public void testValidateObjectWithPropsAndAddpropsSchema() throws ValidationException { - ObjectWithPropsAndAddpropsSchema schema = ObjectWithPropsAndAddpropsSchema.getInstance(); + @Throws(ValidationException::class) + fun testValidateObjectWithPropsAndAddpropsSchema() { + val schema = ObjectWithPropsAndAddpropsSchema.getInstance() // map with only property works - Map inMap = new LinkedHashMap<>(); - inMap.put("someString", "abc"); - FrozenMap<@Nullable Object> validatedValue = schema.validate(inMap, configuration); - LinkedHashMap outMap = new LinkedHashMap<>(); - outMap.put("someString", "abc"); - Assert.assertEquals(validatedValue, outMap); + var inMap: Map = mapOf("someString" to "abc") + var validatedValue: Map = schema.validate(inMap, configuration) + var outMap: Map = mapOf("someString" to "abc") + assertEquals(validatedValue, outMap) // map with additional properties works - inMap = new LinkedHashMap<>(); - inMap.put("someString", "abc"); - inMap.put("someAddProp", true); - validatedValue = schema.validate(inMap, configuration); - outMap = new LinkedHashMap<>(); - outMap.put("someString", "abc"); - outMap.put("someAddProp", true); - Assert.assertEquals(validatedValue, outMap); + inMap = mapOf( + "someString" to "abc", + "someAddProp" to true + ) + validatedValue = schema.validate(inMap, configuration) + val outMap1: Map = mapOf( + "someString" to "abc", + "someAddProp" to true + ) + assertEquals(validatedValue, outMap1) // invalid prop type fails - inMap = new LinkedHashMap<>(); - inMap.put("someString", 1); - Map invalidPropMap = inMap; - Assert.assertThrows(ValidationException.class, () -> schema.validate( - invalidPropMap, configuration - )); + inMap = mapOf("someString" to 1) + val invalidPropMap: Map = inMap + assertFailsWith( + block = { + schema.validate( + invalidPropMap, configuration + ) + } + ) // invalid addProp type fails - inMap = new LinkedHashMap<>(); - inMap.put("someAddProp", 1); - Map invalidAddpropMap = inMap; - Assert.assertThrows(ValidationException.class, () -> schema.validate( - invalidAddpropMap, configuration - )); + inMap = LinkedHashMap() + inMap["someAddProp"] = 1 + val invalidAddpropMap: Map = inMap + assertFailsWith( + block = { + schema.validate( + invalidAddpropMap, configuration + ) + } + ) } @Test - public void testValidateObjectWithOutputTypeSchema() throws ValidationException { - ObjectWithOutputTypeSchema schema = ObjectWithOutputTypeSchema.getInstance(); + @Throws(ValidationException::class) + fun testValidateObjectWithOutputTypeSchema() { + val schema = ObjectWithOutputTypeSchema.getInstance() // map with only property works - Map inMap = new LinkedHashMap<>(); - inMap.put("someString", "abc"); - ObjectWithOutputTypeSchemaMap validatedValue = schema.validate(inMap, configuration); - LinkedHashMap outMap = new LinkedHashMap<>(); - outMap.put("someString", "abc"); - Assert.assertEquals(validatedValue, outMap); + var inMap: Map = mapOf("someString" to "abc") + var validatedValue = schema.validate(inMap, configuration) + var outMap: Map = mapOf("someString" to "abc") + assertEquals(validatedValue, outMap) // map with additional unvalidated property works - inMap = new LinkedHashMap<>(); - inMap.put("someString", "abc"); - inMap.put("someOtherString", "def"); - validatedValue = schema.validate(inMap, configuration); - outMap = new LinkedHashMap<>(); - outMap.put("someString", "abc"); - outMap.put("someOtherString", "def"); - Assert.assertEquals(validatedValue, outMap); + inMap = mapOf( + "someString" to "abc", + "someOtherString" to "def", + ) + validatedValue = schema.validate(inMap, configuration) + val outMap1: Map = mapOf( + "someString" to "abc", + "someOtherString" to "def", + ) + assertEquals(validatedValue, outMap1) // invalid prop type fails - inMap = new LinkedHashMap<>(); - inMap.put("someString", 1); - Map finalInMap = inMap; - Assert.assertThrows(ValidationException.class, () -> schema.validate( - finalInMap, configuration - )); + val invalidInMap = mapOf("someString" to 1) + assertFailsWith( + block = { + schema.validate( + invalidInMap, configuration + ) + } + ) // using output class directly works - inMap = new LinkedHashMap<>(); - inMap.put("someString", "abc"); - validatedValue = ObjectWithOutputTypeSchemaMap.of(inMap, configuration); - outMap = new LinkedHashMap<>(); - outMap.put("someString", "abc"); - Assert.assertEquals(validatedValue, outMap); + inMap = mapOf("someString" to "abc") + validatedValue = ObjectWithOutputTypeSchemaMap.of(inMap, configuration) + val outMap2: Map = mapOf("someString" to "abc") + assertEquals(validatedValue, outMap2) + } + + companion object { + val configuration = SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validationMetadata = ValidationMetadata( + listOf("args[0"), + configuration, + PathToSchemasMap(), + LinkedHashSet() + ) } -} +} \ No newline at end of file diff --git a/src/main/resources/kotlin/src/test/kotlin/packagename/schemas/RefBooleanSchemaTest.hbs b/src/main/resources/kotlin/src/test/kotlin/packagename/schemas/RefBooleanSchemaTest.hbs index aeb7b350a5a..e40febe734b 100644 --- a/src/main/resources/kotlin/src/test/kotlin/packagename/schemas/RefBooleanSchemaTest.hbs +++ b/src/main/resources/kotlin/src/test/kotlin/packagename/schemas/RefBooleanSchemaTest.hbs @@ -1,49 +1,67 @@ -package {{{packageName}}}.schemas; - -import org.junit.Assert; -import org.junit.Test; -import {{{packageName}}}.configurations.JsonSchemaKeywordFlags; -import {{{packageName}}}.configurations.SchemaConfiguration; -import {{{packageName}}}.exceptions.ValidationException; -import {{{packageName}}}.schemas.validation.JsonSchema; -import {{{packageName}}}.schemas.validation.PathToSchemasMap; -import {{{packageName}}}.schemas.validation.ValidationMetadata; - -import java.util.LinkedHashSet; -import java.util.List; - -public class RefBooleanSchemaTest { - public static class RefBooleanSchema { - public static class RefBooleanSchema1 extends BooleanJsonSchema.BooleanJsonSchema1 {} +package {{{packageName}}}.schemas + +import {{{packageName}}}.configurations.JsonSchemaKeywordFlags +import {{{packageName}}}.configurations.SchemaConfiguration +import {{{packageName}}}.exceptions.ValidationException +import {{{packageName}}}.schemas.validation.JsonSchema +import {{{packageName}}}.schemas.validation.PathToSchemasMap +import {{{packageName}}}.schemas.validation.ValidationMetadata +import {{{packageName}}}.schemas.validation.JsonSchemaFactory + +import kotlin.test.Test +import kotlin.test.assertEquals +import kotlin.test.assertFailsWith + +class RefBooleanSchemaTest { + class RefBooleanSchema { + class RefBooleanSchema1 : BooleanJsonSchema.BooleanJsonSchema1() { + companion object { + @Volatile + private var instance: RefBooleanSchema1? = null + + fun getInstance() = + instance ?: synchronized(this) { + instance ?: RefBooleanSchema1().also { instance = it } + } + } + } } - static final SchemaConfiguration configuration = new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().build()); - static final BooleanJsonSchema.BooleanJsonSchema1 refBooleanJsonSchema = RefBooleanSchema.RefBooleanSchema1.getInstance(); - static final ValidationMetadata validationMetadata = new ValidationMetadata( - List.of("args[0"), - configuration, - new PathToSchemasMap(), - new LinkedHashSet<>() - ); - @Test - public void testValidateTrue() throws ValidationException { - Boolean validatedValue = refBooleanJsonSchema.validate(true, configuration); - Assert.assertEquals(validatedValue, Boolean.TRUE); + @Throws(ValidationException::class) + fun testValidateTrue() { + val validatedValue = refBooleanJsonSchema.validate(true, configuration) + assertEquals(validatedValue, true) } @Test - public void testValidateFalse() throws ValidationException { - Boolean validatedValue = refBooleanJsonSchema.validate(false, configuration); - Assert.assertEquals(validatedValue, Boolean.FALSE); + @Throws(ValidationException::class) + fun testValidateFalse() { + val validatedValue = refBooleanJsonSchema.validate(false, configuration) + assertEquals(validatedValue, false) } @Test - public void testExceptionThrownForInvalidType() { - Assert.assertThrows(ValidationException.class, () -> JsonSchema.validate( - refBooleanJsonSchema, - null, - validationMetadata - )); + fun testExceptionThrownForInvalidType() { + assertFailsWith( + block = { + JsonSchema.validate( + refBooleanJsonSchema, + null, + validationMetadata + ) + } + ) + } + + companion object { + val configuration = SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val refBooleanJsonSchema = JsonSchemaFactory.getInstance(RefBooleanSchema.RefBooleanSchema1::class.java) + val validationMetadata = ValidationMetadata( + listOf("args[0"), + configuration, + PathToSchemasMap(), + LinkedHashSet() + ) } } \ No newline at end of file diff --git a/src/main/resources/kotlin/src/test/kotlin/packagename/schemas/validation/AdditionalPropertiesValidatorTest.hbs b/src/main/resources/kotlin/src/test/kotlin/packagename/schemas/validation/AdditionalPropertiesValidatorTest.hbs index e761a4ac371..b14aa275acf 100644 --- a/src/main/resources/kotlin/src/test/kotlin/packagename/schemas/validation/AdditionalPropertiesValidatorTest.hbs +++ b/src/main/resources/kotlin/src/test/kotlin/packagename/schemas/validation/AdditionalPropertiesValidatorTest.hbs @@ -1,149 +1,140 @@ -package {{{packageName}}}.schemas.validation; +package {{{packageName}}}.schemas.validation -import org.checkerframework.checker.nullness.qual.Nullable; -import org.junit.Assert; -import org.junit.Test; -import {{{packageName}}}.configurations.JsonSchemaKeywordFlags; -import {{{packageName}}}.configurations.SchemaConfiguration; -import {{{packageName}}}.exceptions.ValidationException; -import {{{packageName}}}.schemas.MapJsonSchema; -import {{{packageName}}}.schemas.StringJsonSchema; -import {{{packageName}}}.exceptions.ValidationException; +import {{{packageName}}}.configurations.JsonSchemaKeywordFlags +import {{{packageName}}}.configurations.SchemaConfiguration +import {{{packageName}}}.schemas.MapJsonSchema +import {{{packageName}}}.schemas.StringJsonSchema +import {{{packageName}}}.exceptions.ValidationException -import java.util.ArrayList; -import java.util.LinkedHashMap; -import java.util.LinkedHashSet; -import java.util.List; -import java.util.Map; -import java.util.Set; +import kotlin.test.Test +import kotlin.test.assertEquals +import kotlin.test.assertNull +import kotlin.test.assertFailsWith -public class AdditionalPropertiesValidatorTest { - public sealed interface ObjectWithPropsSchemaBoxed permits ObjectWithPropsSchemaBoxedMap {} - public record ObjectWithPropsSchemaBoxedMap() implements ObjectWithPropsSchemaBoxed {} - public static class ObjectWithPropsSchema extends JsonSchema { - private static @Nullable ObjectWithPropsSchema instance = null; - private ObjectWithPropsSchema() { - super(new JsonSchemaInfo() - .type(Set.of(FrozenMap.class)) - .properties(Map.ofEntries( - new PropertyEntry("someString", StringJsonSchema.StringJsonSchema1.class) - )) - .additionalProperties(StringJsonSchema.StringJsonSchema1.class) - ); - - } - - public static ObjectWithPropsSchema getInstance() { - if (instance == null) { - instance = new ObjectWithPropsSchema(); +class AdditionalPropertiesValidatorTest { + sealed interface ObjectWithPropsSchemaBoxed + class ObjectWithPropsSchemaBoxedMap : ObjectWithPropsSchemaBoxed + class ObjectWithPropsSchema private constructor() : JsonSchema( + JsonSchemaInfo() + .type(setOf(Map::class.java)) + .properties( + mapOf( + "someString" to StringJsonSchema.StringJsonSchema1::class.java + ) + ) + .additionalProperties(StringJsonSchema.StringJsonSchema1::class.java) + ) { + override fun getNewInstance(arg: Any?, pathToItem: List, pathToSchemas: PathToSchemasMap): Map<*, *> { + if (arg is Map<*, *>) { + return arg } - return instance; + throw RuntimeException("Invalid input type=$javaClass. It can't be instantiated by this schema") } - @Override - public Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { - if (arg instanceof Map) { - return arg; + @Throws(ValidationException::class) + override fun validate(arg: Any?, configuration: SchemaConfiguration?): Map<*, *> { + if (arg is Map<*, *>) { + return arg } - throw new RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); + throw ValidationException("Invalid input type=$javaClass. It can't be validated by this schema") } - @Override - public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { - if (arg instanceof Map) { - return arg; - } - throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + @Throws(ValidationException::class) + override fun validateAndBox(arg: Any?, configuration: SchemaConfiguration?): ObjectWithPropsSchemaBoxed { + return ObjectWithPropsSchemaBoxedMap() } - @Override - public ObjectWithPropsSchemaBoxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { - return new ObjectWithPropsSchemaBoxedMap(); - } - } + companion object { + @Volatile + private var instance: ObjectWithPropsSchema? = null - @SuppressWarnings("nullness") - private Nothing? assertNull(@Nullable Object object) { - Assert.assertNull(object); - return null; + fun getInstance() = + instance ?: synchronized(this) { + instance ?: ObjectWithPropsSchema().also { instance = it } + } + } } @Test - public void testCorrectPropertySucceeds() throws ValidationException { - List pathToItem = List.of("args[0]"); - ValidationMetadata validationMetadata = new ValidationMetadata( - pathToItem, - new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().build()), - new PathToSchemasMap(), - new LinkedHashSet<>() - ); - LinkedHashMap mutableMap = new LinkedHashMap<>(); - mutableMap.put("someString", "abc"); - mutableMap.put("someAddProp", "def"); - FrozenMap arg = new FrozenMap<>(mutableMap); - final AdditionalPropertiesValidator validator = new AdditionalPropertiesValidator(); - PathToSchemasMap pathToSchemas = validator.validate( - new ValidationData( - ObjectWithPropsSchema.getInstance(), - arg, - validationMetadata - ) - ); - if (pathToSchemas == null) { - throw new RuntimeException("Invalid null value for pathToSchemas for this test case"); - } - List expectedPathToItem = new ArrayList<>(); - expectedPathToItem.add("args[0]"); - expectedPathToItem.add("someAddProp"); - LinkedHashMap, Nothing?> expectedClasses = new LinkedHashMap<>(); - StringJsonSchema.StringJsonSchema1 schema = JsonSchemaFactory.getInstance(StringJsonSchema.StringJsonSchema1.class); - expectedClasses.put(schema, null); - PathToSchemasMap expectedPathToSchemas = new PathToSchemasMap(); - expectedPathToSchemas.put(expectedPathToItem, expectedClasses); - Assert.assertEquals(pathToSchemas, expectedPathToSchemas); + @Throws(ValidationException::class) + fun testCorrectPropertySucceeds() { + val pathToItem = listOf("args[0]") + val validationMetadata = ValidationMetadata( + pathToItem, + SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()), + PathToSchemasMap(), + LinkedHashSet() + ) + val mutableMap = java.util.LinkedHashMap() + mutableMap["someString"] = "abc" + mutableMap["someAddProp"] = "def" + val arg = FrozenMap(mutableMap) + val validator = AdditionalPropertiesValidator() + val pathToSchemas = validator.validate( + ValidationData( + ObjectWithPropsSchema.getInstance(), + arg, + validationMetadata + ) + ) ?: throw RuntimeException("Invalid null value for pathToSchemas for this test case") + val expectedPathToItem: MutableList = ArrayList() + expectedPathToItem.add("args[0]") + expectedPathToItem.add("someAddProp") + + val expectedClasses: LinkedHashMap, Nothing?> = LinkedHashMap() + val schema = JsonSchemaFactory.getInstance(StringJsonSchema.StringJsonSchema1::class.java) + expectedClasses[schema] = null + val expectedPathToSchemas = PathToSchemasMap() + expectedPathToSchemas[expectedPathToItem] = expectedClasses + assertEquals(pathToSchemas, expectedPathToSchemas) } @Test - public void testNotApplicableTypeReturnsNull() throws ValidationException { - List pathToItem = List.of("args[0]"); - ValidationMetadata validationMetadata = new ValidationMetadata( - pathToItem, - new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().build()), - new PathToSchemasMap(), - new LinkedHashSet<>() - ); - final AdditionalPropertiesValidator validator = new AdditionalPropertiesValidator(); - PathToSchemasMap pathToSchemas = validator.validate( - new ValidationData( - MapJsonSchema.MapJsonSchema1.getInstance(), - 1, - validationMetadata - ) - ); - assertNull(pathToSchemas); + @Throws(ValidationException::class) + fun testNotApplicableTypeReturnsNull() { + val pathToItem = listOf("args[0]") + val validationMetadata = ValidationMetadata( + pathToItem, + SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()), + PathToSchemasMap(), + LinkedHashSet() + ) + val validator = AdditionalPropertiesValidator() + val pathToSchemas = validator.validate( + ValidationData( + MapJsonSchema.MapJsonSchema1.getInstance(), + 1, + validationMetadata + ) + ) + assertNull(pathToSchemas) } @Test - public void testIncorrectPropertyValueFails() { - List pathToItem = List.of("args[0]"); - ValidationMetadata validationMetadata = new ValidationMetadata( - pathToItem, - new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().build()), - new PathToSchemasMap(), - new LinkedHashSet<>() - ); - LinkedHashMap mutableMap = new LinkedHashMap<>(); - mutableMap.put("someString", "abc"); - mutableMap.put("someAddProp", 1); - FrozenMap arg = new FrozenMap<>(mutableMap); - final AdditionalPropertiesValidator validator = new AdditionalPropertiesValidator(); - Assert.assertThrows(ValidationException.class, () -> validator.validate( - new ValidationData( - ObjectWithPropsSchema.getInstance(), - arg, - validationMetadata + fun testIncorrectPropertyValueFails() { + val pathToItem = listOf("args[0]") + val validationMetadata = ValidationMetadata( + pathToItem, + SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()), + PathToSchemasMap(), + LinkedHashSet() + ) + val mutableMap = java.util.LinkedHashMap() + mutableMap["someString"] = "abc" + mutableMap["someAddProp"] = 1 + val arg = FrozenMap(mutableMap) + val validator = AdditionalPropertiesValidator() + assertFailsWith( + block = { + validator.validate( + ValidationData( + ObjectWithPropsSchema.getInstance(), + arg, + validationMetadata + ) ) - )); + } + ) } } \ No newline at end of file diff --git a/src/main/resources/kotlin/src/test/kotlin/packagename/schemas/validation/CustomIsoparserTest.hbs b/src/main/resources/kotlin/src/test/kotlin/packagename/schemas/validation/CustomIsoparserTest.hbs index ed5b89f25de..20d24c5d454 100644 --- a/src/main/resources/kotlin/src/test/kotlin/packagename/schemas/validation/CustomIsoparserTest.hbs +++ b/src/main/resources/kotlin/src/test/kotlin/packagename/schemas/validation/CustomIsoparserTest.hbs @@ -1,28 +1,25 @@ -package {{{packageName}}}.schemas.validation; +package {{{packageName}}}.schemas.validation -import java.time.LocalDate; -import java.time.ZonedDateTime; -import java.time.ZoneId; -import org.junit.Assert; -import org.junit.Test; +import java.time.LocalDate +import java.time.ZoneId +import java.time.ZonedDateTime -public final class CustomIsoparserTest { +import kotlin.test.Test +import kotlin.test.assertEquals +class CustomIsoparserTest { @Test - public void testParseIsodatetime() { - final CustomIsoparser parser = new CustomIsoparser(); - ZonedDateTime dateTime = parser.parseIsodatetime("2017-07-21T17:32:28Z"); - ZoneId zone = ZoneId.of("Z"); - ZonedDateTime expectedDateTime = ZonedDateTime.of(2017, 7, 21, 17, 32, 28, 0, zone); - Assert.assertEquals(dateTime, expectedDateTime); + fun testParseIsodatetime() { + val dateTime: ZonedDateTime = CustomIsoparser.parseIsodatetime("2017-07-21T17:32:28Z") + val zone = ZoneId.of("Z") + val expectedDateTime = ZonedDateTime.of(2017, 7, 21, 17, 32, 28, 0, zone) + assertEquals(dateTime, expectedDateTime) } @Test - public void testParseIsodate() { - final CustomIsoparser parser = new CustomIsoparser(); - LocalDate date = parser.parseIsodate("2017-07-21"); - LocalDate expectedDate = LocalDate.of(2017, 7, 21); - Assert.assertEquals(date, expectedDate); + fun testParseIsodate() { + val date: LocalDate = CustomIsoparser.parseIsodate("2017-07-21") + val expectedDate = LocalDate.of(2017, 7, 21) + assertEquals(date, expectedDate) } - } \ No newline at end of file diff --git a/src/main/resources/kotlin/src/test/kotlin/packagename/schemas/validation/FormatValidatorTest.hbs b/src/main/resources/kotlin/src/test/kotlin/packagename/schemas/validation/FormatValidatorTest.hbs index f521c9d7f04..d4fba01fc1f 100644 --- a/src/main/resources/kotlin/src/test/kotlin/packagename/schemas/validation/FormatValidatorTest.hbs +++ b/src/main/resources/kotlin/src/test/kotlin/packagename/schemas/validation/FormatValidatorTest.hbs @@ -1,363 +1,418 @@ -package {{{packageName}}}.schemas.validation; - -import org.checkerframework.checker.nullness.qual.Nullable; -import org.junit.Assert; -import org.junit.Test; -import {{{packageName}}}.configurations.JsonSchemaKeywordFlags; -import {{{packageName}}}.configurations.SchemaConfiguration; -import {{{packageName}}}.exceptions.ValidationException; -import {{{packageName}}}.schemas.IntJsonSchema; -import {{{packageName}}}.schemas.Int32JsonSchema; -import {{{packageName}}}.schemas.Int64JsonSchema; -import {{{packageName}}}.schemas.FloatJsonSchema; -import {{{packageName}}}.schemas.DoubleJsonSchema; -import {{{packageName}}}.schemas.DecimalJsonSchema; -import {{{packageName}}}.schemas.DateJsonSchema; -import {{{packageName}}}.schemas.DateTimeJsonSchema; - -import java.math.BigDecimal; -import java.math.BigInteger; -import java.util.ArrayList; -import java.util.LinkedHashSet; - -public class FormatValidatorTest { - static final ValidationMetadata validationMetadata = new ValidationMetadata( - new ArrayList<>(), - new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().build()), - new PathToSchemasMap(), - new LinkedHashSet<>() - ); - - @SuppressWarnings("nullness") - private void assertNull(@Nullable Object object) { - Assert.assertNull(object); +package {{{packageName}}}.schemas.validation + +import {{{packageName}}}.configurations.JsonSchemaKeywordFlags +import {{{packageName}}}.configurations.SchemaConfiguration +import {{{packageName}}}.exceptions.ValidationException +import {{{packageName}}}.schemas.IntJsonSchema +import {{{packageName}}}.schemas.Int32JsonSchema +import {{{packageName}}}.schemas.Int64JsonSchema +import {{{packageName}}}.schemas.FloatJsonSchema +import {{{packageName}}}.schemas.DoubleJsonSchema +import {{{packageName}}}.schemas.DecimalJsonSchema +import {{{packageName}}}.schemas.DateJsonSchema +import {{{packageName}}}.schemas.DateTimeJsonSchema + +import java.math.BigDecimal +import java.math.BigInteger +import kotlin.test.Test +import kotlin.test.assertFailsWith +import kotlin.test.assertNull + +class FormatValidatorTest { + @Test + @Throws(ValidationException::class) + fun testIntFormatSucceedsWithFloat() { + val validator = FormatValidator() + val pathToSchemasMap = validator.validate( + ValidationData( + IntJsonSchema.IntJsonSchema1.getInstance(), + 1.0f, + validationMetadata + ) + ) + assertNull(pathToSchemasMap) } @Test - public void testIntFormatSucceedsWithFloat() throws ValidationException { - final FormatValidator validator = new FormatValidator(); - PathToSchemasMap pathToSchemasMap = validator.validate( - new ValidationData( - IntJsonSchema.IntJsonSchema1.getInstance(), - 1.0f, - validationMetadata + fun testIntFormatFailsWithFloat() { + val validator = FormatValidator() + assertFailsWith( + block = { + validator.validate( + ValidationData( + IntJsonSchema.IntJsonSchema1.getInstance(), + 3.14f, + validationMetadata + ) ) - ); - assertNull(pathToSchemasMap); + } + ) } @Test - public void testIntFormatFailsWithFloat() { - final FormatValidator validator = new FormatValidator(); - Assert.assertThrows(ValidationException.class, () -> validator.validate( - new ValidationData( - IntJsonSchema.IntJsonSchema1.getInstance(), - 3.14f, - validationMetadata - ) - )); + @Throws(ValidationException::class) + fun testIntFormatSucceedsWithInt() { + val validator = FormatValidator() + val pathToSchemasMap = validator.validate( + ValidationData( + IntJsonSchema.IntJsonSchema1.getInstance(), + 1, + validationMetadata + ) + ) + assertNull(pathToSchemasMap) } @Test - public void testIntFormatSucceedsWithInt() throws ValidationException { - final FormatValidator validator = new FormatValidator(); - PathToSchemasMap pathToSchemasMap = validator.validate( - new ValidationData( - IntJsonSchema.IntJsonSchema1.getInstance(), - 1, - validationMetadata + fun testInt32UnderMinFails() { + val validator = FormatValidator() + assertFailsWith( + block = { + validator.validate( + ValidationData( + Int32JsonSchema.Int32JsonSchema1.getInstance(), + -2147483649L, + validationMetadata + ) ) - ); - assertNull(pathToSchemasMap); + } + ) } @Test - public void testInt32UnderMinFails() { - final FormatValidator validator = new FormatValidator(); - Assert.assertThrows(ValidationException.class, () -> validator.validate( - new ValidationData( - Int32JsonSchema.Int32JsonSchema1.getInstance(), - -2147483649L, - validationMetadata - ) - )); + @Throws(ValidationException::class) + fun testInt32InclusiveMinSucceeds() { + val validator = FormatValidator() + val pathToSchemasMap = validator.validate( + ValidationData( + Int32JsonSchema.Int32JsonSchema1.getInstance(), + -2147483648, + validationMetadata + ) + ) + assertNull(pathToSchemasMap) } @Test - public void testInt32InclusiveMinSucceeds() throws ValidationException { - final FormatValidator validator = new FormatValidator(); - PathToSchemasMap pathToSchemasMap = validator.validate( - new ValidationData( - Int32JsonSchema.Int32JsonSchema1.getInstance(), - -2147483648, - validationMetadata - ) - ); - assertNull(pathToSchemasMap); + @Throws(ValidationException::class) + fun testInt32InclusiveMaxSucceeds() { + val validator = FormatValidator() + val pathToSchemasMap = validator.validate( + ValidationData( + Int32JsonSchema.Int32JsonSchema1.getInstance(), + 2147483647, + validationMetadata + ) + ) + assertNull(pathToSchemasMap) } @Test - public void testInt32InclusiveMaxSucceeds() throws ValidationException { - final FormatValidator validator = new FormatValidator(); - PathToSchemasMap pathToSchemasMap = validator.validate( - new ValidationData( - Int32JsonSchema.Int32JsonSchema1.getInstance(), - 2147483647, - validationMetadata + fun testInt32OverMaxFails() { + val validator = FormatValidator() + assertFailsWith( + block = { + validator.validate( + ValidationData( + Int32JsonSchema.Int32JsonSchema1.getInstance(), + 2147483648L, + validationMetadata + ) ) - ); - assertNull(pathToSchemasMap); + } + ) } @Test - public void testInt32OverMaxFails() { - final FormatValidator validator = new FormatValidator(); - Assert.assertThrows(ValidationException.class, () -> validator.validate( - new ValidationData( - Int32JsonSchema.Int32JsonSchema1.getInstance(), - 2147483648L, - validationMetadata + fun testInt64UnderMinFails() { + val validator = FormatValidator() + assertFailsWith( + block = { + validator.validate( + ValidationData( + Int64JsonSchema.Int64JsonSchema1.getInstance(), + BigInteger("-9223372036854775809"), + validationMetadata + ) ) - )); + } + ) } @Test - public void testInt64UnderMinFails() { - final FormatValidator validator = new FormatValidator(); - - Assert.assertThrows(ValidationException.class, () -> validator.validate( - new ValidationData( - Int64JsonSchema.Int64JsonSchema1.getInstance(), - new BigInteger("-9223372036854775809"), - validationMetadata - ) - )); + @Throws(ValidationException::class) + fun testInt64InclusiveMinSucceeds() { + val validator = FormatValidator() + val pathToSchemasMap = validator.validate( + ValidationData( + Int64JsonSchema.Int64JsonSchema1.getInstance(), + Long.MIN_VALUE, + validationMetadata + ) + ) + assertNull(pathToSchemasMap) } @Test - public void testInt64InclusiveMinSucceeds() throws ValidationException { - final FormatValidator validator = new FormatValidator(); - PathToSchemasMap pathToSchemasMap = validator.validate( - new ValidationData( - Int64JsonSchema.Int64JsonSchema1.getInstance(), - -9223372036854775808L, - validationMetadata - ) - ); - assertNull(pathToSchemasMap); + @Throws(ValidationException::class) + fun testInt64InclusiveMaxSucceeds() { + val validator = FormatValidator() + val pathToSchemasMap = validator.validate( + ValidationData( + Int64JsonSchema.Int64JsonSchema1.getInstance(), + 9223372036854775807L, + validationMetadata + ) + ) + assertNull(pathToSchemasMap) } @Test - public void testInt64InclusiveMaxSucceeds() throws ValidationException { - final FormatValidator validator = new FormatValidator(); - PathToSchemasMap pathToSchemasMap = validator.validate( - new ValidationData( - Int64JsonSchema.Int64JsonSchema1.getInstance(), - 9223372036854775807L, - validationMetadata + fun testInt64OverMaxFails() { + val validator = FormatValidator() + assertFailsWith( + block = { + validator.validate( + ValidationData( + Int64JsonSchema.Int64JsonSchema1.getInstance(), + BigInteger("9223372036854775808"), + validationMetadata + ) ) - ); - assertNull(pathToSchemasMap); + } + ) } @Test - public void testInt64OverMaxFails() { - final FormatValidator validator = new FormatValidator(); - - Assert.assertThrows(ValidationException.class, () -> validator.validate( - new ValidationData( - Int64JsonSchema.Int64JsonSchema1.getInstance(), - new BigInteger("9223372036854775808"), - validationMetadata + fun testFloatUnderMinFails() { + val validator = FormatValidator() + assertFailsWith( + block = { + validator.validate( + ValidationData( + FloatJsonSchema.FloatJsonSchema1.getInstance(), + -3.402823466385289e+38, + validationMetadata + ) ) - )); + } + ) } @Test - public void testFloatUnderMinFails() { - final FormatValidator validator = new FormatValidator(); - Assert.assertThrows(ValidationException.class, () -> validator.validate( - new ValidationData( - FloatJsonSchema.FloatJsonSchema1.getInstance(), - -3.402823466385289e+38d, - validationMetadata - ) - )); + @Throws(ValidationException::class) + fun testFloatInclusiveMinSucceeds() { + val validator = FormatValidator() + val pathToSchemasMap = validator.validate( + ValidationData( + FloatJsonSchema.FloatJsonSchema1.getInstance(), + Float.MIN_VALUE, + validationMetadata + ) + ) + assertNull(pathToSchemasMap) } @Test - public void testFloatInclusiveMinSucceeds() throws ValidationException { - final FormatValidator validator = new FormatValidator(); - PathToSchemasMap pathToSchemasMap = validator.validate( - new ValidationData( - FloatJsonSchema.FloatJsonSchema1.getInstance(), - -3.4028234663852886e+38f, - validationMetadata - ) - ); - assertNull(pathToSchemasMap); + @Throws(ValidationException::class) + fun testFloatInclusiveMaxSucceeds() { + val validator = FormatValidator() + val pathToSchemasMap = validator.validate( + ValidationData( + FloatJsonSchema.FloatJsonSchema1.getInstance(), + Float.MAX_VALUE, + validationMetadata + ) + ) + assertNull(pathToSchemasMap) } @Test - public void testFloatInclusiveMaxSucceeds() throws ValidationException { - final FormatValidator validator = new FormatValidator(); - PathToSchemasMap pathToSchemasMap = validator.validate( - new ValidationData( - FloatJsonSchema.FloatJsonSchema1.getInstance(), - 3.4028234663852886e+38f, - validationMetadata + fun testFloatOverMaxFails() { + val validator = FormatValidator() + assertFailsWith( + block = { + validator.validate( + ValidationData( + FloatJsonSchema.FloatJsonSchema1.getInstance(), + 3.402823466385289e+38, + validationMetadata + ) ) - ); - assertNull(pathToSchemasMap); + } + ) } @Test - public void testFloatOverMaxFails() { - final FormatValidator validator = new FormatValidator(); - Assert.assertThrows(ValidationException.class, () -> validator.validate( - new ValidationData( - FloatJsonSchema.FloatJsonSchema1.getInstance(), - 3.402823466385289e+38d, - validationMetadata + fun testDoubleUnderMinFails() { + val validator = FormatValidator() + assertFailsWith( + block = { + validator.validate( + ValidationData( + DoubleJsonSchema.DoubleJsonSchema1.getInstance(), + BigDecimal("-1.7976931348623157082e+308"), + validationMetadata + ) ) - )); + } + ) } @Test - public void testDoubleUnderMinFails() { - final FormatValidator validator = new FormatValidator(); - Assert.assertThrows(ValidationException.class, () -> validator.validate( - new ValidationData( - DoubleJsonSchema.DoubleJsonSchema1.getInstance(), - new BigDecimal("-1.7976931348623157082e+308"), - validationMetadata - ) - )); + @Throws(ValidationException::class) + fun testDoubleInclusiveMinSucceeds() { + val validator = FormatValidator() + val pathToSchemasMap = validator.validate( + ValidationData( + DoubleJsonSchema.DoubleJsonSchema1.getInstance(), + -1.7976931348623157E+308, + validationMetadata + ) + ) + assertNull(pathToSchemasMap) } @Test - public void testDoubleInclusiveMinSucceeds() throws ValidationException { - final FormatValidator validator = new FormatValidator(); - PathToSchemasMap pathToSchemasMap = validator.validate( - new ValidationData( - DoubleJsonSchema.DoubleJsonSchema1.getInstance(), - -1.7976931348623157E+308d, - validationMetadata - ) - ); - assertNull(pathToSchemasMap); + @Throws(ValidationException::class) + fun testDoubleInclusiveMaxSucceeds() { + val validator = FormatValidator() + val pathToSchemasMap = validator.validate( + ValidationData( + DoubleJsonSchema.DoubleJsonSchema1.getInstance(), + 1.7976931348623157E+308, + validationMetadata + ) + ) + assertNull(pathToSchemasMap) } @Test - public void testDoubleInclusiveMaxSucceeds() throws ValidationException { - final FormatValidator validator = new FormatValidator(); - PathToSchemasMap pathToSchemasMap = validator.validate( - new ValidationData( - DoubleJsonSchema.DoubleJsonSchema1.getInstance(), - 1.7976931348623157E+308d, - validationMetadata + fun testDoubleOverMaxFails() { + val validator = FormatValidator() + assertFailsWith( + block = { + validator.validate( + ValidationData( + DoubleJsonSchema.DoubleJsonSchema1.getInstance(), + BigDecimal("1.7976931348623157082e+308"), + validationMetadata + ) ) - ); - assertNull(pathToSchemasMap); + } + ) } @Test - public void testDoubleOverMaxFails() { - final FormatValidator validator = new FormatValidator(); - Assert.assertThrows(ValidationException.class, () -> validator.validate( - new ValidationData( - DoubleJsonSchema.DoubleJsonSchema1.getInstance(), - new BigDecimal("1.7976931348623157082e+308"), - validationMetadata + fun testInvalidNumberStringFails() { + val validator = FormatValidator() + assertFailsWith( + block = { + validator.validate( + ValidationData( + DecimalJsonSchema.DecimalJsonSchema1.getInstance(), + "abc", + validationMetadata + ) ) - )); + } + ) } @Test - public void testInvalidNumberStringFails() { - final FormatValidator validator = new FormatValidator(); - Assert.assertThrows(ValidationException.class, () -> validator.validate( - new ValidationData( - DecimalJsonSchema.DecimalJsonSchema1.getInstance(), - "abc", - validationMetadata - ) - )); + @Throws(ValidationException::class) + fun testValidFloatNumberStringSucceeds() { + val validator = FormatValidator() + val pathToSchemasMap = validator.validate( + ValidationData( + DecimalJsonSchema.DecimalJsonSchema1.getInstance(), + "3.14", + validationMetadata + ) + ) + assertNull(pathToSchemasMap) } @Test - public void testValidFloatNumberStringSucceeds() throws ValidationException { - final FormatValidator validator = new FormatValidator(); - PathToSchemasMap pathToSchemasMap = validator.validate( - new ValidationData( - DecimalJsonSchema.DecimalJsonSchema1.getInstance(), - "3.14", - validationMetadata - ) - ); - assertNull(pathToSchemasMap); + @Throws(ValidationException::class) + fun testValidIntNumberStringSucceeds() { + val validator = FormatValidator() + val pathToSchemasMap = validator.validate( + ValidationData( + DecimalJsonSchema.DecimalJsonSchema1.getInstance(), + "1", + validationMetadata + ) + ) + assertNull(pathToSchemasMap) } @Test - public void testValidIntNumberStringSucceeds() throws ValidationException { - final FormatValidator validator = new FormatValidator(); - PathToSchemasMap pathToSchemasMap = validator.validate( - new ValidationData( - DecimalJsonSchema.DecimalJsonSchema1.getInstance(), - "1", - validationMetadata + fun testInvalidDateStringFails() { + val validator = FormatValidator() + assertFailsWith( + block = { + validator.validate( + ValidationData( + DateJsonSchema.DateJsonSchema1.getInstance(), + "abc", + validationMetadata + ) ) - ); - assertNull(pathToSchemasMap); + } + ) } @Test - public void testInvalidDateStringFails() { - final FormatValidator validator = new FormatValidator(); - Assert.assertThrows(ValidationException.class, () -> validator.validate( - new ValidationData( - DateJsonSchema.DateJsonSchema1.getInstance(), - "abc", - validationMetadata - ) - )); + @Throws(ValidationException::class) + fun testValidDateStringSucceeds() { + val validator = FormatValidator() + val pathToSchemasMap = validator.validate( + ValidationData( + DateJsonSchema.DateJsonSchema1.getInstance(), + "2017-01-20", + validationMetadata + ) + ) + assertNull(pathToSchemasMap) } @Test - public void testValidDateStringSucceeds() throws ValidationException { - final FormatValidator validator = new FormatValidator(); - PathToSchemasMap pathToSchemasMap = validator.validate( - new ValidationData( - DateJsonSchema.DateJsonSchema1.getInstance(), - "2017-01-20", - validationMetadata + fun testInvalidDateTimeStringFails() { + val validator = FormatValidator() + assertFailsWith( + block = { + validator.validate( + ValidationData( + DateTimeJsonSchema.DateTimeJsonSchema1.getInstance(), + "abc", + validationMetadata + ) ) - ); - assertNull(pathToSchemasMap); + } + ) } @Test - public void testInvalidDateTimeStringFails() { - final FormatValidator validator = new FormatValidator(); - Assert.assertThrows(ValidationException.class, () -> validator.validate( - new ValidationData( - DateTimeJsonSchema.DateTimeJsonSchema1.getInstance(), - "abc", - validationMetadata - ) - )); + @Throws(ValidationException::class) + fun testValidDateTimeStringSucceeds() { + val validator = FormatValidator() + val pathToSchemasMap = validator.validate( + ValidationData( + DateTimeJsonSchema.DateTimeJsonSchema1.getInstance(), + "2017-07-21T17:32:28Z", + validationMetadata + ) + ) + assertNull(pathToSchemasMap) } - @Test - public void testValidDateTimeStringSucceeds() throws ValidationException { - final FormatValidator validator = new FormatValidator(); - PathToSchemasMap pathToSchemasMap = validator.validate( - new ValidationData( - DateTimeJsonSchema.DateTimeJsonSchema1.getInstance(), - "2017-07-21T17:32:28Z", - validationMetadata - ) - ); - assertNull(pathToSchemasMap); + companion object { + val validationMetadata = ValidationMetadata( + ArrayList(), + SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()), + PathToSchemasMap(), + LinkedHashSet() + ) } } \ No newline at end of file diff --git a/src/main/resources/kotlin/src/test/kotlin/packagename/schemas/validation/ItemsValidatorTest.hbs b/src/main/resources/kotlin/src/test/kotlin/packagename/schemas/validation/ItemsValidatorTest.hbs index dca5ae9347e..39faeb257c1 100644 --- a/src/main/resources/kotlin/src/test/kotlin/packagename/schemas/validation/ItemsValidatorTest.hbs +++ b/src/main/resources/kotlin/src/test/kotlin/packagename/schemas/validation/ItemsValidatorTest.hbs @@ -1,131 +1,120 @@ -package {{{packageName}}}.schemas.validation; +package {{{packageName}}}.schemas.validation -import org.checkerframework.checker.nullness.qual.Nullable; -import org.junit.Assert; -import org.junit.Test; -import {{{packageName}}}.configurations.JsonSchemaKeywordFlags; -import {{{packageName}}}.configurations.SchemaConfiguration; -import {{{packageName}}}.schemas.StringJsonSchema; -import {{{packageName}}}.exceptions.ValidationException; +import {{{packageName}}}.configurations.JsonSchemaKeywordFlags +import {{{packageName}}}.configurations.SchemaConfiguration +import {{{packageName}}}.schemas.StringJsonSchema +import {{{packageName}}}.exceptions.ValidationException -import java.util.ArrayList; -import java.util.LinkedHashMap; -import java.util.LinkedHashSet; -import java.util.List; -import java.util.Set; +import kotlin.test.Test +import kotlin.test.assertEquals +import kotlin.test.assertFailsWith +import kotlin.test.assertNull -public class ItemsValidatorTest { - @SuppressWarnings("nullness") - private void assertNull(@Nullable Object object) { - Assert.assertNull(object); - } - - public sealed interface ArrayWithItemsSchemaBoxed permits ArrayWithItemsSchemaBoxedList {} - public record ArrayWithItemsSchemaBoxedList() implements ArrayWithItemsSchemaBoxed {} - - public static class ArrayWithItemsSchema extends JsonSchema { - public ArrayWithItemsSchema() { - super(new JsonSchemaInfo() - .type(Set.of(List.class)) - .items(StringJsonSchema.StringJsonSchema1.class) - ); - } - - @Override - public Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { - if (arg instanceof List listArg) { - return getNewInstance(listArg, pathToItem, pathToSchemas); +class ItemsValidatorTest { + interface ArrayWithItemsSchemaBoxed + class ArrayWithItemsSchemaBoxedList : ArrayWithItemsSchemaBoxed + class ArrayWithItemsSchema : JsonSchema( + JsonSchemaInfo() + .type(setOf(List::class.java)) + .items(StringJsonSchema.StringJsonSchema1::class.java) + ) { + override fun getNewInstance(arg: Any?, pathToItem: List, pathToSchemas: PathToSchemasMap): Any? { + if (arg is List<*>) { + return getNewInstance(arg, pathToItem, pathToSchemas) } - throw new RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); + throw RuntimeException("Invalid input type=$javaClass. It can't be instantiated by this schema") } - @Override - public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { - if (arg instanceof List listArg) { - return validate(listArg, configuration); + @Throws(ValidationException::class) + override fun validate(arg: Any?, configuration: SchemaConfiguration?): Any? { + if (arg is List<*>) { + return validate(arg, configuration) } - throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw ValidationException("Invalid input type=$javaClass. It can't be validated by this schema") } - @Override - public ArrayWithItemsSchemaBoxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { - return new ArrayWithItemsSchemaBoxedList(); + @Throws(ValidationException::class) + override fun validateAndBox(arg: Any?, configuration: SchemaConfiguration?): ArrayWithItemsSchemaBoxed { + return ArrayWithItemsSchemaBoxedList() } } @Test - public void testCorrectItemsSucceeds() throws ValidationException { - List pathToItem = List.of("args[0]"); - ValidationMetadata validationMetadata = new ValidationMetadata( - pathToItem, - new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().build()), - new PathToSchemasMap(), - new LinkedHashSet<>() - ); - List mutableList = new ArrayList<>(); - mutableList.add("a"); - FrozenList arg = new FrozenList<>(mutableList); - final ItemsValidator validator = new ItemsValidator(); - PathToSchemasMap pathToSchemas = validator.validate( - new ValidationData( - new ArrayWithItemsSchema(), - arg, - validationMetadata - ) - ); - if (pathToSchemas == null) { - throw new RuntimeException("Invalid null value in pathToSchemas for this test case"); - } - List expectedPathToItem = new ArrayList<>(); - expectedPathToItem.add("args[0]"); - expectedPathToItem.add(0); - LinkedHashMap, Nothing?> expectedClasses = new LinkedHashMap<>(); - StringJsonSchema.StringJsonSchema1 schema = JsonSchemaFactory.getInstance(StringJsonSchema.StringJsonSchema1.class); - expectedClasses.put(schema, null); - PathToSchemasMap expectedPathToSchemas = new PathToSchemasMap(); - expectedPathToSchemas.put(expectedPathToItem, expectedClasses); - Assert.assertEquals(pathToSchemas, expectedPathToSchemas); + @Throws(ValidationException::class) + fun testCorrectItemsSucceeds() { + val pathToItem = listOf("args[0]") + val validationMetadata = ValidationMetadata( + pathToItem, + SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()), + PathToSchemasMap(), + LinkedHashSet() + ) + val mutableList: MutableList = ArrayList() + mutableList.add("a") + val arg = FrozenList(mutableList) + val validator = ItemsValidator() + val pathToSchemas = validator.validate( + ValidationData( + ArrayWithItemsSchema(), + arg, + validationMetadata + ) + ) ?: throw RuntimeException("Invalid null value in pathToSchemas for this test case") + val expectedPathToItem: MutableList = ArrayList() + expectedPathToItem.add("args[0]") + expectedPathToItem.add(0) + val expectedClasses = LinkedHashMap, Nothing?>() + val schema = JsonSchemaFactory.getInstance(StringJsonSchema.StringJsonSchema1::class.java) + expectedClasses[schema] = null + val expectedPathToSchemas = PathToSchemasMap() + expectedPathToSchemas[expectedPathToItem] = expectedClasses + assertEquals(pathToSchemas, expectedPathToSchemas) } @Test - public void testNotApplicableTypeReturnsNull() throws ValidationException { - List pathToItem = List.of("args[0]"); - ValidationMetadata validationMetadata = new ValidationMetadata( - pathToItem, - new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().build()), - new PathToSchemasMap(), - new LinkedHashSet<>() - ); - final ItemsValidator validator = new ItemsValidator(); - PathToSchemasMap pathToSchemas = validator.validate( - new ValidationData( - new ArrayWithItemsSchema(), - 1, - validationMetadata - ) - ); - assertNull(pathToSchemas); + @Throws(ValidationException::class) + fun testNotApplicableTypeReturnsNull() { + val pathToItem = listOf("args[0]") + val validationMetadata = ValidationMetadata( + pathToItem, + SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()), + PathToSchemasMap(), + LinkedHashSet() + ) + val validator = ItemsValidator() + val pathToSchemas = validator.validate( + ValidationData( + ArrayWithItemsSchema(), + 1, + validationMetadata + ) + ) + assertNull(pathToSchemas) } @Test - public void testIncorrectItemFails() { - List pathToItem = List.of("args[0]"); - ValidationMetadata validationMetadata = new ValidationMetadata( - pathToItem, - new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().build()), - new PathToSchemasMap(), - new LinkedHashSet<>() - ); - List mutableList = new ArrayList<>(); - mutableList.add(1); - FrozenList arg = new FrozenList<>(mutableList); - final ItemsValidator validator = new ItemsValidator(); - Assert.assertThrows(ValidationException.class, () -> validator.validate( - new ValidationData( - new ArrayWithItemsSchema(), - arg, - validationMetadata + fun testIncorrectItemFails() { + val pathToItem = listOf("args[0]") + val validationMetadata = ValidationMetadata( + pathToItem, + SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()), + PathToSchemasMap(), + LinkedHashSet() + ) + val mutableList: MutableList = ArrayList() + mutableList.add(1) + val arg = FrozenList(mutableList) + val validator = ItemsValidator() + assertFailsWith( + block = { + validator.validate( + ValidationData( + ArrayWithItemsSchema(), + arg, + validationMetadata + ) ) - )); + } + ) } } \ No newline at end of file diff --git a/src/main/resources/kotlin/src/test/kotlin/packagename/schemas/validation/JsonSchemaTest.hbs b/src/main/resources/kotlin/src/test/kotlin/packagename/schemas/validation/JsonSchemaTest.hbs index fc7fb8732dd..3b57ceac66f 100644 --- a/src/main/resources/kotlin/src/test/kotlin/packagename/schemas/validation/JsonSchemaTest.hbs +++ b/src/main/resources/kotlin/src/test/kotlin/packagename/schemas/validation/JsonSchemaTest.hbs @@ -1,80 +1,71 @@ -package {{{packageName}}}.schemas.validation; +package {{{packageName}}}.schemas.validation -import org.checkerframework.checker.nullness.qual.Nullable; -import org.junit.Assert; -import org.junit.Test; -import {{{packageName}}}.configurations.JsonSchemaKeywordFlags; -import {{{packageName}}}.configurations.SchemaConfiguration; -import {{{packageName}}}.exceptions.ValidationException; +import {{{packageName}}}.configurations.JsonSchemaKeywordFlags +import {{{packageName}}}.configurations.SchemaConfiguration +import {{{packageName}}}.exceptions.ValidationException -import java.util.LinkedHashMap; -import java.util.LinkedHashSet; -import java.util.List; -import java.util.Set; +import kotlin.test.Test +import kotlin.test.assertEquals -sealed interface SomeSchemaBoxed permits SomeSchemaBoxedString {} -record SomeSchemaBoxedString() implements SomeSchemaBoxed {} - -public class JsonSchemaTest { - sealed interface SomeSchemaBoxed permits SomeSchemaBoxedString {} - record SomeSchemaBoxedString() implements SomeSchemaBoxed {} - - static class SomeSchema extends JsonSchema { - private static @Nullable SomeSchema instance = null; - protected SomeSchema() { - super(new JsonSchemaInfo() - .type(Set.of(String.class)) - ); - } - - public static SomeSchema getInstance() { - if (instance == null) { - instance = new SomeSchema(); +class JsonSchemaTest { + internal sealed interface SomeSchemaBoxed + internal class SomeSchemaBoxedString : SomeSchemaBoxed + internal class SomeSchema private constructor() : JsonSchema( + JsonSchemaInfo() + .type(setOf(String::class.java)) + ) { + override fun getNewInstance(arg: Any?, pathToItem: List, pathToSchemas: PathToSchemasMap): Any? { + if (arg is String) { + return arg } - return instance; + throw RuntimeException("Invalid input type=$javaClass. It can't be instantiated by this schema") } - @Override - public Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { - if (arg instanceof String) { - return arg; + @Throws(ValidationException::class) + override fun validate(arg: Any?, configuration: SchemaConfiguration?): Any? { + if (arg is String) { + return arg } - throw new RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); + throw ValidationException("Invalid input type=$javaClass. It can't be validated by this schema") } - @Override - public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { - if (arg instanceof String) { - return arg; - } - throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + @Throws(ValidationException::class) + override fun validateAndBox(arg: Any?, configuration: SchemaConfiguration?): SomeSchemaBoxed { + return SomeSchemaBoxedString() } - @Override - public SomeSchemaBoxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { - return new SomeSchemaBoxedString(); + companion object { + var instance: SomeSchema? = null + get() { + if (field == null) { + field = SomeSchema() + } + return field + } + private set } } @Test - public void testValidateSucceeds() throws ValidationException { - List pathToItem = List.of("args[0]"); - ValidationMetadata validationMetadata = new ValidationMetadata( - pathToItem, - new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().build()), - new PathToSchemasMap(), - new LinkedHashSet<>() - ); - SomeSchema schema = JsonSchemaFactory.getInstance(SomeSchema.class); - PathToSchemasMap pathToSchemas = JsonSchema.validate( - schema, - "hi", - validationMetadata - ); - PathToSchemasMap expectedPathToSchemas = new PathToSchemasMap(); - LinkedHashMap, Nothing?> validatedClasses = new LinkedHashMap<>(); - validatedClasses.put(schema, null); - expectedPathToSchemas.put(pathToItem, validatedClasses); - Assert.assertEquals(pathToSchemas, expectedPathToSchemas); + @Throws(ValidationException::class) + fun testValidateSucceeds() { + val pathToItem = listOf("args[0]") + val validationMetadata = ValidationMetadata( + pathToItem, + SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()), + PathToSchemasMap(), + LinkedHashSet() + ) + val schema = JsonSchemaFactory.getInstance(SomeSchema::class.java) + val pathToSchemas = JsonSchema.validate( + schema, + "hi", + validationMetadata + ) + val expectedPathToSchemas = PathToSchemasMap() + val validatedClasses = LinkedHashMap, Nothing?>() + validatedClasses[schema] = null + expectedPathToSchemas[pathToItem] = validatedClasses + assertEquals(pathToSchemas, expectedPathToSchemas) } } \ No newline at end of file diff --git a/src/main/resources/kotlin/src/test/kotlin/packagename/schemas/validation/PropertiesValidatorTest.hbs b/src/main/resources/kotlin/src/test/kotlin/packagename/schemas/validation/PropertiesValidatorTest.hbs index 73a89144e4a..7d577f00958 100644 --- a/src/main/resources/kotlin/src/test/kotlin/packagename/schemas/validation/PropertiesValidatorTest.hbs +++ b/src/main/resources/kotlin/src/test/kotlin/packagename/schemas/validation/PropertiesValidatorTest.hbs @@ -1,134 +1,123 @@ -package {{{packageName}}}.schemas.validation; +package {{{packageName}}}.schemas.validation -import org.checkerframework.checker.nullness.qual.Nullable; -import org.junit.Assert; -import org.junit.Test; -import {{{packageName}}}.configurations.JsonSchemaKeywordFlags; -import {{{packageName}}}.configurations.SchemaConfiguration; -import {{{packageName}}}.exceptions.ValidationException; -import {{{packageName}}}.schemas.StringJsonSchema; +import {{{packageName}}}.configurations.JsonSchemaKeywordFlags +import {{{packageName}}}.configurations.SchemaConfiguration +import {{{packageName}}}.exceptions.ValidationException +import {{{packageName}}}.schemas.StringJsonSchema -import java.util.ArrayList; -import java.util.LinkedHashMap; -import java.util.LinkedHashSet; -import java.util.List; -import java.util.Map; -import java.util.Set; +import kotlin.test.Test +import kotlin.test.assertEquals +import kotlin.test.assertNull +import kotlin.test.assertFailsWith -public class PropertiesValidatorTest { - public sealed interface ObjectWithPropsSchemaBoxed permits ObjectWithPropsSchemaBoxedMap {} - public record ObjectWithPropsSchemaBoxedMap() implements ObjectWithPropsSchemaBoxed {} - - public static class ObjectWithPropsSchema extends JsonSchema { - private ObjectWithPropsSchema() { - super(new JsonSchemaInfo() - .type(Set.of(Map.class)) - .properties(Map.ofEntries( - new PropertyEntry("someString", StringJsonSchema.StringJsonSchema1.class) - )) - ); - - } - - @Override - public Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { - if (arg instanceof Map mapArg) { - return getNewInstance(mapArg, pathToItem, pathToSchemas); +class PropertiesValidatorTest { + interface ObjectWithPropsSchemaBoxed + class ObjectWithPropsSchemaBoxedMap : ObjectWithPropsSchemaBoxed + class ObjectWithPropsSchema : JsonSchema( + JsonSchemaInfo() + .type(setOf(MutableMap::class.java)) + .properties( + mapOf( + "someString" to StringJsonSchema.StringJsonSchema1::class.java + ) + ) + ) { + override fun getNewInstance(arg: Any?, pathToItem: List, pathToSchemas: PathToSchemasMap): Any? { + if (arg is Map<*, *>) { + return getNewInstance(arg, pathToItem, pathToSchemas) } - throw new RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); + throw RuntimeException("Invalid input type=$javaClass. It can't be instantiated by this schema") } - @Override - public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { - if (arg instanceof Map mapArg) { - return validate(mapArg, configuration); + @Throws(ValidationException::class) + override fun validate(arg: Any?, configuration: SchemaConfiguration?): Any? { + if (arg is Map<*, *>) { + return validate(arg, configuration) } - throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw ValidationException("Invalid input type=$javaClass. It can't be validated by this schema") } - @Override - public ObjectWithPropsSchemaBoxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { - return new ObjectWithPropsSchemaBoxedMap(); + @Throws(ValidationException::class) + override fun validateAndBox(arg: Any?, configuration: SchemaConfiguration?): ObjectWithPropsSchemaBoxed { + return ObjectWithPropsSchemaBoxedMap() } } - @SuppressWarnings("nullness") - private void assertNull(@Nullable Object object) { - Assert.assertNull(object); - } - @Test - public void testCorrectPropertySucceeds() throws ValidationException { - final PropertiesValidator validator = new PropertiesValidator(); - List pathToItem = List.of("args[0]"); - ValidationMetadata validationMetadata = new ValidationMetadata( - pathToItem, - new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().build()), - new PathToSchemasMap(), - new LinkedHashSet<>() - ); - LinkedHashMap mutableMap = new LinkedHashMap<>(); - mutableMap.put("someString", "abc"); - FrozenMap arg = new FrozenMap<>(mutableMap); - PathToSchemasMap pathToSchemas = validator.validate( - new ValidationData( - new ObjectWithPropsSchema(), - arg, - validationMetadata - ) - ); - if (pathToSchemas == null) { - throw new RuntimeException("Invalid null value for pathToSchemas for this test case"); - } - List expectedPathToItem = new ArrayList<>(); - expectedPathToItem.add("args[0]"); - expectedPathToItem.add("someString"); - LinkedHashMap, Nothing?> expectedClasses = new LinkedHashMap<>(); - expectedClasses.put(JsonSchemaFactory.getInstance(StringJsonSchema.StringJsonSchema1.class), null); - PathToSchemasMap expectedPathToSchemas = new PathToSchemasMap(); - expectedPathToSchemas.put(expectedPathToItem, expectedClasses); - Assert.assertEquals(pathToSchemas, expectedPathToSchemas); + @Throws(ValidationException::class) + fun testCorrectPropertySucceeds() { + val validator = PropertiesValidator() + val pathToItem = listOf("args[0]") + val validationMetadata = ValidationMetadata( + pathToItem, + SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()), + PathToSchemasMap(), + LinkedHashSet() + ) + val mutableMap = LinkedHashMap() + mutableMap["someString"] = "abc" + val arg = FrozenMap(mutableMap) + val pathToSchemas = validator.validate( + ValidationData( + ObjectWithPropsSchema(), + arg, + validationMetadata + ) + ) ?: throw RuntimeException("Invalid null value for pathToSchemas for this test case") + val expectedPathToItem: MutableList = ArrayList() + expectedPathToItem.add("args[0]") + expectedPathToItem.add("someString") + val expectedClasses = LinkedHashMap, Nothing?>() + expectedClasses[JsonSchemaFactory.getInstance(StringJsonSchema.StringJsonSchema1::class.java)] = null + val expectedPathToSchemas = PathToSchemasMap() + expectedPathToSchemas[expectedPathToItem] = expectedClasses + assertEquals(pathToSchemas, expectedPathToSchemas) } @Test - public void testNotApplicableTypeReturnsNull() throws ValidationException { - final PropertiesValidator validator = new PropertiesValidator(); - List pathToItem = List.of("args[0]"); - ValidationMetadata validationMetadata = new ValidationMetadata( - pathToItem, - new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().build()), - new PathToSchemasMap(), - new LinkedHashSet<>() - ); - PathToSchemasMap pathToSchemas = validator.validate( - new ValidationData( - new ObjectWithPropsSchema(), - 1, - validationMetadata - ) - ); - assertNull(pathToSchemas); + @Throws(ValidationException::class) + fun testNotApplicableTypeReturnsNull() { + val validator = PropertiesValidator() + val pathToItem = listOf("args[0]") + val validationMetadata = ValidationMetadata( + pathToItem, + SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()), + PathToSchemasMap(), + LinkedHashSet() + ) + val pathToSchemas = validator.validate( + ValidationData( + ObjectWithPropsSchema(), + 1, + validationMetadata + ) + ) + assertNull(pathToSchemas) } @Test - public void testIncorrectPropertyValueFails() { - final PropertiesValidator validator = new PropertiesValidator(); - List pathToItem = List.of("args[0]"); - ValidationMetadata validationMetadata = new ValidationMetadata( - pathToItem, - new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().build()), - new PathToSchemasMap(), - new LinkedHashSet<>() - ); - LinkedHashMap mutableMap = new LinkedHashMap<>(); - mutableMap.put("someString", 1); - FrozenMap arg = new FrozenMap<>(mutableMap); - Assert.assertThrows(ValidationException.class, () -> validator.validate( - new ValidationData( - new ObjectWithPropsSchema(), - arg, - validationMetadata + fun testIncorrectPropertyValueFails() { + val validator = PropertiesValidator() + val pathToItem = listOf("args[0]") + val validationMetadata = ValidationMetadata( + pathToItem, + SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()), + PathToSchemasMap(), + LinkedHashSet() + ) + val mutableMap = LinkedHashMap() + mutableMap["someString"] = 1 + val arg = FrozenMap(mutableMap) + assertFailsWith( + block = { + validator.validate( + ValidationData( + ObjectWithPropsSchema(), + arg, + validationMetadata + ) ) - )); + } + ) } } \ No newline at end of file diff --git a/src/main/resources/kotlin/src/test/kotlin/packagename/schemas/validation/RequiredValidatorTest.hbs b/src/main/resources/kotlin/src/test/kotlin/packagename/schemas/validation/RequiredValidatorTest.hbs index c7846f7194d..57bc81a2a3f 100644 --- a/src/main/resources/kotlin/src/test/kotlin/packagename/schemas/validation/RequiredValidatorTest.hbs +++ b/src/main/resources/kotlin/src/test/kotlin/packagename/schemas/validation/RequiredValidatorTest.hbs @@ -1,120 +1,110 @@ -package {{{packageName}}}.schemas.validation; +package {{{packageName}}}.schemas.validation -import org.checkerframework.checker.nullness.qual.Nullable; -import org.junit.Assert; -import org.junit.Test; -import {{{packageName}}}.configurations.JsonSchemaKeywordFlags; -import {{{packageName}}}.configurations.SchemaConfiguration; -import {{{packageName}}}.exceptions.ValidationException; +import {{{packageName}}}.configurations.JsonSchemaKeywordFlags +import {{{packageName}}}.configurations.SchemaConfiguration +import {{{packageName}}}.exceptions.ValidationException -import java.util.LinkedHashMap; -import java.util.LinkedHashSet; -import java.util.List; -import java.util.Map; -import java.util.Set; +import kotlin.test.Test +import kotlin.test.assertFailsWith +import kotlin.test.assertNull -public class RequiredValidatorTest { - public sealed interface ObjectWithRequiredSchemaBoxed permits ObjectWithRequiredSchemaBoxedMap {} - public record ObjectWithRequiredSchemaBoxedMap() implements ObjectWithRequiredSchemaBoxed {} - - public static class ObjectWithRequiredSchema extends JsonSchema { - private ObjectWithRequiredSchema() { - super(new JsonSchemaInfo() - .type(Set.of(Map.class)) - .required(Set.of("someString")) - ); - - } - - @Override - public Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { - if (arg instanceof Map mapArg) { - return getNewInstance(mapArg, pathToItem, pathToSchemas); +class RequiredValidatorTest { + interface ObjectWithRequiredSchemaBoxed + class ObjectWithRequiredSchemaBoxedMap : ObjectWithRequiredSchemaBoxed + class ObjectWithRequiredSchema : JsonSchema( + JsonSchemaInfo() + .type(setOf(Map::class.java)) + .required(setOf("someString")) + ) { + override fun getNewInstance(arg: Any?, pathToItem: List, pathToSchemas: PathToSchemasMap): Any? { + if (arg is Map<*, *>) { + return getNewInstance(arg, pathToItem, pathToSchemas) } - throw new RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); + throw RuntimeException("Invalid input type=$javaClass. It can't be instantiated by this schema") } - @Override - public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { - if (arg instanceof Map mapArg) { - return validate(mapArg, configuration); + @Throws(ValidationException::class) + override fun validate(arg: Any?, configuration: SchemaConfiguration?): Any? { + if (arg is Map<*, *>) { + return validate(arg, configuration) } - throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw ValidationException("Invalid input type=$javaClass. It can't be validated by this schema") } - @Override - public ObjectWithRequiredSchemaBoxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { - return new ObjectWithRequiredSchemaBoxedMap(); + @Throws(ValidationException::class) + override fun validateAndBox(arg: Any?, configuration: SchemaConfiguration?): ObjectWithRequiredSchemaBoxed { + return ObjectWithRequiredSchemaBoxedMap() } } - @SuppressWarnings("nullness") - private void assertNull(@Nullable Object object) { - Assert.assertNull(object); - } - @Test - public void testCorrectPropertySucceeds() throws ValidationException { - List pathToItem = List.of("args[0]"); - ValidationMetadata validationMetadata = new ValidationMetadata( - pathToItem, - new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().build()), - new PathToSchemasMap(), - new LinkedHashSet<>() - ); - LinkedHashMap mutableMap = new LinkedHashMap<>(); - mutableMap.put("someString", "abc"); - FrozenMap arg = new FrozenMap<>(mutableMap); - final RequiredValidator validator = new RequiredValidator(); - PathToSchemasMap pathToSchemas = validator.validate( - new ValidationData( - new ObjectWithRequiredSchema(), - arg, - validationMetadata - ) - ); - assertNull(pathToSchemas); + @Throws(ValidationException::class) + fun testCorrectPropertySucceeds() { + val pathToItem = listOf("args[0]") + val validationMetadata = ValidationMetadata( + pathToItem, + SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()), + PathToSchemasMap(), + LinkedHashSet() + ) + val mutableMap = LinkedHashMap() + mutableMap["someString"] = "abc" + val arg = FrozenMap(mutableMap) + val validator = RequiredValidator() + val pathToSchemas = validator.validate( + ValidationData( + ObjectWithRequiredSchema(), + arg, + validationMetadata + ) + ) + assertNull(pathToSchemas) } @Test - public void testNotApplicableTypeReturnsNull() throws ValidationException { - List pathToItem = List.of("args[0]"); - ValidationMetadata validationMetadata = new ValidationMetadata( - pathToItem, - new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().build()), - new PathToSchemasMap(), - new LinkedHashSet<>() - ); - final RequiredValidator validator = new RequiredValidator(); - PathToSchemasMap pathToSchemas = validator.validate( - new ValidationData( - new ObjectWithRequiredSchema(), - 1, - validationMetadata - ) - ); - assertNull(pathToSchemas); + @Throws(ValidationException::class) + fun testNotApplicableTypeReturnsNull() { + val pathToItem = listOf("args[0]") + val validationMetadata = ValidationMetadata( + pathToItem, + SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()), + PathToSchemasMap(), + LinkedHashSet() + ) + val validator = RequiredValidator() + val pathToSchemas = validator.validate( + ValidationData( + ObjectWithRequiredSchema(), + 1, + validationMetadata + ) + ) + assertNull(pathToSchemas) } @Test - public void testIncorrectPropertyFails() { - List pathToItem = List.of("args[0]"); - ValidationMetadata validationMetadata = new ValidationMetadata( - pathToItem, - new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().build()), - new PathToSchemasMap(), - new LinkedHashSet<>() - ); - LinkedHashMap mutableMap = new LinkedHashMap<>(); - mutableMap.put("aDifferentProp", 1); - FrozenMap arg = new FrozenMap<>(mutableMap); - final RequiredValidator validator = new RequiredValidator(); - Assert.assertThrows(ValidationException.class, () -> validator.validate( - new ValidationData( - new ObjectWithRequiredSchema(), - arg, - validationMetadata + fun testIncorrectPropertyFails() { + val pathToItem = listOf("args[0]") + val validationMetadata = ValidationMetadata( + pathToItem, + SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()), + PathToSchemasMap(), + LinkedHashSet() + ) + val mutableMap = LinkedHashMap() + mutableMap["aDifferentProp"] = 1 + val arg = FrozenMap(mutableMap) + val validator = RequiredValidator() + assertFailsWith( + block = { + validator.validate( + ValidationData( + ObjectWithRequiredSchema(), + arg, + validationMetadata + ) ) - )); + } + ) } } \ No newline at end of file diff --git a/src/main/resources/kotlin/src/test/kotlin/packagename/schemas/validation/TypeValidatorTest.hbs b/src/main/resources/kotlin/src/test/kotlin/packagename/schemas/validation/TypeValidatorTest.hbs index 62a150dfae4..eaf57b8a5d7 100644 --- a/src/main/resources/kotlin/src/test/kotlin/packagename/schemas/validation/TypeValidatorTest.hbs +++ b/src/main/resources/kotlin/src/test/kotlin/packagename/schemas/validation/TypeValidatorTest.hbs @@ -1,56 +1,54 @@ -package {{{packageName}}}.schemas.validation; +package {{{packageName}}}.schemas.validation -import org.checkerframework.checker.nullness.qual.Nullable; -import org.junit.Assert; -import org.junit.Test; -import {{{packageName}}}.configurations.JsonSchemaKeywordFlags; -import {{{packageName}}}.configurations.SchemaConfiguration; -import {{{packageName}}}.exceptions.ValidationException; -import {{{packageName}}}.schemas.StringJsonSchema; +import {{{packageName}}}.configurations.JsonSchemaKeywordFlags +import {{{packageName}}}.configurations.SchemaConfiguration +import {{{packageName}}}.exceptions.ValidationException +import {{{packageName}}}.schemas.StringJsonSchema -import java.util.ArrayList; -import java.util.LinkedHashSet; - -public class TypeValidatorTest { - @SuppressWarnings("nullness") - private void assertNull(@Nullable Object object) { - Assert.assertNull(object); - } +import kotlin.test.Test +import kotlin.test.assertFailsWith +import kotlin.test.assertNull +class TypeValidatorTest { @Test - public void testValidateSucceeds() throws ValidationException { - final TypeValidator validator = new TypeValidator(); - ValidationMetadata validationMetadata = new ValidationMetadata( - new ArrayList<>(), - new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().build()), - new PathToSchemasMap(), - new LinkedHashSet<>() - ); - @Nullable PathToSchemasMap pathToSchemasMap = validator.validate( - new ValidationData( - StringJsonSchema.StringJsonSchema1.getInstance(), - "hi", - validationMetadata - ) - ); - assertNull(pathToSchemasMap); + @Throws(ValidationException::class) + fun testValidateSucceeds() { + val validator = TypeValidator() + val validationMetadata = ValidationMetadata( + ArrayList(), + SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()), + PathToSchemasMap(), + LinkedHashSet() + ) + val pathToSchemasMap = validator.validate( + ValidationData( + StringJsonSchema.StringJsonSchema1.getInstance(), + "hi", + validationMetadata + ) + ) + assertNull(pathToSchemasMap) } @Test - public void testValidateFailsIntIsNotString() { - final TypeValidator validator = new TypeValidator(); - ValidationMetadata validationMetadata = new ValidationMetadata( - new ArrayList<>(), - new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().build()), - new PathToSchemasMap(), - new LinkedHashSet<>() - ); - Assert.assertThrows(ValidationException.class, () -> validator.validate( - new ValidationData( - StringJsonSchema.StringJsonSchema1.getInstance(), - 1, - validationMetadata + fun testValidateFailsIntIsNotString() { + val validator = TypeValidator() + val validationMetadata = ValidationMetadata( + ArrayList(), + SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()), + PathToSchemasMap(), + LinkedHashSet() + ) + assertFailsWith( + block = { + validator.validate( + ValidationData( + StringJsonSchema.StringJsonSchema1.getInstance(), + 1, + validationMetadata + ) ) - )); + } + ) } } \ No newline at end of file From bea0ee4763d744ee6e11cf7350263992c85c3aa6 Mon Sep 17 00:00:00 2001 From: Justin Black Date: Fri, 17 May 2024 15:22:09 -0700 Subject: [PATCH 59/78] Samples and docs regen --- docs/generators/kotlin.md | 3 +++ samples/client/3_0_3_unit_test/kotlin/build.gradle.kts | 2 +- .../codegen/generators/JavaClientGenerator.java | 6 ++---- 3 files changed, 6 insertions(+), 5 deletions(-) diff --git a/docs/generators/kotlin.md b/docs/generators/kotlin.md index d8cf5fac87d..763d5c79063 100644 --- a/docs/generators/kotlin.md +++ b/docs/generators/kotlin.md @@ -70,7 +70,10 @@ These options may be applied as additional-properties (cli) or configOptions (pl
  • Double
  • Float
  • Int
  • +
  • List
  • Long
  • +
  • Map
  • +
  • Nothing
  • String
  • diff --git a/samples/client/3_0_3_unit_test/kotlin/build.gradle.kts b/samples/client/3_0_3_unit_test/kotlin/build.gradle.kts index 0f8b6b3945c..bb4941552b0 100644 --- a/samples/client/3_0_3_unit_test/kotlin/build.gradle.kts +++ b/samples/client/3_0_3_unit_test/kotlin/build.gradle.kts @@ -36,4 +36,4 @@ tasks.test { testLogging { events( "started", "passed", "skipped", "failed") } -} \ No newline at end of file +} diff --git a/src/main/java/org/openapijsonschematools/codegen/generators/JavaClientGenerator.java b/src/main/java/org/openapijsonschematools/codegen/generators/JavaClientGenerator.java index 701358347fd..1f8e62834e6 100644 --- a/src/main/java/org/openapijsonschematools/codegen/generators/JavaClientGenerator.java +++ b/src/main/java/org/openapijsonschematools/codegen/generators/JavaClientGenerator.java @@ -133,10 +133,8 @@ public JavaClientGenerator(GeneratorSettings generatorSettings, WorkflowSettings cliOptions.add(new CliOption(CodegenConstants.SOURCE_FOLDER, CodegenConstants.SOURCE_FOLDER_DESC).defaultValue(this.getSourceFolder())); CliOption buildTool = CliOption.newString(CodegenConstants.BUILD_TOOL, CodegenConstants.BUILD_TOOL_DESC); Map buildToolOptions = new LinkedHashMap<>(); - buildToolOptions.putAll(Map.of( - mavenBuildTool, "Use maven", - gradleBuildTool, "Use gradle" - )); + buildToolOptions.put(mavenBuildTool, "Use maven"); + buildToolOptions.put(gradleBuildTool, "Use gradle"); buildTool.setEnum(buildToolOptions); buildTool.setDefault(mavenBuildTool); cliOptions.add(buildTool); From 458928f6b1b9e9a91f215ae3324881c0bd396b2e Mon Sep 17 00:00:00 2001 From: Justin Black Date: Fri, 17 May 2024 15:29:51 -0700 Subject: [PATCH 60/78] Kotlin 310 sample gen --- .../kotlin_3_1_0_unit_test.yaml | 6 + .../client/3_1_0_unit_test/kotlin/.gitignore | 9 + .../kotlin/.openapi-generator-ignore | 23 + .../kotlin/.openapi-generator/FILES | 560 ++++ .../kotlin/.openapi-generator/VERSION | 1 + .../client/3_1_0_unit_test/kotlin/README.md | 280 ++ .../3_1_0_unit_test/kotlin/build.gradle.kts | 39 + .../kotlin/docs/RootServerInfo.md | 59 + .../schemas/ASchemaGivenForPrefixitems.md | 286 ++ .../AdditionalItemsAreAllowedByDefault.md | 248 ++ ...AdditionalpropertiesAreAllowedByDefault.md | 496 +++ .../AdditionalpropertiesCanExistByItself.md | 159 + ...ionalpropertiesDoesNotLookInApplicators.md | 578 ++++ ...pertiesWithNullValuedInstanceProperties.md | 159 + .../schemas/AdditionalpropertiesWithSchema.md | 446 +++ .../kotlin/docs/components/schemas/Allof.md | 674 ++++ .../schemas/AllofCombinedWithAnyofOneof.md | 636 ++++ .../components/schemas/AllofSimpleTypes.md | 479 +++ .../components/schemas/AllofWithBaseSchema.md | 770 +++++ .../schemas/AllofWithOneEmptySchema.md | 302 ++ .../schemas/AllofWithTheFirstEmptySchema.md | 340 ++ .../schemas/AllofWithTheLastEmptySchema.md | 340 ++ .../schemas/AllofWithTwoEmptySchemas.md | 435 +++ .../kotlin/docs/components/schemas/Anyof.md | 362 +++ .../components/schemas/AnyofComplexTypes.md | 674 ++++ .../components/schemas/AnyofWithBaseSchema.md | 394 +++ .../schemas/AnyofWithOneEmptySchema.md | 340 ++ .../schemas/ArrayTypeMatchesArrays.md | 52 + .../schemas/BooleanTypeMatchesBooleans.md | 52 + .../kotlin/docs/components/schemas/ByInt.md | 169 + .../docs/components/schemas/ByNumber.md | 169 + .../docs/components/schemas/BySmallNumber.md | 169 + .../schemas/ConstNulCharactersInStrings.md | 182 ++ .../schemas/ContainsKeywordValidation.md | 324 ++ .../ContainsWithNullInstanceElements.md | 207 ++ .../docs/components/schemas/DateFormat.md | 169 + .../docs/components/schemas/DateTimeFormat.md | 169 + ...chemasDependenciesWithEscapedCharacters.md | 545 ++++ ...sDependentSubschemaIncompatibleWithRoot.md | 732 +++++ .../DependentSchemasSingleDependency.md | 451 +++ .../docs/components/schemas/DurationFormat.md | 169 + .../docs/components/schemas/EmailFormat.md | 169 + .../components/schemas/EmptyDependents.md | 176 + .../schemas/EnumWith0DoesNotMatchFalse.md | 133 + .../schemas/EnumWith1DoesNotMatchTrue.md | 133 + .../schemas/EnumWithEscapedCharacters.md | 99 + .../schemas/EnumWithFalseDoesNotMatch0.md | 98 + .../schemas/EnumWithTrueDoesNotMatch1.md | 98 + .../components/schemas/EnumsInProperties.md | 320 ++ .../schemas/ExclusivemaximumValidation.md | 169 + .../schemas/ExclusiveminimumValidation.md | 169 + .../components/schemas/FloatDivisionInf.md | 85 + .../components/schemas/ForbiddenProperty.md | 508 +++ .../docs/components/schemas/HostnameFormat.md | 169 + .../docs/components/schemas/IdnEmailFormat.md | 169 + .../components/schemas/IdnHostnameFormat.md | 169 + .../schemas/IfAndElseWithoutThen.md | 480 +++ .../schemas/IfAndThenWithoutElse.md | 480 +++ ...WhenSerializedKeywordProcessingSequence.md | 661 ++++ .../components/schemas/IgnoreElseWithoutIf.md | 337 ++ .../schemas/IgnoreIfWithoutThenOrElse.md | 337 ++ .../components/schemas/IgnoreThenWithoutIf.md | 337 ++ .../schemas/IntegerTypeMatchesIntegers.md | 52 + .../docs/components/schemas/Ipv4Format.md | 169 + .../docs/components/schemas/Ipv6Format.md | 169 + .../docs/components/schemas/IriFormat.md | 169 + .../components/schemas/IriReferenceFormat.md | 169 + .../docs/components/schemas/ItemsContains.md | 438 +++ .../ItemsDoesNotLookInApplicatorsValidCase.md | 282 ++ .../schemas/ItemsWithNullInstanceElements.md | 159 + .../components/schemas/JsonPointerFormat.md | 169 + .../MaxcontainsWithoutContainsIsIgnored.md | 169 + .../components/schemas/MaximumValidation.md | 169 + .../MaximumValidationWithUnsignedInteger.md | 169 + .../components/schemas/MaxitemsValidation.md | 169 + .../components/schemas/MaxlengthValidation.md | 169 + .../Maxproperties0MeansTheObjectIsEmpty.md | 169 + .../schemas/MaxpropertiesValidation.md | 169 + .../MincontainsWithoutContainsIsIgnored.md | 169 + .../components/schemas/MinimumValidation.md | 169 + .../MinimumValidationWithSignedInteger.md | 169 + .../components/schemas/MinitemsValidation.md | 169 + .../components/schemas/MinlengthValidation.md | 169 + .../schemas/MinpropertiesValidation.md | 169 + .../schemas/MultipleDependentsRequired.md | 178 + ...multaneousPatternpropertiesAreValidated.md | 362 +++ .../MultipleTypesCanBeSpecifiedInAnArray.md | 111 + .../NestedAllofToCheckValidationSemantics.md | 362 +++ .../NestedAnyofToCheckValidationSemantics.md | 362 +++ .../docs/components/schemas/NestedItems.md | 492 +++ .../NestedOneofToCheckValidationSemantics.md | 362 +++ ...NonAsciiPatternWithAdditionalproperties.md | 384 +++ .../NonInterferenceAcrossCombinedSchemas.md | 1099 +++++++ .../kotlin/docs/components/schemas/Not.md | 207 ++ .../schemas/NotMoreComplexSchema.md | 324 ++ .../components/schemas/NotMultipleTypes.md | 266 ++ .../schemas/NulCharactersInStrings.md | 98 + .../NullTypeMatchesOnlyTheNullObject.md | 52 + .../schemas/NumberTypeMatchesNumbers.md | 52 + .../schemas/ObjectPropertiesValidation.md | 293 ++ .../schemas/ObjectTypeMatchesObjects.md | 52 + .../kotlin/docs/components/schemas/Oneof.md | 362 +++ .../components/schemas/OneofComplexTypes.md | 674 ++++ .../components/schemas/OneofWithBaseSchema.md | 394 +++ .../schemas/OneofWithEmptySchema.md | 340 ++ .../components/schemas/OneofWithRequired.md | 617 ++++ .../schemas/PatternIsNotAnchored.md | 169 + .../components/schemas/PatternValidation.md | 169 + ...ertiesValidatesPropertiesMatchingARegex.md | 207 ++ ...pertiesWithNullValuedInstanceProperties.md | 207 ++ ...lidationAdjustsTheStartingIndexForItems.md | 202 ++ .../PrefixitemsWithNullInstanceElements.md | 248 ++ ...opertiesAdditionalpropertiesInteraction.md | 408 +++ ...seNamesAreJavascriptObjectPropertyNames.md | 539 +++ .../PropertiesWithEscapedCharacters.md | 463 +++ ...pertiesWithNullValuedInstanceProperties.md | 250 ++ .../PropertyNamedRefThatIsNotAReference.md | 250 ++ .../schemas/PropertynamesValidation.md | 239 ++ .../docs/components/schemas/RegexFormat.md | 169 + ...NotAnchoredByDefaultAndAreCaseSensitive.md | 245 ++ .../schemas/RelativeJsonPointerFormat.md | 169 + .../schemas/RequiredDefaultValidation.md | 353 ++ ...seNamesAreJavascriptObjectPropertyNames.md | 425 +++ .../components/schemas/RequiredValidation.md | 512 +++ .../schemas/RequiredWithEmptyArray.md | 353 ++ .../schemas/RequiredWithEscapedCharacters.md | 2884 +++++++++++++++++ .../schemas/SimpleEnumValidation.md | 141 + .../components/schemas/SingleDependency.md | 177 + .../schemas/SmallMultipleOfLargeInteger.md | 85 + .../schemas/StringTypeMatchesStrings.md | 52 + .../docs/components/schemas/TimeFormat.md | 169 + .../schemas/TypeArrayObjectOrNull.md | 125 + .../components/schemas/TypeArrayOrObject.md | 81 + .../schemas/TypeAsArrayWithOneItem.md | 52 + .../schemas/UnevaluateditemsAsSchema.md | 207 ++ ...teditemsDependsOnMultipleNestedContains.md | 945 ++++++ .../schemas/UnevaluateditemsWithItems.md | 201 ++ ...nevaluateditemsWithNullInstanceElements.md | 207 ++ ...tedpropertiesNotAffectedByPropertynames.md | 278 ++ .../schemas/UnevaluatedpropertiesSchema.md | 131 + ...pertiesWithAdjacentAdditionalproperties.md | 437 +++ ...pertiesWithNullValuedInstanceProperties.md | 207 ++ .../schemas/UniqueitemsFalseValidation.md | 169 + .../UniqueitemsFalseWithAnArrayOfItems.md | 287 ++ .../schemas/UniqueitemsValidation.md | 169 + .../schemas/UniqueitemsWithAnArrayOfItems.md | 287 ++ .../docs/components/schemas/UriFormat.md | 169 + .../components/schemas/UriReferenceFormat.md | 169 + .../components/schemas/UriTemplateFormat.md | 169 + .../docs/components/schemas/UuidFormat.md | 169 + .../ValidateAgainstCorrectBranchThenVsElse.md | 636 ++++ .../kotlin/docs/servers/RootServer0.md | 17 + .../kotlin/settings.gradle.kts | 2 + .../client/RootServerInfo.kt | 20 + .../schemas/ASchemaGivenForPrefixitems.kt | 408 +++ .../AdditionalItemsAreAllowedByDefault.kt | 393 +++ ...AdditionalpropertiesAreAllowedByDefault.kt | 518 +++ .../AdditionalpropertiesCanExistByItself.kt | 183 ++ ...ionalpropertiesDoesNotLookInApplicators.kt | 787 +++++ ...pertiesWithNullValuedInstanceProperties.kt | 178 + .../schemas/AdditionalpropertiesWithSchema.kt | 351 ++ .../client/components/schemas/Allof.kt | 1060 ++++++ .../schemas/AllofCombinedWithAnyofOneof.kt | 1142 +++++++ .../components/schemas/AllofSimpleTypes.kt | 861 +++++ .../components/schemas/AllofWithBaseSchema.kt | 1151 +++++++ .../schemas/AllofWithOneEmptySchema.kt | 324 ++ .../schemas/AllofWithTheFirstEmptySchema.kt | 339 ++ .../schemas/AllofWithTheLastEmptySchema.kt | 339 ++ .../schemas/AllofWithTwoEmptySchemas.kt | 338 ++ .../client/components/schemas/Anyof.kt | 600 ++++ .../components/schemas/AnyofComplexTypes.kt | 1060 ++++++ .../components/schemas/AnyofWithBaseSchema.kt | 653 ++++ .../schemas/AnyofWithOneEmptySchema.kt | 339 ++ .../schemas/ArrayTypeMatchesArrays.kt | 21 + .../schemas/BooleanTypeMatchesBooleans.kt | 20 + .../client/components/schemas/ByInt.kt | 309 ++ .../client/components/schemas/ByNumber.kt | 309 ++ .../components/schemas/BySmallNumber.kt | 309 ++ .../schemas/ConstNulCharactersInStrings.kt | 318 ++ .../schemas/ContainsKeywordValidation.kt | 583 ++++ .../ContainsWithNullInstanceElements.kt | 322 ++ .../client/components/schemas/DateFormat.kt | 308 ++ .../components/schemas/DateTimeFormat.kt | 308 ++ ...chemasDependenciesWithEscapedCharacters.kt | 975 ++++++ ...sDependentSubschemaIncompatibleWithRoot.kt | 655 ++++ .../DependentSchemasSingleDependency.kt | 747 +++++ .../components/schemas/DurationFormat.kt | 308 ++ .../client/components/schemas/EmailFormat.kt | 308 ++ .../components/schemas/EmptyDependents.kt | 316 ++ .../schemas/EnumWith0DoesNotMatchFalse.kt | 173 + .../schemas/EnumWith1DoesNotMatchTrue.kt | 173 + .../schemas/EnumWithEscapedCharacters.kt | 106 + .../schemas/EnumWithFalseDoesNotMatch0.kt | 102 + .../schemas/EnumWithTrueDoesNotMatch1.kt | 102 + .../components/schemas/EnumsInProperties.kt | 394 +++ .../schemas/ExclusivemaximumValidation.kt | 308 ++ .../schemas/ExclusiveminimumValidation.kt | 308 ++ .../components/schemas/FloatDivisionInf.kt | 112 + .../components/schemas/ForbiddenProperty.kt | 710 ++++ .../components/schemas/HostnameFormat.kt | 308 ++ .../components/schemas/IdnEmailFormat.kt | 308 ++ .../components/schemas/IdnHostnameFormat.kt | 308 ++ .../schemas/IfAndElseWithoutThen.kt | 860 +++++ .../schemas/IfAndThenWithoutElse.kt | 859 +++++ ...WhenSerializedKeywordProcessingSequence.kt | 1153 +++++++ .../components/schemas/IgnoreElseWithoutIf.kt | 593 ++++ .../schemas/IgnoreIfWithoutThenOrElse.kt | 593 ++++ .../components/schemas/IgnoreThenWithoutIf.kt | 593 ++++ .../schemas/IntegerTypeMatchesIntegers.kt | 20 + .../client/components/schemas/Ipv4Format.kt | 308 ++ .../client/components/schemas/Ipv6Format.kt | 308 ++ .../client/components/schemas/IriFormat.kt | 308 ++ .../components/schemas/IriReferenceFormat.kt | 308 ++ .../components/schemas/ItemsContains.kt | 737 +++++ .../ItemsDoesNotLookInApplicatorsValidCase.kt | 460 +++ .../schemas/ItemsWithNullInstanceElements.kt | 150 + .../components/schemas/JsonPointerFormat.kt | 308 ++ .../MaxcontainsWithoutContainsIsIgnored.kt | 308 ++ .../components/schemas/MaximumValidation.kt | 308 ++ .../MaximumValidationWithUnsignedInteger.kt | 308 ++ .../components/schemas/MaxitemsValidation.kt | 308 ++ .../components/schemas/MaxlengthValidation.kt | 308 ++ .../Maxproperties0MeansTheObjectIsEmpty.kt | 308 ++ .../schemas/MaxpropertiesValidation.kt | 308 ++ .../MincontainsWithoutContainsIsIgnored.kt | 308 ++ .../components/schemas/MinimumValidation.kt | 308 ++ .../MinimumValidationWithSignedInteger.kt | 308 ++ .../components/schemas/MinitemsValidation.kt | 308 ++ .../components/schemas/MinlengthValidation.kt | 308 ++ .../schemas/MinpropertiesValidation.kt | 308 ++ .../schemas/MultipleDependentsRequired.kt | 318 ++ ...multaneousPatternpropertiesAreValidated.kt | 602 ++++ .../MultipleTypesCanBeSpecifiedInAnArray.kt | 139 + .../NestedAllofToCheckValidationSemantics.kt | 601 ++++ .../NestedAnyofToCheckValidationSemantics.kt | 601 ++++ .../client/components/schemas/NestedItems.kt | 510 +++ .../NestedOneofToCheckValidationSemantics.kt | 601 ++++ ...NonAsciiPatternWithAdditionalproperties.kt | 169 + .../NonInterferenceAcrossCombinedSchemas.kt | 1963 +++++++++++ .../client/components/schemas/Not.kt | 322 ++ .../schemas/NotMoreComplexSchema.kt | 478 +++ .../components/schemas/NotMultipleTypes.kt | 426 +++ .../schemas/NulCharactersInStrings.kt | 104 + .../NullTypeMatchesOnlyTheNullObject.kt | 20 + .../schemas/NumberTypeMatchesNumbers.kt | 20 + .../schemas/ObjectPropertiesValidation.kt | 453 +++ .../schemas/ObjectTypeMatchesObjects.kt | 21 + .../client/components/schemas/Oneof.kt | 600 ++++ .../components/schemas/OneofComplexTypes.kt | 1060 ++++++ .../components/schemas/OneofWithBaseSchema.kt | 653 ++++ .../schemas/OneofWithEmptySchema.kt | 339 ++ .../components/schemas/OneofWithRequired.kt | 1096 +++++++ .../schemas/PatternIsNotAnchored.kt | 311 ++ .../components/schemas/PatternValidation.kt | 311 ++ ...ertiesValidatesPropertiesMatchingARegex.kt | 326 ++ ...pertiesWithNullValuedInstanceProperties.kt | 326 ++ ...lidationAdjustsTheStartingIndexForItems.kt | 187 ++ .../PrefixitemsWithNullInstanceElements.kt | 393 +++ ...opertiesAdditionalpropertiesInteraction.kt | 654 ++++ ...seNamesAreJavascriptObjectPropertyNames.kt | 883 +++++ .../PropertiesWithEscapedCharacters.kt | 640 ++++ ...pertiesWithNullValuedInstanceProperties.kt | 393 +++ .../PropertyNamedRefThatIsNotAReference.kt | 382 +++ .../schemas/PropertynamesValidation.kt | 375 +++ .../client/components/schemas/RegexFormat.kt | 308 ++ ...NotAnchoredByDefaultAndAreCaseSensitive.kt | 341 ++ .../schemas/RelativeJsonPointerFormat.kt | 308 ++ .../schemas/RequiredDefaultValidation.kt | 435 +++ ...seNamesAreJavascriptObjectPropertyNames.kt | 623 ++++ .../components/schemas/RequiredValidation.kt | 531 +++ .../schemas/RequiredWithEmptyArray.kt | 435 +++ .../schemas/RequiredWithEscapedCharacters.kt | 1677 ++++++++++ .../schemas/SimpleEnumValidation.kt | 183 ++ .../components/schemas/SingleDependency.kt | 317 ++ .../schemas/SmallMultipleOfLargeInteger.kt | 112 + .../schemas/StringTypeMatchesStrings.kt | 20 + .../client/components/schemas/TimeFormat.kt | 308 ++ .../schemas/TypeArrayObjectOrNull.kt | 186 ++ .../components/schemas/TypeArrayOrObject.kt | 157 + .../schemas/TypeAsArrayWithOneItem.kt | 20 + .../schemas/UnevaluateditemsAsSchema.kt | 322 ++ ...teditemsDependsOnMultipleNestedContains.kt | 1688 ++++++++++ .../schemas/UnevaluateditemsWithItems.kt | 180 + ...nevaluateditemsWithNullInstanceElements.kt | 322 ++ ...tedpropertiesNotAffectedByPropertynames.kt | 390 +++ .../schemas/UnevaluatedpropertiesSchema.kt | 177 + ...pertiesWithAdjacentAdditionalproperties.kt | 302 ++ ...pertiesWithNullValuedInstanceProperties.kt | 322 ++ .../schemas/UniqueitemsFalseValidation.kt | 308 ++ .../UniqueitemsFalseWithAnArrayOfItems.kt | 408 +++ .../schemas/UniqueitemsValidation.kt | 308 ++ .../schemas/UniqueitemsWithAnArrayOfItems.kt | 408 +++ .../client/components/schemas/UriFormat.kt | 308 ++ .../components/schemas/UriReferenceFormat.kt | 308 ++ .../components/schemas/UriTemplateFormat.kt | 308 ++ .../client/components/schemas/UuidFormat.kt | 308 ++ .../ValidateAgainstCorrectBranchThenVsElse.kt | 1136 +++++++ .../configurations/JsonSchemaKeywordFlags.kt | 446 +++ .../configurations/SchemaConfiguration.kt | 3 + .../client/exceptions/BaseException.kt | 3 + .../InvalidAdditionalPropertyException.kt | 3 + .../exceptions/UnsetPropertyException.kt | 3 + .../client/exceptions/ValidationException.kt | 3 + .../client/schemas/AnyTypeJsonSchema.kt | 358 ++ .../client/schemas/BooleanJsonSchema.kt | 78 + .../client/schemas/DateJsonSchema.kt | 87 + .../client/schemas/DateTimeJsonSchema.kt | 87 + .../client/schemas/DecimalJsonSchema.kt | 78 + .../client/schemas/DoubleJsonSchema.kt | 88 + .../client/schemas/FloatJsonSchema.kt | 86 + .../client/schemas/GenericBuilder.kt | 9 + .../client/schemas/Int32JsonSchema.kt | 93 + .../client/schemas/Int64JsonSchema.kt | 105 + .../client/schemas/IntJsonSchema.kt | 105 + .../client/schemas/ListJsonSchema.kt | 98 + .../client/schemas/MapJsonSchema.kt | 98 + .../client/schemas/NotAnyTypeJsonSchema.kt | 379 +++ .../client/schemas/NullJsonSchema.kt | 77 + .../client/schemas/NumberJsonSchema.kt | 104 + .../client/schemas/StringJsonSchema.kt | 111 + .../client/schemas/UnsetAddPropsSetter.kt | 81 + .../client/schemas/UuidJsonSchema.kt | 87 + .../AdditionalPropertiesValidator.kt | 49 + .../schemas/validation/AllOfValidator.kt | 19 + .../schemas/validation/AnyOfValidator.kt | 39 + .../schemas/validation/BigDecimalValidator.kt | 32 + .../validation/BooleanEnumValidator.kt | 9 + .../validation/BooleanSchemaValidator.kt | 12 + .../schemas/validation/BooleanValueMethod.kt | 5 + .../schemas/validation/ConstValidator.kt | 31 + .../schemas/validation/ContainsValidator.kt | 27 + .../schemas/validation/CustomIsoparser.kt | 16 + .../schemas/validation/DefaultValueMethod.kt | 8 + .../validation/DependentRequiredValidator.kt | 36 + .../validation/DependentSchemasValidator.kt | 31 + .../schemas/validation/DoubleEnumValidator.kt | 9 + .../schemas/validation/DoubleValueMethod.kt | 5 + .../schemas/validation/ElseValidator.kt | 25 + .../schemas/validation/EnumValidator.kt | 39 + .../validation/ExclusiveMaximumValidator.kt | 43 + .../validation/ExclusiveMinimumValidator.kt | 43 + .../schemas/validation/FloatEnumValidator.kt | 9 + .../schemas/validation/FloatValueMethod.kt | 5 + .../schemas/validation/FormatValidator.kt | 168 + .../client/schemas/validation/FrozenList.kt | 22 + .../client/schemas/validation/FrozenMap.kt | 44 + .../client/schemas/validation/IfValidator.kt | 26 + .../validation/IntegerEnumValidator.kt | 9 + .../schemas/validation/IntegerValueMethod.kt | 5 + .../schemas/validation/ItemsValidator.kt | 38 + .../client/schemas/validation/JsonSchema.kt | 512 +++ .../schemas/validation/JsonSchemaFactory.kt | 30 + .../schemas/validation/JsonSchemaInfo.kt | 244 ++ .../client/schemas/validation/KeywordEntry.kt | 6 + .../schemas/validation/KeywordValidator.kt | 10 + .../schemas/validation/LengthValidator.kt | 16 + .../schemas/validation/ListSchemaValidator.kt | 15 + .../schemas/validation/LongEnumValidator.kt | 9 + .../schemas/validation/LongValueMethod.kt | 5 + .../schemas/validation/MapSchemaValidator.kt | 15 + .../client/schemas/validation/MapUtils.kt | 35 + .../validation/MaxContainsValidator.kt | 25 + .../schemas/validation/MaxItemsValidator.kt | 19 + .../schemas/validation/MaxLengthValidator.kt | 20 + .../validation/MaxPropertiesValidator.kt | 19 + .../schemas/validation/MaximumValidator.kt | 42 + .../validation/MinContainsValidator.kt | 27 + .../schemas/validation/MinItemsValidator.kt | 19 + .../schemas/validation/MinLengthValidator.kt | 20 + .../validation/MinPropertiesValidator.kt | 19 + .../schemas/validation/MinimumValidator.kt | 42 + .../schemas/validation/MultipleOfValidator.kt | 23 + .../client/schemas/validation/NotValidator.kt | 25 + .../schemas/validation/NullEnumValidator.kt | 9 + .../schemas/validation/NullSchemaValidator.kt | 12 + .../schemas/validation/NullValueMethod.kt | 5 + .../validation/NumberSchemaValidator.kt | 12 + .../schemas/validation/OneOfValidator.kt | 45 + .../schemas/validation/PathToSchemasMap.kt | 13 + .../validation/PatternPropertiesValidator.kt | 15 + .../schemas/validation/PatternValidator.kt | 21 + .../validation/PrefixItemsValidator.kt | 35 + .../schemas/validation/PropertiesValidator.kt | 44 + .../validation/PropertyNamesValidator.kt | 29 + .../schemas/validation/RequiredValidator.kt | 32 + .../schemas/validation/StringEnumValidator.kt | 9 + .../validation/StringSchemaValidator.kt | 12 + .../schemas/validation/StringValueMethod.kt | 5 + .../schemas/validation/ThenValidator.kt | 26 + .../schemas/validation/TypeValidator.kt | 51 + .../validation/UnevaluatedItemsValidator.kt | 41 + .../UnevaluatedPropertiesValidator.kt | 36 + .../validation/UniqueItemsValidator.kt | 27 + .../validation/UnsetAnyTypeJsonSchema.kt | 336 ++ .../schemas/validation/ValidationData.kt | 11 + .../schemas/validation/ValidationMetadata.kt | 18 + .../client/servers/RootServer0.kt | 6 + .../client/servers/Server.kt | 5 + .../client/servers/ServerProvider.kt | 6 + .../client/servers/ServerWithVariables.kt | 20 + .../client/servers/ServerWithoutVariables.kt | 8 + .../schemas/ASchemaGivenForPrefixitemsTest.kt | 110 + .../AdditionalItemsAreAllowedByDefaultTest.kt | 31 + ...tionalpropertiesAreAllowedByDefaultTest.kt | 37 + ...dditionalpropertiesCanExistByItselfTest.kt | 48 + ...lpropertiesDoesNotLookInApplicatorsTest.kt | 37 + ...iesWithNullValuedInstancePropertiesTest.kt | 29 + .../AdditionalpropertiesWithSchemaTest.kt | 79 + .../AllofCombinedWithAnyofOneofTest.kt | 122 + .../schemas/AllofSimpleTypesTest.kt | 38 + .../client/components/schemas/AllofTest.kt | 94 + .../schemas/AllofWithBaseSchemaTest.kt | 125 + .../schemas/AllofWithOneEmptySchemaTest.kt | 24 + .../AllofWithTheFirstEmptySchemaTest.kt | 38 + .../AllofWithTheLastEmptySchemaTest.kt | 38 + .../schemas/AllofWithTwoEmptySchemasTest.kt | 24 + .../schemas/AnyofComplexTypesTest.kt | 86 + .../client/components/schemas/AnyofTest.kt | 58 + .../schemas/AnyofWithBaseSchemaTest.kt | 52 + .../schemas/AnyofWithOneEmptySchemaTest.kt | 34 + .../schemas/ArrayTypeMatchesArraysTest.kt | 110 + .../schemas/BooleanTypeMatchesBooleansTest.kt | 148 + .../client/components/schemas/ByIntTest.kt | 48 + .../client/components/schemas/ByNumberTest.kt | 48 + .../components/schemas/BySmallNumberTest.kt | 38 + .../ConstNulCharactersInStringsTest.kt | 38 + .../schemas/ContainsKeywordValidationTest.kt | 101 + .../ContainsWithNullInstanceElementsTest.kt | 26 + .../components/schemas/DateFormatTest.kt | 86 + .../components/schemas/DateTimeFormatTest.kt | 86 + ...asDependenciesWithEscapedCharactersTest.kt | 107 + ...endentSubschemaIncompatibleWithRootTest.kt | 86 + .../DependentSchemasSingleDependencyTest.kt | 149 + .../components/schemas/DurationFormatTest.kt | 86 + .../components/schemas/EmailFormatTest.kt | 86 + .../components/schemas/EmptyDependentsTest.kt | 50 + .../schemas/EnumWith0DoesNotMatchFalseTest.kt | 48 + .../schemas/EnumWith1DoesNotMatchTrueTest.kt | 48 + .../schemas/EnumWithEscapedCharactersTest.kt | 48 + .../schemas/EnumWithFalseDoesNotMatch0Test.kt | 52 + .../schemas/EnumWithTrueDoesNotMatch1Test.kt | 52 + .../schemas/EnumsInPropertiesTest.kt | 128 + .../schemas/ExclusivemaximumValidationTest.kt | 62 + .../schemas/ExclusiveminimumValidationTest.kt | 62 + .../schemas/FloatDivisionInfTest.kt | 28 + .../schemas/ForbiddenPropertyTest.kt | 56 + .../components/schemas/HostnameFormatTest.kt | 86 + .../components/schemas/IdnEmailFormatTest.kt | 86 + .../schemas/IdnHostnameFormatTest.kt | 86 + .../schemas/IfAndElseWithoutThenTest.kt | 48 + .../schemas/IfAndThenWithoutElseTest.kt | 48 + ...SerializedKeywordProcessingSequenceTest.kt | 62 + .../schemas/IgnoreElseWithoutIfTest.kt | 34 + .../schemas/IgnoreIfWithoutThenOrElseTest.kt | 34 + .../schemas/IgnoreThenWithoutIfTest.kt | 34 + .../schemas/IntegerTypeMatchesIntegersTest.kt | 134 + .../components/schemas/Ipv4FormatTest.kt | 86 + .../components/schemas/Ipv6FormatTest.kt | 86 + .../components/schemas/IriFormatTest.kt | 86 + .../schemas/IriReferenceFormatTest.kt | 86 + .../components/schemas/ItemsContainsTest.kt | 82 + ...msDoesNotLookInApplicatorsValidCaseTest.kt | 46 + .../ItemsWithNullInstanceElementsTest.kt | 27 + .../schemas/JsonPointerFormatTest.kt | 86 + ...MaxcontainsWithoutContainsIsIgnoredTest.kt | 39 + .../schemas/MaximumValidationTest.kt | 58 + ...aximumValidationWithUnsignedIntegerTest.kt | 58 + .../schemas/MaxitemsValidationTest.kt | 67 + .../schemas/MaxlengthValidationTest.kt | 68 + ...Maxproperties0MeansTheObjectIsEmptyTest.kt | 44 + .../schemas/MaxpropertiesValidationTest.kt | 109 + ...MincontainsWithoutContainsIsIgnoredTest.kt | 37 + .../schemas/MinimumValidationTest.kt | 58 + .../MinimumValidationWithSignedIntegerTest.kt | 92 + .../schemas/MinitemsValidationTest.kt | 64 + .../schemas/MinlengthValidationTest.kt | 72 + .../schemas/MinpropertiesValidationTest.kt | 94 + .../schemas/MultipleDependentsRequiredTest.kt | 132 + ...aneousPatternpropertiesAreValidatedTest.kt | 124 + ...ultipleTypesCanBeSpecifiedInAnArrayTest.kt | 106 + ...stedAllofToCheckValidationSemanticsTest.kt | 38 + ...stedAnyofToCheckValidationSemanticsTest.kt | 38 + .../components/schemas/NestedItemsTest.kt | 137 + ...stedOneofToCheckValidationSemanticsTest.kt | 38 + ...sciiPatternWithAdditionalpropertiesTest.kt | 48 + ...onInterferenceAcrossCombinedSchemasTest.kt | 34 + .../schemas/NotMoreComplexSchemaTest.kt | 58 + .../schemas/NotMultipleTypesTest.kt | 52 + .../client/components/schemas/NotTest.kt | 38 + .../schemas/NulCharactersInStringsTest.kt | 38 + .../NullTypeMatchesOnlyTheNullObjectTest.kt | 152 + .../schemas/NumberTypeMatchesNumbersTest.kt | 130 + .../schemas/ObjectPropertiesValidationTest.kt | 119 + .../schemas/ObjectTypeMatchesObjectsTest.kt | 110 + .../schemas/OneofComplexTypesTest.kt | 90 + .../client/components/schemas/OneofTest.kt | 62 + .../schemas/OneofWithBaseSchemaTest.kt | 52 + .../schemas/OneofWithEmptySchemaTest.kt | 38 + .../schemas/OneofWithRequiredTest.kt | 98 + .../schemas/PatternIsNotAnchoredTest.kt | 24 + .../schemas/PatternValidationTest.kt | 100 + ...esValidatesPropertiesMatchingARegexTest.kt | 126 + ...iesWithNullValuedInstancePropertiesTest.kt | 29 + ...tionAdjustsTheStartingIndexForItemsTest.kt | 48 + ...PrefixitemsWithNullInstanceElementsTest.kt | 27 + ...tiesAdditionalpropertiesInteractionTest.kt | 164 + ...mesAreJavascriptObjectPropertyNamesTest.kt | 141 + .../PropertiesWithEscapedCharactersTest.kt | 88 + ...iesWithNullValuedInstancePropertiesTest.kt | 29 + ...PropertyNamedRefThatIsNotAReferenceTest.kt | 48 + .../schemas/PropertynamesValidationTest.kt | 106 + .../components/schemas/RegexFormatTest.kt | 86 + ...nchoredByDefaultAndAreCaseSensitiveTest.kt | 82 + .../schemas/RelativeJsonPointerFormatTest.kt | 86 + .../schemas/RequiredDefaultValidationTest.kt | 25 + ...mesAreJavascriptObjectPropertyNamesTest.kt | 145 + .../schemas/RequiredValidationTest.kt | 79 + .../schemas/RequiredWithEmptyArrayTest.kt | 25 + .../RequiredWithEscapedCharactersTest.kt | 72 + .../schemas/SimpleEnumValidationTest.kt | 38 + .../schemas/SingleDependencyTest.kt | 110 + .../SmallMultipleOfLargeIntegerTest.kt | 24 + .../schemas/StringTypeMatchesStringsTest.kt | 130 + .../components/schemas/TimeFormatTest.kt | 86 + .../schemas/TypeArrayObjectOrNullTest.kt | 81 + .../schemas/TypeArrayOrObjectTest.kt | 85 + .../schemas/TypeAsArrayWithOneItemTest.kt | 38 + .../schemas/UnevaluateditemsAsSchemaTest.kt | 53 + ...temsDependsOnMultipleNestedContainsTest.kt | 50 + .../schemas/UnevaluateditemsWithItemsTest.kt | 51 + ...luateditemsWithNullInstanceElementsTest.kt | 26 + ...ropertiesNotAffectedByPropertynamesTest.kt | 48 + .../UnevaluatedpropertiesSchemaTest.kt | 59 + ...iesWithAdjacentAdditionalpropertiesTest.kt | 48 + ...iesWithNullValuedInstancePropertiesTest.kt | 29 + .../schemas/UniqueitemsFalseValidationTest.kt | 312 ++ .../UniqueitemsFalseWithAnArrayOfItemsTest.kt | 150 + .../schemas/UniqueitemsValidationTest.kt | 612 ++++ .../UniqueitemsWithAnArrayOfItemsTest.kt | 154 + .../components/schemas/UriFormatTest.kt | 86 + .../schemas/UriReferenceFormatTest.kt | 86 + .../schemas/UriTemplateFormatTest.kt | 86 + .../components/schemas/UuidFormatTest.kt | 86 + ...idateAgainstCorrectBranchThenVsElseTest.kt | 62 + .../JsonSchemaKeywordFlagsTest.kt | 141 + .../client/schemas/AnyTypeSchemaTest.kt | 113 + .../client/schemas/ArrayTypeSchemaTest.kt | 251 ++ .../client/schemas/BooleanSchemaTest.kt | 53 + .../client/schemas/ListBuilderTest.kt | 55 + .../client/schemas/ListSchemaTest.kt | 49 + .../client/schemas/MapSchemaTest.kt | 50 + .../client/schemas/NullSchemaTest.kt | 46 + .../client/schemas/NumberSchemaTest.kt | 66 + .../client/schemas/ObjectTypeSchemaTest.kt | 569 ++++ .../client/schemas/RefBooleanSchemaTest.kt | 67 + .../AdditionalPropertiesValidatorTest.kt | 140 + .../schemas/validation/CustomIsoparserTest.kt | 25 + .../schemas/validation/FormatValidatorTest.kt | 418 +++ .../schemas/validation/ItemsValidatorTest.kt | 120 + .../schemas/validation/JsonSchemaTest.kt | 71 + .../validation/PropertiesValidatorTest.kt | 123 + .../validation/RequiredValidatorTest.kt | 110 + .../schemas/validation/TypeValidatorTest.kt | 54 + 563 files changed, 124451 insertions(+) create mode 100644 bin/generate_samples_configs/kotlin_3_1_0_unit_test.yaml create mode 100644 samples/client/3_1_0_unit_test/kotlin/.gitignore create mode 100644 samples/client/3_1_0_unit_test/kotlin/.openapi-generator-ignore create mode 100644 samples/client/3_1_0_unit_test/kotlin/.openapi-generator/FILES create mode 100644 samples/client/3_1_0_unit_test/kotlin/.openapi-generator/VERSION create mode 100644 samples/client/3_1_0_unit_test/kotlin/README.md create mode 100644 samples/client/3_1_0_unit_test/kotlin/build.gradle.kts create mode 100644 samples/client/3_1_0_unit_test/kotlin/docs/RootServerInfo.md create mode 100644 samples/client/3_1_0_unit_test/kotlin/docs/components/schemas/ASchemaGivenForPrefixitems.md create mode 100644 samples/client/3_1_0_unit_test/kotlin/docs/components/schemas/AdditionalItemsAreAllowedByDefault.md create mode 100644 samples/client/3_1_0_unit_test/kotlin/docs/components/schemas/AdditionalpropertiesAreAllowedByDefault.md create mode 100644 samples/client/3_1_0_unit_test/kotlin/docs/components/schemas/AdditionalpropertiesCanExistByItself.md create mode 100644 samples/client/3_1_0_unit_test/kotlin/docs/components/schemas/AdditionalpropertiesDoesNotLookInApplicators.md create mode 100644 samples/client/3_1_0_unit_test/kotlin/docs/components/schemas/AdditionalpropertiesWithNullValuedInstanceProperties.md create mode 100644 samples/client/3_1_0_unit_test/kotlin/docs/components/schemas/AdditionalpropertiesWithSchema.md create mode 100644 samples/client/3_1_0_unit_test/kotlin/docs/components/schemas/Allof.md create mode 100644 samples/client/3_1_0_unit_test/kotlin/docs/components/schemas/AllofCombinedWithAnyofOneof.md create mode 100644 samples/client/3_1_0_unit_test/kotlin/docs/components/schemas/AllofSimpleTypes.md create mode 100644 samples/client/3_1_0_unit_test/kotlin/docs/components/schemas/AllofWithBaseSchema.md create mode 100644 samples/client/3_1_0_unit_test/kotlin/docs/components/schemas/AllofWithOneEmptySchema.md create mode 100644 samples/client/3_1_0_unit_test/kotlin/docs/components/schemas/AllofWithTheFirstEmptySchema.md create mode 100644 samples/client/3_1_0_unit_test/kotlin/docs/components/schemas/AllofWithTheLastEmptySchema.md create mode 100644 samples/client/3_1_0_unit_test/kotlin/docs/components/schemas/AllofWithTwoEmptySchemas.md create mode 100644 samples/client/3_1_0_unit_test/kotlin/docs/components/schemas/Anyof.md create mode 100644 samples/client/3_1_0_unit_test/kotlin/docs/components/schemas/AnyofComplexTypes.md create mode 100644 samples/client/3_1_0_unit_test/kotlin/docs/components/schemas/AnyofWithBaseSchema.md create mode 100644 samples/client/3_1_0_unit_test/kotlin/docs/components/schemas/AnyofWithOneEmptySchema.md create mode 100644 samples/client/3_1_0_unit_test/kotlin/docs/components/schemas/ArrayTypeMatchesArrays.md create mode 100644 samples/client/3_1_0_unit_test/kotlin/docs/components/schemas/BooleanTypeMatchesBooleans.md create mode 100644 samples/client/3_1_0_unit_test/kotlin/docs/components/schemas/ByInt.md create mode 100644 samples/client/3_1_0_unit_test/kotlin/docs/components/schemas/ByNumber.md create mode 100644 samples/client/3_1_0_unit_test/kotlin/docs/components/schemas/BySmallNumber.md create mode 100644 samples/client/3_1_0_unit_test/kotlin/docs/components/schemas/ConstNulCharactersInStrings.md create mode 100644 samples/client/3_1_0_unit_test/kotlin/docs/components/schemas/ContainsKeywordValidation.md create mode 100644 samples/client/3_1_0_unit_test/kotlin/docs/components/schemas/ContainsWithNullInstanceElements.md create mode 100644 samples/client/3_1_0_unit_test/kotlin/docs/components/schemas/DateFormat.md create mode 100644 samples/client/3_1_0_unit_test/kotlin/docs/components/schemas/DateTimeFormat.md create mode 100644 samples/client/3_1_0_unit_test/kotlin/docs/components/schemas/DependentSchemasDependenciesWithEscapedCharacters.md create mode 100644 samples/client/3_1_0_unit_test/kotlin/docs/components/schemas/DependentSchemasDependentSubschemaIncompatibleWithRoot.md create mode 100644 samples/client/3_1_0_unit_test/kotlin/docs/components/schemas/DependentSchemasSingleDependency.md create mode 100644 samples/client/3_1_0_unit_test/kotlin/docs/components/schemas/DurationFormat.md create mode 100644 samples/client/3_1_0_unit_test/kotlin/docs/components/schemas/EmailFormat.md create mode 100644 samples/client/3_1_0_unit_test/kotlin/docs/components/schemas/EmptyDependents.md create mode 100644 samples/client/3_1_0_unit_test/kotlin/docs/components/schemas/EnumWith0DoesNotMatchFalse.md create mode 100644 samples/client/3_1_0_unit_test/kotlin/docs/components/schemas/EnumWith1DoesNotMatchTrue.md create mode 100644 samples/client/3_1_0_unit_test/kotlin/docs/components/schemas/EnumWithEscapedCharacters.md create mode 100644 samples/client/3_1_0_unit_test/kotlin/docs/components/schemas/EnumWithFalseDoesNotMatch0.md create mode 100644 samples/client/3_1_0_unit_test/kotlin/docs/components/schemas/EnumWithTrueDoesNotMatch1.md create mode 100644 samples/client/3_1_0_unit_test/kotlin/docs/components/schemas/EnumsInProperties.md create mode 100644 samples/client/3_1_0_unit_test/kotlin/docs/components/schemas/ExclusivemaximumValidation.md create mode 100644 samples/client/3_1_0_unit_test/kotlin/docs/components/schemas/ExclusiveminimumValidation.md create mode 100644 samples/client/3_1_0_unit_test/kotlin/docs/components/schemas/FloatDivisionInf.md create mode 100644 samples/client/3_1_0_unit_test/kotlin/docs/components/schemas/ForbiddenProperty.md create mode 100644 samples/client/3_1_0_unit_test/kotlin/docs/components/schemas/HostnameFormat.md create mode 100644 samples/client/3_1_0_unit_test/kotlin/docs/components/schemas/IdnEmailFormat.md create mode 100644 samples/client/3_1_0_unit_test/kotlin/docs/components/schemas/IdnHostnameFormat.md create mode 100644 samples/client/3_1_0_unit_test/kotlin/docs/components/schemas/IfAndElseWithoutThen.md create mode 100644 samples/client/3_1_0_unit_test/kotlin/docs/components/schemas/IfAndThenWithoutElse.md create mode 100644 samples/client/3_1_0_unit_test/kotlin/docs/components/schemas/IfAppearsAtTheEndWhenSerializedKeywordProcessingSequence.md create mode 100644 samples/client/3_1_0_unit_test/kotlin/docs/components/schemas/IgnoreElseWithoutIf.md create mode 100644 samples/client/3_1_0_unit_test/kotlin/docs/components/schemas/IgnoreIfWithoutThenOrElse.md create mode 100644 samples/client/3_1_0_unit_test/kotlin/docs/components/schemas/IgnoreThenWithoutIf.md create mode 100644 samples/client/3_1_0_unit_test/kotlin/docs/components/schemas/IntegerTypeMatchesIntegers.md create mode 100644 samples/client/3_1_0_unit_test/kotlin/docs/components/schemas/Ipv4Format.md create mode 100644 samples/client/3_1_0_unit_test/kotlin/docs/components/schemas/Ipv6Format.md create mode 100644 samples/client/3_1_0_unit_test/kotlin/docs/components/schemas/IriFormat.md create mode 100644 samples/client/3_1_0_unit_test/kotlin/docs/components/schemas/IriReferenceFormat.md create mode 100644 samples/client/3_1_0_unit_test/kotlin/docs/components/schemas/ItemsContains.md create mode 100644 samples/client/3_1_0_unit_test/kotlin/docs/components/schemas/ItemsDoesNotLookInApplicatorsValidCase.md create mode 100644 samples/client/3_1_0_unit_test/kotlin/docs/components/schemas/ItemsWithNullInstanceElements.md create mode 100644 samples/client/3_1_0_unit_test/kotlin/docs/components/schemas/JsonPointerFormat.md create mode 100644 samples/client/3_1_0_unit_test/kotlin/docs/components/schemas/MaxcontainsWithoutContainsIsIgnored.md create mode 100644 samples/client/3_1_0_unit_test/kotlin/docs/components/schemas/MaximumValidation.md create mode 100644 samples/client/3_1_0_unit_test/kotlin/docs/components/schemas/MaximumValidationWithUnsignedInteger.md create mode 100644 samples/client/3_1_0_unit_test/kotlin/docs/components/schemas/MaxitemsValidation.md create mode 100644 samples/client/3_1_0_unit_test/kotlin/docs/components/schemas/MaxlengthValidation.md create mode 100644 samples/client/3_1_0_unit_test/kotlin/docs/components/schemas/Maxproperties0MeansTheObjectIsEmpty.md create mode 100644 samples/client/3_1_0_unit_test/kotlin/docs/components/schemas/MaxpropertiesValidation.md create mode 100644 samples/client/3_1_0_unit_test/kotlin/docs/components/schemas/MincontainsWithoutContainsIsIgnored.md create mode 100644 samples/client/3_1_0_unit_test/kotlin/docs/components/schemas/MinimumValidation.md create mode 100644 samples/client/3_1_0_unit_test/kotlin/docs/components/schemas/MinimumValidationWithSignedInteger.md create mode 100644 samples/client/3_1_0_unit_test/kotlin/docs/components/schemas/MinitemsValidation.md create mode 100644 samples/client/3_1_0_unit_test/kotlin/docs/components/schemas/MinlengthValidation.md create mode 100644 samples/client/3_1_0_unit_test/kotlin/docs/components/schemas/MinpropertiesValidation.md create mode 100644 samples/client/3_1_0_unit_test/kotlin/docs/components/schemas/MultipleDependentsRequired.md create mode 100644 samples/client/3_1_0_unit_test/kotlin/docs/components/schemas/MultipleSimultaneousPatternpropertiesAreValidated.md create mode 100644 samples/client/3_1_0_unit_test/kotlin/docs/components/schemas/MultipleTypesCanBeSpecifiedInAnArray.md create mode 100644 samples/client/3_1_0_unit_test/kotlin/docs/components/schemas/NestedAllofToCheckValidationSemantics.md create mode 100644 samples/client/3_1_0_unit_test/kotlin/docs/components/schemas/NestedAnyofToCheckValidationSemantics.md create mode 100644 samples/client/3_1_0_unit_test/kotlin/docs/components/schemas/NestedItems.md create mode 100644 samples/client/3_1_0_unit_test/kotlin/docs/components/schemas/NestedOneofToCheckValidationSemantics.md create mode 100644 samples/client/3_1_0_unit_test/kotlin/docs/components/schemas/NonAsciiPatternWithAdditionalproperties.md create mode 100644 samples/client/3_1_0_unit_test/kotlin/docs/components/schemas/NonInterferenceAcrossCombinedSchemas.md create mode 100644 samples/client/3_1_0_unit_test/kotlin/docs/components/schemas/Not.md create mode 100644 samples/client/3_1_0_unit_test/kotlin/docs/components/schemas/NotMoreComplexSchema.md create mode 100644 samples/client/3_1_0_unit_test/kotlin/docs/components/schemas/NotMultipleTypes.md create mode 100644 samples/client/3_1_0_unit_test/kotlin/docs/components/schemas/NulCharactersInStrings.md create mode 100644 samples/client/3_1_0_unit_test/kotlin/docs/components/schemas/NullTypeMatchesOnlyTheNullObject.md create mode 100644 samples/client/3_1_0_unit_test/kotlin/docs/components/schemas/NumberTypeMatchesNumbers.md create mode 100644 samples/client/3_1_0_unit_test/kotlin/docs/components/schemas/ObjectPropertiesValidation.md create mode 100644 samples/client/3_1_0_unit_test/kotlin/docs/components/schemas/ObjectTypeMatchesObjects.md create mode 100644 samples/client/3_1_0_unit_test/kotlin/docs/components/schemas/Oneof.md create mode 100644 samples/client/3_1_0_unit_test/kotlin/docs/components/schemas/OneofComplexTypes.md create mode 100644 samples/client/3_1_0_unit_test/kotlin/docs/components/schemas/OneofWithBaseSchema.md create mode 100644 samples/client/3_1_0_unit_test/kotlin/docs/components/schemas/OneofWithEmptySchema.md create mode 100644 samples/client/3_1_0_unit_test/kotlin/docs/components/schemas/OneofWithRequired.md create mode 100644 samples/client/3_1_0_unit_test/kotlin/docs/components/schemas/PatternIsNotAnchored.md create mode 100644 samples/client/3_1_0_unit_test/kotlin/docs/components/schemas/PatternValidation.md create mode 100644 samples/client/3_1_0_unit_test/kotlin/docs/components/schemas/PatternpropertiesValidatesPropertiesMatchingARegex.md create mode 100644 samples/client/3_1_0_unit_test/kotlin/docs/components/schemas/PatternpropertiesWithNullValuedInstanceProperties.md create mode 100644 samples/client/3_1_0_unit_test/kotlin/docs/components/schemas/PrefixitemsValidationAdjustsTheStartingIndexForItems.md create mode 100644 samples/client/3_1_0_unit_test/kotlin/docs/components/schemas/PrefixitemsWithNullInstanceElements.md create mode 100644 samples/client/3_1_0_unit_test/kotlin/docs/components/schemas/PropertiesPatternpropertiesAdditionalpropertiesInteraction.md create mode 100644 samples/client/3_1_0_unit_test/kotlin/docs/components/schemas/PropertiesWhoseNamesAreJavascriptObjectPropertyNames.md create mode 100644 samples/client/3_1_0_unit_test/kotlin/docs/components/schemas/PropertiesWithEscapedCharacters.md create mode 100644 samples/client/3_1_0_unit_test/kotlin/docs/components/schemas/PropertiesWithNullValuedInstanceProperties.md create mode 100644 samples/client/3_1_0_unit_test/kotlin/docs/components/schemas/PropertyNamedRefThatIsNotAReference.md create mode 100644 samples/client/3_1_0_unit_test/kotlin/docs/components/schemas/PropertynamesValidation.md create mode 100644 samples/client/3_1_0_unit_test/kotlin/docs/components/schemas/RegexFormat.md create mode 100644 samples/client/3_1_0_unit_test/kotlin/docs/components/schemas/RegexesAreNotAnchoredByDefaultAndAreCaseSensitive.md create mode 100644 samples/client/3_1_0_unit_test/kotlin/docs/components/schemas/RelativeJsonPointerFormat.md create mode 100644 samples/client/3_1_0_unit_test/kotlin/docs/components/schemas/RequiredDefaultValidation.md create mode 100644 samples/client/3_1_0_unit_test/kotlin/docs/components/schemas/RequiredPropertiesWhoseNamesAreJavascriptObjectPropertyNames.md create mode 100644 samples/client/3_1_0_unit_test/kotlin/docs/components/schemas/RequiredValidation.md create mode 100644 samples/client/3_1_0_unit_test/kotlin/docs/components/schemas/RequiredWithEmptyArray.md create mode 100644 samples/client/3_1_0_unit_test/kotlin/docs/components/schemas/RequiredWithEscapedCharacters.md create mode 100644 samples/client/3_1_0_unit_test/kotlin/docs/components/schemas/SimpleEnumValidation.md create mode 100644 samples/client/3_1_0_unit_test/kotlin/docs/components/schemas/SingleDependency.md create mode 100644 samples/client/3_1_0_unit_test/kotlin/docs/components/schemas/SmallMultipleOfLargeInteger.md create mode 100644 samples/client/3_1_0_unit_test/kotlin/docs/components/schemas/StringTypeMatchesStrings.md create mode 100644 samples/client/3_1_0_unit_test/kotlin/docs/components/schemas/TimeFormat.md create mode 100644 samples/client/3_1_0_unit_test/kotlin/docs/components/schemas/TypeArrayObjectOrNull.md create mode 100644 samples/client/3_1_0_unit_test/kotlin/docs/components/schemas/TypeArrayOrObject.md create mode 100644 samples/client/3_1_0_unit_test/kotlin/docs/components/schemas/TypeAsArrayWithOneItem.md create mode 100644 samples/client/3_1_0_unit_test/kotlin/docs/components/schemas/UnevaluateditemsAsSchema.md create mode 100644 samples/client/3_1_0_unit_test/kotlin/docs/components/schemas/UnevaluateditemsDependsOnMultipleNestedContains.md create mode 100644 samples/client/3_1_0_unit_test/kotlin/docs/components/schemas/UnevaluateditemsWithItems.md create mode 100644 samples/client/3_1_0_unit_test/kotlin/docs/components/schemas/UnevaluateditemsWithNullInstanceElements.md create mode 100644 samples/client/3_1_0_unit_test/kotlin/docs/components/schemas/UnevaluatedpropertiesNotAffectedByPropertynames.md create mode 100644 samples/client/3_1_0_unit_test/kotlin/docs/components/schemas/UnevaluatedpropertiesSchema.md create mode 100644 samples/client/3_1_0_unit_test/kotlin/docs/components/schemas/UnevaluatedpropertiesWithAdjacentAdditionalproperties.md create mode 100644 samples/client/3_1_0_unit_test/kotlin/docs/components/schemas/UnevaluatedpropertiesWithNullValuedInstanceProperties.md create mode 100644 samples/client/3_1_0_unit_test/kotlin/docs/components/schemas/UniqueitemsFalseValidation.md create mode 100644 samples/client/3_1_0_unit_test/kotlin/docs/components/schemas/UniqueitemsFalseWithAnArrayOfItems.md create mode 100644 samples/client/3_1_0_unit_test/kotlin/docs/components/schemas/UniqueitemsValidation.md create mode 100644 samples/client/3_1_0_unit_test/kotlin/docs/components/schemas/UniqueitemsWithAnArrayOfItems.md create mode 100644 samples/client/3_1_0_unit_test/kotlin/docs/components/schemas/UriFormat.md create mode 100644 samples/client/3_1_0_unit_test/kotlin/docs/components/schemas/UriReferenceFormat.md create mode 100644 samples/client/3_1_0_unit_test/kotlin/docs/components/schemas/UriTemplateFormat.md create mode 100644 samples/client/3_1_0_unit_test/kotlin/docs/components/schemas/UuidFormat.md create mode 100644 samples/client/3_1_0_unit_test/kotlin/docs/components/schemas/ValidateAgainstCorrectBranchThenVsElse.md create mode 100644 samples/client/3_1_0_unit_test/kotlin/docs/servers/RootServer0.md create mode 100644 samples/client/3_1_0_unit_test/kotlin/settings.gradle.kts create mode 100644 samples/client/3_1_0_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/RootServerInfo.kt create mode 100644 samples/client/3_1_0_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/schemas/ASchemaGivenForPrefixitems.kt create mode 100644 samples/client/3_1_0_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/schemas/AdditionalItemsAreAllowedByDefault.kt create mode 100644 samples/client/3_1_0_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/schemas/AdditionalpropertiesAreAllowedByDefault.kt create mode 100644 samples/client/3_1_0_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/schemas/AdditionalpropertiesCanExistByItself.kt create mode 100644 samples/client/3_1_0_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/schemas/AdditionalpropertiesDoesNotLookInApplicators.kt create mode 100644 samples/client/3_1_0_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/schemas/AdditionalpropertiesWithNullValuedInstanceProperties.kt create mode 100644 samples/client/3_1_0_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/schemas/AdditionalpropertiesWithSchema.kt create mode 100644 samples/client/3_1_0_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/schemas/Allof.kt create mode 100644 samples/client/3_1_0_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/schemas/AllofCombinedWithAnyofOneof.kt create mode 100644 samples/client/3_1_0_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/schemas/AllofSimpleTypes.kt create mode 100644 samples/client/3_1_0_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/schemas/AllofWithBaseSchema.kt create mode 100644 samples/client/3_1_0_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/schemas/AllofWithOneEmptySchema.kt create mode 100644 samples/client/3_1_0_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/schemas/AllofWithTheFirstEmptySchema.kt create mode 100644 samples/client/3_1_0_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/schemas/AllofWithTheLastEmptySchema.kt create mode 100644 samples/client/3_1_0_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/schemas/AllofWithTwoEmptySchemas.kt create mode 100644 samples/client/3_1_0_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/schemas/Anyof.kt create mode 100644 samples/client/3_1_0_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/schemas/AnyofComplexTypes.kt create mode 100644 samples/client/3_1_0_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/schemas/AnyofWithBaseSchema.kt create mode 100644 samples/client/3_1_0_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/schemas/AnyofWithOneEmptySchema.kt create mode 100644 samples/client/3_1_0_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/schemas/ArrayTypeMatchesArrays.kt create mode 100644 samples/client/3_1_0_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/schemas/BooleanTypeMatchesBooleans.kt create mode 100644 samples/client/3_1_0_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/schemas/ByInt.kt create mode 100644 samples/client/3_1_0_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/schemas/ByNumber.kt create mode 100644 samples/client/3_1_0_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/schemas/BySmallNumber.kt create mode 100644 samples/client/3_1_0_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/schemas/ConstNulCharactersInStrings.kt create mode 100644 samples/client/3_1_0_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/schemas/ContainsKeywordValidation.kt create mode 100644 samples/client/3_1_0_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/schemas/ContainsWithNullInstanceElements.kt create mode 100644 samples/client/3_1_0_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/schemas/DateFormat.kt create mode 100644 samples/client/3_1_0_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/schemas/DateTimeFormat.kt create mode 100644 samples/client/3_1_0_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/schemas/DependentSchemasDependenciesWithEscapedCharacters.kt create mode 100644 samples/client/3_1_0_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/schemas/DependentSchemasDependentSubschemaIncompatibleWithRoot.kt create mode 100644 samples/client/3_1_0_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/schemas/DependentSchemasSingleDependency.kt create mode 100644 samples/client/3_1_0_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/schemas/DurationFormat.kt create mode 100644 samples/client/3_1_0_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/schemas/EmailFormat.kt create mode 100644 samples/client/3_1_0_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/schemas/EmptyDependents.kt create mode 100644 samples/client/3_1_0_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/schemas/EnumWith0DoesNotMatchFalse.kt create mode 100644 samples/client/3_1_0_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/schemas/EnumWith1DoesNotMatchTrue.kt create mode 100644 samples/client/3_1_0_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/schemas/EnumWithEscapedCharacters.kt create mode 100644 samples/client/3_1_0_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/schemas/EnumWithFalseDoesNotMatch0.kt create mode 100644 samples/client/3_1_0_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/schemas/EnumWithTrueDoesNotMatch1.kt create mode 100644 samples/client/3_1_0_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/schemas/EnumsInProperties.kt create mode 100644 samples/client/3_1_0_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/schemas/ExclusivemaximumValidation.kt create mode 100644 samples/client/3_1_0_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/schemas/ExclusiveminimumValidation.kt create mode 100644 samples/client/3_1_0_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/schemas/FloatDivisionInf.kt create mode 100644 samples/client/3_1_0_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/schemas/ForbiddenProperty.kt create mode 100644 samples/client/3_1_0_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/schemas/HostnameFormat.kt create mode 100644 samples/client/3_1_0_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/schemas/IdnEmailFormat.kt create mode 100644 samples/client/3_1_0_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/schemas/IdnHostnameFormat.kt create mode 100644 samples/client/3_1_0_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/schemas/IfAndElseWithoutThen.kt create mode 100644 samples/client/3_1_0_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/schemas/IfAndThenWithoutElse.kt create mode 100644 samples/client/3_1_0_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/schemas/IfAppearsAtTheEndWhenSerializedKeywordProcessingSequence.kt create mode 100644 samples/client/3_1_0_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/schemas/IgnoreElseWithoutIf.kt create mode 100644 samples/client/3_1_0_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/schemas/IgnoreIfWithoutThenOrElse.kt create mode 100644 samples/client/3_1_0_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/schemas/IgnoreThenWithoutIf.kt create mode 100644 samples/client/3_1_0_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/schemas/IntegerTypeMatchesIntegers.kt create mode 100644 samples/client/3_1_0_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/schemas/Ipv4Format.kt create mode 100644 samples/client/3_1_0_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/schemas/Ipv6Format.kt create mode 100644 samples/client/3_1_0_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/schemas/IriFormat.kt create mode 100644 samples/client/3_1_0_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/schemas/IriReferenceFormat.kt create mode 100644 samples/client/3_1_0_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/schemas/ItemsContains.kt create mode 100644 samples/client/3_1_0_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/schemas/ItemsDoesNotLookInApplicatorsValidCase.kt create mode 100644 samples/client/3_1_0_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/schemas/ItemsWithNullInstanceElements.kt create mode 100644 samples/client/3_1_0_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/schemas/JsonPointerFormat.kt create mode 100644 samples/client/3_1_0_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/schemas/MaxcontainsWithoutContainsIsIgnored.kt create mode 100644 samples/client/3_1_0_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/schemas/MaximumValidation.kt create mode 100644 samples/client/3_1_0_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/schemas/MaximumValidationWithUnsignedInteger.kt create mode 100644 samples/client/3_1_0_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/schemas/MaxitemsValidation.kt create mode 100644 samples/client/3_1_0_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/schemas/MaxlengthValidation.kt create mode 100644 samples/client/3_1_0_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/schemas/Maxproperties0MeansTheObjectIsEmpty.kt create mode 100644 samples/client/3_1_0_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/schemas/MaxpropertiesValidation.kt create mode 100644 samples/client/3_1_0_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/schemas/MincontainsWithoutContainsIsIgnored.kt create mode 100644 samples/client/3_1_0_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/schemas/MinimumValidation.kt create mode 100644 samples/client/3_1_0_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/schemas/MinimumValidationWithSignedInteger.kt create mode 100644 samples/client/3_1_0_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/schemas/MinitemsValidation.kt create mode 100644 samples/client/3_1_0_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/schemas/MinlengthValidation.kt create mode 100644 samples/client/3_1_0_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/schemas/MinpropertiesValidation.kt create mode 100644 samples/client/3_1_0_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/schemas/MultipleDependentsRequired.kt create mode 100644 samples/client/3_1_0_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/schemas/MultipleSimultaneousPatternpropertiesAreValidated.kt create mode 100644 samples/client/3_1_0_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/schemas/MultipleTypesCanBeSpecifiedInAnArray.kt create mode 100644 samples/client/3_1_0_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/schemas/NestedAllofToCheckValidationSemantics.kt create mode 100644 samples/client/3_1_0_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/schemas/NestedAnyofToCheckValidationSemantics.kt create mode 100644 samples/client/3_1_0_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/schemas/NestedItems.kt create mode 100644 samples/client/3_1_0_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/schemas/NestedOneofToCheckValidationSemantics.kt create mode 100644 samples/client/3_1_0_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/schemas/NonAsciiPatternWithAdditionalproperties.kt create mode 100644 samples/client/3_1_0_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/schemas/NonInterferenceAcrossCombinedSchemas.kt create mode 100644 samples/client/3_1_0_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/schemas/Not.kt create mode 100644 samples/client/3_1_0_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/schemas/NotMoreComplexSchema.kt create mode 100644 samples/client/3_1_0_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/schemas/NotMultipleTypes.kt create mode 100644 samples/client/3_1_0_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/schemas/NulCharactersInStrings.kt create mode 100644 samples/client/3_1_0_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/schemas/NullTypeMatchesOnlyTheNullObject.kt create mode 100644 samples/client/3_1_0_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/schemas/NumberTypeMatchesNumbers.kt create mode 100644 samples/client/3_1_0_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/schemas/ObjectPropertiesValidation.kt create mode 100644 samples/client/3_1_0_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/schemas/ObjectTypeMatchesObjects.kt create mode 100644 samples/client/3_1_0_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/schemas/Oneof.kt create mode 100644 samples/client/3_1_0_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/schemas/OneofComplexTypes.kt create mode 100644 samples/client/3_1_0_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/schemas/OneofWithBaseSchema.kt create mode 100644 samples/client/3_1_0_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/schemas/OneofWithEmptySchema.kt create mode 100644 samples/client/3_1_0_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/schemas/OneofWithRequired.kt create mode 100644 samples/client/3_1_0_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/schemas/PatternIsNotAnchored.kt create mode 100644 samples/client/3_1_0_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/schemas/PatternValidation.kt create mode 100644 samples/client/3_1_0_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/schemas/PatternpropertiesValidatesPropertiesMatchingARegex.kt create mode 100644 samples/client/3_1_0_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/schemas/PatternpropertiesWithNullValuedInstanceProperties.kt create mode 100644 samples/client/3_1_0_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/schemas/PrefixitemsValidationAdjustsTheStartingIndexForItems.kt create mode 100644 samples/client/3_1_0_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/schemas/PrefixitemsWithNullInstanceElements.kt create mode 100644 samples/client/3_1_0_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/schemas/PropertiesPatternpropertiesAdditionalpropertiesInteraction.kt create mode 100644 samples/client/3_1_0_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/schemas/PropertiesWhoseNamesAreJavascriptObjectPropertyNames.kt create mode 100644 samples/client/3_1_0_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/schemas/PropertiesWithEscapedCharacters.kt create mode 100644 samples/client/3_1_0_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/schemas/PropertiesWithNullValuedInstanceProperties.kt create mode 100644 samples/client/3_1_0_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/schemas/PropertyNamedRefThatIsNotAReference.kt create mode 100644 samples/client/3_1_0_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/schemas/PropertynamesValidation.kt create mode 100644 samples/client/3_1_0_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/schemas/RegexFormat.kt create mode 100644 samples/client/3_1_0_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/schemas/RegexesAreNotAnchoredByDefaultAndAreCaseSensitive.kt create mode 100644 samples/client/3_1_0_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/schemas/RelativeJsonPointerFormat.kt create mode 100644 samples/client/3_1_0_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/schemas/RequiredDefaultValidation.kt create mode 100644 samples/client/3_1_0_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/schemas/RequiredPropertiesWhoseNamesAreJavascriptObjectPropertyNames.kt create mode 100644 samples/client/3_1_0_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/schemas/RequiredValidation.kt create mode 100644 samples/client/3_1_0_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/schemas/RequiredWithEmptyArray.kt create mode 100644 samples/client/3_1_0_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/schemas/RequiredWithEscapedCharacters.kt create mode 100644 samples/client/3_1_0_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/schemas/SimpleEnumValidation.kt create mode 100644 samples/client/3_1_0_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/schemas/SingleDependency.kt create mode 100644 samples/client/3_1_0_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/schemas/SmallMultipleOfLargeInteger.kt create mode 100644 samples/client/3_1_0_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/schemas/StringTypeMatchesStrings.kt create mode 100644 samples/client/3_1_0_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/schemas/TimeFormat.kt create mode 100644 samples/client/3_1_0_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/schemas/TypeArrayObjectOrNull.kt create mode 100644 samples/client/3_1_0_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/schemas/TypeArrayOrObject.kt create mode 100644 samples/client/3_1_0_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/schemas/TypeAsArrayWithOneItem.kt create mode 100644 samples/client/3_1_0_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/schemas/UnevaluateditemsAsSchema.kt create mode 100644 samples/client/3_1_0_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/schemas/UnevaluateditemsDependsOnMultipleNestedContains.kt create mode 100644 samples/client/3_1_0_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/schemas/UnevaluateditemsWithItems.kt create mode 100644 samples/client/3_1_0_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/schemas/UnevaluateditemsWithNullInstanceElements.kt create mode 100644 samples/client/3_1_0_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/schemas/UnevaluatedpropertiesNotAffectedByPropertynames.kt create mode 100644 samples/client/3_1_0_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/schemas/UnevaluatedpropertiesSchema.kt create mode 100644 samples/client/3_1_0_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/schemas/UnevaluatedpropertiesWithAdjacentAdditionalproperties.kt create mode 100644 samples/client/3_1_0_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/schemas/UnevaluatedpropertiesWithNullValuedInstanceProperties.kt create mode 100644 samples/client/3_1_0_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/schemas/UniqueitemsFalseValidation.kt create mode 100644 samples/client/3_1_0_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/schemas/UniqueitemsFalseWithAnArrayOfItems.kt create mode 100644 samples/client/3_1_0_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/schemas/UniqueitemsValidation.kt create mode 100644 samples/client/3_1_0_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/schemas/UniqueitemsWithAnArrayOfItems.kt create mode 100644 samples/client/3_1_0_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/schemas/UriFormat.kt create mode 100644 samples/client/3_1_0_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/schemas/UriReferenceFormat.kt create mode 100644 samples/client/3_1_0_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/schemas/UriTemplateFormat.kt create mode 100644 samples/client/3_1_0_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/schemas/UuidFormat.kt create mode 100644 samples/client/3_1_0_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/schemas/ValidateAgainstCorrectBranchThenVsElse.kt create mode 100644 samples/client/3_1_0_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/configurations/JsonSchemaKeywordFlags.kt create mode 100644 samples/client/3_1_0_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/configurations/SchemaConfiguration.kt create mode 100644 samples/client/3_1_0_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/exceptions/BaseException.kt create mode 100644 samples/client/3_1_0_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/exceptions/InvalidAdditionalPropertyException.kt create mode 100644 samples/client/3_1_0_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/exceptions/UnsetPropertyException.kt create mode 100644 samples/client/3_1_0_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/exceptions/ValidationException.kt create mode 100644 samples/client/3_1_0_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/schemas/AnyTypeJsonSchema.kt create mode 100644 samples/client/3_1_0_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/schemas/BooleanJsonSchema.kt create mode 100644 samples/client/3_1_0_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/schemas/DateJsonSchema.kt create mode 100644 samples/client/3_1_0_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/schemas/DateTimeJsonSchema.kt create mode 100644 samples/client/3_1_0_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/schemas/DecimalJsonSchema.kt create mode 100644 samples/client/3_1_0_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/schemas/DoubleJsonSchema.kt create mode 100644 samples/client/3_1_0_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/schemas/FloatJsonSchema.kt create mode 100644 samples/client/3_1_0_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/schemas/GenericBuilder.kt create mode 100644 samples/client/3_1_0_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/schemas/Int32JsonSchema.kt create mode 100644 samples/client/3_1_0_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/schemas/Int64JsonSchema.kt create mode 100644 samples/client/3_1_0_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/schemas/IntJsonSchema.kt create mode 100644 samples/client/3_1_0_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/schemas/ListJsonSchema.kt create mode 100644 samples/client/3_1_0_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/schemas/MapJsonSchema.kt create mode 100644 samples/client/3_1_0_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/schemas/NotAnyTypeJsonSchema.kt create mode 100644 samples/client/3_1_0_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/schemas/NullJsonSchema.kt create mode 100644 samples/client/3_1_0_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/schemas/NumberJsonSchema.kt create mode 100644 samples/client/3_1_0_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/schemas/StringJsonSchema.kt create mode 100644 samples/client/3_1_0_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/schemas/UnsetAddPropsSetter.kt create mode 100644 samples/client/3_1_0_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/schemas/UuidJsonSchema.kt create mode 100644 samples/client/3_1_0_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/schemas/validation/AdditionalPropertiesValidator.kt create mode 100644 samples/client/3_1_0_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/schemas/validation/AllOfValidator.kt create mode 100644 samples/client/3_1_0_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/schemas/validation/AnyOfValidator.kt create mode 100644 samples/client/3_1_0_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/schemas/validation/BigDecimalValidator.kt create mode 100644 samples/client/3_1_0_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/schemas/validation/BooleanEnumValidator.kt create mode 100644 samples/client/3_1_0_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/schemas/validation/BooleanSchemaValidator.kt create mode 100644 samples/client/3_1_0_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/schemas/validation/BooleanValueMethod.kt create mode 100644 samples/client/3_1_0_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/schemas/validation/ConstValidator.kt create mode 100644 samples/client/3_1_0_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/schemas/validation/ContainsValidator.kt create mode 100644 samples/client/3_1_0_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/schemas/validation/CustomIsoparser.kt create mode 100644 samples/client/3_1_0_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/schemas/validation/DefaultValueMethod.kt create mode 100644 samples/client/3_1_0_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/schemas/validation/DependentRequiredValidator.kt create mode 100644 samples/client/3_1_0_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/schemas/validation/DependentSchemasValidator.kt create mode 100644 samples/client/3_1_0_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/schemas/validation/DoubleEnumValidator.kt create mode 100644 samples/client/3_1_0_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/schemas/validation/DoubleValueMethod.kt create mode 100644 samples/client/3_1_0_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/schemas/validation/ElseValidator.kt create mode 100644 samples/client/3_1_0_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/schemas/validation/EnumValidator.kt create mode 100644 samples/client/3_1_0_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/schemas/validation/ExclusiveMaximumValidator.kt create mode 100644 samples/client/3_1_0_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/schemas/validation/ExclusiveMinimumValidator.kt create mode 100644 samples/client/3_1_0_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/schemas/validation/FloatEnumValidator.kt create mode 100644 samples/client/3_1_0_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/schemas/validation/FloatValueMethod.kt create mode 100644 samples/client/3_1_0_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/schemas/validation/FormatValidator.kt create mode 100644 samples/client/3_1_0_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/schemas/validation/FrozenList.kt create mode 100644 samples/client/3_1_0_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/schemas/validation/FrozenMap.kt create mode 100644 samples/client/3_1_0_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/schemas/validation/IfValidator.kt create mode 100644 samples/client/3_1_0_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/schemas/validation/IntegerEnumValidator.kt create mode 100644 samples/client/3_1_0_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/schemas/validation/IntegerValueMethod.kt create mode 100644 samples/client/3_1_0_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/schemas/validation/ItemsValidator.kt create mode 100644 samples/client/3_1_0_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/schemas/validation/JsonSchema.kt create mode 100644 samples/client/3_1_0_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/schemas/validation/JsonSchemaFactory.kt create mode 100644 samples/client/3_1_0_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/schemas/validation/JsonSchemaInfo.kt create mode 100644 samples/client/3_1_0_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/schemas/validation/KeywordEntry.kt create mode 100644 samples/client/3_1_0_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/schemas/validation/KeywordValidator.kt create mode 100644 samples/client/3_1_0_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/schemas/validation/LengthValidator.kt create mode 100644 samples/client/3_1_0_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/schemas/validation/ListSchemaValidator.kt create mode 100644 samples/client/3_1_0_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/schemas/validation/LongEnumValidator.kt create mode 100644 samples/client/3_1_0_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/schemas/validation/LongValueMethod.kt create mode 100644 samples/client/3_1_0_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/schemas/validation/MapSchemaValidator.kt create mode 100644 samples/client/3_1_0_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/schemas/validation/MapUtils.kt create mode 100644 samples/client/3_1_0_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/schemas/validation/MaxContainsValidator.kt create mode 100644 samples/client/3_1_0_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/schemas/validation/MaxItemsValidator.kt create mode 100644 samples/client/3_1_0_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/schemas/validation/MaxLengthValidator.kt create mode 100644 samples/client/3_1_0_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/schemas/validation/MaxPropertiesValidator.kt create mode 100644 samples/client/3_1_0_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/schemas/validation/MaximumValidator.kt create mode 100644 samples/client/3_1_0_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/schemas/validation/MinContainsValidator.kt create mode 100644 samples/client/3_1_0_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/schemas/validation/MinItemsValidator.kt create mode 100644 samples/client/3_1_0_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/schemas/validation/MinLengthValidator.kt create mode 100644 samples/client/3_1_0_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/schemas/validation/MinPropertiesValidator.kt create mode 100644 samples/client/3_1_0_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/schemas/validation/MinimumValidator.kt create mode 100644 samples/client/3_1_0_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/schemas/validation/MultipleOfValidator.kt create mode 100644 samples/client/3_1_0_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/schemas/validation/NotValidator.kt create mode 100644 samples/client/3_1_0_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/schemas/validation/NullEnumValidator.kt create mode 100644 samples/client/3_1_0_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/schemas/validation/NullSchemaValidator.kt create mode 100644 samples/client/3_1_0_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/schemas/validation/NullValueMethod.kt create mode 100644 samples/client/3_1_0_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/schemas/validation/NumberSchemaValidator.kt create mode 100644 samples/client/3_1_0_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/schemas/validation/OneOfValidator.kt create mode 100644 samples/client/3_1_0_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/schemas/validation/PathToSchemasMap.kt create mode 100644 samples/client/3_1_0_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/schemas/validation/PatternPropertiesValidator.kt create mode 100644 samples/client/3_1_0_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/schemas/validation/PatternValidator.kt create mode 100644 samples/client/3_1_0_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/schemas/validation/PrefixItemsValidator.kt create mode 100644 samples/client/3_1_0_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/schemas/validation/PropertiesValidator.kt create mode 100644 samples/client/3_1_0_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/schemas/validation/PropertyNamesValidator.kt create mode 100644 samples/client/3_1_0_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/schemas/validation/RequiredValidator.kt create mode 100644 samples/client/3_1_0_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/schemas/validation/StringEnumValidator.kt create mode 100644 samples/client/3_1_0_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/schemas/validation/StringSchemaValidator.kt create mode 100644 samples/client/3_1_0_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/schemas/validation/StringValueMethod.kt create mode 100644 samples/client/3_1_0_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/schemas/validation/ThenValidator.kt create mode 100644 samples/client/3_1_0_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/schemas/validation/TypeValidator.kt create mode 100644 samples/client/3_1_0_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/schemas/validation/UnevaluatedItemsValidator.kt create mode 100644 samples/client/3_1_0_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/schemas/validation/UnevaluatedPropertiesValidator.kt create mode 100644 samples/client/3_1_0_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/schemas/validation/UniqueItemsValidator.kt create mode 100644 samples/client/3_1_0_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/schemas/validation/UnsetAnyTypeJsonSchema.kt create mode 100644 samples/client/3_1_0_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/schemas/validation/ValidationData.kt create mode 100644 samples/client/3_1_0_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/schemas/validation/ValidationMetadata.kt create mode 100644 samples/client/3_1_0_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/servers/RootServer0.kt create mode 100644 samples/client/3_1_0_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/servers/Server.kt create mode 100644 samples/client/3_1_0_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/servers/ServerProvider.kt create mode 100644 samples/client/3_1_0_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/servers/ServerWithVariables.kt create mode 100644 samples/client/3_1_0_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/servers/ServerWithoutVariables.kt create mode 100644 samples/client/3_1_0_unit_test/kotlin/src/test/kotlin/org/openapijsonschematools/client/components/schemas/ASchemaGivenForPrefixitemsTest.kt create mode 100644 samples/client/3_1_0_unit_test/kotlin/src/test/kotlin/org/openapijsonschematools/client/components/schemas/AdditionalItemsAreAllowedByDefaultTest.kt create mode 100644 samples/client/3_1_0_unit_test/kotlin/src/test/kotlin/org/openapijsonschematools/client/components/schemas/AdditionalpropertiesAreAllowedByDefaultTest.kt create mode 100644 samples/client/3_1_0_unit_test/kotlin/src/test/kotlin/org/openapijsonschematools/client/components/schemas/AdditionalpropertiesCanExistByItselfTest.kt create mode 100644 samples/client/3_1_0_unit_test/kotlin/src/test/kotlin/org/openapijsonschematools/client/components/schemas/AdditionalpropertiesDoesNotLookInApplicatorsTest.kt create mode 100644 samples/client/3_1_0_unit_test/kotlin/src/test/kotlin/org/openapijsonschematools/client/components/schemas/AdditionalpropertiesWithNullValuedInstancePropertiesTest.kt create mode 100644 samples/client/3_1_0_unit_test/kotlin/src/test/kotlin/org/openapijsonschematools/client/components/schemas/AdditionalpropertiesWithSchemaTest.kt create mode 100644 samples/client/3_1_0_unit_test/kotlin/src/test/kotlin/org/openapijsonschematools/client/components/schemas/AllofCombinedWithAnyofOneofTest.kt create mode 100644 samples/client/3_1_0_unit_test/kotlin/src/test/kotlin/org/openapijsonschematools/client/components/schemas/AllofSimpleTypesTest.kt create mode 100644 samples/client/3_1_0_unit_test/kotlin/src/test/kotlin/org/openapijsonschematools/client/components/schemas/AllofTest.kt create mode 100644 samples/client/3_1_0_unit_test/kotlin/src/test/kotlin/org/openapijsonschematools/client/components/schemas/AllofWithBaseSchemaTest.kt create mode 100644 samples/client/3_1_0_unit_test/kotlin/src/test/kotlin/org/openapijsonschematools/client/components/schemas/AllofWithOneEmptySchemaTest.kt create mode 100644 samples/client/3_1_0_unit_test/kotlin/src/test/kotlin/org/openapijsonschematools/client/components/schemas/AllofWithTheFirstEmptySchemaTest.kt create mode 100644 samples/client/3_1_0_unit_test/kotlin/src/test/kotlin/org/openapijsonschematools/client/components/schemas/AllofWithTheLastEmptySchemaTest.kt create mode 100644 samples/client/3_1_0_unit_test/kotlin/src/test/kotlin/org/openapijsonschematools/client/components/schemas/AllofWithTwoEmptySchemasTest.kt create mode 100644 samples/client/3_1_0_unit_test/kotlin/src/test/kotlin/org/openapijsonschematools/client/components/schemas/AnyofComplexTypesTest.kt create mode 100644 samples/client/3_1_0_unit_test/kotlin/src/test/kotlin/org/openapijsonschematools/client/components/schemas/AnyofTest.kt create mode 100644 samples/client/3_1_0_unit_test/kotlin/src/test/kotlin/org/openapijsonschematools/client/components/schemas/AnyofWithBaseSchemaTest.kt create mode 100644 samples/client/3_1_0_unit_test/kotlin/src/test/kotlin/org/openapijsonschematools/client/components/schemas/AnyofWithOneEmptySchemaTest.kt create mode 100644 samples/client/3_1_0_unit_test/kotlin/src/test/kotlin/org/openapijsonschematools/client/components/schemas/ArrayTypeMatchesArraysTest.kt create mode 100644 samples/client/3_1_0_unit_test/kotlin/src/test/kotlin/org/openapijsonschematools/client/components/schemas/BooleanTypeMatchesBooleansTest.kt create mode 100644 samples/client/3_1_0_unit_test/kotlin/src/test/kotlin/org/openapijsonschematools/client/components/schemas/ByIntTest.kt create mode 100644 samples/client/3_1_0_unit_test/kotlin/src/test/kotlin/org/openapijsonschematools/client/components/schemas/ByNumberTest.kt create mode 100644 samples/client/3_1_0_unit_test/kotlin/src/test/kotlin/org/openapijsonschematools/client/components/schemas/BySmallNumberTest.kt create mode 100644 samples/client/3_1_0_unit_test/kotlin/src/test/kotlin/org/openapijsonschematools/client/components/schemas/ConstNulCharactersInStringsTest.kt create mode 100644 samples/client/3_1_0_unit_test/kotlin/src/test/kotlin/org/openapijsonschematools/client/components/schemas/ContainsKeywordValidationTest.kt create mode 100644 samples/client/3_1_0_unit_test/kotlin/src/test/kotlin/org/openapijsonschematools/client/components/schemas/ContainsWithNullInstanceElementsTest.kt create mode 100644 samples/client/3_1_0_unit_test/kotlin/src/test/kotlin/org/openapijsonschematools/client/components/schemas/DateFormatTest.kt create mode 100644 samples/client/3_1_0_unit_test/kotlin/src/test/kotlin/org/openapijsonschematools/client/components/schemas/DateTimeFormatTest.kt create mode 100644 samples/client/3_1_0_unit_test/kotlin/src/test/kotlin/org/openapijsonschematools/client/components/schemas/DependentSchemasDependenciesWithEscapedCharactersTest.kt create mode 100644 samples/client/3_1_0_unit_test/kotlin/src/test/kotlin/org/openapijsonschematools/client/components/schemas/DependentSchemasDependentSubschemaIncompatibleWithRootTest.kt create mode 100644 samples/client/3_1_0_unit_test/kotlin/src/test/kotlin/org/openapijsonschematools/client/components/schemas/DependentSchemasSingleDependencyTest.kt create mode 100644 samples/client/3_1_0_unit_test/kotlin/src/test/kotlin/org/openapijsonschematools/client/components/schemas/DurationFormatTest.kt create mode 100644 samples/client/3_1_0_unit_test/kotlin/src/test/kotlin/org/openapijsonschematools/client/components/schemas/EmailFormatTest.kt create mode 100644 samples/client/3_1_0_unit_test/kotlin/src/test/kotlin/org/openapijsonschematools/client/components/schemas/EmptyDependentsTest.kt create mode 100644 samples/client/3_1_0_unit_test/kotlin/src/test/kotlin/org/openapijsonschematools/client/components/schemas/EnumWith0DoesNotMatchFalseTest.kt create mode 100644 samples/client/3_1_0_unit_test/kotlin/src/test/kotlin/org/openapijsonschematools/client/components/schemas/EnumWith1DoesNotMatchTrueTest.kt create mode 100644 samples/client/3_1_0_unit_test/kotlin/src/test/kotlin/org/openapijsonschematools/client/components/schemas/EnumWithEscapedCharactersTest.kt create mode 100644 samples/client/3_1_0_unit_test/kotlin/src/test/kotlin/org/openapijsonschematools/client/components/schemas/EnumWithFalseDoesNotMatch0Test.kt create mode 100644 samples/client/3_1_0_unit_test/kotlin/src/test/kotlin/org/openapijsonschematools/client/components/schemas/EnumWithTrueDoesNotMatch1Test.kt create mode 100644 samples/client/3_1_0_unit_test/kotlin/src/test/kotlin/org/openapijsonschematools/client/components/schemas/EnumsInPropertiesTest.kt create mode 100644 samples/client/3_1_0_unit_test/kotlin/src/test/kotlin/org/openapijsonschematools/client/components/schemas/ExclusivemaximumValidationTest.kt create mode 100644 samples/client/3_1_0_unit_test/kotlin/src/test/kotlin/org/openapijsonschematools/client/components/schemas/ExclusiveminimumValidationTest.kt create mode 100644 samples/client/3_1_0_unit_test/kotlin/src/test/kotlin/org/openapijsonschematools/client/components/schemas/FloatDivisionInfTest.kt create mode 100644 samples/client/3_1_0_unit_test/kotlin/src/test/kotlin/org/openapijsonschematools/client/components/schemas/ForbiddenPropertyTest.kt create mode 100644 samples/client/3_1_0_unit_test/kotlin/src/test/kotlin/org/openapijsonschematools/client/components/schemas/HostnameFormatTest.kt create mode 100644 samples/client/3_1_0_unit_test/kotlin/src/test/kotlin/org/openapijsonschematools/client/components/schemas/IdnEmailFormatTest.kt create mode 100644 samples/client/3_1_0_unit_test/kotlin/src/test/kotlin/org/openapijsonschematools/client/components/schemas/IdnHostnameFormatTest.kt create mode 100644 samples/client/3_1_0_unit_test/kotlin/src/test/kotlin/org/openapijsonschematools/client/components/schemas/IfAndElseWithoutThenTest.kt create mode 100644 samples/client/3_1_0_unit_test/kotlin/src/test/kotlin/org/openapijsonschematools/client/components/schemas/IfAndThenWithoutElseTest.kt create mode 100644 samples/client/3_1_0_unit_test/kotlin/src/test/kotlin/org/openapijsonschematools/client/components/schemas/IfAppearsAtTheEndWhenSerializedKeywordProcessingSequenceTest.kt create mode 100644 samples/client/3_1_0_unit_test/kotlin/src/test/kotlin/org/openapijsonschematools/client/components/schemas/IgnoreElseWithoutIfTest.kt create mode 100644 samples/client/3_1_0_unit_test/kotlin/src/test/kotlin/org/openapijsonschematools/client/components/schemas/IgnoreIfWithoutThenOrElseTest.kt create mode 100644 samples/client/3_1_0_unit_test/kotlin/src/test/kotlin/org/openapijsonschematools/client/components/schemas/IgnoreThenWithoutIfTest.kt create mode 100644 samples/client/3_1_0_unit_test/kotlin/src/test/kotlin/org/openapijsonschematools/client/components/schemas/IntegerTypeMatchesIntegersTest.kt create mode 100644 samples/client/3_1_0_unit_test/kotlin/src/test/kotlin/org/openapijsonschematools/client/components/schemas/Ipv4FormatTest.kt create mode 100644 samples/client/3_1_0_unit_test/kotlin/src/test/kotlin/org/openapijsonschematools/client/components/schemas/Ipv6FormatTest.kt create mode 100644 samples/client/3_1_0_unit_test/kotlin/src/test/kotlin/org/openapijsonschematools/client/components/schemas/IriFormatTest.kt create mode 100644 samples/client/3_1_0_unit_test/kotlin/src/test/kotlin/org/openapijsonschematools/client/components/schemas/IriReferenceFormatTest.kt create mode 100644 samples/client/3_1_0_unit_test/kotlin/src/test/kotlin/org/openapijsonschematools/client/components/schemas/ItemsContainsTest.kt create mode 100644 samples/client/3_1_0_unit_test/kotlin/src/test/kotlin/org/openapijsonschematools/client/components/schemas/ItemsDoesNotLookInApplicatorsValidCaseTest.kt create mode 100644 samples/client/3_1_0_unit_test/kotlin/src/test/kotlin/org/openapijsonschematools/client/components/schemas/ItemsWithNullInstanceElementsTest.kt create mode 100644 samples/client/3_1_0_unit_test/kotlin/src/test/kotlin/org/openapijsonschematools/client/components/schemas/JsonPointerFormatTest.kt create mode 100644 samples/client/3_1_0_unit_test/kotlin/src/test/kotlin/org/openapijsonschematools/client/components/schemas/MaxcontainsWithoutContainsIsIgnoredTest.kt create mode 100644 samples/client/3_1_0_unit_test/kotlin/src/test/kotlin/org/openapijsonschematools/client/components/schemas/MaximumValidationTest.kt create mode 100644 samples/client/3_1_0_unit_test/kotlin/src/test/kotlin/org/openapijsonschematools/client/components/schemas/MaximumValidationWithUnsignedIntegerTest.kt create mode 100644 samples/client/3_1_0_unit_test/kotlin/src/test/kotlin/org/openapijsonschematools/client/components/schemas/MaxitemsValidationTest.kt create mode 100644 samples/client/3_1_0_unit_test/kotlin/src/test/kotlin/org/openapijsonschematools/client/components/schemas/MaxlengthValidationTest.kt create mode 100644 samples/client/3_1_0_unit_test/kotlin/src/test/kotlin/org/openapijsonschematools/client/components/schemas/Maxproperties0MeansTheObjectIsEmptyTest.kt create mode 100644 samples/client/3_1_0_unit_test/kotlin/src/test/kotlin/org/openapijsonschematools/client/components/schemas/MaxpropertiesValidationTest.kt create mode 100644 samples/client/3_1_0_unit_test/kotlin/src/test/kotlin/org/openapijsonschematools/client/components/schemas/MincontainsWithoutContainsIsIgnoredTest.kt create mode 100644 samples/client/3_1_0_unit_test/kotlin/src/test/kotlin/org/openapijsonschematools/client/components/schemas/MinimumValidationTest.kt create mode 100644 samples/client/3_1_0_unit_test/kotlin/src/test/kotlin/org/openapijsonschematools/client/components/schemas/MinimumValidationWithSignedIntegerTest.kt create mode 100644 samples/client/3_1_0_unit_test/kotlin/src/test/kotlin/org/openapijsonschematools/client/components/schemas/MinitemsValidationTest.kt create mode 100644 samples/client/3_1_0_unit_test/kotlin/src/test/kotlin/org/openapijsonschematools/client/components/schemas/MinlengthValidationTest.kt create mode 100644 samples/client/3_1_0_unit_test/kotlin/src/test/kotlin/org/openapijsonschematools/client/components/schemas/MinpropertiesValidationTest.kt create mode 100644 samples/client/3_1_0_unit_test/kotlin/src/test/kotlin/org/openapijsonschematools/client/components/schemas/MultipleDependentsRequiredTest.kt create mode 100644 samples/client/3_1_0_unit_test/kotlin/src/test/kotlin/org/openapijsonschematools/client/components/schemas/MultipleSimultaneousPatternpropertiesAreValidatedTest.kt create mode 100644 samples/client/3_1_0_unit_test/kotlin/src/test/kotlin/org/openapijsonschematools/client/components/schemas/MultipleTypesCanBeSpecifiedInAnArrayTest.kt create mode 100644 samples/client/3_1_0_unit_test/kotlin/src/test/kotlin/org/openapijsonschematools/client/components/schemas/NestedAllofToCheckValidationSemanticsTest.kt create mode 100644 samples/client/3_1_0_unit_test/kotlin/src/test/kotlin/org/openapijsonschematools/client/components/schemas/NestedAnyofToCheckValidationSemanticsTest.kt create mode 100644 samples/client/3_1_0_unit_test/kotlin/src/test/kotlin/org/openapijsonschematools/client/components/schemas/NestedItemsTest.kt create mode 100644 samples/client/3_1_0_unit_test/kotlin/src/test/kotlin/org/openapijsonschematools/client/components/schemas/NestedOneofToCheckValidationSemanticsTest.kt create mode 100644 samples/client/3_1_0_unit_test/kotlin/src/test/kotlin/org/openapijsonschematools/client/components/schemas/NonAsciiPatternWithAdditionalpropertiesTest.kt create mode 100644 samples/client/3_1_0_unit_test/kotlin/src/test/kotlin/org/openapijsonschematools/client/components/schemas/NonInterferenceAcrossCombinedSchemasTest.kt create mode 100644 samples/client/3_1_0_unit_test/kotlin/src/test/kotlin/org/openapijsonschematools/client/components/schemas/NotMoreComplexSchemaTest.kt create mode 100644 samples/client/3_1_0_unit_test/kotlin/src/test/kotlin/org/openapijsonschematools/client/components/schemas/NotMultipleTypesTest.kt create mode 100644 samples/client/3_1_0_unit_test/kotlin/src/test/kotlin/org/openapijsonschematools/client/components/schemas/NotTest.kt create mode 100644 samples/client/3_1_0_unit_test/kotlin/src/test/kotlin/org/openapijsonschematools/client/components/schemas/NulCharactersInStringsTest.kt create mode 100644 samples/client/3_1_0_unit_test/kotlin/src/test/kotlin/org/openapijsonschematools/client/components/schemas/NullTypeMatchesOnlyTheNullObjectTest.kt create mode 100644 samples/client/3_1_0_unit_test/kotlin/src/test/kotlin/org/openapijsonschematools/client/components/schemas/NumberTypeMatchesNumbersTest.kt create mode 100644 samples/client/3_1_0_unit_test/kotlin/src/test/kotlin/org/openapijsonschematools/client/components/schemas/ObjectPropertiesValidationTest.kt create mode 100644 samples/client/3_1_0_unit_test/kotlin/src/test/kotlin/org/openapijsonschematools/client/components/schemas/ObjectTypeMatchesObjectsTest.kt create mode 100644 samples/client/3_1_0_unit_test/kotlin/src/test/kotlin/org/openapijsonschematools/client/components/schemas/OneofComplexTypesTest.kt create mode 100644 samples/client/3_1_0_unit_test/kotlin/src/test/kotlin/org/openapijsonschematools/client/components/schemas/OneofTest.kt create mode 100644 samples/client/3_1_0_unit_test/kotlin/src/test/kotlin/org/openapijsonschematools/client/components/schemas/OneofWithBaseSchemaTest.kt create mode 100644 samples/client/3_1_0_unit_test/kotlin/src/test/kotlin/org/openapijsonschematools/client/components/schemas/OneofWithEmptySchemaTest.kt create mode 100644 samples/client/3_1_0_unit_test/kotlin/src/test/kotlin/org/openapijsonschematools/client/components/schemas/OneofWithRequiredTest.kt create mode 100644 samples/client/3_1_0_unit_test/kotlin/src/test/kotlin/org/openapijsonschematools/client/components/schemas/PatternIsNotAnchoredTest.kt create mode 100644 samples/client/3_1_0_unit_test/kotlin/src/test/kotlin/org/openapijsonschematools/client/components/schemas/PatternValidationTest.kt create mode 100644 samples/client/3_1_0_unit_test/kotlin/src/test/kotlin/org/openapijsonschematools/client/components/schemas/PatternpropertiesValidatesPropertiesMatchingARegexTest.kt create mode 100644 samples/client/3_1_0_unit_test/kotlin/src/test/kotlin/org/openapijsonschematools/client/components/schemas/PatternpropertiesWithNullValuedInstancePropertiesTest.kt create mode 100644 samples/client/3_1_0_unit_test/kotlin/src/test/kotlin/org/openapijsonschematools/client/components/schemas/PrefixitemsValidationAdjustsTheStartingIndexForItemsTest.kt create mode 100644 samples/client/3_1_0_unit_test/kotlin/src/test/kotlin/org/openapijsonschematools/client/components/schemas/PrefixitemsWithNullInstanceElementsTest.kt create mode 100644 samples/client/3_1_0_unit_test/kotlin/src/test/kotlin/org/openapijsonschematools/client/components/schemas/PropertiesPatternpropertiesAdditionalpropertiesInteractionTest.kt create mode 100644 samples/client/3_1_0_unit_test/kotlin/src/test/kotlin/org/openapijsonschematools/client/components/schemas/PropertiesWhoseNamesAreJavascriptObjectPropertyNamesTest.kt create mode 100644 samples/client/3_1_0_unit_test/kotlin/src/test/kotlin/org/openapijsonschematools/client/components/schemas/PropertiesWithEscapedCharactersTest.kt create mode 100644 samples/client/3_1_0_unit_test/kotlin/src/test/kotlin/org/openapijsonschematools/client/components/schemas/PropertiesWithNullValuedInstancePropertiesTest.kt create mode 100644 samples/client/3_1_0_unit_test/kotlin/src/test/kotlin/org/openapijsonschematools/client/components/schemas/PropertyNamedRefThatIsNotAReferenceTest.kt create mode 100644 samples/client/3_1_0_unit_test/kotlin/src/test/kotlin/org/openapijsonschematools/client/components/schemas/PropertynamesValidationTest.kt create mode 100644 samples/client/3_1_0_unit_test/kotlin/src/test/kotlin/org/openapijsonschematools/client/components/schemas/RegexFormatTest.kt create mode 100644 samples/client/3_1_0_unit_test/kotlin/src/test/kotlin/org/openapijsonschematools/client/components/schemas/RegexesAreNotAnchoredByDefaultAndAreCaseSensitiveTest.kt create mode 100644 samples/client/3_1_0_unit_test/kotlin/src/test/kotlin/org/openapijsonschematools/client/components/schemas/RelativeJsonPointerFormatTest.kt create mode 100644 samples/client/3_1_0_unit_test/kotlin/src/test/kotlin/org/openapijsonschematools/client/components/schemas/RequiredDefaultValidationTest.kt create mode 100644 samples/client/3_1_0_unit_test/kotlin/src/test/kotlin/org/openapijsonschematools/client/components/schemas/RequiredPropertiesWhoseNamesAreJavascriptObjectPropertyNamesTest.kt create mode 100644 samples/client/3_1_0_unit_test/kotlin/src/test/kotlin/org/openapijsonschematools/client/components/schemas/RequiredValidationTest.kt create mode 100644 samples/client/3_1_0_unit_test/kotlin/src/test/kotlin/org/openapijsonschematools/client/components/schemas/RequiredWithEmptyArrayTest.kt create mode 100644 samples/client/3_1_0_unit_test/kotlin/src/test/kotlin/org/openapijsonschematools/client/components/schemas/RequiredWithEscapedCharactersTest.kt create mode 100644 samples/client/3_1_0_unit_test/kotlin/src/test/kotlin/org/openapijsonschematools/client/components/schemas/SimpleEnumValidationTest.kt create mode 100644 samples/client/3_1_0_unit_test/kotlin/src/test/kotlin/org/openapijsonschematools/client/components/schemas/SingleDependencyTest.kt create mode 100644 samples/client/3_1_0_unit_test/kotlin/src/test/kotlin/org/openapijsonschematools/client/components/schemas/SmallMultipleOfLargeIntegerTest.kt create mode 100644 samples/client/3_1_0_unit_test/kotlin/src/test/kotlin/org/openapijsonschematools/client/components/schemas/StringTypeMatchesStringsTest.kt create mode 100644 samples/client/3_1_0_unit_test/kotlin/src/test/kotlin/org/openapijsonschematools/client/components/schemas/TimeFormatTest.kt create mode 100644 samples/client/3_1_0_unit_test/kotlin/src/test/kotlin/org/openapijsonschematools/client/components/schemas/TypeArrayObjectOrNullTest.kt create mode 100644 samples/client/3_1_0_unit_test/kotlin/src/test/kotlin/org/openapijsonschematools/client/components/schemas/TypeArrayOrObjectTest.kt create mode 100644 samples/client/3_1_0_unit_test/kotlin/src/test/kotlin/org/openapijsonschematools/client/components/schemas/TypeAsArrayWithOneItemTest.kt create mode 100644 samples/client/3_1_0_unit_test/kotlin/src/test/kotlin/org/openapijsonschematools/client/components/schemas/UnevaluateditemsAsSchemaTest.kt create mode 100644 samples/client/3_1_0_unit_test/kotlin/src/test/kotlin/org/openapijsonschematools/client/components/schemas/UnevaluateditemsDependsOnMultipleNestedContainsTest.kt create mode 100644 samples/client/3_1_0_unit_test/kotlin/src/test/kotlin/org/openapijsonschematools/client/components/schemas/UnevaluateditemsWithItemsTest.kt create mode 100644 samples/client/3_1_0_unit_test/kotlin/src/test/kotlin/org/openapijsonschematools/client/components/schemas/UnevaluateditemsWithNullInstanceElementsTest.kt create mode 100644 samples/client/3_1_0_unit_test/kotlin/src/test/kotlin/org/openapijsonschematools/client/components/schemas/UnevaluatedpropertiesNotAffectedByPropertynamesTest.kt create mode 100644 samples/client/3_1_0_unit_test/kotlin/src/test/kotlin/org/openapijsonschematools/client/components/schemas/UnevaluatedpropertiesSchemaTest.kt create mode 100644 samples/client/3_1_0_unit_test/kotlin/src/test/kotlin/org/openapijsonschematools/client/components/schemas/UnevaluatedpropertiesWithAdjacentAdditionalpropertiesTest.kt create mode 100644 samples/client/3_1_0_unit_test/kotlin/src/test/kotlin/org/openapijsonschematools/client/components/schemas/UnevaluatedpropertiesWithNullValuedInstancePropertiesTest.kt create mode 100644 samples/client/3_1_0_unit_test/kotlin/src/test/kotlin/org/openapijsonschematools/client/components/schemas/UniqueitemsFalseValidationTest.kt create mode 100644 samples/client/3_1_0_unit_test/kotlin/src/test/kotlin/org/openapijsonschematools/client/components/schemas/UniqueitemsFalseWithAnArrayOfItemsTest.kt create mode 100644 samples/client/3_1_0_unit_test/kotlin/src/test/kotlin/org/openapijsonschematools/client/components/schemas/UniqueitemsValidationTest.kt create mode 100644 samples/client/3_1_0_unit_test/kotlin/src/test/kotlin/org/openapijsonschematools/client/components/schemas/UniqueitemsWithAnArrayOfItemsTest.kt create mode 100644 samples/client/3_1_0_unit_test/kotlin/src/test/kotlin/org/openapijsonschematools/client/components/schemas/UriFormatTest.kt create mode 100644 samples/client/3_1_0_unit_test/kotlin/src/test/kotlin/org/openapijsonschematools/client/components/schemas/UriReferenceFormatTest.kt create mode 100644 samples/client/3_1_0_unit_test/kotlin/src/test/kotlin/org/openapijsonschematools/client/components/schemas/UriTemplateFormatTest.kt create mode 100644 samples/client/3_1_0_unit_test/kotlin/src/test/kotlin/org/openapijsonschematools/client/components/schemas/UuidFormatTest.kt create mode 100644 samples/client/3_1_0_unit_test/kotlin/src/test/kotlin/org/openapijsonschematools/client/components/schemas/ValidateAgainstCorrectBranchThenVsElseTest.kt create mode 100644 samples/client/3_1_0_unit_test/kotlin/src/test/kotlin/org/openapijsonschematools/client/configurations/JsonSchemaKeywordFlagsTest.kt create mode 100644 samples/client/3_1_0_unit_test/kotlin/src/test/kotlin/org/openapijsonschematools/client/schemas/AnyTypeSchemaTest.kt create mode 100644 samples/client/3_1_0_unit_test/kotlin/src/test/kotlin/org/openapijsonschematools/client/schemas/ArrayTypeSchemaTest.kt create mode 100644 samples/client/3_1_0_unit_test/kotlin/src/test/kotlin/org/openapijsonschematools/client/schemas/BooleanSchemaTest.kt create mode 100644 samples/client/3_1_0_unit_test/kotlin/src/test/kotlin/org/openapijsonschematools/client/schemas/ListBuilderTest.kt create mode 100644 samples/client/3_1_0_unit_test/kotlin/src/test/kotlin/org/openapijsonschematools/client/schemas/ListSchemaTest.kt create mode 100644 samples/client/3_1_0_unit_test/kotlin/src/test/kotlin/org/openapijsonschematools/client/schemas/MapSchemaTest.kt create mode 100644 samples/client/3_1_0_unit_test/kotlin/src/test/kotlin/org/openapijsonschematools/client/schemas/NullSchemaTest.kt create mode 100644 samples/client/3_1_0_unit_test/kotlin/src/test/kotlin/org/openapijsonschematools/client/schemas/NumberSchemaTest.kt create mode 100644 samples/client/3_1_0_unit_test/kotlin/src/test/kotlin/org/openapijsonschematools/client/schemas/ObjectTypeSchemaTest.kt create mode 100644 samples/client/3_1_0_unit_test/kotlin/src/test/kotlin/org/openapijsonschematools/client/schemas/RefBooleanSchemaTest.kt create mode 100644 samples/client/3_1_0_unit_test/kotlin/src/test/kotlin/org/openapijsonschematools/client/schemas/validation/AdditionalPropertiesValidatorTest.kt create mode 100644 samples/client/3_1_0_unit_test/kotlin/src/test/kotlin/org/openapijsonschematools/client/schemas/validation/CustomIsoparserTest.kt create mode 100644 samples/client/3_1_0_unit_test/kotlin/src/test/kotlin/org/openapijsonschematools/client/schemas/validation/FormatValidatorTest.kt create mode 100644 samples/client/3_1_0_unit_test/kotlin/src/test/kotlin/org/openapijsonschematools/client/schemas/validation/ItemsValidatorTest.kt create mode 100644 samples/client/3_1_0_unit_test/kotlin/src/test/kotlin/org/openapijsonschematools/client/schemas/validation/JsonSchemaTest.kt create mode 100644 samples/client/3_1_0_unit_test/kotlin/src/test/kotlin/org/openapijsonschematools/client/schemas/validation/PropertiesValidatorTest.kt create mode 100644 samples/client/3_1_0_unit_test/kotlin/src/test/kotlin/org/openapijsonschematools/client/schemas/validation/RequiredValidatorTest.kt create mode 100644 samples/client/3_1_0_unit_test/kotlin/src/test/kotlin/org/openapijsonschematools/client/schemas/validation/TypeValidatorTest.kt diff --git a/bin/generate_samples_configs/kotlin_3_1_0_unit_test.yaml b/bin/generate_samples_configs/kotlin_3_1_0_unit_test.yaml new file mode 100644 index 00000000000..de38ad3abb3 --- /dev/null +++ b/bin/generate_samples_configs/kotlin_3_1_0_unit_test.yaml @@ -0,0 +1,6 @@ +generatorName: kotlin +outputDir: samples/client/3_1_0_unit_test/kotlin +inputSpec: src/test/resources/3_1/unit_test_spec/3_1_0_unit_test_spec_nopaths.yaml +intsAllowedForFloatDoubleFormats: true +artifactId: unit-test-api +hideGenerationTimestamp: true \ No newline at end of file diff --git a/samples/client/3_1_0_unit_test/kotlin/.gitignore b/samples/client/3_1_0_unit_test/kotlin/.gitignore new file mode 100644 index 00000000000..3a4ec036d04 --- /dev/null +++ b/samples/client/3_1_0_unit_test/kotlin/.gitignore @@ -0,0 +1,9 @@ +build/ +.gradle/ +.idea/ +target/ + +# gradle wrapper +gradlew +gradlew.bat +gradle/ \ No newline at end of file diff --git a/samples/client/3_1_0_unit_test/kotlin/.openapi-generator-ignore b/samples/client/3_1_0_unit_test/kotlin/.openapi-generator-ignore new file mode 100644 index 00000000000..d24a2da8ae5 --- /dev/null +++ b/samples/client/3_1_0_unit_test/kotlin/.openapi-generator-ignore @@ -0,0 +1,23 @@ +# OpenAPI Generator Ignore +# Generated by openapi-generator https://github.com/openapi-json-schema-tools/openapi-json-schema-generator + +# Use this file to prevent files from being overwritten by the generator. +# The patterns follow closely to .gitignore or .dockerignore. + +# As an example, the C# client generator defines ApiClient.cs. +# You can make changes and tell OpenAPI Generator to ignore just this file by uncommenting the following line: +#ApiClient.cs + +# You can match any string of characters against a directory, file or extension with a single asterisk (*): +#foo/*/qux +# The above matches foo/bar/qux and foo/baz/qux, but not foo/bar/baz/qux + +# You can recursively match patterns against a directory, file or extension with a double asterisk (**): +#foo/**/qux +# This matches foo/bar/qux, foo/baz/qux, and foo/bar/baz/qux + +# You can also negate patterns with an exclamation (!). +# For example, you can ignore all files in a docs folder with the file extension .md: +#docs/*.md +# Then explicitly reverse the ignore rule for a single file: +#!docs/README.md diff --git a/samples/client/3_1_0_unit_test/kotlin/.openapi-generator/FILES b/samples/client/3_1_0_unit_test/kotlin/.openapi-generator/FILES new file mode 100644 index 00000000000..912c4bdd6f4 --- /dev/null +++ b/samples/client/3_1_0_unit_test/kotlin/.openapi-generator/FILES @@ -0,0 +1,560 @@ +.gitignore +.openapi-generator-ignore +README.md +build.gradle.kts +docs/RootServerInfo.md +docs/components/schemas/ASchemaGivenForPrefixitems.md +docs/components/schemas/AdditionalItemsAreAllowedByDefault.md +docs/components/schemas/AdditionalpropertiesAreAllowedByDefault.md +docs/components/schemas/AdditionalpropertiesCanExistByItself.md +docs/components/schemas/AdditionalpropertiesDoesNotLookInApplicators.md +docs/components/schemas/AdditionalpropertiesWithNullValuedInstanceProperties.md +docs/components/schemas/AdditionalpropertiesWithSchema.md +docs/components/schemas/Allof.md +docs/components/schemas/AllofCombinedWithAnyofOneof.md +docs/components/schemas/AllofSimpleTypes.md +docs/components/schemas/AllofWithBaseSchema.md +docs/components/schemas/AllofWithOneEmptySchema.md +docs/components/schemas/AllofWithTheFirstEmptySchema.md +docs/components/schemas/AllofWithTheLastEmptySchema.md +docs/components/schemas/AllofWithTwoEmptySchemas.md +docs/components/schemas/Anyof.md +docs/components/schemas/AnyofComplexTypes.md +docs/components/schemas/AnyofWithBaseSchema.md +docs/components/schemas/AnyofWithOneEmptySchema.md +docs/components/schemas/ArrayTypeMatchesArrays.md +docs/components/schemas/BooleanTypeMatchesBooleans.md +docs/components/schemas/ByInt.md +docs/components/schemas/ByNumber.md +docs/components/schemas/BySmallNumber.md +docs/components/schemas/ConstNulCharactersInStrings.md +docs/components/schemas/ContainsKeywordValidation.md +docs/components/schemas/ContainsWithNullInstanceElements.md +docs/components/schemas/DateFormat.md +docs/components/schemas/DateTimeFormat.md +docs/components/schemas/DependentSchemasDependenciesWithEscapedCharacters.md +docs/components/schemas/DependentSchemasDependentSubschemaIncompatibleWithRoot.md +docs/components/schemas/DependentSchemasSingleDependency.md +docs/components/schemas/DurationFormat.md +docs/components/schemas/EmailFormat.md +docs/components/schemas/EmptyDependents.md +docs/components/schemas/EnumWith0DoesNotMatchFalse.md +docs/components/schemas/EnumWith1DoesNotMatchTrue.md +docs/components/schemas/EnumWithEscapedCharacters.md +docs/components/schemas/EnumWithFalseDoesNotMatch0.md +docs/components/schemas/EnumWithTrueDoesNotMatch1.md +docs/components/schemas/EnumsInProperties.md +docs/components/schemas/ExclusivemaximumValidation.md +docs/components/schemas/ExclusiveminimumValidation.md +docs/components/schemas/FloatDivisionInf.md +docs/components/schemas/ForbiddenProperty.md +docs/components/schemas/HostnameFormat.md +docs/components/schemas/IdnEmailFormat.md +docs/components/schemas/IdnHostnameFormat.md +docs/components/schemas/IfAndElseWithoutThen.md +docs/components/schemas/IfAndThenWithoutElse.md +docs/components/schemas/IfAppearsAtTheEndWhenSerializedKeywordProcessingSequence.md +docs/components/schemas/IgnoreElseWithoutIf.md +docs/components/schemas/IgnoreIfWithoutThenOrElse.md +docs/components/schemas/IgnoreThenWithoutIf.md +docs/components/schemas/IntegerTypeMatchesIntegers.md +docs/components/schemas/Ipv4Format.md +docs/components/schemas/Ipv6Format.md +docs/components/schemas/IriFormat.md +docs/components/schemas/IriReferenceFormat.md +docs/components/schemas/ItemsContains.md +docs/components/schemas/ItemsDoesNotLookInApplicatorsValidCase.md +docs/components/schemas/ItemsWithNullInstanceElements.md +docs/components/schemas/JsonPointerFormat.md +docs/components/schemas/MaxcontainsWithoutContainsIsIgnored.md +docs/components/schemas/MaximumValidation.md +docs/components/schemas/MaximumValidationWithUnsignedInteger.md +docs/components/schemas/MaxitemsValidation.md +docs/components/schemas/MaxlengthValidation.md +docs/components/schemas/Maxproperties0MeansTheObjectIsEmpty.md +docs/components/schemas/MaxpropertiesValidation.md +docs/components/schemas/MincontainsWithoutContainsIsIgnored.md +docs/components/schemas/MinimumValidation.md +docs/components/schemas/MinimumValidationWithSignedInteger.md +docs/components/schemas/MinitemsValidation.md +docs/components/schemas/MinlengthValidation.md +docs/components/schemas/MinpropertiesValidation.md +docs/components/schemas/MultipleDependentsRequired.md +docs/components/schemas/MultipleSimultaneousPatternpropertiesAreValidated.md +docs/components/schemas/MultipleTypesCanBeSpecifiedInAnArray.md +docs/components/schemas/NestedAllofToCheckValidationSemantics.md +docs/components/schemas/NestedAnyofToCheckValidationSemantics.md +docs/components/schemas/NestedItems.md +docs/components/schemas/NestedOneofToCheckValidationSemantics.md +docs/components/schemas/NonAsciiPatternWithAdditionalproperties.md +docs/components/schemas/NonInterferenceAcrossCombinedSchemas.md +docs/components/schemas/Not.md +docs/components/schemas/NotMoreComplexSchema.md +docs/components/schemas/NotMultipleTypes.md +docs/components/schemas/NulCharactersInStrings.md +docs/components/schemas/NullTypeMatchesOnlyTheNullObject.md +docs/components/schemas/NumberTypeMatchesNumbers.md +docs/components/schemas/ObjectPropertiesValidation.md +docs/components/schemas/ObjectTypeMatchesObjects.md +docs/components/schemas/Oneof.md +docs/components/schemas/OneofComplexTypes.md +docs/components/schemas/OneofWithBaseSchema.md +docs/components/schemas/OneofWithEmptySchema.md +docs/components/schemas/OneofWithRequired.md +docs/components/schemas/PatternIsNotAnchored.md +docs/components/schemas/PatternValidation.md +docs/components/schemas/PatternpropertiesValidatesPropertiesMatchingARegex.md +docs/components/schemas/PatternpropertiesWithNullValuedInstanceProperties.md +docs/components/schemas/PrefixitemsValidationAdjustsTheStartingIndexForItems.md +docs/components/schemas/PrefixitemsWithNullInstanceElements.md +docs/components/schemas/PropertiesPatternpropertiesAdditionalpropertiesInteraction.md +docs/components/schemas/PropertiesWhoseNamesAreJavascriptObjectPropertyNames.md +docs/components/schemas/PropertiesWithEscapedCharacters.md +docs/components/schemas/PropertiesWithNullValuedInstanceProperties.md +docs/components/schemas/PropertyNamedRefThatIsNotAReference.md +docs/components/schemas/PropertynamesValidation.md +docs/components/schemas/RegexFormat.md +docs/components/schemas/RegexesAreNotAnchoredByDefaultAndAreCaseSensitive.md +docs/components/schemas/RelativeJsonPointerFormat.md +docs/components/schemas/RequiredDefaultValidation.md +docs/components/schemas/RequiredPropertiesWhoseNamesAreJavascriptObjectPropertyNames.md +docs/components/schemas/RequiredValidation.md +docs/components/schemas/RequiredWithEmptyArray.md +docs/components/schemas/RequiredWithEscapedCharacters.md +docs/components/schemas/SimpleEnumValidation.md +docs/components/schemas/SingleDependency.md +docs/components/schemas/SmallMultipleOfLargeInteger.md +docs/components/schemas/StringTypeMatchesStrings.md +docs/components/schemas/TimeFormat.md +docs/components/schemas/TypeArrayObjectOrNull.md +docs/components/schemas/TypeArrayOrObject.md +docs/components/schemas/TypeAsArrayWithOneItem.md +docs/components/schemas/UnevaluateditemsAsSchema.md +docs/components/schemas/UnevaluateditemsDependsOnMultipleNestedContains.md +docs/components/schemas/UnevaluateditemsWithItems.md +docs/components/schemas/UnevaluateditemsWithNullInstanceElements.md +docs/components/schemas/UnevaluatedpropertiesNotAffectedByPropertynames.md +docs/components/schemas/UnevaluatedpropertiesSchema.md +docs/components/schemas/UnevaluatedpropertiesWithAdjacentAdditionalproperties.md +docs/components/schemas/UnevaluatedpropertiesWithNullValuedInstanceProperties.md +docs/components/schemas/UniqueitemsFalseValidation.md +docs/components/schemas/UniqueitemsFalseWithAnArrayOfItems.md +docs/components/schemas/UniqueitemsValidation.md +docs/components/schemas/UniqueitemsWithAnArrayOfItems.md +docs/components/schemas/UriFormat.md +docs/components/schemas/UriReferenceFormat.md +docs/components/schemas/UriTemplateFormat.md +docs/components/schemas/UuidFormat.md +docs/components/schemas/ValidateAgainstCorrectBranchThenVsElse.md +docs/servers/RootServer0.md +settings.gradle.kts +src/main/kotlin/org/openapijsonschematools/client/RootServerInfo.kt +src/main/kotlin/org/openapijsonschematools/client/components/schemas/ASchemaGivenForPrefixitems.kt +src/main/kotlin/org/openapijsonschematools/client/components/schemas/AdditionalItemsAreAllowedByDefault.kt +src/main/kotlin/org/openapijsonschematools/client/components/schemas/AdditionalpropertiesAreAllowedByDefault.kt +src/main/kotlin/org/openapijsonschematools/client/components/schemas/AdditionalpropertiesCanExistByItself.kt +src/main/kotlin/org/openapijsonschematools/client/components/schemas/AdditionalpropertiesDoesNotLookInApplicators.kt +src/main/kotlin/org/openapijsonschematools/client/components/schemas/AdditionalpropertiesWithNullValuedInstanceProperties.kt +src/main/kotlin/org/openapijsonschematools/client/components/schemas/AdditionalpropertiesWithSchema.kt +src/main/kotlin/org/openapijsonschematools/client/components/schemas/Allof.kt +src/main/kotlin/org/openapijsonschematools/client/components/schemas/AllofCombinedWithAnyofOneof.kt +src/main/kotlin/org/openapijsonschematools/client/components/schemas/AllofSimpleTypes.kt +src/main/kotlin/org/openapijsonschematools/client/components/schemas/AllofWithBaseSchema.kt +src/main/kotlin/org/openapijsonschematools/client/components/schemas/AllofWithOneEmptySchema.kt +src/main/kotlin/org/openapijsonschematools/client/components/schemas/AllofWithTheFirstEmptySchema.kt +src/main/kotlin/org/openapijsonschematools/client/components/schemas/AllofWithTheLastEmptySchema.kt +src/main/kotlin/org/openapijsonschematools/client/components/schemas/AllofWithTwoEmptySchemas.kt +src/main/kotlin/org/openapijsonschematools/client/components/schemas/Anyof.kt +src/main/kotlin/org/openapijsonschematools/client/components/schemas/AnyofComplexTypes.kt +src/main/kotlin/org/openapijsonschematools/client/components/schemas/AnyofWithBaseSchema.kt +src/main/kotlin/org/openapijsonschematools/client/components/schemas/AnyofWithOneEmptySchema.kt +src/main/kotlin/org/openapijsonschematools/client/components/schemas/ArrayTypeMatchesArrays.kt +src/main/kotlin/org/openapijsonschematools/client/components/schemas/BooleanTypeMatchesBooleans.kt +src/main/kotlin/org/openapijsonschematools/client/components/schemas/ByInt.kt +src/main/kotlin/org/openapijsonschematools/client/components/schemas/ByNumber.kt +src/main/kotlin/org/openapijsonschematools/client/components/schemas/BySmallNumber.kt +src/main/kotlin/org/openapijsonschematools/client/components/schemas/ConstNulCharactersInStrings.kt +src/main/kotlin/org/openapijsonschematools/client/components/schemas/ContainsKeywordValidation.kt +src/main/kotlin/org/openapijsonschematools/client/components/schemas/ContainsWithNullInstanceElements.kt +src/main/kotlin/org/openapijsonschematools/client/components/schemas/DateFormat.kt +src/main/kotlin/org/openapijsonschematools/client/components/schemas/DateTimeFormat.kt +src/main/kotlin/org/openapijsonschematools/client/components/schemas/DependentSchemasDependenciesWithEscapedCharacters.kt +src/main/kotlin/org/openapijsonschematools/client/components/schemas/DependentSchemasDependentSubschemaIncompatibleWithRoot.kt +src/main/kotlin/org/openapijsonschematools/client/components/schemas/DependentSchemasSingleDependency.kt +src/main/kotlin/org/openapijsonschematools/client/components/schemas/DurationFormat.kt +src/main/kotlin/org/openapijsonschematools/client/components/schemas/EmailFormat.kt +src/main/kotlin/org/openapijsonschematools/client/components/schemas/EmptyDependents.kt +src/main/kotlin/org/openapijsonschematools/client/components/schemas/EnumWith0DoesNotMatchFalse.kt +src/main/kotlin/org/openapijsonschematools/client/components/schemas/EnumWith1DoesNotMatchTrue.kt +src/main/kotlin/org/openapijsonschematools/client/components/schemas/EnumWithEscapedCharacters.kt +src/main/kotlin/org/openapijsonschematools/client/components/schemas/EnumWithFalseDoesNotMatch0.kt +src/main/kotlin/org/openapijsonschematools/client/components/schemas/EnumWithTrueDoesNotMatch1.kt +src/main/kotlin/org/openapijsonschematools/client/components/schemas/EnumsInProperties.kt +src/main/kotlin/org/openapijsonschematools/client/components/schemas/ExclusivemaximumValidation.kt +src/main/kotlin/org/openapijsonschematools/client/components/schemas/ExclusiveminimumValidation.kt +src/main/kotlin/org/openapijsonschematools/client/components/schemas/FloatDivisionInf.kt +src/main/kotlin/org/openapijsonschematools/client/components/schemas/ForbiddenProperty.kt +src/main/kotlin/org/openapijsonschematools/client/components/schemas/HostnameFormat.kt +src/main/kotlin/org/openapijsonschematools/client/components/schemas/IdnEmailFormat.kt +src/main/kotlin/org/openapijsonschematools/client/components/schemas/IdnHostnameFormat.kt +src/main/kotlin/org/openapijsonschematools/client/components/schemas/IfAndElseWithoutThen.kt +src/main/kotlin/org/openapijsonschematools/client/components/schemas/IfAndThenWithoutElse.kt +src/main/kotlin/org/openapijsonschematools/client/components/schemas/IfAppearsAtTheEndWhenSerializedKeywordProcessingSequence.kt +src/main/kotlin/org/openapijsonschematools/client/components/schemas/IgnoreElseWithoutIf.kt +src/main/kotlin/org/openapijsonschematools/client/components/schemas/IgnoreIfWithoutThenOrElse.kt +src/main/kotlin/org/openapijsonschematools/client/components/schemas/IgnoreThenWithoutIf.kt +src/main/kotlin/org/openapijsonschematools/client/components/schemas/IntegerTypeMatchesIntegers.kt +src/main/kotlin/org/openapijsonschematools/client/components/schemas/Ipv4Format.kt +src/main/kotlin/org/openapijsonschematools/client/components/schemas/Ipv6Format.kt +src/main/kotlin/org/openapijsonschematools/client/components/schemas/IriFormat.kt +src/main/kotlin/org/openapijsonschematools/client/components/schemas/IriReferenceFormat.kt +src/main/kotlin/org/openapijsonschematools/client/components/schemas/ItemsContains.kt +src/main/kotlin/org/openapijsonschematools/client/components/schemas/ItemsDoesNotLookInApplicatorsValidCase.kt +src/main/kotlin/org/openapijsonschematools/client/components/schemas/ItemsWithNullInstanceElements.kt +src/main/kotlin/org/openapijsonschematools/client/components/schemas/JsonPointerFormat.kt +src/main/kotlin/org/openapijsonschematools/client/components/schemas/MaxcontainsWithoutContainsIsIgnored.kt +src/main/kotlin/org/openapijsonschematools/client/components/schemas/MaximumValidation.kt +src/main/kotlin/org/openapijsonschematools/client/components/schemas/MaximumValidationWithUnsignedInteger.kt +src/main/kotlin/org/openapijsonschematools/client/components/schemas/MaxitemsValidation.kt +src/main/kotlin/org/openapijsonschematools/client/components/schemas/MaxlengthValidation.kt +src/main/kotlin/org/openapijsonschematools/client/components/schemas/Maxproperties0MeansTheObjectIsEmpty.kt +src/main/kotlin/org/openapijsonschematools/client/components/schemas/MaxpropertiesValidation.kt +src/main/kotlin/org/openapijsonschematools/client/components/schemas/MincontainsWithoutContainsIsIgnored.kt +src/main/kotlin/org/openapijsonschematools/client/components/schemas/MinimumValidation.kt +src/main/kotlin/org/openapijsonschematools/client/components/schemas/MinimumValidationWithSignedInteger.kt +src/main/kotlin/org/openapijsonschematools/client/components/schemas/MinitemsValidation.kt +src/main/kotlin/org/openapijsonschematools/client/components/schemas/MinlengthValidation.kt +src/main/kotlin/org/openapijsonschematools/client/components/schemas/MinpropertiesValidation.kt +src/main/kotlin/org/openapijsonschematools/client/components/schemas/MultipleDependentsRequired.kt +src/main/kotlin/org/openapijsonschematools/client/components/schemas/MultipleSimultaneousPatternpropertiesAreValidated.kt +src/main/kotlin/org/openapijsonschematools/client/components/schemas/MultipleTypesCanBeSpecifiedInAnArray.kt +src/main/kotlin/org/openapijsonschematools/client/components/schemas/NestedAllofToCheckValidationSemantics.kt +src/main/kotlin/org/openapijsonschematools/client/components/schemas/NestedAnyofToCheckValidationSemantics.kt +src/main/kotlin/org/openapijsonschematools/client/components/schemas/NestedItems.kt +src/main/kotlin/org/openapijsonschematools/client/components/schemas/NestedOneofToCheckValidationSemantics.kt +src/main/kotlin/org/openapijsonschematools/client/components/schemas/NonAsciiPatternWithAdditionalproperties.kt +src/main/kotlin/org/openapijsonschematools/client/components/schemas/NonInterferenceAcrossCombinedSchemas.kt +src/main/kotlin/org/openapijsonschematools/client/components/schemas/Not.kt +src/main/kotlin/org/openapijsonschematools/client/components/schemas/NotMoreComplexSchema.kt +src/main/kotlin/org/openapijsonschematools/client/components/schemas/NotMultipleTypes.kt +src/main/kotlin/org/openapijsonschematools/client/components/schemas/NulCharactersInStrings.kt +src/main/kotlin/org/openapijsonschematools/client/components/schemas/NullTypeMatchesOnlyTheNullObject.kt +src/main/kotlin/org/openapijsonschematools/client/components/schemas/NumberTypeMatchesNumbers.kt +src/main/kotlin/org/openapijsonschematools/client/components/schemas/ObjectPropertiesValidation.kt +src/main/kotlin/org/openapijsonschematools/client/components/schemas/ObjectTypeMatchesObjects.kt +src/main/kotlin/org/openapijsonschematools/client/components/schemas/Oneof.kt +src/main/kotlin/org/openapijsonschematools/client/components/schemas/OneofComplexTypes.kt +src/main/kotlin/org/openapijsonschematools/client/components/schemas/OneofWithBaseSchema.kt +src/main/kotlin/org/openapijsonschematools/client/components/schemas/OneofWithEmptySchema.kt +src/main/kotlin/org/openapijsonschematools/client/components/schemas/OneofWithRequired.kt +src/main/kotlin/org/openapijsonschematools/client/components/schemas/PatternIsNotAnchored.kt +src/main/kotlin/org/openapijsonschematools/client/components/schemas/PatternValidation.kt +src/main/kotlin/org/openapijsonschematools/client/components/schemas/PatternpropertiesValidatesPropertiesMatchingARegex.kt +src/main/kotlin/org/openapijsonschematools/client/components/schemas/PatternpropertiesWithNullValuedInstanceProperties.kt +src/main/kotlin/org/openapijsonschematools/client/components/schemas/PrefixitemsValidationAdjustsTheStartingIndexForItems.kt +src/main/kotlin/org/openapijsonschematools/client/components/schemas/PrefixitemsWithNullInstanceElements.kt +src/main/kotlin/org/openapijsonschematools/client/components/schemas/PropertiesPatternpropertiesAdditionalpropertiesInteraction.kt +src/main/kotlin/org/openapijsonschematools/client/components/schemas/PropertiesWhoseNamesAreJavascriptObjectPropertyNames.kt +src/main/kotlin/org/openapijsonschematools/client/components/schemas/PropertiesWithEscapedCharacters.kt +src/main/kotlin/org/openapijsonschematools/client/components/schemas/PropertiesWithNullValuedInstanceProperties.kt +src/main/kotlin/org/openapijsonschematools/client/components/schemas/PropertyNamedRefThatIsNotAReference.kt +src/main/kotlin/org/openapijsonschematools/client/components/schemas/PropertynamesValidation.kt +src/main/kotlin/org/openapijsonschematools/client/components/schemas/RegexFormat.kt +src/main/kotlin/org/openapijsonschematools/client/components/schemas/RegexesAreNotAnchoredByDefaultAndAreCaseSensitive.kt +src/main/kotlin/org/openapijsonschematools/client/components/schemas/RelativeJsonPointerFormat.kt +src/main/kotlin/org/openapijsonschematools/client/components/schemas/RequiredDefaultValidation.kt +src/main/kotlin/org/openapijsonschematools/client/components/schemas/RequiredPropertiesWhoseNamesAreJavascriptObjectPropertyNames.kt +src/main/kotlin/org/openapijsonschematools/client/components/schemas/RequiredValidation.kt +src/main/kotlin/org/openapijsonschematools/client/components/schemas/RequiredWithEmptyArray.kt +src/main/kotlin/org/openapijsonschematools/client/components/schemas/RequiredWithEscapedCharacters.kt +src/main/kotlin/org/openapijsonschematools/client/components/schemas/SimpleEnumValidation.kt +src/main/kotlin/org/openapijsonschematools/client/components/schemas/SingleDependency.kt +src/main/kotlin/org/openapijsonschematools/client/components/schemas/SmallMultipleOfLargeInteger.kt +src/main/kotlin/org/openapijsonschematools/client/components/schemas/StringTypeMatchesStrings.kt +src/main/kotlin/org/openapijsonschematools/client/components/schemas/TimeFormat.kt +src/main/kotlin/org/openapijsonschematools/client/components/schemas/TypeArrayObjectOrNull.kt +src/main/kotlin/org/openapijsonschematools/client/components/schemas/TypeArrayOrObject.kt +src/main/kotlin/org/openapijsonschematools/client/components/schemas/TypeAsArrayWithOneItem.kt +src/main/kotlin/org/openapijsonschematools/client/components/schemas/UnevaluateditemsAsSchema.kt +src/main/kotlin/org/openapijsonschematools/client/components/schemas/UnevaluateditemsDependsOnMultipleNestedContains.kt +src/main/kotlin/org/openapijsonschematools/client/components/schemas/UnevaluateditemsWithItems.kt +src/main/kotlin/org/openapijsonschematools/client/components/schemas/UnevaluateditemsWithNullInstanceElements.kt +src/main/kotlin/org/openapijsonschematools/client/components/schemas/UnevaluatedpropertiesNotAffectedByPropertynames.kt +src/main/kotlin/org/openapijsonschematools/client/components/schemas/UnevaluatedpropertiesSchema.kt +src/main/kotlin/org/openapijsonschematools/client/components/schemas/UnevaluatedpropertiesWithAdjacentAdditionalproperties.kt +src/main/kotlin/org/openapijsonschematools/client/components/schemas/UnevaluatedpropertiesWithNullValuedInstanceProperties.kt +src/main/kotlin/org/openapijsonschematools/client/components/schemas/UniqueitemsFalseValidation.kt +src/main/kotlin/org/openapijsonschematools/client/components/schemas/UniqueitemsFalseWithAnArrayOfItems.kt +src/main/kotlin/org/openapijsonschematools/client/components/schemas/UniqueitemsValidation.kt +src/main/kotlin/org/openapijsonschematools/client/components/schemas/UniqueitemsWithAnArrayOfItems.kt +src/main/kotlin/org/openapijsonschematools/client/components/schemas/UriFormat.kt +src/main/kotlin/org/openapijsonschematools/client/components/schemas/UriReferenceFormat.kt +src/main/kotlin/org/openapijsonschematools/client/components/schemas/UriTemplateFormat.kt +src/main/kotlin/org/openapijsonschematools/client/components/schemas/UuidFormat.kt +src/main/kotlin/org/openapijsonschematools/client/components/schemas/ValidateAgainstCorrectBranchThenVsElse.kt +src/main/kotlin/org/openapijsonschematools/client/configurations/JsonSchemaKeywordFlags.kt +src/main/kotlin/org/openapijsonschematools/client/configurations/SchemaConfiguration.kt +src/main/kotlin/org/openapijsonschematools/client/exceptions/BaseException.kt +src/main/kotlin/org/openapijsonschematools/client/exceptions/InvalidAdditionalPropertyException.kt +src/main/kotlin/org/openapijsonschematools/client/exceptions/UnsetPropertyException.kt +src/main/kotlin/org/openapijsonschematools/client/exceptions/ValidationException.kt +src/main/kotlin/org/openapijsonschematools/client/schemas/AnyTypeJsonSchema.kt +src/main/kotlin/org/openapijsonschematools/client/schemas/BooleanJsonSchema.kt +src/main/kotlin/org/openapijsonschematools/client/schemas/DateJsonSchema.kt +src/main/kotlin/org/openapijsonschematools/client/schemas/DateTimeJsonSchema.kt +src/main/kotlin/org/openapijsonschematools/client/schemas/DecimalJsonSchema.kt +src/main/kotlin/org/openapijsonschematools/client/schemas/DoubleJsonSchema.kt +src/main/kotlin/org/openapijsonschematools/client/schemas/FloatJsonSchema.kt +src/main/kotlin/org/openapijsonschematools/client/schemas/GenericBuilder.kt +src/main/kotlin/org/openapijsonschematools/client/schemas/Int32JsonSchema.kt +src/main/kotlin/org/openapijsonschematools/client/schemas/Int64JsonSchema.kt +src/main/kotlin/org/openapijsonschematools/client/schemas/IntJsonSchema.kt +src/main/kotlin/org/openapijsonschematools/client/schemas/ListJsonSchema.kt +src/main/kotlin/org/openapijsonschematools/client/schemas/MapJsonSchema.kt +src/main/kotlin/org/openapijsonschematools/client/schemas/NotAnyTypeJsonSchema.kt +src/main/kotlin/org/openapijsonschematools/client/schemas/NullJsonSchema.kt +src/main/kotlin/org/openapijsonschematools/client/schemas/NumberJsonSchema.kt +src/main/kotlin/org/openapijsonschematools/client/schemas/StringJsonSchema.kt +src/main/kotlin/org/openapijsonschematools/client/schemas/UnsetAddPropsSetter.kt +src/main/kotlin/org/openapijsonschematools/client/schemas/UuidJsonSchema.kt +src/main/kotlin/org/openapijsonschematools/client/schemas/validation/AdditionalPropertiesValidator.kt +src/main/kotlin/org/openapijsonschematools/client/schemas/validation/AllOfValidator.kt +src/main/kotlin/org/openapijsonschematools/client/schemas/validation/AnyOfValidator.kt +src/main/kotlin/org/openapijsonschematools/client/schemas/validation/BigDecimalValidator.kt +src/main/kotlin/org/openapijsonschematools/client/schemas/validation/BooleanEnumValidator.kt +src/main/kotlin/org/openapijsonschematools/client/schemas/validation/BooleanSchemaValidator.kt +src/main/kotlin/org/openapijsonschematools/client/schemas/validation/BooleanValueMethod.kt +src/main/kotlin/org/openapijsonschematools/client/schemas/validation/ConstValidator.kt +src/main/kotlin/org/openapijsonschematools/client/schemas/validation/ContainsValidator.kt +src/main/kotlin/org/openapijsonschematools/client/schemas/validation/CustomIsoparser.kt +src/main/kotlin/org/openapijsonschematools/client/schemas/validation/DefaultValueMethod.kt +src/main/kotlin/org/openapijsonschematools/client/schemas/validation/DependentRequiredValidator.kt +src/main/kotlin/org/openapijsonschematools/client/schemas/validation/DependentSchemasValidator.kt +src/main/kotlin/org/openapijsonschematools/client/schemas/validation/DoubleEnumValidator.kt +src/main/kotlin/org/openapijsonschematools/client/schemas/validation/DoubleValueMethod.kt +src/main/kotlin/org/openapijsonschematools/client/schemas/validation/ElseValidator.kt +src/main/kotlin/org/openapijsonschematools/client/schemas/validation/EnumValidator.kt +src/main/kotlin/org/openapijsonschematools/client/schemas/validation/ExclusiveMaximumValidator.kt +src/main/kotlin/org/openapijsonschematools/client/schemas/validation/ExclusiveMinimumValidator.kt +src/main/kotlin/org/openapijsonschematools/client/schemas/validation/FloatEnumValidator.kt +src/main/kotlin/org/openapijsonschematools/client/schemas/validation/FloatValueMethod.kt +src/main/kotlin/org/openapijsonschematools/client/schemas/validation/FormatValidator.kt +src/main/kotlin/org/openapijsonschematools/client/schemas/validation/FrozenList.kt +src/main/kotlin/org/openapijsonschematools/client/schemas/validation/FrozenMap.kt +src/main/kotlin/org/openapijsonschematools/client/schemas/validation/IfValidator.kt +src/main/kotlin/org/openapijsonschematools/client/schemas/validation/IntegerEnumValidator.kt +src/main/kotlin/org/openapijsonschematools/client/schemas/validation/IntegerValueMethod.kt +src/main/kotlin/org/openapijsonschematools/client/schemas/validation/ItemsValidator.kt +src/main/kotlin/org/openapijsonschematools/client/schemas/validation/JsonSchema.kt +src/main/kotlin/org/openapijsonschematools/client/schemas/validation/JsonSchemaFactory.kt +src/main/kotlin/org/openapijsonschematools/client/schemas/validation/JsonSchemaInfo.kt +src/main/kotlin/org/openapijsonschematools/client/schemas/validation/KeywordEntry.kt +src/main/kotlin/org/openapijsonschematools/client/schemas/validation/KeywordValidator.kt +src/main/kotlin/org/openapijsonschematools/client/schemas/validation/LengthValidator.kt +src/main/kotlin/org/openapijsonschematools/client/schemas/validation/ListSchemaValidator.kt +src/main/kotlin/org/openapijsonschematools/client/schemas/validation/LongEnumValidator.kt +src/main/kotlin/org/openapijsonschematools/client/schemas/validation/LongValueMethod.kt +src/main/kotlin/org/openapijsonschematools/client/schemas/validation/MapSchemaValidator.kt +src/main/kotlin/org/openapijsonschematools/client/schemas/validation/MapUtils.kt +src/main/kotlin/org/openapijsonschematools/client/schemas/validation/MaxContainsValidator.kt +src/main/kotlin/org/openapijsonschematools/client/schemas/validation/MaxItemsValidator.kt +src/main/kotlin/org/openapijsonschematools/client/schemas/validation/MaxLengthValidator.kt +src/main/kotlin/org/openapijsonschematools/client/schemas/validation/MaxPropertiesValidator.kt +src/main/kotlin/org/openapijsonschematools/client/schemas/validation/MaximumValidator.kt +src/main/kotlin/org/openapijsonschematools/client/schemas/validation/MinContainsValidator.kt +src/main/kotlin/org/openapijsonschematools/client/schemas/validation/MinItemsValidator.kt +src/main/kotlin/org/openapijsonschematools/client/schemas/validation/MinLengthValidator.kt +src/main/kotlin/org/openapijsonschematools/client/schemas/validation/MinPropertiesValidator.kt +src/main/kotlin/org/openapijsonschematools/client/schemas/validation/MinimumValidator.kt +src/main/kotlin/org/openapijsonschematools/client/schemas/validation/MultipleOfValidator.kt +src/main/kotlin/org/openapijsonschematools/client/schemas/validation/NotValidator.kt +src/main/kotlin/org/openapijsonschematools/client/schemas/validation/NullEnumValidator.kt +src/main/kotlin/org/openapijsonschematools/client/schemas/validation/NullSchemaValidator.kt +src/main/kotlin/org/openapijsonschematools/client/schemas/validation/NullValueMethod.kt +src/main/kotlin/org/openapijsonschematools/client/schemas/validation/NumberSchemaValidator.kt +src/main/kotlin/org/openapijsonschematools/client/schemas/validation/OneOfValidator.kt +src/main/kotlin/org/openapijsonschematools/client/schemas/validation/PathToSchemasMap.kt +src/main/kotlin/org/openapijsonschematools/client/schemas/validation/PatternPropertiesValidator.kt +src/main/kotlin/org/openapijsonschematools/client/schemas/validation/PatternValidator.kt +src/main/kotlin/org/openapijsonschematools/client/schemas/validation/PrefixItemsValidator.kt +src/main/kotlin/org/openapijsonschematools/client/schemas/validation/PropertiesValidator.kt +src/main/kotlin/org/openapijsonschematools/client/schemas/validation/PropertyNamesValidator.kt +src/main/kotlin/org/openapijsonschematools/client/schemas/validation/RequiredValidator.kt +src/main/kotlin/org/openapijsonschematools/client/schemas/validation/StringEnumValidator.kt +src/main/kotlin/org/openapijsonschematools/client/schemas/validation/StringSchemaValidator.kt +src/main/kotlin/org/openapijsonschematools/client/schemas/validation/StringValueMethod.kt +src/main/kotlin/org/openapijsonschematools/client/schemas/validation/ThenValidator.kt +src/main/kotlin/org/openapijsonschematools/client/schemas/validation/TypeValidator.kt +src/main/kotlin/org/openapijsonschematools/client/schemas/validation/UnevaluatedItemsValidator.kt +src/main/kotlin/org/openapijsonschematools/client/schemas/validation/UnevaluatedPropertiesValidator.kt +src/main/kotlin/org/openapijsonschematools/client/schemas/validation/UniqueItemsValidator.kt +src/main/kotlin/org/openapijsonschematools/client/schemas/validation/UnsetAnyTypeJsonSchema.kt +src/main/kotlin/org/openapijsonschematools/client/schemas/validation/ValidationData.kt +src/main/kotlin/org/openapijsonschematools/client/schemas/validation/ValidationMetadata.kt +src/main/kotlin/org/openapijsonschematools/client/servers/RootServer0.kt +src/main/kotlin/org/openapijsonschematools/client/servers/Server.kt +src/main/kotlin/org/openapijsonschematools/client/servers/ServerProvider.kt +src/main/kotlin/org/openapijsonschematools/client/servers/ServerWithVariables.kt +src/main/kotlin/org/openapijsonschematools/client/servers/ServerWithoutVariables.kt +src/test/kotlin/org/openapijsonschematools/client/components/schemas/ASchemaGivenForPrefixitemsTest.kt +src/test/kotlin/org/openapijsonschematools/client/components/schemas/AdditionalItemsAreAllowedByDefaultTest.kt +src/test/kotlin/org/openapijsonschematools/client/components/schemas/AdditionalpropertiesAreAllowedByDefaultTest.kt +src/test/kotlin/org/openapijsonschematools/client/components/schemas/AdditionalpropertiesCanExistByItselfTest.kt +src/test/kotlin/org/openapijsonschematools/client/components/schemas/AdditionalpropertiesDoesNotLookInApplicatorsTest.kt +src/test/kotlin/org/openapijsonschematools/client/components/schemas/AdditionalpropertiesWithNullValuedInstancePropertiesTest.kt +src/test/kotlin/org/openapijsonschematools/client/components/schemas/AdditionalpropertiesWithSchemaTest.kt +src/test/kotlin/org/openapijsonschematools/client/components/schemas/AllofCombinedWithAnyofOneofTest.kt +src/test/kotlin/org/openapijsonschematools/client/components/schemas/AllofSimpleTypesTest.kt +src/test/kotlin/org/openapijsonschematools/client/components/schemas/AllofTest.kt +src/test/kotlin/org/openapijsonschematools/client/components/schemas/AllofWithBaseSchemaTest.kt +src/test/kotlin/org/openapijsonschematools/client/components/schemas/AllofWithOneEmptySchemaTest.kt +src/test/kotlin/org/openapijsonschematools/client/components/schemas/AllofWithTheFirstEmptySchemaTest.kt +src/test/kotlin/org/openapijsonschematools/client/components/schemas/AllofWithTheLastEmptySchemaTest.kt +src/test/kotlin/org/openapijsonschematools/client/components/schemas/AllofWithTwoEmptySchemasTest.kt +src/test/kotlin/org/openapijsonschematools/client/components/schemas/AnyofComplexTypesTest.kt +src/test/kotlin/org/openapijsonschematools/client/components/schemas/AnyofTest.kt +src/test/kotlin/org/openapijsonschematools/client/components/schemas/AnyofWithBaseSchemaTest.kt +src/test/kotlin/org/openapijsonschematools/client/components/schemas/AnyofWithOneEmptySchemaTest.kt +src/test/kotlin/org/openapijsonschematools/client/components/schemas/ArrayTypeMatchesArraysTest.kt +src/test/kotlin/org/openapijsonschematools/client/components/schemas/BooleanTypeMatchesBooleansTest.kt +src/test/kotlin/org/openapijsonschematools/client/components/schemas/ByIntTest.kt +src/test/kotlin/org/openapijsonschematools/client/components/schemas/ByNumberTest.kt +src/test/kotlin/org/openapijsonschematools/client/components/schemas/BySmallNumberTest.kt +src/test/kotlin/org/openapijsonschematools/client/components/schemas/ConstNulCharactersInStringsTest.kt +src/test/kotlin/org/openapijsonschematools/client/components/schemas/ContainsKeywordValidationTest.kt +src/test/kotlin/org/openapijsonschematools/client/components/schemas/ContainsWithNullInstanceElementsTest.kt +src/test/kotlin/org/openapijsonschematools/client/components/schemas/DateFormatTest.kt +src/test/kotlin/org/openapijsonschematools/client/components/schemas/DateTimeFormatTest.kt +src/test/kotlin/org/openapijsonschematools/client/components/schemas/DependentSchemasDependenciesWithEscapedCharactersTest.kt +src/test/kotlin/org/openapijsonschematools/client/components/schemas/DependentSchemasDependentSubschemaIncompatibleWithRootTest.kt +src/test/kotlin/org/openapijsonschematools/client/components/schemas/DependentSchemasSingleDependencyTest.kt +src/test/kotlin/org/openapijsonschematools/client/components/schemas/DurationFormatTest.kt +src/test/kotlin/org/openapijsonschematools/client/components/schemas/EmailFormatTest.kt +src/test/kotlin/org/openapijsonschematools/client/components/schemas/EmptyDependentsTest.kt +src/test/kotlin/org/openapijsonschematools/client/components/schemas/EnumWith0DoesNotMatchFalseTest.kt +src/test/kotlin/org/openapijsonschematools/client/components/schemas/EnumWith1DoesNotMatchTrueTest.kt +src/test/kotlin/org/openapijsonschematools/client/components/schemas/EnumWithEscapedCharactersTest.kt +src/test/kotlin/org/openapijsonschematools/client/components/schemas/EnumWithFalseDoesNotMatch0Test.kt +src/test/kotlin/org/openapijsonschematools/client/components/schemas/EnumWithTrueDoesNotMatch1Test.kt +src/test/kotlin/org/openapijsonschematools/client/components/schemas/EnumsInPropertiesTest.kt +src/test/kotlin/org/openapijsonschematools/client/components/schemas/ExclusivemaximumValidationTest.kt +src/test/kotlin/org/openapijsonschematools/client/components/schemas/ExclusiveminimumValidationTest.kt +src/test/kotlin/org/openapijsonschematools/client/components/schemas/FloatDivisionInfTest.kt +src/test/kotlin/org/openapijsonschematools/client/components/schemas/ForbiddenPropertyTest.kt +src/test/kotlin/org/openapijsonschematools/client/components/schemas/HostnameFormatTest.kt +src/test/kotlin/org/openapijsonschematools/client/components/schemas/IdnEmailFormatTest.kt +src/test/kotlin/org/openapijsonschematools/client/components/schemas/IdnHostnameFormatTest.kt +src/test/kotlin/org/openapijsonschematools/client/components/schemas/IfAndElseWithoutThenTest.kt +src/test/kotlin/org/openapijsonschematools/client/components/schemas/IfAndThenWithoutElseTest.kt +src/test/kotlin/org/openapijsonschematools/client/components/schemas/IfAppearsAtTheEndWhenSerializedKeywordProcessingSequenceTest.kt +src/test/kotlin/org/openapijsonschematools/client/components/schemas/IgnoreElseWithoutIfTest.kt +src/test/kotlin/org/openapijsonschematools/client/components/schemas/IgnoreIfWithoutThenOrElseTest.kt +src/test/kotlin/org/openapijsonschematools/client/components/schemas/IgnoreThenWithoutIfTest.kt +src/test/kotlin/org/openapijsonschematools/client/components/schemas/IntegerTypeMatchesIntegersTest.kt +src/test/kotlin/org/openapijsonschematools/client/components/schemas/Ipv4FormatTest.kt +src/test/kotlin/org/openapijsonschematools/client/components/schemas/Ipv6FormatTest.kt +src/test/kotlin/org/openapijsonschematools/client/components/schemas/IriFormatTest.kt +src/test/kotlin/org/openapijsonschematools/client/components/schemas/IriReferenceFormatTest.kt +src/test/kotlin/org/openapijsonschematools/client/components/schemas/ItemsContainsTest.kt +src/test/kotlin/org/openapijsonschematools/client/components/schemas/ItemsDoesNotLookInApplicatorsValidCaseTest.kt +src/test/kotlin/org/openapijsonschematools/client/components/schemas/ItemsWithNullInstanceElementsTest.kt +src/test/kotlin/org/openapijsonschematools/client/components/schemas/JsonPointerFormatTest.kt +src/test/kotlin/org/openapijsonschematools/client/components/schemas/MaxcontainsWithoutContainsIsIgnoredTest.kt +src/test/kotlin/org/openapijsonschematools/client/components/schemas/MaximumValidationTest.kt +src/test/kotlin/org/openapijsonschematools/client/components/schemas/MaximumValidationWithUnsignedIntegerTest.kt +src/test/kotlin/org/openapijsonschematools/client/components/schemas/MaxitemsValidationTest.kt +src/test/kotlin/org/openapijsonschematools/client/components/schemas/MaxlengthValidationTest.kt +src/test/kotlin/org/openapijsonschematools/client/components/schemas/Maxproperties0MeansTheObjectIsEmptyTest.kt +src/test/kotlin/org/openapijsonschematools/client/components/schemas/MaxpropertiesValidationTest.kt +src/test/kotlin/org/openapijsonschematools/client/components/schemas/MincontainsWithoutContainsIsIgnoredTest.kt +src/test/kotlin/org/openapijsonschematools/client/components/schemas/MinimumValidationTest.kt +src/test/kotlin/org/openapijsonschematools/client/components/schemas/MinimumValidationWithSignedIntegerTest.kt +src/test/kotlin/org/openapijsonschematools/client/components/schemas/MinitemsValidationTest.kt +src/test/kotlin/org/openapijsonschematools/client/components/schemas/MinlengthValidationTest.kt +src/test/kotlin/org/openapijsonschematools/client/components/schemas/MinpropertiesValidationTest.kt +src/test/kotlin/org/openapijsonschematools/client/components/schemas/MultipleDependentsRequiredTest.kt +src/test/kotlin/org/openapijsonschematools/client/components/schemas/MultipleSimultaneousPatternpropertiesAreValidatedTest.kt +src/test/kotlin/org/openapijsonschematools/client/components/schemas/MultipleTypesCanBeSpecifiedInAnArrayTest.kt +src/test/kotlin/org/openapijsonschematools/client/components/schemas/NestedAllofToCheckValidationSemanticsTest.kt +src/test/kotlin/org/openapijsonschematools/client/components/schemas/NestedAnyofToCheckValidationSemanticsTest.kt +src/test/kotlin/org/openapijsonschematools/client/components/schemas/NestedItemsTest.kt +src/test/kotlin/org/openapijsonschematools/client/components/schemas/NestedOneofToCheckValidationSemanticsTest.kt +src/test/kotlin/org/openapijsonschematools/client/components/schemas/NonAsciiPatternWithAdditionalpropertiesTest.kt +src/test/kotlin/org/openapijsonschematools/client/components/schemas/NonInterferenceAcrossCombinedSchemasTest.kt +src/test/kotlin/org/openapijsonschematools/client/components/schemas/NotMoreComplexSchemaTest.kt +src/test/kotlin/org/openapijsonschematools/client/components/schemas/NotMultipleTypesTest.kt +src/test/kotlin/org/openapijsonschematools/client/components/schemas/NotTest.kt +src/test/kotlin/org/openapijsonschematools/client/components/schemas/NulCharactersInStringsTest.kt +src/test/kotlin/org/openapijsonschematools/client/components/schemas/NullTypeMatchesOnlyTheNullObjectTest.kt +src/test/kotlin/org/openapijsonschematools/client/components/schemas/NumberTypeMatchesNumbersTest.kt +src/test/kotlin/org/openapijsonschematools/client/components/schemas/ObjectPropertiesValidationTest.kt +src/test/kotlin/org/openapijsonschematools/client/components/schemas/ObjectTypeMatchesObjectsTest.kt +src/test/kotlin/org/openapijsonschematools/client/components/schemas/OneofComplexTypesTest.kt +src/test/kotlin/org/openapijsonschematools/client/components/schemas/OneofTest.kt +src/test/kotlin/org/openapijsonschematools/client/components/schemas/OneofWithBaseSchemaTest.kt +src/test/kotlin/org/openapijsonschematools/client/components/schemas/OneofWithEmptySchemaTest.kt +src/test/kotlin/org/openapijsonschematools/client/components/schemas/OneofWithRequiredTest.kt +src/test/kotlin/org/openapijsonschematools/client/components/schemas/PatternIsNotAnchoredTest.kt +src/test/kotlin/org/openapijsonschematools/client/components/schemas/PatternValidationTest.kt +src/test/kotlin/org/openapijsonschematools/client/components/schemas/PatternpropertiesValidatesPropertiesMatchingARegexTest.kt +src/test/kotlin/org/openapijsonschematools/client/components/schemas/PatternpropertiesWithNullValuedInstancePropertiesTest.kt +src/test/kotlin/org/openapijsonschematools/client/components/schemas/PrefixitemsValidationAdjustsTheStartingIndexForItemsTest.kt +src/test/kotlin/org/openapijsonschematools/client/components/schemas/PrefixitemsWithNullInstanceElementsTest.kt +src/test/kotlin/org/openapijsonschematools/client/components/schemas/PropertiesPatternpropertiesAdditionalpropertiesInteractionTest.kt +src/test/kotlin/org/openapijsonschematools/client/components/schemas/PropertiesWhoseNamesAreJavascriptObjectPropertyNamesTest.kt +src/test/kotlin/org/openapijsonschematools/client/components/schemas/PropertiesWithEscapedCharactersTest.kt +src/test/kotlin/org/openapijsonschematools/client/components/schemas/PropertiesWithNullValuedInstancePropertiesTest.kt +src/test/kotlin/org/openapijsonschematools/client/components/schemas/PropertyNamedRefThatIsNotAReferenceTest.kt +src/test/kotlin/org/openapijsonschematools/client/components/schemas/PropertynamesValidationTest.kt +src/test/kotlin/org/openapijsonschematools/client/components/schemas/RegexFormatTest.kt +src/test/kotlin/org/openapijsonschematools/client/components/schemas/RegexesAreNotAnchoredByDefaultAndAreCaseSensitiveTest.kt +src/test/kotlin/org/openapijsonschematools/client/components/schemas/RelativeJsonPointerFormatTest.kt +src/test/kotlin/org/openapijsonschematools/client/components/schemas/RequiredDefaultValidationTest.kt +src/test/kotlin/org/openapijsonschematools/client/components/schemas/RequiredPropertiesWhoseNamesAreJavascriptObjectPropertyNamesTest.kt +src/test/kotlin/org/openapijsonschematools/client/components/schemas/RequiredValidationTest.kt +src/test/kotlin/org/openapijsonschematools/client/components/schemas/RequiredWithEmptyArrayTest.kt +src/test/kotlin/org/openapijsonschematools/client/components/schemas/RequiredWithEscapedCharactersTest.kt +src/test/kotlin/org/openapijsonschematools/client/components/schemas/SimpleEnumValidationTest.kt +src/test/kotlin/org/openapijsonschematools/client/components/schemas/SingleDependencyTest.kt +src/test/kotlin/org/openapijsonschematools/client/components/schemas/SmallMultipleOfLargeIntegerTest.kt +src/test/kotlin/org/openapijsonschematools/client/components/schemas/StringTypeMatchesStringsTest.kt +src/test/kotlin/org/openapijsonschematools/client/components/schemas/TimeFormatTest.kt +src/test/kotlin/org/openapijsonschematools/client/components/schemas/TypeArrayObjectOrNullTest.kt +src/test/kotlin/org/openapijsonschematools/client/components/schemas/TypeArrayOrObjectTest.kt +src/test/kotlin/org/openapijsonschematools/client/components/schemas/TypeAsArrayWithOneItemTest.kt +src/test/kotlin/org/openapijsonschematools/client/components/schemas/UnevaluateditemsAsSchemaTest.kt +src/test/kotlin/org/openapijsonschematools/client/components/schemas/UnevaluateditemsDependsOnMultipleNestedContainsTest.kt +src/test/kotlin/org/openapijsonschematools/client/components/schemas/UnevaluateditemsWithItemsTest.kt +src/test/kotlin/org/openapijsonschematools/client/components/schemas/UnevaluateditemsWithNullInstanceElementsTest.kt +src/test/kotlin/org/openapijsonschematools/client/components/schemas/UnevaluatedpropertiesNotAffectedByPropertynamesTest.kt +src/test/kotlin/org/openapijsonschematools/client/components/schemas/UnevaluatedpropertiesSchemaTest.kt +src/test/kotlin/org/openapijsonschematools/client/components/schemas/UnevaluatedpropertiesWithAdjacentAdditionalpropertiesTest.kt +src/test/kotlin/org/openapijsonschematools/client/components/schemas/UnevaluatedpropertiesWithNullValuedInstancePropertiesTest.kt +src/test/kotlin/org/openapijsonschematools/client/components/schemas/UniqueitemsFalseValidationTest.kt +src/test/kotlin/org/openapijsonschematools/client/components/schemas/UniqueitemsFalseWithAnArrayOfItemsTest.kt +src/test/kotlin/org/openapijsonschematools/client/components/schemas/UniqueitemsValidationTest.kt +src/test/kotlin/org/openapijsonschematools/client/components/schemas/UniqueitemsWithAnArrayOfItemsTest.kt +src/test/kotlin/org/openapijsonschematools/client/components/schemas/UriFormatTest.kt +src/test/kotlin/org/openapijsonschematools/client/components/schemas/UriReferenceFormatTest.kt +src/test/kotlin/org/openapijsonschematools/client/components/schemas/UriTemplateFormatTest.kt +src/test/kotlin/org/openapijsonschematools/client/components/schemas/UuidFormatTest.kt +src/test/kotlin/org/openapijsonschematools/client/components/schemas/ValidateAgainstCorrectBranchThenVsElseTest.kt +src/test/kotlin/org/openapijsonschematools/client/configurations/JsonSchemaKeywordFlagsTest.kt +src/test/kotlin/org/openapijsonschematools/client/schemas/AnyTypeSchemaTest.kt +src/test/kotlin/org/openapijsonschematools/client/schemas/ArrayTypeSchemaTest.kt +src/test/kotlin/org/openapijsonschematools/client/schemas/BooleanSchemaTest.kt +src/test/kotlin/org/openapijsonschematools/client/schemas/ListBuilderTest.kt +src/test/kotlin/org/openapijsonschematools/client/schemas/ListSchemaTest.kt +src/test/kotlin/org/openapijsonschematools/client/schemas/MapSchemaTest.kt +src/test/kotlin/org/openapijsonschematools/client/schemas/NullSchemaTest.kt +src/test/kotlin/org/openapijsonschematools/client/schemas/NumberSchemaTest.kt +src/test/kotlin/org/openapijsonschematools/client/schemas/ObjectTypeSchemaTest.kt +src/test/kotlin/org/openapijsonschematools/client/schemas/RefBooleanSchemaTest.kt +src/test/kotlin/org/openapijsonschematools/client/schemas/validation/AdditionalPropertiesValidatorTest.kt +src/test/kotlin/org/openapijsonschematools/client/schemas/validation/CustomIsoparserTest.kt +src/test/kotlin/org/openapijsonschematools/client/schemas/validation/FormatValidatorTest.kt +src/test/kotlin/org/openapijsonschematools/client/schemas/validation/ItemsValidatorTest.kt +src/test/kotlin/org/openapijsonschematools/client/schemas/validation/JsonSchemaTest.kt +src/test/kotlin/org/openapijsonschematools/client/schemas/validation/PropertiesValidatorTest.kt +src/test/kotlin/org/openapijsonschematools/client/schemas/validation/RequiredValidatorTest.kt +src/test/kotlin/org/openapijsonschematools/client/schemas/validation/TypeValidatorTest.kt diff --git a/samples/client/3_1_0_unit_test/kotlin/.openapi-generator/VERSION b/samples/client/3_1_0_unit_test/kotlin/.openapi-generator/VERSION new file mode 100644 index 00000000000..717311e32e3 --- /dev/null +++ b/samples/client/3_1_0_unit_test/kotlin/.openapi-generator/VERSION @@ -0,0 +1 @@ +unset \ No newline at end of file diff --git a/samples/client/3_1_0_unit_test/kotlin/README.md b/samples/client/3_1_0_unit_test/kotlin/README.md new file mode 100644 index 00000000000..34899ae0c73 --- /dev/null +++ b/samples/client/3_1_0_unit_test/kotlin/README.md @@ -0,0 +1,280 @@ +# unit-test-api +sample spec for testing openapi functionality, built from json schema tests for draft2020-12 + +This Kotlin package is automatically generated by the [OpenAPI JSON Schema Generator](https://github.com/openapi-json-schema-tools/openapi-json-schema-generator) project: + +- OpenAPI document version: 0.0.1 +- Kotlin Package version: 0.0.1 +- OpenAPI JSON Schema Generator, Generator: KotlinClientGenerator + +## Requirements + +1. Kotlin 1.9.23 +2. Gradle + +## Installation + +To install the API client library to your local Maven repository, simply execute: + +```shell +gradle wrapper +gradlew clean build +``` + +### Gradle users + +Add this dependency to your project's build file: + +``` +repositories { + mavenCentral() // Needed if the 'unit-test-api' jar has been published to maven centra + mavenLocal() // Needed if the 'unit-test-api' jar has been published to the local maven repo +} + +dependencies { + implementation "org.openapijsonschematools:unit-test-api:0.0.1" +} +``` + +## Usage Notes +### Validation, Immutability, and Data Type +This Kotlin code validates data to schema classes and return back an immutable instance containing the data. This ensure that +- valid data cannot be mutated and become invalid to a set of schemas + - the one exception is that files are not immutable, so schema instances storing/sending/receiving files are not immutable + +Here is the mapping from json schema types to Kotlin types: + +| Json Schema Type | Kotlin Base Class | +| ---------------- | --------------- | +| object | FrozenMap (Map) | +| array | FrozenList (List) | +| string | String | +| number | Number (int, long, float, double) | +| integer | int, long, float, double (with values equal to integers) | +| boolean | boolean | +| null | Nothing? (null) | +| AnyType (unset) | Object? | + +### Storage of Json Schema Definition in Kotlin JsonSchema Classes +In openapi v3.0.3 there are ~ 28 json schema keywords. Almost all of them can apply if +type is unset. I have chosen to separate the storage of +- json schema definition info +- output classes for validated Map (json schema type object) payloads +- output classes for validated List (json schema type array) payloads + +
    + Reason + +This json schema data is stored in each class that is written for a schema, in a component or +other openapi document location. This class is only responsible for storing schema info. +Output classes like those that store map payloads are written separately and are +returned by the JsonSchema.validate method when that method is passed in Map input. +This prevents payload property access methods from +colliding with json schema definition. +
    + +### Json Schema Type Object +Most component schemas (models) are probably of type object. Which is a map data structure. +Json schema allows string keys in this map, which means schema properties can have key names that are +invalid Kotlin variable names. Names like: +- "hi-there" +- "1variable" +- "@now" +- " " +- "from" + +To allow these use cases to work, FrozenMap (which extends AbstractMap) is used as the base class of type object schemas. +This means that one can use normal Map methods on instances of these classes. + +
    + Other Details + +- getters are written for validly named required and optional properties +- null is only allowed in as a value if type: "null" was included or nullable: true was set + - because null is an allowed property value, it is not used to represent an unset property state +- if an optional property is requested and it does not exist in the Map, an UnsetPropertyException is thrown +
    + +### Json Schema Type + Format, Validated Data Storage +N schemas can be validated on the same payload. +To allow multiple schemas to validate, the data must be stored using one base class whether or not +a json schema format constraint exists in the schema. + +In json schema, type: number with no format validates both integers and floats, +so int and float values are stored for type number. + +
    + String + Date Example + +For example the string payload '2023-12-20' is validates to both of these schemas: +1. string only +``` +- type: string +``` +2. string and date format +``` +- type: string + format: date +``` +Because of use cases like this, a LocalDate is allowed as an input to this schema, but the data +is stored as a string. +
    + +## Getting Started + +Please follow the [installation procedure](#installation) and then use the JsonSchema classes in +org.openapijsonschematools.client.components.schemas to validate input payloads and instances of validated Map and List +output classes. Json schemas allow multiple types for one schema, so a schema's validate method can have +allowed input and output types. + +## Servers +| server_index | Class | Description | +| ------------ | ----- | ----------- | +| 0 | [RootServer0](docs/servers/RootServer0.md) | | + +## Component Schemas +| Class | Description | +| ----- | ----------- | +| [ASchemaGivenForPrefixitems.ASchemaGivenForPrefixitems1](docs/components/schemas/ASchemaGivenForPrefixitems.md#aschemagivenforprefixitems1) | | +| [AdditionalItemsAreAllowedByDefault.AdditionalItemsAreAllowedByDefault1](docs/components/schemas/AdditionalItemsAreAllowedByDefault.md#additionalitemsareallowedbydefault1) | | +| [AdditionalpropertiesAreAllowedByDefault.AdditionalpropertiesAreAllowedByDefault1](docs/components/schemas/AdditionalpropertiesAreAllowedByDefault.md#additionalpropertiesareallowedbydefault1) | | +| [AdditionalpropertiesCanExistByItself.AdditionalpropertiesCanExistByItself1](docs/components/schemas/AdditionalpropertiesCanExistByItself.md#additionalpropertiescanexistbyitself1) | | +| [AdditionalpropertiesDoesNotLookInApplicators.AdditionalpropertiesDoesNotLookInApplicators1](docs/components/schemas/AdditionalpropertiesDoesNotLookInApplicators.md#additionalpropertiesdoesnotlookinapplicators1) | | +| [AdditionalpropertiesWithNullValuedInstanceProperties.AdditionalpropertiesWithNullValuedInstanceProperties1](docs/components/schemas/AdditionalpropertiesWithNullValuedInstanceProperties.md#additionalpropertieswithnullvaluedinstanceproperties1) | | +| [AdditionalpropertiesWithSchema.AdditionalpropertiesWithSchema1](docs/components/schemas/AdditionalpropertiesWithSchema.md#additionalpropertieswithschema1) | | +| [Allof.Allof1](docs/components/schemas/Allof.md#allof1) | | +| [AllofCombinedWithAnyofOneof.AllofCombinedWithAnyofOneof1](docs/components/schemas/AllofCombinedWithAnyofOneof.md#allofcombinedwithanyofoneof1) | | +| [AllofSimpleTypes.AllofSimpleTypes1](docs/components/schemas/AllofSimpleTypes.md#allofsimpletypes1) | | +| [AllofWithBaseSchema.AllofWithBaseSchema1](docs/components/schemas/AllofWithBaseSchema.md#allofwithbaseschema1) | | +| [AllofWithOneEmptySchema.AllofWithOneEmptySchema1](docs/components/schemas/AllofWithOneEmptySchema.md#allofwithoneemptyschema1) | | +| [AllofWithTheFirstEmptySchema.AllofWithTheFirstEmptySchema1](docs/components/schemas/AllofWithTheFirstEmptySchema.md#allofwiththefirstemptyschema1) | | +| [AllofWithTheLastEmptySchema.AllofWithTheLastEmptySchema1](docs/components/schemas/AllofWithTheLastEmptySchema.md#allofwiththelastemptyschema1) | | +| [AllofWithTwoEmptySchemas.AllofWithTwoEmptySchemas1](docs/components/schemas/AllofWithTwoEmptySchemas.md#allofwithtwoemptyschemas1) | | +| [Anyof.Anyof1](docs/components/schemas/Anyof.md#anyof1) | | +| [AnyofComplexTypes.AnyofComplexTypes1](docs/components/schemas/AnyofComplexTypes.md#anyofcomplextypes1) | | +| [AnyofWithBaseSchema.AnyofWithBaseSchema1](docs/components/schemas/AnyofWithBaseSchema.md#anyofwithbaseschema1) | | +| [AnyofWithOneEmptySchema.AnyofWithOneEmptySchema1](docs/components/schemas/AnyofWithOneEmptySchema.md#anyofwithoneemptyschema1) | | +| [ArrayTypeMatchesArrays.ArrayTypeMatchesArrays1](docs/components/schemas/ArrayTypeMatchesArrays.md#arraytypematchesarrays1) | | +| [BooleanTypeMatchesBooleans.BooleanTypeMatchesBooleans1](docs/components/schemas/BooleanTypeMatchesBooleans.md#booleantypematchesbooleans1) | | +| [ByInt.ByInt1](docs/components/schemas/ByInt.md#byint1) | | +| [ByNumber.ByNumber1](docs/components/schemas/ByNumber.md#bynumber1) | | +| [BySmallNumber.BySmallNumber1](docs/components/schemas/BySmallNumber.md#bysmallnumber1) | | +| [ConstNulCharactersInStrings.ConstNulCharactersInStrings1](docs/components/schemas/ConstNulCharactersInStrings.md#constnulcharactersinstrings1) | | +| [ContainsKeywordValidation.ContainsKeywordValidation1](docs/components/schemas/ContainsKeywordValidation.md#containskeywordvalidation1) | | +| [ContainsWithNullInstanceElements.ContainsWithNullInstanceElements1](docs/components/schemas/ContainsWithNullInstanceElements.md#containswithnullinstanceelements1) | | +| [DateFormat.DateFormat1](docs/components/schemas/DateFormat.md#dateformat1) | | +| [DateTimeFormat.DateTimeFormat1](docs/components/schemas/DateTimeFormat.md#datetimeformat1) | | +| [DependentSchemasDependenciesWithEscapedCharacters.DependentSchemasDependenciesWithEscapedCharacters1](docs/components/schemas/DependentSchemasDependenciesWithEscapedCharacters.md#dependentschemasdependencieswithescapedcharacters1) | | +| [DependentSchemasDependentSubschemaIncompatibleWithRoot.DependentSchemasDependentSubschemaIncompatibleWithRoot1](docs/components/schemas/DependentSchemasDependentSubschemaIncompatibleWithRoot.md#dependentschemasdependentsubschemaincompatiblewithroot1) | | +| [DependentSchemasSingleDependency.DependentSchemasSingleDependency1](docs/components/schemas/DependentSchemasSingleDependency.md#dependentschemassingledependency1) | | +| [DurationFormat.DurationFormat1](docs/components/schemas/DurationFormat.md#durationformat1) | | +| [EmailFormat.EmailFormat1](docs/components/schemas/EmailFormat.md#emailformat1) | | +| [EmptyDependents.EmptyDependents1](docs/components/schemas/EmptyDependents.md#emptydependents1) | | +| [EnumWith0DoesNotMatchFalse.EnumWith0DoesNotMatchFalse1](docs/components/schemas/EnumWith0DoesNotMatchFalse.md#enumwith0doesnotmatchfalse1) | | +| [EnumWith1DoesNotMatchTrue.EnumWith1DoesNotMatchTrue1](docs/components/schemas/EnumWith1DoesNotMatchTrue.md#enumwith1doesnotmatchtrue1) | | +| [EnumWithEscapedCharacters.EnumWithEscapedCharacters1](docs/components/schemas/EnumWithEscapedCharacters.md#enumwithescapedcharacters1) | | +| [EnumWithFalseDoesNotMatch0.EnumWithFalseDoesNotMatch01](docs/components/schemas/EnumWithFalseDoesNotMatch0.md#enumwithfalsedoesnotmatch01) | | +| [EnumWithTrueDoesNotMatch1.EnumWithTrueDoesNotMatch11](docs/components/schemas/EnumWithTrueDoesNotMatch1.md#enumwithtruedoesnotmatch11) | | +| [EnumsInProperties.EnumsInProperties1](docs/components/schemas/EnumsInProperties.md#enumsinproperties1) | | +| [ExclusivemaximumValidation.ExclusivemaximumValidation1](docs/components/schemas/ExclusivemaximumValidation.md#exclusivemaximumvalidation1) | | +| [ExclusiveminimumValidation.ExclusiveminimumValidation1](docs/components/schemas/ExclusiveminimumValidation.md#exclusiveminimumvalidation1) | | +| [FloatDivisionInf.FloatDivisionInf1](docs/components/schemas/FloatDivisionInf.md#floatdivisioninf1) | | +| [ForbiddenProperty.ForbiddenProperty1](docs/components/schemas/ForbiddenProperty.md#forbiddenproperty1) | | +| [HostnameFormat.HostnameFormat1](docs/components/schemas/HostnameFormat.md#hostnameformat1) | | +| [IdnEmailFormat.IdnEmailFormat1](docs/components/schemas/IdnEmailFormat.md#idnemailformat1) | | +| [IdnHostnameFormat.IdnHostnameFormat1](docs/components/schemas/IdnHostnameFormat.md#idnhostnameformat1) | | +| [IfAndElseWithoutThen.IfAndElseWithoutThen1](docs/components/schemas/IfAndElseWithoutThen.md#ifandelsewithoutthen1) | | +| [IfAndThenWithoutElse.IfAndThenWithoutElse1](docs/components/schemas/IfAndThenWithoutElse.md#ifandthenwithoutelse1) | | +| [IfAppearsAtTheEndWhenSerializedKeywordProcessingSequence.IfAppearsAtTheEndWhenSerializedKeywordProcessingSequence1](docs/components/schemas/IfAppearsAtTheEndWhenSerializedKeywordProcessingSequence.md#ifappearsattheendwhenserializedkeywordprocessingsequence1) | | +| [IgnoreElseWithoutIf.IgnoreElseWithoutIf1](docs/components/schemas/IgnoreElseWithoutIf.md#ignoreelsewithoutif1) | | +| [IgnoreIfWithoutThenOrElse.IgnoreIfWithoutThenOrElse1](docs/components/schemas/IgnoreIfWithoutThenOrElse.md#ignoreifwithoutthenorelse1) | | +| [IgnoreThenWithoutIf.IgnoreThenWithoutIf1](docs/components/schemas/IgnoreThenWithoutIf.md#ignorethenwithoutif1) | | +| [IntegerTypeMatchesIntegers.IntegerTypeMatchesIntegers1](docs/components/schemas/IntegerTypeMatchesIntegers.md#integertypematchesintegers1) | | +| [Ipv4Format.Ipv4Format1](docs/components/schemas/Ipv4Format.md#ipv4format1) | | +| [Ipv6Format.Ipv6Format1](docs/components/schemas/Ipv6Format.md#ipv6format1) | | +| [IriFormat.IriFormat1](docs/components/schemas/IriFormat.md#iriformat1) | | +| [IriReferenceFormat.IriReferenceFormat1](docs/components/schemas/IriReferenceFormat.md#irireferenceformat1) | | +| [ItemsContains.ItemsContains1](docs/components/schemas/ItemsContains.md#itemscontains1) | | +| [ItemsDoesNotLookInApplicatorsValidCase.ItemsDoesNotLookInApplicatorsValidCase1](docs/components/schemas/ItemsDoesNotLookInApplicatorsValidCase.md#itemsdoesnotlookinapplicatorsvalidcase1) | | +| [ItemsWithNullInstanceElements.ItemsWithNullInstanceElements1](docs/components/schemas/ItemsWithNullInstanceElements.md#itemswithnullinstanceelements1) | | +| [JsonPointerFormat.JsonPointerFormat1](docs/components/schemas/JsonPointerFormat.md#jsonpointerformat1) | | +| [MaxcontainsWithoutContainsIsIgnored.MaxcontainsWithoutContainsIsIgnored1](docs/components/schemas/MaxcontainsWithoutContainsIsIgnored.md#maxcontainswithoutcontainsisignored1) | | +| [MaximumValidation.MaximumValidation1](docs/components/schemas/MaximumValidation.md#maximumvalidation1) | | +| [MaximumValidationWithUnsignedInteger.MaximumValidationWithUnsignedInteger1](docs/components/schemas/MaximumValidationWithUnsignedInteger.md#maximumvalidationwithunsignedinteger1) | | +| [MaxitemsValidation.MaxitemsValidation1](docs/components/schemas/MaxitemsValidation.md#maxitemsvalidation1) | | +| [MaxlengthValidation.MaxlengthValidation1](docs/components/schemas/MaxlengthValidation.md#maxlengthvalidation1) | | +| [Maxproperties0MeansTheObjectIsEmpty.Maxproperties0MeansTheObjectIsEmpty1](docs/components/schemas/Maxproperties0MeansTheObjectIsEmpty.md#maxproperties0meanstheobjectisempty1) | | +| [MaxpropertiesValidation.MaxpropertiesValidation1](docs/components/schemas/MaxpropertiesValidation.md#maxpropertiesvalidation1) | | +| [MincontainsWithoutContainsIsIgnored.MincontainsWithoutContainsIsIgnored1](docs/components/schemas/MincontainsWithoutContainsIsIgnored.md#mincontainswithoutcontainsisignored1) | | +| [MinimumValidation.MinimumValidation1](docs/components/schemas/MinimumValidation.md#minimumvalidation1) | | +| [MinimumValidationWithSignedInteger.MinimumValidationWithSignedInteger1](docs/components/schemas/MinimumValidationWithSignedInteger.md#minimumvalidationwithsignedinteger1) | | +| [MinitemsValidation.MinitemsValidation1](docs/components/schemas/MinitemsValidation.md#minitemsvalidation1) | | +| [MinlengthValidation.MinlengthValidation1](docs/components/schemas/MinlengthValidation.md#minlengthvalidation1) | | +| [MinpropertiesValidation.MinpropertiesValidation1](docs/components/schemas/MinpropertiesValidation.md#minpropertiesvalidation1) | | +| [MultipleDependentsRequired.MultipleDependentsRequired1](docs/components/schemas/MultipleDependentsRequired.md#multipledependentsrequired1) | | +| [MultipleSimultaneousPatternpropertiesAreValidated.MultipleSimultaneousPatternpropertiesAreValidated1](docs/components/schemas/MultipleSimultaneousPatternpropertiesAreValidated.md#multiplesimultaneouspatternpropertiesarevalidated1) | | +| [MultipleTypesCanBeSpecifiedInAnArray.MultipleTypesCanBeSpecifiedInAnArray1](docs/components/schemas/MultipleTypesCanBeSpecifiedInAnArray.md#multipletypescanbespecifiedinanarray1) | | +| [NestedAllofToCheckValidationSemantics.NestedAllofToCheckValidationSemantics1](docs/components/schemas/NestedAllofToCheckValidationSemantics.md#nestedalloftocheckvalidationsemantics1) | | +| [NestedAnyofToCheckValidationSemantics.NestedAnyofToCheckValidationSemantics1](docs/components/schemas/NestedAnyofToCheckValidationSemantics.md#nestedanyoftocheckvalidationsemantics1) | | +| [NestedItems.NestedItems1](docs/components/schemas/NestedItems.md#nesteditems1) | | +| [NestedOneofToCheckValidationSemantics.NestedOneofToCheckValidationSemantics1](docs/components/schemas/NestedOneofToCheckValidationSemantics.md#nestedoneoftocheckvalidationsemantics1) | | +| [NonAsciiPatternWithAdditionalproperties.NonAsciiPatternWithAdditionalproperties1](docs/components/schemas/NonAsciiPatternWithAdditionalproperties.md#nonasciipatternwithadditionalproperties1) | | +| [NonInterferenceAcrossCombinedSchemas.NonInterferenceAcrossCombinedSchemas1](docs/components/schemas/NonInterferenceAcrossCombinedSchemas.md#noninterferenceacrosscombinedschemas1) | | +| [Not.Not1](docs/components/schemas/Not.md#not1) | | +| [NotMoreComplexSchema.NotMoreComplexSchema1](docs/components/schemas/NotMoreComplexSchema.md#notmorecomplexschema1) | | +| [NotMultipleTypes.NotMultipleTypes1](docs/components/schemas/NotMultipleTypes.md#notmultipletypes1) | | +| [NulCharactersInStrings.NulCharactersInStrings1](docs/components/schemas/NulCharactersInStrings.md#nulcharactersinstrings1) | | +| [NullTypeMatchesOnlyTheNullObject.NullTypeMatchesOnlyTheNullObject1](docs/components/schemas/NullTypeMatchesOnlyTheNullObject.md#nulltypematchesonlythenullobject1) | | +| [NumberTypeMatchesNumbers.NumberTypeMatchesNumbers1](docs/components/schemas/NumberTypeMatchesNumbers.md#numbertypematchesnumbers1) | | +| [ObjectPropertiesValidation.ObjectPropertiesValidation1](docs/components/schemas/ObjectPropertiesValidation.md#objectpropertiesvalidation1) | | +| [ObjectTypeMatchesObjects.ObjectTypeMatchesObjects1](docs/components/schemas/ObjectTypeMatchesObjects.md#objecttypematchesobjects1) | | +| [Oneof.Oneof1](docs/components/schemas/Oneof.md#oneof1) | | +| [OneofComplexTypes.OneofComplexTypes1](docs/components/schemas/OneofComplexTypes.md#oneofcomplextypes1) | | +| [OneofWithBaseSchema.OneofWithBaseSchema1](docs/components/schemas/OneofWithBaseSchema.md#oneofwithbaseschema1) | | +| [OneofWithEmptySchema.OneofWithEmptySchema1](docs/components/schemas/OneofWithEmptySchema.md#oneofwithemptyschema1) | | +| [OneofWithRequired.OneofWithRequired1](docs/components/schemas/OneofWithRequired.md#oneofwithrequired1) | | +| [PatternIsNotAnchored.PatternIsNotAnchored1](docs/components/schemas/PatternIsNotAnchored.md#patternisnotanchored1) | | +| [PatternValidation.PatternValidation1](docs/components/schemas/PatternValidation.md#patternvalidation1) | | +| [PatternpropertiesValidatesPropertiesMatchingARegex.PatternpropertiesValidatesPropertiesMatchingARegex1](docs/components/schemas/PatternpropertiesValidatesPropertiesMatchingARegex.md#patternpropertiesvalidatespropertiesmatchingaregex1) | | +| [PatternpropertiesWithNullValuedInstanceProperties.PatternpropertiesWithNullValuedInstanceProperties1](docs/components/schemas/PatternpropertiesWithNullValuedInstanceProperties.md#patternpropertieswithnullvaluedinstanceproperties1) | | +| [PrefixitemsValidationAdjustsTheStartingIndexForItems.PrefixitemsValidationAdjustsTheStartingIndexForItems1](docs/components/schemas/PrefixitemsValidationAdjustsTheStartingIndexForItems.md#prefixitemsvalidationadjuststhestartingindexforitems1) | | +| [PrefixitemsWithNullInstanceElements.PrefixitemsWithNullInstanceElements1](docs/components/schemas/PrefixitemsWithNullInstanceElements.md#prefixitemswithnullinstanceelements1) | | +| [PropertiesPatternpropertiesAdditionalpropertiesInteraction.PropertiesPatternpropertiesAdditionalpropertiesInteraction1](docs/components/schemas/PropertiesPatternpropertiesAdditionalpropertiesInteraction.md#propertiespatternpropertiesadditionalpropertiesinteraction1) | | +| [PropertiesWhoseNamesAreJavascriptObjectPropertyNames.PropertiesWhoseNamesAreJavascriptObjectPropertyNames1](docs/components/schemas/PropertiesWhoseNamesAreJavascriptObjectPropertyNames.md#propertieswhosenamesarejavascriptobjectpropertynames1) | | +| [PropertiesWithEscapedCharacters.PropertiesWithEscapedCharacters1](docs/components/schemas/PropertiesWithEscapedCharacters.md#propertieswithescapedcharacters1) | | +| [PropertiesWithNullValuedInstanceProperties.PropertiesWithNullValuedInstanceProperties1](docs/components/schemas/PropertiesWithNullValuedInstanceProperties.md#propertieswithnullvaluedinstanceproperties1) | | +| [PropertyNamedRefThatIsNotAReference.PropertyNamedRefThatIsNotAReference1](docs/components/schemas/PropertyNamedRefThatIsNotAReference.md#propertynamedrefthatisnotareference1) | | +| [PropertynamesValidation.PropertynamesValidation1](docs/components/schemas/PropertynamesValidation.md#propertynamesvalidation1) | | +| [RegexFormat.RegexFormat1](docs/components/schemas/RegexFormat.md#regexformat1) | | +| [RegexesAreNotAnchoredByDefaultAndAreCaseSensitive.RegexesAreNotAnchoredByDefaultAndAreCaseSensitive1](docs/components/schemas/RegexesAreNotAnchoredByDefaultAndAreCaseSensitive.md#regexesarenotanchoredbydefaultandarecasesensitive1) | | +| [RelativeJsonPointerFormat.RelativeJsonPointerFormat1](docs/components/schemas/RelativeJsonPointerFormat.md#relativejsonpointerformat1) | | +| [RequiredDefaultValidation.RequiredDefaultValidation1](docs/components/schemas/RequiredDefaultValidation.md#requireddefaultvalidation1) | | +| [RequiredPropertiesWhoseNamesAreJavascriptObjectPropertyNames.RequiredPropertiesWhoseNamesAreJavascriptObjectPropertyNames1](docs/components/schemas/RequiredPropertiesWhoseNamesAreJavascriptObjectPropertyNames.md#requiredpropertieswhosenamesarejavascriptobjectpropertynames1) | | +| [RequiredValidation.RequiredValidation1](docs/components/schemas/RequiredValidation.md#requiredvalidation1) | | +| [RequiredWithEmptyArray.RequiredWithEmptyArray1](docs/components/schemas/RequiredWithEmptyArray.md#requiredwithemptyarray1) | | +| [RequiredWithEscapedCharacters.RequiredWithEscapedCharacters1](docs/components/schemas/RequiredWithEscapedCharacters.md#requiredwithescapedcharacters1) | | +| [SimpleEnumValidation.SimpleEnumValidation1](docs/components/schemas/SimpleEnumValidation.md#simpleenumvalidation1) | | +| [SingleDependency.SingleDependency1](docs/components/schemas/SingleDependency.md#singledependency1) | | +| [SmallMultipleOfLargeInteger.SmallMultipleOfLargeInteger1](docs/components/schemas/SmallMultipleOfLargeInteger.md#smallmultipleoflargeinteger1) | | +| [StringTypeMatchesStrings.StringTypeMatchesStrings1](docs/components/schemas/StringTypeMatchesStrings.md#stringtypematchesstrings1) | | +| [TimeFormat.TimeFormat1](docs/components/schemas/TimeFormat.md#timeformat1) | | +| [TypeArrayObjectOrNull.TypeArrayObjectOrNull1](docs/components/schemas/TypeArrayObjectOrNull.md#typearrayobjectornull1) | | +| [TypeArrayOrObject.TypeArrayOrObject1](docs/components/schemas/TypeArrayOrObject.md#typearrayorobject1) | | +| [TypeAsArrayWithOneItem.TypeAsArrayWithOneItem1](docs/components/schemas/TypeAsArrayWithOneItem.md#typeasarraywithoneitem1) | | +| [UnevaluateditemsAsSchema.UnevaluateditemsAsSchema1](docs/components/schemas/UnevaluateditemsAsSchema.md#unevaluateditemsasschema1) | | +| [UnevaluateditemsDependsOnMultipleNestedContains.UnevaluateditemsDependsOnMultipleNestedContains1](docs/components/schemas/UnevaluateditemsDependsOnMultipleNestedContains.md#unevaluateditemsdependsonmultiplenestedcontains1) | | +| [UnevaluateditemsWithItems.UnevaluateditemsWithItems1](docs/components/schemas/UnevaluateditemsWithItems.md#unevaluateditemswithitems1) | | +| [UnevaluateditemsWithNullInstanceElements.UnevaluateditemsWithNullInstanceElements1](docs/components/schemas/UnevaluateditemsWithNullInstanceElements.md#unevaluateditemswithnullinstanceelements1) | | +| [UnevaluatedpropertiesNotAffectedByPropertynames.UnevaluatedpropertiesNotAffectedByPropertynames1](docs/components/schemas/UnevaluatedpropertiesNotAffectedByPropertynames.md#unevaluatedpropertiesnotaffectedbypropertynames1) | | +| [UnevaluatedpropertiesSchema.UnevaluatedpropertiesSchema1](docs/components/schemas/UnevaluatedpropertiesSchema.md#unevaluatedpropertiesschema1) | | +| [UnevaluatedpropertiesWithAdjacentAdditionalproperties.UnevaluatedpropertiesWithAdjacentAdditionalproperties1](docs/components/schemas/UnevaluatedpropertiesWithAdjacentAdditionalproperties.md#unevaluatedpropertieswithadjacentadditionalproperties1) | | +| [UnevaluatedpropertiesWithNullValuedInstanceProperties.UnevaluatedpropertiesWithNullValuedInstanceProperties1](docs/components/schemas/UnevaluatedpropertiesWithNullValuedInstanceProperties.md#unevaluatedpropertieswithnullvaluedinstanceproperties1) | | +| [UniqueitemsFalseValidation.UniqueitemsFalseValidation1](docs/components/schemas/UniqueitemsFalseValidation.md#uniqueitemsfalsevalidation1) | | +| [UniqueitemsFalseWithAnArrayOfItems.UniqueitemsFalseWithAnArrayOfItems1](docs/components/schemas/UniqueitemsFalseWithAnArrayOfItems.md#uniqueitemsfalsewithanarrayofitems1) | | +| [UniqueitemsValidation.UniqueitemsValidation1](docs/components/schemas/UniqueitemsValidation.md#uniqueitemsvalidation1) | | +| [UniqueitemsWithAnArrayOfItems.UniqueitemsWithAnArrayOfItems1](docs/components/schemas/UniqueitemsWithAnArrayOfItems.md#uniqueitemswithanarrayofitems1) | | +| [UriFormat.UriFormat1](docs/components/schemas/UriFormat.md#uriformat1) | | +| [UriReferenceFormat.UriReferenceFormat1](docs/components/schemas/UriReferenceFormat.md#urireferenceformat1) | | +| [UriTemplateFormat.UriTemplateFormat1](docs/components/schemas/UriTemplateFormat.md#uritemplateformat1) | | +| [UuidFormat.UuidFormat1](docs/components/schemas/UuidFormat.md#uuidformat1) | | +| [ValidateAgainstCorrectBranchThenVsElse.ValidateAgainstCorrectBranchThenVsElse1](docs/components/schemas/ValidateAgainstCorrectBranchThenVsElse.md#validateagainstcorrectbranchthenvselse1) | | diff --git a/samples/client/3_1_0_unit_test/kotlin/build.gradle.kts b/samples/client/3_1_0_unit_test/kotlin/build.gradle.kts new file mode 100644 index 00000000000..bb4941552b0 --- /dev/null +++ b/samples/client/3_1_0_unit_test/kotlin/build.gradle.kts @@ -0,0 +1,39 @@ +plugins { + kotlin("jvm") version "1.9.23" +} + +repositories { + mavenLocal() + maven { + url = uri("https://repo.maven.apache.org/maven2/") + } +} + +dependencies { + implementation(kotlin("reflect")) + testImplementation(kotlin("test")) + implementation("org.checkerframework:checker-qual:3.42.0") + implementation("com.google.code.gson:gson:2.10.1") + testImplementation("junit:junit:4.13.2") +} + +group = "org.openapijsonschematools" +version = "0.0.1" +description = "OpenAPI Kotlin" + +java { + toolchain { + languageVersion.set(JavaLanguageVersion.of(17)) + } +} + +tasks.wrapper { + gradleVersion = "8.1.1" +} + +tasks.test { + useJUnitPlatform() + testLogging { + events( "started", "passed", "skipped", "failed") + } +} diff --git a/samples/client/3_1_0_unit_test/kotlin/docs/RootServerInfo.md b/samples/client/3_1_0_unit_test/kotlin/docs/RootServerInfo.md new file mode 100644 index 00000000000..46c3ca818e6 --- /dev/null +++ b/samples/client/3_1_0_unit_test/kotlin/docs/RootServerInfo.md @@ -0,0 +1,59 @@ +# RootServerInfo +RootServerInfo.java + +public class RootServerInfo + +A class that provides a server, and any needed server info classes +- a class that is a ServerProvider +- a builder for the ServerProvider +- an enum class that stores server index values + +## Nested Class Summary +| Modifier and Type | Class and Description | +| ----------------- | --------------------- | +| static class | [RootServerInfo.RootServerInfo1](#rootserverinfo1)
    class that stores a server index | +| static class | [RootServerInfo.RootServerInfoBuilder](#rootserverinfobuilder)
    class that stores a server index | +| enum | [RootServerInfo.ServerIndex](#serverindex)
    class that stores a server index | + +## RootServerInfo1 +implements ServerProvider<[ServerIndex](#serverindex)>
    + +A class that stores servers and allows one to be returned with a ServerIndex instance + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| RootServerInfo1(@Nullable [RootServer0](servers/RootServer0.md) server0)
    Creates an instance using passed in servers | + +### Field Summary +| Modifier and Type | Field and Description | +| ----------------- | --------------------- | +| [RootServer0](servers/RootServer0.md) | server0 | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| Server | getServer([ServerIndex](#serverindex) serverIndex) | + +## RootServerInfoBuilder + +a builder for [RootServerInfo1](#rootserverinfo1) + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| RootServerInfoBuilder()
    Creates an instance | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| [RootServerInfoBuilder](#rootserverinfobuilder) | rootServer0([RootServer0](servers/RootServer0.md) server0)
    sets the server | +| [RootServerInfo1](#rootserverinfo1) | build() | + +## ServerIndex +enum ServerIndex
    + +### Enum Constant Summary +| Enum Constant And Description | +| ----------------------------- | +| SERVER_0
    server 0 | diff --git a/samples/client/3_1_0_unit_test/kotlin/docs/components/schemas/ASchemaGivenForPrefixitems.md b/samples/client/3_1_0_unit_test/kotlin/docs/components/schemas/ASchemaGivenForPrefixitems.md new file mode 100644 index 00000000000..56481399a71 --- /dev/null +++ b/samples/client/3_1_0_unit_test/kotlin/docs/components/schemas/ASchemaGivenForPrefixitems.md @@ -0,0 +1,286 @@ +# ASchemaGivenForPrefixitems +org.openapijsonschematools.client.components.schemas.ASchemaGivenForPrefixitems.java +class ASchemaGivenForPrefixitems
    + +A class that contains necessary nested +- schema classes (which validate payloads), extends JsonSchema +- sealed interfaces which store validated payloads, Kotlin version of a sum type +- boxed classes which store validated payloads, sealed permits class implementations +- classes to store validated list payloads, extends FrozenList +- classes to build inputs for list payloads + +## Nested Class Summary +| Modifier and Type | Class and Description | +| ----------------- | ---------------------- | +| sealed interface | [ASchemaGivenForPrefixitems.ASchemaGivenForPrefixitems1Boxed](#aschemagivenforprefixitems1boxed)
    sealed interface for validated payloads | +| record | [ASchemaGivenForPrefixitems.ASchemaGivenForPrefixitems1BoxedVoid](#aschemagivenforprefixitems1boxedvoid)
    boxed class to store validated null payloads | +| record | [ASchemaGivenForPrefixitems.ASchemaGivenForPrefixitems1BoxedBoolean](#aschemagivenforprefixitems1boxedboolean)
    boxed class to store validated boolean payloads | +| record | [ASchemaGivenForPrefixitems.ASchemaGivenForPrefixitems1BoxedNumber](#aschemagivenforprefixitems1boxednumber)
    boxed class to store validated Number payloads | +| record | [ASchemaGivenForPrefixitems.ASchemaGivenForPrefixitems1BoxedString](#aschemagivenforprefixitems1boxedstring)
    boxed class to store validated String payloads | +| record | [ASchemaGivenForPrefixitems.ASchemaGivenForPrefixitems1BoxedList](#aschemagivenforprefixitems1boxedlist)
    boxed class to store validated List payloads | +| record | [ASchemaGivenForPrefixitems.ASchemaGivenForPrefixitems1BoxedMap](#aschemagivenforprefixitems1boxedmap)
    boxed class to store validated Map payloads | +| static class | [ASchemaGivenForPrefixitems.ASchemaGivenForPrefixitems1](#aschemagivenforprefixitems1)
    schema class | +| sealed interface | [ASchemaGivenForPrefixitems.Schema1Boxed](#schema1boxed)
    sealed interface for validated payloads | +| record | [ASchemaGivenForPrefixitems.Schema1BoxedString](#schema1boxedstring)
    boxed class to store validated String payloads | +| static class | [ASchemaGivenForPrefixitems.Schema1](#schema1)
    schema class | +| sealed interface | [ASchemaGivenForPrefixitems.Schema0Boxed](#schema0boxed)
    sealed interface for validated payloads | +| record | [ASchemaGivenForPrefixitems.Schema0BoxedNumber](#schema0boxednumber)
    boxed class to store validated Number payloads | +| static class | [ASchemaGivenForPrefixitems.Schema0](#schema0)
    schema class | +| static class | [ASchemaGivenForPrefixitems.ASchemaGivenForPrefixitemsListBuilder](#aschemagivenforprefixitemslistbuilder)
    builder for List payloads | +| static class | [ASchemaGivenForPrefixitems.ASchemaGivenForPrefixitemsList](#aschemagivenforprefixitemslist)
    output class for List payloads | + +## ASchemaGivenForPrefixitems1Boxed +sealed interface ASchemaGivenForPrefixitems1Boxed
    +permits
    +[ASchemaGivenForPrefixitems1BoxedVoid](#aschemagivenforprefixitems1boxedvoid), +[ASchemaGivenForPrefixitems1BoxedBoolean](#aschemagivenforprefixitems1boxedboolean), +[ASchemaGivenForPrefixitems1BoxedNumber](#aschemagivenforprefixitems1boxednumber), +[ASchemaGivenForPrefixitems1BoxedString](#aschemagivenforprefixitems1boxedstring), +[ASchemaGivenForPrefixitems1BoxedList](#aschemagivenforprefixitems1boxedlist), +[ASchemaGivenForPrefixitems1BoxedMap](#aschemagivenforprefixitems1boxedmap) + +sealed interface that stores validated payloads using boxed classes + +## ASchemaGivenForPrefixitems1BoxedVoid +data class ASchemaGivenForPrefixitems1BoxedVoid
    +implements [ASchemaGivenForPrefixitems1Boxed](#aschemagivenforprefixitems1boxed) + +data class that stores validated null payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| ASchemaGivenForPrefixitems1BoxedVoid(Nothing? data)
    Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| Nothing? | data()
    validated payload | +| Any? | getData()
    validated payload | + +## ASchemaGivenForPrefixitems1BoxedBoolean +data class ASchemaGivenForPrefixitems1BoxedBoolean
    +implements [ASchemaGivenForPrefixitems1Boxed](#aschemagivenforprefixitems1boxed) + +record that stores validated boolean payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| ASchemaGivenForPrefixitems1BoxedBoolean(boolean data)
    Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| boolean | data()
    validated payload | +| Any? | getData()
    validated payload | + +## ASchemaGivenForPrefixitems1BoxedNumber +data class ASchemaGivenForPrefixitems1BoxedNumber
    +implements [ASchemaGivenForPrefixitems1Boxed](#aschemagivenforprefixitems1boxed) + +data class that stores validated Number payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| ASchemaGivenForPrefixitems1BoxedNumber(Number data)
    Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| Number | data()
    validated payload | +| Any? | getData()
    validated payload | + +## ASchemaGivenForPrefixitems1BoxedString +data class ASchemaGivenForPrefixitems1BoxedString
    +implements [ASchemaGivenForPrefixitems1Boxed](#aschemagivenforprefixitems1boxed) + +data class that stores validated String payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| ASchemaGivenForPrefixitems1BoxedString(String data)
    Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| String | data()
    validated payload | +| Any? | getData()
    validated payload | + +## ASchemaGivenForPrefixitems1BoxedList +data class ASchemaGivenForPrefixitems1BoxedList
    +implements [ASchemaGivenForPrefixitems1Boxed](#aschemagivenforprefixitems1boxed) + +data class that stores validated List payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| ASchemaGivenForPrefixitems1BoxedList([ASchemaGivenForPrefixitemsList](#aschemagivenforprefixitemslist) data)
    Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| [ASchemaGivenForPrefixitemsList](#aschemagivenforprefixitemslist) | data()
    validated payload | +| Any? | getData()
    validated payload | + +## ASchemaGivenForPrefixitems1BoxedMap +data class ASchemaGivenForPrefixitems1BoxedMap
    +implements [ASchemaGivenForPrefixitems1Boxed](#aschemagivenforprefixitems1boxed) + +data class that stores validated Map payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| ASchemaGivenForPrefixitems1BoxedMap(FrozenMap data)
    Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| FrozenMap | data()
    validated payload | +| Any? | getData()
    validated payload | + +## ASchemaGivenForPrefixitems1 +class ASchemaGivenForPrefixitems1
    +extends JsonSchema + +A schema class that validates payloads + +### Field Summary +| Modifier and Type | Field and Description | +| ----------------- | ---------------------- | +| List> | prefixItems = listOf(
        [Schema0::class.java](#schema0),
        [Schema1::class.java](#schema1)
    )
    | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| String | validate(arg: String, configuration: SchemaConfiguration) | +| Nothing? | validate(arg: Nothing?, configuration: SchemaConfiguration) | +| int | validate(arg: int, configuration: SchemaConfiguration) | +| long | validate(arg: long, configuration: SchemaConfiguration) | +| float | validate(arg: float, configuration: SchemaConfiguration) | +| double | validate(arg: double, configuration: SchemaConfiguration) | +| Number | validate(arg: Number, configuration: SchemaConfiguration) | +| boolean | validate(arg: boolean, configuration: SchemaConfiguration) | +| FrozenMap | validate(arg: Map<?, ?>, configuration: SchemaConfiguration) | +| [ASchemaGivenForPrefixitemsList](#aschemagivenforprefixitemslist) | validate(arg: [List<*>](#aschemagivenforprefixitemslistbuilder), configuration: SchemaConfiguration) | +| [ASchemaGivenForPrefixitems1BoxedString](#aschemagivenforprefixitems1boxedstring) | validateAndBox(String, configuration: SchemaConfiguration) | +| [ASchemaGivenForPrefixitems1BoxedVoid](#aschemagivenforprefixitems1boxedvoid) | validateAndBox(Nothing?, configuration: SchemaConfiguration) | +| [ASchemaGivenForPrefixitems1BoxedNumber](#aschemagivenforprefixitems1boxednumber) | validateAndBox(Number, configuration: SchemaConfiguration) | +| [ASchemaGivenForPrefixitems1BoxedBoolean](#aschemagivenforprefixitems1boxedboolean) | validateAndBox(boolean, configuration: SchemaConfiguration) | +| [ASchemaGivenForPrefixitems1BoxedMap](#aschemagivenforprefixitems1boxedmap) | validateAndBox(Map<?, ?>, configuration: SchemaConfiguration) | +| [ASchemaGivenForPrefixitems1BoxedList](#aschemagivenforprefixitems1boxedlist) | validateAndBox([List<*>](#aschemagivenforprefixitemslistbuilder), configuration: SchemaConfiguration) | +| [ASchemaGivenForPrefixitems1Boxed](#aschemagivenforprefixitems1boxed) | validateAndBox(Any?, configuration: SchemaConfiguration) | +| Any? | validate(arg: Any?, configuration: SchemaConfiguration) | + +## Schema1Boxed +sealed interface Schema1Boxed
    +permits
    +[Schema1BoxedString](#schema1boxedstring) + +sealed interface that stores validated payloads using boxed classes + +## Schema1BoxedString +data class Schema1BoxedString
    +implements [Schema1Boxed](#schema1boxed) + +data class that stores validated String payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| Schema1BoxedString(String data)
    Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| String | data()
    validated payload | +| Any? | getData()
    validated payload | + +## Schema1 +class Schema1
    +extends StringJsonSchema.StringJsonSchema1 + +A schema class that validates payloads + +| Methods Inherited from class org.openapijsonschematools.client.schemas.StringJsonSchema.StringJsonSchema1 | +| ------------------------------------------------------------------ | +| validate | +| validateAndBox | + +## Schema0Boxed +sealed interface Schema0Boxed
    +permits
    +[Schema0BoxedNumber](#schema0boxednumber) + +sealed interface that stores validated payloads using boxed classes + +## Schema0BoxedNumber +data class Schema0BoxedNumber
    +implements [Schema0Boxed](#schema0boxed) + +data class that stores validated Number payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| Schema0BoxedNumber(Number data)
    Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| Number | data()
    validated payload | +| Any? | getData()
    validated payload | + +## Schema0 +class Schema0
    +extends IntJsonSchema.IntJsonSchema1 + +A schema class that validates payloads + +| Methods Inherited from class org.openapijsonschematools.client.schemas.IntJsonSchema.IntJsonSchema1 | +| ------------------------------------------------------------------ | +| validate | +| validateAndBox | + +## ASchemaGivenForPrefixitemsListBuilder +class ASchemaGivenForPrefixitemsListBuilder
    +builder for `List` + +A class that builds the List input type + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| ASchemaGivenForPrefixitemsListBuilder()
    Creates an empty list | +| ASchemaGivenForPrefixitemsListBuilder(List items)
    Stores the items in a list | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| ASchemaGivenForPrefixitemsListBuilder | add(item: Nothing?) | +| ASchemaGivenForPrefixitemsListBuilder | add(item: Boolean) | +| ASchemaGivenForPrefixitemsListBuilder | add(item: String) | +| ASchemaGivenForPrefixitemsListBuilder | add(item: Int) | +| ASchemaGivenForPrefixitemsListBuilder | add(item: Float) | +| ASchemaGivenForPrefixitemsListBuilder | add(item: Long) | +| ASchemaGivenForPrefixitemsListBuilder | add(item: Double) | +| ASchemaGivenForPrefixitemsListBuilder | add(item: List) | +| ASchemaGivenForPrefixitemsListBuilder | add(item: Map) | +| List | build()
    Returns list input that should be used with Schema.validate | + +## ASchemaGivenForPrefixitemsList +class ASchemaGivenForPrefixitemsList
    +extends `FrozenList` + +A class to store validated List payloads + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| static [ASchemaGivenForPrefixitemsList](#aschemagivenforprefixitemslist) | of([List](#aschemagivenforprefixitemslistbuilder) arg, SchemaConfiguration configuration) | + +[[Back to top]](#top) [[Back to Component Schemas]](../../../README.md#Component-Schemas) [[Back to README]](../../../README.md) diff --git a/samples/client/3_1_0_unit_test/kotlin/docs/components/schemas/AdditionalItemsAreAllowedByDefault.md b/samples/client/3_1_0_unit_test/kotlin/docs/components/schemas/AdditionalItemsAreAllowedByDefault.md new file mode 100644 index 00000000000..6d51e715f12 --- /dev/null +++ b/samples/client/3_1_0_unit_test/kotlin/docs/components/schemas/AdditionalItemsAreAllowedByDefault.md @@ -0,0 +1,248 @@ +# AdditionalItemsAreAllowedByDefault +org.openapijsonschematools.client.components.schemas.AdditionalItemsAreAllowedByDefault.java +class AdditionalItemsAreAllowedByDefault
    + +A class that contains necessary nested +- schema classes (which validate payloads), extends JsonSchema +- sealed interfaces which store validated payloads, Kotlin version of a sum type +- boxed classes which store validated payloads, sealed permits class implementations +- classes to store validated list payloads, extends FrozenList +- classes to build inputs for list payloads + +## Nested Class Summary +| Modifier and Type | Class and Description | +| ----------------- | ---------------------- | +| sealed interface | [AdditionalItemsAreAllowedByDefault.AdditionalItemsAreAllowedByDefault1Boxed](#additionalitemsareallowedbydefault1boxed)
    sealed interface for validated payloads | +| record | [AdditionalItemsAreAllowedByDefault.AdditionalItemsAreAllowedByDefault1BoxedVoid](#additionalitemsareallowedbydefault1boxedvoid)
    boxed class to store validated null payloads | +| record | [AdditionalItemsAreAllowedByDefault.AdditionalItemsAreAllowedByDefault1BoxedBoolean](#additionalitemsareallowedbydefault1boxedboolean)
    boxed class to store validated boolean payloads | +| record | [AdditionalItemsAreAllowedByDefault.AdditionalItemsAreAllowedByDefault1BoxedNumber](#additionalitemsareallowedbydefault1boxednumber)
    boxed class to store validated Number payloads | +| record | [AdditionalItemsAreAllowedByDefault.AdditionalItemsAreAllowedByDefault1BoxedString](#additionalitemsareallowedbydefault1boxedstring)
    boxed class to store validated String payloads | +| record | [AdditionalItemsAreAllowedByDefault.AdditionalItemsAreAllowedByDefault1BoxedList](#additionalitemsareallowedbydefault1boxedlist)
    boxed class to store validated List payloads | +| record | [AdditionalItemsAreAllowedByDefault.AdditionalItemsAreAllowedByDefault1BoxedMap](#additionalitemsareallowedbydefault1boxedmap)
    boxed class to store validated Map payloads | +| static class | [AdditionalItemsAreAllowedByDefault.AdditionalItemsAreAllowedByDefault1](#additionalitemsareallowedbydefault1)
    schema class | +| sealed interface | [AdditionalItemsAreAllowedByDefault.Schema0Boxed](#schema0boxed)
    sealed interface for validated payloads | +| record | [AdditionalItemsAreAllowedByDefault.Schema0BoxedNumber](#schema0boxednumber)
    boxed class to store validated Number payloads | +| static class | [AdditionalItemsAreAllowedByDefault.Schema0](#schema0)
    schema class | +| static class | [AdditionalItemsAreAllowedByDefault.AdditionalItemsAreAllowedByDefaultListBuilder](#additionalitemsareallowedbydefaultlistbuilder)
    builder for List payloads | +| static class | [AdditionalItemsAreAllowedByDefault.AdditionalItemsAreAllowedByDefaultList](#additionalitemsareallowedbydefaultlist)
    output class for List payloads | + +## AdditionalItemsAreAllowedByDefault1Boxed +sealed interface AdditionalItemsAreAllowedByDefault1Boxed
    +permits
    +[AdditionalItemsAreAllowedByDefault1BoxedVoid](#additionalitemsareallowedbydefault1boxedvoid), +[AdditionalItemsAreAllowedByDefault1BoxedBoolean](#additionalitemsareallowedbydefault1boxedboolean), +[AdditionalItemsAreAllowedByDefault1BoxedNumber](#additionalitemsareallowedbydefault1boxednumber), +[AdditionalItemsAreAllowedByDefault1BoxedString](#additionalitemsareallowedbydefault1boxedstring), +[AdditionalItemsAreAllowedByDefault1BoxedList](#additionalitemsareallowedbydefault1boxedlist), +[AdditionalItemsAreAllowedByDefault1BoxedMap](#additionalitemsareallowedbydefault1boxedmap) + +sealed interface that stores validated payloads using boxed classes + +## AdditionalItemsAreAllowedByDefault1BoxedVoid +data class AdditionalItemsAreAllowedByDefault1BoxedVoid
    +implements [AdditionalItemsAreAllowedByDefault1Boxed](#additionalitemsareallowedbydefault1boxed) + +data class that stores validated null payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| AdditionalItemsAreAllowedByDefault1BoxedVoid(Nothing? data)
    Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| Nothing? | data()
    validated payload | +| Any? | getData()
    validated payload | + +## AdditionalItemsAreAllowedByDefault1BoxedBoolean +data class AdditionalItemsAreAllowedByDefault1BoxedBoolean
    +implements [AdditionalItemsAreAllowedByDefault1Boxed](#additionalitemsareallowedbydefault1boxed) + +record that stores validated boolean payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| AdditionalItemsAreAllowedByDefault1BoxedBoolean(boolean data)
    Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| boolean | data()
    validated payload | +| Any? | getData()
    validated payload | + +## AdditionalItemsAreAllowedByDefault1BoxedNumber +data class AdditionalItemsAreAllowedByDefault1BoxedNumber
    +implements [AdditionalItemsAreAllowedByDefault1Boxed](#additionalitemsareallowedbydefault1boxed) + +data class that stores validated Number payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| AdditionalItemsAreAllowedByDefault1BoxedNumber(Number data)
    Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| Number | data()
    validated payload | +| Any? | getData()
    validated payload | + +## AdditionalItemsAreAllowedByDefault1BoxedString +data class AdditionalItemsAreAllowedByDefault1BoxedString
    +implements [AdditionalItemsAreAllowedByDefault1Boxed](#additionalitemsareallowedbydefault1boxed) + +data class that stores validated String payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| AdditionalItemsAreAllowedByDefault1BoxedString(String data)
    Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| String | data()
    validated payload | +| Any? | getData()
    validated payload | + +## AdditionalItemsAreAllowedByDefault1BoxedList +data class AdditionalItemsAreAllowedByDefault1BoxedList
    +implements [AdditionalItemsAreAllowedByDefault1Boxed](#additionalitemsareallowedbydefault1boxed) + +data class that stores validated List payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| AdditionalItemsAreAllowedByDefault1BoxedList([AdditionalItemsAreAllowedByDefaultList](#additionalitemsareallowedbydefaultlist) data)
    Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| [AdditionalItemsAreAllowedByDefaultList](#additionalitemsareallowedbydefaultlist) | data()
    validated payload | +| Any? | getData()
    validated payload | + +## AdditionalItemsAreAllowedByDefault1BoxedMap +data class AdditionalItemsAreAllowedByDefault1BoxedMap
    +implements [AdditionalItemsAreAllowedByDefault1Boxed](#additionalitemsareallowedbydefault1boxed) + +data class that stores validated Map payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| AdditionalItemsAreAllowedByDefault1BoxedMap(FrozenMap data)
    Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| FrozenMap | data()
    validated payload | +| Any? | getData()
    validated payload | + +## AdditionalItemsAreAllowedByDefault1 +class AdditionalItemsAreAllowedByDefault1
    +extends JsonSchema + +A schema class that validates payloads + +### Field Summary +| Modifier and Type | Field and Description | +| ----------------- | ---------------------- | +| List> | prefixItems = listOf(
        [Schema0::class.java](#schema0)
    )
    | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| String | validate(arg: String, configuration: SchemaConfiguration) | +| Nothing? | validate(arg: Nothing?, configuration: SchemaConfiguration) | +| int | validate(arg: int, configuration: SchemaConfiguration) | +| long | validate(arg: long, configuration: SchemaConfiguration) | +| float | validate(arg: float, configuration: SchemaConfiguration) | +| double | validate(arg: double, configuration: SchemaConfiguration) | +| Number | validate(arg: Number, configuration: SchemaConfiguration) | +| boolean | validate(arg: boolean, configuration: SchemaConfiguration) | +| FrozenMap | validate(arg: Map<?, ?>, configuration: SchemaConfiguration) | +| [AdditionalItemsAreAllowedByDefaultList](#additionalitemsareallowedbydefaultlist) | validate(arg: [List<*>](#additionalitemsareallowedbydefaultlistbuilder), configuration: SchemaConfiguration) | +| [AdditionalItemsAreAllowedByDefault1BoxedString](#additionalitemsareallowedbydefault1boxedstring) | validateAndBox(String, configuration: SchemaConfiguration) | +| [AdditionalItemsAreAllowedByDefault1BoxedVoid](#additionalitemsareallowedbydefault1boxedvoid) | validateAndBox(Nothing?, configuration: SchemaConfiguration) | +| [AdditionalItemsAreAllowedByDefault1BoxedNumber](#additionalitemsareallowedbydefault1boxednumber) | validateAndBox(Number, configuration: SchemaConfiguration) | +| [AdditionalItemsAreAllowedByDefault1BoxedBoolean](#additionalitemsareallowedbydefault1boxedboolean) | validateAndBox(boolean, configuration: SchemaConfiguration) | +| [AdditionalItemsAreAllowedByDefault1BoxedMap](#additionalitemsareallowedbydefault1boxedmap) | validateAndBox(Map<?, ?>, configuration: SchemaConfiguration) | +| [AdditionalItemsAreAllowedByDefault1BoxedList](#additionalitemsareallowedbydefault1boxedlist) | validateAndBox([List<*>](#additionalitemsareallowedbydefaultlistbuilder), configuration: SchemaConfiguration) | +| [AdditionalItemsAreAllowedByDefault1Boxed](#additionalitemsareallowedbydefault1boxed) | validateAndBox(Any?, configuration: SchemaConfiguration) | +| Any? | validate(arg: Any?, configuration: SchemaConfiguration) | + +## Schema0Boxed +sealed interface Schema0Boxed
    +permits
    +[Schema0BoxedNumber](#schema0boxednumber) + +sealed interface that stores validated payloads using boxed classes + +## Schema0BoxedNumber +data class Schema0BoxedNumber
    +implements [Schema0Boxed](#schema0boxed) + +data class that stores validated Number payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| Schema0BoxedNumber(Number data)
    Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| Number | data()
    validated payload | +| Any? | getData()
    validated payload | + +## Schema0 +class Schema0
    +extends IntJsonSchema.IntJsonSchema1 + +A schema class that validates payloads + +| Methods Inherited from class org.openapijsonschematools.client.schemas.IntJsonSchema.IntJsonSchema1 | +| ------------------------------------------------------------------ | +| validate | +| validateAndBox | + +## AdditionalItemsAreAllowedByDefaultListBuilder +class AdditionalItemsAreAllowedByDefaultListBuilder
    +builder for `List` + +A class that builds the List input type + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| AdditionalItemsAreAllowedByDefaultListBuilder()
    Creates an empty list | +| AdditionalItemsAreAllowedByDefaultListBuilder(List items)
    Stores the items in a list | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| AdditionalItemsAreAllowedByDefaultListBuilder | add(item: Nothing?) | +| AdditionalItemsAreAllowedByDefaultListBuilder | add(item: Boolean) | +| AdditionalItemsAreAllowedByDefaultListBuilder | add(item: String) | +| AdditionalItemsAreAllowedByDefaultListBuilder | add(item: Int) | +| AdditionalItemsAreAllowedByDefaultListBuilder | add(item: Float) | +| AdditionalItemsAreAllowedByDefaultListBuilder | add(item: Long) | +| AdditionalItemsAreAllowedByDefaultListBuilder | add(item: Double) | +| AdditionalItemsAreAllowedByDefaultListBuilder | add(item: List) | +| AdditionalItemsAreAllowedByDefaultListBuilder | add(item: Map) | +| List | build()
    Returns list input that should be used with Schema.validate | + +## AdditionalItemsAreAllowedByDefaultList +class AdditionalItemsAreAllowedByDefaultList
    +extends `FrozenList` + +A class to store validated List payloads + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| static [AdditionalItemsAreAllowedByDefaultList](#additionalitemsareallowedbydefaultlist) | of([List](#additionalitemsareallowedbydefaultlistbuilder) arg, SchemaConfiguration configuration) | + +[[Back to top]](#top) [[Back to Component Schemas]](../../../README.md#Component-Schemas) [[Back to README]](../../../README.md) diff --git a/samples/client/3_1_0_unit_test/kotlin/docs/components/schemas/AdditionalpropertiesAreAllowedByDefault.md b/samples/client/3_1_0_unit_test/kotlin/docs/components/schemas/AdditionalpropertiesAreAllowedByDefault.md new file mode 100644 index 00000000000..c3785564640 --- /dev/null +++ b/samples/client/3_1_0_unit_test/kotlin/docs/components/schemas/AdditionalpropertiesAreAllowedByDefault.md @@ -0,0 +1,496 @@ +# AdditionalpropertiesAreAllowedByDefault +org.openapijsonschematools.client.components.schemas.AdditionalpropertiesAreAllowedByDefault.java +class AdditionalpropertiesAreAllowedByDefault
    + +A class that contains necessary nested +- schema classes (which validate payloads), extends JsonSchema +- sealed interfaces which store validated payloads, Kotlin version of a sum type +- boxed classes which store validated payloads, sealed permits class implementations +- classes to store validated map payloads, extends FrozenMap +- classes to build inputs for map payloads + +## Nested Class Summary +| Modifier and Type | Class and Description | +| ----------------- | ---------------------- | +| sealed interface | [AdditionalpropertiesAreAllowedByDefault.AdditionalpropertiesAreAllowedByDefault1Boxed](#additionalpropertiesareallowedbydefault1boxed)
    sealed interface for validated payloads | +| record | [AdditionalpropertiesAreAllowedByDefault.AdditionalpropertiesAreAllowedByDefault1BoxedVoid](#additionalpropertiesareallowedbydefault1boxedvoid)
    boxed class to store validated null payloads | +| record | [AdditionalpropertiesAreAllowedByDefault.AdditionalpropertiesAreAllowedByDefault1BoxedBoolean](#additionalpropertiesareallowedbydefault1boxedboolean)
    boxed class to store validated boolean payloads | +| record | [AdditionalpropertiesAreAllowedByDefault.AdditionalpropertiesAreAllowedByDefault1BoxedNumber](#additionalpropertiesareallowedbydefault1boxednumber)
    boxed class to store validated Number payloads | +| record | [AdditionalpropertiesAreAllowedByDefault.AdditionalpropertiesAreAllowedByDefault1BoxedString](#additionalpropertiesareallowedbydefault1boxedstring)
    boxed class to store validated String payloads | +| record | [AdditionalpropertiesAreAllowedByDefault.AdditionalpropertiesAreAllowedByDefault1BoxedList](#additionalpropertiesareallowedbydefault1boxedlist)
    boxed class to store validated List payloads | +| record | [AdditionalpropertiesAreAllowedByDefault.AdditionalpropertiesAreAllowedByDefault1BoxedMap](#additionalpropertiesareallowedbydefault1boxedmap)
    boxed class to store validated Map payloads | +| static class | [AdditionalpropertiesAreAllowedByDefault.AdditionalpropertiesAreAllowedByDefault1](#additionalpropertiesareallowedbydefault1)
    schema class | +| static class | [AdditionalpropertiesAreAllowedByDefault.AdditionalpropertiesAreAllowedByDefaultMapBuilder](#additionalpropertiesareallowedbydefaultmapbuilder)
    builder for Map payloads | +| static class | [AdditionalpropertiesAreAllowedByDefault.AdditionalpropertiesAreAllowedByDefaultMap](#additionalpropertiesareallowedbydefaultmap)
    output class for Map payloads | +| sealed interface | [AdditionalpropertiesAreAllowedByDefault.BarBoxed](#barboxed)
    sealed interface for validated payloads | +| record | [AdditionalpropertiesAreAllowedByDefault.BarBoxedVoid](#barboxedvoid)
    boxed class to store validated null payloads | +| record | [AdditionalpropertiesAreAllowedByDefault.BarBoxedBoolean](#barboxedboolean)
    boxed class to store validated boolean payloads | +| record | [AdditionalpropertiesAreAllowedByDefault.BarBoxedNumber](#barboxednumber)
    boxed class to store validated Number payloads | +| record | [AdditionalpropertiesAreAllowedByDefault.BarBoxedString](#barboxedstring)
    boxed class to store validated String payloads | +| record | [AdditionalpropertiesAreAllowedByDefault.BarBoxedList](#barboxedlist)
    boxed class to store validated List payloads | +| record | [AdditionalpropertiesAreAllowedByDefault.BarBoxedMap](#barboxedmap)
    boxed class to store validated Map payloads | +| static class | [AdditionalpropertiesAreAllowedByDefault.Bar](#bar)
    schema class | +| sealed interface | [AdditionalpropertiesAreAllowedByDefault.FooBoxed](#fooboxed)
    sealed interface for validated payloads | +| record | [AdditionalpropertiesAreAllowedByDefault.FooBoxedVoid](#fooboxedvoid)
    boxed class to store validated null payloads | +| record | [AdditionalpropertiesAreAllowedByDefault.FooBoxedBoolean](#fooboxedboolean)
    boxed class to store validated boolean payloads | +| record | [AdditionalpropertiesAreAllowedByDefault.FooBoxedNumber](#fooboxednumber)
    boxed class to store validated Number payloads | +| record | [AdditionalpropertiesAreAllowedByDefault.FooBoxedString](#fooboxedstring)
    boxed class to store validated String payloads | +| record | [AdditionalpropertiesAreAllowedByDefault.FooBoxedList](#fooboxedlist)
    boxed class to store validated List payloads | +| record | [AdditionalpropertiesAreAllowedByDefault.FooBoxedMap](#fooboxedmap)
    boxed class to store validated Map payloads | +| static class | [AdditionalpropertiesAreAllowedByDefault.Foo](#foo)
    schema class | + +## AdditionalpropertiesAreAllowedByDefault1Boxed +sealed interface AdditionalpropertiesAreAllowedByDefault1Boxed
    +permits
    +[AdditionalpropertiesAreAllowedByDefault1BoxedVoid](#additionalpropertiesareallowedbydefault1boxedvoid), +[AdditionalpropertiesAreAllowedByDefault1BoxedBoolean](#additionalpropertiesareallowedbydefault1boxedboolean), +[AdditionalpropertiesAreAllowedByDefault1BoxedNumber](#additionalpropertiesareallowedbydefault1boxednumber), +[AdditionalpropertiesAreAllowedByDefault1BoxedString](#additionalpropertiesareallowedbydefault1boxedstring), +[AdditionalpropertiesAreAllowedByDefault1BoxedList](#additionalpropertiesareallowedbydefault1boxedlist), +[AdditionalpropertiesAreAllowedByDefault1BoxedMap](#additionalpropertiesareallowedbydefault1boxedmap) + +sealed interface that stores validated payloads using boxed classes + +## AdditionalpropertiesAreAllowedByDefault1BoxedVoid +data class AdditionalpropertiesAreAllowedByDefault1BoxedVoid
    +implements [AdditionalpropertiesAreAllowedByDefault1Boxed](#additionalpropertiesareallowedbydefault1boxed) + +data class that stores validated null payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| AdditionalpropertiesAreAllowedByDefault1BoxedVoid(Nothing? data)
    Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| Nothing? | data()
    validated payload | +| Any? | getData()
    validated payload | + +## AdditionalpropertiesAreAllowedByDefault1BoxedBoolean +data class AdditionalpropertiesAreAllowedByDefault1BoxedBoolean
    +implements [AdditionalpropertiesAreAllowedByDefault1Boxed](#additionalpropertiesareallowedbydefault1boxed) + +record that stores validated boolean payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| AdditionalpropertiesAreAllowedByDefault1BoxedBoolean(boolean data)
    Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| boolean | data()
    validated payload | +| Any? | getData()
    validated payload | + +## AdditionalpropertiesAreAllowedByDefault1BoxedNumber +data class AdditionalpropertiesAreAllowedByDefault1BoxedNumber
    +implements [AdditionalpropertiesAreAllowedByDefault1Boxed](#additionalpropertiesareallowedbydefault1boxed) + +data class that stores validated Number payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| AdditionalpropertiesAreAllowedByDefault1BoxedNumber(Number data)
    Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| Number | data()
    validated payload | +| Any? | getData()
    validated payload | + +## AdditionalpropertiesAreAllowedByDefault1BoxedString +data class AdditionalpropertiesAreAllowedByDefault1BoxedString
    +implements [AdditionalpropertiesAreAllowedByDefault1Boxed](#additionalpropertiesareallowedbydefault1boxed) + +data class that stores validated String payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| AdditionalpropertiesAreAllowedByDefault1BoxedString(String data)
    Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| String | data()
    validated payload | +| Any? | getData()
    validated payload | + +## AdditionalpropertiesAreAllowedByDefault1BoxedList +data class AdditionalpropertiesAreAllowedByDefault1BoxedList
    +implements [AdditionalpropertiesAreAllowedByDefault1Boxed](#additionalpropertiesareallowedbydefault1boxed) + +data class that stores validated List payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| AdditionalpropertiesAreAllowedByDefault1BoxedList(FrozenList data)
    Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| FrozenList | data()
    validated payload | +| Any? | getData()
    validated payload | + +## AdditionalpropertiesAreAllowedByDefault1BoxedMap +data class AdditionalpropertiesAreAllowedByDefault1BoxedMap
    +implements [AdditionalpropertiesAreAllowedByDefault1Boxed](#additionalpropertiesareallowedbydefault1boxed) + +data class that stores validated Map payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| AdditionalpropertiesAreAllowedByDefault1BoxedMap([AdditionalpropertiesAreAllowedByDefaultMap](#additionalpropertiesareallowedbydefaultmap) data)
    Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| [AdditionalpropertiesAreAllowedByDefaultMap](#additionalpropertiesareallowedbydefaultmap) | data()
    validated payload | +| Any? | getData()
    validated payload | + +## AdditionalpropertiesAreAllowedByDefault1 +class AdditionalpropertiesAreAllowedByDefault1
    +extends JsonSchema + +A schema class that validates payloads + +### Field Summary +| Modifier and Type | Field and Description | +| ----------------- | ---------------------- | +| Map> | properties = mapOf(
        "foo" to [Foo::class.java](#foo)),
        "bar" to [Bar::class.java](#bar))
    )
    | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| String | validate(arg: String, configuration: SchemaConfiguration) | +| Nothing? | validate(arg: Nothing?, configuration: SchemaConfiguration) | +| int | validate(arg: int, configuration: SchemaConfiguration) | +| long | validate(arg: long, configuration: SchemaConfiguration) | +| float | validate(arg: float, configuration: SchemaConfiguration) | +| double | validate(arg: double, configuration: SchemaConfiguration) | +| Number | validate(arg: Number, configuration: SchemaConfiguration) | +| boolean | validate(arg: boolean, configuration: SchemaConfiguration) | +| [AdditionalpropertiesAreAllowedByDefaultMap](#additionalpropertiesareallowedbydefaultmap) | validate(arg: [Map<?, ?>](#additionalpropertiesareallowedbydefaultmapbuilder), configuration: SchemaConfiguration) | +| FrozenList | validate(arg: List<*>, configuration: SchemaConfiguration) | +| [AdditionalpropertiesAreAllowedByDefault1BoxedString](#additionalpropertiesareallowedbydefault1boxedstring) | validateAndBox(String, configuration: SchemaConfiguration) | +| [AdditionalpropertiesAreAllowedByDefault1BoxedVoid](#additionalpropertiesareallowedbydefault1boxedvoid) | validateAndBox(Nothing?, configuration: SchemaConfiguration) | +| [AdditionalpropertiesAreAllowedByDefault1BoxedNumber](#additionalpropertiesareallowedbydefault1boxednumber) | validateAndBox(Number, configuration: SchemaConfiguration) | +| [AdditionalpropertiesAreAllowedByDefault1BoxedBoolean](#additionalpropertiesareallowedbydefault1boxedboolean) | validateAndBox(boolean, configuration: SchemaConfiguration) | +| [AdditionalpropertiesAreAllowedByDefault1BoxedMap](#additionalpropertiesareallowedbydefault1boxedmap) | validateAndBox([Map<?, ?>](#additionalpropertiesareallowedbydefaultmapbuilder), configuration: SchemaConfiguration) | +| [AdditionalpropertiesAreAllowedByDefault1BoxedList](#additionalpropertiesareallowedbydefault1boxedlist) | validateAndBox(List<*>, configuration: SchemaConfiguration) | +| [AdditionalpropertiesAreAllowedByDefault1Boxed](#additionalpropertiesareallowedbydefault1boxed) | validateAndBox(Any?, configuration: SchemaConfiguration) | +| Any? | validate(arg: Any?, configuration: SchemaConfiguration) | + +## AdditionalpropertiesAreAllowedByDefaultMapBuilder +class AdditionalpropertiesAreAllowedByDefaultMapBuilder
    +builder for `Map` + +A class that builds the Map input type + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| AdditionalpropertiesAreAllowedByDefaultMapBuilder()
    Creates a builder that contains an empty map | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| Map | build()
    Returns map input that should be used with Schema.validate | +| [AdditionalpropertiesAreAllowedByDefaultMapBuilder](#additionalpropertiesareallowedbydefaultmapbuilder) | foo(value: Nothing?) | +| [AdditionalpropertiesAreAllowedByDefaultMapBuilder](#additionalpropertiesareallowedbydefaultmapbuilder) | foo(value: Boolean) | +| [AdditionalpropertiesAreAllowedByDefaultMapBuilder](#additionalpropertiesareallowedbydefaultmapbuilder) | foo(value: String) | +| [AdditionalpropertiesAreAllowedByDefaultMapBuilder](#additionalpropertiesareallowedbydefaultmapbuilder) | foo(value: Int) | +| [AdditionalpropertiesAreAllowedByDefaultMapBuilder](#additionalpropertiesareallowedbydefaultmapbuilder) | foo(value: Float) | +| [AdditionalpropertiesAreAllowedByDefaultMapBuilder](#additionalpropertiesareallowedbydefaultmapbuilder) | foo(value: Long) | +| [AdditionalpropertiesAreAllowedByDefaultMapBuilder](#additionalpropertiesareallowedbydefaultmapbuilder) | foo(value: Double) | +| [AdditionalpropertiesAreAllowedByDefaultMapBuilder](#additionalpropertiesareallowedbydefaultmapbuilder) | foo(value: List) | +| [AdditionalpropertiesAreAllowedByDefaultMapBuilder](#additionalpropertiesareallowedbydefaultmapbuilder) | foo(value: Map) | +| [AdditionalpropertiesAreAllowedByDefaultMapBuilder](#additionalpropertiesareallowedbydefaultmapbuilder) | bar(value: Nothing?) | +| [AdditionalpropertiesAreAllowedByDefaultMapBuilder](#additionalpropertiesareallowedbydefaultmapbuilder) | bar(value: Boolean) | +| [AdditionalpropertiesAreAllowedByDefaultMapBuilder](#additionalpropertiesareallowedbydefaultmapbuilder) | bar(value: String) | +| [AdditionalpropertiesAreAllowedByDefaultMapBuilder](#additionalpropertiesareallowedbydefaultmapbuilder) | bar(value: Int) | +| [AdditionalpropertiesAreAllowedByDefaultMapBuilder](#additionalpropertiesareallowedbydefaultmapbuilder) | bar(value: Float) | +| [AdditionalpropertiesAreAllowedByDefaultMapBuilder](#additionalpropertiesareallowedbydefaultmapbuilder) | bar(value: Long) | +| [AdditionalpropertiesAreAllowedByDefaultMapBuilder](#additionalpropertiesareallowedbydefaultmapbuilder) | bar(value: Double) | +| [AdditionalpropertiesAreAllowedByDefaultMapBuilder](#additionalpropertiesareallowedbydefaultmapbuilder) | bar(value: List) | +| [AdditionalpropertiesAreAllowedByDefaultMapBuilder](#additionalpropertiesareallowedbydefaultmapbuilder) | bar(value: Map) | +| [AdditionalpropertiesAreAllowedByDefaultMapBuilder](#additionalpropertiesareallowedbydefaultmapbuilder) | additionalProperty(key: String, value: Nothing?) | +| [AdditionalpropertiesAreAllowedByDefaultMapBuilder](#additionalpropertiesareallowedbydefaultmapbuilder) | additionalProperty(key: String, value: Boolean) | +| [AdditionalpropertiesAreAllowedByDefaultMapBuilder](#additionalpropertiesareallowedbydefaultmapbuilder) | additionalProperty(key: String, value: String) | +| [AdditionalpropertiesAreAllowedByDefaultMapBuilder](#additionalpropertiesareallowedbydefaultmapbuilder) | additionalProperty(key: String, value: Int) | +| [AdditionalpropertiesAreAllowedByDefaultMapBuilder](#additionalpropertiesareallowedbydefaultmapbuilder) | additionalProperty(key: String, value: Float) | +| [AdditionalpropertiesAreAllowedByDefaultMapBuilder](#additionalpropertiesareallowedbydefaultmapbuilder) | additionalProperty(key: String, value: Long) | +| [AdditionalpropertiesAreAllowedByDefaultMapBuilder](#additionalpropertiesareallowedbydefaultmapbuilder) | additionalProperty(key: String, value: Double) | +| [AdditionalpropertiesAreAllowedByDefaultMapBuilder](#additionalpropertiesareallowedbydefaultmapbuilder) | additionalProperty(key: String, value: List) | +| [AdditionalpropertiesAreAllowedByDefaultMapBuilder](#additionalpropertiesareallowedbydefaultmapbuilder) | additionalProperty(key: String, value: Map) | + +## AdditionalpropertiesAreAllowedByDefaultMap +class AdditionalpropertiesAreAllowedByDefaultMap
    +extends FrozenMap + +A class to store validated Map payloads + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| static [AdditionalpropertiesAreAllowedByDefaultMap](#additionalpropertiesareallowedbydefaultmap) | of([Map](#additionalpropertiesareallowedbydefaultmapbuilder) arg, SchemaConfiguration configuration) | +| Any? | foo()
    [optional] | +| Any? | bar()
    [optional] | +| Any? | getAdditionalProperty(String name)
    provides type safety for additional properties | + +## BarBoxed +sealed interface BarBoxed
    +permits
    +[BarBoxedVoid](#barboxedvoid), +[BarBoxedBoolean](#barboxedboolean), +[BarBoxedNumber](#barboxednumber), +[BarBoxedString](#barboxedstring), +[BarBoxedList](#barboxedlist), +[BarBoxedMap](#barboxedmap) + +sealed interface that stores validated payloads using boxed classes + +## BarBoxedVoid +data class BarBoxedVoid
    +implements [BarBoxed](#barboxed) + +data class that stores validated null payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| BarBoxedVoid(Nothing? data)
    Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| Nothing? | data()
    validated payload | +| Any? | getData()
    validated payload | + +## BarBoxedBoolean +data class BarBoxedBoolean
    +implements [BarBoxed](#barboxed) + +record that stores validated boolean payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| BarBoxedBoolean(boolean data)
    Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| boolean | data()
    validated payload | +| Any? | getData()
    validated payload | + +## BarBoxedNumber +data class BarBoxedNumber
    +implements [BarBoxed](#barboxed) + +data class that stores validated Number payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| BarBoxedNumber(Number data)
    Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| Number | data()
    validated payload | +| Any? | getData()
    validated payload | + +## BarBoxedString +data class BarBoxedString
    +implements [BarBoxed](#barboxed) + +data class that stores validated String payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| BarBoxedString(String data)
    Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| String | data()
    validated payload | +| Any? | getData()
    validated payload | + +## BarBoxedList +data class BarBoxedList
    +implements [BarBoxed](#barboxed) + +data class that stores validated List payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| BarBoxedList(FrozenList data)
    Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| FrozenList | data()
    validated payload | +| Any? | getData()
    validated payload | + +## BarBoxedMap +data class BarBoxedMap
    +implements [BarBoxed](#barboxed) + +data class that stores validated Map payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| BarBoxedMap(FrozenMap data)
    Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| FrozenMap | data()
    validated payload | +| Any? | getData()
    validated payload | + +## Bar +class Bar
    +extends AnyTypeJsonSchema.AnyTypeJsonSchema1 + +A schema class that validates payloads + +| Methods Inherited from class org.openapijsonschematools.client.schemas.AnyTypeJsonSchema.AnyTypeJsonSchema1 | +| ------------------------------------------------------------------ | +| validate | +| validateAndBox | + +## FooBoxed +sealed interface FooBoxed
    +permits
    +[FooBoxedVoid](#fooboxedvoid), +[FooBoxedBoolean](#fooboxedboolean), +[FooBoxedNumber](#fooboxednumber), +[FooBoxedString](#fooboxedstring), +[FooBoxedList](#fooboxedlist), +[FooBoxedMap](#fooboxedmap) + +sealed interface that stores validated payloads using boxed classes + +## FooBoxedVoid +data class FooBoxedVoid
    +implements [FooBoxed](#fooboxed) + +data class that stores validated null payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| FooBoxedVoid(Nothing? data)
    Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| Nothing? | data()
    validated payload | +| Any? | getData()
    validated payload | + +## FooBoxedBoolean +data class FooBoxedBoolean
    +implements [FooBoxed](#fooboxed) + +record that stores validated boolean payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| FooBoxedBoolean(boolean data)
    Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| boolean | data()
    validated payload | +| Any? | getData()
    validated payload | + +## FooBoxedNumber +data class FooBoxedNumber
    +implements [FooBoxed](#fooboxed) + +data class that stores validated Number payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| FooBoxedNumber(Number data)
    Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| Number | data()
    validated payload | +| Any? | getData()
    validated payload | + +## FooBoxedString +data class FooBoxedString
    +implements [FooBoxed](#fooboxed) + +data class that stores validated String payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| FooBoxedString(String data)
    Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| String | data()
    validated payload | +| Any? | getData()
    validated payload | + +## FooBoxedList +data class FooBoxedList
    +implements [FooBoxed](#fooboxed) + +data class that stores validated List payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| FooBoxedList(FrozenList data)
    Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| FrozenList | data()
    validated payload | +| Any? | getData()
    validated payload | + +## FooBoxedMap +data class FooBoxedMap
    +implements [FooBoxed](#fooboxed) + +data class that stores validated Map payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| FooBoxedMap(FrozenMap data)
    Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| FrozenMap | data()
    validated payload | +| Any? | getData()
    validated payload | + +## Foo +class Foo
    +extends AnyTypeJsonSchema.AnyTypeJsonSchema1 + +A schema class that validates payloads + +| Methods Inherited from class org.openapijsonschematools.client.schemas.AnyTypeJsonSchema.AnyTypeJsonSchema1 | +| ------------------------------------------------------------------ | +| validate | +| validateAndBox | + +[[Back to top]](#top) [[Back to Component Schemas]](../../../README.md#Component-Schemas) [[Back to README]](../../../README.md) diff --git a/samples/client/3_1_0_unit_test/kotlin/docs/components/schemas/AdditionalpropertiesCanExistByItself.md b/samples/client/3_1_0_unit_test/kotlin/docs/components/schemas/AdditionalpropertiesCanExistByItself.md new file mode 100644 index 00000000000..fdc764ec2a1 --- /dev/null +++ b/samples/client/3_1_0_unit_test/kotlin/docs/components/schemas/AdditionalpropertiesCanExistByItself.md @@ -0,0 +1,159 @@ +# AdditionalpropertiesCanExistByItself +org.openapijsonschematools.client.components.schemas.AdditionalpropertiesCanExistByItself.java +class AdditionalpropertiesCanExistByItself
    + +A class that contains necessary nested +- schema classes (which validate payloads), extends JsonSchema +- sealed interfaces which store validated payloads, Kotlin version of a sum type +- boxed classes which store validated payloads, sealed permits class implementations +- classes to store validated map payloads, extends FrozenMap +- classes to build inputs for map payloads + +## Nested Class Summary +| Modifier and Type | Class and Description | +| ----------------- | ---------------------- | +| sealed interface | [AdditionalpropertiesCanExistByItself.AdditionalpropertiesCanExistByItself1Boxed](#additionalpropertiescanexistbyitself1boxed)
    sealed interface for validated payloads | +| record | [AdditionalpropertiesCanExistByItself.AdditionalpropertiesCanExistByItself1BoxedMap](#additionalpropertiescanexistbyitself1boxedmap)
    boxed class to store validated Map payloads | +| static class | [AdditionalpropertiesCanExistByItself.AdditionalpropertiesCanExistByItself1](#additionalpropertiescanexistbyitself1)
    schema class | +| static class | [AdditionalpropertiesCanExistByItself.AdditionalpropertiesCanExistByItselfMapBuilder](#additionalpropertiescanexistbyitselfmapbuilder)
    builder for Map payloads | +| static class | [AdditionalpropertiesCanExistByItself.AdditionalpropertiesCanExistByItselfMap](#additionalpropertiescanexistbyitselfmap)
    output class for Map payloads | +| sealed interface | [AdditionalpropertiesCanExistByItself.AdditionalPropertiesBoxed](#additionalpropertiesboxed)
    sealed interface for validated payloads | +| record | [AdditionalpropertiesCanExistByItself.AdditionalPropertiesBoxedBoolean](#additionalpropertiesboxedboolean)
    boxed class to store validated boolean payloads | +| static class | [AdditionalpropertiesCanExistByItself.AdditionalProperties](#additionalproperties)
    schema class | + +## AdditionalpropertiesCanExistByItself1Boxed +sealed interface AdditionalpropertiesCanExistByItself1Boxed
    +permits
    +[AdditionalpropertiesCanExistByItself1BoxedMap](#additionalpropertiescanexistbyitself1boxedmap) + +sealed interface that stores validated payloads using boxed classes + +## AdditionalpropertiesCanExistByItself1BoxedMap +data class AdditionalpropertiesCanExistByItself1BoxedMap
    +implements [AdditionalpropertiesCanExistByItself1Boxed](#additionalpropertiescanexistbyitself1boxed) + +data class that stores validated Map payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| AdditionalpropertiesCanExistByItself1BoxedMap([AdditionalpropertiesCanExistByItselfMap](#additionalpropertiescanexistbyitselfmap) data)
    Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| [AdditionalpropertiesCanExistByItselfMap](#additionalpropertiescanexistbyitselfmap) | data()
    validated payload | +| Any? | getData()
    validated payload | + +## AdditionalpropertiesCanExistByItself1 +class AdditionalpropertiesCanExistByItself1
    +extends JsonSchema + +A schema class that validates payloads + +### Code Sample +``` +import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags; +import org.openapijsonschematools.client.configurations.SchemaConfiguration; +import org.openapijsonschematools.client.exceptions.ValidationException; +import org.openapijsonschematools.client.schemas.validation.MapUtils; +import org.openapijsonschematools.client.schemas.validation.FrozenList; +import org.openapijsonschematools.client.schemas.validation.FrozenMap; +import org.openapijsonschematools.client.components.schemas.AdditionalpropertiesCanExistByItself; + +import java.util.Arrays; +import java.util.List; +import java.util.AbstractMap; + +static final SchemaConfiguration configuration = new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().build()); + +// Map validation +AdditionalpropertiesCanExistByItself.AdditionalpropertiesCanExistByItselfMap validatedPayload = + AdditionalpropertiesCanExistByItself.AdditionalpropertiesCanExistByItself1.validate( + new AdditionalpropertiesCanExistByItself.AdditionalpropertiesCanExistByItselfMapBuilder() + .additionalProperty("someAdditionalProperty", true) + + .build(), + configuration +); +``` + +### Field Summary +| Modifier and Type | Field and Description | +| ----------------- | ---------------------- | +| Set> | type = setOf(Map::class.java) | +| Class | additionalProperties = [AdditionalProperties::class.java](#additionalproperties) | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| [AdditionalpropertiesCanExistByItselfMap](#additionalpropertiescanexistbyitselfmap) | validate(arg: [Map<?, ?>](#additionalpropertiescanexistbyitselfmapbuilder), configuration: SchemaConfiguration) | +| [AdditionalpropertiesCanExistByItself1BoxedMap](#additionalpropertiescanexistbyitself1boxedmap) | validateAndBox([Map<?, ?>](#additionalpropertiescanexistbyitselfmapbuilder), configuration: SchemaConfiguration) | +| [AdditionalpropertiesCanExistByItself1Boxed](#additionalpropertiescanexistbyitself1boxed) | validateAndBox(Any?, configuration: SchemaConfiguration) | +| Any? | validate(arg: Any?, configuration: SchemaConfiguration) | + +## AdditionalpropertiesCanExistByItselfMapBuilder +class AdditionalpropertiesCanExistByItselfMapBuilder
    +builder for `Map` + +A class that builds the Map input type + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| AdditionalpropertiesCanExistByItselfMapBuilder()
    Creates a builder that contains an empty map | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| Map | build()
    Returns map input that should be used with Schema.validate | +| [AdditionalpropertiesCanExistByItselfMapBuilder](#additionalpropertiescanexistbyitselfmapbuilder) | additionalProperty(key: String, value: Boolean) | + +## AdditionalpropertiesCanExistByItselfMap +class AdditionalpropertiesCanExistByItselfMap
    +extends FrozenMap + +A class to store validated Map payloads + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| static [AdditionalpropertiesCanExistByItselfMap](#additionalpropertiescanexistbyitselfmap) | of([Map](#additionalpropertiescanexistbyitselfmapbuilder) arg, SchemaConfiguration configuration) | +| Boolean | getAdditionalProperty(String name)
    provides type safety for additional properties | + +## AdditionalPropertiesBoxed +sealed interface AdditionalPropertiesBoxed
    +permits
    +[AdditionalPropertiesBoxedBoolean](#additionalpropertiesboxedboolean) + +sealed interface that stores validated payloads using boxed classes + +## AdditionalPropertiesBoxedBoolean +data class AdditionalPropertiesBoxedBoolean
    +implements [AdditionalPropertiesBoxed](#additionalpropertiesboxed) + +record that stores validated boolean payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| AdditionalPropertiesBoxedBoolean(boolean data)
    Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| boolean | data()
    validated payload | +| Any? | getData()
    validated payload | + +## AdditionalProperties +class AdditionalProperties
    +extends BooleanJsonSchema.BooleanJsonSchema1 + +A schema class that validates payloads + +| Methods Inherited from class org.openapijsonschematools.client.schemas.BooleanJsonSchema.BooleanJsonSchema1 | +| ------------------------------------------------------------------ | +| validate | +| validateAndBox | + +[[Back to top]](#top) [[Back to Component Schemas]](../../../README.md#Component-Schemas) [[Back to README]](../../../README.md) diff --git a/samples/client/3_1_0_unit_test/kotlin/docs/components/schemas/AdditionalpropertiesDoesNotLookInApplicators.md b/samples/client/3_1_0_unit_test/kotlin/docs/components/schemas/AdditionalpropertiesDoesNotLookInApplicators.md new file mode 100644 index 00000000000..311d802ebd0 --- /dev/null +++ b/samples/client/3_1_0_unit_test/kotlin/docs/components/schemas/AdditionalpropertiesDoesNotLookInApplicators.md @@ -0,0 +1,578 @@ +# AdditionalpropertiesDoesNotLookInApplicators +org.openapijsonschematools.client.components.schemas.AdditionalpropertiesDoesNotLookInApplicators.java +class AdditionalpropertiesDoesNotLookInApplicators
    + +A class that contains necessary nested +- schema classes (which validate payloads), extends JsonSchema +- sealed interfaces which store validated payloads, Kotlin version of a sum type +- boxed classes which store validated payloads, sealed permits class implementations +- classes to store validated map payloads, extends FrozenMap +- classes to build inputs for map payloads + +## Nested Class Summary +| Modifier and Type | Class and Description | +| ----------------- | ---------------------- | +| sealed interface | [AdditionalpropertiesDoesNotLookInApplicators.AdditionalpropertiesDoesNotLookInApplicators1Boxed](#additionalpropertiesdoesnotlookinapplicators1boxed)
    sealed interface for validated payloads | +| record | [AdditionalpropertiesDoesNotLookInApplicators.AdditionalpropertiesDoesNotLookInApplicators1BoxedVoid](#additionalpropertiesdoesnotlookinapplicators1boxedvoid)
    boxed class to store validated null payloads | +| record | [AdditionalpropertiesDoesNotLookInApplicators.AdditionalpropertiesDoesNotLookInApplicators1BoxedBoolean](#additionalpropertiesdoesnotlookinapplicators1boxedboolean)
    boxed class to store validated boolean payloads | +| record | [AdditionalpropertiesDoesNotLookInApplicators.AdditionalpropertiesDoesNotLookInApplicators1BoxedNumber](#additionalpropertiesdoesnotlookinapplicators1boxednumber)
    boxed class to store validated Number payloads | +| record | [AdditionalpropertiesDoesNotLookInApplicators.AdditionalpropertiesDoesNotLookInApplicators1BoxedString](#additionalpropertiesdoesnotlookinapplicators1boxedstring)
    boxed class to store validated String payloads | +| record | [AdditionalpropertiesDoesNotLookInApplicators.AdditionalpropertiesDoesNotLookInApplicators1BoxedList](#additionalpropertiesdoesnotlookinapplicators1boxedlist)
    boxed class to store validated List payloads | +| record | [AdditionalpropertiesDoesNotLookInApplicators.AdditionalpropertiesDoesNotLookInApplicators1BoxedMap](#additionalpropertiesdoesnotlookinapplicators1boxedmap)
    boxed class to store validated Map payloads | +| static class | [AdditionalpropertiesDoesNotLookInApplicators.AdditionalpropertiesDoesNotLookInApplicators1](#additionalpropertiesdoesnotlookinapplicators1)
    schema class | +| static class | [AdditionalpropertiesDoesNotLookInApplicators.AdditionalpropertiesDoesNotLookInApplicatorsMapBuilder](#additionalpropertiesdoesnotlookinapplicatorsmapbuilder)
    builder for Map payloads | +| static class | [AdditionalpropertiesDoesNotLookInApplicators.AdditionalpropertiesDoesNotLookInApplicatorsMap](#additionalpropertiesdoesnotlookinapplicatorsmap)
    output class for Map payloads | +| sealed interface | [AdditionalpropertiesDoesNotLookInApplicators.Schema0Boxed](#schema0boxed)
    sealed interface for validated payloads | +| record | [AdditionalpropertiesDoesNotLookInApplicators.Schema0BoxedVoid](#schema0boxedvoid)
    boxed class to store validated null payloads | +| record | [AdditionalpropertiesDoesNotLookInApplicators.Schema0BoxedBoolean](#schema0boxedboolean)
    boxed class to store validated boolean payloads | +| record | [AdditionalpropertiesDoesNotLookInApplicators.Schema0BoxedNumber](#schema0boxednumber)
    boxed class to store validated Number payloads | +| record | [AdditionalpropertiesDoesNotLookInApplicators.Schema0BoxedString](#schema0boxedstring)
    boxed class to store validated String payloads | +| record | [AdditionalpropertiesDoesNotLookInApplicators.Schema0BoxedList](#schema0boxedlist)
    boxed class to store validated List payloads | +| record | [AdditionalpropertiesDoesNotLookInApplicators.Schema0BoxedMap](#schema0boxedmap)
    boxed class to store validated Map payloads | +| static class | [AdditionalpropertiesDoesNotLookInApplicators.Schema0](#schema0)
    schema class | +| static class | [AdditionalpropertiesDoesNotLookInApplicators.Schema0MapBuilder](#schema0mapbuilder)
    builder for Map payloads | +| static class | [AdditionalpropertiesDoesNotLookInApplicators.Schema0Map](#schema0map)
    output class for Map payloads | +| sealed interface | [AdditionalpropertiesDoesNotLookInApplicators.FooBoxed](#fooboxed)
    sealed interface for validated payloads | +| record | [AdditionalpropertiesDoesNotLookInApplicators.FooBoxedVoid](#fooboxedvoid)
    boxed class to store validated null payloads | +| record | [AdditionalpropertiesDoesNotLookInApplicators.FooBoxedBoolean](#fooboxedboolean)
    boxed class to store validated boolean payloads | +| record | [AdditionalpropertiesDoesNotLookInApplicators.FooBoxedNumber](#fooboxednumber)
    boxed class to store validated Number payloads | +| record | [AdditionalpropertiesDoesNotLookInApplicators.FooBoxedString](#fooboxedstring)
    boxed class to store validated String payloads | +| record | [AdditionalpropertiesDoesNotLookInApplicators.FooBoxedList](#fooboxedlist)
    boxed class to store validated List payloads | +| record | [AdditionalpropertiesDoesNotLookInApplicators.FooBoxedMap](#fooboxedmap)
    boxed class to store validated Map payloads | +| static class | [AdditionalpropertiesDoesNotLookInApplicators.Foo](#foo)
    schema class | +| sealed interface | [AdditionalpropertiesDoesNotLookInApplicators.AdditionalPropertiesBoxed](#additionalpropertiesboxed)
    sealed interface for validated payloads | +| record | [AdditionalpropertiesDoesNotLookInApplicators.AdditionalPropertiesBoxedBoolean](#additionalpropertiesboxedboolean)
    boxed class to store validated boolean payloads | +| static class | [AdditionalpropertiesDoesNotLookInApplicators.AdditionalProperties](#additionalproperties)
    schema class | + +## AdditionalpropertiesDoesNotLookInApplicators1Boxed +sealed interface AdditionalpropertiesDoesNotLookInApplicators1Boxed
    +permits
    +[AdditionalpropertiesDoesNotLookInApplicators1BoxedVoid](#additionalpropertiesdoesnotlookinapplicators1boxedvoid), +[AdditionalpropertiesDoesNotLookInApplicators1BoxedBoolean](#additionalpropertiesdoesnotlookinapplicators1boxedboolean), +[AdditionalpropertiesDoesNotLookInApplicators1BoxedNumber](#additionalpropertiesdoesnotlookinapplicators1boxednumber), +[AdditionalpropertiesDoesNotLookInApplicators1BoxedString](#additionalpropertiesdoesnotlookinapplicators1boxedstring), +[AdditionalpropertiesDoesNotLookInApplicators1BoxedList](#additionalpropertiesdoesnotlookinapplicators1boxedlist), +[AdditionalpropertiesDoesNotLookInApplicators1BoxedMap](#additionalpropertiesdoesnotlookinapplicators1boxedmap) + +sealed interface that stores validated payloads using boxed classes + +## AdditionalpropertiesDoesNotLookInApplicators1BoxedVoid +data class AdditionalpropertiesDoesNotLookInApplicators1BoxedVoid
    +implements [AdditionalpropertiesDoesNotLookInApplicators1Boxed](#additionalpropertiesdoesnotlookinapplicators1boxed) + +data class that stores validated null payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| AdditionalpropertiesDoesNotLookInApplicators1BoxedVoid(Nothing? data)
    Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| Nothing? | data()
    validated payload | +| Any? | getData()
    validated payload | + +## AdditionalpropertiesDoesNotLookInApplicators1BoxedBoolean +data class AdditionalpropertiesDoesNotLookInApplicators1BoxedBoolean
    +implements [AdditionalpropertiesDoesNotLookInApplicators1Boxed](#additionalpropertiesdoesnotlookinapplicators1boxed) + +record that stores validated boolean payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| AdditionalpropertiesDoesNotLookInApplicators1BoxedBoolean(boolean data)
    Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| boolean | data()
    validated payload | +| Any? | getData()
    validated payload | + +## AdditionalpropertiesDoesNotLookInApplicators1BoxedNumber +data class AdditionalpropertiesDoesNotLookInApplicators1BoxedNumber
    +implements [AdditionalpropertiesDoesNotLookInApplicators1Boxed](#additionalpropertiesdoesnotlookinapplicators1boxed) + +data class that stores validated Number payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| AdditionalpropertiesDoesNotLookInApplicators1BoxedNumber(Number data)
    Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| Number | data()
    validated payload | +| Any? | getData()
    validated payload | + +## AdditionalpropertiesDoesNotLookInApplicators1BoxedString +data class AdditionalpropertiesDoesNotLookInApplicators1BoxedString
    +implements [AdditionalpropertiesDoesNotLookInApplicators1Boxed](#additionalpropertiesdoesnotlookinapplicators1boxed) + +data class that stores validated String payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| AdditionalpropertiesDoesNotLookInApplicators1BoxedString(String data)
    Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| String | data()
    validated payload | +| Any? | getData()
    validated payload | + +## AdditionalpropertiesDoesNotLookInApplicators1BoxedList +data class AdditionalpropertiesDoesNotLookInApplicators1BoxedList
    +implements [AdditionalpropertiesDoesNotLookInApplicators1Boxed](#additionalpropertiesdoesnotlookinapplicators1boxed) + +data class that stores validated List payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| AdditionalpropertiesDoesNotLookInApplicators1BoxedList(FrozenList data)
    Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| FrozenList | data()
    validated payload | +| Any? | getData()
    validated payload | + +## AdditionalpropertiesDoesNotLookInApplicators1BoxedMap +data class AdditionalpropertiesDoesNotLookInApplicators1BoxedMap
    +implements [AdditionalpropertiesDoesNotLookInApplicators1Boxed](#additionalpropertiesdoesnotlookinapplicators1boxed) + +data class that stores validated Map payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| AdditionalpropertiesDoesNotLookInApplicators1BoxedMap([AdditionalpropertiesDoesNotLookInApplicatorsMap](#additionalpropertiesdoesnotlookinapplicatorsmap) data)
    Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| [AdditionalpropertiesDoesNotLookInApplicatorsMap](#additionalpropertiesdoesnotlookinapplicatorsmap) | data()
    validated payload | +| Any? | getData()
    validated payload | + +## AdditionalpropertiesDoesNotLookInApplicators1 +class AdditionalpropertiesDoesNotLookInApplicators1
    +extends JsonSchema + +A schema class that validates payloads + +### Field Summary +| Modifier and Type | Field and Description | +| ----------------- | ---------------------- | +| Class | additionalProperties = [AdditionalProperties::class.java](#additionalproperties) | +| List> | allOf = listOf(
        [Schema0::class.java](#schema0)
    ;)
    | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| String | validate(arg: String, configuration: SchemaConfiguration) | +| Nothing? | validate(arg: Nothing?, configuration: SchemaConfiguration) | +| int | validate(arg: int, configuration: SchemaConfiguration) | +| long | validate(arg: long, configuration: SchemaConfiguration) | +| float | validate(arg: float, configuration: SchemaConfiguration) | +| double | validate(arg: double, configuration: SchemaConfiguration) | +| Number | validate(arg: Number, configuration: SchemaConfiguration) | +| boolean | validate(arg: boolean, configuration: SchemaConfiguration) | +| [AdditionalpropertiesDoesNotLookInApplicatorsMap](#additionalpropertiesdoesnotlookinapplicatorsmap) | validate(arg: [Map<?, ?>](#additionalpropertiesdoesnotlookinapplicatorsmapbuilder), configuration: SchemaConfiguration) | +| FrozenList | validate(arg: List<*>, configuration: SchemaConfiguration) | +| [AdditionalpropertiesDoesNotLookInApplicators1BoxedString](#additionalpropertiesdoesnotlookinapplicators1boxedstring) | validateAndBox(String, configuration: SchemaConfiguration) | +| [AdditionalpropertiesDoesNotLookInApplicators1BoxedVoid](#additionalpropertiesdoesnotlookinapplicators1boxedvoid) | validateAndBox(Nothing?, configuration: SchemaConfiguration) | +| [AdditionalpropertiesDoesNotLookInApplicators1BoxedNumber](#additionalpropertiesdoesnotlookinapplicators1boxednumber) | validateAndBox(Number, configuration: SchemaConfiguration) | +| [AdditionalpropertiesDoesNotLookInApplicators1BoxedBoolean](#additionalpropertiesdoesnotlookinapplicators1boxedboolean) | validateAndBox(boolean, configuration: SchemaConfiguration) | +| [AdditionalpropertiesDoesNotLookInApplicators1BoxedMap](#additionalpropertiesdoesnotlookinapplicators1boxedmap) | validateAndBox([Map<?, ?>](#additionalpropertiesdoesnotlookinapplicatorsmapbuilder), configuration: SchemaConfiguration) | +| [AdditionalpropertiesDoesNotLookInApplicators1BoxedList](#additionalpropertiesdoesnotlookinapplicators1boxedlist) | validateAndBox(List<*>, configuration: SchemaConfiguration) | +| [AdditionalpropertiesDoesNotLookInApplicators1Boxed](#additionalpropertiesdoesnotlookinapplicators1boxed) | validateAndBox(Any?, configuration: SchemaConfiguration) | +| Any? | validate(arg: Any?, configuration: SchemaConfiguration) | + +## AdditionalpropertiesDoesNotLookInApplicatorsMapBuilder +class AdditionalpropertiesDoesNotLookInApplicatorsMapBuilder
    +builder for `Map` + +A class that builds the Map input type + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| AdditionalpropertiesDoesNotLookInApplicatorsMapBuilder()
    Creates a builder that contains an empty map | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| Map | build()
    Returns map input that should be used with Schema.validate | +| [AdditionalpropertiesDoesNotLookInApplicatorsMapBuilder](#additionalpropertiesdoesnotlookinapplicatorsmapbuilder) | additionalProperty(key: String, value: Boolean) | + +## AdditionalpropertiesDoesNotLookInApplicatorsMap +class AdditionalpropertiesDoesNotLookInApplicatorsMap
    +extends FrozenMap + +A class to store validated Map payloads + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| static [AdditionalpropertiesDoesNotLookInApplicatorsMap](#additionalpropertiesdoesnotlookinapplicatorsmap) | of([Map](#additionalpropertiesdoesnotlookinapplicatorsmapbuilder) arg, SchemaConfiguration configuration) | +| Boolean | getAdditionalProperty(String name)
    provides type safety for additional properties | + +## Schema0Boxed +sealed interface Schema0Boxed
    +permits
    +[Schema0BoxedVoid](#schema0boxedvoid), +[Schema0BoxedBoolean](#schema0boxedboolean), +[Schema0BoxedNumber](#schema0boxednumber), +[Schema0BoxedString](#schema0boxedstring), +[Schema0BoxedList](#schema0boxedlist), +[Schema0BoxedMap](#schema0boxedmap) + +sealed interface that stores validated payloads using boxed classes + +## Schema0BoxedVoid +data class Schema0BoxedVoid
    +implements [Schema0Boxed](#schema0boxed) + +data class that stores validated null payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| Schema0BoxedVoid(Nothing? data)
    Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| Nothing? | data()
    validated payload | +| Any? | getData()
    validated payload | + +## Schema0BoxedBoolean +data class Schema0BoxedBoolean
    +implements [Schema0Boxed](#schema0boxed) + +record that stores validated boolean payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| Schema0BoxedBoolean(boolean data)
    Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| boolean | data()
    validated payload | +| Any? | getData()
    validated payload | + +## Schema0BoxedNumber +data class Schema0BoxedNumber
    +implements [Schema0Boxed](#schema0boxed) + +data class that stores validated Number payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| Schema0BoxedNumber(Number data)
    Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| Number | data()
    validated payload | +| Any? | getData()
    validated payload | + +## Schema0BoxedString +data class Schema0BoxedString
    +implements [Schema0Boxed](#schema0boxed) + +data class that stores validated String payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| Schema0BoxedString(String data)
    Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| String | data()
    validated payload | +| Any? | getData()
    validated payload | + +## Schema0BoxedList +data class Schema0BoxedList
    +implements [Schema0Boxed](#schema0boxed) + +data class that stores validated List payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| Schema0BoxedList(FrozenList data)
    Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| FrozenList | data()
    validated payload | +| Any? | getData()
    validated payload | + +## Schema0BoxedMap +data class Schema0BoxedMap
    +implements [Schema0Boxed](#schema0boxed) + +data class that stores validated Map payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| Schema0BoxedMap([Schema0Map](#schema0map) data)
    Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| [Schema0Map](#schema0map) | data()
    validated payload | +| Any? | getData()
    validated payload | + +## Schema0 +class Schema0
    +extends JsonSchema + +A schema class that validates payloads + +### Field Summary +| Modifier and Type | Field and Description | +| ----------------- | ---------------------- | +| Map> | properties = mapOf(
        "foo" to [Foo::class.java](#foo))
    )
    | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| String | validate(arg: String, configuration: SchemaConfiguration) | +| Nothing? | validate(arg: Nothing?, configuration: SchemaConfiguration) | +| int | validate(arg: int, configuration: SchemaConfiguration) | +| long | validate(arg: long, configuration: SchemaConfiguration) | +| float | validate(arg: float, configuration: SchemaConfiguration) | +| double | validate(arg: double, configuration: SchemaConfiguration) | +| Number | validate(arg: Number, configuration: SchemaConfiguration) | +| boolean | validate(arg: boolean, configuration: SchemaConfiguration) | +| [Schema0Map](#schema0map) | validate(arg: [Map<?, ?>](#schema0mapbuilder), configuration: SchemaConfiguration) | +| FrozenList | validate(arg: List<*>, configuration: SchemaConfiguration) | +| [Schema0BoxedString](#schema0boxedstring) | validateAndBox(String, configuration: SchemaConfiguration) | +| [Schema0BoxedVoid](#schema0boxedvoid) | validateAndBox(Nothing?, configuration: SchemaConfiguration) | +| [Schema0BoxedNumber](#schema0boxednumber) | validateAndBox(Number, configuration: SchemaConfiguration) | +| [Schema0BoxedBoolean](#schema0boxedboolean) | validateAndBox(boolean, configuration: SchemaConfiguration) | +| [Schema0BoxedMap](#schema0boxedmap) | validateAndBox([Map<?, ?>](#schema0mapbuilder), configuration: SchemaConfiguration) | +| [Schema0BoxedList](#schema0boxedlist) | validateAndBox(List<*>, configuration: SchemaConfiguration) | +| [Schema0Boxed](#schema0boxed) | validateAndBox(Any?, configuration: SchemaConfiguration) | +| Any? | validate(arg: Any?, configuration: SchemaConfiguration) | + +## Schema0MapBuilder +class Schema0MapBuilder
    +builder for `Map` + +A class that builds the Map input type + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| Schema0MapBuilder()
    Creates a builder that contains an empty map | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| Map | build()
    Returns map input that should be used with Schema.validate | +| [Schema0MapBuilder](#schema0mapbuilder) | foo(value: Nothing?) | +| [Schema0MapBuilder](#schema0mapbuilder) | foo(value: Boolean) | +| [Schema0MapBuilder](#schema0mapbuilder) | foo(value: String) | +| [Schema0MapBuilder](#schema0mapbuilder) | foo(value: Int) | +| [Schema0MapBuilder](#schema0mapbuilder) | foo(value: Float) | +| [Schema0MapBuilder](#schema0mapbuilder) | foo(value: Long) | +| [Schema0MapBuilder](#schema0mapbuilder) | foo(value: Double) | +| [Schema0MapBuilder](#schema0mapbuilder) | foo(value: List) | +| [Schema0MapBuilder](#schema0mapbuilder) | foo(value: Map) | +| [Schema0MapBuilder](#schema0mapbuilder) | additionalProperty(key: String, value: Nothing?) | +| [Schema0MapBuilder](#schema0mapbuilder) | additionalProperty(key: String, value: Boolean) | +| [Schema0MapBuilder](#schema0mapbuilder) | additionalProperty(key: String, value: String) | +| [Schema0MapBuilder](#schema0mapbuilder) | additionalProperty(key: String, value: Int) | +| [Schema0MapBuilder](#schema0mapbuilder) | additionalProperty(key: String, value: Float) | +| [Schema0MapBuilder](#schema0mapbuilder) | additionalProperty(key: String, value: Long) | +| [Schema0MapBuilder](#schema0mapbuilder) | additionalProperty(key: String, value: Double) | +| [Schema0MapBuilder](#schema0mapbuilder) | additionalProperty(key: String, value: List) | +| [Schema0MapBuilder](#schema0mapbuilder) | additionalProperty(key: String, value: Map) | + +## Schema0Map +class Schema0Map
    +extends FrozenMap + +A class to store validated Map payloads + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| static [Schema0Map](#schema0map) | of([Map](#schema0mapbuilder) arg, SchemaConfiguration configuration) | +| Any? | foo()
    [optional] | +| Any? | getAdditionalProperty(String name)
    provides type safety for additional properties | + +## FooBoxed +sealed interface FooBoxed
    +permits
    +[FooBoxedVoid](#fooboxedvoid), +[FooBoxedBoolean](#fooboxedboolean), +[FooBoxedNumber](#fooboxednumber), +[FooBoxedString](#fooboxedstring), +[FooBoxedList](#fooboxedlist), +[FooBoxedMap](#fooboxedmap) + +sealed interface that stores validated payloads using boxed classes + +## FooBoxedVoid +data class FooBoxedVoid
    +implements [FooBoxed](#fooboxed) + +data class that stores validated null payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| FooBoxedVoid(Nothing? data)
    Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| Nothing? | data()
    validated payload | +| Any? | getData()
    validated payload | + +## FooBoxedBoolean +data class FooBoxedBoolean
    +implements [FooBoxed](#fooboxed) + +record that stores validated boolean payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| FooBoxedBoolean(boolean data)
    Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| boolean | data()
    validated payload | +| Any? | getData()
    validated payload | + +## FooBoxedNumber +data class FooBoxedNumber
    +implements [FooBoxed](#fooboxed) + +data class that stores validated Number payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| FooBoxedNumber(Number data)
    Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| Number | data()
    validated payload | +| Any? | getData()
    validated payload | + +## FooBoxedString +data class FooBoxedString
    +implements [FooBoxed](#fooboxed) + +data class that stores validated String payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| FooBoxedString(String data)
    Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| String | data()
    validated payload | +| Any? | getData()
    validated payload | + +## FooBoxedList +data class FooBoxedList
    +implements [FooBoxed](#fooboxed) + +data class that stores validated List payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| FooBoxedList(FrozenList data)
    Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| FrozenList | data()
    validated payload | +| Any? | getData()
    validated payload | + +## FooBoxedMap +data class FooBoxedMap
    +implements [FooBoxed](#fooboxed) + +data class that stores validated Map payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| FooBoxedMap(FrozenMap data)
    Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| FrozenMap | data()
    validated payload | +| Any? | getData()
    validated payload | + +## Foo +class Foo
    +extends AnyTypeJsonSchema.AnyTypeJsonSchema1 + +A schema class that validates payloads + +| Methods Inherited from class org.openapijsonschematools.client.schemas.AnyTypeJsonSchema.AnyTypeJsonSchema1 | +| ------------------------------------------------------------------ | +| validate | +| validateAndBox | + +## AdditionalPropertiesBoxed +sealed interface AdditionalPropertiesBoxed
    +permits
    +[AdditionalPropertiesBoxedBoolean](#additionalpropertiesboxedboolean) + +sealed interface that stores validated payloads using boxed classes + +## AdditionalPropertiesBoxedBoolean +data class AdditionalPropertiesBoxedBoolean
    +implements [AdditionalPropertiesBoxed](#additionalpropertiesboxed) + +record that stores validated boolean payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| AdditionalPropertiesBoxedBoolean(boolean data)
    Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| boolean | data()
    validated payload | +| Any? | getData()
    validated payload | + +## AdditionalProperties +class AdditionalProperties
    +extends BooleanJsonSchema.BooleanJsonSchema1 + +A schema class that validates payloads + +| Methods Inherited from class org.openapijsonschematools.client.schemas.BooleanJsonSchema.BooleanJsonSchema1 | +| ------------------------------------------------------------------ | +| validate | +| validateAndBox | + +[[Back to top]](#top) [[Back to Component Schemas]](../../../README.md#Component-Schemas) [[Back to README]](../../../README.md) diff --git a/samples/client/3_1_0_unit_test/kotlin/docs/components/schemas/AdditionalpropertiesWithNullValuedInstanceProperties.md b/samples/client/3_1_0_unit_test/kotlin/docs/components/schemas/AdditionalpropertiesWithNullValuedInstanceProperties.md new file mode 100644 index 00000000000..a8be775050b --- /dev/null +++ b/samples/client/3_1_0_unit_test/kotlin/docs/components/schemas/AdditionalpropertiesWithNullValuedInstanceProperties.md @@ -0,0 +1,159 @@ +# AdditionalpropertiesWithNullValuedInstanceProperties +org.openapijsonschematools.client.components.schemas.AdditionalpropertiesWithNullValuedInstanceProperties.java +class AdditionalpropertiesWithNullValuedInstanceProperties
    + +A class that contains necessary nested +- schema classes (which validate payloads), extends JsonSchema +- sealed interfaces which store validated payloads, Kotlin version of a sum type +- boxed classes which store validated payloads, sealed permits class implementations +- classes to store validated map payloads, extends FrozenMap +- classes to build inputs for map payloads + +## Nested Class Summary +| Modifier and Type | Class and Description | +| ----------------- | ---------------------- | +| sealed interface | [AdditionalpropertiesWithNullValuedInstanceProperties.AdditionalpropertiesWithNullValuedInstanceProperties1Boxed](#additionalpropertieswithnullvaluedinstanceproperties1boxed)
    sealed interface for validated payloads | +| record | [AdditionalpropertiesWithNullValuedInstanceProperties.AdditionalpropertiesWithNullValuedInstanceProperties1BoxedMap](#additionalpropertieswithnullvaluedinstanceproperties1boxedmap)
    boxed class to store validated Map payloads | +| static class | [AdditionalpropertiesWithNullValuedInstanceProperties.AdditionalpropertiesWithNullValuedInstanceProperties1](#additionalpropertieswithnullvaluedinstanceproperties1)
    schema class | +| static class | [AdditionalpropertiesWithNullValuedInstanceProperties.AdditionalpropertiesWithNullValuedInstancePropertiesMapBuilder](#additionalpropertieswithnullvaluedinstancepropertiesmapbuilder)
    builder for Map payloads | +| static class | [AdditionalpropertiesWithNullValuedInstanceProperties.AdditionalpropertiesWithNullValuedInstancePropertiesMap](#additionalpropertieswithnullvaluedinstancepropertiesmap)
    output class for Map payloads | +| sealed interface | [AdditionalpropertiesWithNullValuedInstanceProperties.AdditionalPropertiesBoxed](#additionalpropertiesboxed)
    sealed interface for validated payloads | +| record | [AdditionalpropertiesWithNullValuedInstanceProperties.AdditionalPropertiesBoxedVoid](#additionalpropertiesboxedvoid)
    boxed class to store validated null payloads | +| static class | [AdditionalpropertiesWithNullValuedInstanceProperties.AdditionalProperties](#additionalproperties)
    schema class | + +## AdditionalpropertiesWithNullValuedInstanceProperties1Boxed +sealed interface AdditionalpropertiesWithNullValuedInstanceProperties1Boxed
    +permits
    +[AdditionalpropertiesWithNullValuedInstanceProperties1BoxedMap](#additionalpropertieswithnullvaluedinstanceproperties1boxedmap) + +sealed interface that stores validated payloads using boxed classes + +## AdditionalpropertiesWithNullValuedInstanceProperties1BoxedMap +data class AdditionalpropertiesWithNullValuedInstanceProperties1BoxedMap
    +implements [AdditionalpropertiesWithNullValuedInstanceProperties1Boxed](#additionalpropertieswithnullvaluedinstanceproperties1boxed) + +data class that stores validated Map payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| AdditionalpropertiesWithNullValuedInstanceProperties1BoxedMap([AdditionalpropertiesWithNullValuedInstancePropertiesMap](#additionalpropertieswithnullvaluedinstancepropertiesmap) data)
    Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| [AdditionalpropertiesWithNullValuedInstancePropertiesMap](#additionalpropertieswithnullvaluedinstancepropertiesmap) | data()
    validated payload | +| Any? | getData()
    validated payload | + +## AdditionalpropertiesWithNullValuedInstanceProperties1 +class AdditionalpropertiesWithNullValuedInstanceProperties1
    +extends JsonSchema + +A schema class that validates payloads + +### Code Sample +``` +import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags; +import org.openapijsonschematools.client.configurations.SchemaConfiguration; +import org.openapijsonschematools.client.exceptions.ValidationException; +import org.openapijsonschematools.client.schemas.validation.MapUtils; +import org.openapijsonschematools.client.schemas.validation.FrozenList; +import org.openapijsonschematools.client.schemas.validation.FrozenMap; +import org.openapijsonschematools.client.components.schemas.AdditionalpropertiesWithNullValuedInstanceProperties; + +import java.util.Arrays; +import java.util.List; +import java.util.AbstractMap; + +static final SchemaConfiguration configuration = new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().build()); + +// Map validation +AdditionalpropertiesWithNullValuedInstanceProperties.AdditionalpropertiesWithNullValuedInstancePropertiesMap validatedPayload = + AdditionalpropertiesWithNullValuedInstanceProperties.AdditionalpropertiesWithNullValuedInstanceProperties1.validate( + new AdditionalpropertiesWithNullValuedInstanceProperties.AdditionalpropertiesWithNullValuedInstancePropertiesMapBuilder() + .additionalProperty("someAdditionalProperty", null) + + .build(), + configuration +); +``` + +### Field Summary +| Modifier and Type | Field and Description | +| ----------------- | ---------------------- | +| Set> | type = setOf(Map::class.java) | +| Class | additionalProperties = [AdditionalProperties::class.java](#additionalproperties) | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| [AdditionalpropertiesWithNullValuedInstancePropertiesMap](#additionalpropertieswithnullvaluedinstancepropertiesmap) | validate(arg: [Map<?, ?>](#additionalpropertieswithnullvaluedinstancepropertiesmapbuilder), configuration: SchemaConfiguration) | +| [AdditionalpropertiesWithNullValuedInstanceProperties1BoxedMap](#additionalpropertieswithnullvaluedinstanceproperties1boxedmap) | validateAndBox([Map<?, ?>](#additionalpropertieswithnullvaluedinstancepropertiesmapbuilder), configuration: SchemaConfiguration) | +| [AdditionalpropertiesWithNullValuedInstanceProperties1Boxed](#additionalpropertieswithnullvaluedinstanceproperties1boxed) | validateAndBox(Any?, configuration: SchemaConfiguration) | +| Any? | validate(arg: Any?, configuration: SchemaConfiguration) | + +## AdditionalpropertiesWithNullValuedInstancePropertiesMapBuilder +class AdditionalpropertiesWithNullValuedInstancePropertiesMapBuilder
    +builder for `Map` + +A class that builds the Map input type + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| AdditionalpropertiesWithNullValuedInstancePropertiesMapBuilder()
    Creates a builder that contains an empty map | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| Map | build()
    Returns map input that should be used with Schema.validate | +| [AdditionalpropertiesWithNullValuedInstancePropertiesMapBuilder](#additionalpropertieswithnullvaluedinstancepropertiesmapbuilder) | additionalProperty(key: String, value: Nothing?) | + +## AdditionalpropertiesWithNullValuedInstancePropertiesMap +class AdditionalpropertiesWithNullValuedInstancePropertiesMap
    +extends FrozenMap + +A class to store validated Map payloads + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| static [AdditionalpropertiesWithNullValuedInstancePropertiesMap](#additionalpropertieswithnullvaluedinstancepropertiesmap) | of([Map](#additionalpropertieswithnullvaluedinstancepropertiesmapbuilder) arg, SchemaConfiguration configuration) | +| Nothing? | getAdditionalProperty(String name)
    provides type safety for additional properties | + +## AdditionalPropertiesBoxed +sealed interface AdditionalPropertiesBoxed
    +permits
    +[AdditionalPropertiesBoxedVoid](#additionalpropertiesboxedvoid) + +sealed interface that stores validated payloads using boxed classes + +## AdditionalPropertiesBoxedVoid +data class AdditionalPropertiesBoxedVoid
    +implements [AdditionalPropertiesBoxed](#additionalpropertiesboxed) + +data class that stores validated null payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| AdditionalPropertiesBoxedVoid(Nothing? data)
    Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| Nothing? | data()
    validated payload | +| Any? | getData()
    validated payload | + +## AdditionalProperties +class AdditionalProperties
    +extends NullJsonSchema.NullJsonSchema1 + +A schema class that validates payloads + +| Methods Inherited from class org.openapijsonschematools.client.schemas.NullJsonSchema.NullJsonSchema1 | +| ------------------------------------------------------------------ | +| validate | +| validateAndBox | + +[[Back to top]](#top) [[Back to Component Schemas]](../../../README.md#Component-Schemas) [[Back to README]](../../../README.md) diff --git a/samples/client/3_1_0_unit_test/kotlin/docs/components/schemas/AdditionalpropertiesWithSchema.md b/samples/client/3_1_0_unit_test/kotlin/docs/components/schemas/AdditionalpropertiesWithSchema.md new file mode 100644 index 00000000000..9b96b2f032d --- /dev/null +++ b/samples/client/3_1_0_unit_test/kotlin/docs/components/schemas/AdditionalpropertiesWithSchema.md @@ -0,0 +1,446 @@ +# AdditionalpropertiesWithSchema +org.openapijsonschematools.client.components.schemas.AdditionalpropertiesWithSchema.java +class AdditionalpropertiesWithSchema
    + +A class that contains necessary nested +- schema classes (which validate payloads), extends JsonSchema +- sealed interfaces which store validated payloads, Kotlin version of a sum type +- boxed classes which store validated payloads, sealed permits class implementations +- classes to store validated map payloads, extends FrozenMap +- classes to build inputs for map payloads + +## Nested Class Summary +| Modifier and Type | Class and Description | +| ----------------- | ---------------------- | +| sealed interface | [AdditionalpropertiesWithSchema.AdditionalpropertiesWithSchema1Boxed](#additionalpropertieswithschema1boxed)
    sealed interface for validated payloads | +| record | [AdditionalpropertiesWithSchema.AdditionalpropertiesWithSchema1BoxedMap](#additionalpropertieswithschema1boxedmap)
    boxed class to store validated Map payloads | +| static class | [AdditionalpropertiesWithSchema.AdditionalpropertiesWithSchema1](#additionalpropertieswithschema1)
    schema class | +| static class | [AdditionalpropertiesWithSchema.AdditionalpropertiesWithSchemaMapBuilder](#additionalpropertieswithschemamapbuilder)
    builder for Map payloads | +| static class | [AdditionalpropertiesWithSchema.AdditionalpropertiesWithSchemaMap](#additionalpropertieswithschemamap)
    output class for Map payloads | +| sealed interface | [AdditionalpropertiesWithSchema.BarBoxed](#barboxed)
    sealed interface for validated payloads | +| record | [AdditionalpropertiesWithSchema.BarBoxedVoid](#barboxedvoid)
    boxed class to store validated null payloads | +| record | [AdditionalpropertiesWithSchema.BarBoxedBoolean](#barboxedboolean)
    boxed class to store validated boolean payloads | +| record | [AdditionalpropertiesWithSchema.BarBoxedNumber](#barboxednumber)
    boxed class to store validated Number payloads | +| record | [AdditionalpropertiesWithSchema.BarBoxedString](#barboxedstring)
    boxed class to store validated String payloads | +| record | [AdditionalpropertiesWithSchema.BarBoxedList](#barboxedlist)
    boxed class to store validated List payloads | +| record | [AdditionalpropertiesWithSchema.BarBoxedMap](#barboxedmap)
    boxed class to store validated Map payloads | +| static class | [AdditionalpropertiesWithSchema.Bar](#bar)
    schema class | +| sealed interface | [AdditionalpropertiesWithSchema.FooBoxed](#fooboxed)
    sealed interface for validated payloads | +| record | [AdditionalpropertiesWithSchema.FooBoxedVoid](#fooboxedvoid)
    boxed class to store validated null payloads | +| record | [AdditionalpropertiesWithSchema.FooBoxedBoolean](#fooboxedboolean)
    boxed class to store validated boolean payloads | +| record | [AdditionalpropertiesWithSchema.FooBoxedNumber](#fooboxednumber)
    boxed class to store validated Number payloads | +| record | [AdditionalpropertiesWithSchema.FooBoxedString](#fooboxedstring)
    boxed class to store validated String payloads | +| record | [AdditionalpropertiesWithSchema.FooBoxedList](#fooboxedlist)
    boxed class to store validated List payloads | +| record | [AdditionalpropertiesWithSchema.FooBoxedMap](#fooboxedmap)
    boxed class to store validated Map payloads | +| static class | [AdditionalpropertiesWithSchema.Foo](#foo)
    schema class | +| sealed interface | [AdditionalpropertiesWithSchema.AdditionalPropertiesBoxed](#additionalpropertiesboxed)
    sealed interface for validated payloads | +| record | [AdditionalpropertiesWithSchema.AdditionalPropertiesBoxedBoolean](#additionalpropertiesboxedboolean)
    boxed class to store validated boolean payloads | +| static class | [AdditionalpropertiesWithSchema.AdditionalProperties](#additionalproperties)
    schema class | + +## AdditionalpropertiesWithSchema1Boxed +sealed interface AdditionalpropertiesWithSchema1Boxed
    +permits
    +[AdditionalpropertiesWithSchema1BoxedMap](#additionalpropertieswithschema1boxedmap) + +sealed interface that stores validated payloads using boxed classes + +## AdditionalpropertiesWithSchema1BoxedMap +data class AdditionalpropertiesWithSchema1BoxedMap
    +implements [AdditionalpropertiesWithSchema1Boxed](#additionalpropertieswithschema1boxed) + +data class that stores validated Map payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| AdditionalpropertiesWithSchema1BoxedMap([AdditionalpropertiesWithSchemaMap](#additionalpropertieswithschemamap) data)
    Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| [AdditionalpropertiesWithSchemaMap](#additionalpropertieswithschemamap) | data()
    validated payload | +| Any? | getData()
    validated payload | + +## AdditionalpropertiesWithSchema1 +class AdditionalpropertiesWithSchema1
    +extends JsonSchema + +A schema class that validates payloads + +### Code Sample +``` +import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags; +import org.openapijsonschematools.client.configurations.SchemaConfiguration; +import org.openapijsonschematools.client.exceptions.ValidationException; +import org.openapijsonschematools.client.schemas.validation.MapUtils; +import org.openapijsonschematools.client.schemas.validation.FrozenList; +import org.openapijsonschematools.client.schemas.validation.FrozenMap; +import org.openapijsonschematools.client.components.schemas.AdditionalpropertiesWithSchema; + +import java.util.Arrays; +import java.util.List; +import java.util.AbstractMap; + +static final SchemaConfiguration configuration = new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().build()); + +// Map validation +AdditionalpropertiesWithSchema.AdditionalpropertiesWithSchemaMap validatedPayload = + AdditionalpropertiesWithSchema.AdditionalpropertiesWithSchema1.validate( + new AdditionalpropertiesWithSchema.AdditionalpropertiesWithSchemaMapBuilder() + .additionalProperty("someAdditionalProperty", true) + + .build(), + configuration +); +``` + +### Field Summary +| Modifier and Type | Field and Description | +| ----------------- | ---------------------- | +| Set> | type = setOf(Map::class.java) | +| Map> | properties = mapOf(
        "foo" to [Foo::class.java](#foo)),
        "bar" to [Bar::class.java](#bar))
    )
    | +| Class | additionalProperties = [AdditionalProperties::class.java](#additionalproperties) | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| [AdditionalpropertiesWithSchemaMap](#additionalpropertieswithschemamap) | validate(arg: [Map<?, ?>](#additionalpropertieswithschemamapbuilder), configuration: SchemaConfiguration) | +| [AdditionalpropertiesWithSchema1BoxedMap](#additionalpropertieswithschema1boxedmap) | validateAndBox([Map<?, ?>](#additionalpropertieswithschemamapbuilder), configuration: SchemaConfiguration) | +| [AdditionalpropertiesWithSchema1Boxed](#additionalpropertieswithschema1boxed) | validateAndBox(Any?, configuration: SchemaConfiguration) | +| Any? | validate(arg: Any?, configuration: SchemaConfiguration) | + +## AdditionalpropertiesWithSchemaMapBuilder +class AdditionalpropertiesWithSchemaMapBuilder
    +builder for `Map` + +A class that builds the Map input type + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| AdditionalpropertiesWithSchemaMapBuilder()
    Creates a builder that contains an empty map | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| Map | build()
    Returns map input that should be used with Schema.validate | +| [AdditionalpropertiesWithSchemaMapBuilder](#additionalpropertieswithschemamapbuilder) | foo(value: Nothing?) | +| [AdditionalpropertiesWithSchemaMapBuilder](#additionalpropertieswithschemamapbuilder) | foo(value: Boolean) | +| [AdditionalpropertiesWithSchemaMapBuilder](#additionalpropertieswithschemamapbuilder) | foo(value: String) | +| [AdditionalpropertiesWithSchemaMapBuilder](#additionalpropertieswithschemamapbuilder) | foo(value: Int) | +| [AdditionalpropertiesWithSchemaMapBuilder](#additionalpropertieswithschemamapbuilder) | foo(value: Float) | +| [AdditionalpropertiesWithSchemaMapBuilder](#additionalpropertieswithschemamapbuilder) | foo(value: Long) | +| [AdditionalpropertiesWithSchemaMapBuilder](#additionalpropertieswithschemamapbuilder) | foo(value: Double) | +| [AdditionalpropertiesWithSchemaMapBuilder](#additionalpropertieswithschemamapbuilder) | foo(value: List) | +| [AdditionalpropertiesWithSchemaMapBuilder](#additionalpropertieswithschemamapbuilder) | foo(value: Map) | +| [AdditionalpropertiesWithSchemaMapBuilder](#additionalpropertieswithschemamapbuilder) | bar(value: Nothing?) | +| [AdditionalpropertiesWithSchemaMapBuilder](#additionalpropertieswithschemamapbuilder) | bar(value: Boolean) | +| [AdditionalpropertiesWithSchemaMapBuilder](#additionalpropertieswithschemamapbuilder) | bar(value: String) | +| [AdditionalpropertiesWithSchemaMapBuilder](#additionalpropertieswithschemamapbuilder) | bar(value: Int) | +| [AdditionalpropertiesWithSchemaMapBuilder](#additionalpropertieswithschemamapbuilder) | bar(value: Float) | +| [AdditionalpropertiesWithSchemaMapBuilder](#additionalpropertieswithschemamapbuilder) | bar(value: Long) | +| [AdditionalpropertiesWithSchemaMapBuilder](#additionalpropertieswithschemamapbuilder) | bar(value: Double) | +| [AdditionalpropertiesWithSchemaMapBuilder](#additionalpropertieswithschemamapbuilder) | bar(value: List) | +| [AdditionalpropertiesWithSchemaMapBuilder](#additionalpropertieswithschemamapbuilder) | bar(value: Map) | +| [AdditionalpropertiesWithSchemaMapBuilder](#additionalpropertieswithschemamapbuilder) | additionalProperty(key: String, value: Boolean) | + +## AdditionalpropertiesWithSchemaMap +class AdditionalpropertiesWithSchemaMap
    +extends FrozenMap + +A class to store validated Map payloads + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| static [AdditionalpropertiesWithSchemaMap](#additionalpropertieswithschemamap) | of([Map](#additionalpropertieswithschemamapbuilder) arg, SchemaConfiguration configuration) | +| Any? | foo()
    [optional] | +| Any? | bar()
    [optional] | +| Boolean | getAdditionalProperty(String name)
    provides type safety for additional properties | + +## BarBoxed +sealed interface BarBoxed
    +permits
    +[BarBoxedVoid](#barboxedvoid), +[BarBoxedBoolean](#barboxedboolean), +[BarBoxedNumber](#barboxednumber), +[BarBoxedString](#barboxedstring), +[BarBoxedList](#barboxedlist), +[BarBoxedMap](#barboxedmap) + +sealed interface that stores validated payloads using boxed classes + +## BarBoxedVoid +data class BarBoxedVoid
    +implements [BarBoxed](#barboxed) + +data class that stores validated null payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| BarBoxedVoid(Nothing? data)
    Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| Nothing? | data()
    validated payload | +| Any? | getData()
    validated payload | + +## BarBoxedBoolean +data class BarBoxedBoolean
    +implements [BarBoxed](#barboxed) + +record that stores validated boolean payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| BarBoxedBoolean(boolean data)
    Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| boolean | data()
    validated payload | +| Any? | getData()
    validated payload | + +## BarBoxedNumber +data class BarBoxedNumber
    +implements [BarBoxed](#barboxed) + +data class that stores validated Number payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| BarBoxedNumber(Number data)
    Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| Number | data()
    validated payload | +| Any? | getData()
    validated payload | + +## BarBoxedString +data class BarBoxedString
    +implements [BarBoxed](#barboxed) + +data class that stores validated String payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| BarBoxedString(String data)
    Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| String | data()
    validated payload | +| Any? | getData()
    validated payload | + +## BarBoxedList +data class BarBoxedList
    +implements [BarBoxed](#barboxed) + +data class that stores validated List payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| BarBoxedList(FrozenList data)
    Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| FrozenList | data()
    validated payload | +| Any? | getData()
    validated payload | + +## BarBoxedMap +data class BarBoxedMap
    +implements [BarBoxed](#barboxed) + +data class that stores validated Map payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| BarBoxedMap(FrozenMap data)
    Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| FrozenMap | data()
    validated payload | +| Any? | getData()
    validated payload | + +## Bar +class Bar
    +extends AnyTypeJsonSchema.AnyTypeJsonSchema1 + +A schema class that validates payloads + +| Methods Inherited from class org.openapijsonschematools.client.schemas.AnyTypeJsonSchema.AnyTypeJsonSchema1 | +| ------------------------------------------------------------------ | +| validate | +| validateAndBox | + +## FooBoxed +sealed interface FooBoxed
    +permits
    +[FooBoxedVoid](#fooboxedvoid), +[FooBoxedBoolean](#fooboxedboolean), +[FooBoxedNumber](#fooboxednumber), +[FooBoxedString](#fooboxedstring), +[FooBoxedList](#fooboxedlist), +[FooBoxedMap](#fooboxedmap) + +sealed interface that stores validated payloads using boxed classes + +## FooBoxedVoid +data class FooBoxedVoid
    +implements [FooBoxed](#fooboxed) + +data class that stores validated null payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| FooBoxedVoid(Nothing? data)
    Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| Nothing? | data()
    validated payload | +| Any? | getData()
    validated payload | + +## FooBoxedBoolean +data class FooBoxedBoolean
    +implements [FooBoxed](#fooboxed) + +record that stores validated boolean payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| FooBoxedBoolean(boolean data)
    Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| boolean | data()
    validated payload | +| Any? | getData()
    validated payload | + +## FooBoxedNumber +data class FooBoxedNumber
    +implements [FooBoxed](#fooboxed) + +data class that stores validated Number payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| FooBoxedNumber(Number data)
    Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| Number | data()
    validated payload | +| Any? | getData()
    validated payload | + +## FooBoxedString +data class FooBoxedString
    +implements [FooBoxed](#fooboxed) + +data class that stores validated String payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| FooBoxedString(String data)
    Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| String | data()
    validated payload | +| Any? | getData()
    validated payload | + +## FooBoxedList +data class FooBoxedList
    +implements [FooBoxed](#fooboxed) + +data class that stores validated List payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| FooBoxedList(FrozenList data)
    Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| FrozenList | data()
    validated payload | +| Any? | getData()
    validated payload | + +## FooBoxedMap +data class FooBoxedMap
    +implements [FooBoxed](#fooboxed) + +data class that stores validated Map payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| FooBoxedMap(FrozenMap data)
    Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| FrozenMap | data()
    validated payload | +| Any? | getData()
    validated payload | + +## Foo +class Foo
    +extends AnyTypeJsonSchema.AnyTypeJsonSchema1 + +A schema class that validates payloads + +| Methods Inherited from class org.openapijsonschematools.client.schemas.AnyTypeJsonSchema.AnyTypeJsonSchema1 | +| ------------------------------------------------------------------ | +| validate | +| validateAndBox | + +## AdditionalPropertiesBoxed +sealed interface AdditionalPropertiesBoxed
    +permits
    +[AdditionalPropertiesBoxedBoolean](#additionalpropertiesboxedboolean) + +sealed interface that stores validated payloads using boxed classes + +## AdditionalPropertiesBoxedBoolean +data class AdditionalPropertiesBoxedBoolean
    +implements [AdditionalPropertiesBoxed](#additionalpropertiesboxed) + +record that stores validated boolean payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| AdditionalPropertiesBoxedBoolean(boolean data)
    Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| boolean | data()
    validated payload | +| Any? | getData()
    validated payload | + +## AdditionalProperties +class AdditionalProperties
    +extends BooleanJsonSchema.BooleanJsonSchema1 + +A schema class that validates payloads + +| Methods Inherited from class org.openapijsonschematools.client.schemas.BooleanJsonSchema.BooleanJsonSchema1 | +| ------------------------------------------------------------------ | +| validate | +| validateAndBox | + +[[Back to top]](#top) [[Back to Component Schemas]](../../../README.md#Component-Schemas) [[Back to README]](../../../README.md) diff --git a/samples/client/3_1_0_unit_test/kotlin/docs/components/schemas/Allof.md b/samples/client/3_1_0_unit_test/kotlin/docs/components/schemas/Allof.md new file mode 100644 index 00000000000..5a211961ac4 --- /dev/null +++ b/samples/client/3_1_0_unit_test/kotlin/docs/components/schemas/Allof.md @@ -0,0 +1,674 @@ +# Allof +org.openapijsonschematools.client.components.schemas.Allof.java +class Allof
    + +A class that contains necessary nested +- schema classes (which validate payloads), extends JsonSchema +- sealed interfaces which store validated payloads, Kotlin version of a sum type +- boxed classes which store validated payloads, sealed permits class implementations +- classes to store validated map payloads, extends FrozenMap +- classes to build inputs for map payloads + +## Nested Class Summary +| Modifier and Type | Class and Description | +| ----------------- | ---------------------- | +| sealed interface | [Allof.Allof1Boxed](#allof1boxed)
    sealed interface for validated payloads | +| record | [Allof.Allof1BoxedVoid](#allof1boxedvoid)
    boxed class to store validated null payloads | +| record | [Allof.Allof1BoxedBoolean](#allof1boxedboolean)
    boxed class to store validated boolean payloads | +| record | [Allof.Allof1BoxedNumber](#allof1boxednumber)
    boxed class to store validated Number payloads | +| record | [Allof.Allof1BoxedString](#allof1boxedstring)
    boxed class to store validated String payloads | +| record | [Allof.Allof1BoxedList](#allof1boxedlist)
    boxed class to store validated List payloads | +| record | [Allof.Allof1BoxedMap](#allof1boxedmap)
    boxed class to store validated Map payloads | +| static class | [Allof.Allof1](#allof1)
    schema class | +| sealed interface | [Allof.Schema1Boxed](#schema1boxed)
    sealed interface for validated payloads | +| record | [Allof.Schema1BoxedVoid](#schema1boxedvoid)
    boxed class to store validated null payloads | +| record | [Allof.Schema1BoxedBoolean](#schema1boxedboolean)
    boxed class to store validated boolean payloads | +| record | [Allof.Schema1BoxedNumber](#schema1boxednumber)
    boxed class to store validated Number payloads | +| record | [Allof.Schema1BoxedString](#schema1boxedstring)
    boxed class to store validated String payloads | +| record | [Allof.Schema1BoxedList](#schema1boxedlist)
    boxed class to store validated List payloads | +| record | [Allof.Schema1BoxedMap](#schema1boxedmap)
    boxed class to store validated Map payloads | +| static class | [Allof.Schema1](#schema1)
    schema class | +| static class | [Allof.Schema1MapBuilder](#schema1mapbuilder)
    builder for Map payloads | +| static class | [Allof.Schema1Map](#schema1map)
    output class for Map payloads | +| sealed interface | [Allof.FooBoxed](#fooboxed)
    sealed interface for validated payloads | +| record | [Allof.FooBoxedString](#fooboxedstring)
    boxed class to store validated String payloads | +| static class | [Allof.Foo](#foo)
    schema class | +| sealed interface | [Allof.Schema0Boxed](#schema0boxed)
    sealed interface for validated payloads | +| record | [Allof.Schema0BoxedVoid](#schema0boxedvoid)
    boxed class to store validated null payloads | +| record | [Allof.Schema0BoxedBoolean](#schema0boxedboolean)
    boxed class to store validated boolean payloads | +| record | [Allof.Schema0BoxedNumber](#schema0boxednumber)
    boxed class to store validated Number payloads | +| record | [Allof.Schema0BoxedString](#schema0boxedstring)
    boxed class to store validated String payloads | +| record | [Allof.Schema0BoxedList](#schema0boxedlist)
    boxed class to store validated List payloads | +| record | [Allof.Schema0BoxedMap](#schema0boxedmap)
    boxed class to store validated Map payloads | +| static class | [Allof.Schema0](#schema0)
    schema class | +| static class | [Allof.Schema0MapBuilder](#schema0mapbuilder)
    builder for Map payloads | +| static class | [Allof.Schema0Map](#schema0map)
    output class for Map payloads | +| sealed interface | [Allof.BarBoxed](#barboxed)
    sealed interface for validated payloads | +| record | [Allof.BarBoxedNumber](#barboxednumber)
    boxed class to store validated Number payloads | +| static class | [Allof.Bar](#bar)
    schema class | + +## Allof1Boxed +sealed interface Allof1Boxed
    +permits
    +[Allof1BoxedVoid](#allof1boxedvoid), +[Allof1BoxedBoolean](#allof1boxedboolean), +[Allof1BoxedNumber](#allof1boxednumber), +[Allof1BoxedString](#allof1boxedstring), +[Allof1BoxedList](#allof1boxedlist), +[Allof1BoxedMap](#allof1boxedmap) + +sealed interface that stores validated payloads using boxed classes + +## Allof1BoxedVoid +data class Allof1BoxedVoid
    +implements [Allof1Boxed](#allof1boxed) + +data class that stores validated null payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| Allof1BoxedVoid(Nothing? data)
    Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| Nothing? | data()
    validated payload | +| Any? | getData()
    validated payload | + +## Allof1BoxedBoolean +data class Allof1BoxedBoolean
    +implements [Allof1Boxed](#allof1boxed) + +record that stores validated boolean payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| Allof1BoxedBoolean(boolean data)
    Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| boolean | data()
    validated payload | +| Any? | getData()
    validated payload | + +## Allof1BoxedNumber +data class Allof1BoxedNumber
    +implements [Allof1Boxed](#allof1boxed) + +data class that stores validated Number payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| Allof1BoxedNumber(Number data)
    Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| Number | data()
    validated payload | +| Any? | getData()
    validated payload | + +## Allof1BoxedString +data class Allof1BoxedString
    +implements [Allof1Boxed](#allof1boxed) + +data class that stores validated String payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| Allof1BoxedString(String data)
    Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| String | data()
    validated payload | +| Any? | getData()
    validated payload | + +## Allof1BoxedList +data class Allof1BoxedList
    +implements [Allof1Boxed](#allof1boxed) + +data class that stores validated List payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| Allof1BoxedList(FrozenList data)
    Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| FrozenList | data()
    validated payload | +| Any? | getData()
    validated payload | + +## Allof1BoxedMap +data class Allof1BoxedMap
    +implements [Allof1Boxed](#allof1boxed) + +data class that stores validated Map payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| Allof1BoxedMap(FrozenMap data)
    Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| FrozenMap | data()
    validated payload | +| Any? | getData()
    validated payload | + +## Allof1 +class Allof1
    +extends JsonSchema + +A schema class that validates payloads + +### Field Summary +| Modifier and Type | Field and Description | +| ----------------- | ---------------------- | +| List> | allOf = listOf(
        [Schema0::class.java](#schema0),
        [Schema1::class.java](#schema1)
    ;)
    | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| String | validate(arg: String, configuration: SchemaConfiguration) | +| Nothing? | validate(arg: Nothing?, configuration: SchemaConfiguration) | +| int | validate(arg: int, configuration: SchemaConfiguration) | +| long | validate(arg: long, configuration: SchemaConfiguration) | +| float | validate(arg: float, configuration: SchemaConfiguration) | +| double | validate(arg: double, configuration: SchemaConfiguration) | +| Number | validate(arg: Number, configuration: SchemaConfiguration) | +| boolean | validate(arg: boolean, configuration: SchemaConfiguration) | +| FrozenMap | validate(arg: Map<?, ?>, configuration: SchemaConfiguration) | +| FrozenList | validate(arg: List<*>, configuration: SchemaConfiguration) | +| [Allof1BoxedString](#allof1boxedstring) | validateAndBox(String, configuration: SchemaConfiguration) | +| [Allof1BoxedVoid](#allof1boxedvoid) | validateAndBox(Nothing?, configuration: SchemaConfiguration) | +| [Allof1BoxedNumber](#allof1boxednumber) | validateAndBox(Number, configuration: SchemaConfiguration) | +| [Allof1BoxedBoolean](#allof1boxedboolean) | validateAndBox(boolean, configuration: SchemaConfiguration) | +| [Allof1BoxedMap](#allof1boxedmap) | validateAndBox(Map<?, ?>, configuration: SchemaConfiguration) | +| [Allof1BoxedList](#allof1boxedlist) | validateAndBox(List<*>, configuration: SchemaConfiguration) | +| [Allof1Boxed](#allof1boxed) | validateAndBox(Any?, configuration: SchemaConfiguration) | +| Any? | validate(arg: Any?, configuration: SchemaConfiguration) | + +## Schema1Boxed +sealed interface Schema1Boxed
    +permits
    +[Schema1BoxedVoid](#schema1boxedvoid), +[Schema1BoxedBoolean](#schema1boxedboolean), +[Schema1BoxedNumber](#schema1boxednumber), +[Schema1BoxedString](#schema1boxedstring), +[Schema1BoxedList](#schema1boxedlist), +[Schema1BoxedMap](#schema1boxedmap) + +sealed interface that stores validated payloads using boxed classes + +## Schema1BoxedVoid +data class Schema1BoxedVoid
    +implements [Schema1Boxed](#schema1boxed) + +data class that stores validated null payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| Schema1BoxedVoid(Nothing? data)
    Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| Nothing? | data()
    validated payload | +| Any? | getData()
    validated payload | + +## Schema1BoxedBoolean +data class Schema1BoxedBoolean
    +implements [Schema1Boxed](#schema1boxed) + +record that stores validated boolean payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| Schema1BoxedBoolean(boolean data)
    Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| boolean | data()
    validated payload | +| Any? | getData()
    validated payload | + +## Schema1BoxedNumber +data class Schema1BoxedNumber
    +implements [Schema1Boxed](#schema1boxed) + +data class that stores validated Number payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| Schema1BoxedNumber(Number data)
    Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| Number | data()
    validated payload | +| Any? | getData()
    validated payload | + +## Schema1BoxedString +data class Schema1BoxedString
    +implements [Schema1Boxed](#schema1boxed) + +data class that stores validated String payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| Schema1BoxedString(String data)
    Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| String | data()
    validated payload | +| Any? | getData()
    validated payload | + +## Schema1BoxedList +data class Schema1BoxedList
    +implements [Schema1Boxed](#schema1boxed) + +data class that stores validated List payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| Schema1BoxedList(FrozenList data)
    Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| FrozenList | data()
    validated payload | +| Any? | getData()
    validated payload | + +## Schema1BoxedMap +data class Schema1BoxedMap
    +implements [Schema1Boxed](#schema1boxed) + +data class that stores validated Map payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| Schema1BoxedMap([Schema1Map](#schema1map) data)
    Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| [Schema1Map](#schema1map) | data()
    validated payload | +| Any? | getData()
    validated payload | + +## Schema1 +class Schema1
    +extends JsonSchema + +A schema class that validates payloads + +### Field Summary +| Modifier and Type | Field and Description | +| ----------------- | ---------------------- | +| Map> | properties = mapOf(
        "foo" to [Foo::class.java](#foo))
    )
    | +| Set | required = setOf(
        "foo"
    )
    | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| String | validate(arg: String, configuration: SchemaConfiguration) | +| Nothing? | validate(arg: Nothing?, configuration: SchemaConfiguration) | +| int | validate(arg: int, configuration: SchemaConfiguration) | +| long | validate(arg: long, configuration: SchemaConfiguration) | +| float | validate(arg: float, configuration: SchemaConfiguration) | +| double | validate(arg: double, configuration: SchemaConfiguration) | +| Number | validate(arg: Number, configuration: SchemaConfiguration) | +| boolean | validate(arg: boolean, configuration: SchemaConfiguration) | +| [Schema1Map](#schema1map) | validate(arg: [Map<?, ?>](#schema1mapbuilder), configuration: SchemaConfiguration) | +| FrozenList | validate(arg: List<*>, configuration: SchemaConfiguration) | +| [Schema1BoxedString](#schema1boxedstring) | validateAndBox(String, configuration: SchemaConfiguration) | +| [Schema1BoxedVoid](#schema1boxedvoid) | validateAndBox(Nothing?, configuration: SchemaConfiguration) | +| [Schema1BoxedNumber](#schema1boxednumber) | validateAndBox(Number, configuration: SchemaConfiguration) | +| [Schema1BoxedBoolean](#schema1boxedboolean) | validateAndBox(boolean, configuration: SchemaConfiguration) | +| [Schema1BoxedMap](#schema1boxedmap) | validateAndBox([Map<?, ?>](#schema1mapbuilder), configuration: SchemaConfiguration) | +| [Schema1BoxedList](#schema1boxedlist) | validateAndBox(List<*>, configuration: SchemaConfiguration) | +| [Schema1Boxed](#schema1boxed) | validateAndBox(Any?, configuration: SchemaConfiguration) | +| Any? | validate(arg: Any?, configuration: SchemaConfiguration) | + +## Schema1Map0Builder +class Schema1Map0Builder
    +builder for `Map` + +A class that builds the Map input type + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| Schema1Map0Builder(Map instance)
    Creates a builder that contains the passed instance | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| Map | build()
    Returns map input that should be used with Schema.validate | +| [Schema1Map0Builder](#schema1map0builder) | additionalProperty(key: String, value: Nothing?) | +| [Schema1Map0Builder](#schema1map0builder) | additionalProperty(key: String, value: Boolean) | +| [Schema1Map0Builder](#schema1map0builder) | additionalProperty(key: String, value: String) | +| [Schema1Map0Builder](#schema1map0builder) | additionalProperty(key: String, value: Int) | +| [Schema1Map0Builder](#schema1map0builder) | additionalProperty(key: String, value: Float) | +| [Schema1Map0Builder](#schema1map0builder) | additionalProperty(key: String, value: Long) | +| [Schema1Map0Builder](#schema1map0builder) | additionalProperty(key: String, value: Double) | +| [Schema1Map0Builder](#schema1map0builder) | additionalProperty(key: String, value: List) | +| [Schema1Map0Builder](#schema1map0builder) | additionalProperty(key: String, value: Map) | + +## Schema1MapBuilder +class Schema1MapBuilder
    +builder for `Map` + +A class that builds the Map input type + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| Schema1MapBuilder()
    Creates a builder that contains an empty map | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| [Schema1Map0Builder](#schema1map0builder) | foo(value: String) | + +## Schema1Map +class Schema1Map
    +extends FrozenMap + +A class to store validated Map payloads + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| static [Schema1Map](#schema1map) | of([Map](#schema1mapbuilder) arg, SchemaConfiguration configuration) | +| String | foo()
    | +| Any? | getAdditionalProperty(String name)
    provides type safety for additional properties | + +## FooBoxed +sealed interface FooBoxed
    +permits
    +[FooBoxedString](#fooboxedstring) + +sealed interface that stores validated payloads using boxed classes + +## FooBoxedString +data class FooBoxedString
    +implements [FooBoxed](#fooboxed) + +data class that stores validated String payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| FooBoxedString(String data)
    Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| String | data()
    validated payload | +| Any? | getData()
    validated payload | + +## Foo +class Foo
    +extends StringJsonSchema.StringJsonSchema1 + +A schema class that validates payloads + +| Methods Inherited from class org.openapijsonschematools.client.schemas.StringJsonSchema.StringJsonSchema1 | +| ------------------------------------------------------------------ | +| validate | +| validateAndBox | + +## Schema0Boxed +sealed interface Schema0Boxed
    +permits
    +[Schema0BoxedVoid](#schema0boxedvoid), +[Schema0BoxedBoolean](#schema0boxedboolean), +[Schema0BoxedNumber](#schema0boxednumber), +[Schema0BoxedString](#schema0boxedstring), +[Schema0BoxedList](#schema0boxedlist), +[Schema0BoxedMap](#schema0boxedmap) + +sealed interface that stores validated payloads using boxed classes + +## Schema0BoxedVoid +data class Schema0BoxedVoid
    +implements [Schema0Boxed](#schema0boxed) + +data class that stores validated null payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| Schema0BoxedVoid(Nothing? data)
    Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| Nothing? | data()
    validated payload | +| Any? | getData()
    validated payload | + +## Schema0BoxedBoolean +data class Schema0BoxedBoolean
    +implements [Schema0Boxed](#schema0boxed) + +record that stores validated boolean payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| Schema0BoxedBoolean(boolean data)
    Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| boolean | data()
    validated payload | +| Any? | getData()
    validated payload | + +## Schema0BoxedNumber +data class Schema0BoxedNumber
    +implements [Schema0Boxed](#schema0boxed) + +data class that stores validated Number payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| Schema0BoxedNumber(Number data)
    Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| Number | data()
    validated payload | +| Any? | getData()
    validated payload | + +## Schema0BoxedString +data class Schema0BoxedString
    +implements [Schema0Boxed](#schema0boxed) + +data class that stores validated String payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| Schema0BoxedString(String data)
    Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| String | data()
    validated payload | +| Any? | getData()
    validated payload | + +## Schema0BoxedList +data class Schema0BoxedList
    +implements [Schema0Boxed](#schema0boxed) + +data class that stores validated List payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| Schema0BoxedList(FrozenList data)
    Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| FrozenList | data()
    validated payload | +| Any? | getData()
    validated payload | + +## Schema0BoxedMap +data class Schema0BoxedMap
    +implements [Schema0Boxed](#schema0boxed) + +data class that stores validated Map payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| Schema0BoxedMap([Schema0Map](#schema0map) data)
    Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| [Schema0Map](#schema0map) | data()
    validated payload | +| Any? | getData()
    validated payload | + +## Schema0 +class Schema0
    +extends JsonSchema + +A schema class that validates payloads + +### Field Summary +| Modifier and Type | Field and Description | +| ----------------- | ---------------------- | +| Map> | properties = mapOf(
        "bar" to [Bar::class.java](#bar))
    )
    | +| Set | required = setOf(
        "bar"
    )
    | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| String | validate(arg: String, configuration: SchemaConfiguration) | +| Nothing? | validate(arg: Nothing?, configuration: SchemaConfiguration) | +| int | validate(arg: int, configuration: SchemaConfiguration) | +| long | validate(arg: long, configuration: SchemaConfiguration) | +| float | validate(arg: float, configuration: SchemaConfiguration) | +| double | validate(arg: double, configuration: SchemaConfiguration) | +| Number | validate(arg: Number, configuration: SchemaConfiguration) | +| boolean | validate(arg: boolean, configuration: SchemaConfiguration) | +| [Schema0Map](#schema0map) | validate(arg: [Map<?, ?>](#schema0mapbuilder), configuration: SchemaConfiguration) | +| FrozenList | validate(arg: List<*>, configuration: SchemaConfiguration) | +| [Schema0BoxedString](#schema0boxedstring) | validateAndBox(String, configuration: SchemaConfiguration) | +| [Schema0BoxedVoid](#schema0boxedvoid) | validateAndBox(Nothing?, configuration: SchemaConfiguration) | +| [Schema0BoxedNumber](#schema0boxednumber) | validateAndBox(Number, configuration: SchemaConfiguration) | +| [Schema0BoxedBoolean](#schema0boxedboolean) | validateAndBox(boolean, configuration: SchemaConfiguration) | +| [Schema0BoxedMap](#schema0boxedmap) | validateAndBox([Map<?, ?>](#schema0mapbuilder), configuration: SchemaConfiguration) | +| [Schema0BoxedList](#schema0boxedlist) | validateAndBox(List<*>, configuration: SchemaConfiguration) | +| [Schema0Boxed](#schema0boxed) | validateAndBox(Any?, configuration: SchemaConfiguration) | +| Any? | validate(arg: Any?, configuration: SchemaConfiguration) | + +## Schema0Map0Builder +class Schema0Map0Builder
    +builder for `Map` + +A class that builds the Map input type + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| Schema0Map0Builder(Map instance)
    Creates a builder that contains the passed instance | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| Map | build()
    Returns map input that should be used with Schema.validate | +| [Schema0Map0Builder](#schema0map0builder) | additionalProperty(key: String, value: Nothing?) | +| [Schema0Map0Builder](#schema0map0builder) | additionalProperty(key: String, value: Boolean) | +| [Schema0Map0Builder](#schema0map0builder) | additionalProperty(key: String, value: String) | +| [Schema0Map0Builder](#schema0map0builder) | additionalProperty(key: String, value: Int) | +| [Schema0Map0Builder](#schema0map0builder) | additionalProperty(key: String, value: Float) | +| [Schema0Map0Builder](#schema0map0builder) | additionalProperty(key: String, value: Long) | +| [Schema0Map0Builder](#schema0map0builder) | additionalProperty(key: String, value: Double) | +| [Schema0Map0Builder](#schema0map0builder) | additionalProperty(key: String, value: List) | +| [Schema0Map0Builder](#schema0map0builder) | additionalProperty(key: String, value: Map) | + +## Schema0MapBuilder +class Schema0MapBuilder
    +builder for `Map` + +A class that builds the Map input type + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| Schema0MapBuilder()
    Creates a builder that contains an empty map | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| [Schema0Map0Builder](#schema0map0builder) | bar(value: Int) | +| [Schema0Map0Builder](#schema0map0builder) | bar(value: Float) | +| [Schema0Map0Builder](#schema0map0builder) | bar(value: Long) | +| [Schema0Map0Builder](#schema0map0builder) | bar(value: Double) | + +## Schema0Map +class Schema0Map
    +extends FrozenMap + +A class to store validated Map payloads + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| static [Schema0Map](#schema0map) | of([Map](#schema0mapbuilder) arg, SchemaConfiguration configuration) | +| Number | bar()
    | +| Any? | getAdditionalProperty(String name)
    provides type safety for additional properties | + +## BarBoxed +sealed interface BarBoxed
    +permits
    +[BarBoxedNumber](#barboxednumber) + +sealed interface that stores validated payloads using boxed classes + +## BarBoxedNumber +data class BarBoxedNumber
    +implements [BarBoxed](#barboxed) + +data class that stores validated Number payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| BarBoxedNumber(Number data)
    Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| Number | data()
    validated payload | +| Any? | getData()
    validated payload | + +## Bar +class Bar
    +extends IntJsonSchema.IntJsonSchema1 + +A schema class that validates payloads + +| Methods Inherited from class org.openapijsonschematools.client.schemas.IntJsonSchema.IntJsonSchema1 | +| ------------------------------------------------------------------ | +| validate | +| validateAndBox | + +[[Back to top]](#top) [[Back to Component Schemas]](../../../README.md#Component-Schemas) [[Back to README]](../../../README.md) diff --git a/samples/client/3_1_0_unit_test/kotlin/docs/components/schemas/AllofCombinedWithAnyofOneof.md b/samples/client/3_1_0_unit_test/kotlin/docs/components/schemas/AllofCombinedWithAnyofOneof.md new file mode 100644 index 00000000000..be071761cb0 --- /dev/null +++ b/samples/client/3_1_0_unit_test/kotlin/docs/components/schemas/AllofCombinedWithAnyofOneof.md @@ -0,0 +1,636 @@ +# AllofCombinedWithAnyofOneof +org.openapijsonschematools.client.components.schemas.AllofCombinedWithAnyofOneof.java +class AllofCombinedWithAnyofOneof
    + +A class that contains necessary nested +- schema classes (which validate payloads), extends JsonSchema +- sealed interfaces which store validated payloads, Kotlin version of a sum type +- boxed classes which store validated payloads, sealed permits class implementations + +## Nested Class Summary +| Modifier and Type | Class and Description | +| ----------------- | ---------------------- | +| sealed interface | [AllofCombinedWithAnyofOneof.AllofCombinedWithAnyofOneof1Boxed](#allofcombinedwithanyofoneof1boxed)
    sealed interface for validated payloads | +| record | [AllofCombinedWithAnyofOneof.AllofCombinedWithAnyofOneof1BoxedVoid](#allofcombinedwithanyofoneof1boxedvoid)
    boxed class to store validated null payloads | +| record | [AllofCombinedWithAnyofOneof.AllofCombinedWithAnyofOneof1BoxedBoolean](#allofcombinedwithanyofoneof1boxedboolean)
    boxed class to store validated boolean payloads | +| record | [AllofCombinedWithAnyofOneof.AllofCombinedWithAnyofOneof1BoxedNumber](#allofcombinedwithanyofoneof1boxednumber)
    boxed class to store validated Number payloads | +| record | [AllofCombinedWithAnyofOneof.AllofCombinedWithAnyofOneof1BoxedString](#allofcombinedwithanyofoneof1boxedstring)
    boxed class to store validated String payloads | +| record | [AllofCombinedWithAnyofOneof.AllofCombinedWithAnyofOneof1BoxedList](#allofcombinedwithanyofoneof1boxedlist)
    boxed class to store validated List payloads | +| record | [AllofCombinedWithAnyofOneof.AllofCombinedWithAnyofOneof1BoxedMap](#allofcombinedwithanyofoneof1boxedmap)
    boxed class to store validated Map payloads | +| static class | [AllofCombinedWithAnyofOneof.AllofCombinedWithAnyofOneof1](#allofcombinedwithanyofoneof1)
    schema class | +| sealed interface | [AllofCombinedWithAnyofOneof.Schema0Boxed](#schema0boxed)
    sealed interface for validated payloads | +| record | [AllofCombinedWithAnyofOneof.Schema0BoxedVoid](#schema0boxedvoid)
    boxed class to store validated null payloads | +| record | [AllofCombinedWithAnyofOneof.Schema0BoxedBoolean](#schema0boxedboolean)
    boxed class to store validated boolean payloads | +| record | [AllofCombinedWithAnyofOneof.Schema0BoxedNumber](#schema0boxednumber)
    boxed class to store validated Number payloads | +| record | [AllofCombinedWithAnyofOneof.Schema0BoxedString](#schema0boxedstring)
    boxed class to store validated String payloads | +| record | [AllofCombinedWithAnyofOneof.Schema0BoxedList](#schema0boxedlist)
    boxed class to store validated List payloads | +| record | [AllofCombinedWithAnyofOneof.Schema0BoxedMap](#schema0boxedmap)
    boxed class to store validated Map payloads | +| static class | [AllofCombinedWithAnyofOneof.Schema0](#schema0)
    schema class | +| sealed interface | [AllofCombinedWithAnyofOneof.Schema01Boxed](#schema01boxed)
    sealed interface for validated payloads | +| record | [AllofCombinedWithAnyofOneof.Schema01BoxedVoid](#schema01boxedvoid)
    boxed class to store validated null payloads | +| record | [AllofCombinedWithAnyofOneof.Schema01BoxedBoolean](#schema01boxedboolean)
    boxed class to store validated boolean payloads | +| record | [AllofCombinedWithAnyofOneof.Schema01BoxedNumber](#schema01boxednumber)
    boxed class to store validated Number payloads | +| record | [AllofCombinedWithAnyofOneof.Schema01BoxedString](#schema01boxedstring)
    boxed class to store validated String payloads | +| record | [AllofCombinedWithAnyofOneof.Schema01BoxedList](#schema01boxedlist)
    boxed class to store validated List payloads | +| record | [AllofCombinedWithAnyofOneof.Schema01BoxedMap](#schema01boxedmap)
    boxed class to store validated Map payloads | +| static class | [AllofCombinedWithAnyofOneof.Schema01](#schema01)
    schema class | +| sealed interface | [AllofCombinedWithAnyofOneof.Schema02Boxed](#schema02boxed)
    sealed interface for validated payloads | +| record | [AllofCombinedWithAnyofOneof.Schema02BoxedVoid](#schema02boxedvoid)
    boxed class to store validated null payloads | +| record | [AllofCombinedWithAnyofOneof.Schema02BoxedBoolean](#schema02boxedboolean)
    boxed class to store validated boolean payloads | +| record | [AllofCombinedWithAnyofOneof.Schema02BoxedNumber](#schema02boxednumber)
    boxed class to store validated Number payloads | +| record | [AllofCombinedWithAnyofOneof.Schema02BoxedString](#schema02boxedstring)
    boxed class to store validated String payloads | +| record | [AllofCombinedWithAnyofOneof.Schema02BoxedList](#schema02boxedlist)
    boxed class to store validated List payloads | +| record | [AllofCombinedWithAnyofOneof.Schema02BoxedMap](#schema02boxedmap)
    boxed class to store validated Map payloads | +| static class | [AllofCombinedWithAnyofOneof.Schema02](#schema02)
    schema class | + +## AllofCombinedWithAnyofOneof1Boxed +sealed interface AllofCombinedWithAnyofOneof1Boxed
    +permits
    +[AllofCombinedWithAnyofOneof1BoxedVoid](#allofcombinedwithanyofoneof1boxedvoid), +[AllofCombinedWithAnyofOneof1BoxedBoolean](#allofcombinedwithanyofoneof1boxedboolean), +[AllofCombinedWithAnyofOneof1BoxedNumber](#allofcombinedwithanyofoneof1boxednumber), +[AllofCombinedWithAnyofOneof1BoxedString](#allofcombinedwithanyofoneof1boxedstring), +[AllofCombinedWithAnyofOneof1BoxedList](#allofcombinedwithanyofoneof1boxedlist), +[AllofCombinedWithAnyofOneof1BoxedMap](#allofcombinedwithanyofoneof1boxedmap) + +sealed interface that stores validated payloads using boxed classes + +## AllofCombinedWithAnyofOneof1BoxedVoid +data class AllofCombinedWithAnyofOneof1BoxedVoid
    +implements [AllofCombinedWithAnyofOneof1Boxed](#allofcombinedwithanyofoneof1boxed) + +data class that stores validated null payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| AllofCombinedWithAnyofOneof1BoxedVoid(Nothing? data)
    Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| Nothing? | data()
    validated payload | +| Any? | getData()
    validated payload | + +## AllofCombinedWithAnyofOneof1BoxedBoolean +data class AllofCombinedWithAnyofOneof1BoxedBoolean
    +implements [AllofCombinedWithAnyofOneof1Boxed](#allofcombinedwithanyofoneof1boxed) + +record that stores validated boolean payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| AllofCombinedWithAnyofOneof1BoxedBoolean(boolean data)
    Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| boolean | data()
    validated payload | +| Any? | getData()
    validated payload | + +## AllofCombinedWithAnyofOneof1BoxedNumber +data class AllofCombinedWithAnyofOneof1BoxedNumber
    +implements [AllofCombinedWithAnyofOneof1Boxed](#allofcombinedwithanyofoneof1boxed) + +data class that stores validated Number payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| AllofCombinedWithAnyofOneof1BoxedNumber(Number data)
    Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| Number | data()
    validated payload | +| Any? | getData()
    validated payload | + +## AllofCombinedWithAnyofOneof1BoxedString +data class AllofCombinedWithAnyofOneof1BoxedString
    +implements [AllofCombinedWithAnyofOneof1Boxed](#allofcombinedwithanyofoneof1boxed) + +data class that stores validated String payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| AllofCombinedWithAnyofOneof1BoxedString(String data)
    Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| String | data()
    validated payload | +| Any? | getData()
    validated payload | + +## AllofCombinedWithAnyofOneof1BoxedList +data class AllofCombinedWithAnyofOneof1BoxedList
    +implements [AllofCombinedWithAnyofOneof1Boxed](#allofcombinedwithanyofoneof1boxed) + +data class that stores validated List payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| AllofCombinedWithAnyofOneof1BoxedList(FrozenList data)
    Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| FrozenList | data()
    validated payload | +| Any? | getData()
    validated payload | + +## AllofCombinedWithAnyofOneof1BoxedMap +data class AllofCombinedWithAnyofOneof1BoxedMap
    +implements [AllofCombinedWithAnyofOneof1Boxed](#allofcombinedwithanyofoneof1boxed) + +data class that stores validated Map payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| AllofCombinedWithAnyofOneof1BoxedMap(FrozenMap data)
    Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| FrozenMap | data()
    validated payload | +| Any? | getData()
    validated payload | + +## AllofCombinedWithAnyofOneof1 +class AllofCombinedWithAnyofOneof1
    +extends JsonSchema + +A schema class that validates payloads + +### Field Summary +| Modifier and Type | Field and Description | +| ----------------- | ---------------------- | +| List> | allOf = listOf(
        [Schema02::class.java](#schema02)
    ;)
    | +| List> | anyOf = listOf(
        [Schema01::class.java](#schema01)
    )
    | +| List> | oneOf = listOf(
        [Schema0::class.java](#schema0)
    ))
    | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| String | validate(arg: String, configuration: SchemaConfiguration) | +| Nothing? | validate(arg: Nothing?, configuration: SchemaConfiguration) | +| int | validate(arg: int, configuration: SchemaConfiguration) | +| long | validate(arg: long, configuration: SchemaConfiguration) | +| float | validate(arg: float, configuration: SchemaConfiguration) | +| double | validate(arg: double, configuration: SchemaConfiguration) | +| Number | validate(arg: Number, configuration: SchemaConfiguration) | +| boolean | validate(arg: boolean, configuration: SchemaConfiguration) | +| FrozenMap | validate(arg: Map<?, ?>, configuration: SchemaConfiguration) | +| FrozenList | validate(arg: List<*>, configuration: SchemaConfiguration) | +| [AllofCombinedWithAnyofOneof1BoxedString](#allofcombinedwithanyofoneof1boxedstring) | validateAndBox(String, configuration: SchemaConfiguration) | +| [AllofCombinedWithAnyofOneof1BoxedVoid](#allofcombinedwithanyofoneof1boxedvoid) | validateAndBox(Nothing?, configuration: SchemaConfiguration) | +| [AllofCombinedWithAnyofOneof1BoxedNumber](#allofcombinedwithanyofoneof1boxednumber) | validateAndBox(Number, configuration: SchemaConfiguration) | +| [AllofCombinedWithAnyofOneof1BoxedBoolean](#allofcombinedwithanyofoneof1boxedboolean) | validateAndBox(boolean, configuration: SchemaConfiguration) | +| [AllofCombinedWithAnyofOneof1BoxedMap](#allofcombinedwithanyofoneof1boxedmap) | validateAndBox(Map<?, ?>, configuration: SchemaConfiguration) | +| [AllofCombinedWithAnyofOneof1BoxedList](#allofcombinedwithanyofoneof1boxedlist) | validateAndBox(List<*>, configuration: SchemaConfiguration) | +| [AllofCombinedWithAnyofOneof1Boxed](#allofcombinedwithanyofoneof1boxed) | validateAndBox(Any?, configuration: SchemaConfiguration) | +| Any? | validate(arg: Any?, configuration: SchemaConfiguration) | + +## Schema0Boxed +sealed interface Schema0Boxed
    +permits
    +[Schema0BoxedVoid](#schema0boxedvoid), +[Schema0BoxedBoolean](#schema0boxedboolean), +[Schema0BoxedNumber](#schema0boxednumber), +[Schema0BoxedString](#schema0boxedstring), +[Schema0BoxedList](#schema0boxedlist), +[Schema0BoxedMap](#schema0boxedmap) + +sealed interface that stores validated payloads using boxed classes + +## Schema0BoxedVoid +data class Schema0BoxedVoid
    +implements [Schema0Boxed](#schema0boxed) + +data class that stores validated null payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| Schema0BoxedVoid(Nothing? data)
    Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| Nothing? | data()
    validated payload | +| Any? | getData()
    validated payload | + +## Schema0BoxedBoolean +data class Schema0BoxedBoolean
    +implements [Schema0Boxed](#schema0boxed) + +record that stores validated boolean payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| Schema0BoxedBoolean(boolean data)
    Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| boolean | data()
    validated payload | +| Any? | getData()
    validated payload | + +## Schema0BoxedNumber +data class Schema0BoxedNumber
    +implements [Schema0Boxed](#schema0boxed) + +data class that stores validated Number payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| Schema0BoxedNumber(Number data)
    Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| Number | data()
    validated payload | +| Any? | getData()
    validated payload | + +## Schema0BoxedString +data class Schema0BoxedString
    +implements [Schema0Boxed](#schema0boxed) + +data class that stores validated String payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| Schema0BoxedString(String data)
    Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| String | data()
    validated payload | +| Any? | getData()
    validated payload | + +## Schema0BoxedList +data class Schema0BoxedList
    +implements [Schema0Boxed](#schema0boxed) + +data class that stores validated List payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| Schema0BoxedList(FrozenList data)
    Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| FrozenList | data()
    validated payload | +| Any? | getData()
    validated payload | + +## Schema0BoxedMap +data class Schema0BoxedMap
    +implements [Schema0Boxed](#schema0boxed) + +data class that stores validated Map payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| Schema0BoxedMap(FrozenMap data)
    Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| FrozenMap | data()
    validated payload | +| Any? | getData()
    validated payload | + +## Schema0 +class Schema0
    +extends JsonSchema + +A schema class that validates payloads + +### Field Summary +| Modifier and Type | Field and Description | +| ----------------- | ---------------------- | +| BigDecimal | multipleOf = BigDecimal("5") | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| String | validate(arg: String, configuration: SchemaConfiguration) | +| Nothing? | validate(arg: Nothing?, configuration: SchemaConfiguration) | +| int | validate(arg: int, configuration: SchemaConfiguration) | +| long | validate(arg: long, configuration: SchemaConfiguration) | +| float | validate(arg: float, configuration: SchemaConfiguration) | +| double | validate(arg: double, configuration: SchemaConfiguration) | +| Number | validate(arg: Number, configuration: SchemaConfiguration) | +| boolean | validate(arg: boolean, configuration: SchemaConfiguration) | +| FrozenMap | validate(arg: Map<?, ?>, configuration: SchemaConfiguration) | +| FrozenList | validate(arg: List<*>, configuration: SchemaConfiguration) | +| [Schema0BoxedString](#schema0boxedstring) | validateAndBox(String, configuration: SchemaConfiguration) | +| [Schema0BoxedVoid](#schema0boxedvoid) | validateAndBox(Nothing?, configuration: SchemaConfiguration) | +| [Schema0BoxedNumber](#schema0boxednumber) | validateAndBox(Number, configuration: SchemaConfiguration) | +| [Schema0BoxedBoolean](#schema0boxedboolean) | validateAndBox(boolean, configuration: SchemaConfiguration) | +| [Schema0BoxedMap](#schema0boxedmap) | validateAndBox(Map<?, ?>, configuration: SchemaConfiguration) | +| [Schema0BoxedList](#schema0boxedlist) | validateAndBox(List<*>, configuration: SchemaConfiguration) | +| [Schema0Boxed](#schema0boxed) | validateAndBox(Any?, configuration: SchemaConfiguration) | +| Any? | validate(arg: Any?, configuration: SchemaConfiguration) | + +## Schema01Boxed +sealed interface Schema01Boxed
    +permits
    +[Schema01BoxedVoid](#schema01boxedvoid), +[Schema01BoxedBoolean](#schema01boxedboolean), +[Schema01BoxedNumber](#schema01boxednumber), +[Schema01BoxedString](#schema01boxedstring), +[Schema01BoxedList](#schema01boxedlist), +[Schema01BoxedMap](#schema01boxedmap) + +sealed interface that stores validated payloads using boxed classes + +## Schema01BoxedVoid +data class Schema01BoxedVoid
    +implements [Schema01Boxed](#schema01boxed) + +data class that stores validated null payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| Schema01BoxedVoid(Nothing? data)
    Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| Nothing? | data()
    validated payload | +| Any? | getData()
    validated payload | + +## Schema01BoxedBoolean +data class Schema01BoxedBoolean
    +implements [Schema01Boxed](#schema01boxed) + +record that stores validated boolean payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| Schema01BoxedBoolean(boolean data)
    Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| boolean | data()
    validated payload | +| Any? | getData()
    validated payload | + +## Schema01BoxedNumber +data class Schema01BoxedNumber
    +implements [Schema01Boxed](#schema01boxed) + +data class that stores validated Number payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| Schema01BoxedNumber(Number data)
    Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| Number | data()
    validated payload | +| Any? | getData()
    validated payload | + +## Schema01BoxedString +data class Schema01BoxedString
    +implements [Schema01Boxed](#schema01boxed) + +data class that stores validated String payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| Schema01BoxedString(String data)
    Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| String | data()
    validated payload | +| Any? | getData()
    validated payload | + +## Schema01BoxedList +data class Schema01BoxedList
    +implements [Schema01Boxed](#schema01boxed) + +data class that stores validated List payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| Schema01BoxedList(FrozenList data)
    Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| FrozenList | data()
    validated payload | +| Any? | getData()
    validated payload | + +## Schema01BoxedMap +data class Schema01BoxedMap
    +implements [Schema01Boxed](#schema01boxed) + +data class that stores validated Map payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| Schema01BoxedMap(FrozenMap data)
    Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| FrozenMap | data()
    validated payload | +| Any? | getData()
    validated payload | + +## Schema01 +class Schema01
    +extends JsonSchema + +A schema class that validates payloads + +### Field Summary +| Modifier and Type | Field and Description | +| ----------------- | ---------------------- | +| BigDecimal | multipleOf = BigDecimal("3") | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| String | validate(arg: String, configuration: SchemaConfiguration) | +| Nothing? | validate(arg: Nothing?, configuration: SchemaConfiguration) | +| int | validate(arg: int, configuration: SchemaConfiguration) | +| long | validate(arg: long, configuration: SchemaConfiguration) | +| float | validate(arg: float, configuration: SchemaConfiguration) | +| double | validate(arg: double, configuration: SchemaConfiguration) | +| Number | validate(arg: Number, configuration: SchemaConfiguration) | +| boolean | validate(arg: boolean, configuration: SchemaConfiguration) | +| FrozenMap | validate(arg: Map<?, ?>, configuration: SchemaConfiguration) | +| FrozenList | validate(arg: List<*>, configuration: SchemaConfiguration) | +| [Schema01BoxedString](#schema01boxedstring) | validateAndBox(String, configuration: SchemaConfiguration) | +| [Schema01BoxedVoid](#schema01boxedvoid) | validateAndBox(Nothing?, configuration: SchemaConfiguration) | +| [Schema01BoxedNumber](#schema01boxednumber) | validateAndBox(Number, configuration: SchemaConfiguration) | +| [Schema01BoxedBoolean](#schema01boxedboolean) | validateAndBox(boolean, configuration: SchemaConfiguration) | +| [Schema01BoxedMap](#schema01boxedmap) | validateAndBox(Map<?, ?>, configuration: SchemaConfiguration) | +| [Schema01BoxedList](#schema01boxedlist) | validateAndBox(List<*>, configuration: SchemaConfiguration) | +| [Schema01Boxed](#schema01boxed) | validateAndBox(Any?, configuration: SchemaConfiguration) | +| Any? | validate(arg: Any?, configuration: SchemaConfiguration) | + +## Schema02Boxed +sealed interface Schema02Boxed
    +permits
    +[Schema02BoxedVoid](#schema02boxedvoid), +[Schema02BoxedBoolean](#schema02boxedboolean), +[Schema02BoxedNumber](#schema02boxednumber), +[Schema02BoxedString](#schema02boxedstring), +[Schema02BoxedList](#schema02boxedlist), +[Schema02BoxedMap](#schema02boxedmap) + +sealed interface that stores validated payloads using boxed classes + +## Schema02BoxedVoid +data class Schema02BoxedVoid
    +implements [Schema02Boxed](#schema02boxed) + +data class that stores validated null payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| Schema02BoxedVoid(Nothing? data)
    Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| Nothing? | data()
    validated payload | +| Any? | getData()
    validated payload | + +## Schema02BoxedBoolean +data class Schema02BoxedBoolean
    +implements [Schema02Boxed](#schema02boxed) + +record that stores validated boolean payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| Schema02BoxedBoolean(boolean data)
    Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| boolean | data()
    validated payload | +| Any? | getData()
    validated payload | + +## Schema02BoxedNumber +data class Schema02BoxedNumber
    +implements [Schema02Boxed](#schema02boxed) + +data class that stores validated Number payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| Schema02BoxedNumber(Number data)
    Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| Number | data()
    validated payload | +| Any? | getData()
    validated payload | + +## Schema02BoxedString +data class Schema02BoxedString
    +implements [Schema02Boxed](#schema02boxed) + +data class that stores validated String payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| Schema02BoxedString(String data)
    Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| String | data()
    validated payload | +| Any? | getData()
    validated payload | + +## Schema02BoxedList +data class Schema02BoxedList
    +implements [Schema02Boxed](#schema02boxed) + +data class that stores validated List payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| Schema02BoxedList(FrozenList data)
    Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| FrozenList | data()
    validated payload | +| Any? | getData()
    validated payload | + +## Schema02BoxedMap +data class Schema02BoxedMap
    +implements [Schema02Boxed](#schema02boxed) + +data class that stores validated Map payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| Schema02BoxedMap(FrozenMap data)
    Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| FrozenMap | data()
    validated payload | +| Any? | getData()
    validated payload | + +## Schema02 +class Schema02
    +extends JsonSchema + +A schema class that validates payloads + +### Field Summary +| Modifier and Type | Field and Description | +| ----------------- | ---------------------- | +| BigDecimal | multipleOf = BigDecimal("2") | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| String | validate(arg: String, configuration: SchemaConfiguration) | +| Nothing? | validate(arg: Nothing?, configuration: SchemaConfiguration) | +| int | validate(arg: int, configuration: SchemaConfiguration) | +| long | validate(arg: long, configuration: SchemaConfiguration) | +| float | validate(arg: float, configuration: SchemaConfiguration) | +| double | validate(arg: double, configuration: SchemaConfiguration) | +| Number | validate(arg: Number, configuration: SchemaConfiguration) | +| boolean | validate(arg: boolean, configuration: SchemaConfiguration) | +| FrozenMap | validate(arg: Map<?, ?>, configuration: SchemaConfiguration) | +| FrozenList | validate(arg: List<*>, configuration: SchemaConfiguration) | +| [Schema02BoxedString](#schema02boxedstring) | validateAndBox(String, configuration: SchemaConfiguration) | +| [Schema02BoxedVoid](#schema02boxedvoid) | validateAndBox(Nothing?, configuration: SchemaConfiguration) | +| [Schema02BoxedNumber](#schema02boxednumber) | validateAndBox(Number, configuration: SchemaConfiguration) | +| [Schema02BoxedBoolean](#schema02boxedboolean) | validateAndBox(boolean, configuration: SchemaConfiguration) | +| [Schema02BoxedMap](#schema02boxedmap) | validateAndBox(Map<?, ?>, configuration: SchemaConfiguration) | +| [Schema02BoxedList](#schema02boxedlist) | validateAndBox(List<*>, configuration: SchemaConfiguration) | +| [Schema02Boxed](#schema02boxed) | validateAndBox(Any?, configuration: SchemaConfiguration) | +| Any? | validate(arg: Any?, configuration: SchemaConfiguration) | + +[[Back to top]](#top) [[Back to Component Schemas]](../../../README.md#Component-Schemas) [[Back to README]](../../../README.md) diff --git a/samples/client/3_1_0_unit_test/kotlin/docs/components/schemas/AllofSimpleTypes.md b/samples/client/3_1_0_unit_test/kotlin/docs/components/schemas/AllofSimpleTypes.md new file mode 100644 index 00000000000..3797e536800 --- /dev/null +++ b/samples/client/3_1_0_unit_test/kotlin/docs/components/schemas/AllofSimpleTypes.md @@ -0,0 +1,479 @@ +# AllofSimpleTypes +org.openapijsonschematools.client.components.schemas.AllofSimpleTypes.java +class AllofSimpleTypes
    + +A class that contains necessary nested +- schema classes (which validate payloads), extends JsonSchema +- sealed interfaces which store validated payloads, Kotlin version of a sum type +- boxed classes which store validated payloads, sealed permits class implementations + +## Nested Class Summary +| Modifier and Type | Class and Description | +| ----------------- | ---------------------- | +| sealed interface | [AllofSimpleTypes.AllofSimpleTypes1Boxed](#allofsimpletypes1boxed)
    sealed interface for validated payloads | +| record | [AllofSimpleTypes.AllofSimpleTypes1BoxedVoid](#allofsimpletypes1boxedvoid)
    boxed class to store validated null payloads | +| record | [AllofSimpleTypes.AllofSimpleTypes1BoxedBoolean](#allofsimpletypes1boxedboolean)
    boxed class to store validated boolean payloads | +| record | [AllofSimpleTypes.AllofSimpleTypes1BoxedNumber](#allofsimpletypes1boxednumber)
    boxed class to store validated Number payloads | +| record | [AllofSimpleTypes.AllofSimpleTypes1BoxedString](#allofsimpletypes1boxedstring)
    boxed class to store validated String payloads | +| record | [AllofSimpleTypes.AllofSimpleTypes1BoxedList](#allofsimpletypes1boxedlist)
    boxed class to store validated List payloads | +| record | [AllofSimpleTypes.AllofSimpleTypes1BoxedMap](#allofsimpletypes1boxedmap)
    boxed class to store validated Map payloads | +| static class | [AllofSimpleTypes.AllofSimpleTypes1](#allofsimpletypes1)
    schema class | +| sealed interface | [AllofSimpleTypes.Schema1Boxed](#schema1boxed)
    sealed interface for validated payloads | +| record | [AllofSimpleTypes.Schema1BoxedVoid](#schema1boxedvoid)
    boxed class to store validated null payloads | +| record | [AllofSimpleTypes.Schema1BoxedBoolean](#schema1boxedboolean)
    boxed class to store validated boolean payloads | +| record | [AllofSimpleTypes.Schema1BoxedNumber](#schema1boxednumber)
    boxed class to store validated Number payloads | +| record | [AllofSimpleTypes.Schema1BoxedString](#schema1boxedstring)
    boxed class to store validated String payloads | +| record | [AllofSimpleTypes.Schema1BoxedList](#schema1boxedlist)
    boxed class to store validated List payloads | +| record | [AllofSimpleTypes.Schema1BoxedMap](#schema1boxedmap)
    boxed class to store validated Map payloads | +| static class | [AllofSimpleTypes.Schema1](#schema1)
    schema class | +| sealed interface | [AllofSimpleTypes.Schema0Boxed](#schema0boxed)
    sealed interface for validated payloads | +| record | [AllofSimpleTypes.Schema0BoxedVoid](#schema0boxedvoid)
    boxed class to store validated null payloads | +| record | [AllofSimpleTypes.Schema0BoxedBoolean](#schema0boxedboolean)
    boxed class to store validated boolean payloads | +| record | [AllofSimpleTypes.Schema0BoxedNumber](#schema0boxednumber)
    boxed class to store validated Number payloads | +| record | [AllofSimpleTypes.Schema0BoxedString](#schema0boxedstring)
    boxed class to store validated String payloads | +| record | [AllofSimpleTypes.Schema0BoxedList](#schema0boxedlist)
    boxed class to store validated List payloads | +| record | [AllofSimpleTypes.Schema0BoxedMap](#schema0boxedmap)
    boxed class to store validated Map payloads | +| static class | [AllofSimpleTypes.Schema0](#schema0)
    schema class | + +## AllofSimpleTypes1Boxed +sealed interface AllofSimpleTypes1Boxed
    +permits
    +[AllofSimpleTypes1BoxedVoid](#allofsimpletypes1boxedvoid), +[AllofSimpleTypes1BoxedBoolean](#allofsimpletypes1boxedboolean), +[AllofSimpleTypes1BoxedNumber](#allofsimpletypes1boxednumber), +[AllofSimpleTypes1BoxedString](#allofsimpletypes1boxedstring), +[AllofSimpleTypes1BoxedList](#allofsimpletypes1boxedlist), +[AllofSimpleTypes1BoxedMap](#allofsimpletypes1boxedmap) + +sealed interface that stores validated payloads using boxed classes + +## AllofSimpleTypes1BoxedVoid +data class AllofSimpleTypes1BoxedVoid
    +implements [AllofSimpleTypes1Boxed](#allofsimpletypes1boxed) + +data class that stores validated null payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| AllofSimpleTypes1BoxedVoid(Nothing? data)
    Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| Nothing? | data()
    validated payload | +| Any? | getData()
    validated payload | + +## AllofSimpleTypes1BoxedBoolean +data class AllofSimpleTypes1BoxedBoolean
    +implements [AllofSimpleTypes1Boxed](#allofsimpletypes1boxed) + +record that stores validated boolean payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| AllofSimpleTypes1BoxedBoolean(boolean data)
    Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| boolean | data()
    validated payload | +| Any? | getData()
    validated payload | + +## AllofSimpleTypes1BoxedNumber +data class AllofSimpleTypes1BoxedNumber
    +implements [AllofSimpleTypes1Boxed](#allofsimpletypes1boxed) + +data class that stores validated Number payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| AllofSimpleTypes1BoxedNumber(Number data)
    Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| Number | data()
    validated payload | +| Any? | getData()
    validated payload | + +## AllofSimpleTypes1BoxedString +data class AllofSimpleTypes1BoxedString
    +implements [AllofSimpleTypes1Boxed](#allofsimpletypes1boxed) + +data class that stores validated String payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| AllofSimpleTypes1BoxedString(String data)
    Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| String | data()
    validated payload | +| Any? | getData()
    validated payload | + +## AllofSimpleTypes1BoxedList +data class AllofSimpleTypes1BoxedList
    +implements [AllofSimpleTypes1Boxed](#allofsimpletypes1boxed) + +data class that stores validated List payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| AllofSimpleTypes1BoxedList(FrozenList data)
    Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| FrozenList | data()
    validated payload | +| Any? | getData()
    validated payload | + +## AllofSimpleTypes1BoxedMap +data class AllofSimpleTypes1BoxedMap
    +implements [AllofSimpleTypes1Boxed](#allofsimpletypes1boxed) + +data class that stores validated Map payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| AllofSimpleTypes1BoxedMap(FrozenMap data)
    Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| FrozenMap | data()
    validated payload | +| Any? | getData()
    validated payload | + +## AllofSimpleTypes1 +class AllofSimpleTypes1
    +extends JsonSchema + +A schema class that validates payloads + +### Field Summary +| Modifier and Type | Field and Description | +| ----------------- | ---------------------- | +| List> | allOf = listOf(
        [Schema0::class.java](#schema0),
        [Schema1::class.java](#schema1)
    ;)
    | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| String | validate(arg: String, configuration: SchemaConfiguration) | +| Nothing? | validate(arg: Nothing?, configuration: SchemaConfiguration) | +| int | validate(arg: int, configuration: SchemaConfiguration) | +| long | validate(arg: long, configuration: SchemaConfiguration) | +| float | validate(arg: float, configuration: SchemaConfiguration) | +| double | validate(arg: double, configuration: SchemaConfiguration) | +| Number | validate(arg: Number, configuration: SchemaConfiguration) | +| boolean | validate(arg: boolean, configuration: SchemaConfiguration) | +| FrozenMap | validate(arg: Map<?, ?>, configuration: SchemaConfiguration) | +| FrozenList | validate(arg: List<*>, configuration: SchemaConfiguration) | +| [AllofSimpleTypes1BoxedString](#allofsimpletypes1boxedstring) | validateAndBox(String, configuration: SchemaConfiguration) | +| [AllofSimpleTypes1BoxedVoid](#allofsimpletypes1boxedvoid) | validateAndBox(Nothing?, configuration: SchemaConfiguration) | +| [AllofSimpleTypes1BoxedNumber](#allofsimpletypes1boxednumber) | validateAndBox(Number, configuration: SchemaConfiguration) | +| [AllofSimpleTypes1BoxedBoolean](#allofsimpletypes1boxedboolean) | validateAndBox(boolean, configuration: SchemaConfiguration) | +| [AllofSimpleTypes1BoxedMap](#allofsimpletypes1boxedmap) | validateAndBox(Map<?, ?>, configuration: SchemaConfiguration) | +| [AllofSimpleTypes1BoxedList](#allofsimpletypes1boxedlist) | validateAndBox(List<*>, configuration: SchemaConfiguration) | +| [AllofSimpleTypes1Boxed](#allofsimpletypes1boxed) | validateAndBox(Any?, configuration: SchemaConfiguration) | +| Any? | validate(arg: Any?, configuration: SchemaConfiguration) | + +## Schema1Boxed +sealed interface Schema1Boxed
    +permits
    +[Schema1BoxedVoid](#schema1boxedvoid), +[Schema1BoxedBoolean](#schema1boxedboolean), +[Schema1BoxedNumber](#schema1boxednumber), +[Schema1BoxedString](#schema1boxedstring), +[Schema1BoxedList](#schema1boxedlist), +[Schema1BoxedMap](#schema1boxedmap) + +sealed interface that stores validated payloads using boxed classes + +## Schema1BoxedVoid +data class Schema1BoxedVoid
    +implements [Schema1Boxed](#schema1boxed) + +data class that stores validated null payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| Schema1BoxedVoid(Nothing? data)
    Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| Nothing? | data()
    validated payload | +| Any? | getData()
    validated payload | + +## Schema1BoxedBoolean +data class Schema1BoxedBoolean
    +implements [Schema1Boxed](#schema1boxed) + +record that stores validated boolean payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| Schema1BoxedBoolean(boolean data)
    Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| boolean | data()
    validated payload | +| Any? | getData()
    validated payload | + +## Schema1BoxedNumber +data class Schema1BoxedNumber
    +implements [Schema1Boxed](#schema1boxed) + +data class that stores validated Number payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| Schema1BoxedNumber(Number data)
    Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| Number | data()
    validated payload | +| Any? | getData()
    validated payload | + +## Schema1BoxedString +data class Schema1BoxedString
    +implements [Schema1Boxed](#schema1boxed) + +data class that stores validated String payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| Schema1BoxedString(String data)
    Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| String | data()
    validated payload | +| Any? | getData()
    validated payload | + +## Schema1BoxedList +data class Schema1BoxedList
    +implements [Schema1Boxed](#schema1boxed) + +data class that stores validated List payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| Schema1BoxedList(FrozenList data)
    Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| FrozenList | data()
    validated payload | +| Any? | getData()
    validated payload | + +## Schema1BoxedMap +data class Schema1BoxedMap
    +implements [Schema1Boxed](#schema1boxed) + +data class that stores validated Map payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| Schema1BoxedMap(FrozenMap data)
    Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| FrozenMap | data()
    validated payload | +| Any? | getData()
    validated payload | + +## Schema1 +class Schema1
    +extends JsonSchema + +A schema class that validates payloads + +### Field Summary +| Modifier and Type | Field and Description | +| ----------------- | ---------------------- | +| Number | minimum = 20 | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| String | validate(arg: String, configuration: SchemaConfiguration) | +| Nothing? | validate(arg: Nothing?, configuration: SchemaConfiguration) | +| int | validate(arg: int, configuration: SchemaConfiguration) | +| long | validate(arg: long, configuration: SchemaConfiguration) | +| float | validate(arg: float, configuration: SchemaConfiguration) | +| double | validate(arg: double, configuration: SchemaConfiguration) | +| Number | validate(arg: Number, configuration: SchemaConfiguration) | +| boolean | validate(arg: boolean, configuration: SchemaConfiguration) | +| FrozenMap | validate(arg: Map<?, ?>, configuration: SchemaConfiguration) | +| FrozenList | validate(arg: List<*>, configuration: SchemaConfiguration) | +| [Schema1BoxedString](#schema1boxedstring) | validateAndBox(String, configuration: SchemaConfiguration) | +| [Schema1BoxedVoid](#schema1boxedvoid) | validateAndBox(Nothing?, configuration: SchemaConfiguration) | +| [Schema1BoxedNumber](#schema1boxednumber) | validateAndBox(Number, configuration: SchemaConfiguration) | +| [Schema1BoxedBoolean](#schema1boxedboolean) | validateAndBox(boolean, configuration: SchemaConfiguration) | +| [Schema1BoxedMap](#schema1boxedmap) | validateAndBox(Map<?, ?>, configuration: SchemaConfiguration) | +| [Schema1BoxedList](#schema1boxedlist) | validateAndBox(List<*>, configuration: SchemaConfiguration) | +| [Schema1Boxed](#schema1boxed) | validateAndBox(Any?, configuration: SchemaConfiguration) | +| Any? | validate(arg: Any?, configuration: SchemaConfiguration) | + +## Schema0Boxed +sealed interface Schema0Boxed
    +permits
    +[Schema0BoxedVoid](#schema0boxedvoid), +[Schema0BoxedBoolean](#schema0boxedboolean), +[Schema0BoxedNumber](#schema0boxednumber), +[Schema0BoxedString](#schema0boxedstring), +[Schema0BoxedList](#schema0boxedlist), +[Schema0BoxedMap](#schema0boxedmap) + +sealed interface that stores validated payloads using boxed classes + +## Schema0BoxedVoid +data class Schema0BoxedVoid
    +implements [Schema0Boxed](#schema0boxed) + +data class that stores validated null payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| Schema0BoxedVoid(Nothing? data)
    Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| Nothing? | data()
    validated payload | +| Any? | getData()
    validated payload | + +## Schema0BoxedBoolean +data class Schema0BoxedBoolean
    +implements [Schema0Boxed](#schema0boxed) + +record that stores validated boolean payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| Schema0BoxedBoolean(boolean data)
    Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| boolean | data()
    validated payload | +| Any? | getData()
    validated payload | + +## Schema0BoxedNumber +data class Schema0BoxedNumber
    +implements [Schema0Boxed](#schema0boxed) + +data class that stores validated Number payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| Schema0BoxedNumber(Number data)
    Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| Number | data()
    validated payload | +| Any? | getData()
    validated payload | + +## Schema0BoxedString +data class Schema0BoxedString
    +implements [Schema0Boxed](#schema0boxed) + +data class that stores validated String payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| Schema0BoxedString(String data)
    Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| String | data()
    validated payload | +| Any? | getData()
    validated payload | + +## Schema0BoxedList +data class Schema0BoxedList
    +implements [Schema0Boxed](#schema0boxed) + +data class that stores validated List payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| Schema0BoxedList(FrozenList data)
    Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| FrozenList | data()
    validated payload | +| Any? | getData()
    validated payload | + +## Schema0BoxedMap +data class Schema0BoxedMap
    +implements [Schema0Boxed](#schema0boxed) + +data class that stores validated Map payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| Schema0BoxedMap(FrozenMap data)
    Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| FrozenMap | data()
    validated payload | +| Any? | getData()
    validated payload | + +## Schema0 +class Schema0
    +extends JsonSchema + +A schema class that validates payloads + +### Field Summary +| Modifier and Type | Field and Description | +| ----------------- | ---------------------- | +| Number | maximum = 30 | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| String | validate(arg: String, configuration: SchemaConfiguration) | +| Nothing? | validate(arg: Nothing?, configuration: SchemaConfiguration) | +| int | validate(arg: int, configuration: SchemaConfiguration) | +| long | validate(arg: long, configuration: SchemaConfiguration) | +| float | validate(arg: float, configuration: SchemaConfiguration) | +| double | validate(arg: double, configuration: SchemaConfiguration) | +| Number | validate(arg: Number, configuration: SchemaConfiguration) | +| boolean | validate(arg: boolean, configuration: SchemaConfiguration) | +| FrozenMap | validate(arg: Map<?, ?>, configuration: SchemaConfiguration) | +| FrozenList | validate(arg: List<*>, configuration: SchemaConfiguration) | +| [Schema0BoxedString](#schema0boxedstring) | validateAndBox(String, configuration: SchemaConfiguration) | +| [Schema0BoxedVoid](#schema0boxedvoid) | validateAndBox(Nothing?, configuration: SchemaConfiguration) | +| [Schema0BoxedNumber](#schema0boxednumber) | validateAndBox(Number, configuration: SchemaConfiguration) | +| [Schema0BoxedBoolean](#schema0boxedboolean) | validateAndBox(boolean, configuration: SchemaConfiguration) | +| [Schema0BoxedMap](#schema0boxedmap) | validateAndBox(Map<?, ?>, configuration: SchemaConfiguration) | +| [Schema0BoxedList](#schema0boxedlist) | validateAndBox(List<*>, configuration: SchemaConfiguration) | +| [Schema0Boxed](#schema0boxed) | validateAndBox(Any?, configuration: SchemaConfiguration) | +| Any? | validate(arg: Any?, configuration: SchemaConfiguration) | + +[[Back to top]](#top) [[Back to Component Schemas]](../../../README.md#Component-Schemas) [[Back to README]](../../../README.md) diff --git a/samples/client/3_1_0_unit_test/kotlin/docs/components/schemas/AllofWithBaseSchema.md b/samples/client/3_1_0_unit_test/kotlin/docs/components/schemas/AllofWithBaseSchema.md new file mode 100644 index 00000000000..2f94b4b3b6a --- /dev/null +++ b/samples/client/3_1_0_unit_test/kotlin/docs/components/schemas/AllofWithBaseSchema.md @@ -0,0 +1,770 @@ +# AllofWithBaseSchema +org.openapijsonschematools.client.components.schemas.AllofWithBaseSchema.java +class AllofWithBaseSchema
    + +A class that contains necessary nested +- schema classes (which validate payloads), extends JsonSchema +- sealed interfaces which store validated payloads, Kotlin version of a sum type +- boxed classes which store validated payloads, sealed permits class implementations +- classes to store validated map payloads, extends FrozenMap +- classes to build inputs for map payloads + +## Nested Class Summary +| Modifier and Type | Class and Description | +| ----------------- | ---------------------- | +| sealed interface | [AllofWithBaseSchema.AllofWithBaseSchema1Boxed](#allofwithbaseschema1boxed)
    sealed interface for validated payloads | +| record | [AllofWithBaseSchema.AllofWithBaseSchema1BoxedVoid](#allofwithbaseschema1boxedvoid)
    boxed class to store validated null payloads | +| record | [AllofWithBaseSchema.AllofWithBaseSchema1BoxedBoolean](#allofwithbaseschema1boxedboolean)
    boxed class to store validated boolean payloads | +| record | [AllofWithBaseSchema.AllofWithBaseSchema1BoxedNumber](#allofwithbaseschema1boxednumber)
    boxed class to store validated Number payloads | +| record | [AllofWithBaseSchema.AllofWithBaseSchema1BoxedString](#allofwithbaseschema1boxedstring)
    boxed class to store validated String payloads | +| record | [AllofWithBaseSchema.AllofWithBaseSchema1BoxedList](#allofwithbaseschema1boxedlist)
    boxed class to store validated List payloads | +| record | [AllofWithBaseSchema.AllofWithBaseSchema1BoxedMap](#allofwithbaseschema1boxedmap)
    boxed class to store validated Map payloads | +| static class | [AllofWithBaseSchema.AllofWithBaseSchema1](#allofwithbaseschema1)
    schema class | +| static class | [AllofWithBaseSchema.AllofWithBaseSchemaMapBuilder](#allofwithbaseschemamapbuilder)
    builder for Map payloads | +| static class | [AllofWithBaseSchema.AllofWithBaseSchemaMap](#allofwithbaseschemamap)
    output class for Map payloads | +| sealed interface | [AllofWithBaseSchema.BarBoxed](#barboxed)
    sealed interface for validated payloads | +| record | [AllofWithBaseSchema.BarBoxedNumber](#barboxednumber)
    boxed class to store validated Number payloads | +| static class | [AllofWithBaseSchema.Bar](#bar)
    schema class | +| sealed interface | [AllofWithBaseSchema.Schema1Boxed](#schema1boxed)
    sealed interface for validated payloads | +| record | [AllofWithBaseSchema.Schema1BoxedVoid](#schema1boxedvoid)
    boxed class to store validated null payloads | +| record | [AllofWithBaseSchema.Schema1BoxedBoolean](#schema1boxedboolean)
    boxed class to store validated boolean payloads | +| record | [AllofWithBaseSchema.Schema1BoxedNumber](#schema1boxednumber)
    boxed class to store validated Number payloads | +| record | [AllofWithBaseSchema.Schema1BoxedString](#schema1boxedstring)
    boxed class to store validated String payloads | +| record | [AllofWithBaseSchema.Schema1BoxedList](#schema1boxedlist)
    boxed class to store validated List payloads | +| record | [AllofWithBaseSchema.Schema1BoxedMap](#schema1boxedmap)
    boxed class to store validated Map payloads | +| static class | [AllofWithBaseSchema.Schema1](#schema1)
    schema class | +| static class | [AllofWithBaseSchema.Schema1MapBuilder](#schema1mapbuilder)
    builder for Map payloads | +| static class | [AllofWithBaseSchema.Schema1Map](#schema1map)
    output class for Map payloads | +| sealed interface | [AllofWithBaseSchema.BazBoxed](#bazboxed)
    sealed interface for validated payloads | +| record | [AllofWithBaseSchema.BazBoxedVoid](#bazboxedvoid)
    boxed class to store validated null payloads | +| static class | [AllofWithBaseSchema.Baz](#baz)
    schema class | +| sealed interface | [AllofWithBaseSchema.Schema0Boxed](#schema0boxed)
    sealed interface for validated payloads | +| record | [AllofWithBaseSchema.Schema0BoxedVoid](#schema0boxedvoid)
    boxed class to store validated null payloads | +| record | [AllofWithBaseSchema.Schema0BoxedBoolean](#schema0boxedboolean)
    boxed class to store validated boolean payloads | +| record | [AllofWithBaseSchema.Schema0BoxedNumber](#schema0boxednumber)
    boxed class to store validated Number payloads | +| record | [AllofWithBaseSchema.Schema0BoxedString](#schema0boxedstring)
    boxed class to store validated String payloads | +| record | [AllofWithBaseSchema.Schema0BoxedList](#schema0boxedlist)
    boxed class to store validated List payloads | +| record | [AllofWithBaseSchema.Schema0BoxedMap](#schema0boxedmap)
    boxed class to store validated Map payloads | +| static class | [AllofWithBaseSchema.Schema0](#schema0)
    schema class | +| static class | [AllofWithBaseSchema.Schema0MapBuilder](#schema0mapbuilder)
    builder for Map payloads | +| static class | [AllofWithBaseSchema.Schema0Map](#schema0map)
    output class for Map payloads | +| sealed interface | [AllofWithBaseSchema.FooBoxed](#fooboxed)
    sealed interface for validated payloads | +| record | [AllofWithBaseSchema.FooBoxedString](#fooboxedstring)
    boxed class to store validated String payloads | +| static class | [AllofWithBaseSchema.Foo](#foo)
    schema class | + +## AllofWithBaseSchema1Boxed +sealed interface AllofWithBaseSchema1Boxed
    +permits
    +[AllofWithBaseSchema1BoxedVoid](#allofwithbaseschema1boxedvoid), +[AllofWithBaseSchema1BoxedBoolean](#allofwithbaseschema1boxedboolean), +[AllofWithBaseSchema1BoxedNumber](#allofwithbaseschema1boxednumber), +[AllofWithBaseSchema1BoxedString](#allofwithbaseschema1boxedstring), +[AllofWithBaseSchema1BoxedList](#allofwithbaseschema1boxedlist), +[AllofWithBaseSchema1BoxedMap](#allofwithbaseschema1boxedmap) + +sealed interface that stores validated payloads using boxed classes + +## AllofWithBaseSchema1BoxedVoid +data class AllofWithBaseSchema1BoxedVoid
    +implements [AllofWithBaseSchema1Boxed](#allofwithbaseschema1boxed) + +data class that stores validated null payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| AllofWithBaseSchema1BoxedVoid(Nothing? data)
    Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| Nothing? | data()
    validated payload | +| Any? | getData()
    validated payload | + +## AllofWithBaseSchema1BoxedBoolean +data class AllofWithBaseSchema1BoxedBoolean
    +implements [AllofWithBaseSchema1Boxed](#allofwithbaseschema1boxed) + +record that stores validated boolean payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| AllofWithBaseSchema1BoxedBoolean(boolean data)
    Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| boolean | data()
    validated payload | +| Any? | getData()
    validated payload | + +## AllofWithBaseSchema1BoxedNumber +data class AllofWithBaseSchema1BoxedNumber
    +implements [AllofWithBaseSchema1Boxed](#allofwithbaseschema1boxed) + +data class that stores validated Number payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| AllofWithBaseSchema1BoxedNumber(Number data)
    Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| Number | data()
    validated payload | +| Any? | getData()
    validated payload | + +## AllofWithBaseSchema1BoxedString +data class AllofWithBaseSchema1BoxedString
    +implements [AllofWithBaseSchema1Boxed](#allofwithbaseschema1boxed) + +data class that stores validated String payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| AllofWithBaseSchema1BoxedString(String data)
    Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| String | data()
    validated payload | +| Any? | getData()
    validated payload | + +## AllofWithBaseSchema1BoxedList +data class AllofWithBaseSchema1BoxedList
    +implements [AllofWithBaseSchema1Boxed](#allofwithbaseschema1boxed) + +data class that stores validated List payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| AllofWithBaseSchema1BoxedList(FrozenList data)
    Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| FrozenList | data()
    validated payload | +| Any? | getData()
    validated payload | + +## AllofWithBaseSchema1BoxedMap +data class AllofWithBaseSchema1BoxedMap
    +implements [AllofWithBaseSchema1Boxed](#allofwithbaseschema1boxed) + +data class that stores validated Map payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| AllofWithBaseSchema1BoxedMap([AllofWithBaseSchemaMap](#allofwithbaseschemamap) data)
    Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| [AllofWithBaseSchemaMap](#allofwithbaseschemamap) | data()
    validated payload | +| Any? | getData()
    validated payload | + +## AllofWithBaseSchema1 +class AllofWithBaseSchema1
    +extends JsonSchema + +A schema class that validates payloads + +### Field Summary +| Modifier and Type | Field and Description | +| ----------------- | ---------------------- | +| Map> | properties = mapOf(
        "bar" to [Bar::class.java](#bar))
    )
    | +| Set | required = setOf(
        "bar"
    )
    | +| List> | allOf = listOf(
        [Schema0::class.java](#schema0),
        [Schema1::class.java](#schema1)
    ;)
    | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| String | validate(arg: String, configuration: SchemaConfiguration) | +| Nothing? | validate(arg: Nothing?, configuration: SchemaConfiguration) | +| int | validate(arg: int, configuration: SchemaConfiguration) | +| long | validate(arg: long, configuration: SchemaConfiguration) | +| float | validate(arg: float, configuration: SchemaConfiguration) | +| double | validate(arg: double, configuration: SchemaConfiguration) | +| Number | validate(arg: Number, configuration: SchemaConfiguration) | +| boolean | validate(arg: boolean, configuration: SchemaConfiguration) | +| [AllofWithBaseSchemaMap](#allofwithbaseschemamap) | validate(arg: [Map<?, ?>](#allofwithbaseschemamapbuilder), configuration: SchemaConfiguration) | +| FrozenList | validate(arg: List<*>, configuration: SchemaConfiguration) | +| [AllofWithBaseSchema1BoxedString](#allofwithbaseschema1boxedstring) | validateAndBox(String, configuration: SchemaConfiguration) | +| [AllofWithBaseSchema1BoxedVoid](#allofwithbaseschema1boxedvoid) | validateAndBox(Nothing?, configuration: SchemaConfiguration) | +| [AllofWithBaseSchema1BoxedNumber](#allofwithbaseschema1boxednumber) | validateAndBox(Number, configuration: SchemaConfiguration) | +| [AllofWithBaseSchema1BoxedBoolean](#allofwithbaseschema1boxedboolean) | validateAndBox(boolean, configuration: SchemaConfiguration) | +| [AllofWithBaseSchema1BoxedMap](#allofwithbaseschema1boxedmap) | validateAndBox([Map<?, ?>](#allofwithbaseschemamapbuilder), configuration: SchemaConfiguration) | +| [AllofWithBaseSchema1BoxedList](#allofwithbaseschema1boxedlist) | validateAndBox(List<*>, configuration: SchemaConfiguration) | +| [AllofWithBaseSchema1Boxed](#allofwithbaseschema1boxed) | validateAndBox(Any?, configuration: SchemaConfiguration) | +| Any? | validate(arg: Any?, configuration: SchemaConfiguration) | + +## AllofWithBaseSchemaMap0Builder +class AllofWithBaseSchemaMap0Builder
    +builder for `Map` + +A class that builds the Map input type + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| AllofWithBaseSchemaMap0Builder(Map instance)
    Creates a builder that contains the passed instance | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| Map | build()
    Returns map input that should be used with Schema.validate | +| [AllofWithBaseSchemaMap0Builder](#allofwithbaseschemamap0builder) | additionalProperty(key: String, value: Nothing?) | +| [AllofWithBaseSchemaMap0Builder](#allofwithbaseschemamap0builder) | additionalProperty(key: String, value: Boolean) | +| [AllofWithBaseSchemaMap0Builder](#allofwithbaseschemamap0builder) | additionalProperty(key: String, value: String) | +| [AllofWithBaseSchemaMap0Builder](#allofwithbaseschemamap0builder) | additionalProperty(key: String, value: Int) | +| [AllofWithBaseSchemaMap0Builder](#allofwithbaseschemamap0builder) | additionalProperty(key: String, value: Float) | +| [AllofWithBaseSchemaMap0Builder](#allofwithbaseschemamap0builder) | additionalProperty(key: String, value: Long) | +| [AllofWithBaseSchemaMap0Builder](#allofwithbaseschemamap0builder) | additionalProperty(key: String, value: Double) | +| [AllofWithBaseSchemaMap0Builder](#allofwithbaseschemamap0builder) | additionalProperty(key: String, value: List) | +| [AllofWithBaseSchemaMap0Builder](#allofwithbaseschemamap0builder) | additionalProperty(key: String, value: Map) | + +## AllofWithBaseSchemaMapBuilder +class AllofWithBaseSchemaMapBuilder
    +builder for `Map` + +A class that builds the Map input type + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| AllofWithBaseSchemaMapBuilder()
    Creates a builder that contains an empty map | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| [AllofWithBaseSchemaMap0Builder](#allofwithbaseschemamap0builder) | bar(value: Int) | +| [AllofWithBaseSchemaMap0Builder](#allofwithbaseschemamap0builder) | bar(value: Float) | +| [AllofWithBaseSchemaMap0Builder](#allofwithbaseschemamap0builder) | bar(value: Long) | +| [AllofWithBaseSchemaMap0Builder](#allofwithbaseschemamap0builder) | bar(value: Double) | + +## AllofWithBaseSchemaMap +class AllofWithBaseSchemaMap
    +extends FrozenMap + +A class to store validated Map payloads + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| static [AllofWithBaseSchemaMap](#allofwithbaseschemamap) | of([Map](#allofwithbaseschemamapbuilder) arg, SchemaConfiguration configuration) | +| Number | bar()
    | +| Any? | getAdditionalProperty(String name)
    provides type safety for additional properties | + +## BarBoxed +sealed interface BarBoxed
    +permits
    +[BarBoxedNumber](#barboxednumber) + +sealed interface that stores validated payloads using boxed classes + +## BarBoxedNumber +data class BarBoxedNumber
    +implements [BarBoxed](#barboxed) + +data class that stores validated Number payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| BarBoxedNumber(Number data)
    Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| Number | data()
    validated payload | +| Any? | getData()
    validated payload | + +## Bar +class Bar
    +extends IntJsonSchema.IntJsonSchema1 + +A schema class that validates payloads + +| Methods Inherited from class org.openapijsonschematools.client.schemas.IntJsonSchema.IntJsonSchema1 | +| ------------------------------------------------------------------ | +| validate | +| validateAndBox | + +## Schema1Boxed +sealed interface Schema1Boxed
    +permits
    +[Schema1BoxedVoid](#schema1boxedvoid), +[Schema1BoxedBoolean](#schema1boxedboolean), +[Schema1BoxedNumber](#schema1boxednumber), +[Schema1BoxedString](#schema1boxedstring), +[Schema1BoxedList](#schema1boxedlist), +[Schema1BoxedMap](#schema1boxedmap) + +sealed interface that stores validated payloads using boxed classes + +## Schema1BoxedVoid +data class Schema1BoxedVoid
    +implements [Schema1Boxed](#schema1boxed) + +data class that stores validated null payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| Schema1BoxedVoid(Nothing? data)
    Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| Nothing? | data()
    validated payload | +| Any? | getData()
    validated payload | + +## Schema1BoxedBoolean +data class Schema1BoxedBoolean
    +implements [Schema1Boxed](#schema1boxed) + +record that stores validated boolean payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| Schema1BoxedBoolean(boolean data)
    Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| boolean | data()
    validated payload | +| Any? | getData()
    validated payload | + +## Schema1BoxedNumber +data class Schema1BoxedNumber
    +implements [Schema1Boxed](#schema1boxed) + +data class that stores validated Number payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| Schema1BoxedNumber(Number data)
    Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| Number | data()
    validated payload | +| Any? | getData()
    validated payload | + +## Schema1BoxedString +data class Schema1BoxedString
    +implements [Schema1Boxed](#schema1boxed) + +data class that stores validated String payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| Schema1BoxedString(String data)
    Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| String | data()
    validated payload | +| Any? | getData()
    validated payload | + +## Schema1BoxedList +data class Schema1BoxedList
    +implements [Schema1Boxed](#schema1boxed) + +data class that stores validated List payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| Schema1BoxedList(FrozenList data)
    Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| FrozenList | data()
    validated payload | +| Any? | getData()
    validated payload | + +## Schema1BoxedMap +data class Schema1BoxedMap
    +implements [Schema1Boxed](#schema1boxed) + +data class that stores validated Map payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| Schema1BoxedMap([Schema1Map](#schema1map) data)
    Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| [Schema1Map](#schema1map) | data()
    validated payload | +| Any? | getData()
    validated payload | + +## Schema1 +class Schema1
    +extends JsonSchema + +A schema class that validates payloads + +### Field Summary +| Modifier and Type | Field and Description | +| ----------------- | ---------------------- | +| Map> | properties = mapOf(
        "baz" to [Baz::class.java](#baz))
    )
    | +| Set | required = setOf(
        "baz"
    )
    | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| String | validate(arg: String, configuration: SchemaConfiguration) | +| Nothing? | validate(arg: Nothing?, configuration: SchemaConfiguration) | +| int | validate(arg: int, configuration: SchemaConfiguration) | +| long | validate(arg: long, configuration: SchemaConfiguration) | +| float | validate(arg: float, configuration: SchemaConfiguration) | +| double | validate(arg: double, configuration: SchemaConfiguration) | +| Number | validate(arg: Number, configuration: SchemaConfiguration) | +| boolean | validate(arg: boolean, configuration: SchemaConfiguration) | +| [Schema1Map](#schema1map) | validate(arg: [Map<?, ?>](#schema1mapbuilder), configuration: SchemaConfiguration) | +| FrozenList | validate(arg: List<*>, configuration: SchemaConfiguration) | +| [Schema1BoxedString](#schema1boxedstring) | validateAndBox(String, configuration: SchemaConfiguration) | +| [Schema1BoxedVoid](#schema1boxedvoid) | validateAndBox(Nothing?, configuration: SchemaConfiguration) | +| [Schema1BoxedNumber](#schema1boxednumber) | validateAndBox(Number, configuration: SchemaConfiguration) | +| [Schema1BoxedBoolean](#schema1boxedboolean) | validateAndBox(boolean, configuration: SchemaConfiguration) | +| [Schema1BoxedMap](#schema1boxedmap) | validateAndBox([Map<?, ?>](#schema1mapbuilder), configuration: SchemaConfiguration) | +| [Schema1BoxedList](#schema1boxedlist) | validateAndBox(List<*>, configuration: SchemaConfiguration) | +| [Schema1Boxed](#schema1boxed) | validateAndBox(Any?, configuration: SchemaConfiguration) | +| Any? | validate(arg: Any?, configuration: SchemaConfiguration) | + +## Schema1Map0Builder +class Schema1Map0Builder
    +builder for `Map` + +A class that builds the Map input type + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| Schema1Map0Builder(Map instance)
    Creates a builder that contains the passed instance | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| Map | build()
    Returns map input that should be used with Schema.validate | +| [Schema1Map0Builder](#schema1map0builder) | additionalProperty(key: String, value: Nothing?) | +| [Schema1Map0Builder](#schema1map0builder) | additionalProperty(key: String, value: Boolean) | +| [Schema1Map0Builder](#schema1map0builder) | additionalProperty(key: String, value: String) | +| [Schema1Map0Builder](#schema1map0builder) | additionalProperty(key: String, value: Int) | +| [Schema1Map0Builder](#schema1map0builder) | additionalProperty(key: String, value: Float) | +| [Schema1Map0Builder](#schema1map0builder) | additionalProperty(key: String, value: Long) | +| [Schema1Map0Builder](#schema1map0builder) | additionalProperty(key: String, value: Double) | +| [Schema1Map0Builder](#schema1map0builder) | additionalProperty(key: String, value: List) | +| [Schema1Map0Builder](#schema1map0builder) | additionalProperty(key: String, value: Map) | + +## Schema1MapBuilder +class Schema1MapBuilder
    +builder for `Map` + +A class that builds the Map input type + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| Schema1MapBuilder()
    Creates a builder that contains an empty map | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| [Schema1Map0Builder](#schema1map0builder) | baz(value: Nothing?) | + +## Schema1Map +class Schema1Map
    +extends FrozenMap + +A class to store validated Map payloads + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| static [Schema1Map](#schema1map) | of([Map](#schema1mapbuilder) arg, SchemaConfiguration configuration) | +| Nothing? | baz()
    | +| Any? | getAdditionalProperty(String name)
    provides type safety for additional properties | + +## BazBoxed +sealed interface BazBoxed
    +permits
    +[BazBoxedVoid](#bazboxedvoid) + +sealed interface that stores validated payloads using boxed classes + +## BazBoxedVoid +data class BazBoxedVoid
    +implements [BazBoxed](#bazboxed) + +data class that stores validated null payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| BazBoxedVoid(Nothing? data)
    Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| Nothing? | data()
    validated payload | +| Any? | getData()
    validated payload | + +## Baz +class Baz
    +extends NullJsonSchema.NullJsonSchema1 + +A schema class that validates payloads + +| Methods Inherited from class org.openapijsonschematools.client.schemas.NullJsonSchema.NullJsonSchema1 | +| ------------------------------------------------------------------ | +| validate | +| validateAndBox | + +## Schema0Boxed +sealed interface Schema0Boxed
    +permits
    +[Schema0BoxedVoid](#schema0boxedvoid), +[Schema0BoxedBoolean](#schema0boxedboolean), +[Schema0BoxedNumber](#schema0boxednumber), +[Schema0BoxedString](#schema0boxedstring), +[Schema0BoxedList](#schema0boxedlist), +[Schema0BoxedMap](#schema0boxedmap) + +sealed interface that stores validated payloads using boxed classes + +## Schema0BoxedVoid +data class Schema0BoxedVoid
    +implements [Schema0Boxed](#schema0boxed) + +data class that stores validated null payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| Schema0BoxedVoid(Nothing? data)
    Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| Nothing? | data()
    validated payload | +| Any? | getData()
    validated payload | + +## Schema0BoxedBoolean +data class Schema0BoxedBoolean
    +implements [Schema0Boxed](#schema0boxed) + +record that stores validated boolean payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| Schema0BoxedBoolean(boolean data)
    Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| boolean | data()
    validated payload | +| Any? | getData()
    validated payload | + +## Schema0BoxedNumber +data class Schema0BoxedNumber
    +implements [Schema0Boxed](#schema0boxed) + +data class that stores validated Number payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| Schema0BoxedNumber(Number data)
    Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| Number | data()
    validated payload | +| Any? | getData()
    validated payload | + +## Schema0BoxedString +data class Schema0BoxedString
    +implements [Schema0Boxed](#schema0boxed) + +data class that stores validated String payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| Schema0BoxedString(String data)
    Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| String | data()
    validated payload | +| Any? | getData()
    validated payload | + +## Schema0BoxedList +data class Schema0BoxedList
    +implements [Schema0Boxed](#schema0boxed) + +data class that stores validated List payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| Schema0BoxedList(FrozenList data)
    Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| FrozenList | data()
    validated payload | +| Any? | getData()
    validated payload | + +## Schema0BoxedMap +data class Schema0BoxedMap
    +implements [Schema0Boxed](#schema0boxed) + +data class that stores validated Map payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| Schema0BoxedMap([Schema0Map](#schema0map) data)
    Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| [Schema0Map](#schema0map) | data()
    validated payload | +| Any? | getData()
    validated payload | + +## Schema0 +class Schema0
    +extends JsonSchema + +A schema class that validates payloads + +### Field Summary +| Modifier and Type | Field and Description | +| ----------------- | ---------------------- | +| Map> | properties = mapOf(
        "foo" to [Foo::class.java](#foo))
    )
    | +| Set | required = setOf(
        "foo"
    )
    | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| String | validate(arg: String, configuration: SchemaConfiguration) | +| Nothing? | validate(arg: Nothing?, configuration: SchemaConfiguration) | +| int | validate(arg: int, configuration: SchemaConfiguration) | +| long | validate(arg: long, configuration: SchemaConfiguration) | +| float | validate(arg: float, configuration: SchemaConfiguration) | +| double | validate(arg: double, configuration: SchemaConfiguration) | +| Number | validate(arg: Number, configuration: SchemaConfiguration) | +| boolean | validate(arg: boolean, configuration: SchemaConfiguration) | +| [Schema0Map](#schema0map) | validate(arg: [Map<?, ?>](#schema0mapbuilder), configuration: SchemaConfiguration) | +| FrozenList | validate(arg: List<*>, configuration: SchemaConfiguration) | +| [Schema0BoxedString](#schema0boxedstring) | validateAndBox(String, configuration: SchemaConfiguration) | +| [Schema0BoxedVoid](#schema0boxedvoid) | validateAndBox(Nothing?, configuration: SchemaConfiguration) | +| [Schema0BoxedNumber](#schema0boxednumber) | validateAndBox(Number, configuration: SchemaConfiguration) | +| [Schema0BoxedBoolean](#schema0boxedboolean) | validateAndBox(boolean, configuration: SchemaConfiguration) | +| [Schema0BoxedMap](#schema0boxedmap) | validateAndBox([Map<?, ?>](#schema0mapbuilder), configuration: SchemaConfiguration) | +| [Schema0BoxedList](#schema0boxedlist) | validateAndBox(List<*>, configuration: SchemaConfiguration) | +| [Schema0Boxed](#schema0boxed) | validateAndBox(Any?, configuration: SchemaConfiguration) | +| Any? | validate(arg: Any?, configuration: SchemaConfiguration) | + +## Schema0Map0Builder +class Schema0Map0Builder
    +builder for `Map` + +A class that builds the Map input type + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| Schema0Map0Builder(Map instance)
    Creates a builder that contains the passed instance | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| Map | build()
    Returns map input that should be used with Schema.validate | +| [Schema0Map0Builder](#schema0map0builder) | additionalProperty(key: String, value: Nothing?) | +| [Schema0Map0Builder](#schema0map0builder) | additionalProperty(key: String, value: Boolean) | +| [Schema0Map0Builder](#schema0map0builder) | additionalProperty(key: String, value: String) | +| [Schema0Map0Builder](#schema0map0builder) | additionalProperty(key: String, value: Int) | +| [Schema0Map0Builder](#schema0map0builder) | additionalProperty(key: String, value: Float) | +| [Schema0Map0Builder](#schema0map0builder) | additionalProperty(key: String, value: Long) | +| [Schema0Map0Builder](#schema0map0builder) | additionalProperty(key: String, value: Double) | +| [Schema0Map0Builder](#schema0map0builder) | additionalProperty(key: String, value: List) | +| [Schema0Map0Builder](#schema0map0builder) | additionalProperty(key: String, value: Map) | + +## Schema0MapBuilder +class Schema0MapBuilder
    +builder for `Map` + +A class that builds the Map input type + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| Schema0MapBuilder()
    Creates a builder that contains an empty map | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| [Schema0Map0Builder](#schema0map0builder) | foo(value: String) | + +## Schema0Map +class Schema0Map
    +extends FrozenMap + +A class to store validated Map payloads + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| static [Schema0Map](#schema0map) | of([Map](#schema0mapbuilder) arg, SchemaConfiguration configuration) | +| String | foo()
    | +| Any? | getAdditionalProperty(String name)
    provides type safety for additional properties | + +## FooBoxed +sealed interface FooBoxed
    +permits
    +[FooBoxedString](#fooboxedstring) + +sealed interface that stores validated payloads using boxed classes + +## FooBoxedString +data class FooBoxedString
    +implements [FooBoxed](#fooboxed) + +data class that stores validated String payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| FooBoxedString(String data)
    Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| String | data()
    validated payload | +| Any? | getData()
    validated payload | + +## Foo +class Foo
    +extends StringJsonSchema.StringJsonSchema1 + +A schema class that validates payloads + +| Methods Inherited from class org.openapijsonschematools.client.schemas.StringJsonSchema.StringJsonSchema1 | +| ------------------------------------------------------------------ | +| validate | +| validateAndBox | + +[[Back to top]](#top) [[Back to Component Schemas]](../../../README.md#Component-Schemas) [[Back to README]](../../../README.md) diff --git a/samples/client/3_1_0_unit_test/kotlin/docs/components/schemas/AllofWithOneEmptySchema.md b/samples/client/3_1_0_unit_test/kotlin/docs/components/schemas/AllofWithOneEmptySchema.md new file mode 100644 index 00000000000..3a4586b5661 --- /dev/null +++ b/samples/client/3_1_0_unit_test/kotlin/docs/components/schemas/AllofWithOneEmptySchema.md @@ -0,0 +1,302 @@ +# AllofWithOneEmptySchema +org.openapijsonschematools.client.components.schemas.AllofWithOneEmptySchema.java +class AllofWithOneEmptySchema
    + +A class that contains necessary nested +- schema classes (which validate payloads), extends JsonSchema +- sealed interfaces which store validated payloads, Kotlin version of a sum type +- boxed classes which store validated payloads, sealed permits class implementations + +## Nested Class Summary +| Modifier and Type | Class and Description | +| ----------------- | ---------------------- | +| sealed interface | [AllofWithOneEmptySchema.AllofWithOneEmptySchema1Boxed](#allofwithoneemptyschema1boxed)
    sealed interface for validated payloads | +| record | [AllofWithOneEmptySchema.AllofWithOneEmptySchema1BoxedVoid](#allofwithoneemptyschema1boxedvoid)
    boxed class to store validated null payloads | +| record | [AllofWithOneEmptySchema.AllofWithOneEmptySchema1BoxedBoolean](#allofwithoneemptyschema1boxedboolean)
    boxed class to store validated boolean payloads | +| record | [AllofWithOneEmptySchema.AllofWithOneEmptySchema1BoxedNumber](#allofwithoneemptyschema1boxednumber)
    boxed class to store validated Number payloads | +| record | [AllofWithOneEmptySchema.AllofWithOneEmptySchema1BoxedString](#allofwithoneemptyschema1boxedstring)
    boxed class to store validated String payloads | +| record | [AllofWithOneEmptySchema.AllofWithOneEmptySchema1BoxedList](#allofwithoneemptyschema1boxedlist)
    boxed class to store validated List payloads | +| record | [AllofWithOneEmptySchema.AllofWithOneEmptySchema1BoxedMap](#allofwithoneemptyschema1boxedmap)
    boxed class to store validated Map payloads | +| static class | [AllofWithOneEmptySchema.AllofWithOneEmptySchema1](#allofwithoneemptyschema1)
    schema class | +| sealed interface | [AllofWithOneEmptySchema.Schema0Boxed](#schema0boxed)
    sealed interface for validated payloads | +| record | [AllofWithOneEmptySchema.Schema0BoxedVoid](#schema0boxedvoid)
    boxed class to store validated null payloads | +| record | [AllofWithOneEmptySchema.Schema0BoxedBoolean](#schema0boxedboolean)
    boxed class to store validated boolean payloads | +| record | [AllofWithOneEmptySchema.Schema0BoxedNumber](#schema0boxednumber)
    boxed class to store validated Number payloads | +| record | [AllofWithOneEmptySchema.Schema0BoxedString](#schema0boxedstring)
    boxed class to store validated String payloads | +| record | [AllofWithOneEmptySchema.Schema0BoxedList](#schema0boxedlist)
    boxed class to store validated List payloads | +| record | [AllofWithOneEmptySchema.Schema0BoxedMap](#schema0boxedmap)
    boxed class to store validated Map payloads | +| static class | [AllofWithOneEmptySchema.Schema0](#schema0)
    schema class | + +## AllofWithOneEmptySchema1Boxed +sealed interface AllofWithOneEmptySchema1Boxed
    +permits
    +[AllofWithOneEmptySchema1BoxedVoid](#allofwithoneemptyschema1boxedvoid), +[AllofWithOneEmptySchema1BoxedBoolean](#allofwithoneemptyschema1boxedboolean), +[AllofWithOneEmptySchema1BoxedNumber](#allofwithoneemptyschema1boxednumber), +[AllofWithOneEmptySchema1BoxedString](#allofwithoneemptyschema1boxedstring), +[AllofWithOneEmptySchema1BoxedList](#allofwithoneemptyschema1boxedlist), +[AllofWithOneEmptySchema1BoxedMap](#allofwithoneemptyschema1boxedmap) + +sealed interface that stores validated payloads using boxed classes + +## AllofWithOneEmptySchema1BoxedVoid +data class AllofWithOneEmptySchema1BoxedVoid
    +implements [AllofWithOneEmptySchema1Boxed](#allofwithoneemptyschema1boxed) + +data class that stores validated null payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| AllofWithOneEmptySchema1BoxedVoid(Nothing? data)
    Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| Nothing? | data()
    validated payload | +| Any? | getData()
    validated payload | + +## AllofWithOneEmptySchema1BoxedBoolean +data class AllofWithOneEmptySchema1BoxedBoolean
    +implements [AllofWithOneEmptySchema1Boxed](#allofwithoneemptyschema1boxed) + +record that stores validated boolean payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| AllofWithOneEmptySchema1BoxedBoolean(boolean data)
    Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| boolean | data()
    validated payload | +| Any? | getData()
    validated payload | + +## AllofWithOneEmptySchema1BoxedNumber +data class AllofWithOneEmptySchema1BoxedNumber
    +implements [AllofWithOneEmptySchema1Boxed](#allofwithoneemptyschema1boxed) + +data class that stores validated Number payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| AllofWithOneEmptySchema1BoxedNumber(Number data)
    Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| Number | data()
    validated payload | +| Any? | getData()
    validated payload | + +## AllofWithOneEmptySchema1BoxedString +data class AllofWithOneEmptySchema1BoxedString
    +implements [AllofWithOneEmptySchema1Boxed](#allofwithoneemptyschema1boxed) + +data class that stores validated String payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| AllofWithOneEmptySchema1BoxedString(String data)
    Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| String | data()
    validated payload | +| Any? | getData()
    validated payload | + +## AllofWithOneEmptySchema1BoxedList +data class AllofWithOneEmptySchema1BoxedList
    +implements [AllofWithOneEmptySchema1Boxed](#allofwithoneemptyschema1boxed) + +data class that stores validated List payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| AllofWithOneEmptySchema1BoxedList(FrozenList data)
    Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| FrozenList | data()
    validated payload | +| Any? | getData()
    validated payload | + +## AllofWithOneEmptySchema1BoxedMap +data class AllofWithOneEmptySchema1BoxedMap
    +implements [AllofWithOneEmptySchema1Boxed](#allofwithoneemptyschema1boxed) + +data class that stores validated Map payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| AllofWithOneEmptySchema1BoxedMap(FrozenMap data)
    Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| FrozenMap | data()
    validated payload | +| Any? | getData()
    validated payload | + +## AllofWithOneEmptySchema1 +class AllofWithOneEmptySchema1
    +extends JsonSchema + +A schema class that validates payloads + +### Field Summary +| Modifier and Type | Field and Description | +| ----------------- | ---------------------- | +| List> | allOf = listOf(
        [Schema0::class.java](#schema0)
    ;)
    | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| String | validate(arg: String, configuration: SchemaConfiguration) | +| Nothing? | validate(arg: Nothing?, configuration: SchemaConfiguration) | +| int | validate(arg: int, configuration: SchemaConfiguration) | +| long | validate(arg: long, configuration: SchemaConfiguration) | +| float | validate(arg: float, configuration: SchemaConfiguration) | +| double | validate(arg: double, configuration: SchemaConfiguration) | +| Number | validate(arg: Number, configuration: SchemaConfiguration) | +| boolean | validate(arg: boolean, configuration: SchemaConfiguration) | +| FrozenMap | validate(arg: Map<?, ?>, configuration: SchemaConfiguration) | +| FrozenList | validate(arg: List<*>, configuration: SchemaConfiguration) | +| [AllofWithOneEmptySchema1BoxedString](#allofwithoneemptyschema1boxedstring) | validateAndBox(String, configuration: SchemaConfiguration) | +| [AllofWithOneEmptySchema1BoxedVoid](#allofwithoneemptyschema1boxedvoid) | validateAndBox(Nothing?, configuration: SchemaConfiguration) | +| [AllofWithOneEmptySchema1BoxedNumber](#allofwithoneemptyschema1boxednumber) | validateAndBox(Number, configuration: SchemaConfiguration) | +| [AllofWithOneEmptySchema1BoxedBoolean](#allofwithoneemptyschema1boxedboolean) | validateAndBox(boolean, configuration: SchemaConfiguration) | +| [AllofWithOneEmptySchema1BoxedMap](#allofwithoneemptyschema1boxedmap) | validateAndBox(Map<?, ?>, configuration: SchemaConfiguration) | +| [AllofWithOneEmptySchema1BoxedList](#allofwithoneemptyschema1boxedlist) | validateAndBox(List<*>, configuration: SchemaConfiguration) | +| [AllofWithOneEmptySchema1Boxed](#allofwithoneemptyschema1boxed) | validateAndBox(Any?, configuration: SchemaConfiguration) | +| Any? | validate(arg: Any?, configuration: SchemaConfiguration) | + +## Schema0Boxed +sealed interface Schema0Boxed
    +permits
    +[Schema0BoxedVoid](#schema0boxedvoid), +[Schema0BoxedBoolean](#schema0boxedboolean), +[Schema0BoxedNumber](#schema0boxednumber), +[Schema0BoxedString](#schema0boxedstring), +[Schema0BoxedList](#schema0boxedlist), +[Schema0BoxedMap](#schema0boxedmap) + +sealed interface that stores validated payloads using boxed classes + +## Schema0BoxedVoid +data class Schema0BoxedVoid
    +implements [Schema0Boxed](#schema0boxed) + +data class that stores validated null payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| Schema0BoxedVoid(Nothing? data)
    Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| Nothing? | data()
    validated payload | +| Any? | getData()
    validated payload | + +## Schema0BoxedBoolean +data class Schema0BoxedBoolean
    +implements [Schema0Boxed](#schema0boxed) + +record that stores validated boolean payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| Schema0BoxedBoolean(boolean data)
    Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| boolean | data()
    validated payload | +| Any? | getData()
    validated payload | + +## Schema0BoxedNumber +data class Schema0BoxedNumber
    +implements [Schema0Boxed](#schema0boxed) + +data class that stores validated Number payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| Schema0BoxedNumber(Number data)
    Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| Number | data()
    validated payload | +| Any? | getData()
    validated payload | + +## Schema0BoxedString +data class Schema0BoxedString
    +implements [Schema0Boxed](#schema0boxed) + +data class that stores validated String payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| Schema0BoxedString(String data)
    Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| String | data()
    validated payload | +| Any? | getData()
    validated payload | + +## Schema0BoxedList +data class Schema0BoxedList
    +implements [Schema0Boxed](#schema0boxed) + +data class that stores validated List payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| Schema0BoxedList(FrozenList data)
    Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| FrozenList | data()
    validated payload | +| Any? | getData()
    validated payload | + +## Schema0BoxedMap +data class Schema0BoxedMap
    +implements [Schema0Boxed](#schema0boxed) + +data class that stores validated Map payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| Schema0BoxedMap(FrozenMap data)
    Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| FrozenMap | data()
    validated payload | +| Any? | getData()
    validated payload | + +## Schema0 +class Schema0
    +extends AnyTypeJsonSchema.AnyTypeJsonSchema1 + +A schema class that validates payloads + +| Methods Inherited from class org.openapijsonschematools.client.schemas.AnyTypeJsonSchema.AnyTypeJsonSchema1 | +| ------------------------------------------------------------------ | +| validate | +| validateAndBox | + +[[Back to top]](#top) [[Back to Component Schemas]](../../../README.md#Component-Schemas) [[Back to README]](../../../README.md) diff --git a/samples/client/3_1_0_unit_test/kotlin/docs/components/schemas/AllofWithTheFirstEmptySchema.md b/samples/client/3_1_0_unit_test/kotlin/docs/components/schemas/AllofWithTheFirstEmptySchema.md new file mode 100644 index 00000000000..9e14a960664 --- /dev/null +++ b/samples/client/3_1_0_unit_test/kotlin/docs/components/schemas/AllofWithTheFirstEmptySchema.md @@ -0,0 +1,340 @@ +# AllofWithTheFirstEmptySchema +org.openapijsonschematools.client.components.schemas.AllofWithTheFirstEmptySchema.java +class AllofWithTheFirstEmptySchema
    + +A class that contains necessary nested +- schema classes (which validate payloads), extends JsonSchema +- sealed interfaces which store validated payloads, Kotlin version of a sum type +- boxed classes which store validated payloads, sealed permits class implementations + +## Nested Class Summary +| Modifier and Type | Class and Description | +| ----------------- | ---------------------- | +| sealed interface | [AllofWithTheFirstEmptySchema.AllofWithTheFirstEmptySchema1Boxed](#allofwiththefirstemptyschema1boxed)
    sealed interface for validated payloads | +| record | [AllofWithTheFirstEmptySchema.AllofWithTheFirstEmptySchema1BoxedVoid](#allofwiththefirstemptyschema1boxedvoid)
    boxed class to store validated null payloads | +| record | [AllofWithTheFirstEmptySchema.AllofWithTheFirstEmptySchema1BoxedBoolean](#allofwiththefirstemptyschema1boxedboolean)
    boxed class to store validated boolean payloads | +| record | [AllofWithTheFirstEmptySchema.AllofWithTheFirstEmptySchema1BoxedNumber](#allofwiththefirstemptyschema1boxednumber)
    boxed class to store validated Number payloads | +| record | [AllofWithTheFirstEmptySchema.AllofWithTheFirstEmptySchema1BoxedString](#allofwiththefirstemptyschema1boxedstring)
    boxed class to store validated String payloads | +| record | [AllofWithTheFirstEmptySchema.AllofWithTheFirstEmptySchema1BoxedList](#allofwiththefirstemptyschema1boxedlist)
    boxed class to store validated List payloads | +| record | [AllofWithTheFirstEmptySchema.AllofWithTheFirstEmptySchema1BoxedMap](#allofwiththefirstemptyschema1boxedmap)
    boxed class to store validated Map payloads | +| static class | [AllofWithTheFirstEmptySchema.AllofWithTheFirstEmptySchema1](#allofwiththefirstemptyschema1)
    schema class | +| sealed interface | [AllofWithTheFirstEmptySchema.Schema1Boxed](#schema1boxed)
    sealed interface for validated payloads | +| record | [AllofWithTheFirstEmptySchema.Schema1BoxedNumber](#schema1boxednumber)
    boxed class to store validated Number payloads | +| static class | [AllofWithTheFirstEmptySchema.Schema1](#schema1)
    schema class | +| sealed interface | [AllofWithTheFirstEmptySchema.Schema0Boxed](#schema0boxed)
    sealed interface for validated payloads | +| record | [AllofWithTheFirstEmptySchema.Schema0BoxedVoid](#schema0boxedvoid)
    boxed class to store validated null payloads | +| record | [AllofWithTheFirstEmptySchema.Schema0BoxedBoolean](#schema0boxedboolean)
    boxed class to store validated boolean payloads | +| record | [AllofWithTheFirstEmptySchema.Schema0BoxedNumber](#schema0boxednumber)
    boxed class to store validated Number payloads | +| record | [AllofWithTheFirstEmptySchema.Schema0BoxedString](#schema0boxedstring)
    boxed class to store validated String payloads | +| record | [AllofWithTheFirstEmptySchema.Schema0BoxedList](#schema0boxedlist)
    boxed class to store validated List payloads | +| record | [AllofWithTheFirstEmptySchema.Schema0BoxedMap](#schema0boxedmap)
    boxed class to store validated Map payloads | +| static class | [AllofWithTheFirstEmptySchema.Schema0](#schema0)
    schema class | + +## AllofWithTheFirstEmptySchema1Boxed +sealed interface AllofWithTheFirstEmptySchema1Boxed
    +permits
    +[AllofWithTheFirstEmptySchema1BoxedVoid](#allofwiththefirstemptyschema1boxedvoid), +[AllofWithTheFirstEmptySchema1BoxedBoolean](#allofwiththefirstemptyschema1boxedboolean), +[AllofWithTheFirstEmptySchema1BoxedNumber](#allofwiththefirstemptyschema1boxednumber), +[AllofWithTheFirstEmptySchema1BoxedString](#allofwiththefirstemptyschema1boxedstring), +[AllofWithTheFirstEmptySchema1BoxedList](#allofwiththefirstemptyschema1boxedlist), +[AllofWithTheFirstEmptySchema1BoxedMap](#allofwiththefirstemptyschema1boxedmap) + +sealed interface that stores validated payloads using boxed classes + +## AllofWithTheFirstEmptySchema1BoxedVoid +data class AllofWithTheFirstEmptySchema1BoxedVoid
    +implements [AllofWithTheFirstEmptySchema1Boxed](#allofwiththefirstemptyschema1boxed) + +data class that stores validated null payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| AllofWithTheFirstEmptySchema1BoxedVoid(Nothing? data)
    Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| Nothing? | data()
    validated payload | +| Any? | getData()
    validated payload | + +## AllofWithTheFirstEmptySchema1BoxedBoolean +data class AllofWithTheFirstEmptySchema1BoxedBoolean
    +implements [AllofWithTheFirstEmptySchema1Boxed](#allofwiththefirstemptyschema1boxed) + +record that stores validated boolean payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| AllofWithTheFirstEmptySchema1BoxedBoolean(boolean data)
    Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| boolean | data()
    validated payload | +| Any? | getData()
    validated payload | + +## AllofWithTheFirstEmptySchema1BoxedNumber +data class AllofWithTheFirstEmptySchema1BoxedNumber
    +implements [AllofWithTheFirstEmptySchema1Boxed](#allofwiththefirstemptyschema1boxed) + +data class that stores validated Number payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| AllofWithTheFirstEmptySchema1BoxedNumber(Number data)
    Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| Number | data()
    validated payload | +| Any? | getData()
    validated payload | + +## AllofWithTheFirstEmptySchema1BoxedString +data class AllofWithTheFirstEmptySchema1BoxedString
    +implements [AllofWithTheFirstEmptySchema1Boxed](#allofwiththefirstemptyschema1boxed) + +data class that stores validated String payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| AllofWithTheFirstEmptySchema1BoxedString(String data)
    Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| String | data()
    validated payload | +| Any? | getData()
    validated payload | + +## AllofWithTheFirstEmptySchema1BoxedList +data class AllofWithTheFirstEmptySchema1BoxedList
    +implements [AllofWithTheFirstEmptySchema1Boxed](#allofwiththefirstemptyschema1boxed) + +data class that stores validated List payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| AllofWithTheFirstEmptySchema1BoxedList(FrozenList data)
    Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| FrozenList | data()
    validated payload | +| Any? | getData()
    validated payload | + +## AllofWithTheFirstEmptySchema1BoxedMap +data class AllofWithTheFirstEmptySchema1BoxedMap
    +implements [AllofWithTheFirstEmptySchema1Boxed](#allofwiththefirstemptyschema1boxed) + +data class that stores validated Map payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| AllofWithTheFirstEmptySchema1BoxedMap(FrozenMap data)
    Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| FrozenMap | data()
    validated payload | +| Any? | getData()
    validated payload | + +## AllofWithTheFirstEmptySchema1 +class AllofWithTheFirstEmptySchema1
    +extends JsonSchema + +A schema class that validates payloads + +### Field Summary +| Modifier and Type | Field and Description | +| ----------------- | ---------------------- | +| List> | allOf = listOf(
        [Schema0::class.java](#schema0),
        [Schema1::class.java](#schema1)
    ;)
    | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| String | validate(arg: String, configuration: SchemaConfiguration) | +| Nothing? | validate(arg: Nothing?, configuration: SchemaConfiguration) | +| int | validate(arg: int, configuration: SchemaConfiguration) | +| long | validate(arg: long, configuration: SchemaConfiguration) | +| float | validate(arg: float, configuration: SchemaConfiguration) | +| double | validate(arg: double, configuration: SchemaConfiguration) | +| Number | validate(arg: Number, configuration: SchemaConfiguration) | +| boolean | validate(arg: boolean, configuration: SchemaConfiguration) | +| FrozenMap | validate(arg: Map<?, ?>, configuration: SchemaConfiguration) | +| FrozenList | validate(arg: List<*>, configuration: SchemaConfiguration) | +| [AllofWithTheFirstEmptySchema1BoxedString](#allofwiththefirstemptyschema1boxedstring) | validateAndBox(String, configuration: SchemaConfiguration) | +| [AllofWithTheFirstEmptySchema1BoxedVoid](#allofwiththefirstemptyschema1boxedvoid) | validateAndBox(Nothing?, configuration: SchemaConfiguration) | +| [AllofWithTheFirstEmptySchema1BoxedNumber](#allofwiththefirstemptyschema1boxednumber) | validateAndBox(Number, configuration: SchemaConfiguration) | +| [AllofWithTheFirstEmptySchema1BoxedBoolean](#allofwiththefirstemptyschema1boxedboolean) | validateAndBox(boolean, configuration: SchemaConfiguration) | +| [AllofWithTheFirstEmptySchema1BoxedMap](#allofwiththefirstemptyschema1boxedmap) | validateAndBox(Map<?, ?>, configuration: SchemaConfiguration) | +| [AllofWithTheFirstEmptySchema1BoxedList](#allofwiththefirstemptyschema1boxedlist) | validateAndBox(List<*>, configuration: SchemaConfiguration) | +| [AllofWithTheFirstEmptySchema1Boxed](#allofwiththefirstemptyschema1boxed) | validateAndBox(Any?, configuration: SchemaConfiguration) | +| Any? | validate(arg: Any?, configuration: SchemaConfiguration) | + +## Schema1Boxed +sealed interface Schema1Boxed
    +permits
    +[Schema1BoxedNumber](#schema1boxednumber) + +sealed interface that stores validated payloads using boxed classes + +## Schema1BoxedNumber +data class Schema1BoxedNumber
    +implements [Schema1Boxed](#schema1boxed) + +data class that stores validated Number payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| Schema1BoxedNumber(Number data)
    Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| Number | data()
    validated payload | +| Any? | getData()
    validated payload | + +## Schema1 +class Schema1
    +extends NumberJsonSchema.NumberJsonSchema1 + +A schema class that validates payloads + +| Methods Inherited from class org.openapijsonschematools.client.schemas.NumberJsonSchema.NumberJsonSchema1 | +| ------------------------------------------------------------------ | +| validate | +| validateAndBox | + +## Schema0Boxed +sealed interface Schema0Boxed
    +permits
    +[Schema0BoxedVoid](#schema0boxedvoid), +[Schema0BoxedBoolean](#schema0boxedboolean), +[Schema0BoxedNumber](#schema0boxednumber), +[Schema0BoxedString](#schema0boxedstring), +[Schema0BoxedList](#schema0boxedlist), +[Schema0BoxedMap](#schema0boxedmap) + +sealed interface that stores validated payloads using boxed classes + +## Schema0BoxedVoid +data class Schema0BoxedVoid
    +implements [Schema0Boxed](#schema0boxed) + +data class that stores validated null payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| Schema0BoxedVoid(Nothing? data)
    Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| Nothing? | data()
    validated payload | +| Any? | getData()
    validated payload | + +## Schema0BoxedBoolean +data class Schema0BoxedBoolean
    +implements [Schema0Boxed](#schema0boxed) + +record that stores validated boolean payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| Schema0BoxedBoolean(boolean data)
    Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| boolean | data()
    validated payload | +| Any? | getData()
    validated payload | + +## Schema0BoxedNumber +data class Schema0BoxedNumber
    +implements [Schema0Boxed](#schema0boxed) + +data class that stores validated Number payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| Schema0BoxedNumber(Number data)
    Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| Number | data()
    validated payload | +| Any? | getData()
    validated payload | + +## Schema0BoxedString +data class Schema0BoxedString
    +implements [Schema0Boxed](#schema0boxed) + +data class that stores validated String payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| Schema0BoxedString(String data)
    Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| String | data()
    validated payload | +| Any? | getData()
    validated payload | + +## Schema0BoxedList +data class Schema0BoxedList
    +implements [Schema0Boxed](#schema0boxed) + +data class that stores validated List payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| Schema0BoxedList(FrozenList data)
    Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| FrozenList | data()
    validated payload | +| Any? | getData()
    validated payload | + +## Schema0BoxedMap +data class Schema0BoxedMap
    +implements [Schema0Boxed](#schema0boxed) + +data class that stores validated Map payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| Schema0BoxedMap(FrozenMap data)
    Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| FrozenMap | data()
    validated payload | +| Any? | getData()
    validated payload | + +## Schema0 +class Schema0
    +extends AnyTypeJsonSchema.AnyTypeJsonSchema1 + +A schema class that validates payloads + +| Methods Inherited from class org.openapijsonschematools.client.schemas.AnyTypeJsonSchema.AnyTypeJsonSchema1 | +| ------------------------------------------------------------------ | +| validate | +| validateAndBox | + +[[Back to top]](#top) [[Back to Component Schemas]](../../../README.md#Component-Schemas) [[Back to README]](../../../README.md) diff --git a/samples/client/3_1_0_unit_test/kotlin/docs/components/schemas/AllofWithTheLastEmptySchema.md b/samples/client/3_1_0_unit_test/kotlin/docs/components/schemas/AllofWithTheLastEmptySchema.md new file mode 100644 index 00000000000..b67c14c1c5a --- /dev/null +++ b/samples/client/3_1_0_unit_test/kotlin/docs/components/schemas/AllofWithTheLastEmptySchema.md @@ -0,0 +1,340 @@ +# AllofWithTheLastEmptySchema +org.openapijsonschematools.client.components.schemas.AllofWithTheLastEmptySchema.java +class AllofWithTheLastEmptySchema
    + +A class that contains necessary nested +- schema classes (which validate payloads), extends JsonSchema +- sealed interfaces which store validated payloads, Kotlin version of a sum type +- boxed classes which store validated payloads, sealed permits class implementations + +## Nested Class Summary +| Modifier and Type | Class and Description | +| ----------------- | ---------------------- | +| sealed interface | [AllofWithTheLastEmptySchema.AllofWithTheLastEmptySchema1Boxed](#allofwiththelastemptyschema1boxed)
    sealed interface for validated payloads | +| record | [AllofWithTheLastEmptySchema.AllofWithTheLastEmptySchema1BoxedVoid](#allofwiththelastemptyschema1boxedvoid)
    boxed class to store validated null payloads | +| record | [AllofWithTheLastEmptySchema.AllofWithTheLastEmptySchema1BoxedBoolean](#allofwiththelastemptyschema1boxedboolean)
    boxed class to store validated boolean payloads | +| record | [AllofWithTheLastEmptySchema.AllofWithTheLastEmptySchema1BoxedNumber](#allofwiththelastemptyschema1boxednumber)
    boxed class to store validated Number payloads | +| record | [AllofWithTheLastEmptySchema.AllofWithTheLastEmptySchema1BoxedString](#allofwiththelastemptyschema1boxedstring)
    boxed class to store validated String payloads | +| record | [AllofWithTheLastEmptySchema.AllofWithTheLastEmptySchema1BoxedList](#allofwiththelastemptyschema1boxedlist)
    boxed class to store validated List payloads | +| record | [AllofWithTheLastEmptySchema.AllofWithTheLastEmptySchema1BoxedMap](#allofwiththelastemptyschema1boxedmap)
    boxed class to store validated Map payloads | +| static class | [AllofWithTheLastEmptySchema.AllofWithTheLastEmptySchema1](#allofwiththelastemptyschema1)
    schema class | +| sealed interface | [AllofWithTheLastEmptySchema.Schema1Boxed](#schema1boxed)
    sealed interface for validated payloads | +| record | [AllofWithTheLastEmptySchema.Schema1BoxedVoid](#schema1boxedvoid)
    boxed class to store validated null payloads | +| record | [AllofWithTheLastEmptySchema.Schema1BoxedBoolean](#schema1boxedboolean)
    boxed class to store validated boolean payloads | +| record | [AllofWithTheLastEmptySchema.Schema1BoxedNumber](#schema1boxednumber)
    boxed class to store validated Number payloads | +| record | [AllofWithTheLastEmptySchema.Schema1BoxedString](#schema1boxedstring)
    boxed class to store validated String payloads | +| record | [AllofWithTheLastEmptySchema.Schema1BoxedList](#schema1boxedlist)
    boxed class to store validated List payloads | +| record | [AllofWithTheLastEmptySchema.Schema1BoxedMap](#schema1boxedmap)
    boxed class to store validated Map payloads | +| static class | [AllofWithTheLastEmptySchema.Schema1](#schema1)
    schema class | +| sealed interface | [AllofWithTheLastEmptySchema.Schema0Boxed](#schema0boxed)
    sealed interface for validated payloads | +| record | [AllofWithTheLastEmptySchema.Schema0BoxedNumber](#schema0boxednumber)
    boxed class to store validated Number payloads | +| static class | [AllofWithTheLastEmptySchema.Schema0](#schema0)
    schema class | + +## AllofWithTheLastEmptySchema1Boxed +sealed interface AllofWithTheLastEmptySchema1Boxed
    +permits
    +[AllofWithTheLastEmptySchema1BoxedVoid](#allofwiththelastemptyschema1boxedvoid), +[AllofWithTheLastEmptySchema1BoxedBoolean](#allofwiththelastemptyschema1boxedboolean), +[AllofWithTheLastEmptySchema1BoxedNumber](#allofwiththelastemptyschema1boxednumber), +[AllofWithTheLastEmptySchema1BoxedString](#allofwiththelastemptyschema1boxedstring), +[AllofWithTheLastEmptySchema1BoxedList](#allofwiththelastemptyschema1boxedlist), +[AllofWithTheLastEmptySchema1BoxedMap](#allofwiththelastemptyschema1boxedmap) + +sealed interface that stores validated payloads using boxed classes + +## AllofWithTheLastEmptySchema1BoxedVoid +data class AllofWithTheLastEmptySchema1BoxedVoid
    +implements [AllofWithTheLastEmptySchema1Boxed](#allofwiththelastemptyschema1boxed) + +data class that stores validated null payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| AllofWithTheLastEmptySchema1BoxedVoid(Nothing? data)
    Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| Nothing? | data()
    validated payload | +| Any? | getData()
    validated payload | + +## AllofWithTheLastEmptySchema1BoxedBoolean +data class AllofWithTheLastEmptySchema1BoxedBoolean
    +implements [AllofWithTheLastEmptySchema1Boxed](#allofwiththelastemptyschema1boxed) + +record that stores validated boolean payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| AllofWithTheLastEmptySchema1BoxedBoolean(boolean data)
    Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| boolean | data()
    validated payload | +| Any? | getData()
    validated payload | + +## AllofWithTheLastEmptySchema1BoxedNumber +data class AllofWithTheLastEmptySchema1BoxedNumber
    +implements [AllofWithTheLastEmptySchema1Boxed](#allofwiththelastemptyschema1boxed) + +data class that stores validated Number payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| AllofWithTheLastEmptySchema1BoxedNumber(Number data)
    Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| Number | data()
    validated payload | +| Any? | getData()
    validated payload | + +## AllofWithTheLastEmptySchema1BoxedString +data class AllofWithTheLastEmptySchema1BoxedString
    +implements [AllofWithTheLastEmptySchema1Boxed](#allofwiththelastemptyschema1boxed) + +data class that stores validated String payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| AllofWithTheLastEmptySchema1BoxedString(String data)
    Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| String | data()
    validated payload | +| Any? | getData()
    validated payload | + +## AllofWithTheLastEmptySchema1BoxedList +data class AllofWithTheLastEmptySchema1BoxedList
    +implements [AllofWithTheLastEmptySchema1Boxed](#allofwiththelastemptyschema1boxed) + +data class that stores validated List payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| AllofWithTheLastEmptySchema1BoxedList(FrozenList data)
    Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| FrozenList | data()
    validated payload | +| Any? | getData()
    validated payload | + +## AllofWithTheLastEmptySchema1BoxedMap +data class AllofWithTheLastEmptySchema1BoxedMap
    +implements [AllofWithTheLastEmptySchema1Boxed](#allofwiththelastemptyschema1boxed) + +data class that stores validated Map payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| AllofWithTheLastEmptySchema1BoxedMap(FrozenMap data)
    Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| FrozenMap | data()
    validated payload | +| Any? | getData()
    validated payload | + +## AllofWithTheLastEmptySchema1 +class AllofWithTheLastEmptySchema1
    +extends JsonSchema + +A schema class that validates payloads + +### Field Summary +| Modifier and Type | Field and Description | +| ----------------- | ---------------------- | +| List> | allOf = listOf(
        [Schema0::class.java](#schema0),
        [Schema1::class.java](#schema1)
    ;)
    | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| String | validate(arg: String, configuration: SchemaConfiguration) | +| Nothing? | validate(arg: Nothing?, configuration: SchemaConfiguration) | +| int | validate(arg: int, configuration: SchemaConfiguration) | +| long | validate(arg: long, configuration: SchemaConfiguration) | +| float | validate(arg: float, configuration: SchemaConfiguration) | +| double | validate(arg: double, configuration: SchemaConfiguration) | +| Number | validate(arg: Number, configuration: SchemaConfiguration) | +| boolean | validate(arg: boolean, configuration: SchemaConfiguration) | +| FrozenMap | validate(arg: Map<?, ?>, configuration: SchemaConfiguration) | +| FrozenList | validate(arg: List<*>, configuration: SchemaConfiguration) | +| [AllofWithTheLastEmptySchema1BoxedString](#allofwiththelastemptyschema1boxedstring) | validateAndBox(String, configuration: SchemaConfiguration) | +| [AllofWithTheLastEmptySchema1BoxedVoid](#allofwiththelastemptyschema1boxedvoid) | validateAndBox(Nothing?, configuration: SchemaConfiguration) | +| [AllofWithTheLastEmptySchema1BoxedNumber](#allofwiththelastemptyschema1boxednumber) | validateAndBox(Number, configuration: SchemaConfiguration) | +| [AllofWithTheLastEmptySchema1BoxedBoolean](#allofwiththelastemptyschema1boxedboolean) | validateAndBox(boolean, configuration: SchemaConfiguration) | +| [AllofWithTheLastEmptySchema1BoxedMap](#allofwiththelastemptyschema1boxedmap) | validateAndBox(Map<?, ?>, configuration: SchemaConfiguration) | +| [AllofWithTheLastEmptySchema1BoxedList](#allofwiththelastemptyschema1boxedlist) | validateAndBox(List<*>, configuration: SchemaConfiguration) | +| [AllofWithTheLastEmptySchema1Boxed](#allofwiththelastemptyschema1boxed) | validateAndBox(Any?, configuration: SchemaConfiguration) | +| Any? | validate(arg: Any?, configuration: SchemaConfiguration) | + +## Schema1Boxed +sealed interface Schema1Boxed
    +permits
    +[Schema1BoxedVoid](#schema1boxedvoid), +[Schema1BoxedBoolean](#schema1boxedboolean), +[Schema1BoxedNumber](#schema1boxednumber), +[Schema1BoxedString](#schema1boxedstring), +[Schema1BoxedList](#schema1boxedlist), +[Schema1BoxedMap](#schema1boxedmap) + +sealed interface that stores validated payloads using boxed classes + +## Schema1BoxedVoid +data class Schema1BoxedVoid
    +implements [Schema1Boxed](#schema1boxed) + +data class that stores validated null payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| Schema1BoxedVoid(Nothing? data)
    Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| Nothing? | data()
    validated payload | +| Any? | getData()
    validated payload | + +## Schema1BoxedBoolean +data class Schema1BoxedBoolean
    +implements [Schema1Boxed](#schema1boxed) + +record that stores validated boolean payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| Schema1BoxedBoolean(boolean data)
    Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| boolean | data()
    validated payload | +| Any? | getData()
    validated payload | + +## Schema1BoxedNumber +data class Schema1BoxedNumber
    +implements [Schema1Boxed](#schema1boxed) + +data class that stores validated Number payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| Schema1BoxedNumber(Number data)
    Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| Number | data()
    validated payload | +| Any? | getData()
    validated payload | + +## Schema1BoxedString +data class Schema1BoxedString
    +implements [Schema1Boxed](#schema1boxed) + +data class that stores validated String payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| Schema1BoxedString(String data)
    Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| String | data()
    validated payload | +| Any? | getData()
    validated payload | + +## Schema1BoxedList +data class Schema1BoxedList
    +implements [Schema1Boxed](#schema1boxed) + +data class that stores validated List payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| Schema1BoxedList(FrozenList data)
    Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| FrozenList | data()
    validated payload | +| Any? | getData()
    validated payload | + +## Schema1BoxedMap +data class Schema1BoxedMap
    +implements [Schema1Boxed](#schema1boxed) + +data class that stores validated Map payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| Schema1BoxedMap(FrozenMap data)
    Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| FrozenMap | data()
    validated payload | +| Any? | getData()
    validated payload | + +## Schema1 +class Schema1
    +extends AnyTypeJsonSchema.AnyTypeJsonSchema1 + +A schema class that validates payloads + +| Methods Inherited from class org.openapijsonschematools.client.schemas.AnyTypeJsonSchema.AnyTypeJsonSchema1 | +| ------------------------------------------------------------------ | +| validate | +| validateAndBox | + +## Schema0Boxed +sealed interface Schema0Boxed
    +permits
    +[Schema0BoxedNumber](#schema0boxednumber) + +sealed interface that stores validated payloads using boxed classes + +## Schema0BoxedNumber +data class Schema0BoxedNumber
    +implements [Schema0Boxed](#schema0boxed) + +data class that stores validated Number payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| Schema0BoxedNumber(Number data)
    Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| Number | data()
    validated payload | +| Any? | getData()
    validated payload | + +## Schema0 +class Schema0
    +extends NumberJsonSchema.NumberJsonSchema1 + +A schema class that validates payloads + +| Methods Inherited from class org.openapijsonschematools.client.schemas.NumberJsonSchema.NumberJsonSchema1 | +| ------------------------------------------------------------------ | +| validate | +| validateAndBox | + +[[Back to top]](#top) [[Back to Component Schemas]](../../../README.md#Component-Schemas) [[Back to README]](../../../README.md) diff --git a/samples/client/3_1_0_unit_test/kotlin/docs/components/schemas/AllofWithTwoEmptySchemas.md b/samples/client/3_1_0_unit_test/kotlin/docs/components/schemas/AllofWithTwoEmptySchemas.md new file mode 100644 index 00000000000..18791b95b8d --- /dev/null +++ b/samples/client/3_1_0_unit_test/kotlin/docs/components/schemas/AllofWithTwoEmptySchemas.md @@ -0,0 +1,435 @@ +# AllofWithTwoEmptySchemas +org.openapijsonschematools.client.components.schemas.AllofWithTwoEmptySchemas.java +class AllofWithTwoEmptySchemas
    + +A class that contains necessary nested +- schema classes (which validate payloads), extends JsonSchema +- sealed interfaces which store validated payloads, Kotlin version of a sum type +- boxed classes which store validated payloads, sealed permits class implementations + +## Nested Class Summary +| Modifier and Type | Class and Description | +| ----------------- | ---------------------- | +| sealed interface | [AllofWithTwoEmptySchemas.AllofWithTwoEmptySchemas1Boxed](#allofwithtwoemptyschemas1boxed)
    sealed interface for validated payloads | +| record | [AllofWithTwoEmptySchemas.AllofWithTwoEmptySchemas1BoxedVoid](#allofwithtwoemptyschemas1boxedvoid)
    boxed class to store validated null payloads | +| record | [AllofWithTwoEmptySchemas.AllofWithTwoEmptySchemas1BoxedBoolean](#allofwithtwoemptyschemas1boxedboolean)
    boxed class to store validated boolean payloads | +| record | [AllofWithTwoEmptySchemas.AllofWithTwoEmptySchemas1BoxedNumber](#allofwithtwoemptyschemas1boxednumber)
    boxed class to store validated Number payloads | +| record | [AllofWithTwoEmptySchemas.AllofWithTwoEmptySchemas1BoxedString](#allofwithtwoemptyschemas1boxedstring)
    boxed class to store validated String payloads | +| record | [AllofWithTwoEmptySchemas.AllofWithTwoEmptySchemas1BoxedList](#allofwithtwoemptyschemas1boxedlist)
    boxed class to store validated List payloads | +| record | [AllofWithTwoEmptySchemas.AllofWithTwoEmptySchemas1BoxedMap](#allofwithtwoemptyschemas1boxedmap)
    boxed class to store validated Map payloads | +| static class | [AllofWithTwoEmptySchemas.AllofWithTwoEmptySchemas1](#allofwithtwoemptyschemas1)
    schema class | +| sealed interface | [AllofWithTwoEmptySchemas.Schema1Boxed](#schema1boxed)
    sealed interface for validated payloads | +| record | [AllofWithTwoEmptySchemas.Schema1BoxedVoid](#schema1boxedvoid)
    boxed class to store validated null payloads | +| record | [AllofWithTwoEmptySchemas.Schema1BoxedBoolean](#schema1boxedboolean)
    boxed class to store validated boolean payloads | +| record | [AllofWithTwoEmptySchemas.Schema1BoxedNumber](#schema1boxednumber)
    boxed class to store validated Number payloads | +| record | [AllofWithTwoEmptySchemas.Schema1BoxedString](#schema1boxedstring)
    boxed class to store validated String payloads | +| record | [AllofWithTwoEmptySchemas.Schema1BoxedList](#schema1boxedlist)
    boxed class to store validated List payloads | +| record | [AllofWithTwoEmptySchemas.Schema1BoxedMap](#schema1boxedmap)
    boxed class to store validated Map payloads | +| static class | [AllofWithTwoEmptySchemas.Schema1](#schema1)
    schema class | +| sealed interface | [AllofWithTwoEmptySchemas.Schema0Boxed](#schema0boxed)
    sealed interface for validated payloads | +| record | [AllofWithTwoEmptySchemas.Schema0BoxedVoid](#schema0boxedvoid)
    boxed class to store validated null payloads | +| record | [AllofWithTwoEmptySchemas.Schema0BoxedBoolean](#schema0boxedboolean)
    boxed class to store validated boolean payloads | +| record | [AllofWithTwoEmptySchemas.Schema0BoxedNumber](#schema0boxednumber)
    boxed class to store validated Number payloads | +| record | [AllofWithTwoEmptySchemas.Schema0BoxedString](#schema0boxedstring)
    boxed class to store validated String payloads | +| record | [AllofWithTwoEmptySchemas.Schema0BoxedList](#schema0boxedlist)
    boxed class to store validated List payloads | +| record | [AllofWithTwoEmptySchemas.Schema0BoxedMap](#schema0boxedmap)
    boxed class to store validated Map payloads | +| static class | [AllofWithTwoEmptySchemas.Schema0](#schema0)
    schema class | + +## AllofWithTwoEmptySchemas1Boxed +sealed interface AllofWithTwoEmptySchemas1Boxed
    +permits
    +[AllofWithTwoEmptySchemas1BoxedVoid](#allofwithtwoemptyschemas1boxedvoid), +[AllofWithTwoEmptySchemas1BoxedBoolean](#allofwithtwoemptyschemas1boxedboolean), +[AllofWithTwoEmptySchemas1BoxedNumber](#allofwithtwoemptyschemas1boxednumber), +[AllofWithTwoEmptySchemas1BoxedString](#allofwithtwoemptyschemas1boxedstring), +[AllofWithTwoEmptySchemas1BoxedList](#allofwithtwoemptyschemas1boxedlist), +[AllofWithTwoEmptySchemas1BoxedMap](#allofwithtwoemptyschemas1boxedmap) + +sealed interface that stores validated payloads using boxed classes + +## AllofWithTwoEmptySchemas1BoxedVoid +data class AllofWithTwoEmptySchemas1BoxedVoid
    +implements [AllofWithTwoEmptySchemas1Boxed](#allofwithtwoemptyschemas1boxed) + +data class that stores validated null payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| AllofWithTwoEmptySchemas1BoxedVoid(Nothing? data)
    Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| Nothing? | data()
    validated payload | +| Any? | getData()
    validated payload | + +## AllofWithTwoEmptySchemas1BoxedBoolean +data class AllofWithTwoEmptySchemas1BoxedBoolean
    +implements [AllofWithTwoEmptySchemas1Boxed](#allofwithtwoemptyschemas1boxed) + +record that stores validated boolean payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| AllofWithTwoEmptySchemas1BoxedBoolean(boolean data)
    Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| boolean | data()
    validated payload | +| Any? | getData()
    validated payload | + +## AllofWithTwoEmptySchemas1BoxedNumber +data class AllofWithTwoEmptySchemas1BoxedNumber
    +implements [AllofWithTwoEmptySchemas1Boxed](#allofwithtwoemptyschemas1boxed) + +data class that stores validated Number payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| AllofWithTwoEmptySchemas1BoxedNumber(Number data)
    Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| Number | data()
    validated payload | +| Any? | getData()
    validated payload | + +## AllofWithTwoEmptySchemas1BoxedString +data class AllofWithTwoEmptySchemas1BoxedString
    +implements [AllofWithTwoEmptySchemas1Boxed](#allofwithtwoemptyschemas1boxed) + +data class that stores validated String payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| AllofWithTwoEmptySchemas1BoxedString(String data)
    Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| String | data()
    validated payload | +| Any? | getData()
    validated payload | + +## AllofWithTwoEmptySchemas1BoxedList +data class AllofWithTwoEmptySchemas1BoxedList
    +implements [AllofWithTwoEmptySchemas1Boxed](#allofwithtwoemptyschemas1boxed) + +data class that stores validated List payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| AllofWithTwoEmptySchemas1BoxedList(FrozenList data)
    Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| FrozenList | data()
    validated payload | +| Any? | getData()
    validated payload | + +## AllofWithTwoEmptySchemas1BoxedMap +data class AllofWithTwoEmptySchemas1BoxedMap
    +implements [AllofWithTwoEmptySchemas1Boxed](#allofwithtwoemptyschemas1boxed) + +data class that stores validated Map payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| AllofWithTwoEmptySchemas1BoxedMap(FrozenMap data)
    Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| FrozenMap | data()
    validated payload | +| Any? | getData()
    validated payload | + +## AllofWithTwoEmptySchemas1 +class AllofWithTwoEmptySchemas1
    +extends JsonSchema + +A schema class that validates payloads + +### Field Summary +| Modifier and Type | Field and Description | +| ----------------- | ---------------------- | +| List> | allOf = listOf(
        [Schema0::class.java](#schema0),
        [Schema1::class.java](#schema1)
    ;)
    | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| String | validate(arg: String, configuration: SchemaConfiguration) | +| Nothing? | validate(arg: Nothing?, configuration: SchemaConfiguration) | +| int | validate(arg: int, configuration: SchemaConfiguration) | +| long | validate(arg: long, configuration: SchemaConfiguration) | +| float | validate(arg: float, configuration: SchemaConfiguration) | +| double | validate(arg: double, configuration: SchemaConfiguration) | +| Number | validate(arg: Number, configuration: SchemaConfiguration) | +| boolean | validate(arg: boolean, configuration: SchemaConfiguration) | +| FrozenMap | validate(arg: Map<?, ?>, configuration: SchemaConfiguration) | +| FrozenList | validate(arg: List<*>, configuration: SchemaConfiguration) | +| [AllofWithTwoEmptySchemas1BoxedString](#allofwithtwoemptyschemas1boxedstring) | validateAndBox(String, configuration: SchemaConfiguration) | +| [AllofWithTwoEmptySchemas1BoxedVoid](#allofwithtwoemptyschemas1boxedvoid) | validateAndBox(Nothing?, configuration: SchemaConfiguration) | +| [AllofWithTwoEmptySchemas1BoxedNumber](#allofwithtwoemptyschemas1boxednumber) | validateAndBox(Number, configuration: SchemaConfiguration) | +| [AllofWithTwoEmptySchemas1BoxedBoolean](#allofwithtwoemptyschemas1boxedboolean) | validateAndBox(boolean, configuration: SchemaConfiguration) | +| [AllofWithTwoEmptySchemas1BoxedMap](#allofwithtwoemptyschemas1boxedmap) | validateAndBox(Map<?, ?>, configuration: SchemaConfiguration) | +| [AllofWithTwoEmptySchemas1BoxedList](#allofwithtwoemptyschemas1boxedlist) | validateAndBox(List<*>, configuration: SchemaConfiguration) | +| [AllofWithTwoEmptySchemas1Boxed](#allofwithtwoemptyschemas1boxed) | validateAndBox(Any?, configuration: SchemaConfiguration) | +| Any? | validate(arg: Any?, configuration: SchemaConfiguration) | + +## Schema1Boxed +sealed interface Schema1Boxed
    +permits
    +[Schema1BoxedVoid](#schema1boxedvoid), +[Schema1BoxedBoolean](#schema1boxedboolean), +[Schema1BoxedNumber](#schema1boxednumber), +[Schema1BoxedString](#schema1boxedstring), +[Schema1BoxedList](#schema1boxedlist), +[Schema1BoxedMap](#schema1boxedmap) + +sealed interface that stores validated payloads using boxed classes + +## Schema1BoxedVoid +data class Schema1BoxedVoid
    +implements [Schema1Boxed](#schema1boxed) + +data class that stores validated null payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| Schema1BoxedVoid(Nothing? data)
    Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| Nothing? | data()
    validated payload | +| Any? | getData()
    validated payload | + +## Schema1BoxedBoolean +data class Schema1BoxedBoolean
    +implements [Schema1Boxed](#schema1boxed) + +record that stores validated boolean payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| Schema1BoxedBoolean(boolean data)
    Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| boolean | data()
    validated payload | +| Any? | getData()
    validated payload | + +## Schema1BoxedNumber +data class Schema1BoxedNumber
    +implements [Schema1Boxed](#schema1boxed) + +data class that stores validated Number payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| Schema1BoxedNumber(Number data)
    Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| Number | data()
    validated payload | +| Any? | getData()
    validated payload | + +## Schema1BoxedString +data class Schema1BoxedString
    +implements [Schema1Boxed](#schema1boxed) + +data class that stores validated String payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| Schema1BoxedString(String data)
    Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| String | data()
    validated payload | +| Any? | getData()
    validated payload | + +## Schema1BoxedList +data class Schema1BoxedList
    +implements [Schema1Boxed](#schema1boxed) + +data class that stores validated List payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| Schema1BoxedList(FrozenList data)
    Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| FrozenList | data()
    validated payload | +| Any? | getData()
    validated payload | + +## Schema1BoxedMap +data class Schema1BoxedMap
    +implements [Schema1Boxed](#schema1boxed) + +data class that stores validated Map payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| Schema1BoxedMap(FrozenMap data)
    Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| FrozenMap | data()
    validated payload | +| Any? | getData()
    validated payload | + +## Schema1 +class Schema1
    +extends AnyTypeJsonSchema.AnyTypeJsonSchema1 + +A schema class that validates payloads + +| Methods Inherited from class org.openapijsonschematools.client.schemas.AnyTypeJsonSchema.AnyTypeJsonSchema1 | +| ------------------------------------------------------------------ | +| validate | +| validateAndBox | + +## Schema0Boxed +sealed interface Schema0Boxed
    +permits
    +[Schema0BoxedVoid](#schema0boxedvoid), +[Schema0BoxedBoolean](#schema0boxedboolean), +[Schema0BoxedNumber](#schema0boxednumber), +[Schema0BoxedString](#schema0boxedstring), +[Schema0BoxedList](#schema0boxedlist), +[Schema0BoxedMap](#schema0boxedmap) + +sealed interface that stores validated payloads using boxed classes + +## Schema0BoxedVoid +data class Schema0BoxedVoid
    +implements [Schema0Boxed](#schema0boxed) + +data class that stores validated null payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| Schema0BoxedVoid(Nothing? data)
    Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| Nothing? | data()
    validated payload | +| Any? | getData()
    validated payload | + +## Schema0BoxedBoolean +data class Schema0BoxedBoolean
    +implements [Schema0Boxed](#schema0boxed) + +record that stores validated boolean payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| Schema0BoxedBoolean(boolean data)
    Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| boolean | data()
    validated payload | +| Any? | getData()
    validated payload | + +## Schema0BoxedNumber +data class Schema0BoxedNumber
    +implements [Schema0Boxed](#schema0boxed) + +data class that stores validated Number payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| Schema0BoxedNumber(Number data)
    Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| Number | data()
    validated payload | +| Any? | getData()
    validated payload | + +## Schema0BoxedString +data class Schema0BoxedString
    +implements [Schema0Boxed](#schema0boxed) + +data class that stores validated String payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| Schema0BoxedString(String data)
    Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| String | data()
    validated payload | +| Any? | getData()
    validated payload | + +## Schema0BoxedList +data class Schema0BoxedList
    +implements [Schema0Boxed](#schema0boxed) + +data class that stores validated List payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| Schema0BoxedList(FrozenList data)
    Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| FrozenList | data()
    validated payload | +| Any? | getData()
    validated payload | + +## Schema0BoxedMap +data class Schema0BoxedMap
    +implements [Schema0Boxed](#schema0boxed) + +data class that stores validated Map payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| Schema0BoxedMap(FrozenMap data)
    Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| FrozenMap | data()
    validated payload | +| Any? | getData()
    validated payload | + +## Schema0 +class Schema0
    +extends AnyTypeJsonSchema.AnyTypeJsonSchema1 + +A schema class that validates payloads + +| Methods Inherited from class org.openapijsonschematools.client.schemas.AnyTypeJsonSchema.AnyTypeJsonSchema1 | +| ------------------------------------------------------------------ | +| validate | +| validateAndBox | + +[[Back to top]](#top) [[Back to Component Schemas]](../../../README.md#Component-Schemas) [[Back to README]](../../../README.md) diff --git a/samples/client/3_1_0_unit_test/kotlin/docs/components/schemas/Anyof.md b/samples/client/3_1_0_unit_test/kotlin/docs/components/schemas/Anyof.md new file mode 100644 index 00000000000..0b400ccbe95 --- /dev/null +++ b/samples/client/3_1_0_unit_test/kotlin/docs/components/schemas/Anyof.md @@ -0,0 +1,362 @@ +# Anyof +org.openapijsonschematools.client.components.schemas.Anyof.java +class Anyof
    + +A class that contains necessary nested +- schema classes (which validate payloads), extends JsonSchema +- sealed interfaces which store validated payloads, Kotlin version of a sum type +- boxed classes which store validated payloads, sealed permits class implementations + +## Nested Class Summary +| Modifier and Type | Class and Description | +| ----------------- | ---------------------- | +| sealed interface | [Anyof.Anyof1Boxed](#anyof1boxed)
    sealed interface for validated payloads | +| record | [Anyof.Anyof1BoxedVoid](#anyof1boxedvoid)
    boxed class to store validated null payloads | +| record | [Anyof.Anyof1BoxedBoolean](#anyof1boxedboolean)
    boxed class to store validated boolean payloads | +| record | [Anyof.Anyof1BoxedNumber](#anyof1boxednumber)
    boxed class to store validated Number payloads | +| record | [Anyof.Anyof1BoxedString](#anyof1boxedstring)
    boxed class to store validated String payloads | +| record | [Anyof.Anyof1BoxedList](#anyof1boxedlist)
    boxed class to store validated List payloads | +| record | [Anyof.Anyof1BoxedMap](#anyof1boxedmap)
    boxed class to store validated Map payloads | +| static class | [Anyof.Anyof1](#anyof1)
    schema class | +| sealed interface | [Anyof.Schema1Boxed](#schema1boxed)
    sealed interface for validated payloads | +| record | [Anyof.Schema1BoxedVoid](#schema1boxedvoid)
    boxed class to store validated null payloads | +| record | [Anyof.Schema1BoxedBoolean](#schema1boxedboolean)
    boxed class to store validated boolean payloads | +| record | [Anyof.Schema1BoxedNumber](#schema1boxednumber)
    boxed class to store validated Number payloads | +| record | [Anyof.Schema1BoxedString](#schema1boxedstring)
    boxed class to store validated String payloads | +| record | [Anyof.Schema1BoxedList](#schema1boxedlist)
    boxed class to store validated List payloads | +| record | [Anyof.Schema1BoxedMap](#schema1boxedmap)
    boxed class to store validated Map payloads | +| static class | [Anyof.Schema1](#schema1)
    schema class | +| sealed interface | [Anyof.Schema0Boxed](#schema0boxed)
    sealed interface for validated payloads | +| record | [Anyof.Schema0BoxedNumber](#schema0boxednumber)
    boxed class to store validated Number payloads | +| static class | [Anyof.Schema0](#schema0)
    schema class | + +## Anyof1Boxed +sealed interface Anyof1Boxed
    +permits
    +[Anyof1BoxedVoid](#anyof1boxedvoid), +[Anyof1BoxedBoolean](#anyof1boxedboolean), +[Anyof1BoxedNumber](#anyof1boxednumber), +[Anyof1BoxedString](#anyof1boxedstring), +[Anyof1BoxedList](#anyof1boxedlist), +[Anyof1BoxedMap](#anyof1boxedmap) + +sealed interface that stores validated payloads using boxed classes + +## Anyof1BoxedVoid +data class Anyof1BoxedVoid
    +implements [Anyof1Boxed](#anyof1boxed) + +data class that stores validated null payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| Anyof1BoxedVoid(Nothing? data)
    Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| Nothing? | data()
    validated payload | +| Any? | getData()
    validated payload | + +## Anyof1BoxedBoolean +data class Anyof1BoxedBoolean
    +implements [Anyof1Boxed](#anyof1boxed) + +record that stores validated boolean payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| Anyof1BoxedBoolean(boolean data)
    Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| boolean | data()
    validated payload | +| Any? | getData()
    validated payload | + +## Anyof1BoxedNumber +data class Anyof1BoxedNumber
    +implements [Anyof1Boxed](#anyof1boxed) + +data class that stores validated Number payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| Anyof1BoxedNumber(Number data)
    Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| Number | data()
    validated payload | +| Any? | getData()
    validated payload | + +## Anyof1BoxedString +data class Anyof1BoxedString
    +implements [Anyof1Boxed](#anyof1boxed) + +data class that stores validated String payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| Anyof1BoxedString(String data)
    Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| String | data()
    validated payload | +| Any? | getData()
    validated payload | + +## Anyof1BoxedList +data class Anyof1BoxedList
    +implements [Anyof1Boxed](#anyof1boxed) + +data class that stores validated List payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| Anyof1BoxedList(FrozenList data)
    Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| FrozenList | data()
    validated payload | +| Any? | getData()
    validated payload | + +## Anyof1BoxedMap +data class Anyof1BoxedMap
    +implements [Anyof1Boxed](#anyof1boxed) + +data class that stores validated Map payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| Anyof1BoxedMap(FrozenMap data)
    Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| FrozenMap | data()
    validated payload | +| Any? | getData()
    validated payload | + +## Anyof1 +class Anyof1
    +extends JsonSchema + +A schema class that validates payloads + +### Field Summary +| Modifier and Type | Field and Description | +| ----------------- | ---------------------- | +| List> | anyOf = listOf(
        [Schema0::class.java](#schema0),
        [Schema1::class.java](#schema1)
    )
    | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| String | validate(arg: String, configuration: SchemaConfiguration) | +| Nothing? | validate(arg: Nothing?, configuration: SchemaConfiguration) | +| int | validate(arg: int, configuration: SchemaConfiguration) | +| long | validate(arg: long, configuration: SchemaConfiguration) | +| float | validate(arg: float, configuration: SchemaConfiguration) | +| double | validate(arg: double, configuration: SchemaConfiguration) | +| Number | validate(arg: Number, configuration: SchemaConfiguration) | +| boolean | validate(arg: boolean, configuration: SchemaConfiguration) | +| FrozenMap | validate(arg: Map<?, ?>, configuration: SchemaConfiguration) | +| FrozenList | validate(arg: List<*>, configuration: SchemaConfiguration) | +| [Anyof1BoxedString](#anyof1boxedstring) | validateAndBox(String, configuration: SchemaConfiguration) | +| [Anyof1BoxedVoid](#anyof1boxedvoid) | validateAndBox(Nothing?, configuration: SchemaConfiguration) | +| [Anyof1BoxedNumber](#anyof1boxednumber) | validateAndBox(Number, configuration: SchemaConfiguration) | +| [Anyof1BoxedBoolean](#anyof1boxedboolean) | validateAndBox(boolean, configuration: SchemaConfiguration) | +| [Anyof1BoxedMap](#anyof1boxedmap) | validateAndBox(Map<?, ?>, configuration: SchemaConfiguration) | +| [Anyof1BoxedList](#anyof1boxedlist) | validateAndBox(List<*>, configuration: SchemaConfiguration) | +| [Anyof1Boxed](#anyof1boxed) | validateAndBox(Any?, configuration: SchemaConfiguration) | +| Any? | validate(arg: Any?, configuration: SchemaConfiguration) | + +## Schema1Boxed +sealed interface Schema1Boxed
    +permits
    +[Schema1BoxedVoid](#schema1boxedvoid), +[Schema1BoxedBoolean](#schema1boxedboolean), +[Schema1BoxedNumber](#schema1boxednumber), +[Schema1BoxedString](#schema1boxedstring), +[Schema1BoxedList](#schema1boxedlist), +[Schema1BoxedMap](#schema1boxedmap) + +sealed interface that stores validated payloads using boxed classes + +## Schema1BoxedVoid +data class Schema1BoxedVoid
    +implements [Schema1Boxed](#schema1boxed) + +data class that stores validated null payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| Schema1BoxedVoid(Nothing? data)
    Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| Nothing? | data()
    validated payload | +| Any? | getData()
    validated payload | + +## Schema1BoxedBoolean +data class Schema1BoxedBoolean
    +implements [Schema1Boxed](#schema1boxed) + +record that stores validated boolean payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| Schema1BoxedBoolean(boolean data)
    Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| boolean | data()
    validated payload | +| Any? | getData()
    validated payload | + +## Schema1BoxedNumber +data class Schema1BoxedNumber
    +implements [Schema1Boxed](#schema1boxed) + +data class that stores validated Number payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| Schema1BoxedNumber(Number data)
    Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| Number | data()
    validated payload | +| Any? | getData()
    validated payload | + +## Schema1BoxedString +data class Schema1BoxedString
    +implements [Schema1Boxed](#schema1boxed) + +data class that stores validated String payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| Schema1BoxedString(String data)
    Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| String | data()
    validated payload | +| Any? | getData()
    validated payload | + +## Schema1BoxedList +data class Schema1BoxedList
    +implements [Schema1Boxed](#schema1boxed) + +data class that stores validated List payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| Schema1BoxedList(FrozenList data)
    Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| FrozenList | data()
    validated payload | +| Any? | getData()
    validated payload | + +## Schema1BoxedMap +data class Schema1BoxedMap
    +implements [Schema1Boxed](#schema1boxed) + +data class that stores validated Map payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| Schema1BoxedMap(FrozenMap data)
    Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| FrozenMap | data()
    validated payload | +| Any? | getData()
    validated payload | + +## Schema1 +class Schema1
    +extends JsonSchema + +A schema class that validates payloads + +### Field Summary +| Modifier and Type | Field and Description | +| ----------------- | ---------------------- | +| Number | minimum = 2 | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| String | validate(arg: String, configuration: SchemaConfiguration) | +| Nothing? | validate(arg: Nothing?, configuration: SchemaConfiguration) | +| int | validate(arg: int, configuration: SchemaConfiguration) | +| long | validate(arg: long, configuration: SchemaConfiguration) | +| float | validate(arg: float, configuration: SchemaConfiguration) | +| double | validate(arg: double, configuration: SchemaConfiguration) | +| Number | validate(arg: Number, configuration: SchemaConfiguration) | +| boolean | validate(arg: boolean, configuration: SchemaConfiguration) | +| FrozenMap | validate(arg: Map<?, ?>, configuration: SchemaConfiguration) | +| FrozenList | validate(arg: List<*>, configuration: SchemaConfiguration) | +| [Schema1BoxedString](#schema1boxedstring) | validateAndBox(String, configuration: SchemaConfiguration) | +| [Schema1BoxedVoid](#schema1boxedvoid) | validateAndBox(Nothing?, configuration: SchemaConfiguration) | +| [Schema1BoxedNumber](#schema1boxednumber) | validateAndBox(Number, configuration: SchemaConfiguration) | +| [Schema1BoxedBoolean](#schema1boxedboolean) | validateAndBox(boolean, configuration: SchemaConfiguration) | +| [Schema1BoxedMap](#schema1boxedmap) | validateAndBox(Map<?, ?>, configuration: SchemaConfiguration) | +| [Schema1BoxedList](#schema1boxedlist) | validateAndBox(List<*>, configuration: SchemaConfiguration) | +| [Schema1Boxed](#schema1boxed) | validateAndBox(Any?, configuration: SchemaConfiguration) | +| Any? | validate(arg: Any?, configuration: SchemaConfiguration) | + +## Schema0Boxed +sealed interface Schema0Boxed
    +permits
    +[Schema0BoxedNumber](#schema0boxednumber) + +sealed interface that stores validated payloads using boxed classes + +## Schema0BoxedNumber +data class Schema0BoxedNumber
    +implements [Schema0Boxed](#schema0boxed) + +data class that stores validated Number payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| Schema0BoxedNumber(Number data)
    Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| Number | data()
    validated payload | +| Any? | getData()
    validated payload | + +## Schema0 +class Schema0
    +extends IntJsonSchema.IntJsonSchema1 + +A schema class that validates payloads + +| Methods Inherited from class org.openapijsonschematools.client.schemas.IntJsonSchema.IntJsonSchema1 | +| ------------------------------------------------------------------ | +| validate | +| validateAndBox | + +[[Back to top]](#top) [[Back to Component Schemas]](../../../README.md#Component-Schemas) [[Back to README]](../../../README.md) diff --git a/samples/client/3_1_0_unit_test/kotlin/docs/components/schemas/AnyofComplexTypes.md b/samples/client/3_1_0_unit_test/kotlin/docs/components/schemas/AnyofComplexTypes.md new file mode 100644 index 00000000000..fa38731618a --- /dev/null +++ b/samples/client/3_1_0_unit_test/kotlin/docs/components/schemas/AnyofComplexTypes.md @@ -0,0 +1,674 @@ +# AnyofComplexTypes +org.openapijsonschematools.client.components.schemas.AnyofComplexTypes.java +class AnyofComplexTypes
    + +A class that contains necessary nested +- schema classes (which validate payloads), extends JsonSchema +- sealed interfaces which store validated payloads, Kotlin version of a sum type +- boxed classes which store validated payloads, sealed permits class implementations +- classes to store validated map payloads, extends FrozenMap +- classes to build inputs for map payloads + +## Nested Class Summary +| Modifier and Type | Class and Description | +| ----------------- | ---------------------- | +| sealed interface | [AnyofComplexTypes.AnyofComplexTypes1Boxed](#anyofcomplextypes1boxed)
    sealed interface for validated payloads | +| record | [AnyofComplexTypes.AnyofComplexTypes1BoxedVoid](#anyofcomplextypes1boxedvoid)
    boxed class to store validated null payloads | +| record | [AnyofComplexTypes.AnyofComplexTypes1BoxedBoolean](#anyofcomplextypes1boxedboolean)
    boxed class to store validated boolean payloads | +| record | [AnyofComplexTypes.AnyofComplexTypes1BoxedNumber](#anyofcomplextypes1boxednumber)
    boxed class to store validated Number payloads | +| record | [AnyofComplexTypes.AnyofComplexTypes1BoxedString](#anyofcomplextypes1boxedstring)
    boxed class to store validated String payloads | +| record | [AnyofComplexTypes.AnyofComplexTypes1BoxedList](#anyofcomplextypes1boxedlist)
    boxed class to store validated List payloads | +| record | [AnyofComplexTypes.AnyofComplexTypes1BoxedMap](#anyofcomplextypes1boxedmap)
    boxed class to store validated Map payloads | +| static class | [AnyofComplexTypes.AnyofComplexTypes1](#anyofcomplextypes1)
    schema class | +| sealed interface | [AnyofComplexTypes.Schema1Boxed](#schema1boxed)
    sealed interface for validated payloads | +| record | [AnyofComplexTypes.Schema1BoxedVoid](#schema1boxedvoid)
    boxed class to store validated null payloads | +| record | [AnyofComplexTypes.Schema1BoxedBoolean](#schema1boxedboolean)
    boxed class to store validated boolean payloads | +| record | [AnyofComplexTypes.Schema1BoxedNumber](#schema1boxednumber)
    boxed class to store validated Number payloads | +| record | [AnyofComplexTypes.Schema1BoxedString](#schema1boxedstring)
    boxed class to store validated String payloads | +| record | [AnyofComplexTypes.Schema1BoxedList](#schema1boxedlist)
    boxed class to store validated List payloads | +| record | [AnyofComplexTypes.Schema1BoxedMap](#schema1boxedmap)
    boxed class to store validated Map payloads | +| static class | [AnyofComplexTypes.Schema1](#schema1)
    schema class | +| static class | [AnyofComplexTypes.Schema1MapBuilder](#schema1mapbuilder)
    builder for Map payloads | +| static class | [AnyofComplexTypes.Schema1Map](#schema1map)
    output class for Map payloads | +| sealed interface | [AnyofComplexTypes.FooBoxed](#fooboxed)
    sealed interface for validated payloads | +| record | [AnyofComplexTypes.FooBoxedString](#fooboxedstring)
    boxed class to store validated String payloads | +| static class | [AnyofComplexTypes.Foo](#foo)
    schema class | +| sealed interface | [AnyofComplexTypes.Schema0Boxed](#schema0boxed)
    sealed interface for validated payloads | +| record | [AnyofComplexTypes.Schema0BoxedVoid](#schema0boxedvoid)
    boxed class to store validated null payloads | +| record | [AnyofComplexTypes.Schema0BoxedBoolean](#schema0boxedboolean)
    boxed class to store validated boolean payloads | +| record | [AnyofComplexTypes.Schema0BoxedNumber](#schema0boxednumber)
    boxed class to store validated Number payloads | +| record | [AnyofComplexTypes.Schema0BoxedString](#schema0boxedstring)
    boxed class to store validated String payloads | +| record | [AnyofComplexTypes.Schema0BoxedList](#schema0boxedlist)
    boxed class to store validated List payloads | +| record | [AnyofComplexTypes.Schema0BoxedMap](#schema0boxedmap)
    boxed class to store validated Map payloads | +| static class | [AnyofComplexTypes.Schema0](#schema0)
    schema class | +| static class | [AnyofComplexTypes.Schema0MapBuilder](#schema0mapbuilder)
    builder for Map payloads | +| static class | [AnyofComplexTypes.Schema0Map](#schema0map)
    output class for Map payloads | +| sealed interface | [AnyofComplexTypes.BarBoxed](#barboxed)
    sealed interface for validated payloads | +| record | [AnyofComplexTypes.BarBoxedNumber](#barboxednumber)
    boxed class to store validated Number payloads | +| static class | [AnyofComplexTypes.Bar](#bar)
    schema class | + +## AnyofComplexTypes1Boxed +sealed interface AnyofComplexTypes1Boxed
    +permits
    +[AnyofComplexTypes1BoxedVoid](#anyofcomplextypes1boxedvoid), +[AnyofComplexTypes1BoxedBoolean](#anyofcomplextypes1boxedboolean), +[AnyofComplexTypes1BoxedNumber](#anyofcomplextypes1boxednumber), +[AnyofComplexTypes1BoxedString](#anyofcomplextypes1boxedstring), +[AnyofComplexTypes1BoxedList](#anyofcomplextypes1boxedlist), +[AnyofComplexTypes1BoxedMap](#anyofcomplextypes1boxedmap) + +sealed interface that stores validated payloads using boxed classes + +## AnyofComplexTypes1BoxedVoid +data class AnyofComplexTypes1BoxedVoid
    +implements [AnyofComplexTypes1Boxed](#anyofcomplextypes1boxed) + +data class that stores validated null payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| AnyofComplexTypes1BoxedVoid(Nothing? data)
    Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| Nothing? | data()
    validated payload | +| Any? | getData()
    validated payload | + +## AnyofComplexTypes1BoxedBoolean +data class AnyofComplexTypes1BoxedBoolean
    +implements [AnyofComplexTypes1Boxed](#anyofcomplextypes1boxed) + +record that stores validated boolean payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| AnyofComplexTypes1BoxedBoolean(boolean data)
    Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| boolean | data()
    validated payload | +| Any? | getData()
    validated payload | + +## AnyofComplexTypes1BoxedNumber +data class AnyofComplexTypes1BoxedNumber
    +implements [AnyofComplexTypes1Boxed](#anyofcomplextypes1boxed) + +data class that stores validated Number payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| AnyofComplexTypes1BoxedNumber(Number data)
    Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| Number | data()
    validated payload | +| Any? | getData()
    validated payload | + +## AnyofComplexTypes1BoxedString +data class AnyofComplexTypes1BoxedString
    +implements [AnyofComplexTypes1Boxed](#anyofcomplextypes1boxed) + +data class that stores validated String payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| AnyofComplexTypes1BoxedString(String data)
    Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| String | data()
    validated payload | +| Any? | getData()
    validated payload | + +## AnyofComplexTypes1BoxedList +data class AnyofComplexTypes1BoxedList
    +implements [AnyofComplexTypes1Boxed](#anyofcomplextypes1boxed) + +data class that stores validated List payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| AnyofComplexTypes1BoxedList(FrozenList data)
    Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| FrozenList | data()
    validated payload | +| Any? | getData()
    validated payload | + +## AnyofComplexTypes1BoxedMap +data class AnyofComplexTypes1BoxedMap
    +implements [AnyofComplexTypes1Boxed](#anyofcomplextypes1boxed) + +data class that stores validated Map payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| AnyofComplexTypes1BoxedMap(FrozenMap data)
    Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| FrozenMap | data()
    validated payload | +| Any? | getData()
    validated payload | + +## AnyofComplexTypes1 +class AnyofComplexTypes1
    +extends JsonSchema + +A schema class that validates payloads + +### Field Summary +| Modifier and Type | Field and Description | +| ----------------- | ---------------------- | +| List> | anyOf = listOf(
        [Schema0::class.java](#schema0),
        [Schema1::class.java](#schema1)
    )
    | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| String | validate(arg: String, configuration: SchemaConfiguration) | +| Nothing? | validate(arg: Nothing?, configuration: SchemaConfiguration) | +| int | validate(arg: int, configuration: SchemaConfiguration) | +| long | validate(arg: long, configuration: SchemaConfiguration) | +| float | validate(arg: float, configuration: SchemaConfiguration) | +| double | validate(arg: double, configuration: SchemaConfiguration) | +| Number | validate(arg: Number, configuration: SchemaConfiguration) | +| boolean | validate(arg: boolean, configuration: SchemaConfiguration) | +| FrozenMap | validate(arg: Map<?, ?>, configuration: SchemaConfiguration) | +| FrozenList | validate(arg: List<*>, configuration: SchemaConfiguration) | +| [AnyofComplexTypes1BoxedString](#anyofcomplextypes1boxedstring) | validateAndBox(String, configuration: SchemaConfiguration) | +| [AnyofComplexTypes1BoxedVoid](#anyofcomplextypes1boxedvoid) | validateAndBox(Nothing?, configuration: SchemaConfiguration) | +| [AnyofComplexTypes1BoxedNumber](#anyofcomplextypes1boxednumber) | validateAndBox(Number, configuration: SchemaConfiguration) | +| [AnyofComplexTypes1BoxedBoolean](#anyofcomplextypes1boxedboolean) | validateAndBox(boolean, configuration: SchemaConfiguration) | +| [AnyofComplexTypes1BoxedMap](#anyofcomplextypes1boxedmap) | validateAndBox(Map<?, ?>, configuration: SchemaConfiguration) | +| [AnyofComplexTypes1BoxedList](#anyofcomplextypes1boxedlist) | validateAndBox(List<*>, configuration: SchemaConfiguration) | +| [AnyofComplexTypes1Boxed](#anyofcomplextypes1boxed) | validateAndBox(Any?, configuration: SchemaConfiguration) | +| Any? | validate(arg: Any?, configuration: SchemaConfiguration) | + +## Schema1Boxed +sealed interface Schema1Boxed
    +permits
    +[Schema1BoxedVoid](#schema1boxedvoid), +[Schema1BoxedBoolean](#schema1boxedboolean), +[Schema1BoxedNumber](#schema1boxednumber), +[Schema1BoxedString](#schema1boxedstring), +[Schema1BoxedList](#schema1boxedlist), +[Schema1BoxedMap](#schema1boxedmap) + +sealed interface that stores validated payloads using boxed classes + +## Schema1BoxedVoid +data class Schema1BoxedVoid
    +implements [Schema1Boxed](#schema1boxed) + +data class that stores validated null payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| Schema1BoxedVoid(Nothing? data)
    Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| Nothing? | data()
    validated payload | +| Any? | getData()
    validated payload | + +## Schema1BoxedBoolean +data class Schema1BoxedBoolean
    +implements [Schema1Boxed](#schema1boxed) + +record that stores validated boolean payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| Schema1BoxedBoolean(boolean data)
    Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| boolean | data()
    validated payload | +| Any? | getData()
    validated payload | + +## Schema1BoxedNumber +data class Schema1BoxedNumber
    +implements [Schema1Boxed](#schema1boxed) + +data class that stores validated Number payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| Schema1BoxedNumber(Number data)
    Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| Number | data()
    validated payload | +| Any? | getData()
    validated payload | + +## Schema1BoxedString +data class Schema1BoxedString
    +implements [Schema1Boxed](#schema1boxed) + +data class that stores validated String payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| Schema1BoxedString(String data)
    Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| String | data()
    validated payload | +| Any? | getData()
    validated payload | + +## Schema1BoxedList +data class Schema1BoxedList
    +implements [Schema1Boxed](#schema1boxed) + +data class that stores validated List payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| Schema1BoxedList(FrozenList data)
    Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| FrozenList | data()
    validated payload | +| Any? | getData()
    validated payload | + +## Schema1BoxedMap +data class Schema1BoxedMap
    +implements [Schema1Boxed](#schema1boxed) + +data class that stores validated Map payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| Schema1BoxedMap([Schema1Map](#schema1map) data)
    Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| [Schema1Map](#schema1map) | data()
    validated payload | +| Any? | getData()
    validated payload | + +## Schema1 +class Schema1
    +extends JsonSchema + +A schema class that validates payloads + +### Field Summary +| Modifier and Type | Field and Description | +| ----------------- | ---------------------- | +| Map> | properties = mapOf(
        "foo" to [Foo::class.java](#foo))
    )
    | +| Set | required = setOf(
        "foo"
    )
    | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| String | validate(arg: String, configuration: SchemaConfiguration) | +| Nothing? | validate(arg: Nothing?, configuration: SchemaConfiguration) | +| int | validate(arg: int, configuration: SchemaConfiguration) | +| long | validate(arg: long, configuration: SchemaConfiguration) | +| float | validate(arg: float, configuration: SchemaConfiguration) | +| double | validate(arg: double, configuration: SchemaConfiguration) | +| Number | validate(arg: Number, configuration: SchemaConfiguration) | +| boolean | validate(arg: boolean, configuration: SchemaConfiguration) | +| [Schema1Map](#schema1map) | validate(arg: [Map<?, ?>](#schema1mapbuilder), configuration: SchemaConfiguration) | +| FrozenList | validate(arg: List<*>, configuration: SchemaConfiguration) | +| [Schema1BoxedString](#schema1boxedstring) | validateAndBox(String, configuration: SchemaConfiguration) | +| [Schema1BoxedVoid](#schema1boxedvoid) | validateAndBox(Nothing?, configuration: SchemaConfiguration) | +| [Schema1BoxedNumber](#schema1boxednumber) | validateAndBox(Number, configuration: SchemaConfiguration) | +| [Schema1BoxedBoolean](#schema1boxedboolean) | validateAndBox(boolean, configuration: SchemaConfiguration) | +| [Schema1BoxedMap](#schema1boxedmap) | validateAndBox([Map<?, ?>](#schema1mapbuilder), configuration: SchemaConfiguration) | +| [Schema1BoxedList](#schema1boxedlist) | validateAndBox(List<*>, configuration: SchemaConfiguration) | +| [Schema1Boxed](#schema1boxed) | validateAndBox(Any?, configuration: SchemaConfiguration) | +| Any? | validate(arg: Any?, configuration: SchemaConfiguration) | + +## Schema1Map0Builder +class Schema1Map0Builder
    +builder for `Map` + +A class that builds the Map input type + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| Schema1Map0Builder(Map instance)
    Creates a builder that contains the passed instance | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| Map | build()
    Returns map input that should be used with Schema.validate | +| [Schema1Map0Builder](#schema1map0builder) | additionalProperty(key: String, value: Nothing?) | +| [Schema1Map0Builder](#schema1map0builder) | additionalProperty(key: String, value: Boolean) | +| [Schema1Map0Builder](#schema1map0builder) | additionalProperty(key: String, value: String) | +| [Schema1Map0Builder](#schema1map0builder) | additionalProperty(key: String, value: Int) | +| [Schema1Map0Builder](#schema1map0builder) | additionalProperty(key: String, value: Float) | +| [Schema1Map0Builder](#schema1map0builder) | additionalProperty(key: String, value: Long) | +| [Schema1Map0Builder](#schema1map0builder) | additionalProperty(key: String, value: Double) | +| [Schema1Map0Builder](#schema1map0builder) | additionalProperty(key: String, value: List) | +| [Schema1Map0Builder](#schema1map0builder) | additionalProperty(key: String, value: Map) | + +## Schema1MapBuilder +class Schema1MapBuilder
    +builder for `Map` + +A class that builds the Map input type + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| Schema1MapBuilder()
    Creates a builder that contains an empty map | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| [Schema1Map0Builder](#schema1map0builder) | foo(value: String) | + +## Schema1Map +class Schema1Map
    +extends FrozenMap + +A class to store validated Map payloads + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| static [Schema1Map](#schema1map) | of([Map](#schema1mapbuilder) arg, SchemaConfiguration configuration) | +| String | foo()
    | +| Any? | getAdditionalProperty(String name)
    provides type safety for additional properties | + +## FooBoxed +sealed interface FooBoxed
    +permits
    +[FooBoxedString](#fooboxedstring) + +sealed interface that stores validated payloads using boxed classes + +## FooBoxedString +data class FooBoxedString
    +implements [FooBoxed](#fooboxed) + +data class that stores validated String payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| FooBoxedString(String data)
    Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| String | data()
    validated payload | +| Any? | getData()
    validated payload | + +## Foo +class Foo
    +extends StringJsonSchema.StringJsonSchema1 + +A schema class that validates payloads + +| Methods Inherited from class org.openapijsonschematools.client.schemas.StringJsonSchema.StringJsonSchema1 | +| ------------------------------------------------------------------ | +| validate | +| validateAndBox | + +## Schema0Boxed +sealed interface Schema0Boxed
    +permits
    +[Schema0BoxedVoid](#schema0boxedvoid), +[Schema0BoxedBoolean](#schema0boxedboolean), +[Schema0BoxedNumber](#schema0boxednumber), +[Schema0BoxedString](#schema0boxedstring), +[Schema0BoxedList](#schema0boxedlist), +[Schema0BoxedMap](#schema0boxedmap) + +sealed interface that stores validated payloads using boxed classes + +## Schema0BoxedVoid +data class Schema0BoxedVoid
    +implements [Schema0Boxed](#schema0boxed) + +data class that stores validated null payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| Schema0BoxedVoid(Nothing? data)
    Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| Nothing? | data()
    validated payload | +| Any? | getData()
    validated payload | + +## Schema0BoxedBoolean +data class Schema0BoxedBoolean
    +implements [Schema0Boxed](#schema0boxed) + +record that stores validated boolean payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| Schema0BoxedBoolean(boolean data)
    Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| boolean | data()
    validated payload | +| Any? | getData()
    validated payload | + +## Schema0BoxedNumber +data class Schema0BoxedNumber
    +implements [Schema0Boxed](#schema0boxed) + +data class that stores validated Number payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| Schema0BoxedNumber(Number data)
    Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| Number | data()
    validated payload | +| Any? | getData()
    validated payload | + +## Schema0BoxedString +data class Schema0BoxedString
    +implements [Schema0Boxed](#schema0boxed) + +data class that stores validated String payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| Schema0BoxedString(String data)
    Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| String | data()
    validated payload | +| Any? | getData()
    validated payload | + +## Schema0BoxedList +data class Schema0BoxedList
    +implements [Schema0Boxed](#schema0boxed) + +data class that stores validated List payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| Schema0BoxedList(FrozenList data)
    Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| FrozenList | data()
    validated payload | +| Any? | getData()
    validated payload | + +## Schema0BoxedMap +data class Schema0BoxedMap
    +implements [Schema0Boxed](#schema0boxed) + +data class that stores validated Map payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| Schema0BoxedMap([Schema0Map](#schema0map) data)
    Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| [Schema0Map](#schema0map) | data()
    validated payload | +| Any? | getData()
    validated payload | + +## Schema0 +class Schema0
    +extends JsonSchema + +A schema class that validates payloads + +### Field Summary +| Modifier and Type | Field and Description | +| ----------------- | ---------------------- | +| Map> | properties = mapOf(
        "bar" to [Bar::class.java](#bar))
    )
    | +| Set | required = setOf(
        "bar"
    )
    | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| String | validate(arg: String, configuration: SchemaConfiguration) | +| Nothing? | validate(arg: Nothing?, configuration: SchemaConfiguration) | +| int | validate(arg: int, configuration: SchemaConfiguration) | +| long | validate(arg: long, configuration: SchemaConfiguration) | +| float | validate(arg: float, configuration: SchemaConfiguration) | +| double | validate(arg: double, configuration: SchemaConfiguration) | +| Number | validate(arg: Number, configuration: SchemaConfiguration) | +| boolean | validate(arg: boolean, configuration: SchemaConfiguration) | +| [Schema0Map](#schema0map) | validate(arg: [Map<?, ?>](#schema0mapbuilder), configuration: SchemaConfiguration) | +| FrozenList | validate(arg: List<*>, configuration: SchemaConfiguration) | +| [Schema0BoxedString](#schema0boxedstring) | validateAndBox(String, configuration: SchemaConfiguration) | +| [Schema0BoxedVoid](#schema0boxedvoid) | validateAndBox(Nothing?, configuration: SchemaConfiguration) | +| [Schema0BoxedNumber](#schema0boxednumber) | validateAndBox(Number, configuration: SchemaConfiguration) | +| [Schema0BoxedBoolean](#schema0boxedboolean) | validateAndBox(boolean, configuration: SchemaConfiguration) | +| [Schema0BoxedMap](#schema0boxedmap) | validateAndBox([Map<?, ?>](#schema0mapbuilder), configuration: SchemaConfiguration) | +| [Schema0BoxedList](#schema0boxedlist) | validateAndBox(List<*>, configuration: SchemaConfiguration) | +| [Schema0Boxed](#schema0boxed) | validateAndBox(Any?, configuration: SchemaConfiguration) | +| Any? | validate(arg: Any?, configuration: SchemaConfiguration) | + +## Schema0Map0Builder +class Schema0Map0Builder
    +builder for `Map` + +A class that builds the Map input type + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| Schema0Map0Builder(Map instance)
    Creates a builder that contains the passed instance | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| Map | build()
    Returns map input that should be used with Schema.validate | +| [Schema0Map0Builder](#schema0map0builder) | additionalProperty(key: String, value: Nothing?) | +| [Schema0Map0Builder](#schema0map0builder) | additionalProperty(key: String, value: Boolean) | +| [Schema0Map0Builder](#schema0map0builder) | additionalProperty(key: String, value: String) | +| [Schema0Map0Builder](#schema0map0builder) | additionalProperty(key: String, value: Int) | +| [Schema0Map0Builder](#schema0map0builder) | additionalProperty(key: String, value: Float) | +| [Schema0Map0Builder](#schema0map0builder) | additionalProperty(key: String, value: Long) | +| [Schema0Map0Builder](#schema0map0builder) | additionalProperty(key: String, value: Double) | +| [Schema0Map0Builder](#schema0map0builder) | additionalProperty(key: String, value: List) | +| [Schema0Map0Builder](#schema0map0builder) | additionalProperty(key: String, value: Map) | + +## Schema0MapBuilder +class Schema0MapBuilder
    +builder for `Map` + +A class that builds the Map input type + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| Schema0MapBuilder()
    Creates a builder that contains an empty map | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| [Schema0Map0Builder](#schema0map0builder) | bar(value: Int) | +| [Schema0Map0Builder](#schema0map0builder) | bar(value: Float) | +| [Schema0Map0Builder](#schema0map0builder) | bar(value: Long) | +| [Schema0Map0Builder](#schema0map0builder) | bar(value: Double) | + +## Schema0Map +class Schema0Map
    +extends FrozenMap + +A class to store validated Map payloads + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| static [Schema0Map](#schema0map) | of([Map](#schema0mapbuilder) arg, SchemaConfiguration configuration) | +| Number | bar()
    | +| Any? | getAdditionalProperty(String name)
    provides type safety for additional properties | + +## BarBoxed +sealed interface BarBoxed
    +permits
    +[BarBoxedNumber](#barboxednumber) + +sealed interface that stores validated payloads using boxed classes + +## BarBoxedNumber +data class BarBoxedNumber
    +implements [BarBoxed](#barboxed) + +data class that stores validated Number payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| BarBoxedNumber(Number data)
    Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| Number | data()
    validated payload | +| Any? | getData()
    validated payload | + +## Bar +class Bar
    +extends IntJsonSchema.IntJsonSchema1 + +A schema class that validates payloads + +| Methods Inherited from class org.openapijsonschematools.client.schemas.IntJsonSchema.IntJsonSchema1 | +| ------------------------------------------------------------------ | +| validate | +| validateAndBox | + +[[Back to top]](#top) [[Back to Component Schemas]](../../../README.md#Component-Schemas) [[Back to README]](../../../README.md) diff --git a/samples/client/3_1_0_unit_test/kotlin/docs/components/schemas/AnyofWithBaseSchema.md b/samples/client/3_1_0_unit_test/kotlin/docs/components/schemas/AnyofWithBaseSchema.md new file mode 100644 index 00000000000..d0175fa0d3d --- /dev/null +++ b/samples/client/3_1_0_unit_test/kotlin/docs/components/schemas/AnyofWithBaseSchema.md @@ -0,0 +1,394 @@ +# AnyofWithBaseSchema +org.openapijsonschematools.client.components.schemas.AnyofWithBaseSchema.java +class AnyofWithBaseSchema
    + +A class that contains necessary nested +- schema classes (which validate payloads), extends JsonSchema +- sealed interfaces which store validated payloads, Kotlin version of a sum type +- boxed classes which store validated payloads, sealed permits class implementations + +## Nested Class Summary +| Modifier and Type | Class and Description | +| ----------------- | ---------------------- | +| sealed interface | [AnyofWithBaseSchema.AnyofWithBaseSchema1Boxed](#anyofwithbaseschema1boxed)
    sealed interface for validated payloads | +| record | [AnyofWithBaseSchema.AnyofWithBaseSchema1BoxedString](#anyofwithbaseschema1boxedstring)
    boxed class to store validated String payloads | +| static class | [AnyofWithBaseSchema.AnyofWithBaseSchema1](#anyofwithbaseschema1)
    schema class | +| sealed interface | [AnyofWithBaseSchema.Schema1Boxed](#schema1boxed)
    sealed interface for validated payloads | +| record | [AnyofWithBaseSchema.Schema1BoxedVoid](#schema1boxedvoid)
    boxed class to store validated null payloads | +| record | [AnyofWithBaseSchema.Schema1BoxedBoolean](#schema1boxedboolean)
    boxed class to store validated boolean payloads | +| record | [AnyofWithBaseSchema.Schema1BoxedNumber](#schema1boxednumber)
    boxed class to store validated Number payloads | +| record | [AnyofWithBaseSchema.Schema1BoxedString](#schema1boxedstring)
    boxed class to store validated String payloads | +| record | [AnyofWithBaseSchema.Schema1BoxedList](#schema1boxedlist)
    boxed class to store validated List payloads | +| record | [AnyofWithBaseSchema.Schema1BoxedMap](#schema1boxedmap)
    boxed class to store validated Map payloads | +| static class | [AnyofWithBaseSchema.Schema1](#schema1)
    schema class | +| sealed interface | [AnyofWithBaseSchema.Schema0Boxed](#schema0boxed)
    sealed interface for validated payloads | +| record | [AnyofWithBaseSchema.Schema0BoxedVoid](#schema0boxedvoid)
    boxed class to store validated null payloads | +| record | [AnyofWithBaseSchema.Schema0BoxedBoolean](#schema0boxedboolean)
    boxed class to store validated boolean payloads | +| record | [AnyofWithBaseSchema.Schema0BoxedNumber](#schema0boxednumber)
    boxed class to store validated Number payloads | +| record | [AnyofWithBaseSchema.Schema0BoxedString](#schema0boxedstring)
    boxed class to store validated String payloads | +| record | [AnyofWithBaseSchema.Schema0BoxedList](#schema0boxedlist)
    boxed class to store validated List payloads | +| record | [AnyofWithBaseSchema.Schema0BoxedMap](#schema0boxedmap)
    boxed class to store validated Map payloads | +| static class | [AnyofWithBaseSchema.Schema0](#schema0)
    schema class | + +## AnyofWithBaseSchema1Boxed +sealed interface AnyofWithBaseSchema1Boxed
    +permits
    +[AnyofWithBaseSchema1BoxedString](#anyofwithbaseschema1boxedstring) + +sealed interface that stores validated payloads using boxed classes + +## AnyofWithBaseSchema1BoxedString +data class AnyofWithBaseSchema1BoxedString
    +implements [AnyofWithBaseSchema1Boxed](#anyofwithbaseschema1boxed) + +data class that stores validated String payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| AnyofWithBaseSchema1BoxedString(String data)
    Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| String | data()
    validated payload | +| Any? | getData()
    validated payload | + +## AnyofWithBaseSchema1 +class AnyofWithBaseSchema1
    +extends JsonSchema + +A schema class that validates payloads + +### Code Sample +``` +import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags; +import org.openapijsonschematools.client.configurations.SchemaConfiguration; +import org.openapijsonschematools.client.exceptions.ValidationException; +import org.openapijsonschematools.client.schemas.validation.MapUtils; +import org.openapijsonschematools.client.schemas.validation.FrozenList; +import org.openapijsonschematools.client.schemas.validation.FrozenMap; +import org.openapijsonschematools.client.components.schemas.AnyofWithBaseSchema; + +import java.util.Arrays; +import java.util.List; +import java.util.AbstractMap; + +static final SchemaConfiguration configuration = new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().build()); + +// String validation +String validatedPayload = AnyofWithBaseSchema.AnyofWithBaseSchema1.validate( + "a", + configuration +); +``` + +### Field Summary +| Modifier and Type | Field and Description | +| ----------------- | ---------------------- | +| Set> | type = setOf(
        String::class.java
    )
    | +| List> | anyOf = listOf(
        [Schema0::class.java](#schema0),
        [Schema1::class.java](#schema1)
    )
    | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| String | validate(arg: String, configuration: SchemaConfiguration) | +| [AnyofWithBaseSchema1BoxedString](#anyofwithbaseschema1boxedstring) | validateAndBox(String, configuration: SchemaConfiguration) | +| [AnyofWithBaseSchema1Boxed](#anyofwithbaseschema1boxed) | validateAndBox(Any?, configuration: SchemaConfiguration) | +| Any? | validate(arg: Any?, configuration: SchemaConfiguration) | + +## Schema1Boxed +sealed interface Schema1Boxed
    +permits
    +[Schema1BoxedVoid](#schema1boxedvoid), +[Schema1BoxedBoolean](#schema1boxedboolean), +[Schema1BoxedNumber](#schema1boxednumber), +[Schema1BoxedString](#schema1boxedstring), +[Schema1BoxedList](#schema1boxedlist), +[Schema1BoxedMap](#schema1boxedmap) + +sealed interface that stores validated payloads using boxed classes + +## Schema1BoxedVoid +data class Schema1BoxedVoid
    +implements [Schema1Boxed](#schema1boxed) + +data class that stores validated null payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| Schema1BoxedVoid(Nothing? data)
    Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| Nothing? | data()
    validated payload | +| Any? | getData()
    validated payload | + +## Schema1BoxedBoolean +data class Schema1BoxedBoolean
    +implements [Schema1Boxed](#schema1boxed) + +record that stores validated boolean payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| Schema1BoxedBoolean(boolean data)
    Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| boolean | data()
    validated payload | +| Any? | getData()
    validated payload | + +## Schema1BoxedNumber +data class Schema1BoxedNumber
    +implements [Schema1Boxed](#schema1boxed) + +data class that stores validated Number payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| Schema1BoxedNumber(Number data)
    Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| Number | data()
    validated payload | +| Any? | getData()
    validated payload | + +## Schema1BoxedString +data class Schema1BoxedString
    +implements [Schema1Boxed](#schema1boxed) + +data class that stores validated String payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| Schema1BoxedString(String data)
    Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| String | data()
    validated payload | +| Any? | getData()
    validated payload | + +## Schema1BoxedList +data class Schema1BoxedList
    +implements [Schema1Boxed](#schema1boxed) + +data class that stores validated List payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| Schema1BoxedList(FrozenList data)
    Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| FrozenList | data()
    validated payload | +| Any? | getData()
    validated payload | + +## Schema1BoxedMap +data class Schema1BoxedMap
    +implements [Schema1Boxed](#schema1boxed) + +data class that stores validated Map payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| Schema1BoxedMap(FrozenMap data)
    Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| FrozenMap | data()
    validated payload | +| Any? | getData()
    validated payload | + +## Schema1 +class Schema1
    +extends JsonSchema + +A schema class that validates payloads + +### Field Summary +| Modifier and Type | Field and Description | +| ----------------- | ---------------------- | +| Integer | minLength = 4 | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| String | validate(arg: String, configuration: SchemaConfiguration) | +| Nothing? | validate(arg: Nothing?, configuration: SchemaConfiguration) | +| int | validate(arg: int, configuration: SchemaConfiguration) | +| long | validate(arg: long, configuration: SchemaConfiguration) | +| float | validate(arg: float, configuration: SchemaConfiguration) | +| double | validate(arg: double, configuration: SchemaConfiguration) | +| Number | validate(arg: Number, configuration: SchemaConfiguration) | +| boolean | validate(arg: boolean, configuration: SchemaConfiguration) | +| FrozenMap | validate(arg: Map<?, ?>, configuration: SchemaConfiguration) | +| FrozenList | validate(arg: List<*>, configuration: SchemaConfiguration) | +| [Schema1BoxedString](#schema1boxedstring) | validateAndBox(String, configuration: SchemaConfiguration) | +| [Schema1BoxedVoid](#schema1boxedvoid) | validateAndBox(Nothing?, configuration: SchemaConfiguration) | +| [Schema1BoxedNumber](#schema1boxednumber) | validateAndBox(Number, configuration: SchemaConfiguration) | +| [Schema1BoxedBoolean](#schema1boxedboolean) | validateAndBox(boolean, configuration: SchemaConfiguration) | +| [Schema1BoxedMap](#schema1boxedmap) | validateAndBox(Map<?, ?>, configuration: SchemaConfiguration) | +| [Schema1BoxedList](#schema1boxedlist) | validateAndBox(List<*>, configuration: SchemaConfiguration) | +| [Schema1Boxed](#schema1boxed) | validateAndBox(Any?, configuration: SchemaConfiguration) | +| Any? | validate(arg: Any?, configuration: SchemaConfiguration) | + +## Schema0Boxed +sealed interface Schema0Boxed
    +permits
    +[Schema0BoxedVoid](#schema0boxedvoid), +[Schema0BoxedBoolean](#schema0boxedboolean), +[Schema0BoxedNumber](#schema0boxednumber), +[Schema0BoxedString](#schema0boxedstring), +[Schema0BoxedList](#schema0boxedlist), +[Schema0BoxedMap](#schema0boxedmap) + +sealed interface that stores validated payloads using boxed classes + +## Schema0BoxedVoid +data class Schema0BoxedVoid
    +implements [Schema0Boxed](#schema0boxed) + +data class that stores validated null payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| Schema0BoxedVoid(Nothing? data)
    Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| Nothing? | data()
    validated payload | +| Any? | getData()
    validated payload | + +## Schema0BoxedBoolean +data class Schema0BoxedBoolean
    +implements [Schema0Boxed](#schema0boxed) + +record that stores validated boolean payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| Schema0BoxedBoolean(boolean data)
    Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| boolean | data()
    validated payload | +| Any? | getData()
    validated payload | + +## Schema0BoxedNumber +data class Schema0BoxedNumber
    +implements [Schema0Boxed](#schema0boxed) + +data class that stores validated Number payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| Schema0BoxedNumber(Number data)
    Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| Number | data()
    validated payload | +| Any? | getData()
    validated payload | + +## Schema0BoxedString +data class Schema0BoxedString
    +implements [Schema0Boxed](#schema0boxed) + +data class that stores validated String payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| Schema0BoxedString(String data)
    Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| String | data()
    validated payload | +| Any? | getData()
    validated payload | + +## Schema0BoxedList +data class Schema0BoxedList
    +implements [Schema0Boxed](#schema0boxed) + +data class that stores validated List payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| Schema0BoxedList(FrozenList data)
    Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| FrozenList | data()
    validated payload | +| Any? | getData()
    validated payload | + +## Schema0BoxedMap +data class Schema0BoxedMap
    +implements [Schema0Boxed](#schema0boxed) + +data class that stores validated Map payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| Schema0BoxedMap(FrozenMap data)
    Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| FrozenMap | data()
    validated payload | +| Any? | getData()
    validated payload | + +## Schema0 +class Schema0
    +extends JsonSchema + +A schema class that validates payloads + +### Field Summary +| Modifier and Type | Field and Description | +| ----------------- | ---------------------- | +| Integer | maxLength = 2 | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| String | validate(arg: String, configuration: SchemaConfiguration) | +| Nothing? | validate(arg: Nothing?, configuration: SchemaConfiguration) | +| int | validate(arg: int, configuration: SchemaConfiguration) | +| long | validate(arg: long, configuration: SchemaConfiguration) | +| float | validate(arg: float, configuration: SchemaConfiguration) | +| double | validate(arg: double, configuration: SchemaConfiguration) | +| Number | validate(arg: Number, configuration: SchemaConfiguration) | +| boolean | validate(arg: boolean, configuration: SchemaConfiguration) | +| FrozenMap | validate(arg: Map<?, ?>, configuration: SchemaConfiguration) | +| FrozenList | validate(arg: List<*>, configuration: SchemaConfiguration) | +| [Schema0BoxedString](#schema0boxedstring) | validateAndBox(String, configuration: SchemaConfiguration) | +| [Schema0BoxedVoid](#schema0boxedvoid) | validateAndBox(Nothing?, configuration: SchemaConfiguration) | +| [Schema0BoxedNumber](#schema0boxednumber) | validateAndBox(Number, configuration: SchemaConfiguration) | +| [Schema0BoxedBoolean](#schema0boxedboolean) | validateAndBox(boolean, configuration: SchemaConfiguration) | +| [Schema0BoxedMap](#schema0boxedmap) | validateAndBox(Map<?, ?>, configuration: SchemaConfiguration) | +| [Schema0BoxedList](#schema0boxedlist) | validateAndBox(List<*>, configuration: SchemaConfiguration) | +| [Schema0Boxed](#schema0boxed) | validateAndBox(Any?, configuration: SchemaConfiguration) | +| Any? | validate(arg: Any?, configuration: SchemaConfiguration) | + +[[Back to top]](#top) [[Back to Component Schemas]](../../../README.md#Component-Schemas) [[Back to README]](../../../README.md) diff --git a/samples/client/3_1_0_unit_test/kotlin/docs/components/schemas/AnyofWithOneEmptySchema.md b/samples/client/3_1_0_unit_test/kotlin/docs/components/schemas/AnyofWithOneEmptySchema.md new file mode 100644 index 00000000000..9dacfd34348 --- /dev/null +++ b/samples/client/3_1_0_unit_test/kotlin/docs/components/schemas/AnyofWithOneEmptySchema.md @@ -0,0 +1,340 @@ +# AnyofWithOneEmptySchema +org.openapijsonschematools.client.components.schemas.AnyofWithOneEmptySchema.java +class AnyofWithOneEmptySchema
    + +A class that contains necessary nested +- schema classes (which validate payloads), extends JsonSchema +- sealed interfaces which store validated payloads, Kotlin version of a sum type +- boxed classes which store validated payloads, sealed permits class implementations + +## Nested Class Summary +| Modifier and Type | Class and Description | +| ----------------- | ---------------------- | +| sealed interface | [AnyofWithOneEmptySchema.AnyofWithOneEmptySchema1Boxed](#anyofwithoneemptyschema1boxed)
    sealed interface for validated payloads | +| record | [AnyofWithOneEmptySchema.AnyofWithOneEmptySchema1BoxedVoid](#anyofwithoneemptyschema1boxedvoid)
    boxed class to store validated null payloads | +| record | [AnyofWithOneEmptySchema.AnyofWithOneEmptySchema1BoxedBoolean](#anyofwithoneemptyschema1boxedboolean)
    boxed class to store validated boolean payloads | +| record | [AnyofWithOneEmptySchema.AnyofWithOneEmptySchema1BoxedNumber](#anyofwithoneemptyschema1boxednumber)
    boxed class to store validated Number payloads | +| record | [AnyofWithOneEmptySchema.AnyofWithOneEmptySchema1BoxedString](#anyofwithoneemptyschema1boxedstring)
    boxed class to store validated String payloads | +| record | [AnyofWithOneEmptySchema.AnyofWithOneEmptySchema1BoxedList](#anyofwithoneemptyschema1boxedlist)
    boxed class to store validated List payloads | +| record | [AnyofWithOneEmptySchema.AnyofWithOneEmptySchema1BoxedMap](#anyofwithoneemptyschema1boxedmap)
    boxed class to store validated Map payloads | +| static class | [AnyofWithOneEmptySchema.AnyofWithOneEmptySchema1](#anyofwithoneemptyschema1)
    schema class | +| sealed interface | [AnyofWithOneEmptySchema.Schema1Boxed](#schema1boxed)
    sealed interface for validated payloads | +| record | [AnyofWithOneEmptySchema.Schema1BoxedVoid](#schema1boxedvoid)
    boxed class to store validated null payloads | +| record | [AnyofWithOneEmptySchema.Schema1BoxedBoolean](#schema1boxedboolean)
    boxed class to store validated boolean payloads | +| record | [AnyofWithOneEmptySchema.Schema1BoxedNumber](#schema1boxednumber)
    boxed class to store validated Number payloads | +| record | [AnyofWithOneEmptySchema.Schema1BoxedString](#schema1boxedstring)
    boxed class to store validated String payloads | +| record | [AnyofWithOneEmptySchema.Schema1BoxedList](#schema1boxedlist)
    boxed class to store validated List payloads | +| record | [AnyofWithOneEmptySchema.Schema1BoxedMap](#schema1boxedmap)
    boxed class to store validated Map payloads | +| static class | [AnyofWithOneEmptySchema.Schema1](#schema1)
    schema class | +| sealed interface | [AnyofWithOneEmptySchema.Schema0Boxed](#schema0boxed)
    sealed interface for validated payloads | +| record | [AnyofWithOneEmptySchema.Schema0BoxedNumber](#schema0boxednumber)
    boxed class to store validated Number payloads | +| static class | [AnyofWithOneEmptySchema.Schema0](#schema0)
    schema class | + +## AnyofWithOneEmptySchema1Boxed +sealed interface AnyofWithOneEmptySchema1Boxed
    +permits
    +[AnyofWithOneEmptySchema1BoxedVoid](#anyofwithoneemptyschema1boxedvoid), +[AnyofWithOneEmptySchema1BoxedBoolean](#anyofwithoneemptyschema1boxedboolean), +[AnyofWithOneEmptySchema1BoxedNumber](#anyofwithoneemptyschema1boxednumber), +[AnyofWithOneEmptySchema1BoxedString](#anyofwithoneemptyschema1boxedstring), +[AnyofWithOneEmptySchema1BoxedList](#anyofwithoneemptyschema1boxedlist), +[AnyofWithOneEmptySchema1BoxedMap](#anyofwithoneemptyschema1boxedmap) + +sealed interface that stores validated payloads using boxed classes + +## AnyofWithOneEmptySchema1BoxedVoid +data class AnyofWithOneEmptySchema1BoxedVoid
    +implements [AnyofWithOneEmptySchema1Boxed](#anyofwithoneemptyschema1boxed) + +data class that stores validated null payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| AnyofWithOneEmptySchema1BoxedVoid(Nothing? data)
    Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| Nothing? | data()
    validated payload | +| Any? | getData()
    validated payload | + +## AnyofWithOneEmptySchema1BoxedBoolean +data class AnyofWithOneEmptySchema1BoxedBoolean
    +implements [AnyofWithOneEmptySchema1Boxed](#anyofwithoneemptyschema1boxed) + +record that stores validated boolean payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| AnyofWithOneEmptySchema1BoxedBoolean(boolean data)
    Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| boolean | data()
    validated payload | +| Any? | getData()
    validated payload | + +## AnyofWithOneEmptySchema1BoxedNumber +data class AnyofWithOneEmptySchema1BoxedNumber
    +implements [AnyofWithOneEmptySchema1Boxed](#anyofwithoneemptyschema1boxed) + +data class that stores validated Number payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| AnyofWithOneEmptySchema1BoxedNumber(Number data)
    Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| Number | data()
    validated payload | +| Any? | getData()
    validated payload | + +## AnyofWithOneEmptySchema1BoxedString +data class AnyofWithOneEmptySchema1BoxedString
    +implements [AnyofWithOneEmptySchema1Boxed](#anyofwithoneemptyschema1boxed) + +data class that stores validated String payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| AnyofWithOneEmptySchema1BoxedString(String data)
    Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| String | data()
    validated payload | +| Any? | getData()
    validated payload | + +## AnyofWithOneEmptySchema1BoxedList +data class AnyofWithOneEmptySchema1BoxedList
    +implements [AnyofWithOneEmptySchema1Boxed](#anyofwithoneemptyschema1boxed) + +data class that stores validated List payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| AnyofWithOneEmptySchema1BoxedList(FrozenList data)
    Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| FrozenList | data()
    validated payload | +| Any? | getData()
    validated payload | + +## AnyofWithOneEmptySchema1BoxedMap +data class AnyofWithOneEmptySchema1BoxedMap
    +implements [AnyofWithOneEmptySchema1Boxed](#anyofwithoneemptyschema1boxed) + +data class that stores validated Map payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| AnyofWithOneEmptySchema1BoxedMap(FrozenMap data)
    Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| FrozenMap | data()
    validated payload | +| Any? | getData()
    validated payload | + +## AnyofWithOneEmptySchema1 +class AnyofWithOneEmptySchema1
    +extends JsonSchema + +A schema class that validates payloads + +### Field Summary +| Modifier and Type | Field and Description | +| ----------------- | ---------------------- | +| List> | anyOf = listOf(
        [Schema0::class.java](#schema0),
        [Schema1::class.java](#schema1)
    )
    | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| String | validate(arg: String, configuration: SchemaConfiguration) | +| Nothing? | validate(arg: Nothing?, configuration: SchemaConfiguration) | +| int | validate(arg: int, configuration: SchemaConfiguration) | +| long | validate(arg: long, configuration: SchemaConfiguration) | +| float | validate(arg: float, configuration: SchemaConfiguration) | +| double | validate(arg: double, configuration: SchemaConfiguration) | +| Number | validate(arg: Number, configuration: SchemaConfiguration) | +| boolean | validate(arg: boolean, configuration: SchemaConfiguration) | +| FrozenMap | validate(arg: Map<?, ?>, configuration: SchemaConfiguration) | +| FrozenList | validate(arg: List<*>, configuration: SchemaConfiguration) | +| [AnyofWithOneEmptySchema1BoxedString](#anyofwithoneemptyschema1boxedstring) | validateAndBox(String, configuration: SchemaConfiguration) | +| [AnyofWithOneEmptySchema1BoxedVoid](#anyofwithoneemptyschema1boxedvoid) | validateAndBox(Nothing?, configuration: SchemaConfiguration) | +| [AnyofWithOneEmptySchema1BoxedNumber](#anyofwithoneemptyschema1boxednumber) | validateAndBox(Number, configuration: SchemaConfiguration) | +| [AnyofWithOneEmptySchema1BoxedBoolean](#anyofwithoneemptyschema1boxedboolean) | validateAndBox(boolean, configuration: SchemaConfiguration) | +| [AnyofWithOneEmptySchema1BoxedMap](#anyofwithoneemptyschema1boxedmap) | validateAndBox(Map<?, ?>, configuration: SchemaConfiguration) | +| [AnyofWithOneEmptySchema1BoxedList](#anyofwithoneemptyschema1boxedlist) | validateAndBox(List<*>, configuration: SchemaConfiguration) | +| [AnyofWithOneEmptySchema1Boxed](#anyofwithoneemptyschema1boxed) | validateAndBox(Any?, configuration: SchemaConfiguration) | +| Any? | validate(arg: Any?, configuration: SchemaConfiguration) | + +## Schema1Boxed +sealed interface Schema1Boxed
    +permits
    +[Schema1BoxedVoid](#schema1boxedvoid), +[Schema1BoxedBoolean](#schema1boxedboolean), +[Schema1BoxedNumber](#schema1boxednumber), +[Schema1BoxedString](#schema1boxedstring), +[Schema1BoxedList](#schema1boxedlist), +[Schema1BoxedMap](#schema1boxedmap) + +sealed interface that stores validated payloads using boxed classes + +## Schema1BoxedVoid +data class Schema1BoxedVoid
    +implements [Schema1Boxed](#schema1boxed) + +data class that stores validated null payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| Schema1BoxedVoid(Nothing? data)
    Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| Nothing? | data()
    validated payload | +| Any? | getData()
    validated payload | + +## Schema1BoxedBoolean +data class Schema1BoxedBoolean
    +implements [Schema1Boxed](#schema1boxed) + +record that stores validated boolean payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| Schema1BoxedBoolean(boolean data)
    Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| boolean | data()
    validated payload | +| Any? | getData()
    validated payload | + +## Schema1BoxedNumber +data class Schema1BoxedNumber
    +implements [Schema1Boxed](#schema1boxed) + +data class that stores validated Number payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| Schema1BoxedNumber(Number data)
    Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| Number | data()
    validated payload | +| Any? | getData()
    validated payload | + +## Schema1BoxedString +data class Schema1BoxedString
    +implements [Schema1Boxed](#schema1boxed) + +data class that stores validated String payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| Schema1BoxedString(String data)
    Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| String | data()
    validated payload | +| Any? | getData()
    validated payload | + +## Schema1BoxedList +data class Schema1BoxedList
    +implements [Schema1Boxed](#schema1boxed) + +data class that stores validated List payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| Schema1BoxedList(FrozenList data)
    Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| FrozenList | data()
    validated payload | +| Any? | getData()
    validated payload | + +## Schema1BoxedMap +data class Schema1BoxedMap
    +implements [Schema1Boxed](#schema1boxed) + +data class that stores validated Map payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| Schema1BoxedMap(FrozenMap data)
    Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| FrozenMap | data()
    validated payload | +| Any? | getData()
    validated payload | + +## Schema1 +class Schema1
    +extends AnyTypeJsonSchema.AnyTypeJsonSchema1 + +A schema class that validates payloads + +| Methods Inherited from class org.openapijsonschematools.client.schemas.AnyTypeJsonSchema.AnyTypeJsonSchema1 | +| ------------------------------------------------------------------ | +| validate | +| validateAndBox | + +## Schema0Boxed +sealed interface Schema0Boxed
    +permits
    +[Schema0BoxedNumber](#schema0boxednumber) + +sealed interface that stores validated payloads using boxed classes + +## Schema0BoxedNumber +data class Schema0BoxedNumber
    +implements [Schema0Boxed](#schema0boxed) + +data class that stores validated Number payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| Schema0BoxedNumber(Number data)
    Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| Number | data()
    validated payload | +| Any? | getData()
    validated payload | + +## Schema0 +class Schema0
    +extends NumberJsonSchema.NumberJsonSchema1 + +A schema class that validates payloads + +| Methods Inherited from class org.openapijsonschematools.client.schemas.NumberJsonSchema.NumberJsonSchema1 | +| ------------------------------------------------------------------ | +| validate | +| validateAndBox | + +[[Back to top]](#top) [[Back to Component Schemas]](../../../README.md#Component-Schemas) [[Back to README]](../../../README.md) diff --git a/samples/client/3_1_0_unit_test/kotlin/docs/components/schemas/ArrayTypeMatchesArrays.md b/samples/client/3_1_0_unit_test/kotlin/docs/components/schemas/ArrayTypeMatchesArrays.md new file mode 100644 index 00000000000..f96565a4be4 --- /dev/null +++ b/samples/client/3_1_0_unit_test/kotlin/docs/components/schemas/ArrayTypeMatchesArrays.md @@ -0,0 +1,52 @@ +# ArrayTypeMatchesArrays +org.openapijsonschematools.client.components.schemas.ArrayTypeMatchesArrays.java +class ArrayTypeMatchesArrays
    + +A class that contains necessary nested +- schema classes (which validate payloads), extends JsonSchema +- sealed interfaces which store validated payloads, Kotlin version of a sum type +- boxed classes which store validated payloads, sealed permits class implementations + +## Nested Class Summary +| Modifier and Type | Class and Description | +| ----------------- | ---------------------- | +| sealed interface | [ArrayTypeMatchesArrays.ArrayTypeMatchesArrays1Boxed](#arraytypematchesarrays1boxed)
    sealed interface for validated payloads | +| record | [ArrayTypeMatchesArrays.ArrayTypeMatchesArrays1BoxedList](#arraytypematchesarrays1boxedlist)
    boxed class to store validated List payloads | +| static class | [ArrayTypeMatchesArrays.ArrayTypeMatchesArrays1](#arraytypematchesarrays1)
    schema class | + +## ArrayTypeMatchesArrays1Boxed +sealed interface ArrayTypeMatchesArrays1Boxed
    +permits
    +[ArrayTypeMatchesArrays1BoxedList](#arraytypematchesarrays1boxedlist) + +sealed interface that stores validated payloads using boxed classes + +## ArrayTypeMatchesArrays1BoxedList +data class ArrayTypeMatchesArrays1BoxedList
    +implements [ArrayTypeMatchesArrays1Boxed](#arraytypematchesarrays1boxed) + +data class that stores validated List payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| ArrayTypeMatchesArrays1BoxedList(FrozenList data)
    Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| FrozenList | data()
    validated payload | +| Any? | getData()
    validated payload | + +## ArrayTypeMatchesArrays1 +class ArrayTypeMatchesArrays1
    +extends ListJsonSchema.ListJsonSchema1 + +A schema class that validates payloads + +| Methods Inherited from class org.openapijsonschematools.client.schemas.ListJsonSchema.ListJsonSchema1 | +| ------------------------------------------------------------------ | +| validate | +| validateAndBox | + +[[Back to top]](#top) [[Back to Component Schemas]](../../../README.md#Component-Schemas) [[Back to README]](../../../README.md) diff --git a/samples/client/3_1_0_unit_test/kotlin/docs/components/schemas/BooleanTypeMatchesBooleans.md b/samples/client/3_1_0_unit_test/kotlin/docs/components/schemas/BooleanTypeMatchesBooleans.md new file mode 100644 index 00000000000..e64f7f92c4a --- /dev/null +++ b/samples/client/3_1_0_unit_test/kotlin/docs/components/schemas/BooleanTypeMatchesBooleans.md @@ -0,0 +1,52 @@ +# BooleanTypeMatchesBooleans +org.openapijsonschematools.client.components.schemas.BooleanTypeMatchesBooleans.java +class BooleanTypeMatchesBooleans
    + +A class that contains necessary nested +- schema classes (which validate payloads), extends JsonSchema +- sealed interfaces which store validated payloads, Kotlin version of a sum type +- boxed classes which store validated payloads, sealed permits class implementations + +## Nested Class Summary +| Modifier and Type | Class and Description | +| ----------------- | ---------------------- | +| sealed interface | [BooleanTypeMatchesBooleans.BooleanTypeMatchesBooleans1Boxed](#booleantypematchesbooleans1boxed)
    sealed interface for validated payloads | +| record | [BooleanTypeMatchesBooleans.BooleanTypeMatchesBooleans1BoxedBoolean](#booleantypematchesbooleans1boxedboolean)
    boxed class to store validated boolean payloads | +| static class | [BooleanTypeMatchesBooleans.BooleanTypeMatchesBooleans1](#booleantypematchesbooleans1)
    schema class | + +## BooleanTypeMatchesBooleans1Boxed +sealed interface BooleanTypeMatchesBooleans1Boxed
    +permits
    +[BooleanTypeMatchesBooleans1BoxedBoolean](#booleantypematchesbooleans1boxedboolean) + +sealed interface that stores validated payloads using boxed classes + +## BooleanTypeMatchesBooleans1BoxedBoolean +data class BooleanTypeMatchesBooleans1BoxedBoolean
    +implements [BooleanTypeMatchesBooleans1Boxed](#booleantypematchesbooleans1boxed) + +record that stores validated boolean payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| BooleanTypeMatchesBooleans1BoxedBoolean(boolean data)
    Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| boolean | data()
    validated payload | +| Any? | getData()
    validated payload | + +## BooleanTypeMatchesBooleans1 +class BooleanTypeMatchesBooleans1
    +extends BooleanJsonSchema.BooleanJsonSchema1 + +A schema class that validates payloads + +| Methods Inherited from class org.openapijsonschematools.client.schemas.BooleanJsonSchema.BooleanJsonSchema1 | +| ------------------------------------------------------------------ | +| validate | +| validateAndBox | + +[[Back to top]](#top) [[Back to Component Schemas]](../../../README.md#Component-Schemas) [[Back to README]](../../../README.md) diff --git a/samples/client/3_1_0_unit_test/kotlin/docs/components/schemas/ByInt.md b/samples/client/3_1_0_unit_test/kotlin/docs/components/schemas/ByInt.md new file mode 100644 index 00000000000..1d2e173784f --- /dev/null +++ b/samples/client/3_1_0_unit_test/kotlin/docs/components/schemas/ByInt.md @@ -0,0 +1,169 @@ +# ByInt +org.openapijsonschematools.client.components.schemas.ByInt.java +class ByInt
    + +A class that contains necessary nested +- schema classes (which validate payloads), extends JsonSchema +- sealed interfaces which store validated payloads, Kotlin version of a sum type +- boxed classes which store validated payloads, sealed permits class implementations + +## Nested Class Summary +| Modifier and Type | Class and Description | +| ----------------- | ---------------------- | +| sealed interface | [ByInt.ByInt1Boxed](#byint1boxed)
    sealed interface for validated payloads | +| record | [ByInt.ByInt1BoxedVoid](#byint1boxedvoid)
    boxed class to store validated null payloads | +| record | [ByInt.ByInt1BoxedBoolean](#byint1boxedboolean)
    boxed class to store validated boolean payloads | +| record | [ByInt.ByInt1BoxedNumber](#byint1boxednumber)
    boxed class to store validated Number payloads | +| record | [ByInt.ByInt1BoxedString](#byint1boxedstring)
    boxed class to store validated String payloads | +| record | [ByInt.ByInt1BoxedList](#byint1boxedlist)
    boxed class to store validated List payloads | +| record | [ByInt.ByInt1BoxedMap](#byint1boxedmap)
    boxed class to store validated Map payloads | +| static class | [ByInt.ByInt1](#byint1)
    schema class | + +## ByInt1Boxed +sealed interface ByInt1Boxed
    +permits
    +[ByInt1BoxedVoid](#byint1boxedvoid), +[ByInt1BoxedBoolean](#byint1boxedboolean), +[ByInt1BoxedNumber](#byint1boxednumber), +[ByInt1BoxedString](#byint1boxedstring), +[ByInt1BoxedList](#byint1boxedlist), +[ByInt1BoxedMap](#byint1boxedmap) + +sealed interface that stores validated payloads using boxed classes + +## ByInt1BoxedVoid +data class ByInt1BoxedVoid
    +implements [ByInt1Boxed](#byint1boxed) + +data class that stores validated null payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| ByInt1BoxedVoid(Nothing? data)
    Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| Nothing? | data()
    validated payload | +| Any? | getData()
    validated payload | + +## ByInt1BoxedBoolean +data class ByInt1BoxedBoolean
    +implements [ByInt1Boxed](#byint1boxed) + +record that stores validated boolean payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| ByInt1BoxedBoolean(boolean data)
    Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| boolean | data()
    validated payload | +| Any? | getData()
    validated payload | + +## ByInt1BoxedNumber +data class ByInt1BoxedNumber
    +implements [ByInt1Boxed](#byint1boxed) + +data class that stores validated Number payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| ByInt1BoxedNumber(Number data)
    Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| Number | data()
    validated payload | +| Any? | getData()
    validated payload | + +## ByInt1BoxedString +data class ByInt1BoxedString
    +implements [ByInt1Boxed](#byint1boxed) + +data class that stores validated String payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| ByInt1BoxedString(String data)
    Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| String | data()
    validated payload | +| Any? | getData()
    validated payload | + +## ByInt1BoxedList +data class ByInt1BoxedList
    +implements [ByInt1Boxed](#byint1boxed) + +data class that stores validated List payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| ByInt1BoxedList(FrozenList data)
    Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| FrozenList | data()
    validated payload | +| Any? | getData()
    validated payload | + +## ByInt1BoxedMap +data class ByInt1BoxedMap
    +implements [ByInt1Boxed](#byint1boxed) + +data class that stores validated Map payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| ByInt1BoxedMap(FrozenMap data)
    Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| FrozenMap | data()
    validated payload | +| Any? | getData()
    validated payload | + +## ByInt1 +class ByInt1
    +extends JsonSchema + +A schema class that validates payloads + +### Field Summary +| Modifier and Type | Field and Description | +| ----------------- | ---------------------- | +| BigDecimal | multipleOf = BigDecimal("2") | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| String | validate(arg: String, configuration: SchemaConfiguration) | +| Nothing? | validate(arg: Nothing?, configuration: SchemaConfiguration) | +| int | validate(arg: int, configuration: SchemaConfiguration) | +| long | validate(arg: long, configuration: SchemaConfiguration) | +| float | validate(arg: float, configuration: SchemaConfiguration) | +| double | validate(arg: double, configuration: SchemaConfiguration) | +| Number | validate(arg: Number, configuration: SchemaConfiguration) | +| boolean | validate(arg: boolean, configuration: SchemaConfiguration) | +| FrozenMap | validate(arg: Map<?, ?>, configuration: SchemaConfiguration) | +| FrozenList | validate(arg: List<*>, configuration: SchemaConfiguration) | +| [ByInt1BoxedString](#byint1boxedstring) | validateAndBox(String, configuration: SchemaConfiguration) | +| [ByInt1BoxedVoid](#byint1boxedvoid) | validateAndBox(Nothing?, configuration: SchemaConfiguration) | +| [ByInt1BoxedNumber](#byint1boxednumber) | validateAndBox(Number, configuration: SchemaConfiguration) | +| [ByInt1BoxedBoolean](#byint1boxedboolean) | validateAndBox(boolean, configuration: SchemaConfiguration) | +| [ByInt1BoxedMap](#byint1boxedmap) | validateAndBox(Map<?, ?>, configuration: SchemaConfiguration) | +| [ByInt1BoxedList](#byint1boxedlist) | validateAndBox(List<*>, configuration: SchemaConfiguration) | +| [ByInt1Boxed](#byint1boxed) | validateAndBox(Any?, configuration: SchemaConfiguration) | +| Any? | validate(arg: Any?, configuration: SchemaConfiguration) | + +[[Back to top]](#top) [[Back to Component Schemas]](../../../README.md#Component-Schemas) [[Back to README]](../../../README.md) diff --git a/samples/client/3_1_0_unit_test/kotlin/docs/components/schemas/ByNumber.md b/samples/client/3_1_0_unit_test/kotlin/docs/components/schemas/ByNumber.md new file mode 100644 index 00000000000..0ef752b157e --- /dev/null +++ b/samples/client/3_1_0_unit_test/kotlin/docs/components/schemas/ByNumber.md @@ -0,0 +1,169 @@ +# ByNumber +org.openapijsonschematools.client.components.schemas.ByNumber.java +class ByNumber
    + +A class that contains necessary nested +- schema classes (which validate payloads), extends JsonSchema +- sealed interfaces which store validated payloads, Kotlin version of a sum type +- boxed classes which store validated payloads, sealed permits class implementations + +## Nested Class Summary +| Modifier and Type | Class and Description | +| ----------------- | ---------------------- | +| sealed interface | [ByNumber.ByNumber1Boxed](#bynumber1boxed)
    sealed interface for validated payloads | +| record | [ByNumber.ByNumber1BoxedVoid](#bynumber1boxedvoid)
    boxed class to store validated null payloads | +| record | [ByNumber.ByNumber1BoxedBoolean](#bynumber1boxedboolean)
    boxed class to store validated boolean payloads | +| record | [ByNumber.ByNumber1BoxedNumber](#bynumber1boxednumber)
    boxed class to store validated Number payloads | +| record | [ByNumber.ByNumber1BoxedString](#bynumber1boxedstring)
    boxed class to store validated String payloads | +| record | [ByNumber.ByNumber1BoxedList](#bynumber1boxedlist)
    boxed class to store validated List payloads | +| record | [ByNumber.ByNumber1BoxedMap](#bynumber1boxedmap)
    boxed class to store validated Map payloads | +| static class | [ByNumber.ByNumber1](#bynumber1)
    schema class | + +## ByNumber1Boxed +sealed interface ByNumber1Boxed
    +permits
    +[ByNumber1BoxedVoid](#bynumber1boxedvoid), +[ByNumber1BoxedBoolean](#bynumber1boxedboolean), +[ByNumber1BoxedNumber](#bynumber1boxednumber), +[ByNumber1BoxedString](#bynumber1boxedstring), +[ByNumber1BoxedList](#bynumber1boxedlist), +[ByNumber1BoxedMap](#bynumber1boxedmap) + +sealed interface that stores validated payloads using boxed classes + +## ByNumber1BoxedVoid +data class ByNumber1BoxedVoid
    +implements [ByNumber1Boxed](#bynumber1boxed) + +data class that stores validated null payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| ByNumber1BoxedVoid(Nothing? data)
    Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| Nothing? | data()
    validated payload | +| Any? | getData()
    validated payload | + +## ByNumber1BoxedBoolean +data class ByNumber1BoxedBoolean
    +implements [ByNumber1Boxed](#bynumber1boxed) + +record that stores validated boolean payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| ByNumber1BoxedBoolean(boolean data)
    Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| boolean | data()
    validated payload | +| Any? | getData()
    validated payload | + +## ByNumber1BoxedNumber +data class ByNumber1BoxedNumber
    +implements [ByNumber1Boxed](#bynumber1boxed) + +data class that stores validated Number payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| ByNumber1BoxedNumber(Number data)
    Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| Number | data()
    validated payload | +| Any? | getData()
    validated payload | + +## ByNumber1BoxedString +data class ByNumber1BoxedString
    +implements [ByNumber1Boxed](#bynumber1boxed) + +data class that stores validated String payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| ByNumber1BoxedString(String data)
    Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| String | data()
    validated payload | +| Any? | getData()
    validated payload | + +## ByNumber1BoxedList +data class ByNumber1BoxedList
    +implements [ByNumber1Boxed](#bynumber1boxed) + +data class that stores validated List payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| ByNumber1BoxedList(FrozenList data)
    Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| FrozenList | data()
    validated payload | +| Any? | getData()
    validated payload | + +## ByNumber1BoxedMap +data class ByNumber1BoxedMap
    +implements [ByNumber1Boxed](#bynumber1boxed) + +data class that stores validated Map payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| ByNumber1BoxedMap(FrozenMap data)
    Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| FrozenMap | data()
    validated payload | +| Any? | getData()
    validated payload | + +## ByNumber1 +class ByNumber1
    +extends JsonSchema + +A schema class that validates payloads + +### Field Summary +| Modifier and Type | Field and Description | +| ----------------- | ---------------------- | +| BigDecimal | multipleOf = BigDecimal("1.5") | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| String | validate(arg: String, configuration: SchemaConfiguration) | +| Nothing? | validate(arg: Nothing?, configuration: SchemaConfiguration) | +| int | validate(arg: int, configuration: SchemaConfiguration) | +| long | validate(arg: long, configuration: SchemaConfiguration) | +| float | validate(arg: float, configuration: SchemaConfiguration) | +| double | validate(arg: double, configuration: SchemaConfiguration) | +| Number | validate(arg: Number, configuration: SchemaConfiguration) | +| boolean | validate(arg: boolean, configuration: SchemaConfiguration) | +| FrozenMap | validate(arg: Map<?, ?>, configuration: SchemaConfiguration) | +| FrozenList | validate(arg: List<*>, configuration: SchemaConfiguration) | +| [ByNumber1BoxedString](#bynumber1boxedstring) | validateAndBox(String, configuration: SchemaConfiguration) | +| [ByNumber1BoxedVoid](#bynumber1boxedvoid) | validateAndBox(Nothing?, configuration: SchemaConfiguration) | +| [ByNumber1BoxedNumber](#bynumber1boxednumber) | validateAndBox(Number, configuration: SchemaConfiguration) | +| [ByNumber1BoxedBoolean](#bynumber1boxedboolean) | validateAndBox(boolean, configuration: SchemaConfiguration) | +| [ByNumber1BoxedMap](#bynumber1boxedmap) | validateAndBox(Map<?, ?>, configuration: SchemaConfiguration) | +| [ByNumber1BoxedList](#bynumber1boxedlist) | validateAndBox(List<*>, configuration: SchemaConfiguration) | +| [ByNumber1Boxed](#bynumber1boxed) | validateAndBox(Any?, configuration: SchemaConfiguration) | +| Any? | validate(arg: Any?, configuration: SchemaConfiguration) | + +[[Back to top]](#top) [[Back to Component Schemas]](../../../README.md#Component-Schemas) [[Back to README]](../../../README.md) diff --git a/samples/client/3_1_0_unit_test/kotlin/docs/components/schemas/BySmallNumber.md b/samples/client/3_1_0_unit_test/kotlin/docs/components/schemas/BySmallNumber.md new file mode 100644 index 00000000000..efb24198916 --- /dev/null +++ b/samples/client/3_1_0_unit_test/kotlin/docs/components/schemas/BySmallNumber.md @@ -0,0 +1,169 @@ +# BySmallNumber +org.openapijsonschematools.client.components.schemas.BySmallNumber.java +class BySmallNumber
    + +A class that contains necessary nested +- schema classes (which validate payloads), extends JsonSchema +- sealed interfaces which store validated payloads, Kotlin version of a sum type +- boxed classes which store validated payloads, sealed permits class implementations + +## Nested Class Summary +| Modifier and Type | Class and Description | +| ----------------- | ---------------------- | +| sealed interface | [BySmallNumber.BySmallNumber1Boxed](#bysmallnumber1boxed)
    sealed interface for validated payloads | +| record | [BySmallNumber.BySmallNumber1BoxedVoid](#bysmallnumber1boxedvoid)
    boxed class to store validated null payloads | +| record | [BySmallNumber.BySmallNumber1BoxedBoolean](#bysmallnumber1boxedboolean)
    boxed class to store validated boolean payloads | +| record | [BySmallNumber.BySmallNumber1BoxedNumber](#bysmallnumber1boxednumber)
    boxed class to store validated Number payloads | +| record | [BySmallNumber.BySmallNumber1BoxedString](#bysmallnumber1boxedstring)
    boxed class to store validated String payloads | +| record | [BySmallNumber.BySmallNumber1BoxedList](#bysmallnumber1boxedlist)
    boxed class to store validated List payloads | +| record | [BySmallNumber.BySmallNumber1BoxedMap](#bysmallnumber1boxedmap)
    boxed class to store validated Map payloads | +| static class | [BySmallNumber.BySmallNumber1](#bysmallnumber1)
    schema class | + +## BySmallNumber1Boxed +sealed interface BySmallNumber1Boxed
    +permits
    +[BySmallNumber1BoxedVoid](#bysmallnumber1boxedvoid), +[BySmallNumber1BoxedBoolean](#bysmallnumber1boxedboolean), +[BySmallNumber1BoxedNumber](#bysmallnumber1boxednumber), +[BySmallNumber1BoxedString](#bysmallnumber1boxedstring), +[BySmallNumber1BoxedList](#bysmallnumber1boxedlist), +[BySmallNumber1BoxedMap](#bysmallnumber1boxedmap) + +sealed interface that stores validated payloads using boxed classes + +## BySmallNumber1BoxedVoid +data class BySmallNumber1BoxedVoid
    +implements [BySmallNumber1Boxed](#bysmallnumber1boxed) + +data class that stores validated null payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| BySmallNumber1BoxedVoid(Nothing? data)
    Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| Nothing? | data()
    validated payload | +| Any? | getData()
    validated payload | + +## BySmallNumber1BoxedBoolean +data class BySmallNumber1BoxedBoolean
    +implements [BySmallNumber1Boxed](#bysmallnumber1boxed) + +record that stores validated boolean payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| BySmallNumber1BoxedBoolean(boolean data)
    Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| boolean | data()
    validated payload | +| Any? | getData()
    validated payload | + +## BySmallNumber1BoxedNumber +data class BySmallNumber1BoxedNumber
    +implements [BySmallNumber1Boxed](#bysmallnumber1boxed) + +data class that stores validated Number payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| BySmallNumber1BoxedNumber(Number data)
    Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| Number | data()
    validated payload | +| Any? | getData()
    validated payload | + +## BySmallNumber1BoxedString +data class BySmallNumber1BoxedString
    +implements [BySmallNumber1Boxed](#bysmallnumber1boxed) + +data class that stores validated String payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| BySmallNumber1BoxedString(String data)
    Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| String | data()
    validated payload | +| Any? | getData()
    validated payload | + +## BySmallNumber1BoxedList +data class BySmallNumber1BoxedList
    +implements [BySmallNumber1Boxed](#bysmallnumber1boxed) + +data class that stores validated List payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| BySmallNumber1BoxedList(FrozenList data)
    Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| FrozenList | data()
    validated payload | +| Any? | getData()
    validated payload | + +## BySmallNumber1BoxedMap +data class BySmallNumber1BoxedMap
    +implements [BySmallNumber1Boxed](#bysmallnumber1boxed) + +data class that stores validated Map payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| BySmallNumber1BoxedMap(FrozenMap data)
    Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| FrozenMap | data()
    validated payload | +| Any? | getData()
    validated payload | + +## BySmallNumber1 +class BySmallNumber1
    +extends JsonSchema + +A schema class that validates payloads + +### Field Summary +| Modifier and Type | Field and Description | +| ----------------- | ---------------------- | +| BigDecimal | multipleOf = BigDecimal("0.00010") | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| String | validate(arg: String, configuration: SchemaConfiguration) | +| Nothing? | validate(arg: Nothing?, configuration: SchemaConfiguration) | +| int | validate(arg: int, configuration: SchemaConfiguration) | +| long | validate(arg: long, configuration: SchemaConfiguration) | +| float | validate(arg: float, configuration: SchemaConfiguration) | +| double | validate(arg: double, configuration: SchemaConfiguration) | +| Number | validate(arg: Number, configuration: SchemaConfiguration) | +| boolean | validate(arg: boolean, configuration: SchemaConfiguration) | +| FrozenMap | validate(arg: Map<?, ?>, configuration: SchemaConfiguration) | +| FrozenList | validate(arg: List<*>, configuration: SchemaConfiguration) | +| [BySmallNumber1BoxedString](#bysmallnumber1boxedstring) | validateAndBox(String, configuration: SchemaConfiguration) | +| [BySmallNumber1BoxedVoid](#bysmallnumber1boxedvoid) | validateAndBox(Nothing?, configuration: SchemaConfiguration) | +| [BySmallNumber1BoxedNumber](#bysmallnumber1boxednumber) | validateAndBox(Number, configuration: SchemaConfiguration) | +| [BySmallNumber1BoxedBoolean](#bysmallnumber1boxedboolean) | validateAndBox(boolean, configuration: SchemaConfiguration) | +| [BySmallNumber1BoxedMap](#bysmallnumber1boxedmap) | validateAndBox(Map<?, ?>, configuration: SchemaConfiguration) | +| [BySmallNumber1BoxedList](#bysmallnumber1boxedlist) | validateAndBox(List<*>, configuration: SchemaConfiguration) | +| [BySmallNumber1Boxed](#bysmallnumber1boxed) | validateAndBox(Any?, configuration: SchemaConfiguration) | +| Any? | validate(arg: Any?, configuration: SchemaConfiguration) | + +[[Back to top]](#top) [[Back to Component Schemas]](../../../README.md#Component-Schemas) [[Back to README]](../../../README.md) diff --git a/samples/client/3_1_0_unit_test/kotlin/docs/components/schemas/ConstNulCharactersInStrings.md b/samples/client/3_1_0_unit_test/kotlin/docs/components/schemas/ConstNulCharactersInStrings.md new file mode 100644 index 00000000000..2164a4dddf4 --- /dev/null +++ b/samples/client/3_1_0_unit_test/kotlin/docs/components/schemas/ConstNulCharactersInStrings.md @@ -0,0 +1,182 @@ +# ConstNulCharactersInStrings +org.openapijsonschematools.client.components.schemas.ConstNulCharactersInStrings.java +class ConstNulCharactersInStrings
    + +A class that contains necessary nested +- schema classes (which validate payloads), extends JsonSchema +- sealed interfaces which store validated payloads, Kotlin version of a sum type +- boxed classes which store validated payloads, sealed permits class implementations +- enum classes + +## Nested Class Summary +| Modifier and Type | Class and Description | +| ----------------- | ---------------------- | +| sealed interface | [ConstNulCharactersInStrings.ConstNulCharactersInStrings1Boxed](#constnulcharactersinstrings1boxed)
    sealed interface for validated payloads | +| record | [ConstNulCharactersInStrings.ConstNulCharactersInStrings1BoxedVoid](#constnulcharactersinstrings1boxedvoid)
    boxed class to store validated null payloads | +| record | [ConstNulCharactersInStrings.ConstNulCharactersInStrings1BoxedBoolean](#constnulcharactersinstrings1boxedboolean)
    boxed class to store validated boolean payloads | +| record | [ConstNulCharactersInStrings.ConstNulCharactersInStrings1BoxedNumber](#constnulcharactersinstrings1boxednumber)
    boxed class to store validated Number payloads | +| record | [ConstNulCharactersInStrings.ConstNulCharactersInStrings1BoxedString](#constnulcharactersinstrings1boxedstring)
    boxed class to store validated String payloads | +| record | [ConstNulCharactersInStrings.ConstNulCharactersInStrings1BoxedList](#constnulcharactersinstrings1boxedlist)
    boxed class to store validated List payloads | +| record | [ConstNulCharactersInStrings.ConstNulCharactersInStrings1BoxedMap](#constnulcharactersinstrings1boxedmap)
    boxed class to store validated Map payloads | +| static class | [ConstNulCharactersInStrings.ConstNulCharactersInStrings1](#constnulcharactersinstrings1)
    schema class | +| enum | [ConstNulCharactersInStrings.StringConstNulCharactersInStringsConst](#stringconstnulcharactersinstringsconst)
    String enum | + +## ConstNulCharactersInStrings1Boxed +sealed interface ConstNulCharactersInStrings1Boxed
    +permits
    +[ConstNulCharactersInStrings1BoxedVoid](#constnulcharactersinstrings1boxedvoid), +[ConstNulCharactersInStrings1BoxedBoolean](#constnulcharactersinstrings1boxedboolean), +[ConstNulCharactersInStrings1BoxedNumber](#constnulcharactersinstrings1boxednumber), +[ConstNulCharactersInStrings1BoxedString](#constnulcharactersinstrings1boxedstring), +[ConstNulCharactersInStrings1BoxedList](#constnulcharactersinstrings1boxedlist), +[ConstNulCharactersInStrings1BoxedMap](#constnulcharactersinstrings1boxedmap) + +sealed interface that stores validated payloads using boxed classes + +## ConstNulCharactersInStrings1BoxedVoid +data class ConstNulCharactersInStrings1BoxedVoid
    +implements [ConstNulCharactersInStrings1Boxed](#constnulcharactersinstrings1boxed) + +data class that stores validated null payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| ConstNulCharactersInStrings1BoxedVoid(Nothing? data)
    Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| Nothing? | data()
    validated payload | +| Any? | getData()
    validated payload | + +## ConstNulCharactersInStrings1BoxedBoolean +data class ConstNulCharactersInStrings1BoxedBoolean
    +implements [ConstNulCharactersInStrings1Boxed](#constnulcharactersinstrings1boxed) + +record that stores validated boolean payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| ConstNulCharactersInStrings1BoxedBoolean(boolean data)
    Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| boolean | data()
    validated payload | +| Any? | getData()
    validated payload | + +## ConstNulCharactersInStrings1BoxedNumber +data class ConstNulCharactersInStrings1BoxedNumber
    +implements [ConstNulCharactersInStrings1Boxed](#constnulcharactersinstrings1boxed) + +data class that stores validated Number payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| ConstNulCharactersInStrings1BoxedNumber(Number data)
    Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| Number | data()
    validated payload | +| Any? | getData()
    validated payload | + +## ConstNulCharactersInStrings1BoxedString +data class ConstNulCharactersInStrings1BoxedString
    +implements [ConstNulCharactersInStrings1Boxed](#constnulcharactersinstrings1boxed) + +data class that stores validated String payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| ConstNulCharactersInStrings1BoxedString(String data)
    Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| String | data()
    validated payload | +| Any? | getData()
    validated payload | + +## ConstNulCharactersInStrings1BoxedList +data class ConstNulCharactersInStrings1BoxedList
    +implements [ConstNulCharactersInStrings1Boxed](#constnulcharactersinstrings1boxed) + +data class that stores validated List payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| ConstNulCharactersInStrings1BoxedList(FrozenList data)
    Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| FrozenList | data()
    validated payload | +| Any? | getData()
    validated payload | + +## ConstNulCharactersInStrings1BoxedMap +data class ConstNulCharactersInStrings1BoxedMap
    +implements [ConstNulCharactersInStrings1Boxed](#constnulcharactersinstrings1boxed) + +data class that stores validated Map payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| ConstNulCharactersInStrings1BoxedMap(FrozenMap data)
    Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| FrozenMap | data()
    validated payload | +| Any? | getData()
    validated payload | + +## ConstNulCharactersInStrings1 +class ConstNulCharactersInStrings1
    +extends JsonSchema + +A schema class that validates payloads + +### Field Summary +| Modifier and Type | Field and Description | +| ----------------- | ---------------------- | +| Any? | constValue = "hello\u0000there" | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| String | validate(arg: String, configuration: SchemaConfiguration) | +| Nothing? | validate(arg: Nothing?, configuration: SchemaConfiguration) | +| int | validate(arg: int, configuration: SchemaConfiguration) | +| long | validate(arg: long, configuration: SchemaConfiguration) | +| float | validate(arg: float, configuration: SchemaConfiguration) | +| double | validate(arg: double, configuration: SchemaConfiguration) | +| Number | validate(arg: Number, configuration: SchemaConfiguration) | +| boolean | validate(arg: boolean, configuration: SchemaConfiguration) | +| FrozenMap | validate(arg: Map<?, ?>, configuration: SchemaConfiguration) | +| FrozenList | validate(arg: List<*>, configuration: SchemaConfiguration) | +| [ConstNulCharactersInStrings1BoxedString](#constnulcharactersinstrings1boxedstring) | validateAndBox(String, configuration: SchemaConfiguration) | +| [ConstNulCharactersInStrings1BoxedVoid](#constnulcharactersinstrings1boxedvoid) | validateAndBox(Nothing?, configuration: SchemaConfiguration) | +| [ConstNulCharactersInStrings1BoxedNumber](#constnulcharactersinstrings1boxednumber) | validateAndBox(Number, configuration: SchemaConfiguration) | +| [ConstNulCharactersInStrings1BoxedBoolean](#constnulcharactersinstrings1boxedboolean) | validateAndBox(boolean, configuration: SchemaConfiguration) | +| [ConstNulCharactersInStrings1BoxedMap](#constnulcharactersinstrings1boxedmap) | validateAndBox(Map<?, ?>, configuration: SchemaConfiguration) | +| [ConstNulCharactersInStrings1BoxedList](#constnulcharactersinstrings1boxedlist) | validateAndBox(List<*>, configuration: SchemaConfiguration) | +| [ConstNulCharactersInStrings1Boxed](#constnulcharactersinstrings1boxed) | validateAndBox(Any?, configuration: SchemaConfiguration) | +| Any? | validate(arg: Any?, configuration: SchemaConfiguration) | + +## StringConstNulCharactersInStringsConst +public enum StringConstNulCharactersInStringsConst
    +extends `Enum` + +A class that stores String enum values + +### Enum Constant Summary +| Enum Constant | Description | +| ------------- | ----------- | +| HELLO_NULL_THERE | value = "hello\u0000there" | + +[[Back to top]](#top) [[Back to Component Schemas]](../../../README.md#Component-Schemas) [[Back to README]](../../../README.md) diff --git a/samples/client/3_1_0_unit_test/kotlin/docs/components/schemas/ContainsKeywordValidation.md b/samples/client/3_1_0_unit_test/kotlin/docs/components/schemas/ContainsKeywordValidation.md new file mode 100644 index 00000000000..b7ad2bc525d --- /dev/null +++ b/samples/client/3_1_0_unit_test/kotlin/docs/components/schemas/ContainsKeywordValidation.md @@ -0,0 +1,324 @@ +# ContainsKeywordValidation +org.openapijsonschematools.client.components.schemas.ContainsKeywordValidation.java +class ContainsKeywordValidation
    + +A class that contains necessary nested +- schema classes (which validate payloads), extends JsonSchema +- sealed interfaces which store validated payloads, Kotlin version of a sum type +- boxed classes which store validated payloads, sealed permits class implementations + +## Nested Class Summary +| Modifier and Type | Class and Description | +| ----------------- | ---------------------- | +| sealed interface | [ContainsKeywordValidation.ContainsKeywordValidation1Boxed](#containskeywordvalidation1boxed)
    sealed interface for validated payloads | +| record | [ContainsKeywordValidation.ContainsKeywordValidation1BoxedVoid](#containskeywordvalidation1boxedvoid)
    boxed class to store validated null payloads | +| record | [ContainsKeywordValidation.ContainsKeywordValidation1BoxedBoolean](#containskeywordvalidation1boxedboolean)
    boxed class to store validated boolean payloads | +| record | [ContainsKeywordValidation.ContainsKeywordValidation1BoxedNumber](#containskeywordvalidation1boxednumber)
    boxed class to store validated Number payloads | +| record | [ContainsKeywordValidation.ContainsKeywordValidation1BoxedString](#containskeywordvalidation1boxedstring)
    boxed class to store validated String payloads | +| record | [ContainsKeywordValidation.ContainsKeywordValidation1BoxedList](#containskeywordvalidation1boxedlist)
    boxed class to store validated List payloads | +| record | [ContainsKeywordValidation.ContainsKeywordValidation1BoxedMap](#containskeywordvalidation1boxedmap)
    boxed class to store validated Map payloads | +| static class | [ContainsKeywordValidation.ContainsKeywordValidation1](#containskeywordvalidation1)
    schema class | +| sealed interface | [ContainsKeywordValidation.ContainsBoxed](#containsboxed)
    sealed interface for validated payloads | +| record | [ContainsKeywordValidation.ContainsBoxedVoid](#containsboxedvoid)
    boxed class to store validated null payloads | +| record | [ContainsKeywordValidation.ContainsBoxedBoolean](#containsboxedboolean)
    boxed class to store validated boolean payloads | +| record | [ContainsKeywordValidation.ContainsBoxedNumber](#containsboxednumber)
    boxed class to store validated Number payloads | +| record | [ContainsKeywordValidation.ContainsBoxedString](#containsboxedstring)
    boxed class to store validated String payloads | +| record | [ContainsKeywordValidation.ContainsBoxedList](#containsboxedlist)
    boxed class to store validated List payloads | +| record | [ContainsKeywordValidation.ContainsBoxedMap](#containsboxedmap)
    boxed class to store validated Map payloads | +| static class | [ContainsKeywordValidation.Contains](#contains)
    schema class | + +## ContainsKeywordValidation1Boxed +sealed interface ContainsKeywordValidation1Boxed
    +permits
    +[ContainsKeywordValidation1BoxedVoid](#containskeywordvalidation1boxedvoid), +[ContainsKeywordValidation1BoxedBoolean](#containskeywordvalidation1boxedboolean), +[ContainsKeywordValidation1BoxedNumber](#containskeywordvalidation1boxednumber), +[ContainsKeywordValidation1BoxedString](#containskeywordvalidation1boxedstring), +[ContainsKeywordValidation1BoxedList](#containskeywordvalidation1boxedlist), +[ContainsKeywordValidation1BoxedMap](#containskeywordvalidation1boxedmap) + +sealed interface that stores validated payloads using boxed classes + +## ContainsKeywordValidation1BoxedVoid +data class ContainsKeywordValidation1BoxedVoid
    +implements [ContainsKeywordValidation1Boxed](#containskeywordvalidation1boxed) + +data class that stores validated null payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| ContainsKeywordValidation1BoxedVoid(Nothing? data)
    Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| Nothing? | data()
    validated payload | +| Any? | getData()
    validated payload | + +## ContainsKeywordValidation1BoxedBoolean +data class ContainsKeywordValidation1BoxedBoolean
    +implements [ContainsKeywordValidation1Boxed](#containskeywordvalidation1boxed) + +record that stores validated boolean payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| ContainsKeywordValidation1BoxedBoolean(boolean data)
    Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| boolean | data()
    validated payload | +| Any? | getData()
    validated payload | + +## ContainsKeywordValidation1BoxedNumber +data class ContainsKeywordValidation1BoxedNumber
    +implements [ContainsKeywordValidation1Boxed](#containskeywordvalidation1boxed) + +data class that stores validated Number payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| ContainsKeywordValidation1BoxedNumber(Number data)
    Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| Number | data()
    validated payload | +| Any? | getData()
    validated payload | + +## ContainsKeywordValidation1BoxedString +data class ContainsKeywordValidation1BoxedString
    +implements [ContainsKeywordValidation1Boxed](#containskeywordvalidation1boxed) + +data class that stores validated String payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| ContainsKeywordValidation1BoxedString(String data)
    Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| String | data()
    validated payload | +| Any? | getData()
    validated payload | + +## ContainsKeywordValidation1BoxedList +data class ContainsKeywordValidation1BoxedList
    +implements [ContainsKeywordValidation1Boxed](#containskeywordvalidation1boxed) + +data class that stores validated List payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| ContainsKeywordValidation1BoxedList(FrozenList data)
    Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| FrozenList | data()
    validated payload | +| Any? | getData()
    validated payload | + +## ContainsKeywordValidation1BoxedMap +data class ContainsKeywordValidation1BoxedMap
    +implements [ContainsKeywordValidation1Boxed](#containskeywordvalidation1boxed) + +data class that stores validated Map payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| ContainsKeywordValidation1BoxedMap(FrozenMap data)
    Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| FrozenMap | data()
    validated payload | +| Any? | getData()
    validated payload | + +## ContainsKeywordValidation1 +class ContainsKeywordValidation1
    +extends JsonSchema + +A schema class that validates payloads + +### Field Summary +| Modifier and Type | Field and Description | +| ----------------- | ---------------------- | +| Class | contains = [Contains::class.java](#contains) | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| String | validate(arg: String, configuration: SchemaConfiguration) | +| Nothing? | validate(arg: Nothing?, configuration: SchemaConfiguration) | +| int | validate(arg: int, configuration: SchemaConfiguration) | +| long | validate(arg: long, configuration: SchemaConfiguration) | +| float | validate(arg: float, configuration: SchemaConfiguration) | +| double | validate(arg: double, configuration: SchemaConfiguration) | +| Number | validate(arg: Number, configuration: SchemaConfiguration) | +| boolean | validate(arg: boolean, configuration: SchemaConfiguration) | +| FrozenMap | validate(arg: Map<?, ?>, configuration: SchemaConfiguration) | +| FrozenList | validate(arg: List<*>, configuration: SchemaConfiguration) | +| [ContainsKeywordValidation1BoxedString](#containskeywordvalidation1boxedstring) | validateAndBox(String, configuration: SchemaConfiguration) | +| [ContainsKeywordValidation1BoxedVoid](#containskeywordvalidation1boxedvoid) | validateAndBox(Nothing?, configuration: SchemaConfiguration) | +| [ContainsKeywordValidation1BoxedNumber](#containskeywordvalidation1boxednumber) | validateAndBox(Number, configuration: SchemaConfiguration) | +| [ContainsKeywordValidation1BoxedBoolean](#containskeywordvalidation1boxedboolean) | validateAndBox(boolean, configuration: SchemaConfiguration) | +| [ContainsKeywordValidation1BoxedMap](#containskeywordvalidation1boxedmap) | validateAndBox(Map<?, ?>, configuration: SchemaConfiguration) | +| [ContainsKeywordValidation1BoxedList](#containskeywordvalidation1boxedlist) | validateAndBox(List<*>, configuration: SchemaConfiguration) | +| [ContainsKeywordValidation1Boxed](#containskeywordvalidation1boxed) | validateAndBox(Any?, configuration: SchemaConfiguration) | +| Any? | validate(arg: Any?, configuration: SchemaConfiguration) | + +## ContainsBoxed +sealed interface ContainsBoxed
    +permits
    +[ContainsBoxedVoid](#containsboxedvoid), +[ContainsBoxedBoolean](#containsboxedboolean), +[ContainsBoxedNumber](#containsboxednumber), +[ContainsBoxedString](#containsboxedstring), +[ContainsBoxedList](#containsboxedlist), +[ContainsBoxedMap](#containsboxedmap) + +sealed interface that stores validated payloads using boxed classes + +## ContainsBoxedVoid +data class ContainsBoxedVoid
    +implements [ContainsBoxed](#containsboxed) + +data class that stores validated null payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| ContainsBoxedVoid(Nothing? data)
    Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| Nothing? | data()
    validated payload | +| Any? | getData()
    validated payload | + +## ContainsBoxedBoolean +data class ContainsBoxedBoolean
    +implements [ContainsBoxed](#containsboxed) + +record that stores validated boolean payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| ContainsBoxedBoolean(boolean data)
    Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| boolean | data()
    validated payload | +| Any? | getData()
    validated payload | + +## ContainsBoxedNumber +data class ContainsBoxedNumber
    +implements [ContainsBoxed](#containsboxed) + +data class that stores validated Number payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| ContainsBoxedNumber(Number data)
    Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| Number | data()
    validated payload | +| Any? | getData()
    validated payload | + +## ContainsBoxedString +data class ContainsBoxedString
    +implements [ContainsBoxed](#containsboxed) + +data class that stores validated String payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| ContainsBoxedString(String data)
    Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| String | data()
    validated payload | +| Any? | getData()
    validated payload | + +## ContainsBoxedList +data class ContainsBoxedList
    +implements [ContainsBoxed](#containsboxed) + +data class that stores validated List payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| ContainsBoxedList(FrozenList data)
    Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| FrozenList | data()
    validated payload | +| Any? | getData()
    validated payload | + +## ContainsBoxedMap +data class ContainsBoxedMap
    +implements [ContainsBoxed](#containsboxed) + +data class that stores validated Map payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| ContainsBoxedMap(FrozenMap data)
    Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| FrozenMap | data()
    validated payload | +| Any? | getData()
    validated payload | + +## Contains +class Contains
    +extends JsonSchema + +A schema class that validates payloads + +### Field Summary +| Modifier and Type | Field and Description | +| ----------------- | ---------------------- | +| Number | minimum = 5 | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| String | validate(arg: String, configuration: SchemaConfiguration) | +| Nothing? | validate(arg: Nothing?, configuration: SchemaConfiguration) | +| int | validate(arg: int, configuration: SchemaConfiguration) | +| long | validate(arg: long, configuration: SchemaConfiguration) | +| float | validate(arg: float, configuration: SchemaConfiguration) | +| double | validate(arg: double, configuration: SchemaConfiguration) | +| Number | validate(arg: Number, configuration: SchemaConfiguration) | +| boolean | validate(arg: boolean, configuration: SchemaConfiguration) | +| FrozenMap | validate(arg: Map<?, ?>, configuration: SchemaConfiguration) | +| FrozenList | validate(arg: List<*>, configuration: SchemaConfiguration) | +| [ContainsBoxedString](#containsboxedstring) | validateAndBox(String, configuration: SchemaConfiguration) | +| [ContainsBoxedVoid](#containsboxedvoid) | validateAndBox(Nothing?, configuration: SchemaConfiguration) | +| [ContainsBoxedNumber](#containsboxednumber) | validateAndBox(Number, configuration: SchemaConfiguration) | +| [ContainsBoxedBoolean](#containsboxedboolean) | validateAndBox(boolean, configuration: SchemaConfiguration) | +| [ContainsBoxedMap](#containsboxedmap) | validateAndBox(Map<?, ?>, configuration: SchemaConfiguration) | +| [ContainsBoxedList](#containsboxedlist) | validateAndBox(List<*>, configuration: SchemaConfiguration) | +| [ContainsBoxed](#containsboxed) | validateAndBox(Any?, configuration: SchemaConfiguration) | +| Any? | validate(arg: Any?, configuration: SchemaConfiguration) | + +[[Back to top]](#top) [[Back to Component Schemas]](../../../README.md#Component-Schemas) [[Back to README]](../../../README.md) diff --git a/samples/client/3_1_0_unit_test/kotlin/docs/components/schemas/ContainsWithNullInstanceElements.md b/samples/client/3_1_0_unit_test/kotlin/docs/components/schemas/ContainsWithNullInstanceElements.md new file mode 100644 index 00000000000..62745960f5e --- /dev/null +++ b/samples/client/3_1_0_unit_test/kotlin/docs/components/schemas/ContainsWithNullInstanceElements.md @@ -0,0 +1,207 @@ +# ContainsWithNullInstanceElements +org.openapijsonschematools.client.components.schemas.ContainsWithNullInstanceElements.java +class ContainsWithNullInstanceElements
    + +A class that contains necessary nested +- schema classes (which validate payloads), extends JsonSchema +- sealed interfaces which store validated payloads, Kotlin version of a sum type +- boxed classes which store validated payloads, sealed permits class implementations + +## Nested Class Summary +| Modifier and Type | Class and Description | +| ----------------- | ---------------------- | +| sealed interface | [ContainsWithNullInstanceElements.ContainsWithNullInstanceElements1Boxed](#containswithnullinstanceelements1boxed)
    sealed interface for validated payloads | +| record | [ContainsWithNullInstanceElements.ContainsWithNullInstanceElements1BoxedVoid](#containswithnullinstanceelements1boxedvoid)
    boxed class to store validated null payloads | +| record | [ContainsWithNullInstanceElements.ContainsWithNullInstanceElements1BoxedBoolean](#containswithnullinstanceelements1boxedboolean)
    boxed class to store validated boolean payloads | +| record | [ContainsWithNullInstanceElements.ContainsWithNullInstanceElements1BoxedNumber](#containswithnullinstanceelements1boxednumber)
    boxed class to store validated Number payloads | +| record | [ContainsWithNullInstanceElements.ContainsWithNullInstanceElements1BoxedString](#containswithnullinstanceelements1boxedstring)
    boxed class to store validated String payloads | +| record | [ContainsWithNullInstanceElements.ContainsWithNullInstanceElements1BoxedList](#containswithnullinstanceelements1boxedlist)
    boxed class to store validated List payloads | +| record | [ContainsWithNullInstanceElements.ContainsWithNullInstanceElements1BoxedMap](#containswithnullinstanceelements1boxedmap)
    boxed class to store validated Map payloads | +| static class | [ContainsWithNullInstanceElements.ContainsWithNullInstanceElements1](#containswithnullinstanceelements1)
    schema class | +| sealed interface | [ContainsWithNullInstanceElements.ContainsBoxed](#containsboxed)
    sealed interface for validated payloads | +| record | [ContainsWithNullInstanceElements.ContainsBoxedVoid](#containsboxedvoid)
    boxed class to store validated null payloads | +| static class | [ContainsWithNullInstanceElements.Contains](#contains)
    schema class | + +## ContainsWithNullInstanceElements1Boxed +sealed interface ContainsWithNullInstanceElements1Boxed
    +permits
    +[ContainsWithNullInstanceElements1BoxedVoid](#containswithnullinstanceelements1boxedvoid), +[ContainsWithNullInstanceElements1BoxedBoolean](#containswithnullinstanceelements1boxedboolean), +[ContainsWithNullInstanceElements1BoxedNumber](#containswithnullinstanceelements1boxednumber), +[ContainsWithNullInstanceElements1BoxedString](#containswithnullinstanceelements1boxedstring), +[ContainsWithNullInstanceElements1BoxedList](#containswithnullinstanceelements1boxedlist), +[ContainsWithNullInstanceElements1BoxedMap](#containswithnullinstanceelements1boxedmap) + +sealed interface that stores validated payloads using boxed classes + +## ContainsWithNullInstanceElements1BoxedVoid +data class ContainsWithNullInstanceElements1BoxedVoid
    +implements [ContainsWithNullInstanceElements1Boxed](#containswithnullinstanceelements1boxed) + +data class that stores validated null payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| ContainsWithNullInstanceElements1BoxedVoid(Nothing? data)
    Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| Nothing? | data()
    validated payload | +| Any? | getData()
    validated payload | + +## ContainsWithNullInstanceElements1BoxedBoolean +data class ContainsWithNullInstanceElements1BoxedBoolean
    +implements [ContainsWithNullInstanceElements1Boxed](#containswithnullinstanceelements1boxed) + +record that stores validated boolean payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| ContainsWithNullInstanceElements1BoxedBoolean(boolean data)
    Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| boolean | data()
    validated payload | +| Any? | getData()
    validated payload | + +## ContainsWithNullInstanceElements1BoxedNumber +data class ContainsWithNullInstanceElements1BoxedNumber
    +implements [ContainsWithNullInstanceElements1Boxed](#containswithnullinstanceelements1boxed) + +data class that stores validated Number payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| ContainsWithNullInstanceElements1BoxedNumber(Number data)
    Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| Number | data()
    validated payload | +| Any? | getData()
    validated payload | + +## ContainsWithNullInstanceElements1BoxedString +data class ContainsWithNullInstanceElements1BoxedString
    +implements [ContainsWithNullInstanceElements1Boxed](#containswithnullinstanceelements1boxed) + +data class that stores validated String payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| ContainsWithNullInstanceElements1BoxedString(String data)
    Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| String | data()
    validated payload | +| Any? | getData()
    validated payload | + +## ContainsWithNullInstanceElements1BoxedList +data class ContainsWithNullInstanceElements1BoxedList
    +implements [ContainsWithNullInstanceElements1Boxed](#containswithnullinstanceelements1boxed) + +data class that stores validated List payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| ContainsWithNullInstanceElements1BoxedList(FrozenList data)
    Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| FrozenList | data()
    validated payload | +| Any? | getData()
    validated payload | + +## ContainsWithNullInstanceElements1BoxedMap +data class ContainsWithNullInstanceElements1BoxedMap
    +implements [ContainsWithNullInstanceElements1Boxed](#containswithnullinstanceelements1boxed) + +data class that stores validated Map payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| ContainsWithNullInstanceElements1BoxedMap(FrozenMap data)
    Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| FrozenMap | data()
    validated payload | +| Any? | getData()
    validated payload | + +## ContainsWithNullInstanceElements1 +class ContainsWithNullInstanceElements1
    +extends JsonSchema + +A schema class that validates payloads + +### Field Summary +| Modifier and Type | Field and Description | +| ----------------- | ---------------------- | +| Class | contains = [Contains::class.java](#contains) | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| String | validate(arg: String, configuration: SchemaConfiguration) | +| Nothing? | validate(arg: Nothing?, configuration: SchemaConfiguration) | +| int | validate(arg: int, configuration: SchemaConfiguration) | +| long | validate(arg: long, configuration: SchemaConfiguration) | +| float | validate(arg: float, configuration: SchemaConfiguration) | +| double | validate(arg: double, configuration: SchemaConfiguration) | +| Number | validate(arg: Number, configuration: SchemaConfiguration) | +| boolean | validate(arg: boolean, configuration: SchemaConfiguration) | +| FrozenMap | validate(arg: Map<?, ?>, configuration: SchemaConfiguration) | +| FrozenList | validate(arg: List<*>, configuration: SchemaConfiguration) | +| [ContainsWithNullInstanceElements1BoxedString](#containswithnullinstanceelements1boxedstring) | validateAndBox(String, configuration: SchemaConfiguration) | +| [ContainsWithNullInstanceElements1BoxedVoid](#containswithnullinstanceelements1boxedvoid) | validateAndBox(Nothing?, configuration: SchemaConfiguration) | +| [ContainsWithNullInstanceElements1BoxedNumber](#containswithnullinstanceelements1boxednumber) | validateAndBox(Number, configuration: SchemaConfiguration) | +| [ContainsWithNullInstanceElements1BoxedBoolean](#containswithnullinstanceelements1boxedboolean) | validateAndBox(boolean, configuration: SchemaConfiguration) | +| [ContainsWithNullInstanceElements1BoxedMap](#containswithnullinstanceelements1boxedmap) | validateAndBox(Map<?, ?>, configuration: SchemaConfiguration) | +| [ContainsWithNullInstanceElements1BoxedList](#containswithnullinstanceelements1boxedlist) | validateAndBox(List<*>, configuration: SchemaConfiguration) | +| [ContainsWithNullInstanceElements1Boxed](#containswithnullinstanceelements1boxed) | validateAndBox(Any?, configuration: SchemaConfiguration) | +| Any? | validate(arg: Any?, configuration: SchemaConfiguration) | + +## ContainsBoxed +sealed interface ContainsBoxed
    +permits
    +[ContainsBoxedVoid](#containsboxedvoid) + +sealed interface that stores validated payloads using boxed classes + +## ContainsBoxedVoid +data class ContainsBoxedVoid
    +implements [ContainsBoxed](#containsboxed) + +data class that stores validated null payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| ContainsBoxedVoid(Nothing? data)
    Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| Nothing? | data()
    validated payload | +| Any? | getData()
    validated payload | + +## Contains +class Contains
    +extends NullJsonSchema.NullJsonSchema1 + +A schema class that validates payloads + +| Methods Inherited from class org.openapijsonschematools.client.schemas.NullJsonSchema.NullJsonSchema1 | +| ------------------------------------------------------------------ | +| validate | +| validateAndBox | + +[[Back to top]](#top) [[Back to Component Schemas]](../../../README.md#Component-Schemas) [[Back to README]](../../../README.md) diff --git a/samples/client/3_1_0_unit_test/kotlin/docs/components/schemas/DateFormat.md b/samples/client/3_1_0_unit_test/kotlin/docs/components/schemas/DateFormat.md new file mode 100644 index 00000000000..79655ce8dbd --- /dev/null +++ b/samples/client/3_1_0_unit_test/kotlin/docs/components/schemas/DateFormat.md @@ -0,0 +1,169 @@ +# DateFormat +org.openapijsonschematools.client.components.schemas.DateFormat.java +class DateFormat
    + +A class that contains necessary nested +- schema classes (which validate payloads), extends JsonSchema +- sealed interfaces which store validated payloads, Kotlin version of a sum type +- boxed classes which store validated payloads, sealed permits class implementations + +## Nested Class Summary +| Modifier and Type | Class and Description | +| ----------------- | ---------------------- | +| sealed interface | [DateFormat.DateFormat1Boxed](#dateformat1boxed)
    sealed interface for validated payloads | +| record | [DateFormat.DateFormat1BoxedVoid](#dateformat1boxedvoid)
    boxed class to store validated null payloads | +| record | [DateFormat.DateFormat1BoxedBoolean](#dateformat1boxedboolean)
    boxed class to store validated boolean payloads | +| record | [DateFormat.DateFormat1BoxedNumber](#dateformat1boxednumber)
    boxed class to store validated Number payloads | +| record | [DateFormat.DateFormat1BoxedString](#dateformat1boxedstring)
    boxed class to store validated String payloads | +| record | [DateFormat.DateFormat1BoxedList](#dateformat1boxedlist)
    boxed class to store validated List payloads | +| record | [DateFormat.DateFormat1BoxedMap](#dateformat1boxedmap)
    boxed class to store validated Map payloads | +| static class | [DateFormat.DateFormat1](#dateformat1)
    schema class | + +## DateFormat1Boxed +sealed interface DateFormat1Boxed
    +permits
    +[DateFormat1BoxedVoid](#dateformat1boxedvoid), +[DateFormat1BoxedBoolean](#dateformat1boxedboolean), +[DateFormat1BoxedNumber](#dateformat1boxednumber), +[DateFormat1BoxedString](#dateformat1boxedstring), +[DateFormat1BoxedList](#dateformat1boxedlist), +[DateFormat1BoxedMap](#dateformat1boxedmap) + +sealed interface that stores validated payloads using boxed classes + +## DateFormat1BoxedVoid +data class DateFormat1BoxedVoid
    +implements [DateFormat1Boxed](#dateformat1boxed) + +data class that stores validated null payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| DateFormat1BoxedVoid(Nothing? data)
    Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| Nothing? | data()
    validated payload | +| Any? | getData()
    validated payload | + +## DateFormat1BoxedBoolean +data class DateFormat1BoxedBoolean
    +implements [DateFormat1Boxed](#dateformat1boxed) + +record that stores validated boolean payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| DateFormat1BoxedBoolean(boolean data)
    Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| boolean | data()
    validated payload | +| Any? | getData()
    validated payload | + +## DateFormat1BoxedNumber +data class DateFormat1BoxedNumber
    +implements [DateFormat1Boxed](#dateformat1boxed) + +data class that stores validated Number payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| DateFormat1BoxedNumber(Number data)
    Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| Number | data()
    validated payload | +| Any? | getData()
    validated payload | + +## DateFormat1BoxedString +data class DateFormat1BoxedString
    +implements [DateFormat1Boxed](#dateformat1boxed) + +data class that stores validated String payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| DateFormat1BoxedString(String data)
    Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| String | data()
    validated payload | +| Any? | getData()
    validated payload | + +## DateFormat1BoxedList +data class DateFormat1BoxedList
    +implements [DateFormat1Boxed](#dateformat1boxed) + +data class that stores validated List payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| DateFormat1BoxedList(FrozenList data)
    Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| FrozenList | data()
    validated payload | +| Any? | getData()
    validated payload | + +## DateFormat1BoxedMap +data class DateFormat1BoxedMap
    +implements [DateFormat1Boxed](#dateformat1boxed) + +data class that stores validated Map payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| DateFormat1BoxedMap(FrozenMap data)
    Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| FrozenMap | data()
    validated payload | +| Any? | getData()
    validated payload | + +## DateFormat1 +class DateFormat1
    +extends JsonSchema + +A schema class that validates payloads + +### Field Summary +| Modifier and Type | Field and Description | +| ----------------- | ---------------------- | +| String | type = "date"; | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| String | validate(arg: String, configuration: SchemaConfiguration) | +| Nothing? | validate(arg: Nothing?, configuration: SchemaConfiguration) | +| int | validate(arg: int, configuration: SchemaConfiguration) | +| long | validate(arg: long, configuration: SchemaConfiguration) | +| float | validate(arg: float, configuration: SchemaConfiguration) | +| double | validate(arg: double, configuration: SchemaConfiguration) | +| Number | validate(arg: Number, configuration: SchemaConfiguration) | +| boolean | validate(arg: boolean, configuration: SchemaConfiguration) | +| FrozenMap | validate(arg: Map<?, ?>, configuration: SchemaConfiguration) | +| FrozenList | validate(arg: List<*>, configuration: SchemaConfiguration) | +| [DateFormat1BoxedString](#dateformat1boxedstring) | validateAndBox(String, configuration: SchemaConfiguration) | +| [DateFormat1BoxedVoid](#dateformat1boxedvoid) | validateAndBox(Nothing?, configuration: SchemaConfiguration) | +| [DateFormat1BoxedNumber](#dateformat1boxednumber) | validateAndBox(Number, configuration: SchemaConfiguration) | +| [DateFormat1BoxedBoolean](#dateformat1boxedboolean) | validateAndBox(boolean, configuration: SchemaConfiguration) | +| [DateFormat1BoxedMap](#dateformat1boxedmap) | validateAndBox(Map<?, ?>, configuration: SchemaConfiguration) | +| [DateFormat1BoxedList](#dateformat1boxedlist) | validateAndBox(List<*>, configuration: SchemaConfiguration) | +| [DateFormat1Boxed](#dateformat1boxed) | validateAndBox(Any?, configuration: SchemaConfiguration) | +| Any? | validate(arg: Any?, configuration: SchemaConfiguration) | + +[[Back to top]](#top) [[Back to Component Schemas]](../../../README.md#Component-Schemas) [[Back to README]](../../../README.md) diff --git a/samples/client/3_1_0_unit_test/kotlin/docs/components/schemas/DateTimeFormat.md b/samples/client/3_1_0_unit_test/kotlin/docs/components/schemas/DateTimeFormat.md new file mode 100644 index 00000000000..1844f22cea8 --- /dev/null +++ b/samples/client/3_1_0_unit_test/kotlin/docs/components/schemas/DateTimeFormat.md @@ -0,0 +1,169 @@ +# DateTimeFormat +org.openapijsonschematools.client.components.schemas.DateTimeFormat.java +class DateTimeFormat
    + +A class that contains necessary nested +- schema classes (which validate payloads), extends JsonSchema +- sealed interfaces which store validated payloads, Kotlin version of a sum type +- boxed classes which store validated payloads, sealed permits class implementations + +## Nested Class Summary +| Modifier and Type | Class and Description | +| ----------------- | ---------------------- | +| sealed interface | [DateTimeFormat.DateTimeFormat1Boxed](#datetimeformat1boxed)
    sealed interface for validated payloads | +| record | [DateTimeFormat.DateTimeFormat1BoxedVoid](#datetimeformat1boxedvoid)
    boxed class to store validated null payloads | +| record | [DateTimeFormat.DateTimeFormat1BoxedBoolean](#datetimeformat1boxedboolean)
    boxed class to store validated boolean payloads | +| record | [DateTimeFormat.DateTimeFormat1BoxedNumber](#datetimeformat1boxednumber)
    boxed class to store validated Number payloads | +| record | [DateTimeFormat.DateTimeFormat1BoxedString](#datetimeformat1boxedstring)
    boxed class to store validated String payloads | +| record | [DateTimeFormat.DateTimeFormat1BoxedList](#datetimeformat1boxedlist)
    boxed class to store validated List payloads | +| record | [DateTimeFormat.DateTimeFormat1BoxedMap](#datetimeformat1boxedmap)
    boxed class to store validated Map payloads | +| static class | [DateTimeFormat.DateTimeFormat1](#datetimeformat1)
    schema class | + +## DateTimeFormat1Boxed +sealed interface DateTimeFormat1Boxed
    +permits
    +[DateTimeFormat1BoxedVoid](#datetimeformat1boxedvoid), +[DateTimeFormat1BoxedBoolean](#datetimeformat1boxedboolean), +[DateTimeFormat1BoxedNumber](#datetimeformat1boxednumber), +[DateTimeFormat1BoxedString](#datetimeformat1boxedstring), +[DateTimeFormat1BoxedList](#datetimeformat1boxedlist), +[DateTimeFormat1BoxedMap](#datetimeformat1boxedmap) + +sealed interface that stores validated payloads using boxed classes + +## DateTimeFormat1BoxedVoid +data class DateTimeFormat1BoxedVoid
    +implements [DateTimeFormat1Boxed](#datetimeformat1boxed) + +data class that stores validated null payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| DateTimeFormat1BoxedVoid(Nothing? data)
    Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| Nothing? | data()
    validated payload | +| Any? | getData()
    validated payload | + +## DateTimeFormat1BoxedBoolean +data class DateTimeFormat1BoxedBoolean
    +implements [DateTimeFormat1Boxed](#datetimeformat1boxed) + +record that stores validated boolean payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| DateTimeFormat1BoxedBoolean(boolean data)
    Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| boolean | data()
    validated payload | +| Any? | getData()
    validated payload | + +## DateTimeFormat1BoxedNumber +data class DateTimeFormat1BoxedNumber
    +implements [DateTimeFormat1Boxed](#datetimeformat1boxed) + +data class that stores validated Number payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| DateTimeFormat1BoxedNumber(Number data)
    Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| Number | data()
    validated payload | +| Any? | getData()
    validated payload | + +## DateTimeFormat1BoxedString +data class DateTimeFormat1BoxedString
    +implements [DateTimeFormat1Boxed](#datetimeformat1boxed) + +data class that stores validated String payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| DateTimeFormat1BoxedString(String data)
    Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| String | data()
    validated payload | +| Any? | getData()
    validated payload | + +## DateTimeFormat1BoxedList +data class DateTimeFormat1BoxedList
    +implements [DateTimeFormat1Boxed](#datetimeformat1boxed) + +data class that stores validated List payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| DateTimeFormat1BoxedList(FrozenList data)
    Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| FrozenList | data()
    validated payload | +| Any? | getData()
    validated payload | + +## DateTimeFormat1BoxedMap +data class DateTimeFormat1BoxedMap
    +implements [DateTimeFormat1Boxed](#datetimeformat1boxed) + +data class that stores validated Map payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| DateTimeFormat1BoxedMap(FrozenMap data)
    Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| FrozenMap | data()
    validated payload | +| Any? | getData()
    validated payload | + +## DateTimeFormat1 +class DateTimeFormat1
    +extends JsonSchema + +A schema class that validates payloads + +### Field Summary +| Modifier and Type | Field and Description | +| ----------------- | ---------------------- | +| String | type = "date-time"; | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| String | validate(arg: String, configuration: SchemaConfiguration) | +| Nothing? | validate(arg: Nothing?, configuration: SchemaConfiguration) | +| int | validate(arg: int, configuration: SchemaConfiguration) | +| long | validate(arg: long, configuration: SchemaConfiguration) | +| float | validate(arg: float, configuration: SchemaConfiguration) | +| double | validate(arg: double, configuration: SchemaConfiguration) | +| Number | validate(arg: Number, configuration: SchemaConfiguration) | +| boolean | validate(arg: boolean, configuration: SchemaConfiguration) | +| FrozenMap | validate(arg: Map<?, ?>, configuration: SchemaConfiguration) | +| FrozenList | validate(arg: List<*>, configuration: SchemaConfiguration) | +| [DateTimeFormat1BoxedString](#datetimeformat1boxedstring) | validateAndBox(String, configuration: SchemaConfiguration) | +| [DateTimeFormat1BoxedVoid](#datetimeformat1boxedvoid) | validateAndBox(Nothing?, configuration: SchemaConfiguration) | +| [DateTimeFormat1BoxedNumber](#datetimeformat1boxednumber) | validateAndBox(Number, configuration: SchemaConfiguration) | +| [DateTimeFormat1BoxedBoolean](#datetimeformat1boxedboolean) | validateAndBox(boolean, configuration: SchemaConfiguration) | +| [DateTimeFormat1BoxedMap](#datetimeformat1boxedmap) | validateAndBox(Map<?, ?>, configuration: SchemaConfiguration) | +| [DateTimeFormat1BoxedList](#datetimeformat1boxedlist) | validateAndBox(List<*>, configuration: SchemaConfiguration) | +| [DateTimeFormat1Boxed](#datetimeformat1boxed) | validateAndBox(Any?, configuration: SchemaConfiguration) | +| Any? | validate(arg: Any?, configuration: SchemaConfiguration) | + +[[Back to top]](#top) [[Back to Component Schemas]](../../../README.md#Component-Schemas) [[Back to README]](../../../README.md) diff --git a/samples/client/3_1_0_unit_test/kotlin/docs/components/schemas/DependentSchemasDependenciesWithEscapedCharacters.md b/samples/client/3_1_0_unit_test/kotlin/docs/components/schemas/DependentSchemasDependenciesWithEscapedCharacters.md new file mode 100644 index 00000000000..db1d3bbf5a6 --- /dev/null +++ b/samples/client/3_1_0_unit_test/kotlin/docs/components/schemas/DependentSchemasDependenciesWithEscapedCharacters.md @@ -0,0 +1,545 @@ +# DependentSchemasDependenciesWithEscapedCharacters +org.openapijsonschematools.client.components.schemas.DependentSchemasDependenciesWithEscapedCharacters.java +class DependentSchemasDependenciesWithEscapedCharacters
    + +A class that contains necessary nested +- schema classes (which validate payloads), extends JsonSchema +- sealed interfaces which store validated payloads, Kotlin version of a sum type +- boxed classes which store validated payloads, sealed permits class implementations +- classes to store validated map payloads, extends FrozenMap +- classes to build inputs for map payloads + +## Nested Class Summary +| Modifier and Type | Class and Description | +| ----------------- | ---------------------- | +| sealed interface | [DependentSchemasDependenciesWithEscapedCharacters.DependentSchemasDependenciesWithEscapedCharacters1Boxed](#dependentschemasdependencieswithescapedcharacters1boxed)
    sealed interface for validated payloads | +| record | [DependentSchemasDependenciesWithEscapedCharacters.DependentSchemasDependenciesWithEscapedCharacters1BoxedVoid](#dependentschemasdependencieswithescapedcharacters1boxedvoid)
    boxed class to store validated null payloads | +| record | [DependentSchemasDependenciesWithEscapedCharacters.DependentSchemasDependenciesWithEscapedCharacters1BoxedBoolean](#dependentschemasdependencieswithescapedcharacters1boxedboolean)
    boxed class to store validated boolean payloads | +| record | [DependentSchemasDependenciesWithEscapedCharacters.DependentSchemasDependenciesWithEscapedCharacters1BoxedNumber](#dependentschemasdependencieswithescapedcharacters1boxednumber)
    boxed class to store validated Number payloads | +| record | [DependentSchemasDependenciesWithEscapedCharacters.DependentSchemasDependenciesWithEscapedCharacters1BoxedString](#dependentschemasdependencieswithescapedcharacters1boxedstring)
    boxed class to store validated String payloads | +| record | [DependentSchemasDependenciesWithEscapedCharacters.DependentSchemasDependenciesWithEscapedCharacters1BoxedList](#dependentschemasdependencieswithescapedcharacters1boxedlist)
    boxed class to store validated List payloads | +| record | [DependentSchemasDependenciesWithEscapedCharacters.DependentSchemasDependenciesWithEscapedCharacters1BoxedMap](#dependentschemasdependencieswithescapedcharacters1boxedmap)
    boxed class to store validated Map payloads | +| static class | [DependentSchemasDependenciesWithEscapedCharacters.DependentSchemasDependenciesWithEscapedCharacters1](#dependentschemasdependencieswithescapedcharacters1)
    schema class | +| sealed interface | [DependentSchemasDependenciesWithEscapedCharacters.FoobarBoxed](#foobarboxed)
    sealed interface for validated payloads | +| record | [DependentSchemasDependenciesWithEscapedCharacters.FoobarBoxedVoid](#foobarboxedvoid)
    boxed class to store validated null payloads | +| record | [DependentSchemasDependenciesWithEscapedCharacters.FoobarBoxedBoolean](#foobarboxedboolean)
    boxed class to store validated boolean payloads | +| record | [DependentSchemasDependenciesWithEscapedCharacters.FoobarBoxedNumber](#foobarboxednumber)
    boxed class to store validated Number payloads | +| record | [DependentSchemasDependenciesWithEscapedCharacters.FoobarBoxedString](#foobarboxedstring)
    boxed class to store validated String payloads | +| record | [DependentSchemasDependenciesWithEscapedCharacters.FoobarBoxedList](#foobarboxedlist)
    boxed class to store validated List payloads | +| record | [DependentSchemasDependenciesWithEscapedCharacters.FoobarBoxedMap](#foobarboxedmap)
    boxed class to store validated Map payloads | +| static class | [DependentSchemasDependenciesWithEscapedCharacters.Foobar](#foobar)
    schema class | +| static class | [DependentSchemasDependenciesWithEscapedCharacters.FoobarMapBuilder](#foobarmapbuilder)
    builder for Map payloads | +| static class | [DependentSchemasDependenciesWithEscapedCharacters.FoobarMap](#foobarmap)
    output class for Map payloads | +| sealed interface | [DependentSchemasDependenciesWithEscapedCharacters.FootbarBoxed](#footbarboxed)
    sealed interface for validated payloads | +| record | [DependentSchemasDependenciesWithEscapedCharacters.FootbarBoxedVoid](#footbarboxedvoid)
    boxed class to store validated null payloads | +| record | [DependentSchemasDependenciesWithEscapedCharacters.FootbarBoxedBoolean](#footbarboxedboolean)
    boxed class to store validated boolean payloads | +| record | [DependentSchemasDependenciesWithEscapedCharacters.FootbarBoxedNumber](#footbarboxednumber)
    boxed class to store validated Number payloads | +| record | [DependentSchemasDependenciesWithEscapedCharacters.FootbarBoxedString](#footbarboxedstring)
    boxed class to store validated String payloads | +| record | [DependentSchemasDependenciesWithEscapedCharacters.FootbarBoxedList](#footbarboxedlist)
    boxed class to store validated List payloads | +| record | [DependentSchemasDependenciesWithEscapedCharacters.FootbarBoxedMap](#footbarboxedmap)
    boxed class to store validated Map payloads | +| static class | [DependentSchemasDependenciesWithEscapedCharacters.Footbar](#footbar)
    schema class | + +## DependentSchemasDependenciesWithEscapedCharacters1Boxed +sealed interface DependentSchemasDependenciesWithEscapedCharacters1Boxed
    +permits
    +[DependentSchemasDependenciesWithEscapedCharacters1BoxedVoid](#dependentschemasdependencieswithescapedcharacters1boxedvoid), +[DependentSchemasDependenciesWithEscapedCharacters1BoxedBoolean](#dependentschemasdependencieswithescapedcharacters1boxedboolean), +[DependentSchemasDependenciesWithEscapedCharacters1BoxedNumber](#dependentschemasdependencieswithescapedcharacters1boxednumber), +[DependentSchemasDependenciesWithEscapedCharacters1BoxedString](#dependentschemasdependencieswithescapedcharacters1boxedstring), +[DependentSchemasDependenciesWithEscapedCharacters1BoxedList](#dependentschemasdependencieswithescapedcharacters1boxedlist), +[DependentSchemasDependenciesWithEscapedCharacters1BoxedMap](#dependentschemasdependencieswithescapedcharacters1boxedmap) + +sealed interface that stores validated payloads using boxed classes + +## DependentSchemasDependenciesWithEscapedCharacters1BoxedVoid +data class DependentSchemasDependenciesWithEscapedCharacters1BoxedVoid
    +implements [DependentSchemasDependenciesWithEscapedCharacters1Boxed](#dependentschemasdependencieswithescapedcharacters1boxed) + +data class that stores validated null payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| DependentSchemasDependenciesWithEscapedCharacters1BoxedVoid(Nothing? data)
    Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| Nothing? | data()
    validated payload | +| Any? | getData()
    validated payload | + +## DependentSchemasDependenciesWithEscapedCharacters1BoxedBoolean +data class DependentSchemasDependenciesWithEscapedCharacters1BoxedBoolean
    +implements [DependentSchemasDependenciesWithEscapedCharacters1Boxed](#dependentschemasdependencieswithescapedcharacters1boxed) + +record that stores validated boolean payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| DependentSchemasDependenciesWithEscapedCharacters1BoxedBoolean(boolean data)
    Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| boolean | data()
    validated payload | +| Any? | getData()
    validated payload | + +## DependentSchemasDependenciesWithEscapedCharacters1BoxedNumber +data class DependentSchemasDependenciesWithEscapedCharacters1BoxedNumber
    +implements [DependentSchemasDependenciesWithEscapedCharacters1Boxed](#dependentschemasdependencieswithescapedcharacters1boxed) + +data class that stores validated Number payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| DependentSchemasDependenciesWithEscapedCharacters1BoxedNumber(Number data)
    Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| Number | data()
    validated payload | +| Any? | getData()
    validated payload | + +## DependentSchemasDependenciesWithEscapedCharacters1BoxedString +data class DependentSchemasDependenciesWithEscapedCharacters1BoxedString
    +implements [DependentSchemasDependenciesWithEscapedCharacters1Boxed](#dependentschemasdependencieswithescapedcharacters1boxed) + +data class that stores validated String payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| DependentSchemasDependenciesWithEscapedCharacters1BoxedString(String data)
    Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| String | data()
    validated payload | +| Any? | getData()
    validated payload | + +## DependentSchemasDependenciesWithEscapedCharacters1BoxedList +data class DependentSchemasDependenciesWithEscapedCharacters1BoxedList
    +implements [DependentSchemasDependenciesWithEscapedCharacters1Boxed](#dependentschemasdependencieswithescapedcharacters1boxed) + +data class that stores validated List payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| DependentSchemasDependenciesWithEscapedCharacters1BoxedList(FrozenList data)
    Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| FrozenList | data()
    validated payload | +| Any? | getData()
    validated payload | + +## DependentSchemasDependenciesWithEscapedCharacters1BoxedMap +data class DependentSchemasDependenciesWithEscapedCharacters1BoxedMap
    +implements [DependentSchemasDependenciesWithEscapedCharacters1Boxed](#dependentschemasdependencieswithescapedcharacters1boxed) + +data class that stores validated Map payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| DependentSchemasDependenciesWithEscapedCharacters1BoxedMap(FrozenMap data)
    Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| FrozenMap | data()
    validated payload | +| Any? | getData()
    validated payload | + +## DependentSchemasDependenciesWithEscapedCharacters1 +class DependentSchemasDependenciesWithEscapedCharacters1
    +extends JsonSchema + +A schema class that validates payloads + +### Field Summary +| Modifier and Type | Field and Description | +| ----------------- | ---------------------- | +| Map> | dependentSchemas = mapOf(
        new PropertyEntry("foo\tbar", [Footbar::class.java](#footbar))),
        new PropertyEntry("foo'bar", [Foobar::class.java](#foobar)))
    )
    | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| String | validate(arg: String, configuration: SchemaConfiguration) | +| Nothing? | validate(arg: Nothing?, configuration: SchemaConfiguration) | +| int | validate(arg: int, configuration: SchemaConfiguration) | +| long | validate(arg: long, configuration: SchemaConfiguration) | +| float | validate(arg: float, configuration: SchemaConfiguration) | +| double | validate(arg: double, configuration: SchemaConfiguration) | +| Number | validate(arg: Number, configuration: SchemaConfiguration) | +| boolean | validate(arg: boolean, configuration: SchemaConfiguration) | +| FrozenMap | validate(arg: Map<?, ?>, configuration: SchemaConfiguration) | +| FrozenList | validate(arg: List<*>, configuration: SchemaConfiguration) | +| [DependentSchemasDependenciesWithEscapedCharacters1BoxedString](#dependentschemasdependencieswithescapedcharacters1boxedstring) | validateAndBox(String, configuration: SchemaConfiguration) | +| [DependentSchemasDependenciesWithEscapedCharacters1BoxedVoid](#dependentschemasdependencieswithescapedcharacters1boxedvoid) | validateAndBox(Nothing?, configuration: SchemaConfiguration) | +| [DependentSchemasDependenciesWithEscapedCharacters1BoxedNumber](#dependentschemasdependencieswithescapedcharacters1boxednumber) | validateAndBox(Number, configuration: SchemaConfiguration) | +| [DependentSchemasDependenciesWithEscapedCharacters1BoxedBoolean](#dependentschemasdependencieswithescapedcharacters1boxedboolean) | validateAndBox(boolean, configuration: SchemaConfiguration) | +| [DependentSchemasDependenciesWithEscapedCharacters1BoxedMap](#dependentschemasdependencieswithescapedcharacters1boxedmap) | validateAndBox(Map<?, ?>, configuration: SchemaConfiguration) | +| [DependentSchemasDependenciesWithEscapedCharacters1BoxedList](#dependentschemasdependencieswithescapedcharacters1boxedlist) | validateAndBox(List<*>, configuration: SchemaConfiguration) | +| [DependentSchemasDependenciesWithEscapedCharacters1Boxed](#dependentschemasdependencieswithescapedcharacters1boxed) | validateAndBox(Any?, configuration: SchemaConfiguration) | +| Any? | validate(arg: Any?, configuration: SchemaConfiguration) | + +## FoobarBoxed +sealed interface FoobarBoxed
    +permits
    +[FoobarBoxedVoid](#foobarboxedvoid), +[FoobarBoxedBoolean](#foobarboxedboolean), +[FoobarBoxedNumber](#foobarboxednumber), +[FoobarBoxedString](#foobarboxedstring), +[FoobarBoxedList](#foobarboxedlist), +[FoobarBoxedMap](#foobarboxedmap) + +sealed interface that stores validated payloads using boxed classes + +## FoobarBoxedVoid +data class FoobarBoxedVoid
    +implements [FoobarBoxed](#foobarboxed) + +data class that stores validated null payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| FoobarBoxedVoid(Nothing? data)
    Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| Nothing? | data()
    validated payload | +| Any? | getData()
    validated payload | + +## FoobarBoxedBoolean +data class FoobarBoxedBoolean
    +implements [FoobarBoxed](#foobarboxed) + +record that stores validated boolean payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| FoobarBoxedBoolean(boolean data)
    Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| boolean | data()
    validated payload | +| Any? | getData()
    validated payload | + +## FoobarBoxedNumber +data class FoobarBoxedNumber
    +implements [FoobarBoxed](#foobarboxed) + +data class that stores validated Number payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| FoobarBoxedNumber(Number data)
    Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| Number | data()
    validated payload | +| Any? | getData()
    validated payload | + +## FoobarBoxedString +data class FoobarBoxedString
    +implements [FoobarBoxed](#foobarboxed) + +data class that stores validated String payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| FoobarBoxedString(String data)
    Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| String | data()
    validated payload | +| Any? | getData()
    validated payload | + +## FoobarBoxedList +data class FoobarBoxedList
    +implements [FoobarBoxed](#foobarboxed) + +data class that stores validated List payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| FoobarBoxedList(FrozenList data)
    Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| FrozenList | data()
    validated payload | +| Any? | getData()
    validated payload | + +## FoobarBoxedMap +data class FoobarBoxedMap
    +implements [FoobarBoxed](#foobarboxed) + +data class that stores validated Map payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| FoobarBoxedMap([FoobarMap](#foobarmap) data)
    Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| [FoobarMap](#foobarmap) | data()
    validated payload | +| Any? | getData()
    validated payload | + +## Foobar +class Foobar
    +extends JsonSchema + +A schema class that validates payloads + +### Field Summary +| Modifier and Type | Field and Description | +| ----------------- | ---------------------- | +| Set | required = setOf(
        "foo\"bar"
    )
    | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| String | validate(arg: String, configuration: SchemaConfiguration) | +| Nothing? | validate(arg: Nothing?, configuration: SchemaConfiguration) | +| int | validate(arg: int, configuration: SchemaConfiguration) | +| long | validate(arg: long, configuration: SchemaConfiguration) | +| float | validate(arg: float, configuration: SchemaConfiguration) | +| double | validate(arg: double, configuration: SchemaConfiguration) | +| Number | validate(arg: Number, configuration: SchemaConfiguration) | +| boolean | validate(arg: boolean, configuration: SchemaConfiguration) | +| [FoobarMap](#foobarmap) | validate(arg: [Map<?, ?>](#foobarmapbuilder), configuration: SchemaConfiguration) | +| FrozenList | validate(arg: List<*>, configuration: SchemaConfiguration) | +| [FoobarBoxedString](#foobarboxedstring) | validateAndBox(String, configuration: SchemaConfiguration) | +| [FoobarBoxedVoid](#foobarboxedvoid) | validateAndBox(Nothing?, configuration: SchemaConfiguration) | +| [FoobarBoxedNumber](#foobarboxednumber) | validateAndBox(Number, configuration: SchemaConfiguration) | +| [FoobarBoxedBoolean](#foobarboxedboolean) | validateAndBox(boolean, configuration: SchemaConfiguration) | +| [FoobarBoxedMap](#foobarboxedmap) | validateAndBox([Map<?, ?>](#foobarmapbuilder), configuration: SchemaConfiguration) | +| [FoobarBoxedList](#foobarboxedlist) | validateAndBox(List<*>, configuration: SchemaConfiguration) | +| [FoobarBoxed](#foobarboxed) | validateAndBox(Any?, configuration: SchemaConfiguration) | +| Any? | validate(arg: Any?, configuration: SchemaConfiguration) | + +## FoobarMap0Builder +class FoobarMap0Builder
    +builder for `Map` + +A class that builds the Map input type + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| FoobarMap0Builder(Map instance)
    Creates a builder that contains the passed instance | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| Map | build()
    Returns map input that should be used with Schema.validate | +| [FoobarMap0Builder](#foobarmap0builder) | additionalProperty(key: String, value: Nothing?) | +| [FoobarMap0Builder](#foobarmap0builder) | additionalProperty(key: String, value: Boolean) | +| [FoobarMap0Builder](#foobarmap0builder) | additionalProperty(key: String, value: String) | +| [FoobarMap0Builder](#foobarmap0builder) | additionalProperty(key: String, value: Int) | +| [FoobarMap0Builder](#foobarmap0builder) | additionalProperty(key: String, value: Float) | +| [FoobarMap0Builder](#foobarmap0builder) | additionalProperty(key: String, value: Long) | +| [FoobarMap0Builder](#foobarmap0builder) | additionalProperty(key: String, value: Double) | +| [FoobarMap0Builder](#foobarmap0builder) | additionalProperty(key: String, value: List) | +| [FoobarMap0Builder](#foobarmap0builder) | additionalProperty(key: String, value: Map) | + +## FoobarMapBuilder +class FoobarMapBuilder
    +builder for `Map` + +A class that builds the Map input type + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| FoobarMapBuilder()
    Creates a builder that contains an empty map | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| [FoobarMap0Builder](#foobarmap0builder) | fooReverseSolidusQuotationMarkBar(value: Nothing?) | +| [FoobarMap0Builder](#foobarmap0builder) | fooReverseSolidusQuotationMarkBar(value: Boolean) | +| [FoobarMap0Builder](#foobarmap0builder) | fooReverseSolidusQuotationMarkBar(value: String) | +| [FoobarMap0Builder](#foobarmap0builder) | fooReverseSolidusQuotationMarkBar(value: Int) | +| [FoobarMap0Builder](#foobarmap0builder) | fooReverseSolidusQuotationMarkBar(value: Float) | +| [FoobarMap0Builder](#foobarmap0builder) | fooReverseSolidusQuotationMarkBar(value: Long) | +| [FoobarMap0Builder](#foobarmap0builder) | fooReverseSolidusQuotationMarkBar(value: Double) | +| [FoobarMap0Builder](#foobarmap0builder) | fooReverseSolidusQuotationMarkBar(value: List) | +| [FoobarMap0Builder](#foobarmap0builder) | fooReverseSolidusQuotationMarkBar(value: Map) | + +## FoobarMap +class FoobarMap
    +extends FrozenMap + +A class to store validated Map payloads + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| static [FoobarMap](#foobarmap) | of([Map](#foobarmapbuilder) arg, SchemaConfiguration configuration) | +| Any? | get(String key)
    This schema has invalid Kotlin names so this method must be used when you access instance["foo\"bar"], | +| Any? | getAdditionalProperty(String name)
    provides type safety for additional properties | + +## FootbarBoxed +sealed interface FootbarBoxed
    +permits
    +[FootbarBoxedVoid](#footbarboxedvoid), +[FootbarBoxedBoolean](#footbarboxedboolean), +[FootbarBoxedNumber](#footbarboxednumber), +[FootbarBoxedString](#footbarboxedstring), +[FootbarBoxedList](#footbarboxedlist), +[FootbarBoxedMap](#footbarboxedmap) + +sealed interface that stores validated payloads using boxed classes + +## FootbarBoxedVoid +data class FootbarBoxedVoid
    +implements [FootbarBoxed](#footbarboxed) + +data class that stores validated null payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| FootbarBoxedVoid(Nothing? data)
    Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| Nothing? | data()
    validated payload | +| Any? | getData()
    validated payload | + +## FootbarBoxedBoolean +data class FootbarBoxedBoolean
    +implements [FootbarBoxed](#footbarboxed) + +record that stores validated boolean payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| FootbarBoxedBoolean(boolean data)
    Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| boolean | data()
    validated payload | +| Any? | getData()
    validated payload | + +## FootbarBoxedNumber +data class FootbarBoxedNumber
    +implements [FootbarBoxed](#footbarboxed) + +data class that stores validated Number payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| FootbarBoxedNumber(Number data)
    Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| Number | data()
    validated payload | +| Any? | getData()
    validated payload | + +## FootbarBoxedString +data class FootbarBoxedString
    +implements [FootbarBoxed](#footbarboxed) + +data class that stores validated String payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| FootbarBoxedString(String data)
    Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| String | data()
    validated payload | +| Any? | getData()
    validated payload | + +## FootbarBoxedList +data class FootbarBoxedList
    +implements [FootbarBoxed](#footbarboxed) + +data class that stores validated List payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| FootbarBoxedList(FrozenList data)
    Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| FrozenList | data()
    validated payload | +| Any? | getData()
    validated payload | + +## FootbarBoxedMap +data class FootbarBoxedMap
    +implements [FootbarBoxed](#footbarboxed) + +data class that stores validated Map payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| FootbarBoxedMap(FrozenMap data)
    Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| FrozenMap | data()
    validated payload | +| Any? | getData()
    validated payload | + +## Footbar +class Footbar
    +extends JsonSchema + +A schema class that validates payloads + +### Field Summary +| Modifier and Type | Field and Description | +| ----------------- | ---------------------- | +| Integer | minProperties = 4 | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| String | validate(arg: String, configuration: SchemaConfiguration) | +| Nothing? | validate(arg: Nothing?, configuration: SchemaConfiguration) | +| int | validate(arg: int, configuration: SchemaConfiguration) | +| long | validate(arg: long, configuration: SchemaConfiguration) | +| float | validate(arg: float, configuration: SchemaConfiguration) | +| double | validate(arg: double, configuration: SchemaConfiguration) | +| Number | validate(arg: Number, configuration: SchemaConfiguration) | +| boolean | validate(arg: boolean, configuration: SchemaConfiguration) | +| FrozenMap | validate(arg: Map<?, ?>, configuration: SchemaConfiguration) | +| FrozenList | validate(arg: List<*>, configuration: SchemaConfiguration) | +| [FootbarBoxedString](#footbarboxedstring) | validateAndBox(String, configuration: SchemaConfiguration) | +| [FootbarBoxedVoid](#footbarboxedvoid) | validateAndBox(Nothing?, configuration: SchemaConfiguration) | +| [FootbarBoxedNumber](#footbarboxednumber) | validateAndBox(Number, configuration: SchemaConfiguration) | +| [FootbarBoxedBoolean](#footbarboxedboolean) | validateAndBox(boolean, configuration: SchemaConfiguration) | +| [FootbarBoxedMap](#footbarboxedmap) | validateAndBox(Map<?, ?>, configuration: SchemaConfiguration) | +| [FootbarBoxedList](#footbarboxedlist) | validateAndBox(List<*>, configuration: SchemaConfiguration) | +| [FootbarBoxed](#footbarboxed) | validateAndBox(Any?, configuration: SchemaConfiguration) | +| Any? | validate(arg: Any?, configuration: SchemaConfiguration) | + +[[Back to top]](#top) [[Back to Component Schemas]](../../../README.md#Component-Schemas) [[Back to README]](../../../README.md) diff --git a/samples/client/3_1_0_unit_test/kotlin/docs/components/schemas/DependentSchemasDependentSubschemaIncompatibleWithRoot.md b/samples/client/3_1_0_unit_test/kotlin/docs/components/schemas/DependentSchemasDependentSubschemaIncompatibleWithRoot.md new file mode 100644 index 00000000000..29ad51535c7 --- /dev/null +++ b/samples/client/3_1_0_unit_test/kotlin/docs/components/schemas/DependentSchemasDependentSubschemaIncompatibleWithRoot.md @@ -0,0 +1,732 @@ +# DependentSchemasDependentSubschemaIncompatibleWithRoot +org.openapijsonschematools.client.components.schemas.DependentSchemasDependentSubschemaIncompatibleWithRoot.java +class DependentSchemasDependentSubschemaIncompatibleWithRoot
    + +A class that contains necessary nested +- schema classes (which validate payloads), extends JsonSchema +- sealed interfaces which store validated payloads, Kotlin version of a sum type +- boxed classes which store validated payloads, sealed permits class implementations +- classes to store validated map payloads, extends FrozenMap +- classes to build inputs for map payloads + +## Nested Class Summary +| Modifier and Type | Class and Description | +| ----------------- | ---------------------- | +| sealed interface | [DependentSchemasDependentSubschemaIncompatibleWithRoot.DependentSchemasDependentSubschemaIncompatibleWithRoot1Boxed](#dependentschemasdependentsubschemaincompatiblewithroot1boxed)
    sealed interface for validated payloads | +| record | [DependentSchemasDependentSubschemaIncompatibleWithRoot.DependentSchemasDependentSubschemaIncompatibleWithRoot1BoxedVoid](#dependentschemasdependentsubschemaincompatiblewithroot1boxedvoid)
    boxed class to store validated null payloads | +| record | [DependentSchemasDependentSubschemaIncompatibleWithRoot.DependentSchemasDependentSubschemaIncompatibleWithRoot1BoxedBoolean](#dependentschemasdependentsubschemaincompatiblewithroot1boxedboolean)
    boxed class to store validated boolean payloads | +| record | [DependentSchemasDependentSubschemaIncompatibleWithRoot.DependentSchemasDependentSubschemaIncompatibleWithRoot1BoxedNumber](#dependentschemasdependentsubschemaincompatiblewithroot1boxednumber)
    boxed class to store validated Number payloads | +| record | [DependentSchemasDependentSubschemaIncompatibleWithRoot.DependentSchemasDependentSubschemaIncompatibleWithRoot1BoxedString](#dependentschemasdependentsubschemaincompatiblewithroot1boxedstring)
    boxed class to store validated String payloads | +| record | [DependentSchemasDependentSubschemaIncompatibleWithRoot.DependentSchemasDependentSubschemaIncompatibleWithRoot1BoxedList](#dependentschemasdependentsubschemaincompatiblewithroot1boxedlist)
    boxed class to store validated List payloads | +| record | [DependentSchemasDependentSubschemaIncompatibleWithRoot.DependentSchemasDependentSubschemaIncompatibleWithRoot1BoxedMap](#dependentschemasdependentsubschemaincompatiblewithroot1boxedmap)
    boxed class to store validated Map payloads | +| static class | [DependentSchemasDependentSubschemaIncompatibleWithRoot.DependentSchemasDependentSubschemaIncompatibleWithRoot1](#dependentschemasdependentsubschemaincompatiblewithroot1)
    schema class | +| static class | [DependentSchemasDependentSubschemaIncompatibleWithRoot.DependentSchemasDependentSubschemaIncompatibleWithRootMapBuilder](#dependentschemasdependentsubschemaincompatiblewithrootmapbuilder)
    builder for Map payloads | +| static class | [DependentSchemasDependentSubschemaIncompatibleWithRoot.DependentSchemasDependentSubschemaIncompatibleWithRootMap](#dependentschemasdependentsubschemaincompatiblewithrootmap)
    output class for Map payloads | +| sealed interface | [DependentSchemasDependentSubschemaIncompatibleWithRoot.FooBoxed](#fooboxed)
    sealed interface for validated payloads | +| record | [DependentSchemasDependentSubschemaIncompatibleWithRoot.FooBoxedVoid](#fooboxedvoid)
    boxed class to store validated null payloads | +| record | [DependentSchemasDependentSubschemaIncompatibleWithRoot.FooBoxedBoolean](#fooboxedboolean)
    boxed class to store validated boolean payloads | +| record | [DependentSchemasDependentSubschemaIncompatibleWithRoot.FooBoxedNumber](#fooboxednumber)
    boxed class to store validated Number payloads | +| record | [DependentSchemasDependentSubschemaIncompatibleWithRoot.FooBoxedString](#fooboxedstring)
    boxed class to store validated String payloads | +| record | [DependentSchemasDependentSubschemaIncompatibleWithRoot.FooBoxedList](#fooboxedlist)
    boxed class to store validated List payloads | +| record | [DependentSchemasDependentSubschemaIncompatibleWithRoot.FooBoxedMap](#fooboxedmap)
    boxed class to store validated Map payloads | +| static class | [DependentSchemasDependentSubschemaIncompatibleWithRoot.Foo](#foo)
    schema class | +| sealed interface | [DependentSchemasDependentSubschemaIncompatibleWithRoot.Foo1Boxed](#foo1boxed)
    sealed interface for validated payloads | +| record | [DependentSchemasDependentSubschemaIncompatibleWithRoot.Foo1BoxedMap](#foo1boxedmap)
    boxed class to store validated Map payloads | +| static class | [DependentSchemasDependentSubschemaIncompatibleWithRoot.Foo1](#foo1)
    schema class | +| static class | [DependentSchemasDependentSubschemaIncompatibleWithRoot.FooMapBuilder1](#foomapbuilder1)
    builder for Map payloads | +| static class | [DependentSchemasDependentSubschemaIncompatibleWithRoot.FooMap](#foomap)
    output class for Map payloads | +| sealed interface | [DependentSchemasDependentSubschemaIncompatibleWithRoot.BarBoxed](#barboxed)
    sealed interface for validated payloads | +| record | [DependentSchemasDependentSubschemaIncompatibleWithRoot.BarBoxedVoid](#barboxedvoid)
    boxed class to store validated null payloads | +| record | [DependentSchemasDependentSubschemaIncompatibleWithRoot.BarBoxedBoolean](#barboxedboolean)
    boxed class to store validated boolean payloads | +| record | [DependentSchemasDependentSubschemaIncompatibleWithRoot.BarBoxedNumber](#barboxednumber)
    boxed class to store validated Number payloads | +| record | [DependentSchemasDependentSubschemaIncompatibleWithRoot.BarBoxedString](#barboxedstring)
    boxed class to store validated String payloads | +| record | [DependentSchemasDependentSubschemaIncompatibleWithRoot.BarBoxedList](#barboxedlist)
    boxed class to store validated List payloads | +| record | [DependentSchemasDependentSubschemaIncompatibleWithRoot.BarBoxedMap](#barboxedmap)
    boxed class to store validated Map payloads | +| static class | [DependentSchemasDependentSubschemaIncompatibleWithRoot.Bar](#bar)
    schema class | +| sealed interface | [DependentSchemasDependentSubschemaIncompatibleWithRoot.AdditionalPropertiesBoxed](#additionalpropertiesboxed)
    sealed interface for validated payloads | +| record | [DependentSchemasDependentSubschemaIncompatibleWithRoot.AdditionalPropertiesBoxedVoid](#additionalpropertiesboxedvoid)
    boxed class to store validated null payloads | +| record | [DependentSchemasDependentSubschemaIncompatibleWithRoot.AdditionalPropertiesBoxedBoolean](#additionalpropertiesboxedboolean)
    boxed class to store validated boolean payloads | +| record | [DependentSchemasDependentSubschemaIncompatibleWithRoot.AdditionalPropertiesBoxedNumber](#additionalpropertiesboxednumber)
    boxed class to store validated Number payloads | +| record | [DependentSchemasDependentSubschemaIncompatibleWithRoot.AdditionalPropertiesBoxedString](#additionalpropertiesboxedstring)
    boxed class to store validated String payloads | +| record | [DependentSchemasDependentSubschemaIncompatibleWithRoot.AdditionalPropertiesBoxedList](#additionalpropertiesboxedlist)
    boxed class to store validated List payloads | +| record | [DependentSchemasDependentSubschemaIncompatibleWithRoot.AdditionalPropertiesBoxedMap](#additionalpropertiesboxedmap)
    boxed class to store validated Map payloads | +| static class | [DependentSchemasDependentSubschemaIncompatibleWithRoot.AdditionalProperties](#additionalproperties)
    schema class | + +## DependentSchemasDependentSubschemaIncompatibleWithRoot1Boxed +sealed interface DependentSchemasDependentSubschemaIncompatibleWithRoot1Boxed
    +permits
    +[DependentSchemasDependentSubschemaIncompatibleWithRoot1BoxedVoid](#dependentschemasdependentsubschemaincompatiblewithroot1boxedvoid), +[DependentSchemasDependentSubschemaIncompatibleWithRoot1BoxedBoolean](#dependentschemasdependentsubschemaincompatiblewithroot1boxedboolean), +[DependentSchemasDependentSubschemaIncompatibleWithRoot1BoxedNumber](#dependentschemasdependentsubschemaincompatiblewithroot1boxednumber), +[DependentSchemasDependentSubschemaIncompatibleWithRoot1BoxedString](#dependentschemasdependentsubschemaincompatiblewithroot1boxedstring), +[DependentSchemasDependentSubschemaIncompatibleWithRoot1BoxedList](#dependentschemasdependentsubschemaincompatiblewithroot1boxedlist), +[DependentSchemasDependentSubschemaIncompatibleWithRoot1BoxedMap](#dependentschemasdependentsubschemaincompatiblewithroot1boxedmap) + +sealed interface that stores validated payloads using boxed classes + +## DependentSchemasDependentSubschemaIncompatibleWithRoot1BoxedVoid +data class DependentSchemasDependentSubschemaIncompatibleWithRoot1BoxedVoid
    +implements [DependentSchemasDependentSubschemaIncompatibleWithRoot1Boxed](#dependentschemasdependentsubschemaincompatiblewithroot1boxed) + +data class that stores validated null payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| DependentSchemasDependentSubschemaIncompatibleWithRoot1BoxedVoid(Nothing? data)
    Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| Nothing? | data()
    validated payload | +| Any? | getData()
    validated payload | + +## DependentSchemasDependentSubschemaIncompatibleWithRoot1BoxedBoolean +data class DependentSchemasDependentSubschemaIncompatibleWithRoot1BoxedBoolean
    +implements [DependentSchemasDependentSubschemaIncompatibleWithRoot1Boxed](#dependentschemasdependentsubschemaincompatiblewithroot1boxed) + +record that stores validated boolean payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| DependentSchemasDependentSubschemaIncompatibleWithRoot1BoxedBoolean(boolean data)
    Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| boolean | data()
    validated payload | +| Any? | getData()
    validated payload | + +## DependentSchemasDependentSubschemaIncompatibleWithRoot1BoxedNumber +data class DependentSchemasDependentSubschemaIncompatibleWithRoot1BoxedNumber
    +implements [DependentSchemasDependentSubschemaIncompatibleWithRoot1Boxed](#dependentschemasdependentsubschemaincompatiblewithroot1boxed) + +data class that stores validated Number payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| DependentSchemasDependentSubschemaIncompatibleWithRoot1BoxedNumber(Number data)
    Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| Number | data()
    validated payload | +| Any? | getData()
    validated payload | + +## DependentSchemasDependentSubschemaIncompatibleWithRoot1BoxedString +data class DependentSchemasDependentSubschemaIncompatibleWithRoot1BoxedString
    +implements [DependentSchemasDependentSubschemaIncompatibleWithRoot1Boxed](#dependentschemasdependentsubschemaincompatiblewithroot1boxed) + +data class that stores validated String payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| DependentSchemasDependentSubschemaIncompatibleWithRoot1BoxedString(String data)
    Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| String | data()
    validated payload | +| Any? | getData()
    validated payload | + +## DependentSchemasDependentSubschemaIncompatibleWithRoot1BoxedList +data class DependentSchemasDependentSubschemaIncompatibleWithRoot1BoxedList
    +implements [DependentSchemasDependentSubschemaIncompatibleWithRoot1Boxed](#dependentschemasdependentsubschemaincompatiblewithroot1boxed) + +data class that stores validated List payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| DependentSchemasDependentSubschemaIncompatibleWithRoot1BoxedList(FrozenList data)
    Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| FrozenList | data()
    validated payload | +| Any? | getData()
    validated payload | + +## DependentSchemasDependentSubschemaIncompatibleWithRoot1BoxedMap +data class DependentSchemasDependentSubschemaIncompatibleWithRoot1BoxedMap
    +implements [DependentSchemasDependentSubschemaIncompatibleWithRoot1Boxed](#dependentschemasdependentsubschemaincompatiblewithroot1boxed) + +data class that stores validated Map payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| DependentSchemasDependentSubschemaIncompatibleWithRoot1BoxedMap([DependentSchemasDependentSubschemaIncompatibleWithRootMap](#dependentschemasdependentsubschemaincompatiblewithrootmap) data)
    Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| [DependentSchemasDependentSubschemaIncompatibleWithRootMap](#dependentschemasdependentsubschemaincompatiblewithrootmap) | data()
    validated payload | +| Any? | getData()
    validated payload | + +## DependentSchemasDependentSubschemaIncompatibleWithRoot1 +class DependentSchemasDependentSubschemaIncompatibleWithRoot1
    +extends JsonSchema + +A schema class that validates payloads + +### Field Summary +| Modifier and Type | Field and Description | +| ----------------- | ---------------------- | +| Map> | properties = mapOf(
        "foo" to [Foo::class.java](#foo))
    )
    | +| Map> | dependentSchemas = mapOf(
        new PropertyEntry("foo", [Foo1::class.java](#foo1)))
    )
    | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| String | validate(arg: String, configuration: SchemaConfiguration) | +| Nothing? | validate(arg: Nothing?, configuration: SchemaConfiguration) | +| int | validate(arg: int, configuration: SchemaConfiguration) | +| long | validate(arg: long, configuration: SchemaConfiguration) | +| float | validate(arg: float, configuration: SchemaConfiguration) | +| double | validate(arg: double, configuration: SchemaConfiguration) | +| Number | validate(arg: Number, configuration: SchemaConfiguration) | +| boolean | validate(arg: boolean, configuration: SchemaConfiguration) | +| [DependentSchemasDependentSubschemaIncompatibleWithRootMap](#dependentschemasdependentsubschemaincompatiblewithrootmap) | validate(arg: [Map<?, ?>](#dependentschemasdependentsubschemaincompatiblewithrootmapbuilder), configuration: SchemaConfiguration) | +| FrozenList | validate(arg: List<*>, configuration: SchemaConfiguration) | +| [DependentSchemasDependentSubschemaIncompatibleWithRoot1BoxedString](#dependentschemasdependentsubschemaincompatiblewithroot1boxedstring) | validateAndBox(String, configuration: SchemaConfiguration) | +| [DependentSchemasDependentSubschemaIncompatibleWithRoot1BoxedVoid](#dependentschemasdependentsubschemaincompatiblewithroot1boxedvoid) | validateAndBox(Nothing?, configuration: SchemaConfiguration) | +| [DependentSchemasDependentSubschemaIncompatibleWithRoot1BoxedNumber](#dependentschemasdependentsubschemaincompatiblewithroot1boxednumber) | validateAndBox(Number, configuration: SchemaConfiguration) | +| [DependentSchemasDependentSubschemaIncompatibleWithRoot1BoxedBoolean](#dependentschemasdependentsubschemaincompatiblewithroot1boxedboolean) | validateAndBox(boolean, configuration: SchemaConfiguration) | +| [DependentSchemasDependentSubschemaIncompatibleWithRoot1BoxedMap](#dependentschemasdependentsubschemaincompatiblewithroot1boxedmap) | validateAndBox([Map<?, ?>](#dependentschemasdependentsubschemaincompatiblewithrootmapbuilder), configuration: SchemaConfiguration) | +| [DependentSchemasDependentSubschemaIncompatibleWithRoot1BoxedList](#dependentschemasdependentsubschemaincompatiblewithroot1boxedlist) | validateAndBox(List<*>, configuration: SchemaConfiguration) | +| [DependentSchemasDependentSubschemaIncompatibleWithRoot1Boxed](#dependentschemasdependentsubschemaincompatiblewithroot1boxed) | validateAndBox(Any?, configuration: SchemaConfiguration) | +| Any? | validate(arg: Any?, configuration: SchemaConfiguration) | + +## DependentSchemasDependentSubschemaIncompatibleWithRootMapBuilder +class DependentSchemasDependentSubschemaIncompatibleWithRootMapBuilder
    +builder for `Map` + +A class that builds the Map input type + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| DependentSchemasDependentSubschemaIncompatibleWithRootMapBuilder()
    Creates a builder that contains an empty map | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| Map | build()
    Returns map input that should be used with Schema.validate | +| [DependentSchemasDependentSubschemaIncompatibleWithRootMapBuilder](#dependentschemasdependentsubschemaincompatiblewithrootmapbuilder) | foo(value: Nothing?) | +| [DependentSchemasDependentSubschemaIncompatibleWithRootMapBuilder](#dependentschemasdependentsubschemaincompatiblewithrootmapbuilder) | foo(value: Boolean) | +| [DependentSchemasDependentSubschemaIncompatibleWithRootMapBuilder](#dependentschemasdependentsubschemaincompatiblewithrootmapbuilder) | foo(value: String) | +| [DependentSchemasDependentSubschemaIncompatibleWithRootMapBuilder](#dependentschemasdependentsubschemaincompatiblewithrootmapbuilder) | foo(value: Int) | +| [DependentSchemasDependentSubschemaIncompatibleWithRootMapBuilder](#dependentschemasdependentsubschemaincompatiblewithrootmapbuilder) | foo(value: Float) | +| [DependentSchemasDependentSubschemaIncompatibleWithRootMapBuilder](#dependentschemasdependentsubschemaincompatiblewithrootmapbuilder) | foo(value: Long) | +| [DependentSchemasDependentSubschemaIncompatibleWithRootMapBuilder](#dependentschemasdependentsubschemaincompatiblewithrootmapbuilder) | foo(value: Double) | +| [DependentSchemasDependentSubschemaIncompatibleWithRootMapBuilder](#dependentschemasdependentsubschemaincompatiblewithrootmapbuilder) | foo(value: List) | +| [DependentSchemasDependentSubschemaIncompatibleWithRootMapBuilder](#dependentschemasdependentsubschemaincompatiblewithrootmapbuilder) | foo(value: Map) | +| [DependentSchemasDependentSubschemaIncompatibleWithRootMapBuilder](#dependentschemasdependentsubschemaincompatiblewithrootmapbuilder) | additionalProperty(key: String, value: Nothing?) | +| [DependentSchemasDependentSubschemaIncompatibleWithRootMapBuilder](#dependentschemasdependentsubschemaincompatiblewithrootmapbuilder) | additionalProperty(key: String, value: Boolean) | +| [DependentSchemasDependentSubschemaIncompatibleWithRootMapBuilder](#dependentschemasdependentsubschemaincompatiblewithrootmapbuilder) | additionalProperty(key: String, value: String) | +| [DependentSchemasDependentSubschemaIncompatibleWithRootMapBuilder](#dependentschemasdependentsubschemaincompatiblewithrootmapbuilder) | additionalProperty(key: String, value: Int) | +| [DependentSchemasDependentSubschemaIncompatibleWithRootMapBuilder](#dependentschemasdependentsubschemaincompatiblewithrootmapbuilder) | additionalProperty(key: String, value: Float) | +| [DependentSchemasDependentSubschemaIncompatibleWithRootMapBuilder](#dependentschemasdependentsubschemaincompatiblewithrootmapbuilder) | additionalProperty(key: String, value: Long) | +| [DependentSchemasDependentSubschemaIncompatibleWithRootMapBuilder](#dependentschemasdependentsubschemaincompatiblewithrootmapbuilder) | additionalProperty(key: String, value: Double) | +| [DependentSchemasDependentSubschemaIncompatibleWithRootMapBuilder](#dependentschemasdependentsubschemaincompatiblewithrootmapbuilder) | additionalProperty(key: String, value: List) | +| [DependentSchemasDependentSubschemaIncompatibleWithRootMapBuilder](#dependentschemasdependentsubschemaincompatiblewithrootmapbuilder) | additionalProperty(key: String, value: Map) | + +## DependentSchemasDependentSubschemaIncompatibleWithRootMap +class DependentSchemasDependentSubschemaIncompatibleWithRootMap
    +extends FrozenMap + +A class to store validated Map payloads + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| static [DependentSchemasDependentSubschemaIncompatibleWithRootMap](#dependentschemasdependentsubschemaincompatiblewithrootmap) | of([Map](#dependentschemasdependentsubschemaincompatiblewithrootmapbuilder) arg, SchemaConfiguration configuration) | +| Any? | foo()
    [optional] | +| Any? | getAdditionalProperty(String name)
    provides type safety for additional properties | + +## FooBoxed +sealed interface FooBoxed
    +permits
    +[FooBoxedVoid](#fooboxedvoid), +[FooBoxedBoolean](#fooboxedboolean), +[FooBoxedNumber](#fooboxednumber), +[FooBoxedString](#fooboxedstring), +[FooBoxedList](#fooboxedlist), +[FooBoxedMap](#fooboxedmap) + +sealed interface that stores validated payloads using boxed classes + +## FooBoxedVoid +data class FooBoxedVoid
    +implements [FooBoxed](#fooboxed) + +data class that stores validated null payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| FooBoxedVoid(Nothing? data)
    Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| Nothing? | data()
    validated payload | +| Any? | getData()
    validated payload | + +## FooBoxedBoolean +data class FooBoxedBoolean
    +implements [FooBoxed](#fooboxed) + +record that stores validated boolean payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| FooBoxedBoolean(boolean data)
    Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| boolean | data()
    validated payload | +| Any? | getData()
    validated payload | + +## FooBoxedNumber +data class FooBoxedNumber
    +implements [FooBoxed](#fooboxed) + +data class that stores validated Number payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| FooBoxedNumber(Number data)
    Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| Number | data()
    validated payload | +| Any? | getData()
    validated payload | + +## FooBoxedString +data class FooBoxedString
    +implements [FooBoxed](#fooboxed) + +data class that stores validated String payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| FooBoxedString(String data)
    Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| String | data()
    validated payload | +| Any? | getData()
    validated payload | + +## FooBoxedList +data class FooBoxedList
    +implements [FooBoxed](#fooboxed) + +data class that stores validated List payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| FooBoxedList(FrozenList data)
    Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| FrozenList | data()
    validated payload | +| Any? | getData()
    validated payload | + +## FooBoxedMap +data class FooBoxedMap
    +implements [FooBoxed](#fooboxed) + +data class that stores validated Map payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| FooBoxedMap(FrozenMap data)
    Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| FrozenMap | data()
    validated payload | +| Any? | getData()
    validated payload | + +## Foo +class Foo
    +extends AnyTypeJsonSchema.AnyTypeJsonSchema1 + +A schema class that validates payloads + +| Methods Inherited from class org.openapijsonschematools.client.schemas.AnyTypeJsonSchema.AnyTypeJsonSchema1 | +| ------------------------------------------------------------------ | +| validate | +| validateAndBox | + +## Foo1Boxed +sealed interface Foo1Boxed
    +permits
    +[Foo1BoxedMap](#foo1boxedmap) + +sealed interface that stores validated payloads using boxed classes + +## Foo1BoxedMap +data class Foo1BoxedMap
    +implements [Foo1Boxed](#foo1boxed) + +data class that stores validated Map payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| Foo1BoxedMap([FooMap](#foomap) data)
    Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| [FooMap](#foomap) | data()
    validated payload | +| Any? | getData()
    validated payload | + +## Foo1 +class Foo1
    +extends JsonSchema + +A schema class that validates payloads + +### Code Sample +``` +import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags; +import org.openapijsonschematools.client.configurations.SchemaConfiguration; +import org.openapijsonschematools.client.exceptions.ValidationException; +import org.openapijsonschematools.client.schemas.validation.MapUtils; +import org.openapijsonschematools.client.schemas.validation.FrozenList; +import org.openapijsonschematools.client.schemas.validation.FrozenMap; +import org.openapijsonschematools.client.components.schemas.DependentSchemasDependentSubschemaIncompatibleWithRoot; + +import java.util.Arrays; +import java.util.List; +import java.util.AbstractMap; + +static final SchemaConfiguration configuration = new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().build()); + +// Map validation +DependentSchemasDependentSubschemaIncompatibleWithRoot.FooMap validatedPayload = + DependentSchemasDependentSubschemaIncompatibleWithRoot.Foo1.validate( + new DependentSchemasDependentSubschemaIncompatibleWithRoot.FooMapBuilder1() + .build(), + configuration +); +``` + +### Field Summary +| Modifier and Type | Field and Description | +| ----------------- | ---------------------- | +| Set> | type = setOf(Map::class.java) | +| Map> | properties = mapOf(
        "bar" to [Bar::class.java](#bar))
    )
    | +| Class | additionalProperties = [AdditionalProperties::class.java](#additionalproperties) | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| [FooMap](#foomap) | validate(arg: [Map<?, ?>](#foomapbuilder1), configuration: SchemaConfiguration) | +| [Foo1BoxedMap](#foo1boxedmap) | validateAndBox([Map<?, ?>](#foomapbuilder1), configuration: SchemaConfiguration) | +| [Foo1Boxed](#foo1boxed) | validateAndBox(Any?, configuration: SchemaConfiguration) | +| Any? | validate(arg: Any?, configuration: SchemaConfiguration) | + +## FooMapBuilder1 +class FooMapBuilder1
    +builder for `Map` + +A class that builds the Map input type + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| FooMapBuilder1()
    Creates a builder that contains an empty map | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| Map | build()
    Returns map input that should be used with Schema.validate | +| [FooMapBuilder1](#foomapbuilder1) | bar(value: Nothing?) | +| [FooMapBuilder1](#foomapbuilder1) | bar(value: Boolean) | +| [FooMapBuilder1](#foomapbuilder1) | bar(value: String) | +| [FooMapBuilder1](#foomapbuilder1) | bar(value: Int) | +| [FooMapBuilder1](#foomapbuilder1) | bar(value: Float) | +| [FooMapBuilder1](#foomapbuilder1) | bar(value: Long) | +| [FooMapBuilder1](#foomapbuilder1) | bar(value: Double) | +| [FooMapBuilder1](#foomapbuilder1) | bar(value: List) | +| [FooMapBuilder1](#foomapbuilder1) | bar(value: Map) | + +## FooMap +class FooMap
    +extends FrozenMap + +A class to store validated Map payloads + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| static [FooMap](#foomap) | of([Map](#foomapbuilder1) arg, SchemaConfiguration configuration) | +| Any? | bar()
    [optional] | + +## BarBoxed +sealed interface BarBoxed
    +permits
    +[BarBoxedVoid](#barboxedvoid), +[BarBoxedBoolean](#barboxedboolean), +[BarBoxedNumber](#barboxednumber), +[BarBoxedString](#barboxedstring), +[BarBoxedList](#barboxedlist), +[BarBoxedMap](#barboxedmap) + +sealed interface that stores validated payloads using boxed classes + +## BarBoxedVoid +data class BarBoxedVoid
    +implements [BarBoxed](#barboxed) + +data class that stores validated null payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| BarBoxedVoid(Nothing? data)
    Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| Nothing? | data()
    validated payload | +| Any? | getData()
    validated payload | + +## BarBoxedBoolean +data class BarBoxedBoolean
    +implements [BarBoxed](#barboxed) + +record that stores validated boolean payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| BarBoxedBoolean(boolean data)
    Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| boolean | data()
    validated payload | +| Any? | getData()
    validated payload | + +## BarBoxedNumber +data class BarBoxedNumber
    +implements [BarBoxed](#barboxed) + +data class that stores validated Number payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| BarBoxedNumber(Number data)
    Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| Number | data()
    validated payload | +| Any? | getData()
    validated payload | + +## BarBoxedString +data class BarBoxedString
    +implements [BarBoxed](#barboxed) + +data class that stores validated String payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| BarBoxedString(String data)
    Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| String | data()
    validated payload | +| Any? | getData()
    validated payload | + +## BarBoxedList +data class BarBoxedList
    +implements [BarBoxed](#barboxed) + +data class that stores validated List payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| BarBoxedList(FrozenList data)
    Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| FrozenList | data()
    validated payload | +| Any? | getData()
    validated payload | + +## BarBoxedMap +data class BarBoxedMap
    +implements [BarBoxed](#barboxed) + +data class that stores validated Map payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| BarBoxedMap(FrozenMap data)
    Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| FrozenMap | data()
    validated payload | +| Any? | getData()
    validated payload | + +## Bar +class Bar
    +extends AnyTypeJsonSchema.AnyTypeJsonSchema1 + +A schema class that validates payloads + +| Methods Inherited from class org.openapijsonschematools.client.schemas.AnyTypeJsonSchema.AnyTypeJsonSchema1 | +| ------------------------------------------------------------------ | +| validate | +| validateAndBox | + +## AdditionalPropertiesBoxed +sealed interface AdditionalPropertiesBoxed
    +permits
    +[AdditionalPropertiesBoxedVoid](#additionalpropertiesboxedvoid), +[AdditionalPropertiesBoxedBoolean](#additionalpropertiesboxedboolean), +[AdditionalPropertiesBoxedNumber](#additionalpropertiesboxednumber), +[AdditionalPropertiesBoxedString](#additionalpropertiesboxedstring), +[AdditionalPropertiesBoxedList](#additionalpropertiesboxedlist), +[AdditionalPropertiesBoxedMap](#additionalpropertiesboxedmap) + +sealed interface that stores validated payloads using boxed classes + +## AdditionalPropertiesBoxedVoid +data class AdditionalPropertiesBoxedVoid
    +implements [AdditionalPropertiesBoxed](#additionalpropertiesboxed) + +data class that stores validated null payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| AdditionalPropertiesBoxedVoid(Nothing? data)
    Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| Nothing? | data()
    validated payload | +| Any? | getData()
    validated payload | + +## AdditionalPropertiesBoxedBoolean +data class AdditionalPropertiesBoxedBoolean
    +implements [AdditionalPropertiesBoxed](#additionalpropertiesboxed) + +record that stores validated boolean payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| AdditionalPropertiesBoxedBoolean(boolean data)
    Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| boolean | data()
    validated payload | +| Any? | getData()
    validated payload | + +## AdditionalPropertiesBoxedNumber +data class AdditionalPropertiesBoxedNumber
    +implements [AdditionalPropertiesBoxed](#additionalpropertiesboxed) + +data class that stores validated Number payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| AdditionalPropertiesBoxedNumber(Number data)
    Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| Number | data()
    validated payload | +| Any? | getData()
    validated payload | + +## AdditionalPropertiesBoxedString +data class AdditionalPropertiesBoxedString
    +implements [AdditionalPropertiesBoxed](#additionalpropertiesboxed) + +data class that stores validated String payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| AdditionalPropertiesBoxedString(String data)
    Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| String | data()
    validated payload | +| Any? | getData()
    validated payload | + +## AdditionalPropertiesBoxedList +data class AdditionalPropertiesBoxedList
    +implements [AdditionalPropertiesBoxed](#additionalpropertiesboxed) + +data class that stores validated List payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| AdditionalPropertiesBoxedList(FrozenList data)
    Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| FrozenList | data()
    validated payload | +| Any? | getData()
    validated payload | + +## AdditionalPropertiesBoxedMap +data class AdditionalPropertiesBoxedMap
    +implements [AdditionalPropertiesBoxed](#additionalpropertiesboxed) + +data class that stores validated Map payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| AdditionalPropertiesBoxedMap(FrozenMap data)
    Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| FrozenMap | data()
    validated payload | +| Any? | getData()
    validated payload | + +## AdditionalProperties +class AdditionalProperties
    +extends NotAnyTypeJsonSchema.NotAnyTypeJsonSchema1 + +A schema class that validates payloads + +| Methods Inherited from class org.openapijsonschematools.client.schemas.NotAnyTypeJsonSchema.NotAnyTypeJsonSchema1 | +| ------------------------------------------------------------------ | +| validate | +| validateAndBox | + +[[Back to top]](#top) [[Back to Component Schemas]](../../../README.md#Component-Schemas) [[Back to README]](../../../README.md) diff --git a/samples/client/3_1_0_unit_test/kotlin/docs/components/schemas/DependentSchemasSingleDependency.md b/samples/client/3_1_0_unit_test/kotlin/docs/components/schemas/DependentSchemasSingleDependency.md new file mode 100644 index 00000000000..e1ed3a44dab --- /dev/null +++ b/samples/client/3_1_0_unit_test/kotlin/docs/components/schemas/DependentSchemasSingleDependency.md @@ -0,0 +1,451 @@ +# DependentSchemasSingleDependency +org.openapijsonschematools.client.components.schemas.DependentSchemasSingleDependency.java +class DependentSchemasSingleDependency
    + +A class that contains necessary nested +- schema classes (which validate payloads), extends JsonSchema +- sealed interfaces which store validated payloads, Kotlin version of a sum type +- boxed classes which store validated payloads, sealed permits class implementations +- classes to store validated map payloads, extends FrozenMap +- classes to build inputs for map payloads + +## Nested Class Summary +| Modifier and Type | Class and Description | +| ----------------- | ---------------------- | +| sealed interface | [DependentSchemasSingleDependency.DependentSchemasSingleDependency1Boxed](#dependentschemassingledependency1boxed)
    sealed interface for validated payloads | +| record | [DependentSchemasSingleDependency.DependentSchemasSingleDependency1BoxedVoid](#dependentschemassingledependency1boxedvoid)
    boxed class to store validated null payloads | +| record | [DependentSchemasSingleDependency.DependentSchemasSingleDependency1BoxedBoolean](#dependentschemassingledependency1boxedboolean)
    boxed class to store validated boolean payloads | +| record | [DependentSchemasSingleDependency.DependentSchemasSingleDependency1BoxedNumber](#dependentschemassingledependency1boxednumber)
    boxed class to store validated Number payloads | +| record | [DependentSchemasSingleDependency.DependentSchemasSingleDependency1BoxedString](#dependentschemassingledependency1boxedstring)
    boxed class to store validated String payloads | +| record | [DependentSchemasSingleDependency.DependentSchemasSingleDependency1BoxedList](#dependentschemassingledependency1boxedlist)
    boxed class to store validated List payloads | +| record | [DependentSchemasSingleDependency.DependentSchemasSingleDependency1BoxedMap](#dependentschemassingledependency1boxedmap)
    boxed class to store validated Map payloads | +| static class | [DependentSchemasSingleDependency.DependentSchemasSingleDependency1](#dependentschemassingledependency1)
    schema class | +| sealed interface | [DependentSchemasSingleDependency.BarBoxed](#barboxed)
    sealed interface for validated payloads | +| record | [DependentSchemasSingleDependency.BarBoxedVoid](#barboxedvoid)
    boxed class to store validated null payloads | +| record | [DependentSchemasSingleDependency.BarBoxedBoolean](#barboxedboolean)
    boxed class to store validated boolean payloads | +| record | [DependentSchemasSingleDependency.BarBoxedNumber](#barboxednumber)
    boxed class to store validated Number payloads | +| record | [DependentSchemasSingleDependency.BarBoxedString](#barboxedstring)
    boxed class to store validated String payloads | +| record | [DependentSchemasSingleDependency.BarBoxedList](#barboxedlist)
    boxed class to store validated List payloads | +| record | [DependentSchemasSingleDependency.BarBoxedMap](#barboxedmap)
    boxed class to store validated Map payloads | +| static class | [DependentSchemasSingleDependency.Bar](#bar)
    schema class | +| static class | [DependentSchemasSingleDependency.BarMapBuilder1](#barmapbuilder1)
    builder for Map payloads | +| static class | [DependentSchemasSingleDependency.BarMap](#barmap)
    output class for Map payloads | +| sealed interface | [DependentSchemasSingleDependency.Bar1Boxed](#bar1boxed)
    sealed interface for validated payloads | +| record | [DependentSchemasSingleDependency.Bar1BoxedNumber](#bar1boxednumber)
    boxed class to store validated Number payloads | +| static class | [DependentSchemasSingleDependency.Bar1](#bar1)
    schema class | +| sealed interface | [DependentSchemasSingleDependency.FooBoxed](#fooboxed)
    sealed interface for validated payloads | +| record | [DependentSchemasSingleDependency.FooBoxedNumber](#fooboxednumber)
    boxed class to store validated Number payloads | +| static class | [DependentSchemasSingleDependency.Foo](#foo)
    schema class | + +## DependentSchemasSingleDependency1Boxed +sealed interface DependentSchemasSingleDependency1Boxed
    +permits
    +[DependentSchemasSingleDependency1BoxedVoid](#dependentschemassingledependency1boxedvoid), +[DependentSchemasSingleDependency1BoxedBoolean](#dependentschemassingledependency1boxedboolean), +[DependentSchemasSingleDependency1BoxedNumber](#dependentschemassingledependency1boxednumber), +[DependentSchemasSingleDependency1BoxedString](#dependentschemassingledependency1boxedstring), +[DependentSchemasSingleDependency1BoxedList](#dependentschemassingledependency1boxedlist), +[DependentSchemasSingleDependency1BoxedMap](#dependentschemassingledependency1boxedmap) + +sealed interface that stores validated payloads using boxed classes + +## DependentSchemasSingleDependency1BoxedVoid +data class DependentSchemasSingleDependency1BoxedVoid
    +implements [DependentSchemasSingleDependency1Boxed](#dependentschemassingledependency1boxed) + +data class that stores validated null payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| DependentSchemasSingleDependency1BoxedVoid(Nothing? data)
    Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| Nothing? | data()
    validated payload | +| Any? | getData()
    validated payload | + +## DependentSchemasSingleDependency1BoxedBoolean +data class DependentSchemasSingleDependency1BoxedBoolean
    +implements [DependentSchemasSingleDependency1Boxed](#dependentschemassingledependency1boxed) + +record that stores validated boolean payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| DependentSchemasSingleDependency1BoxedBoolean(boolean data)
    Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| boolean | data()
    validated payload | +| Any? | getData()
    validated payload | + +## DependentSchemasSingleDependency1BoxedNumber +data class DependentSchemasSingleDependency1BoxedNumber
    +implements [DependentSchemasSingleDependency1Boxed](#dependentschemassingledependency1boxed) + +data class that stores validated Number payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| DependentSchemasSingleDependency1BoxedNumber(Number data)
    Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| Number | data()
    validated payload | +| Any? | getData()
    validated payload | + +## DependentSchemasSingleDependency1BoxedString +data class DependentSchemasSingleDependency1BoxedString
    +implements [DependentSchemasSingleDependency1Boxed](#dependentschemassingledependency1boxed) + +data class that stores validated String payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| DependentSchemasSingleDependency1BoxedString(String data)
    Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| String | data()
    validated payload | +| Any? | getData()
    validated payload | + +## DependentSchemasSingleDependency1BoxedList +data class DependentSchemasSingleDependency1BoxedList
    +implements [DependentSchemasSingleDependency1Boxed](#dependentschemassingledependency1boxed) + +data class that stores validated List payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| DependentSchemasSingleDependency1BoxedList(FrozenList data)
    Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| FrozenList | data()
    validated payload | +| Any? | getData()
    validated payload | + +## DependentSchemasSingleDependency1BoxedMap +data class DependentSchemasSingleDependency1BoxedMap
    +implements [DependentSchemasSingleDependency1Boxed](#dependentschemassingledependency1boxed) + +data class that stores validated Map payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| DependentSchemasSingleDependency1BoxedMap(FrozenMap data)
    Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| FrozenMap | data()
    validated payload | +| Any? | getData()
    validated payload | + +## DependentSchemasSingleDependency1 +class DependentSchemasSingleDependency1
    +extends JsonSchema + +A schema class that validates payloads + +### Field Summary +| Modifier and Type | Field and Description | +| ----------------- | ---------------------- | +| Map> | dependentSchemas = mapOf(
        new PropertyEntry("bar", [Bar::class.java](#bar)))
    )
    | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| String | validate(arg: String, configuration: SchemaConfiguration) | +| Nothing? | validate(arg: Nothing?, configuration: SchemaConfiguration) | +| int | validate(arg: int, configuration: SchemaConfiguration) | +| long | validate(arg: long, configuration: SchemaConfiguration) | +| float | validate(arg: float, configuration: SchemaConfiguration) | +| double | validate(arg: double, configuration: SchemaConfiguration) | +| Number | validate(arg: Number, configuration: SchemaConfiguration) | +| boolean | validate(arg: boolean, configuration: SchemaConfiguration) | +| FrozenMap | validate(arg: Map<?, ?>, configuration: SchemaConfiguration) | +| FrozenList | validate(arg: List<*>, configuration: SchemaConfiguration) | +| [DependentSchemasSingleDependency1BoxedString](#dependentschemassingledependency1boxedstring) | validateAndBox(String, configuration: SchemaConfiguration) | +| [DependentSchemasSingleDependency1BoxedVoid](#dependentschemassingledependency1boxedvoid) | validateAndBox(Nothing?, configuration: SchemaConfiguration) | +| [DependentSchemasSingleDependency1BoxedNumber](#dependentschemassingledependency1boxednumber) | validateAndBox(Number, configuration: SchemaConfiguration) | +| [DependentSchemasSingleDependency1BoxedBoolean](#dependentschemassingledependency1boxedboolean) | validateAndBox(boolean, configuration: SchemaConfiguration) | +| [DependentSchemasSingleDependency1BoxedMap](#dependentschemassingledependency1boxedmap) | validateAndBox(Map<?, ?>, configuration: SchemaConfiguration) | +| [DependentSchemasSingleDependency1BoxedList](#dependentschemassingledependency1boxedlist) | validateAndBox(List<*>, configuration: SchemaConfiguration) | +| [DependentSchemasSingleDependency1Boxed](#dependentschemassingledependency1boxed) | validateAndBox(Any?, configuration: SchemaConfiguration) | +| Any? | validate(arg: Any?, configuration: SchemaConfiguration) | + +## BarBoxed +sealed interface BarBoxed
    +permits
    +[BarBoxedVoid](#barboxedvoid), +[BarBoxedBoolean](#barboxedboolean), +[BarBoxedNumber](#barboxednumber), +[BarBoxedString](#barboxedstring), +[BarBoxedList](#barboxedlist), +[BarBoxedMap](#barboxedmap) + +sealed interface that stores validated payloads using boxed classes + +## BarBoxedVoid +data class BarBoxedVoid
    +implements [BarBoxed](#barboxed) + +data class that stores validated null payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| BarBoxedVoid(Nothing? data)
    Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| Nothing? | data()
    validated payload | +| Any? | getData()
    validated payload | + +## BarBoxedBoolean +data class BarBoxedBoolean
    +implements [BarBoxed](#barboxed) + +record that stores validated boolean payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| BarBoxedBoolean(boolean data)
    Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| boolean | data()
    validated payload | +| Any? | getData()
    validated payload | + +## BarBoxedNumber +data class BarBoxedNumber
    +implements [BarBoxed](#barboxed) + +data class that stores validated Number payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| BarBoxedNumber(Number data)
    Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| Number | data()
    validated payload | +| Any? | getData()
    validated payload | + +## BarBoxedString +data class BarBoxedString
    +implements [BarBoxed](#barboxed) + +data class that stores validated String payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| BarBoxedString(String data)
    Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| String | data()
    validated payload | +| Any? | getData()
    validated payload | + +## BarBoxedList +data class BarBoxedList
    +implements [BarBoxed](#barboxed) + +data class that stores validated List payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| BarBoxedList(FrozenList data)
    Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| FrozenList | data()
    validated payload | +| Any? | getData()
    validated payload | + +## BarBoxedMap +data class BarBoxedMap
    +implements [BarBoxed](#barboxed) + +data class that stores validated Map payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| BarBoxedMap([BarMap](#barmap) data)
    Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| [BarMap](#barmap) | data()
    validated payload | +| Any? | getData()
    validated payload | + +## Bar +class Bar
    +extends JsonSchema + +A schema class that validates payloads + +### Field Summary +| Modifier and Type | Field and Description | +| ----------------- | ---------------------- | +| Map> | properties = mapOf(
        "foo" to [Foo::class.java](#foo)),
        "bar" to [Bar1::class.java](#bar1))
    )
    | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| String | validate(arg: String, configuration: SchemaConfiguration) | +| Nothing? | validate(arg: Nothing?, configuration: SchemaConfiguration) | +| int | validate(arg: int, configuration: SchemaConfiguration) | +| long | validate(arg: long, configuration: SchemaConfiguration) | +| float | validate(arg: float, configuration: SchemaConfiguration) | +| double | validate(arg: double, configuration: SchemaConfiguration) | +| Number | validate(arg: Number, configuration: SchemaConfiguration) | +| boolean | validate(arg: boolean, configuration: SchemaConfiguration) | +| [BarMap](#barmap) | validate(arg: [Map<?, ?>](#barmapbuilder1), configuration: SchemaConfiguration) | +| FrozenList | validate(arg: List<*>, configuration: SchemaConfiguration) | +| [BarBoxedString](#barboxedstring) | validateAndBox(String, configuration: SchemaConfiguration) | +| [BarBoxedVoid](#barboxedvoid) | validateAndBox(Nothing?, configuration: SchemaConfiguration) | +| [BarBoxedNumber](#barboxednumber) | validateAndBox(Number, configuration: SchemaConfiguration) | +| [BarBoxedBoolean](#barboxedboolean) | validateAndBox(boolean, configuration: SchemaConfiguration) | +| [BarBoxedMap](#barboxedmap) | validateAndBox([Map<?, ?>](#barmapbuilder1), configuration: SchemaConfiguration) | +| [BarBoxedList](#barboxedlist) | validateAndBox(List<*>, configuration: SchemaConfiguration) | +| [BarBoxed](#barboxed) | validateAndBox(Any?, configuration: SchemaConfiguration) | +| Any? | validate(arg: Any?, configuration: SchemaConfiguration) | + +## BarMapBuilder1 +class BarMapBuilder1
    +builder for `Map` + +A class that builds the Map input type + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| BarMapBuilder1()
    Creates a builder that contains an empty map | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| Map | build()
    Returns map input that should be used with Schema.validate | +| [BarMapBuilder1](#barmapbuilder1) | foo(value: Int) | +| [BarMapBuilder1](#barmapbuilder1) | foo(value: Float) | +| [BarMapBuilder1](#barmapbuilder1) | foo(value: Long) | +| [BarMapBuilder1](#barmapbuilder1) | foo(value: Double) | +| [BarMapBuilder1](#barmapbuilder1) | bar(value: Int) | +| [BarMapBuilder1](#barmapbuilder1) | bar(value: Float) | +| [BarMapBuilder1](#barmapbuilder1) | bar(value: Long) | +| [BarMapBuilder1](#barmapbuilder1) | bar(value: Double) | +| [BarMapBuilder1](#barmapbuilder1) | additionalProperty(key: String, value: Nothing?) | +| [BarMapBuilder1](#barmapbuilder1) | additionalProperty(key: String, value: Boolean) | +| [BarMapBuilder1](#barmapbuilder1) | additionalProperty(key: String, value: String) | +| [BarMapBuilder1](#barmapbuilder1) | additionalProperty(key: String, value: Int) | +| [BarMapBuilder1](#barmapbuilder1) | additionalProperty(key: String, value: Float) | +| [BarMapBuilder1](#barmapbuilder1) | additionalProperty(key: String, value: Long) | +| [BarMapBuilder1](#barmapbuilder1) | additionalProperty(key: String, value: Double) | +| [BarMapBuilder1](#barmapbuilder1) | additionalProperty(key: String, value: List) | +| [BarMapBuilder1](#barmapbuilder1) | additionalProperty(key: String, value: Map) | + +## BarMap +class BarMap
    +extends FrozenMap + +A class to store validated Map payloads + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| static [BarMap](#barmap) | of([Map](#barmapbuilder1) arg, SchemaConfiguration configuration) | +| Number | foo()
    [optional] | +| Number | bar()
    [optional] | +| Any? | getAdditionalProperty(String name)
    provides type safety for additional properties | + +## Bar1Boxed +sealed interface Bar1Boxed
    +permits
    +[Bar1BoxedNumber](#bar1boxednumber) + +sealed interface that stores validated payloads using boxed classes + +## Bar1BoxedNumber +data class Bar1BoxedNumber
    +implements [Bar1Boxed](#bar1boxed) + +data class that stores validated Number payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| Bar1BoxedNumber(Number data)
    Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| Number | data()
    validated payload | +| Any? | getData()
    validated payload | + +## Bar1 +class Bar1
    +extends IntJsonSchema.IntJsonSchema1 + +A schema class that validates payloads + +| Methods Inherited from class org.openapijsonschematools.client.schemas.IntJsonSchema.IntJsonSchema1 | +| ------------------------------------------------------------------ | +| validate | +| validateAndBox | + +## FooBoxed +sealed interface FooBoxed
    +permits
    +[FooBoxedNumber](#fooboxednumber) + +sealed interface that stores validated payloads using boxed classes + +## FooBoxedNumber +data class FooBoxedNumber
    +implements [FooBoxed](#fooboxed) + +data class that stores validated Number payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| FooBoxedNumber(Number data)
    Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| Number | data()
    validated payload | +| Any? | getData()
    validated payload | + +## Foo +class Foo
    +extends IntJsonSchema.IntJsonSchema1 + +A schema class that validates payloads + +| Methods Inherited from class org.openapijsonschematools.client.schemas.IntJsonSchema.IntJsonSchema1 | +| ------------------------------------------------------------------ | +| validate | +| validateAndBox | + +[[Back to top]](#top) [[Back to Component Schemas]](../../../README.md#Component-Schemas) [[Back to README]](../../../README.md) diff --git a/samples/client/3_1_0_unit_test/kotlin/docs/components/schemas/DurationFormat.md b/samples/client/3_1_0_unit_test/kotlin/docs/components/schemas/DurationFormat.md new file mode 100644 index 00000000000..a0d1e2009ae --- /dev/null +++ b/samples/client/3_1_0_unit_test/kotlin/docs/components/schemas/DurationFormat.md @@ -0,0 +1,169 @@ +# DurationFormat +org.openapijsonschematools.client.components.schemas.DurationFormat.java +class DurationFormat
    + +A class that contains necessary nested +- schema classes (which validate payloads), extends JsonSchema +- sealed interfaces which store validated payloads, Kotlin version of a sum type +- boxed classes which store validated payloads, sealed permits class implementations + +## Nested Class Summary +| Modifier and Type | Class and Description | +| ----------------- | ---------------------- | +| sealed interface | [DurationFormat.DurationFormat1Boxed](#durationformat1boxed)
    sealed interface for validated payloads | +| record | [DurationFormat.DurationFormat1BoxedVoid](#durationformat1boxedvoid)
    boxed class to store validated null payloads | +| record | [DurationFormat.DurationFormat1BoxedBoolean](#durationformat1boxedboolean)
    boxed class to store validated boolean payloads | +| record | [DurationFormat.DurationFormat1BoxedNumber](#durationformat1boxednumber)
    boxed class to store validated Number payloads | +| record | [DurationFormat.DurationFormat1BoxedString](#durationformat1boxedstring)
    boxed class to store validated String payloads | +| record | [DurationFormat.DurationFormat1BoxedList](#durationformat1boxedlist)
    boxed class to store validated List payloads | +| record | [DurationFormat.DurationFormat1BoxedMap](#durationformat1boxedmap)
    boxed class to store validated Map payloads | +| static class | [DurationFormat.DurationFormat1](#durationformat1)
    schema class | + +## DurationFormat1Boxed +sealed interface DurationFormat1Boxed
    +permits
    +[DurationFormat1BoxedVoid](#durationformat1boxedvoid), +[DurationFormat1BoxedBoolean](#durationformat1boxedboolean), +[DurationFormat1BoxedNumber](#durationformat1boxednumber), +[DurationFormat1BoxedString](#durationformat1boxedstring), +[DurationFormat1BoxedList](#durationformat1boxedlist), +[DurationFormat1BoxedMap](#durationformat1boxedmap) + +sealed interface that stores validated payloads using boxed classes + +## DurationFormat1BoxedVoid +data class DurationFormat1BoxedVoid
    +implements [DurationFormat1Boxed](#durationformat1boxed) + +data class that stores validated null payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| DurationFormat1BoxedVoid(Nothing? data)
    Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| Nothing? | data()
    validated payload | +| Any? | getData()
    validated payload | + +## DurationFormat1BoxedBoolean +data class DurationFormat1BoxedBoolean
    +implements [DurationFormat1Boxed](#durationformat1boxed) + +record that stores validated boolean payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| DurationFormat1BoxedBoolean(boolean data)
    Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| boolean | data()
    validated payload | +| Any? | getData()
    validated payload | + +## DurationFormat1BoxedNumber +data class DurationFormat1BoxedNumber
    +implements [DurationFormat1Boxed](#durationformat1boxed) + +data class that stores validated Number payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| DurationFormat1BoxedNumber(Number data)
    Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| Number | data()
    validated payload | +| Any? | getData()
    validated payload | + +## DurationFormat1BoxedString +data class DurationFormat1BoxedString
    +implements [DurationFormat1Boxed](#durationformat1boxed) + +data class that stores validated String payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| DurationFormat1BoxedString(String data)
    Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| String | data()
    validated payload | +| Any? | getData()
    validated payload | + +## DurationFormat1BoxedList +data class DurationFormat1BoxedList
    +implements [DurationFormat1Boxed](#durationformat1boxed) + +data class that stores validated List payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| DurationFormat1BoxedList(FrozenList data)
    Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| FrozenList | data()
    validated payload | +| Any? | getData()
    validated payload | + +## DurationFormat1BoxedMap +data class DurationFormat1BoxedMap
    +implements [DurationFormat1Boxed](#durationformat1boxed) + +data class that stores validated Map payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| DurationFormat1BoxedMap(FrozenMap data)
    Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| FrozenMap | data()
    validated payload | +| Any? | getData()
    validated payload | + +## DurationFormat1 +class DurationFormat1
    +extends JsonSchema + +A schema class that validates payloads + +### Field Summary +| Modifier and Type | Field and Description | +| ----------------- | ---------------------- | +| String | type = "duration"; | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| String | validate(arg: String, configuration: SchemaConfiguration) | +| Nothing? | validate(arg: Nothing?, configuration: SchemaConfiguration) | +| int | validate(arg: int, configuration: SchemaConfiguration) | +| long | validate(arg: long, configuration: SchemaConfiguration) | +| float | validate(arg: float, configuration: SchemaConfiguration) | +| double | validate(arg: double, configuration: SchemaConfiguration) | +| Number | validate(arg: Number, configuration: SchemaConfiguration) | +| boolean | validate(arg: boolean, configuration: SchemaConfiguration) | +| FrozenMap | validate(arg: Map<?, ?>, configuration: SchemaConfiguration) | +| FrozenList | validate(arg: List<*>, configuration: SchemaConfiguration) | +| [DurationFormat1BoxedString](#durationformat1boxedstring) | validateAndBox(String, configuration: SchemaConfiguration) | +| [DurationFormat1BoxedVoid](#durationformat1boxedvoid) | validateAndBox(Nothing?, configuration: SchemaConfiguration) | +| [DurationFormat1BoxedNumber](#durationformat1boxednumber) | validateAndBox(Number, configuration: SchemaConfiguration) | +| [DurationFormat1BoxedBoolean](#durationformat1boxedboolean) | validateAndBox(boolean, configuration: SchemaConfiguration) | +| [DurationFormat1BoxedMap](#durationformat1boxedmap) | validateAndBox(Map<?, ?>, configuration: SchemaConfiguration) | +| [DurationFormat1BoxedList](#durationformat1boxedlist) | validateAndBox(List<*>, configuration: SchemaConfiguration) | +| [DurationFormat1Boxed](#durationformat1boxed) | validateAndBox(Any?, configuration: SchemaConfiguration) | +| Any? | validate(arg: Any?, configuration: SchemaConfiguration) | + +[[Back to top]](#top) [[Back to Component Schemas]](../../../README.md#Component-Schemas) [[Back to README]](../../../README.md) diff --git a/samples/client/3_1_0_unit_test/kotlin/docs/components/schemas/EmailFormat.md b/samples/client/3_1_0_unit_test/kotlin/docs/components/schemas/EmailFormat.md new file mode 100644 index 00000000000..53b4cde33e0 --- /dev/null +++ b/samples/client/3_1_0_unit_test/kotlin/docs/components/schemas/EmailFormat.md @@ -0,0 +1,169 @@ +# EmailFormat +org.openapijsonschematools.client.components.schemas.EmailFormat.java +class EmailFormat
    + +A class that contains necessary nested +- schema classes (which validate payloads), extends JsonSchema +- sealed interfaces which store validated payloads, Kotlin version of a sum type +- boxed classes which store validated payloads, sealed permits class implementations + +## Nested Class Summary +| Modifier and Type | Class and Description | +| ----------------- | ---------------------- | +| sealed interface | [EmailFormat.EmailFormat1Boxed](#emailformat1boxed)
    sealed interface for validated payloads | +| record | [EmailFormat.EmailFormat1BoxedVoid](#emailformat1boxedvoid)
    boxed class to store validated null payloads | +| record | [EmailFormat.EmailFormat1BoxedBoolean](#emailformat1boxedboolean)
    boxed class to store validated boolean payloads | +| record | [EmailFormat.EmailFormat1BoxedNumber](#emailformat1boxednumber)
    boxed class to store validated Number payloads | +| record | [EmailFormat.EmailFormat1BoxedString](#emailformat1boxedstring)
    boxed class to store validated String payloads | +| record | [EmailFormat.EmailFormat1BoxedList](#emailformat1boxedlist)
    boxed class to store validated List payloads | +| record | [EmailFormat.EmailFormat1BoxedMap](#emailformat1boxedmap)
    boxed class to store validated Map payloads | +| static class | [EmailFormat.EmailFormat1](#emailformat1)
    schema class | + +## EmailFormat1Boxed +sealed interface EmailFormat1Boxed
    +permits
    +[EmailFormat1BoxedVoid](#emailformat1boxedvoid), +[EmailFormat1BoxedBoolean](#emailformat1boxedboolean), +[EmailFormat1BoxedNumber](#emailformat1boxednumber), +[EmailFormat1BoxedString](#emailformat1boxedstring), +[EmailFormat1BoxedList](#emailformat1boxedlist), +[EmailFormat1BoxedMap](#emailformat1boxedmap) + +sealed interface that stores validated payloads using boxed classes + +## EmailFormat1BoxedVoid +data class EmailFormat1BoxedVoid
    +implements [EmailFormat1Boxed](#emailformat1boxed) + +data class that stores validated null payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| EmailFormat1BoxedVoid(Nothing? data)
    Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| Nothing? | data()
    validated payload | +| Any? | getData()
    validated payload | + +## EmailFormat1BoxedBoolean +data class EmailFormat1BoxedBoolean
    +implements [EmailFormat1Boxed](#emailformat1boxed) + +record that stores validated boolean payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| EmailFormat1BoxedBoolean(boolean data)
    Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| boolean | data()
    validated payload | +| Any? | getData()
    validated payload | + +## EmailFormat1BoxedNumber +data class EmailFormat1BoxedNumber
    +implements [EmailFormat1Boxed](#emailformat1boxed) + +data class that stores validated Number payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| EmailFormat1BoxedNumber(Number data)
    Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| Number | data()
    validated payload | +| Any? | getData()
    validated payload | + +## EmailFormat1BoxedString +data class EmailFormat1BoxedString
    +implements [EmailFormat1Boxed](#emailformat1boxed) + +data class that stores validated String payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| EmailFormat1BoxedString(String data)
    Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| String | data()
    validated payload | +| Any? | getData()
    validated payload | + +## EmailFormat1BoxedList +data class EmailFormat1BoxedList
    +implements [EmailFormat1Boxed](#emailformat1boxed) + +data class that stores validated List payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| EmailFormat1BoxedList(FrozenList data)
    Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| FrozenList | data()
    validated payload | +| Any? | getData()
    validated payload | + +## EmailFormat1BoxedMap +data class EmailFormat1BoxedMap
    +implements [EmailFormat1Boxed](#emailformat1boxed) + +data class that stores validated Map payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| EmailFormat1BoxedMap(FrozenMap data)
    Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| FrozenMap | data()
    validated payload | +| Any? | getData()
    validated payload | + +## EmailFormat1 +class EmailFormat1
    +extends JsonSchema + +A schema class that validates payloads + +### Field Summary +| Modifier and Type | Field and Description | +| ----------------- | ---------------------- | +| String | type = "email"; | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| String | validate(arg: String, configuration: SchemaConfiguration) | +| Nothing? | validate(arg: Nothing?, configuration: SchemaConfiguration) | +| int | validate(arg: int, configuration: SchemaConfiguration) | +| long | validate(arg: long, configuration: SchemaConfiguration) | +| float | validate(arg: float, configuration: SchemaConfiguration) | +| double | validate(arg: double, configuration: SchemaConfiguration) | +| Number | validate(arg: Number, configuration: SchemaConfiguration) | +| boolean | validate(arg: boolean, configuration: SchemaConfiguration) | +| FrozenMap | validate(arg: Map<?, ?>, configuration: SchemaConfiguration) | +| FrozenList | validate(arg: List<*>, configuration: SchemaConfiguration) | +| [EmailFormat1BoxedString](#emailformat1boxedstring) | validateAndBox(String, configuration: SchemaConfiguration) | +| [EmailFormat1BoxedVoid](#emailformat1boxedvoid) | validateAndBox(Nothing?, configuration: SchemaConfiguration) | +| [EmailFormat1BoxedNumber](#emailformat1boxednumber) | validateAndBox(Number, configuration: SchemaConfiguration) | +| [EmailFormat1BoxedBoolean](#emailformat1boxedboolean) | validateAndBox(boolean, configuration: SchemaConfiguration) | +| [EmailFormat1BoxedMap](#emailformat1boxedmap) | validateAndBox(Map<?, ?>, configuration: SchemaConfiguration) | +| [EmailFormat1BoxedList](#emailformat1boxedlist) | validateAndBox(List<*>, configuration: SchemaConfiguration) | +| [EmailFormat1Boxed](#emailformat1boxed) | validateAndBox(Any?, configuration: SchemaConfiguration) | +| Any? | validate(arg: Any?, configuration: SchemaConfiguration) | + +[[Back to top]](#top) [[Back to Component Schemas]](../../../README.md#Component-Schemas) [[Back to README]](../../../README.md) diff --git a/samples/client/3_1_0_unit_test/kotlin/docs/components/schemas/EmptyDependents.md b/samples/client/3_1_0_unit_test/kotlin/docs/components/schemas/EmptyDependents.md new file mode 100644 index 00000000000..a0e5b46a430 --- /dev/null +++ b/samples/client/3_1_0_unit_test/kotlin/docs/components/schemas/EmptyDependents.md @@ -0,0 +1,176 @@ +# EmptyDependents +org.openapijsonschematools.client.components.schemas.EmptyDependents.java +class EmptyDependents
    + +A class that contains necessary nested +- schema classes (which validate payloads), extends JsonSchema +- sealed interfaces which store validated payloads, Kotlin version of a sum type +- boxed classes which store validated payloads, sealed permits class implementations + +## Nested Class Summary +| Modifier and Type | Class and Description | +| ----------------- | ---------------------- | +| sealed interface | [EmptyDependents.EmptyDependents1Boxed](#emptydependents1boxed)
    sealed interface for validated payloads | +| record | [EmptyDependents.EmptyDependents1BoxedVoid](#emptydependents1boxedvoid)
    boxed class to store validated null payloads | +| record | [EmptyDependents.EmptyDependents1BoxedBoolean](#emptydependents1boxedboolean)
    boxed class to store validated boolean payloads | +| record | [EmptyDependents.EmptyDependents1BoxedNumber](#emptydependents1boxednumber)
    boxed class to store validated Number payloads | +| record | [EmptyDependents.EmptyDependents1BoxedString](#emptydependents1boxedstring)
    boxed class to store validated String payloads | +| record | [EmptyDependents.EmptyDependents1BoxedList](#emptydependents1boxedlist)
    boxed class to store validated List payloads | +| record | [EmptyDependents.EmptyDependents1BoxedMap](#emptydependents1boxedmap)
    boxed class to store validated Map payloads | +| static class | [EmptyDependents.EmptyDependents1](#emptydependents1)
    schema class | + +## EmptyDependents1Boxed +sealed interface EmptyDependents1Boxed
    +permits
    +[EmptyDependents1BoxedVoid](#emptydependents1boxedvoid), +[EmptyDependents1BoxedBoolean](#emptydependents1boxedboolean), +[EmptyDependents1BoxedNumber](#emptydependents1boxednumber), +[EmptyDependents1BoxedString](#emptydependents1boxedstring), +[EmptyDependents1BoxedList](#emptydependents1boxedlist), +[EmptyDependents1BoxedMap](#emptydependents1boxedmap) + +sealed interface that stores validated payloads using boxed classes + +## EmptyDependents1BoxedVoid +data class EmptyDependents1BoxedVoid
    +implements [EmptyDependents1Boxed](#emptydependents1boxed) + +data class that stores validated null payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| EmptyDependents1BoxedVoid(Nothing? data)
    Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| Nothing? | data()
    validated payload | +| Any? | getData()
    validated payload | + +## EmptyDependents1BoxedBoolean +data class EmptyDependents1BoxedBoolean
    +implements [EmptyDependents1Boxed](#emptydependents1boxed) + +record that stores validated boolean payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| EmptyDependents1BoxedBoolean(boolean data)
    Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| boolean | data()
    validated payload | +| Any? | getData()
    validated payload | + +## EmptyDependents1BoxedNumber +data class EmptyDependents1BoxedNumber
    +implements [EmptyDependents1Boxed](#emptydependents1boxed) + +data class that stores validated Number payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| EmptyDependents1BoxedNumber(Number data)
    Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| Number | data()
    validated payload | +| Any? | getData()
    validated payload | + +## EmptyDependents1BoxedString +data class EmptyDependents1BoxedString
    +implements [EmptyDependents1Boxed](#emptydependents1boxed) + +data class that stores validated String payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| EmptyDependents1BoxedString(String data)
    Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| String | data()
    validated payload | +| Any? | getData()
    validated payload | + +## EmptyDependents1BoxedList +data class EmptyDependents1BoxedList
    +implements [EmptyDependents1Boxed](#emptydependents1boxed) + +data class that stores validated List payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| EmptyDependents1BoxedList(FrozenList data)
    Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| FrozenList | data()
    validated payload | +| Any? | getData()
    validated payload | + +## EmptyDependents1BoxedMap +data class EmptyDependents1BoxedMap
    +implements [EmptyDependents1Boxed](#emptydependents1boxed) + +data class that stores validated Map payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| EmptyDependents1BoxedMap(FrozenMap data)
    Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| FrozenMap | data()
    validated payload | +| Any? | getData()
    validated payload | + +## EmptyDependents1 +class EmptyDependents1
    +extends JsonSchema + +A schema class that validates payloads + +### Field Summary +| Modifier and Type | Field and Description | +| ----------------- | ---------------------- | +| Map> | dependentRequired = MapUtils.makeMap(
    +    new AbstractMap.SimpleEntry<>(
    +        "bar",
    +        setOf( +        ) +    )
    +) + | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| String | validate(arg: String, configuration: SchemaConfiguration) | +| Nothing? | validate(arg: Nothing?, configuration: SchemaConfiguration) | +| int | validate(arg: int, configuration: SchemaConfiguration) | +| long | validate(arg: long, configuration: SchemaConfiguration) | +| float | validate(arg: float, configuration: SchemaConfiguration) | +| double | validate(arg: double, configuration: SchemaConfiguration) | +| Number | validate(arg: Number, configuration: SchemaConfiguration) | +| boolean | validate(arg: boolean, configuration: SchemaConfiguration) | +| FrozenMap | validate(arg: Map<?, ?>, configuration: SchemaConfiguration) | +| FrozenList | validate(arg: List<*>, configuration: SchemaConfiguration) | +| [EmptyDependents1BoxedString](#emptydependents1boxedstring) | validateAndBox(String, configuration: SchemaConfiguration) | +| [EmptyDependents1BoxedVoid](#emptydependents1boxedvoid) | validateAndBox(Nothing?, configuration: SchemaConfiguration) | +| [EmptyDependents1BoxedNumber](#emptydependents1boxednumber) | validateAndBox(Number, configuration: SchemaConfiguration) | +| [EmptyDependents1BoxedBoolean](#emptydependents1boxedboolean) | validateAndBox(boolean, configuration: SchemaConfiguration) | +| [EmptyDependents1BoxedMap](#emptydependents1boxedmap) | validateAndBox(Map<?, ?>, configuration: SchemaConfiguration) | +| [EmptyDependents1BoxedList](#emptydependents1boxedlist) | validateAndBox(List<*>, configuration: SchemaConfiguration) | +| [EmptyDependents1Boxed](#emptydependents1boxed) | validateAndBox(Any?, configuration: SchemaConfiguration) | +| Any? | validate(arg: Any?, configuration: SchemaConfiguration) | + +[[Back to top]](#top) [[Back to Component Schemas]](../../../README.md#Component-Schemas) [[Back to README]](../../../README.md) diff --git a/samples/client/3_1_0_unit_test/kotlin/docs/components/schemas/EnumWith0DoesNotMatchFalse.md b/samples/client/3_1_0_unit_test/kotlin/docs/components/schemas/EnumWith0DoesNotMatchFalse.md new file mode 100644 index 00000000000..b33bd6fd650 --- /dev/null +++ b/samples/client/3_1_0_unit_test/kotlin/docs/components/schemas/EnumWith0DoesNotMatchFalse.md @@ -0,0 +1,133 @@ +# EnumWith0DoesNotMatchFalse +org.openapijsonschematools.client.components.schemas.EnumWith0DoesNotMatchFalse.java +class EnumWith0DoesNotMatchFalse
    + +A class that contains necessary nested +- schema classes (which validate payloads), extends JsonSchema +- sealed interfaces which store validated payloads, Kotlin version of a sum type +- boxed classes which store validated payloads, sealed permits class implementations +- enum classes + +## Nested Class Summary +| Modifier and Type | Class and Description | +| ----------------- | ---------------------- | +| sealed interface | [EnumWith0DoesNotMatchFalse.EnumWith0DoesNotMatchFalse1Boxed](#enumwith0doesnotmatchfalse1boxed)
    sealed interface for validated payloads | +| record | [EnumWith0DoesNotMatchFalse.EnumWith0DoesNotMatchFalse1BoxedNumber](#enumwith0doesnotmatchfalse1boxednumber)
    boxed class to store validated Number payloads | +| static class | [EnumWith0DoesNotMatchFalse.EnumWith0DoesNotMatchFalse1](#enumwith0doesnotmatchfalse1)
    schema class | +| enum | [EnumWith0DoesNotMatchFalse.IntegerEnumWith0DoesNotMatchFalseEnums](#integerenumwith0doesnotmatchfalseenums)
    Integer enum | +| enum | [EnumWith0DoesNotMatchFalse.LongEnumWith0DoesNotMatchFalseEnums](#longenumwith0doesnotmatchfalseenums)
    Long enum | +| enum | [EnumWith0DoesNotMatchFalse.FloatEnumWith0DoesNotMatchFalseEnums](#floatenumwith0doesnotmatchfalseenums)
    Float enum | +| enum | [EnumWith0DoesNotMatchFalse.DoubleEnumWith0DoesNotMatchFalseEnums](#doubleenumwith0doesnotmatchfalseenums)
    Double enum | + +## EnumWith0DoesNotMatchFalse1Boxed +sealed interface EnumWith0DoesNotMatchFalse1Boxed
    +permits
    +[EnumWith0DoesNotMatchFalse1BoxedNumber](#enumwith0doesnotmatchfalse1boxednumber) + +sealed interface that stores validated payloads using boxed classes + +## EnumWith0DoesNotMatchFalse1BoxedNumber +data class EnumWith0DoesNotMatchFalse1BoxedNumber
    +implements [EnumWith0DoesNotMatchFalse1Boxed](#enumwith0doesnotmatchfalse1boxed) + +data class that stores validated Number payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| EnumWith0DoesNotMatchFalse1BoxedNumber(Number data)
    Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| Number | data()
    validated payload | +| Any? | getData()
    validated payload | + +## EnumWith0DoesNotMatchFalse1 +class EnumWith0DoesNotMatchFalse1
    +extends JsonSchema + +A schema class that validates payloads + +### Code Sample +``` +import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags; +import org.openapijsonschematools.client.configurations.SchemaConfiguration; +import org.openapijsonschematools.client.exceptions.ValidationException; +import org.openapijsonschematools.client.schemas.validation.MapUtils; +import org.openapijsonschematools.client.schemas.validation.FrozenList; +import org.openapijsonschematools.client.schemas.validation.FrozenMap; +import org.openapijsonschematools.client.components.schemas.EnumWith0DoesNotMatchFalse; + +import java.util.Arrays; +import java.util.List; +import java.util.AbstractMap; + +static final SchemaConfiguration configuration = new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().build()); + +// int validation +int validatedPayload = EnumWith0DoesNotMatchFalse.EnumWith0DoesNotMatchFalse1.validate( + 1, + configuration +); +``` + +### Field Summary +| Modifier and Type | Field and Description | +| ----------------- | ---------------------- | +| Set> | type = setOf(
        Int::class.java,
        Long::class.java,
        Float::class.java,
        Double::class.java
    )
    | +| Set | enumValues = setOf(
        0
    )
    | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| Number | validate(arg: Number, configuration: SchemaConfiguration) | +| [EnumWith0DoesNotMatchFalse1BoxedNumber](#enumwith0doesnotmatchfalse1boxednumber) | validateAndBox(Number, configuration: SchemaConfiguration) | +| [EnumWith0DoesNotMatchFalse1Boxed](#enumwith0doesnotmatchfalse1boxed) | validateAndBox(Any?, configuration: SchemaConfiguration) | +| Any? | validate(arg: Any?, configuration: SchemaConfiguration) | + +## IntegerEnumWith0DoesNotMatchFalseEnums +public enum IntegerEnumWith0DoesNotMatchFalseEnums
    +extends `Enum` + +A class that stores Integer enum values + +### Enum Constant Summary +| Enum Constant | Description | +| ------------- | ----------- | +| POSITIVE_0 | value = 0 | + +## LongEnumWith0DoesNotMatchFalseEnums +public enum LongEnumWith0DoesNotMatchFalseEnums
    +extends `Enum` + +A class that stores Long enum values + +### Enum Constant Summary +| Enum Constant | Description | +| ------------- | ----------- | +| POSITIVE_0 | value = 0L | + +## FloatEnumWith0DoesNotMatchFalseEnums +public enum FloatEnumWith0DoesNotMatchFalseEnums
    +extends `Enum` + +A class that stores Float enum values + +### Enum Constant Summary +| Enum Constant | Description | +| ------------- | ----------- | +| POSITIVE_0 | value = 0.0f | + +## DoubleEnumWith0DoesNotMatchFalseEnums +public enum DoubleEnumWith0DoesNotMatchFalseEnums
    +extends `Enum` + +A class that stores Double enum values + +### Enum Constant Summary +| Enum Constant | Description | +| ------------- | ----------- | +| POSITIVE_0 | value = 0.0d | + +[[Back to top]](#top) [[Back to Component Schemas]](../../../README.md#Component-Schemas) [[Back to README]](../../../README.md) diff --git a/samples/client/3_1_0_unit_test/kotlin/docs/components/schemas/EnumWith1DoesNotMatchTrue.md b/samples/client/3_1_0_unit_test/kotlin/docs/components/schemas/EnumWith1DoesNotMatchTrue.md new file mode 100644 index 00000000000..a296b3a613f --- /dev/null +++ b/samples/client/3_1_0_unit_test/kotlin/docs/components/schemas/EnumWith1DoesNotMatchTrue.md @@ -0,0 +1,133 @@ +# EnumWith1DoesNotMatchTrue +org.openapijsonschematools.client.components.schemas.EnumWith1DoesNotMatchTrue.java +class EnumWith1DoesNotMatchTrue
    + +A class that contains necessary nested +- schema classes (which validate payloads), extends JsonSchema +- sealed interfaces which store validated payloads, Kotlin version of a sum type +- boxed classes which store validated payloads, sealed permits class implementations +- enum classes + +## Nested Class Summary +| Modifier and Type | Class and Description | +| ----------------- | ---------------------- | +| sealed interface | [EnumWith1DoesNotMatchTrue.EnumWith1DoesNotMatchTrue1Boxed](#enumwith1doesnotmatchtrue1boxed)
    sealed interface for validated payloads | +| record | [EnumWith1DoesNotMatchTrue.EnumWith1DoesNotMatchTrue1BoxedNumber](#enumwith1doesnotmatchtrue1boxednumber)
    boxed class to store validated Number payloads | +| static class | [EnumWith1DoesNotMatchTrue.EnumWith1DoesNotMatchTrue1](#enumwith1doesnotmatchtrue1)
    schema class | +| enum | [EnumWith1DoesNotMatchTrue.IntegerEnumWith1DoesNotMatchTrueEnums](#integerenumwith1doesnotmatchtrueenums)
    Integer enum | +| enum | [EnumWith1DoesNotMatchTrue.LongEnumWith1DoesNotMatchTrueEnums](#longenumwith1doesnotmatchtrueenums)
    Long enum | +| enum | [EnumWith1DoesNotMatchTrue.FloatEnumWith1DoesNotMatchTrueEnums](#floatenumwith1doesnotmatchtrueenums)
    Float enum | +| enum | [EnumWith1DoesNotMatchTrue.DoubleEnumWith1DoesNotMatchTrueEnums](#doubleenumwith1doesnotmatchtrueenums)
    Double enum | + +## EnumWith1DoesNotMatchTrue1Boxed +sealed interface EnumWith1DoesNotMatchTrue1Boxed
    +permits
    +[EnumWith1DoesNotMatchTrue1BoxedNumber](#enumwith1doesnotmatchtrue1boxednumber) + +sealed interface that stores validated payloads using boxed classes + +## EnumWith1DoesNotMatchTrue1BoxedNumber +data class EnumWith1DoesNotMatchTrue1BoxedNumber
    +implements [EnumWith1DoesNotMatchTrue1Boxed](#enumwith1doesnotmatchtrue1boxed) + +data class that stores validated Number payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| EnumWith1DoesNotMatchTrue1BoxedNumber(Number data)
    Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| Number | data()
    validated payload | +| Any? | getData()
    validated payload | + +## EnumWith1DoesNotMatchTrue1 +class EnumWith1DoesNotMatchTrue1
    +extends JsonSchema + +A schema class that validates payloads + +### Code Sample +``` +import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags; +import org.openapijsonschematools.client.configurations.SchemaConfiguration; +import org.openapijsonschematools.client.exceptions.ValidationException; +import org.openapijsonschematools.client.schemas.validation.MapUtils; +import org.openapijsonschematools.client.schemas.validation.FrozenList; +import org.openapijsonschematools.client.schemas.validation.FrozenMap; +import org.openapijsonschematools.client.components.schemas.EnumWith1DoesNotMatchTrue; + +import java.util.Arrays; +import java.util.List; +import java.util.AbstractMap; + +static final SchemaConfiguration configuration = new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().build()); + +// int validation +int validatedPayload = EnumWith1DoesNotMatchTrue.EnumWith1DoesNotMatchTrue1.validate( + 1, + configuration +); +``` + +### Field Summary +| Modifier and Type | Field and Description | +| ----------------- | ---------------------- | +| Set> | type = setOf(
        Int::class.java,
        Long::class.java,
        Float::class.java,
        Double::class.java
    )
    | +| Set | enumValues = setOf(
        1
    )
    | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| Number | validate(arg: Number, configuration: SchemaConfiguration) | +| [EnumWith1DoesNotMatchTrue1BoxedNumber](#enumwith1doesnotmatchtrue1boxednumber) | validateAndBox(Number, configuration: SchemaConfiguration) | +| [EnumWith1DoesNotMatchTrue1Boxed](#enumwith1doesnotmatchtrue1boxed) | validateAndBox(Any?, configuration: SchemaConfiguration) | +| Any? | validate(arg: Any?, configuration: SchemaConfiguration) | + +## IntegerEnumWith1DoesNotMatchTrueEnums +public enum IntegerEnumWith1DoesNotMatchTrueEnums
    +extends `Enum` + +A class that stores Integer enum values + +### Enum Constant Summary +| Enum Constant | Description | +| ------------- | ----------- | +| POSITIVE_1 | value = 1 | + +## LongEnumWith1DoesNotMatchTrueEnums +public enum LongEnumWith1DoesNotMatchTrueEnums
    +extends `Enum` + +A class that stores Long enum values + +### Enum Constant Summary +| Enum Constant | Description | +| ------------- | ----------- | +| POSITIVE_1 | value = 1L | + +## FloatEnumWith1DoesNotMatchTrueEnums +public enum FloatEnumWith1DoesNotMatchTrueEnums
    +extends `Enum` + +A class that stores Float enum values + +### Enum Constant Summary +| Enum Constant | Description | +| ------------- | ----------- | +| POSITIVE_1 | value = 1.0f | + +## DoubleEnumWith1DoesNotMatchTrueEnums +public enum DoubleEnumWith1DoesNotMatchTrueEnums
    +extends `Enum` + +A class that stores Double enum values + +### Enum Constant Summary +| Enum Constant | Description | +| ------------- | ----------- | +| POSITIVE_1 | value = 1.0d | + +[[Back to top]](#top) [[Back to Component Schemas]](../../../README.md#Component-Schemas) [[Back to README]](../../../README.md) diff --git a/samples/client/3_1_0_unit_test/kotlin/docs/components/schemas/EnumWithEscapedCharacters.md b/samples/client/3_1_0_unit_test/kotlin/docs/components/schemas/EnumWithEscapedCharacters.md new file mode 100644 index 00000000000..54458d5522a --- /dev/null +++ b/samples/client/3_1_0_unit_test/kotlin/docs/components/schemas/EnumWithEscapedCharacters.md @@ -0,0 +1,99 @@ +# EnumWithEscapedCharacters +org.openapijsonschematools.client.components.schemas.EnumWithEscapedCharacters.java +class EnumWithEscapedCharacters
    + +A class that contains necessary nested +- schema classes (which validate payloads), extends JsonSchema +- sealed interfaces which store validated payloads, Kotlin version of a sum type +- boxed classes which store validated payloads, sealed permits class implementations +- enum classes + +## Nested Class Summary +| Modifier and Type | Class and Description | +| ----------------- | ---------------------- | +| sealed interface | [EnumWithEscapedCharacters.EnumWithEscapedCharacters1Boxed](#enumwithescapedcharacters1boxed)
    sealed interface for validated payloads | +| record | [EnumWithEscapedCharacters.EnumWithEscapedCharacters1BoxedString](#enumwithescapedcharacters1boxedstring)
    boxed class to store validated String payloads | +| static class | [EnumWithEscapedCharacters.EnumWithEscapedCharacters1](#enumwithescapedcharacters1)
    schema class | +| enum | [EnumWithEscapedCharacters.StringEnumWithEscapedCharactersEnums](#stringenumwithescapedcharactersenums)
    String enum | + +## EnumWithEscapedCharacters1Boxed +sealed interface EnumWithEscapedCharacters1Boxed
    +permits
    +[EnumWithEscapedCharacters1BoxedString](#enumwithescapedcharacters1boxedstring) + +sealed interface that stores validated payloads using boxed classes + +## EnumWithEscapedCharacters1BoxedString +data class EnumWithEscapedCharacters1BoxedString
    +implements [EnumWithEscapedCharacters1Boxed](#enumwithescapedcharacters1boxed) + +data class that stores validated String payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| EnumWithEscapedCharacters1BoxedString(String data)
    Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| String | data()
    validated payload | +| Any? | getData()
    validated payload | + +## EnumWithEscapedCharacters1 +class EnumWithEscapedCharacters1
    +extends JsonSchema + +A schema class that validates payloads + +### Code Sample +``` +import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags; +import org.openapijsonschematools.client.configurations.SchemaConfiguration; +import org.openapijsonschematools.client.exceptions.ValidationException; +import org.openapijsonschematools.client.schemas.validation.MapUtils; +import org.openapijsonschematools.client.schemas.validation.FrozenList; +import org.openapijsonschematools.client.schemas.validation.FrozenMap; +import org.openapijsonschematools.client.components.schemas.EnumWithEscapedCharacters; + +import java.util.Arrays; +import java.util.List; +import java.util.AbstractMap; + +static final SchemaConfiguration configuration = new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().build()); + +// String validation +String validatedPayload = EnumWithEscapedCharacters.EnumWithEscapedCharacters1.validate( + "foo\nbar", + configuration +); +``` + +### Field Summary +| Modifier and Type | Field and Description | +| ----------------- | ---------------------- | +| Set> | type = setOf(
        String::class.java
    )
    | +| Set | enumValues = setOf(
        "foo\nbar",
        "foo\rbar"
    )
    | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| String | validate(arg: String, configuration: SchemaConfiguration) | +| String | validate(arg: [StringEnumWithEscapedCharactersEnums](#stringenumwithescapedcharactersenums), configuration: SchemaConfiguration) | +| [EnumWithEscapedCharacters1BoxedString](#enumwithescapedcharacters1boxedstring) | validateAndBox(String, configuration: SchemaConfiguration) | +| [EnumWithEscapedCharacters1Boxed](#enumwithescapedcharacters1boxed) | validateAndBox(Any?, configuration: SchemaConfiguration) | +| Any? | validate(arg: Any?, configuration: SchemaConfiguration) | + +## StringEnumWithEscapedCharactersEnums +public enum StringEnumWithEscapedCharactersEnums
    +extends `Enum` + +A class that stores String enum values + +### Enum Constant Summary +| Enum Constant | Description | +| ------------- | ----------- | +| FOO_LINE_FEED_LF_BAR | value = "foo\nbar" | +| FOO_CARRIAGE_RETURN_CR_BAR | value = "foo\rbar" | + +[[Back to top]](#top) [[Back to Component Schemas]](../../../README.md#Component-Schemas) [[Back to README]](../../../README.md) diff --git a/samples/client/3_1_0_unit_test/kotlin/docs/components/schemas/EnumWithFalseDoesNotMatch0.md b/samples/client/3_1_0_unit_test/kotlin/docs/components/schemas/EnumWithFalseDoesNotMatch0.md new file mode 100644 index 00000000000..8055fb6b4d9 --- /dev/null +++ b/samples/client/3_1_0_unit_test/kotlin/docs/components/schemas/EnumWithFalseDoesNotMatch0.md @@ -0,0 +1,98 @@ +# EnumWithFalseDoesNotMatch0 +org.openapijsonschematools.client.components.schemas.EnumWithFalseDoesNotMatch0.java +class EnumWithFalseDoesNotMatch0
    + +A class that contains necessary nested +- schema classes (which validate payloads), extends JsonSchema +- sealed interfaces which store validated payloads, Kotlin version of a sum type +- boxed classes which store validated payloads, sealed permits class implementations +- enum classes + +## Nested Class Summary +| Modifier and Type | Class and Description | +| ----------------- | ---------------------- | +| sealed interface | [EnumWithFalseDoesNotMatch0.EnumWithFalseDoesNotMatch01Boxed](#enumwithfalsedoesnotmatch01boxed)
    sealed interface for validated payloads | +| record | [EnumWithFalseDoesNotMatch0.EnumWithFalseDoesNotMatch01BoxedBoolean](#enumwithfalsedoesnotmatch01boxedboolean)
    boxed class to store validated boolean payloads | +| static class | [EnumWithFalseDoesNotMatch0.EnumWithFalseDoesNotMatch01](#enumwithfalsedoesnotmatch01)
    schema class | +| enum | [EnumWithFalseDoesNotMatch0.BooleanEnumWithFalseDoesNotMatch0Enums](#booleanenumwithfalsedoesnotmatch0enums)
    boolean enum | + +## EnumWithFalseDoesNotMatch01Boxed +sealed interface EnumWithFalseDoesNotMatch01Boxed
    +permits
    +[EnumWithFalseDoesNotMatch01BoxedBoolean](#enumwithfalsedoesnotmatch01boxedboolean) + +sealed interface that stores validated payloads using boxed classes + +## EnumWithFalseDoesNotMatch01BoxedBoolean +data class EnumWithFalseDoesNotMatch01BoxedBoolean
    +implements [EnumWithFalseDoesNotMatch01Boxed](#enumwithfalsedoesnotmatch01boxed) + +record that stores validated boolean payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| EnumWithFalseDoesNotMatch01BoxedBoolean(boolean data)
    Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| boolean | data()
    validated payload | +| Any? | getData()
    validated payload | + +## EnumWithFalseDoesNotMatch01 +class EnumWithFalseDoesNotMatch01
    +extends JsonSchema + +A schema class that validates payloads + +### Code Sample +``` +import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags; +import org.openapijsonschematools.client.configurations.SchemaConfiguration; +import org.openapijsonschematools.client.exceptions.ValidationException; +import org.openapijsonschematools.client.schemas.validation.MapUtils; +import org.openapijsonschematools.client.schemas.validation.FrozenList; +import org.openapijsonschematools.client.schemas.validation.FrozenMap; +import org.openapijsonschematools.client.components.schemas.EnumWithFalseDoesNotMatch0; + +import java.util.Arrays; +import java.util.List; +import java.util.AbstractMap; + +static final SchemaConfiguration configuration = new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().build()); + +// boolean validation +boolean validatedPayload = EnumWithFalseDoesNotMatch0.EnumWithFalseDoesNotMatch01.validate( + false, + configuration +); +``` + +### Field Summary +| Modifier and Type | Field and Description | +| ----------------- | ---------------------- | +| Set> | type = setOf(Boolean::class.java) | +| Set | enumValues = setOf(
        false
    )
    | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| boolean | validate(arg: boolean, configuration: SchemaConfiguration) | +| boolean | validate(arg: [BooleanEnumWithFalseDoesNotMatch0Enums](#booleanenumwithfalsedoesnotmatch0enums), configuration: SchemaConfiguration) | +| [EnumWithFalseDoesNotMatch01BoxedBoolean](#enumwithfalsedoesnotmatch01boxedboolean) | validateAndBox(boolean, configuration: SchemaConfiguration) | +| [EnumWithFalseDoesNotMatch01Boxed](#enumwithfalsedoesnotmatch01boxed) | validateAndBox(Any?, configuration: SchemaConfiguration) | +| Any? | validate(arg: Any?, configuration: SchemaConfiguration) | + +## BooleanEnumWithFalseDoesNotMatch0Enums +public enum BooleanEnumWithFalseDoesNotMatch0Enums
    +extends `Enum` + +A class that stores boolean enum values + +### Enum Constant Summary +| Enum Constant | Description | +| ------------- | ----------- | +| FALSE | value = false | + +[[Back to top]](#top) [[Back to Component Schemas]](../../../README.md#Component-Schemas) [[Back to README]](../../../README.md) diff --git a/samples/client/3_1_0_unit_test/kotlin/docs/components/schemas/EnumWithTrueDoesNotMatch1.md b/samples/client/3_1_0_unit_test/kotlin/docs/components/schemas/EnumWithTrueDoesNotMatch1.md new file mode 100644 index 00000000000..c22cd9303bb --- /dev/null +++ b/samples/client/3_1_0_unit_test/kotlin/docs/components/schemas/EnumWithTrueDoesNotMatch1.md @@ -0,0 +1,98 @@ +# EnumWithTrueDoesNotMatch1 +org.openapijsonschematools.client.components.schemas.EnumWithTrueDoesNotMatch1.java +class EnumWithTrueDoesNotMatch1
    + +A class that contains necessary nested +- schema classes (which validate payloads), extends JsonSchema +- sealed interfaces which store validated payloads, Kotlin version of a sum type +- boxed classes which store validated payloads, sealed permits class implementations +- enum classes + +## Nested Class Summary +| Modifier and Type | Class and Description | +| ----------------- | ---------------------- | +| sealed interface | [EnumWithTrueDoesNotMatch1.EnumWithTrueDoesNotMatch11Boxed](#enumwithtruedoesnotmatch11boxed)
    sealed interface for validated payloads | +| record | [EnumWithTrueDoesNotMatch1.EnumWithTrueDoesNotMatch11BoxedBoolean](#enumwithtruedoesnotmatch11boxedboolean)
    boxed class to store validated boolean payloads | +| static class | [EnumWithTrueDoesNotMatch1.EnumWithTrueDoesNotMatch11](#enumwithtruedoesnotmatch11)
    schema class | +| enum | [EnumWithTrueDoesNotMatch1.BooleanEnumWithTrueDoesNotMatch1Enums](#booleanenumwithtruedoesnotmatch1enums)
    boolean enum | + +## EnumWithTrueDoesNotMatch11Boxed +sealed interface EnumWithTrueDoesNotMatch11Boxed
    +permits
    +[EnumWithTrueDoesNotMatch11BoxedBoolean](#enumwithtruedoesnotmatch11boxedboolean) + +sealed interface that stores validated payloads using boxed classes + +## EnumWithTrueDoesNotMatch11BoxedBoolean +data class EnumWithTrueDoesNotMatch11BoxedBoolean
    +implements [EnumWithTrueDoesNotMatch11Boxed](#enumwithtruedoesnotmatch11boxed) + +record that stores validated boolean payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| EnumWithTrueDoesNotMatch11BoxedBoolean(boolean data)
    Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| boolean | data()
    validated payload | +| Any? | getData()
    validated payload | + +## EnumWithTrueDoesNotMatch11 +class EnumWithTrueDoesNotMatch11
    +extends JsonSchema + +A schema class that validates payloads + +### Code Sample +``` +import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags; +import org.openapijsonschematools.client.configurations.SchemaConfiguration; +import org.openapijsonschematools.client.exceptions.ValidationException; +import org.openapijsonschematools.client.schemas.validation.MapUtils; +import org.openapijsonschematools.client.schemas.validation.FrozenList; +import org.openapijsonschematools.client.schemas.validation.FrozenMap; +import org.openapijsonschematools.client.components.schemas.EnumWithTrueDoesNotMatch1; + +import java.util.Arrays; +import java.util.List; +import java.util.AbstractMap; + +static final SchemaConfiguration configuration = new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().build()); + +// boolean validation +boolean validatedPayload = EnumWithTrueDoesNotMatch1.EnumWithTrueDoesNotMatch11.validate( + true, + configuration +); +``` + +### Field Summary +| Modifier and Type | Field and Description | +| ----------------- | ---------------------- | +| Set> | type = setOf(Boolean::class.java) | +| Set | enumValues = setOf(
        true
    )
    | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| boolean | validate(arg: boolean, configuration: SchemaConfiguration) | +| boolean | validate(arg: [BooleanEnumWithTrueDoesNotMatch1Enums](#booleanenumwithtruedoesnotmatch1enums), configuration: SchemaConfiguration) | +| [EnumWithTrueDoesNotMatch11BoxedBoolean](#enumwithtruedoesnotmatch11boxedboolean) | validateAndBox(boolean, configuration: SchemaConfiguration) | +| [EnumWithTrueDoesNotMatch11Boxed](#enumwithtruedoesnotmatch11boxed) | validateAndBox(Any?, configuration: SchemaConfiguration) | +| Any? | validate(arg: Any?, configuration: SchemaConfiguration) | + +## BooleanEnumWithTrueDoesNotMatch1Enums +public enum BooleanEnumWithTrueDoesNotMatch1Enums
    +extends `Enum` + +A class that stores boolean enum values + +### Enum Constant Summary +| Enum Constant | Description | +| ------------- | ----------- | +| TRUE | value = true | + +[[Back to top]](#top) [[Back to Component Schemas]](../../../README.md#Component-Schemas) [[Back to README]](../../../README.md) diff --git a/samples/client/3_1_0_unit_test/kotlin/docs/components/schemas/EnumsInProperties.md b/samples/client/3_1_0_unit_test/kotlin/docs/components/schemas/EnumsInProperties.md new file mode 100644 index 00000000000..dad4dd136ad --- /dev/null +++ b/samples/client/3_1_0_unit_test/kotlin/docs/components/schemas/EnumsInProperties.md @@ -0,0 +1,320 @@ +# EnumsInProperties +org.openapijsonschematools.client.components.schemas.EnumsInProperties.java +class EnumsInProperties
    + +A class that contains necessary nested +- schema classes (which validate payloads), extends JsonSchema +- sealed interfaces which store validated payloads, Kotlin version of a sum type +- boxed classes which store validated payloads, sealed permits class implementations +- classes to store validated map payloads, extends FrozenMap +- classes to build inputs for map payloads +- enum classes + +## Nested Class Summary +| Modifier and Type | Class and Description | +| ----------------- | ---------------------- | +| sealed interface | [EnumsInProperties.EnumsInProperties1Boxed](#enumsinproperties1boxed)
    sealed interface for validated payloads | +| record | [EnumsInProperties.EnumsInProperties1BoxedMap](#enumsinproperties1boxedmap)
    boxed class to store validated Map payloads | +| static class | [EnumsInProperties.EnumsInProperties1](#enumsinproperties1)
    schema class | +| static class | [EnumsInProperties.EnumsInPropertiesMapBuilder](#enumsinpropertiesmapbuilder)
    builder for Map payloads | +| static class | [EnumsInProperties.EnumsInPropertiesMap](#enumsinpropertiesmap)
    output class for Map payloads | +| sealed interface | [EnumsInProperties.BarBoxed](#barboxed)
    sealed interface for validated payloads | +| record | [EnumsInProperties.BarBoxedString](#barboxedstring)
    boxed class to store validated String payloads | +| static class | [EnumsInProperties.Bar](#bar)
    schema class | +| enum | [EnumsInProperties.StringBarEnums](#stringbarenums)
    String enum | +| sealed interface | [EnumsInProperties.FooBoxed](#fooboxed)
    sealed interface for validated payloads | +| record | [EnumsInProperties.FooBoxedString](#fooboxedstring)
    boxed class to store validated String payloads | +| static class | [EnumsInProperties.Foo](#foo)
    schema class | +| enum | [EnumsInProperties.StringFooEnums](#stringfooenums)
    String enum | + +## EnumsInProperties1Boxed +sealed interface EnumsInProperties1Boxed
    +permits
    +[EnumsInProperties1BoxedMap](#enumsinproperties1boxedmap) + +sealed interface that stores validated payloads using boxed classes + +## EnumsInProperties1BoxedMap +data class EnumsInProperties1BoxedMap
    +implements [EnumsInProperties1Boxed](#enumsinproperties1boxed) + +data class that stores validated Map payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| EnumsInProperties1BoxedMap([EnumsInPropertiesMap](#enumsinpropertiesmap) data)
    Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| [EnumsInPropertiesMap](#enumsinpropertiesmap) | data()
    validated payload | +| Any? | getData()
    validated payload | + +## EnumsInProperties1 +class EnumsInProperties1
    +extends JsonSchema + +A schema class that validates payloads + +### Code Sample +``` +import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags; +import org.openapijsonschematools.client.configurations.SchemaConfiguration; +import org.openapijsonschematools.client.exceptions.ValidationException; +import org.openapijsonschematools.client.schemas.validation.MapUtils; +import org.openapijsonschematools.client.schemas.validation.FrozenList; +import org.openapijsonschematools.client.schemas.validation.FrozenMap; +import org.openapijsonschematools.client.components.schemas.EnumsInProperties; + +import java.util.Arrays; +import java.util.List; +import java.util.AbstractMap; + +static final SchemaConfiguration configuration = new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().build()); + +// Map validation +EnumsInProperties.EnumsInPropertiesMap validatedPayload = + EnumsInProperties.EnumsInProperties1.validate( + new EnumsInProperties.EnumsInPropertiesMapBuilder() + .bar("bar") + + .foo("foo") + + .build(), + configuration +); +``` + +### Field Summary +| Modifier and Type | Field and Description | +| ----------------- | ---------------------- | +| Set> | type = setOf(Map::class.java) | +| Map> | properties = mapOf(
        "foo" to [Foo::class.java](#foo)),
        "bar" to [Bar::class.java](#bar))
    )
    | +| Set | required = setOf(
        "bar"
    )
    | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| [EnumsInPropertiesMap](#enumsinpropertiesmap) | validate(arg: [Map<?, ?>](#enumsinpropertiesmapbuilder), configuration: SchemaConfiguration) | +| [EnumsInProperties1BoxedMap](#enumsinproperties1boxedmap) | validateAndBox([Map<?, ?>](#enumsinpropertiesmapbuilder), configuration: SchemaConfiguration) | +| [EnumsInProperties1Boxed](#enumsinproperties1boxed) | validateAndBox(Any?, configuration: SchemaConfiguration) | +| Any? | validate(arg: Any?, configuration: SchemaConfiguration) | + +## EnumsInPropertiesMap0Builder +class EnumsInPropertiesMap0Builder
    +builder for `Map` + +A class that builds the Map input type + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| EnumsInPropertiesMap0Builder(Map instance)
    Creates a builder that contains the passed instance | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| Map | build()
    Returns map input that should be used with Schema.validate | +| [EnumsInPropertiesMap0Builder](#enumsinpropertiesmap0builder) | foo(value: String) | +| [EnumsInPropertiesMap0Builder](#enumsinpropertiesmap0builder) | foo(value: [StringFooEnums](#stringfooenums)) | +| [EnumsInPropertiesMap0Builder](#enumsinpropertiesmap0builder) | additionalProperty(key: String, value: Nothing?) | +| [EnumsInPropertiesMap0Builder](#enumsinpropertiesmap0builder) | additionalProperty(key: String, value: Boolean) | +| [EnumsInPropertiesMap0Builder](#enumsinpropertiesmap0builder) | additionalProperty(key: String, value: String) | +| [EnumsInPropertiesMap0Builder](#enumsinpropertiesmap0builder) | additionalProperty(key: String, value: Int) | +| [EnumsInPropertiesMap0Builder](#enumsinpropertiesmap0builder) | additionalProperty(key: String, value: Float) | +| [EnumsInPropertiesMap0Builder](#enumsinpropertiesmap0builder) | additionalProperty(key: String, value: Long) | +| [EnumsInPropertiesMap0Builder](#enumsinpropertiesmap0builder) | additionalProperty(key: String, value: Double) | +| [EnumsInPropertiesMap0Builder](#enumsinpropertiesmap0builder) | additionalProperty(key: String, value: List) | +| [EnumsInPropertiesMap0Builder](#enumsinpropertiesmap0builder) | additionalProperty(key: String, value: Map) | + +## EnumsInPropertiesMapBuilder +class EnumsInPropertiesMapBuilder
    +builder for `Map` + +A class that builds the Map input type + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| EnumsInPropertiesMapBuilder()
    Creates a builder that contains an empty map | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| [EnumsInPropertiesMap0Builder](#enumsinpropertiesmap0builder) | bar(value: String) | +| [EnumsInPropertiesMap0Builder](#enumsinpropertiesmap0builder) | bar(value: [StringBarEnums](#stringbarenums)) | + +## EnumsInPropertiesMap +class EnumsInPropertiesMap
    +extends FrozenMap + +A class to store validated Map payloads + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| static [EnumsInPropertiesMap](#enumsinpropertiesmap) | of([Map](#enumsinpropertiesmapbuilder) arg, SchemaConfiguration configuration) | +| String | bar()
    must be one of ["bar"] | +| String | foo()
    [optional] must be one of ["foo"] | +| Any? | getAdditionalProperty(String name)
    provides type safety for additional properties | + +## BarBoxed +sealed interface BarBoxed
    +permits
    +[BarBoxedString](#barboxedstring) + +sealed interface that stores validated payloads using boxed classes + +## BarBoxedString +data class BarBoxedString
    +implements [BarBoxed](#barboxed) + +data class that stores validated String payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| BarBoxedString(String data)
    Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| String | data()
    validated payload | +| Any? | getData()
    validated payload | + +## Bar +class Bar
    +extends JsonSchema + +A schema class that validates payloads + +### Code Sample +``` +import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags; +import org.openapijsonschematools.client.configurations.SchemaConfiguration; +import org.openapijsonschematools.client.exceptions.ValidationException; +import org.openapijsonschematools.client.schemas.validation.MapUtils; +import org.openapijsonschematools.client.schemas.validation.FrozenList; +import org.openapijsonschematools.client.schemas.validation.FrozenMap; +import org.openapijsonschematools.client.components.schemas.EnumsInProperties; + +import java.util.Arrays; +import java.util.List; +import java.util.AbstractMap; + +static final SchemaConfiguration configuration = new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().build()); + +// String validation +String validatedPayload = EnumsInProperties.Bar.validate( + "bar", + configuration +); +``` + +### Field Summary +| Modifier and Type | Field and Description | +| ----------------- | ---------------------- | +| Set> | type = setOf(
        String::class.java
    )
    | +| Set | enumValues = setOf(
        "bar"
    )
    | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| String | validate(arg: String, configuration: SchemaConfiguration) | +| String | validate(arg: [StringBarEnums](#stringbarenums), configuration: SchemaConfiguration) | +| [BarBoxedString](#barboxedstring) | validateAndBox(String, configuration: SchemaConfiguration) | +| [BarBoxed](#barboxed) | validateAndBox(Any?, configuration: SchemaConfiguration) | +| Any? | validate(arg: Any?, configuration: SchemaConfiguration) | + +## StringBarEnums +public enum StringBarEnums
    +extends `Enum` + +A class that stores String enum values + +### Enum Constant Summary +| Enum Constant | Description | +| ------------- | ----------- | +| BAR | value = "bar" | + +## FooBoxed +sealed interface FooBoxed
    +permits
    +[FooBoxedString](#fooboxedstring) + +sealed interface that stores validated payloads using boxed classes + +## FooBoxedString +data class FooBoxedString
    +implements [FooBoxed](#fooboxed) + +data class that stores validated String payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| FooBoxedString(String data)
    Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| String | data()
    validated payload | +| Any? | getData()
    validated payload | + +## Foo +class Foo
    +extends JsonSchema + +A schema class that validates payloads + +### Code Sample +``` +import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags; +import org.openapijsonschematools.client.configurations.SchemaConfiguration; +import org.openapijsonschematools.client.exceptions.ValidationException; +import org.openapijsonschematools.client.schemas.validation.MapUtils; +import org.openapijsonschematools.client.schemas.validation.FrozenList; +import org.openapijsonschematools.client.schemas.validation.FrozenMap; +import org.openapijsonschematools.client.components.schemas.EnumsInProperties; + +import java.util.Arrays; +import java.util.List; +import java.util.AbstractMap; + +static final SchemaConfiguration configuration = new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().build()); + +// String validation +String validatedPayload = EnumsInProperties.Foo.validate( + "foo", + configuration +); +``` + +### Field Summary +| Modifier and Type | Field and Description | +| ----------------- | ---------------------- | +| Set> | type = setOf(
        String::class.java
    )
    | +| Set | enumValues = setOf(
        "foo"
    )
    | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| String | validate(arg: String, configuration: SchemaConfiguration) | +| String | validate(arg: [StringFooEnums](#stringfooenums), configuration: SchemaConfiguration) | +| [FooBoxedString](#fooboxedstring) | validateAndBox(String, configuration: SchemaConfiguration) | +| [FooBoxed](#fooboxed) | validateAndBox(Any?, configuration: SchemaConfiguration) | +| Any? | validate(arg: Any?, configuration: SchemaConfiguration) | + +## StringFooEnums +public enum StringFooEnums
    +extends `Enum` + +A class that stores String enum values + +### Enum Constant Summary +| Enum Constant | Description | +| ------------- | ----------- | +| FOO | value = "foo" | + +[[Back to top]](#top) [[Back to Component Schemas]](../../../README.md#Component-Schemas) [[Back to README]](../../../README.md) diff --git a/samples/client/3_1_0_unit_test/kotlin/docs/components/schemas/ExclusivemaximumValidation.md b/samples/client/3_1_0_unit_test/kotlin/docs/components/schemas/ExclusivemaximumValidation.md new file mode 100644 index 00000000000..abb9d6bfeb0 --- /dev/null +++ b/samples/client/3_1_0_unit_test/kotlin/docs/components/schemas/ExclusivemaximumValidation.md @@ -0,0 +1,169 @@ +# ExclusivemaximumValidation +org.openapijsonschematools.client.components.schemas.ExclusivemaximumValidation.java +class ExclusivemaximumValidation
    + +A class that contains necessary nested +- schema classes (which validate payloads), extends JsonSchema +- sealed interfaces which store validated payloads, Kotlin version of a sum type +- boxed classes which store validated payloads, sealed permits class implementations + +## Nested Class Summary +| Modifier and Type | Class and Description | +| ----------------- | ---------------------- | +| sealed interface | [ExclusivemaximumValidation.ExclusivemaximumValidation1Boxed](#exclusivemaximumvalidation1boxed)
    sealed interface for validated payloads | +| record | [ExclusivemaximumValidation.ExclusivemaximumValidation1BoxedVoid](#exclusivemaximumvalidation1boxedvoid)
    boxed class to store validated null payloads | +| record | [ExclusivemaximumValidation.ExclusivemaximumValidation1BoxedBoolean](#exclusivemaximumvalidation1boxedboolean)
    boxed class to store validated boolean payloads | +| record | [ExclusivemaximumValidation.ExclusivemaximumValidation1BoxedNumber](#exclusivemaximumvalidation1boxednumber)
    boxed class to store validated Number payloads | +| record | [ExclusivemaximumValidation.ExclusivemaximumValidation1BoxedString](#exclusivemaximumvalidation1boxedstring)
    boxed class to store validated String payloads | +| record | [ExclusivemaximumValidation.ExclusivemaximumValidation1BoxedList](#exclusivemaximumvalidation1boxedlist)
    boxed class to store validated List payloads | +| record | [ExclusivemaximumValidation.ExclusivemaximumValidation1BoxedMap](#exclusivemaximumvalidation1boxedmap)
    boxed class to store validated Map payloads | +| static class | [ExclusivemaximumValidation.ExclusivemaximumValidation1](#exclusivemaximumvalidation1)
    schema class | + +## ExclusivemaximumValidation1Boxed +sealed interface ExclusivemaximumValidation1Boxed
    +permits
    +[ExclusivemaximumValidation1BoxedVoid](#exclusivemaximumvalidation1boxedvoid), +[ExclusivemaximumValidation1BoxedBoolean](#exclusivemaximumvalidation1boxedboolean), +[ExclusivemaximumValidation1BoxedNumber](#exclusivemaximumvalidation1boxednumber), +[ExclusivemaximumValidation1BoxedString](#exclusivemaximumvalidation1boxedstring), +[ExclusivemaximumValidation1BoxedList](#exclusivemaximumvalidation1boxedlist), +[ExclusivemaximumValidation1BoxedMap](#exclusivemaximumvalidation1boxedmap) + +sealed interface that stores validated payloads using boxed classes + +## ExclusivemaximumValidation1BoxedVoid +data class ExclusivemaximumValidation1BoxedVoid
    +implements [ExclusivemaximumValidation1Boxed](#exclusivemaximumvalidation1boxed) + +data class that stores validated null payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| ExclusivemaximumValidation1BoxedVoid(Nothing? data)
    Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| Nothing? | data()
    validated payload | +| Any? | getData()
    validated payload | + +## ExclusivemaximumValidation1BoxedBoolean +data class ExclusivemaximumValidation1BoxedBoolean
    +implements [ExclusivemaximumValidation1Boxed](#exclusivemaximumvalidation1boxed) + +record that stores validated boolean payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| ExclusivemaximumValidation1BoxedBoolean(boolean data)
    Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| boolean | data()
    validated payload | +| Any? | getData()
    validated payload | + +## ExclusivemaximumValidation1BoxedNumber +data class ExclusivemaximumValidation1BoxedNumber
    +implements [ExclusivemaximumValidation1Boxed](#exclusivemaximumvalidation1boxed) + +data class that stores validated Number payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| ExclusivemaximumValidation1BoxedNumber(Number data)
    Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| Number | data()
    validated payload | +| Any? | getData()
    validated payload | + +## ExclusivemaximumValidation1BoxedString +data class ExclusivemaximumValidation1BoxedString
    +implements [ExclusivemaximumValidation1Boxed](#exclusivemaximumvalidation1boxed) + +data class that stores validated String payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| ExclusivemaximumValidation1BoxedString(String data)
    Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| String | data()
    validated payload | +| Any? | getData()
    validated payload | + +## ExclusivemaximumValidation1BoxedList +data class ExclusivemaximumValidation1BoxedList
    +implements [ExclusivemaximumValidation1Boxed](#exclusivemaximumvalidation1boxed) + +data class that stores validated List payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| ExclusivemaximumValidation1BoxedList(FrozenList data)
    Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| FrozenList | data()
    validated payload | +| Any? | getData()
    validated payload | + +## ExclusivemaximumValidation1BoxedMap +data class ExclusivemaximumValidation1BoxedMap
    +implements [ExclusivemaximumValidation1Boxed](#exclusivemaximumvalidation1boxed) + +data class that stores validated Map payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| ExclusivemaximumValidation1BoxedMap(FrozenMap data)
    Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| FrozenMap | data()
    validated payload | +| Any? | getData()
    validated payload | + +## ExclusivemaximumValidation1 +class ExclusivemaximumValidation1
    +extends JsonSchema + +A schema class that validates payloads + +### Field Summary +| Modifier and Type | Field and Description | +| ----------------- | ---------------------- | +| Number | exclusiveMaximum = 3.0 | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| String | validate(arg: String, configuration: SchemaConfiguration) | +| Nothing? | validate(arg: Nothing?, configuration: SchemaConfiguration) | +| int | validate(arg: int, configuration: SchemaConfiguration) | +| long | validate(arg: long, configuration: SchemaConfiguration) | +| float | validate(arg: float, configuration: SchemaConfiguration) | +| double | validate(arg: double, configuration: SchemaConfiguration) | +| Number | validate(arg: Number, configuration: SchemaConfiguration) | +| boolean | validate(arg: boolean, configuration: SchemaConfiguration) | +| FrozenMap | validate(arg: Map<?, ?>, configuration: SchemaConfiguration) | +| FrozenList | validate(arg: List<*>, configuration: SchemaConfiguration) | +| [ExclusivemaximumValidation1BoxedString](#exclusivemaximumvalidation1boxedstring) | validateAndBox(String, configuration: SchemaConfiguration) | +| [ExclusivemaximumValidation1BoxedVoid](#exclusivemaximumvalidation1boxedvoid) | validateAndBox(Nothing?, configuration: SchemaConfiguration) | +| [ExclusivemaximumValidation1BoxedNumber](#exclusivemaximumvalidation1boxednumber) | validateAndBox(Number, configuration: SchemaConfiguration) | +| [ExclusivemaximumValidation1BoxedBoolean](#exclusivemaximumvalidation1boxedboolean) | validateAndBox(boolean, configuration: SchemaConfiguration) | +| [ExclusivemaximumValidation1BoxedMap](#exclusivemaximumvalidation1boxedmap) | validateAndBox(Map<?, ?>, configuration: SchemaConfiguration) | +| [ExclusivemaximumValidation1BoxedList](#exclusivemaximumvalidation1boxedlist) | validateAndBox(List<*>, configuration: SchemaConfiguration) | +| [ExclusivemaximumValidation1Boxed](#exclusivemaximumvalidation1boxed) | validateAndBox(Any?, configuration: SchemaConfiguration) | +| Any? | validate(arg: Any?, configuration: SchemaConfiguration) | + +[[Back to top]](#top) [[Back to Component Schemas]](../../../README.md#Component-Schemas) [[Back to README]](../../../README.md) diff --git a/samples/client/3_1_0_unit_test/kotlin/docs/components/schemas/ExclusiveminimumValidation.md b/samples/client/3_1_0_unit_test/kotlin/docs/components/schemas/ExclusiveminimumValidation.md new file mode 100644 index 00000000000..aa688f8c18d --- /dev/null +++ b/samples/client/3_1_0_unit_test/kotlin/docs/components/schemas/ExclusiveminimumValidation.md @@ -0,0 +1,169 @@ +# ExclusiveminimumValidation +org.openapijsonschematools.client.components.schemas.ExclusiveminimumValidation.java +class ExclusiveminimumValidation
    + +A class that contains necessary nested +- schema classes (which validate payloads), extends JsonSchema +- sealed interfaces which store validated payloads, Kotlin version of a sum type +- boxed classes which store validated payloads, sealed permits class implementations + +## Nested Class Summary +| Modifier and Type | Class and Description | +| ----------------- | ---------------------- | +| sealed interface | [ExclusiveminimumValidation.ExclusiveminimumValidation1Boxed](#exclusiveminimumvalidation1boxed)
    sealed interface for validated payloads | +| record | [ExclusiveminimumValidation.ExclusiveminimumValidation1BoxedVoid](#exclusiveminimumvalidation1boxedvoid)
    boxed class to store validated null payloads | +| record | [ExclusiveminimumValidation.ExclusiveminimumValidation1BoxedBoolean](#exclusiveminimumvalidation1boxedboolean)
    boxed class to store validated boolean payloads | +| record | [ExclusiveminimumValidation.ExclusiveminimumValidation1BoxedNumber](#exclusiveminimumvalidation1boxednumber)
    boxed class to store validated Number payloads | +| record | [ExclusiveminimumValidation.ExclusiveminimumValidation1BoxedString](#exclusiveminimumvalidation1boxedstring)
    boxed class to store validated String payloads | +| record | [ExclusiveminimumValidation.ExclusiveminimumValidation1BoxedList](#exclusiveminimumvalidation1boxedlist)
    boxed class to store validated List payloads | +| record | [ExclusiveminimumValidation.ExclusiveminimumValidation1BoxedMap](#exclusiveminimumvalidation1boxedmap)
    boxed class to store validated Map payloads | +| static class | [ExclusiveminimumValidation.ExclusiveminimumValidation1](#exclusiveminimumvalidation1)
    schema class | + +## ExclusiveminimumValidation1Boxed +sealed interface ExclusiveminimumValidation1Boxed
    +permits
    +[ExclusiveminimumValidation1BoxedVoid](#exclusiveminimumvalidation1boxedvoid), +[ExclusiveminimumValidation1BoxedBoolean](#exclusiveminimumvalidation1boxedboolean), +[ExclusiveminimumValidation1BoxedNumber](#exclusiveminimumvalidation1boxednumber), +[ExclusiveminimumValidation1BoxedString](#exclusiveminimumvalidation1boxedstring), +[ExclusiveminimumValidation1BoxedList](#exclusiveminimumvalidation1boxedlist), +[ExclusiveminimumValidation1BoxedMap](#exclusiveminimumvalidation1boxedmap) + +sealed interface that stores validated payloads using boxed classes + +## ExclusiveminimumValidation1BoxedVoid +data class ExclusiveminimumValidation1BoxedVoid
    +implements [ExclusiveminimumValidation1Boxed](#exclusiveminimumvalidation1boxed) + +data class that stores validated null payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| ExclusiveminimumValidation1BoxedVoid(Nothing? data)
    Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| Nothing? | data()
    validated payload | +| Any? | getData()
    validated payload | + +## ExclusiveminimumValidation1BoxedBoolean +data class ExclusiveminimumValidation1BoxedBoolean
    +implements [ExclusiveminimumValidation1Boxed](#exclusiveminimumvalidation1boxed) + +record that stores validated boolean payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| ExclusiveminimumValidation1BoxedBoolean(boolean data)
    Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| boolean | data()
    validated payload | +| Any? | getData()
    validated payload | + +## ExclusiveminimumValidation1BoxedNumber +data class ExclusiveminimumValidation1BoxedNumber
    +implements [ExclusiveminimumValidation1Boxed](#exclusiveminimumvalidation1boxed) + +data class that stores validated Number payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| ExclusiveminimumValidation1BoxedNumber(Number data)
    Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| Number | data()
    validated payload | +| Any? | getData()
    validated payload | + +## ExclusiveminimumValidation1BoxedString +data class ExclusiveminimumValidation1BoxedString
    +implements [ExclusiveminimumValidation1Boxed](#exclusiveminimumvalidation1boxed) + +data class that stores validated String payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| ExclusiveminimumValidation1BoxedString(String data)
    Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| String | data()
    validated payload | +| Any? | getData()
    validated payload | + +## ExclusiveminimumValidation1BoxedList +data class ExclusiveminimumValidation1BoxedList
    +implements [ExclusiveminimumValidation1Boxed](#exclusiveminimumvalidation1boxed) + +data class that stores validated List payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| ExclusiveminimumValidation1BoxedList(FrozenList data)
    Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| FrozenList | data()
    validated payload | +| Any? | getData()
    validated payload | + +## ExclusiveminimumValidation1BoxedMap +data class ExclusiveminimumValidation1BoxedMap
    +implements [ExclusiveminimumValidation1Boxed](#exclusiveminimumvalidation1boxed) + +data class that stores validated Map payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| ExclusiveminimumValidation1BoxedMap(FrozenMap data)
    Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| FrozenMap | data()
    validated payload | +| Any? | getData()
    validated payload | + +## ExclusiveminimumValidation1 +class ExclusiveminimumValidation1
    +extends JsonSchema + +A schema class that validates payloads + +### Field Summary +| Modifier and Type | Field and Description | +| ----------------- | ---------------------- | +| Number | exclusiveMinimum = 1.1 | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| String | validate(arg: String, configuration: SchemaConfiguration) | +| Nothing? | validate(arg: Nothing?, configuration: SchemaConfiguration) | +| int | validate(arg: int, configuration: SchemaConfiguration) | +| long | validate(arg: long, configuration: SchemaConfiguration) | +| float | validate(arg: float, configuration: SchemaConfiguration) | +| double | validate(arg: double, configuration: SchemaConfiguration) | +| Number | validate(arg: Number, configuration: SchemaConfiguration) | +| boolean | validate(arg: boolean, configuration: SchemaConfiguration) | +| FrozenMap | validate(arg: Map<?, ?>, configuration: SchemaConfiguration) | +| FrozenList | validate(arg: List<*>, configuration: SchemaConfiguration) | +| [ExclusiveminimumValidation1BoxedString](#exclusiveminimumvalidation1boxedstring) | validateAndBox(String, configuration: SchemaConfiguration) | +| [ExclusiveminimumValidation1BoxedVoid](#exclusiveminimumvalidation1boxedvoid) | validateAndBox(Nothing?, configuration: SchemaConfiguration) | +| [ExclusiveminimumValidation1BoxedNumber](#exclusiveminimumvalidation1boxednumber) | validateAndBox(Number, configuration: SchemaConfiguration) | +| [ExclusiveminimumValidation1BoxedBoolean](#exclusiveminimumvalidation1boxedboolean) | validateAndBox(boolean, configuration: SchemaConfiguration) | +| [ExclusiveminimumValidation1BoxedMap](#exclusiveminimumvalidation1boxedmap) | validateAndBox(Map<?, ?>, configuration: SchemaConfiguration) | +| [ExclusiveminimumValidation1BoxedList](#exclusiveminimumvalidation1boxedlist) | validateAndBox(List<*>, configuration: SchemaConfiguration) | +| [ExclusiveminimumValidation1Boxed](#exclusiveminimumvalidation1boxed) | validateAndBox(Any?, configuration: SchemaConfiguration) | +| Any? | validate(arg: Any?, configuration: SchemaConfiguration) | + +[[Back to top]](#top) [[Back to Component Schemas]](../../../README.md#Component-Schemas) [[Back to README]](../../../README.md) diff --git a/samples/client/3_1_0_unit_test/kotlin/docs/components/schemas/FloatDivisionInf.md b/samples/client/3_1_0_unit_test/kotlin/docs/components/schemas/FloatDivisionInf.md new file mode 100644 index 00000000000..e7135dd2f87 --- /dev/null +++ b/samples/client/3_1_0_unit_test/kotlin/docs/components/schemas/FloatDivisionInf.md @@ -0,0 +1,85 @@ +# FloatDivisionInf +org.openapijsonschematools.client.components.schemas.FloatDivisionInf.java +class FloatDivisionInf
    + +A class that contains necessary nested +- schema classes (which validate payloads), extends JsonSchema +- sealed interfaces which store validated payloads, Kotlin version of a sum type +- boxed classes which store validated payloads, sealed permits class implementations + +## Nested Class Summary +| Modifier and Type | Class and Description | +| ----------------- | ---------------------- | +| sealed interface | [FloatDivisionInf.FloatDivisionInf1Boxed](#floatdivisioninf1boxed)
    sealed interface for validated payloads | +| record | [FloatDivisionInf.FloatDivisionInf1BoxedNumber](#floatdivisioninf1boxednumber)
    boxed class to store validated Number payloads | +| static class | [FloatDivisionInf.FloatDivisionInf1](#floatdivisioninf1)
    schema class | + +## FloatDivisionInf1Boxed +sealed interface FloatDivisionInf1Boxed
    +permits
    +[FloatDivisionInf1BoxedNumber](#floatdivisioninf1boxednumber) + +sealed interface that stores validated payloads using boxed classes + +## FloatDivisionInf1BoxedNumber +data class FloatDivisionInf1BoxedNumber
    +implements [FloatDivisionInf1Boxed](#floatdivisioninf1boxed) + +data class that stores validated Number payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| FloatDivisionInf1BoxedNumber(Number data)
    Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| Number | data()
    validated payload | +| Any? | getData()
    validated payload | + +## FloatDivisionInf1 +class FloatDivisionInf1
    +extends JsonSchema + +A schema class that validates payloads + +### Code Sample +``` +import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags; +import org.openapijsonschematools.client.configurations.SchemaConfiguration; +import org.openapijsonschematools.client.exceptions.ValidationException; +import org.openapijsonschematools.client.schemas.validation.MapUtils; +import org.openapijsonschematools.client.schemas.validation.FrozenList; +import org.openapijsonschematools.client.schemas.validation.FrozenMap; +import org.openapijsonschematools.client.components.schemas.FloatDivisionInf; + +import java.util.Arrays; +import java.util.List; +import java.util.AbstractMap; + +static final SchemaConfiguration configuration = new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().build()); + +// int validation +int validatedPayload = FloatDivisionInf.FloatDivisionInf1.validate( + 1L, + configuration +); +``` + +### Field Summary +| Modifier and Type | Field and Description | +| ----------------- | ---------------------- | +| Set> | type = setOf(
        Int::class.java,
        Long::class.java,
        Float::class.java,
        Double::class.java
    )
    | +| String | type = "int"; | +| BigDecimal | multipleOf = BigDecimal("0.123456789") | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| long | validate(arg: long, configuration: SchemaConfiguration) | +| [FloatDivisionInf1BoxedNumber](#floatdivisioninf1boxednumber) | validateAndBox(Number, configuration: SchemaConfiguration) | +| [FloatDivisionInf1Boxed](#floatdivisioninf1boxed) | validateAndBox(Any?, configuration: SchemaConfiguration) | +| Any? | validate(arg: Any?, configuration: SchemaConfiguration) | + +[[Back to top]](#top) [[Back to Component Schemas]](../../../README.md#Component-Schemas) [[Back to README]](../../../README.md) diff --git a/samples/client/3_1_0_unit_test/kotlin/docs/components/schemas/ForbiddenProperty.md b/samples/client/3_1_0_unit_test/kotlin/docs/components/schemas/ForbiddenProperty.md new file mode 100644 index 00000000000..e36ce2a34e8 --- /dev/null +++ b/samples/client/3_1_0_unit_test/kotlin/docs/components/schemas/ForbiddenProperty.md @@ -0,0 +1,508 @@ +# ForbiddenProperty +org.openapijsonschematools.client.components.schemas.ForbiddenProperty.java +class ForbiddenProperty
    + +A class that contains necessary nested +- schema classes (which validate payloads), extends JsonSchema +- sealed interfaces which store validated payloads, Kotlin version of a sum type +- boxed classes which store validated payloads, sealed permits class implementations +- classes to store validated map payloads, extends FrozenMap +- classes to build inputs for map payloads + +## Nested Class Summary +| Modifier and Type | Class and Description | +| ----------------- | ---------------------- | +| sealed interface | [ForbiddenProperty.ForbiddenProperty1Boxed](#forbiddenproperty1boxed)
    sealed interface for validated payloads | +| record | [ForbiddenProperty.ForbiddenProperty1BoxedVoid](#forbiddenproperty1boxedvoid)
    boxed class to store validated null payloads | +| record | [ForbiddenProperty.ForbiddenProperty1BoxedBoolean](#forbiddenproperty1boxedboolean)
    boxed class to store validated boolean payloads | +| record | [ForbiddenProperty.ForbiddenProperty1BoxedNumber](#forbiddenproperty1boxednumber)
    boxed class to store validated Number payloads | +| record | [ForbiddenProperty.ForbiddenProperty1BoxedString](#forbiddenproperty1boxedstring)
    boxed class to store validated String payloads | +| record | [ForbiddenProperty.ForbiddenProperty1BoxedList](#forbiddenproperty1boxedlist)
    boxed class to store validated List payloads | +| record | [ForbiddenProperty.ForbiddenProperty1BoxedMap](#forbiddenproperty1boxedmap)
    boxed class to store validated Map payloads | +| static class | [ForbiddenProperty.ForbiddenProperty1](#forbiddenproperty1)
    schema class | +| static class | [ForbiddenProperty.ForbiddenPropertyMapBuilder](#forbiddenpropertymapbuilder)
    builder for Map payloads | +| static class | [ForbiddenProperty.ForbiddenPropertyMap](#forbiddenpropertymap)
    output class for Map payloads | +| sealed interface | [ForbiddenProperty.FooBoxed](#fooboxed)
    sealed interface for validated payloads | +| record | [ForbiddenProperty.FooBoxedVoid](#fooboxedvoid)
    boxed class to store validated null payloads | +| record | [ForbiddenProperty.FooBoxedBoolean](#fooboxedboolean)
    boxed class to store validated boolean payloads | +| record | [ForbiddenProperty.FooBoxedNumber](#fooboxednumber)
    boxed class to store validated Number payloads | +| record | [ForbiddenProperty.FooBoxedString](#fooboxedstring)
    boxed class to store validated String payloads | +| record | [ForbiddenProperty.FooBoxedList](#fooboxedlist)
    boxed class to store validated List payloads | +| record | [ForbiddenProperty.FooBoxedMap](#fooboxedmap)
    boxed class to store validated Map payloads | +| static class | [ForbiddenProperty.Foo](#foo)
    schema class | +| sealed interface | [ForbiddenProperty.NotBoxed](#notboxed)
    sealed interface for validated payloads | +| record | [ForbiddenProperty.NotBoxedVoid](#notboxedvoid)
    boxed class to store validated null payloads | +| record | [ForbiddenProperty.NotBoxedBoolean](#notboxedboolean)
    boxed class to store validated boolean payloads | +| record | [ForbiddenProperty.NotBoxedNumber](#notboxednumber)
    boxed class to store validated Number payloads | +| record | [ForbiddenProperty.NotBoxedString](#notboxedstring)
    boxed class to store validated String payloads | +| record | [ForbiddenProperty.NotBoxedList](#notboxedlist)
    boxed class to store validated List payloads | +| record | [ForbiddenProperty.NotBoxedMap](#notboxedmap)
    boxed class to store validated Map payloads | +| static class | [ForbiddenProperty.Not](#not)
    schema class | + +## ForbiddenProperty1Boxed +sealed interface ForbiddenProperty1Boxed
    +permits
    +[ForbiddenProperty1BoxedVoid](#forbiddenproperty1boxedvoid), +[ForbiddenProperty1BoxedBoolean](#forbiddenproperty1boxedboolean), +[ForbiddenProperty1BoxedNumber](#forbiddenproperty1boxednumber), +[ForbiddenProperty1BoxedString](#forbiddenproperty1boxedstring), +[ForbiddenProperty1BoxedList](#forbiddenproperty1boxedlist), +[ForbiddenProperty1BoxedMap](#forbiddenproperty1boxedmap) + +sealed interface that stores validated payloads using boxed classes + +## ForbiddenProperty1BoxedVoid +data class ForbiddenProperty1BoxedVoid
    +implements [ForbiddenProperty1Boxed](#forbiddenproperty1boxed) + +data class that stores validated null payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| ForbiddenProperty1BoxedVoid(Nothing? data)
    Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| Nothing? | data()
    validated payload | +| Any? | getData()
    validated payload | + +## ForbiddenProperty1BoxedBoolean +data class ForbiddenProperty1BoxedBoolean
    +implements [ForbiddenProperty1Boxed](#forbiddenproperty1boxed) + +record that stores validated boolean payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| ForbiddenProperty1BoxedBoolean(boolean data)
    Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| boolean | data()
    validated payload | +| Any? | getData()
    validated payload | + +## ForbiddenProperty1BoxedNumber +data class ForbiddenProperty1BoxedNumber
    +implements [ForbiddenProperty1Boxed](#forbiddenproperty1boxed) + +data class that stores validated Number payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| ForbiddenProperty1BoxedNumber(Number data)
    Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| Number | data()
    validated payload | +| Any? | getData()
    validated payload | + +## ForbiddenProperty1BoxedString +data class ForbiddenProperty1BoxedString
    +implements [ForbiddenProperty1Boxed](#forbiddenproperty1boxed) + +data class that stores validated String payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| ForbiddenProperty1BoxedString(String data)
    Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| String | data()
    validated payload | +| Any? | getData()
    validated payload | + +## ForbiddenProperty1BoxedList +data class ForbiddenProperty1BoxedList
    +implements [ForbiddenProperty1Boxed](#forbiddenproperty1boxed) + +data class that stores validated List payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| ForbiddenProperty1BoxedList(FrozenList data)
    Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| FrozenList | data()
    validated payload | +| Any? | getData()
    validated payload | + +## ForbiddenProperty1BoxedMap +data class ForbiddenProperty1BoxedMap
    +implements [ForbiddenProperty1Boxed](#forbiddenproperty1boxed) + +data class that stores validated Map payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| ForbiddenProperty1BoxedMap([ForbiddenPropertyMap](#forbiddenpropertymap) data)
    Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| [ForbiddenPropertyMap](#forbiddenpropertymap) | data()
    validated payload | +| Any? | getData()
    validated payload | + +## ForbiddenProperty1 +class ForbiddenProperty1
    +extends JsonSchema + +A schema class that validates payloads + +### Field Summary +| Modifier and Type | Field and Description | +| ----------------- | ---------------------- | +| Map> | properties = mapOf(
        "foo" to [Foo::class.java](#foo))
    )
    | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| String | validate(arg: String, configuration: SchemaConfiguration) | +| Nothing? | validate(arg: Nothing?, configuration: SchemaConfiguration) | +| int | validate(arg: int, configuration: SchemaConfiguration) | +| long | validate(arg: long, configuration: SchemaConfiguration) | +| float | validate(arg: float, configuration: SchemaConfiguration) | +| double | validate(arg: double, configuration: SchemaConfiguration) | +| Number | validate(arg: Number, configuration: SchemaConfiguration) | +| boolean | validate(arg: boolean, configuration: SchemaConfiguration) | +| [ForbiddenPropertyMap](#forbiddenpropertymap) | validate(arg: [Map<?, ?>](#forbiddenpropertymapbuilder), configuration: SchemaConfiguration) | +| FrozenList | validate(arg: List<*>, configuration: SchemaConfiguration) | +| [ForbiddenProperty1BoxedString](#forbiddenproperty1boxedstring) | validateAndBox(String, configuration: SchemaConfiguration) | +| [ForbiddenProperty1BoxedVoid](#forbiddenproperty1boxedvoid) | validateAndBox(Nothing?, configuration: SchemaConfiguration) | +| [ForbiddenProperty1BoxedNumber](#forbiddenproperty1boxednumber) | validateAndBox(Number, configuration: SchemaConfiguration) | +| [ForbiddenProperty1BoxedBoolean](#forbiddenproperty1boxedboolean) | validateAndBox(boolean, configuration: SchemaConfiguration) | +| [ForbiddenProperty1BoxedMap](#forbiddenproperty1boxedmap) | validateAndBox([Map<?, ?>](#forbiddenpropertymapbuilder), configuration: SchemaConfiguration) | +| [ForbiddenProperty1BoxedList](#forbiddenproperty1boxedlist) | validateAndBox(List<*>, configuration: SchemaConfiguration) | +| [ForbiddenProperty1Boxed](#forbiddenproperty1boxed) | validateAndBox(Any?, configuration: SchemaConfiguration) | +| Any? | validate(arg: Any?, configuration: SchemaConfiguration) | + +## ForbiddenPropertyMapBuilder +class ForbiddenPropertyMapBuilder
    +builder for `Map` + +A class that builds the Map input type + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| ForbiddenPropertyMapBuilder()
    Creates a builder that contains an empty map | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| Map | build()
    Returns map input that should be used with Schema.validate | +| [ForbiddenPropertyMapBuilder](#forbiddenpropertymapbuilder) | foo(value: Nothing?) | +| [ForbiddenPropertyMapBuilder](#forbiddenpropertymapbuilder) | foo(value: Boolean) | +| [ForbiddenPropertyMapBuilder](#forbiddenpropertymapbuilder) | foo(value: String) | +| [ForbiddenPropertyMapBuilder](#forbiddenpropertymapbuilder) | foo(value: Int) | +| [ForbiddenPropertyMapBuilder](#forbiddenpropertymapbuilder) | foo(value: Float) | +| [ForbiddenPropertyMapBuilder](#forbiddenpropertymapbuilder) | foo(value: Long) | +| [ForbiddenPropertyMapBuilder](#forbiddenpropertymapbuilder) | foo(value: Double) | +| [ForbiddenPropertyMapBuilder](#forbiddenpropertymapbuilder) | foo(value: List) | +| [ForbiddenPropertyMapBuilder](#forbiddenpropertymapbuilder) | foo(value: Map) | +| [ForbiddenPropertyMapBuilder](#forbiddenpropertymapbuilder) | additionalProperty(key: String, value: Nothing?) | +| [ForbiddenPropertyMapBuilder](#forbiddenpropertymapbuilder) | additionalProperty(key: String, value: Boolean) | +| [ForbiddenPropertyMapBuilder](#forbiddenpropertymapbuilder) | additionalProperty(key: String, value: String) | +| [ForbiddenPropertyMapBuilder](#forbiddenpropertymapbuilder) | additionalProperty(key: String, value: Int) | +| [ForbiddenPropertyMapBuilder](#forbiddenpropertymapbuilder) | additionalProperty(key: String, value: Float) | +| [ForbiddenPropertyMapBuilder](#forbiddenpropertymapbuilder) | additionalProperty(key: String, value: Long) | +| [ForbiddenPropertyMapBuilder](#forbiddenpropertymapbuilder) | additionalProperty(key: String, value: Double) | +| [ForbiddenPropertyMapBuilder](#forbiddenpropertymapbuilder) | additionalProperty(key: String, value: List) | +| [ForbiddenPropertyMapBuilder](#forbiddenpropertymapbuilder) | additionalProperty(key: String, value: Map) | + +## ForbiddenPropertyMap +class ForbiddenPropertyMap
    +extends FrozenMap + +A class to store validated Map payloads + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| static [ForbiddenPropertyMap](#forbiddenpropertymap) | of([Map](#forbiddenpropertymapbuilder) arg, SchemaConfiguration configuration) | +| Any? | foo()
    [optional] | +| Any? | getAdditionalProperty(String name)
    provides type safety for additional properties | + +## FooBoxed +sealed interface FooBoxed
    +permits
    +[FooBoxedVoid](#fooboxedvoid), +[FooBoxedBoolean](#fooboxedboolean), +[FooBoxedNumber](#fooboxednumber), +[FooBoxedString](#fooboxedstring), +[FooBoxedList](#fooboxedlist), +[FooBoxedMap](#fooboxedmap) + +sealed interface that stores validated payloads using boxed classes + +## FooBoxedVoid +data class FooBoxedVoid
    +implements [FooBoxed](#fooboxed) + +data class that stores validated null payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| FooBoxedVoid(Nothing? data)
    Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| Nothing? | data()
    validated payload | +| Any? | getData()
    validated payload | + +## FooBoxedBoolean +data class FooBoxedBoolean
    +implements [FooBoxed](#fooboxed) + +record that stores validated boolean payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| FooBoxedBoolean(boolean data)
    Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| boolean | data()
    validated payload | +| Any? | getData()
    validated payload | + +## FooBoxedNumber +data class FooBoxedNumber
    +implements [FooBoxed](#fooboxed) + +data class that stores validated Number payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| FooBoxedNumber(Number data)
    Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| Number | data()
    validated payload | +| Any? | getData()
    validated payload | + +## FooBoxedString +data class FooBoxedString
    +implements [FooBoxed](#fooboxed) + +data class that stores validated String payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| FooBoxedString(String data)
    Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| String | data()
    validated payload | +| Any? | getData()
    validated payload | + +## FooBoxedList +data class FooBoxedList
    +implements [FooBoxed](#fooboxed) + +data class that stores validated List payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| FooBoxedList(FrozenList data)
    Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| FrozenList | data()
    validated payload | +| Any? | getData()
    validated payload | + +## FooBoxedMap +data class FooBoxedMap
    +implements [FooBoxed](#fooboxed) + +data class that stores validated Map payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| FooBoxedMap(FrozenMap data)
    Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| FrozenMap | data()
    validated payload | +| Any? | getData()
    validated payload | + +## Foo +class Foo
    +extends JsonSchema + +A schema class that validates payloads + +### Field Summary +| Modifier and Type | Field and Description | +| ----------------- | ---------------------- | +| Class | not = [Not::class.java](#not) | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| String | validate(arg: String, configuration: SchemaConfiguration) | +| Nothing? | validate(arg: Nothing?, configuration: SchemaConfiguration) | +| int | validate(arg: int, configuration: SchemaConfiguration) | +| long | validate(arg: long, configuration: SchemaConfiguration) | +| float | validate(arg: float, configuration: SchemaConfiguration) | +| double | validate(arg: double, configuration: SchemaConfiguration) | +| Number | validate(arg: Number, configuration: SchemaConfiguration) | +| boolean | validate(arg: boolean, configuration: SchemaConfiguration) | +| FrozenMap | validate(arg: Map<?, ?>, configuration: SchemaConfiguration) | +| FrozenList | validate(arg: List<*>, configuration: SchemaConfiguration) | +| [FooBoxedString](#fooboxedstring) | validateAndBox(String, configuration: SchemaConfiguration) | +| [FooBoxedVoid](#fooboxedvoid) | validateAndBox(Nothing?, configuration: SchemaConfiguration) | +| [FooBoxedNumber](#fooboxednumber) | validateAndBox(Number, configuration: SchemaConfiguration) | +| [FooBoxedBoolean](#fooboxedboolean) | validateAndBox(boolean, configuration: SchemaConfiguration) | +| [FooBoxedMap](#fooboxedmap) | validateAndBox(Map<?, ?>, configuration: SchemaConfiguration) | +| [FooBoxedList](#fooboxedlist) | validateAndBox(List<*>, configuration: SchemaConfiguration) | +| [FooBoxed](#fooboxed) | validateAndBox(Any?, configuration: SchemaConfiguration) | +| Any? | validate(arg: Any?, configuration: SchemaConfiguration) | + +## NotBoxed +sealed interface NotBoxed
    +permits
    +[NotBoxedVoid](#notboxedvoid), +[NotBoxedBoolean](#notboxedboolean), +[NotBoxedNumber](#notboxednumber), +[NotBoxedString](#notboxedstring), +[NotBoxedList](#notboxedlist), +[NotBoxedMap](#notboxedmap) + +sealed interface that stores validated payloads using boxed classes + +## NotBoxedVoid +data class NotBoxedVoid
    +implements [NotBoxed](#notboxed) + +data class that stores validated null payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| NotBoxedVoid(Nothing? data)
    Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| Nothing? | data()
    validated payload | +| Any? | getData()
    validated payload | + +## NotBoxedBoolean +data class NotBoxedBoolean
    +implements [NotBoxed](#notboxed) + +record that stores validated boolean payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| NotBoxedBoolean(boolean data)
    Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| boolean | data()
    validated payload | +| Any? | getData()
    validated payload | + +## NotBoxedNumber +data class NotBoxedNumber
    +implements [NotBoxed](#notboxed) + +data class that stores validated Number payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| NotBoxedNumber(Number data)
    Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| Number | data()
    validated payload | +| Any? | getData()
    validated payload | + +## NotBoxedString +data class NotBoxedString
    +implements [NotBoxed](#notboxed) + +data class that stores validated String payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| NotBoxedString(String data)
    Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| String | data()
    validated payload | +| Any? | getData()
    validated payload | + +## NotBoxedList +data class NotBoxedList
    +implements [NotBoxed](#notboxed) + +data class that stores validated List payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| NotBoxedList(FrozenList data)
    Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| FrozenList | data()
    validated payload | +| Any? | getData()
    validated payload | + +## NotBoxedMap +data class NotBoxedMap
    +implements [NotBoxed](#notboxed) + +data class that stores validated Map payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| NotBoxedMap(FrozenMap data)
    Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| FrozenMap | data()
    validated payload | +| Any? | getData()
    validated payload | + +## Not +class Not
    +extends AnyTypeJsonSchema.AnyTypeJsonSchema1 + +A schema class that validates payloads + +| Methods Inherited from class org.openapijsonschematools.client.schemas.AnyTypeJsonSchema.AnyTypeJsonSchema1 | +| ------------------------------------------------------------------ | +| validate | +| validateAndBox | + +[[Back to top]](#top) [[Back to Component Schemas]](../../../README.md#Component-Schemas) [[Back to README]](../../../README.md) diff --git a/samples/client/3_1_0_unit_test/kotlin/docs/components/schemas/HostnameFormat.md b/samples/client/3_1_0_unit_test/kotlin/docs/components/schemas/HostnameFormat.md new file mode 100644 index 00000000000..9bfb2c2b465 --- /dev/null +++ b/samples/client/3_1_0_unit_test/kotlin/docs/components/schemas/HostnameFormat.md @@ -0,0 +1,169 @@ +# HostnameFormat +org.openapijsonschematools.client.components.schemas.HostnameFormat.java +class HostnameFormat
    + +A class that contains necessary nested +- schema classes (which validate payloads), extends JsonSchema +- sealed interfaces which store validated payloads, Kotlin version of a sum type +- boxed classes which store validated payloads, sealed permits class implementations + +## Nested Class Summary +| Modifier and Type | Class and Description | +| ----------------- | ---------------------- | +| sealed interface | [HostnameFormat.HostnameFormat1Boxed](#hostnameformat1boxed)
    sealed interface for validated payloads | +| record | [HostnameFormat.HostnameFormat1BoxedVoid](#hostnameformat1boxedvoid)
    boxed class to store validated null payloads | +| record | [HostnameFormat.HostnameFormat1BoxedBoolean](#hostnameformat1boxedboolean)
    boxed class to store validated boolean payloads | +| record | [HostnameFormat.HostnameFormat1BoxedNumber](#hostnameformat1boxednumber)
    boxed class to store validated Number payloads | +| record | [HostnameFormat.HostnameFormat1BoxedString](#hostnameformat1boxedstring)
    boxed class to store validated String payloads | +| record | [HostnameFormat.HostnameFormat1BoxedList](#hostnameformat1boxedlist)
    boxed class to store validated List payloads | +| record | [HostnameFormat.HostnameFormat1BoxedMap](#hostnameformat1boxedmap)
    boxed class to store validated Map payloads | +| static class | [HostnameFormat.HostnameFormat1](#hostnameformat1)
    schema class | + +## HostnameFormat1Boxed +sealed interface HostnameFormat1Boxed
    +permits
    +[HostnameFormat1BoxedVoid](#hostnameformat1boxedvoid), +[HostnameFormat1BoxedBoolean](#hostnameformat1boxedboolean), +[HostnameFormat1BoxedNumber](#hostnameformat1boxednumber), +[HostnameFormat1BoxedString](#hostnameformat1boxedstring), +[HostnameFormat1BoxedList](#hostnameformat1boxedlist), +[HostnameFormat1BoxedMap](#hostnameformat1boxedmap) + +sealed interface that stores validated payloads using boxed classes + +## HostnameFormat1BoxedVoid +data class HostnameFormat1BoxedVoid
    +implements [HostnameFormat1Boxed](#hostnameformat1boxed) + +data class that stores validated null payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| HostnameFormat1BoxedVoid(Nothing? data)
    Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| Nothing? | data()
    validated payload | +| Any? | getData()
    validated payload | + +## HostnameFormat1BoxedBoolean +data class HostnameFormat1BoxedBoolean
    +implements [HostnameFormat1Boxed](#hostnameformat1boxed) + +record that stores validated boolean payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| HostnameFormat1BoxedBoolean(boolean data)
    Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| boolean | data()
    validated payload | +| Any? | getData()
    validated payload | + +## HostnameFormat1BoxedNumber +data class HostnameFormat1BoxedNumber
    +implements [HostnameFormat1Boxed](#hostnameformat1boxed) + +data class that stores validated Number payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| HostnameFormat1BoxedNumber(Number data)
    Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| Number | data()
    validated payload | +| Any? | getData()
    validated payload | + +## HostnameFormat1BoxedString +data class HostnameFormat1BoxedString
    +implements [HostnameFormat1Boxed](#hostnameformat1boxed) + +data class that stores validated String payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| HostnameFormat1BoxedString(String data)
    Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| String | data()
    validated payload | +| Any? | getData()
    validated payload | + +## HostnameFormat1BoxedList +data class HostnameFormat1BoxedList
    +implements [HostnameFormat1Boxed](#hostnameformat1boxed) + +data class that stores validated List payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| HostnameFormat1BoxedList(FrozenList data)
    Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| FrozenList | data()
    validated payload | +| Any? | getData()
    validated payload | + +## HostnameFormat1BoxedMap +data class HostnameFormat1BoxedMap
    +implements [HostnameFormat1Boxed](#hostnameformat1boxed) + +data class that stores validated Map payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| HostnameFormat1BoxedMap(FrozenMap data)
    Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| FrozenMap | data()
    validated payload | +| Any? | getData()
    validated payload | + +## HostnameFormat1 +class HostnameFormat1
    +extends JsonSchema + +A schema class that validates payloads + +### Field Summary +| Modifier and Type | Field and Description | +| ----------------- | ---------------------- | +| String | type = "hostname"; | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| String | validate(arg: String, configuration: SchemaConfiguration) | +| Nothing? | validate(arg: Nothing?, configuration: SchemaConfiguration) | +| int | validate(arg: int, configuration: SchemaConfiguration) | +| long | validate(arg: long, configuration: SchemaConfiguration) | +| float | validate(arg: float, configuration: SchemaConfiguration) | +| double | validate(arg: double, configuration: SchemaConfiguration) | +| Number | validate(arg: Number, configuration: SchemaConfiguration) | +| boolean | validate(arg: boolean, configuration: SchemaConfiguration) | +| FrozenMap | validate(arg: Map<?, ?>, configuration: SchemaConfiguration) | +| FrozenList | validate(arg: List<*>, configuration: SchemaConfiguration) | +| [HostnameFormat1BoxedString](#hostnameformat1boxedstring) | validateAndBox(String, configuration: SchemaConfiguration) | +| [HostnameFormat1BoxedVoid](#hostnameformat1boxedvoid) | validateAndBox(Nothing?, configuration: SchemaConfiguration) | +| [HostnameFormat1BoxedNumber](#hostnameformat1boxednumber) | validateAndBox(Number, configuration: SchemaConfiguration) | +| [HostnameFormat1BoxedBoolean](#hostnameformat1boxedboolean) | validateAndBox(boolean, configuration: SchemaConfiguration) | +| [HostnameFormat1BoxedMap](#hostnameformat1boxedmap) | validateAndBox(Map<?, ?>, configuration: SchemaConfiguration) | +| [HostnameFormat1BoxedList](#hostnameformat1boxedlist) | validateAndBox(List<*>, configuration: SchemaConfiguration) | +| [HostnameFormat1Boxed](#hostnameformat1boxed) | validateAndBox(Any?, configuration: SchemaConfiguration) | +| Any? | validate(arg: Any?, configuration: SchemaConfiguration) | + +[[Back to top]](#top) [[Back to Component Schemas]](../../../README.md#Component-Schemas) [[Back to README]](../../../README.md) diff --git a/samples/client/3_1_0_unit_test/kotlin/docs/components/schemas/IdnEmailFormat.md b/samples/client/3_1_0_unit_test/kotlin/docs/components/schemas/IdnEmailFormat.md new file mode 100644 index 00000000000..697c25e4a13 --- /dev/null +++ b/samples/client/3_1_0_unit_test/kotlin/docs/components/schemas/IdnEmailFormat.md @@ -0,0 +1,169 @@ +# IdnEmailFormat +org.openapijsonschematools.client.components.schemas.IdnEmailFormat.java +class IdnEmailFormat
    + +A class that contains necessary nested +- schema classes (which validate payloads), extends JsonSchema +- sealed interfaces which store validated payloads, Kotlin version of a sum type +- boxed classes which store validated payloads, sealed permits class implementations + +## Nested Class Summary +| Modifier and Type | Class and Description | +| ----------------- | ---------------------- | +| sealed interface | [IdnEmailFormat.IdnEmailFormat1Boxed](#idnemailformat1boxed)
    sealed interface for validated payloads | +| record | [IdnEmailFormat.IdnEmailFormat1BoxedVoid](#idnemailformat1boxedvoid)
    boxed class to store validated null payloads | +| record | [IdnEmailFormat.IdnEmailFormat1BoxedBoolean](#idnemailformat1boxedboolean)
    boxed class to store validated boolean payloads | +| record | [IdnEmailFormat.IdnEmailFormat1BoxedNumber](#idnemailformat1boxednumber)
    boxed class to store validated Number payloads | +| record | [IdnEmailFormat.IdnEmailFormat1BoxedString](#idnemailformat1boxedstring)
    boxed class to store validated String payloads | +| record | [IdnEmailFormat.IdnEmailFormat1BoxedList](#idnemailformat1boxedlist)
    boxed class to store validated List payloads | +| record | [IdnEmailFormat.IdnEmailFormat1BoxedMap](#idnemailformat1boxedmap)
    boxed class to store validated Map payloads | +| static class | [IdnEmailFormat.IdnEmailFormat1](#idnemailformat1)
    schema class | + +## IdnEmailFormat1Boxed +sealed interface IdnEmailFormat1Boxed
    +permits
    +[IdnEmailFormat1BoxedVoid](#idnemailformat1boxedvoid), +[IdnEmailFormat1BoxedBoolean](#idnemailformat1boxedboolean), +[IdnEmailFormat1BoxedNumber](#idnemailformat1boxednumber), +[IdnEmailFormat1BoxedString](#idnemailformat1boxedstring), +[IdnEmailFormat1BoxedList](#idnemailformat1boxedlist), +[IdnEmailFormat1BoxedMap](#idnemailformat1boxedmap) + +sealed interface that stores validated payloads using boxed classes + +## IdnEmailFormat1BoxedVoid +data class IdnEmailFormat1BoxedVoid
    +implements [IdnEmailFormat1Boxed](#idnemailformat1boxed) + +data class that stores validated null payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| IdnEmailFormat1BoxedVoid(Nothing? data)
    Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| Nothing? | data()
    validated payload | +| Any? | getData()
    validated payload | + +## IdnEmailFormat1BoxedBoolean +data class IdnEmailFormat1BoxedBoolean
    +implements [IdnEmailFormat1Boxed](#idnemailformat1boxed) + +record that stores validated boolean payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| IdnEmailFormat1BoxedBoolean(boolean data)
    Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| boolean | data()
    validated payload | +| Any? | getData()
    validated payload | + +## IdnEmailFormat1BoxedNumber +data class IdnEmailFormat1BoxedNumber
    +implements [IdnEmailFormat1Boxed](#idnemailformat1boxed) + +data class that stores validated Number payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| IdnEmailFormat1BoxedNumber(Number data)
    Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| Number | data()
    validated payload | +| Any? | getData()
    validated payload | + +## IdnEmailFormat1BoxedString +data class IdnEmailFormat1BoxedString
    +implements [IdnEmailFormat1Boxed](#idnemailformat1boxed) + +data class that stores validated String payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| IdnEmailFormat1BoxedString(String data)
    Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| String | data()
    validated payload | +| Any? | getData()
    validated payload | + +## IdnEmailFormat1BoxedList +data class IdnEmailFormat1BoxedList
    +implements [IdnEmailFormat1Boxed](#idnemailformat1boxed) + +data class that stores validated List payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| IdnEmailFormat1BoxedList(FrozenList data)
    Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| FrozenList | data()
    validated payload | +| Any? | getData()
    validated payload | + +## IdnEmailFormat1BoxedMap +data class IdnEmailFormat1BoxedMap
    +implements [IdnEmailFormat1Boxed](#idnemailformat1boxed) + +data class that stores validated Map payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| IdnEmailFormat1BoxedMap(FrozenMap data)
    Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| FrozenMap | data()
    validated payload | +| Any? | getData()
    validated payload | + +## IdnEmailFormat1 +class IdnEmailFormat1
    +extends JsonSchema + +A schema class that validates payloads + +### Field Summary +| Modifier and Type | Field and Description | +| ----------------- | ---------------------- | +| String | type = "idn-email"; | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| String | validate(arg: String, configuration: SchemaConfiguration) | +| Nothing? | validate(arg: Nothing?, configuration: SchemaConfiguration) | +| int | validate(arg: int, configuration: SchemaConfiguration) | +| long | validate(arg: long, configuration: SchemaConfiguration) | +| float | validate(arg: float, configuration: SchemaConfiguration) | +| double | validate(arg: double, configuration: SchemaConfiguration) | +| Number | validate(arg: Number, configuration: SchemaConfiguration) | +| boolean | validate(arg: boolean, configuration: SchemaConfiguration) | +| FrozenMap | validate(arg: Map<?, ?>, configuration: SchemaConfiguration) | +| FrozenList | validate(arg: List<*>, configuration: SchemaConfiguration) | +| [IdnEmailFormat1BoxedString](#idnemailformat1boxedstring) | validateAndBox(String, configuration: SchemaConfiguration) | +| [IdnEmailFormat1BoxedVoid](#idnemailformat1boxedvoid) | validateAndBox(Nothing?, configuration: SchemaConfiguration) | +| [IdnEmailFormat1BoxedNumber](#idnemailformat1boxednumber) | validateAndBox(Number, configuration: SchemaConfiguration) | +| [IdnEmailFormat1BoxedBoolean](#idnemailformat1boxedboolean) | validateAndBox(boolean, configuration: SchemaConfiguration) | +| [IdnEmailFormat1BoxedMap](#idnemailformat1boxedmap) | validateAndBox(Map<?, ?>, configuration: SchemaConfiguration) | +| [IdnEmailFormat1BoxedList](#idnemailformat1boxedlist) | validateAndBox(List<*>, configuration: SchemaConfiguration) | +| [IdnEmailFormat1Boxed](#idnemailformat1boxed) | validateAndBox(Any?, configuration: SchemaConfiguration) | +| Any? | validate(arg: Any?, configuration: SchemaConfiguration) | + +[[Back to top]](#top) [[Back to Component Schemas]](../../../README.md#Component-Schemas) [[Back to README]](../../../README.md) diff --git a/samples/client/3_1_0_unit_test/kotlin/docs/components/schemas/IdnHostnameFormat.md b/samples/client/3_1_0_unit_test/kotlin/docs/components/schemas/IdnHostnameFormat.md new file mode 100644 index 00000000000..432027c74d7 --- /dev/null +++ b/samples/client/3_1_0_unit_test/kotlin/docs/components/schemas/IdnHostnameFormat.md @@ -0,0 +1,169 @@ +# IdnHostnameFormat +org.openapijsonschematools.client.components.schemas.IdnHostnameFormat.java +class IdnHostnameFormat
    + +A class that contains necessary nested +- schema classes (which validate payloads), extends JsonSchema +- sealed interfaces which store validated payloads, Kotlin version of a sum type +- boxed classes which store validated payloads, sealed permits class implementations + +## Nested Class Summary +| Modifier and Type | Class and Description | +| ----------------- | ---------------------- | +| sealed interface | [IdnHostnameFormat.IdnHostnameFormat1Boxed](#idnhostnameformat1boxed)
    sealed interface for validated payloads | +| record | [IdnHostnameFormat.IdnHostnameFormat1BoxedVoid](#idnhostnameformat1boxedvoid)
    boxed class to store validated null payloads | +| record | [IdnHostnameFormat.IdnHostnameFormat1BoxedBoolean](#idnhostnameformat1boxedboolean)
    boxed class to store validated boolean payloads | +| record | [IdnHostnameFormat.IdnHostnameFormat1BoxedNumber](#idnhostnameformat1boxednumber)
    boxed class to store validated Number payloads | +| record | [IdnHostnameFormat.IdnHostnameFormat1BoxedString](#idnhostnameformat1boxedstring)
    boxed class to store validated String payloads | +| record | [IdnHostnameFormat.IdnHostnameFormat1BoxedList](#idnhostnameformat1boxedlist)
    boxed class to store validated List payloads | +| record | [IdnHostnameFormat.IdnHostnameFormat1BoxedMap](#idnhostnameformat1boxedmap)
    boxed class to store validated Map payloads | +| static class | [IdnHostnameFormat.IdnHostnameFormat1](#idnhostnameformat1)
    schema class | + +## IdnHostnameFormat1Boxed +sealed interface IdnHostnameFormat1Boxed
    +permits
    +[IdnHostnameFormat1BoxedVoid](#idnhostnameformat1boxedvoid), +[IdnHostnameFormat1BoxedBoolean](#idnhostnameformat1boxedboolean), +[IdnHostnameFormat1BoxedNumber](#idnhostnameformat1boxednumber), +[IdnHostnameFormat1BoxedString](#idnhostnameformat1boxedstring), +[IdnHostnameFormat1BoxedList](#idnhostnameformat1boxedlist), +[IdnHostnameFormat1BoxedMap](#idnhostnameformat1boxedmap) + +sealed interface that stores validated payloads using boxed classes + +## IdnHostnameFormat1BoxedVoid +data class IdnHostnameFormat1BoxedVoid
    +implements [IdnHostnameFormat1Boxed](#idnhostnameformat1boxed) + +data class that stores validated null payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| IdnHostnameFormat1BoxedVoid(Nothing? data)
    Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| Nothing? | data()
    validated payload | +| Any? | getData()
    validated payload | + +## IdnHostnameFormat1BoxedBoolean +data class IdnHostnameFormat1BoxedBoolean
    +implements [IdnHostnameFormat1Boxed](#idnhostnameformat1boxed) + +record that stores validated boolean payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| IdnHostnameFormat1BoxedBoolean(boolean data)
    Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| boolean | data()
    validated payload | +| Any? | getData()
    validated payload | + +## IdnHostnameFormat1BoxedNumber +data class IdnHostnameFormat1BoxedNumber
    +implements [IdnHostnameFormat1Boxed](#idnhostnameformat1boxed) + +data class that stores validated Number payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| IdnHostnameFormat1BoxedNumber(Number data)
    Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| Number | data()
    validated payload | +| Any? | getData()
    validated payload | + +## IdnHostnameFormat1BoxedString +data class IdnHostnameFormat1BoxedString
    +implements [IdnHostnameFormat1Boxed](#idnhostnameformat1boxed) + +data class that stores validated String payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| IdnHostnameFormat1BoxedString(String data)
    Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| String | data()
    validated payload | +| Any? | getData()
    validated payload | + +## IdnHostnameFormat1BoxedList +data class IdnHostnameFormat1BoxedList
    +implements [IdnHostnameFormat1Boxed](#idnhostnameformat1boxed) + +data class that stores validated List payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| IdnHostnameFormat1BoxedList(FrozenList data)
    Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| FrozenList | data()
    validated payload | +| Any? | getData()
    validated payload | + +## IdnHostnameFormat1BoxedMap +data class IdnHostnameFormat1BoxedMap
    +implements [IdnHostnameFormat1Boxed](#idnhostnameformat1boxed) + +data class that stores validated Map payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| IdnHostnameFormat1BoxedMap(FrozenMap data)
    Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| FrozenMap | data()
    validated payload | +| Any? | getData()
    validated payload | + +## IdnHostnameFormat1 +class IdnHostnameFormat1
    +extends JsonSchema + +A schema class that validates payloads + +### Field Summary +| Modifier and Type | Field and Description | +| ----------------- | ---------------------- | +| String | type = "idn-hostname"; | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| String | validate(arg: String, configuration: SchemaConfiguration) | +| Nothing? | validate(arg: Nothing?, configuration: SchemaConfiguration) | +| int | validate(arg: int, configuration: SchemaConfiguration) | +| long | validate(arg: long, configuration: SchemaConfiguration) | +| float | validate(arg: float, configuration: SchemaConfiguration) | +| double | validate(arg: double, configuration: SchemaConfiguration) | +| Number | validate(arg: Number, configuration: SchemaConfiguration) | +| boolean | validate(arg: boolean, configuration: SchemaConfiguration) | +| FrozenMap | validate(arg: Map<?, ?>, configuration: SchemaConfiguration) | +| FrozenList | validate(arg: List<*>, configuration: SchemaConfiguration) | +| [IdnHostnameFormat1BoxedString](#idnhostnameformat1boxedstring) | validateAndBox(String, configuration: SchemaConfiguration) | +| [IdnHostnameFormat1BoxedVoid](#idnhostnameformat1boxedvoid) | validateAndBox(Nothing?, configuration: SchemaConfiguration) | +| [IdnHostnameFormat1BoxedNumber](#idnhostnameformat1boxednumber) | validateAndBox(Number, configuration: SchemaConfiguration) | +| [IdnHostnameFormat1BoxedBoolean](#idnhostnameformat1boxedboolean) | validateAndBox(boolean, configuration: SchemaConfiguration) | +| [IdnHostnameFormat1BoxedMap](#idnhostnameformat1boxedmap) | validateAndBox(Map<?, ?>, configuration: SchemaConfiguration) | +| [IdnHostnameFormat1BoxedList](#idnhostnameformat1boxedlist) | validateAndBox(List<*>, configuration: SchemaConfiguration) | +| [IdnHostnameFormat1Boxed](#idnhostnameformat1boxed) | validateAndBox(Any?, configuration: SchemaConfiguration) | +| Any? | validate(arg: Any?, configuration: SchemaConfiguration) | + +[[Back to top]](#top) [[Back to Component Schemas]](../../../README.md#Component-Schemas) [[Back to README]](../../../README.md) diff --git a/samples/client/3_1_0_unit_test/kotlin/docs/components/schemas/IfAndElseWithoutThen.md b/samples/client/3_1_0_unit_test/kotlin/docs/components/schemas/IfAndElseWithoutThen.md new file mode 100644 index 00000000000..6bf87cb8605 --- /dev/null +++ b/samples/client/3_1_0_unit_test/kotlin/docs/components/schemas/IfAndElseWithoutThen.md @@ -0,0 +1,480 @@ +# IfAndElseWithoutThen +org.openapijsonschematools.client.components.schemas.IfAndElseWithoutThen.java +class IfAndElseWithoutThen
    + +A class that contains necessary nested +- schema classes (which validate payloads), extends JsonSchema +- sealed interfaces which store validated payloads, Kotlin version of a sum type +- boxed classes which store validated payloads, sealed permits class implementations + +## Nested Class Summary +| Modifier and Type | Class and Description | +| ----------------- | ---------------------- | +| sealed interface | [IfAndElseWithoutThen.IfAndElseWithoutThen1Boxed](#ifandelsewithoutthen1boxed)
    sealed interface for validated payloads | +| record | [IfAndElseWithoutThen.IfAndElseWithoutThen1BoxedVoid](#ifandelsewithoutthen1boxedvoid)
    boxed class to store validated null payloads | +| record | [IfAndElseWithoutThen.IfAndElseWithoutThen1BoxedBoolean](#ifandelsewithoutthen1boxedboolean)
    boxed class to store validated boolean payloads | +| record | [IfAndElseWithoutThen.IfAndElseWithoutThen1BoxedNumber](#ifandelsewithoutthen1boxednumber)
    boxed class to store validated Number payloads | +| record | [IfAndElseWithoutThen.IfAndElseWithoutThen1BoxedString](#ifandelsewithoutthen1boxedstring)
    boxed class to store validated String payloads | +| record | [IfAndElseWithoutThen.IfAndElseWithoutThen1BoxedList](#ifandelsewithoutthen1boxedlist)
    boxed class to store validated List payloads | +| record | [IfAndElseWithoutThen.IfAndElseWithoutThen1BoxedMap](#ifandelsewithoutthen1boxedmap)
    boxed class to store validated Map payloads | +| static class | [IfAndElseWithoutThen.IfAndElseWithoutThen1](#ifandelsewithoutthen1)
    schema class | +| sealed interface | [IfAndElseWithoutThen.IfSchemaBoxed](#ifschemaboxed)
    sealed interface for validated payloads | +| record | [IfAndElseWithoutThen.IfSchemaBoxedVoid](#ifschemaboxedvoid)
    boxed class to store validated null payloads | +| record | [IfAndElseWithoutThen.IfSchemaBoxedBoolean](#ifschemaboxedboolean)
    boxed class to store validated boolean payloads | +| record | [IfAndElseWithoutThen.IfSchemaBoxedNumber](#ifschemaboxednumber)
    boxed class to store validated Number payloads | +| record | [IfAndElseWithoutThen.IfSchemaBoxedString](#ifschemaboxedstring)
    boxed class to store validated String payloads | +| record | [IfAndElseWithoutThen.IfSchemaBoxedList](#ifschemaboxedlist)
    boxed class to store validated List payloads | +| record | [IfAndElseWithoutThen.IfSchemaBoxedMap](#ifschemaboxedmap)
    boxed class to store validated Map payloads | +| static class | [IfAndElseWithoutThen.IfSchema](#ifschema)
    schema class | +| sealed interface | [IfAndElseWithoutThen.ElseSchemaBoxed](#elseschemaboxed)
    sealed interface for validated payloads | +| record | [IfAndElseWithoutThen.ElseSchemaBoxedVoid](#elseschemaboxedvoid)
    boxed class to store validated null payloads | +| record | [IfAndElseWithoutThen.ElseSchemaBoxedBoolean](#elseschemaboxedboolean)
    boxed class to store validated boolean payloads | +| record | [IfAndElseWithoutThen.ElseSchemaBoxedNumber](#elseschemaboxednumber)
    boxed class to store validated Number payloads | +| record | [IfAndElseWithoutThen.ElseSchemaBoxedString](#elseschemaboxedstring)
    boxed class to store validated String payloads | +| record | [IfAndElseWithoutThen.ElseSchemaBoxedList](#elseschemaboxedlist)
    boxed class to store validated List payloads | +| record | [IfAndElseWithoutThen.ElseSchemaBoxedMap](#elseschemaboxedmap)
    boxed class to store validated Map payloads | +| static class | [IfAndElseWithoutThen.ElseSchema](#elseschema)
    schema class | + +## IfAndElseWithoutThen1Boxed +sealed interface IfAndElseWithoutThen1Boxed
    +permits
    +[IfAndElseWithoutThen1BoxedVoid](#ifandelsewithoutthen1boxedvoid), +[IfAndElseWithoutThen1BoxedBoolean](#ifandelsewithoutthen1boxedboolean), +[IfAndElseWithoutThen1BoxedNumber](#ifandelsewithoutthen1boxednumber), +[IfAndElseWithoutThen1BoxedString](#ifandelsewithoutthen1boxedstring), +[IfAndElseWithoutThen1BoxedList](#ifandelsewithoutthen1boxedlist), +[IfAndElseWithoutThen1BoxedMap](#ifandelsewithoutthen1boxedmap) + +sealed interface that stores validated payloads using boxed classes + +## IfAndElseWithoutThen1BoxedVoid +data class IfAndElseWithoutThen1BoxedVoid
    +implements [IfAndElseWithoutThen1Boxed](#ifandelsewithoutthen1boxed) + +data class that stores validated null payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| IfAndElseWithoutThen1BoxedVoid(Nothing? data)
    Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| Nothing? | data()
    validated payload | +| Any? | getData()
    validated payload | + +## IfAndElseWithoutThen1BoxedBoolean +data class IfAndElseWithoutThen1BoxedBoolean
    +implements [IfAndElseWithoutThen1Boxed](#ifandelsewithoutthen1boxed) + +record that stores validated boolean payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| IfAndElseWithoutThen1BoxedBoolean(boolean data)
    Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| boolean | data()
    validated payload | +| Any? | getData()
    validated payload | + +## IfAndElseWithoutThen1BoxedNumber +data class IfAndElseWithoutThen1BoxedNumber
    +implements [IfAndElseWithoutThen1Boxed](#ifandelsewithoutthen1boxed) + +data class that stores validated Number payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| IfAndElseWithoutThen1BoxedNumber(Number data)
    Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| Number | data()
    validated payload | +| Any? | getData()
    validated payload | + +## IfAndElseWithoutThen1BoxedString +data class IfAndElseWithoutThen1BoxedString
    +implements [IfAndElseWithoutThen1Boxed](#ifandelsewithoutthen1boxed) + +data class that stores validated String payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| IfAndElseWithoutThen1BoxedString(String data)
    Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| String | data()
    validated payload | +| Any? | getData()
    validated payload | + +## IfAndElseWithoutThen1BoxedList +data class IfAndElseWithoutThen1BoxedList
    +implements [IfAndElseWithoutThen1Boxed](#ifandelsewithoutthen1boxed) + +data class that stores validated List payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| IfAndElseWithoutThen1BoxedList(FrozenList data)
    Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| FrozenList | data()
    validated payload | +| Any? | getData()
    validated payload | + +## IfAndElseWithoutThen1BoxedMap +data class IfAndElseWithoutThen1BoxedMap
    +implements [IfAndElseWithoutThen1Boxed](#ifandelsewithoutthen1boxed) + +data class that stores validated Map payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| IfAndElseWithoutThen1BoxedMap(FrozenMap data)
    Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| FrozenMap | data()
    validated payload | +| Any? | getData()
    validated payload | + +## IfAndElseWithoutThen1 +class IfAndElseWithoutThen1
    +extends JsonSchema + +A schema class that validates payloads + +### Field Summary +| Modifier and Type | Field and Description | +| ----------------- | ---------------------- | +| Class | if = [IfSchema::class.java](#ifschema) | +| Class | elseSchema = [ElseSchema::class.java](#elseschema) | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| String | validate(arg: String, configuration: SchemaConfiguration) | +| Nothing? | validate(arg: Nothing?, configuration: SchemaConfiguration) | +| int | validate(arg: int, configuration: SchemaConfiguration) | +| long | validate(arg: long, configuration: SchemaConfiguration) | +| float | validate(arg: float, configuration: SchemaConfiguration) | +| double | validate(arg: double, configuration: SchemaConfiguration) | +| Number | validate(arg: Number, configuration: SchemaConfiguration) | +| boolean | validate(arg: boolean, configuration: SchemaConfiguration) | +| FrozenMap | validate(arg: Map<?, ?>, configuration: SchemaConfiguration) | +| FrozenList | validate(arg: List<*>, configuration: SchemaConfiguration) | +| [IfAndElseWithoutThen1BoxedString](#ifandelsewithoutthen1boxedstring) | validateAndBox(String, configuration: SchemaConfiguration) | +| [IfAndElseWithoutThen1BoxedVoid](#ifandelsewithoutthen1boxedvoid) | validateAndBox(Nothing?, configuration: SchemaConfiguration) | +| [IfAndElseWithoutThen1BoxedNumber](#ifandelsewithoutthen1boxednumber) | validateAndBox(Number, configuration: SchemaConfiguration) | +| [IfAndElseWithoutThen1BoxedBoolean](#ifandelsewithoutthen1boxedboolean) | validateAndBox(boolean, configuration: SchemaConfiguration) | +| [IfAndElseWithoutThen1BoxedMap](#ifandelsewithoutthen1boxedmap) | validateAndBox(Map<?, ?>, configuration: SchemaConfiguration) | +| [IfAndElseWithoutThen1BoxedList](#ifandelsewithoutthen1boxedlist) | validateAndBox(List<*>, configuration: SchemaConfiguration) | +| [IfAndElseWithoutThen1Boxed](#ifandelsewithoutthen1boxed) | validateAndBox(Any?, configuration: SchemaConfiguration) | +| Any? | validate(arg: Any?, configuration: SchemaConfiguration) | + +## IfSchemaBoxed +sealed interface IfSchemaBoxed
    +permits
    +[IfSchemaBoxedVoid](#ifschemaboxedvoid), +[IfSchemaBoxedBoolean](#ifschemaboxedboolean), +[IfSchemaBoxedNumber](#ifschemaboxednumber), +[IfSchemaBoxedString](#ifschemaboxedstring), +[IfSchemaBoxedList](#ifschemaboxedlist), +[IfSchemaBoxedMap](#ifschemaboxedmap) + +sealed interface that stores validated payloads using boxed classes + +## IfSchemaBoxedVoid +data class IfSchemaBoxedVoid
    +implements [IfSchemaBoxed](#ifschemaboxed) + +data class that stores validated null payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| IfSchemaBoxedVoid(Nothing? data)
    Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| Nothing? | data()
    validated payload | +| Any? | getData()
    validated payload | + +## IfSchemaBoxedBoolean +data class IfSchemaBoxedBoolean
    +implements [IfSchemaBoxed](#ifschemaboxed) + +record that stores validated boolean payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| IfSchemaBoxedBoolean(boolean data)
    Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| boolean | data()
    validated payload | +| Any? | getData()
    validated payload | + +## IfSchemaBoxedNumber +data class IfSchemaBoxedNumber
    +implements [IfSchemaBoxed](#ifschemaboxed) + +data class that stores validated Number payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| IfSchemaBoxedNumber(Number data)
    Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| Number | data()
    validated payload | +| Any? | getData()
    validated payload | + +## IfSchemaBoxedString +data class IfSchemaBoxedString
    +implements [IfSchemaBoxed](#ifschemaboxed) + +data class that stores validated String payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| IfSchemaBoxedString(String data)
    Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| String | data()
    validated payload | +| Any? | getData()
    validated payload | + +## IfSchemaBoxedList +data class IfSchemaBoxedList
    +implements [IfSchemaBoxed](#ifschemaboxed) + +data class that stores validated List payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| IfSchemaBoxedList(FrozenList data)
    Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| FrozenList | data()
    validated payload | +| Any? | getData()
    validated payload | + +## IfSchemaBoxedMap +data class IfSchemaBoxedMap
    +implements [IfSchemaBoxed](#ifschemaboxed) + +data class that stores validated Map payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| IfSchemaBoxedMap(FrozenMap data)
    Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| FrozenMap | data()
    validated payload | +| Any? | getData()
    validated payload | + +## IfSchema +class IfSchema
    +extends JsonSchema + +A schema class that validates payloads + +### Field Summary +| Modifier and Type | Field and Description | +| ----------------- | ---------------------- | +| Number | exclusiveMaximum = 0 | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| String | validate(arg: String, configuration: SchemaConfiguration) | +| Nothing? | validate(arg: Nothing?, configuration: SchemaConfiguration) | +| int | validate(arg: int, configuration: SchemaConfiguration) | +| long | validate(arg: long, configuration: SchemaConfiguration) | +| float | validate(arg: float, configuration: SchemaConfiguration) | +| double | validate(arg: double, configuration: SchemaConfiguration) | +| Number | validate(arg: Number, configuration: SchemaConfiguration) | +| boolean | validate(arg: boolean, configuration: SchemaConfiguration) | +| FrozenMap | validate(arg: Map<?, ?>, configuration: SchemaConfiguration) | +| FrozenList | validate(arg: List<*>, configuration: SchemaConfiguration) | +| [IfSchemaBoxedString](#ifschemaboxedstring) | validateAndBox(String, configuration: SchemaConfiguration) | +| [IfSchemaBoxedVoid](#ifschemaboxedvoid) | validateAndBox(Nothing?, configuration: SchemaConfiguration) | +| [IfSchemaBoxedNumber](#ifschemaboxednumber) | validateAndBox(Number, configuration: SchemaConfiguration) | +| [IfSchemaBoxedBoolean](#ifschemaboxedboolean) | validateAndBox(boolean, configuration: SchemaConfiguration) | +| [IfSchemaBoxedMap](#ifschemaboxedmap) | validateAndBox(Map<?, ?>, configuration: SchemaConfiguration) | +| [IfSchemaBoxedList](#ifschemaboxedlist) | validateAndBox(List<*>, configuration: SchemaConfiguration) | +| [IfSchemaBoxed](#ifschemaboxed) | validateAndBox(Any?, configuration: SchemaConfiguration) | +| Any? | validate(arg: Any?, configuration: SchemaConfiguration) | + +## ElseSchemaBoxed +sealed interface ElseSchemaBoxed
    +permits
    +[ElseSchemaBoxedVoid](#elseschemaboxedvoid), +[ElseSchemaBoxedBoolean](#elseschemaboxedboolean), +[ElseSchemaBoxedNumber](#elseschemaboxednumber), +[ElseSchemaBoxedString](#elseschemaboxedstring), +[ElseSchemaBoxedList](#elseschemaboxedlist), +[ElseSchemaBoxedMap](#elseschemaboxedmap) + +sealed interface that stores validated payloads using boxed classes + +## ElseSchemaBoxedVoid +data class ElseSchemaBoxedVoid
    +implements [ElseSchemaBoxed](#elseschemaboxed) + +data class that stores validated null payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| ElseSchemaBoxedVoid(Nothing? data)
    Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| Nothing? | data()
    validated payload | +| Any? | getData()
    validated payload | + +## ElseSchemaBoxedBoolean +data class ElseSchemaBoxedBoolean
    +implements [ElseSchemaBoxed](#elseschemaboxed) + +record that stores validated boolean payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| ElseSchemaBoxedBoolean(boolean data)
    Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| boolean | data()
    validated payload | +| Any? | getData()
    validated payload | + +## ElseSchemaBoxedNumber +data class ElseSchemaBoxedNumber
    +implements [ElseSchemaBoxed](#elseschemaboxed) + +data class that stores validated Number payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| ElseSchemaBoxedNumber(Number data)
    Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| Number | data()
    validated payload | +| Any? | getData()
    validated payload | + +## ElseSchemaBoxedString +data class ElseSchemaBoxedString
    +implements [ElseSchemaBoxed](#elseschemaboxed) + +data class that stores validated String payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| ElseSchemaBoxedString(String data)
    Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| String | data()
    validated payload | +| Any? | getData()
    validated payload | + +## ElseSchemaBoxedList +data class ElseSchemaBoxedList
    +implements [ElseSchemaBoxed](#elseschemaboxed) + +data class that stores validated List payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| ElseSchemaBoxedList(FrozenList data)
    Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| FrozenList | data()
    validated payload | +| Any? | getData()
    validated payload | + +## ElseSchemaBoxedMap +data class ElseSchemaBoxedMap
    +implements [ElseSchemaBoxed](#elseschemaboxed) + +data class that stores validated Map payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| ElseSchemaBoxedMap(FrozenMap data)
    Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| FrozenMap | data()
    validated payload | +| Any? | getData()
    validated payload | + +## ElseSchema +class ElseSchema
    +extends JsonSchema + +A schema class that validates payloads + +### Field Summary +| Modifier and Type | Field and Description | +| ----------------- | ---------------------- | +| BigDecimal | multipleOf = BigDecimal("2") | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| String | validate(arg: String, configuration: SchemaConfiguration) | +| Nothing? | validate(arg: Nothing?, configuration: SchemaConfiguration) | +| int | validate(arg: int, configuration: SchemaConfiguration) | +| long | validate(arg: long, configuration: SchemaConfiguration) | +| float | validate(arg: float, configuration: SchemaConfiguration) | +| double | validate(arg: double, configuration: SchemaConfiguration) | +| Number | validate(arg: Number, configuration: SchemaConfiguration) | +| boolean | validate(arg: boolean, configuration: SchemaConfiguration) | +| FrozenMap | validate(arg: Map<?, ?>, configuration: SchemaConfiguration) | +| FrozenList | validate(arg: List<*>, configuration: SchemaConfiguration) | +| [ElseSchemaBoxedString](#elseschemaboxedstring) | validateAndBox(String, configuration: SchemaConfiguration) | +| [ElseSchemaBoxedVoid](#elseschemaboxedvoid) | validateAndBox(Nothing?, configuration: SchemaConfiguration) | +| [ElseSchemaBoxedNumber](#elseschemaboxednumber) | validateAndBox(Number, configuration: SchemaConfiguration) | +| [ElseSchemaBoxedBoolean](#elseschemaboxedboolean) | validateAndBox(boolean, configuration: SchemaConfiguration) | +| [ElseSchemaBoxedMap](#elseschemaboxedmap) | validateAndBox(Map<?, ?>, configuration: SchemaConfiguration) | +| [ElseSchemaBoxedList](#elseschemaboxedlist) | validateAndBox(List<*>, configuration: SchemaConfiguration) | +| [ElseSchemaBoxed](#elseschemaboxed) | validateAndBox(Any?, configuration: SchemaConfiguration) | +| Any? | validate(arg: Any?, configuration: SchemaConfiguration) | + +[[Back to top]](#top) [[Back to Component Schemas]](../../../README.md#Component-Schemas) [[Back to README]](../../../README.md) diff --git a/samples/client/3_1_0_unit_test/kotlin/docs/components/schemas/IfAndThenWithoutElse.md b/samples/client/3_1_0_unit_test/kotlin/docs/components/schemas/IfAndThenWithoutElse.md new file mode 100644 index 00000000000..f6816588009 --- /dev/null +++ b/samples/client/3_1_0_unit_test/kotlin/docs/components/schemas/IfAndThenWithoutElse.md @@ -0,0 +1,480 @@ +# IfAndThenWithoutElse +org.openapijsonschematools.client.components.schemas.IfAndThenWithoutElse.java +class IfAndThenWithoutElse
    + +A class that contains necessary nested +- schema classes (which validate payloads), extends JsonSchema +- sealed interfaces which store validated payloads, Kotlin version of a sum type +- boxed classes which store validated payloads, sealed permits class implementations + +## Nested Class Summary +| Modifier and Type | Class and Description | +| ----------------- | ---------------------- | +| sealed interface | [IfAndThenWithoutElse.IfAndThenWithoutElse1Boxed](#ifandthenwithoutelse1boxed)
    sealed interface for validated payloads | +| record | [IfAndThenWithoutElse.IfAndThenWithoutElse1BoxedVoid](#ifandthenwithoutelse1boxedvoid)
    boxed class to store validated null payloads | +| record | [IfAndThenWithoutElse.IfAndThenWithoutElse1BoxedBoolean](#ifandthenwithoutelse1boxedboolean)
    boxed class to store validated boolean payloads | +| record | [IfAndThenWithoutElse.IfAndThenWithoutElse1BoxedNumber](#ifandthenwithoutelse1boxednumber)
    boxed class to store validated Number payloads | +| record | [IfAndThenWithoutElse.IfAndThenWithoutElse1BoxedString](#ifandthenwithoutelse1boxedstring)
    boxed class to store validated String payloads | +| record | [IfAndThenWithoutElse.IfAndThenWithoutElse1BoxedList](#ifandthenwithoutelse1boxedlist)
    boxed class to store validated List payloads | +| record | [IfAndThenWithoutElse.IfAndThenWithoutElse1BoxedMap](#ifandthenwithoutelse1boxedmap)
    boxed class to store validated Map payloads | +| static class | [IfAndThenWithoutElse.IfAndThenWithoutElse1](#ifandthenwithoutelse1)
    schema class | +| sealed interface | [IfAndThenWithoutElse.ThenBoxed](#thenboxed)
    sealed interface for validated payloads | +| record | [IfAndThenWithoutElse.ThenBoxedVoid](#thenboxedvoid)
    boxed class to store validated null payloads | +| record | [IfAndThenWithoutElse.ThenBoxedBoolean](#thenboxedboolean)
    boxed class to store validated boolean payloads | +| record | [IfAndThenWithoutElse.ThenBoxedNumber](#thenboxednumber)
    boxed class to store validated Number payloads | +| record | [IfAndThenWithoutElse.ThenBoxedString](#thenboxedstring)
    boxed class to store validated String payloads | +| record | [IfAndThenWithoutElse.ThenBoxedList](#thenboxedlist)
    boxed class to store validated List payloads | +| record | [IfAndThenWithoutElse.ThenBoxedMap](#thenboxedmap)
    boxed class to store validated Map payloads | +| static class | [IfAndThenWithoutElse.Then](#then)
    schema class | +| sealed interface | [IfAndThenWithoutElse.IfSchemaBoxed](#ifschemaboxed)
    sealed interface for validated payloads | +| record | [IfAndThenWithoutElse.IfSchemaBoxedVoid](#ifschemaboxedvoid)
    boxed class to store validated null payloads | +| record | [IfAndThenWithoutElse.IfSchemaBoxedBoolean](#ifschemaboxedboolean)
    boxed class to store validated boolean payloads | +| record | [IfAndThenWithoutElse.IfSchemaBoxedNumber](#ifschemaboxednumber)
    boxed class to store validated Number payloads | +| record | [IfAndThenWithoutElse.IfSchemaBoxedString](#ifschemaboxedstring)
    boxed class to store validated String payloads | +| record | [IfAndThenWithoutElse.IfSchemaBoxedList](#ifschemaboxedlist)
    boxed class to store validated List payloads | +| record | [IfAndThenWithoutElse.IfSchemaBoxedMap](#ifschemaboxedmap)
    boxed class to store validated Map payloads | +| static class | [IfAndThenWithoutElse.IfSchema](#ifschema)
    schema class | + +## IfAndThenWithoutElse1Boxed +sealed interface IfAndThenWithoutElse1Boxed
    +permits
    +[IfAndThenWithoutElse1BoxedVoid](#ifandthenwithoutelse1boxedvoid), +[IfAndThenWithoutElse1BoxedBoolean](#ifandthenwithoutelse1boxedboolean), +[IfAndThenWithoutElse1BoxedNumber](#ifandthenwithoutelse1boxednumber), +[IfAndThenWithoutElse1BoxedString](#ifandthenwithoutelse1boxedstring), +[IfAndThenWithoutElse1BoxedList](#ifandthenwithoutelse1boxedlist), +[IfAndThenWithoutElse1BoxedMap](#ifandthenwithoutelse1boxedmap) + +sealed interface that stores validated payloads using boxed classes + +## IfAndThenWithoutElse1BoxedVoid +data class IfAndThenWithoutElse1BoxedVoid
    +implements [IfAndThenWithoutElse1Boxed](#ifandthenwithoutelse1boxed) + +data class that stores validated null payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| IfAndThenWithoutElse1BoxedVoid(Nothing? data)
    Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| Nothing? | data()
    validated payload | +| Any? | getData()
    validated payload | + +## IfAndThenWithoutElse1BoxedBoolean +data class IfAndThenWithoutElse1BoxedBoolean
    +implements [IfAndThenWithoutElse1Boxed](#ifandthenwithoutelse1boxed) + +record that stores validated boolean payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| IfAndThenWithoutElse1BoxedBoolean(boolean data)
    Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| boolean | data()
    validated payload | +| Any? | getData()
    validated payload | + +## IfAndThenWithoutElse1BoxedNumber +data class IfAndThenWithoutElse1BoxedNumber
    +implements [IfAndThenWithoutElse1Boxed](#ifandthenwithoutelse1boxed) + +data class that stores validated Number payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| IfAndThenWithoutElse1BoxedNumber(Number data)
    Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| Number | data()
    validated payload | +| Any? | getData()
    validated payload | + +## IfAndThenWithoutElse1BoxedString +data class IfAndThenWithoutElse1BoxedString
    +implements [IfAndThenWithoutElse1Boxed](#ifandthenwithoutelse1boxed) + +data class that stores validated String payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| IfAndThenWithoutElse1BoxedString(String data)
    Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| String | data()
    validated payload | +| Any? | getData()
    validated payload | + +## IfAndThenWithoutElse1BoxedList +data class IfAndThenWithoutElse1BoxedList
    +implements [IfAndThenWithoutElse1Boxed](#ifandthenwithoutelse1boxed) + +data class that stores validated List payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| IfAndThenWithoutElse1BoxedList(FrozenList data)
    Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| FrozenList | data()
    validated payload | +| Any? | getData()
    validated payload | + +## IfAndThenWithoutElse1BoxedMap +data class IfAndThenWithoutElse1BoxedMap
    +implements [IfAndThenWithoutElse1Boxed](#ifandthenwithoutelse1boxed) + +data class that stores validated Map payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| IfAndThenWithoutElse1BoxedMap(FrozenMap data)
    Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| FrozenMap | data()
    validated payload | +| Any? | getData()
    validated payload | + +## IfAndThenWithoutElse1 +class IfAndThenWithoutElse1
    +extends JsonSchema + +A schema class that validates payloads + +### Field Summary +| Modifier and Type | Field and Description | +| ----------------- | ---------------------- | +| Class | if = [IfSchema::class.java](#ifschema) | +| Class | then = [Then::class.java](#then) | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| String | validate(arg: String, configuration: SchemaConfiguration) | +| Nothing? | validate(arg: Nothing?, configuration: SchemaConfiguration) | +| int | validate(arg: int, configuration: SchemaConfiguration) | +| long | validate(arg: long, configuration: SchemaConfiguration) | +| float | validate(arg: float, configuration: SchemaConfiguration) | +| double | validate(arg: double, configuration: SchemaConfiguration) | +| Number | validate(arg: Number, configuration: SchemaConfiguration) | +| boolean | validate(arg: boolean, configuration: SchemaConfiguration) | +| FrozenMap | validate(arg: Map<?, ?>, configuration: SchemaConfiguration) | +| FrozenList | validate(arg: List<*>, configuration: SchemaConfiguration) | +| [IfAndThenWithoutElse1BoxedString](#ifandthenwithoutelse1boxedstring) | validateAndBox(String, configuration: SchemaConfiguration) | +| [IfAndThenWithoutElse1BoxedVoid](#ifandthenwithoutelse1boxedvoid) | validateAndBox(Nothing?, configuration: SchemaConfiguration) | +| [IfAndThenWithoutElse1BoxedNumber](#ifandthenwithoutelse1boxednumber) | validateAndBox(Number, configuration: SchemaConfiguration) | +| [IfAndThenWithoutElse1BoxedBoolean](#ifandthenwithoutelse1boxedboolean) | validateAndBox(boolean, configuration: SchemaConfiguration) | +| [IfAndThenWithoutElse1BoxedMap](#ifandthenwithoutelse1boxedmap) | validateAndBox(Map<?, ?>, configuration: SchemaConfiguration) | +| [IfAndThenWithoutElse1BoxedList](#ifandthenwithoutelse1boxedlist) | validateAndBox(List<*>, configuration: SchemaConfiguration) | +| [IfAndThenWithoutElse1Boxed](#ifandthenwithoutelse1boxed) | validateAndBox(Any?, configuration: SchemaConfiguration) | +| Any? | validate(arg: Any?, configuration: SchemaConfiguration) | + +## ThenBoxed +sealed interface ThenBoxed
    +permits
    +[ThenBoxedVoid](#thenboxedvoid), +[ThenBoxedBoolean](#thenboxedboolean), +[ThenBoxedNumber](#thenboxednumber), +[ThenBoxedString](#thenboxedstring), +[ThenBoxedList](#thenboxedlist), +[ThenBoxedMap](#thenboxedmap) + +sealed interface that stores validated payloads using boxed classes + +## ThenBoxedVoid +data class ThenBoxedVoid
    +implements [ThenBoxed](#thenboxed) + +data class that stores validated null payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| ThenBoxedVoid(Nothing? data)
    Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| Nothing? | data()
    validated payload | +| Any? | getData()
    validated payload | + +## ThenBoxedBoolean +data class ThenBoxedBoolean
    +implements [ThenBoxed](#thenboxed) + +record that stores validated boolean payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| ThenBoxedBoolean(boolean data)
    Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| boolean | data()
    validated payload | +| Any? | getData()
    validated payload | + +## ThenBoxedNumber +data class ThenBoxedNumber
    +implements [ThenBoxed](#thenboxed) + +data class that stores validated Number payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| ThenBoxedNumber(Number data)
    Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| Number | data()
    validated payload | +| Any? | getData()
    validated payload | + +## ThenBoxedString +data class ThenBoxedString
    +implements [ThenBoxed](#thenboxed) + +data class that stores validated String payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| ThenBoxedString(String data)
    Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| String | data()
    validated payload | +| Any? | getData()
    validated payload | + +## ThenBoxedList +data class ThenBoxedList
    +implements [ThenBoxed](#thenboxed) + +data class that stores validated List payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| ThenBoxedList(FrozenList data)
    Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| FrozenList | data()
    validated payload | +| Any? | getData()
    validated payload | + +## ThenBoxedMap +data class ThenBoxedMap
    +implements [ThenBoxed](#thenboxed) + +data class that stores validated Map payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| ThenBoxedMap(FrozenMap data)
    Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| FrozenMap | data()
    validated payload | +| Any? | getData()
    validated payload | + +## Then +class Then
    +extends JsonSchema + +A schema class that validates payloads + +### Field Summary +| Modifier and Type | Field and Description | +| ----------------- | ---------------------- | +| Number | minimum = -10 | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| String | validate(arg: String, configuration: SchemaConfiguration) | +| Nothing? | validate(arg: Nothing?, configuration: SchemaConfiguration) | +| int | validate(arg: int, configuration: SchemaConfiguration) | +| long | validate(arg: long, configuration: SchemaConfiguration) | +| float | validate(arg: float, configuration: SchemaConfiguration) | +| double | validate(arg: double, configuration: SchemaConfiguration) | +| Number | validate(arg: Number, configuration: SchemaConfiguration) | +| boolean | validate(arg: boolean, configuration: SchemaConfiguration) | +| FrozenMap | validate(arg: Map<?, ?>, configuration: SchemaConfiguration) | +| FrozenList | validate(arg: List<*>, configuration: SchemaConfiguration) | +| [ThenBoxedString](#thenboxedstring) | validateAndBox(String, configuration: SchemaConfiguration) | +| [ThenBoxedVoid](#thenboxedvoid) | validateAndBox(Nothing?, configuration: SchemaConfiguration) | +| [ThenBoxedNumber](#thenboxednumber) | validateAndBox(Number, configuration: SchemaConfiguration) | +| [ThenBoxedBoolean](#thenboxedboolean) | validateAndBox(boolean, configuration: SchemaConfiguration) | +| [ThenBoxedMap](#thenboxedmap) | validateAndBox(Map<?, ?>, configuration: SchemaConfiguration) | +| [ThenBoxedList](#thenboxedlist) | validateAndBox(List<*>, configuration: SchemaConfiguration) | +| [ThenBoxed](#thenboxed) | validateAndBox(Any?, configuration: SchemaConfiguration) | +| Any? | validate(arg: Any?, configuration: SchemaConfiguration) | + +## IfSchemaBoxed +sealed interface IfSchemaBoxed
    +permits
    +[IfSchemaBoxedVoid](#ifschemaboxedvoid), +[IfSchemaBoxedBoolean](#ifschemaboxedboolean), +[IfSchemaBoxedNumber](#ifschemaboxednumber), +[IfSchemaBoxedString](#ifschemaboxedstring), +[IfSchemaBoxedList](#ifschemaboxedlist), +[IfSchemaBoxedMap](#ifschemaboxedmap) + +sealed interface that stores validated payloads using boxed classes + +## IfSchemaBoxedVoid +data class IfSchemaBoxedVoid
    +implements [IfSchemaBoxed](#ifschemaboxed) + +data class that stores validated null payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| IfSchemaBoxedVoid(Nothing? data)
    Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| Nothing? | data()
    validated payload | +| Any? | getData()
    validated payload | + +## IfSchemaBoxedBoolean +data class IfSchemaBoxedBoolean
    +implements [IfSchemaBoxed](#ifschemaboxed) + +record that stores validated boolean payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| IfSchemaBoxedBoolean(boolean data)
    Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| boolean | data()
    validated payload | +| Any? | getData()
    validated payload | + +## IfSchemaBoxedNumber +data class IfSchemaBoxedNumber
    +implements [IfSchemaBoxed](#ifschemaboxed) + +data class that stores validated Number payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| IfSchemaBoxedNumber(Number data)
    Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| Number | data()
    validated payload | +| Any? | getData()
    validated payload | + +## IfSchemaBoxedString +data class IfSchemaBoxedString
    +implements [IfSchemaBoxed](#ifschemaboxed) + +data class that stores validated String payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| IfSchemaBoxedString(String data)
    Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| String | data()
    validated payload | +| Any? | getData()
    validated payload | + +## IfSchemaBoxedList +data class IfSchemaBoxedList
    +implements [IfSchemaBoxed](#ifschemaboxed) + +data class that stores validated List payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| IfSchemaBoxedList(FrozenList data)
    Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| FrozenList | data()
    validated payload | +| Any? | getData()
    validated payload | + +## IfSchemaBoxedMap +data class IfSchemaBoxedMap
    +implements [IfSchemaBoxed](#ifschemaboxed) + +data class that stores validated Map payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| IfSchemaBoxedMap(FrozenMap data)
    Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| FrozenMap | data()
    validated payload | +| Any? | getData()
    validated payload | + +## IfSchema +class IfSchema
    +extends JsonSchema + +A schema class that validates payloads + +### Field Summary +| Modifier and Type | Field and Description | +| ----------------- | ---------------------- | +| Number | exclusiveMaximum = 0 | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| String | validate(arg: String, configuration: SchemaConfiguration) | +| Nothing? | validate(arg: Nothing?, configuration: SchemaConfiguration) | +| int | validate(arg: int, configuration: SchemaConfiguration) | +| long | validate(arg: long, configuration: SchemaConfiguration) | +| float | validate(arg: float, configuration: SchemaConfiguration) | +| double | validate(arg: double, configuration: SchemaConfiguration) | +| Number | validate(arg: Number, configuration: SchemaConfiguration) | +| boolean | validate(arg: boolean, configuration: SchemaConfiguration) | +| FrozenMap | validate(arg: Map<?, ?>, configuration: SchemaConfiguration) | +| FrozenList | validate(arg: List<*>, configuration: SchemaConfiguration) | +| [IfSchemaBoxedString](#ifschemaboxedstring) | validateAndBox(String, configuration: SchemaConfiguration) | +| [IfSchemaBoxedVoid](#ifschemaboxedvoid) | validateAndBox(Nothing?, configuration: SchemaConfiguration) | +| [IfSchemaBoxedNumber](#ifschemaboxednumber) | validateAndBox(Number, configuration: SchemaConfiguration) | +| [IfSchemaBoxedBoolean](#ifschemaboxedboolean) | validateAndBox(boolean, configuration: SchemaConfiguration) | +| [IfSchemaBoxedMap](#ifschemaboxedmap) | validateAndBox(Map<?, ?>, configuration: SchemaConfiguration) | +| [IfSchemaBoxedList](#ifschemaboxedlist) | validateAndBox(List<*>, configuration: SchemaConfiguration) | +| [IfSchemaBoxed](#ifschemaboxed) | validateAndBox(Any?, configuration: SchemaConfiguration) | +| Any? | validate(arg: Any?, configuration: SchemaConfiguration) | + +[[Back to top]](#top) [[Back to Component Schemas]](../../../README.md#Component-Schemas) [[Back to README]](../../../README.md) diff --git a/samples/client/3_1_0_unit_test/kotlin/docs/components/schemas/IfAppearsAtTheEndWhenSerializedKeywordProcessingSequence.md b/samples/client/3_1_0_unit_test/kotlin/docs/components/schemas/IfAppearsAtTheEndWhenSerializedKeywordProcessingSequence.md new file mode 100644 index 00000000000..548b66dd824 --- /dev/null +++ b/samples/client/3_1_0_unit_test/kotlin/docs/components/schemas/IfAppearsAtTheEndWhenSerializedKeywordProcessingSequence.md @@ -0,0 +1,661 @@ +# IfAppearsAtTheEndWhenSerializedKeywordProcessingSequence +org.openapijsonschematools.client.components.schemas.IfAppearsAtTheEndWhenSerializedKeywordProcessingSequence.java +class IfAppearsAtTheEndWhenSerializedKeywordProcessingSequence
    + +A class that contains necessary nested +- schema classes (which validate payloads), extends JsonSchema +- sealed interfaces which store validated payloads, Kotlin version of a sum type +- boxed classes which store validated payloads, sealed permits class implementations +- enum classes + +## Nested Class Summary +| Modifier and Type | Class and Description | +| ----------------- | ---------------------- | +| sealed interface | [IfAppearsAtTheEndWhenSerializedKeywordProcessingSequence.IfAppearsAtTheEndWhenSerializedKeywordProcessingSequence1Boxed](#ifappearsattheendwhenserializedkeywordprocessingsequence1boxed)
    sealed interface for validated payloads | +| record | [IfAppearsAtTheEndWhenSerializedKeywordProcessingSequence.IfAppearsAtTheEndWhenSerializedKeywordProcessingSequence1BoxedVoid](#ifappearsattheendwhenserializedkeywordprocessingsequence1boxedvoid)
    boxed class to store validated null payloads | +| record | [IfAppearsAtTheEndWhenSerializedKeywordProcessingSequence.IfAppearsAtTheEndWhenSerializedKeywordProcessingSequence1BoxedBoolean](#ifappearsattheendwhenserializedkeywordprocessingsequence1boxedboolean)
    boxed class to store validated boolean payloads | +| record | [IfAppearsAtTheEndWhenSerializedKeywordProcessingSequence.IfAppearsAtTheEndWhenSerializedKeywordProcessingSequence1BoxedNumber](#ifappearsattheendwhenserializedkeywordprocessingsequence1boxednumber)
    boxed class to store validated Number payloads | +| record | [IfAppearsAtTheEndWhenSerializedKeywordProcessingSequence.IfAppearsAtTheEndWhenSerializedKeywordProcessingSequence1BoxedString](#ifappearsattheendwhenserializedkeywordprocessingsequence1boxedstring)
    boxed class to store validated String payloads | +| record | [IfAppearsAtTheEndWhenSerializedKeywordProcessingSequence.IfAppearsAtTheEndWhenSerializedKeywordProcessingSequence1BoxedList](#ifappearsattheendwhenserializedkeywordprocessingsequence1boxedlist)
    boxed class to store validated List payloads | +| record | [IfAppearsAtTheEndWhenSerializedKeywordProcessingSequence.IfAppearsAtTheEndWhenSerializedKeywordProcessingSequence1BoxedMap](#ifappearsattheendwhenserializedkeywordprocessingsequence1boxedmap)
    boxed class to store validated Map payloads | +| static class | [IfAppearsAtTheEndWhenSerializedKeywordProcessingSequence.IfAppearsAtTheEndWhenSerializedKeywordProcessingSequence1](#ifappearsattheendwhenserializedkeywordprocessingsequence1)
    schema class | +| sealed interface | [IfAppearsAtTheEndWhenSerializedKeywordProcessingSequence.ThenBoxed](#thenboxed)
    sealed interface for validated payloads | +| record | [IfAppearsAtTheEndWhenSerializedKeywordProcessingSequence.ThenBoxedVoid](#thenboxedvoid)
    boxed class to store validated null payloads | +| record | [IfAppearsAtTheEndWhenSerializedKeywordProcessingSequence.ThenBoxedBoolean](#thenboxedboolean)
    boxed class to store validated boolean payloads | +| record | [IfAppearsAtTheEndWhenSerializedKeywordProcessingSequence.ThenBoxedNumber](#thenboxednumber)
    boxed class to store validated Number payloads | +| record | [IfAppearsAtTheEndWhenSerializedKeywordProcessingSequence.ThenBoxedString](#thenboxedstring)
    boxed class to store validated String payloads | +| record | [IfAppearsAtTheEndWhenSerializedKeywordProcessingSequence.ThenBoxedList](#thenboxedlist)
    boxed class to store validated List payloads | +| record | [IfAppearsAtTheEndWhenSerializedKeywordProcessingSequence.ThenBoxedMap](#thenboxedmap)
    boxed class to store validated Map payloads | +| static class | [IfAppearsAtTheEndWhenSerializedKeywordProcessingSequence.Then](#then)
    schema class | +| enum | [IfAppearsAtTheEndWhenSerializedKeywordProcessingSequence.StringThenConst](#stringthenconst)
    String enum | +| sealed interface | [IfAppearsAtTheEndWhenSerializedKeywordProcessingSequence.IfSchemaBoxed](#ifschemaboxed)
    sealed interface for validated payloads | +| record | [IfAppearsAtTheEndWhenSerializedKeywordProcessingSequence.IfSchemaBoxedVoid](#ifschemaboxedvoid)
    boxed class to store validated null payloads | +| record | [IfAppearsAtTheEndWhenSerializedKeywordProcessingSequence.IfSchemaBoxedBoolean](#ifschemaboxedboolean)
    boxed class to store validated boolean payloads | +| record | [IfAppearsAtTheEndWhenSerializedKeywordProcessingSequence.IfSchemaBoxedNumber](#ifschemaboxednumber)
    boxed class to store validated Number payloads | +| record | [IfAppearsAtTheEndWhenSerializedKeywordProcessingSequence.IfSchemaBoxedString](#ifschemaboxedstring)
    boxed class to store validated String payloads | +| record | [IfAppearsAtTheEndWhenSerializedKeywordProcessingSequence.IfSchemaBoxedList](#ifschemaboxedlist)
    boxed class to store validated List payloads | +| record | [IfAppearsAtTheEndWhenSerializedKeywordProcessingSequence.IfSchemaBoxedMap](#ifschemaboxedmap)
    boxed class to store validated Map payloads | +| static class | [IfAppearsAtTheEndWhenSerializedKeywordProcessingSequence.IfSchema](#ifschema)
    schema class | +| sealed interface | [IfAppearsAtTheEndWhenSerializedKeywordProcessingSequence.ElseSchemaBoxed](#elseschemaboxed)
    sealed interface for validated payloads | +| record | [IfAppearsAtTheEndWhenSerializedKeywordProcessingSequence.ElseSchemaBoxedVoid](#elseschemaboxedvoid)
    boxed class to store validated null payloads | +| record | [IfAppearsAtTheEndWhenSerializedKeywordProcessingSequence.ElseSchemaBoxedBoolean](#elseschemaboxedboolean)
    boxed class to store validated boolean payloads | +| record | [IfAppearsAtTheEndWhenSerializedKeywordProcessingSequence.ElseSchemaBoxedNumber](#elseschemaboxednumber)
    boxed class to store validated Number payloads | +| record | [IfAppearsAtTheEndWhenSerializedKeywordProcessingSequence.ElseSchemaBoxedString](#elseschemaboxedstring)
    boxed class to store validated String payloads | +| record | [IfAppearsAtTheEndWhenSerializedKeywordProcessingSequence.ElseSchemaBoxedList](#elseschemaboxedlist)
    boxed class to store validated List payloads | +| record | [IfAppearsAtTheEndWhenSerializedKeywordProcessingSequence.ElseSchemaBoxedMap](#elseschemaboxedmap)
    boxed class to store validated Map payloads | +| static class | [IfAppearsAtTheEndWhenSerializedKeywordProcessingSequence.ElseSchema](#elseschema)
    schema class | +| enum | [IfAppearsAtTheEndWhenSerializedKeywordProcessingSequence.StringElseConst](#stringelseconst)
    String enum | + +## IfAppearsAtTheEndWhenSerializedKeywordProcessingSequence1Boxed +sealed interface IfAppearsAtTheEndWhenSerializedKeywordProcessingSequence1Boxed
    +permits
    +[IfAppearsAtTheEndWhenSerializedKeywordProcessingSequence1BoxedVoid](#ifappearsattheendwhenserializedkeywordprocessingsequence1boxedvoid), +[IfAppearsAtTheEndWhenSerializedKeywordProcessingSequence1BoxedBoolean](#ifappearsattheendwhenserializedkeywordprocessingsequence1boxedboolean), +[IfAppearsAtTheEndWhenSerializedKeywordProcessingSequence1BoxedNumber](#ifappearsattheendwhenserializedkeywordprocessingsequence1boxednumber), +[IfAppearsAtTheEndWhenSerializedKeywordProcessingSequence1BoxedString](#ifappearsattheendwhenserializedkeywordprocessingsequence1boxedstring), +[IfAppearsAtTheEndWhenSerializedKeywordProcessingSequence1BoxedList](#ifappearsattheendwhenserializedkeywordprocessingsequence1boxedlist), +[IfAppearsAtTheEndWhenSerializedKeywordProcessingSequence1BoxedMap](#ifappearsattheendwhenserializedkeywordprocessingsequence1boxedmap) + +sealed interface that stores validated payloads using boxed classes + +## IfAppearsAtTheEndWhenSerializedKeywordProcessingSequence1BoxedVoid +data class IfAppearsAtTheEndWhenSerializedKeywordProcessingSequence1BoxedVoid
    +implements [IfAppearsAtTheEndWhenSerializedKeywordProcessingSequence1Boxed](#ifappearsattheendwhenserializedkeywordprocessingsequence1boxed) + +data class that stores validated null payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| IfAppearsAtTheEndWhenSerializedKeywordProcessingSequence1BoxedVoid(Nothing? data)
    Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| Nothing? | data()
    validated payload | +| Any? | getData()
    validated payload | + +## IfAppearsAtTheEndWhenSerializedKeywordProcessingSequence1BoxedBoolean +data class IfAppearsAtTheEndWhenSerializedKeywordProcessingSequence1BoxedBoolean
    +implements [IfAppearsAtTheEndWhenSerializedKeywordProcessingSequence1Boxed](#ifappearsattheendwhenserializedkeywordprocessingsequence1boxed) + +record that stores validated boolean payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| IfAppearsAtTheEndWhenSerializedKeywordProcessingSequence1BoxedBoolean(boolean data)
    Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| boolean | data()
    validated payload | +| Any? | getData()
    validated payload | + +## IfAppearsAtTheEndWhenSerializedKeywordProcessingSequence1BoxedNumber +data class IfAppearsAtTheEndWhenSerializedKeywordProcessingSequence1BoxedNumber
    +implements [IfAppearsAtTheEndWhenSerializedKeywordProcessingSequence1Boxed](#ifappearsattheendwhenserializedkeywordprocessingsequence1boxed) + +data class that stores validated Number payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| IfAppearsAtTheEndWhenSerializedKeywordProcessingSequence1BoxedNumber(Number data)
    Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| Number | data()
    validated payload | +| Any? | getData()
    validated payload | + +## IfAppearsAtTheEndWhenSerializedKeywordProcessingSequence1BoxedString +data class IfAppearsAtTheEndWhenSerializedKeywordProcessingSequence1BoxedString
    +implements [IfAppearsAtTheEndWhenSerializedKeywordProcessingSequence1Boxed](#ifappearsattheendwhenserializedkeywordprocessingsequence1boxed) + +data class that stores validated String payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| IfAppearsAtTheEndWhenSerializedKeywordProcessingSequence1BoxedString(String data)
    Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| String | data()
    validated payload | +| Any? | getData()
    validated payload | + +## IfAppearsAtTheEndWhenSerializedKeywordProcessingSequence1BoxedList +data class IfAppearsAtTheEndWhenSerializedKeywordProcessingSequence1BoxedList
    +implements [IfAppearsAtTheEndWhenSerializedKeywordProcessingSequence1Boxed](#ifappearsattheendwhenserializedkeywordprocessingsequence1boxed) + +data class that stores validated List payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| IfAppearsAtTheEndWhenSerializedKeywordProcessingSequence1BoxedList(FrozenList data)
    Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| FrozenList | data()
    validated payload | +| Any? | getData()
    validated payload | + +## IfAppearsAtTheEndWhenSerializedKeywordProcessingSequence1BoxedMap +data class IfAppearsAtTheEndWhenSerializedKeywordProcessingSequence1BoxedMap
    +implements [IfAppearsAtTheEndWhenSerializedKeywordProcessingSequence1Boxed](#ifappearsattheendwhenserializedkeywordprocessingsequence1boxed) + +data class that stores validated Map payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| IfAppearsAtTheEndWhenSerializedKeywordProcessingSequence1BoxedMap(FrozenMap data)
    Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| FrozenMap | data()
    validated payload | +| Any? | getData()
    validated payload | + +## IfAppearsAtTheEndWhenSerializedKeywordProcessingSequence1 +class IfAppearsAtTheEndWhenSerializedKeywordProcessingSequence1
    +extends JsonSchema + +A schema class that validates payloads + +### Field Summary +| Modifier and Type | Field and Description | +| ----------------- | ---------------------- | +| Class | if = [IfSchema::class.java](#ifschema) | +| Class | then = [Then::class.java](#then) | +| Class | elseSchema = [ElseSchema::class.java](#elseschema) | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| String | validate(arg: String, configuration: SchemaConfiguration) | +| Nothing? | validate(arg: Nothing?, configuration: SchemaConfiguration) | +| int | validate(arg: int, configuration: SchemaConfiguration) | +| long | validate(arg: long, configuration: SchemaConfiguration) | +| float | validate(arg: float, configuration: SchemaConfiguration) | +| double | validate(arg: double, configuration: SchemaConfiguration) | +| Number | validate(arg: Number, configuration: SchemaConfiguration) | +| boolean | validate(arg: boolean, configuration: SchemaConfiguration) | +| FrozenMap | validate(arg: Map<?, ?>, configuration: SchemaConfiguration) | +| FrozenList | validate(arg: List<*>, configuration: SchemaConfiguration) | +| [IfAppearsAtTheEndWhenSerializedKeywordProcessingSequence1BoxedString](#ifappearsattheendwhenserializedkeywordprocessingsequence1boxedstring) | validateAndBox(String, configuration: SchemaConfiguration) | +| [IfAppearsAtTheEndWhenSerializedKeywordProcessingSequence1BoxedVoid](#ifappearsattheendwhenserializedkeywordprocessingsequence1boxedvoid) | validateAndBox(Nothing?, configuration: SchemaConfiguration) | +| [IfAppearsAtTheEndWhenSerializedKeywordProcessingSequence1BoxedNumber](#ifappearsattheendwhenserializedkeywordprocessingsequence1boxednumber) | validateAndBox(Number, configuration: SchemaConfiguration) | +| [IfAppearsAtTheEndWhenSerializedKeywordProcessingSequence1BoxedBoolean](#ifappearsattheendwhenserializedkeywordprocessingsequence1boxedboolean) | validateAndBox(boolean, configuration: SchemaConfiguration) | +| [IfAppearsAtTheEndWhenSerializedKeywordProcessingSequence1BoxedMap](#ifappearsattheendwhenserializedkeywordprocessingsequence1boxedmap) | validateAndBox(Map<?, ?>, configuration: SchemaConfiguration) | +| [IfAppearsAtTheEndWhenSerializedKeywordProcessingSequence1BoxedList](#ifappearsattheendwhenserializedkeywordprocessingsequence1boxedlist) | validateAndBox(List<*>, configuration: SchemaConfiguration) | +| [IfAppearsAtTheEndWhenSerializedKeywordProcessingSequence1Boxed](#ifappearsattheendwhenserializedkeywordprocessingsequence1boxed) | validateAndBox(Any?, configuration: SchemaConfiguration) | +| Any? | validate(arg: Any?, configuration: SchemaConfiguration) | + +## ThenBoxed +sealed interface ThenBoxed
    +permits
    +[ThenBoxedVoid](#thenboxedvoid), +[ThenBoxedBoolean](#thenboxedboolean), +[ThenBoxedNumber](#thenboxednumber), +[ThenBoxedString](#thenboxedstring), +[ThenBoxedList](#thenboxedlist), +[ThenBoxedMap](#thenboxedmap) + +sealed interface that stores validated payloads using boxed classes + +## ThenBoxedVoid +data class ThenBoxedVoid
    +implements [ThenBoxed](#thenboxed) + +data class that stores validated null payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| ThenBoxedVoid(Nothing? data)
    Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| Nothing? | data()
    validated payload | +| Any? | getData()
    validated payload | + +## ThenBoxedBoolean +data class ThenBoxedBoolean
    +implements [ThenBoxed](#thenboxed) + +record that stores validated boolean payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| ThenBoxedBoolean(boolean data)
    Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| boolean | data()
    validated payload | +| Any? | getData()
    validated payload | + +## ThenBoxedNumber +data class ThenBoxedNumber
    +implements [ThenBoxed](#thenboxed) + +data class that stores validated Number payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| ThenBoxedNumber(Number data)
    Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| Number | data()
    validated payload | +| Any? | getData()
    validated payload | + +## ThenBoxedString +data class ThenBoxedString
    +implements [ThenBoxed](#thenboxed) + +data class that stores validated String payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| ThenBoxedString(String data)
    Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| String | data()
    validated payload | +| Any? | getData()
    validated payload | + +## ThenBoxedList +data class ThenBoxedList
    +implements [ThenBoxed](#thenboxed) + +data class that stores validated List payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| ThenBoxedList(FrozenList data)
    Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| FrozenList | data()
    validated payload | +| Any? | getData()
    validated payload | + +## ThenBoxedMap +data class ThenBoxedMap
    +implements [ThenBoxed](#thenboxed) + +data class that stores validated Map payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| ThenBoxedMap(FrozenMap data)
    Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| FrozenMap | data()
    validated payload | +| Any? | getData()
    validated payload | + +## Then +class Then
    +extends JsonSchema + +A schema class that validates payloads + +### Field Summary +| Modifier and Type | Field and Description | +| ----------------- | ---------------------- | +| Any? | constValue = "yes" | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| String | validate(arg: String, configuration: SchemaConfiguration) | +| Nothing? | validate(arg: Nothing?, configuration: SchemaConfiguration) | +| int | validate(arg: int, configuration: SchemaConfiguration) | +| long | validate(arg: long, configuration: SchemaConfiguration) | +| float | validate(arg: float, configuration: SchemaConfiguration) | +| double | validate(arg: double, configuration: SchemaConfiguration) | +| Number | validate(arg: Number, configuration: SchemaConfiguration) | +| boolean | validate(arg: boolean, configuration: SchemaConfiguration) | +| FrozenMap | validate(arg: Map<?, ?>, configuration: SchemaConfiguration) | +| FrozenList | validate(arg: List<*>, configuration: SchemaConfiguration) | +| [ThenBoxedString](#thenboxedstring) | validateAndBox(String, configuration: SchemaConfiguration) | +| [ThenBoxedVoid](#thenboxedvoid) | validateAndBox(Nothing?, configuration: SchemaConfiguration) | +| [ThenBoxedNumber](#thenboxednumber) | validateAndBox(Number, configuration: SchemaConfiguration) | +| [ThenBoxedBoolean](#thenboxedboolean) | validateAndBox(boolean, configuration: SchemaConfiguration) | +| [ThenBoxedMap](#thenboxedmap) | validateAndBox(Map<?, ?>, configuration: SchemaConfiguration) | +| [ThenBoxedList](#thenboxedlist) | validateAndBox(List<*>, configuration: SchemaConfiguration) | +| [ThenBoxed](#thenboxed) | validateAndBox(Any?, configuration: SchemaConfiguration) | +| Any? | validate(arg: Any?, configuration: SchemaConfiguration) | + +## StringThenConst +public enum StringThenConst
    +extends `Enum` + +A class that stores String enum values + +### Enum Constant Summary +| Enum Constant | Description | +| ------------- | ----------- | +| YES | value = "yes" | + +## IfSchemaBoxed +sealed interface IfSchemaBoxed
    +permits
    +[IfSchemaBoxedVoid](#ifschemaboxedvoid), +[IfSchemaBoxedBoolean](#ifschemaboxedboolean), +[IfSchemaBoxedNumber](#ifschemaboxednumber), +[IfSchemaBoxedString](#ifschemaboxedstring), +[IfSchemaBoxedList](#ifschemaboxedlist), +[IfSchemaBoxedMap](#ifschemaboxedmap) + +sealed interface that stores validated payloads using boxed classes + +## IfSchemaBoxedVoid +data class IfSchemaBoxedVoid
    +implements [IfSchemaBoxed](#ifschemaboxed) + +data class that stores validated null payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| IfSchemaBoxedVoid(Nothing? data)
    Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| Nothing? | data()
    validated payload | +| Any? | getData()
    validated payload | + +## IfSchemaBoxedBoolean +data class IfSchemaBoxedBoolean
    +implements [IfSchemaBoxed](#ifschemaboxed) + +record that stores validated boolean payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| IfSchemaBoxedBoolean(boolean data)
    Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| boolean | data()
    validated payload | +| Any? | getData()
    validated payload | + +## IfSchemaBoxedNumber +data class IfSchemaBoxedNumber
    +implements [IfSchemaBoxed](#ifschemaboxed) + +data class that stores validated Number payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| IfSchemaBoxedNumber(Number data)
    Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| Number | data()
    validated payload | +| Any? | getData()
    validated payload | + +## IfSchemaBoxedString +data class IfSchemaBoxedString
    +implements [IfSchemaBoxed](#ifschemaboxed) + +data class that stores validated String payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| IfSchemaBoxedString(String data)
    Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| String | data()
    validated payload | +| Any? | getData()
    validated payload | + +## IfSchemaBoxedList +data class IfSchemaBoxedList
    +implements [IfSchemaBoxed](#ifschemaboxed) + +data class that stores validated List payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| IfSchemaBoxedList(FrozenList data)
    Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| FrozenList | data()
    validated payload | +| Any? | getData()
    validated payload | + +## IfSchemaBoxedMap +data class IfSchemaBoxedMap
    +implements [IfSchemaBoxed](#ifschemaboxed) + +data class that stores validated Map payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| IfSchemaBoxedMap(FrozenMap data)
    Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| FrozenMap | data()
    validated payload | +| Any? | getData()
    validated payload | + +## IfSchema +class IfSchema
    +extends JsonSchema + +A schema class that validates payloads + +### Field Summary +| Modifier and Type | Field and Description | +| ----------------- | ---------------------- | +| Integer | maxLength = 4 | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| String | validate(arg: String, configuration: SchemaConfiguration) | +| Nothing? | validate(arg: Nothing?, configuration: SchemaConfiguration) | +| int | validate(arg: int, configuration: SchemaConfiguration) | +| long | validate(arg: long, configuration: SchemaConfiguration) | +| float | validate(arg: float, configuration: SchemaConfiguration) | +| double | validate(arg: double, configuration: SchemaConfiguration) | +| Number | validate(arg: Number, configuration: SchemaConfiguration) | +| boolean | validate(arg: boolean, configuration: SchemaConfiguration) | +| FrozenMap | validate(arg: Map<?, ?>, configuration: SchemaConfiguration) | +| FrozenList | validate(arg: List<*>, configuration: SchemaConfiguration) | +| [IfSchemaBoxedString](#ifschemaboxedstring) | validateAndBox(String, configuration: SchemaConfiguration) | +| [IfSchemaBoxedVoid](#ifschemaboxedvoid) | validateAndBox(Nothing?, configuration: SchemaConfiguration) | +| [IfSchemaBoxedNumber](#ifschemaboxednumber) | validateAndBox(Number, configuration: SchemaConfiguration) | +| [IfSchemaBoxedBoolean](#ifschemaboxedboolean) | validateAndBox(boolean, configuration: SchemaConfiguration) | +| [IfSchemaBoxedMap](#ifschemaboxedmap) | validateAndBox(Map<?, ?>, configuration: SchemaConfiguration) | +| [IfSchemaBoxedList](#ifschemaboxedlist) | validateAndBox(List<*>, configuration: SchemaConfiguration) | +| [IfSchemaBoxed](#ifschemaboxed) | validateAndBox(Any?, configuration: SchemaConfiguration) | +| Any? | validate(arg: Any?, configuration: SchemaConfiguration) | + +## ElseSchemaBoxed +sealed interface ElseSchemaBoxed
    +permits
    +[ElseSchemaBoxedVoid](#elseschemaboxedvoid), +[ElseSchemaBoxedBoolean](#elseschemaboxedboolean), +[ElseSchemaBoxedNumber](#elseschemaboxednumber), +[ElseSchemaBoxedString](#elseschemaboxedstring), +[ElseSchemaBoxedList](#elseschemaboxedlist), +[ElseSchemaBoxedMap](#elseschemaboxedmap) + +sealed interface that stores validated payloads using boxed classes + +## ElseSchemaBoxedVoid +data class ElseSchemaBoxedVoid
    +implements [ElseSchemaBoxed](#elseschemaboxed) + +data class that stores validated null payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| ElseSchemaBoxedVoid(Nothing? data)
    Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| Nothing? | data()
    validated payload | +| Any? | getData()
    validated payload | + +## ElseSchemaBoxedBoolean +data class ElseSchemaBoxedBoolean
    +implements [ElseSchemaBoxed](#elseschemaboxed) + +record that stores validated boolean payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| ElseSchemaBoxedBoolean(boolean data)
    Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| boolean | data()
    validated payload | +| Any? | getData()
    validated payload | + +## ElseSchemaBoxedNumber +data class ElseSchemaBoxedNumber
    +implements [ElseSchemaBoxed](#elseschemaboxed) + +data class that stores validated Number payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| ElseSchemaBoxedNumber(Number data)
    Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| Number | data()
    validated payload | +| Any? | getData()
    validated payload | + +## ElseSchemaBoxedString +data class ElseSchemaBoxedString
    +implements [ElseSchemaBoxed](#elseschemaboxed) + +data class that stores validated String payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| ElseSchemaBoxedString(String data)
    Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| String | data()
    validated payload | +| Any? | getData()
    validated payload | + +## ElseSchemaBoxedList +data class ElseSchemaBoxedList
    +implements [ElseSchemaBoxed](#elseschemaboxed) + +data class that stores validated List payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| ElseSchemaBoxedList(FrozenList data)
    Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| FrozenList | data()
    validated payload | +| Any? | getData()
    validated payload | + +## ElseSchemaBoxedMap +data class ElseSchemaBoxedMap
    +implements [ElseSchemaBoxed](#elseschemaboxed) + +data class that stores validated Map payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| ElseSchemaBoxedMap(FrozenMap data)
    Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| FrozenMap | data()
    validated payload | +| Any? | getData()
    validated payload | + +## ElseSchema +class ElseSchema
    +extends JsonSchema + +A schema class that validates payloads + +### Field Summary +| Modifier and Type | Field and Description | +| ----------------- | ---------------------- | +| Any? | constValue = "other" | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| String | validate(arg: String, configuration: SchemaConfiguration) | +| Nothing? | validate(arg: Nothing?, configuration: SchemaConfiguration) | +| int | validate(arg: int, configuration: SchemaConfiguration) | +| long | validate(arg: long, configuration: SchemaConfiguration) | +| float | validate(arg: float, configuration: SchemaConfiguration) | +| double | validate(arg: double, configuration: SchemaConfiguration) | +| Number | validate(arg: Number, configuration: SchemaConfiguration) | +| boolean | validate(arg: boolean, configuration: SchemaConfiguration) | +| FrozenMap | validate(arg: Map<?, ?>, configuration: SchemaConfiguration) | +| FrozenList | validate(arg: List<*>, configuration: SchemaConfiguration) | +| [ElseSchemaBoxedString](#elseschemaboxedstring) | validateAndBox(String, configuration: SchemaConfiguration) | +| [ElseSchemaBoxedVoid](#elseschemaboxedvoid) | validateAndBox(Nothing?, configuration: SchemaConfiguration) | +| [ElseSchemaBoxedNumber](#elseschemaboxednumber) | validateAndBox(Number, configuration: SchemaConfiguration) | +| [ElseSchemaBoxedBoolean](#elseschemaboxedboolean) | validateAndBox(boolean, configuration: SchemaConfiguration) | +| [ElseSchemaBoxedMap](#elseschemaboxedmap) | validateAndBox(Map<?, ?>, configuration: SchemaConfiguration) | +| [ElseSchemaBoxedList](#elseschemaboxedlist) | validateAndBox(List<*>, configuration: SchemaConfiguration) | +| [ElseSchemaBoxed](#elseschemaboxed) | validateAndBox(Any?, configuration: SchemaConfiguration) | +| Any? | validate(arg: Any?, configuration: SchemaConfiguration) | + +## StringElseConst +public enum StringElseConst
    +extends `Enum` + +A class that stores String enum values + +### Enum Constant Summary +| Enum Constant | Description | +| ------------- | ----------- | +| OTHER | value = "other" | + +[[Back to top]](#top) [[Back to Component Schemas]](../../../README.md#Component-Schemas) [[Back to README]](../../../README.md) diff --git a/samples/client/3_1_0_unit_test/kotlin/docs/components/schemas/IgnoreElseWithoutIf.md b/samples/client/3_1_0_unit_test/kotlin/docs/components/schemas/IgnoreElseWithoutIf.md new file mode 100644 index 00000000000..c0103ee93df --- /dev/null +++ b/samples/client/3_1_0_unit_test/kotlin/docs/components/schemas/IgnoreElseWithoutIf.md @@ -0,0 +1,337 @@ +# IgnoreElseWithoutIf +org.openapijsonschematools.client.components.schemas.IgnoreElseWithoutIf.java +class IgnoreElseWithoutIf
    + +A class that contains necessary nested +- schema classes (which validate payloads), extends JsonSchema +- sealed interfaces which store validated payloads, Kotlin version of a sum type +- boxed classes which store validated payloads, sealed permits class implementations +- enum classes + +## Nested Class Summary +| Modifier and Type | Class and Description | +| ----------------- | ---------------------- | +| sealed interface | [IgnoreElseWithoutIf.IgnoreElseWithoutIf1Boxed](#ignoreelsewithoutif1boxed)
    sealed interface for validated payloads | +| record | [IgnoreElseWithoutIf.IgnoreElseWithoutIf1BoxedVoid](#ignoreelsewithoutif1boxedvoid)
    boxed class to store validated null payloads | +| record | [IgnoreElseWithoutIf.IgnoreElseWithoutIf1BoxedBoolean](#ignoreelsewithoutif1boxedboolean)
    boxed class to store validated boolean payloads | +| record | [IgnoreElseWithoutIf.IgnoreElseWithoutIf1BoxedNumber](#ignoreelsewithoutif1boxednumber)
    boxed class to store validated Number payloads | +| record | [IgnoreElseWithoutIf.IgnoreElseWithoutIf1BoxedString](#ignoreelsewithoutif1boxedstring)
    boxed class to store validated String payloads | +| record | [IgnoreElseWithoutIf.IgnoreElseWithoutIf1BoxedList](#ignoreelsewithoutif1boxedlist)
    boxed class to store validated List payloads | +| record | [IgnoreElseWithoutIf.IgnoreElseWithoutIf1BoxedMap](#ignoreelsewithoutif1boxedmap)
    boxed class to store validated Map payloads | +| static class | [IgnoreElseWithoutIf.IgnoreElseWithoutIf1](#ignoreelsewithoutif1)
    schema class | +| sealed interface | [IgnoreElseWithoutIf.ElseSchemaBoxed](#elseschemaboxed)
    sealed interface for validated payloads | +| record | [IgnoreElseWithoutIf.ElseSchemaBoxedVoid](#elseschemaboxedvoid)
    boxed class to store validated null payloads | +| record | [IgnoreElseWithoutIf.ElseSchemaBoxedBoolean](#elseschemaboxedboolean)
    boxed class to store validated boolean payloads | +| record | [IgnoreElseWithoutIf.ElseSchemaBoxedNumber](#elseschemaboxednumber)
    boxed class to store validated Number payloads | +| record | [IgnoreElseWithoutIf.ElseSchemaBoxedString](#elseschemaboxedstring)
    boxed class to store validated String payloads | +| record | [IgnoreElseWithoutIf.ElseSchemaBoxedList](#elseschemaboxedlist)
    boxed class to store validated List payloads | +| record | [IgnoreElseWithoutIf.ElseSchemaBoxedMap](#elseschemaboxedmap)
    boxed class to store validated Map payloads | +| static class | [IgnoreElseWithoutIf.ElseSchema](#elseschema)
    schema class | +| enum | [IgnoreElseWithoutIf.StringElseConst](#stringelseconst)
    String enum | + +## IgnoreElseWithoutIf1Boxed +sealed interface IgnoreElseWithoutIf1Boxed
    +permits
    +[IgnoreElseWithoutIf1BoxedVoid](#ignoreelsewithoutif1boxedvoid), +[IgnoreElseWithoutIf1BoxedBoolean](#ignoreelsewithoutif1boxedboolean), +[IgnoreElseWithoutIf1BoxedNumber](#ignoreelsewithoutif1boxednumber), +[IgnoreElseWithoutIf1BoxedString](#ignoreelsewithoutif1boxedstring), +[IgnoreElseWithoutIf1BoxedList](#ignoreelsewithoutif1boxedlist), +[IgnoreElseWithoutIf1BoxedMap](#ignoreelsewithoutif1boxedmap) + +sealed interface that stores validated payloads using boxed classes + +## IgnoreElseWithoutIf1BoxedVoid +data class IgnoreElseWithoutIf1BoxedVoid
    +implements [IgnoreElseWithoutIf1Boxed](#ignoreelsewithoutif1boxed) + +data class that stores validated null payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| IgnoreElseWithoutIf1BoxedVoid(Nothing? data)
    Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| Nothing? | data()
    validated payload | +| Any? | getData()
    validated payload | + +## IgnoreElseWithoutIf1BoxedBoolean +data class IgnoreElseWithoutIf1BoxedBoolean
    +implements [IgnoreElseWithoutIf1Boxed](#ignoreelsewithoutif1boxed) + +record that stores validated boolean payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| IgnoreElseWithoutIf1BoxedBoolean(boolean data)
    Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| boolean | data()
    validated payload | +| Any? | getData()
    validated payload | + +## IgnoreElseWithoutIf1BoxedNumber +data class IgnoreElseWithoutIf1BoxedNumber
    +implements [IgnoreElseWithoutIf1Boxed](#ignoreelsewithoutif1boxed) + +data class that stores validated Number payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| IgnoreElseWithoutIf1BoxedNumber(Number data)
    Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| Number | data()
    validated payload | +| Any? | getData()
    validated payload | + +## IgnoreElseWithoutIf1BoxedString +data class IgnoreElseWithoutIf1BoxedString
    +implements [IgnoreElseWithoutIf1Boxed](#ignoreelsewithoutif1boxed) + +data class that stores validated String payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| IgnoreElseWithoutIf1BoxedString(String data)
    Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| String | data()
    validated payload | +| Any? | getData()
    validated payload | + +## IgnoreElseWithoutIf1BoxedList +data class IgnoreElseWithoutIf1BoxedList
    +implements [IgnoreElseWithoutIf1Boxed](#ignoreelsewithoutif1boxed) + +data class that stores validated List payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| IgnoreElseWithoutIf1BoxedList(FrozenList data)
    Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| FrozenList | data()
    validated payload | +| Any? | getData()
    validated payload | + +## IgnoreElseWithoutIf1BoxedMap +data class IgnoreElseWithoutIf1BoxedMap
    +implements [IgnoreElseWithoutIf1Boxed](#ignoreelsewithoutif1boxed) + +data class that stores validated Map payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| IgnoreElseWithoutIf1BoxedMap(FrozenMap data)
    Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| FrozenMap | data()
    validated payload | +| Any? | getData()
    validated payload | + +## IgnoreElseWithoutIf1 +class IgnoreElseWithoutIf1
    +extends JsonSchema + +A schema class that validates payloads + +### Field Summary +| Modifier and Type | Field and Description | +| ----------------- | ---------------------- | +| Class | elseSchema = [ElseSchema::class.java](#elseschema) | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| String | validate(arg: String, configuration: SchemaConfiguration) | +| Nothing? | validate(arg: Nothing?, configuration: SchemaConfiguration) | +| int | validate(arg: int, configuration: SchemaConfiguration) | +| long | validate(arg: long, configuration: SchemaConfiguration) | +| float | validate(arg: float, configuration: SchemaConfiguration) | +| double | validate(arg: double, configuration: SchemaConfiguration) | +| Number | validate(arg: Number, configuration: SchemaConfiguration) | +| boolean | validate(arg: boolean, configuration: SchemaConfiguration) | +| FrozenMap | validate(arg: Map<?, ?>, configuration: SchemaConfiguration) | +| FrozenList | validate(arg: List<*>, configuration: SchemaConfiguration) | +| [IgnoreElseWithoutIf1BoxedString](#ignoreelsewithoutif1boxedstring) | validateAndBox(String, configuration: SchemaConfiguration) | +| [IgnoreElseWithoutIf1BoxedVoid](#ignoreelsewithoutif1boxedvoid) | validateAndBox(Nothing?, configuration: SchemaConfiguration) | +| [IgnoreElseWithoutIf1BoxedNumber](#ignoreelsewithoutif1boxednumber) | validateAndBox(Number, configuration: SchemaConfiguration) | +| [IgnoreElseWithoutIf1BoxedBoolean](#ignoreelsewithoutif1boxedboolean) | validateAndBox(boolean, configuration: SchemaConfiguration) | +| [IgnoreElseWithoutIf1BoxedMap](#ignoreelsewithoutif1boxedmap) | validateAndBox(Map<?, ?>, configuration: SchemaConfiguration) | +| [IgnoreElseWithoutIf1BoxedList](#ignoreelsewithoutif1boxedlist) | validateAndBox(List<*>, configuration: SchemaConfiguration) | +| [IgnoreElseWithoutIf1Boxed](#ignoreelsewithoutif1boxed) | validateAndBox(Any?, configuration: SchemaConfiguration) | +| Any? | validate(arg: Any?, configuration: SchemaConfiguration) | + +## ElseSchemaBoxed +sealed interface ElseSchemaBoxed
    +permits
    +[ElseSchemaBoxedVoid](#elseschemaboxedvoid), +[ElseSchemaBoxedBoolean](#elseschemaboxedboolean), +[ElseSchemaBoxedNumber](#elseschemaboxednumber), +[ElseSchemaBoxedString](#elseschemaboxedstring), +[ElseSchemaBoxedList](#elseschemaboxedlist), +[ElseSchemaBoxedMap](#elseschemaboxedmap) + +sealed interface that stores validated payloads using boxed classes + +## ElseSchemaBoxedVoid +data class ElseSchemaBoxedVoid
    +implements [ElseSchemaBoxed](#elseschemaboxed) + +data class that stores validated null payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| ElseSchemaBoxedVoid(Nothing? data)
    Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| Nothing? | data()
    validated payload | +| Any? | getData()
    validated payload | + +## ElseSchemaBoxedBoolean +data class ElseSchemaBoxedBoolean
    +implements [ElseSchemaBoxed](#elseschemaboxed) + +record that stores validated boolean payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| ElseSchemaBoxedBoolean(boolean data)
    Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| boolean | data()
    validated payload | +| Any? | getData()
    validated payload | + +## ElseSchemaBoxedNumber +data class ElseSchemaBoxedNumber
    +implements [ElseSchemaBoxed](#elseschemaboxed) + +data class that stores validated Number payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| ElseSchemaBoxedNumber(Number data)
    Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| Number | data()
    validated payload | +| Any? | getData()
    validated payload | + +## ElseSchemaBoxedString +data class ElseSchemaBoxedString
    +implements [ElseSchemaBoxed](#elseschemaboxed) + +data class that stores validated String payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| ElseSchemaBoxedString(String data)
    Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| String | data()
    validated payload | +| Any? | getData()
    validated payload | + +## ElseSchemaBoxedList +data class ElseSchemaBoxedList
    +implements [ElseSchemaBoxed](#elseschemaboxed) + +data class that stores validated List payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| ElseSchemaBoxedList(FrozenList data)
    Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| FrozenList | data()
    validated payload | +| Any? | getData()
    validated payload | + +## ElseSchemaBoxedMap +data class ElseSchemaBoxedMap
    +implements [ElseSchemaBoxed](#elseschemaboxed) + +data class that stores validated Map payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| ElseSchemaBoxedMap(FrozenMap data)
    Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| FrozenMap | data()
    validated payload | +| Any? | getData()
    validated payload | + +## ElseSchema +class ElseSchema
    +extends JsonSchema + +A schema class that validates payloads + +### Field Summary +| Modifier and Type | Field and Description | +| ----------------- | ---------------------- | +| Any? | constValue = "0" | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| String | validate(arg: String, configuration: SchemaConfiguration) | +| Nothing? | validate(arg: Nothing?, configuration: SchemaConfiguration) | +| int | validate(arg: int, configuration: SchemaConfiguration) | +| long | validate(arg: long, configuration: SchemaConfiguration) | +| float | validate(arg: float, configuration: SchemaConfiguration) | +| double | validate(arg: double, configuration: SchemaConfiguration) | +| Number | validate(arg: Number, configuration: SchemaConfiguration) | +| boolean | validate(arg: boolean, configuration: SchemaConfiguration) | +| FrozenMap | validate(arg: Map<?, ?>, configuration: SchemaConfiguration) | +| FrozenList | validate(arg: List<*>, configuration: SchemaConfiguration) | +| [ElseSchemaBoxedString](#elseschemaboxedstring) | validateAndBox(String, configuration: SchemaConfiguration) | +| [ElseSchemaBoxedVoid](#elseschemaboxedvoid) | validateAndBox(Nothing?, configuration: SchemaConfiguration) | +| [ElseSchemaBoxedNumber](#elseschemaboxednumber) | validateAndBox(Number, configuration: SchemaConfiguration) | +| [ElseSchemaBoxedBoolean](#elseschemaboxedboolean) | validateAndBox(boolean, configuration: SchemaConfiguration) | +| [ElseSchemaBoxedMap](#elseschemaboxedmap) | validateAndBox(Map<?, ?>, configuration: SchemaConfiguration) | +| [ElseSchemaBoxedList](#elseschemaboxedlist) | validateAndBox(List<*>, configuration: SchemaConfiguration) | +| [ElseSchemaBoxed](#elseschemaboxed) | validateAndBox(Any?, configuration: SchemaConfiguration) | +| Any? | validate(arg: Any?, configuration: SchemaConfiguration) | + +## StringElseConst +public enum StringElseConst
    +extends `Enum` + +A class that stores String enum values + +### Enum Constant Summary +| Enum Constant | Description | +| ------------- | ----------- | +| POSITIVE_0 | value = "0" | + +[[Back to top]](#top) [[Back to Component Schemas]](../../../README.md#Component-Schemas) [[Back to README]](../../../README.md) diff --git a/samples/client/3_1_0_unit_test/kotlin/docs/components/schemas/IgnoreIfWithoutThenOrElse.md b/samples/client/3_1_0_unit_test/kotlin/docs/components/schemas/IgnoreIfWithoutThenOrElse.md new file mode 100644 index 00000000000..d0c00d7da34 --- /dev/null +++ b/samples/client/3_1_0_unit_test/kotlin/docs/components/schemas/IgnoreIfWithoutThenOrElse.md @@ -0,0 +1,337 @@ +# IgnoreIfWithoutThenOrElse +org.openapijsonschematools.client.components.schemas.IgnoreIfWithoutThenOrElse.java +class IgnoreIfWithoutThenOrElse
    + +A class that contains necessary nested +- schema classes (which validate payloads), extends JsonSchema +- sealed interfaces which store validated payloads, Kotlin version of a sum type +- boxed classes which store validated payloads, sealed permits class implementations +- enum classes + +## Nested Class Summary +| Modifier and Type | Class and Description | +| ----------------- | ---------------------- | +| sealed interface | [IgnoreIfWithoutThenOrElse.IgnoreIfWithoutThenOrElse1Boxed](#ignoreifwithoutthenorelse1boxed)
    sealed interface for validated payloads | +| record | [IgnoreIfWithoutThenOrElse.IgnoreIfWithoutThenOrElse1BoxedVoid](#ignoreifwithoutthenorelse1boxedvoid)
    boxed class to store validated null payloads | +| record | [IgnoreIfWithoutThenOrElse.IgnoreIfWithoutThenOrElse1BoxedBoolean](#ignoreifwithoutthenorelse1boxedboolean)
    boxed class to store validated boolean payloads | +| record | [IgnoreIfWithoutThenOrElse.IgnoreIfWithoutThenOrElse1BoxedNumber](#ignoreifwithoutthenorelse1boxednumber)
    boxed class to store validated Number payloads | +| record | [IgnoreIfWithoutThenOrElse.IgnoreIfWithoutThenOrElse1BoxedString](#ignoreifwithoutthenorelse1boxedstring)
    boxed class to store validated String payloads | +| record | [IgnoreIfWithoutThenOrElse.IgnoreIfWithoutThenOrElse1BoxedList](#ignoreifwithoutthenorelse1boxedlist)
    boxed class to store validated List payloads | +| record | [IgnoreIfWithoutThenOrElse.IgnoreIfWithoutThenOrElse1BoxedMap](#ignoreifwithoutthenorelse1boxedmap)
    boxed class to store validated Map payloads | +| static class | [IgnoreIfWithoutThenOrElse.IgnoreIfWithoutThenOrElse1](#ignoreifwithoutthenorelse1)
    schema class | +| sealed interface | [IgnoreIfWithoutThenOrElse.IfSchemaBoxed](#ifschemaboxed)
    sealed interface for validated payloads | +| record | [IgnoreIfWithoutThenOrElse.IfSchemaBoxedVoid](#ifschemaboxedvoid)
    boxed class to store validated null payloads | +| record | [IgnoreIfWithoutThenOrElse.IfSchemaBoxedBoolean](#ifschemaboxedboolean)
    boxed class to store validated boolean payloads | +| record | [IgnoreIfWithoutThenOrElse.IfSchemaBoxedNumber](#ifschemaboxednumber)
    boxed class to store validated Number payloads | +| record | [IgnoreIfWithoutThenOrElse.IfSchemaBoxedString](#ifschemaboxedstring)
    boxed class to store validated String payloads | +| record | [IgnoreIfWithoutThenOrElse.IfSchemaBoxedList](#ifschemaboxedlist)
    boxed class to store validated List payloads | +| record | [IgnoreIfWithoutThenOrElse.IfSchemaBoxedMap](#ifschemaboxedmap)
    boxed class to store validated Map payloads | +| static class | [IgnoreIfWithoutThenOrElse.IfSchema](#ifschema)
    schema class | +| enum | [IgnoreIfWithoutThenOrElse.StringIfConst](#stringifconst)
    String enum | + +## IgnoreIfWithoutThenOrElse1Boxed +sealed interface IgnoreIfWithoutThenOrElse1Boxed
    +permits
    +[IgnoreIfWithoutThenOrElse1BoxedVoid](#ignoreifwithoutthenorelse1boxedvoid), +[IgnoreIfWithoutThenOrElse1BoxedBoolean](#ignoreifwithoutthenorelse1boxedboolean), +[IgnoreIfWithoutThenOrElse1BoxedNumber](#ignoreifwithoutthenorelse1boxednumber), +[IgnoreIfWithoutThenOrElse1BoxedString](#ignoreifwithoutthenorelse1boxedstring), +[IgnoreIfWithoutThenOrElse1BoxedList](#ignoreifwithoutthenorelse1boxedlist), +[IgnoreIfWithoutThenOrElse1BoxedMap](#ignoreifwithoutthenorelse1boxedmap) + +sealed interface that stores validated payloads using boxed classes + +## IgnoreIfWithoutThenOrElse1BoxedVoid +data class IgnoreIfWithoutThenOrElse1BoxedVoid
    +implements [IgnoreIfWithoutThenOrElse1Boxed](#ignoreifwithoutthenorelse1boxed) + +data class that stores validated null payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| IgnoreIfWithoutThenOrElse1BoxedVoid(Nothing? data)
    Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| Nothing? | data()
    validated payload | +| Any? | getData()
    validated payload | + +## IgnoreIfWithoutThenOrElse1BoxedBoolean +data class IgnoreIfWithoutThenOrElse1BoxedBoolean
    +implements [IgnoreIfWithoutThenOrElse1Boxed](#ignoreifwithoutthenorelse1boxed) + +record that stores validated boolean payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| IgnoreIfWithoutThenOrElse1BoxedBoolean(boolean data)
    Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| boolean | data()
    validated payload | +| Any? | getData()
    validated payload | + +## IgnoreIfWithoutThenOrElse1BoxedNumber +data class IgnoreIfWithoutThenOrElse1BoxedNumber
    +implements [IgnoreIfWithoutThenOrElse1Boxed](#ignoreifwithoutthenorelse1boxed) + +data class that stores validated Number payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| IgnoreIfWithoutThenOrElse1BoxedNumber(Number data)
    Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| Number | data()
    validated payload | +| Any? | getData()
    validated payload | + +## IgnoreIfWithoutThenOrElse1BoxedString +data class IgnoreIfWithoutThenOrElse1BoxedString
    +implements [IgnoreIfWithoutThenOrElse1Boxed](#ignoreifwithoutthenorelse1boxed) + +data class that stores validated String payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| IgnoreIfWithoutThenOrElse1BoxedString(String data)
    Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| String | data()
    validated payload | +| Any? | getData()
    validated payload | + +## IgnoreIfWithoutThenOrElse1BoxedList +data class IgnoreIfWithoutThenOrElse1BoxedList
    +implements [IgnoreIfWithoutThenOrElse1Boxed](#ignoreifwithoutthenorelse1boxed) + +data class that stores validated List payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| IgnoreIfWithoutThenOrElse1BoxedList(FrozenList data)
    Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| FrozenList | data()
    validated payload | +| Any? | getData()
    validated payload | + +## IgnoreIfWithoutThenOrElse1BoxedMap +data class IgnoreIfWithoutThenOrElse1BoxedMap
    +implements [IgnoreIfWithoutThenOrElse1Boxed](#ignoreifwithoutthenorelse1boxed) + +data class that stores validated Map payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| IgnoreIfWithoutThenOrElse1BoxedMap(FrozenMap data)
    Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| FrozenMap | data()
    validated payload | +| Any? | getData()
    validated payload | + +## IgnoreIfWithoutThenOrElse1 +class IgnoreIfWithoutThenOrElse1
    +extends JsonSchema + +A schema class that validates payloads + +### Field Summary +| Modifier and Type | Field and Description | +| ----------------- | ---------------------- | +| Class | if = [IfSchema::class.java](#ifschema) | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| String | validate(arg: String, configuration: SchemaConfiguration) | +| Nothing? | validate(arg: Nothing?, configuration: SchemaConfiguration) | +| int | validate(arg: int, configuration: SchemaConfiguration) | +| long | validate(arg: long, configuration: SchemaConfiguration) | +| float | validate(arg: float, configuration: SchemaConfiguration) | +| double | validate(arg: double, configuration: SchemaConfiguration) | +| Number | validate(arg: Number, configuration: SchemaConfiguration) | +| boolean | validate(arg: boolean, configuration: SchemaConfiguration) | +| FrozenMap | validate(arg: Map<?, ?>, configuration: SchemaConfiguration) | +| FrozenList | validate(arg: List<*>, configuration: SchemaConfiguration) | +| [IgnoreIfWithoutThenOrElse1BoxedString](#ignoreifwithoutthenorelse1boxedstring) | validateAndBox(String, configuration: SchemaConfiguration) | +| [IgnoreIfWithoutThenOrElse1BoxedVoid](#ignoreifwithoutthenorelse1boxedvoid) | validateAndBox(Nothing?, configuration: SchemaConfiguration) | +| [IgnoreIfWithoutThenOrElse1BoxedNumber](#ignoreifwithoutthenorelse1boxednumber) | validateAndBox(Number, configuration: SchemaConfiguration) | +| [IgnoreIfWithoutThenOrElse1BoxedBoolean](#ignoreifwithoutthenorelse1boxedboolean) | validateAndBox(boolean, configuration: SchemaConfiguration) | +| [IgnoreIfWithoutThenOrElse1BoxedMap](#ignoreifwithoutthenorelse1boxedmap) | validateAndBox(Map<?, ?>, configuration: SchemaConfiguration) | +| [IgnoreIfWithoutThenOrElse1BoxedList](#ignoreifwithoutthenorelse1boxedlist) | validateAndBox(List<*>, configuration: SchemaConfiguration) | +| [IgnoreIfWithoutThenOrElse1Boxed](#ignoreifwithoutthenorelse1boxed) | validateAndBox(Any?, configuration: SchemaConfiguration) | +| Any? | validate(arg: Any?, configuration: SchemaConfiguration) | + +## IfSchemaBoxed +sealed interface IfSchemaBoxed
    +permits
    +[IfSchemaBoxedVoid](#ifschemaboxedvoid), +[IfSchemaBoxedBoolean](#ifschemaboxedboolean), +[IfSchemaBoxedNumber](#ifschemaboxednumber), +[IfSchemaBoxedString](#ifschemaboxedstring), +[IfSchemaBoxedList](#ifschemaboxedlist), +[IfSchemaBoxedMap](#ifschemaboxedmap) + +sealed interface that stores validated payloads using boxed classes + +## IfSchemaBoxedVoid +data class IfSchemaBoxedVoid
    +implements [IfSchemaBoxed](#ifschemaboxed) + +data class that stores validated null payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| IfSchemaBoxedVoid(Nothing? data)
    Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| Nothing? | data()
    validated payload | +| Any? | getData()
    validated payload | + +## IfSchemaBoxedBoolean +data class IfSchemaBoxedBoolean
    +implements [IfSchemaBoxed](#ifschemaboxed) + +record that stores validated boolean payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| IfSchemaBoxedBoolean(boolean data)
    Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| boolean | data()
    validated payload | +| Any? | getData()
    validated payload | + +## IfSchemaBoxedNumber +data class IfSchemaBoxedNumber
    +implements [IfSchemaBoxed](#ifschemaboxed) + +data class that stores validated Number payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| IfSchemaBoxedNumber(Number data)
    Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| Number | data()
    validated payload | +| Any? | getData()
    validated payload | + +## IfSchemaBoxedString +data class IfSchemaBoxedString
    +implements [IfSchemaBoxed](#ifschemaboxed) + +data class that stores validated String payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| IfSchemaBoxedString(String data)
    Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| String | data()
    validated payload | +| Any? | getData()
    validated payload | + +## IfSchemaBoxedList +data class IfSchemaBoxedList
    +implements [IfSchemaBoxed](#ifschemaboxed) + +data class that stores validated List payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| IfSchemaBoxedList(FrozenList data)
    Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| FrozenList | data()
    validated payload | +| Any? | getData()
    validated payload | + +## IfSchemaBoxedMap +data class IfSchemaBoxedMap
    +implements [IfSchemaBoxed](#ifschemaboxed) + +data class that stores validated Map payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| IfSchemaBoxedMap(FrozenMap data)
    Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| FrozenMap | data()
    validated payload | +| Any? | getData()
    validated payload | + +## IfSchema +class IfSchema
    +extends JsonSchema + +A schema class that validates payloads + +### Field Summary +| Modifier and Type | Field and Description | +| ----------------- | ---------------------- | +| Any? | constValue = "0" | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| String | validate(arg: String, configuration: SchemaConfiguration) | +| Nothing? | validate(arg: Nothing?, configuration: SchemaConfiguration) | +| int | validate(arg: int, configuration: SchemaConfiguration) | +| long | validate(arg: long, configuration: SchemaConfiguration) | +| float | validate(arg: float, configuration: SchemaConfiguration) | +| double | validate(arg: double, configuration: SchemaConfiguration) | +| Number | validate(arg: Number, configuration: SchemaConfiguration) | +| boolean | validate(arg: boolean, configuration: SchemaConfiguration) | +| FrozenMap | validate(arg: Map<?, ?>, configuration: SchemaConfiguration) | +| FrozenList | validate(arg: List<*>, configuration: SchemaConfiguration) | +| [IfSchemaBoxedString](#ifschemaboxedstring) | validateAndBox(String, configuration: SchemaConfiguration) | +| [IfSchemaBoxedVoid](#ifschemaboxedvoid) | validateAndBox(Nothing?, configuration: SchemaConfiguration) | +| [IfSchemaBoxedNumber](#ifschemaboxednumber) | validateAndBox(Number, configuration: SchemaConfiguration) | +| [IfSchemaBoxedBoolean](#ifschemaboxedboolean) | validateAndBox(boolean, configuration: SchemaConfiguration) | +| [IfSchemaBoxedMap](#ifschemaboxedmap) | validateAndBox(Map<?, ?>, configuration: SchemaConfiguration) | +| [IfSchemaBoxedList](#ifschemaboxedlist) | validateAndBox(List<*>, configuration: SchemaConfiguration) | +| [IfSchemaBoxed](#ifschemaboxed) | validateAndBox(Any?, configuration: SchemaConfiguration) | +| Any? | validate(arg: Any?, configuration: SchemaConfiguration) | + +## StringIfConst +public enum StringIfConst
    +extends `Enum` + +A class that stores String enum values + +### Enum Constant Summary +| Enum Constant | Description | +| ------------- | ----------- | +| POSITIVE_0 | value = "0" | + +[[Back to top]](#top) [[Back to Component Schemas]](../../../README.md#Component-Schemas) [[Back to README]](../../../README.md) diff --git a/samples/client/3_1_0_unit_test/kotlin/docs/components/schemas/IgnoreThenWithoutIf.md b/samples/client/3_1_0_unit_test/kotlin/docs/components/schemas/IgnoreThenWithoutIf.md new file mode 100644 index 00000000000..fb5782aefc5 --- /dev/null +++ b/samples/client/3_1_0_unit_test/kotlin/docs/components/schemas/IgnoreThenWithoutIf.md @@ -0,0 +1,337 @@ +# IgnoreThenWithoutIf +org.openapijsonschematools.client.components.schemas.IgnoreThenWithoutIf.java +class IgnoreThenWithoutIf
    + +A class that contains necessary nested +- schema classes (which validate payloads), extends JsonSchema +- sealed interfaces which store validated payloads, Kotlin version of a sum type +- boxed classes which store validated payloads, sealed permits class implementations +- enum classes + +## Nested Class Summary +| Modifier and Type | Class and Description | +| ----------------- | ---------------------- | +| sealed interface | [IgnoreThenWithoutIf.IgnoreThenWithoutIf1Boxed](#ignorethenwithoutif1boxed)
    sealed interface for validated payloads | +| record | [IgnoreThenWithoutIf.IgnoreThenWithoutIf1BoxedVoid](#ignorethenwithoutif1boxedvoid)
    boxed class to store validated null payloads | +| record | [IgnoreThenWithoutIf.IgnoreThenWithoutIf1BoxedBoolean](#ignorethenwithoutif1boxedboolean)
    boxed class to store validated boolean payloads | +| record | [IgnoreThenWithoutIf.IgnoreThenWithoutIf1BoxedNumber](#ignorethenwithoutif1boxednumber)
    boxed class to store validated Number payloads | +| record | [IgnoreThenWithoutIf.IgnoreThenWithoutIf1BoxedString](#ignorethenwithoutif1boxedstring)
    boxed class to store validated String payloads | +| record | [IgnoreThenWithoutIf.IgnoreThenWithoutIf1BoxedList](#ignorethenwithoutif1boxedlist)
    boxed class to store validated List payloads | +| record | [IgnoreThenWithoutIf.IgnoreThenWithoutIf1BoxedMap](#ignorethenwithoutif1boxedmap)
    boxed class to store validated Map payloads | +| static class | [IgnoreThenWithoutIf.IgnoreThenWithoutIf1](#ignorethenwithoutif1)
    schema class | +| sealed interface | [IgnoreThenWithoutIf.ThenBoxed](#thenboxed)
    sealed interface for validated payloads | +| record | [IgnoreThenWithoutIf.ThenBoxedVoid](#thenboxedvoid)
    boxed class to store validated null payloads | +| record | [IgnoreThenWithoutIf.ThenBoxedBoolean](#thenboxedboolean)
    boxed class to store validated boolean payloads | +| record | [IgnoreThenWithoutIf.ThenBoxedNumber](#thenboxednumber)
    boxed class to store validated Number payloads | +| record | [IgnoreThenWithoutIf.ThenBoxedString](#thenboxedstring)
    boxed class to store validated String payloads | +| record | [IgnoreThenWithoutIf.ThenBoxedList](#thenboxedlist)
    boxed class to store validated List payloads | +| record | [IgnoreThenWithoutIf.ThenBoxedMap](#thenboxedmap)
    boxed class to store validated Map payloads | +| static class | [IgnoreThenWithoutIf.Then](#then)
    schema class | +| enum | [IgnoreThenWithoutIf.StringThenConst](#stringthenconst)
    String enum | + +## IgnoreThenWithoutIf1Boxed +sealed interface IgnoreThenWithoutIf1Boxed
    +permits
    +[IgnoreThenWithoutIf1BoxedVoid](#ignorethenwithoutif1boxedvoid), +[IgnoreThenWithoutIf1BoxedBoolean](#ignorethenwithoutif1boxedboolean), +[IgnoreThenWithoutIf1BoxedNumber](#ignorethenwithoutif1boxednumber), +[IgnoreThenWithoutIf1BoxedString](#ignorethenwithoutif1boxedstring), +[IgnoreThenWithoutIf1BoxedList](#ignorethenwithoutif1boxedlist), +[IgnoreThenWithoutIf1BoxedMap](#ignorethenwithoutif1boxedmap) + +sealed interface that stores validated payloads using boxed classes + +## IgnoreThenWithoutIf1BoxedVoid +data class IgnoreThenWithoutIf1BoxedVoid
    +implements [IgnoreThenWithoutIf1Boxed](#ignorethenwithoutif1boxed) + +data class that stores validated null payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| IgnoreThenWithoutIf1BoxedVoid(Nothing? data)
    Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| Nothing? | data()
    validated payload | +| Any? | getData()
    validated payload | + +## IgnoreThenWithoutIf1BoxedBoolean +data class IgnoreThenWithoutIf1BoxedBoolean
    +implements [IgnoreThenWithoutIf1Boxed](#ignorethenwithoutif1boxed) + +record that stores validated boolean payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| IgnoreThenWithoutIf1BoxedBoolean(boolean data)
    Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| boolean | data()
    validated payload | +| Any? | getData()
    validated payload | + +## IgnoreThenWithoutIf1BoxedNumber +data class IgnoreThenWithoutIf1BoxedNumber
    +implements [IgnoreThenWithoutIf1Boxed](#ignorethenwithoutif1boxed) + +data class that stores validated Number payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| IgnoreThenWithoutIf1BoxedNumber(Number data)
    Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| Number | data()
    validated payload | +| Any? | getData()
    validated payload | + +## IgnoreThenWithoutIf1BoxedString +data class IgnoreThenWithoutIf1BoxedString
    +implements [IgnoreThenWithoutIf1Boxed](#ignorethenwithoutif1boxed) + +data class that stores validated String payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| IgnoreThenWithoutIf1BoxedString(String data)
    Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| String | data()
    validated payload | +| Any? | getData()
    validated payload | + +## IgnoreThenWithoutIf1BoxedList +data class IgnoreThenWithoutIf1BoxedList
    +implements [IgnoreThenWithoutIf1Boxed](#ignorethenwithoutif1boxed) + +data class that stores validated List payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| IgnoreThenWithoutIf1BoxedList(FrozenList data)
    Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| FrozenList | data()
    validated payload | +| Any? | getData()
    validated payload | + +## IgnoreThenWithoutIf1BoxedMap +data class IgnoreThenWithoutIf1BoxedMap
    +implements [IgnoreThenWithoutIf1Boxed](#ignorethenwithoutif1boxed) + +data class that stores validated Map payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| IgnoreThenWithoutIf1BoxedMap(FrozenMap data)
    Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| FrozenMap | data()
    validated payload | +| Any? | getData()
    validated payload | + +## IgnoreThenWithoutIf1 +class IgnoreThenWithoutIf1
    +extends JsonSchema + +A schema class that validates payloads + +### Field Summary +| Modifier and Type | Field and Description | +| ----------------- | ---------------------- | +| Class | then = [Then::class.java](#then) | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| String | validate(arg: String, configuration: SchemaConfiguration) | +| Nothing? | validate(arg: Nothing?, configuration: SchemaConfiguration) | +| int | validate(arg: int, configuration: SchemaConfiguration) | +| long | validate(arg: long, configuration: SchemaConfiguration) | +| float | validate(arg: float, configuration: SchemaConfiguration) | +| double | validate(arg: double, configuration: SchemaConfiguration) | +| Number | validate(arg: Number, configuration: SchemaConfiguration) | +| boolean | validate(arg: boolean, configuration: SchemaConfiguration) | +| FrozenMap | validate(arg: Map<?, ?>, configuration: SchemaConfiguration) | +| FrozenList | validate(arg: List<*>, configuration: SchemaConfiguration) | +| [IgnoreThenWithoutIf1BoxedString](#ignorethenwithoutif1boxedstring) | validateAndBox(String, configuration: SchemaConfiguration) | +| [IgnoreThenWithoutIf1BoxedVoid](#ignorethenwithoutif1boxedvoid) | validateAndBox(Nothing?, configuration: SchemaConfiguration) | +| [IgnoreThenWithoutIf1BoxedNumber](#ignorethenwithoutif1boxednumber) | validateAndBox(Number, configuration: SchemaConfiguration) | +| [IgnoreThenWithoutIf1BoxedBoolean](#ignorethenwithoutif1boxedboolean) | validateAndBox(boolean, configuration: SchemaConfiguration) | +| [IgnoreThenWithoutIf1BoxedMap](#ignorethenwithoutif1boxedmap) | validateAndBox(Map<?, ?>, configuration: SchemaConfiguration) | +| [IgnoreThenWithoutIf1BoxedList](#ignorethenwithoutif1boxedlist) | validateAndBox(List<*>, configuration: SchemaConfiguration) | +| [IgnoreThenWithoutIf1Boxed](#ignorethenwithoutif1boxed) | validateAndBox(Any?, configuration: SchemaConfiguration) | +| Any? | validate(arg: Any?, configuration: SchemaConfiguration) | + +## ThenBoxed +sealed interface ThenBoxed
    +permits
    +[ThenBoxedVoid](#thenboxedvoid), +[ThenBoxedBoolean](#thenboxedboolean), +[ThenBoxedNumber](#thenboxednumber), +[ThenBoxedString](#thenboxedstring), +[ThenBoxedList](#thenboxedlist), +[ThenBoxedMap](#thenboxedmap) + +sealed interface that stores validated payloads using boxed classes + +## ThenBoxedVoid +data class ThenBoxedVoid
    +implements [ThenBoxed](#thenboxed) + +data class that stores validated null payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| ThenBoxedVoid(Nothing? data)
    Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| Nothing? | data()
    validated payload | +| Any? | getData()
    validated payload | + +## ThenBoxedBoolean +data class ThenBoxedBoolean
    +implements [ThenBoxed](#thenboxed) + +record that stores validated boolean payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| ThenBoxedBoolean(boolean data)
    Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| boolean | data()
    validated payload | +| Any? | getData()
    validated payload | + +## ThenBoxedNumber +data class ThenBoxedNumber
    +implements [ThenBoxed](#thenboxed) + +data class that stores validated Number payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| ThenBoxedNumber(Number data)
    Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| Number | data()
    validated payload | +| Any? | getData()
    validated payload | + +## ThenBoxedString +data class ThenBoxedString
    +implements [ThenBoxed](#thenboxed) + +data class that stores validated String payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| ThenBoxedString(String data)
    Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| String | data()
    validated payload | +| Any? | getData()
    validated payload | + +## ThenBoxedList +data class ThenBoxedList
    +implements [ThenBoxed](#thenboxed) + +data class that stores validated List payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| ThenBoxedList(FrozenList data)
    Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| FrozenList | data()
    validated payload | +| Any? | getData()
    validated payload | + +## ThenBoxedMap +data class ThenBoxedMap
    +implements [ThenBoxed](#thenboxed) + +data class that stores validated Map payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| ThenBoxedMap(FrozenMap data)
    Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| FrozenMap | data()
    validated payload | +| Any? | getData()
    validated payload | + +## Then +class Then
    +extends JsonSchema + +A schema class that validates payloads + +### Field Summary +| Modifier and Type | Field and Description | +| ----------------- | ---------------------- | +| Any? | constValue = "0" | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| String | validate(arg: String, configuration: SchemaConfiguration) | +| Nothing? | validate(arg: Nothing?, configuration: SchemaConfiguration) | +| int | validate(arg: int, configuration: SchemaConfiguration) | +| long | validate(arg: long, configuration: SchemaConfiguration) | +| float | validate(arg: float, configuration: SchemaConfiguration) | +| double | validate(arg: double, configuration: SchemaConfiguration) | +| Number | validate(arg: Number, configuration: SchemaConfiguration) | +| boolean | validate(arg: boolean, configuration: SchemaConfiguration) | +| FrozenMap | validate(arg: Map<?, ?>, configuration: SchemaConfiguration) | +| FrozenList | validate(arg: List<*>, configuration: SchemaConfiguration) | +| [ThenBoxedString](#thenboxedstring) | validateAndBox(String, configuration: SchemaConfiguration) | +| [ThenBoxedVoid](#thenboxedvoid) | validateAndBox(Nothing?, configuration: SchemaConfiguration) | +| [ThenBoxedNumber](#thenboxednumber) | validateAndBox(Number, configuration: SchemaConfiguration) | +| [ThenBoxedBoolean](#thenboxedboolean) | validateAndBox(boolean, configuration: SchemaConfiguration) | +| [ThenBoxedMap](#thenboxedmap) | validateAndBox(Map<?, ?>, configuration: SchemaConfiguration) | +| [ThenBoxedList](#thenboxedlist) | validateAndBox(List<*>, configuration: SchemaConfiguration) | +| [ThenBoxed](#thenboxed) | validateAndBox(Any?, configuration: SchemaConfiguration) | +| Any? | validate(arg: Any?, configuration: SchemaConfiguration) | + +## StringThenConst +public enum StringThenConst
    +extends `Enum` + +A class that stores String enum values + +### Enum Constant Summary +| Enum Constant | Description | +| ------------- | ----------- | +| POSITIVE_0 | value = "0" | + +[[Back to top]](#top) [[Back to Component Schemas]](../../../README.md#Component-Schemas) [[Back to README]](../../../README.md) diff --git a/samples/client/3_1_0_unit_test/kotlin/docs/components/schemas/IntegerTypeMatchesIntegers.md b/samples/client/3_1_0_unit_test/kotlin/docs/components/schemas/IntegerTypeMatchesIntegers.md new file mode 100644 index 00000000000..39131a09a05 --- /dev/null +++ b/samples/client/3_1_0_unit_test/kotlin/docs/components/schemas/IntegerTypeMatchesIntegers.md @@ -0,0 +1,52 @@ +# IntegerTypeMatchesIntegers +org.openapijsonschematools.client.components.schemas.IntegerTypeMatchesIntegers.java +class IntegerTypeMatchesIntegers
    + +A class that contains necessary nested +- schema classes (which validate payloads), extends JsonSchema +- sealed interfaces which store validated payloads, Kotlin version of a sum type +- boxed classes which store validated payloads, sealed permits class implementations + +## Nested Class Summary +| Modifier and Type | Class and Description | +| ----------------- | ---------------------- | +| sealed interface | [IntegerTypeMatchesIntegers.IntegerTypeMatchesIntegers1Boxed](#integertypematchesintegers1boxed)
    sealed interface for validated payloads | +| record | [IntegerTypeMatchesIntegers.IntegerTypeMatchesIntegers1BoxedNumber](#integertypematchesintegers1boxednumber)
    boxed class to store validated Number payloads | +| static class | [IntegerTypeMatchesIntegers.IntegerTypeMatchesIntegers1](#integertypematchesintegers1)
    schema class | + +## IntegerTypeMatchesIntegers1Boxed +sealed interface IntegerTypeMatchesIntegers1Boxed
    +permits
    +[IntegerTypeMatchesIntegers1BoxedNumber](#integertypematchesintegers1boxednumber) + +sealed interface that stores validated payloads using boxed classes + +## IntegerTypeMatchesIntegers1BoxedNumber +data class IntegerTypeMatchesIntegers1BoxedNumber
    +implements [IntegerTypeMatchesIntegers1Boxed](#integertypematchesintegers1boxed) + +data class that stores validated Number payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| IntegerTypeMatchesIntegers1BoxedNumber(Number data)
    Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| Number | data()
    validated payload | +| Any? | getData()
    validated payload | + +## IntegerTypeMatchesIntegers1 +class IntegerTypeMatchesIntegers1
    +extends IntJsonSchema.IntJsonSchema1 + +A schema class that validates payloads + +| Methods Inherited from class org.openapijsonschematools.client.schemas.IntJsonSchema.IntJsonSchema1 | +| ------------------------------------------------------------------ | +| validate | +| validateAndBox | + +[[Back to top]](#top) [[Back to Component Schemas]](../../../README.md#Component-Schemas) [[Back to README]](../../../README.md) diff --git a/samples/client/3_1_0_unit_test/kotlin/docs/components/schemas/Ipv4Format.md b/samples/client/3_1_0_unit_test/kotlin/docs/components/schemas/Ipv4Format.md new file mode 100644 index 00000000000..0ddec8c4233 --- /dev/null +++ b/samples/client/3_1_0_unit_test/kotlin/docs/components/schemas/Ipv4Format.md @@ -0,0 +1,169 @@ +# Ipv4Format +org.openapijsonschematools.client.components.schemas.Ipv4Format.java +class Ipv4Format
    + +A class that contains necessary nested +- schema classes (which validate payloads), extends JsonSchema +- sealed interfaces which store validated payloads, Kotlin version of a sum type +- boxed classes which store validated payloads, sealed permits class implementations + +## Nested Class Summary +| Modifier and Type | Class and Description | +| ----------------- | ---------------------- | +| sealed interface | [Ipv4Format.Ipv4Format1Boxed](#ipv4format1boxed)
    sealed interface for validated payloads | +| record | [Ipv4Format.Ipv4Format1BoxedVoid](#ipv4format1boxedvoid)
    boxed class to store validated null payloads | +| record | [Ipv4Format.Ipv4Format1BoxedBoolean](#ipv4format1boxedboolean)
    boxed class to store validated boolean payloads | +| record | [Ipv4Format.Ipv4Format1BoxedNumber](#ipv4format1boxednumber)
    boxed class to store validated Number payloads | +| record | [Ipv4Format.Ipv4Format1BoxedString](#ipv4format1boxedstring)
    boxed class to store validated String payloads | +| record | [Ipv4Format.Ipv4Format1BoxedList](#ipv4format1boxedlist)
    boxed class to store validated List payloads | +| record | [Ipv4Format.Ipv4Format1BoxedMap](#ipv4format1boxedmap)
    boxed class to store validated Map payloads | +| static class | [Ipv4Format.Ipv4Format1](#ipv4format1)
    schema class | + +## Ipv4Format1Boxed +sealed interface Ipv4Format1Boxed
    +permits
    +[Ipv4Format1BoxedVoid](#ipv4format1boxedvoid), +[Ipv4Format1BoxedBoolean](#ipv4format1boxedboolean), +[Ipv4Format1BoxedNumber](#ipv4format1boxednumber), +[Ipv4Format1BoxedString](#ipv4format1boxedstring), +[Ipv4Format1BoxedList](#ipv4format1boxedlist), +[Ipv4Format1BoxedMap](#ipv4format1boxedmap) + +sealed interface that stores validated payloads using boxed classes + +## Ipv4Format1BoxedVoid +data class Ipv4Format1BoxedVoid
    +implements [Ipv4Format1Boxed](#ipv4format1boxed) + +data class that stores validated null payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| Ipv4Format1BoxedVoid(Nothing? data)
    Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| Nothing? | data()
    validated payload | +| Any? | getData()
    validated payload | + +## Ipv4Format1BoxedBoolean +data class Ipv4Format1BoxedBoolean
    +implements [Ipv4Format1Boxed](#ipv4format1boxed) + +record that stores validated boolean payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| Ipv4Format1BoxedBoolean(boolean data)
    Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| boolean | data()
    validated payload | +| Any? | getData()
    validated payload | + +## Ipv4Format1BoxedNumber +data class Ipv4Format1BoxedNumber
    +implements [Ipv4Format1Boxed](#ipv4format1boxed) + +data class that stores validated Number payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| Ipv4Format1BoxedNumber(Number data)
    Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| Number | data()
    validated payload | +| Any? | getData()
    validated payload | + +## Ipv4Format1BoxedString +data class Ipv4Format1BoxedString
    +implements [Ipv4Format1Boxed](#ipv4format1boxed) + +data class that stores validated String payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| Ipv4Format1BoxedString(String data)
    Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| String | data()
    validated payload | +| Any? | getData()
    validated payload | + +## Ipv4Format1BoxedList +data class Ipv4Format1BoxedList
    +implements [Ipv4Format1Boxed](#ipv4format1boxed) + +data class that stores validated List payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| Ipv4Format1BoxedList(FrozenList data)
    Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| FrozenList | data()
    validated payload | +| Any? | getData()
    validated payload | + +## Ipv4Format1BoxedMap +data class Ipv4Format1BoxedMap
    +implements [Ipv4Format1Boxed](#ipv4format1boxed) + +data class that stores validated Map payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| Ipv4Format1BoxedMap(FrozenMap data)
    Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| FrozenMap | data()
    validated payload | +| Any? | getData()
    validated payload | + +## Ipv4Format1 +class Ipv4Format1
    +extends JsonSchema + +A schema class that validates payloads + +### Field Summary +| Modifier and Type | Field and Description | +| ----------------- | ---------------------- | +| String | type = "ipv4"; | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| String | validate(arg: String, configuration: SchemaConfiguration) | +| Nothing? | validate(arg: Nothing?, configuration: SchemaConfiguration) | +| int | validate(arg: int, configuration: SchemaConfiguration) | +| long | validate(arg: long, configuration: SchemaConfiguration) | +| float | validate(arg: float, configuration: SchemaConfiguration) | +| double | validate(arg: double, configuration: SchemaConfiguration) | +| Number | validate(arg: Number, configuration: SchemaConfiguration) | +| boolean | validate(arg: boolean, configuration: SchemaConfiguration) | +| FrozenMap | validate(arg: Map<?, ?>, configuration: SchemaConfiguration) | +| FrozenList | validate(arg: List<*>, configuration: SchemaConfiguration) | +| [Ipv4Format1BoxedString](#ipv4format1boxedstring) | validateAndBox(String, configuration: SchemaConfiguration) | +| [Ipv4Format1BoxedVoid](#ipv4format1boxedvoid) | validateAndBox(Nothing?, configuration: SchemaConfiguration) | +| [Ipv4Format1BoxedNumber](#ipv4format1boxednumber) | validateAndBox(Number, configuration: SchemaConfiguration) | +| [Ipv4Format1BoxedBoolean](#ipv4format1boxedboolean) | validateAndBox(boolean, configuration: SchemaConfiguration) | +| [Ipv4Format1BoxedMap](#ipv4format1boxedmap) | validateAndBox(Map<?, ?>, configuration: SchemaConfiguration) | +| [Ipv4Format1BoxedList](#ipv4format1boxedlist) | validateAndBox(List<*>, configuration: SchemaConfiguration) | +| [Ipv4Format1Boxed](#ipv4format1boxed) | validateAndBox(Any?, configuration: SchemaConfiguration) | +| Any? | validate(arg: Any?, configuration: SchemaConfiguration) | + +[[Back to top]](#top) [[Back to Component Schemas]](../../../README.md#Component-Schemas) [[Back to README]](../../../README.md) diff --git a/samples/client/3_1_0_unit_test/kotlin/docs/components/schemas/Ipv6Format.md b/samples/client/3_1_0_unit_test/kotlin/docs/components/schemas/Ipv6Format.md new file mode 100644 index 00000000000..d78fd50c8b4 --- /dev/null +++ b/samples/client/3_1_0_unit_test/kotlin/docs/components/schemas/Ipv6Format.md @@ -0,0 +1,169 @@ +# Ipv6Format +org.openapijsonschematools.client.components.schemas.Ipv6Format.java +class Ipv6Format
    + +A class that contains necessary nested +- schema classes (which validate payloads), extends JsonSchema +- sealed interfaces which store validated payloads, Kotlin version of a sum type +- boxed classes which store validated payloads, sealed permits class implementations + +## Nested Class Summary +| Modifier and Type | Class and Description | +| ----------------- | ---------------------- | +| sealed interface | [Ipv6Format.Ipv6Format1Boxed](#ipv6format1boxed)
    sealed interface for validated payloads | +| record | [Ipv6Format.Ipv6Format1BoxedVoid](#ipv6format1boxedvoid)
    boxed class to store validated null payloads | +| record | [Ipv6Format.Ipv6Format1BoxedBoolean](#ipv6format1boxedboolean)
    boxed class to store validated boolean payloads | +| record | [Ipv6Format.Ipv6Format1BoxedNumber](#ipv6format1boxednumber)
    boxed class to store validated Number payloads | +| record | [Ipv6Format.Ipv6Format1BoxedString](#ipv6format1boxedstring)
    boxed class to store validated String payloads | +| record | [Ipv6Format.Ipv6Format1BoxedList](#ipv6format1boxedlist)
    boxed class to store validated List payloads | +| record | [Ipv6Format.Ipv6Format1BoxedMap](#ipv6format1boxedmap)
    boxed class to store validated Map payloads | +| static class | [Ipv6Format.Ipv6Format1](#ipv6format1)
    schema class | + +## Ipv6Format1Boxed +sealed interface Ipv6Format1Boxed
    +permits
    +[Ipv6Format1BoxedVoid](#ipv6format1boxedvoid), +[Ipv6Format1BoxedBoolean](#ipv6format1boxedboolean), +[Ipv6Format1BoxedNumber](#ipv6format1boxednumber), +[Ipv6Format1BoxedString](#ipv6format1boxedstring), +[Ipv6Format1BoxedList](#ipv6format1boxedlist), +[Ipv6Format1BoxedMap](#ipv6format1boxedmap) + +sealed interface that stores validated payloads using boxed classes + +## Ipv6Format1BoxedVoid +data class Ipv6Format1BoxedVoid
    +implements [Ipv6Format1Boxed](#ipv6format1boxed) + +data class that stores validated null payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| Ipv6Format1BoxedVoid(Nothing? data)
    Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| Nothing? | data()
    validated payload | +| Any? | getData()
    validated payload | + +## Ipv6Format1BoxedBoolean +data class Ipv6Format1BoxedBoolean
    +implements [Ipv6Format1Boxed](#ipv6format1boxed) + +record that stores validated boolean payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| Ipv6Format1BoxedBoolean(boolean data)
    Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| boolean | data()
    validated payload | +| Any? | getData()
    validated payload | + +## Ipv6Format1BoxedNumber +data class Ipv6Format1BoxedNumber
    +implements [Ipv6Format1Boxed](#ipv6format1boxed) + +data class that stores validated Number payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| Ipv6Format1BoxedNumber(Number data)
    Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| Number | data()
    validated payload | +| Any? | getData()
    validated payload | + +## Ipv6Format1BoxedString +data class Ipv6Format1BoxedString
    +implements [Ipv6Format1Boxed](#ipv6format1boxed) + +data class that stores validated String payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| Ipv6Format1BoxedString(String data)
    Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| String | data()
    validated payload | +| Any? | getData()
    validated payload | + +## Ipv6Format1BoxedList +data class Ipv6Format1BoxedList
    +implements [Ipv6Format1Boxed](#ipv6format1boxed) + +data class that stores validated List payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| Ipv6Format1BoxedList(FrozenList data)
    Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| FrozenList | data()
    validated payload | +| Any? | getData()
    validated payload | + +## Ipv6Format1BoxedMap +data class Ipv6Format1BoxedMap
    +implements [Ipv6Format1Boxed](#ipv6format1boxed) + +data class that stores validated Map payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| Ipv6Format1BoxedMap(FrozenMap data)
    Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| FrozenMap | data()
    validated payload | +| Any? | getData()
    validated payload | + +## Ipv6Format1 +class Ipv6Format1
    +extends JsonSchema + +A schema class that validates payloads + +### Field Summary +| Modifier and Type | Field and Description | +| ----------------- | ---------------------- | +| String | type = "ipv6"; | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| String | validate(arg: String, configuration: SchemaConfiguration) | +| Nothing? | validate(arg: Nothing?, configuration: SchemaConfiguration) | +| int | validate(arg: int, configuration: SchemaConfiguration) | +| long | validate(arg: long, configuration: SchemaConfiguration) | +| float | validate(arg: float, configuration: SchemaConfiguration) | +| double | validate(arg: double, configuration: SchemaConfiguration) | +| Number | validate(arg: Number, configuration: SchemaConfiguration) | +| boolean | validate(arg: boolean, configuration: SchemaConfiguration) | +| FrozenMap | validate(arg: Map<?, ?>, configuration: SchemaConfiguration) | +| FrozenList | validate(arg: List<*>, configuration: SchemaConfiguration) | +| [Ipv6Format1BoxedString](#ipv6format1boxedstring) | validateAndBox(String, configuration: SchemaConfiguration) | +| [Ipv6Format1BoxedVoid](#ipv6format1boxedvoid) | validateAndBox(Nothing?, configuration: SchemaConfiguration) | +| [Ipv6Format1BoxedNumber](#ipv6format1boxednumber) | validateAndBox(Number, configuration: SchemaConfiguration) | +| [Ipv6Format1BoxedBoolean](#ipv6format1boxedboolean) | validateAndBox(boolean, configuration: SchemaConfiguration) | +| [Ipv6Format1BoxedMap](#ipv6format1boxedmap) | validateAndBox(Map<?, ?>, configuration: SchemaConfiguration) | +| [Ipv6Format1BoxedList](#ipv6format1boxedlist) | validateAndBox(List<*>, configuration: SchemaConfiguration) | +| [Ipv6Format1Boxed](#ipv6format1boxed) | validateAndBox(Any?, configuration: SchemaConfiguration) | +| Any? | validate(arg: Any?, configuration: SchemaConfiguration) | + +[[Back to top]](#top) [[Back to Component Schemas]](../../../README.md#Component-Schemas) [[Back to README]](../../../README.md) diff --git a/samples/client/3_1_0_unit_test/kotlin/docs/components/schemas/IriFormat.md b/samples/client/3_1_0_unit_test/kotlin/docs/components/schemas/IriFormat.md new file mode 100644 index 00000000000..a044d8df914 --- /dev/null +++ b/samples/client/3_1_0_unit_test/kotlin/docs/components/schemas/IriFormat.md @@ -0,0 +1,169 @@ +# IriFormat +org.openapijsonschematools.client.components.schemas.IriFormat.java +class IriFormat
    + +A class that contains necessary nested +- schema classes (which validate payloads), extends JsonSchema +- sealed interfaces which store validated payloads, Kotlin version of a sum type +- boxed classes which store validated payloads, sealed permits class implementations + +## Nested Class Summary +| Modifier and Type | Class and Description | +| ----------------- | ---------------------- | +| sealed interface | [IriFormat.IriFormat1Boxed](#iriformat1boxed)
    sealed interface for validated payloads | +| record | [IriFormat.IriFormat1BoxedVoid](#iriformat1boxedvoid)
    boxed class to store validated null payloads | +| record | [IriFormat.IriFormat1BoxedBoolean](#iriformat1boxedboolean)
    boxed class to store validated boolean payloads | +| record | [IriFormat.IriFormat1BoxedNumber](#iriformat1boxednumber)
    boxed class to store validated Number payloads | +| record | [IriFormat.IriFormat1BoxedString](#iriformat1boxedstring)
    boxed class to store validated String payloads | +| record | [IriFormat.IriFormat1BoxedList](#iriformat1boxedlist)
    boxed class to store validated List payloads | +| record | [IriFormat.IriFormat1BoxedMap](#iriformat1boxedmap)
    boxed class to store validated Map payloads | +| static class | [IriFormat.IriFormat1](#iriformat1)
    schema class | + +## IriFormat1Boxed +sealed interface IriFormat1Boxed
    +permits
    +[IriFormat1BoxedVoid](#iriformat1boxedvoid), +[IriFormat1BoxedBoolean](#iriformat1boxedboolean), +[IriFormat1BoxedNumber](#iriformat1boxednumber), +[IriFormat1BoxedString](#iriformat1boxedstring), +[IriFormat1BoxedList](#iriformat1boxedlist), +[IriFormat1BoxedMap](#iriformat1boxedmap) + +sealed interface that stores validated payloads using boxed classes + +## IriFormat1BoxedVoid +data class IriFormat1BoxedVoid
    +implements [IriFormat1Boxed](#iriformat1boxed) + +data class that stores validated null payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| IriFormat1BoxedVoid(Nothing? data)
    Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| Nothing? | data()
    validated payload | +| Any? | getData()
    validated payload | + +## IriFormat1BoxedBoolean +data class IriFormat1BoxedBoolean
    +implements [IriFormat1Boxed](#iriformat1boxed) + +record that stores validated boolean payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| IriFormat1BoxedBoolean(boolean data)
    Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| boolean | data()
    validated payload | +| Any? | getData()
    validated payload | + +## IriFormat1BoxedNumber +data class IriFormat1BoxedNumber
    +implements [IriFormat1Boxed](#iriformat1boxed) + +data class that stores validated Number payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| IriFormat1BoxedNumber(Number data)
    Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| Number | data()
    validated payload | +| Any? | getData()
    validated payload | + +## IriFormat1BoxedString +data class IriFormat1BoxedString
    +implements [IriFormat1Boxed](#iriformat1boxed) + +data class that stores validated String payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| IriFormat1BoxedString(String data)
    Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| String | data()
    validated payload | +| Any? | getData()
    validated payload | + +## IriFormat1BoxedList +data class IriFormat1BoxedList
    +implements [IriFormat1Boxed](#iriformat1boxed) + +data class that stores validated List payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| IriFormat1BoxedList(FrozenList data)
    Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| FrozenList | data()
    validated payload | +| Any? | getData()
    validated payload | + +## IriFormat1BoxedMap +data class IriFormat1BoxedMap
    +implements [IriFormat1Boxed](#iriformat1boxed) + +data class that stores validated Map payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| IriFormat1BoxedMap(FrozenMap data)
    Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| FrozenMap | data()
    validated payload | +| Any? | getData()
    validated payload | + +## IriFormat1 +class IriFormat1
    +extends JsonSchema + +A schema class that validates payloads + +### Field Summary +| Modifier and Type | Field and Description | +| ----------------- | ---------------------- | +| String | type = "iri"; | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| String | validate(arg: String, configuration: SchemaConfiguration) | +| Nothing? | validate(arg: Nothing?, configuration: SchemaConfiguration) | +| int | validate(arg: int, configuration: SchemaConfiguration) | +| long | validate(arg: long, configuration: SchemaConfiguration) | +| float | validate(arg: float, configuration: SchemaConfiguration) | +| double | validate(arg: double, configuration: SchemaConfiguration) | +| Number | validate(arg: Number, configuration: SchemaConfiguration) | +| boolean | validate(arg: boolean, configuration: SchemaConfiguration) | +| FrozenMap | validate(arg: Map<?, ?>, configuration: SchemaConfiguration) | +| FrozenList | validate(arg: List<*>, configuration: SchemaConfiguration) | +| [IriFormat1BoxedString](#iriformat1boxedstring) | validateAndBox(String, configuration: SchemaConfiguration) | +| [IriFormat1BoxedVoid](#iriformat1boxedvoid) | validateAndBox(Nothing?, configuration: SchemaConfiguration) | +| [IriFormat1BoxedNumber](#iriformat1boxednumber) | validateAndBox(Number, configuration: SchemaConfiguration) | +| [IriFormat1BoxedBoolean](#iriformat1boxedboolean) | validateAndBox(boolean, configuration: SchemaConfiguration) | +| [IriFormat1BoxedMap](#iriformat1boxedmap) | validateAndBox(Map<?, ?>, configuration: SchemaConfiguration) | +| [IriFormat1BoxedList](#iriformat1boxedlist) | validateAndBox(List<*>, configuration: SchemaConfiguration) | +| [IriFormat1Boxed](#iriformat1boxed) | validateAndBox(Any?, configuration: SchemaConfiguration) | +| Any? | validate(arg: Any?, configuration: SchemaConfiguration) | + +[[Back to top]](#top) [[Back to Component Schemas]](../../../README.md#Component-Schemas) [[Back to README]](../../../README.md) diff --git a/samples/client/3_1_0_unit_test/kotlin/docs/components/schemas/IriReferenceFormat.md b/samples/client/3_1_0_unit_test/kotlin/docs/components/schemas/IriReferenceFormat.md new file mode 100644 index 00000000000..c5014f940bc --- /dev/null +++ b/samples/client/3_1_0_unit_test/kotlin/docs/components/schemas/IriReferenceFormat.md @@ -0,0 +1,169 @@ +# IriReferenceFormat +org.openapijsonschematools.client.components.schemas.IriReferenceFormat.java +class IriReferenceFormat
    + +A class that contains necessary nested +- schema classes (which validate payloads), extends JsonSchema +- sealed interfaces which store validated payloads, Kotlin version of a sum type +- boxed classes which store validated payloads, sealed permits class implementations + +## Nested Class Summary +| Modifier and Type | Class and Description | +| ----------------- | ---------------------- | +| sealed interface | [IriReferenceFormat.IriReferenceFormat1Boxed](#irireferenceformat1boxed)
    sealed interface for validated payloads | +| record | [IriReferenceFormat.IriReferenceFormat1BoxedVoid](#irireferenceformat1boxedvoid)
    boxed class to store validated null payloads | +| record | [IriReferenceFormat.IriReferenceFormat1BoxedBoolean](#irireferenceformat1boxedboolean)
    boxed class to store validated boolean payloads | +| record | [IriReferenceFormat.IriReferenceFormat1BoxedNumber](#irireferenceformat1boxednumber)
    boxed class to store validated Number payloads | +| record | [IriReferenceFormat.IriReferenceFormat1BoxedString](#irireferenceformat1boxedstring)
    boxed class to store validated String payloads | +| record | [IriReferenceFormat.IriReferenceFormat1BoxedList](#irireferenceformat1boxedlist)
    boxed class to store validated List payloads | +| record | [IriReferenceFormat.IriReferenceFormat1BoxedMap](#irireferenceformat1boxedmap)
    boxed class to store validated Map payloads | +| static class | [IriReferenceFormat.IriReferenceFormat1](#irireferenceformat1)
    schema class | + +## IriReferenceFormat1Boxed +sealed interface IriReferenceFormat1Boxed
    +permits
    +[IriReferenceFormat1BoxedVoid](#irireferenceformat1boxedvoid), +[IriReferenceFormat1BoxedBoolean](#irireferenceformat1boxedboolean), +[IriReferenceFormat1BoxedNumber](#irireferenceformat1boxednumber), +[IriReferenceFormat1BoxedString](#irireferenceformat1boxedstring), +[IriReferenceFormat1BoxedList](#irireferenceformat1boxedlist), +[IriReferenceFormat1BoxedMap](#irireferenceformat1boxedmap) + +sealed interface that stores validated payloads using boxed classes + +## IriReferenceFormat1BoxedVoid +data class IriReferenceFormat1BoxedVoid
    +implements [IriReferenceFormat1Boxed](#irireferenceformat1boxed) + +data class that stores validated null payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| IriReferenceFormat1BoxedVoid(Nothing? data)
    Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| Nothing? | data()
    validated payload | +| Any? | getData()
    validated payload | + +## IriReferenceFormat1BoxedBoolean +data class IriReferenceFormat1BoxedBoolean
    +implements [IriReferenceFormat1Boxed](#irireferenceformat1boxed) + +record that stores validated boolean payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| IriReferenceFormat1BoxedBoolean(boolean data)
    Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| boolean | data()
    validated payload | +| Any? | getData()
    validated payload | + +## IriReferenceFormat1BoxedNumber +data class IriReferenceFormat1BoxedNumber
    +implements [IriReferenceFormat1Boxed](#irireferenceformat1boxed) + +data class that stores validated Number payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| IriReferenceFormat1BoxedNumber(Number data)
    Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| Number | data()
    validated payload | +| Any? | getData()
    validated payload | + +## IriReferenceFormat1BoxedString +data class IriReferenceFormat1BoxedString
    +implements [IriReferenceFormat1Boxed](#irireferenceformat1boxed) + +data class that stores validated String payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| IriReferenceFormat1BoxedString(String data)
    Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| String | data()
    validated payload | +| Any? | getData()
    validated payload | + +## IriReferenceFormat1BoxedList +data class IriReferenceFormat1BoxedList
    +implements [IriReferenceFormat1Boxed](#irireferenceformat1boxed) + +data class that stores validated List payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| IriReferenceFormat1BoxedList(FrozenList data)
    Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| FrozenList | data()
    validated payload | +| Any? | getData()
    validated payload | + +## IriReferenceFormat1BoxedMap +data class IriReferenceFormat1BoxedMap
    +implements [IriReferenceFormat1Boxed](#irireferenceformat1boxed) + +data class that stores validated Map payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| IriReferenceFormat1BoxedMap(FrozenMap data)
    Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| FrozenMap | data()
    validated payload | +| Any? | getData()
    validated payload | + +## IriReferenceFormat1 +class IriReferenceFormat1
    +extends JsonSchema + +A schema class that validates payloads + +### Field Summary +| Modifier and Type | Field and Description | +| ----------------- | ---------------------- | +| String | type = "iri-reference"; | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| String | validate(arg: String, configuration: SchemaConfiguration) | +| Nothing? | validate(arg: Nothing?, configuration: SchemaConfiguration) | +| int | validate(arg: int, configuration: SchemaConfiguration) | +| long | validate(arg: long, configuration: SchemaConfiguration) | +| float | validate(arg: float, configuration: SchemaConfiguration) | +| double | validate(arg: double, configuration: SchemaConfiguration) | +| Number | validate(arg: Number, configuration: SchemaConfiguration) | +| boolean | validate(arg: boolean, configuration: SchemaConfiguration) | +| FrozenMap | validate(arg: Map<?, ?>, configuration: SchemaConfiguration) | +| FrozenList | validate(arg: List<*>, configuration: SchemaConfiguration) | +| [IriReferenceFormat1BoxedString](#irireferenceformat1boxedstring) | validateAndBox(String, configuration: SchemaConfiguration) | +| [IriReferenceFormat1BoxedVoid](#irireferenceformat1boxedvoid) | validateAndBox(Nothing?, configuration: SchemaConfiguration) | +| [IriReferenceFormat1BoxedNumber](#irireferenceformat1boxednumber) | validateAndBox(Number, configuration: SchemaConfiguration) | +| [IriReferenceFormat1BoxedBoolean](#irireferenceformat1boxedboolean) | validateAndBox(boolean, configuration: SchemaConfiguration) | +| [IriReferenceFormat1BoxedMap](#irireferenceformat1boxedmap) | validateAndBox(Map<?, ?>, configuration: SchemaConfiguration) | +| [IriReferenceFormat1BoxedList](#irireferenceformat1boxedlist) | validateAndBox(List<*>, configuration: SchemaConfiguration) | +| [IriReferenceFormat1Boxed](#irireferenceformat1boxed) | validateAndBox(Any?, configuration: SchemaConfiguration) | +| Any? | validate(arg: Any?, configuration: SchemaConfiguration) | + +[[Back to top]](#top) [[Back to Component Schemas]](../../../README.md#Component-Schemas) [[Back to README]](../../../README.md) diff --git a/samples/client/3_1_0_unit_test/kotlin/docs/components/schemas/ItemsContains.md b/samples/client/3_1_0_unit_test/kotlin/docs/components/schemas/ItemsContains.md new file mode 100644 index 00000000000..ba6593d7fd7 --- /dev/null +++ b/samples/client/3_1_0_unit_test/kotlin/docs/components/schemas/ItemsContains.md @@ -0,0 +1,438 @@ +# ItemsContains +org.openapijsonschematools.client.components.schemas.ItemsContains.java +class ItemsContains
    + +A class that contains necessary nested +- schema classes (which validate payloads), extends JsonSchema +- sealed interfaces which store validated payloads, Kotlin version of a sum type +- boxed classes which store validated payloads, sealed permits class implementations +- classes to store validated list payloads, extends FrozenList +- classes to build inputs for list payloads + +## Nested Class Summary +| Modifier and Type | Class and Description | +| ----------------- | ---------------------- | +| sealed interface | [ItemsContains.ItemsContains1Boxed](#itemscontains1boxed)
    sealed interface for validated payloads | +| record | [ItemsContains.ItemsContains1BoxedList](#itemscontains1boxedlist)
    boxed class to store validated List payloads | +| static class | [ItemsContains.ItemsContains1](#itemscontains1)
    schema class | +| static class | [ItemsContains.ItemsContainsListBuilder](#itemscontainslistbuilder)
    builder for List payloads | +| static class | [ItemsContains.ItemsContainsList](#itemscontainslist)
    output class for List payloads | +| sealed interface | [ItemsContains.ItemsBoxed](#itemsboxed)
    sealed interface for validated payloads | +| record | [ItemsContains.ItemsBoxedVoid](#itemsboxedvoid)
    boxed class to store validated null payloads | +| record | [ItemsContains.ItemsBoxedBoolean](#itemsboxedboolean)
    boxed class to store validated boolean payloads | +| record | [ItemsContains.ItemsBoxedNumber](#itemsboxednumber)
    boxed class to store validated Number payloads | +| record | [ItemsContains.ItemsBoxedString](#itemsboxedstring)
    boxed class to store validated String payloads | +| record | [ItemsContains.ItemsBoxedList](#itemsboxedlist)
    boxed class to store validated List payloads | +| record | [ItemsContains.ItemsBoxedMap](#itemsboxedmap)
    boxed class to store validated Map payloads | +| static class | [ItemsContains.Items](#items)
    schema class | +| sealed interface | [ItemsContains.ContainsBoxed](#containsboxed)
    sealed interface for validated payloads | +| record | [ItemsContains.ContainsBoxedVoid](#containsboxedvoid)
    boxed class to store validated null payloads | +| record | [ItemsContains.ContainsBoxedBoolean](#containsboxedboolean)
    boxed class to store validated boolean payloads | +| record | [ItemsContains.ContainsBoxedNumber](#containsboxednumber)
    boxed class to store validated Number payloads | +| record | [ItemsContains.ContainsBoxedString](#containsboxedstring)
    boxed class to store validated String payloads | +| record | [ItemsContains.ContainsBoxedList](#containsboxedlist)
    boxed class to store validated List payloads | +| record | [ItemsContains.ContainsBoxedMap](#containsboxedmap)
    boxed class to store validated Map payloads | +| static class | [ItemsContains.Contains](#contains)
    schema class | + +## ItemsContains1Boxed +sealed interface ItemsContains1Boxed
    +permits
    +[ItemsContains1BoxedList](#itemscontains1boxedlist) + +sealed interface that stores validated payloads using boxed classes + +## ItemsContains1BoxedList +data class ItemsContains1BoxedList
    +implements [ItemsContains1Boxed](#itemscontains1boxed) + +data class that stores validated List payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| ItemsContains1BoxedList([ItemsContainsList](#itemscontainslist) data)
    Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| [ItemsContainsList](#itemscontainslist) | data()
    validated payload | +| Any? | getData()
    validated payload | + +## ItemsContains1 +class ItemsContains1
    +extends JsonSchema + +A schema class that validates payloads + +### Code Sample +``` +import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags; +import org.openapijsonschematools.client.configurations.SchemaConfiguration; +import org.openapijsonschematools.client.exceptions.ValidationException; +import org.openapijsonschematools.client.schemas.validation.MapUtils; +import org.openapijsonschematools.client.schemas.validation.FrozenList; +import org.openapijsonschematools.client.schemas.validation.FrozenMap; +import org.openapijsonschematools.client.components.schemas.ItemsContains; + +import java.util.Arrays; +import java.util.List; +import java.util.AbstractMap; + +static final SchemaConfiguration configuration = new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().build()); + +// List validation +ItemsContains.ItemsContainsList validatedPayload = + ItemsContains.ItemsContains1.validate( + new ItemsContains.ItemsContainsListBuilder() + .build(), + configuration +); +``` + +### Field Summary +| Modifier and Type | Field and Description | +| ----------------- | ---------------------- | +| Set> | type = setOf(List::class.java) | +| Class | items = [Items::class.java](#items) | +| Class | contains = [Contains::class.java](#contains) | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| [ItemsContainsList](#itemscontainslist) | validate(arg: [List<*>](#itemscontainslistbuilder), configuration: SchemaConfiguration) | +| [ItemsContains1BoxedList](#itemscontains1boxedlist) | validateAndBox([List<*>](#itemscontainslistbuilder), configuration: SchemaConfiguration) | +| [ItemsContains1Boxed](#itemscontains1boxed) | validateAndBox(Any?, configuration: SchemaConfiguration) | +| Any? | validate(arg: Any?, configuration: SchemaConfiguration) | + +## ItemsContainsListBuilder +class ItemsContainsListBuilder
    +builder for `List` + +A class that builds the List input type + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| ItemsContainsListBuilder()
    Creates an empty list | +| ItemsContainsListBuilder(List items)
    Stores the items in a list | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| ItemsContainsListBuilder | add(item: Nothing?) | +| ItemsContainsListBuilder | add(item: Boolean) | +| ItemsContainsListBuilder | add(item: String) | +| ItemsContainsListBuilder | add(item: Int) | +| ItemsContainsListBuilder | add(item: Float) | +| ItemsContainsListBuilder | add(item: Long) | +| ItemsContainsListBuilder | add(item: Double) | +| ItemsContainsListBuilder | add(item: List) | +| ItemsContainsListBuilder | add(item: Map) | +| List | build()
    Returns list input that should be used with Schema.validate | + +## ItemsContainsList +class ItemsContainsList
    +extends `FrozenList` + +A class to store validated List payloads + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| static [ItemsContainsList](#itemscontainslist) | of([List](#itemscontainslistbuilder) arg, SchemaConfiguration configuration) | + +## ItemsBoxed +sealed interface ItemsBoxed
    +permits
    +[ItemsBoxedVoid](#itemsboxedvoid), +[ItemsBoxedBoolean](#itemsboxedboolean), +[ItemsBoxedNumber](#itemsboxednumber), +[ItemsBoxedString](#itemsboxedstring), +[ItemsBoxedList](#itemsboxedlist), +[ItemsBoxedMap](#itemsboxedmap) + +sealed interface that stores validated payloads using boxed classes + +## ItemsBoxedVoid +data class ItemsBoxedVoid
    +implements [ItemsBoxed](#itemsboxed) + +data class that stores validated null payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| ItemsBoxedVoid(Nothing? data)
    Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| Nothing? | data()
    validated payload | +| Any? | getData()
    validated payload | + +## ItemsBoxedBoolean +data class ItemsBoxedBoolean
    +implements [ItemsBoxed](#itemsboxed) + +record that stores validated boolean payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| ItemsBoxedBoolean(boolean data)
    Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| boolean | data()
    validated payload | +| Any? | getData()
    validated payload | + +## ItemsBoxedNumber +data class ItemsBoxedNumber
    +implements [ItemsBoxed](#itemsboxed) + +data class that stores validated Number payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| ItemsBoxedNumber(Number data)
    Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| Number | data()
    validated payload | +| Any? | getData()
    validated payload | + +## ItemsBoxedString +data class ItemsBoxedString
    +implements [ItemsBoxed](#itemsboxed) + +data class that stores validated String payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| ItemsBoxedString(String data)
    Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| String | data()
    validated payload | +| Any? | getData()
    validated payload | + +## ItemsBoxedList +data class ItemsBoxedList
    +implements [ItemsBoxed](#itemsboxed) + +data class that stores validated List payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| ItemsBoxedList(FrozenList data)
    Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| FrozenList | data()
    validated payload | +| Any? | getData()
    validated payload | + +## ItemsBoxedMap +data class ItemsBoxedMap
    +implements [ItemsBoxed](#itemsboxed) + +data class that stores validated Map payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| ItemsBoxedMap(FrozenMap data)
    Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| FrozenMap | data()
    validated payload | +| Any? | getData()
    validated payload | + +## Items +class Items
    +extends JsonSchema + +A schema class that validates payloads + +### Field Summary +| Modifier and Type | Field and Description | +| ----------------- | ---------------------- | +| BigDecimal | multipleOf = BigDecimal("2") | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| String | validate(arg: String, configuration: SchemaConfiguration) | +| Nothing? | validate(arg: Nothing?, configuration: SchemaConfiguration) | +| int | validate(arg: int, configuration: SchemaConfiguration) | +| long | validate(arg: long, configuration: SchemaConfiguration) | +| float | validate(arg: float, configuration: SchemaConfiguration) | +| double | validate(arg: double, configuration: SchemaConfiguration) | +| Number | validate(arg: Number, configuration: SchemaConfiguration) | +| boolean | validate(arg: boolean, configuration: SchemaConfiguration) | +| FrozenMap | validate(arg: Map<?, ?>, configuration: SchemaConfiguration) | +| FrozenList | validate(arg: List<*>, configuration: SchemaConfiguration) | +| [ItemsBoxedString](#itemsboxedstring) | validateAndBox(String, configuration: SchemaConfiguration) | +| [ItemsBoxedVoid](#itemsboxedvoid) | validateAndBox(Nothing?, configuration: SchemaConfiguration) | +| [ItemsBoxedNumber](#itemsboxednumber) | validateAndBox(Number, configuration: SchemaConfiguration) | +| [ItemsBoxedBoolean](#itemsboxedboolean) | validateAndBox(boolean, configuration: SchemaConfiguration) | +| [ItemsBoxedMap](#itemsboxedmap) | validateAndBox(Map<?, ?>, configuration: SchemaConfiguration) | +| [ItemsBoxedList](#itemsboxedlist) | validateAndBox(List<*>, configuration: SchemaConfiguration) | +| [ItemsBoxed](#itemsboxed) | validateAndBox(Any?, configuration: SchemaConfiguration) | +| Any? | validate(arg: Any?, configuration: SchemaConfiguration) | + +## ContainsBoxed +sealed interface ContainsBoxed
    +permits
    +[ContainsBoxedVoid](#containsboxedvoid), +[ContainsBoxedBoolean](#containsboxedboolean), +[ContainsBoxedNumber](#containsboxednumber), +[ContainsBoxedString](#containsboxedstring), +[ContainsBoxedList](#containsboxedlist), +[ContainsBoxedMap](#containsboxedmap) + +sealed interface that stores validated payloads using boxed classes + +## ContainsBoxedVoid +data class ContainsBoxedVoid
    +implements [ContainsBoxed](#containsboxed) + +data class that stores validated null payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| ContainsBoxedVoid(Nothing? data)
    Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| Nothing? | data()
    validated payload | +| Any? | getData()
    validated payload | + +## ContainsBoxedBoolean +data class ContainsBoxedBoolean
    +implements [ContainsBoxed](#containsboxed) + +record that stores validated boolean payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| ContainsBoxedBoolean(boolean data)
    Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| boolean | data()
    validated payload | +| Any? | getData()
    validated payload | + +## ContainsBoxedNumber +data class ContainsBoxedNumber
    +implements [ContainsBoxed](#containsboxed) + +data class that stores validated Number payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| ContainsBoxedNumber(Number data)
    Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| Number | data()
    validated payload | +| Any? | getData()
    validated payload | + +## ContainsBoxedString +data class ContainsBoxedString
    +implements [ContainsBoxed](#containsboxed) + +data class that stores validated String payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| ContainsBoxedString(String data)
    Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| String | data()
    validated payload | +| Any? | getData()
    validated payload | + +## ContainsBoxedList +data class ContainsBoxedList
    +implements [ContainsBoxed](#containsboxed) + +data class that stores validated List payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| ContainsBoxedList(FrozenList data)
    Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| FrozenList | data()
    validated payload | +| Any? | getData()
    validated payload | + +## ContainsBoxedMap +data class ContainsBoxedMap
    +implements [ContainsBoxed](#containsboxed) + +data class that stores validated Map payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| ContainsBoxedMap(FrozenMap data)
    Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| FrozenMap | data()
    validated payload | +| Any? | getData()
    validated payload | + +## Contains +class Contains
    +extends JsonSchema + +A schema class that validates payloads + +### Field Summary +| Modifier and Type | Field and Description | +| ----------------- | ---------------------- | +| BigDecimal | multipleOf = BigDecimal("3") | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| String | validate(arg: String, configuration: SchemaConfiguration) | +| Nothing? | validate(arg: Nothing?, configuration: SchemaConfiguration) | +| int | validate(arg: int, configuration: SchemaConfiguration) | +| long | validate(arg: long, configuration: SchemaConfiguration) | +| float | validate(arg: float, configuration: SchemaConfiguration) | +| double | validate(arg: double, configuration: SchemaConfiguration) | +| Number | validate(arg: Number, configuration: SchemaConfiguration) | +| boolean | validate(arg: boolean, configuration: SchemaConfiguration) | +| FrozenMap | validate(arg: Map<?, ?>, configuration: SchemaConfiguration) | +| FrozenList | validate(arg: List<*>, configuration: SchemaConfiguration) | +| [ContainsBoxedString](#containsboxedstring) | validateAndBox(String, configuration: SchemaConfiguration) | +| [ContainsBoxedVoid](#containsboxedvoid) | validateAndBox(Nothing?, configuration: SchemaConfiguration) | +| [ContainsBoxedNumber](#containsboxednumber) | validateAndBox(Number, configuration: SchemaConfiguration) | +| [ContainsBoxedBoolean](#containsboxedboolean) | validateAndBox(boolean, configuration: SchemaConfiguration) | +| [ContainsBoxedMap](#containsboxedmap) | validateAndBox(Map<?, ?>, configuration: SchemaConfiguration) | +| [ContainsBoxedList](#containsboxedlist) | validateAndBox(List<*>, configuration: SchemaConfiguration) | +| [ContainsBoxed](#containsboxed) | validateAndBox(Any?, configuration: SchemaConfiguration) | +| Any? | validate(arg: Any?, configuration: SchemaConfiguration) | + +[[Back to top]](#top) [[Back to Component Schemas]](../../../README.md#Component-Schemas) [[Back to README]](../../../README.md) diff --git a/samples/client/3_1_0_unit_test/kotlin/docs/components/schemas/ItemsDoesNotLookInApplicatorsValidCase.md b/samples/client/3_1_0_unit_test/kotlin/docs/components/schemas/ItemsDoesNotLookInApplicatorsValidCase.md new file mode 100644 index 00000000000..6a5f4ef5f68 --- /dev/null +++ b/samples/client/3_1_0_unit_test/kotlin/docs/components/schemas/ItemsDoesNotLookInApplicatorsValidCase.md @@ -0,0 +1,282 @@ +# ItemsDoesNotLookInApplicatorsValidCase +org.openapijsonschematools.client.components.schemas.ItemsDoesNotLookInApplicatorsValidCase.java +class ItemsDoesNotLookInApplicatorsValidCase
    + +A class that contains necessary nested +- schema classes (which validate payloads), extends JsonSchema +- sealed interfaces which store validated payloads, Kotlin version of a sum type +- boxed classes which store validated payloads, sealed permits class implementations +- classes to store validated list payloads, extends FrozenList +- classes to build inputs for list payloads + +## Nested Class Summary +| Modifier and Type | Class and Description | +| ----------------- | ---------------------- | +| sealed interface | [ItemsDoesNotLookInApplicatorsValidCase.ItemsDoesNotLookInApplicatorsValidCase1Boxed](#itemsdoesnotlookinapplicatorsvalidcase1boxed)
    sealed interface for validated payloads | +| record | [ItemsDoesNotLookInApplicatorsValidCase.ItemsDoesNotLookInApplicatorsValidCase1BoxedList](#itemsdoesnotlookinapplicatorsvalidcase1boxedlist)
    boxed class to store validated List payloads | +| static class | [ItemsDoesNotLookInApplicatorsValidCase.ItemsDoesNotLookInApplicatorsValidCase1](#itemsdoesnotlookinapplicatorsvalidcase1)
    schema class | +| static class | [ItemsDoesNotLookInApplicatorsValidCase.ItemsDoesNotLookInApplicatorsValidCaseListBuilder](#itemsdoesnotlookinapplicatorsvalidcaselistbuilder)
    builder for List payloads | +| static class | [ItemsDoesNotLookInApplicatorsValidCase.ItemsDoesNotLookInApplicatorsValidCaseList](#itemsdoesnotlookinapplicatorsvalidcaselist)
    output class for List payloads | +| sealed interface | [ItemsDoesNotLookInApplicatorsValidCase.ItemsBoxed](#itemsboxed)
    sealed interface for validated payloads | +| record | [ItemsDoesNotLookInApplicatorsValidCase.ItemsBoxedVoid](#itemsboxedvoid)
    boxed class to store validated null payloads | +| record | [ItemsDoesNotLookInApplicatorsValidCase.ItemsBoxedBoolean](#itemsboxedboolean)
    boxed class to store validated boolean payloads | +| record | [ItemsDoesNotLookInApplicatorsValidCase.ItemsBoxedNumber](#itemsboxednumber)
    boxed class to store validated Number payloads | +| record | [ItemsDoesNotLookInApplicatorsValidCase.ItemsBoxedString](#itemsboxedstring)
    boxed class to store validated String payloads | +| record | [ItemsDoesNotLookInApplicatorsValidCase.ItemsBoxedList](#itemsboxedlist)
    boxed class to store validated List payloads | +| record | [ItemsDoesNotLookInApplicatorsValidCase.ItemsBoxedMap](#itemsboxedmap)
    boxed class to store validated Map payloads | +| static class | [ItemsDoesNotLookInApplicatorsValidCase.Items](#items)
    schema class | + +## ItemsDoesNotLookInApplicatorsValidCase1Boxed +sealed interface ItemsDoesNotLookInApplicatorsValidCase1Boxed
    +permits
    +[ItemsDoesNotLookInApplicatorsValidCase1BoxedList](#itemsdoesnotlookinapplicatorsvalidcase1boxedlist) + +sealed interface that stores validated payloads using boxed classes + +## ItemsDoesNotLookInApplicatorsValidCase1BoxedList +data class ItemsDoesNotLookInApplicatorsValidCase1BoxedList
    +implements [ItemsDoesNotLookInApplicatorsValidCase1Boxed](#itemsdoesnotlookinapplicatorsvalidcase1boxed) + +data class that stores validated List payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| ItemsDoesNotLookInApplicatorsValidCase1BoxedList([ItemsDoesNotLookInApplicatorsValidCaseList](#itemsdoesnotlookinapplicatorsvalidcaselist) data)
    Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| [ItemsDoesNotLookInApplicatorsValidCaseList](#itemsdoesnotlookinapplicatorsvalidcaselist) | data()
    validated payload | +| Any? | getData()
    validated payload | + +## ItemsDoesNotLookInApplicatorsValidCase1 +class ItemsDoesNotLookInApplicatorsValidCase1
    +extends JsonSchema + +A schema class that validates payloads + +### Code Sample +``` +import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags; +import org.openapijsonschematools.client.configurations.SchemaConfiguration; +import org.openapijsonschematools.client.exceptions.ValidationException; +import org.openapijsonschematools.client.schemas.validation.MapUtils; +import org.openapijsonschematools.client.schemas.validation.FrozenList; +import org.openapijsonschematools.client.schemas.validation.FrozenMap; +import org.openapijsonschematools.client.components.schemas.ItemsDoesNotLookInApplicatorsValidCase; + +import java.util.Arrays; +import java.util.List; +import java.util.AbstractMap; + +static final SchemaConfiguration configuration = new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().build()); + +// List validation +ItemsDoesNotLookInApplicatorsValidCase.ItemsDoesNotLookInApplicatorsValidCaseList validatedPayload = + ItemsDoesNotLookInApplicatorsValidCase.ItemsDoesNotLookInApplicatorsValidCase1.validate( + new ItemsDoesNotLookInApplicatorsValidCase.ItemsDoesNotLookInApplicatorsValidCaseListBuilder() + .build(), + configuration +); +``` + +### Field Summary +| Modifier and Type | Field and Description | +| ----------------- | ---------------------- | +| Set> | type = setOf(List::class.java) | +| Class | items = [Items::class.java](#items) | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| [ItemsDoesNotLookInApplicatorsValidCaseList](#itemsdoesnotlookinapplicatorsvalidcaselist) | validate(arg: [List<*>](#itemsdoesnotlookinapplicatorsvalidcaselistbuilder), configuration: SchemaConfiguration) | +| [ItemsDoesNotLookInApplicatorsValidCase1BoxedList](#itemsdoesnotlookinapplicatorsvalidcase1boxedlist) | validateAndBox([List<*>](#itemsdoesnotlookinapplicatorsvalidcaselistbuilder), configuration: SchemaConfiguration) | +| [ItemsDoesNotLookInApplicatorsValidCase1Boxed](#itemsdoesnotlookinapplicatorsvalidcase1boxed) | validateAndBox(Any?, configuration: SchemaConfiguration) | +| Any? | validate(arg: Any?, configuration: SchemaConfiguration) | + +## ItemsDoesNotLookInApplicatorsValidCaseListBuilder +class ItemsDoesNotLookInApplicatorsValidCaseListBuilder
    +builder for `List` + +A class that builds the List input type + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| ItemsDoesNotLookInApplicatorsValidCaseListBuilder()
    Creates an empty list | +| ItemsDoesNotLookInApplicatorsValidCaseListBuilder(List items)
    Stores the items in a list | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| ItemsDoesNotLookInApplicatorsValidCaseListBuilder | add(item: Nothing?) | +| ItemsDoesNotLookInApplicatorsValidCaseListBuilder | add(item: Boolean) | +| ItemsDoesNotLookInApplicatorsValidCaseListBuilder | add(item: String) | +| ItemsDoesNotLookInApplicatorsValidCaseListBuilder | add(item: Int) | +| ItemsDoesNotLookInApplicatorsValidCaseListBuilder | add(item: Float) | +| ItemsDoesNotLookInApplicatorsValidCaseListBuilder | add(item: Long) | +| ItemsDoesNotLookInApplicatorsValidCaseListBuilder | add(item: Double) | +| ItemsDoesNotLookInApplicatorsValidCaseListBuilder | add(item: List) | +| ItemsDoesNotLookInApplicatorsValidCaseListBuilder | add(item: Map) | +| List | build()
    Returns list input that should be used with Schema.validate | + +## ItemsDoesNotLookInApplicatorsValidCaseList +class ItemsDoesNotLookInApplicatorsValidCaseList
    +extends `FrozenList` + +A class to store validated List payloads + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| static [ItemsDoesNotLookInApplicatorsValidCaseList](#itemsdoesnotlookinapplicatorsvalidcaselist) | of([List](#itemsdoesnotlookinapplicatorsvalidcaselistbuilder) arg, SchemaConfiguration configuration) | + +## ItemsBoxed +sealed interface ItemsBoxed
    +permits
    +[ItemsBoxedVoid](#itemsboxedvoid), +[ItemsBoxedBoolean](#itemsboxedboolean), +[ItemsBoxedNumber](#itemsboxednumber), +[ItemsBoxedString](#itemsboxedstring), +[ItemsBoxedList](#itemsboxedlist), +[ItemsBoxedMap](#itemsboxedmap) + +sealed interface that stores validated payloads using boxed classes + +## ItemsBoxedVoid +data class ItemsBoxedVoid
    +implements [ItemsBoxed](#itemsboxed) + +data class that stores validated null payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| ItemsBoxedVoid(Nothing? data)
    Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| Nothing? | data()
    validated payload | +| Any? | getData()
    validated payload | + +## ItemsBoxedBoolean +data class ItemsBoxedBoolean
    +implements [ItemsBoxed](#itemsboxed) + +record that stores validated boolean payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| ItemsBoxedBoolean(boolean data)
    Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| boolean | data()
    validated payload | +| Any? | getData()
    validated payload | + +## ItemsBoxedNumber +data class ItemsBoxedNumber
    +implements [ItemsBoxed](#itemsboxed) + +data class that stores validated Number payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| ItemsBoxedNumber(Number data)
    Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| Number | data()
    validated payload | +| Any? | getData()
    validated payload | + +## ItemsBoxedString +data class ItemsBoxedString
    +implements [ItemsBoxed](#itemsboxed) + +data class that stores validated String payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| ItemsBoxedString(String data)
    Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| String | data()
    validated payload | +| Any? | getData()
    validated payload | + +## ItemsBoxedList +data class ItemsBoxedList
    +implements [ItemsBoxed](#itemsboxed) + +data class that stores validated List payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| ItemsBoxedList(FrozenList data)
    Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| FrozenList | data()
    validated payload | +| Any? | getData()
    validated payload | + +## ItemsBoxedMap +data class ItemsBoxedMap
    +implements [ItemsBoxed](#itemsboxed) + +data class that stores validated Map payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| ItemsBoxedMap(FrozenMap data)
    Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| FrozenMap | data()
    validated payload | +| Any? | getData()
    validated payload | + +## Items +class Items
    +extends JsonSchema + +A schema class that validates payloads + +### Field Summary +| Modifier and Type | Field and Description | +| ----------------- | ---------------------- | +| Number | minimum = 5 | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| String | validate(arg: String, configuration: SchemaConfiguration) | +| Nothing? | validate(arg: Nothing?, configuration: SchemaConfiguration) | +| int | validate(arg: int, configuration: SchemaConfiguration) | +| long | validate(arg: long, configuration: SchemaConfiguration) | +| float | validate(arg: float, configuration: SchemaConfiguration) | +| double | validate(arg: double, configuration: SchemaConfiguration) | +| Number | validate(arg: Number, configuration: SchemaConfiguration) | +| boolean | validate(arg: boolean, configuration: SchemaConfiguration) | +| FrozenMap | validate(arg: Map<?, ?>, configuration: SchemaConfiguration) | +| FrozenList | validate(arg: List<*>, configuration: SchemaConfiguration) | +| [ItemsBoxedString](#itemsboxedstring) | validateAndBox(String, configuration: SchemaConfiguration) | +| [ItemsBoxedVoid](#itemsboxedvoid) | validateAndBox(Nothing?, configuration: SchemaConfiguration) | +| [ItemsBoxedNumber](#itemsboxednumber) | validateAndBox(Number, configuration: SchemaConfiguration) | +| [ItemsBoxedBoolean](#itemsboxedboolean) | validateAndBox(boolean, configuration: SchemaConfiguration) | +| [ItemsBoxedMap](#itemsboxedmap) | validateAndBox(Map<?, ?>, configuration: SchemaConfiguration) | +| [ItemsBoxedList](#itemsboxedlist) | validateAndBox(List<*>, configuration: SchemaConfiguration) | +| [ItemsBoxed](#itemsboxed) | validateAndBox(Any?, configuration: SchemaConfiguration) | +| Any? | validate(arg: Any?, configuration: SchemaConfiguration) | + +[[Back to top]](#top) [[Back to Component Schemas]](../../../README.md#Component-Schemas) [[Back to README]](../../../README.md) diff --git a/samples/client/3_1_0_unit_test/kotlin/docs/components/schemas/ItemsWithNullInstanceElements.md b/samples/client/3_1_0_unit_test/kotlin/docs/components/schemas/ItemsWithNullInstanceElements.md new file mode 100644 index 00000000000..c7321c84a46 --- /dev/null +++ b/samples/client/3_1_0_unit_test/kotlin/docs/components/schemas/ItemsWithNullInstanceElements.md @@ -0,0 +1,159 @@ +# ItemsWithNullInstanceElements +org.openapijsonschematools.client.components.schemas.ItemsWithNullInstanceElements.java +class ItemsWithNullInstanceElements
    + +A class that contains necessary nested +- schema classes (which validate payloads), extends JsonSchema +- sealed interfaces which store validated payloads, Kotlin version of a sum type +- boxed classes which store validated payloads, sealed permits class implementations +- classes to store validated list payloads, extends FrozenList +- classes to build inputs for list payloads + +## Nested Class Summary +| Modifier and Type | Class and Description | +| ----------------- | ---------------------- | +| sealed interface | [ItemsWithNullInstanceElements.ItemsWithNullInstanceElements1Boxed](#itemswithnullinstanceelements1boxed)
    sealed interface for validated payloads | +| record | [ItemsWithNullInstanceElements.ItemsWithNullInstanceElements1BoxedList](#itemswithnullinstanceelements1boxedlist)
    boxed class to store validated List payloads | +| static class | [ItemsWithNullInstanceElements.ItemsWithNullInstanceElements1](#itemswithnullinstanceelements1)
    schema class | +| static class | [ItemsWithNullInstanceElements.ItemsWithNullInstanceElementsListBuilder](#itemswithnullinstanceelementslistbuilder)
    builder for List payloads | +| static class | [ItemsWithNullInstanceElements.ItemsWithNullInstanceElementsList](#itemswithnullinstanceelementslist)
    output class for List payloads | +| sealed interface | [ItemsWithNullInstanceElements.ItemsBoxed](#itemsboxed)
    sealed interface for validated payloads | +| record | [ItemsWithNullInstanceElements.ItemsBoxedVoid](#itemsboxedvoid)
    boxed class to store validated null payloads | +| static class | [ItemsWithNullInstanceElements.Items](#items)
    schema class | + +## ItemsWithNullInstanceElements1Boxed +sealed interface ItemsWithNullInstanceElements1Boxed
    +permits
    +[ItemsWithNullInstanceElements1BoxedList](#itemswithnullinstanceelements1boxedlist) + +sealed interface that stores validated payloads using boxed classes + +## ItemsWithNullInstanceElements1BoxedList +data class ItemsWithNullInstanceElements1BoxedList
    +implements [ItemsWithNullInstanceElements1Boxed](#itemswithnullinstanceelements1boxed) + +data class that stores validated List payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| ItemsWithNullInstanceElements1BoxedList([ItemsWithNullInstanceElementsList](#itemswithnullinstanceelementslist) data)
    Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| [ItemsWithNullInstanceElementsList](#itemswithnullinstanceelementslist) | data()
    validated payload | +| Any? | getData()
    validated payload | + +## ItemsWithNullInstanceElements1 +class ItemsWithNullInstanceElements1
    +extends JsonSchema + +A schema class that validates payloads + +### Code Sample +``` +import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags; +import org.openapijsonschematools.client.configurations.SchemaConfiguration; +import org.openapijsonschematools.client.exceptions.ValidationException; +import org.openapijsonschematools.client.schemas.validation.MapUtils; +import org.openapijsonschematools.client.schemas.validation.FrozenList; +import org.openapijsonschematools.client.schemas.validation.FrozenMap; +import org.openapijsonschematools.client.components.schemas.ItemsWithNullInstanceElements; + +import java.util.Arrays; +import java.util.List; +import java.util.AbstractMap; + +static final SchemaConfiguration configuration = new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().build()); + +// List validation +ItemsWithNullInstanceElements.ItemsWithNullInstanceElementsList validatedPayload = + ItemsWithNullInstanceElements.ItemsWithNullInstanceElements1.validate( + new ItemsWithNullInstanceElements.ItemsWithNullInstanceElementsListBuilder() + .add(null) + + .build(), + configuration +); +``` + +### Field Summary +| Modifier and Type | Field and Description | +| ----------------- | ---------------------- | +| Set> | type = setOf(List::class.java) | +| Class | items = [Items::class.java](#items) | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| [ItemsWithNullInstanceElementsList](#itemswithnullinstanceelementslist) | validate(arg: [List<*>](#itemswithnullinstanceelementslistbuilder), configuration: SchemaConfiguration) | +| [ItemsWithNullInstanceElements1BoxedList](#itemswithnullinstanceelements1boxedlist) | validateAndBox([List<*>](#itemswithnullinstanceelementslistbuilder), configuration: SchemaConfiguration) | +| [ItemsWithNullInstanceElements1Boxed](#itemswithnullinstanceelements1boxed) | validateAndBox(Any?, configuration: SchemaConfiguration) | +| Any? | validate(arg: Any?, configuration: SchemaConfiguration) | + +## ItemsWithNullInstanceElementsListBuilder +class ItemsWithNullInstanceElementsListBuilder
    +builder for `List` + +A class that builds the List input type + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| ItemsWithNullInstanceElementsListBuilder()
    Creates an empty list | +| ItemsWithNullInstanceElementsListBuilder(List items)
    Stores the items in a list | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| ItemsWithNullInstanceElementsListBuilder | add(item: Nothing?) | +| List | build()
    Returns list input that should be used with Schema.validate | + +## ItemsWithNullInstanceElementsList +class ItemsWithNullInstanceElementsList
    +extends `FrozenList` + +A class to store validated List payloads + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| static [ItemsWithNullInstanceElementsList](#itemswithnullinstanceelementslist) | of([List](#itemswithnullinstanceelementslistbuilder) arg, SchemaConfiguration configuration) | + +## ItemsBoxed +sealed interface ItemsBoxed
    +permits
    +[ItemsBoxedVoid](#itemsboxedvoid) + +sealed interface that stores validated payloads using boxed classes + +## ItemsBoxedVoid +data class ItemsBoxedVoid
    +implements [ItemsBoxed](#itemsboxed) + +data class that stores validated null payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| ItemsBoxedVoid(Nothing? data)
    Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| Nothing? | data()
    validated payload | +| Any? | getData()
    validated payload | + +## Items +class Items
    +extends NullJsonSchema.NullJsonSchema1 + +A schema class that validates payloads + +| Methods Inherited from class org.openapijsonschematools.client.schemas.NullJsonSchema.NullJsonSchema1 | +| ------------------------------------------------------------------ | +| validate | +| validateAndBox | + +[[Back to top]](#top) [[Back to Component Schemas]](../../../README.md#Component-Schemas) [[Back to README]](../../../README.md) diff --git a/samples/client/3_1_0_unit_test/kotlin/docs/components/schemas/JsonPointerFormat.md b/samples/client/3_1_0_unit_test/kotlin/docs/components/schemas/JsonPointerFormat.md new file mode 100644 index 00000000000..6eddd588dff --- /dev/null +++ b/samples/client/3_1_0_unit_test/kotlin/docs/components/schemas/JsonPointerFormat.md @@ -0,0 +1,169 @@ +# JsonPointerFormat +org.openapijsonschematools.client.components.schemas.JsonPointerFormat.java +class JsonPointerFormat
    + +A class that contains necessary nested +- schema classes (which validate payloads), extends JsonSchema +- sealed interfaces which store validated payloads, Kotlin version of a sum type +- boxed classes which store validated payloads, sealed permits class implementations + +## Nested Class Summary +| Modifier and Type | Class and Description | +| ----------------- | ---------------------- | +| sealed interface | [JsonPointerFormat.JsonPointerFormat1Boxed](#jsonpointerformat1boxed)
    sealed interface for validated payloads | +| record | [JsonPointerFormat.JsonPointerFormat1BoxedVoid](#jsonpointerformat1boxedvoid)
    boxed class to store validated null payloads | +| record | [JsonPointerFormat.JsonPointerFormat1BoxedBoolean](#jsonpointerformat1boxedboolean)
    boxed class to store validated boolean payloads | +| record | [JsonPointerFormat.JsonPointerFormat1BoxedNumber](#jsonpointerformat1boxednumber)
    boxed class to store validated Number payloads | +| record | [JsonPointerFormat.JsonPointerFormat1BoxedString](#jsonpointerformat1boxedstring)
    boxed class to store validated String payloads | +| record | [JsonPointerFormat.JsonPointerFormat1BoxedList](#jsonpointerformat1boxedlist)
    boxed class to store validated List payloads | +| record | [JsonPointerFormat.JsonPointerFormat1BoxedMap](#jsonpointerformat1boxedmap)
    boxed class to store validated Map payloads | +| static class | [JsonPointerFormat.JsonPointerFormat1](#jsonpointerformat1)
    schema class | + +## JsonPointerFormat1Boxed +sealed interface JsonPointerFormat1Boxed
    +permits
    +[JsonPointerFormat1BoxedVoid](#jsonpointerformat1boxedvoid), +[JsonPointerFormat1BoxedBoolean](#jsonpointerformat1boxedboolean), +[JsonPointerFormat1BoxedNumber](#jsonpointerformat1boxednumber), +[JsonPointerFormat1BoxedString](#jsonpointerformat1boxedstring), +[JsonPointerFormat1BoxedList](#jsonpointerformat1boxedlist), +[JsonPointerFormat1BoxedMap](#jsonpointerformat1boxedmap) + +sealed interface that stores validated payloads using boxed classes + +## JsonPointerFormat1BoxedVoid +data class JsonPointerFormat1BoxedVoid
    +implements [JsonPointerFormat1Boxed](#jsonpointerformat1boxed) + +data class that stores validated null payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| JsonPointerFormat1BoxedVoid(Nothing? data)
    Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| Nothing? | data()
    validated payload | +| Any? | getData()
    validated payload | + +## JsonPointerFormat1BoxedBoolean +data class JsonPointerFormat1BoxedBoolean
    +implements [JsonPointerFormat1Boxed](#jsonpointerformat1boxed) + +record that stores validated boolean payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| JsonPointerFormat1BoxedBoolean(boolean data)
    Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| boolean | data()
    validated payload | +| Any? | getData()
    validated payload | + +## JsonPointerFormat1BoxedNumber +data class JsonPointerFormat1BoxedNumber
    +implements [JsonPointerFormat1Boxed](#jsonpointerformat1boxed) + +data class that stores validated Number payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| JsonPointerFormat1BoxedNumber(Number data)
    Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| Number | data()
    validated payload | +| Any? | getData()
    validated payload | + +## JsonPointerFormat1BoxedString +data class JsonPointerFormat1BoxedString
    +implements [JsonPointerFormat1Boxed](#jsonpointerformat1boxed) + +data class that stores validated String payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| JsonPointerFormat1BoxedString(String data)
    Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| String | data()
    validated payload | +| Any? | getData()
    validated payload | + +## JsonPointerFormat1BoxedList +data class JsonPointerFormat1BoxedList
    +implements [JsonPointerFormat1Boxed](#jsonpointerformat1boxed) + +data class that stores validated List payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| JsonPointerFormat1BoxedList(FrozenList data)
    Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| FrozenList | data()
    validated payload | +| Any? | getData()
    validated payload | + +## JsonPointerFormat1BoxedMap +data class JsonPointerFormat1BoxedMap
    +implements [JsonPointerFormat1Boxed](#jsonpointerformat1boxed) + +data class that stores validated Map payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| JsonPointerFormat1BoxedMap(FrozenMap data)
    Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| FrozenMap | data()
    validated payload | +| Any? | getData()
    validated payload | + +## JsonPointerFormat1 +class JsonPointerFormat1
    +extends JsonSchema + +A schema class that validates payloads + +### Field Summary +| Modifier and Type | Field and Description | +| ----------------- | ---------------------- | +| String | type = "json-pointer"; | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| String | validate(arg: String, configuration: SchemaConfiguration) | +| Nothing? | validate(arg: Nothing?, configuration: SchemaConfiguration) | +| int | validate(arg: int, configuration: SchemaConfiguration) | +| long | validate(arg: long, configuration: SchemaConfiguration) | +| float | validate(arg: float, configuration: SchemaConfiguration) | +| double | validate(arg: double, configuration: SchemaConfiguration) | +| Number | validate(arg: Number, configuration: SchemaConfiguration) | +| boolean | validate(arg: boolean, configuration: SchemaConfiguration) | +| FrozenMap | validate(arg: Map<?, ?>, configuration: SchemaConfiguration) | +| FrozenList | validate(arg: List<*>, configuration: SchemaConfiguration) | +| [JsonPointerFormat1BoxedString](#jsonpointerformat1boxedstring) | validateAndBox(String, configuration: SchemaConfiguration) | +| [JsonPointerFormat1BoxedVoid](#jsonpointerformat1boxedvoid) | validateAndBox(Nothing?, configuration: SchemaConfiguration) | +| [JsonPointerFormat1BoxedNumber](#jsonpointerformat1boxednumber) | validateAndBox(Number, configuration: SchemaConfiguration) | +| [JsonPointerFormat1BoxedBoolean](#jsonpointerformat1boxedboolean) | validateAndBox(boolean, configuration: SchemaConfiguration) | +| [JsonPointerFormat1BoxedMap](#jsonpointerformat1boxedmap) | validateAndBox(Map<?, ?>, configuration: SchemaConfiguration) | +| [JsonPointerFormat1BoxedList](#jsonpointerformat1boxedlist) | validateAndBox(List<*>, configuration: SchemaConfiguration) | +| [JsonPointerFormat1Boxed](#jsonpointerformat1boxed) | validateAndBox(Any?, configuration: SchemaConfiguration) | +| Any? | validate(arg: Any?, configuration: SchemaConfiguration) | + +[[Back to top]](#top) [[Back to Component Schemas]](../../../README.md#Component-Schemas) [[Back to README]](../../../README.md) diff --git a/samples/client/3_1_0_unit_test/kotlin/docs/components/schemas/MaxcontainsWithoutContainsIsIgnored.md b/samples/client/3_1_0_unit_test/kotlin/docs/components/schemas/MaxcontainsWithoutContainsIsIgnored.md new file mode 100644 index 00000000000..5d7c780cf02 --- /dev/null +++ b/samples/client/3_1_0_unit_test/kotlin/docs/components/schemas/MaxcontainsWithoutContainsIsIgnored.md @@ -0,0 +1,169 @@ +# MaxcontainsWithoutContainsIsIgnored +org.openapijsonschematools.client.components.schemas.MaxcontainsWithoutContainsIsIgnored.java +class MaxcontainsWithoutContainsIsIgnored
    + +A class that contains necessary nested +- schema classes (which validate payloads), extends JsonSchema +- sealed interfaces which store validated payloads, Kotlin version of a sum type +- boxed classes which store validated payloads, sealed permits class implementations + +## Nested Class Summary +| Modifier and Type | Class and Description | +| ----------------- | ---------------------- | +| sealed interface | [MaxcontainsWithoutContainsIsIgnored.MaxcontainsWithoutContainsIsIgnored1Boxed](#maxcontainswithoutcontainsisignored1boxed)
    sealed interface for validated payloads | +| record | [MaxcontainsWithoutContainsIsIgnored.MaxcontainsWithoutContainsIsIgnored1BoxedVoid](#maxcontainswithoutcontainsisignored1boxedvoid)
    boxed class to store validated null payloads | +| record | [MaxcontainsWithoutContainsIsIgnored.MaxcontainsWithoutContainsIsIgnored1BoxedBoolean](#maxcontainswithoutcontainsisignored1boxedboolean)
    boxed class to store validated boolean payloads | +| record | [MaxcontainsWithoutContainsIsIgnored.MaxcontainsWithoutContainsIsIgnored1BoxedNumber](#maxcontainswithoutcontainsisignored1boxednumber)
    boxed class to store validated Number payloads | +| record | [MaxcontainsWithoutContainsIsIgnored.MaxcontainsWithoutContainsIsIgnored1BoxedString](#maxcontainswithoutcontainsisignored1boxedstring)
    boxed class to store validated String payloads | +| record | [MaxcontainsWithoutContainsIsIgnored.MaxcontainsWithoutContainsIsIgnored1BoxedList](#maxcontainswithoutcontainsisignored1boxedlist)
    boxed class to store validated List payloads | +| record | [MaxcontainsWithoutContainsIsIgnored.MaxcontainsWithoutContainsIsIgnored1BoxedMap](#maxcontainswithoutcontainsisignored1boxedmap)
    boxed class to store validated Map payloads | +| static class | [MaxcontainsWithoutContainsIsIgnored.MaxcontainsWithoutContainsIsIgnored1](#maxcontainswithoutcontainsisignored1)
    schema class | + +## MaxcontainsWithoutContainsIsIgnored1Boxed +sealed interface MaxcontainsWithoutContainsIsIgnored1Boxed
    +permits
    +[MaxcontainsWithoutContainsIsIgnored1BoxedVoid](#maxcontainswithoutcontainsisignored1boxedvoid), +[MaxcontainsWithoutContainsIsIgnored1BoxedBoolean](#maxcontainswithoutcontainsisignored1boxedboolean), +[MaxcontainsWithoutContainsIsIgnored1BoxedNumber](#maxcontainswithoutcontainsisignored1boxednumber), +[MaxcontainsWithoutContainsIsIgnored1BoxedString](#maxcontainswithoutcontainsisignored1boxedstring), +[MaxcontainsWithoutContainsIsIgnored1BoxedList](#maxcontainswithoutcontainsisignored1boxedlist), +[MaxcontainsWithoutContainsIsIgnored1BoxedMap](#maxcontainswithoutcontainsisignored1boxedmap) + +sealed interface that stores validated payloads using boxed classes + +## MaxcontainsWithoutContainsIsIgnored1BoxedVoid +data class MaxcontainsWithoutContainsIsIgnored1BoxedVoid
    +implements [MaxcontainsWithoutContainsIsIgnored1Boxed](#maxcontainswithoutcontainsisignored1boxed) + +data class that stores validated null payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| MaxcontainsWithoutContainsIsIgnored1BoxedVoid(Nothing? data)
    Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| Nothing? | data()
    validated payload | +| Any? | getData()
    validated payload | + +## MaxcontainsWithoutContainsIsIgnored1BoxedBoolean +data class MaxcontainsWithoutContainsIsIgnored1BoxedBoolean
    +implements [MaxcontainsWithoutContainsIsIgnored1Boxed](#maxcontainswithoutcontainsisignored1boxed) + +record that stores validated boolean payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| MaxcontainsWithoutContainsIsIgnored1BoxedBoolean(boolean data)
    Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| boolean | data()
    validated payload | +| Any? | getData()
    validated payload | + +## MaxcontainsWithoutContainsIsIgnored1BoxedNumber +data class MaxcontainsWithoutContainsIsIgnored1BoxedNumber
    +implements [MaxcontainsWithoutContainsIsIgnored1Boxed](#maxcontainswithoutcontainsisignored1boxed) + +data class that stores validated Number payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| MaxcontainsWithoutContainsIsIgnored1BoxedNumber(Number data)
    Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| Number | data()
    validated payload | +| Any? | getData()
    validated payload | + +## MaxcontainsWithoutContainsIsIgnored1BoxedString +data class MaxcontainsWithoutContainsIsIgnored1BoxedString
    +implements [MaxcontainsWithoutContainsIsIgnored1Boxed](#maxcontainswithoutcontainsisignored1boxed) + +data class that stores validated String payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| MaxcontainsWithoutContainsIsIgnored1BoxedString(String data)
    Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| String | data()
    validated payload | +| Any? | getData()
    validated payload | + +## MaxcontainsWithoutContainsIsIgnored1BoxedList +data class MaxcontainsWithoutContainsIsIgnored1BoxedList
    +implements [MaxcontainsWithoutContainsIsIgnored1Boxed](#maxcontainswithoutcontainsisignored1boxed) + +data class that stores validated List payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| MaxcontainsWithoutContainsIsIgnored1BoxedList(FrozenList data)
    Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| FrozenList | data()
    validated payload | +| Any? | getData()
    validated payload | + +## MaxcontainsWithoutContainsIsIgnored1BoxedMap +data class MaxcontainsWithoutContainsIsIgnored1BoxedMap
    +implements [MaxcontainsWithoutContainsIsIgnored1Boxed](#maxcontainswithoutcontainsisignored1boxed) + +data class that stores validated Map payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| MaxcontainsWithoutContainsIsIgnored1BoxedMap(FrozenMap data)
    Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| FrozenMap | data()
    validated payload | +| Any? | getData()
    validated payload | + +## MaxcontainsWithoutContainsIsIgnored1 +class MaxcontainsWithoutContainsIsIgnored1
    +extends JsonSchema + +A schema class that validates payloads + +### Field Summary +| Modifier and Type | Field and Description | +| ----------------- | ---------------------- | +| Integer | maxContains = 1 | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| String | validate(arg: String, configuration: SchemaConfiguration) | +| Nothing? | validate(arg: Nothing?, configuration: SchemaConfiguration) | +| int | validate(arg: int, configuration: SchemaConfiguration) | +| long | validate(arg: long, configuration: SchemaConfiguration) | +| float | validate(arg: float, configuration: SchemaConfiguration) | +| double | validate(arg: double, configuration: SchemaConfiguration) | +| Number | validate(arg: Number, configuration: SchemaConfiguration) | +| boolean | validate(arg: boolean, configuration: SchemaConfiguration) | +| FrozenMap | validate(arg: Map<?, ?>, configuration: SchemaConfiguration) | +| FrozenList | validate(arg: List<*>, configuration: SchemaConfiguration) | +| [MaxcontainsWithoutContainsIsIgnored1BoxedString](#maxcontainswithoutcontainsisignored1boxedstring) | validateAndBox(String, configuration: SchemaConfiguration) | +| [MaxcontainsWithoutContainsIsIgnored1BoxedVoid](#maxcontainswithoutcontainsisignored1boxedvoid) | validateAndBox(Nothing?, configuration: SchemaConfiguration) | +| [MaxcontainsWithoutContainsIsIgnored1BoxedNumber](#maxcontainswithoutcontainsisignored1boxednumber) | validateAndBox(Number, configuration: SchemaConfiguration) | +| [MaxcontainsWithoutContainsIsIgnored1BoxedBoolean](#maxcontainswithoutcontainsisignored1boxedboolean) | validateAndBox(boolean, configuration: SchemaConfiguration) | +| [MaxcontainsWithoutContainsIsIgnored1BoxedMap](#maxcontainswithoutcontainsisignored1boxedmap) | validateAndBox(Map<?, ?>, configuration: SchemaConfiguration) | +| [MaxcontainsWithoutContainsIsIgnored1BoxedList](#maxcontainswithoutcontainsisignored1boxedlist) | validateAndBox(List<*>, configuration: SchemaConfiguration) | +| [MaxcontainsWithoutContainsIsIgnored1Boxed](#maxcontainswithoutcontainsisignored1boxed) | validateAndBox(Any?, configuration: SchemaConfiguration) | +| Any? | validate(arg: Any?, configuration: SchemaConfiguration) | + +[[Back to top]](#top) [[Back to Component Schemas]](../../../README.md#Component-Schemas) [[Back to README]](../../../README.md) diff --git a/samples/client/3_1_0_unit_test/kotlin/docs/components/schemas/MaximumValidation.md b/samples/client/3_1_0_unit_test/kotlin/docs/components/schemas/MaximumValidation.md new file mode 100644 index 00000000000..30da56e71cc --- /dev/null +++ b/samples/client/3_1_0_unit_test/kotlin/docs/components/schemas/MaximumValidation.md @@ -0,0 +1,169 @@ +# MaximumValidation +org.openapijsonschematools.client.components.schemas.MaximumValidation.java +class MaximumValidation
    + +A class that contains necessary nested +- schema classes (which validate payloads), extends JsonSchema +- sealed interfaces which store validated payloads, Kotlin version of a sum type +- boxed classes which store validated payloads, sealed permits class implementations + +## Nested Class Summary +| Modifier and Type | Class and Description | +| ----------------- | ---------------------- | +| sealed interface | [MaximumValidation.MaximumValidation1Boxed](#maximumvalidation1boxed)
    sealed interface for validated payloads | +| record | [MaximumValidation.MaximumValidation1BoxedVoid](#maximumvalidation1boxedvoid)
    boxed class to store validated null payloads | +| record | [MaximumValidation.MaximumValidation1BoxedBoolean](#maximumvalidation1boxedboolean)
    boxed class to store validated boolean payloads | +| record | [MaximumValidation.MaximumValidation1BoxedNumber](#maximumvalidation1boxednumber)
    boxed class to store validated Number payloads | +| record | [MaximumValidation.MaximumValidation1BoxedString](#maximumvalidation1boxedstring)
    boxed class to store validated String payloads | +| record | [MaximumValidation.MaximumValidation1BoxedList](#maximumvalidation1boxedlist)
    boxed class to store validated List payloads | +| record | [MaximumValidation.MaximumValidation1BoxedMap](#maximumvalidation1boxedmap)
    boxed class to store validated Map payloads | +| static class | [MaximumValidation.MaximumValidation1](#maximumvalidation1)
    schema class | + +## MaximumValidation1Boxed +sealed interface MaximumValidation1Boxed
    +permits
    +[MaximumValidation1BoxedVoid](#maximumvalidation1boxedvoid), +[MaximumValidation1BoxedBoolean](#maximumvalidation1boxedboolean), +[MaximumValidation1BoxedNumber](#maximumvalidation1boxednumber), +[MaximumValidation1BoxedString](#maximumvalidation1boxedstring), +[MaximumValidation1BoxedList](#maximumvalidation1boxedlist), +[MaximumValidation1BoxedMap](#maximumvalidation1boxedmap) + +sealed interface that stores validated payloads using boxed classes + +## MaximumValidation1BoxedVoid +data class MaximumValidation1BoxedVoid
    +implements [MaximumValidation1Boxed](#maximumvalidation1boxed) + +data class that stores validated null payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| MaximumValidation1BoxedVoid(Nothing? data)
    Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| Nothing? | data()
    validated payload | +| Any? | getData()
    validated payload | + +## MaximumValidation1BoxedBoolean +data class MaximumValidation1BoxedBoolean
    +implements [MaximumValidation1Boxed](#maximumvalidation1boxed) + +record that stores validated boolean payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| MaximumValidation1BoxedBoolean(boolean data)
    Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| boolean | data()
    validated payload | +| Any? | getData()
    validated payload | + +## MaximumValidation1BoxedNumber +data class MaximumValidation1BoxedNumber
    +implements [MaximumValidation1Boxed](#maximumvalidation1boxed) + +data class that stores validated Number payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| MaximumValidation1BoxedNumber(Number data)
    Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| Number | data()
    validated payload | +| Any? | getData()
    validated payload | + +## MaximumValidation1BoxedString +data class MaximumValidation1BoxedString
    +implements [MaximumValidation1Boxed](#maximumvalidation1boxed) + +data class that stores validated String payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| MaximumValidation1BoxedString(String data)
    Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| String | data()
    validated payload | +| Any? | getData()
    validated payload | + +## MaximumValidation1BoxedList +data class MaximumValidation1BoxedList
    +implements [MaximumValidation1Boxed](#maximumvalidation1boxed) + +data class that stores validated List payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| MaximumValidation1BoxedList(FrozenList data)
    Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| FrozenList | data()
    validated payload | +| Any? | getData()
    validated payload | + +## MaximumValidation1BoxedMap +data class MaximumValidation1BoxedMap
    +implements [MaximumValidation1Boxed](#maximumvalidation1boxed) + +data class that stores validated Map payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| MaximumValidation1BoxedMap(FrozenMap data)
    Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| FrozenMap | data()
    validated payload | +| Any? | getData()
    validated payload | + +## MaximumValidation1 +class MaximumValidation1
    +extends JsonSchema + +A schema class that validates payloads + +### Field Summary +| Modifier and Type | Field and Description | +| ----------------- | ---------------------- | +| Number | maximum = 3.0 | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| String | validate(arg: String, configuration: SchemaConfiguration) | +| Nothing? | validate(arg: Nothing?, configuration: SchemaConfiguration) | +| int | validate(arg: int, configuration: SchemaConfiguration) | +| long | validate(arg: long, configuration: SchemaConfiguration) | +| float | validate(arg: float, configuration: SchemaConfiguration) | +| double | validate(arg: double, configuration: SchemaConfiguration) | +| Number | validate(arg: Number, configuration: SchemaConfiguration) | +| boolean | validate(arg: boolean, configuration: SchemaConfiguration) | +| FrozenMap | validate(arg: Map<?, ?>, configuration: SchemaConfiguration) | +| FrozenList | validate(arg: List<*>, configuration: SchemaConfiguration) | +| [MaximumValidation1BoxedString](#maximumvalidation1boxedstring) | validateAndBox(String, configuration: SchemaConfiguration) | +| [MaximumValidation1BoxedVoid](#maximumvalidation1boxedvoid) | validateAndBox(Nothing?, configuration: SchemaConfiguration) | +| [MaximumValidation1BoxedNumber](#maximumvalidation1boxednumber) | validateAndBox(Number, configuration: SchemaConfiguration) | +| [MaximumValidation1BoxedBoolean](#maximumvalidation1boxedboolean) | validateAndBox(boolean, configuration: SchemaConfiguration) | +| [MaximumValidation1BoxedMap](#maximumvalidation1boxedmap) | validateAndBox(Map<?, ?>, configuration: SchemaConfiguration) | +| [MaximumValidation1BoxedList](#maximumvalidation1boxedlist) | validateAndBox(List<*>, configuration: SchemaConfiguration) | +| [MaximumValidation1Boxed](#maximumvalidation1boxed) | validateAndBox(Any?, configuration: SchemaConfiguration) | +| Any? | validate(arg: Any?, configuration: SchemaConfiguration) | + +[[Back to top]](#top) [[Back to Component Schemas]](../../../README.md#Component-Schemas) [[Back to README]](../../../README.md) diff --git a/samples/client/3_1_0_unit_test/kotlin/docs/components/schemas/MaximumValidationWithUnsignedInteger.md b/samples/client/3_1_0_unit_test/kotlin/docs/components/schemas/MaximumValidationWithUnsignedInteger.md new file mode 100644 index 00000000000..c9730a8592b --- /dev/null +++ b/samples/client/3_1_0_unit_test/kotlin/docs/components/schemas/MaximumValidationWithUnsignedInteger.md @@ -0,0 +1,169 @@ +# MaximumValidationWithUnsignedInteger +org.openapijsonschematools.client.components.schemas.MaximumValidationWithUnsignedInteger.java +class MaximumValidationWithUnsignedInteger
    + +A class that contains necessary nested +- schema classes (which validate payloads), extends JsonSchema +- sealed interfaces which store validated payloads, Kotlin version of a sum type +- boxed classes which store validated payloads, sealed permits class implementations + +## Nested Class Summary +| Modifier and Type | Class and Description | +| ----------------- | ---------------------- | +| sealed interface | [MaximumValidationWithUnsignedInteger.MaximumValidationWithUnsignedInteger1Boxed](#maximumvalidationwithunsignedinteger1boxed)
    sealed interface for validated payloads | +| record | [MaximumValidationWithUnsignedInteger.MaximumValidationWithUnsignedInteger1BoxedVoid](#maximumvalidationwithunsignedinteger1boxedvoid)
    boxed class to store validated null payloads | +| record | [MaximumValidationWithUnsignedInteger.MaximumValidationWithUnsignedInteger1BoxedBoolean](#maximumvalidationwithunsignedinteger1boxedboolean)
    boxed class to store validated boolean payloads | +| record | [MaximumValidationWithUnsignedInteger.MaximumValidationWithUnsignedInteger1BoxedNumber](#maximumvalidationwithunsignedinteger1boxednumber)
    boxed class to store validated Number payloads | +| record | [MaximumValidationWithUnsignedInteger.MaximumValidationWithUnsignedInteger1BoxedString](#maximumvalidationwithunsignedinteger1boxedstring)
    boxed class to store validated String payloads | +| record | [MaximumValidationWithUnsignedInteger.MaximumValidationWithUnsignedInteger1BoxedList](#maximumvalidationwithunsignedinteger1boxedlist)
    boxed class to store validated List payloads | +| record | [MaximumValidationWithUnsignedInteger.MaximumValidationWithUnsignedInteger1BoxedMap](#maximumvalidationwithunsignedinteger1boxedmap)
    boxed class to store validated Map payloads | +| static class | [MaximumValidationWithUnsignedInteger.MaximumValidationWithUnsignedInteger1](#maximumvalidationwithunsignedinteger1)
    schema class | + +## MaximumValidationWithUnsignedInteger1Boxed +sealed interface MaximumValidationWithUnsignedInteger1Boxed
    +permits
    +[MaximumValidationWithUnsignedInteger1BoxedVoid](#maximumvalidationwithunsignedinteger1boxedvoid), +[MaximumValidationWithUnsignedInteger1BoxedBoolean](#maximumvalidationwithunsignedinteger1boxedboolean), +[MaximumValidationWithUnsignedInteger1BoxedNumber](#maximumvalidationwithunsignedinteger1boxednumber), +[MaximumValidationWithUnsignedInteger1BoxedString](#maximumvalidationwithunsignedinteger1boxedstring), +[MaximumValidationWithUnsignedInteger1BoxedList](#maximumvalidationwithunsignedinteger1boxedlist), +[MaximumValidationWithUnsignedInteger1BoxedMap](#maximumvalidationwithunsignedinteger1boxedmap) + +sealed interface that stores validated payloads using boxed classes + +## MaximumValidationWithUnsignedInteger1BoxedVoid +data class MaximumValidationWithUnsignedInteger1BoxedVoid
    +implements [MaximumValidationWithUnsignedInteger1Boxed](#maximumvalidationwithunsignedinteger1boxed) + +data class that stores validated null payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| MaximumValidationWithUnsignedInteger1BoxedVoid(Nothing? data)
    Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| Nothing? | data()
    validated payload | +| Any? | getData()
    validated payload | + +## MaximumValidationWithUnsignedInteger1BoxedBoolean +data class MaximumValidationWithUnsignedInteger1BoxedBoolean
    +implements [MaximumValidationWithUnsignedInteger1Boxed](#maximumvalidationwithunsignedinteger1boxed) + +record that stores validated boolean payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| MaximumValidationWithUnsignedInteger1BoxedBoolean(boolean data)
    Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| boolean | data()
    validated payload | +| Any? | getData()
    validated payload | + +## MaximumValidationWithUnsignedInteger1BoxedNumber +data class MaximumValidationWithUnsignedInteger1BoxedNumber
    +implements [MaximumValidationWithUnsignedInteger1Boxed](#maximumvalidationwithunsignedinteger1boxed) + +data class that stores validated Number payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| MaximumValidationWithUnsignedInteger1BoxedNumber(Number data)
    Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| Number | data()
    validated payload | +| Any? | getData()
    validated payload | + +## MaximumValidationWithUnsignedInteger1BoxedString +data class MaximumValidationWithUnsignedInteger1BoxedString
    +implements [MaximumValidationWithUnsignedInteger1Boxed](#maximumvalidationwithunsignedinteger1boxed) + +data class that stores validated String payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| MaximumValidationWithUnsignedInteger1BoxedString(String data)
    Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| String | data()
    validated payload | +| Any? | getData()
    validated payload | + +## MaximumValidationWithUnsignedInteger1BoxedList +data class MaximumValidationWithUnsignedInteger1BoxedList
    +implements [MaximumValidationWithUnsignedInteger1Boxed](#maximumvalidationwithunsignedinteger1boxed) + +data class that stores validated List payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| MaximumValidationWithUnsignedInteger1BoxedList(FrozenList data)
    Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| FrozenList | data()
    validated payload | +| Any? | getData()
    validated payload | + +## MaximumValidationWithUnsignedInteger1BoxedMap +data class MaximumValidationWithUnsignedInteger1BoxedMap
    +implements [MaximumValidationWithUnsignedInteger1Boxed](#maximumvalidationwithunsignedinteger1boxed) + +data class that stores validated Map payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| MaximumValidationWithUnsignedInteger1BoxedMap(FrozenMap data)
    Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| FrozenMap | data()
    validated payload | +| Any? | getData()
    validated payload | + +## MaximumValidationWithUnsignedInteger1 +class MaximumValidationWithUnsignedInteger1
    +extends JsonSchema + +A schema class that validates payloads + +### Field Summary +| Modifier and Type | Field and Description | +| ----------------- | ---------------------- | +| Number | maximum = 300 | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| String | validate(arg: String, configuration: SchemaConfiguration) | +| Nothing? | validate(arg: Nothing?, configuration: SchemaConfiguration) | +| int | validate(arg: int, configuration: SchemaConfiguration) | +| long | validate(arg: long, configuration: SchemaConfiguration) | +| float | validate(arg: float, configuration: SchemaConfiguration) | +| double | validate(arg: double, configuration: SchemaConfiguration) | +| Number | validate(arg: Number, configuration: SchemaConfiguration) | +| boolean | validate(arg: boolean, configuration: SchemaConfiguration) | +| FrozenMap | validate(arg: Map<?, ?>, configuration: SchemaConfiguration) | +| FrozenList | validate(arg: List<*>, configuration: SchemaConfiguration) | +| [MaximumValidationWithUnsignedInteger1BoxedString](#maximumvalidationwithunsignedinteger1boxedstring) | validateAndBox(String, configuration: SchemaConfiguration) | +| [MaximumValidationWithUnsignedInteger1BoxedVoid](#maximumvalidationwithunsignedinteger1boxedvoid) | validateAndBox(Nothing?, configuration: SchemaConfiguration) | +| [MaximumValidationWithUnsignedInteger1BoxedNumber](#maximumvalidationwithunsignedinteger1boxednumber) | validateAndBox(Number, configuration: SchemaConfiguration) | +| [MaximumValidationWithUnsignedInteger1BoxedBoolean](#maximumvalidationwithunsignedinteger1boxedboolean) | validateAndBox(boolean, configuration: SchemaConfiguration) | +| [MaximumValidationWithUnsignedInteger1BoxedMap](#maximumvalidationwithunsignedinteger1boxedmap) | validateAndBox(Map<?, ?>, configuration: SchemaConfiguration) | +| [MaximumValidationWithUnsignedInteger1BoxedList](#maximumvalidationwithunsignedinteger1boxedlist) | validateAndBox(List<*>, configuration: SchemaConfiguration) | +| [MaximumValidationWithUnsignedInteger1Boxed](#maximumvalidationwithunsignedinteger1boxed) | validateAndBox(Any?, configuration: SchemaConfiguration) | +| Any? | validate(arg: Any?, configuration: SchemaConfiguration) | + +[[Back to top]](#top) [[Back to Component Schemas]](../../../README.md#Component-Schemas) [[Back to README]](../../../README.md) diff --git a/samples/client/3_1_0_unit_test/kotlin/docs/components/schemas/MaxitemsValidation.md b/samples/client/3_1_0_unit_test/kotlin/docs/components/schemas/MaxitemsValidation.md new file mode 100644 index 00000000000..3ea5955c1d2 --- /dev/null +++ b/samples/client/3_1_0_unit_test/kotlin/docs/components/schemas/MaxitemsValidation.md @@ -0,0 +1,169 @@ +# MaxitemsValidation +org.openapijsonschematools.client.components.schemas.MaxitemsValidation.java +class MaxitemsValidation
    + +A class that contains necessary nested +- schema classes (which validate payloads), extends JsonSchema +- sealed interfaces which store validated payloads, Kotlin version of a sum type +- boxed classes which store validated payloads, sealed permits class implementations + +## Nested Class Summary +| Modifier and Type | Class and Description | +| ----------------- | ---------------------- | +| sealed interface | [MaxitemsValidation.MaxitemsValidation1Boxed](#maxitemsvalidation1boxed)
    sealed interface for validated payloads | +| record | [MaxitemsValidation.MaxitemsValidation1BoxedVoid](#maxitemsvalidation1boxedvoid)
    boxed class to store validated null payloads | +| record | [MaxitemsValidation.MaxitemsValidation1BoxedBoolean](#maxitemsvalidation1boxedboolean)
    boxed class to store validated boolean payloads | +| record | [MaxitemsValidation.MaxitemsValidation1BoxedNumber](#maxitemsvalidation1boxednumber)
    boxed class to store validated Number payloads | +| record | [MaxitemsValidation.MaxitemsValidation1BoxedString](#maxitemsvalidation1boxedstring)
    boxed class to store validated String payloads | +| record | [MaxitemsValidation.MaxitemsValidation1BoxedList](#maxitemsvalidation1boxedlist)
    boxed class to store validated List payloads | +| record | [MaxitemsValidation.MaxitemsValidation1BoxedMap](#maxitemsvalidation1boxedmap)
    boxed class to store validated Map payloads | +| static class | [MaxitemsValidation.MaxitemsValidation1](#maxitemsvalidation1)
    schema class | + +## MaxitemsValidation1Boxed +sealed interface MaxitemsValidation1Boxed
    +permits
    +[MaxitemsValidation1BoxedVoid](#maxitemsvalidation1boxedvoid), +[MaxitemsValidation1BoxedBoolean](#maxitemsvalidation1boxedboolean), +[MaxitemsValidation1BoxedNumber](#maxitemsvalidation1boxednumber), +[MaxitemsValidation1BoxedString](#maxitemsvalidation1boxedstring), +[MaxitemsValidation1BoxedList](#maxitemsvalidation1boxedlist), +[MaxitemsValidation1BoxedMap](#maxitemsvalidation1boxedmap) + +sealed interface that stores validated payloads using boxed classes + +## MaxitemsValidation1BoxedVoid +data class MaxitemsValidation1BoxedVoid
    +implements [MaxitemsValidation1Boxed](#maxitemsvalidation1boxed) + +data class that stores validated null payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| MaxitemsValidation1BoxedVoid(Nothing? data)
    Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| Nothing? | data()
    validated payload | +| Any? | getData()
    validated payload | + +## MaxitemsValidation1BoxedBoolean +data class MaxitemsValidation1BoxedBoolean
    +implements [MaxitemsValidation1Boxed](#maxitemsvalidation1boxed) + +record that stores validated boolean payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| MaxitemsValidation1BoxedBoolean(boolean data)
    Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| boolean | data()
    validated payload | +| Any? | getData()
    validated payload | + +## MaxitemsValidation1BoxedNumber +data class MaxitemsValidation1BoxedNumber
    +implements [MaxitemsValidation1Boxed](#maxitemsvalidation1boxed) + +data class that stores validated Number payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| MaxitemsValidation1BoxedNumber(Number data)
    Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| Number | data()
    validated payload | +| Any? | getData()
    validated payload | + +## MaxitemsValidation1BoxedString +data class MaxitemsValidation1BoxedString
    +implements [MaxitemsValidation1Boxed](#maxitemsvalidation1boxed) + +data class that stores validated String payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| MaxitemsValidation1BoxedString(String data)
    Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| String | data()
    validated payload | +| Any? | getData()
    validated payload | + +## MaxitemsValidation1BoxedList +data class MaxitemsValidation1BoxedList
    +implements [MaxitemsValidation1Boxed](#maxitemsvalidation1boxed) + +data class that stores validated List payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| MaxitemsValidation1BoxedList(FrozenList data)
    Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| FrozenList | data()
    validated payload | +| Any? | getData()
    validated payload | + +## MaxitemsValidation1BoxedMap +data class MaxitemsValidation1BoxedMap
    +implements [MaxitemsValidation1Boxed](#maxitemsvalidation1boxed) + +data class that stores validated Map payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| MaxitemsValidation1BoxedMap(FrozenMap data)
    Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| FrozenMap | data()
    validated payload | +| Any? | getData()
    validated payload | + +## MaxitemsValidation1 +class MaxitemsValidation1
    +extends JsonSchema + +A schema class that validates payloads + +### Field Summary +| Modifier and Type | Field and Description | +| ----------------- | ---------------------- | +| Integer | maxItems = 2 | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| String | validate(arg: String, configuration: SchemaConfiguration) | +| Nothing? | validate(arg: Nothing?, configuration: SchemaConfiguration) | +| int | validate(arg: int, configuration: SchemaConfiguration) | +| long | validate(arg: long, configuration: SchemaConfiguration) | +| float | validate(arg: float, configuration: SchemaConfiguration) | +| double | validate(arg: double, configuration: SchemaConfiguration) | +| Number | validate(arg: Number, configuration: SchemaConfiguration) | +| boolean | validate(arg: boolean, configuration: SchemaConfiguration) | +| FrozenMap | validate(arg: Map<?, ?>, configuration: SchemaConfiguration) | +| FrozenList | validate(arg: List<*>, configuration: SchemaConfiguration) | +| [MaxitemsValidation1BoxedString](#maxitemsvalidation1boxedstring) | validateAndBox(String, configuration: SchemaConfiguration) | +| [MaxitemsValidation1BoxedVoid](#maxitemsvalidation1boxedvoid) | validateAndBox(Nothing?, configuration: SchemaConfiguration) | +| [MaxitemsValidation1BoxedNumber](#maxitemsvalidation1boxednumber) | validateAndBox(Number, configuration: SchemaConfiguration) | +| [MaxitemsValidation1BoxedBoolean](#maxitemsvalidation1boxedboolean) | validateAndBox(boolean, configuration: SchemaConfiguration) | +| [MaxitemsValidation1BoxedMap](#maxitemsvalidation1boxedmap) | validateAndBox(Map<?, ?>, configuration: SchemaConfiguration) | +| [MaxitemsValidation1BoxedList](#maxitemsvalidation1boxedlist) | validateAndBox(List<*>, configuration: SchemaConfiguration) | +| [MaxitemsValidation1Boxed](#maxitemsvalidation1boxed) | validateAndBox(Any?, configuration: SchemaConfiguration) | +| Any? | validate(arg: Any?, configuration: SchemaConfiguration) | + +[[Back to top]](#top) [[Back to Component Schemas]](../../../README.md#Component-Schemas) [[Back to README]](../../../README.md) diff --git a/samples/client/3_1_0_unit_test/kotlin/docs/components/schemas/MaxlengthValidation.md b/samples/client/3_1_0_unit_test/kotlin/docs/components/schemas/MaxlengthValidation.md new file mode 100644 index 00000000000..bce5aed91d9 --- /dev/null +++ b/samples/client/3_1_0_unit_test/kotlin/docs/components/schemas/MaxlengthValidation.md @@ -0,0 +1,169 @@ +# MaxlengthValidation +org.openapijsonschematools.client.components.schemas.MaxlengthValidation.java +class MaxlengthValidation
    + +A class that contains necessary nested +- schema classes (which validate payloads), extends JsonSchema +- sealed interfaces which store validated payloads, Kotlin version of a sum type +- boxed classes which store validated payloads, sealed permits class implementations + +## Nested Class Summary +| Modifier and Type | Class and Description | +| ----------------- | ---------------------- | +| sealed interface | [MaxlengthValidation.MaxlengthValidation1Boxed](#maxlengthvalidation1boxed)
    sealed interface for validated payloads | +| record | [MaxlengthValidation.MaxlengthValidation1BoxedVoid](#maxlengthvalidation1boxedvoid)
    boxed class to store validated null payloads | +| record | [MaxlengthValidation.MaxlengthValidation1BoxedBoolean](#maxlengthvalidation1boxedboolean)
    boxed class to store validated boolean payloads | +| record | [MaxlengthValidation.MaxlengthValidation1BoxedNumber](#maxlengthvalidation1boxednumber)
    boxed class to store validated Number payloads | +| record | [MaxlengthValidation.MaxlengthValidation1BoxedString](#maxlengthvalidation1boxedstring)
    boxed class to store validated String payloads | +| record | [MaxlengthValidation.MaxlengthValidation1BoxedList](#maxlengthvalidation1boxedlist)
    boxed class to store validated List payloads | +| record | [MaxlengthValidation.MaxlengthValidation1BoxedMap](#maxlengthvalidation1boxedmap)
    boxed class to store validated Map payloads | +| static class | [MaxlengthValidation.MaxlengthValidation1](#maxlengthvalidation1)
    schema class | + +## MaxlengthValidation1Boxed +sealed interface MaxlengthValidation1Boxed
    +permits
    +[MaxlengthValidation1BoxedVoid](#maxlengthvalidation1boxedvoid), +[MaxlengthValidation1BoxedBoolean](#maxlengthvalidation1boxedboolean), +[MaxlengthValidation1BoxedNumber](#maxlengthvalidation1boxednumber), +[MaxlengthValidation1BoxedString](#maxlengthvalidation1boxedstring), +[MaxlengthValidation1BoxedList](#maxlengthvalidation1boxedlist), +[MaxlengthValidation1BoxedMap](#maxlengthvalidation1boxedmap) + +sealed interface that stores validated payloads using boxed classes + +## MaxlengthValidation1BoxedVoid +data class MaxlengthValidation1BoxedVoid
    +implements [MaxlengthValidation1Boxed](#maxlengthvalidation1boxed) + +data class that stores validated null payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| MaxlengthValidation1BoxedVoid(Nothing? data)
    Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| Nothing? | data()
    validated payload | +| Any? | getData()
    validated payload | + +## MaxlengthValidation1BoxedBoolean +data class MaxlengthValidation1BoxedBoolean
    +implements [MaxlengthValidation1Boxed](#maxlengthvalidation1boxed) + +record that stores validated boolean payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| MaxlengthValidation1BoxedBoolean(boolean data)
    Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| boolean | data()
    validated payload | +| Any? | getData()
    validated payload | + +## MaxlengthValidation1BoxedNumber +data class MaxlengthValidation1BoxedNumber
    +implements [MaxlengthValidation1Boxed](#maxlengthvalidation1boxed) + +data class that stores validated Number payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| MaxlengthValidation1BoxedNumber(Number data)
    Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| Number | data()
    validated payload | +| Any? | getData()
    validated payload | + +## MaxlengthValidation1BoxedString +data class MaxlengthValidation1BoxedString
    +implements [MaxlengthValidation1Boxed](#maxlengthvalidation1boxed) + +data class that stores validated String payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| MaxlengthValidation1BoxedString(String data)
    Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| String | data()
    validated payload | +| Any? | getData()
    validated payload | + +## MaxlengthValidation1BoxedList +data class MaxlengthValidation1BoxedList
    +implements [MaxlengthValidation1Boxed](#maxlengthvalidation1boxed) + +data class that stores validated List payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| MaxlengthValidation1BoxedList(FrozenList data)
    Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| FrozenList | data()
    validated payload | +| Any? | getData()
    validated payload | + +## MaxlengthValidation1BoxedMap +data class MaxlengthValidation1BoxedMap
    +implements [MaxlengthValidation1Boxed](#maxlengthvalidation1boxed) + +data class that stores validated Map payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| MaxlengthValidation1BoxedMap(FrozenMap data)
    Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| FrozenMap | data()
    validated payload | +| Any? | getData()
    validated payload | + +## MaxlengthValidation1 +class MaxlengthValidation1
    +extends JsonSchema + +A schema class that validates payloads + +### Field Summary +| Modifier and Type | Field and Description | +| ----------------- | ---------------------- | +| Integer | maxLength = 2 | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| String | validate(arg: String, configuration: SchemaConfiguration) | +| Nothing? | validate(arg: Nothing?, configuration: SchemaConfiguration) | +| int | validate(arg: int, configuration: SchemaConfiguration) | +| long | validate(arg: long, configuration: SchemaConfiguration) | +| float | validate(arg: float, configuration: SchemaConfiguration) | +| double | validate(arg: double, configuration: SchemaConfiguration) | +| Number | validate(arg: Number, configuration: SchemaConfiguration) | +| boolean | validate(arg: boolean, configuration: SchemaConfiguration) | +| FrozenMap | validate(arg: Map<?, ?>, configuration: SchemaConfiguration) | +| FrozenList | validate(arg: List<*>, configuration: SchemaConfiguration) | +| [MaxlengthValidation1BoxedString](#maxlengthvalidation1boxedstring) | validateAndBox(String, configuration: SchemaConfiguration) | +| [MaxlengthValidation1BoxedVoid](#maxlengthvalidation1boxedvoid) | validateAndBox(Nothing?, configuration: SchemaConfiguration) | +| [MaxlengthValidation1BoxedNumber](#maxlengthvalidation1boxednumber) | validateAndBox(Number, configuration: SchemaConfiguration) | +| [MaxlengthValidation1BoxedBoolean](#maxlengthvalidation1boxedboolean) | validateAndBox(boolean, configuration: SchemaConfiguration) | +| [MaxlengthValidation1BoxedMap](#maxlengthvalidation1boxedmap) | validateAndBox(Map<?, ?>, configuration: SchemaConfiguration) | +| [MaxlengthValidation1BoxedList](#maxlengthvalidation1boxedlist) | validateAndBox(List<*>, configuration: SchemaConfiguration) | +| [MaxlengthValidation1Boxed](#maxlengthvalidation1boxed) | validateAndBox(Any?, configuration: SchemaConfiguration) | +| Any? | validate(arg: Any?, configuration: SchemaConfiguration) | + +[[Back to top]](#top) [[Back to Component Schemas]](../../../README.md#Component-Schemas) [[Back to README]](../../../README.md) diff --git a/samples/client/3_1_0_unit_test/kotlin/docs/components/schemas/Maxproperties0MeansTheObjectIsEmpty.md b/samples/client/3_1_0_unit_test/kotlin/docs/components/schemas/Maxproperties0MeansTheObjectIsEmpty.md new file mode 100644 index 00000000000..06a37326fda --- /dev/null +++ b/samples/client/3_1_0_unit_test/kotlin/docs/components/schemas/Maxproperties0MeansTheObjectIsEmpty.md @@ -0,0 +1,169 @@ +# Maxproperties0MeansTheObjectIsEmpty +org.openapijsonschematools.client.components.schemas.Maxproperties0MeansTheObjectIsEmpty.java +class Maxproperties0MeansTheObjectIsEmpty
    + +A class that contains necessary nested +- schema classes (which validate payloads), extends JsonSchema +- sealed interfaces which store validated payloads, Kotlin version of a sum type +- boxed classes which store validated payloads, sealed permits class implementations + +## Nested Class Summary +| Modifier and Type | Class and Description | +| ----------------- | ---------------------- | +| sealed interface | [Maxproperties0MeansTheObjectIsEmpty.Maxproperties0MeansTheObjectIsEmpty1Boxed](#maxproperties0meanstheobjectisempty1boxed)
    sealed interface for validated payloads | +| record | [Maxproperties0MeansTheObjectIsEmpty.Maxproperties0MeansTheObjectIsEmpty1BoxedVoid](#maxproperties0meanstheobjectisempty1boxedvoid)
    boxed class to store validated null payloads | +| record | [Maxproperties0MeansTheObjectIsEmpty.Maxproperties0MeansTheObjectIsEmpty1BoxedBoolean](#maxproperties0meanstheobjectisempty1boxedboolean)
    boxed class to store validated boolean payloads | +| record | [Maxproperties0MeansTheObjectIsEmpty.Maxproperties0MeansTheObjectIsEmpty1BoxedNumber](#maxproperties0meanstheobjectisempty1boxednumber)
    boxed class to store validated Number payloads | +| record | [Maxproperties0MeansTheObjectIsEmpty.Maxproperties0MeansTheObjectIsEmpty1BoxedString](#maxproperties0meanstheobjectisempty1boxedstring)
    boxed class to store validated String payloads | +| record | [Maxproperties0MeansTheObjectIsEmpty.Maxproperties0MeansTheObjectIsEmpty1BoxedList](#maxproperties0meanstheobjectisempty1boxedlist)
    boxed class to store validated List payloads | +| record | [Maxproperties0MeansTheObjectIsEmpty.Maxproperties0MeansTheObjectIsEmpty1BoxedMap](#maxproperties0meanstheobjectisempty1boxedmap)
    boxed class to store validated Map payloads | +| static class | [Maxproperties0MeansTheObjectIsEmpty.Maxproperties0MeansTheObjectIsEmpty1](#maxproperties0meanstheobjectisempty1)
    schema class | + +## Maxproperties0MeansTheObjectIsEmpty1Boxed +sealed interface Maxproperties0MeansTheObjectIsEmpty1Boxed
    +permits
    +[Maxproperties0MeansTheObjectIsEmpty1BoxedVoid](#maxproperties0meanstheobjectisempty1boxedvoid), +[Maxproperties0MeansTheObjectIsEmpty1BoxedBoolean](#maxproperties0meanstheobjectisempty1boxedboolean), +[Maxproperties0MeansTheObjectIsEmpty1BoxedNumber](#maxproperties0meanstheobjectisempty1boxednumber), +[Maxproperties0MeansTheObjectIsEmpty1BoxedString](#maxproperties0meanstheobjectisempty1boxedstring), +[Maxproperties0MeansTheObjectIsEmpty1BoxedList](#maxproperties0meanstheobjectisempty1boxedlist), +[Maxproperties0MeansTheObjectIsEmpty1BoxedMap](#maxproperties0meanstheobjectisempty1boxedmap) + +sealed interface that stores validated payloads using boxed classes + +## Maxproperties0MeansTheObjectIsEmpty1BoxedVoid +data class Maxproperties0MeansTheObjectIsEmpty1BoxedVoid
    +implements [Maxproperties0MeansTheObjectIsEmpty1Boxed](#maxproperties0meanstheobjectisempty1boxed) + +data class that stores validated null payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| Maxproperties0MeansTheObjectIsEmpty1BoxedVoid(Nothing? data)
    Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| Nothing? | data()
    validated payload | +| Any? | getData()
    validated payload | + +## Maxproperties0MeansTheObjectIsEmpty1BoxedBoolean +data class Maxproperties0MeansTheObjectIsEmpty1BoxedBoolean
    +implements [Maxproperties0MeansTheObjectIsEmpty1Boxed](#maxproperties0meanstheobjectisempty1boxed) + +record that stores validated boolean payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| Maxproperties0MeansTheObjectIsEmpty1BoxedBoolean(boolean data)
    Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| boolean | data()
    validated payload | +| Any? | getData()
    validated payload | + +## Maxproperties0MeansTheObjectIsEmpty1BoxedNumber +data class Maxproperties0MeansTheObjectIsEmpty1BoxedNumber
    +implements [Maxproperties0MeansTheObjectIsEmpty1Boxed](#maxproperties0meanstheobjectisempty1boxed) + +data class that stores validated Number payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| Maxproperties0MeansTheObjectIsEmpty1BoxedNumber(Number data)
    Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| Number | data()
    validated payload | +| Any? | getData()
    validated payload | + +## Maxproperties0MeansTheObjectIsEmpty1BoxedString +data class Maxproperties0MeansTheObjectIsEmpty1BoxedString
    +implements [Maxproperties0MeansTheObjectIsEmpty1Boxed](#maxproperties0meanstheobjectisempty1boxed) + +data class that stores validated String payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| Maxproperties0MeansTheObjectIsEmpty1BoxedString(String data)
    Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| String | data()
    validated payload | +| Any? | getData()
    validated payload | + +## Maxproperties0MeansTheObjectIsEmpty1BoxedList +data class Maxproperties0MeansTheObjectIsEmpty1BoxedList
    +implements [Maxproperties0MeansTheObjectIsEmpty1Boxed](#maxproperties0meanstheobjectisempty1boxed) + +data class that stores validated List payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| Maxproperties0MeansTheObjectIsEmpty1BoxedList(FrozenList data)
    Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| FrozenList | data()
    validated payload | +| Any? | getData()
    validated payload | + +## Maxproperties0MeansTheObjectIsEmpty1BoxedMap +data class Maxproperties0MeansTheObjectIsEmpty1BoxedMap
    +implements [Maxproperties0MeansTheObjectIsEmpty1Boxed](#maxproperties0meanstheobjectisempty1boxed) + +data class that stores validated Map payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| Maxproperties0MeansTheObjectIsEmpty1BoxedMap(FrozenMap data)
    Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| FrozenMap | data()
    validated payload | +| Any? | getData()
    validated payload | + +## Maxproperties0MeansTheObjectIsEmpty1 +class Maxproperties0MeansTheObjectIsEmpty1
    +extends JsonSchema + +A schema class that validates payloads + +### Field Summary +| Modifier and Type | Field and Description | +| ----------------- | ---------------------- | +| Integer | maxProperties = 0 | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| String | validate(arg: String, configuration: SchemaConfiguration) | +| Nothing? | validate(arg: Nothing?, configuration: SchemaConfiguration) | +| int | validate(arg: int, configuration: SchemaConfiguration) | +| long | validate(arg: long, configuration: SchemaConfiguration) | +| float | validate(arg: float, configuration: SchemaConfiguration) | +| double | validate(arg: double, configuration: SchemaConfiguration) | +| Number | validate(arg: Number, configuration: SchemaConfiguration) | +| boolean | validate(arg: boolean, configuration: SchemaConfiguration) | +| FrozenMap | validate(arg: Map<?, ?>, configuration: SchemaConfiguration) | +| FrozenList | validate(arg: List<*>, configuration: SchemaConfiguration) | +| [Maxproperties0MeansTheObjectIsEmpty1BoxedString](#maxproperties0meanstheobjectisempty1boxedstring) | validateAndBox(String, configuration: SchemaConfiguration) | +| [Maxproperties0MeansTheObjectIsEmpty1BoxedVoid](#maxproperties0meanstheobjectisempty1boxedvoid) | validateAndBox(Nothing?, configuration: SchemaConfiguration) | +| [Maxproperties0MeansTheObjectIsEmpty1BoxedNumber](#maxproperties0meanstheobjectisempty1boxednumber) | validateAndBox(Number, configuration: SchemaConfiguration) | +| [Maxproperties0MeansTheObjectIsEmpty1BoxedBoolean](#maxproperties0meanstheobjectisempty1boxedboolean) | validateAndBox(boolean, configuration: SchemaConfiguration) | +| [Maxproperties0MeansTheObjectIsEmpty1BoxedMap](#maxproperties0meanstheobjectisempty1boxedmap) | validateAndBox(Map<?, ?>, configuration: SchemaConfiguration) | +| [Maxproperties0MeansTheObjectIsEmpty1BoxedList](#maxproperties0meanstheobjectisempty1boxedlist) | validateAndBox(List<*>, configuration: SchemaConfiguration) | +| [Maxproperties0MeansTheObjectIsEmpty1Boxed](#maxproperties0meanstheobjectisempty1boxed) | validateAndBox(Any?, configuration: SchemaConfiguration) | +| Any? | validate(arg: Any?, configuration: SchemaConfiguration) | + +[[Back to top]](#top) [[Back to Component Schemas]](../../../README.md#Component-Schemas) [[Back to README]](../../../README.md) diff --git a/samples/client/3_1_0_unit_test/kotlin/docs/components/schemas/MaxpropertiesValidation.md b/samples/client/3_1_0_unit_test/kotlin/docs/components/schemas/MaxpropertiesValidation.md new file mode 100644 index 00000000000..8b04a4d21ac --- /dev/null +++ b/samples/client/3_1_0_unit_test/kotlin/docs/components/schemas/MaxpropertiesValidation.md @@ -0,0 +1,169 @@ +# MaxpropertiesValidation +org.openapijsonschematools.client.components.schemas.MaxpropertiesValidation.java +class MaxpropertiesValidation
    + +A class that contains necessary nested +- schema classes (which validate payloads), extends JsonSchema +- sealed interfaces which store validated payloads, Kotlin version of a sum type +- boxed classes which store validated payloads, sealed permits class implementations + +## Nested Class Summary +| Modifier and Type | Class and Description | +| ----------------- | ---------------------- | +| sealed interface | [MaxpropertiesValidation.MaxpropertiesValidation1Boxed](#maxpropertiesvalidation1boxed)
    sealed interface for validated payloads | +| record | [MaxpropertiesValidation.MaxpropertiesValidation1BoxedVoid](#maxpropertiesvalidation1boxedvoid)
    boxed class to store validated null payloads | +| record | [MaxpropertiesValidation.MaxpropertiesValidation1BoxedBoolean](#maxpropertiesvalidation1boxedboolean)
    boxed class to store validated boolean payloads | +| record | [MaxpropertiesValidation.MaxpropertiesValidation1BoxedNumber](#maxpropertiesvalidation1boxednumber)
    boxed class to store validated Number payloads | +| record | [MaxpropertiesValidation.MaxpropertiesValidation1BoxedString](#maxpropertiesvalidation1boxedstring)
    boxed class to store validated String payloads | +| record | [MaxpropertiesValidation.MaxpropertiesValidation1BoxedList](#maxpropertiesvalidation1boxedlist)
    boxed class to store validated List payloads | +| record | [MaxpropertiesValidation.MaxpropertiesValidation1BoxedMap](#maxpropertiesvalidation1boxedmap)
    boxed class to store validated Map payloads | +| static class | [MaxpropertiesValidation.MaxpropertiesValidation1](#maxpropertiesvalidation1)
    schema class | + +## MaxpropertiesValidation1Boxed +sealed interface MaxpropertiesValidation1Boxed
    +permits
    +[MaxpropertiesValidation1BoxedVoid](#maxpropertiesvalidation1boxedvoid), +[MaxpropertiesValidation1BoxedBoolean](#maxpropertiesvalidation1boxedboolean), +[MaxpropertiesValidation1BoxedNumber](#maxpropertiesvalidation1boxednumber), +[MaxpropertiesValidation1BoxedString](#maxpropertiesvalidation1boxedstring), +[MaxpropertiesValidation1BoxedList](#maxpropertiesvalidation1boxedlist), +[MaxpropertiesValidation1BoxedMap](#maxpropertiesvalidation1boxedmap) + +sealed interface that stores validated payloads using boxed classes + +## MaxpropertiesValidation1BoxedVoid +data class MaxpropertiesValidation1BoxedVoid
    +implements [MaxpropertiesValidation1Boxed](#maxpropertiesvalidation1boxed) + +data class that stores validated null payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| MaxpropertiesValidation1BoxedVoid(Nothing? data)
    Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| Nothing? | data()
    validated payload | +| Any? | getData()
    validated payload | + +## MaxpropertiesValidation1BoxedBoolean +data class MaxpropertiesValidation1BoxedBoolean
    +implements [MaxpropertiesValidation1Boxed](#maxpropertiesvalidation1boxed) + +record that stores validated boolean payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| MaxpropertiesValidation1BoxedBoolean(boolean data)
    Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| boolean | data()
    validated payload | +| Any? | getData()
    validated payload | + +## MaxpropertiesValidation1BoxedNumber +data class MaxpropertiesValidation1BoxedNumber
    +implements [MaxpropertiesValidation1Boxed](#maxpropertiesvalidation1boxed) + +data class that stores validated Number payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| MaxpropertiesValidation1BoxedNumber(Number data)
    Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| Number | data()
    validated payload | +| Any? | getData()
    validated payload | + +## MaxpropertiesValidation1BoxedString +data class MaxpropertiesValidation1BoxedString
    +implements [MaxpropertiesValidation1Boxed](#maxpropertiesvalidation1boxed) + +data class that stores validated String payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| MaxpropertiesValidation1BoxedString(String data)
    Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| String | data()
    validated payload | +| Any? | getData()
    validated payload | + +## MaxpropertiesValidation1BoxedList +data class MaxpropertiesValidation1BoxedList
    +implements [MaxpropertiesValidation1Boxed](#maxpropertiesvalidation1boxed) + +data class that stores validated List payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| MaxpropertiesValidation1BoxedList(FrozenList data)
    Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| FrozenList | data()
    validated payload | +| Any? | getData()
    validated payload | + +## MaxpropertiesValidation1BoxedMap +data class MaxpropertiesValidation1BoxedMap
    +implements [MaxpropertiesValidation1Boxed](#maxpropertiesvalidation1boxed) + +data class that stores validated Map payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| MaxpropertiesValidation1BoxedMap(FrozenMap data)
    Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| FrozenMap | data()
    validated payload | +| Any? | getData()
    validated payload | + +## MaxpropertiesValidation1 +class MaxpropertiesValidation1
    +extends JsonSchema + +A schema class that validates payloads + +### Field Summary +| Modifier and Type | Field and Description | +| ----------------- | ---------------------- | +| Integer | maxProperties = 2 | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| String | validate(arg: String, configuration: SchemaConfiguration) | +| Nothing? | validate(arg: Nothing?, configuration: SchemaConfiguration) | +| int | validate(arg: int, configuration: SchemaConfiguration) | +| long | validate(arg: long, configuration: SchemaConfiguration) | +| float | validate(arg: float, configuration: SchemaConfiguration) | +| double | validate(arg: double, configuration: SchemaConfiguration) | +| Number | validate(arg: Number, configuration: SchemaConfiguration) | +| boolean | validate(arg: boolean, configuration: SchemaConfiguration) | +| FrozenMap | validate(arg: Map<?, ?>, configuration: SchemaConfiguration) | +| FrozenList | validate(arg: List<*>, configuration: SchemaConfiguration) | +| [MaxpropertiesValidation1BoxedString](#maxpropertiesvalidation1boxedstring) | validateAndBox(String, configuration: SchemaConfiguration) | +| [MaxpropertiesValidation1BoxedVoid](#maxpropertiesvalidation1boxedvoid) | validateAndBox(Nothing?, configuration: SchemaConfiguration) | +| [MaxpropertiesValidation1BoxedNumber](#maxpropertiesvalidation1boxednumber) | validateAndBox(Number, configuration: SchemaConfiguration) | +| [MaxpropertiesValidation1BoxedBoolean](#maxpropertiesvalidation1boxedboolean) | validateAndBox(boolean, configuration: SchemaConfiguration) | +| [MaxpropertiesValidation1BoxedMap](#maxpropertiesvalidation1boxedmap) | validateAndBox(Map<?, ?>, configuration: SchemaConfiguration) | +| [MaxpropertiesValidation1BoxedList](#maxpropertiesvalidation1boxedlist) | validateAndBox(List<*>, configuration: SchemaConfiguration) | +| [MaxpropertiesValidation1Boxed](#maxpropertiesvalidation1boxed) | validateAndBox(Any?, configuration: SchemaConfiguration) | +| Any? | validate(arg: Any?, configuration: SchemaConfiguration) | + +[[Back to top]](#top) [[Back to Component Schemas]](../../../README.md#Component-Schemas) [[Back to README]](../../../README.md) diff --git a/samples/client/3_1_0_unit_test/kotlin/docs/components/schemas/MincontainsWithoutContainsIsIgnored.md b/samples/client/3_1_0_unit_test/kotlin/docs/components/schemas/MincontainsWithoutContainsIsIgnored.md new file mode 100644 index 00000000000..e7e2a699ba7 --- /dev/null +++ b/samples/client/3_1_0_unit_test/kotlin/docs/components/schemas/MincontainsWithoutContainsIsIgnored.md @@ -0,0 +1,169 @@ +# MincontainsWithoutContainsIsIgnored +org.openapijsonschematools.client.components.schemas.MincontainsWithoutContainsIsIgnored.java +class MincontainsWithoutContainsIsIgnored
    + +A class that contains necessary nested +- schema classes (which validate payloads), extends JsonSchema +- sealed interfaces which store validated payloads, Kotlin version of a sum type +- boxed classes which store validated payloads, sealed permits class implementations + +## Nested Class Summary +| Modifier and Type | Class and Description | +| ----------------- | ---------------------- | +| sealed interface | [MincontainsWithoutContainsIsIgnored.MincontainsWithoutContainsIsIgnored1Boxed](#mincontainswithoutcontainsisignored1boxed)
    sealed interface for validated payloads | +| record | [MincontainsWithoutContainsIsIgnored.MincontainsWithoutContainsIsIgnored1BoxedVoid](#mincontainswithoutcontainsisignored1boxedvoid)
    boxed class to store validated null payloads | +| record | [MincontainsWithoutContainsIsIgnored.MincontainsWithoutContainsIsIgnored1BoxedBoolean](#mincontainswithoutcontainsisignored1boxedboolean)
    boxed class to store validated boolean payloads | +| record | [MincontainsWithoutContainsIsIgnored.MincontainsWithoutContainsIsIgnored1BoxedNumber](#mincontainswithoutcontainsisignored1boxednumber)
    boxed class to store validated Number payloads | +| record | [MincontainsWithoutContainsIsIgnored.MincontainsWithoutContainsIsIgnored1BoxedString](#mincontainswithoutcontainsisignored1boxedstring)
    boxed class to store validated String payloads | +| record | [MincontainsWithoutContainsIsIgnored.MincontainsWithoutContainsIsIgnored1BoxedList](#mincontainswithoutcontainsisignored1boxedlist)
    boxed class to store validated List payloads | +| record | [MincontainsWithoutContainsIsIgnored.MincontainsWithoutContainsIsIgnored1BoxedMap](#mincontainswithoutcontainsisignored1boxedmap)
    boxed class to store validated Map payloads | +| static class | [MincontainsWithoutContainsIsIgnored.MincontainsWithoutContainsIsIgnored1](#mincontainswithoutcontainsisignored1)
    schema class | + +## MincontainsWithoutContainsIsIgnored1Boxed +sealed interface MincontainsWithoutContainsIsIgnored1Boxed
    +permits
    +[MincontainsWithoutContainsIsIgnored1BoxedVoid](#mincontainswithoutcontainsisignored1boxedvoid), +[MincontainsWithoutContainsIsIgnored1BoxedBoolean](#mincontainswithoutcontainsisignored1boxedboolean), +[MincontainsWithoutContainsIsIgnored1BoxedNumber](#mincontainswithoutcontainsisignored1boxednumber), +[MincontainsWithoutContainsIsIgnored1BoxedString](#mincontainswithoutcontainsisignored1boxedstring), +[MincontainsWithoutContainsIsIgnored1BoxedList](#mincontainswithoutcontainsisignored1boxedlist), +[MincontainsWithoutContainsIsIgnored1BoxedMap](#mincontainswithoutcontainsisignored1boxedmap) + +sealed interface that stores validated payloads using boxed classes + +## MincontainsWithoutContainsIsIgnored1BoxedVoid +data class MincontainsWithoutContainsIsIgnored1BoxedVoid
    +implements [MincontainsWithoutContainsIsIgnored1Boxed](#mincontainswithoutcontainsisignored1boxed) + +data class that stores validated null payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| MincontainsWithoutContainsIsIgnored1BoxedVoid(Nothing? data)
    Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| Nothing? | data()
    validated payload | +| Any? | getData()
    validated payload | + +## MincontainsWithoutContainsIsIgnored1BoxedBoolean +data class MincontainsWithoutContainsIsIgnored1BoxedBoolean
    +implements [MincontainsWithoutContainsIsIgnored1Boxed](#mincontainswithoutcontainsisignored1boxed) + +record that stores validated boolean payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| MincontainsWithoutContainsIsIgnored1BoxedBoolean(boolean data)
    Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| boolean | data()
    validated payload | +| Any? | getData()
    validated payload | + +## MincontainsWithoutContainsIsIgnored1BoxedNumber +data class MincontainsWithoutContainsIsIgnored1BoxedNumber
    +implements [MincontainsWithoutContainsIsIgnored1Boxed](#mincontainswithoutcontainsisignored1boxed) + +data class that stores validated Number payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| MincontainsWithoutContainsIsIgnored1BoxedNumber(Number data)
    Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| Number | data()
    validated payload | +| Any? | getData()
    validated payload | + +## MincontainsWithoutContainsIsIgnored1BoxedString +data class MincontainsWithoutContainsIsIgnored1BoxedString
    +implements [MincontainsWithoutContainsIsIgnored1Boxed](#mincontainswithoutcontainsisignored1boxed) + +data class that stores validated String payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| MincontainsWithoutContainsIsIgnored1BoxedString(String data)
    Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| String | data()
    validated payload | +| Any? | getData()
    validated payload | + +## MincontainsWithoutContainsIsIgnored1BoxedList +data class MincontainsWithoutContainsIsIgnored1BoxedList
    +implements [MincontainsWithoutContainsIsIgnored1Boxed](#mincontainswithoutcontainsisignored1boxed) + +data class that stores validated List payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| MincontainsWithoutContainsIsIgnored1BoxedList(FrozenList data)
    Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| FrozenList | data()
    validated payload | +| Any? | getData()
    validated payload | + +## MincontainsWithoutContainsIsIgnored1BoxedMap +data class MincontainsWithoutContainsIsIgnored1BoxedMap
    +implements [MincontainsWithoutContainsIsIgnored1Boxed](#mincontainswithoutcontainsisignored1boxed) + +data class that stores validated Map payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| MincontainsWithoutContainsIsIgnored1BoxedMap(FrozenMap data)
    Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| FrozenMap | data()
    validated payload | +| Any? | getData()
    validated payload | + +## MincontainsWithoutContainsIsIgnored1 +class MincontainsWithoutContainsIsIgnored1
    +extends JsonSchema + +A schema class that validates payloads + +### Field Summary +| Modifier and Type | Field and Description | +| ----------------- | ---------------------- | +| Integer | minContains = 1 | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| String | validate(arg: String, configuration: SchemaConfiguration) | +| Nothing? | validate(arg: Nothing?, configuration: SchemaConfiguration) | +| int | validate(arg: int, configuration: SchemaConfiguration) | +| long | validate(arg: long, configuration: SchemaConfiguration) | +| float | validate(arg: float, configuration: SchemaConfiguration) | +| double | validate(arg: double, configuration: SchemaConfiguration) | +| Number | validate(arg: Number, configuration: SchemaConfiguration) | +| boolean | validate(arg: boolean, configuration: SchemaConfiguration) | +| FrozenMap | validate(arg: Map<?, ?>, configuration: SchemaConfiguration) | +| FrozenList | validate(arg: List<*>, configuration: SchemaConfiguration) | +| [MincontainsWithoutContainsIsIgnored1BoxedString](#mincontainswithoutcontainsisignored1boxedstring) | validateAndBox(String, configuration: SchemaConfiguration) | +| [MincontainsWithoutContainsIsIgnored1BoxedVoid](#mincontainswithoutcontainsisignored1boxedvoid) | validateAndBox(Nothing?, configuration: SchemaConfiguration) | +| [MincontainsWithoutContainsIsIgnored1BoxedNumber](#mincontainswithoutcontainsisignored1boxednumber) | validateAndBox(Number, configuration: SchemaConfiguration) | +| [MincontainsWithoutContainsIsIgnored1BoxedBoolean](#mincontainswithoutcontainsisignored1boxedboolean) | validateAndBox(boolean, configuration: SchemaConfiguration) | +| [MincontainsWithoutContainsIsIgnored1BoxedMap](#mincontainswithoutcontainsisignored1boxedmap) | validateAndBox(Map<?, ?>, configuration: SchemaConfiguration) | +| [MincontainsWithoutContainsIsIgnored1BoxedList](#mincontainswithoutcontainsisignored1boxedlist) | validateAndBox(List<*>, configuration: SchemaConfiguration) | +| [MincontainsWithoutContainsIsIgnored1Boxed](#mincontainswithoutcontainsisignored1boxed) | validateAndBox(Any?, configuration: SchemaConfiguration) | +| Any? | validate(arg: Any?, configuration: SchemaConfiguration) | + +[[Back to top]](#top) [[Back to Component Schemas]](../../../README.md#Component-Schemas) [[Back to README]](../../../README.md) diff --git a/samples/client/3_1_0_unit_test/kotlin/docs/components/schemas/MinimumValidation.md b/samples/client/3_1_0_unit_test/kotlin/docs/components/schemas/MinimumValidation.md new file mode 100644 index 00000000000..94694cf69ec --- /dev/null +++ b/samples/client/3_1_0_unit_test/kotlin/docs/components/schemas/MinimumValidation.md @@ -0,0 +1,169 @@ +# MinimumValidation +org.openapijsonschematools.client.components.schemas.MinimumValidation.java +class MinimumValidation
    + +A class that contains necessary nested +- schema classes (which validate payloads), extends JsonSchema +- sealed interfaces which store validated payloads, Kotlin version of a sum type +- boxed classes which store validated payloads, sealed permits class implementations + +## Nested Class Summary +| Modifier and Type | Class and Description | +| ----------------- | ---------------------- | +| sealed interface | [MinimumValidation.MinimumValidation1Boxed](#minimumvalidation1boxed)
    sealed interface for validated payloads | +| record | [MinimumValidation.MinimumValidation1BoxedVoid](#minimumvalidation1boxedvoid)
    boxed class to store validated null payloads | +| record | [MinimumValidation.MinimumValidation1BoxedBoolean](#minimumvalidation1boxedboolean)
    boxed class to store validated boolean payloads | +| record | [MinimumValidation.MinimumValidation1BoxedNumber](#minimumvalidation1boxednumber)
    boxed class to store validated Number payloads | +| record | [MinimumValidation.MinimumValidation1BoxedString](#minimumvalidation1boxedstring)
    boxed class to store validated String payloads | +| record | [MinimumValidation.MinimumValidation1BoxedList](#minimumvalidation1boxedlist)
    boxed class to store validated List payloads | +| record | [MinimumValidation.MinimumValidation1BoxedMap](#minimumvalidation1boxedmap)
    boxed class to store validated Map payloads | +| static class | [MinimumValidation.MinimumValidation1](#minimumvalidation1)
    schema class | + +## MinimumValidation1Boxed +sealed interface MinimumValidation1Boxed
    +permits
    +[MinimumValidation1BoxedVoid](#minimumvalidation1boxedvoid), +[MinimumValidation1BoxedBoolean](#minimumvalidation1boxedboolean), +[MinimumValidation1BoxedNumber](#minimumvalidation1boxednumber), +[MinimumValidation1BoxedString](#minimumvalidation1boxedstring), +[MinimumValidation1BoxedList](#minimumvalidation1boxedlist), +[MinimumValidation1BoxedMap](#minimumvalidation1boxedmap) + +sealed interface that stores validated payloads using boxed classes + +## MinimumValidation1BoxedVoid +data class MinimumValidation1BoxedVoid
    +implements [MinimumValidation1Boxed](#minimumvalidation1boxed) + +data class that stores validated null payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| MinimumValidation1BoxedVoid(Nothing? data)
    Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| Nothing? | data()
    validated payload | +| Any? | getData()
    validated payload | + +## MinimumValidation1BoxedBoolean +data class MinimumValidation1BoxedBoolean
    +implements [MinimumValidation1Boxed](#minimumvalidation1boxed) + +record that stores validated boolean payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| MinimumValidation1BoxedBoolean(boolean data)
    Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| boolean | data()
    validated payload | +| Any? | getData()
    validated payload | + +## MinimumValidation1BoxedNumber +data class MinimumValidation1BoxedNumber
    +implements [MinimumValidation1Boxed](#minimumvalidation1boxed) + +data class that stores validated Number payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| MinimumValidation1BoxedNumber(Number data)
    Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| Number | data()
    validated payload | +| Any? | getData()
    validated payload | + +## MinimumValidation1BoxedString +data class MinimumValidation1BoxedString
    +implements [MinimumValidation1Boxed](#minimumvalidation1boxed) + +data class that stores validated String payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| MinimumValidation1BoxedString(String data)
    Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| String | data()
    validated payload | +| Any? | getData()
    validated payload | + +## MinimumValidation1BoxedList +data class MinimumValidation1BoxedList
    +implements [MinimumValidation1Boxed](#minimumvalidation1boxed) + +data class that stores validated List payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| MinimumValidation1BoxedList(FrozenList data)
    Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| FrozenList | data()
    validated payload | +| Any? | getData()
    validated payload | + +## MinimumValidation1BoxedMap +data class MinimumValidation1BoxedMap
    +implements [MinimumValidation1Boxed](#minimumvalidation1boxed) + +data class that stores validated Map payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| MinimumValidation1BoxedMap(FrozenMap data)
    Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| FrozenMap | data()
    validated payload | +| Any? | getData()
    validated payload | + +## MinimumValidation1 +class MinimumValidation1
    +extends JsonSchema + +A schema class that validates payloads + +### Field Summary +| Modifier and Type | Field and Description | +| ----------------- | ---------------------- | +| Number | minimum = 1.1 | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| String | validate(arg: String, configuration: SchemaConfiguration) | +| Nothing? | validate(arg: Nothing?, configuration: SchemaConfiguration) | +| int | validate(arg: int, configuration: SchemaConfiguration) | +| long | validate(arg: long, configuration: SchemaConfiguration) | +| float | validate(arg: float, configuration: SchemaConfiguration) | +| double | validate(arg: double, configuration: SchemaConfiguration) | +| Number | validate(arg: Number, configuration: SchemaConfiguration) | +| boolean | validate(arg: boolean, configuration: SchemaConfiguration) | +| FrozenMap | validate(arg: Map<?, ?>, configuration: SchemaConfiguration) | +| FrozenList | validate(arg: List<*>, configuration: SchemaConfiguration) | +| [MinimumValidation1BoxedString](#minimumvalidation1boxedstring) | validateAndBox(String, configuration: SchemaConfiguration) | +| [MinimumValidation1BoxedVoid](#minimumvalidation1boxedvoid) | validateAndBox(Nothing?, configuration: SchemaConfiguration) | +| [MinimumValidation1BoxedNumber](#minimumvalidation1boxednumber) | validateAndBox(Number, configuration: SchemaConfiguration) | +| [MinimumValidation1BoxedBoolean](#minimumvalidation1boxedboolean) | validateAndBox(boolean, configuration: SchemaConfiguration) | +| [MinimumValidation1BoxedMap](#minimumvalidation1boxedmap) | validateAndBox(Map<?, ?>, configuration: SchemaConfiguration) | +| [MinimumValidation1BoxedList](#minimumvalidation1boxedlist) | validateAndBox(List<*>, configuration: SchemaConfiguration) | +| [MinimumValidation1Boxed](#minimumvalidation1boxed) | validateAndBox(Any?, configuration: SchemaConfiguration) | +| Any? | validate(arg: Any?, configuration: SchemaConfiguration) | + +[[Back to top]](#top) [[Back to Component Schemas]](../../../README.md#Component-Schemas) [[Back to README]](../../../README.md) diff --git a/samples/client/3_1_0_unit_test/kotlin/docs/components/schemas/MinimumValidationWithSignedInteger.md b/samples/client/3_1_0_unit_test/kotlin/docs/components/schemas/MinimumValidationWithSignedInteger.md new file mode 100644 index 00000000000..b898faa9cd1 --- /dev/null +++ b/samples/client/3_1_0_unit_test/kotlin/docs/components/schemas/MinimumValidationWithSignedInteger.md @@ -0,0 +1,169 @@ +# MinimumValidationWithSignedInteger +org.openapijsonschematools.client.components.schemas.MinimumValidationWithSignedInteger.java +class MinimumValidationWithSignedInteger
    + +A class that contains necessary nested +- schema classes (which validate payloads), extends JsonSchema +- sealed interfaces which store validated payloads, Kotlin version of a sum type +- boxed classes which store validated payloads, sealed permits class implementations + +## Nested Class Summary +| Modifier and Type | Class and Description | +| ----------------- | ---------------------- | +| sealed interface | [MinimumValidationWithSignedInteger.MinimumValidationWithSignedInteger1Boxed](#minimumvalidationwithsignedinteger1boxed)
    sealed interface for validated payloads | +| record | [MinimumValidationWithSignedInteger.MinimumValidationWithSignedInteger1BoxedVoid](#minimumvalidationwithsignedinteger1boxedvoid)
    boxed class to store validated null payloads | +| record | [MinimumValidationWithSignedInteger.MinimumValidationWithSignedInteger1BoxedBoolean](#minimumvalidationwithsignedinteger1boxedboolean)
    boxed class to store validated boolean payloads | +| record | [MinimumValidationWithSignedInteger.MinimumValidationWithSignedInteger1BoxedNumber](#minimumvalidationwithsignedinteger1boxednumber)
    boxed class to store validated Number payloads | +| record | [MinimumValidationWithSignedInteger.MinimumValidationWithSignedInteger1BoxedString](#minimumvalidationwithsignedinteger1boxedstring)
    boxed class to store validated String payloads | +| record | [MinimumValidationWithSignedInteger.MinimumValidationWithSignedInteger1BoxedList](#minimumvalidationwithsignedinteger1boxedlist)
    boxed class to store validated List payloads | +| record | [MinimumValidationWithSignedInteger.MinimumValidationWithSignedInteger1BoxedMap](#minimumvalidationwithsignedinteger1boxedmap)
    boxed class to store validated Map payloads | +| static class | [MinimumValidationWithSignedInteger.MinimumValidationWithSignedInteger1](#minimumvalidationwithsignedinteger1)
    schema class | + +## MinimumValidationWithSignedInteger1Boxed +sealed interface MinimumValidationWithSignedInteger1Boxed
    +permits
    +[MinimumValidationWithSignedInteger1BoxedVoid](#minimumvalidationwithsignedinteger1boxedvoid), +[MinimumValidationWithSignedInteger1BoxedBoolean](#minimumvalidationwithsignedinteger1boxedboolean), +[MinimumValidationWithSignedInteger1BoxedNumber](#minimumvalidationwithsignedinteger1boxednumber), +[MinimumValidationWithSignedInteger1BoxedString](#minimumvalidationwithsignedinteger1boxedstring), +[MinimumValidationWithSignedInteger1BoxedList](#minimumvalidationwithsignedinteger1boxedlist), +[MinimumValidationWithSignedInteger1BoxedMap](#minimumvalidationwithsignedinteger1boxedmap) + +sealed interface that stores validated payloads using boxed classes + +## MinimumValidationWithSignedInteger1BoxedVoid +data class MinimumValidationWithSignedInteger1BoxedVoid
    +implements [MinimumValidationWithSignedInteger1Boxed](#minimumvalidationwithsignedinteger1boxed) + +data class that stores validated null payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| MinimumValidationWithSignedInteger1BoxedVoid(Nothing? data)
    Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| Nothing? | data()
    validated payload | +| Any? | getData()
    validated payload | + +## MinimumValidationWithSignedInteger1BoxedBoolean +data class MinimumValidationWithSignedInteger1BoxedBoolean
    +implements [MinimumValidationWithSignedInteger1Boxed](#minimumvalidationwithsignedinteger1boxed) + +record that stores validated boolean payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| MinimumValidationWithSignedInteger1BoxedBoolean(boolean data)
    Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| boolean | data()
    validated payload | +| Any? | getData()
    validated payload | + +## MinimumValidationWithSignedInteger1BoxedNumber +data class MinimumValidationWithSignedInteger1BoxedNumber
    +implements [MinimumValidationWithSignedInteger1Boxed](#minimumvalidationwithsignedinteger1boxed) + +data class that stores validated Number payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| MinimumValidationWithSignedInteger1BoxedNumber(Number data)
    Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| Number | data()
    validated payload | +| Any? | getData()
    validated payload | + +## MinimumValidationWithSignedInteger1BoxedString +data class MinimumValidationWithSignedInteger1BoxedString
    +implements [MinimumValidationWithSignedInteger1Boxed](#minimumvalidationwithsignedinteger1boxed) + +data class that stores validated String payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| MinimumValidationWithSignedInteger1BoxedString(String data)
    Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| String | data()
    validated payload | +| Any? | getData()
    validated payload | + +## MinimumValidationWithSignedInteger1BoxedList +data class MinimumValidationWithSignedInteger1BoxedList
    +implements [MinimumValidationWithSignedInteger1Boxed](#minimumvalidationwithsignedinteger1boxed) + +data class that stores validated List payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| MinimumValidationWithSignedInteger1BoxedList(FrozenList data)
    Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| FrozenList | data()
    validated payload | +| Any? | getData()
    validated payload | + +## MinimumValidationWithSignedInteger1BoxedMap +data class MinimumValidationWithSignedInteger1BoxedMap
    +implements [MinimumValidationWithSignedInteger1Boxed](#minimumvalidationwithsignedinteger1boxed) + +data class that stores validated Map payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| MinimumValidationWithSignedInteger1BoxedMap(FrozenMap data)
    Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| FrozenMap | data()
    validated payload | +| Any? | getData()
    validated payload | + +## MinimumValidationWithSignedInteger1 +class MinimumValidationWithSignedInteger1
    +extends JsonSchema + +A schema class that validates payloads + +### Field Summary +| Modifier and Type | Field and Description | +| ----------------- | ---------------------- | +| Number | minimum = -2 | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| String | validate(arg: String, configuration: SchemaConfiguration) | +| Nothing? | validate(arg: Nothing?, configuration: SchemaConfiguration) | +| int | validate(arg: int, configuration: SchemaConfiguration) | +| long | validate(arg: long, configuration: SchemaConfiguration) | +| float | validate(arg: float, configuration: SchemaConfiguration) | +| double | validate(arg: double, configuration: SchemaConfiguration) | +| Number | validate(arg: Number, configuration: SchemaConfiguration) | +| boolean | validate(arg: boolean, configuration: SchemaConfiguration) | +| FrozenMap | validate(arg: Map<?, ?>, configuration: SchemaConfiguration) | +| FrozenList | validate(arg: List<*>, configuration: SchemaConfiguration) | +| [MinimumValidationWithSignedInteger1BoxedString](#minimumvalidationwithsignedinteger1boxedstring) | validateAndBox(String, configuration: SchemaConfiguration) | +| [MinimumValidationWithSignedInteger1BoxedVoid](#minimumvalidationwithsignedinteger1boxedvoid) | validateAndBox(Nothing?, configuration: SchemaConfiguration) | +| [MinimumValidationWithSignedInteger1BoxedNumber](#minimumvalidationwithsignedinteger1boxednumber) | validateAndBox(Number, configuration: SchemaConfiguration) | +| [MinimumValidationWithSignedInteger1BoxedBoolean](#minimumvalidationwithsignedinteger1boxedboolean) | validateAndBox(boolean, configuration: SchemaConfiguration) | +| [MinimumValidationWithSignedInteger1BoxedMap](#minimumvalidationwithsignedinteger1boxedmap) | validateAndBox(Map<?, ?>, configuration: SchemaConfiguration) | +| [MinimumValidationWithSignedInteger1BoxedList](#minimumvalidationwithsignedinteger1boxedlist) | validateAndBox(List<*>, configuration: SchemaConfiguration) | +| [MinimumValidationWithSignedInteger1Boxed](#minimumvalidationwithsignedinteger1boxed) | validateAndBox(Any?, configuration: SchemaConfiguration) | +| Any? | validate(arg: Any?, configuration: SchemaConfiguration) | + +[[Back to top]](#top) [[Back to Component Schemas]](../../../README.md#Component-Schemas) [[Back to README]](../../../README.md) diff --git a/samples/client/3_1_0_unit_test/kotlin/docs/components/schemas/MinitemsValidation.md b/samples/client/3_1_0_unit_test/kotlin/docs/components/schemas/MinitemsValidation.md new file mode 100644 index 00000000000..e095c974cd9 --- /dev/null +++ b/samples/client/3_1_0_unit_test/kotlin/docs/components/schemas/MinitemsValidation.md @@ -0,0 +1,169 @@ +# MinitemsValidation +org.openapijsonschematools.client.components.schemas.MinitemsValidation.java +class MinitemsValidation
    + +A class that contains necessary nested +- schema classes (which validate payloads), extends JsonSchema +- sealed interfaces which store validated payloads, Kotlin version of a sum type +- boxed classes which store validated payloads, sealed permits class implementations + +## Nested Class Summary +| Modifier and Type | Class and Description | +| ----------------- | ---------------------- | +| sealed interface | [MinitemsValidation.MinitemsValidation1Boxed](#minitemsvalidation1boxed)
    sealed interface for validated payloads | +| record | [MinitemsValidation.MinitemsValidation1BoxedVoid](#minitemsvalidation1boxedvoid)
    boxed class to store validated null payloads | +| record | [MinitemsValidation.MinitemsValidation1BoxedBoolean](#minitemsvalidation1boxedboolean)
    boxed class to store validated boolean payloads | +| record | [MinitemsValidation.MinitemsValidation1BoxedNumber](#minitemsvalidation1boxednumber)
    boxed class to store validated Number payloads | +| record | [MinitemsValidation.MinitemsValidation1BoxedString](#minitemsvalidation1boxedstring)
    boxed class to store validated String payloads | +| record | [MinitemsValidation.MinitemsValidation1BoxedList](#minitemsvalidation1boxedlist)
    boxed class to store validated List payloads | +| record | [MinitemsValidation.MinitemsValidation1BoxedMap](#minitemsvalidation1boxedmap)
    boxed class to store validated Map payloads | +| static class | [MinitemsValidation.MinitemsValidation1](#minitemsvalidation1)
    schema class | + +## MinitemsValidation1Boxed +sealed interface MinitemsValidation1Boxed
    +permits
    +[MinitemsValidation1BoxedVoid](#minitemsvalidation1boxedvoid), +[MinitemsValidation1BoxedBoolean](#minitemsvalidation1boxedboolean), +[MinitemsValidation1BoxedNumber](#minitemsvalidation1boxednumber), +[MinitemsValidation1BoxedString](#minitemsvalidation1boxedstring), +[MinitemsValidation1BoxedList](#minitemsvalidation1boxedlist), +[MinitemsValidation1BoxedMap](#minitemsvalidation1boxedmap) + +sealed interface that stores validated payloads using boxed classes + +## MinitemsValidation1BoxedVoid +data class MinitemsValidation1BoxedVoid
    +implements [MinitemsValidation1Boxed](#minitemsvalidation1boxed) + +data class that stores validated null payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| MinitemsValidation1BoxedVoid(Nothing? data)
    Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| Nothing? | data()
    validated payload | +| Any? | getData()
    validated payload | + +## MinitemsValidation1BoxedBoolean +data class MinitemsValidation1BoxedBoolean
    +implements [MinitemsValidation1Boxed](#minitemsvalidation1boxed) + +record that stores validated boolean payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| MinitemsValidation1BoxedBoolean(boolean data)
    Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| boolean | data()
    validated payload | +| Any? | getData()
    validated payload | + +## MinitemsValidation1BoxedNumber +data class MinitemsValidation1BoxedNumber
    +implements [MinitemsValidation1Boxed](#minitemsvalidation1boxed) + +data class that stores validated Number payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| MinitemsValidation1BoxedNumber(Number data)
    Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| Number | data()
    validated payload | +| Any? | getData()
    validated payload | + +## MinitemsValidation1BoxedString +data class MinitemsValidation1BoxedString
    +implements [MinitemsValidation1Boxed](#minitemsvalidation1boxed) + +data class that stores validated String payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| MinitemsValidation1BoxedString(String data)
    Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| String | data()
    validated payload | +| Any? | getData()
    validated payload | + +## MinitemsValidation1BoxedList +data class MinitemsValidation1BoxedList
    +implements [MinitemsValidation1Boxed](#minitemsvalidation1boxed) + +data class that stores validated List payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| MinitemsValidation1BoxedList(FrozenList data)
    Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| FrozenList | data()
    validated payload | +| Any? | getData()
    validated payload | + +## MinitemsValidation1BoxedMap +data class MinitemsValidation1BoxedMap
    +implements [MinitemsValidation1Boxed](#minitemsvalidation1boxed) + +data class that stores validated Map payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| MinitemsValidation1BoxedMap(FrozenMap data)
    Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| FrozenMap | data()
    validated payload | +| Any? | getData()
    validated payload | + +## MinitemsValidation1 +class MinitemsValidation1
    +extends JsonSchema + +A schema class that validates payloads + +### Field Summary +| Modifier and Type | Field and Description | +| ----------------- | ---------------------- | +| Integer | minItems = 1 | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| String | validate(arg: String, configuration: SchemaConfiguration) | +| Nothing? | validate(arg: Nothing?, configuration: SchemaConfiguration) | +| int | validate(arg: int, configuration: SchemaConfiguration) | +| long | validate(arg: long, configuration: SchemaConfiguration) | +| float | validate(arg: float, configuration: SchemaConfiguration) | +| double | validate(arg: double, configuration: SchemaConfiguration) | +| Number | validate(arg: Number, configuration: SchemaConfiguration) | +| boolean | validate(arg: boolean, configuration: SchemaConfiguration) | +| FrozenMap | validate(arg: Map<?, ?>, configuration: SchemaConfiguration) | +| FrozenList | validate(arg: List<*>, configuration: SchemaConfiguration) | +| [MinitemsValidation1BoxedString](#minitemsvalidation1boxedstring) | validateAndBox(String, configuration: SchemaConfiguration) | +| [MinitemsValidation1BoxedVoid](#minitemsvalidation1boxedvoid) | validateAndBox(Nothing?, configuration: SchemaConfiguration) | +| [MinitemsValidation1BoxedNumber](#minitemsvalidation1boxednumber) | validateAndBox(Number, configuration: SchemaConfiguration) | +| [MinitemsValidation1BoxedBoolean](#minitemsvalidation1boxedboolean) | validateAndBox(boolean, configuration: SchemaConfiguration) | +| [MinitemsValidation1BoxedMap](#minitemsvalidation1boxedmap) | validateAndBox(Map<?, ?>, configuration: SchemaConfiguration) | +| [MinitemsValidation1BoxedList](#minitemsvalidation1boxedlist) | validateAndBox(List<*>, configuration: SchemaConfiguration) | +| [MinitemsValidation1Boxed](#minitemsvalidation1boxed) | validateAndBox(Any?, configuration: SchemaConfiguration) | +| Any? | validate(arg: Any?, configuration: SchemaConfiguration) | + +[[Back to top]](#top) [[Back to Component Schemas]](../../../README.md#Component-Schemas) [[Back to README]](../../../README.md) diff --git a/samples/client/3_1_0_unit_test/kotlin/docs/components/schemas/MinlengthValidation.md b/samples/client/3_1_0_unit_test/kotlin/docs/components/schemas/MinlengthValidation.md new file mode 100644 index 00000000000..3905f4a2411 --- /dev/null +++ b/samples/client/3_1_0_unit_test/kotlin/docs/components/schemas/MinlengthValidation.md @@ -0,0 +1,169 @@ +# MinlengthValidation +org.openapijsonschematools.client.components.schemas.MinlengthValidation.java +class MinlengthValidation
    + +A class that contains necessary nested +- schema classes (which validate payloads), extends JsonSchema +- sealed interfaces which store validated payloads, Kotlin version of a sum type +- boxed classes which store validated payloads, sealed permits class implementations + +## Nested Class Summary +| Modifier and Type | Class and Description | +| ----------------- | ---------------------- | +| sealed interface | [MinlengthValidation.MinlengthValidation1Boxed](#minlengthvalidation1boxed)
    sealed interface for validated payloads | +| record | [MinlengthValidation.MinlengthValidation1BoxedVoid](#minlengthvalidation1boxedvoid)
    boxed class to store validated null payloads | +| record | [MinlengthValidation.MinlengthValidation1BoxedBoolean](#minlengthvalidation1boxedboolean)
    boxed class to store validated boolean payloads | +| record | [MinlengthValidation.MinlengthValidation1BoxedNumber](#minlengthvalidation1boxednumber)
    boxed class to store validated Number payloads | +| record | [MinlengthValidation.MinlengthValidation1BoxedString](#minlengthvalidation1boxedstring)
    boxed class to store validated String payloads | +| record | [MinlengthValidation.MinlengthValidation1BoxedList](#minlengthvalidation1boxedlist)
    boxed class to store validated List payloads | +| record | [MinlengthValidation.MinlengthValidation1BoxedMap](#minlengthvalidation1boxedmap)
    boxed class to store validated Map payloads | +| static class | [MinlengthValidation.MinlengthValidation1](#minlengthvalidation1)
    schema class | + +## MinlengthValidation1Boxed +sealed interface MinlengthValidation1Boxed
    +permits
    +[MinlengthValidation1BoxedVoid](#minlengthvalidation1boxedvoid), +[MinlengthValidation1BoxedBoolean](#minlengthvalidation1boxedboolean), +[MinlengthValidation1BoxedNumber](#minlengthvalidation1boxednumber), +[MinlengthValidation1BoxedString](#minlengthvalidation1boxedstring), +[MinlengthValidation1BoxedList](#minlengthvalidation1boxedlist), +[MinlengthValidation1BoxedMap](#minlengthvalidation1boxedmap) + +sealed interface that stores validated payloads using boxed classes + +## MinlengthValidation1BoxedVoid +data class MinlengthValidation1BoxedVoid
    +implements [MinlengthValidation1Boxed](#minlengthvalidation1boxed) + +data class that stores validated null payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| MinlengthValidation1BoxedVoid(Nothing? data)
    Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| Nothing? | data()
    validated payload | +| Any? | getData()
    validated payload | + +## MinlengthValidation1BoxedBoolean +data class MinlengthValidation1BoxedBoolean
    +implements [MinlengthValidation1Boxed](#minlengthvalidation1boxed) + +record that stores validated boolean payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| MinlengthValidation1BoxedBoolean(boolean data)
    Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| boolean | data()
    validated payload | +| Any? | getData()
    validated payload | + +## MinlengthValidation1BoxedNumber +data class MinlengthValidation1BoxedNumber
    +implements [MinlengthValidation1Boxed](#minlengthvalidation1boxed) + +data class that stores validated Number payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| MinlengthValidation1BoxedNumber(Number data)
    Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| Number | data()
    validated payload | +| Any? | getData()
    validated payload | + +## MinlengthValidation1BoxedString +data class MinlengthValidation1BoxedString
    +implements [MinlengthValidation1Boxed](#minlengthvalidation1boxed) + +data class that stores validated String payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| MinlengthValidation1BoxedString(String data)
    Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| String | data()
    validated payload | +| Any? | getData()
    validated payload | + +## MinlengthValidation1BoxedList +data class MinlengthValidation1BoxedList
    +implements [MinlengthValidation1Boxed](#minlengthvalidation1boxed) + +data class that stores validated List payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| MinlengthValidation1BoxedList(FrozenList data)
    Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| FrozenList | data()
    validated payload | +| Any? | getData()
    validated payload | + +## MinlengthValidation1BoxedMap +data class MinlengthValidation1BoxedMap
    +implements [MinlengthValidation1Boxed](#minlengthvalidation1boxed) + +data class that stores validated Map payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| MinlengthValidation1BoxedMap(FrozenMap data)
    Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| FrozenMap | data()
    validated payload | +| Any? | getData()
    validated payload | + +## MinlengthValidation1 +class MinlengthValidation1
    +extends JsonSchema + +A schema class that validates payloads + +### Field Summary +| Modifier and Type | Field and Description | +| ----------------- | ---------------------- | +| Integer | minLength = 2 | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| String | validate(arg: String, configuration: SchemaConfiguration) | +| Nothing? | validate(arg: Nothing?, configuration: SchemaConfiguration) | +| int | validate(arg: int, configuration: SchemaConfiguration) | +| long | validate(arg: long, configuration: SchemaConfiguration) | +| float | validate(arg: float, configuration: SchemaConfiguration) | +| double | validate(arg: double, configuration: SchemaConfiguration) | +| Number | validate(arg: Number, configuration: SchemaConfiguration) | +| boolean | validate(arg: boolean, configuration: SchemaConfiguration) | +| FrozenMap | validate(arg: Map<?, ?>, configuration: SchemaConfiguration) | +| FrozenList | validate(arg: List<*>, configuration: SchemaConfiguration) | +| [MinlengthValidation1BoxedString](#minlengthvalidation1boxedstring) | validateAndBox(String, configuration: SchemaConfiguration) | +| [MinlengthValidation1BoxedVoid](#minlengthvalidation1boxedvoid) | validateAndBox(Nothing?, configuration: SchemaConfiguration) | +| [MinlengthValidation1BoxedNumber](#minlengthvalidation1boxednumber) | validateAndBox(Number, configuration: SchemaConfiguration) | +| [MinlengthValidation1BoxedBoolean](#minlengthvalidation1boxedboolean) | validateAndBox(boolean, configuration: SchemaConfiguration) | +| [MinlengthValidation1BoxedMap](#minlengthvalidation1boxedmap) | validateAndBox(Map<?, ?>, configuration: SchemaConfiguration) | +| [MinlengthValidation1BoxedList](#minlengthvalidation1boxedlist) | validateAndBox(List<*>, configuration: SchemaConfiguration) | +| [MinlengthValidation1Boxed](#minlengthvalidation1boxed) | validateAndBox(Any?, configuration: SchemaConfiguration) | +| Any? | validate(arg: Any?, configuration: SchemaConfiguration) | + +[[Back to top]](#top) [[Back to Component Schemas]](../../../README.md#Component-Schemas) [[Back to README]](../../../README.md) diff --git a/samples/client/3_1_0_unit_test/kotlin/docs/components/schemas/MinpropertiesValidation.md b/samples/client/3_1_0_unit_test/kotlin/docs/components/schemas/MinpropertiesValidation.md new file mode 100644 index 00000000000..27161315772 --- /dev/null +++ b/samples/client/3_1_0_unit_test/kotlin/docs/components/schemas/MinpropertiesValidation.md @@ -0,0 +1,169 @@ +# MinpropertiesValidation +org.openapijsonschematools.client.components.schemas.MinpropertiesValidation.java +class MinpropertiesValidation
    + +A class that contains necessary nested +- schema classes (which validate payloads), extends JsonSchema +- sealed interfaces which store validated payloads, Kotlin version of a sum type +- boxed classes which store validated payloads, sealed permits class implementations + +## Nested Class Summary +| Modifier and Type | Class and Description | +| ----------------- | ---------------------- | +| sealed interface | [MinpropertiesValidation.MinpropertiesValidation1Boxed](#minpropertiesvalidation1boxed)
    sealed interface for validated payloads | +| record | [MinpropertiesValidation.MinpropertiesValidation1BoxedVoid](#minpropertiesvalidation1boxedvoid)
    boxed class to store validated null payloads | +| record | [MinpropertiesValidation.MinpropertiesValidation1BoxedBoolean](#minpropertiesvalidation1boxedboolean)
    boxed class to store validated boolean payloads | +| record | [MinpropertiesValidation.MinpropertiesValidation1BoxedNumber](#minpropertiesvalidation1boxednumber)
    boxed class to store validated Number payloads | +| record | [MinpropertiesValidation.MinpropertiesValidation1BoxedString](#minpropertiesvalidation1boxedstring)
    boxed class to store validated String payloads | +| record | [MinpropertiesValidation.MinpropertiesValidation1BoxedList](#minpropertiesvalidation1boxedlist)
    boxed class to store validated List payloads | +| record | [MinpropertiesValidation.MinpropertiesValidation1BoxedMap](#minpropertiesvalidation1boxedmap)
    boxed class to store validated Map payloads | +| static class | [MinpropertiesValidation.MinpropertiesValidation1](#minpropertiesvalidation1)
    schema class | + +## MinpropertiesValidation1Boxed +sealed interface MinpropertiesValidation1Boxed
    +permits
    +[MinpropertiesValidation1BoxedVoid](#minpropertiesvalidation1boxedvoid), +[MinpropertiesValidation1BoxedBoolean](#minpropertiesvalidation1boxedboolean), +[MinpropertiesValidation1BoxedNumber](#minpropertiesvalidation1boxednumber), +[MinpropertiesValidation1BoxedString](#minpropertiesvalidation1boxedstring), +[MinpropertiesValidation1BoxedList](#minpropertiesvalidation1boxedlist), +[MinpropertiesValidation1BoxedMap](#minpropertiesvalidation1boxedmap) + +sealed interface that stores validated payloads using boxed classes + +## MinpropertiesValidation1BoxedVoid +data class MinpropertiesValidation1BoxedVoid
    +implements [MinpropertiesValidation1Boxed](#minpropertiesvalidation1boxed) + +data class that stores validated null payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| MinpropertiesValidation1BoxedVoid(Nothing? data)
    Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| Nothing? | data()
    validated payload | +| Any? | getData()
    validated payload | + +## MinpropertiesValidation1BoxedBoolean +data class MinpropertiesValidation1BoxedBoolean
    +implements [MinpropertiesValidation1Boxed](#minpropertiesvalidation1boxed) + +record that stores validated boolean payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| MinpropertiesValidation1BoxedBoolean(boolean data)
    Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| boolean | data()
    validated payload | +| Any? | getData()
    validated payload | + +## MinpropertiesValidation1BoxedNumber +data class MinpropertiesValidation1BoxedNumber
    +implements [MinpropertiesValidation1Boxed](#minpropertiesvalidation1boxed) + +data class that stores validated Number payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| MinpropertiesValidation1BoxedNumber(Number data)
    Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| Number | data()
    validated payload | +| Any? | getData()
    validated payload | + +## MinpropertiesValidation1BoxedString +data class MinpropertiesValidation1BoxedString
    +implements [MinpropertiesValidation1Boxed](#minpropertiesvalidation1boxed) + +data class that stores validated String payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| MinpropertiesValidation1BoxedString(String data)
    Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| String | data()
    validated payload | +| Any? | getData()
    validated payload | + +## MinpropertiesValidation1BoxedList +data class MinpropertiesValidation1BoxedList
    +implements [MinpropertiesValidation1Boxed](#minpropertiesvalidation1boxed) + +data class that stores validated List payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| MinpropertiesValidation1BoxedList(FrozenList data)
    Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| FrozenList | data()
    validated payload | +| Any? | getData()
    validated payload | + +## MinpropertiesValidation1BoxedMap +data class MinpropertiesValidation1BoxedMap
    +implements [MinpropertiesValidation1Boxed](#minpropertiesvalidation1boxed) + +data class that stores validated Map payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| MinpropertiesValidation1BoxedMap(FrozenMap data)
    Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| FrozenMap | data()
    validated payload | +| Any? | getData()
    validated payload | + +## MinpropertiesValidation1 +class MinpropertiesValidation1
    +extends JsonSchema + +A schema class that validates payloads + +### Field Summary +| Modifier and Type | Field and Description | +| ----------------- | ---------------------- | +| Integer | minProperties = 1 | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| String | validate(arg: String, configuration: SchemaConfiguration) | +| Nothing? | validate(arg: Nothing?, configuration: SchemaConfiguration) | +| int | validate(arg: int, configuration: SchemaConfiguration) | +| long | validate(arg: long, configuration: SchemaConfiguration) | +| float | validate(arg: float, configuration: SchemaConfiguration) | +| double | validate(arg: double, configuration: SchemaConfiguration) | +| Number | validate(arg: Number, configuration: SchemaConfiguration) | +| boolean | validate(arg: boolean, configuration: SchemaConfiguration) | +| FrozenMap | validate(arg: Map<?, ?>, configuration: SchemaConfiguration) | +| FrozenList | validate(arg: List<*>, configuration: SchemaConfiguration) | +| [MinpropertiesValidation1BoxedString](#minpropertiesvalidation1boxedstring) | validateAndBox(String, configuration: SchemaConfiguration) | +| [MinpropertiesValidation1BoxedVoid](#minpropertiesvalidation1boxedvoid) | validateAndBox(Nothing?, configuration: SchemaConfiguration) | +| [MinpropertiesValidation1BoxedNumber](#minpropertiesvalidation1boxednumber) | validateAndBox(Number, configuration: SchemaConfiguration) | +| [MinpropertiesValidation1BoxedBoolean](#minpropertiesvalidation1boxedboolean) | validateAndBox(boolean, configuration: SchemaConfiguration) | +| [MinpropertiesValidation1BoxedMap](#minpropertiesvalidation1boxedmap) | validateAndBox(Map<?, ?>, configuration: SchemaConfiguration) | +| [MinpropertiesValidation1BoxedList](#minpropertiesvalidation1boxedlist) | validateAndBox(List<*>, configuration: SchemaConfiguration) | +| [MinpropertiesValidation1Boxed](#minpropertiesvalidation1boxed) | validateAndBox(Any?, configuration: SchemaConfiguration) | +| Any? | validate(arg: Any?, configuration: SchemaConfiguration) | + +[[Back to top]](#top) [[Back to Component Schemas]](../../../README.md#Component-Schemas) [[Back to README]](../../../README.md) diff --git a/samples/client/3_1_0_unit_test/kotlin/docs/components/schemas/MultipleDependentsRequired.md b/samples/client/3_1_0_unit_test/kotlin/docs/components/schemas/MultipleDependentsRequired.md new file mode 100644 index 00000000000..96112100122 --- /dev/null +++ b/samples/client/3_1_0_unit_test/kotlin/docs/components/schemas/MultipleDependentsRequired.md @@ -0,0 +1,178 @@ +# MultipleDependentsRequired +org.openapijsonschematools.client.components.schemas.MultipleDependentsRequired.java +class MultipleDependentsRequired
    + +A class that contains necessary nested +- schema classes (which validate payloads), extends JsonSchema +- sealed interfaces which store validated payloads, Kotlin version of a sum type +- boxed classes which store validated payloads, sealed permits class implementations + +## Nested Class Summary +| Modifier and Type | Class and Description | +| ----------------- | ---------------------- | +| sealed interface | [MultipleDependentsRequired.MultipleDependentsRequired1Boxed](#multipledependentsrequired1boxed)
    sealed interface for validated payloads | +| record | [MultipleDependentsRequired.MultipleDependentsRequired1BoxedVoid](#multipledependentsrequired1boxedvoid)
    boxed class to store validated null payloads | +| record | [MultipleDependentsRequired.MultipleDependentsRequired1BoxedBoolean](#multipledependentsrequired1boxedboolean)
    boxed class to store validated boolean payloads | +| record | [MultipleDependentsRequired.MultipleDependentsRequired1BoxedNumber](#multipledependentsrequired1boxednumber)
    boxed class to store validated Number payloads | +| record | [MultipleDependentsRequired.MultipleDependentsRequired1BoxedString](#multipledependentsrequired1boxedstring)
    boxed class to store validated String payloads | +| record | [MultipleDependentsRequired.MultipleDependentsRequired1BoxedList](#multipledependentsrequired1boxedlist)
    boxed class to store validated List payloads | +| record | [MultipleDependentsRequired.MultipleDependentsRequired1BoxedMap](#multipledependentsrequired1boxedmap)
    boxed class to store validated Map payloads | +| static class | [MultipleDependentsRequired.MultipleDependentsRequired1](#multipledependentsrequired1)
    schema class | + +## MultipleDependentsRequired1Boxed +sealed interface MultipleDependentsRequired1Boxed
    +permits
    +[MultipleDependentsRequired1BoxedVoid](#multipledependentsrequired1boxedvoid), +[MultipleDependentsRequired1BoxedBoolean](#multipledependentsrequired1boxedboolean), +[MultipleDependentsRequired1BoxedNumber](#multipledependentsrequired1boxednumber), +[MultipleDependentsRequired1BoxedString](#multipledependentsrequired1boxedstring), +[MultipleDependentsRequired1BoxedList](#multipledependentsrequired1boxedlist), +[MultipleDependentsRequired1BoxedMap](#multipledependentsrequired1boxedmap) + +sealed interface that stores validated payloads using boxed classes + +## MultipleDependentsRequired1BoxedVoid +data class MultipleDependentsRequired1BoxedVoid
    +implements [MultipleDependentsRequired1Boxed](#multipledependentsrequired1boxed) + +data class that stores validated null payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| MultipleDependentsRequired1BoxedVoid(Nothing? data)
    Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| Nothing? | data()
    validated payload | +| Any? | getData()
    validated payload | + +## MultipleDependentsRequired1BoxedBoolean +data class MultipleDependentsRequired1BoxedBoolean
    +implements [MultipleDependentsRequired1Boxed](#multipledependentsrequired1boxed) + +record that stores validated boolean payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| MultipleDependentsRequired1BoxedBoolean(boolean data)
    Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| boolean | data()
    validated payload | +| Any? | getData()
    validated payload | + +## MultipleDependentsRequired1BoxedNumber +data class MultipleDependentsRequired1BoxedNumber
    +implements [MultipleDependentsRequired1Boxed](#multipledependentsrequired1boxed) + +data class that stores validated Number payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| MultipleDependentsRequired1BoxedNumber(Number data)
    Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| Number | data()
    validated payload | +| Any? | getData()
    validated payload | + +## MultipleDependentsRequired1BoxedString +data class MultipleDependentsRequired1BoxedString
    +implements [MultipleDependentsRequired1Boxed](#multipledependentsrequired1boxed) + +data class that stores validated String payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| MultipleDependentsRequired1BoxedString(String data)
    Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| String | data()
    validated payload | +| Any? | getData()
    validated payload | + +## MultipleDependentsRequired1BoxedList +data class MultipleDependentsRequired1BoxedList
    +implements [MultipleDependentsRequired1Boxed](#multipledependentsrequired1boxed) + +data class that stores validated List payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| MultipleDependentsRequired1BoxedList(FrozenList data)
    Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| FrozenList | data()
    validated payload | +| Any? | getData()
    validated payload | + +## MultipleDependentsRequired1BoxedMap +data class MultipleDependentsRequired1BoxedMap
    +implements [MultipleDependentsRequired1Boxed](#multipledependentsrequired1boxed) + +data class that stores validated Map payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| MultipleDependentsRequired1BoxedMap(FrozenMap data)
    Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| FrozenMap | data()
    validated payload | +| Any? | getData()
    validated payload | + +## MultipleDependentsRequired1 +class MultipleDependentsRequired1
    +extends JsonSchema + +A schema class that validates payloads + +### Field Summary +| Modifier and Type | Field and Description | +| ----------------- | ---------------------- | +| Map> | dependentRequired = MapUtils.makeMap(
    +    new AbstractMap.SimpleEntry<>(
    +        "quux",
    +        setOf( +            "foo",
    +            "bar"
    +        ) +    )
    +) + | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| String | validate(arg: String, configuration: SchemaConfiguration) | +| Nothing? | validate(arg: Nothing?, configuration: SchemaConfiguration) | +| int | validate(arg: int, configuration: SchemaConfiguration) | +| long | validate(arg: long, configuration: SchemaConfiguration) | +| float | validate(arg: float, configuration: SchemaConfiguration) | +| double | validate(arg: double, configuration: SchemaConfiguration) | +| Number | validate(arg: Number, configuration: SchemaConfiguration) | +| boolean | validate(arg: boolean, configuration: SchemaConfiguration) | +| FrozenMap | validate(arg: Map<?, ?>, configuration: SchemaConfiguration) | +| FrozenList | validate(arg: List<*>, configuration: SchemaConfiguration) | +| [MultipleDependentsRequired1BoxedString](#multipledependentsrequired1boxedstring) | validateAndBox(String, configuration: SchemaConfiguration) | +| [MultipleDependentsRequired1BoxedVoid](#multipledependentsrequired1boxedvoid) | validateAndBox(Nothing?, configuration: SchemaConfiguration) | +| [MultipleDependentsRequired1BoxedNumber](#multipledependentsrequired1boxednumber) | validateAndBox(Number, configuration: SchemaConfiguration) | +| [MultipleDependentsRequired1BoxedBoolean](#multipledependentsrequired1boxedboolean) | validateAndBox(boolean, configuration: SchemaConfiguration) | +| [MultipleDependentsRequired1BoxedMap](#multipledependentsrequired1boxedmap) | validateAndBox(Map<?, ?>, configuration: SchemaConfiguration) | +| [MultipleDependentsRequired1BoxedList](#multipledependentsrequired1boxedlist) | validateAndBox(List<*>, configuration: SchemaConfiguration) | +| [MultipleDependentsRequired1Boxed](#multipledependentsrequired1boxed) | validateAndBox(Any?, configuration: SchemaConfiguration) | +| Any? | validate(arg: Any?, configuration: SchemaConfiguration) | + +[[Back to top]](#top) [[Back to Component Schemas]](../../../README.md#Component-Schemas) [[Back to README]](../../../README.md) diff --git a/samples/client/3_1_0_unit_test/kotlin/docs/components/schemas/MultipleSimultaneousPatternpropertiesAreValidated.md b/samples/client/3_1_0_unit_test/kotlin/docs/components/schemas/MultipleSimultaneousPatternpropertiesAreValidated.md new file mode 100644 index 00000000000..486e40312e4 --- /dev/null +++ b/samples/client/3_1_0_unit_test/kotlin/docs/components/schemas/MultipleSimultaneousPatternpropertiesAreValidated.md @@ -0,0 +1,362 @@ +# MultipleSimultaneousPatternpropertiesAreValidated +org.openapijsonschematools.client.components.schemas.MultipleSimultaneousPatternpropertiesAreValidated.java +class MultipleSimultaneousPatternpropertiesAreValidated
    + +A class that contains necessary nested +- schema classes (which validate payloads), extends JsonSchema +- sealed interfaces which store validated payloads, Kotlin version of a sum type +- boxed classes which store validated payloads, sealed permits class implementations + +## Nested Class Summary +| Modifier and Type | Class and Description | +| ----------------- | ---------------------- | +| sealed interface | [MultipleSimultaneousPatternpropertiesAreValidated.MultipleSimultaneousPatternpropertiesAreValidated1Boxed](#multiplesimultaneouspatternpropertiesarevalidated1boxed)
    sealed interface for validated payloads | +| record | [MultipleSimultaneousPatternpropertiesAreValidated.MultipleSimultaneousPatternpropertiesAreValidated1BoxedVoid](#multiplesimultaneouspatternpropertiesarevalidated1boxedvoid)
    boxed class to store validated null payloads | +| record | [MultipleSimultaneousPatternpropertiesAreValidated.MultipleSimultaneousPatternpropertiesAreValidated1BoxedBoolean](#multiplesimultaneouspatternpropertiesarevalidated1boxedboolean)
    boxed class to store validated boolean payloads | +| record | [MultipleSimultaneousPatternpropertiesAreValidated.MultipleSimultaneousPatternpropertiesAreValidated1BoxedNumber](#multiplesimultaneouspatternpropertiesarevalidated1boxednumber)
    boxed class to store validated Number payloads | +| record | [MultipleSimultaneousPatternpropertiesAreValidated.MultipleSimultaneousPatternpropertiesAreValidated1BoxedString](#multiplesimultaneouspatternpropertiesarevalidated1boxedstring)
    boxed class to store validated String payloads | +| record | [MultipleSimultaneousPatternpropertiesAreValidated.MultipleSimultaneousPatternpropertiesAreValidated1BoxedList](#multiplesimultaneouspatternpropertiesarevalidated1boxedlist)
    boxed class to store validated List payloads | +| record | [MultipleSimultaneousPatternpropertiesAreValidated.MultipleSimultaneousPatternpropertiesAreValidated1BoxedMap](#multiplesimultaneouspatternpropertiesarevalidated1boxedmap)
    boxed class to store validated Map payloads | +| static class | [MultipleSimultaneousPatternpropertiesAreValidated.MultipleSimultaneousPatternpropertiesAreValidated1](#multiplesimultaneouspatternpropertiesarevalidated1)
    schema class | +| sealed interface | [MultipleSimultaneousPatternpropertiesAreValidated.AaaBoxed](#aaaboxed)
    sealed interface for validated payloads | +| record | [MultipleSimultaneousPatternpropertiesAreValidated.AaaBoxedVoid](#aaaboxedvoid)
    boxed class to store validated null payloads | +| record | [MultipleSimultaneousPatternpropertiesAreValidated.AaaBoxedBoolean](#aaaboxedboolean)
    boxed class to store validated boolean payloads | +| record | [MultipleSimultaneousPatternpropertiesAreValidated.AaaBoxedNumber](#aaaboxednumber)
    boxed class to store validated Number payloads | +| record | [MultipleSimultaneousPatternpropertiesAreValidated.AaaBoxedString](#aaaboxedstring)
    boxed class to store validated String payloads | +| record | [MultipleSimultaneousPatternpropertiesAreValidated.AaaBoxedList](#aaaboxedlist)
    boxed class to store validated List payloads | +| record | [MultipleSimultaneousPatternpropertiesAreValidated.AaaBoxedMap](#aaaboxedmap)
    boxed class to store validated Map payloads | +| static class | [MultipleSimultaneousPatternpropertiesAreValidated.Aaa](#aaa)
    schema class | +| sealed interface | [MultipleSimultaneousPatternpropertiesAreValidated.ABoxed](#aboxed)
    sealed interface for validated payloads | +| record | [MultipleSimultaneousPatternpropertiesAreValidated.ABoxedNumber](#aboxednumber)
    boxed class to store validated Number payloads | +| static class | [MultipleSimultaneousPatternpropertiesAreValidated.A](#a)
    schema class | + +## MultipleSimultaneousPatternpropertiesAreValidated1Boxed +sealed interface MultipleSimultaneousPatternpropertiesAreValidated1Boxed
    +permits
    +[MultipleSimultaneousPatternpropertiesAreValidated1BoxedVoid](#multiplesimultaneouspatternpropertiesarevalidated1boxedvoid), +[MultipleSimultaneousPatternpropertiesAreValidated1BoxedBoolean](#multiplesimultaneouspatternpropertiesarevalidated1boxedboolean), +[MultipleSimultaneousPatternpropertiesAreValidated1BoxedNumber](#multiplesimultaneouspatternpropertiesarevalidated1boxednumber), +[MultipleSimultaneousPatternpropertiesAreValidated1BoxedString](#multiplesimultaneouspatternpropertiesarevalidated1boxedstring), +[MultipleSimultaneousPatternpropertiesAreValidated1BoxedList](#multiplesimultaneouspatternpropertiesarevalidated1boxedlist), +[MultipleSimultaneousPatternpropertiesAreValidated1BoxedMap](#multiplesimultaneouspatternpropertiesarevalidated1boxedmap) + +sealed interface that stores validated payloads using boxed classes + +## MultipleSimultaneousPatternpropertiesAreValidated1BoxedVoid +data class MultipleSimultaneousPatternpropertiesAreValidated1BoxedVoid
    +implements [MultipleSimultaneousPatternpropertiesAreValidated1Boxed](#multiplesimultaneouspatternpropertiesarevalidated1boxed) + +data class that stores validated null payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| MultipleSimultaneousPatternpropertiesAreValidated1BoxedVoid(Nothing? data)
    Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| Nothing? | data()
    validated payload | +| Any? | getData()
    validated payload | + +## MultipleSimultaneousPatternpropertiesAreValidated1BoxedBoolean +data class MultipleSimultaneousPatternpropertiesAreValidated1BoxedBoolean
    +implements [MultipleSimultaneousPatternpropertiesAreValidated1Boxed](#multiplesimultaneouspatternpropertiesarevalidated1boxed) + +record that stores validated boolean payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| MultipleSimultaneousPatternpropertiesAreValidated1BoxedBoolean(boolean data)
    Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| boolean | data()
    validated payload | +| Any? | getData()
    validated payload | + +## MultipleSimultaneousPatternpropertiesAreValidated1BoxedNumber +data class MultipleSimultaneousPatternpropertiesAreValidated1BoxedNumber
    +implements [MultipleSimultaneousPatternpropertiesAreValidated1Boxed](#multiplesimultaneouspatternpropertiesarevalidated1boxed) + +data class that stores validated Number payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| MultipleSimultaneousPatternpropertiesAreValidated1BoxedNumber(Number data)
    Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| Number | data()
    validated payload | +| Any? | getData()
    validated payload | + +## MultipleSimultaneousPatternpropertiesAreValidated1BoxedString +data class MultipleSimultaneousPatternpropertiesAreValidated1BoxedString
    +implements [MultipleSimultaneousPatternpropertiesAreValidated1Boxed](#multiplesimultaneouspatternpropertiesarevalidated1boxed) + +data class that stores validated String payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| MultipleSimultaneousPatternpropertiesAreValidated1BoxedString(String data)
    Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| String | data()
    validated payload | +| Any? | getData()
    validated payload | + +## MultipleSimultaneousPatternpropertiesAreValidated1BoxedList +data class MultipleSimultaneousPatternpropertiesAreValidated1BoxedList
    +implements [MultipleSimultaneousPatternpropertiesAreValidated1Boxed](#multiplesimultaneouspatternpropertiesarevalidated1boxed) + +data class that stores validated List payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| MultipleSimultaneousPatternpropertiesAreValidated1BoxedList(FrozenList data)
    Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| FrozenList | data()
    validated payload | +| Any? | getData()
    validated payload | + +## MultipleSimultaneousPatternpropertiesAreValidated1BoxedMap +data class MultipleSimultaneousPatternpropertiesAreValidated1BoxedMap
    +implements [MultipleSimultaneousPatternpropertiesAreValidated1Boxed](#multiplesimultaneouspatternpropertiesarevalidated1boxed) + +data class that stores validated Map payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| MultipleSimultaneousPatternpropertiesAreValidated1BoxedMap(FrozenMap data)
    Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| FrozenMap | data()
    validated payload | +| Any? | getData()
    validated payload | + +## MultipleSimultaneousPatternpropertiesAreValidated1 +class MultipleSimultaneousPatternpropertiesAreValidated1
    +extends JsonSchema + +A schema class that validates payloads + +### Field Summary +| Modifier and Type | Field and Description | +| ----------------- | ---------------------- | +| Map> | patternProperties = mapOf(
        new AbstractMap.SimpleEntry<>(Pattern.compile("a*"), [A::class.java](#a))),
        new AbstractMap.SimpleEntry<>(Pattern.compile("aaa*"), [Aaa::class.java](#aaa)))
    )
    | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| String | validate(arg: String, configuration: SchemaConfiguration) | +| Nothing? | validate(arg: Nothing?, configuration: SchemaConfiguration) | +| int | validate(arg: int, configuration: SchemaConfiguration) | +| long | validate(arg: long, configuration: SchemaConfiguration) | +| float | validate(arg: float, configuration: SchemaConfiguration) | +| double | validate(arg: double, configuration: SchemaConfiguration) | +| Number | validate(arg: Number, configuration: SchemaConfiguration) | +| boolean | validate(arg: boolean, configuration: SchemaConfiguration) | +| FrozenMap | validate(arg: Map<?, ?>, configuration: SchemaConfiguration) | +| FrozenList | validate(arg: List<*>, configuration: SchemaConfiguration) | +| [MultipleSimultaneousPatternpropertiesAreValidated1BoxedString](#multiplesimultaneouspatternpropertiesarevalidated1boxedstring) | validateAndBox(String, configuration: SchemaConfiguration) | +| [MultipleSimultaneousPatternpropertiesAreValidated1BoxedVoid](#multiplesimultaneouspatternpropertiesarevalidated1boxedvoid) | validateAndBox(Nothing?, configuration: SchemaConfiguration) | +| [MultipleSimultaneousPatternpropertiesAreValidated1BoxedNumber](#multiplesimultaneouspatternpropertiesarevalidated1boxednumber) | validateAndBox(Number, configuration: SchemaConfiguration) | +| [MultipleSimultaneousPatternpropertiesAreValidated1BoxedBoolean](#multiplesimultaneouspatternpropertiesarevalidated1boxedboolean) | validateAndBox(boolean, configuration: SchemaConfiguration) | +| [MultipleSimultaneousPatternpropertiesAreValidated1BoxedMap](#multiplesimultaneouspatternpropertiesarevalidated1boxedmap) | validateAndBox(Map<?, ?>, configuration: SchemaConfiguration) | +| [MultipleSimultaneousPatternpropertiesAreValidated1BoxedList](#multiplesimultaneouspatternpropertiesarevalidated1boxedlist) | validateAndBox(List<*>, configuration: SchemaConfiguration) | +| [MultipleSimultaneousPatternpropertiesAreValidated1Boxed](#multiplesimultaneouspatternpropertiesarevalidated1boxed) | validateAndBox(Any?, configuration: SchemaConfiguration) | +| Any? | validate(arg: Any?, configuration: SchemaConfiguration) | + +## AaaBoxed +sealed interface AaaBoxed
    +permits
    +[AaaBoxedVoid](#aaaboxedvoid), +[AaaBoxedBoolean](#aaaboxedboolean), +[AaaBoxedNumber](#aaaboxednumber), +[AaaBoxedString](#aaaboxedstring), +[AaaBoxedList](#aaaboxedlist), +[AaaBoxedMap](#aaaboxedmap) + +sealed interface that stores validated payloads using boxed classes + +## AaaBoxedVoid +data class AaaBoxedVoid
    +implements [AaaBoxed](#aaaboxed) + +data class that stores validated null payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| AaaBoxedVoid(Nothing? data)
    Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| Nothing? | data()
    validated payload | +| Any? | getData()
    validated payload | + +## AaaBoxedBoolean +data class AaaBoxedBoolean
    +implements [AaaBoxed](#aaaboxed) + +record that stores validated boolean payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| AaaBoxedBoolean(boolean data)
    Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| boolean | data()
    validated payload | +| Any? | getData()
    validated payload | + +## AaaBoxedNumber +data class AaaBoxedNumber
    +implements [AaaBoxed](#aaaboxed) + +data class that stores validated Number payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| AaaBoxedNumber(Number data)
    Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| Number | data()
    validated payload | +| Any? | getData()
    validated payload | + +## AaaBoxedString +data class AaaBoxedString
    +implements [AaaBoxed](#aaaboxed) + +data class that stores validated String payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| AaaBoxedString(String data)
    Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| String | data()
    validated payload | +| Any? | getData()
    validated payload | + +## AaaBoxedList +data class AaaBoxedList
    +implements [AaaBoxed](#aaaboxed) + +data class that stores validated List payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| AaaBoxedList(FrozenList data)
    Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| FrozenList | data()
    validated payload | +| Any? | getData()
    validated payload | + +## AaaBoxedMap +data class AaaBoxedMap
    +implements [AaaBoxed](#aaaboxed) + +data class that stores validated Map payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| AaaBoxedMap(FrozenMap data)
    Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| FrozenMap | data()
    validated payload | +| Any? | getData()
    validated payload | + +## Aaa +class Aaa
    +extends JsonSchema + +A schema class that validates payloads + +### Field Summary +| Modifier and Type | Field and Description | +| ----------------- | ---------------------- | +| Number | maximum = 20 | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| String | validate(arg: String, configuration: SchemaConfiguration) | +| Nothing? | validate(arg: Nothing?, configuration: SchemaConfiguration) | +| int | validate(arg: int, configuration: SchemaConfiguration) | +| long | validate(arg: long, configuration: SchemaConfiguration) | +| float | validate(arg: float, configuration: SchemaConfiguration) | +| double | validate(arg: double, configuration: SchemaConfiguration) | +| Number | validate(arg: Number, configuration: SchemaConfiguration) | +| boolean | validate(arg: boolean, configuration: SchemaConfiguration) | +| FrozenMap | validate(arg: Map<?, ?>, configuration: SchemaConfiguration) | +| FrozenList | validate(arg: List<*>, configuration: SchemaConfiguration) | +| [AaaBoxedString](#aaaboxedstring) | validateAndBox(String, configuration: SchemaConfiguration) | +| [AaaBoxedVoid](#aaaboxedvoid) | validateAndBox(Nothing?, configuration: SchemaConfiguration) | +| [AaaBoxedNumber](#aaaboxednumber) | validateAndBox(Number, configuration: SchemaConfiguration) | +| [AaaBoxedBoolean](#aaaboxedboolean) | validateAndBox(boolean, configuration: SchemaConfiguration) | +| [AaaBoxedMap](#aaaboxedmap) | validateAndBox(Map<?, ?>, configuration: SchemaConfiguration) | +| [AaaBoxedList](#aaaboxedlist) | validateAndBox(List<*>, configuration: SchemaConfiguration) | +| [AaaBoxed](#aaaboxed) | validateAndBox(Any?, configuration: SchemaConfiguration) | +| Any? | validate(arg: Any?, configuration: SchemaConfiguration) | + +## ABoxed +sealed interface ABoxed
    +permits
    +[ABoxedNumber](#aboxednumber) + +sealed interface that stores validated payloads using boxed classes + +## ABoxedNumber +data class ABoxedNumber
    +implements [ABoxed](#aboxed) + +data class that stores validated Number payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| ABoxedNumber(Number data)
    Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| Number | data()
    validated payload | +| Any? | getData()
    validated payload | + +## A +class A
    +extends IntJsonSchema.IntJsonSchema1 + +A schema class that validates payloads + +| Methods Inherited from class org.openapijsonschematools.client.schemas.IntJsonSchema.IntJsonSchema1 | +| ------------------------------------------------------------------ | +| validate | +| validateAndBox | + +[[Back to top]](#top) [[Back to Component Schemas]](../../../README.md#Component-Schemas) [[Back to README]](../../../README.md) diff --git a/samples/client/3_1_0_unit_test/kotlin/docs/components/schemas/MultipleTypesCanBeSpecifiedInAnArray.md b/samples/client/3_1_0_unit_test/kotlin/docs/components/schemas/MultipleTypesCanBeSpecifiedInAnArray.md new file mode 100644 index 00000000000..7b35e51a0c9 --- /dev/null +++ b/samples/client/3_1_0_unit_test/kotlin/docs/components/schemas/MultipleTypesCanBeSpecifiedInAnArray.md @@ -0,0 +1,111 @@ +# MultipleTypesCanBeSpecifiedInAnArray +org.openapijsonschematools.client.components.schemas.MultipleTypesCanBeSpecifiedInAnArray.java +class MultipleTypesCanBeSpecifiedInAnArray
    + +A class that contains necessary nested +- schema classes (which validate payloads), extends JsonSchema +- sealed interfaces which store validated payloads, Kotlin version of a sum type +- boxed classes which store validated payloads, sealed permits class implementations + +## Nested Class Summary +| Modifier and Type | Class and Description | +| ----------------- | ---------------------- | +| sealed interface | [MultipleTypesCanBeSpecifiedInAnArray.MultipleTypesCanBeSpecifiedInAnArray1Boxed](#multipletypescanbespecifiedinanarray1boxed)
    sealed interface for validated payloads | +| record | [MultipleTypesCanBeSpecifiedInAnArray.MultipleTypesCanBeSpecifiedInAnArray1BoxedNumber](#multipletypescanbespecifiedinanarray1boxednumber)
    boxed class to store validated Number payloads | +| record | [MultipleTypesCanBeSpecifiedInAnArray.MultipleTypesCanBeSpecifiedInAnArray1BoxedString](#multipletypescanbespecifiedinanarray1boxedstring)
    boxed class to store validated String payloads | +| static class | [MultipleTypesCanBeSpecifiedInAnArray.MultipleTypesCanBeSpecifiedInAnArray1](#multipletypescanbespecifiedinanarray1)
    schema class | + +## MultipleTypesCanBeSpecifiedInAnArray1Boxed +sealed interface MultipleTypesCanBeSpecifiedInAnArray1Boxed
    +permits
    +[MultipleTypesCanBeSpecifiedInAnArray1BoxedNumber](#multipletypescanbespecifiedinanarray1boxednumber), +[MultipleTypesCanBeSpecifiedInAnArray1BoxedString](#multipletypescanbespecifiedinanarray1boxedstring) + +sealed interface that stores validated payloads using boxed classes + +## MultipleTypesCanBeSpecifiedInAnArray1BoxedNumber +data class MultipleTypesCanBeSpecifiedInAnArray1BoxedNumber
    +implements [MultipleTypesCanBeSpecifiedInAnArray1Boxed](#multipletypescanbespecifiedinanarray1boxed) + +data class that stores validated Number payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| MultipleTypesCanBeSpecifiedInAnArray1BoxedNumber(Number data)
    Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| Number | data()
    validated payload | +| Any? | getData()
    validated payload | + +## MultipleTypesCanBeSpecifiedInAnArray1BoxedString +data class MultipleTypesCanBeSpecifiedInAnArray1BoxedString
    +implements [MultipleTypesCanBeSpecifiedInAnArray1Boxed](#multipletypescanbespecifiedinanarray1boxed) + +data class that stores validated String payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| MultipleTypesCanBeSpecifiedInAnArray1BoxedString(String data)
    Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| String | data()
    validated payload | +| Any? | getData()
    validated payload | + +## MultipleTypesCanBeSpecifiedInAnArray1 +class MultipleTypesCanBeSpecifiedInAnArray1
    +extends JsonSchema + +A schema class that validates payloads + +### Code Sample +``` +import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags; +import org.openapijsonschematools.client.configurations.SchemaConfiguration; +import org.openapijsonschematools.client.exceptions.ValidationException; +import org.openapijsonschematools.client.schemas.validation.MapUtils; +import org.openapijsonschematools.client.schemas.validation.FrozenList; +import org.openapijsonschematools.client.schemas.validation.FrozenMap; +import org.openapijsonschematools.client.components.schemas.MultipleTypesCanBeSpecifiedInAnArray; + +import java.util.Arrays; +import java.util.List; +import java.util.AbstractMap; + +static final SchemaConfiguration configuration = new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().build()); + +// int validation +int validatedPayload = MultipleTypesCanBeSpecifiedInAnArray.MultipleTypesCanBeSpecifiedInAnArray1.validate( + 1L, + configuration +); + +// String validation +String validatedPayload = MultipleTypesCanBeSpecifiedInAnArray.MultipleTypesCanBeSpecifiedInAnArray1.validate( + "a", + configuration +); +``` + +### Field Summary +| Modifier and Type | Field and Description | +| ----------------- | ---------------------- | +| Set> | type = setOf(
        Int::class.java,
        Long::class.java,
        Float::class.java,
        Double::class.java,
        String::class.java
    )
    | +| String | type = "int"; | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| long | validate(arg: long, configuration: SchemaConfiguration) | +| [MultipleTypesCanBeSpecifiedInAnArray1BoxedNumber](#multipletypescanbespecifiedinanarray1boxednumber) | validateAndBox(Number, configuration: SchemaConfiguration) | +| String | validate(arg: String, configuration: SchemaConfiguration) | +| [MultipleTypesCanBeSpecifiedInAnArray1BoxedString](#multipletypescanbespecifiedinanarray1boxedstring) | validateAndBox(String, configuration: SchemaConfiguration) | +| [MultipleTypesCanBeSpecifiedInAnArray1Boxed](#multipletypescanbespecifiedinanarray1boxed) | validateAndBox(Any?, configuration: SchemaConfiguration) | +| Any? | validate(arg: Any?, configuration: SchemaConfiguration) | + +[[Back to top]](#top) [[Back to Component Schemas]](../../../README.md#Component-Schemas) [[Back to README]](../../../README.md) diff --git a/samples/client/3_1_0_unit_test/kotlin/docs/components/schemas/NestedAllofToCheckValidationSemantics.md b/samples/client/3_1_0_unit_test/kotlin/docs/components/schemas/NestedAllofToCheckValidationSemantics.md new file mode 100644 index 00000000000..708628006e4 --- /dev/null +++ b/samples/client/3_1_0_unit_test/kotlin/docs/components/schemas/NestedAllofToCheckValidationSemantics.md @@ -0,0 +1,362 @@ +# NestedAllofToCheckValidationSemantics +org.openapijsonschematools.client.components.schemas.NestedAllofToCheckValidationSemantics.java +class NestedAllofToCheckValidationSemantics
    + +A class that contains necessary nested +- schema classes (which validate payloads), extends JsonSchema +- sealed interfaces which store validated payloads, Kotlin version of a sum type +- boxed classes which store validated payloads, sealed permits class implementations + +## Nested Class Summary +| Modifier and Type | Class and Description | +| ----------------- | ---------------------- | +| sealed interface | [NestedAllofToCheckValidationSemantics.NestedAllofToCheckValidationSemantics1Boxed](#nestedalloftocheckvalidationsemantics1boxed)
    sealed interface for validated payloads | +| record | [NestedAllofToCheckValidationSemantics.NestedAllofToCheckValidationSemantics1BoxedVoid](#nestedalloftocheckvalidationsemantics1boxedvoid)
    boxed class to store validated null payloads | +| record | [NestedAllofToCheckValidationSemantics.NestedAllofToCheckValidationSemantics1BoxedBoolean](#nestedalloftocheckvalidationsemantics1boxedboolean)
    boxed class to store validated boolean payloads | +| record | [NestedAllofToCheckValidationSemantics.NestedAllofToCheckValidationSemantics1BoxedNumber](#nestedalloftocheckvalidationsemantics1boxednumber)
    boxed class to store validated Number payloads | +| record | [NestedAllofToCheckValidationSemantics.NestedAllofToCheckValidationSemantics1BoxedString](#nestedalloftocheckvalidationsemantics1boxedstring)
    boxed class to store validated String payloads | +| record | [NestedAllofToCheckValidationSemantics.NestedAllofToCheckValidationSemantics1BoxedList](#nestedalloftocheckvalidationsemantics1boxedlist)
    boxed class to store validated List payloads | +| record | [NestedAllofToCheckValidationSemantics.NestedAllofToCheckValidationSemantics1BoxedMap](#nestedalloftocheckvalidationsemantics1boxedmap)
    boxed class to store validated Map payloads | +| static class | [NestedAllofToCheckValidationSemantics.NestedAllofToCheckValidationSemantics1](#nestedalloftocheckvalidationsemantics1)
    schema class | +| sealed interface | [NestedAllofToCheckValidationSemantics.Schema0Boxed](#schema0boxed)
    sealed interface for validated payloads | +| record | [NestedAllofToCheckValidationSemantics.Schema0BoxedVoid](#schema0boxedvoid)
    boxed class to store validated null payloads | +| record | [NestedAllofToCheckValidationSemantics.Schema0BoxedBoolean](#schema0boxedboolean)
    boxed class to store validated boolean payloads | +| record | [NestedAllofToCheckValidationSemantics.Schema0BoxedNumber](#schema0boxednumber)
    boxed class to store validated Number payloads | +| record | [NestedAllofToCheckValidationSemantics.Schema0BoxedString](#schema0boxedstring)
    boxed class to store validated String payloads | +| record | [NestedAllofToCheckValidationSemantics.Schema0BoxedList](#schema0boxedlist)
    boxed class to store validated List payloads | +| record | [NestedAllofToCheckValidationSemantics.Schema0BoxedMap](#schema0boxedmap)
    boxed class to store validated Map payloads | +| static class | [NestedAllofToCheckValidationSemantics.Schema0](#schema0)
    schema class | +| sealed interface | [NestedAllofToCheckValidationSemantics.Schema01Boxed](#schema01boxed)
    sealed interface for validated payloads | +| record | [NestedAllofToCheckValidationSemantics.Schema01BoxedVoid](#schema01boxedvoid)
    boxed class to store validated null payloads | +| static class | [NestedAllofToCheckValidationSemantics.Schema01](#schema01)
    schema class | + +## NestedAllofToCheckValidationSemantics1Boxed +sealed interface NestedAllofToCheckValidationSemantics1Boxed
    +permits
    +[NestedAllofToCheckValidationSemantics1BoxedVoid](#nestedalloftocheckvalidationsemantics1boxedvoid), +[NestedAllofToCheckValidationSemantics1BoxedBoolean](#nestedalloftocheckvalidationsemantics1boxedboolean), +[NestedAllofToCheckValidationSemantics1BoxedNumber](#nestedalloftocheckvalidationsemantics1boxednumber), +[NestedAllofToCheckValidationSemantics1BoxedString](#nestedalloftocheckvalidationsemantics1boxedstring), +[NestedAllofToCheckValidationSemantics1BoxedList](#nestedalloftocheckvalidationsemantics1boxedlist), +[NestedAllofToCheckValidationSemantics1BoxedMap](#nestedalloftocheckvalidationsemantics1boxedmap) + +sealed interface that stores validated payloads using boxed classes + +## NestedAllofToCheckValidationSemantics1BoxedVoid +data class NestedAllofToCheckValidationSemantics1BoxedVoid
    +implements [NestedAllofToCheckValidationSemantics1Boxed](#nestedalloftocheckvalidationsemantics1boxed) + +data class that stores validated null payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| NestedAllofToCheckValidationSemantics1BoxedVoid(Nothing? data)
    Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| Nothing? | data()
    validated payload | +| Any? | getData()
    validated payload | + +## NestedAllofToCheckValidationSemantics1BoxedBoolean +data class NestedAllofToCheckValidationSemantics1BoxedBoolean
    +implements [NestedAllofToCheckValidationSemantics1Boxed](#nestedalloftocheckvalidationsemantics1boxed) + +record that stores validated boolean payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| NestedAllofToCheckValidationSemantics1BoxedBoolean(boolean data)
    Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| boolean | data()
    validated payload | +| Any? | getData()
    validated payload | + +## NestedAllofToCheckValidationSemantics1BoxedNumber +data class NestedAllofToCheckValidationSemantics1BoxedNumber
    +implements [NestedAllofToCheckValidationSemantics1Boxed](#nestedalloftocheckvalidationsemantics1boxed) + +data class that stores validated Number payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| NestedAllofToCheckValidationSemantics1BoxedNumber(Number data)
    Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| Number | data()
    validated payload | +| Any? | getData()
    validated payload | + +## NestedAllofToCheckValidationSemantics1BoxedString +data class NestedAllofToCheckValidationSemantics1BoxedString
    +implements [NestedAllofToCheckValidationSemantics1Boxed](#nestedalloftocheckvalidationsemantics1boxed) + +data class that stores validated String payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| NestedAllofToCheckValidationSemantics1BoxedString(String data)
    Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| String | data()
    validated payload | +| Any? | getData()
    validated payload | + +## NestedAllofToCheckValidationSemantics1BoxedList +data class NestedAllofToCheckValidationSemantics1BoxedList
    +implements [NestedAllofToCheckValidationSemantics1Boxed](#nestedalloftocheckvalidationsemantics1boxed) + +data class that stores validated List payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| NestedAllofToCheckValidationSemantics1BoxedList(FrozenList data)
    Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| FrozenList | data()
    validated payload | +| Any? | getData()
    validated payload | + +## NestedAllofToCheckValidationSemantics1BoxedMap +data class NestedAllofToCheckValidationSemantics1BoxedMap
    +implements [NestedAllofToCheckValidationSemantics1Boxed](#nestedalloftocheckvalidationsemantics1boxed) + +data class that stores validated Map payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| NestedAllofToCheckValidationSemantics1BoxedMap(FrozenMap data)
    Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| FrozenMap | data()
    validated payload | +| Any? | getData()
    validated payload | + +## NestedAllofToCheckValidationSemantics1 +class NestedAllofToCheckValidationSemantics1
    +extends JsonSchema + +A schema class that validates payloads + +### Field Summary +| Modifier and Type | Field and Description | +| ----------------- | ---------------------- | +| List> | allOf = listOf(
        [Schema0::class.java](#schema0)
    ;)
    | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| String | validate(arg: String, configuration: SchemaConfiguration) | +| Nothing? | validate(arg: Nothing?, configuration: SchemaConfiguration) | +| int | validate(arg: int, configuration: SchemaConfiguration) | +| long | validate(arg: long, configuration: SchemaConfiguration) | +| float | validate(arg: float, configuration: SchemaConfiguration) | +| double | validate(arg: double, configuration: SchemaConfiguration) | +| Number | validate(arg: Number, configuration: SchemaConfiguration) | +| boolean | validate(arg: boolean, configuration: SchemaConfiguration) | +| FrozenMap | validate(arg: Map<?, ?>, configuration: SchemaConfiguration) | +| FrozenList | validate(arg: List<*>, configuration: SchemaConfiguration) | +| [NestedAllofToCheckValidationSemantics1BoxedString](#nestedalloftocheckvalidationsemantics1boxedstring) | validateAndBox(String, configuration: SchemaConfiguration) | +| [NestedAllofToCheckValidationSemantics1BoxedVoid](#nestedalloftocheckvalidationsemantics1boxedvoid) | validateAndBox(Nothing?, configuration: SchemaConfiguration) | +| [NestedAllofToCheckValidationSemantics1BoxedNumber](#nestedalloftocheckvalidationsemantics1boxednumber) | validateAndBox(Number, configuration: SchemaConfiguration) | +| [NestedAllofToCheckValidationSemantics1BoxedBoolean](#nestedalloftocheckvalidationsemantics1boxedboolean) | validateAndBox(boolean, configuration: SchemaConfiguration) | +| [NestedAllofToCheckValidationSemantics1BoxedMap](#nestedalloftocheckvalidationsemantics1boxedmap) | validateAndBox(Map<?, ?>, configuration: SchemaConfiguration) | +| [NestedAllofToCheckValidationSemantics1BoxedList](#nestedalloftocheckvalidationsemantics1boxedlist) | validateAndBox(List<*>, configuration: SchemaConfiguration) | +| [NestedAllofToCheckValidationSemantics1Boxed](#nestedalloftocheckvalidationsemantics1boxed) | validateAndBox(Any?, configuration: SchemaConfiguration) | +| Any? | validate(arg: Any?, configuration: SchemaConfiguration) | + +## Schema0Boxed +sealed interface Schema0Boxed
    +permits
    +[Schema0BoxedVoid](#schema0boxedvoid), +[Schema0BoxedBoolean](#schema0boxedboolean), +[Schema0BoxedNumber](#schema0boxednumber), +[Schema0BoxedString](#schema0boxedstring), +[Schema0BoxedList](#schema0boxedlist), +[Schema0BoxedMap](#schema0boxedmap) + +sealed interface that stores validated payloads using boxed classes + +## Schema0BoxedVoid +data class Schema0BoxedVoid
    +implements [Schema0Boxed](#schema0boxed) + +data class that stores validated null payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| Schema0BoxedVoid(Nothing? data)
    Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| Nothing? | data()
    validated payload | +| Any? | getData()
    validated payload | + +## Schema0BoxedBoolean +data class Schema0BoxedBoolean
    +implements [Schema0Boxed](#schema0boxed) + +record that stores validated boolean payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| Schema0BoxedBoolean(boolean data)
    Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| boolean | data()
    validated payload | +| Any? | getData()
    validated payload | + +## Schema0BoxedNumber +data class Schema0BoxedNumber
    +implements [Schema0Boxed](#schema0boxed) + +data class that stores validated Number payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| Schema0BoxedNumber(Number data)
    Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| Number | data()
    validated payload | +| Any? | getData()
    validated payload | + +## Schema0BoxedString +data class Schema0BoxedString
    +implements [Schema0Boxed](#schema0boxed) + +data class that stores validated String payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| Schema0BoxedString(String data)
    Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| String | data()
    validated payload | +| Any? | getData()
    validated payload | + +## Schema0BoxedList +data class Schema0BoxedList
    +implements [Schema0Boxed](#schema0boxed) + +data class that stores validated List payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| Schema0BoxedList(FrozenList data)
    Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| FrozenList | data()
    validated payload | +| Any? | getData()
    validated payload | + +## Schema0BoxedMap +data class Schema0BoxedMap
    +implements [Schema0Boxed](#schema0boxed) + +data class that stores validated Map payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| Schema0BoxedMap(FrozenMap data)
    Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| FrozenMap | data()
    validated payload | +| Any? | getData()
    validated payload | + +## Schema0 +class Schema0
    +extends JsonSchema + +A schema class that validates payloads + +### Field Summary +| Modifier and Type | Field and Description | +| ----------------- | ---------------------- | +| List> | allOf = listOf(
        [Schema01::class.java](#schema01)
    ;)
    | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| String | validate(arg: String, configuration: SchemaConfiguration) | +| Nothing? | validate(arg: Nothing?, configuration: SchemaConfiguration) | +| int | validate(arg: int, configuration: SchemaConfiguration) | +| long | validate(arg: long, configuration: SchemaConfiguration) | +| float | validate(arg: float, configuration: SchemaConfiguration) | +| double | validate(arg: double, configuration: SchemaConfiguration) | +| Number | validate(arg: Number, configuration: SchemaConfiguration) | +| boolean | validate(arg: boolean, configuration: SchemaConfiguration) | +| FrozenMap | validate(arg: Map<?, ?>, configuration: SchemaConfiguration) | +| FrozenList | validate(arg: List<*>, configuration: SchemaConfiguration) | +| [Schema0BoxedString](#schema0boxedstring) | validateAndBox(String, configuration: SchemaConfiguration) | +| [Schema0BoxedVoid](#schema0boxedvoid) | validateAndBox(Nothing?, configuration: SchemaConfiguration) | +| [Schema0BoxedNumber](#schema0boxednumber) | validateAndBox(Number, configuration: SchemaConfiguration) | +| [Schema0BoxedBoolean](#schema0boxedboolean) | validateAndBox(boolean, configuration: SchemaConfiguration) | +| [Schema0BoxedMap](#schema0boxedmap) | validateAndBox(Map<?, ?>, configuration: SchemaConfiguration) | +| [Schema0BoxedList](#schema0boxedlist) | validateAndBox(List<*>, configuration: SchemaConfiguration) | +| [Schema0Boxed](#schema0boxed) | validateAndBox(Any?, configuration: SchemaConfiguration) | +| Any? | validate(arg: Any?, configuration: SchemaConfiguration) | + +## Schema01Boxed +sealed interface Schema01Boxed
    +permits
    +[Schema01BoxedVoid](#schema01boxedvoid) + +sealed interface that stores validated payloads using boxed classes + +## Schema01BoxedVoid +data class Schema01BoxedVoid
    +implements [Schema01Boxed](#schema01boxed) + +data class that stores validated null payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| Schema01BoxedVoid(Nothing? data)
    Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| Nothing? | data()
    validated payload | +| Any? | getData()
    validated payload | + +## Schema01 +class Schema01
    +extends NullJsonSchema.NullJsonSchema1 + +A schema class that validates payloads + +| Methods Inherited from class org.openapijsonschematools.client.schemas.NullJsonSchema.NullJsonSchema1 | +| ------------------------------------------------------------------ | +| validate | +| validateAndBox | + +[[Back to top]](#top) [[Back to Component Schemas]](../../../README.md#Component-Schemas) [[Back to README]](../../../README.md) diff --git a/samples/client/3_1_0_unit_test/kotlin/docs/components/schemas/NestedAnyofToCheckValidationSemantics.md b/samples/client/3_1_0_unit_test/kotlin/docs/components/schemas/NestedAnyofToCheckValidationSemantics.md new file mode 100644 index 00000000000..d145f8fdf0a --- /dev/null +++ b/samples/client/3_1_0_unit_test/kotlin/docs/components/schemas/NestedAnyofToCheckValidationSemantics.md @@ -0,0 +1,362 @@ +# NestedAnyofToCheckValidationSemantics +org.openapijsonschematools.client.components.schemas.NestedAnyofToCheckValidationSemantics.java +class NestedAnyofToCheckValidationSemantics
    + +A class that contains necessary nested +- schema classes (which validate payloads), extends JsonSchema +- sealed interfaces which store validated payloads, Kotlin version of a sum type +- boxed classes which store validated payloads, sealed permits class implementations + +## Nested Class Summary +| Modifier and Type | Class and Description | +| ----------------- | ---------------------- | +| sealed interface | [NestedAnyofToCheckValidationSemantics.NestedAnyofToCheckValidationSemantics1Boxed](#nestedanyoftocheckvalidationsemantics1boxed)
    sealed interface for validated payloads | +| record | [NestedAnyofToCheckValidationSemantics.NestedAnyofToCheckValidationSemantics1BoxedVoid](#nestedanyoftocheckvalidationsemantics1boxedvoid)
    boxed class to store validated null payloads | +| record | [NestedAnyofToCheckValidationSemantics.NestedAnyofToCheckValidationSemantics1BoxedBoolean](#nestedanyoftocheckvalidationsemantics1boxedboolean)
    boxed class to store validated boolean payloads | +| record | [NestedAnyofToCheckValidationSemantics.NestedAnyofToCheckValidationSemantics1BoxedNumber](#nestedanyoftocheckvalidationsemantics1boxednumber)
    boxed class to store validated Number payloads | +| record | [NestedAnyofToCheckValidationSemantics.NestedAnyofToCheckValidationSemantics1BoxedString](#nestedanyoftocheckvalidationsemantics1boxedstring)
    boxed class to store validated String payloads | +| record | [NestedAnyofToCheckValidationSemantics.NestedAnyofToCheckValidationSemantics1BoxedList](#nestedanyoftocheckvalidationsemantics1boxedlist)
    boxed class to store validated List payloads | +| record | [NestedAnyofToCheckValidationSemantics.NestedAnyofToCheckValidationSemantics1BoxedMap](#nestedanyoftocheckvalidationsemantics1boxedmap)
    boxed class to store validated Map payloads | +| static class | [NestedAnyofToCheckValidationSemantics.NestedAnyofToCheckValidationSemantics1](#nestedanyoftocheckvalidationsemantics1)
    schema class | +| sealed interface | [NestedAnyofToCheckValidationSemantics.Schema0Boxed](#schema0boxed)
    sealed interface for validated payloads | +| record | [NestedAnyofToCheckValidationSemantics.Schema0BoxedVoid](#schema0boxedvoid)
    boxed class to store validated null payloads | +| record | [NestedAnyofToCheckValidationSemantics.Schema0BoxedBoolean](#schema0boxedboolean)
    boxed class to store validated boolean payloads | +| record | [NestedAnyofToCheckValidationSemantics.Schema0BoxedNumber](#schema0boxednumber)
    boxed class to store validated Number payloads | +| record | [NestedAnyofToCheckValidationSemantics.Schema0BoxedString](#schema0boxedstring)
    boxed class to store validated String payloads | +| record | [NestedAnyofToCheckValidationSemantics.Schema0BoxedList](#schema0boxedlist)
    boxed class to store validated List payloads | +| record | [NestedAnyofToCheckValidationSemantics.Schema0BoxedMap](#schema0boxedmap)
    boxed class to store validated Map payloads | +| static class | [NestedAnyofToCheckValidationSemantics.Schema0](#schema0)
    schema class | +| sealed interface | [NestedAnyofToCheckValidationSemantics.Schema01Boxed](#schema01boxed)
    sealed interface for validated payloads | +| record | [NestedAnyofToCheckValidationSemantics.Schema01BoxedVoid](#schema01boxedvoid)
    boxed class to store validated null payloads | +| static class | [NestedAnyofToCheckValidationSemantics.Schema01](#schema01)
    schema class | + +## NestedAnyofToCheckValidationSemantics1Boxed +sealed interface NestedAnyofToCheckValidationSemantics1Boxed
    +permits
    +[NestedAnyofToCheckValidationSemantics1BoxedVoid](#nestedanyoftocheckvalidationsemantics1boxedvoid), +[NestedAnyofToCheckValidationSemantics1BoxedBoolean](#nestedanyoftocheckvalidationsemantics1boxedboolean), +[NestedAnyofToCheckValidationSemantics1BoxedNumber](#nestedanyoftocheckvalidationsemantics1boxednumber), +[NestedAnyofToCheckValidationSemantics1BoxedString](#nestedanyoftocheckvalidationsemantics1boxedstring), +[NestedAnyofToCheckValidationSemantics1BoxedList](#nestedanyoftocheckvalidationsemantics1boxedlist), +[NestedAnyofToCheckValidationSemantics1BoxedMap](#nestedanyoftocheckvalidationsemantics1boxedmap) + +sealed interface that stores validated payloads using boxed classes + +## NestedAnyofToCheckValidationSemantics1BoxedVoid +data class NestedAnyofToCheckValidationSemantics1BoxedVoid
    +implements [NestedAnyofToCheckValidationSemantics1Boxed](#nestedanyoftocheckvalidationsemantics1boxed) + +data class that stores validated null payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| NestedAnyofToCheckValidationSemantics1BoxedVoid(Nothing? data)
    Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| Nothing? | data()
    validated payload | +| Any? | getData()
    validated payload | + +## NestedAnyofToCheckValidationSemantics1BoxedBoolean +data class NestedAnyofToCheckValidationSemantics1BoxedBoolean
    +implements [NestedAnyofToCheckValidationSemantics1Boxed](#nestedanyoftocheckvalidationsemantics1boxed) + +record that stores validated boolean payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| NestedAnyofToCheckValidationSemantics1BoxedBoolean(boolean data)
    Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| boolean | data()
    validated payload | +| Any? | getData()
    validated payload | + +## NestedAnyofToCheckValidationSemantics1BoxedNumber +data class NestedAnyofToCheckValidationSemantics1BoxedNumber
    +implements [NestedAnyofToCheckValidationSemantics1Boxed](#nestedanyoftocheckvalidationsemantics1boxed) + +data class that stores validated Number payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| NestedAnyofToCheckValidationSemantics1BoxedNumber(Number data)
    Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| Number | data()
    validated payload | +| Any? | getData()
    validated payload | + +## NestedAnyofToCheckValidationSemantics1BoxedString +data class NestedAnyofToCheckValidationSemantics1BoxedString
    +implements [NestedAnyofToCheckValidationSemantics1Boxed](#nestedanyoftocheckvalidationsemantics1boxed) + +data class that stores validated String payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| NestedAnyofToCheckValidationSemantics1BoxedString(String data)
    Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| String | data()
    validated payload | +| Any? | getData()
    validated payload | + +## NestedAnyofToCheckValidationSemantics1BoxedList +data class NestedAnyofToCheckValidationSemantics1BoxedList
    +implements [NestedAnyofToCheckValidationSemantics1Boxed](#nestedanyoftocheckvalidationsemantics1boxed) + +data class that stores validated List payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| NestedAnyofToCheckValidationSemantics1BoxedList(FrozenList data)
    Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| FrozenList | data()
    validated payload | +| Any? | getData()
    validated payload | + +## NestedAnyofToCheckValidationSemantics1BoxedMap +data class NestedAnyofToCheckValidationSemantics1BoxedMap
    +implements [NestedAnyofToCheckValidationSemantics1Boxed](#nestedanyoftocheckvalidationsemantics1boxed) + +data class that stores validated Map payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| NestedAnyofToCheckValidationSemantics1BoxedMap(FrozenMap data)
    Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| FrozenMap | data()
    validated payload | +| Any? | getData()
    validated payload | + +## NestedAnyofToCheckValidationSemantics1 +class NestedAnyofToCheckValidationSemantics1
    +extends JsonSchema + +A schema class that validates payloads + +### Field Summary +| Modifier and Type | Field and Description | +| ----------------- | ---------------------- | +| List> | anyOf = listOf(
        [Schema0::class.java](#schema0)
    )
    | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| String | validate(arg: String, configuration: SchemaConfiguration) | +| Nothing? | validate(arg: Nothing?, configuration: SchemaConfiguration) | +| int | validate(arg: int, configuration: SchemaConfiguration) | +| long | validate(arg: long, configuration: SchemaConfiguration) | +| float | validate(arg: float, configuration: SchemaConfiguration) | +| double | validate(arg: double, configuration: SchemaConfiguration) | +| Number | validate(arg: Number, configuration: SchemaConfiguration) | +| boolean | validate(arg: boolean, configuration: SchemaConfiguration) | +| FrozenMap | validate(arg: Map<?, ?>, configuration: SchemaConfiguration) | +| FrozenList | validate(arg: List<*>, configuration: SchemaConfiguration) | +| [NestedAnyofToCheckValidationSemantics1BoxedString](#nestedanyoftocheckvalidationsemantics1boxedstring) | validateAndBox(String, configuration: SchemaConfiguration) | +| [NestedAnyofToCheckValidationSemantics1BoxedVoid](#nestedanyoftocheckvalidationsemantics1boxedvoid) | validateAndBox(Nothing?, configuration: SchemaConfiguration) | +| [NestedAnyofToCheckValidationSemantics1BoxedNumber](#nestedanyoftocheckvalidationsemantics1boxednumber) | validateAndBox(Number, configuration: SchemaConfiguration) | +| [NestedAnyofToCheckValidationSemantics1BoxedBoolean](#nestedanyoftocheckvalidationsemantics1boxedboolean) | validateAndBox(boolean, configuration: SchemaConfiguration) | +| [NestedAnyofToCheckValidationSemantics1BoxedMap](#nestedanyoftocheckvalidationsemantics1boxedmap) | validateAndBox(Map<?, ?>, configuration: SchemaConfiguration) | +| [NestedAnyofToCheckValidationSemantics1BoxedList](#nestedanyoftocheckvalidationsemantics1boxedlist) | validateAndBox(List<*>, configuration: SchemaConfiguration) | +| [NestedAnyofToCheckValidationSemantics1Boxed](#nestedanyoftocheckvalidationsemantics1boxed) | validateAndBox(Any?, configuration: SchemaConfiguration) | +| Any? | validate(arg: Any?, configuration: SchemaConfiguration) | + +## Schema0Boxed +sealed interface Schema0Boxed
    +permits
    +[Schema0BoxedVoid](#schema0boxedvoid), +[Schema0BoxedBoolean](#schema0boxedboolean), +[Schema0BoxedNumber](#schema0boxednumber), +[Schema0BoxedString](#schema0boxedstring), +[Schema0BoxedList](#schema0boxedlist), +[Schema0BoxedMap](#schema0boxedmap) + +sealed interface that stores validated payloads using boxed classes + +## Schema0BoxedVoid +data class Schema0BoxedVoid
    +implements [Schema0Boxed](#schema0boxed) + +data class that stores validated null payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| Schema0BoxedVoid(Nothing? data)
    Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| Nothing? | data()
    validated payload | +| Any? | getData()
    validated payload | + +## Schema0BoxedBoolean +data class Schema0BoxedBoolean
    +implements [Schema0Boxed](#schema0boxed) + +record that stores validated boolean payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| Schema0BoxedBoolean(boolean data)
    Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| boolean | data()
    validated payload | +| Any? | getData()
    validated payload | + +## Schema0BoxedNumber +data class Schema0BoxedNumber
    +implements [Schema0Boxed](#schema0boxed) + +data class that stores validated Number payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| Schema0BoxedNumber(Number data)
    Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| Number | data()
    validated payload | +| Any? | getData()
    validated payload | + +## Schema0BoxedString +data class Schema0BoxedString
    +implements [Schema0Boxed](#schema0boxed) + +data class that stores validated String payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| Schema0BoxedString(String data)
    Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| String | data()
    validated payload | +| Any? | getData()
    validated payload | + +## Schema0BoxedList +data class Schema0BoxedList
    +implements [Schema0Boxed](#schema0boxed) + +data class that stores validated List payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| Schema0BoxedList(FrozenList data)
    Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| FrozenList | data()
    validated payload | +| Any? | getData()
    validated payload | + +## Schema0BoxedMap +data class Schema0BoxedMap
    +implements [Schema0Boxed](#schema0boxed) + +data class that stores validated Map payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| Schema0BoxedMap(FrozenMap data)
    Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| FrozenMap | data()
    validated payload | +| Any? | getData()
    validated payload | + +## Schema0 +class Schema0
    +extends JsonSchema + +A schema class that validates payloads + +### Field Summary +| Modifier and Type | Field and Description | +| ----------------- | ---------------------- | +| List> | anyOf = listOf(
        [Schema01::class.java](#schema01)
    )
    | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| String | validate(arg: String, configuration: SchemaConfiguration) | +| Nothing? | validate(arg: Nothing?, configuration: SchemaConfiguration) | +| int | validate(arg: int, configuration: SchemaConfiguration) | +| long | validate(arg: long, configuration: SchemaConfiguration) | +| float | validate(arg: float, configuration: SchemaConfiguration) | +| double | validate(arg: double, configuration: SchemaConfiguration) | +| Number | validate(arg: Number, configuration: SchemaConfiguration) | +| boolean | validate(arg: boolean, configuration: SchemaConfiguration) | +| FrozenMap | validate(arg: Map<?, ?>, configuration: SchemaConfiguration) | +| FrozenList | validate(arg: List<*>, configuration: SchemaConfiguration) | +| [Schema0BoxedString](#schema0boxedstring) | validateAndBox(String, configuration: SchemaConfiguration) | +| [Schema0BoxedVoid](#schema0boxedvoid) | validateAndBox(Nothing?, configuration: SchemaConfiguration) | +| [Schema0BoxedNumber](#schema0boxednumber) | validateAndBox(Number, configuration: SchemaConfiguration) | +| [Schema0BoxedBoolean](#schema0boxedboolean) | validateAndBox(boolean, configuration: SchemaConfiguration) | +| [Schema0BoxedMap](#schema0boxedmap) | validateAndBox(Map<?, ?>, configuration: SchemaConfiguration) | +| [Schema0BoxedList](#schema0boxedlist) | validateAndBox(List<*>, configuration: SchemaConfiguration) | +| [Schema0Boxed](#schema0boxed) | validateAndBox(Any?, configuration: SchemaConfiguration) | +| Any? | validate(arg: Any?, configuration: SchemaConfiguration) | + +## Schema01Boxed +sealed interface Schema01Boxed
    +permits
    +[Schema01BoxedVoid](#schema01boxedvoid) + +sealed interface that stores validated payloads using boxed classes + +## Schema01BoxedVoid +data class Schema01BoxedVoid
    +implements [Schema01Boxed](#schema01boxed) + +data class that stores validated null payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| Schema01BoxedVoid(Nothing? data)
    Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| Nothing? | data()
    validated payload | +| Any? | getData()
    validated payload | + +## Schema01 +class Schema01
    +extends NullJsonSchema.NullJsonSchema1 + +A schema class that validates payloads + +| Methods Inherited from class org.openapijsonschematools.client.schemas.NullJsonSchema.NullJsonSchema1 | +| ------------------------------------------------------------------ | +| validate | +| validateAndBox | + +[[Back to top]](#top) [[Back to Component Schemas]](../../../README.md#Component-Schemas) [[Back to README]](../../../README.md) diff --git a/samples/client/3_1_0_unit_test/kotlin/docs/components/schemas/NestedItems.md b/samples/client/3_1_0_unit_test/kotlin/docs/components/schemas/NestedItems.md new file mode 100644 index 00000000000..f609bc5ec46 --- /dev/null +++ b/samples/client/3_1_0_unit_test/kotlin/docs/components/schemas/NestedItems.md @@ -0,0 +1,492 @@ +# NestedItems +org.openapijsonschematools.client.components.schemas.NestedItems.java +class NestedItems
    + +A class that contains necessary nested +- schema classes (which validate payloads), extends JsonSchema +- sealed interfaces which store validated payloads, Kotlin version of a sum type +- boxed classes which store validated payloads, sealed permits class implementations +- classes to store validated list payloads, extends FrozenList +- classes to build inputs for list payloads + +## Nested Class Summary +| Modifier and Type | Class and Description | +| ----------------- | ---------------------- | +| sealed interface | [NestedItems.NestedItems1Boxed](#nesteditems1boxed)
    sealed interface for validated payloads | +| record | [NestedItems.NestedItems1BoxedList](#nesteditems1boxedlist)
    boxed class to store validated List payloads | +| static class | [NestedItems.NestedItems1](#nesteditems1)
    schema class | +| static class | [NestedItems.NestedItemsListBuilder](#nesteditemslistbuilder)
    builder for List payloads | +| static class | [NestedItems.NestedItemsList](#nesteditemslist)
    output class for List payloads | +| sealed interface | [NestedItems.ItemsBoxed](#itemsboxed)
    sealed interface for validated payloads | +| record | [NestedItems.ItemsBoxedList](#itemsboxedlist)
    boxed class to store validated List payloads | +| static class | [NestedItems.Items](#items)
    schema class | +| static class | [NestedItems.ItemsListBuilder2](#itemslistbuilder2)
    builder for List payloads | +| static class | [NestedItems.ItemsList2](#itemslist2)
    output class for List payloads | +| sealed interface | [NestedItems.Items1Boxed](#items1boxed)
    sealed interface for validated payloads | +| record | [NestedItems.Items1BoxedList](#items1boxedlist)
    boxed class to store validated List payloads | +| static class | [NestedItems.Items1](#items1)
    schema class | +| static class | [NestedItems.ItemsListBuilder1](#itemslistbuilder1)
    builder for List payloads | +| static class | [NestedItems.ItemsList1](#itemslist1)
    output class for List payloads | +| sealed interface | [NestedItems.Items2Boxed](#items2boxed)
    sealed interface for validated payloads | +| record | [NestedItems.Items2BoxedList](#items2boxedlist)
    boxed class to store validated List payloads | +| static class | [NestedItems.Items2](#items2)
    schema class | +| static class | [NestedItems.ItemsListBuilder](#itemslistbuilder)
    builder for List payloads | +| static class | [NestedItems.ItemsList](#itemslist)
    output class for List payloads | +| sealed interface | [NestedItems.Items3Boxed](#items3boxed)
    sealed interface for validated payloads | +| record | [NestedItems.Items3BoxedNumber](#items3boxednumber)
    boxed class to store validated Number payloads | +| static class | [NestedItems.Items3](#items3)
    schema class | + +## NestedItems1Boxed +sealed interface NestedItems1Boxed
    +permits
    +[NestedItems1BoxedList](#nesteditems1boxedlist) + +sealed interface that stores validated payloads using boxed classes + +## NestedItems1BoxedList +data class NestedItems1BoxedList
    +implements [NestedItems1Boxed](#nesteditems1boxed) + +data class that stores validated List payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| NestedItems1BoxedList([NestedItemsList](#nesteditemslist) data)
    Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| [NestedItemsList](#nesteditemslist) | data()
    validated payload | +| Any? | getData()
    validated payload | + +## NestedItems1 +class NestedItems1
    +extends JsonSchema + +A schema class that validates payloads + +### Code Sample +``` +import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags; +import org.openapijsonschematools.client.configurations.SchemaConfiguration; +import org.openapijsonschematools.client.exceptions.ValidationException; +import org.openapijsonschematools.client.schemas.validation.MapUtils; +import org.openapijsonschematools.client.schemas.validation.FrozenList; +import org.openapijsonschematools.client.schemas.validation.FrozenMap; +import org.openapijsonschematools.client.components.schemas.NestedItems; + +import java.util.Arrays; +import java.util.List; +import java.util.AbstractMap; + +static final SchemaConfiguration configuration = new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().build()); + +// List validation +NestedItems.NestedItemsList validatedPayload = + NestedItems.NestedItems1.validate( + new NestedItems.NestedItemsListBuilder() + .add( + listOf( + listOf( + listOf( + 1 + ) + ) + ) + ) + .build(), + configuration +); +``` + +### Field Summary +| Modifier and Type | Field and Description | +| ----------------- | ---------------------- | +| Set> | type = setOf(List::class.java) | +| Class | items = [Items::class.java](#items) | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| [NestedItemsList](#nesteditemslist) | validate(arg: [List<*>](#nesteditemslistbuilder), configuration: SchemaConfiguration) | +| [NestedItems1BoxedList](#nesteditems1boxedlist) | validateAndBox([List<*>](#nesteditemslistbuilder), configuration: SchemaConfiguration) | +| [NestedItems1Boxed](#nesteditems1boxed) | validateAndBox(Any?, configuration: SchemaConfiguration) | +| Any? | validate(arg: Any?, configuration: SchemaConfiguration) | + +## NestedItemsListBuilder +class NestedItemsListBuilder
    +builder for `List>>>` + +A class that builds the List input type + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| NestedItemsListBuilder()
    Creates an empty list | +| NestedItemsListBuilder(List>>> items)
    Stores the items in a list | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| NestedItemsListBuilder | add(item: List>>) | +| List>>> | build()
    Returns list input that should be used with Schema.validate | + +## NestedItemsList +class NestedItemsList
    +extends `FrozenList` + +A class to store validated List payloads + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| static [NestedItemsList](#nesteditemslist) | of([List>>>](#nesteditemslistbuilder) arg, SchemaConfiguration configuration) | + +## ItemsBoxed +sealed interface ItemsBoxed
    +permits
    +[ItemsBoxedList](#itemsboxedlist) + +sealed interface that stores validated payloads using boxed classes + +## ItemsBoxedList +data class ItemsBoxedList
    +implements [ItemsBoxed](#itemsboxed) + +data class that stores validated List payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| ItemsBoxedList([ItemsList2](#itemslist2) data)
    Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| [ItemsList2](#itemslist2) | data()
    validated payload | +| Any? | getData()
    validated payload | + +## Items +class Items
    +extends JsonSchema + +A schema class that validates payloads + +### Code Sample +``` +import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags; +import org.openapijsonschematools.client.configurations.SchemaConfiguration; +import org.openapijsonschematools.client.exceptions.ValidationException; +import org.openapijsonschematools.client.schemas.validation.MapUtils; +import org.openapijsonschematools.client.schemas.validation.FrozenList; +import org.openapijsonschematools.client.schemas.validation.FrozenMap; +import org.openapijsonschematools.client.components.schemas.NestedItems; + +import java.util.Arrays; +import java.util.List; +import java.util.AbstractMap; + +static final SchemaConfiguration configuration = new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().build()); + +// List validation +NestedItems.ItemsList2 validatedPayload = + NestedItems.Items.validate( + new NestedItems.ItemsListBuilder2() + .add( + listOf( + listOf( + 1 + ) + ) + ) + .build(), + configuration +); +``` + +### Field Summary +| Modifier and Type | Field and Description | +| ----------------- | ---------------------- | +| Set> | type = setOf(List::class.java) | +| Class | items = [Items1::class.java](#items1) | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| [ItemsList2](#itemslist2) | validate(arg: [List<*>](#itemslistbuilder2), configuration: SchemaConfiguration) | +| [ItemsBoxedList](#itemsboxedlist) | validateAndBox([List<*>](#itemslistbuilder2), configuration: SchemaConfiguration) | +| [ItemsBoxed](#itemsboxed) | validateAndBox(Any?, configuration: SchemaConfiguration) | +| Any? | validate(arg: Any?, configuration: SchemaConfiguration) | + +## ItemsListBuilder2 +class ItemsListBuilder2
    +builder for `List>>` + +A class that builds the List input type + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| ItemsListBuilder2()
    Creates an empty list | +| ItemsListBuilder2(List>> items)
    Stores the items in a list | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| ItemsListBuilder2 | add(item: List>) | +| List>> | build()
    Returns list input that should be used with Schema.validate | + +## ItemsList2 +class ItemsList2
    +extends `FrozenList` + +A class to store validated List payloads + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| static [ItemsList2](#itemslist2) | of([List>>](#itemslistbuilder2) arg, SchemaConfiguration configuration) | + +## Items1Boxed +sealed interface Items1Boxed
    +permits
    +[Items1BoxedList](#items1boxedlist) + +sealed interface that stores validated payloads using boxed classes + +## Items1BoxedList +data class Items1BoxedList
    +implements [Items1Boxed](#items1boxed) + +data class that stores validated List payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| Items1BoxedList([ItemsList1](#itemslist1) data)
    Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| [ItemsList1](#itemslist1) | data()
    validated payload | +| Any? | getData()
    validated payload | + +## Items1 +class Items1
    +extends JsonSchema + +A schema class that validates payloads + +### Code Sample +``` +import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags; +import org.openapijsonschematools.client.configurations.SchemaConfiguration; +import org.openapijsonschematools.client.exceptions.ValidationException; +import org.openapijsonschematools.client.schemas.validation.MapUtils; +import org.openapijsonschematools.client.schemas.validation.FrozenList; +import org.openapijsonschematools.client.schemas.validation.FrozenMap; +import org.openapijsonschematools.client.components.schemas.NestedItems; + +import java.util.Arrays; +import java.util.List; +import java.util.AbstractMap; + +static final SchemaConfiguration configuration = new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().build()); + +// List validation +NestedItems.ItemsList1 validatedPayload = + NestedItems.Items1.validate( + new NestedItems.ItemsListBuilder1() + .add( + listOf( + 1 + ) + ) + .build(), + configuration +); +``` + +### Field Summary +| Modifier and Type | Field and Description | +| ----------------- | ---------------------- | +| Set> | type = setOf(List::class.java) | +| Class | items = [Items2::class.java](#items2) | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| [ItemsList1](#itemslist1) | validate(arg: [List<*>](#itemslistbuilder1), configuration: SchemaConfiguration) | +| [Items1BoxedList](#items1boxedlist) | validateAndBox([List<*>](#itemslistbuilder1), configuration: SchemaConfiguration) | +| [Items1Boxed](#items1boxed) | validateAndBox(Any?, configuration: SchemaConfiguration) | +| Any? | validate(arg: Any?, configuration: SchemaConfiguration) | + +## ItemsListBuilder1 +class ItemsListBuilder1
    +builder for `List>` + +A class that builds the List input type + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| ItemsListBuilder1()
    Creates an empty list | +| ItemsListBuilder1(List> items)
    Stores the items in a list | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| ItemsListBuilder1 | add(item: List) | +| List> | build()
    Returns list input that should be used with Schema.validate | + +## ItemsList1 +class ItemsList1
    +extends `FrozenList` + +A class to store validated List payloads + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| static [ItemsList1](#itemslist1) | of([List>](#itemslistbuilder1) arg, SchemaConfiguration configuration) | + +## Items2Boxed +sealed interface Items2Boxed
    +permits
    +[Items2BoxedList](#items2boxedlist) + +sealed interface that stores validated payloads using boxed classes + +## Items2BoxedList +data class Items2BoxedList
    +implements [Items2Boxed](#items2boxed) + +data class that stores validated List payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| Items2BoxedList([ItemsList](#itemslist) data)
    Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| [ItemsList](#itemslist) | data()
    validated payload | +| Any? | getData()
    validated payload | + +## Items2 +class Items2
    +extends JsonSchema + +A schema class that validates payloads + +### Code Sample +``` +import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags; +import org.openapijsonschematools.client.configurations.SchemaConfiguration; +import org.openapijsonschematools.client.exceptions.ValidationException; +import org.openapijsonschematools.client.schemas.validation.MapUtils; +import org.openapijsonschematools.client.schemas.validation.FrozenList; +import org.openapijsonschematools.client.schemas.validation.FrozenMap; +import org.openapijsonschematools.client.components.schemas.NestedItems; + +import java.util.Arrays; +import java.util.List; +import java.util.AbstractMap; + +static final SchemaConfiguration configuration = new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().build()); + +// List validation +NestedItems.ItemsList validatedPayload = + NestedItems.Items2.validate( + new NestedItems.ItemsListBuilder() + .add(1) + + .build(), + configuration +); +``` + +### Field Summary +| Modifier and Type | Field and Description | +| ----------------- | ---------------------- | +| Set> | type = setOf(List::class.java) | +| Class | items = [Items3::class.java](#items3) | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| [ItemsList](#itemslist) | validate(arg: [List<*>](#itemslistbuilder), configuration: SchemaConfiguration) | +| [Items2BoxedList](#items2boxedlist) | validateAndBox([List<*>](#itemslistbuilder), configuration: SchemaConfiguration) | +| [Items2Boxed](#items2boxed) | validateAndBox(Any?, configuration: SchemaConfiguration) | +| Any? | validate(arg: Any?, configuration: SchemaConfiguration) | + +## ItemsListBuilder +class ItemsListBuilder
    +builder for `List` + +A class that builds the List input type + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| ItemsListBuilder()
    Creates an empty list | +| ItemsListBuilder(List items)
    Stores the items in a list | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| ItemsListBuilder | add(item: Int) | +| ItemsListBuilder | add(item: Float) | +| ItemsListBuilder | add(item: Long) | +| ItemsListBuilder | add(item: Double) | +| List | build()
    Returns list input that should be used with Schema.validate | + +## ItemsList +class ItemsList
    +extends `FrozenList` + +A class to store validated List payloads + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| static [ItemsList](#itemslist) | of([List](#itemslistbuilder) arg, SchemaConfiguration configuration) | + +## Items3Boxed +sealed interface Items3Boxed
    +permits
    +[Items3BoxedNumber](#items3boxednumber) + +sealed interface that stores validated payloads using boxed classes + +## Items3BoxedNumber +data class Items3BoxedNumber
    +implements [Items3Boxed](#items3boxed) + +data class that stores validated Number payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| Items3BoxedNumber(Number data)
    Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| Number | data()
    validated payload | +| Any? | getData()
    validated payload | + +## Items3 +class Items3
    +extends NumberJsonSchema.NumberJsonSchema1 + +A schema class that validates payloads + +| Methods Inherited from class org.openapijsonschematools.client.schemas.NumberJsonSchema.NumberJsonSchema1 | +| ------------------------------------------------------------------ | +| validate | +| validateAndBox | + +[[Back to top]](#top) [[Back to Component Schemas]](../../../README.md#Component-Schemas) [[Back to README]](../../../README.md) diff --git a/samples/client/3_1_0_unit_test/kotlin/docs/components/schemas/NestedOneofToCheckValidationSemantics.md b/samples/client/3_1_0_unit_test/kotlin/docs/components/schemas/NestedOneofToCheckValidationSemantics.md new file mode 100644 index 00000000000..6e78e1ba783 --- /dev/null +++ b/samples/client/3_1_0_unit_test/kotlin/docs/components/schemas/NestedOneofToCheckValidationSemantics.md @@ -0,0 +1,362 @@ +# NestedOneofToCheckValidationSemantics +org.openapijsonschematools.client.components.schemas.NestedOneofToCheckValidationSemantics.java +class NestedOneofToCheckValidationSemantics
    + +A class that contains necessary nested +- schema classes (which validate payloads), extends JsonSchema +- sealed interfaces which store validated payloads, Kotlin version of a sum type +- boxed classes which store validated payloads, sealed permits class implementations + +## Nested Class Summary +| Modifier and Type | Class and Description | +| ----------------- | ---------------------- | +| sealed interface | [NestedOneofToCheckValidationSemantics.NestedOneofToCheckValidationSemantics1Boxed](#nestedoneoftocheckvalidationsemantics1boxed)
    sealed interface for validated payloads | +| record | [NestedOneofToCheckValidationSemantics.NestedOneofToCheckValidationSemantics1BoxedVoid](#nestedoneoftocheckvalidationsemantics1boxedvoid)
    boxed class to store validated null payloads | +| record | [NestedOneofToCheckValidationSemantics.NestedOneofToCheckValidationSemantics1BoxedBoolean](#nestedoneoftocheckvalidationsemantics1boxedboolean)
    boxed class to store validated boolean payloads | +| record | [NestedOneofToCheckValidationSemantics.NestedOneofToCheckValidationSemantics1BoxedNumber](#nestedoneoftocheckvalidationsemantics1boxednumber)
    boxed class to store validated Number payloads | +| record | [NestedOneofToCheckValidationSemantics.NestedOneofToCheckValidationSemantics1BoxedString](#nestedoneoftocheckvalidationsemantics1boxedstring)
    boxed class to store validated String payloads | +| record | [NestedOneofToCheckValidationSemantics.NestedOneofToCheckValidationSemantics1BoxedList](#nestedoneoftocheckvalidationsemantics1boxedlist)
    boxed class to store validated List payloads | +| record | [NestedOneofToCheckValidationSemantics.NestedOneofToCheckValidationSemantics1BoxedMap](#nestedoneoftocheckvalidationsemantics1boxedmap)
    boxed class to store validated Map payloads | +| static class | [NestedOneofToCheckValidationSemantics.NestedOneofToCheckValidationSemantics1](#nestedoneoftocheckvalidationsemantics1)
    schema class | +| sealed interface | [NestedOneofToCheckValidationSemantics.Schema0Boxed](#schema0boxed)
    sealed interface for validated payloads | +| record | [NestedOneofToCheckValidationSemantics.Schema0BoxedVoid](#schema0boxedvoid)
    boxed class to store validated null payloads | +| record | [NestedOneofToCheckValidationSemantics.Schema0BoxedBoolean](#schema0boxedboolean)
    boxed class to store validated boolean payloads | +| record | [NestedOneofToCheckValidationSemantics.Schema0BoxedNumber](#schema0boxednumber)
    boxed class to store validated Number payloads | +| record | [NestedOneofToCheckValidationSemantics.Schema0BoxedString](#schema0boxedstring)
    boxed class to store validated String payloads | +| record | [NestedOneofToCheckValidationSemantics.Schema0BoxedList](#schema0boxedlist)
    boxed class to store validated List payloads | +| record | [NestedOneofToCheckValidationSemantics.Schema0BoxedMap](#schema0boxedmap)
    boxed class to store validated Map payloads | +| static class | [NestedOneofToCheckValidationSemantics.Schema0](#schema0)
    schema class | +| sealed interface | [NestedOneofToCheckValidationSemantics.Schema01Boxed](#schema01boxed)
    sealed interface for validated payloads | +| record | [NestedOneofToCheckValidationSemantics.Schema01BoxedVoid](#schema01boxedvoid)
    boxed class to store validated null payloads | +| static class | [NestedOneofToCheckValidationSemantics.Schema01](#schema01)
    schema class | + +## NestedOneofToCheckValidationSemantics1Boxed +sealed interface NestedOneofToCheckValidationSemantics1Boxed
    +permits
    +[NestedOneofToCheckValidationSemantics1BoxedVoid](#nestedoneoftocheckvalidationsemantics1boxedvoid), +[NestedOneofToCheckValidationSemantics1BoxedBoolean](#nestedoneoftocheckvalidationsemantics1boxedboolean), +[NestedOneofToCheckValidationSemantics1BoxedNumber](#nestedoneoftocheckvalidationsemantics1boxednumber), +[NestedOneofToCheckValidationSemantics1BoxedString](#nestedoneoftocheckvalidationsemantics1boxedstring), +[NestedOneofToCheckValidationSemantics1BoxedList](#nestedoneoftocheckvalidationsemantics1boxedlist), +[NestedOneofToCheckValidationSemantics1BoxedMap](#nestedoneoftocheckvalidationsemantics1boxedmap) + +sealed interface that stores validated payloads using boxed classes + +## NestedOneofToCheckValidationSemantics1BoxedVoid +data class NestedOneofToCheckValidationSemantics1BoxedVoid
    +implements [NestedOneofToCheckValidationSemantics1Boxed](#nestedoneoftocheckvalidationsemantics1boxed) + +data class that stores validated null payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| NestedOneofToCheckValidationSemantics1BoxedVoid(Nothing? data)
    Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| Nothing? | data()
    validated payload | +| Any? | getData()
    validated payload | + +## NestedOneofToCheckValidationSemantics1BoxedBoolean +data class NestedOneofToCheckValidationSemantics1BoxedBoolean
    +implements [NestedOneofToCheckValidationSemantics1Boxed](#nestedoneoftocheckvalidationsemantics1boxed) + +record that stores validated boolean payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| NestedOneofToCheckValidationSemantics1BoxedBoolean(boolean data)
    Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| boolean | data()
    validated payload | +| Any? | getData()
    validated payload | + +## NestedOneofToCheckValidationSemantics1BoxedNumber +data class NestedOneofToCheckValidationSemantics1BoxedNumber
    +implements [NestedOneofToCheckValidationSemantics1Boxed](#nestedoneoftocheckvalidationsemantics1boxed) + +data class that stores validated Number payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| NestedOneofToCheckValidationSemantics1BoxedNumber(Number data)
    Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| Number | data()
    validated payload | +| Any? | getData()
    validated payload | + +## NestedOneofToCheckValidationSemantics1BoxedString +data class NestedOneofToCheckValidationSemantics1BoxedString
    +implements [NestedOneofToCheckValidationSemantics1Boxed](#nestedoneoftocheckvalidationsemantics1boxed) + +data class that stores validated String payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| NestedOneofToCheckValidationSemantics1BoxedString(String data)
    Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| String | data()
    validated payload | +| Any? | getData()
    validated payload | + +## NestedOneofToCheckValidationSemantics1BoxedList +data class NestedOneofToCheckValidationSemantics1BoxedList
    +implements [NestedOneofToCheckValidationSemantics1Boxed](#nestedoneoftocheckvalidationsemantics1boxed) + +data class that stores validated List payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| NestedOneofToCheckValidationSemantics1BoxedList(FrozenList data)
    Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| FrozenList | data()
    validated payload | +| Any? | getData()
    validated payload | + +## NestedOneofToCheckValidationSemantics1BoxedMap +data class NestedOneofToCheckValidationSemantics1BoxedMap
    +implements [NestedOneofToCheckValidationSemantics1Boxed](#nestedoneoftocheckvalidationsemantics1boxed) + +data class that stores validated Map payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| NestedOneofToCheckValidationSemantics1BoxedMap(FrozenMap data)
    Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| FrozenMap | data()
    validated payload | +| Any? | getData()
    validated payload | + +## NestedOneofToCheckValidationSemantics1 +class NestedOneofToCheckValidationSemantics1
    +extends JsonSchema + +A schema class that validates payloads + +### Field Summary +| Modifier and Type | Field and Description | +| ----------------- | ---------------------- | +| List> | oneOf = listOf(
        [Schema0::class.java](#schema0)
    ))
    | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| String | validate(arg: String, configuration: SchemaConfiguration) | +| Nothing? | validate(arg: Nothing?, configuration: SchemaConfiguration) | +| int | validate(arg: int, configuration: SchemaConfiguration) | +| long | validate(arg: long, configuration: SchemaConfiguration) | +| float | validate(arg: float, configuration: SchemaConfiguration) | +| double | validate(arg: double, configuration: SchemaConfiguration) | +| Number | validate(arg: Number, configuration: SchemaConfiguration) | +| boolean | validate(arg: boolean, configuration: SchemaConfiguration) | +| FrozenMap | validate(arg: Map<?, ?>, configuration: SchemaConfiguration) | +| FrozenList | validate(arg: List<*>, configuration: SchemaConfiguration) | +| [NestedOneofToCheckValidationSemantics1BoxedString](#nestedoneoftocheckvalidationsemantics1boxedstring) | validateAndBox(String, configuration: SchemaConfiguration) | +| [NestedOneofToCheckValidationSemantics1BoxedVoid](#nestedoneoftocheckvalidationsemantics1boxedvoid) | validateAndBox(Nothing?, configuration: SchemaConfiguration) | +| [NestedOneofToCheckValidationSemantics1BoxedNumber](#nestedoneoftocheckvalidationsemantics1boxednumber) | validateAndBox(Number, configuration: SchemaConfiguration) | +| [NestedOneofToCheckValidationSemantics1BoxedBoolean](#nestedoneoftocheckvalidationsemantics1boxedboolean) | validateAndBox(boolean, configuration: SchemaConfiguration) | +| [NestedOneofToCheckValidationSemantics1BoxedMap](#nestedoneoftocheckvalidationsemantics1boxedmap) | validateAndBox(Map<?, ?>, configuration: SchemaConfiguration) | +| [NestedOneofToCheckValidationSemantics1BoxedList](#nestedoneoftocheckvalidationsemantics1boxedlist) | validateAndBox(List<*>, configuration: SchemaConfiguration) | +| [NestedOneofToCheckValidationSemantics1Boxed](#nestedoneoftocheckvalidationsemantics1boxed) | validateAndBox(Any?, configuration: SchemaConfiguration) | +| Any? | validate(arg: Any?, configuration: SchemaConfiguration) | + +## Schema0Boxed +sealed interface Schema0Boxed
    +permits
    +[Schema0BoxedVoid](#schema0boxedvoid), +[Schema0BoxedBoolean](#schema0boxedboolean), +[Schema0BoxedNumber](#schema0boxednumber), +[Schema0BoxedString](#schema0boxedstring), +[Schema0BoxedList](#schema0boxedlist), +[Schema0BoxedMap](#schema0boxedmap) + +sealed interface that stores validated payloads using boxed classes + +## Schema0BoxedVoid +data class Schema0BoxedVoid
    +implements [Schema0Boxed](#schema0boxed) + +data class that stores validated null payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| Schema0BoxedVoid(Nothing? data)
    Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| Nothing? | data()
    validated payload | +| Any? | getData()
    validated payload | + +## Schema0BoxedBoolean +data class Schema0BoxedBoolean
    +implements [Schema0Boxed](#schema0boxed) + +record that stores validated boolean payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| Schema0BoxedBoolean(boolean data)
    Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| boolean | data()
    validated payload | +| Any? | getData()
    validated payload | + +## Schema0BoxedNumber +data class Schema0BoxedNumber
    +implements [Schema0Boxed](#schema0boxed) + +data class that stores validated Number payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| Schema0BoxedNumber(Number data)
    Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| Number | data()
    validated payload | +| Any? | getData()
    validated payload | + +## Schema0BoxedString +data class Schema0BoxedString
    +implements [Schema0Boxed](#schema0boxed) + +data class that stores validated String payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| Schema0BoxedString(String data)
    Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| String | data()
    validated payload | +| Any? | getData()
    validated payload | + +## Schema0BoxedList +data class Schema0BoxedList
    +implements [Schema0Boxed](#schema0boxed) + +data class that stores validated List payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| Schema0BoxedList(FrozenList data)
    Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| FrozenList | data()
    validated payload | +| Any? | getData()
    validated payload | + +## Schema0BoxedMap +data class Schema0BoxedMap
    +implements [Schema0Boxed](#schema0boxed) + +data class that stores validated Map payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| Schema0BoxedMap(FrozenMap data)
    Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| FrozenMap | data()
    validated payload | +| Any? | getData()
    validated payload | + +## Schema0 +class Schema0
    +extends JsonSchema + +A schema class that validates payloads + +### Field Summary +| Modifier and Type | Field and Description | +| ----------------- | ---------------------- | +| List> | oneOf = listOf(
        [Schema01::class.java](#schema01)
    ))
    | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| String | validate(arg: String, configuration: SchemaConfiguration) | +| Nothing? | validate(arg: Nothing?, configuration: SchemaConfiguration) | +| int | validate(arg: int, configuration: SchemaConfiguration) | +| long | validate(arg: long, configuration: SchemaConfiguration) | +| float | validate(arg: float, configuration: SchemaConfiguration) | +| double | validate(arg: double, configuration: SchemaConfiguration) | +| Number | validate(arg: Number, configuration: SchemaConfiguration) | +| boolean | validate(arg: boolean, configuration: SchemaConfiguration) | +| FrozenMap | validate(arg: Map<?, ?>, configuration: SchemaConfiguration) | +| FrozenList | validate(arg: List<*>, configuration: SchemaConfiguration) | +| [Schema0BoxedString](#schema0boxedstring) | validateAndBox(String, configuration: SchemaConfiguration) | +| [Schema0BoxedVoid](#schema0boxedvoid) | validateAndBox(Nothing?, configuration: SchemaConfiguration) | +| [Schema0BoxedNumber](#schema0boxednumber) | validateAndBox(Number, configuration: SchemaConfiguration) | +| [Schema0BoxedBoolean](#schema0boxedboolean) | validateAndBox(boolean, configuration: SchemaConfiguration) | +| [Schema0BoxedMap](#schema0boxedmap) | validateAndBox(Map<?, ?>, configuration: SchemaConfiguration) | +| [Schema0BoxedList](#schema0boxedlist) | validateAndBox(List<*>, configuration: SchemaConfiguration) | +| [Schema0Boxed](#schema0boxed) | validateAndBox(Any?, configuration: SchemaConfiguration) | +| Any? | validate(arg: Any?, configuration: SchemaConfiguration) | + +## Schema01Boxed +sealed interface Schema01Boxed
    +permits
    +[Schema01BoxedVoid](#schema01boxedvoid) + +sealed interface that stores validated payloads using boxed classes + +## Schema01BoxedVoid +data class Schema01BoxedVoid
    +implements [Schema01Boxed](#schema01boxed) + +data class that stores validated null payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| Schema01BoxedVoid(Nothing? data)
    Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| Nothing? | data()
    validated payload | +| Any? | getData()
    validated payload | + +## Schema01 +class Schema01
    +extends NullJsonSchema.NullJsonSchema1 + +A schema class that validates payloads + +| Methods Inherited from class org.openapijsonschematools.client.schemas.NullJsonSchema.NullJsonSchema1 | +| ------------------------------------------------------------------ | +| validate | +| validateAndBox | + +[[Back to top]](#top) [[Back to Component Schemas]](../../../README.md#Component-Schemas) [[Back to README]](../../../README.md) diff --git a/samples/client/3_1_0_unit_test/kotlin/docs/components/schemas/NonAsciiPatternWithAdditionalproperties.md b/samples/client/3_1_0_unit_test/kotlin/docs/components/schemas/NonAsciiPatternWithAdditionalproperties.md new file mode 100644 index 00000000000..9d5a0916834 --- /dev/null +++ b/samples/client/3_1_0_unit_test/kotlin/docs/components/schemas/NonAsciiPatternWithAdditionalproperties.md @@ -0,0 +1,384 @@ +# NonAsciiPatternWithAdditionalproperties +org.openapijsonschematools.client.components.schemas.NonAsciiPatternWithAdditionalproperties.java +class NonAsciiPatternWithAdditionalproperties
    + +A class that contains necessary nested +- schema classes (which validate payloads), extends JsonSchema +- sealed interfaces which store validated payloads, Kotlin version of a sum type +- boxed classes which store validated payloads, sealed permits class implementations +- classes to store validated map payloads, extends FrozenMap +- classes to build inputs for map payloads + +## Nested Class Summary +| Modifier and Type | Class and Description | +| ----------------- | ---------------------- | +| sealed interface | [NonAsciiPatternWithAdditionalproperties.NonAsciiPatternWithAdditionalproperties1Boxed](#nonasciipatternwithadditionalproperties1boxed)
    sealed interface for validated payloads | +| record | [NonAsciiPatternWithAdditionalproperties.NonAsciiPatternWithAdditionalproperties1BoxedMap](#nonasciipatternwithadditionalproperties1boxedmap)
    boxed class to store validated Map payloads | +| static class | [NonAsciiPatternWithAdditionalproperties.NonAsciiPatternWithAdditionalproperties1](#nonasciipatternwithadditionalproperties1)
    schema class | +| static class | [NonAsciiPatternWithAdditionalproperties.NonAsciiPatternWithAdditionalpropertiesMapBuilder](#nonasciipatternwithadditionalpropertiesmapbuilder)
    builder for Map payloads | +| static class | [NonAsciiPatternWithAdditionalproperties.NonAsciiPatternWithAdditionalpropertiesMap](#nonasciipatternwithadditionalpropertiesmap)
    output class for Map payloads | +| sealed interface | [NonAsciiPatternWithAdditionalproperties.CircumflexAccentLatinSmallLetterAWithAcuteBoxed](#circumflexaccentlatinsmallletterawithacuteboxed)
    sealed interface for validated payloads | +| record | [NonAsciiPatternWithAdditionalproperties.CircumflexAccentLatinSmallLetterAWithAcuteBoxedVoid](#circumflexaccentlatinsmallletterawithacuteboxedvoid)
    boxed class to store validated null payloads | +| record | [NonAsciiPatternWithAdditionalproperties.CircumflexAccentLatinSmallLetterAWithAcuteBoxedBoolean](#circumflexaccentlatinsmallletterawithacuteboxedboolean)
    boxed class to store validated boolean payloads | +| record | [NonAsciiPatternWithAdditionalproperties.CircumflexAccentLatinSmallLetterAWithAcuteBoxedNumber](#circumflexaccentlatinsmallletterawithacuteboxednumber)
    boxed class to store validated Number payloads | +| record | [NonAsciiPatternWithAdditionalproperties.CircumflexAccentLatinSmallLetterAWithAcuteBoxedString](#circumflexaccentlatinsmallletterawithacuteboxedstring)
    boxed class to store validated String payloads | +| record | [NonAsciiPatternWithAdditionalproperties.CircumflexAccentLatinSmallLetterAWithAcuteBoxedList](#circumflexaccentlatinsmallletterawithacuteboxedlist)
    boxed class to store validated List payloads | +| record | [NonAsciiPatternWithAdditionalproperties.CircumflexAccentLatinSmallLetterAWithAcuteBoxedMap](#circumflexaccentlatinsmallletterawithacuteboxedmap)
    boxed class to store validated Map payloads | +| static class | [NonAsciiPatternWithAdditionalproperties.CircumflexAccentLatinSmallLetterAWithAcute](#circumflexaccentlatinsmallletterawithacute)
    schema class | +| sealed interface | [NonAsciiPatternWithAdditionalproperties.AdditionalPropertiesBoxed](#additionalpropertiesboxed)
    sealed interface for validated payloads | +| record | [NonAsciiPatternWithAdditionalproperties.AdditionalPropertiesBoxedVoid](#additionalpropertiesboxedvoid)
    boxed class to store validated null payloads | +| record | [NonAsciiPatternWithAdditionalproperties.AdditionalPropertiesBoxedBoolean](#additionalpropertiesboxedboolean)
    boxed class to store validated boolean payloads | +| record | [NonAsciiPatternWithAdditionalproperties.AdditionalPropertiesBoxedNumber](#additionalpropertiesboxednumber)
    boxed class to store validated Number payloads | +| record | [NonAsciiPatternWithAdditionalproperties.AdditionalPropertiesBoxedString](#additionalpropertiesboxedstring)
    boxed class to store validated String payloads | +| record | [NonAsciiPatternWithAdditionalproperties.AdditionalPropertiesBoxedList](#additionalpropertiesboxedlist)
    boxed class to store validated List payloads | +| record | [NonAsciiPatternWithAdditionalproperties.AdditionalPropertiesBoxedMap](#additionalpropertiesboxedmap)
    boxed class to store validated Map payloads | +| static class | [NonAsciiPatternWithAdditionalproperties.AdditionalProperties](#additionalproperties)
    schema class | + +## NonAsciiPatternWithAdditionalproperties1Boxed +sealed interface NonAsciiPatternWithAdditionalproperties1Boxed
    +permits
    +[NonAsciiPatternWithAdditionalproperties1BoxedMap](#nonasciipatternwithadditionalproperties1boxedmap) + +sealed interface that stores validated payloads using boxed classes + +## NonAsciiPatternWithAdditionalproperties1BoxedMap +data class NonAsciiPatternWithAdditionalproperties1BoxedMap
    +implements [NonAsciiPatternWithAdditionalproperties1Boxed](#nonasciipatternwithadditionalproperties1boxed) + +data class that stores validated Map payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| NonAsciiPatternWithAdditionalproperties1BoxedMap([NonAsciiPatternWithAdditionalpropertiesMap](#nonasciipatternwithadditionalpropertiesmap) data)
    Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| [NonAsciiPatternWithAdditionalpropertiesMap](#nonasciipatternwithadditionalpropertiesmap) | data()
    validated payload | +| Any? | getData()
    validated payload | + +## NonAsciiPatternWithAdditionalproperties1 +class NonAsciiPatternWithAdditionalproperties1
    +extends JsonSchema + +A schema class that validates payloads + +### Code Sample +``` +import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags; +import org.openapijsonschematools.client.configurations.SchemaConfiguration; +import org.openapijsonschematools.client.exceptions.ValidationException; +import org.openapijsonschematools.client.schemas.validation.MapUtils; +import org.openapijsonschematools.client.schemas.validation.FrozenList; +import org.openapijsonschematools.client.schemas.validation.FrozenMap; +import org.openapijsonschematools.client.components.schemas.NonAsciiPatternWithAdditionalproperties; + +import java.util.Arrays; +import java.util.List; +import java.util.AbstractMap; + +static final SchemaConfiguration configuration = new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().build()); + +// Map validation +NonAsciiPatternWithAdditionalproperties.NonAsciiPatternWithAdditionalpropertiesMap validatedPayload = + NonAsciiPatternWithAdditionalproperties.NonAsciiPatternWithAdditionalproperties1.validate( + new NonAsciiPatternWithAdditionalproperties.NonAsciiPatternWithAdditionalpropertiesMapBuilder() + .build(), + configuration +); +``` + +### Field Summary +| Modifier and Type | Field and Description | +| ----------------- | ---------------------- | +| Set> | type = setOf(Map::class.java) | +| Class | additionalProperties = [AdditionalProperties::class.java](#additionalproperties) | +| Map> | patternProperties = mapOf(
        new AbstractMap.SimpleEntry<>(Pattern.compile("^á"), [CircumflexAccentLatinSmallLetterAWithAcute::class.java](#circumflexaccentlatinsmallletterawithacute)))
    )
    | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| [NonAsciiPatternWithAdditionalpropertiesMap](#nonasciipatternwithadditionalpropertiesmap) | validate(arg: [Map<?, ?>](#nonasciipatternwithadditionalpropertiesmapbuilder), configuration: SchemaConfiguration) | +| [NonAsciiPatternWithAdditionalproperties1BoxedMap](#nonasciipatternwithadditionalproperties1boxedmap) | validateAndBox([Map<?, ?>](#nonasciipatternwithadditionalpropertiesmapbuilder), configuration: SchemaConfiguration) | +| [NonAsciiPatternWithAdditionalproperties1Boxed](#nonasciipatternwithadditionalproperties1boxed) | validateAndBox(Any?, configuration: SchemaConfiguration) | +| Any? | validate(arg: Any?, configuration: SchemaConfiguration) | + +## NonAsciiPatternWithAdditionalpropertiesMapBuilder +class NonAsciiPatternWithAdditionalpropertiesMapBuilder
    +builder for `Map` + +A class that builds the Map input type + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| NonAsciiPatternWithAdditionalpropertiesMapBuilder()
    Creates a builder that contains an empty map | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| Map | build()
    Returns map input that should be used with Schema.validate | + +## NonAsciiPatternWithAdditionalpropertiesMap +class NonAsciiPatternWithAdditionalpropertiesMap
    +extends FrozenMap + +A class to store validated Map payloads + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| static [NonAsciiPatternWithAdditionalpropertiesMap](#nonasciipatternwithadditionalpropertiesmap) | of([Map](#nonasciipatternwithadditionalpropertiesmapbuilder) arg, SchemaConfiguration configuration) | + +## CircumflexAccentLatinSmallLetterAWithAcuteBoxed +sealed interface CircumflexAccentLatinSmallLetterAWithAcuteBoxed
    +permits
    +[CircumflexAccentLatinSmallLetterAWithAcuteBoxedVoid](#circumflexaccentlatinsmallletterawithacuteboxedvoid), +[CircumflexAccentLatinSmallLetterAWithAcuteBoxedBoolean](#circumflexaccentlatinsmallletterawithacuteboxedboolean), +[CircumflexAccentLatinSmallLetterAWithAcuteBoxedNumber](#circumflexaccentlatinsmallletterawithacuteboxednumber), +[CircumflexAccentLatinSmallLetterAWithAcuteBoxedString](#circumflexaccentlatinsmallletterawithacuteboxedstring), +[CircumflexAccentLatinSmallLetterAWithAcuteBoxedList](#circumflexaccentlatinsmallletterawithacuteboxedlist), +[CircumflexAccentLatinSmallLetterAWithAcuteBoxedMap](#circumflexaccentlatinsmallletterawithacuteboxedmap) + +sealed interface that stores validated payloads using boxed classes + +## CircumflexAccentLatinSmallLetterAWithAcuteBoxedVoid +data class CircumflexAccentLatinSmallLetterAWithAcuteBoxedVoid
    +implements [CircumflexAccentLatinSmallLetterAWithAcuteBoxed](#circumflexaccentlatinsmallletterawithacuteboxed) + +data class that stores validated null payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| CircumflexAccentLatinSmallLetterAWithAcuteBoxedVoid(Nothing? data)
    Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| Nothing? | data()
    validated payload | +| Any? | getData()
    validated payload | + +## CircumflexAccentLatinSmallLetterAWithAcuteBoxedBoolean +data class CircumflexAccentLatinSmallLetterAWithAcuteBoxedBoolean
    +implements [CircumflexAccentLatinSmallLetterAWithAcuteBoxed](#circumflexaccentlatinsmallletterawithacuteboxed) + +record that stores validated boolean payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| CircumflexAccentLatinSmallLetterAWithAcuteBoxedBoolean(boolean data)
    Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| boolean | data()
    validated payload | +| Any? | getData()
    validated payload | + +## CircumflexAccentLatinSmallLetterAWithAcuteBoxedNumber +data class CircumflexAccentLatinSmallLetterAWithAcuteBoxedNumber
    +implements [CircumflexAccentLatinSmallLetterAWithAcuteBoxed](#circumflexaccentlatinsmallletterawithacuteboxed) + +data class that stores validated Number payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| CircumflexAccentLatinSmallLetterAWithAcuteBoxedNumber(Number data)
    Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| Number | data()
    validated payload | +| Any? | getData()
    validated payload | + +## CircumflexAccentLatinSmallLetterAWithAcuteBoxedString +data class CircumflexAccentLatinSmallLetterAWithAcuteBoxedString
    +implements [CircumflexAccentLatinSmallLetterAWithAcuteBoxed](#circumflexaccentlatinsmallletterawithacuteboxed) + +data class that stores validated String payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| CircumflexAccentLatinSmallLetterAWithAcuteBoxedString(String data)
    Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| String | data()
    validated payload | +| Any? | getData()
    validated payload | + +## CircumflexAccentLatinSmallLetterAWithAcuteBoxedList +data class CircumflexAccentLatinSmallLetterAWithAcuteBoxedList
    +implements [CircumflexAccentLatinSmallLetterAWithAcuteBoxed](#circumflexaccentlatinsmallletterawithacuteboxed) + +data class that stores validated List payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| CircumflexAccentLatinSmallLetterAWithAcuteBoxedList(FrozenList data)
    Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| FrozenList | data()
    validated payload | +| Any? | getData()
    validated payload | + +## CircumflexAccentLatinSmallLetterAWithAcuteBoxedMap +data class CircumflexAccentLatinSmallLetterAWithAcuteBoxedMap
    +implements [CircumflexAccentLatinSmallLetterAWithAcuteBoxed](#circumflexaccentlatinsmallletterawithacuteboxed) + +data class that stores validated Map payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| CircumflexAccentLatinSmallLetterAWithAcuteBoxedMap(FrozenMap data)
    Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| FrozenMap | data()
    validated payload | +| Any? | getData()
    validated payload | + +## CircumflexAccentLatinSmallLetterAWithAcute +class CircumflexAccentLatinSmallLetterAWithAcute
    +extends AnyTypeJsonSchema.AnyTypeJsonSchema1 + +A schema class that validates payloads + +| Methods Inherited from class org.openapijsonschematools.client.schemas.AnyTypeJsonSchema.AnyTypeJsonSchema1 | +| ------------------------------------------------------------------ | +| validate | +| validateAndBox | + +## AdditionalPropertiesBoxed +sealed interface AdditionalPropertiesBoxed
    +permits
    +[AdditionalPropertiesBoxedVoid](#additionalpropertiesboxedvoid), +[AdditionalPropertiesBoxedBoolean](#additionalpropertiesboxedboolean), +[AdditionalPropertiesBoxedNumber](#additionalpropertiesboxednumber), +[AdditionalPropertiesBoxedString](#additionalpropertiesboxedstring), +[AdditionalPropertiesBoxedList](#additionalpropertiesboxedlist), +[AdditionalPropertiesBoxedMap](#additionalpropertiesboxedmap) + +sealed interface that stores validated payloads using boxed classes + +## AdditionalPropertiesBoxedVoid +data class AdditionalPropertiesBoxedVoid
    +implements [AdditionalPropertiesBoxed](#additionalpropertiesboxed) + +data class that stores validated null payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| AdditionalPropertiesBoxedVoid(Nothing? data)
    Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| Nothing? | data()
    validated payload | +| Any? | getData()
    validated payload | + +## AdditionalPropertiesBoxedBoolean +data class AdditionalPropertiesBoxedBoolean
    +implements [AdditionalPropertiesBoxed](#additionalpropertiesboxed) + +record that stores validated boolean payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| AdditionalPropertiesBoxedBoolean(boolean data)
    Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| boolean | data()
    validated payload | +| Any? | getData()
    validated payload | + +## AdditionalPropertiesBoxedNumber +data class AdditionalPropertiesBoxedNumber
    +implements [AdditionalPropertiesBoxed](#additionalpropertiesboxed) + +data class that stores validated Number payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| AdditionalPropertiesBoxedNumber(Number data)
    Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| Number | data()
    validated payload | +| Any? | getData()
    validated payload | + +## AdditionalPropertiesBoxedString +data class AdditionalPropertiesBoxedString
    +implements [AdditionalPropertiesBoxed](#additionalpropertiesboxed) + +data class that stores validated String payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| AdditionalPropertiesBoxedString(String data)
    Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| String | data()
    validated payload | +| Any? | getData()
    validated payload | + +## AdditionalPropertiesBoxedList +data class AdditionalPropertiesBoxedList
    +implements [AdditionalPropertiesBoxed](#additionalpropertiesboxed) + +data class that stores validated List payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| AdditionalPropertiesBoxedList(FrozenList data)
    Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| FrozenList | data()
    validated payload | +| Any? | getData()
    validated payload | + +## AdditionalPropertiesBoxedMap +data class AdditionalPropertiesBoxedMap
    +implements [AdditionalPropertiesBoxed](#additionalpropertiesboxed) + +data class that stores validated Map payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| AdditionalPropertiesBoxedMap(FrozenMap data)
    Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| FrozenMap | data()
    validated payload | +| Any? | getData()
    validated payload | + +## AdditionalProperties +class AdditionalProperties
    +extends NotAnyTypeJsonSchema.NotAnyTypeJsonSchema1 + +A schema class that validates payloads + +| Methods Inherited from class org.openapijsonschematools.client.schemas.NotAnyTypeJsonSchema.NotAnyTypeJsonSchema1 | +| ------------------------------------------------------------------ | +| validate | +| validateAndBox | + +[[Back to top]](#top) [[Back to Component Schemas]](../../../README.md#Component-Schemas) [[Back to README]](../../../README.md) diff --git a/samples/client/3_1_0_unit_test/kotlin/docs/components/schemas/NonInterferenceAcrossCombinedSchemas.md b/samples/client/3_1_0_unit_test/kotlin/docs/components/schemas/NonInterferenceAcrossCombinedSchemas.md new file mode 100644 index 00000000000..39f210a06d0 --- /dev/null +++ b/samples/client/3_1_0_unit_test/kotlin/docs/components/schemas/NonInterferenceAcrossCombinedSchemas.md @@ -0,0 +1,1099 @@ +# NonInterferenceAcrossCombinedSchemas +org.openapijsonschematools.client.components.schemas.NonInterferenceAcrossCombinedSchemas.java +class NonInterferenceAcrossCombinedSchemas
    + +A class that contains necessary nested +- schema classes (which validate payloads), extends JsonSchema +- sealed interfaces which store validated payloads, Kotlin version of a sum type +- boxed classes which store validated payloads, sealed permits class implementations + +## Nested Class Summary +| Modifier and Type | Class and Description | +| ----------------- | ---------------------- | +| sealed interface | [NonInterferenceAcrossCombinedSchemas.NonInterferenceAcrossCombinedSchemas1Boxed](#noninterferenceacrosscombinedschemas1boxed)
    sealed interface for validated payloads | +| record | [NonInterferenceAcrossCombinedSchemas.NonInterferenceAcrossCombinedSchemas1BoxedVoid](#noninterferenceacrosscombinedschemas1boxedvoid)
    boxed class to store validated null payloads | +| record | [NonInterferenceAcrossCombinedSchemas.NonInterferenceAcrossCombinedSchemas1BoxedBoolean](#noninterferenceacrosscombinedschemas1boxedboolean)
    boxed class to store validated boolean payloads | +| record | [NonInterferenceAcrossCombinedSchemas.NonInterferenceAcrossCombinedSchemas1BoxedNumber](#noninterferenceacrosscombinedschemas1boxednumber)
    boxed class to store validated Number payloads | +| record | [NonInterferenceAcrossCombinedSchemas.NonInterferenceAcrossCombinedSchemas1BoxedString](#noninterferenceacrosscombinedschemas1boxedstring)
    boxed class to store validated String payloads | +| record | [NonInterferenceAcrossCombinedSchemas.NonInterferenceAcrossCombinedSchemas1BoxedList](#noninterferenceacrosscombinedschemas1boxedlist)
    boxed class to store validated List payloads | +| record | [NonInterferenceAcrossCombinedSchemas.NonInterferenceAcrossCombinedSchemas1BoxedMap](#noninterferenceacrosscombinedschemas1boxedmap)
    boxed class to store validated Map payloads | +| static class | [NonInterferenceAcrossCombinedSchemas.NonInterferenceAcrossCombinedSchemas1](#noninterferenceacrosscombinedschemas1)
    schema class | +| sealed interface | [NonInterferenceAcrossCombinedSchemas.Schema2Boxed](#schema2boxed)
    sealed interface for validated payloads | +| record | [NonInterferenceAcrossCombinedSchemas.Schema2BoxedVoid](#schema2boxedvoid)
    boxed class to store validated null payloads | +| record | [NonInterferenceAcrossCombinedSchemas.Schema2BoxedBoolean](#schema2boxedboolean)
    boxed class to store validated boolean payloads | +| record | [NonInterferenceAcrossCombinedSchemas.Schema2BoxedNumber](#schema2boxednumber)
    boxed class to store validated Number payloads | +| record | [NonInterferenceAcrossCombinedSchemas.Schema2BoxedString](#schema2boxedstring)
    boxed class to store validated String payloads | +| record | [NonInterferenceAcrossCombinedSchemas.Schema2BoxedList](#schema2boxedlist)
    boxed class to store validated List payloads | +| record | [NonInterferenceAcrossCombinedSchemas.Schema2BoxedMap](#schema2boxedmap)
    boxed class to store validated Map payloads | +| static class | [NonInterferenceAcrossCombinedSchemas.Schema2](#schema2)
    schema class | +| sealed interface | [NonInterferenceAcrossCombinedSchemas.ElseSchemaBoxed](#elseschemaboxed)
    sealed interface for validated payloads | +| record | [NonInterferenceAcrossCombinedSchemas.ElseSchemaBoxedVoid](#elseschemaboxedvoid)
    boxed class to store validated null payloads | +| record | [NonInterferenceAcrossCombinedSchemas.ElseSchemaBoxedBoolean](#elseschemaboxedboolean)
    boxed class to store validated boolean payloads | +| record | [NonInterferenceAcrossCombinedSchemas.ElseSchemaBoxedNumber](#elseschemaboxednumber)
    boxed class to store validated Number payloads | +| record | [NonInterferenceAcrossCombinedSchemas.ElseSchemaBoxedString](#elseschemaboxedstring)
    boxed class to store validated String payloads | +| record | [NonInterferenceAcrossCombinedSchemas.ElseSchemaBoxedList](#elseschemaboxedlist)
    boxed class to store validated List payloads | +| record | [NonInterferenceAcrossCombinedSchemas.ElseSchemaBoxedMap](#elseschemaboxedmap)
    boxed class to store validated Map payloads | +| static class | [NonInterferenceAcrossCombinedSchemas.ElseSchema](#elseschema)
    schema class | +| sealed interface | [NonInterferenceAcrossCombinedSchemas.Schema1Boxed](#schema1boxed)
    sealed interface for validated payloads | +| record | [NonInterferenceAcrossCombinedSchemas.Schema1BoxedVoid](#schema1boxedvoid)
    boxed class to store validated null payloads | +| record | [NonInterferenceAcrossCombinedSchemas.Schema1BoxedBoolean](#schema1boxedboolean)
    boxed class to store validated boolean payloads | +| record | [NonInterferenceAcrossCombinedSchemas.Schema1BoxedNumber](#schema1boxednumber)
    boxed class to store validated Number payloads | +| record | [NonInterferenceAcrossCombinedSchemas.Schema1BoxedString](#schema1boxedstring)
    boxed class to store validated String payloads | +| record | [NonInterferenceAcrossCombinedSchemas.Schema1BoxedList](#schema1boxedlist)
    boxed class to store validated List payloads | +| record | [NonInterferenceAcrossCombinedSchemas.Schema1BoxedMap](#schema1boxedmap)
    boxed class to store validated Map payloads | +| static class | [NonInterferenceAcrossCombinedSchemas.Schema1](#schema1)
    schema class | +| sealed interface | [NonInterferenceAcrossCombinedSchemas.ThenBoxed](#thenboxed)
    sealed interface for validated payloads | +| record | [NonInterferenceAcrossCombinedSchemas.ThenBoxedVoid](#thenboxedvoid)
    boxed class to store validated null payloads | +| record | [NonInterferenceAcrossCombinedSchemas.ThenBoxedBoolean](#thenboxedboolean)
    boxed class to store validated boolean payloads | +| record | [NonInterferenceAcrossCombinedSchemas.ThenBoxedNumber](#thenboxednumber)
    boxed class to store validated Number payloads | +| record | [NonInterferenceAcrossCombinedSchemas.ThenBoxedString](#thenboxedstring)
    boxed class to store validated String payloads | +| record | [NonInterferenceAcrossCombinedSchemas.ThenBoxedList](#thenboxedlist)
    boxed class to store validated List payloads | +| record | [NonInterferenceAcrossCombinedSchemas.ThenBoxedMap](#thenboxedmap)
    boxed class to store validated Map payloads | +| static class | [NonInterferenceAcrossCombinedSchemas.Then](#then)
    schema class | +| sealed interface | [NonInterferenceAcrossCombinedSchemas.Schema0Boxed](#schema0boxed)
    sealed interface for validated payloads | +| record | [NonInterferenceAcrossCombinedSchemas.Schema0BoxedVoid](#schema0boxedvoid)
    boxed class to store validated null payloads | +| record | [NonInterferenceAcrossCombinedSchemas.Schema0BoxedBoolean](#schema0boxedboolean)
    boxed class to store validated boolean payloads | +| record | [NonInterferenceAcrossCombinedSchemas.Schema0BoxedNumber](#schema0boxednumber)
    boxed class to store validated Number payloads | +| record | [NonInterferenceAcrossCombinedSchemas.Schema0BoxedString](#schema0boxedstring)
    boxed class to store validated String payloads | +| record | [NonInterferenceAcrossCombinedSchemas.Schema0BoxedList](#schema0boxedlist)
    boxed class to store validated List payloads | +| record | [NonInterferenceAcrossCombinedSchemas.Schema0BoxedMap](#schema0boxedmap)
    boxed class to store validated Map payloads | +| static class | [NonInterferenceAcrossCombinedSchemas.Schema0](#schema0)
    schema class | +| sealed interface | [NonInterferenceAcrossCombinedSchemas.IfSchemaBoxed](#ifschemaboxed)
    sealed interface for validated payloads | +| record | [NonInterferenceAcrossCombinedSchemas.IfSchemaBoxedVoid](#ifschemaboxedvoid)
    boxed class to store validated null payloads | +| record | [NonInterferenceAcrossCombinedSchemas.IfSchemaBoxedBoolean](#ifschemaboxedboolean)
    boxed class to store validated boolean payloads | +| record | [NonInterferenceAcrossCombinedSchemas.IfSchemaBoxedNumber](#ifschemaboxednumber)
    boxed class to store validated Number payloads | +| record | [NonInterferenceAcrossCombinedSchemas.IfSchemaBoxedString](#ifschemaboxedstring)
    boxed class to store validated String payloads | +| record | [NonInterferenceAcrossCombinedSchemas.IfSchemaBoxedList](#ifschemaboxedlist)
    boxed class to store validated List payloads | +| record | [NonInterferenceAcrossCombinedSchemas.IfSchemaBoxedMap](#ifschemaboxedmap)
    boxed class to store validated Map payloads | +| static class | [NonInterferenceAcrossCombinedSchemas.IfSchema](#ifschema)
    schema class | + +## NonInterferenceAcrossCombinedSchemas1Boxed +sealed interface NonInterferenceAcrossCombinedSchemas1Boxed
    +permits
    +[NonInterferenceAcrossCombinedSchemas1BoxedVoid](#noninterferenceacrosscombinedschemas1boxedvoid), +[NonInterferenceAcrossCombinedSchemas1BoxedBoolean](#noninterferenceacrosscombinedschemas1boxedboolean), +[NonInterferenceAcrossCombinedSchemas1BoxedNumber](#noninterferenceacrosscombinedschemas1boxednumber), +[NonInterferenceAcrossCombinedSchemas1BoxedString](#noninterferenceacrosscombinedschemas1boxedstring), +[NonInterferenceAcrossCombinedSchemas1BoxedList](#noninterferenceacrosscombinedschemas1boxedlist), +[NonInterferenceAcrossCombinedSchemas1BoxedMap](#noninterferenceacrosscombinedschemas1boxedmap) + +sealed interface that stores validated payloads using boxed classes + +## NonInterferenceAcrossCombinedSchemas1BoxedVoid +data class NonInterferenceAcrossCombinedSchemas1BoxedVoid
    +implements [NonInterferenceAcrossCombinedSchemas1Boxed](#noninterferenceacrosscombinedschemas1boxed) + +data class that stores validated null payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| NonInterferenceAcrossCombinedSchemas1BoxedVoid(Nothing? data)
    Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| Nothing? | data()
    validated payload | +| Any? | getData()
    validated payload | + +## NonInterferenceAcrossCombinedSchemas1BoxedBoolean +data class NonInterferenceAcrossCombinedSchemas1BoxedBoolean
    +implements [NonInterferenceAcrossCombinedSchemas1Boxed](#noninterferenceacrosscombinedschemas1boxed) + +record that stores validated boolean payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| NonInterferenceAcrossCombinedSchemas1BoxedBoolean(boolean data)
    Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| boolean | data()
    validated payload | +| Any? | getData()
    validated payload | + +## NonInterferenceAcrossCombinedSchemas1BoxedNumber +data class NonInterferenceAcrossCombinedSchemas1BoxedNumber
    +implements [NonInterferenceAcrossCombinedSchemas1Boxed](#noninterferenceacrosscombinedschemas1boxed) + +data class that stores validated Number payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| NonInterferenceAcrossCombinedSchemas1BoxedNumber(Number data)
    Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| Number | data()
    validated payload | +| Any? | getData()
    validated payload | + +## NonInterferenceAcrossCombinedSchemas1BoxedString +data class NonInterferenceAcrossCombinedSchemas1BoxedString
    +implements [NonInterferenceAcrossCombinedSchemas1Boxed](#noninterferenceacrosscombinedschemas1boxed) + +data class that stores validated String payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| NonInterferenceAcrossCombinedSchemas1BoxedString(String data)
    Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| String | data()
    validated payload | +| Any? | getData()
    validated payload | + +## NonInterferenceAcrossCombinedSchemas1BoxedList +data class NonInterferenceAcrossCombinedSchemas1BoxedList
    +implements [NonInterferenceAcrossCombinedSchemas1Boxed](#noninterferenceacrosscombinedschemas1boxed) + +data class that stores validated List payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| NonInterferenceAcrossCombinedSchemas1BoxedList(FrozenList data)
    Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| FrozenList | data()
    validated payload | +| Any? | getData()
    validated payload | + +## NonInterferenceAcrossCombinedSchemas1BoxedMap +data class NonInterferenceAcrossCombinedSchemas1BoxedMap
    +implements [NonInterferenceAcrossCombinedSchemas1Boxed](#noninterferenceacrosscombinedschemas1boxed) + +data class that stores validated Map payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| NonInterferenceAcrossCombinedSchemas1BoxedMap(FrozenMap data)
    Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| FrozenMap | data()
    validated payload | +| Any? | getData()
    validated payload | + +## NonInterferenceAcrossCombinedSchemas1 +class NonInterferenceAcrossCombinedSchemas1
    +extends JsonSchema + +A schema class that validates payloads + +### Field Summary +| Modifier and Type | Field and Description | +| ----------------- | ---------------------- | +| List> | allOf = listOf(
        [Schema0::class.java](#schema0),
        [Schema1::class.java](#schema1),
        [Schema2::class.java](#schema2)
    ;)
    | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| String | validate(arg: String, configuration: SchemaConfiguration) | +| Nothing? | validate(arg: Nothing?, configuration: SchemaConfiguration) | +| int | validate(arg: int, configuration: SchemaConfiguration) | +| long | validate(arg: long, configuration: SchemaConfiguration) | +| float | validate(arg: float, configuration: SchemaConfiguration) | +| double | validate(arg: double, configuration: SchemaConfiguration) | +| Number | validate(arg: Number, configuration: SchemaConfiguration) | +| boolean | validate(arg: boolean, configuration: SchemaConfiguration) | +| FrozenMap | validate(arg: Map<?, ?>, configuration: SchemaConfiguration) | +| FrozenList | validate(arg: List<*>, configuration: SchemaConfiguration) | +| [NonInterferenceAcrossCombinedSchemas1BoxedString](#noninterferenceacrosscombinedschemas1boxedstring) | validateAndBox(String, configuration: SchemaConfiguration) | +| [NonInterferenceAcrossCombinedSchemas1BoxedVoid](#noninterferenceacrosscombinedschemas1boxedvoid) | validateAndBox(Nothing?, configuration: SchemaConfiguration) | +| [NonInterferenceAcrossCombinedSchemas1BoxedNumber](#noninterferenceacrosscombinedschemas1boxednumber) | validateAndBox(Number, configuration: SchemaConfiguration) | +| [NonInterferenceAcrossCombinedSchemas1BoxedBoolean](#noninterferenceacrosscombinedschemas1boxedboolean) | validateAndBox(boolean, configuration: SchemaConfiguration) | +| [NonInterferenceAcrossCombinedSchemas1BoxedMap](#noninterferenceacrosscombinedschemas1boxedmap) | validateAndBox(Map<?, ?>, configuration: SchemaConfiguration) | +| [NonInterferenceAcrossCombinedSchemas1BoxedList](#noninterferenceacrosscombinedschemas1boxedlist) | validateAndBox(List<*>, configuration: SchemaConfiguration) | +| [NonInterferenceAcrossCombinedSchemas1Boxed](#noninterferenceacrosscombinedschemas1boxed) | validateAndBox(Any?, configuration: SchemaConfiguration) | +| Any? | validate(arg: Any?, configuration: SchemaConfiguration) | + +## Schema2Boxed +sealed interface Schema2Boxed
    +permits
    +[Schema2BoxedVoid](#schema2boxedvoid), +[Schema2BoxedBoolean](#schema2boxedboolean), +[Schema2BoxedNumber](#schema2boxednumber), +[Schema2BoxedString](#schema2boxedstring), +[Schema2BoxedList](#schema2boxedlist), +[Schema2BoxedMap](#schema2boxedmap) + +sealed interface that stores validated payloads using boxed classes + +## Schema2BoxedVoid +data class Schema2BoxedVoid
    +implements [Schema2Boxed](#schema2boxed) + +data class that stores validated null payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| Schema2BoxedVoid(Nothing? data)
    Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| Nothing? | data()
    validated payload | +| Any? | getData()
    validated payload | + +## Schema2BoxedBoolean +data class Schema2BoxedBoolean
    +implements [Schema2Boxed](#schema2boxed) + +record that stores validated boolean payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| Schema2BoxedBoolean(boolean data)
    Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| boolean | data()
    validated payload | +| Any? | getData()
    validated payload | + +## Schema2BoxedNumber +data class Schema2BoxedNumber
    +implements [Schema2Boxed](#schema2boxed) + +data class that stores validated Number payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| Schema2BoxedNumber(Number data)
    Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| Number | data()
    validated payload | +| Any? | getData()
    validated payload | + +## Schema2BoxedString +data class Schema2BoxedString
    +implements [Schema2Boxed](#schema2boxed) + +data class that stores validated String payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| Schema2BoxedString(String data)
    Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| String | data()
    validated payload | +| Any? | getData()
    validated payload | + +## Schema2BoxedList +data class Schema2BoxedList
    +implements [Schema2Boxed](#schema2boxed) + +data class that stores validated List payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| Schema2BoxedList(FrozenList data)
    Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| FrozenList | data()
    validated payload | +| Any? | getData()
    validated payload | + +## Schema2BoxedMap +data class Schema2BoxedMap
    +implements [Schema2Boxed](#schema2boxed) + +data class that stores validated Map payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| Schema2BoxedMap(FrozenMap data)
    Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| FrozenMap | data()
    validated payload | +| Any? | getData()
    validated payload | + +## Schema2 +class Schema2
    +extends JsonSchema + +A schema class that validates payloads + +### Field Summary +| Modifier and Type | Field and Description | +| ----------------- | ---------------------- | +| Class | elseSchema = [ElseSchema::class.java](#elseschema) | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| String | validate(arg: String, configuration: SchemaConfiguration) | +| Nothing? | validate(arg: Nothing?, configuration: SchemaConfiguration) | +| int | validate(arg: int, configuration: SchemaConfiguration) | +| long | validate(arg: long, configuration: SchemaConfiguration) | +| float | validate(arg: float, configuration: SchemaConfiguration) | +| double | validate(arg: double, configuration: SchemaConfiguration) | +| Number | validate(arg: Number, configuration: SchemaConfiguration) | +| boolean | validate(arg: boolean, configuration: SchemaConfiguration) | +| FrozenMap | validate(arg: Map<?, ?>, configuration: SchemaConfiguration) | +| FrozenList | validate(arg: List<*>, configuration: SchemaConfiguration) | +| [Schema2BoxedString](#schema2boxedstring) | validateAndBox(String, configuration: SchemaConfiguration) | +| [Schema2BoxedVoid](#schema2boxedvoid) | validateAndBox(Nothing?, configuration: SchemaConfiguration) | +| [Schema2BoxedNumber](#schema2boxednumber) | validateAndBox(Number, configuration: SchemaConfiguration) | +| [Schema2BoxedBoolean](#schema2boxedboolean) | validateAndBox(boolean, configuration: SchemaConfiguration) | +| [Schema2BoxedMap](#schema2boxedmap) | validateAndBox(Map<?, ?>, configuration: SchemaConfiguration) | +| [Schema2BoxedList](#schema2boxedlist) | validateAndBox(List<*>, configuration: SchemaConfiguration) | +| [Schema2Boxed](#schema2boxed) | validateAndBox(Any?, configuration: SchemaConfiguration) | +| Any? | validate(arg: Any?, configuration: SchemaConfiguration) | + +## ElseSchemaBoxed +sealed interface ElseSchemaBoxed
    +permits
    +[ElseSchemaBoxedVoid](#elseschemaboxedvoid), +[ElseSchemaBoxedBoolean](#elseschemaboxedboolean), +[ElseSchemaBoxedNumber](#elseschemaboxednumber), +[ElseSchemaBoxedString](#elseschemaboxedstring), +[ElseSchemaBoxedList](#elseschemaboxedlist), +[ElseSchemaBoxedMap](#elseschemaboxedmap) + +sealed interface that stores validated payloads using boxed classes + +## ElseSchemaBoxedVoid +data class ElseSchemaBoxedVoid
    +implements [ElseSchemaBoxed](#elseschemaboxed) + +data class that stores validated null payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| ElseSchemaBoxedVoid(Nothing? data)
    Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| Nothing? | data()
    validated payload | +| Any? | getData()
    validated payload | + +## ElseSchemaBoxedBoolean +data class ElseSchemaBoxedBoolean
    +implements [ElseSchemaBoxed](#elseschemaboxed) + +record that stores validated boolean payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| ElseSchemaBoxedBoolean(boolean data)
    Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| boolean | data()
    validated payload | +| Any? | getData()
    validated payload | + +## ElseSchemaBoxedNumber +data class ElseSchemaBoxedNumber
    +implements [ElseSchemaBoxed](#elseschemaboxed) + +data class that stores validated Number payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| ElseSchemaBoxedNumber(Number data)
    Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| Number | data()
    validated payload | +| Any? | getData()
    validated payload | + +## ElseSchemaBoxedString +data class ElseSchemaBoxedString
    +implements [ElseSchemaBoxed](#elseschemaboxed) + +data class that stores validated String payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| ElseSchemaBoxedString(String data)
    Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| String | data()
    validated payload | +| Any? | getData()
    validated payload | + +## ElseSchemaBoxedList +data class ElseSchemaBoxedList
    +implements [ElseSchemaBoxed](#elseschemaboxed) + +data class that stores validated List payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| ElseSchemaBoxedList(FrozenList data)
    Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| FrozenList | data()
    validated payload | +| Any? | getData()
    validated payload | + +## ElseSchemaBoxedMap +data class ElseSchemaBoxedMap
    +implements [ElseSchemaBoxed](#elseschemaboxed) + +data class that stores validated Map payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| ElseSchemaBoxedMap(FrozenMap data)
    Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| FrozenMap | data()
    validated payload | +| Any? | getData()
    validated payload | + +## ElseSchema +class ElseSchema
    +extends JsonSchema + +A schema class that validates payloads + +### Field Summary +| Modifier and Type | Field and Description | +| ----------------- | ---------------------- | +| BigDecimal | multipleOf = BigDecimal("2") | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| String | validate(arg: String, configuration: SchemaConfiguration) | +| Nothing? | validate(arg: Nothing?, configuration: SchemaConfiguration) | +| int | validate(arg: int, configuration: SchemaConfiguration) | +| long | validate(arg: long, configuration: SchemaConfiguration) | +| float | validate(arg: float, configuration: SchemaConfiguration) | +| double | validate(arg: double, configuration: SchemaConfiguration) | +| Number | validate(arg: Number, configuration: SchemaConfiguration) | +| boolean | validate(arg: boolean, configuration: SchemaConfiguration) | +| FrozenMap | validate(arg: Map<?, ?>, configuration: SchemaConfiguration) | +| FrozenList | validate(arg: List<*>, configuration: SchemaConfiguration) | +| [ElseSchemaBoxedString](#elseschemaboxedstring) | validateAndBox(String, configuration: SchemaConfiguration) | +| [ElseSchemaBoxedVoid](#elseschemaboxedvoid) | validateAndBox(Nothing?, configuration: SchemaConfiguration) | +| [ElseSchemaBoxedNumber](#elseschemaboxednumber) | validateAndBox(Number, configuration: SchemaConfiguration) | +| [ElseSchemaBoxedBoolean](#elseschemaboxedboolean) | validateAndBox(boolean, configuration: SchemaConfiguration) | +| [ElseSchemaBoxedMap](#elseschemaboxedmap) | validateAndBox(Map<?, ?>, configuration: SchemaConfiguration) | +| [ElseSchemaBoxedList](#elseschemaboxedlist) | validateAndBox(List<*>, configuration: SchemaConfiguration) | +| [ElseSchemaBoxed](#elseschemaboxed) | validateAndBox(Any?, configuration: SchemaConfiguration) | +| Any? | validate(arg: Any?, configuration: SchemaConfiguration) | + +## Schema1Boxed +sealed interface Schema1Boxed
    +permits
    +[Schema1BoxedVoid](#schema1boxedvoid), +[Schema1BoxedBoolean](#schema1boxedboolean), +[Schema1BoxedNumber](#schema1boxednumber), +[Schema1BoxedString](#schema1boxedstring), +[Schema1BoxedList](#schema1boxedlist), +[Schema1BoxedMap](#schema1boxedmap) + +sealed interface that stores validated payloads using boxed classes + +## Schema1BoxedVoid +data class Schema1BoxedVoid
    +implements [Schema1Boxed](#schema1boxed) + +data class that stores validated null payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| Schema1BoxedVoid(Nothing? data)
    Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| Nothing? | data()
    validated payload | +| Any? | getData()
    validated payload | + +## Schema1BoxedBoolean +data class Schema1BoxedBoolean
    +implements [Schema1Boxed](#schema1boxed) + +record that stores validated boolean payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| Schema1BoxedBoolean(boolean data)
    Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| boolean | data()
    validated payload | +| Any? | getData()
    validated payload | + +## Schema1BoxedNumber +data class Schema1BoxedNumber
    +implements [Schema1Boxed](#schema1boxed) + +data class that stores validated Number payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| Schema1BoxedNumber(Number data)
    Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| Number | data()
    validated payload | +| Any? | getData()
    validated payload | + +## Schema1BoxedString +data class Schema1BoxedString
    +implements [Schema1Boxed](#schema1boxed) + +data class that stores validated String payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| Schema1BoxedString(String data)
    Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| String | data()
    validated payload | +| Any? | getData()
    validated payload | + +## Schema1BoxedList +data class Schema1BoxedList
    +implements [Schema1Boxed](#schema1boxed) + +data class that stores validated List payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| Schema1BoxedList(FrozenList data)
    Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| FrozenList | data()
    validated payload | +| Any? | getData()
    validated payload | + +## Schema1BoxedMap +data class Schema1BoxedMap
    +implements [Schema1Boxed](#schema1boxed) + +data class that stores validated Map payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| Schema1BoxedMap(FrozenMap data)
    Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| FrozenMap | data()
    validated payload | +| Any? | getData()
    validated payload | + +## Schema1 +class Schema1
    +extends JsonSchema + +A schema class that validates payloads + +### Field Summary +| Modifier and Type | Field and Description | +| ----------------- | ---------------------- | +| Class | then = [Then::class.java](#then) | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| String | validate(arg: String, configuration: SchemaConfiguration) | +| Nothing? | validate(arg: Nothing?, configuration: SchemaConfiguration) | +| int | validate(arg: int, configuration: SchemaConfiguration) | +| long | validate(arg: long, configuration: SchemaConfiguration) | +| float | validate(arg: float, configuration: SchemaConfiguration) | +| double | validate(arg: double, configuration: SchemaConfiguration) | +| Number | validate(arg: Number, configuration: SchemaConfiguration) | +| boolean | validate(arg: boolean, configuration: SchemaConfiguration) | +| FrozenMap | validate(arg: Map<?, ?>, configuration: SchemaConfiguration) | +| FrozenList | validate(arg: List<*>, configuration: SchemaConfiguration) | +| [Schema1BoxedString](#schema1boxedstring) | validateAndBox(String, configuration: SchemaConfiguration) | +| [Schema1BoxedVoid](#schema1boxedvoid) | validateAndBox(Nothing?, configuration: SchemaConfiguration) | +| [Schema1BoxedNumber](#schema1boxednumber) | validateAndBox(Number, configuration: SchemaConfiguration) | +| [Schema1BoxedBoolean](#schema1boxedboolean) | validateAndBox(boolean, configuration: SchemaConfiguration) | +| [Schema1BoxedMap](#schema1boxedmap) | validateAndBox(Map<?, ?>, configuration: SchemaConfiguration) | +| [Schema1BoxedList](#schema1boxedlist) | validateAndBox(List<*>, configuration: SchemaConfiguration) | +| [Schema1Boxed](#schema1boxed) | validateAndBox(Any?, configuration: SchemaConfiguration) | +| Any? | validate(arg: Any?, configuration: SchemaConfiguration) | + +## ThenBoxed +sealed interface ThenBoxed
    +permits
    +[ThenBoxedVoid](#thenboxedvoid), +[ThenBoxedBoolean](#thenboxedboolean), +[ThenBoxedNumber](#thenboxednumber), +[ThenBoxedString](#thenboxedstring), +[ThenBoxedList](#thenboxedlist), +[ThenBoxedMap](#thenboxedmap) + +sealed interface that stores validated payloads using boxed classes + +## ThenBoxedVoid +data class ThenBoxedVoid
    +implements [ThenBoxed](#thenboxed) + +data class that stores validated null payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| ThenBoxedVoid(Nothing? data)
    Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| Nothing? | data()
    validated payload | +| Any? | getData()
    validated payload | + +## ThenBoxedBoolean +data class ThenBoxedBoolean
    +implements [ThenBoxed](#thenboxed) + +record that stores validated boolean payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| ThenBoxedBoolean(boolean data)
    Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| boolean | data()
    validated payload | +| Any? | getData()
    validated payload | + +## ThenBoxedNumber +data class ThenBoxedNumber
    +implements [ThenBoxed](#thenboxed) + +data class that stores validated Number payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| ThenBoxedNumber(Number data)
    Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| Number | data()
    validated payload | +| Any? | getData()
    validated payload | + +## ThenBoxedString +data class ThenBoxedString
    +implements [ThenBoxed](#thenboxed) + +data class that stores validated String payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| ThenBoxedString(String data)
    Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| String | data()
    validated payload | +| Any? | getData()
    validated payload | + +## ThenBoxedList +data class ThenBoxedList
    +implements [ThenBoxed](#thenboxed) + +data class that stores validated List payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| ThenBoxedList(FrozenList data)
    Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| FrozenList | data()
    validated payload | +| Any? | getData()
    validated payload | + +## ThenBoxedMap +data class ThenBoxedMap
    +implements [ThenBoxed](#thenboxed) + +data class that stores validated Map payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| ThenBoxedMap(FrozenMap data)
    Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| FrozenMap | data()
    validated payload | +| Any? | getData()
    validated payload | + +## Then +class Then
    +extends JsonSchema + +A schema class that validates payloads + +### Field Summary +| Modifier and Type | Field and Description | +| ----------------- | ---------------------- | +| Number | minimum = -10 | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| String | validate(arg: String, configuration: SchemaConfiguration) | +| Nothing? | validate(arg: Nothing?, configuration: SchemaConfiguration) | +| int | validate(arg: int, configuration: SchemaConfiguration) | +| long | validate(arg: long, configuration: SchemaConfiguration) | +| float | validate(arg: float, configuration: SchemaConfiguration) | +| double | validate(arg: double, configuration: SchemaConfiguration) | +| Number | validate(arg: Number, configuration: SchemaConfiguration) | +| boolean | validate(arg: boolean, configuration: SchemaConfiguration) | +| FrozenMap | validate(arg: Map<?, ?>, configuration: SchemaConfiguration) | +| FrozenList | validate(arg: List<*>, configuration: SchemaConfiguration) | +| [ThenBoxedString](#thenboxedstring) | validateAndBox(String, configuration: SchemaConfiguration) | +| [ThenBoxedVoid](#thenboxedvoid) | validateAndBox(Nothing?, configuration: SchemaConfiguration) | +| [ThenBoxedNumber](#thenboxednumber) | validateAndBox(Number, configuration: SchemaConfiguration) | +| [ThenBoxedBoolean](#thenboxedboolean) | validateAndBox(boolean, configuration: SchemaConfiguration) | +| [ThenBoxedMap](#thenboxedmap) | validateAndBox(Map<?, ?>, configuration: SchemaConfiguration) | +| [ThenBoxedList](#thenboxedlist) | validateAndBox(List<*>, configuration: SchemaConfiguration) | +| [ThenBoxed](#thenboxed) | validateAndBox(Any?, configuration: SchemaConfiguration) | +| Any? | validate(arg: Any?, configuration: SchemaConfiguration) | + +## Schema0Boxed +sealed interface Schema0Boxed
    +permits
    +[Schema0BoxedVoid](#schema0boxedvoid), +[Schema0BoxedBoolean](#schema0boxedboolean), +[Schema0BoxedNumber](#schema0boxednumber), +[Schema0BoxedString](#schema0boxedstring), +[Schema0BoxedList](#schema0boxedlist), +[Schema0BoxedMap](#schema0boxedmap) + +sealed interface that stores validated payloads using boxed classes + +## Schema0BoxedVoid +data class Schema0BoxedVoid
    +implements [Schema0Boxed](#schema0boxed) + +data class that stores validated null payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| Schema0BoxedVoid(Nothing? data)
    Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| Nothing? | data()
    validated payload | +| Any? | getData()
    validated payload | + +## Schema0BoxedBoolean +data class Schema0BoxedBoolean
    +implements [Schema0Boxed](#schema0boxed) + +record that stores validated boolean payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| Schema0BoxedBoolean(boolean data)
    Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| boolean | data()
    validated payload | +| Any? | getData()
    validated payload | + +## Schema0BoxedNumber +data class Schema0BoxedNumber
    +implements [Schema0Boxed](#schema0boxed) + +data class that stores validated Number payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| Schema0BoxedNumber(Number data)
    Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| Number | data()
    validated payload | +| Any? | getData()
    validated payload | + +## Schema0BoxedString +data class Schema0BoxedString
    +implements [Schema0Boxed](#schema0boxed) + +data class that stores validated String payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| Schema0BoxedString(String data)
    Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| String | data()
    validated payload | +| Any? | getData()
    validated payload | + +## Schema0BoxedList +data class Schema0BoxedList
    +implements [Schema0Boxed](#schema0boxed) + +data class that stores validated List payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| Schema0BoxedList(FrozenList data)
    Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| FrozenList | data()
    validated payload | +| Any? | getData()
    validated payload | + +## Schema0BoxedMap +data class Schema0BoxedMap
    +implements [Schema0Boxed](#schema0boxed) + +data class that stores validated Map payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| Schema0BoxedMap(FrozenMap data)
    Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| FrozenMap | data()
    validated payload | +| Any? | getData()
    validated payload | + +## Schema0 +class Schema0
    +extends JsonSchema + +A schema class that validates payloads + +### Field Summary +| Modifier and Type | Field and Description | +| ----------------- | ---------------------- | +| Class | if = [IfSchema::class.java](#ifschema) | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| String | validate(arg: String, configuration: SchemaConfiguration) | +| Nothing? | validate(arg: Nothing?, configuration: SchemaConfiguration) | +| int | validate(arg: int, configuration: SchemaConfiguration) | +| long | validate(arg: long, configuration: SchemaConfiguration) | +| float | validate(arg: float, configuration: SchemaConfiguration) | +| double | validate(arg: double, configuration: SchemaConfiguration) | +| Number | validate(arg: Number, configuration: SchemaConfiguration) | +| boolean | validate(arg: boolean, configuration: SchemaConfiguration) | +| FrozenMap | validate(arg: Map<?, ?>, configuration: SchemaConfiguration) | +| FrozenList | validate(arg: List<*>, configuration: SchemaConfiguration) | +| [Schema0BoxedString](#schema0boxedstring) | validateAndBox(String, configuration: SchemaConfiguration) | +| [Schema0BoxedVoid](#schema0boxedvoid) | validateAndBox(Nothing?, configuration: SchemaConfiguration) | +| [Schema0BoxedNumber](#schema0boxednumber) | validateAndBox(Number, configuration: SchemaConfiguration) | +| [Schema0BoxedBoolean](#schema0boxedboolean) | validateAndBox(boolean, configuration: SchemaConfiguration) | +| [Schema0BoxedMap](#schema0boxedmap) | validateAndBox(Map<?, ?>, configuration: SchemaConfiguration) | +| [Schema0BoxedList](#schema0boxedlist) | validateAndBox(List<*>, configuration: SchemaConfiguration) | +| [Schema0Boxed](#schema0boxed) | validateAndBox(Any?, configuration: SchemaConfiguration) | +| Any? | validate(arg: Any?, configuration: SchemaConfiguration) | + +## IfSchemaBoxed +sealed interface IfSchemaBoxed
    +permits
    +[IfSchemaBoxedVoid](#ifschemaboxedvoid), +[IfSchemaBoxedBoolean](#ifschemaboxedboolean), +[IfSchemaBoxedNumber](#ifschemaboxednumber), +[IfSchemaBoxedString](#ifschemaboxedstring), +[IfSchemaBoxedList](#ifschemaboxedlist), +[IfSchemaBoxedMap](#ifschemaboxedmap) + +sealed interface that stores validated payloads using boxed classes + +## IfSchemaBoxedVoid +data class IfSchemaBoxedVoid
    +implements [IfSchemaBoxed](#ifschemaboxed) + +data class that stores validated null payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| IfSchemaBoxedVoid(Nothing? data)
    Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| Nothing? | data()
    validated payload | +| Any? | getData()
    validated payload | + +## IfSchemaBoxedBoolean +data class IfSchemaBoxedBoolean
    +implements [IfSchemaBoxed](#ifschemaboxed) + +record that stores validated boolean payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| IfSchemaBoxedBoolean(boolean data)
    Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| boolean | data()
    validated payload | +| Any? | getData()
    validated payload | + +## IfSchemaBoxedNumber +data class IfSchemaBoxedNumber
    +implements [IfSchemaBoxed](#ifschemaboxed) + +data class that stores validated Number payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| IfSchemaBoxedNumber(Number data)
    Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| Number | data()
    validated payload | +| Any? | getData()
    validated payload | + +## IfSchemaBoxedString +data class IfSchemaBoxedString
    +implements [IfSchemaBoxed](#ifschemaboxed) + +data class that stores validated String payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| IfSchemaBoxedString(String data)
    Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| String | data()
    validated payload | +| Any? | getData()
    validated payload | + +## IfSchemaBoxedList +data class IfSchemaBoxedList
    +implements [IfSchemaBoxed](#ifschemaboxed) + +data class that stores validated List payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| IfSchemaBoxedList(FrozenList data)
    Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| FrozenList | data()
    validated payload | +| Any? | getData()
    validated payload | + +## IfSchemaBoxedMap +data class IfSchemaBoxedMap
    +implements [IfSchemaBoxed](#ifschemaboxed) + +data class that stores validated Map payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| IfSchemaBoxedMap(FrozenMap data)
    Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| FrozenMap | data()
    validated payload | +| Any? | getData()
    validated payload | + +## IfSchema +class IfSchema
    +extends JsonSchema + +A schema class that validates payloads + +### Field Summary +| Modifier and Type | Field and Description | +| ----------------- | ---------------------- | +| Number | exclusiveMaximum = 0 | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| String | validate(arg: String, configuration: SchemaConfiguration) | +| Nothing? | validate(arg: Nothing?, configuration: SchemaConfiguration) | +| int | validate(arg: int, configuration: SchemaConfiguration) | +| long | validate(arg: long, configuration: SchemaConfiguration) | +| float | validate(arg: float, configuration: SchemaConfiguration) | +| double | validate(arg: double, configuration: SchemaConfiguration) | +| Number | validate(arg: Number, configuration: SchemaConfiguration) | +| boolean | validate(arg: boolean, configuration: SchemaConfiguration) | +| FrozenMap | validate(arg: Map<?, ?>, configuration: SchemaConfiguration) | +| FrozenList | validate(arg: List<*>, configuration: SchemaConfiguration) | +| [IfSchemaBoxedString](#ifschemaboxedstring) | validateAndBox(String, configuration: SchemaConfiguration) | +| [IfSchemaBoxedVoid](#ifschemaboxedvoid) | validateAndBox(Nothing?, configuration: SchemaConfiguration) | +| [IfSchemaBoxedNumber](#ifschemaboxednumber) | validateAndBox(Number, configuration: SchemaConfiguration) | +| [IfSchemaBoxedBoolean](#ifschemaboxedboolean) | validateAndBox(boolean, configuration: SchemaConfiguration) | +| [IfSchemaBoxedMap](#ifschemaboxedmap) | validateAndBox(Map<?, ?>, configuration: SchemaConfiguration) | +| [IfSchemaBoxedList](#ifschemaboxedlist) | validateAndBox(List<*>, configuration: SchemaConfiguration) | +| [IfSchemaBoxed](#ifschemaboxed) | validateAndBox(Any?, configuration: SchemaConfiguration) | +| Any? | validate(arg: Any?, configuration: SchemaConfiguration) | + +[[Back to top]](#top) [[Back to Component Schemas]](../../../README.md#Component-Schemas) [[Back to README]](../../../README.md) diff --git a/samples/client/3_1_0_unit_test/kotlin/docs/components/schemas/Not.md b/samples/client/3_1_0_unit_test/kotlin/docs/components/schemas/Not.md new file mode 100644 index 00000000000..4e1250b94c4 --- /dev/null +++ b/samples/client/3_1_0_unit_test/kotlin/docs/components/schemas/Not.md @@ -0,0 +1,207 @@ +# Not +org.openapijsonschematools.client.components.schemas.Not.java +class Not
    + +A class that contains necessary nested +- schema classes (which validate payloads), extends JsonSchema +- sealed interfaces which store validated payloads, Kotlin version of a sum type +- boxed classes which store validated payloads, sealed permits class implementations + +## Nested Class Summary +| Modifier and Type | Class and Description | +| ----------------- | ---------------------- | +| sealed interface | [Not.Not1Boxed](#not1boxed)
    sealed interface for validated payloads | +| record | [Not.Not1BoxedVoid](#not1boxedvoid)
    boxed class to store validated null payloads | +| record | [Not.Not1BoxedBoolean](#not1boxedboolean)
    boxed class to store validated boolean payloads | +| record | [Not.Not1BoxedNumber](#not1boxednumber)
    boxed class to store validated Number payloads | +| record | [Not.Not1BoxedString](#not1boxedstring)
    boxed class to store validated String payloads | +| record | [Not.Not1BoxedList](#not1boxedlist)
    boxed class to store validated List payloads | +| record | [Not.Not1BoxedMap](#not1boxedmap)
    boxed class to store validated Map payloads | +| static class | [Not.Not1](#not1)
    schema class | +| sealed interface | [Not.Not2Boxed](#not2boxed)
    sealed interface for validated payloads | +| record | [Not.Not2BoxedNumber](#not2boxednumber)
    boxed class to store validated Number payloads | +| static class | [Not.Not2](#not2)
    schema class | + +## Not1Boxed +sealed interface Not1Boxed
    +permits
    +[Not1BoxedVoid](#not1boxedvoid), +[Not1BoxedBoolean](#not1boxedboolean), +[Not1BoxedNumber](#not1boxednumber), +[Not1BoxedString](#not1boxedstring), +[Not1BoxedList](#not1boxedlist), +[Not1BoxedMap](#not1boxedmap) + +sealed interface that stores validated payloads using boxed classes + +## Not1BoxedVoid +data class Not1BoxedVoid
    +implements [Not1Boxed](#not1boxed) + +data class that stores validated null payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| Not1BoxedVoid(Nothing? data)
    Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| Nothing? | data()
    validated payload | +| Any? | getData()
    validated payload | + +## Not1BoxedBoolean +data class Not1BoxedBoolean
    +implements [Not1Boxed](#not1boxed) + +record that stores validated boolean payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| Not1BoxedBoolean(boolean data)
    Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| boolean | data()
    validated payload | +| Any? | getData()
    validated payload | + +## Not1BoxedNumber +data class Not1BoxedNumber
    +implements [Not1Boxed](#not1boxed) + +data class that stores validated Number payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| Not1BoxedNumber(Number data)
    Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| Number | data()
    validated payload | +| Any? | getData()
    validated payload | + +## Not1BoxedString +data class Not1BoxedString
    +implements [Not1Boxed](#not1boxed) + +data class that stores validated String payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| Not1BoxedString(String data)
    Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| String | data()
    validated payload | +| Any? | getData()
    validated payload | + +## Not1BoxedList +data class Not1BoxedList
    +implements [Not1Boxed](#not1boxed) + +data class that stores validated List payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| Not1BoxedList(FrozenList data)
    Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| FrozenList | data()
    validated payload | +| Any? | getData()
    validated payload | + +## Not1BoxedMap +data class Not1BoxedMap
    +implements [Not1Boxed](#not1boxed) + +data class that stores validated Map payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| Not1BoxedMap(FrozenMap data)
    Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| FrozenMap | data()
    validated payload | +| Any? | getData()
    validated payload | + +## Not1 +class Not1
    +extends JsonSchema + +A schema class that validates payloads + +### Field Summary +| Modifier and Type | Field and Description | +| ----------------- | ---------------------- | +| Class | not = [Not2::class.java](#not2) | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| String | validate(arg: String, configuration: SchemaConfiguration) | +| Nothing? | validate(arg: Nothing?, configuration: SchemaConfiguration) | +| int | validate(arg: int, configuration: SchemaConfiguration) | +| long | validate(arg: long, configuration: SchemaConfiguration) | +| float | validate(arg: float, configuration: SchemaConfiguration) | +| double | validate(arg: double, configuration: SchemaConfiguration) | +| Number | validate(arg: Number, configuration: SchemaConfiguration) | +| boolean | validate(arg: boolean, configuration: SchemaConfiguration) | +| FrozenMap | validate(arg: Map<?, ?>, configuration: SchemaConfiguration) | +| FrozenList | validate(arg: List<*>, configuration: SchemaConfiguration) | +| [Not1BoxedString](#not1boxedstring) | validateAndBox(String, configuration: SchemaConfiguration) | +| [Not1BoxedVoid](#not1boxedvoid) | validateAndBox(Nothing?, configuration: SchemaConfiguration) | +| [Not1BoxedNumber](#not1boxednumber) | validateAndBox(Number, configuration: SchemaConfiguration) | +| [Not1BoxedBoolean](#not1boxedboolean) | validateAndBox(boolean, configuration: SchemaConfiguration) | +| [Not1BoxedMap](#not1boxedmap) | validateAndBox(Map<?, ?>, configuration: SchemaConfiguration) | +| [Not1BoxedList](#not1boxedlist) | validateAndBox(List<*>, configuration: SchemaConfiguration) | +| [Not1Boxed](#not1boxed) | validateAndBox(Any?, configuration: SchemaConfiguration) | +| Any? | validate(arg: Any?, configuration: SchemaConfiguration) | + +## Not2Boxed +sealed interface Not2Boxed
    +permits
    +[Not2BoxedNumber](#not2boxednumber) + +sealed interface that stores validated payloads using boxed classes + +## Not2BoxedNumber +data class Not2BoxedNumber
    +implements [Not2Boxed](#not2boxed) + +data class that stores validated Number payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| Not2BoxedNumber(Number data)
    Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| Number | data()
    validated payload | +| Any? | getData()
    validated payload | + +## Not2 +class Not2
    +extends IntJsonSchema.IntJsonSchema1 + +A schema class that validates payloads + +| Methods Inherited from class org.openapijsonschematools.client.schemas.IntJsonSchema.IntJsonSchema1 | +| ------------------------------------------------------------------ | +| validate | +| validateAndBox | + +[[Back to top]](#top) [[Back to Component Schemas]](../../../README.md#Component-Schemas) [[Back to README]](../../../README.md) diff --git a/samples/client/3_1_0_unit_test/kotlin/docs/components/schemas/NotMoreComplexSchema.md b/samples/client/3_1_0_unit_test/kotlin/docs/components/schemas/NotMoreComplexSchema.md new file mode 100644 index 00000000000..2578fcfd7c1 --- /dev/null +++ b/samples/client/3_1_0_unit_test/kotlin/docs/components/schemas/NotMoreComplexSchema.md @@ -0,0 +1,324 @@ +# NotMoreComplexSchema +org.openapijsonschematools.client.components.schemas.NotMoreComplexSchema.java +class NotMoreComplexSchema
    + +A class that contains necessary nested +- schema classes (which validate payloads), extends JsonSchema +- sealed interfaces which store validated payloads, Kotlin version of a sum type +- boxed classes which store validated payloads, sealed permits class implementations +- classes to store validated map payloads, extends FrozenMap +- classes to build inputs for map payloads + +## Nested Class Summary +| Modifier and Type | Class and Description | +| ----------------- | ---------------------- | +| sealed interface | [NotMoreComplexSchema.NotMoreComplexSchema1Boxed](#notmorecomplexschema1boxed)
    sealed interface for validated payloads | +| record | [NotMoreComplexSchema.NotMoreComplexSchema1BoxedVoid](#notmorecomplexschema1boxedvoid)
    boxed class to store validated null payloads | +| record | [NotMoreComplexSchema.NotMoreComplexSchema1BoxedBoolean](#notmorecomplexschema1boxedboolean)
    boxed class to store validated boolean payloads | +| record | [NotMoreComplexSchema.NotMoreComplexSchema1BoxedNumber](#notmorecomplexschema1boxednumber)
    boxed class to store validated Number payloads | +| record | [NotMoreComplexSchema.NotMoreComplexSchema1BoxedString](#notmorecomplexschema1boxedstring)
    boxed class to store validated String payloads | +| record | [NotMoreComplexSchema.NotMoreComplexSchema1BoxedList](#notmorecomplexschema1boxedlist)
    boxed class to store validated List payloads | +| record | [NotMoreComplexSchema.NotMoreComplexSchema1BoxedMap](#notmorecomplexschema1boxedmap)
    boxed class to store validated Map payloads | +| static class | [NotMoreComplexSchema.NotMoreComplexSchema1](#notmorecomplexschema1)
    schema class | +| sealed interface | [NotMoreComplexSchema.NotBoxed](#notboxed)
    sealed interface for validated payloads | +| record | [NotMoreComplexSchema.NotBoxedMap](#notboxedmap)
    boxed class to store validated Map payloads | +| static class | [NotMoreComplexSchema.Not](#not)
    schema class | +| static class | [NotMoreComplexSchema.NotMapBuilder](#notmapbuilder)
    builder for Map payloads | +| static class | [NotMoreComplexSchema.NotMap](#notmap)
    output class for Map payloads | +| sealed interface | [NotMoreComplexSchema.FooBoxed](#fooboxed)
    sealed interface for validated payloads | +| record | [NotMoreComplexSchema.FooBoxedString](#fooboxedstring)
    boxed class to store validated String payloads | +| static class | [NotMoreComplexSchema.Foo](#foo)
    schema class | + +## NotMoreComplexSchema1Boxed +sealed interface NotMoreComplexSchema1Boxed
    +permits
    +[NotMoreComplexSchema1BoxedVoid](#notmorecomplexschema1boxedvoid), +[NotMoreComplexSchema1BoxedBoolean](#notmorecomplexschema1boxedboolean), +[NotMoreComplexSchema1BoxedNumber](#notmorecomplexschema1boxednumber), +[NotMoreComplexSchema1BoxedString](#notmorecomplexschema1boxedstring), +[NotMoreComplexSchema1BoxedList](#notmorecomplexschema1boxedlist), +[NotMoreComplexSchema1BoxedMap](#notmorecomplexschema1boxedmap) + +sealed interface that stores validated payloads using boxed classes + +## NotMoreComplexSchema1BoxedVoid +data class NotMoreComplexSchema1BoxedVoid
    +implements [NotMoreComplexSchema1Boxed](#notmorecomplexschema1boxed) + +data class that stores validated null payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| NotMoreComplexSchema1BoxedVoid(Nothing? data)
    Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| Nothing? | data()
    validated payload | +| Any? | getData()
    validated payload | + +## NotMoreComplexSchema1BoxedBoolean +data class NotMoreComplexSchema1BoxedBoolean
    +implements [NotMoreComplexSchema1Boxed](#notmorecomplexschema1boxed) + +record that stores validated boolean payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| NotMoreComplexSchema1BoxedBoolean(boolean data)
    Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| boolean | data()
    validated payload | +| Any? | getData()
    validated payload | + +## NotMoreComplexSchema1BoxedNumber +data class NotMoreComplexSchema1BoxedNumber
    +implements [NotMoreComplexSchema1Boxed](#notmorecomplexschema1boxed) + +data class that stores validated Number payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| NotMoreComplexSchema1BoxedNumber(Number data)
    Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| Number | data()
    validated payload | +| Any? | getData()
    validated payload | + +## NotMoreComplexSchema1BoxedString +data class NotMoreComplexSchema1BoxedString
    +implements [NotMoreComplexSchema1Boxed](#notmorecomplexschema1boxed) + +data class that stores validated String payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| NotMoreComplexSchema1BoxedString(String data)
    Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| String | data()
    validated payload | +| Any? | getData()
    validated payload | + +## NotMoreComplexSchema1BoxedList +data class NotMoreComplexSchema1BoxedList
    +implements [NotMoreComplexSchema1Boxed](#notmorecomplexschema1boxed) + +data class that stores validated List payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| NotMoreComplexSchema1BoxedList(FrozenList data)
    Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| FrozenList | data()
    validated payload | +| Any? | getData()
    validated payload | + +## NotMoreComplexSchema1BoxedMap +data class NotMoreComplexSchema1BoxedMap
    +implements [NotMoreComplexSchema1Boxed](#notmorecomplexschema1boxed) + +data class that stores validated Map payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| NotMoreComplexSchema1BoxedMap(FrozenMap data)
    Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| FrozenMap | data()
    validated payload | +| Any? | getData()
    validated payload | + +## NotMoreComplexSchema1 +class NotMoreComplexSchema1
    +extends JsonSchema + +A schema class that validates payloads + +### Field Summary +| Modifier and Type | Field and Description | +| ----------------- | ---------------------- | +| Class | not = [Not::class.java](#not) | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| String | validate(arg: String, configuration: SchemaConfiguration) | +| Nothing? | validate(arg: Nothing?, configuration: SchemaConfiguration) | +| int | validate(arg: int, configuration: SchemaConfiguration) | +| long | validate(arg: long, configuration: SchemaConfiguration) | +| float | validate(arg: float, configuration: SchemaConfiguration) | +| double | validate(arg: double, configuration: SchemaConfiguration) | +| Number | validate(arg: Number, configuration: SchemaConfiguration) | +| boolean | validate(arg: boolean, configuration: SchemaConfiguration) | +| FrozenMap | validate(arg: Map<?, ?>, configuration: SchemaConfiguration) | +| FrozenList | validate(arg: List<*>, configuration: SchemaConfiguration) | +| [NotMoreComplexSchema1BoxedString](#notmorecomplexschema1boxedstring) | validateAndBox(String, configuration: SchemaConfiguration) | +| [NotMoreComplexSchema1BoxedVoid](#notmorecomplexschema1boxedvoid) | validateAndBox(Nothing?, configuration: SchemaConfiguration) | +| [NotMoreComplexSchema1BoxedNumber](#notmorecomplexschema1boxednumber) | validateAndBox(Number, configuration: SchemaConfiguration) | +| [NotMoreComplexSchema1BoxedBoolean](#notmorecomplexschema1boxedboolean) | validateAndBox(boolean, configuration: SchemaConfiguration) | +| [NotMoreComplexSchema1BoxedMap](#notmorecomplexschema1boxedmap) | validateAndBox(Map<?, ?>, configuration: SchemaConfiguration) | +| [NotMoreComplexSchema1BoxedList](#notmorecomplexschema1boxedlist) | validateAndBox(List<*>, configuration: SchemaConfiguration) | +| [NotMoreComplexSchema1Boxed](#notmorecomplexschema1boxed) | validateAndBox(Any?, configuration: SchemaConfiguration) | +| Any? | validate(arg: Any?, configuration: SchemaConfiguration) | + +## NotBoxed +sealed interface NotBoxed
    +permits
    +[NotBoxedMap](#notboxedmap) + +sealed interface that stores validated payloads using boxed classes + +## NotBoxedMap +data class NotBoxedMap
    +implements [NotBoxed](#notboxed) + +data class that stores validated Map payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| NotBoxedMap([NotMap](#notmap) data)
    Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| [NotMap](#notmap) | data()
    validated payload | +| Any? | getData()
    validated payload | + +## Not +class Not
    +extends JsonSchema + +A schema class that validates payloads + +### Code Sample +``` +import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags; +import org.openapijsonschematools.client.configurations.SchemaConfiguration; +import org.openapijsonschematools.client.exceptions.ValidationException; +import org.openapijsonschematools.client.schemas.validation.MapUtils; +import org.openapijsonschematools.client.schemas.validation.FrozenList; +import org.openapijsonschematools.client.schemas.validation.FrozenMap; +import org.openapijsonschematools.client.components.schemas.NotMoreComplexSchema; + +import java.util.Arrays; +import java.util.List; +import java.util.AbstractMap; + +static final SchemaConfiguration configuration = new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().build()); + +// Map validation +NotMoreComplexSchema.NotMap validatedPayload = + NotMoreComplexSchema.Not.validate( + new NotMoreComplexSchema.NotMapBuilder() + .foo("a") + + .build(), + configuration +); +``` + +### Field Summary +| Modifier and Type | Field and Description | +| ----------------- | ---------------------- | +| Set> | type = setOf(Map::class.java) | +| Map> | properties = mapOf(
        "foo" to [Foo::class.java](#foo))
    )
    | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| [NotMap](#notmap) | validate(arg: [Map<?, ?>](#notmapbuilder), configuration: SchemaConfiguration) | +| [NotBoxedMap](#notboxedmap) | validateAndBox([Map<?, ?>](#notmapbuilder), configuration: SchemaConfiguration) | +| [NotBoxed](#notboxed) | validateAndBox(Any?, configuration: SchemaConfiguration) | +| Any? | validate(arg: Any?, configuration: SchemaConfiguration) | + +## NotMapBuilder +class NotMapBuilder
    +builder for `Map` + +A class that builds the Map input type + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| NotMapBuilder()
    Creates a builder that contains an empty map | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| Map | build()
    Returns map input that should be used with Schema.validate | +| [NotMapBuilder](#notmapbuilder) | foo(value: String) | +| [NotMapBuilder](#notmapbuilder) | additionalProperty(key: String, value: Nothing?) | +| [NotMapBuilder](#notmapbuilder) | additionalProperty(key: String, value: Boolean) | +| [NotMapBuilder](#notmapbuilder) | additionalProperty(key: String, value: String) | +| [NotMapBuilder](#notmapbuilder) | additionalProperty(key: String, value: Int) | +| [NotMapBuilder](#notmapbuilder) | additionalProperty(key: String, value: Float) | +| [NotMapBuilder](#notmapbuilder) | additionalProperty(key: String, value: Long) | +| [NotMapBuilder](#notmapbuilder) | additionalProperty(key: String, value: Double) | +| [NotMapBuilder](#notmapbuilder) | additionalProperty(key: String, value: List) | +| [NotMapBuilder](#notmapbuilder) | additionalProperty(key: String, value: Map) | + +## NotMap +class NotMap
    +extends FrozenMap + +A class to store validated Map payloads + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| static [NotMap](#notmap) | of([Map](#notmapbuilder) arg, SchemaConfiguration configuration) | +| String | foo()
    [optional] | +| Any? | getAdditionalProperty(String name)
    provides type safety for additional properties | + +## FooBoxed +sealed interface FooBoxed
    +permits
    +[FooBoxedString](#fooboxedstring) + +sealed interface that stores validated payloads using boxed classes + +## FooBoxedString +data class FooBoxedString
    +implements [FooBoxed](#fooboxed) + +data class that stores validated String payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| FooBoxedString(String data)
    Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| String | data()
    validated payload | +| Any? | getData()
    validated payload | + +## Foo +class Foo
    +extends StringJsonSchema.StringJsonSchema1 + +A schema class that validates payloads + +| Methods Inherited from class org.openapijsonschematools.client.schemas.StringJsonSchema.StringJsonSchema1 | +| ------------------------------------------------------------------ | +| validate | +| validateAndBox | + +[[Back to top]](#top) [[Back to Component Schemas]](../../../README.md#Component-Schemas) [[Back to README]](../../../README.md) diff --git a/samples/client/3_1_0_unit_test/kotlin/docs/components/schemas/NotMultipleTypes.md b/samples/client/3_1_0_unit_test/kotlin/docs/components/schemas/NotMultipleTypes.md new file mode 100644 index 00000000000..441488b38d5 --- /dev/null +++ b/samples/client/3_1_0_unit_test/kotlin/docs/components/schemas/NotMultipleTypes.md @@ -0,0 +1,266 @@ +# NotMultipleTypes +org.openapijsonschematools.client.components.schemas.NotMultipleTypes.java +class NotMultipleTypes
    + +A class that contains necessary nested +- schema classes (which validate payloads), extends JsonSchema +- sealed interfaces which store validated payloads, Kotlin version of a sum type +- boxed classes which store validated payloads, sealed permits class implementations + +## Nested Class Summary +| Modifier and Type | Class and Description | +| ----------------- | ---------------------- | +| sealed interface | [NotMultipleTypes.NotMultipleTypes1Boxed](#notmultipletypes1boxed)
    sealed interface for validated payloads | +| record | [NotMultipleTypes.NotMultipleTypes1BoxedVoid](#notmultipletypes1boxedvoid)
    boxed class to store validated null payloads | +| record | [NotMultipleTypes.NotMultipleTypes1BoxedBoolean](#notmultipletypes1boxedboolean)
    boxed class to store validated boolean payloads | +| record | [NotMultipleTypes.NotMultipleTypes1BoxedNumber](#notmultipletypes1boxednumber)
    boxed class to store validated Number payloads | +| record | [NotMultipleTypes.NotMultipleTypes1BoxedString](#notmultipletypes1boxedstring)
    boxed class to store validated String payloads | +| record | [NotMultipleTypes.NotMultipleTypes1BoxedList](#notmultipletypes1boxedlist)
    boxed class to store validated List payloads | +| record | [NotMultipleTypes.NotMultipleTypes1BoxedMap](#notmultipletypes1boxedmap)
    boxed class to store validated Map payloads | +| static class | [NotMultipleTypes.NotMultipleTypes1](#notmultipletypes1)
    schema class | +| sealed interface | [NotMultipleTypes.NotBoxed](#notboxed)
    sealed interface for validated payloads | +| record | [NotMultipleTypes.NotBoxedNumber](#notboxednumber)
    boxed class to store validated Number payloads | +| record | [NotMultipleTypes.NotBoxedBoolean](#notboxedboolean)
    boxed class to store validated boolean payloads | +| static class | [NotMultipleTypes.Not](#not)
    schema class | + +## NotMultipleTypes1Boxed +sealed interface NotMultipleTypes1Boxed
    +permits
    +[NotMultipleTypes1BoxedVoid](#notmultipletypes1boxedvoid), +[NotMultipleTypes1BoxedBoolean](#notmultipletypes1boxedboolean), +[NotMultipleTypes1BoxedNumber](#notmultipletypes1boxednumber), +[NotMultipleTypes1BoxedString](#notmultipletypes1boxedstring), +[NotMultipleTypes1BoxedList](#notmultipletypes1boxedlist), +[NotMultipleTypes1BoxedMap](#notmultipletypes1boxedmap) + +sealed interface that stores validated payloads using boxed classes + +## NotMultipleTypes1BoxedVoid +data class NotMultipleTypes1BoxedVoid
    +implements [NotMultipleTypes1Boxed](#notmultipletypes1boxed) + +data class that stores validated null payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| NotMultipleTypes1BoxedVoid(Nothing? data)
    Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| Nothing? | data()
    validated payload | +| Any? | getData()
    validated payload | + +## NotMultipleTypes1BoxedBoolean +data class NotMultipleTypes1BoxedBoolean
    +implements [NotMultipleTypes1Boxed](#notmultipletypes1boxed) + +record that stores validated boolean payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| NotMultipleTypes1BoxedBoolean(boolean data)
    Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| boolean | data()
    validated payload | +| Any? | getData()
    validated payload | + +## NotMultipleTypes1BoxedNumber +data class NotMultipleTypes1BoxedNumber
    +implements [NotMultipleTypes1Boxed](#notmultipletypes1boxed) + +data class that stores validated Number payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| NotMultipleTypes1BoxedNumber(Number data)
    Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| Number | data()
    validated payload | +| Any? | getData()
    validated payload | + +## NotMultipleTypes1BoxedString +data class NotMultipleTypes1BoxedString
    +implements [NotMultipleTypes1Boxed](#notmultipletypes1boxed) + +data class that stores validated String payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| NotMultipleTypes1BoxedString(String data)
    Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| String | data()
    validated payload | +| Any? | getData()
    validated payload | + +## NotMultipleTypes1BoxedList +data class NotMultipleTypes1BoxedList
    +implements [NotMultipleTypes1Boxed](#notmultipletypes1boxed) + +data class that stores validated List payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| NotMultipleTypes1BoxedList(FrozenList data)
    Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| FrozenList | data()
    validated payload | +| Any? | getData()
    validated payload | + +## NotMultipleTypes1BoxedMap +data class NotMultipleTypes1BoxedMap
    +implements [NotMultipleTypes1Boxed](#notmultipletypes1boxed) + +data class that stores validated Map payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| NotMultipleTypes1BoxedMap(FrozenMap data)
    Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| FrozenMap | data()
    validated payload | +| Any? | getData()
    validated payload | + +## NotMultipleTypes1 +class NotMultipleTypes1
    +extends JsonSchema + +A schema class that validates payloads + +### Field Summary +| Modifier and Type | Field and Description | +| ----------------- | ---------------------- | +| Class | not = [Not::class.java](#not) | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| String | validate(arg: String, configuration: SchemaConfiguration) | +| Nothing? | validate(arg: Nothing?, configuration: SchemaConfiguration) | +| int | validate(arg: int, configuration: SchemaConfiguration) | +| long | validate(arg: long, configuration: SchemaConfiguration) | +| float | validate(arg: float, configuration: SchemaConfiguration) | +| double | validate(arg: double, configuration: SchemaConfiguration) | +| Number | validate(arg: Number, configuration: SchemaConfiguration) | +| boolean | validate(arg: boolean, configuration: SchemaConfiguration) | +| FrozenMap | validate(arg: Map<?, ?>, configuration: SchemaConfiguration) | +| FrozenList | validate(arg: List<*>, configuration: SchemaConfiguration) | +| [NotMultipleTypes1BoxedString](#notmultipletypes1boxedstring) | validateAndBox(String, configuration: SchemaConfiguration) | +| [NotMultipleTypes1BoxedVoid](#notmultipletypes1boxedvoid) | validateAndBox(Nothing?, configuration: SchemaConfiguration) | +| [NotMultipleTypes1BoxedNumber](#notmultipletypes1boxednumber) | validateAndBox(Number, configuration: SchemaConfiguration) | +| [NotMultipleTypes1BoxedBoolean](#notmultipletypes1boxedboolean) | validateAndBox(boolean, configuration: SchemaConfiguration) | +| [NotMultipleTypes1BoxedMap](#notmultipletypes1boxedmap) | validateAndBox(Map<?, ?>, configuration: SchemaConfiguration) | +| [NotMultipleTypes1BoxedList](#notmultipletypes1boxedlist) | validateAndBox(List<*>, configuration: SchemaConfiguration) | +| [NotMultipleTypes1Boxed](#notmultipletypes1boxed) | validateAndBox(Any?, configuration: SchemaConfiguration) | +| Any? | validate(arg: Any?, configuration: SchemaConfiguration) | + +## NotBoxed +sealed interface NotBoxed
    +permits
    +[NotBoxedNumber](#notboxednumber), +[NotBoxedBoolean](#notboxedboolean) + +sealed interface that stores validated payloads using boxed classes + +## NotBoxedNumber +data class NotBoxedNumber
    +implements [NotBoxed](#notboxed) + +data class that stores validated Number payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| NotBoxedNumber(Number data)
    Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| Number | data()
    validated payload | +| Any? | getData()
    validated payload | + +## NotBoxedBoolean +data class NotBoxedBoolean
    +implements [NotBoxed](#notboxed) + +record that stores validated boolean payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| NotBoxedBoolean(boolean data)
    Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| boolean | data()
    validated payload | +| Any? | getData()
    validated payload | + +## Not +class Not
    +extends JsonSchema + +A schema class that validates payloads + +### Code Sample +``` +import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags; +import org.openapijsonschematools.client.configurations.SchemaConfiguration; +import org.openapijsonschematools.client.exceptions.ValidationException; +import org.openapijsonschematools.client.schemas.validation.MapUtils; +import org.openapijsonschematools.client.schemas.validation.FrozenList; +import org.openapijsonschematools.client.schemas.validation.FrozenMap; +import org.openapijsonschematools.client.components.schemas.NotMultipleTypes; + +import java.util.Arrays; +import java.util.List; +import java.util.AbstractMap; + +static final SchemaConfiguration configuration = new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().build()); + +// int validation +int validatedPayload = NotMultipleTypes.Not.validate( + 1L, + configuration +); + +// boolean validation +boolean validatedPayload = NotMultipleTypes.Not.validate( + true, + configuration +); +``` + +### Field Summary +| Modifier and Type | Field and Description | +| ----------------- | ---------------------- | +| Set> | type = setOf(
        Int::class.java,
        Long::class.java,
        Float::class.java,
        Double::class.java,
        Boolean::class.java
    )
    | +| String | type = "int"; | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| long | validate(arg: long, configuration: SchemaConfiguration) | +| [NotBoxedNumber](#notboxednumber) | validateAndBox(Number, configuration: SchemaConfiguration) | +| boolean | validate(arg: boolean, configuration: SchemaConfiguration) | +| [NotBoxedBoolean](#notboxedboolean) | validateAndBox(boolean, configuration: SchemaConfiguration) | +| [NotBoxed](#notboxed) | validateAndBox(Any?, configuration: SchemaConfiguration) | +| Any? | validate(arg: Any?, configuration: SchemaConfiguration) | + +[[Back to top]](#top) [[Back to Component Schemas]](../../../README.md#Component-Schemas) [[Back to README]](../../../README.md) diff --git a/samples/client/3_1_0_unit_test/kotlin/docs/components/schemas/NulCharactersInStrings.md b/samples/client/3_1_0_unit_test/kotlin/docs/components/schemas/NulCharactersInStrings.md new file mode 100644 index 00000000000..3fa79cb0018 --- /dev/null +++ b/samples/client/3_1_0_unit_test/kotlin/docs/components/schemas/NulCharactersInStrings.md @@ -0,0 +1,98 @@ +# NulCharactersInStrings +org.openapijsonschematools.client.components.schemas.NulCharactersInStrings.java +class NulCharactersInStrings
    + +A class that contains necessary nested +- schema classes (which validate payloads), extends JsonSchema +- sealed interfaces which store validated payloads, Kotlin version of a sum type +- boxed classes which store validated payloads, sealed permits class implementations +- enum classes + +## Nested Class Summary +| Modifier and Type | Class and Description | +| ----------------- | ---------------------- | +| sealed interface | [NulCharactersInStrings.NulCharactersInStrings1Boxed](#nulcharactersinstrings1boxed)
    sealed interface for validated payloads | +| record | [NulCharactersInStrings.NulCharactersInStrings1BoxedString](#nulcharactersinstrings1boxedstring)
    boxed class to store validated String payloads | +| static class | [NulCharactersInStrings.NulCharactersInStrings1](#nulcharactersinstrings1)
    schema class | +| enum | [NulCharactersInStrings.StringNulCharactersInStringsEnums](#stringnulcharactersinstringsenums)
    String enum | + +## NulCharactersInStrings1Boxed +sealed interface NulCharactersInStrings1Boxed
    +permits
    +[NulCharactersInStrings1BoxedString](#nulcharactersinstrings1boxedstring) + +sealed interface that stores validated payloads using boxed classes + +## NulCharactersInStrings1BoxedString +data class NulCharactersInStrings1BoxedString
    +implements [NulCharactersInStrings1Boxed](#nulcharactersinstrings1boxed) + +data class that stores validated String payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| NulCharactersInStrings1BoxedString(String data)
    Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| String | data()
    validated payload | +| Any? | getData()
    validated payload | + +## NulCharactersInStrings1 +class NulCharactersInStrings1
    +extends JsonSchema + +A schema class that validates payloads + +### Code Sample +``` +import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags; +import org.openapijsonschematools.client.configurations.SchemaConfiguration; +import org.openapijsonschematools.client.exceptions.ValidationException; +import org.openapijsonschematools.client.schemas.validation.MapUtils; +import org.openapijsonschematools.client.schemas.validation.FrozenList; +import org.openapijsonschematools.client.schemas.validation.FrozenMap; +import org.openapijsonschematools.client.components.schemas.NulCharactersInStrings; + +import java.util.Arrays; +import java.util.List; +import java.util.AbstractMap; + +static final SchemaConfiguration configuration = new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().build()); + +// String validation +String validatedPayload = NulCharactersInStrings.NulCharactersInStrings1.validate( + "hello\u0000there", + configuration +); +``` + +### Field Summary +| Modifier and Type | Field and Description | +| ----------------- | ---------------------- | +| Set> | type = setOf(
        String::class.java
    )
    | +| Set | enumValues = setOf(
        "hello\u0000there"
    )
    | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| String | validate(arg: String, configuration: SchemaConfiguration) | +| String | validate(arg: [StringNulCharactersInStringsEnums](#stringnulcharactersinstringsenums), configuration: SchemaConfiguration) | +| [NulCharactersInStrings1BoxedString](#nulcharactersinstrings1boxedstring) | validateAndBox(String, configuration: SchemaConfiguration) | +| [NulCharactersInStrings1Boxed](#nulcharactersinstrings1boxed) | validateAndBox(Any?, configuration: SchemaConfiguration) | +| Any? | validate(arg: Any?, configuration: SchemaConfiguration) | + +## StringNulCharactersInStringsEnums +public enum StringNulCharactersInStringsEnums
    +extends `Enum` + +A class that stores String enum values + +### Enum Constant Summary +| Enum Constant | Description | +| ------------- | ----------- | +| HELLO_NULL_THERE | value = "hello\u0000there" | + +[[Back to top]](#top) [[Back to Component Schemas]](../../../README.md#Component-Schemas) [[Back to README]](../../../README.md) diff --git a/samples/client/3_1_0_unit_test/kotlin/docs/components/schemas/NullTypeMatchesOnlyTheNullObject.md b/samples/client/3_1_0_unit_test/kotlin/docs/components/schemas/NullTypeMatchesOnlyTheNullObject.md new file mode 100644 index 00000000000..0bcdf2e30e4 --- /dev/null +++ b/samples/client/3_1_0_unit_test/kotlin/docs/components/schemas/NullTypeMatchesOnlyTheNullObject.md @@ -0,0 +1,52 @@ +# NullTypeMatchesOnlyTheNullObject +org.openapijsonschematools.client.components.schemas.NullTypeMatchesOnlyTheNullObject.java +class NullTypeMatchesOnlyTheNullObject
    + +A class that contains necessary nested +- schema classes (which validate payloads), extends JsonSchema +- sealed interfaces which store validated payloads, Kotlin version of a sum type +- boxed classes which store validated payloads, sealed permits class implementations + +## Nested Class Summary +| Modifier and Type | Class and Description | +| ----------------- | ---------------------- | +| sealed interface | [NullTypeMatchesOnlyTheNullObject.NullTypeMatchesOnlyTheNullObject1Boxed](#nulltypematchesonlythenullobject1boxed)
    sealed interface for validated payloads | +| record | [NullTypeMatchesOnlyTheNullObject.NullTypeMatchesOnlyTheNullObject1BoxedVoid](#nulltypematchesonlythenullobject1boxedvoid)
    boxed class to store validated null payloads | +| static class | [NullTypeMatchesOnlyTheNullObject.NullTypeMatchesOnlyTheNullObject1](#nulltypematchesonlythenullobject1)
    schema class | + +## NullTypeMatchesOnlyTheNullObject1Boxed +sealed interface NullTypeMatchesOnlyTheNullObject1Boxed
    +permits
    +[NullTypeMatchesOnlyTheNullObject1BoxedVoid](#nulltypematchesonlythenullobject1boxedvoid) + +sealed interface that stores validated payloads using boxed classes + +## NullTypeMatchesOnlyTheNullObject1BoxedVoid +data class NullTypeMatchesOnlyTheNullObject1BoxedVoid
    +implements [NullTypeMatchesOnlyTheNullObject1Boxed](#nulltypematchesonlythenullobject1boxed) + +data class that stores validated null payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| NullTypeMatchesOnlyTheNullObject1BoxedVoid(Nothing? data)
    Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| Nothing? | data()
    validated payload | +| Any? | getData()
    validated payload | + +## NullTypeMatchesOnlyTheNullObject1 +class NullTypeMatchesOnlyTheNullObject1
    +extends NullJsonSchema.NullJsonSchema1 + +A schema class that validates payloads + +| Methods Inherited from class org.openapijsonschematools.client.schemas.NullJsonSchema.NullJsonSchema1 | +| ------------------------------------------------------------------ | +| validate | +| validateAndBox | + +[[Back to top]](#top) [[Back to Component Schemas]](../../../README.md#Component-Schemas) [[Back to README]](../../../README.md) diff --git a/samples/client/3_1_0_unit_test/kotlin/docs/components/schemas/NumberTypeMatchesNumbers.md b/samples/client/3_1_0_unit_test/kotlin/docs/components/schemas/NumberTypeMatchesNumbers.md new file mode 100644 index 00000000000..02a48980434 --- /dev/null +++ b/samples/client/3_1_0_unit_test/kotlin/docs/components/schemas/NumberTypeMatchesNumbers.md @@ -0,0 +1,52 @@ +# NumberTypeMatchesNumbers +org.openapijsonschematools.client.components.schemas.NumberTypeMatchesNumbers.java +class NumberTypeMatchesNumbers
    + +A class that contains necessary nested +- schema classes (which validate payloads), extends JsonSchema +- sealed interfaces which store validated payloads, Kotlin version of a sum type +- boxed classes which store validated payloads, sealed permits class implementations + +## Nested Class Summary +| Modifier and Type | Class and Description | +| ----------------- | ---------------------- | +| sealed interface | [NumberTypeMatchesNumbers.NumberTypeMatchesNumbers1Boxed](#numbertypematchesnumbers1boxed)
    sealed interface for validated payloads | +| record | [NumberTypeMatchesNumbers.NumberTypeMatchesNumbers1BoxedNumber](#numbertypematchesnumbers1boxednumber)
    boxed class to store validated Number payloads | +| static class | [NumberTypeMatchesNumbers.NumberTypeMatchesNumbers1](#numbertypematchesnumbers1)
    schema class | + +## NumberTypeMatchesNumbers1Boxed +sealed interface NumberTypeMatchesNumbers1Boxed
    +permits
    +[NumberTypeMatchesNumbers1BoxedNumber](#numbertypematchesnumbers1boxednumber) + +sealed interface that stores validated payloads using boxed classes + +## NumberTypeMatchesNumbers1BoxedNumber +data class NumberTypeMatchesNumbers1BoxedNumber
    +implements [NumberTypeMatchesNumbers1Boxed](#numbertypematchesnumbers1boxed) + +data class that stores validated Number payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| NumberTypeMatchesNumbers1BoxedNumber(Number data)
    Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| Number | data()
    validated payload | +| Any? | getData()
    validated payload | + +## NumberTypeMatchesNumbers1 +class NumberTypeMatchesNumbers1
    +extends NumberJsonSchema.NumberJsonSchema1 + +A schema class that validates payloads + +| Methods Inherited from class org.openapijsonschematools.client.schemas.NumberJsonSchema.NumberJsonSchema1 | +| ------------------------------------------------------------------ | +| validate | +| validateAndBox | + +[[Back to top]](#top) [[Back to Component Schemas]](../../../README.md#Component-Schemas) [[Back to README]](../../../README.md) diff --git a/samples/client/3_1_0_unit_test/kotlin/docs/components/schemas/ObjectPropertiesValidation.md b/samples/client/3_1_0_unit_test/kotlin/docs/components/schemas/ObjectPropertiesValidation.md new file mode 100644 index 00000000000..a80a93be1e8 --- /dev/null +++ b/samples/client/3_1_0_unit_test/kotlin/docs/components/schemas/ObjectPropertiesValidation.md @@ -0,0 +1,293 @@ +# ObjectPropertiesValidation +org.openapijsonschematools.client.components.schemas.ObjectPropertiesValidation.java +class ObjectPropertiesValidation
    + +A class that contains necessary nested +- schema classes (which validate payloads), extends JsonSchema +- sealed interfaces which store validated payloads, Kotlin version of a sum type +- boxed classes which store validated payloads, sealed permits class implementations +- classes to store validated map payloads, extends FrozenMap +- classes to build inputs for map payloads + +## Nested Class Summary +| Modifier and Type | Class and Description | +| ----------------- | ---------------------- | +| sealed interface | [ObjectPropertiesValidation.ObjectPropertiesValidation1Boxed](#objectpropertiesvalidation1boxed)
    sealed interface for validated payloads | +| record | [ObjectPropertiesValidation.ObjectPropertiesValidation1BoxedVoid](#objectpropertiesvalidation1boxedvoid)
    boxed class to store validated null payloads | +| record | [ObjectPropertiesValidation.ObjectPropertiesValidation1BoxedBoolean](#objectpropertiesvalidation1boxedboolean)
    boxed class to store validated boolean payloads | +| record | [ObjectPropertiesValidation.ObjectPropertiesValidation1BoxedNumber](#objectpropertiesvalidation1boxednumber)
    boxed class to store validated Number payloads | +| record | [ObjectPropertiesValidation.ObjectPropertiesValidation1BoxedString](#objectpropertiesvalidation1boxedstring)
    boxed class to store validated String payloads | +| record | [ObjectPropertiesValidation.ObjectPropertiesValidation1BoxedList](#objectpropertiesvalidation1boxedlist)
    boxed class to store validated List payloads | +| record | [ObjectPropertiesValidation.ObjectPropertiesValidation1BoxedMap](#objectpropertiesvalidation1boxedmap)
    boxed class to store validated Map payloads | +| static class | [ObjectPropertiesValidation.ObjectPropertiesValidation1](#objectpropertiesvalidation1)
    schema class | +| static class | [ObjectPropertiesValidation.ObjectPropertiesValidationMapBuilder](#objectpropertiesvalidationmapbuilder)
    builder for Map payloads | +| static class | [ObjectPropertiesValidation.ObjectPropertiesValidationMap](#objectpropertiesvalidationmap)
    output class for Map payloads | +| sealed interface | [ObjectPropertiesValidation.BarBoxed](#barboxed)
    sealed interface for validated payloads | +| record | [ObjectPropertiesValidation.BarBoxedString](#barboxedstring)
    boxed class to store validated String payloads | +| static class | [ObjectPropertiesValidation.Bar](#bar)
    schema class | +| sealed interface | [ObjectPropertiesValidation.FooBoxed](#fooboxed)
    sealed interface for validated payloads | +| record | [ObjectPropertiesValidation.FooBoxedNumber](#fooboxednumber)
    boxed class to store validated Number payloads | +| static class | [ObjectPropertiesValidation.Foo](#foo)
    schema class | + +## ObjectPropertiesValidation1Boxed +sealed interface ObjectPropertiesValidation1Boxed
    +permits
    +[ObjectPropertiesValidation1BoxedVoid](#objectpropertiesvalidation1boxedvoid), +[ObjectPropertiesValidation1BoxedBoolean](#objectpropertiesvalidation1boxedboolean), +[ObjectPropertiesValidation1BoxedNumber](#objectpropertiesvalidation1boxednumber), +[ObjectPropertiesValidation1BoxedString](#objectpropertiesvalidation1boxedstring), +[ObjectPropertiesValidation1BoxedList](#objectpropertiesvalidation1boxedlist), +[ObjectPropertiesValidation1BoxedMap](#objectpropertiesvalidation1boxedmap) + +sealed interface that stores validated payloads using boxed classes + +## ObjectPropertiesValidation1BoxedVoid +data class ObjectPropertiesValidation1BoxedVoid
    +implements [ObjectPropertiesValidation1Boxed](#objectpropertiesvalidation1boxed) + +data class that stores validated null payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| ObjectPropertiesValidation1BoxedVoid(Nothing? data)
    Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| Nothing? | data()
    validated payload | +| Any? | getData()
    validated payload | + +## ObjectPropertiesValidation1BoxedBoolean +data class ObjectPropertiesValidation1BoxedBoolean
    +implements [ObjectPropertiesValidation1Boxed](#objectpropertiesvalidation1boxed) + +record that stores validated boolean payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| ObjectPropertiesValidation1BoxedBoolean(boolean data)
    Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| boolean | data()
    validated payload | +| Any? | getData()
    validated payload | + +## ObjectPropertiesValidation1BoxedNumber +data class ObjectPropertiesValidation1BoxedNumber
    +implements [ObjectPropertiesValidation1Boxed](#objectpropertiesvalidation1boxed) + +data class that stores validated Number payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| ObjectPropertiesValidation1BoxedNumber(Number data)
    Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| Number | data()
    validated payload | +| Any? | getData()
    validated payload | + +## ObjectPropertiesValidation1BoxedString +data class ObjectPropertiesValidation1BoxedString
    +implements [ObjectPropertiesValidation1Boxed](#objectpropertiesvalidation1boxed) + +data class that stores validated String payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| ObjectPropertiesValidation1BoxedString(String data)
    Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| String | data()
    validated payload | +| Any? | getData()
    validated payload | + +## ObjectPropertiesValidation1BoxedList +data class ObjectPropertiesValidation1BoxedList
    +implements [ObjectPropertiesValidation1Boxed](#objectpropertiesvalidation1boxed) + +data class that stores validated List payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| ObjectPropertiesValidation1BoxedList(FrozenList data)
    Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| FrozenList | data()
    validated payload | +| Any? | getData()
    validated payload | + +## ObjectPropertiesValidation1BoxedMap +data class ObjectPropertiesValidation1BoxedMap
    +implements [ObjectPropertiesValidation1Boxed](#objectpropertiesvalidation1boxed) + +data class that stores validated Map payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| ObjectPropertiesValidation1BoxedMap([ObjectPropertiesValidationMap](#objectpropertiesvalidationmap) data)
    Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| [ObjectPropertiesValidationMap](#objectpropertiesvalidationmap) | data()
    validated payload | +| Any? | getData()
    validated payload | + +## ObjectPropertiesValidation1 +class ObjectPropertiesValidation1
    +extends JsonSchema + +A schema class that validates payloads + +### Field Summary +| Modifier and Type | Field and Description | +| ----------------- | ---------------------- | +| Map> | properties = mapOf(
        "foo" to [Foo::class.java](#foo)),
        "bar" to [Bar::class.java](#bar))
    )
    | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| String | validate(arg: String, configuration: SchemaConfiguration) | +| Nothing? | validate(arg: Nothing?, configuration: SchemaConfiguration) | +| int | validate(arg: int, configuration: SchemaConfiguration) | +| long | validate(arg: long, configuration: SchemaConfiguration) | +| float | validate(arg: float, configuration: SchemaConfiguration) | +| double | validate(arg: double, configuration: SchemaConfiguration) | +| Number | validate(arg: Number, configuration: SchemaConfiguration) | +| boolean | validate(arg: boolean, configuration: SchemaConfiguration) | +| [ObjectPropertiesValidationMap](#objectpropertiesvalidationmap) | validate(arg: [Map<?, ?>](#objectpropertiesvalidationmapbuilder), configuration: SchemaConfiguration) | +| FrozenList | validate(arg: List<*>, configuration: SchemaConfiguration) | +| [ObjectPropertiesValidation1BoxedString](#objectpropertiesvalidation1boxedstring) | validateAndBox(String, configuration: SchemaConfiguration) | +| [ObjectPropertiesValidation1BoxedVoid](#objectpropertiesvalidation1boxedvoid) | validateAndBox(Nothing?, configuration: SchemaConfiguration) | +| [ObjectPropertiesValidation1BoxedNumber](#objectpropertiesvalidation1boxednumber) | validateAndBox(Number, configuration: SchemaConfiguration) | +| [ObjectPropertiesValidation1BoxedBoolean](#objectpropertiesvalidation1boxedboolean) | validateAndBox(boolean, configuration: SchemaConfiguration) | +| [ObjectPropertiesValidation1BoxedMap](#objectpropertiesvalidation1boxedmap) | validateAndBox([Map<?, ?>](#objectpropertiesvalidationmapbuilder), configuration: SchemaConfiguration) | +| [ObjectPropertiesValidation1BoxedList](#objectpropertiesvalidation1boxedlist) | validateAndBox(List<*>, configuration: SchemaConfiguration) | +| [ObjectPropertiesValidation1Boxed](#objectpropertiesvalidation1boxed) | validateAndBox(Any?, configuration: SchemaConfiguration) | +| Any? | validate(arg: Any?, configuration: SchemaConfiguration) | + +## ObjectPropertiesValidationMapBuilder +class ObjectPropertiesValidationMapBuilder
    +builder for `Map` + +A class that builds the Map input type + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| ObjectPropertiesValidationMapBuilder()
    Creates a builder that contains an empty map | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| Map | build()
    Returns map input that should be used with Schema.validate | +| [ObjectPropertiesValidationMapBuilder](#objectpropertiesvalidationmapbuilder) | foo(value: Int) | +| [ObjectPropertiesValidationMapBuilder](#objectpropertiesvalidationmapbuilder) | foo(value: Float) | +| [ObjectPropertiesValidationMapBuilder](#objectpropertiesvalidationmapbuilder) | foo(value: Long) | +| [ObjectPropertiesValidationMapBuilder](#objectpropertiesvalidationmapbuilder) | foo(value: Double) | +| [ObjectPropertiesValidationMapBuilder](#objectpropertiesvalidationmapbuilder) | bar(value: String) | +| [ObjectPropertiesValidationMapBuilder](#objectpropertiesvalidationmapbuilder) | additionalProperty(key: String, value: Nothing?) | +| [ObjectPropertiesValidationMapBuilder](#objectpropertiesvalidationmapbuilder) | additionalProperty(key: String, value: Boolean) | +| [ObjectPropertiesValidationMapBuilder](#objectpropertiesvalidationmapbuilder) | additionalProperty(key: String, value: String) | +| [ObjectPropertiesValidationMapBuilder](#objectpropertiesvalidationmapbuilder) | additionalProperty(key: String, value: Int) | +| [ObjectPropertiesValidationMapBuilder](#objectpropertiesvalidationmapbuilder) | additionalProperty(key: String, value: Float) | +| [ObjectPropertiesValidationMapBuilder](#objectpropertiesvalidationmapbuilder) | additionalProperty(key: String, value: Long) | +| [ObjectPropertiesValidationMapBuilder](#objectpropertiesvalidationmapbuilder) | additionalProperty(key: String, value: Double) | +| [ObjectPropertiesValidationMapBuilder](#objectpropertiesvalidationmapbuilder) | additionalProperty(key: String, value: List) | +| [ObjectPropertiesValidationMapBuilder](#objectpropertiesvalidationmapbuilder) | additionalProperty(key: String, value: Map) | + +## ObjectPropertiesValidationMap +class ObjectPropertiesValidationMap
    +extends FrozenMap + +A class to store validated Map payloads + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| static [ObjectPropertiesValidationMap](#objectpropertiesvalidationmap) | of([Map](#objectpropertiesvalidationmapbuilder) arg, SchemaConfiguration configuration) | +| Number | foo()
    [optional] | +| String | bar()
    [optional] | +| Any? | getAdditionalProperty(String name)
    provides type safety for additional properties | + +## BarBoxed +sealed interface BarBoxed
    +permits
    +[BarBoxedString](#barboxedstring) + +sealed interface that stores validated payloads using boxed classes + +## BarBoxedString +data class BarBoxedString
    +implements [BarBoxed](#barboxed) + +data class that stores validated String payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| BarBoxedString(String data)
    Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| String | data()
    validated payload | +| Any? | getData()
    validated payload | + +## Bar +class Bar
    +extends StringJsonSchema.StringJsonSchema1 + +A schema class that validates payloads + +| Methods Inherited from class org.openapijsonschematools.client.schemas.StringJsonSchema.StringJsonSchema1 | +| ------------------------------------------------------------------ | +| validate | +| validateAndBox | + +## FooBoxed +sealed interface FooBoxed
    +permits
    +[FooBoxedNumber](#fooboxednumber) + +sealed interface that stores validated payloads using boxed classes + +## FooBoxedNumber +data class FooBoxedNumber
    +implements [FooBoxed](#fooboxed) + +data class that stores validated Number payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| FooBoxedNumber(Number data)
    Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| Number | data()
    validated payload | +| Any? | getData()
    validated payload | + +## Foo +class Foo
    +extends IntJsonSchema.IntJsonSchema1 + +A schema class that validates payloads + +| Methods Inherited from class org.openapijsonschematools.client.schemas.IntJsonSchema.IntJsonSchema1 | +| ------------------------------------------------------------------ | +| validate | +| validateAndBox | + +[[Back to top]](#top) [[Back to Component Schemas]](../../../README.md#Component-Schemas) [[Back to README]](../../../README.md) diff --git a/samples/client/3_1_0_unit_test/kotlin/docs/components/schemas/ObjectTypeMatchesObjects.md b/samples/client/3_1_0_unit_test/kotlin/docs/components/schemas/ObjectTypeMatchesObjects.md new file mode 100644 index 00000000000..ddc0d8b8aa6 --- /dev/null +++ b/samples/client/3_1_0_unit_test/kotlin/docs/components/schemas/ObjectTypeMatchesObjects.md @@ -0,0 +1,52 @@ +# ObjectTypeMatchesObjects +org.openapijsonschematools.client.components.schemas.ObjectTypeMatchesObjects.java +class ObjectTypeMatchesObjects
    + +A class that contains necessary nested +- schema classes (which validate payloads), extends JsonSchema +- sealed interfaces which store validated payloads, Kotlin version of a sum type +- boxed classes which store validated payloads, sealed permits class implementations + +## Nested Class Summary +| Modifier and Type | Class and Description | +| ----------------- | ---------------------- | +| sealed interface | [ObjectTypeMatchesObjects.ObjectTypeMatchesObjects1Boxed](#objecttypematchesobjects1boxed)
    sealed interface for validated payloads | +| record | [ObjectTypeMatchesObjects.ObjectTypeMatchesObjects1BoxedMap](#objecttypematchesobjects1boxedmap)
    boxed class to store validated Map payloads | +| static class | [ObjectTypeMatchesObjects.ObjectTypeMatchesObjects1](#objecttypematchesobjects1)
    schema class | + +## ObjectTypeMatchesObjects1Boxed +sealed interface ObjectTypeMatchesObjects1Boxed
    +permits
    +[ObjectTypeMatchesObjects1BoxedMap](#objecttypematchesobjects1boxedmap) + +sealed interface that stores validated payloads using boxed classes + +## ObjectTypeMatchesObjects1BoxedMap +data class ObjectTypeMatchesObjects1BoxedMap
    +implements [ObjectTypeMatchesObjects1Boxed](#objecttypematchesobjects1boxed) + +data class that stores validated Map payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| ObjectTypeMatchesObjects1BoxedMap(FrozenMap data)
    Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| FrozenMap | data()
    validated payload | +| Any? | getData()
    validated payload | + +## ObjectTypeMatchesObjects1 +class ObjectTypeMatchesObjects1
    +extends MapJsonSchema.MapJsonSchema1 + +A schema class that validates payloads + +| Methods Inherited from class org.openapijsonschematools.client.schemas.MapJsonSchema.MapJsonSchema1 | +| ------------------------------------------------------------------ | +| validate | +| validateAndBox | + +[[Back to top]](#top) [[Back to Component Schemas]](../../../README.md#Component-Schemas) [[Back to README]](../../../README.md) diff --git a/samples/client/3_1_0_unit_test/kotlin/docs/components/schemas/Oneof.md b/samples/client/3_1_0_unit_test/kotlin/docs/components/schemas/Oneof.md new file mode 100644 index 00000000000..c94e5017546 --- /dev/null +++ b/samples/client/3_1_0_unit_test/kotlin/docs/components/schemas/Oneof.md @@ -0,0 +1,362 @@ +# Oneof +org.openapijsonschematools.client.components.schemas.Oneof.java +class Oneof
    + +A class that contains necessary nested +- schema classes (which validate payloads), extends JsonSchema +- sealed interfaces which store validated payloads, Kotlin version of a sum type +- boxed classes which store validated payloads, sealed permits class implementations + +## Nested Class Summary +| Modifier and Type | Class and Description | +| ----------------- | ---------------------- | +| sealed interface | [Oneof.Oneof1Boxed](#oneof1boxed)
    sealed interface for validated payloads | +| record | [Oneof.Oneof1BoxedVoid](#oneof1boxedvoid)
    boxed class to store validated null payloads | +| record | [Oneof.Oneof1BoxedBoolean](#oneof1boxedboolean)
    boxed class to store validated boolean payloads | +| record | [Oneof.Oneof1BoxedNumber](#oneof1boxednumber)
    boxed class to store validated Number payloads | +| record | [Oneof.Oneof1BoxedString](#oneof1boxedstring)
    boxed class to store validated String payloads | +| record | [Oneof.Oneof1BoxedList](#oneof1boxedlist)
    boxed class to store validated List payloads | +| record | [Oneof.Oneof1BoxedMap](#oneof1boxedmap)
    boxed class to store validated Map payloads | +| static class | [Oneof.Oneof1](#oneof1)
    schema class | +| sealed interface | [Oneof.Schema1Boxed](#schema1boxed)
    sealed interface for validated payloads | +| record | [Oneof.Schema1BoxedVoid](#schema1boxedvoid)
    boxed class to store validated null payloads | +| record | [Oneof.Schema1BoxedBoolean](#schema1boxedboolean)
    boxed class to store validated boolean payloads | +| record | [Oneof.Schema1BoxedNumber](#schema1boxednumber)
    boxed class to store validated Number payloads | +| record | [Oneof.Schema1BoxedString](#schema1boxedstring)
    boxed class to store validated String payloads | +| record | [Oneof.Schema1BoxedList](#schema1boxedlist)
    boxed class to store validated List payloads | +| record | [Oneof.Schema1BoxedMap](#schema1boxedmap)
    boxed class to store validated Map payloads | +| static class | [Oneof.Schema1](#schema1)
    schema class | +| sealed interface | [Oneof.Schema0Boxed](#schema0boxed)
    sealed interface for validated payloads | +| record | [Oneof.Schema0BoxedNumber](#schema0boxednumber)
    boxed class to store validated Number payloads | +| static class | [Oneof.Schema0](#schema0)
    schema class | + +## Oneof1Boxed +sealed interface Oneof1Boxed
    +permits
    +[Oneof1BoxedVoid](#oneof1boxedvoid), +[Oneof1BoxedBoolean](#oneof1boxedboolean), +[Oneof1BoxedNumber](#oneof1boxednumber), +[Oneof1BoxedString](#oneof1boxedstring), +[Oneof1BoxedList](#oneof1boxedlist), +[Oneof1BoxedMap](#oneof1boxedmap) + +sealed interface that stores validated payloads using boxed classes + +## Oneof1BoxedVoid +data class Oneof1BoxedVoid
    +implements [Oneof1Boxed](#oneof1boxed) + +data class that stores validated null payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| Oneof1BoxedVoid(Nothing? data)
    Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| Nothing? | data()
    validated payload | +| Any? | getData()
    validated payload | + +## Oneof1BoxedBoolean +data class Oneof1BoxedBoolean
    +implements [Oneof1Boxed](#oneof1boxed) + +record that stores validated boolean payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| Oneof1BoxedBoolean(boolean data)
    Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| boolean | data()
    validated payload | +| Any? | getData()
    validated payload | + +## Oneof1BoxedNumber +data class Oneof1BoxedNumber
    +implements [Oneof1Boxed](#oneof1boxed) + +data class that stores validated Number payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| Oneof1BoxedNumber(Number data)
    Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| Number | data()
    validated payload | +| Any? | getData()
    validated payload | + +## Oneof1BoxedString +data class Oneof1BoxedString
    +implements [Oneof1Boxed](#oneof1boxed) + +data class that stores validated String payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| Oneof1BoxedString(String data)
    Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| String | data()
    validated payload | +| Any? | getData()
    validated payload | + +## Oneof1BoxedList +data class Oneof1BoxedList
    +implements [Oneof1Boxed](#oneof1boxed) + +data class that stores validated List payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| Oneof1BoxedList(FrozenList data)
    Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| FrozenList | data()
    validated payload | +| Any? | getData()
    validated payload | + +## Oneof1BoxedMap +data class Oneof1BoxedMap
    +implements [Oneof1Boxed](#oneof1boxed) + +data class that stores validated Map payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| Oneof1BoxedMap(FrozenMap data)
    Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| FrozenMap | data()
    validated payload | +| Any? | getData()
    validated payload | + +## Oneof1 +class Oneof1
    +extends JsonSchema + +A schema class that validates payloads + +### Field Summary +| Modifier and Type | Field and Description | +| ----------------- | ---------------------- | +| List> | oneOf = listOf(
        [Schema0::class.java](#schema0),
        [Schema1::class.java](#schema1)
    ))
    | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| String | validate(arg: String, configuration: SchemaConfiguration) | +| Nothing? | validate(arg: Nothing?, configuration: SchemaConfiguration) | +| int | validate(arg: int, configuration: SchemaConfiguration) | +| long | validate(arg: long, configuration: SchemaConfiguration) | +| float | validate(arg: float, configuration: SchemaConfiguration) | +| double | validate(arg: double, configuration: SchemaConfiguration) | +| Number | validate(arg: Number, configuration: SchemaConfiguration) | +| boolean | validate(arg: boolean, configuration: SchemaConfiguration) | +| FrozenMap | validate(arg: Map<?, ?>, configuration: SchemaConfiguration) | +| FrozenList | validate(arg: List<*>, configuration: SchemaConfiguration) | +| [Oneof1BoxedString](#oneof1boxedstring) | validateAndBox(String, configuration: SchemaConfiguration) | +| [Oneof1BoxedVoid](#oneof1boxedvoid) | validateAndBox(Nothing?, configuration: SchemaConfiguration) | +| [Oneof1BoxedNumber](#oneof1boxednumber) | validateAndBox(Number, configuration: SchemaConfiguration) | +| [Oneof1BoxedBoolean](#oneof1boxedboolean) | validateAndBox(boolean, configuration: SchemaConfiguration) | +| [Oneof1BoxedMap](#oneof1boxedmap) | validateAndBox(Map<?, ?>, configuration: SchemaConfiguration) | +| [Oneof1BoxedList](#oneof1boxedlist) | validateAndBox(List<*>, configuration: SchemaConfiguration) | +| [Oneof1Boxed](#oneof1boxed) | validateAndBox(Any?, configuration: SchemaConfiguration) | +| Any? | validate(arg: Any?, configuration: SchemaConfiguration) | + +## Schema1Boxed +sealed interface Schema1Boxed
    +permits
    +[Schema1BoxedVoid](#schema1boxedvoid), +[Schema1BoxedBoolean](#schema1boxedboolean), +[Schema1BoxedNumber](#schema1boxednumber), +[Schema1BoxedString](#schema1boxedstring), +[Schema1BoxedList](#schema1boxedlist), +[Schema1BoxedMap](#schema1boxedmap) + +sealed interface that stores validated payloads using boxed classes + +## Schema1BoxedVoid +data class Schema1BoxedVoid
    +implements [Schema1Boxed](#schema1boxed) + +data class that stores validated null payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| Schema1BoxedVoid(Nothing? data)
    Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| Nothing? | data()
    validated payload | +| Any? | getData()
    validated payload | + +## Schema1BoxedBoolean +data class Schema1BoxedBoolean
    +implements [Schema1Boxed](#schema1boxed) + +record that stores validated boolean payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| Schema1BoxedBoolean(boolean data)
    Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| boolean | data()
    validated payload | +| Any? | getData()
    validated payload | + +## Schema1BoxedNumber +data class Schema1BoxedNumber
    +implements [Schema1Boxed](#schema1boxed) + +data class that stores validated Number payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| Schema1BoxedNumber(Number data)
    Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| Number | data()
    validated payload | +| Any? | getData()
    validated payload | + +## Schema1BoxedString +data class Schema1BoxedString
    +implements [Schema1Boxed](#schema1boxed) + +data class that stores validated String payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| Schema1BoxedString(String data)
    Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| String | data()
    validated payload | +| Any? | getData()
    validated payload | + +## Schema1BoxedList +data class Schema1BoxedList
    +implements [Schema1Boxed](#schema1boxed) + +data class that stores validated List payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| Schema1BoxedList(FrozenList data)
    Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| FrozenList | data()
    validated payload | +| Any? | getData()
    validated payload | + +## Schema1BoxedMap +data class Schema1BoxedMap
    +implements [Schema1Boxed](#schema1boxed) + +data class that stores validated Map payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| Schema1BoxedMap(FrozenMap data)
    Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| FrozenMap | data()
    validated payload | +| Any? | getData()
    validated payload | + +## Schema1 +class Schema1
    +extends JsonSchema + +A schema class that validates payloads + +### Field Summary +| Modifier and Type | Field and Description | +| ----------------- | ---------------------- | +| Number | minimum = 2 | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| String | validate(arg: String, configuration: SchemaConfiguration) | +| Nothing? | validate(arg: Nothing?, configuration: SchemaConfiguration) | +| int | validate(arg: int, configuration: SchemaConfiguration) | +| long | validate(arg: long, configuration: SchemaConfiguration) | +| float | validate(arg: float, configuration: SchemaConfiguration) | +| double | validate(arg: double, configuration: SchemaConfiguration) | +| Number | validate(arg: Number, configuration: SchemaConfiguration) | +| boolean | validate(arg: boolean, configuration: SchemaConfiguration) | +| FrozenMap | validate(arg: Map<?, ?>, configuration: SchemaConfiguration) | +| FrozenList | validate(arg: List<*>, configuration: SchemaConfiguration) | +| [Schema1BoxedString](#schema1boxedstring) | validateAndBox(String, configuration: SchemaConfiguration) | +| [Schema1BoxedVoid](#schema1boxedvoid) | validateAndBox(Nothing?, configuration: SchemaConfiguration) | +| [Schema1BoxedNumber](#schema1boxednumber) | validateAndBox(Number, configuration: SchemaConfiguration) | +| [Schema1BoxedBoolean](#schema1boxedboolean) | validateAndBox(boolean, configuration: SchemaConfiguration) | +| [Schema1BoxedMap](#schema1boxedmap) | validateAndBox(Map<?, ?>, configuration: SchemaConfiguration) | +| [Schema1BoxedList](#schema1boxedlist) | validateAndBox(List<*>, configuration: SchemaConfiguration) | +| [Schema1Boxed](#schema1boxed) | validateAndBox(Any?, configuration: SchemaConfiguration) | +| Any? | validate(arg: Any?, configuration: SchemaConfiguration) | + +## Schema0Boxed +sealed interface Schema0Boxed
    +permits
    +[Schema0BoxedNumber](#schema0boxednumber) + +sealed interface that stores validated payloads using boxed classes + +## Schema0BoxedNumber +data class Schema0BoxedNumber
    +implements [Schema0Boxed](#schema0boxed) + +data class that stores validated Number payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| Schema0BoxedNumber(Number data)
    Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| Number | data()
    validated payload | +| Any? | getData()
    validated payload | + +## Schema0 +class Schema0
    +extends IntJsonSchema.IntJsonSchema1 + +A schema class that validates payloads + +| Methods Inherited from class org.openapijsonschematools.client.schemas.IntJsonSchema.IntJsonSchema1 | +| ------------------------------------------------------------------ | +| validate | +| validateAndBox | + +[[Back to top]](#top) [[Back to Component Schemas]](../../../README.md#Component-Schemas) [[Back to README]](../../../README.md) diff --git a/samples/client/3_1_0_unit_test/kotlin/docs/components/schemas/OneofComplexTypes.md b/samples/client/3_1_0_unit_test/kotlin/docs/components/schemas/OneofComplexTypes.md new file mode 100644 index 00000000000..42bf6a2067a --- /dev/null +++ b/samples/client/3_1_0_unit_test/kotlin/docs/components/schemas/OneofComplexTypes.md @@ -0,0 +1,674 @@ +# OneofComplexTypes +org.openapijsonschematools.client.components.schemas.OneofComplexTypes.java +class OneofComplexTypes
    + +A class that contains necessary nested +- schema classes (which validate payloads), extends JsonSchema +- sealed interfaces which store validated payloads, Kotlin version of a sum type +- boxed classes which store validated payloads, sealed permits class implementations +- classes to store validated map payloads, extends FrozenMap +- classes to build inputs for map payloads + +## Nested Class Summary +| Modifier and Type | Class and Description | +| ----------------- | ---------------------- | +| sealed interface | [OneofComplexTypes.OneofComplexTypes1Boxed](#oneofcomplextypes1boxed)
    sealed interface for validated payloads | +| record | [OneofComplexTypes.OneofComplexTypes1BoxedVoid](#oneofcomplextypes1boxedvoid)
    boxed class to store validated null payloads | +| record | [OneofComplexTypes.OneofComplexTypes1BoxedBoolean](#oneofcomplextypes1boxedboolean)
    boxed class to store validated boolean payloads | +| record | [OneofComplexTypes.OneofComplexTypes1BoxedNumber](#oneofcomplextypes1boxednumber)
    boxed class to store validated Number payloads | +| record | [OneofComplexTypes.OneofComplexTypes1BoxedString](#oneofcomplextypes1boxedstring)
    boxed class to store validated String payloads | +| record | [OneofComplexTypes.OneofComplexTypes1BoxedList](#oneofcomplextypes1boxedlist)
    boxed class to store validated List payloads | +| record | [OneofComplexTypes.OneofComplexTypes1BoxedMap](#oneofcomplextypes1boxedmap)
    boxed class to store validated Map payloads | +| static class | [OneofComplexTypes.OneofComplexTypes1](#oneofcomplextypes1)
    schema class | +| sealed interface | [OneofComplexTypes.Schema1Boxed](#schema1boxed)
    sealed interface for validated payloads | +| record | [OneofComplexTypes.Schema1BoxedVoid](#schema1boxedvoid)
    boxed class to store validated null payloads | +| record | [OneofComplexTypes.Schema1BoxedBoolean](#schema1boxedboolean)
    boxed class to store validated boolean payloads | +| record | [OneofComplexTypes.Schema1BoxedNumber](#schema1boxednumber)
    boxed class to store validated Number payloads | +| record | [OneofComplexTypes.Schema1BoxedString](#schema1boxedstring)
    boxed class to store validated String payloads | +| record | [OneofComplexTypes.Schema1BoxedList](#schema1boxedlist)
    boxed class to store validated List payloads | +| record | [OneofComplexTypes.Schema1BoxedMap](#schema1boxedmap)
    boxed class to store validated Map payloads | +| static class | [OneofComplexTypes.Schema1](#schema1)
    schema class | +| static class | [OneofComplexTypes.Schema1MapBuilder](#schema1mapbuilder)
    builder for Map payloads | +| static class | [OneofComplexTypes.Schema1Map](#schema1map)
    output class for Map payloads | +| sealed interface | [OneofComplexTypes.FooBoxed](#fooboxed)
    sealed interface for validated payloads | +| record | [OneofComplexTypes.FooBoxedString](#fooboxedstring)
    boxed class to store validated String payloads | +| static class | [OneofComplexTypes.Foo](#foo)
    schema class | +| sealed interface | [OneofComplexTypes.Schema0Boxed](#schema0boxed)
    sealed interface for validated payloads | +| record | [OneofComplexTypes.Schema0BoxedVoid](#schema0boxedvoid)
    boxed class to store validated null payloads | +| record | [OneofComplexTypes.Schema0BoxedBoolean](#schema0boxedboolean)
    boxed class to store validated boolean payloads | +| record | [OneofComplexTypes.Schema0BoxedNumber](#schema0boxednumber)
    boxed class to store validated Number payloads | +| record | [OneofComplexTypes.Schema0BoxedString](#schema0boxedstring)
    boxed class to store validated String payloads | +| record | [OneofComplexTypes.Schema0BoxedList](#schema0boxedlist)
    boxed class to store validated List payloads | +| record | [OneofComplexTypes.Schema0BoxedMap](#schema0boxedmap)
    boxed class to store validated Map payloads | +| static class | [OneofComplexTypes.Schema0](#schema0)
    schema class | +| static class | [OneofComplexTypes.Schema0MapBuilder](#schema0mapbuilder)
    builder for Map payloads | +| static class | [OneofComplexTypes.Schema0Map](#schema0map)
    output class for Map payloads | +| sealed interface | [OneofComplexTypes.BarBoxed](#barboxed)
    sealed interface for validated payloads | +| record | [OneofComplexTypes.BarBoxedNumber](#barboxednumber)
    boxed class to store validated Number payloads | +| static class | [OneofComplexTypes.Bar](#bar)
    schema class | + +## OneofComplexTypes1Boxed +sealed interface OneofComplexTypes1Boxed
    +permits
    +[OneofComplexTypes1BoxedVoid](#oneofcomplextypes1boxedvoid), +[OneofComplexTypes1BoxedBoolean](#oneofcomplextypes1boxedboolean), +[OneofComplexTypes1BoxedNumber](#oneofcomplextypes1boxednumber), +[OneofComplexTypes1BoxedString](#oneofcomplextypes1boxedstring), +[OneofComplexTypes1BoxedList](#oneofcomplextypes1boxedlist), +[OneofComplexTypes1BoxedMap](#oneofcomplextypes1boxedmap) + +sealed interface that stores validated payloads using boxed classes + +## OneofComplexTypes1BoxedVoid +data class OneofComplexTypes1BoxedVoid
    +implements [OneofComplexTypes1Boxed](#oneofcomplextypes1boxed) + +data class that stores validated null payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| OneofComplexTypes1BoxedVoid(Nothing? data)
    Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| Nothing? | data()
    validated payload | +| Any? | getData()
    validated payload | + +## OneofComplexTypes1BoxedBoolean +data class OneofComplexTypes1BoxedBoolean
    +implements [OneofComplexTypes1Boxed](#oneofcomplextypes1boxed) + +record that stores validated boolean payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| OneofComplexTypes1BoxedBoolean(boolean data)
    Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| boolean | data()
    validated payload | +| Any? | getData()
    validated payload | + +## OneofComplexTypes1BoxedNumber +data class OneofComplexTypes1BoxedNumber
    +implements [OneofComplexTypes1Boxed](#oneofcomplextypes1boxed) + +data class that stores validated Number payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| OneofComplexTypes1BoxedNumber(Number data)
    Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| Number | data()
    validated payload | +| Any? | getData()
    validated payload | + +## OneofComplexTypes1BoxedString +data class OneofComplexTypes1BoxedString
    +implements [OneofComplexTypes1Boxed](#oneofcomplextypes1boxed) + +data class that stores validated String payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| OneofComplexTypes1BoxedString(String data)
    Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| String | data()
    validated payload | +| Any? | getData()
    validated payload | + +## OneofComplexTypes1BoxedList +data class OneofComplexTypes1BoxedList
    +implements [OneofComplexTypes1Boxed](#oneofcomplextypes1boxed) + +data class that stores validated List payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| OneofComplexTypes1BoxedList(FrozenList data)
    Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| FrozenList | data()
    validated payload | +| Any? | getData()
    validated payload | + +## OneofComplexTypes1BoxedMap +data class OneofComplexTypes1BoxedMap
    +implements [OneofComplexTypes1Boxed](#oneofcomplextypes1boxed) + +data class that stores validated Map payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| OneofComplexTypes1BoxedMap(FrozenMap data)
    Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| FrozenMap | data()
    validated payload | +| Any? | getData()
    validated payload | + +## OneofComplexTypes1 +class OneofComplexTypes1
    +extends JsonSchema + +A schema class that validates payloads + +### Field Summary +| Modifier and Type | Field and Description | +| ----------------- | ---------------------- | +| List> | oneOf = listOf(
        [Schema0::class.java](#schema0),
        [Schema1::class.java](#schema1)
    ))
    | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| String | validate(arg: String, configuration: SchemaConfiguration) | +| Nothing? | validate(arg: Nothing?, configuration: SchemaConfiguration) | +| int | validate(arg: int, configuration: SchemaConfiguration) | +| long | validate(arg: long, configuration: SchemaConfiguration) | +| float | validate(arg: float, configuration: SchemaConfiguration) | +| double | validate(arg: double, configuration: SchemaConfiguration) | +| Number | validate(arg: Number, configuration: SchemaConfiguration) | +| boolean | validate(arg: boolean, configuration: SchemaConfiguration) | +| FrozenMap | validate(arg: Map<?, ?>, configuration: SchemaConfiguration) | +| FrozenList | validate(arg: List<*>, configuration: SchemaConfiguration) | +| [OneofComplexTypes1BoxedString](#oneofcomplextypes1boxedstring) | validateAndBox(String, configuration: SchemaConfiguration) | +| [OneofComplexTypes1BoxedVoid](#oneofcomplextypes1boxedvoid) | validateAndBox(Nothing?, configuration: SchemaConfiguration) | +| [OneofComplexTypes1BoxedNumber](#oneofcomplextypes1boxednumber) | validateAndBox(Number, configuration: SchemaConfiguration) | +| [OneofComplexTypes1BoxedBoolean](#oneofcomplextypes1boxedboolean) | validateAndBox(boolean, configuration: SchemaConfiguration) | +| [OneofComplexTypes1BoxedMap](#oneofcomplextypes1boxedmap) | validateAndBox(Map<?, ?>, configuration: SchemaConfiguration) | +| [OneofComplexTypes1BoxedList](#oneofcomplextypes1boxedlist) | validateAndBox(List<*>, configuration: SchemaConfiguration) | +| [OneofComplexTypes1Boxed](#oneofcomplextypes1boxed) | validateAndBox(Any?, configuration: SchemaConfiguration) | +| Any? | validate(arg: Any?, configuration: SchemaConfiguration) | + +## Schema1Boxed +sealed interface Schema1Boxed
    +permits
    +[Schema1BoxedVoid](#schema1boxedvoid), +[Schema1BoxedBoolean](#schema1boxedboolean), +[Schema1BoxedNumber](#schema1boxednumber), +[Schema1BoxedString](#schema1boxedstring), +[Schema1BoxedList](#schema1boxedlist), +[Schema1BoxedMap](#schema1boxedmap) + +sealed interface that stores validated payloads using boxed classes + +## Schema1BoxedVoid +data class Schema1BoxedVoid
    +implements [Schema1Boxed](#schema1boxed) + +data class that stores validated null payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| Schema1BoxedVoid(Nothing? data)
    Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| Nothing? | data()
    validated payload | +| Any? | getData()
    validated payload | + +## Schema1BoxedBoolean +data class Schema1BoxedBoolean
    +implements [Schema1Boxed](#schema1boxed) + +record that stores validated boolean payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| Schema1BoxedBoolean(boolean data)
    Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| boolean | data()
    validated payload | +| Any? | getData()
    validated payload | + +## Schema1BoxedNumber +data class Schema1BoxedNumber
    +implements [Schema1Boxed](#schema1boxed) + +data class that stores validated Number payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| Schema1BoxedNumber(Number data)
    Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| Number | data()
    validated payload | +| Any? | getData()
    validated payload | + +## Schema1BoxedString +data class Schema1BoxedString
    +implements [Schema1Boxed](#schema1boxed) + +data class that stores validated String payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| Schema1BoxedString(String data)
    Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| String | data()
    validated payload | +| Any? | getData()
    validated payload | + +## Schema1BoxedList +data class Schema1BoxedList
    +implements [Schema1Boxed](#schema1boxed) + +data class that stores validated List payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| Schema1BoxedList(FrozenList data)
    Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| FrozenList | data()
    validated payload | +| Any? | getData()
    validated payload | + +## Schema1BoxedMap +data class Schema1BoxedMap
    +implements [Schema1Boxed](#schema1boxed) + +data class that stores validated Map payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| Schema1BoxedMap([Schema1Map](#schema1map) data)
    Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| [Schema1Map](#schema1map) | data()
    validated payload | +| Any? | getData()
    validated payload | + +## Schema1 +class Schema1
    +extends JsonSchema + +A schema class that validates payloads + +### Field Summary +| Modifier and Type | Field and Description | +| ----------------- | ---------------------- | +| Map> | properties = mapOf(
        "foo" to [Foo::class.java](#foo))
    )
    | +| Set | required = setOf(
        "foo"
    )
    | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| String | validate(arg: String, configuration: SchemaConfiguration) | +| Nothing? | validate(arg: Nothing?, configuration: SchemaConfiguration) | +| int | validate(arg: int, configuration: SchemaConfiguration) | +| long | validate(arg: long, configuration: SchemaConfiguration) | +| float | validate(arg: float, configuration: SchemaConfiguration) | +| double | validate(arg: double, configuration: SchemaConfiguration) | +| Number | validate(arg: Number, configuration: SchemaConfiguration) | +| boolean | validate(arg: boolean, configuration: SchemaConfiguration) | +| [Schema1Map](#schema1map) | validate(arg: [Map<?, ?>](#schema1mapbuilder), configuration: SchemaConfiguration) | +| FrozenList | validate(arg: List<*>, configuration: SchemaConfiguration) | +| [Schema1BoxedString](#schema1boxedstring) | validateAndBox(String, configuration: SchemaConfiguration) | +| [Schema1BoxedVoid](#schema1boxedvoid) | validateAndBox(Nothing?, configuration: SchemaConfiguration) | +| [Schema1BoxedNumber](#schema1boxednumber) | validateAndBox(Number, configuration: SchemaConfiguration) | +| [Schema1BoxedBoolean](#schema1boxedboolean) | validateAndBox(boolean, configuration: SchemaConfiguration) | +| [Schema1BoxedMap](#schema1boxedmap) | validateAndBox([Map<?, ?>](#schema1mapbuilder), configuration: SchemaConfiguration) | +| [Schema1BoxedList](#schema1boxedlist) | validateAndBox(List<*>, configuration: SchemaConfiguration) | +| [Schema1Boxed](#schema1boxed) | validateAndBox(Any?, configuration: SchemaConfiguration) | +| Any? | validate(arg: Any?, configuration: SchemaConfiguration) | + +## Schema1Map0Builder +class Schema1Map0Builder
    +builder for `Map` + +A class that builds the Map input type + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| Schema1Map0Builder(Map instance)
    Creates a builder that contains the passed instance | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| Map | build()
    Returns map input that should be used with Schema.validate | +| [Schema1Map0Builder](#schema1map0builder) | additionalProperty(key: String, value: Nothing?) | +| [Schema1Map0Builder](#schema1map0builder) | additionalProperty(key: String, value: Boolean) | +| [Schema1Map0Builder](#schema1map0builder) | additionalProperty(key: String, value: String) | +| [Schema1Map0Builder](#schema1map0builder) | additionalProperty(key: String, value: Int) | +| [Schema1Map0Builder](#schema1map0builder) | additionalProperty(key: String, value: Float) | +| [Schema1Map0Builder](#schema1map0builder) | additionalProperty(key: String, value: Long) | +| [Schema1Map0Builder](#schema1map0builder) | additionalProperty(key: String, value: Double) | +| [Schema1Map0Builder](#schema1map0builder) | additionalProperty(key: String, value: List) | +| [Schema1Map0Builder](#schema1map0builder) | additionalProperty(key: String, value: Map) | + +## Schema1MapBuilder +class Schema1MapBuilder
    +builder for `Map` + +A class that builds the Map input type + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| Schema1MapBuilder()
    Creates a builder that contains an empty map | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| [Schema1Map0Builder](#schema1map0builder) | foo(value: String) | + +## Schema1Map +class Schema1Map
    +extends FrozenMap + +A class to store validated Map payloads + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| static [Schema1Map](#schema1map) | of([Map](#schema1mapbuilder) arg, SchemaConfiguration configuration) | +| String | foo()
    | +| Any? | getAdditionalProperty(String name)
    provides type safety for additional properties | + +## FooBoxed +sealed interface FooBoxed
    +permits
    +[FooBoxedString](#fooboxedstring) + +sealed interface that stores validated payloads using boxed classes + +## FooBoxedString +data class FooBoxedString
    +implements [FooBoxed](#fooboxed) + +data class that stores validated String payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| FooBoxedString(String data)
    Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| String | data()
    validated payload | +| Any? | getData()
    validated payload | + +## Foo +class Foo
    +extends StringJsonSchema.StringJsonSchema1 + +A schema class that validates payloads + +| Methods Inherited from class org.openapijsonschematools.client.schemas.StringJsonSchema.StringJsonSchema1 | +| ------------------------------------------------------------------ | +| validate | +| validateAndBox | + +## Schema0Boxed +sealed interface Schema0Boxed
    +permits
    +[Schema0BoxedVoid](#schema0boxedvoid), +[Schema0BoxedBoolean](#schema0boxedboolean), +[Schema0BoxedNumber](#schema0boxednumber), +[Schema0BoxedString](#schema0boxedstring), +[Schema0BoxedList](#schema0boxedlist), +[Schema0BoxedMap](#schema0boxedmap) + +sealed interface that stores validated payloads using boxed classes + +## Schema0BoxedVoid +data class Schema0BoxedVoid
    +implements [Schema0Boxed](#schema0boxed) + +data class that stores validated null payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| Schema0BoxedVoid(Nothing? data)
    Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| Nothing? | data()
    validated payload | +| Any? | getData()
    validated payload | + +## Schema0BoxedBoolean +data class Schema0BoxedBoolean
    +implements [Schema0Boxed](#schema0boxed) + +record that stores validated boolean payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| Schema0BoxedBoolean(boolean data)
    Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| boolean | data()
    validated payload | +| Any? | getData()
    validated payload | + +## Schema0BoxedNumber +data class Schema0BoxedNumber
    +implements [Schema0Boxed](#schema0boxed) + +data class that stores validated Number payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| Schema0BoxedNumber(Number data)
    Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| Number | data()
    validated payload | +| Any? | getData()
    validated payload | + +## Schema0BoxedString +data class Schema0BoxedString
    +implements [Schema0Boxed](#schema0boxed) + +data class that stores validated String payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| Schema0BoxedString(String data)
    Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| String | data()
    validated payload | +| Any? | getData()
    validated payload | + +## Schema0BoxedList +data class Schema0BoxedList
    +implements [Schema0Boxed](#schema0boxed) + +data class that stores validated List payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| Schema0BoxedList(FrozenList data)
    Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| FrozenList | data()
    validated payload | +| Any? | getData()
    validated payload | + +## Schema0BoxedMap +data class Schema0BoxedMap
    +implements [Schema0Boxed](#schema0boxed) + +data class that stores validated Map payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| Schema0BoxedMap([Schema0Map](#schema0map) data)
    Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| [Schema0Map](#schema0map) | data()
    validated payload | +| Any? | getData()
    validated payload | + +## Schema0 +class Schema0
    +extends JsonSchema + +A schema class that validates payloads + +### Field Summary +| Modifier and Type | Field and Description | +| ----------------- | ---------------------- | +| Map> | properties = mapOf(
        "bar" to [Bar::class.java](#bar))
    )
    | +| Set | required = setOf(
        "bar"
    )
    | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| String | validate(arg: String, configuration: SchemaConfiguration) | +| Nothing? | validate(arg: Nothing?, configuration: SchemaConfiguration) | +| int | validate(arg: int, configuration: SchemaConfiguration) | +| long | validate(arg: long, configuration: SchemaConfiguration) | +| float | validate(arg: float, configuration: SchemaConfiguration) | +| double | validate(arg: double, configuration: SchemaConfiguration) | +| Number | validate(arg: Number, configuration: SchemaConfiguration) | +| boolean | validate(arg: boolean, configuration: SchemaConfiguration) | +| [Schema0Map](#schema0map) | validate(arg: [Map<?, ?>](#schema0mapbuilder), configuration: SchemaConfiguration) | +| FrozenList | validate(arg: List<*>, configuration: SchemaConfiguration) | +| [Schema0BoxedString](#schema0boxedstring) | validateAndBox(String, configuration: SchemaConfiguration) | +| [Schema0BoxedVoid](#schema0boxedvoid) | validateAndBox(Nothing?, configuration: SchemaConfiguration) | +| [Schema0BoxedNumber](#schema0boxednumber) | validateAndBox(Number, configuration: SchemaConfiguration) | +| [Schema0BoxedBoolean](#schema0boxedboolean) | validateAndBox(boolean, configuration: SchemaConfiguration) | +| [Schema0BoxedMap](#schema0boxedmap) | validateAndBox([Map<?, ?>](#schema0mapbuilder), configuration: SchemaConfiguration) | +| [Schema0BoxedList](#schema0boxedlist) | validateAndBox(List<*>, configuration: SchemaConfiguration) | +| [Schema0Boxed](#schema0boxed) | validateAndBox(Any?, configuration: SchemaConfiguration) | +| Any? | validate(arg: Any?, configuration: SchemaConfiguration) | + +## Schema0Map0Builder +class Schema0Map0Builder
    +builder for `Map` + +A class that builds the Map input type + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| Schema0Map0Builder(Map instance)
    Creates a builder that contains the passed instance | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| Map | build()
    Returns map input that should be used with Schema.validate | +| [Schema0Map0Builder](#schema0map0builder) | additionalProperty(key: String, value: Nothing?) | +| [Schema0Map0Builder](#schema0map0builder) | additionalProperty(key: String, value: Boolean) | +| [Schema0Map0Builder](#schema0map0builder) | additionalProperty(key: String, value: String) | +| [Schema0Map0Builder](#schema0map0builder) | additionalProperty(key: String, value: Int) | +| [Schema0Map0Builder](#schema0map0builder) | additionalProperty(key: String, value: Float) | +| [Schema0Map0Builder](#schema0map0builder) | additionalProperty(key: String, value: Long) | +| [Schema0Map0Builder](#schema0map0builder) | additionalProperty(key: String, value: Double) | +| [Schema0Map0Builder](#schema0map0builder) | additionalProperty(key: String, value: List) | +| [Schema0Map0Builder](#schema0map0builder) | additionalProperty(key: String, value: Map) | + +## Schema0MapBuilder +class Schema0MapBuilder
    +builder for `Map` + +A class that builds the Map input type + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| Schema0MapBuilder()
    Creates a builder that contains an empty map | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| [Schema0Map0Builder](#schema0map0builder) | bar(value: Int) | +| [Schema0Map0Builder](#schema0map0builder) | bar(value: Float) | +| [Schema0Map0Builder](#schema0map0builder) | bar(value: Long) | +| [Schema0Map0Builder](#schema0map0builder) | bar(value: Double) | + +## Schema0Map +class Schema0Map
    +extends FrozenMap + +A class to store validated Map payloads + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| static [Schema0Map](#schema0map) | of([Map](#schema0mapbuilder) arg, SchemaConfiguration configuration) | +| Number | bar()
    | +| Any? | getAdditionalProperty(String name)
    provides type safety for additional properties | + +## BarBoxed +sealed interface BarBoxed
    +permits
    +[BarBoxedNumber](#barboxednumber) + +sealed interface that stores validated payloads using boxed classes + +## BarBoxedNumber +data class BarBoxedNumber
    +implements [BarBoxed](#barboxed) + +data class that stores validated Number payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| BarBoxedNumber(Number data)
    Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| Number | data()
    validated payload | +| Any? | getData()
    validated payload | + +## Bar +class Bar
    +extends IntJsonSchema.IntJsonSchema1 + +A schema class that validates payloads + +| Methods Inherited from class org.openapijsonschematools.client.schemas.IntJsonSchema.IntJsonSchema1 | +| ------------------------------------------------------------------ | +| validate | +| validateAndBox | + +[[Back to top]](#top) [[Back to Component Schemas]](../../../README.md#Component-Schemas) [[Back to README]](../../../README.md) diff --git a/samples/client/3_1_0_unit_test/kotlin/docs/components/schemas/OneofWithBaseSchema.md b/samples/client/3_1_0_unit_test/kotlin/docs/components/schemas/OneofWithBaseSchema.md new file mode 100644 index 00000000000..ec2efa5bd7a --- /dev/null +++ b/samples/client/3_1_0_unit_test/kotlin/docs/components/schemas/OneofWithBaseSchema.md @@ -0,0 +1,394 @@ +# OneofWithBaseSchema +org.openapijsonschematools.client.components.schemas.OneofWithBaseSchema.java +class OneofWithBaseSchema
    + +A class that contains necessary nested +- schema classes (which validate payloads), extends JsonSchema +- sealed interfaces which store validated payloads, Kotlin version of a sum type +- boxed classes which store validated payloads, sealed permits class implementations + +## Nested Class Summary +| Modifier and Type | Class and Description | +| ----------------- | ---------------------- | +| sealed interface | [OneofWithBaseSchema.OneofWithBaseSchema1Boxed](#oneofwithbaseschema1boxed)
    sealed interface for validated payloads | +| record | [OneofWithBaseSchema.OneofWithBaseSchema1BoxedString](#oneofwithbaseschema1boxedstring)
    boxed class to store validated String payloads | +| static class | [OneofWithBaseSchema.OneofWithBaseSchema1](#oneofwithbaseschema1)
    schema class | +| sealed interface | [OneofWithBaseSchema.Schema1Boxed](#schema1boxed)
    sealed interface for validated payloads | +| record | [OneofWithBaseSchema.Schema1BoxedVoid](#schema1boxedvoid)
    boxed class to store validated null payloads | +| record | [OneofWithBaseSchema.Schema1BoxedBoolean](#schema1boxedboolean)
    boxed class to store validated boolean payloads | +| record | [OneofWithBaseSchema.Schema1BoxedNumber](#schema1boxednumber)
    boxed class to store validated Number payloads | +| record | [OneofWithBaseSchema.Schema1BoxedString](#schema1boxedstring)
    boxed class to store validated String payloads | +| record | [OneofWithBaseSchema.Schema1BoxedList](#schema1boxedlist)
    boxed class to store validated List payloads | +| record | [OneofWithBaseSchema.Schema1BoxedMap](#schema1boxedmap)
    boxed class to store validated Map payloads | +| static class | [OneofWithBaseSchema.Schema1](#schema1)
    schema class | +| sealed interface | [OneofWithBaseSchema.Schema0Boxed](#schema0boxed)
    sealed interface for validated payloads | +| record | [OneofWithBaseSchema.Schema0BoxedVoid](#schema0boxedvoid)
    boxed class to store validated null payloads | +| record | [OneofWithBaseSchema.Schema0BoxedBoolean](#schema0boxedboolean)
    boxed class to store validated boolean payloads | +| record | [OneofWithBaseSchema.Schema0BoxedNumber](#schema0boxednumber)
    boxed class to store validated Number payloads | +| record | [OneofWithBaseSchema.Schema0BoxedString](#schema0boxedstring)
    boxed class to store validated String payloads | +| record | [OneofWithBaseSchema.Schema0BoxedList](#schema0boxedlist)
    boxed class to store validated List payloads | +| record | [OneofWithBaseSchema.Schema0BoxedMap](#schema0boxedmap)
    boxed class to store validated Map payloads | +| static class | [OneofWithBaseSchema.Schema0](#schema0)
    schema class | + +## OneofWithBaseSchema1Boxed +sealed interface OneofWithBaseSchema1Boxed
    +permits
    +[OneofWithBaseSchema1BoxedString](#oneofwithbaseschema1boxedstring) + +sealed interface that stores validated payloads using boxed classes + +## OneofWithBaseSchema1BoxedString +data class OneofWithBaseSchema1BoxedString
    +implements [OneofWithBaseSchema1Boxed](#oneofwithbaseschema1boxed) + +data class that stores validated String payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| OneofWithBaseSchema1BoxedString(String data)
    Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| String | data()
    validated payload | +| Any? | getData()
    validated payload | + +## OneofWithBaseSchema1 +class OneofWithBaseSchema1
    +extends JsonSchema + +A schema class that validates payloads + +### Code Sample +``` +import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags; +import org.openapijsonschematools.client.configurations.SchemaConfiguration; +import org.openapijsonschematools.client.exceptions.ValidationException; +import org.openapijsonschematools.client.schemas.validation.MapUtils; +import org.openapijsonschematools.client.schemas.validation.FrozenList; +import org.openapijsonschematools.client.schemas.validation.FrozenMap; +import org.openapijsonschematools.client.components.schemas.OneofWithBaseSchema; + +import java.util.Arrays; +import java.util.List; +import java.util.AbstractMap; + +static final SchemaConfiguration configuration = new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().build()); + +// String validation +String validatedPayload = OneofWithBaseSchema.OneofWithBaseSchema1.validate( + "a", + configuration +); +``` + +### Field Summary +| Modifier and Type | Field and Description | +| ----------------- | ---------------------- | +| Set> | type = setOf(
        String::class.java
    )
    | +| List> | oneOf = listOf(
        [Schema0::class.java](#schema0),
        [Schema1::class.java](#schema1)
    ))
    | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| String | validate(arg: String, configuration: SchemaConfiguration) | +| [OneofWithBaseSchema1BoxedString](#oneofwithbaseschema1boxedstring) | validateAndBox(String, configuration: SchemaConfiguration) | +| [OneofWithBaseSchema1Boxed](#oneofwithbaseschema1boxed) | validateAndBox(Any?, configuration: SchemaConfiguration) | +| Any? | validate(arg: Any?, configuration: SchemaConfiguration) | + +## Schema1Boxed +sealed interface Schema1Boxed
    +permits
    +[Schema1BoxedVoid](#schema1boxedvoid), +[Schema1BoxedBoolean](#schema1boxedboolean), +[Schema1BoxedNumber](#schema1boxednumber), +[Schema1BoxedString](#schema1boxedstring), +[Schema1BoxedList](#schema1boxedlist), +[Schema1BoxedMap](#schema1boxedmap) + +sealed interface that stores validated payloads using boxed classes + +## Schema1BoxedVoid +data class Schema1BoxedVoid
    +implements [Schema1Boxed](#schema1boxed) + +data class that stores validated null payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| Schema1BoxedVoid(Nothing? data)
    Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| Nothing? | data()
    validated payload | +| Any? | getData()
    validated payload | + +## Schema1BoxedBoolean +data class Schema1BoxedBoolean
    +implements [Schema1Boxed](#schema1boxed) + +record that stores validated boolean payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| Schema1BoxedBoolean(boolean data)
    Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| boolean | data()
    validated payload | +| Any? | getData()
    validated payload | + +## Schema1BoxedNumber +data class Schema1BoxedNumber
    +implements [Schema1Boxed](#schema1boxed) + +data class that stores validated Number payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| Schema1BoxedNumber(Number data)
    Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| Number | data()
    validated payload | +| Any? | getData()
    validated payload | + +## Schema1BoxedString +data class Schema1BoxedString
    +implements [Schema1Boxed](#schema1boxed) + +data class that stores validated String payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| Schema1BoxedString(String data)
    Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| String | data()
    validated payload | +| Any? | getData()
    validated payload | + +## Schema1BoxedList +data class Schema1BoxedList
    +implements [Schema1Boxed](#schema1boxed) + +data class that stores validated List payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| Schema1BoxedList(FrozenList data)
    Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| FrozenList | data()
    validated payload | +| Any? | getData()
    validated payload | + +## Schema1BoxedMap +data class Schema1BoxedMap
    +implements [Schema1Boxed](#schema1boxed) + +data class that stores validated Map payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| Schema1BoxedMap(FrozenMap data)
    Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| FrozenMap | data()
    validated payload | +| Any? | getData()
    validated payload | + +## Schema1 +class Schema1
    +extends JsonSchema + +A schema class that validates payloads + +### Field Summary +| Modifier and Type | Field and Description | +| ----------------- | ---------------------- | +| Integer | maxLength = 4 | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| String | validate(arg: String, configuration: SchemaConfiguration) | +| Nothing? | validate(arg: Nothing?, configuration: SchemaConfiguration) | +| int | validate(arg: int, configuration: SchemaConfiguration) | +| long | validate(arg: long, configuration: SchemaConfiguration) | +| float | validate(arg: float, configuration: SchemaConfiguration) | +| double | validate(arg: double, configuration: SchemaConfiguration) | +| Number | validate(arg: Number, configuration: SchemaConfiguration) | +| boolean | validate(arg: boolean, configuration: SchemaConfiguration) | +| FrozenMap | validate(arg: Map<?, ?>, configuration: SchemaConfiguration) | +| FrozenList | validate(arg: List<*>, configuration: SchemaConfiguration) | +| [Schema1BoxedString](#schema1boxedstring) | validateAndBox(String, configuration: SchemaConfiguration) | +| [Schema1BoxedVoid](#schema1boxedvoid) | validateAndBox(Nothing?, configuration: SchemaConfiguration) | +| [Schema1BoxedNumber](#schema1boxednumber) | validateAndBox(Number, configuration: SchemaConfiguration) | +| [Schema1BoxedBoolean](#schema1boxedboolean) | validateAndBox(boolean, configuration: SchemaConfiguration) | +| [Schema1BoxedMap](#schema1boxedmap) | validateAndBox(Map<?, ?>, configuration: SchemaConfiguration) | +| [Schema1BoxedList](#schema1boxedlist) | validateAndBox(List<*>, configuration: SchemaConfiguration) | +| [Schema1Boxed](#schema1boxed) | validateAndBox(Any?, configuration: SchemaConfiguration) | +| Any? | validate(arg: Any?, configuration: SchemaConfiguration) | + +## Schema0Boxed +sealed interface Schema0Boxed
    +permits
    +[Schema0BoxedVoid](#schema0boxedvoid), +[Schema0BoxedBoolean](#schema0boxedboolean), +[Schema0BoxedNumber](#schema0boxednumber), +[Schema0BoxedString](#schema0boxedstring), +[Schema0BoxedList](#schema0boxedlist), +[Schema0BoxedMap](#schema0boxedmap) + +sealed interface that stores validated payloads using boxed classes + +## Schema0BoxedVoid +data class Schema0BoxedVoid
    +implements [Schema0Boxed](#schema0boxed) + +data class that stores validated null payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| Schema0BoxedVoid(Nothing? data)
    Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| Nothing? | data()
    validated payload | +| Any? | getData()
    validated payload | + +## Schema0BoxedBoolean +data class Schema0BoxedBoolean
    +implements [Schema0Boxed](#schema0boxed) + +record that stores validated boolean payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| Schema0BoxedBoolean(boolean data)
    Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| boolean | data()
    validated payload | +| Any? | getData()
    validated payload | + +## Schema0BoxedNumber +data class Schema0BoxedNumber
    +implements [Schema0Boxed](#schema0boxed) + +data class that stores validated Number payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| Schema0BoxedNumber(Number data)
    Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| Number | data()
    validated payload | +| Any? | getData()
    validated payload | + +## Schema0BoxedString +data class Schema0BoxedString
    +implements [Schema0Boxed](#schema0boxed) + +data class that stores validated String payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| Schema0BoxedString(String data)
    Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| String | data()
    validated payload | +| Any? | getData()
    validated payload | + +## Schema0BoxedList +data class Schema0BoxedList
    +implements [Schema0Boxed](#schema0boxed) + +data class that stores validated List payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| Schema0BoxedList(FrozenList data)
    Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| FrozenList | data()
    validated payload | +| Any? | getData()
    validated payload | + +## Schema0BoxedMap +data class Schema0BoxedMap
    +implements [Schema0Boxed](#schema0boxed) + +data class that stores validated Map payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| Schema0BoxedMap(FrozenMap data)
    Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| FrozenMap | data()
    validated payload | +| Any? | getData()
    validated payload | + +## Schema0 +class Schema0
    +extends JsonSchema + +A schema class that validates payloads + +### Field Summary +| Modifier and Type | Field and Description | +| ----------------- | ---------------------- | +| Integer | minLength = 2 | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| String | validate(arg: String, configuration: SchemaConfiguration) | +| Nothing? | validate(arg: Nothing?, configuration: SchemaConfiguration) | +| int | validate(arg: int, configuration: SchemaConfiguration) | +| long | validate(arg: long, configuration: SchemaConfiguration) | +| float | validate(arg: float, configuration: SchemaConfiguration) | +| double | validate(arg: double, configuration: SchemaConfiguration) | +| Number | validate(arg: Number, configuration: SchemaConfiguration) | +| boolean | validate(arg: boolean, configuration: SchemaConfiguration) | +| FrozenMap | validate(arg: Map<?, ?>, configuration: SchemaConfiguration) | +| FrozenList | validate(arg: List<*>, configuration: SchemaConfiguration) | +| [Schema0BoxedString](#schema0boxedstring) | validateAndBox(String, configuration: SchemaConfiguration) | +| [Schema0BoxedVoid](#schema0boxedvoid) | validateAndBox(Nothing?, configuration: SchemaConfiguration) | +| [Schema0BoxedNumber](#schema0boxednumber) | validateAndBox(Number, configuration: SchemaConfiguration) | +| [Schema0BoxedBoolean](#schema0boxedboolean) | validateAndBox(boolean, configuration: SchemaConfiguration) | +| [Schema0BoxedMap](#schema0boxedmap) | validateAndBox(Map<?, ?>, configuration: SchemaConfiguration) | +| [Schema0BoxedList](#schema0boxedlist) | validateAndBox(List<*>, configuration: SchemaConfiguration) | +| [Schema0Boxed](#schema0boxed) | validateAndBox(Any?, configuration: SchemaConfiguration) | +| Any? | validate(arg: Any?, configuration: SchemaConfiguration) | + +[[Back to top]](#top) [[Back to Component Schemas]](../../../README.md#Component-Schemas) [[Back to README]](../../../README.md) diff --git a/samples/client/3_1_0_unit_test/kotlin/docs/components/schemas/OneofWithEmptySchema.md b/samples/client/3_1_0_unit_test/kotlin/docs/components/schemas/OneofWithEmptySchema.md new file mode 100644 index 00000000000..3c41a98cb37 --- /dev/null +++ b/samples/client/3_1_0_unit_test/kotlin/docs/components/schemas/OneofWithEmptySchema.md @@ -0,0 +1,340 @@ +# OneofWithEmptySchema +org.openapijsonschematools.client.components.schemas.OneofWithEmptySchema.java +class OneofWithEmptySchema
    + +A class that contains necessary nested +- schema classes (which validate payloads), extends JsonSchema +- sealed interfaces which store validated payloads, Kotlin version of a sum type +- boxed classes which store validated payloads, sealed permits class implementations + +## Nested Class Summary +| Modifier and Type | Class and Description | +| ----------------- | ---------------------- | +| sealed interface | [OneofWithEmptySchema.OneofWithEmptySchema1Boxed](#oneofwithemptyschema1boxed)
    sealed interface for validated payloads | +| record | [OneofWithEmptySchema.OneofWithEmptySchema1BoxedVoid](#oneofwithemptyschema1boxedvoid)
    boxed class to store validated null payloads | +| record | [OneofWithEmptySchema.OneofWithEmptySchema1BoxedBoolean](#oneofwithemptyschema1boxedboolean)
    boxed class to store validated boolean payloads | +| record | [OneofWithEmptySchema.OneofWithEmptySchema1BoxedNumber](#oneofwithemptyschema1boxednumber)
    boxed class to store validated Number payloads | +| record | [OneofWithEmptySchema.OneofWithEmptySchema1BoxedString](#oneofwithemptyschema1boxedstring)
    boxed class to store validated String payloads | +| record | [OneofWithEmptySchema.OneofWithEmptySchema1BoxedList](#oneofwithemptyschema1boxedlist)
    boxed class to store validated List payloads | +| record | [OneofWithEmptySchema.OneofWithEmptySchema1BoxedMap](#oneofwithemptyschema1boxedmap)
    boxed class to store validated Map payloads | +| static class | [OneofWithEmptySchema.OneofWithEmptySchema1](#oneofwithemptyschema1)
    schema class | +| sealed interface | [OneofWithEmptySchema.Schema1Boxed](#schema1boxed)
    sealed interface for validated payloads | +| record | [OneofWithEmptySchema.Schema1BoxedVoid](#schema1boxedvoid)
    boxed class to store validated null payloads | +| record | [OneofWithEmptySchema.Schema1BoxedBoolean](#schema1boxedboolean)
    boxed class to store validated boolean payloads | +| record | [OneofWithEmptySchema.Schema1BoxedNumber](#schema1boxednumber)
    boxed class to store validated Number payloads | +| record | [OneofWithEmptySchema.Schema1BoxedString](#schema1boxedstring)
    boxed class to store validated String payloads | +| record | [OneofWithEmptySchema.Schema1BoxedList](#schema1boxedlist)
    boxed class to store validated List payloads | +| record | [OneofWithEmptySchema.Schema1BoxedMap](#schema1boxedmap)
    boxed class to store validated Map payloads | +| static class | [OneofWithEmptySchema.Schema1](#schema1)
    schema class | +| sealed interface | [OneofWithEmptySchema.Schema0Boxed](#schema0boxed)
    sealed interface for validated payloads | +| record | [OneofWithEmptySchema.Schema0BoxedNumber](#schema0boxednumber)
    boxed class to store validated Number payloads | +| static class | [OneofWithEmptySchema.Schema0](#schema0)
    schema class | + +## OneofWithEmptySchema1Boxed +sealed interface OneofWithEmptySchema1Boxed
    +permits
    +[OneofWithEmptySchema1BoxedVoid](#oneofwithemptyschema1boxedvoid), +[OneofWithEmptySchema1BoxedBoolean](#oneofwithemptyschema1boxedboolean), +[OneofWithEmptySchema1BoxedNumber](#oneofwithemptyschema1boxednumber), +[OneofWithEmptySchema1BoxedString](#oneofwithemptyschema1boxedstring), +[OneofWithEmptySchema1BoxedList](#oneofwithemptyschema1boxedlist), +[OneofWithEmptySchema1BoxedMap](#oneofwithemptyschema1boxedmap) + +sealed interface that stores validated payloads using boxed classes + +## OneofWithEmptySchema1BoxedVoid +data class OneofWithEmptySchema1BoxedVoid
    +implements [OneofWithEmptySchema1Boxed](#oneofwithemptyschema1boxed) + +data class that stores validated null payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| OneofWithEmptySchema1BoxedVoid(Nothing? data)
    Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| Nothing? | data()
    validated payload | +| Any? | getData()
    validated payload | + +## OneofWithEmptySchema1BoxedBoolean +data class OneofWithEmptySchema1BoxedBoolean
    +implements [OneofWithEmptySchema1Boxed](#oneofwithemptyschema1boxed) + +record that stores validated boolean payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| OneofWithEmptySchema1BoxedBoolean(boolean data)
    Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| boolean | data()
    validated payload | +| Any? | getData()
    validated payload | + +## OneofWithEmptySchema1BoxedNumber +data class OneofWithEmptySchema1BoxedNumber
    +implements [OneofWithEmptySchema1Boxed](#oneofwithemptyschema1boxed) + +data class that stores validated Number payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| OneofWithEmptySchema1BoxedNumber(Number data)
    Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| Number | data()
    validated payload | +| Any? | getData()
    validated payload | + +## OneofWithEmptySchema1BoxedString +data class OneofWithEmptySchema1BoxedString
    +implements [OneofWithEmptySchema1Boxed](#oneofwithemptyschema1boxed) + +data class that stores validated String payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| OneofWithEmptySchema1BoxedString(String data)
    Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| String | data()
    validated payload | +| Any? | getData()
    validated payload | + +## OneofWithEmptySchema1BoxedList +data class OneofWithEmptySchema1BoxedList
    +implements [OneofWithEmptySchema1Boxed](#oneofwithemptyschema1boxed) + +data class that stores validated List payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| OneofWithEmptySchema1BoxedList(FrozenList data)
    Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| FrozenList | data()
    validated payload | +| Any? | getData()
    validated payload | + +## OneofWithEmptySchema1BoxedMap +data class OneofWithEmptySchema1BoxedMap
    +implements [OneofWithEmptySchema1Boxed](#oneofwithemptyschema1boxed) + +data class that stores validated Map payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| OneofWithEmptySchema1BoxedMap(FrozenMap data)
    Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| FrozenMap | data()
    validated payload | +| Any? | getData()
    validated payload | + +## OneofWithEmptySchema1 +class OneofWithEmptySchema1
    +extends JsonSchema + +A schema class that validates payloads + +### Field Summary +| Modifier and Type | Field and Description | +| ----------------- | ---------------------- | +| List> | oneOf = listOf(
        [Schema0::class.java](#schema0),
        [Schema1::class.java](#schema1)
    ))
    | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| String | validate(arg: String, configuration: SchemaConfiguration) | +| Nothing? | validate(arg: Nothing?, configuration: SchemaConfiguration) | +| int | validate(arg: int, configuration: SchemaConfiguration) | +| long | validate(arg: long, configuration: SchemaConfiguration) | +| float | validate(arg: float, configuration: SchemaConfiguration) | +| double | validate(arg: double, configuration: SchemaConfiguration) | +| Number | validate(arg: Number, configuration: SchemaConfiguration) | +| boolean | validate(arg: boolean, configuration: SchemaConfiguration) | +| FrozenMap | validate(arg: Map<?, ?>, configuration: SchemaConfiguration) | +| FrozenList | validate(arg: List<*>, configuration: SchemaConfiguration) | +| [OneofWithEmptySchema1BoxedString](#oneofwithemptyschema1boxedstring) | validateAndBox(String, configuration: SchemaConfiguration) | +| [OneofWithEmptySchema1BoxedVoid](#oneofwithemptyschema1boxedvoid) | validateAndBox(Nothing?, configuration: SchemaConfiguration) | +| [OneofWithEmptySchema1BoxedNumber](#oneofwithemptyschema1boxednumber) | validateAndBox(Number, configuration: SchemaConfiguration) | +| [OneofWithEmptySchema1BoxedBoolean](#oneofwithemptyschema1boxedboolean) | validateAndBox(boolean, configuration: SchemaConfiguration) | +| [OneofWithEmptySchema1BoxedMap](#oneofwithemptyschema1boxedmap) | validateAndBox(Map<?, ?>, configuration: SchemaConfiguration) | +| [OneofWithEmptySchema1BoxedList](#oneofwithemptyschema1boxedlist) | validateAndBox(List<*>, configuration: SchemaConfiguration) | +| [OneofWithEmptySchema1Boxed](#oneofwithemptyschema1boxed) | validateAndBox(Any?, configuration: SchemaConfiguration) | +| Any? | validate(arg: Any?, configuration: SchemaConfiguration) | + +## Schema1Boxed +sealed interface Schema1Boxed
    +permits
    +[Schema1BoxedVoid](#schema1boxedvoid), +[Schema1BoxedBoolean](#schema1boxedboolean), +[Schema1BoxedNumber](#schema1boxednumber), +[Schema1BoxedString](#schema1boxedstring), +[Schema1BoxedList](#schema1boxedlist), +[Schema1BoxedMap](#schema1boxedmap) + +sealed interface that stores validated payloads using boxed classes + +## Schema1BoxedVoid +data class Schema1BoxedVoid
    +implements [Schema1Boxed](#schema1boxed) + +data class that stores validated null payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| Schema1BoxedVoid(Nothing? data)
    Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| Nothing? | data()
    validated payload | +| Any? | getData()
    validated payload | + +## Schema1BoxedBoolean +data class Schema1BoxedBoolean
    +implements [Schema1Boxed](#schema1boxed) + +record that stores validated boolean payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| Schema1BoxedBoolean(boolean data)
    Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| boolean | data()
    validated payload | +| Any? | getData()
    validated payload | + +## Schema1BoxedNumber +data class Schema1BoxedNumber
    +implements [Schema1Boxed](#schema1boxed) + +data class that stores validated Number payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| Schema1BoxedNumber(Number data)
    Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| Number | data()
    validated payload | +| Any? | getData()
    validated payload | + +## Schema1BoxedString +data class Schema1BoxedString
    +implements [Schema1Boxed](#schema1boxed) + +data class that stores validated String payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| Schema1BoxedString(String data)
    Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| String | data()
    validated payload | +| Any? | getData()
    validated payload | + +## Schema1BoxedList +data class Schema1BoxedList
    +implements [Schema1Boxed](#schema1boxed) + +data class that stores validated List payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| Schema1BoxedList(FrozenList data)
    Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| FrozenList | data()
    validated payload | +| Any? | getData()
    validated payload | + +## Schema1BoxedMap +data class Schema1BoxedMap
    +implements [Schema1Boxed](#schema1boxed) + +data class that stores validated Map payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| Schema1BoxedMap(FrozenMap data)
    Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| FrozenMap | data()
    validated payload | +| Any? | getData()
    validated payload | + +## Schema1 +class Schema1
    +extends AnyTypeJsonSchema.AnyTypeJsonSchema1 + +A schema class that validates payloads + +| Methods Inherited from class org.openapijsonschematools.client.schemas.AnyTypeJsonSchema.AnyTypeJsonSchema1 | +| ------------------------------------------------------------------ | +| validate | +| validateAndBox | + +## Schema0Boxed +sealed interface Schema0Boxed
    +permits
    +[Schema0BoxedNumber](#schema0boxednumber) + +sealed interface that stores validated payloads using boxed classes + +## Schema0BoxedNumber +data class Schema0BoxedNumber
    +implements [Schema0Boxed](#schema0boxed) + +data class that stores validated Number payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| Schema0BoxedNumber(Number data)
    Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| Number | data()
    validated payload | +| Any? | getData()
    validated payload | + +## Schema0 +class Schema0
    +extends NumberJsonSchema.NumberJsonSchema1 + +A schema class that validates payloads + +| Methods Inherited from class org.openapijsonschematools.client.schemas.NumberJsonSchema.NumberJsonSchema1 | +| ------------------------------------------------------------------ | +| validate | +| validateAndBox | + +[[Back to top]](#top) [[Back to Component Schemas]](../../../README.md#Component-Schemas) [[Back to README]](../../../README.md) diff --git a/samples/client/3_1_0_unit_test/kotlin/docs/components/schemas/OneofWithRequired.md b/samples/client/3_1_0_unit_test/kotlin/docs/components/schemas/OneofWithRequired.md new file mode 100644 index 00000000000..5fb44f316d2 --- /dev/null +++ b/samples/client/3_1_0_unit_test/kotlin/docs/components/schemas/OneofWithRequired.md @@ -0,0 +1,617 @@ +# OneofWithRequired +org.openapijsonschematools.client.components.schemas.OneofWithRequired.java +class OneofWithRequired
    + +A class that contains necessary nested +- schema classes (which validate payloads), extends JsonSchema +- sealed interfaces which store validated payloads, Kotlin version of a sum type +- boxed classes which store validated payloads, sealed permits class implementations +- classes to store validated map payloads, extends FrozenMap +- classes to build inputs for map payloads + +## Nested Class Summary +| Modifier and Type | Class and Description | +| ----------------- | ---------------------- | +| sealed interface | [OneofWithRequired.OneofWithRequired1Boxed](#oneofwithrequired1boxed)
    sealed interface for validated payloads | +| record | [OneofWithRequired.OneofWithRequired1BoxedMap](#oneofwithrequired1boxedmap)
    boxed class to store validated Map payloads | +| static class | [OneofWithRequired.OneofWithRequired1](#oneofwithrequired1)
    schema class | +| sealed interface | [OneofWithRequired.Schema1Boxed](#schema1boxed)
    sealed interface for validated payloads | +| record | [OneofWithRequired.Schema1BoxedVoid](#schema1boxedvoid)
    boxed class to store validated null payloads | +| record | [OneofWithRequired.Schema1BoxedBoolean](#schema1boxedboolean)
    boxed class to store validated boolean payloads | +| record | [OneofWithRequired.Schema1BoxedNumber](#schema1boxednumber)
    boxed class to store validated Number payloads | +| record | [OneofWithRequired.Schema1BoxedString](#schema1boxedstring)
    boxed class to store validated String payloads | +| record | [OneofWithRequired.Schema1BoxedList](#schema1boxedlist)
    boxed class to store validated List payloads | +| record | [OneofWithRequired.Schema1BoxedMap](#schema1boxedmap)
    boxed class to store validated Map payloads | +| static class | [OneofWithRequired.Schema1](#schema1)
    schema class | +| static class | [OneofWithRequired.Schema1MapBuilder](#schema1mapbuilder)
    builder for Map payloads | +| static class | [OneofWithRequired.Schema1Map](#schema1map)
    output class for Map payloads | +| sealed interface | [OneofWithRequired.Schema0Boxed](#schema0boxed)
    sealed interface for validated payloads | +| record | [OneofWithRequired.Schema0BoxedVoid](#schema0boxedvoid)
    boxed class to store validated null payloads | +| record | [OneofWithRequired.Schema0BoxedBoolean](#schema0boxedboolean)
    boxed class to store validated boolean payloads | +| record | [OneofWithRequired.Schema0BoxedNumber](#schema0boxednumber)
    boxed class to store validated Number payloads | +| record | [OneofWithRequired.Schema0BoxedString](#schema0boxedstring)
    boxed class to store validated String payloads | +| record | [OneofWithRequired.Schema0BoxedList](#schema0boxedlist)
    boxed class to store validated List payloads | +| record | [OneofWithRequired.Schema0BoxedMap](#schema0boxedmap)
    boxed class to store validated Map payloads | +| static class | [OneofWithRequired.Schema0](#schema0)
    schema class | +| static class | [OneofWithRequired.Schema0MapBuilder](#schema0mapbuilder)
    builder for Map payloads | +| static class | [OneofWithRequired.Schema0Map](#schema0map)
    output class for Map payloads | + +## OneofWithRequired1Boxed +sealed interface OneofWithRequired1Boxed
    +permits
    +[OneofWithRequired1BoxedMap](#oneofwithrequired1boxedmap) + +sealed interface that stores validated payloads using boxed classes + +## OneofWithRequired1BoxedMap +data class OneofWithRequired1BoxedMap
    +implements [OneofWithRequired1Boxed](#oneofwithrequired1boxed) + +data class that stores validated Map payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| OneofWithRequired1BoxedMap(FrozenMap data)
    Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| FrozenMap | data()
    validated payload | +| Any? | getData()
    validated payload | + +## OneofWithRequired1 +class OneofWithRequired1
    +extends JsonSchema + +A schema class that validates payloads + +### Field Summary +| Modifier and Type | Field and Description | +| ----------------- | ---------------------- | +| Set> | type = setOf(Map::class.java) | +| List> | oneOf = listOf(
        [Schema0::class.java](#schema0),
        [Schema1::class.java](#schema1)
    ))
    | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| FrozenMap | validate(arg: Map<?, ?>, configuration: SchemaConfiguration) | +| [OneofWithRequired1BoxedMap](#oneofwithrequired1boxedmap) | validateAndBox(Map<?, ?>, configuration: SchemaConfiguration) | +| [OneofWithRequired1Boxed](#oneofwithrequired1boxed) | validateAndBox(Any?, configuration: SchemaConfiguration) | +| Any? | validate(arg: Any?, configuration: SchemaConfiguration) | + +## Schema1Boxed +sealed interface Schema1Boxed
    +permits
    +[Schema1BoxedVoid](#schema1boxedvoid), +[Schema1BoxedBoolean](#schema1boxedboolean), +[Schema1BoxedNumber](#schema1boxednumber), +[Schema1BoxedString](#schema1boxedstring), +[Schema1BoxedList](#schema1boxedlist), +[Schema1BoxedMap](#schema1boxedmap) + +sealed interface that stores validated payloads using boxed classes + +## Schema1BoxedVoid +data class Schema1BoxedVoid
    +implements [Schema1Boxed](#schema1boxed) + +data class that stores validated null payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| Schema1BoxedVoid(Nothing? data)
    Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| Nothing? | data()
    validated payload | +| Any? | getData()
    validated payload | + +## Schema1BoxedBoolean +data class Schema1BoxedBoolean
    +implements [Schema1Boxed](#schema1boxed) + +record that stores validated boolean payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| Schema1BoxedBoolean(boolean data)
    Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| boolean | data()
    validated payload | +| Any? | getData()
    validated payload | + +## Schema1BoxedNumber +data class Schema1BoxedNumber
    +implements [Schema1Boxed](#schema1boxed) + +data class that stores validated Number payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| Schema1BoxedNumber(Number data)
    Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| Number | data()
    validated payload | +| Any? | getData()
    validated payload | + +## Schema1BoxedString +data class Schema1BoxedString
    +implements [Schema1Boxed](#schema1boxed) + +data class that stores validated String payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| Schema1BoxedString(String data)
    Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| String | data()
    validated payload | +| Any? | getData()
    validated payload | + +## Schema1BoxedList +data class Schema1BoxedList
    +implements [Schema1Boxed](#schema1boxed) + +data class that stores validated List payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| Schema1BoxedList(FrozenList data)
    Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| FrozenList | data()
    validated payload | +| Any? | getData()
    validated payload | + +## Schema1BoxedMap +data class Schema1BoxedMap
    +implements [Schema1Boxed](#schema1boxed) + +data class that stores validated Map payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| Schema1BoxedMap([Schema1Map](#schema1map) data)
    Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| [Schema1Map](#schema1map) | data()
    validated payload | +| Any? | getData()
    validated payload | + +## Schema1 +class Schema1
    +extends JsonSchema + +A schema class that validates payloads + +### Field Summary +| Modifier and Type | Field and Description | +| ----------------- | ---------------------- | +| Set | required = setOf(
        "baz",
        "foo"
    )
    | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| String | validate(arg: String, configuration: SchemaConfiguration) | +| Nothing? | validate(arg: Nothing?, configuration: SchemaConfiguration) | +| int | validate(arg: int, configuration: SchemaConfiguration) | +| long | validate(arg: long, configuration: SchemaConfiguration) | +| float | validate(arg: float, configuration: SchemaConfiguration) | +| double | validate(arg: double, configuration: SchemaConfiguration) | +| Number | validate(arg: Number, configuration: SchemaConfiguration) | +| boolean | validate(arg: boolean, configuration: SchemaConfiguration) | +| [Schema1Map](#schema1map) | validate(arg: [Map<?, ?>](#schema1mapbuilder), configuration: SchemaConfiguration) | +| FrozenList | validate(arg: List<*>, configuration: SchemaConfiguration) | +| [Schema1BoxedString](#schema1boxedstring) | validateAndBox(String, configuration: SchemaConfiguration) | +| [Schema1BoxedVoid](#schema1boxedvoid) | validateAndBox(Nothing?, configuration: SchemaConfiguration) | +| [Schema1BoxedNumber](#schema1boxednumber) | validateAndBox(Number, configuration: SchemaConfiguration) | +| [Schema1BoxedBoolean](#schema1boxedboolean) | validateAndBox(boolean, configuration: SchemaConfiguration) | +| [Schema1BoxedMap](#schema1boxedmap) | validateAndBox([Map<?, ?>](#schema1mapbuilder), configuration: SchemaConfiguration) | +| [Schema1BoxedList](#schema1boxedlist) | validateAndBox(List<*>, configuration: SchemaConfiguration) | +| [Schema1Boxed](#schema1boxed) | validateAndBox(Any?, configuration: SchemaConfiguration) | +| Any? | validate(arg: Any?, configuration: SchemaConfiguration) | + +## Schema1Map00Builder +class Schema1Map00Builder
    +builder for `Map` + +A class that builds the Map input type + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| Schema1Map00Builder(Map instance)
    Creates a builder that contains the passed instance | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| Map | build()
    Returns map input that should be used with Schema.validate | +| [Schema1Map00Builder](#schema1map00builder) | additionalProperty(key: String, value: Nothing?) | +| [Schema1Map00Builder](#schema1map00builder) | additionalProperty(key: String, value: Boolean) | +| [Schema1Map00Builder](#schema1map00builder) | additionalProperty(key: String, value: String) | +| [Schema1Map00Builder](#schema1map00builder) | additionalProperty(key: String, value: Int) | +| [Schema1Map00Builder](#schema1map00builder) | additionalProperty(key: String, value: Float) | +| [Schema1Map00Builder](#schema1map00builder) | additionalProperty(key: String, value: Long) | +| [Schema1Map00Builder](#schema1map00builder) | additionalProperty(key: String, value: Double) | +| [Schema1Map00Builder](#schema1map00builder) | additionalProperty(key: String, value: List) | +| [Schema1Map00Builder](#schema1map00builder) | additionalProperty(key: String, value: Map) | + +## Schema1Map01Builder +class Schema1Map01Builder
    +builder for `Map` + +A class that builds the Map input type + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| Schema1Map01Builder(Map instance)
    Creates a builder that contains the passed instance | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| [Schema1Map00Builder](#schema1map00builder) | foo(value: Nothing?) | +| [Schema1Map00Builder](#schema1map00builder) | foo(value: Boolean) | +| [Schema1Map00Builder](#schema1map00builder) | foo(value: String) | +| [Schema1Map00Builder](#schema1map00builder) | foo(value: Int) | +| [Schema1Map00Builder](#schema1map00builder) | foo(value: Float) | +| [Schema1Map00Builder](#schema1map00builder) | foo(value: Long) | +| [Schema1Map00Builder](#schema1map00builder) | foo(value: Double) | +| [Schema1Map00Builder](#schema1map00builder) | foo(value: List) | +| [Schema1Map00Builder](#schema1map00builder) | foo(value: Map) | + +## Schema1Map10Builder +class Schema1Map10Builder
    +builder for `Map` + +A class that builds the Map input type + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| Schema1Map10Builder(Map instance)
    Creates a builder that contains the passed instance | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| [Schema1Map00Builder](#schema1map00builder) | baz(value: Nothing?) | +| [Schema1Map00Builder](#schema1map00builder) | baz(value: Boolean) | +| [Schema1Map00Builder](#schema1map00builder) | baz(value: String) | +| [Schema1Map00Builder](#schema1map00builder) | baz(value: Int) | +| [Schema1Map00Builder](#schema1map00builder) | baz(value: Float) | +| [Schema1Map00Builder](#schema1map00builder) | baz(value: Long) | +| [Schema1Map00Builder](#schema1map00builder) | baz(value: Double) | +| [Schema1Map00Builder](#schema1map00builder) | baz(value: List) | +| [Schema1Map00Builder](#schema1map00builder) | baz(value: Map) | + +## Schema1MapBuilder +class Schema1MapBuilder
    +builder for `Map` + +A class that builds the Map input type + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| Schema1MapBuilder()
    Creates a builder that contains an empty map | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| [Schema1Map01Builder](#schema1map01builder) | baz(value: Nothing?) | +| [Schema1Map01Builder](#schema1map01builder) | baz(value: Boolean) | +| [Schema1Map01Builder](#schema1map01builder) | baz(value: String) | +| [Schema1Map01Builder](#schema1map01builder) | baz(value: Int) | +| [Schema1Map01Builder](#schema1map01builder) | baz(value: Float) | +| [Schema1Map01Builder](#schema1map01builder) | baz(value: Long) | +| [Schema1Map01Builder](#schema1map01builder) | baz(value: Double) | +| [Schema1Map01Builder](#schema1map01builder) | baz(value: List) | +| [Schema1Map01Builder](#schema1map01builder) | baz(value: Map) | +| [Schema1Map10Builder](#schema1map10builder) | foo(value: Nothing?) | +| [Schema1Map10Builder](#schema1map10builder) | foo(value: Boolean) | +| [Schema1Map10Builder](#schema1map10builder) | foo(value: String) | +| [Schema1Map10Builder](#schema1map10builder) | foo(value: Int) | +| [Schema1Map10Builder](#schema1map10builder) | foo(value: Float) | +| [Schema1Map10Builder](#schema1map10builder) | foo(value: Long) | +| [Schema1Map10Builder](#schema1map10builder) | foo(value: Double) | +| [Schema1Map10Builder](#schema1map10builder) | foo(value: List) | +| [Schema1Map10Builder](#schema1map10builder) | foo(value: Map) | + +## Schema1Map +class Schema1Map
    +extends FrozenMap + +A class to store validated Map payloads + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| static [Schema1Map](#schema1map) | of([Map](#schema1mapbuilder) arg, SchemaConfiguration configuration) | +| Any? | baz()
    | +| Any? | foo()
    | +| Any? | getAdditionalProperty(String name)
    provides type safety for additional properties | + +## Schema0Boxed +sealed interface Schema0Boxed
    +permits
    +[Schema0BoxedVoid](#schema0boxedvoid), +[Schema0BoxedBoolean](#schema0boxedboolean), +[Schema0BoxedNumber](#schema0boxednumber), +[Schema0BoxedString](#schema0boxedstring), +[Schema0BoxedList](#schema0boxedlist), +[Schema0BoxedMap](#schema0boxedmap) + +sealed interface that stores validated payloads using boxed classes + +## Schema0BoxedVoid +data class Schema0BoxedVoid
    +implements [Schema0Boxed](#schema0boxed) + +data class that stores validated null payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| Schema0BoxedVoid(Nothing? data)
    Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| Nothing? | data()
    validated payload | +| Any? | getData()
    validated payload | + +## Schema0BoxedBoolean +data class Schema0BoxedBoolean
    +implements [Schema0Boxed](#schema0boxed) + +record that stores validated boolean payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| Schema0BoxedBoolean(boolean data)
    Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| boolean | data()
    validated payload | +| Any? | getData()
    validated payload | + +## Schema0BoxedNumber +data class Schema0BoxedNumber
    +implements [Schema0Boxed](#schema0boxed) + +data class that stores validated Number payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| Schema0BoxedNumber(Number data)
    Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| Number | data()
    validated payload | +| Any? | getData()
    validated payload | + +## Schema0BoxedString +data class Schema0BoxedString
    +implements [Schema0Boxed](#schema0boxed) + +data class that stores validated String payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| Schema0BoxedString(String data)
    Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| String | data()
    validated payload | +| Any? | getData()
    validated payload | + +## Schema0BoxedList +data class Schema0BoxedList
    +implements [Schema0Boxed](#schema0boxed) + +data class that stores validated List payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| Schema0BoxedList(FrozenList data)
    Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| FrozenList | data()
    validated payload | +| Any? | getData()
    validated payload | + +## Schema0BoxedMap +data class Schema0BoxedMap
    +implements [Schema0Boxed](#schema0boxed) + +data class that stores validated Map payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| Schema0BoxedMap([Schema0Map](#schema0map) data)
    Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| [Schema0Map](#schema0map) | data()
    validated payload | +| Any? | getData()
    validated payload | + +## Schema0 +class Schema0
    +extends JsonSchema + +A schema class that validates payloads + +### Field Summary +| Modifier and Type | Field and Description | +| ----------------- | ---------------------- | +| Set | required = setOf(
        "bar",
        "foo"
    )
    | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| String | validate(arg: String, configuration: SchemaConfiguration) | +| Nothing? | validate(arg: Nothing?, configuration: SchemaConfiguration) | +| int | validate(arg: int, configuration: SchemaConfiguration) | +| long | validate(arg: long, configuration: SchemaConfiguration) | +| float | validate(arg: float, configuration: SchemaConfiguration) | +| double | validate(arg: double, configuration: SchemaConfiguration) | +| Number | validate(arg: Number, configuration: SchemaConfiguration) | +| boolean | validate(arg: boolean, configuration: SchemaConfiguration) | +| [Schema0Map](#schema0map) | validate(arg: [Map<?, ?>](#schema0mapbuilder), configuration: SchemaConfiguration) | +| FrozenList | validate(arg: List<*>, configuration: SchemaConfiguration) | +| [Schema0BoxedString](#schema0boxedstring) | validateAndBox(String, configuration: SchemaConfiguration) | +| [Schema0BoxedVoid](#schema0boxedvoid) | validateAndBox(Nothing?, configuration: SchemaConfiguration) | +| [Schema0BoxedNumber](#schema0boxednumber) | validateAndBox(Number, configuration: SchemaConfiguration) | +| [Schema0BoxedBoolean](#schema0boxedboolean) | validateAndBox(boolean, configuration: SchemaConfiguration) | +| [Schema0BoxedMap](#schema0boxedmap) | validateAndBox([Map<?, ?>](#schema0mapbuilder), configuration: SchemaConfiguration) | +| [Schema0BoxedList](#schema0boxedlist) | validateAndBox(List<*>, configuration: SchemaConfiguration) | +| [Schema0Boxed](#schema0boxed) | validateAndBox(Any?, configuration: SchemaConfiguration) | +| Any? | validate(arg: Any?, configuration: SchemaConfiguration) | + +## Schema0Map00Builder +class Schema0Map00Builder
    +builder for `Map` + +A class that builds the Map input type + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| Schema0Map00Builder(Map instance)
    Creates a builder that contains the passed instance | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| Map | build()
    Returns map input that should be used with Schema.validate | +| [Schema0Map00Builder](#schema0map00builder) | additionalProperty(key: String, value: Nothing?) | +| [Schema0Map00Builder](#schema0map00builder) | additionalProperty(key: String, value: Boolean) | +| [Schema0Map00Builder](#schema0map00builder) | additionalProperty(key: String, value: String) | +| [Schema0Map00Builder](#schema0map00builder) | additionalProperty(key: String, value: Int) | +| [Schema0Map00Builder](#schema0map00builder) | additionalProperty(key: String, value: Float) | +| [Schema0Map00Builder](#schema0map00builder) | additionalProperty(key: String, value: Long) | +| [Schema0Map00Builder](#schema0map00builder) | additionalProperty(key: String, value: Double) | +| [Schema0Map00Builder](#schema0map00builder) | additionalProperty(key: String, value: List) | +| [Schema0Map00Builder](#schema0map00builder) | additionalProperty(key: String, value: Map) | + +## Schema0Map01Builder +class Schema0Map01Builder
    +builder for `Map` + +A class that builds the Map input type + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| Schema0Map01Builder(Map instance)
    Creates a builder that contains the passed instance | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| [Schema0Map00Builder](#schema0map00builder) | foo(value: Nothing?) | +| [Schema0Map00Builder](#schema0map00builder) | foo(value: Boolean) | +| [Schema0Map00Builder](#schema0map00builder) | foo(value: String) | +| [Schema0Map00Builder](#schema0map00builder) | foo(value: Int) | +| [Schema0Map00Builder](#schema0map00builder) | foo(value: Float) | +| [Schema0Map00Builder](#schema0map00builder) | foo(value: Long) | +| [Schema0Map00Builder](#schema0map00builder) | foo(value: Double) | +| [Schema0Map00Builder](#schema0map00builder) | foo(value: List) | +| [Schema0Map00Builder](#schema0map00builder) | foo(value: Map) | + +## Schema0Map10Builder +class Schema0Map10Builder
    +builder for `Map` + +A class that builds the Map input type + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| Schema0Map10Builder(Map instance)
    Creates a builder that contains the passed instance | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| [Schema0Map00Builder](#schema0map00builder) | bar(value: Nothing?) | +| [Schema0Map00Builder](#schema0map00builder) | bar(value: Boolean) | +| [Schema0Map00Builder](#schema0map00builder) | bar(value: String) | +| [Schema0Map00Builder](#schema0map00builder) | bar(value: Int) | +| [Schema0Map00Builder](#schema0map00builder) | bar(value: Float) | +| [Schema0Map00Builder](#schema0map00builder) | bar(value: Long) | +| [Schema0Map00Builder](#schema0map00builder) | bar(value: Double) | +| [Schema0Map00Builder](#schema0map00builder) | bar(value: List) | +| [Schema0Map00Builder](#schema0map00builder) | bar(value: Map) | + +## Schema0MapBuilder +class Schema0MapBuilder
    +builder for `Map` + +A class that builds the Map input type + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| Schema0MapBuilder()
    Creates a builder that contains an empty map | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| [Schema0Map01Builder](#schema0map01builder) | bar(value: Nothing?) | +| [Schema0Map01Builder](#schema0map01builder) | bar(value: Boolean) | +| [Schema0Map01Builder](#schema0map01builder) | bar(value: String) | +| [Schema0Map01Builder](#schema0map01builder) | bar(value: Int) | +| [Schema0Map01Builder](#schema0map01builder) | bar(value: Float) | +| [Schema0Map01Builder](#schema0map01builder) | bar(value: Long) | +| [Schema0Map01Builder](#schema0map01builder) | bar(value: Double) | +| [Schema0Map01Builder](#schema0map01builder) | bar(value: List) | +| [Schema0Map01Builder](#schema0map01builder) | bar(value: Map) | +| [Schema0Map10Builder](#schema0map10builder) | foo(value: Nothing?) | +| [Schema0Map10Builder](#schema0map10builder) | foo(value: Boolean) | +| [Schema0Map10Builder](#schema0map10builder) | foo(value: String) | +| [Schema0Map10Builder](#schema0map10builder) | foo(value: Int) | +| [Schema0Map10Builder](#schema0map10builder) | foo(value: Float) | +| [Schema0Map10Builder](#schema0map10builder) | foo(value: Long) | +| [Schema0Map10Builder](#schema0map10builder) | foo(value: Double) | +| [Schema0Map10Builder](#schema0map10builder) | foo(value: List) | +| [Schema0Map10Builder](#schema0map10builder) | foo(value: Map) | + +## Schema0Map +class Schema0Map
    +extends FrozenMap + +A class to store validated Map payloads + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| static [Schema0Map](#schema0map) | of([Map](#schema0mapbuilder) arg, SchemaConfiguration configuration) | +| Any? | bar()
    | +| Any? | foo()
    | +| Any? | getAdditionalProperty(String name)
    provides type safety for additional properties | + +[[Back to top]](#top) [[Back to Component Schemas]](../../../README.md#Component-Schemas) [[Back to README]](../../../README.md) diff --git a/samples/client/3_1_0_unit_test/kotlin/docs/components/schemas/PatternIsNotAnchored.md b/samples/client/3_1_0_unit_test/kotlin/docs/components/schemas/PatternIsNotAnchored.md new file mode 100644 index 00000000000..db50b22bddc --- /dev/null +++ b/samples/client/3_1_0_unit_test/kotlin/docs/components/schemas/PatternIsNotAnchored.md @@ -0,0 +1,169 @@ +# PatternIsNotAnchored +org.openapijsonschematools.client.components.schemas.PatternIsNotAnchored.java +class PatternIsNotAnchored
    + +A class that contains necessary nested +- schema classes (which validate payloads), extends JsonSchema +- sealed interfaces which store validated payloads, Kotlin version of a sum type +- boxed classes which store validated payloads, sealed permits class implementations + +## Nested Class Summary +| Modifier and Type | Class and Description | +| ----------------- | ---------------------- | +| sealed interface | [PatternIsNotAnchored.PatternIsNotAnchored1Boxed](#patternisnotanchored1boxed)
    sealed interface for validated payloads | +| record | [PatternIsNotAnchored.PatternIsNotAnchored1BoxedVoid](#patternisnotanchored1boxedvoid)
    boxed class to store validated null payloads | +| record | [PatternIsNotAnchored.PatternIsNotAnchored1BoxedBoolean](#patternisnotanchored1boxedboolean)
    boxed class to store validated boolean payloads | +| record | [PatternIsNotAnchored.PatternIsNotAnchored1BoxedNumber](#patternisnotanchored1boxednumber)
    boxed class to store validated Number payloads | +| record | [PatternIsNotAnchored.PatternIsNotAnchored1BoxedString](#patternisnotanchored1boxedstring)
    boxed class to store validated String payloads | +| record | [PatternIsNotAnchored.PatternIsNotAnchored1BoxedList](#patternisnotanchored1boxedlist)
    boxed class to store validated List payloads | +| record | [PatternIsNotAnchored.PatternIsNotAnchored1BoxedMap](#patternisnotanchored1boxedmap)
    boxed class to store validated Map payloads | +| static class | [PatternIsNotAnchored.PatternIsNotAnchored1](#patternisnotanchored1)
    schema class | + +## PatternIsNotAnchored1Boxed +sealed interface PatternIsNotAnchored1Boxed
    +permits
    +[PatternIsNotAnchored1BoxedVoid](#patternisnotanchored1boxedvoid), +[PatternIsNotAnchored1BoxedBoolean](#patternisnotanchored1boxedboolean), +[PatternIsNotAnchored1BoxedNumber](#patternisnotanchored1boxednumber), +[PatternIsNotAnchored1BoxedString](#patternisnotanchored1boxedstring), +[PatternIsNotAnchored1BoxedList](#patternisnotanchored1boxedlist), +[PatternIsNotAnchored1BoxedMap](#patternisnotanchored1boxedmap) + +sealed interface that stores validated payloads using boxed classes + +## PatternIsNotAnchored1BoxedVoid +data class PatternIsNotAnchored1BoxedVoid
    +implements [PatternIsNotAnchored1Boxed](#patternisnotanchored1boxed) + +data class that stores validated null payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| PatternIsNotAnchored1BoxedVoid(Nothing? data)
    Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| Nothing? | data()
    validated payload | +| Any? | getData()
    validated payload | + +## PatternIsNotAnchored1BoxedBoolean +data class PatternIsNotAnchored1BoxedBoolean
    +implements [PatternIsNotAnchored1Boxed](#patternisnotanchored1boxed) + +record that stores validated boolean payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| PatternIsNotAnchored1BoxedBoolean(boolean data)
    Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| boolean | data()
    validated payload | +| Any? | getData()
    validated payload | + +## PatternIsNotAnchored1BoxedNumber +data class PatternIsNotAnchored1BoxedNumber
    +implements [PatternIsNotAnchored1Boxed](#patternisnotanchored1boxed) + +data class that stores validated Number payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| PatternIsNotAnchored1BoxedNumber(Number data)
    Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| Number | data()
    validated payload | +| Any? | getData()
    validated payload | + +## PatternIsNotAnchored1BoxedString +data class PatternIsNotAnchored1BoxedString
    +implements [PatternIsNotAnchored1Boxed](#patternisnotanchored1boxed) + +data class that stores validated String payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| PatternIsNotAnchored1BoxedString(String data)
    Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| String | data()
    validated payload | +| Any? | getData()
    validated payload | + +## PatternIsNotAnchored1BoxedList +data class PatternIsNotAnchored1BoxedList
    +implements [PatternIsNotAnchored1Boxed](#patternisnotanchored1boxed) + +data class that stores validated List payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| PatternIsNotAnchored1BoxedList(FrozenList data)
    Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| FrozenList | data()
    validated payload | +| Any? | getData()
    validated payload | + +## PatternIsNotAnchored1BoxedMap +data class PatternIsNotAnchored1BoxedMap
    +implements [PatternIsNotAnchored1Boxed](#patternisnotanchored1boxed) + +data class that stores validated Map payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| PatternIsNotAnchored1BoxedMap(FrozenMap data)
    Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| FrozenMap | data()
    validated payload | +| Any? | getData()
    validated payload | + +## PatternIsNotAnchored1 +class PatternIsNotAnchored1
    +extends JsonSchema + +A schema class that validates payloads + +### Field Summary +| Modifier and Type | Field and Description | +| ----------------- | ---------------------- | +| Pattern | pattern = Pattern.compile(
        "a+"
    )
    | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| String | validate(arg: String, configuration: SchemaConfiguration) | +| Nothing? | validate(arg: Nothing?, configuration: SchemaConfiguration) | +| int | validate(arg: int, configuration: SchemaConfiguration) | +| long | validate(arg: long, configuration: SchemaConfiguration) | +| float | validate(arg: float, configuration: SchemaConfiguration) | +| double | validate(arg: double, configuration: SchemaConfiguration) | +| Number | validate(arg: Number, configuration: SchemaConfiguration) | +| boolean | validate(arg: boolean, configuration: SchemaConfiguration) | +| FrozenMap | validate(arg: Map<?, ?>, configuration: SchemaConfiguration) | +| FrozenList | validate(arg: List<*>, configuration: SchemaConfiguration) | +| [PatternIsNotAnchored1BoxedString](#patternisnotanchored1boxedstring) | validateAndBox(String, configuration: SchemaConfiguration) | +| [PatternIsNotAnchored1BoxedVoid](#patternisnotanchored1boxedvoid) | validateAndBox(Nothing?, configuration: SchemaConfiguration) | +| [PatternIsNotAnchored1BoxedNumber](#patternisnotanchored1boxednumber) | validateAndBox(Number, configuration: SchemaConfiguration) | +| [PatternIsNotAnchored1BoxedBoolean](#patternisnotanchored1boxedboolean) | validateAndBox(boolean, configuration: SchemaConfiguration) | +| [PatternIsNotAnchored1BoxedMap](#patternisnotanchored1boxedmap) | validateAndBox(Map<?, ?>, configuration: SchemaConfiguration) | +| [PatternIsNotAnchored1BoxedList](#patternisnotanchored1boxedlist) | validateAndBox(List<*>, configuration: SchemaConfiguration) | +| [PatternIsNotAnchored1Boxed](#patternisnotanchored1boxed) | validateAndBox(Any?, configuration: SchemaConfiguration) | +| Any? | validate(arg: Any?, configuration: SchemaConfiguration) | + +[[Back to top]](#top) [[Back to Component Schemas]](../../../README.md#Component-Schemas) [[Back to README]](../../../README.md) diff --git a/samples/client/3_1_0_unit_test/kotlin/docs/components/schemas/PatternValidation.md b/samples/client/3_1_0_unit_test/kotlin/docs/components/schemas/PatternValidation.md new file mode 100644 index 00000000000..38aabdd0f51 --- /dev/null +++ b/samples/client/3_1_0_unit_test/kotlin/docs/components/schemas/PatternValidation.md @@ -0,0 +1,169 @@ +# PatternValidation +org.openapijsonschematools.client.components.schemas.PatternValidation.java +class PatternValidation
    + +A class that contains necessary nested +- schema classes (which validate payloads), extends JsonSchema +- sealed interfaces which store validated payloads, Kotlin version of a sum type +- boxed classes which store validated payloads, sealed permits class implementations + +## Nested Class Summary +| Modifier and Type | Class and Description | +| ----------------- | ---------------------- | +| sealed interface | [PatternValidation.PatternValidation1Boxed](#patternvalidation1boxed)
    sealed interface for validated payloads | +| record | [PatternValidation.PatternValidation1BoxedVoid](#patternvalidation1boxedvoid)
    boxed class to store validated null payloads | +| record | [PatternValidation.PatternValidation1BoxedBoolean](#patternvalidation1boxedboolean)
    boxed class to store validated boolean payloads | +| record | [PatternValidation.PatternValidation1BoxedNumber](#patternvalidation1boxednumber)
    boxed class to store validated Number payloads | +| record | [PatternValidation.PatternValidation1BoxedString](#patternvalidation1boxedstring)
    boxed class to store validated String payloads | +| record | [PatternValidation.PatternValidation1BoxedList](#patternvalidation1boxedlist)
    boxed class to store validated List payloads | +| record | [PatternValidation.PatternValidation1BoxedMap](#patternvalidation1boxedmap)
    boxed class to store validated Map payloads | +| static class | [PatternValidation.PatternValidation1](#patternvalidation1)
    schema class | + +## PatternValidation1Boxed +sealed interface PatternValidation1Boxed
    +permits
    +[PatternValidation1BoxedVoid](#patternvalidation1boxedvoid), +[PatternValidation1BoxedBoolean](#patternvalidation1boxedboolean), +[PatternValidation1BoxedNumber](#patternvalidation1boxednumber), +[PatternValidation1BoxedString](#patternvalidation1boxedstring), +[PatternValidation1BoxedList](#patternvalidation1boxedlist), +[PatternValidation1BoxedMap](#patternvalidation1boxedmap) + +sealed interface that stores validated payloads using boxed classes + +## PatternValidation1BoxedVoid +data class PatternValidation1BoxedVoid
    +implements [PatternValidation1Boxed](#patternvalidation1boxed) + +data class that stores validated null payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| PatternValidation1BoxedVoid(Nothing? data)
    Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| Nothing? | data()
    validated payload | +| Any? | getData()
    validated payload | + +## PatternValidation1BoxedBoolean +data class PatternValidation1BoxedBoolean
    +implements [PatternValidation1Boxed](#patternvalidation1boxed) + +record that stores validated boolean payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| PatternValidation1BoxedBoolean(boolean data)
    Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| boolean | data()
    validated payload | +| Any? | getData()
    validated payload | + +## PatternValidation1BoxedNumber +data class PatternValidation1BoxedNumber
    +implements [PatternValidation1Boxed](#patternvalidation1boxed) + +data class that stores validated Number payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| PatternValidation1BoxedNumber(Number data)
    Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| Number | data()
    validated payload | +| Any? | getData()
    validated payload | + +## PatternValidation1BoxedString +data class PatternValidation1BoxedString
    +implements [PatternValidation1Boxed](#patternvalidation1boxed) + +data class that stores validated String payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| PatternValidation1BoxedString(String data)
    Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| String | data()
    validated payload | +| Any? | getData()
    validated payload | + +## PatternValidation1BoxedList +data class PatternValidation1BoxedList
    +implements [PatternValidation1Boxed](#patternvalidation1boxed) + +data class that stores validated List payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| PatternValidation1BoxedList(FrozenList data)
    Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| FrozenList | data()
    validated payload | +| Any? | getData()
    validated payload | + +## PatternValidation1BoxedMap +data class PatternValidation1BoxedMap
    +implements [PatternValidation1Boxed](#patternvalidation1boxed) + +data class that stores validated Map payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| PatternValidation1BoxedMap(FrozenMap data)
    Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| FrozenMap | data()
    validated payload | +| Any? | getData()
    validated payload | + +## PatternValidation1 +class PatternValidation1
    +extends JsonSchema + +A schema class that validates payloads + +### Field Summary +| Modifier and Type | Field and Description | +| ----------------- | ---------------------- | +| Pattern | pattern = Pattern.compile(
        "^a*\$"
    )
    | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| String | validate(arg: String, configuration: SchemaConfiguration) | +| Nothing? | validate(arg: Nothing?, configuration: SchemaConfiguration) | +| int | validate(arg: int, configuration: SchemaConfiguration) | +| long | validate(arg: long, configuration: SchemaConfiguration) | +| float | validate(arg: float, configuration: SchemaConfiguration) | +| double | validate(arg: double, configuration: SchemaConfiguration) | +| Number | validate(arg: Number, configuration: SchemaConfiguration) | +| boolean | validate(arg: boolean, configuration: SchemaConfiguration) | +| FrozenMap | validate(arg: Map<?, ?>, configuration: SchemaConfiguration) | +| FrozenList | validate(arg: List<*>, configuration: SchemaConfiguration) | +| [PatternValidation1BoxedString](#patternvalidation1boxedstring) | validateAndBox(String, configuration: SchemaConfiguration) | +| [PatternValidation1BoxedVoid](#patternvalidation1boxedvoid) | validateAndBox(Nothing?, configuration: SchemaConfiguration) | +| [PatternValidation1BoxedNumber](#patternvalidation1boxednumber) | validateAndBox(Number, configuration: SchemaConfiguration) | +| [PatternValidation1BoxedBoolean](#patternvalidation1boxedboolean) | validateAndBox(boolean, configuration: SchemaConfiguration) | +| [PatternValidation1BoxedMap](#patternvalidation1boxedmap) | validateAndBox(Map<?, ?>, configuration: SchemaConfiguration) | +| [PatternValidation1BoxedList](#patternvalidation1boxedlist) | validateAndBox(List<*>, configuration: SchemaConfiguration) | +| [PatternValidation1Boxed](#patternvalidation1boxed) | validateAndBox(Any?, configuration: SchemaConfiguration) | +| Any? | validate(arg: Any?, configuration: SchemaConfiguration) | + +[[Back to top]](#top) [[Back to Component Schemas]](../../../README.md#Component-Schemas) [[Back to README]](../../../README.md) diff --git a/samples/client/3_1_0_unit_test/kotlin/docs/components/schemas/PatternpropertiesValidatesPropertiesMatchingARegex.md b/samples/client/3_1_0_unit_test/kotlin/docs/components/schemas/PatternpropertiesValidatesPropertiesMatchingARegex.md new file mode 100644 index 00000000000..53cd3dcce63 --- /dev/null +++ b/samples/client/3_1_0_unit_test/kotlin/docs/components/schemas/PatternpropertiesValidatesPropertiesMatchingARegex.md @@ -0,0 +1,207 @@ +# PatternpropertiesValidatesPropertiesMatchingARegex +org.openapijsonschematools.client.components.schemas.PatternpropertiesValidatesPropertiesMatchingARegex.java +class PatternpropertiesValidatesPropertiesMatchingARegex
    + +A class that contains necessary nested +- schema classes (which validate payloads), extends JsonSchema +- sealed interfaces which store validated payloads, Kotlin version of a sum type +- boxed classes which store validated payloads, sealed permits class implementations + +## Nested Class Summary +| Modifier and Type | Class and Description | +| ----------------- | ---------------------- | +| sealed interface | [PatternpropertiesValidatesPropertiesMatchingARegex.PatternpropertiesValidatesPropertiesMatchingARegex1Boxed](#patternpropertiesvalidatespropertiesmatchingaregex1boxed)
    sealed interface for validated payloads | +| record | [PatternpropertiesValidatesPropertiesMatchingARegex.PatternpropertiesValidatesPropertiesMatchingARegex1BoxedVoid](#patternpropertiesvalidatespropertiesmatchingaregex1boxedvoid)
    boxed class to store validated null payloads | +| record | [PatternpropertiesValidatesPropertiesMatchingARegex.PatternpropertiesValidatesPropertiesMatchingARegex1BoxedBoolean](#patternpropertiesvalidatespropertiesmatchingaregex1boxedboolean)
    boxed class to store validated boolean payloads | +| record | [PatternpropertiesValidatesPropertiesMatchingARegex.PatternpropertiesValidatesPropertiesMatchingARegex1BoxedNumber](#patternpropertiesvalidatespropertiesmatchingaregex1boxednumber)
    boxed class to store validated Number payloads | +| record | [PatternpropertiesValidatesPropertiesMatchingARegex.PatternpropertiesValidatesPropertiesMatchingARegex1BoxedString](#patternpropertiesvalidatespropertiesmatchingaregex1boxedstring)
    boxed class to store validated String payloads | +| record | [PatternpropertiesValidatesPropertiesMatchingARegex.PatternpropertiesValidatesPropertiesMatchingARegex1BoxedList](#patternpropertiesvalidatespropertiesmatchingaregex1boxedlist)
    boxed class to store validated List payloads | +| record | [PatternpropertiesValidatesPropertiesMatchingARegex.PatternpropertiesValidatesPropertiesMatchingARegex1BoxedMap](#patternpropertiesvalidatespropertiesmatchingaregex1boxedmap)
    boxed class to store validated Map payloads | +| static class | [PatternpropertiesValidatesPropertiesMatchingARegex.PatternpropertiesValidatesPropertiesMatchingARegex1](#patternpropertiesvalidatespropertiesmatchingaregex1)
    schema class | +| sealed interface | [PatternpropertiesValidatesPropertiesMatchingARegex.FoBoxed](#foboxed)
    sealed interface for validated payloads | +| record | [PatternpropertiesValidatesPropertiesMatchingARegex.FoBoxedNumber](#foboxednumber)
    boxed class to store validated Number payloads | +| static class | [PatternpropertiesValidatesPropertiesMatchingARegex.Fo](#fo)
    schema class | + +## PatternpropertiesValidatesPropertiesMatchingARegex1Boxed +sealed interface PatternpropertiesValidatesPropertiesMatchingARegex1Boxed
    +permits
    +[PatternpropertiesValidatesPropertiesMatchingARegex1BoxedVoid](#patternpropertiesvalidatespropertiesmatchingaregex1boxedvoid), +[PatternpropertiesValidatesPropertiesMatchingARegex1BoxedBoolean](#patternpropertiesvalidatespropertiesmatchingaregex1boxedboolean), +[PatternpropertiesValidatesPropertiesMatchingARegex1BoxedNumber](#patternpropertiesvalidatespropertiesmatchingaregex1boxednumber), +[PatternpropertiesValidatesPropertiesMatchingARegex1BoxedString](#patternpropertiesvalidatespropertiesmatchingaregex1boxedstring), +[PatternpropertiesValidatesPropertiesMatchingARegex1BoxedList](#patternpropertiesvalidatespropertiesmatchingaregex1boxedlist), +[PatternpropertiesValidatesPropertiesMatchingARegex1BoxedMap](#patternpropertiesvalidatespropertiesmatchingaregex1boxedmap) + +sealed interface that stores validated payloads using boxed classes + +## PatternpropertiesValidatesPropertiesMatchingARegex1BoxedVoid +data class PatternpropertiesValidatesPropertiesMatchingARegex1BoxedVoid
    +implements [PatternpropertiesValidatesPropertiesMatchingARegex1Boxed](#patternpropertiesvalidatespropertiesmatchingaregex1boxed) + +data class that stores validated null payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| PatternpropertiesValidatesPropertiesMatchingARegex1BoxedVoid(Nothing? data)
    Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| Nothing? | data()
    validated payload | +| Any? | getData()
    validated payload | + +## PatternpropertiesValidatesPropertiesMatchingARegex1BoxedBoolean +data class PatternpropertiesValidatesPropertiesMatchingARegex1BoxedBoolean
    +implements [PatternpropertiesValidatesPropertiesMatchingARegex1Boxed](#patternpropertiesvalidatespropertiesmatchingaregex1boxed) + +record that stores validated boolean payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| PatternpropertiesValidatesPropertiesMatchingARegex1BoxedBoolean(boolean data)
    Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| boolean | data()
    validated payload | +| Any? | getData()
    validated payload | + +## PatternpropertiesValidatesPropertiesMatchingARegex1BoxedNumber +data class PatternpropertiesValidatesPropertiesMatchingARegex1BoxedNumber
    +implements [PatternpropertiesValidatesPropertiesMatchingARegex1Boxed](#patternpropertiesvalidatespropertiesmatchingaregex1boxed) + +data class that stores validated Number payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| PatternpropertiesValidatesPropertiesMatchingARegex1BoxedNumber(Number data)
    Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| Number | data()
    validated payload | +| Any? | getData()
    validated payload | + +## PatternpropertiesValidatesPropertiesMatchingARegex1BoxedString +data class PatternpropertiesValidatesPropertiesMatchingARegex1BoxedString
    +implements [PatternpropertiesValidatesPropertiesMatchingARegex1Boxed](#patternpropertiesvalidatespropertiesmatchingaregex1boxed) + +data class that stores validated String payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| PatternpropertiesValidatesPropertiesMatchingARegex1BoxedString(String data)
    Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| String | data()
    validated payload | +| Any? | getData()
    validated payload | + +## PatternpropertiesValidatesPropertiesMatchingARegex1BoxedList +data class PatternpropertiesValidatesPropertiesMatchingARegex1BoxedList
    +implements [PatternpropertiesValidatesPropertiesMatchingARegex1Boxed](#patternpropertiesvalidatespropertiesmatchingaregex1boxed) + +data class that stores validated List payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| PatternpropertiesValidatesPropertiesMatchingARegex1BoxedList(FrozenList data)
    Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| FrozenList | data()
    validated payload | +| Any? | getData()
    validated payload | + +## PatternpropertiesValidatesPropertiesMatchingARegex1BoxedMap +data class PatternpropertiesValidatesPropertiesMatchingARegex1BoxedMap
    +implements [PatternpropertiesValidatesPropertiesMatchingARegex1Boxed](#patternpropertiesvalidatespropertiesmatchingaregex1boxed) + +data class that stores validated Map payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| PatternpropertiesValidatesPropertiesMatchingARegex1BoxedMap(FrozenMap data)
    Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| FrozenMap | data()
    validated payload | +| Any? | getData()
    validated payload | + +## PatternpropertiesValidatesPropertiesMatchingARegex1 +class PatternpropertiesValidatesPropertiesMatchingARegex1
    +extends JsonSchema + +A schema class that validates payloads + +### Field Summary +| Modifier and Type | Field and Description | +| ----------------- | ---------------------- | +| Map> | patternProperties = mapOf(
        new AbstractMap.SimpleEntry<>(Pattern.compile("f.*o"), [Fo::class.java](#fo)))
    )
    | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| String | validate(arg: String, configuration: SchemaConfiguration) | +| Nothing? | validate(arg: Nothing?, configuration: SchemaConfiguration) | +| int | validate(arg: int, configuration: SchemaConfiguration) | +| long | validate(arg: long, configuration: SchemaConfiguration) | +| float | validate(arg: float, configuration: SchemaConfiguration) | +| double | validate(arg: double, configuration: SchemaConfiguration) | +| Number | validate(arg: Number, configuration: SchemaConfiguration) | +| boolean | validate(arg: boolean, configuration: SchemaConfiguration) | +| FrozenMap | validate(arg: Map<?, ?>, configuration: SchemaConfiguration) | +| FrozenList | validate(arg: List<*>, configuration: SchemaConfiguration) | +| [PatternpropertiesValidatesPropertiesMatchingARegex1BoxedString](#patternpropertiesvalidatespropertiesmatchingaregex1boxedstring) | validateAndBox(String, configuration: SchemaConfiguration) | +| [PatternpropertiesValidatesPropertiesMatchingARegex1BoxedVoid](#patternpropertiesvalidatespropertiesmatchingaregex1boxedvoid) | validateAndBox(Nothing?, configuration: SchemaConfiguration) | +| [PatternpropertiesValidatesPropertiesMatchingARegex1BoxedNumber](#patternpropertiesvalidatespropertiesmatchingaregex1boxednumber) | validateAndBox(Number, configuration: SchemaConfiguration) | +| [PatternpropertiesValidatesPropertiesMatchingARegex1BoxedBoolean](#patternpropertiesvalidatespropertiesmatchingaregex1boxedboolean) | validateAndBox(boolean, configuration: SchemaConfiguration) | +| [PatternpropertiesValidatesPropertiesMatchingARegex1BoxedMap](#patternpropertiesvalidatespropertiesmatchingaregex1boxedmap) | validateAndBox(Map<?, ?>, configuration: SchemaConfiguration) | +| [PatternpropertiesValidatesPropertiesMatchingARegex1BoxedList](#patternpropertiesvalidatespropertiesmatchingaregex1boxedlist) | validateAndBox(List<*>, configuration: SchemaConfiguration) | +| [PatternpropertiesValidatesPropertiesMatchingARegex1Boxed](#patternpropertiesvalidatespropertiesmatchingaregex1boxed) | validateAndBox(Any?, configuration: SchemaConfiguration) | +| Any? | validate(arg: Any?, configuration: SchemaConfiguration) | + +## FoBoxed +sealed interface FoBoxed
    +permits
    +[FoBoxedNumber](#foboxednumber) + +sealed interface that stores validated payloads using boxed classes + +## FoBoxedNumber +data class FoBoxedNumber
    +implements [FoBoxed](#foboxed) + +data class that stores validated Number payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| FoBoxedNumber(Number data)
    Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| Number | data()
    validated payload | +| Any? | getData()
    validated payload | + +## Fo +class Fo
    +extends IntJsonSchema.IntJsonSchema1 + +A schema class that validates payloads + +| Methods Inherited from class org.openapijsonschematools.client.schemas.IntJsonSchema.IntJsonSchema1 | +| ------------------------------------------------------------------ | +| validate | +| validateAndBox | + +[[Back to top]](#top) [[Back to Component Schemas]](../../../README.md#Component-Schemas) [[Back to README]](../../../README.md) diff --git a/samples/client/3_1_0_unit_test/kotlin/docs/components/schemas/PatternpropertiesWithNullValuedInstanceProperties.md b/samples/client/3_1_0_unit_test/kotlin/docs/components/schemas/PatternpropertiesWithNullValuedInstanceProperties.md new file mode 100644 index 00000000000..54184e70d2a --- /dev/null +++ b/samples/client/3_1_0_unit_test/kotlin/docs/components/schemas/PatternpropertiesWithNullValuedInstanceProperties.md @@ -0,0 +1,207 @@ +# PatternpropertiesWithNullValuedInstanceProperties +org.openapijsonschematools.client.components.schemas.PatternpropertiesWithNullValuedInstanceProperties.java +class PatternpropertiesWithNullValuedInstanceProperties
    + +A class that contains necessary nested +- schema classes (which validate payloads), extends JsonSchema +- sealed interfaces which store validated payloads, Kotlin version of a sum type +- boxed classes which store validated payloads, sealed permits class implementations + +## Nested Class Summary +| Modifier and Type | Class and Description | +| ----------------- | ---------------------- | +| sealed interface | [PatternpropertiesWithNullValuedInstanceProperties.PatternpropertiesWithNullValuedInstanceProperties1Boxed](#patternpropertieswithnullvaluedinstanceproperties1boxed)
    sealed interface for validated payloads | +| record | [PatternpropertiesWithNullValuedInstanceProperties.PatternpropertiesWithNullValuedInstanceProperties1BoxedVoid](#patternpropertieswithnullvaluedinstanceproperties1boxedvoid)
    boxed class to store validated null payloads | +| record | [PatternpropertiesWithNullValuedInstanceProperties.PatternpropertiesWithNullValuedInstanceProperties1BoxedBoolean](#patternpropertieswithnullvaluedinstanceproperties1boxedboolean)
    boxed class to store validated boolean payloads | +| record | [PatternpropertiesWithNullValuedInstanceProperties.PatternpropertiesWithNullValuedInstanceProperties1BoxedNumber](#patternpropertieswithnullvaluedinstanceproperties1boxednumber)
    boxed class to store validated Number payloads | +| record | [PatternpropertiesWithNullValuedInstanceProperties.PatternpropertiesWithNullValuedInstanceProperties1BoxedString](#patternpropertieswithnullvaluedinstanceproperties1boxedstring)
    boxed class to store validated String payloads | +| record | [PatternpropertiesWithNullValuedInstanceProperties.PatternpropertiesWithNullValuedInstanceProperties1BoxedList](#patternpropertieswithnullvaluedinstanceproperties1boxedlist)
    boxed class to store validated List payloads | +| record | [PatternpropertiesWithNullValuedInstanceProperties.PatternpropertiesWithNullValuedInstanceProperties1BoxedMap](#patternpropertieswithnullvaluedinstanceproperties1boxedmap)
    boxed class to store validated Map payloads | +| static class | [PatternpropertiesWithNullValuedInstanceProperties.PatternpropertiesWithNullValuedInstanceProperties1](#patternpropertieswithnullvaluedinstanceproperties1)
    schema class | +| sealed interface | [PatternpropertiesWithNullValuedInstanceProperties.BarBoxed](#barboxed)
    sealed interface for validated payloads | +| record | [PatternpropertiesWithNullValuedInstanceProperties.BarBoxedVoid](#barboxedvoid)
    boxed class to store validated null payloads | +| static class | [PatternpropertiesWithNullValuedInstanceProperties.Bar](#bar)
    schema class | + +## PatternpropertiesWithNullValuedInstanceProperties1Boxed +sealed interface PatternpropertiesWithNullValuedInstanceProperties1Boxed
    +permits
    +[PatternpropertiesWithNullValuedInstanceProperties1BoxedVoid](#patternpropertieswithnullvaluedinstanceproperties1boxedvoid), +[PatternpropertiesWithNullValuedInstanceProperties1BoxedBoolean](#patternpropertieswithnullvaluedinstanceproperties1boxedboolean), +[PatternpropertiesWithNullValuedInstanceProperties1BoxedNumber](#patternpropertieswithnullvaluedinstanceproperties1boxednumber), +[PatternpropertiesWithNullValuedInstanceProperties1BoxedString](#patternpropertieswithnullvaluedinstanceproperties1boxedstring), +[PatternpropertiesWithNullValuedInstanceProperties1BoxedList](#patternpropertieswithnullvaluedinstanceproperties1boxedlist), +[PatternpropertiesWithNullValuedInstanceProperties1BoxedMap](#patternpropertieswithnullvaluedinstanceproperties1boxedmap) + +sealed interface that stores validated payloads using boxed classes + +## PatternpropertiesWithNullValuedInstanceProperties1BoxedVoid +data class PatternpropertiesWithNullValuedInstanceProperties1BoxedVoid
    +implements [PatternpropertiesWithNullValuedInstanceProperties1Boxed](#patternpropertieswithnullvaluedinstanceproperties1boxed) + +data class that stores validated null payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| PatternpropertiesWithNullValuedInstanceProperties1BoxedVoid(Nothing? data)
    Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| Nothing? | data()
    validated payload | +| Any? | getData()
    validated payload | + +## PatternpropertiesWithNullValuedInstanceProperties1BoxedBoolean +data class PatternpropertiesWithNullValuedInstanceProperties1BoxedBoolean
    +implements [PatternpropertiesWithNullValuedInstanceProperties1Boxed](#patternpropertieswithnullvaluedinstanceproperties1boxed) + +record that stores validated boolean payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| PatternpropertiesWithNullValuedInstanceProperties1BoxedBoolean(boolean data)
    Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| boolean | data()
    validated payload | +| Any? | getData()
    validated payload | + +## PatternpropertiesWithNullValuedInstanceProperties1BoxedNumber +data class PatternpropertiesWithNullValuedInstanceProperties1BoxedNumber
    +implements [PatternpropertiesWithNullValuedInstanceProperties1Boxed](#patternpropertieswithnullvaluedinstanceproperties1boxed) + +data class that stores validated Number payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| PatternpropertiesWithNullValuedInstanceProperties1BoxedNumber(Number data)
    Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| Number | data()
    validated payload | +| Any? | getData()
    validated payload | + +## PatternpropertiesWithNullValuedInstanceProperties1BoxedString +data class PatternpropertiesWithNullValuedInstanceProperties1BoxedString
    +implements [PatternpropertiesWithNullValuedInstanceProperties1Boxed](#patternpropertieswithnullvaluedinstanceproperties1boxed) + +data class that stores validated String payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| PatternpropertiesWithNullValuedInstanceProperties1BoxedString(String data)
    Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| String | data()
    validated payload | +| Any? | getData()
    validated payload | + +## PatternpropertiesWithNullValuedInstanceProperties1BoxedList +data class PatternpropertiesWithNullValuedInstanceProperties1BoxedList
    +implements [PatternpropertiesWithNullValuedInstanceProperties1Boxed](#patternpropertieswithnullvaluedinstanceproperties1boxed) + +data class that stores validated List payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| PatternpropertiesWithNullValuedInstanceProperties1BoxedList(FrozenList data)
    Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| FrozenList | data()
    validated payload | +| Any? | getData()
    validated payload | + +## PatternpropertiesWithNullValuedInstanceProperties1BoxedMap +data class PatternpropertiesWithNullValuedInstanceProperties1BoxedMap
    +implements [PatternpropertiesWithNullValuedInstanceProperties1Boxed](#patternpropertieswithnullvaluedinstanceproperties1boxed) + +data class that stores validated Map payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| PatternpropertiesWithNullValuedInstanceProperties1BoxedMap(FrozenMap data)
    Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| FrozenMap | data()
    validated payload | +| Any? | getData()
    validated payload | + +## PatternpropertiesWithNullValuedInstanceProperties1 +class PatternpropertiesWithNullValuedInstanceProperties1
    +extends JsonSchema + +A schema class that validates payloads + +### Field Summary +| Modifier and Type | Field and Description | +| ----------------- | ---------------------- | +| Map> | patternProperties = mapOf(
        new AbstractMap.SimpleEntry<>(Pattern.compile("^.*bar\$"), [Bar::class.java](#bar)))
    )
    | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| String | validate(arg: String, configuration: SchemaConfiguration) | +| Nothing? | validate(arg: Nothing?, configuration: SchemaConfiguration) | +| int | validate(arg: int, configuration: SchemaConfiguration) | +| long | validate(arg: long, configuration: SchemaConfiguration) | +| float | validate(arg: float, configuration: SchemaConfiguration) | +| double | validate(arg: double, configuration: SchemaConfiguration) | +| Number | validate(arg: Number, configuration: SchemaConfiguration) | +| boolean | validate(arg: boolean, configuration: SchemaConfiguration) | +| FrozenMap | validate(arg: Map<?, ?>, configuration: SchemaConfiguration) | +| FrozenList | validate(arg: List<*>, configuration: SchemaConfiguration) | +| [PatternpropertiesWithNullValuedInstanceProperties1BoxedString](#patternpropertieswithnullvaluedinstanceproperties1boxedstring) | validateAndBox(String, configuration: SchemaConfiguration) | +| [PatternpropertiesWithNullValuedInstanceProperties1BoxedVoid](#patternpropertieswithnullvaluedinstanceproperties1boxedvoid) | validateAndBox(Nothing?, configuration: SchemaConfiguration) | +| [PatternpropertiesWithNullValuedInstanceProperties1BoxedNumber](#patternpropertieswithnullvaluedinstanceproperties1boxednumber) | validateAndBox(Number, configuration: SchemaConfiguration) | +| [PatternpropertiesWithNullValuedInstanceProperties1BoxedBoolean](#patternpropertieswithnullvaluedinstanceproperties1boxedboolean) | validateAndBox(boolean, configuration: SchemaConfiguration) | +| [PatternpropertiesWithNullValuedInstanceProperties1BoxedMap](#patternpropertieswithnullvaluedinstanceproperties1boxedmap) | validateAndBox(Map<?, ?>, configuration: SchemaConfiguration) | +| [PatternpropertiesWithNullValuedInstanceProperties1BoxedList](#patternpropertieswithnullvaluedinstanceproperties1boxedlist) | validateAndBox(List<*>, configuration: SchemaConfiguration) | +| [PatternpropertiesWithNullValuedInstanceProperties1Boxed](#patternpropertieswithnullvaluedinstanceproperties1boxed) | validateAndBox(Any?, configuration: SchemaConfiguration) | +| Any? | validate(arg: Any?, configuration: SchemaConfiguration) | + +## BarBoxed +sealed interface BarBoxed
    +permits
    +[BarBoxedVoid](#barboxedvoid) + +sealed interface that stores validated payloads using boxed classes + +## BarBoxedVoid +data class BarBoxedVoid
    +implements [BarBoxed](#barboxed) + +data class that stores validated null payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| BarBoxedVoid(Nothing? data)
    Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| Nothing? | data()
    validated payload | +| Any? | getData()
    validated payload | + +## Bar +class Bar
    +extends NullJsonSchema.NullJsonSchema1 + +A schema class that validates payloads + +| Methods Inherited from class org.openapijsonschematools.client.schemas.NullJsonSchema.NullJsonSchema1 | +| ------------------------------------------------------------------ | +| validate | +| validateAndBox | + +[[Back to top]](#top) [[Back to Component Schemas]](../../../README.md#Component-Schemas) [[Back to README]](../../../README.md) diff --git a/samples/client/3_1_0_unit_test/kotlin/docs/components/schemas/PrefixitemsValidationAdjustsTheStartingIndexForItems.md b/samples/client/3_1_0_unit_test/kotlin/docs/components/schemas/PrefixitemsValidationAdjustsTheStartingIndexForItems.md new file mode 100644 index 00000000000..7bef5b19137 --- /dev/null +++ b/samples/client/3_1_0_unit_test/kotlin/docs/components/schemas/PrefixitemsValidationAdjustsTheStartingIndexForItems.md @@ -0,0 +1,202 @@ +# PrefixitemsValidationAdjustsTheStartingIndexForItems +org.openapijsonschematools.client.components.schemas.PrefixitemsValidationAdjustsTheStartingIndexForItems.java +class PrefixitemsValidationAdjustsTheStartingIndexForItems
    + +A class that contains necessary nested +- schema classes (which validate payloads), extends JsonSchema +- sealed interfaces which store validated payloads, Kotlin version of a sum type +- boxed classes which store validated payloads, sealed permits class implementations +- classes to store validated list payloads, extends FrozenList +- classes to build inputs for list payloads + +## Nested Class Summary +| Modifier and Type | Class and Description | +| ----------------- | ---------------------- | +| sealed interface | [PrefixitemsValidationAdjustsTheStartingIndexForItems.PrefixitemsValidationAdjustsTheStartingIndexForItems1Boxed](#prefixitemsvalidationadjuststhestartingindexforitems1boxed)
    sealed interface for validated payloads | +| record | [PrefixitemsValidationAdjustsTheStartingIndexForItems.PrefixitemsValidationAdjustsTheStartingIndexForItems1BoxedList](#prefixitemsvalidationadjuststhestartingindexforitems1boxedlist)
    boxed class to store validated List payloads | +| static class | [PrefixitemsValidationAdjustsTheStartingIndexForItems.PrefixitemsValidationAdjustsTheStartingIndexForItems1](#prefixitemsvalidationadjuststhestartingindexforitems1)
    schema class | +| sealed interface | [PrefixitemsValidationAdjustsTheStartingIndexForItems.Schema0Boxed](#schema0boxed)
    sealed interface for validated payloads | +| record | [PrefixitemsValidationAdjustsTheStartingIndexForItems.Schema0BoxedString](#schema0boxedstring)
    boxed class to store validated String payloads | +| static class | [PrefixitemsValidationAdjustsTheStartingIndexForItems.Schema0](#schema0)
    schema class | +| static class | [PrefixitemsValidationAdjustsTheStartingIndexForItems.PrefixitemsValidationAdjustsTheStartingIndexForItemsListBuilder](#prefixitemsvalidationadjuststhestartingindexforitemslistbuilder)
    builder for List payloads | +| static class | [PrefixitemsValidationAdjustsTheStartingIndexForItems.PrefixitemsValidationAdjustsTheStartingIndexForItemsList](#prefixitemsvalidationadjuststhestartingindexforitemslist)
    output class for List payloads | +| sealed interface | [PrefixitemsValidationAdjustsTheStartingIndexForItems.ItemsBoxed](#itemsboxed)
    sealed interface for validated payloads | +| record | [PrefixitemsValidationAdjustsTheStartingIndexForItems.ItemsBoxedNumber](#itemsboxednumber)
    boxed class to store validated Number payloads | +| static class | [PrefixitemsValidationAdjustsTheStartingIndexForItems.Items](#items)
    schema class | + +## PrefixitemsValidationAdjustsTheStartingIndexForItems1Boxed +sealed interface PrefixitemsValidationAdjustsTheStartingIndexForItems1Boxed
    +permits
    +[PrefixitemsValidationAdjustsTheStartingIndexForItems1BoxedList](#prefixitemsvalidationadjuststhestartingindexforitems1boxedlist) + +sealed interface that stores validated payloads using boxed classes + +## PrefixitemsValidationAdjustsTheStartingIndexForItems1BoxedList +data class PrefixitemsValidationAdjustsTheStartingIndexForItems1BoxedList
    +implements [PrefixitemsValidationAdjustsTheStartingIndexForItems1Boxed](#prefixitemsvalidationadjuststhestartingindexforitems1boxed) + +data class that stores validated List payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| PrefixitemsValidationAdjustsTheStartingIndexForItems1BoxedList([PrefixitemsValidationAdjustsTheStartingIndexForItemsList](#prefixitemsvalidationadjuststhestartingindexforitemslist) data)
    Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| [PrefixitemsValidationAdjustsTheStartingIndexForItemsList](#prefixitemsvalidationadjuststhestartingindexforitemslist) | data()
    validated payload | +| Any? | getData()
    validated payload | + +## PrefixitemsValidationAdjustsTheStartingIndexForItems1 +class PrefixitemsValidationAdjustsTheStartingIndexForItems1
    +extends JsonSchema + +A schema class that validates payloads + +### Code Sample +``` +import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags; +import org.openapijsonschematools.client.configurations.SchemaConfiguration; +import org.openapijsonschematools.client.exceptions.ValidationException; +import org.openapijsonschematools.client.schemas.validation.MapUtils; +import org.openapijsonschematools.client.schemas.validation.FrozenList; +import org.openapijsonschematools.client.schemas.validation.FrozenMap; +import org.openapijsonschematools.client.components.schemas.PrefixitemsValidationAdjustsTheStartingIndexForItems; + +import java.util.Arrays; +import java.util.List; +import java.util.AbstractMap; + +static final SchemaConfiguration configuration = new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().build()); + +// List validation +PrefixitemsValidationAdjustsTheStartingIndexForItems.PrefixitemsValidationAdjustsTheStartingIndexForItemsList validatedPayload = + PrefixitemsValidationAdjustsTheStartingIndexForItems.PrefixitemsValidationAdjustsTheStartingIndexForItems1.validate( + new PrefixitemsValidationAdjustsTheStartingIndexForItems.PrefixitemsValidationAdjustsTheStartingIndexForItemsListBuilder() + .add(1) + + .build(), + configuration +); +``` + +### Field Summary +| Modifier and Type | Field and Description | +| ----------------- | ---------------------- | +| Set> | type = setOf(List::class.java) | +| Class | items = [Items::class.java](#items) | +| List> | prefixItems = listOf(
        [Schema0::class.java](#schema0)
    )
    | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| [PrefixitemsValidationAdjustsTheStartingIndexForItemsList](#prefixitemsvalidationadjuststhestartingindexforitemslist) | validate(arg: [List<*>](#prefixitemsvalidationadjuststhestartingindexforitemslistbuilder), configuration: SchemaConfiguration) | +| [PrefixitemsValidationAdjustsTheStartingIndexForItems1BoxedList](#prefixitemsvalidationadjuststhestartingindexforitems1boxedlist) | validateAndBox([List<*>](#prefixitemsvalidationadjuststhestartingindexforitemslistbuilder), configuration: SchemaConfiguration) | +| [PrefixitemsValidationAdjustsTheStartingIndexForItems1Boxed](#prefixitemsvalidationadjuststhestartingindexforitems1boxed) | validateAndBox(Any?, configuration: SchemaConfiguration) | +| Any? | validate(arg: Any?, configuration: SchemaConfiguration) | + +## Schema0Boxed +sealed interface Schema0Boxed
    +permits
    +[Schema0BoxedString](#schema0boxedstring) + +sealed interface that stores validated payloads using boxed classes + +## Schema0BoxedString +data class Schema0BoxedString
    +implements [Schema0Boxed](#schema0boxed) + +data class that stores validated String payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| Schema0BoxedString(String data)
    Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| String | data()
    validated payload | +| Any? | getData()
    validated payload | + +## Schema0 +class Schema0
    +extends StringJsonSchema.StringJsonSchema1 + +A schema class that validates payloads + +| Methods Inherited from class org.openapijsonschematools.client.schemas.StringJsonSchema.StringJsonSchema1 | +| ------------------------------------------------------------------ | +| validate | +| validateAndBox | + +## PrefixitemsValidationAdjustsTheStartingIndexForItemsListBuilder +class PrefixitemsValidationAdjustsTheStartingIndexForItemsListBuilder
    +builder for `List` + +A class that builds the List input type + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| PrefixitemsValidationAdjustsTheStartingIndexForItemsListBuilder()
    Creates an empty list | +| PrefixitemsValidationAdjustsTheStartingIndexForItemsListBuilder(List items)
    Stores the items in a list | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| PrefixitemsValidationAdjustsTheStartingIndexForItemsListBuilder | add(item: Int) | +| PrefixitemsValidationAdjustsTheStartingIndexForItemsListBuilder | add(item: Float) | +| PrefixitemsValidationAdjustsTheStartingIndexForItemsListBuilder | add(item: Long) | +| PrefixitemsValidationAdjustsTheStartingIndexForItemsListBuilder | add(item: Double) | +| PrefixitemsValidationAdjustsTheStartingIndexForItemsListBuilder | add(item: String) | +| List | build()
    Returns list input that should be used with Schema.validate | + +## PrefixitemsValidationAdjustsTheStartingIndexForItemsList +class PrefixitemsValidationAdjustsTheStartingIndexForItemsList
    +extends `FrozenList` + +A class to store validated List payloads + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| static [PrefixitemsValidationAdjustsTheStartingIndexForItemsList](#prefixitemsvalidationadjuststhestartingindexforitemslist) | of([List](#prefixitemsvalidationadjuststhestartingindexforitemslistbuilder) arg, SchemaConfiguration configuration) | + +## ItemsBoxed +sealed interface ItemsBoxed
    +permits
    +[ItemsBoxedNumber](#itemsboxednumber) + +sealed interface that stores validated payloads using boxed classes + +## ItemsBoxedNumber +data class ItemsBoxedNumber
    +implements [ItemsBoxed](#itemsboxed) + +data class that stores validated Number payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| ItemsBoxedNumber(Number data)
    Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| Number | data()
    validated payload | +| Any? | getData()
    validated payload | + +## Items +class Items
    +extends IntJsonSchema.IntJsonSchema1 + +A schema class that validates payloads + +| Methods Inherited from class org.openapijsonschematools.client.schemas.IntJsonSchema.IntJsonSchema1 | +| ------------------------------------------------------------------ | +| validate | +| validateAndBox | + +[[Back to top]](#top) [[Back to Component Schemas]](../../../README.md#Component-Schemas) [[Back to README]](../../../README.md) diff --git a/samples/client/3_1_0_unit_test/kotlin/docs/components/schemas/PrefixitemsWithNullInstanceElements.md b/samples/client/3_1_0_unit_test/kotlin/docs/components/schemas/PrefixitemsWithNullInstanceElements.md new file mode 100644 index 00000000000..c549c837813 --- /dev/null +++ b/samples/client/3_1_0_unit_test/kotlin/docs/components/schemas/PrefixitemsWithNullInstanceElements.md @@ -0,0 +1,248 @@ +# PrefixitemsWithNullInstanceElements +org.openapijsonschematools.client.components.schemas.PrefixitemsWithNullInstanceElements.java +class PrefixitemsWithNullInstanceElements
    + +A class that contains necessary nested +- schema classes (which validate payloads), extends JsonSchema +- sealed interfaces which store validated payloads, Kotlin version of a sum type +- boxed classes which store validated payloads, sealed permits class implementations +- classes to store validated list payloads, extends FrozenList +- classes to build inputs for list payloads + +## Nested Class Summary +| Modifier and Type | Class and Description | +| ----------------- | ---------------------- | +| sealed interface | [PrefixitemsWithNullInstanceElements.PrefixitemsWithNullInstanceElements1Boxed](#prefixitemswithnullinstanceelements1boxed)
    sealed interface for validated payloads | +| record | [PrefixitemsWithNullInstanceElements.PrefixitemsWithNullInstanceElements1BoxedVoid](#prefixitemswithnullinstanceelements1boxedvoid)
    boxed class to store validated null payloads | +| record | [PrefixitemsWithNullInstanceElements.PrefixitemsWithNullInstanceElements1BoxedBoolean](#prefixitemswithnullinstanceelements1boxedboolean)
    boxed class to store validated boolean payloads | +| record | [PrefixitemsWithNullInstanceElements.PrefixitemsWithNullInstanceElements1BoxedNumber](#prefixitemswithnullinstanceelements1boxednumber)
    boxed class to store validated Number payloads | +| record | [PrefixitemsWithNullInstanceElements.PrefixitemsWithNullInstanceElements1BoxedString](#prefixitemswithnullinstanceelements1boxedstring)
    boxed class to store validated String payloads | +| record | [PrefixitemsWithNullInstanceElements.PrefixitemsWithNullInstanceElements1BoxedList](#prefixitemswithnullinstanceelements1boxedlist)
    boxed class to store validated List payloads | +| record | [PrefixitemsWithNullInstanceElements.PrefixitemsWithNullInstanceElements1BoxedMap](#prefixitemswithnullinstanceelements1boxedmap)
    boxed class to store validated Map payloads | +| static class | [PrefixitemsWithNullInstanceElements.PrefixitemsWithNullInstanceElements1](#prefixitemswithnullinstanceelements1)
    schema class | +| sealed interface | [PrefixitemsWithNullInstanceElements.Schema0Boxed](#schema0boxed)
    sealed interface for validated payloads | +| record | [PrefixitemsWithNullInstanceElements.Schema0BoxedVoid](#schema0boxedvoid)
    boxed class to store validated null payloads | +| static class | [PrefixitemsWithNullInstanceElements.Schema0](#schema0)
    schema class | +| static class | [PrefixitemsWithNullInstanceElements.PrefixitemsWithNullInstanceElementsListBuilder](#prefixitemswithnullinstanceelementslistbuilder)
    builder for List payloads | +| static class | [PrefixitemsWithNullInstanceElements.PrefixitemsWithNullInstanceElementsList](#prefixitemswithnullinstanceelementslist)
    output class for List payloads | + +## PrefixitemsWithNullInstanceElements1Boxed +sealed interface PrefixitemsWithNullInstanceElements1Boxed
    +permits
    +[PrefixitemsWithNullInstanceElements1BoxedVoid](#prefixitemswithnullinstanceelements1boxedvoid), +[PrefixitemsWithNullInstanceElements1BoxedBoolean](#prefixitemswithnullinstanceelements1boxedboolean), +[PrefixitemsWithNullInstanceElements1BoxedNumber](#prefixitemswithnullinstanceelements1boxednumber), +[PrefixitemsWithNullInstanceElements1BoxedString](#prefixitemswithnullinstanceelements1boxedstring), +[PrefixitemsWithNullInstanceElements1BoxedList](#prefixitemswithnullinstanceelements1boxedlist), +[PrefixitemsWithNullInstanceElements1BoxedMap](#prefixitemswithnullinstanceelements1boxedmap) + +sealed interface that stores validated payloads using boxed classes + +## PrefixitemsWithNullInstanceElements1BoxedVoid +data class PrefixitemsWithNullInstanceElements1BoxedVoid
    +implements [PrefixitemsWithNullInstanceElements1Boxed](#prefixitemswithnullinstanceelements1boxed) + +data class that stores validated null payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| PrefixitemsWithNullInstanceElements1BoxedVoid(Nothing? data)
    Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| Nothing? | data()
    validated payload | +| Any? | getData()
    validated payload | + +## PrefixitemsWithNullInstanceElements1BoxedBoolean +data class PrefixitemsWithNullInstanceElements1BoxedBoolean
    +implements [PrefixitemsWithNullInstanceElements1Boxed](#prefixitemswithnullinstanceelements1boxed) + +record that stores validated boolean payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| PrefixitemsWithNullInstanceElements1BoxedBoolean(boolean data)
    Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| boolean | data()
    validated payload | +| Any? | getData()
    validated payload | + +## PrefixitemsWithNullInstanceElements1BoxedNumber +data class PrefixitemsWithNullInstanceElements1BoxedNumber
    +implements [PrefixitemsWithNullInstanceElements1Boxed](#prefixitemswithnullinstanceelements1boxed) + +data class that stores validated Number payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| PrefixitemsWithNullInstanceElements1BoxedNumber(Number data)
    Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| Number | data()
    validated payload | +| Any? | getData()
    validated payload | + +## PrefixitemsWithNullInstanceElements1BoxedString +data class PrefixitemsWithNullInstanceElements1BoxedString
    +implements [PrefixitemsWithNullInstanceElements1Boxed](#prefixitemswithnullinstanceelements1boxed) + +data class that stores validated String payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| PrefixitemsWithNullInstanceElements1BoxedString(String data)
    Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| String | data()
    validated payload | +| Any? | getData()
    validated payload | + +## PrefixitemsWithNullInstanceElements1BoxedList +data class PrefixitemsWithNullInstanceElements1BoxedList
    +implements [PrefixitemsWithNullInstanceElements1Boxed](#prefixitemswithnullinstanceelements1boxed) + +data class that stores validated List payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| PrefixitemsWithNullInstanceElements1BoxedList([PrefixitemsWithNullInstanceElementsList](#prefixitemswithnullinstanceelementslist) data)
    Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| [PrefixitemsWithNullInstanceElementsList](#prefixitemswithnullinstanceelementslist) | data()
    validated payload | +| Any? | getData()
    validated payload | + +## PrefixitemsWithNullInstanceElements1BoxedMap +data class PrefixitemsWithNullInstanceElements1BoxedMap
    +implements [PrefixitemsWithNullInstanceElements1Boxed](#prefixitemswithnullinstanceelements1boxed) + +data class that stores validated Map payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| PrefixitemsWithNullInstanceElements1BoxedMap(FrozenMap data)
    Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| FrozenMap | data()
    validated payload | +| Any? | getData()
    validated payload | + +## PrefixitemsWithNullInstanceElements1 +class PrefixitemsWithNullInstanceElements1
    +extends JsonSchema + +A schema class that validates payloads + +### Field Summary +| Modifier and Type | Field and Description | +| ----------------- | ---------------------- | +| List> | prefixItems = listOf(
        [Schema0::class.java](#schema0)
    )
    | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| String | validate(arg: String, configuration: SchemaConfiguration) | +| Nothing? | validate(arg: Nothing?, configuration: SchemaConfiguration) | +| int | validate(arg: int, configuration: SchemaConfiguration) | +| long | validate(arg: long, configuration: SchemaConfiguration) | +| float | validate(arg: float, configuration: SchemaConfiguration) | +| double | validate(arg: double, configuration: SchemaConfiguration) | +| Number | validate(arg: Number, configuration: SchemaConfiguration) | +| boolean | validate(arg: boolean, configuration: SchemaConfiguration) | +| FrozenMap | validate(arg: Map<?, ?>, configuration: SchemaConfiguration) | +| [PrefixitemsWithNullInstanceElementsList](#prefixitemswithnullinstanceelementslist) | validate(arg: [List<*>](#prefixitemswithnullinstanceelementslistbuilder), configuration: SchemaConfiguration) | +| [PrefixitemsWithNullInstanceElements1BoxedString](#prefixitemswithnullinstanceelements1boxedstring) | validateAndBox(String, configuration: SchemaConfiguration) | +| [PrefixitemsWithNullInstanceElements1BoxedVoid](#prefixitemswithnullinstanceelements1boxedvoid) | validateAndBox(Nothing?, configuration: SchemaConfiguration) | +| [PrefixitemsWithNullInstanceElements1BoxedNumber](#prefixitemswithnullinstanceelements1boxednumber) | validateAndBox(Number, configuration: SchemaConfiguration) | +| [PrefixitemsWithNullInstanceElements1BoxedBoolean](#prefixitemswithnullinstanceelements1boxedboolean) | validateAndBox(boolean, configuration: SchemaConfiguration) | +| [PrefixitemsWithNullInstanceElements1BoxedMap](#prefixitemswithnullinstanceelements1boxedmap) | validateAndBox(Map<?, ?>, configuration: SchemaConfiguration) | +| [PrefixitemsWithNullInstanceElements1BoxedList](#prefixitemswithnullinstanceelements1boxedlist) | validateAndBox([List<*>](#prefixitemswithnullinstanceelementslistbuilder), configuration: SchemaConfiguration) | +| [PrefixitemsWithNullInstanceElements1Boxed](#prefixitemswithnullinstanceelements1boxed) | validateAndBox(Any?, configuration: SchemaConfiguration) | +| Any? | validate(arg: Any?, configuration: SchemaConfiguration) | + +## Schema0Boxed +sealed interface Schema0Boxed
    +permits
    +[Schema0BoxedVoid](#schema0boxedvoid) + +sealed interface that stores validated payloads using boxed classes + +## Schema0BoxedVoid +data class Schema0BoxedVoid
    +implements [Schema0Boxed](#schema0boxed) + +data class that stores validated null payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| Schema0BoxedVoid(Nothing? data)
    Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| Nothing? | data()
    validated payload | +| Any? | getData()
    validated payload | + +## Schema0 +class Schema0
    +extends NullJsonSchema.NullJsonSchema1 + +A schema class that validates payloads + +| Methods Inherited from class org.openapijsonschematools.client.schemas.NullJsonSchema.NullJsonSchema1 | +| ------------------------------------------------------------------ | +| validate | +| validateAndBox | + +## PrefixitemsWithNullInstanceElementsListBuilder +class PrefixitemsWithNullInstanceElementsListBuilder
    +builder for `List` + +A class that builds the List input type + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| PrefixitemsWithNullInstanceElementsListBuilder()
    Creates an empty list | +| PrefixitemsWithNullInstanceElementsListBuilder(List items)
    Stores the items in a list | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| PrefixitemsWithNullInstanceElementsListBuilder | add(item: Nothing?) | +| PrefixitemsWithNullInstanceElementsListBuilder | add(item: Boolean) | +| PrefixitemsWithNullInstanceElementsListBuilder | add(item: String) | +| PrefixitemsWithNullInstanceElementsListBuilder | add(item: Int) | +| PrefixitemsWithNullInstanceElementsListBuilder | add(item: Float) | +| PrefixitemsWithNullInstanceElementsListBuilder | add(item: Long) | +| PrefixitemsWithNullInstanceElementsListBuilder | add(item: Double) | +| PrefixitemsWithNullInstanceElementsListBuilder | add(item: List) | +| PrefixitemsWithNullInstanceElementsListBuilder | add(item: Map) | +| List | build()
    Returns list input that should be used with Schema.validate | + +## PrefixitemsWithNullInstanceElementsList +class PrefixitemsWithNullInstanceElementsList
    +extends `FrozenList` + +A class to store validated List payloads + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| static [PrefixitemsWithNullInstanceElementsList](#prefixitemswithnullinstanceelementslist) | of([List](#prefixitemswithnullinstanceelementslistbuilder) arg, SchemaConfiguration configuration) | + +[[Back to top]](#top) [[Back to Component Schemas]](../../../README.md#Component-Schemas) [[Back to README]](../../../README.md) diff --git a/samples/client/3_1_0_unit_test/kotlin/docs/components/schemas/PropertiesPatternpropertiesAdditionalpropertiesInteraction.md b/samples/client/3_1_0_unit_test/kotlin/docs/components/schemas/PropertiesPatternpropertiesAdditionalpropertiesInteraction.md new file mode 100644 index 00000000000..419a5ba2f4f --- /dev/null +++ b/samples/client/3_1_0_unit_test/kotlin/docs/components/schemas/PropertiesPatternpropertiesAdditionalpropertiesInteraction.md @@ -0,0 +1,408 @@ +# PropertiesPatternpropertiesAdditionalpropertiesInteraction +org.openapijsonschematools.client.components.schemas.PropertiesPatternpropertiesAdditionalpropertiesInteraction.java +class PropertiesPatternpropertiesAdditionalpropertiesInteraction
    + +A class that contains necessary nested +- schema classes (which validate payloads), extends JsonSchema +- sealed interfaces which store validated payloads, Kotlin version of a sum type +- boxed classes which store validated payloads, sealed permits class implementations +- classes to store validated map payloads, extends FrozenMap +- classes to build inputs for map payloads + +## Nested Class Summary +| Modifier and Type | Class and Description | +| ----------------- | ---------------------- | +| sealed interface | [PropertiesPatternpropertiesAdditionalpropertiesInteraction.PropertiesPatternpropertiesAdditionalpropertiesInteraction1Boxed](#propertiespatternpropertiesadditionalpropertiesinteraction1boxed)
    sealed interface for validated payloads | +| record | [PropertiesPatternpropertiesAdditionalpropertiesInteraction.PropertiesPatternpropertiesAdditionalpropertiesInteraction1BoxedMap](#propertiespatternpropertiesadditionalpropertiesinteraction1boxedmap)
    boxed class to store validated Map payloads | +| static class | [PropertiesPatternpropertiesAdditionalpropertiesInteraction.PropertiesPatternpropertiesAdditionalpropertiesInteraction1](#propertiespatternpropertiesadditionalpropertiesinteraction1)
    schema class | +| static class | [PropertiesPatternpropertiesAdditionalpropertiesInteraction.PropertiesPatternpropertiesAdditionalpropertiesInteractionMapBuilder](#propertiespatternpropertiesadditionalpropertiesinteractionmapbuilder)
    builder for Map payloads | +| static class | [PropertiesPatternpropertiesAdditionalpropertiesInteraction.PropertiesPatternpropertiesAdditionalpropertiesInteractionMap](#propertiespatternpropertiesadditionalpropertiesinteractionmap)
    output class for Map payloads | +| sealed interface | [PropertiesPatternpropertiesAdditionalpropertiesInteraction.BarBoxed](#barboxed)
    sealed interface for validated payloads | +| record | [PropertiesPatternpropertiesAdditionalpropertiesInteraction.BarBoxedList](#barboxedlist)
    boxed class to store validated List payloads | +| static class | [PropertiesPatternpropertiesAdditionalpropertiesInteraction.Bar](#bar)
    schema class | +| sealed interface | [PropertiesPatternpropertiesAdditionalpropertiesInteraction.FooBoxed](#fooboxed)
    sealed interface for validated payloads | +| record | [PropertiesPatternpropertiesAdditionalpropertiesInteraction.FooBoxedList](#fooboxedlist)
    boxed class to store validated List payloads | +| static class | [PropertiesPatternpropertiesAdditionalpropertiesInteraction.Foo](#foo)
    schema class | +| sealed interface | [PropertiesPatternpropertiesAdditionalpropertiesInteraction.FoBoxed](#foboxed)
    sealed interface for validated payloads | +| record | [PropertiesPatternpropertiesAdditionalpropertiesInteraction.FoBoxedVoid](#foboxedvoid)
    boxed class to store validated null payloads | +| record | [PropertiesPatternpropertiesAdditionalpropertiesInteraction.FoBoxedBoolean](#foboxedboolean)
    boxed class to store validated boolean payloads | +| record | [PropertiesPatternpropertiesAdditionalpropertiesInteraction.FoBoxedNumber](#foboxednumber)
    boxed class to store validated Number payloads | +| record | [PropertiesPatternpropertiesAdditionalpropertiesInteraction.FoBoxedString](#foboxedstring)
    boxed class to store validated String payloads | +| record | [PropertiesPatternpropertiesAdditionalpropertiesInteraction.FoBoxedList](#foboxedlist)
    boxed class to store validated List payloads | +| record | [PropertiesPatternpropertiesAdditionalpropertiesInteraction.FoBoxedMap](#foboxedmap)
    boxed class to store validated Map payloads | +| static class | [PropertiesPatternpropertiesAdditionalpropertiesInteraction.Fo](#fo)
    schema class | +| sealed interface | [PropertiesPatternpropertiesAdditionalpropertiesInteraction.AdditionalPropertiesBoxed](#additionalpropertiesboxed)
    sealed interface for validated payloads | +| record | [PropertiesPatternpropertiesAdditionalpropertiesInteraction.AdditionalPropertiesBoxedNumber](#additionalpropertiesboxednumber)
    boxed class to store validated Number payloads | +| static class | [PropertiesPatternpropertiesAdditionalpropertiesInteraction.AdditionalProperties](#additionalproperties)
    schema class | + +## PropertiesPatternpropertiesAdditionalpropertiesInteraction1Boxed +sealed interface PropertiesPatternpropertiesAdditionalpropertiesInteraction1Boxed
    +permits
    +[PropertiesPatternpropertiesAdditionalpropertiesInteraction1BoxedMap](#propertiespatternpropertiesadditionalpropertiesinteraction1boxedmap) + +sealed interface that stores validated payloads using boxed classes + +## PropertiesPatternpropertiesAdditionalpropertiesInteraction1BoxedMap +data class PropertiesPatternpropertiesAdditionalpropertiesInteraction1BoxedMap
    +implements [PropertiesPatternpropertiesAdditionalpropertiesInteraction1Boxed](#propertiespatternpropertiesadditionalpropertiesinteraction1boxed) + +data class that stores validated Map payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| PropertiesPatternpropertiesAdditionalpropertiesInteraction1BoxedMap([PropertiesPatternpropertiesAdditionalpropertiesInteractionMap](#propertiespatternpropertiesadditionalpropertiesinteractionmap) data)
    Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| [PropertiesPatternpropertiesAdditionalpropertiesInteractionMap](#propertiespatternpropertiesadditionalpropertiesinteractionmap) | data()
    validated payload | +| Any? | getData()
    validated payload | + +## PropertiesPatternpropertiesAdditionalpropertiesInteraction1 +class PropertiesPatternpropertiesAdditionalpropertiesInteraction1
    +extends JsonSchema + +A schema class that validates payloads + +### Code Sample +``` +import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags; +import org.openapijsonschematools.client.configurations.SchemaConfiguration; +import org.openapijsonschematools.client.exceptions.ValidationException; +import org.openapijsonschematools.client.schemas.validation.MapUtils; +import org.openapijsonschematools.client.schemas.validation.FrozenList; +import org.openapijsonschematools.client.schemas.validation.FrozenMap; +import org.openapijsonschematools.client.components.schemas.PropertiesPatternpropertiesAdditionalpropertiesInteraction; + +import java.util.Arrays; +import java.util.List; +import java.util.AbstractMap; + +static final SchemaConfiguration configuration = new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().build()); + +// Map validation +PropertiesPatternpropertiesAdditionalpropertiesInteraction.PropertiesPatternpropertiesAdditionalpropertiesInteractionMap validatedPayload = + PropertiesPatternpropertiesAdditionalpropertiesInteraction.PropertiesPatternpropertiesAdditionalpropertiesInteraction1.validate( + new PropertiesPatternpropertiesAdditionalpropertiesInteraction.PropertiesPatternpropertiesAdditionalpropertiesInteractionMapBuilder() + .additionalProperty("someAdditionalProperty", 1) + + .build(), + configuration +); +``` + +### Field Summary +| Modifier and Type | Field and Description | +| ----------------- | ---------------------- | +| Set> | type = setOf(Map::class.java) | +| Map> | properties = mapOf(
        "foo" to [Foo::class.java](#foo)),
        "bar" to [Bar::class.java](#bar))
    )
    | +| Class | additionalProperties = [AdditionalProperties::class.java](#additionalproperties) | +| Map> | patternProperties = mapOf(
        new AbstractMap.SimpleEntry<>(Pattern.compile("f.o"), [Fo::class.java](#fo)))
    )
    | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| [PropertiesPatternpropertiesAdditionalpropertiesInteractionMap](#propertiespatternpropertiesadditionalpropertiesinteractionmap) | validate(arg: [Map<?, ?>](#propertiespatternpropertiesadditionalpropertiesinteractionmapbuilder), configuration: SchemaConfiguration) | +| [PropertiesPatternpropertiesAdditionalpropertiesInteraction1BoxedMap](#propertiespatternpropertiesadditionalpropertiesinteraction1boxedmap) | validateAndBox([Map<?, ?>](#propertiespatternpropertiesadditionalpropertiesinteractionmapbuilder), configuration: SchemaConfiguration) | +| [PropertiesPatternpropertiesAdditionalpropertiesInteraction1Boxed](#propertiespatternpropertiesadditionalpropertiesinteraction1boxed) | validateAndBox(Any?, configuration: SchemaConfiguration) | +| Any? | validate(arg: Any?, configuration: SchemaConfiguration) | + +## PropertiesPatternpropertiesAdditionalpropertiesInteractionMapBuilder +class PropertiesPatternpropertiesAdditionalpropertiesInteractionMapBuilder
    +builder for `Map` + +A class that builds the Map input type + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| PropertiesPatternpropertiesAdditionalpropertiesInteractionMapBuilder()
    Creates a builder that contains an empty map | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| Map | build()
    Returns map input that should be used with Schema.validate | +| [PropertiesPatternpropertiesAdditionalpropertiesInteractionMapBuilder](#propertiespatternpropertiesadditionalpropertiesinteractionmapbuilder) | foo(value: List) | +| [PropertiesPatternpropertiesAdditionalpropertiesInteractionMapBuilder](#propertiespatternpropertiesadditionalpropertiesinteractionmapbuilder) | bar(value: List) | +| [PropertiesPatternpropertiesAdditionalpropertiesInteractionMapBuilder](#propertiespatternpropertiesadditionalpropertiesinteractionmapbuilder) | additionalProperty(key: String, value: Int) | +| [PropertiesPatternpropertiesAdditionalpropertiesInteractionMapBuilder](#propertiespatternpropertiesadditionalpropertiesinteractionmapbuilder) | additionalProperty(key: String, value: Float) | +| [PropertiesPatternpropertiesAdditionalpropertiesInteractionMapBuilder](#propertiespatternpropertiesadditionalpropertiesinteractionmapbuilder) | additionalProperty(key: String, value: Long) | +| [PropertiesPatternpropertiesAdditionalpropertiesInteractionMapBuilder](#propertiespatternpropertiesadditionalpropertiesinteractionmapbuilder) | additionalProperty(key: String, value: Double) | + +## PropertiesPatternpropertiesAdditionalpropertiesInteractionMap +class PropertiesPatternpropertiesAdditionalpropertiesInteractionMap
    +extends FrozenMap + +A class to store validated Map payloads + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| static [PropertiesPatternpropertiesAdditionalpropertiesInteractionMap](#propertiespatternpropertiesadditionalpropertiesinteractionmap) | of([Map](#propertiespatternpropertiesadditionalpropertiesinteractionmapbuilder) arg, SchemaConfiguration configuration) | +| FrozenList | foo()
    [optional] | +| FrozenList | bar()
    [optional] | +| Number | getAdditionalProperty(String name)
    provides type safety for additional properties | + +## BarBoxed +sealed interface BarBoxed
    +permits
    +[BarBoxedList](#barboxedlist) + +sealed interface that stores validated payloads using boxed classes + +## BarBoxedList +data class BarBoxedList
    +implements [BarBoxed](#barboxed) + +data class that stores validated List payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| BarBoxedList(FrozenList data)
    Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| FrozenList | data()
    validated payload | +| Any? | getData()
    validated payload | + +## Bar +class Bar
    +extends ListJsonSchema.ListJsonSchema1 + +A schema class that validates payloads + +| Methods Inherited from class org.openapijsonschematools.client.schemas.ListJsonSchema.ListJsonSchema1 | +| ------------------------------------------------------------------ | +| validate | +| validateAndBox | + +## FooBoxed +sealed interface FooBoxed
    +permits
    +[FooBoxedList](#fooboxedlist) + +sealed interface that stores validated payloads using boxed classes + +## FooBoxedList +data class FooBoxedList
    +implements [FooBoxed](#fooboxed) + +data class that stores validated List payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| FooBoxedList(FrozenList data)
    Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| FrozenList | data()
    validated payload | +| Any? | getData()
    validated payload | + +## Foo +class Foo
    +extends JsonSchema + +A schema class that validates payloads + +### Field Summary +| Modifier and Type | Field and Description | +| ----------------- | ---------------------- | +| Set> | type = setOf(List::class.java) | +| Integer | maxItems = 3 | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| FrozenList | validate(arg: List<*>, configuration: SchemaConfiguration) | +| [FooBoxedList](#fooboxedlist) | validateAndBox(List<*>, configuration: SchemaConfiguration) | +| [FooBoxed](#fooboxed) | validateAndBox(Any?, configuration: SchemaConfiguration) | +| Any? | validate(arg: Any?, configuration: SchemaConfiguration) | + +## FoBoxed +sealed interface FoBoxed
    +permits
    +[FoBoxedVoid](#foboxedvoid), +[FoBoxedBoolean](#foboxedboolean), +[FoBoxedNumber](#foboxednumber), +[FoBoxedString](#foboxedstring), +[FoBoxedList](#foboxedlist), +[FoBoxedMap](#foboxedmap) + +sealed interface that stores validated payloads using boxed classes + +## FoBoxedVoid +data class FoBoxedVoid
    +implements [FoBoxed](#foboxed) + +data class that stores validated null payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| FoBoxedVoid(Nothing? data)
    Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| Nothing? | data()
    validated payload | +| Any? | getData()
    validated payload | + +## FoBoxedBoolean +data class FoBoxedBoolean
    +implements [FoBoxed](#foboxed) + +record that stores validated boolean payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| FoBoxedBoolean(boolean data)
    Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| boolean | data()
    validated payload | +| Any? | getData()
    validated payload | + +## FoBoxedNumber +data class FoBoxedNumber
    +implements [FoBoxed](#foboxed) + +data class that stores validated Number payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| FoBoxedNumber(Number data)
    Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| Number | data()
    validated payload | +| Any? | getData()
    validated payload | + +## FoBoxedString +data class FoBoxedString
    +implements [FoBoxed](#foboxed) + +data class that stores validated String payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| FoBoxedString(String data)
    Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| String | data()
    validated payload | +| Any? | getData()
    validated payload | + +## FoBoxedList +data class FoBoxedList
    +implements [FoBoxed](#foboxed) + +data class that stores validated List payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| FoBoxedList(FrozenList data)
    Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| FrozenList | data()
    validated payload | +| Any? | getData()
    validated payload | + +## FoBoxedMap +data class FoBoxedMap
    +implements [FoBoxed](#foboxed) + +data class that stores validated Map payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| FoBoxedMap(FrozenMap data)
    Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| FrozenMap | data()
    validated payload | +| Any? | getData()
    validated payload | + +## Fo +class Fo
    +extends JsonSchema + +A schema class that validates payloads + +### Field Summary +| Modifier and Type | Field and Description | +| ----------------- | ---------------------- | +| Integer | minItems = 2 | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| String | validate(arg: String, configuration: SchemaConfiguration) | +| Nothing? | validate(arg: Nothing?, configuration: SchemaConfiguration) | +| int | validate(arg: int, configuration: SchemaConfiguration) | +| long | validate(arg: long, configuration: SchemaConfiguration) | +| float | validate(arg: float, configuration: SchemaConfiguration) | +| double | validate(arg: double, configuration: SchemaConfiguration) | +| Number | validate(arg: Number, configuration: SchemaConfiguration) | +| boolean | validate(arg: boolean, configuration: SchemaConfiguration) | +| FrozenMap | validate(arg: Map<?, ?>, configuration: SchemaConfiguration) | +| FrozenList | validate(arg: List<*>, configuration: SchemaConfiguration) | +| [FoBoxedString](#foboxedstring) | validateAndBox(String, configuration: SchemaConfiguration) | +| [FoBoxedVoid](#foboxedvoid) | validateAndBox(Nothing?, configuration: SchemaConfiguration) | +| [FoBoxedNumber](#foboxednumber) | validateAndBox(Number, configuration: SchemaConfiguration) | +| [FoBoxedBoolean](#foboxedboolean) | validateAndBox(boolean, configuration: SchemaConfiguration) | +| [FoBoxedMap](#foboxedmap) | validateAndBox(Map<?, ?>, configuration: SchemaConfiguration) | +| [FoBoxedList](#foboxedlist) | validateAndBox(List<*>, configuration: SchemaConfiguration) | +| [FoBoxed](#foboxed) | validateAndBox(Any?, configuration: SchemaConfiguration) | +| Any? | validate(arg: Any?, configuration: SchemaConfiguration) | + +## AdditionalPropertiesBoxed +sealed interface AdditionalPropertiesBoxed
    +permits
    +[AdditionalPropertiesBoxedNumber](#additionalpropertiesboxednumber) + +sealed interface that stores validated payloads using boxed classes + +## AdditionalPropertiesBoxedNumber +data class AdditionalPropertiesBoxedNumber
    +implements [AdditionalPropertiesBoxed](#additionalpropertiesboxed) + +data class that stores validated Number payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| AdditionalPropertiesBoxedNumber(Number data)
    Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| Number | data()
    validated payload | +| Any? | getData()
    validated payload | + +## AdditionalProperties +class AdditionalProperties
    +extends IntJsonSchema.IntJsonSchema1 + +A schema class that validates payloads + +| Methods Inherited from class org.openapijsonschematools.client.schemas.IntJsonSchema.IntJsonSchema1 | +| ------------------------------------------------------------------ | +| validate | +| validateAndBox | + +[[Back to top]](#top) [[Back to Component Schemas]](../../../README.md#Component-Schemas) [[Back to README]](../../../README.md) diff --git a/samples/client/3_1_0_unit_test/kotlin/docs/components/schemas/PropertiesWhoseNamesAreJavascriptObjectPropertyNames.md b/samples/client/3_1_0_unit_test/kotlin/docs/components/schemas/PropertiesWhoseNamesAreJavascriptObjectPropertyNames.md new file mode 100644 index 00000000000..a153b4a36eb --- /dev/null +++ b/samples/client/3_1_0_unit_test/kotlin/docs/components/schemas/PropertiesWhoseNamesAreJavascriptObjectPropertyNames.md @@ -0,0 +1,539 @@ +# PropertiesWhoseNamesAreJavascriptObjectPropertyNames +org.openapijsonschematools.client.components.schemas.PropertiesWhoseNamesAreJavascriptObjectPropertyNames.java +class PropertiesWhoseNamesAreJavascriptObjectPropertyNames
    + +A class that contains necessary nested +- schema classes (which validate payloads), extends JsonSchema +- sealed interfaces which store validated payloads, Kotlin version of a sum type +- boxed classes which store validated payloads, sealed permits class implementations +- classes to store validated map payloads, extends FrozenMap +- classes to build inputs for map payloads + +## Nested Class Summary +| Modifier and Type | Class and Description | +| ----------------- | ---------------------- | +| sealed interface | [PropertiesWhoseNamesAreJavascriptObjectPropertyNames.PropertiesWhoseNamesAreJavascriptObjectPropertyNames1Boxed](#propertieswhosenamesarejavascriptobjectpropertynames1boxed)
    sealed interface for validated payloads | +| record | [PropertiesWhoseNamesAreJavascriptObjectPropertyNames.PropertiesWhoseNamesAreJavascriptObjectPropertyNames1BoxedVoid](#propertieswhosenamesarejavascriptobjectpropertynames1boxedvoid)
    boxed class to store validated null payloads | +| record | [PropertiesWhoseNamesAreJavascriptObjectPropertyNames.PropertiesWhoseNamesAreJavascriptObjectPropertyNames1BoxedBoolean](#propertieswhosenamesarejavascriptobjectpropertynames1boxedboolean)
    boxed class to store validated boolean payloads | +| record | [PropertiesWhoseNamesAreJavascriptObjectPropertyNames.PropertiesWhoseNamesAreJavascriptObjectPropertyNames1BoxedNumber](#propertieswhosenamesarejavascriptobjectpropertynames1boxednumber)
    boxed class to store validated Number payloads | +| record | [PropertiesWhoseNamesAreJavascriptObjectPropertyNames.PropertiesWhoseNamesAreJavascriptObjectPropertyNames1BoxedString](#propertieswhosenamesarejavascriptobjectpropertynames1boxedstring)
    boxed class to store validated String payloads | +| record | [PropertiesWhoseNamesAreJavascriptObjectPropertyNames.PropertiesWhoseNamesAreJavascriptObjectPropertyNames1BoxedList](#propertieswhosenamesarejavascriptobjectpropertynames1boxedlist)
    boxed class to store validated List payloads | +| record | [PropertiesWhoseNamesAreJavascriptObjectPropertyNames.PropertiesWhoseNamesAreJavascriptObjectPropertyNames1BoxedMap](#propertieswhosenamesarejavascriptobjectpropertynames1boxedmap)
    boxed class to store validated Map payloads | +| static class | [PropertiesWhoseNamesAreJavascriptObjectPropertyNames.PropertiesWhoseNamesAreJavascriptObjectPropertyNames1](#propertieswhosenamesarejavascriptobjectpropertynames1)
    schema class | +| static class | [PropertiesWhoseNamesAreJavascriptObjectPropertyNames.PropertiesWhoseNamesAreJavascriptObjectPropertyNamesMapBuilder](#propertieswhosenamesarejavascriptobjectpropertynamesmapbuilder)
    builder for Map payloads | +| static class | [PropertiesWhoseNamesAreJavascriptObjectPropertyNames.PropertiesWhoseNamesAreJavascriptObjectPropertyNamesMap](#propertieswhosenamesarejavascriptobjectpropertynamesmap)
    output class for Map payloads | +| sealed interface | [PropertiesWhoseNamesAreJavascriptObjectPropertyNames.ConstructorSchemaBoxed](#constructorschemaboxed)
    sealed interface for validated payloads | +| record | [PropertiesWhoseNamesAreJavascriptObjectPropertyNames.ConstructorSchemaBoxedNumber](#constructorschemaboxednumber)
    boxed class to store validated Number payloads | +| static class | [PropertiesWhoseNamesAreJavascriptObjectPropertyNames.ConstructorSchema](#constructorschema)
    schema class | +| sealed interface | [PropertiesWhoseNamesAreJavascriptObjectPropertyNames.ToStringBoxed](#tostringboxed)
    sealed interface for validated payloads | +| record | [PropertiesWhoseNamesAreJavascriptObjectPropertyNames.ToStringBoxedVoid](#tostringboxedvoid)
    boxed class to store validated null payloads | +| record | [PropertiesWhoseNamesAreJavascriptObjectPropertyNames.ToStringBoxedBoolean](#tostringboxedboolean)
    boxed class to store validated boolean payloads | +| record | [PropertiesWhoseNamesAreJavascriptObjectPropertyNames.ToStringBoxedNumber](#tostringboxednumber)
    boxed class to store validated Number payloads | +| record | [PropertiesWhoseNamesAreJavascriptObjectPropertyNames.ToStringBoxedString](#tostringboxedstring)
    boxed class to store validated String payloads | +| record | [PropertiesWhoseNamesAreJavascriptObjectPropertyNames.ToStringBoxedList](#tostringboxedlist)
    boxed class to store validated List payloads | +| record | [PropertiesWhoseNamesAreJavascriptObjectPropertyNames.ToStringBoxedMap](#tostringboxedmap)
    boxed class to store validated Map payloads | +| static class | [PropertiesWhoseNamesAreJavascriptObjectPropertyNames.ToString](#tostring)
    schema class | +| static class | [PropertiesWhoseNamesAreJavascriptObjectPropertyNames.ToStringMapBuilder](#tostringmapbuilder)
    builder for Map payloads | +| static class | [PropertiesWhoseNamesAreJavascriptObjectPropertyNames.ToStringMap](#tostringmap)
    output class for Map payloads | +| sealed interface | [PropertiesWhoseNamesAreJavascriptObjectPropertyNames.LengthBoxed](#lengthboxed)
    sealed interface for validated payloads | +| record | [PropertiesWhoseNamesAreJavascriptObjectPropertyNames.LengthBoxedString](#lengthboxedstring)
    boxed class to store validated String payloads | +| static class | [PropertiesWhoseNamesAreJavascriptObjectPropertyNames.Length](#length)
    schema class | +| sealed interface | [PropertiesWhoseNamesAreJavascriptObjectPropertyNames.ProtoBoxed](#protoboxed)
    sealed interface for validated payloads | +| record | [PropertiesWhoseNamesAreJavascriptObjectPropertyNames.ProtoBoxedNumber](#protoboxednumber)
    boxed class to store validated Number payloads | +| static class | [PropertiesWhoseNamesAreJavascriptObjectPropertyNames.Proto](#proto)
    schema class | + +## PropertiesWhoseNamesAreJavascriptObjectPropertyNames1Boxed +sealed interface PropertiesWhoseNamesAreJavascriptObjectPropertyNames1Boxed
    +permits
    +[PropertiesWhoseNamesAreJavascriptObjectPropertyNames1BoxedVoid](#propertieswhosenamesarejavascriptobjectpropertynames1boxedvoid), +[PropertiesWhoseNamesAreJavascriptObjectPropertyNames1BoxedBoolean](#propertieswhosenamesarejavascriptobjectpropertynames1boxedboolean), +[PropertiesWhoseNamesAreJavascriptObjectPropertyNames1BoxedNumber](#propertieswhosenamesarejavascriptobjectpropertynames1boxednumber), +[PropertiesWhoseNamesAreJavascriptObjectPropertyNames1BoxedString](#propertieswhosenamesarejavascriptobjectpropertynames1boxedstring), +[PropertiesWhoseNamesAreJavascriptObjectPropertyNames1BoxedList](#propertieswhosenamesarejavascriptobjectpropertynames1boxedlist), +[PropertiesWhoseNamesAreJavascriptObjectPropertyNames1BoxedMap](#propertieswhosenamesarejavascriptobjectpropertynames1boxedmap) + +sealed interface that stores validated payloads using boxed classes + +## PropertiesWhoseNamesAreJavascriptObjectPropertyNames1BoxedVoid +data class PropertiesWhoseNamesAreJavascriptObjectPropertyNames1BoxedVoid
    +implements [PropertiesWhoseNamesAreJavascriptObjectPropertyNames1Boxed](#propertieswhosenamesarejavascriptobjectpropertynames1boxed) + +data class that stores validated null payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| PropertiesWhoseNamesAreJavascriptObjectPropertyNames1BoxedVoid(Nothing? data)
    Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| Nothing? | data()
    validated payload | +| Any? | getData()
    validated payload | + +## PropertiesWhoseNamesAreJavascriptObjectPropertyNames1BoxedBoolean +data class PropertiesWhoseNamesAreJavascriptObjectPropertyNames1BoxedBoolean
    +implements [PropertiesWhoseNamesAreJavascriptObjectPropertyNames1Boxed](#propertieswhosenamesarejavascriptobjectpropertynames1boxed) + +record that stores validated boolean payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| PropertiesWhoseNamesAreJavascriptObjectPropertyNames1BoxedBoolean(boolean data)
    Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| boolean | data()
    validated payload | +| Any? | getData()
    validated payload | + +## PropertiesWhoseNamesAreJavascriptObjectPropertyNames1BoxedNumber +data class PropertiesWhoseNamesAreJavascriptObjectPropertyNames1BoxedNumber
    +implements [PropertiesWhoseNamesAreJavascriptObjectPropertyNames1Boxed](#propertieswhosenamesarejavascriptobjectpropertynames1boxed) + +data class that stores validated Number payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| PropertiesWhoseNamesAreJavascriptObjectPropertyNames1BoxedNumber(Number data)
    Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| Number | data()
    validated payload | +| Any? | getData()
    validated payload | + +## PropertiesWhoseNamesAreJavascriptObjectPropertyNames1BoxedString +data class PropertiesWhoseNamesAreJavascriptObjectPropertyNames1BoxedString
    +implements [PropertiesWhoseNamesAreJavascriptObjectPropertyNames1Boxed](#propertieswhosenamesarejavascriptobjectpropertynames1boxed) + +data class that stores validated String payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| PropertiesWhoseNamesAreJavascriptObjectPropertyNames1BoxedString(String data)
    Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| String | data()
    validated payload | +| Any? | getData()
    validated payload | + +## PropertiesWhoseNamesAreJavascriptObjectPropertyNames1BoxedList +data class PropertiesWhoseNamesAreJavascriptObjectPropertyNames1BoxedList
    +implements [PropertiesWhoseNamesAreJavascriptObjectPropertyNames1Boxed](#propertieswhosenamesarejavascriptobjectpropertynames1boxed) + +data class that stores validated List payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| PropertiesWhoseNamesAreJavascriptObjectPropertyNames1BoxedList(FrozenList data)
    Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| FrozenList | data()
    validated payload | +| Any? | getData()
    validated payload | + +## PropertiesWhoseNamesAreJavascriptObjectPropertyNames1BoxedMap +data class PropertiesWhoseNamesAreJavascriptObjectPropertyNames1BoxedMap
    +implements [PropertiesWhoseNamesAreJavascriptObjectPropertyNames1Boxed](#propertieswhosenamesarejavascriptobjectpropertynames1boxed) + +data class that stores validated Map payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| PropertiesWhoseNamesAreJavascriptObjectPropertyNames1BoxedMap([PropertiesWhoseNamesAreJavascriptObjectPropertyNamesMap](#propertieswhosenamesarejavascriptobjectpropertynamesmap) data)
    Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| [PropertiesWhoseNamesAreJavascriptObjectPropertyNamesMap](#propertieswhosenamesarejavascriptobjectpropertynamesmap) | data()
    validated payload | +| Any? | getData()
    validated payload | + +## PropertiesWhoseNamesAreJavascriptObjectPropertyNames1 +class PropertiesWhoseNamesAreJavascriptObjectPropertyNames1
    +extends JsonSchema + +A schema class that validates payloads + +### Field Summary +| Modifier and Type | Field and Description | +| ----------------- | ---------------------- | +| Map> | properties = mapOf(
        "__proto__" to [Proto::class.java](#proto)),
        "toString" to [ToString::class.java](#tostring)),
        "constructor" to [ConstructorSchema::class.java](#constructorschema))
    )
    | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| String | validate(arg: String, configuration: SchemaConfiguration) | +| Nothing? | validate(arg: Nothing?, configuration: SchemaConfiguration) | +| int | validate(arg: int, configuration: SchemaConfiguration) | +| long | validate(arg: long, configuration: SchemaConfiguration) | +| float | validate(arg: float, configuration: SchemaConfiguration) | +| double | validate(arg: double, configuration: SchemaConfiguration) | +| Number | validate(arg: Number, configuration: SchemaConfiguration) | +| boolean | validate(arg: boolean, configuration: SchemaConfiguration) | +| [PropertiesWhoseNamesAreJavascriptObjectPropertyNamesMap](#propertieswhosenamesarejavascriptobjectpropertynamesmap) | validate(arg: [Map<?, ?>](#propertieswhosenamesarejavascriptobjectpropertynamesmapbuilder), configuration: SchemaConfiguration) | +| FrozenList | validate(arg: List<*>, configuration: SchemaConfiguration) | +| [PropertiesWhoseNamesAreJavascriptObjectPropertyNames1BoxedString](#propertieswhosenamesarejavascriptobjectpropertynames1boxedstring) | validateAndBox(String, configuration: SchemaConfiguration) | +| [PropertiesWhoseNamesAreJavascriptObjectPropertyNames1BoxedVoid](#propertieswhosenamesarejavascriptobjectpropertynames1boxedvoid) | validateAndBox(Nothing?, configuration: SchemaConfiguration) | +| [PropertiesWhoseNamesAreJavascriptObjectPropertyNames1BoxedNumber](#propertieswhosenamesarejavascriptobjectpropertynames1boxednumber) | validateAndBox(Number, configuration: SchemaConfiguration) | +| [PropertiesWhoseNamesAreJavascriptObjectPropertyNames1BoxedBoolean](#propertieswhosenamesarejavascriptobjectpropertynames1boxedboolean) | validateAndBox(boolean, configuration: SchemaConfiguration) | +| [PropertiesWhoseNamesAreJavascriptObjectPropertyNames1BoxedMap](#propertieswhosenamesarejavascriptobjectpropertynames1boxedmap) | validateAndBox([Map<?, ?>](#propertieswhosenamesarejavascriptobjectpropertynamesmapbuilder), configuration: SchemaConfiguration) | +| [PropertiesWhoseNamesAreJavascriptObjectPropertyNames1BoxedList](#propertieswhosenamesarejavascriptobjectpropertynames1boxedlist) | validateAndBox(List<*>, configuration: SchemaConfiguration) | +| [PropertiesWhoseNamesAreJavascriptObjectPropertyNames1Boxed](#propertieswhosenamesarejavascriptobjectpropertynames1boxed) | validateAndBox(Any?, configuration: SchemaConfiguration) | +| Any? | validate(arg: Any?, configuration: SchemaConfiguration) | + +## PropertiesWhoseNamesAreJavascriptObjectPropertyNamesMapBuilder +class PropertiesWhoseNamesAreJavascriptObjectPropertyNamesMapBuilder
    +builder for `Map` + +A class that builds the Map input type + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| PropertiesWhoseNamesAreJavascriptObjectPropertyNamesMapBuilder()
    Creates a builder that contains an empty map | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| Map | build()
    Returns map input that should be used with Schema.validate | +| [PropertiesWhoseNamesAreJavascriptObjectPropertyNamesMapBuilder](#propertieswhosenamesarejavascriptobjectpropertynamesmapbuilder) | lowLineProto(value: Int) | +| [PropertiesWhoseNamesAreJavascriptObjectPropertyNamesMapBuilder](#propertieswhosenamesarejavascriptobjectpropertynamesmapbuilder) | lowLineProto(value: Float) | +| [PropertiesWhoseNamesAreJavascriptObjectPropertyNamesMapBuilder](#propertieswhosenamesarejavascriptobjectpropertynamesmapbuilder) | lowLineProto(value: Long) | +| [PropertiesWhoseNamesAreJavascriptObjectPropertyNamesMapBuilder](#propertieswhosenamesarejavascriptobjectpropertynamesmapbuilder) | lowLineProto(value: Double) | +| [PropertiesWhoseNamesAreJavascriptObjectPropertyNamesMapBuilder](#propertieswhosenamesarejavascriptobjectpropertynamesmapbuilder) | toString(value: Nothing?) | +| [PropertiesWhoseNamesAreJavascriptObjectPropertyNamesMapBuilder](#propertieswhosenamesarejavascriptobjectpropertynamesmapbuilder) | toString(value: Boolean) | +| [PropertiesWhoseNamesAreJavascriptObjectPropertyNamesMapBuilder](#propertieswhosenamesarejavascriptobjectpropertynamesmapbuilder) | toString(value: String) | +| [PropertiesWhoseNamesAreJavascriptObjectPropertyNamesMapBuilder](#propertieswhosenamesarejavascriptobjectpropertynamesmapbuilder) | toString(value: Int) | +| [PropertiesWhoseNamesAreJavascriptObjectPropertyNamesMapBuilder](#propertieswhosenamesarejavascriptobjectpropertynamesmapbuilder) | toString(value: Float) | +| [PropertiesWhoseNamesAreJavascriptObjectPropertyNamesMapBuilder](#propertieswhosenamesarejavascriptobjectpropertynamesmapbuilder) | toString(value: Long) | +| [PropertiesWhoseNamesAreJavascriptObjectPropertyNamesMapBuilder](#propertieswhosenamesarejavascriptobjectpropertynamesmapbuilder) | toString(value: Double) | +| [PropertiesWhoseNamesAreJavascriptObjectPropertyNamesMapBuilder](#propertieswhosenamesarejavascriptobjectpropertynamesmapbuilder) | toString(value: List) | +| [PropertiesWhoseNamesAreJavascriptObjectPropertyNamesMapBuilder](#propertieswhosenamesarejavascriptobjectpropertynamesmapbuilder) | toString(value: Map) | +| [PropertiesWhoseNamesAreJavascriptObjectPropertyNamesMapBuilder](#propertieswhosenamesarejavascriptobjectpropertynamesmapbuilder) | setConstructor(value: Int) | +| [PropertiesWhoseNamesAreJavascriptObjectPropertyNamesMapBuilder](#propertieswhosenamesarejavascriptobjectpropertynamesmapbuilder) | setConstructor(value: Float) | +| [PropertiesWhoseNamesAreJavascriptObjectPropertyNamesMapBuilder](#propertieswhosenamesarejavascriptobjectpropertynamesmapbuilder) | setConstructor(value: Long) | +| [PropertiesWhoseNamesAreJavascriptObjectPropertyNamesMapBuilder](#propertieswhosenamesarejavascriptobjectpropertynamesmapbuilder) | setConstructor(value: Double) | +| [PropertiesWhoseNamesAreJavascriptObjectPropertyNamesMapBuilder](#propertieswhosenamesarejavascriptobjectpropertynamesmapbuilder) | additionalProperty(key: String, value: Nothing?) | +| [PropertiesWhoseNamesAreJavascriptObjectPropertyNamesMapBuilder](#propertieswhosenamesarejavascriptobjectpropertynamesmapbuilder) | additionalProperty(key: String, value: Boolean) | +| [PropertiesWhoseNamesAreJavascriptObjectPropertyNamesMapBuilder](#propertieswhosenamesarejavascriptobjectpropertynamesmapbuilder) | additionalProperty(key: String, value: String) | +| [PropertiesWhoseNamesAreJavascriptObjectPropertyNamesMapBuilder](#propertieswhosenamesarejavascriptobjectpropertynamesmapbuilder) | additionalProperty(key: String, value: Int) | +| [PropertiesWhoseNamesAreJavascriptObjectPropertyNamesMapBuilder](#propertieswhosenamesarejavascriptobjectpropertynamesmapbuilder) | additionalProperty(key: String, value: Float) | +| [PropertiesWhoseNamesAreJavascriptObjectPropertyNamesMapBuilder](#propertieswhosenamesarejavascriptobjectpropertynamesmapbuilder) | additionalProperty(key: String, value: Long) | +| [PropertiesWhoseNamesAreJavascriptObjectPropertyNamesMapBuilder](#propertieswhosenamesarejavascriptobjectpropertynamesmapbuilder) | additionalProperty(key: String, value: Double) | +| [PropertiesWhoseNamesAreJavascriptObjectPropertyNamesMapBuilder](#propertieswhosenamesarejavascriptobjectpropertynamesmapbuilder) | additionalProperty(key: String, value: List) | +| [PropertiesWhoseNamesAreJavascriptObjectPropertyNamesMapBuilder](#propertieswhosenamesarejavascriptobjectpropertynamesmapbuilder) | additionalProperty(key: String, value: Map) | + +## PropertiesWhoseNamesAreJavascriptObjectPropertyNamesMap +class PropertiesWhoseNamesAreJavascriptObjectPropertyNamesMap
    +extends FrozenMap + +A class to store validated Map payloads + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| static [PropertiesWhoseNamesAreJavascriptObjectPropertyNamesMap](#propertieswhosenamesarejavascriptobjectpropertynamesmap) | of([Map](#propertieswhosenamesarejavascriptobjectpropertynamesmapbuilder) arg, SchemaConfiguration configuration) | +| Any? | toString()
    [optional] | +| Any? | get(String key)
    This schema has invalid Kotlin names so this method must be used when you access instance["__proto__"], instance["constructor"], | +| Any? | getAdditionalProperty(String name)
    provides type safety for additional properties | + +## ConstructorSchemaBoxed +sealed interface ConstructorSchemaBoxed
    +permits
    +[ConstructorSchemaBoxedNumber](#constructorschemaboxednumber) + +sealed interface that stores validated payloads using boxed classes + +## ConstructorSchemaBoxedNumber +data class ConstructorSchemaBoxedNumber
    +implements [ConstructorSchemaBoxed](#constructorschemaboxed) + +data class that stores validated Number payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| ConstructorSchemaBoxedNumber(Number data)
    Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| Number | data()
    validated payload | +| Any? | getData()
    validated payload | + +## ConstructorSchema +class ConstructorSchema
    +extends NumberJsonSchema.NumberJsonSchema1 + +A schema class that validates payloads + +| Methods Inherited from class org.openapijsonschematools.client.schemas.NumberJsonSchema.NumberJsonSchema1 | +| ------------------------------------------------------------------ | +| validate | +| validateAndBox | + +## ToStringBoxed +sealed interface ToStringBoxed
    +permits
    +[ToStringBoxedVoid](#tostringboxedvoid), +[ToStringBoxedBoolean](#tostringboxedboolean), +[ToStringBoxedNumber](#tostringboxednumber), +[ToStringBoxedString](#tostringboxedstring), +[ToStringBoxedList](#tostringboxedlist), +[ToStringBoxedMap](#tostringboxedmap) + +sealed interface that stores validated payloads using boxed classes + +## ToStringBoxedVoid +data class ToStringBoxedVoid
    +implements [ToStringBoxed](#tostringboxed) + +data class that stores validated null payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| ToStringBoxedVoid(Nothing? data)
    Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| Nothing? | data()
    validated payload | +| Any? | getData()
    validated payload | + +## ToStringBoxedBoolean +data class ToStringBoxedBoolean
    +implements [ToStringBoxed](#tostringboxed) + +record that stores validated boolean payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| ToStringBoxedBoolean(boolean data)
    Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| boolean | data()
    validated payload | +| Any? | getData()
    validated payload | + +## ToStringBoxedNumber +data class ToStringBoxedNumber
    +implements [ToStringBoxed](#tostringboxed) + +data class that stores validated Number payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| ToStringBoxedNumber(Number data)
    Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| Number | data()
    validated payload | +| Any? | getData()
    validated payload | + +## ToStringBoxedString +data class ToStringBoxedString
    +implements [ToStringBoxed](#tostringboxed) + +data class that stores validated String payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| ToStringBoxedString(String data)
    Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| String | data()
    validated payload | +| Any? | getData()
    validated payload | + +## ToStringBoxedList +data class ToStringBoxedList
    +implements [ToStringBoxed](#tostringboxed) + +data class that stores validated List payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| ToStringBoxedList(FrozenList data)
    Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| FrozenList | data()
    validated payload | +| Any? | getData()
    validated payload | + +## ToStringBoxedMap +data class ToStringBoxedMap
    +implements [ToStringBoxed](#tostringboxed) + +data class that stores validated Map payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| ToStringBoxedMap([ToStringMap](#tostringmap) data)
    Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| [ToStringMap](#tostringmap) | data()
    validated payload | +| Any? | getData()
    validated payload | + +## ToString +class ToString
    +extends JsonSchema + +A schema class that validates payloads + +### Field Summary +| Modifier and Type | Field and Description | +| ----------------- | ---------------------- | +| Map> | properties = mapOf(
        "length" to [Length::class.java](#length))
    )
    | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| String | validate(arg: String, configuration: SchemaConfiguration) | +| Nothing? | validate(arg: Nothing?, configuration: SchemaConfiguration) | +| int | validate(arg: int, configuration: SchemaConfiguration) | +| long | validate(arg: long, configuration: SchemaConfiguration) | +| float | validate(arg: float, configuration: SchemaConfiguration) | +| double | validate(arg: double, configuration: SchemaConfiguration) | +| Number | validate(arg: Number, configuration: SchemaConfiguration) | +| boolean | validate(arg: boolean, configuration: SchemaConfiguration) | +| [ToStringMap](#tostringmap) | validate(arg: [Map<?, ?>](#tostringmapbuilder), configuration: SchemaConfiguration) | +| FrozenList | validate(arg: List<*>, configuration: SchemaConfiguration) | +| [ToStringBoxedString](#tostringboxedstring) | validateAndBox(String, configuration: SchemaConfiguration) | +| [ToStringBoxedVoid](#tostringboxedvoid) | validateAndBox(Nothing?, configuration: SchemaConfiguration) | +| [ToStringBoxedNumber](#tostringboxednumber) | validateAndBox(Number, configuration: SchemaConfiguration) | +| [ToStringBoxedBoolean](#tostringboxedboolean) | validateAndBox(boolean, configuration: SchemaConfiguration) | +| [ToStringBoxedMap](#tostringboxedmap) | validateAndBox([Map<?, ?>](#tostringmapbuilder), configuration: SchemaConfiguration) | +| [ToStringBoxedList](#tostringboxedlist) | validateAndBox(List<*>, configuration: SchemaConfiguration) | +| [ToStringBoxed](#tostringboxed) | validateAndBox(Any?, configuration: SchemaConfiguration) | +| Any? | validate(arg: Any?, configuration: SchemaConfiguration) | + +## ToStringMapBuilder +class ToStringMapBuilder
    +builder for `Map` + +A class that builds the Map input type + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| ToStringMapBuilder()
    Creates a builder that contains an empty map | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| Map | build()
    Returns map input that should be used with Schema.validate | +| [ToStringMapBuilder](#tostringmapbuilder) | length(value: String) | +| [ToStringMapBuilder](#tostringmapbuilder) | additionalProperty(key: String, value: Nothing?) | +| [ToStringMapBuilder](#tostringmapbuilder) | additionalProperty(key: String, value: Boolean) | +| [ToStringMapBuilder](#tostringmapbuilder) | additionalProperty(key: String, value: String) | +| [ToStringMapBuilder](#tostringmapbuilder) | additionalProperty(key: String, value: Int) | +| [ToStringMapBuilder](#tostringmapbuilder) | additionalProperty(key: String, value: Float) | +| [ToStringMapBuilder](#tostringmapbuilder) | additionalProperty(key: String, value: Long) | +| [ToStringMapBuilder](#tostringmapbuilder) | additionalProperty(key: String, value: Double) | +| [ToStringMapBuilder](#tostringmapbuilder) | additionalProperty(key: String, value: List) | +| [ToStringMapBuilder](#tostringmapbuilder) | additionalProperty(key: String, value: Map) | + +## ToStringMap +class ToStringMap
    +extends FrozenMap + +A class to store validated Map payloads + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| static [ToStringMap](#tostringmap) | of([Map](#tostringmapbuilder) arg, SchemaConfiguration configuration) | +| String | length()
    [optional] | +| Any? | getAdditionalProperty(String name)
    provides type safety for additional properties | + +## LengthBoxed +sealed interface LengthBoxed
    +permits
    +[LengthBoxedString](#lengthboxedstring) + +sealed interface that stores validated payloads using boxed classes + +## LengthBoxedString +data class LengthBoxedString
    +implements [LengthBoxed](#lengthboxed) + +data class that stores validated String payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| LengthBoxedString(String data)
    Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| String | data()
    validated payload | +| Any? | getData()
    validated payload | + +## Length +class Length
    +extends StringJsonSchema.StringJsonSchema1 + +A schema class that validates payloads + +| Methods Inherited from class org.openapijsonschematools.client.schemas.StringJsonSchema.StringJsonSchema1 | +| ------------------------------------------------------------------ | +| validate | +| validateAndBox | + +## ProtoBoxed +sealed interface ProtoBoxed
    +permits
    +[ProtoBoxedNumber](#protoboxednumber) + +sealed interface that stores validated payloads using boxed classes + +## ProtoBoxedNumber +data class ProtoBoxedNumber
    +implements [ProtoBoxed](#protoboxed) + +data class that stores validated Number payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| ProtoBoxedNumber(Number data)
    Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| Number | data()
    validated payload | +| Any? | getData()
    validated payload | + +## Proto +class Proto
    +extends NumberJsonSchema.NumberJsonSchema1 + +A schema class that validates payloads + +| Methods Inherited from class org.openapijsonschematools.client.schemas.NumberJsonSchema.NumberJsonSchema1 | +| ------------------------------------------------------------------ | +| validate | +| validateAndBox | + +[[Back to top]](#top) [[Back to Component Schemas]](../../../README.md#Component-Schemas) [[Back to README]](../../../README.md) diff --git a/samples/client/3_1_0_unit_test/kotlin/docs/components/schemas/PropertiesWithEscapedCharacters.md b/samples/client/3_1_0_unit_test/kotlin/docs/components/schemas/PropertiesWithEscapedCharacters.md new file mode 100644 index 00000000000..385cc3ca185 --- /dev/null +++ b/samples/client/3_1_0_unit_test/kotlin/docs/components/schemas/PropertiesWithEscapedCharacters.md @@ -0,0 +1,463 @@ +# PropertiesWithEscapedCharacters +org.openapijsonschematools.client.components.schemas.PropertiesWithEscapedCharacters.java +class PropertiesWithEscapedCharacters
    + +A class that contains necessary nested +- schema classes (which validate payloads), extends JsonSchema +- sealed interfaces which store validated payloads, Kotlin version of a sum type +- boxed classes which store validated payloads, sealed permits class implementations +- classes to store validated map payloads, extends FrozenMap +- classes to build inputs for map payloads + +## Nested Class Summary +| Modifier and Type | Class and Description | +| ----------------- | ---------------------- | +| sealed interface | [PropertiesWithEscapedCharacters.PropertiesWithEscapedCharacters1Boxed](#propertieswithescapedcharacters1boxed)
    sealed interface for validated payloads | +| record | [PropertiesWithEscapedCharacters.PropertiesWithEscapedCharacters1BoxedVoid](#propertieswithescapedcharacters1boxedvoid)
    boxed class to store validated null payloads | +| record | [PropertiesWithEscapedCharacters.PropertiesWithEscapedCharacters1BoxedBoolean](#propertieswithescapedcharacters1boxedboolean)
    boxed class to store validated boolean payloads | +| record | [PropertiesWithEscapedCharacters.PropertiesWithEscapedCharacters1BoxedNumber](#propertieswithescapedcharacters1boxednumber)
    boxed class to store validated Number payloads | +| record | [PropertiesWithEscapedCharacters.PropertiesWithEscapedCharacters1BoxedString](#propertieswithescapedcharacters1boxedstring)
    boxed class to store validated String payloads | +| record | [PropertiesWithEscapedCharacters.PropertiesWithEscapedCharacters1BoxedList](#propertieswithescapedcharacters1boxedlist)
    boxed class to store validated List payloads | +| record | [PropertiesWithEscapedCharacters.PropertiesWithEscapedCharacters1BoxedMap](#propertieswithescapedcharacters1boxedmap)
    boxed class to store validated Map payloads | +| static class | [PropertiesWithEscapedCharacters.PropertiesWithEscapedCharacters1](#propertieswithescapedcharacters1)
    schema class | +| static class | [PropertiesWithEscapedCharacters.PropertiesWithEscapedCharactersMapBuilder](#propertieswithescapedcharactersmapbuilder)
    builder for Map payloads | +| static class | [PropertiesWithEscapedCharacters.PropertiesWithEscapedCharactersMap](#propertieswithescapedcharactersmap)
    output class for Map payloads | +| sealed interface | [PropertiesWithEscapedCharacters.Foou000CbarBoxed](#foou000cbarboxed)
    sealed interface for validated payloads | +| record | [PropertiesWithEscapedCharacters.Foou000CbarBoxedNumber](#foou000cbarboxednumber)
    boxed class to store validated Number payloads | +| static class | [PropertiesWithEscapedCharacters.Foou000Cbar](#foou000cbar)
    schema class | +| sealed interface | [PropertiesWithEscapedCharacters.FootbarBoxed](#footbarboxed)
    sealed interface for validated payloads | +| record | [PropertiesWithEscapedCharacters.FootbarBoxedNumber](#footbarboxednumber)
    boxed class to store validated Number payloads | +| static class | [PropertiesWithEscapedCharacters.Footbar](#footbar)
    schema class | +| sealed interface | [PropertiesWithEscapedCharacters.FoorbarBoxed](#foorbarboxed)
    sealed interface for validated payloads | +| record | [PropertiesWithEscapedCharacters.FoorbarBoxedNumber](#foorbarboxednumber)
    boxed class to store validated Number payloads | +| static class | [PropertiesWithEscapedCharacters.Foorbar](#foorbar)
    schema class | +| sealed interface | [PropertiesWithEscapedCharacters.Foobar1Boxed](#foobar1boxed)
    sealed interface for validated payloads | +| record | [PropertiesWithEscapedCharacters.Foobar1BoxedNumber](#foobar1boxednumber)
    boxed class to store validated Number payloads | +| static class | [PropertiesWithEscapedCharacters.Foobar1](#foobar1)
    schema class | +| sealed interface | [PropertiesWithEscapedCharacters.FoobarBoxed](#foobarboxed)
    sealed interface for validated payloads | +| record | [PropertiesWithEscapedCharacters.FoobarBoxedNumber](#foobarboxednumber)
    boxed class to store validated Number payloads | +| static class | [PropertiesWithEscapedCharacters.Foobar](#foobar)
    schema class | +| sealed interface | [PropertiesWithEscapedCharacters.FoonbarBoxed](#foonbarboxed)
    sealed interface for validated payloads | +| record | [PropertiesWithEscapedCharacters.FoonbarBoxedNumber](#foonbarboxednumber)
    boxed class to store validated Number payloads | +| static class | [PropertiesWithEscapedCharacters.Foonbar](#foonbar)
    schema class | + +## PropertiesWithEscapedCharacters1Boxed +sealed interface PropertiesWithEscapedCharacters1Boxed
    +permits
    +[PropertiesWithEscapedCharacters1BoxedVoid](#propertieswithescapedcharacters1boxedvoid), +[PropertiesWithEscapedCharacters1BoxedBoolean](#propertieswithescapedcharacters1boxedboolean), +[PropertiesWithEscapedCharacters1BoxedNumber](#propertieswithescapedcharacters1boxednumber), +[PropertiesWithEscapedCharacters1BoxedString](#propertieswithescapedcharacters1boxedstring), +[PropertiesWithEscapedCharacters1BoxedList](#propertieswithescapedcharacters1boxedlist), +[PropertiesWithEscapedCharacters1BoxedMap](#propertieswithescapedcharacters1boxedmap) + +sealed interface that stores validated payloads using boxed classes + +## PropertiesWithEscapedCharacters1BoxedVoid +data class PropertiesWithEscapedCharacters1BoxedVoid
    +implements [PropertiesWithEscapedCharacters1Boxed](#propertieswithescapedcharacters1boxed) + +data class that stores validated null payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| PropertiesWithEscapedCharacters1BoxedVoid(Nothing? data)
    Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| Nothing? | data()
    validated payload | +| Any? | getData()
    validated payload | + +## PropertiesWithEscapedCharacters1BoxedBoolean +data class PropertiesWithEscapedCharacters1BoxedBoolean
    +implements [PropertiesWithEscapedCharacters1Boxed](#propertieswithescapedcharacters1boxed) + +record that stores validated boolean payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| PropertiesWithEscapedCharacters1BoxedBoolean(boolean data)
    Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| boolean | data()
    validated payload | +| Any? | getData()
    validated payload | + +## PropertiesWithEscapedCharacters1BoxedNumber +data class PropertiesWithEscapedCharacters1BoxedNumber
    +implements [PropertiesWithEscapedCharacters1Boxed](#propertieswithescapedcharacters1boxed) + +data class that stores validated Number payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| PropertiesWithEscapedCharacters1BoxedNumber(Number data)
    Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| Number | data()
    validated payload | +| Any? | getData()
    validated payload | + +## PropertiesWithEscapedCharacters1BoxedString +data class PropertiesWithEscapedCharacters1BoxedString
    +implements [PropertiesWithEscapedCharacters1Boxed](#propertieswithescapedcharacters1boxed) + +data class that stores validated String payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| PropertiesWithEscapedCharacters1BoxedString(String data)
    Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| String | data()
    validated payload | +| Any? | getData()
    validated payload | + +## PropertiesWithEscapedCharacters1BoxedList +data class PropertiesWithEscapedCharacters1BoxedList
    +implements [PropertiesWithEscapedCharacters1Boxed](#propertieswithescapedcharacters1boxed) + +data class that stores validated List payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| PropertiesWithEscapedCharacters1BoxedList(FrozenList data)
    Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| FrozenList | data()
    validated payload | +| Any? | getData()
    validated payload | + +## PropertiesWithEscapedCharacters1BoxedMap +data class PropertiesWithEscapedCharacters1BoxedMap
    +implements [PropertiesWithEscapedCharacters1Boxed](#propertieswithescapedcharacters1boxed) + +data class that stores validated Map payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| PropertiesWithEscapedCharacters1BoxedMap([PropertiesWithEscapedCharactersMap](#propertieswithescapedcharactersmap) data)
    Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| [PropertiesWithEscapedCharactersMap](#propertieswithescapedcharactersmap) | data()
    validated payload | +| Any? | getData()
    validated payload | + +## PropertiesWithEscapedCharacters1 +class PropertiesWithEscapedCharacters1
    +extends JsonSchema + +A schema class that validates payloads + +### Field Summary +| Modifier and Type | Field and Description | +| ----------------- | ---------------------- | +| Map> | properties = mapOf(
        "foo\nbar" to [Foonbar::class.java](#foonbar)),
        "foo\"bar" to [Foobar::class.java](#foobar)),
        "foo\\bar" to [Foobar1::class.java](#foobar1)),
        "foo\rbar" to [Foorbar::class.java](#foorbar)),
        "foo\tbar" to [Footbar::class.java](#footbar)),
        "foo\u000Cbar" to [Foou000Cbar::class.java](#foou000cbar))
    )
    | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| String | validate(arg: String, configuration: SchemaConfiguration) | +| Nothing? | validate(arg: Nothing?, configuration: SchemaConfiguration) | +| int | validate(arg: int, configuration: SchemaConfiguration) | +| long | validate(arg: long, configuration: SchemaConfiguration) | +| float | validate(arg: float, configuration: SchemaConfiguration) | +| double | validate(arg: double, configuration: SchemaConfiguration) | +| Number | validate(arg: Number, configuration: SchemaConfiguration) | +| boolean | validate(arg: boolean, configuration: SchemaConfiguration) | +| [PropertiesWithEscapedCharactersMap](#propertieswithescapedcharactersmap) | validate(arg: [Map<?, ?>](#propertieswithescapedcharactersmapbuilder), configuration: SchemaConfiguration) | +| FrozenList | validate(arg: List<*>, configuration: SchemaConfiguration) | +| [PropertiesWithEscapedCharacters1BoxedString](#propertieswithescapedcharacters1boxedstring) | validateAndBox(String, configuration: SchemaConfiguration) | +| [PropertiesWithEscapedCharacters1BoxedVoid](#propertieswithescapedcharacters1boxedvoid) | validateAndBox(Nothing?, configuration: SchemaConfiguration) | +| [PropertiesWithEscapedCharacters1BoxedNumber](#propertieswithescapedcharacters1boxednumber) | validateAndBox(Number, configuration: SchemaConfiguration) | +| [PropertiesWithEscapedCharacters1BoxedBoolean](#propertieswithescapedcharacters1boxedboolean) | validateAndBox(boolean, configuration: SchemaConfiguration) | +| [PropertiesWithEscapedCharacters1BoxedMap](#propertieswithescapedcharacters1boxedmap) | validateAndBox([Map<?, ?>](#propertieswithescapedcharactersmapbuilder), configuration: SchemaConfiguration) | +| [PropertiesWithEscapedCharacters1BoxedList](#propertieswithescapedcharacters1boxedlist) | validateAndBox(List<*>, configuration: SchemaConfiguration) | +| [PropertiesWithEscapedCharacters1Boxed](#propertieswithescapedcharacters1boxed) | validateAndBox(Any?, configuration: SchemaConfiguration) | +| Any? | validate(arg: Any?, configuration: SchemaConfiguration) | + +## PropertiesWithEscapedCharactersMapBuilder +class PropertiesWithEscapedCharactersMapBuilder
    +builder for `Map` + +A class that builds the Map input type + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| PropertiesWithEscapedCharactersMapBuilder()
    Creates a builder that contains an empty map | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| Map | build()
    Returns map input that should be used with Schema.validate | +| [PropertiesWithEscapedCharactersMapBuilder](#propertieswithescapedcharactersmapbuilder) | fooReverseSolidusNbar(value: Int) | +| [PropertiesWithEscapedCharactersMapBuilder](#propertieswithescapedcharactersmapbuilder) | fooReverseSolidusNbar(value: Float) | +| [PropertiesWithEscapedCharactersMapBuilder](#propertieswithescapedcharactersmapbuilder) | fooReverseSolidusNbar(value: Long) | +| [PropertiesWithEscapedCharactersMapBuilder](#propertieswithescapedcharactersmapbuilder) | fooReverseSolidusNbar(value: Double) | +| [PropertiesWithEscapedCharactersMapBuilder](#propertieswithescapedcharactersmapbuilder) | fooReverseSolidusQuotationMarkBar(value: Int) | +| [PropertiesWithEscapedCharactersMapBuilder](#propertieswithescapedcharactersmapbuilder) | fooReverseSolidusQuotationMarkBar(value: Float) | +| [PropertiesWithEscapedCharactersMapBuilder](#propertieswithescapedcharactersmapbuilder) | fooReverseSolidusQuotationMarkBar(value: Long) | +| [PropertiesWithEscapedCharactersMapBuilder](#propertieswithescapedcharactersmapbuilder) | fooReverseSolidusQuotationMarkBar(value: Double) | +| [PropertiesWithEscapedCharactersMapBuilder](#propertieswithescapedcharactersmapbuilder) | fooReverseSolidusReverseSolidusBar(value: Int) | +| [PropertiesWithEscapedCharactersMapBuilder](#propertieswithescapedcharactersmapbuilder) | fooReverseSolidusReverseSolidusBar(value: Float) | +| [PropertiesWithEscapedCharactersMapBuilder](#propertieswithescapedcharactersmapbuilder) | fooReverseSolidusReverseSolidusBar(value: Long) | +| [PropertiesWithEscapedCharactersMapBuilder](#propertieswithescapedcharactersmapbuilder) | fooReverseSolidusReverseSolidusBar(value: Double) | +| [PropertiesWithEscapedCharactersMapBuilder](#propertieswithescapedcharactersmapbuilder) | fooReverseSolidusRbar(value: Int) | +| [PropertiesWithEscapedCharactersMapBuilder](#propertieswithescapedcharactersmapbuilder) | fooReverseSolidusRbar(value: Float) | +| [PropertiesWithEscapedCharactersMapBuilder](#propertieswithescapedcharactersmapbuilder) | fooReverseSolidusRbar(value: Long) | +| [PropertiesWithEscapedCharactersMapBuilder](#propertieswithescapedcharactersmapbuilder) | fooReverseSolidusRbar(value: Double) | +| [PropertiesWithEscapedCharactersMapBuilder](#propertieswithescapedcharactersmapbuilder) | fooReverseSolidusTbar(value: Int) | +| [PropertiesWithEscapedCharactersMapBuilder](#propertieswithescapedcharactersmapbuilder) | fooReverseSolidusTbar(value: Float) | +| [PropertiesWithEscapedCharactersMapBuilder](#propertieswithescapedcharactersmapbuilder) | fooReverseSolidusTbar(value: Long) | +| [PropertiesWithEscapedCharactersMapBuilder](#propertieswithescapedcharactersmapbuilder) | fooReverseSolidusTbar(value: Double) | +| [PropertiesWithEscapedCharactersMapBuilder](#propertieswithescapedcharactersmapbuilder) | fooReverseSolidusU000cbar(value: Int) | +| [PropertiesWithEscapedCharactersMapBuilder](#propertieswithescapedcharactersmapbuilder) | fooReverseSolidusU000cbar(value: Float) | +| [PropertiesWithEscapedCharactersMapBuilder](#propertieswithescapedcharactersmapbuilder) | fooReverseSolidusU000cbar(value: Long) | +| [PropertiesWithEscapedCharactersMapBuilder](#propertieswithescapedcharactersmapbuilder) | fooReverseSolidusU000cbar(value: Double) | +| [PropertiesWithEscapedCharactersMapBuilder](#propertieswithescapedcharactersmapbuilder) | additionalProperty(key: String, value: Nothing?) | +| [PropertiesWithEscapedCharactersMapBuilder](#propertieswithescapedcharactersmapbuilder) | additionalProperty(key: String, value: Boolean) | +| [PropertiesWithEscapedCharactersMapBuilder](#propertieswithescapedcharactersmapbuilder) | additionalProperty(key: String, value: String) | +| [PropertiesWithEscapedCharactersMapBuilder](#propertieswithescapedcharactersmapbuilder) | additionalProperty(key: String, value: Int) | +| [PropertiesWithEscapedCharactersMapBuilder](#propertieswithescapedcharactersmapbuilder) | additionalProperty(key: String, value: Float) | +| [PropertiesWithEscapedCharactersMapBuilder](#propertieswithescapedcharactersmapbuilder) | additionalProperty(key: String, value: Long) | +| [PropertiesWithEscapedCharactersMapBuilder](#propertieswithescapedcharactersmapbuilder) | additionalProperty(key: String, value: Double) | +| [PropertiesWithEscapedCharactersMapBuilder](#propertieswithescapedcharactersmapbuilder) | additionalProperty(key: String, value: List) | +| [PropertiesWithEscapedCharactersMapBuilder](#propertieswithescapedcharactersmapbuilder) | additionalProperty(key: String, value: Map) | + +## PropertiesWithEscapedCharactersMap +class PropertiesWithEscapedCharactersMap
    +extends FrozenMap + +A class to store validated Map payloads + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| static [PropertiesWithEscapedCharactersMap](#propertieswithescapedcharactersmap) | of([Map](#propertieswithescapedcharactersmapbuilder) arg, SchemaConfiguration configuration) | +| Any? | get(String key)
    This schema has invalid Kotlin names so this method must be used when you access instance["foo\nbar"], instance["foo\"bar"], instance["foo\\bar"], instance["foo\rbar"], instance["foo\tbar"], instance["foo\u000Cbar"], | +| Any? | getAdditionalProperty(String name)
    provides type safety for additional properties | + +## Foou000CbarBoxed +sealed interface Foou000CbarBoxed
    +permits
    +[Foou000CbarBoxedNumber](#foou000cbarboxednumber) + +sealed interface that stores validated payloads using boxed classes + +## Foou000CbarBoxedNumber +data class Foou000CbarBoxedNumber
    +implements [Foou000CbarBoxed](#foou000cbarboxed) + +data class that stores validated Number payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| Foou000CbarBoxedNumber(Number data)
    Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| Number | data()
    validated payload | +| Any? | getData()
    validated payload | + +## Foou000Cbar +class Foou000Cbar
    +extends NumberJsonSchema.NumberJsonSchema1 + +A schema class that validates payloads + +| Methods Inherited from class org.openapijsonschematools.client.schemas.NumberJsonSchema.NumberJsonSchema1 | +| ------------------------------------------------------------------ | +| validate | +| validateAndBox | + +## FootbarBoxed +sealed interface FootbarBoxed
    +permits
    +[FootbarBoxedNumber](#footbarboxednumber) + +sealed interface that stores validated payloads using boxed classes + +## FootbarBoxedNumber +data class FootbarBoxedNumber
    +implements [FootbarBoxed](#footbarboxed) + +data class that stores validated Number payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| FootbarBoxedNumber(Number data)
    Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| Number | data()
    validated payload | +| Any? | getData()
    validated payload | + +## Footbar +class Footbar
    +extends NumberJsonSchema.NumberJsonSchema1 + +A schema class that validates payloads + +| Methods Inherited from class org.openapijsonschematools.client.schemas.NumberJsonSchema.NumberJsonSchema1 | +| ------------------------------------------------------------------ | +| validate | +| validateAndBox | + +## FoorbarBoxed +sealed interface FoorbarBoxed
    +permits
    +[FoorbarBoxedNumber](#foorbarboxednumber) + +sealed interface that stores validated payloads using boxed classes + +## FoorbarBoxedNumber +data class FoorbarBoxedNumber
    +implements [FoorbarBoxed](#foorbarboxed) + +data class that stores validated Number payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| FoorbarBoxedNumber(Number data)
    Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| Number | data()
    validated payload | +| Any? | getData()
    validated payload | + +## Foorbar +class Foorbar
    +extends NumberJsonSchema.NumberJsonSchema1 + +A schema class that validates payloads + +| Methods Inherited from class org.openapijsonschematools.client.schemas.NumberJsonSchema.NumberJsonSchema1 | +| ------------------------------------------------------------------ | +| validate | +| validateAndBox | + +## Foobar1Boxed +sealed interface Foobar1Boxed
    +permits
    +[Foobar1BoxedNumber](#foobar1boxednumber) + +sealed interface that stores validated payloads using boxed classes + +## Foobar1BoxedNumber +data class Foobar1BoxedNumber
    +implements [Foobar1Boxed](#foobar1boxed) + +data class that stores validated Number payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| Foobar1BoxedNumber(Number data)
    Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| Number | data()
    validated payload | +| Any? | getData()
    validated payload | + +## Foobar1 +class Foobar1
    +extends NumberJsonSchema.NumberJsonSchema1 + +A schema class that validates payloads + +| Methods Inherited from class org.openapijsonschematools.client.schemas.NumberJsonSchema.NumberJsonSchema1 | +| ------------------------------------------------------------------ | +| validate | +| validateAndBox | + +## FoobarBoxed +sealed interface FoobarBoxed
    +permits
    +[FoobarBoxedNumber](#foobarboxednumber) + +sealed interface that stores validated payloads using boxed classes + +## FoobarBoxedNumber +data class FoobarBoxedNumber
    +implements [FoobarBoxed](#foobarboxed) + +data class that stores validated Number payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| FoobarBoxedNumber(Number data)
    Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| Number | data()
    validated payload | +| Any? | getData()
    validated payload | + +## Foobar +class Foobar
    +extends NumberJsonSchema.NumberJsonSchema1 + +A schema class that validates payloads + +| Methods Inherited from class org.openapijsonschematools.client.schemas.NumberJsonSchema.NumberJsonSchema1 | +| ------------------------------------------------------------------ | +| validate | +| validateAndBox | + +## FoonbarBoxed +sealed interface FoonbarBoxed
    +permits
    +[FoonbarBoxedNumber](#foonbarboxednumber) + +sealed interface that stores validated payloads using boxed classes + +## FoonbarBoxedNumber +data class FoonbarBoxedNumber
    +implements [FoonbarBoxed](#foonbarboxed) + +data class that stores validated Number payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| FoonbarBoxedNumber(Number data)
    Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| Number | data()
    validated payload | +| Any? | getData()
    validated payload | + +## Foonbar +class Foonbar
    +extends NumberJsonSchema.NumberJsonSchema1 + +A schema class that validates payloads + +| Methods Inherited from class org.openapijsonschematools.client.schemas.NumberJsonSchema.NumberJsonSchema1 | +| ------------------------------------------------------------------ | +| validate | +| validateAndBox | + +[[Back to top]](#top) [[Back to Component Schemas]](../../../README.md#Component-Schemas) [[Back to README]](../../../README.md) diff --git a/samples/client/3_1_0_unit_test/kotlin/docs/components/schemas/PropertiesWithNullValuedInstanceProperties.md b/samples/client/3_1_0_unit_test/kotlin/docs/components/schemas/PropertiesWithNullValuedInstanceProperties.md new file mode 100644 index 00000000000..5e0d69eee7d --- /dev/null +++ b/samples/client/3_1_0_unit_test/kotlin/docs/components/schemas/PropertiesWithNullValuedInstanceProperties.md @@ -0,0 +1,250 @@ +# PropertiesWithNullValuedInstanceProperties +org.openapijsonschematools.client.components.schemas.PropertiesWithNullValuedInstanceProperties.java +class PropertiesWithNullValuedInstanceProperties
    + +A class that contains necessary nested +- schema classes (which validate payloads), extends JsonSchema +- sealed interfaces which store validated payloads, Kotlin version of a sum type +- boxed classes which store validated payloads, sealed permits class implementations +- classes to store validated map payloads, extends FrozenMap +- classes to build inputs for map payloads + +## Nested Class Summary +| Modifier and Type | Class and Description | +| ----------------- | ---------------------- | +| sealed interface | [PropertiesWithNullValuedInstanceProperties.PropertiesWithNullValuedInstanceProperties1Boxed](#propertieswithnullvaluedinstanceproperties1boxed)
    sealed interface for validated payloads | +| record | [PropertiesWithNullValuedInstanceProperties.PropertiesWithNullValuedInstanceProperties1BoxedVoid](#propertieswithnullvaluedinstanceproperties1boxedvoid)
    boxed class to store validated null payloads | +| record | [PropertiesWithNullValuedInstanceProperties.PropertiesWithNullValuedInstanceProperties1BoxedBoolean](#propertieswithnullvaluedinstanceproperties1boxedboolean)
    boxed class to store validated boolean payloads | +| record | [PropertiesWithNullValuedInstanceProperties.PropertiesWithNullValuedInstanceProperties1BoxedNumber](#propertieswithnullvaluedinstanceproperties1boxednumber)
    boxed class to store validated Number payloads | +| record | [PropertiesWithNullValuedInstanceProperties.PropertiesWithNullValuedInstanceProperties1BoxedString](#propertieswithnullvaluedinstanceproperties1boxedstring)
    boxed class to store validated String payloads | +| record | [PropertiesWithNullValuedInstanceProperties.PropertiesWithNullValuedInstanceProperties1BoxedList](#propertieswithnullvaluedinstanceproperties1boxedlist)
    boxed class to store validated List payloads | +| record | [PropertiesWithNullValuedInstanceProperties.PropertiesWithNullValuedInstanceProperties1BoxedMap](#propertieswithnullvaluedinstanceproperties1boxedmap)
    boxed class to store validated Map payloads | +| static class | [PropertiesWithNullValuedInstanceProperties.PropertiesWithNullValuedInstanceProperties1](#propertieswithnullvaluedinstanceproperties1)
    schema class | +| static class | [PropertiesWithNullValuedInstanceProperties.PropertiesWithNullValuedInstancePropertiesMapBuilder](#propertieswithnullvaluedinstancepropertiesmapbuilder)
    builder for Map payloads | +| static class | [PropertiesWithNullValuedInstanceProperties.PropertiesWithNullValuedInstancePropertiesMap](#propertieswithnullvaluedinstancepropertiesmap)
    output class for Map payloads | +| sealed interface | [PropertiesWithNullValuedInstanceProperties.FooBoxed](#fooboxed)
    sealed interface for validated payloads | +| record | [PropertiesWithNullValuedInstanceProperties.FooBoxedVoid](#fooboxedvoid)
    boxed class to store validated null payloads | +| static class | [PropertiesWithNullValuedInstanceProperties.Foo](#foo)
    schema class | + +## PropertiesWithNullValuedInstanceProperties1Boxed +sealed interface PropertiesWithNullValuedInstanceProperties1Boxed
    +permits
    +[PropertiesWithNullValuedInstanceProperties1BoxedVoid](#propertieswithnullvaluedinstanceproperties1boxedvoid), +[PropertiesWithNullValuedInstanceProperties1BoxedBoolean](#propertieswithnullvaluedinstanceproperties1boxedboolean), +[PropertiesWithNullValuedInstanceProperties1BoxedNumber](#propertieswithnullvaluedinstanceproperties1boxednumber), +[PropertiesWithNullValuedInstanceProperties1BoxedString](#propertieswithnullvaluedinstanceproperties1boxedstring), +[PropertiesWithNullValuedInstanceProperties1BoxedList](#propertieswithnullvaluedinstanceproperties1boxedlist), +[PropertiesWithNullValuedInstanceProperties1BoxedMap](#propertieswithnullvaluedinstanceproperties1boxedmap) + +sealed interface that stores validated payloads using boxed classes + +## PropertiesWithNullValuedInstanceProperties1BoxedVoid +data class PropertiesWithNullValuedInstanceProperties1BoxedVoid
    +implements [PropertiesWithNullValuedInstanceProperties1Boxed](#propertieswithnullvaluedinstanceproperties1boxed) + +data class that stores validated null payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| PropertiesWithNullValuedInstanceProperties1BoxedVoid(Nothing? data)
    Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| Nothing? | data()
    validated payload | +| Any? | getData()
    validated payload | + +## PropertiesWithNullValuedInstanceProperties1BoxedBoolean +data class PropertiesWithNullValuedInstanceProperties1BoxedBoolean
    +implements [PropertiesWithNullValuedInstanceProperties1Boxed](#propertieswithnullvaluedinstanceproperties1boxed) + +record that stores validated boolean payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| PropertiesWithNullValuedInstanceProperties1BoxedBoolean(boolean data)
    Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| boolean | data()
    validated payload | +| Any? | getData()
    validated payload | + +## PropertiesWithNullValuedInstanceProperties1BoxedNumber +data class PropertiesWithNullValuedInstanceProperties1BoxedNumber
    +implements [PropertiesWithNullValuedInstanceProperties1Boxed](#propertieswithnullvaluedinstanceproperties1boxed) + +data class that stores validated Number payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| PropertiesWithNullValuedInstanceProperties1BoxedNumber(Number data)
    Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| Number | data()
    validated payload | +| Any? | getData()
    validated payload | + +## PropertiesWithNullValuedInstanceProperties1BoxedString +data class PropertiesWithNullValuedInstanceProperties1BoxedString
    +implements [PropertiesWithNullValuedInstanceProperties1Boxed](#propertieswithnullvaluedinstanceproperties1boxed) + +data class that stores validated String payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| PropertiesWithNullValuedInstanceProperties1BoxedString(String data)
    Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| String | data()
    validated payload | +| Any? | getData()
    validated payload | + +## PropertiesWithNullValuedInstanceProperties1BoxedList +data class PropertiesWithNullValuedInstanceProperties1BoxedList
    +implements [PropertiesWithNullValuedInstanceProperties1Boxed](#propertieswithnullvaluedinstanceproperties1boxed) + +data class that stores validated List payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| PropertiesWithNullValuedInstanceProperties1BoxedList(FrozenList data)
    Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| FrozenList | data()
    validated payload | +| Any? | getData()
    validated payload | + +## PropertiesWithNullValuedInstanceProperties1BoxedMap +data class PropertiesWithNullValuedInstanceProperties1BoxedMap
    +implements [PropertiesWithNullValuedInstanceProperties1Boxed](#propertieswithnullvaluedinstanceproperties1boxed) + +data class that stores validated Map payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| PropertiesWithNullValuedInstanceProperties1BoxedMap([PropertiesWithNullValuedInstancePropertiesMap](#propertieswithnullvaluedinstancepropertiesmap) data)
    Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| [PropertiesWithNullValuedInstancePropertiesMap](#propertieswithnullvaluedinstancepropertiesmap) | data()
    validated payload | +| Any? | getData()
    validated payload | + +## PropertiesWithNullValuedInstanceProperties1 +class PropertiesWithNullValuedInstanceProperties1
    +extends JsonSchema + +A schema class that validates payloads + +### Field Summary +| Modifier and Type | Field and Description | +| ----------------- | ---------------------- | +| Map> | properties = mapOf(
        "foo" to [Foo::class.java](#foo))
    )
    | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| String | validate(arg: String, configuration: SchemaConfiguration) | +| Nothing? | validate(arg: Nothing?, configuration: SchemaConfiguration) | +| int | validate(arg: int, configuration: SchemaConfiguration) | +| long | validate(arg: long, configuration: SchemaConfiguration) | +| float | validate(arg: float, configuration: SchemaConfiguration) | +| double | validate(arg: double, configuration: SchemaConfiguration) | +| Number | validate(arg: Number, configuration: SchemaConfiguration) | +| boolean | validate(arg: boolean, configuration: SchemaConfiguration) | +| [PropertiesWithNullValuedInstancePropertiesMap](#propertieswithnullvaluedinstancepropertiesmap) | validate(arg: [Map<?, ?>](#propertieswithnullvaluedinstancepropertiesmapbuilder), configuration: SchemaConfiguration) | +| FrozenList | validate(arg: List<*>, configuration: SchemaConfiguration) | +| [PropertiesWithNullValuedInstanceProperties1BoxedString](#propertieswithnullvaluedinstanceproperties1boxedstring) | validateAndBox(String, configuration: SchemaConfiguration) | +| [PropertiesWithNullValuedInstanceProperties1BoxedVoid](#propertieswithnullvaluedinstanceproperties1boxedvoid) | validateAndBox(Nothing?, configuration: SchemaConfiguration) | +| [PropertiesWithNullValuedInstanceProperties1BoxedNumber](#propertieswithnullvaluedinstanceproperties1boxednumber) | validateAndBox(Number, configuration: SchemaConfiguration) | +| [PropertiesWithNullValuedInstanceProperties1BoxedBoolean](#propertieswithnullvaluedinstanceproperties1boxedboolean) | validateAndBox(boolean, configuration: SchemaConfiguration) | +| [PropertiesWithNullValuedInstanceProperties1BoxedMap](#propertieswithnullvaluedinstanceproperties1boxedmap) | validateAndBox([Map<?, ?>](#propertieswithnullvaluedinstancepropertiesmapbuilder), configuration: SchemaConfiguration) | +| [PropertiesWithNullValuedInstanceProperties1BoxedList](#propertieswithnullvaluedinstanceproperties1boxedlist) | validateAndBox(List<*>, configuration: SchemaConfiguration) | +| [PropertiesWithNullValuedInstanceProperties1Boxed](#propertieswithnullvaluedinstanceproperties1boxed) | validateAndBox(Any?, configuration: SchemaConfiguration) | +| Any? | validate(arg: Any?, configuration: SchemaConfiguration) | + +## PropertiesWithNullValuedInstancePropertiesMapBuilder +class PropertiesWithNullValuedInstancePropertiesMapBuilder
    +builder for `Map` + +A class that builds the Map input type + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| PropertiesWithNullValuedInstancePropertiesMapBuilder()
    Creates a builder that contains an empty map | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| Map | build()
    Returns map input that should be used with Schema.validate | +| [PropertiesWithNullValuedInstancePropertiesMapBuilder](#propertieswithnullvaluedinstancepropertiesmapbuilder) | foo(value: Nothing?) | +| [PropertiesWithNullValuedInstancePropertiesMapBuilder](#propertieswithnullvaluedinstancepropertiesmapbuilder) | additionalProperty(key: String, value: Nothing?) | +| [PropertiesWithNullValuedInstancePropertiesMapBuilder](#propertieswithnullvaluedinstancepropertiesmapbuilder) | additionalProperty(key: String, value: Boolean) | +| [PropertiesWithNullValuedInstancePropertiesMapBuilder](#propertieswithnullvaluedinstancepropertiesmapbuilder) | additionalProperty(key: String, value: String) | +| [PropertiesWithNullValuedInstancePropertiesMapBuilder](#propertieswithnullvaluedinstancepropertiesmapbuilder) | additionalProperty(key: String, value: Int) | +| [PropertiesWithNullValuedInstancePropertiesMapBuilder](#propertieswithnullvaluedinstancepropertiesmapbuilder) | additionalProperty(key: String, value: Float) | +| [PropertiesWithNullValuedInstancePropertiesMapBuilder](#propertieswithnullvaluedinstancepropertiesmapbuilder) | additionalProperty(key: String, value: Long) | +| [PropertiesWithNullValuedInstancePropertiesMapBuilder](#propertieswithnullvaluedinstancepropertiesmapbuilder) | additionalProperty(key: String, value: Double) | +| [PropertiesWithNullValuedInstancePropertiesMapBuilder](#propertieswithnullvaluedinstancepropertiesmapbuilder) | additionalProperty(key: String, value: List) | +| [PropertiesWithNullValuedInstancePropertiesMapBuilder](#propertieswithnullvaluedinstancepropertiesmapbuilder) | additionalProperty(key: String, value: Map) | + +## PropertiesWithNullValuedInstancePropertiesMap +class PropertiesWithNullValuedInstancePropertiesMap
    +extends FrozenMap + +A class to store validated Map payloads + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| static [PropertiesWithNullValuedInstancePropertiesMap](#propertieswithnullvaluedinstancepropertiesmap) | of([Map](#propertieswithnullvaluedinstancepropertiesmapbuilder) arg, SchemaConfiguration configuration) | +| Nothing? | foo()
    [optional] | +| Any? | getAdditionalProperty(String name)
    provides type safety for additional properties | + +## FooBoxed +sealed interface FooBoxed
    +permits
    +[FooBoxedVoid](#fooboxedvoid) + +sealed interface that stores validated payloads using boxed classes + +## FooBoxedVoid +data class FooBoxedVoid
    +implements [FooBoxed](#fooboxed) + +data class that stores validated null payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| FooBoxedVoid(Nothing? data)
    Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| Nothing? | data()
    validated payload | +| Any? | getData()
    validated payload | + +## Foo +class Foo
    +extends NullJsonSchema.NullJsonSchema1 + +A schema class that validates payloads + +| Methods Inherited from class org.openapijsonschematools.client.schemas.NullJsonSchema.NullJsonSchema1 | +| ------------------------------------------------------------------ | +| validate | +| validateAndBox | + +[[Back to top]](#top) [[Back to Component Schemas]](../../../README.md#Component-Schemas) [[Back to README]](../../../README.md) diff --git a/samples/client/3_1_0_unit_test/kotlin/docs/components/schemas/PropertyNamedRefThatIsNotAReference.md b/samples/client/3_1_0_unit_test/kotlin/docs/components/schemas/PropertyNamedRefThatIsNotAReference.md new file mode 100644 index 00000000000..9a3d24c717a --- /dev/null +++ b/samples/client/3_1_0_unit_test/kotlin/docs/components/schemas/PropertyNamedRefThatIsNotAReference.md @@ -0,0 +1,250 @@ +# PropertyNamedRefThatIsNotAReference +org.openapijsonschematools.client.components.schemas.PropertyNamedRefThatIsNotAReference.java +class PropertyNamedRefThatIsNotAReference
    + +A class that contains necessary nested +- schema classes (which validate payloads), extends JsonSchema +- sealed interfaces which store validated payloads, Kotlin version of a sum type +- boxed classes which store validated payloads, sealed permits class implementations +- classes to store validated map payloads, extends FrozenMap +- classes to build inputs for map payloads + +## Nested Class Summary +| Modifier and Type | Class and Description | +| ----------------- | ---------------------- | +| sealed interface | [PropertyNamedRefThatIsNotAReference.PropertyNamedRefThatIsNotAReference1Boxed](#propertynamedrefthatisnotareference1boxed)
    sealed interface for validated payloads | +| record | [PropertyNamedRefThatIsNotAReference.PropertyNamedRefThatIsNotAReference1BoxedVoid](#propertynamedrefthatisnotareference1boxedvoid)
    boxed class to store validated null payloads | +| record | [PropertyNamedRefThatIsNotAReference.PropertyNamedRefThatIsNotAReference1BoxedBoolean](#propertynamedrefthatisnotareference1boxedboolean)
    boxed class to store validated boolean payloads | +| record | [PropertyNamedRefThatIsNotAReference.PropertyNamedRefThatIsNotAReference1BoxedNumber](#propertynamedrefthatisnotareference1boxednumber)
    boxed class to store validated Number payloads | +| record | [PropertyNamedRefThatIsNotAReference.PropertyNamedRefThatIsNotAReference1BoxedString](#propertynamedrefthatisnotareference1boxedstring)
    boxed class to store validated String payloads | +| record | [PropertyNamedRefThatIsNotAReference.PropertyNamedRefThatIsNotAReference1BoxedList](#propertynamedrefthatisnotareference1boxedlist)
    boxed class to store validated List payloads | +| record | [PropertyNamedRefThatIsNotAReference.PropertyNamedRefThatIsNotAReference1BoxedMap](#propertynamedrefthatisnotareference1boxedmap)
    boxed class to store validated Map payloads | +| static class | [PropertyNamedRefThatIsNotAReference.PropertyNamedRefThatIsNotAReference1](#propertynamedrefthatisnotareference1)
    schema class | +| static class | [PropertyNamedRefThatIsNotAReference.PropertyNamedRefThatIsNotAReferenceMapBuilder](#propertynamedrefthatisnotareferencemapbuilder)
    builder for Map payloads | +| static class | [PropertyNamedRefThatIsNotAReference.PropertyNamedRefThatIsNotAReferenceMap](#propertynamedrefthatisnotareferencemap)
    output class for Map payloads | +| sealed interface | [PropertyNamedRefThatIsNotAReference.RefBoxed](#refboxed)
    sealed interface for validated payloads | +| record | [PropertyNamedRefThatIsNotAReference.RefBoxedString](#refboxedstring)
    boxed class to store validated String payloads | +| static class | [PropertyNamedRefThatIsNotAReference.Ref](#ref)
    schema class | + +## PropertyNamedRefThatIsNotAReference1Boxed +sealed interface PropertyNamedRefThatIsNotAReference1Boxed
    +permits
    +[PropertyNamedRefThatIsNotAReference1BoxedVoid](#propertynamedrefthatisnotareference1boxedvoid), +[PropertyNamedRefThatIsNotAReference1BoxedBoolean](#propertynamedrefthatisnotareference1boxedboolean), +[PropertyNamedRefThatIsNotAReference1BoxedNumber](#propertynamedrefthatisnotareference1boxednumber), +[PropertyNamedRefThatIsNotAReference1BoxedString](#propertynamedrefthatisnotareference1boxedstring), +[PropertyNamedRefThatIsNotAReference1BoxedList](#propertynamedrefthatisnotareference1boxedlist), +[PropertyNamedRefThatIsNotAReference1BoxedMap](#propertynamedrefthatisnotareference1boxedmap) + +sealed interface that stores validated payloads using boxed classes + +## PropertyNamedRefThatIsNotAReference1BoxedVoid +data class PropertyNamedRefThatIsNotAReference1BoxedVoid
    +implements [PropertyNamedRefThatIsNotAReference1Boxed](#propertynamedrefthatisnotareference1boxed) + +data class that stores validated null payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| PropertyNamedRefThatIsNotAReference1BoxedVoid(Nothing? data)
    Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| Nothing? | data()
    validated payload | +| Any? | getData()
    validated payload | + +## PropertyNamedRefThatIsNotAReference1BoxedBoolean +data class PropertyNamedRefThatIsNotAReference1BoxedBoolean
    +implements [PropertyNamedRefThatIsNotAReference1Boxed](#propertynamedrefthatisnotareference1boxed) + +record that stores validated boolean payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| PropertyNamedRefThatIsNotAReference1BoxedBoolean(boolean data)
    Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| boolean | data()
    validated payload | +| Any? | getData()
    validated payload | + +## PropertyNamedRefThatIsNotAReference1BoxedNumber +data class PropertyNamedRefThatIsNotAReference1BoxedNumber
    +implements [PropertyNamedRefThatIsNotAReference1Boxed](#propertynamedrefthatisnotareference1boxed) + +data class that stores validated Number payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| PropertyNamedRefThatIsNotAReference1BoxedNumber(Number data)
    Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| Number | data()
    validated payload | +| Any? | getData()
    validated payload | + +## PropertyNamedRefThatIsNotAReference1BoxedString +data class PropertyNamedRefThatIsNotAReference1BoxedString
    +implements [PropertyNamedRefThatIsNotAReference1Boxed](#propertynamedrefthatisnotareference1boxed) + +data class that stores validated String payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| PropertyNamedRefThatIsNotAReference1BoxedString(String data)
    Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| String | data()
    validated payload | +| Any? | getData()
    validated payload | + +## PropertyNamedRefThatIsNotAReference1BoxedList +data class PropertyNamedRefThatIsNotAReference1BoxedList
    +implements [PropertyNamedRefThatIsNotAReference1Boxed](#propertynamedrefthatisnotareference1boxed) + +data class that stores validated List payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| PropertyNamedRefThatIsNotAReference1BoxedList(FrozenList data)
    Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| FrozenList | data()
    validated payload | +| Any? | getData()
    validated payload | + +## PropertyNamedRefThatIsNotAReference1BoxedMap +data class PropertyNamedRefThatIsNotAReference1BoxedMap
    +implements [PropertyNamedRefThatIsNotAReference1Boxed](#propertynamedrefthatisnotareference1boxed) + +data class that stores validated Map payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| PropertyNamedRefThatIsNotAReference1BoxedMap([PropertyNamedRefThatIsNotAReferenceMap](#propertynamedrefthatisnotareferencemap) data)
    Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| [PropertyNamedRefThatIsNotAReferenceMap](#propertynamedrefthatisnotareferencemap) | data()
    validated payload | +| Any? | getData()
    validated payload | + +## PropertyNamedRefThatIsNotAReference1 +class PropertyNamedRefThatIsNotAReference1
    +extends JsonSchema + +A schema class that validates payloads + +### Field Summary +| Modifier and Type | Field and Description | +| ----------------- | ---------------------- | +| Map> | properties = mapOf(
        "\$ref" to [Ref::class.java](#ref))
    )
    | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| String | validate(arg: String, configuration: SchemaConfiguration) | +| Nothing? | validate(arg: Nothing?, configuration: SchemaConfiguration) | +| int | validate(arg: int, configuration: SchemaConfiguration) | +| long | validate(arg: long, configuration: SchemaConfiguration) | +| float | validate(arg: float, configuration: SchemaConfiguration) | +| double | validate(arg: double, configuration: SchemaConfiguration) | +| Number | validate(arg: Number, configuration: SchemaConfiguration) | +| boolean | validate(arg: boolean, configuration: SchemaConfiguration) | +| [PropertyNamedRefThatIsNotAReferenceMap](#propertynamedrefthatisnotareferencemap) | validate(arg: [Map<?, ?>](#propertynamedrefthatisnotareferencemapbuilder), configuration: SchemaConfiguration) | +| FrozenList | validate(arg: List<*>, configuration: SchemaConfiguration) | +| [PropertyNamedRefThatIsNotAReference1BoxedString](#propertynamedrefthatisnotareference1boxedstring) | validateAndBox(String, configuration: SchemaConfiguration) | +| [PropertyNamedRefThatIsNotAReference1BoxedVoid](#propertynamedrefthatisnotareference1boxedvoid) | validateAndBox(Nothing?, configuration: SchemaConfiguration) | +| [PropertyNamedRefThatIsNotAReference1BoxedNumber](#propertynamedrefthatisnotareference1boxednumber) | validateAndBox(Number, configuration: SchemaConfiguration) | +| [PropertyNamedRefThatIsNotAReference1BoxedBoolean](#propertynamedrefthatisnotareference1boxedboolean) | validateAndBox(boolean, configuration: SchemaConfiguration) | +| [PropertyNamedRefThatIsNotAReference1BoxedMap](#propertynamedrefthatisnotareference1boxedmap) | validateAndBox([Map<?, ?>](#propertynamedrefthatisnotareferencemapbuilder), configuration: SchemaConfiguration) | +| [PropertyNamedRefThatIsNotAReference1BoxedList](#propertynamedrefthatisnotareference1boxedlist) | validateAndBox(List<*>, configuration: SchemaConfiguration) | +| [PropertyNamedRefThatIsNotAReference1Boxed](#propertynamedrefthatisnotareference1boxed) | validateAndBox(Any?, configuration: SchemaConfiguration) | +| Any? | validate(arg: Any?, configuration: SchemaConfiguration) | + +## PropertyNamedRefThatIsNotAReferenceMapBuilder +class PropertyNamedRefThatIsNotAReferenceMapBuilder
    +builder for `Map` + +A class that builds the Map input type + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| PropertyNamedRefThatIsNotAReferenceMapBuilder()
    Creates a builder that contains an empty map | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| Map | build()
    Returns map input that should be used with Schema.validate | +| [PropertyNamedRefThatIsNotAReferenceMapBuilder](#propertynamedrefthatisnotareferencemapbuilder) | reverseSolidusDollarSignRef(value: String) | +| [PropertyNamedRefThatIsNotAReferenceMapBuilder](#propertynamedrefthatisnotareferencemapbuilder) | additionalProperty(key: String, value: Nothing?) | +| [PropertyNamedRefThatIsNotAReferenceMapBuilder](#propertynamedrefthatisnotareferencemapbuilder) | additionalProperty(key: String, value: Boolean) | +| [PropertyNamedRefThatIsNotAReferenceMapBuilder](#propertynamedrefthatisnotareferencemapbuilder) | additionalProperty(key: String, value: String) | +| [PropertyNamedRefThatIsNotAReferenceMapBuilder](#propertynamedrefthatisnotareferencemapbuilder) | additionalProperty(key: String, value: Int) | +| [PropertyNamedRefThatIsNotAReferenceMapBuilder](#propertynamedrefthatisnotareferencemapbuilder) | additionalProperty(key: String, value: Float) | +| [PropertyNamedRefThatIsNotAReferenceMapBuilder](#propertynamedrefthatisnotareferencemapbuilder) | additionalProperty(key: String, value: Long) | +| [PropertyNamedRefThatIsNotAReferenceMapBuilder](#propertynamedrefthatisnotareferencemapbuilder) | additionalProperty(key: String, value: Double) | +| [PropertyNamedRefThatIsNotAReferenceMapBuilder](#propertynamedrefthatisnotareferencemapbuilder) | additionalProperty(key: String, value: List) | +| [PropertyNamedRefThatIsNotAReferenceMapBuilder](#propertynamedrefthatisnotareferencemapbuilder) | additionalProperty(key: String, value: Map) | + +## PropertyNamedRefThatIsNotAReferenceMap +class PropertyNamedRefThatIsNotAReferenceMap
    +extends FrozenMap + +A class to store validated Map payloads + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| static [PropertyNamedRefThatIsNotAReferenceMap](#propertynamedrefthatisnotareferencemap) | of([Map](#propertynamedrefthatisnotareferencemapbuilder) arg, SchemaConfiguration configuration) | +| Any? | get(String key)
    This schema has invalid Kotlin names so this method must be used when you access instance["\$ref"], | +| Any? | getAdditionalProperty(String name)
    provides type safety for additional properties | + +## RefBoxed +sealed interface RefBoxed
    +permits
    +[RefBoxedString](#refboxedstring) + +sealed interface that stores validated payloads using boxed classes + +## RefBoxedString +data class RefBoxedString
    +implements [RefBoxed](#refboxed) + +data class that stores validated String payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| RefBoxedString(String data)
    Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| String | data()
    validated payload | +| Any? | getData()
    validated payload | + +## Ref +class Ref
    +extends StringJsonSchema.StringJsonSchema1 + +A schema class that validates payloads + +| Methods Inherited from class org.openapijsonschematools.client.schemas.StringJsonSchema.StringJsonSchema1 | +| ------------------------------------------------------------------ | +| validate | +| validateAndBox | + +[[Back to top]](#top) [[Back to Component Schemas]](../../../README.md#Component-Schemas) [[Back to README]](../../../README.md) diff --git a/samples/client/3_1_0_unit_test/kotlin/docs/components/schemas/PropertynamesValidation.md b/samples/client/3_1_0_unit_test/kotlin/docs/components/schemas/PropertynamesValidation.md new file mode 100644 index 00000000000..7f91cbf1956 --- /dev/null +++ b/samples/client/3_1_0_unit_test/kotlin/docs/components/schemas/PropertynamesValidation.md @@ -0,0 +1,239 @@ +# PropertynamesValidation +org.openapijsonschematools.client.components.schemas.PropertynamesValidation.java +class PropertynamesValidation
    + +A class that contains necessary nested +- schema classes (which validate payloads), extends JsonSchema +- sealed interfaces which store validated payloads, Kotlin version of a sum type +- boxed classes which store validated payloads, sealed permits class implementations + +## Nested Class Summary +| Modifier and Type | Class and Description | +| ----------------- | ---------------------- | +| sealed interface | [PropertynamesValidation.PropertynamesValidation1Boxed](#propertynamesvalidation1boxed)
    sealed interface for validated payloads | +| record | [PropertynamesValidation.PropertynamesValidation1BoxedVoid](#propertynamesvalidation1boxedvoid)
    boxed class to store validated null payloads | +| record | [PropertynamesValidation.PropertynamesValidation1BoxedBoolean](#propertynamesvalidation1boxedboolean)
    boxed class to store validated boolean payloads | +| record | [PropertynamesValidation.PropertynamesValidation1BoxedNumber](#propertynamesvalidation1boxednumber)
    boxed class to store validated Number payloads | +| record | [PropertynamesValidation.PropertynamesValidation1BoxedString](#propertynamesvalidation1boxedstring)
    boxed class to store validated String payloads | +| record | [PropertynamesValidation.PropertynamesValidation1BoxedList](#propertynamesvalidation1boxedlist)
    boxed class to store validated List payloads | +| record | [PropertynamesValidation.PropertynamesValidation1BoxedMap](#propertynamesvalidation1boxedmap)
    boxed class to store validated Map payloads | +| static class | [PropertynamesValidation.PropertynamesValidation1](#propertynamesvalidation1)
    schema class | +| sealed interface | [PropertynamesValidation.PropertyNamesBoxed](#propertynamesboxed)
    sealed interface for validated payloads | +| record | [PropertynamesValidation.PropertyNamesBoxedString](#propertynamesboxedstring)
    boxed class to store validated String payloads | +| static class | [PropertynamesValidation.PropertyNames](#propertynames)
    schema class | + +## PropertynamesValidation1Boxed +sealed interface PropertynamesValidation1Boxed
    +permits
    +[PropertynamesValidation1BoxedVoid](#propertynamesvalidation1boxedvoid), +[PropertynamesValidation1BoxedBoolean](#propertynamesvalidation1boxedboolean), +[PropertynamesValidation1BoxedNumber](#propertynamesvalidation1boxednumber), +[PropertynamesValidation1BoxedString](#propertynamesvalidation1boxedstring), +[PropertynamesValidation1BoxedList](#propertynamesvalidation1boxedlist), +[PropertynamesValidation1BoxedMap](#propertynamesvalidation1boxedmap) + +sealed interface that stores validated payloads using boxed classes + +## PropertynamesValidation1BoxedVoid +data class PropertynamesValidation1BoxedVoid
    +implements [PropertynamesValidation1Boxed](#propertynamesvalidation1boxed) + +data class that stores validated null payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| PropertynamesValidation1BoxedVoid(Nothing? data)
    Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| Nothing? | data()
    validated payload | +| Any? | getData()
    validated payload | + +## PropertynamesValidation1BoxedBoolean +data class PropertynamesValidation1BoxedBoolean
    +implements [PropertynamesValidation1Boxed](#propertynamesvalidation1boxed) + +record that stores validated boolean payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| PropertynamesValidation1BoxedBoolean(boolean data)
    Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| boolean | data()
    validated payload | +| Any? | getData()
    validated payload | + +## PropertynamesValidation1BoxedNumber +data class PropertynamesValidation1BoxedNumber
    +implements [PropertynamesValidation1Boxed](#propertynamesvalidation1boxed) + +data class that stores validated Number payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| PropertynamesValidation1BoxedNumber(Number data)
    Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| Number | data()
    validated payload | +| Any? | getData()
    validated payload | + +## PropertynamesValidation1BoxedString +data class PropertynamesValidation1BoxedString
    +implements [PropertynamesValidation1Boxed](#propertynamesvalidation1boxed) + +data class that stores validated String payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| PropertynamesValidation1BoxedString(String data)
    Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| String | data()
    validated payload | +| Any? | getData()
    validated payload | + +## PropertynamesValidation1BoxedList +data class PropertynamesValidation1BoxedList
    +implements [PropertynamesValidation1Boxed](#propertynamesvalidation1boxed) + +data class that stores validated List payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| PropertynamesValidation1BoxedList(FrozenList data)
    Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| FrozenList | data()
    validated payload | +| Any? | getData()
    validated payload | + +## PropertynamesValidation1BoxedMap +data class PropertynamesValidation1BoxedMap
    +implements [PropertynamesValidation1Boxed](#propertynamesvalidation1boxed) + +data class that stores validated Map payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| PropertynamesValidation1BoxedMap(FrozenMap data)
    Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| FrozenMap | data()
    validated payload | +| Any? | getData()
    validated payload | + +## PropertynamesValidation1 +class PropertynamesValidation1
    +extends JsonSchema + +A schema class that validates payloads + +### Field Summary +| Modifier and Type | Field and Description | +| ----------------- | ---------------------- | +| Class | propertyNames = [PropertyNames::class.java](#propertynames) | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| String | validate(arg: String, configuration: SchemaConfiguration) | +| Nothing? | validate(arg: Nothing?, configuration: SchemaConfiguration) | +| int | validate(arg: int, configuration: SchemaConfiguration) | +| long | validate(arg: long, configuration: SchemaConfiguration) | +| float | validate(arg: float, configuration: SchemaConfiguration) | +| double | validate(arg: double, configuration: SchemaConfiguration) | +| Number | validate(arg: Number, configuration: SchemaConfiguration) | +| boolean | validate(arg: boolean, configuration: SchemaConfiguration) | +| FrozenMap | validate(arg: Map<?, ?>, configuration: SchemaConfiguration) | +| FrozenList | validate(arg: List<*>, configuration: SchemaConfiguration) | +| [PropertynamesValidation1BoxedString](#propertynamesvalidation1boxedstring) | validateAndBox(String, configuration: SchemaConfiguration) | +| [PropertynamesValidation1BoxedVoid](#propertynamesvalidation1boxedvoid) | validateAndBox(Nothing?, configuration: SchemaConfiguration) | +| [PropertynamesValidation1BoxedNumber](#propertynamesvalidation1boxednumber) | validateAndBox(Number, configuration: SchemaConfiguration) | +| [PropertynamesValidation1BoxedBoolean](#propertynamesvalidation1boxedboolean) | validateAndBox(boolean, configuration: SchemaConfiguration) | +| [PropertynamesValidation1BoxedMap](#propertynamesvalidation1boxedmap) | validateAndBox(Map<?, ?>, configuration: SchemaConfiguration) | +| [PropertynamesValidation1BoxedList](#propertynamesvalidation1boxedlist) | validateAndBox(List<*>, configuration: SchemaConfiguration) | +| [PropertynamesValidation1Boxed](#propertynamesvalidation1boxed) | validateAndBox(Any?, configuration: SchemaConfiguration) | +| Any? | validate(arg: Any?, configuration: SchemaConfiguration) | + +## PropertyNamesBoxed +sealed interface PropertyNamesBoxed
    +permits
    +[PropertyNamesBoxedString](#propertynamesboxedstring) + +sealed interface that stores validated payloads using boxed classes + +## PropertyNamesBoxedString +data class PropertyNamesBoxedString
    +implements [PropertyNamesBoxed](#propertynamesboxed) + +data class that stores validated String payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| PropertyNamesBoxedString(String data)
    Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| String | data()
    validated payload | +| Any? | getData()
    validated payload | + +## PropertyNames +class PropertyNames
    +extends JsonSchema + +A schema class that validates payloads + +### Code Sample +``` +import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags; +import org.openapijsonschematools.client.configurations.SchemaConfiguration; +import org.openapijsonschematools.client.exceptions.ValidationException; +import org.openapijsonschematools.client.schemas.validation.MapUtils; +import org.openapijsonschematools.client.schemas.validation.FrozenList; +import org.openapijsonschematools.client.schemas.validation.FrozenMap; +import org.openapijsonschematools.client.components.schemas.PropertynamesValidation; + +import java.util.Arrays; +import java.util.List; +import java.util.AbstractMap; + +static final SchemaConfiguration configuration = new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().build()); + +// String validation +String validatedPayload = PropertynamesValidation.PropertyNames.validate( + "a", + configuration +); +``` + +### Field Summary +| Modifier and Type | Field and Description | +| ----------------- | ---------------------- | +| Set> | type = setOf(
        String::class.java
    )
    | +| Integer | maxLength = 3 | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| String | validate(arg: String, configuration: SchemaConfiguration) | +| [PropertyNamesBoxedString](#propertynamesboxedstring) | validateAndBox(String, configuration: SchemaConfiguration) | +| [PropertyNamesBoxed](#propertynamesboxed) | validateAndBox(Any?, configuration: SchemaConfiguration) | +| Any? | validate(arg: Any?, configuration: SchemaConfiguration) | + +[[Back to top]](#top) [[Back to Component Schemas]](../../../README.md#Component-Schemas) [[Back to README]](../../../README.md) diff --git a/samples/client/3_1_0_unit_test/kotlin/docs/components/schemas/RegexFormat.md b/samples/client/3_1_0_unit_test/kotlin/docs/components/schemas/RegexFormat.md new file mode 100644 index 00000000000..7c3bd4263ab --- /dev/null +++ b/samples/client/3_1_0_unit_test/kotlin/docs/components/schemas/RegexFormat.md @@ -0,0 +1,169 @@ +# RegexFormat +org.openapijsonschematools.client.components.schemas.RegexFormat.java +class RegexFormat
    + +A class that contains necessary nested +- schema classes (which validate payloads), extends JsonSchema +- sealed interfaces which store validated payloads, Kotlin version of a sum type +- boxed classes which store validated payloads, sealed permits class implementations + +## Nested Class Summary +| Modifier and Type | Class and Description | +| ----------------- | ---------------------- | +| sealed interface | [RegexFormat.RegexFormat1Boxed](#regexformat1boxed)
    sealed interface for validated payloads | +| record | [RegexFormat.RegexFormat1BoxedVoid](#regexformat1boxedvoid)
    boxed class to store validated null payloads | +| record | [RegexFormat.RegexFormat1BoxedBoolean](#regexformat1boxedboolean)
    boxed class to store validated boolean payloads | +| record | [RegexFormat.RegexFormat1BoxedNumber](#regexformat1boxednumber)
    boxed class to store validated Number payloads | +| record | [RegexFormat.RegexFormat1BoxedString](#regexformat1boxedstring)
    boxed class to store validated String payloads | +| record | [RegexFormat.RegexFormat1BoxedList](#regexformat1boxedlist)
    boxed class to store validated List payloads | +| record | [RegexFormat.RegexFormat1BoxedMap](#regexformat1boxedmap)
    boxed class to store validated Map payloads | +| static class | [RegexFormat.RegexFormat1](#regexformat1)
    schema class | + +## RegexFormat1Boxed +sealed interface RegexFormat1Boxed
    +permits
    +[RegexFormat1BoxedVoid](#regexformat1boxedvoid), +[RegexFormat1BoxedBoolean](#regexformat1boxedboolean), +[RegexFormat1BoxedNumber](#regexformat1boxednumber), +[RegexFormat1BoxedString](#regexformat1boxedstring), +[RegexFormat1BoxedList](#regexformat1boxedlist), +[RegexFormat1BoxedMap](#regexformat1boxedmap) + +sealed interface that stores validated payloads using boxed classes + +## RegexFormat1BoxedVoid +data class RegexFormat1BoxedVoid
    +implements [RegexFormat1Boxed](#regexformat1boxed) + +data class that stores validated null payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| RegexFormat1BoxedVoid(Nothing? data)
    Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| Nothing? | data()
    validated payload | +| Any? | getData()
    validated payload | + +## RegexFormat1BoxedBoolean +data class RegexFormat1BoxedBoolean
    +implements [RegexFormat1Boxed](#regexformat1boxed) + +record that stores validated boolean payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| RegexFormat1BoxedBoolean(boolean data)
    Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| boolean | data()
    validated payload | +| Any? | getData()
    validated payload | + +## RegexFormat1BoxedNumber +data class RegexFormat1BoxedNumber
    +implements [RegexFormat1Boxed](#regexformat1boxed) + +data class that stores validated Number payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| RegexFormat1BoxedNumber(Number data)
    Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| Number | data()
    validated payload | +| Any? | getData()
    validated payload | + +## RegexFormat1BoxedString +data class RegexFormat1BoxedString
    +implements [RegexFormat1Boxed](#regexformat1boxed) + +data class that stores validated String payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| RegexFormat1BoxedString(String data)
    Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| String | data()
    validated payload | +| Any? | getData()
    validated payload | + +## RegexFormat1BoxedList +data class RegexFormat1BoxedList
    +implements [RegexFormat1Boxed](#regexformat1boxed) + +data class that stores validated List payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| RegexFormat1BoxedList(FrozenList data)
    Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| FrozenList | data()
    validated payload | +| Any? | getData()
    validated payload | + +## RegexFormat1BoxedMap +data class RegexFormat1BoxedMap
    +implements [RegexFormat1Boxed](#regexformat1boxed) + +data class that stores validated Map payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| RegexFormat1BoxedMap(FrozenMap data)
    Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| FrozenMap | data()
    validated payload | +| Any? | getData()
    validated payload | + +## RegexFormat1 +class RegexFormat1
    +extends JsonSchema + +A schema class that validates payloads + +### Field Summary +| Modifier and Type | Field and Description | +| ----------------- | ---------------------- | +| String | type = "regex"; | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| String | validate(arg: String, configuration: SchemaConfiguration) | +| Nothing? | validate(arg: Nothing?, configuration: SchemaConfiguration) | +| int | validate(arg: int, configuration: SchemaConfiguration) | +| long | validate(arg: long, configuration: SchemaConfiguration) | +| float | validate(arg: float, configuration: SchemaConfiguration) | +| double | validate(arg: double, configuration: SchemaConfiguration) | +| Number | validate(arg: Number, configuration: SchemaConfiguration) | +| boolean | validate(arg: boolean, configuration: SchemaConfiguration) | +| FrozenMap | validate(arg: Map<?, ?>, configuration: SchemaConfiguration) | +| FrozenList | validate(arg: List<*>, configuration: SchemaConfiguration) | +| [RegexFormat1BoxedString](#regexformat1boxedstring) | validateAndBox(String, configuration: SchemaConfiguration) | +| [RegexFormat1BoxedVoid](#regexformat1boxedvoid) | validateAndBox(Nothing?, configuration: SchemaConfiguration) | +| [RegexFormat1BoxedNumber](#regexformat1boxednumber) | validateAndBox(Number, configuration: SchemaConfiguration) | +| [RegexFormat1BoxedBoolean](#regexformat1boxedboolean) | validateAndBox(boolean, configuration: SchemaConfiguration) | +| [RegexFormat1BoxedMap](#regexformat1boxedmap) | validateAndBox(Map<?, ?>, configuration: SchemaConfiguration) | +| [RegexFormat1BoxedList](#regexformat1boxedlist) | validateAndBox(List<*>, configuration: SchemaConfiguration) | +| [RegexFormat1Boxed](#regexformat1boxed) | validateAndBox(Any?, configuration: SchemaConfiguration) | +| Any? | validate(arg: Any?, configuration: SchemaConfiguration) | + +[[Back to top]](#top) [[Back to Component Schemas]](../../../README.md#Component-Schemas) [[Back to README]](../../../README.md) diff --git a/samples/client/3_1_0_unit_test/kotlin/docs/components/schemas/RegexesAreNotAnchoredByDefaultAndAreCaseSensitive.md b/samples/client/3_1_0_unit_test/kotlin/docs/components/schemas/RegexesAreNotAnchoredByDefaultAndAreCaseSensitive.md new file mode 100644 index 00000000000..12ccda1b765 --- /dev/null +++ b/samples/client/3_1_0_unit_test/kotlin/docs/components/schemas/RegexesAreNotAnchoredByDefaultAndAreCaseSensitive.md @@ -0,0 +1,245 @@ +# RegexesAreNotAnchoredByDefaultAndAreCaseSensitive +org.openapijsonschematools.client.components.schemas.RegexesAreNotAnchoredByDefaultAndAreCaseSensitive.java +class RegexesAreNotAnchoredByDefaultAndAreCaseSensitive
    + +A class that contains necessary nested +- schema classes (which validate payloads), extends JsonSchema +- sealed interfaces which store validated payloads, Kotlin version of a sum type +- boxed classes which store validated payloads, sealed permits class implementations + +## Nested Class Summary +| Modifier and Type | Class and Description | +| ----------------- | ---------------------- | +| sealed interface | [RegexesAreNotAnchoredByDefaultAndAreCaseSensitive.RegexesAreNotAnchoredByDefaultAndAreCaseSensitive1Boxed](#regexesarenotanchoredbydefaultandarecasesensitive1boxed)
    sealed interface for validated payloads | +| record | [RegexesAreNotAnchoredByDefaultAndAreCaseSensitive.RegexesAreNotAnchoredByDefaultAndAreCaseSensitive1BoxedVoid](#regexesarenotanchoredbydefaultandarecasesensitive1boxedvoid)
    boxed class to store validated null payloads | +| record | [RegexesAreNotAnchoredByDefaultAndAreCaseSensitive.RegexesAreNotAnchoredByDefaultAndAreCaseSensitive1BoxedBoolean](#regexesarenotanchoredbydefaultandarecasesensitive1boxedboolean)
    boxed class to store validated boolean payloads | +| record | [RegexesAreNotAnchoredByDefaultAndAreCaseSensitive.RegexesAreNotAnchoredByDefaultAndAreCaseSensitive1BoxedNumber](#regexesarenotanchoredbydefaultandarecasesensitive1boxednumber)
    boxed class to store validated Number payloads | +| record | [RegexesAreNotAnchoredByDefaultAndAreCaseSensitive.RegexesAreNotAnchoredByDefaultAndAreCaseSensitive1BoxedString](#regexesarenotanchoredbydefaultandarecasesensitive1boxedstring)
    boxed class to store validated String payloads | +| record | [RegexesAreNotAnchoredByDefaultAndAreCaseSensitive.RegexesAreNotAnchoredByDefaultAndAreCaseSensitive1BoxedList](#regexesarenotanchoredbydefaultandarecasesensitive1boxedlist)
    boxed class to store validated List payloads | +| record | [RegexesAreNotAnchoredByDefaultAndAreCaseSensitive.RegexesAreNotAnchoredByDefaultAndAreCaseSensitive1BoxedMap](#regexesarenotanchoredbydefaultandarecasesensitive1boxedmap)
    boxed class to store validated Map payloads | +| static class | [RegexesAreNotAnchoredByDefaultAndAreCaseSensitive.RegexesAreNotAnchoredByDefaultAndAreCaseSensitive1](#regexesarenotanchoredbydefaultandarecasesensitive1)
    schema class | +| sealed interface | [RegexesAreNotAnchoredByDefaultAndAreCaseSensitive.XBoxed](#xboxed)
    sealed interface for validated payloads | +| record | [RegexesAreNotAnchoredByDefaultAndAreCaseSensitive.XBoxedString](#xboxedstring)
    boxed class to store validated String payloads | +| static class | [RegexesAreNotAnchoredByDefaultAndAreCaseSensitive.X](#x)
    schema class | +| sealed interface | [RegexesAreNotAnchoredByDefaultAndAreCaseSensitive.Schema092Boxed](#schema092boxed)
    sealed interface for validated payloads | +| record | [RegexesAreNotAnchoredByDefaultAndAreCaseSensitive.Schema092BoxedBoolean](#schema092boxedboolean)
    boxed class to store validated boolean payloads | +| static class | [RegexesAreNotAnchoredByDefaultAndAreCaseSensitive.Schema092](#schema092)
    schema class | + +## RegexesAreNotAnchoredByDefaultAndAreCaseSensitive1Boxed +sealed interface RegexesAreNotAnchoredByDefaultAndAreCaseSensitive1Boxed
    +permits
    +[RegexesAreNotAnchoredByDefaultAndAreCaseSensitive1BoxedVoid](#regexesarenotanchoredbydefaultandarecasesensitive1boxedvoid), +[RegexesAreNotAnchoredByDefaultAndAreCaseSensitive1BoxedBoolean](#regexesarenotanchoredbydefaultandarecasesensitive1boxedboolean), +[RegexesAreNotAnchoredByDefaultAndAreCaseSensitive1BoxedNumber](#regexesarenotanchoredbydefaultandarecasesensitive1boxednumber), +[RegexesAreNotAnchoredByDefaultAndAreCaseSensitive1BoxedString](#regexesarenotanchoredbydefaultandarecasesensitive1boxedstring), +[RegexesAreNotAnchoredByDefaultAndAreCaseSensitive1BoxedList](#regexesarenotanchoredbydefaultandarecasesensitive1boxedlist), +[RegexesAreNotAnchoredByDefaultAndAreCaseSensitive1BoxedMap](#regexesarenotanchoredbydefaultandarecasesensitive1boxedmap) + +sealed interface that stores validated payloads using boxed classes + +## RegexesAreNotAnchoredByDefaultAndAreCaseSensitive1BoxedVoid +data class RegexesAreNotAnchoredByDefaultAndAreCaseSensitive1BoxedVoid
    +implements [RegexesAreNotAnchoredByDefaultAndAreCaseSensitive1Boxed](#regexesarenotanchoredbydefaultandarecasesensitive1boxed) + +data class that stores validated null payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| RegexesAreNotAnchoredByDefaultAndAreCaseSensitive1BoxedVoid(Nothing? data)
    Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| Nothing? | data()
    validated payload | +| Any? | getData()
    validated payload | + +## RegexesAreNotAnchoredByDefaultAndAreCaseSensitive1BoxedBoolean +data class RegexesAreNotAnchoredByDefaultAndAreCaseSensitive1BoxedBoolean
    +implements [RegexesAreNotAnchoredByDefaultAndAreCaseSensitive1Boxed](#regexesarenotanchoredbydefaultandarecasesensitive1boxed) + +record that stores validated boolean payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| RegexesAreNotAnchoredByDefaultAndAreCaseSensitive1BoxedBoolean(boolean data)
    Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| boolean | data()
    validated payload | +| Any? | getData()
    validated payload | + +## RegexesAreNotAnchoredByDefaultAndAreCaseSensitive1BoxedNumber +data class RegexesAreNotAnchoredByDefaultAndAreCaseSensitive1BoxedNumber
    +implements [RegexesAreNotAnchoredByDefaultAndAreCaseSensitive1Boxed](#regexesarenotanchoredbydefaultandarecasesensitive1boxed) + +data class that stores validated Number payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| RegexesAreNotAnchoredByDefaultAndAreCaseSensitive1BoxedNumber(Number data)
    Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| Number | data()
    validated payload | +| Any? | getData()
    validated payload | + +## RegexesAreNotAnchoredByDefaultAndAreCaseSensitive1BoxedString +data class RegexesAreNotAnchoredByDefaultAndAreCaseSensitive1BoxedString
    +implements [RegexesAreNotAnchoredByDefaultAndAreCaseSensitive1Boxed](#regexesarenotanchoredbydefaultandarecasesensitive1boxed) + +data class that stores validated String payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| RegexesAreNotAnchoredByDefaultAndAreCaseSensitive1BoxedString(String data)
    Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| String | data()
    validated payload | +| Any? | getData()
    validated payload | + +## RegexesAreNotAnchoredByDefaultAndAreCaseSensitive1BoxedList +data class RegexesAreNotAnchoredByDefaultAndAreCaseSensitive1BoxedList
    +implements [RegexesAreNotAnchoredByDefaultAndAreCaseSensitive1Boxed](#regexesarenotanchoredbydefaultandarecasesensitive1boxed) + +data class that stores validated List payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| RegexesAreNotAnchoredByDefaultAndAreCaseSensitive1BoxedList(FrozenList data)
    Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| FrozenList | data()
    validated payload | +| Any? | getData()
    validated payload | + +## RegexesAreNotAnchoredByDefaultAndAreCaseSensitive1BoxedMap +data class RegexesAreNotAnchoredByDefaultAndAreCaseSensitive1BoxedMap
    +implements [RegexesAreNotAnchoredByDefaultAndAreCaseSensitive1Boxed](#regexesarenotanchoredbydefaultandarecasesensitive1boxed) + +data class that stores validated Map payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| RegexesAreNotAnchoredByDefaultAndAreCaseSensitive1BoxedMap(FrozenMap data)
    Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| FrozenMap | data()
    validated payload | +| Any? | getData()
    validated payload | + +## RegexesAreNotAnchoredByDefaultAndAreCaseSensitive1 +class RegexesAreNotAnchoredByDefaultAndAreCaseSensitive1
    +extends JsonSchema + +A schema class that validates payloads + +### Field Summary +| Modifier and Type | Field and Description | +| ----------------- | ---------------------- | +| Map> | patternProperties = mapOf(
        new AbstractMap.SimpleEntry<>(Pattern.compile("[0-9]{2,}"), [Schema092::class.java](#schema092))),
        new AbstractMap.SimpleEntry<>(Pattern.compile("X_"), [X::class.java](#x)))
    )
    | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| String | validate(arg: String, configuration: SchemaConfiguration) | +| Nothing? | validate(arg: Nothing?, configuration: SchemaConfiguration) | +| int | validate(arg: int, configuration: SchemaConfiguration) | +| long | validate(arg: long, configuration: SchemaConfiguration) | +| float | validate(arg: float, configuration: SchemaConfiguration) | +| double | validate(arg: double, configuration: SchemaConfiguration) | +| Number | validate(arg: Number, configuration: SchemaConfiguration) | +| boolean | validate(arg: boolean, configuration: SchemaConfiguration) | +| FrozenMap | validate(arg: Map<?, ?>, configuration: SchemaConfiguration) | +| FrozenList | validate(arg: List<*>, configuration: SchemaConfiguration) | +| [RegexesAreNotAnchoredByDefaultAndAreCaseSensitive1BoxedString](#regexesarenotanchoredbydefaultandarecasesensitive1boxedstring) | validateAndBox(String, configuration: SchemaConfiguration) | +| [RegexesAreNotAnchoredByDefaultAndAreCaseSensitive1BoxedVoid](#regexesarenotanchoredbydefaultandarecasesensitive1boxedvoid) | validateAndBox(Nothing?, configuration: SchemaConfiguration) | +| [RegexesAreNotAnchoredByDefaultAndAreCaseSensitive1BoxedNumber](#regexesarenotanchoredbydefaultandarecasesensitive1boxednumber) | validateAndBox(Number, configuration: SchemaConfiguration) | +| [RegexesAreNotAnchoredByDefaultAndAreCaseSensitive1BoxedBoolean](#regexesarenotanchoredbydefaultandarecasesensitive1boxedboolean) | validateAndBox(boolean, configuration: SchemaConfiguration) | +| [RegexesAreNotAnchoredByDefaultAndAreCaseSensitive1BoxedMap](#regexesarenotanchoredbydefaultandarecasesensitive1boxedmap) | validateAndBox(Map<?, ?>, configuration: SchemaConfiguration) | +| [RegexesAreNotAnchoredByDefaultAndAreCaseSensitive1BoxedList](#regexesarenotanchoredbydefaultandarecasesensitive1boxedlist) | validateAndBox(List<*>, configuration: SchemaConfiguration) | +| [RegexesAreNotAnchoredByDefaultAndAreCaseSensitive1Boxed](#regexesarenotanchoredbydefaultandarecasesensitive1boxed) | validateAndBox(Any?, configuration: SchemaConfiguration) | +| Any? | validate(arg: Any?, configuration: SchemaConfiguration) | + +## XBoxed +sealed interface XBoxed
    +permits
    +[XBoxedString](#xboxedstring) + +sealed interface that stores validated payloads using boxed classes + +## XBoxedString +data class XBoxedString
    +implements [XBoxed](#xboxed) + +data class that stores validated String payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| XBoxedString(String data)
    Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| String | data()
    validated payload | +| Any? | getData()
    validated payload | + +## X +class X
    +extends StringJsonSchema.StringJsonSchema1 + +A schema class that validates payloads + +| Methods Inherited from class org.openapijsonschematools.client.schemas.StringJsonSchema.StringJsonSchema1 | +| ------------------------------------------------------------------ | +| validate | +| validateAndBox | + +## Schema092Boxed +sealed interface Schema092Boxed
    +permits
    +[Schema092BoxedBoolean](#schema092boxedboolean) + +sealed interface that stores validated payloads using boxed classes + +## Schema092BoxedBoolean +data class Schema092BoxedBoolean
    +implements [Schema092Boxed](#schema092boxed) + +record that stores validated boolean payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| Schema092BoxedBoolean(boolean data)
    Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| boolean | data()
    validated payload | +| Any? | getData()
    validated payload | + +## Schema092 +class Schema092
    +extends BooleanJsonSchema.BooleanJsonSchema1 + +A schema class that validates payloads + +| Methods Inherited from class org.openapijsonschematools.client.schemas.BooleanJsonSchema.BooleanJsonSchema1 | +| ------------------------------------------------------------------ | +| validate | +| validateAndBox | + +[[Back to top]](#top) [[Back to Component Schemas]](../../../README.md#Component-Schemas) [[Back to README]](../../../README.md) diff --git a/samples/client/3_1_0_unit_test/kotlin/docs/components/schemas/RelativeJsonPointerFormat.md b/samples/client/3_1_0_unit_test/kotlin/docs/components/schemas/RelativeJsonPointerFormat.md new file mode 100644 index 00000000000..49a4a60eec1 --- /dev/null +++ b/samples/client/3_1_0_unit_test/kotlin/docs/components/schemas/RelativeJsonPointerFormat.md @@ -0,0 +1,169 @@ +# RelativeJsonPointerFormat +org.openapijsonschematools.client.components.schemas.RelativeJsonPointerFormat.java +class RelativeJsonPointerFormat
    + +A class that contains necessary nested +- schema classes (which validate payloads), extends JsonSchema +- sealed interfaces which store validated payloads, Kotlin version of a sum type +- boxed classes which store validated payloads, sealed permits class implementations + +## Nested Class Summary +| Modifier and Type | Class and Description | +| ----------------- | ---------------------- | +| sealed interface | [RelativeJsonPointerFormat.RelativeJsonPointerFormat1Boxed](#relativejsonpointerformat1boxed)
    sealed interface for validated payloads | +| record | [RelativeJsonPointerFormat.RelativeJsonPointerFormat1BoxedVoid](#relativejsonpointerformat1boxedvoid)
    boxed class to store validated null payloads | +| record | [RelativeJsonPointerFormat.RelativeJsonPointerFormat1BoxedBoolean](#relativejsonpointerformat1boxedboolean)
    boxed class to store validated boolean payloads | +| record | [RelativeJsonPointerFormat.RelativeJsonPointerFormat1BoxedNumber](#relativejsonpointerformat1boxednumber)
    boxed class to store validated Number payloads | +| record | [RelativeJsonPointerFormat.RelativeJsonPointerFormat1BoxedString](#relativejsonpointerformat1boxedstring)
    boxed class to store validated String payloads | +| record | [RelativeJsonPointerFormat.RelativeJsonPointerFormat1BoxedList](#relativejsonpointerformat1boxedlist)
    boxed class to store validated List payloads | +| record | [RelativeJsonPointerFormat.RelativeJsonPointerFormat1BoxedMap](#relativejsonpointerformat1boxedmap)
    boxed class to store validated Map payloads | +| static class | [RelativeJsonPointerFormat.RelativeJsonPointerFormat1](#relativejsonpointerformat1)
    schema class | + +## RelativeJsonPointerFormat1Boxed +sealed interface RelativeJsonPointerFormat1Boxed
    +permits
    +[RelativeJsonPointerFormat1BoxedVoid](#relativejsonpointerformat1boxedvoid), +[RelativeJsonPointerFormat1BoxedBoolean](#relativejsonpointerformat1boxedboolean), +[RelativeJsonPointerFormat1BoxedNumber](#relativejsonpointerformat1boxednumber), +[RelativeJsonPointerFormat1BoxedString](#relativejsonpointerformat1boxedstring), +[RelativeJsonPointerFormat1BoxedList](#relativejsonpointerformat1boxedlist), +[RelativeJsonPointerFormat1BoxedMap](#relativejsonpointerformat1boxedmap) + +sealed interface that stores validated payloads using boxed classes + +## RelativeJsonPointerFormat1BoxedVoid +data class RelativeJsonPointerFormat1BoxedVoid
    +implements [RelativeJsonPointerFormat1Boxed](#relativejsonpointerformat1boxed) + +data class that stores validated null payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| RelativeJsonPointerFormat1BoxedVoid(Nothing? data)
    Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| Nothing? | data()
    validated payload | +| Any? | getData()
    validated payload | + +## RelativeJsonPointerFormat1BoxedBoolean +data class RelativeJsonPointerFormat1BoxedBoolean
    +implements [RelativeJsonPointerFormat1Boxed](#relativejsonpointerformat1boxed) + +record that stores validated boolean payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| RelativeJsonPointerFormat1BoxedBoolean(boolean data)
    Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| boolean | data()
    validated payload | +| Any? | getData()
    validated payload | + +## RelativeJsonPointerFormat1BoxedNumber +data class RelativeJsonPointerFormat1BoxedNumber
    +implements [RelativeJsonPointerFormat1Boxed](#relativejsonpointerformat1boxed) + +data class that stores validated Number payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| RelativeJsonPointerFormat1BoxedNumber(Number data)
    Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| Number | data()
    validated payload | +| Any? | getData()
    validated payload | + +## RelativeJsonPointerFormat1BoxedString +data class RelativeJsonPointerFormat1BoxedString
    +implements [RelativeJsonPointerFormat1Boxed](#relativejsonpointerformat1boxed) + +data class that stores validated String payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| RelativeJsonPointerFormat1BoxedString(String data)
    Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| String | data()
    validated payload | +| Any? | getData()
    validated payload | + +## RelativeJsonPointerFormat1BoxedList +data class RelativeJsonPointerFormat1BoxedList
    +implements [RelativeJsonPointerFormat1Boxed](#relativejsonpointerformat1boxed) + +data class that stores validated List payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| RelativeJsonPointerFormat1BoxedList(FrozenList data)
    Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| FrozenList | data()
    validated payload | +| Any? | getData()
    validated payload | + +## RelativeJsonPointerFormat1BoxedMap +data class RelativeJsonPointerFormat1BoxedMap
    +implements [RelativeJsonPointerFormat1Boxed](#relativejsonpointerformat1boxed) + +data class that stores validated Map payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| RelativeJsonPointerFormat1BoxedMap(FrozenMap data)
    Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| FrozenMap | data()
    validated payload | +| Any? | getData()
    validated payload | + +## RelativeJsonPointerFormat1 +class RelativeJsonPointerFormat1
    +extends JsonSchema + +A schema class that validates payloads + +### Field Summary +| Modifier and Type | Field and Description | +| ----------------- | ---------------------- | +| String | type = "relative-json-pointer"; | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| String | validate(arg: String, configuration: SchemaConfiguration) | +| Nothing? | validate(arg: Nothing?, configuration: SchemaConfiguration) | +| int | validate(arg: int, configuration: SchemaConfiguration) | +| long | validate(arg: long, configuration: SchemaConfiguration) | +| float | validate(arg: float, configuration: SchemaConfiguration) | +| double | validate(arg: double, configuration: SchemaConfiguration) | +| Number | validate(arg: Number, configuration: SchemaConfiguration) | +| boolean | validate(arg: boolean, configuration: SchemaConfiguration) | +| FrozenMap | validate(arg: Map<?, ?>, configuration: SchemaConfiguration) | +| FrozenList | validate(arg: List<*>, configuration: SchemaConfiguration) | +| [RelativeJsonPointerFormat1BoxedString](#relativejsonpointerformat1boxedstring) | validateAndBox(String, configuration: SchemaConfiguration) | +| [RelativeJsonPointerFormat1BoxedVoid](#relativejsonpointerformat1boxedvoid) | validateAndBox(Nothing?, configuration: SchemaConfiguration) | +| [RelativeJsonPointerFormat1BoxedNumber](#relativejsonpointerformat1boxednumber) | validateAndBox(Number, configuration: SchemaConfiguration) | +| [RelativeJsonPointerFormat1BoxedBoolean](#relativejsonpointerformat1boxedboolean) | validateAndBox(boolean, configuration: SchemaConfiguration) | +| [RelativeJsonPointerFormat1BoxedMap](#relativejsonpointerformat1boxedmap) | validateAndBox(Map<?, ?>, configuration: SchemaConfiguration) | +| [RelativeJsonPointerFormat1BoxedList](#relativejsonpointerformat1boxedlist) | validateAndBox(List<*>, configuration: SchemaConfiguration) | +| [RelativeJsonPointerFormat1Boxed](#relativejsonpointerformat1boxed) | validateAndBox(Any?, configuration: SchemaConfiguration) | +| Any? | validate(arg: Any?, configuration: SchemaConfiguration) | + +[[Back to top]](#top) [[Back to Component Schemas]](../../../README.md#Component-Schemas) [[Back to README]](../../../README.md) diff --git a/samples/client/3_1_0_unit_test/kotlin/docs/components/schemas/RequiredDefaultValidation.md b/samples/client/3_1_0_unit_test/kotlin/docs/components/schemas/RequiredDefaultValidation.md new file mode 100644 index 00000000000..7b71ca0e3f6 --- /dev/null +++ b/samples/client/3_1_0_unit_test/kotlin/docs/components/schemas/RequiredDefaultValidation.md @@ -0,0 +1,353 @@ +# RequiredDefaultValidation +org.openapijsonschematools.client.components.schemas.RequiredDefaultValidation.java +class RequiredDefaultValidation
    + +A class that contains necessary nested +- schema classes (which validate payloads), extends JsonSchema +- sealed interfaces which store validated payloads, Kotlin version of a sum type +- boxed classes which store validated payloads, sealed permits class implementations +- classes to store validated map payloads, extends FrozenMap +- classes to build inputs for map payloads + +## Nested Class Summary +| Modifier and Type | Class and Description | +| ----------------- | ---------------------- | +| sealed interface | [RequiredDefaultValidation.RequiredDefaultValidation1Boxed](#requireddefaultvalidation1boxed)
    sealed interface for validated payloads | +| record | [RequiredDefaultValidation.RequiredDefaultValidation1BoxedVoid](#requireddefaultvalidation1boxedvoid)
    boxed class to store validated null payloads | +| record | [RequiredDefaultValidation.RequiredDefaultValidation1BoxedBoolean](#requireddefaultvalidation1boxedboolean)
    boxed class to store validated boolean payloads | +| record | [RequiredDefaultValidation.RequiredDefaultValidation1BoxedNumber](#requireddefaultvalidation1boxednumber)
    boxed class to store validated Number payloads | +| record | [RequiredDefaultValidation.RequiredDefaultValidation1BoxedString](#requireddefaultvalidation1boxedstring)
    boxed class to store validated String payloads | +| record | [RequiredDefaultValidation.RequiredDefaultValidation1BoxedList](#requireddefaultvalidation1boxedlist)
    boxed class to store validated List payloads | +| record | [RequiredDefaultValidation.RequiredDefaultValidation1BoxedMap](#requireddefaultvalidation1boxedmap)
    boxed class to store validated Map payloads | +| static class | [RequiredDefaultValidation.RequiredDefaultValidation1](#requireddefaultvalidation1)
    schema class | +| static class | [RequiredDefaultValidation.RequiredDefaultValidationMapBuilder](#requireddefaultvalidationmapbuilder)
    builder for Map payloads | +| static class | [RequiredDefaultValidation.RequiredDefaultValidationMap](#requireddefaultvalidationmap)
    output class for Map payloads | +| sealed interface | [RequiredDefaultValidation.FooBoxed](#fooboxed)
    sealed interface for validated payloads | +| record | [RequiredDefaultValidation.FooBoxedVoid](#fooboxedvoid)
    boxed class to store validated null payloads | +| record | [RequiredDefaultValidation.FooBoxedBoolean](#fooboxedboolean)
    boxed class to store validated boolean payloads | +| record | [RequiredDefaultValidation.FooBoxedNumber](#fooboxednumber)
    boxed class to store validated Number payloads | +| record | [RequiredDefaultValidation.FooBoxedString](#fooboxedstring)
    boxed class to store validated String payloads | +| record | [RequiredDefaultValidation.FooBoxedList](#fooboxedlist)
    boxed class to store validated List payloads | +| record | [RequiredDefaultValidation.FooBoxedMap](#fooboxedmap)
    boxed class to store validated Map payloads | +| static class | [RequiredDefaultValidation.Foo](#foo)
    schema class | + +## RequiredDefaultValidation1Boxed +sealed interface RequiredDefaultValidation1Boxed
    +permits
    +[RequiredDefaultValidation1BoxedVoid](#requireddefaultvalidation1boxedvoid), +[RequiredDefaultValidation1BoxedBoolean](#requireddefaultvalidation1boxedboolean), +[RequiredDefaultValidation1BoxedNumber](#requireddefaultvalidation1boxednumber), +[RequiredDefaultValidation1BoxedString](#requireddefaultvalidation1boxedstring), +[RequiredDefaultValidation1BoxedList](#requireddefaultvalidation1boxedlist), +[RequiredDefaultValidation1BoxedMap](#requireddefaultvalidation1boxedmap) + +sealed interface that stores validated payloads using boxed classes + +## RequiredDefaultValidation1BoxedVoid +data class RequiredDefaultValidation1BoxedVoid
    +implements [RequiredDefaultValidation1Boxed](#requireddefaultvalidation1boxed) + +data class that stores validated null payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| RequiredDefaultValidation1BoxedVoid(Nothing? data)
    Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| Nothing? | data()
    validated payload | +| Any? | getData()
    validated payload | + +## RequiredDefaultValidation1BoxedBoolean +data class RequiredDefaultValidation1BoxedBoolean
    +implements [RequiredDefaultValidation1Boxed](#requireddefaultvalidation1boxed) + +record that stores validated boolean payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| RequiredDefaultValidation1BoxedBoolean(boolean data)
    Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| boolean | data()
    validated payload | +| Any? | getData()
    validated payload | + +## RequiredDefaultValidation1BoxedNumber +data class RequiredDefaultValidation1BoxedNumber
    +implements [RequiredDefaultValidation1Boxed](#requireddefaultvalidation1boxed) + +data class that stores validated Number payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| RequiredDefaultValidation1BoxedNumber(Number data)
    Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| Number | data()
    validated payload | +| Any? | getData()
    validated payload | + +## RequiredDefaultValidation1BoxedString +data class RequiredDefaultValidation1BoxedString
    +implements [RequiredDefaultValidation1Boxed](#requireddefaultvalidation1boxed) + +data class that stores validated String payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| RequiredDefaultValidation1BoxedString(String data)
    Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| String | data()
    validated payload | +| Any? | getData()
    validated payload | + +## RequiredDefaultValidation1BoxedList +data class RequiredDefaultValidation1BoxedList
    +implements [RequiredDefaultValidation1Boxed](#requireddefaultvalidation1boxed) + +data class that stores validated List payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| RequiredDefaultValidation1BoxedList(FrozenList data)
    Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| FrozenList | data()
    validated payload | +| Any? | getData()
    validated payload | + +## RequiredDefaultValidation1BoxedMap +data class RequiredDefaultValidation1BoxedMap
    +implements [RequiredDefaultValidation1Boxed](#requireddefaultvalidation1boxed) + +data class that stores validated Map payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| RequiredDefaultValidation1BoxedMap([RequiredDefaultValidationMap](#requireddefaultvalidationmap) data)
    Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| [RequiredDefaultValidationMap](#requireddefaultvalidationmap) | data()
    validated payload | +| Any? | getData()
    validated payload | + +## RequiredDefaultValidation1 +class RequiredDefaultValidation1
    +extends JsonSchema + +A schema class that validates payloads + +### Field Summary +| Modifier and Type | Field and Description | +| ----------------- | ---------------------- | +| Map> | properties = mapOf(
        "foo" to [Foo::class.java](#foo))
    )
    | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| String | validate(arg: String, configuration: SchemaConfiguration) | +| Nothing? | validate(arg: Nothing?, configuration: SchemaConfiguration) | +| int | validate(arg: int, configuration: SchemaConfiguration) | +| long | validate(arg: long, configuration: SchemaConfiguration) | +| float | validate(arg: float, configuration: SchemaConfiguration) | +| double | validate(arg: double, configuration: SchemaConfiguration) | +| Number | validate(arg: Number, configuration: SchemaConfiguration) | +| boolean | validate(arg: boolean, configuration: SchemaConfiguration) | +| [RequiredDefaultValidationMap](#requireddefaultvalidationmap) | validate(arg: [Map<?, ?>](#requireddefaultvalidationmapbuilder), configuration: SchemaConfiguration) | +| FrozenList | validate(arg: List<*>, configuration: SchemaConfiguration) | +| [RequiredDefaultValidation1BoxedString](#requireddefaultvalidation1boxedstring) | validateAndBox(String, configuration: SchemaConfiguration) | +| [RequiredDefaultValidation1BoxedVoid](#requireddefaultvalidation1boxedvoid) | validateAndBox(Nothing?, configuration: SchemaConfiguration) | +| [RequiredDefaultValidation1BoxedNumber](#requireddefaultvalidation1boxednumber) | validateAndBox(Number, configuration: SchemaConfiguration) | +| [RequiredDefaultValidation1BoxedBoolean](#requireddefaultvalidation1boxedboolean) | validateAndBox(boolean, configuration: SchemaConfiguration) | +| [RequiredDefaultValidation1BoxedMap](#requireddefaultvalidation1boxedmap) | validateAndBox([Map<?, ?>](#requireddefaultvalidationmapbuilder), configuration: SchemaConfiguration) | +| [RequiredDefaultValidation1BoxedList](#requireddefaultvalidation1boxedlist) | validateAndBox(List<*>, configuration: SchemaConfiguration) | +| [RequiredDefaultValidation1Boxed](#requireddefaultvalidation1boxed) | validateAndBox(Any?, configuration: SchemaConfiguration) | +| Any? | validate(arg: Any?, configuration: SchemaConfiguration) | + +## RequiredDefaultValidationMapBuilder +class RequiredDefaultValidationMapBuilder
    +builder for `Map` + +A class that builds the Map input type + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| RequiredDefaultValidationMapBuilder()
    Creates a builder that contains an empty map | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| Map | build()
    Returns map input that should be used with Schema.validate | +| [RequiredDefaultValidationMapBuilder](#requireddefaultvalidationmapbuilder) | foo(value: Nothing?) | +| [RequiredDefaultValidationMapBuilder](#requireddefaultvalidationmapbuilder) | foo(value: Boolean) | +| [RequiredDefaultValidationMapBuilder](#requireddefaultvalidationmapbuilder) | foo(value: String) | +| [RequiredDefaultValidationMapBuilder](#requireddefaultvalidationmapbuilder) | foo(value: Int) | +| [RequiredDefaultValidationMapBuilder](#requireddefaultvalidationmapbuilder) | foo(value: Float) | +| [RequiredDefaultValidationMapBuilder](#requireddefaultvalidationmapbuilder) | foo(value: Long) | +| [RequiredDefaultValidationMapBuilder](#requireddefaultvalidationmapbuilder) | foo(value: Double) | +| [RequiredDefaultValidationMapBuilder](#requireddefaultvalidationmapbuilder) | foo(value: List) | +| [RequiredDefaultValidationMapBuilder](#requireddefaultvalidationmapbuilder) | foo(value: Map) | +| [RequiredDefaultValidationMapBuilder](#requireddefaultvalidationmapbuilder) | additionalProperty(key: String, value: Nothing?) | +| [RequiredDefaultValidationMapBuilder](#requireddefaultvalidationmapbuilder) | additionalProperty(key: String, value: Boolean) | +| [RequiredDefaultValidationMapBuilder](#requireddefaultvalidationmapbuilder) | additionalProperty(key: String, value: String) | +| [RequiredDefaultValidationMapBuilder](#requireddefaultvalidationmapbuilder) | additionalProperty(key: String, value: Int) | +| [RequiredDefaultValidationMapBuilder](#requireddefaultvalidationmapbuilder) | additionalProperty(key: String, value: Float) | +| [RequiredDefaultValidationMapBuilder](#requireddefaultvalidationmapbuilder) | additionalProperty(key: String, value: Long) | +| [RequiredDefaultValidationMapBuilder](#requireddefaultvalidationmapbuilder) | additionalProperty(key: String, value: Double) | +| [RequiredDefaultValidationMapBuilder](#requireddefaultvalidationmapbuilder) | additionalProperty(key: String, value: List) | +| [RequiredDefaultValidationMapBuilder](#requireddefaultvalidationmapbuilder) | additionalProperty(key: String, value: Map) | + +## RequiredDefaultValidationMap +class RequiredDefaultValidationMap
    +extends FrozenMap + +A class to store validated Map payloads + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| static [RequiredDefaultValidationMap](#requireddefaultvalidationmap) | of([Map](#requireddefaultvalidationmapbuilder) arg, SchemaConfiguration configuration) | +| Any? | foo()
    [optional] | +| Any? | getAdditionalProperty(String name)
    provides type safety for additional properties | + +## FooBoxed +sealed interface FooBoxed
    +permits
    +[FooBoxedVoid](#fooboxedvoid), +[FooBoxedBoolean](#fooboxedboolean), +[FooBoxedNumber](#fooboxednumber), +[FooBoxedString](#fooboxedstring), +[FooBoxedList](#fooboxedlist), +[FooBoxedMap](#fooboxedmap) + +sealed interface that stores validated payloads using boxed classes + +## FooBoxedVoid +data class FooBoxedVoid
    +implements [FooBoxed](#fooboxed) + +data class that stores validated null payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| FooBoxedVoid(Nothing? data)
    Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| Nothing? | data()
    validated payload | +| Any? | getData()
    validated payload | + +## FooBoxedBoolean +data class FooBoxedBoolean
    +implements [FooBoxed](#fooboxed) + +record that stores validated boolean payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| FooBoxedBoolean(boolean data)
    Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| boolean | data()
    validated payload | +| Any? | getData()
    validated payload | + +## FooBoxedNumber +data class FooBoxedNumber
    +implements [FooBoxed](#fooboxed) + +data class that stores validated Number payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| FooBoxedNumber(Number data)
    Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| Number | data()
    validated payload | +| Any? | getData()
    validated payload | + +## FooBoxedString +data class FooBoxedString
    +implements [FooBoxed](#fooboxed) + +data class that stores validated String payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| FooBoxedString(String data)
    Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| String | data()
    validated payload | +| Any? | getData()
    validated payload | + +## FooBoxedList +data class FooBoxedList
    +implements [FooBoxed](#fooboxed) + +data class that stores validated List payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| FooBoxedList(FrozenList data)
    Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| FrozenList | data()
    validated payload | +| Any? | getData()
    validated payload | + +## FooBoxedMap +data class FooBoxedMap
    +implements [FooBoxed](#fooboxed) + +data class that stores validated Map payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| FooBoxedMap(FrozenMap data)
    Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| FrozenMap | data()
    validated payload | +| Any? | getData()
    validated payload | + +## Foo +class Foo
    +extends AnyTypeJsonSchema.AnyTypeJsonSchema1 + +A schema class that validates payloads + +| Methods Inherited from class org.openapijsonschematools.client.schemas.AnyTypeJsonSchema.AnyTypeJsonSchema1 | +| ------------------------------------------------------------------ | +| validate | +| validateAndBox | + +[[Back to top]](#top) [[Back to Component Schemas]](../../../README.md#Component-Schemas) [[Back to README]](../../../README.md) diff --git a/samples/client/3_1_0_unit_test/kotlin/docs/components/schemas/RequiredPropertiesWhoseNamesAreJavascriptObjectPropertyNames.md b/samples/client/3_1_0_unit_test/kotlin/docs/components/schemas/RequiredPropertiesWhoseNamesAreJavascriptObjectPropertyNames.md new file mode 100644 index 00000000000..1f70ba9284c --- /dev/null +++ b/samples/client/3_1_0_unit_test/kotlin/docs/components/schemas/RequiredPropertiesWhoseNamesAreJavascriptObjectPropertyNames.md @@ -0,0 +1,425 @@ +# RequiredPropertiesWhoseNamesAreJavascriptObjectPropertyNames +org.openapijsonschematools.client.components.schemas.RequiredPropertiesWhoseNamesAreJavascriptObjectPropertyNames.java +class RequiredPropertiesWhoseNamesAreJavascriptObjectPropertyNames
    + +A class that contains necessary nested +- schema classes (which validate payloads), extends JsonSchema +- sealed interfaces which store validated payloads, Kotlin version of a sum type +- boxed classes which store validated payloads, sealed permits class implementations +- classes to store validated map payloads, extends FrozenMap +- classes to build inputs for map payloads + +## Nested Class Summary +| Modifier and Type | Class and Description | +| ----------------- | ---------------------- | +| sealed interface | [RequiredPropertiesWhoseNamesAreJavascriptObjectPropertyNames.RequiredPropertiesWhoseNamesAreJavascriptObjectPropertyNames1Boxed](#requiredpropertieswhosenamesarejavascriptobjectpropertynames1boxed)
    sealed interface for validated payloads | +| record | [RequiredPropertiesWhoseNamesAreJavascriptObjectPropertyNames.RequiredPropertiesWhoseNamesAreJavascriptObjectPropertyNames1BoxedVoid](#requiredpropertieswhosenamesarejavascriptobjectpropertynames1boxedvoid)
    boxed class to store validated null payloads | +| record | [RequiredPropertiesWhoseNamesAreJavascriptObjectPropertyNames.RequiredPropertiesWhoseNamesAreJavascriptObjectPropertyNames1BoxedBoolean](#requiredpropertieswhosenamesarejavascriptobjectpropertynames1boxedboolean)
    boxed class to store validated boolean payloads | +| record | [RequiredPropertiesWhoseNamesAreJavascriptObjectPropertyNames.RequiredPropertiesWhoseNamesAreJavascriptObjectPropertyNames1BoxedNumber](#requiredpropertieswhosenamesarejavascriptobjectpropertynames1boxednumber)
    boxed class to store validated Number payloads | +| record | [RequiredPropertiesWhoseNamesAreJavascriptObjectPropertyNames.RequiredPropertiesWhoseNamesAreJavascriptObjectPropertyNames1BoxedString](#requiredpropertieswhosenamesarejavascriptobjectpropertynames1boxedstring)
    boxed class to store validated String payloads | +| record | [RequiredPropertiesWhoseNamesAreJavascriptObjectPropertyNames.RequiredPropertiesWhoseNamesAreJavascriptObjectPropertyNames1BoxedList](#requiredpropertieswhosenamesarejavascriptobjectpropertynames1boxedlist)
    boxed class to store validated List payloads | +| record | [RequiredPropertiesWhoseNamesAreJavascriptObjectPropertyNames.RequiredPropertiesWhoseNamesAreJavascriptObjectPropertyNames1BoxedMap](#requiredpropertieswhosenamesarejavascriptobjectpropertynames1boxedmap)
    boxed class to store validated Map payloads | +| static class | [RequiredPropertiesWhoseNamesAreJavascriptObjectPropertyNames.RequiredPropertiesWhoseNamesAreJavascriptObjectPropertyNames1](#requiredpropertieswhosenamesarejavascriptobjectpropertynames1)
    schema class | +| static class | [RequiredPropertiesWhoseNamesAreJavascriptObjectPropertyNames.RequiredPropertiesWhoseNamesAreJavascriptObjectPropertyNamesMapBuilder](#requiredpropertieswhosenamesarejavascriptobjectpropertynamesmapbuilder)
    builder for Map payloads | +| static class | [RequiredPropertiesWhoseNamesAreJavascriptObjectPropertyNames.RequiredPropertiesWhoseNamesAreJavascriptObjectPropertyNamesMap](#requiredpropertieswhosenamesarejavascriptobjectpropertynamesmap)
    output class for Map payloads | + +## RequiredPropertiesWhoseNamesAreJavascriptObjectPropertyNames1Boxed +sealed interface RequiredPropertiesWhoseNamesAreJavascriptObjectPropertyNames1Boxed
    +permits
    +[RequiredPropertiesWhoseNamesAreJavascriptObjectPropertyNames1BoxedVoid](#requiredpropertieswhosenamesarejavascriptobjectpropertynames1boxedvoid), +[RequiredPropertiesWhoseNamesAreJavascriptObjectPropertyNames1BoxedBoolean](#requiredpropertieswhosenamesarejavascriptobjectpropertynames1boxedboolean), +[RequiredPropertiesWhoseNamesAreJavascriptObjectPropertyNames1BoxedNumber](#requiredpropertieswhosenamesarejavascriptobjectpropertynames1boxednumber), +[RequiredPropertiesWhoseNamesAreJavascriptObjectPropertyNames1BoxedString](#requiredpropertieswhosenamesarejavascriptobjectpropertynames1boxedstring), +[RequiredPropertiesWhoseNamesAreJavascriptObjectPropertyNames1BoxedList](#requiredpropertieswhosenamesarejavascriptobjectpropertynames1boxedlist), +[RequiredPropertiesWhoseNamesAreJavascriptObjectPropertyNames1BoxedMap](#requiredpropertieswhosenamesarejavascriptobjectpropertynames1boxedmap) + +sealed interface that stores validated payloads using boxed classes + +## RequiredPropertiesWhoseNamesAreJavascriptObjectPropertyNames1BoxedVoid +data class RequiredPropertiesWhoseNamesAreJavascriptObjectPropertyNames1BoxedVoid
    +implements [RequiredPropertiesWhoseNamesAreJavascriptObjectPropertyNames1Boxed](#requiredpropertieswhosenamesarejavascriptobjectpropertynames1boxed) + +data class that stores validated null payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| RequiredPropertiesWhoseNamesAreJavascriptObjectPropertyNames1BoxedVoid(Nothing? data)
    Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| Nothing? | data()
    validated payload | +| Any? | getData()
    validated payload | + +## RequiredPropertiesWhoseNamesAreJavascriptObjectPropertyNames1BoxedBoolean +data class RequiredPropertiesWhoseNamesAreJavascriptObjectPropertyNames1BoxedBoolean
    +implements [RequiredPropertiesWhoseNamesAreJavascriptObjectPropertyNames1Boxed](#requiredpropertieswhosenamesarejavascriptobjectpropertynames1boxed) + +record that stores validated boolean payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| RequiredPropertiesWhoseNamesAreJavascriptObjectPropertyNames1BoxedBoolean(boolean data)
    Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| boolean | data()
    validated payload | +| Any? | getData()
    validated payload | + +## RequiredPropertiesWhoseNamesAreJavascriptObjectPropertyNames1BoxedNumber +data class RequiredPropertiesWhoseNamesAreJavascriptObjectPropertyNames1BoxedNumber
    +implements [RequiredPropertiesWhoseNamesAreJavascriptObjectPropertyNames1Boxed](#requiredpropertieswhosenamesarejavascriptobjectpropertynames1boxed) + +data class that stores validated Number payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| RequiredPropertiesWhoseNamesAreJavascriptObjectPropertyNames1BoxedNumber(Number data)
    Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| Number | data()
    validated payload | +| Any? | getData()
    validated payload | + +## RequiredPropertiesWhoseNamesAreJavascriptObjectPropertyNames1BoxedString +data class RequiredPropertiesWhoseNamesAreJavascriptObjectPropertyNames1BoxedString
    +implements [RequiredPropertiesWhoseNamesAreJavascriptObjectPropertyNames1Boxed](#requiredpropertieswhosenamesarejavascriptobjectpropertynames1boxed) + +data class that stores validated String payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| RequiredPropertiesWhoseNamesAreJavascriptObjectPropertyNames1BoxedString(String data)
    Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| String | data()
    validated payload | +| Any? | getData()
    validated payload | + +## RequiredPropertiesWhoseNamesAreJavascriptObjectPropertyNames1BoxedList +data class RequiredPropertiesWhoseNamesAreJavascriptObjectPropertyNames1BoxedList
    +implements [RequiredPropertiesWhoseNamesAreJavascriptObjectPropertyNames1Boxed](#requiredpropertieswhosenamesarejavascriptobjectpropertynames1boxed) + +data class that stores validated List payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| RequiredPropertiesWhoseNamesAreJavascriptObjectPropertyNames1BoxedList(FrozenList data)
    Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| FrozenList | data()
    validated payload | +| Any? | getData()
    validated payload | + +## RequiredPropertiesWhoseNamesAreJavascriptObjectPropertyNames1BoxedMap +data class RequiredPropertiesWhoseNamesAreJavascriptObjectPropertyNames1BoxedMap
    +implements [RequiredPropertiesWhoseNamesAreJavascriptObjectPropertyNames1Boxed](#requiredpropertieswhosenamesarejavascriptobjectpropertynames1boxed) + +data class that stores validated Map payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| RequiredPropertiesWhoseNamesAreJavascriptObjectPropertyNames1BoxedMap([RequiredPropertiesWhoseNamesAreJavascriptObjectPropertyNamesMap](#requiredpropertieswhosenamesarejavascriptobjectpropertynamesmap) data)
    Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| [RequiredPropertiesWhoseNamesAreJavascriptObjectPropertyNamesMap](#requiredpropertieswhosenamesarejavascriptobjectpropertynamesmap) | data()
    validated payload | +| Any? | getData()
    validated payload | + +## RequiredPropertiesWhoseNamesAreJavascriptObjectPropertyNames1 +class RequiredPropertiesWhoseNamesAreJavascriptObjectPropertyNames1
    +extends JsonSchema + +A schema class that validates payloads + +### Field Summary +| Modifier and Type | Field and Description | +| ----------------- | ---------------------- | +| Set | required = setOf(
        "__proto__",
        "constructor",
        "toString"
    )
    | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| String | validate(arg: String, configuration: SchemaConfiguration) | +| Nothing? | validate(arg: Nothing?, configuration: SchemaConfiguration) | +| int | validate(arg: int, configuration: SchemaConfiguration) | +| long | validate(arg: long, configuration: SchemaConfiguration) | +| float | validate(arg: float, configuration: SchemaConfiguration) | +| double | validate(arg: double, configuration: SchemaConfiguration) | +| Number | validate(arg: Number, configuration: SchemaConfiguration) | +| boolean | validate(arg: boolean, configuration: SchemaConfiguration) | +| [RequiredPropertiesWhoseNamesAreJavascriptObjectPropertyNamesMap](#requiredpropertieswhosenamesarejavascriptobjectpropertynamesmap) | validate(arg: [Map<?, ?>](#requiredpropertieswhosenamesarejavascriptobjectpropertynamesmapbuilder), configuration: SchemaConfiguration) | +| FrozenList | validate(arg: List<*>, configuration: SchemaConfiguration) | +| [RequiredPropertiesWhoseNamesAreJavascriptObjectPropertyNames1BoxedString](#requiredpropertieswhosenamesarejavascriptobjectpropertynames1boxedstring) | validateAndBox(String, configuration: SchemaConfiguration) | +| [RequiredPropertiesWhoseNamesAreJavascriptObjectPropertyNames1BoxedVoid](#requiredpropertieswhosenamesarejavascriptobjectpropertynames1boxedvoid) | validateAndBox(Nothing?, configuration: SchemaConfiguration) | +| [RequiredPropertiesWhoseNamesAreJavascriptObjectPropertyNames1BoxedNumber](#requiredpropertieswhosenamesarejavascriptobjectpropertynames1boxednumber) | validateAndBox(Number, configuration: SchemaConfiguration) | +| [RequiredPropertiesWhoseNamesAreJavascriptObjectPropertyNames1BoxedBoolean](#requiredpropertieswhosenamesarejavascriptobjectpropertynames1boxedboolean) | validateAndBox(boolean, configuration: SchemaConfiguration) | +| [RequiredPropertiesWhoseNamesAreJavascriptObjectPropertyNames1BoxedMap](#requiredpropertieswhosenamesarejavascriptobjectpropertynames1boxedmap) | validateAndBox([Map<?, ?>](#requiredpropertieswhosenamesarejavascriptobjectpropertynamesmapbuilder), configuration: SchemaConfiguration) | +| [RequiredPropertiesWhoseNamesAreJavascriptObjectPropertyNames1BoxedList](#requiredpropertieswhosenamesarejavascriptobjectpropertynames1boxedlist) | validateAndBox(List<*>, configuration: SchemaConfiguration) | +| [RequiredPropertiesWhoseNamesAreJavascriptObjectPropertyNames1Boxed](#requiredpropertieswhosenamesarejavascriptobjectpropertynames1boxed) | validateAndBox(Any?, configuration: SchemaConfiguration) | +| Any? | validate(arg: Any?, configuration: SchemaConfiguration) | + +## RequiredPropertiesWhoseNamesAreJavascriptObjectPropertyNamesMap000Builder +class RequiredPropertiesWhoseNamesAreJavascriptObjectPropertyNamesMap000Builder
    +builder for `Map` + +A class that builds the Map input type + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| RequiredPropertiesWhoseNamesAreJavascriptObjectPropertyNamesMap000Builder(Map instance)
    Creates a builder that contains the passed instance | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| Map | build()
    Returns map input that should be used with Schema.validate | +| [RequiredPropertiesWhoseNamesAreJavascriptObjectPropertyNamesMap000Builder](#requiredpropertieswhosenamesarejavascriptobjectpropertynamesmap000builder) | additionalProperty(key: String, value: Nothing?) | +| [RequiredPropertiesWhoseNamesAreJavascriptObjectPropertyNamesMap000Builder](#requiredpropertieswhosenamesarejavascriptobjectpropertynamesmap000builder) | additionalProperty(key: String, value: Boolean) | +| [RequiredPropertiesWhoseNamesAreJavascriptObjectPropertyNamesMap000Builder](#requiredpropertieswhosenamesarejavascriptobjectpropertynamesmap000builder) | additionalProperty(key: String, value: String) | +| [RequiredPropertiesWhoseNamesAreJavascriptObjectPropertyNamesMap000Builder](#requiredpropertieswhosenamesarejavascriptobjectpropertynamesmap000builder) | additionalProperty(key: String, value: Int) | +| [RequiredPropertiesWhoseNamesAreJavascriptObjectPropertyNamesMap000Builder](#requiredpropertieswhosenamesarejavascriptobjectpropertynamesmap000builder) | additionalProperty(key: String, value: Float) | +| [RequiredPropertiesWhoseNamesAreJavascriptObjectPropertyNamesMap000Builder](#requiredpropertieswhosenamesarejavascriptobjectpropertynamesmap000builder) | additionalProperty(key: String, value: Long) | +| [RequiredPropertiesWhoseNamesAreJavascriptObjectPropertyNamesMap000Builder](#requiredpropertieswhosenamesarejavascriptobjectpropertynamesmap000builder) | additionalProperty(key: String, value: Double) | +| [RequiredPropertiesWhoseNamesAreJavascriptObjectPropertyNamesMap000Builder](#requiredpropertieswhosenamesarejavascriptobjectpropertynamesmap000builder) | additionalProperty(key: String, value: List) | +| [RequiredPropertiesWhoseNamesAreJavascriptObjectPropertyNamesMap000Builder](#requiredpropertieswhosenamesarejavascriptobjectpropertynamesmap000builder) | additionalProperty(key: String, value: Map) | + +## RequiredPropertiesWhoseNamesAreJavascriptObjectPropertyNamesMap001Builder +class RequiredPropertiesWhoseNamesAreJavascriptObjectPropertyNamesMap001Builder
    +builder for `Map` + +A class that builds the Map input type + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| RequiredPropertiesWhoseNamesAreJavascriptObjectPropertyNamesMap001Builder(Map instance)
    Creates a builder that contains the passed instance | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| [RequiredPropertiesWhoseNamesAreJavascriptObjectPropertyNamesMap000Builder](#requiredpropertieswhosenamesarejavascriptobjectpropertynamesmap000builder) | toString(value: Nothing?) | +| [RequiredPropertiesWhoseNamesAreJavascriptObjectPropertyNamesMap000Builder](#requiredpropertieswhosenamesarejavascriptobjectpropertynamesmap000builder) | toString(value: Boolean) | +| [RequiredPropertiesWhoseNamesAreJavascriptObjectPropertyNamesMap000Builder](#requiredpropertieswhosenamesarejavascriptobjectpropertynamesmap000builder) | toString(value: String) | +| [RequiredPropertiesWhoseNamesAreJavascriptObjectPropertyNamesMap000Builder](#requiredpropertieswhosenamesarejavascriptobjectpropertynamesmap000builder) | toString(value: Int) | +| [RequiredPropertiesWhoseNamesAreJavascriptObjectPropertyNamesMap000Builder](#requiredpropertieswhosenamesarejavascriptobjectpropertynamesmap000builder) | toString(value: Float) | +| [RequiredPropertiesWhoseNamesAreJavascriptObjectPropertyNamesMap000Builder](#requiredpropertieswhosenamesarejavascriptobjectpropertynamesmap000builder) | toString(value: Long) | +| [RequiredPropertiesWhoseNamesAreJavascriptObjectPropertyNamesMap000Builder](#requiredpropertieswhosenamesarejavascriptobjectpropertynamesmap000builder) | toString(value: Double) | +| [RequiredPropertiesWhoseNamesAreJavascriptObjectPropertyNamesMap000Builder](#requiredpropertieswhosenamesarejavascriptobjectpropertynamesmap000builder) | toString(value: List) | +| [RequiredPropertiesWhoseNamesAreJavascriptObjectPropertyNamesMap000Builder](#requiredpropertieswhosenamesarejavascriptobjectpropertynamesmap000builder) | toString(value: Map) | + +## RequiredPropertiesWhoseNamesAreJavascriptObjectPropertyNamesMap010Builder +class RequiredPropertiesWhoseNamesAreJavascriptObjectPropertyNamesMap010Builder
    +builder for `Map` + +A class that builds the Map input type + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| RequiredPropertiesWhoseNamesAreJavascriptObjectPropertyNamesMap010Builder(Map instance)
    Creates a builder that contains the passed instance | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| [RequiredPropertiesWhoseNamesAreJavascriptObjectPropertyNamesMap000Builder](#requiredpropertieswhosenamesarejavascriptobjectpropertynamesmap000builder) | setConstructor(value: Nothing?) | +| [RequiredPropertiesWhoseNamesAreJavascriptObjectPropertyNamesMap000Builder](#requiredpropertieswhosenamesarejavascriptobjectpropertynamesmap000builder) | setConstructor(value: Boolean) | +| [RequiredPropertiesWhoseNamesAreJavascriptObjectPropertyNamesMap000Builder](#requiredpropertieswhosenamesarejavascriptobjectpropertynamesmap000builder) | setConstructor(value: String) | +| [RequiredPropertiesWhoseNamesAreJavascriptObjectPropertyNamesMap000Builder](#requiredpropertieswhosenamesarejavascriptobjectpropertynamesmap000builder) | setConstructor(value: Int) | +| [RequiredPropertiesWhoseNamesAreJavascriptObjectPropertyNamesMap000Builder](#requiredpropertieswhosenamesarejavascriptobjectpropertynamesmap000builder) | setConstructor(value: Float) | +| [RequiredPropertiesWhoseNamesAreJavascriptObjectPropertyNamesMap000Builder](#requiredpropertieswhosenamesarejavascriptobjectpropertynamesmap000builder) | setConstructor(value: Long) | +| [RequiredPropertiesWhoseNamesAreJavascriptObjectPropertyNamesMap000Builder](#requiredpropertieswhosenamesarejavascriptobjectpropertynamesmap000builder) | setConstructor(value: Double) | +| [RequiredPropertiesWhoseNamesAreJavascriptObjectPropertyNamesMap000Builder](#requiredpropertieswhosenamesarejavascriptobjectpropertynamesmap000builder) | setConstructor(value: List) | +| [RequiredPropertiesWhoseNamesAreJavascriptObjectPropertyNamesMap000Builder](#requiredpropertieswhosenamesarejavascriptobjectpropertynamesmap000builder) | setConstructor(value: Map) | + +## RequiredPropertiesWhoseNamesAreJavascriptObjectPropertyNamesMap011Builder +class RequiredPropertiesWhoseNamesAreJavascriptObjectPropertyNamesMap011Builder
    +builder for `Map` + +A class that builds the Map input type + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| RequiredPropertiesWhoseNamesAreJavascriptObjectPropertyNamesMap011Builder(Map instance)
    Creates a builder that contains the passed instance | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| [RequiredPropertiesWhoseNamesAreJavascriptObjectPropertyNamesMap001Builder](#requiredpropertieswhosenamesarejavascriptobjectpropertynamesmap001builder) | setConstructor(value: Nothing?) | +| [RequiredPropertiesWhoseNamesAreJavascriptObjectPropertyNamesMap001Builder](#requiredpropertieswhosenamesarejavascriptobjectpropertynamesmap001builder) | setConstructor(value: Boolean) | +| [RequiredPropertiesWhoseNamesAreJavascriptObjectPropertyNamesMap001Builder](#requiredpropertieswhosenamesarejavascriptobjectpropertynamesmap001builder) | setConstructor(value: String) | +| [RequiredPropertiesWhoseNamesAreJavascriptObjectPropertyNamesMap001Builder](#requiredpropertieswhosenamesarejavascriptobjectpropertynamesmap001builder) | setConstructor(value: Int) | +| [RequiredPropertiesWhoseNamesAreJavascriptObjectPropertyNamesMap001Builder](#requiredpropertieswhosenamesarejavascriptobjectpropertynamesmap001builder) | setConstructor(value: Float) | +| [RequiredPropertiesWhoseNamesAreJavascriptObjectPropertyNamesMap001Builder](#requiredpropertieswhosenamesarejavascriptobjectpropertynamesmap001builder) | setConstructor(value: Long) | +| [RequiredPropertiesWhoseNamesAreJavascriptObjectPropertyNamesMap001Builder](#requiredpropertieswhosenamesarejavascriptobjectpropertynamesmap001builder) | setConstructor(value: Double) | +| [RequiredPropertiesWhoseNamesAreJavascriptObjectPropertyNamesMap001Builder](#requiredpropertieswhosenamesarejavascriptobjectpropertynamesmap001builder) | setConstructor(value: List) | +| [RequiredPropertiesWhoseNamesAreJavascriptObjectPropertyNamesMap001Builder](#requiredpropertieswhosenamesarejavascriptobjectpropertynamesmap001builder) | setConstructor(value: Map) | +| [RequiredPropertiesWhoseNamesAreJavascriptObjectPropertyNamesMap010Builder](#requiredpropertieswhosenamesarejavascriptobjectpropertynamesmap010builder) | toString(value: Nothing?) | +| [RequiredPropertiesWhoseNamesAreJavascriptObjectPropertyNamesMap010Builder](#requiredpropertieswhosenamesarejavascriptobjectpropertynamesmap010builder) | toString(value: Boolean) | +| [RequiredPropertiesWhoseNamesAreJavascriptObjectPropertyNamesMap010Builder](#requiredpropertieswhosenamesarejavascriptobjectpropertynamesmap010builder) | toString(value: String) | +| [RequiredPropertiesWhoseNamesAreJavascriptObjectPropertyNamesMap010Builder](#requiredpropertieswhosenamesarejavascriptobjectpropertynamesmap010builder) | toString(value: Int) | +| [RequiredPropertiesWhoseNamesAreJavascriptObjectPropertyNamesMap010Builder](#requiredpropertieswhosenamesarejavascriptobjectpropertynamesmap010builder) | toString(value: Float) | +| [RequiredPropertiesWhoseNamesAreJavascriptObjectPropertyNamesMap010Builder](#requiredpropertieswhosenamesarejavascriptobjectpropertynamesmap010builder) | toString(value: Long) | +| [RequiredPropertiesWhoseNamesAreJavascriptObjectPropertyNamesMap010Builder](#requiredpropertieswhosenamesarejavascriptobjectpropertynamesmap010builder) | toString(value: Double) | +| [RequiredPropertiesWhoseNamesAreJavascriptObjectPropertyNamesMap010Builder](#requiredpropertieswhosenamesarejavascriptobjectpropertynamesmap010builder) | toString(value: List) | +| [RequiredPropertiesWhoseNamesAreJavascriptObjectPropertyNamesMap010Builder](#requiredpropertieswhosenamesarejavascriptobjectpropertynamesmap010builder) | toString(value: Map) | + +## RequiredPropertiesWhoseNamesAreJavascriptObjectPropertyNamesMap100Builder +class RequiredPropertiesWhoseNamesAreJavascriptObjectPropertyNamesMap100Builder
    +builder for `Map` + +A class that builds the Map input type + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| RequiredPropertiesWhoseNamesAreJavascriptObjectPropertyNamesMap100Builder(Map instance)
    Creates a builder that contains the passed instance | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| [RequiredPropertiesWhoseNamesAreJavascriptObjectPropertyNamesMap000Builder](#requiredpropertieswhosenamesarejavascriptobjectpropertynamesmap000builder) | lowLineProto(value: Nothing?) | +| [RequiredPropertiesWhoseNamesAreJavascriptObjectPropertyNamesMap000Builder](#requiredpropertieswhosenamesarejavascriptobjectpropertynamesmap000builder) | lowLineProto(value: Boolean) | +| [RequiredPropertiesWhoseNamesAreJavascriptObjectPropertyNamesMap000Builder](#requiredpropertieswhosenamesarejavascriptobjectpropertynamesmap000builder) | lowLineProto(value: String) | +| [RequiredPropertiesWhoseNamesAreJavascriptObjectPropertyNamesMap000Builder](#requiredpropertieswhosenamesarejavascriptobjectpropertynamesmap000builder) | lowLineProto(value: Int) | +| [RequiredPropertiesWhoseNamesAreJavascriptObjectPropertyNamesMap000Builder](#requiredpropertieswhosenamesarejavascriptobjectpropertynamesmap000builder) | lowLineProto(value: Float) | +| [RequiredPropertiesWhoseNamesAreJavascriptObjectPropertyNamesMap000Builder](#requiredpropertieswhosenamesarejavascriptobjectpropertynamesmap000builder) | lowLineProto(value: Long) | +| [RequiredPropertiesWhoseNamesAreJavascriptObjectPropertyNamesMap000Builder](#requiredpropertieswhosenamesarejavascriptobjectpropertynamesmap000builder) | lowLineProto(value: Double) | +| [RequiredPropertiesWhoseNamesAreJavascriptObjectPropertyNamesMap000Builder](#requiredpropertieswhosenamesarejavascriptobjectpropertynamesmap000builder) | lowLineProto(value: List) | +| [RequiredPropertiesWhoseNamesAreJavascriptObjectPropertyNamesMap000Builder](#requiredpropertieswhosenamesarejavascriptobjectpropertynamesmap000builder) | lowLineProto(value: Map) | + +## RequiredPropertiesWhoseNamesAreJavascriptObjectPropertyNamesMap101Builder +class RequiredPropertiesWhoseNamesAreJavascriptObjectPropertyNamesMap101Builder
    +builder for `Map` + +A class that builds the Map input type + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| RequiredPropertiesWhoseNamesAreJavascriptObjectPropertyNamesMap101Builder(Map instance)
    Creates a builder that contains the passed instance | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| [RequiredPropertiesWhoseNamesAreJavascriptObjectPropertyNamesMap001Builder](#requiredpropertieswhosenamesarejavascriptobjectpropertynamesmap001builder) | lowLineProto(value: Nothing?) | +| [RequiredPropertiesWhoseNamesAreJavascriptObjectPropertyNamesMap001Builder](#requiredpropertieswhosenamesarejavascriptobjectpropertynamesmap001builder) | lowLineProto(value: Boolean) | +| [RequiredPropertiesWhoseNamesAreJavascriptObjectPropertyNamesMap001Builder](#requiredpropertieswhosenamesarejavascriptobjectpropertynamesmap001builder) | lowLineProto(value: String) | +| [RequiredPropertiesWhoseNamesAreJavascriptObjectPropertyNamesMap001Builder](#requiredpropertieswhosenamesarejavascriptobjectpropertynamesmap001builder) | lowLineProto(value: Int) | +| [RequiredPropertiesWhoseNamesAreJavascriptObjectPropertyNamesMap001Builder](#requiredpropertieswhosenamesarejavascriptobjectpropertynamesmap001builder) | lowLineProto(value: Float) | +| [RequiredPropertiesWhoseNamesAreJavascriptObjectPropertyNamesMap001Builder](#requiredpropertieswhosenamesarejavascriptobjectpropertynamesmap001builder) | lowLineProto(value: Long) | +| [RequiredPropertiesWhoseNamesAreJavascriptObjectPropertyNamesMap001Builder](#requiredpropertieswhosenamesarejavascriptobjectpropertynamesmap001builder) | lowLineProto(value: Double) | +| [RequiredPropertiesWhoseNamesAreJavascriptObjectPropertyNamesMap001Builder](#requiredpropertieswhosenamesarejavascriptobjectpropertynamesmap001builder) | lowLineProto(value: List) | +| [RequiredPropertiesWhoseNamesAreJavascriptObjectPropertyNamesMap001Builder](#requiredpropertieswhosenamesarejavascriptobjectpropertynamesmap001builder) | lowLineProto(value: Map) | +| [RequiredPropertiesWhoseNamesAreJavascriptObjectPropertyNamesMap100Builder](#requiredpropertieswhosenamesarejavascriptobjectpropertynamesmap100builder) | toString(value: Nothing?) | +| [RequiredPropertiesWhoseNamesAreJavascriptObjectPropertyNamesMap100Builder](#requiredpropertieswhosenamesarejavascriptobjectpropertynamesmap100builder) | toString(value: Boolean) | +| [RequiredPropertiesWhoseNamesAreJavascriptObjectPropertyNamesMap100Builder](#requiredpropertieswhosenamesarejavascriptobjectpropertynamesmap100builder) | toString(value: String) | +| [RequiredPropertiesWhoseNamesAreJavascriptObjectPropertyNamesMap100Builder](#requiredpropertieswhosenamesarejavascriptobjectpropertynamesmap100builder) | toString(value: Int) | +| [RequiredPropertiesWhoseNamesAreJavascriptObjectPropertyNamesMap100Builder](#requiredpropertieswhosenamesarejavascriptobjectpropertynamesmap100builder) | toString(value: Float) | +| [RequiredPropertiesWhoseNamesAreJavascriptObjectPropertyNamesMap100Builder](#requiredpropertieswhosenamesarejavascriptobjectpropertynamesmap100builder) | toString(value: Long) | +| [RequiredPropertiesWhoseNamesAreJavascriptObjectPropertyNamesMap100Builder](#requiredpropertieswhosenamesarejavascriptobjectpropertynamesmap100builder) | toString(value: Double) | +| [RequiredPropertiesWhoseNamesAreJavascriptObjectPropertyNamesMap100Builder](#requiredpropertieswhosenamesarejavascriptobjectpropertynamesmap100builder) | toString(value: List) | +| [RequiredPropertiesWhoseNamesAreJavascriptObjectPropertyNamesMap100Builder](#requiredpropertieswhosenamesarejavascriptobjectpropertynamesmap100builder) | toString(value: Map) | + +## RequiredPropertiesWhoseNamesAreJavascriptObjectPropertyNamesMap110Builder +class RequiredPropertiesWhoseNamesAreJavascriptObjectPropertyNamesMap110Builder
    +builder for `Map` + +A class that builds the Map input type + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| RequiredPropertiesWhoseNamesAreJavascriptObjectPropertyNamesMap110Builder(Map instance)
    Creates a builder that contains the passed instance | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| [RequiredPropertiesWhoseNamesAreJavascriptObjectPropertyNamesMap010Builder](#requiredpropertieswhosenamesarejavascriptobjectpropertynamesmap010builder) | lowLineProto(value: Nothing?) | +| [RequiredPropertiesWhoseNamesAreJavascriptObjectPropertyNamesMap010Builder](#requiredpropertieswhosenamesarejavascriptobjectpropertynamesmap010builder) | lowLineProto(value: Boolean) | +| [RequiredPropertiesWhoseNamesAreJavascriptObjectPropertyNamesMap010Builder](#requiredpropertieswhosenamesarejavascriptobjectpropertynamesmap010builder) | lowLineProto(value: String) | +| [RequiredPropertiesWhoseNamesAreJavascriptObjectPropertyNamesMap010Builder](#requiredpropertieswhosenamesarejavascriptobjectpropertynamesmap010builder) | lowLineProto(value: Int) | +| [RequiredPropertiesWhoseNamesAreJavascriptObjectPropertyNamesMap010Builder](#requiredpropertieswhosenamesarejavascriptobjectpropertynamesmap010builder) | lowLineProto(value: Float) | +| [RequiredPropertiesWhoseNamesAreJavascriptObjectPropertyNamesMap010Builder](#requiredpropertieswhosenamesarejavascriptobjectpropertynamesmap010builder) | lowLineProto(value: Long) | +| [RequiredPropertiesWhoseNamesAreJavascriptObjectPropertyNamesMap010Builder](#requiredpropertieswhosenamesarejavascriptobjectpropertynamesmap010builder) | lowLineProto(value: Double) | +| [RequiredPropertiesWhoseNamesAreJavascriptObjectPropertyNamesMap010Builder](#requiredpropertieswhosenamesarejavascriptobjectpropertynamesmap010builder) | lowLineProto(value: List) | +| [RequiredPropertiesWhoseNamesAreJavascriptObjectPropertyNamesMap010Builder](#requiredpropertieswhosenamesarejavascriptobjectpropertynamesmap010builder) | lowLineProto(value: Map) | +| [RequiredPropertiesWhoseNamesAreJavascriptObjectPropertyNamesMap100Builder](#requiredpropertieswhosenamesarejavascriptobjectpropertynamesmap100builder) | setConstructor(value: Nothing?) | +| [RequiredPropertiesWhoseNamesAreJavascriptObjectPropertyNamesMap100Builder](#requiredpropertieswhosenamesarejavascriptobjectpropertynamesmap100builder) | setConstructor(value: Boolean) | +| [RequiredPropertiesWhoseNamesAreJavascriptObjectPropertyNamesMap100Builder](#requiredpropertieswhosenamesarejavascriptobjectpropertynamesmap100builder) | setConstructor(value: String) | +| [RequiredPropertiesWhoseNamesAreJavascriptObjectPropertyNamesMap100Builder](#requiredpropertieswhosenamesarejavascriptobjectpropertynamesmap100builder) | setConstructor(value: Int) | +| [RequiredPropertiesWhoseNamesAreJavascriptObjectPropertyNamesMap100Builder](#requiredpropertieswhosenamesarejavascriptobjectpropertynamesmap100builder) | setConstructor(value: Float) | +| [RequiredPropertiesWhoseNamesAreJavascriptObjectPropertyNamesMap100Builder](#requiredpropertieswhosenamesarejavascriptobjectpropertynamesmap100builder) | setConstructor(value: Long) | +| [RequiredPropertiesWhoseNamesAreJavascriptObjectPropertyNamesMap100Builder](#requiredpropertieswhosenamesarejavascriptobjectpropertynamesmap100builder) | setConstructor(value: Double) | +| [RequiredPropertiesWhoseNamesAreJavascriptObjectPropertyNamesMap100Builder](#requiredpropertieswhosenamesarejavascriptobjectpropertynamesmap100builder) | setConstructor(value: List) | +| [RequiredPropertiesWhoseNamesAreJavascriptObjectPropertyNamesMap100Builder](#requiredpropertieswhosenamesarejavascriptobjectpropertynamesmap100builder) | setConstructor(value: Map) | + +## RequiredPropertiesWhoseNamesAreJavascriptObjectPropertyNamesMapBuilder +class RequiredPropertiesWhoseNamesAreJavascriptObjectPropertyNamesMapBuilder
    +builder for `Map` + +A class that builds the Map input type + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| RequiredPropertiesWhoseNamesAreJavascriptObjectPropertyNamesMapBuilder()
    Creates a builder that contains an empty map | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| [RequiredPropertiesWhoseNamesAreJavascriptObjectPropertyNamesMap011Builder](#requiredpropertieswhosenamesarejavascriptobjectpropertynamesmap011builder) | lowLineProto(value: Nothing?) | +| [RequiredPropertiesWhoseNamesAreJavascriptObjectPropertyNamesMap011Builder](#requiredpropertieswhosenamesarejavascriptobjectpropertynamesmap011builder) | lowLineProto(value: Boolean) | +| [RequiredPropertiesWhoseNamesAreJavascriptObjectPropertyNamesMap011Builder](#requiredpropertieswhosenamesarejavascriptobjectpropertynamesmap011builder) | lowLineProto(value: String) | +| [RequiredPropertiesWhoseNamesAreJavascriptObjectPropertyNamesMap011Builder](#requiredpropertieswhosenamesarejavascriptobjectpropertynamesmap011builder) | lowLineProto(value: Int) | +| [RequiredPropertiesWhoseNamesAreJavascriptObjectPropertyNamesMap011Builder](#requiredpropertieswhosenamesarejavascriptobjectpropertynamesmap011builder) | lowLineProto(value: Float) | +| [RequiredPropertiesWhoseNamesAreJavascriptObjectPropertyNamesMap011Builder](#requiredpropertieswhosenamesarejavascriptobjectpropertynamesmap011builder) | lowLineProto(value: Long) | +| [RequiredPropertiesWhoseNamesAreJavascriptObjectPropertyNamesMap011Builder](#requiredpropertieswhosenamesarejavascriptobjectpropertynamesmap011builder) | lowLineProto(value: Double) | +| [RequiredPropertiesWhoseNamesAreJavascriptObjectPropertyNamesMap011Builder](#requiredpropertieswhosenamesarejavascriptobjectpropertynamesmap011builder) | lowLineProto(value: List) | +| [RequiredPropertiesWhoseNamesAreJavascriptObjectPropertyNamesMap011Builder](#requiredpropertieswhosenamesarejavascriptobjectpropertynamesmap011builder) | lowLineProto(value: Map) | +| [RequiredPropertiesWhoseNamesAreJavascriptObjectPropertyNamesMap101Builder](#requiredpropertieswhosenamesarejavascriptobjectpropertynamesmap101builder) | setConstructor(value: Nothing?) | +| [RequiredPropertiesWhoseNamesAreJavascriptObjectPropertyNamesMap101Builder](#requiredpropertieswhosenamesarejavascriptobjectpropertynamesmap101builder) | setConstructor(value: Boolean) | +| [RequiredPropertiesWhoseNamesAreJavascriptObjectPropertyNamesMap101Builder](#requiredpropertieswhosenamesarejavascriptobjectpropertynamesmap101builder) | setConstructor(value: String) | +| [RequiredPropertiesWhoseNamesAreJavascriptObjectPropertyNamesMap101Builder](#requiredpropertieswhosenamesarejavascriptobjectpropertynamesmap101builder) | setConstructor(value: Int) | +| [RequiredPropertiesWhoseNamesAreJavascriptObjectPropertyNamesMap101Builder](#requiredpropertieswhosenamesarejavascriptobjectpropertynamesmap101builder) | setConstructor(value: Float) | +| [RequiredPropertiesWhoseNamesAreJavascriptObjectPropertyNamesMap101Builder](#requiredpropertieswhosenamesarejavascriptobjectpropertynamesmap101builder) | setConstructor(value: Long) | +| [RequiredPropertiesWhoseNamesAreJavascriptObjectPropertyNamesMap101Builder](#requiredpropertieswhosenamesarejavascriptobjectpropertynamesmap101builder) | setConstructor(value: Double) | +| [RequiredPropertiesWhoseNamesAreJavascriptObjectPropertyNamesMap101Builder](#requiredpropertieswhosenamesarejavascriptobjectpropertynamesmap101builder) | setConstructor(value: List) | +| [RequiredPropertiesWhoseNamesAreJavascriptObjectPropertyNamesMap101Builder](#requiredpropertieswhosenamesarejavascriptobjectpropertynamesmap101builder) | setConstructor(value: Map) | +| [RequiredPropertiesWhoseNamesAreJavascriptObjectPropertyNamesMap110Builder](#requiredpropertieswhosenamesarejavascriptobjectpropertynamesmap110builder) | toString(value: Nothing?) | +| [RequiredPropertiesWhoseNamesAreJavascriptObjectPropertyNamesMap110Builder](#requiredpropertieswhosenamesarejavascriptobjectpropertynamesmap110builder) | toString(value: Boolean) | +| [RequiredPropertiesWhoseNamesAreJavascriptObjectPropertyNamesMap110Builder](#requiredpropertieswhosenamesarejavascriptobjectpropertynamesmap110builder) | toString(value: String) | +| [RequiredPropertiesWhoseNamesAreJavascriptObjectPropertyNamesMap110Builder](#requiredpropertieswhosenamesarejavascriptobjectpropertynamesmap110builder) | toString(value: Int) | +| [RequiredPropertiesWhoseNamesAreJavascriptObjectPropertyNamesMap110Builder](#requiredpropertieswhosenamesarejavascriptobjectpropertynamesmap110builder) | toString(value: Float) | +| [RequiredPropertiesWhoseNamesAreJavascriptObjectPropertyNamesMap110Builder](#requiredpropertieswhosenamesarejavascriptobjectpropertynamesmap110builder) | toString(value: Long) | +| [RequiredPropertiesWhoseNamesAreJavascriptObjectPropertyNamesMap110Builder](#requiredpropertieswhosenamesarejavascriptobjectpropertynamesmap110builder) | toString(value: Double) | +| [RequiredPropertiesWhoseNamesAreJavascriptObjectPropertyNamesMap110Builder](#requiredpropertieswhosenamesarejavascriptobjectpropertynamesmap110builder) | toString(value: List) | +| [RequiredPropertiesWhoseNamesAreJavascriptObjectPropertyNamesMap110Builder](#requiredpropertieswhosenamesarejavascriptobjectpropertynamesmap110builder) | toString(value: Map) | + +## RequiredPropertiesWhoseNamesAreJavascriptObjectPropertyNamesMap +class RequiredPropertiesWhoseNamesAreJavascriptObjectPropertyNamesMap
    +extends FrozenMap + +A class to store validated Map payloads + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| static [RequiredPropertiesWhoseNamesAreJavascriptObjectPropertyNamesMap](#requiredpropertieswhosenamesarejavascriptobjectpropertynamesmap) | of([Map](#requiredpropertieswhosenamesarejavascriptobjectpropertynamesmapbuilder) arg, SchemaConfiguration configuration) | +| Any? | toString()
    | +| Any? | get(String key)
    This schema has invalid Kotlin names so this method must be used when you access instance["__proto__"], instance["constructor"], | +| Any? | getAdditionalProperty(String name)
    provides type safety for additional properties | + +[[Back to top]](#top) [[Back to Component Schemas]](../../../README.md#Component-Schemas) [[Back to README]](../../../README.md) diff --git a/samples/client/3_1_0_unit_test/kotlin/docs/components/schemas/RequiredValidation.md b/samples/client/3_1_0_unit_test/kotlin/docs/components/schemas/RequiredValidation.md new file mode 100644 index 00000000000..448abb465fe --- /dev/null +++ b/samples/client/3_1_0_unit_test/kotlin/docs/components/schemas/RequiredValidation.md @@ -0,0 +1,512 @@ +# RequiredValidation +org.openapijsonschematools.client.components.schemas.RequiredValidation.java +class RequiredValidation
    + +A class that contains necessary nested +- schema classes (which validate payloads), extends JsonSchema +- sealed interfaces which store validated payloads, Kotlin version of a sum type +- boxed classes which store validated payloads, sealed permits class implementations +- classes to store validated map payloads, extends FrozenMap +- classes to build inputs for map payloads + +## Nested Class Summary +| Modifier and Type | Class and Description | +| ----------------- | ---------------------- | +| sealed interface | [RequiredValidation.RequiredValidation1Boxed](#requiredvalidation1boxed)
    sealed interface for validated payloads | +| record | [RequiredValidation.RequiredValidation1BoxedVoid](#requiredvalidation1boxedvoid)
    boxed class to store validated null payloads | +| record | [RequiredValidation.RequiredValidation1BoxedBoolean](#requiredvalidation1boxedboolean)
    boxed class to store validated boolean payloads | +| record | [RequiredValidation.RequiredValidation1BoxedNumber](#requiredvalidation1boxednumber)
    boxed class to store validated Number payloads | +| record | [RequiredValidation.RequiredValidation1BoxedString](#requiredvalidation1boxedstring)
    boxed class to store validated String payloads | +| record | [RequiredValidation.RequiredValidation1BoxedList](#requiredvalidation1boxedlist)
    boxed class to store validated List payloads | +| record | [RequiredValidation.RequiredValidation1BoxedMap](#requiredvalidation1boxedmap)
    boxed class to store validated Map payloads | +| static class | [RequiredValidation.RequiredValidation1](#requiredvalidation1)
    schema class | +| static class | [RequiredValidation.RequiredValidationMapBuilder](#requiredvalidationmapbuilder)
    builder for Map payloads | +| static class | [RequiredValidation.RequiredValidationMap](#requiredvalidationmap)
    output class for Map payloads | +| sealed interface | [RequiredValidation.BarBoxed](#barboxed)
    sealed interface for validated payloads | +| record | [RequiredValidation.BarBoxedVoid](#barboxedvoid)
    boxed class to store validated null payloads | +| record | [RequiredValidation.BarBoxedBoolean](#barboxedboolean)
    boxed class to store validated boolean payloads | +| record | [RequiredValidation.BarBoxedNumber](#barboxednumber)
    boxed class to store validated Number payloads | +| record | [RequiredValidation.BarBoxedString](#barboxedstring)
    boxed class to store validated String payloads | +| record | [RequiredValidation.BarBoxedList](#barboxedlist)
    boxed class to store validated List payloads | +| record | [RequiredValidation.BarBoxedMap](#barboxedmap)
    boxed class to store validated Map payloads | +| static class | [RequiredValidation.Bar](#bar)
    schema class | +| sealed interface | [RequiredValidation.FooBoxed](#fooboxed)
    sealed interface for validated payloads | +| record | [RequiredValidation.FooBoxedVoid](#fooboxedvoid)
    boxed class to store validated null payloads | +| record | [RequiredValidation.FooBoxedBoolean](#fooboxedboolean)
    boxed class to store validated boolean payloads | +| record | [RequiredValidation.FooBoxedNumber](#fooboxednumber)
    boxed class to store validated Number payloads | +| record | [RequiredValidation.FooBoxedString](#fooboxedstring)
    boxed class to store validated String payloads | +| record | [RequiredValidation.FooBoxedList](#fooboxedlist)
    boxed class to store validated List payloads | +| record | [RequiredValidation.FooBoxedMap](#fooboxedmap)
    boxed class to store validated Map payloads | +| static class | [RequiredValidation.Foo](#foo)
    schema class | + +## RequiredValidation1Boxed +sealed interface RequiredValidation1Boxed
    +permits
    +[RequiredValidation1BoxedVoid](#requiredvalidation1boxedvoid), +[RequiredValidation1BoxedBoolean](#requiredvalidation1boxedboolean), +[RequiredValidation1BoxedNumber](#requiredvalidation1boxednumber), +[RequiredValidation1BoxedString](#requiredvalidation1boxedstring), +[RequiredValidation1BoxedList](#requiredvalidation1boxedlist), +[RequiredValidation1BoxedMap](#requiredvalidation1boxedmap) + +sealed interface that stores validated payloads using boxed classes + +## RequiredValidation1BoxedVoid +data class RequiredValidation1BoxedVoid
    +implements [RequiredValidation1Boxed](#requiredvalidation1boxed) + +data class that stores validated null payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| RequiredValidation1BoxedVoid(Nothing? data)
    Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| Nothing? | data()
    validated payload | +| Any? | getData()
    validated payload | + +## RequiredValidation1BoxedBoolean +data class RequiredValidation1BoxedBoolean
    +implements [RequiredValidation1Boxed](#requiredvalidation1boxed) + +record that stores validated boolean payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| RequiredValidation1BoxedBoolean(boolean data)
    Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| boolean | data()
    validated payload | +| Any? | getData()
    validated payload | + +## RequiredValidation1BoxedNumber +data class RequiredValidation1BoxedNumber
    +implements [RequiredValidation1Boxed](#requiredvalidation1boxed) + +data class that stores validated Number payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| RequiredValidation1BoxedNumber(Number data)
    Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| Number | data()
    validated payload | +| Any? | getData()
    validated payload | + +## RequiredValidation1BoxedString +data class RequiredValidation1BoxedString
    +implements [RequiredValidation1Boxed](#requiredvalidation1boxed) + +data class that stores validated String payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| RequiredValidation1BoxedString(String data)
    Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| String | data()
    validated payload | +| Any? | getData()
    validated payload | + +## RequiredValidation1BoxedList +data class RequiredValidation1BoxedList
    +implements [RequiredValidation1Boxed](#requiredvalidation1boxed) + +data class that stores validated List payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| RequiredValidation1BoxedList(FrozenList data)
    Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| FrozenList | data()
    validated payload | +| Any? | getData()
    validated payload | + +## RequiredValidation1BoxedMap +data class RequiredValidation1BoxedMap
    +implements [RequiredValidation1Boxed](#requiredvalidation1boxed) + +data class that stores validated Map payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| RequiredValidation1BoxedMap([RequiredValidationMap](#requiredvalidationmap) data)
    Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| [RequiredValidationMap](#requiredvalidationmap) | data()
    validated payload | +| Any? | getData()
    validated payload | + +## RequiredValidation1 +class RequiredValidation1
    +extends JsonSchema + +A schema class that validates payloads + +### Field Summary +| Modifier and Type | Field and Description | +| ----------------- | ---------------------- | +| Map> | properties = mapOf(
        "foo" to [Foo::class.java](#foo)),
        "bar" to [Bar::class.java](#bar))
    )
    | +| Set | required = setOf(
        "foo"
    )
    | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| String | validate(arg: String, configuration: SchemaConfiguration) | +| Nothing? | validate(arg: Nothing?, configuration: SchemaConfiguration) | +| int | validate(arg: int, configuration: SchemaConfiguration) | +| long | validate(arg: long, configuration: SchemaConfiguration) | +| float | validate(arg: float, configuration: SchemaConfiguration) | +| double | validate(arg: double, configuration: SchemaConfiguration) | +| Number | validate(arg: Number, configuration: SchemaConfiguration) | +| boolean | validate(arg: boolean, configuration: SchemaConfiguration) | +| [RequiredValidationMap](#requiredvalidationmap) | validate(arg: [Map<?, ?>](#requiredvalidationmapbuilder), configuration: SchemaConfiguration) | +| FrozenList | validate(arg: List<*>, configuration: SchemaConfiguration) | +| [RequiredValidation1BoxedString](#requiredvalidation1boxedstring) | validateAndBox(String, configuration: SchemaConfiguration) | +| [RequiredValidation1BoxedVoid](#requiredvalidation1boxedvoid) | validateAndBox(Nothing?, configuration: SchemaConfiguration) | +| [RequiredValidation1BoxedNumber](#requiredvalidation1boxednumber) | validateAndBox(Number, configuration: SchemaConfiguration) | +| [RequiredValidation1BoxedBoolean](#requiredvalidation1boxedboolean) | validateAndBox(boolean, configuration: SchemaConfiguration) | +| [RequiredValidation1BoxedMap](#requiredvalidation1boxedmap) | validateAndBox([Map<?, ?>](#requiredvalidationmapbuilder), configuration: SchemaConfiguration) | +| [RequiredValidation1BoxedList](#requiredvalidation1boxedlist) | validateAndBox(List<*>, configuration: SchemaConfiguration) | +| [RequiredValidation1Boxed](#requiredvalidation1boxed) | validateAndBox(Any?, configuration: SchemaConfiguration) | +| Any? | validate(arg: Any?, configuration: SchemaConfiguration) | + +## RequiredValidationMap0Builder +class RequiredValidationMap0Builder
    +builder for `Map` + +A class that builds the Map input type + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| RequiredValidationMap0Builder(Map instance)
    Creates a builder that contains the passed instance | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| Map | build()
    Returns map input that should be used with Schema.validate | +| [RequiredValidationMap0Builder](#requiredvalidationmap0builder) | bar(value: Nothing?) | +| [RequiredValidationMap0Builder](#requiredvalidationmap0builder) | bar(value: Boolean) | +| [RequiredValidationMap0Builder](#requiredvalidationmap0builder) | bar(value: String) | +| [RequiredValidationMap0Builder](#requiredvalidationmap0builder) | bar(value: Int) | +| [RequiredValidationMap0Builder](#requiredvalidationmap0builder) | bar(value: Float) | +| [RequiredValidationMap0Builder](#requiredvalidationmap0builder) | bar(value: Long) | +| [RequiredValidationMap0Builder](#requiredvalidationmap0builder) | bar(value: Double) | +| [RequiredValidationMap0Builder](#requiredvalidationmap0builder) | bar(value: List) | +| [RequiredValidationMap0Builder](#requiredvalidationmap0builder) | bar(value: Map) | +| [RequiredValidationMap0Builder](#requiredvalidationmap0builder) | additionalProperty(key: String, value: Nothing?) | +| [RequiredValidationMap0Builder](#requiredvalidationmap0builder) | additionalProperty(key: String, value: Boolean) | +| [RequiredValidationMap0Builder](#requiredvalidationmap0builder) | additionalProperty(key: String, value: String) | +| [RequiredValidationMap0Builder](#requiredvalidationmap0builder) | additionalProperty(key: String, value: Int) | +| [RequiredValidationMap0Builder](#requiredvalidationmap0builder) | additionalProperty(key: String, value: Float) | +| [RequiredValidationMap0Builder](#requiredvalidationmap0builder) | additionalProperty(key: String, value: Long) | +| [RequiredValidationMap0Builder](#requiredvalidationmap0builder) | additionalProperty(key: String, value: Double) | +| [RequiredValidationMap0Builder](#requiredvalidationmap0builder) | additionalProperty(key: String, value: List) | +| [RequiredValidationMap0Builder](#requiredvalidationmap0builder) | additionalProperty(key: String, value: Map) | + +## RequiredValidationMapBuilder +class RequiredValidationMapBuilder
    +builder for `Map` + +A class that builds the Map input type + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| RequiredValidationMapBuilder()
    Creates a builder that contains an empty map | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| [RequiredValidationMap0Builder](#requiredvalidationmap0builder) | foo(value: Nothing?) | +| [RequiredValidationMap0Builder](#requiredvalidationmap0builder) | foo(value: Boolean) | +| [RequiredValidationMap0Builder](#requiredvalidationmap0builder) | foo(value: String) | +| [RequiredValidationMap0Builder](#requiredvalidationmap0builder) | foo(value: Int) | +| [RequiredValidationMap0Builder](#requiredvalidationmap0builder) | foo(value: Float) | +| [RequiredValidationMap0Builder](#requiredvalidationmap0builder) | foo(value: Long) | +| [RequiredValidationMap0Builder](#requiredvalidationmap0builder) | foo(value: Double) | +| [RequiredValidationMap0Builder](#requiredvalidationmap0builder) | foo(value: List) | +| [RequiredValidationMap0Builder](#requiredvalidationmap0builder) | foo(value: Map) | + +## RequiredValidationMap +class RequiredValidationMap
    +extends FrozenMap + +A class to store validated Map payloads + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| static [RequiredValidationMap](#requiredvalidationmap) | of([Map](#requiredvalidationmapbuilder) arg, SchemaConfiguration configuration) | +| Any? | foo()
    | +| Any? | bar()
    [optional] | +| Any? | getAdditionalProperty(String name)
    provides type safety for additional properties | + +## BarBoxed +sealed interface BarBoxed
    +permits
    +[BarBoxedVoid](#barboxedvoid), +[BarBoxedBoolean](#barboxedboolean), +[BarBoxedNumber](#barboxednumber), +[BarBoxedString](#barboxedstring), +[BarBoxedList](#barboxedlist), +[BarBoxedMap](#barboxedmap) + +sealed interface that stores validated payloads using boxed classes + +## BarBoxedVoid +data class BarBoxedVoid
    +implements [BarBoxed](#barboxed) + +data class that stores validated null payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| BarBoxedVoid(Nothing? data)
    Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| Nothing? | data()
    validated payload | +| Any? | getData()
    validated payload | + +## BarBoxedBoolean +data class BarBoxedBoolean
    +implements [BarBoxed](#barboxed) + +record that stores validated boolean payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| BarBoxedBoolean(boolean data)
    Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| boolean | data()
    validated payload | +| Any? | getData()
    validated payload | + +## BarBoxedNumber +data class BarBoxedNumber
    +implements [BarBoxed](#barboxed) + +data class that stores validated Number payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| BarBoxedNumber(Number data)
    Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| Number | data()
    validated payload | +| Any? | getData()
    validated payload | + +## BarBoxedString +data class BarBoxedString
    +implements [BarBoxed](#barboxed) + +data class that stores validated String payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| BarBoxedString(String data)
    Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| String | data()
    validated payload | +| Any? | getData()
    validated payload | + +## BarBoxedList +data class BarBoxedList
    +implements [BarBoxed](#barboxed) + +data class that stores validated List payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| BarBoxedList(FrozenList data)
    Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| FrozenList | data()
    validated payload | +| Any? | getData()
    validated payload | + +## BarBoxedMap +data class BarBoxedMap
    +implements [BarBoxed](#barboxed) + +data class that stores validated Map payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| BarBoxedMap(FrozenMap data)
    Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| FrozenMap | data()
    validated payload | +| Any? | getData()
    validated payload | + +## Bar +class Bar
    +extends AnyTypeJsonSchema.AnyTypeJsonSchema1 + +A schema class that validates payloads + +| Methods Inherited from class org.openapijsonschematools.client.schemas.AnyTypeJsonSchema.AnyTypeJsonSchema1 | +| ------------------------------------------------------------------ | +| validate | +| validateAndBox | + +## FooBoxed +sealed interface FooBoxed
    +permits
    +[FooBoxedVoid](#fooboxedvoid), +[FooBoxedBoolean](#fooboxedboolean), +[FooBoxedNumber](#fooboxednumber), +[FooBoxedString](#fooboxedstring), +[FooBoxedList](#fooboxedlist), +[FooBoxedMap](#fooboxedmap) + +sealed interface that stores validated payloads using boxed classes + +## FooBoxedVoid +data class FooBoxedVoid
    +implements [FooBoxed](#fooboxed) + +data class that stores validated null payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| FooBoxedVoid(Nothing? data)
    Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| Nothing? | data()
    validated payload | +| Any? | getData()
    validated payload | + +## FooBoxedBoolean +data class FooBoxedBoolean
    +implements [FooBoxed](#fooboxed) + +record that stores validated boolean payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| FooBoxedBoolean(boolean data)
    Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| boolean | data()
    validated payload | +| Any? | getData()
    validated payload | + +## FooBoxedNumber +data class FooBoxedNumber
    +implements [FooBoxed](#fooboxed) + +data class that stores validated Number payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| FooBoxedNumber(Number data)
    Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| Number | data()
    validated payload | +| Any? | getData()
    validated payload | + +## FooBoxedString +data class FooBoxedString
    +implements [FooBoxed](#fooboxed) + +data class that stores validated String payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| FooBoxedString(String data)
    Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| String | data()
    validated payload | +| Any? | getData()
    validated payload | + +## FooBoxedList +data class FooBoxedList
    +implements [FooBoxed](#fooboxed) + +data class that stores validated List payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| FooBoxedList(FrozenList data)
    Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| FrozenList | data()
    validated payload | +| Any? | getData()
    validated payload | + +## FooBoxedMap +data class FooBoxedMap
    +implements [FooBoxed](#fooboxed) + +data class that stores validated Map payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| FooBoxedMap(FrozenMap data)
    Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| FrozenMap | data()
    validated payload | +| Any? | getData()
    validated payload | + +## Foo +class Foo
    +extends AnyTypeJsonSchema.AnyTypeJsonSchema1 + +A schema class that validates payloads + +| Methods Inherited from class org.openapijsonschematools.client.schemas.AnyTypeJsonSchema.AnyTypeJsonSchema1 | +| ------------------------------------------------------------------ | +| validate | +| validateAndBox | + +[[Back to top]](#top) [[Back to Component Schemas]](../../../README.md#Component-Schemas) [[Back to README]](../../../README.md) diff --git a/samples/client/3_1_0_unit_test/kotlin/docs/components/schemas/RequiredWithEmptyArray.md b/samples/client/3_1_0_unit_test/kotlin/docs/components/schemas/RequiredWithEmptyArray.md new file mode 100644 index 00000000000..85125a5f8d2 --- /dev/null +++ b/samples/client/3_1_0_unit_test/kotlin/docs/components/schemas/RequiredWithEmptyArray.md @@ -0,0 +1,353 @@ +# RequiredWithEmptyArray +org.openapijsonschematools.client.components.schemas.RequiredWithEmptyArray.java +class RequiredWithEmptyArray
    + +A class that contains necessary nested +- schema classes (which validate payloads), extends JsonSchema +- sealed interfaces which store validated payloads, Kotlin version of a sum type +- boxed classes which store validated payloads, sealed permits class implementations +- classes to store validated map payloads, extends FrozenMap +- classes to build inputs for map payloads + +## Nested Class Summary +| Modifier and Type | Class and Description | +| ----------------- | ---------------------- | +| sealed interface | [RequiredWithEmptyArray.RequiredWithEmptyArray1Boxed](#requiredwithemptyarray1boxed)
    sealed interface for validated payloads | +| record | [RequiredWithEmptyArray.RequiredWithEmptyArray1BoxedVoid](#requiredwithemptyarray1boxedvoid)
    boxed class to store validated null payloads | +| record | [RequiredWithEmptyArray.RequiredWithEmptyArray1BoxedBoolean](#requiredwithemptyarray1boxedboolean)
    boxed class to store validated boolean payloads | +| record | [RequiredWithEmptyArray.RequiredWithEmptyArray1BoxedNumber](#requiredwithemptyarray1boxednumber)
    boxed class to store validated Number payloads | +| record | [RequiredWithEmptyArray.RequiredWithEmptyArray1BoxedString](#requiredwithemptyarray1boxedstring)
    boxed class to store validated String payloads | +| record | [RequiredWithEmptyArray.RequiredWithEmptyArray1BoxedList](#requiredwithemptyarray1boxedlist)
    boxed class to store validated List payloads | +| record | [RequiredWithEmptyArray.RequiredWithEmptyArray1BoxedMap](#requiredwithemptyarray1boxedmap)
    boxed class to store validated Map payloads | +| static class | [RequiredWithEmptyArray.RequiredWithEmptyArray1](#requiredwithemptyarray1)
    schema class | +| static class | [RequiredWithEmptyArray.RequiredWithEmptyArrayMapBuilder](#requiredwithemptyarraymapbuilder)
    builder for Map payloads | +| static class | [RequiredWithEmptyArray.RequiredWithEmptyArrayMap](#requiredwithemptyarraymap)
    output class for Map payloads | +| sealed interface | [RequiredWithEmptyArray.FooBoxed](#fooboxed)
    sealed interface for validated payloads | +| record | [RequiredWithEmptyArray.FooBoxedVoid](#fooboxedvoid)
    boxed class to store validated null payloads | +| record | [RequiredWithEmptyArray.FooBoxedBoolean](#fooboxedboolean)
    boxed class to store validated boolean payloads | +| record | [RequiredWithEmptyArray.FooBoxedNumber](#fooboxednumber)
    boxed class to store validated Number payloads | +| record | [RequiredWithEmptyArray.FooBoxedString](#fooboxedstring)
    boxed class to store validated String payloads | +| record | [RequiredWithEmptyArray.FooBoxedList](#fooboxedlist)
    boxed class to store validated List payloads | +| record | [RequiredWithEmptyArray.FooBoxedMap](#fooboxedmap)
    boxed class to store validated Map payloads | +| static class | [RequiredWithEmptyArray.Foo](#foo)
    schema class | + +## RequiredWithEmptyArray1Boxed +sealed interface RequiredWithEmptyArray1Boxed
    +permits
    +[RequiredWithEmptyArray1BoxedVoid](#requiredwithemptyarray1boxedvoid), +[RequiredWithEmptyArray1BoxedBoolean](#requiredwithemptyarray1boxedboolean), +[RequiredWithEmptyArray1BoxedNumber](#requiredwithemptyarray1boxednumber), +[RequiredWithEmptyArray1BoxedString](#requiredwithemptyarray1boxedstring), +[RequiredWithEmptyArray1BoxedList](#requiredwithemptyarray1boxedlist), +[RequiredWithEmptyArray1BoxedMap](#requiredwithemptyarray1boxedmap) + +sealed interface that stores validated payloads using boxed classes + +## RequiredWithEmptyArray1BoxedVoid +data class RequiredWithEmptyArray1BoxedVoid
    +implements [RequiredWithEmptyArray1Boxed](#requiredwithemptyarray1boxed) + +data class that stores validated null payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| RequiredWithEmptyArray1BoxedVoid(Nothing? data)
    Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| Nothing? | data()
    validated payload | +| Any? | getData()
    validated payload | + +## RequiredWithEmptyArray1BoxedBoolean +data class RequiredWithEmptyArray1BoxedBoolean
    +implements [RequiredWithEmptyArray1Boxed](#requiredwithemptyarray1boxed) + +record that stores validated boolean payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| RequiredWithEmptyArray1BoxedBoolean(boolean data)
    Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| boolean | data()
    validated payload | +| Any? | getData()
    validated payload | + +## RequiredWithEmptyArray1BoxedNumber +data class RequiredWithEmptyArray1BoxedNumber
    +implements [RequiredWithEmptyArray1Boxed](#requiredwithemptyarray1boxed) + +data class that stores validated Number payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| RequiredWithEmptyArray1BoxedNumber(Number data)
    Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| Number | data()
    validated payload | +| Any? | getData()
    validated payload | + +## RequiredWithEmptyArray1BoxedString +data class RequiredWithEmptyArray1BoxedString
    +implements [RequiredWithEmptyArray1Boxed](#requiredwithemptyarray1boxed) + +data class that stores validated String payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| RequiredWithEmptyArray1BoxedString(String data)
    Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| String | data()
    validated payload | +| Any? | getData()
    validated payload | + +## RequiredWithEmptyArray1BoxedList +data class RequiredWithEmptyArray1BoxedList
    +implements [RequiredWithEmptyArray1Boxed](#requiredwithemptyarray1boxed) + +data class that stores validated List payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| RequiredWithEmptyArray1BoxedList(FrozenList data)
    Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| FrozenList | data()
    validated payload | +| Any? | getData()
    validated payload | + +## RequiredWithEmptyArray1BoxedMap +data class RequiredWithEmptyArray1BoxedMap
    +implements [RequiredWithEmptyArray1Boxed](#requiredwithemptyarray1boxed) + +data class that stores validated Map payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| RequiredWithEmptyArray1BoxedMap([RequiredWithEmptyArrayMap](#requiredwithemptyarraymap) data)
    Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| [RequiredWithEmptyArrayMap](#requiredwithemptyarraymap) | data()
    validated payload | +| Any? | getData()
    validated payload | + +## RequiredWithEmptyArray1 +class RequiredWithEmptyArray1
    +extends JsonSchema + +A schema class that validates payloads + +### Field Summary +| Modifier and Type | Field and Description | +| ----------------- | ---------------------- | +| Map> | properties = mapOf(
        "foo" to [Foo::class.java](#foo))
    )
    | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| String | validate(arg: String, configuration: SchemaConfiguration) | +| Nothing? | validate(arg: Nothing?, configuration: SchemaConfiguration) | +| int | validate(arg: int, configuration: SchemaConfiguration) | +| long | validate(arg: long, configuration: SchemaConfiguration) | +| float | validate(arg: float, configuration: SchemaConfiguration) | +| double | validate(arg: double, configuration: SchemaConfiguration) | +| Number | validate(arg: Number, configuration: SchemaConfiguration) | +| boolean | validate(arg: boolean, configuration: SchemaConfiguration) | +| [RequiredWithEmptyArrayMap](#requiredwithemptyarraymap) | validate(arg: [Map<?, ?>](#requiredwithemptyarraymapbuilder), configuration: SchemaConfiguration) | +| FrozenList | validate(arg: List<*>, configuration: SchemaConfiguration) | +| [RequiredWithEmptyArray1BoxedString](#requiredwithemptyarray1boxedstring) | validateAndBox(String, configuration: SchemaConfiguration) | +| [RequiredWithEmptyArray1BoxedVoid](#requiredwithemptyarray1boxedvoid) | validateAndBox(Nothing?, configuration: SchemaConfiguration) | +| [RequiredWithEmptyArray1BoxedNumber](#requiredwithemptyarray1boxednumber) | validateAndBox(Number, configuration: SchemaConfiguration) | +| [RequiredWithEmptyArray1BoxedBoolean](#requiredwithemptyarray1boxedboolean) | validateAndBox(boolean, configuration: SchemaConfiguration) | +| [RequiredWithEmptyArray1BoxedMap](#requiredwithemptyarray1boxedmap) | validateAndBox([Map<?, ?>](#requiredwithemptyarraymapbuilder), configuration: SchemaConfiguration) | +| [RequiredWithEmptyArray1BoxedList](#requiredwithemptyarray1boxedlist) | validateAndBox(List<*>, configuration: SchemaConfiguration) | +| [RequiredWithEmptyArray1Boxed](#requiredwithemptyarray1boxed) | validateAndBox(Any?, configuration: SchemaConfiguration) | +| Any? | validate(arg: Any?, configuration: SchemaConfiguration) | + +## RequiredWithEmptyArrayMapBuilder +class RequiredWithEmptyArrayMapBuilder
    +builder for `Map` + +A class that builds the Map input type + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| RequiredWithEmptyArrayMapBuilder()
    Creates a builder that contains an empty map | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| Map | build()
    Returns map input that should be used with Schema.validate | +| [RequiredWithEmptyArrayMapBuilder](#requiredwithemptyarraymapbuilder) | foo(value: Nothing?) | +| [RequiredWithEmptyArrayMapBuilder](#requiredwithemptyarraymapbuilder) | foo(value: Boolean) | +| [RequiredWithEmptyArrayMapBuilder](#requiredwithemptyarraymapbuilder) | foo(value: String) | +| [RequiredWithEmptyArrayMapBuilder](#requiredwithemptyarraymapbuilder) | foo(value: Int) | +| [RequiredWithEmptyArrayMapBuilder](#requiredwithemptyarraymapbuilder) | foo(value: Float) | +| [RequiredWithEmptyArrayMapBuilder](#requiredwithemptyarraymapbuilder) | foo(value: Long) | +| [RequiredWithEmptyArrayMapBuilder](#requiredwithemptyarraymapbuilder) | foo(value: Double) | +| [RequiredWithEmptyArrayMapBuilder](#requiredwithemptyarraymapbuilder) | foo(value: List) | +| [RequiredWithEmptyArrayMapBuilder](#requiredwithemptyarraymapbuilder) | foo(value: Map) | +| [RequiredWithEmptyArrayMapBuilder](#requiredwithemptyarraymapbuilder) | additionalProperty(key: String, value: Nothing?) | +| [RequiredWithEmptyArrayMapBuilder](#requiredwithemptyarraymapbuilder) | additionalProperty(key: String, value: Boolean) | +| [RequiredWithEmptyArrayMapBuilder](#requiredwithemptyarraymapbuilder) | additionalProperty(key: String, value: String) | +| [RequiredWithEmptyArrayMapBuilder](#requiredwithemptyarraymapbuilder) | additionalProperty(key: String, value: Int) | +| [RequiredWithEmptyArrayMapBuilder](#requiredwithemptyarraymapbuilder) | additionalProperty(key: String, value: Float) | +| [RequiredWithEmptyArrayMapBuilder](#requiredwithemptyarraymapbuilder) | additionalProperty(key: String, value: Long) | +| [RequiredWithEmptyArrayMapBuilder](#requiredwithemptyarraymapbuilder) | additionalProperty(key: String, value: Double) | +| [RequiredWithEmptyArrayMapBuilder](#requiredwithemptyarraymapbuilder) | additionalProperty(key: String, value: List) | +| [RequiredWithEmptyArrayMapBuilder](#requiredwithemptyarraymapbuilder) | additionalProperty(key: String, value: Map) | + +## RequiredWithEmptyArrayMap +class RequiredWithEmptyArrayMap
    +extends FrozenMap + +A class to store validated Map payloads + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| static [RequiredWithEmptyArrayMap](#requiredwithemptyarraymap) | of([Map](#requiredwithemptyarraymapbuilder) arg, SchemaConfiguration configuration) | +| Any? | foo()
    [optional] | +| Any? | getAdditionalProperty(String name)
    provides type safety for additional properties | + +## FooBoxed +sealed interface FooBoxed
    +permits
    +[FooBoxedVoid](#fooboxedvoid), +[FooBoxedBoolean](#fooboxedboolean), +[FooBoxedNumber](#fooboxednumber), +[FooBoxedString](#fooboxedstring), +[FooBoxedList](#fooboxedlist), +[FooBoxedMap](#fooboxedmap) + +sealed interface that stores validated payloads using boxed classes + +## FooBoxedVoid +data class FooBoxedVoid
    +implements [FooBoxed](#fooboxed) + +data class that stores validated null payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| FooBoxedVoid(Nothing? data)
    Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| Nothing? | data()
    validated payload | +| Any? | getData()
    validated payload | + +## FooBoxedBoolean +data class FooBoxedBoolean
    +implements [FooBoxed](#fooboxed) + +record that stores validated boolean payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| FooBoxedBoolean(boolean data)
    Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| boolean | data()
    validated payload | +| Any? | getData()
    validated payload | + +## FooBoxedNumber +data class FooBoxedNumber
    +implements [FooBoxed](#fooboxed) + +data class that stores validated Number payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| FooBoxedNumber(Number data)
    Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| Number | data()
    validated payload | +| Any? | getData()
    validated payload | + +## FooBoxedString +data class FooBoxedString
    +implements [FooBoxed](#fooboxed) + +data class that stores validated String payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| FooBoxedString(String data)
    Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| String | data()
    validated payload | +| Any? | getData()
    validated payload | + +## FooBoxedList +data class FooBoxedList
    +implements [FooBoxed](#fooboxed) + +data class that stores validated List payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| FooBoxedList(FrozenList data)
    Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| FrozenList | data()
    validated payload | +| Any? | getData()
    validated payload | + +## FooBoxedMap +data class FooBoxedMap
    +implements [FooBoxed](#fooboxed) + +data class that stores validated Map payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| FooBoxedMap(FrozenMap data)
    Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| FrozenMap | data()
    validated payload | +| Any? | getData()
    validated payload | + +## Foo +class Foo
    +extends AnyTypeJsonSchema.AnyTypeJsonSchema1 + +A schema class that validates payloads + +| Methods Inherited from class org.openapijsonschematools.client.schemas.AnyTypeJsonSchema.AnyTypeJsonSchema1 | +| ------------------------------------------------------------------ | +| validate | +| validateAndBox | + +[[Back to top]](#top) [[Back to Component Schemas]](../../../README.md#Component-Schemas) [[Back to README]](../../../README.md) diff --git a/samples/client/3_1_0_unit_test/kotlin/docs/components/schemas/RequiredWithEscapedCharacters.md b/samples/client/3_1_0_unit_test/kotlin/docs/components/schemas/RequiredWithEscapedCharacters.md new file mode 100644 index 00000000000..eb8d365df0d --- /dev/null +++ b/samples/client/3_1_0_unit_test/kotlin/docs/components/schemas/RequiredWithEscapedCharacters.md @@ -0,0 +1,2884 @@ +# RequiredWithEscapedCharacters +org.openapijsonschematools.client.components.schemas.RequiredWithEscapedCharacters.java +class RequiredWithEscapedCharacters
    + +A class that contains necessary nested +- schema classes (which validate payloads), extends JsonSchema +- sealed interfaces which store validated payloads, Kotlin version of a sum type +- boxed classes which store validated payloads, sealed permits class implementations +- classes to store validated map payloads, extends FrozenMap +- classes to build inputs for map payloads + +## Nested Class Summary +| Modifier and Type | Class and Description | +| ----------------- | ---------------------- | +| sealed interface | [RequiredWithEscapedCharacters.RequiredWithEscapedCharacters1Boxed](#requiredwithescapedcharacters1boxed)
    sealed interface for validated payloads | +| record | [RequiredWithEscapedCharacters.RequiredWithEscapedCharacters1BoxedVoid](#requiredwithescapedcharacters1boxedvoid)
    boxed class to store validated null payloads | +| record | [RequiredWithEscapedCharacters.RequiredWithEscapedCharacters1BoxedBoolean](#requiredwithescapedcharacters1boxedboolean)
    boxed class to store validated boolean payloads | +| record | [RequiredWithEscapedCharacters.RequiredWithEscapedCharacters1BoxedNumber](#requiredwithescapedcharacters1boxednumber)
    boxed class to store validated Number payloads | +| record | [RequiredWithEscapedCharacters.RequiredWithEscapedCharacters1BoxedString](#requiredwithescapedcharacters1boxedstring)
    boxed class to store validated String payloads | +| record | [RequiredWithEscapedCharacters.RequiredWithEscapedCharacters1BoxedList](#requiredwithescapedcharacters1boxedlist)
    boxed class to store validated List payloads | +| record | [RequiredWithEscapedCharacters.RequiredWithEscapedCharacters1BoxedMap](#requiredwithescapedcharacters1boxedmap)
    boxed class to store validated Map payloads | +| static class | [RequiredWithEscapedCharacters.RequiredWithEscapedCharacters1](#requiredwithescapedcharacters1)
    schema class | +| static class | [RequiredWithEscapedCharacters.RequiredWithEscapedCharactersMapBuilder](#requiredwithescapedcharactersmapbuilder)
    builder for Map payloads | +| static class | [RequiredWithEscapedCharacters.RequiredWithEscapedCharactersMap](#requiredwithescapedcharactersmap)
    output class for Map payloads | + +## RequiredWithEscapedCharacters1Boxed +sealed interface RequiredWithEscapedCharacters1Boxed
    +permits
    +[RequiredWithEscapedCharacters1BoxedVoid](#requiredwithescapedcharacters1boxedvoid), +[RequiredWithEscapedCharacters1BoxedBoolean](#requiredwithescapedcharacters1boxedboolean), +[RequiredWithEscapedCharacters1BoxedNumber](#requiredwithescapedcharacters1boxednumber), +[RequiredWithEscapedCharacters1BoxedString](#requiredwithescapedcharacters1boxedstring), +[RequiredWithEscapedCharacters1BoxedList](#requiredwithescapedcharacters1boxedlist), +[RequiredWithEscapedCharacters1BoxedMap](#requiredwithescapedcharacters1boxedmap) + +sealed interface that stores validated payloads using boxed classes + +## RequiredWithEscapedCharacters1BoxedVoid +data class RequiredWithEscapedCharacters1BoxedVoid
    +implements [RequiredWithEscapedCharacters1Boxed](#requiredwithescapedcharacters1boxed) + +data class that stores validated null payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| RequiredWithEscapedCharacters1BoxedVoid(Nothing? data)
    Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| Nothing? | data()
    validated payload | +| Any? | getData()
    validated payload | + +## RequiredWithEscapedCharacters1BoxedBoolean +data class RequiredWithEscapedCharacters1BoxedBoolean
    +implements [RequiredWithEscapedCharacters1Boxed](#requiredwithescapedcharacters1boxed) + +record that stores validated boolean payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| RequiredWithEscapedCharacters1BoxedBoolean(boolean data)
    Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| boolean | data()
    validated payload | +| Any? | getData()
    validated payload | + +## RequiredWithEscapedCharacters1BoxedNumber +data class RequiredWithEscapedCharacters1BoxedNumber
    +implements [RequiredWithEscapedCharacters1Boxed](#requiredwithescapedcharacters1boxed) + +data class that stores validated Number payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| RequiredWithEscapedCharacters1BoxedNumber(Number data)
    Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| Number | data()
    validated payload | +| Any? | getData()
    validated payload | + +## RequiredWithEscapedCharacters1BoxedString +data class RequiredWithEscapedCharacters1BoxedString
    +implements [RequiredWithEscapedCharacters1Boxed](#requiredwithescapedcharacters1boxed) + +data class that stores validated String payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| RequiredWithEscapedCharacters1BoxedString(String data)
    Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| String | data()
    validated payload | +| Any? | getData()
    validated payload | + +## RequiredWithEscapedCharacters1BoxedList +data class RequiredWithEscapedCharacters1BoxedList
    +implements [RequiredWithEscapedCharacters1Boxed](#requiredwithescapedcharacters1boxed) + +data class that stores validated List payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| RequiredWithEscapedCharacters1BoxedList(FrozenList data)
    Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| FrozenList | data()
    validated payload | +| Any? | getData()
    validated payload | + +## RequiredWithEscapedCharacters1BoxedMap +data class RequiredWithEscapedCharacters1BoxedMap
    +implements [RequiredWithEscapedCharacters1Boxed](#requiredwithescapedcharacters1boxed) + +data class that stores validated Map payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| RequiredWithEscapedCharacters1BoxedMap([RequiredWithEscapedCharactersMap](#requiredwithescapedcharactersmap) data)
    Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| [RequiredWithEscapedCharactersMap](#requiredwithescapedcharactersmap) | data()
    validated payload | +| Any? | getData()
    validated payload | + +## RequiredWithEscapedCharacters1 +class RequiredWithEscapedCharacters1
    +extends JsonSchema + +A schema class that validates payloads + +### Field Summary +| Modifier and Type | Field and Description | +| ----------------- | ---------------------- | +| Set | required = setOf(
        "foo\tbar",
        "foo\nbar",
        "foo\u000Cbar",
        "foo\rbar",
        "foo\"bar",
        "foo\\bar"
    )
    | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| String | validate(arg: String, configuration: SchemaConfiguration) | +| Nothing? | validate(arg: Nothing?, configuration: SchemaConfiguration) | +| int | validate(arg: int, configuration: SchemaConfiguration) | +| long | validate(arg: long, configuration: SchemaConfiguration) | +| float | validate(arg: float, configuration: SchemaConfiguration) | +| double | validate(arg: double, configuration: SchemaConfiguration) | +| Number | validate(arg: Number, configuration: SchemaConfiguration) | +| boolean | validate(arg: boolean, configuration: SchemaConfiguration) | +| [RequiredWithEscapedCharactersMap](#requiredwithescapedcharactersmap) | validate(arg: [Map<?, ?>](#requiredwithescapedcharactersmapbuilder), configuration: SchemaConfiguration) | +| FrozenList | validate(arg: List<*>, configuration: SchemaConfiguration) | +| [RequiredWithEscapedCharacters1BoxedString](#requiredwithescapedcharacters1boxedstring) | validateAndBox(String, configuration: SchemaConfiguration) | +| [RequiredWithEscapedCharacters1BoxedVoid](#requiredwithescapedcharacters1boxedvoid) | validateAndBox(Nothing?, configuration: SchemaConfiguration) | +| [RequiredWithEscapedCharacters1BoxedNumber](#requiredwithescapedcharacters1boxednumber) | validateAndBox(Number, configuration: SchemaConfiguration) | +| [RequiredWithEscapedCharacters1BoxedBoolean](#requiredwithescapedcharacters1boxedboolean) | validateAndBox(boolean, configuration: SchemaConfiguration) | +| [RequiredWithEscapedCharacters1BoxedMap](#requiredwithescapedcharacters1boxedmap) | validateAndBox([Map<?, ?>](#requiredwithescapedcharactersmapbuilder), configuration: SchemaConfiguration) | +| [RequiredWithEscapedCharacters1BoxedList](#requiredwithescapedcharacters1boxedlist) | validateAndBox(List<*>, configuration: SchemaConfiguration) | +| [RequiredWithEscapedCharacters1Boxed](#requiredwithescapedcharacters1boxed) | validateAndBox(Any?, configuration: SchemaConfiguration) | +| Any? | validate(arg: Any?, configuration: SchemaConfiguration) | + +## RequiredWithEscapedCharactersMap000000Builder +class RequiredWithEscapedCharactersMap000000Builder
    +builder for `Map` + +A class that builds the Map input type + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| RequiredWithEscapedCharactersMap000000Builder(Map instance)
    Creates a builder that contains the passed instance | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| Map | build()
    Returns map input that should be used with Schema.validate | +| [RequiredWithEscapedCharactersMap000000Builder](#requiredwithescapedcharactersmap000000builder) | additionalProperty(key: String, value: Nothing?) | +| [RequiredWithEscapedCharactersMap000000Builder](#requiredwithescapedcharactersmap000000builder) | additionalProperty(key: String, value: Boolean) | +| [RequiredWithEscapedCharactersMap000000Builder](#requiredwithescapedcharactersmap000000builder) | additionalProperty(key: String, value: String) | +| [RequiredWithEscapedCharactersMap000000Builder](#requiredwithescapedcharactersmap000000builder) | additionalProperty(key: String, value: Int) | +| [RequiredWithEscapedCharactersMap000000Builder](#requiredwithescapedcharactersmap000000builder) | additionalProperty(key: String, value: Float) | +| [RequiredWithEscapedCharactersMap000000Builder](#requiredwithescapedcharactersmap000000builder) | additionalProperty(key: String, value: Long) | +| [RequiredWithEscapedCharactersMap000000Builder](#requiredwithescapedcharactersmap000000builder) | additionalProperty(key: String, value: Double) | +| [RequiredWithEscapedCharactersMap000000Builder](#requiredwithescapedcharactersmap000000builder) | additionalProperty(key: String, value: List) | +| [RequiredWithEscapedCharactersMap000000Builder](#requiredwithescapedcharactersmap000000builder) | additionalProperty(key: String, value: Map) | + +## RequiredWithEscapedCharactersMap000001Builder +class RequiredWithEscapedCharactersMap000001Builder
    +builder for `Map` + +A class that builds the Map input type + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| RequiredWithEscapedCharactersMap000001Builder(Map instance)
    Creates a builder that contains the passed instance | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| [RequiredWithEscapedCharactersMap000000Builder](#requiredwithescapedcharactersmap000000builder) | fooReverseSolidusReverseSolidusBar(value: Nothing?) | +| [RequiredWithEscapedCharactersMap000000Builder](#requiredwithescapedcharactersmap000000builder) | fooReverseSolidusReverseSolidusBar(value: Boolean) | +| [RequiredWithEscapedCharactersMap000000Builder](#requiredwithescapedcharactersmap000000builder) | fooReverseSolidusReverseSolidusBar(value: String) | +| [RequiredWithEscapedCharactersMap000000Builder](#requiredwithescapedcharactersmap000000builder) | fooReverseSolidusReverseSolidusBar(value: Int) | +| [RequiredWithEscapedCharactersMap000000Builder](#requiredwithescapedcharactersmap000000builder) | fooReverseSolidusReverseSolidusBar(value: Float) | +| [RequiredWithEscapedCharactersMap000000Builder](#requiredwithescapedcharactersmap000000builder) | fooReverseSolidusReverseSolidusBar(value: Long) | +| [RequiredWithEscapedCharactersMap000000Builder](#requiredwithescapedcharactersmap000000builder) | fooReverseSolidusReverseSolidusBar(value: Double) | +| [RequiredWithEscapedCharactersMap000000Builder](#requiredwithescapedcharactersmap000000builder) | fooReverseSolidusReverseSolidusBar(value: List) | +| [RequiredWithEscapedCharactersMap000000Builder](#requiredwithescapedcharactersmap000000builder) | fooReverseSolidusReverseSolidusBar(value: Map) | + +## RequiredWithEscapedCharactersMap000010Builder +class RequiredWithEscapedCharactersMap000010Builder
    +builder for `Map` + +A class that builds the Map input type + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| RequiredWithEscapedCharactersMap000010Builder(Map instance)
    Creates a builder that contains the passed instance | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| [RequiredWithEscapedCharactersMap000000Builder](#requiredwithescapedcharactersmap000000builder) | fooReverseSolidusQuotationMarkBar(value: Nothing?) | +| [RequiredWithEscapedCharactersMap000000Builder](#requiredwithescapedcharactersmap000000builder) | fooReverseSolidusQuotationMarkBar(value: Boolean) | +| [RequiredWithEscapedCharactersMap000000Builder](#requiredwithescapedcharactersmap000000builder) | fooReverseSolidusQuotationMarkBar(value: String) | +| [RequiredWithEscapedCharactersMap000000Builder](#requiredwithescapedcharactersmap000000builder) | fooReverseSolidusQuotationMarkBar(value: Int) | +| [RequiredWithEscapedCharactersMap000000Builder](#requiredwithescapedcharactersmap000000builder) | fooReverseSolidusQuotationMarkBar(value: Float) | +| [RequiredWithEscapedCharactersMap000000Builder](#requiredwithescapedcharactersmap000000builder) | fooReverseSolidusQuotationMarkBar(value: Long) | +| [RequiredWithEscapedCharactersMap000000Builder](#requiredwithescapedcharactersmap000000builder) | fooReverseSolidusQuotationMarkBar(value: Double) | +| [RequiredWithEscapedCharactersMap000000Builder](#requiredwithescapedcharactersmap000000builder) | fooReverseSolidusQuotationMarkBar(value: List) | +| [RequiredWithEscapedCharactersMap000000Builder](#requiredwithescapedcharactersmap000000builder) | fooReverseSolidusQuotationMarkBar(value: Map) | + +## RequiredWithEscapedCharactersMap000011Builder +class RequiredWithEscapedCharactersMap000011Builder
    +builder for `Map` + +A class that builds the Map input type + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| RequiredWithEscapedCharactersMap000011Builder(Map instance)
    Creates a builder that contains the passed instance | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| [RequiredWithEscapedCharactersMap000001Builder](#requiredwithescapedcharactersmap000001builder) | fooReverseSolidusQuotationMarkBar(value: Nothing?) | +| [RequiredWithEscapedCharactersMap000001Builder](#requiredwithescapedcharactersmap000001builder) | fooReverseSolidusQuotationMarkBar(value: Boolean) | +| [RequiredWithEscapedCharactersMap000001Builder](#requiredwithescapedcharactersmap000001builder) | fooReverseSolidusQuotationMarkBar(value: String) | +| [RequiredWithEscapedCharactersMap000001Builder](#requiredwithescapedcharactersmap000001builder) | fooReverseSolidusQuotationMarkBar(value: Int) | +| [RequiredWithEscapedCharactersMap000001Builder](#requiredwithescapedcharactersmap000001builder) | fooReverseSolidusQuotationMarkBar(value: Float) | +| [RequiredWithEscapedCharactersMap000001Builder](#requiredwithescapedcharactersmap000001builder) | fooReverseSolidusQuotationMarkBar(value: Long) | +| [RequiredWithEscapedCharactersMap000001Builder](#requiredwithescapedcharactersmap000001builder) | fooReverseSolidusQuotationMarkBar(value: Double) | +| [RequiredWithEscapedCharactersMap000001Builder](#requiredwithescapedcharactersmap000001builder) | fooReverseSolidusQuotationMarkBar(value: List) | +| [RequiredWithEscapedCharactersMap000001Builder](#requiredwithescapedcharactersmap000001builder) | fooReverseSolidusQuotationMarkBar(value: Map) | +| [RequiredWithEscapedCharactersMap000010Builder](#requiredwithescapedcharactersmap000010builder) | fooReverseSolidusReverseSolidusBar(value: Nothing?) | +| [RequiredWithEscapedCharactersMap000010Builder](#requiredwithescapedcharactersmap000010builder) | fooReverseSolidusReverseSolidusBar(value: Boolean) | +| [RequiredWithEscapedCharactersMap000010Builder](#requiredwithescapedcharactersmap000010builder) | fooReverseSolidusReverseSolidusBar(value: String) | +| [RequiredWithEscapedCharactersMap000010Builder](#requiredwithescapedcharactersmap000010builder) | fooReverseSolidusReverseSolidusBar(value: Int) | +| [RequiredWithEscapedCharactersMap000010Builder](#requiredwithescapedcharactersmap000010builder) | fooReverseSolidusReverseSolidusBar(value: Float) | +| [RequiredWithEscapedCharactersMap000010Builder](#requiredwithescapedcharactersmap000010builder) | fooReverseSolidusReverseSolidusBar(value: Long) | +| [RequiredWithEscapedCharactersMap000010Builder](#requiredwithescapedcharactersmap000010builder) | fooReverseSolidusReverseSolidusBar(value: Double) | +| [RequiredWithEscapedCharactersMap000010Builder](#requiredwithescapedcharactersmap000010builder) | fooReverseSolidusReverseSolidusBar(value: List) | +| [RequiredWithEscapedCharactersMap000010Builder](#requiredwithescapedcharactersmap000010builder) | fooReverseSolidusReverseSolidusBar(value: Map) | + +## RequiredWithEscapedCharactersMap000100Builder +class RequiredWithEscapedCharactersMap000100Builder
    +builder for `Map` + +A class that builds the Map input type + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| RequiredWithEscapedCharactersMap000100Builder(Map instance)
    Creates a builder that contains the passed instance | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| [RequiredWithEscapedCharactersMap000000Builder](#requiredwithescapedcharactersmap000000builder) | fooReverseSolidusRbar(value: Nothing?) | +| [RequiredWithEscapedCharactersMap000000Builder](#requiredwithescapedcharactersmap000000builder) | fooReverseSolidusRbar(value: Boolean) | +| [RequiredWithEscapedCharactersMap000000Builder](#requiredwithescapedcharactersmap000000builder) | fooReverseSolidusRbar(value: String) | +| [RequiredWithEscapedCharactersMap000000Builder](#requiredwithescapedcharactersmap000000builder) | fooReverseSolidusRbar(value: Int) | +| [RequiredWithEscapedCharactersMap000000Builder](#requiredwithescapedcharactersmap000000builder) | fooReverseSolidusRbar(value: Float) | +| [RequiredWithEscapedCharactersMap000000Builder](#requiredwithescapedcharactersmap000000builder) | fooReverseSolidusRbar(value: Long) | +| [RequiredWithEscapedCharactersMap000000Builder](#requiredwithescapedcharactersmap000000builder) | fooReverseSolidusRbar(value: Double) | +| [RequiredWithEscapedCharactersMap000000Builder](#requiredwithescapedcharactersmap000000builder) | fooReverseSolidusRbar(value: List) | +| [RequiredWithEscapedCharactersMap000000Builder](#requiredwithescapedcharactersmap000000builder) | fooReverseSolidusRbar(value: Map) | + +## RequiredWithEscapedCharactersMap000101Builder +class RequiredWithEscapedCharactersMap000101Builder
    +builder for `Map` + +A class that builds the Map input type + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| RequiredWithEscapedCharactersMap000101Builder(Map instance)
    Creates a builder that contains the passed instance | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| [RequiredWithEscapedCharactersMap000001Builder](#requiredwithescapedcharactersmap000001builder) | fooReverseSolidusRbar(value: Nothing?) | +| [RequiredWithEscapedCharactersMap000001Builder](#requiredwithescapedcharactersmap000001builder) | fooReverseSolidusRbar(value: Boolean) | +| [RequiredWithEscapedCharactersMap000001Builder](#requiredwithescapedcharactersmap000001builder) | fooReverseSolidusRbar(value: String) | +| [RequiredWithEscapedCharactersMap000001Builder](#requiredwithescapedcharactersmap000001builder) | fooReverseSolidusRbar(value: Int) | +| [RequiredWithEscapedCharactersMap000001Builder](#requiredwithescapedcharactersmap000001builder) | fooReverseSolidusRbar(value: Float) | +| [RequiredWithEscapedCharactersMap000001Builder](#requiredwithescapedcharactersmap000001builder) | fooReverseSolidusRbar(value: Long) | +| [RequiredWithEscapedCharactersMap000001Builder](#requiredwithescapedcharactersmap000001builder) | fooReverseSolidusRbar(value: Double) | +| [RequiredWithEscapedCharactersMap000001Builder](#requiredwithescapedcharactersmap000001builder) | fooReverseSolidusRbar(value: List) | +| [RequiredWithEscapedCharactersMap000001Builder](#requiredwithescapedcharactersmap000001builder) | fooReverseSolidusRbar(value: Map) | +| [RequiredWithEscapedCharactersMap000100Builder](#requiredwithescapedcharactersmap000100builder) | fooReverseSolidusReverseSolidusBar(value: Nothing?) | +| [RequiredWithEscapedCharactersMap000100Builder](#requiredwithescapedcharactersmap000100builder) | fooReverseSolidusReverseSolidusBar(value: Boolean) | +| [RequiredWithEscapedCharactersMap000100Builder](#requiredwithescapedcharactersmap000100builder) | fooReverseSolidusReverseSolidusBar(value: String) | +| [RequiredWithEscapedCharactersMap000100Builder](#requiredwithescapedcharactersmap000100builder) | fooReverseSolidusReverseSolidusBar(value: Int) | +| [RequiredWithEscapedCharactersMap000100Builder](#requiredwithescapedcharactersmap000100builder) | fooReverseSolidusReverseSolidusBar(value: Float) | +| [RequiredWithEscapedCharactersMap000100Builder](#requiredwithescapedcharactersmap000100builder) | fooReverseSolidusReverseSolidusBar(value: Long) | +| [RequiredWithEscapedCharactersMap000100Builder](#requiredwithescapedcharactersmap000100builder) | fooReverseSolidusReverseSolidusBar(value: Double) | +| [RequiredWithEscapedCharactersMap000100Builder](#requiredwithescapedcharactersmap000100builder) | fooReverseSolidusReverseSolidusBar(value: List) | +| [RequiredWithEscapedCharactersMap000100Builder](#requiredwithescapedcharactersmap000100builder) | fooReverseSolidusReverseSolidusBar(value: Map) | + +## RequiredWithEscapedCharactersMap000110Builder +class RequiredWithEscapedCharactersMap000110Builder
    +builder for `Map` + +A class that builds the Map input type + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| RequiredWithEscapedCharactersMap000110Builder(Map instance)
    Creates a builder that contains the passed instance | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| [RequiredWithEscapedCharactersMap000010Builder](#requiredwithescapedcharactersmap000010builder) | fooReverseSolidusRbar(value: Nothing?) | +| [RequiredWithEscapedCharactersMap000010Builder](#requiredwithescapedcharactersmap000010builder) | fooReverseSolidusRbar(value: Boolean) | +| [RequiredWithEscapedCharactersMap000010Builder](#requiredwithescapedcharactersmap000010builder) | fooReverseSolidusRbar(value: String) | +| [RequiredWithEscapedCharactersMap000010Builder](#requiredwithescapedcharactersmap000010builder) | fooReverseSolidusRbar(value: Int) | +| [RequiredWithEscapedCharactersMap000010Builder](#requiredwithescapedcharactersmap000010builder) | fooReverseSolidusRbar(value: Float) | +| [RequiredWithEscapedCharactersMap000010Builder](#requiredwithescapedcharactersmap000010builder) | fooReverseSolidusRbar(value: Long) | +| [RequiredWithEscapedCharactersMap000010Builder](#requiredwithescapedcharactersmap000010builder) | fooReverseSolidusRbar(value: Double) | +| [RequiredWithEscapedCharactersMap000010Builder](#requiredwithescapedcharactersmap000010builder) | fooReverseSolidusRbar(value: List) | +| [RequiredWithEscapedCharactersMap000010Builder](#requiredwithescapedcharactersmap000010builder) | fooReverseSolidusRbar(value: Map) | +| [RequiredWithEscapedCharactersMap000100Builder](#requiredwithescapedcharactersmap000100builder) | fooReverseSolidusQuotationMarkBar(value: Nothing?) | +| [RequiredWithEscapedCharactersMap000100Builder](#requiredwithescapedcharactersmap000100builder) | fooReverseSolidusQuotationMarkBar(value: Boolean) | +| [RequiredWithEscapedCharactersMap000100Builder](#requiredwithescapedcharactersmap000100builder) | fooReverseSolidusQuotationMarkBar(value: String) | +| [RequiredWithEscapedCharactersMap000100Builder](#requiredwithescapedcharactersmap000100builder) | fooReverseSolidusQuotationMarkBar(value: Int) | +| [RequiredWithEscapedCharactersMap000100Builder](#requiredwithescapedcharactersmap000100builder) | fooReverseSolidusQuotationMarkBar(value: Float) | +| [RequiredWithEscapedCharactersMap000100Builder](#requiredwithescapedcharactersmap000100builder) | fooReverseSolidusQuotationMarkBar(value: Long) | +| [RequiredWithEscapedCharactersMap000100Builder](#requiredwithescapedcharactersmap000100builder) | fooReverseSolidusQuotationMarkBar(value: Double) | +| [RequiredWithEscapedCharactersMap000100Builder](#requiredwithescapedcharactersmap000100builder) | fooReverseSolidusQuotationMarkBar(value: List) | +| [RequiredWithEscapedCharactersMap000100Builder](#requiredwithescapedcharactersmap000100builder) | fooReverseSolidusQuotationMarkBar(value: Map) | + +## RequiredWithEscapedCharactersMap000111Builder +class RequiredWithEscapedCharactersMap000111Builder
    +builder for `Map` + +A class that builds the Map input type + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| RequiredWithEscapedCharactersMap000111Builder(Map instance)
    Creates a builder that contains the passed instance | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| [RequiredWithEscapedCharactersMap000011Builder](#requiredwithescapedcharactersmap000011builder) | fooReverseSolidusRbar(value: Nothing?) | +| [RequiredWithEscapedCharactersMap000011Builder](#requiredwithescapedcharactersmap000011builder) | fooReverseSolidusRbar(value: Boolean) | +| [RequiredWithEscapedCharactersMap000011Builder](#requiredwithescapedcharactersmap000011builder) | fooReverseSolidusRbar(value: String) | +| [RequiredWithEscapedCharactersMap000011Builder](#requiredwithescapedcharactersmap000011builder) | fooReverseSolidusRbar(value: Int) | +| [RequiredWithEscapedCharactersMap000011Builder](#requiredwithescapedcharactersmap000011builder) | fooReverseSolidusRbar(value: Float) | +| [RequiredWithEscapedCharactersMap000011Builder](#requiredwithescapedcharactersmap000011builder) | fooReverseSolidusRbar(value: Long) | +| [RequiredWithEscapedCharactersMap000011Builder](#requiredwithescapedcharactersmap000011builder) | fooReverseSolidusRbar(value: Double) | +| [RequiredWithEscapedCharactersMap000011Builder](#requiredwithescapedcharactersmap000011builder) | fooReverseSolidusRbar(value: List) | +| [RequiredWithEscapedCharactersMap000011Builder](#requiredwithescapedcharactersmap000011builder) | fooReverseSolidusRbar(value: Map) | +| [RequiredWithEscapedCharactersMap000101Builder](#requiredwithescapedcharactersmap000101builder) | fooReverseSolidusQuotationMarkBar(value: Nothing?) | +| [RequiredWithEscapedCharactersMap000101Builder](#requiredwithescapedcharactersmap000101builder) | fooReverseSolidusQuotationMarkBar(value: Boolean) | +| [RequiredWithEscapedCharactersMap000101Builder](#requiredwithescapedcharactersmap000101builder) | fooReverseSolidusQuotationMarkBar(value: String) | +| [RequiredWithEscapedCharactersMap000101Builder](#requiredwithescapedcharactersmap000101builder) | fooReverseSolidusQuotationMarkBar(value: Int) | +| [RequiredWithEscapedCharactersMap000101Builder](#requiredwithescapedcharactersmap000101builder) | fooReverseSolidusQuotationMarkBar(value: Float) | +| [RequiredWithEscapedCharactersMap000101Builder](#requiredwithescapedcharactersmap000101builder) | fooReverseSolidusQuotationMarkBar(value: Long) | +| [RequiredWithEscapedCharactersMap000101Builder](#requiredwithescapedcharactersmap000101builder) | fooReverseSolidusQuotationMarkBar(value: Double) | +| [RequiredWithEscapedCharactersMap000101Builder](#requiredwithescapedcharactersmap000101builder) | fooReverseSolidusQuotationMarkBar(value: List) | +| [RequiredWithEscapedCharactersMap000101Builder](#requiredwithescapedcharactersmap000101builder) | fooReverseSolidusQuotationMarkBar(value: Map) | +| [RequiredWithEscapedCharactersMap000110Builder](#requiredwithescapedcharactersmap000110builder) | fooReverseSolidusReverseSolidusBar(value: Nothing?) | +| [RequiredWithEscapedCharactersMap000110Builder](#requiredwithescapedcharactersmap000110builder) | fooReverseSolidusReverseSolidusBar(value: Boolean) | +| [RequiredWithEscapedCharactersMap000110Builder](#requiredwithescapedcharactersmap000110builder) | fooReverseSolidusReverseSolidusBar(value: String) | +| [RequiredWithEscapedCharactersMap000110Builder](#requiredwithescapedcharactersmap000110builder) | fooReverseSolidusReverseSolidusBar(value: Int) | +| [RequiredWithEscapedCharactersMap000110Builder](#requiredwithescapedcharactersmap000110builder) | fooReverseSolidusReverseSolidusBar(value: Float) | +| [RequiredWithEscapedCharactersMap000110Builder](#requiredwithescapedcharactersmap000110builder) | fooReverseSolidusReverseSolidusBar(value: Long) | +| [RequiredWithEscapedCharactersMap000110Builder](#requiredwithescapedcharactersmap000110builder) | fooReverseSolidusReverseSolidusBar(value: Double) | +| [RequiredWithEscapedCharactersMap000110Builder](#requiredwithescapedcharactersmap000110builder) | fooReverseSolidusReverseSolidusBar(value: List) | +| [RequiredWithEscapedCharactersMap000110Builder](#requiredwithescapedcharactersmap000110builder) | fooReverseSolidusReverseSolidusBar(value: Map) | + +## RequiredWithEscapedCharactersMap001000Builder +class RequiredWithEscapedCharactersMap001000Builder
    +builder for `Map` + +A class that builds the Map input type + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| RequiredWithEscapedCharactersMap001000Builder(Map instance)
    Creates a builder that contains the passed instance | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| [RequiredWithEscapedCharactersMap000000Builder](#requiredwithescapedcharactersmap000000builder) | fooReverseSolidusU000cbar(value: Nothing?) | +| [RequiredWithEscapedCharactersMap000000Builder](#requiredwithescapedcharactersmap000000builder) | fooReverseSolidusU000cbar(value: Boolean) | +| [RequiredWithEscapedCharactersMap000000Builder](#requiredwithescapedcharactersmap000000builder) | fooReverseSolidusU000cbar(value: String) | +| [RequiredWithEscapedCharactersMap000000Builder](#requiredwithescapedcharactersmap000000builder) | fooReverseSolidusU000cbar(value: Int) | +| [RequiredWithEscapedCharactersMap000000Builder](#requiredwithescapedcharactersmap000000builder) | fooReverseSolidusU000cbar(value: Float) | +| [RequiredWithEscapedCharactersMap000000Builder](#requiredwithescapedcharactersmap000000builder) | fooReverseSolidusU000cbar(value: Long) | +| [RequiredWithEscapedCharactersMap000000Builder](#requiredwithescapedcharactersmap000000builder) | fooReverseSolidusU000cbar(value: Double) | +| [RequiredWithEscapedCharactersMap000000Builder](#requiredwithescapedcharactersmap000000builder) | fooReverseSolidusU000cbar(value: List) | +| [RequiredWithEscapedCharactersMap000000Builder](#requiredwithescapedcharactersmap000000builder) | fooReverseSolidusU000cbar(value: Map) | + +## RequiredWithEscapedCharactersMap001001Builder +class RequiredWithEscapedCharactersMap001001Builder
    +builder for `Map` + +A class that builds the Map input type + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| RequiredWithEscapedCharactersMap001001Builder(Map instance)
    Creates a builder that contains the passed instance | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| [RequiredWithEscapedCharactersMap000001Builder](#requiredwithescapedcharactersmap000001builder) | fooReverseSolidusU000cbar(value: Nothing?) | +| [RequiredWithEscapedCharactersMap000001Builder](#requiredwithescapedcharactersmap000001builder) | fooReverseSolidusU000cbar(value: Boolean) | +| [RequiredWithEscapedCharactersMap000001Builder](#requiredwithescapedcharactersmap000001builder) | fooReverseSolidusU000cbar(value: String) | +| [RequiredWithEscapedCharactersMap000001Builder](#requiredwithescapedcharactersmap000001builder) | fooReverseSolidusU000cbar(value: Int) | +| [RequiredWithEscapedCharactersMap000001Builder](#requiredwithescapedcharactersmap000001builder) | fooReverseSolidusU000cbar(value: Float) | +| [RequiredWithEscapedCharactersMap000001Builder](#requiredwithescapedcharactersmap000001builder) | fooReverseSolidusU000cbar(value: Long) | +| [RequiredWithEscapedCharactersMap000001Builder](#requiredwithescapedcharactersmap000001builder) | fooReverseSolidusU000cbar(value: Double) | +| [RequiredWithEscapedCharactersMap000001Builder](#requiredwithescapedcharactersmap000001builder) | fooReverseSolidusU000cbar(value: List) | +| [RequiredWithEscapedCharactersMap000001Builder](#requiredwithescapedcharactersmap000001builder) | fooReverseSolidusU000cbar(value: Map) | +| [RequiredWithEscapedCharactersMap001000Builder](#requiredwithescapedcharactersmap001000builder) | fooReverseSolidusReverseSolidusBar(value: Nothing?) | +| [RequiredWithEscapedCharactersMap001000Builder](#requiredwithescapedcharactersmap001000builder) | fooReverseSolidusReverseSolidusBar(value: Boolean) | +| [RequiredWithEscapedCharactersMap001000Builder](#requiredwithescapedcharactersmap001000builder) | fooReverseSolidusReverseSolidusBar(value: String) | +| [RequiredWithEscapedCharactersMap001000Builder](#requiredwithescapedcharactersmap001000builder) | fooReverseSolidusReverseSolidusBar(value: Int) | +| [RequiredWithEscapedCharactersMap001000Builder](#requiredwithescapedcharactersmap001000builder) | fooReverseSolidusReverseSolidusBar(value: Float) | +| [RequiredWithEscapedCharactersMap001000Builder](#requiredwithescapedcharactersmap001000builder) | fooReverseSolidusReverseSolidusBar(value: Long) | +| [RequiredWithEscapedCharactersMap001000Builder](#requiredwithescapedcharactersmap001000builder) | fooReverseSolidusReverseSolidusBar(value: Double) | +| [RequiredWithEscapedCharactersMap001000Builder](#requiredwithescapedcharactersmap001000builder) | fooReverseSolidusReverseSolidusBar(value: List) | +| [RequiredWithEscapedCharactersMap001000Builder](#requiredwithescapedcharactersmap001000builder) | fooReverseSolidusReverseSolidusBar(value: Map) | + +## RequiredWithEscapedCharactersMap001010Builder +class RequiredWithEscapedCharactersMap001010Builder
    +builder for `Map` + +A class that builds the Map input type + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| RequiredWithEscapedCharactersMap001010Builder(Map instance)
    Creates a builder that contains the passed instance | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| [RequiredWithEscapedCharactersMap000010Builder](#requiredwithescapedcharactersmap000010builder) | fooReverseSolidusU000cbar(value: Nothing?) | +| [RequiredWithEscapedCharactersMap000010Builder](#requiredwithescapedcharactersmap000010builder) | fooReverseSolidusU000cbar(value: Boolean) | +| [RequiredWithEscapedCharactersMap000010Builder](#requiredwithescapedcharactersmap000010builder) | fooReverseSolidusU000cbar(value: String) | +| [RequiredWithEscapedCharactersMap000010Builder](#requiredwithescapedcharactersmap000010builder) | fooReverseSolidusU000cbar(value: Int) | +| [RequiredWithEscapedCharactersMap000010Builder](#requiredwithescapedcharactersmap000010builder) | fooReverseSolidusU000cbar(value: Float) | +| [RequiredWithEscapedCharactersMap000010Builder](#requiredwithescapedcharactersmap000010builder) | fooReverseSolidusU000cbar(value: Long) | +| [RequiredWithEscapedCharactersMap000010Builder](#requiredwithescapedcharactersmap000010builder) | fooReverseSolidusU000cbar(value: Double) | +| [RequiredWithEscapedCharactersMap000010Builder](#requiredwithescapedcharactersmap000010builder) | fooReverseSolidusU000cbar(value: List) | +| [RequiredWithEscapedCharactersMap000010Builder](#requiredwithescapedcharactersmap000010builder) | fooReverseSolidusU000cbar(value: Map) | +| [RequiredWithEscapedCharactersMap001000Builder](#requiredwithescapedcharactersmap001000builder) | fooReverseSolidusQuotationMarkBar(value: Nothing?) | +| [RequiredWithEscapedCharactersMap001000Builder](#requiredwithescapedcharactersmap001000builder) | fooReverseSolidusQuotationMarkBar(value: Boolean) | +| [RequiredWithEscapedCharactersMap001000Builder](#requiredwithescapedcharactersmap001000builder) | fooReverseSolidusQuotationMarkBar(value: String) | +| [RequiredWithEscapedCharactersMap001000Builder](#requiredwithescapedcharactersmap001000builder) | fooReverseSolidusQuotationMarkBar(value: Int) | +| [RequiredWithEscapedCharactersMap001000Builder](#requiredwithescapedcharactersmap001000builder) | fooReverseSolidusQuotationMarkBar(value: Float) | +| [RequiredWithEscapedCharactersMap001000Builder](#requiredwithescapedcharactersmap001000builder) | fooReverseSolidusQuotationMarkBar(value: Long) | +| [RequiredWithEscapedCharactersMap001000Builder](#requiredwithescapedcharactersmap001000builder) | fooReverseSolidusQuotationMarkBar(value: Double) | +| [RequiredWithEscapedCharactersMap001000Builder](#requiredwithescapedcharactersmap001000builder) | fooReverseSolidusQuotationMarkBar(value: List) | +| [RequiredWithEscapedCharactersMap001000Builder](#requiredwithescapedcharactersmap001000builder) | fooReverseSolidusQuotationMarkBar(value: Map) | + +## RequiredWithEscapedCharactersMap001011Builder +class RequiredWithEscapedCharactersMap001011Builder
    +builder for `Map` + +A class that builds the Map input type + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| RequiredWithEscapedCharactersMap001011Builder(Map instance)
    Creates a builder that contains the passed instance | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| [RequiredWithEscapedCharactersMap000011Builder](#requiredwithescapedcharactersmap000011builder) | fooReverseSolidusU000cbar(value: Nothing?) | +| [RequiredWithEscapedCharactersMap000011Builder](#requiredwithescapedcharactersmap000011builder) | fooReverseSolidusU000cbar(value: Boolean) | +| [RequiredWithEscapedCharactersMap000011Builder](#requiredwithescapedcharactersmap000011builder) | fooReverseSolidusU000cbar(value: String) | +| [RequiredWithEscapedCharactersMap000011Builder](#requiredwithescapedcharactersmap000011builder) | fooReverseSolidusU000cbar(value: Int) | +| [RequiredWithEscapedCharactersMap000011Builder](#requiredwithescapedcharactersmap000011builder) | fooReverseSolidusU000cbar(value: Float) | +| [RequiredWithEscapedCharactersMap000011Builder](#requiredwithescapedcharactersmap000011builder) | fooReverseSolidusU000cbar(value: Long) | +| [RequiredWithEscapedCharactersMap000011Builder](#requiredwithescapedcharactersmap000011builder) | fooReverseSolidusU000cbar(value: Double) | +| [RequiredWithEscapedCharactersMap000011Builder](#requiredwithescapedcharactersmap000011builder) | fooReverseSolidusU000cbar(value: List) | +| [RequiredWithEscapedCharactersMap000011Builder](#requiredwithescapedcharactersmap000011builder) | fooReverseSolidusU000cbar(value: Map) | +| [RequiredWithEscapedCharactersMap001001Builder](#requiredwithescapedcharactersmap001001builder) | fooReverseSolidusQuotationMarkBar(value: Nothing?) | +| [RequiredWithEscapedCharactersMap001001Builder](#requiredwithescapedcharactersmap001001builder) | fooReverseSolidusQuotationMarkBar(value: Boolean) | +| [RequiredWithEscapedCharactersMap001001Builder](#requiredwithescapedcharactersmap001001builder) | fooReverseSolidusQuotationMarkBar(value: String) | +| [RequiredWithEscapedCharactersMap001001Builder](#requiredwithescapedcharactersmap001001builder) | fooReverseSolidusQuotationMarkBar(value: Int) | +| [RequiredWithEscapedCharactersMap001001Builder](#requiredwithescapedcharactersmap001001builder) | fooReverseSolidusQuotationMarkBar(value: Float) | +| [RequiredWithEscapedCharactersMap001001Builder](#requiredwithescapedcharactersmap001001builder) | fooReverseSolidusQuotationMarkBar(value: Long) | +| [RequiredWithEscapedCharactersMap001001Builder](#requiredwithescapedcharactersmap001001builder) | fooReverseSolidusQuotationMarkBar(value: Double) | +| [RequiredWithEscapedCharactersMap001001Builder](#requiredwithescapedcharactersmap001001builder) | fooReverseSolidusQuotationMarkBar(value: List) | +| [RequiredWithEscapedCharactersMap001001Builder](#requiredwithescapedcharactersmap001001builder) | fooReverseSolidusQuotationMarkBar(value: Map) | +| [RequiredWithEscapedCharactersMap001010Builder](#requiredwithescapedcharactersmap001010builder) | fooReverseSolidusReverseSolidusBar(value: Nothing?) | +| [RequiredWithEscapedCharactersMap001010Builder](#requiredwithescapedcharactersmap001010builder) | fooReverseSolidusReverseSolidusBar(value: Boolean) | +| [RequiredWithEscapedCharactersMap001010Builder](#requiredwithescapedcharactersmap001010builder) | fooReverseSolidusReverseSolidusBar(value: String) | +| [RequiredWithEscapedCharactersMap001010Builder](#requiredwithescapedcharactersmap001010builder) | fooReverseSolidusReverseSolidusBar(value: Int) | +| [RequiredWithEscapedCharactersMap001010Builder](#requiredwithescapedcharactersmap001010builder) | fooReverseSolidusReverseSolidusBar(value: Float) | +| [RequiredWithEscapedCharactersMap001010Builder](#requiredwithescapedcharactersmap001010builder) | fooReverseSolidusReverseSolidusBar(value: Long) | +| [RequiredWithEscapedCharactersMap001010Builder](#requiredwithescapedcharactersmap001010builder) | fooReverseSolidusReverseSolidusBar(value: Double) | +| [RequiredWithEscapedCharactersMap001010Builder](#requiredwithescapedcharactersmap001010builder) | fooReverseSolidusReverseSolidusBar(value: List) | +| [RequiredWithEscapedCharactersMap001010Builder](#requiredwithescapedcharactersmap001010builder) | fooReverseSolidusReverseSolidusBar(value: Map) | + +## RequiredWithEscapedCharactersMap001100Builder +class RequiredWithEscapedCharactersMap001100Builder
    +builder for `Map` + +A class that builds the Map input type + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| RequiredWithEscapedCharactersMap001100Builder(Map instance)
    Creates a builder that contains the passed instance | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| [RequiredWithEscapedCharactersMap000100Builder](#requiredwithescapedcharactersmap000100builder) | fooReverseSolidusU000cbar(value: Nothing?) | +| [RequiredWithEscapedCharactersMap000100Builder](#requiredwithescapedcharactersmap000100builder) | fooReverseSolidusU000cbar(value: Boolean) | +| [RequiredWithEscapedCharactersMap000100Builder](#requiredwithescapedcharactersmap000100builder) | fooReverseSolidusU000cbar(value: String) | +| [RequiredWithEscapedCharactersMap000100Builder](#requiredwithescapedcharactersmap000100builder) | fooReverseSolidusU000cbar(value: Int) | +| [RequiredWithEscapedCharactersMap000100Builder](#requiredwithescapedcharactersmap000100builder) | fooReverseSolidusU000cbar(value: Float) | +| [RequiredWithEscapedCharactersMap000100Builder](#requiredwithescapedcharactersmap000100builder) | fooReverseSolidusU000cbar(value: Long) | +| [RequiredWithEscapedCharactersMap000100Builder](#requiredwithescapedcharactersmap000100builder) | fooReverseSolidusU000cbar(value: Double) | +| [RequiredWithEscapedCharactersMap000100Builder](#requiredwithescapedcharactersmap000100builder) | fooReverseSolidusU000cbar(value: List) | +| [RequiredWithEscapedCharactersMap000100Builder](#requiredwithescapedcharactersmap000100builder) | fooReverseSolidusU000cbar(value: Map) | +| [RequiredWithEscapedCharactersMap001000Builder](#requiredwithescapedcharactersmap001000builder) | fooReverseSolidusRbar(value: Nothing?) | +| [RequiredWithEscapedCharactersMap001000Builder](#requiredwithescapedcharactersmap001000builder) | fooReverseSolidusRbar(value: Boolean) | +| [RequiredWithEscapedCharactersMap001000Builder](#requiredwithescapedcharactersmap001000builder) | fooReverseSolidusRbar(value: String) | +| [RequiredWithEscapedCharactersMap001000Builder](#requiredwithescapedcharactersmap001000builder) | fooReverseSolidusRbar(value: Int) | +| [RequiredWithEscapedCharactersMap001000Builder](#requiredwithescapedcharactersmap001000builder) | fooReverseSolidusRbar(value: Float) | +| [RequiredWithEscapedCharactersMap001000Builder](#requiredwithescapedcharactersmap001000builder) | fooReverseSolidusRbar(value: Long) | +| [RequiredWithEscapedCharactersMap001000Builder](#requiredwithescapedcharactersmap001000builder) | fooReverseSolidusRbar(value: Double) | +| [RequiredWithEscapedCharactersMap001000Builder](#requiredwithescapedcharactersmap001000builder) | fooReverseSolidusRbar(value: List) | +| [RequiredWithEscapedCharactersMap001000Builder](#requiredwithescapedcharactersmap001000builder) | fooReverseSolidusRbar(value: Map) | + +## RequiredWithEscapedCharactersMap001101Builder +class RequiredWithEscapedCharactersMap001101Builder
    +builder for `Map` + +A class that builds the Map input type + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| RequiredWithEscapedCharactersMap001101Builder(Map instance)
    Creates a builder that contains the passed instance | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| [RequiredWithEscapedCharactersMap000101Builder](#requiredwithescapedcharactersmap000101builder) | fooReverseSolidusU000cbar(value: Nothing?) | +| [RequiredWithEscapedCharactersMap000101Builder](#requiredwithescapedcharactersmap000101builder) | fooReverseSolidusU000cbar(value: Boolean) | +| [RequiredWithEscapedCharactersMap000101Builder](#requiredwithescapedcharactersmap000101builder) | fooReverseSolidusU000cbar(value: String) | +| [RequiredWithEscapedCharactersMap000101Builder](#requiredwithescapedcharactersmap000101builder) | fooReverseSolidusU000cbar(value: Int) | +| [RequiredWithEscapedCharactersMap000101Builder](#requiredwithescapedcharactersmap000101builder) | fooReverseSolidusU000cbar(value: Float) | +| [RequiredWithEscapedCharactersMap000101Builder](#requiredwithescapedcharactersmap000101builder) | fooReverseSolidusU000cbar(value: Long) | +| [RequiredWithEscapedCharactersMap000101Builder](#requiredwithescapedcharactersmap000101builder) | fooReverseSolidusU000cbar(value: Double) | +| [RequiredWithEscapedCharactersMap000101Builder](#requiredwithescapedcharactersmap000101builder) | fooReverseSolidusU000cbar(value: List) | +| [RequiredWithEscapedCharactersMap000101Builder](#requiredwithescapedcharactersmap000101builder) | fooReverseSolidusU000cbar(value: Map) | +| [RequiredWithEscapedCharactersMap001001Builder](#requiredwithescapedcharactersmap001001builder) | fooReverseSolidusRbar(value: Nothing?) | +| [RequiredWithEscapedCharactersMap001001Builder](#requiredwithescapedcharactersmap001001builder) | fooReverseSolidusRbar(value: Boolean) | +| [RequiredWithEscapedCharactersMap001001Builder](#requiredwithescapedcharactersmap001001builder) | fooReverseSolidusRbar(value: String) | +| [RequiredWithEscapedCharactersMap001001Builder](#requiredwithescapedcharactersmap001001builder) | fooReverseSolidusRbar(value: Int) | +| [RequiredWithEscapedCharactersMap001001Builder](#requiredwithescapedcharactersmap001001builder) | fooReverseSolidusRbar(value: Float) | +| [RequiredWithEscapedCharactersMap001001Builder](#requiredwithescapedcharactersmap001001builder) | fooReverseSolidusRbar(value: Long) | +| [RequiredWithEscapedCharactersMap001001Builder](#requiredwithescapedcharactersmap001001builder) | fooReverseSolidusRbar(value: Double) | +| [RequiredWithEscapedCharactersMap001001Builder](#requiredwithescapedcharactersmap001001builder) | fooReverseSolidusRbar(value: List) | +| [RequiredWithEscapedCharactersMap001001Builder](#requiredwithescapedcharactersmap001001builder) | fooReverseSolidusRbar(value: Map) | +| [RequiredWithEscapedCharactersMap001100Builder](#requiredwithescapedcharactersmap001100builder) | fooReverseSolidusReverseSolidusBar(value: Nothing?) | +| [RequiredWithEscapedCharactersMap001100Builder](#requiredwithescapedcharactersmap001100builder) | fooReverseSolidusReverseSolidusBar(value: Boolean) | +| [RequiredWithEscapedCharactersMap001100Builder](#requiredwithescapedcharactersmap001100builder) | fooReverseSolidusReverseSolidusBar(value: String) | +| [RequiredWithEscapedCharactersMap001100Builder](#requiredwithescapedcharactersmap001100builder) | fooReverseSolidusReverseSolidusBar(value: Int) | +| [RequiredWithEscapedCharactersMap001100Builder](#requiredwithescapedcharactersmap001100builder) | fooReverseSolidusReverseSolidusBar(value: Float) | +| [RequiredWithEscapedCharactersMap001100Builder](#requiredwithescapedcharactersmap001100builder) | fooReverseSolidusReverseSolidusBar(value: Long) | +| [RequiredWithEscapedCharactersMap001100Builder](#requiredwithescapedcharactersmap001100builder) | fooReverseSolidusReverseSolidusBar(value: Double) | +| [RequiredWithEscapedCharactersMap001100Builder](#requiredwithescapedcharactersmap001100builder) | fooReverseSolidusReverseSolidusBar(value: List) | +| [RequiredWithEscapedCharactersMap001100Builder](#requiredwithescapedcharactersmap001100builder) | fooReverseSolidusReverseSolidusBar(value: Map) | + +## RequiredWithEscapedCharactersMap001110Builder +class RequiredWithEscapedCharactersMap001110Builder
    +builder for `Map` + +A class that builds the Map input type + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| RequiredWithEscapedCharactersMap001110Builder(Map instance)
    Creates a builder that contains the passed instance | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| [RequiredWithEscapedCharactersMap000110Builder](#requiredwithescapedcharactersmap000110builder) | fooReverseSolidusU000cbar(value: Nothing?) | +| [RequiredWithEscapedCharactersMap000110Builder](#requiredwithescapedcharactersmap000110builder) | fooReverseSolidusU000cbar(value: Boolean) | +| [RequiredWithEscapedCharactersMap000110Builder](#requiredwithescapedcharactersmap000110builder) | fooReverseSolidusU000cbar(value: String) | +| [RequiredWithEscapedCharactersMap000110Builder](#requiredwithescapedcharactersmap000110builder) | fooReverseSolidusU000cbar(value: Int) | +| [RequiredWithEscapedCharactersMap000110Builder](#requiredwithescapedcharactersmap000110builder) | fooReverseSolidusU000cbar(value: Float) | +| [RequiredWithEscapedCharactersMap000110Builder](#requiredwithescapedcharactersmap000110builder) | fooReverseSolidusU000cbar(value: Long) | +| [RequiredWithEscapedCharactersMap000110Builder](#requiredwithescapedcharactersmap000110builder) | fooReverseSolidusU000cbar(value: Double) | +| [RequiredWithEscapedCharactersMap000110Builder](#requiredwithescapedcharactersmap000110builder) | fooReverseSolidusU000cbar(value: List) | +| [RequiredWithEscapedCharactersMap000110Builder](#requiredwithescapedcharactersmap000110builder) | fooReverseSolidusU000cbar(value: Map) | +| [RequiredWithEscapedCharactersMap001010Builder](#requiredwithescapedcharactersmap001010builder) | fooReverseSolidusRbar(value: Nothing?) | +| [RequiredWithEscapedCharactersMap001010Builder](#requiredwithescapedcharactersmap001010builder) | fooReverseSolidusRbar(value: Boolean) | +| [RequiredWithEscapedCharactersMap001010Builder](#requiredwithescapedcharactersmap001010builder) | fooReverseSolidusRbar(value: String) | +| [RequiredWithEscapedCharactersMap001010Builder](#requiredwithescapedcharactersmap001010builder) | fooReverseSolidusRbar(value: Int) | +| [RequiredWithEscapedCharactersMap001010Builder](#requiredwithescapedcharactersmap001010builder) | fooReverseSolidusRbar(value: Float) | +| [RequiredWithEscapedCharactersMap001010Builder](#requiredwithescapedcharactersmap001010builder) | fooReverseSolidusRbar(value: Long) | +| [RequiredWithEscapedCharactersMap001010Builder](#requiredwithescapedcharactersmap001010builder) | fooReverseSolidusRbar(value: Double) | +| [RequiredWithEscapedCharactersMap001010Builder](#requiredwithescapedcharactersmap001010builder) | fooReverseSolidusRbar(value: List) | +| [RequiredWithEscapedCharactersMap001010Builder](#requiredwithescapedcharactersmap001010builder) | fooReverseSolidusRbar(value: Map) | +| [RequiredWithEscapedCharactersMap001100Builder](#requiredwithescapedcharactersmap001100builder) | fooReverseSolidusQuotationMarkBar(value: Nothing?) | +| [RequiredWithEscapedCharactersMap001100Builder](#requiredwithescapedcharactersmap001100builder) | fooReverseSolidusQuotationMarkBar(value: Boolean) | +| [RequiredWithEscapedCharactersMap001100Builder](#requiredwithescapedcharactersmap001100builder) | fooReverseSolidusQuotationMarkBar(value: String) | +| [RequiredWithEscapedCharactersMap001100Builder](#requiredwithescapedcharactersmap001100builder) | fooReverseSolidusQuotationMarkBar(value: Int) | +| [RequiredWithEscapedCharactersMap001100Builder](#requiredwithescapedcharactersmap001100builder) | fooReverseSolidusQuotationMarkBar(value: Float) | +| [RequiredWithEscapedCharactersMap001100Builder](#requiredwithescapedcharactersmap001100builder) | fooReverseSolidusQuotationMarkBar(value: Long) | +| [RequiredWithEscapedCharactersMap001100Builder](#requiredwithescapedcharactersmap001100builder) | fooReverseSolidusQuotationMarkBar(value: Double) | +| [RequiredWithEscapedCharactersMap001100Builder](#requiredwithescapedcharactersmap001100builder) | fooReverseSolidusQuotationMarkBar(value: List) | +| [RequiredWithEscapedCharactersMap001100Builder](#requiredwithescapedcharactersmap001100builder) | fooReverseSolidusQuotationMarkBar(value: Map) | + +## RequiredWithEscapedCharactersMap001111Builder +class RequiredWithEscapedCharactersMap001111Builder
    +builder for `Map` + +A class that builds the Map input type + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| RequiredWithEscapedCharactersMap001111Builder(Map instance)
    Creates a builder that contains the passed instance | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| [RequiredWithEscapedCharactersMap000111Builder](#requiredwithescapedcharactersmap000111builder) | fooReverseSolidusU000cbar(value: Nothing?) | +| [RequiredWithEscapedCharactersMap000111Builder](#requiredwithescapedcharactersmap000111builder) | fooReverseSolidusU000cbar(value: Boolean) | +| [RequiredWithEscapedCharactersMap000111Builder](#requiredwithescapedcharactersmap000111builder) | fooReverseSolidusU000cbar(value: String) | +| [RequiredWithEscapedCharactersMap000111Builder](#requiredwithescapedcharactersmap000111builder) | fooReverseSolidusU000cbar(value: Int) | +| [RequiredWithEscapedCharactersMap000111Builder](#requiredwithescapedcharactersmap000111builder) | fooReverseSolidusU000cbar(value: Float) | +| [RequiredWithEscapedCharactersMap000111Builder](#requiredwithescapedcharactersmap000111builder) | fooReverseSolidusU000cbar(value: Long) | +| [RequiredWithEscapedCharactersMap000111Builder](#requiredwithescapedcharactersmap000111builder) | fooReverseSolidusU000cbar(value: Double) | +| [RequiredWithEscapedCharactersMap000111Builder](#requiredwithescapedcharactersmap000111builder) | fooReverseSolidusU000cbar(value: List) | +| [RequiredWithEscapedCharactersMap000111Builder](#requiredwithescapedcharactersmap000111builder) | fooReverseSolidusU000cbar(value: Map) | +| [RequiredWithEscapedCharactersMap001011Builder](#requiredwithescapedcharactersmap001011builder) | fooReverseSolidusRbar(value: Nothing?) | +| [RequiredWithEscapedCharactersMap001011Builder](#requiredwithescapedcharactersmap001011builder) | fooReverseSolidusRbar(value: Boolean) | +| [RequiredWithEscapedCharactersMap001011Builder](#requiredwithescapedcharactersmap001011builder) | fooReverseSolidusRbar(value: String) | +| [RequiredWithEscapedCharactersMap001011Builder](#requiredwithescapedcharactersmap001011builder) | fooReverseSolidusRbar(value: Int) | +| [RequiredWithEscapedCharactersMap001011Builder](#requiredwithescapedcharactersmap001011builder) | fooReverseSolidusRbar(value: Float) | +| [RequiredWithEscapedCharactersMap001011Builder](#requiredwithescapedcharactersmap001011builder) | fooReverseSolidusRbar(value: Long) | +| [RequiredWithEscapedCharactersMap001011Builder](#requiredwithescapedcharactersmap001011builder) | fooReverseSolidusRbar(value: Double) | +| [RequiredWithEscapedCharactersMap001011Builder](#requiredwithescapedcharactersmap001011builder) | fooReverseSolidusRbar(value: List) | +| [RequiredWithEscapedCharactersMap001011Builder](#requiredwithescapedcharactersmap001011builder) | fooReverseSolidusRbar(value: Map) | +| [RequiredWithEscapedCharactersMap001101Builder](#requiredwithescapedcharactersmap001101builder) | fooReverseSolidusQuotationMarkBar(value: Nothing?) | +| [RequiredWithEscapedCharactersMap001101Builder](#requiredwithescapedcharactersmap001101builder) | fooReverseSolidusQuotationMarkBar(value: Boolean) | +| [RequiredWithEscapedCharactersMap001101Builder](#requiredwithescapedcharactersmap001101builder) | fooReverseSolidusQuotationMarkBar(value: String) | +| [RequiredWithEscapedCharactersMap001101Builder](#requiredwithescapedcharactersmap001101builder) | fooReverseSolidusQuotationMarkBar(value: Int) | +| [RequiredWithEscapedCharactersMap001101Builder](#requiredwithescapedcharactersmap001101builder) | fooReverseSolidusQuotationMarkBar(value: Float) | +| [RequiredWithEscapedCharactersMap001101Builder](#requiredwithescapedcharactersmap001101builder) | fooReverseSolidusQuotationMarkBar(value: Long) | +| [RequiredWithEscapedCharactersMap001101Builder](#requiredwithescapedcharactersmap001101builder) | fooReverseSolidusQuotationMarkBar(value: Double) | +| [RequiredWithEscapedCharactersMap001101Builder](#requiredwithescapedcharactersmap001101builder) | fooReverseSolidusQuotationMarkBar(value: List) | +| [RequiredWithEscapedCharactersMap001101Builder](#requiredwithescapedcharactersmap001101builder) | fooReverseSolidusQuotationMarkBar(value: Map) | +| [RequiredWithEscapedCharactersMap001110Builder](#requiredwithescapedcharactersmap001110builder) | fooReverseSolidusReverseSolidusBar(value: Nothing?) | +| [RequiredWithEscapedCharactersMap001110Builder](#requiredwithescapedcharactersmap001110builder) | fooReverseSolidusReverseSolidusBar(value: Boolean) | +| [RequiredWithEscapedCharactersMap001110Builder](#requiredwithescapedcharactersmap001110builder) | fooReverseSolidusReverseSolidusBar(value: String) | +| [RequiredWithEscapedCharactersMap001110Builder](#requiredwithescapedcharactersmap001110builder) | fooReverseSolidusReverseSolidusBar(value: Int) | +| [RequiredWithEscapedCharactersMap001110Builder](#requiredwithescapedcharactersmap001110builder) | fooReverseSolidusReverseSolidusBar(value: Float) | +| [RequiredWithEscapedCharactersMap001110Builder](#requiredwithescapedcharactersmap001110builder) | fooReverseSolidusReverseSolidusBar(value: Long) | +| [RequiredWithEscapedCharactersMap001110Builder](#requiredwithescapedcharactersmap001110builder) | fooReverseSolidusReverseSolidusBar(value: Double) | +| [RequiredWithEscapedCharactersMap001110Builder](#requiredwithescapedcharactersmap001110builder) | fooReverseSolidusReverseSolidusBar(value: List) | +| [RequiredWithEscapedCharactersMap001110Builder](#requiredwithescapedcharactersmap001110builder) | fooReverseSolidusReverseSolidusBar(value: Map) | + +## RequiredWithEscapedCharactersMap010000Builder +class RequiredWithEscapedCharactersMap010000Builder
    +builder for `Map` + +A class that builds the Map input type + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| RequiredWithEscapedCharactersMap010000Builder(Map instance)
    Creates a builder that contains the passed instance | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| [RequiredWithEscapedCharactersMap000000Builder](#requiredwithescapedcharactersmap000000builder) | fooReverseSolidusNbar(value: Nothing?) | +| [RequiredWithEscapedCharactersMap000000Builder](#requiredwithescapedcharactersmap000000builder) | fooReverseSolidusNbar(value: Boolean) | +| [RequiredWithEscapedCharactersMap000000Builder](#requiredwithescapedcharactersmap000000builder) | fooReverseSolidusNbar(value: String) | +| [RequiredWithEscapedCharactersMap000000Builder](#requiredwithescapedcharactersmap000000builder) | fooReverseSolidusNbar(value: Int) | +| [RequiredWithEscapedCharactersMap000000Builder](#requiredwithescapedcharactersmap000000builder) | fooReverseSolidusNbar(value: Float) | +| [RequiredWithEscapedCharactersMap000000Builder](#requiredwithescapedcharactersmap000000builder) | fooReverseSolidusNbar(value: Long) | +| [RequiredWithEscapedCharactersMap000000Builder](#requiredwithescapedcharactersmap000000builder) | fooReverseSolidusNbar(value: Double) | +| [RequiredWithEscapedCharactersMap000000Builder](#requiredwithescapedcharactersmap000000builder) | fooReverseSolidusNbar(value: List) | +| [RequiredWithEscapedCharactersMap000000Builder](#requiredwithescapedcharactersmap000000builder) | fooReverseSolidusNbar(value: Map) | + +## RequiredWithEscapedCharactersMap010001Builder +class RequiredWithEscapedCharactersMap010001Builder
    +builder for `Map` + +A class that builds the Map input type + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| RequiredWithEscapedCharactersMap010001Builder(Map instance)
    Creates a builder that contains the passed instance | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| [RequiredWithEscapedCharactersMap000001Builder](#requiredwithescapedcharactersmap000001builder) | fooReverseSolidusNbar(value: Nothing?) | +| [RequiredWithEscapedCharactersMap000001Builder](#requiredwithescapedcharactersmap000001builder) | fooReverseSolidusNbar(value: Boolean) | +| [RequiredWithEscapedCharactersMap000001Builder](#requiredwithescapedcharactersmap000001builder) | fooReverseSolidusNbar(value: String) | +| [RequiredWithEscapedCharactersMap000001Builder](#requiredwithescapedcharactersmap000001builder) | fooReverseSolidusNbar(value: Int) | +| [RequiredWithEscapedCharactersMap000001Builder](#requiredwithescapedcharactersmap000001builder) | fooReverseSolidusNbar(value: Float) | +| [RequiredWithEscapedCharactersMap000001Builder](#requiredwithescapedcharactersmap000001builder) | fooReverseSolidusNbar(value: Long) | +| [RequiredWithEscapedCharactersMap000001Builder](#requiredwithescapedcharactersmap000001builder) | fooReverseSolidusNbar(value: Double) | +| [RequiredWithEscapedCharactersMap000001Builder](#requiredwithescapedcharactersmap000001builder) | fooReverseSolidusNbar(value: List) | +| [RequiredWithEscapedCharactersMap000001Builder](#requiredwithescapedcharactersmap000001builder) | fooReverseSolidusNbar(value: Map) | +| [RequiredWithEscapedCharactersMap010000Builder](#requiredwithescapedcharactersmap010000builder) | fooReverseSolidusReverseSolidusBar(value: Nothing?) | +| [RequiredWithEscapedCharactersMap010000Builder](#requiredwithescapedcharactersmap010000builder) | fooReverseSolidusReverseSolidusBar(value: Boolean) | +| [RequiredWithEscapedCharactersMap010000Builder](#requiredwithescapedcharactersmap010000builder) | fooReverseSolidusReverseSolidusBar(value: String) | +| [RequiredWithEscapedCharactersMap010000Builder](#requiredwithescapedcharactersmap010000builder) | fooReverseSolidusReverseSolidusBar(value: Int) | +| [RequiredWithEscapedCharactersMap010000Builder](#requiredwithescapedcharactersmap010000builder) | fooReverseSolidusReverseSolidusBar(value: Float) | +| [RequiredWithEscapedCharactersMap010000Builder](#requiredwithescapedcharactersmap010000builder) | fooReverseSolidusReverseSolidusBar(value: Long) | +| [RequiredWithEscapedCharactersMap010000Builder](#requiredwithescapedcharactersmap010000builder) | fooReverseSolidusReverseSolidusBar(value: Double) | +| [RequiredWithEscapedCharactersMap010000Builder](#requiredwithescapedcharactersmap010000builder) | fooReverseSolidusReverseSolidusBar(value: List) | +| [RequiredWithEscapedCharactersMap010000Builder](#requiredwithescapedcharactersmap010000builder) | fooReverseSolidusReverseSolidusBar(value: Map) | + +## RequiredWithEscapedCharactersMap010010Builder +class RequiredWithEscapedCharactersMap010010Builder
    +builder for `Map` + +A class that builds the Map input type + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| RequiredWithEscapedCharactersMap010010Builder(Map instance)
    Creates a builder that contains the passed instance | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| [RequiredWithEscapedCharactersMap000010Builder](#requiredwithescapedcharactersmap000010builder) | fooReverseSolidusNbar(value: Nothing?) | +| [RequiredWithEscapedCharactersMap000010Builder](#requiredwithescapedcharactersmap000010builder) | fooReverseSolidusNbar(value: Boolean) | +| [RequiredWithEscapedCharactersMap000010Builder](#requiredwithescapedcharactersmap000010builder) | fooReverseSolidusNbar(value: String) | +| [RequiredWithEscapedCharactersMap000010Builder](#requiredwithescapedcharactersmap000010builder) | fooReverseSolidusNbar(value: Int) | +| [RequiredWithEscapedCharactersMap000010Builder](#requiredwithescapedcharactersmap000010builder) | fooReverseSolidusNbar(value: Float) | +| [RequiredWithEscapedCharactersMap000010Builder](#requiredwithescapedcharactersmap000010builder) | fooReverseSolidusNbar(value: Long) | +| [RequiredWithEscapedCharactersMap000010Builder](#requiredwithescapedcharactersmap000010builder) | fooReverseSolidusNbar(value: Double) | +| [RequiredWithEscapedCharactersMap000010Builder](#requiredwithescapedcharactersmap000010builder) | fooReverseSolidusNbar(value: List) | +| [RequiredWithEscapedCharactersMap000010Builder](#requiredwithescapedcharactersmap000010builder) | fooReverseSolidusNbar(value: Map) | +| [RequiredWithEscapedCharactersMap010000Builder](#requiredwithescapedcharactersmap010000builder) | fooReverseSolidusQuotationMarkBar(value: Nothing?) | +| [RequiredWithEscapedCharactersMap010000Builder](#requiredwithescapedcharactersmap010000builder) | fooReverseSolidusQuotationMarkBar(value: Boolean) | +| [RequiredWithEscapedCharactersMap010000Builder](#requiredwithescapedcharactersmap010000builder) | fooReverseSolidusQuotationMarkBar(value: String) | +| [RequiredWithEscapedCharactersMap010000Builder](#requiredwithescapedcharactersmap010000builder) | fooReverseSolidusQuotationMarkBar(value: Int) | +| [RequiredWithEscapedCharactersMap010000Builder](#requiredwithescapedcharactersmap010000builder) | fooReverseSolidusQuotationMarkBar(value: Float) | +| [RequiredWithEscapedCharactersMap010000Builder](#requiredwithescapedcharactersmap010000builder) | fooReverseSolidusQuotationMarkBar(value: Long) | +| [RequiredWithEscapedCharactersMap010000Builder](#requiredwithescapedcharactersmap010000builder) | fooReverseSolidusQuotationMarkBar(value: Double) | +| [RequiredWithEscapedCharactersMap010000Builder](#requiredwithescapedcharactersmap010000builder) | fooReverseSolidusQuotationMarkBar(value: List) | +| [RequiredWithEscapedCharactersMap010000Builder](#requiredwithescapedcharactersmap010000builder) | fooReverseSolidusQuotationMarkBar(value: Map) | + +## RequiredWithEscapedCharactersMap010011Builder +class RequiredWithEscapedCharactersMap010011Builder
    +builder for `Map` + +A class that builds the Map input type + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| RequiredWithEscapedCharactersMap010011Builder(Map instance)
    Creates a builder that contains the passed instance | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| [RequiredWithEscapedCharactersMap000011Builder](#requiredwithescapedcharactersmap000011builder) | fooReverseSolidusNbar(value: Nothing?) | +| [RequiredWithEscapedCharactersMap000011Builder](#requiredwithescapedcharactersmap000011builder) | fooReverseSolidusNbar(value: Boolean) | +| [RequiredWithEscapedCharactersMap000011Builder](#requiredwithescapedcharactersmap000011builder) | fooReverseSolidusNbar(value: String) | +| [RequiredWithEscapedCharactersMap000011Builder](#requiredwithescapedcharactersmap000011builder) | fooReverseSolidusNbar(value: Int) | +| [RequiredWithEscapedCharactersMap000011Builder](#requiredwithescapedcharactersmap000011builder) | fooReverseSolidusNbar(value: Float) | +| [RequiredWithEscapedCharactersMap000011Builder](#requiredwithescapedcharactersmap000011builder) | fooReverseSolidusNbar(value: Long) | +| [RequiredWithEscapedCharactersMap000011Builder](#requiredwithescapedcharactersmap000011builder) | fooReverseSolidusNbar(value: Double) | +| [RequiredWithEscapedCharactersMap000011Builder](#requiredwithescapedcharactersmap000011builder) | fooReverseSolidusNbar(value: List) | +| [RequiredWithEscapedCharactersMap000011Builder](#requiredwithescapedcharactersmap000011builder) | fooReverseSolidusNbar(value: Map) | +| [RequiredWithEscapedCharactersMap010001Builder](#requiredwithescapedcharactersmap010001builder) | fooReverseSolidusQuotationMarkBar(value: Nothing?) | +| [RequiredWithEscapedCharactersMap010001Builder](#requiredwithescapedcharactersmap010001builder) | fooReverseSolidusQuotationMarkBar(value: Boolean) | +| [RequiredWithEscapedCharactersMap010001Builder](#requiredwithescapedcharactersmap010001builder) | fooReverseSolidusQuotationMarkBar(value: String) | +| [RequiredWithEscapedCharactersMap010001Builder](#requiredwithescapedcharactersmap010001builder) | fooReverseSolidusQuotationMarkBar(value: Int) | +| [RequiredWithEscapedCharactersMap010001Builder](#requiredwithescapedcharactersmap010001builder) | fooReverseSolidusQuotationMarkBar(value: Float) | +| [RequiredWithEscapedCharactersMap010001Builder](#requiredwithescapedcharactersmap010001builder) | fooReverseSolidusQuotationMarkBar(value: Long) | +| [RequiredWithEscapedCharactersMap010001Builder](#requiredwithescapedcharactersmap010001builder) | fooReverseSolidusQuotationMarkBar(value: Double) | +| [RequiredWithEscapedCharactersMap010001Builder](#requiredwithescapedcharactersmap010001builder) | fooReverseSolidusQuotationMarkBar(value: List) | +| [RequiredWithEscapedCharactersMap010001Builder](#requiredwithescapedcharactersmap010001builder) | fooReverseSolidusQuotationMarkBar(value: Map) | +| [RequiredWithEscapedCharactersMap010010Builder](#requiredwithescapedcharactersmap010010builder) | fooReverseSolidusReverseSolidusBar(value: Nothing?) | +| [RequiredWithEscapedCharactersMap010010Builder](#requiredwithescapedcharactersmap010010builder) | fooReverseSolidusReverseSolidusBar(value: Boolean) | +| [RequiredWithEscapedCharactersMap010010Builder](#requiredwithescapedcharactersmap010010builder) | fooReverseSolidusReverseSolidusBar(value: String) | +| [RequiredWithEscapedCharactersMap010010Builder](#requiredwithescapedcharactersmap010010builder) | fooReverseSolidusReverseSolidusBar(value: Int) | +| [RequiredWithEscapedCharactersMap010010Builder](#requiredwithescapedcharactersmap010010builder) | fooReverseSolidusReverseSolidusBar(value: Float) | +| [RequiredWithEscapedCharactersMap010010Builder](#requiredwithescapedcharactersmap010010builder) | fooReverseSolidusReverseSolidusBar(value: Long) | +| [RequiredWithEscapedCharactersMap010010Builder](#requiredwithescapedcharactersmap010010builder) | fooReverseSolidusReverseSolidusBar(value: Double) | +| [RequiredWithEscapedCharactersMap010010Builder](#requiredwithescapedcharactersmap010010builder) | fooReverseSolidusReverseSolidusBar(value: List) | +| [RequiredWithEscapedCharactersMap010010Builder](#requiredwithescapedcharactersmap010010builder) | fooReverseSolidusReverseSolidusBar(value: Map) | + +## RequiredWithEscapedCharactersMap010100Builder +class RequiredWithEscapedCharactersMap010100Builder
    +builder for `Map` + +A class that builds the Map input type + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| RequiredWithEscapedCharactersMap010100Builder(Map instance)
    Creates a builder that contains the passed instance | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| [RequiredWithEscapedCharactersMap000100Builder](#requiredwithescapedcharactersmap000100builder) | fooReverseSolidusNbar(value: Nothing?) | +| [RequiredWithEscapedCharactersMap000100Builder](#requiredwithescapedcharactersmap000100builder) | fooReverseSolidusNbar(value: Boolean) | +| [RequiredWithEscapedCharactersMap000100Builder](#requiredwithescapedcharactersmap000100builder) | fooReverseSolidusNbar(value: String) | +| [RequiredWithEscapedCharactersMap000100Builder](#requiredwithescapedcharactersmap000100builder) | fooReverseSolidusNbar(value: Int) | +| [RequiredWithEscapedCharactersMap000100Builder](#requiredwithescapedcharactersmap000100builder) | fooReverseSolidusNbar(value: Float) | +| [RequiredWithEscapedCharactersMap000100Builder](#requiredwithescapedcharactersmap000100builder) | fooReverseSolidusNbar(value: Long) | +| [RequiredWithEscapedCharactersMap000100Builder](#requiredwithescapedcharactersmap000100builder) | fooReverseSolidusNbar(value: Double) | +| [RequiredWithEscapedCharactersMap000100Builder](#requiredwithescapedcharactersmap000100builder) | fooReverseSolidusNbar(value: List) | +| [RequiredWithEscapedCharactersMap000100Builder](#requiredwithescapedcharactersmap000100builder) | fooReverseSolidusNbar(value: Map) | +| [RequiredWithEscapedCharactersMap010000Builder](#requiredwithescapedcharactersmap010000builder) | fooReverseSolidusRbar(value: Nothing?) | +| [RequiredWithEscapedCharactersMap010000Builder](#requiredwithescapedcharactersmap010000builder) | fooReverseSolidusRbar(value: Boolean) | +| [RequiredWithEscapedCharactersMap010000Builder](#requiredwithescapedcharactersmap010000builder) | fooReverseSolidusRbar(value: String) | +| [RequiredWithEscapedCharactersMap010000Builder](#requiredwithescapedcharactersmap010000builder) | fooReverseSolidusRbar(value: Int) | +| [RequiredWithEscapedCharactersMap010000Builder](#requiredwithescapedcharactersmap010000builder) | fooReverseSolidusRbar(value: Float) | +| [RequiredWithEscapedCharactersMap010000Builder](#requiredwithescapedcharactersmap010000builder) | fooReverseSolidusRbar(value: Long) | +| [RequiredWithEscapedCharactersMap010000Builder](#requiredwithescapedcharactersmap010000builder) | fooReverseSolidusRbar(value: Double) | +| [RequiredWithEscapedCharactersMap010000Builder](#requiredwithescapedcharactersmap010000builder) | fooReverseSolidusRbar(value: List) | +| [RequiredWithEscapedCharactersMap010000Builder](#requiredwithescapedcharactersmap010000builder) | fooReverseSolidusRbar(value: Map) | + +## RequiredWithEscapedCharactersMap010101Builder +class RequiredWithEscapedCharactersMap010101Builder
    +builder for `Map` + +A class that builds the Map input type + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| RequiredWithEscapedCharactersMap010101Builder(Map instance)
    Creates a builder that contains the passed instance | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| [RequiredWithEscapedCharactersMap000101Builder](#requiredwithescapedcharactersmap000101builder) | fooReverseSolidusNbar(value: Nothing?) | +| [RequiredWithEscapedCharactersMap000101Builder](#requiredwithescapedcharactersmap000101builder) | fooReverseSolidusNbar(value: Boolean) | +| [RequiredWithEscapedCharactersMap000101Builder](#requiredwithescapedcharactersmap000101builder) | fooReverseSolidusNbar(value: String) | +| [RequiredWithEscapedCharactersMap000101Builder](#requiredwithescapedcharactersmap000101builder) | fooReverseSolidusNbar(value: Int) | +| [RequiredWithEscapedCharactersMap000101Builder](#requiredwithescapedcharactersmap000101builder) | fooReverseSolidusNbar(value: Float) | +| [RequiredWithEscapedCharactersMap000101Builder](#requiredwithescapedcharactersmap000101builder) | fooReverseSolidusNbar(value: Long) | +| [RequiredWithEscapedCharactersMap000101Builder](#requiredwithescapedcharactersmap000101builder) | fooReverseSolidusNbar(value: Double) | +| [RequiredWithEscapedCharactersMap000101Builder](#requiredwithescapedcharactersmap000101builder) | fooReverseSolidusNbar(value: List) | +| [RequiredWithEscapedCharactersMap000101Builder](#requiredwithescapedcharactersmap000101builder) | fooReverseSolidusNbar(value: Map) | +| [RequiredWithEscapedCharactersMap010001Builder](#requiredwithescapedcharactersmap010001builder) | fooReverseSolidusRbar(value: Nothing?) | +| [RequiredWithEscapedCharactersMap010001Builder](#requiredwithescapedcharactersmap010001builder) | fooReverseSolidusRbar(value: Boolean) | +| [RequiredWithEscapedCharactersMap010001Builder](#requiredwithescapedcharactersmap010001builder) | fooReverseSolidusRbar(value: String) | +| [RequiredWithEscapedCharactersMap010001Builder](#requiredwithescapedcharactersmap010001builder) | fooReverseSolidusRbar(value: Int) | +| [RequiredWithEscapedCharactersMap010001Builder](#requiredwithescapedcharactersmap010001builder) | fooReverseSolidusRbar(value: Float) | +| [RequiredWithEscapedCharactersMap010001Builder](#requiredwithescapedcharactersmap010001builder) | fooReverseSolidusRbar(value: Long) | +| [RequiredWithEscapedCharactersMap010001Builder](#requiredwithescapedcharactersmap010001builder) | fooReverseSolidusRbar(value: Double) | +| [RequiredWithEscapedCharactersMap010001Builder](#requiredwithescapedcharactersmap010001builder) | fooReverseSolidusRbar(value: List) | +| [RequiredWithEscapedCharactersMap010001Builder](#requiredwithescapedcharactersmap010001builder) | fooReverseSolidusRbar(value: Map) | +| [RequiredWithEscapedCharactersMap010100Builder](#requiredwithescapedcharactersmap010100builder) | fooReverseSolidusReverseSolidusBar(value: Nothing?) | +| [RequiredWithEscapedCharactersMap010100Builder](#requiredwithescapedcharactersmap010100builder) | fooReverseSolidusReverseSolidusBar(value: Boolean) | +| [RequiredWithEscapedCharactersMap010100Builder](#requiredwithescapedcharactersmap010100builder) | fooReverseSolidusReverseSolidusBar(value: String) | +| [RequiredWithEscapedCharactersMap010100Builder](#requiredwithescapedcharactersmap010100builder) | fooReverseSolidusReverseSolidusBar(value: Int) | +| [RequiredWithEscapedCharactersMap010100Builder](#requiredwithescapedcharactersmap010100builder) | fooReverseSolidusReverseSolidusBar(value: Float) | +| [RequiredWithEscapedCharactersMap010100Builder](#requiredwithescapedcharactersmap010100builder) | fooReverseSolidusReverseSolidusBar(value: Long) | +| [RequiredWithEscapedCharactersMap010100Builder](#requiredwithescapedcharactersmap010100builder) | fooReverseSolidusReverseSolidusBar(value: Double) | +| [RequiredWithEscapedCharactersMap010100Builder](#requiredwithescapedcharactersmap010100builder) | fooReverseSolidusReverseSolidusBar(value: List) | +| [RequiredWithEscapedCharactersMap010100Builder](#requiredwithescapedcharactersmap010100builder) | fooReverseSolidusReverseSolidusBar(value: Map) | + +## RequiredWithEscapedCharactersMap010110Builder +class RequiredWithEscapedCharactersMap010110Builder
    +builder for `Map` + +A class that builds the Map input type + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| RequiredWithEscapedCharactersMap010110Builder(Map instance)
    Creates a builder that contains the passed instance | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| [RequiredWithEscapedCharactersMap000110Builder](#requiredwithescapedcharactersmap000110builder) | fooReverseSolidusNbar(value: Nothing?) | +| [RequiredWithEscapedCharactersMap000110Builder](#requiredwithescapedcharactersmap000110builder) | fooReverseSolidusNbar(value: Boolean) | +| [RequiredWithEscapedCharactersMap000110Builder](#requiredwithescapedcharactersmap000110builder) | fooReverseSolidusNbar(value: String) | +| [RequiredWithEscapedCharactersMap000110Builder](#requiredwithescapedcharactersmap000110builder) | fooReverseSolidusNbar(value: Int) | +| [RequiredWithEscapedCharactersMap000110Builder](#requiredwithescapedcharactersmap000110builder) | fooReverseSolidusNbar(value: Float) | +| [RequiredWithEscapedCharactersMap000110Builder](#requiredwithescapedcharactersmap000110builder) | fooReverseSolidusNbar(value: Long) | +| [RequiredWithEscapedCharactersMap000110Builder](#requiredwithescapedcharactersmap000110builder) | fooReverseSolidusNbar(value: Double) | +| [RequiredWithEscapedCharactersMap000110Builder](#requiredwithescapedcharactersmap000110builder) | fooReverseSolidusNbar(value: List) | +| [RequiredWithEscapedCharactersMap000110Builder](#requiredwithescapedcharactersmap000110builder) | fooReverseSolidusNbar(value: Map) | +| [RequiredWithEscapedCharactersMap010010Builder](#requiredwithescapedcharactersmap010010builder) | fooReverseSolidusRbar(value: Nothing?) | +| [RequiredWithEscapedCharactersMap010010Builder](#requiredwithescapedcharactersmap010010builder) | fooReverseSolidusRbar(value: Boolean) | +| [RequiredWithEscapedCharactersMap010010Builder](#requiredwithescapedcharactersmap010010builder) | fooReverseSolidusRbar(value: String) | +| [RequiredWithEscapedCharactersMap010010Builder](#requiredwithescapedcharactersmap010010builder) | fooReverseSolidusRbar(value: Int) | +| [RequiredWithEscapedCharactersMap010010Builder](#requiredwithescapedcharactersmap010010builder) | fooReverseSolidusRbar(value: Float) | +| [RequiredWithEscapedCharactersMap010010Builder](#requiredwithescapedcharactersmap010010builder) | fooReverseSolidusRbar(value: Long) | +| [RequiredWithEscapedCharactersMap010010Builder](#requiredwithescapedcharactersmap010010builder) | fooReverseSolidusRbar(value: Double) | +| [RequiredWithEscapedCharactersMap010010Builder](#requiredwithescapedcharactersmap010010builder) | fooReverseSolidusRbar(value: List) | +| [RequiredWithEscapedCharactersMap010010Builder](#requiredwithescapedcharactersmap010010builder) | fooReverseSolidusRbar(value: Map) | +| [RequiredWithEscapedCharactersMap010100Builder](#requiredwithescapedcharactersmap010100builder) | fooReverseSolidusQuotationMarkBar(value: Nothing?) | +| [RequiredWithEscapedCharactersMap010100Builder](#requiredwithescapedcharactersmap010100builder) | fooReverseSolidusQuotationMarkBar(value: Boolean) | +| [RequiredWithEscapedCharactersMap010100Builder](#requiredwithescapedcharactersmap010100builder) | fooReverseSolidusQuotationMarkBar(value: String) | +| [RequiredWithEscapedCharactersMap010100Builder](#requiredwithescapedcharactersmap010100builder) | fooReverseSolidusQuotationMarkBar(value: Int) | +| [RequiredWithEscapedCharactersMap010100Builder](#requiredwithescapedcharactersmap010100builder) | fooReverseSolidusQuotationMarkBar(value: Float) | +| [RequiredWithEscapedCharactersMap010100Builder](#requiredwithescapedcharactersmap010100builder) | fooReverseSolidusQuotationMarkBar(value: Long) | +| [RequiredWithEscapedCharactersMap010100Builder](#requiredwithescapedcharactersmap010100builder) | fooReverseSolidusQuotationMarkBar(value: Double) | +| [RequiredWithEscapedCharactersMap010100Builder](#requiredwithescapedcharactersmap010100builder) | fooReverseSolidusQuotationMarkBar(value: List) | +| [RequiredWithEscapedCharactersMap010100Builder](#requiredwithescapedcharactersmap010100builder) | fooReverseSolidusQuotationMarkBar(value: Map) | + +## RequiredWithEscapedCharactersMap010111Builder +class RequiredWithEscapedCharactersMap010111Builder
    +builder for `Map` + +A class that builds the Map input type + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| RequiredWithEscapedCharactersMap010111Builder(Map instance)
    Creates a builder that contains the passed instance | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| [RequiredWithEscapedCharactersMap000111Builder](#requiredwithescapedcharactersmap000111builder) | fooReverseSolidusNbar(value: Nothing?) | +| [RequiredWithEscapedCharactersMap000111Builder](#requiredwithescapedcharactersmap000111builder) | fooReverseSolidusNbar(value: Boolean) | +| [RequiredWithEscapedCharactersMap000111Builder](#requiredwithescapedcharactersmap000111builder) | fooReverseSolidusNbar(value: String) | +| [RequiredWithEscapedCharactersMap000111Builder](#requiredwithescapedcharactersmap000111builder) | fooReverseSolidusNbar(value: Int) | +| [RequiredWithEscapedCharactersMap000111Builder](#requiredwithescapedcharactersmap000111builder) | fooReverseSolidusNbar(value: Float) | +| [RequiredWithEscapedCharactersMap000111Builder](#requiredwithescapedcharactersmap000111builder) | fooReverseSolidusNbar(value: Long) | +| [RequiredWithEscapedCharactersMap000111Builder](#requiredwithescapedcharactersmap000111builder) | fooReverseSolidusNbar(value: Double) | +| [RequiredWithEscapedCharactersMap000111Builder](#requiredwithescapedcharactersmap000111builder) | fooReverseSolidusNbar(value: List) | +| [RequiredWithEscapedCharactersMap000111Builder](#requiredwithescapedcharactersmap000111builder) | fooReverseSolidusNbar(value: Map) | +| [RequiredWithEscapedCharactersMap010011Builder](#requiredwithescapedcharactersmap010011builder) | fooReverseSolidusRbar(value: Nothing?) | +| [RequiredWithEscapedCharactersMap010011Builder](#requiredwithescapedcharactersmap010011builder) | fooReverseSolidusRbar(value: Boolean) | +| [RequiredWithEscapedCharactersMap010011Builder](#requiredwithescapedcharactersmap010011builder) | fooReverseSolidusRbar(value: String) | +| [RequiredWithEscapedCharactersMap010011Builder](#requiredwithescapedcharactersmap010011builder) | fooReverseSolidusRbar(value: Int) | +| [RequiredWithEscapedCharactersMap010011Builder](#requiredwithescapedcharactersmap010011builder) | fooReverseSolidusRbar(value: Float) | +| [RequiredWithEscapedCharactersMap010011Builder](#requiredwithescapedcharactersmap010011builder) | fooReverseSolidusRbar(value: Long) | +| [RequiredWithEscapedCharactersMap010011Builder](#requiredwithescapedcharactersmap010011builder) | fooReverseSolidusRbar(value: Double) | +| [RequiredWithEscapedCharactersMap010011Builder](#requiredwithescapedcharactersmap010011builder) | fooReverseSolidusRbar(value: List) | +| [RequiredWithEscapedCharactersMap010011Builder](#requiredwithescapedcharactersmap010011builder) | fooReverseSolidusRbar(value: Map) | +| [RequiredWithEscapedCharactersMap010101Builder](#requiredwithescapedcharactersmap010101builder) | fooReverseSolidusQuotationMarkBar(value: Nothing?) | +| [RequiredWithEscapedCharactersMap010101Builder](#requiredwithescapedcharactersmap010101builder) | fooReverseSolidusQuotationMarkBar(value: Boolean) | +| [RequiredWithEscapedCharactersMap010101Builder](#requiredwithescapedcharactersmap010101builder) | fooReverseSolidusQuotationMarkBar(value: String) | +| [RequiredWithEscapedCharactersMap010101Builder](#requiredwithescapedcharactersmap010101builder) | fooReverseSolidusQuotationMarkBar(value: Int) | +| [RequiredWithEscapedCharactersMap010101Builder](#requiredwithescapedcharactersmap010101builder) | fooReverseSolidusQuotationMarkBar(value: Float) | +| [RequiredWithEscapedCharactersMap010101Builder](#requiredwithescapedcharactersmap010101builder) | fooReverseSolidusQuotationMarkBar(value: Long) | +| [RequiredWithEscapedCharactersMap010101Builder](#requiredwithescapedcharactersmap010101builder) | fooReverseSolidusQuotationMarkBar(value: Double) | +| [RequiredWithEscapedCharactersMap010101Builder](#requiredwithescapedcharactersmap010101builder) | fooReverseSolidusQuotationMarkBar(value: List) | +| [RequiredWithEscapedCharactersMap010101Builder](#requiredwithescapedcharactersmap010101builder) | fooReverseSolidusQuotationMarkBar(value: Map) | +| [RequiredWithEscapedCharactersMap010110Builder](#requiredwithescapedcharactersmap010110builder) | fooReverseSolidusReverseSolidusBar(value: Nothing?) | +| [RequiredWithEscapedCharactersMap010110Builder](#requiredwithescapedcharactersmap010110builder) | fooReverseSolidusReverseSolidusBar(value: Boolean) | +| [RequiredWithEscapedCharactersMap010110Builder](#requiredwithescapedcharactersmap010110builder) | fooReverseSolidusReverseSolidusBar(value: String) | +| [RequiredWithEscapedCharactersMap010110Builder](#requiredwithescapedcharactersmap010110builder) | fooReverseSolidusReverseSolidusBar(value: Int) | +| [RequiredWithEscapedCharactersMap010110Builder](#requiredwithescapedcharactersmap010110builder) | fooReverseSolidusReverseSolidusBar(value: Float) | +| [RequiredWithEscapedCharactersMap010110Builder](#requiredwithescapedcharactersmap010110builder) | fooReverseSolidusReverseSolidusBar(value: Long) | +| [RequiredWithEscapedCharactersMap010110Builder](#requiredwithescapedcharactersmap010110builder) | fooReverseSolidusReverseSolidusBar(value: Double) | +| [RequiredWithEscapedCharactersMap010110Builder](#requiredwithescapedcharactersmap010110builder) | fooReverseSolidusReverseSolidusBar(value: List) | +| [RequiredWithEscapedCharactersMap010110Builder](#requiredwithescapedcharactersmap010110builder) | fooReverseSolidusReverseSolidusBar(value: Map) | + +## RequiredWithEscapedCharactersMap011000Builder +class RequiredWithEscapedCharactersMap011000Builder
    +builder for `Map` + +A class that builds the Map input type + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| RequiredWithEscapedCharactersMap011000Builder(Map instance)
    Creates a builder that contains the passed instance | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| [RequiredWithEscapedCharactersMap001000Builder](#requiredwithescapedcharactersmap001000builder) | fooReverseSolidusNbar(value: Nothing?) | +| [RequiredWithEscapedCharactersMap001000Builder](#requiredwithescapedcharactersmap001000builder) | fooReverseSolidusNbar(value: Boolean) | +| [RequiredWithEscapedCharactersMap001000Builder](#requiredwithescapedcharactersmap001000builder) | fooReverseSolidusNbar(value: String) | +| [RequiredWithEscapedCharactersMap001000Builder](#requiredwithescapedcharactersmap001000builder) | fooReverseSolidusNbar(value: Int) | +| [RequiredWithEscapedCharactersMap001000Builder](#requiredwithescapedcharactersmap001000builder) | fooReverseSolidusNbar(value: Float) | +| [RequiredWithEscapedCharactersMap001000Builder](#requiredwithescapedcharactersmap001000builder) | fooReverseSolidusNbar(value: Long) | +| [RequiredWithEscapedCharactersMap001000Builder](#requiredwithescapedcharactersmap001000builder) | fooReverseSolidusNbar(value: Double) | +| [RequiredWithEscapedCharactersMap001000Builder](#requiredwithescapedcharactersmap001000builder) | fooReverseSolidusNbar(value: List) | +| [RequiredWithEscapedCharactersMap001000Builder](#requiredwithescapedcharactersmap001000builder) | fooReverseSolidusNbar(value: Map) | +| [RequiredWithEscapedCharactersMap010000Builder](#requiredwithescapedcharactersmap010000builder) | fooReverseSolidusU000cbar(value: Nothing?) | +| [RequiredWithEscapedCharactersMap010000Builder](#requiredwithescapedcharactersmap010000builder) | fooReverseSolidusU000cbar(value: Boolean) | +| [RequiredWithEscapedCharactersMap010000Builder](#requiredwithescapedcharactersmap010000builder) | fooReverseSolidusU000cbar(value: String) | +| [RequiredWithEscapedCharactersMap010000Builder](#requiredwithescapedcharactersmap010000builder) | fooReverseSolidusU000cbar(value: Int) | +| [RequiredWithEscapedCharactersMap010000Builder](#requiredwithescapedcharactersmap010000builder) | fooReverseSolidusU000cbar(value: Float) | +| [RequiredWithEscapedCharactersMap010000Builder](#requiredwithescapedcharactersmap010000builder) | fooReverseSolidusU000cbar(value: Long) | +| [RequiredWithEscapedCharactersMap010000Builder](#requiredwithescapedcharactersmap010000builder) | fooReverseSolidusU000cbar(value: Double) | +| [RequiredWithEscapedCharactersMap010000Builder](#requiredwithescapedcharactersmap010000builder) | fooReverseSolidusU000cbar(value: List) | +| [RequiredWithEscapedCharactersMap010000Builder](#requiredwithescapedcharactersmap010000builder) | fooReverseSolidusU000cbar(value: Map) | + +## RequiredWithEscapedCharactersMap011001Builder +class RequiredWithEscapedCharactersMap011001Builder
    +builder for `Map` + +A class that builds the Map input type + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| RequiredWithEscapedCharactersMap011001Builder(Map instance)
    Creates a builder that contains the passed instance | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| [RequiredWithEscapedCharactersMap001001Builder](#requiredwithescapedcharactersmap001001builder) | fooReverseSolidusNbar(value: Nothing?) | +| [RequiredWithEscapedCharactersMap001001Builder](#requiredwithescapedcharactersmap001001builder) | fooReverseSolidusNbar(value: Boolean) | +| [RequiredWithEscapedCharactersMap001001Builder](#requiredwithescapedcharactersmap001001builder) | fooReverseSolidusNbar(value: String) | +| [RequiredWithEscapedCharactersMap001001Builder](#requiredwithescapedcharactersmap001001builder) | fooReverseSolidusNbar(value: Int) | +| [RequiredWithEscapedCharactersMap001001Builder](#requiredwithescapedcharactersmap001001builder) | fooReverseSolidusNbar(value: Float) | +| [RequiredWithEscapedCharactersMap001001Builder](#requiredwithescapedcharactersmap001001builder) | fooReverseSolidusNbar(value: Long) | +| [RequiredWithEscapedCharactersMap001001Builder](#requiredwithescapedcharactersmap001001builder) | fooReverseSolidusNbar(value: Double) | +| [RequiredWithEscapedCharactersMap001001Builder](#requiredwithescapedcharactersmap001001builder) | fooReverseSolidusNbar(value: List) | +| [RequiredWithEscapedCharactersMap001001Builder](#requiredwithescapedcharactersmap001001builder) | fooReverseSolidusNbar(value: Map) | +| [RequiredWithEscapedCharactersMap010001Builder](#requiredwithescapedcharactersmap010001builder) | fooReverseSolidusU000cbar(value: Nothing?) | +| [RequiredWithEscapedCharactersMap010001Builder](#requiredwithescapedcharactersmap010001builder) | fooReverseSolidusU000cbar(value: Boolean) | +| [RequiredWithEscapedCharactersMap010001Builder](#requiredwithescapedcharactersmap010001builder) | fooReverseSolidusU000cbar(value: String) | +| [RequiredWithEscapedCharactersMap010001Builder](#requiredwithescapedcharactersmap010001builder) | fooReverseSolidusU000cbar(value: Int) | +| [RequiredWithEscapedCharactersMap010001Builder](#requiredwithescapedcharactersmap010001builder) | fooReverseSolidusU000cbar(value: Float) | +| [RequiredWithEscapedCharactersMap010001Builder](#requiredwithescapedcharactersmap010001builder) | fooReverseSolidusU000cbar(value: Long) | +| [RequiredWithEscapedCharactersMap010001Builder](#requiredwithescapedcharactersmap010001builder) | fooReverseSolidusU000cbar(value: Double) | +| [RequiredWithEscapedCharactersMap010001Builder](#requiredwithescapedcharactersmap010001builder) | fooReverseSolidusU000cbar(value: List) | +| [RequiredWithEscapedCharactersMap010001Builder](#requiredwithescapedcharactersmap010001builder) | fooReverseSolidusU000cbar(value: Map) | +| [RequiredWithEscapedCharactersMap011000Builder](#requiredwithescapedcharactersmap011000builder) | fooReverseSolidusReverseSolidusBar(value: Nothing?) | +| [RequiredWithEscapedCharactersMap011000Builder](#requiredwithescapedcharactersmap011000builder) | fooReverseSolidusReverseSolidusBar(value: Boolean) | +| [RequiredWithEscapedCharactersMap011000Builder](#requiredwithescapedcharactersmap011000builder) | fooReverseSolidusReverseSolidusBar(value: String) | +| [RequiredWithEscapedCharactersMap011000Builder](#requiredwithescapedcharactersmap011000builder) | fooReverseSolidusReverseSolidusBar(value: Int) | +| [RequiredWithEscapedCharactersMap011000Builder](#requiredwithescapedcharactersmap011000builder) | fooReverseSolidusReverseSolidusBar(value: Float) | +| [RequiredWithEscapedCharactersMap011000Builder](#requiredwithescapedcharactersmap011000builder) | fooReverseSolidusReverseSolidusBar(value: Long) | +| [RequiredWithEscapedCharactersMap011000Builder](#requiredwithescapedcharactersmap011000builder) | fooReverseSolidusReverseSolidusBar(value: Double) | +| [RequiredWithEscapedCharactersMap011000Builder](#requiredwithescapedcharactersmap011000builder) | fooReverseSolidusReverseSolidusBar(value: List) | +| [RequiredWithEscapedCharactersMap011000Builder](#requiredwithescapedcharactersmap011000builder) | fooReverseSolidusReverseSolidusBar(value: Map) | + +## RequiredWithEscapedCharactersMap011010Builder +class RequiredWithEscapedCharactersMap011010Builder
    +builder for `Map` + +A class that builds the Map input type + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| RequiredWithEscapedCharactersMap011010Builder(Map instance)
    Creates a builder that contains the passed instance | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| [RequiredWithEscapedCharactersMap001010Builder](#requiredwithescapedcharactersmap001010builder) | fooReverseSolidusNbar(value: Nothing?) | +| [RequiredWithEscapedCharactersMap001010Builder](#requiredwithescapedcharactersmap001010builder) | fooReverseSolidusNbar(value: Boolean) | +| [RequiredWithEscapedCharactersMap001010Builder](#requiredwithescapedcharactersmap001010builder) | fooReverseSolidusNbar(value: String) | +| [RequiredWithEscapedCharactersMap001010Builder](#requiredwithescapedcharactersmap001010builder) | fooReverseSolidusNbar(value: Int) | +| [RequiredWithEscapedCharactersMap001010Builder](#requiredwithescapedcharactersmap001010builder) | fooReverseSolidusNbar(value: Float) | +| [RequiredWithEscapedCharactersMap001010Builder](#requiredwithescapedcharactersmap001010builder) | fooReverseSolidusNbar(value: Long) | +| [RequiredWithEscapedCharactersMap001010Builder](#requiredwithescapedcharactersmap001010builder) | fooReverseSolidusNbar(value: Double) | +| [RequiredWithEscapedCharactersMap001010Builder](#requiredwithescapedcharactersmap001010builder) | fooReverseSolidusNbar(value: List) | +| [RequiredWithEscapedCharactersMap001010Builder](#requiredwithescapedcharactersmap001010builder) | fooReverseSolidusNbar(value: Map) | +| [RequiredWithEscapedCharactersMap010010Builder](#requiredwithescapedcharactersmap010010builder) | fooReverseSolidusU000cbar(value: Nothing?) | +| [RequiredWithEscapedCharactersMap010010Builder](#requiredwithescapedcharactersmap010010builder) | fooReverseSolidusU000cbar(value: Boolean) | +| [RequiredWithEscapedCharactersMap010010Builder](#requiredwithescapedcharactersmap010010builder) | fooReverseSolidusU000cbar(value: String) | +| [RequiredWithEscapedCharactersMap010010Builder](#requiredwithescapedcharactersmap010010builder) | fooReverseSolidusU000cbar(value: Int) | +| [RequiredWithEscapedCharactersMap010010Builder](#requiredwithescapedcharactersmap010010builder) | fooReverseSolidusU000cbar(value: Float) | +| [RequiredWithEscapedCharactersMap010010Builder](#requiredwithescapedcharactersmap010010builder) | fooReverseSolidusU000cbar(value: Long) | +| [RequiredWithEscapedCharactersMap010010Builder](#requiredwithescapedcharactersmap010010builder) | fooReverseSolidusU000cbar(value: Double) | +| [RequiredWithEscapedCharactersMap010010Builder](#requiredwithescapedcharactersmap010010builder) | fooReverseSolidusU000cbar(value: List) | +| [RequiredWithEscapedCharactersMap010010Builder](#requiredwithescapedcharactersmap010010builder) | fooReverseSolidusU000cbar(value: Map) | +| [RequiredWithEscapedCharactersMap011000Builder](#requiredwithescapedcharactersmap011000builder) | fooReverseSolidusQuotationMarkBar(value: Nothing?) | +| [RequiredWithEscapedCharactersMap011000Builder](#requiredwithescapedcharactersmap011000builder) | fooReverseSolidusQuotationMarkBar(value: Boolean) | +| [RequiredWithEscapedCharactersMap011000Builder](#requiredwithescapedcharactersmap011000builder) | fooReverseSolidusQuotationMarkBar(value: String) | +| [RequiredWithEscapedCharactersMap011000Builder](#requiredwithescapedcharactersmap011000builder) | fooReverseSolidusQuotationMarkBar(value: Int) | +| [RequiredWithEscapedCharactersMap011000Builder](#requiredwithescapedcharactersmap011000builder) | fooReverseSolidusQuotationMarkBar(value: Float) | +| [RequiredWithEscapedCharactersMap011000Builder](#requiredwithescapedcharactersmap011000builder) | fooReverseSolidusQuotationMarkBar(value: Long) | +| [RequiredWithEscapedCharactersMap011000Builder](#requiredwithescapedcharactersmap011000builder) | fooReverseSolidusQuotationMarkBar(value: Double) | +| [RequiredWithEscapedCharactersMap011000Builder](#requiredwithescapedcharactersmap011000builder) | fooReverseSolidusQuotationMarkBar(value: List) | +| [RequiredWithEscapedCharactersMap011000Builder](#requiredwithescapedcharactersmap011000builder) | fooReverseSolidusQuotationMarkBar(value: Map) | + +## RequiredWithEscapedCharactersMap011011Builder +class RequiredWithEscapedCharactersMap011011Builder
    +builder for `Map` + +A class that builds the Map input type + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| RequiredWithEscapedCharactersMap011011Builder(Map instance)
    Creates a builder that contains the passed instance | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| [RequiredWithEscapedCharactersMap001011Builder](#requiredwithescapedcharactersmap001011builder) | fooReverseSolidusNbar(value: Nothing?) | +| [RequiredWithEscapedCharactersMap001011Builder](#requiredwithescapedcharactersmap001011builder) | fooReverseSolidusNbar(value: Boolean) | +| [RequiredWithEscapedCharactersMap001011Builder](#requiredwithescapedcharactersmap001011builder) | fooReverseSolidusNbar(value: String) | +| [RequiredWithEscapedCharactersMap001011Builder](#requiredwithescapedcharactersmap001011builder) | fooReverseSolidusNbar(value: Int) | +| [RequiredWithEscapedCharactersMap001011Builder](#requiredwithescapedcharactersmap001011builder) | fooReverseSolidusNbar(value: Float) | +| [RequiredWithEscapedCharactersMap001011Builder](#requiredwithescapedcharactersmap001011builder) | fooReverseSolidusNbar(value: Long) | +| [RequiredWithEscapedCharactersMap001011Builder](#requiredwithescapedcharactersmap001011builder) | fooReverseSolidusNbar(value: Double) | +| [RequiredWithEscapedCharactersMap001011Builder](#requiredwithescapedcharactersmap001011builder) | fooReverseSolidusNbar(value: List) | +| [RequiredWithEscapedCharactersMap001011Builder](#requiredwithescapedcharactersmap001011builder) | fooReverseSolidusNbar(value: Map) | +| [RequiredWithEscapedCharactersMap010011Builder](#requiredwithescapedcharactersmap010011builder) | fooReverseSolidusU000cbar(value: Nothing?) | +| [RequiredWithEscapedCharactersMap010011Builder](#requiredwithescapedcharactersmap010011builder) | fooReverseSolidusU000cbar(value: Boolean) | +| [RequiredWithEscapedCharactersMap010011Builder](#requiredwithescapedcharactersmap010011builder) | fooReverseSolidusU000cbar(value: String) | +| [RequiredWithEscapedCharactersMap010011Builder](#requiredwithescapedcharactersmap010011builder) | fooReverseSolidusU000cbar(value: Int) | +| [RequiredWithEscapedCharactersMap010011Builder](#requiredwithescapedcharactersmap010011builder) | fooReverseSolidusU000cbar(value: Float) | +| [RequiredWithEscapedCharactersMap010011Builder](#requiredwithescapedcharactersmap010011builder) | fooReverseSolidusU000cbar(value: Long) | +| [RequiredWithEscapedCharactersMap010011Builder](#requiredwithescapedcharactersmap010011builder) | fooReverseSolidusU000cbar(value: Double) | +| [RequiredWithEscapedCharactersMap010011Builder](#requiredwithescapedcharactersmap010011builder) | fooReverseSolidusU000cbar(value: List) | +| [RequiredWithEscapedCharactersMap010011Builder](#requiredwithescapedcharactersmap010011builder) | fooReverseSolidusU000cbar(value: Map) | +| [RequiredWithEscapedCharactersMap011001Builder](#requiredwithescapedcharactersmap011001builder) | fooReverseSolidusQuotationMarkBar(value: Nothing?) | +| [RequiredWithEscapedCharactersMap011001Builder](#requiredwithescapedcharactersmap011001builder) | fooReverseSolidusQuotationMarkBar(value: Boolean) | +| [RequiredWithEscapedCharactersMap011001Builder](#requiredwithescapedcharactersmap011001builder) | fooReverseSolidusQuotationMarkBar(value: String) | +| [RequiredWithEscapedCharactersMap011001Builder](#requiredwithescapedcharactersmap011001builder) | fooReverseSolidusQuotationMarkBar(value: Int) | +| [RequiredWithEscapedCharactersMap011001Builder](#requiredwithescapedcharactersmap011001builder) | fooReverseSolidusQuotationMarkBar(value: Float) | +| [RequiredWithEscapedCharactersMap011001Builder](#requiredwithescapedcharactersmap011001builder) | fooReverseSolidusQuotationMarkBar(value: Long) | +| [RequiredWithEscapedCharactersMap011001Builder](#requiredwithescapedcharactersmap011001builder) | fooReverseSolidusQuotationMarkBar(value: Double) | +| [RequiredWithEscapedCharactersMap011001Builder](#requiredwithescapedcharactersmap011001builder) | fooReverseSolidusQuotationMarkBar(value: List) | +| [RequiredWithEscapedCharactersMap011001Builder](#requiredwithescapedcharactersmap011001builder) | fooReverseSolidusQuotationMarkBar(value: Map) | +| [RequiredWithEscapedCharactersMap011010Builder](#requiredwithescapedcharactersmap011010builder) | fooReverseSolidusReverseSolidusBar(value: Nothing?) | +| [RequiredWithEscapedCharactersMap011010Builder](#requiredwithescapedcharactersmap011010builder) | fooReverseSolidusReverseSolidusBar(value: Boolean) | +| [RequiredWithEscapedCharactersMap011010Builder](#requiredwithescapedcharactersmap011010builder) | fooReverseSolidusReverseSolidusBar(value: String) | +| [RequiredWithEscapedCharactersMap011010Builder](#requiredwithescapedcharactersmap011010builder) | fooReverseSolidusReverseSolidusBar(value: Int) | +| [RequiredWithEscapedCharactersMap011010Builder](#requiredwithescapedcharactersmap011010builder) | fooReverseSolidusReverseSolidusBar(value: Float) | +| [RequiredWithEscapedCharactersMap011010Builder](#requiredwithescapedcharactersmap011010builder) | fooReverseSolidusReverseSolidusBar(value: Long) | +| [RequiredWithEscapedCharactersMap011010Builder](#requiredwithescapedcharactersmap011010builder) | fooReverseSolidusReverseSolidusBar(value: Double) | +| [RequiredWithEscapedCharactersMap011010Builder](#requiredwithescapedcharactersmap011010builder) | fooReverseSolidusReverseSolidusBar(value: List) | +| [RequiredWithEscapedCharactersMap011010Builder](#requiredwithescapedcharactersmap011010builder) | fooReverseSolidusReverseSolidusBar(value: Map) | + +## RequiredWithEscapedCharactersMap011100Builder +class RequiredWithEscapedCharactersMap011100Builder
    +builder for `Map` + +A class that builds the Map input type + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| RequiredWithEscapedCharactersMap011100Builder(Map instance)
    Creates a builder that contains the passed instance | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| [RequiredWithEscapedCharactersMap001100Builder](#requiredwithescapedcharactersmap001100builder) | fooReverseSolidusNbar(value: Nothing?) | +| [RequiredWithEscapedCharactersMap001100Builder](#requiredwithescapedcharactersmap001100builder) | fooReverseSolidusNbar(value: Boolean) | +| [RequiredWithEscapedCharactersMap001100Builder](#requiredwithescapedcharactersmap001100builder) | fooReverseSolidusNbar(value: String) | +| [RequiredWithEscapedCharactersMap001100Builder](#requiredwithescapedcharactersmap001100builder) | fooReverseSolidusNbar(value: Int) | +| [RequiredWithEscapedCharactersMap001100Builder](#requiredwithescapedcharactersmap001100builder) | fooReverseSolidusNbar(value: Float) | +| [RequiredWithEscapedCharactersMap001100Builder](#requiredwithescapedcharactersmap001100builder) | fooReverseSolidusNbar(value: Long) | +| [RequiredWithEscapedCharactersMap001100Builder](#requiredwithescapedcharactersmap001100builder) | fooReverseSolidusNbar(value: Double) | +| [RequiredWithEscapedCharactersMap001100Builder](#requiredwithescapedcharactersmap001100builder) | fooReverseSolidusNbar(value: List) | +| [RequiredWithEscapedCharactersMap001100Builder](#requiredwithescapedcharactersmap001100builder) | fooReverseSolidusNbar(value: Map) | +| [RequiredWithEscapedCharactersMap010100Builder](#requiredwithescapedcharactersmap010100builder) | fooReverseSolidusU000cbar(value: Nothing?) | +| [RequiredWithEscapedCharactersMap010100Builder](#requiredwithescapedcharactersmap010100builder) | fooReverseSolidusU000cbar(value: Boolean) | +| [RequiredWithEscapedCharactersMap010100Builder](#requiredwithescapedcharactersmap010100builder) | fooReverseSolidusU000cbar(value: String) | +| [RequiredWithEscapedCharactersMap010100Builder](#requiredwithescapedcharactersmap010100builder) | fooReverseSolidusU000cbar(value: Int) | +| [RequiredWithEscapedCharactersMap010100Builder](#requiredwithescapedcharactersmap010100builder) | fooReverseSolidusU000cbar(value: Float) | +| [RequiredWithEscapedCharactersMap010100Builder](#requiredwithescapedcharactersmap010100builder) | fooReverseSolidusU000cbar(value: Long) | +| [RequiredWithEscapedCharactersMap010100Builder](#requiredwithescapedcharactersmap010100builder) | fooReverseSolidusU000cbar(value: Double) | +| [RequiredWithEscapedCharactersMap010100Builder](#requiredwithescapedcharactersmap010100builder) | fooReverseSolidusU000cbar(value: List) | +| [RequiredWithEscapedCharactersMap010100Builder](#requiredwithescapedcharactersmap010100builder) | fooReverseSolidusU000cbar(value: Map) | +| [RequiredWithEscapedCharactersMap011000Builder](#requiredwithescapedcharactersmap011000builder) | fooReverseSolidusRbar(value: Nothing?) | +| [RequiredWithEscapedCharactersMap011000Builder](#requiredwithescapedcharactersmap011000builder) | fooReverseSolidusRbar(value: Boolean) | +| [RequiredWithEscapedCharactersMap011000Builder](#requiredwithescapedcharactersmap011000builder) | fooReverseSolidusRbar(value: String) | +| [RequiredWithEscapedCharactersMap011000Builder](#requiredwithescapedcharactersmap011000builder) | fooReverseSolidusRbar(value: Int) | +| [RequiredWithEscapedCharactersMap011000Builder](#requiredwithescapedcharactersmap011000builder) | fooReverseSolidusRbar(value: Float) | +| [RequiredWithEscapedCharactersMap011000Builder](#requiredwithescapedcharactersmap011000builder) | fooReverseSolidusRbar(value: Long) | +| [RequiredWithEscapedCharactersMap011000Builder](#requiredwithescapedcharactersmap011000builder) | fooReverseSolidusRbar(value: Double) | +| [RequiredWithEscapedCharactersMap011000Builder](#requiredwithescapedcharactersmap011000builder) | fooReverseSolidusRbar(value: List) | +| [RequiredWithEscapedCharactersMap011000Builder](#requiredwithescapedcharactersmap011000builder) | fooReverseSolidusRbar(value: Map) | + +## RequiredWithEscapedCharactersMap011101Builder +class RequiredWithEscapedCharactersMap011101Builder
    +builder for `Map` + +A class that builds the Map input type + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| RequiredWithEscapedCharactersMap011101Builder(Map instance)
    Creates a builder that contains the passed instance | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| [RequiredWithEscapedCharactersMap001101Builder](#requiredwithescapedcharactersmap001101builder) | fooReverseSolidusNbar(value: Nothing?) | +| [RequiredWithEscapedCharactersMap001101Builder](#requiredwithescapedcharactersmap001101builder) | fooReverseSolidusNbar(value: Boolean) | +| [RequiredWithEscapedCharactersMap001101Builder](#requiredwithescapedcharactersmap001101builder) | fooReverseSolidusNbar(value: String) | +| [RequiredWithEscapedCharactersMap001101Builder](#requiredwithescapedcharactersmap001101builder) | fooReverseSolidusNbar(value: Int) | +| [RequiredWithEscapedCharactersMap001101Builder](#requiredwithescapedcharactersmap001101builder) | fooReverseSolidusNbar(value: Float) | +| [RequiredWithEscapedCharactersMap001101Builder](#requiredwithescapedcharactersmap001101builder) | fooReverseSolidusNbar(value: Long) | +| [RequiredWithEscapedCharactersMap001101Builder](#requiredwithescapedcharactersmap001101builder) | fooReverseSolidusNbar(value: Double) | +| [RequiredWithEscapedCharactersMap001101Builder](#requiredwithescapedcharactersmap001101builder) | fooReverseSolidusNbar(value: List) | +| [RequiredWithEscapedCharactersMap001101Builder](#requiredwithescapedcharactersmap001101builder) | fooReverseSolidusNbar(value: Map) | +| [RequiredWithEscapedCharactersMap010101Builder](#requiredwithescapedcharactersmap010101builder) | fooReverseSolidusU000cbar(value: Nothing?) | +| [RequiredWithEscapedCharactersMap010101Builder](#requiredwithescapedcharactersmap010101builder) | fooReverseSolidusU000cbar(value: Boolean) | +| [RequiredWithEscapedCharactersMap010101Builder](#requiredwithescapedcharactersmap010101builder) | fooReverseSolidusU000cbar(value: String) | +| [RequiredWithEscapedCharactersMap010101Builder](#requiredwithescapedcharactersmap010101builder) | fooReverseSolidusU000cbar(value: Int) | +| [RequiredWithEscapedCharactersMap010101Builder](#requiredwithescapedcharactersmap010101builder) | fooReverseSolidusU000cbar(value: Float) | +| [RequiredWithEscapedCharactersMap010101Builder](#requiredwithescapedcharactersmap010101builder) | fooReverseSolidusU000cbar(value: Long) | +| [RequiredWithEscapedCharactersMap010101Builder](#requiredwithescapedcharactersmap010101builder) | fooReverseSolidusU000cbar(value: Double) | +| [RequiredWithEscapedCharactersMap010101Builder](#requiredwithescapedcharactersmap010101builder) | fooReverseSolidusU000cbar(value: List) | +| [RequiredWithEscapedCharactersMap010101Builder](#requiredwithescapedcharactersmap010101builder) | fooReverseSolidusU000cbar(value: Map) | +| [RequiredWithEscapedCharactersMap011001Builder](#requiredwithescapedcharactersmap011001builder) | fooReverseSolidusRbar(value: Nothing?) | +| [RequiredWithEscapedCharactersMap011001Builder](#requiredwithescapedcharactersmap011001builder) | fooReverseSolidusRbar(value: Boolean) | +| [RequiredWithEscapedCharactersMap011001Builder](#requiredwithescapedcharactersmap011001builder) | fooReverseSolidusRbar(value: String) | +| [RequiredWithEscapedCharactersMap011001Builder](#requiredwithescapedcharactersmap011001builder) | fooReverseSolidusRbar(value: Int) | +| [RequiredWithEscapedCharactersMap011001Builder](#requiredwithescapedcharactersmap011001builder) | fooReverseSolidusRbar(value: Float) | +| [RequiredWithEscapedCharactersMap011001Builder](#requiredwithescapedcharactersmap011001builder) | fooReverseSolidusRbar(value: Long) | +| [RequiredWithEscapedCharactersMap011001Builder](#requiredwithescapedcharactersmap011001builder) | fooReverseSolidusRbar(value: Double) | +| [RequiredWithEscapedCharactersMap011001Builder](#requiredwithescapedcharactersmap011001builder) | fooReverseSolidusRbar(value: List) | +| [RequiredWithEscapedCharactersMap011001Builder](#requiredwithescapedcharactersmap011001builder) | fooReverseSolidusRbar(value: Map) | +| [RequiredWithEscapedCharactersMap011100Builder](#requiredwithescapedcharactersmap011100builder) | fooReverseSolidusReverseSolidusBar(value: Nothing?) | +| [RequiredWithEscapedCharactersMap011100Builder](#requiredwithescapedcharactersmap011100builder) | fooReverseSolidusReverseSolidusBar(value: Boolean) | +| [RequiredWithEscapedCharactersMap011100Builder](#requiredwithescapedcharactersmap011100builder) | fooReverseSolidusReverseSolidusBar(value: String) | +| [RequiredWithEscapedCharactersMap011100Builder](#requiredwithescapedcharactersmap011100builder) | fooReverseSolidusReverseSolidusBar(value: Int) | +| [RequiredWithEscapedCharactersMap011100Builder](#requiredwithescapedcharactersmap011100builder) | fooReverseSolidusReverseSolidusBar(value: Float) | +| [RequiredWithEscapedCharactersMap011100Builder](#requiredwithescapedcharactersmap011100builder) | fooReverseSolidusReverseSolidusBar(value: Long) | +| [RequiredWithEscapedCharactersMap011100Builder](#requiredwithescapedcharactersmap011100builder) | fooReverseSolidusReverseSolidusBar(value: Double) | +| [RequiredWithEscapedCharactersMap011100Builder](#requiredwithescapedcharactersmap011100builder) | fooReverseSolidusReverseSolidusBar(value: List) | +| [RequiredWithEscapedCharactersMap011100Builder](#requiredwithescapedcharactersmap011100builder) | fooReverseSolidusReverseSolidusBar(value: Map) | + +## RequiredWithEscapedCharactersMap011110Builder +class RequiredWithEscapedCharactersMap011110Builder
    +builder for `Map` + +A class that builds the Map input type + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| RequiredWithEscapedCharactersMap011110Builder(Map instance)
    Creates a builder that contains the passed instance | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| [RequiredWithEscapedCharactersMap001110Builder](#requiredwithescapedcharactersmap001110builder) | fooReverseSolidusNbar(value: Nothing?) | +| [RequiredWithEscapedCharactersMap001110Builder](#requiredwithescapedcharactersmap001110builder) | fooReverseSolidusNbar(value: Boolean) | +| [RequiredWithEscapedCharactersMap001110Builder](#requiredwithescapedcharactersmap001110builder) | fooReverseSolidusNbar(value: String) | +| [RequiredWithEscapedCharactersMap001110Builder](#requiredwithescapedcharactersmap001110builder) | fooReverseSolidusNbar(value: Int) | +| [RequiredWithEscapedCharactersMap001110Builder](#requiredwithescapedcharactersmap001110builder) | fooReverseSolidusNbar(value: Float) | +| [RequiredWithEscapedCharactersMap001110Builder](#requiredwithescapedcharactersmap001110builder) | fooReverseSolidusNbar(value: Long) | +| [RequiredWithEscapedCharactersMap001110Builder](#requiredwithescapedcharactersmap001110builder) | fooReverseSolidusNbar(value: Double) | +| [RequiredWithEscapedCharactersMap001110Builder](#requiredwithescapedcharactersmap001110builder) | fooReverseSolidusNbar(value: List) | +| [RequiredWithEscapedCharactersMap001110Builder](#requiredwithescapedcharactersmap001110builder) | fooReverseSolidusNbar(value: Map) | +| [RequiredWithEscapedCharactersMap010110Builder](#requiredwithescapedcharactersmap010110builder) | fooReverseSolidusU000cbar(value: Nothing?) | +| [RequiredWithEscapedCharactersMap010110Builder](#requiredwithescapedcharactersmap010110builder) | fooReverseSolidusU000cbar(value: Boolean) | +| [RequiredWithEscapedCharactersMap010110Builder](#requiredwithescapedcharactersmap010110builder) | fooReverseSolidusU000cbar(value: String) | +| [RequiredWithEscapedCharactersMap010110Builder](#requiredwithescapedcharactersmap010110builder) | fooReverseSolidusU000cbar(value: Int) | +| [RequiredWithEscapedCharactersMap010110Builder](#requiredwithescapedcharactersmap010110builder) | fooReverseSolidusU000cbar(value: Float) | +| [RequiredWithEscapedCharactersMap010110Builder](#requiredwithescapedcharactersmap010110builder) | fooReverseSolidusU000cbar(value: Long) | +| [RequiredWithEscapedCharactersMap010110Builder](#requiredwithescapedcharactersmap010110builder) | fooReverseSolidusU000cbar(value: Double) | +| [RequiredWithEscapedCharactersMap010110Builder](#requiredwithescapedcharactersmap010110builder) | fooReverseSolidusU000cbar(value: List) | +| [RequiredWithEscapedCharactersMap010110Builder](#requiredwithescapedcharactersmap010110builder) | fooReverseSolidusU000cbar(value: Map) | +| [RequiredWithEscapedCharactersMap011010Builder](#requiredwithescapedcharactersmap011010builder) | fooReverseSolidusRbar(value: Nothing?) | +| [RequiredWithEscapedCharactersMap011010Builder](#requiredwithescapedcharactersmap011010builder) | fooReverseSolidusRbar(value: Boolean) | +| [RequiredWithEscapedCharactersMap011010Builder](#requiredwithescapedcharactersmap011010builder) | fooReverseSolidusRbar(value: String) | +| [RequiredWithEscapedCharactersMap011010Builder](#requiredwithescapedcharactersmap011010builder) | fooReverseSolidusRbar(value: Int) | +| [RequiredWithEscapedCharactersMap011010Builder](#requiredwithescapedcharactersmap011010builder) | fooReverseSolidusRbar(value: Float) | +| [RequiredWithEscapedCharactersMap011010Builder](#requiredwithescapedcharactersmap011010builder) | fooReverseSolidusRbar(value: Long) | +| [RequiredWithEscapedCharactersMap011010Builder](#requiredwithescapedcharactersmap011010builder) | fooReverseSolidusRbar(value: Double) | +| [RequiredWithEscapedCharactersMap011010Builder](#requiredwithescapedcharactersmap011010builder) | fooReverseSolidusRbar(value: List) | +| [RequiredWithEscapedCharactersMap011010Builder](#requiredwithescapedcharactersmap011010builder) | fooReverseSolidusRbar(value: Map) | +| [RequiredWithEscapedCharactersMap011100Builder](#requiredwithescapedcharactersmap011100builder) | fooReverseSolidusQuotationMarkBar(value: Nothing?) | +| [RequiredWithEscapedCharactersMap011100Builder](#requiredwithescapedcharactersmap011100builder) | fooReverseSolidusQuotationMarkBar(value: Boolean) | +| [RequiredWithEscapedCharactersMap011100Builder](#requiredwithescapedcharactersmap011100builder) | fooReverseSolidusQuotationMarkBar(value: String) | +| [RequiredWithEscapedCharactersMap011100Builder](#requiredwithescapedcharactersmap011100builder) | fooReverseSolidusQuotationMarkBar(value: Int) | +| [RequiredWithEscapedCharactersMap011100Builder](#requiredwithescapedcharactersmap011100builder) | fooReverseSolidusQuotationMarkBar(value: Float) | +| [RequiredWithEscapedCharactersMap011100Builder](#requiredwithescapedcharactersmap011100builder) | fooReverseSolidusQuotationMarkBar(value: Long) | +| [RequiredWithEscapedCharactersMap011100Builder](#requiredwithescapedcharactersmap011100builder) | fooReverseSolidusQuotationMarkBar(value: Double) | +| [RequiredWithEscapedCharactersMap011100Builder](#requiredwithescapedcharactersmap011100builder) | fooReverseSolidusQuotationMarkBar(value: List) | +| [RequiredWithEscapedCharactersMap011100Builder](#requiredwithescapedcharactersmap011100builder) | fooReverseSolidusQuotationMarkBar(value: Map) | + +## RequiredWithEscapedCharactersMap011111Builder +class RequiredWithEscapedCharactersMap011111Builder
    +builder for `Map` + +A class that builds the Map input type + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| RequiredWithEscapedCharactersMap011111Builder(Map instance)
    Creates a builder that contains the passed instance | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| [RequiredWithEscapedCharactersMap001111Builder](#requiredwithescapedcharactersmap001111builder) | fooReverseSolidusNbar(value: Nothing?) | +| [RequiredWithEscapedCharactersMap001111Builder](#requiredwithescapedcharactersmap001111builder) | fooReverseSolidusNbar(value: Boolean) | +| [RequiredWithEscapedCharactersMap001111Builder](#requiredwithescapedcharactersmap001111builder) | fooReverseSolidusNbar(value: String) | +| [RequiredWithEscapedCharactersMap001111Builder](#requiredwithescapedcharactersmap001111builder) | fooReverseSolidusNbar(value: Int) | +| [RequiredWithEscapedCharactersMap001111Builder](#requiredwithescapedcharactersmap001111builder) | fooReverseSolidusNbar(value: Float) | +| [RequiredWithEscapedCharactersMap001111Builder](#requiredwithescapedcharactersmap001111builder) | fooReverseSolidusNbar(value: Long) | +| [RequiredWithEscapedCharactersMap001111Builder](#requiredwithescapedcharactersmap001111builder) | fooReverseSolidusNbar(value: Double) | +| [RequiredWithEscapedCharactersMap001111Builder](#requiredwithescapedcharactersmap001111builder) | fooReverseSolidusNbar(value: List) | +| [RequiredWithEscapedCharactersMap001111Builder](#requiredwithescapedcharactersmap001111builder) | fooReverseSolidusNbar(value: Map) | +| [RequiredWithEscapedCharactersMap010111Builder](#requiredwithescapedcharactersmap010111builder) | fooReverseSolidusU000cbar(value: Nothing?) | +| [RequiredWithEscapedCharactersMap010111Builder](#requiredwithescapedcharactersmap010111builder) | fooReverseSolidusU000cbar(value: Boolean) | +| [RequiredWithEscapedCharactersMap010111Builder](#requiredwithescapedcharactersmap010111builder) | fooReverseSolidusU000cbar(value: String) | +| [RequiredWithEscapedCharactersMap010111Builder](#requiredwithescapedcharactersmap010111builder) | fooReverseSolidusU000cbar(value: Int) | +| [RequiredWithEscapedCharactersMap010111Builder](#requiredwithescapedcharactersmap010111builder) | fooReverseSolidusU000cbar(value: Float) | +| [RequiredWithEscapedCharactersMap010111Builder](#requiredwithescapedcharactersmap010111builder) | fooReverseSolidusU000cbar(value: Long) | +| [RequiredWithEscapedCharactersMap010111Builder](#requiredwithescapedcharactersmap010111builder) | fooReverseSolidusU000cbar(value: Double) | +| [RequiredWithEscapedCharactersMap010111Builder](#requiredwithescapedcharactersmap010111builder) | fooReverseSolidusU000cbar(value: List) | +| [RequiredWithEscapedCharactersMap010111Builder](#requiredwithescapedcharactersmap010111builder) | fooReverseSolidusU000cbar(value: Map) | +| [RequiredWithEscapedCharactersMap011011Builder](#requiredwithescapedcharactersmap011011builder) | fooReverseSolidusRbar(value: Nothing?) | +| [RequiredWithEscapedCharactersMap011011Builder](#requiredwithescapedcharactersmap011011builder) | fooReverseSolidusRbar(value: Boolean) | +| [RequiredWithEscapedCharactersMap011011Builder](#requiredwithescapedcharactersmap011011builder) | fooReverseSolidusRbar(value: String) | +| [RequiredWithEscapedCharactersMap011011Builder](#requiredwithescapedcharactersmap011011builder) | fooReverseSolidusRbar(value: Int) | +| [RequiredWithEscapedCharactersMap011011Builder](#requiredwithescapedcharactersmap011011builder) | fooReverseSolidusRbar(value: Float) | +| [RequiredWithEscapedCharactersMap011011Builder](#requiredwithescapedcharactersmap011011builder) | fooReverseSolidusRbar(value: Long) | +| [RequiredWithEscapedCharactersMap011011Builder](#requiredwithescapedcharactersmap011011builder) | fooReverseSolidusRbar(value: Double) | +| [RequiredWithEscapedCharactersMap011011Builder](#requiredwithescapedcharactersmap011011builder) | fooReverseSolidusRbar(value: List) | +| [RequiredWithEscapedCharactersMap011011Builder](#requiredwithescapedcharactersmap011011builder) | fooReverseSolidusRbar(value: Map) | +| [RequiredWithEscapedCharactersMap011101Builder](#requiredwithescapedcharactersmap011101builder) | fooReverseSolidusQuotationMarkBar(value: Nothing?) | +| [RequiredWithEscapedCharactersMap011101Builder](#requiredwithescapedcharactersmap011101builder) | fooReverseSolidusQuotationMarkBar(value: Boolean) | +| [RequiredWithEscapedCharactersMap011101Builder](#requiredwithescapedcharactersmap011101builder) | fooReverseSolidusQuotationMarkBar(value: String) | +| [RequiredWithEscapedCharactersMap011101Builder](#requiredwithescapedcharactersmap011101builder) | fooReverseSolidusQuotationMarkBar(value: Int) | +| [RequiredWithEscapedCharactersMap011101Builder](#requiredwithescapedcharactersmap011101builder) | fooReverseSolidusQuotationMarkBar(value: Float) | +| [RequiredWithEscapedCharactersMap011101Builder](#requiredwithescapedcharactersmap011101builder) | fooReverseSolidusQuotationMarkBar(value: Long) | +| [RequiredWithEscapedCharactersMap011101Builder](#requiredwithescapedcharactersmap011101builder) | fooReverseSolidusQuotationMarkBar(value: Double) | +| [RequiredWithEscapedCharactersMap011101Builder](#requiredwithescapedcharactersmap011101builder) | fooReverseSolidusQuotationMarkBar(value: List) | +| [RequiredWithEscapedCharactersMap011101Builder](#requiredwithescapedcharactersmap011101builder) | fooReverseSolidusQuotationMarkBar(value: Map) | +| [RequiredWithEscapedCharactersMap011110Builder](#requiredwithescapedcharactersmap011110builder) | fooReverseSolidusReverseSolidusBar(value: Nothing?) | +| [RequiredWithEscapedCharactersMap011110Builder](#requiredwithescapedcharactersmap011110builder) | fooReverseSolidusReverseSolidusBar(value: Boolean) | +| [RequiredWithEscapedCharactersMap011110Builder](#requiredwithescapedcharactersmap011110builder) | fooReverseSolidusReverseSolidusBar(value: String) | +| [RequiredWithEscapedCharactersMap011110Builder](#requiredwithescapedcharactersmap011110builder) | fooReverseSolidusReverseSolidusBar(value: Int) | +| [RequiredWithEscapedCharactersMap011110Builder](#requiredwithescapedcharactersmap011110builder) | fooReverseSolidusReverseSolidusBar(value: Float) | +| [RequiredWithEscapedCharactersMap011110Builder](#requiredwithescapedcharactersmap011110builder) | fooReverseSolidusReverseSolidusBar(value: Long) | +| [RequiredWithEscapedCharactersMap011110Builder](#requiredwithescapedcharactersmap011110builder) | fooReverseSolidusReverseSolidusBar(value: Double) | +| [RequiredWithEscapedCharactersMap011110Builder](#requiredwithescapedcharactersmap011110builder) | fooReverseSolidusReverseSolidusBar(value: List) | +| [RequiredWithEscapedCharactersMap011110Builder](#requiredwithescapedcharactersmap011110builder) | fooReverseSolidusReverseSolidusBar(value: Map) | + +## RequiredWithEscapedCharactersMap100000Builder +class RequiredWithEscapedCharactersMap100000Builder
    +builder for `Map` + +A class that builds the Map input type + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| RequiredWithEscapedCharactersMap100000Builder(Map instance)
    Creates a builder that contains the passed instance | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| [RequiredWithEscapedCharactersMap000000Builder](#requiredwithescapedcharactersmap000000builder) | fooReverseSolidusTbar(value: Nothing?) | +| [RequiredWithEscapedCharactersMap000000Builder](#requiredwithescapedcharactersmap000000builder) | fooReverseSolidusTbar(value: Boolean) | +| [RequiredWithEscapedCharactersMap000000Builder](#requiredwithescapedcharactersmap000000builder) | fooReverseSolidusTbar(value: String) | +| [RequiredWithEscapedCharactersMap000000Builder](#requiredwithescapedcharactersmap000000builder) | fooReverseSolidusTbar(value: Int) | +| [RequiredWithEscapedCharactersMap000000Builder](#requiredwithescapedcharactersmap000000builder) | fooReverseSolidusTbar(value: Float) | +| [RequiredWithEscapedCharactersMap000000Builder](#requiredwithescapedcharactersmap000000builder) | fooReverseSolidusTbar(value: Long) | +| [RequiredWithEscapedCharactersMap000000Builder](#requiredwithescapedcharactersmap000000builder) | fooReverseSolidusTbar(value: Double) | +| [RequiredWithEscapedCharactersMap000000Builder](#requiredwithescapedcharactersmap000000builder) | fooReverseSolidusTbar(value: List) | +| [RequiredWithEscapedCharactersMap000000Builder](#requiredwithescapedcharactersmap000000builder) | fooReverseSolidusTbar(value: Map) | + +## RequiredWithEscapedCharactersMap100001Builder +class RequiredWithEscapedCharactersMap100001Builder
    +builder for `Map` + +A class that builds the Map input type + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| RequiredWithEscapedCharactersMap100001Builder(Map instance)
    Creates a builder that contains the passed instance | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| [RequiredWithEscapedCharactersMap000001Builder](#requiredwithescapedcharactersmap000001builder) | fooReverseSolidusTbar(value: Nothing?) | +| [RequiredWithEscapedCharactersMap000001Builder](#requiredwithescapedcharactersmap000001builder) | fooReverseSolidusTbar(value: Boolean) | +| [RequiredWithEscapedCharactersMap000001Builder](#requiredwithescapedcharactersmap000001builder) | fooReverseSolidusTbar(value: String) | +| [RequiredWithEscapedCharactersMap000001Builder](#requiredwithescapedcharactersmap000001builder) | fooReverseSolidusTbar(value: Int) | +| [RequiredWithEscapedCharactersMap000001Builder](#requiredwithescapedcharactersmap000001builder) | fooReverseSolidusTbar(value: Float) | +| [RequiredWithEscapedCharactersMap000001Builder](#requiredwithescapedcharactersmap000001builder) | fooReverseSolidusTbar(value: Long) | +| [RequiredWithEscapedCharactersMap000001Builder](#requiredwithescapedcharactersmap000001builder) | fooReverseSolidusTbar(value: Double) | +| [RequiredWithEscapedCharactersMap000001Builder](#requiredwithescapedcharactersmap000001builder) | fooReverseSolidusTbar(value: List) | +| [RequiredWithEscapedCharactersMap000001Builder](#requiredwithescapedcharactersmap000001builder) | fooReverseSolidusTbar(value: Map) | +| [RequiredWithEscapedCharactersMap100000Builder](#requiredwithescapedcharactersmap100000builder) | fooReverseSolidusReverseSolidusBar(value: Nothing?) | +| [RequiredWithEscapedCharactersMap100000Builder](#requiredwithescapedcharactersmap100000builder) | fooReverseSolidusReverseSolidusBar(value: Boolean) | +| [RequiredWithEscapedCharactersMap100000Builder](#requiredwithescapedcharactersmap100000builder) | fooReverseSolidusReverseSolidusBar(value: String) | +| [RequiredWithEscapedCharactersMap100000Builder](#requiredwithescapedcharactersmap100000builder) | fooReverseSolidusReverseSolidusBar(value: Int) | +| [RequiredWithEscapedCharactersMap100000Builder](#requiredwithescapedcharactersmap100000builder) | fooReverseSolidusReverseSolidusBar(value: Float) | +| [RequiredWithEscapedCharactersMap100000Builder](#requiredwithescapedcharactersmap100000builder) | fooReverseSolidusReverseSolidusBar(value: Long) | +| [RequiredWithEscapedCharactersMap100000Builder](#requiredwithescapedcharactersmap100000builder) | fooReverseSolidusReverseSolidusBar(value: Double) | +| [RequiredWithEscapedCharactersMap100000Builder](#requiredwithescapedcharactersmap100000builder) | fooReverseSolidusReverseSolidusBar(value: List) | +| [RequiredWithEscapedCharactersMap100000Builder](#requiredwithescapedcharactersmap100000builder) | fooReverseSolidusReverseSolidusBar(value: Map) | + +## RequiredWithEscapedCharactersMap100010Builder +class RequiredWithEscapedCharactersMap100010Builder
    +builder for `Map` + +A class that builds the Map input type + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| RequiredWithEscapedCharactersMap100010Builder(Map instance)
    Creates a builder that contains the passed instance | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| [RequiredWithEscapedCharactersMap000010Builder](#requiredwithescapedcharactersmap000010builder) | fooReverseSolidusTbar(value: Nothing?) | +| [RequiredWithEscapedCharactersMap000010Builder](#requiredwithescapedcharactersmap000010builder) | fooReverseSolidusTbar(value: Boolean) | +| [RequiredWithEscapedCharactersMap000010Builder](#requiredwithescapedcharactersmap000010builder) | fooReverseSolidusTbar(value: String) | +| [RequiredWithEscapedCharactersMap000010Builder](#requiredwithescapedcharactersmap000010builder) | fooReverseSolidusTbar(value: Int) | +| [RequiredWithEscapedCharactersMap000010Builder](#requiredwithescapedcharactersmap000010builder) | fooReverseSolidusTbar(value: Float) | +| [RequiredWithEscapedCharactersMap000010Builder](#requiredwithescapedcharactersmap000010builder) | fooReverseSolidusTbar(value: Long) | +| [RequiredWithEscapedCharactersMap000010Builder](#requiredwithescapedcharactersmap000010builder) | fooReverseSolidusTbar(value: Double) | +| [RequiredWithEscapedCharactersMap000010Builder](#requiredwithescapedcharactersmap000010builder) | fooReverseSolidusTbar(value: List) | +| [RequiredWithEscapedCharactersMap000010Builder](#requiredwithescapedcharactersmap000010builder) | fooReverseSolidusTbar(value: Map) | +| [RequiredWithEscapedCharactersMap100000Builder](#requiredwithescapedcharactersmap100000builder) | fooReverseSolidusQuotationMarkBar(value: Nothing?) | +| [RequiredWithEscapedCharactersMap100000Builder](#requiredwithescapedcharactersmap100000builder) | fooReverseSolidusQuotationMarkBar(value: Boolean) | +| [RequiredWithEscapedCharactersMap100000Builder](#requiredwithescapedcharactersmap100000builder) | fooReverseSolidusQuotationMarkBar(value: String) | +| [RequiredWithEscapedCharactersMap100000Builder](#requiredwithescapedcharactersmap100000builder) | fooReverseSolidusQuotationMarkBar(value: Int) | +| [RequiredWithEscapedCharactersMap100000Builder](#requiredwithescapedcharactersmap100000builder) | fooReverseSolidusQuotationMarkBar(value: Float) | +| [RequiredWithEscapedCharactersMap100000Builder](#requiredwithescapedcharactersmap100000builder) | fooReverseSolidusQuotationMarkBar(value: Long) | +| [RequiredWithEscapedCharactersMap100000Builder](#requiredwithescapedcharactersmap100000builder) | fooReverseSolidusQuotationMarkBar(value: Double) | +| [RequiredWithEscapedCharactersMap100000Builder](#requiredwithescapedcharactersmap100000builder) | fooReverseSolidusQuotationMarkBar(value: List) | +| [RequiredWithEscapedCharactersMap100000Builder](#requiredwithescapedcharactersmap100000builder) | fooReverseSolidusQuotationMarkBar(value: Map) | + +## RequiredWithEscapedCharactersMap100011Builder +class RequiredWithEscapedCharactersMap100011Builder
    +builder for `Map` + +A class that builds the Map input type + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| RequiredWithEscapedCharactersMap100011Builder(Map instance)
    Creates a builder that contains the passed instance | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| [RequiredWithEscapedCharactersMap000011Builder](#requiredwithescapedcharactersmap000011builder) | fooReverseSolidusTbar(value: Nothing?) | +| [RequiredWithEscapedCharactersMap000011Builder](#requiredwithescapedcharactersmap000011builder) | fooReverseSolidusTbar(value: Boolean) | +| [RequiredWithEscapedCharactersMap000011Builder](#requiredwithescapedcharactersmap000011builder) | fooReverseSolidusTbar(value: String) | +| [RequiredWithEscapedCharactersMap000011Builder](#requiredwithescapedcharactersmap000011builder) | fooReverseSolidusTbar(value: Int) | +| [RequiredWithEscapedCharactersMap000011Builder](#requiredwithescapedcharactersmap000011builder) | fooReverseSolidusTbar(value: Float) | +| [RequiredWithEscapedCharactersMap000011Builder](#requiredwithescapedcharactersmap000011builder) | fooReverseSolidusTbar(value: Long) | +| [RequiredWithEscapedCharactersMap000011Builder](#requiredwithescapedcharactersmap000011builder) | fooReverseSolidusTbar(value: Double) | +| [RequiredWithEscapedCharactersMap000011Builder](#requiredwithescapedcharactersmap000011builder) | fooReverseSolidusTbar(value: List) | +| [RequiredWithEscapedCharactersMap000011Builder](#requiredwithescapedcharactersmap000011builder) | fooReverseSolidusTbar(value: Map) | +| [RequiredWithEscapedCharactersMap100001Builder](#requiredwithescapedcharactersmap100001builder) | fooReverseSolidusQuotationMarkBar(value: Nothing?) | +| [RequiredWithEscapedCharactersMap100001Builder](#requiredwithescapedcharactersmap100001builder) | fooReverseSolidusQuotationMarkBar(value: Boolean) | +| [RequiredWithEscapedCharactersMap100001Builder](#requiredwithescapedcharactersmap100001builder) | fooReverseSolidusQuotationMarkBar(value: String) | +| [RequiredWithEscapedCharactersMap100001Builder](#requiredwithescapedcharactersmap100001builder) | fooReverseSolidusQuotationMarkBar(value: Int) | +| [RequiredWithEscapedCharactersMap100001Builder](#requiredwithescapedcharactersmap100001builder) | fooReverseSolidusQuotationMarkBar(value: Float) | +| [RequiredWithEscapedCharactersMap100001Builder](#requiredwithescapedcharactersmap100001builder) | fooReverseSolidusQuotationMarkBar(value: Long) | +| [RequiredWithEscapedCharactersMap100001Builder](#requiredwithescapedcharactersmap100001builder) | fooReverseSolidusQuotationMarkBar(value: Double) | +| [RequiredWithEscapedCharactersMap100001Builder](#requiredwithescapedcharactersmap100001builder) | fooReverseSolidusQuotationMarkBar(value: List) | +| [RequiredWithEscapedCharactersMap100001Builder](#requiredwithescapedcharactersmap100001builder) | fooReverseSolidusQuotationMarkBar(value: Map) | +| [RequiredWithEscapedCharactersMap100010Builder](#requiredwithescapedcharactersmap100010builder) | fooReverseSolidusReverseSolidusBar(value: Nothing?) | +| [RequiredWithEscapedCharactersMap100010Builder](#requiredwithescapedcharactersmap100010builder) | fooReverseSolidusReverseSolidusBar(value: Boolean) | +| [RequiredWithEscapedCharactersMap100010Builder](#requiredwithescapedcharactersmap100010builder) | fooReverseSolidusReverseSolidusBar(value: String) | +| [RequiredWithEscapedCharactersMap100010Builder](#requiredwithescapedcharactersmap100010builder) | fooReverseSolidusReverseSolidusBar(value: Int) | +| [RequiredWithEscapedCharactersMap100010Builder](#requiredwithescapedcharactersmap100010builder) | fooReverseSolidusReverseSolidusBar(value: Float) | +| [RequiredWithEscapedCharactersMap100010Builder](#requiredwithescapedcharactersmap100010builder) | fooReverseSolidusReverseSolidusBar(value: Long) | +| [RequiredWithEscapedCharactersMap100010Builder](#requiredwithescapedcharactersmap100010builder) | fooReverseSolidusReverseSolidusBar(value: Double) | +| [RequiredWithEscapedCharactersMap100010Builder](#requiredwithescapedcharactersmap100010builder) | fooReverseSolidusReverseSolidusBar(value: List) | +| [RequiredWithEscapedCharactersMap100010Builder](#requiredwithescapedcharactersmap100010builder) | fooReverseSolidusReverseSolidusBar(value: Map) | + +## RequiredWithEscapedCharactersMap100100Builder +class RequiredWithEscapedCharactersMap100100Builder
    +builder for `Map` + +A class that builds the Map input type + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| RequiredWithEscapedCharactersMap100100Builder(Map instance)
    Creates a builder that contains the passed instance | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| [RequiredWithEscapedCharactersMap000100Builder](#requiredwithescapedcharactersmap000100builder) | fooReverseSolidusTbar(value: Nothing?) | +| [RequiredWithEscapedCharactersMap000100Builder](#requiredwithescapedcharactersmap000100builder) | fooReverseSolidusTbar(value: Boolean) | +| [RequiredWithEscapedCharactersMap000100Builder](#requiredwithescapedcharactersmap000100builder) | fooReverseSolidusTbar(value: String) | +| [RequiredWithEscapedCharactersMap000100Builder](#requiredwithescapedcharactersmap000100builder) | fooReverseSolidusTbar(value: Int) | +| [RequiredWithEscapedCharactersMap000100Builder](#requiredwithescapedcharactersmap000100builder) | fooReverseSolidusTbar(value: Float) | +| [RequiredWithEscapedCharactersMap000100Builder](#requiredwithescapedcharactersmap000100builder) | fooReverseSolidusTbar(value: Long) | +| [RequiredWithEscapedCharactersMap000100Builder](#requiredwithescapedcharactersmap000100builder) | fooReverseSolidusTbar(value: Double) | +| [RequiredWithEscapedCharactersMap000100Builder](#requiredwithescapedcharactersmap000100builder) | fooReverseSolidusTbar(value: List) | +| [RequiredWithEscapedCharactersMap000100Builder](#requiredwithescapedcharactersmap000100builder) | fooReverseSolidusTbar(value: Map) | +| [RequiredWithEscapedCharactersMap100000Builder](#requiredwithescapedcharactersmap100000builder) | fooReverseSolidusRbar(value: Nothing?) | +| [RequiredWithEscapedCharactersMap100000Builder](#requiredwithescapedcharactersmap100000builder) | fooReverseSolidusRbar(value: Boolean) | +| [RequiredWithEscapedCharactersMap100000Builder](#requiredwithescapedcharactersmap100000builder) | fooReverseSolidusRbar(value: String) | +| [RequiredWithEscapedCharactersMap100000Builder](#requiredwithescapedcharactersmap100000builder) | fooReverseSolidusRbar(value: Int) | +| [RequiredWithEscapedCharactersMap100000Builder](#requiredwithescapedcharactersmap100000builder) | fooReverseSolidusRbar(value: Float) | +| [RequiredWithEscapedCharactersMap100000Builder](#requiredwithescapedcharactersmap100000builder) | fooReverseSolidusRbar(value: Long) | +| [RequiredWithEscapedCharactersMap100000Builder](#requiredwithescapedcharactersmap100000builder) | fooReverseSolidusRbar(value: Double) | +| [RequiredWithEscapedCharactersMap100000Builder](#requiredwithescapedcharactersmap100000builder) | fooReverseSolidusRbar(value: List) | +| [RequiredWithEscapedCharactersMap100000Builder](#requiredwithescapedcharactersmap100000builder) | fooReverseSolidusRbar(value: Map) | + +## RequiredWithEscapedCharactersMap100101Builder +class RequiredWithEscapedCharactersMap100101Builder
    +builder for `Map` + +A class that builds the Map input type + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| RequiredWithEscapedCharactersMap100101Builder(Map instance)
    Creates a builder that contains the passed instance | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| [RequiredWithEscapedCharactersMap000101Builder](#requiredwithescapedcharactersmap000101builder) | fooReverseSolidusTbar(value: Nothing?) | +| [RequiredWithEscapedCharactersMap000101Builder](#requiredwithescapedcharactersmap000101builder) | fooReverseSolidusTbar(value: Boolean) | +| [RequiredWithEscapedCharactersMap000101Builder](#requiredwithescapedcharactersmap000101builder) | fooReverseSolidusTbar(value: String) | +| [RequiredWithEscapedCharactersMap000101Builder](#requiredwithescapedcharactersmap000101builder) | fooReverseSolidusTbar(value: Int) | +| [RequiredWithEscapedCharactersMap000101Builder](#requiredwithescapedcharactersmap000101builder) | fooReverseSolidusTbar(value: Float) | +| [RequiredWithEscapedCharactersMap000101Builder](#requiredwithescapedcharactersmap000101builder) | fooReverseSolidusTbar(value: Long) | +| [RequiredWithEscapedCharactersMap000101Builder](#requiredwithescapedcharactersmap000101builder) | fooReverseSolidusTbar(value: Double) | +| [RequiredWithEscapedCharactersMap000101Builder](#requiredwithescapedcharactersmap000101builder) | fooReverseSolidusTbar(value: List) | +| [RequiredWithEscapedCharactersMap000101Builder](#requiredwithescapedcharactersmap000101builder) | fooReverseSolidusTbar(value: Map) | +| [RequiredWithEscapedCharactersMap100001Builder](#requiredwithescapedcharactersmap100001builder) | fooReverseSolidusRbar(value: Nothing?) | +| [RequiredWithEscapedCharactersMap100001Builder](#requiredwithescapedcharactersmap100001builder) | fooReverseSolidusRbar(value: Boolean) | +| [RequiredWithEscapedCharactersMap100001Builder](#requiredwithescapedcharactersmap100001builder) | fooReverseSolidusRbar(value: String) | +| [RequiredWithEscapedCharactersMap100001Builder](#requiredwithescapedcharactersmap100001builder) | fooReverseSolidusRbar(value: Int) | +| [RequiredWithEscapedCharactersMap100001Builder](#requiredwithescapedcharactersmap100001builder) | fooReverseSolidusRbar(value: Float) | +| [RequiredWithEscapedCharactersMap100001Builder](#requiredwithescapedcharactersmap100001builder) | fooReverseSolidusRbar(value: Long) | +| [RequiredWithEscapedCharactersMap100001Builder](#requiredwithescapedcharactersmap100001builder) | fooReverseSolidusRbar(value: Double) | +| [RequiredWithEscapedCharactersMap100001Builder](#requiredwithescapedcharactersmap100001builder) | fooReverseSolidusRbar(value: List) | +| [RequiredWithEscapedCharactersMap100001Builder](#requiredwithescapedcharactersmap100001builder) | fooReverseSolidusRbar(value: Map) | +| [RequiredWithEscapedCharactersMap100100Builder](#requiredwithescapedcharactersmap100100builder) | fooReverseSolidusReverseSolidusBar(value: Nothing?) | +| [RequiredWithEscapedCharactersMap100100Builder](#requiredwithescapedcharactersmap100100builder) | fooReverseSolidusReverseSolidusBar(value: Boolean) | +| [RequiredWithEscapedCharactersMap100100Builder](#requiredwithescapedcharactersmap100100builder) | fooReverseSolidusReverseSolidusBar(value: String) | +| [RequiredWithEscapedCharactersMap100100Builder](#requiredwithescapedcharactersmap100100builder) | fooReverseSolidusReverseSolidusBar(value: Int) | +| [RequiredWithEscapedCharactersMap100100Builder](#requiredwithescapedcharactersmap100100builder) | fooReverseSolidusReverseSolidusBar(value: Float) | +| [RequiredWithEscapedCharactersMap100100Builder](#requiredwithescapedcharactersmap100100builder) | fooReverseSolidusReverseSolidusBar(value: Long) | +| [RequiredWithEscapedCharactersMap100100Builder](#requiredwithescapedcharactersmap100100builder) | fooReverseSolidusReverseSolidusBar(value: Double) | +| [RequiredWithEscapedCharactersMap100100Builder](#requiredwithescapedcharactersmap100100builder) | fooReverseSolidusReverseSolidusBar(value: List) | +| [RequiredWithEscapedCharactersMap100100Builder](#requiredwithescapedcharactersmap100100builder) | fooReverseSolidusReverseSolidusBar(value: Map) | + +## RequiredWithEscapedCharactersMap100110Builder +class RequiredWithEscapedCharactersMap100110Builder
    +builder for `Map` + +A class that builds the Map input type + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| RequiredWithEscapedCharactersMap100110Builder(Map instance)
    Creates a builder that contains the passed instance | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| [RequiredWithEscapedCharactersMap000110Builder](#requiredwithescapedcharactersmap000110builder) | fooReverseSolidusTbar(value: Nothing?) | +| [RequiredWithEscapedCharactersMap000110Builder](#requiredwithescapedcharactersmap000110builder) | fooReverseSolidusTbar(value: Boolean) | +| [RequiredWithEscapedCharactersMap000110Builder](#requiredwithescapedcharactersmap000110builder) | fooReverseSolidusTbar(value: String) | +| [RequiredWithEscapedCharactersMap000110Builder](#requiredwithescapedcharactersmap000110builder) | fooReverseSolidusTbar(value: Int) | +| [RequiredWithEscapedCharactersMap000110Builder](#requiredwithescapedcharactersmap000110builder) | fooReverseSolidusTbar(value: Float) | +| [RequiredWithEscapedCharactersMap000110Builder](#requiredwithescapedcharactersmap000110builder) | fooReverseSolidusTbar(value: Long) | +| [RequiredWithEscapedCharactersMap000110Builder](#requiredwithescapedcharactersmap000110builder) | fooReverseSolidusTbar(value: Double) | +| [RequiredWithEscapedCharactersMap000110Builder](#requiredwithescapedcharactersmap000110builder) | fooReverseSolidusTbar(value: List) | +| [RequiredWithEscapedCharactersMap000110Builder](#requiredwithescapedcharactersmap000110builder) | fooReverseSolidusTbar(value: Map) | +| [RequiredWithEscapedCharactersMap100010Builder](#requiredwithescapedcharactersmap100010builder) | fooReverseSolidusRbar(value: Nothing?) | +| [RequiredWithEscapedCharactersMap100010Builder](#requiredwithescapedcharactersmap100010builder) | fooReverseSolidusRbar(value: Boolean) | +| [RequiredWithEscapedCharactersMap100010Builder](#requiredwithescapedcharactersmap100010builder) | fooReverseSolidusRbar(value: String) | +| [RequiredWithEscapedCharactersMap100010Builder](#requiredwithescapedcharactersmap100010builder) | fooReverseSolidusRbar(value: Int) | +| [RequiredWithEscapedCharactersMap100010Builder](#requiredwithescapedcharactersmap100010builder) | fooReverseSolidusRbar(value: Float) | +| [RequiredWithEscapedCharactersMap100010Builder](#requiredwithescapedcharactersmap100010builder) | fooReverseSolidusRbar(value: Long) | +| [RequiredWithEscapedCharactersMap100010Builder](#requiredwithescapedcharactersmap100010builder) | fooReverseSolidusRbar(value: Double) | +| [RequiredWithEscapedCharactersMap100010Builder](#requiredwithescapedcharactersmap100010builder) | fooReverseSolidusRbar(value: List) | +| [RequiredWithEscapedCharactersMap100010Builder](#requiredwithescapedcharactersmap100010builder) | fooReverseSolidusRbar(value: Map) | +| [RequiredWithEscapedCharactersMap100100Builder](#requiredwithescapedcharactersmap100100builder) | fooReverseSolidusQuotationMarkBar(value: Nothing?) | +| [RequiredWithEscapedCharactersMap100100Builder](#requiredwithescapedcharactersmap100100builder) | fooReverseSolidusQuotationMarkBar(value: Boolean) | +| [RequiredWithEscapedCharactersMap100100Builder](#requiredwithescapedcharactersmap100100builder) | fooReverseSolidusQuotationMarkBar(value: String) | +| [RequiredWithEscapedCharactersMap100100Builder](#requiredwithescapedcharactersmap100100builder) | fooReverseSolidusQuotationMarkBar(value: Int) | +| [RequiredWithEscapedCharactersMap100100Builder](#requiredwithescapedcharactersmap100100builder) | fooReverseSolidusQuotationMarkBar(value: Float) | +| [RequiredWithEscapedCharactersMap100100Builder](#requiredwithescapedcharactersmap100100builder) | fooReverseSolidusQuotationMarkBar(value: Long) | +| [RequiredWithEscapedCharactersMap100100Builder](#requiredwithescapedcharactersmap100100builder) | fooReverseSolidusQuotationMarkBar(value: Double) | +| [RequiredWithEscapedCharactersMap100100Builder](#requiredwithescapedcharactersmap100100builder) | fooReverseSolidusQuotationMarkBar(value: List) | +| [RequiredWithEscapedCharactersMap100100Builder](#requiredwithescapedcharactersmap100100builder) | fooReverseSolidusQuotationMarkBar(value: Map) | + +## RequiredWithEscapedCharactersMap100111Builder +class RequiredWithEscapedCharactersMap100111Builder
    +builder for `Map` + +A class that builds the Map input type + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| RequiredWithEscapedCharactersMap100111Builder(Map instance)
    Creates a builder that contains the passed instance | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| [RequiredWithEscapedCharactersMap000111Builder](#requiredwithescapedcharactersmap000111builder) | fooReverseSolidusTbar(value: Nothing?) | +| [RequiredWithEscapedCharactersMap000111Builder](#requiredwithescapedcharactersmap000111builder) | fooReverseSolidusTbar(value: Boolean) | +| [RequiredWithEscapedCharactersMap000111Builder](#requiredwithescapedcharactersmap000111builder) | fooReverseSolidusTbar(value: String) | +| [RequiredWithEscapedCharactersMap000111Builder](#requiredwithescapedcharactersmap000111builder) | fooReverseSolidusTbar(value: Int) | +| [RequiredWithEscapedCharactersMap000111Builder](#requiredwithescapedcharactersmap000111builder) | fooReverseSolidusTbar(value: Float) | +| [RequiredWithEscapedCharactersMap000111Builder](#requiredwithescapedcharactersmap000111builder) | fooReverseSolidusTbar(value: Long) | +| [RequiredWithEscapedCharactersMap000111Builder](#requiredwithescapedcharactersmap000111builder) | fooReverseSolidusTbar(value: Double) | +| [RequiredWithEscapedCharactersMap000111Builder](#requiredwithescapedcharactersmap000111builder) | fooReverseSolidusTbar(value: List) | +| [RequiredWithEscapedCharactersMap000111Builder](#requiredwithescapedcharactersmap000111builder) | fooReverseSolidusTbar(value: Map) | +| [RequiredWithEscapedCharactersMap100011Builder](#requiredwithescapedcharactersmap100011builder) | fooReverseSolidusRbar(value: Nothing?) | +| [RequiredWithEscapedCharactersMap100011Builder](#requiredwithescapedcharactersmap100011builder) | fooReverseSolidusRbar(value: Boolean) | +| [RequiredWithEscapedCharactersMap100011Builder](#requiredwithescapedcharactersmap100011builder) | fooReverseSolidusRbar(value: String) | +| [RequiredWithEscapedCharactersMap100011Builder](#requiredwithescapedcharactersmap100011builder) | fooReverseSolidusRbar(value: Int) | +| [RequiredWithEscapedCharactersMap100011Builder](#requiredwithescapedcharactersmap100011builder) | fooReverseSolidusRbar(value: Float) | +| [RequiredWithEscapedCharactersMap100011Builder](#requiredwithescapedcharactersmap100011builder) | fooReverseSolidusRbar(value: Long) | +| [RequiredWithEscapedCharactersMap100011Builder](#requiredwithescapedcharactersmap100011builder) | fooReverseSolidusRbar(value: Double) | +| [RequiredWithEscapedCharactersMap100011Builder](#requiredwithescapedcharactersmap100011builder) | fooReverseSolidusRbar(value: List) | +| [RequiredWithEscapedCharactersMap100011Builder](#requiredwithescapedcharactersmap100011builder) | fooReverseSolidusRbar(value: Map) | +| [RequiredWithEscapedCharactersMap100101Builder](#requiredwithescapedcharactersmap100101builder) | fooReverseSolidusQuotationMarkBar(value: Nothing?) | +| [RequiredWithEscapedCharactersMap100101Builder](#requiredwithescapedcharactersmap100101builder) | fooReverseSolidusQuotationMarkBar(value: Boolean) | +| [RequiredWithEscapedCharactersMap100101Builder](#requiredwithescapedcharactersmap100101builder) | fooReverseSolidusQuotationMarkBar(value: String) | +| [RequiredWithEscapedCharactersMap100101Builder](#requiredwithescapedcharactersmap100101builder) | fooReverseSolidusQuotationMarkBar(value: Int) | +| [RequiredWithEscapedCharactersMap100101Builder](#requiredwithescapedcharactersmap100101builder) | fooReverseSolidusQuotationMarkBar(value: Float) | +| [RequiredWithEscapedCharactersMap100101Builder](#requiredwithescapedcharactersmap100101builder) | fooReverseSolidusQuotationMarkBar(value: Long) | +| [RequiredWithEscapedCharactersMap100101Builder](#requiredwithescapedcharactersmap100101builder) | fooReverseSolidusQuotationMarkBar(value: Double) | +| [RequiredWithEscapedCharactersMap100101Builder](#requiredwithescapedcharactersmap100101builder) | fooReverseSolidusQuotationMarkBar(value: List) | +| [RequiredWithEscapedCharactersMap100101Builder](#requiredwithescapedcharactersmap100101builder) | fooReverseSolidusQuotationMarkBar(value: Map) | +| [RequiredWithEscapedCharactersMap100110Builder](#requiredwithescapedcharactersmap100110builder) | fooReverseSolidusReverseSolidusBar(value: Nothing?) | +| [RequiredWithEscapedCharactersMap100110Builder](#requiredwithescapedcharactersmap100110builder) | fooReverseSolidusReverseSolidusBar(value: Boolean) | +| [RequiredWithEscapedCharactersMap100110Builder](#requiredwithescapedcharactersmap100110builder) | fooReverseSolidusReverseSolidusBar(value: String) | +| [RequiredWithEscapedCharactersMap100110Builder](#requiredwithescapedcharactersmap100110builder) | fooReverseSolidusReverseSolidusBar(value: Int) | +| [RequiredWithEscapedCharactersMap100110Builder](#requiredwithescapedcharactersmap100110builder) | fooReverseSolidusReverseSolidusBar(value: Float) | +| [RequiredWithEscapedCharactersMap100110Builder](#requiredwithescapedcharactersmap100110builder) | fooReverseSolidusReverseSolidusBar(value: Long) | +| [RequiredWithEscapedCharactersMap100110Builder](#requiredwithescapedcharactersmap100110builder) | fooReverseSolidusReverseSolidusBar(value: Double) | +| [RequiredWithEscapedCharactersMap100110Builder](#requiredwithescapedcharactersmap100110builder) | fooReverseSolidusReverseSolidusBar(value: List) | +| [RequiredWithEscapedCharactersMap100110Builder](#requiredwithescapedcharactersmap100110builder) | fooReverseSolidusReverseSolidusBar(value: Map) | + +## RequiredWithEscapedCharactersMap101000Builder +class RequiredWithEscapedCharactersMap101000Builder
    +builder for `Map` + +A class that builds the Map input type + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| RequiredWithEscapedCharactersMap101000Builder(Map instance)
    Creates a builder that contains the passed instance | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| [RequiredWithEscapedCharactersMap001000Builder](#requiredwithescapedcharactersmap001000builder) | fooReverseSolidusTbar(value: Nothing?) | +| [RequiredWithEscapedCharactersMap001000Builder](#requiredwithescapedcharactersmap001000builder) | fooReverseSolidusTbar(value: Boolean) | +| [RequiredWithEscapedCharactersMap001000Builder](#requiredwithescapedcharactersmap001000builder) | fooReverseSolidusTbar(value: String) | +| [RequiredWithEscapedCharactersMap001000Builder](#requiredwithescapedcharactersmap001000builder) | fooReverseSolidusTbar(value: Int) | +| [RequiredWithEscapedCharactersMap001000Builder](#requiredwithescapedcharactersmap001000builder) | fooReverseSolidusTbar(value: Float) | +| [RequiredWithEscapedCharactersMap001000Builder](#requiredwithescapedcharactersmap001000builder) | fooReverseSolidusTbar(value: Long) | +| [RequiredWithEscapedCharactersMap001000Builder](#requiredwithescapedcharactersmap001000builder) | fooReverseSolidusTbar(value: Double) | +| [RequiredWithEscapedCharactersMap001000Builder](#requiredwithescapedcharactersmap001000builder) | fooReverseSolidusTbar(value: List) | +| [RequiredWithEscapedCharactersMap001000Builder](#requiredwithescapedcharactersmap001000builder) | fooReverseSolidusTbar(value: Map) | +| [RequiredWithEscapedCharactersMap100000Builder](#requiredwithescapedcharactersmap100000builder) | fooReverseSolidusU000cbar(value: Nothing?) | +| [RequiredWithEscapedCharactersMap100000Builder](#requiredwithescapedcharactersmap100000builder) | fooReverseSolidusU000cbar(value: Boolean) | +| [RequiredWithEscapedCharactersMap100000Builder](#requiredwithescapedcharactersmap100000builder) | fooReverseSolidusU000cbar(value: String) | +| [RequiredWithEscapedCharactersMap100000Builder](#requiredwithescapedcharactersmap100000builder) | fooReverseSolidusU000cbar(value: Int) | +| [RequiredWithEscapedCharactersMap100000Builder](#requiredwithescapedcharactersmap100000builder) | fooReverseSolidusU000cbar(value: Float) | +| [RequiredWithEscapedCharactersMap100000Builder](#requiredwithescapedcharactersmap100000builder) | fooReverseSolidusU000cbar(value: Long) | +| [RequiredWithEscapedCharactersMap100000Builder](#requiredwithescapedcharactersmap100000builder) | fooReverseSolidusU000cbar(value: Double) | +| [RequiredWithEscapedCharactersMap100000Builder](#requiredwithescapedcharactersmap100000builder) | fooReverseSolidusU000cbar(value: List) | +| [RequiredWithEscapedCharactersMap100000Builder](#requiredwithescapedcharactersmap100000builder) | fooReverseSolidusU000cbar(value: Map) | + +## RequiredWithEscapedCharactersMap101001Builder +class RequiredWithEscapedCharactersMap101001Builder
    +builder for `Map` + +A class that builds the Map input type + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| RequiredWithEscapedCharactersMap101001Builder(Map instance)
    Creates a builder that contains the passed instance | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| [RequiredWithEscapedCharactersMap001001Builder](#requiredwithescapedcharactersmap001001builder) | fooReverseSolidusTbar(value: Nothing?) | +| [RequiredWithEscapedCharactersMap001001Builder](#requiredwithescapedcharactersmap001001builder) | fooReverseSolidusTbar(value: Boolean) | +| [RequiredWithEscapedCharactersMap001001Builder](#requiredwithescapedcharactersmap001001builder) | fooReverseSolidusTbar(value: String) | +| [RequiredWithEscapedCharactersMap001001Builder](#requiredwithescapedcharactersmap001001builder) | fooReverseSolidusTbar(value: Int) | +| [RequiredWithEscapedCharactersMap001001Builder](#requiredwithescapedcharactersmap001001builder) | fooReverseSolidusTbar(value: Float) | +| [RequiredWithEscapedCharactersMap001001Builder](#requiredwithescapedcharactersmap001001builder) | fooReverseSolidusTbar(value: Long) | +| [RequiredWithEscapedCharactersMap001001Builder](#requiredwithescapedcharactersmap001001builder) | fooReverseSolidusTbar(value: Double) | +| [RequiredWithEscapedCharactersMap001001Builder](#requiredwithescapedcharactersmap001001builder) | fooReverseSolidusTbar(value: List) | +| [RequiredWithEscapedCharactersMap001001Builder](#requiredwithescapedcharactersmap001001builder) | fooReverseSolidusTbar(value: Map) | +| [RequiredWithEscapedCharactersMap100001Builder](#requiredwithescapedcharactersmap100001builder) | fooReverseSolidusU000cbar(value: Nothing?) | +| [RequiredWithEscapedCharactersMap100001Builder](#requiredwithescapedcharactersmap100001builder) | fooReverseSolidusU000cbar(value: Boolean) | +| [RequiredWithEscapedCharactersMap100001Builder](#requiredwithescapedcharactersmap100001builder) | fooReverseSolidusU000cbar(value: String) | +| [RequiredWithEscapedCharactersMap100001Builder](#requiredwithescapedcharactersmap100001builder) | fooReverseSolidusU000cbar(value: Int) | +| [RequiredWithEscapedCharactersMap100001Builder](#requiredwithescapedcharactersmap100001builder) | fooReverseSolidusU000cbar(value: Float) | +| [RequiredWithEscapedCharactersMap100001Builder](#requiredwithescapedcharactersmap100001builder) | fooReverseSolidusU000cbar(value: Long) | +| [RequiredWithEscapedCharactersMap100001Builder](#requiredwithescapedcharactersmap100001builder) | fooReverseSolidusU000cbar(value: Double) | +| [RequiredWithEscapedCharactersMap100001Builder](#requiredwithescapedcharactersmap100001builder) | fooReverseSolidusU000cbar(value: List) | +| [RequiredWithEscapedCharactersMap100001Builder](#requiredwithescapedcharactersmap100001builder) | fooReverseSolidusU000cbar(value: Map) | +| [RequiredWithEscapedCharactersMap101000Builder](#requiredwithescapedcharactersmap101000builder) | fooReverseSolidusReverseSolidusBar(value: Nothing?) | +| [RequiredWithEscapedCharactersMap101000Builder](#requiredwithescapedcharactersmap101000builder) | fooReverseSolidusReverseSolidusBar(value: Boolean) | +| [RequiredWithEscapedCharactersMap101000Builder](#requiredwithescapedcharactersmap101000builder) | fooReverseSolidusReverseSolidusBar(value: String) | +| [RequiredWithEscapedCharactersMap101000Builder](#requiredwithescapedcharactersmap101000builder) | fooReverseSolidusReverseSolidusBar(value: Int) | +| [RequiredWithEscapedCharactersMap101000Builder](#requiredwithescapedcharactersmap101000builder) | fooReverseSolidusReverseSolidusBar(value: Float) | +| [RequiredWithEscapedCharactersMap101000Builder](#requiredwithescapedcharactersmap101000builder) | fooReverseSolidusReverseSolidusBar(value: Long) | +| [RequiredWithEscapedCharactersMap101000Builder](#requiredwithescapedcharactersmap101000builder) | fooReverseSolidusReverseSolidusBar(value: Double) | +| [RequiredWithEscapedCharactersMap101000Builder](#requiredwithescapedcharactersmap101000builder) | fooReverseSolidusReverseSolidusBar(value: List) | +| [RequiredWithEscapedCharactersMap101000Builder](#requiredwithescapedcharactersmap101000builder) | fooReverseSolidusReverseSolidusBar(value: Map) | + +## RequiredWithEscapedCharactersMap101010Builder +class RequiredWithEscapedCharactersMap101010Builder
    +builder for `Map` + +A class that builds the Map input type + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| RequiredWithEscapedCharactersMap101010Builder(Map instance)
    Creates a builder that contains the passed instance | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| [RequiredWithEscapedCharactersMap001010Builder](#requiredwithescapedcharactersmap001010builder) | fooReverseSolidusTbar(value: Nothing?) | +| [RequiredWithEscapedCharactersMap001010Builder](#requiredwithescapedcharactersmap001010builder) | fooReverseSolidusTbar(value: Boolean) | +| [RequiredWithEscapedCharactersMap001010Builder](#requiredwithescapedcharactersmap001010builder) | fooReverseSolidusTbar(value: String) | +| [RequiredWithEscapedCharactersMap001010Builder](#requiredwithescapedcharactersmap001010builder) | fooReverseSolidusTbar(value: Int) | +| [RequiredWithEscapedCharactersMap001010Builder](#requiredwithescapedcharactersmap001010builder) | fooReverseSolidusTbar(value: Float) | +| [RequiredWithEscapedCharactersMap001010Builder](#requiredwithescapedcharactersmap001010builder) | fooReverseSolidusTbar(value: Long) | +| [RequiredWithEscapedCharactersMap001010Builder](#requiredwithescapedcharactersmap001010builder) | fooReverseSolidusTbar(value: Double) | +| [RequiredWithEscapedCharactersMap001010Builder](#requiredwithescapedcharactersmap001010builder) | fooReverseSolidusTbar(value: List) | +| [RequiredWithEscapedCharactersMap001010Builder](#requiredwithescapedcharactersmap001010builder) | fooReverseSolidusTbar(value: Map) | +| [RequiredWithEscapedCharactersMap100010Builder](#requiredwithescapedcharactersmap100010builder) | fooReverseSolidusU000cbar(value: Nothing?) | +| [RequiredWithEscapedCharactersMap100010Builder](#requiredwithescapedcharactersmap100010builder) | fooReverseSolidusU000cbar(value: Boolean) | +| [RequiredWithEscapedCharactersMap100010Builder](#requiredwithescapedcharactersmap100010builder) | fooReverseSolidusU000cbar(value: String) | +| [RequiredWithEscapedCharactersMap100010Builder](#requiredwithescapedcharactersmap100010builder) | fooReverseSolidusU000cbar(value: Int) | +| [RequiredWithEscapedCharactersMap100010Builder](#requiredwithescapedcharactersmap100010builder) | fooReverseSolidusU000cbar(value: Float) | +| [RequiredWithEscapedCharactersMap100010Builder](#requiredwithescapedcharactersmap100010builder) | fooReverseSolidusU000cbar(value: Long) | +| [RequiredWithEscapedCharactersMap100010Builder](#requiredwithescapedcharactersmap100010builder) | fooReverseSolidusU000cbar(value: Double) | +| [RequiredWithEscapedCharactersMap100010Builder](#requiredwithescapedcharactersmap100010builder) | fooReverseSolidusU000cbar(value: List) | +| [RequiredWithEscapedCharactersMap100010Builder](#requiredwithescapedcharactersmap100010builder) | fooReverseSolidusU000cbar(value: Map) | +| [RequiredWithEscapedCharactersMap101000Builder](#requiredwithescapedcharactersmap101000builder) | fooReverseSolidusQuotationMarkBar(value: Nothing?) | +| [RequiredWithEscapedCharactersMap101000Builder](#requiredwithescapedcharactersmap101000builder) | fooReverseSolidusQuotationMarkBar(value: Boolean) | +| [RequiredWithEscapedCharactersMap101000Builder](#requiredwithescapedcharactersmap101000builder) | fooReverseSolidusQuotationMarkBar(value: String) | +| [RequiredWithEscapedCharactersMap101000Builder](#requiredwithescapedcharactersmap101000builder) | fooReverseSolidusQuotationMarkBar(value: Int) | +| [RequiredWithEscapedCharactersMap101000Builder](#requiredwithescapedcharactersmap101000builder) | fooReverseSolidusQuotationMarkBar(value: Float) | +| [RequiredWithEscapedCharactersMap101000Builder](#requiredwithescapedcharactersmap101000builder) | fooReverseSolidusQuotationMarkBar(value: Long) | +| [RequiredWithEscapedCharactersMap101000Builder](#requiredwithescapedcharactersmap101000builder) | fooReverseSolidusQuotationMarkBar(value: Double) | +| [RequiredWithEscapedCharactersMap101000Builder](#requiredwithescapedcharactersmap101000builder) | fooReverseSolidusQuotationMarkBar(value: List) | +| [RequiredWithEscapedCharactersMap101000Builder](#requiredwithescapedcharactersmap101000builder) | fooReverseSolidusQuotationMarkBar(value: Map) | + +## RequiredWithEscapedCharactersMap101011Builder +class RequiredWithEscapedCharactersMap101011Builder
    +builder for `Map` + +A class that builds the Map input type + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| RequiredWithEscapedCharactersMap101011Builder(Map instance)
    Creates a builder that contains the passed instance | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| [RequiredWithEscapedCharactersMap001011Builder](#requiredwithescapedcharactersmap001011builder) | fooReverseSolidusTbar(value: Nothing?) | +| [RequiredWithEscapedCharactersMap001011Builder](#requiredwithescapedcharactersmap001011builder) | fooReverseSolidusTbar(value: Boolean) | +| [RequiredWithEscapedCharactersMap001011Builder](#requiredwithescapedcharactersmap001011builder) | fooReverseSolidusTbar(value: String) | +| [RequiredWithEscapedCharactersMap001011Builder](#requiredwithescapedcharactersmap001011builder) | fooReverseSolidusTbar(value: Int) | +| [RequiredWithEscapedCharactersMap001011Builder](#requiredwithescapedcharactersmap001011builder) | fooReverseSolidusTbar(value: Float) | +| [RequiredWithEscapedCharactersMap001011Builder](#requiredwithescapedcharactersmap001011builder) | fooReverseSolidusTbar(value: Long) | +| [RequiredWithEscapedCharactersMap001011Builder](#requiredwithescapedcharactersmap001011builder) | fooReverseSolidusTbar(value: Double) | +| [RequiredWithEscapedCharactersMap001011Builder](#requiredwithescapedcharactersmap001011builder) | fooReverseSolidusTbar(value: List) | +| [RequiredWithEscapedCharactersMap001011Builder](#requiredwithescapedcharactersmap001011builder) | fooReverseSolidusTbar(value: Map) | +| [RequiredWithEscapedCharactersMap100011Builder](#requiredwithescapedcharactersmap100011builder) | fooReverseSolidusU000cbar(value: Nothing?) | +| [RequiredWithEscapedCharactersMap100011Builder](#requiredwithescapedcharactersmap100011builder) | fooReverseSolidusU000cbar(value: Boolean) | +| [RequiredWithEscapedCharactersMap100011Builder](#requiredwithescapedcharactersmap100011builder) | fooReverseSolidusU000cbar(value: String) | +| [RequiredWithEscapedCharactersMap100011Builder](#requiredwithescapedcharactersmap100011builder) | fooReverseSolidusU000cbar(value: Int) | +| [RequiredWithEscapedCharactersMap100011Builder](#requiredwithescapedcharactersmap100011builder) | fooReverseSolidusU000cbar(value: Float) | +| [RequiredWithEscapedCharactersMap100011Builder](#requiredwithescapedcharactersmap100011builder) | fooReverseSolidusU000cbar(value: Long) | +| [RequiredWithEscapedCharactersMap100011Builder](#requiredwithescapedcharactersmap100011builder) | fooReverseSolidusU000cbar(value: Double) | +| [RequiredWithEscapedCharactersMap100011Builder](#requiredwithescapedcharactersmap100011builder) | fooReverseSolidusU000cbar(value: List) | +| [RequiredWithEscapedCharactersMap100011Builder](#requiredwithescapedcharactersmap100011builder) | fooReverseSolidusU000cbar(value: Map) | +| [RequiredWithEscapedCharactersMap101001Builder](#requiredwithescapedcharactersmap101001builder) | fooReverseSolidusQuotationMarkBar(value: Nothing?) | +| [RequiredWithEscapedCharactersMap101001Builder](#requiredwithescapedcharactersmap101001builder) | fooReverseSolidusQuotationMarkBar(value: Boolean) | +| [RequiredWithEscapedCharactersMap101001Builder](#requiredwithescapedcharactersmap101001builder) | fooReverseSolidusQuotationMarkBar(value: String) | +| [RequiredWithEscapedCharactersMap101001Builder](#requiredwithescapedcharactersmap101001builder) | fooReverseSolidusQuotationMarkBar(value: Int) | +| [RequiredWithEscapedCharactersMap101001Builder](#requiredwithescapedcharactersmap101001builder) | fooReverseSolidusQuotationMarkBar(value: Float) | +| [RequiredWithEscapedCharactersMap101001Builder](#requiredwithescapedcharactersmap101001builder) | fooReverseSolidusQuotationMarkBar(value: Long) | +| [RequiredWithEscapedCharactersMap101001Builder](#requiredwithescapedcharactersmap101001builder) | fooReverseSolidusQuotationMarkBar(value: Double) | +| [RequiredWithEscapedCharactersMap101001Builder](#requiredwithescapedcharactersmap101001builder) | fooReverseSolidusQuotationMarkBar(value: List) | +| [RequiredWithEscapedCharactersMap101001Builder](#requiredwithescapedcharactersmap101001builder) | fooReverseSolidusQuotationMarkBar(value: Map) | +| [RequiredWithEscapedCharactersMap101010Builder](#requiredwithescapedcharactersmap101010builder) | fooReverseSolidusReverseSolidusBar(value: Nothing?) | +| [RequiredWithEscapedCharactersMap101010Builder](#requiredwithescapedcharactersmap101010builder) | fooReverseSolidusReverseSolidusBar(value: Boolean) | +| [RequiredWithEscapedCharactersMap101010Builder](#requiredwithescapedcharactersmap101010builder) | fooReverseSolidusReverseSolidusBar(value: String) | +| [RequiredWithEscapedCharactersMap101010Builder](#requiredwithescapedcharactersmap101010builder) | fooReverseSolidusReverseSolidusBar(value: Int) | +| [RequiredWithEscapedCharactersMap101010Builder](#requiredwithescapedcharactersmap101010builder) | fooReverseSolidusReverseSolidusBar(value: Float) | +| [RequiredWithEscapedCharactersMap101010Builder](#requiredwithescapedcharactersmap101010builder) | fooReverseSolidusReverseSolidusBar(value: Long) | +| [RequiredWithEscapedCharactersMap101010Builder](#requiredwithescapedcharactersmap101010builder) | fooReverseSolidusReverseSolidusBar(value: Double) | +| [RequiredWithEscapedCharactersMap101010Builder](#requiredwithescapedcharactersmap101010builder) | fooReverseSolidusReverseSolidusBar(value: List) | +| [RequiredWithEscapedCharactersMap101010Builder](#requiredwithescapedcharactersmap101010builder) | fooReverseSolidusReverseSolidusBar(value: Map) | + +## RequiredWithEscapedCharactersMap101100Builder +class RequiredWithEscapedCharactersMap101100Builder
    +builder for `Map` + +A class that builds the Map input type + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| RequiredWithEscapedCharactersMap101100Builder(Map instance)
    Creates a builder that contains the passed instance | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| [RequiredWithEscapedCharactersMap001100Builder](#requiredwithescapedcharactersmap001100builder) | fooReverseSolidusTbar(value: Nothing?) | +| [RequiredWithEscapedCharactersMap001100Builder](#requiredwithescapedcharactersmap001100builder) | fooReverseSolidusTbar(value: Boolean) | +| [RequiredWithEscapedCharactersMap001100Builder](#requiredwithescapedcharactersmap001100builder) | fooReverseSolidusTbar(value: String) | +| [RequiredWithEscapedCharactersMap001100Builder](#requiredwithescapedcharactersmap001100builder) | fooReverseSolidusTbar(value: Int) | +| [RequiredWithEscapedCharactersMap001100Builder](#requiredwithescapedcharactersmap001100builder) | fooReverseSolidusTbar(value: Float) | +| [RequiredWithEscapedCharactersMap001100Builder](#requiredwithescapedcharactersmap001100builder) | fooReverseSolidusTbar(value: Long) | +| [RequiredWithEscapedCharactersMap001100Builder](#requiredwithescapedcharactersmap001100builder) | fooReverseSolidusTbar(value: Double) | +| [RequiredWithEscapedCharactersMap001100Builder](#requiredwithescapedcharactersmap001100builder) | fooReverseSolidusTbar(value: List) | +| [RequiredWithEscapedCharactersMap001100Builder](#requiredwithescapedcharactersmap001100builder) | fooReverseSolidusTbar(value: Map) | +| [RequiredWithEscapedCharactersMap100100Builder](#requiredwithescapedcharactersmap100100builder) | fooReverseSolidusU000cbar(value: Nothing?) | +| [RequiredWithEscapedCharactersMap100100Builder](#requiredwithescapedcharactersmap100100builder) | fooReverseSolidusU000cbar(value: Boolean) | +| [RequiredWithEscapedCharactersMap100100Builder](#requiredwithescapedcharactersmap100100builder) | fooReverseSolidusU000cbar(value: String) | +| [RequiredWithEscapedCharactersMap100100Builder](#requiredwithescapedcharactersmap100100builder) | fooReverseSolidusU000cbar(value: Int) | +| [RequiredWithEscapedCharactersMap100100Builder](#requiredwithescapedcharactersmap100100builder) | fooReverseSolidusU000cbar(value: Float) | +| [RequiredWithEscapedCharactersMap100100Builder](#requiredwithescapedcharactersmap100100builder) | fooReverseSolidusU000cbar(value: Long) | +| [RequiredWithEscapedCharactersMap100100Builder](#requiredwithescapedcharactersmap100100builder) | fooReverseSolidusU000cbar(value: Double) | +| [RequiredWithEscapedCharactersMap100100Builder](#requiredwithescapedcharactersmap100100builder) | fooReverseSolidusU000cbar(value: List) | +| [RequiredWithEscapedCharactersMap100100Builder](#requiredwithescapedcharactersmap100100builder) | fooReverseSolidusU000cbar(value: Map) | +| [RequiredWithEscapedCharactersMap101000Builder](#requiredwithescapedcharactersmap101000builder) | fooReverseSolidusRbar(value: Nothing?) | +| [RequiredWithEscapedCharactersMap101000Builder](#requiredwithescapedcharactersmap101000builder) | fooReverseSolidusRbar(value: Boolean) | +| [RequiredWithEscapedCharactersMap101000Builder](#requiredwithescapedcharactersmap101000builder) | fooReverseSolidusRbar(value: String) | +| [RequiredWithEscapedCharactersMap101000Builder](#requiredwithescapedcharactersmap101000builder) | fooReverseSolidusRbar(value: Int) | +| [RequiredWithEscapedCharactersMap101000Builder](#requiredwithescapedcharactersmap101000builder) | fooReverseSolidusRbar(value: Float) | +| [RequiredWithEscapedCharactersMap101000Builder](#requiredwithescapedcharactersmap101000builder) | fooReverseSolidusRbar(value: Long) | +| [RequiredWithEscapedCharactersMap101000Builder](#requiredwithescapedcharactersmap101000builder) | fooReverseSolidusRbar(value: Double) | +| [RequiredWithEscapedCharactersMap101000Builder](#requiredwithescapedcharactersmap101000builder) | fooReverseSolidusRbar(value: List) | +| [RequiredWithEscapedCharactersMap101000Builder](#requiredwithescapedcharactersmap101000builder) | fooReverseSolidusRbar(value: Map) | + +## RequiredWithEscapedCharactersMap101101Builder +class RequiredWithEscapedCharactersMap101101Builder
    +builder for `Map` + +A class that builds the Map input type + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| RequiredWithEscapedCharactersMap101101Builder(Map instance)
    Creates a builder that contains the passed instance | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| [RequiredWithEscapedCharactersMap001101Builder](#requiredwithescapedcharactersmap001101builder) | fooReverseSolidusTbar(value: Nothing?) | +| [RequiredWithEscapedCharactersMap001101Builder](#requiredwithescapedcharactersmap001101builder) | fooReverseSolidusTbar(value: Boolean) | +| [RequiredWithEscapedCharactersMap001101Builder](#requiredwithescapedcharactersmap001101builder) | fooReverseSolidusTbar(value: String) | +| [RequiredWithEscapedCharactersMap001101Builder](#requiredwithescapedcharactersmap001101builder) | fooReverseSolidusTbar(value: Int) | +| [RequiredWithEscapedCharactersMap001101Builder](#requiredwithescapedcharactersmap001101builder) | fooReverseSolidusTbar(value: Float) | +| [RequiredWithEscapedCharactersMap001101Builder](#requiredwithescapedcharactersmap001101builder) | fooReverseSolidusTbar(value: Long) | +| [RequiredWithEscapedCharactersMap001101Builder](#requiredwithescapedcharactersmap001101builder) | fooReverseSolidusTbar(value: Double) | +| [RequiredWithEscapedCharactersMap001101Builder](#requiredwithescapedcharactersmap001101builder) | fooReverseSolidusTbar(value: List) | +| [RequiredWithEscapedCharactersMap001101Builder](#requiredwithescapedcharactersmap001101builder) | fooReverseSolidusTbar(value: Map) | +| [RequiredWithEscapedCharactersMap100101Builder](#requiredwithescapedcharactersmap100101builder) | fooReverseSolidusU000cbar(value: Nothing?) | +| [RequiredWithEscapedCharactersMap100101Builder](#requiredwithescapedcharactersmap100101builder) | fooReverseSolidusU000cbar(value: Boolean) | +| [RequiredWithEscapedCharactersMap100101Builder](#requiredwithescapedcharactersmap100101builder) | fooReverseSolidusU000cbar(value: String) | +| [RequiredWithEscapedCharactersMap100101Builder](#requiredwithescapedcharactersmap100101builder) | fooReverseSolidusU000cbar(value: Int) | +| [RequiredWithEscapedCharactersMap100101Builder](#requiredwithescapedcharactersmap100101builder) | fooReverseSolidusU000cbar(value: Float) | +| [RequiredWithEscapedCharactersMap100101Builder](#requiredwithescapedcharactersmap100101builder) | fooReverseSolidusU000cbar(value: Long) | +| [RequiredWithEscapedCharactersMap100101Builder](#requiredwithescapedcharactersmap100101builder) | fooReverseSolidusU000cbar(value: Double) | +| [RequiredWithEscapedCharactersMap100101Builder](#requiredwithescapedcharactersmap100101builder) | fooReverseSolidusU000cbar(value: List) | +| [RequiredWithEscapedCharactersMap100101Builder](#requiredwithescapedcharactersmap100101builder) | fooReverseSolidusU000cbar(value: Map) | +| [RequiredWithEscapedCharactersMap101001Builder](#requiredwithescapedcharactersmap101001builder) | fooReverseSolidusRbar(value: Nothing?) | +| [RequiredWithEscapedCharactersMap101001Builder](#requiredwithescapedcharactersmap101001builder) | fooReverseSolidusRbar(value: Boolean) | +| [RequiredWithEscapedCharactersMap101001Builder](#requiredwithescapedcharactersmap101001builder) | fooReverseSolidusRbar(value: String) | +| [RequiredWithEscapedCharactersMap101001Builder](#requiredwithescapedcharactersmap101001builder) | fooReverseSolidusRbar(value: Int) | +| [RequiredWithEscapedCharactersMap101001Builder](#requiredwithescapedcharactersmap101001builder) | fooReverseSolidusRbar(value: Float) | +| [RequiredWithEscapedCharactersMap101001Builder](#requiredwithescapedcharactersmap101001builder) | fooReverseSolidusRbar(value: Long) | +| [RequiredWithEscapedCharactersMap101001Builder](#requiredwithescapedcharactersmap101001builder) | fooReverseSolidusRbar(value: Double) | +| [RequiredWithEscapedCharactersMap101001Builder](#requiredwithescapedcharactersmap101001builder) | fooReverseSolidusRbar(value: List) | +| [RequiredWithEscapedCharactersMap101001Builder](#requiredwithescapedcharactersmap101001builder) | fooReverseSolidusRbar(value: Map) | +| [RequiredWithEscapedCharactersMap101100Builder](#requiredwithescapedcharactersmap101100builder) | fooReverseSolidusReverseSolidusBar(value: Nothing?) | +| [RequiredWithEscapedCharactersMap101100Builder](#requiredwithescapedcharactersmap101100builder) | fooReverseSolidusReverseSolidusBar(value: Boolean) | +| [RequiredWithEscapedCharactersMap101100Builder](#requiredwithescapedcharactersmap101100builder) | fooReverseSolidusReverseSolidusBar(value: String) | +| [RequiredWithEscapedCharactersMap101100Builder](#requiredwithescapedcharactersmap101100builder) | fooReverseSolidusReverseSolidusBar(value: Int) | +| [RequiredWithEscapedCharactersMap101100Builder](#requiredwithescapedcharactersmap101100builder) | fooReverseSolidusReverseSolidusBar(value: Float) | +| [RequiredWithEscapedCharactersMap101100Builder](#requiredwithescapedcharactersmap101100builder) | fooReverseSolidusReverseSolidusBar(value: Long) | +| [RequiredWithEscapedCharactersMap101100Builder](#requiredwithescapedcharactersmap101100builder) | fooReverseSolidusReverseSolidusBar(value: Double) | +| [RequiredWithEscapedCharactersMap101100Builder](#requiredwithescapedcharactersmap101100builder) | fooReverseSolidusReverseSolidusBar(value: List) | +| [RequiredWithEscapedCharactersMap101100Builder](#requiredwithescapedcharactersmap101100builder) | fooReverseSolidusReverseSolidusBar(value: Map) | + +## RequiredWithEscapedCharactersMap101110Builder +class RequiredWithEscapedCharactersMap101110Builder
    +builder for `Map` + +A class that builds the Map input type + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| RequiredWithEscapedCharactersMap101110Builder(Map instance)
    Creates a builder that contains the passed instance | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| [RequiredWithEscapedCharactersMap001110Builder](#requiredwithescapedcharactersmap001110builder) | fooReverseSolidusTbar(value: Nothing?) | +| [RequiredWithEscapedCharactersMap001110Builder](#requiredwithescapedcharactersmap001110builder) | fooReverseSolidusTbar(value: Boolean) | +| [RequiredWithEscapedCharactersMap001110Builder](#requiredwithescapedcharactersmap001110builder) | fooReverseSolidusTbar(value: String) | +| [RequiredWithEscapedCharactersMap001110Builder](#requiredwithescapedcharactersmap001110builder) | fooReverseSolidusTbar(value: Int) | +| [RequiredWithEscapedCharactersMap001110Builder](#requiredwithescapedcharactersmap001110builder) | fooReverseSolidusTbar(value: Float) | +| [RequiredWithEscapedCharactersMap001110Builder](#requiredwithescapedcharactersmap001110builder) | fooReverseSolidusTbar(value: Long) | +| [RequiredWithEscapedCharactersMap001110Builder](#requiredwithescapedcharactersmap001110builder) | fooReverseSolidusTbar(value: Double) | +| [RequiredWithEscapedCharactersMap001110Builder](#requiredwithescapedcharactersmap001110builder) | fooReverseSolidusTbar(value: List) | +| [RequiredWithEscapedCharactersMap001110Builder](#requiredwithescapedcharactersmap001110builder) | fooReverseSolidusTbar(value: Map) | +| [RequiredWithEscapedCharactersMap100110Builder](#requiredwithescapedcharactersmap100110builder) | fooReverseSolidusU000cbar(value: Nothing?) | +| [RequiredWithEscapedCharactersMap100110Builder](#requiredwithescapedcharactersmap100110builder) | fooReverseSolidusU000cbar(value: Boolean) | +| [RequiredWithEscapedCharactersMap100110Builder](#requiredwithescapedcharactersmap100110builder) | fooReverseSolidusU000cbar(value: String) | +| [RequiredWithEscapedCharactersMap100110Builder](#requiredwithescapedcharactersmap100110builder) | fooReverseSolidusU000cbar(value: Int) | +| [RequiredWithEscapedCharactersMap100110Builder](#requiredwithescapedcharactersmap100110builder) | fooReverseSolidusU000cbar(value: Float) | +| [RequiredWithEscapedCharactersMap100110Builder](#requiredwithescapedcharactersmap100110builder) | fooReverseSolidusU000cbar(value: Long) | +| [RequiredWithEscapedCharactersMap100110Builder](#requiredwithescapedcharactersmap100110builder) | fooReverseSolidusU000cbar(value: Double) | +| [RequiredWithEscapedCharactersMap100110Builder](#requiredwithescapedcharactersmap100110builder) | fooReverseSolidusU000cbar(value: List) | +| [RequiredWithEscapedCharactersMap100110Builder](#requiredwithescapedcharactersmap100110builder) | fooReverseSolidusU000cbar(value: Map) | +| [RequiredWithEscapedCharactersMap101010Builder](#requiredwithescapedcharactersmap101010builder) | fooReverseSolidusRbar(value: Nothing?) | +| [RequiredWithEscapedCharactersMap101010Builder](#requiredwithescapedcharactersmap101010builder) | fooReverseSolidusRbar(value: Boolean) | +| [RequiredWithEscapedCharactersMap101010Builder](#requiredwithescapedcharactersmap101010builder) | fooReverseSolidusRbar(value: String) | +| [RequiredWithEscapedCharactersMap101010Builder](#requiredwithescapedcharactersmap101010builder) | fooReverseSolidusRbar(value: Int) | +| [RequiredWithEscapedCharactersMap101010Builder](#requiredwithescapedcharactersmap101010builder) | fooReverseSolidusRbar(value: Float) | +| [RequiredWithEscapedCharactersMap101010Builder](#requiredwithescapedcharactersmap101010builder) | fooReverseSolidusRbar(value: Long) | +| [RequiredWithEscapedCharactersMap101010Builder](#requiredwithescapedcharactersmap101010builder) | fooReverseSolidusRbar(value: Double) | +| [RequiredWithEscapedCharactersMap101010Builder](#requiredwithescapedcharactersmap101010builder) | fooReverseSolidusRbar(value: List) | +| [RequiredWithEscapedCharactersMap101010Builder](#requiredwithescapedcharactersmap101010builder) | fooReverseSolidusRbar(value: Map) | +| [RequiredWithEscapedCharactersMap101100Builder](#requiredwithescapedcharactersmap101100builder) | fooReverseSolidusQuotationMarkBar(value: Nothing?) | +| [RequiredWithEscapedCharactersMap101100Builder](#requiredwithescapedcharactersmap101100builder) | fooReverseSolidusQuotationMarkBar(value: Boolean) | +| [RequiredWithEscapedCharactersMap101100Builder](#requiredwithescapedcharactersmap101100builder) | fooReverseSolidusQuotationMarkBar(value: String) | +| [RequiredWithEscapedCharactersMap101100Builder](#requiredwithescapedcharactersmap101100builder) | fooReverseSolidusQuotationMarkBar(value: Int) | +| [RequiredWithEscapedCharactersMap101100Builder](#requiredwithescapedcharactersmap101100builder) | fooReverseSolidusQuotationMarkBar(value: Float) | +| [RequiredWithEscapedCharactersMap101100Builder](#requiredwithescapedcharactersmap101100builder) | fooReverseSolidusQuotationMarkBar(value: Long) | +| [RequiredWithEscapedCharactersMap101100Builder](#requiredwithescapedcharactersmap101100builder) | fooReverseSolidusQuotationMarkBar(value: Double) | +| [RequiredWithEscapedCharactersMap101100Builder](#requiredwithescapedcharactersmap101100builder) | fooReverseSolidusQuotationMarkBar(value: List) | +| [RequiredWithEscapedCharactersMap101100Builder](#requiredwithescapedcharactersmap101100builder) | fooReverseSolidusQuotationMarkBar(value: Map) | + +## RequiredWithEscapedCharactersMap101111Builder +class RequiredWithEscapedCharactersMap101111Builder
    +builder for `Map` + +A class that builds the Map input type + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| RequiredWithEscapedCharactersMap101111Builder(Map instance)
    Creates a builder that contains the passed instance | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| [RequiredWithEscapedCharactersMap001111Builder](#requiredwithescapedcharactersmap001111builder) | fooReverseSolidusTbar(value: Nothing?) | +| [RequiredWithEscapedCharactersMap001111Builder](#requiredwithescapedcharactersmap001111builder) | fooReverseSolidusTbar(value: Boolean) | +| [RequiredWithEscapedCharactersMap001111Builder](#requiredwithescapedcharactersmap001111builder) | fooReverseSolidusTbar(value: String) | +| [RequiredWithEscapedCharactersMap001111Builder](#requiredwithescapedcharactersmap001111builder) | fooReverseSolidusTbar(value: Int) | +| [RequiredWithEscapedCharactersMap001111Builder](#requiredwithescapedcharactersmap001111builder) | fooReverseSolidusTbar(value: Float) | +| [RequiredWithEscapedCharactersMap001111Builder](#requiredwithescapedcharactersmap001111builder) | fooReverseSolidusTbar(value: Long) | +| [RequiredWithEscapedCharactersMap001111Builder](#requiredwithescapedcharactersmap001111builder) | fooReverseSolidusTbar(value: Double) | +| [RequiredWithEscapedCharactersMap001111Builder](#requiredwithescapedcharactersmap001111builder) | fooReverseSolidusTbar(value: List) | +| [RequiredWithEscapedCharactersMap001111Builder](#requiredwithescapedcharactersmap001111builder) | fooReverseSolidusTbar(value: Map) | +| [RequiredWithEscapedCharactersMap100111Builder](#requiredwithescapedcharactersmap100111builder) | fooReverseSolidusU000cbar(value: Nothing?) | +| [RequiredWithEscapedCharactersMap100111Builder](#requiredwithescapedcharactersmap100111builder) | fooReverseSolidusU000cbar(value: Boolean) | +| [RequiredWithEscapedCharactersMap100111Builder](#requiredwithescapedcharactersmap100111builder) | fooReverseSolidusU000cbar(value: String) | +| [RequiredWithEscapedCharactersMap100111Builder](#requiredwithescapedcharactersmap100111builder) | fooReverseSolidusU000cbar(value: Int) | +| [RequiredWithEscapedCharactersMap100111Builder](#requiredwithescapedcharactersmap100111builder) | fooReverseSolidusU000cbar(value: Float) | +| [RequiredWithEscapedCharactersMap100111Builder](#requiredwithescapedcharactersmap100111builder) | fooReverseSolidusU000cbar(value: Long) | +| [RequiredWithEscapedCharactersMap100111Builder](#requiredwithescapedcharactersmap100111builder) | fooReverseSolidusU000cbar(value: Double) | +| [RequiredWithEscapedCharactersMap100111Builder](#requiredwithescapedcharactersmap100111builder) | fooReverseSolidusU000cbar(value: List) | +| [RequiredWithEscapedCharactersMap100111Builder](#requiredwithescapedcharactersmap100111builder) | fooReverseSolidusU000cbar(value: Map) | +| [RequiredWithEscapedCharactersMap101011Builder](#requiredwithescapedcharactersmap101011builder) | fooReverseSolidusRbar(value: Nothing?) | +| [RequiredWithEscapedCharactersMap101011Builder](#requiredwithescapedcharactersmap101011builder) | fooReverseSolidusRbar(value: Boolean) | +| [RequiredWithEscapedCharactersMap101011Builder](#requiredwithescapedcharactersmap101011builder) | fooReverseSolidusRbar(value: String) | +| [RequiredWithEscapedCharactersMap101011Builder](#requiredwithescapedcharactersmap101011builder) | fooReverseSolidusRbar(value: Int) | +| [RequiredWithEscapedCharactersMap101011Builder](#requiredwithescapedcharactersmap101011builder) | fooReverseSolidusRbar(value: Float) | +| [RequiredWithEscapedCharactersMap101011Builder](#requiredwithescapedcharactersmap101011builder) | fooReverseSolidusRbar(value: Long) | +| [RequiredWithEscapedCharactersMap101011Builder](#requiredwithescapedcharactersmap101011builder) | fooReverseSolidusRbar(value: Double) | +| [RequiredWithEscapedCharactersMap101011Builder](#requiredwithescapedcharactersmap101011builder) | fooReverseSolidusRbar(value: List) | +| [RequiredWithEscapedCharactersMap101011Builder](#requiredwithescapedcharactersmap101011builder) | fooReverseSolidusRbar(value: Map) | +| [RequiredWithEscapedCharactersMap101101Builder](#requiredwithescapedcharactersmap101101builder) | fooReverseSolidusQuotationMarkBar(value: Nothing?) | +| [RequiredWithEscapedCharactersMap101101Builder](#requiredwithescapedcharactersmap101101builder) | fooReverseSolidusQuotationMarkBar(value: Boolean) | +| [RequiredWithEscapedCharactersMap101101Builder](#requiredwithescapedcharactersmap101101builder) | fooReverseSolidusQuotationMarkBar(value: String) | +| [RequiredWithEscapedCharactersMap101101Builder](#requiredwithescapedcharactersmap101101builder) | fooReverseSolidusQuotationMarkBar(value: Int) | +| [RequiredWithEscapedCharactersMap101101Builder](#requiredwithescapedcharactersmap101101builder) | fooReverseSolidusQuotationMarkBar(value: Float) | +| [RequiredWithEscapedCharactersMap101101Builder](#requiredwithescapedcharactersmap101101builder) | fooReverseSolidusQuotationMarkBar(value: Long) | +| [RequiredWithEscapedCharactersMap101101Builder](#requiredwithescapedcharactersmap101101builder) | fooReverseSolidusQuotationMarkBar(value: Double) | +| [RequiredWithEscapedCharactersMap101101Builder](#requiredwithescapedcharactersmap101101builder) | fooReverseSolidusQuotationMarkBar(value: List) | +| [RequiredWithEscapedCharactersMap101101Builder](#requiredwithescapedcharactersmap101101builder) | fooReverseSolidusQuotationMarkBar(value: Map) | +| [RequiredWithEscapedCharactersMap101110Builder](#requiredwithescapedcharactersmap101110builder) | fooReverseSolidusReverseSolidusBar(value: Nothing?) | +| [RequiredWithEscapedCharactersMap101110Builder](#requiredwithescapedcharactersmap101110builder) | fooReverseSolidusReverseSolidusBar(value: Boolean) | +| [RequiredWithEscapedCharactersMap101110Builder](#requiredwithescapedcharactersmap101110builder) | fooReverseSolidusReverseSolidusBar(value: String) | +| [RequiredWithEscapedCharactersMap101110Builder](#requiredwithescapedcharactersmap101110builder) | fooReverseSolidusReverseSolidusBar(value: Int) | +| [RequiredWithEscapedCharactersMap101110Builder](#requiredwithescapedcharactersmap101110builder) | fooReverseSolidusReverseSolidusBar(value: Float) | +| [RequiredWithEscapedCharactersMap101110Builder](#requiredwithescapedcharactersmap101110builder) | fooReverseSolidusReverseSolidusBar(value: Long) | +| [RequiredWithEscapedCharactersMap101110Builder](#requiredwithescapedcharactersmap101110builder) | fooReverseSolidusReverseSolidusBar(value: Double) | +| [RequiredWithEscapedCharactersMap101110Builder](#requiredwithescapedcharactersmap101110builder) | fooReverseSolidusReverseSolidusBar(value: List) | +| [RequiredWithEscapedCharactersMap101110Builder](#requiredwithescapedcharactersmap101110builder) | fooReverseSolidusReverseSolidusBar(value: Map) | + +## RequiredWithEscapedCharactersMap110000Builder +class RequiredWithEscapedCharactersMap110000Builder
    +builder for `Map` + +A class that builds the Map input type + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| RequiredWithEscapedCharactersMap110000Builder(Map instance)
    Creates a builder that contains the passed instance | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| [RequiredWithEscapedCharactersMap010000Builder](#requiredwithescapedcharactersmap010000builder) | fooReverseSolidusTbar(value: Nothing?) | +| [RequiredWithEscapedCharactersMap010000Builder](#requiredwithescapedcharactersmap010000builder) | fooReverseSolidusTbar(value: Boolean) | +| [RequiredWithEscapedCharactersMap010000Builder](#requiredwithescapedcharactersmap010000builder) | fooReverseSolidusTbar(value: String) | +| [RequiredWithEscapedCharactersMap010000Builder](#requiredwithescapedcharactersmap010000builder) | fooReverseSolidusTbar(value: Int) | +| [RequiredWithEscapedCharactersMap010000Builder](#requiredwithescapedcharactersmap010000builder) | fooReverseSolidusTbar(value: Float) | +| [RequiredWithEscapedCharactersMap010000Builder](#requiredwithescapedcharactersmap010000builder) | fooReverseSolidusTbar(value: Long) | +| [RequiredWithEscapedCharactersMap010000Builder](#requiredwithescapedcharactersmap010000builder) | fooReverseSolidusTbar(value: Double) | +| [RequiredWithEscapedCharactersMap010000Builder](#requiredwithescapedcharactersmap010000builder) | fooReverseSolidusTbar(value: List) | +| [RequiredWithEscapedCharactersMap010000Builder](#requiredwithescapedcharactersmap010000builder) | fooReverseSolidusTbar(value: Map) | +| [RequiredWithEscapedCharactersMap100000Builder](#requiredwithescapedcharactersmap100000builder) | fooReverseSolidusNbar(value: Nothing?) | +| [RequiredWithEscapedCharactersMap100000Builder](#requiredwithescapedcharactersmap100000builder) | fooReverseSolidusNbar(value: Boolean) | +| [RequiredWithEscapedCharactersMap100000Builder](#requiredwithescapedcharactersmap100000builder) | fooReverseSolidusNbar(value: String) | +| [RequiredWithEscapedCharactersMap100000Builder](#requiredwithescapedcharactersmap100000builder) | fooReverseSolidusNbar(value: Int) | +| [RequiredWithEscapedCharactersMap100000Builder](#requiredwithescapedcharactersmap100000builder) | fooReverseSolidusNbar(value: Float) | +| [RequiredWithEscapedCharactersMap100000Builder](#requiredwithescapedcharactersmap100000builder) | fooReverseSolidusNbar(value: Long) | +| [RequiredWithEscapedCharactersMap100000Builder](#requiredwithescapedcharactersmap100000builder) | fooReverseSolidusNbar(value: Double) | +| [RequiredWithEscapedCharactersMap100000Builder](#requiredwithescapedcharactersmap100000builder) | fooReverseSolidusNbar(value: List) | +| [RequiredWithEscapedCharactersMap100000Builder](#requiredwithescapedcharactersmap100000builder) | fooReverseSolidusNbar(value: Map) | + +## RequiredWithEscapedCharactersMap110001Builder +class RequiredWithEscapedCharactersMap110001Builder
    +builder for `Map` + +A class that builds the Map input type + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| RequiredWithEscapedCharactersMap110001Builder(Map instance)
    Creates a builder that contains the passed instance | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| [RequiredWithEscapedCharactersMap010001Builder](#requiredwithescapedcharactersmap010001builder) | fooReverseSolidusTbar(value: Nothing?) | +| [RequiredWithEscapedCharactersMap010001Builder](#requiredwithescapedcharactersmap010001builder) | fooReverseSolidusTbar(value: Boolean) | +| [RequiredWithEscapedCharactersMap010001Builder](#requiredwithescapedcharactersmap010001builder) | fooReverseSolidusTbar(value: String) | +| [RequiredWithEscapedCharactersMap010001Builder](#requiredwithescapedcharactersmap010001builder) | fooReverseSolidusTbar(value: Int) | +| [RequiredWithEscapedCharactersMap010001Builder](#requiredwithescapedcharactersmap010001builder) | fooReverseSolidusTbar(value: Float) | +| [RequiredWithEscapedCharactersMap010001Builder](#requiredwithescapedcharactersmap010001builder) | fooReverseSolidusTbar(value: Long) | +| [RequiredWithEscapedCharactersMap010001Builder](#requiredwithescapedcharactersmap010001builder) | fooReverseSolidusTbar(value: Double) | +| [RequiredWithEscapedCharactersMap010001Builder](#requiredwithescapedcharactersmap010001builder) | fooReverseSolidusTbar(value: List) | +| [RequiredWithEscapedCharactersMap010001Builder](#requiredwithescapedcharactersmap010001builder) | fooReverseSolidusTbar(value: Map) | +| [RequiredWithEscapedCharactersMap100001Builder](#requiredwithescapedcharactersmap100001builder) | fooReverseSolidusNbar(value: Nothing?) | +| [RequiredWithEscapedCharactersMap100001Builder](#requiredwithescapedcharactersmap100001builder) | fooReverseSolidusNbar(value: Boolean) | +| [RequiredWithEscapedCharactersMap100001Builder](#requiredwithescapedcharactersmap100001builder) | fooReverseSolidusNbar(value: String) | +| [RequiredWithEscapedCharactersMap100001Builder](#requiredwithescapedcharactersmap100001builder) | fooReverseSolidusNbar(value: Int) | +| [RequiredWithEscapedCharactersMap100001Builder](#requiredwithescapedcharactersmap100001builder) | fooReverseSolidusNbar(value: Float) | +| [RequiredWithEscapedCharactersMap100001Builder](#requiredwithescapedcharactersmap100001builder) | fooReverseSolidusNbar(value: Long) | +| [RequiredWithEscapedCharactersMap100001Builder](#requiredwithescapedcharactersmap100001builder) | fooReverseSolidusNbar(value: Double) | +| [RequiredWithEscapedCharactersMap100001Builder](#requiredwithescapedcharactersmap100001builder) | fooReverseSolidusNbar(value: List) | +| [RequiredWithEscapedCharactersMap100001Builder](#requiredwithescapedcharactersmap100001builder) | fooReverseSolidusNbar(value: Map) | +| [RequiredWithEscapedCharactersMap110000Builder](#requiredwithescapedcharactersmap110000builder) | fooReverseSolidusReverseSolidusBar(value: Nothing?) | +| [RequiredWithEscapedCharactersMap110000Builder](#requiredwithescapedcharactersmap110000builder) | fooReverseSolidusReverseSolidusBar(value: Boolean) | +| [RequiredWithEscapedCharactersMap110000Builder](#requiredwithescapedcharactersmap110000builder) | fooReverseSolidusReverseSolidusBar(value: String) | +| [RequiredWithEscapedCharactersMap110000Builder](#requiredwithescapedcharactersmap110000builder) | fooReverseSolidusReverseSolidusBar(value: Int) | +| [RequiredWithEscapedCharactersMap110000Builder](#requiredwithescapedcharactersmap110000builder) | fooReverseSolidusReverseSolidusBar(value: Float) | +| [RequiredWithEscapedCharactersMap110000Builder](#requiredwithescapedcharactersmap110000builder) | fooReverseSolidusReverseSolidusBar(value: Long) | +| [RequiredWithEscapedCharactersMap110000Builder](#requiredwithescapedcharactersmap110000builder) | fooReverseSolidusReverseSolidusBar(value: Double) | +| [RequiredWithEscapedCharactersMap110000Builder](#requiredwithescapedcharactersmap110000builder) | fooReverseSolidusReverseSolidusBar(value: List) | +| [RequiredWithEscapedCharactersMap110000Builder](#requiredwithescapedcharactersmap110000builder) | fooReverseSolidusReverseSolidusBar(value: Map) | + +## RequiredWithEscapedCharactersMap110010Builder +class RequiredWithEscapedCharactersMap110010Builder
    +builder for `Map` + +A class that builds the Map input type + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| RequiredWithEscapedCharactersMap110010Builder(Map instance)
    Creates a builder that contains the passed instance | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| [RequiredWithEscapedCharactersMap010010Builder](#requiredwithescapedcharactersmap010010builder) | fooReverseSolidusTbar(value: Nothing?) | +| [RequiredWithEscapedCharactersMap010010Builder](#requiredwithescapedcharactersmap010010builder) | fooReverseSolidusTbar(value: Boolean) | +| [RequiredWithEscapedCharactersMap010010Builder](#requiredwithescapedcharactersmap010010builder) | fooReverseSolidusTbar(value: String) | +| [RequiredWithEscapedCharactersMap010010Builder](#requiredwithescapedcharactersmap010010builder) | fooReverseSolidusTbar(value: Int) | +| [RequiredWithEscapedCharactersMap010010Builder](#requiredwithescapedcharactersmap010010builder) | fooReverseSolidusTbar(value: Float) | +| [RequiredWithEscapedCharactersMap010010Builder](#requiredwithescapedcharactersmap010010builder) | fooReverseSolidusTbar(value: Long) | +| [RequiredWithEscapedCharactersMap010010Builder](#requiredwithescapedcharactersmap010010builder) | fooReverseSolidusTbar(value: Double) | +| [RequiredWithEscapedCharactersMap010010Builder](#requiredwithescapedcharactersmap010010builder) | fooReverseSolidusTbar(value: List) | +| [RequiredWithEscapedCharactersMap010010Builder](#requiredwithescapedcharactersmap010010builder) | fooReverseSolidusTbar(value: Map) | +| [RequiredWithEscapedCharactersMap100010Builder](#requiredwithescapedcharactersmap100010builder) | fooReverseSolidusNbar(value: Nothing?) | +| [RequiredWithEscapedCharactersMap100010Builder](#requiredwithescapedcharactersmap100010builder) | fooReverseSolidusNbar(value: Boolean) | +| [RequiredWithEscapedCharactersMap100010Builder](#requiredwithescapedcharactersmap100010builder) | fooReverseSolidusNbar(value: String) | +| [RequiredWithEscapedCharactersMap100010Builder](#requiredwithescapedcharactersmap100010builder) | fooReverseSolidusNbar(value: Int) | +| [RequiredWithEscapedCharactersMap100010Builder](#requiredwithescapedcharactersmap100010builder) | fooReverseSolidusNbar(value: Float) | +| [RequiredWithEscapedCharactersMap100010Builder](#requiredwithescapedcharactersmap100010builder) | fooReverseSolidusNbar(value: Long) | +| [RequiredWithEscapedCharactersMap100010Builder](#requiredwithescapedcharactersmap100010builder) | fooReverseSolidusNbar(value: Double) | +| [RequiredWithEscapedCharactersMap100010Builder](#requiredwithescapedcharactersmap100010builder) | fooReverseSolidusNbar(value: List) | +| [RequiredWithEscapedCharactersMap100010Builder](#requiredwithescapedcharactersmap100010builder) | fooReverseSolidusNbar(value: Map) | +| [RequiredWithEscapedCharactersMap110000Builder](#requiredwithescapedcharactersmap110000builder) | fooReverseSolidusQuotationMarkBar(value: Nothing?) | +| [RequiredWithEscapedCharactersMap110000Builder](#requiredwithescapedcharactersmap110000builder) | fooReverseSolidusQuotationMarkBar(value: Boolean) | +| [RequiredWithEscapedCharactersMap110000Builder](#requiredwithescapedcharactersmap110000builder) | fooReverseSolidusQuotationMarkBar(value: String) | +| [RequiredWithEscapedCharactersMap110000Builder](#requiredwithescapedcharactersmap110000builder) | fooReverseSolidusQuotationMarkBar(value: Int) | +| [RequiredWithEscapedCharactersMap110000Builder](#requiredwithescapedcharactersmap110000builder) | fooReverseSolidusQuotationMarkBar(value: Float) | +| [RequiredWithEscapedCharactersMap110000Builder](#requiredwithescapedcharactersmap110000builder) | fooReverseSolidusQuotationMarkBar(value: Long) | +| [RequiredWithEscapedCharactersMap110000Builder](#requiredwithescapedcharactersmap110000builder) | fooReverseSolidusQuotationMarkBar(value: Double) | +| [RequiredWithEscapedCharactersMap110000Builder](#requiredwithescapedcharactersmap110000builder) | fooReverseSolidusQuotationMarkBar(value: List) | +| [RequiredWithEscapedCharactersMap110000Builder](#requiredwithescapedcharactersmap110000builder) | fooReverseSolidusQuotationMarkBar(value: Map) | + +## RequiredWithEscapedCharactersMap110011Builder +class RequiredWithEscapedCharactersMap110011Builder
    +builder for `Map` + +A class that builds the Map input type + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| RequiredWithEscapedCharactersMap110011Builder(Map instance)
    Creates a builder that contains the passed instance | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| [RequiredWithEscapedCharactersMap010011Builder](#requiredwithescapedcharactersmap010011builder) | fooReverseSolidusTbar(value: Nothing?) | +| [RequiredWithEscapedCharactersMap010011Builder](#requiredwithescapedcharactersmap010011builder) | fooReverseSolidusTbar(value: Boolean) | +| [RequiredWithEscapedCharactersMap010011Builder](#requiredwithescapedcharactersmap010011builder) | fooReverseSolidusTbar(value: String) | +| [RequiredWithEscapedCharactersMap010011Builder](#requiredwithescapedcharactersmap010011builder) | fooReverseSolidusTbar(value: Int) | +| [RequiredWithEscapedCharactersMap010011Builder](#requiredwithescapedcharactersmap010011builder) | fooReverseSolidusTbar(value: Float) | +| [RequiredWithEscapedCharactersMap010011Builder](#requiredwithescapedcharactersmap010011builder) | fooReverseSolidusTbar(value: Long) | +| [RequiredWithEscapedCharactersMap010011Builder](#requiredwithescapedcharactersmap010011builder) | fooReverseSolidusTbar(value: Double) | +| [RequiredWithEscapedCharactersMap010011Builder](#requiredwithescapedcharactersmap010011builder) | fooReverseSolidusTbar(value: List) | +| [RequiredWithEscapedCharactersMap010011Builder](#requiredwithescapedcharactersmap010011builder) | fooReverseSolidusTbar(value: Map) | +| [RequiredWithEscapedCharactersMap100011Builder](#requiredwithescapedcharactersmap100011builder) | fooReverseSolidusNbar(value: Nothing?) | +| [RequiredWithEscapedCharactersMap100011Builder](#requiredwithescapedcharactersmap100011builder) | fooReverseSolidusNbar(value: Boolean) | +| [RequiredWithEscapedCharactersMap100011Builder](#requiredwithescapedcharactersmap100011builder) | fooReverseSolidusNbar(value: String) | +| [RequiredWithEscapedCharactersMap100011Builder](#requiredwithescapedcharactersmap100011builder) | fooReverseSolidusNbar(value: Int) | +| [RequiredWithEscapedCharactersMap100011Builder](#requiredwithescapedcharactersmap100011builder) | fooReverseSolidusNbar(value: Float) | +| [RequiredWithEscapedCharactersMap100011Builder](#requiredwithescapedcharactersmap100011builder) | fooReverseSolidusNbar(value: Long) | +| [RequiredWithEscapedCharactersMap100011Builder](#requiredwithescapedcharactersmap100011builder) | fooReverseSolidusNbar(value: Double) | +| [RequiredWithEscapedCharactersMap100011Builder](#requiredwithescapedcharactersmap100011builder) | fooReverseSolidusNbar(value: List) | +| [RequiredWithEscapedCharactersMap100011Builder](#requiredwithescapedcharactersmap100011builder) | fooReverseSolidusNbar(value: Map) | +| [RequiredWithEscapedCharactersMap110001Builder](#requiredwithescapedcharactersmap110001builder) | fooReverseSolidusQuotationMarkBar(value: Nothing?) | +| [RequiredWithEscapedCharactersMap110001Builder](#requiredwithescapedcharactersmap110001builder) | fooReverseSolidusQuotationMarkBar(value: Boolean) | +| [RequiredWithEscapedCharactersMap110001Builder](#requiredwithescapedcharactersmap110001builder) | fooReverseSolidusQuotationMarkBar(value: String) | +| [RequiredWithEscapedCharactersMap110001Builder](#requiredwithescapedcharactersmap110001builder) | fooReverseSolidusQuotationMarkBar(value: Int) | +| [RequiredWithEscapedCharactersMap110001Builder](#requiredwithescapedcharactersmap110001builder) | fooReverseSolidusQuotationMarkBar(value: Float) | +| [RequiredWithEscapedCharactersMap110001Builder](#requiredwithescapedcharactersmap110001builder) | fooReverseSolidusQuotationMarkBar(value: Long) | +| [RequiredWithEscapedCharactersMap110001Builder](#requiredwithescapedcharactersmap110001builder) | fooReverseSolidusQuotationMarkBar(value: Double) | +| [RequiredWithEscapedCharactersMap110001Builder](#requiredwithescapedcharactersmap110001builder) | fooReverseSolidusQuotationMarkBar(value: List) | +| [RequiredWithEscapedCharactersMap110001Builder](#requiredwithescapedcharactersmap110001builder) | fooReverseSolidusQuotationMarkBar(value: Map) | +| [RequiredWithEscapedCharactersMap110010Builder](#requiredwithescapedcharactersmap110010builder) | fooReverseSolidusReverseSolidusBar(value: Nothing?) | +| [RequiredWithEscapedCharactersMap110010Builder](#requiredwithescapedcharactersmap110010builder) | fooReverseSolidusReverseSolidusBar(value: Boolean) | +| [RequiredWithEscapedCharactersMap110010Builder](#requiredwithescapedcharactersmap110010builder) | fooReverseSolidusReverseSolidusBar(value: String) | +| [RequiredWithEscapedCharactersMap110010Builder](#requiredwithescapedcharactersmap110010builder) | fooReverseSolidusReverseSolidusBar(value: Int) | +| [RequiredWithEscapedCharactersMap110010Builder](#requiredwithescapedcharactersmap110010builder) | fooReverseSolidusReverseSolidusBar(value: Float) | +| [RequiredWithEscapedCharactersMap110010Builder](#requiredwithescapedcharactersmap110010builder) | fooReverseSolidusReverseSolidusBar(value: Long) | +| [RequiredWithEscapedCharactersMap110010Builder](#requiredwithescapedcharactersmap110010builder) | fooReverseSolidusReverseSolidusBar(value: Double) | +| [RequiredWithEscapedCharactersMap110010Builder](#requiredwithescapedcharactersmap110010builder) | fooReverseSolidusReverseSolidusBar(value: List) | +| [RequiredWithEscapedCharactersMap110010Builder](#requiredwithescapedcharactersmap110010builder) | fooReverseSolidusReverseSolidusBar(value: Map) | + +## RequiredWithEscapedCharactersMap110100Builder +class RequiredWithEscapedCharactersMap110100Builder
    +builder for `Map` + +A class that builds the Map input type + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| RequiredWithEscapedCharactersMap110100Builder(Map instance)
    Creates a builder that contains the passed instance | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| [RequiredWithEscapedCharactersMap010100Builder](#requiredwithescapedcharactersmap010100builder) | fooReverseSolidusTbar(value: Nothing?) | +| [RequiredWithEscapedCharactersMap010100Builder](#requiredwithescapedcharactersmap010100builder) | fooReverseSolidusTbar(value: Boolean) | +| [RequiredWithEscapedCharactersMap010100Builder](#requiredwithescapedcharactersmap010100builder) | fooReverseSolidusTbar(value: String) | +| [RequiredWithEscapedCharactersMap010100Builder](#requiredwithescapedcharactersmap010100builder) | fooReverseSolidusTbar(value: Int) | +| [RequiredWithEscapedCharactersMap010100Builder](#requiredwithescapedcharactersmap010100builder) | fooReverseSolidusTbar(value: Float) | +| [RequiredWithEscapedCharactersMap010100Builder](#requiredwithescapedcharactersmap010100builder) | fooReverseSolidusTbar(value: Long) | +| [RequiredWithEscapedCharactersMap010100Builder](#requiredwithescapedcharactersmap010100builder) | fooReverseSolidusTbar(value: Double) | +| [RequiredWithEscapedCharactersMap010100Builder](#requiredwithescapedcharactersmap010100builder) | fooReverseSolidusTbar(value: List) | +| [RequiredWithEscapedCharactersMap010100Builder](#requiredwithescapedcharactersmap010100builder) | fooReverseSolidusTbar(value: Map) | +| [RequiredWithEscapedCharactersMap100100Builder](#requiredwithescapedcharactersmap100100builder) | fooReverseSolidusNbar(value: Nothing?) | +| [RequiredWithEscapedCharactersMap100100Builder](#requiredwithescapedcharactersmap100100builder) | fooReverseSolidusNbar(value: Boolean) | +| [RequiredWithEscapedCharactersMap100100Builder](#requiredwithescapedcharactersmap100100builder) | fooReverseSolidusNbar(value: String) | +| [RequiredWithEscapedCharactersMap100100Builder](#requiredwithescapedcharactersmap100100builder) | fooReverseSolidusNbar(value: Int) | +| [RequiredWithEscapedCharactersMap100100Builder](#requiredwithescapedcharactersmap100100builder) | fooReverseSolidusNbar(value: Float) | +| [RequiredWithEscapedCharactersMap100100Builder](#requiredwithescapedcharactersmap100100builder) | fooReverseSolidusNbar(value: Long) | +| [RequiredWithEscapedCharactersMap100100Builder](#requiredwithescapedcharactersmap100100builder) | fooReverseSolidusNbar(value: Double) | +| [RequiredWithEscapedCharactersMap100100Builder](#requiredwithescapedcharactersmap100100builder) | fooReverseSolidusNbar(value: List) | +| [RequiredWithEscapedCharactersMap100100Builder](#requiredwithescapedcharactersmap100100builder) | fooReverseSolidusNbar(value: Map) | +| [RequiredWithEscapedCharactersMap110000Builder](#requiredwithescapedcharactersmap110000builder) | fooReverseSolidusRbar(value: Nothing?) | +| [RequiredWithEscapedCharactersMap110000Builder](#requiredwithescapedcharactersmap110000builder) | fooReverseSolidusRbar(value: Boolean) | +| [RequiredWithEscapedCharactersMap110000Builder](#requiredwithescapedcharactersmap110000builder) | fooReverseSolidusRbar(value: String) | +| [RequiredWithEscapedCharactersMap110000Builder](#requiredwithescapedcharactersmap110000builder) | fooReverseSolidusRbar(value: Int) | +| [RequiredWithEscapedCharactersMap110000Builder](#requiredwithescapedcharactersmap110000builder) | fooReverseSolidusRbar(value: Float) | +| [RequiredWithEscapedCharactersMap110000Builder](#requiredwithescapedcharactersmap110000builder) | fooReverseSolidusRbar(value: Long) | +| [RequiredWithEscapedCharactersMap110000Builder](#requiredwithescapedcharactersmap110000builder) | fooReverseSolidusRbar(value: Double) | +| [RequiredWithEscapedCharactersMap110000Builder](#requiredwithescapedcharactersmap110000builder) | fooReverseSolidusRbar(value: List) | +| [RequiredWithEscapedCharactersMap110000Builder](#requiredwithescapedcharactersmap110000builder) | fooReverseSolidusRbar(value: Map) | + +## RequiredWithEscapedCharactersMap110101Builder +class RequiredWithEscapedCharactersMap110101Builder
    +builder for `Map` + +A class that builds the Map input type + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| RequiredWithEscapedCharactersMap110101Builder(Map instance)
    Creates a builder that contains the passed instance | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| [RequiredWithEscapedCharactersMap010101Builder](#requiredwithescapedcharactersmap010101builder) | fooReverseSolidusTbar(value: Nothing?) | +| [RequiredWithEscapedCharactersMap010101Builder](#requiredwithescapedcharactersmap010101builder) | fooReverseSolidusTbar(value: Boolean) | +| [RequiredWithEscapedCharactersMap010101Builder](#requiredwithescapedcharactersmap010101builder) | fooReverseSolidusTbar(value: String) | +| [RequiredWithEscapedCharactersMap010101Builder](#requiredwithescapedcharactersmap010101builder) | fooReverseSolidusTbar(value: Int) | +| [RequiredWithEscapedCharactersMap010101Builder](#requiredwithescapedcharactersmap010101builder) | fooReverseSolidusTbar(value: Float) | +| [RequiredWithEscapedCharactersMap010101Builder](#requiredwithescapedcharactersmap010101builder) | fooReverseSolidusTbar(value: Long) | +| [RequiredWithEscapedCharactersMap010101Builder](#requiredwithescapedcharactersmap010101builder) | fooReverseSolidusTbar(value: Double) | +| [RequiredWithEscapedCharactersMap010101Builder](#requiredwithescapedcharactersmap010101builder) | fooReverseSolidusTbar(value: List) | +| [RequiredWithEscapedCharactersMap010101Builder](#requiredwithescapedcharactersmap010101builder) | fooReverseSolidusTbar(value: Map) | +| [RequiredWithEscapedCharactersMap100101Builder](#requiredwithescapedcharactersmap100101builder) | fooReverseSolidusNbar(value: Nothing?) | +| [RequiredWithEscapedCharactersMap100101Builder](#requiredwithescapedcharactersmap100101builder) | fooReverseSolidusNbar(value: Boolean) | +| [RequiredWithEscapedCharactersMap100101Builder](#requiredwithescapedcharactersmap100101builder) | fooReverseSolidusNbar(value: String) | +| [RequiredWithEscapedCharactersMap100101Builder](#requiredwithescapedcharactersmap100101builder) | fooReverseSolidusNbar(value: Int) | +| [RequiredWithEscapedCharactersMap100101Builder](#requiredwithescapedcharactersmap100101builder) | fooReverseSolidusNbar(value: Float) | +| [RequiredWithEscapedCharactersMap100101Builder](#requiredwithescapedcharactersmap100101builder) | fooReverseSolidusNbar(value: Long) | +| [RequiredWithEscapedCharactersMap100101Builder](#requiredwithescapedcharactersmap100101builder) | fooReverseSolidusNbar(value: Double) | +| [RequiredWithEscapedCharactersMap100101Builder](#requiredwithescapedcharactersmap100101builder) | fooReverseSolidusNbar(value: List) | +| [RequiredWithEscapedCharactersMap100101Builder](#requiredwithescapedcharactersmap100101builder) | fooReverseSolidusNbar(value: Map) | +| [RequiredWithEscapedCharactersMap110001Builder](#requiredwithescapedcharactersmap110001builder) | fooReverseSolidusRbar(value: Nothing?) | +| [RequiredWithEscapedCharactersMap110001Builder](#requiredwithescapedcharactersmap110001builder) | fooReverseSolidusRbar(value: Boolean) | +| [RequiredWithEscapedCharactersMap110001Builder](#requiredwithescapedcharactersmap110001builder) | fooReverseSolidusRbar(value: String) | +| [RequiredWithEscapedCharactersMap110001Builder](#requiredwithescapedcharactersmap110001builder) | fooReverseSolidusRbar(value: Int) | +| [RequiredWithEscapedCharactersMap110001Builder](#requiredwithescapedcharactersmap110001builder) | fooReverseSolidusRbar(value: Float) | +| [RequiredWithEscapedCharactersMap110001Builder](#requiredwithescapedcharactersmap110001builder) | fooReverseSolidusRbar(value: Long) | +| [RequiredWithEscapedCharactersMap110001Builder](#requiredwithescapedcharactersmap110001builder) | fooReverseSolidusRbar(value: Double) | +| [RequiredWithEscapedCharactersMap110001Builder](#requiredwithescapedcharactersmap110001builder) | fooReverseSolidusRbar(value: List) | +| [RequiredWithEscapedCharactersMap110001Builder](#requiredwithescapedcharactersmap110001builder) | fooReverseSolidusRbar(value: Map) | +| [RequiredWithEscapedCharactersMap110100Builder](#requiredwithescapedcharactersmap110100builder) | fooReverseSolidusReverseSolidusBar(value: Nothing?) | +| [RequiredWithEscapedCharactersMap110100Builder](#requiredwithescapedcharactersmap110100builder) | fooReverseSolidusReverseSolidusBar(value: Boolean) | +| [RequiredWithEscapedCharactersMap110100Builder](#requiredwithescapedcharactersmap110100builder) | fooReverseSolidusReverseSolidusBar(value: String) | +| [RequiredWithEscapedCharactersMap110100Builder](#requiredwithescapedcharactersmap110100builder) | fooReverseSolidusReverseSolidusBar(value: Int) | +| [RequiredWithEscapedCharactersMap110100Builder](#requiredwithescapedcharactersmap110100builder) | fooReverseSolidusReverseSolidusBar(value: Float) | +| [RequiredWithEscapedCharactersMap110100Builder](#requiredwithescapedcharactersmap110100builder) | fooReverseSolidusReverseSolidusBar(value: Long) | +| [RequiredWithEscapedCharactersMap110100Builder](#requiredwithescapedcharactersmap110100builder) | fooReverseSolidusReverseSolidusBar(value: Double) | +| [RequiredWithEscapedCharactersMap110100Builder](#requiredwithescapedcharactersmap110100builder) | fooReverseSolidusReverseSolidusBar(value: List) | +| [RequiredWithEscapedCharactersMap110100Builder](#requiredwithescapedcharactersmap110100builder) | fooReverseSolidusReverseSolidusBar(value: Map) | + +## RequiredWithEscapedCharactersMap110110Builder +class RequiredWithEscapedCharactersMap110110Builder
    +builder for `Map` + +A class that builds the Map input type + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| RequiredWithEscapedCharactersMap110110Builder(Map instance)
    Creates a builder that contains the passed instance | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| [RequiredWithEscapedCharactersMap010110Builder](#requiredwithescapedcharactersmap010110builder) | fooReverseSolidusTbar(value: Nothing?) | +| [RequiredWithEscapedCharactersMap010110Builder](#requiredwithescapedcharactersmap010110builder) | fooReverseSolidusTbar(value: Boolean) | +| [RequiredWithEscapedCharactersMap010110Builder](#requiredwithescapedcharactersmap010110builder) | fooReverseSolidusTbar(value: String) | +| [RequiredWithEscapedCharactersMap010110Builder](#requiredwithescapedcharactersmap010110builder) | fooReverseSolidusTbar(value: Int) | +| [RequiredWithEscapedCharactersMap010110Builder](#requiredwithescapedcharactersmap010110builder) | fooReverseSolidusTbar(value: Float) | +| [RequiredWithEscapedCharactersMap010110Builder](#requiredwithescapedcharactersmap010110builder) | fooReverseSolidusTbar(value: Long) | +| [RequiredWithEscapedCharactersMap010110Builder](#requiredwithescapedcharactersmap010110builder) | fooReverseSolidusTbar(value: Double) | +| [RequiredWithEscapedCharactersMap010110Builder](#requiredwithescapedcharactersmap010110builder) | fooReverseSolidusTbar(value: List) | +| [RequiredWithEscapedCharactersMap010110Builder](#requiredwithescapedcharactersmap010110builder) | fooReverseSolidusTbar(value: Map) | +| [RequiredWithEscapedCharactersMap100110Builder](#requiredwithescapedcharactersmap100110builder) | fooReverseSolidusNbar(value: Nothing?) | +| [RequiredWithEscapedCharactersMap100110Builder](#requiredwithescapedcharactersmap100110builder) | fooReverseSolidusNbar(value: Boolean) | +| [RequiredWithEscapedCharactersMap100110Builder](#requiredwithescapedcharactersmap100110builder) | fooReverseSolidusNbar(value: String) | +| [RequiredWithEscapedCharactersMap100110Builder](#requiredwithescapedcharactersmap100110builder) | fooReverseSolidusNbar(value: Int) | +| [RequiredWithEscapedCharactersMap100110Builder](#requiredwithescapedcharactersmap100110builder) | fooReverseSolidusNbar(value: Float) | +| [RequiredWithEscapedCharactersMap100110Builder](#requiredwithescapedcharactersmap100110builder) | fooReverseSolidusNbar(value: Long) | +| [RequiredWithEscapedCharactersMap100110Builder](#requiredwithescapedcharactersmap100110builder) | fooReverseSolidusNbar(value: Double) | +| [RequiredWithEscapedCharactersMap100110Builder](#requiredwithescapedcharactersmap100110builder) | fooReverseSolidusNbar(value: List) | +| [RequiredWithEscapedCharactersMap100110Builder](#requiredwithescapedcharactersmap100110builder) | fooReverseSolidusNbar(value: Map) | +| [RequiredWithEscapedCharactersMap110010Builder](#requiredwithescapedcharactersmap110010builder) | fooReverseSolidusRbar(value: Nothing?) | +| [RequiredWithEscapedCharactersMap110010Builder](#requiredwithescapedcharactersmap110010builder) | fooReverseSolidusRbar(value: Boolean) | +| [RequiredWithEscapedCharactersMap110010Builder](#requiredwithescapedcharactersmap110010builder) | fooReverseSolidusRbar(value: String) | +| [RequiredWithEscapedCharactersMap110010Builder](#requiredwithescapedcharactersmap110010builder) | fooReverseSolidusRbar(value: Int) | +| [RequiredWithEscapedCharactersMap110010Builder](#requiredwithescapedcharactersmap110010builder) | fooReverseSolidusRbar(value: Float) | +| [RequiredWithEscapedCharactersMap110010Builder](#requiredwithescapedcharactersmap110010builder) | fooReverseSolidusRbar(value: Long) | +| [RequiredWithEscapedCharactersMap110010Builder](#requiredwithescapedcharactersmap110010builder) | fooReverseSolidusRbar(value: Double) | +| [RequiredWithEscapedCharactersMap110010Builder](#requiredwithescapedcharactersmap110010builder) | fooReverseSolidusRbar(value: List) | +| [RequiredWithEscapedCharactersMap110010Builder](#requiredwithescapedcharactersmap110010builder) | fooReverseSolidusRbar(value: Map) | +| [RequiredWithEscapedCharactersMap110100Builder](#requiredwithescapedcharactersmap110100builder) | fooReverseSolidusQuotationMarkBar(value: Nothing?) | +| [RequiredWithEscapedCharactersMap110100Builder](#requiredwithescapedcharactersmap110100builder) | fooReverseSolidusQuotationMarkBar(value: Boolean) | +| [RequiredWithEscapedCharactersMap110100Builder](#requiredwithescapedcharactersmap110100builder) | fooReverseSolidusQuotationMarkBar(value: String) | +| [RequiredWithEscapedCharactersMap110100Builder](#requiredwithescapedcharactersmap110100builder) | fooReverseSolidusQuotationMarkBar(value: Int) | +| [RequiredWithEscapedCharactersMap110100Builder](#requiredwithescapedcharactersmap110100builder) | fooReverseSolidusQuotationMarkBar(value: Float) | +| [RequiredWithEscapedCharactersMap110100Builder](#requiredwithescapedcharactersmap110100builder) | fooReverseSolidusQuotationMarkBar(value: Long) | +| [RequiredWithEscapedCharactersMap110100Builder](#requiredwithescapedcharactersmap110100builder) | fooReverseSolidusQuotationMarkBar(value: Double) | +| [RequiredWithEscapedCharactersMap110100Builder](#requiredwithescapedcharactersmap110100builder) | fooReverseSolidusQuotationMarkBar(value: List) | +| [RequiredWithEscapedCharactersMap110100Builder](#requiredwithescapedcharactersmap110100builder) | fooReverseSolidusQuotationMarkBar(value: Map) | + +## RequiredWithEscapedCharactersMap110111Builder +class RequiredWithEscapedCharactersMap110111Builder
    +builder for `Map` + +A class that builds the Map input type + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| RequiredWithEscapedCharactersMap110111Builder(Map instance)
    Creates a builder that contains the passed instance | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| [RequiredWithEscapedCharactersMap010111Builder](#requiredwithescapedcharactersmap010111builder) | fooReverseSolidusTbar(value: Nothing?) | +| [RequiredWithEscapedCharactersMap010111Builder](#requiredwithescapedcharactersmap010111builder) | fooReverseSolidusTbar(value: Boolean) | +| [RequiredWithEscapedCharactersMap010111Builder](#requiredwithescapedcharactersmap010111builder) | fooReverseSolidusTbar(value: String) | +| [RequiredWithEscapedCharactersMap010111Builder](#requiredwithescapedcharactersmap010111builder) | fooReverseSolidusTbar(value: Int) | +| [RequiredWithEscapedCharactersMap010111Builder](#requiredwithescapedcharactersmap010111builder) | fooReverseSolidusTbar(value: Float) | +| [RequiredWithEscapedCharactersMap010111Builder](#requiredwithescapedcharactersmap010111builder) | fooReverseSolidusTbar(value: Long) | +| [RequiredWithEscapedCharactersMap010111Builder](#requiredwithescapedcharactersmap010111builder) | fooReverseSolidusTbar(value: Double) | +| [RequiredWithEscapedCharactersMap010111Builder](#requiredwithescapedcharactersmap010111builder) | fooReverseSolidusTbar(value: List) | +| [RequiredWithEscapedCharactersMap010111Builder](#requiredwithescapedcharactersmap010111builder) | fooReverseSolidusTbar(value: Map) | +| [RequiredWithEscapedCharactersMap100111Builder](#requiredwithescapedcharactersmap100111builder) | fooReverseSolidusNbar(value: Nothing?) | +| [RequiredWithEscapedCharactersMap100111Builder](#requiredwithescapedcharactersmap100111builder) | fooReverseSolidusNbar(value: Boolean) | +| [RequiredWithEscapedCharactersMap100111Builder](#requiredwithescapedcharactersmap100111builder) | fooReverseSolidusNbar(value: String) | +| [RequiredWithEscapedCharactersMap100111Builder](#requiredwithescapedcharactersmap100111builder) | fooReverseSolidusNbar(value: Int) | +| [RequiredWithEscapedCharactersMap100111Builder](#requiredwithescapedcharactersmap100111builder) | fooReverseSolidusNbar(value: Float) | +| [RequiredWithEscapedCharactersMap100111Builder](#requiredwithescapedcharactersmap100111builder) | fooReverseSolidusNbar(value: Long) | +| [RequiredWithEscapedCharactersMap100111Builder](#requiredwithescapedcharactersmap100111builder) | fooReverseSolidusNbar(value: Double) | +| [RequiredWithEscapedCharactersMap100111Builder](#requiredwithescapedcharactersmap100111builder) | fooReverseSolidusNbar(value: List) | +| [RequiredWithEscapedCharactersMap100111Builder](#requiredwithescapedcharactersmap100111builder) | fooReverseSolidusNbar(value: Map) | +| [RequiredWithEscapedCharactersMap110011Builder](#requiredwithescapedcharactersmap110011builder) | fooReverseSolidusRbar(value: Nothing?) | +| [RequiredWithEscapedCharactersMap110011Builder](#requiredwithescapedcharactersmap110011builder) | fooReverseSolidusRbar(value: Boolean) | +| [RequiredWithEscapedCharactersMap110011Builder](#requiredwithescapedcharactersmap110011builder) | fooReverseSolidusRbar(value: String) | +| [RequiredWithEscapedCharactersMap110011Builder](#requiredwithescapedcharactersmap110011builder) | fooReverseSolidusRbar(value: Int) | +| [RequiredWithEscapedCharactersMap110011Builder](#requiredwithescapedcharactersmap110011builder) | fooReverseSolidusRbar(value: Float) | +| [RequiredWithEscapedCharactersMap110011Builder](#requiredwithescapedcharactersmap110011builder) | fooReverseSolidusRbar(value: Long) | +| [RequiredWithEscapedCharactersMap110011Builder](#requiredwithescapedcharactersmap110011builder) | fooReverseSolidusRbar(value: Double) | +| [RequiredWithEscapedCharactersMap110011Builder](#requiredwithescapedcharactersmap110011builder) | fooReverseSolidusRbar(value: List) | +| [RequiredWithEscapedCharactersMap110011Builder](#requiredwithescapedcharactersmap110011builder) | fooReverseSolidusRbar(value: Map) | +| [RequiredWithEscapedCharactersMap110101Builder](#requiredwithescapedcharactersmap110101builder) | fooReverseSolidusQuotationMarkBar(value: Nothing?) | +| [RequiredWithEscapedCharactersMap110101Builder](#requiredwithescapedcharactersmap110101builder) | fooReverseSolidusQuotationMarkBar(value: Boolean) | +| [RequiredWithEscapedCharactersMap110101Builder](#requiredwithescapedcharactersmap110101builder) | fooReverseSolidusQuotationMarkBar(value: String) | +| [RequiredWithEscapedCharactersMap110101Builder](#requiredwithescapedcharactersmap110101builder) | fooReverseSolidusQuotationMarkBar(value: Int) | +| [RequiredWithEscapedCharactersMap110101Builder](#requiredwithescapedcharactersmap110101builder) | fooReverseSolidusQuotationMarkBar(value: Float) | +| [RequiredWithEscapedCharactersMap110101Builder](#requiredwithescapedcharactersmap110101builder) | fooReverseSolidusQuotationMarkBar(value: Long) | +| [RequiredWithEscapedCharactersMap110101Builder](#requiredwithescapedcharactersmap110101builder) | fooReverseSolidusQuotationMarkBar(value: Double) | +| [RequiredWithEscapedCharactersMap110101Builder](#requiredwithescapedcharactersmap110101builder) | fooReverseSolidusQuotationMarkBar(value: List) | +| [RequiredWithEscapedCharactersMap110101Builder](#requiredwithescapedcharactersmap110101builder) | fooReverseSolidusQuotationMarkBar(value: Map) | +| [RequiredWithEscapedCharactersMap110110Builder](#requiredwithescapedcharactersmap110110builder) | fooReverseSolidusReverseSolidusBar(value: Nothing?) | +| [RequiredWithEscapedCharactersMap110110Builder](#requiredwithescapedcharactersmap110110builder) | fooReverseSolidusReverseSolidusBar(value: Boolean) | +| [RequiredWithEscapedCharactersMap110110Builder](#requiredwithescapedcharactersmap110110builder) | fooReverseSolidusReverseSolidusBar(value: String) | +| [RequiredWithEscapedCharactersMap110110Builder](#requiredwithescapedcharactersmap110110builder) | fooReverseSolidusReverseSolidusBar(value: Int) | +| [RequiredWithEscapedCharactersMap110110Builder](#requiredwithescapedcharactersmap110110builder) | fooReverseSolidusReverseSolidusBar(value: Float) | +| [RequiredWithEscapedCharactersMap110110Builder](#requiredwithescapedcharactersmap110110builder) | fooReverseSolidusReverseSolidusBar(value: Long) | +| [RequiredWithEscapedCharactersMap110110Builder](#requiredwithescapedcharactersmap110110builder) | fooReverseSolidusReverseSolidusBar(value: Double) | +| [RequiredWithEscapedCharactersMap110110Builder](#requiredwithescapedcharactersmap110110builder) | fooReverseSolidusReverseSolidusBar(value: List) | +| [RequiredWithEscapedCharactersMap110110Builder](#requiredwithescapedcharactersmap110110builder) | fooReverseSolidusReverseSolidusBar(value: Map) | + +## RequiredWithEscapedCharactersMap111000Builder +class RequiredWithEscapedCharactersMap111000Builder
    +builder for `Map` + +A class that builds the Map input type + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| RequiredWithEscapedCharactersMap111000Builder(Map instance)
    Creates a builder that contains the passed instance | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| [RequiredWithEscapedCharactersMap011000Builder](#requiredwithescapedcharactersmap011000builder) | fooReverseSolidusTbar(value: Nothing?) | +| [RequiredWithEscapedCharactersMap011000Builder](#requiredwithescapedcharactersmap011000builder) | fooReverseSolidusTbar(value: Boolean) | +| [RequiredWithEscapedCharactersMap011000Builder](#requiredwithescapedcharactersmap011000builder) | fooReverseSolidusTbar(value: String) | +| [RequiredWithEscapedCharactersMap011000Builder](#requiredwithescapedcharactersmap011000builder) | fooReverseSolidusTbar(value: Int) | +| [RequiredWithEscapedCharactersMap011000Builder](#requiredwithescapedcharactersmap011000builder) | fooReverseSolidusTbar(value: Float) | +| [RequiredWithEscapedCharactersMap011000Builder](#requiredwithescapedcharactersmap011000builder) | fooReverseSolidusTbar(value: Long) | +| [RequiredWithEscapedCharactersMap011000Builder](#requiredwithescapedcharactersmap011000builder) | fooReverseSolidusTbar(value: Double) | +| [RequiredWithEscapedCharactersMap011000Builder](#requiredwithescapedcharactersmap011000builder) | fooReverseSolidusTbar(value: List) | +| [RequiredWithEscapedCharactersMap011000Builder](#requiredwithescapedcharactersmap011000builder) | fooReverseSolidusTbar(value: Map) | +| [RequiredWithEscapedCharactersMap101000Builder](#requiredwithescapedcharactersmap101000builder) | fooReverseSolidusNbar(value: Nothing?) | +| [RequiredWithEscapedCharactersMap101000Builder](#requiredwithescapedcharactersmap101000builder) | fooReverseSolidusNbar(value: Boolean) | +| [RequiredWithEscapedCharactersMap101000Builder](#requiredwithescapedcharactersmap101000builder) | fooReverseSolidusNbar(value: String) | +| [RequiredWithEscapedCharactersMap101000Builder](#requiredwithescapedcharactersmap101000builder) | fooReverseSolidusNbar(value: Int) | +| [RequiredWithEscapedCharactersMap101000Builder](#requiredwithescapedcharactersmap101000builder) | fooReverseSolidusNbar(value: Float) | +| [RequiredWithEscapedCharactersMap101000Builder](#requiredwithescapedcharactersmap101000builder) | fooReverseSolidusNbar(value: Long) | +| [RequiredWithEscapedCharactersMap101000Builder](#requiredwithescapedcharactersmap101000builder) | fooReverseSolidusNbar(value: Double) | +| [RequiredWithEscapedCharactersMap101000Builder](#requiredwithescapedcharactersmap101000builder) | fooReverseSolidusNbar(value: List) | +| [RequiredWithEscapedCharactersMap101000Builder](#requiredwithescapedcharactersmap101000builder) | fooReverseSolidusNbar(value: Map) | +| [RequiredWithEscapedCharactersMap110000Builder](#requiredwithescapedcharactersmap110000builder) | fooReverseSolidusU000cbar(value: Nothing?) | +| [RequiredWithEscapedCharactersMap110000Builder](#requiredwithescapedcharactersmap110000builder) | fooReverseSolidusU000cbar(value: Boolean) | +| [RequiredWithEscapedCharactersMap110000Builder](#requiredwithescapedcharactersmap110000builder) | fooReverseSolidusU000cbar(value: String) | +| [RequiredWithEscapedCharactersMap110000Builder](#requiredwithescapedcharactersmap110000builder) | fooReverseSolidusU000cbar(value: Int) | +| [RequiredWithEscapedCharactersMap110000Builder](#requiredwithescapedcharactersmap110000builder) | fooReverseSolidusU000cbar(value: Float) | +| [RequiredWithEscapedCharactersMap110000Builder](#requiredwithescapedcharactersmap110000builder) | fooReverseSolidusU000cbar(value: Long) | +| [RequiredWithEscapedCharactersMap110000Builder](#requiredwithescapedcharactersmap110000builder) | fooReverseSolidusU000cbar(value: Double) | +| [RequiredWithEscapedCharactersMap110000Builder](#requiredwithescapedcharactersmap110000builder) | fooReverseSolidusU000cbar(value: List) | +| [RequiredWithEscapedCharactersMap110000Builder](#requiredwithescapedcharactersmap110000builder) | fooReverseSolidusU000cbar(value: Map) | + +## RequiredWithEscapedCharactersMap111001Builder +class RequiredWithEscapedCharactersMap111001Builder
    +builder for `Map` + +A class that builds the Map input type + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| RequiredWithEscapedCharactersMap111001Builder(Map instance)
    Creates a builder that contains the passed instance | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| [RequiredWithEscapedCharactersMap011001Builder](#requiredwithescapedcharactersmap011001builder) | fooReverseSolidusTbar(value: Nothing?) | +| [RequiredWithEscapedCharactersMap011001Builder](#requiredwithescapedcharactersmap011001builder) | fooReverseSolidusTbar(value: Boolean) | +| [RequiredWithEscapedCharactersMap011001Builder](#requiredwithescapedcharactersmap011001builder) | fooReverseSolidusTbar(value: String) | +| [RequiredWithEscapedCharactersMap011001Builder](#requiredwithescapedcharactersmap011001builder) | fooReverseSolidusTbar(value: Int) | +| [RequiredWithEscapedCharactersMap011001Builder](#requiredwithescapedcharactersmap011001builder) | fooReverseSolidusTbar(value: Float) | +| [RequiredWithEscapedCharactersMap011001Builder](#requiredwithescapedcharactersmap011001builder) | fooReverseSolidusTbar(value: Long) | +| [RequiredWithEscapedCharactersMap011001Builder](#requiredwithescapedcharactersmap011001builder) | fooReverseSolidusTbar(value: Double) | +| [RequiredWithEscapedCharactersMap011001Builder](#requiredwithescapedcharactersmap011001builder) | fooReverseSolidusTbar(value: List) | +| [RequiredWithEscapedCharactersMap011001Builder](#requiredwithescapedcharactersmap011001builder) | fooReverseSolidusTbar(value: Map) | +| [RequiredWithEscapedCharactersMap101001Builder](#requiredwithescapedcharactersmap101001builder) | fooReverseSolidusNbar(value: Nothing?) | +| [RequiredWithEscapedCharactersMap101001Builder](#requiredwithescapedcharactersmap101001builder) | fooReverseSolidusNbar(value: Boolean) | +| [RequiredWithEscapedCharactersMap101001Builder](#requiredwithescapedcharactersmap101001builder) | fooReverseSolidusNbar(value: String) | +| [RequiredWithEscapedCharactersMap101001Builder](#requiredwithescapedcharactersmap101001builder) | fooReverseSolidusNbar(value: Int) | +| [RequiredWithEscapedCharactersMap101001Builder](#requiredwithescapedcharactersmap101001builder) | fooReverseSolidusNbar(value: Float) | +| [RequiredWithEscapedCharactersMap101001Builder](#requiredwithescapedcharactersmap101001builder) | fooReverseSolidusNbar(value: Long) | +| [RequiredWithEscapedCharactersMap101001Builder](#requiredwithescapedcharactersmap101001builder) | fooReverseSolidusNbar(value: Double) | +| [RequiredWithEscapedCharactersMap101001Builder](#requiredwithescapedcharactersmap101001builder) | fooReverseSolidusNbar(value: List) | +| [RequiredWithEscapedCharactersMap101001Builder](#requiredwithescapedcharactersmap101001builder) | fooReverseSolidusNbar(value: Map) | +| [RequiredWithEscapedCharactersMap110001Builder](#requiredwithescapedcharactersmap110001builder) | fooReverseSolidusU000cbar(value: Nothing?) | +| [RequiredWithEscapedCharactersMap110001Builder](#requiredwithescapedcharactersmap110001builder) | fooReverseSolidusU000cbar(value: Boolean) | +| [RequiredWithEscapedCharactersMap110001Builder](#requiredwithescapedcharactersmap110001builder) | fooReverseSolidusU000cbar(value: String) | +| [RequiredWithEscapedCharactersMap110001Builder](#requiredwithescapedcharactersmap110001builder) | fooReverseSolidusU000cbar(value: Int) | +| [RequiredWithEscapedCharactersMap110001Builder](#requiredwithescapedcharactersmap110001builder) | fooReverseSolidusU000cbar(value: Float) | +| [RequiredWithEscapedCharactersMap110001Builder](#requiredwithescapedcharactersmap110001builder) | fooReverseSolidusU000cbar(value: Long) | +| [RequiredWithEscapedCharactersMap110001Builder](#requiredwithescapedcharactersmap110001builder) | fooReverseSolidusU000cbar(value: Double) | +| [RequiredWithEscapedCharactersMap110001Builder](#requiredwithescapedcharactersmap110001builder) | fooReverseSolidusU000cbar(value: List) | +| [RequiredWithEscapedCharactersMap110001Builder](#requiredwithescapedcharactersmap110001builder) | fooReverseSolidusU000cbar(value: Map) | +| [RequiredWithEscapedCharactersMap111000Builder](#requiredwithescapedcharactersmap111000builder) | fooReverseSolidusReverseSolidusBar(value: Nothing?) | +| [RequiredWithEscapedCharactersMap111000Builder](#requiredwithescapedcharactersmap111000builder) | fooReverseSolidusReverseSolidusBar(value: Boolean) | +| [RequiredWithEscapedCharactersMap111000Builder](#requiredwithescapedcharactersmap111000builder) | fooReverseSolidusReverseSolidusBar(value: String) | +| [RequiredWithEscapedCharactersMap111000Builder](#requiredwithescapedcharactersmap111000builder) | fooReverseSolidusReverseSolidusBar(value: Int) | +| [RequiredWithEscapedCharactersMap111000Builder](#requiredwithescapedcharactersmap111000builder) | fooReverseSolidusReverseSolidusBar(value: Float) | +| [RequiredWithEscapedCharactersMap111000Builder](#requiredwithescapedcharactersmap111000builder) | fooReverseSolidusReverseSolidusBar(value: Long) | +| [RequiredWithEscapedCharactersMap111000Builder](#requiredwithescapedcharactersmap111000builder) | fooReverseSolidusReverseSolidusBar(value: Double) | +| [RequiredWithEscapedCharactersMap111000Builder](#requiredwithescapedcharactersmap111000builder) | fooReverseSolidusReverseSolidusBar(value: List) | +| [RequiredWithEscapedCharactersMap111000Builder](#requiredwithescapedcharactersmap111000builder) | fooReverseSolidusReverseSolidusBar(value: Map) | + +## RequiredWithEscapedCharactersMap111010Builder +class RequiredWithEscapedCharactersMap111010Builder
    +builder for `Map` + +A class that builds the Map input type + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| RequiredWithEscapedCharactersMap111010Builder(Map instance)
    Creates a builder that contains the passed instance | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| [RequiredWithEscapedCharactersMap011010Builder](#requiredwithescapedcharactersmap011010builder) | fooReverseSolidusTbar(value: Nothing?) | +| [RequiredWithEscapedCharactersMap011010Builder](#requiredwithescapedcharactersmap011010builder) | fooReverseSolidusTbar(value: Boolean) | +| [RequiredWithEscapedCharactersMap011010Builder](#requiredwithescapedcharactersmap011010builder) | fooReverseSolidusTbar(value: String) | +| [RequiredWithEscapedCharactersMap011010Builder](#requiredwithescapedcharactersmap011010builder) | fooReverseSolidusTbar(value: Int) | +| [RequiredWithEscapedCharactersMap011010Builder](#requiredwithescapedcharactersmap011010builder) | fooReverseSolidusTbar(value: Float) | +| [RequiredWithEscapedCharactersMap011010Builder](#requiredwithescapedcharactersmap011010builder) | fooReverseSolidusTbar(value: Long) | +| [RequiredWithEscapedCharactersMap011010Builder](#requiredwithescapedcharactersmap011010builder) | fooReverseSolidusTbar(value: Double) | +| [RequiredWithEscapedCharactersMap011010Builder](#requiredwithescapedcharactersmap011010builder) | fooReverseSolidusTbar(value: List) | +| [RequiredWithEscapedCharactersMap011010Builder](#requiredwithescapedcharactersmap011010builder) | fooReverseSolidusTbar(value: Map) | +| [RequiredWithEscapedCharactersMap101010Builder](#requiredwithescapedcharactersmap101010builder) | fooReverseSolidusNbar(value: Nothing?) | +| [RequiredWithEscapedCharactersMap101010Builder](#requiredwithescapedcharactersmap101010builder) | fooReverseSolidusNbar(value: Boolean) | +| [RequiredWithEscapedCharactersMap101010Builder](#requiredwithescapedcharactersmap101010builder) | fooReverseSolidusNbar(value: String) | +| [RequiredWithEscapedCharactersMap101010Builder](#requiredwithescapedcharactersmap101010builder) | fooReverseSolidusNbar(value: Int) | +| [RequiredWithEscapedCharactersMap101010Builder](#requiredwithescapedcharactersmap101010builder) | fooReverseSolidusNbar(value: Float) | +| [RequiredWithEscapedCharactersMap101010Builder](#requiredwithescapedcharactersmap101010builder) | fooReverseSolidusNbar(value: Long) | +| [RequiredWithEscapedCharactersMap101010Builder](#requiredwithescapedcharactersmap101010builder) | fooReverseSolidusNbar(value: Double) | +| [RequiredWithEscapedCharactersMap101010Builder](#requiredwithescapedcharactersmap101010builder) | fooReverseSolidusNbar(value: List) | +| [RequiredWithEscapedCharactersMap101010Builder](#requiredwithescapedcharactersmap101010builder) | fooReverseSolidusNbar(value: Map) | +| [RequiredWithEscapedCharactersMap110010Builder](#requiredwithescapedcharactersmap110010builder) | fooReverseSolidusU000cbar(value: Nothing?) | +| [RequiredWithEscapedCharactersMap110010Builder](#requiredwithescapedcharactersmap110010builder) | fooReverseSolidusU000cbar(value: Boolean) | +| [RequiredWithEscapedCharactersMap110010Builder](#requiredwithescapedcharactersmap110010builder) | fooReverseSolidusU000cbar(value: String) | +| [RequiredWithEscapedCharactersMap110010Builder](#requiredwithescapedcharactersmap110010builder) | fooReverseSolidusU000cbar(value: Int) | +| [RequiredWithEscapedCharactersMap110010Builder](#requiredwithescapedcharactersmap110010builder) | fooReverseSolidusU000cbar(value: Float) | +| [RequiredWithEscapedCharactersMap110010Builder](#requiredwithescapedcharactersmap110010builder) | fooReverseSolidusU000cbar(value: Long) | +| [RequiredWithEscapedCharactersMap110010Builder](#requiredwithescapedcharactersmap110010builder) | fooReverseSolidusU000cbar(value: Double) | +| [RequiredWithEscapedCharactersMap110010Builder](#requiredwithescapedcharactersmap110010builder) | fooReverseSolidusU000cbar(value: List) | +| [RequiredWithEscapedCharactersMap110010Builder](#requiredwithescapedcharactersmap110010builder) | fooReverseSolidusU000cbar(value: Map) | +| [RequiredWithEscapedCharactersMap111000Builder](#requiredwithescapedcharactersmap111000builder) | fooReverseSolidusQuotationMarkBar(value: Nothing?) | +| [RequiredWithEscapedCharactersMap111000Builder](#requiredwithescapedcharactersmap111000builder) | fooReverseSolidusQuotationMarkBar(value: Boolean) | +| [RequiredWithEscapedCharactersMap111000Builder](#requiredwithescapedcharactersmap111000builder) | fooReverseSolidusQuotationMarkBar(value: String) | +| [RequiredWithEscapedCharactersMap111000Builder](#requiredwithescapedcharactersmap111000builder) | fooReverseSolidusQuotationMarkBar(value: Int) | +| [RequiredWithEscapedCharactersMap111000Builder](#requiredwithescapedcharactersmap111000builder) | fooReverseSolidusQuotationMarkBar(value: Float) | +| [RequiredWithEscapedCharactersMap111000Builder](#requiredwithescapedcharactersmap111000builder) | fooReverseSolidusQuotationMarkBar(value: Long) | +| [RequiredWithEscapedCharactersMap111000Builder](#requiredwithescapedcharactersmap111000builder) | fooReverseSolidusQuotationMarkBar(value: Double) | +| [RequiredWithEscapedCharactersMap111000Builder](#requiredwithescapedcharactersmap111000builder) | fooReverseSolidusQuotationMarkBar(value: List) | +| [RequiredWithEscapedCharactersMap111000Builder](#requiredwithescapedcharactersmap111000builder) | fooReverseSolidusQuotationMarkBar(value: Map) | + +## RequiredWithEscapedCharactersMap111011Builder +class RequiredWithEscapedCharactersMap111011Builder
    +builder for `Map` + +A class that builds the Map input type + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| RequiredWithEscapedCharactersMap111011Builder(Map instance)
    Creates a builder that contains the passed instance | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| [RequiredWithEscapedCharactersMap011011Builder](#requiredwithescapedcharactersmap011011builder) | fooReverseSolidusTbar(value: Nothing?) | +| [RequiredWithEscapedCharactersMap011011Builder](#requiredwithescapedcharactersmap011011builder) | fooReverseSolidusTbar(value: Boolean) | +| [RequiredWithEscapedCharactersMap011011Builder](#requiredwithescapedcharactersmap011011builder) | fooReverseSolidusTbar(value: String) | +| [RequiredWithEscapedCharactersMap011011Builder](#requiredwithescapedcharactersmap011011builder) | fooReverseSolidusTbar(value: Int) | +| [RequiredWithEscapedCharactersMap011011Builder](#requiredwithescapedcharactersmap011011builder) | fooReverseSolidusTbar(value: Float) | +| [RequiredWithEscapedCharactersMap011011Builder](#requiredwithescapedcharactersmap011011builder) | fooReverseSolidusTbar(value: Long) | +| [RequiredWithEscapedCharactersMap011011Builder](#requiredwithescapedcharactersmap011011builder) | fooReverseSolidusTbar(value: Double) | +| [RequiredWithEscapedCharactersMap011011Builder](#requiredwithescapedcharactersmap011011builder) | fooReverseSolidusTbar(value: List) | +| [RequiredWithEscapedCharactersMap011011Builder](#requiredwithescapedcharactersmap011011builder) | fooReverseSolidusTbar(value: Map) | +| [RequiredWithEscapedCharactersMap101011Builder](#requiredwithescapedcharactersmap101011builder) | fooReverseSolidusNbar(value: Nothing?) | +| [RequiredWithEscapedCharactersMap101011Builder](#requiredwithescapedcharactersmap101011builder) | fooReverseSolidusNbar(value: Boolean) | +| [RequiredWithEscapedCharactersMap101011Builder](#requiredwithescapedcharactersmap101011builder) | fooReverseSolidusNbar(value: String) | +| [RequiredWithEscapedCharactersMap101011Builder](#requiredwithescapedcharactersmap101011builder) | fooReverseSolidusNbar(value: Int) | +| [RequiredWithEscapedCharactersMap101011Builder](#requiredwithescapedcharactersmap101011builder) | fooReverseSolidusNbar(value: Float) | +| [RequiredWithEscapedCharactersMap101011Builder](#requiredwithescapedcharactersmap101011builder) | fooReverseSolidusNbar(value: Long) | +| [RequiredWithEscapedCharactersMap101011Builder](#requiredwithescapedcharactersmap101011builder) | fooReverseSolidusNbar(value: Double) | +| [RequiredWithEscapedCharactersMap101011Builder](#requiredwithescapedcharactersmap101011builder) | fooReverseSolidusNbar(value: List) | +| [RequiredWithEscapedCharactersMap101011Builder](#requiredwithescapedcharactersmap101011builder) | fooReverseSolidusNbar(value: Map) | +| [RequiredWithEscapedCharactersMap110011Builder](#requiredwithescapedcharactersmap110011builder) | fooReverseSolidusU000cbar(value: Nothing?) | +| [RequiredWithEscapedCharactersMap110011Builder](#requiredwithescapedcharactersmap110011builder) | fooReverseSolidusU000cbar(value: Boolean) | +| [RequiredWithEscapedCharactersMap110011Builder](#requiredwithescapedcharactersmap110011builder) | fooReverseSolidusU000cbar(value: String) | +| [RequiredWithEscapedCharactersMap110011Builder](#requiredwithescapedcharactersmap110011builder) | fooReverseSolidusU000cbar(value: Int) | +| [RequiredWithEscapedCharactersMap110011Builder](#requiredwithescapedcharactersmap110011builder) | fooReverseSolidusU000cbar(value: Float) | +| [RequiredWithEscapedCharactersMap110011Builder](#requiredwithescapedcharactersmap110011builder) | fooReverseSolidusU000cbar(value: Long) | +| [RequiredWithEscapedCharactersMap110011Builder](#requiredwithescapedcharactersmap110011builder) | fooReverseSolidusU000cbar(value: Double) | +| [RequiredWithEscapedCharactersMap110011Builder](#requiredwithescapedcharactersmap110011builder) | fooReverseSolidusU000cbar(value: List) | +| [RequiredWithEscapedCharactersMap110011Builder](#requiredwithescapedcharactersmap110011builder) | fooReverseSolidusU000cbar(value: Map) | +| [RequiredWithEscapedCharactersMap111001Builder](#requiredwithescapedcharactersmap111001builder) | fooReverseSolidusQuotationMarkBar(value: Nothing?) | +| [RequiredWithEscapedCharactersMap111001Builder](#requiredwithescapedcharactersmap111001builder) | fooReverseSolidusQuotationMarkBar(value: Boolean) | +| [RequiredWithEscapedCharactersMap111001Builder](#requiredwithescapedcharactersmap111001builder) | fooReverseSolidusQuotationMarkBar(value: String) | +| [RequiredWithEscapedCharactersMap111001Builder](#requiredwithescapedcharactersmap111001builder) | fooReverseSolidusQuotationMarkBar(value: Int) | +| [RequiredWithEscapedCharactersMap111001Builder](#requiredwithescapedcharactersmap111001builder) | fooReverseSolidusQuotationMarkBar(value: Float) | +| [RequiredWithEscapedCharactersMap111001Builder](#requiredwithescapedcharactersmap111001builder) | fooReverseSolidusQuotationMarkBar(value: Long) | +| [RequiredWithEscapedCharactersMap111001Builder](#requiredwithescapedcharactersmap111001builder) | fooReverseSolidusQuotationMarkBar(value: Double) | +| [RequiredWithEscapedCharactersMap111001Builder](#requiredwithescapedcharactersmap111001builder) | fooReverseSolidusQuotationMarkBar(value: List) | +| [RequiredWithEscapedCharactersMap111001Builder](#requiredwithescapedcharactersmap111001builder) | fooReverseSolidusQuotationMarkBar(value: Map) | +| [RequiredWithEscapedCharactersMap111010Builder](#requiredwithescapedcharactersmap111010builder) | fooReverseSolidusReverseSolidusBar(value: Nothing?) | +| [RequiredWithEscapedCharactersMap111010Builder](#requiredwithescapedcharactersmap111010builder) | fooReverseSolidusReverseSolidusBar(value: Boolean) | +| [RequiredWithEscapedCharactersMap111010Builder](#requiredwithescapedcharactersmap111010builder) | fooReverseSolidusReverseSolidusBar(value: String) | +| [RequiredWithEscapedCharactersMap111010Builder](#requiredwithescapedcharactersmap111010builder) | fooReverseSolidusReverseSolidusBar(value: Int) | +| [RequiredWithEscapedCharactersMap111010Builder](#requiredwithescapedcharactersmap111010builder) | fooReverseSolidusReverseSolidusBar(value: Float) | +| [RequiredWithEscapedCharactersMap111010Builder](#requiredwithescapedcharactersmap111010builder) | fooReverseSolidusReverseSolidusBar(value: Long) | +| [RequiredWithEscapedCharactersMap111010Builder](#requiredwithescapedcharactersmap111010builder) | fooReverseSolidusReverseSolidusBar(value: Double) | +| [RequiredWithEscapedCharactersMap111010Builder](#requiredwithescapedcharactersmap111010builder) | fooReverseSolidusReverseSolidusBar(value: List) | +| [RequiredWithEscapedCharactersMap111010Builder](#requiredwithescapedcharactersmap111010builder) | fooReverseSolidusReverseSolidusBar(value: Map) | + +## RequiredWithEscapedCharactersMap111100Builder +class RequiredWithEscapedCharactersMap111100Builder
    +builder for `Map` + +A class that builds the Map input type + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| RequiredWithEscapedCharactersMap111100Builder(Map instance)
    Creates a builder that contains the passed instance | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| [RequiredWithEscapedCharactersMap011100Builder](#requiredwithescapedcharactersmap011100builder) | fooReverseSolidusTbar(value: Nothing?) | +| [RequiredWithEscapedCharactersMap011100Builder](#requiredwithescapedcharactersmap011100builder) | fooReverseSolidusTbar(value: Boolean) | +| [RequiredWithEscapedCharactersMap011100Builder](#requiredwithescapedcharactersmap011100builder) | fooReverseSolidusTbar(value: String) | +| [RequiredWithEscapedCharactersMap011100Builder](#requiredwithescapedcharactersmap011100builder) | fooReverseSolidusTbar(value: Int) | +| [RequiredWithEscapedCharactersMap011100Builder](#requiredwithescapedcharactersmap011100builder) | fooReverseSolidusTbar(value: Float) | +| [RequiredWithEscapedCharactersMap011100Builder](#requiredwithescapedcharactersmap011100builder) | fooReverseSolidusTbar(value: Long) | +| [RequiredWithEscapedCharactersMap011100Builder](#requiredwithescapedcharactersmap011100builder) | fooReverseSolidusTbar(value: Double) | +| [RequiredWithEscapedCharactersMap011100Builder](#requiredwithescapedcharactersmap011100builder) | fooReverseSolidusTbar(value: List) | +| [RequiredWithEscapedCharactersMap011100Builder](#requiredwithescapedcharactersmap011100builder) | fooReverseSolidusTbar(value: Map) | +| [RequiredWithEscapedCharactersMap101100Builder](#requiredwithescapedcharactersmap101100builder) | fooReverseSolidusNbar(value: Nothing?) | +| [RequiredWithEscapedCharactersMap101100Builder](#requiredwithescapedcharactersmap101100builder) | fooReverseSolidusNbar(value: Boolean) | +| [RequiredWithEscapedCharactersMap101100Builder](#requiredwithescapedcharactersmap101100builder) | fooReverseSolidusNbar(value: String) | +| [RequiredWithEscapedCharactersMap101100Builder](#requiredwithescapedcharactersmap101100builder) | fooReverseSolidusNbar(value: Int) | +| [RequiredWithEscapedCharactersMap101100Builder](#requiredwithescapedcharactersmap101100builder) | fooReverseSolidusNbar(value: Float) | +| [RequiredWithEscapedCharactersMap101100Builder](#requiredwithescapedcharactersmap101100builder) | fooReverseSolidusNbar(value: Long) | +| [RequiredWithEscapedCharactersMap101100Builder](#requiredwithescapedcharactersmap101100builder) | fooReverseSolidusNbar(value: Double) | +| [RequiredWithEscapedCharactersMap101100Builder](#requiredwithescapedcharactersmap101100builder) | fooReverseSolidusNbar(value: List) | +| [RequiredWithEscapedCharactersMap101100Builder](#requiredwithescapedcharactersmap101100builder) | fooReverseSolidusNbar(value: Map) | +| [RequiredWithEscapedCharactersMap110100Builder](#requiredwithescapedcharactersmap110100builder) | fooReverseSolidusU000cbar(value: Nothing?) | +| [RequiredWithEscapedCharactersMap110100Builder](#requiredwithescapedcharactersmap110100builder) | fooReverseSolidusU000cbar(value: Boolean) | +| [RequiredWithEscapedCharactersMap110100Builder](#requiredwithescapedcharactersmap110100builder) | fooReverseSolidusU000cbar(value: String) | +| [RequiredWithEscapedCharactersMap110100Builder](#requiredwithescapedcharactersmap110100builder) | fooReverseSolidusU000cbar(value: Int) | +| [RequiredWithEscapedCharactersMap110100Builder](#requiredwithescapedcharactersmap110100builder) | fooReverseSolidusU000cbar(value: Float) | +| [RequiredWithEscapedCharactersMap110100Builder](#requiredwithescapedcharactersmap110100builder) | fooReverseSolidusU000cbar(value: Long) | +| [RequiredWithEscapedCharactersMap110100Builder](#requiredwithescapedcharactersmap110100builder) | fooReverseSolidusU000cbar(value: Double) | +| [RequiredWithEscapedCharactersMap110100Builder](#requiredwithescapedcharactersmap110100builder) | fooReverseSolidusU000cbar(value: List) | +| [RequiredWithEscapedCharactersMap110100Builder](#requiredwithescapedcharactersmap110100builder) | fooReverseSolidusU000cbar(value: Map) | +| [RequiredWithEscapedCharactersMap111000Builder](#requiredwithescapedcharactersmap111000builder) | fooReverseSolidusRbar(value: Nothing?) | +| [RequiredWithEscapedCharactersMap111000Builder](#requiredwithescapedcharactersmap111000builder) | fooReverseSolidusRbar(value: Boolean) | +| [RequiredWithEscapedCharactersMap111000Builder](#requiredwithescapedcharactersmap111000builder) | fooReverseSolidusRbar(value: String) | +| [RequiredWithEscapedCharactersMap111000Builder](#requiredwithescapedcharactersmap111000builder) | fooReverseSolidusRbar(value: Int) | +| [RequiredWithEscapedCharactersMap111000Builder](#requiredwithescapedcharactersmap111000builder) | fooReverseSolidusRbar(value: Float) | +| [RequiredWithEscapedCharactersMap111000Builder](#requiredwithescapedcharactersmap111000builder) | fooReverseSolidusRbar(value: Long) | +| [RequiredWithEscapedCharactersMap111000Builder](#requiredwithescapedcharactersmap111000builder) | fooReverseSolidusRbar(value: Double) | +| [RequiredWithEscapedCharactersMap111000Builder](#requiredwithescapedcharactersmap111000builder) | fooReverseSolidusRbar(value: List) | +| [RequiredWithEscapedCharactersMap111000Builder](#requiredwithescapedcharactersmap111000builder) | fooReverseSolidusRbar(value: Map) | + +## RequiredWithEscapedCharactersMap111101Builder +class RequiredWithEscapedCharactersMap111101Builder
    +builder for `Map` + +A class that builds the Map input type + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| RequiredWithEscapedCharactersMap111101Builder(Map instance)
    Creates a builder that contains the passed instance | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| [RequiredWithEscapedCharactersMap011101Builder](#requiredwithescapedcharactersmap011101builder) | fooReverseSolidusTbar(value: Nothing?) | +| [RequiredWithEscapedCharactersMap011101Builder](#requiredwithescapedcharactersmap011101builder) | fooReverseSolidusTbar(value: Boolean) | +| [RequiredWithEscapedCharactersMap011101Builder](#requiredwithescapedcharactersmap011101builder) | fooReverseSolidusTbar(value: String) | +| [RequiredWithEscapedCharactersMap011101Builder](#requiredwithescapedcharactersmap011101builder) | fooReverseSolidusTbar(value: Int) | +| [RequiredWithEscapedCharactersMap011101Builder](#requiredwithescapedcharactersmap011101builder) | fooReverseSolidusTbar(value: Float) | +| [RequiredWithEscapedCharactersMap011101Builder](#requiredwithescapedcharactersmap011101builder) | fooReverseSolidusTbar(value: Long) | +| [RequiredWithEscapedCharactersMap011101Builder](#requiredwithescapedcharactersmap011101builder) | fooReverseSolidusTbar(value: Double) | +| [RequiredWithEscapedCharactersMap011101Builder](#requiredwithescapedcharactersmap011101builder) | fooReverseSolidusTbar(value: List) | +| [RequiredWithEscapedCharactersMap011101Builder](#requiredwithescapedcharactersmap011101builder) | fooReverseSolidusTbar(value: Map) | +| [RequiredWithEscapedCharactersMap101101Builder](#requiredwithescapedcharactersmap101101builder) | fooReverseSolidusNbar(value: Nothing?) | +| [RequiredWithEscapedCharactersMap101101Builder](#requiredwithescapedcharactersmap101101builder) | fooReverseSolidusNbar(value: Boolean) | +| [RequiredWithEscapedCharactersMap101101Builder](#requiredwithescapedcharactersmap101101builder) | fooReverseSolidusNbar(value: String) | +| [RequiredWithEscapedCharactersMap101101Builder](#requiredwithescapedcharactersmap101101builder) | fooReverseSolidusNbar(value: Int) | +| [RequiredWithEscapedCharactersMap101101Builder](#requiredwithescapedcharactersmap101101builder) | fooReverseSolidusNbar(value: Float) | +| [RequiredWithEscapedCharactersMap101101Builder](#requiredwithescapedcharactersmap101101builder) | fooReverseSolidusNbar(value: Long) | +| [RequiredWithEscapedCharactersMap101101Builder](#requiredwithescapedcharactersmap101101builder) | fooReverseSolidusNbar(value: Double) | +| [RequiredWithEscapedCharactersMap101101Builder](#requiredwithescapedcharactersmap101101builder) | fooReverseSolidusNbar(value: List) | +| [RequiredWithEscapedCharactersMap101101Builder](#requiredwithescapedcharactersmap101101builder) | fooReverseSolidusNbar(value: Map) | +| [RequiredWithEscapedCharactersMap110101Builder](#requiredwithescapedcharactersmap110101builder) | fooReverseSolidusU000cbar(value: Nothing?) | +| [RequiredWithEscapedCharactersMap110101Builder](#requiredwithescapedcharactersmap110101builder) | fooReverseSolidusU000cbar(value: Boolean) | +| [RequiredWithEscapedCharactersMap110101Builder](#requiredwithescapedcharactersmap110101builder) | fooReverseSolidusU000cbar(value: String) | +| [RequiredWithEscapedCharactersMap110101Builder](#requiredwithescapedcharactersmap110101builder) | fooReverseSolidusU000cbar(value: Int) | +| [RequiredWithEscapedCharactersMap110101Builder](#requiredwithescapedcharactersmap110101builder) | fooReverseSolidusU000cbar(value: Float) | +| [RequiredWithEscapedCharactersMap110101Builder](#requiredwithescapedcharactersmap110101builder) | fooReverseSolidusU000cbar(value: Long) | +| [RequiredWithEscapedCharactersMap110101Builder](#requiredwithescapedcharactersmap110101builder) | fooReverseSolidusU000cbar(value: Double) | +| [RequiredWithEscapedCharactersMap110101Builder](#requiredwithescapedcharactersmap110101builder) | fooReverseSolidusU000cbar(value: List) | +| [RequiredWithEscapedCharactersMap110101Builder](#requiredwithescapedcharactersmap110101builder) | fooReverseSolidusU000cbar(value: Map) | +| [RequiredWithEscapedCharactersMap111001Builder](#requiredwithescapedcharactersmap111001builder) | fooReverseSolidusRbar(value: Nothing?) | +| [RequiredWithEscapedCharactersMap111001Builder](#requiredwithescapedcharactersmap111001builder) | fooReverseSolidusRbar(value: Boolean) | +| [RequiredWithEscapedCharactersMap111001Builder](#requiredwithescapedcharactersmap111001builder) | fooReverseSolidusRbar(value: String) | +| [RequiredWithEscapedCharactersMap111001Builder](#requiredwithescapedcharactersmap111001builder) | fooReverseSolidusRbar(value: Int) | +| [RequiredWithEscapedCharactersMap111001Builder](#requiredwithescapedcharactersmap111001builder) | fooReverseSolidusRbar(value: Float) | +| [RequiredWithEscapedCharactersMap111001Builder](#requiredwithescapedcharactersmap111001builder) | fooReverseSolidusRbar(value: Long) | +| [RequiredWithEscapedCharactersMap111001Builder](#requiredwithescapedcharactersmap111001builder) | fooReverseSolidusRbar(value: Double) | +| [RequiredWithEscapedCharactersMap111001Builder](#requiredwithescapedcharactersmap111001builder) | fooReverseSolidusRbar(value: List) | +| [RequiredWithEscapedCharactersMap111001Builder](#requiredwithescapedcharactersmap111001builder) | fooReverseSolidusRbar(value: Map) | +| [RequiredWithEscapedCharactersMap111100Builder](#requiredwithescapedcharactersmap111100builder) | fooReverseSolidusReverseSolidusBar(value: Nothing?) | +| [RequiredWithEscapedCharactersMap111100Builder](#requiredwithescapedcharactersmap111100builder) | fooReverseSolidusReverseSolidusBar(value: Boolean) | +| [RequiredWithEscapedCharactersMap111100Builder](#requiredwithescapedcharactersmap111100builder) | fooReverseSolidusReverseSolidusBar(value: String) | +| [RequiredWithEscapedCharactersMap111100Builder](#requiredwithescapedcharactersmap111100builder) | fooReverseSolidusReverseSolidusBar(value: Int) | +| [RequiredWithEscapedCharactersMap111100Builder](#requiredwithescapedcharactersmap111100builder) | fooReverseSolidusReverseSolidusBar(value: Float) | +| [RequiredWithEscapedCharactersMap111100Builder](#requiredwithescapedcharactersmap111100builder) | fooReverseSolidusReverseSolidusBar(value: Long) | +| [RequiredWithEscapedCharactersMap111100Builder](#requiredwithescapedcharactersmap111100builder) | fooReverseSolidusReverseSolidusBar(value: Double) | +| [RequiredWithEscapedCharactersMap111100Builder](#requiredwithescapedcharactersmap111100builder) | fooReverseSolidusReverseSolidusBar(value: List) | +| [RequiredWithEscapedCharactersMap111100Builder](#requiredwithescapedcharactersmap111100builder) | fooReverseSolidusReverseSolidusBar(value: Map) | + +## RequiredWithEscapedCharactersMap111110Builder +class RequiredWithEscapedCharactersMap111110Builder
    +builder for `Map` + +A class that builds the Map input type + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| RequiredWithEscapedCharactersMap111110Builder(Map instance)
    Creates a builder that contains the passed instance | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| [RequiredWithEscapedCharactersMap011110Builder](#requiredwithescapedcharactersmap011110builder) | fooReverseSolidusTbar(value: Nothing?) | +| [RequiredWithEscapedCharactersMap011110Builder](#requiredwithescapedcharactersmap011110builder) | fooReverseSolidusTbar(value: Boolean) | +| [RequiredWithEscapedCharactersMap011110Builder](#requiredwithescapedcharactersmap011110builder) | fooReverseSolidusTbar(value: String) | +| [RequiredWithEscapedCharactersMap011110Builder](#requiredwithescapedcharactersmap011110builder) | fooReverseSolidusTbar(value: Int) | +| [RequiredWithEscapedCharactersMap011110Builder](#requiredwithescapedcharactersmap011110builder) | fooReverseSolidusTbar(value: Float) | +| [RequiredWithEscapedCharactersMap011110Builder](#requiredwithescapedcharactersmap011110builder) | fooReverseSolidusTbar(value: Long) | +| [RequiredWithEscapedCharactersMap011110Builder](#requiredwithescapedcharactersmap011110builder) | fooReverseSolidusTbar(value: Double) | +| [RequiredWithEscapedCharactersMap011110Builder](#requiredwithescapedcharactersmap011110builder) | fooReverseSolidusTbar(value: List) | +| [RequiredWithEscapedCharactersMap011110Builder](#requiredwithescapedcharactersmap011110builder) | fooReverseSolidusTbar(value: Map) | +| [RequiredWithEscapedCharactersMap101110Builder](#requiredwithescapedcharactersmap101110builder) | fooReverseSolidusNbar(value: Nothing?) | +| [RequiredWithEscapedCharactersMap101110Builder](#requiredwithescapedcharactersmap101110builder) | fooReverseSolidusNbar(value: Boolean) | +| [RequiredWithEscapedCharactersMap101110Builder](#requiredwithescapedcharactersmap101110builder) | fooReverseSolidusNbar(value: String) | +| [RequiredWithEscapedCharactersMap101110Builder](#requiredwithescapedcharactersmap101110builder) | fooReverseSolidusNbar(value: Int) | +| [RequiredWithEscapedCharactersMap101110Builder](#requiredwithescapedcharactersmap101110builder) | fooReverseSolidusNbar(value: Float) | +| [RequiredWithEscapedCharactersMap101110Builder](#requiredwithescapedcharactersmap101110builder) | fooReverseSolidusNbar(value: Long) | +| [RequiredWithEscapedCharactersMap101110Builder](#requiredwithescapedcharactersmap101110builder) | fooReverseSolidusNbar(value: Double) | +| [RequiredWithEscapedCharactersMap101110Builder](#requiredwithescapedcharactersmap101110builder) | fooReverseSolidusNbar(value: List) | +| [RequiredWithEscapedCharactersMap101110Builder](#requiredwithescapedcharactersmap101110builder) | fooReverseSolidusNbar(value: Map) | +| [RequiredWithEscapedCharactersMap110110Builder](#requiredwithescapedcharactersmap110110builder) | fooReverseSolidusU000cbar(value: Nothing?) | +| [RequiredWithEscapedCharactersMap110110Builder](#requiredwithescapedcharactersmap110110builder) | fooReverseSolidusU000cbar(value: Boolean) | +| [RequiredWithEscapedCharactersMap110110Builder](#requiredwithescapedcharactersmap110110builder) | fooReverseSolidusU000cbar(value: String) | +| [RequiredWithEscapedCharactersMap110110Builder](#requiredwithescapedcharactersmap110110builder) | fooReverseSolidusU000cbar(value: Int) | +| [RequiredWithEscapedCharactersMap110110Builder](#requiredwithescapedcharactersmap110110builder) | fooReverseSolidusU000cbar(value: Float) | +| [RequiredWithEscapedCharactersMap110110Builder](#requiredwithescapedcharactersmap110110builder) | fooReverseSolidusU000cbar(value: Long) | +| [RequiredWithEscapedCharactersMap110110Builder](#requiredwithescapedcharactersmap110110builder) | fooReverseSolidusU000cbar(value: Double) | +| [RequiredWithEscapedCharactersMap110110Builder](#requiredwithescapedcharactersmap110110builder) | fooReverseSolidusU000cbar(value: List) | +| [RequiredWithEscapedCharactersMap110110Builder](#requiredwithescapedcharactersmap110110builder) | fooReverseSolidusU000cbar(value: Map) | +| [RequiredWithEscapedCharactersMap111010Builder](#requiredwithescapedcharactersmap111010builder) | fooReverseSolidusRbar(value: Nothing?) | +| [RequiredWithEscapedCharactersMap111010Builder](#requiredwithescapedcharactersmap111010builder) | fooReverseSolidusRbar(value: Boolean) | +| [RequiredWithEscapedCharactersMap111010Builder](#requiredwithescapedcharactersmap111010builder) | fooReverseSolidusRbar(value: String) | +| [RequiredWithEscapedCharactersMap111010Builder](#requiredwithescapedcharactersmap111010builder) | fooReverseSolidusRbar(value: Int) | +| [RequiredWithEscapedCharactersMap111010Builder](#requiredwithescapedcharactersmap111010builder) | fooReverseSolidusRbar(value: Float) | +| [RequiredWithEscapedCharactersMap111010Builder](#requiredwithescapedcharactersmap111010builder) | fooReverseSolidusRbar(value: Long) | +| [RequiredWithEscapedCharactersMap111010Builder](#requiredwithescapedcharactersmap111010builder) | fooReverseSolidusRbar(value: Double) | +| [RequiredWithEscapedCharactersMap111010Builder](#requiredwithescapedcharactersmap111010builder) | fooReverseSolidusRbar(value: List) | +| [RequiredWithEscapedCharactersMap111010Builder](#requiredwithescapedcharactersmap111010builder) | fooReverseSolidusRbar(value: Map) | +| [RequiredWithEscapedCharactersMap111100Builder](#requiredwithescapedcharactersmap111100builder) | fooReverseSolidusQuotationMarkBar(value: Nothing?) | +| [RequiredWithEscapedCharactersMap111100Builder](#requiredwithescapedcharactersmap111100builder) | fooReverseSolidusQuotationMarkBar(value: Boolean) | +| [RequiredWithEscapedCharactersMap111100Builder](#requiredwithescapedcharactersmap111100builder) | fooReverseSolidusQuotationMarkBar(value: String) | +| [RequiredWithEscapedCharactersMap111100Builder](#requiredwithescapedcharactersmap111100builder) | fooReverseSolidusQuotationMarkBar(value: Int) | +| [RequiredWithEscapedCharactersMap111100Builder](#requiredwithescapedcharactersmap111100builder) | fooReverseSolidusQuotationMarkBar(value: Float) | +| [RequiredWithEscapedCharactersMap111100Builder](#requiredwithescapedcharactersmap111100builder) | fooReverseSolidusQuotationMarkBar(value: Long) | +| [RequiredWithEscapedCharactersMap111100Builder](#requiredwithescapedcharactersmap111100builder) | fooReverseSolidusQuotationMarkBar(value: Double) | +| [RequiredWithEscapedCharactersMap111100Builder](#requiredwithescapedcharactersmap111100builder) | fooReverseSolidusQuotationMarkBar(value: List) | +| [RequiredWithEscapedCharactersMap111100Builder](#requiredwithescapedcharactersmap111100builder) | fooReverseSolidusQuotationMarkBar(value: Map) | + +## RequiredWithEscapedCharactersMapBuilder +class RequiredWithEscapedCharactersMapBuilder
    +builder for `Map` + +A class that builds the Map input type + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| RequiredWithEscapedCharactersMapBuilder()
    Creates a builder that contains an empty map | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| [RequiredWithEscapedCharactersMap011111Builder](#requiredwithescapedcharactersmap011111builder) | fooReverseSolidusTbar(value: Nothing?) | +| [RequiredWithEscapedCharactersMap011111Builder](#requiredwithescapedcharactersmap011111builder) | fooReverseSolidusTbar(value: Boolean) | +| [RequiredWithEscapedCharactersMap011111Builder](#requiredwithescapedcharactersmap011111builder) | fooReverseSolidusTbar(value: String) | +| [RequiredWithEscapedCharactersMap011111Builder](#requiredwithescapedcharactersmap011111builder) | fooReverseSolidusTbar(value: Int) | +| [RequiredWithEscapedCharactersMap011111Builder](#requiredwithescapedcharactersmap011111builder) | fooReverseSolidusTbar(value: Float) | +| [RequiredWithEscapedCharactersMap011111Builder](#requiredwithescapedcharactersmap011111builder) | fooReverseSolidusTbar(value: Long) | +| [RequiredWithEscapedCharactersMap011111Builder](#requiredwithescapedcharactersmap011111builder) | fooReverseSolidusTbar(value: Double) | +| [RequiredWithEscapedCharactersMap011111Builder](#requiredwithescapedcharactersmap011111builder) | fooReverseSolidusTbar(value: List) | +| [RequiredWithEscapedCharactersMap011111Builder](#requiredwithescapedcharactersmap011111builder) | fooReverseSolidusTbar(value: Map) | +| [RequiredWithEscapedCharactersMap101111Builder](#requiredwithescapedcharactersmap101111builder) | fooReverseSolidusNbar(value: Nothing?) | +| [RequiredWithEscapedCharactersMap101111Builder](#requiredwithescapedcharactersmap101111builder) | fooReverseSolidusNbar(value: Boolean) | +| [RequiredWithEscapedCharactersMap101111Builder](#requiredwithescapedcharactersmap101111builder) | fooReverseSolidusNbar(value: String) | +| [RequiredWithEscapedCharactersMap101111Builder](#requiredwithescapedcharactersmap101111builder) | fooReverseSolidusNbar(value: Int) | +| [RequiredWithEscapedCharactersMap101111Builder](#requiredwithescapedcharactersmap101111builder) | fooReverseSolidusNbar(value: Float) | +| [RequiredWithEscapedCharactersMap101111Builder](#requiredwithescapedcharactersmap101111builder) | fooReverseSolidusNbar(value: Long) | +| [RequiredWithEscapedCharactersMap101111Builder](#requiredwithescapedcharactersmap101111builder) | fooReverseSolidusNbar(value: Double) | +| [RequiredWithEscapedCharactersMap101111Builder](#requiredwithescapedcharactersmap101111builder) | fooReverseSolidusNbar(value: List) | +| [RequiredWithEscapedCharactersMap101111Builder](#requiredwithescapedcharactersmap101111builder) | fooReverseSolidusNbar(value: Map) | +| [RequiredWithEscapedCharactersMap110111Builder](#requiredwithescapedcharactersmap110111builder) | fooReverseSolidusU000cbar(value: Nothing?) | +| [RequiredWithEscapedCharactersMap110111Builder](#requiredwithescapedcharactersmap110111builder) | fooReverseSolidusU000cbar(value: Boolean) | +| [RequiredWithEscapedCharactersMap110111Builder](#requiredwithescapedcharactersmap110111builder) | fooReverseSolidusU000cbar(value: String) | +| [RequiredWithEscapedCharactersMap110111Builder](#requiredwithescapedcharactersmap110111builder) | fooReverseSolidusU000cbar(value: Int) | +| [RequiredWithEscapedCharactersMap110111Builder](#requiredwithescapedcharactersmap110111builder) | fooReverseSolidusU000cbar(value: Float) | +| [RequiredWithEscapedCharactersMap110111Builder](#requiredwithescapedcharactersmap110111builder) | fooReverseSolidusU000cbar(value: Long) | +| [RequiredWithEscapedCharactersMap110111Builder](#requiredwithescapedcharactersmap110111builder) | fooReverseSolidusU000cbar(value: Double) | +| [RequiredWithEscapedCharactersMap110111Builder](#requiredwithescapedcharactersmap110111builder) | fooReverseSolidusU000cbar(value: List) | +| [RequiredWithEscapedCharactersMap110111Builder](#requiredwithescapedcharactersmap110111builder) | fooReverseSolidusU000cbar(value: Map) | +| [RequiredWithEscapedCharactersMap111011Builder](#requiredwithescapedcharactersmap111011builder) | fooReverseSolidusRbar(value: Nothing?) | +| [RequiredWithEscapedCharactersMap111011Builder](#requiredwithescapedcharactersmap111011builder) | fooReverseSolidusRbar(value: Boolean) | +| [RequiredWithEscapedCharactersMap111011Builder](#requiredwithescapedcharactersmap111011builder) | fooReverseSolidusRbar(value: String) | +| [RequiredWithEscapedCharactersMap111011Builder](#requiredwithescapedcharactersmap111011builder) | fooReverseSolidusRbar(value: Int) | +| [RequiredWithEscapedCharactersMap111011Builder](#requiredwithescapedcharactersmap111011builder) | fooReverseSolidusRbar(value: Float) | +| [RequiredWithEscapedCharactersMap111011Builder](#requiredwithescapedcharactersmap111011builder) | fooReverseSolidusRbar(value: Long) | +| [RequiredWithEscapedCharactersMap111011Builder](#requiredwithescapedcharactersmap111011builder) | fooReverseSolidusRbar(value: Double) | +| [RequiredWithEscapedCharactersMap111011Builder](#requiredwithescapedcharactersmap111011builder) | fooReverseSolidusRbar(value: List) | +| [RequiredWithEscapedCharactersMap111011Builder](#requiredwithescapedcharactersmap111011builder) | fooReverseSolidusRbar(value: Map) | +| [RequiredWithEscapedCharactersMap111101Builder](#requiredwithescapedcharactersmap111101builder) | fooReverseSolidusQuotationMarkBar(value: Nothing?) | +| [RequiredWithEscapedCharactersMap111101Builder](#requiredwithescapedcharactersmap111101builder) | fooReverseSolidusQuotationMarkBar(value: Boolean) | +| [RequiredWithEscapedCharactersMap111101Builder](#requiredwithescapedcharactersmap111101builder) | fooReverseSolidusQuotationMarkBar(value: String) | +| [RequiredWithEscapedCharactersMap111101Builder](#requiredwithescapedcharactersmap111101builder) | fooReverseSolidusQuotationMarkBar(value: Int) | +| [RequiredWithEscapedCharactersMap111101Builder](#requiredwithescapedcharactersmap111101builder) | fooReverseSolidusQuotationMarkBar(value: Float) | +| [RequiredWithEscapedCharactersMap111101Builder](#requiredwithescapedcharactersmap111101builder) | fooReverseSolidusQuotationMarkBar(value: Long) | +| [RequiredWithEscapedCharactersMap111101Builder](#requiredwithescapedcharactersmap111101builder) | fooReverseSolidusQuotationMarkBar(value: Double) | +| [RequiredWithEscapedCharactersMap111101Builder](#requiredwithescapedcharactersmap111101builder) | fooReverseSolidusQuotationMarkBar(value: List) | +| [RequiredWithEscapedCharactersMap111101Builder](#requiredwithescapedcharactersmap111101builder) | fooReverseSolidusQuotationMarkBar(value: Map) | +| [RequiredWithEscapedCharactersMap111110Builder](#requiredwithescapedcharactersmap111110builder) | fooReverseSolidusReverseSolidusBar(value: Nothing?) | +| [RequiredWithEscapedCharactersMap111110Builder](#requiredwithescapedcharactersmap111110builder) | fooReverseSolidusReverseSolidusBar(value: Boolean) | +| [RequiredWithEscapedCharactersMap111110Builder](#requiredwithescapedcharactersmap111110builder) | fooReverseSolidusReverseSolidusBar(value: String) | +| [RequiredWithEscapedCharactersMap111110Builder](#requiredwithescapedcharactersmap111110builder) | fooReverseSolidusReverseSolidusBar(value: Int) | +| [RequiredWithEscapedCharactersMap111110Builder](#requiredwithescapedcharactersmap111110builder) | fooReverseSolidusReverseSolidusBar(value: Float) | +| [RequiredWithEscapedCharactersMap111110Builder](#requiredwithescapedcharactersmap111110builder) | fooReverseSolidusReverseSolidusBar(value: Long) | +| [RequiredWithEscapedCharactersMap111110Builder](#requiredwithescapedcharactersmap111110builder) | fooReverseSolidusReverseSolidusBar(value: Double) | +| [RequiredWithEscapedCharactersMap111110Builder](#requiredwithescapedcharactersmap111110builder) | fooReverseSolidusReverseSolidusBar(value: List) | +| [RequiredWithEscapedCharactersMap111110Builder](#requiredwithescapedcharactersmap111110builder) | fooReverseSolidusReverseSolidusBar(value: Map) | + +## RequiredWithEscapedCharactersMap +class RequiredWithEscapedCharactersMap
    +extends FrozenMap + +A class to store validated Map payloads + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| static [RequiredWithEscapedCharactersMap](#requiredwithescapedcharactersmap) | of([Map](#requiredwithescapedcharactersmapbuilder) arg, SchemaConfiguration configuration) | +| Any? | get(String key)
    This schema has invalid Kotlin names so this method must be used when you access instance["foo\tbar"], instance["foo\nbar"], instance["foo\u000Cbar"], instance["foo\rbar"], instance["foo\"bar"], instance["foo\\bar"], | +| Any? | getAdditionalProperty(String name)
    provides type safety for additional properties | + +[[Back to top]](#top) [[Back to Component Schemas]](../../../README.md#Component-Schemas) [[Back to README]](../../../README.md) diff --git a/samples/client/3_1_0_unit_test/kotlin/docs/components/schemas/SimpleEnumValidation.md b/samples/client/3_1_0_unit_test/kotlin/docs/components/schemas/SimpleEnumValidation.md new file mode 100644 index 00000000000..08da7286908 --- /dev/null +++ b/samples/client/3_1_0_unit_test/kotlin/docs/components/schemas/SimpleEnumValidation.md @@ -0,0 +1,141 @@ +# SimpleEnumValidation +org.openapijsonschematools.client.components.schemas.SimpleEnumValidation.java +class SimpleEnumValidation
    + +A class that contains necessary nested +- schema classes (which validate payloads), extends JsonSchema +- sealed interfaces which store validated payloads, Kotlin version of a sum type +- boxed classes which store validated payloads, sealed permits class implementations +- enum classes + +## Nested Class Summary +| Modifier and Type | Class and Description | +| ----------------- | ---------------------- | +| sealed interface | [SimpleEnumValidation.SimpleEnumValidation1Boxed](#simpleenumvalidation1boxed)
    sealed interface for validated payloads | +| record | [SimpleEnumValidation.SimpleEnumValidation1BoxedNumber](#simpleenumvalidation1boxednumber)
    boxed class to store validated Number payloads | +| static class | [SimpleEnumValidation.SimpleEnumValidation1](#simpleenumvalidation1)
    schema class | +| enum | [SimpleEnumValidation.IntegerSimpleEnumValidationEnums](#integersimpleenumvalidationenums)
    Integer enum | +| enum | [SimpleEnumValidation.LongSimpleEnumValidationEnums](#longsimpleenumvalidationenums)
    Long enum | +| enum | [SimpleEnumValidation.FloatSimpleEnumValidationEnums](#floatsimpleenumvalidationenums)
    Float enum | +| enum | [SimpleEnumValidation.DoubleSimpleEnumValidationEnums](#doublesimpleenumvalidationenums)
    Double enum | + +## SimpleEnumValidation1Boxed +sealed interface SimpleEnumValidation1Boxed
    +permits
    +[SimpleEnumValidation1BoxedNumber](#simpleenumvalidation1boxednumber) + +sealed interface that stores validated payloads using boxed classes + +## SimpleEnumValidation1BoxedNumber +data class SimpleEnumValidation1BoxedNumber
    +implements [SimpleEnumValidation1Boxed](#simpleenumvalidation1boxed) + +data class that stores validated Number payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| SimpleEnumValidation1BoxedNumber(Number data)
    Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| Number | data()
    validated payload | +| Any? | getData()
    validated payload | + +## SimpleEnumValidation1 +class SimpleEnumValidation1
    +extends JsonSchema + +A schema class that validates payloads + +### Code Sample +``` +import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags; +import org.openapijsonschematools.client.configurations.SchemaConfiguration; +import org.openapijsonschematools.client.exceptions.ValidationException; +import org.openapijsonschematools.client.schemas.validation.MapUtils; +import org.openapijsonschematools.client.schemas.validation.FrozenList; +import org.openapijsonschematools.client.schemas.validation.FrozenMap; +import org.openapijsonschematools.client.components.schemas.SimpleEnumValidation; + +import java.util.Arrays; +import java.util.List; +import java.util.AbstractMap; + +static final SchemaConfiguration configuration = new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().build()); + +// int validation +int validatedPayload = SimpleEnumValidation.SimpleEnumValidation1.validate( + 1, + configuration +); +``` + +### Field Summary +| Modifier and Type | Field and Description | +| ----------------- | ---------------------- | +| Set> | type = setOf(
        Int::class.java,
        Long::class.java,
        Float::class.java,
        Double::class.java
    )
    | +| Set | enumValues = setOf(
        1,
        2,
        3
    )
    | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| Number | validate(arg: Number, configuration: SchemaConfiguration) | +| [SimpleEnumValidation1BoxedNumber](#simpleenumvalidation1boxednumber) | validateAndBox(Number, configuration: SchemaConfiguration) | +| [SimpleEnumValidation1Boxed](#simpleenumvalidation1boxed) | validateAndBox(Any?, configuration: SchemaConfiguration) | +| Any? | validate(arg: Any?, configuration: SchemaConfiguration) | + +## IntegerSimpleEnumValidationEnums +public enum IntegerSimpleEnumValidationEnums
    +extends `Enum` + +A class that stores Integer enum values + +### Enum Constant Summary +| Enum Constant | Description | +| ------------- | ----------- | +| POSITIVE_1 | value = 1 | +| POSITIVE_2 | value = 2 | +| POSITIVE_3 | value = 3 | + +## LongSimpleEnumValidationEnums +public enum LongSimpleEnumValidationEnums
    +extends `Enum` + +A class that stores Long enum values + +### Enum Constant Summary +| Enum Constant | Description | +| ------------- | ----------- | +| POSITIVE_1 | value = 1L | +| POSITIVE_2 | value = 2L | +| POSITIVE_3 | value = 3L | + +## FloatSimpleEnumValidationEnums +public enum FloatSimpleEnumValidationEnums
    +extends `Enum` + +A class that stores Float enum values + +### Enum Constant Summary +| Enum Constant | Description | +| ------------- | ----------- | +| POSITIVE_1 | value = 1.0f | +| POSITIVE_2 | value = 2.0f | +| POSITIVE_3 | value = 3.0f | + +## DoubleSimpleEnumValidationEnums +public enum DoubleSimpleEnumValidationEnums
    +extends `Enum` + +A class that stores Double enum values + +### Enum Constant Summary +| Enum Constant | Description | +| ------------- | ----------- | +| POSITIVE_1 | value = 1.0d | +| POSITIVE_2 | value = 2.0d | +| POSITIVE_3 | value = 3.0d | + +[[Back to top]](#top) [[Back to Component Schemas]](../../../README.md#Component-Schemas) [[Back to README]](../../../README.md) diff --git a/samples/client/3_1_0_unit_test/kotlin/docs/components/schemas/SingleDependency.md b/samples/client/3_1_0_unit_test/kotlin/docs/components/schemas/SingleDependency.md new file mode 100644 index 00000000000..cc3db86e738 --- /dev/null +++ b/samples/client/3_1_0_unit_test/kotlin/docs/components/schemas/SingleDependency.md @@ -0,0 +1,177 @@ +# SingleDependency +org.openapijsonschematools.client.components.schemas.SingleDependency.java +class SingleDependency
    + +A class that contains necessary nested +- schema classes (which validate payloads), extends JsonSchema +- sealed interfaces which store validated payloads, Kotlin version of a sum type +- boxed classes which store validated payloads, sealed permits class implementations + +## Nested Class Summary +| Modifier and Type | Class and Description | +| ----------------- | ---------------------- | +| sealed interface | [SingleDependency.SingleDependency1Boxed](#singledependency1boxed)
    sealed interface for validated payloads | +| record | [SingleDependency.SingleDependency1BoxedVoid](#singledependency1boxedvoid)
    boxed class to store validated null payloads | +| record | [SingleDependency.SingleDependency1BoxedBoolean](#singledependency1boxedboolean)
    boxed class to store validated boolean payloads | +| record | [SingleDependency.SingleDependency1BoxedNumber](#singledependency1boxednumber)
    boxed class to store validated Number payloads | +| record | [SingleDependency.SingleDependency1BoxedString](#singledependency1boxedstring)
    boxed class to store validated String payloads | +| record | [SingleDependency.SingleDependency1BoxedList](#singledependency1boxedlist)
    boxed class to store validated List payloads | +| record | [SingleDependency.SingleDependency1BoxedMap](#singledependency1boxedmap)
    boxed class to store validated Map payloads | +| static class | [SingleDependency.SingleDependency1](#singledependency1)
    schema class | + +## SingleDependency1Boxed +sealed interface SingleDependency1Boxed
    +permits
    +[SingleDependency1BoxedVoid](#singledependency1boxedvoid), +[SingleDependency1BoxedBoolean](#singledependency1boxedboolean), +[SingleDependency1BoxedNumber](#singledependency1boxednumber), +[SingleDependency1BoxedString](#singledependency1boxedstring), +[SingleDependency1BoxedList](#singledependency1boxedlist), +[SingleDependency1BoxedMap](#singledependency1boxedmap) + +sealed interface that stores validated payloads using boxed classes + +## SingleDependency1BoxedVoid +data class SingleDependency1BoxedVoid
    +implements [SingleDependency1Boxed](#singledependency1boxed) + +data class that stores validated null payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| SingleDependency1BoxedVoid(Nothing? data)
    Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| Nothing? | data()
    validated payload | +| Any? | getData()
    validated payload | + +## SingleDependency1BoxedBoolean +data class SingleDependency1BoxedBoolean
    +implements [SingleDependency1Boxed](#singledependency1boxed) + +record that stores validated boolean payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| SingleDependency1BoxedBoolean(boolean data)
    Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| boolean | data()
    validated payload | +| Any? | getData()
    validated payload | + +## SingleDependency1BoxedNumber +data class SingleDependency1BoxedNumber
    +implements [SingleDependency1Boxed](#singledependency1boxed) + +data class that stores validated Number payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| SingleDependency1BoxedNumber(Number data)
    Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| Number | data()
    validated payload | +| Any? | getData()
    validated payload | + +## SingleDependency1BoxedString +data class SingleDependency1BoxedString
    +implements [SingleDependency1Boxed](#singledependency1boxed) + +data class that stores validated String payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| SingleDependency1BoxedString(String data)
    Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| String | data()
    validated payload | +| Any? | getData()
    validated payload | + +## SingleDependency1BoxedList +data class SingleDependency1BoxedList
    +implements [SingleDependency1Boxed](#singledependency1boxed) + +data class that stores validated List payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| SingleDependency1BoxedList(FrozenList data)
    Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| FrozenList | data()
    validated payload | +| Any? | getData()
    validated payload | + +## SingleDependency1BoxedMap +data class SingleDependency1BoxedMap
    +implements [SingleDependency1Boxed](#singledependency1boxed) + +data class that stores validated Map payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| SingleDependency1BoxedMap(FrozenMap data)
    Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| FrozenMap | data()
    validated payload | +| Any? | getData()
    validated payload | + +## SingleDependency1 +class SingleDependency1
    +extends JsonSchema + +A schema class that validates payloads + +### Field Summary +| Modifier and Type | Field and Description | +| ----------------- | ---------------------- | +| Map> | dependentRequired = MapUtils.makeMap(
    +    new AbstractMap.SimpleEntry<>(
    +        "bar",
    +        setOf( +            "foo"
    +        ) +    )
    +) + | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| String | validate(arg: String, configuration: SchemaConfiguration) | +| Nothing? | validate(arg: Nothing?, configuration: SchemaConfiguration) | +| int | validate(arg: int, configuration: SchemaConfiguration) | +| long | validate(arg: long, configuration: SchemaConfiguration) | +| float | validate(arg: float, configuration: SchemaConfiguration) | +| double | validate(arg: double, configuration: SchemaConfiguration) | +| Number | validate(arg: Number, configuration: SchemaConfiguration) | +| boolean | validate(arg: boolean, configuration: SchemaConfiguration) | +| FrozenMap | validate(arg: Map<?, ?>, configuration: SchemaConfiguration) | +| FrozenList | validate(arg: List<*>, configuration: SchemaConfiguration) | +| [SingleDependency1BoxedString](#singledependency1boxedstring) | validateAndBox(String, configuration: SchemaConfiguration) | +| [SingleDependency1BoxedVoid](#singledependency1boxedvoid) | validateAndBox(Nothing?, configuration: SchemaConfiguration) | +| [SingleDependency1BoxedNumber](#singledependency1boxednumber) | validateAndBox(Number, configuration: SchemaConfiguration) | +| [SingleDependency1BoxedBoolean](#singledependency1boxedboolean) | validateAndBox(boolean, configuration: SchemaConfiguration) | +| [SingleDependency1BoxedMap](#singledependency1boxedmap) | validateAndBox(Map<?, ?>, configuration: SchemaConfiguration) | +| [SingleDependency1BoxedList](#singledependency1boxedlist) | validateAndBox(List<*>, configuration: SchemaConfiguration) | +| [SingleDependency1Boxed](#singledependency1boxed) | validateAndBox(Any?, configuration: SchemaConfiguration) | +| Any? | validate(arg: Any?, configuration: SchemaConfiguration) | + +[[Back to top]](#top) [[Back to Component Schemas]](../../../README.md#Component-Schemas) [[Back to README]](../../../README.md) diff --git a/samples/client/3_1_0_unit_test/kotlin/docs/components/schemas/SmallMultipleOfLargeInteger.md b/samples/client/3_1_0_unit_test/kotlin/docs/components/schemas/SmallMultipleOfLargeInteger.md new file mode 100644 index 00000000000..4ac3fc21c89 --- /dev/null +++ b/samples/client/3_1_0_unit_test/kotlin/docs/components/schemas/SmallMultipleOfLargeInteger.md @@ -0,0 +1,85 @@ +# SmallMultipleOfLargeInteger +org.openapijsonschematools.client.components.schemas.SmallMultipleOfLargeInteger.java +class SmallMultipleOfLargeInteger
    + +A class that contains necessary nested +- schema classes (which validate payloads), extends JsonSchema +- sealed interfaces which store validated payloads, Kotlin version of a sum type +- boxed classes which store validated payloads, sealed permits class implementations + +## Nested Class Summary +| Modifier and Type | Class and Description | +| ----------------- | ---------------------- | +| sealed interface | [SmallMultipleOfLargeInteger.SmallMultipleOfLargeInteger1Boxed](#smallmultipleoflargeinteger1boxed)
    sealed interface for validated payloads | +| record | [SmallMultipleOfLargeInteger.SmallMultipleOfLargeInteger1BoxedNumber](#smallmultipleoflargeinteger1boxednumber)
    boxed class to store validated Number payloads | +| static class | [SmallMultipleOfLargeInteger.SmallMultipleOfLargeInteger1](#smallmultipleoflargeinteger1)
    schema class | + +## SmallMultipleOfLargeInteger1Boxed +sealed interface SmallMultipleOfLargeInteger1Boxed
    +permits
    +[SmallMultipleOfLargeInteger1BoxedNumber](#smallmultipleoflargeinteger1boxednumber) + +sealed interface that stores validated payloads using boxed classes + +## SmallMultipleOfLargeInteger1BoxedNumber +data class SmallMultipleOfLargeInteger1BoxedNumber
    +implements [SmallMultipleOfLargeInteger1Boxed](#smallmultipleoflargeinteger1boxed) + +data class that stores validated Number payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| SmallMultipleOfLargeInteger1BoxedNumber(Number data)
    Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| Number | data()
    validated payload | +| Any? | getData()
    validated payload | + +## SmallMultipleOfLargeInteger1 +class SmallMultipleOfLargeInteger1
    +extends JsonSchema + +A schema class that validates payloads + +### Code Sample +``` +import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags; +import org.openapijsonschematools.client.configurations.SchemaConfiguration; +import org.openapijsonschematools.client.exceptions.ValidationException; +import org.openapijsonschematools.client.schemas.validation.MapUtils; +import org.openapijsonschematools.client.schemas.validation.FrozenList; +import org.openapijsonschematools.client.schemas.validation.FrozenMap; +import org.openapijsonschematools.client.components.schemas.SmallMultipleOfLargeInteger; + +import java.util.Arrays; +import java.util.List; +import java.util.AbstractMap; + +static final SchemaConfiguration configuration = new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().build()); + +// int validation +int validatedPayload = SmallMultipleOfLargeInteger.SmallMultipleOfLargeInteger1.validate( + 1L, + configuration +); +``` + +### Field Summary +| Modifier and Type | Field and Description | +| ----------------- | ---------------------- | +| Set> | type = setOf(
        Int::class.java,
        Long::class.java,
        Float::class.java,
        Double::class.java
    )
    | +| String | type = "int"; | +| BigDecimal | multipleOf = BigDecimal("1.0E-8") | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| long | validate(arg: long, configuration: SchemaConfiguration) | +| [SmallMultipleOfLargeInteger1BoxedNumber](#smallmultipleoflargeinteger1boxednumber) | validateAndBox(Number, configuration: SchemaConfiguration) | +| [SmallMultipleOfLargeInteger1Boxed](#smallmultipleoflargeinteger1boxed) | validateAndBox(Any?, configuration: SchemaConfiguration) | +| Any? | validate(arg: Any?, configuration: SchemaConfiguration) | + +[[Back to top]](#top) [[Back to Component Schemas]](../../../README.md#Component-Schemas) [[Back to README]](../../../README.md) diff --git a/samples/client/3_1_0_unit_test/kotlin/docs/components/schemas/StringTypeMatchesStrings.md b/samples/client/3_1_0_unit_test/kotlin/docs/components/schemas/StringTypeMatchesStrings.md new file mode 100644 index 00000000000..30d0ca293d7 --- /dev/null +++ b/samples/client/3_1_0_unit_test/kotlin/docs/components/schemas/StringTypeMatchesStrings.md @@ -0,0 +1,52 @@ +# StringTypeMatchesStrings +org.openapijsonschematools.client.components.schemas.StringTypeMatchesStrings.java +class StringTypeMatchesStrings
    + +A class that contains necessary nested +- schema classes (which validate payloads), extends JsonSchema +- sealed interfaces which store validated payloads, Kotlin version of a sum type +- boxed classes which store validated payloads, sealed permits class implementations + +## Nested Class Summary +| Modifier and Type | Class and Description | +| ----------------- | ---------------------- | +| sealed interface | [StringTypeMatchesStrings.StringTypeMatchesStrings1Boxed](#stringtypematchesstrings1boxed)
    sealed interface for validated payloads | +| record | [StringTypeMatchesStrings.StringTypeMatchesStrings1BoxedString](#stringtypematchesstrings1boxedstring)
    boxed class to store validated String payloads | +| static class | [StringTypeMatchesStrings.StringTypeMatchesStrings1](#stringtypematchesstrings1)
    schema class | + +## StringTypeMatchesStrings1Boxed +sealed interface StringTypeMatchesStrings1Boxed
    +permits
    +[StringTypeMatchesStrings1BoxedString](#stringtypematchesstrings1boxedstring) + +sealed interface that stores validated payloads using boxed classes + +## StringTypeMatchesStrings1BoxedString +data class StringTypeMatchesStrings1BoxedString
    +implements [StringTypeMatchesStrings1Boxed](#stringtypematchesstrings1boxed) + +data class that stores validated String payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| StringTypeMatchesStrings1BoxedString(String data)
    Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| String | data()
    validated payload | +| Any? | getData()
    validated payload | + +## StringTypeMatchesStrings1 +class StringTypeMatchesStrings1
    +extends StringJsonSchema.StringJsonSchema1 + +A schema class that validates payloads + +| Methods Inherited from class org.openapijsonschematools.client.schemas.StringJsonSchema.StringJsonSchema1 | +| ------------------------------------------------------------------ | +| validate | +| validateAndBox | + +[[Back to top]](#top) [[Back to Component Schemas]](../../../README.md#Component-Schemas) [[Back to README]](../../../README.md) diff --git a/samples/client/3_1_0_unit_test/kotlin/docs/components/schemas/TimeFormat.md b/samples/client/3_1_0_unit_test/kotlin/docs/components/schemas/TimeFormat.md new file mode 100644 index 00000000000..6c9b0696e11 --- /dev/null +++ b/samples/client/3_1_0_unit_test/kotlin/docs/components/schemas/TimeFormat.md @@ -0,0 +1,169 @@ +# TimeFormat +org.openapijsonschematools.client.components.schemas.TimeFormat.java +class TimeFormat
    + +A class that contains necessary nested +- schema classes (which validate payloads), extends JsonSchema +- sealed interfaces which store validated payloads, Kotlin version of a sum type +- boxed classes which store validated payloads, sealed permits class implementations + +## Nested Class Summary +| Modifier and Type | Class and Description | +| ----------------- | ---------------------- | +| sealed interface | [TimeFormat.TimeFormat1Boxed](#timeformat1boxed)
    sealed interface for validated payloads | +| record | [TimeFormat.TimeFormat1BoxedVoid](#timeformat1boxedvoid)
    boxed class to store validated null payloads | +| record | [TimeFormat.TimeFormat1BoxedBoolean](#timeformat1boxedboolean)
    boxed class to store validated boolean payloads | +| record | [TimeFormat.TimeFormat1BoxedNumber](#timeformat1boxednumber)
    boxed class to store validated Number payloads | +| record | [TimeFormat.TimeFormat1BoxedString](#timeformat1boxedstring)
    boxed class to store validated String payloads | +| record | [TimeFormat.TimeFormat1BoxedList](#timeformat1boxedlist)
    boxed class to store validated List payloads | +| record | [TimeFormat.TimeFormat1BoxedMap](#timeformat1boxedmap)
    boxed class to store validated Map payloads | +| static class | [TimeFormat.TimeFormat1](#timeformat1)
    schema class | + +## TimeFormat1Boxed +sealed interface TimeFormat1Boxed
    +permits
    +[TimeFormat1BoxedVoid](#timeformat1boxedvoid), +[TimeFormat1BoxedBoolean](#timeformat1boxedboolean), +[TimeFormat1BoxedNumber](#timeformat1boxednumber), +[TimeFormat1BoxedString](#timeformat1boxedstring), +[TimeFormat1BoxedList](#timeformat1boxedlist), +[TimeFormat1BoxedMap](#timeformat1boxedmap) + +sealed interface that stores validated payloads using boxed classes + +## TimeFormat1BoxedVoid +data class TimeFormat1BoxedVoid
    +implements [TimeFormat1Boxed](#timeformat1boxed) + +data class that stores validated null payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| TimeFormat1BoxedVoid(Nothing? data)
    Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| Nothing? | data()
    validated payload | +| Any? | getData()
    validated payload | + +## TimeFormat1BoxedBoolean +data class TimeFormat1BoxedBoolean
    +implements [TimeFormat1Boxed](#timeformat1boxed) + +record that stores validated boolean payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| TimeFormat1BoxedBoolean(boolean data)
    Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| boolean | data()
    validated payload | +| Any? | getData()
    validated payload | + +## TimeFormat1BoxedNumber +data class TimeFormat1BoxedNumber
    +implements [TimeFormat1Boxed](#timeformat1boxed) + +data class that stores validated Number payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| TimeFormat1BoxedNumber(Number data)
    Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| Number | data()
    validated payload | +| Any? | getData()
    validated payload | + +## TimeFormat1BoxedString +data class TimeFormat1BoxedString
    +implements [TimeFormat1Boxed](#timeformat1boxed) + +data class that stores validated String payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| TimeFormat1BoxedString(String data)
    Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| String | data()
    validated payload | +| Any? | getData()
    validated payload | + +## TimeFormat1BoxedList +data class TimeFormat1BoxedList
    +implements [TimeFormat1Boxed](#timeformat1boxed) + +data class that stores validated List payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| TimeFormat1BoxedList(FrozenList data)
    Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| FrozenList | data()
    validated payload | +| Any? | getData()
    validated payload | + +## TimeFormat1BoxedMap +data class TimeFormat1BoxedMap
    +implements [TimeFormat1Boxed](#timeformat1boxed) + +data class that stores validated Map payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| TimeFormat1BoxedMap(FrozenMap data)
    Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| FrozenMap | data()
    validated payload | +| Any? | getData()
    validated payload | + +## TimeFormat1 +class TimeFormat1
    +extends JsonSchema + +A schema class that validates payloads + +### Field Summary +| Modifier and Type | Field and Description | +| ----------------- | ---------------------- | +| String | type = "time"; | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| String | validate(arg: String, configuration: SchemaConfiguration) | +| Nothing? | validate(arg: Nothing?, configuration: SchemaConfiguration) | +| int | validate(arg: int, configuration: SchemaConfiguration) | +| long | validate(arg: long, configuration: SchemaConfiguration) | +| float | validate(arg: float, configuration: SchemaConfiguration) | +| double | validate(arg: double, configuration: SchemaConfiguration) | +| Number | validate(arg: Number, configuration: SchemaConfiguration) | +| boolean | validate(arg: boolean, configuration: SchemaConfiguration) | +| FrozenMap | validate(arg: Map<?, ?>, configuration: SchemaConfiguration) | +| FrozenList | validate(arg: List<*>, configuration: SchemaConfiguration) | +| [TimeFormat1BoxedString](#timeformat1boxedstring) | validateAndBox(String, configuration: SchemaConfiguration) | +| [TimeFormat1BoxedVoid](#timeformat1boxedvoid) | validateAndBox(Nothing?, configuration: SchemaConfiguration) | +| [TimeFormat1BoxedNumber](#timeformat1boxednumber) | validateAndBox(Number, configuration: SchemaConfiguration) | +| [TimeFormat1BoxedBoolean](#timeformat1boxedboolean) | validateAndBox(boolean, configuration: SchemaConfiguration) | +| [TimeFormat1BoxedMap](#timeformat1boxedmap) | validateAndBox(Map<?, ?>, configuration: SchemaConfiguration) | +| [TimeFormat1BoxedList](#timeformat1boxedlist) | validateAndBox(List<*>, configuration: SchemaConfiguration) | +| [TimeFormat1Boxed](#timeformat1boxed) | validateAndBox(Any?, configuration: SchemaConfiguration) | +| Any? | validate(arg: Any?, configuration: SchemaConfiguration) | + +[[Back to top]](#top) [[Back to Component Schemas]](../../../README.md#Component-Schemas) [[Back to README]](../../../README.md) diff --git a/samples/client/3_1_0_unit_test/kotlin/docs/components/schemas/TypeArrayObjectOrNull.md b/samples/client/3_1_0_unit_test/kotlin/docs/components/schemas/TypeArrayObjectOrNull.md new file mode 100644 index 00000000000..91459eaefce --- /dev/null +++ b/samples/client/3_1_0_unit_test/kotlin/docs/components/schemas/TypeArrayObjectOrNull.md @@ -0,0 +1,125 @@ +# TypeArrayObjectOrNull +org.openapijsonschematools.client.components.schemas.TypeArrayObjectOrNull.java +class TypeArrayObjectOrNull
    + +A class that contains necessary nested +- schema classes (which validate payloads), extends JsonSchema +- sealed interfaces which store validated payloads, Kotlin version of a sum type +- boxed classes which store validated payloads, sealed permits class implementations + +## Nested Class Summary +| Modifier and Type | Class and Description | +| ----------------- | ---------------------- | +| sealed interface | [TypeArrayObjectOrNull.TypeArrayObjectOrNull1Boxed](#typearrayobjectornull1boxed)
    sealed interface for validated payloads | +| record | [TypeArrayObjectOrNull.TypeArrayObjectOrNull1BoxedList](#typearrayobjectornull1boxedlist)
    boxed class to store validated List payloads | +| record | [TypeArrayObjectOrNull.TypeArrayObjectOrNull1BoxedMap](#typearrayobjectornull1boxedmap)
    boxed class to store validated Map payloads | +| record | [TypeArrayObjectOrNull.TypeArrayObjectOrNull1BoxedVoid](#typearrayobjectornull1boxedvoid)
    boxed class to store validated null payloads | +| static class | [TypeArrayObjectOrNull.TypeArrayObjectOrNull1](#typearrayobjectornull1)
    schema class | + +## TypeArrayObjectOrNull1Boxed +sealed interface TypeArrayObjectOrNull1Boxed
    +permits
    +[TypeArrayObjectOrNull1BoxedList](#typearrayobjectornull1boxedlist), +[TypeArrayObjectOrNull1BoxedMap](#typearrayobjectornull1boxedmap), +[TypeArrayObjectOrNull1BoxedVoid](#typearrayobjectornull1boxedvoid) + +sealed interface that stores validated payloads using boxed classes + +## TypeArrayObjectOrNull1BoxedList +data class TypeArrayObjectOrNull1BoxedList
    +implements [TypeArrayObjectOrNull1Boxed](#typearrayobjectornull1boxed) + +data class that stores validated List payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| TypeArrayObjectOrNull1BoxedList(FrozenList data)
    Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| FrozenList | data()
    validated payload | +| Any? | getData()
    validated payload | + +## TypeArrayObjectOrNull1BoxedMap +data class TypeArrayObjectOrNull1BoxedMap
    +implements [TypeArrayObjectOrNull1Boxed](#typearrayobjectornull1boxed) + +data class that stores validated Map payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| TypeArrayObjectOrNull1BoxedMap(FrozenMap data)
    Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| FrozenMap | data()
    validated payload | +| Any? | getData()
    validated payload | + +## TypeArrayObjectOrNull1BoxedVoid +data class TypeArrayObjectOrNull1BoxedVoid
    +implements [TypeArrayObjectOrNull1Boxed](#typearrayobjectornull1boxed) + +data class that stores validated null payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| TypeArrayObjectOrNull1BoxedVoid(Nothing? data)
    Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| Nothing? | data()
    validated payload | +| Any? | getData()
    validated payload | + +## TypeArrayObjectOrNull1 +class TypeArrayObjectOrNull1
    +extends JsonSchema + +A schema class that validates payloads + +### Code Sample +``` +import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags; +import org.openapijsonschematools.client.configurations.SchemaConfiguration; +import org.openapijsonschematools.client.exceptions.ValidationException; +import org.openapijsonschematools.client.schemas.validation.MapUtils; +import org.openapijsonschematools.client.schemas.validation.FrozenList; +import org.openapijsonschematools.client.schemas.validation.FrozenMap; +import org.openapijsonschematools.client.components.schemas.TypeArrayObjectOrNull; + +import java.util.Arrays; +import java.util.List; +import java.util.AbstractMap; + +static final SchemaConfiguration configuration = new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().build()); + +// null validation +Nothing? validatedPayload = TypeArrayObjectOrNull.TypeArrayObjectOrNull1.validate( + null, + configuration +); +``` + +### Field Summary +| Modifier and Type | Field and Description | +| ----------------- | ---------------------- | +| Set> | type = setOf(
        List::class.java,
        Map::class.java,
        Void::class.java
    )
    | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| FrozenList | validate(arg: List<*>, configuration: SchemaConfiguration) | +| [TypeArrayObjectOrNull1BoxedList](#typearrayobjectornull1boxedlist) | validateAndBox(List<*>, configuration: SchemaConfiguration) | +| FrozenMap | validate(arg: Map<?, ?>, configuration: SchemaConfiguration) | +| [TypeArrayObjectOrNull1BoxedMap](#typearrayobjectornull1boxedmap) | validateAndBox(Map<?, ?>, configuration: SchemaConfiguration) | +| Nothing? | validate(arg: Nothing?, configuration: SchemaConfiguration) | +| [TypeArrayObjectOrNull1BoxedVoid](#typearrayobjectornull1boxedvoid) | validateAndBox(Nothing?, configuration: SchemaConfiguration) | +| [TypeArrayObjectOrNull1Boxed](#typearrayobjectornull1boxed) | validateAndBox(Any?, configuration: SchemaConfiguration) | +| Any? | validate(arg: Any?, configuration: SchemaConfiguration) | + +[[Back to top]](#top) [[Back to Component Schemas]](../../../README.md#Component-Schemas) [[Back to README]](../../../README.md) diff --git a/samples/client/3_1_0_unit_test/kotlin/docs/components/schemas/TypeArrayOrObject.md b/samples/client/3_1_0_unit_test/kotlin/docs/components/schemas/TypeArrayOrObject.md new file mode 100644 index 00000000000..04442787c75 --- /dev/null +++ b/samples/client/3_1_0_unit_test/kotlin/docs/components/schemas/TypeArrayOrObject.md @@ -0,0 +1,81 @@ +# TypeArrayOrObject +org.openapijsonschematools.client.components.schemas.TypeArrayOrObject.java +class TypeArrayOrObject
    + +A class that contains necessary nested +- schema classes (which validate payloads), extends JsonSchema +- sealed interfaces which store validated payloads, Kotlin version of a sum type +- boxed classes which store validated payloads, sealed permits class implementations + +## Nested Class Summary +| Modifier and Type | Class and Description | +| ----------------- | ---------------------- | +| sealed interface | [TypeArrayOrObject.TypeArrayOrObject1Boxed](#typearrayorobject1boxed)
    sealed interface for validated payloads | +| record | [TypeArrayOrObject.TypeArrayOrObject1BoxedList](#typearrayorobject1boxedlist)
    boxed class to store validated List payloads | +| record | [TypeArrayOrObject.TypeArrayOrObject1BoxedMap](#typearrayorobject1boxedmap)
    boxed class to store validated Map payloads | +| static class | [TypeArrayOrObject.TypeArrayOrObject1](#typearrayorobject1)
    schema class | + +## TypeArrayOrObject1Boxed +sealed interface TypeArrayOrObject1Boxed
    +permits
    +[TypeArrayOrObject1BoxedList](#typearrayorobject1boxedlist), +[TypeArrayOrObject1BoxedMap](#typearrayorobject1boxedmap) + +sealed interface that stores validated payloads using boxed classes + +## TypeArrayOrObject1BoxedList +data class TypeArrayOrObject1BoxedList
    +implements [TypeArrayOrObject1Boxed](#typearrayorobject1boxed) + +data class that stores validated List payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| TypeArrayOrObject1BoxedList(FrozenList data)
    Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| FrozenList | data()
    validated payload | +| Any? | getData()
    validated payload | + +## TypeArrayOrObject1BoxedMap +data class TypeArrayOrObject1BoxedMap
    +implements [TypeArrayOrObject1Boxed](#typearrayorobject1boxed) + +data class that stores validated Map payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| TypeArrayOrObject1BoxedMap(FrozenMap data)
    Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| FrozenMap | data()
    validated payload | +| Any? | getData()
    validated payload | + +## TypeArrayOrObject1 +class TypeArrayOrObject1
    +extends JsonSchema + +A schema class that validates payloads + +### Field Summary +| Modifier and Type | Field and Description | +| ----------------- | ---------------------- | +| Set> | type = setOf(
        List::class.java,
        Map::class.java
    )
    | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| FrozenList | validate(arg: List<*>, configuration: SchemaConfiguration) | +| [TypeArrayOrObject1BoxedList](#typearrayorobject1boxedlist) | validateAndBox(List<*>, configuration: SchemaConfiguration) | +| FrozenMap | validate(arg: Map<?, ?>, configuration: SchemaConfiguration) | +| [TypeArrayOrObject1BoxedMap](#typearrayorobject1boxedmap) | validateAndBox(Map<?, ?>, configuration: SchemaConfiguration) | +| [TypeArrayOrObject1Boxed](#typearrayorobject1boxed) | validateAndBox(Any?, configuration: SchemaConfiguration) | +| Any? | validate(arg: Any?, configuration: SchemaConfiguration) | + +[[Back to top]](#top) [[Back to Component Schemas]](../../../README.md#Component-Schemas) [[Back to README]](../../../README.md) diff --git a/samples/client/3_1_0_unit_test/kotlin/docs/components/schemas/TypeAsArrayWithOneItem.md b/samples/client/3_1_0_unit_test/kotlin/docs/components/schemas/TypeAsArrayWithOneItem.md new file mode 100644 index 00000000000..8b9ee26252e --- /dev/null +++ b/samples/client/3_1_0_unit_test/kotlin/docs/components/schemas/TypeAsArrayWithOneItem.md @@ -0,0 +1,52 @@ +# TypeAsArrayWithOneItem +org.openapijsonschematools.client.components.schemas.TypeAsArrayWithOneItem.java +class TypeAsArrayWithOneItem
    + +A class that contains necessary nested +- schema classes (which validate payloads), extends JsonSchema +- sealed interfaces which store validated payloads, Kotlin version of a sum type +- boxed classes which store validated payloads, sealed permits class implementations + +## Nested Class Summary +| Modifier and Type | Class and Description | +| ----------------- | ---------------------- | +| sealed interface | [TypeAsArrayWithOneItem.TypeAsArrayWithOneItem1Boxed](#typeasarraywithoneitem1boxed)
    sealed interface for validated payloads | +| record | [TypeAsArrayWithOneItem.TypeAsArrayWithOneItem1BoxedString](#typeasarraywithoneitem1boxedstring)
    boxed class to store validated String payloads | +| static class | [TypeAsArrayWithOneItem.TypeAsArrayWithOneItem1](#typeasarraywithoneitem1)
    schema class | + +## TypeAsArrayWithOneItem1Boxed +sealed interface TypeAsArrayWithOneItem1Boxed
    +permits
    +[TypeAsArrayWithOneItem1BoxedString](#typeasarraywithoneitem1boxedstring) + +sealed interface that stores validated payloads using boxed classes + +## TypeAsArrayWithOneItem1BoxedString +data class TypeAsArrayWithOneItem1BoxedString
    +implements [TypeAsArrayWithOneItem1Boxed](#typeasarraywithoneitem1boxed) + +data class that stores validated String payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| TypeAsArrayWithOneItem1BoxedString(String data)
    Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| String | data()
    validated payload | +| Any? | getData()
    validated payload | + +## TypeAsArrayWithOneItem1 +class TypeAsArrayWithOneItem1
    +extends StringJsonSchema.StringJsonSchema1 + +A schema class that validates payloads + +| Methods Inherited from class org.openapijsonschematools.client.schemas.StringJsonSchema.StringJsonSchema1 | +| ------------------------------------------------------------------ | +| validate | +| validateAndBox | + +[[Back to top]](#top) [[Back to Component Schemas]](../../../README.md#Component-Schemas) [[Back to README]](../../../README.md) diff --git a/samples/client/3_1_0_unit_test/kotlin/docs/components/schemas/UnevaluateditemsAsSchema.md b/samples/client/3_1_0_unit_test/kotlin/docs/components/schemas/UnevaluateditemsAsSchema.md new file mode 100644 index 00000000000..8df9cd10550 --- /dev/null +++ b/samples/client/3_1_0_unit_test/kotlin/docs/components/schemas/UnevaluateditemsAsSchema.md @@ -0,0 +1,207 @@ +# UnevaluateditemsAsSchema +org.openapijsonschematools.client.components.schemas.UnevaluateditemsAsSchema.java +class UnevaluateditemsAsSchema
    + +A class that contains necessary nested +- schema classes (which validate payloads), extends JsonSchema +- sealed interfaces which store validated payloads, Kotlin version of a sum type +- boxed classes which store validated payloads, sealed permits class implementations + +## Nested Class Summary +| Modifier and Type | Class and Description | +| ----------------- | ---------------------- | +| sealed interface | [UnevaluateditemsAsSchema.UnevaluateditemsAsSchema1Boxed](#unevaluateditemsasschema1boxed)
    sealed interface for validated payloads | +| record | [UnevaluateditemsAsSchema.UnevaluateditemsAsSchema1BoxedVoid](#unevaluateditemsasschema1boxedvoid)
    boxed class to store validated null payloads | +| record | [UnevaluateditemsAsSchema.UnevaluateditemsAsSchema1BoxedBoolean](#unevaluateditemsasschema1boxedboolean)
    boxed class to store validated boolean payloads | +| record | [UnevaluateditemsAsSchema.UnevaluateditemsAsSchema1BoxedNumber](#unevaluateditemsasschema1boxednumber)
    boxed class to store validated Number payloads | +| record | [UnevaluateditemsAsSchema.UnevaluateditemsAsSchema1BoxedString](#unevaluateditemsasschema1boxedstring)
    boxed class to store validated String payloads | +| record | [UnevaluateditemsAsSchema.UnevaluateditemsAsSchema1BoxedList](#unevaluateditemsasschema1boxedlist)
    boxed class to store validated List payloads | +| record | [UnevaluateditemsAsSchema.UnevaluateditemsAsSchema1BoxedMap](#unevaluateditemsasschema1boxedmap)
    boxed class to store validated Map payloads | +| static class | [UnevaluateditemsAsSchema.UnevaluateditemsAsSchema1](#unevaluateditemsasschema1)
    schema class | +| sealed interface | [UnevaluateditemsAsSchema.UnevaluatedItemsBoxed](#unevaluateditemsboxed)
    sealed interface for validated payloads | +| record | [UnevaluateditemsAsSchema.UnevaluatedItemsBoxedString](#unevaluateditemsboxedstring)
    boxed class to store validated String payloads | +| static class | [UnevaluateditemsAsSchema.UnevaluatedItems](#unevaluateditems)
    schema class | + +## UnevaluateditemsAsSchema1Boxed +sealed interface UnevaluateditemsAsSchema1Boxed
    +permits
    +[UnevaluateditemsAsSchema1BoxedVoid](#unevaluateditemsasschema1boxedvoid), +[UnevaluateditemsAsSchema1BoxedBoolean](#unevaluateditemsasschema1boxedboolean), +[UnevaluateditemsAsSchema1BoxedNumber](#unevaluateditemsasschema1boxednumber), +[UnevaluateditemsAsSchema1BoxedString](#unevaluateditemsasschema1boxedstring), +[UnevaluateditemsAsSchema1BoxedList](#unevaluateditemsasschema1boxedlist), +[UnevaluateditemsAsSchema1BoxedMap](#unevaluateditemsasschema1boxedmap) + +sealed interface that stores validated payloads using boxed classes + +## UnevaluateditemsAsSchema1BoxedVoid +data class UnevaluateditemsAsSchema1BoxedVoid
    +implements [UnevaluateditemsAsSchema1Boxed](#unevaluateditemsasschema1boxed) + +data class that stores validated null payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| UnevaluateditemsAsSchema1BoxedVoid(Nothing? data)
    Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| Nothing? | data()
    validated payload | +| Any? | getData()
    validated payload | + +## UnevaluateditemsAsSchema1BoxedBoolean +data class UnevaluateditemsAsSchema1BoxedBoolean
    +implements [UnevaluateditemsAsSchema1Boxed](#unevaluateditemsasschema1boxed) + +record that stores validated boolean payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| UnevaluateditemsAsSchema1BoxedBoolean(boolean data)
    Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| boolean | data()
    validated payload | +| Any? | getData()
    validated payload | + +## UnevaluateditemsAsSchema1BoxedNumber +data class UnevaluateditemsAsSchema1BoxedNumber
    +implements [UnevaluateditemsAsSchema1Boxed](#unevaluateditemsasschema1boxed) + +data class that stores validated Number payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| UnevaluateditemsAsSchema1BoxedNumber(Number data)
    Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| Number | data()
    validated payload | +| Any? | getData()
    validated payload | + +## UnevaluateditemsAsSchema1BoxedString +data class UnevaluateditemsAsSchema1BoxedString
    +implements [UnevaluateditemsAsSchema1Boxed](#unevaluateditemsasschema1boxed) + +data class that stores validated String payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| UnevaluateditemsAsSchema1BoxedString(String data)
    Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| String | data()
    validated payload | +| Any? | getData()
    validated payload | + +## UnevaluateditemsAsSchema1BoxedList +data class UnevaluateditemsAsSchema1BoxedList
    +implements [UnevaluateditemsAsSchema1Boxed](#unevaluateditemsasschema1boxed) + +data class that stores validated List payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| UnevaluateditemsAsSchema1BoxedList(FrozenList data)
    Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| FrozenList | data()
    validated payload | +| Any? | getData()
    validated payload | + +## UnevaluateditemsAsSchema1BoxedMap +data class UnevaluateditemsAsSchema1BoxedMap
    +implements [UnevaluateditemsAsSchema1Boxed](#unevaluateditemsasschema1boxed) + +data class that stores validated Map payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| UnevaluateditemsAsSchema1BoxedMap(FrozenMap data)
    Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| FrozenMap | data()
    validated payload | +| Any? | getData()
    validated payload | + +## UnevaluateditemsAsSchema1 +class UnevaluateditemsAsSchema1
    +extends JsonSchema + +A schema class that validates payloads + +### Field Summary +| Modifier and Type | Field and Description | +| ----------------- | ---------------------- | +| Class | unevaluatedItems = [UnevaluatedItems::class.java](#unevaluateditems) | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| String | validate(arg: String, configuration: SchemaConfiguration) | +| Nothing? | validate(arg: Nothing?, configuration: SchemaConfiguration) | +| int | validate(arg: int, configuration: SchemaConfiguration) | +| long | validate(arg: long, configuration: SchemaConfiguration) | +| float | validate(arg: float, configuration: SchemaConfiguration) | +| double | validate(arg: double, configuration: SchemaConfiguration) | +| Number | validate(arg: Number, configuration: SchemaConfiguration) | +| boolean | validate(arg: boolean, configuration: SchemaConfiguration) | +| FrozenMap | validate(arg: Map<?, ?>, configuration: SchemaConfiguration) | +| FrozenList | validate(arg: List<*>, configuration: SchemaConfiguration) | +| [UnevaluateditemsAsSchema1BoxedString](#unevaluateditemsasschema1boxedstring) | validateAndBox(String, configuration: SchemaConfiguration) | +| [UnevaluateditemsAsSchema1BoxedVoid](#unevaluateditemsasschema1boxedvoid) | validateAndBox(Nothing?, configuration: SchemaConfiguration) | +| [UnevaluateditemsAsSchema1BoxedNumber](#unevaluateditemsasschema1boxednumber) | validateAndBox(Number, configuration: SchemaConfiguration) | +| [UnevaluateditemsAsSchema1BoxedBoolean](#unevaluateditemsasschema1boxedboolean) | validateAndBox(boolean, configuration: SchemaConfiguration) | +| [UnevaluateditemsAsSchema1BoxedMap](#unevaluateditemsasschema1boxedmap) | validateAndBox(Map<?, ?>, configuration: SchemaConfiguration) | +| [UnevaluateditemsAsSchema1BoxedList](#unevaluateditemsasschema1boxedlist) | validateAndBox(List<*>, configuration: SchemaConfiguration) | +| [UnevaluateditemsAsSchema1Boxed](#unevaluateditemsasschema1boxed) | validateAndBox(Any?, configuration: SchemaConfiguration) | +| Any? | validate(arg: Any?, configuration: SchemaConfiguration) | + +## UnevaluatedItemsBoxed +sealed interface UnevaluatedItemsBoxed
    +permits
    +[UnevaluatedItemsBoxedString](#unevaluateditemsboxedstring) + +sealed interface that stores validated payloads using boxed classes + +## UnevaluatedItemsBoxedString +data class UnevaluatedItemsBoxedString
    +implements [UnevaluatedItemsBoxed](#unevaluateditemsboxed) + +data class that stores validated String payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| UnevaluatedItemsBoxedString(String data)
    Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| String | data()
    validated payload | +| Any? | getData()
    validated payload | + +## UnevaluatedItems +class UnevaluatedItems
    +extends StringJsonSchema.StringJsonSchema1 + +A schema class that validates payloads + +| Methods Inherited from class org.openapijsonschematools.client.schemas.StringJsonSchema.StringJsonSchema1 | +| ------------------------------------------------------------------ | +| validate | +| validateAndBox | + +[[Back to top]](#top) [[Back to Component Schemas]](../../../README.md#Component-Schemas) [[Back to README]](../../../README.md) diff --git a/samples/client/3_1_0_unit_test/kotlin/docs/components/schemas/UnevaluateditemsDependsOnMultipleNestedContains.md b/samples/client/3_1_0_unit_test/kotlin/docs/components/schemas/UnevaluateditemsDependsOnMultipleNestedContains.md new file mode 100644 index 00000000000..58946fe9263 --- /dev/null +++ b/samples/client/3_1_0_unit_test/kotlin/docs/components/schemas/UnevaluateditemsDependsOnMultipleNestedContains.md @@ -0,0 +1,945 @@ +# UnevaluateditemsDependsOnMultipleNestedContains +org.openapijsonschematools.client.components.schemas.UnevaluateditemsDependsOnMultipleNestedContains.java +class UnevaluateditemsDependsOnMultipleNestedContains
    + +A class that contains necessary nested +- schema classes (which validate payloads), extends JsonSchema +- sealed interfaces which store validated payloads, Kotlin version of a sum type +- boxed classes which store validated payloads, sealed permits class implementations + +## Nested Class Summary +| Modifier and Type | Class and Description | +| ----------------- | ---------------------- | +| sealed interface | [UnevaluateditemsDependsOnMultipleNestedContains.UnevaluateditemsDependsOnMultipleNestedContains1Boxed](#unevaluateditemsdependsonmultiplenestedcontains1boxed)
    sealed interface for validated payloads | +| record | [UnevaluateditemsDependsOnMultipleNestedContains.UnevaluateditemsDependsOnMultipleNestedContains1BoxedVoid](#unevaluateditemsdependsonmultiplenestedcontains1boxedvoid)
    boxed class to store validated null payloads | +| record | [UnevaluateditemsDependsOnMultipleNestedContains.UnevaluateditemsDependsOnMultipleNestedContains1BoxedBoolean](#unevaluateditemsdependsonmultiplenestedcontains1boxedboolean)
    boxed class to store validated boolean payloads | +| record | [UnevaluateditemsDependsOnMultipleNestedContains.UnevaluateditemsDependsOnMultipleNestedContains1BoxedNumber](#unevaluateditemsdependsonmultiplenestedcontains1boxednumber)
    boxed class to store validated Number payloads | +| record | [UnevaluateditemsDependsOnMultipleNestedContains.UnevaluateditemsDependsOnMultipleNestedContains1BoxedString](#unevaluateditemsdependsonmultiplenestedcontains1boxedstring)
    boxed class to store validated String payloads | +| record | [UnevaluateditemsDependsOnMultipleNestedContains.UnevaluateditemsDependsOnMultipleNestedContains1BoxedList](#unevaluateditemsdependsonmultiplenestedcontains1boxedlist)
    boxed class to store validated List payloads | +| record | [UnevaluateditemsDependsOnMultipleNestedContains.UnevaluateditemsDependsOnMultipleNestedContains1BoxedMap](#unevaluateditemsdependsonmultiplenestedcontains1boxedmap)
    boxed class to store validated Map payloads | +| static class | [UnevaluateditemsDependsOnMultipleNestedContains.UnevaluateditemsDependsOnMultipleNestedContains1](#unevaluateditemsdependsonmultiplenestedcontains1)
    schema class | +| sealed interface | [UnevaluateditemsDependsOnMultipleNestedContains.UnevaluatedItemsBoxed](#unevaluateditemsboxed)
    sealed interface for validated payloads | +| record | [UnevaluateditemsDependsOnMultipleNestedContains.UnevaluatedItemsBoxedVoid](#unevaluateditemsboxedvoid)
    boxed class to store validated null payloads | +| record | [UnevaluateditemsDependsOnMultipleNestedContains.UnevaluatedItemsBoxedBoolean](#unevaluateditemsboxedboolean)
    boxed class to store validated boolean payloads | +| record | [UnevaluateditemsDependsOnMultipleNestedContains.UnevaluatedItemsBoxedNumber](#unevaluateditemsboxednumber)
    boxed class to store validated Number payloads | +| record | [UnevaluateditemsDependsOnMultipleNestedContains.UnevaluatedItemsBoxedString](#unevaluateditemsboxedstring)
    boxed class to store validated String payloads | +| record | [UnevaluateditemsDependsOnMultipleNestedContains.UnevaluatedItemsBoxedList](#unevaluateditemsboxedlist)
    boxed class to store validated List payloads | +| record | [UnevaluateditemsDependsOnMultipleNestedContains.UnevaluatedItemsBoxedMap](#unevaluateditemsboxedmap)
    boxed class to store validated Map payloads | +| static class | [UnevaluateditemsDependsOnMultipleNestedContains.UnevaluatedItems](#unevaluateditems)
    schema class | +| sealed interface | [UnevaluateditemsDependsOnMultipleNestedContains.Schema1Boxed](#schema1boxed)
    sealed interface for validated payloads | +| record | [UnevaluateditemsDependsOnMultipleNestedContains.Schema1BoxedVoid](#schema1boxedvoid)
    boxed class to store validated null payloads | +| record | [UnevaluateditemsDependsOnMultipleNestedContains.Schema1BoxedBoolean](#schema1boxedboolean)
    boxed class to store validated boolean payloads | +| record | [UnevaluateditemsDependsOnMultipleNestedContains.Schema1BoxedNumber](#schema1boxednumber)
    boxed class to store validated Number payloads | +| record | [UnevaluateditemsDependsOnMultipleNestedContains.Schema1BoxedString](#schema1boxedstring)
    boxed class to store validated String payloads | +| record | [UnevaluateditemsDependsOnMultipleNestedContains.Schema1BoxedList](#schema1boxedlist)
    boxed class to store validated List payloads | +| record | [UnevaluateditemsDependsOnMultipleNestedContains.Schema1BoxedMap](#schema1boxedmap)
    boxed class to store validated Map payloads | +| static class | [UnevaluateditemsDependsOnMultipleNestedContains.Schema1](#schema1)
    schema class | +| sealed interface | [UnevaluateditemsDependsOnMultipleNestedContains.Contains1Boxed](#contains1boxed)
    sealed interface for validated payloads | +| record | [UnevaluateditemsDependsOnMultipleNestedContains.Contains1BoxedVoid](#contains1boxedvoid)
    boxed class to store validated null payloads | +| record | [UnevaluateditemsDependsOnMultipleNestedContains.Contains1BoxedBoolean](#contains1boxedboolean)
    boxed class to store validated boolean payloads | +| record | [UnevaluateditemsDependsOnMultipleNestedContains.Contains1BoxedNumber](#contains1boxednumber)
    boxed class to store validated Number payloads | +| record | [UnevaluateditemsDependsOnMultipleNestedContains.Contains1BoxedString](#contains1boxedstring)
    boxed class to store validated String payloads | +| record | [UnevaluateditemsDependsOnMultipleNestedContains.Contains1BoxedList](#contains1boxedlist)
    boxed class to store validated List payloads | +| record | [UnevaluateditemsDependsOnMultipleNestedContains.Contains1BoxedMap](#contains1boxedmap)
    boxed class to store validated Map payloads | +| static class | [UnevaluateditemsDependsOnMultipleNestedContains.Contains1](#contains1)
    schema class | +| sealed interface | [UnevaluateditemsDependsOnMultipleNestedContains.Schema0Boxed](#schema0boxed)
    sealed interface for validated payloads | +| record | [UnevaluateditemsDependsOnMultipleNestedContains.Schema0BoxedVoid](#schema0boxedvoid)
    boxed class to store validated null payloads | +| record | [UnevaluateditemsDependsOnMultipleNestedContains.Schema0BoxedBoolean](#schema0boxedboolean)
    boxed class to store validated boolean payloads | +| record | [UnevaluateditemsDependsOnMultipleNestedContains.Schema0BoxedNumber](#schema0boxednumber)
    boxed class to store validated Number payloads | +| record | [UnevaluateditemsDependsOnMultipleNestedContains.Schema0BoxedString](#schema0boxedstring)
    boxed class to store validated String payloads | +| record | [UnevaluateditemsDependsOnMultipleNestedContains.Schema0BoxedList](#schema0boxedlist)
    boxed class to store validated List payloads | +| record | [UnevaluateditemsDependsOnMultipleNestedContains.Schema0BoxedMap](#schema0boxedmap)
    boxed class to store validated Map payloads | +| static class | [UnevaluateditemsDependsOnMultipleNestedContains.Schema0](#schema0)
    schema class | +| sealed interface | [UnevaluateditemsDependsOnMultipleNestedContains.ContainsBoxed](#containsboxed)
    sealed interface for validated payloads | +| record | [UnevaluateditemsDependsOnMultipleNestedContains.ContainsBoxedVoid](#containsboxedvoid)
    boxed class to store validated null payloads | +| record | [UnevaluateditemsDependsOnMultipleNestedContains.ContainsBoxedBoolean](#containsboxedboolean)
    boxed class to store validated boolean payloads | +| record | [UnevaluateditemsDependsOnMultipleNestedContains.ContainsBoxedNumber](#containsboxednumber)
    boxed class to store validated Number payloads | +| record | [UnevaluateditemsDependsOnMultipleNestedContains.ContainsBoxedString](#containsboxedstring)
    boxed class to store validated String payloads | +| record | [UnevaluateditemsDependsOnMultipleNestedContains.ContainsBoxedList](#containsboxedlist)
    boxed class to store validated List payloads | +| record | [UnevaluateditemsDependsOnMultipleNestedContains.ContainsBoxedMap](#containsboxedmap)
    boxed class to store validated Map payloads | +| static class | [UnevaluateditemsDependsOnMultipleNestedContains.Contains](#contains)
    schema class | + +## UnevaluateditemsDependsOnMultipleNestedContains1Boxed +sealed interface UnevaluateditemsDependsOnMultipleNestedContains1Boxed
    +permits
    +[UnevaluateditemsDependsOnMultipleNestedContains1BoxedVoid](#unevaluateditemsdependsonmultiplenestedcontains1boxedvoid), +[UnevaluateditemsDependsOnMultipleNestedContains1BoxedBoolean](#unevaluateditemsdependsonmultiplenestedcontains1boxedboolean), +[UnevaluateditemsDependsOnMultipleNestedContains1BoxedNumber](#unevaluateditemsdependsonmultiplenestedcontains1boxednumber), +[UnevaluateditemsDependsOnMultipleNestedContains1BoxedString](#unevaluateditemsdependsonmultiplenestedcontains1boxedstring), +[UnevaluateditemsDependsOnMultipleNestedContains1BoxedList](#unevaluateditemsdependsonmultiplenestedcontains1boxedlist), +[UnevaluateditemsDependsOnMultipleNestedContains1BoxedMap](#unevaluateditemsdependsonmultiplenestedcontains1boxedmap) + +sealed interface that stores validated payloads using boxed classes + +## UnevaluateditemsDependsOnMultipleNestedContains1BoxedVoid +data class UnevaluateditemsDependsOnMultipleNestedContains1BoxedVoid
    +implements [UnevaluateditemsDependsOnMultipleNestedContains1Boxed](#unevaluateditemsdependsonmultiplenestedcontains1boxed) + +data class that stores validated null payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| UnevaluateditemsDependsOnMultipleNestedContains1BoxedVoid(Nothing? data)
    Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| Nothing? | data()
    validated payload | +| Any? | getData()
    validated payload | + +## UnevaluateditemsDependsOnMultipleNestedContains1BoxedBoolean +data class UnevaluateditemsDependsOnMultipleNestedContains1BoxedBoolean
    +implements [UnevaluateditemsDependsOnMultipleNestedContains1Boxed](#unevaluateditemsdependsonmultiplenestedcontains1boxed) + +record that stores validated boolean payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| UnevaluateditemsDependsOnMultipleNestedContains1BoxedBoolean(boolean data)
    Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| boolean | data()
    validated payload | +| Any? | getData()
    validated payload | + +## UnevaluateditemsDependsOnMultipleNestedContains1BoxedNumber +data class UnevaluateditemsDependsOnMultipleNestedContains1BoxedNumber
    +implements [UnevaluateditemsDependsOnMultipleNestedContains1Boxed](#unevaluateditemsdependsonmultiplenestedcontains1boxed) + +data class that stores validated Number payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| UnevaluateditemsDependsOnMultipleNestedContains1BoxedNumber(Number data)
    Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| Number | data()
    validated payload | +| Any? | getData()
    validated payload | + +## UnevaluateditemsDependsOnMultipleNestedContains1BoxedString +data class UnevaluateditemsDependsOnMultipleNestedContains1BoxedString
    +implements [UnevaluateditemsDependsOnMultipleNestedContains1Boxed](#unevaluateditemsdependsonmultiplenestedcontains1boxed) + +data class that stores validated String payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| UnevaluateditemsDependsOnMultipleNestedContains1BoxedString(String data)
    Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| String | data()
    validated payload | +| Any? | getData()
    validated payload | + +## UnevaluateditemsDependsOnMultipleNestedContains1BoxedList +data class UnevaluateditemsDependsOnMultipleNestedContains1BoxedList
    +implements [UnevaluateditemsDependsOnMultipleNestedContains1Boxed](#unevaluateditemsdependsonmultiplenestedcontains1boxed) + +data class that stores validated List payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| UnevaluateditemsDependsOnMultipleNestedContains1BoxedList(FrozenList data)
    Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| FrozenList | data()
    validated payload | +| Any? | getData()
    validated payload | + +## UnevaluateditemsDependsOnMultipleNestedContains1BoxedMap +data class UnevaluateditemsDependsOnMultipleNestedContains1BoxedMap
    +implements [UnevaluateditemsDependsOnMultipleNestedContains1Boxed](#unevaluateditemsdependsonmultiplenestedcontains1boxed) + +data class that stores validated Map payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| UnevaluateditemsDependsOnMultipleNestedContains1BoxedMap(FrozenMap data)
    Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| FrozenMap | data()
    validated payload | +| Any? | getData()
    validated payload | + +## UnevaluateditemsDependsOnMultipleNestedContains1 +class UnevaluateditemsDependsOnMultipleNestedContains1
    +extends JsonSchema + +A schema class that validates payloads + +### Field Summary +| Modifier and Type | Field and Description | +| ----------------- | ---------------------- | +| List> | allOf = listOf(
        [Schema0::class.java](#schema0),
        [Schema1::class.java](#schema1)
    ;)
    | +| Class | unevaluatedItems = [UnevaluatedItems::class.java](#unevaluateditems) | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| String | validate(arg: String, configuration: SchemaConfiguration) | +| Nothing? | validate(arg: Nothing?, configuration: SchemaConfiguration) | +| int | validate(arg: int, configuration: SchemaConfiguration) | +| long | validate(arg: long, configuration: SchemaConfiguration) | +| float | validate(arg: float, configuration: SchemaConfiguration) | +| double | validate(arg: double, configuration: SchemaConfiguration) | +| Number | validate(arg: Number, configuration: SchemaConfiguration) | +| boolean | validate(arg: boolean, configuration: SchemaConfiguration) | +| FrozenMap | validate(arg: Map<?, ?>, configuration: SchemaConfiguration) | +| FrozenList | validate(arg: List<*>, configuration: SchemaConfiguration) | +| [UnevaluateditemsDependsOnMultipleNestedContains1BoxedString](#unevaluateditemsdependsonmultiplenestedcontains1boxedstring) | validateAndBox(String, configuration: SchemaConfiguration) | +| [UnevaluateditemsDependsOnMultipleNestedContains1BoxedVoid](#unevaluateditemsdependsonmultiplenestedcontains1boxedvoid) | validateAndBox(Nothing?, configuration: SchemaConfiguration) | +| [UnevaluateditemsDependsOnMultipleNestedContains1BoxedNumber](#unevaluateditemsdependsonmultiplenestedcontains1boxednumber) | validateAndBox(Number, configuration: SchemaConfiguration) | +| [UnevaluateditemsDependsOnMultipleNestedContains1BoxedBoolean](#unevaluateditemsdependsonmultiplenestedcontains1boxedboolean) | validateAndBox(boolean, configuration: SchemaConfiguration) | +| [UnevaluateditemsDependsOnMultipleNestedContains1BoxedMap](#unevaluateditemsdependsonmultiplenestedcontains1boxedmap) | validateAndBox(Map<?, ?>, configuration: SchemaConfiguration) | +| [UnevaluateditemsDependsOnMultipleNestedContains1BoxedList](#unevaluateditemsdependsonmultiplenestedcontains1boxedlist) | validateAndBox(List<*>, configuration: SchemaConfiguration) | +| [UnevaluateditemsDependsOnMultipleNestedContains1Boxed](#unevaluateditemsdependsonmultiplenestedcontains1boxed) | validateAndBox(Any?, configuration: SchemaConfiguration) | +| Any? | validate(arg: Any?, configuration: SchemaConfiguration) | + +## UnevaluatedItemsBoxed +sealed interface UnevaluatedItemsBoxed
    +permits
    +[UnevaluatedItemsBoxedVoid](#unevaluateditemsboxedvoid), +[UnevaluatedItemsBoxedBoolean](#unevaluateditemsboxedboolean), +[UnevaluatedItemsBoxedNumber](#unevaluateditemsboxednumber), +[UnevaluatedItemsBoxedString](#unevaluateditemsboxedstring), +[UnevaluatedItemsBoxedList](#unevaluateditemsboxedlist), +[UnevaluatedItemsBoxedMap](#unevaluateditemsboxedmap) + +sealed interface that stores validated payloads using boxed classes + +## UnevaluatedItemsBoxedVoid +data class UnevaluatedItemsBoxedVoid
    +implements [UnevaluatedItemsBoxed](#unevaluateditemsboxed) + +data class that stores validated null payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| UnevaluatedItemsBoxedVoid(Nothing? data)
    Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| Nothing? | data()
    validated payload | +| Any? | getData()
    validated payload | + +## UnevaluatedItemsBoxedBoolean +data class UnevaluatedItemsBoxedBoolean
    +implements [UnevaluatedItemsBoxed](#unevaluateditemsboxed) + +record that stores validated boolean payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| UnevaluatedItemsBoxedBoolean(boolean data)
    Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| boolean | data()
    validated payload | +| Any? | getData()
    validated payload | + +## UnevaluatedItemsBoxedNumber +data class UnevaluatedItemsBoxedNumber
    +implements [UnevaluatedItemsBoxed](#unevaluateditemsboxed) + +data class that stores validated Number payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| UnevaluatedItemsBoxedNumber(Number data)
    Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| Number | data()
    validated payload | +| Any? | getData()
    validated payload | + +## UnevaluatedItemsBoxedString +data class UnevaluatedItemsBoxedString
    +implements [UnevaluatedItemsBoxed](#unevaluateditemsboxed) + +data class that stores validated String payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| UnevaluatedItemsBoxedString(String data)
    Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| String | data()
    validated payload | +| Any? | getData()
    validated payload | + +## UnevaluatedItemsBoxedList +data class UnevaluatedItemsBoxedList
    +implements [UnevaluatedItemsBoxed](#unevaluateditemsboxed) + +data class that stores validated List payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| UnevaluatedItemsBoxedList(FrozenList data)
    Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| FrozenList | data()
    validated payload | +| Any? | getData()
    validated payload | + +## UnevaluatedItemsBoxedMap +data class UnevaluatedItemsBoxedMap
    +implements [UnevaluatedItemsBoxed](#unevaluateditemsboxed) + +data class that stores validated Map payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| UnevaluatedItemsBoxedMap(FrozenMap data)
    Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| FrozenMap | data()
    validated payload | +| Any? | getData()
    validated payload | + +## UnevaluatedItems +class UnevaluatedItems
    +extends JsonSchema + +A schema class that validates payloads + +### Field Summary +| Modifier and Type | Field and Description | +| ----------------- | ---------------------- | +| BigDecimal | multipleOf = BigDecimal("5") | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| String | validate(arg: String, configuration: SchemaConfiguration) | +| Nothing? | validate(arg: Nothing?, configuration: SchemaConfiguration) | +| int | validate(arg: int, configuration: SchemaConfiguration) | +| long | validate(arg: long, configuration: SchemaConfiguration) | +| float | validate(arg: float, configuration: SchemaConfiguration) | +| double | validate(arg: double, configuration: SchemaConfiguration) | +| Number | validate(arg: Number, configuration: SchemaConfiguration) | +| boolean | validate(arg: boolean, configuration: SchemaConfiguration) | +| FrozenMap | validate(arg: Map<?, ?>, configuration: SchemaConfiguration) | +| FrozenList | validate(arg: List<*>, configuration: SchemaConfiguration) | +| [UnevaluatedItemsBoxedString](#unevaluateditemsboxedstring) | validateAndBox(String, configuration: SchemaConfiguration) | +| [UnevaluatedItemsBoxedVoid](#unevaluateditemsboxedvoid) | validateAndBox(Nothing?, configuration: SchemaConfiguration) | +| [UnevaluatedItemsBoxedNumber](#unevaluateditemsboxednumber) | validateAndBox(Number, configuration: SchemaConfiguration) | +| [UnevaluatedItemsBoxedBoolean](#unevaluateditemsboxedboolean) | validateAndBox(boolean, configuration: SchemaConfiguration) | +| [UnevaluatedItemsBoxedMap](#unevaluateditemsboxedmap) | validateAndBox(Map<?, ?>, configuration: SchemaConfiguration) | +| [UnevaluatedItemsBoxedList](#unevaluateditemsboxedlist) | validateAndBox(List<*>, configuration: SchemaConfiguration) | +| [UnevaluatedItemsBoxed](#unevaluateditemsboxed) | validateAndBox(Any?, configuration: SchemaConfiguration) | +| Any? | validate(arg: Any?, configuration: SchemaConfiguration) | + +## Schema1Boxed +sealed interface Schema1Boxed
    +permits
    +[Schema1BoxedVoid](#schema1boxedvoid), +[Schema1BoxedBoolean](#schema1boxedboolean), +[Schema1BoxedNumber](#schema1boxednumber), +[Schema1BoxedString](#schema1boxedstring), +[Schema1BoxedList](#schema1boxedlist), +[Schema1BoxedMap](#schema1boxedmap) + +sealed interface that stores validated payloads using boxed classes + +## Schema1BoxedVoid +data class Schema1BoxedVoid
    +implements [Schema1Boxed](#schema1boxed) + +data class that stores validated null payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| Schema1BoxedVoid(Nothing? data)
    Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| Nothing? | data()
    validated payload | +| Any? | getData()
    validated payload | + +## Schema1BoxedBoolean +data class Schema1BoxedBoolean
    +implements [Schema1Boxed](#schema1boxed) + +record that stores validated boolean payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| Schema1BoxedBoolean(boolean data)
    Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| boolean | data()
    validated payload | +| Any? | getData()
    validated payload | + +## Schema1BoxedNumber +data class Schema1BoxedNumber
    +implements [Schema1Boxed](#schema1boxed) + +data class that stores validated Number payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| Schema1BoxedNumber(Number data)
    Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| Number | data()
    validated payload | +| Any? | getData()
    validated payload | + +## Schema1BoxedString +data class Schema1BoxedString
    +implements [Schema1Boxed](#schema1boxed) + +data class that stores validated String payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| Schema1BoxedString(String data)
    Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| String | data()
    validated payload | +| Any? | getData()
    validated payload | + +## Schema1BoxedList +data class Schema1BoxedList
    +implements [Schema1Boxed](#schema1boxed) + +data class that stores validated List payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| Schema1BoxedList(FrozenList data)
    Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| FrozenList | data()
    validated payload | +| Any? | getData()
    validated payload | + +## Schema1BoxedMap +data class Schema1BoxedMap
    +implements [Schema1Boxed](#schema1boxed) + +data class that stores validated Map payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| Schema1BoxedMap(FrozenMap data)
    Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| FrozenMap | data()
    validated payload | +| Any? | getData()
    validated payload | + +## Schema1 +class Schema1
    +extends JsonSchema + +A schema class that validates payloads + +### Field Summary +| Modifier and Type | Field and Description | +| ----------------- | ---------------------- | +| Class | contains = [Contains1::class.java](#contains1) | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| String | validate(arg: String, configuration: SchemaConfiguration) | +| Nothing? | validate(arg: Nothing?, configuration: SchemaConfiguration) | +| int | validate(arg: int, configuration: SchemaConfiguration) | +| long | validate(arg: long, configuration: SchemaConfiguration) | +| float | validate(arg: float, configuration: SchemaConfiguration) | +| double | validate(arg: double, configuration: SchemaConfiguration) | +| Number | validate(arg: Number, configuration: SchemaConfiguration) | +| boolean | validate(arg: boolean, configuration: SchemaConfiguration) | +| FrozenMap | validate(arg: Map<?, ?>, configuration: SchemaConfiguration) | +| FrozenList | validate(arg: List<*>, configuration: SchemaConfiguration) | +| [Schema1BoxedString](#schema1boxedstring) | validateAndBox(String, configuration: SchemaConfiguration) | +| [Schema1BoxedVoid](#schema1boxedvoid) | validateAndBox(Nothing?, configuration: SchemaConfiguration) | +| [Schema1BoxedNumber](#schema1boxednumber) | validateAndBox(Number, configuration: SchemaConfiguration) | +| [Schema1BoxedBoolean](#schema1boxedboolean) | validateAndBox(boolean, configuration: SchemaConfiguration) | +| [Schema1BoxedMap](#schema1boxedmap) | validateAndBox(Map<?, ?>, configuration: SchemaConfiguration) | +| [Schema1BoxedList](#schema1boxedlist) | validateAndBox(List<*>, configuration: SchemaConfiguration) | +| [Schema1Boxed](#schema1boxed) | validateAndBox(Any?, configuration: SchemaConfiguration) | +| Any? | validate(arg: Any?, configuration: SchemaConfiguration) | + +## Contains1Boxed +sealed interface Contains1Boxed
    +permits
    +[Contains1BoxedVoid](#contains1boxedvoid), +[Contains1BoxedBoolean](#contains1boxedboolean), +[Contains1BoxedNumber](#contains1boxednumber), +[Contains1BoxedString](#contains1boxedstring), +[Contains1BoxedList](#contains1boxedlist), +[Contains1BoxedMap](#contains1boxedmap) + +sealed interface that stores validated payloads using boxed classes + +## Contains1BoxedVoid +data class Contains1BoxedVoid
    +implements [Contains1Boxed](#contains1boxed) + +data class that stores validated null payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| Contains1BoxedVoid(Nothing? data)
    Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| Nothing? | data()
    validated payload | +| Any? | getData()
    validated payload | + +## Contains1BoxedBoolean +data class Contains1BoxedBoolean
    +implements [Contains1Boxed](#contains1boxed) + +record that stores validated boolean payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| Contains1BoxedBoolean(boolean data)
    Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| boolean | data()
    validated payload | +| Any? | getData()
    validated payload | + +## Contains1BoxedNumber +data class Contains1BoxedNumber
    +implements [Contains1Boxed](#contains1boxed) + +data class that stores validated Number payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| Contains1BoxedNumber(Number data)
    Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| Number | data()
    validated payload | +| Any? | getData()
    validated payload | + +## Contains1BoxedString +data class Contains1BoxedString
    +implements [Contains1Boxed](#contains1boxed) + +data class that stores validated String payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| Contains1BoxedString(String data)
    Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| String | data()
    validated payload | +| Any? | getData()
    validated payload | + +## Contains1BoxedList +data class Contains1BoxedList
    +implements [Contains1Boxed](#contains1boxed) + +data class that stores validated List payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| Contains1BoxedList(FrozenList data)
    Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| FrozenList | data()
    validated payload | +| Any? | getData()
    validated payload | + +## Contains1BoxedMap +data class Contains1BoxedMap
    +implements [Contains1Boxed](#contains1boxed) + +data class that stores validated Map payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| Contains1BoxedMap(FrozenMap data)
    Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| FrozenMap | data()
    validated payload | +| Any? | getData()
    validated payload | + +## Contains1 +class Contains1
    +extends JsonSchema + +A schema class that validates payloads + +### Field Summary +| Modifier and Type | Field and Description | +| ----------------- | ---------------------- | +| BigDecimal | multipleOf = BigDecimal("3") | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| String | validate(arg: String, configuration: SchemaConfiguration) | +| Nothing? | validate(arg: Nothing?, configuration: SchemaConfiguration) | +| int | validate(arg: int, configuration: SchemaConfiguration) | +| long | validate(arg: long, configuration: SchemaConfiguration) | +| float | validate(arg: float, configuration: SchemaConfiguration) | +| double | validate(arg: double, configuration: SchemaConfiguration) | +| Number | validate(arg: Number, configuration: SchemaConfiguration) | +| boolean | validate(arg: boolean, configuration: SchemaConfiguration) | +| FrozenMap | validate(arg: Map<?, ?>, configuration: SchemaConfiguration) | +| FrozenList | validate(arg: List<*>, configuration: SchemaConfiguration) | +| [Contains1BoxedString](#contains1boxedstring) | validateAndBox(String, configuration: SchemaConfiguration) | +| [Contains1BoxedVoid](#contains1boxedvoid) | validateAndBox(Nothing?, configuration: SchemaConfiguration) | +| [Contains1BoxedNumber](#contains1boxednumber) | validateAndBox(Number, configuration: SchemaConfiguration) | +| [Contains1BoxedBoolean](#contains1boxedboolean) | validateAndBox(boolean, configuration: SchemaConfiguration) | +| [Contains1BoxedMap](#contains1boxedmap) | validateAndBox(Map<?, ?>, configuration: SchemaConfiguration) | +| [Contains1BoxedList](#contains1boxedlist) | validateAndBox(List<*>, configuration: SchemaConfiguration) | +| [Contains1Boxed](#contains1boxed) | validateAndBox(Any?, configuration: SchemaConfiguration) | +| Any? | validate(arg: Any?, configuration: SchemaConfiguration) | + +## Schema0Boxed +sealed interface Schema0Boxed
    +permits
    +[Schema0BoxedVoid](#schema0boxedvoid), +[Schema0BoxedBoolean](#schema0boxedboolean), +[Schema0BoxedNumber](#schema0boxednumber), +[Schema0BoxedString](#schema0boxedstring), +[Schema0BoxedList](#schema0boxedlist), +[Schema0BoxedMap](#schema0boxedmap) + +sealed interface that stores validated payloads using boxed classes + +## Schema0BoxedVoid +data class Schema0BoxedVoid
    +implements [Schema0Boxed](#schema0boxed) + +data class that stores validated null payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| Schema0BoxedVoid(Nothing? data)
    Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| Nothing? | data()
    validated payload | +| Any? | getData()
    validated payload | + +## Schema0BoxedBoolean +data class Schema0BoxedBoolean
    +implements [Schema0Boxed](#schema0boxed) + +record that stores validated boolean payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| Schema0BoxedBoolean(boolean data)
    Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| boolean | data()
    validated payload | +| Any? | getData()
    validated payload | + +## Schema0BoxedNumber +data class Schema0BoxedNumber
    +implements [Schema0Boxed](#schema0boxed) + +data class that stores validated Number payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| Schema0BoxedNumber(Number data)
    Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| Number | data()
    validated payload | +| Any? | getData()
    validated payload | + +## Schema0BoxedString +data class Schema0BoxedString
    +implements [Schema0Boxed](#schema0boxed) + +data class that stores validated String payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| Schema0BoxedString(String data)
    Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| String | data()
    validated payload | +| Any? | getData()
    validated payload | + +## Schema0BoxedList +data class Schema0BoxedList
    +implements [Schema0Boxed](#schema0boxed) + +data class that stores validated List payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| Schema0BoxedList(FrozenList data)
    Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| FrozenList | data()
    validated payload | +| Any? | getData()
    validated payload | + +## Schema0BoxedMap +data class Schema0BoxedMap
    +implements [Schema0Boxed](#schema0boxed) + +data class that stores validated Map payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| Schema0BoxedMap(FrozenMap data)
    Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| FrozenMap | data()
    validated payload | +| Any? | getData()
    validated payload | + +## Schema0 +class Schema0
    +extends JsonSchema + +A schema class that validates payloads + +### Field Summary +| Modifier and Type | Field and Description | +| ----------------- | ---------------------- | +| Class | contains = [Contains::class.java](#contains) | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| String | validate(arg: String, configuration: SchemaConfiguration) | +| Nothing? | validate(arg: Nothing?, configuration: SchemaConfiguration) | +| int | validate(arg: int, configuration: SchemaConfiguration) | +| long | validate(arg: long, configuration: SchemaConfiguration) | +| float | validate(arg: float, configuration: SchemaConfiguration) | +| double | validate(arg: double, configuration: SchemaConfiguration) | +| Number | validate(arg: Number, configuration: SchemaConfiguration) | +| boolean | validate(arg: boolean, configuration: SchemaConfiguration) | +| FrozenMap | validate(arg: Map<?, ?>, configuration: SchemaConfiguration) | +| FrozenList | validate(arg: List<*>, configuration: SchemaConfiguration) | +| [Schema0BoxedString](#schema0boxedstring) | validateAndBox(String, configuration: SchemaConfiguration) | +| [Schema0BoxedVoid](#schema0boxedvoid) | validateAndBox(Nothing?, configuration: SchemaConfiguration) | +| [Schema0BoxedNumber](#schema0boxednumber) | validateAndBox(Number, configuration: SchemaConfiguration) | +| [Schema0BoxedBoolean](#schema0boxedboolean) | validateAndBox(boolean, configuration: SchemaConfiguration) | +| [Schema0BoxedMap](#schema0boxedmap) | validateAndBox(Map<?, ?>, configuration: SchemaConfiguration) | +| [Schema0BoxedList](#schema0boxedlist) | validateAndBox(List<*>, configuration: SchemaConfiguration) | +| [Schema0Boxed](#schema0boxed) | validateAndBox(Any?, configuration: SchemaConfiguration) | +| Any? | validate(arg: Any?, configuration: SchemaConfiguration) | + +## ContainsBoxed +sealed interface ContainsBoxed
    +permits
    +[ContainsBoxedVoid](#containsboxedvoid), +[ContainsBoxedBoolean](#containsboxedboolean), +[ContainsBoxedNumber](#containsboxednumber), +[ContainsBoxedString](#containsboxedstring), +[ContainsBoxedList](#containsboxedlist), +[ContainsBoxedMap](#containsboxedmap) + +sealed interface that stores validated payloads using boxed classes + +## ContainsBoxedVoid +data class ContainsBoxedVoid
    +implements [ContainsBoxed](#containsboxed) + +data class that stores validated null payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| ContainsBoxedVoid(Nothing? data)
    Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| Nothing? | data()
    validated payload | +| Any? | getData()
    validated payload | + +## ContainsBoxedBoolean +data class ContainsBoxedBoolean
    +implements [ContainsBoxed](#containsboxed) + +record that stores validated boolean payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| ContainsBoxedBoolean(boolean data)
    Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| boolean | data()
    validated payload | +| Any? | getData()
    validated payload | + +## ContainsBoxedNumber +data class ContainsBoxedNumber
    +implements [ContainsBoxed](#containsboxed) + +data class that stores validated Number payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| ContainsBoxedNumber(Number data)
    Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| Number | data()
    validated payload | +| Any? | getData()
    validated payload | + +## ContainsBoxedString +data class ContainsBoxedString
    +implements [ContainsBoxed](#containsboxed) + +data class that stores validated String payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| ContainsBoxedString(String data)
    Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| String | data()
    validated payload | +| Any? | getData()
    validated payload | + +## ContainsBoxedList +data class ContainsBoxedList
    +implements [ContainsBoxed](#containsboxed) + +data class that stores validated List payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| ContainsBoxedList(FrozenList data)
    Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| FrozenList | data()
    validated payload | +| Any? | getData()
    validated payload | + +## ContainsBoxedMap +data class ContainsBoxedMap
    +implements [ContainsBoxed](#containsboxed) + +data class that stores validated Map payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| ContainsBoxedMap(FrozenMap data)
    Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| FrozenMap | data()
    validated payload | +| Any? | getData()
    validated payload | + +## Contains +class Contains
    +extends JsonSchema + +A schema class that validates payloads + +### Field Summary +| Modifier and Type | Field and Description | +| ----------------- | ---------------------- | +| BigDecimal | multipleOf = BigDecimal("2") | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| String | validate(arg: String, configuration: SchemaConfiguration) | +| Nothing? | validate(arg: Nothing?, configuration: SchemaConfiguration) | +| int | validate(arg: int, configuration: SchemaConfiguration) | +| long | validate(arg: long, configuration: SchemaConfiguration) | +| float | validate(arg: float, configuration: SchemaConfiguration) | +| double | validate(arg: double, configuration: SchemaConfiguration) | +| Number | validate(arg: Number, configuration: SchemaConfiguration) | +| boolean | validate(arg: boolean, configuration: SchemaConfiguration) | +| FrozenMap | validate(arg: Map<?, ?>, configuration: SchemaConfiguration) | +| FrozenList | validate(arg: List<*>, configuration: SchemaConfiguration) | +| [ContainsBoxedString](#containsboxedstring) | validateAndBox(String, configuration: SchemaConfiguration) | +| [ContainsBoxedVoid](#containsboxedvoid) | validateAndBox(Nothing?, configuration: SchemaConfiguration) | +| [ContainsBoxedNumber](#containsboxednumber) | validateAndBox(Number, configuration: SchemaConfiguration) | +| [ContainsBoxedBoolean](#containsboxedboolean) | validateAndBox(boolean, configuration: SchemaConfiguration) | +| [ContainsBoxedMap](#containsboxedmap) | validateAndBox(Map<?, ?>, configuration: SchemaConfiguration) | +| [ContainsBoxedList](#containsboxedlist) | validateAndBox(List<*>, configuration: SchemaConfiguration) | +| [ContainsBoxed](#containsboxed) | validateAndBox(Any?, configuration: SchemaConfiguration) | +| Any? | validate(arg: Any?, configuration: SchemaConfiguration) | + +[[Back to top]](#top) [[Back to Component Schemas]](../../../README.md#Component-Schemas) [[Back to README]](../../../README.md) diff --git a/samples/client/3_1_0_unit_test/kotlin/docs/components/schemas/UnevaluateditemsWithItems.md b/samples/client/3_1_0_unit_test/kotlin/docs/components/schemas/UnevaluateditemsWithItems.md new file mode 100644 index 00000000000..70c4884ae7a --- /dev/null +++ b/samples/client/3_1_0_unit_test/kotlin/docs/components/schemas/UnevaluateditemsWithItems.md @@ -0,0 +1,201 @@ +# UnevaluateditemsWithItems +org.openapijsonschematools.client.components.schemas.UnevaluateditemsWithItems.java +class UnevaluateditemsWithItems
    + +A class that contains necessary nested +- schema classes (which validate payloads), extends JsonSchema +- sealed interfaces which store validated payloads, Kotlin version of a sum type +- boxed classes which store validated payloads, sealed permits class implementations +- classes to store validated list payloads, extends FrozenList +- classes to build inputs for list payloads + +## Nested Class Summary +| Modifier and Type | Class and Description | +| ----------------- | ---------------------- | +| sealed interface | [UnevaluateditemsWithItems.UnevaluateditemsWithItems1Boxed](#unevaluateditemswithitems1boxed)
    sealed interface for validated payloads | +| record | [UnevaluateditemsWithItems.UnevaluateditemsWithItems1BoxedList](#unevaluateditemswithitems1boxedlist)
    boxed class to store validated List payloads | +| static class | [UnevaluateditemsWithItems.UnevaluateditemsWithItems1](#unevaluateditemswithitems1)
    schema class | +| sealed interface | [UnevaluateditemsWithItems.UnevaluatedItemsBoxed](#unevaluateditemsboxed)
    sealed interface for validated payloads | +| record | [UnevaluateditemsWithItems.UnevaluatedItemsBoxedString](#unevaluateditemsboxedstring)
    boxed class to store validated String payloads | +| static class | [UnevaluateditemsWithItems.UnevaluatedItems](#unevaluateditems)
    schema class | +| static class | [UnevaluateditemsWithItems.UnevaluateditemsWithItemsListBuilder](#unevaluateditemswithitemslistbuilder)
    builder for List payloads | +| static class | [UnevaluateditemsWithItems.UnevaluateditemsWithItemsList](#unevaluateditemswithitemslist)
    output class for List payloads | +| sealed interface | [UnevaluateditemsWithItems.ItemsBoxed](#itemsboxed)
    sealed interface for validated payloads | +| record | [UnevaluateditemsWithItems.ItemsBoxedNumber](#itemsboxednumber)
    boxed class to store validated Number payloads | +| static class | [UnevaluateditemsWithItems.Items](#items)
    schema class | + +## UnevaluateditemsWithItems1Boxed +sealed interface UnevaluateditemsWithItems1Boxed
    +permits
    +[UnevaluateditemsWithItems1BoxedList](#unevaluateditemswithitems1boxedlist) + +sealed interface that stores validated payloads using boxed classes + +## UnevaluateditemsWithItems1BoxedList +data class UnevaluateditemsWithItems1BoxedList
    +implements [UnevaluateditemsWithItems1Boxed](#unevaluateditemswithitems1boxed) + +data class that stores validated List payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| UnevaluateditemsWithItems1BoxedList([UnevaluateditemsWithItemsList](#unevaluateditemswithitemslist) data)
    Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| [UnevaluateditemsWithItemsList](#unevaluateditemswithitemslist) | data()
    validated payload | +| Any? | getData()
    validated payload | + +## UnevaluateditemsWithItems1 +class UnevaluateditemsWithItems1
    +extends JsonSchema + +A schema class that validates payloads + +### Code Sample +``` +import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags; +import org.openapijsonschematools.client.configurations.SchemaConfiguration; +import org.openapijsonschematools.client.exceptions.ValidationException; +import org.openapijsonschematools.client.schemas.validation.MapUtils; +import org.openapijsonschematools.client.schemas.validation.FrozenList; +import org.openapijsonschematools.client.schemas.validation.FrozenMap; +import org.openapijsonschematools.client.components.schemas.UnevaluateditemsWithItems; + +import java.util.Arrays; +import java.util.List; +import java.util.AbstractMap; + +static final SchemaConfiguration configuration = new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().build()); + +// List validation +UnevaluateditemsWithItems.UnevaluateditemsWithItemsList validatedPayload = + UnevaluateditemsWithItems.UnevaluateditemsWithItems1.validate( + new UnevaluateditemsWithItems.UnevaluateditemsWithItemsListBuilder() + .add(1) + + .build(), + configuration +); +``` + +### Field Summary +| Modifier and Type | Field and Description | +| ----------------- | ---------------------- | +| Set> | type = setOf(List::class.java) | +| Class | items = [Items::class.java](#items) | +| Class | unevaluatedItems = [UnevaluatedItems::class.java](#unevaluateditems) | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| [UnevaluateditemsWithItemsList](#unevaluateditemswithitemslist) | validate(arg: [List<*>](#unevaluateditemswithitemslistbuilder), configuration: SchemaConfiguration) | +| [UnevaluateditemsWithItems1BoxedList](#unevaluateditemswithitems1boxedlist) | validateAndBox([List<*>](#unevaluateditemswithitemslistbuilder), configuration: SchemaConfiguration) | +| [UnevaluateditemsWithItems1Boxed](#unevaluateditemswithitems1boxed) | validateAndBox(Any?, configuration: SchemaConfiguration) | +| Any? | validate(arg: Any?, configuration: SchemaConfiguration) | + +## UnevaluatedItemsBoxed +sealed interface UnevaluatedItemsBoxed
    +permits
    +[UnevaluatedItemsBoxedString](#unevaluateditemsboxedstring) + +sealed interface that stores validated payloads using boxed classes + +## UnevaluatedItemsBoxedString +data class UnevaluatedItemsBoxedString
    +implements [UnevaluatedItemsBoxed](#unevaluateditemsboxed) + +data class that stores validated String payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| UnevaluatedItemsBoxedString(String data)
    Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| String | data()
    validated payload | +| Any? | getData()
    validated payload | + +## UnevaluatedItems +class UnevaluatedItems
    +extends StringJsonSchema.StringJsonSchema1 + +A schema class that validates payloads + +| Methods Inherited from class org.openapijsonschematools.client.schemas.StringJsonSchema.StringJsonSchema1 | +| ------------------------------------------------------------------ | +| validate | +| validateAndBox | + +## UnevaluateditemsWithItemsListBuilder +class UnevaluateditemsWithItemsListBuilder
    +builder for `List` + +A class that builds the List input type + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| UnevaluateditemsWithItemsListBuilder()
    Creates an empty list | +| UnevaluateditemsWithItemsListBuilder(List items)
    Stores the items in a list | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| UnevaluateditemsWithItemsListBuilder | add(item: Int) | +| UnevaluateditemsWithItemsListBuilder | add(item: Float) | +| UnevaluateditemsWithItemsListBuilder | add(item: Long) | +| UnevaluateditemsWithItemsListBuilder | add(item: Double) | +| List | build()
    Returns list input that should be used with Schema.validate | + +## UnevaluateditemsWithItemsList +class UnevaluateditemsWithItemsList
    +extends `FrozenList` + +A class to store validated List payloads + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| static [UnevaluateditemsWithItemsList](#unevaluateditemswithitemslist) | of([List](#unevaluateditemswithitemslistbuilder) arg, SchemaConfiguration configuration) | + +## ItemsBoxed +sealed interface ItemsBoxed
    +permits
    +[ItemsBoxedNumber](#itemsboxednumber) + +sealed interface that stores validated payloads using boxed classes + +## ItemsBoxedNumber +data class ItemsBoxedNumber
    +implements [ItemsBoxed](#itemsboxed) + +data class that stores validated Number payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| ItemsBoxedNumber(Number data)
    Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| Number | data()
    validated payload | +| Any? | getData()
    validated payload | + +## Items +class Items
    +extends NumberJsonSchema.NumberJsonSchema1 + +A schema class that validates payloads + +| Methods Inherited from class org.openapijsonschematools.client.schemas.NumberJsonSchema.NumberJsonSchema1 | +| ------------------------------------------------------------------ | +| validate | +| validateAndBox | + +[[Back to top]](#top) [[Back to Component Schemas]](../../../README.md#Component-Schemas) [[Back to README]](../../../README.md) diff --git a/samples/client/3_1_0_unit_test/kotlin/docs/components/schemas/UnevaluateditemsWithNullInstanceElements.md b/samples/client/3_1_0_unit_test/kotlin/docs/components/schemas/UnevaluateditemsWithNullInstanceElements.md new file mode 100644 index 00000000000..e2c1ce930f5 --- /dev/null +++ b/samples/client/3_1_0_unit_test/kotlin/docs/components/schemas/UnevaluateditemsWithNullInstanceElements.md @@ -0,0 +1,207 @@ +# UnevaluateditemsWithNullInstanceElements +org.openapijsonschematools.client.components.schemas.UnevaluateditemsWithNullInstanceElements.java +class UnevaluateditemsWithNullInstanceElements
    + +A class that contains necessary nested +- schema classes (which validate payloads), extends JsonSchema +- sealed interfaces which store validated payloads, Kotlin version of a sum type +- boxed classes which store validated payloads, sealed permits class implementations + +## Nested Class Summary +| Modifier and Type | Class and Description | +| ----------------- | ---------------------- | +| sealed interface | [UnevaluateditemsWithNullInstanceElements.UnevaluateditemsWithNullInstanceElements1Boxed](#unevaluateditemswithnullinstanceelements1boxed)
    sealed interface for validated payloads | +| record | [UnevaluateditemsWithNullInstanceElements.UnevaluateditemsWithNullInstanceElements1BoxedVoid](#unevaluateditemswithnullinstanceelements1boxedvoid)
    boxed class to store validated null payloads | +| record | [UnevaluateditemsWithNullInstanceElements.UnevaluateditemsWithNullInstanceElements1BoxedBoolean](#unevaluateditemswithnullinstanceelements1boxedboolean)
    boxed class to store validated boolean payloads | +| record | [UnevaluateditemsWithNullInstanceElements.UnevaluateditemsWithNullInstanceElements1BoxedNumber](#unevaluateditemswithnullinstanceelements1boxednumber)
    boxed class to store validated Number payloads | +| record | [UnevaluateditemsWithNullInstanceElements.UnevaluateditemsWithNullInstanceElements1BoxedString](#unevaluateditemswithnullinstanceelements1boxedstring)
    boxed class to store validated String payloads | +| record | [UnevaluateditemsWithNullInstanceElements.UnevaluateditemsWithNullInstanceElements1BoxedList](#unevaluateditemswithnullinstanceelements1boxedlist)
    boxed class to store validated List payloads | +| record | [UnevaluateditemsWithNullInstanceElements.UnevaluateditemsWithNullInstanceElements1BoxedMap](#unevaluateditemswithnullinstanceelements1boxedmap)
    boxed class to store validated Map payloads | +| static class | [UnevaluateditemsWithNullInstanceElements.UnevaluateditemsWithNullInstanceElements1](#unevaluateditemswithnullinstanceelements1)
    schema class | +| sealed interface | [UnevaluateditemsWithNullInstanceElements.UnevaluatedItemsBoxed](#unevaluateditemsboxed)
    sealed interface for validated payloads | +| record | [UnevaluateditemsWithNullInstanceElements.UnevaluatedItemsBoxedVoid](#unevaluateditemsboxedvoid)
    boxed class to store validated null payloads | +| static class | [UnevaluateditemsWithNullInstanceElements.UnevaluatedItems](#unevaluateditems)
    schema class | + +## UnevaluateditemsWithNullInstanceElements1Boxed +sealed interface UnevaluateditemsWithNullInstanceElements1Boxed
    +permits
    +[UnevaluateditemsWithNullInstanceElements1BoxedVoid](#unevaluateditemswithnullinstanceelements1boxedvoid), +[UnevaluateditemsWithNullInstanceElements1BoxedBoolean](#unevaluateditemswithnullinstanceelements1boxedboolean), +[UnevaluateditemsWithNullInstanceElements1BoxedNumber](#unevaluateditemswithnullinstanceelements1boxednumber), +[UnevaluateditemsWithNullInstanceElements1BoxedString](#unevaluateditemswithnullinstanceelements1boxedstring), +[UnevaluateditemsWithNullInstanceElements1BoxedList](#unevaluateditemswithnullinstanceelements1boxedlist), +[UnevaluateditemsWithNullInstanceElements1BoxedMap](#unevaluateditemswithnullinstanceelements1boxedmap) + +sealed interface that stores validated payloads using boxed classes + +## UnevaluateditemsWithNullInstanceElements1BoxedVoid +data class UnevaluateditemsWithNullInstanceElements1BoxedVoid
    +implements [UnevaluateditemsWithNullInstanceElements1Boxed](#unevaluateditemswithnullinstanceelements1boxed) + +data class that stores validated null payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| UnevaluateditemsWithNullInstanceElements1BoxedVoid(Nothing? data)
    Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| Nothing? | data()
    validated payload | +| Any? | getData()
    validated payload | + +## UnevaluateditemsWithNullInstanceElements1BoxedBoolean +data class UnevaluateditemsWithNullInstanceElements1BoxedBoolean
    +implements [UnevaluateditemsWithNullInstanceElements1Boxed](#unevaluateditemswithnullinstanceelements1boxed) + +record that stores validated boolean payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| UnevaluateditemsWithNullInstanceElements1BoxedBoolean(boolean data)
    Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| boolean | data()
    validated payload | +| Any? | getData()
    validated payload | + +## UnevaluateditemsWithNullInstanceElements1BoxedNumber +data class UnevaluateditemsWithNullInstanceElements1BoxedNumber
    +implements [UnevaluateditemsWithNullInstanceElements1Boxed](#unevaluateditemswithnullinstanceelements1boxed) + +data class that stores validated Number payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| UnevaluateditemsWithNullInstanceElements1BoxedNumber(Number data)
    Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| Number | data()
    validated payload | +| Any? | getData()
    validated payload | + +## UnevaluateditemsWithNullInstanceElements1BoxedString +data class UnevaluateditemsWithNullInstanceElements1BoxedString
    +implements [UnevaluateditemsWithNullInstanceElements1Boxed](#unevaluateditemswithnullinstanceelements1boxed) + +data class that stores validated String payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| UnevaluateditemsWithNullInstanceElements1BoxedString(String data)
    Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| String | data()
    validated payload | +| Any? | getData()
    validated payload | + +## UnevaluateditemsWithNullInstanceElements1BoxedList +data class UnevaluateditemsWithNullInstanceElements1BoxedList
    +implements [UnevaluateditemsWithNullInstanceElements1Boxed](#unevaluateditemswithnullinstanceelements1boxed) + +data class that stores validated List payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| UnevaluateditemsWithNullInstanceElements1BoxedList(FrozenList data)
    Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| FrozenList | data()
    validated payload | +| Any? | getData()
    validated payload | + +## UnevaluateditemsWithNullInstanceElements1BoxedMap +data class UnevaluateditemsWithNullInstanceElements1BoxedMap
    +implements [UnevaluateditemsWithNullInstanceElements1Boxed](#unevaluateditemswithnullinstanceelements1boxed) + +data class that stores validated Map payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| UnevaluateditemsWithNullInstanceElements1BoxedMap(FrozenMap data)
    Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| FrozenMap | data()
    validated payload | +| Any? | getData()
    validated payload | + +## UnevaluateditemsWithNullInstanceElements1 +class UnevaluateditemsWithNullInstanceElements1
    +extends JsonSchema + +A schema class that validates payloads + +### Field Summary +| Modifier and Type | Field and Description | +| ----------------- | ---------------------- | +| Class | unevaluatedItems = [UnevaluatedItems::class.java](#unevaluateditems) | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| String | validate(arg: String, configuration: SchemaConfiguration) | +| Nothing? | validate(arg: Nothing?, configuration: SchemaConfiguration) | +| int | validate(arg: int, configuration: SchemaConfiguration) | +| long | validate(arg: long, configuration: SchemaConfiguration) | +| float | validate(arg: float, configuration: SchemaConfiguration) | +| double | validate(arg: double, configuration: SchemaConfiguration) | +| Number | validate(arg: Number, configuration: SchemaConfiguration) | +| boolean | validate(arg: boolean, configuration: SchemaConfiguration) | +| FrozenMap | validate(arg: Map<?, ?>, configuration: SchemaConfiguration) | +| FrozenList | validate(arg: List<*>, configuration: SchemaConfiguration) | +| [UnevaluateditemsWithNullInstanceElements1BoxedString](#unevaluateditemswithnullinstanceelements1boxedstring) | validateAndBox(String, configuration: SchemaConfiguration) | +| [UnevaluateditemsWithNullInstanceElements1BoxedVoid](#unevaluateditemswithnullinstanceelements1boxedvoid) | validateAndBox(Nothing?, configuration: SchemaConfiguration) | +| [UnevaluateditemsWithNullInstanceElements1BoxedNumber](#unevaluateditemswithnullinstanceelements1boxednumber) | validateAndBox(Number, configuration: SchemaConfiguration) | +| [UnevaluateditemsWithNullInstanceElements1BoxedBoolean](#unevaluateditemswithnullinstanceelements1boxedboolean) | validateAndBox(boolean, configuration: SchemaConfiguration) | +| [UnevaluateditemsWithNullInstanceElements1BoxedMap](#unevaluateditemswithnullinstanceelements1boxedmap) | validateAndBox(Map<?, ?>, configuration: SchemaConfiguration) | +| [UnevaluateditemsWithNullInstanceElements1BoxedList](#unevaluateditemswithnullinstanceelements1boxedlist) | validateAndBox(List<*>, configuration: SchemaConfiguration) | +| [UnevaluateditemsWithNullInstanceElements1Boxed](#unevaluateditemswithnullinstanceelements1boxed) | validateAndBox(Any?, configuration: SchemaConfiguration) | +| Any? | validate(arg: Any?, configuration: SchemaConfiguration) | + +## UnevaluatedItemsBoxed +sealed interface UnevaluatedItemsBoxed
    +permits
    +[UnevaluatedItemsBoxedVoid](#unevaluateditemsboxedvoid) + +sealed interface that stores validated payloads using boxed classes + +## UnevaluatedItemsBoxedVoid +data class UnevaluatedItemsBoxedVoid
    +implements [UnevaluatedItemsBoxed](#unevaluateditemsboxed) + +data class that stores validated null payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| UnevaluatedItemsBoxedVoid(Nothing? data)
    Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| Nothing? | data()
    validated payload | +| Any? | getData()
    validated payload | + +## UnevaluatedItems +class UnevaluatedItems
    +extends NullJsonSchema.NullJsonSchema1 + +A schema class that validates payloads + +| Methods Inherited from class org.openapijsonschematools.client.schemas.NullJsonSchema.NullJsonSchema1 | +| ------------------------------------------------------------------ | +| validate | +| validateAndBox | + +[[Back to top]](#top) [[Back to Component Schemas]](../../../README.md#Component-Schemas) [[Back to README]](../../../README.md) diff --git a/samples/client/3_1_0_unit_test/kotlin/docs/components/schemas/UnevaluatedpropertiesNotAffectedByPropertynames.md b/samples/client/3_1_0_unit_test/kotlin/docs/components/schemas/UnevaluatedpropertiesNotAffectedByPropertynames.md new file mode 100644 index 00000000000..b9ad4fec267 --- /dev/null +++ b/samples/client/3_1_0_unit_test/kotlin/docs/components/schemas/UnevaluatedpropertiesNotAffectedByPropertynames.md @@ -0,0 +1,278 @@ +# UnevaluatedpropertiesNotAffectedByPropertynames +org.openapijsonschematools.client.components.schemas.UnevaluatedpropertiesNotAffectedByPropertynames.java +class UnevaluatedpropertiesNotAffectedByPropertynames
    + +A class that contains necessary nested +- schema classes (which validate payloads), extends JsonSchema +- sealed interfaces which store validated payloads, Kotlin version of a sum type +- boxed classes which store validated payloads, sealed permits class implementations + +## Nested Class Summary +| Modifier and Type | Class and Description | +| ----------------- | ---------------------- | +| sealed interface | [UnevaluatedpropertiesNotAffectedByPropertynames.UnevaluatedpropertiesNotAffectedByPropertynames1Boxed](#unevaluatedpropertiesnotaffectedbypropertynames1boxed)
    sealed interface for validated payloads | +| record | [UnevaluatedpropertiesNotAffectedByPropertynames.UnevaluatedpropertiesNotAffectedByPropertynames1BoxedVoid](#unevaluatedpropertiesnotaffectedbypropertynames1boxedvoid)
    boxed class to store validated null payloads | +| record | [UnevaluatedpropertiesNotAffectedByPropertynames.UnevaluatedpropertiesNotAffectedByPropertynames1BoxedBoolean](#unevaluatedpropertiesnotaffectedbypropertynames1boxedboolean)
    boxed class to store validated boolean payloads | +| record | [UnevaluatedpropertiesNotAffectedByPropertynames.UnevaluatedpropertiesNotAffectedByPropertynames1BoxedNumber](#unevaluatedpropertiesnotaffectedbypropertynames1boxednumber)
    boxed class to store validated Number payloads | +| record | [UnevaluatedpropertiesNotAffectedByPropertynames.UnevaluatedpropertiesNotAffectedByPropertynames1BoxedString](#unevaluatedpropertiesnotaffectedbypropertynames1boxedstring)
    boxed class to store validated String payloads | +| record | [UnevaluatedpropertiesNotAffectedByPropertynames.UnevaluatedpropertiesNotAffectedByPropertynames1BoxedList](#unevaluatedpropertiesnotaffectedbypropertynames1boxedlist)
    boxed class to store validated List payloads | +| record | [UnevaluatedpropertiesNotAffectedByPropertynames.UnevaluatedpropertiesNotAffectedByPropertynames1BoxedMap](#unevaluatedpropertiesnotaffectedbypropertynames1boxedmap)
    boxed class to store validated Map payloads | +| static class | [UnevaluatedpropertiesNotAffectedByPropertynames.UnevaluatedpropertiesNotAffectedByPropertynames1](#unevaluatedpropertiesnotaffectedbypropertynames1)
    schema class | +| sealed interface | [UnevaluatedpropertiesNotAffectedByPropertynames.UnevaluatedPropertiesBoxed](#unevaluatedpropertiesboxed)
    sealed interface for validated payloads | +| record | [UnevaluatedpropertiesNotAffectedByPropertynames.UnevaluatedPropertiesBoxedNumber](#unevaluatedpropertiesboxednumber)
    boxed class to store validated Number payloads | +| static class | [UnevaluatedpropertiesNotAffectedByPropertynames.UnevaluatedProperties](#unevaluatedproperties)
    schema class | +| sealed interface | [UnevaluatedpropertiesNotAffectedByPropertynames.PropertyNamesBoxed](#propertynamesboxed)
    sealed interface for validated payloads | +| record | [UnevaluatedpropertiesNotAffectedByPropertynames.PropertyNamesBoxedString](#propertynamesboxedstring)
    boxed class to store validated String payloads | +| static class | [UnevaluatedpropertiesNotAffectedByPropertynames.PropertyNames](#propertynames)
    schema class | + +## UnevaluatedpropertiesNotAffectedByPropertynames1Boxed +sealed interface UnevaluatedpropertiesNotAffectedByPropertynames1Boxed
    +permits
    +[UnevaluatedpropertiesNotAffectedByPropertynames1BoxedVoid](#unevaluatedpropertiesnotaffectedbypropertynames1boxedvoid), +[UnevaluatedpropertiesNotAffectedByPropertynames1BoxedBoolean](#unevaluatedpropertiesnotaffectedbypropertynames1boxedboolean), +[UnevaluatedpropertiesNotAffectedByPropertynames1BoxedNumber](#unevaluatedpropertiesnotaffectedbypropertynames1boxednumber), +[UnevaluatedpropertiesNotAffectedByPropertynames1BoxedString](#unevaluatedpropertiesnotaffectedbypropertynames1boxedstring), +[UnevaluatedpropertiesNotAffectedByPropertynames1BoxedList](#unevaluatedpropertiesnotaffectedbypropertynames1boxedlist), +[UnevaluatedpropertiesNotAffectedByPropertynames1BoxedMap](#unevaluatedpropertiesnotaffectedbypropertynames1boxedmap) + +sealed interface that stores validated payloads using boxed classes + +## UnevaluatedpropertiesNotAffectedByPropertynames1BoxedVoid +data class UnevaluatedpropertiesNotAffectedByPropertynames1BoxedVoid
    +implements [UnevaluatedpropertiesNotAffectedByPropertynames1Boxed](#unevaluatedpropertiesnotaffectedbypropertynames1boxed) + +data class that stores validated null payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| UnevaluatedpropertiesNotAffectedByPropertynames1BoxedVoid(Nothing? data)
    Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| Nothing? | data()
    validated payload | +| Any? | getData()
    validated payload | + +## UnevaluatedpropertiesNotAffectedByPropertynames1BoxedBoolean +data class UnevaluatedpropertiesNotAffectedByPropertynames1BoxedBoolean
    +implements [UnevaluatedpropertiesNotAffectedByPropertynames1Boxed](#unevaluatedpropertiesnotaffectedbypropertynames1boxed) + +record that stores validated boolean payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| UnevaluatedpropertiesNotAffectedByPropertynames1BoxedBoolean(boolean data)
    Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| boolean | data()
    validated payload | +| Any? | getData()
    validated payload | + +## UnevaluatedpropertiesNotAffectedByPropertynames1BoxedNumber +data class UnevaluatedpropertiesNotAffectedByPropertynames1BoxedNumber
    +implements [UnevaluatedpropertiesNotAffectedByPropertynames1Boxed](#unevaluatedpropertiesnotaffectedbypropertynames1boxed) + +data class that stores validated Number payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| UnevaluatedpropertiesNotAffectedByPropertynames1BoxedNumber(Number data)
    Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| Number | data()
    validated payload | +| Any? | getData()
    validated payload | + +## UnevaluatedpropertiesNotAffectedByPropertynames1BoxedString +data class UnevaluatedpropertiesNotAffectedByPropertynames1BoxedString
    +implements [UnevaluatedpropertiesNotAffectedByPropertynames1Boxed](#unevaluatedpropertiesnotaffectedbypropertynames1boxed) + +data class that stores validated String payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| UnevaluatedpropertiesNotAffectedByPropertynames1BoxedString(String data)
    Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| String | data()
    validated payload | +| Any? | getData()
    validated payload | + +## UnevaluatedpropertiesNotAffectedByPropertynames1BoxedList +data class UnevaluatedpropertiesNotAffectedByPropertynames1BoxedList
    +implements [UnevaluatedpropertiesNotAffectedByPropertynames1Boxed](#unevaluatedpropertiesnotaffectedbypropertynames1boxed) + +data class that stores validated List payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| UnevaluatedpropertiesNotAffectedByPropertynames1BoxedList(FrozenList data)
    Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| FrozenList | data()
    validated payload | +| Any? | getData()
    validated payload | + +## UnevaluatedpropertiesNotAffectedByPropertynames1BoxedMap +data class UnevaluatedpropertiesNotAffectedByPropertynames1BoxedMap
    +implements [UnevaluatedpropertiesNotAffectedByPropertynames1Boxed](#unevaluatedpropertiesnotaffectedbypropertynames1boxed) + +data class that stores validated Map payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| UnevaluatedpropertiesNotAffectedByPropertynames1BoxedMap(FrozenMap data)
    Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| FrozenMap | data()
    validated payload | +| Any? | getData()
    validated payload | + +## UnevaluatedpropertiesNotAffectedByPropertynames1 +class UnevaluatedpropertiesNotAffectedByPropertynames1
    +extends JsonSchema + +A schema class that validates payloads + +### Field Summary +| Modifier and Type | Field and Description | +| ----------------- | ---------------------- | +| Class | propertyNames = [PropertyNames::class.java](#propertynames) | +| Class | unevaluatedProperties = [UnevaluatedProperties::class.java](#unevaluatedproperties) | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| String | validate(arg: String, configuration: SchemaConfiguration) | +| Nothing? | validate(arg: Nothing?, configuration: SchemaConfiguration) | +| int | validate(arg: int, configuration: SchemaConfiguration) | +| long | validate(arg: long, configuration: SchemaConfiguration) | +| float | validate(arg: float, configuration: SchemaConfiguration) | +| double | validate(arg: double, configuration: SchemaConfiguration) | +| Number | validate(arg: Number, configuration: SchemaConfiguration) | +| boolean | validate(arg: boolean, configuration: SchemaConfiguration) | +| FrozenMap | validate(arg: Map<?, ?>, configuration: SchemaConfiguration) | +| FrozenList | validate(arg: List<*>, configuration: SchemaConfiguration) | +| [UnevaluatedpropertiesNotAffectedByPropertynames1BoxedString](#unevaluatedpropertiesnotaffectedbypropertynames1boxedstring) | validateAndBox(String, configuration: SchemaConfiguration) | +| [UnevaluatedpropertiesNotAffectedByPropertynames1BoxedVoid](#unevaluatedpropertiesnotaffectedbypropertynames1boxedvoid) | validateAndBox(Nothing?, configuration: SchemaConfiguration) | +| [UnevaluatedpropertiesNotAffectedByPropertynames1BoxedNumber](#unevaluatedpropertiesnotaffectedbypropertynames1boxednumber) | validateAndBox(Number, configuration: SchemaConfiguration) | +| [UnevaluatedpropertiesNotAffectedByPropertynames1BoxedBoolean](#unevaluatedpropertiesnotaffectedbypropertynames1boxedboolean) | validateAndBox(boolean, configuration: SchemaConfiguration) | +| [UnevaluatedpropertiesNotAffectedByPropertynames1BoxedMap](#unevaluatedpropertiesnotaffectedbypropertynames1boxedmap) | validateAndBox(Map<?, ?>, configuration: SchemaConfiguration) | +| [UnevaluatedpropertiesNotAffectedByPropertynames1BoxedList](#unevaluatedpropertiesnotaffectedbypropertynames1boxedlist) | validateAndBox(List<*>, configuration: SchemaConfiguration) | +| [UnevaluatedpropertiesNotAffectedByPropertynames1Boxed](#unevaluatedpropertiesnotaffectedbypropertynames1boxed) | validateAndBox(Any?, configuration: SchemaConfiguration) | +| Any? | validate(arg: Any?, configuration: SchemaConfiguration) | + +## UnevaluatedPropertiesBoxed +sealed interface UnevaluatedPropertiesBoxed
    +permits
    +[UnevaluatedPropertiesBoxedNumber](#unevaluatedpropertiesboxednumber) + +sealed interface that stores validated payloads using boxed classes + +## UnevaluatedPropertiesBoxedNumber +data class UnevaluatedPropertiesBoxedNumber
    +implements [UnevaluatedPropertiesBoxed](#unevaluatedpropertiesboxed) + +data class that stores validated Number payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| UnevaluatedPropertiesBoxedNumber(Number data)
    Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| Number | data()
    validated payload | +| Any? | getData()
    validated payload | + +## UnevaluatedProperties +class UnevaluatedProperties
    +extends NumberJsonSchema.NumberJsonSchema1 + +A schema class that validates payloads + +| Methods Inherited from class org.openapijsonschematools.client.schemas.NumberJsonSchema.NumberJsonSchema1 | +| ------------------------------------------------------------------ | +| validate | +| validateAndBox | + +## PropertyNamesBoxed +sealed interface PropertyNamesBoxed
    +permits
    +[PropertyNamesBoxedString](#propertynamesboxedstring) + +sealed interface that stores validated payloads using boxed classes + +## PropertyNamesBoxedString +data class PropertyNamesBoxedString
    +implements [PropertyNamesBoxed](#propertynamesboxed) + +data class that stores validated String payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| PropertyNamesBoxedString(String data)
    Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| String | data()
    validated payload | +| Any? | getData()
    validated payload | + +## PropertyNames +class PropertyNames
    +extends JsonSchema + +A schema class that validates payloads + +### Code Sample +``` +import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags; +import org.openapijsonschematools.client.configurations.SchemaConfiguration; +import org.openapijsonschematools.client.exceptions.ValidationException; +import org.openapijsonschematools.client.schemas.validation.MapUtils; +import org.openapijsonschematools.client.schemas.validation.FrozenList; +import org.openapijsonschematools.client.schemas.validation.FrozenMap; +import org.openapijsonschematools.client.components.schemas.UnevaluatedpropertiesNotAffectedByPropertynames; + +import java.util.Arrays; +import java.util.List; +import java.util.AbstractMap; + +static final SchemaConfiguration configuration = new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().build()); + +// String validation +String validatedPayload = UnevaluatedpropertiesNotAffectedByPropertynames.PropertyNames.validate( + "a", + configuration +); +``` + +### Field Summary +| Modifier and Type | Field and Description | +| ----------------- | ---------------------- | +| Set> | type = setOf(
        String::class.java
    )
    | +| Integer | maxLength = 1 | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| String | validate(arg: String, configuration: SchemaConfiguration) | +| [PropertyNamesBoxedString](#propertynamesboxedstring) | validateAndBox(String, configuration: SchemaConfiguration) | +| [PropertyNamesBoxed](#propertynamesboxed) | validateAndBox(Any?, configuration: SchemaConfiguration) | +| Any? | validate(arg: Any?, configuration: SchemaConfiguration) | + +[[Back to top]](#top) [[Back to Component Schemas]](../../../README.md#Component-Schemas) [[Back to README]](../../../README.md) diff --git a/samples/client/3_1_0_unit_test/kotlin/docs/components/schemas/UnevaluatedpropertiesSchema.md b/samples/client/3_1_0_unit_test/kotlin/docs/components/schemas/UnevaluatedpropertiesSchema.md new file mode 100644 index 00000000000..fb7f627b176 --- /dev/null +++ b/samples/client/3_1_0_unit_test/kotlin/docs/components/schemas/UnevaluatedpropertiesSchema.md @@ -0,0 +1,131 @@ +# UnevaluatedpropertiesSchema +org.openapijsonschematools.client.components.schemas.UnevaluatedpropertiesSchema.java +class UnevaluatedpropertiesSchema
    + +A class that contains necessary nested +- schema classes (which validate payloads), extends JsonSchema +- sealed interfaces which store validated payloads, Kotlin version of a sum type +- boxed classes which store validated payloads, sealed permits class implementations + +## Nested Class Summary +| Modifier and Type | Class and Description | +| ----------------- | ---------------------- | +| sealed interface | [UnevaluatedpropertiesSchema.UnevaluatedpropertiesSchema1Boxed](#unevaluatedpropertiesschema1boxed)
    sealed interface for validated payloads | +| record | [UnevaluatedpropertiesSchema.UnevaluatedpropertiesSchema1BoxedMap](#unevaluatedpropertiesschema1boxedmap)
    boxed class to store validated Map payloads | +| static class | [UnevaluatedpropertiesSchema.UnevaluatedpropertiesSchema1](#unevaluatedpropertiesschema1)
    schema class | +| sealed interface | [UnevaluatedpropertiesSchema.UnevaluatedPropertiesBoxed](#unevaluatedpropertiesboxed)
    sealed interface for validated payloads | +| record | [UnevaluatedpropertiesSchema.UnevaluatedPropertiesBoxedString](#unevaluatedpropertiesboxedstring)
    boxed class to store validated String payloads | +| static class | [UnevaluatedpropertiesSchema.UnevaluatedProperties](#unevaluatedproperties)
    schema class | + +## UnevaluatedpropertiesSchema1Boxed +sealed interface UnevaluatedpropertiesSchema1Boxed
    +permits
    +[UnevaluatedpropertiesSchema1BoxedMap](#unevaluatedpropertiesschema1boxedmap) + +sealed interface that stores validated payloads using boxed classes + +## UnevaluatedpropertiesSchema1BoxedMap +data class UnevaluatedpropertiesSchema1BoxedMap
    +implements [UnevaluatedpropertiesSchema1Boxed](#unevaluatedpropertiesschema1boxed) + +data class that stores validated Map payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| UnevaluatedpropertiesSchema1BoxedMap(FrozenMap data)
    Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| FrozenMap | data()
    validated payload | +| Any? | getData()
    validated payload | + +## UnevaluatedpropertiesSchema1 +class UnevaluatedpropertiesSchema1
    +extends JsonSchema + +A schema class that validates payloads + +### Field Summary +| Modifier and Type | Field and Description | +| ----------------- | ---------------------- | +| Set> | type = setOf(Map::class.java) | +| Class | unevaluatedProperties = [UnevaluatedProperties::class.java](#unevaluatedproperties) | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| FrozenMap | validate(arg: Map<?, ?>, configuration: SchemaConfiguration) | +| [UnevaluatedpropertiesSchema1BoxedMap](#unevaluatedpropertiesschema1boxedmap) | validateAndBox(Map<?, ?>, configuration: SchemaConfiguration) | +| [UnevaluatedpropertiesSchema1Boxed](#unevaluatedpropertiesschema1boxed) | validateAndBox(Any?, configuration: SchemaConfiguration) | +| Any? | validate(arg: Any?, configuration: SchemaConfiguration) | + +## UnevaluatedPropertiesBoxed +sealed interface UnevaluatedPropertiesBoxed
    +permits
    +[UnevaluatedPropertiesBoxedString](#unevaluatedpropertiesboxedstring) + +sealed interface that stores validated payloads using boxed classes + +## UnevaluatedPropertiesBoxedString +data class UnevaluatedPropertiesBoxedString
    +implements [UnevaluatedPropertiesBoxed](#unevaluatedpropertiesboxed) + +data class that stores validated String payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| UnevaluatedPropertiesBoxedString(String data)
    Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| String | data()
    validated payload | +| Any? | getData()
    validated payload | + +## UnevaluatedProperties +class UnevaluatedProperties
    +extends JsonSchema + +A schema class that validates payloads + +### Code Sample +``` +import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags; +import org.openapijsonschematools.client.configurations.SchemaConfiguration; +import org.openapijsonschematools.client.exceptions.ValidationException; +import org.openapijsonschematools.client.schemas.validation.MapUtils; +import org.openapijsonschematools.client.schemas.validation.FrozenList; +import org.openapijsonschematools.client.schemas.validation.FrozenMap; +import org.openapijsonschematools.client.components.schemas.UnevaluatedpropertiesSchema; + +import java.util.Arrays; +import java.util.List; +import java.util.AbstractMap; + +static final SchemaConfiguration configuration = new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().build()); + +// String validation +String validatedPayload = UnevaluatedpropertiesSchema.UnevaluatedProperties.validate( + "a", + configuration +); +``` + +### Field Summary +| Modifier and Type | Field and Description | +| ----------------- | ---------------------- | +| Set> | type = setOf(
        String::class.java
    )
    | +| Integer | minLength = 3 | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| String | validate(arg: String, configuration: SchemaConfiguration) | +| [UnevaluatedPropertiesBoxedString](#unevaluatedpropertiesboxedstring) | validateAndBox(String, configuration: SchemaConfiguration) | +| [UnevaluatedPropertiesBoxed](#unevaluatedpropertiesboxed) | validateAndBox(Any?, configuration: SchemaConfiguration) | +| Any? | validate(arg: Any?, configuration: SchemaConfiguration) | + +[[Back to top]](#top) [[Back to Component Schemas]](../../../README.md#Component-Schemas) [[Back to README]](../../../README.md) diff --git a/samples/client/3_1_0_unit_test/kotlin/docs/components/schemas/UnevaluatedpropertiesWithAdjacentAdditionalproperties.md b/samples/client/3_1_0_unit_test/kotlin/docs/components/schemas/UnevaluatedpropertiesWithAdjacentAdditionalproperties.md new file mode 100644 index 00000000000..b2d9b45c536 --- /dev/null +++ b/samples/client/3_1_0_unit_test/kotlin/docs/components/schemas/UnevaluatedpropertiesWithAdjacentAdditionalproperties.md @@ -0,0 +1,437 @@ +# UnevaluatedpropertiesWithAdjacentAdditionalproperties +org.openapijsonschematools.client.components.schemas.UnevaluatedpropertiesWithAdjacentAdditionalproperties.java +class UnevaluatedpropertiesWithAdjacentAdditionalproperties
    + +A class that contains necessary nested +- schema classes (which validate payloads), extends JsonSchema +- sealed interfaces which store validated payloads, Kotlin version of a sum type +- boxed classes which store validated payloads, sealed permits class implementations +- classes to store validated map payloads, extends FrozenMap +- classes to build inputs for map payloads + +## Nested Class Summary +| Modifier and Type | Class and Description | +| ----------------- | ---------------------- | +| sealed interface | [UnevaluatedpropertiesWithAdjacentAdditionalproperties.UnevaluatedpropertiesWithAdjacentAdditionalproperties1Boxed](#unevaluatedpropertieswithadjacentadditionalproperties1boxed)
    sealed interface for validated payloads | +| record | [UnevaluatedpropertiesWithAdjacentAdditionalproperties.UnevaluatedpropertiesWithAdjacentAdditionalproperties1BoxedMap](#unevaluatedpropertieswithadjacentadditionalproperties1boxedmap)
    boxed class to store validated Map payloads | +| static class | [UnevaluatedpropertiesWithAdjacentAdditionalproperties.UnevaluatedpropertiesWithAdjacentAdditionalproperties1](#unevaluatedpropertieswithadjacentadditionalproperties1)
    schema class | +| sealed interface | [UnevaluatedpropertiesWithAdjacentAdditionalproperties.UnevaluatedPropertiesBoxed](#unevaluatedpropertiesboxed)
    sealed interface for validated payloads | +| record | [UnevaluatedpropertiesWithAdjacentAdditionalproperties.UnevaluatedPropertiesBoxedVoid](#unevaluatedpropertiesboxedvoid)
    boxed class to store validated null payloads | +| record | [UnevaluatedpropertiesWithAdjacentAdditionalproperties.UnevaluatedPropertiesBoxedBoolean](#unevaluatedpropertiesboxedboolean)
    boxed class to store validated boolean payloads | +| record | [UnevaluatedpropertiesWithAdjacentAdditionalproperties.UnevaluatedPropertiesBoxedNumber](#unevaluatedpropertiesboxednumber)
    boxed class to store validated Number payloads | +| record | [UnevaluatedpropertiesWithAdjacentAdditionalproperties.UnevaluatedPropertiesBoxedString](#unevaluatedpropertiesboxedstring)
    boxed class to store validated String payloads | +| record | [UnevaluatedpropertiesWithAdjacentAdditionalproperties.UnevaluatedPropertiesBoxedList](#unevaluatedpropertiesboxedlist)
    boxed class to store validated List payloads | +| record | [UnevaluatedpropertiesWithAdjacentAdditionalproperties.UnevaluatedPropertiesBoxedMap](#unevaluatedpropertiesboxedmap)
    boxed class to store validated Map payloads | +| static class | [UnevaluatedpropertiesWithAdjacentAdditionalproperties.UnevaluatedProperties](#unevaluatedproperties)
    schema class | +| static class | [UnevaluatedpropertiesWithAdjacentAdditionalproperties.UnevaluatedpropertiesWithAdjacentAdditionalpropertiesMapBuilder](#unevaluatedpropertieswithadjacentadditionalpropertiesmapbuilder)
    builder for Map payloads | +| static class | [UnevaluatedpropertiesWithAdjacentAdditionalproperties.UnevaluatedpropertiesWithAdjacentAdditionalpropertiesMap](#unevaluatedpropertieswithadjacentadditionalpropertiesmap)
    output class for Map payloads | +| sealed interface | [UnevaluatedpropertiesWithAdjacentAdditionalproperties.FooBoxed](#fooboxed)
    sealed interface for validated payloads | +| record | [UnevaluatedpropertiesWithAdjacentAdditionalproperties.FooBoxedString](#fooboxedstring)
    boxed class to store validated String payloads | +| static class | [UnevaluatedpropertiesWithAdjacentAdditionalproperties.Foo](#foo)
    schema class | +| sealed interface | [UnevaluatedpropertiesWithAdjacentAdditionalproperties.AdditionalPropertiesBoxed](#additionalpropertiesboxed)
    sealed interface for validated payloads | +| record | [UnevaluatedpropertiesWithAdjacentAdditionalproperties.AdditionalPropertiesBoxedVoid](#additionalpropertiesboxedvoid)
    boxed class to store validated null payloads | +| record | [UnevaluatedpropertiesWithAdjacentAdditionalproperties.AdditionalPropertiesBoxedBoolean](#additionalpropertiesboxedboolean)
    boxed class to store validated boolean payloads | +| record | [UnevaluatedpropertiesWithAdjacentAdditionalproperties.AdditionalPropertiesBoxedNumber](#additionalpropertiesboxednumber)
    boxed class to store validated Number payloads | +| record | [UnevaluatedpropertiesWithAdjacentAdditionalproperties.AdditionalPropertiesBoxedString](#additionalpropertiesboxedstring)
    boxed class to store validated String payloads | +| record | [UnevaluatedpropertiesWithAdjacentAdditionalproperties.AdditionalPropertiesBoxedList](#additionalpropertiesboxedlist)
    boxed class to store validated List payloads | +| record | [UnevaluatedpropertiesWithAdjacentAdditionalproperties.AdditionalPropertiesBoxedMap](#additionalpropertiesboxedmap)
    boxed class to store validated Map payloads | +| static class | [UnevaluatedpropertiesWithAdjacentAdditionalproperties.AdditionalProperties](#additionalproperties)
    schema class | + +## UnevaluatedpropertiesWithAdjacentAdditionalproperties1Boxed +sealed interface UnevaluatedpropertiesWithAdjacentAdditionalproperties1Boxed
    +permits
    +[UnevaluatedpropertiesWithAdjacentAdditionalproperties1BoxedMap](#unevaluatedpropertieswithadjacentadditionalproperties1boxedmap) + +sealed interface that stores validated payloads using boxed classes + +## UnevaluatedpropertiesWithAdjacentAdditionalproperties1BoxedMap +data class UnevaluatedpropertiesWithAdjacentAdditionalproperties1BoxedMap
    +implements [UnevaluatedpropertiesWithAdjacentAdditionalproperties1Boxed](#unevaluatedpropertieswithadjacentadditionalproperties1boxed) + +data class that stores validated Map payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| UnevaluatedpropertiesWithAdjacentAdditionalproperties1BoxedMap([UnevaluatedpropertiesWithAdjacentAdditionalpropertiesMap](#unevaluatedpropertieswithadjacentadditionalpropertiesmap) data)
    Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| [UnevaluatedpropertiesWithAdjacentAdditionalpropertiesMap](#unevaluatedpropertieswithadjacentadditionalpropertiesmap) | data()
    validated payload | +| Any? | getData()
    validated payload | + +## UnevaluatedpropertiesWithAdjacentAdditionalproperties1 +class UnevaluatedpropertiesWithAdjacentAdditionalproperties1
    +extends JsonSchema + +A schema class that validates payloads + +### Code Sample +``` +import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags; +import org.openapijsonschematools.client.configurations.SchemaConfiguration; +import org.openapijsonschematools.client.exceptions.ValidationException; +import org.openapijsonschematools.client.schemas.validation.MapUtils; +import org.openapijsonschematools.client.schemas.validation.FrozenList; +import org.openapijsonschematools.client.schemas.validation.FrozenMap; +import org.openapijsonschematools.client.components.schemas.UnevaluatedpropertiesWithAdjacentAdditionalproperties; + +import java.util.Arrays; +import java.util.List; +import java.util.AbstractMap; + +static final SchemaConfiguration configuration = new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().build()); + +// Map validation +UnevaluatedpropertiesWithAdjacentAdditionalproperties.UnevaluatedpropertiesWithAdjacentAdditionalpropertiesMap validatedPayload = + UnevaluatedpropertiesWithAdjacentAdditionalproperties.UnevaluatedpropertiesWithAdjacentAdditionalproperties1.validate( + new UnevaluatedpropertiesWithAdjacentAdditionalproperties.UnevaluatedpropertiesWithAdjacentAdditionalpropertiesMapBuilder() + .foo("a") + + .build(), + configuration +); +``` + +### Field Summary +| Modifier and Type | Field and Description | +| ----------------- | ---------------------- | +| Set> | type = setOf(Map::class.java) | +| Map> | properties = mapOf(
        "foo" to [Foo::class.java](#foo))
    )
    | +| Class | additionalProperties = [AdditionalProperties::class.java](#additionalproperties) | +| Class | unevaluatedProperties = [UnevaluatedProperties::class.java](#unevaluatedproperties) | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| [UnevaluatedpropertiesWithAdjacentAdditionalpropertiesMap](#unevaluatedpropertieswithadjacentadditionalpropertiesmap) | validate(arg: [Map<?, ?>](#unevaluatedpropertieswithadjacentadditionalpropertiesmapbuilder), configuration: SchemaConfiguration) | +| [UnevaluatedpropertiesWithAdjacentAdditionalproperties1BoxedMap](#unevaluatedpropertieswithadjacentadditionalproperties1boxedmap) | validateAndBox([Map<?, ?>](#unevaluatedpropertieswithadjacentadditionalpropertiesmapbuilder), configuration: SchemaConfiguration) | +| [UnevaluatedpropertiesWithAdjacentAdditionalproperties1Boxed](#unevaluatedpropertieswithadjacentadditionalproperties1boxed) | validateAndBox(Any?, configuration: SchemaConfiguration) | +| Any? | validate(arg: Any?, configuration: SchemaConfiguration) | + +## UnevaluatedPropertiesBoxed +sealed interface UnevaluatedPropertiesBoxed
    +permits
    +[UnevaluatedPropertiesBoxedVoid](#unevaluatedpropertiesboxedvoid), +[UnevaluatedPropertiesBoxedBoolean](#unevaluatedpropertiesboxedboolean), +[UnevaluatedPropertiesBoxedNumber](#unevaluatedpropertiesboxednumber), +[UnevaluatedPropertiesBoxedString](#unevaluatedpropertiesboxedstring), +[UnevaluatedPropertiesBoxedList](#unevaluatedpropertiesboxedlist), +[UnevaluatedPropertiesBoxedMap](#unevaluatedpropertiesboxedmap) + +sealed interface that stores validated payloads using boxed classes + +## UnevaluatedPropertiesBoxedVoid +data class UnevaluatedPropertiesBoxedVoid
    +implements [UnevaluatedPropertiesBoxed](#unevaluatedpropertiesboxed) + +data class that stores validated null payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| UnevaluatedPropertiesBoxedVoid(Nothing? data)
    Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| Nothing? | data()
    validated payload | +| Any? | getData()
    validated payload | + +## UnevaluatedPropertiesBoxedBoolean +data class UnevaluatedPropertiesBoxedBoolean
    +implements [UnevaluatedPropertiesBoxed](#unevaluatedpropertiesboxed) + +record that stores validated boolean payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| UnevaluatedPropertiesBoxedBoolean(boolean data)
    Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| boolean | data()
    validated payload | +| Any? | getData()
    validated payload | + +## UnevaluatedPropertiesBoxedNumber +data class UnevaluatedPropertiesBoxedNumber
    +implements [UnevaluatedPropertiesBoxed](#unevaluatedpropertiesboxed) + +data class that stores validated Number payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| UnevaluatedPropertiesBoxedNumber(Number data)
    Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| Number | data()
    validated payload | +| Any? | getData()
    validated payload | + +## UnevaluatedPropertiesBoxedString +data class UnevaluatedPropertiesBoxedString
    +implements [UnevaluatedPropertiesBoxed](#unevaluatedpropertiesboxed) + +data class that stores validated String payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| UnevaluatedPropertiesBoxedString(String data)
    Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| String | data()
    validated payload | +| Any? | getData()
    validated payload | + +## UnevaluatedPropertiesBoxedList +data class UnevaluatedPropertiesBoxedList
    +implements [UnevaluatedPropertiesBoxed](#unevaluatedpropertiesboxed) + +data class that stores validated List payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| UnevaluatedPropertiesBoxedList(FrozenList data)
    Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| FrozenList | data()
    validated payload | +| Any? | getData()
    validated payload | + +## UnevaluatedPropertiesBoxedMap +data class UnevaluatedPropertiesBoxedMap
    +implements [UnevaluatedPropertiesBoxed](#unevaluatedpropertiesboxed) + +data class that stores validated Map payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| UnevaluatedPropertiesBoxedMap(FrozenMap data)
    Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| FrozenMap | data()
    validated payload | +| Any? | getData()
    validated payload | + +## UnevaluatedProperties +class UnevaluatedProperties
    +extends NotAnyTypeJsonSchema.NotAnyTypeJsonSchema1 + +A schema class that validates payloads + +| Methods Inherited from class org.openapijsonschematools.client.schemas.NotAnyTypeJsonSchema.NotAnyTypeJsonSchema1 | +| ------------------------------------------------------------------ | +| validate | +| validateAndBox | + +## UnevaluatedpropertiesWithAdjacentAdditionalpropertiesMapBuilder +class UnevaluatedpropertiesWithAdjacentAdditionalpropertiesMapBuilder
    +builder for `Map` + +A class that builds the Map input type + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| UnevaluatedpropertiesWithAdjacentAdditionalpropertiesMapBuilder()
    Creates a builder that contains an empty map | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| Map | build()
    Returns map input that should be used with Schema.validate | +| [UnevaluatedpropertiesWithAdjacentAdditionalpropertiesMapBuilder](#unevaluatedpropertieswithadjacentadditionalpropertiesmapbuilder) | foo(value: String) | +| [UnevaluatedpropertiesWithAdjacentAdditionalpropertiesMapBuilder](#unevaluatedpropertieswithadjacentadditionalpropertiesmapbuilder) | additionalProperty(key: String, value: Nothing?) | +| [UnevaluatedpropertiesWithAdjacentAdditionalpropertiesMapBuilder](#unevaluatedpropertieswithadjacentadditionalpropertiesmapbuilder) | additionalProperty(key: String, value: Boolean) | +| [UnevaluatedpropertiesWithAdjacentAdditionalpropertiesMapBuilder](#unevaluatedpropertieswithadjacentadditionalpropertiesmapbuilder) | additionalProperty(key: String, value: String) | +| [UnevaluatedpropertiesWithAdjacentAdditionalpropertiesMapBuilder](#unevaluatedpropertieswithadjacentadditionalpropertiesmapbuilder) | additionalProperty(key: String, value: Int) | +| [UnevaluatedpropertiesWithAdjacentAdditionalpropertiesMapBuilder](#unevaluatedpropertieswithadjacentadditionalpropertiesmapbuilder) | additionalProperty(key: String, value: Float) | +| [UnevaluatedpropertiesWithAdjacentAdditionalpropertiesMapBuilder](#unevaluatedpropertieswithadjacentadditionalpropertiesmapbuilder) | additionalProperty(key: String, value: Long) | +| [UnevaluatedpropertiesWithAdjacentAdditionalpropertiesMapBuilder](#unevaluatedpropertieswithadjacentadditionalpropertiesmapbuilder) | additionalProperty(key: String, value: Double) | +| [UnevaluatedpropertiesWithAdjacentAdditionalpropertiesMapBuilder](#unevaluatedpropertieswithadjacentadditionalpropertiesmapbuilder) | additionalProperty(key: String, value: List) | +| [UnevaluatedpropertiesWithAdjacentAdditionalpropertiesMapBuilder](#unevaluatedpropertieswithadjacentadditionalpropertiesmapbuilder) | additionalProperty(key: String, value: Map) | + +## UnevaluatedpropertiesWithAdjacentAdditionalpropertiesMap +class UnevaluatedpropertiesWithAdjacentAdditionalpropertiesMap
    +extends FrozenMap + +A class to store validated Map payloads + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| static [UnevaluatedpropertiesWithAdjacentAdditionalpropertiesMap](#unevaluatedpropertieswithadjacentadditionalpropertiesmap) | of([Map](#unevaluatedpropertieswithadjacentadditionalpropertiesmapbuilder) arg, SchemaConfiguration configuration) | +| String | foo()
    [optional] | +| Any? | getAdditionalProperty(String name)
    provides type safety for additional properties | + +## FooBoxed +sealed interface FooBoxed
    +permits
    +[FooBoxedString](#fooboxedstring) + +sealed interface that stores validated payloads using boxed classes + +## FooBoxedString +data class FooBoxedString
    +implements [FooBoxed](#fooboxed) + +data class that stores validated String payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| FooBoxedString(String data)
    Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| String | data()
    validated payload | +| Any? | getData()
    validated payload | + +## Foo +class Foo
    +extends StringJsonSchema.StringJsonSchema1 + +A schema class that validates payloads + +| Methods Inherited from class org.openapijsonschematools.client.schemas.StringJsonSchema.StringJsonSchema1 | +| ------------------------------------------------------------------ | +| validate | +| validateAndBox | + +## AdditionalPropertiesBoxed +sealed interface AdditionalPropertiesBoxed
    +permits
    +[AdditionalPropertiesBoxedVoid](#additionalpropertiesboxedvoid), +[AdditionalPropertiesBoxedBoolean](#additionalpropertiesboxedboolean), +[AdditionalPropertiesBoxedNumber](#additionalpropertiesboxednumber), +[AdditionalPropertiesBoxedString](#additionalpropertiesboxedstring), +[AdditionalPropertiesBoxedList](#additionalpropertiesboxedlist), +[AdditionalPropertiesBoxedMap](#additionalpropertiesboxedmap) + +sealed interface that stores validated payloads using boxed classes + +## AdditionalPropertiesBoxedVoid +data class AdditionalPropertiesBoxedVoid
    +implements [AdditionalPropertiesBoxed](#additionalpropertiesboxed) + +data class that stores validated null payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| AdditionalPropertiesBoxedVoid(Nothing? data)
    Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| Nothing? | data()
    validated payload | +| Any? | getData()
    validated payload | + +## AdditionalPropertiesBoxedBoolean +data class AdditionalPropertiesBoxedBoolean
    +implements [AdditionalPropertiesBoxed](#additionalpropertiesboxed) + +record that stores validated boolean payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| AdditionalPropertiesBoxedBoolean(boolean data)
    Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| boolean | data()
    validated payload | +| Any? | getData()
    validated payload | + +## AdditionalPropertiesBoxedNumber +data class AdditionalPropertiesBoxedNumber
    +implements [AdditionalPropertiesBoxed](#additionalpropertiesboxed) + +data class that stores validated Number payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| AdditionalPropertiesBoxedNumber(Number data)
    Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| Number | data()
    validated payload | +| Any? | getData()
    validated payload | + +## AdditionalPropertiesBoxedString +data class AdditionalPropertiesBoxedString
    +implements [AdditionalPropertiesBoxed](#additionalpropertiesboxed) + +data class that stores validated String payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| AdditionalPropertiesBoxedString(String data)
    Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| String | data()
    validated payload | +| Any? | getData()
    validated payload | + +## AdditionalPropertiesBoxedList +data class AdditionalPropertiesBoxedList
    +implements [AdditionalPropertiesBoxed](#additionalpropertiesboxed) + +data class that stores validated List payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| AdditionalPropertiesBoxedList(FrozenList data)
    Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| FrozenList | data()
    validated payload | +| Any? | getData()
    validated payload | + +## AdditionalPropertiesBoxedMap +data class AdditionalPropertiesBoxedMap
    +implements [AdditionalPropertiesBoxed](#additionalpropertiesboxed) + +data class that stores validated Map payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| AdditionalPropertiesBoxedMap(FrozenMap data)
    Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| FrozenMap | data()
    validated payload | +| Any? | getData()
    validated payload | + +## AdditionalProperties +class AdditionalProperties
    +extends AnyTypeJsonSchema.AnyTypeJsonSchema1 + +A schema class that validates payloads + +| Methods Inherited from class org.openapijsonschematools.client.schemas.AnyTypeJsonSchema.AnyTypeJsonSchema1 | +| ------------------------------------------------------------------ | +| validate | +| validateAndBox | + +[[Back to top]](#top) [[Back to Component Schemas]](../../../README.md#Component-Schemas) [[Back to README]](../../../README.md) diff --git a/samples/client/3_1_0_unit_test/kotlin/docs/components/schemas/UnevaluatedpropertiesWithNullValuedInstanceProperties.md b/samples/client/3_1_0_unit_test/kotlin/docs/components/schemas/UnevaluatedpropertiesWithNullValuedInstanceProperties.md new file mode 100644 index 00000000000..af90c453785 --- /dev/null +++ b/samples/client/3_1_0_unit_test/kotlin/docs/components/schemas/UnevaluatedpropertiesWithNullValuedInstanceProperties.md @@ -0,0 +1,207 @@ +# UnevaluatedpropertiesWithNullValuedInstanceProperties +org.openapijsonschematools.client.components.schemas.UnevaluatedpropertiesWithNullValuedInstanceProperties.java +class UnevaluatedpropertiesWithNullValuedInstanceProperties
    + +A class that contains necessary nested +- schema classes (which validate payloads), extends JsonSchema +- sealed interfaces which store validated payloads, Kotlin version of a sum type +- boxed classes which store validated payloads, sealed permits class implementations + +## Nested Class Summary +| Modifier and Type | Class and Description | +| ----------------- | ---------------------- | +| sealed interface | [UnevaluatedpropertiesWithNullValuedInstanceProperties.UnevaluatedpropertiesWithNullValuedInstanceProperties1Boxed](#unevaluatedpropertieswithnullvaluedinstanceproperties1boxed)
    sealed interface for validated payloads | +| record | [UnevaluatedpropertiesWithNullValuedInstanceProperties.UnevaluatedpropertiesWithNullValuedInstanceProperties1BoxedVoid](#unevaluatedpropertieswithnullvaluedinstanceproperties1boxedvoid)
    boxed class to store validated null payloads | +| record | [UnevaluatedpropertiesWithNullValuedInstanceProperties.UnevaluatedpropertiesWithNullValuedInstanceProperties1BoxedBoolean](#unevaluatedpropertieswithnullvaluedinstanceproperties1boxedboolean)
    boxed class to store validated boolean payloads | +| record | [UnevaluatedpropertiesWithNullValuedInstanceProperties.UnevaluatedpropertiesWithNullValuedInstanceProperties1BoxedNumber](#unevaluatedpropertieswithnullvaluedinstanceproperties1boxednumber)
    boxed class to store validated Number payloads | +| record | [UnevaluatedpropertiesWithNullValuedInstanceProperties.UnevaluatedpropertiesWithNullValuedInstanceProperties1BoxedString](#unevaluatedpropertieswithnullvaluedinstanceproperties1boxedstring)
    boxed class to store validated String payloads | +| record | [UnevaluatedpropertiesWithNullValuedInstanceProperties.UnevaluatedpropertiesWithNullValuedInstanceProperties1BoxedList](#unevaluatedpropertieswithnullvaluedinstanceproperties1boxedlist)
    boxed class to store validated List payloads | +| record | [UnevaluatedpropertiesWithNullValuedInstanceProperties.UnevaluatedpropertiesWithNullValuedInstanceProperties1BoxedMap](#unevaluatedpropertieswithnullvaluedinstanceproperties1boxedmap)
    boxed class to store validated Map payloads | +| static class | [UnevaluatedpropertiesWithNullValuedInstanceProperties.UnevaluatedpropertiesWithNullValuedInstanceProperties1](#unevaluatedpropertieswithnullvaluedinstanceproperties1)
    schema class | +| sealed interface | [UnevaluatedpropertiesWithNullValuedInstanceProperties.UnevaluatedPropertiesBoxed](#unevaluatedpropertiesboxed)
    sealed interface for validated payloads | +| record | [UnevaluatedpropertiesWithNullValuedInstanceProperties.UnevaluatedPropertiesBoxedVoid](#unevaluatedpropertiesboxedvoid)
    boxed class to store validated null payloads | +| static class | [UnevaluatedpropertiesWithNullValuedInstanceProperties.UnevaluatedProperties](#unevaluatedproperties)
    schema class | + +## UnevaluatedpropertiesWithNullValuedInstanceProperties1Boxed +sealed interface UnevaluatedpropertiesWithNullValuedInstanceProperties1Boxed
    +permits
    +[UnevaluatedpropertiesWithNullValuedInstanceProperties1BoxedVoid](#unevaluatedpropertieswithnullvaluedinstanceproperties1boxedvoid), +[UnevaluatedpropertiesWithNullValuedInstanceProperties1BoxedBoolean](#unevaluatedpropertieswithnullvaluedinstanceproperties1boxedboolean), +[UnevaluatedpropertiesWithNullValuedInstanceProperties1BoxedNumber](#unevaluatedpropertieswithnullvaluedinstanceproperties1boxednumber), +[UnevaluatedpropertiesWithNullValuedInstanceProperties1BoxedString](#unevaluatedpropertieswithnullvaluedinstanceproperties1boxedstring), +[UnevaluatedpropertiesWithNullValuedInstanceProperties1BoxedList](#unevaluatedpropertieswithnullvaluedinstanceproperties1boxedlist), +[UnevaluatedpropertiesWithNullValuedInstanceProperties1BoxedMap](#unevaluatedpropertieswithnullvaluedinstanceproperties1boxedmap) + +sealed interface that stores validated payloads using boxed classes + +## UnevaluatedpropertiesWithNullValuedInstanceProperties1BoxedVoid +data class UnevaluatedpropertiesWithNullValuedInstanceProperties1BoxedVoid
    +implements [UnevaluatedpropertiesWithNullValuedInstanceProperties1Boxed](#unevaluatedpropertieswithnullvaluedinstanceproperties1boxed) + +data class that stores validated null payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| UnevaluatedpropertiesWithNullValuedInstanceProperties1BoxedVoid(Nothing? data)
    Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| Nothing? | data()
    validated payload | +| Any? | getData()
    validated payload | + +## UnevaluatedpropertiesWithNullValuedInstanceProperties1BoxedBoolean +data class UnevaluatedpropertiesWithNullValuedInstanceProperties1BoxedBoolean
    +implements [UnevaluatedpropertiesWithNullValuedInstanceProperties1Boxed](#unevaluatedpropertieswithnullvaluedinstanceproperties1boxed) + +record that stores validated boolean payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| UnevaluatedpropertiesWithNullValuedInstanceProperties1BoxedBoolean(boolean data)
    Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| boolean | data()
    validated payload | +| Any? | getData()
    validated payload | + +## UnevaluatedpropertiesWithNullValuedInstanceProperties1BoxedNumber +data class UnevaluatedpropertiesWithNullValuedInstanceProperties1BoxedNumber
    +implements [UnevaluatedpropertiesWithNullValuedInstanceProperties1Boxed](#unevaluatedpropertieswithnullvaluedinstanceproperties1boxed) + +data class that stores validated Number payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| UnevaluatedpropertiesWithNullValuedInstanceProperties1BoxedNumber(Number data)
    Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| Number | data()
    validated payload | +| Any? | getData()
    validated payload | + +## UnevaluatedpropertiesWithNullValuedInstanceProperties1BoxedString +data class UnevaluatedpropertiesWithNullValuedInstanceProperties1BoxedString
    +implements [UnevaluatedpropertiesWithNullValuedInstanceProperties1Boxed](#unevaluatedpropertieswithnullvaluedinstanceproperties1boxed) + +data class that stores validated String payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| UnevaluatedpropertiesWithNullValuedInstanceProperties1BoxedString(String data)
    Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| String | data()
    validated payload | +| Any? | getData()
    validated payload | + +## UnevaluatedpropertiesWithNullValuedInstanceProperties1BoxedList +data class UnevaluatedpropertiesWithNullValuedInstanceProperties1BoxedList
    +implements [UnevaluatedpropertiesWithNullValuedInstanceProperties1Boxed](#unevaluatedpropertieswithnullvaluedinstanceproperties1boxed) + +data class that stores validated List payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| UnevaluatedpropertiesWithNullValuedInstanceProperties1BoxedList(FrozenList data)
    Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| FrozenList | data()
    validated payload | +| Any? | getData()
    validated payload | + +## UnevaluatedpropertiesWithNullValuedInstanceProperties1BoxedMap +data class UnevaluatedpropertiesWithNullValuedInstanceProperties1BoxedMap
    +implements [UnevaluatedpropertiesWithNullValuedInstanceProperties1Boxed](#unevaluatedpropertieswithnullvaluedinstanceproperties1boxed) + +data class that stores validated Map payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| UnevaluatedpropertiesWithNullValuedInstanceProperties1BoxedMap(FrozenMap data)
    Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| FrozenMap | data()
    validated payload | +| Any? | getData()
    validated payload | + +## UnevaluatedpropertiesWithNullValuedInstanceProperties1 +class UnevaluatedpropertiesWithNullValuedInstanceProperties1
    +extends JsonSchema + +A schema class that validates payloads + +### Field Summary +| Modifier and Type | Field and Description | +| ----------------- | ---------------------- | +| Class | unevaluatedProperties = [UnevaluatedProperties::class.java](#unevaluatedproperties) | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| String | validate(arg: String, configuration: SchemaConfiguration) | +| Nothing? | validate(arg: Nothing?, configuration: SchemaConfiguration) | +| int | validate(arg: int, configuration: SchemaConfiguration) | +| long | validate(arg: long, configuration: SchemaConfiguration) | +| float | validate(arg: float, configuration: SchemaConfiguration) | +| double | validate(arg: double, configuration: SchemaConfiguration) | +| Number | validate(arg: Number, configuration: SchemaConfiguration) | +| boolean | validate(arg: boolean, configuration: SchemaConfiguration) | +| FrozenMap | validate(arg: Map<?, ?>, configuration: SchemaConfiguration) | +| FrozenList | validate(arg: List<*>, configuration: SchemaConfiguration) | +| [UnevaluatedpropertiesWithNullValuedInstanceProperties1BoxedString](#unevaluatedpropertieswithnullvaluedinstanceproperties1boxedstring) | validateAndBox(String, configuration: SchemaConfiguration) | +| [UnevaluatedpropertiesWithNullValuedInstanceProperties1BoxedVoid](#unevaluatedpropertieswithnullvaluedinstanceproperties1boxedvoid) | validateAndBox(Nothing?, configuration: SchemaConfiguration) | +| [UnevaluatedpropertiesWithNullValuedInstanceProperties1BoxedNumber](#unevaluatedpropertieswithnullvaluedinstanceproperties1boxednumber) | validateAndBox(Number, configuration: SchemaConfiguration) | +| [UnevaluatedpropertiesWithNullValuedInstanceProperties1BoxedBoolean](#unevaluatedpropertieswithnullvaluedinstanceproperties1boxedboolean) | validateAndBox(boolean, configuration: SchemaConfiguration) | +| [UnevaluatedpropertiesWithNullValuedInstanceProperties1BoxedMap](#unevaluatedpropertieswithnullvaluedinstanceproperties1boxedmap) | validateAndBox(Map<?, ?>, configuration: SchemaConfiguration) | +| [UnevaluatedpropertiesWithNullValuedInstanceProperties1BoxedList](#unevaluatedpropertieswithnullvaluedinstanceproperties1boxedlist) | validateAndBox(List<*>, configuration: SchemaConfiguration) | +| [UnevaluatedpropertiesWithNullValuedInstanceProperties1Boxed](#unevaluatedpropertieswithnullvaluedinstanceproperties1boxed) | validateAndBox(Any?, configuration: SchemaConfiguration) | +| Any? | validate(arg: Any?, configuration: SchemaConfiguration) | + +## UnevaluatedPropertiesBoxed +sealed interface UnevaluatedPropertiesBoxed
    +permits
    +[UnevaluatedPropertiesBoxedVoid](#unevaluatedpropertiesboxedvoid) + +sealed interface that stores validated payloads using boxed classes + +## UnevaluatedPropertiesBoxedVoid +data class UnevaluatedPropertiesBoxedVoid
    +implements [UnevaluatedPropertiesBoxed](#unevaluatedpropertiesboxed) + +data class that stores validated null payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| UnevaluatedPropertiesBoxedVoid(Nothing? data)
    Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| Nothing? | data()
    validated payload | +| Any? | getData()
    validated payload | + +## UnevaluatedProperties +class UnevaluatedProperties
    +extends NullJsonSchema.NullJsonSchema1 + +A schema class that validates payloads + +| Methods Inherited from class org.openapijsonschematools.client.schemas.NullJsonSchema.NullJsonSchema1 | +| ------------------------------------------------------------------ | +| validate | +| validateAndBox | + +[[Back to top]](#top) [[Back to Component Schemas]](../../../README.md#Component-Schemas) [[Back to README]](../../../README.md) diff --git a/samples/client/3_1_0_unit_test/kotlin/docs/components/schemas/UniqueitemsFalseValidation.md b/samples/client/3_1_0_unit_test/kotlin/docs/components/schemas/UniqueitemsFalseValidation.md new file mode 100644 index 00000000000..5529c997fa9 --- /dev/null +++ b/samples/client/3_1_0_unit_test/kotlin/docs/components/schemas/UniqueitemsFalseValidation.md @@ -0,0 +1,169 @@ +# UniqueitemsFalseValidation +org.openapijsonschematools.client.components.schemas.UniqueitemsFalseValidation.java +class UniqueitemsFalseValidation
    + +A class that contains necessary nested +- schema classes (which validate payloads), extends JsonSchema +- sealed interfaces which store validated payloads, Kotlin version of a sum type +- boxed classes which store validated payloads, sealed permits class implementations + +## Nested Class Summary +| Modifier and Type | Class and Description | +| ----------------- | ---------------------- | +| sealed interface | [UniqueitemsFalseValidation.UniqueitemsFalseValidation1Boxed](#uniqueitemsfalsevalidation1boxed)
    sealed interface for validated payloads | +| record | [UniqueitemsFalseValidation.UniqueitemsFalseValidation1BoxedVoid](#uniqueitemsfalsevalidation1boxedvoid)
    boxed class to store validated null payloads | +| record | [UniqueitemsFalseValidation.UniqueitemsFalseValidation1BoxedBoolean](#uniqueitemsfalsevalidation1boxedboolean)
    boxed class to store validated boolean payloads | +| record | [UniqueitemsFalseValidation.UniqueitemsFalseValidation1BoxedNumber](#uniqueitemsfalsevalidation1boxednumber)
    boxed class to store validated Number payloads | +| record | [UniqueitemsFalseValidation.UniqueitemsFalseValidation1BoxedString](#uniqueitemsfalsevalidation1boxedstring)
    boxed class to store validated String payloads | +| record | [UniqueitemsFalseValidation.UniqueitemsFalseValidation1BoxedList](#uniqueitemsfalsevalidation1boxedlist)
    boxed class to store validated List payloads | +| record | [UniqueitemsFalseValidation.UniqueitemsFalseValidation1BoxedMap](#uniqueitemsfalsevalidation1boxedmap)
    boxed class to store validated Map payloads | +| static class | [UniqueitemsFalseValidation.UniqueitemsFalseValidation1](#uniqueitemsfalsevalidation1)
    schema class | + +## UniqueitemsFalseValidation1Boxed +sealed interface UniqueitemsFalseValidation1Boxed
    +permits
    +[UniqueitemsFalseValidation1BoxedVoid](#uniqueitemsfalsevalidation1boxedvoid), +[UniqueitemsFalseValidation1BoxedBoolean](#uniqueitemsfalsevalidation1boxedboolean), +[UniqueitemsFalseValidation1BoxedNumber](#uniqueitemsfalsevalidation1boxednumber), +[UniqueitemsFalseValidation1BoxedString](#uniqueitemsfalsevalidation1boxedstring), +[UniqueitemsFalseValidation1BoxedList](#uniqueitemsfalsevalidation1boxedlist), +[UniqueitemsFalseValidation1BoxedMap](#uniqueitemsfalsevalidation1boxedmap) + +sealed interface that stores validated payloads using boxed classes + +## UniqueitemsFalseValidation1BoxedVoid +data class UniqueitemsFalseValidation1BoxedVoid
    +implements [UniqueitemsFalseValidation1Boxed](#uniqueitemsfalsevalidation1boxed) + +data class that stores validated null payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| UniqueitemsFalseValidation1BoxedVoid(Nothing? data)
    Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| Nothing? | data()
    validated payload | +| Any? | getData()
    validated payload | + +## UniqueitemsFalseValidation1BoxedBoolean +data class UniqueitemsFalseValidation1BoxedBoolean
    +implements [UniqueitemsFalseValidation1Boxed](#uniqueitemsfalsevalidation1boxed) + +record that stores validated boolean payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| UniqueitemsFalseValidation1BoxedBoolean(boolean data)
    Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| boolean | data()
    validated payload | +| Any? | getData()
    validated payload | + +## UniqueitemsFalseValidation1BoxedNumber +data class UniqueitemsFalseValidation1BoxedNumber
    +implements [UniqueitemsFalseValidation1Boxed](#uniqueitemsfalsevalidation1boxed) + +data class that stores validated Number payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| UniqueitemsFalseValidation1BoxedNumber(Number data)
    Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| Number | data()
    validated payload | +| Any? | getData()
    validated payload | + +## UniqueitemsFalseValidation1BoxedString +data class UniqueitemsFalseValidation1BoxedString
    +implements [UniqueitemsFalseValidation1Boxed](#uniqueitemsfalsevalidation1boxed) + +data class that stores validated String payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| UniqueitemsFalseValidation1BoxedString(String data)
    Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| String | data()
    validated payload | +| Any? | getData()
    validated payload | + +## UniqueitemsFalseValidation1BoxedList +data class UniqueitemsFalseValidation1BoxedList
    +implements [UniqueitemsFalseValidation1Boxed](#uniqueitemsfalsevalidation1boxed) + +data class that stores validated List payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| UniqueitemsFalseValidation1BoxedList(FrozenList data)
    Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| FrozenList | data()
    validated payload | +| Any? | getData()
    validated payload | + +## UniqueitemsFalseValidation1BoxedMap +data class UniqueitemsFalseValidation1BoxedMap
    +implements [UniqueitemsFalseValidation1Boxed](#uniqueitemsfalsevalidation1boxed) + +data class that stores validated Map payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| UniqueitemsFalseValidation1BoxedMap(FrozenMap data)
    Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| FrozenMap | data()
    validated payload | +| Any? | getData()
    validated payload | + +## UniqueitemsFalseValidation1 +class UniqueitemsFalseValidation1
    +extends JsonSchema + +A schema class that validates payloads + +### Field Summary +| Modifier and Type | Field and Description | +| ----------------- | ---------------------- | +| Boolean | uniqueItems = false | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| String | validate(arg: String, configuration: SchemaConfiguration) | +| Nothing? | validate(arg: Nothing?, configuration: SchemaConfiguration) | +| int | validate(arg: int, configuration: SchemaConfiguration) | +| long | validate(arg: long, configuration: SchemaConfiguration) | +| float | validate(arg: float, configuration: SchemaConfiguration) | +| double | validate(arg: double, configuration: SchemaConfiguration) | +| Number | validate(arg: Number, configuration: SchemaConfiguration) | +| boolean | validate(arg: boolean, configuration: SchemaConfiguration) | +| FrozenMap | validate(arg: Map<?, ?>, configuration: SchemaConfiguration) | +| FrozenList | validate(arg: List<*>, configuration: SchemaConfiguration) | +| [UniqueitemsFalseValidation1BoxedString](#uniqueitemsfalsevalidation1boxedstring) | validateAndBox(String, configuration: SchemaConfiguration) | +| [UniqueitemsFalseValidation1BoxedVoid](#uniqueitemsfalsevalidation1boxedvoid) | validateAndBox(Nothing?, configuration: SchemaConfiguration) | +| [UniqueitemsFalseValidation1BoxedNumber](#uniqueitemsfalsevalidation1boxednumber) | validateAndBox(Number, configuration: SchemaConfiguration) | +| [UniqueitemsFalseValidation1BoxedBoolean](#uniqueitemsfalsevalidation1boxedboolean) | validateAndBox(boolean, configuration: SchemaConfiguration) | +| [UniqueitemsFalseValidation1BoxedMap](#uniqueitemsfalsevalidation1boxedmap) | validateAndBox(Map<?, ?>, configuration: SchemaConfiguration) | +| [UniqueitemsFalseValidation1BoxedList](#uniqueitemsfalsevalidation1boxedlist) | validateAndBox(List<*>, configuration: SchemaConfiguration) | +| [UniqueitemsFalseValidation1Boxed](#uniqueitemsfalsevalidation1boxed) | validateAndBox(Any?, configuration: SchemaConfiguration) | +| Any? | validate(arg: Any?, configuration: SchemaConfiguration) | + +[[Back to top]](#top) [[Back to Component Schemas]](../../../README.md#Component-Schemas) [[Back to README]](../../../README.md) diff --git a/samples/client/3_1_0_unit_test/kotlin/docs/components/schemas/UniqueitemsFalseWithAnArrayOfItems.md b/samples/client/3_1_0_unit_test/kotlin/docs/components/schemas/UniqueitemsFalseWithAnArrayOfItems.md new file mode 100644 index 00000000000..c7a9935f3a6 --- /dev/null +++ b/samples/client/3_1_0_unit_test/kotlin/docs/components/schemas/UniqueitemsFalseWithAnArrayOfItems.md @@ -0,0 +1,287 @@ +# UniqueitemsFalseWithAnArrayOfItems +org.openapijsonschematools.client.components.schemas.UniqueitemsFalseWithAnArrayOfItems.java +class UniqueitemsFalseWithAnArrayOfItems
    + +A class that contains necessary nested +- schema classes (which validate payloads), extends JsonSchema +- sealed interfaces which store validated payloads, Kotlin version of a sum type +- boxed classes which store validated payloads, sealed permits class implementations +- classes to store validated list payloads, extends FrozenList +- classes to build inputs for list payloads + +## Nested Class Summary +| Modifier and Type | Class and Description | +| ----------------- | ---------------------- | +| sealed interface | [UniqueitemsFalseWithAnArrayOfItems.UniqueitemsFalseWithAnArrayOfItems1Boxed](#uniqueitemsfalsewithanarrayofitems1boxed)
    sealed interface for validated payloads | +| record | [UniqueitemsFalseWithAnArrayOfItems.UniqueitemsFalseWithAnArrayOfItems1BoxedVoid](#uniqueitemsfalsewithanarrayofitems1boxedvoid)
    boxed class to store validated null payloads | +| record | [UniqueitemsFalseWithAnArrayOfItems.UniqueitemsFalseWithAnArrayOfItems1BoxedBoolean](#uniqueitemsfalsewithanarrayofitems1boxedboolean)
    boxed class to store validated boolean payloads | +| record | [UniqueitemsFalseWithAnArrayOfItems.UniqueitemsFalseWithAnArrayOfItems1BoxedNumber](#uniqueitemsfalsewithanarrayofitems1boxednumber)
    boxed class to store validated Number payloads | +| record | [UniqueitemsFalseWithAnArrayOfItems.UniqueitemsFalseWithAnArrayOfItems1BoxedString](#uniqueitemsfalsewithanarrayofitems1boxedstring)
    boxed class to store validated String payloads | +| record | [UniqueitemsFalseWithAnArrayOfItems.UniqueitemsFalseWithAnArrayOfItems1BoxedList](#uniqueitemsfalsewithanarrayofitems1boxedlist)
    boxed class to store validated List payloads | +| record | [UniqueitemsFalseWithAnArrayOfItems.UniqueitemsFalseWithAnArrayOfItems1BoxedMap](#uniqueitemsfalsewithanarrayofitems1boxedmap)
    boxed class to store validated Map payloads | +| static class | [UniqueitemsFalseWithAnArrayOfItems.UniqueitemsFalseWithAnArrayOfItems1](#uniqueitemsfalsewithanarrayofitems1)
    schema class | +| sealed interface | [UniqueitemsFalseWithAnArrayOfItems.Schema1Boxed](#schema1boxed)
    sealed interface for validated payloads | +| record | [UniqueitemsFalseWithAnArrayOfItems.Schema1BoxedBoolean](#schema1boxedboolean)
    boxed class to store validated boolean payloads | +| static class | [UniqueitemsFalseWithAnArrayOfItems.Schema1](#schema1)
    schema class | +| sealed interface | [UniqueitemsFalseWithAnArrayOfItems.Schema0Boxed](#schema0boxed)
    sealed interface for validated payloads | +| record | [UniqueitemsFalseWithAnArrayOfItems.Schema0BoxedBoolean](#schema0boxedboolean)
    boxed class to store validated boolean payloads | +| static class | [UniqueitemsFalseWithAnArrayOfItems.Schema0](#schema0)
    schema class | +| static class | [UniqueitemsFalseWithAnArrayOfItems.UniqueitemsFalseWithAnArrayOfItemsListBuilder](#uniqueitemsfalsewithanarrayofitemslistbuilder)
    builder for List payloads | +| static class | [UniqueitemsFalseWithAnArrayOfItems.UniqueitemsFalseWithAnArrayOfItemsList](#uniqueitemsfalsewithanarrayofitemslist)
    output class for List payloads | + +## UniqueitemsFalseWithAnArrayOfItems1Boxed +sealed interface UniqueitemsFalseWithAnArrayOfItems1Boxed
    +permits
    +[UniqueitemsFalseWithAnArrayOfItems1BoxedVoid](#uniqueitemsfalsewithanarrayofitems1boxedvoid), +[UniqueitemsFalseWithAnArrayOfItems1BoxedBoolean](#uniqueitemsfalsewithanarrayofitems1boxedboolean), +[UniqueitemsFalseWithAnArrayOfItems1BoxedNumber](#uniqueitemsfalsewithanarrayofitems1boxednumber), +[UniqueitemsFalseWithAnArrayOfItems1BoxedString](#uniqueitemsfalsewithanarrayofitems1boxedstring), +[UniqueitemsFalseWithAnArrayOfItems1BoxedList](#uniqueitemsfalsewithanarrayofitems1boxedlist), +[UniqueitemsFalseWithAnArrayOfItems1BoxedMap](#uniqueitemsfalsewithanarrayofitems1boxedmap) + +sealed interface that stores validated payloads using boxed classes + +## UniqueitemsFalseWithAnArrayOfItems1BoxedVoid +data class UniqueitemsFalseWithAnArrayOfItems1BoxedVoid
    +implements [UniqueitemsFalseWithAnArrayOfItems1Boxed](#uniqueitemsfalsewithanarrayofitems1boxed) + +data class that stores validated null payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| UniqueitemsFalseWithAnArrayOfItems1BoxedVoid(Nothing? data)
    Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| Nothing? | data()
    validated payload | +| Any? | getData()
    validated payload | + +## UniqueitemsFalseWithAnArrayOfItems1BoxedBoolean +data class UniqueitemsFalseWithAnArrayOfItems1BoxedBoolean
    +implements [UniqueitemsFalseWithAnArrayOfItems1Boxed](#uniqueitemsfalsewithanarrayofitems1boxed) + +record that stores validated boolean payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| UniqueitemsFalseWithAnArrayOfItems1BoxedBoolean(boolean data)
    Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| boolean | data()
    validated payload | +| Any? | getData()
    validated payload | + +## UniqueitemsFalseWithAnArrayOfItems1BoxedNumber +data class UniqueitemsFalseWithAnArrayOfItems1BoxedNumber
    +implements [UniqueitemsFalseWithAnArrayOfItems1Boxed](#uniqueitemsfalsewithanarrayofitems1boxed) + +data class that stores validated Number payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| UniqueitemsFalseWithAnArrayOfItems1BoxedNumber(Number data)
    Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| Number | data()
    validated payload | +| Any? | getData()
    validated payload | + +## UniqueitemsFalseWithAnArrayOfItems1BoxedString +data class UniqueitemsFalseWithAnArrayOfItems1BoxedString
    +implements [UniqueitemsFalseWithAnArrayOfItems1Boxed](#uniqueitemsfalsewithanarrayofitems1boxed) + +data class that stores validated String payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| UniqueitemsFalseWithAnArrayOfItems1BoxedString(String data)
    Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| String | data()
    validated payload | +| Any? | getData()
    validated payload | + +## UniqueitemsFalseWithAnArrayOfItems1BoxedList +data class UniqueitemsFalseWithAnArrayOfItems1BoxedList
    +implements [UniqueitemsFalseWithAnArrayOfItems1Boxed](#uniqueitemsfalsewithanarrayofitems1boxed) + +data class that stores validated List payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| UniqueitemsFalseWithAnArrayOfItems1BoxedList([UniqueitemsFalseWithAnArrayOfItemsList](#uniqueitemsfalsewithanarrayofitemslist) data)
    Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| [UniqueitemsFalseWithAnArrayOfItemsList](#uniqueitemsfalsewithanarrayofitemslist) | data()
    validated payload | +| Any? | getData()
    validated payload | + +## UniqueitemsFalseWithAnArrayOfItems1BoxedMap +data class UniqueitemsFalseWithAnArrayOfItems1BoxedMap
    +implements [UniqueitemsFalseWithAnArrayOfItems1Boxed](#uniqueitemsfalsewithanarrayofitems1boxed) + +data class that stores validated Map payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| UniqueitemsFalseWithAnArrayOfItems1BoxedMap(FrozenMap data)
    Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| FrozenMap | data()
    validated payload | +| Any? | getData()
    validated payload | + +## UniqueitemsFalseWithAnArrayOfItems1 +class UniqueitemsFalseWithAnArrayOfItems1
    +extends JsonSchema + +A schema class that validates payloads + +### Field Summary +| Modifier and Type | Field and Description | +| ----------------- | ---------------------- | +| Boolean | uniqueItems = false | +| List> | prefixItems = listOf(
        [Schema0::class.java](#schema0),
        [Schema1::class.java](#schema1)
    )
    | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| String | validate(arg: String, configuration: SchemaConfiguration) | +| Nothing? | validate(arg: Nothing?, configuration: SchemaConfiguration) | +| int | validate(arg: int, configuration: SchemaConfiguration) | +| long | validate(arg: long, configuration: SchemaConfiguration) | +| float | validate(arg: float, configuration: SchemaConfiguration) | +| double | validate(arg: double, configuration: SchemaConfiguration) | +| Number | validate(arg: Number, configuration: SchemaConfiguration) | +| boolean | validate(arg: boolean, configuration: SchemaConfiguration) | +| FrozenMap | validate(arg: Map<?, ?>, configuration: SchemaConfiguration) | +| [UniqueitemsFalseWithAnArrayOfItemsList](#uniqueitemsfalsewithanarrayofitemslist) | validate(arg: [List<*>](#uniqueitemsfalsewithanarrayofitemslistbuilder), configuration: SchemaConfiguration) | +| [UniqueitemsFalseWithAnArrayOfItems1BoxedString](#uniqueitemsfalsewithanarrayofitems1boxedstring) | validateAndBox(String, configuration: SchemaConfiguration) | +| [UniqueitemsFalseWithAnArrayOfItems1BoxedVoid](#uniqueitemsfalsewithanarrayofitems1boxedvoid) | validateAndBox(Nothing?, configuration: SchemaConfiguration) | +| [UniqueitemsFalseWithAnArrayOfItems1BoxedNumber](#uniqueitemsfalsewithanarrayofitems1boxednumber) | validateAndBox(Number, configuration: SchemaConfiguration) | +| [UniqueitemsFalseWithAnArrayOfItems1BoxedBoolean](#uniqueitemsfalsewithanarrayofitems1boxedboolean) | validateAndBox(boolean, configuration: SchemaConfiguration) | +| [UniqueitemsFalseWithAnArrayOfItems1BoxedMap](#uniqueitemsfalsewithanarrayofitems1boxedmap) | validateAndBox(Map<?, ?>, configuration: SchemaConfiguration) | +| [UniqueitemsFalseWithAnArrayOfItems1BoxedList](#uniqueitemsfalsewithanarrayofitems1boxedlist) | validateAndBox([List<*>](#uniqueitemsfalsewithanarrayofitemslistbuilder), configuration: SchemaConfiguration) | +| [UniqueitemsFalseWithAnArrayOfItems1Boxed](#uniqueitemsfalsewithanarrayofitems1boxed) | validateAndBox(Any?, configuration: SchemaConfiguration) | +| Any? | validate(arg: Any?, configuration: SchemaConfiguration) | + +## Schema1Boxed +sealed interface Schema1Boxed
    +permits
    +[Schema1BoxedBoolean](#schema1boxedboolean) + +sealed interface that stores validated payloads using boxed classes + +## Schema1BoxedBoolean +data class Schema1BoxedBoolean
    +implements [Schema1Boxed](#schema1boxed) + +record that stores validated boolean payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| Schema1BoxedBoolean(boolean data)
    Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| boolean | data()
    validated payload | +| Any? | getData()
    validated payload | + +## Schema1 +class Schema1
    +extends BooleanJsonSchema.BooleanJsonSchema1 + +A schema class that validates payloads + +| Methods Inherited from class org.openapijsonschematools.client.schemas.BooleanJsonSchema.BooleanJsonSchema1 | +| ------------------------------------------------------------------ | +| validate | +| validateAndBox | + +## Schema0Boxed +sealed interface Schema0Boxed
    +permits
    +[Schema0BoxedBoolean](#schema0boxedboolean) + +sealed interface that stores validated payloads using boxed classes + +## Schema0BoxedBoolean +data class Schema0BoxedBoolean
    +implements [Schema0Boxed](#schema0boxed) + +record that stores validated boolean payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| Schema0BoxedBoolean(boolean data)
    Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| boolean | data()
    validated payload | +| Any? | getData()
    validated payload | + +## Schema0 +class Schema0
    +extends BooleanJsonSchema.BooleanJsonSchema1 + +A schema class that validates payloads + +| Methods Inherited from class org.openapijsonschematools.client.schemas.BooleanJsonSchema.BooleanJsonSchema1 | +| ------------------------------------------------------------------ | +| validate | +| validateAndBox | + +## UniqueitemsFalseWithAnArrayOfItemsListBuilder +class UniqueitemsFalseWithAnArrayOfItemsListBuilder
    +builder for `List` + +A class that builds the List input type + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| UniqueitemsFalseWithAnArrayOfItemsListBuilder()
    Creates an empty list | +| UniqueitemsFalseWithAnArrayOfItemsListBuilder(List items)
    Stores the items in a list | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| UniqueitemsFalseWithAnArrayOfItemsListBuilder | add(item: Nothing?) | +| UniqueitemsFalseWithAnArrayOfItemsListBuilder | add(item: Boolean) | +| UniqueitemsFalseWithAnArrayOfItemsListBuilder | add(item: String) | +| UniqueitemsFalseWithAnArrayOfItemsListBuilder | add(item: Int) | +| UniqueitemsFalseWithAnArrayOfItemsListBuilder | add(item: Float) | +| UniqueitemsFalseWithAnArrayOfItemsListBuilder | add(item: Long) | +| UniqueitemsFalseWithAnArrayOfItemsListBuilder | add(item: Double) | +| UniqueitemsFalseWithAnArrayOfItemsListBuilder | add(item: List) | +| UniqueitemsFalseWithAnArrayOfItemsListBuilder | add(item: Map) | +| List | build()
    Returns list input that should be used with Schema.validate | + +## UniqueitemsFalseWithAnArrayOfItemsList +class UniqueitemsFalseWithAnArrayOfItemsList
    +extends `FrozenList` + +A class to store validated List payloads + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| static [UniqueitemsFalseWithAnArrayOfItemsList](#uniqueitemsfalsewithanarrayofitemslist) | of([List](#uniqueitemsfalsewithanarrayofitemslistbuilder) arg, SchemaConfiguration configuration) | + +[[Back to top]](#top) [[Back to Component Schemas]](../../../README.md#Component-Schemas) [[Back to README]](../../../README.md) diff --git a/samples/client/3_1_0_unit_test/kotlin/docs/components/schemas/UniqueitemsValidation.md b/samples/client/3_1_0_unit_test/kotlin/docs/components/schemas/UniqueitemsValidation.md new file mode 100644 index 00000000000..09861dec784 --- /dev/null +++ b/samples/client/3_1_0_unit_test/kotlin/docs/components/schemas/UniqueitemsValidation.md @@ -0,0 +1,169 @@ +# UniqueitemsValidation +org.openapijsonschematools.client.components.schemas.UniqueitemsValidation.java +class UniqueitemsValidation
    + +A class that contains necessary nested +- schema classes (which validate payloads), extends JsonSchema +- sealed interfaces which store validated payloads, Kotlin version of a sum type +- boxed classes which store validated payloads, sealed permits class implementations + +## Nested Class Summary +| Modifier and Type | Class and Description | +| ----------------- | ---------------------- | +| sealed interface | [UniqueitemsValidation.UniqueitemsValidation1Boxed](#uniqueitemsvalidation1boxed)
    sealed interface for validated payloads | +| record | [UniqueitemsValidation.UniqueitemsValidation1BoxedVoid](#uniqueitemsvalidation1boxedvoid)
    boxed class to store validated null payloads | +| record | [UniqueitemsValidation.UniqueitemsValidation1BoxedBoolean](#uniqueitemsvalidation1boxedboolean)
    boxed class to store validated boolean payloads | +| record | [UniqueitemsValidation.UniqueitemsValidation1BoxedNumber](#uniqueitemsvalidation1boxednumber)
    boxed class to store validated Number payloads | +| record | [UniqueitemsValidation.UniqueitemsValidation1BoxedString](#uniqueitemsvalidation1boxedstring)
    boxed class to store validated String payloads | +| record | [UniqueitemsValidation.UniqueitemsValidation1BoxedList](#uniqueitemsvalidation1boxedlist)
    boxed class to store validated List payloads | +| record | [UniqueitemsValidation.UniqueitemsValidation1BoxedMap](#uniqueitemsvalidation1boxedmap)
    boxed class to store validated Map payloads | +| static class | [UniqueitemsValidation.UniqueitemsValidation1](#uniqueitemsvalidation1)
    schema class | + +## UniqueitemsValidation1Boxed +sealed interface UniqueitemsValidation1Boxed
    +permits
    +[UniqueitemsValidation1BoxedVoid](#uniqueitemsvalidation1boxedvoid), +[UniqueitemsValidation1BoxedBoolean](#uniqueitemsvalidation1boxedboolean), +[UniqueitemsValidation1BoxedNumber](#uniqueitemsvalidation1boxednumber), +[UniqueitemsValidation1BoxedString](#uniqueitemsvalidation1boxedstring), +[UniqueitemsValidation1BoxedList](#uniqueitemsvalidation1boxedlist), +[UniqueitemsValidation1BoxedMap](#uniqueitemsvalidation1boxedmap) + +sealed interface that stores validated payloads using boxed classes + +## UniqueitemsValidation1BoxedVoid +data class UniqueitemsValidation1BoxedVoid
    +implements [UniqueitemsValidation1Boxed](#uniqueitemsvalidation1boxed) + +data class that stores validated null payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| UniqueitemsValidation1BoxedVoid(Nothing? data)
    Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| Nothing? | data()
    validated payload | +| Any? | getData()
    validated payload | + +## UniqueitemsValidation1BoxedBoolean +data class UniqueitemsValidation1BoxedBoolean
    +implements [UniqueitemsValidation1Boxed](#uniqueitemsvalidation1boxed) + +record that stores validated boolean payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| UniqueitemsValidation1BoxedBoolean(boolean data)
    Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| boolean | data()
    validated payload | +| Any? | getData()
    validated payload | + +## UniqueitemsValidation1BoxedNumber +data class UniqueitemsValidation1BoxedNumber
    +implements [UniqueitemsValidation1Boxed](#uniqueitemsvalidation1boxed) + +data class that stores validated Number payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| UniqueitemsValidation1BoxedNumber(Number data)
    Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| Number | data()
    validated payload | +| Any? | getData()
    validated payload | + +## UniqueitemsValidation1BoxedString +data class UniqueitemsValidation1BoxedString
    +implements [UniqueitemsValidation1Boxed](#uniqueitemsvalidation1boxed) + +data class that stores validated String payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| UniqueitemsValidation1BoxedString(String data)
    Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| String | data()
    validated payload | +| Any? | getData()
    validated payload | + +## UniqueitemsValidation1BoxedList +data class UniqueitemsValidation1BoxedList
    +implements [UniqueitemsValidation1Boxed](#uniqueitemsvalidation1boxed) + +data class that stores validated List payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| UniqueitemsValidation1BoxedList(FrozenList data)
    Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| FrozenList | data()
    validated payload | +| Any? | getData()
    validated payload | + +## UniqueitemsValidation1BoxedMap +data class UniqueitemsValidation1BoxedMap
    +implements [UniqueitemsValidation1Boxed](#uniqueitemsvalidation1boxed) + +data class that stores validated Map payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| UniqueitemsValidation1BoxedMap(FrozenMap data)
    Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| FrozenMap | data()
    validated payload | +| Any? | getData()
    validated payload | + +## UniqueitemsValidation1 +class UniqueitemsValidation1
    +extends JsonSchema + +A schema class that validates payloads + +### Field Summary +| Modifier and Type | Field and Description | +| ----------------- | ---------------------- | +| Boolean | uniqueItems = true | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| String | validate(arg: String, configuration: SchemaConfiguration) | +| Nothing? | validate(arg: Nothing?, configuration: SchemaConfiguration) | +| int | validate(arg: int, configuration: SchemaConfiguration) | +| long | validate(arg: long, configuration: SchemaConfiguration) | +| float | validate(arg: float, configuration: SchemaConfiguration) | +| double | validate(arg: double, configuration: SchemaConfiguration) | +| Number | validate(arg: Number, configuration: SchemaConfiguration) | +| boolean | validate(arg: boolean, configuration: SchemaConfiguration) | +| FrozenMap | validate(arg: Map<?, ?>, configuration: SchemaConfiguration) | +| FrozenList | validate(arg: List<*>, configuration: SchemaConfiguration) | +| [UniqueitemsValidation1BoxedString](#uniqueitemsvalidation1boxedstring) | validateAndBox(String, configuration: SchemaConfiguration) | +| [UniqueitemsValidation1BoxedVoid](#uniqueitemsvalidation1boxedvoid) | validateAndBox(Nothing?, configuration: SchemaConfiguration) | +| [UniqueitemsValidation1BoxedNumber](#uniqueitemsvalidation1boxednumber) | validateAndBox(Number, configuration: SchemaConfiguration) | +| [UniqueitemsValidation1BoxedBoolean](#uniqueitemsvalidation1boxedboolean) | validateAndBox(boolean, configuration: SchemaConfiguration) | +| [UniqueitemsValidation1BoxedMap](#uniqueitemsvalidation1boxedmap) | validateAndBox(Map<?, ?>, configuration: SchemaConfiguration) | +| [UniqueitemsValidation1BoxedList](#uniqueitemsvalidation1boxedlist) | validateAndBox(List<*>, configuration: SchemaConfiguration) | +| [UniqueitemsValidation1Boxed](#uniqueitemsvalidation1boxed) | validateAndBox(Any?, configuration: SchemaConfiguration) | +| Any? | validate(arg: Any?, configuration: SchemaConfiguration) | + +[[Back to top]](#top) [[Back to Component Schemas]](../../../README.md#Component-Schemas) [[Back to README]](../../../README.md) diff --git a/samples/client/3_1_0_unit_test/kotlin/docs/components/schemas/UniqueitemsWithAnArrayOfItems.md b/samples/client/3_1_0_unit_test/kotlin/docs/components/schemas/UniqueitemsWithAnArrayOfItems.md new file mode 100644 index 00000000000..d2397a579af --- /dev/null +++ b/samples/client/3_1_0_unit_test/kotlin/docs/components/schemas/UniqueitemsWithAnArrayOfItems.md @@ -0,0 +1,287 @@ +# UniqueitemsWithAnArrayOfItems +org.openapijsonschematools.client.components.schemas.UniqueitemsWithAnArrayOfItems.java +class UniqueitemsWithAnArrayOfItems
    + +A class that contains necessary nested +- schema classes (which validate payloads), extends JsonSchema +- sealed interfaces which store validated payloads, Kotlin version of a sum type +- boxed classes which store validated payloads, sealed permits class implementations +- classes to store validated list payloads, extends FrozenList +- classes to build inputs for list payloads + +## Nested Class Summary +| Modifier and Type | Class and Description | +| ----------------- | ---------------------- | +| sealed interface | [UniqueitemsWithAnArrayOfItems.UniqueitemsWithAnArrayOfItems1Boxed](#uniqueitemswithanarrayofitems1boxed)
    sealed interface for validated payloads | +| record | [UniqueitemsWithAnArrayOfItems.UniqueitemsWithAnArrayOfItems1BoxedVoid](#uniqueitemswithanarrayofitems1boxedvoid)
    boxed class to store validated null payloads | +| record | [UniqueitemsWithAnArrayOfItems.UniqueitemsWithAnArrayOfItems1BoxedBoolean](#uniqueitemswithanarrayofitems1boxedboolean)
    boxed class to store validated boolean payloads | +| record | [UniqueitemsWithAnArrayOfItems.UniqueitemsWithAnArrayOfItems1BoxedNumber](#uniqueitemswithanarrayofitems1boxednumber)
    boxed class to store validated Number payloads | +| record | [UniqueitemsWithAnArrayOfItems.UniqueitemsWithAnArrayOfItems1BoxedString](#uniqueitemswithanarrayofitems1boxedstring)
    boxed class to store validated String payloads | +| record | [UniqueitemsWithAnArrayOfItems.UniqueitemsWithAnArrayOfItems1BoxedList](#uniqueitemswithanarrayofitems1boxedlist)
    boxed class to store validated List payloads | +| record | [UniqueitemsWithAnArrayOfItems.UniqueitemsWithAnArrayOfItems1BoxedMap](#uniqueitemswithanarrayofitems1boxedmap)
    boxed class to store validated Map payloads | +| static class | [UniqueitemsWithAnArrayOfItems.UniqueitemsWithAnArrayOfItems1](#uniqueitemswithanarrayofitems1)
    schema class | +| sealed interface | [UniqueitemsWithAnArrayOfItems.Schema1Boxed](#schema1boxed)
    sealed interface for validated payloads | +| record | [UniqueitemsWithAnArrayOfItems.Schema1BoxedBoolean](#schema1boxedboolean)
    boxed class to store validated boolean payloads | +| static class | [UniqueitemsWithAnArrayOfItems.Schema1](#schema1)
    schema class | +| sealed interface | [UniqueitemsWithAnArrayOfItems.Schema0Boxed](#schema0boxed)
    sealed interface for validated payloads | +| record | [UniqueitemsWithAnArrayOfItems.Schema0BoxedBoolean](#schema0boxedboolean)
    boxed class to store validated boolean payloads | +| static class | [UniqueitemsWithAnArrayOfItems.Schema0](#schema0)
    schema class | +| static class | [UniqueitemsWithAnArrayOfItems.UniqueitemsWithAnArrayOfItemsListBuilder](#uniqueitemswithanarrayofitemslistbuilder)
    builder for List payloads | +| static class | [UniqueitemsWithAnArrayOfItems.UniqueitemsWithAnArrayOfItemsList](#uniqueitemswithanarrayofitemslist)
    output class for List payloads | + +## UniqueitemsWithAnArrayOfItems1Boxed +sealed interface UniqueitemsWithAnArrayOfItems1Boxed
    +permits
    +[UniqueitemsWithAnArrayOfItems1BoxedVoid](#uniqueitemswithanarrayofitems1boxedvoid), +[UniqueitemsWithAnArrayOfItems1BoxedBoolean](#uniqueitemswithanarrayofitems1boxedboolean), +[UniqueitemsWithAnArrayOfItems1BoxedNumber](#uniqueitemswithanarrayofitems1boxednumber), +[UniqueitemsWithAnArrayOfItems1BoxedString](#uniqueitemswithanarrayofitems1boxedstring), +[UniqueitemsWithAnArrayOfItems1BoxedList](#uniqueitemswithanarrayofitems1boxedlist), +[UniqueitemsWithAnArrayOfItems1BoxedMap](#uniqueitemswithanarrayofitems1boxedmap) + +sealed interface that stores validated payloads using boxed classes + +## UniqueitemsWithAnArrayOfItems1BoxedVoid +data class UniqueitemsWithAnArrayOfItems1BoxedVoid
    +implements [UniqueitemsWithAnArrayOfItems1Boxed](#uniqueitemswithanarrayofitems1boxed) + +data class that stores validated null payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| UniqueitemsWithAnArrayOfItems1BoxedVoid(Nothing? data)
    Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| Nothing? | data()
    validated payload | +| Any? | getData()
    validated payload | + +## UniqueitemsWithAnArrayOfItems1BoxedBoolean +data class UniqueitemsWithAnArrayOfItems1BoxedBoolean
    +implements [UniqueitemsWithAnArrayOfItems1Boxed](#uniqueitemswithanarrayofitems1boxed) + +record that stores validated boolean payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| UniqueitemsWithAnArrayOfItems1BoxedBoolean(boolean data)
    Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| boolean | data()
    validated payload | +| Any? | getData()
    validated payload | + +## UniqueitemsWithAnArrayOfItems1BoxedNumber +data class UniqueitemsWithAnArrayOfItems1BoxedNumber
    +implements [UniqueitemsWithAnArrayOfItems1Boxed](#uniqueitemswithanarrayofitems1boxed) + +data class that stores validated Number payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| UniqueitemsWithAnArrayOfItems1BoxedNumber(Number data)
    Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| Number | data()
    validated payload | +| Any? | getData()
    validated payload | + +## UniqueitemsWithAnArrayOfItems1BoxedString +data class UniqueitemsWithAnArrayOfItems1BoxedString
    +implements [UniqueitemsWithAnArrayOfItems1Boxed](#uniqueitemswithanarrayofitems1boxed) + +data class that stores validated String payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| UniqueitemsWithAnArrayOfItems1BoxedString(String data)
    Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| String | data()
    validated payload | +| Any? | getData()
    validated payload | + +## UniqueitemsWithAnArrayOfItems1BoxedList +data class UniqueitemsWithAnArrayOfItems1BoxedList
    +implements [UniqueitemsWithAnArrayOfItems1Boxed](#uniqueitemswithanarrayofitems1boxed) + +data class that stores validated List payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| UniqueitemsWithAnArrayOfItems1BoxedList([UniqueitemsWithAnArrayOfItemsList](#uniqueitemswithanarrayofitemslist) data)
    Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| [UniqueitemsWithAnArrayOfItemsList](#uniqueitemswithanarrayofitemslist) | data()
    validated payload | +| Any? | getData()
    validated payload | + +## UniqueitemsWithAnArrayOfItems1BoxedMap +data class UniqueitemsWithAnArrayOfItems1BoxedMap
    +implements [UniqueitemsWithAnArrayOfItems1Boxed](#uniqueitemswithanarrayofitems1boxed) + +data class that stores validated Map payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| UniqueitemsWithAnArrayOfItems1BoxedMap(FrozenMap data)
    Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| FrozenMap | data()
    validated payload | +| Any? | getData()
    validated payload | + +## UniqueitemsWithAnArrayOfItems1 +class UniqueitemsWithAnArrayOfItems1
    +extends JsonSchema + +A schema class that validates payloads + +### Field Summary +| Modifier and Type | Field and Description | +| ----------------- | ---------------------- | +| Boolean | uniqueItems = true | +| List> | prefixItems = listOf(
        [Schema0::class.java](#schema0),
        [Schema1::class.java](#schema1)
    )
    | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| String | validate(arg: String, configuration: SchemaConfiguration) | +| Nothing? | validate(arg: Nothing?, configuration: SchemaConfiguration) | +| int | validate(arg: int, configuration: SchemaConfiguration) | +| long | validate(arg: long, configuration: SchemaConfiguration) | +| float | validate(arg: float, configuration: SchemaConfiguration) | +| double | validate(arg: double, configuration: SchemaConfiguration) | +| Number | validate(arg: Number, configuration: SchemaConfiguration) | +| boolean | validate(arg: boolean, configuration: SchemaConfiguration) | +| FrozenMap | validate(arg: Map<?, ?>, configuration: SchemaConfiguration) | +| [UniqueitemsWithAnArrayOfItemsList](#uniqueitemswithanarrayofitemslist) | validate(arg: [List<*>](#uniqueitemswithanarrayofitemslistbuilder), configuration: SchemaConfiguration) | +| [UniqueitemsWithAnArrayOfItems1BoxedString](#uniqueitemswithanarrayofitems1boxedstring) | validateAndBox(String, configuration: SchemaConfiguration) | +| [UniqueitemsWithAnArrayOfItems1BoxedVoid](#uniqueitemswithanarrayofitems1boxedvoid) | validateAndBox(Nothing?, configuration: SchemaConfiguration) | +| [UniqueitemsWithAnArrayOfItems1BoxedNumber](#uniqueitemswithanarrayofitems1boxednumber) | validateAndBox(Number, configuration: SchemaConfiguration) | +| [UniqueitemsWithAnArrayOfItems1BoxedBoolean](#uniqueitemswithanarrayofitems1boxedboolean) | validateAndBox(boolean, configuration: SchemaConfiguration) | +| [UniqueitemsWithAnArrayOfItems1BoxedMap](#uniqueitemswithanarrayofitems1boxedmap) | validateAndBox(Map<?, ?>, configuration: SchemaConfiguration) | +| [UniqueitemsWithAnArrayOfItems1BoxedList](#uniqueitemswithanarrayofitems1boxedlist) | validateAndBox([List<*>](#uniqueitemswithanarrayofitemslistbuilder), configuration: SchemaConfiguration) | +| [UniqueitemsWithAnArrayOfItems1Boxed](#uniqueitemswithanarrayofitems1boxed) | validateAndBox(Any?, configuration: SchemaConfiguration) | +| Any? | validate(arg: Any?, configuration: SchemaConfiguration) | + +## Schema1Boxed +sealed interface Schema1Boxed
    +permits
    +[Schema1BoxedBoolean](#schema1boxedboolean) + +sealed interface that stores validated payloads using boxed classes + +## Schema1BoxedBoolean +data class Schema1BoxedBoolean
    +implements [Schema1Boxed](#schema1boxed) + +record that stores validated boolean payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| Schema1BoxedBoolean(boolean data)
    Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| boolean | data()
    validated payload | +| Any? | getData()
    validated payload | + +## Schema1 +class Schema1
    +extends BooleanJsonSchema.BooleanJsonSchema1 + +A schema class that validates payloads + +| Methods Inherited from class org.openapijsonschematools.client.schemas.BooleanJsonSchema.BooleanJsonSchema1 | +| ------------------------------------------------------------------ | +| validate | +| validateAndBox | + +## Schema0Boxed +sealed interface Schema0Boxed
    +permits
    +[Schema0BoxedBoolean](#schema0boxedboolean) + +sealed interface that stores validated payloads using boxed classes + +## Schema0BoxedBoolean +data class Schema0BoxedBoolean
    +implements [Schema0Boxed](#schema0boxed) + +record that stores validated boolean payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| Schema0BoxedBoolean(boolean data)
    Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| boolean | data()
    validated payload | +| Any? | getData()
    validated payload | + +## Schema0 +class Schema0
    +extends BooleanJsonSchema.BooleanJsonSchema1 + +A schema class that validates payloads + +| Methods Inherited from class org.openapijsonschematools.client.schemas.BooleanJsonSchema.BooleanJsonSchema1 | +| ------------------------------------------------------------------ | +| validate | +| validateAndBox | + +## UniqueitemsWithAnArrayOfItemsListBuilder +class UniqueitemsWithAnArrayOfItemsListBuilder
    +builder for `List` + +A class that builds the List input type + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| UniqueitemsWithAnArrayOfItemsListBuilder()
    Creates an empty list | +| UniqueitemsWithAnArrayOfItemsListBuilder(List items)
    Stores the items in a list | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| UniqueitemsWithAnArrayOfItemsListBuilder | add(item: Nothing?) | +| UniqueitemsWithAnArrayOfItemsListBuilder | add(item: Boolean) | +| UniqueitemsWithAnArrayOfItemsListBuilder | add(item: String) | +| UniqueitemsWithAnArrayOfItemsListBuilder | add(item: Int) | +| UniqueitemsWithAnArrayOfItemsListBuilder | add(item: Float) | +| UniqueitemsWithAnArrayOfItemsListBuilder | add(item: Long) | +| UniqueitemsWithAnArrayOfItemsListBuilder | add(item: Double) | +| UniqueitemsWithAnArrayOfItemsListBuilder | add(item: List) | +| UniqueitemsWithAnArrayOfItemsListBuilder | add(item: Map) | +| List | build()
    Returns list input that should be used with Schema.validate | + +## UniqueitemsWithAnArrayOfItemsList +class UniqueitemsWithAnArrayOfItemsList
    +extends `FrozenList` + +A class to store validated List payloads + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| static [UniqueitemsWithAnArrayOfItemsList](#uniqueitemswithanarrayofitemslist) | of([List](#uniqueitemswithanarrayofitemslistbuilder) arg, SchemaConfiguration configuration) | + +[[Back to top]](#top) [[Back to Component Schemas]](../../../README.md#Component-Schemas) [[Back to README]](../../../README.md) diff --git a/samples/client/3_1_0_unit_test/kotlin/docs/components/schemas/UriFormat.md b/samples/client/3_1_0_unit_test/kotlin/docs/components/schemas/UriFormat.md new file mode 100644 index 00000000000..ee78e984294 --- /dev/null +++ b/samples/client/3_1_0_unit_test/kotlin/docs/components/schemas/UriFormat.md @@ -0,0 +1,169 @@ +# UriFormat +org.openapijsonschematools.client.components.schemas.UriFormat.java +class UriFormat
    + +A class that contains necessary nested +- schema classes (which validate payloads), extends JsonSchema +- sealed interfaces which store validated payloads, Kotlin version of a sum type +- boxed classes which store validated payloads, sealed permits class implementations + +## Nested Class Summary +| Modifier and Type | Class and Description | +| ----------------- | ---------------------- | +| sealed interface | [UriFormat.UriFormat1Boxed](#uriformat1boxed)
    sealed interface for validated payloads | +| record | [UriFormat.UriFormat1BoxedVoid](#uriformat1boxedvoid)
    boxed class to store validated null payloads | +| record | [UriFormat.UriFormat1BoxedBoolean](#uriformat1boxedboolean)
    boxed class to store validated boolean payloads | +| record | [UriFormat.UriFormat1BoxedNumber](#uriformat1boxednumber)
    boxed class to store validated Number payloads | +| record | [UriFormat.UriFormat1BoxedString](#uriformat1boxedstring)
    boxed class to store validated String payloads | +| record | [UriFormat.UriFormat1BoxedList](#uriformat1boxedlist)
    boxed class to store validated List payloads | +| record | [UriFormat.UriFormat1BoxedMap](#uriformat1boxedmap)
    boxed class to store validated Map payloads | +| static class | [UriFormat.UriFormat1](#uriformat1)
    schema class | + +## UriFormat1Boxed +sealed interface UriFormat1Boxed
    +permits
    +[UriFormat1BoxedVoid](#uriformat1boxedvoid), +[UriFormat1BoxedBoolean](#uriformat1boxedboolean), +[UriFormat1BoxedNumber](#uriformat1boxednumber), +[UriFormat1BoxedString](#uriformat1boxedstring), +[UriFormat1BoxedList](#uriformat1boxedlist), +[UriFormat1BoxedMap](#uriformat1boxedmap) + +sealed interface that stores validated payloads using boxed classes + +## UriFormat1BoxedVoid +data class UriFormat1BoxedVoid
    +implements [UriFormat1Boxed](#uriformat1boxed) + +data class that stores validated null payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| UriFormat1BoxedVoid(Nothing? data)
    Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| Nothing? | data()
    validated payload | +| Any? | getData()
    validated payload | + +## UriFormat1BoxedBoolean +data class UriFormat1BoxedBoolean
    +implements [UriFormat1Boxed](#uriformat1boxed) + +record that stores validated boolean payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| UriFormat1BoxedBoolean(boolean data)
    Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| boolean | data()
    validated payload | +| Any? | getData()
    validated payload | + +## UriFormat1BoxedNumber +data class UriFormat1BoxedNumber
    +implements [UriFormat1Boxed](#uriformat1boxed) + +data class that stores validated Number payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| UriFormat1BoxedNumber(Number data)
    Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| Number | data()
    validated payload | +| Any? | getData()
    validated payload | + +## UriFormat1BoxedString +data class UriFormat1BoxedString
    +implements [UriFormat1Boxed](#uriformat1boxed) + +data class that stores validated String payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| UriFormat1BoxedString(String data)
    Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| String | data()
    validated payload | +| Any? | getData()
    validated payload | + +## UriFormat1BoxedList +data class UriFormat1BoxedList
    +implements [UriFormat1Boxed](#uriformat1boxed) + +data class that stores validated List payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| UriFormat1BoxedList(FrozenList data)
    Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| FrozenList | data()
    validated payload | +| Any? | getData()
    validated payload | + +## UriFormat1BoxedMap +data class UriFormat1BoxedMap
    +implements [UriFormat1Boxed](#uriformat1boxed) + +data class that stores validated Map payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| UriFormat1BoxedMap(FrozenMap data)
    Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| FrozenMap | data()
    validated payload | +| Any? | getData()
    validated payload | + +## UriFormat1 +class UriFormat1
    +extends JsonSchema + +A schema class that validates payloads + +### Field Summary +| Modifier and Type | Field and Description | +| ----------------- | ---------------------- | +| String | type = "uri"; | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| String | validate(arg: String, configuration: SchemaConfiguration) | +| Nothing? | validate(arg: Nothing?, configuration: SchemaConfiguration) | +| int | validate(arg: int, configuration: SchemaConfiguration) | +| long | validate(arg: long, configuration: SchemaConfiguration) | +| float | validate(arg: float, configuration: SchemaConfiguration) | +| double | validate(arg: double, configuration: SchemaConfiguration) | +| Number | validate(arg: Number, configuration: SchemaConfiguration) | +| boolean | validate(arg: boolean, configuration: SchemaConfiguration) | +| FrozenMap | validate(arg: Map<?, ?>, configuration: SchemaConfiguration) | +| FrozenList | validate(arg: List<*>, configuration: SchemaConfiguration) | +| [UriFormat1BoxedString](#uriformat1boxedstring) | validateAndBox(String, configuration: SchemaConfiguration) | +| [UriFormat1BoxedVoid](#uriformat1boxedvoid) | validateAndBox(Nothing?, configuration: SchemaConfiguration) | +| [UriFormat1BoxedNumber](#uriformat1boxednumber) | validateAndBox(Number, configuration: SchemaConfiguration) | +| [UriFormat1BoxedBoolean](#uriformat1boxedboolean) | validateAndBox(boolean, configuration: SchemaConfiguration) | +| [UriFormat1BoxedMap](#uriformat1boxedmap) | validateAndBox(Map<?, ?>, configuration: SchemaConfiguration) | +| [UriFormat1BoxedList](#uriformat1boxedlist) | validateAndBox(List<*>, configuration: SchemaConfiguration) | +| [UriFormat1Boxed](#uriformat1boxed) | validateAndBox(Any?, configuration: SchemaConfiguration) | +| Any? | validate(arg: Any?, configuration: SchemaConfiguration) | + +[[Back to top]](#top) [[Back to Component Schemas]](../../../README.md#Component-Schemas) [[Back to README]](../../../README.md) diff --git a/samples/client/3_1_0_unit_test/kotlin/docs/components/schemas/UriReferenceFormat.md b/samples/client/3_1_0_unit_test/kotlin/docs/components/schemas/UriReferenceFormat.md new file mode 100644 index 00000000000..34c794017c3 --- /dev/null +++ b/samples/client/3_1_0_unit_test/kotlin/docs/components/schemas/UriReferenceFormat.md @@ -0,0 +1,169 @@ +# UriReferenceFormat +org.openapijsonschematools.client.components.schemas.UriReferenceFormat.java +class UriReferenceFormat
    + +A class that contains necessary nested +- schema classes (which validate payloads), extends JsonSchema +- sealed interfaces which store validated payloads, Kotlin version of a sum type +- boxed classes which store validated payloads, sealed permits class implementations + +## Nested Class Summary +| Modifier and Type | Class and Description | +| ----------------- | ---------------------- | +| sealed interface | [UriReferenceFormat.UriReferenceFormat1Boxed](#urireferenceformat1boxed)
    sealed interface for validated payloads | +| record | [UriReferenceFormat.UriReferenceFormat1BoxedVoid](#urireferenceformat1boxedvoid)
    boxed class to store validated null payloads | +| record | [UriReferenceFormat.UriReferenceFormat1BoxedBoolean](#urireferenceformat1boxedboolean)
    boxed class to store validated boolean payloads | +| record | [UriReferenceFormat.UriReferenceFormat1BoxedNumber](#urireferenceformat1boxednumber)
    boxed class to store validated Number payloads | +| record | [UriReferenceFormat.UriReferenceFormat1BoxedString](#urireferenceformat1boxedstring)
    boxed class to store validated String payloads | +| record | [UriReferenceFormat.UriReferenceFormat1BoxedList](#urireferenceformat1boxedlist)
    boxed class to store validated List payloads | +| record | [UriReferenceFormat.UriReferenceFormat1BoxedMap](#urireferenceformat1boxedmap)
    boxed class to store validated Map payloads | +| static class | [UriReferenceFormat.UriReferenceFormat1](#urireferenceformat1)
    schema class | + +## UriReferenceFormat1Boxed +sealed interface UriReferenceFormat1Boxed
    +permits
    +[UriReferenceFormat1BoxedVoid](#urireferenceformat1boxedvoid), +[UriReferenceFormat1BoxedBoolean](#urireferenceformat1boxedboolean), +[UriReferenceFormat1BoxedNumber](#urireferenceformat1boxednumber), +[UriReferenceFormat1BoxedString](#urireferenceformat1boxedstring), +[UriReferenceFormat1BoxedList](#urireferenceformat1boxedlist), +[UriReferenceFormat1BoxedMap](#urireferenceformat1boxedmap) + +sealed interface that stores validated payloads using boxed classes + +## UriReferenceFormat1BoxedVoid +data class UriReferenceFormat1BoxedVoid
    +implements [UriReferenceFormat1Boxed](#urireferenceformat1boxed) + +data class that stores validated null payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| UriReferenceFormat1BoxedVoid(Nothing? data)
    Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| Nothing? | data()
    validated payload | +| Any? | getData()
    validated payload | + +## UriReferenceFormat1BoxedBoolean +data class UriReferenceFormat1BoxedBoolean
    +implements [UriReferenceFormat1Boxed](#urireferenceformat1boxed) + +record that stores validated boolean payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| UriReferenceFormat1BoxedBoolean(boolean data)
    Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| boolean | data()
    validated payload | +| Any? | getData()
    validated payload | + +## UriReferenceFormat1BoxedNumber +data class UriReferenceFormat1BoxedNumber
    +implements [UriReferenceFormat1Boxed](#urireferenceformat1boxed) + +data class that stores validated Number payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| UriReferenceFormat1BoxedNumber(Number data)
    Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| Number | data()
    validated payload | +| Any? | getData()
    validated payload | + +## UriReferenceFormat1BoxedString +data class UriReferenceFormat1BoxedString
    +implements [UriReferenceFormat1Boxed](#urireferenceformat1boxed) + +data class that stores validated String payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| UriReferenceFormat1BoxedString(String data)
    Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| String | data()
    validated payload | +| Any? | getData()
    validated payload | + +## UriReferenceFormat1BoxedList +data class UriReferenceFormat1BoxedList
    +implements [UriReferenceFormat1Boxed](#urireferenceformat1boxed) + +data class that stores validated List payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| UriReferenceFormat1BoxedList(FrozenList data)
    Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| FrozenList | data()
    validated payload | +| Any? | getData()
    validated payload | + +## UriReferenceFormat1BoxedMap +data class UriReferenceFormat1BoxedMap
    +implements [UriReferenceFormat1Boxed](#urireferenceformat1boxed) + +data class that stores validated Map payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| UriReferenceFormat1BoxedMap(FrozenMap data)
    Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| FrozenMap | data()
    validated payload | +| Any? | getData()
    validated payload | + +## UriReferenceFormat1 +class UriReferenceFormat1
    +extends JsonSchema + +A schema class that validates payloads + +### Field Summary +| Modifier and Type | Field and Description | +| ----------------- | ---------------------- | +| String | type = "uri-reference"; | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| String | validate(arg: String, configuration: SchemaConfiguration) | +| Nothing? | validate(arg: Nothing?, configuration: SchemaConfiguration) | +| int | validate(arg: int, configuration: SchemaConfiguration) | +| long | validate(arg: long, configuration: SchemaConfiguration) | +| float | validate(arg: float, configuration: SchemaConfiguration) | +| double | validate(arg: double, configuration: SchemaConfiguration) | +| Number | validate(arg: Number, configuration: SchemaConfiguration) | +| boolean | validate(arg: boolean, configuration: SchemaConfiguration) | +| FrozenMap | validate(arg: Map<?, ?>, configuration: SchemaConfiguration) | +| FrozenList | validate(arg: List<*>, configuration: SchemaConfiguration) | +| [UriReferenceFormat1BoxedString](#urireferenceformat1boxedstring) | validateAndBox(String, configuration: SchemaConfiguration) | +| [UriReferenceFormat1BoxedVoid](#urireferenceformat1boxedvoid) | validateAndBox(Nothing?, configuration: SchemaConfiguration) | +| [UriReferenceFormat1BoxedNumber](#urireferenceformat1boxednumber) | validateAndBox(Number, configuration: SchemaConfiguration) | +| [UriReferenceFormat1BoxedBoolean](#urireferenceformat1boxedboolean) | validateAndBox(boolean, configuration: SchemaConfiguration) | +| [UriReferenceFormat1BoxedMap](#urireferenceformat1boxedmap) | validateAndBox(Map<?, ?>, configuration: SchemaConfiguration) | +| [UriReferenceFormat1BoxedList](#urireferenceformat1boxedlist) | validateAndBox(List<*>, configuration: SchemaConfiguration) | +| [UriReferenceFormat1Boxed](#urireferenceformat1boxed) | validateAndBox(Any?, configuration: SchemaConfiguration) | +| Any? | validate(arg: Any?, configuration: SchemaConfiguration) | + +[[Back to top]](#top) [[Back to Component Schemas]](../../../README.md#Component-Schemas) [[Back to README]](../../../README.md) diff --git a/samples/client/3_1_0_unit_test/kotlin/docs/components/schemas/UriTemplateFormat.md b/samples/client/3_1_0_unit_test/kotlin/docs/components/schemas/UriTemplateFormat.md new file mode 100644 index 00000000000..1c17c912d35 --- /dev/null +++ b/samples/client/3_1_0_unit_test/kotlin/docs/components/schemas/UriTemplateFormat.md @@ -0,0 +1,169 @@ +# UriTemplateFormat +org.openapijsonschematools.client.components.schemas.UriTemplateFormat.java +class UriTemplateFormat
    + +A class that contains necessary nested +- schema classes (which validate payloads), extends JsonSchema +- sealed interfaces which store validated payloads, Kotlin version of a sum type +- boxed classes which store validated payloads, sealed permits class implementations + +## Nested Class Summary +| Modifier and Type | Class and Description | +| ----------------- | ---------------------- | +| sealed interface | [UriTemplateFormat.UriTemplateFormat1Boxed](#uritemplateformat1boxed)
    sealed interface for validated payloads | +| record | [UriTemplateFormat.UriTemplateFormat1BoxedVoid](#uritemplateformat1boxedvoid)
    boxed class to store validated null payloads | +| record | [UriTemplateFormat.UriTemplateFormat1BoxedBoolean](#uritemplateformat1boxedboolean)
    boxed class to store validated boolean payloads | +| record | [UriTemplateFormat.UriTemplateFormat1BoxedNumber](#uritemplateformat1boxednumber)
    boxed class to store validated Number payloads | +| record | [UriTemplateFormat.UriTemplateFormat1BoxedString](#uritemplateformat1boxedstring)
    boxed class to store validated String payloads | +| record | [UriTemplateFormat.UriTemplateFormat1BoxedList](#uritemplateformat1boxedlist)
    boxed class to store validated List payloads | +| record | [UriTemplateFormat.UriTemplateFormat1BoxedMap](#uritemplateformat1boxedmap)
    boxed class to store validated Map payloads | +| static class | [UriTemplateFormat.UriTemplateFormat1](#uritemplateformat1)
    schema class | + +## UriTemplateFormat1Boxed +sealed interface UriTemplateFormat1Boxed
    +permits
    +[UriTemplateFormat1BoxedVoid](#uritemplateformat1boxedvoid), +[UriTemplateFormat1BoxedBoolean](#uritemplateformat1boxedboolean), +[UriTemplateFormat1BoxedNumber](#uritemplateformat1boxednumber), +[UriTemplateFormat1BoxedString](#uritemplateformat1boxedstring), +[UriTemplateFormat1BoxedList](#uritemplateformat1boxedlist), +[UriTemplateFormat1BoxedMap](#uritemplateformat1boxedmap) + +sealed interface that stores validated payloads using boxed classes + +## UriTemplateFormat1BoxedVoid +data class UriTemplateFormat1BoxedVoid
    +implements [UriTemplateFormat1Boxed](#uritemplateformat1boxed) + +data class that stores validated null payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| UriTemplateFormat1BoxedVoid(Nothing? data)
    Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| Nothing? | data()
    validated payload | +| Any? | getData()
    validated payload | + +## UriTemplateFormat1BoxedBoolean +data class UriTemplateFormat1BoxedBoolean
    +implements [UriTemplateFormat1Boxed](#uritemplateformat1boxed) + +record that stores validated boolean payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| UriTemplateFormat1BoxedBoolean(boolean data)
    Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| boolean | data()
    validated payload | +| Any? | getData()
    validated payload | + +## UriTemplateFormat1BoxedNumber +data class UriTemplateFormat1BoxedNumber
    +implements [UriTemplateFormat1Boxed](#uritemplateformat1boxed) + +data class that stores validated Number payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| UriTemplateFormat1BoxedNumber(Number data)
    Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| Number | data()
    validated payload | +| Any? | getData()
    validated payload | + +## UriTemplateFormat1BoxedString +data class UriTemplateFormat1BoxedString
    +implements [UriTemplateFormat1Boxed](#uritemplateformat1boxed) + +data class that stores validated String payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| UriTemplateFormat1BoxedString(String data)
    Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| String | data()
    validated payload | +| Any? | getData()
    validated payload | + +## UriTemplateFormat1BoxedList +data class UriTemplateFormat1BoxedList
    +implements [UriTemplateFormat1Boxed](#uritemplateformat1boxed) + +data class that stores validated List payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| UriTemplateFormat1BoxedList(FrozenList data)
    Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| FrozenList | data()
    validated payload | +| Any? | getData()
    validated payload | + +## UriTemplateFormat1BoxedMap +data class UriTemplateFormat1BoxedMap
    +implements [UriTemplateFormat1Boxed](#uritemplateformat1boxed) + +data class that stores validated Map payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| UriTemplateFormat1BoxedMap(FrozenMap data)
    Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| FrozenMap | data()
    validated payload | +| Any? | getData()
    validated payload | + +## UriTemplateFormat1 +class UriTemplateFormat1
    +extends JsonSchema + +A schema class that validates payloads + +### Field Summary +| Modifier and Type | Field and Description | +| ----------------- | ---------------------- | +| String | type = "uri-template"; | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| String | validate(arg: String, configuration: SchemaConfiguration) | +| Nothing? | validate(arg: Nothing?, configuration: SchemaConfiguration) | +| int | validate(arg: int, configuration: SchemaConfiguration) | +| long | validate(arg: long, configuration: SchemaConfiguration) | +| float | validate(arg: float, configuration: SchemaConfiguration) | +| double | validate(arg: double, configuration: SchemaConfiguration) | +| Number | validate(arg: Number, configuration: SchemaConfiguration) | +| boolean | validate(arg: boolean, configuration: SchemaConfiguration) | +| FrozenMap | validate(arg: Map<?, ?>, configuration: SchemaConfiguration) | +| FrozenList | validate(arg: List<*>, configuration: SchemaConfiguration) | +| [UriTemplateFormat1BoxedString](#uritemplateformat1boxedstring) | validateAndBox(String, configuration: SchemaConfiguration) | +| [UriTemplateFormat1BoxedVoid](#uritemplateformat1boxedvoid) | validateAndBox(Nothing?, configuration: SchemaConfiguration) | +| [UriTemplateFormat1BoxedNumber](#uritemplateformat1boxednumber) | validateAndBox(Number, configuration: SchemaConfiguration) | +| [UriTemplateFormat1BoxedBoolean](#uritemplateformat1boxedboolean) | validateAndBox(boolean, configuration: SchemaConfiguration) | +| [UriTemplateFormat1BoxedMap](#uritemplateformat1boxedmap) | validateAndBox(Map<?, ?>, configuration: SchemaConfiguration) | +| [UriTemplateFormat1BoxedList](#uritemplateformat1boxedlist) | validateAndBox(List<*>, configuration: SchemaConfiguration) | +| [UriTemplateFormat1Boxed](#uritemplateformat1boxed) | validateAndBox(Any?, configuration: SchemaConfiguration) | +| Any? | validate(arg: Any?, configuration: SchemaConfiguration) | + +[[Back to top]](#top) [[Back to Component Schemas]](../../../README.md#Component-Schemas) [[Back to README]](../../../README.md) diff --git a/samples/client/3_1_0_unit_test/kotlin/docs/components/schemas/UuidFormat.md b/samples/client/3_1_0_unit_test/kotlin/docs/components/schemas/UuidFormat.md new file mode 100644 index 00000000000..b086762957a --- /dev/null +++ b/samples/client/3_1_0_unit_test/kotlin/docs/components/schemas/UuidFormat.md @@ -0,0 +1,169 @@ +# UuidFormat +org.openapijsonschematools.client.components.schemas.UuidFormat.java +class UuidFormat
    + +A class that contains necessary nested +- schema classes (which validate payloads), extends JsonSchema +- sealed interfaces which store validated payloads, Kotlin version of a sum type +- boxed classes which store validated payloads, sealed permits class implementations + +## Nested Class Summary +| Modifier and Type | Class and Description | +| ----------------- | ---------------------- | +| sealed interface | [UuidFormat.UuidFormat1Boxed](#uuidformat1boxed)
    sealed interface for validated payloads | +| record | [UuidFormat.UuidFormat1BoxedVoid](#uuidformat1boxedvoid)
    boxed class to store validated null payloads | +| record | [UuidFormat.UuidFormat1BoxedBoolean](#uuidformat1boxedboolean)
    boxed class to store validated boolean payloads | +| record | [UuidFormat.UuidFormat1BoxedNumber](#uuidformat1boxednumber)
    boxed class to store validated Number payloads | +| record | [UuidFormat.UuidFormat1BoxedString](#uuidformat1boxedstring)
    boxed class to store validated String payloads | +| record | [UuidFormat.UuidFormat1BoxedList](#uuidformat1boxedlist)
    boxed class to store validated List payloads | +| record | [UuidFormat.UuidFormat1BoxedMap](#uuidformat1boxedmap)
    boxed class to store validated Map payloads | +| static class | [UuidFormat.UuidFormat1](#uuidformat1)
    schema class | + +## UuidFormat1Boxed +sealed interface UuidFormat1Boxed
    +permits
    +[UuidFormat1BoxedVoid](#uuidformat1boxedvoid), +[UuidFormat1BoxedBoolean](#uuidformat1boxedboolean), +[UuidFormat1BoxedNumber](#uuidformat1boxednumber), +[UuidFormat1BoxedString](#uuidformat1boxedstring), +[UuidFormat1BoxedList](#uuidformat1boxedlist), +[UuidFormat1BoxedMap](#uuidformat1boxedmap) + +sealed interface that stores validated payloads using boxed classes + +## UuidFormat1BoxedVoid +data class UuidFormat1BoxedVoid
    +implements [UuidFormat1Boxed](#uuidformat1boxed) + +data class that stores validated null payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| UuidFormat1BoxedVoid(Nothing? data)
    Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| Nothing? | data()
    validated payload | +| Any? | getData()
    validated payload | + +## UuidFormat1BoxedBoolean +data class UuidFormat1BoxedBoolean
    +implements [UuidFormat1Boxed](#uuidformat1boxed) + +record that stores validated boolean payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| UuidFormat1BoxedBoolean(boolean data)
    Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| boolean | data()
    validated payload | +| Any? | getData()
    validated payload | + +## UuidFormat1BoxedNumber +data class UuidFormat1BoxedNumber
    +implements [UuidFormat1Boxed](#uuidformat1boxed) + +data class that stores validated Number payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| UuidFormat1BoxedNumber(Number data)
    Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| Number | data()
    validated payload | +| Any? | getData()
    validated payload | + +## UuidFormat1BoxedString +data class UuidFormat1BoxedString
    +implements [UuidFormat1Boxed](#uuidformat1boxed) + +data class that stores validated String payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| UuidFormat1BoxedString(String data)
    Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| String | data()
    validated payload | +| Any? | getData()
    validated payload | + +## UuidFormat1BoxedList +data class UuidFormat1BoxedList
    +implements [UuidFormat1Boxed](#uuidformat1boxed) + +data class that stores validated List payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| UuidFormat1BoxedList(FrozenList data)
    Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| FrozenList | data()
    validated payload | +| Any? | getData()
    validated payload | + +## UuidFormat1BoxedMap +data class UuidFormat1BoxedMap
    +implements [UuidFormat1Boxed](#uuidformat1boxed) + +data class that stores validated Map payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| UuidFormat1BoxedMap(FrozenMap data)
    Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| FrozenMap | data()
    validated payload | +| Any? | getData()
    validated payload | + +## UuidFormat1 +class UuidFormat1
    +extends JsonSchema + +A schema class that validates payloads + +### Field Summary +| Modifier and Type | Field and Description | +| ----------------- | ---------------------- | +| String | type = "uuid"; | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| String | validate(arg: String, configuration: SchemaConfiguration) | +| Nothing? | validate(arg: Nothing?, configuration: SchemaConfiguration) | +| int | validate(arg: int, configuration: SchemaConfiguration) | +| long | validate(arg: long, configuration: SchemaConfiguration) | +| float | validate(arg: float, configuration: SchemaConfiguration) | +| double | validate(arg: double, configuration: SchemaConfiguration) | +| Number | validate(arg: Number, configuration: SchemaConfiguration) | +| boolean | validate(arg: boolean, configuration: SchemaConfiguration) | +| FrozenMap | validate(arg: Map<?, ?>, configuration: SchemaConfiguration) | +| FrozenList | validate(arg: List<*>, configuration: SchemaConfiguration) | +| [UuidFormat1BoxedString](#uuidformat1boxedstring) | validateAndBox(String, configuration: SchemaConfiguration) | +| [UuidFormat1BoxedVoid](#uuidformat1boxedvoid) | validateAndBox(Nothing?, configuration: SchemaConfiguration) | +| [UuidFormat1BoxedNumber](#uuidformat1boxednumber) | validateAndBox(Number, configuration: SchemaConfiguration) | +| [UuidFormat1BoxedBoolean](#uuidformat1boxedboolean) | validateAndBox(boolean, configuration: SchemaConfiguration) | +| [UuidFormat1BoxedMap](#uuidformat1boxedmap) | validateAndBox(Map<?, ?>, configuration: SchemaConfiguration) | +| [UuidFormat1BoxedList](#uuidformat1boxedlist) | validateAndBox(List<*>, configuration: SchemaConfiguration) | +| [UuidFormat1Boxed](#uuidformat1boxed) | validateAndBox(Any?, configuration: SchemaConfiguration) | +| Any? | validate(arg: Any?, configuration: SchemaConfiguration) | + +[[Back to top]](#top) [[Back to Component Schemas]](../../../README.md#Component-Schemas) [[Back to README]](../../../README.md) diff --git a/samples/client/3_1_0_unit_test/kotlin/docs/components/schemas/ValidateAgainstCorrectBranchThenVsElse.md b/samples/client/3_1_0_unit_test/kotlin/docs/components/schemas/ValidateAgainstCorrectBranchThenVsElse.md new file mode 100644 index 00000000000..5331dbedc81 --- /dev/null +++ b/samples/client/3_1_0_unit_test/kotlin/docs/components/schemas/ValidateAgainstCorrectBranchThenVsElse.md @@ -0,0 +1,636 @@ +# ValidateAgainstCorrectBranchThenVsElse +org.openapijsonschematools.client.components.schemas.ValidateAgainstCorrectBranchThenVsElse.java +class ValidateAgainstCorrectBranchThenVsElse
    + +A class that contains necessary nested +- schema classes (which validate payloads), extends JsonSchema +- sealed interfaces which store validated payloads, Kotlin version of a sum type +- boxed classes which store validated payloads, sealed permits class implementations + +## Nested Class Summary +| Modifier and Type | Class and Description | +| ----------------- | ---------------------- | +| sealed interface | [ValidateAgainstCorrectBranchThenVsElse.ValidateAgainstCorrectBranchThenVsElse1Boxed](#validateagainstcorrectbranchthenvselse1boxed)
    sealed interface for validated payloads | +| record | [ValidateAgainstCorrectBranchThenVsElse.ValidateAgainstCorrectBranchThenVsElse1BoxedVoid](#validateagainstcorrectbranchthenvselse1boxedvoid)
    boxed class to store validated null payloads | +| record | [ValidateAgainstCorrectBranchThenVsElse.ValidateAgainstCorrectBranchThenVsElse1BoxedBoolean](#validateagainstcorrectbranchthenvselse1boxedboolean)
    boxed class to store validated boolean payloads | +| record | [ValidateAgainstCorrectBranchThenVsElse.ValidateAgainstCorrectBranchThenVsElse1BoxedNumber](#validateagainstcorrectbranchthenvselse1boxednumber)
    boxed class to store validated Number payloads | +| record | [ValidateAgainstCorrectBranchThenVsElse.ValidateAgainstCorrectBranchThenVsElse1BoxedString](#validateagainstcorrectbranchthenvselse1boxedstring)
    boxed class to store validated String payloads | +| record | [ValidateAgainstCorrectBranchThenVsElse.ValidateAgainstCorrectBranchThenVsElse1BoxedList](#validateagainstcorrectbranchthenvselse1boxedlist)
    boxed class to store validated List payloads | +| record | [ValidateAgainstCorrectBranchThenVsElse.ValidateAgainstCorrectBranchThenVsElse1BoxedMap](#validateagainstcorrectbranchthenvselse1boxedmap)
    boxed class to store validated Map payloads | +| static class | [ValidateAgainstCorrectBranchThenVsElse.ValidateAgainstCorrectBranchThenVsElse1](#validateagainstcorrectbranchthenvselse1)
    schema class | +| sealed interface | [ValidateAgainstCorrectBranchThenVsElse.ThenBoxed](#thenboxed)
    sealed interface for validated payloads | +| record | [ValidateAgainstCorrectBranchThenVsElse.ThenBoxedVoid](#thenboxedvoid)
    boxed class to store validated null payloads | +| record | [ValidateAgainstCorrectBranchThenVsElse.ThenBoxedBoolean](#thenboxedboolean)
    boxed class to store validated boolean payloads | +| record | [ValidateAgainstCorrectBranchThenVsElse.ThenBoxedNumber](#thenboxednumber)
    boxed class to store validated Number payloads | +| record | [ValidateAgainstCorrectBranchThenVsElse.ThenBoxedString](#thenboxedstring)
    boxed class to store validated String payloads | +| record | [ValidateAgainstCorrectBranchThenVsElse.ThenBoxedList](#thenboxedlist)
    boxed class to store validated List payloads | +| record | [ValidateAgainstCorrectBranchThenVsElse.ThenBoxedMap](#thenboxedmap)
    boxed class to store validated Map payloads | +| static class | [ValidateAgainstCorrectBranchThenVsElse.Then](#then)
    schema class | +| sealed interface | [ValidateAgainstCorrectBranchThenVsElse.IfSchemaBoxed](#ifschemaboxed)
    sealed interface for validated payloads | +| record | [ValidateAgainstCorrectBranchThenVsElse.IfSchemaBoxedVoid](#ifschemaboxedvoid)
    boxed class to store validated null payloads | +| record | [ValidateAgainstCorrectBranchThenVsElse.IfSchemaBoxedBoolean](#ifschemaboxedboolean)
    boxed class to store validated boolean payloads | +| record | [ValidateAgainstCorrectBranchThenVsElse.IfSchemaBoxedNumber](#ifschemaboxednumber)
    boxed class to store validated Number payloads | +| record | [ValidateAgainstCorrectBranchThenVsElse.IfSchemaBoxedString](#ifschemaboxedstring)
    boxed class to store validated String payloads | +| record | [ValidateAgainstCorrectBranchThenVsElse.IfSchemaBoxedList](#ifschemaboxedlist)
    boxed class to store validated List payloads | +| record | [ValidateAgainstCorrectBranchThenVsElse.IfSchemaBoxedMap](#ifschemaboxedmap)
    boxed class to store validated Map payloads | +| static class | [ValidateAgainstCorrectBranchThenVsElse.IfSchema](#ifschema)
    schema class | +| sealed interface | [ValidateAgainstCorrectBranchThenVsElse.ElseSchemaBoxed](#elseschemaboxed)
    sealed interface for validated payloads | +| record | [ValidateAgainstCorrectBranchThenVsElse.ElseSchemaBoxedVoid](#elseschemaboxedvoid)
    boxed class to store validated null payloads | +| record | [ValidateAgainstCorrectBranchThenVsElse.ElseSchemaBoxedBoolean](#elseschemaboxedboolean)
    boxed class to store validated boolean payloads | +| record | [ValidateAgainstCorrectBranchThenVsElse.ElseSchemaBoxedNumber](#elseschemaboxednumber)
    boxed class to store validated Number payloads | +| record | [ValidateAgainstCorrectBranchThenVsElse.ElseSchemaBoxedString](#elseschemaboxedstring)
    boxed class to store validated String payloads | +| record | [ValidateAgainstCorrectBranchThenVsElse.ElseSchemaBoxedList](#elseschemaboxedlist)
    boxed class to store validated List payloads | +| record | [ValidateAgainstCorrectBranchThenVsElse.ElseSchemaBoxedMap](#elseschemaboxedmap)
    boxed class to store validated Map payloads | +| static class | [ValidateAgainstCorrectBranchThenVsElse.ElseSchema](#elseschema)
    schema class | + +## ValidateAgainstCorrectBranchThenVsElse1Boxed +sealed interface ValidateAgainstCorrectBranchThenVsElse1Boxed
    +permits
    +[ValidateAgainstCorrectBranchThenVsElse1BoxedVoid](#validateagainstcorrectbranchthenvselse1boxedvoid), +[ValidateAgainstCorrectBranchThenVsElse1BoxedBoolean](#validateagainstcorrectbranchthenvselse1boxedboolean), +[ValidateAgainstCorrectBranchThenVsElse1BoxedNumber](#validateagainstcorrectbranchthenvselse1boxednumber), +[ValidateAgainstCorrectBranchThenVsElse1BoxedString](#validateagainstcorrectbranchthenvselse1boxedstring), +[ValidateAgainstCorrectBranchThenVsElse1BoxedList](#validateagainstcorrectbranchthenvselse1boxedlist), +[ValidateAgainstCorrectBranchThenVsElse1BoxedMap](#validateagainstcorrectbranchthenvselse1boxedmap) + +sealed interface that stores validated payloads using boxed classes + +## ValidateAgainstCorrectBranchThenVsElse1BoxedVoid +data class ValidateAgainstCorrectBranchThenVsElse1BoxedVoid
    +implements [ValidateAgainstCorrectBranchThenVsElse1Boxed](#validateagainstcorrectbranchthenvselse1boxed) + +data class that stores validated null payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| ValidateAgainstCorrectBranchThenVsElse1BoxedVoid(Nothing? data)
    Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| Nothing? | data()
    validated payload | +| Any? | getData()
    validated payload | + +## ValidateAgainstCorrectBranchThenVsElse1BoxedBoolean +data class ValidateAgainstCorrectBranchThenVsElse1BoxedBoolean
    +implements [ValidateAgainstCorrectBranchThenVsElse1Boxed](#validateagainstcorrectbranchthenvselse1boxed) + +record that stores validated boolean payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| ValidateAgainstCorrectBranchThenVsElse1BoxedBoolean(boolean data)
    Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| boolean | data()
    validated payload | +| Any? | getData()
    validated payload | + +## ValidateAgainstCorrectBranchThenVsElse1BoxedNumber +data class ValidateAgainstCorrectBranchThenVsElse1BoxedNumber
    +implements [ValidateAgainstCorrectBranchThenVsElse1Boxed](#validateagainstcorrectbranchthenvselse1boxed) + +data class that stores validated Number payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| ValidateAgainstCorrectBranchThenVsElse1BoxedNumber(Number data)
    Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| Number | data()
    validated payload | +| Any? | getData()
    validated payload | + +## ValidateAgainstCorrectBranchThenVsElse1BoxedString +data class ValidateAgainstCorrectBranchThenVsElse1BoxedString
    +implements [ValidateAgainstCorrectBranchThenVsElse1Boxed](#validateagainstcorrectbranchthenvselse1boxed) + +data class that stores validated String payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| ValidateAgainstCorrectBranchThenVsElse1BoxedString(String data)
    Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| String | data()
    validated payload | +| Any? | getData()
    validated payload | + +## ValidateAgainstCorrectBranchThenVsElse1BoxedList +data class ValidateAgainstCorrectBranchThenVsElse1BoxedList
    +implements [ValidateAgainstCorrectBranchThenVsElse1Boxed](#validateagainstcorrectbranchthenvselse1boxed) + +data class that stores validated List payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| ValidateAgainstCorrectBranchThenVsElse1BoxedList(FrozenList data)
    Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| FrozenList | data()
    validated payload | +| Any? | getData()
    validated payload | + +## ValidateAgainstCorrectBranchThenVsElse1BoxedMap +data class ValidateAgainstCorrectBranchThenVsElse1BoxedMap
    +implements [ValidateAgainstCorrectBranchThenVsElse1Boxed](#validateagainstcorrectbranchthenvselse1boxed) + +data class that stores validated Map payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| ValidateAgainstCorrectBranchThenVsElse1BoxedMap(FrozenMap data)
    Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| FrozenMap | data()
    validated payload | +| Any? | getData()
    validated payload | + +## ValidateAgainstCorrectBranchThenVsElse1 +class ValidateAgainstCorrectBranchThenVsElse1
    +extends JsonSchema + +A schema class that validates payloads + +### Field Summary +| Modifier and Type | Field and Description | +| ----------------- | ---------------------- | +| Class | if = [IfSchema::class.java](#ifschema) | +| Class | then = [Then::class.java](#then) | +| Class | elseSchema = [ElseSchema::class.java](#elseschema) | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| String | validate(arg: String, configuration: SchemaConfiguration) | +| Nothing? | validate(arg: Nothing?, configuration: SchemaConfiguration) | +| int | validate(arg: int, configuration: SchemaConfiguration) | +| long | validate(arg: long, configuration: SchemaConfiguration) | +| float | validate(arg: float, configuration: SchemaConfiguration) | +| double | validate(arg: double, configuration: SchemaConfiguration) | +| Number | validate(arg: Number, configuration: SchemaConfiguration) | +| boolean | validate(arg: boolean, configuration: SchemaConfiguration) | +| FrozenMap | validate(arg: Map<?, ?>, configuration: SchemaConfiguration) | +| FrozenList | validate(arg: List<*>, configuration: SchemaConfiguration) | +| [ValidateAgainstCorrectBranchThenVsElse1BoxedString](#validateagainstcorrectbranchthenvselse1boxedstring) | validateAndBox(String, configuration: SchemaConfiguration) | +| [ValidateAgainstCorrectBranchThenVsElse1BoxedVoid](#validateagainstcorrectbranchthenvselse1boxedvoid) | validateAndBox(Nothing?, configuration: SchemaConfiguration) | +| [ValidateAgainstCorrectBranchThenVsElse1BoxedNumber](#validateagainstcorrectbranchthenvselse1boxednumber) | validateAndBox(Number, configuration: SchemaConfiguration) | +| [ValidateAgainstCorrectBranchThenVsElse1BoxedBoolean](#validateagainstcorrectbranchthenvselse1boxedboolean) | validateAndBox(boolean, configuration: SchemaConfiguration) | +| [ValidateAgainstCorrectBranchThenVsElse1BoxedMap](#validateagainstcorrectbranchthenvselse1boxedmap) | validateAndBox(Map<?, ?>, configuration: SchemaConfiguration) | +| [ValidateAgainstCorrectBranchThenVsElse1BoxedList](#validateagainstcorrectbranchthenvselse1boxedlist) | validateAndBox(List<*>, configuration: SchemaConfiguration) | +| [ValidateAgainstCorrectBranchThenVsElse1Boxed](#validateagainstcorrectbranchthenvselse1boxed) | validateAndBox(Any?, configuration: SchemaConfiguration) | +| Any? | validate(arg: Any?, configuration: SchemaConfiguration) | + +## ThenBoxed +sealed interface ThenBoxed
    +permits
    +[ThenBoxedVoid](#thenboxedvoid), +[ThenBoxedBoolean](#thenboxedboolean), +[ThenBoxedNumber](#thenboxednumber), +[ThenBoxedString](#thenboxedstring), +[ThenBoxedList](#thenboxedlist), +[ThenBoxedMap](#thenboxedmap) + +sealed interface that stores validated payloads using boxed classes + +## ThenBoxedVoid +data class ThenBoxedVoid
    +implements [ThenBoxed](#thenboxed) + +data class that stores validated null payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| ThenBoxedVoid(Nothing? data)
    Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| Nothing? | data()
    validated payload | +| Any? | getData()
    validated payload | + +## ThenBoxedBoolean +data class ThenBoxedBoolean
    +implements [ThenBoxed](#thenboxed) + +record that stores validated boolean payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| ThenBoxedBoolean(boolean data)
    Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| boolean | data()
    validated payload | +| Any? | getData()
    validated payload | + +## ThenBoxedNumber +data class ThenBoxedNumber
    +implements [ThenBoxed](#thenboxed) + +data class that stores validated Number payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| ThenBoxedNumber(Number data)
    Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| Number | data()
    validated payload | +| Any? | getData()
    validated payload | + +## ThenBoxedString +data class ThenBoxedString
    +implements [ThenBoxed](#thenboxed) + +data class that stores validated String payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| ThenBoxedString(String data)
    Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| String | data()
    validated payload | +| Any? | getData()
    validated payload | + +## ThenBoxedList +data class ThenBoxedList
    +implements [ThenBoxed](#thenboxed) + +data class that stores validated List payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| ThenBoxedList(FrozenList data)
    Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| FrozenList | data()
    validated payload | +| Any? | getData()
    validated payload | + +## ThenBoxedMap +data class ThenBoxedMap
    +implements [ThenBoxed](#thenboxed) + +data class that stores validated Map payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| ThenBoxedMap(FrozenMap data)
    Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| FrozenMap | data()
    validated payload | +| Any? | getData()
    validated payload | + +## Then +class Then
    +extends JsonSchema + +A schema class that validates payloads + +### Field Summary +| Modifier and Type | Field and Description | +| ----------------- | ---------------------- | +| Number | minimum = -10 | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| String | validate(arg: String, configuration: SchemaConfiguration) | +| Nothing? | validate(arg: Nothing?, configuration: SchemaConfiguration) | +| int | validate(arg: int, configuration: SchemaConfiguration) | +| long | validate(arg: long, configuration: SchemaConfiguration) | +| float | validate(arg: float, configuration: SchemaConfiguration) | +| double | validate(arg: double, configuration: SchemaConfiguration) | +| Number | validate(arg: Number, configuration: SchemaConfiguration) | +| boolean | validate(arg: boolean, configuration: SchemaConfiguration) | +| FrozenMap | validate(arg: Map<?, ?>, configuration: SchemaConfiguration) | +| FrozenList | validate(arg: List<*>, configuration: SchemaConfiguration) | +| [ThenBoxedString](#thenboxedstring) | validateAndBox(String, configuration: SchemaConfiguration) | +| [ThenBoxedVoid](#thenboxedvoid) | validateAndBox(Nothing?, configuration: SchemaConfiguration) | +| [ThenBoxedNumber](#thenboxednumber) | validateAndBox(Number, configuration: SchemaConfiguration) | +| [ThenBoxedBoolean](#thenboxedboolean) | validateAndBox(boolean, configuration: SchemaConfiguration) | +| [ThenBoxedMap](#thenboxedmap) | validateAndBox(Map<?, ?>, configuration: SchemaConfiguration) | +| [ThenBoxedList](#thenboxedlist) | validateAndBox(List<*>, configuration: SchemaConfiguration) | +| [ThenBoxed](#thenboxed) | validateAndBox(Any?, configuration: SchemaConfiguration) | +| Any? | validate(arg: Any?, configuration: SchemaConfiguration) | + +## IfSchemaBoxed +sealed interface IfSchemaBoxed
    +permits
    +[IfSchemaBoxedVoid](#ifschemaboxedvoid), +[IfSchemaBoxedBoolean](#ifschemaboxedboolean), +[IfSchemaBoxedNumber](#ifschemaboxednumber), +[IfSchemaBoxedString](#ifschemaboxedstring), +[IfSchemaBoxedList](#ifschemaboxedlist), +[IfSchemaBoxedMap](#ifschemaboxedmap) + +sealed interface that stores validated payloads using boxed classes + +## IfSchemaBoxedVoid +data class IfSchemaBoxedVoid
    +implements [IfSchemaBoxed](#ifschemaboxed) + +data class that stores validated null payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| IfSchemaBoxedVoid(Nothing? data)
    Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| Nothing? | data()
    validated payload | +| Any? | getData()
    validated payload | + +## IfSchemaBoxedBoolean +data class IfSchemaBoxedBoolean
    +implements [IfSchemaBoxed](#ifschemaboxed) + +record that stores validated boolean payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| IfSchemaBoxedBoolean(boolean data)
    Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| boolean | data()
    validated payload | +| Any? | getData()
    validated payload | + +## IfSchemaBoxedNumber +data class IfSchemaBoxedNumber
    +implements [IfSchemaBoxed](#ifschemaboxed) + +data class that stores validated Number payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| IfSchemaBoxedNumber(Number data)
    Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| Number | data()
    validated payload | +| Any? | getData()
    validated payload | + +## IfSchemaBoxedString +data class IfSchemaBoxedString
    +implements [IfSchemaBoxed](#ifschemaboxed) + +data class that stores validated String payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| IfSchemaBoxedString(String data)
    Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| String | data()
    validated payload | +| Any? | getData()
    validated payload | + +## IfSchemaBoxedList +data class IfSchemaBoxedList
    +implements [IfSchemaBoxed](#ifschemaboxed) + +data class that stores validated List payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| IfSchemaBoxedList(FrozenList data)
    Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| FrozenList | data()
    validated payload | +| Any? | getData()
    validated payload | + +## IfSchemaBoxedMap +data class IfSchemaBoxedMap
    +implements [IfSchemaBoxed](#ifschemaboxed) + +data class that stores validated Map payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| IfSchemaBoxedMap(FrozenMap data)
    Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| FrozenMap | data()
    validated payload | +| Any? | getData()
    validated payload | + +## IfSchema +class IfSchema
    +extends JsonSchema + +A schema class that validates payloads + +### Field Summary +| Modifier and Type | Field and Description | +| ----------------- | ---------------------- | +| Number | exclusiveMaximum = 0 | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| String | validate(arg: String, configuration: SchemaConfiguration) | +| Nothing? | validate(arg: Nothing?, configuration: SchemaConfiguration) | +| int | validate(arg: int, configuration: SchemaConfiguration) | +| long | validate(arg: long, configuration: SchemaConfiguration) | +| float | validate(arg: float, configuration: SchemaConfiguration) | +| double | validate(arg: double, configuration: SchemaConfiguration) | +| Number | validate(arg: Number, configuration: SchemaConfiguration) | +| boolean | validate(arg: boolean, configuration: SchemaConfiguration) | +| FrozenMap | validate(arg: Map<?, ?>, configuration: SchemaConfiguration) | +| FrozenList | validate(arg: List<*>, configuration: SchemaConfiguration) | +| [IfSchemaBoxedString](#ifschemaboxedstring) | validateAndBox(String, configuration: SchemaConfiguration) | +| [IfSchemaBoxedVoid](#ifschemaboxedvoid) | validateAndBox(Nothing?, configuration: SchemaConfiguration) | +| [IfSchemaBoxedNumber](#ifschemaboxednumber) | validateAndBox(Number, configuration: SchemaConfiguration) | +| [IfSchemaBoxedBoolean](#ifschemaboxedboolean) | validateAndBox(boolean, configuration: SchemaConfiguration) | +| [IfSchemaBoxedMap](#ifschemaboxedmap) | validateAndBox(Map<?, ?>, configuration: SchemaConfiguration) | +| [IfSchemaBoxedList](#ifschemaboxedlist) | validateAndBox(List<*>, configuration: SchemaConfiguration) | +| [IfSchemaBoxed](#ifschemaboxed) | validateAndBox(Any?, configuration: SchemaConfiguration) | +| Any? | validate(arg: Any?, configuration: SchemaConfiguration) | + +## ElseSchemaBoxed +sealed interface ElseSchemaBoxed
    +permits
    +[ElseSchemaBoxedVoid](#elseschemaboxedvoid), +[ElseSchemaBoxedBoolean](#elseschemaboxedboolean), +[ElseSchemaBoxedNumber](#elseschemaboxednumber), +[ElseSchemaBoxedString](#elseschemaboxedstring), +[ElseSchemaBoxedList](#elseschemaboxedlist), +[ElseSchemaBoxedMap](#elseschemaboxedmap) + +sealed interface that stores validated payloads using boxed classes + +## ElseSchemaBoxedVoid +data class ElseSchemaBoxedVoid
    +implements [ElseSchemaBoxed](#elseschemaboxed) + +data class that stores validated null payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| ElseSchemaBoxedVoid(Nothing? data)
    Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| Nothing? | data()
    validated payload | +| Any? | getData()
    validated payload | + +## ElseSchemaBoxedBoolean +data class ElseSchemaBoxedBoolean
    +implements [ElseSchemaBoxed](#elseschemaboxed) + +record that stores validated boolean payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| ElseSchemaBoxedBoolean(boolean data)
    Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| boolean | data()
    validated payload | +| Any? | getData()
    validated payload | + +## ElseSchemaBoxedNumber +data class ElseSchemaBoxedNumber
    +implements [ElseSchemaBoxed](#elseschemaboxed) + +data class that stores validated Number payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| ElseSchemaBoxedNumber(Number data)
    Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| Number | data()
    validated payload | +| Any? | getData()
    validated payload | + +## ElseSchemaBoxedString +data class ElseSchemaBoxedString
    +implements [ElseSchemaBoxed](#elseschemaboxed) + +data class that stores validated String payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| ElseSchemaBoxedString(String data)
    Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| String | data()
    validated payload | +| Any? | getData()
    validated payload | + +## ElseSchemaBoxedList +data class ElseSchemaBoxedList
    +implements [ElseSchemaBoxed](#elseschemaboxed) + +data class that stores validated List payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| ElseSchemaBoxedList(FrozenList data)
    Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| FrozenList | data()
    validated payload | +| Any? | getData()
    validated payload | + +## ElseSchemaBoxedMap +data class ElseSchemaBoxedMap
    +implements [ElseSchemaBoxed](#elseschemaboxed) + +data class that stores validated Map payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| ElseSchemaBoxedMap(FrozenMap data)
    Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| FrozenMap | data()
    validated payload | +| Any? | getData()
    validated payload | + +## ElseSchema +class ElseSchema
    +extends JsonSchema + +A schema class that validates payloads + +### Field Summary +| Modifier and Type | Field and Description | +| ----------------- | ---------------------- | +| BigDecimal | multipleOf = BigDecimal("2") | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| String | validate(arg: String, configuration: SchemaConfiguration) | +| Nothing? | validate(arg: Nothing?, configuration: SchemaConfiguration) | +| int | validate(arg: int, configuration: SchemaConfiguration) | +| long | validate(arg: long, configuration: SchemaConfiguration) | +| float | validate(arg: float, configuration: SchemaConfiguration) | +| double | validate(arg: double, configuration: SchemaConfiguration) | +| Number | validate(arg: Number, configuration: SchemaConfiguration) | +| boolean | validate(arg: boolean, configuration: SchemaConfiguration) | +| FrozenMap | validate(arg: Map<?, ?>, configuration: SchemaConfiguration) | +| FrozenList | validate(arg: List<*>, configuration: SchemaConfiguration) | +| [ElseSchemaBoxedString](#elseschemaboxedstring) | validateAndBox(String, configuration: SchemaConfiguration) | +| [ElseSchemaBoxedVoid](#elseschemaboxedvoid) | validateAndBox(Nothing?, configuration: SchemaConfiguration) | +| [ElseSchemaBoxedNumber](#elseschemaboxednumber) | validateAndBox(Number, configuration: SchemaConfiguration) | +| [ElseSchemaBoxedBoolean](#elseschemaboxedboolean) | validateAndBox(boolean, configuration: SchemaConfiguration) | +| [ElseSchemaBoxedMap](#elseschemaboxedmap) | validateAndBox(Map<?, ?>, configuration: SchemaConfiguration) | +| [ElseSchemaBoxedList](#elseschemaboxedlist) | validateAndBox(List<*>, configuration: SchemaConfiguration) | +| [ElseSchemaBoxed](#elseschemaboxed) | validateAndBox(Any?, configuration: SchemaConfiguration) | +| Any? | validate(arg: Any?, configuration: SchemaConfiguration) | + +[[Back to top]](#top) [[Back to Component Schemas]](../../../README.md#Component-Schemas) [[Back to README]](../../../README.md) diff --git a/samples/client/3_1_0_unit_test/kotlin/docs/servers/RootServer0.md b/samples/client/3_1_0_unit_test/kotlin/docs/servers/RootServer0.md new file mode 100644 index 00000000000..08ddb1be947 --- /dev/null +++ b/samples/client/3_1_0_unit_test/kotlin/docs/servers/RootServer0.md @@ -0,0 +1,17 @@ +org.openapijsonschematools.client.servers.RootServer0 +# Server RootServer0 +public class RootServer0 + +A class that stores a server url + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| RootServer0()
    Creates a server | + +### Field Summary +| Modifier and Type | Field and Description | +| ----------------- | --------------------- | +| String | url = "https://someserver.com/v1" | + +[[Back to top]](#top) [[Back to Servers]](../../README.md#Servers) [[Back to README]](../../README.md) diff --git a/samples/client/3_1_0_unit_test/kotlin/settings.gradle.kts b/samples/client/3_1_0_unit_test/kotlin/settings.gradle.kts new file mode 100644 index 00000000000..65c368589f6 --- /dev/null +++ b/samples/client/3_1_0_unit_test/kotlin/settings.gradle.kts @@ -0,0 +1,2 @@ +rootProject.name = "unit-test-api" + diff --git a/samples/client/3_1_0_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/RootServerInfo.kt b/samples/client/3_1_0_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/RootServerInfo.kt new file mode 100644 index 00000000000..2d583252938 --- /dev/null +++ b/samples/client/3_1_0_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/RootServerInfo.kt @@ -0,0 +1,20 @@ +package org.openapijsonschematools.client + +import org.openapijsonschematools.client.servers.RootServer0 +import org.openapijsonschematools.client.servers.Server +import org.openapijsonschematools.client.servers.ServerProvider + +class RootServerInfo { + class RootServerInfo1( + private val server0: RootServer0 = RootServer0() + ) : ServerProvider { + + override fun getServer(serverIndex: ServerIndex): Server { + return server0 + } + } + + enum class ServerIndex { + SERVER_0 + } +} \ No newline at end of file diff --git a/samples/client/3_1_0_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/schemas/ASchemaGivenForPrefixitems.kt b/samples/client/3_1_0_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/schemas/ASchemaGivenForPrefixitems.kt new file mode 100644 index 00000000000..561f561d6f1 --- /dev/null +++ b/samples/client/3_1_0_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/schemas/ASchemaGivenForPrefixitems.kt @@ -0,0 +1,408 @@ +package org.openapijsonschematools.client.components.schemas +import java.time.LocalDate +import java.time.ZonedDateTime +import java.util.UUID +import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags +import org.openapijsonschematools.client.configurations.SchemaConfiguration +import org.openapijsonschematools.client.exceptions.InvalidAdditionalPropertyException +import org.openapijsonschematools.client.exceptions.UnsetPropertyException +import org.openapijsonschematools.client.exceptions.ValidationException +import org.openapijsonschematools.client.schemas.IntJsonSchema +import org.openapijsonschematools.client.schemas.StringJsonSchema +import org.openapijsonschematools.client.schemas.UnsetAddPropsSetter +import org.openapijsonschematools.client.schemas.validation.BooleanSchemaValidator +import org.openapijsonschematools.client.schemas.validation.FrozenList +import org.openapijsonschematools.client.schemas.validation.FrozenMap +import org.openapijsonschematools.client.schemas.validation.JsonSchema +import org.openapijsonschematools.client.schemas.validation.JsonSchemaInfo +import org.openapijsonschematools.client.schemas.validation.ListSchemaValidator +import org.openapijsonschematools.client.schemas.validation.MapSchemaValidator +import org.openapijsonschematools.client.schemas.validation.NullSchemaValidator +import org.openapijsonschematools.client.schemas.validation.NumberSchemaValidator +import org.openapijsonschematools.client.schemas.validation.PathToSchemasMap +import org.openapijsonschematools.client.schemas.validation.StringSchemaValidator +import org.openapijsonschematools.client.schemas.validation.ValidationMetadata + +class ASchemaGivenForPrefixitems { + // nest classes so all schemas and input/output classes can be public + + + class ASchemaGivenForPrefixitemsList(m: FrozenList) : FrozenList(m) { + companion object { + @Throws(ValidationException::class) + fun of(arg: List, configuration: SchemaConfiguration?): ASchemaGivenForPrefixitemsList { + return ASchemaGivenForPrefixitems1.getInstance().validate(arg, configuration) + } + } + } + + class ASchemaGivenForPrefixitemsListBuilder { + // class to build List + private val list: MutableList + + init { + this.list = ArrayList() + } + + + fun add(item: Nothing?): ASchemaGivenForPrefixitemsListBuilder { + list.add(null) + return this + } + + fun add(item: Boolean): ASchemaGivenForPrefixitemsListBuilder { + list.add(item) + return this + } + + fun add(item: String): ASchemaGivenForPrefixitemsListBuilder { + list.add(item) + return this + } + + fun add(item: Int): ASchemaGivenForPrefixitemsListBuilder { + list.add(item) + return this + } + + fun add(item: Float): ASchemaGivenForPrefixitemsListBuilder { + list.add(item) + return this + } + + fun add(item: Long): ASchemaGivenForPrefixitemsListBuilder { + list.add(item) + return this + } + + fun add(item: Double): ASchemaGivenForPrefixitemsListBuilder { + list.add(item) + return this + } + + fun add(item: List<*>): ASchemaGivenForPrefixitemsListBuilder { + list.add(item) + return this + } + + fun add(item: Map): ASchemaGivenForPrefixitemsListBuilder { + list.add(item) + return this + } + + fun build(): List { + return list + } + } + + + class Schema0 : IntJsonSchema.IntJsonSchema1() { + companion object { + @Volatile + private var instance: Schema0? = null + + fun getInstance() = + instance ?: synchronized(this) { + instance ?: Schema0().also { instance = it } + } + } + } + + + class Schema1 : StringJsonSchema.StringJsonSchema1() { + companion object { + @Volatile + private var instance: Schema1? = null + + fun getInstance() = + instance ?: synchronized(this) { + instance ?: Schema1().also { instance = it } + } + } + } + + + sealed interface ASchemaGivenForPrefixitems1Boxed { + fun getData(): Any? + } + + data class ASchemaGivenForPrefixitems1BoxedVoid(val data: Nothing?) : ASchemaGivenForPrefixitems1Boxed { + override fun getData(): Any? { + return data + } + } + + data class ASchemaGivenForPrefixitems1BoxedBoolean(val data: Boolean): ASchemaGivenForPrefixitems1Boxed { + override fun getData(): Any? { + return data + } + } + + data class ASchemaGivenForPrefixitems1BoxedNumber(val data: Number) : ASchemaGivenForPrefixitems1Boxed { + override fun getData(): Any? { + return data + } + } + + data class ASchemaGivenForPrefixitems1BoxedString(val data: String) : ASchemaGivenForPrefixitems1Boxed { + override fun getData(): Any? { + return data + } + } + + data class ASchemaGivenForPrefixitems1BoxedList(val data: ASchemaGivenForPrefixitemsList) : ASchemaGivenForPrefixitems1Boxed { + override fun getData(): Any? { + return data + } + } + + data class ASchemaGivenForPrefixitems1BoxedMap(val data: FrozenMap) : ASchemaGivenForPrefixitems1Boxed { + override fun getData(): Any? { + return data + } + } + + + class ASchemaGivenForPrefixitems1 private constructor(): JsonSchema( + JsonSchemaInfo() + .prefixItems(listOf( + Schema0::class.java, + Schema1::class.java + )) + ), NullSchemaValidator, BooleanSchemaValidator, NumberSchemaValidator, StringSchemaValidator, ListSchemaValidator, MapSchemaValidator, ASchemaGivenForPrefixitems1BoxedMap> { + /* + NOTE: This class is auto generated by OpenAPI JSON Schema Generator. + Ref: https://github.com/openapi-json-schema-tools/openapi-json-schema-generator + + Do not edit the class manually. + */ + + companion object { + @Volatile + private var instance: ASchemaGivenForPrefixitems1? = null + + fun getInstance() = + instance ?: synchronized(this) { + instance ?: ASchemaGivenForPrefixitems1().also { instance = it } + } + } + + @Throws(ValidationException::class) + override fun validate(arg: Nothing?, configuration: SchemaConfiguration?): Nothing? { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validatedPathToSchemas = PathToSchemasMap() + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, LinkedHashSet()) + getPathToSchemas(this, castArg, validationMetadata, pathSet) + return castArg + } + + @Throws(ValidationException::class) + override fun validate(arg: Boolean, configuration: SchemaConfiguration?): Boolean { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validatedPathToSchemas = PathToSchemasMap() + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, LinkedHashSet()) + getPathToSchemas(this, castArg, validationMetadata, pathSet) + return castArg + } + + @Throws(ValidationException::class) + override fun validate(arg: Number, configuration: SchemaConfiguration?): Number { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validatedPathToSchemas = PathToSchemasMap() + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, LinkedHashSet()) + getPathToSchemas(this, castArg, validationMetadata, pathSet) + return castArg + } + + @Throws(ValidationException::class) + fun validate(arg: Int, configuration: SchemaConfiguration?): Int { + return validate(arg as Number, configuration) as Int + } + + @Throws(ValidationException::class) + fun validate(arg: Long, configuration: SchemaConfiguration?): Long { + return validate(arg as Number, configuration) as Long + } + + @Throws(ValidationException::class) + fun validate(arg: Float, configuration: SchemaConfiguration?): Float { + return validate(arg as Number, configuration) as Float + } + + @Throws(ValidationException::class) + fun validate(arg: Double, configuration: SchemaConfiguration?): Double { + return validate(arg as Number, configuration) as Double + } + + @Throws(ValidationException::class) + override fun validate(arg: String, configuration: SchemaConfiguration?): String { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validatedPathToSchemas = PathToSchemasMap() + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, LinkedHashSet()) + getPathToSchemas(this, castArg, validationMetadata, pathSet) + return castArg + } + + @Throws(ValidationException::class) + fun validate(arg: LocalDate, configuration: SchemaConfiguration?): String { + return validate(arg.toString(), configuration) + } + + @Throws(ValidationException::class) + fun validate(arg: ZonedDateTime, configuration: SchemaConfiguration?): String { + return validate(arg.toString(), configuration) + } + + @Throws(ValidationException::class) + fun validate(arg: UUID, configuration: SchemaConfiguration?): String { + return validate(arg.toString(), configuration) + } + + override fun getNewInstance(arg: List<*>, pathToItem: List, pathToSchemas: PathToSchemasMap): ASchemaGivenForPrefixitemsList { + val items: MutableList = ArrayList() + var i: Int = 0 + for (item: Any? in arg) { + val itemPathToItem = pathToItem + i + val schemas: LinkedHashMap, Nothing?>? = pathToSchemas.get(itemPathToItem) + if (schemas == null) { + throw RuntimeException("Validation result is invalid, schemas must exist for a pathToItem") + } + val itemSchema: JsonSchema<*> = schemas.entries.iterator().next().key + val itemInstance: Any? = itemSchema.getNewInstance(item, itemPathToItem, pathToSchemas) + items.add(itemInstance) + i += 1 + } + val newInstanceItems: FrozenList = FrozenList(items) + return ASchemaGivenForPrefixitemsList(newInstanceItems) + } + + @Throws(ValidationException::class) + override fun validate(arg: List<*>, configuration: SchemaConfiguration?): ASchemaGivenForPrefixitemsList { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, PathToSchemasMap(), LinkedHashSet()) + val pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet) + return getNewInstance(castArg, validationMetadata.pathToItem, pathToSchemasMap) + } + + override fun getNewInstance(arg: Map<*, *>, pathToItem: List, pathToSchemas: PathToSchemasMap): FrozenMap { + val properties: LinkedHashMap = LinkedHashMap() + for((propertyName, value) in arg) { + if (!(propertyName is String)) { + throw RuntimeException("Invalid non-string key value") + } + val propertyPathToItem: List = pathToItem + propertyName + val schemas: LinkedHashMap, Nothing?>? = pathToSchemas.get(propertyPathToItem) + if (schemas == null) { + throw RuntimeException("Validation result is invalid, schemas must exist for a pathToItem") + } + val propertySchema: JsonSchema<*> = schemas.entries.iterator().next().key + val propertyInstance: Any? = propertySchema.getNewInstance(value, propertyPathToItem, pathToSchemas) + properties[propertyName] = propertyInstance + } + val castProperties: FrozenMap = FrozenMap(properties) + return castProperties + } + + @Throws(ValidationException::class) + override fun validate(arg: Map<*, *>, configuration: SchemaConfiguration?): FrozenMap { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validatedPathToSchemas = PathToSchemasMap() + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, LinkedHashSet()) + val pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet) + return getNewInstance(castArg, validationMetadata.pathToItem, pathToSchemasMap) + } + + @Throws(ValidationException::class) + override fun validate(arg: Any?, configuration: SchemaConfiguration?): Any? { + if (arg == null) { + return validate(null, configuration) + } else if (arg is Boolean) { + return validate(arg, configuration) + } else if (arg is Number) { + return validate(arg, configuration) + } else if (arg is String) { + return validate(arg, configuration) + } else if (arg is List<*>) { + return validate(arg, configuration) + } else if (arg is Map<*, *>) { + return validate(arg, configuration) + } + throw ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema") + } + override fun getNewInstance(arg: Any?, pathToItem: List, pathToSchemas: PathToSchemasMap): Any? { + if (arg == null) { + return getNewInstance( null, pathToItem, pathToSchemas) + } else if (arg is Boolean) { + return getNewInstance(arg, pathToItem, pathToSchemas) + } else if (arg is Number) { + return getNewInstance(arg, pathToItem, pathToSchemas) + } else if (arg is String) { + return getNewInstance(arg, pathToItem, pathToSchemas) + } else if (arg is List<*>) { + return getNewInstance(arg, pathToItem, pathToSchemas) + } else if (arg is Map<*, *>) { + return getNewInstance(arg, pathToItem, pathToSchemas) + } + throw RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema") + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: Nothing?, configuration: SchemaConfiguration?): ASchemaGivenForPrefixitems1BoxedVoid { + return ASchemaGivenForPrefixitems1BoxedVoid(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: Boolean, configuration: SchemaConfiguration?): ASchemaGivenForPrefixitems1BoxedBoolean { + return ASchemaGivenForPrefixitems1BoxedBoolean(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: Number, configuration: SchemaConfiguration?): ASchemaGivenForPrefixitems1BoxedNumber { + return ASchemaGivenForPrefixitems1BoxedNumber(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: String, configuration: SchemaConfiguration?): ASchemaGivenForPrefixitems1BoxedString { + return ASchemaGivenForPrefixitems1BoxedString(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: List<*>, configuration: SchemaConfiguration?): ASchemaGivenForPrefixitems1BoxedList { + return ASchemaGivenForPrefixitems1BoxedList(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: Map<*, *>, configuration: SchemaConfiguration?): ASchemaGivenForPrefixitems1BoxedMap { + return ASchemaGivenForPrefixitems1BoxedMap(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: Any?, configuration: SchemaConfiguration?): ASchemaGivenForPrefixitems1Boxed { + if (arg == null) { + return validateAndBox(null, configuration) + } else if (arg is Boolean) { + return validateAndBox(arg, configuration) + } else if (arg is String) { + return validateAndBox(arg, configuration) + } else if (arg is Number) { + return validateAndBox(arg, configuration) + } else if (arg is List<*>) { + return validateAndBox(arg, configuration) + } else if (arg is Map<*, *>) { + return validateAndBox(arg, configuration) + } + throw ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema") + } + } +} diff --git a/samples/client/3_1_0_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/schemas/AdditionalItemsAreAllowedByDefault.kt b/samples/client/3_1_0_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/schemas/AdditionalItemsAreAllowedByDefault.kt new file mode 100644 index 00000000000..185c54ed123 --- /dev/null +++ b/samples/client/3_1_0_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/schemas/AdditionalItemsAreAllowedByDefault.kt @@ -0,0 +1,393 @@ +package org.openapijsonschematools.client.components.schemas +import java.time.LocalDate +import java.time.ZonedDateTime +import java.util.UUID +import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags +import org.openapijsonschematools.client.configurations.SchemaConfiguration +import org.openapijsonschematools.client.exceptions.InvalidAdditionalPropertyException +import org.openapijsonschematools.client.exceptions.UnsetPropertyException +import org.openapijsonschematools.client.exceptions.ValidationException +import org.openapijsonschematools.client.schemas.IntJsonSchema +import org.openapijsonschematools.client.schemas.UnsetAddPropsSetter +import org.openapijsonschematools.client.schemas.validation.BooleanSchemaValidator +import org.openapijsonschematools.client.schemas.validation.FrozenList +import org.openapijsonschematools.client.schemas.validation.FrozenMap +import org.openapijsonschematools.client.schemas.validation.JsonSchema +import org.openapijsonschematools.client.schemas.validation.JsonSchemaInfo +import org.openapijsonschematools.client.schemas.validation.ListSchemaValidator +import org.openapijsonschematools.client.schemas.validation.MapSchemaValidator +import org.openapijsonschematools.client.schemas.validation.NullSchemaValidator +import org.openapijsonschematools.client.schemas.validation.NumberSchemaValidator +import org.openapijsonschematools.client.schemas.validation.PathToSchemasMap +import org.openapijsonschematools.client.schemas.validation.StringSchemaValidator +import org.openapijsonschematools.client.schemas.validation.ValidationMetadata + +class AdditionalItemsAreAllowedByDefault { + // nest classes so all schemas and input/output classes can be public + + + class AdditionalItemsAreAllowedByDefaultList(m: FrozenList) : FrozenList(m) { + companion object { + @Throws(ValidationException::class) + fun of(arg: List, configuration: SchemaConfiguration?): AdditionalItemsAreAllowedByDefaultList { + return AdditionalItemsAreAllowedByDefault1.getInstance().validate(arg, configuration) + } + } + } + + class AdditionalItemsAreAllowedByDefaultListBuilder { + // class to build List + private val list: MutableList + + init { + this.list = ArrayList() + } + + + fun add(item: Nothing?): AdditionalItemsAreAllowedByDefaultListBuilder { + list.add(null) + return this + } + + fun add(item: Boolean): AdditionalItemsAreAllowedByDefaultListBuilder { + list.add(item) + return this + } + + fun add(item: String): AdditionalItemsAreAllowedByDefaultListBuilder { + list.add(item) + return this + } + + fun add(item: Int): AdditionalItemsAreAllowedByDefaultListBuilder { + list.add(item) + return this + } + + fun add(item: Float): AdditionalItemsAreAllowedByDefaultListBuilder { + list.add(item) + return this + } + + fun add(item: Long): AdditionalItemsAreAllowedByDefaultListBuilder { + list.add(item) + return this + } + + fun add(item: Double): AdditionalItemsAreAllowedByDefaultListBuilder { + list.add(item) + return this + } + + fun add(item: List<*>): AdditionalItemsAreAllowedByDefaultListBuilder { + list.add(item) + return this + } + + fun add(item: Map): AdditionalItemsAreAllowedByDefaultListBuilder { + list.add(item) + return this + } + + fun build(): List { + return list + } + } + + + class Schema0 : IntJsonSchema.IntJsonSchema1() { + companion object { + @Volatile + private var instance: Schema0? = null + + fun getInstance() = + instance ?: synchronized(this) { + instance ?: Schema0().also { instance = it } + } + } + } + + + sealed interface AdditionalItemsAreAllowedByDefault1Boxed { + fun getData(): Any? + } + + data class AdditionalItemsAreAllowedByDefault1BoxedVoid(val data: Nothing?) : AdditionalItemsAreAllowedByDefault1Boxed { + override fun getData(): Any? { + return data + } + } + + data class AdditionalItemsAreAllowedByDefault1BoxedBoolean(val data: Boolean): AdditionalItemsAreAllowedByDefault1Boxed { + override fun getData(): Any? { + return data + } + } + + data class AdditionalItemsAreAllowedByDefault1BoxedNumber(val data: Number) : AdditionalItemsAreAllowedByDefault1Boxed { + override fun getData(): Any? { + return data + } + } + + data class AdditionalItemsAreAllowedByDefault1BoxedString(val data: String) : AdditionalItemsAreAllowedByDefault1Boxed { + override fun getData(): Any? { + return data + } + } + + data class AdditionalItemsAreAllowedByDefault1BoxedList(val data: AdditionalItemsAreAllowedByDefaultList) : AdditionalItemsAreAllowedByDefault1Boxed { + override fun getData(): Any? { + return data + } + } + + data class AdditionalItemsAreAllowedByDefault1BoxedMap(val data: FrozenMap) : AdditionalItemsAreAllowedByDefault1Boxed { + override fun getData(): Any? { + return data + } + } + + + class AdditionalItemsAreAllowedByDefault1 private constructor(): JsonSchema( + JsonSchemaInfo() + .prefixItems(listOf( + Schema0::class.java + )) + ), NullSchemaValidator, BooleanSchemaValidator, NumberSchemaValidator, StringSchemaValidator, ListSchemaValidator, MapSchemaValidator, AdditionalItemsAreAllowedByDefault1BoxedMap> { + /* + NOTE: This class is auto generated by OpenAPI JSON Schema Generator. + Ref: https://github.com/openapi-json-schema-tools/openapi-json-schema-generator + + Do not edit the class manually. + */ + + companion object { + @Volatile + private var instance: AdditionalItemsAreAllowedByDefault1? = null + + fun getInstance() = + instance ?: synchronized(this) { + instance ?: AdditionalItemsAreAllowedByDefault1().also { instance = it } + } + } + + @Throws(ValidationException::class) + override fun validate(arg: Nothing?, configuration: SchemaConfiguration?): Nothing? { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validatedPathToSchemas = PathToSchemasMap() + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, LinkedHashSet()) + getPathToSchemas(this, castArg, validationMetadata, pathSet) + return castArg + } + + @Throws(ValidationException::class) + override fun validate(arg: Boolean, configuration: SchemaConfiguration?): Boolean { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validatedPathToSchemas = PathToSchemasMap() + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, LinkedHashSet()) + getPathToSchemas(this, castArg, validationMetadata, pathSet) + return castArg + } + + @Throws(ValidationException::class) + override fun validate(arg: Number, configuration: SchemaConfiguration?): Number { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validatedPathToSchemas = PathToSchemasMap() + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, LinkedHashSet()) + getPathToSchemas(this, castArg, validationMetadata, pathSet) + return castArg + } + + @Throws(ValidationException::class) + fun validate(arg: Int, configuration: SchemaConfiguration?): Int { + return validate(arg as Number, configuration) as Int + } + + @Throws(ValidationException::class) + fun validate(arg: Long, configuration: SchemaConfiguration?): Long { + return validate(arg as Number, configuration) as Long + } + + @Throws(ValidationException::class) + fun validate(arg: Float, configuration: SchemaConfiguration?): Float { + return validate(arg as Number, configuration) as Float + } + + @Throws(ValidationException::class) + fun validate(arg: Double, configuration: SchemaConfiguration?): Double { + return validate(arg as Number, configuration) as Double + } + + @Throws(ValidationException::class) + override fun validate(arg: String, configuration: SchemaConfiguration?): String { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validatedPathToSchemas = PathToSchemasMap() + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, LinkedHashSet()) + getPathToSchemas(this, castArg, validationMetadata, pathSet) + return castArg + } + + @Throws(ValidationException::class) + fun validate(arg: LocalDate, configuration: SchemaConfiguration?): String { + return validate(arg.toString(), configuration) + } + + @Throws(ValidationException::class) + fun validate(arg: ZonedDateTime, configuration: SchemaConfiguration?): String { + return validate(arg.toString(), configuration) + } + + @Throws(ValidationException::class) + fun validate(arg: UUID, configuration: SchemaConfiguration?): String { + return validate(arg.toString(), configuration) + } + + override fun getNewInstance(arg: List<*>, pathToItem: List, pathToSchemas: PathToSchemasMap): AdditionalItemsAreAllowedByDefaultList { + val items: MutableList = ArrayList() + var i: Int = 0 + for (item: Any? in arg) { + val itemPathToItem = pathToItem + i + val schemas: LinkedHashMap, Nothing?>? = pathToSchemas.get(itemPathToItem) + if (schemas == null) { + throw RuntimeException("Validation result is invalid, schemas must exist for a pathToItem") + } + val itemSchema: JsonSchema<*> = schemas.entries.iterator().next().key + val itemInstance: Any? = itemSchema.getNewInstance(item, itemPathToItem, pathToSchemas) + items.add(itemInstance) + i += 1 + } + val newInstanceItems: FrozenList = FrozenList(items) + return AdditionalItemsAreAllowedByDefaultList(newInstanceItems) + } + + @Throws(ValidationException::class) + override fun validate(arg: List<*>, configuration: SchemaConfiguration?): AdditionalItemsAreAllowedByDefaultList { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, PathToSchemasMap(), LinkedHashSet()) + val pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet) + return getNewInstance(castArg, validationMetadata.pathToItem, pathToSchemasMap) + } + + override fun getNewInstance(arg: Map<*, *>, pathToItem: List, pathToSchemas: PathToSchemasMap): FrozenMap { + val properties: LinkedHashMap = LinkedHashMap() + for((propertyName, value) in arg) { + if (!(propertyName is String)) { + throw RuntimeException("Invalid non-string key value") + } + val propertyPathToItem: List = pathToItem + propertyName + val schemas: LinkedHashMap, Nothing?>? = pathToSchemas.get(propertyPathToItem) + if (schemas == null) { + throw RuntimeException("Validation result is invalid, schemas must exist for a pathToItem") + } + val propertySchema: JsonSchema<*> = schemas.entries.iterator().next().key + val propertyInstance: Any? = propertySchema.getNewInstance(value, propertyPathToItem, pathToSchemas) + properties[propertyName] = propertyInstance + } + val castProperties: FrozenMap = FrozenMap(properties) + return castProperties + } + + @Throws(ValidationException::class) + override fun validate(arg: Map<*, *>, configuration: SchemaConfiguration?): FrozenMap { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validatedPathToSchemas = PathToSchemasMap() + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, LinkedHashSet()) + val pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet) + return getNewInstance(castArg, validationMetadata.pathToItem, pathToSchemasMap) + } + + @Throws(ValidationException::class) + override fun validate(arg: Any?, configuration: SchemaConfiguration?): Any? { + if (arg == null) { + return validate(null, configuration) + } else if (arg is Boolean) { + return validate(arg, configuration) + } else if (arg is Number) { + return validate(arg, configuration) + } else if (arg is String) { + return validate(arg, configuration) + } else if (arg is List<*>) { + return validate(arg, configuration) + } else if (arg is Map<*, *>) { + return validate(arg, configuration) + } + throw ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema") + } + override fun getNewInstance(arg: Any?, pathToItem: List, pathToSchemas: PathToSchemasMap): Any? { + if (arg == null) { + return getNewInstance( null, pathToItem, pathToSchemas) + } else if (arg is Boolean) { + return getNewInstance(arg, pathToItem, pathToSchemas) + } else if (arg is Number) { + return getNewInstance(arg, pathToItem, pathToSchemas) + } else if (arg is String) { + return getNewInstance(arg, pathToItem, pathToSchemas) + } else if (arg is List<*>) { + return getNewInstance(arg, pathToItem, pathToSchemas) + } else if (arg is Map<*, *>) { + return getNewInstance(arg, pathToItem, pathToSchemas) + } + throw RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema") + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: Nothing?, configuration: SchemaConfiguration?): AdditionalItemsAreAllowedByDefault1BoxedVoid { + return AdditionalItemsAreAllowedByDefault1BoxedVoid(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: Boolean, configuration: SchemaConfiguration?): AdditionalItemsAreAllowedByDefault1BoxedBoolean { + return AdditionalItemsAreAllowedByDefault1BoxedBoolean(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: Number, configuration: SchemaConfiguration?): AdditionalItemsAreAllowedByDefault1BoxedNumber { + return AdditionalItemsAreAllowedByDefault1BoxedNumber(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: String, configuration: SchemaConfiguration?): AdditionalItemsAreAllowedByDefault1BoxedString { + return AdditionalItemsAreAllowedByDefault1BoxedString(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: List<*>, configuration: SchemaConfiguration?): AdditionalItemsAreAllowedByDefault1BoxedList { + return AdditionalItemsAreAllowedByDefault1BoxedList(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: Map<*, *>, configuration: SchemaConfiguration?): AdditionalItemsAreAllowedByDefault1BoxedMap { + return AdditionalItemsAreAllowedByDefault1BoxedMap(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: Any?, configuration: SchemaConfiguration?): AdditionalItemsAreAllowedByDefault1Boxed { + if (arg == null) { + return validateAndBox(null, configuration) + } else if (arg is Boolean) { + return validateAndBox(arg, configuration) + } else if (arg is String) { + return validateAndBox(arg, configuration) + } else if (arg is Number) { + return validateAndBox(arg, configuration) + } else if (arg is List<*>) { + return validateAndBox(arg, configuration) + } else if (arg is Map<*, *>) { + return validateAndBox(arg, configuration) + } + throw ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema") + } + } +} diff --git a/samples/client/3_1_0_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/schemas/AdditionalpropertiesAreAllowedByDefault.kt b/samples/client/3_1_0_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/schemas/AdditionalpropertiesAreAllowedByDefault.kt new file mode 100644 index 00000000000..2966b3216d6 --- /dev/null +++ b/samples/client/3_1_0_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/schemas/AdditionalpropertiesAreAllowedByDefault.kt @@ -0,0 +1,518 @@ +package org.openapijsonschematools.client.components.schemas +import java.time.LocalDate +import java.time.ZonedDateTime +import java.util.UUID +import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags +import org.openapijsonschematools.client.configurations.SchemaConfiguration +import org.openapijsonschematools.client.exceptions.InvalidAdditionalPropertyException +import org.openapijsonschematools.client.exceptions.UnsetPropertyException +import org.openapijsonschematools.client.exceptions.ValidationException +import org.openapijsonschematools.client.schemas.AnyTypeJsonSchema +import org.openapijsonschematools.client.schemas.GenericBuilder +import org.openapijsonschematools.client.schemas.UnsetAddPropsSetter +import org.openapijsonschematools.client.schemas.validation.BooleanSchemaValidator +import org.openapijsonschematools.client.schemas.validation.FrozenList +import org.openapijsonschematools.client.schemas.validation.FrozenMap +import org.openapijsonschematools.client.schemas.validation.JsonSchema +import org.openapijsonschematools.client.schemas.validation.JsonSchemaInfo +import org.openapijsonschematools.client.schemas.validation.ListSchemaValidator +import org.openapijsonschematools.client.schemas.validation.MapSchemaValidator +import org.openapijsonschematools.client.schemas.validation.NullSchemaValidator +import org.openapijsonschematools.client.schemas.validation.NumberSchemaValidator +import org.openapijsonschematools.client.schemas.validation.PathToSchemasMap +import org.openapijsonschematools.client.schemas.validation.StringSchemaValidator +import org.openapijsonschematools.client.schemas.validation.ValidationMetadata + +class AdditionalpropertiesAreAllowedByDefault { + // nest classes so all schemas and input/output classes can be public + + + class Foo : AnyTypeJsonSchema.AnyTypeJsonSchema1() { + companion object { + @Volatile + private var instance: Foo? = null + + fun getInstance() = + instance ?: synchronized(this) { + instance ?: Foo().also { instance = it } + } + } + } + + + class Bar : AnyTypeJsonSchema.AnyTypeJsonSchema1() { + companion object { + @Volatile + private var instance: Bar? = null + + fun getInstance() = + instance ?: synchronized(this) { + instance ?: Bar().also { instance = it } + } + } + } + + + class AdditionalpropertiesAreAllowedByDefaultMap(m: FrozenMap) : FrozenMap(m) { + companion object { + val requiredKeys: Set = setOf() + val optionalKeys: Set = setOf( + "foo", + "bar" + ) + @Throws(ValidationException::class) + fun of(arg: Map, configuration: SchemaConfiguration): AdditionalpropertiesAreAllowedByDefaultMap { + return AdditionalpropertiesAreAllowedByDefault1.getInstance().validate(arg, configuration) + } + } + + @Throws(UnsetPropertyException::class) + fun foo(): Any? { + return getOrThrow("foo") + } + + @Throws(UnsetPropertyException::class) + fun bar(): Any? { + return getOrThrow("bar") + } + + @Throws(UnsetPropertyException::class, InvalidAdditionalPropertyException::class) + fun getAdditionalProperty(name: String): Any? { + throwIfKeyKnown(name, requiredKeys, optionalKeys) + throwIfKeyNotPresent(name) + return get(name) + } + } + + interface SetterForFoo { + fun getInstance(): MutableMap + fun getBuilderAfterFoo(instance: MutableMap): T + + fun foo(value: Nothing?): T { + val instance = getInstance() + instance["foo"] = null + return getBuilderAfterFoo(instance) + } + + fun foo(value: Boolean): T { + val instance = getInstance() + instance["foo"] = value + return getBuilderAfterFoo(instance) + } + + fun foo(value: String): T { + val instance = getInstance() + instance["foo"] = value + return getBuilderAfterFoo(instance) + } + + fun foo(value: Int): T { + val instance = getInstance() + instance["foo"] = value + return getBuilderAfterFoo(instance) + } + + fun foo(value: Float): T { + val instance = getInstance() + instance["foo"] = value + return getBuilderAfterFoo(instance) + } + + fun foo(value: Long): T { + val instance = getInstance() + instance["foo"] = value + return getBuilderAfterFoo(instance) + } + + fun foo(value: Double): T { + val instance = getInstance() + instance["foo"] = value + return getBuilderAfterFoo(instance) + } + + fun foo(value: List): T { + val instance = getInstance() + instance["foo"] = value + return getBuilderAfterFoo(instance) + } + + fun foo(value: Map): T { + val instance = getInstance() + instance["foo"] = value + return getBuilderAfterFoo(instance) + } + } + + interface SetterForBar { + fun getInstance(): MutableMap + fun getBuilderAfterBar(instance: MutableMap): T + + fun bar(value: Nothing?): T { + val instance = getInstance() + instance["bar"] = null + return getBuilderAfterBar(instance) + } + + fun bar(value: Boolean): T { + val instance = getInstance() + instance["bar"] = value + return getBuilderAfterBar(instance) + } + + fun bar(value: String): T { + val instance = getInstance() + instance["bar"] = value + return getBuilderAfterBar(instance) + } + + fun bar(value: Int): T { + val instance = getInstance() + instance["bar"] = value + return getBuilderAfterBar(instance) + } + + fun bar(value: Float): T { + val instance = getInstance() + instance["bar"] = value + return getBuilderAfterBar(instance) + } + + fun bar(value: Long): T { + val instance = getInstance() + instance["bar"] = value + return getBuilderAfterBar(instance) + } + + fun bar(value: Double): T { + val instance = getInstance() + instance["bar"] = value + return getBuilderAfterBar(instance) + } + + fun bar(value: List): T { + val instance = getInstance() + instance["bar"] = value + return getBuilderAfterBar(instance) + } + + fun bar(value: Map): T { + val instance = getInstance() + instance["bar"] = value + return getBuilderAfterBar(instance) + } + } + + class AdditionalpropertiesAreAllowedByDefaultMapBuilder: UnsetAddPropsSetter, GenericBuilder>, SetterForFoo, SetterForBar { + private val knownKeys: Set = setOf( + "foo", + "bar" + ) + override fun getKnownKeys(): Set { + return knownKeys + } + private val instance: MutableMap + init { + this.instance = LinkedHashMap() + } + override fun build(): Map { + return instance + } + override fun getInstance(): MutableMap { + return instance + } + override fun getBuilderAfterFoo(instance: MutableMap): AdditionalpropertiesAreAllowedByDefaultMapBuilder { + return this + } + override fun getBuilderAfterBar(instance: MutableMap): AdditionalpropertiesAreAllowedByDefaultMapBuilder { + return this + } + override fun getBuilderAfterAdditionalProperty(instance: MutableMap): AdditionalpropertiesAreAllowedByDefaultMapBuilder { + return this + } + } + + + sealed interface AdditionalpropertiesAreAllowedByDefault1Boxed { + fun getData(): Any? + } + + data class AdditionalpropertiesAreAllowedByDefault1BoxedVoid(val data: Nothing?) : AdditionalpropertiesAreAllowedByDefault1Boxed { + override fun getData(): Any? { + return data + } + } + + data class AdditionalpropertiesAreAllowedByDefault1BoxedBoolean(val data: Boolean): AdditionalpropertiesAreAllowedByDefault1Boxed { + override fun getData(): Any? { + return data + } + } + + data class AdditionalpropertiesAreAllowedByDefault1BoxedNumber(val data: Number) : AdditionalpropertiesAreAllowedByDefault1Boxed { + override fun getData(): Any? { + return data + } + } + + data class AdditionalpropertiesAreAllowedByDefault1BoxedString(val data: String) : AdditionalpropertiesAreAllowedByDefault1Boxed { + override fun getData(): Any? { + return data + } + } + + data class AdditionalpropertiesAreAllowedByDefault1BoxedList(val data: FrozenList) : AdditionalpropertiesAreAllowedByDefault1Boxed { + override fun getData(): Any? { + return data + } + } + + data class AdditionalpropertiesAreAllowedByDefault1BoxedMap(val data: AdditionalpropertiesAreAllowedByDefaultMap) : AdditionalpropertiesAreAllowedByDefault1Boxed { + override fun getData(): Any? { + return data + } + } + + + class AdditionalpropertiesAreAllowedByDefault1 private constructor(): JsonSchema( + JsonSchemaInfo() + .properties(mapOf( + "foo" to Foo::class.java, + "bar" to Bar::class.java + )) + ), NullSchemaValidator, BooleanSchemaValidator, NumberSchemaValidator, StringSchemaValidator, ListSchemaValidator, AdditionalpropertiesAreAllowedByDefault1BoxedList>, MapSchemaValidator { + /* + NOTE: This class is auto generated by OpenAPI JSON Schema Generator. + Ref: https://github.com/openapi-json-schema-tools/openapi-json-schema-generator + + Do not edit the class manually. + */ + + companion object { + @Volatile + private var instance: AdditionalpropertiesAreAllowedByDefault1? = null + + fun getInstance() = + instance ?: synchronized(this) { + instance ?: AdditionalpropertiesAreAllowedByDefault1().also { instance = it } + } + } + + @Throws(ValidationException::class) + override fun validate(arg: Nothing?, configuration: SchemaConfiguration?): Nothing? { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validatedPathToSchemas = PathToSchemasMap() + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, LinkedHashSet()) + getPathToSchemas(this, castArg, validationMetadata, pathSet) + return castArg + } + + @Throws(ValidationException::class) + override fun validate(arg: Boolean, configuration: SchemaConfiguration?): Boolean { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validatedPathToSchemas = PathToSchemasMap() + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, LinkedHashSet()) + getPathToSchemas(this, castArg, validationMetadata, pathSet) + return castArg + } + + @Throws(ValidationException::class) + override fun validate(arg: Number, configuration: SchemaConfiguration?): Number { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validatedPathToSchemas = PathToSchemasMap() + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, LinkedHashSet()) + getPathToSchemas(this, castArg, validationMetadata, pathSet) + return castArg + } + + @Throws(ValidationException::class) + fun validate(arg: Int, configuration: SchemaConfiguration?): Int { + return validate(arg as Number, configuration) as Int + } + + @Throws(ValidationException::class) + fun validate(arg: Long, configuration: SchemaConfiguration?): Long { + return validate(arg as Number, configuration) as Long + } + + @Throws(ValidationException::class) + fun validate(arg: Float, configuration: SchemaConfiguration?): Float { + return validate(arg as Number, configuration) as Float + } + + @Throws(ValidationException::class) + fun validate(arg: Double, configuration: SchemaConfiguration?): Double { + return validate(arg as Number, configuration) as Double + } + + @Throws(ValidationException::class) + override fun validate(arg: String, configuration: SchemaConfiguration?): String { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validatedPathToSchemas = PathToSchemasMap() + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, LinkedHashSet()) + getPathToSchemas(this, castArg, validationMetadata, pathSet) + return castArg + } + + @Throws(ValidationException::class) + fun validate(arg: LocalDate, configuration: SchemaConfiguration?): String { + return validate(arg.toString(), configuration) + } + + @Throws(ValidationException::class) + fun validate(arg: ZonedDateTime, configuration: SchemaConfiguration?): String { + return validate(arg.toString(), configuration) + } + + @Throws(ValidationException::class) + fun validate(arg: UUID, configuration: SchemaConfiguration?): String { + return validate(arg.toString(), configuration) + } + + override fun getNewInstance(arg: List<*>, pathToItem: List, pathToSchemas: PathToSchemasMap): FrozenList { + val items: MutableList = ArrayList() + var i: Int = 0 + for (item: Any? in arg) { + val itemPathToItem = pathToItem + i + val schemas: LinkedHashMap, Nothing?>? = pathToSchemas.get(itemPathToItem) + if (schemas == null) { + throw RuntimeException("Validation result is invalid, schemas must exist for a pathToItem") + } + val itemSchema: JsonSchema<*> = schemas.entries.iterator().next().key + val itemInstance: Any? = itemSchema.getNewInstance(item, itemPathToItem, pathToSchemas) + items.add(itemInstance) + i += 1 + } + val newInstanceItems: FrozenList = FrozenList(items) + return newInstanceItems + } + + @Throws(ValidationException::class) + override fun validate(arg: List<*>, configuration: SchemaConfiguration?): FrozenList { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, PathToSchemasMap(), LinkedHashSet()) + val pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet) + return getNewInstance(castArg, validationMetadata.pathToItem, pathToSchemasMap) + } + + override fun getNewInstance(arg: Map<*, *>, pathToItem: List, pathToSchemas: PathToSchemasMap): AdditionalpropertiesAreAllowedByDefaultMap { + val properties: LinkedHashMap = LinkedHashMap() + for((propertyName, value) in arg) { + if (!(propertyName is String)) { + throw RuntimeException("Invalid non-string key value") + } + val propertyPathToItem: List = pathToItem + propertyName + val schemas: LinkedHashMap, Nothing?>? = pathToSchemas.get(propertyPathToItem) + if (schemas == null) { + throw RuntimeException("Validation result is invalid, schemas must exist for a pathToItem") + } + val propertySchema: JsonSchema<*> = schemas.entries.iterator().next().key + val propertyInstance: Any? = propertySchema.getNewInstance(value, propertyPathToItem, pathToSchemas) + properties[propertyName] = propertyInstance + } + val castProperties: FrozenMap = FrozenMap(properties) + return AdditionalpropertiesAreAllowedByDefaultMap(castProperties) + } + + @Throws(ValidationException::class) + override fun validate(arg: Map<*, *>, configuration: SchemaConfiguration?): AdditionalpropertiesAreAllowedByDefaultMap { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validatedPathToSchemas = PathToSchemasMap() + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, LinkedHashSet()) + val pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet) + return getNewInstance(castArg, validationMetadata.pathToItem, pathToSchemasMap) + } + + @Throws(ValidationException::class) + override fun validate(arg: Any?, configuration: SchemaConfiguration?): Any? { + if (arg == null) { + return validate(null, configuration) + } else if (arg is Boolean) { + return validate(arg, configuration) + } else if (arg is Number) { + return validate(arg, configuration) + } else if (arg is String) { + return validate(arg, configuration) + } else if (arg is List<*>) { + return validate(arg, configuration) + } else if (arg is Map<*, *>) { + return validate(arg, configuration) + } + throw ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema") + } + override fun getNewInstance(arg: Any?, pathToItem: List, pathToSchemas: PathToSchemasMap): Any? { + if (arg == null) { + return getNewInstance( null, pathToItem, pathToSchemas) + } else if (arg is Boolean) { + return getNewInstance(arg, pathToItem, pathToSchemas) + } else if (arg is Number) { + return getNewInstance(arg, pathToItem, pathToSchemas) + } else if (arg is String) { + return getNewInstance(arg, pathToItem, pathToSchemas) + } else if (arg is List<*>) { + return getNewInstance(arg, pathToItem, pathToSchemas) + } else if (arg is Map<*, *>) { + return getNewInstance(arg, pathToItem, pathToSchemas) + } + throw RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema") + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: Nothing?, configuration: SchemaConfiguration?): AdditionalpropertiesAreAllowedByDefault1BoxedVoid { + return AdditionalpropertiesAreAllowedByDefault1BoxedVoid(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: Boolean, configuration: SchemaConfiguration?): AdditionalpropertiesAreAllowedByDefault1BoxedBoolean { + return AdditionalpropertiesAreAllowedByDefault1BoxedBoolean(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: Number, configuration: SchemaConfiguration?): AdditionalpropertiesAreAllowedByDefault1BoxedNumber { + return AdditionalpropertiesAreAllowedByDefault1BoxedNumber(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: String, configuration: SchemaConfiguration?): AdditionalpropertiesAreAllowedByDefault1BoxedString { + return AdditionalpropertiesAreAllowedByDefault1BoxedString(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: List<*>, configuration: SchemaConfiguration?): AdditionalpropertiesAreAllowedByDefault1BoxedList { + return AdditionalpropertiesAreAllowedByDefault1BoxedList(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: Map<*, *>, configuration: SchemaConfiguration?): AdditionalpropertiesAreAllowedByDefault1BoxedMap { + return AdditionalpropertiesAreAllowedByDefault1BoxedMap(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: Any?, configuration: SchemaConfiguration?): AdditionalpropertiesAreAllowedByDefault1Boxed { + if (arg == null) { + return validateAndBox(null, configuration) + } else if (arg is Boolean) { + return validateAndBox(arg, configuration) + } else if (arg is String) { + return validateAndBox(arg, configuration) + } else if (arg is Number) { + return validateAndBox(arg, configuration) + } else if (arg is List<*>) { + return validateAndBox(arg, configuration) + } else if (arg is Map<*, *>) { + return validateAndBox(arg, configuration) + } + throw ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema") + } + } +} diff --git a/samples/client/3_1_0_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/schemas/AdditionalpropertiesCanExistByItself.kt b/samples/client/3_1_0_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/schemas/AdditionalpropertiesCanExistByItself.kt new file mode 100644 index 00000000000..ee604cec42a --- /dev/null +++ b/samples/client/3_1_0_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/schemas/AdditionalpropertiesCanExistByItself.kt @@ -0,0 +1,183 @@ +package org.openapijsonschematools.client.components.schemas +import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags +import org.openapijsonschematools.client.configurations.SchemaConfiguration +import org.openapijsonschematools.client.exceptions.InvalidAdditionalPropertyException +import org.openapijsonschematools.client.exceptions.UnsetPropertyException +import org.openapijsonschematools.client.exceptions.ValidationException +import org.openapijsonschematools.client.schemas.BooleanJsonSchema +import org.openapijsonschematools.client.schemas.GenericBuilder +import org.openapijsonschematools.client.schemas.validation.FrozenMap +import org.openapijsonschematools.client.schemas.validation.JsonSchema +import org.openapijsonschematools.client.schemas.validation.JsonSchemaInfo +import org.openapijsonschematools.client.schemas.validation.MapSchemaValidator +import org.openapijsonschematools.client.schemas.validation.MapUtils +import org.openapijsonschematools.client.schemas.validation.PathToSchemasMap +import org.openapijsonschematools.client.schemas.validation.ValidationMetadata + +class AdditionalpropertiesCanExistByItself { + // nest classes so all schemas and input/output classes can be public + + + class AdditionalProperties : BooleanJsonSchema.BooleanJsonSchema1() { + companion object { + @Volatile + private var instance: AdditionalProperties? = null + + fun getInstance() = + instance ?: synchronized(this) { + instance ?: AdditionalProperties().also { instance = it } + } + } + } + + + class AdditionalpropertiesCanExistByItselfMap(m: FrozenMap) : FrozenMap(m) { + companion object { + val requiredKeys: Set = setOf() + val optionalKeys: Set = setOf() + @Throws(ValidationException::class) + fun of(arg: Map, configuration: SchemaConfiguration): AdditionalpropertiesCanExistByItselfMap { + return AdditionalpropertiesCanExistByItself1.getInstance().validate(arg, configuration) + } + } + + @Throws(UnsetPropertyException::class) + fun getAdditionalProperty(name: String): Boolean { + throwIfKeyNotPresent(name) + val value: Boolean? = get(name) + if (value == null) { + throw RuntimeException("Value may not be null") + } + return value + } + } + + interface SetterForAdditionalProperties { + fun getKnownKeys(): Set + fun getInstance(): MutableMap + fun getBuilderAfterAdditionalProperty(instance: MutableMap): T + + @Throws(InvalidAdditionalPropertyException::class) + fun additionalProperty(key: String, value: Boolean): T { + MapUtils.throwIfKeyKnown(key, getKnownKeys(), true) + val instance = getInstance() + instance[key] = value + return getBuilderAfterAdditionalProperty(instance) + } + } + + class AdditionalpropertiesCanExistByItselfMapBuilder: GenericBuilder>, SetterForAdditionalProperties { + private val knownKeys: Set = setOf() + override fun getKnownKeys(): Set { + return knownKeys + } + private val instance: MutableMap + init { + this.instance = LinkedHashMap() + } + override fun build(): Map { + return instance + } + override fun getInstance(): MutableMap { + return instance + } + override fun getBuilderAfterAdditionalProperty(instance: MutableMap): AdditionalpropertiesCanExistByItselfMapBuilder { + return this + } + } + + + sealed interface AdditionalpropertiesCanExistByItself1Boxed { + fun getData(): Any? + } + + data class AdditionalpropertiesCanExistByItself1BoxedMap(val data: AdditionalpropertiesCanExistByItselfMap) : AdditionalpropertiesCanExistByItself1Boxed { + override fun getData(): Any? { + return data + } + } + + + class AdditionalpropertiesCanExistByItself1 private constructor(): JsonSchema( + JsonSchemaInfo() + .type(setOf(Map::class.java)) + .additionalProperties(AdditionalProperties::class.java) + ), MapSchemaValidator { + /* + NOTE: This class is auto generated by OpenAPI JSON Schema Generator. + Ref: https://github.com/openapi-json-schema-tools/openapi-json-schema-generator + + Do not edit the class manually. + */ + + companion object { + @Volatile + private var instance: AdditionalpropertiesCanExistByItself1? = null + + fun getInstance() = + instance ?: synchronized(this) { + instance ?: AdditionalpropertiesCanExistByItself1().also { instance = it } + } + } + + override fun getNewInstance(arg: Map<*, *>, pathToItem: List, pathToSchemas: PathToSchemasMap): AdditionalpropertiesCanExistByItselfMap { + val properties: LinkedHashMap = LinkedHashMap() + for((entryKey, value) in arg) { + if (!(entryKey is String)) { + throw RuntimeException("Invalid non-string key value") + } + val propertyPathToItem: List = pathToItem + entryKey + val schemas: LinkedHashMap, Nothing?>? = pathToSchemas.get(propertyPathToItem) + if (schemas == null) { + throw RuntimeException("Validation result is invalid, schemas must exist for a pathToItem") + } + val propertySchema: JsonSchema<*> = schemas.entries.iterator().next().key + val propertyInstance: Any? = propertySchema.getNewInstance(value, propertyPathToItem, pathToSchemas) + if (!(propertyInstance is Boolean)) { + throw RuntimeException("Invalid instantiated value") + } + properties[entryKey] = propertyInstance + } + val castProperties: FrozenMap = FrozenMap(properties) + return AdditionalpropertiesCanExistByItselfMap(castProperties) + } + + @Throws(ValidationException::class) + override fun validate(arg: Map<*, *>, configuration: SchemaConfiguration?): AdditionalpropertiesCanExistByItselfMap { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, PathToSchemasMap(), LinkedHashSet()) + val pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet) + return getNewInstance(castArg, validationMetadata.pathToItem, pathToSchemasMap) + } + + + @Throws(ValidationException::class) + override fun validate(arg: Any?, configuration: SchemaConfiguration?): Any? { + if (arg is Map<*, *>) { + return validate(arg, configuration) + } + throw ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema") + } + override fun getNewInstance(arg: Any?, pathToItem: List, pathToSchemas: PathToSchemasMap): Any? { + if (arg is Map<*, *>) { + return getNewInstance(arg, pathToItem, pathToSchemas) + } + throw RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema") + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: Map<*, *>, configuration: SchemaConfiguration?): AdditionalpropertiesCanExistByItself1BoxedMap { + return AdditionalpropertiesCanExistByItself1BoxedMap(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: Any?, configuration: SchemaConfiguration?): AdditionalpropertiesCanExistByItself1Boxed { + if (arg is Map<*, *>) { + return validateAndBox(arg, configuration) + } + throw ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema") + } + } + +} diff --git a/samples/client/3_1_0_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/schemas/AdditionalpropertiesDoesNotLookInApplicators.kt b/samples/client/3_1_0_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/schemas/AdditionalpropertiesDoesNotLookInApplicators.kt new file mode 100644 index 00000000000..2a31ca2a279 --- /dev/null +++ b/samples/client/3_1_0_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/schemas/AdditionalpropertiesDoesNotLookInApplicators.kt @@ -0,0 +1,787 @@ +package org.openapijsonschematools.client.components.schemas +import java.time.LocalDate +import java.time.ZonedDateTime +import java.util.UUID +import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags +import org.openapijsonschematools.client.configurations.SchemaConfiguration +import org.openapijsonschematools.client.exceptions.InvalidAdditionalPropertyException +import org.openapijsonschematools.client.exceptions.UnsetPropertyException +import org.openapijsonschematools.client.exceptions.ValidationException +import org.openapijsonschematools.client.schemas.AnyTypeJsonSchema +import org.openapijsonschematools.client.schemas.BooleanJsonSchema +import org.openapijsonschematools.client.schemas.GenericBuilder +import org.openapijsonschematools.client.schemas.UnsetAddPropsSetter +import org.openapijsonschematools.client.schemas.validation.BooleanSchemaValidator +import org.openapijsonschematools.client.schemas.validation.FrozenList +import org.openapijsonschematools.client.schemas.validation.FrozenMap +import org.openapijsonschematools.client.schemas.validation.JsonSchema +import org.openapijsonschematools.client.schemas.validation.JsonSchemaInfo +import org.openapijsonschematools.client.schemas.validation.ListSchemaValidator +import org.openapijsonschematools.client.schemas.validation.MapSchemaValidator +import org.openapijsonschematools.client.schemas.validation.MapUtils +import org.openapijsonschematools.client.schemas.validation.NullSchemaValidator +import org.openapijsonschematools.client.schemas.validation.NumberSchemaValidator +import org.openapijsonschematools.client.schemas.validation.PathToSchemasMap +import org.openapijsonschematools.client.schemas.validation.StringSchemaValidator +import org.openapijsonschematools.client.schemas.validation.ValidationMetadata + +class AdditionalpropertiesDoesNotLookInApplicators { + // nest classes so all schemas and input/output classes can be public + + + class AdditionalProperties : BooleanJsonSchema.BooleanJsonSchema1() { + companion object { + @Volatile + private var instance: AdditionalProperties? = null + + fun getInstance() = + instance ?: synchronized(this) { + instance ?: AdditionalProperties().also { instance = it } + } + } + } + + + class Foo : AnyTypeJsonSchema.AnyTypeJsonSchema1() { + companion object { + @Volatile + private var instance: Foo? = null + + fun getInstance() = + instance ?: synchronized(this) { + instance ?: Foo().also { instance = it } + } + } + } + + + class Schema0Map(m: FrozenMap) : FrozenMap(m) { + companion object { + val requiredKeys: Set = setOf() + val optionalKeys: Set = setOf( + "foo" + ) + @Throws(ValidationException::class) + fun of(arg: Map, configuration: SchemaConfiguration): Schema0Map { + return Schema0.getInstance().validate(arg, configuration) + } + } + + @Throws(UnsetPropertyException::class) + fun foo(): Any? { + return getOrThrow("foo") + } + + @Throws(UnsetPropertyException::class, InvalidAdditionalPropertyException::class) + fun getAdditionalProperty(name: String): Any? { + throwIfKeyKnown(name, requiredKeys, optionalKeys) + throwIfKeyNotPresent(name) + return get(name) + } + } + + interface SetterForFoo { + fun getInstance(): MutableMap + fun getBuilderAfterFoo(instance: MutableMap): T + + fun foo(value: Nothing?): T { + val instance = getInstance() + instance["foo"] = null + return getBuilderAfterFoo(instance) + } + + fun foo(value: Boolean): T { + val instance = getInstance() + instance["foo"] = value + return getBuilderAfterFoo(instance) + } + + fun foo(value: String): T { + val instance = getInstance() + instance["foo"] = value + return getBuilderAfterFoo(instance) + } + + fun foo(value: Int): T { + val instance = getInstance() + instance["foo"] = value + return getBuilderAfterFoo(instance) + } + + fun foo(value: Float): T { + val instance = getInstance() + instance["foo"] = value + return getBuilderAfterFoo(instance) + } + + fun foo(value: Long): T { + val instance = getInstance() + instance["foo"] = value + return getBuilderAfterFoo(instance) + } + + fun foo(value: Double): T { + val instance = getInstance() + instance["foo"] = value + return getBuilderAfterFoo(instance) + } + + fun foo(value: List): T { + val instance = getInstance() + instance["foo"] = value + return getBuilderAfterFoo(instance) + } + + fun foo(value: Map): T { + val instance = getInstance() + instance["foo"] = value + return getBuilderAfterFoo(instance) + } + } + + class Schema0MapBuilder: UnsetAddPropsSetter, GenericBuilder>, SetterForFoo { + private val knownKeys: Set = setOf( + "foo" + ) + override fun getKnownKeys(): Set { + return knownKeys + } + private val instance: MutableMap + init { + this.instance = LinkedHashMap() + } + override fun build(): Map { + return instance + } + override fun getInstance(): MutableMap { + return instance + } + override fun getBuilderAfterFoo(instance: MutableMap): Schema0MapBuilder { + return this + } + override fun getBuilderAfterAdditionalProperty(instance: MutableMap): Schema0MapBuilder { + return this + } + } + + + sealed interface Schema0Boxed { + fun getData(): Any? + } + + data class Schema0BoxedVoid(val data: Nothing?) : Schema0Boxed { + override fun getData(): Any? { + return data + } + } + + data class Schema0BoxedBoolean(val data: Boolean): Schema0Boxed { + override fun getData(): Any? { + return data + } + } + + data class Schema0BoxedNumber(val data: Number) : Schema0Boxed { + override fun getData(): Any? { + return data + } + } + + data class Schema0BoxedString(val data: String) : Schema0Boxed { + override fun getData(): Any? { + return data + } + } + + data class Schema0BoxedList(val data: FrozenList) : Schema0Boxed { + override fun getData(): Any? { + return data + } + } + + data class Schema0BoxedMap(val data: Schema0Map) : Schema0Boxed { + override fun getData(): Any? { + return data + } + } + + + class Schema0 private constructor(): JsonSchema( + JsonSchemaInfo() + .properties(mapOf( + "foo" to Foo::class.java + )) + ), NullSchemaValidator, BooleanSchemaValidator, NumberSchemaValidator, StringSchemaValidator, ListSchemaValidator, Schema0BoxedList>, MapSchemaValidator { + + companion object { + @Volatile + private var instance: Schema0? = null + + fun getInstance() = + instance ?: synchronized(this) { + instance ?: Schema0().also { instance = it } + } + } + + @Throws(ValidationException::class) + override fun validate(arg: Nothing?, configuration: SchemaConfiguration?): Nothing? { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validatedPathToSchemas = PathToSchemasMap() + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, LinkedHashSet()) + getPathToSchemas(this, castArg, validationMetadata, pathSet) + return castArg + } + + @Throws(ValidationException::class) + override fun validate(arg: Boolean, configuration: SchemaConfiguration?): Boolean { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validatedPathToSchemas = PathToSchemasMap() + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, LinkedHashSet()) + getPathToSchemas(this, castArg, validationMetadata, pathSet) + return castArg + } + + @Throws(ValidationException::class) + override fun validate(arg: Number, configuration: SchemaConfiguration?): Number { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validatedPathToSchemas = PathToSchemasMap() + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, LinkedHashSet()) + getPathToSchemas(this, castArg, validationMetadata, pathSet) + return castArg + } + + @Throws(ValidationException::class) + fun validate(arg: Int, configuration: SchemaConfiguration?): Int { + return validate(arg as Number, configuration) as Int + } + + @Throws(ValidationException::class) + fun validate(arg: Long, configuration: SchemaConfiguration?): Long { + return validate(arg as Number, configuration) as Long + } + + @Throws(ValidationException::class) + fun validate(arg: Float, configuration: SchemaConfiguration?): Float { + return validate(arg as Number, configuration) as Float + } + + @Throws(ValidationException::class) + fun validate(arg: Double, configuration: SchemaConfiguration?): Double { + return validate(arg as Number, configuration) as Double + } + + @Throws(ValidationException::class) + override fun validate(arg: String, configuration: SchemaConfiguration?): String { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validatedPathToSchemas = PathToSchemasMap() + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, LinkedHashSet()) + getPathToSchemas(this, castArg, validationMetadata, pathSet) + return castArg + } + + @Throws(ValidationException::class) + fun validate(arg: LocalDate, configuration: SchemaConfiguration?): String { + return validate(arg.toString(), configuration) + } + + @Throws(ValidationException::class) + fun validate(arg: ZonedDateTime, configuration: SchemaConfiguration?): String { + return validate(arg.toString(), configuration) + } + + @Throws(ValidationException::class) + fun validate(arg: UUID, configuration: SchemaConfiguration?): String { + return validate(arg.toString(), configuration) + } + + override fun getNewInstance(arg: List<*>, pathToItem: List, pathToSchemas: PathToSchemasMap): FrozenList { + val items: MutableList = ArrayList() + var i: Int = 0 + for (item: Any? in arg) { + val itemPathToItem = pathToItem + i + val schemas: LinkedHashMap, Nothing?>? = pathToSchemas.get(itemPathToItem) + if (schemas == null) { + throw RuntimeException("Validation result is invalid, schemas must exist for a pathToItem") + } + val itemSchema: JsonSchema<*> = schemas.entries.iterator().next().key + val itemInstance: Any? = itemSchema.getNewInstance(item, itemPathToItem, pathToSchemas) + items.add(itemInstance) + i += 1 + } + val newInstanceItems: FrozenList = FrozenList(items) + return newInstanceItems + } + + @Throws(ValidationException::class) + override fun validate(arg: List<*>, configuration: SchemaConfiguration?): FrozenList { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, PathToSchemasMap(), LinkedHashSet()) + val pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet) + return getNewInstance(castArg, validationMetadata.pathToItem, pathToSchemasMap) + } + + override fun getNewInstance(arg: Map<*, *>, pathToItem: List, pathToSchemas: PathToSchemasMap): Schema0Map { + val properties: LinkedHashMap = LinkedHashMap() + for((propertyName, value) in arg) { + if (!(propertyName is String)) { + throw RuntimeException("Invalid non-string key value") + } + val propertyPathToItem: List = pathToItem + propertyName + val schemas: LinkedHashMap, Nothing?>? = pathToSchemas.get(propertyPathToItem) + if (schemas == null) { + throw RuntimeException("Validation result is invalid, schemas must exist for a pathToItem") + } + val propertySchema: JsonSchema<*> = schemas.entries.iterator().next().key + val propertyInstance: Any? = propertySchema.getNewInstance(value, propertyPathToItem, pathToSchemas) + properties[propertyName] = propertyInstance + } + val castProperties: FrozenMap = FrozenMap(properties) + return Schema0Map(castProperties) + } + + @Throws(ValidationException::class) + override fun validate(arg: Map<*, *>, configuration: SchemaConfiguration?): Schema0Map { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validatedPathToSchemas = PathToSchemasMap() + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, LinkedHashSet()) + val pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet) + return getNewInstance(castArg, validationMetadata.pathToItem, pathToSchemasMap) + } + + @Throws(ValidationException::class) + override fun validate(arg: Any?, configuration: SchemaConfiguration?): Any? { + if (arg == null) { + return validate(null, configuration) + } else if (arg is Boolean) { + return validate(arg, configuration) + } else if (arg is Number) { + return validate(arg, configuration) + } else if (arg is String) { + return validate(arg, configuration) + } else if (arg is List<*>) { + return validate(arg, configuration) + } else if (arg is Map<*, *>) { + return validate(arg, configuration) + } + throw ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema") + } + override fun getNewInstance(arg: Any?, pathToItem: List, pathToSchemas: PathToSchemasMap): Any? { + if (arg == null) { + return getNewInstance( null, pathToItem, pathToSchemas) + } else if (arg is Boolean) { + return getNewInstance(arg, pathToItem, pathToSchemas) + } else if (arg is Number) { + return getNewInstance(arg, pathToItem, pathToSchemas) + } else if (arg is String) { + return getNewInstance(arg, pathToItem, pathToSchemas) + } else if (arg is List<*>) { + return getNewInstance(arg, pathToItem, pathToSchemas) + } else if (arg is Map<*, *>) { + return getNewInstance(arg, pathToItem, pathToSchemas) + } + throw RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema") + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: Nothing?, configuration: SchemaConfiguration?): Schema0BoxedVoid { + return Schema0BoxedVoid(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: Boolean, configuration: SchemaConfiguration?): Schema0BoxedBoolean { + return Schema0BoxedBoolean(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: Number, configuration: SchemaConfiguration?): Schema0BoxedNumber { + return Schema0BoxedNumber(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: String, configuration: SchemaConfiguration?): Schema0BoxedString { + return Schema0BoxedString(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: List<*>, configuration: SchemaConfiguration?): Schema0BoxedList { + return Schema0BoxedList(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: Map<*, *>, configuration: SchemaConfiguration?): Schema0BoxedMap { + return Schema0BoxedMap(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: Any?, configuration: SchemaConfiguration?): Schema0Boxed { + if (arg == null) { + return validateAndBox(null, configuration) + } else if (arg is Boolean) { + return validateAndBox(arg, configuration) + } else if (arg is String) { + return validateAndBox(arg, configuration) + } else if (arg is Number) { + return validateAndBox(arg, configuration) + } else if (arg is List<*>) { + return validateAndBox(arg, configuration) + } else if (arg is Map<*, *>) { + return validateAndBox(arg, configuration) + } + throw ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema") + } + } + + class AdditionalpropertiesDoesNotLookInApplicatorsMap(m: FrozenMap) : FrozenMap(m) { + companion object { + val requiredKeys: Set = setOf() + val optionalKeys: Set = setOf() + @Throws(ValidationException::class) + fun of(arg: Map, configuration: SchemaConfiguration): AdditionalpropertiesDoesNotLookInApplicatorsMap { + return AdditionalpropertiesDoesNotLookInApplicators1.getInstance().validate(arg, configuration) + } + } + + @Throws(UnsetPropertyException::class) + fun getAdditionalProperty(name: String): Boolean { + throwIfKeyNotPresent(name) + val value: Boolean? = get(name) + if (value == null) { + throw RuntimeException("Value may not be null") + } + return value + } + } + + interface SetterForAdditionalProperties { + fun getKnownKeys(): Set + fun getInstance(): MutableMap + fun getBuilderAfterAdditionalProperty(instance: MutableMap): T + + @Throws(InvalidAdditionalPropertyException::class) + fun additionalProperty(key: String, value: Boolean): T { + MapUtils.throwIfKeyKnown(key, getKnownKeys(), true) + val instance = getInstance() + instance[key] = value + return getBuilderAfterAdditionalProperty(instance) + } + } + + class AdditionalpropertiesDoesNotLookInApplicatorsMapBuilder: GenericBuilder>, SetterForAdditionalProperties { + private val knownKeys: Set = setOf() + override fun getKnownKeys(): Set { + return knownKeys + } + private val instance: MutableMap + init { + this.instance = LinkedHashMap() + } + override fun build(): Map { + return instance + } + override fun getInstance(): MutableMap { + return instance + } + override fun getBuilderAfterAdditionalProperty(instance: MutableMap): AdditionalpropertiesDoesNotLookInApplicatorsMapBuilder { + return this + } + } + + + sealed interface AdditionalpropertiesDoesNotLookInApplicators1Boxed { + fun getData(): Any? + } + + data class AdditionalpropertiesDoesNotLookInApplicators1BoxedVoid(val data: Nothing?) : AdditionalpropertiesDoesNotLookInApplicators1Boxed { + override fun getData(): Any? { + return data + } + } + + data class AdditionalpropertiesDoesNotLookInApplicators1BoxedBoolean(val data: Boolean): AdditionalpropertiesDoesNotLookInApplicators1Boxed { + override fun getData(): Any? { + return data + } + } + + data class AdditionalpropertiesDoesNotLookInApplicators1BoxedNumber(val data: Number) : AdditionalpropertiesDoesNotLookInApplicators1Boxed { + override fun getData(): Any? { + return data + } + } + + data class AdditionalpropertiesDoesNotLookInApplicators1BoxedString(val data: String) : AdditionalpropertiesDoesNotLookInApplicators1Boxed { + override fun getData(): Any? { + return data + } + } + + data class AdditionalpropertiesDoesNotLookInApplicators1BoxedList(val data: FrozenList) : AdditionalpropertiesDoesNotLookInApplicators1Boxed { + override fun getData(): Any? { + return data + } + } + + data class AdditionalpropertiesDoesNotLookInApplicators1BoxedMap(val data: AdditionalpropertiesDoesNotLookInApplicatorsMap) : AdditionalpropertiesDoesNotLookInApplicators1Boxed { + override fun getData(): Any? { + return data + } + } + + + class AdditionalpropertiesDoesNotLookInApplicators1 private constructor(): JsonSchema( + JsonSchemaInfo() + .additionalProperties(AdditionalProperties::class.java) + .allOf(listOf( + Schema0::class.java + )) + ), NullSchemaValidator, BooleanSchemaValidator, NumberSchemaValidator, StringSchemaValidator, ListSchemaValidator, AdditionalpropertiesDoesNotLookInApplicators1BoxedList>, MapSchemaValidator { + /* + NOTE: This class is auto generated by OpenAPI JSON Schema Generator. + Ref: https://github.com/openapi-json-schema-tools/openapi-json-schema-generator + + Do not edit the class manually. + */ + + companion object { + @Volatile + private var instance: AdditionalpropertiesDoesNotLookInApplicators1? = null + + fun getInstance() = + instance ?: synchronized(this) { + instance ?: AdditionalpropertiesDoesNotLookInApplicators1().also { instance = it } + } + } + + @Throws(ValidationException::class) + override fun validate(arg: Nothing?, configuration: SchemaConfiguration?): Nothing? { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validatedPathToSchemas = PathToSchemasMap() + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, LinkedHashSet()) + getPathToSchemas(this, castArg, validationMetadata, pathSet) + return castArg + } + + @Throws(ValidationException::class) + override fun validate(arg: Boolean, configuration: SchemaConfiguration?): Boolean { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validatedPathToSchemas = PathToSchemasMap() + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, LinkedHashSet()) + getPathToSchemas(this, castArg, validationMetadata, pathSet) + return castArg + } + + @Throws(ValidationException::class) + override fun validate(arg: Number, configuration: SchemaConfiguration?): Number { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validatedPathToSchemas = PathToSchemasMap() + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, LinkedHashSet()) + getPathToSchemas(this, castArg, validationMetadata, pathSet) + return castArg + } + + @Throws(ValidationException::class) + fun validate(arg: Int, configuration: SchemaConfiguration?): Int { + return validate(arg as Number, configuration) as Int + } + + @Throws(ValidationException::class) + fun validate(arg: Long, configuration: SchemaConfiguration?): Long { + return validate(arg as Number, configuration) as Long + } + + @Throws(ValidationException::class) + fun validate(arg: Float, configuration: SchemaConfiguration?): Float { + return validate(arg as Number, configuration) as Float + } + + @Throws(ValidationException::class) + fun validate(arg: Double, configuration: SchemaConfiguration?): Double { + return validate(arg as Number, configuration) as Double + } + + @Throws(ValidationException::class) + override fun validate(arg: String, configuration: SchemaConfiguration?): String { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validatedPathToSchemas = PathToSchemasMap() + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, LinkedHashSet()) + getPathToSchemas(this, castArg, validationMetadata, pathSet) + return castArg + } + + @Throws(ValidationException::class) + fun validate(arg: LocalDate, configuration: SchemaConfiguration?): String { + return validate(arg.toString(), configuration) + } + + @Throws(ValidationException::class) + fun validate(arg: ZonedDateTime, configuration: SchemaConfiguration?): String { + return validate(arg.toString(), configuration) + } + + @Throws(ValidationException::class) + fun validate(arg: UUID, configuration: SchemaConfiguration?): String { + return validate(arg.toString(), configuration) + } + + override fun getNewInstance(arg: List<*>, pathToItem: List, pathToSchemas: PathToSchemasMap): FrozenList { + val items: MutableList = ArrayList() + var i: Int = 0 + for (item: Any? in arg) { + val itemPathToItem = pathToItem + i + val schemas: LinkedHashMap, Nothing?>? = pathToSchemas.get(itemPathToItem) + if (schemas == null) { + throw RuntimeException("Validation result is invalid, schemas must exist for a pathToItem") + } + val itemSchema: JsonSchema<*> = schemas.entries.iterator().next().key + val itemInstance: Any? = itemSchema.getNewInstance(item, itemPathToItem, pathToSchemas) + items.add(itemInstance) + i += 1 + } + val newInstanceItems: FrozenList = FrozenList(items) + return newInstanceItems + } + + @Throws(ValidationException::class) + override fun validate(arg: List<*>, configuration: SchemaConfiguration?): FrozenList { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, PathToSchemasMap(), LinkedHashSet()) + val pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet) + return getNewInstance(castArg, validationMetadata.pathToItem, pathToSchemasMap) + } + + override fun getNewInstance(arg: Map<*, *>, pathToItem: List, pathToSchemas: PathToSchemasMap): AdditionalpropertiesDoesNotLookInApplicatorsMap { + val properties: LinkedHashMap = LinkedHashMap() + for((propertyName, value) in arg) { + if (!(propertyName is String)) { + throw RuntimeException("Invalid non-string key value") + } + val propertyPathToItem: List = pathToItem + propertyName + val schemas: LinkedHashMap, Nothing?>? = pathToSchemas.get(propertyPathToItem) + if (schemas == null) { + throw RuntimeException("Validation result is invalid, schemas must exist for a pathToItem") + } + val propertySchema: JsonSchema<*> = schemas.entries.iterator().next().key + val propertyInstance: Any? = propertySchema.getNewInstance(value, propertyPathToItem, pathToSchemas) + if (!(propertyInstance is Boolean)) { + throw RuntimeException("Invalid instantiated value") + } + properties[propertyName] = propertyInstance + } + val castProperties: FrozenMap = FrozenMap(properties) + return AdditionalpropertiesDoesNotLookInApplicatorsMap(castProperties) + } + + @Throws(ValidationException::class) + override fun validate(arg: Map<*, *>, configuration: SchemaConfiguration?): AdditionalpropertiesDoesNotLookInApplicatorsMap { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validatedPathToSchemas = PathToSchemasMap() + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, LinkedHashSet()) + val pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet) + return getNewInstance(castArg, validationMetadata.pathToItem, pathToSchemasMap) + } + + @Throws(ValidationException::class) + override fun validate(arg: Any?, configuration: SchemaConfiguration?): Any? { + if (arg == null) { + return validate(null, configuration) + } else if (arg is Boolean) { + return validate(arg, configuration) + } else if (arg is Number) { + return validate(arg, configuration) + } else if (arg is String) { + return validate(arg, configuration) + } else if (arg is List<*>) { + return validate(arg, configuration) + } else if (arg is Map<*, *>) { + return validate(arg, configuration) + } + throw ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema") + } + override fun getNewInstance(arg: Any?, pathToItem: List, pathToSchemas: PathToSchemasMap): Any? { + if (arg == null) { + return getNewInstance( null, pathToItem, pathToSchemas) + } else if (arg is Boolean) { + return getNewInstance(arg, pathToItem, pathToSchemas) + } else if (arg is Number) { + return getNewInstance(arg, pathToItem, pathToSchemas) + } else if (arg is String) { + return getNewInstance(arg, pathToItem, pathToSchemas) + } else if (arg is List<*>) { + return getNewInstance(arg, pathToItem, pathToSchemas) + } else if (arg is Map<*, *>) { + return getNewInstance(arg, pathToItem, pathToSchemas) + } + throw RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema") + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: Nothing?, configuration: SchemaConfiguration?): AdditionalpropertiesDoesNotLookInApplicators1BoxedVoid { + return AdditionalpropertiesDoesNotLookInApplicators1BoxedVoid(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: Boolean, configuration: SchemaConfiguration?): AdditionalpropertiesDoesNotLookInApplicators1BoxedBoolean { + return AdditionalpropertiesDoesNotLookInApplicators1BoxedBoolean(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: Number, configuration: SchemaConfiguration?): AdditionalpropertiesDoesNotLookInApplicators1BoxedNumber { + return AdditionalpropertiesDoesNotLookInApplicators1BoxedNumber(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: String, configuration: SchemaConfiguration?): AdditionalpropertiesDoesNotLookInApplicators1BoxedString { + return AdditionalpropertiesDoesNotLookInApplicators1BoxedString(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: List<*>, configuration: SchemaConfiguration?): AdditionalpropertiesDoesNotLookInApplicators1BoxedList { + return AdditionalpropertiesDoesNotLookInApplicators1BoxedList(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: Map<*, *>, configuration: SchemaConfiguration?): AdditionalpropertiesDoesNotLookInApplicators1BoxedMap { + return AdditionalpropertiesDoesNotLookInApplicators1BoxedMap(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: Any?, configuration: SchemaConfiguration?): AdditionalpropertiesDoesNotLookInApplicators1Boxed { + if (arg == null) { + return validateAndBox(null, configuration) + } else if (arg is Boolean) { + return validateAndBox(arg, configuration) + } else if (arg is String) { + return validateAndBox(arg, configuration) + } else if (arg is Number) { + return validateAndBox(arg, configuration) + } else if (arg is List<*>) { + return validateAndBox(arg, configuration) + } else if (arg is Map<*, *>) { + return validateAndBox(arg, configuration) + } + throw ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema") + } + } +} diff --git a/samples/client/3_1_0_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/schemas/AdditionalpropertiesWithNullValuedInstanceProperties.kt b/samples/client/3_1_0_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/schemas/AdditionalpropertiesWithNullValuedInstanceProperties.kt new file mode 100644 index 00000000000..1926d960cfc --- /dev/null +++ b/samples/client/3_1_0_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/schemas/AdditionalpropertiesWithNullValuedInstanceProperties.kt @@ -0,0 +1,178 @@ +package org.openapijsonschematools.client.components.schemas +import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags +import org.openapijsonschematools.client.configurations.SchemaConfiguration +import org.openapijsonschematools.client.exceptions.InvalidAdditionalPropertyException +import org.openapijsonschematools.client.exceptions.UnsetPropertyException +import org.openapijsonschematools.client.exceptions.ValidationException +import org.openapijsonschematools.client.schemas.GenericBuilder +import org.openapijsonschematools.client.schemas.NullJsonSchema +import org.openapijsonschematools.client.schemas.validation.FrozenMap +import org.openapijsonschematools.client.schemas.validation.JsonSchema +import org.openapijsonschematools.client.schemas.validation.JsonSchemaInfo +import org.openapijsonschematools.client.schemas.validation.MapSchemaValidator +import org.openapijsonschematools.client.schemas.validation.MapUtils +import org.openapijsonschematools.client.schemas.validation.PathToSchemasMap +import org.openapijsonschematools.client.schemas.validation.ValidationMetadata + +class AdditionalpropertiesWithNullValuedInstanceProperties { + // nest classes so all schemas and input/output classes can be public + + + class AdditionalProperties : NullJsonSchema.NullJsonSchema1() { + companion object { + @Volatile + private var instance: AdditionalProperties? = null + + fun getInstance() = + instance ?: synchronized(this) { + instance ?: AdditionalProperties().also { instance = it } + } + } + } + + + class AdditionalpropertiesWithNullValuedInstancePropertiesMap(m: FrozenMap) : FrozenMap(m) { + companion object { + val requiredKeys: Set = setOf() + val optionalKeys: Set = setOf() + @Throws(ValidationException::class) + fun of(arg: Map, configuration: SchemaConfiguration): AdditionalpropertiesWithNullValuedInstancePropertiesMap { + return AdditionalpropertiesWithNullValuedInstanceProperties1.getInstance().validate(arg, configuration) + } + } + + @Throws(UnsetPropertyException::class) + fun getAdditionalProperty(name: String): Nothing? { + return getOrThrow(name) + } + } + + interface SetterForAdditionalProperties { + fun getKnownKeys(): Set + fun getInstance(): MutableMap + fun getBuilderAfterAdditionalProperty(instance: MutableMap): T + + @Throws(InvalidAdditionalPropertyException::class) + fun additionalProperty(key: String, value: Nothing?): T { + MapUtils.throwIfKeyKnown(key, getKnownKeys(), true) + val instance = getInstance() + instance[key] = null + return getBuilderAfterAdditionalProperty(instance) + } + } + + class AdditionalpropertiesWithNullValuedInstancePropertiesMapBuilder: GenericBuilder>, SetterForAdditionalProperties { + private val knownKeys: Set = setOf() + override fun getKnownKeys(): Set { + return knownKeys + } + private val instance: MutableMap + init { + this.instance = LinkedHashMap() + } + override fun build(): Map { + return instance + } + override fun getInstance(): MutableMap { + return instance + } + override fun getBuilderAfterAdditionalProperty(instance: MutableMap): AdditionalpropertiesWithNullValuedInstancePropertiesMapBuilder { + return this + } + } + + + sealed interface AdditionalpropertiesWithNullValuedInstanceProperties1Boxed { + fun getData(): Any? + } + + data class AdditionalpropertiesWithNullValuedInstanceProperties1BoxedMap(val data: AdditionalpropertiesWithNullValuedInstancePropertiesMap) : AdditionalpropertiesWithNullValuedInstanceProperties1Boxed { + override fun getData(): Any? { + return data + } + } + + + class AdditionalpropertiesWithNullValuedInstanceProperties1 private constructor(): JsonSchema( + JsonSchemaInfo() + .type(setOf(Map::class.java)) + .additionalProperties(AdditionalProperties::class.java) + ), MapSchemaValidator { + /* + NOTE: This class is auto generated by OpenAPI JSON Schema Generator. + Ref: https://github.com/openapi-json-schema-tools/openapi-json-schema-generator + + Do not edit the class manually. + */ + + companion object { + @Volatile + private var instance: AdditionalpropertiesWithNullValuedInstanceProperties1? = null + + fun getInstance() = + instance ?: synchronized(this) { + instance ?: AdditionalpropertiesWithNullValuedInstanceProperties1().also { instance = it } + } + } + + override fun getNewInstance(arg: Map<*, *>, pathToItem: List, pathToSchemas: PathToSchemasMap): AdditionalpropertiesWithNullValuedInstancePropertiesMap { + val properties: LinkedHashMap = LinkedHashMap() + for((entryKey, value) in arg) { + if (!(entryKey is String)) { + throw RuntimeException("Invalid non-string key value") + } + val propertyPathToItem: List = pathToItem + entryKey + val schemas: LinkedHashMap, Nothing?>? = pathToSchemas.get(propertyPathToItem) + if (schemas == null) { + throw RuntimeException("Validation result is invalid, schemas must exist for a pathToItem") + } + val propertySchema: JsonSchema<*> = schemas.entries.iterator().next().key + val propertyInstance: Any? = propertySchema.getNewInstance(value, propertyPathToItem, pathToSchemas) + if (!(propertyInstance == null || propertyInstance is Nothing?)) { + throw RuntimeException("Invalid instantiated value") + } + properties[entryKey] = propertyInstance + } + val castProperties: FrozenMap = FrozenMap(properties) + return AdditionalpropertiesWithNullValuedInstancePropertiesMap(castProperties) + } + + @Throws(ValidationException::class) + override fun validate(arg: Map<*, *>, configuration: SchemaConfiguration?): AdditionalpropertiesWithNullValuedInstancePropertiesMap { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, PathToSchemasMap(), LinkedHashSet()) + val pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet) + return getNewInstance(castArg, validationMetadata.pathToItem, pathToSchemasMap) + } + + + @Throws(ValidationException::class) + override fun validate(arg: Any?, configuration: SchemaConfiguration?): Any? { + if (arg is Map<*, *>) { + return validate(arg, configuration) + } + throw ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema") + } + override fun getNewInstance(arg: Any?, pathToItem: List, pathToSchemas: PathToSchemasMap): Any? { + if (arg is Map<*, *>) { + return getNewInstance(arg, pathToItem, pathToSchemas) + } + throw RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema") + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: Map<*, *>, configuration: SchemaConfiguration?): AdditionalpropertiesWithNullValuedInstanceProperties1BoxedMap { + return AdditionalpropertiesWithNullValuedInstanceProperties1BoxedMap(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: Any?, configuration: SchemaConfiguration?): AdditionalpropertiesWithNullValuedInstanceProperties1Boxed { + if (arg is Map<*, *>) { + return validateAndBox(arg, configuration) + } + throw ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema") + } + } + +} diff --git a/samples/client/3_1_0_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/schemas/AdditionalpropertiesWithSchema.kt b/samples/client/3_1_0_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/schemas/AdditionalpropertiesWithSchema.kt new file mode 100644 index 00000000000..a64da97eb59 --- /dev/null +++ b/samples/client/3_1_0_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/schemas/AdditionalpropertiesWithSchema.kt @@ -0,0 +1,351 @@ +package org.openapijsonschematools.client.components.schemas +import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags +import org.openapijsonschematools.client.configurations.SchemaConfiguration +import org.openapijsonschematools.client.exceptions.InvalidAdditionalPropertyException +import org.openapijsonschematools.client.exceptions.UnsetPropertyException +import org.openapijsonschematools.client.exceptions.ValidationException +import org.openapijsonschematools.client.schemas.AnyTypeJsonSchema +import org.openapijsonschematools.client.schemas.BooleanJsonSchema +import org.openapijsonschematools.client.schemas.GenericBuilder +import org.openapijsonschematools.client.schemas.validation.FrozenMap +import org.openapijsonschematools.client.schemas.validation.JsonSchema +import org.openapijsonschematools.client.schemas.validation.JsonSchemaInfo +import org.openapijsonschematools.client.schemas.validation.MapSchemaValidator +import org.openapijsonschematools.client.schemas.validation.MapUtils +import org.openapijsonschematools.client.schemas.validation.PathToSchemasMap +import org.openapijsonschematools.client.schemas.validation.ValidationMetadata + +class AdditionalpropertiesWithSchema { + // nest classes so all schemas and input/output classes can be public + + + class AdditionalProperties : BooleanJsonSchema.BooleanJsonSchema1() { + companion object { + @Volatile + private var instance: AdditionalProperties? = null + + fun getInstance() = + instance ?: synchronized(this) { + instance ?: AdditionalProperties().also { instance = it } + } + } + } + + + class Foo : AnyTypeJsonSchema.AnyTypeJsonSchema1() { + companion object { + @Volatile + private var instance: Foo? = null + + fun getInstance() = + instance ?: synchronized(this) { + instance ?: Foo().also { instance = it } + } + } + } + + + class Bar : AnyTypeJsonSchema.AnyTypeJsonSchema1() { + companion object { + @Volatile + private var instance: Bar? = null + + fun getInstance() = + instance ?: synchronized(this) { + instance ?: Bar().also { instance = it } + } + } + } + + + class AdditionalpropertiesWithSchemaMap(m: FrozenMap) : FrozenMap(m) { + companion object { + val requiredKeys: Set = setOf() + val optionalKeys: Set = setOf( + "foo", + "bar" + ) + @Throws(ValidationException::class) + fun of(arg: Map, configuration: SchemaConfiguration): AdditionalpropertiesWithSchemaMap { + return AdditionalpropertiesWithSchema1.getInstance().validate(arg, configuration) + } + } + + @Throws(UnsetPropertyException::class) + fun foo(): Any? { + return getOrThrow("foo") + } + + @Throws(UnsetPropertyException::class) + fun bar(): Any? { + return getOrThrow("bar") + } + + @Throws(UnsetPropertyException::class, InvalidAdditionalPropertyException::class) + fun getAdditionalProperty(name: String): Boolean { + throwIfKeyKnown(name, requiredKeys, optionalKeys) + val value = getOrThrow(name) + if (!(value is Boolean)) { + throw RuntimeException("Invalid value stored for " + name) + } + return value + } + } + + interface SetterForFoo { + fun getInstance(): MutableMap + fun getBuilderAfterFoo(instance: MutableMap): T + + fun foo(value: Nothing?): T { + val instance = getInstance() + instance["foo"] = null + return getBuilderAfterFoo(instance) + } + + fun foo(value: Boolean): T { + val instance = getInstance() + instance["foo"] = value + return getBuilderAfterFoo(instance) + } + + fun foo(value: String): T { + val instance = getInstance() + instance["foo"] = value + return getBuilderAfterFoo(instance) + } + + fun foo(value: Int): T { + val instance = getInstance() + instance["foo"] = value + return getBuilderAfterFoo(instance) + } + + fun foo(value: Float): T { + val instance = getInstance() + instance["foo"] = value + return getBuilderAfterFoo(instance) + } + + fun foo(value: Long): T { + val instance = getInstance() + instance["foo"] = value + return getBuilderAfterFoo(instance) + } + + fun foo(value: Double): T { + val instance = getInstance() + instance["foo"] = value + return getBuilderAfterFoo(instance) + } + + fun foo(value: List): T { + val instance = getInstance() + instance["foo"] = value + return getBuilderAfterFoo(instance) + } + + fun foo(value: Map): T { + val instance = getInstance() + instance["foo"] = value + return getBuilderAfterFoo(instance) + } + } + + interface SetterForBar { + fun getInstance(): MutableMap + fun getBuilderAfterBar(instance: MutableMap): T + + fun bar(value: Nothing?): T { + val instance = getInstance() + instance["bar"] = null + return getBuilderAfterBar(instance) + } + + fun bar(value: Boolean): T { + val instance = getInstance() + instance["bar"] = value + return getBuilderAfterBar(instance) + } + + fun bar(value: String): T { + val instance = getInstance() + instance["bar"] = value + return getBuilderAfterBar(instance) + } + + fun bar(value: Int): T { + val instance = getInstance() + instance["bar"] = value + return getBuilderAfterBar(instance) + } + + fun bar(value: Float): T { + val instance = getInstance() + instance["bar"] = value + return getBuilderAfterBar(instance) + } + + fun bar(value: Long): T { + val instance = getInstance() + instance["bar"] = value + return getBuilderAfterBar(instance) + } + + fun bar(value: Double): T { + val instance = getInstance() + instance["bar"] = value + return getBuilderAfterBar(instance) + } + + fun bar(value: List): T { + val instance = getInstance() + instance["bar"] = value + return getBuilderAfterBar(instance) + } + + fun bar(value: Map): T { + val instance = getInstance() + instance["bar"] = value + return getBuilderAfterBar(instance) + } + } + + interface SetterForAdditionalProperties { + fun getKnownKeys(): Set + fun getInstance(): MutableMap + fun getBuilderAfterAdditionalProperty(instance: MutableMap): T + + @Throws(InvalidAdditionalPropertyException::class) + fun additionalProperty(key: String, value: Boolean): T { + MapUtils.throwIfKeyKnown(key, getKnownKeys(), true) + val instance = getInstance() + instance[key] = value + return getBuilderAfterAdditionalProperty(instance) + } + } + + class AdditionalpropertiesWithSchemaMapBuilder: GenericBuilder>, SetterForFoo, SetterForBar, SetterForAdditionalProperties { + private val knownKeys: Set = setOf( + "foo", + "bar" + ) + override fun getKnownKeys(): Set { + return knownKeys + } + private val instance: MutableMap + init { + this.instance = LinkedHashMap() + } + override fun build(): Map { + return instance + } + override fun getInstance(): MutableMap { + return instance + } + override fun getBuilderAfterFoo(instance: MutableMap): AdditionalpropertiesWithSchemaMapBuilder { + return this + } + override fun getBuilderAfterBar(instance: MutableMap): AdditionalpropertiesWithSchemaMapBuilder { + return this + } + override fun getBuilderAfterAdditionalProperty(instance: MutableMap): AdditionalpropertiesWithSchemaMapBuilder { + return this + } + } + + + sealed interface AdditionalpropertiesWithSchema1Boxed { + fun getData(): Any? + } + + data class AdditionalpropertiesWithSchema1BoxedMap(val data: AdditionalpropertiesWithSchemaMap) : AdditionalpropertiesWithSchema1Boxed { + override fun getData(): Any? { + return data + } + } + + + class AdditionalpropertiesWithSchema1 private constructor(): JsonSchema( + JsonSchemaInfo() + .type(setOf(Map::class.java)) + .properties(mapOf( + "foo" to Foo::class.java, + "bar" to Bar::class.java + )) + .additionalProperties(AdditionalProperties::class.java) + ), MapSchemaValidator { + /* + NOTE: This class is auto generated by OpenAPI JSON Schema Generator. + Ref: https://github.com/openapi-json-schema-tools/openapi-json-schema-generator + + Do not edit the class manually. + */ + + companion object { + @Volatile + private var instance: AdditionalpropertiesWithSchema1? = null + + fun getInstance() = + instance ?: synchronized(this) { + instance ?: AdditionalpropertiesWithSchema1().also { instance = it } + } + } + + override fun getNewInstance(arg: Map<*, *>, pathToItem: List, pathToSchemas: PathToSchemasMap): AdditionalpropertiesWithSchemaMap { + val properties: LinkedHashMap = LinkedHashMap() + for((entryKey, value) in arg) { + if (!(entryKey is String)) { + throw RuntimeException("Invalid non-string key value") + } + val propertyPathToItem: List = pathToItem + entryKey + val schemas: LinkedHashMap, Nothing?>? = pathToSchemas.get(propertyPathToItem) + if (schemas == null) { + throw RuntimeException("Validation result is invalid, schemas must exist for a pathToItem") + } + val propertySchema: JsonSchema<*> = schemas.entries.iterator().next().key + val propertyInstance: Any? = propertySchema.getNewInstance(value, propertyPathToItem, pathToSchemas) + properties[entryKey] = propertyInstance + } + val castProperties: FrozenMap = FrozenMap(properties) + return AdditionalpropertiesWithSchemaMap(castProperties) + } + + @Throws(ValidationException::class) + override fun validate(arg: Map<*, *>, configuration: SchemaConfiguration?): AdditionalpropertiesWithSchemaMap { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, PathToSchemasMap(), LinkedHashSet()) + val pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet) + return getNewInstance(castArg, validationMetadata.pathToItem, pathToSchemasMap) + } + + + @Throws(ValidationException::class) + override fun validate(arg: Any?, configuration: SchemaConfiguration?): Any? { + if (arg is Map<*, *>) { + return validate(arg, configuration) + } + throw ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema") + } + override fun getNewInstance(arg: Any?, pathToItem: List, pathToSchemas: PathToSchemasMap): Any? { + if (arg is Map<*, *>) { + return getNewInstance(arg, pathToItem, pathToSchemas) + } + throw RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema") + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: Map<*, *>, configuration: SchemaConfiguration?): AdditionalpropertiesWithSchema1BoxedMap { + return AdditionalpropertiesWithSchema1BoxedMap(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: Any?, configuration: SchemaConfiguration?): AdditionalpropertiesWithSchema1Boxed { + if (arg is Map<*, *>) { + return validateAndBox(arg, configuration) + } + throw ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema") + } + } + +} diff --git a/samples/client/3_1_0_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/schemas/Allof.kt b/samples/client/3_1_0_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/schemas/Allof.kt new file mode 100644 index 00000000000..4d04ec0291e --- /dev/null +++ b/samples/client/3_1_0_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/schemas/Allof.kt @@ -0,0 +1,1060 @@ +package org.openapijsonschematools.client.components.schemas +import java.time.LocalDate +import java.time.ZonedDateTime +import java.util.UUID +import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags +import org.openapijsonschematools.client.configurations.SchemaConfiguration +import org.openapijsonschematools.client.exceptions.InvalidAdditionalPropertyException +import org.openapijsonschematools.client.exceptions.UnsetPropertyException +import org.openapijsonschematools.client.exceptions.ValidationException +import org.openapijsonschematools.client.schemas.GenericBuilder +import org.openapijsonschematools.client.schemas.IntJsonSchema +import org.openapijsonschematools.client.schemas.StringJsonSchema +import org.openapijsonschematools.client.schemas.UnsetAddPropsSetter +import org.openapijsonschematools.client.schemas.validation.BooleanSchemaValidator +import org.openapijsonschematools.client.schemas.validation.FrozenList +import org.openapijsonschematools.client.schemas.validation.FrozenMap +import org.openapijsonschematools.client.schemas.validation.JsonSchema +import org.openapijsonschematools.client.schemas.validation.JsonSchemaInfo +import org.openapijsonschematools.client.schemas.validation.ListSchemaValidator +import org.openapijsonschematools.client.schemas.validation.MapSchemaValidator +import org.openapijsonschematools.client.schemas.validation.NullSchemaValidator +import org.openapijsonschematools.client.schemas.validation.NumberSchemaValidator +import org.openapijsonschematools.client.schemas.validation.PathToSchemasMap +import org.openapijsonschematools.client.schemas.validation.StringSchemaValidator +import org.openapijsonschematools.client.schemas.validation.ValidationMetadata + +class Allof { + // nest classes so all schemas and input/output classes can be public + + + class Bar : IntJsonSchema.IntJsonSchema1() { + companion object { + @Volatile + private var instance: Bar? = null + + fun getInstance() = + instance ?: synchronized(this) { + instance ?: Bar().also { instance = it } + } + } + } + + + class Schema0Map(m: FrozenMap) : FrozenMap(m) { + companion object { + val requiredKeys: Set = setOf( + "bar" + ) + val optionalKeys: Set = setOf() + @Throws(ValidationException::class) + fun of(arg: Map, configuration: SchemaConfiguration): Schema0Map { + return Schema0.getInstance().validate(arg, configuration) + } + } + + fun bar(): Number { + val value: Any? = get("bar") + if (!(value is Number)) { + throw RuntimeException("Invalid value stored for bar") + } + return value + } + + @Throws(UnsetPropertyException::class, InvalidAdditionalPropertyException::class) + fun getAdditionalProperty(name: String): Any? { + throwIfKeyKnown(name, requiredKeys, optionalKeys) + throwIfKeyNotPresent(name) + return get(name) + } + } + + interface SetterForBar { + fun getInstance(): MutableMap + fun getBuilderAfterBar(instance: MutableMap): T + + fun bar(value: Int): T { + val instance = getInstance() + instance["bar"] = value + return getBuilderAfterBar(instance) + } + + fun bar(value: Float): T { + val instance = getInstance() + instance["bar"] = value + return getBuilderAfterBar(instance) + } + + fun bar(value: Long): T { + val instance = getInstance() + instance["bar"] = value + return getBuilderAfterBar(instance) + } + + fun bar(value: Double): T { + val instance = getInstance() + instance["bar"] = value + return getBuilderAfterBar(instance) + } + } + + class Schema0Map0Builder(private val instance: MutableMap): UnsetAddPropsSetter, GenericBuilder> { + private val knownKeys: Set = setOf( + "bar" + ) + override fun getKnownKeys(): Set { + return knownKeys + } + override fun build(): Map { + return instance + } + override fun getInstance(): MutableMap { + return instance + } + override fun getBuilderAfterAdditionalProperty(instance: MutableMap): Schema0Map0Builder { + return this + } + } + + class Schema0MapBuilder: SetterForBar { + private val instance: MutableMap + init { + this.instance = LinkedHashMap() + } + override fun getInstance(): MutableMap { + return instance + } + override fun getBuilderAfterBar(instance: MutableMap): Schema0Map0Builder { + return Schema0Map0Builder(instance) + } + } + + + sealed interface Schema0Boxed { + fun getData(): Any? + } + + data class Schema0BoxedVoid(val data: Nothing?) : Schema0Boxed { + override fun getData(): Any? { + return data + } + } + + data class Schema0BoxedBoolean(val data: Boolean): Schema0Boxed { + override fun getData(): Any? { + return data + } + } + + data class Schema0BoxedNumber(val data: Number) : Schema0Boxed { + override fun getData(): Any? { + return data + } + } + + data class Schema0BoxedString(val data: String) : Schema0Boxed { + override fun getData(): Any? { + return data + } + } + + data class Schema0BoxedList(val data: FrozenList) : Schema0Boxed { + override fun getData(): Any? { + return data + } + } + + data class Schema0BoxedMap(val data: Schema0Map) : Schema0Boxed { + override fun getData(): Any? { + return data + } + } + + + class Schema0 private constructor(): JsonSchema( + JsonSchemaInfo() + .properties(mapOf( + "bar" to Bar::class.java + )) + .required(setOf( + "bar" + )) + ), NullSchemaValidator, BooleanSchemaValidator, NumberSchemaValidator, StringSchemaValidator, ListSchemaValidator, Schema0BoxedList>, MapSchemaValidator { + + companion object { + @Volatile + private var instance: Schema0? = null + + fun getInstance() = + instance ?: synchronized(this) { + instance ?: Schema0().also { instance = it } + } + } + + @Throws(ValidationException::class) + override fun validate(arg: Nothing?, configuration: SchemaConfiguration?): Nothing? { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validatedPathToSchemas = PathToSchemasMap() + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, LinkedHashSet()) + getPathToSchemas(this, castArg, validationMetadata, pathSet) + return castArg + } + + @Throws(ValidationException::class) + override fun validate(arg: Boolean, configuration: SchemaConfiguration?): Boolean { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validatedPathToSchemas = PathToSchemasMap() + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, LinkedHashSet()) + getPathToSchemas(this, castArg, validationMetadata, pathSet) + return castArg + } + + @Throws(ValidationException::class) + override fun validate(arg: Number, configuration: SchemaConfiguration?): Number { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validatedPathToSchemas = PathToSchemasMap() + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, LinkedHashSet()) + getPathToSchemas(this, castArg, validationMetadata, pathSet) + return castArg + } + + @Throws(ValidationException::class) + fun validate(arg: Int, configuration: SchemaConfiguration?): Int { + return validate(arg as Number, configuration) as Int + } + + @Throws(ValidationException::class) + fun validate(arg: Long, configuration: SchemaConfiguration?): Long { + return validate(arg as Number, configuration) as Long + } + + @Throws(ValidationException::class) + fun validate(arg: Float, configuration: SchemaConfiguration?): Float { + return validate(arg as Number, configuration) as Float + } + + @Throws(ValidationException::class) + fun validate(arg: Double, configuration: SchemaConfiguration?): Double { + return validate(arg as Number, configuration) as Double + } + + @Throws(ValidationException::class) + override fun validate(arg: String, configuration: SchemaConfiguration?): String { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validatedPathToSchemas = PathToSchemasMap() + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, LinkedHashSet()) + getPathToSchemas(this, castArg, validationMetadata, pathSet) + return castArg + } + + @Throws(ValidationException::class) + fun validate(arg: LocalDate, configuration: SchemaConfiguration?): String { + return validate(arg.toString(), configuration) + } + + @Throws(ValidationException::class) + fun validate(arg: ZonedDateTime, configuration: SchemaConfiguration?): String { + return validate(arg.toString(), configuration) + } + + @Throws(ValidationException::class) + fun validate(arg: UUID, configuration: SchemaConfiguration?): String { + return validate(arg.toString(), configuration) + } + + override fun getNewInstance(arg: List<*>, pathToItem: List, pathToSchemas: PathToSchemasMap): FrozenList { + val items: MutableList = ArrayList() + var i: Int = 0 + for (item: Any? in arg) { + val itemPathToItem = pathToItem + i + val schemas: LinkedHashMap, Nothing?>? = pathToSchemas.get(itemPathToItem) + if (schemas == null) { + throw RuntimeException("Validation result is invalid, schemas must exist for a pathToItem") + } + val itemSchema: JsonSchema<*> = schemas.entries.iterator().next().key + val itemInstance: Any? = itemSchema.getNewInstance(item, itemPathToItem, pathToSchemas) + items.add(itemInstance) + i += 1 + } + val newInstanceItems: FrozenList = FrozenList(items) + return newInstanceItems + } + + @Throws(ValidationException::class) + override fun validate(arg: List<*>, configuration: SchemaConfiguration?): FrozenList { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, PathToSchemasMap(), LinkedHashSet()) + val pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet) + return getNewInstance(castArg, validationMetadata.pathToItem, pathToSchemasMap) + } + + override fun getNewInstance(arg: Map<*, *>, pathToItem: List, pathToSchemas: PathToSchemasMap): Schema0Map { + val properties: LinkedHashMap = LinkedHashMap() + for((propertyName, value) in arg) { + if (!(propertyName is String)) { + throw RuntimeException("Invalid non-string key value") + } + val propertyPathToItem: List = pathToItem + propertyName + val schemas: LinkedHashMap, Nothing?>? = pathToSchemas.get(propertyPathToItem) + if (schemas == null) { + throw RuntimeException("Validation result is invalid, schemas must exist for a pathToItem") + } + val propertySchema: JsonSchema<*> = schemas.entries.iterator().next().key + val propertyInstance: Any? = propertySchema.getNewInstance(value, propertyPathToItem, pathToSchemas) + properties[propertyName] = propertyInstance + } + val castProperties: FrozenMap = FrozenMap(properties) + return Schema0Map(castProperties) + } + + @Throws(ValidationException::class) + override fun validate(arg: Map<*, *>, configuration: SchemaConfiguration?): Schema0Map { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validatedPathToSchemas = PathToSchemasMap() + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, LinkedHashSet()) + val pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet) + return getNewInstance(castArg, validationMetadata.pathToItem, pathToSchemasMap) + } + + @Throws(ValidationException::class) + override fun validate(arg: Any?, configuration: SchemaConfiguration?): Any? { + if (arg == null) { + return validate(null, configuration) + } else if (arg is Boolean) { + return validate(arg, configuration) + } else if (arg is Number) { + return validate(arg, configuration) + } else if (arg is String) { + return validate(arg, configuration) + } else if (arg is List<*>) { + return validate(arg, configuration) + } else if (arg is Map<*, *>) { + return validate(arg, configuration) + } + throw ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema") + } + override fun getNewInstance(arg: Any?, pathToItem: List, pathToSchemas: PathToSchemasMap): Any? { + if (arg == null) { + return getNewInstance( null, pathToItem, pathToSchemas) + } else if (arg is Boolean) { + return getNewInstance(arg, pathToItem, pathToSchemas) + } else if (arg is Number) { + return getNewInstance(arg, pathToItem, pathToSchemas) + } else if (arg is String) { + return getNewInstance(arg, pathToItem, pathToSchemas) + } else if (arg is List<*>) { + return getNewInstance(arg, pathToItem, pathToSchemas) + } else if (arg is Map<*, *>) { + return getNewInstance(arg, pathToItem, pathToSchemas) + } + throw RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema") + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: Nothing?, configuration: SchemaConfiguration?): Schema0BoxedVoid { + return Schema0BoxedVoid(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: Boolean, configuration: SchemaConfiguration?): Schema0BoxedBoolean { + return Schema0BoxedBoolean(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: Number, configuration: SchemaConfiguration?): Schema0BoxedNumber { + return Schema0BoxedNumber(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: String, configuration: SchemaConfiguration?): Schema0BoxedString { + return Schema0BoxedString(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: List<*>, configuration: SchemaConfiguration?): Schema0BoxedList { + return Schema0BoxedList(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: Map<*, *>, configuration: SchemaConfiguration?): Schema0BoxedMap { + return Schema0BoxedMap(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: Any?, configuration: SchemaConfiguration?): Schema0Boxed { + if (arg == null) { + return validateAndBox(null, configuration) + } else if (arg is Boolean) { + return validateAndBox(arg, configuration) + } else if (arg is String) { + return validateAndBox(arg, configuration) + } else if (arg is Number) { + return validateAndBox(arg, configuration) + } else if (arg is List<*>) { + return validateAndBox(arg, configuration) + } else if (arg is Map<*, *>) { + return validateAndBox(arg, configuration) + } + throw ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema") + } + } + + class Foo : StringJsonSchema.StringJsonSchema1() { + companion object { + @Volatile + private var instance: Foo? = null + + fun getInstance() = + instance ?: synchronized(this) { + instance ?: Foo().also { instance = it } + } + } + } + + + class Schema1Map(m: FrozenMap) : FrozenMap(m) { + companion object { + val requiredKeys: Set = setOf( + "foo" + ) + val optionalKeys: Set = setOf() + @Throws(ValidationException::class) + fun of(arg: Map, configuration: SchemaConfiguration): Schema1Map { + return Schema1.getInstance().validate(arg, configuration) + } + } + + fun foo(): String { + val value: Any? = get("foo") + if (!(value is String)) { + throw RuntimeException("Invalid value stored for foo") + } + return value + } + + @Throws(UnsetPropertyException::class, InvalidAdditionalPropertyException::class) + fun getAdditionalProperty(name: String): Any? { + throwIfKeyKnown(name, requiredKeys, optionalKeys) + throwIfKeyNotPresent(name) + return get(name) + } + } + + interface SetterForFoo { + fun getInstance(): MutableMap + fun getBuilderAfterFoo(instance: MutableMap): T + + fun foo(value: String): T { + val instance = getInstance() + instance["foo"] = value + return getBuilderAfterFoo(instance) + } + } + + class Schema1Map0Builder(private val instance: MutableMap): UnsetAddPropsSetter, GenericBuilder> { + private val knownKeys: Set = setOf( + "foo" + ) + override fun getKnownKeys(): Set { + return knownKeys + } + override fun build(): Map { + return instance + } + override fun getInstance(): MutableMap { + return instance + } + override fun getBuilderAfterAdditionalProperty(instance: MutableMap): Schema1Map0Builder { + return this + } + } + + class Schema1MapBuilder: SetterForFoo { + private val instance: MutableMap + init { + this.instance = LinkedHashMap() + } + override fun getInstance(): MutableMap { + return instance + } + override fun getBuilderAfterFoo(instance: MutableMap): Schema1Map0Builder { + return Schema1Map0Builder(instance) + } + } + + + sealed interface Schema1Boxed { + fun getData(): Any? + } + + data class Schema1BoxedVoid(val data: Nothing?) : Schema1Boxed { + override fun getData(): Any? { + return data + } + } + + data class Schema1BoxedBoolean(val data: Boolean): Schema1Boxed { + override fun getData(): Any? { + return data + } + } + + data class Schema1BoxedNumber(val data: Number) : Schema1Boxed { + override fun getData(): Any? { + return data + } + } + + data class Schema1BoxedString(val data: String) : Schema1Boxed { + override fun getData(): Any? { + return data + } + } + + data class Schema1BoxedList(val data: FrozenList) : Schema1Boxed { + override fun getData(): Any? { + return data + } + } + + data class Schema1BoxedMap(val data: Schema1Map) : Schema1Boxed { + override fun getData(): Any? { + return data + } + } + + + class Schema1 private constructor(): JsonSchema( + JsonSchemaInfo() + .properties(mapOf( + "foo" to Foo::class.java + )) + .required(setOf( + "foo" + )) + ), NullSchemaValidator, BooleanSchemaValidator, NumberSchemaValidator, StringSchemaValidator, ListSchemaValidator, Schema1BoxedList>, MapSchemaValidator { + + companion object { + @Volatile + private var instance: Schema1? = null + + fun getInstance() = + instance ?: synchronized(this) { + instance ?: Schema1().also { instance = it } + } + } + + @Throws(ValidationException::class) + override fun validate(arg: Nothing?, configuration: SchemaConfiguration?): Nothing? { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validatedPathToSchemas = PathToSchemasMap() + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, LinkedHashSet()) + getPathToSchemas(this, castArg, validationMetadata, pathSet) + return castArg + } + + @Throws(ValidationException::class) + override fun validate(arg: Boolean, configuration: SchemaConfiguration?): Boolean { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validatedPathToSchemas = PathToSchemasMap() + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, LinkedHashSet()) + getPathToSchemas(this, castArg, validationMetadata, pathSet) + return castArg + } + + @Throws(ValidationException::class) + override fun validate(arg: Number, configuration: SchemaConfiguration?): Number { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validatedPathToSchemas = PathToSchemasMap() + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, LinkedHashSet()) + getPathToSchemas(this, castArg, validationMetadata, pathSet) + return castArg + } + + @Throws(ValidationException::class) + fun validate(arg: Int, configuration: SchemaConfiguration?): Int { + return validate(arg as Number, configuration) as Int + } + + @Throws(ValidationException::class) + fun validate(arg: Long, configuration: SchemaConfiguration?): Long { + return validate(arg as Number, configuration) as Long + } + + @Throws(ValidationException::class) + fun validate(arg: Float, configuration: SchemaConfiguration?): Float { + return validate(arg as Number, configuration) as Float + } + + @Throws(ValidationException::class) + fun validate(arg: Double, configuration: SchemaConfiguration?): Double { + return validate(arg as Number, configuration) as Double + } + + @Throws(ValidationException::class) + override fun validate(arg: String, configuration: SchemaConfiguration?): String { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validatedPathToSchemas = PathToSchemasMap() + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, LinkedHashSet()) + getPathToSchemas(this, castArg, validationMetadata, pathSet) + return castArg + } + + @Throws(ValidationException::class) + fun validate(arg: LocalDate, configuration: SchemaConfiguration?): String { + return validate(arg.toString(), configuration) + } + + @Throws(ValidationException::class) + fun validate(arg: ZonedDateTime, configuration: SchemaConfiguration?): String { + return validate(arg.toString(), configuration) + } + + @Throws(ValidationException::class) + fun validate(arg: UUID, configuration: SchemaConfiguration?): String { + return validate(arg.toString(), configuration) + } + + override fun getNewInstance(arg: List<*>, pathToItem: List, pathToSchemas: PathToSchemasMap): FrozenList { + val items: MutableList = ArrayList() + var i: Int = 0 + for (item: Any? in arg) { + val itemPathToItem = pathToItem + i + val schemas: LinkedHashMap, Nothing?>? = pathToSchemas.get(itemPathToItem) + if (schemas == null) { + throw RuntimeException("Validation result is invalid, schemas must exist for a pathToItem") + } + val itemSchema: JsonSchema<*> = schemas.entries.iterator().next().key + val itemInstance: Any? = itemSchema.getNewInstance(item, itemPathToItem, pathToSchemas) + items.add(itemInstance) + i += 1 + } + val newInstanceItems: FrozenList = FrozenList(items) + return newInstanceItems + } + + @Throws(ValidationException::class) + override fun validate(arg: List<*>, configuration: SchemaConfiguration?): FrozenList { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, PathToSchemasMap(), LinkedHashSet()) + val pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet) + return getNewInstance(castArg, validationMetadata.pathToItem, pathToSchemasMap) + } + + override fun getNewInstance(arg: Map<*, *>, pathToItem: List, pathToSchemas: PathToSchemasMap): Schema1Map { + val properties: LinkedHashMap = LinkedHashMap() + for((propertyName, value) in arg) { + if (!(propertyName is String)) { + throw RuntimeException("Invalid non-string key value") + } + val propertyPathToItem: List = pathToItem + propertyName + val schemas: LinkedHashMap, Nothing?>? = pathToSchemas.get(propertyPathToItem) + if (schemas == null) { + throw RuntimeException("Validation result is invalid, schemas must exist for a pathToItem") + } + val propertySchema: JsonSchema<*> = schemas.entries.iterator().next().key + val propertyInstance: Any? = propertySchema.getNewInstance(value, propertyPathToItem, pathToSchemas) + properties[propertyName] = propertyInstance + } + val castProperties: FrozenMap = FrozenMap(properties) + return Schema1Map(castProperties) + } + + @Throws(ValidationException::class) + override fun validate(arg: Map<*, *>, configuration: SchemaConfiguration?): Schema1Map { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validatedPathToSchemas = PathToSchemasMap() + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, LinkedHashSet()) + val pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet) + return getNewInstance(castArg, validationMetadata.pathToItem, pathToSchemasMap) + } + + @Throws(ValidationException::class) + override fun validate(arg: Any?, configuration: SchemaConfiguration?): Any? { + if (arg == null) { + return validate(null, configuration) + } else if (arg is Boolean) { + return validate(arg, configuration) + } else if (arg is Number) { + return validate(arg, configuration) + } else if (arg is String) { + return validate(arg, configuration) + } else if (arg is List<*>) { + return validate(arg, configuration) + } else if (arg is Map<*, *>) { + return validate(arg, configuration) + } + throw ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema") + } + override fun getNewInstance(arg: Any?, pathToItem: List, pathToSchemas: PathToSchemasMap): Any? { + if (arg == null) { + return getNewInstance( null, pathToItem, pathToSchemas) + } else if (arg is Boolean) { + return getNewInstance(arg, pathToItem, pathToSchemas) + } else if (arg is Number) { + return getNewInstance(arg, pathToItem, pathToSchemas) + } else if (arg is String) { + return getNewInstance(arg, pathToItem, pathToSchemas) + } else if (arg is List<*>) { + return getNewInstance(arg, pathToItem, pathToSchemas) + } else if (arg is Map<*, *>) { + return getNewInstance(arg, pathToItem, pathToSchemas) + } + throw RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema") + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: Nothing?, configuration: SchemaConfiguration?): Schema1BoxedVoid { + return Schema1BoxedVoid(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: Boolean, configuration: SchemaConfiguration?): Schema1BoxedBoolean { + return Schema1BoxedBoolean(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: Number, configuration: SchemaConfiguration?): Schema1BoxedNumber { + return Schema1BoxedNumber(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: String, configuration: SchemaConfiguration?): Schema1BoxedString { + return Schema1BoxedString(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: List<*>, configuration: SchemaConfiguration?): Schema1BoxedList { + return Schema1BoxedList(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: Map<*, *>, configuration: SchemaConfiguration?): Schema1BoxedMap { + return Schema1BoxedMap(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: Any?, configuration: SchemaConfiguration?): Schema1Boxed { + if (arg == null) { + return validateAndBox(null, configuration) + } else if (arg is Boolean) { + return validateAndBox(arg, configuration) + } else if (arg is String) { + return validateAndBox(arg, configuration) + } else if (arg is Number) { + return validateAndBox(arg, configuration) + } else if (arg is List<*>) { + return validateAndBox(arg, configuration) + } else if (arg is Map<*, *>) { + return validateAndBox(arg, configuration) + } + throw ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema") + } + } + + sealed interface Allof1Boxed { + fun getData(): Any? + } + + data class Allof1BoxedVoid(val data: Nothing?) : Allof1Boxed { + override fun getData(): Any? { + return data + } + } + + data class Allof1BoxedBoolean(val data: Boolean): Allof1Boxed { + override fun getData(): Any? { + return data + } + } + + data class Allof1BoxedNumber(val data: Number) : Allof1Boxed { + override fun getData(): Any? { + return data + } + } + + data class Allof1BoxedString(val data: String) : Allof1Boxed { + override fun getData(): Any? { + return data + } + } + + data class Allof1BoxedList(val data: FrozenList) : Allof1Boxed { + override fun getData(): Any? { + return data + } + } + + data class Allof1BoxedMap(val data: FrozenMap) : Allof1Boxed { + override fun getData(): Any? { + return data + } + } + + + class Allof1 private constructor(): JsonSchema( + JsonSchemaInfo() + .allOf(listOf( + Schema0::class.java, + Schema1::class.java + )) + ), NullSchemaValidator, BooleanSchemaValidator, NumberSchemaValidator, StringSchemaValidator, ListSchemaValidator, Allof1BoxedList>, MapSchemaValidator, Allof1BoxedMap> { + /* + NOTE: This class is auto generated by OpenAPI JSON Schema Generator. + Ref: https://github.com/openapi-json-schema-tools/openapi-json-schema-generator + + Do not edit the class manually. + */ + + companion object { + @Volatile + private var instance: Allof1? = null + + fun getInstance() = + instance ?: synchronized(this) { + instance ?: Allof1().also { instance = it } + } + } + + @Throws(ValidationException::class) + override fun validate(arg: Nothing?, configuration: SchemaConfiguration?): Nothing? { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validatedPathToSchemas = PathToSchemasMap() + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, LinkedHashSet()) + getPathToSchemas(this, castArg, validationMetadata, pathSet) + return castArg + } + + @Throws(ValidationException::class) + override fun validate(arg: Boolean, configuration: SchemaConfiguration?): Boolean { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validatedPathToSchemas = PathToSchemasMap() + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, LinkedHashSet()) + getPathToSchemas(this, castArg, validationMetadata, pathSet) + return castArg + } + + @Throws(ValidationException::class) + override fun validate(arg: Number, configuration: SchemaConfiguration?): Number { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validatedPathToSchemas = PathToSchemasMap() + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, LinkedHashSet()) + getPathToSchemas(this, castArg, validationMetadata, pathSet) + return castArg + } + + @Throws(ValidationException::class) + fun validate(arg: Int, configuration: SchemaConfiguration?): Int { + return validate(arg as Number, configuration) as Int + } + + @Throws(ValidationException::class) + fun validate(arg: Long, configuration: SchemaConfiguration?): Long { + return validate(arg as Number, configuration) as Long + } + + @Throws(ValidationException::class) + fun validate(arg: Float, configuration: SchemaConfiguration?): Float { + return validate(arg as Number, configuration) as Float + } + + @Throws(ValidationException::class) + fun validate(arg: Double, configuration: SchemaConfiguration?): Double { + return validate(arg as Number, configuration) as Double + } + + @Throws(ValidationException::class) + override fun validate(arg: String, configuration: SchemaConfiguration?): String { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validatedPathToSchemas = PathToSchemasMap() + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, LinkedHashSet()) + getPathToSchemas(this, castArg, validationMetadata, pathSet) + return castArg + } + + @Throws(ValidationException::class) + fun validate(arg: LocalDate, configuration: SchemaConfiguration?): String { + return validate(arg.toString(), configuration) + } + + @Throws(ValidationException::class) + fun validate(arg: ZonedDateTime, configuration: SchemaConfiguration?): String { + return validate(arg.toString(), configuration) + } + + @Throws(ValidationException::class) + fun validate(arg: UUID, configuration: SchemaConfiguration?): String { + return validate(arg.toString(), configuration) + } + + override fun getNewInstance(arg: List<*>, pathToItem: List, pathToSchemas: PathToSchemasMap): FrozenList { + val items: MutableList = ArrayList() + var i: Int = 0 + for (item: Any? in arg) { + val itemPathToItem = pathToItem + i + val schemas: LinkedHashMap, Nothing?>? = pathToSchemas.get(itemPathToItem) + if (schemas == null) { + throw RuntimeException("Validation result is invalid, schemas must exist for a pathToItem") + } + val itemSchema: JsonSchema<*> = schemas.entries.iterator().next().key + val itemInstance: Any? = itemSchema.getNewInstance(item, itemPathToItem, pathToSchemas) + items.add(itemInstance) + i += 1 + } + val newInstanceItems: FrozenList = FrozenList(items) + return newInstanceItems + } + + @Throws(ValidationException::class) + override fun validate(arg: List<*>, configuration: SchemaConfiguration?): FrozenList { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, PathToSchemasMap(), LinkedHashSet()) + val pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet) + return getNewInstance(castArg, validationMetadata.pathToItem, pathToSchemasMap) + } + + override fun getNewInstance(arg: Map<*, *>, pathToItem: List, pathToSchemas: PathToSchemasMap): FrozenMap { + val properties: LinkedHashMap = LinkedHashMap() + for((propertyName, value) in arg) { + if (!(propertyName is String)) { + throw RuntimeException("Invalid non-string key value") + } + val propertyPathToItem: List = pathToItem + propertyName + val schemas: LinkedHashMap, Nothing?>? = pathToSchemas.get(propertyPathToItem) + if (schemas == null) { + throw RuntimeException("Validation result is invalid, schemas must exist for a pathToItem") + } + val propertySchema: JsonSchema<*> = schemas.entries.iterator().next().key + val propertyInstance: Any? = propertySchema.getNewInstance(value, propertyPathToItem, pathToSchemas) + properties[propertyName] = propertyInstance + } + val castProperties: FrozenMap = FrozenMap(properties) + return castProperties + } + + @Throws(ValidationException::class) + override fun validate(arg: Map<*, *>, configuration: SchemaConfiguration?): FrozenMap { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validatedPathToSchemas = PathToSchemasMap() + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, LinkedHashSet()) + val pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet) + return getNewInstance(castArg, validationMetadata.pathToItem, pathToSchemasMap) + } + + @Throws(ValidationException::class) + override fun validate(arg: Any?, configuration: SchemaConfiguration?): Any? { + if (arg == null) { + return validate(null, configuration) + } else if (arg is Boolean) { + return validate(arg, configuration) + } else if (arg is Number) { + return validate(arg, configuration) + } else if (arg is String) { + return validate(arg, configuration) + } else if (arg is List<*>) { + return validate(arg, configuration) + } else if (arg is Map<*, *>) { + return validate(arg, configuration) + } + throw ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema") + } + override fun getNewInstance(arg: Any?, pathToItem: List, pathToSchemas: PathToSchemasMap): Any? { + if (arg == null) { + return getNewInstance( null, pathToItem, pathToSchemas) + } else if (arg is Boolean) { + return getNewInstance(arg, pathToItem, pathToSchemas) + } else if (arg is Number) { + return getNewInstance(arg, pathToItem, pathToSchemas) + } else if (arg is String) { + return getNewInstance(arg, pathToItem, pathToSchemas) + } else if (arg is List<*>) { + return getNewInstance(arg, pathToItem, pathToSchemas) + } else if (arg is Map<*, *>) { + return getNewInstance(arg, pathToItem, pathToSchemas) + } + throw RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema") + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: Nothing?, configuration: SchemaConfiguration?): Allof1BoxedVoid { + return Allof1BoxedVoid(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: Boolean, configuration: SchemaConfiguration?): Allof1BoxedBoolean { + return Allof1BoxedBoolean(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: Number, configuration: SchemaConfiguration?): Allof1BoxedNumber { + return Allof1BoxedNumber(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: String, configuration: SchemaConfiguration?): Allof1BoxedString { + return Allof1BoxedString(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: List<*>, configuration: SchemaConfiguration?): Allof1BoxedList { + return Allof1BoxedList(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: Map<*, *>, configuration: SchemaConfiguration?): Allof1BoxedMap { + return Allof1BoxedMap(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: Any?, configuration: SchemaConfiguration?): Allof1Boxed { + if (arg == null) { + return validateAndBox(null, configuration) + } else if (arg is Boolean) { + return validateAndBox(arg, configuration) + } else if (arg is String) { + return validateAndBox(arg, configuration) + } else if (arg is Number) { + return validateAndBox(arg, configuration) + } else if (arg is List<*>) { + return validateAndBox(arg, configuration) + } else if (arg is Map<*, *>) { + return validateAndBox(arg, configuration) + } + throw ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema") + } + } +} diff --git a/samples/client/3_1_0_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/schemas/AllofCombinedWithAnyofOneof.kt b/samples/client/3_1_0_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/schemas/AllofCombinedWithAnyofOneof.kt new file mode 100644 index 00000000000..22448768881 --- /dev/null +++ b/samples/client/3_1_0_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/schemas/AllofCombinedWithAnyofOneof.kt @@ -0,0 +1,1142 @@ +package org.openapijsonschematools.client.components.schemas +import java.math.BigDecimal +import java.time.LocalDate +import java.time.ZonedDateTime +import java.util.UUID +import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags +import org.openapijsonschematools.client.configurations.SchemaConfiguration +import org.openapijsonschematools.client.exceptions.InvalidAdditionalPropertyException +import org.openapijsonschematools.client.exceptions.UnsetPropertyException +import org.openapijsonschematools.client.exceptions.ValidationException +import org.openapijsonschematools.client.schemas.UnsetAddPropsSetter +import org.openapijsonschematools.client.schemas.validation.BooleanSchemaValidator +import org.openapijsonschematools.client.schemas.validation.FrozenList +import org.openapijsonschematools.client.schemas.validation.FrozenMap +import org.openapijsonschematools.client.schemas.validation.JsonSchema +import org.openapijsonschematools.client.schemas.validation.JsonSchemaInfo +import org.openapijsonschematools.client.schemas.validation.ListSchemaValidator +import org.openapijsonschematools.client.schemas.validation.MapSchemaValidator +import org.openapijsonschematools.client.schemas.validation.NullSchemaValidator +import org.openapijsonschematools.client.schemas.validation.NumberSchemaValidator +import org.openapijsonschematools.client.schemas.validation.PathToSchemasMap +import org.openapijsonschematools.client.schemas.validation.StringSchemaValidator +import org.openapijsonschematools.client.schemas.validation.ValidationMetadata + +class AllofCombinedWithAnyofOneof { + // nest classes so all schemas and input/output classes can be public + + + sealed interface Schema02Boxed { + fun getData(): Any? + } + + data class Schema02BoxedVoid(val data: Nothing?) : Schema02Boxed { + override fun getData(): Any? { + return data + } + } + + data class Schema02BoxedBoolean(val data: Boolean): Schema02Boxed { + override fun getData(): Any? { + return data + } + } + + data class Schema02BoxedNumber(val data: Number) : Schema02Boxed { + override fun getData(): Any? { + return data + } + } + + data class Schema02BoxedString(val data: String) : Schema02Boxed { + override fun getData(): Any? { + return data + } + } + + data class Schema02BoxedList(val data: FrozenList) : Schema02Boxed { + override fun getData(): Any? { + return data + } + } + + data class Schema02BoxedMap(val data: FrozenMap) : Schema02Boxed { + override fun getData(): Any? { + return data + } + } + + + class Schema02 private constructor(): JsonSchema( + JsonSchemaInfo() + .multipleOf(BigDecimal("2")) + ), NullSchemaValidator, BooleanSchemaValidator, NumberSchemaValidator, StringSchemaValidator, ListSchemaValidator, Schema02BoxedList>, MapSchemaValidator, Schema02BoxedMap> { + + companion object { + @Volatile + private var instance: Schema02? = null + + fun getInstance() = + instance ?: synchronized(this) { + instance ?: Schema02().also { instance = it } + } + } + + @Throws(ValidationException::class) + override fun validate(arg: Nothing?, configuration: SchemaConfiguration?): Nothing? { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validatedPathToSchemas = PathToSchemasMap() + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, LinkedHashSet()) + getPathToSchemas(this, castArg, validationMetadata, pathSet) + return castArg + } + + @Throws(ValidationException::class) + override fun validate(arg: Boolean, configuration: SchemaConfiguration?): Boolean { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validatedPathToSchemas = PathToSchemasMap() + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, LinkedHashSet()) + getPathToSchemas(this, castArg, validationMetadata, pathSet) + return castArg + } + + @Throws(ValidationException::class) + override fun validate(arg: Number, configuration: SchemaConfiguration?): Number { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validatedPathToSchemas = PathToSchemasMap() + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, LinkedHashSet()) + getPathToSchemas(this, castArg, validationMetadata, pathSet) + return castArg + } + + @Throws(ValidationException::class) + fun validate(arg: Int, configuration: SchemaConfiguration?): Int { + return validate(arg as Number, configuration) as Int + } + + @Throws(ValidationException::class) + fun validate(arg: Long, configuration: SchemaConfiguration?): Long { + return validate(arg as Number, configuration) as Long + } + + @Throws(ValidationException::class) + fun validate(arg: Float, configuration: SchemaConfiguration?): Float { + return validate(arg as Number, configuration) as Float + } + + @Throws(ValidationException::class) + fun validate(arg: Double, configuration: SchemaConfiguration?): Double { + return validate(arg as Number, configuration) as Double + } + + @Throws(ValidationException::class) + override fun validate(arg: String, configuration: SchemaConfiguration?): String { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validatedPathToSchemas = PathToSchemasMap() + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, LinkedHashSet()) + getPathToSchemas(this, castArg, validationMetadata, pathSet) + return castArg + } + + @Throws(ValidationException::class) + fun validate(arg: LocalDate, configuration: SchemaConfiguration?): String { + return validate(arg.toString(), configuration) + } + + @Throws(ValidationException::class) + fun validate(arg: ZonedDateTime, configuration: SchemaConfiguration?): String { + return validate(arg.toString(), configuration) + } + + @Throws(ValidationException::class) + fun validate(arg: UUID, configuration: SchemaConfiguration?): String { + return validate(arg.toString(), configuration) + } + + override fun getNewInstance(arg: List<*>, pathToItem: List, pathToSchemas: PathToSchemasMap): FrozenList { + val items: MutableList = ArrayList() + var i: Int = 0 + for (item: Any? in arg) { + val itemPathToItem = pathToItem + i + val schemas: LinkedHashMap, Nothing?>? = pathToSchemas.get(itemPathToItem) + if (schemas == null) { + throw RuntimeException("Validation result is invalid, schemas must exist for a pathToItem") + } + val itemSchema: JsonSchema<*> = schemas.entries.iterator().next().key + val itemInstance: Any? = itemSchema.getNewInstance(item, itemPathToItem, pathToSchemas) + items.add(itemInstance) + i += 1 + } + val newInstanceItems: FrozenList = FrozenList(items) + return newInstanceItems + } + + @Throws(ValidationException::class) + override fun validate(arg: List<*>, configuration: SchemaConfiguration?): FrozenList { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, PathToSchemasMap(), LinkedHashSet()) + val pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet) + return getNewInstance(castArg, validationMetadata.pathToItem, pathToSchemasMap) + } + + override fun getNewInstance(arg: Map<*, *>, pathToItem: List, pathToSchemas: PathToSchemasMap): FrozenMap { + val properties: LinkedHashMap = LinkedHashMap() + for((propertyName, value) in arg) { + if (!(propertyName is String)) { + throw RuntimeException("Invalid non-string key value") + } + val propertyPathToItem: List = pathToItem + propertyName + val schemas: LinkedHashMap, Nothing?>? = pathToSchemas.get(propertyPathToItem) + if (schemas == null) { + throw RuntimeException("Validation result is invalid, schemas must exist for a pathToItem") + } + val propertySchema: JsonSchema<*> = schemas.entries.iterator().next().key + val propertyInstance: Any? = propertySchema.getNewInstance(value, propertyPathToItem, pathToSchemas) + properties[propertyName] = propertyInstance + } + val castProperties: FrozenMap = FrozenMap(properties) + return castProperties + } + + @Throws(ValidationException::class) + override fun validate(arg: Map<*, *>, configuration: SchemaConfiguration?): FrozenMap { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validatedPathToSchemas = PathToSchemasMap() + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, LinkedHashSet()) + val pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet) + return getNewInstance(castArg, validationMetadata.pathToItem, pathToSchemasMap) + } + + @Throws(ValidationException::class) + override fun validate(arg: Any?, configuration: SchemaConfiguration?): Any? { + if (arg == null) { + return validate(null, configuration) + } else if (arg is Boolean) { + return validate(arg, configuration) + } else if (arg is Number) { + return validate(arg, configuration) + } else if (arg is String) { + return validate(arg, configuration) + } else if (arg is List<*>) { + return validate(arg, configuration) + } else if (arg is Map<*, *>) { + return validate(arg, configuration) + } + throw ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema") + } + override fun getNewInstance(arg: Any?, pathToItem: List, pathToSchemas: PathToSchemasMap): Any? { + if (arg == null) { + return getNewInstance( null, pathToItem, pathToSchemas) + } else if (arg is Boolean) { + return getNewInstance(arg, pathToItem, pathToSchemas) + } else if (arg is Number) { + return getNewInstance(arg, pathToItem, pathToSchemas) + } else if (arg is String) { + return getNewInstance(arg, pathToItem, pathToSchemas) + } else if (arg is List<*>) { + return getNewInstance(arg, pathToItem, pathToSchemas) + } else if (arg is Map<*, *>) { + return getNewInstance(arg, pathToItem, pathToSchemas) + } + throw RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema") + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: Nothing?, configuration: SchemaConfiguration?): Schema02BoxedVoid { + return Schema02BoxedVoid(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: Boolean, configuration: SchemaConfiguration?): Schema02BoxedBoolean { + return Schema02BoxedBoolean(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: Number, configuration: SchemaConfiguration?): Schema02BoxedNumber { + return Schema02BoxedNumber(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: String, configuration: SchemaConfiguration?): Schema02BoxedString { + return Schema02BoxedString(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: List<*>, configuration: SchemaConfiguration?): Schema02BoxedList { + return Schema02BoxedList(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: Map<*, *>, configuration: SchemaConfiguration?): Schema02BoxedMap { + return Schema02BoxedMap(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: Any?, configuration: SchemaConfiguration?): Schema02Boxed { + if (arg == null) { + return validateAndBox(null, configuration) + } else if (arg is Boolean) { + return validateAndBox(arg, configuration) + } else if (arg is String) { + return validateAndBox(arg, configuration) + } else if (arg is Number) { + return validateAndBox(arg, configuration) + } else if (arg is List<*>) { + return validateAndBox(arg, configuration) + } else if (arg is Map<*, *>) { + return validateAndBox(arg, configuration) + } + throw ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema") + } + } + + sealed interface Schema01Boxed { + fun getData(): Any? + } + + data class Schema01BoxedVoid(val data: Nothing?) : Schema01Boxed { + override fun getData(): Any? { + return data + } + } + + data class Schema01BoxedBoolean(val data: Boolean): Schema01Boxed { + override fun getData(): Any? { + return data + } + } + + data class Schema01BoxedNumber(val data: Number) : Schema01Boxed { + override fun getData(): Any? { + return data + } + } + + data class Schema01BoxedString(val data: String) : Schema01Boxed { + override fun getData(): Any? { + return data + } + } + + data class Schema01BoxedList(val data: FrozenList) : Schema01Boxed { + override fun getData(): Any? { + return data + } + } + + data class Schema01BoxedMap(val data: FrozenMap) : Schema01Boxed { + override fun getData(): Any? { + return data + } + } + + + class Schema01 private constructor(): JsonSchema( + JsonSchemaInfo() + .multipleOf(BigDecimal("3")) + ), NullSchemaValidator, BooleanSchemaValidator, NumberSchemaValidator, StringSchemaValidator, ListSchemaValidator, Schema01BoxedList>, MapSchemaValidator, Schema01BoxedMap> { + + companion object { + @Volatile + private var instance: Schema01? = null + + fun getInstance() = + instance ?: synchronized(this) { + instance ?: Schema01().also { instance = it } + } + } + + @Throws(ValidationException::class) + override fun validate(arg: Nothing?, configuration: SchemaConfiguration?): Nothing? { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validatedPathToSchemas = PathToSchemasMap() + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, LinkedHashSet()) + getPathToSchemas(this, castArg, validationMetadata, pathSet) + return castArg + } + + @Throws(ValidationException::class) + override fun validate(arg: Boolean, configuration: SchemaConfiguration?): Boolean { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validatedPathToSchemas = PathToSchemasMap() + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, LinkedHashSet()) + getPathToSchemas(this, castArg, validationMetadata, pathSet) + return castArg + } + + @Throws(ValidationException::class) + override fun validate(arg: Number, configuration: SchemaConfiguration?): Number { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validatedPathToSchemas = PathToSchemasMap() + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, LinkedHashSet()) + getPathToSchemas(this, castArg, validationMetadata, pathSet) + return castArg + } + + @Throws(ValidationException::class) + fun validate(arg: Int, configuration: SchemaConfiguration?): Int { + return validate(arg as Number, configuration) as Int + } + + @Throws(ValidationException::class) + fun validate(arg: Long, configuration: SchemaConfiguration?): Long { + return validate(arg as Number, configuration) as Long + } + + @Throws(ValidationException::class) + fun validate(arg: Float, configuration: SchemaConfiguration?): Float { + return validate(arg as Number, configuration) as Float + } + + @Throws(ValidationException::class) + fun validate(arg: Double, configuration: SchemaConfiguration?): Double { + return validate(arg as Number, configuration) as Double + } + + @Throws(ValidationException::class) + override fun validate(arg: String, configuration: SchemaConfiguration?): String { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validatedPathToSchemas = PathToSchemasMap() + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, LinkedHashSet()) + getPathToSchemas(this, castArg, validationMetadata, pathSet) + return castArg + } + + @Throws(ValidationException::class) + fun validate(arg: LocalDate, configuration: SchemaConfiguration?): String { + return validate(arg.toString(), configuration) + } + + @Throws(ValidationException::class) + fun validate(arg: ZonedDateTime, configuration: SchemaConfiguration?): String { + return validate(arg.toString(), configuration) + } + + @Throws(ValidationException::class) + fun validate(arg: UUID, configuration: SchemaConfiguration?): String { + return validate(arg.toString(), configuration) + } + + override fun getNewInstance(arg: List<*>, pathToItem: List, pathToSchemas: PathToSchemasMap): FrozenList { + val items: MutableList = ArrayList() + var i: Int = 0 + for (item: Any? in arg) { + val itemPathToItem = pathToItem + i + val schemas: LinkedHashMap, Nothing?>? = pathToSchemas.get(itemPathToItem) + if (schemas == null) { + throw RuntimeException("Validation result is invalid, schemas must exist for a pathToItem") + } + val itemSchema: JsonSchema<*> = schemas.entries.iterator().next().key + val itemInstance: Any? = itemSchema.getNewInstance(item, itemPathToItem, pathToSchemas) + items.add(itemInstance) + i += 1 + } + val newInstanceItems: FrozenList = FrozenList(items) + return newInstanceItems + } + + @Throws(ValidationException::class) + override fun validate(arg: List<*>, configuration: SchemaConfiguration?): FrozenList { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, PathToSchemasMap(), LinkedHashSet()) + val pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet) + return getNewInstance(castArg, validationMetadata.pathToItem, pathToSchemasMap) + } + + override fun getNewInstance(arg: Map<*, *>, pathToItem: List, pathToSchemas: PathToSchemasMap): FrozenMap { + val properties: LinkedHashMap = LinkedHashMap() + for((propertyName, value) in arg) { + if (!(propertyName is String)) { + throw RuntimeException("Invalid non-string key value") + } + val propertyPathToItem: List = pathToItem + propertyName + val schemas: LinkedHashMap, Nothing?>? = pathToSchemas.get(propertyPathToItem) + if (schemas == null) { + throw RuntimeException("Validation result is invalid, schemas must exist for a pathToItem") + } + val propertySchema: JsonSchema<*> = schemas.entries.iterator().next().key + val propertyInstance: Any? = propertySchema.getNewInstance(value, propertyPathToItem, pathToSchemas) + properties[propertyName] = propertyInstance + } + val castProperties: FrozenMap = FrozenMap(properties) + return castProperties + } + + @Throws(ValidationException::class) + override fun validate(arg: Map<*, *>, configuration: SchemaConfiguration?): FrozenMap { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validatedPathToSchemas = PathToSchemasMap() + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, LinkedHashSet()) + val pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet) + return getNewInstance(castArg, validationMetadata.pathToItem, pathToSchemasMap) + } + + @Throws(ValidationException::class) + override fun validate(arg: Any?, configuration: SchemaConfiguration?): Any? { + if (arg == null) { + return validate(null, configuration) + } else if (arg is Boolean) { + return validate(arg, configuration) + } else if (arg is Number) { + return validate(arg, configuration) + } else if (arg is String) { + return validate(arg, configuration) + } else if (arg is List<*>) { + return validate(arg, configuration) + } else if (arg is Map<*, *>) { + return validate(arg, configuration) + } + throw ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema") + } + override fun getNewInstance(arg: Any?, pathToItem: List, pathToSchemas: PathToSchemasMap): Any? { + if (arg == null) { + return getNewInstance( null, pathToItem, pathToSchemas) + } else if (arg is Boolean) { + return getNewInstance(arg, pathToItem, pathToSchemas) + } else if (arg is Number) { + return getNewInstance(arg, pathToItem, pathToSchemas) + } else if (arg is String) { + return getNewInstance(arg, pathToItem, pathToSchemas) + } else if (arg is List<*>) { + return getNewInstance(arg, pathToItem, pathToSchemas) + } else if (arg is Map<*, *>) { + return getNewInstance(arg, pathToItem, pathToSchemas) + } + throw RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema") + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: Nothing?, configuration: SchemaConfiguration?): Schema01BoxedVoid { + return Schema01BoxedVoid(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: Boolean, configuration: SchemaConfiguration?): Schema01BoxedBoolean { + return Schema01BoxedBoolean(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: Number, configuration: SchemaConfiguration?): Schema01BoxedNumber { + return Schema01BoxedNumber(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: String, configuration: SchemaConfiguration?): Schema01BoxedString { + return Schema01BoxedString(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: List<*>, configuration: SchemaConfiguration?): Schema01BoxedList { + return Schema01BoxedList(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: Map<*, *>, configuration: SchemaConfiguration?): Schema01BoxedMap { + return Schema01BoxedMap(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: Any?, configuration: SchemaConfiguration?): Schema01Boxed { + if (arg == null) { + return validateAndBox(null, configuration) + } else if (arg is Boolean) { + return validateAndBox(arg, configuration) + } else if (arg is String) { + return validateAndBox(arg, configuration) + } else if (arg is Number) { + return validateAndBox(arg, configuration) + } else if (arg is List<*>) { + return validateAndBox(arg, configuration) + } else if (arg is Map<*, *>) { + return validateAndBox(arg, configuration) + } + throw ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema") + } + } + + sealed interface Schema0Boxed { + fun getData(): Any? + } + + data class Schema0BoxedVoid(val data: Nothing?) : Schema0Boxed { + override fun getData(): Any? { + return data + } + } + + data class Schema0BoxedBoolean(val data: Boolean): Schema0Boxed { + override fun getData(): Any? { + return data + } + } + + data class Schema0BoxedNumber(val data: Number) : Schema0Boxed { + override fun getData(): Any? { + return data + } + } + + data class Schema0BoxedString(val data: String) : Schema0Boxed { + override fun getData(): Any? { + return data + } + } + + data class Schema0BoxedList(val data: FrozenList) : Schema0Boxed { + override fun getData(): Any? { + return data + } + } + + data class Schema0BoxedMap(val data: FrozenMap) : Schema0Boxed { + override fun getData(): Any? { + return data + } + } + + + class Schema0 private constructor(): JsonSchema( + JsonSchemaInfo() + .multipleOf(BigDecimal("5")) + ), NullSchemaValidator, BooleanSchemaValidator, NumberSchemaValidator, StringSchemaValidator, ListSchemaValidator, Schema0BoxedList>, MapSchemaValidator, Schema0BoxedMap> { + + companion object { + @Volatile + private var instance: Schema0? = null + + fun getInstance() = + instance ?: synchronized(this) { + instance ?: Schema0().also { instance = it } + } + } + + @Throws(ValidationException::class) + override fun validate(arg: Nothing?, configuration: SchemaConfiguration?): Nothing? { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validatedPathToSchemas = PathToSchemasMap() + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, LinkedHashSet()) + getPathToSchemas(this, castArg, validationMetadata, pathSet) + return castArg + } + + @Throws(ValidationException::class) + override fun validate(arg: Boolean, configuration: SchemaConfiguration?): Boolean { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validatedPathToSchemas = PathToSchemasMap() + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, LinkedHashSet()) + getPathToSchemas(this, castArg, validationMetadata, pathSet) + return castArg + } + + @Throws(ValidationException::class) + override fun validate(arg: Number, configuration: SchemaConfiguration?): Number { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validatedPathToSchemas = PathToSchemasMap() + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, LinkedHashSet()) + getPathToSchemas(this, castArg, validationMetadata, pathSet) + return castArg + } + + @Throws(ValidationException::class) + fun validate(arg: Int, configuration: SchemaConfiguration?): Int { + return validate(arg as Number, configuration) as Int + } + + @Throws(ValidationException::class) + fun validate(arg: Long, configuration: SchemaConfiguration?): Long { + return validate(arg as Number, configuration) as Long + } + + @Throws(ValidationException::class) + fun validate(arg: Float, configuration: SchemaConfiguration?): Float { + return validate(arg as Number, configuration) as Float + } + + @Throws(ValidationException::class) + fun validate(arg: Double, configuration: SchemaConfiguration?): Double { + return validate(arg as Number, configuration) as Double + } + + @Throws(ValidationException::class) + override fun validate(arg: String, configuration: SchemaConfiguration?): String { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validatedPathToSchemas = PathToSchemasMap() + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, LinkedHashSet()) + getPathToSchemas(this, castArg, validationMetadata, pathSet) + return castArg + } + + @Throws(ValidationException::class) + fun validate(arg: LocalDate, configuration: SchemaConfiguration?): String { + return validate(arg.toString(), configuration) + } + + @Throws(ValidationException::class) + fun validate(arg: ZonedDateTime, configuration: SchemaConfiguration?): String { + return validate(arg.toString(), configuration) + } + + @Throws(ValidationException::class) + fun validate(arg: UUID, configuration: SchemaConfiguration?): String { + return validate(arg.toString(), configuration) + } + + override fun getNewInstance(arg: List<*>, pathToItem: List, pathToSchemas: PathToSchemasMap): FrozenList { + val items: MutableList = ArrayList() + var i: Int = 0 + for (item: Any? in arg) { + val itemPathToItem = pathToItem + i + val schemas: LinkedHashMap, Nothing?>? = pathToSchemas.get(itemPathToItem) + if (schemas == null) { + throw RuntimeException("Validation result is invalid, schemas must exist for a pathToItem") + } + val itemSchema: JsonSchema<*> = schemas.entries.iterator().next().key + val itemInstance: Any? = itemSchema.getNewInstance(item, itemPathToItem, pathToSchemas) + items.add(itemInstance) + i += 1 + } + val newInstanceItems: FrozenList = FrozenList(items) + return newInstanceItems + } + + @Throws(ValidationException::class) + override fun validate(arg: List<*>, configuration: SchemaConfiguration?): FrozenList { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, PathToSchemasMap(), LinkedHashSet()) + val pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet) + return getNewInstance(castArg, validationMetadata.pathToItem, pathToSchemasMap) + } + + override fun getNewInstance(arg: Map<*, *>, pathToItem: List, pathToSchemas: PathToSchemasMap): FrozenMap { + val properties: LinkedHashMap = LinkedHashMap() + for((propertyName, value) in arg) { + if (!(propertyName is String)) { + throw RuntimeException("Invalid non-string key value") + } + val propertyPathToItem: List = pathToItem + propertyName + val schemas: LinkedHashMap, Nothing?>? = pathToSchemas.get(propertyPathToItem) + if (schemas == null) { + throw RuntimeException("Validation result is invalid, schemas must exist for a pathToItem") + } + val propertySchema: JsonSchema<*> = schemas.entries.iterator().next().key + val propertyInstance: Any? = propertySchema.getNewInstance(value, propertyPathToItem, pathToSchemas) + properties[propertyName] = propertyInstance + } + val castProperties: FrozenMap = FrozenMap(properties) + return castProperties + } + + @Throws(ValidationException::class) + override fun validate(arg: Map<*, *>, configuration: SchemaConfiguration?): FrozenMap { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validatedPathToSchemas = PathToSchemasMap() + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, LinkedHashSet()) + val pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet) + return getNewInstance(castArg, validationMetadata.pathToItem, pathToSchemasMap) + } + + @Throws(ValidationException::class) + override fun validate(arg: Any?, configuration: SchemaConfiguration?): Any? { + if (arg == null) { + return validate(null, configuration) + } else if (arg is Boolean) { + return validate(arg, configuration) + } else if (arg is Number) { + return validate(arg, configuration) + } else if (arg is String) { + return validate(arg, configuration) + } else if (arg is List<*>) { + return validate(arg, configuration) + } else if (arg is Map<*, *>) { + return validate(arg, configuration) + } + throw ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema") + } + override fun getNewInstance(arg: Any?, pathToItem: List, pathToSchemas: PathToSchemasMap): Any? { + if (arg == null) { + return getNewInstance( null, pathToItem, pathToSchemas) + } else if (arg is Boolean) { + return getNewInstance(arg, pathToItem, pathToSchemas) + } else if (arg is Number) { + return getNewInstance(arg, pathToItem, pathToSchemas) + } else if (arg is String) { + return getNewInstance(arg, pathToItem, pathToSchemas) + } else if (arg is List<*>) { + return getNewInstance(arg, pathToItem, pathToSchemas) + } else if (arg is Map<*, *>) { + return getNewInstance(arg, pathToItem, pathToSchemas) + } + throw RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema") + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: Nothing?, configuration: SchemaConfiguration?): Schema0BoxedVoid { + return Schema0BoxedVoid(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: Boolean, configuration: SchemaConfiguration?): Schema0BoxedBoolean { + return Schema0BoxedBoolean(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: Number, configuration: SchemaConfiguration?): Schema0BoxedNumber { + return Schema0BoxedNumber(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: String, configuration: SchemaConfiguration?): Schema0BoxedString { + return Schema0BoxedString(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: List<*>, configuration: SchemaConfiguration?): Schema0BoxedList { + return Schema0BoxedList(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: Map<*, *>, configuration: SchemaConfiguration?): Schema0BoxedMap { + return Schema0BoxedMap(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: Any?, configuration: SchemaConfiguration?): Schema0Boxed { + if (arg == null) { + return validateAndBox(null, configuration) + } else if (arg is Boolean) { + return validateAndBox(arg, configuration) + } else if (arg is String) { + return validateAndBox(arg, configuration) + } else if (arg is Number) { + return validateAndBox(arg, configuration) + } else if (arg is List<*>) { + return validateAndBox(arg, configuration) + } else if (arg is Map<*, *>) { + return validateAndBox(arg, configuration) + } + throw ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema") + } + } + + sealed interface AllofCombinedWithAnyofOneof1Boxed { + fun getData(): Any? + } + + data class AllofCombinedWithAnyofOneof1BoxedVoid(val data: Nothing?) : AllofCombinedWithAnyofOneof1Boxed { + override fun getData(): Any? { + return data + } + } + + data class AllofCombinedWithAnyofOneof1BoxedBoolean(val data: Boolean): AllofCombinedWithAnyofOneof1Boxed { + override fun getData(): Any? { + return data + } + } + + data class AllofCombinedWithAnyofOneof1BoxedNumber(val data: Number) : AllofCombinedWithAnyofOneof1Boxed { + override fun getData(): Any? { + return data + } + } + + data class AllofCombinedWithAnyofOneof1BoxedString(val data: String) : AllofCombinedWithAnyofOneof1Boxed { + override fun getData(): Any? { + return data + } + } + + data class AllofCombinedWithAnyofOneof1BoxedList(val data: FrozenList) : AllofCombinedWithAnyofOneof1Boxed { + override fun getData(): Any? { + return data + } + } + + data class AllofCombinedWithAnyofOneof1BoxedMap(val data: FrozenMap) : AllofCombinedWithAnyofOneof1Boxed { + override fun getData(): Any? { + return data + } + } + + + class AllofCombinedWithAnyofOneof1 private constructor(): JsonSchema( + JsonSchemaInfo() + .allOf(listOf( + Schema02::class.java + )) + .anyOf(listOf( + Schema01::class.java + )) + .oneOf(listOf( + Schema0::class.java + )) + ), NullSchemaValidator, BooleanSchemaValidator, NumberSchemaValidator, StringSchemaValidator, ListSchemaValidator, AllofCombinedWithAnyofOneof1BoxedList>, MapSchemaValidator, AllofCombinedWithAnyofOneof1BoxedMap> { + /* + NOTE: This class is auto generated by OpenAPI JSON Schema Generator. + Ref: https://github.com/openapi-json-schema-tools/openapi-json-schema-generator + + Do not edit the class manually. + */ + + companion object { + @Volatile + private var instance: AllofCombinedWithAnyofOneof1? = null + + fun getInstance() = + instance ?: synchronized(this) { + instance ?: AllofCombinedWithAnyofOneof1().also { instance = it } + } + } + + @Throws(ValidationException::class) + override fun validate(arg: Nothing?, configuration: SchemaConfiguration?): Nothing? { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validatedPathToSchemas = PathToSchemasMap() + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, LinkedHashSet()) + getPathToSchemas(this, castArg, validationMetadata, pathSet) + return castArg + } + + @Throws(ValidationException::class) + override fun validate(arg: Boolean, configuration: SchemaConfiguration?): Boolean { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validatedPathToSchemas = PathToSchemasMap() + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, LinkedHashSet()) + getPathToSchemas(this, castArg, validationMetadata, pathSet) + return castArg + } + + @Throws(ValidationException::class) + override fun validate(arg: Number, configuration: SchemaConfiguration?): Number { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validatedPathToSchemas = PathToSchemasMap() + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, LinkedHashSet()) + getPathToSchemas(this, castArg, validationMetadata, pathSet) + return castArg + } + + @Throws(ValidationException::class) + fun validate(arg: Int, configuration: SchemaConfiguration?): Int { + return validate(arg as Number, configuration) as Int + } + + @Throws(ValidationException::class) + fun validate(arg: Long, configuration: SchemaConfiguration?): Long { + return validate(arg as Number, configuration) as Long + } + + @Throws(ValidationException::class) + fun validate(arg: Float, configuration: SchemaConfiguration?): Float { + return validate(arg as Number, configuration) as Float + } + + @Throws(ValidationException::class) + fun validate(arg: Double, configuration: SchemaConfiguration?): Double { + return validate(arg as Number, configuration) as Double + } + + @Throws(ValidationException::class) + override fun validate(arg: String, configuration: SchemaConfiguration?): String { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validatedPathToSchemas = PathToSchemasMap() + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, LinkedHashSet()) + getPathToSchemas(this, castArg, validationMetadata, pathSet) + return castArg + } + + @Throws(ValidationException::class) + fun validate(arg: LocalDate, configuration: SchemaConfiguration?): String { + return validate(arg.toString(), configuration) + } + + @Throws(ValidationException::class) + fun validate(arg: ZonedDateTime, configuration: SchemaConfiguration?): String { + return validate(arg.toString(), configuration) + } + + @Throws(ValidationException::class) + fun validate(arg: UUID, configuration: SchemaConfiguration?): String { + return validate(arg.toString(), configuration) + } + + override fun getNewInstance(arg: List<*>, pathToItem: List, pathToSchemas: PathToSchemasMap): FrozenList { + val items: MutableList = ArrayList() + var i: Int = 0 + for (item: Any? in arg) { + val itemPathToItem = pathToItem + i + val schemas: LinkedHashMap, Nothing?>? = pathToSchemas.get(itemPathToItem) + if (schemas == null) { + throw RuntimeException("Validation result is invalid, schemas must exist for a pathToItem") + } + val itemSchema: JsonSchema<*> = schemas.entries.iterator().next().key + val itemInstance: Any? = itemSchema.getNewInstance(item, itemPathToItem, pathToSchemas) + items.add(itemInstance) + i += 1 + } + val newInstanceItems: FrozenList = FrozenList(items) + return newInstanceItems + } + + @Throws(ValidationException::class) + override fun validate(arg: List<*>, configuration: SchemaConfiguration?): FrozenList { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, PathToSchemasMap(), LinkedHashSet()) + val pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet) + return getNewInstance(castArg, validationMetadata.pathToItem, pathToSchemasMap) + } + + override fun getNewInstance(arg: Map<*, *>, pathToItem: List, pathToSchemas: PathToSchemasMap): FrozenMap { + val properties: LinkedHashMap = LinkedHashMap() + for((propertyName, value) in arg) { + if (!(propertyName is String)) { + throw RuntimeException("Invalid non-string key value") + } + val propertyPathToItem: List = pathToItem + propertyName + val schemas: LinkedHashMap, Nothing?>? = pathToSchemas.get(propertyPathToItem) + if (schemas == null) { + throw RuntimeException("Validation result is invalid, schemas must exist for a pathToItem") + } + val propertySchema: JsonSchema<*> = schemas.entries.iterator().next().key + val propertyInstance: Any? = propertySchema.getNewInstance(value, propertyPathToItem, pathToSchemas) + properties[propertyName] = propertyInstance + } + val castProperties: FrozenMap = FrozenMap(properties) + return castProperties + } + + @Throws(ValidationException::class) + override fun validate(arg: Map<*, *>, configuration: SchemaConfiguration?): FrozenMap { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validatedPathToSchemas = PathToSchemasMap() + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, LinkedHashSet()) + val pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet) + return getNewInstance(castArg, validationMetadata.pathToItem, pathToSchemasMap) + } + + @Throws(ValidationException::class) + override fun validate(arg: Any?, configuration: SchemaConfiguration?): Any? { + if (arg == null) { + return validate(null, configuration) + } else if (arg is Boolean) { + return validate(arg, configuration) + } else if (arg is Number) { + return validate(arg, configuration) + } else if (arg is String) { + return validate(arg, configuration) + } else if (arg is List<*>) { + return validate(arg, configuration) + } else if (arg is Map<*, *>) { + return validate(arg, configuration) + } + throw ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema") + } + override fun getNewInstance(arg: Any?, pathToItem: List, pathToSchemas: PathToSchemasMap): Any? { + if (arg == null) { + return getNewInstance( null, pathToItem, pathToSchemas) + } else if (arg is Boolean) { + return getNewInstance(arg, pathToItem, pathToSchemas) + } else if (arg is Number) { + return getNewInstance(arg, pathToItem, pathToSchemas) + } else if (arg is String) { + return getNewInstance(arg, pathToItem, pathToSchemas) + } else if (arg is List<*>) { + return getNewInstance(arg, pathToItem, pathToSchemas) + } else if (arg is Map<*, *>) { + return getNewInstance(arg, pathToItem, pathToSchemas) + } + throw RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema") + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: Nothing?, configuration: SchemaConfiguration?): AllofCombinedWithAnyofOneof1BoxedVoid { + return AllofCombinedWithAnyofOneof1BoxedVoid(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: Boolean, configuration: SchemaConfiguration?): AllofCombinedWithAnyofOneof1BoxedBoolean { + return AllofCombinedWithAnyofOneof1BoxedBoolean(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: Number, configuration: SchemaConfiguration?): AllofCombinedWithAnyofOneof1BoxedNumber { + return AllofCombinedWithAnyofOneof1BoxedNumber(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: String, configuration: SchemaConfiguration?): AllofCombinedWithAnyofOneof1BoxedString { + return AllofCombinedWithAnyofOneof1BoxedString(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: List<*>, configuration: SchemaConfiguration?): AllofCombinedWithAnyofOneof1BoxedList { + return AllofCombinedWithAnyofOneof1BoxedList(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: Map<*, *>, configuration: SchemaConfiguration?): AllofCombinedWithAnyofOneof1BoxedMap { + return AllofCombinedWithAnyofOneof1BoxedMap(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: Any?, configuration: SchemaConfiguration?): AllofCombinedWithAnyofOneof1Boxed { + if (arg == null) { + return validateAndBox(null, configuration) + } else if (arg is Boolean) { + return validateAndBox(arg, configuration) + } else if (arg is String) { + return validateAndBox(arg, configuration) + } else if (arg is Number) { + return validateAndBox(arg, configuration) + } else if (arg is List<*>) { + return validateAndBox(arg, configuration) + } else if (arg is Map<*, *>) { + return validateAndBox(arg, configuration) + } + throw ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema") + } + } +} diff --git a/samples/client/3_1_0_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/schemas/AllofSimpleTypes.kt b/samples/client/3_1_0_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/schemas/AllofSimpleTypes.kt new file mode 100644 index 00000000000..1311748cc47 --- /dev/null +++ b/samples/client/3_1_0_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/schemas/AllofSimpleTypes.kt @@ -0,0 +1,861 @@ +package org.openapijsonschematools.client.components.schemas +import java.time.LocalDate +import java.time.ZonedDateTime +import java.util.UUID +import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags +import org.openapijsonschematools.client.configurations.SchemaConfiguration +import org.openapijsonschematools.client.exceptions.InvalidAdditionalPropertyException +import org.openapijsonschematools.client.exceptions.UnsetPropertyException +import org.openapijsonschematools.client.exceptions.ValidationException +import org.openapijsonschematools.client.schemas.UnsetAddPropsSetter +import org.openapijsonschematools.client.schemas.validation.BooleanSchemaValidator +import org.openapijsonschematools.client.schemas.validation.FrozenList +import org.openapijsonschematools.client.schemas.validation.FrozenMap +import org.openapijsonschematools.client.schemas.validation.JsonSchema +import org.openapijsonschematools.client.schemas.validation.JsonSchemaInfo +import org.openapijsonschematools.client.schemas.validation.ListSchemaValidator +import org.openapijsonschematools.client.schemas.validation.MapSchemaValidator +import org.openapijsonschematools.client.schemas.validation.NullSchemaValidator +import org.openapijsonschematools.client.schemas.validation.NumberSchemaValidator +import org.openapijsonschematools.client.schemas.validation.PathToSchemasMap +import org.openapijsonschematools.client.schemas.validation.StringSchemaValidator +import org.openapijsonschematools.client.schemas.validation.ValidationMetadata + +class AllofSimpleTypes { + // nest classes so all schemas and input/output classes can be public + + + sealed interface Schema0Boxed { + fun getData(): Any? + } + + data class Schema0BoxedVoid(val data: Nothing?) : Schema0Boxed { + override fun getData(): Any? { + return data + } + } + + data class Schema0BoxedBoolean(val data: Boolean): Schema0Boxed { + override fun getData(): Any? { + return data + } + } + + data class Schema0BoxedNumber(val data: Number) : Schema0Boxed { + override fun getData(): Any? { + return data + } + } + + data class Schema0BoxedString(val data: String) : Schema0Boxed { + override fun getData(): Any? { + return data + } + } + + data class Schema0BoxedList(val data: FrozenList) : Schema0Boxed { + override fun getData(): Any? { + return data + } + } + + data class Schema0BoxedMap(val data: FrozenMap) : Schema0Boxed { + override fun getData(): Any? { + return data + } + } + + + class Schema0 private constructor(): JsonSchema( + JsonSchemaInfo() + .maximum(30) + ), NullSchemaValidator, BooleanSchemaValidator, NumberSchemaValidator, StringSchemaValidator, ListSchemaValidator, Schema0BoxedList>, MapSchemaValidator, Schema0BoxedMap> { + + companion object { + @Volatile + private var instance: Schema0? = null + + fun getInstance() = + instance ?: synchronized(this) { + instance ?: Schema0().also { instance = it } + } + } + + @Throws(ValidationException::class) + override fun validate(arg: Nothing?, configuration: SchemaConfiguration?): Nothing? { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validatedPathToSchemas = PathToSchemasMap() + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, LinkedHashSet()) + getPathToSchemas(this, castArg, validationMetadata, pathSet) + return castArg + } + + @Throws(ValidationException::class) + override fun validate(arg: Boolean, configuration: SchemaConfiguration?): Boolean { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validatedPathToSchemas = PathToSchemasMap() + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, LinkedHashSet()) + getPathToSchemas(this, castArg, validationMetadata, pathSet) + return castArg + } + + @Throws(ValidationException::class) + override fun validate(arg: Number, configuration: SchemaConfiguration?): Number { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validatedPathToSchemas = PathToSchemasMap() + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, LinkedHashSet()) + getPathToSchemas(this, castArg, validationMetadata, pathSet) + return castArg + } + + @Throws(ValidationException::class) + fun validate(arg: Int, configuration: SchemaConfiguration?): Int { + return validate(arg as Number, configuration) as Int + } + + @Throws(ValidationException::class) + fun validate(arg: Long, configuration: SchemaConfiguration?): Long { + return validate(arg as Number, configuration) as Long + } + + @Throws(ValidationException::class) + fun validate(arg: Float, configuration: SchemaConfiguration?): Float { + return validate(arg as Number, configuration) as Float + } + + @Throws(ValidationException::class) + fun validate(arg: Double, configuration: SchemaConfiguration?): Double { + return validate(arg as Number, configuration) as Double + } + + @Throws(ValidationException::class) + override fun validate(arg: String, configuration: SchemaConfiguration?): String { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validatedPathToSchemas = PathToSchemasMap() + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, LinkedHashSet()) + getPathToSchemas(this, castArg, validationMetadata, pathSet) + return castArg + } + + @Throws(ValidationException::class) + fun validate(arg: LocalDate, configuration: SchemaConfiguration?): String { + return validate(arg.toString(), configuration) + } + + @Throws(ValidationException::class) + fun validate(arg: ZonedDateTime, configuration: SchemaConfiguration?): String { + return validate(arg.toString(), configuration) + } + + @Throws(ValidationException::class) + fun validate(arg: UUID, configuration: SchemaConfiguration?): String { + return validate(arg.toString(), configuration) + } + + override fun getNewInstance(arg: List<*>, pathToItem: List, pathToSchemas: PathToSchemasMap): FrozenList { + val items: MutableList = ArrayList() + var i: Int = 0 + for (item: Any? in arg) { + val itemPathToItem = pathToItem + i + val schemas: LinkedHashMap, Nothing?>? = pathToSchemas.get(itemPathToItem) + if (schemas == null) { + throw RuntimeException("Validation result is invalid, schemas must exist for a pathToItem") + } + val itemSchema: JsonSchema<*> = schemas.entries.iterator().next().key + val itemInstance: Any? = itemSchema.getNewInstance(item, itemPathToItem, pathToSchemas) + items.add(itemInstance) + i += 1 + } + val newInstanceItems: FrozenList = FrozenList(items) + return newInstanceItems + } + + @Throws(ValidationException::class) + override fun validate(arg: List<*>, configuration: SchemaConfiguration?): FrozenList { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, PathToSchemasMap(), LinkedHashSet()) + val pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet) + return getNewInstance(castArg, validationMetadata.pathToItem, pathToSchemasMap) + } + + override fun getNewInstance(arg: Map<*, *>, pathToItem: List, pathToSchemas: PathToSchemasMap): FrozenMap { + val properties: LinkedHashMap = LinkedHashMap() + for((propertyName, value) in arg) { + if (!(propertyName is String)) { + throw RuntimeException("Invalid non-string key value") + } + val propertyPathToItem: List = pathToItem + propertyName + val schemas: LinkedHashMap, Nothing?>? = pathToSchemas.get(propertyPathToItem) + if (schemas == null) { + throw RuntimeException("Validation result is invalid, schemas must exist for a pathToItem") + } + val propertySchema: JsonSchema<*> = schemas.entries.iterator().next().key + val propertyInstance: Any? = propertySchema.getNewInstance(value, propertyPathToItem, pathToSchemas) + properties[propertyName] = propertyInstance + } + val castProperties: FrozenMap = FrozenMap(properties) + return castProperties + } + + @Throws(ValidationException::class) + override fun validate(arg: Map<*, *>, configuration: SchemaConfiguration?): FrozenMap { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validatedPathToSchemas = PathToSchemasMap() + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, LinkedHashSet()) + val pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet) + return getNewInstance(castArg, validationMetadata.pathToItem, pathToSchemasMap) + } + + @Throws(ValidationException::class) + override fun validate(arg: Any?, configuration: SchemaConfiguration?): Any? { + if (arg == null) { + return validate(null, configuration) + } else if (arg is Boolean) { + return validate(arg, configuration) + } else if (arg is Number) { + return validate(arg, configuration) + } else if (arg is String) { + return validate(arg, configuration) + } else if (arg is List<*>) { + return validate(arg, configuration) + } else if (arg is Map<*, *>) { + return validate(arg, configuration) + } + throw ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema") + } + override fun getNewInstance(arg: Any?, pathToItem: List, pathToSchemas: PathToSchemasMap): Any? { + if (arg == null) { + return getNewInstance( null, pathToItem, pathToSchemas) + } else if (arg is Boolean) { + return getNewInstance(arg, pathToItem, pathToSchemas) + } else if (arg is Number) { + return getNewInstance(arg, pathToItem, pathToSchemas) + } else if (arg is String) { + return getNewInstance(arg, pathToItem, pathToSchemas) + } else if (arg is List<*>) { + return getNewInstance(arg, pathToItem, pathToSchemas) + } else if (arg is Map<*, *>) { + return getNewInstance(arg, pathToItem, pathToSchemas) + } + throw RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema") + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: Nothing?, configuration: SchemaConfiguration?): Schema0BoxedVoid { + return Schema0BoxedVoid(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: Boolean, configuration: SchemaConfiguration?): Schema0BoxedBoolean { + return Schema0BoxedBoolean(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: Number, configuration: SchemaConfiguration?): Schema0BoxedNumber { + return Schema0BoxedNumber(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: String, configuration: SchemaConfiguration?): Schema0BoxedString { + return Schema0BoxedString(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: List<*>, configuration: SchemaConfiguration?): Schema0BoxedList { + return Schema0BoxedList(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: Map<*, *>, configuration: SchemaConfiguration?): Schema0BoxedMap { + return Schema0BoxedMap(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: Any?, configuration: SchemaConfiguration?): Schema0Boxed { + if (arg == null) { + return validateAndBox(null, configuration) + } else if (arg is Boolean) { + return validateAndBox(arg, configuration) + } else if (arg is String) { + return validateAndBox(arg, configuration) + } else if (arg is Number) { + return validateAndBox(arg, configuration) + } else if (arg is List<*>) { + return validateAndBox(arg, configuration) + } else if (arg is Map<*, *>) { + return validateAndBox(arg, configuration) + } + throw ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema") + } + } + + sealed interface Schema1Boxed { + fun getData(): Any? + } + + data class Schema1BoxedVoid(val data: Nothing?) : Schema1Boxed { + override fun getData(): Any? { + return data + } + } + + data class Schema1BoxedBoolean(val data: Boolean): Schema1Boxed { + override fun getData(): Any? { + return data + } + } + + data class Schema1BoxedNumber(val data: Number) : Schema1Boxed { + override fun getData(): Any? { + return data + } + } + + data class Schema1BoxedString(val data: String) : Schema1Boxed { + override fun getData(): Any? { + return data + } + } + + data class Schema1BoxedList(val data: FrozenList) : Schema1Boxed { + override fun getData(): Any? { + return data + } + } + + data class Schema1BoxedMap(val data: FrozenMap) : Schema1Boxed { + override fun getData(): Any? { + return data + } + } + + + class Schema1 private constructor(): JsonSchema( + JsonSchemaInfo() + .minimum(20) + ), NullSchemaValidator, BooleanSchemaValidator, NumberSchemaValidator, StringSchemaValidator, ListSchemaValidator, Schema1BoxedList>, MapSchemaValidator, Schema1BoxedMap> { + + companion object { + @Volatile + private var instance: Schema1? = null + + fun getInstance() = + instance ?: synchronized(this) { + instance ?: Schema1().also { instance = it } + } + } + + @Throws(ValidationException::class) + override fun validate(arg: Nothing?, configuration: SchemaConfiguration?): Nothing? { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validatedPathToSchemas = PathToSchemasMap() + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, LinkedHashSet()) + getPathToSchemas(this, castArg, validationMetadata, pathSet) + return castArg + } + + @Throws(ValidationException::class) + override fun validate(arg: Boolean, configuration: SchemaConfiguration?): Boolean { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validatedPathToSchemas = PathToSchemasMap() + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, LinkedHashSet()) + getPathToSchemas(this, castArg, validationMetadata, pathSet) + return castArg + } + + @Throws(ValidationException::class) + override fun validate(arg: Number, configuration: SchemaConfiguration?): Number { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validatedPathToSchemas = PathToSchemasMap() + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, LinkedHashSet()) + getPathToSchemas(this, castArg, validationMetadata, pathSet) + return castArg + } + + @Throws(ValidationException::class) + fun validate(arg: Int, configuration: SchemaConfiguration?): Int { + return validate(arg as Number, configuration) as Int + } + + @Throws(ValidationException::class) + fun validate(arg: Long, configuration: SchemaConfiguration?): Long { + return validate(arg as Number, configuration) as Long + } + + @Throws(ValidationException::class) + fun validate(arg: Float, configuration: SchemaConfiguration?): Float { + return validate(arg as Number, configuration) as Float + } + + @Throws(ValidationException::class) + fun validate(arg: Double, configuration: SchemaConfiguration?): Double { + return validate(arg as Number, configuration) as Double + } + + @Throws(ValidationException::class) + override fun validate(arg: String, configuration: SchemaConfiguration?): String { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validatedPathToSchemas = PathToSchemasMap() + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, LinkedHashSet()) + getPathToSchemas(this, castArg, validationMetadata, pathSet) + return castArg + } + + @Throws(ValidationException::class) + fun validate(arg: LocalDate, configuration: SchemaConfiguration?): String { + return validate(arg.toString(), configuration) + } + + @Throws(ValidationException::class) + fun validate(arg: ZonedDateTime, configuration: SchemaConfiguration?): String { + return validate(arg.toString(), configuration) + } + + @Throws(ValidationException::class) + fun validate(arg: UUID, configuration: SchemaConfiguration?): String { + return validate(arg.toString(), configuration) + } + + override fun getNewInstance(arg: List<*>, pathToItem: List, pathToSchemas: PathToSchemasMap): FrozenList { + val items: MutableList = ArrayList() + var i: Int = 0 + for (item: Any? in arg) { + val itemPathToItem = pathToItem + i + val schemas: LinkedHashMap, Nothing?>? = pathToSchemas.get(itemPathToItem) + if (schemas == null) { + throw RuntimeException("Validation result is invalid, schemas must exist for a pathToItem") + } + val itemSchema: JsonSchema<*> = schemas.entries.iterator().next().key + val itemInstance: Any? = itemSchema.getNewInstance(item, itemPathToItem, pathToSchemas) + items.add(itemInstance) + i += 1 + } + val newInstanceItems: FrozenList = FrozenList(items) + return newInstanceItems + } + + @Throws(ValidationException::class) + override fun validate(arg: List<*>, configuration: SchemaConfiguration?): FrozenList { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, PathToSchemasMap(), LinkedHashSet()) + val pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet) + return getNewInstance(castArg, validationMetadata.pathToItem, pathToSchemasMap) + } + + override fun getNewInstance(arg: Map<*, *>, pathToItem: List, pathToSchemas: PathToSchemasMap): FrozenMap { + val properties: LinkedHashMap = LinkedHashMap() + for((propertyName, value) in arg) { + if (!(propertyName is String)) { + throw RuntimeException("Invalid non-string key value") + } + val propertyPathToItem: List = pathToItem + propertyName + val schemas: LinkedHashMap, Nothing?>? = pathToSchemas.get(propertyPathToItem) + if (schemas == null) { + throw RuntimeException("Validation result is invalid, schemas must exist for a pathToItem") + } + val propertySchema: JsonSchema<*> = schemas.entries.iterator().next().key + val propertyInstance: Any? = propertySchema.getNewInstance(value, propertyPathToItem, pathToSchemas) + properties[propertyName] = propertyInstance + } + val castProperties: FrozenMap = FrozenMap(properties) + return castProperties + } + + @Throws(ValidationException::class) + override fun validate(arg: Map<*, *>, configuration: SchemaConfiguration?): FrozenMap { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validatedPathToSchemas = PathToSchemasMap() + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, LinkedHashSet()) + val pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet) + return getNewInstance(castArg, validationMetadata.pathToItem, pathToSchemasMap) + } + + @Throws(ValidationException::class) + override fun validate(arg: Any?, configuration: SchemaConfiguration?): Any? { + if (arg == null) { + return validate(null, configuration) + } else if (arg is Boolean) { + return validate(arg, configuration) + } else if (arg is Number) { + return validate(arg, configuration) + } else if (arg is String) { + return validate(arg, configuration) + } else if (arg is List<*>) { + return validate(arg, configuration) + } else if (arg is Map<*, *>) { + return validate(arg, configuration) + } + throw ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema") + } + override fun getNewInstance(arg: Any?, pathToItem: List, pathToSchemas: PathToSchemasMap): Any? { + if (arg == null) { + return getNewInstance( null, pathToItem, pathToSchemas) + } else if (arg is Boolean) { + return getNewInstance(arg, pathToItem, pathToSchemas) + } else if (arg is Number) { + return getNewInstance(arg, pathToItem, pathToSchemas) + } else if (arg is String) { + return getNewInstance(arg, pathToItem, pathToSchemas) + } else if (arg is List<*>) { + return getNewInstance(arg, pathToItem, pathToSchemas) + } else if (arg is Map<*, *>) { + return getNewInstance(arg, pathToItem, pathToSchemas) + } + throw RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema") + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: Nothing?, configuration: SchemaConfiguration?): Schema1BoxedVoid { + return Schema1BoxedVoid(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: Boolean, configuration: SchemaConfiguration?): Schema1BoxedBoolean { + return Schema1BoxedBoolean(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: Number, configuration: SchemaConfiguration?): Schema1BoxedNumber { + return Schema1BoxedNumber(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: String, configuration: SchemaConfiguration?): Schema1BoxedString { + return Schema1BoxedString(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: List<*>, configuration: SchemaConfiguration?): Schema1BoxedList { + return Schema1BoxedList(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: Map<*, *>, configuration: SchemaConfiguration?): Schema1BoxedMap { + return Schema1BoxedMap(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: Any?, configuration: SchemaConfiguration?): Schema1Boxed { + if (arg == null) { + return validateAndBox(null, configuration) + } else if (arg is Boolean) { + return validateAndBox(arg, configuration) + } else if (arg is String) { + return validateAndBox(arg, configuration) + } else if (arg is Number) { + return validateAndBox(arg, configuration) + } else if (arg is List<*>) { + return validateAndBox(arg, configuration) + } else if (arg is Map<*, *>) { + return validateAndBox(arg, configuration) + } + throw ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema") + } + } + + sealed interface AllofSimpleTypes1Boxed { + fun getData(): Any? + } + + data class AllofSimpleTypes1BoxedVoid(val data: Nothing?) : AllofSimpleTypes1Boxed { + override fun getData(): Any? { + return data + } + } + + data class AllofSimpleTypes1BoxedBoolean(val data: Boolean): AllofSimpleTypes1Boxed { + override fun getData(): Any? { + return data + } + } + + data class AllofSimpleTypes1BoxedNumber(val data: Number) : AllofSimpleTypes1Boxed { + override fun getData(): Any? { + return data + } + } + + data class AllofSimpleTypes1BoxedString(val data: String) : AllofSimpleTypes1Boxed { + override fun getData(): Any? { + return data + } + } + + data class AllofSimpleTypes1BoxedList(val data: FrozenList) : AllofSimpleTypes1Boxed { + override fun getData(): Any? { + return data + } + } + + data class AllofSimpleTypes1BoxedMap(val data: FrozenMap) : AllofSimpleTypes1Boxed { + override fun getData(): Any? { + return data + } + } + + + class AllofSimpleTypes1 private constructor(): JsonSchema( + JsonSchemaInfo() + .allOf(listOf( + Schema0::class.java, + Schema1::class.java + )) + ), NullSchemaValidator, BooleanSchemaValidator, NumberSchemaValidator, StringSchemaValidator, ListSchemaValidator, AllofSimpleTypes1BoxedList>, MapSchemaValidator, AllofSimpleTypes1BoxedMap> { + /* + NOTE: This class is auto generated by OpenAPI JSON Schema Generator. + Ref: https://github.com/openapi-json-schema-tools/openapi-json-schema-generator + + Do not edit the class manually. + */ + + companion object { + @Volatile + private var instance: AllofSimpleTypes1? = null + + fun getInstance() = + instance ?: synchronized(this) { + instance ?: AllofSimpleTypes1().also { instance = it } + } + } + + @Throws(ValidationException::class) + override fun validate(arg: Nothing?, configuration: SchemaConfiguration?): Nothing? { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validatedPathToSchemas = PathToSchemasMap() + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, LinkedHashSet()) + getPathToSchemas(this, castArg, validationMetadata, pathSet) + return castArg + } + + @Throws(ValidationException::class) + override fun validate(arg: Boolean, configuration: SchemaConfiguration?): Boolean { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validatedPathToSchemas = PathToSchemasMap() + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, LinkedHashSet()) + getPathToSchemas(this, castArg, validationMetadata, pathSet) + return castArg + } + + @Throws(ValidationException::class) + override fun validate(arg: Number, configuration: SchemaConfiguration?): Number { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validatedPathToSchemas = PathToSchemasMap() + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, LinkedHashSet()) + getPathToSchemas(this, castArg, validationMetadata, pathSet) + return castArg + } + + @Throws(ValidationException::class) + fun validate(arg: Int, configuration: SchemaConfiguration?): Int { + return validate(arg as Number, configuration) as Int + } + + @Throws(ValidationException::class) + fun validate(arg: Long, configuration: SchemaConfiguration?): Long { + return validate(arg as Number, configuration) as Long + } + + @Throws(ValidationException::class) + fun validate(arg: Float, configuration: SchemaConfiguration?): Float { + return validate(arg as Number, configuration) as Float + } + + @Throws(ValidationException::class) + fun validate(arg: Double, configuration: SchemaConfiguration?): Double { + return validate(arg as Number, configuration) as Double + } + + @Throws(ValidationException::class) + override fun validate(arg: String, configuration: SchemaConfiguration?): String { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validatedPathToSchemas = PathToSchemasMap() + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, LinkedHashSet()) + getPathToSchemas(this, castArg, validationMetadata, pathSet) + return castArg + } + + @Throws(ValidationException::class) + fun validate(arg: LocalDate, configuration: SchemaConfiguration?): String { + return validate(arg.toString(), configuration) + } + + @Throws(ValidationException::class) + fun validate(arg: ZonedDateTime, configuration: SchemaConfiguration?): String { + return validate(arg.toString(), configuration) + } + + @Throws(ValidationException::class) + fun validate(arg: UUID, configuration: SchemaConfiguration?): String { + return validate(arg.toString(), configuration) + } + + override fun getNewInstance(arg: List<*>, pathToItem: List, pathToSchemas: PathToSchemasMap): FrozenList { + val items: MutableList = ArrayList() + var i: Int = 0 + for (item: Any? in arg) { + val itemPathToItem = pathToItem + i + val schemas: LinkedHashMap, Nothing?>? = pathToSchemas.get(itemPathToItem) + if (schemas == null) { + throw RuntimeException("Validation result is invalid, schemas must exist for a pathToItem") + } + val itemSchema: JsonSchema<*> = schemas.entries.iterator().next().key + val itemInstance: Any? = itemSchema.getNewInstance(item, itemPathToItem, pathToSchemas) + items.add(itemInstance) + i += 1 + } + val newInstanceItems: FrozenList = FrozenList(items) + return newInstanceItems + } + + @Throws(ValidationException::class) + override fun validate(arg: List<*>, configuration: SchemaConfiguration?): FrozenList { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, PathToSchemasMap(), LinkedHashSet()) + val pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet) + return getNewInstance(castArg, validationMetadata.pathToItem, pathToSchemasMap) + } + + override fun getNewInstance(arg: Map<*, *>, pathToItem: List, pathToSchemas: PathToSchemasMap): FrozenMap { + val properties: LinkedHashMap = LinkedHashMap() + for((propertyName, value) in arg) { + if (!(propertyName is String)) { + throw RuntimeException("Invalid non-string key value") + } + val propertyPathToItem: List = pathToItem + propertyName + val schemas: LinkedHashMap, Nothing?>? = pathToSchemas.get(propertyPathToItem) + if (schemas == null) { + throw RuntimeException("Validation result is invalid, schemas must exist for a pathToItem") + } + val propertySchema: JsonSchema<*> = schemas.entries.iterator().next().key + val propertyInstance: Any? = propertySchema.getNewInstance(value, propertyPathToItem, pathToSchemas) + properties[propertyName] = propertyInstance + } + val castProperties: FrozenMap = FrozenMap(properties) + return castProperties + } + + @Throws(ValidationException::class) + override fun validate(arg: Map<*, *>, configuration: SchemaConfiguration?): FrozenMap { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validatedPathToSchemas = PathToSchemasMap() + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, LinkedHashSet()) + val pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet) + return getNewInstance(castArg, validationMetadata.pathToItem, pathToSchemasMap) + } + + @Throws(ValidationException::class) + override fun validate(arg: Any?, configuration: SchemaConfiguration?): Any? { + if (arg == null) { + return validate(null, configuration) + } else if (arg is Boolean) { + return validate(arg, configuration) + } else if (arg is Number) { + return validate(arg, configuration) + } else if (arg is String) { + return validate(arg, configuration) + } else if (arg is List<*>) { + return validate(arg, configuration) + } else if (arg is Map<*, *>) { + return validate(arg, configuration) + } + throw ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema") + } + override fun getNewInstance(arg: Any?, pathToItem: List, pathToSchemas: PathToSchemasMap): Any? { + if (arg == null) { + return getNewInstance( null, pathToItem, pathToSchemas) + } else if (arg is Boolean) { + return getNewInstance(arg, pathToItem, pathToSchemas) + } else if (arg is Number) { + return getNewInstance(arg, pathToItem, pathToSchemas) + } else if (arg is String) { + return getNewInstance(arg, pathToItem, pathToSchemas) + } else if (arg is List<*>) { + return getNewInstance(arg, pathToItem, pathToSchemas) + } else if (arg is Map<*, *>) { + return getNewInstance(arg, pathToItem, pathToSchemas) + } + throw RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema") + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: Nothing?, configuration: SchemaConfiguration?): AllofSimpleTypes1BoxedVoid { + return AllofSimpleTypes1BoxedVoid(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: Boolean, configuration: SchemaConfiguration?): AllofSimpleTypes1BoxedBoolean { + return AllofSimpleTypes1BoxedBoolean(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: Number, configuration: SchemaConfiguration?): AllofSimpleTypes1BoxedNumber { + return AllofSimpleTypes1BoxedNumber(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: String, configuration: SchemaConfiguration?): AllofSimpleTypes1BoxedString { + return AllofSimpleTypes1BoxedString(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: List<*>, configuration: SchemaConfiguration?): AllofSimpleTypes1BoxedList { + return AllofSimpleTypes1BoxedList(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: Map<*, *>, configuration: SchemaConfiguration?): AllofSimpleTypes1BoxedMap { + return AllofSimpleTypes1BoxedMap(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: Any?, configuration: SchemaConfiguration?): AllofSimpleTypes1Boxed { + if (arg == null) { + return validateAndBox(null, configuration) + } else if (arg is Boolean) { + return validateAndBox(arg, configuration) + } else if (arg is String) { + return validateAndBox(arg, configuration) + } else if (arg is Number) { + return validateAndBox(arg, configuration) + } else if (arg is List<*>) { + return validateAndBox(arg, configuration) + } else if (arg is Map<*, *>) { + return validateAndBox(arg, configuration) + } + throw ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema") + } + } +} diff --git a/samples/client/3_1_0_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/schemas/AllofWithBaseSchema.kt b/samples/client/3_1_0_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/schemas/AllofWithBaseSchema.kt new file mode 100644 index 00000000000..434a6b3cac3 --- /dev/null +++ b/samples/client/3_1_0_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/schemas/AllofWithBaseSchema.kt @@ -0,0 +1,1151 @@ +package org.openapijsonschematools.client.components.schemas +import java.time.LocalDate +import java.time.ZonedDateTime +import java.util.UUID +import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags +import org.openapijsonschematools.client.configurations.SchemaConfiguration +import org.openapijsonschematools.client.exceptions.InvalidAdditionalPropertyException +import org.openapijsonschematools.client.exceptions.UnsetPropertyException +import org.openapijsonschematools.client.exceptions.ValidationException +import org.openapijsonschematools.client.schemas.GenericBuilder +import org.openapijsonschematools.client.schemas.IntJsonSchema +import org.openapijsonschematools.client.schemas.NullJsonSchema +import org.openapijsonschematools.client.schemas.StringJsonSchema +import org.openapijsonschematools.client.schemas.UnsetAddPropsSetter +import org.openapijsonschematools.client.schemas.validation.BooleanSchemaValidator +import org.openapijsonschematools.client.schemas.validation.FrozenList +import org.openapijsonschematools.client.schemas.validation.FrozenMap +import org.openapijsonschematools.client.schemas.validation.JsonSchema +import org.openapijsonschematools.client.schemas.validation.JsonSchemaInfo +import org.openapijsonschematools.client.schemas.validation.ListSchemaValidator +import org.openapijsonschematools.client.schemas.validation.MapSchemaValidator +import org.openapijsonschematools.client.schemas.validation.NullSchemaValidator +import org.openapijsonschematools.client.schemas.validation.NumberSchemaValidator +import org.openapijsonschematools.client.schemas.validation.PathToSchemasMap +import org.openapijsonschematools.client.schemas.validation.StringSchemaValidator +import org.openapijsonschematools.client.schemas.validation.ValidationMetadata + +class AllofWithBaseSchema { + // nest classes so all schemas and input/output classes can be public + + + class Foo : StringJsonSchema.StringJsonSchema1() { + companion object { + @Volatile + private var instance: Foo? = null + + fun getInstance() = + instance ?: synchronized(this) { + instance ?: Foo().also { instance = it } + } + } + } + + + class Schema0Map(m: FrozenMap) : FrozenMap(m) { + companion object { + val requiredKeys: Set = setOf( + "foo" + ) + val optionalKeys: Set = setOf() + @Throws(ValidationException::class) + fun of(arg: Map, configuration: SchemaConfiguration): Schema0Map { + return Schema0.getInstance().validate(arg, configuration) + } + } + + fun foo(): String { + val value: Any? = get("foo") + if (!(value is String)) { + throw RuntimeException("Invalid value stored for foo") + } + return value + } + + @Throws(UnsetPropertyException::class, InvalidAdditionalPropertyException::class) + fun getAdditionalProperty(name: String): Any? { + throwIfKeyKnown(name, requiredKeys, optionalKeys) + throwIfKeyNotPresent(name) + return get(name) + } + } + + interface SetterForFoo { + fun getInstance(): MutableMap + fun getBuilderAfterFoo(instance: MutableMap): T + + fun foo(value: String): T { + val instance = getInstance() + instance["foo"] = value + return getBuilderAfterFoo(instance) + } + } + + class Schema0Map0Builder(private val instance: MutableMap): UnsetAddPropsSetter, GenericBuilder> { + private val knownKeys: Set = setOf( + "foo" + ) + override fun getKnownKeys(): Set { + return knownKeys + } + override fun build(): Map { + return instance + } + override fun getInstance(): MutableMap { + return instance + } + override fun getBuilderAfterAdditionalProperty(instance: MutableMap): Schema0Map0Builder { + return this + } + } + + class Schema0MapBuilder: SetterForFoo { + private val instance: MutableMap + init { + this.instance = LinkedHashMap() + } + override fun getInstance(): MutableMap { + return instance + } + override fun getBuilderAfterFoo(instance: MutableMap): Schema0Map0Builder { + return Schema0Map0Builder(instance) + } + } + + + sealed interface Schema0Boxed { + fun getData(): Any? + } + + data class Schema0BoxedVoid(val data: Nothing?) : Schema0Boxed { + override fun getData(): Any? { + return data + } + } + + data class Schema0BoxedBoolean(val data: Boolean): Schema0Boxed { + override fun getData(): Any? { + return data + } + } + + data class Schema0BoxedNumber(val data: Number) : Schema0Boxed { + override fun getData(): Any? { + return data + } + } + + data class Schema0BoxedString(val data: String) : Schema0Boxed { + override fun getData(): Any? { + return data + } + } + + data class Schema0BoxedList(val data: FrozenList) : Schema0Boxed { + override fun getData(): Any? { + return data + } + } + + data class Schema0BoxedMap(val data: Schema0Map) : Schema0Boxed { + override fun getData(): Any? { + return data + } + } + + + class Schema0 private constructor(): JsonSchema( + JsonSchemaInfo() + .properties(mapOf( + "foo" to Foo::class.java + )) + .required(setOf( + "foo" + )) + ), NullSchemaValidator, BooleanSchemaValidator, NumberSchemaValidator, StringSchemaValidator, ListSchemaValidator, Schema0BoxedList>, MapSchemaValidator { + + companion object { + @Volatile + private var instance: Schema0? = null + + fun getInstance() = + instance ?: synchronized(this) { + instance ?: Schema0().also { instance = it } + } + } + + @Throws(ValidationException::class) + override fun validate(arg: Nothing?, configuration: SchemaConfiguration?): Nothing? { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validatedPathToSchemas = PathToSchemasMap() + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, LinkedHashSet()) + getPathToSchemas(this, castArg, validationMetadata, pathSet) + return castArg + } + + @Throws(ValidationException::class) + override fun validate(arg: Boolean, configuration: SchemaConfiguration?): Boolean { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validatedPathToSchemas = PathToSchemasMap() + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, LinkedHashSet()) + getPathToSchemas(this, castArg, validationMetadata, pathSet) + return castArg + } + + @Throws(ValidationException::class) + override fun validate(arg: Number, configuration: SchemaConfiguration?): Number { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validatedPathToSchemas = PathToSchemasMap() + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, LinkedHashSet()) + getPathToSchemas(this, castArg, validationMetadata, pathSet) + return castArg + } + + @Throws(ValidationException::class) + fun validate(arg: Int, configuration: SchemaConfiguration?): Int { + return validate(arg as Number, configuration) as Int + } + + @Throws(ValidationException::class) + fun validate(arg: Long, configuration: SchemaConfiguration?): Long { + return validate(arg as Number, configuration) as Long + } + + @Throws(ValidationException::class) + fun validate(arg: Float, configuration: SchemaConfiguration?): Float { + return validate(arg as Number, configuration) as Float + } + + @Throws(ValidationException::class) + fun validate(arg: Double, configuration: SchemaConfiguration?): Double { + return validate(arg as Number, configuration) as Double + } + + @Throws(ValidationException::class) + override fun validate(arg: String, configuration: SchemaConfiguration?): String { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validatedPathToSchemas = PathToSchemasMap() + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, LinkedHashSet()) + getPathToSchemas(this, castArg, validationMetadata, pathSet) + return castArg + } + + @Throws(ValidationException::class) + fun validate(arg: LocalDate, configuration: SchemaConfiguration?): String { + return validate(arg.toString(), configuration) + } + + @Throws(ValidationException::class) + fun validate(arg: ZonedDateTime, configuration: SchemaConfiguration?): String { + return validate(arg.toString(), configuration) + } + + @Throws(ValidationException::class) + fun validate(arg: UUID, configuration: SchemaConfiguration?): String { + return validate(arg.toString(), configuration) + } + + override fun getNewInstance(arg: List<*>, pathToItem: List, pathToSchemas: PathToSchemasMap): FrozenList { + val items: MutableList = ArrayList() + var i: Int = 0 + for (item: Any? in arg) { + val itemPathToItem = pathToItem + i + val schemas: LinkedHashMap, Nothing?>? = pathToSchemas.get(itemPathToItem) + if (schemas == null) { + throw RuntimeException("Validation result is invalid, schemas must exist for a pathToItem") + } + val itemSchema: JsonSchema<*> = schemas.entries.iterator().next().key + val itemInstance: Any? = itemSchema.getNewInstance(item, itemPathToItem, pathToSchemas) + items.add(itemInstance) + i += 1 + } + val newInstanceItems: FrozenList = FrozenList(items) + return newInstanceItems + } + + @Throws(ValidationException::class) + override fun validate(arg: List<*>, configuration: SchemaConfiguration?): FrozenList { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, PathToSchemasMap(), LinkedHashSet()) + val pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet) + return getNewInstance(castArg, validationMetadata.pathToItem, pathToSchemasMap) + } + + override fun getNewInstance(arg: Map<*, *>, pathToItem: List, pathToSchemas: PathToSchemasMap): Schema0Map { + val properties: LinkedHashMap = LinkedHashMap() + for((propertyName, value) in arg) { + if (!(propertyName is String)) { + throw RuntimeException("Invalid non-string key value") + } + val propertyPathToItem: List = pathToItem + propertyName + val schemas: LinkedHashMap, Nothing?>? = pathToSchemas.get(propertyPathToItem) + if (schemas == null) { + throw RuntimeException("Validation result is invalid, schemas must exist for a pathToItem") + } + val propertySchema: JsonSchema<*> = schemas.entries.iterator().next().key + val propertyInstance: Any? = propertySchema.getNewInstance(value, propertyPathToItem, pathToSchemas) + properties[propertyName] = propertyInstance + } + val castProperties: FrozenMap = FrozenMap(properties) + return Schema0Map(castProperties) + } + + @Throws(ValidationException::class) + override fun validate(arg: Map<*, *>, configuration: SchemaConfiguration?): Schema0Map { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validatedPathToSchemas = PathToSchemasMap() + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, LinkedHashSet()) + val pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet) + return getNewInstance(castArg, validationMetadata.pathToItem, pathToSchemasMap) + } + + @Throws(ValidationException::class) + override fun validate(arg: Any?, configuration: SchemaConfiguration?): Any? { + if (arg == null) { + return validate(null, configuration) + } else if (arg is Boolean) { + return validate(arg, configuration) + } else if (arg is Number) { + return validate(arg, configuration) + } else if (arg is String) { + return validate(arg, configuration) + } else if (arg is List<*>) { + return validate(arg, configuration) + } else if (arg is Map<*, *>) { + return validate(arg, configuration) + } + throw ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema") + } + override fun getNewInstance(arg: Any?, pathToItem: List, pathToSchemas: PathToSchemasMap): Any? { + if (arg == null) { + return getNewInstance( null, pathToItem, pathToSchemas) + } else if (arg is Boolean) { + return getNewInstance(arg, pathToItem, pathToSchemas) + } else if (arg is Number) { + return getNewInstance(arg, pathToItem, pathToSchemas) + } else if (arg is String) { + return getNewInstance(arg, pathToItem, pathToSchemas) + } else if (arg is List<*>) { + return getNewInstance(arg, pathToItem, pathToSchemas) + } else if (arg is Map<*, *>) { + return getNewInstance(arg, pathToItem, pathToSchemas) + } + throw RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema") + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: Nothing?, configuration: SchemaConfiguration?): Schema0BoxedVoid { + return Schema0BoxedVoid(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: Boolean, configuration: SchemaConfiguration?): Schema0BoxedBoolean { + return Schema0BoxedBoolean(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: Number, configuration: SchemaConfiguration?): Schema0BoxedNumber { + return Schema0BoxedNumber(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: String, configuration: SchemaConfiguration?): Schema0BoxedString { + return Schema0BoxedString(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: List<*>, configuration: SchemaConfiguration?): Schema0BoxedList { + return Schema0BoxedList(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: Map<*, *>, configuration: SchemaConfiguration?): Schema0BoxedMap { + return Schema0BoxedMap(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: Any?, configuration: SchemaConfiguration?): Schema0Boxed { + if (arg == null) { + return validateAndBox(null, configuration) + } else if (arg is Boolean) { + return validateAndBox(arg, configuration) + } else if (arg is String) { + return validateAndBox(arg, configuration) + } else if (arg is Number) { + return validateAndBox(arg, configuration) + } else if (arg is List<*>) { + return validateAndBox(arg, configuration) + } else if (arg is Map<*, *>) { + return validateAndBox(arg, configuration) + } + throw ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema") + } + } + + class Baz : NullJsonSchema.NullJsonSchema1() { + companion object { + @Volatile + private var instance: Baz? = null + + fun getInstance() = + instance ?: synchronized(this) { + instance ?: Baz().also { instance = it } + } + } + } + + + class Schema1Map(m: FrozenMap) : FrozenMap(m) { + companion object { + val requiredKeys: Set = setOf( + "baz" + ) + val optionalKeys: Set = setOf() + @Throws(ValidationException::class) + fun of(arg: Map, configuration: SchemaConfiguration): Schema1Map { + return Schema1.getInstance().validate(arg, configuration) + } + } + + fun baz(): Nothing? { + val value: Any? = get("baz") + if (!(value == null || value is Nothing?)) { + throw RuntimeException("Invalid value stored for baz") + } + return value + } + + @Throws(UnsetPropertyException::class, InvalidAdditionalPropertyException::class) + fun getAdditionalProperty(name: String): Any? { + throwIfKeyKnown(name, requiredKeys, optionalKeys) + throwIfKeyNotPresent(name) + return get(name) + } + } + + interface SetterForBaz { + fun getInstance(): MutableMap + fun getBuilderAfterBaz(instance: MutableMap): T + + fun baz(value: Nothing?): T { + val instance = getInstance() + instance["baz"] = null + return getBuilderAfterBaz(instance) + } + } + + class Schema1Map0Builder(private val instance: MutableMap): UnsetAddPropsSetter, GenericBuilder> { + private val knownKeys: Set = setOf( + "baz" + ) + override fun getKnownKeys(): Set { + return knownKeys + } + override fun build(): Map { + return instance + } + override fun getInstance(): MutableMap { + return instance + } + override fun getBuilderAfterAdditionalProperty(instance: MutableMap): Schema1Map0Builder { + return this + } + } + + class Schema1MapBuilder: SetterForBaz { + private val instance: MutableMap + init { + this.instance = LinkedHashMap() + } + override fun getInstance(): MutableMap { + return instance + } + override fun getBuilderAfterBaz(instance: MutableMap): Schema1Map0Builder { + return Schema1Map0Builder(instance) + } + } + + + sealed interface Schema1Boxed { + fun getData(): Any? + } + + data class Schema1BoxedVoid(val data: Nothing?) : Schema1Boxed { + override fun getData(): Any? { + return data + } + } + + data class Schema1BoxedBoolean(val data: Boolean): Schema1Boxed { + override fun getData(): Any? { + return data + } + } + + data class Schema1BoxedNumber(val data: Number) : Schema1Boxed { + override fun getData(): Any? { + return data + } + } + + data class Schema1BoxedString(val data: String) : Schema1Boxed { + override fun getData(): Any? { + return data + } + } + + data class Schema1BoxedList(val data: FrozenList) : Schema1Boxed { + override fun getData(): Any? { + return data + } + } + + data class Schema1BoxedMap(val data: Schema1Map) : Schema1Boxed { + override fun getData(): Any? { + return data + } + } + + + class Schema1 private constructor(): JsonSchema( + JsonSchemaInfo() + .properties(mapOf( + "baz" to Baz::class.java + )) + .required(setOf( + "baz" + )) + ), NullSchemaValidator, BooleanSchemaValidator, NumberSchemaValidator, StringSchemaValidator, ListSchemaValidator, Schema1BoxedList>, MapSchemaValidator { + + companion object { + @Volatile + private var instance: Schema1? = null + + fun getInstance() = + instance ?: synchronized(this) { + instance ?: Schema1().also { instance = it } + } + } + + @Throws(ValidationException::class) + override fun validate(arg: Nothing?, configuration: SchemaConfiguration?): Nothing? { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validatedPathToSchemas = PathToSchemasMap() + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, LinkedHashSet()) + getPathToSchemas(this, castArg, validationMetadata, pathSet) + return castArg + } + + @Throws(ValidationException::class) + override fun validate(arg: Boolean, configuration: SchemaConfiguration?): Boolean { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validatedPathToSchemas = PathToSchemasMap() + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, LinkedHashSet()) + getPathToSchemas(this, castArg, validationMetadata, pathSet) + return castArg + } + + @Throws(ValidationException::class) + override fun validate(arg: Number, configuration: SchemaConfiguration?): Number { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validatedPathToSchemas = PathToSchemasMap() + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, LinkedHashSet()) + getPathToSchemas(this, castArg, validationMetadata, pathSet) + return castArg + } + + @Throws(ValidationException::class) + fun validate(arg: Int, configuration: SchemaConfiguration?): Int { + return validate(arg as Number, configuration) as Int + } + + @Throws(ValidationException::class) + fun validate(arg: Long, configuration: SchemaConfiguration?): Long { + return validate(arg as Number, configuration) as Long + } + + @Throws(ValidationException::class) + fun validate(arg: Float, configuration: SchemaConfiguration?): Float { + return validate(arg as Number, configuration) as Float + } + + @Throws(ValidationException::class) + fun validate(arg: Double, configuration: SchemaConfiguration?): Double { + return validate(arg as Number, configuration) as Double + } + + @Throws(ValidationException::class) + override fun validate(arg: String, configuration: SchemaConfiguration?): String { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validatedPathToSchemas = PathToSchemasMap() + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, LinkedHashSet()) + getPathToSchemas(this, castArg, validationMetadata, pathSet) + return castArg + } + + @Throws(ValidationException::class) + fun validate(arg: LocalDate, configuration: SchemaConfiguration?): String { + return validate(arg.toString(), configuration) + } + + @Throws(ValidationException::class) + fun validate(arg: ZonedDateTime, configuration: SchemaConfiguration?): String { + return validate(arg.toString(), configuration) + } + + @Throws(ValidationException::class) + fun validate(arg: UUID, configuration: SchemaConfiguration?): String { + return validate(arg.toString(), configuration) + } + + override fun getNewInstance(arg: List<*>, pathToItem: List, pathToSchemas: PathToSchemasMap): FrozenList { + val items: MutableList = ArrayList() + var i: Int = 0 + for (item: Any? in arg) { + val itemPathToItem = pathToItem + i + val schemas: LinkedHashMap, Nothing?>? = pathToSchemas.get(itemPathToItem) + if (schemas == null) { + throw RuntimeException("Validation result is invalid, schemas must exist for a pathToItem") + } + val itemSchema: JsonSchema<*> = schemas.entries.iterator().next().key + val itemInstance: Any? = itemSchema.getNewInstance(item, itemPathToItem, pathToSchemas) + items.add(itemInstance) + i += 1 + } + val newInstanceItems: FrozenList = FrozenList(items) + return newInstanceItems + } + + @Throws(ValidationException::class) + override fun validate(arg: List<*>, configuration: SchemaConfiguration?): FrozenList { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, PathToSchemasMap(), LinkedHashSet()) + val pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet) + return getNewInstance(castArg, validationMetadata.pathToItem, pathToSchemasMap) + } + + override fun getNewInstance(arg: Map<*, *>, pathToItem: List, pathToSchemas: PathToSchemasMap): Schema1Map { + val properties: LinkedHashMap = LinkedHashMap() + for((propertyName, value) in arg) { + if (!(propertyName is String)) { + throw RuntimeException("Invalid non-string key value") + } + val propertyPathToItem: List = pathToItem + propertyName + val schemas: LinkedHashMap, Nothing?>? = pathToSchemas.get(propertyPathToItem) + if (schemas == null) { + throw RuntimeException("Validation result is invalid, schemas must exist for a pathToItem") + } + val propertySchema: JsonSchema<*> = schemas.entries.iterator().next().key + val propertyInstance: Any? = propertySchema.getNewInstance(value, propertyPathToItem, pathToSchemas) + properties[propertyName] = propertyInstance + } + val castProperties: FrozenMap = FrozenMap(properties) + return Schema1Map(castProperties) + } + + @Throws(ValidationException::class) + override fun validate(arg: Map<*, *>, configuration: SchemaConfiguration?): Schema1Map { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validatedPathToSchemas = PathToSchemasMap() + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, LinkedHashSet()) + val pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet) + return getNewInstance(castArg, validationMetadata.pathToItem, pathToSchemasMap) + } + + @Throws(ValidationException::class) + override fun validate(arg: Any?, configuration: SchemaConfiguration?): Any? { + if (arg == null) { + return validate(null, configuration) + } else if (arg is Boolean) { + return validate(arg, configuration) + } else if (arg is Number) { + return validate(arg, configuration) + } else if (arg is String) { + return validate(arg, configuration) + } else if (arg is List<*>) { + return validate(arg, configuration) + } else if (arg is Map<*, *>) { + return validate(arg, configuration) + } + throw ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema") + } + override fun getNewInstance(arg: Any?, pathToItem: List, pathToSchemas: PathToSchemasMap): Any? { + if (arg == null) { + return getNewInstance( null, pathToItem, pathToSchemas) + } else if (arg is Boolean) { + return getNewInstance(arg, pathToItem, pathToSchemas) + } else if (arg is Number) { + return getNewInstance(arg, pathToItem, pathToSchemas) + } else if (arg is String) { + return getNewInstance(arg, pathToItem, pathToSchemas) + } else if (arg is List<*>) { + return getNewInstance(arg, pathToItem, pathToSchemas) + } else if (arg is Map<*, *>) { + return getNewInstance(arg, pathToItem, pathToSchemas) + } + throw RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema") + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: Nothing?, configuration: SchemaConfiguration?): Schema1BoxedVoid { + return Schema1BoxedVoid(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: Boolean, configuration: SchemaConfiguration?): Schema1BoxedBoolean { + return Schema1BoxedBoolean(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: Number, configuration: SchemaConfiguration?): Schema1BoxedNumber { + return Schema1BoxedNumber(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: String, configuration: SchemaConfiguration?): Schema1BoxedString { + return Schema1BoxedString(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: List<*>, configuration: SchemaConfiguration?): Schema1BoxedList { + return Schema1BoxedList(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: Map<*, *>, configuration: SchemaConfiguration?): Schema1BoxedMap { + return Schema1BoxedMap(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: Any?, configuration: SchemaConfiguration?): Schema1Boxed { + if (arg == null) { + return validateAndBox(null, configuration) + } else if (arg is Boolean) { + return validateAndBox(arg, configuration) + } else if (arg is String) { + return validateAndBox(arg, configuration) + } else if (arg is Number) { + return validateAndBox(arg, configuration) + } else if (arg is List<*>) { + return validateAndBox(arg, configuration) + } else if (arg is Map<*, *>) { + return validateAndBox(arg, configuration) + } + throw ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema") + } + } + + class Bar : IntJsonSchema.IntJsonSchema1() { + companion object { + @Volatile + private var instance: Bar? = null + + fun getInstance() = + instance ?: synchronized(this) { + instance ?: Bar().also { instance = it } + } + } + } + + + class AllofWithBaseSchemaMap(m: FrozenMap) : FrozenMap(m) { + companion object { + val requiredKeys: Set = setOf( + "bar" + ) + val optionalKeys: Set = setOf() + @Throws(ValidationException::class) + fun of(arg: Map, configuration: SchemaConfiguration): AllofWithBaseSchemaMap { + return AllofWithBaseSchema1.getInstance().validate(arg, configuration) + } + } + + fun bar(): Number { + val value: Any? = get("bar") + if (!(value is Number)) { + throw RuntimeException("Invalid value stored for bar") + } + return value + } + + @Throws(UnsetPropertyException::class, InvalidAdditionalPropertyException::class) + fun getAdditionalProperty(name: String): Any? { + throwIfKeyKnown(name, requiredKeys, optionalKeys) + throwIfKeyNotPresent(name) + return get(name) + } + } + + interface SetterForBar { + fun getInstance(): MutableMap + fun getBuilderAfterBar(instance: MutableMap): T + + fun bar(value: Int): T { + val instance = getInstance() + instance["bar"] = value + return getBuilderAfterBar(instance) + } + + fun bar(value: Float): T { + val instance = getInstance() + instance["bar"] = value + return getBuilderAfterBar(instance) + } + + fun bar(value: Long): T { + val instance = getInstance() + instance["bar"] = value + return getBuilderAfterBar(instance) + } + + fun bar(value: Double): T { + val instance = getInstance() + instance["bar"] = value + return getBuilderAfterBar(instance) + } + } + + class AllofWithBaseSchemaMap0Builder(private val instance: MutableMap): UnsetAddPropsSetter, GenericBuilder> { + private val knownKeys: Set = setOf( + "bar" + ) + override fun getKnownKeys(): Set { + return knownKeys + } + override fun build(): Map { + return instance + } + override fun getInstance(): MutableMap { + return instance + } + override fun getBuilderAfterAdditionalProperty(instance: MutableMap): AllofWithBaseSchemaMap0Builder { + return this + } + } + + class AllofWithBaseSchemaMapBuilder: SetterForBar { + private val instance: MutableMap + init { + this.instance = LinkedHashMap() + } + override fun getInstance(): MutableMap { + return instance + } + override fun getBuilderAfterBar(instance: MutableMap): AllofWithBaseSchemaMap0Builder { + return AllofWithBaseSchemaMap0Builder(instance) + } + } + + + sealed interface AllofWithBaseSchema1Boxed { + fun getData(): Any? + } + + data class AllofWithBaseSchema1BoxedVoid(val data: Nothing?) : AllofWithBaseSchema1Boxed { + override fun getData(): Any? { + return data + } + } + + data class AllofWithBaseSchema1BoxedBoolean(val data: Boolean): AllofWithBaseSchema1Boxed { + override fun getData(): Any? { + return data + } + } + + data class AllofWithBaseSchema1BoxedNumber(val data: Number) : AllofWithBaseSchema1Boxed { + override fun getData(): Any? { + return data + } + } + + data class AllofWithBaseSchema1BoxedString(val data: String) : AllofWithBaseSchema1Boxed { + override fun getData(): Any? { + return data + } + } + + data class AllofWithBaseSchema1BoxedList(val data: FrozenList) : AllofWithBaseSchema1Boxed { + override fun getData(): Any? { + return data + } + } + + data class AllofWithBaseSchema1BoxedMap(val data: AllofWithBaseSchemaMap) : AllofWithBaseSchema1Boxed { + override fun getData(): Any? { + return data + } + } + + + class AllofWithBaseSchema1 private constructor(): JsonSchema( + JsonSchemaInfo() + .properties(mapOf( + "bar" to Bar::class.java + )) + .required(setOf( + "bar" + )) + .allOf(listOf( + Schema0::class.java, + Schema1::class.java + )) + ), NullSchemaValidator, BooleanSchemaValidator, NumberSchemaValidator, StringSchemaValidator, ListSchemaValidator, AllofWithBaseSchema1BoxedList>, MapSchemaValidator { + /* + NOTE: This class is auto generated by OpenAPI JSON Schema Generator. + Ref: https://github.com/openapi-json-schema-tools/openapi-json-schema-generator + + Do not edit the class manually. + */ + + companion object { + @Volatile + private var instance: AllofWithBaseSchema1? = null + + fun getInstance() = + instance ?: synchronized(this) { + instance ?: AllofWithBaseSchema1().also { instance = it } + } + } + + @Throws(ValidationException::class) + override fun validate(arg: Nothing?, configuration: SchemaConfiguration?): Nothing? { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validatedPathToSchemas = PathToSchemasMap() + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, LinkedHashSet()) + getPathToSchemas(this, castArg, validationMetadata, pathSet) + return castArg + } + + @Throws(ValidationException::class) + override fun validate(arg: Boolean, configuration: SchemaConfiguration?): Boolean { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validatedPathToSchemas = PathToSchemasMap() + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, LinkedHashSet()) + getPathToSchemas(this, castArg, validationMetadata, pathSet) + return castArg + } + + @Throws(ValidationException::class) + override fun validate(arg: Number, configuration: SchemaConfiguration?): Number { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validatedPathToSchemas = PathToSchemasMap() + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, LinkedHashSet()) + getPathToSchemas(this, castArg, validationMetadata, pathSet) + return castArg + } + + @Throws(ValidationException::class) + fun validate(arg: Int, configuration: SchemaConfiguration?): Int { + return validate(arg as Number, configuration) as Int + } + + @Throws(ValidationException::class) + fun validate(arg: Long, configuration: SchemaConfiguration?): Long { + return validate(arg as Number, configuration) as Long + } + + @Throws(ValidationException::class) + fun validate(arg: Float, configuration: SchemaConfiguration?): Float { + return validate(arg as Number, configuration) as Float + } + + @Throws(ValidationException::class) + fun validate(arg: Double, configuration: SchemaConfiguration?): Double { + return validate(arg as Number, configuration) as Double + } + + @Throws(ValidationException::class) + override fun validate(arg: String, configuration: SchemaConfiguration?): String { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validatedPathToSchemas = PathToSchemasMap() + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, LinkedHashSet()) + getPathToSchemas(this, castArg, validationMetadata, pathSet) + return castArg + } + + @Throws(ValidationException::class) + fun validate(arg: LocalDate, configuration: SchemaConfiguration?): String { + return validate(arg.toString(), configuration) + } + + @Throws(ValidationException::class) + fun validate(arg: ZonedDateTime, configuration: SchemaConfiguration?): String { + return validate(arg.toString(), configuration) + } + + @Throws(ValidationException::class) + fun validate(arg: UUID, configuration: SchemaConfiguration?): String { + return validate(arg.toString(), configuration) + } + + override fun getNewInstance(arg: List<*>, pathToItem: List, pathToSchemas: PathToSchemasMap): FrozenList { + val items: MutableList = ArrayList() + var i: Int = 0 + for (item: Any? in arg) { + val itemPathToItem = pathToItem + i + val schemas: LinkedHashMap, Nothing?>? = pathToSchemas.get(itemPathToItem) + if (schemas == null) { + throw RuntimeException("Validation result is invalid, schemas must exist for a pathToItem") + } + val itemSchema: JsonSchema<*> = schemas.entries.iterator().next().key + val itemInstance: Any? = itemSchema.getNewInstance(item, itemPathToItem, pathToSchemas) + items.add(itemInstance) + i += 1 + } + val newInstanceItems: FrozenList = FrozenList(items) + return newInstanceItems + } + + @Throws(ValidationException::class) + override fun validate(arg: List<*>, configuration: SchemaConfiguration?): FrozenList { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, PathToSchemasMap(), LinkedHashSet()) + val pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet) + return getNewInstance(castArg, validationMetadata.pathToItem, pathToSchemasMap) + } + + override fun getNewInstance(arg: Map<*, *>, pathToItem: List, pathToSchemas: PathToSchemasMap): AllofWithBaseSchemaMap { + val properties: LinkedHashMap = LinkedHashMap() + for((propertyName, value) in arg) { + if (!(propertyName is String)) { + throw RuntimeException("Invalid non-string key value") + } + val propertyPathToItem: List = pathToItem + propertyName + val schemas: LinkedHashMap, Nothing?>? = pathToSchemas.get(propertyPathToItem) + if (schemas == null) { + throw RuntimeException("Validation result is invalid, schemas must exist for a pathToItem") + } + val propertySchema: JsonSchema<*> = schemas.entries.iterator().next().key + val propertyInstance: Any? = propertySchema.getNewInstance(value, propertyPathToItem, pathToSchemas) + properties[propertyName] = propertyInstance + } + val castProperties: FrozenMap = FrozenMap(properties) + return AllofWithBaseSchemaMap(castProperties) + } + + @Throws(ValidationException::class) + override fun validate(arg: Map<*, *>, configuration: SchemaConfiguration?): AllofWithBaseSchemaMap { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validatedPathToSchemas = PathToSchemasMap() + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, LinkedHashSet()) + val pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet) + return getNewInstance(castArg, validationMetadata.pathToItem, pathToSchemasMap) + } + + @Throws(ValidationException::class) + override fun validate(arg: Any?, configuration: SchemaConfiguration?): Any? { + if (arg == null) { + return validate(null, configuration) + } else if (arg is Boolean) { + return validate(arg, configuration) + } else if (arg is Number) { + return validate(arg, configuration) + } else if (arg is String) { + return validate(arg, configuration) + } else if (arg is List<*>) { + return validate(arg, configuration) + } else if (arg is Map<*, *>) { + return validate(arg, configuration) + } + throw ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema") + } + override fun getNewInstance(arg: Any?, pathToItem: List, pathToSchemas: PathToSchemasMap): Any? { + if (arg == null) { + return getNewInstance( null, pathToItem, pathToSchemas) + } else if (arg is Boolean) { + return getNewInstance(arg, pathToItem, pathToSchemas) + } else if (arg is Number) { + return getNewInstance(arg, pathToItem, pathToSchemas) + } else if (arg is String) { + return getNewInstance(arg, pathToItem, pathToSchemas) + } else if (arg is List<*>) { + return getNewInstance(arg, pathToItem, pathToSchemas) + } else if (arg is Map<*, *>) { + return getNewInstance(arg, pathToItem, pathToSchemas) + } + throw RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema") + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: Nothing?, configuration: SchemaConfiguration?): AllofWithBaseSchema1BoxedVoid { + return AllofWithBaseSchema1BoxedVoid(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: Boolean, configuration: SchemaConfiguration?): AllofWithBaseSchema1BoxedBoolean { + return AllofWithBaseSchema1BoxedBoolean(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: Number, configuration: SchemaConfiguration?): AllofWithBaseSchema1BoxedNumber { + return AllofWithBaseSchema1BoxedNumber(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: String, configuration: SchemaConfiguration?): AllofWithBaseSchema1BoxedString { + return AllofWithBaseSchema1BoxedString(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: List<*>, configuration: SchemaConfiguration?): AllofWithBaseSchema1BoxedList { + return AllofWithBaseSchema1BoxedList(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: Map<*, *>, configuration: SchemaConfiguration?): AllofWithBaseSchema1BoxedMap { + return AllofWithBaseSchema1BoxedMap(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: Any?, configuration: SchemaConfiguration?): AllofWithBaseSchema1Boxed { + if (arg == null) { + return validateAndBox(null, configuration) + } else if (arg is Boolean) { + return validateAndBox(arg, configuration) + } else if (arg is String) { + return validateAndBox(arg, configuration) + } else if (arg is Number) { + return validateAndBox(arg, configuration) + } else if (arg is List<*>) { + return validateAndBox(arg, configuration) + } else if (arg is Map<*, *>) { + return validateAndBox(arg, configuration) + } + throw ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema") + } + } +} diff --git a/samples/client/3_1_0_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/schemas/AllofWithOneEmptySchema.kt b/samples/client/3_1_0_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/schemas/AllofWithOneEmptySchema.kt new file mode 100644 index 00000000000..d52dc7697e6 --- /dev/null +++ b/samples/client/3_1_0_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/schemas/AllofWithOneEmptySchema.kt @@ -0,0 +1,324 @@ +package org.openapijsonschematools.client.components.schemas +import java.time.LocalDate +import java.time.ZonedDateTime +import java.util.UUID +import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags +import org.openapijsonschematools.client.configurations.SchemaConfiguration +import org.openapijsonschematools.client.exceptions.InvalidAdditionalPropertyException +import org.openapijsonschematools.client.exceptions.UnsetPropertyException +import org.openapijsonschematools.client.exceptions.ValidationException +import org.openapijsonschematools.client.schemas.AnyTypeJsonSchema +import org.openapijsonschematools.client.schemas.UnsetAddPropsSetter +import org.openapijsonschematools.client.schemas.validation.BooleanSchemaValidator +import org.openapijsonschematools.client.schemas.validation.FrozenList +import org.openapijsonschematools.client.schemas.validation.FrozenMap +import org.openapijsonschematools.client.schemas.validation.JsonSchema +import org.openapijsonschematools.client.schemas.validation.JsonSchemaInfo +import org.openapijsonschematools.client.schemas.validation.ListSchemaValidator +import org.openapijsonschematools.client.schemas.validation.MapSchemaValidator +import org.openapijsonschematools.client.schemas.validation.NullSchemaValidator +import org.openapijsonschematools.client.schemas.validation.NumberSchemaValidator +import org.openapijsonschematools.client.schemas.validation.PathToSchemasMap +import org.openapijsonschematools.client.schemas.validation.StringSchemaValidator +import org.openapijsonschematools.client.schemas.validation.ValidationMetadata + +class AllofWithOneEmptySchema { + // nest classes so all schemas and input/output classes can be public + + + class Schema0 : AnyTypeJsonSchema.AnyTypeJsonSchema1() { + companion object { + @Volatile + private var instance: Schema0? = null + + fun getInstance() = + instance ?: synchronized(this) { + instance ?: Schema0().also { instance = it } + } + } + } + + + sealed interface AllofWithOneEmptySchema1Boxed { + fun getData(): Any? + } + + data class AllofWithOneEmptySchema1BoxedVoid(val data: Nothing?) : AllofWithOneEmptySchema1Boxed { + override fun getData(): Any? { + return data + } + } + + data class AllofWithOneEmptySchema1BoxedBoolean(val data: Boolean): AllofWithOneEmptySchema1Boxed { + override fun getData(): Any? { + return data + } + } + + data class AllofWithOneEmptySchema1BoxedNumber(val data: Number) : AllofWithOneEmptySchema1Boxed { + override fun getData(): Any? { + return data + } + } + + data class AllofWithOneEmptySchema1BoxedString(val data: String) : AllofWithOneEmptySchema1Boxed { + override fun getData(): Any? { + return data + } + } + + data class AllofWithOneEmptySchema1BoxedList(val data: FrozenList) : AllofWithOneEmptySchema1Boxed { + override fun getData(): Any? { + return data + } + } + + data class AllofWithOneEmptySchema1BoxedMap(val data: FrozenMap) : AllofWithOneEmptySchema1Boxed { + override fun getData(): Any? { + return data + } + } + + + class AllofWithOneEmptySchema1 private constructor(): JsonSchema( + JsonSchemaInfo() + .allOf(listOf( + Schema0::class.java + )) + ), NullSchemaValidator, BooleanSchemaValidator, NumberSchemaValidator, StringSchemaValidator, ListSchemaValidator, AllofWithOneEmptySchema1BoxedList>, MapSchemaValidator, AllofWithOneEmptySchema1BoxedMap> { + /* + NOTE: This class is auto generated by OpenAPI JSON Schema Generator. + Ref: https://github.com/openapi-json-schema-tools/openapi-json-schema-generator + + Do not edit the class manually. + */ + + companion object { + @Volatile + private var instance: AllofWithOneEmptySchema1? = null + + fun getInstance() = + instance ?: synchronized(this) { + instance ?: AllofWithOneEmptySchema1().also { instance = it } + } + } + + @Throws(ValidationException::class) + override fun validate(arg: Nothing?, configuration: SchemaConfiguration?): Nothing? { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validatedPathToSchemas = PathToSchemasMap() + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, LinkedHashSet()) + getPathToSchemas(this, castArg, validationMetadata, pathSet) + return castArg + } + + @Throws(ValidationException::class) + override fun validate(arg: Boolean, configuration: SchemaConfiguration?): Boolean { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validatedPathToSchemas = PathToSchemasMap() + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, LinkedHashSet()) + getPathToSchemas(this, castArg, validationMetadata, pathSet) + return castArg + } + + @Throws(ValidationException::class) + override fun validate(arg: Number, configuration: SchemaConfiguration?): Number { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validatedPathToSchemas = PathToSchemasMap() + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, LinkedHashSet()) + getPathToSchemas(this, castArg, validationMetadata, pathSet) + return castArg + } + + @Throws(ValidationException::class) + fun validate(arg: Int, configuration: SchemaConfiguration?): Int { + return validate(arg as Number, configuration) as Int + } + + @Throws(ValidationException::class) + fun validate(arg: Long, configuration: SchemaConfiguration?): Long { + return validate(arg as Number, configuration) as Long + } + + @Throws(ValidationException::class) + fun validate(arg: Float, configuration: SchemaConfiguration?): Float { + return validate(arg as Number, configuration) as Float + } + + @Throws(ValidationException::class) + fun validate(arg: Double, configuration: SchemaConfiguration?): Double { + return validate(arg as Number, configuration) as Double + } + + @Throws(ValidationException::class) + override fun validate(arg: String, configuration: SchemaConfiguration?): String { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validatedPathToSchemas = PathToSchemasMap() + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, LinkedHashSet()) + getPathToSchemas(this, castArg, validationMetadata, pathSet) + return castArg + } + + @Throws(ValidationException::class) + fun validate(arg: LocalDate, configuration: SchemaConfiguration?): String { + return validate(arg.toString(), configuration) + } + + @Throws(ValidationException::class) + fun validate(arg: ZonedDateTime, configuration: SchemaConfiguration?): String { + return validate(arg.toString(), configuration) + } + + @Throws(ValidationException::class) + fun validate(arg: UUID, configuration: SchemaConfiguration?): String { + return validate(arg.toString(), configuration) + } + + override fun getNewInstance(arg: List<*>, pathToItem: List, pathToSchemas: PathToSchemasMap): FrozenList { + val items: MutableList = ArrayList() + var i: Int = 0 + for (item: Any? in arg) { + val itemPathToItem = pathToItem + i + val schemas: LinkedHashMap, Nothing?>? = pathToSchemas.get(itemPathToItem) + if (schemas == null) { + throw RuntimeException("Validation result is invalid, schemas must exist for a pathToItem") + } + val itemSchema: JsonSchema<*> = schemas.entries.iterator().next().key + val itemInstance: Any? = itemSchema.getNewInstance(item, itemPathToItem, pathToSchemas) + items.add(itemInstance) + i += 1 + } + val newInstanceItems: FrozenList = FrozenList(items) + return newInstanceItems + } + + @Throws(ValidationException::class) + override fun validate(arg: List<*>, configuration: SchemaConfiguration?): FrozenList { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, PathToSchemasMap(), LinkedHashSet()) + val pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet) + return getNewInstance(castArg, validationMetadata.pathToItem, pathToSchemasMap) + } + + override fun getNewInstance(arg: Map<*, *>, pathToItem: List, pathToSchemas: PathToSchemasMap): FrozenMap { + val properties: LinkedHashMap = LinkedHashMap() + for((propertyName, value) in arg) { + if (!(propertyName is String)) { + throw RuntimeException("Invalid non-string key value") + } + val propertyPathToItem: List = pathToItem + propertyName + val schemas: LinkedHashMap, Nothing?>? = pathToSchemas.get(propertyPathToItem) + if (schemas == null) { + throw RuntimeException("Validation result is invalid, schemas must exist for a pathToItem") + } + val propertySchema: JsonSchema<*> = schemas.entries.iterator().next().key + val propertyInstance: Any? = propertySchema.getNewInstance(value, propertyPathToItem, pathToSchemas) + properties[propertyName] = propertyInstance + } + val castProperties: FrozenMap = FrozenMap(properties) + return castProperties + } + + @Throws(ValidationException::class) + override fun validate(arg: Map<*, *>, configuration: SchemaConfiguration?): FrozenMap { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validatedPathToSchemas = PathToSchemasMap() + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, LinkedHashSet()) + val pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet) + return getNewInstance(castArg, validationMetadata.pathToItem, pathToSchemasMap) + } + + @Throws(ValidationException::class) + override fun validate(arg: Any?, configuration: SchemaConfiguration?): Any? { + if (arg == null) { + return validate(null, configuration) + } else if (arg is Boolean) { + return validate(arg, configuration) + } else if (arg is Number) { + return validate(arg, configuration) + } else if (arg is String) { + return validate(arg, configuration) + } else if (arg is List<*>) { + return validate(arg, configuration) + } else if (arg is Map<*, *>) { + return validate(arg, configuration) + } + throw ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema") + } + override fun getNewInstance(arg: Any?, pathToItem: List, pathToSchemas: PathToSchemasMap): Any? { + if (arg == null) { + return getNewInstance( null, pathToItem, pathToSchemas) + } else if (arg is Boolean) { + return getNewInstance(arg, pathToItem, pathToSchemas) + } else if (arg is Number) { + return getNewInstance(arg, pathToItem, pathToSchemas) + } else if (arg is String) { + return getNewInstance(arg, pathToItem, pathToSchemas) + } else if (arg is List<*>) { + return getNewInstance(arg, pathToItem, pathToSchemas) + } else if (arg is Map<*, *>) { + return getNewInstance(arg, pathToItem, pathToSchemas) + } + throw RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema") + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: Nothing?, configuration: SchemaConfiguration?): AllofWithOneEmptySchema1BoxedVoid { + return AllofWithOneEmptySchema1BoxedVoid(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: Boolean, configuration: SchemaConfiguration?): AllofWithOneEmptySchema1BoxedBoolean { + return AllofWithOneEmptySchema1BoxedBoolean(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: Number, configuration: SchemaConfiguration?): AllofWithOneEmptySchema1BoxedNumber { + return AllofWithOneEmptySchema1BoxedNumber(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: String, configuration: SchemaConfiguration?): AllofWithOneEmptySchema1BoxedString { + return AllofWithOneEmptySchema1BoxedString(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: List<*>, configuration: SchemaConfiguration?): AllofWithOneEmptySchema1BoxedList { + return AllofWithOneEmptySchema1BoxedList(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: Map<*, *>, configuration: SchemaConfiguration?): AllofWithOneEmptySchema1BoxedMap { + return AllofWithOneEmptySchema1BoxedMap(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: Any?, configuration: SchemaConfiguration?): AllofWithOneEmptySchema1Boxed { + if (arg == null) { + return validateAndBox(null, configuration) + } else if (arg is Boolean) { + return validateAndBox(arg, configuration) + } else if (arg is String) { + return validateAndBox(arg, configuration) + } else if (arg is Number) { + return validateAndBox(arg, configuration) + } else if (arg is List<*>) { + return validateAndBox(arg, configuration) + } else if (arg is Map<*, *>) { + return validateAndBox(arg, configuration) + } + throw ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema") + } + } +} diff --git a/samples/client/3_1_0_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/schemas/AllofWithTheFirstEmptySchema.kt b/samples/client/3_1_0_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/schemas/AllofWithTheFirstEmptySchema.kt new file mode 100644 index 00000000000..05bc227949a --- /dev/null +++ b/samples/client/3_1_0_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/schemas/AllofWithTheFirstEmptySchema.kt @@ -0,0 +1,339 @@ +package org.openapijsonschematools.client.components.schemas +import java.time.LocalDate +import java.time.ZonedDateTime +import java.util.UUID +import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags +import org.openapijsonschematools.client.configurations.SchemaConfiguration +import org.openapijsonschematools.client.exceptions.InvalidAdditionalPropertyException +import org.openapijsonschematools.client.exceptions.UnsetPropertyException +import org.openapijsonschematools.client.exceptions.ValidationException +import org.openapijsonschematools.client.schemas.AnyTypeJsonSchema +import org.openapijsonschematools.client.schemas.NumberJsonSchema +import org.openapijsonschematools.client.schemas.UnsetAddPropsSetter +import org.openapijsonschematools.client.schemas.validation.BooleanSchemaValidator +import org.openapijsonschematools.client.schemas.validation.FrozenList +import org.openapijsonschematools.client.schemas.validation.FrozenMap +import org.openapijsonschematools.client.schemas.validation.JsonSchema +import org.openapijsonschematools.client.schemas.validation.JsonSchemaInfo +import org.openapijsonschematools.client.schemas.validation.ListSchemaValidator +import org.openapijsonschematools.client.schemas.validation.MapSchemaValidator +import org.openapijsonschematools.client.schemas.validation.NullSchemaValidator +import org.openapijsonschematools.client.schemas.validation.NumberSchemaValidator +import org.openapijsonschematools.client.schemas.validation.PathToSchemasMap +import org.openapijsonschematools.client.schemas.validation.StringSchemaValidator +import org.openapijsonschematools.client.schemas.validation.ValidationMetadata + +class AllofWithTheFirstEmptySchema { + // nest classes so all schemas and input/output classes can be public + + + class Schema0 : AnyTypeJsonSchema.AnyTypeJsonSchema1() { + companion object { + @Volatile + private var instance: Schema0? = null + + fun getInstance() = + instance ?: synchronized(this) { + instance ?: Schema0().also { instance = it } + } + } + } + + + class Schema1 : NumberJsonSchema.NumberJsonSchema1() { + companion object { + @Volatile + private var instance: Schema1? = null + + fun getInstance() = + instance ?: synchronized(this) { + instance ?: Schema1().also { instance = it } + } + } + } + + + sealed interface AllofWithTheFirstEmptySchema1Boxed { + fun getData(): Any? + } + + data class AllofWithTheFirstEmptySchema1BoxedVoid(val data: Nothing?) : AllofWithTheFirstEmptySchema1Boxed { + override fun getData(): Any? { + return data + } + } + + data class AllofWithTheFirstEmptySchema1BoxedBoolean(val data: Boolean): AllofWithTheFirstEmptySchema1Boxed { + override fun getData(): Any? { + return data + } + } + + data class AllofWithTheFirstEmptySchema1BoxedNumber(val data: Number) : AllofWithTheFirstEmptySchema1Boxed { + override fun getData(): Any? { + return data + } + } + + data class AllofWithTheFirstEmptySchema1BoxedString(val data: String) : AllofWithTheFirstEmptySchema1Boxed { + override fun getData(): Any? { + return data + } + } + + data class AllofWithTheFirstEmptySchema1BoxedList(val data: FrozenList) : AllofWithTheFirstEmptySchema1Boxed { + override fun getData(): Any? { + return data + } + } + + data class AllofWithTheFirstEmptySchema1BoxedMap(val data: FrozenMap) : AllofWithTheFirstEmptySchema1Boxed { + override fun getData(): Any? { + return data + } + } + + + class AllofWithTheFirstEmptySchema1 private constructor(): JsonSchema( + JsonSchemaInfo() + .allOf(listOf( + Schema0::class.java, + Schema1::class.java + )) + ), NullSchemaValidator, BooleanSchemaValidator, NumberSchemaValidator, StringSchemaValidator, ListSchemaValidator, AllofWithTheFirstEmptySchema1BoxedList>, MapSchemaValidator, AllofWithTheFirstEmptySchema1BoxedMap> { + /* + NOTE: This class is auto generated by OpenAPI JSON Schema Generator. + Ref: https://github.com/openapi-json-schema-tools/openapi-json-schema-generator + + Do not edit the class manually. + */ + + companion object { + @Volatile + private var instance: AllofWithTheFirstEmptySchema1? = null + + fun getInstance() = + instance ?: synchronized(this) { + instance ?: AllofWithTheFirstEmptySchema1().also { instance = it } + } + } + + @Throws(ValidationException::class) + override fun validate(arg: Nothing?, configuration: SchemaConfiguration?): Nothing? { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validatedPathToSchemas = PathToSchemasMap() + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, LinkedHashSet()) + getPathToSchemas(this, castArg, validationMetadata, pathSet) + return castArg + } + + @Throws(ValidationException::class) + override fun validate(arg: Boolean, configuration: SchemaConfiguration?): Boolean { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validatedPathToSchemas = PathToSchemasMap() + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, LinkedHashSet()) + getPathToSchemas(this, castArg, validationMetadata, pathSet) + return castArg + } + + @Throws(ValidationException::class) + override fun validate(arg: Number, configuration: SchemaConfiguration?): Number { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validatedPathToSchemas = PathToSchemasMap() + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, LinkedHashSet()) + getPathToSchemas(this, castArg, validationMetadata, pathSet) + return castArg + } + + @Throws(ValidationException::class) + fun validate(arg: Int, configuration: SchemaConfiguration?): Int { + return validate(arg as Number, configuration) as Int + } + + @Throws(ValidationException::class) + fun validate(arg: Long, configuration: SchemaConfiguration?): Long { + return validate(arg as Number, configuration) as Long + } + + @Throws(ValidationException::class) + fun validate(arg: Float, configuration: SchemaConfiguration?): Float { + return validate(arg as Number, configuration) as Float + } + + @Throws(ValidationException::class) + fun validate(arg: Double, configuration: SchemaConfiguration?): Double { + return validate(arg as Number, configuration) as Double + } + + @Throws(ValidationException::class) + override fun validate(arg: String, configuration: SchemaConfiguration?): String { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validatedPathToSchemas = PathToSchemasMap() + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, LinkedHashSet()) + getPathToSchemas(this, castArg, validationMetadata, pathSet) + return castArg + } + + @Throws(ValidationException::class) + fun validate(arg: LocalDate, configuration: SchemaConfiguration?): String { + return validate(arg.toString(), configuration) + } + + @Throws(ValidationException::class) + fun validate(arg: ZonedDateTime, configuration: SchemaConfiguration?): String { + return validate(arg.toString(), configuration) + } + + @Throws(ValidationException::class) + fun validate(arg: UUID, configuration: SchemaConfiguration?): String { + return validate(arg.toString(), configuration) + } + + override fun getNewInstance(arg: List<*>, pathToItem: List, pathToSchemas: PathToSchemasMap): FrozenList { + val items: MutableList = ArrayList() + var i: Int = 0 + for (item: Any? in arg) { + val itemPathToItem = pathToItem + i + val schemas: LinkedHashMap, Nothing?>? = pathToSchemas.get(itemPathToItem) + if (schemas == null) { + throw RuntimeException("Validation result is invalid, schemas must exist for a pathToItem") + } + val itemSchema: JsonSchema<*> = schemas.entries.iterator().next().key + val itemInstance: Any? = itemSchema.getNewInstance(item, itemPathToItem, pathToSchemas) + items.add(itemInstance) + i += 1 + } + val newInstanceItems: FrozenList = FrozenList(items) + return newInstanceItems + } + + @Throws(ValidationException::class) + override fun validate(arg: List<*>, configuration: SchemaConfiguration?): FrozenList { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, PathToSchemasMap(), LinkedHashSet()) + val pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet) + return getNewInstance(castArg, validationMetadata.pathToItem, pathToSchemasMap) + } + + override fun getNewInstance(arg: Map<*, *>, pathToItem: List, pathToSchemas: PathToSchemasMap): FrozenMap { + val properties: LinkedHashMap = LinkedHashMap() + for((propertyName, value) in arg) { + if (!(propertyName is String)) { + throw RuntimeException("Invalid non-string key value") + } + val propertyPathToItem: List = pathToItem + propertyName + val schemas: LinkedHashMap, Nothing?>? = pathToSchemas.get(propertyPathToItem) + if (schemas == null) { + throw RuntimeException("Validation result is invalid, schemas must exist for a pathToItem") + } + val propertySchema: JsonSchema<*> = schemas.entries.iterator().next().key + val propertyInstance: Any? = propertySchema.getNewInstance(value, propertyPathToItem, pathToSchemas) + properties[propertyName] = propertyInstance + } + val castProperties: FrozenMap = FrozenMap(properties) + return castProperties + } + + @Throws(ValidationException::class) + override fun validate(arg: Map<*, *>, configuration: SchemaConfiguration?): FrozenMap { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validatedPathToSchemas = PathToSchemasMap() + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, LinkedHashSet()) + val pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet) + return getNewInstance(castArg, validationMetadata.pathToItem, pathToSchemasMap) + } + + @Throws(ValidationException::class) + override fun validate(arg: Any?, configuration: SchemaConfiguration?): Any? { + if (arg == null) { + return validate(null, configuration) + } else if (arg is Boolean) { + return validate(arg, configuration) + } else if (arg is Number) { + return validate(arg, configuration) + } else if (arg is String) { + return validate(arg, configuration) + } else if (arg is List<*>) { + return validate(arg, configuration) + } else if (arg is Map<*, *>) { + return validate(arg, configuration) + } + throw ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema") + } + override fun getNewInstance(arg: Any?, pathToItem: List, pathToSchemas: PathToSchemasMap): Any? { + if (arg == null) { + return getNewInstance( null, pathToItem, pathToSchemas) + } else if (arg is Boolean) { + return getNewInstance(arg, pathToItem, pathToSchemas) + } else if (arg is Number) { + return getNewInstance(arg, pathToItem, pathToSchemas) + } else if (arg is String) { + return getNewInstance(arg, pathToItem, pathToSchemas) + } else if (arg is List<*>) { + return getNewInstance(arg, pathToItem, pathToSchemas) + } else if (arg is Map<*, *>) { + return getNewInstance(arg, pathToItem, pathToSchemas) + } + throw RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema") + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: Nothing?, configuration: SchemaConfiguration?): AllofWithTheFirstEmptySchema1BoxedVoid { + return AllofWithTheFirstEmptySchema1BoxedVoid(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: Boolean, configuration: SchemaConfiguration?): AllofWithTheFirstEmptySchema1BoxedBoolean { + return AllofWithTheFirstEmptySchema1BoxedBoolean(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: Number, configuration: SchemaConfiguration?): AllofWithTheFirstEmptySchema1BoxedNumber { + return AllofWithTheFirstEmptySchema1BoxedNumber(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: String, configuration: SchemaConfiguration?): AllofWithTheFirstEmptySchema1BoxedString { + return AllofWithTheFirstEmptySchema1BoxedString(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: List<*>, configuration: SchemaConfiguration?): AllofWithTheFirstEmptySchema1BoxedList { + return AllofWithTheFirstEmptySchema1BoxedList(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: Map<*, *>, configuration: SchemaConfiguration?): AllofWithTheFirstEmptySchema1BoxedMap { + return AllofWithTheFirstEmptySchema1BoxedMap(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: Any?, configuration: SchemaConfiguration?): AllofWithTheFirstEmptySchema1Boxed { + if (arg == null) { + return validateAndBox(null, configuration) + } else if (arg is Boolean) { + return validateAndBox(arg, configuration) + } else if (arg is String) { + return validateAndBox(arg, configuration) + } else if (arg is Number) { + return validateAndBox(arg, configuration) + } else if (arg is List<*>) { + return validateAndBox(arg, configuration) + } else if (arg is Map<*, *>) { + return validateAndBox(arg, configuration) + } + throw ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema") + } + } +} diff --git a/samples/client/3_1_0_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/schemas/AllofWithTheLastEmptySchema.kt b/samples/client/3_1_0_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/schemas/AllofWithTheLastEmptySchema.kt new file mode 100644 index 00000000000..fa3b00d842e --- /dev/null +++ b/samples/client/3_1_0_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/schemas/AllofWithTheLastEmptySchema.kt @@ -0,0 +1,339 @@ +package org.openapijsonschematools.client.components.schemas +import java.time.LocalDate +import java.time.ZonedDateTime +import java.util.UUID +import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags +import org.openapijsonschematools.client.configurations.SchemaConfiguration +import org.openapijsonschematools.client.exceptions.InvalidAdditionalPropertyException +import org.openapijsonschematools.client.exceptions.UnsetPropertyException +import org.openapijsonschematools.client.exceptions.ValidationException +import org.openapijsonschematools.client.schemas.AnyTypeJsonSchema +import org.openapijsonschematools.client.schemas.NumberJsonSchema +import org.openapijsonschematools.client.schemas.UnsetAddPropsSetter +import org.openapijsonschematools.client.schemas.validation.BooleanSchemaValidator +import org.openapijsonschematools.client.schemas.validation.FrozenList +import org.openapijsonschematools.client.schemas.validation.FrozenMap +import org.openapijsonschematools.client.schemas.validation.JsonSchema +import org.openapijsonschematools.client.schemas.validation.JsonSchemaInfo +import org.openapijsonschematools.client.schemas.validation.ListSchemaValidator +import org.openapijsonschematools.client.schemas.validation.MapSchemaValidator +import org.openapijsonschematools.client.schemas.validation.NullSchemaValidator +import org.openapijsonschematools.client.schemas.validation.NumberSchemaValidator +import org.openapijsonschematools.client.schemas.validation.PathToSchemasMap +import org.openapijsonschematools.client.schemas.validation.StringSchemaValidator +import org.openapijsonschematools.client.schemas.validation.ValidationMetadata + +class AllofWithTheLastEmptySchema { + // nest classes so all schemas and input/output classes can be public + + + class Schema0 : NumberJsonSchema.NumberJsonSchema1() { + companion object { + @Volatile + private var instance: Schema0? = null + + fun getInstance() = + instance ?: synchronized(this) { + instance ?: Schema0().also { instance = it } + } + } + } + + + class Schema1 : AnyTypeJsonSchema.AnyTypeJsonSchema1() { + companion object { + @Volatile + private var instance: Schema1? = null + + fun getInstance() = + instance ?: synchronized(this) { + instance ?: Schema1().also { instance = it } + } + } + } + + + sealed interface AllofWithTheLastEmptySchema1Boxed { + fun getData(): Any? + } + + data class AllofWithTheLastEmptySchema1BoxedVoid(val data: Nothing?) : AllofWithTheLastEmptySchema1Boxed { + override fun getData(): Any? { + return data + } + } + + data class AllofWithTheLastEmptySchema1BoxedBoolean(val data: Boolean): AllofWithTheLastEmptySchema1Boxed { + override fun getData(): Any? { + return data + } + } + + data class AllofWithTheLastEmptySchema1BoxedNumber(val data: Number) : AllofWithTheLastEmptySchema1Boxed { + override fun getData(): Any? { + return data + } + } + + data class AllofWithTheLastEmptySchema1BoxedString(val data: String) : AllofWithTheLastEmptySchema1Boxed { + override fun getData(): Any? { + return data + } + } + + data class AllofWithTheLastEmptySchema1BoxedList(val data: FrozenList) : AllofWithTheLastEmptySchema1Boxed { + override fun getData(): Any? { + return data + } + } + + data class AllofWithTheLastEmptySchema1BoxedMap(val data: FrozenMap) : AllofWithTheLastEmptySchema1Boxed { + override fun getData(): Any? { + return data + } + } + + + class AllofWithTheLastEmptySchema1 private constructor(): JsonSchema( + JsonSchemaInfo() + .allOf(listOf( + Schema0::class.java, + Schema1::class.java + )) + ), NullSchemaValidator, BooleanSchemaValidator, NumberSchemaValidator, StringSchemaValidator, ListSchemaValidator, AllofWithTheLastEmptySchema1BoxedList>, MapSchemaValidator, AllofWithTheLastEmptySchema1BoxedMap> { + /* + NOTE: This class is auto generated by OpenAPI JSON Schema Generator. + Ref: https://github.com/openapi-json-schema-tools/openapi-json-schema-generator + + Do not edit the class manually. + */ + + companion object { + @Volatile + private var instance: AllofWithTheLastEmptySchema1? = null + + fun getInstance() = + instance ?: synchronized(this) { + instance ?: AllofWithTheLastEmptySchema1().also { instance = it } + } + } + + @Throws(ValidationException::class) + override fun validate(arg: Nothing?, configuration: SchemaConfiguration?): Nothing? { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validatedPathToSchemas = PathToSchemasMap() + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, LinkedHashSet()) + getPathToSchemas(this, castArg, validationMetadata, pathSet) + return castArg + } + + @Throws(ValidationException::class) + override fun validate(arg: Boolean, configuration: SchemaConfiguration?): Boolean { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validatedPathToSchemas = PathToSchemasMap() + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, LinkedHashSet()) + getPathToSchemas(this, castArg, validationMetadata, pathSet) + return castArg + } + + @Throws(ValidationException::class) + override fun validate(arg: Number, configuration: SchemaConfiguration?): Number { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validatedPathToSchemas = PathToSchemasMap() + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, LinkedHashSet()) + getPathToSchemas(this, castArg, validationMetadata, pathSet) + return castArg + } + + @Throws(ValidationException::class) + fun validate(arg: Int, configuration: SchemaConfiguration?): Int { + return validate(arg as Number, configuration) as Int + } + + @Throws(ValidationException::class) + fun validate(arg: Long, configuration: SchemaConfiguration?): Long { + return validate(arg as Number, configuration) as Long + } + + @Throws(ValidationException::class) + fun validate(arg: Float, configuration: SchemaConfiguration?): Float { + return validate(arg as Number, configuration) as Float + } + + @Throws(ValidationException::class) + fun validate(arg: Double, configuration: SchemaConfiguration?): Double { + return validate(arg as Number, configuration) as Double + } + + @Throws(ValidationException::class) + override fun validate(arg: String, configuration: SchemaConfiguration?): String { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validatedPathToSchemas = PathToSchemasMap() + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, LinkedHashSet()) + getPathToSchemas(this, castArg, validationMetadata, pathSet) + return castArg + } + + @Throws(ValidationException::class) + fun validate(arg: LocalDate, configuration: SchemaConfiguration?): String { + return validate(arg.toString(), configuration) + } + + @Throws(ValidationException::class) + fun validate(arg: ZonedDateTime, configuration: SchemaConfiguration?): String { + return validate(arg.toString(), configuration) + } + + @Throws(ValidationException::class) + fun validate(arg: UUID, configuration: SchemaConfiguration?): String { + return validate(arg.toString(), configuration) + } + + override fun getNewInstance(arg: List<*>, pathToItem: List, pathToSchemas: PathToSchemasMap): FrozenList { + val items: MutableList = ArrayList() + var i: Int = 0 + for (item: Any? in arg) { + val itemPathToItem = pathToItem + i + val schemas: LinkedHashMap, Nothing?>? = pathToSchemas.get(itemPathToItem) + if (schemas == null) { + throw RuntimeException("Validation result is invalid, schemas must exist for a pathToItem") + } + val itemSchema: JsonSchema<*> = schemas.entries.iterator().next().key + val itemInstance: Any? = itemSchema.getNewInstance(item, itemPathToItem, pathToSchemas) + items.add(itemInstance) + i += 1 + } + val newInstanceItems: FrozenList = FrozenList(items) + return newInstanceItems + } + + @Throws(ValidationException::class) + override fun validate(arg: List<*>, configuration: SchemaConfiguration?): FrozenList { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, PathToSchemasMap(), LinkedHashSet()) + val pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet) + return getNewInstance(castArg, validationMetadata.pathToItem, pathToSchemasMap) + } + + override fun getNewInstance(arg: Map<*, *>, pathToItem: List, pathToSchemas: PathToSchemasMap): FrozenMap { + val properties: LinkedHashMap = LinkedHashMap() + for((propertyName, value) in arg) { + if (!(propertyName is String)) { + throw RuntimeException("Invalid non-string key value") + } + val propertyPathToItem: List = pathToItem + propertyName + val schemas: LinkedHashMap, Nothing?>? = pathToSchemas.get(propertyPathToItem) + if (schemas == null) { + throw RuntimeException("Validation result is invalid, schemas must exist for a pathToItem") + } + val propertySchema: JsonSchema<*> = schemas.entries.iterator().next().key + val propertyInstance: Any? = propertySchema.getNewInstance(value, propertyPathToItem, pathToSchemas) + properties[propertyName] = propertyInstance + } + val castProperties: FrozenMap = FrozenMap(properties) + return castProperties + } + + @Throws(ValidationException::class) + override fun validate(arg: Map<*, *>, configuration: SchemaConfiguration?): FrozenMap { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validatedPathToSchemas = PathToSchemasMap() + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, LinkedHashSet()) + val pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet) + return getNewInstance(castArg, validationMetadata.pathToItem, pathToSchemasMap) + } + + @Throws(ValidationException::class) + override fun validate(arg: Any?, configuration: SchemaConfiguration?): Any? { + if (arg == null) { + return validate(null, configuration) + } else if (arg is Boolean) { + return validate(arg, configuration) + } else if (arg is Number) { + return validate(arg, configuration) + } else if (arg is String) { + return validate(arg, configuration) + } else if (arg is List<*>) { + return validate(arg, configuration) + } else if (arg is Map<*, *>) { + return validate(arg, configuration) + } + throw ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema") + } + override fun getNewInstance(arg: Any?, pathToItem: List, pathToSchemas: PathToSchemasMap): Any? { + if (arg == null) { + return getNewInstance( null, pathToItem, pathToSchemas) + } else if (arg is Boolean) { + return getNewInstance(arg, pathToItem, pathToSchemas) + } else if (arg is Number) { + return getNewInstance(arg, pathToItem, pathToSchemas) + } else if (arg is String) { + return getNewInstance(arg, pathToItem, pathToSchemas) + } else if (arg is List<*>) { + return getNewInstance(arg, pathToItem, pathToSchemas) + } else if (arg is Map<*, *>) { + return getNewInstance(arg, pathToItem, pathToSchemas) + } + throw RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema") + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: Nothing?, configuration: SchemaConfiguration?): AllofWithTheLastEmptySchema1BoxedVoid { + return AllofWithTheLastEmptySchema1BoxedVoid(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: Boolean, configuration: SchemaConfiguration?): AllofWithTheLastEmptySchema1BoxedBoolean { + return AllofWithTheLastEmptySchema1BoxedBoolean(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: Number, configuration: SchemaConfiguration?): AllofWithTheLastEmptySchema1BoxedNumber { + return AllofWithTheLastEmptySchema1BoxedNumber(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: String, configuration: SchemaConfiguration?): AllofWithTheLastEmptySchema1BoxedString { + return AllofWithTheLastEmptySchema1BoxedString(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: List<*>, configuration: SchemaConfiguration?): AllofWithTheLastEmptySchema1BoxedList { + return AllofWithTheLastEmptySchema1BoxedList(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: Map<*, *>, configuration: SchemaConfiguration?): AllofWithTheLastEmptySchema1BoxedMap { + return AllofWithTheLastEmptySchema1BoxedMap(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: Any?, configuration: SchemaConfiguration?): AllofWithTheLastEmptySchema1Boxed { + if (arg == null) { + return validateAndBox(null, configuration) + } else if (arg is Boolean) { + return validateAndBox(arg, configuration) + } else if (arg is String) { + return validateAndBox(arg, configuration) + } else if (arg is Number) { + return validateAndBox(arg, configuration) + } else if (arg is List<*>) { + return validateAndBox(arg, configuration) + } else if (arg is Map<*, *>) { + return validateAndBox(arg, configuration) + } + throw ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema") + } + } +} diff --git a/samples/client/3_1_0_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/schemas/AllofWithTwoEmptySchemas.kt b/samples/client/3_1_0_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/schemas/AllofWithTwoEmptySchemas.kt new file mode 100644 index 00000000000..6ac254eada1 --- /dev/null +++ b/samples/client/3_1_0_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/schemas/AllofWithTwoEmptySchemas.kt @@ -0,0 +1,338 @@ +package org.openapijsonschematools.client.components.schemas +import java.time.LocalDate +import java.time.ZonedDateTime +import java.util.UUID +import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags +import org.openapijsonschematools.client.configurations.SchemaConfiguration +import org.openapijsonschematools.client.exceptions.InvalidAdditionalPropertyException +import org.openapijsonschematools.client.exceptions.UnsetPropertyException +import org.openapijsonschematools.client.exceptions.ValidationException +import org.openapijsonschematools.client.schemas.AnyTypeJsonSchema +import org.openapijsonschematools.client.schemas.UnsetAddPropsSetter +import org.openapijsonschematools.client.schemas.validation.BooleanSchemaValidator +import org.openapijsonschematools.client.schemas.validation.FrozenList +import org.openapijsonschematools.client.schemas.validation.FrozenMap +import org.openapijsonschematools.client.schemas.validation.JsonSchema +import org.openapijsonschematools.client.schemas.validation.JsonSchemaInfo +import org.openapijsonschematools.client.schemas.validation.ListSchemaValidator +import org.openapijsonschematools.client.schemas.validation.MapSchemaValidator +import org.openapijsonschematools.client.schemas.validation.NullSchemaValidator +import org.openapijsonschematools.client.schemas.validation.NumberSchemaValidator +import org.openapijsonschematools.client.schemas.validation.PathToSchemasMap +import org.openapijsonschematools.client.schemas.validation.StringSchemaValidator +import org.openapijsonschematools.client.schemas.validation.ValidationMetadata + +class AllofWithTwoEmptySchemas { + // nest classes so all schemas and input/output classes can be public + + + class Schema0 : AnyTypeJsonSchema.AnyTypeJsonSchema1() { + companion object { + @Volatile + private var instance: Schema0? = null + + fun getInstance() = + instance ?: synchronized(this) { + instance ?: Schema0().also { instance = it } + } + } + } + + + class Schema1 : AnyTypeJsonSchema.AnyTypeJsonSchema1() { + companion object { + @Volatile + private var instance: Schema1? = null + + fun getInstance() = + instance ?: synchronized(this) { + instance ?: Schema1().also { instance = it } + } + } + } + + + sealed interface AllofWithTwoEmptySchemas1Boxed { + fun getData(): Any? + } + + data class AllofWithTwoEmptySchemas1BoxedVoid(val data: Nothing?) : AllofWithTwoEmptySchemas1Boxed { + override fun getData(): Any? { + return data + } + } + + data class AllofWithTwoEmptySchemas1BoxedBoolean(val data: Boolean): AllofWithTwoEmptySchemas1Boxed { + override fun getData(): Any? { + return data + } + } + + data class AllofWithTwoEmptySchemas1BoxedNumber(val data: Number) : AllofWithTwoEmptySchemas1Boxed { + override fun getData(): Any? { + return data + } + } + + data class AllofWithTwoEmptySchemas1BoxedString(val data: String) : AllofWithTwoEmptySchemas1Boxed { + override fun getData(): Any? { + return data + } + } + + data class AllofWithTwoEmptySchemas1BoxedList(val data: FrozenList) : AllofWithTwoEmptySchemas1Boxed { + override fun getData(): Any? { + return data + } + } + + data class AllofWithTwoEmptySchemas1BoxedMap(val data: FrozenMap) : AllofWithTwoEmptySchemas1Boxed { + override fun getData(): Any? { + return data + } + } + + + class AllofWithTwoEmptySchemas1 private constructor(): JsonSchema( + JsonSchemaInfo() + .allOf(listOf( + Schema0::class.java, + Schema1::class.java + )) + ), NullSchemaValidator, BooleanSchemaValidator, NumberSchemaValidator, StringSchemaValidator, ListSchemaValidator, AllofWithTwoEmptySchemas1BoxedList>, MapSchemaValidator, AllofWithTwoEmptySchemas1BoxedMap> { + /* + NOTE: This class is auto generated by OpenAPI JSON Schema Generator. + Ref: https://github.com/openapi-json-schema-tools/openapi-json-schema-generator + + Do not edit the class manually. + */ + + companion object { + @Volatile + private var instance: AllofWithTwoEmptySchemas1? = null + + fun getInstance() = + instance ?: synchronized(this) { + instance ?: AllofWithTwoEmptySchemas1().also { instance = it } + } + } + + @Throws(ValidationException::class) + override fun validate(arg: Nothing?, configuration: SchemaConfiguration?): Nothing? { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validatedPathToSchemas = PathToSchemasMap() + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, LinkedHashSet()) + getPathToSchemas(this, castArg, validationMetadata, pathSet) + return castArg + } + + @Throws(ValidationException::class) + override fun validate(arg: Boolean, configuration: SchemaConfiguration?): Boolean { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validatedPathToSchemas = PathToSchemasMap() + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, LinkedHashSet()) + getPathToSchemas(this, castArg, validationMetadata, pathSet) + return castArg + } + + @Throws(ValidationException::class) + override fun validate(arg: Number, configuration: SchemaConfiguration?): Number { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validatedPathToSchemas = PathToSchemasMap() + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, LinkedHashSet()) + getPathToSchemas(this, castArg, validationMetadata, pathSet) + return castArg + } + + @Throws(ValidationException::class) + fun validate(arg: Int, configuration: SchemaConfiguration?): Int { + return validate(arg as Number, configuration) as Int + } + + @Throws(ValidationException::class) + fun validate(arg: Long, configuration: SchemaConfiguration?): Long { + return validate(arg as Number, configuration) as Long + } + + @Throws(ValidationException::class) + fun validate(arg: Float, configuration: SchemaConfiguration?): Float { + return validate(arg as Number, configuration) as Float + } + + @Throws(ValidationException::class) + fun validate(arg: Double, configuration: SchemaConfiguration?): Double { + return validate(arg as Number, configuration) as Double + } + + @Throws(ValidationException::class) + override fun validate(arg: String, configuration: SchemaConfiguration?): String { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validatedPathToSchemas = PathToSchemasMap() + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, LinkedHashSet()) + getPathToSchemas(this, castArg, validationMetadata, pathSet) + return castArg + } + + @Throws(ValidationException::class) + fun validate(arg: LocalDate, configuration: SchemaConfiguration?): String { + return validate(arg.toString(), configuration) + } + + @Throws(ValidationException::class) + fun validate(arg: ZonedDateTime, configuration: SchemaConfiguration?): String { + return validate(arg.toString(), configuration) + } + + @Throws(ValidationException::class) + fun validate(arg: UUID, configuration: SchemaConfiguration?): String { + return validate(arg.toString(), configuration) + } + + override fun getNewInstance(arg: List<*>, pathToItem: List, pathToSchemas: PathToSchemasMap): FrozenList { + val items: MutableList = ArrayList() + var i: Int = 0 + for (item: Any? in arg) { + val itemPathToItem = pathToItem + i + val schemas: LinkedHashMap, Nothing?>? = pathToSchemas.get(itemPathToItem) + if (schemas == null) { + throw RuntimeException("Validation result is invalid, schemas must exist for a pathToItem") + } + val itemSchema: JsonSchema<*> = schemas.entries.iterator().next().key + val itemInstance: Any? = itemSchema.getNewInstance(item, itemPathToItem, pathToSchemas) + items.add(itemInstance) + i += 1 + } + val newInstanceItems: FrozenList = FrozenList(items) + return newInstanceItems + } + + @Throws(ValidationException::class) + override fun validate(arg: List<*>, configuration: SchemaConfiguration?): FrozenList { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, PathToSchemasMap(), LinkedHashSet()) + val pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet) + return getNewInstance(castArg, validationMetadata.pathToItem, pathToSchemasMap) + } + + override fun getNewInstance(arg: Map<*, *>, pathToItem: List, pathToSchemas: PathToSchemasMap): FrozenMap { + val properties: LinkedHashMap = LinkedHashMap() + for((propertyName, value) in arg) { + if (!(propertyName is String)) { + throw RuntimeException("Invalid non-string key value") + } + val propertyPathToItem: List = pathToItem + propertyName + val schemas: LinkedHashMap, Nothing?>? = pathToSchemas.get(propertyPathToItem) + if (schemas == null) { + throw RuntimeException("Validation result is invalid, schemas must exist for a pathToItem") + } + val propertySchema: JsonSchema<*> = schemas.entries.iterator().next().key + val propertyInstance: Any? = propertySchema.getNewInstance(value, propertyPathToItem, pathToSchemas) + properties[propertyName] = propertyInstance + } + val castProperties: FrozenMap = FrozenMap(properties) + return castProperties + } + + @Throws(ValidationException::class) + override fun validate(arg: Map<*, *>, configuration: SchemaConfiguration?): FrozenMap { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validatedPathToSchemas = PathToSchemasMap() + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, LinkedHashSet()) + val pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet) + return getNewInstance(castArg, validationMetadata.pathToItem, pathToSchemasMap) + } + + @Throws(ValidationException::class) + override fun validate(arg: Any?, configuration: SchemaConfiguration?): Any? { + if (arg == null) { + return validate(null, configuration) + } else if (arg is Boolean) { + return validate(arg, configuration) + } else if (arg is Number) { + return validate(arg, configuration) + } else if (arg is String) { + return validate(arg, configuration) + } else if (arg is List<*>) { + return validate(arg, configuration) + } else if (arg is Map<*, *>) { + return validate(arg, configuration) + } + throw ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema") + } + override fun getNewInstance(arg: Any?, pathToItem: List, pathToSchemas: PathToSchemasMap): Any? { + if (arg == null) { + return getNewInstance( null, pathToItem, pathToSchemas) + } else if (arg is Boolean) { + return getNewInstance(arg, pathToItem, pathToSchemas) + } else if (arg is Number) { + return getNewInstance(arg, pathToItem, pathToSchemas) + } else if (arg is String) { + return getNewInstance(arg, pathToItem, pathToSchemas) + } else if (arg is List<*>) { + return getNewInstance(arg, pathToItem, pathToSchemas) + } else if (arg is Map<*, *>) { + return getNewInstance(arg, pathToItem, pathToSchemas) + } + throw RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema") + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: Nothing?, configuration: SchemaConfiguration?): AllofWithTwoEmptySchemas1BoxedVoid { + return AllofWithTwoEmptySchemas1BoxedVoid(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: Boolean, configuration: SchemaConfiguration?): AllofWithTwoEmptySchemas1BoxedBoolean { + return AllofWithTwoEmptySchemas1BoxedBoolean(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: Number, configuration: SchemaConfiguration?): AllofWithTwoEmptySchemas1BoxedNumber { + return AllofWithTwoEmptySchemas1BoxedNumber(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: String, configuration: SchemaConfiguration?): AllofWithTwoEmptySchemas1BoxedString { + return AllofWithTwoEmptySchemas1BoxedString(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: List<*>, configuration: SchemaConfiguration?): AllofWithTwoEmptySchemas1BoxedList { + return AllofWithTwoEmptySchemas1BoxedList(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: Map<*, *>, configuration: SchemaConfiguration?): AllofWithTwoEmptySchemas1BoxedMap { + return AllofWithTwoEmptySchemas1BoxedMap(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: Any?, configuration: SchemaConfiguration?): AllofWithTwoEmptySchemas1Boxed { + if (arg == null) { + return validateAndBox(null, configuration) + } else if (arg is Boolean) { + return validateAndBox(arg, configuration) + } else if (arg is String) { + return validateAndBox(arg, configuration) + } else if (arg is Number) { + return validateAndBox(arg, configuration) + } else if (arg is List<*>) { + return validateAndBox(arg, configuration) + } else if (arg is Map<*, *>) { + return validateAndBox(arg, configuration) + } + throw ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema") + } + } +} diff --git a/samples/client/3_1_0_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/schemas/Anyof.kt b/samples/client/3_1_0_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/schemas/Anyof.kt new file mode 100644 index 00000000000..c71b31c6ce0 --- /dev/null +++ b/samples/client/3_1_0_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/schemas/Anyof.kt @@ -0,0 +1,600 @@ +package org.openapijsonschematools.client.components.schemas +import java.time.LocalDate +import java.time.ZonedDateTime +import java.util.UUID +import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags +import org.openapijsonschematools.client.configurations.SchemaConfiguration +import org.openapijsonschematools.client.exceptions.InvalidAdditionalPropertyException +import org.openapijsonschematools.client.exceptions.UnsetPropertyException +import org.openapijsonschematools.client.exceptions.ValidationException +import org.openapijsonschematools.client.schemas.IntJsonSchema +import org.openapijsonschematools.client.schemas.UnsetAddPropsSetter +import org.openapijsonschematools.client.schemas.validation.BooleanSchemaValidator +import org.openapijsonschematools.client.schemas.validation.FrozenList +import org.openapijsonschematools.client.schemas.validation.FrozenMap +import org.openapijsonschematools.client.schemas.validation.JsonSchema +import org.openapijsonschematools.client.schemas.validation.JsonSchemaInfo +import org.openapijsonschematools.client.schemas.validation.ListSchemaValidator +import org.openapijsonschematools.client.schemas.validation.MapSchemaValidator +import org.openapijsonschematools.client.schemas.validation.NullSchemaValidator +import org.openapijsonschematools.client.schemas.validation.NumberSchemaValidator +import org.openapijsonschematools.client.schemas.validation.PathToSchemasMap +import org.openapijsonschematools.client.schemas.validation.StringSchemaValidator +import org.openapijsonschematools.client.schemas.validation.ValidationMetadata + +class Anyof { + // nest classes so all schemas and input/output classes can be public + + + class Schema0 : IntJsonSchema.IntJsonSchema1() { + companion object { + @Volatile + private var instance: Schema0? = null + + fun getInstance() = + instance ?: synchronized(this) { + instance ?: Schema0().also { instance = it } + } + } + } + + + sealed interface Schema1Boxed { + fun getData(): Any? + } + + data class Schema1BoxedVoid(val data: Nothing?) : Schema1Boxed { + override fun getData(): Any? { + return data + } + } + + data class Schema1BoxedBoolean(val data: Boolean): Schema1Boxed { + override fun getData(): Any? { + return data + } + } + + data class Schema1BoxedNumber(val data: Number) : Schema1Boxed { + override fun getData(): Any? { + return data + } + } + + data class Schema1BoxedString(val data: String) : Schema1Boxed { + override fun getData(): Any? { + return data + } + } + + data class Schema1BoxedList(val data: FrozenList) : Schema1Boxed { + override fun getData(): Any? { + return data + } + } + + data class Schema1BoxedMap(val data: FrozenMap) : Schema1Boxed { + override fun getData(): Any? { + return data + } + } + + + class Schema1 private constructor(): JsonSchema( + JsonSchemaInfo() + .minimum(2) + ), NullSchemaValidator, BooleanSchemaValidator, NumberSchemaValidator, StringSchemaValidator, ListSchemaValidator, Schema1BoxedList>, MapSchemaValidator, Schema1BoxedMap> { + + companion object { + @Volatile + private var instance: Schema1? = null + + fun getInstance() = + instance ?: synchronized(this) { + instance ?: Schema1().also { instance = it } + } + } + + @Throws(ValidationException::class) + override fun validate(arg: Nothing?, configuration: SchemaConfiguration?): Nothing? { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validatedPathToSchemas = PathToSchemasMap() + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, LinkedHashSet()) + getPathToSchemas(this, castArg, validationMetadata, pathSet) + return castArg + } + + @Throws(ValidationException::class) + override fun validate(arg: Boolean, configuration: SchemaConfiguration?): Boolean { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validatedPathToSchemas = PathToSchemasMap() + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, LinkedHashSet()) + getPathToSchemas(this, castArg, validationMetadata, pathSet) + return castArg + } + + @Throws(ValidationException::class) + override fun validate(arg: Number, configuration: SchemaConfiguration?): Number { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validatedPathToSchemas = PathToSchemasMap() + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, LinkedHashSet()) + getPathToSchemas(this, castArg, validationMetadata, pathSet) + return castArg + } + + @Throws(ValidationException::class) + fun validate(arg: Int, configuration: SchemaConfiguration?): Int { + return validate(arg as Number, configuration) as Int + } + + @Throws(ValidationException::class) + fun validate(arg: Long, configuration: SchemaConfiguration?): Long { + return validate(arg as Number, configuration) as Long + } + + @Throws(ValidationException::class) + fun validate(arg: Float, configuration: SchemaConfiguration?): Float { + return validate(arg as Number, configuration) as Float + } + + @Throws(ValidationException::class) + fun validate(arg: Double, configuration: SchemaConfiguration?): Double { + return validate(arg as Number, configuration) as Double + } + + @Throws(ValidationException::class) + override fun validate(arg: String, configuration: SchemaConfiguration?): String { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validatedPathToSchemas = PathToSchemasMap() + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, LinkedHashSet()) + getPathToSchemas(this, castArg, validationMetadata, pathSet) + return castArg + } + + @Throws(ValidationException::class) + fun validate(arg: LocalDate, configuration: SchemaConfiguration?): String { + return validate(arg.toString(), configuration) + } + + @Throws(ValidationException::class) + fun validate(arg: ZonedDateTime, configuration: SchemaConfiguration?): String { + return validate(arg.toString(), configuration) + } + + @Throws(ValidationException::class) + fun validate(arg: UUID, configuration: SchemaConfiguration?): String { + return validate(arg.toString(), configuration) + } + + override fun getNewInstance(arg: List<*>, pathToItem: List, pathToSchemas: PathToSchemasMap): FrozenList { + val items: MutableList = ArrayList() + var i: Int = 0 + for (item: Any? in arg) { + val itemPathToItem = pathToItem + i + val schemas: LinkedHashMap, Nothing?>? = pathToSchemas.get(itemPathToItem) + if (schemas == null) { + throw RuntimeException("Validation result is invalid, schemas must exist for a pathToItem") + } + val itemSchema: JsonSchema<*> = schemas.entries.iterator().next().key + val itemInstance: Any? = itemSchema.getNewInstance(item, itemPathToItem, pathToSchemas) + items.add(itemInstance) + i += 1 + } + val newInstanceItems: FrozenList = FrozenList(items) + return newInstanceItems + } + + @Throws(ValidationException::class) + override fun validate(arg: List<*>, configuration: SchemaConfiguration?): FrozenList { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, PathToSchemasMap(), LinkedHashSet()) + val pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet) + return getNewInstance(castArg, validationMetadata.pathToItem, pathToSchemasMap) + } + + override fun getNewInstance(arg: Map<*, *>, pathToItem: List, pathToSchemas: PathToSchemasMap): FrozenMap { + val properties: LinkedHashMap = LinkedHashMap() + for((propertyName, value) in arg) { + if (!(propertyName is String)) { + throw RuntimeException("Invalid non-string key value") + } + val propertyPathToItem: List = pathToItem + propertyName + val schemas: LinkedHashMap, Nothing?>? = pathToSchemas.get(propertyPathToItem) + if (schemas == null) { + throw RuntimeException("Validation result is invalid, schemas must exist for a pathToItem") + } + val propertySchema: JsonSchema<*> = schemas.entries.iterator().next().key + val propertyInstance: Any? = propertySchema.getNewInstance(value, propertyPathToItem, pathToSchemas) + properties[propertyName] = propertyInstance + } + val castProperties: FrozenMap = FrozenMap(properties) + return castProperties + } + + @Throws(ValidationException::class) + override fun validate(arg: Map<*, *>, configuration: SchemaConfiguration?): FrozenMap { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validatedPathToSchemas = PathToSchemasMap() + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, LinkedHashSet()) + val pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet) + return getNewInstance(castArg, validationMetadata.pathToItem, pathToSchemasMap) + } + + @Throws(ValidationException::class) + override fun validate(arg: Any?, configuration: SchemaConfiguration?): Any? { + if (arg == null) { + return validate(null, configuration) + } else if (arg is Boolean) { + return validate(arg, configuration) + } else if (arg is Number) { + return validate(arg, configuration) + } else if (arg is String) { + return validate(arg, configuration) + } else if (arg is List<*>) { + return validate(arg, configuration) + } else if (arg is Map<*, *>) { + return validate(arg, configuration) + } + throw ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema") + } + override fun getNewInstance(arg: Any?, pathToItem: List, pathToSchemas: PathToSchemasMap): Any? { + if (arg == null) { + return getNewInstance( null, pathToItem, pathToSchemas) + } else if (arg is Boolean) { + return getNewInstance(arg, pathToItem, pathToSchemas) + } else if (arg is Number) { + return getNewInstance(arg, pathToItem, pathToSchemas) + } else if (arg is String) { + return getNewInstance(arg, pathToItem, pathToSchemas) + } else if (arg is List<*>) { + return getNewInstance(arg, pathToItem, pathToSchemas) + } else if (arg is Map<*, *>) { + return getNewInstance(arg, pathToItem, pathToSchemas) + } + throw RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema") + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: Nothing?, configuration: SchemaConfiguration?): Schema1BoxedVoid { + return Schema1BoxedVoid(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: Boolean, configuration: SchemaConfiguration?): Schema1BoxedBoolean { + return Schema1BoxedBoolean(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: Number, configuration: SchemaConfiguration?): Schema1BoxedNumber { + return Schema1BoxedNumber(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: String, configuration: SchemaConfiguration?): Schema1BoxedString { + return Schema1BoxedString(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: List<*>, configuration: SchemaConfiguration?): Schema1BoxedList { + return Schema1BoxedList(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: Map<*, *>, configuration: SchemaConfiguration?): Schema1BoxedMap { + return Schema1BoxedMap(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: Any?, configuration: SchemaConfiguration?): Schema1Boxed { + if (arg == null) { + return validateAndBox(null, configuration) + } else if (arg is Boolean) { + return validateAndBox(arg, configuration) + } else if (arg is String) { + return validateAndBox(arg, configuration) + } else if (arg is Number) { + return validateAndBox(arg, configuration) + } else if (arg is List<*>) { + return validateAndBox(arg, configuration) + } else if (arg is Map<*, *>) { + return validateAndBox(arg, configuration) + } + throw ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema") + } + } + + sealed interface Anyof1Boxed { + fun getData(): Any? + } + + data class Anyof1BoxedVoid(val data: Nothing?) : Anyof1Boxed { + override fun getData(): Any? { + return data + } + } + + data class Anyof1BoxedBoolean(val data: Boolean): Anyof1Boxed { + override fun getData(): Any? { + return data + } + } + + data class Anyof1BoxedNumber(val data: Number) : Anyof1Boxed { + override fun getData(): Any? { + return data + } + } + + data class Anyof1BoxedString(val data: String) : Anyof1Boxed { + override fun getData(): Any? { + return data + } + } + + data class Anyof1BoxedList(val data: FrozenList) : Anyof1Boxed { + override fun getData(): Any? { + return data + } + } + + data class Anyof1BoxedMap(val data: FrozenMap) : Anyof1Boxed { + override fun getData(): Any? { + return data + } + } + + + class Anyof1 private constructor(): JsonSchema( + JsonSchemaInfo() + .anyOf(listOf( + Schema0::class.java, + Schema1::class.java + )) + ), NullSchemaValidator, BooleanSchemaValidator, NumberSchemaValidator, StringSchemaValidator, ListSchemaValidator, Anyof1BoxedList>, MapSchemaValidator, Anyof1BoxedMap> { + /* + NOTE: This class is auto generated by OpenAPI JSON Schema Generator. + Ref: https://github.com/openapi-json-schema-tools/openapi-json-schema-generator + + Do not edit the class manually. + */ + + companion object { + @Volatile + private var instance: Anyof1? = null + + fun getInstance() = + instance ?: synchronized(this) { + instance ?: Anyof1().also { instance = it } + } + } + + @Throws(ValidationException::class) + override fun validate(arg: Nothing?, configuration: SchemaConfiguration?): Nothing? { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validatedPathToSchemas = PathToSchemasMap() + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, LinkedHashSet()) + getPathToSchemas(this, castArg, validationMetadata, pathSet) + return castArg + } + + @Throws(ValidationException::class) + override fun validate(arg: Boolean, configuration: SchemaConfiguration?): Boolean { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validatedPathToSchemas = PathToSchemasMap() + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, LinkedHashSet()) + getPathToSchemas(this, castArg, validationMetadata, pathSet) + return castArg + } + + @Throws(ValidationException::class) + override fun validate(arg: Number, configuration: SchemaConfiguration?): Number { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validatedPathToSchemas = PathToSchemasMap() + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, LinkedHashSet()) + getPathToSchemas(this, castArg, validationMetadata, pathSet) + return castArg + } + + @Throws(ValidationException::class) + fun validate(arg: Int, configuration: SchemaConfiguration?): Int { + return validate(arg as Number, configuration) as Int + } + + @Throws(ValidationException::class) + fun validate(arg: Long, configuration: SchemaConfiguration?): Long { + return validate(arg as Number, configuration) as Long + } + + @Throws(ValidationException::class) + fun validate(arg: Float, configuration: SchemaConfiguration?): Float { + return validate(arg as Number, configuration) as Float + } + + @Throws(ValidationException::class) + fun validate(arg: Double, configuration: SchemaConfiguration?): Double { + return validate(arg as Number, configuration) as Double + } + + @Throws(ValidationException::class) + override fun validate(arg: String, configuration: SchemaConfiguration?): String { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validatedPathToSchemas = PathToSchemasMap() + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, LinkedHashSet()) + getPathToSchemas(this, castArg, validationMetadata, pathSet) + return castArg + } + + @Throws(ValidationException::class) + fun validate(arg: LocalDate, configuration: SchemaConfiguration?): String { + return validate(arg.toString(), configuration) + } + + @Throws(ValidationException::class) + fun validate(arg: ZonedDateTime, configuration: SchemaConfiguration?): String { + return validate(arg.toString(), configuration) + } + + @Throws(ValidationException::class) + fun validate(arg: UUID, configuration: SchemaConfiguration?): String { + return validate(arg.toString(), configuration) + } + + override fun getNewInstance(arg: List<*>, pathToItem: List, pathToSchemas: PathToSchemasMap): FrozenList { + val items: MutableList = ArrayList() + var i: Int = 0 + for (item: Any? in arg) { + val itemPathToItem = pathToItem + i + val schemas: LinkedHashMap, Nothing?>? = pathToSchemas.get(itemPathToItem) + if (schemas == null) { + throw RuntimeException("Validation result is invalid, schemas must exist for a pathToItem") + } + val itemSchema: JsonSchema<*> = schemas.entries.iterator().next().key + val itemInstance: Any? = itemSchema.getNewInstance(item, itemPathToItem, pathToSchemas) + items.add(itemInstance) + i += 1 + } + val newInstanceItems: FrozenList = FrozenList(items) + return newInstanceItems + } + + @Throws(ValidationException::class) + override fun validate(arg: List<*>, configuration: SchemaConfiguration?): FrozenList { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, PathToSchemasMap(), LinkedHashSet()) + val pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet) + return getNewInstance(castArg, validationMetadata.pathToItem, pathToSchemasMap) + } + + override fun getNewInstance(arg: Map<*, *>, pathToItem: List, pathToSchemas: PathToSchemasMap): FrozenMap { + val properties: LinkedHashMap = LinkedHashMap() + for((propertyName, value) in arg) { + if (!(propertyName is String)) { + throw RuntimeException("Invalid non-string key value") + } + val propertyPathToItem: List = pathToItem + propertyName + val schemas: LinkedHashMap, Nothing?>? = pathToSchemas.get(propertyPathToItem) + if (schemas == null) { + throw RuntimeException("Validation result is invalid, schemas must exist for a pathToItem") + } + val propertySchema: JsonSchema<*> = schemas.entries.iterator().next().key + val propertyInstance: Any? = propertySchema.getNewInstance(value, propertyPathToItem, pathToSchemas) + properties[propertyName] = propertyInstance + } + val castProperties: FrozenMap = FrozenMap(properties) + return castProperties + } + + @Throws(ValidationException::class) + override fun validate(arg: Map<*, *>, configuration: SchemaConfiguration?): FrozenMap { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validatedPathToSchemas = PathToSchemasMap() + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, LinkedHashSet()) + val pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet) + return getNewInstance(castArg, validationMetadata.pathToItem, pathToSchemasMap) + } + + @Throws(ValidationException::class) + override fun validate(arg: Any?, configuration: SchemaConfiguration?): Any? { + if (arg == null) { + return validate(null, configuration) + } else if (arg is Boolean) { + return validate(arg, configuration) + } else if (arg is Number) { + return validate(arg, configuration) + } else if (arg is String) { + return validate(arg, configuration) + } else if (arg is List<*>) { + return validate(arg, configuration) + } else if (arg is Map<*, *>) { + return validate(arg, configuration) + } + throw ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema") + } + override fun getNewInstance(arg: Any?, pathToItem: List, pathToSchemas: PathToSchemasMap): Any? { + if (arg == null) { + return getNewInstance( null, pathToItem, pathToSchemas) + } else if (arg is Boolean) { + return getNewInstance(arg, pathToItem, pathToSchemas) + } else if (arg is Number) { + return getNewInstance(arg, pathToItem, pathToSchemas) + } else if (arg is String) { + return getNewInstance(arg, pathToItem, pathToSchemas) + } else if (arg is List<*>) { + return getNewInstance(arg, pathToItem, pathToSchemas) + } else if (arg is Map<*, *>) { + return getNewInstance(arg, pathToItem, pathToSchemas) + } + throw RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema") + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: Nothing?, configuration: SchemaConfiguration?): Anyof1BoxedVoid { + return Anyof1BoxedVoid(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: Boolean, configuration: SchemaConfiguration?): Anyof1BoxedBoolean { + return Anyof1BoxedBoolean(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: Number, configuration: SchemaConfiguration?): Anyof1BoxedNumber { + return Anyof1BoxedNumber(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: String, configuration: SchemaConfiguration?): Anyof1BoxedString { + return Anyof1BoxedString(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: List<*>, configuration: SchemaConfiguration?): Anyof1BoxedList { + return Anyof1BoxedList(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: Map<*, *>, configuration: SchemaConfiguration?): Anyof1BoxedMap { + return Anyof1BoxedMap(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: Any?, configuration: SchemaConfiguration?): Anyof1Boxed { + if (arg == null) { + return validateAndBox(null, configuration) + } else if (arg is Boolean) { + return validateAndBox(arg, configuration) + } else if (arg is String) { + return validateAndBox(arg, configuration) + } else if (arg is Number) { + return validateAndBox(arg, configuration) + } else if (arg is List<*>) { + return validateAndBox(arg, configuration) + } else if (arg is Map<*, *>) { + return validateAndBox(arg, configuration) + } + throw ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema") + } + } +} diff --git a/samples/client/3_1_0_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/schemas/AnyofComplexTypes.kt b/samples/client/3_1_0_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/schemas/AnyofComplexTypes.kt new file mode 100644 index 00000000000..8abf0c0c3cb --- /dev/null +++ b/samples/client/3_1_0_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/schemas/AnyofComplexTypes.kt @@ -0,0 +1,1060 @@ +package org.openapijsonschematools.client.components.schemas +import java.time.LocalDate +import java.time.ZonedDateTime +import java.util.UUID +import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags +import org.openapijsonschematools.client.configurations.SchemaConfiguration +import org.openapijsonschematools.client.exceptions.InvalidAdditionalPropertyException +import org.openapijsonschematools.client.exceptions.UnsetPropertyException +import org.openapijsonschematools.client.exceptions.ValidationException +import org.openapijsonschematools.client.schemas.GenericBuilder +import org.openapijsonschematools.client.schemas.IntJsonSchema +import org.openapijsonschematools.client.schemas.StringJsonSchema +import org.openapijsonschematools.client.schemas.UnsetAddPropsSetter +import org.openapijsonschematools.client.schemas.validation.BooleanSchemaValidator +import org.openapijsonschematools.client.schemas.validation.FrozenList +import org.openapijsonschematools.client.schemas.validation.FrozenMap +import org.openapijsonschematools.client.schemas.validation.JsonSchema +import org.openapijsonschematools.client.schemas.validation.JsonSchemaInfo +import org.openapijsonschematools.client.schemas.validation.ListSchemaValidator +import org.openapijsonschematools.client.schemas.validation.MapSchemaValidator +import org.openapijsonschematools.client.schemas.validation.NullSchemaValidator +import org.openapijsonschematools.client.schemas.validation.NumberSchemaValidator +import org.openapijsonschematools.client.schemas.validation.PathToSchemasMap +import org.openapijsonschematools.client.schemas.validation.StringSchemaValidator +import org.openapijsonschematools.client.schemas.validation.ValidationMetadata + +class AnyofComplexTypes { + // nest classes so all schemas and input/output classes can be public + + + class Bar : IntJsonSchema.IntJsonSchema1() { + companion object { + @Volatile + private var instance: Bar? = null + + fun getInstance() = + instance ?: synchronized(this) { + instance ?: Bar().also { instance = it } + } + } + } + + + class Schema0Map(m: FrozenMap) : FrozenMap(m) { + companion object { + val requiredKeys: Set = setOf( + "bar" + ) + val optionalKeys: Set = setOf() + @Throws(ValidationException::class) + fun of(arg: Map, configuration: SchemaConfiguration): Schema0Map { + return Schema0.getInstance().validate(arg, configuration) + } + } + + fun bar(): Number { + val value: Any? = get("bar") + if (!(value is Number)) { + throw RuntimeException("Invalid value stored for bar") + } + return value + } + + @Throws(UnsetPropertyException::class, InvalidAdditionalPropertyException::class) + fun getAdditionalProperty(name: String): Any? { + throwIfKeyKnown(name, requiredKeys, optionalKeys) + throwIfKeyNotPresent(name) + return get(name) + } + } + + interface SetterForBar { + fun getInstance(): MutableMap + fun getBuilderAfterBar(instance: MutableMap): T + + fun bar(value: Int): T { + val instance = getInstance() + instance["bar"] = value + return getBuilderAfterBar(instance) + } + + fun bar(value: Float): T { + val instance = getInstance() + instance["bar"] = value + return getBuilderAfterBar(instance) + } + + fun bar(value: Long): T { + val instance = getInstance() + instance["bar"] = value + return getBuilderAfterBar(instance) + } + + fun bar(value: Double): T { + val instance = getInstance() + instance["bar"] = value + return getBuilderAfterBar(instance) + } + } + + class Schema0Map0Builder(private val instance: MutableMap): UnsetAddPropsSetter, GenericBuilder> { + private val knownKeys: Set = setOf( + "bar" + ) + override fun getKnownKeys(): Set { + return knownKeys + } + override fun build(): Map { + return instance + } + override fun getInstance(): MutableMap { + return instance + } + override fun getBuilderAfterAdditionalProperty(instance: MutableMap): Schema0Map0Builder { + return this + } + } + + class Schema0MapBuilder: SetterForBar { + private val instance: MutableMap + init { + this.instance = LinkedHashMap() + } + override fun getInstance(): MutableMap { + return instance + } + override fun getBuilderAfterBar(instance: MutableMap): Schema0Map0Builder { + return Schema0Map0Builder(instance) + } + } + + + sealed interface Schema0Boxed { + fun getData(): Any? + } + + data class Schema0BoxedVoid(val data: Nothing?) : Schema0Boxed { + override fun getData(): Any? { + return data + } + } + + data class Schema0BoxedBoolean(val data: Boolean): Schema0Boxed { + override fun getData(): Any? { + return data + } + } + + data class Schema0BoxedNumber(val data: Number) : Schema0Boxed { + override fun getData(): Any? { + return data + } + } + + data class Schema0BoxedString(val data: String) : Schema0Boxed { + override fun getData(): Any? { + return data + } + } + + data class Schema0BoxedList(val data: FrozenList) : Schema0Boxed { + override fun getData(): Any? { + return data + } + } + + data class Schema0BoxedMap(val data: Schema0Map) : Schema0Boxed { + override fun getData(): Any? { + return data + } + } + + + class Schema0 private constructor(): JsonSchema( + JsonSchemaInfo() + .properties(mapOf( + "bar" to Bar::class.java + )) + .required(setOf( + "bar" + )) + ), NullSchemaValidator, BooleanSchemaValidator, NumberSchemaValidator, StringSchemaValidator, ListSchemaValidator, Schema0BoxedList>, MapSchemaValidator { + + companion object { + @Volatile + private var instance: Schema0? = null + + fun getInstance() = + instance ?: synchronized(this) { + instance ?: Schema0().also { instance = it } + } + } + + @Throws(ValidationException::class) + override fun validate(arg: Nothing?, configuration: SchemaConfiguration?): Nothing? { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validatedPathToSchemas = PathToSchemasMap() + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, LinkedHashSet()) + getPathToSchemas(this, castArg, validationMetadata, pathSet) + return castArg + } + + @Throws(ValidationException::class) + override fun validate(arg: Boolean, configuration: SchemaConfiguration?): Boolean { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validatedPathToSchemas = PathToSchemasMap() + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, LinkedHashSet()) + getPathToSchemas(this, castArg, validationMetadata, pathSet) + return castArg + } + + @Throws(ValidationException::class) + override fun validate(arg: Number, configuration: SchemaConfiguration?): Number { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validatedPathToSchemas = PathToSchemasMap() + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, LinkedHashSet()) + getPathToSchemas(this, castArg, validationMetadata, pathSet) + return castArg + } + + @Throws(ValidationException::class) + fun validate(arg: Int, configuration: SchemaConfiguration?): Int { + return validate(arg as Number, configuration) as Int + } + + @Throws(ValidationException::class) + fun validate(arg: Long, configuration: SchemaConfiguration?): Long { + return validate(arg as Number, configuration) as Long + } + + @Throws(ValidationException::class) + fun validate(arg: Float, configuration: SchemaConfiguration?): Float { + return validate(arg as Number, configuration) as Float + } + + @Throws(ValidationException::class) + fun validate(arg: Double, configuration: SchemaConfiguration?): Double { + return validate(arg as Number, configuration) as Double + } + + @Throws(ValidationException::class) + override fun validate(arg: String, configuration: SchemaConfiguration?): String { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validatedPathToSchemas = PathToSchemasMap() + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, LinkedHashSet()) + getPathToSchemas(this, castArg, validationMetadata, pathSet) + return castArg + } + + @Throws(ValidationException::class) + fun validate(arg: LocalDate, configuration: SchemaConfiguration?): String { + return validate(arg.toString(), configuration) + } + + @Throws(ValidationException::class) + fun validate(arg: ZonedDateTime, configuration: SchemaConfiguration?): String { + return validate(arg.toString(), configuration) + } + + @Throws(ValidationException::class) + fun validate(arg: UUID, configuration: SchemaConfiguration?): String { + return validate(arg.toString(), configuration) + } + + override fun getNewInstance(arg: List<*>, pathToItem: List, pathToSchemas: PathToSchemasMap): FrozenList { + val items: MutableList = ArrayList() + var i: Int = 0 + for (item: Any? in arg) { + val itemPathToItem = pathToItem + i + val schemas: LinkedHashMap, Nothing?>? = pathToSchemas.get(itemPathToItem) + if (schemas == null) { + throw RuntimeException("Validation result is invalid, schemas must exist for a pathToItem") + } + val itemSchema: JsonSchema<*> = schemas.entries.iterator().next().key + val itemInstance: Any? = itemSchema.getNewInstance(item, itemPathToItem, pathToSchemas) + items.add(itemInstance) + i += 1 + } + val newInstanceItems: FrozenList = FrozenList(items) + return newInstanceItems + } + + @Throws(ValidationException::class) + override fun validate(arg: List<*>, configuration: SchemaConfiguration?): FrozenList { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, PathToSchemasMap(), LinkedHashSet()) + val pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet) + return getNewInstance(castArg, validationMetadata.pathToItem, pathToSchemasMap) + } + + override fun getNewInstance(arg: Map<*, *>, pathToItem: List, pathToSchemas: PathToSchemasMap): Schema0Map { + val properties: LinkedHashMap = LinkedHashMap() + for((propertyName, value) in arg) { + if (!(propertyName is String)) { + throw RuntimeException("Invalid non-string key value") + } + val propertyPathToItem: List = pathToItem + propertyName + val schemas: LinkedHashMap, Nothing?>? = pathToSchemas.get(propertyPathToItem) + if (schemas == null) { + throw RuntimeException("Validation result is invalid, schemas must exist for a pathToItem") + } + val propertySchema: JsonSchema<*> = schemas.entries.iterator().next().key + val propertyInstance: Any? = propertySchema.getNewInstance(value, propertyPathToItem, pathToSchemas) + properties[propertyName] = propertyInstance + } + val castProperties: FrozenMap = FrozenMap(properties) + return Schema0Map(castProperties) + } + + @Throws(ValidationException::class) + override fun validate(arg: Map<*, *>, configuration: SchemaConfiguration?): Schema0Map { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validatedPathToSchemas = PathToSchemasMap() + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, LinkedHashSet()) + val pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet) + return getNewInstance(castArg, validationMetadata.pathToItem, pathToSchemasMap) + } + + @Throws(ValidationException::class) + override fun validate(arg: Any?, configuration: SchemaConfiguration?): Any? { + if (arg == null) { + return validate(null, configuration) + } else if (arg is Boolean) { + return validate(arg, configuration) + } else if (arg is Number) { + return validate(arg, configuration) + } else if (arg is String) { + return validate(arg, configuration) + } else if (arg is List<*>) { + return validate(arg, configuration) + } else if (arg is Map<*, *>) { + return validate(arg, configuration) + } + throw ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema") + } + override fun getNewInstance(arg: Any?, pathToItem: List, pathToSchemas: PathToSchemasMap): Any? { + if (arg == null) { + return getNewInstance( null, pathToItem, pathToSchemas) + } else if (arg is Boolean) { + return getNewInstance(arg, pathToItem, pathToSchemas) + } else if (arg is Number) { + return getNewInstance(arg, pathToItem, pathToSchemas) + } else if (arg is String) { + return getNewInstance(arg, pathToItem, pathToSchemas) + } else if (arg is List<*>) { + return getNewInstance(arg, pathToItem, pathToSchemas) + } else if (arg is Map<*, *>) { + return getNewInstance(arg, pathToItem, pathToSchemas) + } + throw RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema") + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: Nothing?, configuration: SchemaConfiguration?): Schema0BoxedVoid { + return Schema0BoxedVoid(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: Boolean, configuration: SchemaConfiguration?): Schema0BoxedBoolean { + return Schema0BoxedBoolean(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: Number, configuration: SchemaConfiguration?): Schema0BoxedNumber { + return Schema0BoxedNumber(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: String, configuration: SchemaConfiguration?): Schema0BoxedString { + return Schema0BoxedString(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: List<*>, configuration: SchemaConfiguration?): Schema0BoxedList { + return Schema0BoxedList(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: Map<*, *>, configuration: SchemaConfiguration?): Schema0BoxedMap { + return Schema0BoxedMap(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: Any?, configuration: SchemaConfiguration?): Schema0Boxed { + if (arg == null) { + return validateAndBox(null, configuration) + } else if (arg is Boolean) { + return validateAndBox(arg, configuration) + } else if (arg is String) { + return validateAndBox(arg, configuration) + } else if (arg is Number) { + return validateAndBox(arg, configuration) + } else if (arg is List<*>) { + return validateAndBox(arg, configuration) + } else if (arg is Map<*, *>) { + return validateAndBox(arg, configuration) + } + throw ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema") + } + } + + class Foo : StringJsonSchema.StringJsonSchema1() { + companion object { + @Volatile + private var instance: Foo? = null + + fun getInstance() = + instance ?: synchronized(this) { + instance ?: Foo().also { instance = it } + } + } + } + + + class Schema1Map(m: FrozenMap) : FrozenMap(m) { + companion object { + val requiredKeys: Set = setOf( + "foo" + ) + val optionalKeys: Set = setOf() + @Throws(ValidationException::class) + fun of(arg: Map, configuration: SchemaConfiguration): Schema1Map { + return Schema1.getInstance().validate(arg, configuration) + } + } + + fun foo(): String { + val value: Any? = get("foo") + if (!(value is String)) { + throw RuntimeException("Invalid value stored for foo") + } + return value + } + + @Throws(UnsetPropertyException::class, InvalidAdditionalPropertyException::class) + fun getAdditionalProperty(name: String): Any? { + throwIfKeyKnown(name, requiredKeys, optionalKeys) + throwIfKeyNotPresent(name) + return get(name) + } + } + + interface SetterForFoo { + fun getInstance(): MutableMap + fun getBuilderAfterFoo(instance: MutableMap): T + + fun foo(value: String): T { + val instance = getInstance() + instance["foo"] = value + return getBuilderAfterFoo(instance) + } + } + + class Schema1Map0Builder(private val instance: MutableMap): UnsetAddPropsSetter, GenericBuilder> { + private val knownKeys: Set = setOf( + "foo" + ) + override fun getKnownKeys(): Set { + return knownKeys + } + override fun build(): Map { + return instance + } + override fun getInstance(): MutableMap { + return instance + } + override fun getBuilderAfterAdditionalProperty(instance: MutableMap): Schema1Map0Builder { + return this + } + } + + class Schema1MapBuilder: SetterForFoo { + private val instance: MutableMap + init { + this.instance = LinkedHashMap() + } + override fun getInstance(): MutableMap { + return instance + } + override fun getBuilderAfterFoo(instance: MutableMap): Schema1Map0Builder { + return Schema1Map0Builder(instance) + } + } + + + sealed interface Schema1Boxed { + fun getData(): Any? + } + + data class Schema1BoxedVoid(val data: Nothing?) : Schema1Boxed { + override fun getData(): Any? { + return data + } + } + + data class Schema1BoxedBoolean(val data: Boolean): Schema1Boxed { + override fun getData(): Any? { + return data + } + } + + data class Schema1BoxedNumber(val data: Number) : Schema1Boxed { + override fun getData(): Any? { + return data + } + } + + data class Schema1BoxedString(val data: String) : Schema1Boxed { + override fun getData(): Any? { + return data + } + } + + data class Schema1BoxedList(val data: FrozenList) : Schema1Boxed { + override fun getData(): Any? { + return data + } + } + + data class Schema1BoxedMap(val data: Schema1Map) : Schema1Boxed { + override fun getData(): Any? { + return data + } + } + + + class Schema1 private constructor(): JsonSchema( + JsonSchemaInfo() + .properties(mapOf( + "foo" to Foo::class.java + )) + .required(setOf( + "foo" + )) + ), NullSchemaValidator, BooleanSchemaValidator, NumberSchemaValidator, StringSchemaValidator, ListSchemaValidator, Schema1BoxedList>, MapSchemaValidator { + + companion object { + @Volatile + private var instance: Schema1? = null + + fun getInstance() = + instance ?: synchronized(this) { + instance ?: Schema1().also { instance = it } + } + } + + @Throws(ValidationException::class) + override fun validate(arg: Nothing?, configuration: SchemaConfiguration?): Nothing? { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validatedPathToSchemas = PathToSchemasMap() + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, LinkedHashSet()) + getPathToSchemas(this, castArg, validationMetadata, pathSet) + return castArg + } + + @Throws(ValidationException::class) + override fun validate(arg: Boolean, configuration: SchemaConfiguration?): Boolean { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validatedPathToSchemas = PathToSchemasMap() + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, LinkedHashSet()) + getPathToSchemas(this, castArg, validationMetadata, pathSet) + return castArg + } + + @Throws(ValidationException::class) + override fun validate(arg: Number, configuration: SchemaConfiguration?): Number { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validatedPathToSchemas = PathToSchemasMap() + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, LinkedHashSet()) + getPathToSchemas(this, castArg, validationMetadata, pathSet) + return castArg + } + + @Throws(ValidationException::class) + fun validate(arg: Int, configuration: SchemaConfiguration?): Int { + return validate(arg as Number, configuration) as Int + } + + @Throws(ValidationException::class) + fun validate(arg: Long, configuration: SchemaConfiguration?): Long { + return validate(arg as Number, configuration) as Long + } + + @Throws(ValidationException::class) + fun validate(arg: Float, configuration: SchemaConfiguration?): Float { + return validate(arg as Number, configuration) as Float + } + + @Throws(ValidationException::class) + fun validate(arg: Double, configuration: SchemaConfiguration?): Double { + return validate(arg as Number, configuration) as Double + } + + @Throws(ValidationException::class) + override fun validate(arg: String, configuration: SchemaConfiguration?): String { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validatedPathToSchemas = PathToSchemasMap() + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, LinkedHashSet()) + getPathToSchemas(this, castArg, validationMetadata, pathSet) + return castArg + } + + @Throws(ValidationException::class) + fun validate(arg: LocalDate, configuration: SchemaConfiguration?): String { + return validate(arg.toString(), configuration) + } + + @Throws(ValidationException::class) + fun validate(arg: ZonedDateTime, configuration: SchemaConfiguration?): String { + return validate(arg.toString(), configuration) + } + + @Throws(ValidationException::class) + fun validate(arg: UUID, configuration: SchemaConfiguration?): String { + return validate(arg.toString(), configuration) + } + + override fun getNewInstance(arg: List<*>, pathToItem: List, pathToSchemas: PathToSchemasMap): FrozenList { + val items: MutableList = ArrayList() + var i: Int = 0 + for (item: Any? in arg) { + val itemPathToItem = pathToItem + i + val schemas: LinkedHashMap, Nothing?>? = pathToSchemas.get(itemPathToItem) + if (schemas == null) { + throw RuntimeException("Validation result is invalid, schemas must exist for a pathToItem") + } + val itemSchema: JsonSchema<*> = schemas.entries.iterator().next().key + val itemInstance: Any? = itemSchema.getNewInstance(item, itemPathToItem, pathToSchemas) + items.add(itemInstance) + i += 1 + } + val newInstanceItems: FrozenList = FrozenList(items) + return newInstanceItems + } + + @Throws(ValidationException::class) + override fun validate(arg: List<*>, configuration: SchemaConfiguration?): FrozenList { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, PathToSchemasMap(), LinkedHashSet()) + val pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet) + return getNewInstance(castArg, validationMetadata.pathToItem, pathToSchemasMap) + } + + override fun getNewInstance(arg: Map<*, *>, pathToItem: List, pathToSchemas: PathToSchemasMap): Schema1Map { + val properties: LinkedHashMap = LinkedHashMap() + for((propertyName, value) in arg) { + if (!(propertyName is String)) { + throw RuntimeException("Invalid non-string key value") + } + val propertyPathToItem: List = pathToItem + propertyName + val schemas: LinkedHashMap, Nothing?>? = pathToSchemas.get(propertyPathToItem) + if (schemas == null) { + throw RuntimeException("Validation result is invalid, schemas must exist for a pathToItem") + } + val propertySchema: JsonSchema<*> = schemas.entries.iterator().next().key + val propertyInstance: Any? = propertySchema.getNewInstance(value, propertyPathToItem, pathToSchemas) + properties[propertyName] = propertyInstance + } + val castProperties: FrozenMap = FrozenMap(properties) + return Schema1Map(castProperties) + } + + @Throws(ValidationException::class) + override fun validate(arg: Map<*, *>, configuration: SchemaConfiguration?): Schema1Map { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validatedPathToSchemas = PathToSchemasMap() + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, LinkedHashSet()) + val pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet) + return getNewInstance(castArg, validationMetadata.pathToItem, pathToSchemasMap) + } + + @Throws(ValidationException::class) + override fun validate(arg: Any?, configuration: SchemaConfiguration?): Any? { + if (arg == null) { + return validate(null, configuration) + } else if (arg is Boolean) { + return validate(arg, configuration) + } else if (arg is Number) { + return validate(arg, configuration) + } else if (arg is String) { + return validate(arg, configuration) + } else if (arg is List<*>) { + return validate(arg, configuration) + } else if (arg is Map<*, *>) { + return validate(arg, configuration) + } + throw ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema") + } + override fun getNewInstance(arg: Any?, pathToItem: List, pathToSchemas: PathToSchemasMap): Any? { + if (arg == null) { + return getNewInstance( null, pathToItem, pathToSchemas) + } else if (arg is Boolean) { + return getNewInstance(arg, pathToItem, pathToSchemas) + } else if (arg is Number) { + return getNewInstance(arg, pathToItem, pathToSchemas) + } else if (arg is String) { + return getNewInstance(arg, pathToItem, pathToSchemas) + } else if (arg is List<*>) { + return getNewInstance(arg, pathToItem, pathToSchemas) + } else if (arg is Map<*, *>) { + return getNewInstance(arg, pathToItem, pathToSchemas) + } + throw RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema") + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: Nothing?, configuration: SchemaConfiguration?): Schema1BoxedVoid { + return Schema1BoxedVoid(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: Boolean, configuration: SchemaConfiguration?): Schema1BoxedBoolean { + return Schema1BoxedBoolean(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: Number, configuration: SchemaConfiguration?): Schema1BoxedNumber { + return Schema1BoxedNumber(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: String, configuration: SchemaConfiguration?): Schema1BoxedString { + return Schema1BoxedString(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: List<*>, configuration: SchemaConfiguration?): Schema1BoxedList { + return Schema1BoxedList(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: Map<*, *>, configuration: SchemaConfiguration?): Schema1BoxedMap { + return Schema1BoxedMap(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: Any?, configuration: SchemaConfiguration?): Schema1Boxed { + if (arg == null) { + return validateAndBox(null, configuration) + } else if (arg is Boolean) { + return validateAndBox(arg, configuration) + } else if (arg is String) { + return validateAndBox(arg, configuration) + } else if (arg is Number) { + return validateAndBox(arg, configuration) + } else if (arg is List<*>) { + return validateAndBox(arg, configuration) + } else if (arg is Map<*, *>) { + return validateAndBox(arg, configuration) + } + throw ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema") + } + } + + sealed interface AnyofComplexTypes1Boxed { + fun getData(): Any? + } + + data class AnyofComplexTypes1BoxedVoid(val data: Nothing?) : AnyofComplexTypes1Boxed { + override fun getData(): Any? { + return data + } + } + + data class AnyofComplexTypes1BoxedBoolean(val data: Boolean): AnyofComplexTypes1Boxed { + override fun getData(): Any? { + return data + } + } + + data class AnyofComplexTypes1BoxedNumber(val data: Number) : AnyofComplexTypes1Boxed { + override fun getData(): Any? { + return data + } + } + + data class AnyofComplexTypes1BoxedString(val data: String) : AnyofComplexTypes1Boxed { + override fun getData(): Any? { + return data + } + } + + data class AnyofComplexTypes1BoxedList(val data: FrozenList) : AnyofComplexTypes1Boxed { + override fun getData(): Any? { + return data + } + } + + data class AnyofComplexTypes1BoxedMap(val data: FrozenMap) : AnyofComplexTypes1Boxed { + override fun getData(): Any? { + return data + } + } + + + class AnyofComplexTypes1 private constructor(): JsonSchema( + JsonSchemaInfo() + .anyOf(listOf( + Schema0::class.java, + Schema1::class.java + )) + ), NullSchemaValidator, BooleanSchemaValidator, NumberSchemaValidator, StringSchemaValidator, ListSchemaValidator, AnyofComplexTypes1BoxedList>, MapSchemaValidator, AnyofComplexTypes1BoxedMap> { + /* + NOTE: This class is auto generated by OpenAPI JSON Schema Generator. + Ref: https://github.com/openapi-json-schema-tools/openapi-json-schema-generator + + Do not edit the class manually. + */ + + companion object { + @Volatile + private var instance: AnyofComplexTypes1? = null + + fun getInstance() = + instance ?: synchronized(this) { + instance ?: AnyofComplexTypes1().also { instance = it } + } + } + + @Throws(ValidationException::class) + override fun validate(arg: Nothing?, configuration: SchemaConfiguration?): Nothing? { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validatedPathToSchemas = PathToSchemasMap() + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, LinkedHashSet()) + getPathToSchemas(this, castArg, validationMetadata, pathSet) + return castArg + } + + @Throws(ValidationException::class) + override fun validate(arg: Boolean, configuration: SchemaConfiguration?): Boolean { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validatedPathToSchemas = PathToSchemasMap() + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, LinkedHashSet()) + getPathToSchemas(this, castArg, validationMetadata, pathSet) + return castArg + } + + @Throws(ValidationException::class) + override fun validate(arg: Number, configuration: SchemaConfiguration?): Number { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validatedPathToSchemas = PathToSchemasMap() + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, LinkedHashSet()) + getPathToSchemas(this, castArg, validationMetadata, pathSet) + return castArg + } + + @Throws(ValidationException::class) + fun validate(arg: Int, configuration: SchemaConfiguration?): Int { + return validate(arg as Number, configuration) as Int + } + + @Throws(ValidationException::class) + fun validate(arg: Long, configuration: SchemaConfiguration?): Long { + return validate(arg as Number, configuration) as Long + } + + @Throws(ValidationException::class) + fun validate(arg: Float, configuration: SchemaConfiguration?): Float { + return validate(arg as Number, configuration) as Float + } + + @Throws(ValidationException::class) + fun validate(arg: Double, configuration: SchemaConfiguration?): Double { + return validate(arg as Number, configuration) as Double + } + + @Throws(ValidationException::class) + override fun validate(arg: String, configuration: SchemaConfiguration?): String { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validatedPathToSchemas = PathToSchemasMap() + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, LinkedHashSet()) + getPathToSchemas(this, castArg, validationMetadata, pathSet) + return castArg + } + + @Throws(ValidationException::class) + fun validate(arg: LocalDate, configuration: SchemaConfiguration?): String { + return validate(arg.toString(), configuration) + } + + @Throws(ValidationException::class) + fun validate(arg: ZonedDateTime, configuration: SchemaConfiguration?): String { + return validate(arg.toString(), configuration) + } + + @Throws(ValidationException::class) + fun validate(arg: UUID, configuration: SchemaConfiguration?): String { + return validate(arg.toString(), configuration) + } + + override fun getNewInstance(arg: List<*>, pathToItem: List, pathToSchemas: PathToSchemasMap): FrozenList { + val items: MutableList = ArrayList() + var i: Int = 0 + for (item: Any? in arg) { + val itemPathToItem = pathToItem + i + val schemas: LinkedHashMap, Nothing?>? = pathToSchemas.get(itemPathToItem) + if (schemas == null) { + throw RuntimeException("Validation result is invalid, schemas must exist for a pathToItem") + } + val itemSchema: JsonSchema<*> = schemas.entries.iterator().next().key + val itemInstance: Any? = itemSchema.getNewInstance(item, itemPathToItem, pathToSchemas) + items.add(itemInstance) + i += 1 + } + val newInstanceItems: FrozenList = FrozenList(items) + return newInstanceItems + } + + @Throws(ValidationException::class) + override fun validate(arg: List<*>, configuration: SchemaConfiguration?): FrozenList { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, PathToSchemasMap(), LinkedHashSet()) + val pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet) + return getNewInstance(castArg, validationMetadata.pathToItem, pathToSchemasMap) + } + + override fun getNewInstance(arg: Map<*, *>, pathToItem: List, pathToSchemas: PathToSchemasMap): FrozenMap { + val properties: LinkedHashMap = LinkedHashMap() + for((propertyName, value) in arg) { + if (!(propertyName is String)) { + throw RuntimeException("Invalid non-string key value") + } + val propertyPathToItem: List = pathToItem + propertyName + val schemas: LinkedHashMap, Nothing?>? = pathToSchemas.get(propertyPathToItem) + if (schemas == null) { + throw RuntimeException("Validation result is invalid, schemas must exist for a pathToItem") + } + val propertySchema: JsonSchema<*> = schemas.entries.iterator().next().key + val propertyInstance: Any? = propertySchema.getNewInstance(value, propertyPathToItem, pathToSchemas) + properties[propertyName] = propertyInstance + } + val castProperties: FrozenMap = FrozenMap(properties) + return castProperties + } + + @Throws(ValidationException::class) + override fun validate(arg: Map<*, *>, configuration: SchemaConfiguration?): FrozenMap { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validatedPathToSchemas = PathToSchemasMap() + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, LinkedHashSet()) + val pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet) + return getNewInstance(castArg, validationMetadata.pathToItem, pathToSchemasMap) + } + + @Throws(ValidationException::class) + override fun validate(arg: Any?, configuration: SchemaConfiguration?): Any? { + if (arg == null) { + return validate(null, configuration) + } else if (arg is Boolean) { + return validate(arg, configuration) + } else if (arg is Number) { + return validate(arg, configuration) + } else if (arg is String) { + return validate(arg, configuration) + } else if (arg is List<*>) { + return validate(arg, configuration) + } else if (arg is Map<*, *>) { + return validate(arg, configuration) + } + throw ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema") + } + override fun getNewInstance(arg: Any?, pathToItem: List, pathToSchemas: PathToSchemasMap): Any? { + if (arg == null) { + return getNewInstance( null, pathToItem, pathToSchemas) + } else if (arg is Boolean) { + return getNewInstance(arg, pathToItem, pathToSchemas) + } else if (arg is Number) { + return getNewInstance(arg, pathToItem, pathToSchemas) + } else if (arg is String) { + return getNewInstance(arg, pathToItem, pathToSchemas) + } else if (arg is List<*>) { + return getNewInstance(arg, pathToItem, pathToSchemas) + } else if (arg is Map<*, *>) { + return getNewInstance(arg, pathToItem, pathToSchemas) + } + throw RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema") + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: Nothing?, configuration: SchemaConfiguration?): AnyofComplexTypes1BoxedVoid { + return AnyofComplexTypes1BoxedVoid(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: Boolean, configuration: SchemaConfiguration?): AnyofComplexTypes1BoxedBoolean { + return AnyofComplexTypes1BoxedBoolean(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: Number, configuration: SchemaConfiguration?): AnyofComplexTypes1BoxedNumber { + return AnyofComplexTypes1BoxedNumber(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: String, configuration: SchemaConfiguration?): AnyofComplexTypes1BoxedString { + return AnyofComplexTypes1BoxedString(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: List<*>, configuration: SchemaConfiguration?): AnyofComplexTypes1BoxedList { + return AnyofComplexTypes1BoxedList(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: Map<*, *>, configuration: SchemaConfiguration?): AnyofComplexTypes1BoxedMap { + return AnyofComplexTypes1BoxedMap(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: Any?, configuration: SchemaConfiguration?): AnyofComplexTypes1Boxed { + if (arg == null) { + return validateAndBox(null, configuration) + } else if (arg is Boolean) { + return validateAndBox(arg, configuration) + } else if (arg is String) { + return validateAndBox(arg, configuration) + } else if (arg is Number) { + return validateAndBox(arg, configuration) + } else if (arg is List<*>) { + return validateAndBox(arg, configuration) + } else if (arg is Map<*, *>) { + return validateAndBox(arg, configuration) + } + throw ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema") + } + } +} diff --git a/samples/client/3_1_0_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/schemas/AnyofWithBaseSchema.kt b/samples/client/3_1_0_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/schemas/AnyofWithBaseSchema.kt new file mode 100644 index 00000000000..c6c6cd7ba74 --- /dev/null +++ b/samples/client/3_1_0_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/schemas/AnyofWithBaseSchema.kt @@ -0,0 +1,653 @@ +package org.openapijsonschematools.client.components.schemas +import java.time.LocalDate +import java.time.ZonedDateTime +import java.util.UUID +import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags +import org.openapijsonschematools.client.configurations.SchemaConfiguration +import org.openapijsonschematools.client.exceptions.InvalidAdditionalPropertyException +import org.openapijsonschematools.client.exceptions.UnsetPropertyException +import org.openapijsonschematools.client.exceptions.ValidationException +import org.openapijsonschematools.client.schemas.UnsetAddPropsSetter +import org.openapijsonschematools.client.schemas.validation.BooleanSchemaValidator +import org.openapijsonschematools.client.schemas.validation.FrozenList +import org.openapijsonschematools.client.schemas.validation.FrozenMap +import org.openapijsonschematools.client.schemas.validation.JsonSchema +import org.openapijsonschematools.client.schemas.validation.JsonSchemaInfo +import org.openapijsonschematools.client.schemas.validation.ListSchemaValidator +import org.openapijsonschematools.client.schemas.validation.MapSchemaValidator +import org.openapijsonschematools.client.schemas.validation.NullSchemaValidator +import org.openapijsonschematools.client.schemas.validation.NumberSchemaValidator +import org.openapijsonschematools.client.schemas.validation.PathToSchemasMap +import org.openapijsonschematools.client.schemas.validation.StringSchemaValidator +import org.openapijsonschematools.client.schemas.validation.ValidationMetadata + +class AnyofWithBaseSchema { + // nest classes so all schemas and input/output classes can be public + + + sealed interface Schema0Boxed { + fun getData(): Any? + } + + data class Schema0BoxedVoid(val data: Nothing?) : Schema0Boxed { + override fun getData(): Any? { + return data + } + } + + data class Schema0BoxedBoolean(val data: Boolean): Schema0Boxed { + override fun getData(): Any? { + return data + } + } + + data class Schema0BoxedNumber(val data: Number) : Schema0Boxed { + override fun getData(): Any? { + return data + } + } + + data class Schema0BoxedString(val data: String) : Schema0Boxed { + override fun getData(): Any? { + return data + } + } + + data class Schema0BoxedList(val data: FrozenList) : Schema0Boxed { + override fun getData(): Any? { + return data + } + } + + data class Schema0BoxedMap(val data: FrozenMap) : Schema0Boxed { + override fun getData(): Any? { + return data + } + } + + + class Schema0 private constructor(): JsonSchema( + JsonSchemaInfo() + .maxLength(2) + ), NullSchemaValidator, BooleanSchemaValidator, NumberSchemaValidator, StringSchemaValidator, ListSchemaValidator, Schema0BoxedList>, MapSchemaValidator, Schema0BoxedMap> { + + companion object { + @Volatile + private var instance: Schema0? = null + + fun getInstance() = + instance ?: synchronized(this) { + instance ?: Schema0().also { instance = it } + } + } + + @Throws(ValidationException::class) + override fun validate(arg: Nothing?, configuration: SchemaConfiguration?): Nothing? { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validatedPathToSchemas = PathToSchemasMap() + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, LinkedHashSet()) + getPathToSchemas(this, castArg, validationMetadata, pathSet) + return castArg + } + + @Throws(ValidationException::class) + override fun validate(arg: Boolean, configuration: SchemaConfiguration?): Boolean { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validatedPathToSchemas = PathToSchemasMap() + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, LinkedHashSet()) + getPathToSchemas(this, castArg, validationMetadata, pathSet) + return castArg + } + + @Throws(ValidationException::class) + override fun validate(arg: Number, configuration: SchemaConfiguration?): Number { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validatedPathToSchemas = PathToSchemasMap() + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, LinkedHashSet()) + getPathToSchemas(this, castArg, validationMetadata, pathSet) + return castArg + } + + @Throws(ValidationException::class) + fun validate(arg: Int, configuration: SchemaConfiguration?): Int { + return validate(arg as Number, configuration) as Int + } + + @Throws(ValidationException::class) + fun validate(arg: Long, configuration: SchemaConfiguration?): Long { + return validate(arg as Number, configuration) as Long + } + + @Throws(ValidationException::class) + fun validate(arg: Float, configuration: SchemaConfiguration?): Float { + return validate(arg as Number, configuration) as Float + } + + @Throws(ValidationException::class) + fun validate(arg: Double, configuration: SchemaConfiguration?): Double { + return validate(arg as Number, configuration) as Double + } + + @Throws(ValidationException::class) + override fun validate(arg: String, configuration: SchemaConfiguration?): String { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validatedPathToSchemas = PathToSchemasMap() + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, LinkedHashSet()) + getPathToSchemas(this, castArg, validationMetadata, pathSet) + return castArg + } + + @Throws(ValidationException::class) + fun validate(arg: LocalDate, configuration: SchemaConfiguration?): String { + return validate(arg.toString(), configuration) + } + + @Throws(ValidationException::class) + fun validate(arg: ZonedDateTime, configuration: SchemaConfiguration?): String { + return validate(arg.toString(), configuration) + } + + @Throws(ValidationException::class) + fun validate(arg: UUID, configuration: SchemaConfiguration?): String { + return validate(arg.toString(), configuration) + } + + override fun getNewInstance(arg: List<*>, pathToItem: List, pathToSchemas: PathToSchemasMap): FrozenList { + val items: MutableList = ArrayList() + var i: Int = 0 + for (item: Any? in arg) { + val itemPathToItem = pathToItem + i + val schemas: LinkedHashMap, Nothing?>? = pathToSchemas.get(itemPathToItem) + if (schemas == null) { + throw RuntimeException("Validation result is invalid, schemas must exist for a pathToItem") + } + val itemSchema: JsonSchema<*> = schemas.entries.iterator().next().key + val itemInstance: Any? = itemSchema.getNewInstance(item, itemPathToItem, pathToSchemas) + items.add(itemInstance) + i += 1 + } + val newInstanceItems: FrozenList = FrozenList(items) + return newInstanceItems + } + + @Throws(ValidationException::class) + override fun validate(arg: List<*>, configuration: SchemaConfiguration?): FrozenList { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, PathToSchemasMap(), LinkedHashSet()) + val pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet) + return getNewInstance(castArg, validationMetadata.pathToItem, pathToSchemasMap) + } + + override fun getNewInstance(arg: Map<*, *>, pathToItem: List, pathToSchemas: PathToSchemasMap): FrozenMap { + val properties: LinkedHashMap = LinkedHashMap() + for((propertyName, value) in arg) { + if (!(propertyName is String)) { + throw RuntimeException("Invalid non-string key value") + } + val propertyPathToItem: List = pathToItem + propertyName + val schemas: LinkedHashMap, Nothing?>? = pathToSchemas.get(propertyPathToItem) + if (schemas == null) { + throw RuntimeException("Validation result is invalid, schemas must exist for a pathToItem") + } + val propertySchema: JsonSchema<*> = schemas.entries.iterator().next().key + val propertyInstance: Any? = propertySchema.getNewInstance(value, propertyPathToItem, pathToSchemas) + properties[propertyName] = propertyInstance + } + val castProperties: FrozenMap = FrozenMap(properties) + return castProperties + } + + @Throws(ValidationException::class) + override fun validate(arg: Map<*, *>, configuration: SchemaConfiguration?): FrozenMap { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validatedPathToSchemas = PathToSchemasMap() + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, LinkedHashSet()) + val pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet) + return getNewInstance(castArg, validationMetadata.pathToItem, pathToSchemasMap) + } + + @Throws(ValidationException::class) + override fun validate(arg: Any?, configuration: SchemaConfiguration?): Any? { + if (arg == null) { + return validate(null, configuration) + } else if (arg is Boolean) { + return validate(arg, configuration) + } else if (arg is Number) { + return validate(arg, configuration) + } else if (arg is String) { + return validate(arg, configuration) + } else if (arg is List<*>) { + return validate(arg, configuration) + } else if (arg is Map<*, *>) { + return validate(arg, configuration) + } + throw ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema") + } + override fun getNewInstance(arg: Any?, pathToItem: List, pathToSchemas: PathToSchemasMap): Any? { + if (arg == null) { + return getNewInstance( null, pathToItem, pathToSchemas) + } else if (arg is Boolean) { + return getNewInstance(arg, pathToItem, pathToSchemas) + } else if (arg is Number) { + return getNewInstance(arg, pathToItem, pathToSchemas) + } else if (arg is String) { + return getNewInstance(arg, pathToItem, pathToSchemas) + } else if (arg is List<*>) { + return getNewInstance(arg, pathToItem, pathToSchemas) + } else if (arg is Map<*, *>) { + return getNewInstance(arg, pathToItem, pathToSchemas) + } + throw RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema") + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: Nothing?, configuration: SchemaConfiguration?): Schema0BoxedVoid { + return Schema0BoxedVoid(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: Boolean, configuration: SchemaConfiguration?): Schema0BoxedBoolean { + return Schema0BoxedBoolean(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: Number, configuration: SchemaConfiguration?): Schema0BoxedNumber { + return Schema0BoxedNumber(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: String, configuration: SchemaConfiguration?): Schema0BoxedString { + return Schema0BoxedString(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: List<*>, configuration: SchemaConfiguration?): Schema0BoxedList { + return Schema0BoxedList(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: Map<*, *>, configuration: SchemaConfiguration?): Schema0BoxedMap { + return Schema0BoxedMap(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: Any?, configuration: SchemaConfiguration?): Schema0Boxed { + if (arg == null) { + return validateAndBox(null, configuration) + } else if (arg is Boolean) { + return validateAndBox(arg, configuration) + } else if (arg is String) { + return validateAndBox(arg, configuration) + } else if (arg is Number) { + return validateAndBox(arg, configuration) + } else if (arg is List<*>) { + return validateAndBox(arg, configuration) + } else if (arg is Map<*, *>) { + return validateAndBox(arg, configuration) + } + throw ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema") + } + } + + sealed interface Schema1Boxed { + fun getData(): Any? + } + + data class Schema1BoxedVoid(val data: Nothing?) : Schema1Boxed { + override fun getData(): Any? { + return data + } + } + + data class Schema1BoxedBoolean(val data: Boolean): Schema1Boxed { + override fun getData(): Any? { + return data + } + } + + data class Schema1BoxedNumber(val data: Number) : Schema1Boxed { + override fun getData(): Any? { + return data + } + } + + data class Schema1BoxedString(val data: String) : Schema1Boxed { + override fun getData(): Any? { + return data + } + } + + data class Schema1BoxedList(val data: FrozenList) : Schema1Boxed { + override fun getData(): Any? { + return data + } + } + + data class Schema1BoxedMap(val data: FrozenMap) : Schema1Boxed { + override fun getData(): Any? { + return data + } + } + + + class Schema1 private constructor(): JsonSchema( + JsonSchemaInfo() + .minLength(4) + ), NullSchemaValidator, BooleanSchemaValidator, NumberSchemaValidator, StringSchemaValidator, ListSchemaValidator, Schema1BoxedList>, MapSchemaValidator, Schema1BoxedMap> { + + companion object { + @Volatile + private var instance: Schema1? = null + + fun getInstance() = + instance ?: synchronized(this) { + instance ?: Schema1().also { instance = it } + } + } + + @Throws(ValidationException::class) + override fun validate(arg: Nothing?, configuration: SchemaConfiguration?): Nothing? { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validatedPathToSchemas = PathToSchemasMap() + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, LinkedHashSet()) + getPathToSchemas(this, castArg, validationMetadata, pathSet) + return castArg + } + + @Throws(ValidationException::class) + override fun validate(arg: Boolean, configuration: SchemaConfiguration?): Boolean { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validatedPathToSchemas = PathToSchemasMap() + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, LinkedHashSet()) + getPathToSchemas(this, castArg, validationMetadata, pathSet) + return castArg + } + + @Throws(ValidationException::class) + override fun validate(arg: Number, configuration: SchemaConfiguration?): Number { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validatedPathToSchemas = PathToSchemasMap() + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, LinkedHashSet()) + getPathToSchemas(this, castArg, validationMetadata, pathSet) + return castArg + } + + @Throws(ValidationException::class) + fun validate(arg: Int, configuration: SchemaConfiguration?): Int { + return validate(arg as Number, configuration) as Int + } + + @Throws(ValidationException::class) + fun validate(arg: Long, configuration: SchemaConfiguration?): Long { + return validate(arg as Number, configuration) as Long + } + + @Throws(ValidationException::class) + fun validate(arg: Float, configuration: SchemaConfiguration?): Float { + return validate(arg as Number, configuration) as Float + } + + @Throws(ValidationException::class) + fun validate(arg: Double, configuration: SchemaConfiguration?): Double { + return validate(arg as Number, configuration) as Double + } + + @Throws(ValidationException::class) + override fun validate(arg: String, configuration: SchemaConfiguration?): String { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validatedPathToSchemas = PathToSchemasMap() + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, LinkedHashSet()) + getPathToSchemas(this, castArg, validationMetadata, pathSet) + return castArg + } + + @Throws(ValidationException::class) + fun validate(arg: LocalDate, configuration: SchemaConfiguration?): String { + return validate(arg.toString(), configuration) + } + + @Throws(ValidationException::class) + fun validate(arg: ZonedDateTime, configuration: SchemaConfiguration?): String { + return validate(arg.toString(), configuration) + } + + @Throws(ValidationException::class) + fun validate(arg: UUID, configuration: SchemaConfiguration?): String { + return validate(arg.toString(), configuration) + } + + override fun getNewInstance(arg: List<*>, pathToItem: List, pathToSchemas: PathToSchemasMap): FrozenList { + val items: MutableList = ArrayList() + var i: Int = 0 + for (item: Any? in arg) { + val itemPathToItem = pathToItem + i + val schemas: LinkedHashMap, Nothing?>? = pathToSchemas.get(itemPathToItem) + if (schemas == null) { + throw RuntimeException("Validation result is invalid, schemas must exist for a pathToItem") + } + val itemSchema: JsonSchema<*> = schemas.entries.iterator().next().key + val itemInstance: Any? = itemSchema.getNewInstance(item, itemPathToItem, pathToSchemas) + items.add(itemInstance) + i += 1 + } + val newInstanceItems: FrozenList = FrozenList(items) + return newInstanceItems + } + + @Throws(ValidationException::class) + override fun validate(arg: List<*>, configuration: SchemaConfiguration?): FrozenList { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, PathToSchemasMap(), LinkedHashSet()) + val pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet) + return getNewInstance(castArg, validationMetadata.pathToItem, pathToSchemasMap) + } + + override fun getNewInstance(arg: Map<*, *>, pathToItem: List, pathToSchemas: PathToSchemasMap): FrozenMap { + val properties: LinkedHashMap = LinkedHashMap() + for((propertyName, value) in arg) { + if (!(propertyName is String)) { + throw RuntimeException("Invalid non-string key value") + } + val propertyPathToItem: List = pathToItem + propertyName + val schemas: LinkedHashMap, Nothing?>? = pathToSchemas.get(propertyPathToItem) + if (schemas == null) { + throw RuntimeException("Validation result is invalid, schemas must exist for a pathToItem") + } + val propertySchema: JsonSchema<*> = schemas.entries.iterator().next().key + val propertyInstance: Any? = propertySchema.getNewInstance(value, propertyPathToItem, pathToSchemas) + properties[propertyName] = propertyInstance + } + val castProperties: FrozenMap = FrozenMap(properties) + return castProperties + } + + @Throws(ValidationException::class) + override fun validate(arg: Map<*, *>, configuration: SchemaConfiguration?): FrozenMap { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validatedPathToSchemas = PathToSchemasMap() + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, LinkedHashSet()) + val pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet) + return getNewInstance(castArg, validationMetadata.pathToItem, pathToSchemasMap) + } + + @Throws(ValidationException::class) + override fun validate(arg: Any?, configuration: SchemaConfiguration?): Any? { + if (arg == null) { + return validate(null, configuration) + } else if (arg is Boolean) { + return validate(arg, configuration) + } else if (arg is Number) { + return validate(arg, configuration) + } else if (arg is String) { + return validate(arg, configuration) + } else if (arg is List<*>) { + return validate(arg, configuration) + } else if (arg is Map<*, *>) { + return validate(arg, configuration) + } + throw ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema") + } + override fun getNewInstance(arg: Any?, pathToItem: List, pathToSchemas: PathToSchemasMap): Any? { + if (arg == null) { + return getNewInstance( null, pathToItem, pathToSchemas) + } else if (arg is Boolean) { + return getNewInstance(arg, pathToItem, pathToSchemas) + } else if (arg is Number) { + return getNewInstance(arg, pathToItem, pathToSchemas) + } else if (arg is String) { + return getNewInstance(arg, pathToItem, pathToSchemas) + } else if (arg is List<*>) { + return getNewInstance(arg, pathToItem, pathToSchemas) + } else if (arg is Map<*, *>) { + return getNewInstance(arg, pathToItem, pathToSchemas) + } + throw RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema") + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: Nothing?, configuration: SchemaConfiguration?): Schema1BoxedVoid { + return Schema1BoxedVoid(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: Boolean, configuration: SchemaConfiguration?): Schema1BoxedBoolean { + return Schema1BoxedBoolean(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: Number, configuration: SchemaConfiguration?): Schema1BoxedNumber { + return Schema1BoxedNumber(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: String, configuration: SchemaConfiguration?): Schema1BoxedString { + return Schema1BoxedString(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: List<*>, configuration: SchemaConfiguration?): Schema1BoxedList { + return Schema1BoxedList(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: Map<*, *>, configuration: SchemaConfiguration?): Schema1BoxedMap { + return Schema1BoxedMap(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: Any?, configuration: SchemaConfiguration?): Schema1Boxed { + if (arg == null) { + return validateAndBox(null, configuration) + } else if (arg is Boolean) { + return validateAndBox(arg, configuration) + } else if (arg is String) { + return validateAndBox(arg, configuration) + } else if (arg is Number) { + return validateAndBox(arg, configuration) + } else if (arg is List<*>) { + return validateAndBox(arg, configuration) + } else if (arg is Map<*, *>) { + return validateAndBox(arg, configuration) + } + throw ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema") + } + } + + sealed interface AnyofWithBaseSchema1Boxed { + fun getData(): Any? + } + + data class AnyofWithBaseSchema1BoxedString(val data: String) : AnyofWithBaseSchema1Boxed { + override fun getData(): Any? { + return data + } + } + + + + class AnyofWithBaseSchema1 private constructor(): JsonSchema( + JsonSchemaInfo() + .type(setOf( + String::class.java + )) + .anyOf(listOf( + Schema0::class.java, + Schema1::class.java + )) + ), StringSchemaValidator { + /* + NOTE: This class is auto generated by OpenAPI JSON Schema Generator. + Ref: https://github.com/openapi-json-schema-tools/openapi-json-schema-generator + + Do not edit the class manually. + */ + + companion object { + @Volatile + private var instance: AnyofWithBaseSchema1? = null + + fun getInstance() = + instance ?: synchronized(this) { + instance ?: AnyofWithBaseSchema1().also { instance = it } + } + } + + @Throws(ValidationException::class) + override fun validate(arg: String, configuration: SchemaConfiguration?): String { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, PathToSchemasMap(), LinkedHashSet()) + getPathToSchemas(this, castArg, validationMetadata, pathSet) + return castArg + } + + @Throws(ValidationException::class) + override fun validate(arg: Any?, configuration: SchemaConfiguration?): Any? { + if (arg is String) { + return validate(arg, configuration) + } + throw ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema") + } + override fun getNewInstance(arg: Any?, pathToItem: List, pathToSchemas: PathToSchemasMap): Any? { + if (arg is String) { + return getNewInstance(arg, pathToItem, pathToSchemas) + } + throw RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema") + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: String, configuration: SchemaConfiguration?): AnyofWithBaseSchema1BoxedString { + return AnyofWithBaseSchema1BoxedString(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: Any?, configuration: SchemaConfiguration?): AnyofWithBaseSchema1Boxed { + if (arg is String) { + return validateAndBox(arg, configuration) + } + throw ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema") + } + } +} diff --git a/samples/client/3_1_0_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/schemas/AnyofWithOneEmptySchema.kt b/samples/client/3_1_0_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/schemas/AnyofWithOneEmptySchema.kt new file mode 100644 index 00000000000..6bd29945cdc --- /dev/null +++ b/samples/client/3_1_0_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/schemas/AnyofWithOneEmptySchema.kt @@ -0,0 +1,339 @@ +package org.openapijsonschematools.client.components.schemas +import java.time.LocalDate +import java.time.ZonedDateTime +import java.util.UUID +import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags +import org.openapijsonschematools.client.configurations.SchemaConfiguration +import org.openapijsonschematools.client.exceptions.InvalidAdditionalPropertyException +import org.openapijsonschematools.client.exceptions.UnsetPropertyException +import org.openapijsonschematools.client.exceptions.ValidationException +import org.openapijsonschematools.client.schemas.AnyTypeJsonSchema +import org.openapijsonschematools.client.schemas.NumberJsonSchema +import org.openapijsonschematools.client.schemas.UnsetAddPropsSetter +import org.openapijsonschematools.client.schemas.validation.BooleanSchemaValidator +import org.openapijsonschematools.client.schemas.validation.FrozenList +import org.openapijsonschematools.client.schemas.validation.FrozenMap +import org.openapijsonschematools.client.schemas.validation.JsonSchema +import org.openapijsonschematools.client.schemas.validation.JsonSchemaInfo +import org.openapijsonschematools.client.schemas.validation.ListSchemaValidator +import org.openapijsonschematools.client.schemas.validation.MapSchemaValidator +import org.openapijsonschematools.client.schemas.validation.NullSchemaValidator +import org.openapijsonschematools.client.schemas.validation.NumberSchemaValidator +import org.openapijsonschematools.client.schemas.validation.PathToSchemasMap +import org.openapijsonschematools.client.schemas.validation.StringSchemaValidator +import org.openapijsonschematools.client.schemas.validation.ValidationMetadata + +class AnyofWithOneEmptySchema { + // nest classes so all schemas and input/output classes can be public + + + class Schema0 : NumberJsonSchema.NumberJsonSchema1() { + companion object { + @Volatile + private var instance: Schema0? = null + + fun getInstance() = + instance ?: synchronized(this) { + instance ?: Schema0().also { instance = it } + } + } + } + + + class Schema1 : AnyTypeJsonSchema.AnyTypeJsonSchema1() { + companion object { + @Volatile + private var instance: Schema1? = null + + fun getInstance() = + instance ?: synchronized(this) { + instance ?: Schema1().also { instance = it } + } + } + } + + + sealed interface AnyofWithOneEmptySchema1Boxed { + fun getData(): Any? + } + + data class AnyofWithOneEmptySchema1BoxedVoid(val data: Nothing?) : AnyofWithOneEmptySchema1Boxed { + override fun getData(): Any? { + return data + } + } + + data class AnyofWithOneEmptySchema1BoxedBoolean(val data: Boolean): AnyofWithOneEmptySchema1Boxed { + override fun getData(): Any? { + return data + } + } + + data class AnyofWithOneEmptySchema1BoxedNumber(val data: Number) : AnyofWithOneEmptySchema1Boxed { + override fun getData(): Any? { + return data + } + } + + data class AnyofWithOneEmptySchema1BoxedString(val data: String) : AnyofWithOneEmptySchema1Boxed { + override fun getData(): Any? { + return data + } + } + + data class AnyofWithOneEmptySchema1BoxedList(val data: FrozenList) : AnyofWithOneEmptySchema1Boxed { + override fun getData(): Any? { + return data + } + } + + data class AnyofWithOneEmptySchema1BoxedMap(val data: FrozenMap) : AnyofWithOneEmptySchema1Boxed { + override fun getData(): Any? { + return data + } + } + + + class AnyofWithOneEmptySchema1 private constructor(): JsonSchema( + JsonSchemaInfo() + .anyOf(listOf( + Schema0::class.java, + Schema1::class.java + )) + ), NullSchemaValidator, BooleanSchemaValidator, NumberSchemaValidator, StringSchemaValidator, ListSchemaValidator, AnyofWithOneEmptySchema1BoxedList>, MapSchemaValidator, AnyofWithOneEmptySchema1BoxedMap> { + /* + NOTE: This class is auto generated by OpenAPI JSON Schema Generator. + Ref: https://github.com/openapi-json-schema-tools/openapi-json-schema-generator + + Do not edit the class manually. + */ + + companion object { + @Volatile + private var instance: AnyofWithOneEmptySchema1? = null + + fun getInstance() = + instance ?: synchronized(this) { + instance ?: AnyofWithOneEmptySchema1().also { instance = it } + } + } + + @Throws(ValidationException::class) + override fun validate(arg: Nothing?, configuration: SchemaConfiguration?): Nothing? { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validatedPathToSchemas = PathToSchemasMap() + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, LinkedHashSet()) + getPathToSchemas(this, castArg, validationMetadata, pathSet) + return castArg + } + + @Throws(ValidationException::class) + override fun validate(arg: Boolean, configuration: SchemaConfiguration?): Boolean { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validatedPathToSchemas = PathToSchemasMap() + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, LinkedHashSet()) + getPathToSchemas(this, castArg, validationMetadata, pathSet) + return castArg + } + + @Throws(ValidationException::class) + override fun validate(arg: Number, configuration: SchemaConfiguration?): Number { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validatedPathToSchemas = PathToSchemasMap() + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, LinkedHashSet()) + getPathToSchemas(this, castArg, validationMetadata, pathSet) + return castArg + } + + @Throws(ValidationException::class) + fun validate(arg: Int, configuration: SchemaConfiguration?): Int { + return validate(arg as Number, configuration) as Int + } + + @Throws(ValidationException::class) + fun validate(arg: Long, configuration: SchemaConfiguration?): Long { + return validate(arg as Number, configuration) as Long + } + + @Throws(ValidationException::class) + fun validate(arg: Float, configuration: SchemaConfiguration?): Float { + return validate(arg as Number, configuration) as Float + } + + @Throws(ValidationException::class) + fun validate(arg: Double, configuration: SchemaConfiguration?): Double { + return validate(arg as Number, configuration) as Double + } + + @Throws(ValidationException::class) + override fun validate(arg: String, configuration: SchemaConfiguration?): String { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validatedPathToSchemas = PathToSchemasMap() + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, LinkedHashSet()) + getPathToSchemas(this, castArg, validationMetadata, pathSet) + return castArg + } + + @Throws(ValidationException::class) + fun validate(arg: LocalDate, configuration: SchemaConfiguration?): String { + return validate(arg.toString(), configuration) + } + + @Throws(ValidationException::class) + fun validate(arg: ZonedDateTime, configuration: SchemaConfiguration?): String { + return validate(arg.toString(), configuration) + } + + @Throws(ValidationException::class) + fun validate(arg: UUID, configuration: SchemaConfiguration?): String { + return validate(arg.toString(), configuration) + } + + override fun getNewInstance(arg: List<*>, pathToItem: List, pathToSchemas: PathToSchemasMap): FrozenList { + val items: MutableList = ArrayList() + var i: Int = 0 + for (item: Any? in arg) { + val itemPathToItem = pathToItem + i + val schemas: LinkedHashMap, Nothing?>? = pathToSchemas.get(itemPathToItem) + if (schemas == null) { + throw RuntimeException("Validation result is invalid, schemas must exist for a pathToItem") + } + val itemSchema: JsonSchema<*> = schemas.entries.iterator().next().key + val itemInstance: Any? = itemSchema.getNewInstance(item, itemPathToItem, pathToSchemas) + items.add(itemInstance) + i += 1 + } + val newInstanceItems: FrozenList = FrozenList(items) + return newInstanceItems + } + + @Throws(ValidationException::class) + override fun validate(arg: List<*>, configuration: SchemaConfiguration?): FrozenList { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, PathToSchemasMap(), LinkedHashSet()) + val pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet) + return getNewInstance(castArg, validationMetadata.pathToItem, pathToSchemasMap) + } + + override fun getNewInstance(arg: Map<*, *>, pathToItem: List, pathToSchemas: PathToSchemasMap): FrozenMap { + val properties: LinkedHashMap = LinkedHashMap() + for((propertyName, value) in arg) { + if (!(propertyName is String)) { + throw RuntimeException("Invalid non-string key value") + } + val propertyPathToItem: List = pathToItem + propertyName + val schemas: LinkedHashMap, Nothing?>? = pathToSchemas.get(propertyPathToItem) + if (schemas == null) { + throw RuntimeException("Validation result is invalid, schemas must exist for a pathToItem") + } + val propertySchema: JsonSchema<*> = schemas.entries.iterator().next().key + val propertyInstance: Any? = propertySchema.getNewInstance(value, propertyPathToItem, pathToSchemas) + properties[propertyName] = propertyInstance + } + val castProperties: FrozenMap = FrozenMap(properties) + return castProperties + } + + @Throws(ValidationException::class) + override fun validate(arg: Map<*, *>, configuration: SchemaConfiguration?): FrozenMap { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validatedPathToSchemas = PathToSchemasMap() + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, LinkedHashSet()) + val pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet) + return getNewInstance(castArg, validationMetadata.pathToItem, pathToSchemasMap) + } + + @Throws(ValidationException::class) + override fun validate(arg: Any?, configuration: SchemaConfiguration?): Any? { + if (arg == null) { + return validate(null, configuration) + } else if (arg is Boolean) { + return validate(arg, configuration) + } else if (arg is Number) { + return validate(arg, configuration) + } else if (arg is String) { + return validate(arg, configuration) + } else if (arg is List<*>) { + return validate(arg, configuration) + } else if (arg is Map<*, *>) { + return validate(arg, configuration) + } + throw ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema") + } + override fun getNewInstance(arg: Any?, pathToItem: List, pathToSchemas: PathToSchemasMap): Any? { + if (arg == null) { + return getNewInstance( null, pathToItem, pathToSchemas) + } else if (arg is Boolean) { + return getNewInstance(arg, pathToItem, pathToSchemas) + } else if (arg is Number) { + return getNewInstance(arg, pathToItem, pathToSchemas) + } else if (arg is String) { + return getNewInstance(arg, pathToItem, pathToSchemas) + } else if (arg is List<*>) { + return getNewInstance(arg, pathToItem, pathToSchemas) + } else if (arg is Map<*, *>) { + return getNewInstance(arg, pathToItem, pathToSchemas) + } + throw RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema") + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: Nothing?, configuration: SchemaConfiguration?): AnyofWithOneEmptySchema1BoxedVoid { + return AnyofWithOneEmptySchema1BoxedVoid(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: Boolean, configuration: SchemaConfiguration?): AnyofWithOneEmptySchema1BoxedBoolean { + return AnyofWithOneEmptySchema1BoxedBoolean(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: Number, configuration: SchemaConfiguration?): AnyofWithOneEmptySchema1BoxedNumber { + return AnyofWithOneEmptySchema1BoxedNumber(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: String, configuration: SchemaConfiguration?): AnyofWithOneEmptySchema1BoxedString { + return AnyofWithOneEmptySchema1BoxedString(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: List<*>, configuration: SchemaConfiguration?): AnyofWithOneEmptySchema1BoxedList { + return AnyofWithOneEmptySchema1BoxedList(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: Map<*, *>, configuration: SchemaConfiguration?): AnyofWithOneEmptySchema1BoxedMap { + return AnyofWithOneEmptySchema1BoxedMap(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: Any?, configuration: SchemaConfiguration?): AnyofWithOneEmptySchema1Boxed { + if (arg == null) { + return validateAndBox(null, configuration) + } else if (arg is Boolean) { + return validateAndBox(arg, configuration) + } else if (arg is String) { + return validateAndBox(arg, configuration) + } else if (arg is Number) { + return validateAndBox(arg, configuration) + } else if (arg is List<*>) { + return validateAndBox(arg, configuration) + } else if (arg is Map<*, *>) { + return validateAndBox(arg, configuration) + } + throw ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema") + } + } +} diff --git a/samples/client/3_1_0_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/schemas/ArrayTypeMatchesArrays.kt b/samples/client/3_1_0_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/schemas/ArrayTypeMatchesArrays.kt new file mode 100644 index 00000000000..27a7304f30f --- /dev/null +++ b/samples/client/3_1_0_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/schemas/ArrayTypeMatchesArrays.kt @@ -0,0 +1,21 @@ +package org.openapijsonschematools.client.components.schemas +import org.openapijsonschematools.client.schemas.ListJsonSchema +import org.openapijsonschematools.client.schemas.validation.FrozenList + +class ArrayTypeMatchesArrays: ListJsonSchema() { + // nest classes so all schemas and input/output classes can be public + + + class ArrayTypeMatchesArrays1 : ListJsonSchema.ListJsonSchema1() { + companion object { + @Volatile + private var instance: ArrayTypeMatchesArrays1? = null + + fun getInstance() = + instance ?: synchronized(this) { + instance ?: ArrayTypeMatchesArrays1().also { instance = it } + } + } + } + +} diff --git a/samples/client/3_1_0_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/schemas/BooleanTypeMatchesBooleans.kt b/samples/client/3_1_0_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/schemas/BooleanTypeMatchesBooleans.kt new file mode 100644 index 00000000000..f557463b4d8 --- /dev/null +++ b/samples/client/3_1_0_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/schemas/BooleanTypeMatchesBooleans.kt @@ -0,0 +1,20 @@ +package org.openapijsonschematools.client.components.schemas +import org.openapijsonschematools.client.schemas.BooleanJsonSchema + +class BooleanTypeMatchesBooleans: BooleanJsonSchema() { + // nest classes so all schemas and input/output classes can be public + + + class BooleanTypeMatchesBooleans1 : BooleanJsonSchema.BooleanJsonSchema1() { + companion object { + @Volatile + private var instance: BooleanTypeMatchesBooleans1? = null + + fun getInstance() = + instance ?: synchronized(this) { + instance ?: BooleanTypeMatchesBooleans1().also { instance = it } + } + } + } + +} diff --git a/samples/client/3_1_0_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/schemas/ByInt.kt b/samples/client/3_1_0_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/schemas/ByInt.kt new file mode 100644 index 00000000000..e02942f3d65 --- /dev/null +++ b/samples/client/3_1_0_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/schemas/ByInt.kt @@ -0,0 +1,309 @@ +package org.openapijsonschematools.client.components.schemas +import java.math.BigDecimal +import java.time.LocalDate +import java.time.ZonedDateTime +import java.util.UUID +import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags +import org.openapijsonschematools.client.configurations.SchemaConfiguration +import org.openapijsonschematools.client.exceptions.InvalidAdditionalPropertyException +import org.openapijsonschematools.client.exceptions.UnsetPropertyException +import org.openapijsonschematools.client.exceptions.ValidationException +import org.openapijsonschematools.client.schemas.UnsetAddPropsSetter +import org.openapijsonschematools.client.schemas.validation.BooleanSchemaValidator +import org.openapijsonschematools.client.schemas.validation.FrozenList +import org.openapijsonschematools.client.schemas.validation.FrozenMap +import org.openapijsonschematools.client.schemas.validation.JsonSchema +import org.openapijsonschematools.client.schemas.validation.JsonSchemaInfo +import org.openapijsonschematools.client.schemas.validation.ListSchemaValidator +import org.openapijsonschematools.client.schemas.validation.MapSchemaValidator +import org.openapijsonschematools.client.schemas.validation.NullSchemaValidator +import org.openapijsonschematools.client.schemas.validation.NumberSchemaValidator +import org.openapijsonschematools.client.schemas.validation.PathToSchemasMap +import org.openapijsonschematools.client.schemas.validation.StringSchemaValidator +import org.openapijsonschematools.client.schemas.validation.ValidationMetadata + +class ByInt { + // nest classes so all schemas and input/output classes can be public + + + sealed interface ByInt1Boxed { + fun getData(): Any? + } + + data class ByInt1BoxedVoid(val data: Nothing?) : ByInt1Boxed { + override fun getData(): Any? { + return data + } + } + + data class ByInt1BoxedBoolean(val data: Boolean): ByInt1Boxed { + override fun getData(): Any? { + return data + } + } + + data class ByInt1BoxedNumber(val data: Number) : ByInt1Boxed { + override fun getData(): Any? { + return data + } + } + + data class ByInt1BoxedString(val data: String) : ByInt1Boxed { + override fun getData(): Any? { + return data + } + } + + data class ByInt1BoxedList(val data: FrozenList) : ByInt1Boxed { + override fun getData(): Any? { + return data + } + } + + data class ByInt1BoxedMap(val data: FrozenMap) : ByInt1Boxed { + override fun getData(): Any? { + return data + } + } + + + class ByInt1 private constructor(): JsonSchema( + JsonSchemaInfo() + .multipleOf(BigDecimal("2")) + ), NullSchemaValidator, BooleanSchemaValidator, NumberSchemaValidator, StringSchemaValidator, ListSchemaValidator, ByInt1BoxedList>, MapSchemaValidator, ByInt1BoxedMap> { + /* + NOTE: This class is auto generated by OpenAPI JSON Schema Generator. + Ref: https://github.com/openapi-json-schema-tools/openapi-json-schema-generator + + Do not edit the class manually. + */ + + companion object { + @Volatile + private var instance: ByInt1? = null + + fun getInstance() = + instance ?: synchronized(this) { + instance ?: ByInt1().also { instance = it } + } + } + + @Throws(ValidationException::class) + override fun validate(arg: Nothing?, configuration: SchemaConfiguration?): Nothing? { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validatedPathToSchemas = PathToSchemasMap() + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, LinkedHashSet()) + getPathToSchemas(this, castArg, validationMetadata, pathSet) + return castArg + } + + @Throws(ValidationException::class) + override fun validate(arg: Boolean, configuration: SchemaConfiguration?): Boolean { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validatedPathToSchemas = PathToSchemasMap() + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, LinkedHashSet()) + getPathToSchemas(this, castArg, validationMetadata, pathSet) + return castArg + } + + @Throws(ValidationException::class) + override fun validate(arg: Number, configuration: SchemaConfiguration?): Number { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validatedPathToSchemas = PathToSchemasMap() + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, LinkedHashSet()) + getPathToSchemas(this, castArg, validationMetadata, pathSet) + return castArg + } + + @Throws(ValidationException::class) + fun validate(arg: Int, configuration: SchemaConfiguration?): Int { + return validate(arg as Number, configuration) as Int + } + + @Throws(ValidationException::class) + fun validate(arg: Long, configuration: SchemaConfiguration?): Long { + return validate(arg as Number, configuration) as Long + } + + @Throws(ValidationException::class) + fun validate(arg: Float, configuration: SchemaConfiguration?): Float { + return validate(arg as Number, configuration) as Float + } + + @Throws(ValidationException::class) + fun validate(arg: Double, configuration: SchemaConfiguration?): Double { + return validate(arg as Number, configuration) as Double + } + + @Throws(ValidationException::class) + override fun validate(arg: String, configuration: SchemaConfiguration?): String { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validatedPathToSchemas = PathToSchemasMap() + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, LinkedHashSet()) + getPathToSchemas(this, castArg, validationMetadata, pathSet) + return castArg + } + + @Throws(ValidationException::class) + fun validate(arg: LocalDate, configuration: SchemaConfiguration?): String { + return validate(arg.toString(), configuration) + } + + @Throws(ValidationException::class) + fun validate(arg: ZonedDateTime, configuration: SchemaConfiguration?): String { + return validate(arg.toString(), configuration) + } + + @Throws(ValidationException::class) + fun validate(arg: UUID, configuration: SchemaConfiguration?): String { + return validate(arg.toString(), configuration) + } + + override fun getNewInstance(arg: List<*>, pathToItem: List, pathToSchemas: PathToSchemasMap): FrozenList { + val items: MutableList = ArrayList() + var i: Int = 0 + for (item: Any? in arg) { + val itemPathToItem = pathToItem + i + val schemas: LinkedHashMap, Nothing?>? = pathToSchemas.get(itemPathToItem) + if (schemas == null) { + throw RuntimeException("Validation result is invalid, schemas must exist for a pathToItem") + } + val itemSchema: JsonSchema<*> = schemas.entries.iterator().next().key + val itemInstance: Any? = itemSchema.getNewInstance(item, itemPathToItem, pathToSchemas) + items.add(itemInstance) + i += 1 + } + val newInstanceItems: FrozenList = FrozenList(items) + return newInstanceItems + } + + @Throws(ValidationException::class) + override fun validate(arg: List<*>, configuration: SchemaConfiguration?): FrozenList { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, PathToSchemasMap(), LinkedHashSet()) + val pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet) + return getNewInstance(castArg, validationMetadata.pathToItem, pathToSchemasMap) + } + + override fun getNewInstance(arg: Map<*, *>, pathToItem: List, pathToSchemas: PathToSchemasMap): FrozenMap { + val properties: LinkedHashMap = LinkedHashMap() + for((propertyName, value) in arg) { + if (!(propertyName is String)) { + throw RuntimeException("Invalid non-string key value") + } + val propertyPathToItem: List = pathToItem + propertyName + val schemas: LinkedHashMap, Nothing?>? = pathToSchemas.get(propertyPathToItem) + if (schemas == null) { + throw RuntimeException("Validation result is invalid, schemas must exist for a pathToItem") + } + val propertySchema: JsonSchema<*> = schemas.entries.iterator().next().key + val propertyInstance: Any? = propertySchema.getNewInstance(value, propertyPathToItem, pathToSchemas) + properties[propertyName] = propertyInstance + } + val castProperties: FrozenMap = FrozenMap(properties) + return castProperties + } + + @Throws(ValidationException::class) + override fun validate(arg: Map<*, *>, configuration: SchemaConfiguration?): FrozenMap { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validatedPathToSchemas = PathToSchemasMap() + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, LinkedHashSet()) + val pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet) + return getNewInstance(castArg, validationMetadata.pathToItem, pathToSchemasMap) + } + + @Throws(ValidationException::class) + override fun validate(arg: Any?, configuration: SchemaConfiguration?): Any? { + if (arg == null) { + return validate(null, configuration) + } else if (arg is Boolean) { + return validate(arg, configuration) + } else if (arg is Number) { + return validate(arg, configuration) + } else if (arg is String) { + return validate(arg, configuration) + } else if (arg is List<*>) { + return validate(arg, configuration) + } else if (arg is Map<*, *>) { + return validate(arg, configuration) + } + throw ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema") + } + override fun getNewInstance(arg: Any?, pathToItem: List, pathToSchemas: PathToSchemasMap): Any? { + if (arg == null) { + return getNewInstance( null, pathToItem, pathToSchemas) + } else if (arg is Boolean) { + return getNewInstance(arg, pathToItem, pathToSchemas) + } else if (arg is Number) { + return getNewInstance(arg, pathToItem, pathToSchemas) + } else if (arg is String) { + return getNewInstance(arg, pathToItem, pathToSchemas) + } else if (arg is List<*>) { + return getNewInstance(arg, pathToItem, pathToSchemas) + } else if (arg is Map<*, *>) { + return getNewInstance(arg, pathToItem, pathToSchemas) + } + throw RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema") + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: Nothing?, configuration: SchemaConfiguration?): ByInt1BoxedVoid { + return ByInt1BoxedVoid(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: Boolean, configuration: SchemaConfiguration?): ByInt1BoxedBoolean { + return ByInt1BoxedBoolean(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: Number, configuration: SchemaConfiguration?): ByInt1BoxedNumber { + return ByInt1BoxedNumber(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: String, configuration: SchemaConfiguration?): ByInt1BoxedString { + return ByInt1BoxedString(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: List<*>, configuration: SchemaConfiguration?): ByInt1BoxedList { + return ByInt1BoxedList(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: Map<*, *>, configuration: SchemaConfiguration?): ByInt1BoxedMap { + return ByInt1BoxedMap(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: Any?, configuration: SchemaConfiguration?): ByInt1Boxed { + if (arg == null) { + return validateAndBox(null, configuration) + } else if (arg is Boolean) { + return validateAndBox(arg, configuration) + } else if (arg is String) { + return validateAndBox(arg, configuration) + } else if (arg is Number) { + return validateAndBox(arg, configuration) + } else if (arg is List<*>) { + return validateAndBox(arg, configuration) + } else if (arg is Map<*, *>) { + return validateAndBox(arg, configuration) + } + throw ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema") + } + } +} diff --git a/samples/client/3_1_0_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/schemas/ByNumber.kt b/samples/client/3_1_0_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/schemas/ByNumber.kt new file mode 100644 index 00000000000..92ab5a5ee41 --- /dev/null +++ b/samples/client/3_1_0_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/schemas/ByNumber.kt @@ -0,0 +1,309 @@ +package org.openapijsonschematools.client.components.schemas +import java.math.BigDecimal +import java.time.LocalDate +import java.time.ZonedDateTime +import java.util.UUID +import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags +import org.openapijsonschematools.client.configurations.SchemaConfiguration +import org.openapijsonschematools.client.exceptions.InvalidAdditionalPropertyException +import org.openapijsonschematools.client.exceptions.UnsetPropertyException +import org.openapijsonschematools.client.exceptions.ValidationException +import org.openapijsonschematools.client.schemas.UnsetAddPropsSetter +import org.openapijsonschematools.client.schemas.validation.BooleanSchemaValidator +import org.openapijsonschematools.client.schemas.validation.FrozenList +import org.openapijsonschematools.client.schemas.validation.FrozenMap +import org.openapijsonschematools.client.schemas.validation.JsonSchema +import org.openapijsonschematools.client.schemas.validation.JsonSchemaInfo +import org.openapijsonschematools.client.schemas.validation.ListSchemaValidator +import org.openapijsonschematools.client.schemas.validation.MapSchemaValidator +import org.openapijsonschematools.client.schemas.validation.NullSchemaValidator +import org.openapijsonschematools.client.schemas.validation.NumberSchemaValidator +import org.openapijsonschematools.client.schemas.validation.PathToSchemasMap +import org.openapijsonschematools.client.schemas.validation.StringSchemaValidator +import org.openapijsonschematools.client.schemas.validation.ValidationMetadata + +class ByNumber { + // nest classes so all schemas and input/output classes can be public + + + sealed interface ByNumber1Boxed { + fun getData(): Any? + } + + data class ByNumber1BoxedVoid(val data: Nothing?) : ByNumber1Boxed { + override fun getData(): Any? { + return data + } + } + + data class ByNumber1BoxedBoolean(val data: Boolean): ByNumber1Boxed { + override fun getData(): Any? { + return data + } + } + + data class ByNumber1BoxedNumber(val data: Number) : ByNumber1Boxed { + override fun getData(): Any? { + return data + } + } + + data class ByNumber1BoxedString(val data: String) : ByNumber1Boxed { + override fun getData(): Any? { + return data + } + } + + data class ByNumber1BoxedList(val data: FrozenList) : ByNumber1Boxed { + override fun getData(): Any? { + return data + } + } + + data class ByNumber1BoxedMap(val data: FrozenMap) : ByNumber1Boxed { + override fun getData(): Any? { + return data + } + } + + + class ByNumber1 private constructor(): JsonSchema( + JsonSchemaInfo() + .multipleOf(BigDecimal("1.5")) + ), NullSchemaValidator, BooleanSchemaValidator, NumberSchemaValidator, StringSchemaValidator, ListSchemaValidator, ByNumber1BoxedList>, MapSchemaValidator, ByNumber1BoxedMap> { + /* + NOTE: This class is auto generated by OpenAPI JSON Schema Generator. + Ref: https://github.com/openapi-json-schema-tools/openapi-json-schema-generator + + Do not edit the class manually. + */ + + companion object { + @Volatile + private var instance: ByNumber1? = null + + fun getInstance() = + instance ?: synchronized(this) { + instance ?: ByNumber1().also { instance = it } + } + } + + @Throws(ValidationException::class) + override fun validate(arg: Nothing?, configuration: SchemaConfiguration?): Nothing? { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validatedPathToSchemas = PathToSchemasMap() + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, LinkedHashSet()) + getPathToSchemas(this, castArg, validationMetadata, pathSet) + return castArg + } + + @Throws(ValidationException::class) + override fun validate(arg: Boolean, configuration: SchemaConfiguration?): Boolean { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validatedPathToSchemas = PathToSchemasMap() + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, LinkedHashSet()) + getPathToSchemas(this, castArg, validationMetadata, pathSet) + return castArg + } + + @Throws(ValidationException::class) + override fun validate(arg: Number, configuration: SchemaConfiguration?): Number { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validatedPathToSchemas = PathToSchemasMap() + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, LinkedHashSet()) + getPathToSchemas(this, castArg, validationMetadata, pathSet) + return castArg + } + + @Throws(ValidationException::class) + fun validate(arg: Int, configuration: SchemaConfiguration?): Int { + return validate(arg as Number, configuration) as Int + } + + @Throws(ValidationException::class) + fun validate(arg: Long, configuration: SchemaConfiguration?): Long { + return validate(arg as Number, configuration) as Long + } + + @Throws(ValidationException::class) + fun validate(arg: Float, configuration: SchemaConfiguration?): Float { + return validate(arg as Number, configuration) as Float + } + + @Throws(ValidationException::class) + fun validate(arg: Double, configuration: SchemaConfiguration?): Double { + return validate(arg as Number, configuration) as Double + } + + @Throws(ValidationException::class) + override fun validate(arg: String, configuration: SchemaConfiguration?): String { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validatedPathToSchemas = PathToSchemasMap() + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, LinkedHashSet()) + getPathToSchemas(this, castArg, validationMetadata, pathSet) + return castArg + } + + @Throws(ValidationException::class) + fun validate(arg: LocalDate, configuration: SchemaConfiguration?): String { + return validate(arg.toString(), configuration) + } + + @Throws(ValidationException::class) + fun validate(arg: ZonedDateTime, configuration: SchemaConfiguration?): String { + return validate(arg.toString(), configuration) + } + + @Throws(ValidationException::class) + fun validate(arg: UUID, configuration: SchemaConfiguration?): String { + return validate(arg.toString(), configuration) + } + + override fun getNewInstance(arg: List<*>, pathToItem: List, pathToSchemas: PathToSchemasMap): FrozenList { + val items: MutableList = ArrayList() + var i: Int = 0 + for (item: Any? in arg) { + val itemPathToItem = pathToItem + i + val schemas: LinkedHashMap, Nothing?>? = pathToSchemas.get(itemPathToItem) + if (schemas == null) { + throw RuntimeException("Validation result is invalid, schemas must exist for a pathToItem") + } + val itemSchema: JsonSchema<*> = schemas.entries.iterator().next().key + val itemInstance: Any? = itemSchema.getNewInstance(item, itemPathToItem, pathToSchemas) + items.add(itemInstance) + i += 1 + } + val newInstanceItems: FrozenList = FrozenList(items) + return newInstanceItems + } + + @Throws(ValidationException::class) + override fun validate(arg: List<*>, configuration: SchemaConfiguration?): FrozenList { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, PathToSchemasMap(), LinkedHashSet()) + val pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet) + return getNewInstance(castArg, validationMetadata.pathToItem, pathToSchemasMap) + } + + override fun getNewInstance(arg: Map<*, *>, pathToItem: List, pathToSchemas: PathToSchemasMap): FrozenMap { + val properties: LinkedHashMap = LinkedHashMap() + for((propertyName, value) in arg) { + if (!(propertyName is String)) { + throw RuntimeException("Invalid non-string key value") + } + val propertyPathToItem: List = pathToItem + propertyName + val schemas: LinkedHashMap, Nothing?>? = pathToSchemas.get(propertyPathToItem) + if (schemas == null) { + throw RuntimeException("Validation result is invalid, schemas must exist for a pathToItem") + } + val propertySchema: JsonSchema<*> = schemas.entries.iterator().next().key + val propertyInstance: Any? = propertySchema.getNewInstance(value, propertyPathToItem, pathToSchemas) + properties[propertyName] = propertyInstance + } + val castProperties: FrozenMap = FrozenMap(properties) + return castProperties + } + + @Throws(ValidationException::class) + override fun validate(arg: Map<*, *>, configuration: SchemaConfiguration?): FrozenMap { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validatedPathToSchemas = PathToSchemasMap() + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, LinkedHashSet()) + val pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet) + return getNewInstance(castArg, validationMetadata.pathToItem, pathToSchemasMap) + } + + @Throws(ValidationException::class) + override fun validate(arg: Any?, configuration: SchemaConfiguration?): Any? { + if (arg == null) { + return validate(null, configuration) + } else if (arg is Boolean) { + return validate(arg, configuration) + } else if (arg is Number) { + return validate(arg, configuration) + } else if (arg is String) { + return validate(arg, configuration) + } else if (arg is List<*>) { + return validate(arg, configuration) + } else if (arg is Map<*, *>) { + return validate(arg, configuration) + } + throw ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema") + } + override fun getNewInstance(arg: Any?, pathToItem: List, pathToSchemas: PathToSchemasMap): Any? { + if (arg == null) { + return getNewInstance( null, pathToItem, pathToSchemas) + } else if (arg is Boolean) { + return getNewInstance(arg, pathToItem, pathToSchemas) + } else if (arg is Number) { + return getNewInstance(arg, pathToItem, pathToSchemas) + } else if (arg is String) { + return getNewInstance(arg, pathToItem, pathToSchemas) + } else if (arg is List<*>) { + return getNewInstance(arg, pathToItem, pathToSchemas) + } else if (arg is Map<*, *>) { + return getNewInstance(arg, pathToItem, pathToSchemas) + } + throw RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema") + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: Nothing?, configuration: SchemaConfiguration?): ByNumber1BoxedVoid { + return ByNumber1BoxedVoid(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: Boolean, configuration: SchemaConfiguration?): ByNumber1BoxedBoolean { + return ByNumber1BoxedBoolean(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: Number, configuration: SchemaConfiguration?): ByNumber1BoxedNumber { + return ByNumber1BoxedNumber(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: String, configuration: SchemaConfiguration?): ByNumber1BoxedString { + return ByNumber1BoxedString(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: List<*>, configuration: SchemaConfiguration?): ByNumber1BoxedList { + return ByNumber1BoxedList(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: Map<*, *>, configuration: SchemaConfiguration?): ByNumber1BoxedMap { + return ByNumber1BoxedMap(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: Any?, configuration: SchemaConfiguration?): ByNumber1Boxed { + if (arg == null) { + return validateAndBox(null, configuration) + } else if (arg is Boolean) { + return validateAndBox(arg, configuration) + } else if (arg is String) { + return validateAndBox(arg, configuration) + } else if (arg is Number) { + return validateAndBox(arg, configuration) + } else if (arg is List<*>) { + return validateAndBox(arg, configuration) + } else if (arg is Map<*, *>) { + return validateAndBox(arg, configuration) + } + throw ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema") + } + } +} diff --git a/samples/client/3_1_0_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/schemas/BySmallNumber.kt b/samples/client/3_1_0_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/schemas/BySmallNumber.kt new file mode 100644 index 00000000000..3f9c9b3ffe9 --- /dev/null +++ b/samples/client/3_1_0_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/schemas/BySmallNumber.kt @@ -0,0 +1,309 @@ +package org.openapijsonschematools.client.components.schemas +import java.math.BigDecimal +import java.time.LocalDate +import java.time.ZonedDateTime +import java.util.UUID +import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags +import org.openapijsonschematools.client.configurations.SchemaConfiguration +import org.openapijsonschematools.client.exceptions.InvalidAdditionalPropertyException +import org.openapijsonschematools.client.exceptions.UnsetPropertyException +import org.openapijsonschematools.client.exceptions.ValidationException +import org.openapijsonschematools.client.schemas.UnsetAddPropsSetter +import org.openapijsonschematools.client.schemas.validation.BooleanSchemaValidator +import org.openapijsonschematools.client.schemas.validation.FrozenList +import org.openapijsonschematools.client.schemas.validation.FrozenMap +import org.openapijsonschematools.client.schemas.validation.JsonSchema +import org.openapijsonschematools.client.schemas.validation.JsonSchemaInfo +import org.openapijsonschematools.client.schemas.validation.ListSchemaValidator +import org.openapijsonschematools.client.schemas.validation.MapSchemaValidator +import org.openapijsonschematools.client.schemas.validation.NullSchemaValidator +import org.openapijsonschematools.client.schemas.validation.NumberSchemaValidator +import org.openapijsonschematools.client.schemas.validation.PathToSchemasMap +import org.openapijsonschematools.client.schemas.validation.StringSchemaValidator +import org.openapijsonschematools.client.schemas.validation.ValidationMetadata + +class BySmallNumber { + // nest classes so all schemas and input/output classes can be public + + + sealed interface BySmallNumber1Boxed { + fun getData(): Any? + } + + data class BySmallNumber1BoxedVoid(val data: Nothing?) : BySmallNumber1Boxed { + override fun getData(): Any? { + return data + } + } + + data class BySmallNumber1BoxedBoolean(val data: Boolean): BySmallNumber1Boxed { + override fun getData(): Any? { + return data + } + } + + data class BySmallNumber1BoxedNumber(val data: Number) : BySmallNumber1Boxed { + override fun getData(): Any? { + return data + } + } + + data class BySmallNumber1BoxedString(val data: String) : BySmallNumber1Boxed { + override fun getData(): Any? { + return data + } + } + + data class BySmallNumber1BoxedList(val data: FrozenList) : BySmallNumber1Boxed { + override fun getData(): Any? { + return data + } + } + + data class BySmallNumber1BoxedMap(val data: FrozenMap) : BySmallNumber1Boxed { + override fun getData(): Any? { + return data + } + } + + + class BySmallNumber1 private constructor(): JsonSchema( + JsonSchemaInfo() + .multipleOf(BigDecimal("0.00010")) + ), NullSchemaValidator, BooleanSchemaValidator, NumberSchemaValidator, StringSchemaValidator, ListSchemaValidator, BySmallNumber1BoxedList>, MapSchemaValidator, BySmallNumber1BoxedMap> { + /* + NOTE: This class is auto generated by OpenAPI JSON Schema Generator. + Ref: https://github.com/openapi-json-schema-tools/openapi-json-schema-generator + + Do not edit the class manually. + */ + + companion object { + @Volatile + private var instance: BySmallNumber1? = null + + fun getInstance() = + instance ?: synchronized(this) { + instance ?: BySmallNumber1().also { instance = it } + } + } + + @Throws(ValidationException::class) + override fun validate(arg: Nothing?, configuration: SchemaConfiguration?): Nothing? { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validatedPathToSchemas = PathToSchemasMap() + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, LinkedHashSet()) + getPathToSchemas(this, castArg, validationMetadata, pathSet) + return castArg + } + + @Throws(ValidationException::class) + override fun validate(arg: Boolean, configuration: SchemaConfiguration?): Boolean { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validatedPathToSchemas = PathToSchemasMap() + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, LinkedHashSet()) + getPathToSchemas(this, castArg, validationMetadata, pathSet) + return castArg + } + + @Throws(ValidationException::class) + override fun validate(arg: Number, configuration: SchemaConfiguration?): Number { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validatedPathToSchemas = PathToSchemasMap() + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, LinkedHashSet()) + getPathToSchemas(this, castArg, validationMetadata, pathSet) + return castArg + } + + @Throws(ValidationException::class) + fun validate(arg: Int, configuration: SchemaConfiguration?): Int { + return validate(arg as Number, configuration) as Int + } + + @Throws(ValidationException::class) + fun validate(arg: Long, configuration: SchemaConfiguration?): Long { + return validate(arg as Number, configuration) as Long + } + + @Throws(ValidationException::class) + fun validate(arg: Float, configuration: SchemaConfiguration?): Float { + return validate(arg as Number, configuration) as Float + } + + @Throws(ValidationException::class) + fun validate(arg: Double, configuration: SchemaConfiguration?): Double { + return validate(arg as Number, configuration) as Double + } + + @Throws(ValidationException::class) + override fun validate(arg: String, configuration: SchemaConfiguration?): String { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validatedPathToSchemas = PathToSchemasMap() + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, LinkedHashSet()) + getPathToSchemas(this, castArg, validationMetadata, pathSet) + return castArg + } + + @Throws(ValidationException::class) + fun validate(arg: LocalDate, configuration: SchemaConfiguration?): String { + return validate(arg.toString(), configuration) + } + + @Throws(ValidationException::class) + fun validate(arg: ZonedDateTime, configuration: SchemaConfiguration?): String { + return validate(arg.toString(), configuration) + } + + @Throws(ValidationException::class) + fun validate(arg: UUID, configuration: SchemaConfiguration?): String { + return validate(arg.toString(), configuration) + } + + override fun getNewInstance(arg: List<*>, pathToItem: List, pathToSchemas: PathToSchemasMap): FrozenList { + val items: MutableList = ArrayList() + var i: Int = 0 + for (item: Any? in arg) { + val itemPathToItem = pathToItem + i + val schemas: LinkedHashMap, Nothing?>? = pathToSchemas.get(itemPathToItem) + if (schemas == null) { + throw RuntimeException("Validation result is invalid, schemas must exist for a pathToItem") + } + val itemSchema: JsonSchema<*> = schemas.entries.iterator().next().key + val itemInstance: Any? = itemSchema.getNewInstance(item, itemPathToItem, pathToSchemas) + items.add(itemInstance) + i += 1 + } + val newInstanceItems: FrozenList = FrozenList(items) + return newInstanceItems + } + + @Throws(ValidationException::class) + override fun validate(arg: List<*>, configuration: SchemaConfiguration?): FrozenList { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, PathToSchemasMap(), LinkedHashSet()) + val pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet) + return getNewInstance(castArg, validationMetadata.pathToItem, pathToSchemasMap) + } + + override fun getNewInstance(arg: Map<*, *>, pathToItem: List, pathToSchemas: PathToSchemasMap): FrozenMap { + val properties: LinkedHashMap = LinkedHashMap() + for((propertyName, value) in arg) { + if (!(propertyName is String)) { + throw RuntimeException("Invalid non-string key value") + } + val propertyPathToItem: List = pathToItem + propertyName + val schemas: LinkedHashMap, Nothing?>? = pathToSchemas.get(propertyPathToItem) + if (schemas == null) { + throw RuntimeException("Validation result is invalid, schemas must exist for a pathToItem") + } + val propertySchema: JsonSchema<*> = schemas.entries.iterator().next().key + val propertyInstance: Any? = propertySchema.getNewInstance(value, propertyPathToItem, pathToSchemas) + properties[propertyName] = propertyInstance + } + val castProperties: FrozenMap = FrozenMap(properties) + return castProperties + } + + @Throws(ValidationException::class) + override fun validate(arg: Map<*, *>, configuration: SchemaConfiguration?): FrozenMap { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validatedPathToSchemas = PathToSchemasMap() + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, LinkedHashSet()) + val pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet) + return getNewInstance(castArg, validationMetadata.pathToItem, pathToSchemasMap) + } + + @Throws(ValidationException::class) + override fun validate(arg: Any?, configuration: SchemaConfiguration?): Any? { + if (arg == null) { + return validate(null, configuration) + } else if (arg is Boolean) { + return validate(arg, configuration) + } else if (arg is Number) { + return validate(arg, configuration) + } else if (arg is String) { + return validate(arg, configuration) + } else if (arg is List<*>) { + return validate(arg, configuration) + } else if (arg is Map<*, *>) { + return validate(arg, configuration) + } + throw ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema") + } + override fun getNewInstance(arg: Any?, pathToItem: List, pathToSchemas: PathToSchemasMap): Any? { + if (arg == null) { + return getNewInstance( null, pathToItem, pathToSchemas) + } else if (arg is Boolean) { + return getNewInstance(arg, pathToItem, pathToSchemas) + } else if (arg is Number) { + return getNewInstance(arg, pathToItem, pathToSchemas) + } else if (arg is String) { + return getNewInstance(arg, pathToItem, pathToSchemas) + } else if (arg is List<*>) { + return getNewInstance(arg, pathToItem, pathToSchemas) + } else if (arg is Map<*, *>) { + return getNewInstance(arg, pathToItem, pathToSchemas) + } + throw RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema") + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: Nothing?, configuration: SchemaConfiguration?): BySmallNumber1BoxedVoid { + return BySmallNumber1BoxedVoid(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: Boolean, configuration: SchemaConfiguration?): BySmallNumber1BoxedBoolean { + return BySmallNumber1BoxedBoolean(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: Number, configuration: SchemaConfiguration?): BySmallNumber1BoxedNumber { + return BySmallNumber1BoxedNumber(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: String, configuration: SchemaConfiguration?): BySmallNumber1BoxedString { + return BySmallNumber1BoxedString(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: List<*>, configuration: SchemaConfiguration?): BySmallNumber1BoxedList { + return BySmallNumber1BoxedList(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: Map<*, *>, configuration: SchemaConfiguration?): BySmallNumber1BoxedMap { + return BySmallNumber1BoxedMap(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: Any?, configuration: SchemaConfiguration?): BySmallNumber1Boxed { + if (arg == null) { + return validateAndBox(null, configuration) + } else if (arg is Boolean) { + return validateAndBox(arg, configuration) + } else if (arg is String) { + return validateAndBox(arg, configuration) + } else if (arg is Number) { + return validateAndBox(arg, configuration) + } else if (arg is List<*>) { + return validateAndBox(arg, configuration) + } else if (arg is Map<*, *>) { + return validateAndBox(arg, configuration) + } + throw ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema") + } + } +} diff --git a/samples/client/3_1_0_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/schemas/ConstNulCharactersInStrings.kt b/samples/client/3_1_0_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/schemas/ConstNulCharactersInStrings.kt new file mode 100644 index 00000000000..6d794527178 --- /dev/null +++ b/samples/client/3_1_0_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/schemas/ConstNulCharactersInStrings.kt @@ -0,0 +1,318 @@ +package org.openapijsonschematools.client.components.schemas +import java.time.LocalDate +import java.time.ZonedDateTime +import java.util.UUID +import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags +import org.openapijsonschematools.client.configurations.SchemaConfiguration +import org.openapijsonschematools.client.exceptions.InvalidAdditionalPropertyException +import org.openapijsonschematools.client.exceptions.UnsetPropertyException +import org.openapijsonschematools.client.exceptions.ValidationException +import org.openapijsonschematools.client.schemas.UnsetAddPropsSetter +import org.openapijsonschematools.client.schemas.validation.BooleanSchemaValidator +import org.openapijsonschematools.client.schemas.validation.FrozenList +import org.openapijsonschematools.client.schemas.validation.FrozenMap +import org.openapijsonschematools.client.schemas.validation.JsonSchema +import org.openapijsonschematools.client.schemas.validation.JsonSchemaInfo +import org.openapijsonschematools.client.schemas.validation.ListSchemaValidator +import org.openapijsonschematools.client.schemas.validation.MapSchemaValidator +import org.openapijsonschematools.client.schemas.validation.NullSchemaValidator +import org.openapijsonschematools.client.schemas.validation.NumberSchemaValidator +import org.openapijsonschematools.client.schemas.validation.PathToSchemasMap +import org.openapijsonschematools.client.schemas.validation.StringEnumValidator +import org.openapijsonschematools.client.schemas.validation.StringSchemaValidator +import org.openapijsonschematools.client.schemas.validation.StringValueMethod +import org.openapijsonschematools.client.schemas.validation.ValidationMetadata + +class ConstNulCharactersInStrings { + // nest classes so all schemas and input/output classes can be public + + enum class StringConstNulCharactersInStringsConst(private val value: String): StringValueMethod { + HELLO_NULL_THERE("hello\u0000there"); + + override fun value(): String { + return this.value + } + } + + + sealed interface ConstNulCharactersInStrings1Boxed { + fun getData(): Any? + } + + data class ConstNulCharactersInStrings1BoxedVoid(val data: Nothing?) : ConstNulCharactersInStrings1Boxed { + override fun getData(): Any? { + return data + } + } + + data class ConstNulCharactersInStrings1BoxedBoolean(val data: Boolean): ConstNulCharactersInStrings1Boxed { + override fun getData(): Any? { + return data + } + } + + data class ConstNulCharactersInStrings1BoxedNumber(val data: Number) : ConstNulCharactersInStrings1Boxed { + override fun getData(): Any? { + return data + } + } + + data class ConstNulCharactersInStrings1BoxedString(val data: String) : ConstNulCharactersInStrings1Boxed { + override fun getData(): Any? { + return data + } + } + + data class ConstNulCharactersInStrings1BoxedList(val data: FrozenList) : ConstNulCharactersInStrings1Boxed { + override fun getData(): Any? { + return data + } + } + + data class ConstNulCharactersInStrings1BoxedMap(val data: FrozenMap) : ConstNulCharactersInStrings1Boxed { + override fun getData(): Any? { + return data + } + } + + + class ConstNulCharactersInStrings1 private constructor(): JsonSchema( + JsonSchemaInfo() + .constValue("hello\u0000there") + ), NullSchemaValidator, BooleanSchemaValidator, NumberSchemaValidator, StringSchemaValidator, ListSchemaValidator, ConstNulCharactersInStrings1BoxedList>, MapSchemaValidator, ConstNulCharactersInStrings1BoxedMap> { + /* + NOTE: This class is auto generated by OpenAPI JSON Schema Generator. + Ref: https://github.com/openapi-json-schema-tools/openapi-json-schema-generator + + Do not edit the class manually. + */ + + companion object { + @Volatile + private var instance: ConstNulCharactersInStrings1? = null + + fun getInstance() = + instance ?: synchronized(this) { + instance ?: ConstNulCharactersInStrings1().also { instance = it } + } + } + + @Throws(ValidationException::class) + override fun validate(arg: Nothing?, configuration: SchemaConfiguration?): Nothing? { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validatedPathToSchemas = PathToSchemasMap() + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, LinkedHashSet()) + getPathToSchemas(this, castArg, validationMetadata, pathSet) + return castArg + } + + @Throws(ValidationException::class) + override fun validate(arg: Boolean, configuration: SchemaConfiguration?): Boolean { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validatedPathToSchemas = PathToSchemasMap() + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, LinkedHashSet()) + getPathToSchemas(this, castArg, validationMetadata, pathSet) + return castArg + } + + @Throws(ValidationException::class) + override fun validate(arg: Number, configuration: SchemaConfiguration?): Number { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validatedPathToSchemas = PathToSchemasMap() + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, LinkedHashSet()) + getPathToSchemas(this, castArg, validationMetadata, pathSet) + return castArg + } + + @Throws(ValidationException::class) + fun validate(arg: Int, configuration: SchemaConfiguration?): Int { + return validate(arg as Number, configuration) as Int + } + + @Throws(ValidationException::class) + fun validate(arg: Long, configuration: SchemaConfiguration?): Long { + return validate(arg as Number, configuration) as Long + } + + @Throws(ValidationException::class) + fun validate(arg: Float, configuration: SchemaConfiguration?): Float { + return validate(arg as Number, configuration) as Float + } + + @Throws(ValidationException::class) + fun validate(arg: Double, configuration: SchemaConfiguration?): Double { + return validate(arg as Number, configuration) as Double + } + + @Throws(ValidationException::class) + override fun validate(arg: String, configuration: SchemaConfiguration?): String { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validatedPathToSchemas = PathToSchemasMap() + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, LinkedHashSet()) + getPathToSchemas(this, castArg, validationMetadata, pathSet) + return castArg + } + + @Throws(ValidationException::class) + fun validate(arg: LocalDate, configuration: SchemaConfiguration?): String { + return validate(arg.toString(), configuration) + } + + @Throws(ValidationException::class) + fun validate(arg: ZonedDateTime, configuration: SchemaConfiguration?): String { + return validate(arg.toString(), configuration) + } + + @Throws(ValidationException::class) + fun validate(arg: UUID, configuration: SchemaConfiguration?): String { + return validate(arg.toString(), configuration) + } + + override fun getNewInstance(arg: List<*>, pathToItem: List, pathToSchemas: PathToSchemasMap): FrozenList { + val items: MutableList = ArrayList() + var i: Int = 0 + for (item: Any? in arg) { + val itemPathToItem = pathToItem + i + val schemas: LinkedHashMap, Nothing?>? = pathToSchemas.get(itemPathToItem) + if (schemas == null) { + throw RuntimeException("Validation result is invalid, schemas must exist for a pathToItem") + } + val itemSchema: JsonSchema<*> = schemas.entries.iterator().next().key + val itemInstance: Any? = itemSchema.getNewInstance(item, itemPathToItem, pathToSchemas) + items.add(itemInstance) + i += 1 + } + val newInstanceItems: FrozenList = FrozenList(items) + return newInstanceItems + } + + @Throws(ValidationException::class) + override fun validate(arg: List<*>, configuration: SchemaConfiguration?): FrozenList { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, PathToSchemasMap(), LinkedHashSet()) + val pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet) + return getNewInstance(castArg, validationMetadata.pathToItem, pathToSchemasMap) + } + + override fun getNewInstance(arg: Map<*, *>, pathToItem: List, pathToSchemas: PathToSchemasMap): FrozenMap { + val properties: LinkedHashMap = LinkedHashMap() + for((propertyName, value) in arg) { + if (!(propertyName is String)) { + throw RuntimeException("Invalid non-string key value") + } + val propertyPathToItem: List = pathToItem + propertyName + val schemas: LinkedHashMap, Nothing?>? = pathToSchemas.get(propertyPathToItem) + if (schemas == null) { + throw RuntimeException("Validation result is invalid, schemas must exist for a pathToItem") + } + val propertySchema: JsonSchema<*> = schemas.entries.iterator().next().key + val propertyInstance: Any? = propertySchema.getNewInstance(value, propertyPathToItem, pathToSchemas) + properties[propertyName] = propertyInstance + } + val castProperties: FrozenMap = FrozenMap(properties) + return castProperties + } + + @Throws(ValidationException::class) + override fun validate(arg: Map<*, *>, configuration: SchemaConfiguration?): FrozenMap { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validatedPathToSchemas = PathToSchemasMap() + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, LinkedHashSet()) + val pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet) + return getNewInstance(castArg, validationMetadata.pathToItem, pathToSchemasMap) + } + + @Throws(ValidationException::class) + override fun validate(arg: Any?, configuration: SchemaConfiguration?): Any? { + if (arg == null) { + return validate(null, configuration) + } else if (arg is Boolean) { + return validate(arg, configuration) + } else if (arg is Number) { + return validate(arg, configuration) + } else if (arg is String) { + return validate(arg, configuration) + } else if (arg is List<*>) { + return validate(arg, configuration) + } else if (arg is Map<*, *>) { + return validate(arg, configuration) + } + throw ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema") + } + override fun getNewInstance(arg: Any?, pathToItem: List, pathToSchemas: PathToSchemasMap): Any? { + if (arg == null) { + return getNewInstance( null, pathToItem, pathToSchemas) + } else if (arg is Boolean) { + return getNewInstance(arg, pathToItem, pathToSchemas) + } else if (arg is Number) { + return getNewInstance(arg, pathToItem, pathToSchemas) + } else if (arg is String) { + return getNewInstance(arg, pathToItem, pathToSchemas) + } else if (arg is List<*>) { + return getNewInstance(arg, pathToItem, pathToSchemas) + } else if (arg is Map<*, *>) { + return getNewInstance(arg, pathToItem, pathToSchemas) + } + throw RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema") + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: Nothing?, configuration: SchemaConfiguration?): ConstNulCharactersInStrings1BoxedVoid { + return ConstNulCharactersInStrings1BoxedVoid(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: Boolean, configuration: SchemaConfiguration?): ConstNulCharactersInStrings1BoxedBoolean { + return ConstNulCharactersInStrings1BoxedBoolean(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: Number, configuration: SchemaConfiguration?): ConstNulCharactersInStrings1BoxedNumber { + return ConstNulCharactersInStrings1BoxedNumber(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: String, configuration: SchemaConfiguration?): ConstNulCharactersInStrings1BoxedString { + return ConstNulCharactersInStrings1BoxedString(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: List<*>, configuration: SchemaConfiguration?): ConstNulCharactersInStrings1BoxedList { + return ConstNulCharactersInStrings1BoxedList(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: Map<*, *>, configuration: SchemaConfiguration?): ConstNulCharactersInStrings1BoxedMap { + return ConstNulCharactersInStrings1BoxedMap(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: Any?, configuration: SchemaConfiguration?): ConstNulCharactersInStrings1Boxed { + if (arg == null) { + return validateAndBox(null, configuration) + } else if (arg is Boolean) { + return validateAndBox(arg, configuration) + } else if (arg is String) { + return validateAndBox(arg, configuration) + } else if (arg is Number) { + return validateAndBox(arg, configuration) + } else if (arg is List<*>) { + return validateAndBox(arg, configuration) + } else if (arg is Map<*, *>) { + return validateAndBox(arg, configuration) + } + throw ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema") + } + } +} diff --git a/samples/client/3_1_0_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/schemas/ContainsKeywordValidation.kt b/samples/client/3_1_0_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/schemas/ContainsKeywordValidation.kt new file mode 100644 index 00000000000..059c14dac3a --- /dev/null +++ b/samples/client/3_1_0_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/schemas/ContainsKeywordValidation.kt @@ -0,0 +1,583 @@ +package org.openapijsonschematools.client.components.schemas +import java.time.LocalDate +import java.time.ZonedDateTime +import java.util.UUID +import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags +import org.openapijsonschematools.client.configurations.SchemaConfiguration +import org.openapijsonschematools.client.exceptions.InvalidAdditionalPropertyException +import org.openapijsonschematools.client.exceptions.UnsetPropertyException +import org.openapijsonschematools.client.exceptions.ValidationException +import org.openapijsonschematools.client.schemas.UnsetAddPropsSetter +import org.openapijsonschematools.client.schemas.validation.BooleanSchemaValidator +import org.openapijsonschematools.client.schemas.validation.FrozenList +import org.openapijsonschematools.client.schemas.validation.FrozenMap +import org.openapijsonschematools.client.schemas.validation.JsonSchema +import org.openapijsonschematools.client.schemas.validation.JsonSchemaInfo +import org.openapijsonschematools.client.schemas.validation.ListSchemaValidator +import org.openapijsonschematools.client.schemas.validation.MapSchemaValidator +import org.openapijsonschematools.client.schemas.validation.NullSchemaValidator +import org.openapijsonschematools.client.schemas.validation.NumberSchemaValidator +import org.openapijsonschematools.client.schemas.validation.PathToSchemasMap +import org.openapijsonschematools.client.schemas.validation.StringSchemaValidator +import org.openapijsonschematools.client.schemas.validation.ValidationMetadata + +class ContainsKeywordValidation { + // nest classes so all schemas and input/output classes can be public + + + sealed interface ContainsBoxed { + fun getData(): Any? + } + + data class ContainsBoxedVoid(val data: Nothing?) : ContainsBoxed { + override fun getData(): Any? { + return data + } + } + + data class ContainsBoxedBoolean(val data: Boolean): ContainsBoxed { + override fun getData(): Any? { + return data + } + } + + data class ContainsBoxedNumber(val data: Number) : ContainsBoxed { + override fun getData(): Any? { + return data + } + } + + data class ContainsBoxedString(val data: String) : ContainsBoxed { + override fun getData(): Any? { + return data + } + } + + data class ContainsBoxedList(val data: FrozenList) : ContainsBoxed { + override fun getData(): Any? { + return data + } + } + + data class ContainsBoxedMap(val data: FrozenMap) : ContainsBoxed { + override fun getData(): Any? { + return data + } + } + + + class Contains private constructor(): JsonSchema( + JsonSchemaInfo() + .minimum(5) + ), NullSchemaValidator, BooleanSchemaValidator, NumberSchemaValidator, StringSchemaValidator, ListSchemaValidator, ContainsBoxedList>, MapSchemaValidator, ContainsBoxedMap> { + + companion object { + @Volatile + private var instance: Contains? = null + + fun getInstance() = + instance ?: synchronized(this) { + instance ?: Contains().also { instance = it } + } + } + + @Throws(ValidationException::class) + override fun validate(arg: Nothing?, configuration: SchemaConfiguration?): Nothing? { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validatedPathToSchemas = PathToSchemasMap() + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, LinkedHashSet()) + getPathToSchemas(this, castArg, validationMetadata, pathSet) + return castArg + } + + @Throws(ValidationException::class) + override fun validate(arg: Boolean, configuration: SchemaConfiguration?): Boolean { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validatedPathToSchemas = PathToSchemasMap() + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, LinkedHashSet()) + getPathToSchemas(this, castArg, validationMetadata, pathSet) + return castArg + } + + @Throws(ValidationException::class) + override fun validate(arg: Number, configuration: SchemaConfiguration?): Number { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validatedPathToSchemas = PathToSchemasMap() + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, LinkedHashSet()) + getPathToSchemas(this, castArg, validationMetadata, pathSet) + return castArg + } + + @Throws(ValidationException::class) + fun validate(arg: Int, configuration: SchemaConfiguration?): Int { + return validate(arg as Number, configuration) as Int + } + + @Throws(ValidationException::class) + fun validate(arg: Long, configuration: SchemaConfiguration?): Long { + return validate(arg as Number, configuration) as Long + } + + @Throws(ValidationException::class) + fun validate(arg: Float, configuration: SchemaConfiguration?): Float { + return validate(arg as Number, configuration) as Float + } + + @Throws(ValidationException::class) + fun validate(arg: Double, configuration: SchemaConfiguration?): Double { + return validate(arg as Number, configuration) as Double + } + + @Throws(ValidationException::class) + override fun validate(arg: String, configuration: SchemaConfiguration?): String { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validatedPathToSchemas = PathToSchemasMap() + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, LinkedHashSet()) + getPathToSchemas(this, castArg, validationMetadata, pathSet) + return castArg + } + + @Throws(ValidationException::class) + fun validate(arg: LocalDate, configuration: SchemaConfiguration?): String { + return validate(arg.toString(), configuration) + } + + @Throws(ValidationException::class) + fun validate(arg: ZonedDateTime, configuration: SchemaConfiguration?): String { + return validate(arg.toString(), configuration) + } + + @Throws(ValidationException::class) + fun validate(arg: UUID, configuration: SchemaConfiguration?): String { + return validate(arg.toString(), configuration) + } + + override fun getNewInstance(arg: List<*>, pathToItem: List, pathToSchemas: PathToSchemasMap): FrozenList { + val items: MutableList = ArrayList() + var i: Int = 0 + for (item: Any? in arg) { + val itemPathToItem = pathToItem + i + val schemas: LinkedHashMap, Nothing?>? = pathToSchemas.get(itemPathToItem) + if (schemas == null) { + throw RuntimeException("Validation result is invalid, schemas must exist for a pathToItem") + } + val itemSchema: JsonSchema<*> = schemas.entries.iterator().next().key + val itemInstance: Any? = itemSchema.getNewInstance(item, itemPathToItem, pathToSchemas) + items.add(itemInstance) + i += 1 + } + val newInstanceItems: FrozenList = FrozenList(items) + return newInstanceItems + } + + @Throws(ValidationException::class) + override fun validate(arg: List<*>, configuration: SchemaConfiguration?): FrozenList { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, PathToSchemasMap(), LinkedHashSet()) + val pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet) + return getNewInstance(castArg, validationMetadata.pathToItem, pathToSchemasMap) + } + + override fun getNewInstance(arg: Map<*, *>, pathToItem: List, pathToSchemas: PathToSchemasMap): FrozenMap { + val properties: LinkedHashMap = LinkedHashMap() + for((propertyName, value) in arg) { + if (!(propertyName is String)) { + throw RuntimeException("Invalid non-string key value") + } + val propertyPathToItem: List = pathToItem + propertyName + val schemas: LinkedHashMap, Nothing?>? = pathToSchemas.get(propertyPathToItem) + if (schemas == null) { + throw RuntimeException("Validation result is invalid, schemas must exist for a pathToItem") + } + val propertySchema: JsonSchema<*> = schemas.entries.iterator().next().key + val propertyInstance: Any? = propertySchema.getNewInstance(value, propertyPathToItem, pathToSchemas) + properties[propertyName] = propertyInstance + } + val castProperties: FrozenMap = FrozenMap(properties) + return castProperties + } + + @Throws(ValidationException::class) + override fun validate(arg: Map<*, *>, configuration: SchemaConfiguration?): FrozenMap { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validatedPathToSchemas = PathToSchemasMap() + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, LinkedHashSet()) + val pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet) + return getNewInstance(castArg, validationMetadata.pathToItem, pathToSchemasMap) + } + + @Throws(ValidationException::class) + override fun validate(arg: Any?, configuration: SchemaConfiguration?): Any? { + if (arg == null) { + return validate(null, configuration) + } else if (arg is Boolean) { + return validate(arg, configuration) + } else if (arg is Number) { + return validate(arg, configuration) + } else if (arg is String) { + return validate(arg, configuration) + } else if (arg is List<*>) { + return validate(arg, configuration) + } else if (arg is Map<*, *>) { + return validate(arg, configuration) + } + throw ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema") + } + override fun getNewInstance(arg: Any?, pathToItem: List, pathToSchemas: PathToSchemasMap): Any? { + if (arg == null) { + return getNewInstance( null, pathToItem, pathToSchemas) + } else if (arg is Boolean) { + return getNewInstance(arg, pathToItem, pathToSchemas) + } else if (arg is Number) { + return getNewInstance(arg, pathToItem, pathToSchemas) + } else if (arg is String) { + return getNewInstance(arg, pathToItem, pathToSchemas) + } else if (arg is List<*>) { + return getNewInstance(arg, pathToItem, pathToSchemas) + } else if (arg is Map<*, *>) { + return getNewInstance(arg, pathToItem, pathToSchemas) + } + throw RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema") + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: Nothing?, configuration: SchemaConfiguration?): ContainsBoxedVoid { + return ContainsBoxedVoid(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: Boolean, configuration: SchemaConfiguration?): ContainsBoxedBoolean { + return ContainsBoxedBoolean(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: Number, configuration: SchemaConfiguration?): ContainsBoxedNumber { + return ContainsBoxedNumber(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: String, configuration: SchemaConfiguration?): ContainsBoxedString { + return ContainsBoxedString(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: List<*>, configuration: SchemaConfiguration?): ContainsBoxedList { + return ContainsBoxedList(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: Map<*, *>, configuration: SchemaConfiguration?): ContainsBoxedMap { + return ContainsBoxedMap(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: Any?, configuration: SchemaConfiguration?): ContainsBoxed { + if (arg == null) { + return validateAndBox(null, configuration) + } else if (arg is Boolean) { + return validateAndBox(arg, configuration) + } else if (arg is String) { + return validateAndBox(arg, configuration) + } else if (arg is Number) { + return validateAndBox(arg, configuration) + } else if (arg is List<*>) { + return validateAndBox(arg, configuration) + } else if (arg is Map<*, *>) { + return validateAndBox(arg, configuration) + } + throw ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema") + } + } + + sealed interface ContainsKeywordValidation1Boxed { + fun getData(): Any? + } + + data class ContainsKeywordValidation1BoxedVoid(val data: Nothing?) : ContainsKeywordValidation1Boxed { + override fun getData(): Any? { + return data + } + } + + data class ContainsKeywordValidation1BoxedBoolean(val data: Boolean): ContainsKeywordValidation1Boxed { + override fun getData(): Any? { + return data + } + } + + data class ContainsKeywordValidation1BoxedNumber(val data: Number) : ContainsKeywordValidation1Boxed { + override fun getData(): Any? { + return data + } + } + + data class ContainsKeywordValidation1BoxedString(val data: String) : ContainsKeywordValidation1Boxed { + override fun getData(): Any? { + return data + } + } + + data class ContainsKeywordValidation1BoxedList(val data: FrozenList) : ContainsKeywordValidation1Boxed { + override fun getData(): Any? { + return data + } + } + + data class ContainsKeywordValidation1BoxedMap(val data: FrozenMap) : ContainsKeywordValidation1Boxed { + override fun getData(): Any? { + return data + } + } + + + class ContainsKeywordValidation1 private constructor(): JsonSchema( + JsonSchemaInfo() + .contains(Contains::class.java) + ), NullSchemaValidator, BooleanSchemaValidator, NumberSchemaValidator, StringSchemaValidator, ListSchemaValidator, ContainsKeywordValidation1BoxedList>, MapSchemaValidator, ContainsKeywordValidation1BoxedMap> { + /* + NOTE: This class is auto generated by OpenAPI JSON Schema Generator. + Ref: https://github.com/openapi-json-schema-tools/openapi-json-schema-generator + + Do not edit the class manually. + */ + + companion object { + @Volatile + private var instance: ContainsKeywordValidation1? = null + + fun getInstance() = + instance ?: synchronized(this) { + instance ?: ContainsKeywordValidation1().also { instance = it } + } + } + + @Throws(ValidationException::class) + override fun validate(arg: Nothing?, configuration: SchemaConfiguration?): Nothing? { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validatedPathToSchemas = PathToSchemasMap() + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, LinkedHashSet()) + getPathToSchemas(this, castArg, validationMetadata, pathSet) + return castArg + } + + @Throws(ValidationException::class) + override fun validate(arg: Boolean, configuration: SchemaConfiguration?): Boolean { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validatedPathToSchemas = PathToSchemasMap() + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, LinkedHashSet()) + getPathToSchemas(this, castArg, validationMetadata, pathSet) + return castArg + } + + @Throws(ValidationException::class) + override fun validate(arg: Number, configuration: SchemaConfiguration?): Number { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validatedPathToSchemas = PathToSchemasMap() + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, LinkedHashSet()) + getPathToSchemas(this, castArg, validationMetadata, pathSet) + return castArg + } + + @Throws(ValidationException::class) + fun validate(arg: Int, configuration: SchemaConfiguration?): Int { + return validate(arg as Number, configuration) as Int + } + + @Throws(ValidationException::class) + fun validate(arg: Long, configuration: SchemaConfiguration?): Long { + return validate(arg as Number, configuration) as Long + } + + @Throws(ValidationException::class) + fun validate(arg: Float, configuration: SchemaConfiguration?): Float { + return validate(arg as Number, configuration) as Float + } + + @Throws(ValidationException::class) + fun validate(arg: Double, configuration: SchemaConfiguration?): Double { + return validate(arg as Number, configuration) as Double + } + + @Throws(ValidationException::class) + override fun validate(arg: String, configuration: SchemaConfiguration?): String { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validatedPathToSchemas = PathToSchemasMap() + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, LinkedHashSet()) + getPathToSchemas(this, castArg, validationMetadata, pathSet) + return castArg + } + + @Throws(ValidationException::class) + fun validate(arg: LocalDate, configuration: SchemaConfiguration?): String { + return validate(arg.toString(), configuration) + } + + @Throws(ValidationException::class) + fun validate(arg: ZonedDateTime, configuration: SchemaConfiguration?): String { + return validate(arg.toString(), configuration) + } + + @Throws(ValidationException::class) + fun validate(arg: UUID, configuration: SchemaConfiguration?): String { + return validate(arg.toString(), configuration) + } + + override fun getNewInstance(arg: List<*>, pathToItem: List, pathToSchemas: PathToSchemasMap): FrozenList { + val items: MutableList = ArrayList() + var i: Int = 0 + for (item: Any? in arg) { + val itemPathToItem = pathToItem + i + val schemas: LinkedHashMap, Nothing?>? = pathToSchemas.get(itemPathToItem) + if (schemas == null) { + throw RuntimeException("Validation result is invalid, schemas must exist for a pathToItem") + } + val itemSchema: JsonSchema<*> = schemas.entries.iterator().next().key + val itemInstance: Any? = itemSchema.getNewInstance(item, itemPathToItem, pathToSchemas) + items.add(itemInstance) + i += 1 + } + val newInstanceItems: FrozenList = FrozenList(items) + return newInstanceItems + } + + @Throws(ValidationException::class) + override fun validate(arg: List<*>, configuration: SchemaConfiguration?): FrozenList { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, PathToSchemasMap(), LinkedHashSet()) + val pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet) + return getNewInstance(castArg, validationMetadata.pathToItem, pathToSchemasMap) + } + + override fun getNewInstance(arg: Map<*, *>, pathToItem: List, pathToSchemas: PathToSchemasMap): FrozenMap { + val properties: LinkedHashMap = LinkedHashMap() + for((propertyName, value) in arg) { + if (!(propertyName is String)) { + throw RuntimeException("Invalid non-string key value") + } + val propertyPathToItem: List = pathToItem + propertyName + val schemas: LinkedHashMap, Nothing?>? = pathToSchemas.get(propertyPathToItem) + if (schemas == null) { + throw RuntimeException("Validation result is invalid, schemas must exist for a pathToItem") + } + val propertySchema: JsonSchema<*> = schemas.entries.iterator().next().key + val propertyInstance: Any? = propertySchema.getNewInstance(value, propertyPathToItem, pathToSchemas) + properties[propertyName] = propertyInstance + } + val castProperties: FrozenMap = FrozenMap(properties) + return castProperties + } + + @Throws(ValidationException::class) + override fun validate(arg: Map<*, *>, configuration: SchemaConfiguration?): FrozenMap { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validatedPathToSchemas = PathToSchemasMap() + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, LinkedHashSet()) + val pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet) + return getNewInstance(castArg, validationMetadata.pathToItem, pathToSchemasMap) + } + + @Throws(ValidationException::class) + override fun validate(arg: Any?, configuration: SchemaConfiguration?): Any? { + if (arg == null) { + return validate(null, configuration) + } else if (arg is Boolean) { + return validate(arg, configuration) + } else if (arg is Number) { + return validate(arg, configuration) + } else if (arg is String) { + return validate(arg, configuration) + } else if (arg is List<*>) { + return validate(arg, configuration) + } else if (arg is Map<*, *>) { + return validate(arg, configuration) + } + throw ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema") + } + override fun getNewInstance(arg: Any?, pathToItem: List, pathToSchemas: PathToSchemasMap): Any? { + if (arg == null) { + return getNewInstance( null, pathToItem, pathToSchemas) + } else if (arg is Boolean) { + return getNewInstance(arg, pathToItem, pathToSchemas) + } else if (arg is Number) { + return getNewInstance(arg, pathToItem, pathToSchemas) + } else if (arg is String) { + return getNewInstance(arg, pathToItem, pathToSchemas) + } else if (arg is List<*>) { + return getNewInstance(arg, pathToItem, pathToSchemas) + } else if (arg is Map<*, *>) { + return getNewInstance(arg, pathToItem, pathToSchemas) + } + throw RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema") + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: Nothing?, configuration: SchemaConfiguration?): ContainsKeywordValidation1BoxedVoid { + return ContainsKeywordValidation1BoxedVoid(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: Boolean, configuration: SchemaConfiguration?): ContainsKeywordValidation1BoxedBoolean { + return ContainsKeywordValidation1BoxedBoolean(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: Number, configuration: SchemaConfiguration?): ContainsKeywordValidation1BoxedNumber { + return ContainsKeywordValidation1BoxedNumber(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: String, configuration: SchemaConfiguration?): ContainsKeywordValidation1BoxedString { + return ContainsKeywordValidation1BoxedString(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: List<*>, configuration: SchemaConfiguration?): ContainsKeywordValidation1BoxedList { + return ContainsKeywordValidation1BoxedList(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: Map<*, *>, configuration: SchemaConfiguration?): ContainsKeywordValidation1BoxedMap { + return ContainsKeywordValidation1BoxedMap(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: Any?, configuration: SchemaConfiguration?): ContainsKeywordValidation1Boxed { + if (arg == null) { + return validateAndBox(null, configuration) + } else if (arg is Boolean) { + return validateAndBox(arg, configuration) + } else if (arg is String) { + return validateAndBox(arg, configuration) + } else if (arg is Number) { + return validateAndBox(arg, configuration) + } else if (arg is List<*>) { + return validateAndBox(arg, configuration) + } else if (arg is Map<*, *>) { + return validateAndBox(arg, configuration) + } + throw ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema") + } + } +} diff --git a/samples/client/3_1_0_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/schemas/ContainsWithNullInstanceElements.kt b/samples/client/3_1_0_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/schemas/ContainsWithNullInstanceElements.kt new file mode 100644 index 00000000000..9b0d868ae47 --- /dev/null +++ b/samples/client/3_1_0_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/schemas/ContainsWithNullInstanceElements.kt @@ -0,0 +1,322 @@ +package org.openapijsonschematools.client.components.schemas +import java.time.LocalDate +import java.time.ZonedDateTime +import java.util.UUID +import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags +import org.openapijsonschematools.client.configurations.SchemaConfiguration +import org.openapijsonschematools.client.exceptions.InvalidAdditionalPropertyException +import org.openapijsonschematools.client.exceptions.UnsetPropertyException +import org.openapijsonschematools.client.exceptions.ValidationException +import org.openapijsonschematools.client.schemas.NullJsonSchema +import org.openapijsonschematools.client.schemas.UnsetAddPropsSetter +import org.openapijsonschematools.client.schemas.validation.BooleanSchemaValidator +import org.openapijsonschematools.client.schemas.validation.FrozenList +import org.openapijsonschematools.client.schemas.validation.FrozenMap +import org.openapijsonschematools.client.schemas.validation.JsonSchema +import org.openapijsonschematools.client.schemas.validation.JsonSchemaInfo +import org.openapijsonschematools.client.schemas.validation.ListSchemaValidator +import org.openapijsonschematools.client.schemas.validation.MapSchemaValidator +import org.openapijsonschematools.client.schemas.validation.NullSchemaValidator +import org.openapijsonschematools.client.schemas.validation.NumberSchemaValidator +import org.openapijsonschematools.client.schemas.validation.PathToSchemasMap +import org.openapijsonschematools.client.schemas.validation.StringSchemaValidator +import org.openapijsonschematools.client.schemas.validation.ValidationMetadata + +class ContainsWithNullInstanceElements { + // nest classes so all schemas and input/output classes can be public + + + class Contains : NullJsonSchema.NullJsonSchema1() { + companion object { + @Volatile + private var instance: Contains? = null + + fun getInstance() = + instance ?: synchronized(this) { + instance ?: Contains().also { instance = it } + } + } + } + + + sealed interface ContainsWithNullInstanceElements1Boxed { + fun getData(): Any? + } + + data class ContainsWithNullInstanceElements1BoxedVoid(val data: Nothing?) : ContainsWithNullInstanceElements1Boxed { + override fun getData(): Any? { + return data + } + } + + data class ContainsWithNullInstanceElements1BoxedBoolean(val data: Boolean): ContainsWithNullInstanceElements1Boxed { + override fun getData(): Any? { + return data + } + } + + data class ContainsWithNullInstanceElements1BoxedNumber(val data: Number) : ContainsWithNullInstanceElements1Boxed { + override fun getData(): Any? { + return data + } + } + + data class ContainsWithNullInstanceElements1BoxedString(val data: String) : ContainsWithNullInstanceElements1Boxed { + override fun getData(): Any? { + return data + } + } + + data class ContainsWithNullInstanceElements1BoxedList(val data: FrozenList) : ContainsWithNullInstanceElements1Boxed { + override fun getData(): Any? { + return data + } + } + + data class ContainsWithNullInstanceElements1BoxedMap(val data: FrozenMap) : ContainsWithNullInstanceElements1Boxed { + override fun getData(): Any? { + return data + } + } + + + class ContainsWithNullInstanceElements1 private constructor(): JsonSchema( + JsonSchemaInfo() + .contains(Contains::class.java) + ), NullSchemaValidator, BooleanSchemaValidator, NumberSchemaValidator, StringSchemaValidator, ListSchemaValidator, ContainsWithNullInstanceElements1BoxedList>, MapSchemaValidator, ContainsWithNullInstanceElements1BoxedMap> { + /* + NOTE: This class is auto generated by OpenAPI JSON Schema Generator. + Ref: https://github.com/openapi-json-schema-tools/openapi-json-schema-generator + + Do not edit the class manually. + */ + + companion object { + @Volatile + private var instance: ContainsWithNullInstanceElements1? = null + + fun getInstance() = + instance ?: synchronized(this) { + instance ?: ContainsWithNullInstanceElements1().also { instance = it } + } + } + + @Throws(ValidationException::class) + override fun validate(arg: Nothing?, configuration: SchemaConfiguration?): Nothing? { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validatedPathToSchemas = PathToSchemasMap() + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, LinkedHashSet()) + getPathToSchemas(this, castArg, validationMetadata, pathSet) + return castArg + } + + @Throws(ValidationException::class) + override fun validate(arg: Boolean, configuration: SchemaConfiguration?): Boolean { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validatedPathToSchemas = PathToSchemasMap() + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, LinkedHashSet()) + getPathToSchemas(this, castArg, validationMetadata, pathSet) + return castArg + } + + @Throws(ValidationException::class) + override fun validate(arg: Number, configuration: SchemaConfiguration?): Number { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validatedPathToSchemas = PathToSchemasMap() + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, LinkedHashSet()) + getPathToSchemas(this, castArg, validationMetadata, pathSet) + return castArg + } + + @Throws(ValidationException::class) + fun validate(arg: Int, configuration: SchemaConfiguration?): Int { + return validate(arg as Number, configuration) as Int + } + + @Throws(ValidationException::class) + fun validate(arg: Long, configuration: SchemaConfiguration?): Long { + return validate(arg as Number, configuration) as Long + } + + @Throws(ValidationException::class) + fun validate(arg: Float, configuration: SchemaConfiguration?): Float { + return validate(arg as Number, configuration) as Float + } + + @Throws(ValidationException::class) + fun validate(arg: Double, configuration: SchemaConfiguration?): Double { + return validate(arg as Number, configuration) as Double + } + + @Throws(ValidationException::class) + override fun validate(arg: String, configuration: SchemaConfiguration?): String { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validatedPathToSchemas = PathToSchemasMap() + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, LinkedHashSet()) + getPathToSchemas(this, castArg, validationMetadata, pathSet) + return castArg + } + + @Throws(ValidationException::class) + fun validate(arg: LocalDate, configuration: SchemaConfiguration?): String { + return validate(arg.toString(), configuration) + } + + @Throws(ValidationException::class) + fun validate(arg: ZonedDateTime, configuration: SchemaConfiguration?): String { + return validate(arg.toString(), configuration) + } + + @Throws(ValidationException::class) + fun validate(arg: UUID, configuration: SchemaConfiguration?): String { + return validate(arg.toString(), configuration) + } + + override fun getNewInstance(arg: List<*>, pathToItem: List, pathToSchemas: PathToSchemasMap): FrozenList { + val items: MutableList = ArrayList() + var i: Int = 0 + for (item: Any? in arg) { + val itemPathToItem = pathToItem + i + val schemas: LinkedHashMap, Nothing?>? = pathToSchemas.get(itemPathToItem) + if (schemas == null) { + throw RuntimeException("Validation result is invalid, schemas must exist for a pathToItem") + } + val itemSchema: JsonSchema<*> = schemas.entries.iterator().next().key + val itemInstance: Any? = itemSchema.getNewInstance(item, itemPathToItem, pathToSchemas) + items.add(itemInstance) + i += 1 + } + val newInstanceItems: FrozenList = FrozenList(items) + return newInstanceItems + } + + @Throws(ValidationException::class) + override fun validate(arg: List<*>, configuration: SchemaConfiguration?): FrozenList { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, PathToSchemasMap(), LinkedHashSet()) + val pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet) + return getNewInstance(castArg, validationMetadata.pathToItem, pathToSchemasMap) + } + + override fun getNewInstance(arg: Map<*, *>, pathToItem: List, pathToSchemas: PathToSchemasMap): FrozenMap { + val properties: LinkedHashMap = LinkedHashMap() + for((propertyName, value) in arg) { + if (!(propertyName is String)) { + throw RuntimeException("Invalid non-string key value") + } + val propertyPathToItem: List = pathToItem + propertyName + val schemas: LinkedHashMap, Nothing?>? = pathToSchemas.get(propertyPathToItem) + if (schemas == null) { + throw RuntimeException("Validation result is invalid, schemas must exist for a pathToItem") + } + val propertySchema: JsonSchema<*> = schemas.entries.iterator().next().key + val propertyInstance: Any? = propertySchema.getNewInstance(value, propertyPathToItem, pathToSchemas) + properties[propertyName] = propertyInstance + } + val castProperties: FrozenMap = FrozenMap(properties) + return castProperties + } + + @Throws(ValidationException::class) + override fun validate(arg: Map<*, *>, configuration: SchemaConfiguration?): FrozenMap { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validatedPathToSchemas = PathToSchemasMap() + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, LinkedHashSet()) + val pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet) + return getNewInstance(castArg, validationMetadata.pathToItem, pathToSchemasMap) + } + + @Throws(ValidationException::class) + override fun validate(arg: Any?, configuration: SchemaConfiguration?): Any? { + if (arg == null) { + return validate(null, configuration) + } else if (arg is Boolean) { + return validate(arg, configuration) + } else if (arg is Number) { + return validate(arg, configuration) + } else if (arg is String) { + return validate(arg, configuration) + } else if (arg is List<*>) { + return validate(arg, configuration) + } else if (arg is Map<*, *>) { + return validate(arg, configuration) + } + throw ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema") + } + override fun getNewInstance(arg: Any?, pathToItem: List, pathToSchemas: PathToSchemasMap): Any? { + if (arg == null) { + return getNewInstance( null, pathToItem, pathToSchemas) + } else if (arg is Boolean) { + return getNewInstance(arg, pathToItem, pathToSchemas) + } else if (arg is Number) { + return getNewInstance(arg, pathToItem, pathToSchemas) + } else if (arg is String) { + return getNewInstance(arg, pathToItem, pathToSchemas) + } else if (arg is List<*>) { + return getNewInstance(arg, pathToItem, pathToSchemas) + } else if (arg is Map<*, *>) { + return getNewInstance(arg, pathToItem, pathToSchemas) + } + throw RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema") + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: Nothing?, configuration: SchemaConfiguration?): ContainsWithNullInstanceElements1BoxedVoid { + return ContainsWithNullInstanceElements1BoxedVoid(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: Boolean, configuration: SchemaConfiguration?): ContainsWithNullInstanceElements1BoxedBoolean { + return ContainsWithNullInstanceElements1BoxedBoolean(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: Number, configuration: SchemaConfiguration?): ContainsWithNullInstanceElements1BoxedNumber { + return ContainsWithNullInstanceElements1BoxedNumber(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: String, configuration: SchemaConfiguration?): ContainsWithNullInstanceElements1BoxedString { + return ContainsWithNullInstanceElements1BoxedString(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: List<*>, configuration: SchemaConfiguration?): ContainsWithNullInstanceElements1BoxedList { + return ContainsWithNullInstanceElements1BoxedList(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: Map<*, *>, configuration: SchemaConfiguration?): ContainsWithNullInstanceElements1BoxedMap { + return ContainsWithNullInstanceElements1BoxedMap(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: Any?, configuration: SchemaConfiguration?): ContainsWithNullInstanceElements1Boxed { + if (arg == null) { + return validateAndBox(null, configuration) + } else if (arg is Boolean) { + return validateAndBox(arg, configuration) + } else if (arg is String) { + return validateAndBox(arg, configuration) + } else if (arg is Number) { + return validateAndBox(arg, configuration) + } else if (arg is List<*>) { + return validateAndBox(arg, configuration) + } else if (arg is Map<*, *>) { + return validateAndBox(arg, configuration) + } + throw ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema") + } + } +} diff --git a/samples/client/3_1_0_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/schemas/DateFormat.kt b/samples/client/3_1_0_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/schemas/DateFormat.kt new file mode 100644 index 00000000000..5064560701f --- /dev/null +++ b/samples/client/3_1_0_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/schemas/DateFormat.kt @@ -0,0 +1,308 @@ +package org.openapijsonschematools.client.components.schemas +import java.time.LocalDate +import java.time.ZonedDateTime +import java.util.UUID +import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags +import org.openapijsonschematools.client.configurations.SchemaConfiguration +import org.openapijsonschematools.client.exceptions.InvalidAdditionalPropertyException +import org.openapijsonschematools.client.exceptions.UnsetPropertyException +import org.openapijsonschematools.client.exceptions.ValidationException +import org.openapijsonschematools.client.schemas.UnsetAddPropsSetter +import org.openapijsonschematools.client.schemas.validation.BooleanSchemaValidator +import org.openapijsonschematools.client.schemas.validation.FrozenList +import org.openapijsonschematools.client.schemas.validation.FrozenMap +import org.openapijsonschematools.client.schemas.validation.JsonSchema +import org.openapijsonschematools.client.schemas.validation.JsonSchemaInfo +import org.openapijsonschematools.client.schemas.validation.ListSchemaValidator +import org.openapijsonschematools.client.schemas.validation.MapSchemaValidator +import org.openapijsonschematools.client.schemas.validation.NullSchemaValidator +import org.openapijsonschematools.client.schemas.validation.NumberSchemaValidator +import org.openapijsonschematools.client.schemas.validation.PathToSchemasMap +import org.openapijsonschematools.client.schemas.validation.StringSchemaValidator +import org.openapijsonschematools.client.schemas.validation.ValidationMetadata + +class DateFormat { + // nest classes so all schemas and input/output classes can be public + + + sealed interface DateFormat1Boxed { + fun getData(): Any? + } + + data class DateFormat1BoxedVoid(val data: Nothing?) : DateFormat1Boxed { + override fun getData(): Any? { + return data + } + } + + data class DateFormat1BoxedBoolean(val data: Boolean): DateFormat1Boxed { + override fun getData(): Any? { + return data + } + } + + data class DateFormat1BoxedNumber(val data: Number) : DateFormat1Boxed { + override fun getData(): Any? { + return data + } + } + + data class DateFormat1BoxedString(val data: String) : DateFormat1Boxed { + override fun getData(): Any? { + return data + } + } + + data class DateFormat1BoxedList(val data: FrozenList) : DateFormat1Boxed { + override fun getData(): Any? { + return data + } + } + + data class DateFormat1BoxedMap(val data: FrozenMap) : DateFormat1Boxed { + override fun getData(): Any? { + return data + } + } + + + class DateFormat1 private constructor(): JsonSchema( + JsonSchemaInfo() + .format("date") + ), NullSchemaValidator, BooleanSchemaValidator, NumberSchemaValidator, StringSchemaValidator, ListSchemaValidator, DateFormat1BoxedList>, MapSchemaValidator, DateFormat1BoxedMap> { + /* + NOTE: This class is auto generated by OpenAPI JSON Schema Generator. + Ref: https://github.com/openapi-json-schema-tools/openapi-json-schema-generator + + Do not edit the class manually. + */ + + companion object { + @Volatile + private var instance: DateFormat1? = null + + fun getInstance() = + instance ?: synchronized(this) { + instance ?: DateFormat1().also { instance = it } + } + } + + @Throws(ValidationException::class) + override fun validate(arg: Nothing?, configuration: SchemaConfiguration?): Nothing? { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validatedPathToSchemas = PathToSchemasMap() + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, LinkedHashSet()) + getPathToSchemas(this, castArg, validationMetadata, pathSet) + return castArg + } + + @Throws(ValidationException::class) + override fun validate(arg: Boolean, configuration: SchemaConfiguration?): Boolean { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validatedPathToSchemas = PathToSchemasMap() + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, LinkedHashSet()) + getPathToSchemas(this, castArg, validationMetadata, pathSet) + return castArg + } + + @Throws(ValidationException::class) + override fun validate(arg: Number, configuration: SchemaConfiguration?): Number { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validatedPathToSchemas = PathToSchemasMap() + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, LinkedHashSet()) + getPathToSchemas(this, castArg, validationMetadata, pathSet) + return castArg + } + + @Throws(ValidationException::class) + fun validate(arg: Int, configuration: SchemaConfiguration?): Int { + return validate(arg as Number, configuration) as Int + } + + @Throws(ValidationException::class) + fun validate(arg: Long, configuration: SchemaConfiguration?): Long { + return validate(arg as Number, configuration) as Long + } + + @Throws(ValidationException::class) + fun validate(arg: Float, configuration: SchemaConfiguration?): Float { + return validate(arg as Number, configuration) as Float + } + + @Throws(ValidationException::class) + fun validate(arg: Double, configuration: SchemaConfiguration?): Double { + return validate(arg as Number, configuration) as Double + } + + @Throws(ValidationException::class) + override fun validate(arg: String, configuration: SchemaConfiguration?): String { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validatedPathToSchemas = PathToSchemasMap() + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, LinkedHashSet()) + getPathToSchemas(this, castArg, validationMetadata, pathSet) + return castArg + } + + @Throws(ValidationException::class) + fun validate(arg: LocalDate, configuration: SchemaConfiguration?): String { + return validate(arg.toString(), configuration) + } + + @Throws(ValidationException::class) + fun validate(arg: ZonedDateTime, configuration: SchemaConfiguration?): String { + return validate(arg.toString(), configuration) + } + + @Throws(ValidationException::class) + fun validate(arg: UUID, configuration: SchemaConfiguration?): String { + return validate(arg.toString(), configuration) + } + + override fun getNewInstance(arg: List<*>, pathToItem: List, pathToSchemas: PathToSchemasMap): FrozenList { + val items: MutableList = ArrayList() + var i: Int = 0 + for (item: Any? in arg) { + val itemPathToItem = pathToItem + i + val schemas: LinkedHashMap, Nothing?>? = pathToSchemas.get(itemPathToItem) + if (schemas == null) { + throw RuntimeException("Validation result is invalid, schemas must exist for a pathToItem") + } + val itemSchema: JsonSchema<*> = schemas.entries.iterator().next().key + val itemInstance: Any? = itemSchema.getNewInstance(item, itemPathToItem, pathToSchemas) + items.add(itemInstance) + i += 1 + } + val newInstanceItems: FrozenList = FrozenList(items) + return newInstanceItems + } + + @Throws(ValidationException::class) + override fun validate(arg: List<*>, configuration: SchemaConfiguration?): FrozenList { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, PathToSchemasMap(), LinkedHashSet()) + val pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet) + return getNewInstance(castArg, validationMetadata.pathToItem, pathToSchemasMap) + } + + override fun getNewInstance(arg: Map<*, *>, pathToItem: List, pathToSchemas: PathToSchemasMap): FrozenMap { + val properties: LinkedHashMap = LinkedHashMap() + for((propertyName, value) in arg) { + if (!(propertyName is String)) { + throw RuntimeException("Invalid non-string key value") + } + val propertyPathToItem: List = pathToItem + propertyName + val schemas: LinkedHashMap, Nothing?>? = pathToSchemas.get(propertyPathToItem) + if (schemas == null) { + throw RuntimeException("Validation result is invalid, schemas must exist for a pathToItem") + } + val propertySchema: JsonSchema<*> = schemas.entries.iterator().next().key + val propertyInstance: Any? = propertySchema.getNewInstance(value, propertyPathToItem, pathToSchemas) + properties[propertyName] = propertyInstance + } + val castProperties: FrozenMap = FrozenMap(properties) + return castProperties + } + + @Throws(ValidationException::class) + override fun validate(arg: Map<*, *>, configuration: SchemaConfiguration?): FrozenMap { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validatedPathToSchemas = PathToSchemasMap() + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, LinkedHashSet()) + val pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet) + return getNewInstance(castArg, validationMetadata.pathToItem, pathToSchemasMap) + } + + @Throws(ValidationException::class) + override fun validate(arg: Any?, configuration: SchemaConfiguration?): Any? { + if (arg == null) { + return validate(null, configuration) + } else if (arg is Boolean) { + return validate(arg, configuration) + } else if (arg is Number) { + return validate(arg, configuration) + } else if (arg is String) { + return validate(arg, configuration) + } else if (arg is List<*>) { + return validate(arg, configuration) + } else if (arg is Map<*, *>) { + return validate(arg, configuration) + } + throw ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema") + } + override fun getNewInstance(arg: Any?, pathToItem: List, pathToSchemas: PathToSchemasMap): Any? { + if (arg == null) { + return getNewInstance( null, pathToItem, pathToSchemas) + } else if (arg is Boolean) { + return getNewInstance(arg, pathToItem, pathToSchemas) + } else if (arg is Number) { + return getNewInstance(arg, pathToItem, pathToSchemas) + } else if (arg is String) { + return getNewInstance(arg, pathToItem, pathToSchemas) + } else if (arg is List<*>) { + return getNewInstance(arg, pathToItem, pathToSchemas) + } else if (arg is Map<*, *>) { + return getNewInstance(arg, pathToItem, pathToSchemas) + } + throw RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema") + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: Nothing?, configuration: SchemaConfiguration?): DateFormat1BoxedVoid { + return DateFormat1BoxedVoid(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: Boolean, configuration: SchemaConfiguration?): DateFormat1BoxedBoolean { + return DateFormat1BoxedBoolean(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: Number, configuration: SchemaConfiguration?): DateFormat1BoxedNumber { + return DateFormat1BoxedNumber(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: String, configuration: SchemaConfiguration?): DateFormat1BoxedString { + return DateFormat1BoxedString(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: List<*>, configuration: SchemaConfiguration?): DateFormat1BoxedList { + return DateFormat1BoxedList(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: Map<*, *>, configuration: SchemaConfiguration?): DateFormat1BoxedMap { + return DateFormat1BoxedMap(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: Any?, configuration: SchemaConfiguration?): DateFormat1Boxed { + if (arg == null) { + return validateAndBox(null, configuration) + } else if (arg is Boolean) { + return validateAndBox(arg, configuration) + } else if (arg is String) { + return validateAndBox(arg, configuration) + } else if (arg is Number) { + return validateAndBox(arg, configuration) + } else if (arg is List<*>) { + return validateAndBox(arg, configuration) + } else if (arg is Map<*, *>) { + return validateAndBox(arg, configuration) + } + throw ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema") + } + } +} diff --git a/samples/client/3_1_0_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/schemas/DateTimeFormat.kt b/samples/client/3_1_0_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/schemas/DateTimeFormat.kt new file mode 100644 index 00000000000..034656f3583 --- /dev/null +++ b/samples/client/3_1_0_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/schemas/DateTimeFormat.kt @@ -0,0 +1,308 @@ +package org.openapijsonschematools.client.components.schemas +import java.time.LocalDate +import java.time.ZonedDateTime +import java.util.UUID +import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags +import org.openapijsonschematools.client.configurations.SchemaConfiguration +import org.openapijsonschematools.client.exceptions.InvalidAdditionalPropertyException +import org.openapijsonschematools.client.exceptions.UnsetPropertyException +import org.openapijsonschematools.client.exceptions.ValidationException +import org.openapijsonschematools.client.schemas.UnsetAddPropsSetter +import org.openapijsonschematools.client.schemas.validation.BooleanSchemaValidator +import org.openapijsonschematools.client.schemas.validation.FrozenList +import org.openapijsonschematools.client.schemas.validation.FrozenMap +import org.openapijsonschematools.client.schemas.validation.JsonSchema +import org.openapijsonschematools.client.schemas.validation.JsonSchemaInfo +import org.openapijsonschematools.client.schemas.validation.ListSchemaValidator +import org.openapijsonschematools.client.schemas.validation.MapSchemaValidator +import org.openapijsonschematools.client.schemas.validation.NullSchemaValidator +import org.openapijsonschematools.client.schemas.validation.NumberSchemaValidator +import org.openapijsonschematools.client.schemas.validation.PathToSchemasMap +import org.openapijsonschematools.client.schemas.validation.StringSchemaValidator +import org.openapijsonschematools.client.schemas.validation.ValidationMetadata + +class DateTimeFormat { + // nest classes so all schemas and input/output classes can be public + + + sealed interface DateTimeFormat1Boxed { + fun getData(): Any? + } + + data class DateTimeFormat1BoxedVoid(val data: Nothing?) : DateTimeFormat1Boxed { + override fun getData(): Any? { + return data + } + } + + data class DateTimeFormat1BoxedBoolean(val data: Boolean): DateTimeFormat1Boxed { + override fun getData(): Any? { + return data + } + } + + data class DateTimeFormat1BoxedNumber(val data: Number) : DateTimeFormat1Boxed { + override fun getData(): Any? { + return data + } + } + + data class DateTimeFormat1BoxedString(val data: String) : DateTimeFormat1Boxed { + override fun getData(): Any? { + return data + } + } + + data class DateTimeFormat1BoxedList(val data: FrozenList) : DateTimeFormat1Boxed { + override fun getData(): Any? { + return data + } + } + + data class DateTimeFormat1BoxedMap(val data: FrozenMap) : DateTimeFormat1Boxed { + override fun getData(): Any? { + return data + } + } + + + class DateTimeFormat1 private constructor(): JsonSchema( + JsonSchemaInfo() + .format("date-time") + ), NullSchemaValidator, BooleanSchemaValidator, NumberSchemaValidator, StringSchemaValidator, ListSchemaValidator, DateTimeFormat1BoxedList>, MapSchemaValidator, DateTimeFormat1BoxedMap> { + /* + NOTE: This class is auto generated by OpenAPI JSON Schema Generator. + Ref: https://github.com/openapi-json-schema-tools/openapi-json-schema-generator + + Do not edit the class manually. + */ + + companion object { + @Volatile + private var instance: DateTimeFormat1? = null + + fun getInstance() = + instance ?: synchronized(this) { + instance ?: DateTimeFormat1().also { instance = it } + } + } + + @Throws(ValidationException::class) + override fun validate(arg: Nothing?, configuration: SchemaConfiguration?): Nothing? { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validatedPathToSchemas = PathToSchemasMap() + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, LinkedHashSet()) + getPathToSchemas(this, castArg, validationMetadata, pathSet) + return castArg + } + + @Throws(ValidationException::class) + override fun validate(arg: Boolean, configuration: SchemaConfiguration?): Boolean { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validatedPathToSchemas = PathToSchemasMap() + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, LinkedHashSet()) + getPathToSchemas(this, castArg, validationMetadata, pathSet) + return castArg + } + + @Throws(ValidationException::class) + override fun validate(arg: Number, configuration: SchemaConfiguration?): Number { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validatedPathToSchemas = PathToSchemasMap() + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, LinkedHashSet()) + getPathToSchemas(this, castArg, validationMetadata, pathSet) + return castArg + } + + @Throws(ValidationException::class) + fun validate(arg: Int, configuration: SchemaConfiguration?): Int { + return validate(arg as Number, configuration) as Int + } + + @Throws(ValidationException::class) + fun validate(arg: Long, configuration: SchemaConfiguration?): Long { + return validate(arg as Number, configuration) as Long + } + + @Throws(ValidationException::class) + fun validate(arg: Float, configuration: SchemaConfiguration?): Float { + return validate(arg as Number, configuration) as Float + } + + @Throws(ValidationException::class) + fun validate(arg: Double, configuration: SchemaConfiguration?): Double { + return validate(arg as Number, configuration) as Double + } + + @Throws(ValidationException::class) + override fun validate(arg: String, configuration: SchemaConfiguration?): String { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validatedPathToSchemas = PathToSchemasMap() + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, LinkedHashSet()) + getPathToSchemas(this, castArg, validationMetadata, pathSet) + return castArg + } + + @Throws(ValidationException::class) + fun validate(arg: LocalDate, configuration: SchemaConfiguration?): String { + return validate(arg.toString(), configuration) + } + + @Throws(ValidationException::class) + fun validate(arg: ZonedDateTime, configuration: SchemaConfiguration?): String { + return validate(arg.toString(), configuration) + } + + @Throws(ValidationException::class) + fun validate(arg: UUID, configuration: SchemaConfiguration?): String { + return validate(arg.toString(), configuration) + } + + override fun getNewInstance(arg: List<*>, pathToItem: List, pathToSchemas: PathToSchemasMap): FrozenList { + val items: MutableList = ArrayList() + var i: Int = 0 + for (item: Any? in arg) { + val itemPathToItem = pathToItem + i + val schemas: LinkedHashMap, Nothing?>? = pathToSchemas.get(itemPathToItem) + if (schemas == null) { + throw RuntimeException("Validation result is invalid, schemas must exist for a pathToItem") + } + val itemSchema: JsonSchema<*> = schemas.entries.iterator().next().key + val itemInstance: Any? = itemSchema.getNewInstance(item, itemPathToItem, pathToSchemas) + items.add(itemInstance) + i += 1 + } + val newInstanceItems: FrozenList = FrozenList(items) + return newInstanceItems + } + + @Throws(ValidationException::class) + override fun validate(arg: List<*>, configuration: SchemaConfiguration?): FrozenList { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, PathToSchemasMap(), LinkedHashSet()) + val pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet) + return getNewInstance(castArg, validationMetadata.pathToItem, pathToSchemasMap) + } + + override fun getNewInstance(arg: Map<*, *>, pathToItem: List, pathToSchemas: PathToSchemasMap): FrozenMap { + val properties: LinkedHashMap = LinkedHashMap() + for((propertyName, value) in arg) { + if (!(propertyName is String)) { + throw RuntimeException("Invalid non-string key value") + } + val propertyPathToItem: List = pathToItem + propertyName + val schemas: LinkedHashMap, Nothing?>? = pathToSchemas.get(propertyPathToItem) + if (schemas == null) { + throw RuntimeException("Validation result is invalid, schemas must exist for a pathToItem") + } + val propertySchema: JsonSchema<*> = schemas.entries.iterator().next().key + val propertyInstance: Any? = propertySchema.getNewInstance(value, propertyPathToItem, pathToSchemas) + properties[propertyName] = propertyInstance + } + val castProperties: FrozenMap = FrozenMap(properties) + return castProperties + } + + @Throws(ValidationException::class) + override fun validate(arg: Map<*, *>, configuration: SchemaConfiguration?): FrozenMap { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validatedPathToSchemas = PathToSchemasMap() + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, LinkedHashSet()) + val pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet) + return getNewInstance(castArg, validationMetadata.pathToItem, pathToSchemasMap) + } + + @Throws(ValidationException::class) + override fun validate(arg: Any?, configuration: SchemaConfiguration?): Any? { + if (arg == null) { + return validate(null, configuration) + } else if (arg is Boolean) { + return validate(arg, configuration) + } else if (arg is Number) { + return validate(arg, configuration) + } else if (arg is String) { + return validate(arg, configuration) + } else if (arg is List<*>) { + return validate(arg, configuration) + } else if (arg is Map<*, *>) { + return validate(arg, configuration) + } + throw ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema") + } + override fun getNewInstance(arg: Any?, pathToItem: List, pathToSchemas: PathToSchemasMap): Any? { + if (arg == null) { + return getNewInstance( null, pathToItem, pathToSchemas) + } else if (arg is Boolean) { + return getNewInstance(arg, pathToItem, pathToSchemas) + } else if (arg is Number) { + return getNewInstance(arg, pathToItem, pathToSchemas) + } else if (arg is String) { + return getNewInstance(arg, pathToItem, pathToSchemas) + } else if (arg is List<*>) { + return getNewInstance(arg, pathToItem, pathToSchemas) + } else if (arg is Map<*, *>) { + return getNewInstance(arg, pathToItem, pathToSchemas) + } + throw RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema") + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: Nothing?, configuration: SchemaConfiguration?): DateTimeFormat1BoxedVoid { + return DateTimeFormat1BoxedVoid(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: Boolean, configuration: SchemaConfiguration?): DateTimeFormat1BoxedBoolean { + return DateTimeFormat1BoxedBoolean(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: Number, configuration: SchemaConfiguration?): DateTimeFormat1BoxedNumber { + return DateTimeFormat1BoxedNumber(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: String, configuration: SchemaConfiguration?): DateTimeFormat1BoxedString { + return DateTimeFormat1BoxedString(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: List<*>, configuration: SchemaConfiguration?): DateTimeFormat1BoxedList { + return DateTimeFormat1BoxedList(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: Map<*, *>, configuration: SchemaConfiguration?): DateTimeFormat1BoxedMap { + return DateTimeFormat1BoxedMap(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: Any?, configuration: SchemaConfiguration?): DateTimeFormat1Boxed { + if (arg == null) { + return validateAndBox(null, configuration) + } else if (arg is Boolean) { + return validateAndBox(arg, configuration) + } else if (arg is String) { + return validateAndBox(arg, configuration) + } else if (arg is Number) { + return validateAndBox(arg, configuration) + } else if (arg is List<*>) { + return validateAndBox(arg, configuration) + } else if (arg is Map<*, *>) { + return validateAndBox(arg, configuration) + } + throw ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema") + } + } +} diff --git a/samples/client/3_1_0_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/schemas/DependentSchemasDependenciesWithEscapedCharacters.kt b/samples/client/3_1_0_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/schemas/DependentSchemasDependenciesWithEscapedCharacters.kt new file mode 100644 index 00000000000..cd210cde149 --- /dev/null +++ b/samples/client/3_1_0_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/schemas/DependentSchemasDependenciesWithEscapedCharacters.kt @@ -0,0 +1,975 @@ +package org.openapijsonschematools.client.components.schemas +import java.time.LocalDate +import java.time.ZonedDateTime +import java.util.UUID +import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags +import org.openapijsonschematools.client.configurations.SchemaConfiguration +import org.openapijsonschematools.client.exceptions.InvalidAdditionalPropertyException +import org.openapijsonschematools.client.exceptions.UnsetPropertyException +import org.openapijsonschematools.client.exceptions.ValidationException +import org.openapijsonschematools.client.schemas.GenericBuilder +import org.openapijsonschematools.client.schemas.UnsetAddPropsSetter +import org.openapijsonschematools.client.schemas.validation.BooleanSchemaValidator +import org.openapijsonschematools.client.schemas.validation.FrozenList +import org.openapijsonschematools.client.schemas.validation.FrozenMap +import org.openapijsonschematools.client.schemas.validation.JsonSchema +import org.openapijsonschematools.client.schemas.validation.JsonSchemaInfo +import org.openapijsonschematools.client.schemas.validation.ListSchemaValidator +import org.openapijsonschematools.client.schemas.validation.MapSchemaValidator +import org.openapijsonschematools.client.schemas.validation.NullSchemaValidator +import org.openapijsonschematools.client.schemas.validation.NumberSchemaValidator +import org.openapijsonschematools.client.schemas.validation.PathToSchemasMap +import org.openapijsonschematools.client.schemas.validation.StringSchemaValidator +import org.openapijsonschematools.client.schemas.validation.ValidationMetadata + +class DependentSchemasDependenciesWithEscapedCharacters { + // nest classes so all schemas and input/output classes can be public + + + sealed interface FootbarBoxed { + fun getData(): Any? + } + + data class FootbarBoxedVoid(val data: Nothing?) : FootbarBoxed { + override fun getData(): Any? { + return data + } + } + + data class FootbarBoxedBoolean(val data: Boolean): FootbarBoxed { + override fun getData(): Any? { + return data + } + } + + data class FootbarBoxedNumber(val data: Number) : FootbarBoxed { + override fun getData(): Any? { + return data + } + } + + data class FootbarBoxedString(val data: String) : FootbarBoxed { + override fun getData(): Any? { + return data + } + } + + data class FootbarBoxedList(val data: FrozenList) : FootbarBoxed { + override fun getData(): Any? { + return data + } + } + + data class FootbarBoxedMap(val data: FrozenMap) : FootbarBoxed { + override fun getData(): Any? { + return data + } + } + + + class Footbar private constructor(): JsonSchema( + JsonSchemaInfo() + .minProperties(4) + ), NullSchemaValidator, BooleanSchemaValidator, NumberSchemaValidator, StringSchemaValidator, ListSchemaValidator, FootbarBoxedList>, MapSchemaValidator, FootbarBoxedMap> { + + companion object { + @Volatile + private var instance: Footbar? = null + + fun getInstance() = + instance ?: synchronized(this) { + instance ?: Footbar().also { instance = it } + } + } + + @Throws(ValidationException::class) + override fun validate(arg: Nothing?, configuration: SchemaConfiguration?): Nothing? { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validatedPathToSchemas = PathToSchemasMap() + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, LinkedHashSet()) + getPathToSchemas(this, castArg, validationMetadata, pathSet) + return castArg + } + + @Throws(ValidationException::class) + override fun validate(arg: Boolean, configuration: SchemaConfiguration?): Boolean { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validatedPathToSchemas = PathToSchemasMap() + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, LinkedHashSet()) + getPathToSchemas(this, castArg, validationMetadata, pathSet) + return castArg + } + + @Throws(ValidationException::class) + override fun validate(arg: Number, configuration: SchemaConfiguration?): Number { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validatedPathToSchemas = PathToSchemasMap() + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, LinkedHashSet()) + getPathToSchemas(this, castArg, validationMetadata, pathSet) + return castArg + } + + @Throws(ValidationException::class) + fun validate(arg: Int, configuration: SchemaConfiguration?): Int { + return validate(arg as Number, configuration) as Int + } + + @Throws(ValidationException::class) + fun validate(arg: Long, configuration: SchemaConfiguration?): Long { + return validate(arg as Number, configuration) as Long + } + + @Throws(ValidationException::class) + fun validate(arg: Float, configuration: SchemaConfiguration?): Float { + return validate(arg as Number, configuration) as Float + } + + @Throws(ValidationException::class) + fun validate(arg: Double, configuration: SchemaConfiguration?): Double { + return validate(arg as Number, configuration) as Double + } + + @Throws(ValidationException::class) + override fun validate(arg: String, configuration: SchemaConfiguration?): String { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validatedPathToSchemas = PathToSchemasMap() + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, LinkedHashSet()) + getPathToSchemas(this, castArg, validationMetadata, pathSet) + return castArg + } + + @Throws(ValidationException::class) + fun validate(arg: LocalDate, configuration: SchemaConfiguration?): String { + return validate(arg.toString(), configuration) + } + + @Throws(ValidationException::class) + fun validate(arg: ZonedDateTime, configuration: SchemaConfiguration?): String { + return validate(arg.toString(), configuration) + } + + @Throws(ValidationException::class) + fun validate(arg: UUID, configuration: SchemaConfiguration?): String { + return validate(arg.toString(), configuration) + } + + override fun getNewInstance(arg: List<*>, pathToItem: List, pathToSchemas: PathToSchemasMap): FrozenList { + val items: MutableList = ArrayList() + var i: Int = 0 + for (item: Any? in arg) { + val itemPathToItem = pathToItem + i + val schemas: LinkedHashMap, Nothing?>? = pathToSchemas.get(itemPathToItem) + if (schemas == null) { + throw RuntimeException("Validation result is invalid, schemas must exist for a pathToItem") + } + val itemSchema: JsonSchema<*> = schemas.entries.iterator().next().key + val itemInstance: Any? = itemSchema.getNewInstance(item, itemPathToItem, pathToSchemas) + items.add(itemInstance) + i += 1 + } + val newInstanceItems: FrozenList = FrozenList(items) + return newInstanceItems + } + + @Throws(ValidationException::class) + override fun validate(arg: List<*>, configuration: SchemaConfiguration?): FrozenList { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, PathToSchemasMap(), LinkedHashSet()) + val pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet) + return getNewInstance(castArg, validationMetadata.pathToItem, pathToSchemasMap) + } + + override fun getNewInstance(arg: Map<*, *>, pathToItem: List, pathToSchemas: PathToSchemasMap): FrozenMap { + val properties: LinkedHashMap = LinkedHashMap() + for((propertyName, value) in arg) { + if (!(propertyName is String)) { + throw RuntimeException("Invalid non-string key value") + } + val propertyPathToItem: List = pathToItem + propertyName + val schemas: LinkedHashMap, Nothing?>? = pathToSchemas.get(propertyPathToItem) + if (schemas == null) { + throw RuntimeException("Validation result is invalid, schemas must exist for a pathToItem") + } + val propertySchema: JsonSchema<*> = schemas.entries.iterator().next().key + val propertyInstance: Any? = propertySchema.getNewInstance(value, propertyPathToItem, pathToSchemas) + properties[propertyName] = propertyInstance + } + val castProperties: FrozenMap = FrozenMap(properties) + return castProperties + } + + @Throws(ValidationException::class) + override fun validate(arg: Map<*, *>, configuration: SchemaConfiguration?): FrozenMap { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validatedPathToSchemas = PathToSchemasMap() + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, LinkedHashSet()) + val pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet) + return getNewInstance(castArg, validationMetadata.pathToItem, pathToSchemasMap) + } + + @Throws(ValidationException::class) + override fun validate(arg: Any?, configuration: SchemaConfiguration?): Any? { + if (arg == null) { + return validate(null, configuration) + } else if (arg is Boolean) { + return validate(arg, configuration) + } else if (arg is Number) { + return validate(arg, configuration) + } else if (arg is String) { + return validate(arg, configuration) + } else if (arg is List<*>) { + return validate(arg, configuration) + } else if (arg is Map<*, *>) { + return validate(arg, configuration) + } + throw ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema") + } + override fun getNewInstance(arg: Any?, pathToItem: List, pathToSchemas: PathToSchemasMap): Any? { + if (arg == null) { + return getNewInstance( null, pathToItem, pathToSchemas) + } else if (arg is Boolean) { + return getNewInstance(arg, pathToItem, pathToSchemas) + } else if (arg is Number) { + return getNewInstance(arg, pathToItem, pathToSchemas) + } else if (arg is String) { + return getNewInstance(arg, pathToItem, pathToSchemas) + } else if (arg is List<*>) { + return getNewInstance(arg, pathToItem, pathToSchemas) + } else if (arg is Map<*, *>) { + return getNewInstance(arg, pathToItem, pathToSchemas) + } + throw RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema") + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: Nothing?, configuration: SchemaConfiguration?): FootbarBoxedVoid { + return FootbarBoxedVoid(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: Boolean, configuration: SchemaConfiguration?): FootbarBoxedBoolean { + return FootbarBoxedBoolean(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: Number, configuration: SchemaConfiguration?): FootbarBoxedNumber { + return FootbarBoxedNumber(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: String, configuration: SchemaConfiguration?): FootbarBoxedString { + return FootbarBoxedString(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: List<*>, configuration: SchemaConfiguration?): FootbarBoxedList { + return FootbarBoxedList(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: Map<*, *>, configuration: SchemaConfiguration?): FootbarBoxedMap { + return FootbarBoxedMap(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: Any?, configuration: SchemaConfiguration?): FootbarBoxed { + if (arg == null) { + return validateAndBox(null, configuration) + } else if (arg is Boolean) { + return validateAndBox(arg, configuration) + } else if (arg is String) { + return validateAndBox(arg, configuration) + } else if (arg is Number) { + return validateAndBox(arg, configuration) + } else if (arg is List<*>) { + return validateAndBox(arg, configuration) + } else if (arg is Map<*, *>) { + return validateAndBox(arg, configuration) + } + throw ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema") + } + } + + class FoobarMap(m: FrozenMap) : FrozenMap(m) { + companion object { + val requiredKeys: Set = setOf( + "foo\"bar" + ) + val optionalKeys: Set = setOf() + @Throws(ValidationException::class) + fun of(arg: Map, configuration: SchemaConfiguration): FoobarMap { + return Foobar.getInstance().validate(arg, configuration) + } + } + + @Throws(UnsetPropertyException::class, InvalidAdditionalPropertyException::class) + fun getAdditionalProperty(name: String): Any? { + throwIfKeyKnown(name, requiredKeys, optionalKeys) + throwIfKeyNotPresent(name) + return get(name) + } + } + + interface SetterForFoobar1 { + fun getInstance(): MutableMap + fun getBuilderAfterFoobar1(instance: MutableMap): T + + fun fooReverseSolidusQuotationMarkBar(value: Nothing?): T { + val instance = getInstance() + instance["foo\"bar"] = null + return getBuilderAfterFoobar1(instance) + } + + fun fooReverseSolidusQuotationMarkBar(value: Boolean): T { + val instance = getInstance() + instance["foo\"bar"] = value + return getBuilderAfterFoobar1(instance) + } + + fun fooReverseSolidusQuotationMarkBar(value: String): T { + val instance = getInstance() + instance["foo\"bar"] = value + return getBuilderAfterFoobar1(instance) + } + + fun fooReverseSolidusQuotationMarkBar(value: Int): T { + val instance = getInstance() + instance["foo\"bar"] = value + return getBuilderAfterFoobar1(instance) + } + + fun fooReverseSolidusQuotationMarkBar(value: Float): T { + val instance = getInstance() + instance["foo\"bar"] = value + return getBuilderAfterFoobar1(instance) + } + + fun fooReverseSolidusQuotationMarkBar(value: Long): T { + val instance = getInstance() + instance["foo\"bar"] = value + return getBuilderAfterFoobar1(instance) + } + + fun fooReverseSolidusQuotationMarkBar(value: Double): T { + val instance = getInstance() + instance["foo\"bar"] = value + return getBuilderAfterFoobar1(instance) + } + + fun fooReverseSolidusQuotationMarkBar(value: List): T { + val instance = getInstance() + instance["foo\"bar"] = value + return getBuilderAfterFoobar1(instance) + } + + fun fooReverseSolidusQuotationMarkBar(value: Map): T { + val instance = getInstance() + instance["foo\"bar"] = value + return getBuilderAfterFoobar1(instance) + } + } + + class FoobarMap0Builder(private val instance: MutableMap): UnsetAddPropsSetter, GenericBuilder> { + private val knownKeys: Set = setOf( + "foo\"bar" + ) + override fun getKnownKeys(): Set { + return knownKeys + } + override fun build(): Map { + return instance + } + override fun getInstance(): MutableMap { + return instance + } + override fun getBuilderAfterAdditionalProperty(instance: MutableMap): FoobarMap0Builder { + return this + } + } + + class FoobarMapBuilder: SetterForFoobar1 { + private val instance: MutableMap + init { + this.instance = LinkedHashMap() + } + override fun getInstance(): MutableMap { + return instance + } + override fun getBuilderAfterFoobar1(instance: MutableMap): FoobarMap0Builder { + return FoobarMap0Builder(instance) + } + } + + + sealed interface FoobarBoxed { + fun getData(): Any? + } + + data class FoobarBoxedVoid(val data: Nothing?) : FoobarBoxed { + override fun getData(): Any? { + return data + } + } + + data class FoobarBoxedBoolean(val data: Boolean): FoobarBoxed { + override fun getData(): Any? { + return data + } + } + + data class FoobarBoxedNumber(val data: Number) : FoobarBoxed { + override fun getData(): Any? { + return data + } + } + + data class FoobarBoxedString(val data: String) : FoobarBoxed { + override fun getData(): Any? { + return data + } + } + + data class FoobarBoxedList(val data: FrozenList) : FoobarBoxed { + override fun getData(): Any? { + return data + } + } + + data class FoobarBoxedMap(val data: FoobarMap) : FoobarBoxed { + override fun getData(): Any? { + return data + } + } + + + class Foobar private constructor(): JsonSchema( + JsonSchemaInfo() + .required(setOf( + "foo\"bar" + )) + ), NullSchemaValidator, BooleanSchemaValidator, NumberSchemaValidator, StringSchemaValidator, ListSchemaValidator, FoobarBoxedList>, MapSchemaValidator { + + companion object { + @Volatile + private var instance: Foobar? = null + + fun getInstance() = + instance ?: synchronized(this) { + instance ?: Foobar().also { instance = it } + } + } + + @Throws(ValidationException::class) + override fun validate(arg: Nothing?, configuration: SchemaConfiguration?): Nothing? { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validatedPathToSchemas = PathToSchemasMap() + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, LinkedHashSet()) + getPathToSchemas(this, castArg, validationMetadata, pathSet) + return castArg + } + + @Throws(ValidationException::class) + override fun validate(arg: Boolean, configuration: SchemaConfiguration?): Boolean { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validatedPathToSchemas = PathToSchemasMap() + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, LinkedHashSet()) + getPathToSchemas(this, castArg, validationMetadata, pathSet) + return castArg + } + + @Throws(ValidationException::class) + override fun validate(arg: Number, configuration: SchemaConfiguration?): Number { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validatedPathToSchemas = PathToSchemasMap() + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, LinkedHashSet()) + getPathToSchemas(this, castArg, validationMetadata, pathSet) + return castArg + } + + @Throws(ValidationException::class) + fun validate(arg: Int, configuration: SchemaConfiguration?): Int { + return validate(arg as Number, configuration) as Int + } + + @Throws(ValidationException::class) + fun validate(arg: Long, configuration: SchemaConfiguration?): Long { + return validate(arg as Number, configuration) as Long + } + + @Throws(ValidationException::class) + fun validate(arg: Float, configuration: SchemaConfiguration?): Float { + return validate(arg as Number, configuration) as Float + } + + @Throws(ValidationException::class) + fun validate(arg: Double, configuration: SchemaConfiguration?): Double { + return validate(arg as Number, configuration) as Double + } + + @Throws(ValidationException::class) + override fun validate(arg: String, configuration: SchemaConfiguration?): String { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validatedPathToSchemas = PathToSchemasMap() + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, LinkedHashSet()) + getPathToSchemas(this, castArg, validationMetadata, pathSet) + return castArg + } + + @Throws(ValidationException::class) + fun validate(arg: LocalDate, configuration: SchemaConfiguration?): String { + return validate(arg.toString(), configuration) + } + + @Throws(ValidationException::class) + fun validate(arg: ZonedDateTime, configuration: SchemaConfiguration?): String { + return validate(arg.toString(), configuration) + } + + @Throws(ValidationException::class) + fun validate(arg: UUID, configuration: SchemaConfiguration?): String { + return validate(arg.toString(), configuration) + } + + override fun getNewInstance(arg: List<*>, pathToItem: List, pathToSchemas: PathToSchemasMap): FrozenList { + val items: MutableList = ArrayList() + var i: Int = 0 + for (item: Any? in arg) { + val itemPathToItem = pathToItem + i + val schemas: LinkedHashMap, Nothing?>? = pathToSchemas.get(itemPathToItem) + if (schemas == null) { + throw RuntimeException("Validation result is invalid, schemas must exist for a pathToItem") + } + val itemSchema: JsonSchema<*> = schemas.entries.iterator().next().key + val itemInstance: Any? = itemSchema.getNewInstance(item, itemPathToItem, pathToSchemas) + items.add(itemInstance) + i += 1 + } + val newInstanceItems: FrozenList = FrozenList(items) + return newInstanceItems + } + + @Throws(ValidationException::class) + override fun validate(arg: List<*>, configuration: SchemaConfiguration?): FrozenList { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, PathToSchemasMap(), LinkedHashSet()) + val pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet) + return getNewInstance(castArg, validationMetadata.pathToItem, pathToSchemasMap) + } + + override fun getNewInstance(arg: Map<*, *>, pathToItem: List, pathToSchemas: PathToSchemasMap): FoobarMap { + val properties: LinkedHashMap = LinkedHashMap() + for((propertyName, value) in arg) { + if (!(propertyName is String)) { + throw RuntimeException("Invalid non-string key value") + } + val propertyPathToItem: List = pathToItem + propertyName + val schemas: LinkedHashMap, Nothing?>? = pathToSchemas.get(propertyPathToItem) + if (schemas == null) { + throw RuntimeException("Validation result is invalid, schemas must exist for a pathToItem") + } + val propertySchema: JsonSchema<*> = schemas.entries.iterator().next().key + val propertyInstance: Any? = propertySchema.getNewInstance(value, propertyPathToItem, pathToSchemas) + properties[propertyName] = propertyInstance + } + val castProperties: FrozenMap = FrozenMap(properties) + return FoobarMap(castProperties) + } + + @Throws(ValidationException::class) + override fun validate(arg: Map<*, *>, configuration: SchemaConfiguration?): FoobarMap { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validatedPathToSchemas = PathToSchemasMap() + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, LinkedHashSet()) + val pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet) + return getNewInstance(castArg, validationMetadata.pathToItem, pathToSchemasMap) + } + + @Throws(ValidationException::class) + override fun validate(arg: Any?, configuration: SchemaConfiguration?): Any? { + if (arg == null) { + return validate(null, configuration) + } else if (arg is Boolean) { + return validate(arg, configuration) + } else if (arg is Number) { + return validate(arg, configuration) + } else if (arg is String) { + return validate(arg, configuration) + } else if (arg is List<*>) { + return validate(arg, configuration) + } else if (arg is Map<*, *>) { + return validate(arg, configuration) + } + throw ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema") + } + override fun getNewInstance(arg: Any?, pathToItem: List, pathToSchemas: PathToSchemasMap): Any? { + if (arg == null) { + return getNewInstance( null, pathToItem, pathToSchemas) + } else if (arg is Boolean) { + return getNewInstance(arg, pathToItem, pathToSchemas) + } else if (arg is Number) { + return getNewInstance(arg, pathToItem, pathToSchemas) + } else if (arg is String) { + return getNewInstance(arg, pathToItem, pathToSchemas) + } else if (arg is List<*>) { + return getNewInstance(arg, pathToItem, pathToSchemas) + } else if (arg is Map<*, *>) { + return getNewInstance(arg, pathToItem, pathToSchemas) + } + throw RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema") + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: Nothing?, configuration: SchemaConfiguration?): FoobarBoxedVoid { + return FoobarBoxedVoid(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: Boolean, configuration: SchemaConfiguration?): FoobarBoxedBoolean { + return FoobarBoxedBoolean(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: Number, configuration: SchemaConfiguration?): FoobarBoxedNumber { + return FoobarBoxedNumber(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: String, configuration: SchemaConfiguration?): FoobarBoxedString { + return FoobarBoxedString(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: List<*>, configuration: SchemaConfiguration?): FoobarBoxedList { + return FoobarBoxedList(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: Map<*, *>, configuration: SchemaConfiguration?): FoobarBoxedMap { + return FoobarBoxedMap(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: Any?, configuration: SchemaConfiguration?): FoobarBoxed { + if (arg == null) { + return validateAndBox(null, configuration) + } else if (arg is Boolean) { + return validateAndBox(arg, configuration) + } else if (arg is String) { + return validateAndBox(arg, configuration) + } else if (arg is Number) { + return validateAndBox(arg, configuration) + } else if (arg is List<*>) { + return validateAndBox(arg, configuration) + } else if (arg is Map<*, *>) { + return validateAndBox(arg, configuration) + } + throw ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema") + } + } + + sealed interface DependentSchemasDependenciesWithEscapedCharacters1Boxed { + fun getData(): Any? + } + + data class DependentSchemasDependenciesWithEscapedCharacters1BoxedVoid(val data: Nothing?) : DependentSchemasDependenciesWithEscapedCharacters1Boxed { + override fun getData(): Any? { + return data + } + } + + data class DependentSchemasDependenciesWithEscapedCharacters1BoxedBoolean(val data: Boolean): DependentSchemasDependenciesWithEscapedCharacters1Boxed { + override fun getData(): Any? { + return data + } + } + + data class DependentSchemasDependenciesWithEscapedCharacters1BoxedNumber(val data: Number) : DependentSchemasDependenciesWithEscapedCharacters1Boxed { + override fun getData(): Any? { + return data + } + } + + data class DependentSchemasDependenciesWithEscapedCharacters1BoxedString(val data: String) : DependentSchemasDependenciesWithEscapedCharacters1Boxed { + override fun getData(): Any? { + return data + } + } + + data class DependentSchemasDependenciesWithEscapedCharacters1BoxedList(val data: FrozenList) : DependentSchemasDependenciesWithEscapedCharacters1Boxed { + override fun getData(): Any? { + return data + } + } + + data class DependentSchemasDependenciesWithEscapedCharacters1BoxedMap(val data: FrozenMap) : DependentSchemasDependenciesWithEscapedCharacters1Boxed { + override fun getData(): Any? { + return data + } + } + + + class DependentSchemasDependenciesWithEscapedCharacters1 private constructor(): JsonSchema( + JsonSchemaInfo() + .dependentSchemas(mapOf( + new PropertyEntry("foo\tbar", Footbar::class.java), + new PropertyEntry("foo'bar", Foobar::class.java) + )) + ), NullSchemaValidator, BooleanSchemaValidator, NumberSchemaValidator, StringSchemaValidator, ListSchemaValidator, DependentSchemasDependenciesWithEscapedCharacters1BoxedList>, MapSchemaValidator, DependentSchemasDependenciesWithEscapedCharacters1BoxedMap> { + /* + NOTE: This class is auto generated by OpenAPI JSON Schema Generator. + Ref: https://github.com/openapi-json-schema-tools/openapi-json-schema-generator + + Do not edit the class manually. + */ + + companion object { + @Volatile + private var instance: DependentSchemasDependenciesWithEscapedCharacters1? = null + + fun getInstance() = + instance ?: synchronized(this) { + instance ?: DependentSchemasDependenciesWithEscapedCharacters1().also { instance = it } + } + } + + @Throws(ValidationException::class) + override fun validate(arg: Nothing?, configuration: SchemaConfiguration?): Nothing? { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validatedPathToSchemas = PathToSchemasMap() + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, LinkedHashSet()) + getPathToSchemas(this, castArg, validationMetadata, pathSet) + return castArg + } + + @Throws(ValidationException::class) + override fun validate(arg: Boolean, configuration: SchemaConfiguration?): Boolean { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validatedPathToSchemas = PathToSchemasMap() + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, LinkedHashSet()) + getPathToSchemas(this, castArg, validationMetadata, pathSet) + return castArg + } + + @Throws(ValidationException::class) + override fun validate(arg: Number, configuration: SchemaConfiguration?): Number { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validatedPathToSchemas = PathToSchemasMap() + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, LinkedHashSet()) + getPathToSchemas(this, castArg, validationMetadata, pathSet) + return castArg + } + + @Throws(ValidationException::class) + fun validate(arg: Int, configuration: SchemaConfiguration?): Int { + return validate(arg as Number, configuration) as Int + } + + @Throws(ValidationException::class) + fun validate(arg: Long, configuration: SchemaConfiguration?): Long { + return validate(arg as Number, configuration) as Long + } + + @Throws(ValidationException::class) + fun validate(arg: Float, configuration: SchemaConfiguration?): Float { + return validate(arg as Number, configuration) as Float + } + + @Throws(ValidationException::class) + fun validate(arg: Double, configuration: SchemaConfiguration?): Double { + return validate(arg as Number, configuration) as Double + } + + @Throws(ValidationException::class) + override fun validate(arg: String, configuration: SchemaConfiguration?): String { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validatedPathToSchemas = PathToSchemasMap() + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, LinkedHashSet()) + getPathToSchemas(this, castArg, validationMetadata, pathSet) + return castArg + } + + @Throws(ValidationException::class) + fun validate(arg: LocalDate, configuration: SchemaConfiguration?): String { + return validate(arg.toString(), configuration) + } + + @Throws(ValidationException::class) + fun validate(arg: ZonedDateTime, configuration: SchemaConfiguration?): String { + return validate(arg.toString(), configuration) + } + + @Throws(ValidationException::class) + fun validate(arg: UUID, configuration: SchemaConfiguration?): String { + return validate(arg.toString(), configuration) + } + + override fun getNewInstance(arg: List<*>, pathToItem: List, pathToSchemas: PathToSchemasMap): FrozenList { + val items: MutableList = ArrayList() + var i: Int = 0 + for (item: Any? in arg) { + val itemPathToItem = pathToItem + i + val schemas: LinkedHashMap, Nothing?>? = pathToSchemas.get(itemPathToItem) + if (schemas == null) { + throw RuntimeException("Validation result is invalid, schemas must exist for a pathToItem") + } + val itemSchema: JsonSchema<*> = schemas.entries.iterator().next().key + val itemInstance: Any? = itemSchema.getNewInstance(item, itemPathToItem, pathToSchemas) + items.add(itemInstance) + i += 1 + } + val newInstanceItems: FrozenList = FrozenList(items) + return newInstanceItems + } + + @Throws(ValidationException::class) + override fun validate(arg: List<*>, configuration: SchemaConfiguration?): FrozenList { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, PathToSchemasMap(), LinkedHashSet()) + val pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet) + return getNewInstance(castArg, validationMetadata.pathToItem, pathToSchemasMap) + } + + override fun getNewInstance(arg: Map<*, *>, pathToItem: List, pathToSchemas: PathToSchemasMap): FrozenMap { + val properties: LinkedHashMap = LinkedHashMap() + for((propertyName, value) in arg) { + if (!(propertyName is String)) { + throw RuntimeException("Invalid non-string key value") + } + val propertyPathToItem: List = pathToItem + propertyName + val schemas: LinkedHashMap, Nothing?>? = pathToSchemas.get(propertyPathToItem) + if (schemas == null) { + throw RuntimeException("Validation result is invalid, schemas must exist for a pathToItem") + } + val propertySchema: JsonSchema<*> = schemas.entries.iterator().next().key + val propertyInstance: Any? = propertySchema.getNewInstance(value, propertyPathToItem, pathToSchemas) + properties[propertyName] = propertyInstance + } + val castProperties: FrozenMap = FrozenMap(properties) + return castProperties + } + + @Throws(ValidationException::class) + override fun validate(arg: Map<*, *>, configuration: SchemaConfiguration?): FrozenMap { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validatedPathToSchemas = PathToSchemasMap() + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, LinkedHashSet()) + val pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet) + return getNewInstance(castArg, validationMetadata.pathToItem, pathToSchemasMap) + } + + @Throws(ValidationException::class) + override fun validate(arg: Any?, configuration: SchemaConfiguration?): Any? { + if (arg == null) { + return validate(null, configuration) + } else if (arg is Boolean) { + return validate(arg, configuration) + } else if (arg is Number) { + return validate(arg, configuration) + } else if (arg is String) { + return validate(arg, configuration) + } else if (arg is List<*>) { + return validate(arg, configuration) + } else if (arg is Map<*, *>) { + return validate(arg, configuration) + } + throw ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema") + } + override fun getNewInstance(arg: Any?, pathToItem: List, pathToSchemas: PathToSchemasMap): Any? { + if (arg == null) { + return getNewInstance( null, pathToItem, pathToSchemas) + } else if (arg is Boolean) { + return getNewInstance(arg, pathToItem, pathToSchemas) + } else if (arg is Number) { + return getNewInstance(arg, pathToItem, pathToSchemas) + } else if (arg is String) { + return getNewInstance(arg, pathToItem, pathToSchemas) + } else if (arg is List<*>) { + return getNewInstance(arg, pathToItem, pathToSchemas) + } else if (arg is Map<*, *>) { + return getNewInstance(arg, pathToItem, pathToSchemas) + } + throw RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema") + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: Nothing?, configuration: SchemaConfiguration?): DependentSchemasDependenciesWithEscapedCharacters1BoxedVoid { + return DependentSchemasDependenciesWithEscapedCharacters1BoxedVoid(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: Boolean, configuration: SchemaConfiguration?): DependentSchemasDependenciesWithEscapedCharacters1BoxedBoolean { + return DependentSchemasDependenciesWithEscapedCharacters1BoxedBoolean(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: Number, configuration: SchemaConfiguration?): DependentSchemasDependenciesWithEscapedCharacters1BoxedNumber { + return DependentSchemasDependenciesWithEscapedCharacters1BoxedNumber(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: String, configuration: SchemaConfiguration?): DependentSchemasDependenciesWithEscapedCharacters1BoxedString { + return DependentSchemasDependenciesWithEscapedCharacters1BoxedString(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: List<*>, configuration: SchemaConfiguration?): DependentSchemasDependenciesWithEscapedCharacters1BoxedList { + return DependentSchemasDependenciesWithEscapedCharacters1BoxedList(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: Map<*, *>, configuration: SchemaConfiguration?): DependentSchemasDependenciesWithEscapedCharacters1BoxedMap { + return DependentSchemasDependenciesWithEscapedCharacters1BoxedMap(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: Any?, configuration: SchemaConfiguration?): DependentSchemasDependenciesWithEscapedCharacters1Boxed { + if (arg == null) { + return validateAndBox(null, configuration) + } else if (arg is Boolean) { + return validateAndBox(arg, configuration) + } else if (arg is String) { + return validateAndBox(arg, configuration) + } else if (arg is Number) { + return validateAndBox(arg, configuration) + } else if (arg is List<*>) { + return validateAndBox(arg, configuration) + } else if (arg is Map<*, *>) { + return validateAndBox(arg, configuration) + } + throw ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema") + } + } +} diff --git a/samples/client/3_1_0_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/schemas/DependentSchemasDependentSubschemaIncompatibleWithRoot.kt b/samples/client/3_1_0_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/schemas/DependentSchemasDependentSubschemaIncompatibleWithRoot.kt new file mode 100644 index 00000000000..6ffb6b956c2 --- /dev/null +++ b/samples/client/3_1_0_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/schemas/DependentSchemasDependentSubschemaIncompatibleWithRoot.kt @@ -0,0 +1,655 @@ +package org.openapijsonschematools.client.components.schemas +import java.time.LocalDate +import java.time.ZonedDateTime +import java.util.UUID +import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags +import org.openapijsonschematools.client.configurations.SchemaConfiguration +import org.openapijsonschematools.client.exceptions.InvalidAdditionalPropertyException +import org.openapijsonschematools.client.exceptions.UnsetPropertyException +import org.openapijsonschematools.client.exceptions.ValidationException +import org.openapijsonschematools.client.schemas.AnyTypeJsonSchema +import org.openapijsonschematools.client.schemas.GenericBuilder +import org.openapijsonschematools.client.schemas.NotAnyTypeJsonSchema +import org.openapijsonschematools.client.schemas.UnsetAddPropsSetter +import org.openapijsonschematools.client.schemas.validation.BooleanSchemaValidator +import org.openapijsonschematools.client.schemas.validation.FrozenList +import org.openapijsonschematools.client.schemas.validation.FrozenMap +import org.openapijsonschematools.client.schemas.validation.JsonSchema +import org.openapijsonschematools.client.schemas.validation.JsonSchemaInfo +import org.openapijsonschematools.client.schemas.validation.ListSchemaValidator +import org.openapijsonschematools.client.schemas.validation.MapSchemaValidator +import org.openapijsonschematools.client.schemas.validation.MapUtils +import org.openapijsonschematools.client.schemas.validation.NullSchemaValidator +import org.openapijsonschematools.client.schemas.validation.NumberSchemaValidator +import org.openapijsonschematools.client.schemas.validation.PathToSchemasMap +import org.openapijsonschematools.client.schemas.validation.StringSchemaValidator +import org.openapijsonschematools.client.schemas.validation.ValidationMetadata + +class DependentSchemasDependentSubschemaIncompatibleWithRoot { + // nest classes so all schemas and input/output classes can be public + + + class AdditionalProperties : NotAnyTypeJsonSchema.NotAnyTypeJsonSchema1() { + // NotAnyTypeSchema + companion object { + @Volatile + private var instance: AdditionalProperties? = null + + fun getInstance() = + instance ?: synchronized(this) { + instance ?: AdditionalProperties().also { instance = it } + } + } + } + + + class Bar : AnyTypeJsonSchema.AnyTypeJsonSchema1() { + companion object { + @Volatile + private var instance: Bar? = null + + fun getInstance() = + instance ?: synchronized(this) { + instance ?: Bar().also { instance = it } + } + } + } + + + class FooMap(m: FrozenMap) : FrozenMap(m) { + companion object { + val requiredKeys: Set = setOf() + val optionalKeys: Set = setOf( + "bar" + ) + @Throws(ValidationException::class) + fun of(arg: Map, configuration: SchemaConfiguration): FooMap { + return Foo1.getInstance().validate(arg, configuration) + } + } + + @Throws(UnsetPropertyException::class) + fun bar(): Any? { + return getOrThrow("bar") + } + } + + interface SetterForBar { + fun getInstance(): MutableMap + fun getBuilderAfterBar(instance: MutableMap): T + + fun bar(value: Nothing?): T { + val instance = getInstance() + instance["bar"] = null + return getBuilderAfterBar(instance) + } + + fun bar(value: Boolean): T { + val instance = getInstance() + instance["bar"] = value + return getBuilderAfterBar(instance) + } + + fun bar(value: String): T { + val instance = getInstance() + instance["bar"] = value + return getBuilderAfterBar(instance) + } + + fun bar(value: Int): T { + val instance = getInstance() + instance["bar"] = value + return getBuilderAfterBar(instance) + } + + fun bar(value: Float): T { + val instance = getInstance() + instance["bar"] = value + return getBuilderAfterBar(instance) + } + + fun bar(value: Long): T { + val instance = getInstance() + instance["bar"] = value + return getBuilderAfterBar(instance) + } + + fun bar(value: Double): T { + val instance = getInstance() + instance["bar"] = value + return getBuilderAfterBar(instance) + } + + fun bar(value: List): T { + val instance = getInstance() + instance["bar"] = value + return getBuilderAfterBar(instance) + } + + fun bar(value: Map): T { + val instance = getInstance() + instance["bar"] = value + return getBuilderAfterBar(instance) + } + } + + class FooMapBuilder1: GenericBuilder>, SetterForBar { + private val knownKeys: Set = setOf( + "bar" + ) + override fun getKnownKeys(): Set { + return knownKeys + } + private val instance: MutableMap + init { + this.instance = LinkedHashMap() + } + override fun build(): Map { + return instance + } + override fun getInstance(): MutableMap { + return instance + } + override fun getBuilderAfterBar(instance: MutableMap): FooMapBuilder1 { + return this + } + } + + + sealed interface Foo1Boxed { + fun getData(): Any? + } + + data class Foo1BoxedMap(val data: FooMap) : Foo1Boxed { + override fun getData(): Any? { + return data + } + } + + + class Foo1 private constructor(): JsonSchema( + JsonSchemaInfo() + .type(setOf(Map::class.java)) + .properties(mapOf( + "bar" to Bar::class.java + )) + .additionalProperties(AdditionalProperties::class.java) + ), MapSchemaValidator { + + companion object { + @Volatile + private var instance: Foo1? = null + + fun getInstance() = + instance ?: synchronized(this) { + instance ?: Foo1().also { instance = it } + } + } + + override fun getNewInstance(arg: Map<*, *>, pathToItem: List, pathToSchemas: PathToSchemasMap): FooMap { + val properties: LinkedHashMap = LinkedHashMap() + for((entryKey, value) in arg) { + if (!(entryKey is String)) { + throw RuntimeException("Invalid non-string key value") + } + val propertyPathToItem: List = pathToItem + entryKey + val schemas: LinkedHashMap, Nothing?>? = pathToSchemas.get(propertyPathToItem) + if (schemas == null) { + throw RuntimeException("Validation result is invalid, schemas must exist for a pathToItem") + } + val propertySchema: JsonSchema<*> = schemas.entries.iterator().next().key + val propertyInstance: Any? = propertySchema.getNewInstance(value, propertyPathToItem, pathToSchemas) + properties[entryKey] = propertyInstance + } + val castProperties: FrozenMap = FrozenMap(properties) + return FooMap(castProperties) + } + + @Throws(ValidationException::class) + override fun validate(arg: Map<*, *>, configuration: SchemaConfiguration?): FooMap { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, PathToSchemasMap(), LinkedHashSet()) + val pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet) + return getNewInstance(castArg, validationMetadata.pathToItem, pathToSchemasMap) + } + + + @Throws(ValidationException::class) + override fun validate(arg: Any?, configuration: SchemaConfiguration?): Any? { + if (arg is Map<*, *>) { + return validate(arg, configuration) + } + throw ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema") + } + override fun getNewInstance(arg: Any?, pathToItem: List, pathToSchemas: PathToSchemasMap): Any? { + if (arg is Map<*, *>) { + return getNewInstance(arg, pathToItem, pathToSchemas) + } + throw RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema") + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: Map<*, *>, configuration: SchemaConfiguration?): Foo1BoxedMap { + return Foo1BoxedMap(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: Any?, configuration: SchemaConfiguration?): Foo1Boxed { + if (arg is Map<*, *>) { + return validateAndBox(arg, configuration) + } + throw ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema") + } + } + + + class Foo : AnyTypeJsonSchema.AnyTypeJsonSchema1() { + companion object { + @Volatile + private var instance: Foo? = null + + fun getInstance() = + instance ?: synchronized(this) { + instance ?: Foo().also { instance = it } + } + } + } + + + class DependentSchemasDependentSubschemaIncompatibleWithRootMap(m: FrozenMap) : FrozenMap(m) { + companion object { + val requiredKeys: Set = setOf() + val optionalKeys: Set = setOf( + "foo" + ) + @Throws(ValidationException::class) + fun of(arg: Map, configuration: SchemaConfiguration): DependentSchemasDependentSubschemaIncompatibleWithRootMap { + return DependentSchemasDependentSubschemaIncompatibleWithRoot1.getInstance().validate(arg, configuration) + } + } + + @Throws(UnsetPropertyException::class) + fun foo(): Any? { + return getOrThrow("foo") + } + + @Throws(UnsetPropertyException::class, InvalidAdditionalPropertyException::class) + fun getAdditionalProperty(name: String): Any? { + throwIfKeyKnown(name, requiredKeys, optionalKeys) + throwIfKeyNotPresent(name) + return get(name) + } + } + + interface SetterForFoo { + fun getInstance(): MutableMap + fun getBuilderAfterFoo(instance: MutableMap): T + + fun foo(value: Nothing?): T { + val instance = getInstance() + instance["foo"] = null + return getBuilderAfterFoo(instance) + } + + fun foo(value: Boolean): T { + val instance = getInstance() + instance["foo"] = value + return getBuilderAfterFoo(instance) + } + + fun foo(value: String): T { + val instance = getInstance() + instance["foo"] = value + return getBuilderAfterFoo(instance) + } + + fun foo(value: Int): T { + val instance = getInstance() + instance["foo"] = value + return getBuilderAfterFoo(instance) + } + + fun foo(value: Float): T { + val instance = getInstance() + instance["foo"] = value + return getBuilderAfterFoo(instance) + } + + fun foo(value: Long): T { + val instance = getInstance() + instance["foo"] = value + return getBuilderAfterFoo(instance) + } + + fun foo(value: Double): T { + val instance = getInstance() + instance["foo"] = value + return getBuilderAfterFoo(instance) + } + + fun foo(value: List): T { + val instance = getInstance() + instance["foo"] = value + return getBuilderAfterFoo(instance) + } + + fun foo(value: Map): T { + val instance = getInstance() + instance["foo"] = value + return getBuilderAfterFoo(instance) + } + } + + class DependentSchemasDependentSubschemaIncompatibleWithRootMapBuilder: UnsetAddPropsSetter, GenericBuilder>, SetterForFoo { + private val knownKeys: Set = setOf( + "foo" + ) + override fun getKnownKeys(): Set { + return knownKeys + } + private val instance: MutableMap + init { + this.instance = LinkedHashMap() + } + override fun build(): Map { + return instance + } + override fun getInstance(): MutableMap { + return instance + } + override fun getBuilderAfterFoo(instance: MutableMap): DependentSchemasDependentSubschemaIncompatibleWithRootMapBuilder { + return this + } + override fun getBuilderAfterAdditionalProperty(instance: MutableMap): DependentSchemasDependentSubschemaIncompatibleWithRootMapBuilder { + return this + } + } + + + sealed interface DependentSchemasDependentSubschemaIncompatibleWithRoot1Boxed { + fun getData(): Any? + } + + data class DependentSchemasDependentSubschemaIncompatibleWithRoot1BoxedVoid(val data: Nothing?) : DependentSchemasDependentSubschemaIncompatibleWithRoot1Boxed { + override fun getData(): Any? { + return data + } + } + + data class DependentSchemasDependentSubschemaIncompatibleWithRoot1BoxedBoolean(val data: Boolean): DependentSchemasDependentSubschemaIncompatibleWithRoot1Boxed { + override fun getData(): Any? { + return data + } + } + + data class DependentSchemasDependentSubschemaIncompatibleWithRoot1BoxedNumber(val data: Number) : DependentSchemasDependentSubschemaIncompatibleWithRoot1Boxed { + override fun getData(): Any? { + return data + } + } + + data class DependentSchemasDependentSubschemaIncompatibleWithRoot1BoxedString(val data: String) : DependentSchemasDependentSubschemaIncompatibleWithRoot1Boxed { + override fun getData(): Any? { + return data + } + } + + data class DependentSchemasDependentSubschemaIncompatibleWithRoot1BoxedList(val data: FrozenList) : DependentSchemasDependentSubschemaIncompatibleWithRoot1Boxed { + override fun getData(): Any? { + return data + } + } + + data class DependentSchemasDependentSubschemaIncompatibleWithRoot1BoxedMap(val data: DependentSchemasDependentSubschemaIncompatibleWithRootMap) : DependentSchemasDependentSubschemaIncompatibleWithRoot1Boxed { + override fun getData(): Any? { + return data + } + } + + + class DependentSchemasDependentSubschemaIncompatibleWithRoot1 private constructor(): JsonSchema( + JsonSchemaInfo() + .properties(mapOf( + "foo" to Foo::class.java + )) + .dependentSchemas(mapOf( + new PropertyEntry("foo", Foo1::class.java) + )) + ), NullSchemaValidator, BooleanSchemaValidator, NumberSchemaValidator, StringSchemaValidator, ListSchemaValidator, DependentSchemasDependentSubschemaIncompatibleWithRoot1BoxedList>, MapSchemaValidator { + /* + NOTE: This class is auto generated by OpenAPI JSON Schema Generator. + Ref: https://github.com/openapi-json-schema-tools/openapi-json-schema-generator + + Do not edit the class manually. + */ + + companion object { + @Volatile + private var instance: DependentSchemasDependentSubschemaIncompatibleWithRoot1? = null + + fun getInstance() = + instance ?: synchronized(this) { + instance ?: DependentSchemasDependentSubschemaIncompatibleWithRoot1().also { instance = it } + } + } + + @Throws(ValidationException::class) + override fun validate(arg: Nothing?, configuration: SchemaConfiguration?): Nothing? { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validatedPathToSchemas = PathToSchemasMap() + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, LinkedHashSet()) + getPathToSchemas(this, castArg, validationMetadata, pathSet) + return castArg + } + + @Throws(ValidationException::class) + override fun validate(arg: Boolean, configuration: SchemaConfiguration?): Boolean { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validatedPathToSchemas = PathToSchemasMap() + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, LinkedHashSet()) + getPathToSchemas(this, castArg, validationMetadata, pathSet) + return castArg + } + + @Throws(ValidationException::class) + override fun validate(arg: Number, configuration: SchemaConfiguration?): Number { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validatedPathToSchemas = PathToSchemasMap() + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, LinkedHashSet()) + getPathToSchemas(this, castArg, validationMetadata, pathSet) + return castArg + } + + @Throws(ValidationException::class) + fun validate(arg: Int, configuration: SchemaConfiguration?): Int { + return validate(arg as Number, configuration) as Int + } + + @Throws(ValidationException::class) + fun validate(arg: Long, configuration: SchemaConfiguration?): Long { + return validate(arg as Number, configuration) as Long + } + + @Throws(ValidationException::class) + fun validate(arg: Float, configuration: SchemaConfiguration?): Float { + return validate(arg as Number, configuration) as Float + } + + @Throws(ValidationException::class) + fun validate(arg: Double, configuration: SchemaConfiguration?): Double { + return validate(arg as Number, configuration) as Double + } + + @Throws(ValidationException::class) + override fun validate(arg: String, configuration: SchemaConfiguration?): String { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validatedPathToSchemas = PathToSchemasMap() + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, LinkedHashSet()) + getPathToSchemas(this, castArg, validationMetadata, pathSet) + return castArg + } + + @Throws(ValidationException::class) + fun validate(arg: LocalDate, configuration: SchemaConfiguration?): String { + return validate(arg.toString(), configuration) + } + + @Throws(ValidationException::class) + fun validate(arg: ZonedDateTime, configuration: SchemaConfiguration?): String { + return validate(arg.toString(), configuration) + } + + @Throws(ValidationException::class) + fun validate(arg: UUID, configuration: SchemaConfiguration?): String { + return validate(arg.toString(), configuration) + } + + override fun getNewInstance(arg: List<*>, pathToItem: List, pathToSchemas: PathToSchemasMap): FrozenList { + val items: MutableList = ArrayList() + var i: Int = 0 + for (item: Any? in arg) { + val itemPathToItem = pathToItem + i + val schemas: LinkedHashMap, Nothing?>? = pathToSchemas.get(itemPathToItem) + if (schemas == null) { + throw RuntimeException("Validation result is invalid, schemas must exist for a pathToItem") + } + val itemSchema: JsonSchema<*> = schemas.entries.iterator().next().key + val itemInstance: Any? = itemSchema.getNewInstance(item, itemPathToItem, pathToSchemas) + items.add(itemInstance) + i += 1 + } + val newInstanceItems: FrozenList = FrozenList(items) + return newInstanceItems + } + + @Throws(ValidationException::class) + override fun validate(arg: List<*>, configuration: SchemaConfiguration?): FrozenList { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, PathToSchemasMap(), LinkedHashSet()) + val pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet) + return getNewInstance(castArg, validationMetadata.pathToItem, pathToSchemasMap) + } + + override fun getNewInstance(arg: Map<*, *>, pathToItem: List, pathToSchemas: PathToSchemasMap): DependentSchemasDependentSubschemaIncompatibleWithRootMap { + val properties: LinkedHashMap = LinkedHashMap() + for((propertyName, value) in arg) { + if (!(propertyName is String)) { + throw RuntimeException("Invalid non-string key value") + } + val propertyPathToItem: List = pathToItem + propertyName + val schemas: LinkedHashMap, Nothing?>? = pathToSchemas.get(propertyPathToItem) + if (schemas == null) { + throw RuntimeException("Validation result is invalid, schemas must exist for a pathToItem") + } + val propertySchema: JsonSchema<*> = schemas.entries.iterator().next().key + val propertyInstance: Any? = propertySchema.getNewInstance(value, propertyPathToItem, pathToSchemas) + properties[propertyName] = propertyInstance + } + val castProperties: FrozenMap = FrozenMap(properties) + return DependentSchemasDependentSubschemaIncompatibleWithRootMap(castProperties) + } + + @Throws(ValidationException::class) + override fun validate(arg: Map<*, *>, configuration: SchemaConfiguration?): DependentSchemasDependentSubschemaIncompatibleWithRootMap { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validatedPathToSchemas = PathToSchemasMap() + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, LinkedHashSet()) + val pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet) + return getNewInstance(castArg, validationMetadata.pathToItem, pathToSchemasMap) + } + + @Throws(ValidationException::class) + override fun validate(arg: Any?, configuration: SchemaConfiguration?): Any? { + if (arg == null) { + return validate(null, configuration) + } else if (arg is Boolean) { + return validate(arg, configuration) + } else if (arg is Number) { + return validate(arg, configuration) + } else if (arg is String) { + return validate(arg, configuration) + } else if (arg is List<*>) { + return validate(arg, configuration) + } else if (arg is Map<*, *>) { + return validate(arg, configuration) + } + throw ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema") + } + override fun getNewInstance(arg: Any?, pathToItem: List, pathToSchemas: PathToSchemasMap): Any? { + if (arg == null) { + return getNewInstance( null, pathToItem, pathToSchemas) + } else if (arg is Boolean) { + return getNewInstance(arg, pathToItem, pathToSchemas) + } else if (arg is Number) { + return getNewInstance(arg, pathToItem, pathToSchemas) + } else if (arg is String) { + return getNewInstance(arg, pathToItem, pathToSchemas) + } else if (arg is List<*>) { + return getNewInstance(arg, pathToItem, pathToSchemas) + } else if (arg is Map<*, *>) { + return getNewInstance(arg, pathToItem, pathToSchemas) + } + throw RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema") + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: Nothing?, configuration: SchemaConfiguration?): DependentSchemasDependentSubschemaIncompatibleWithRoot1BoxedVoid { + return DependentSchemasDependentSubschemaIncompatibleWithRoot1BoxedVoid(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: Boolean, configuration: SchemaConfiguration?): DependentSchemasDependentSubschemaIncompatibleWithRoot1BoxedBoolean { + return DependentSchemasDependentSubschemaIncompatibleWithRoot1BoxedBoolean(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: Number, configuration: SchemaConfiguration?): DependentSchemasDependentSubschemaIncompatibleWithRoot1BoxedNumber { + return DependentSchemasDependentSubschemaIncompatibleWithRoot1BoxedNumber(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: String, configuration: SchemaConfiguration?): DependentSchemasDependentSubschemaIncompatibleWithRoot1BoxedString { + return DependentSchemasDependentSubschemaIncompatibleWithRoot1BoxedString(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: List<*>, configuration: SchemaConfiguration?): DependentSchemasDependentSubschemaIncompatibleWithRoot1BoxedList { + return DependentSchemasDependentSubschemaIncompatibleWithRoot1BoxedList(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: Map<*, *>, configuration: SchemaConfiguration?): DependentSchemasDependentSubschemaIncompatibleWithRoot1BoxedMap { + return DependentSchemasDependentSubschemaIncompatibleWithRoot1BoxedMap(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: Any?, configuration: SchemaConfiguration?): DependentSchemasDependentSubschemaIncompatibleWithRoot1Boxed { + if (arg == null) { + return validateAndBox(null, configuration) + } else if (arg is Boolean) { + return validateAndBox(arg, configuration) + } else if (arg is String) { + return validateAndBox(arg, configuration) + } else if (arg is Number) { + return validateAndBox(arg, configuration) + } else if (arg is List<*>) { + return validateAndBox(arg, configuration) + } else if (arg is Map<*, *>) { + return validateAndBox(arg, configuration) + } + throw ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema") + } + } +} diff --git a/samples/client/3_1_0_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/schemas/DependentSchemasSingleDependency.kt b/samples/client/3_1_0_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/schemas/DependentSchemasSingleDependency.kt new file mode 100644 index 00000000000..3c8361fe061 --- /dev/null +++ b/samples/client/3_1_0_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/schemas/DependentSchemasSingleDependency.kt @@ -0,0 +1,747 @@ +package org.openapijsonschematools.client.components.schemas +import java.time.LocalDate +import java.time.ZonedDateTime +import java.util.UUID +import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags +import org.openapijsonschematools.client.configurations.SchemaConfiguration +import org.openapijsonschematools.client.exceptions.InvalidAdditionalPropertyException +import org.openapijsonschematools.client.exceptions.UnsetPropertyException +import org.openapijsonschematools.client.exceptions.ValidationException +import org.openapijsonschematools.client.schemas.GenericBuilder +import org.openapijsonschematools.client.schemas.IntJsonSchema +import org.openapijsonschematools.client.schemas.UnsetAddPropsSetter +import org.openapijsonschematools.client.schemas.validation.BooleanSchemaValidator +import org.openapijsonschematools.client.schemas.validation.FrozenList +import org.openapijsonschematools.client.schemas.validation.FrozenMap +import org.openapijsonschematools.client.schemas.validation.JsonSchema +import org.openapijsonschematools.client.schemas.validation.JsonSchemaInfo +import org.openapijsonschematools.client.schemas.validation.ListSchemaValidator +import org.openapijsonschematools.client.schemas.validation.MapSchemaValidator +import org.openapijsonschematools.client.schemas.validation.NullSchemaValidator +import org.openapijsonschematools.client.schemas.validation.NumberSchemaValidator +import org.openapijsonschematools.client.schemas.validation.PathToSchemasMap +import org.openapijsonschematools.client.schemas.validation.StringSchemaValidator +import org.openapijsonschematools.client.schemas.validation.ValidationMetadata + +class DependentSchemasSingleDependency { + // nest classes so all schemas and input/output classes can be public + + + class Foo : IntJsonSchema.IntJsonSchema1() { + companion object { + @Volatile + private var instance: Foo? = null + + fun getInstance() = + instance ?: synchronized(this) { + instance ?: Foo().also { instance = it } + } + } + } + + + class Bar1 : IntJsonSchema.IntJsonSchema1() { + companion object { + @Volatile + private var instance: Bar1? = null + + fun getInstance() = + instance ?: synchronized(this) { + instance ?: Bar1().also { instance = it } + } + } + } + + + class BarMap(m: FrozenMap) : FrozenMap(m) { + companion object { + val requiredKeys: Set = setOf() + val optionalKeys: Set = setOf( + "foo", + "bar" + ) + @Throws(ValidationException::class) + fun of(arg: Map, configuration: SchemaConfiguration): BarMap { + return Bar.getInstance().validate(arg, configuration) + } + } + + @Throws(UnsetPropertyException::class) + fun foo(): Number { + val key = "foo" + throwIfKeyNotPresent(key) + val value: Any? = get(key) + if (!(value is Number)) { + throw RuntimeException("Invalid value stored for foo") + } + return value + } + + @Throws(UnsetPropertyException::class) + fun bar(): Number { + val key = "bar" + throwIfKeyNotPresent(key) + val value: Any? = get(key) + if (!(value is Number)) { + throw RuntimeException("Invalid value stored for bar") + } + return value + } + + @Throws(UnsetPropertyException::class, InvalidAdditionalPropertyException::class) + fun getAdditionalProperty(name: String): Any? { + throwIfKeyKnown(name, requiredKeys, optionalKeys) + throwIfKeyNotPresent(name) + return get(name) + } + } + + interface SetterForFoo { + fun getInstance(): MutableMap + fun getBuilderAfterFoo(instance: MutableMap): T + + fun foo(value: Int): T { + val instance = getInstance() + instance["foo"] = value + return getBuilderAfterFoo(instance) + } + + fun foo(value: Float): T { + val instance = getInstance() + instance["foo"] = value + return getBuilderAfterFoo(instance) + } + + fun foo(value: Long): T { + val instance = getInstance() + instance["foo"] = value + return getBuilderAfterFoo(instance) + } + + fun foo(value: Double): T { + val instance = getInstance() + instance["foo"] = value + return getBuilderAfterFoo(instance) + } + } + + interface SetterForBar1 { + fun getInstance(): MutableMap + fun getBuilderAfterBar1(instance: MutableMap): T + + fun bar(value: Int): T { + val instance = getInstance() + instance["bar"] = value + return getBuilderAfterBar1(instance) + } + + fun bar(value: Float): T { + val instance = getInstance() + instance["bar"] = value + return getBuilderAfterBar1(instance) + } + + fun bar(value: Long): T { + val instance = getInstance() + instance["bar"] = value + return getBuilderAfterBar1(instance) + } + + fun bar(value: Double): T { + val instance = getInstance() + instance["bar"] = value + return getBuilderAfterBar1(instance) + } + } + + class BarMapBuilder1: UnsetAddPropsSetter, GenericBuilder>, SetterForFoo, SetterForBar1 { + private val knownKeys: Set = setOf( + "foo", + "bar" + ) + override fun getKnownKeys(): Set { + return knownKeys + } + private val instance: MutableMap + init { + this.instance = LinkedHashMap() + } + override fun build(): Map { + return instance + } + override fun getInstance(): MutableMap { + return instance + } + override fun getBuilderAfterFoo(instance: MutableMap): BarMapBuilder1 { + return this + } + override fun getBuilderAfterBar1(instance: MutableMap): BarMapBuilder1 { + return this + } + override fun getBuilderAfterAdditionalProperty(instance: MutableMap): BarMapBuilder1 { + return this + } + } + + + sealed interface BarBoxed { + fun getData(): Any? + } + + data class BarBoxedVoid(val data: Nothing?) : BarBoxed { + override fun getData(): Any? { + return data + } + } + + data class BarBoxedBoolean(val data: Boolean): BarBoxed { + override fun getData(): Any? { + return data + } + } + + data class BarBoxedNumber(val data: Number) : BarBoxed { + override fun getData(): Any? { + return data + } + } + + data class BarBoxedString(val data: String) : BarBoxed { + override fun getData(): Any? { + return data + } + } + + data class BarBoxedList(val data: FrozenList) : BarBoxed { + override fun getData(): Any? { + return data + } + } + + data class BarBoxedMap(val data: BarMap) : BarBoxed { + override fun getData(): Any? { + return data + } + } + + + class Bar private constructor(): JsonSchema( + JsonSchemaInfo() + .properties(mapOf( + "foo" to Foo::class.java, + "bar" to Bar1::class.java + )) + ), NullSchemaValidator, BooleanSchemaValidator, NumberSchemaValidator, StringSchemaValidator, ListSchemaValidator, BarBoxedList>, MapSchemaValidator { + + companion object { + @Volatile + private var instance: Bar? = null + + fun getInstance() = + instance ?: synchronized(this) { + instance ?: Bar().also { instance = it } + } + } + + @Throws(ValidationException::class) + override fun validate(arg: Nothing?, configuration: SchemaConfiguration?): Nothing? { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validatedPathToSchemas = PathToSchemasMap() + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, LinkedHashSet()) + getPathToSchemas(this, castArg, validationMetadata, pathSet) + return castArg + } + + @Throws(ValidationException::class) + override fun validate(arg: Boolean, configuration: SchemaConfiguration?): Boolean { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validatedPathToSchemas = PathToSchemasMap() + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, LinkedHashSet()) + getPathToSchemas(this, castArg, validationMetadata, pathSet) + return castArg + } + + @Throws(ValidationException::class) + override fun validate(arg: Number, configuration: SchemaConfiguration?): Number { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validatedPathToSchemas = PathToSchemasMap() + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, LinkedHashSet()) + getPathToSchemas(this, castArg, validationMetadata, pathSet) + return castArg + } + + @Throws(ValidationException::class) + fun validate(arg: Int, configuration: SchemaConfiguration?): Int { + return validate(arg as Number, configuration) as Int + } + + @Throws(ValidationException::class) + fun validate(arg: Long, configuration: SchemaConfiguration?): Long { + return validate(arg as Number, configuration) as Long + } + + @Throws(ValidationException::class) + fun validate(arg: Float, configuration: SchemaConfiguration?): Float { + return validate(arg as Number, configuration) as Float + } + + @Throws(ValidationException::class) + fun validate(arg: Double, configuration: SchemaConfiguration?): Double { + return validate(arg as Number, configuration) as Double + } + + @Throws(ValidationException::class) + override fun validate(arg: String, configuration: SchemaConfiguration?): String { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validatedPathToSchemas = PathToSchemasMap() + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, LinkedHashSet()) + getPathToSchemas(this, castArg, validationMetadata, pathSet) + return castArg + } + + @Throws(ValidationException::class) + fun validate(arg: LocalDate, configuration: SchemaConfiguration?): String { + return validate(arg.toString(), configuration) + } + + @Throws(ValidationException::class) + fun validate(arg: ZonedDateTime, configuration: SchemaConfiguration?): String { + return validate(arg.toString(), configuration) + } + + @Throws(ValidationException::class) + fun validate(arg: UUID, configuration: SchemaConfiguration?): String { + return validate(arg.toString(), configuration) + } + + override fun getNewInstance(arg: List<*>, pathToItem: List, pathToSchemas: PathToSchemasMap): FrozenList { + val items: MutableList = ArrayList() + var i: Int = 0 + for (item: Any? in arg) { + val itemPathToItem = pathToItem + i + val schemas: LinkedHashMap, Nothing?>? = pathToSchemas.get(itemPathToItem) + if (schemas == null) { + throw RuntimeException("Validation result is invalid, schemas must exist for a pathToItem") + } + val itemSchema: JsonSchema<*> = schemas.entries.iterator().next().key + val itemInstance: Any? = itemSchema.getNewInstance(item, itemPathToItem, pathToSchemas) + items.add(itemInstance) + i += 1 + } + val newInstanceItems: FrozenList = FrozenList(items) + return newInstanceItems + } + + @Throws(ValidationException::class) + override fun validate(arg: List<*>, configuration: SchemaConfiguration?): FrozenList { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, PathToSchemasMap(), LinkedHashSet()) + val pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet) + return getNewInstance(castArg, validationMetadata.pathToItem, pathToSchemasMap) + } + + override fun getNewInstance(arg: Map<*, *>, pathToItem: List, pathToSchemas: PathToSchemasMap): BarMap { + val properties: LinkedHashMap = LinkedHashMap() + for((propertyName, value) in arg) { + if (!(propertyName is String)) { + throw RuntimeException("Invalid non-string key value") + } + val propertyPathToItem: List = pathToItem + propertyName + val schemas: LinkedHashMap, Nothing?>? = pathToSchemas.get(propertyPathToItem) + if (schemas == null) { + throw RuntimeException("Validation result is invalid, schemas must exist for a pathToItem") + } + val propertySchema: JsonSchema<*> = schemas.entries.iterator().next().key + val propertyInstance: Any? = propertySchema.getNewInstance(value, propertyPathToItem, pathToSchemas) + properties[propertyName] = propertyInstance + } + val castProperties: FrozenMap = FrozenMap(properties) + return BarMap(castProperties) + } + + @Throws(ValidationException::class) + override fun validate(arg: Map<*, *>, configuration: SchemaConfiguration?): BarMap { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validatedPathToSchemas = PathToSchemasMap() + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, LinkedHashSet()) + val pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet) + return getNewInstance(castArg, validationMetadata.pathToItem, pathToSchemasMap) + } + + @Throws(ValidationException::class) + override fun validate(arg: Any?, configuration: SchemaConfiguration?): Any? { + if (arg == null) { + return validate(null, configuration) + } else if (arg is Boolean) { + return validate(arg, configuration) + } else if (arg is Number) { + return validate(arg, configuration) + } else if (arg is String) { + return validate(arg, configuration) + } else if (arg is List<*>) { + return validate(arg, configuration) + } else if (arg is Map<*, *>) { + return validate(arg, configuration) + } + throw ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema") + } + override fun getNewInstance(arg: Any?, pathToItem: List, pathToSchemas: PathToSchemasMap): Any? { + if (arg == null) { + return getNewInstance( null, pathToItem, pathToSchemas) + } else if (arg is Boolean) { + return getNewInstance(arg, pathToItem, pathToSchemas) + } else if (arg is Number) { + return getNewInstance(arg, pathToItem, pathToSchemas) + } else if (arg is String) { + return getNewInstance(arg, pathToItem, pathToSchemas) + } else if (arg is List<*>) { + return getNewInstance(arg, pathToItem, pathToSchemas) + } else if (arg is Map<*, *>) { + return getNewInstance(arg, pathToItem, pathToSchemas) + } + throw RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema") + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: Nothing?, configuration: SchemaConfiguration?): BarBoxedVoid { + return BarBoxedVoid(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: Boolean, configuration: SchemaConfiguration?): BarBoxedBoolean { + return BarBoxedBoolean(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: Number, configuration: SchemaConfiguration?): BarBoxedNumber { + return BarBoxedNumber(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: String, configuration: SchemaConfiguration?): BarBoxedString { + return BarBoxedString(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: List<*>, configuration: SchemaConfiguration?): BarBoxedList { + return BarBoxedList(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: Map<*, *>, configuration: SchemaConfiguration?): BarBoxedMap { + return BarBoxedMap(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: Any?, configuration: SchemaConfiguration?): BarBoxed { + if (arg == null) { + return validateAndBox(null, configuration) + } else if (arg is Boolean) { + return validateAndBox(arg, configuration) + } else if (arg is String) { + return validateAndBox(arg, configuration) + } else if (arg is Number) { + return validateAndBox(arg, configuration) + } else if (arg is List<*>) { + return validateAndBox(arg, configuration) + } else if (arg is Map<*, *>) { + return validateAndBox(arg, configuration) + } + throw ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema") + } + } + + sealed interface DependentSchemasSingleDependency1Boxed { + fun getData(): Any? + } + + data class DependentSchemasSingleDependency1BoxedVoid(val data: Nothing?) : DependentSchemasSingleDependency1Boxed { + override fun getData(): Any? { + return data + } + } + + data class DependentSchemasSingleDependency1BoxedBoolean(val data: Boolean): DependentSchemasSingleDependency1Boxed { + override fun getData(): Any? { + return data + } + } + + data class DependentSchemasSingleDependency1BoxedNumber(val data: Number) : DependentSchemasSingleDependency1Boxed { + override fun getData(): Any? { + return data + } + } + + data class DependentSchemasSingleDependency1BoxedString(val data: String) : DependentSchemasSingleDependency1Boxed { + override fun getData(): Any? { + return data + } + } + + data class DependentSchemasSingleDependency1BoxedList(val data: FrozenList) : DependentSchemasSingleDependency1Boxed { + override fun getData(): Any? { + return data + } + } + + data class DependentSchemasSingleDependency1BoxedMap(val data: FrozenMap) : DependentSchemasSingleDependency1Boxed { + override fun getData(): Any? { + return data + } + } + + + class DependentSchemasSingleDependency1 private constructor(): JsonSchema( + JsonSchemaInfo() + .dependentSchemas(mapOf( + new PropertyEntry("bar", Bar::class.java) + )) + ), NullSchemaValidator, BooleanSchemaValidator, NumberSchemaValidator, StringSchemaValidator, ListSchemaValidator, DependentSchemasSingleDependency1BoxedList>, MapSchemaValidator, DependentSchemasSingleDependency1BoxedMap> { + /* + NOTE: This class is auto generated by OpenAPI JSON Schema Generator. + Ref: https://github.com/openapi-json-schema-tools/openapi-json-schema-generator + + Do not edit the class manually. + */ + + companion object { + @Volatile + private var instance: DependentSchemasSingleDependency1? = null + + fun getInstance() = + instance ?: synchronized(this) { + instance ?: DependentSchemasSingleDependency1().also { instance = it } + } + } + + @Throws(ValidationException::class) + override fun validate(arg: Nothing?, configuration: SchemaConfiguration?): Nothing? { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validatedPathToSchemas = PathToSchemasMap() + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, LinkedHashSet()) + getPathToSchemas(this, castArg, validationMetadata, pathSet) + return castArg + } + + @Throws(ValidationException::class) + override fun validate(arg: Boolean, configuration: SchemaConfiguration?): Boolean { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validatedPathToSchemas = PathToSchemasMap() + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, LinkedHashSet()) + getPathToSchemas(this, castArg, validationMetadata, pathSet) + return castArg + } + + @Throws(ValidationException::class) + override fun validate(arg: Number, configuration: SchemaConfiguration?): Number { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validatedPathToSchemas = PathToSchemasMap() + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, LinkedHashSet()) + getPathToSchemas(this, castArg, validationMetadata, pathSet) + return castArg + } + + @Throws(ValidationException::class) + fun validate(arg: Int, configuration: SchemaConfiguration?): Int { + return validate(arg as Number, configuration) as Int + } + + @Throws(ValidationException::class) + fun validate(arg: Long, configuration: SchemaConfiguration?): Long { + return validate(arg as Number, configuration) as Long + } + + @Throws(ValidationException::class) + fun validate(arg: Float, configuration: SchemaConfiguration?): Float { + return validate(arg as Number, configuration) as Float + } + + @Throws(ValidationException::class) + fun validate(arg: Double, configuration: SchemaConfiguration?): Double { + return validate(arg as Number, configuration) as Double + } + + @Throws(ValidationException::class) + override fun validate(arg: String, configuration: SchemaConfiguration?): String { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validatedPathToSchemas = PathToSchemasMap() + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, LinkedHashSet()) + getPathToSchemas(this, castArg, validationMetadata, pathSet) + return castArg + } + + @Throws(ValidationException::class) + fun validate(arg: LocalDate, configuration: SchemaConfiguration?): String { + return validate(arg.toString(), configuration) + } + + @Throws(ValidationException::class) + fun validate(arg: ZonedDateTime, configuration: SchemaConfiguration?): String { + return validate(arg.toString(), configuration) + } + + @Throws(ValidationException::class) + fun validate(arg: UUID, configuration: SchemaConfiguration?): String { + return validate(arg.toString(), configuration) + } + + override fun getNewInstance(arg: List<*>, pathToItem: List, pathToSchemas: PathToSchemasMap): FrozenList { + val items: MutableList = ArrayList() + var i: Int = 0 + for (item: Any? in arg) { + val itemPathToItem = pathToItem + i + val schemas: LinkedHashMap, Nothing?>? = pathToSchemas.get(itemPathToItem) + if (schemas == null) { + throw RuntimeException("Validation result is invalid, schemas must exist for a pathToItem") + } + val itemSchema: JsonSchema<*> = schemas.entries.iterator().next().key + val itemInstance: Any? = itemSchema.getNewInstance(item, itemPathToItem, pathToSchemas) + items.add(itemInstance) + i += 1 + } + val newInstanceItems: FrozenList = FrozenList(items) + return newInstanceItems + } + + @Throws(ValidationException::class) + override fun validate(arg: List<*>, configuration: SchemaConfiguration?): FrozenList { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, PathToSchemasMap(), LinkedHashSet()) + val pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet) + return getNewInstance(castArg, validationMetadata.pathToItem, pathToSchemasMap) + } + + override fun getNewInstance(arg: Map<*, *>, pathToItem: List, pathToSchemas: PathToSchemasMap): FrozenMap { + val properties: LinkedHashMap = LinkedHashMap() + for((propertyName, value) in arg) { + if (!(propertyName is String)) { + throw RuntimeException("Invalid non-string key value") + } + val propertyPathToItem: List = pathToItem + propertyName + val schemas: LinkedHashMap, Nothing?>? = pathToSchemas.get(propertyPathToItem) + if (schemas == null) { + throw RuntimeException("Validation result is invalid, schemas must exist for a pathToItem") + } + val propertySchema: JsonSchema<*> = schemas.entries.iterator().next().key + val propertyInstance: Any? = propertySchema.getNewInstance(value, propertyPathToItem, pathToSchemas) + properties[propertyName] = propertyInstance + } + val castProperties: FrozenMap = FrozenMap(properties) + return castProperties + } + + @Throws(ValidationException::class) + override fun validate(arg: Map<*, *>, configuration: SchemaConfiguration?): FrozenMap { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validatedPathToSchemas = PathToSchemasMap() + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, LinkedHashSet()) + val pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet) + return getNewInstance(castArg, validationMetadata.pathToItem, pathToSchemasMap) + } + + @Throws(ValidationException::class) + override fun validate(arg: Any?, configuration: SchemaConfiguration?): Any? { + if (arg == null) { + return validate(null, configuration) + } else if (arg is Boolean) { + return validate(arg, configuration) + } else if (arg is Number) { + return validate(arg, configuration) + } else if (arg is String) { + return validate(arg, configuration) + } else if (arg is List<*>) { + return validate(arg, configuration) + } else if (arg is Map<*, *>) { + return validate(arg, configuration) + } + throw ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema") + } + override fun getNewInstance(arg: Any?, pathToItem: List, pathToSchemas: PathToSchemasMap): Any? { + if (arg == null) { + return getNewInstance( null, pathToItem, pathToSchemas) + } else if (arg is Boolean) { + return getNewInstance(arg, pathToItem, pathToSchemas) + } else if (arg is Number) { + return getNewInstance(arg, pathToItem, pathToSchemas) + } else if (arg is String) { + return getNewInstance(arg, pathToItem, pathToSchemas) + } else if (arg is List<*>) { + return getNewInstance(arg, pathToItem, pathToSchemas) + } else if (arg is Map<*, *>) { + return getNewInstance(arg, pathToItem, pathToSchemas) + } + throw RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema") + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: Nothing?, configuration: SchemaConfiguration?): DependentSchemasSingleDependency1BoxedVoid { + return DependentSchemasSingleDependency1BoxedVoid(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: Boolean, configuration: SchemaConfiguration?): DependentSchemasSingleDependency1BoxedBoolean { + return DependentSchemasSingleDependency1BoxedBoolean(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: Number, configuration: SchemaConfiguration?): DependentSchemasSingleDependency1BoxedNumber { + return DependentSchemasSingleDependency1BoxedNumber(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: String, configuration: SchemaConfiguration?): DependentSchemasSingleDependency1BoxedString { + return DependentSchemasSingleDependency1BoxedString(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: List<*>, configuration: SchemaConfiguration?): DependentSchemasSingleDependency1BoxedList { + return DependentSchemasSingleDependency1BoxedList(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: Map<*, *>, configuration: SchemaConfiguration?): DependentSchemasSingleDependency1BoxedMap { + return DependentSchemasSingleDependency1BoxedMap(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: Any?, configuration: SchemaConfiguration?): DependentSchemasSingleDependency1Boxed { + if (arg == null) { + return validateAndBox(null, configuration) + } else if (arg is Boolean) { + return validateAndBox(arg, configuration) + } else if (arg is String) { + return validateAndBox(arg, configuration) + } else if (arg is Number) { + return validateAndBox(arg, configuration) + } else if (arg is List<*>) { + return validateAndBox(arg, configuration) + } else if (arg is Map<*, *>) { + return validateAndBox(arg, configuration) + } + throw ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema") + } + } +} diff --git a/samples/client/3_1_0_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/schemas/DurationFormat.kt b/samples/client/3_1_0_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/schemas/DurationFormat.kt new file mode 100644 index 00000000000..d08dbc639e5 --- /dev/null +++ b/samples/client/3_1_0_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/schemas/DurationFormat.kt @@ -0,0 +1,308 @@ +package org.openapijsonschematools.client.components.schemas +import java.time.LocalDate +import java.time.ZonedDateTime +import java.util.UUID +import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags +import org.openapijsonschematools.client.configurations.SchemaConfiguration +import org.openapijsonschematools.client.exceptions.InvalidAdditionalPropertyException +import org.openapijsonschematools.client.exceptions.UnsetPropertyException +import org.openapijsonschematools.client.exceptions.ValidationException +import org.openapijsonschematools.client.schemas.UnsetAddPropsSetter +import org.openapijsonschematools.client.schemas.validation.BooleanSchemaValidator +import org.openapijsonschematools.client.schemas.validation.FrozenList +import org.openapijsonschematools.client.schemas.validation.FrozenMap +import org.openapijsonschematools.client.schemas.validation.JsonSchema +import org.openapijsonschematools.client.schemas.validation.JsonSchemaInfo +import org.openapijsonschematools.client.schemas.validation.ListSchemaValidator +import org.openapijsonschematools.client.schemas.validation.MapSchemaValidator +import org.openapijsonschematools.client.schemas.validation.NullSchemaValidator +import org.openapijsonschematools.client.schemas.validation.NumberSchemaValidator +import org.openapijsonschematools.client.schemas.validation.PathToSchemasMap +import org.openapijsonschematools.client.schemas.validation.StringSchemaValidator +import org.openapijsonschematools.client.schemas.validation.ValidationMetadata + +class DurationFormat { + // nest classes so all schemas and input/output classes can be public + + + sealed interface DurationFormat1Boxed { + fun getData(): Any? + } + + data class DurationFormat1BoxedVoid(val data: Nothing?) : DurationFormat1Boxed { + override fun getData(): Any? { + return data + } + } + + data class DurationFormat1BoxedBoolean(val data: Boolean): DurationFormat1Boxed { + override fun getData(): Any? { + return data + } + } + + data class DurationFormat1BoxedNumber(val data: Number) : DurationFormat1Boxed { + override fun getData(): Any? { + return data + } + } + + data class DurationFormat1BoxedString(val data: String) : DurationFormat1Boxed { + override fun getData(): Any? { + return data + } + } + + data class DurationFormat1BoxedList(val data: FrozenList) : DurationFormat1Boxed { + override fun getData(): Any? { + return data + } + } + + data class DurationFormat1BoxedMap(val data: FrozenMap) : DurationFormat1Boxed { + override fun getData(): Any? { + return data + } + } + + + class DurationFormat1 private constructor(): JsonSchema( + JsonSchemaInfo() + .format("duration") + ), NullSchemaValidator, BooleanSchemaValidator, NumberSchemaValidator, StringSchemaValidator, ListSchemaValidator, DurationFormat1BoxedList>, MapSchemaValidator, DurationFormat1BoxedMap> { + /* + NOTE: This class is auto generated by OpenAPI JSON Schema Generator. + Ref: https://github.com/openapi-json-schema-tools/openapi-json-schema-generator + + Do not edit the class manually. + */ + + companion object { + @Volatile + private var instance: DurationFormat1? = null + + fun getInstance() = + instance ?: synchronized(this) { + instance ?: DurationFormat1().also { instance = it } + } + } + + @Throws(ValidationException::class) + override fun validate(arg: Nothing?, configuration: SchemaConfiguration?): Nothing? { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validatedPathToSchemas = PathToSchemasMap() + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, LinkedHashSet()) + getPathToSchemas(this, castArg, validationMetadata, pathSet) + return castArg + } + + @Throws(ValidationException::class) + override fun validate(arg: Boolean, configuration: SchemaConfiguration?): Boolean { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validatedPathToSchemas = PathToSchemasMap() + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, LinkedHashSet()) + getPathToSchemas(this, castArg, validationMetadata, pathSet) + return castArg + } + + @Throws(ValidationException::class) + override fun validate(arg: Number, configuration: SchemaConfiguration?): Number { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validatedPathToSchemas = PathToSchemasMap() + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, LinkedHashSet()) + getPathToSchemas(this, castArg, validationMetadata, pathSet) + return castArg + } + + @Throws(ValidationException::class) + fun validate(arg: Int, configuration: SchemaConfiguration?): Int { + return validate(arg as Number, configuration) as Int + } + + @Throws(ValidationException::class) + fun validate(arg: Long, configuration: SchemaConfiguration?): Long { + return validate(arg as Number, configuration) as Long + } + + @Throws(ValidationException::class) + fun validate(arg: Float, configuration: SchemaConfiguration?): Float { + return validate(arg as Number, configuration) as Float + } + + @Throws(ValidationException::class) + fun validate(arg: Double, configuration: SchemaConfiguration?): Double { + return validate(arg as Number, configuration) as Double + } + + @Throws(ValidationException::class) + override fun validate(arg: String, configuration: SchemaConfiguration?): String { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validatedPathToSchemas = PathToSchemasMap() + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, LinkedHashSet()) + getPathToSchemas(this, castArg, validationMetadata, pathSet) + return castArg + } + + @Throws(ValidationException::class) + fun validate(arg: LocalDate, configuration: SchemaConfiguration?): String { + return validate(arg.toString(), configuration) + } + + @Throws(ValidationException::class) + fun validate(arg: ZonedDateTime, configuration: SchemaConfiguration?): String { + return validate(arg.toString(), configuration) + } + + @Throws(ValidationException::class) + fun validate(arg: UUID, configuration: SchemaConfiguration?): String { + return validate(arg.toString(), configuration) + } + + override fun getNewInstance(arg: List<*>, pathToItem: List, pathToSchemas: PathToSchemasMap): FrozenList { + val items: MutableList = ArrayList() + var i: Int = 0 + for (item: Any? in arg) { + val itemPathToItem = pathToItem + i + val schemas: LinkedHashMap, Nothing?>? = pathToSchemas.get(itemPathToItem) + if (schemas == null) { + throw RuntimeException("Validation result is invalid, schemas must exist for a pathToItem") + } + val itemSchema: JsonSchema<*> = schemas.entries.iterator().next().key + val itemInstance: Any? = itemSchema.getNewInstance(item, itemPathToItem, pathToSchemas) + items.add(itemInstance) + i += 1 + } + val newInstanceItems: FrozenList = FrozenList(items) + return newInstanceItems + } + + @Throws(ValidationException::class) + override fun validate(arg: List<*>, configuration: SchemaConfiguration?): FrozenList { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, PathToSchemasMap(), LinkedHashSet()) + val pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet) + return getNewInstance(castArg, validationMetadata.pathToItem, pathToSchemasMap) + } + + override fun getNewInstance(arg: Map<*, *>, pathToItem: List, pathToSchemas: PathToSchemasMap): FrozenMap { + val properties: LinkedHashMap = LinkedHashMap() + for((propertyName, value) in arg) { + if (!(propertyName is String)) { + throw RuntimeException("Invalid non-string key value") + } + val propertyPathToItem: List = pathToItem + propertyName + val schemas: LinkedHashMap, Nothing?>? = pathToSchemas.get(propertyPathToItem) + if (schemas == null) { + throw RuntimeException("Validation result is invalid, schemas must exist for a pathToItem") + } + val propertySchema: JsonSchema<*> = schemas.entries.iterator().next().key + val propertyInstance: Any? = propertySchema.getNewInstance(value, propertyPathToItem, pathToSchemas) + properties[propertyName] = propertyInstance + } + val castProperties: FrozenMap = FrozenMap(properties) + return castProperties + } + + @Throws(ValidationException::class) + override fun validate(arg: Map<*, *>, configuration: SchemaConfiguration?): FrozenMap { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validatedPathToSchemas = PathToSchemasMap() + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, LinkedHashSet()) + val pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet) + return getNewInstance(castArg, validationMetadata.pathToItem, pathToSchemasMap) + } + + @Throws(ValidationException::class) + override fun validate(arg: Any?, configuration: SchemaConfiguration?): Any? { + if (arg == null) { + return validate(null, configuration) + } else if (arg is Boolean) { + return validate(arg, configuration) + } else if (arg is Number) { + return validate(arg, configuration) + } else if (arg is String) { + return validate(arg, configuration) + } else if (arg is List<*>) { + return validate(arg, configuration) + } else if (arg is Map<*, *>) { + return validate(arg, configuration) + } + throw ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema") + } + override fun getNewInstance(arg: Any?, pathToItem: List, pathToSchemas: PathToSchemasMap): Any? { + if (arg == null) { + return getNewInstance( null, pathToItem, pathToSchemas) + } else if (arg is Boolean) { + return getNewInstance(arg, pathToItem, pathToSchemas) + } else if (arg is Number) { + return getNewInstance(arg, pathToItem, pathToSchemas) + } else if (arg is String) { + return getNewInstance(arg, pathToItem, pathToSchemas) + } else if (arg is List<*>) { + return getNewInstance(arg, pathToItem, pathToSchemas) + } else if (arg is Map<*, *>) { + return getNewInstance(arg, pathToItem, pathToSchemas) + } + throw RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema") + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: Nothing?, configuration: SchemaConfiguration?): DurationFormat1BoxedVoid { + return DurationFormat1BoxedVoid(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: Boolean, configuration: SchemaConfiguration?): DurationFormat1BoxedBoolean { + return DurationFormat1BoxedBoolean(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: Number, configuration: SchemaConfiguration?): DurationFormat1BoxedNumber { + return DurationFormat1BoxedNumber(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: String, configuration: SchemaConfiguration?): DurationFormat1BoxedString { + return DurationFormat1BoxedString(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: List<*>, configuration: SchemaConfiguration?): DurationFormat1BoxedList { + return DurationFormat1BoxedList(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: Map<*, *>, configuration: SchemaConfiguration?): DurationFormat1BoxedMap { + return DurationFormat1BoxedMap(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: Any?, configuration: SchemaConfiguration?): DurationFormat1Boxed { + if (arg == null) { + return validateAndBox(null, configuration) + } else if (arg is Boolean) { + return validateAndBox(arg, configuration) + } else if (arg is String) { + return validateAndBox(arg, configuration) + } else if (arg is Number) { + return validateAndBox(arg, configuration) + } else if (arg is List<*>) { + return validateAndBox(arg, configuration) + } else if (arg is Map<*, *>) { + return validateAndBox(arg, configuration) + } + throw ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema") + } + } +} diff --git a/samples/client/3_1_0_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/schemas/EmailFormat.kt b/samples/client/3_1_0_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/schemas/EmailFormat.kt new file mode 100644 index 00000000000..ed88a6dc0c5 --- /dev/null +++ b/samples/client/3_1_0_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/schemas/EmailFormat.kt @@ -0,0 +1,308 @@ +package org.openapijsonschematools.client.components.schemas +import java.time.LocalDate +import java.time.ZonedDateTime +import java.util.UUID +import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags +import org.openapijsonschematools.client.configurations.SchemaConfiguration +import org.openapijsonschematools.client.exceptions.InvalidAdditionalPropertyException +import org.openapijsonschematools.client.exceptions.UnsetPropertyException +import org.openapijsonschematools.client.exceptions.ValidationException +import org.openapijsonschematools.client.schemas.UnsetAddPropsSetter +import org.openapijsonschematools.client.schemas.validation.BooleanSchemaValidator +import org.openapijsonschematools.client.schemas.validation.FrozenList +import org.openapijsonschematools.client.schemas.validation.FrozenMap +import org.openapijsonschematools.client.schemas.validation.JsonSchema +import org.openapijsonschematools.client.schemas.validation.JsonSchemaInfo +import org.openapijsonschematools.client.schemas.validation.ListSchemaValidator +import org.openapijsonschematools.client.schemas.validation.MapSchemaValidator +import org.openapijsonschematools.client.schemas.validation.NullSchemaValidator +import org.openapijsonschematools.client.schemas.validation.NumberSchemaValidator +import org.openapijsonschematools.client.schemas.validation.PathToSchemasMap +import org.openapijsonschematools.client.schemas.validation.StringSchemaValidator +import org.openapijsonschematools.client.schemas.validation.ValidationMetadata + +class EmailFormat { + // nest classes so all schemas and input/output classes can be public + + + sealed interface EmailFormat1Boxed { + fun getData(): Any? + } + + data class EmailFormat1BoxedVoid(val data: Nothing?) : EmailFormat1Boxed { + override fun getData(): Any? { + return data + } + } + + data class EmailFormat1BoxedBoolean(val data: Boolean): EmailFormat1Boxed { + override fun getData(): Any? { + return data + } + } + + data class EmailFormat1BoxedNumber(val data: Number) : EmailFormat1Boxed { + override fun getData(): Any? { + return data + } + } + + data class EmailFormat1BoxedString(val data: String) : EmailFormat1Boxed { + override fun getData(): Any? { + return data + } + } + + data class EmailFormat1BoxedList(val data: FrozenList) : EmailFormat1Boxed { + override fun getData(): Any? { + return data + } + } + + data class EmailFormat1BoxedMap(val data: FrozenMap) : EmailFormat1Boxed { + override fun getData(): Any? { + return data + } + } + + + class EmailFormat1 private constructor(): JsonSchema( + JsonSchemaInfo() + .format("email") + ), NullSchemaValidator, BooleanSchemaValidator, NumberSchemaValidator, StringSchemaValidator, ListSchemaValidator, EmailFormat1BoxedList>, MapSchemaValidator, EmailFormat1BoxedMap> { + /* + NOTE: This class is auto generated by OpenAPI JSON Schema Generator. + Ref: https://github.com/openapi-json-schema-tools/openapi-json-schema-generator + + Do not edit the class manually. + */ + + companion object { + @Volatile + private var instance: EmailFormat1? = null + + fun getInstance() = + instance ?: synchronized(this) { + instance ?: EmailFormat1().also { instance = it } + } + } + + @Throws(ValidationException::class) + override fun validate(arg: Nothing?, configuration: SchemaConfiguration?): Nothing? { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validatedPathToSchemas = PathToSchemasMap() + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, LinkedHashSet()) + getPathToSchemas(this, castArg, validationMetadata, pathSet) + return castArg + } + + @Throws(ValidationException::class) + override fun validate(arg: Boolean, configuration: SchemaConfiguration?): Boolean { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validatedPathToSchemas = PathToSchemasMap() + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, LinkedHashSet()) + getPathToSchemas(this, castArg, validationMetadata, pathSet) + return castArg + } + + @Throws(ValidationException::class) + override fun validate(arg: Number, configuration: SchemaConfiguration?): Number { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validatedPathToSchemas = PathToSchemasMap() + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, LinkedHashSet()) + getPathToSchemas(this, castArg, validationMetadata, pathSet) + return castArg + } + + @Throws(ValidationException::class) + fun validate(arg: Int, configuration: SchemaConfiguration?): Int { + return validate(arg as Number, configuration) as Int + } + + @Throws(ValidationException::class) + fun validate(arg: Long, configuration: SchemaConfiguration?): Long { + return validate(arg as Number, configuration) as Long + } + + @Throws(ValidationException::class) + fun validate(arg: Float, configuration: SchemaConfiguration?): Float { + return validate(arg as Number, configuration) as Float + } + + @Throws(ValidationException::class) + fun validate(arg: Double, configuration: SchemaConfiguration?): Double { + return validate(arg as Number, configuration) as Double + } + + @Throws(ValidationException::class) + override fun validate(arg: String, configuration: SchemaConfiguration?): String { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validatedPathToSchemas = PathToSchemasMap() + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, LinkedHashSet()) + getPathToSchemas(this, castArg, validationMetadata, pathSet) + return castArg + } + + @Throws(ValidationException::class) + fun validate(arg: LocalDate, configuration: SchemaConfiguration?): String { + return validate(arg.toString(), configuration) + } + + @Throws(ValidationException::class) + fun validate(arg: ZonedDateTime, configuration: SchemaConfiguration?): String { + return validate(arg.toString(), configuration) + } + + @Throws(ValidationException::class) + fun validate(arg: UUID, configuration: SchemaConfiguration?): String { + return validate(arg.toString(), configuration) + } + + override fun getNewInstance(arg: List<*>, pathToItem: List, pathToSchemas: PathToSchemasMap): FrozenList { + val items: MutableList = ArrayList() + var i: Int = 0 + for (item: Any? in arg) { + val itemPathToItem = pathToItem + i + val schemas: LinkedHashMap, Nothing?>? = pathToSchemas.get(itemPathToItem) + if (schemas == null) { + throw RuntimeException("Validation result is invalid, schemas must exist for a pathToItem") + } + val itemSchema: JsonSchema<*> = schemas.entries.iterator().next().key + val itemInstance: Any? = itemSchema.getNewInstance(item, itemPathToItem, pathToSchemas) + items.add(itemInstance) + i += 1 + } + val newInstanceItems: FrozenList = FrozenList(items) + return newInstanceItems + } + + @Throws(ValidationException::class) + override fun validate(arg: List<*>, configuration: SchemaConfiguration?): FrozenList { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, PathToSchemasMap(), LinkedHashSet()) + val pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet) + return getNewInstance(castArg, validationMetadata.pathToItem, pathToSchemasMap) + } + + override fun getNewInstance(arg: Map<*, *>, pathToItem: List, pathToSchemas: PathToSchemasMap): FrozenMap { + val properties: LinkedHashMap = LinkedHashMap() + for((propertyName, value) in arg) { + if (!(propertyName is String)) { + throw RuntimeException("Invalid non-string key value") + } + val propertyPathToItem: List = pathToItem + propertyName + val schemas: LinkedHashMap, Nothing?>? = pathToSchemas.get(propertyPathToItem) + if (schemas == null) { + throw RuntimeException("Validation result is invalid, schemas must exist for a pathToItem") + } + val propertySchema: JsonSchema<*> = schemas.entries.iterator().next().key + val propertyInstance: Any? = propertySchema.getNewInstance(value, propertyPathToItem, pathToSchemas) + properties[propertyName] = propertyInstance + } + val castProperties: FrozenMap = FrozenMap(properties) + return castProperties + } + + @Throws(ValidationException::class) + override fun validate(arg: Map<*, *>, configuration: SchemaConfiguration?): FrozenMap { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validatedPathToSchemas = PathToSchemasMap() + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, LinkedHashSet()) + val pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet) + return getNewInstance(castArg, validationMetadata.pathToItem, pathToSchemasMap) + } + + @Throws(ValidationException::class) + override fun validate(arg: Any?, configuration: SchemaConfiguration?): Any? { + if (arg == null) { + return validate(null, configuration) + } else if (arg is Boolean) { + return validate(arg, configuration) + } else if (arg is Number) { + return validate(arg, configuration) + } else if (arg is String) { + return validate(arg, configuration) + } else if (arg is List<*>) { + return validate(arg, configuration) + } else if (arg is Map<*, *>) { + return validate(arg, configuration) + } + throw ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema") + } + override fun getNewInstance(arg: Any?, pathToItem: List, pathToSchemas: PathToSchemasMap): Any? { + if (arg == null) { + return getNewInstance( null, pathToItem, pathToSchemas) + } else if (arg is Boolean) { + return getNewInstance(arg, pathToItem, pathToSchemas) + } else if (arg is Number) { + return getNewInstance(arg, pathToItem, pathToSchemas) + } else if (arg is String) { + return getNewInstance(arg, pathToItem, pathToSchemas) + } else if (arg is List<*>) { + return getNewInstance(arg, pathToItem, pathToSchemas) + } else if (arg is Map<*, *>) { + return getNewInstance(arg, pathToItem, pathToSchemas) + } + throw RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema") + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: Nothing?, configuration: SchemaConfiguration?): EmailFormat1BoxedVoid { + return EmailFormat1BoxedVoid(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: Boolean, configuration: SchemaConfiguration?): EmailFormat1BoxedBoolean { + return EmailFormat1BoxedBoolean(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: Number, configuration: SchemaConfiguration?): EmailFormat1BoxedNumber { + return EmailFormat1BoxedNumber(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: String, configuration: SchemaConfiguration?): EmailFormat1BoxedString { + return EmailFormat1BoxedString(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: List<*>, configuration: SchemaConfiguration?): EmailFormat1BoxedList { + return EmailFormat1BoxedList(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: Map<*, *>, configuration: SchemaConfiguration?): EmailFormat1BoxedMap { + return EmailFormat1BoxedMap(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: Any?, configuration: SchemaConfiguration?): EmailFormat1Boxed { + if (arg == null) { + return validateAndBox(null, configuration) + } else if (arg is Boolean) { + return validateAndBox(arg, configuration) + } else if (arg is String) { + return validateAndBox(arg, configuration) + } else if (arg is Number) { + return validateAndBox(arg, configuration) + } else if (arg is List<*>) { + return validateAndBox(arg, configuration) + } else if (arg is Map<*, *>) { + return validateAndBox(arg, configuration) + } + throw ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema") + } + } +} diff --git a/samples/client/3_1_0_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/schemas/EmptyDependents.kt b/samples/client/3_1_0_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/schemas/EmptyDependents.kt new file mode 100644 index 00000000000..d0952e4931f --- /dev/null +++ b/samples/client/3_1_0_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/schemas/EmptyDependents.kt @@ -0,0 +1,316 @@ +package org.openapijsonschematools.client.components.schemas +import java.time.LocalDate +import java.time.ZonedDateTime +import java.util.AbstractMap +import java.util.UUID +import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags +import org.openapijsonschematools.client.configurations.SchemaConfiguration +import org.openapijsonschematools.client.exceptions.InvalidAdditionalPropertyException +import org.openapijsonschematools.client.exceptions.UnsetPropertyException +import org.openapijsonschematools.client.exceptions.ValidationException +import org.openapijsonschematools.client.schemas.UnsetAddPropsSetter +import org.openapijsonschematools.client.schemas.validation.BooleanSchemaValidator +import org.openapijsonschematools.client.schemas.validation.FrozenList +import org.openapijsonschematools.client.schemas.validation.FrozenMap +import org.openapijsonschematools.client.schemas.validation.JsonSchema +import org.openapijsonschematools.client.schemas.validation.JsonSchemaInfo +import org.openapijsonschematools.client.schemas.validation.ListSchemaValidator +import org.openapijsonschematools.client.schemas.validation.MapSchemaValidator +import org.openapijsonschematools.client.schemas.validation.MapUtils +import org.openapijsonschematools.client.schemas.validation.NullSchemaValidator +import org.openapijsonschematools.client.schemas.validation.NumberSchemaValidator +import org.openapijsonschematools.client.schemas.validation.PathToSchemasMap +import org.openapijsonschematools.client.schemas.validation.StringSchemaValidator +import org.openapijsonschematools.client.schemas.validation.ValidationMetadata + +class EmptyDependents { + // nest classes so all schemas and input/output classes can be public + + + sealed interface EmptyDependents1Boxed { + fun getData(): Any? + } + + data class EmptyDependents1BoxedVoid(val data: Nothing?) : EmptyDependents1Boxed { + override fun getData(): Any? { + return data + } + } + + data class EmptyDependents1BoxedBoolean(val data: Boolean): EmptyDependents1Boxed { + override fun getData(): Any? { + return data + } + } + + data class EmptyDependents1BoxedNumber(val data: Number) : EmptyDependents1Boxed { + override fun getData(): Any? { + return data + } + } + + data class EmptyDependents1BoxedString(val data: String) : EmptyDependents1Boxed { + override fun getData(): Any? { + return data + } + } + + data class EmptyDependents1BoxedList(val data: FrozenList) : EmptyDependents1Boxed { + override fun getData(): Any? { + return data + } + } + + data class EmptyDependents1BoxedMap(val data: FrozenMap) : EmptyDependents1Boxed { + override fun getData(): Any? { + return data + } + } + + + class EmptyDependents1 private constructor(): JsonSchema( + JsonSchemaInfo() + .dependentRequired(MapUtils.makeMap( + new AbstractMap.SimpleEntry<>( + "bar", + setOf( + ) + ) + )) + ), NullSchemaValidator, BooleanSchemaValidator, NumberSchemaValidator, StringSchemaValidator, ListSchemaValidator, EmptyDependents1BoxedList>, MapSchemaValidator, EmptyDependents1BoxedMap> { + /* + NOTE: This class is auto generated by OpenAPI JSON Schema Generator. + Ref: https://github.com/openapi-json-schema-tools/openapi-json-schema-generator + + Do not edit the class manually. + */ + + companion object { + @Volatile + private var instance: EmptyDependents1? = null + + fun getInstance() = + instance ?: synchronized(this) { + instance ?: EmptyDependents1().also { instance = it } + } + } + + @Throws(ValidationException::class) + override fun validate(arg: Nothing?, configuration: SchemaConfiguration?): Nothing? { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validatedPathToSchemas = PathToSchemasMap() + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, LinkedHashSet()) + getPathToSchemas(this, castArg, validationMetadata, pathSet) + return castArg + } + + @Throws(ValidationException::class) + override fun validate(arg: Boolean, configuration: SchemaConfiguration?): Boolean { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validatedPathToSchemas = PathToSchemasMap() + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, LinkedHashSet()) + getPathToSchemas(this, castArg, validationMetadata, pathSet) + return castArg + } + + @Throws(ValidationException::class) + override fun validate(arg: Number, configuration: SchemaConfiguration?): Number { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validatedPathToSchemas = PathToSchemasMap() + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, LinkedHashSet()) + getPathToSchemas(this, castArg, validationMetadata, pathSet) + return castArg + } + + @Throws(ValidationException::class) + fun validate(arg: Int, configuration: SchemaConfiguration?): Int { + return validate(arg as Number, configuration) as Int + } + + @Throws(ValidationException::class) + fun validate(arg: Long, configuration: SchemaConfiguration?): Long { + return validate(arg as Number, configuration) as Long + } + + @Throws(ValidationException::class) + fun validate(arg: Float, configuration: SchemaConfiguration?): Float { + return validate(arg as Number, configuration) as Float + } + + @Throws(ValidationException::class) + fun validate(arg: Double, configuration: SchemaConfiguration?): Double { + return validate(arg as Number, configuration) as Double + } + + @Throws(ValidationException::class) + override fun validate(arg: String, configuration: SchemaConfiguration?): String { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validatedPathToSchemas = PathToSchemasMap() + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, LinkedHashSet()) + getPathToSchemas(this, castArg, validationMetadata, pathSet) + return castArg + } + + @Throws(ValidationException::class) + fun validate(arg: LocalDate, configuration: SchemaConfiguration?): String { + return validate(arg.toString(), configuration) + } + + @Throws(ValidationException::class) + fun validate(arg: ZonedDateTime, configuration: SchemaConfiguration?): String { + return validate(arg.toString(), configuration) + } + + @Throws(ValidationException::class) + fun validate(arg: UUID, configuration: SchemaConfiguration?): String { + return validate(arg.toString(), configuration) + } + + override fun getNewInstance(arg: List<*>, pathToItem: List, pathToSchemas: PathToSchemasMap): FrozenList { + val items: MutableList = ArrayList() + var i: Int = 0 + for (item: Any? in arg) { + val itemPathToItem = pathToItem + i + val schemas: LinkedHashMap, Nothing?>? = pathToSchemas.get(itemPathToItem) + if (schemas == null) { + throw RuntimeException("Validation result is invalid, schemas must exist for a pathToItem") + } + val itemSchema: JsonSchema<*> = schemas.entries.iterator().next().key + val itemInstance: Any? = itemSchema.getNewInstance(item, itemPathToItem, pathToSchemas) + items.add(itemInstance) + i += 1 + } + val newInstanceItems: FrozenList = FrozenList(items) + return newInstanceItems + } + + @Throws(ValidationException::class) + override fun validate(arg: List<*>, configuration: SchemaConfiguration?): FrozenList { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, PathToSchemasMap(), LinkedHashSet()) + val pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet) + return getNewInstance(castArg, validationMetadata.pathToItem, pathToSchemasMap) + } + + override fun getNewInstance(arg: Map<*, *>, pathToItem: List, pathToSchemas: PathToSchemasMap): FrozenMap { + val properties: LinkedHashMap = LinkedHashMap() + for((propertyName, value) in arg) { + if (!(propertyName is String)) { + throw RuntimeException("Invalid non-string key value") + } + val propertyPathToItem: List = pathToItem + propertyName + val schemas: LinkedHashMap, Nothing?>? = pathToSchemas.get(propertyPathToItem) + if (schemas == null) { + throw RuntimeException("Validation result is invalid, schemas must exist for a pathToItem") + } + val propertySchema: JsonSchema<*> = schemas.entries.iterator().next().key + val propertyInstance: Any? = propertySchema.getNewInstance(value, propertyPathToItem, pathToSchemas) + properties[propertyName] = propertyInstance + } + val castProperties: FrozenMap = FrozenMap(properties) + return castProperties + } + + @Throws(ValidationException::class) + override fun validate(arg: Map<*, *>, configuration: SchemaConfiguration?): FrozenMap { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validatedPathToSchemas = PathToSchemasMap() + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, LinkedHashSet()) + val pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet) + return getNewInstance(castArg, validationMetadata.pathToItem, pathToSchemasMap) + } + + @Throws(ValidationException::class) + override fun validate(arg: Any?, configuration: SchemaConfiguration?): Any? { + if (arg == null) { + return validate(null, configuration) + } else if (arg is Boolean) { + return validate(arg, configuration) + } else if (arg is Number) { + return validate(arg, configuration) + } else if (arg is String) { + return validate(arg, configuration) + } else if (arg is List<*>) { + return validate(arg, configuration) + } else if (arg is Map<*, *>) { + return validate(arg, configuration) + } + throw ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema") + } + override fun getNewInstance(arg: Any?, pathToItem: List, pathToSchemas: PathToSchemasMap): Any? { + if (arg == null) { + return getNewInstance( null, pathToItem, pathToSchemas) + } else if (arg is Boolean) { + return getNewInstance(arg, pathToItem, pathToSchemas) + } else if (arg is Number) { + return getNewInstance(arg, pathToItem, pathToSchemas) + } else if (arg is String) { + return getNewInstance(arg, pathToItem, pathToSchemas) + } else if (arg is List<*>) { + return getNewInstance(arg, pathToItem, pathToSchemas) + } else if (arg is Map<*, *>) { + return getNewInstance(arg, pathToItem, pathToSchemas) + } + throw RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema") + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: Nothing?, configuration: SchemaConfiguration?): EmptyDependents1BoxedVoid { + return EmptyDependents1BoxedVoid(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: Boolean, configuration: SchemaConfiguration?): EmptyDependents1BoxedBoolean { + return EmptyDependents1BoxedBoolean(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: Number, configuration: SchemaConfiguration?): EmptyDependents1BoxedNumber { + return EmptyDependents1BoxedNumber(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: String, configuration: SchemaConfiguration?): EmptyDependents1BoxedString { + return EmptyDependents1BoxedString(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: List<*>, configuration: SchemaConfiguration?): EmptyDependents1BoxedList { + return EmptyDependents1BoxedList(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: Map<*, *>, configuration: SchemaConfiguration?): EmptyDependents1BoxedMap { + return EmptyDependents1BoxedMap(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: Any?, configuration: SchemaConfiguration?): EmptyDependents1Boxed { + if (arg == null) { + return validateAndBox(null, configuration) + } else if (arg is Boolean) { + return validateAndBox(arg, configuration) + } else if (arg is String) { + return validateAndBox(arg, configuration) + } else if (arg is Number) { + return validateAndBox(arg, configuration) + } else if (arg is List<*>) { + return validateAndBox(arg, configuration) + } else if (arg is Map<*, *>) { + return validateAndBox(arg, configuration) + } + throw ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema") + } + } +} diff --git a/samples/client/3_1_0_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/schemas/EnumWith0DoesNotMatchFalse.kt b/samples/client/3_1_0_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/schemas/EnumWith0DoesNotMatchFalse.kt new file mode 100644 index 00000000000..5d94f419354 --- /dev/null +++ b/samples/client/3_1_0_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/schemas/EnumWith0DoesNotMatchFalse.kt @@ -0,0 +1,173 @@ +package org.openapijsonschematools.client.components.schemas +import java.math.BigDecimal +import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags +import org.openapijsonschematools.client.configurations.SchemaConfiguration +import org.openapijsonschematools.client.exceptions.ValidationException +import org.openapijsonschematools.client.schemas.validation.DoubleEnumValidator +import org.openapijsonschematools.client.schemas.validation.DoubleValueMethod +import org.openapijsonschematools.client.schemas.validation.FloatEnumValidator +import org.openapijsonschematools.client.schemas.validation.FloatValueMethod +import org.openapijsonschematools.client.schemas.validation.IntegerEnumValidator +import org.openapijsonschematools.client.schemas.validation.IntegerValueMethod +import org.openapijsonschematools.client.schemas.validation.JsonSchema +import org.openapijsonschematools.client.schemas.validation.JsonSchemaInfo +import org.openapijsonschematools.client.schemas.validation.LongEnumValidator +import org.openapijsonschematools.client.schemas.validation.LongValueMethod +import org.openapijsonschematools.client.schemas.validation.NumberSchemaValidator +import org.openapijsonschematools.client.schemas.validation.PathToSchemasMap +import org.openapijsonschematools.client.schemas.validation.ValidationMetadata + +class EnumWith0DoesNotMatchFalse { + // nest classes so all schemas and input/output classes can be public + + enum class IntegerEnumWith0DoesNotMatchFalseEnums(private val value: Int): IntegerValueMethod { + POSITIVE_0(0); + + override fun value(): Int { + return this.value + } + } + + enum class LongEnumWith0DoesNotMatchFalseEnums(private val value: Long): LongValueMethod { + POSITIVE_0(0L); + + override fun value(): Long { + return this.value + } + } + + enum class FloatEnumWith0DoesNotMatchFalseEnums(private val value: Float): FloatValueMethod { + POSITIVE_0(0.0f); + + override fun value(): Float { + return this.value + } + } + + enum class DoubleEnumWith0DoesNotMatchFalseEnums(private val value: Double): DoubleValueMethod { + POSITIVE_0(0.0); + + override fun value(): Double { + return this.value + } + } + + + sealed interface EnumWith0DoesNotMatchFalse1Boxed { + fun getData(): Any? + } + + data class EnumWith0DoesNotMatchFalse1BoxedNumber(val data: Number) : EnumWith0DoesNotMatchFalse1Boxed { + override fun getData(): Any? { + return data + } + } + + + + class EnumWith0DoesNotMatchFalse1 private constructor(): JsonSchema( + JsonSchemaInfo() + .type(setOf( + Int::class.java, + Long::class.java, + Float::class.java, + Double::class.java + )) + .enumValues(setOf( + BigDecimal("0") + )) + ), IntegerEnumValidator, LongEnumValidator, FloatEnumValidator, DoubleEnumValidator, NumberSchemaValidator { + /* + NOTE: This class is auto generated by OpenAPI JSON Schema Generator. + Ref: https://github.com/openapi-json-schema-tools/openapi-json-schema-generator + + Do not edit the class manually. + */ + + companion object { + @Volatile + private var instance: EnumWith0DoesNotMatchFalse1? = null + + fun getInstance() = + instance ?: synchronized(this) { + instance ?: EnumWith0DoesNotMatchFalse1().also { instance = it } + } + } + + @Throws(ValidationException::class) + override fun validate(arg: Number, configuration: SchemaConfiguration?): Number { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, PathToSchemasMap(), LinkedHashSet()) + val pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet) + return castArg + } + + @Throws(ValidationException::class) + fun validate(arg: Int, configuration: SchemaConfiguration?): Int { + return validate(arg as Number, configuration) as Int + } + + @Throws(ValidationException::class) + fun validate(arg: Long, configuration: SchemaConfiguration?): Long { + return validate(arg as Number, configuration) as Long + } + + @Throws(ValidationException::class) + fun validate(arg: Float, configuration: SchemaConfiguration?): Float { + return validate(arg as Number, configuration) as Float + } + + @Throws(ValidationException::class) + fun validate(arg: Double, configuration: SchemaConfiguration?): Double { + return validate(arg as Number, configuration) as Double + } + + @Throws(ValidationException::class) + override fun validate(arg: IntegerEnumWith0DoesNotMatchFalseEnums, configuration: SchemaConfiguration?): Int { + return validate(arg.value() as Number, configuration) as Int + } + + @Throws(ValidationException::class) + override fun validate(arg: LongEnumWith0DoesNotMatchFalseEnums, configuration: SchemaConfiguration?): Long { + return validate(arg.value() as Number, configuration) as Long + } + + @Throws(ValidationException::class) + override fun validate(arg: FloatEnumWith0DoesNotMatchFalseEnums, configuration: SchemaConfiguration?): Float { + return validate(arg.value() as Number, configuration) as Float + } + + @Throws(ValidationException::class) + override fun validate(arg: DoubleEnumWith0DoesNotMatchFalseEnums, configuration: SchemaConfiguration?): Double { + return validate(arg.value() as Number, configuration) as Double + } + + @Throws(ValidationException::class) + override fun validate(arg: Any?, configuration: SchemaConfiguration?): Any? { + if (arg is Number) { + return validate(arg, configuration) + } + throw ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema") + } + override fun getNewInstance(arg: Any?, pathToItem: List, pathToSchemas: PathToSchemasMap): Any? { + if (arg is Number) { + return getNewInstance(arg, pathToItem, pathToSchemas) + } + throw RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema") + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: Number, configuration: SchemaConfiguration?): EnumWith0DoesNotMatchFalse1BoxedNumber { + return EnumWith0DoesNotMatchFalse1BoxedNumber(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: Any?, configuration: SchemaConfiguration?): EnumWith0DoesNotMatchFalse1Boxed { + if (arg is Number) { + return validateAndBox(arg, configuration) + } + throw ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema") + } + } +} diff --git a/samples/client/3_1_0_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/schemas/EnumWith1DoesNotMatchTrue.kt b/samples/client/3_1_0_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/schemas/EnumWith1DoesNotMatchTrue.kt new file mode 100644 index 00000000000..7397d4f728e --- /dev/null +++ b/samples/client/3_1_0_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/schemas/EnumWith1DoesNotMatchTrue.kt @@ -0,0 +1,173 @@ +package org.openapijsonschematools.client.components.schemas +import java.math.BigDecimal +import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags +import org.openapijsonschematools.client.configurations.SchemaConfiguration +import org.openapijsonschematools.client.exceptions.ValidationException +import org.openapijsonschematools.client.schemas.validation.DoubleEnumValidator +import org.openapijsonschematools.client.schemas.validation.DoubleValueMethod +import org.openapijsonschematools.client.schemas.validation.FloatEnumValidator +import org.openapijsonschematools.client.schemas.validation.FloatValueMethod +import org.openapijsonschematools.client.schemas.validation.IntegerEnumValidator +import org.openapijsonschematools.client.schemas.validation.IntegerValueMethod +import org.openapijsonschematools.client.schemas.validation.JsonSchema +import org.openapijsonschematools.client.schemas.validation.JsonSchemaInfo +import org.openapijsonschematools.client.schemas.validation.LongEnumValidator +import org.openapijsonschematools.client.schemas.validation.LongValueMethod +import org.openapijsonschematools.client.schemas.validation.NumberSchemaValidator +import org.openapijsonschematools.client.schemas.validation.PathToSchemasMap +import org.openapijsonschematools.client.schemas.validation.ValidationMetadata + +class EnumWith1DoesNotMatchTrue { + // nest classes so all schemas and input/output classes can be public + + enum class IntegerEnumWith1DoesNotMatchTrueEnums(private val value: Int): IntegerValueMethod { + POSITIVE_1(1); + + override fun value(): Int { + return this.value + } + } + + enum class LongEnumWith1DoesNotMatchTrueEnums(private val value: Long): LongValueMethod { + POSITIVE_1(1L); + + override fun value(): Long { + return this.value + } + } + + enum class FloatEnumWith1DoesNotMatchTrueEnums(private val value: Float): FloatValueMethod { + POSITIVE_1(1.0f); + + override fun value(): Float { + return this.value + } + } + + enum class DoubleEnumWith1DoesNotMatchTrueEnums(private val value: Double): DoubleValueMethod { + POSITIVE_1(1.0); + + override fun value(): Double { + return this.value + } + } + + + sealed interface EnumWith1DoesNotMatchTrue1Boxed { + fun getData(): Any? + } + + data class EnumWith1DoesNotMatchTrue1BoxedNumber(val data: Number) : EnumWith1DoesNotMatchTrue1Boxed { + override fun getData(): Any? { + return data + } + } + + + + class EnumWith1DoesNotMatchTrue1 private constructor(): JsonSchema( + JsonSchemaInfo() + .type(setOf( + Int::class.java, + Long::class.java, + Float::class.java, + Double::class.java + )) + .enumValues(setOf( + BigDecimal("1") + )) + ), IntegerEnumValidator, LongEnumValidator, FloatEnumValidator, DoubleEnumValidator, NumberSchemaValidator { + /* + NOTE: This class is auto generated by OpenAPI JSON Schema Generator. + Ref: https://github.com/openapi-json-schema-tools/openapi-json-schema-generator + + Do not edit the class manually. + */ + + companion object { + @Volatile + private var instance: EnumWith1DoesNotMatchTrue1? = null + + fun getInstance() = + instance ?: synchronized(this) { + instance ?: EnumWith1DoesNotMatchTrue1().also { instance = it } + } + } + + @Throws(ValidationException::class) + override fun validate(arg: Number, configuration: SchemaConfiguration?): Number { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, PathToSchemasMap(), LinkedHashSet()) + val pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet) + return castArg + } + + @Throws(ValidationException::class) + fun validate(arg: Int, configuration: SchemaConfiguration?): Int { + return validate(arg as Number, configuration) as Int + } + + @Throws(ValidationException::class) + fun validate(arg: Long, configuration: SchemaConfiguration?): Long { + return validate(arg as Number, configuration) as Long + } + + @Throws(ValidationException::class) + fun validate(arg: Float, configuration: SchemaConfiguration?): Float { + return validate(arg as Number, configuration) as Float + } + + @Throws(ValidationException::class) + fun validate(arg: Double, configuration: SchemaConfiguration?): Double { + return validate(arg as Number, configuration) as Double + } + + @Throws(ValidationException::class) + override fun validate(arg: IntegerEnumWith1DoesNotMatchTrueEnums, configuration: SchemaConfiguration?): Int { + return validate(arg.value() as Number, configuration) as Int + } + + @Throws(ValidationException::class) + override fun validate(arg: LongEnumWith1DoesNotMatchTrueEnums, configuration: SchemaConfiguration?): Long { + return validate(arg.value() as Number, configuration) as Long + } + + @Throws(ValidationException::class) + override fun validate(arg: FloatEnumWith1DoesNotMatchTrueEnums, configuration: SchemaConfiguration?): Float { + return validate(arg.value() as Number, configuration) as Float + } + + @Throws(ValidationException::class) + override fun validate(arg: DoubleEnumWith1DoesNotMatchTrueEnums, configuration: SchemaConfiguration?): Double { + return validate(arg.value() as Number, configuration) as Double + } + + @Throws(ValidationException::class) + override fun validate(arg: Any?, configuration: SchemaConfiguration?): Any? { + if (arg is Number) { + return validate(arg, configuration) + } + throw ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema") + } + override fun getNewInstance(arg: Any?, pathToItem: List, pathToSchemas: PathToSchemasMap): Any? { + if (arg is Number) { + return getNewInstance(arg, pathToItem, pathToSchemas) + } + throw RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema") + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: Number, configuration: SchemaConfiguration?): EnumWith1DoesNotMatchTrue1BoxedNumber { + return EnumWith1DoesNotMatchTrue1BoxedNumber(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: Any?, configuration: SchemaConfiguration?): EnumWith1DoesNotMatchTrue1Boxed { + if (arg is Number) { + return validateAndBox(arg, configuration) + } + throw ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema") + } + } +} diff --git a/samples/client/3_1_0_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/schemas/EnumWithEscapedCharacters.kt b/samples/client/3_1_0_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/schemas/EnumWithEscapedCharacters.kt new file mode 100644 index 00000000000..4624e048623 --- /dev/null +++ b/samples/client/3_1_0_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/schemas/EnumWithEscapedCharacters.kt @@ -0,0 +1,106 @@ +package org.openapijsonschematools.client.components.schemas +import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags +import org.openapijsonschematools.client.configurations.SchemaConfiguration +import org.openapijsonschematools.client.exceptions.ValidationException +import org.openapijsonschematools.client.schemas.validation.JsonSchema +import org.openapijsonschematools.client.schemas.validation.JsonSchemaInfo +import org.openapijsonschematools.client.schemas.validation.PathToSchemasMap +import org.openapijsonschematools.client.schemas.validation.StringEnumValidator +import org.openapijsonschematools.client.schemas.validation.StringSchemaValidator +import org.openapijsonschematools.client.schemas.validation.StringValueMethod +import org.openapijsonschematools.client.schemas.validation.ValidationMetadata + +class EnumWithEscapedCharacters { + // nest classes so all schemas and input/output classes can be public + + enum class StringEnumWithEscapedCharactersEnums(private val value: String): StringValueMethod { + FOO_LINE_FEED_LF_BAR("foo\nbar"), + FOO_CARRIAGE_RETURN_CR_BAR("foo\rbar"); + + override fun value(): String { + return this.value + } + } + + + sealed interface EnumWithEscapedCharacters1Boxed { + fun getData(): Any? + } + + data class EnumWithEscapedCharacters1BoxedString(val data: String) : EnumWithEscapedCharacters1Boxed { + override fun getData(): Any? { + return data + } + } + + + + class EnumWithEscapedCharacters1 private constructor(): JsonSchema( + JsonSchemaInfo() + .type(setOf( + String::class.java + )) + .enumValues(setOf( + "foo\nbar", + "foo\rbar" + )) + ), StringSchemaValidator, StringEnumValidator { + /* + NOTE: This class is auto generated by OpenAPI JSON Schema Generator. + Ref: https://github.com/openapi-json-schema-tools/openapi-json-schema-generator + + Do not edit the class manually. + */ + + companion object { + @Volatile + private var instance: EnumWithEscapedCharacters1? = null + + fun getInstance() = + instance ?: synchronized(this) { + instance ?: EnumWithEscapedCharacters1().also { instance = it } + } + } + + @Throws(ValidationException::class) + override fun validate(arg: String, configuration: SchemaConfiguration?): String { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, PathToSchemasMap(), LinkedHashSet()) + getPathToSchemas(this, castArg, validationMetadata, pathSet) + return castArg + } + + @Throws(ValidationException::class) + override fun validate(arg: StringEnumWithEscapedCharactersEnums, configuration: SchemaConfiguration?): String { + return validate(arg.value(), configuration) + } + + @Throws(ValidationException::class) + override fun validate(arg: Any?, configuration: SchemaConfiguration?): Any? { + if (arg is String) { + return validate(arg, configuration) + } + throw ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema") + } + override fun getNewInstance(arg: Any?, pathToItem: List, pathToSchemas: PathToSchemasMap): Any? { + if (arg is String) { + return getNewInstance(arg, pathToItem, pathToSchemas) + } + throw RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema") + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: String, configuration: SchemaConfiguration?): EnumWithEscapedCharacters1BoxedString { + return EnumWithEscapedCharacters1BoxedString(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: Any?, configuration: SchemaConfiguration?): EnumWithEscapedCharacters1Boxed { + if (arg is String) { + return validateAndBox(arg, configuration) + } + throw ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema") + } + } +} diff --git a/samples/client/3_1_0_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/schemas/EnumWithFalseDoesNotMatch0.kt b/samples/client/3_1_0_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/schemas/EnumWithFalseDoesNotMatch0.kt new file mode 100644 index 00000000000..bfc0dd03800 --- /dev/null +++ b/samples/client/3_1_0_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/schemas/EnumWithFalseDoesNotMatch0.kt @@ -0,0 +1,102 @@ +package org.openapijsonschematools.client.components.schemas +import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags +import org.openapijsonschematools.client.configurations.SchemaConfiguration +import org.openapijsonschematools.client.exceptions.ValidationException +import org.openapijsonschematools.client.schemas.validation.BooleanEnumValidator +import org.openapijsonschematools.client.schemas.validation.BooleanSchemaValidator +import org.openapijsonschematools.client.schemas.validation.BooleanValueMethod +import org.openapijsonschematools.client.schemas.validation.JsonSchema +import org.openapijsonschematools.client.schemas.validation.JsonSchemaInfo +import org.openapijsonschematools.client.schemas.validation.PathToSchemasMap +import org.openapijsonschematools.client.schemas.validation.ValidationMetadata + +class EnumWithFalseDoesNotMatch0 { + // nest classes so all schemas and input/output classes can be public + + enum class BooleanEnumWithFalseDoesNotMatch0Enums(private val value: Boolean): BooleanValueMethod { + FALSE(false); + + override fun value(): Boolean { + return this.value + } + } + + + sealed interface EnumWithFalseDoesNotMatch01Boxed { + fun getData(): Any? + } + + data class EnumWithFalseDoesNotMatch01BoxedBoolean(val data: Boolean): EnumWithFalseDoesNotMatch01Boxed { + override fun getData(): Any? { + return data + } + } + + + + class EnumWithFalseDoesNotMatch01 private constructor(): JsonSchema( + JsonSchemaInfo() + .type(setOf(Boolean::class.java)) + .enumValues(setOf( + false + )) + ), BooleanSchemaValidator, BooleanEnumValidator { + /* + NOTE: This class is auto generated by OpenAPI JSON Schema Generator. + Ref: https://github.com/openapi-json-schema-tools/openapi-json-schema-generator + + Do not edit the class manually. + */ + + companion object { + @Volatile + private var instance: EnumWithFalseDoesNotMatch01? = null + + fun getInstance() = + instance ?: synchronized(this) { + instance ?: EnumWithFalseDoesNotMatch01().also { instance = it } + } + } + + @Throws(ValidationException::class) + override fun validate(arg: Boolean, configuration: SchemaConfiguration?): Boolean { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, PathToSchemasMap(), LinkedHashSet()) + getPathToSchemas(this, castArg, validationMetadata, pathSet) + return castArg + } + + @Throws(ValidationException::class) + override fun validate(arg: BooleanEnumWithFalseDoesNotMatch0Enums, configuration: SchemaConfiguration?): Boolean { + return validate(arg.value(), configuration) + } + + @Throws(ValidationException::class) + override fun validate(arg: Any?, configuration: SchemaConfiguration?): Any? { + if (arg is Boolean) { + return validate(arg, configuration) + } + throw ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema") + } + override fun getNewInstance(arg: Any?, pathToItem: List, pathToSchemas: PathToSchemasMap): Any? { + if (arg is Boolean) { + return getNewInstance(arg, pathToItem, pathToSchemas) + } + throw RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema") + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: Boolean, configuration: SchemaConfiguration?): EnumWithFalseDoesNotMatch01BoxedBoolean { + return EnumWithFalseDoesNotMatch01BoxedBoolean(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: Any?, configuration: SchemaConfiguration?): EnumWithFalseDoesNotMatch01Boxed { + if (arg is Boolean) { + return validateAndBox(arg, configuration) + } + throw ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema") + } + } +} diff --git a/samples/client/3_1_0_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/schemas/EnumWithTrueDoesNotMatch1.kt b/samples/client/3_1_0_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/schemas/EnumWithTrueDoesNotMatch1.kt new file mode 100644 index 00000000000..2df59f8e594 --- /dev/null +++ b/samples/client/3_1_0_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/schemas/EnumWithTrueDoesNotMatch1.kt @@ -0,0 +1,102 @@ +package org.openapijsonschematools.client.components.schemas +import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags +import org.openapijsonschematools.client.configurations.SchemaConfiguration +import org.openapijsonschematools.client.exceptions.ValidationException +import org.openapijsonschematools.client.schemas.validation.BooleanEnumValidator +import org.openapijsonschematools.client.schemas.validation.BooleanSchemaValidator +import org.openapijsonschematools.client.schemas.validation.BooleanValueMethod +import org.openapijsonschematools.client.schemas.validation.JsonSchema +import org.openapijsonschematools.client.schemas.validation.JsonSchemaInfo +import org.openapijsonschematools.client.schemas.validation.PathToSchemasMap +import org.openapijsonschematools.client.schemas.validation.ValidationMetadata + +class EnumWithTrueDoesNotMatch1 { + // nest classes so all schemas and input/output classes can be public + + enum class BooleanEnumWithTrueDoesNotMatch1Enums(private val value: Boolean): BooleanValueMethod { + TRUE(true); + + override fun value(): Boolean { + return this.value + } + } + + + sealed interface EnumWithTrueDoesNotMatch11Boxed { + fun getData(): Any? + } + + data class EnumWithTrueDoesNotMatch11BoxedBoolean(val data: Boolean): EnumWithTrueDoesNotMatch11Boxed { + override fun getData(): Any? { + return data + } + } + + + + class EnumWithTrueDoesNotMatch11 private constructor(): JsonSchema( + JsonSchemaInfo() + .type(setOf(Boolean::class.java)) + .enumValues(setOf( + true + )) + ), BooleanSchemaValidator, BooleanEnumValidator { + /* + NOTE: This class is auto generated by OpenAPI JSON Schema Generator. + Ref: https://github.com/openapi-json-schema-tools/openapi-json-schema-generator + + Do not edit the class manually. + */ + + companion object { + @Volatile + private var instance: EnumWithTrueDoesNotMatch11? = null + + fun getInstance() = + instance ?: synchronized(this) { + instance ?: EnumWithTrueDoesNotMatch11().also { instance = it } + } + } + + @Throws(ValidationException::class) + override fun validate(arg: Boolean, configuration: SchemaConfiguration?): Boolean { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, PathToSchemasMap(), LinkedHashSet()) + getPathToSchemas(this, castArg, validationMetadata, pathSet) + return castArg + } + + @Throws(ValidationException::class) + override fun validate(arg: BooleanEnumWithTrueDoesNotMatch1Enums, configuration: SchemaConfiguration?): Boolean { + return validate(arg.value(), configuration) + } + + @Throws(ValidationException::class) + override fun validate(arg: Any?, configuration: SchemaConfiguration?): Any? { + if (arg is Boolean) { + return validate(arg, configuration) + } + throw ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema") + } + override fun getNewInstance(arg: Any?, pathToItem: List, pathToSchemas: PathToSchemasMap): Any? { + if (arg is Boolean) { + return getNewInstance(arg, pathToItem, pathToSchemas) + } + throw RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema") + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: Boolean, configuration: SchemaConfiguration?): EnumWithTrueDoesNotMatch11BoxedBoolean { + return EnumWithTrueDoesNotMatch11BoxedBoolean(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: Any?, configuration: SchemaConfiguration?): EnumWithTrueDoesNotMatch11Boxed { + if (arg is Boolean) { + return validateAndBox(arg, configuration) + } + throw ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema") + } + } +} diff --git a/samples/client/3_1_0_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/schemas/EnumsInProperties.kt b/samples/client/3_1_0_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/schemas/EnumsInProperties.kt new file mode 100644 index 00000000000..50712e368ae --- /dev/null +++ b/samples/client/3_1_0_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/schemas/EnumsInProperties.kt @@ -0,0 +1,394 @@ +package org.openapijsonschematools.client.components.schemas +import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags +import org.openapijsonschematools.client.configurations.SchemaConfiguration +import org.openapijsonschematools.client.exceptions.InvalidAdditionalPropertyException +import org.openapijsonschematools.client.exceptions.UnsetPropertyException +import org.openapijsonschematools.client.exceptions.ValidationException +import org.openapijsonschematools.client.schemas.GenericBuilder +import org.openapijsonschematools.client.schemas.UnsetAddPropsSetter +import org.openapijsonschematools.client.schemas.validation.FrozenMap +import org.openapijsonschematools.client.schemas.validation.JsonSchema +import org.openapijsonschematools.client.schemas.validation.JsonSchemaInfo +import org.openapijsonschematools.client.schemas.validation.MapSchemaValidator +import org.openapijsonschematools.client.schemas.validation.PathToSchemasMap +import org.openapijsonschematools.client.schemas.validation.StringEnumValidator +import org.openapijsonschematools.client.schemas.validation.StringSchemaValidator +import org.openapijsonschematools.client.schemas.validation.StringValueMethod +import org.openapijsonschematools.client.schemas.validation.ValidationMetadata + +class EnumsInProperties { + // nest classes so all schemas and input/output classes can be public + + enum class StringFooEnums(private val value: String): StringValueMethod { + FOO("foo"); + + override fun value(): String { + return this.value + } + } + + + sealed interface FooBoxed { + fun getData(): Any? + } + + data class FooBoxedString(val data: String) : FooBoxed { + override fun getData(): Any? { + return data + } + } + + + + class Foo private constructor(): JsonSchema( + JsonSchemaInfo() + .type(setOf( + String::class.java + )) + .enumValues(setOf( + "foo" + )) + ), StringSchemaValidator, StringEnumValidator { + + companion object { + @Volatile + private var instance: Foo? = null + + fun getInstance() = + instance ?: synchronized(this) { + instance ?: Foo().also { instance = it } + } + } + + @Throws(ValidationException::class) + override fun validate(arg: String, configuration: SchemaConfiguration?): String { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, PathToSchemasMap(), LinkedHashSet()) + getPathToSchemas(this, castArg, validationMetadata, pathSet) + return castArg + } + + @Throws(ValidationException::class) + override fun validate(arg: StringFooEnums, configuration: SchemaConfiguration?): String { + return validate(arg.value(), configuration) + } + + @Throws(ValidationException::class) + override fun validate(arg: Any?, configuration: SchemaConfiguration?): Any? { + if (arg is String) { + return validate(arg, configuration) + } + throw ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema") + } + override fun getNewInstance(arg: Any?, pathToItem: List, pathToSchemas: PathToSchemasMap): Any? { + if (arg is String) { + return getNewInstance(arg, pathToItem, pathToSchemas) + } + throw RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema") + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: String, configuration: SchemaConfiguration?): FooBoxedString { + return FooBoxedString(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: Any?, configuration: SchemaConfiguration?): FooBoxed { + if (arg is String) { + return validateAndBox(arg, configuration) + } + throw ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema") + } + } + enum class StringBarEnums(private val value: String): StringValueMethod { + BAR("bar"); + + override fun value(): String { + return this.value + } + } + + + sealed interface BarBoxed { + fun getData(): Any? + } + + data class BarBoxedString(val data: String) : BarBoxed { + override fun getData(): Any? { + return data + } + } + + + + class Bar private constructor(): JsonSchema( + JsonSchemaInfo() + .type(setOf( + String::class.java + )) + .enumValues(setOf( + "bar" + )) + ), StringSchemaValidator, StringEnumValidator { + + companion object { + @Volatile + private var instance: Bar? = null + + fun getInstance() = + instance ?: synchronized(this) { + instance ?: Bar().also { instance = it } + } + } + + @Throws(ValidationException::class) + override fun validate(arg: String, configuration: SchemaConfiguration?): String { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, PathToSchemasMap(), LinkedHashSet()) + getPathToSchemas(this, castArg, validationMetadata, pathSet) + return castArg + } + + @Throws(ValidationException::class) + override fun validate(arg: StringBarEnums, configuration: SchemaConfiguration?): String { + return validate(arg.value(), configuration) + } + + @Throws(ValidationException::class) + override fun validate(arg: Any?, configuration: SchemaConfiguration?): Any? { + if (arg is String) { + return validate(arg, configuration) + } + throw ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema") + } + override fun getNewInstance(arg: Any?, pathToItem: List, pathToSchemas: PathToSchemasMap): Any? { + if (arg is String) { + return getNewInstance(arg, pathToItem, pathToSchemas) + } + throw RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema") + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: String, configuration: SchemaConfiguration?): BarBoxedString { + return BarBoxedString(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: Any?, configuration: SchemaConfiguration?): BarBoxed { + if (arg is String) { + return validateAndBox(arg, configuration) + } + throw ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema") + } + } + + class EnumsInPropertiesMap(m: FrozenMap) : FrozenMap(m) { + companion object { + val requiredKeys: Set = setOf( + "bar" + ) + val optionalKeys: Set = setOf( + "foo" + ) + @Throws(ValidationException::class) + fun of(arg: Map, configuration: SchemaConfiguration): EnumsInPropertiesMap { + return EnumsInProperties1.getInstance().validate(arg, configuration) + } + } + + fun bar(): String { + val value: Any? = get("bar") + if (!(value is String)) { + throw RuntimeException("Invalid value stored for bar") + } + return value + } + + @Throws(UnsetPropertyException::class) + fun foo(): String { + val key = "foo" + throwIfKeyNotPresent(key) + val value: Any? = get(key) + if (!(value is String)) { + throw RuntimeException("Invalid value stored for foo") + } + return value + } + + @Throws(UnsetPropertyException::class, InvalidAdditionalPropertyException::class) + fun getAdditionalProperty(name: String): Any? { + throwIfKeyKnown(name, requiredKeys, optionalKeys) + throwIfKeyNotPresent(name) + return get(name) + } + } + + interface SetterForBar { + fun getInstance(): MutableMap + fun getBuilderAfterBar(instance: MutableMap): T + + fun bar(value: String): T { + val instance = getInstance() + instance["bar"] = value + return getBuilderAfterBar(instance) + } + + fun bar(value: StringBarEnums): T { + val instance = getInstance() + instance["bar"] = value.value() + return getBuilderAfterBar(instance) + } + } + + interface SetterForFoo { + fun getInstance(): MutableMap + fun getBuilderAfterFoo(instance: MutableMap): T + + fun foo(value: String): T { + val instance = getInstance() + instance["foo"] = value + return getBuilderAfterFoo(instance) + } + + fun foo(value: StringFooEnums): T { + val instance = getInstance() + instance["foo"] = value.value() + return getBuilderAfterFoo(instance) + } + } + + class EnumsInPropertiesMap0Builder(private val instance: MutableMap): UnsetAddPropsSetter, GenericBuilder>, SetterForFoo { + private val knownKeys: Set = setOf( + "bar", + "foo" + ) + override fun getKnownKeys(): Set { + return knownKeys + } + override fun build(): Map { + return instance + } + override fun getInstance(): MutableMap { + return instance + } + override fun getBuilderAfterFoo(instance: MutableMap): EnumsInPropertiesMap0Builder { + return this + } + override fun getBuilderAfterAdditionalProperty(instance: MutableMap): EnumsInPropertiesMap0Builder { + return this + } + } + + class EnumsInPropertiesMapBuilder: SetterForBar { + private val instance: MutableMap + init { + this.instance = LinkedHashMap() + } + override fun getInstance(): MutableMap { + return instance + } + override fun getBuilderAfterBar(instance: MutableMap): EnumsInPropertiesMap0Builder { + return EnumsInPropertiesMap0Builder(instance) + } + } + + + sealed interface EnumsInProperties1Boxed { + fun getData(): Any? + } + + data class EnumsInProperties1BoxedMap(val data: EnumsInPropertiesMap) : EnumsInProperties1Boxed { + override fun getData(): Any? { + return data + } + } + + + class EnumsInProperties1 private constructor(): JsonSchema( + JsonSchemaInfo() + .type(setOf(Map::class.java)) + .properties(mapOf( + "foo" to Foo::class.java, + "bar" to Bar::class.java + )) + .required(setOf( + "bar" + )) + ), MapSchemaValidator { + /* + NOTE: This class is auto generated by OpenAPI JSON Schema Generator. + Ref: https://github.com/openapi-json-schema-tools/openapi-json-schema-generator + + Do not edit the class manually. + */ + + companion object { + @Volatile + private var instance: EnumsInProperties1? = null + + fun getInstance() = + instance ?: synchronized(this) { + instance ?: EnumsInProperties1().also { instance = it } + } + } + + override fun getNewInstance(arg: Map<*, *>, pathToItem: List, pathToSchemas: PathToSchemasMap): EnumsInPropertiesMap { + val properties: LinkedHashMap = LinkedHashMap() + for((entryKey, value) in arg) { + if (!(entryKey is String)) { + throw RuntimeException("Invalid non-string key value") + } + val propertyPathToItem: List = pathToItem + entryKey + val schemas: LinkedHashMap, Nothing?>? = pathToSchemas.get(propertyPathToItem) + if (schemas == null) { + throw RuntimeException("Validation result is invalid, schemas must exist for a pathToItem") + } + val propertySchema: JsonSchema<*> = schemas.entries.iterator().next().key + val propertyInstance: Any? = propertySchema.getNewInstance(value, propertyPathToItem, pathToSchemas) + properties[entryKey] = propertyInstance + } + val castProperties: FrozenMap = FrozenMap(properties) + return EnumsInPropertiesMap(castProperties) + } + + @Throws(ValidationException::class) + override fun validate(arg: Map<*, *>, configuration: SchemaConfiguration?): EnumsInPropertiesMap { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, PathToSchemasMap(), LinkedHashSet()) + val pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet) + return getNewInstance(castArg, validationMetadata.pathToItem, pathToSchemasMap) + } + + + @Throws(ValidationException::class) + override fun validate(arg: Any?, configuration: SchemaConfiguration?): Any? { + if (arg is Map<*, *>) { + return validate(arg, configuration) + } + throw ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema") + } + override fun getNewInstance(arg: Any?, pathToItem: List, pathToSchemas: PathToSchemasMap): Any? { + if (arg is Map<*, *>) { + return getNewInstance(arg, pathToItem, pathToSchemas) + } + throw RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema") + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: Map<*, *>, configuration: SchemaConfiguration?): EnumsInProperties1BoxedMap { + return EnumsInProperties1BoxedMap(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: Any?, configuration: SchemaConfiguration?): EnumsInProperties1Boxed { + if (arg is Map<*, *>) { + return validateAndBox(arg, configuration) + } + throw ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema") + } + } + +} diff --git a/samples/client/3_1_0_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/schemas/ExclusivemaximumValidation.kt b/samples/client/3_1_0_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/schemas/ExclusivemaximumValidation.kt new file mode 100644 index 00000000000..ef73329fbe9 --- /dev/null +++ b/samples/client/3_1_0_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/schemas/ExclusivemaximumValidation.kt @@ -0,0 +1,308 @@ +package org.openapijsonschematools.client.components.schemas +import java.time.LocalDate +import java.time.ZonedDateTime +import java.util.UUID +import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags +import org.openapijsonschematools.client.configurations.SchemaConfiguration +import org.openapijsonschematools.client.exceptions.InvalidAdditionalPropertyException +import org.openapijsonschematools.client.exceptions.UnsetPropertyException +import org.openapijsonschematools.client.exceptions.ValidationException +import org.openapijsonschematools.client.schemas.UnsetAddPropsSetter +import org.openapijsonschematools.client.schemas.validation.BooleanSchemaValidator +import org.openapijsonschematools.client.schemas.validation.FrozenList +import org.openapijsonschematools.client.schemas.validation.FrozenMap +import org.openapijsonschematools.client.schemas.validation.JsonSchema +import org.openapijsonschematools.client.schemas.validation.JsonSchemaInfo +import org.openapijsonschematools.client.schemas.validation.ListSchemaValidator +import org.openapijsonschematools.client.schemas.validation.MapSchemaValidator +import org.openapijsonschematools.client.schemas.validation.NullSchemaValidator +import org.openapijsonschematools.client.schemas.validation.NumberSchemaValidator +import org.openapijsonschematools.client.schemas.validation.PathToSchemasMap +import org.openapijsonschematools.client.schemas.validation.StringSchemaValidator +import org.openapijsonschematools.client.schemas.validation.ValidationMetadata + +class ExclusivemaximumValidation { + // nest classes so all schemas and input/output classes can be public + + + sealed interface ExclusivemaximumValidation1Boxed { + fun getData(): Any? + } + + data class ExclusivemaximumValidation1BoxedVoid(val data: Nothing?) : ExclusivemaximumValidation1Boxed { + override fun getData(): Any? { + return data + } + } + + data class ExclusivemaximumValidation1BoxedBoolean(val data: Boolean): ExclusivemaximumValidation1Boxed { + override fun getData(): Any? { + return data + } + } + + data class ExclusivemaximumValidation1BoxedNumber(val data: Number) : ExclusivemaximumValidation1Boxed { + override fun getData(): Any? { + return data + } + } + + data class ExclusivemaximumValidation1BoxedString(val data: String) : ExclusivemaximumValidation1Boxed { + override fun getData(): Any? { + return data + } + } + + data class ExclusivemaximumValidation1BoxedList(val data: FrozenList) : ExclusivemaximumValidation1Boxed { + override fun getData(): Any? { + return data + } + } + + data class ExclusivemaximumValidation1BoxedMap(val data: FrozenMap) : ExclusivemaximumValidation1Boxed { + override fun getData(): Any? { + return data + } + } + + + class ExclusivemaximumValidation1 private constructor(): JsonSchema( + JsonSchemaInfo() + .exclusiveMaximum(3.0) + ), NullSchemaValidator, BooleanSchemaValidator, NumberSchemaValidator, StringSchemaValidator, ListSchemaValidator, ExclusivemaximumValidation1BoxedList>, MapSchemaValidator, ExclusivemaximumValidation1BoxedMap> { + /* + NOTE: This class is auto generated by OpenAPI JSON Schema Generator. + Ref: https://github.com/openapi-json-schema-tools/openapi-json-schema-generator + + Do not edit the class manually. + */ + + companion object { + @Volatile + private var instance: ExclusivemaximumValidation1? = null + + fun getInstance() = + instance ?: synchronized(this) { + instance ?: ExclusivemaximumValidation1().also { instance = it } + } + } + + @Throws(ValidationException::class) + override fun validate(arg: Nothing?, configuration: SchemaConfiguration?): Nothing? { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validatedPathToSchemas = PathToSchemasMap() + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, LinkedHashSet()) + getPathToSchemas(this, castArg, validationMetadata, pathSet) + return castArg + } + + @Throws(ValidationException::class) + override fun validate(arg: Boolean, configuration: SchemaConfiguration?): Boolean { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validatedPathToSchemas = PathToSchemasMap() + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, LinkedHashSet()) + getPathToSchemas(this, castArg, validationMetadata, pathSet) + return castArg + } + + @Throws(ValidationException::class) + override fun validate(arg: Number, configuration: SchemaConfiguration?): Number { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validatedPathToSchemas = PathToSchemasMap() + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, LinkedHashSet()) + getPathToSchemas(this, castArg, validationMetadata, pathSet) + return castArg + } + + @Throws(ValidationException::class) + fun validate(arg: Int, configuration: SchemaConfiguration?): Int { + return validate(arg as Number, configuration) as Int + } + + @Throws(ValidationException::class) + fun validate(arg: Long, configuration: SchemaConfiguration?): Long { + return validate(arg as Number, configuration) as Long + } + + @Throws(ValidationException::class) + fun validate(arg: Float, configuration: SchemaConfiguration?): Float { + return validate(arg as Number, configuration) as Float + } + + @Throws(ValidationException::class) + fun validate(arg: Double, configuration: SchemaConfiguration?): Double { + return validate(arg as Number, configuration) as Double + } + + @Throws(ValidationException::class) + override fun validate(arg: String, configuration: SchemaConfiguration?): String { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validatedPathToSchemas = PathToSchemasMap() + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, LinkedHashSet()) + getPathToSchemas(this, castArg, validationMetadata, pathSet) + return castArg + } + + @Throws(ValidationException::class) + fun validate(arg: LocalDate, configuration: SchemaConfiguration?): String { + return validate(arg.toString(), configuration) + } + + @Throws(ValidationException::class) + fun validate(arg: ZonedDateTime, configuration: SchemaConfiguration?): String { + return validate(arg.toString(), configuration) + } + + @Throws(ValidationException::class) + fun validate(arg: UUID, configuration: SchemaConfiguration?): String { + return validate(arg.toString(), configuration) + } + + override fun getNewInstance(arg: List<*>, pathToItem: List, pathToSchemas: PathToSchemasMap): FrozenList { + val items: MutableList = ArrayList() + var i: Int = 0 + for (item: Any? in arg) { + val itemPathToItem = pathToItem + i + val schemas: LinkedHashMap, Nothing?>? = pathToSchemas.get(itemPathToItem) + if (schemas == null) { + throw RuntimeException("Validation result is invalid, schemas must exist for a pathToItem") + } + val itemSchema: JsonSchema<*> = schemas.entries.iterator().next().key + val itemInstance: Any? = itemSchema.getNewInstance(item, itemPathToItem, pathToSchemas) + items.add(itemInstance) + i += 1 + } + val newInstanceItems: FrozenList = FrozenList(items) + return newInstanceItems + } + + @Throws(ValidationException::class) + override fun validate(arg: List<*>, configuration: SchemaConfiguration?): FrozenList { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, PathToSchemasMap(), LinkedHashSet()) + val pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet) + return getNewInstance(castArg, validationMetadata.pathToItem, pathToSchemasMap) + } + + override fun getNewInstance(arg: Map<*, *>, pathToItem: List, pathToSchemas: PathToSchemasMap): FrozenMap { + val properties: LinkedHashMap = LinkedHashMap() + for((propertyName, value) in arg) { + if (!(propertyName is String)) { + throw RuntimeException("Invalid non-string key value") + } + val propertyPathToItem: List = pathToItem + propertyName + val schemas: LinkedHashMap, Nothing?>? = pathToSchemas.get(propertyPathToItem) + if (schemas == null) { + throw RuntimeException("Validation result is invalid, schemas must exist for a pathToItem") + } + val propertySchema: JsonSchema<*> = schemas.entries.iterator().next().key + val propertyInstance: Any? = propertySchema.getNewInstance(value, propertyPathToItem, pathToSchemas) + properties[propertyName] = propertyInstance + } + val castProperties: FrozenMap = FrozenMap(properties) + return castProperties + } + + @Throws(ValidationException::class) + override fun validate(arg: Map<*, *>, configuration: SchemaConfiguration?): FrozenMap { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validatedPathToSchemas = PathToSchemasMap() + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, LinkedHashSet()) + val pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet) + return getNewInstance(castArg, validationMetadata.pathToItem, pathToSchemasMap) + } + + @Throws(ValidationException::class) + override fun validate(arg: Any?, configuration: SchemaConfiguration?): Any? { + if (arg == null) { + return validate(null, configuration) + } else if (arg is Boolean) { + return validate(arg, configuration) + } else if (arg is Number) { + return validate(arg, configuration) + } else if (arg is String) { + return validate(arg, configuration) + } else if (arg is List<*>) { + return validate(arg, configuration) + } else if (arg is Map<*, *>) { + return validate(arg, configuration) + } + throw ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema") + } + override fun getNewInstance(arg: Any?, pathToItem: List, pathToSchemas: PathToSchemasMap): Any? { + if (arg == null) { + return getNewInstance( null, pathToItem, pathToSchemas) + } else if (arg is Boolean) { + return getNewInstance(arg, pathToItem, pathToSchemas) + } else if (arg is Number) { + return getNewInstance(arg, pathToItem, pathToSchemas) + } else if (arg is String) { + return getNewInstance(arg, pathToItem, pathToSchemas) + } else if (arg is List<*>) { + return getNewInstance(arg, pathToItem, pathToSchemas) + } else if (arg is Map<*, *>) { + return getNewInstance(arg, pathToItem, pathToSchemas) + } + throw RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema") + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: Nothing?, configuration: SchemaConfiguration?): ExclusivemaximumValidation1BoxedVoid { + return ExclusivemaximumValidation1BoxedVoid(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: Boolean, configuration: SchemaConfiguration?): ExclusivemaximumValidation1BoxedBoolean { + return ExclusivemaximumValidation1BoxedBoolean(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: Number, configuration: SchemaConfiguration?): ExclusivemaximumValidation1BoxedNumber { + return ExclusivemaximumValidation1BoxedNumber(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: String, configuration: SchemaConfiguration?): ExclusivemaximumValidation1BoxedString { + return ExclusivemaximumValidation1BoxedString(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: List<*>, configuration: SchemaConfiguration?): ExclusivemaximumValidation1BoxedList { + return ExclusivemaximumValidation1BoxedList(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: Map<*, *>, configuration: SchemaConfiguration?): ExclusivemaximumValidation1BoxedMap { + return ExclusivemaximumValidation1BoxedMap(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: Any?, configuration: SchemaConfiguration?): ExclusivemaximumValidation1Boxed { + if (arg == null) { + return validateAndBox(null, configuration) + } else if (arg is Boolean) { + return validateAndBox(arg, configuration) + } else if (arg is String) { + return validateAndBox(arg, configuration) + } else if (arg is Number) { + return validateAndBox(arg, configuration) + } else if (arg is List<*>) { + return validateAndBox(arg, configuration) + } else if (arg is Map<*, *>) { + return validateAndBox(arg, configuration) + } + throw ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema") + } + } +} diff --git a/samples/client/3_1_0_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/schemas/ExclusiveminimumValidation.kt b/samples/client/3_1_0_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/schemas/ExclusiveminimumValidation.kt new file mode 100644 index 00000000000..18e56a3a845 --- /dev/null +++ b/samples/client/3_1_0_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/schemas/ExclusiveminimumValidation.kt @@ -0,0 +1,308 @@ +package org.openapijsonschematools.client.components.schemas +import java.time.LocalDate +import java.time.ZonedDateTime +import java.util.UUID +import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags +import org.openapijsonschematools.client.configurations.SchemaConfiguration +import org.openapijsonschematools.client.exceptions.InvalidAdditionalPropertyException +import org.openapijsonschematools.client.exceptions.UnsetPropertyException +import org.openapijsonschematools.client.exceptions.ValidationException +import org.openapijsonschematools.client.schemas.UnsetAddPropsSetter +import org.openapijsonschematools.client.schemas.validation.BooleanSchemaValidator +import org.openapijsonschematools.client.schemas.validation.FrozenList +import org.openapijsonschematools.client.schemas.validation.FrozenMap +import org.openapijsonschematools.client.schemas.validation.JsonSchema +import org.openapijsonschematools.client.schemas.validation.JsonSchemaInfo +import org.openapijsonschematools.client.schemas.validation.ListSchemaValidator +import org.openapijsonschematools.client.schemas.validation.MapSchemaValidator +import org.openapijsonschematools.client.schemas.validation.NullSchemaValidator +import org.openapijsonschematools.client.schemas.validation.NumberSchemaValidator +import org.openapijsonschematools.client.schemas.validation.PathToSchemasMap +import org.openapijsonschematools.client.schemas.validation.StringSchemaValidator +import org.openapijsonschematools.client.schemas.validation.ValidationMetadata + +class ExclusiveminimumValidation { + // nest classes so all schemas and input/output classes can be public + + + sealed interface ExclusiveminimumValidation1Boxed { + fun getData(): Any? + } + + data class ExclusiveminimumValidation1BoxedVoid(val data: Nothing?) : ExclusiveminimumValidation1Boxed { + override fun getData(): Any? { + return data + } + } + + data class ExclusiveminimumValidation1BoxedBoolean(val data: Boolean): ExclusiveminimumValidation1Boxed { + override fun getData(): Any? { + return data + } + } + + data class ExclusiveminimumValidation1BoxedNumber(val data: Number) : ExclusiveminimumValidation1Boxed { + override fun getData(): Any? { + return data + } + } + + data class ExclusiveminimumValidation1BoxedString(val data: String) : ExclusiveminimumValidation1Boxed { + override fun getData(): Any? { + return data + } + } + + data class ExclusiveminimumValidation1BoxedList(val data: FrozenList) : ExclusiveminimumValidation1Boxed { + override fun getData(): Any? { + return data + } + } + + data class ExclusiveminimumValidation1BoxedMap(val data: FrozenMap) : ExclusiveminimumValidation1Boxed { + override fun getData(): Any? { + return data + } + } + + + class ExclusiveminimumValidation1 private constructor(): JsonSchema( + JsonSchemaInfo() + .exclusiveMinimum(1.1) + ), NullSchemaValidator, BooleanSchemaValidator, NumberSchemaValidator, StringSchemaValidator, ListSchemaValidator, ExclusiveminimumValidation1BoxedList>, MapSchemaValidator, ExclusiveminimumValidation1BoxedMap> { + /* + NOTE: This class is auto generated by OpenAPI JSON Schema Generator. + Ref: https://github.com/openapi-json-schema-tools/openapi-json-schema-generator + + Do not edit the class manually. + */ + + companion object { + @Volatile + private var instance: ExclusiveminimumValidation1? = null + + fun getInstance() = + instance ?: synchronized(this) { + instance ?: ExclusiveminimumValidation1().also { instance = it } + } + } + + @Throws(ValidationException::class) + override fun validate(arg: Nothing?, configuration: SchemaConfiguration?): Nothing? { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validatedPathToSchemas = PathToSchemasMap() + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, LinkedHashSet()) + getPathToSchemas(this, castArg, validationMetadata, pathSet) + return castArg + } + + @Throws(ValidationException::class) + override fun validate(arg: Boolean, configuration: SchemaConfiguration?): Boolean { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validatedPathToSchemas = PathToSchemasMap() + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, LinkedHashSet()) + getPathToSchemas(this, castArg, validationMetadata, pathSet) + return castArg + } + + @Throws(ValidationException::class) + override fun validate(arg: Number, configuration: SchemaConfiguration?): Number { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validatedPathToSchemas = PathToSchemasMap() + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, LinkedHashSet()) + getPathToSchemas(this, castArg, validationMetadata, pathSet) + return castArg + } + + @Throws(ValidationException::class) + fun validate(arg: Int, configuration: SchemaConfiguration?): Int { + return validate(arg as Number, configuration) as Int + } + + @Throws(ValidationException::class) + fun validate(arg: Long, configuration: SchemaConfiguration?): Long { + return validate(arg as Number, configuration) as Long + } + + @Throws(ValidationException::class) + fun validate(arg: Float, configuration: SchemaConfiguration?): Float { + return validate(arg as Number, configuration) as Float + } + + @Throws(ValidationException::class) + fun validate(arg: Double, configuration: SchemaConfiguration?): Double { + return validate(arg as Number, configuration) as Double + } + + @Throws(ValidationException::class) + override fun validate(arg: String, configuration: SchemaConfiguration?): String { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validatedPathToSchemas = PathToSchemasMap() + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, LinkedHashSet()) + getPathToSchemas(this, castArg, validationMetadata, pathSet) + return castArg + } + + @Throws(ValidationException::class) + fun validate(arg: LocalDate, configuration: SchemaConfiguration?): String { + return validate(arg.toString(), configuration) + } + + @Throws(ValidationException::class) + fun validate(arg: ZonedDateTime, configuration: SchemaConfiguration?): String { + return validate(arg.toString(), configuration) + } + + @Throws(ValidationException::class) + fun validate(arg: UUID, configuration: SchemaConfiguration?): String { + return validate(arg.toString(), configuration) + } + + override fun getNewInstance(arg: List<*>, pathToItem: List, pathToSchemas: PathToSchemasMap): FrozenList { + val items: MutableList = ArrayList() + var i: Int = 0 + for (item: Any? in arg) { + val itemPathToItem = pathToItem + i + val schemas: LinkedHashMap, Nothing?>? = pathToSchemas.get(itemPathToItem) + if (schemas == null) { + throw RuntimeException("Validation result is invalid, schemas must exist for a pathToItem") + } + val itemSchema: JsonSchema<*> = schemas.entries.iterator().next().key + val itemInstance: Any? = itemSchema.getNewInstance(item, itemPathToItem, pathToSchemas) + items.add(itemInstance) + i += 1 + } + val newInstanceItems: FrozenList = FrozenList(items) + return newInstanceItems + } + + @Throws(ValidationException::class) + override fun validate(arg: List<*>, configuration: SchemaConfiguration?): FrozenList { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, PathToSchemasMap(), LinkedHashSet()) + val pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet) + return getNewInstance(castArg, validationMetadata.pathToItem, pathToSchemasMap) + } + + override fun getNewInstance(arg: Map<*, *>, pathToItem: List, pathToSchemas: PathToSchemasMap): FrozenMap { + val properties: LinkedHashMap = LinkedHashMap() + for((propertyName, value) in arg) { + if (!(propertyName is String)) { + throw RuntimeException("Invalid non-string key value") + } + val propertyPathToItem: List = pathToItem + propertyName + val schemas: LinkedHashMap, Nothing?>? = pathToSchemas.get(propertyPathToItem) + if (schemas == null) { + throw RuntimeException("Validation result is invalid, schemas must exist for a pathToItem") + } + val propertySchema: JsonSchema<*> = schemas.entries.iterator().next().key + val propertyInstance: Any? = propertySchema.getNewInstance(value, propertyPathToItem, pathToSchemas) + properties[propertyName] = propertyInstance + } + val castProperties: FrozenMap = FrozenMap(properties) + return castProperties + } + + @Throws(ValidationException::class) + override fun validate(arg: Map<*, *>, configuration: SchemaConfiguration?): FrozenMap { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validatedPathToSchemas = PathToSchemasMap() + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, LinkedHashSet()) + val pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet) + return getNewInstance(castArg, validationMetadata.pathToItem, pathToSchemasMap) + } + + @Throws(ValidationException::class) + override fun validate(arg: Any?, configuration: SchemaConfiguration?): Any? { + if (arg == null) { + return validate(null, configuration) + } else if (arg is Boolean) { + return validate(arg, configuration) + } else if (arg is Number) { + return validate(arg, configuration) + } else if (arg is String) { + return validate(arg, configuration) + } else if (arg is List<*>) { + return validate(arg, configuration) + } else if (arg is Map<*, *>) { + return validate(arg, configuration) + } + throw ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema") + } + override fun getNewInstance(arg: Any?, pathToItem: List, pathToSchemas: PathToSchemasMap): Any? { + if (arg == null) { + return getNewInstance( null, pathToItem, pathToSchemas) + } else if (arg is Boolean) { + return getNewInstance(arg, pathToItem, pathToSchemas) + } else if (arg is Number) { + return getNewInstance(arg, pathToItem, pathToSchemas) + } else if (arg is String) { + return getNewInstance(arg, pathToItem, pathToSchemas) + } else if (arg is List<*>) { + return getNewInstance(arg, pathToItem, pathToSchemas) + } else if (arg is Map<*, *>) { + return getNewInstance(arg, pathToItem, pathToSchemas) + } + throw RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema") + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: Nothing?, configuration: SchemaConfiguration?): ExclusiveminimumValidation1BoxedVoid { + return ExclusiveminimumValidation1BoxedVoid(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: Boolean, configuration: SchemaConfiguration?): ExclusiveminimumValidation1BoxedBoolean { + return ExclusiveminimumValidation1BoxedBoolean(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: Number, configuration: SchemaConfiguration?): ExclusiveminimumValidation1BoxedNumber { + return ExclusiveminimumValidation1BoxedNumber(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: String, configuration: SchemaConfiguration?): ExclusiveminimumValidation1BoxedString { + return ExclusiveminimumValidation1BoxedString(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: List<*>, configuration: SchemaConfiguration?): ExclusiveminimumValidation1BoxedList { + return ExclusiveminimumValidation1BoxedList(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: Map<*, *>, configuration: SchemaConfiguration?): ExclusiveminimumValidation1BoxedMap { + return ExclusiveminimumValidation1BoxedMap(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: Any?, configuration: SchemaConfiguration?): ExclusiveminimumValidation1Boxed { + if (arg == null) { + return validateAndBox(null, configuration) + } else if (arg is Boolean) { + return validateAndBox(arg, configuration) + } else if (arg is String) { + return validateAndBox(arg, configuration) + } else if (arg is Number) { + return validateAndBox(arg, configuration) + } else if (arg is List<*>) { + return validateAndBox(arg, configuration) + } else if (arg is Map<*, *>) { + return validateAndBox(arg, configuration) + } + throw ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema") + } + } +} diff --git a/samples/client/3_1_0_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/schemas/FloatDivisionInf.kt b/samples/client/3_1_0_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/schemas/FloatDivisionInf.kt new file mode 100644 index 00000000000..9d83a4c1936 --- /dev/null +++ b/samples/client/3_1_0_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/schemas/FloatDivisionInf.kt @@ -0,0 +1,112 @@ +package org.openapijsonschematools.client.components.schemas +import java.math.BigDecimal +import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags +import org.openapijsonschematools.client.configurations.SchemaConfiguration +import org.openapijsonschematools.client.exceptions.ValidationException +import org.openapijsonschematools.client.schemas.validation.JsonSchema +import org.openapijsonschematools.client.schemas.validation.JsonSchemaInfo +import org.openapijsonschematools.client.schemas.validation.NumberSchemaValidator +import org.openapijsonschematools.client.schemas.validation.PathToSchemasMap +import org.openapijsonschematools.client.schemas.validation.ValidationMetadata + +class FloatDivisionInf { + // nest classes so all schemas and input/output classes can be public + + + sealed interface FloatDivisionInf1Boxed { + fun getData(): Any? + } + + data class FloatDivisionInf1BoxedNumber(val data: Number) : FloatDivisionInf1Boxed { + override fun getData(): Any? { + return data + } + } + + + + class FloatDivisionInf1 private constructor(): JsonSchema( + JsonSchemaInfo() + .type(setOf( + Int::class.java, + Long::class.java, + Float::class.java, + Double::class.java + )) + .format("int") + .multipleOf(BigDecimal("0.123456789")) + ), NumberSchemaValidator { + /* + NOTE: This class is auto generated by OpenAPI JSON Schema Generator. + Ref: https://github.com/openapi-json-schema-tools/openapi-json-schema-generator + + Do not edit the class manually. + */ + + companion object { + @Volatile + private var instance: FloatDivisionInf1? = null + + fun getInstance() = + instance ?: synchronized(this) { + instance ?: FloatDivisionInf1().also { instance = it } + } + } + + @Throws(ValidationException::class) + override fun validate(arg: Number, configuration: SchemaConfiguration?): Number { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, PathToSchemasMap(), LinkedHashSet()) + getPathToSchemas(this, castArg, validationMetadata, pathSet) + return castArg + } + + @Throws(ValidationException::class) + fun validate(arg: Int, configuration: SchemaConfiguration?): Int { + return validate(arg as Number, configuration) as Int + } + + @Throws(ValidationException::class) + fun validate(arg: Float, configuration: SchemaConfiguration?): Float { + return validate(arg as Number, configuration) as Float + } + + @Throws(ValidationException::class) + fun validate(arg: Long, configuration: SchemaConfiguration?): Long { + return validate(arg as Number, configuration) as Long + } + + @Throws(ValidationException::class) + fun validate(arg: Double, configuration: SchemaConfiguration?): Double { + return validate(arg as Number, configuration) as Double + } + + @Throws(ValidationException::class) + override fun validate(arg: Any?, configuration: SchemaConfiguration?): Any? { + if (arg is Number) { + return validate(arg, configuration) + } + throw ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema") + } + override fun getNewInstance(arg: Any?, pathToItem: List, pathToSchemas: PathToSchemasMap): Any? { + if (arg is Number) { + return getNewInstance(arg, pathToItem, pathToSchemas) + } + throw RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema") + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: Number, configuration: SchemaConfiguration?): FloatDivisionInf1BoxedNumber { + return FloatDivisionInf1BoxedNumber(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: Any?, configuration: SchemaConfiguration?): FloatDivisionInf1Boxed { + if (arg is Number) { + return validateAndBox(arg, configuration) + } + throw ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema") + } + } +} diff --git a/samples/client/3_1_0_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/schemas/ForbiddenProperty.kt b/samples/client/3_1_0_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/schemas/ForbiddenProperty.kt new file mode 100644 index 00000000000..fc91855ede5 --- /dev/null +++ b/samples/client/3_1_0_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/schemas/ForbiddenProperty.kt @@ -0,0 +1,710 @@ +package org.openapijsonschematools.client.components.schemas +import java.time.LocalDate +import java.time.ZonedDateTime +import java.util.UUID +import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags +import org.openapijsonschematools.client.configurations.SchemaConfiguration +import org.openapijsonschematools.client.exceptions.InvalidAdditionalPropertyException +import org.openapijsonschematools.client.exceptions.UnsetPropertyException +import org.openapijsonschematools.client.exceptions.ValidationException +import org.openapijsonschematools.client.schemas.AnyTypeJsonSchema +import org.openapijsonschematools.client.schemas.GenericBuilder +import org.openapijsonschematools.client.schemas.UnsetAddPropsSetter +import org.openapijsonschematools.client.schemas.validation.BooleanSchemaValidator +import org.openapijsonschematools.client.schemas.validation.FrozenList +import org.openapijsonschematools.client.schemas.validation.FrozenMap +import org.openapijsonschematools.client.schemas.validation.JsonSchema +import org.openapijsonschematools.client.schemas.validation.JsonSchemaInfo +import org.openapijsonschematools.client.schemas.validation.ListSchemaValidator +import org.openapijsonschematools.client.schemas.validation.MapSchemaValidator +import org.openapijsonschematools.client.schemas.validation.NullSchemaValidator +import org.openapijsonschematools.client.schemas.validation.NumberSchemaValidator +import org.openapijsonschematools.client.schemas.validation.PathToSchemasMap +import org.openapijsonschematools.client.schemas.validation.StringSchemaValidator +import org.openapijsonschematools.client.schemas.validation.ValidationMetadata + +class ForbiddenProperty { + // nest classes so all schemas and input/output classes can be public + + + class Not : AnyTypeJsonSchema.AnyTypeJsonSchema1() { + companion object { + @Volatile + private var instance: Not? = null + + fun getInstance() = + instance ?: synchronized(this) { + instance ?: Not().also { instance = it } + } + } + } + + + sealed interface FooBoxed { + fun getData(): Any? + } + + data class FooBoxedVoid(val data: Nothing?) : FooBoxed { + override fun getData(): Any? { + return data + } + } + + data class FooBoxedBoolean(val data: Boolean): FooBoxed { + override fun getData(): Any? { + return data + } + } + + data class FooBoxedNumber(val data: Number) : FooBoxed { + override fun getData(): Any? { + return data + } + } + + data class FooBoxedString(val data: String) : FooBoxed { + override fun getData(): Any? { + return data + } + } + + data class FooBoxedList(val data: FrozenList) : FooBoxed { + override fun getData(): Any? { + return data + } + } + + data class FooBoxedMap(val data: FrozenMap) : FooBoxed { + override fun getData(): Any? { + return data + } + } + + + class Foo private constructor(): JsonSchema( + JsonSchemaInfo() + .not(Not::class.java) + ), NullSchemaValidator, BooleanSchemaValidator, NumberSchemaValidator, StringSchemaValidator, ListSchemaValidator, FooBoxedList>, MapSchemaValidator, FooBoxedMap> { + + companion object { + @Volatile + private var instance: Foo? = null + + fun getInstance() = + instance ?: synchronized(this) { + instance ?: Foo().also { instance = it } + } + } + + @Throws(ValidationException::class) + override fun validate(arg: Nothing?, configuration: SchemaConfiguration?): Nothing? { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validatedPathToSchemas = PathToSchemasMap() + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, LinkedHashSet()) + getPathToSchemas(this, castArg, validationMetadata, pathSet) + return castArg + } + + @Throws(ValidationException::class) + override fun validate(arg: Boolean, configuration: SchemaConfiguration?): Boolean { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validatedPathToSchemas = PathToSchemasMap() + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, LinkedHashSet()) + getPathToSchemas(this, castArg, validationMetadata, pathSet) + return castArg + } + + @Throws(ValidationException::class) + override fun validate(arg: Number, configuration: SchemaConfiguration?): Number { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validatedPathToSchemas = PathToSchemasMap() + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, LinkedHashSet()) + getPathToSchemas(this, castArg, validationMetadata, pathSet) + return castArg + } + + @Throws(ValidationException::class) + fun validate(arg: Int, configuration: SchemaConfiguration?): Int { + return validate(arg as Number, configuration) as Int + } + + @Throws(ValidationException::class) + fun validate(arg: Long, configuration: SchemaConfiguration?): Long { + return validate(arg as Number, configuration) as Long + } + + @Throws(ValidationException::class) + fun validate(arg: Float, configuration: SchemaConfiguration?): Float { + return validate(arg as Number, configuration) as Float + } + + @Throws(ValidationException::class) + fun validate(arg: Double, configuration: SchemaConfiguration?): Double { + return validate(arg as Number, configuration) as Double + } + + @Throws(ValidationException::class) + override fun validate(arg: String, configuration: SchemaConfiguration?): String { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validatedPathToSchemas = PathToSchemasMap() + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, LinkedHashSet()) + getPathToSchemas(this, castArg, validationMetadata, pathSet) + return castArg + } + + @Throws(ValidationException::class) + fun validate(arg: LocalDate, configuration: SchemaConfiguration?): String { + return validate(arg.toString(), configuration) + } + + @Throws(ValidationException::class) + fun validate(arg: ZonedDateTime, configuration: SchemaConfiguration?): String { + return validate(arg.toString(), configuration) + } + + @Throws(ValidationException::class) + fun validate(arg: UUID, configuration: SchemaConfiguration?): String { + return validate(arg.toString(), configuration) + } + + override fun getNewInstance(arg: List<*>, pathToItem: List, pathToSchemas: PathToSchemasMap): FrozenList { + val items: MutableList = ArrayList() + var i: Int = 0 + for (item: Any? in arg) { + val itemPathToItem = pathToItem + i + val schemas: LinkedHashMap, Nothing?>? = pathToSchemas.get(itemPathToItem) + if (schemas == null) { + throw RuntimeException("Validation result is invalid, schemas must exist for a pathToItem") + } + val itemSchema: JsonSchema<*> = schemas.entries.iterator().next().key + val itemInstance: Any? = itemSchema.getNewInstance(item, itemPathToItem, pathToSchemas) + items.add(itemInstance) + i += 1 + } + val newInstanceItems: FrozenList = FrozenList(items) + return newInstanceItems + } + + @Throws(ValidationException::class) + override fun validate(arg: List<*>, configuration: SchemaConfiguration?): FrozenList { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, PathToSchemasMap(), LinkedHashSet()) + val pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet) + return getNewInstance(castArg, validationMetadata.pathToItem, pathToSchemasMap) + } + + override fun getNewInstance(arg: Map<*, *>, pathToItem: List, pathToSchemas: PathToSchemasMap): FrozenMap { + val properties: LinkedHashMap = LinkedHashMap() + for((propertyName, value) in arg) { + if (!(propertyName is String)) { + throw RuntimeException("Invalid non-string key value") + } + val propertyPathToItem: List = pathToItem + propertyName + val schemas: LinkedHashMap, Nothing?>? = pathToSchemas.get(propertyPathToItem) + if (schemas == null) { + throw RuntimeException("Validation result is invalid, schemas must exist for a pathToItem") + } + val propertySchema: JsonSchema<*> = schemas.entries.iterator().next().key + val propertyInstance: Any? = propertySchema.getNewInstance(value, propertyPathToItem, pathToSchemas) + properties[propertyName] = propertyInstance + } + val castProperties: FrozenMap = FrozenMap(properties) + return castProperties + } + + @Throws(ValidationException::class) + override fun validate(arg: Map<*, *>, configuration: SchemaConfiguration?): FrozenMap { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validatedPathToSchemas = PathToSchemasMap() + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, LinkedHashSet()) + val pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet) + return getNewInstance(castArg, validationMetadata.pathToItem, pathToSchemasMap) + } + + @Throws(ValidationException::class) + override fun validate(arg: Any?, configuration: SchemaConfiguration?): Any? { + if (arg == null) { + return validate(null, configuration) + } else if (arg is Boolean) { + return validate(arg, configuration) + } else if (arg is Number) { + return validate(arg, configuration) + } else if (arg is String) { + return validate(arg, configuration) + } else if (arg is List<*>) { + return validate(arg, configuration) + } else if (arg is Map<*, *>) { + return validate(arg, configuration) + } + throw ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema") + } + override fun getNewInstance(arg: Any?, pathToItem: List, pathToSchemas: PathToSchemasMap): Any? { + if (arg == null) { + return getNewInstance( null, pathToItem, pathToSchemas) + } else if (arg is Boolean) { + return getNewInstance(arg, pathToItem, pathToSchemas) + } else if (arg is Number) { + return getNewInstance(arg, pathToItem, pathToSchemas) + } else if (arg is String) { + return getNewInstance(arg, pathToItem, pathToSchemas) + } else if (arg is List<*>) { + return getNewInstance(arg, pathToItem, pathToSchemas) + } else if (arg is Map<*, *>) { + return getNewInstance(arg, pathToItem, pathToSchemas) + } + throw RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema") + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: Nothing?, configuration: SchemaConfiguration?): FooBoxedVoid { + return FooBoxedVoid(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: Boolean, configuration: SchemaConfiguration?): FooBoxedBoolean { + return FooBoxedBoolean(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: Number, configuration: SchemaConfiguration?): FooBoxedNumber { + return FooBoxedNumber(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: String, configuration: SchemaConfiguration?): FooBoxedString { + return FooBoxedString(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: List<*>, configuration: SchemaConfiguration?): FooBoxedList { + return FooBoxedList(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: Map<*, *>, configuration: SchemaConfiguration?): FooBoxedMap { + return FooBoxedMap(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: Any?, configuration: SchemaConfiguration?): FooBoxed { + if (arg == null) { + return validateAndBox(null, configuration) + } else if (arg is Boolean) { + return validateAndBox(arg, configuration) + } else if (arg is String) { + return validateAndBox(arg, configuration) + } else if (arg is Number) { + return validateAndBox(arg, configuration) + } else if (arg is List<*>) { + return validateAndBox(arg, configuration) + } else if (arg is Map<*, *>) { + return validateAndBox(arg, configuration) + } + throw ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema") + } + } + + class ForbiddenPropertyMap(m: FrozenMap) : FrozenMap(m) { + companion object { + val requiredKeys: Set = setOf() + val optionalKeys: Set = setOf( + "foo" + ) + @Throws(ValidationException::class) + fun of(arg: Map, configuration: SchemaConfiguration): ForbiddenPropertyMap { + return ForbiddenProperty1.getInstance().validate(arg, configuration) + } + } + + @Throws(UnsetPropertyException::class) + fun foo(): Any? { + return getOrThrow("foo") + } + + @Throws(UnsetPropertyException::class, InvalidAdditionalPropertyException::class) + fun getAdditionalProperty(name: String): Any? { + throwIfKeyKnown(name, requiredKeys, optionalKeys) + throwIfKeyNotPresent(name) + return get(name) + } + } + + interface SetterForFoo { + fun getInstance(): MutableMap + fun getBuilderAfterFoo(instance: MutableMap): T + + fun foo(value: Nothing?): T { + val instance = getInstance() + instance["foo"] = null + return getBuilderAfterFoo(instance) + } + + fun foo(value: Boolean): T { + val instance = getInstance() + instance["foo"] = value + return getBuilderAfterFoo(instance) + } + + fun foo(value: String): T { + val instance = getInstance() + instance["foo"] = value + return getBuilderAfterFoo(instance) + } + + fun foo(value: Int): T { + val instance = getInstance() + instance["foo"] = value + return getBuilderAfterFoo(instance) + } + + fun foo(value: Float): T { + val instance = getInstance() + instance["foo"] = value + return getBuilderAfterFoo(instance) + } + + fun foo(value: Long): T { + val instance = getInstance() + instance["foo"] = value + return getBuilderAfterFoo(instance) + } + + fun foo(value: Double): T { + val instance = getInstance() + instance["foo"] = value + return getBuilderAfterFoo(instance) + } + + fun foo(value: List): T { + val instance = getInstance() + instance["foo"] = value + return getBuilderAfterFoo(instance) + } + + fun foo(value: Map): T { + val instance = getInstance() + instance["foo"] = value + return getBuilderAfterFoo(instance) + } + } + + class ForbiddenPropertyMapBuilder: UnsetAddPropsSetter, GenericBuilder>, SetterForFoo { + private val knownKeys: Set = setOf( + "foo" + ) + override fun getKnownKeys(): Set { + return knownKeys + } + private val instance: MutableMap + init { + this.instance = LinkedHashMap() + } + override fun build(): Map { + return instance + } + override fun getInstance(): MutableMap { + return instance + } + override fun getBuilderAfterFoo(instance: MutableMap): ForbiddenPropertyMapBuilder { + return this + } + override fun getBuilderAfterAdditionalProperty(instance: MutableMap): ForbiddenPropertyMapBuilder { + return this + } + } + + + sealed interface ForbiddenProperty1Boxed { + fun getData(): Any? + } + + data class ForbiddenProperty1BoxedVoid(val data: Nothing?) : ForbiddenProperty1Boxed { + override fun getData(): Any? { + return data + } + } + + data class ForbiddenProperty1BoxedBoolean(val data: Boolean): ForbiddenProperty1Boxed { + override fun getData(): Any? { + return data + } + } + + data class ForbiddenProperty1BoxedNumber(val data: Number) : ForbiddenProperty1Boxed { + override fun getData(): Any? { + return data + } + } + + data class ForbiddenProperty1BoxedString(val data: String) : ForbiddenProperty1Boxed { + override fun getData(): Any? { + return data + } + } + + data class ForbiddenProperty1BoxedList(val data: FrozenList) : ForbiddenProperty1Boxed { + override fun getData(): Any? { + return data + } + } + + data class ForbiddenProperty1BoxedMap(val data: ForbiddenPropertyMap) : ForbiddenProperty1Boxed { + override fun getData(): Any? { + return data + } + } + + + class ForbiddenProperty1 private constructor(): JsonSchema( + JsonSchemaInfo() + .properties(mapOf( + "foo" to Foo::class.java + )) + ), NullSchemaValidator, BooleanSchemaValidator, NumberSchemaValidator, StringSchemaValidator, ListSchemaValidator, ForbiddenProperty1BoxedList>, MapSchemaValidator { + /* + NOTE: This class is auto generated by OpenAPI JSON Schema Generator. + Ref: https://github.com/openapi-json-schema-tools/openapi-json-schema-generator + + Do not edit the class manually. + */ + + companion object { + @Volatile + private var instance: ForbiddenProperty1? = null + + fun getInstance() = + instance ?: synchronized(this) { + instance ?: ForbiddenProperty1().also { instance = it } + } + } + + @Throws(ValidationException::class) + override fun validate(arg: Nothing?, configuration: SchemaConfiguration?): Nothing? { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validatedPathToSchemas = PathToSchemasMap() + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, LinkedHashSet()) + getPathToSchemas(this, castArg, validationMetadata, pathSet) + return castArg + } + + @Throws(ValidationException::class) + override fun validate(arg: Boolean, configuration: SchemaConfiguration?): Boolean { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validatedPathToSchemas = PathToSchemasMap() + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, LinkedHashSet()) + getPathToSchemas(this, castArg, validationMetadata, pathSet) + return castArg + } + + @Throws(ValidationException::class) + override fun validate(arg: Number, configuration: SchemaConfiguration?): Number { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validatedPathToSchemas = PathToSchemasMap() + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, LinkedHashSet()) + getPathToSchemas(this, castArg, validationMetadata, pathSet) + return castArg + } + + @Throws(ValidationException::class) + fun validate(arg: Int, configuration: SchemaConfiguration?): Int { + return validate(arg as Number, configuration) as Int + } + + @Throws(ValidationException::class) + fun validate(arg: Long, configuration: SchemaConfiguration?): Long { + return validate(arg as Number, configuration) as Long + } + + @Throws(ValidationException::class) + fun validate(arg: Float, configuration: SchemaConfiguration?): Float { + return validate(arg as Number, configuration) as Float + } + + @Throws(ValidationException::class) + fun validate(arg: Double, configuration: SchemaConfiguration?): Double { + return validate(arg as Number, configuration) as Double + } + + @Throws(ValidationException::class) + override fun validate(arg: String, configuration: SchemaConfiguration?): String { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validatedPathToSchemas = PathToSchemasMap() + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, LinkedHashSet()) + getPathToSchemas(this, castArg, validationMetadata, pathSet) + return castArg + } + + @Throws(ValidationException::class) + fun validate(arg: LocalDate, configuration: SchemaConfiguration?): String { + return validate(arg.toString(), configuration) + } + + @Throws(ValidationException::class) + fun validate(arg: ZonedDateTime, configuration: SchemaConfiguration?): String { + return validate(arg.toString(), configuration) + } + + @Throws(ValidationException::class) + fun validate(arg: UUID, configuration: SchemaConfiguration?): String { + return validate(arg.toString(), configuration) + } + + override fun getNewInstance(arg: List<*>, pathToItem: List, pathToSchemas: PathToSchemasMap): FrozenList { + val items: MutableList = ArrayList() + var i: Int = 0 + for (item: Any? in arg) { + val itemPathToItem = pathToItem + i + val schemas: LinkedHashMap, Nothing?>? = pathToSchemas.get(itemPathToItem) + if (schemas == null) { + throw RuntimeException("Validation result is invalid, schemas must exist for a pathToItem") + } + val itemSchema: JsonSchema<*> = schemas.entries.iterator().next().key + val itemInstance: Any? = itemSchema.getNewInstance(item, itemPathToItem, pathToSchemas) + items.add(itemInstance) + i += 1 + } + val newInstanceItems: FrozenList = FrozenList(items) + return newInstanceItems + } + + @Throws(ValidationException::class) + override fun validate(arg: List<*>, configuration: SchemaConfiguration?): FrozenList { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, PathToSchemasMap(), LinkedHashSet()) + val pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet) + return getNewInstance(castArg, validationMetadata.pathToItem, pathToSchemasMap) + } + + override fun getNewInstance(arg: Map<*, *>, pathToItem: List, pathToSchemas: PathToSchemasMap): ForbiddenPropertyMap { + val properties: LinkedHashMap = LinkedHashMap() + for((propertyName, value) in arg) { + if (!(propertyName is String)) { + throw RuntimeException("Invalid non-string key value") + } + val propertyPathToItem: List = pathToItem + propertyName + val schemas: LinkedHashMap, Nothing?>? = pathToSchemas.get(propertyPathToItem) + if (schemas == null) { + throw RuntimeException("Validation result is invalid, schemas must exist for a pathToItem") + } + val propertySchema: JsonSchema<*> = schemas.entries.iterator().next().key + val propertyInstance: Any? = propertySchema.getNewInstance(value, propertyPathToItem, pathToSchemas) + properties[propertyName] = propertyInstance + } + val castProperties: FrozenMap = FrozenMap(properties) + return ForbiddenPropertyMap(castProperties) + } + + @Throws(ValidationException::class) + override fun validate(arg: Map<*, *>, configuration: SchemaConfiguration?): ForbiddenPropertyMap { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validatedPathToSchemas = PathToSchemasMap() + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, LinkedHashSet()) + val pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet) + return getNewInstance(castArg, validationMetadata.pathToItem, pathToSchemasMap) + } + + @Throws(ValidationException::class) + override fun validate(arg: Any?, configuration: SchemaConfiguration?): Any? { + if (arg == null) { + return validate(null, configuration) + } else if (arg is Boolean) { + return validate(arg, configuration) + } else if (arg is Number) { + return validate(arg, configuration) + } else if (arg is String) { + return validate(arg, configuration) + } else if (arg is List<*>) { + return validate(arg, configuration) + } else if (arg is Map<*, *>) { + return validate(arg, configuration) + } + throw ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema") + } + override fun getNewInstance(arg: Any?, pathToItem: List, pathToSchemas: PathToSchemasMap): Any? { + if (arg == null) { + return getNewInstance( null, pathToItem, pathToSchemas) + } else if (arg is Boolean) { + return getNewInstance(arg, pathToItem, pathToSchemas) + } else if (arg is Number) { + return getNewInstance(arg, pathToItem, pathToSchemas) + } else if (arg is String) { + return getNewInstance(arg, pathToItem, pathToSchemas) + } else if (arg is List<*>) { + return getNewInstance(arg, pathToItem, pathToSchemas) + } else if (arg is Map<*, *>) { + return getNewInstance(arg, pathToItem, pathToSchemas) + } + throw RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema") + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: Nothing?, configuration: SchemaConfiguration?): ForbiddenProperty1BoxedVoid { + return ForbiddenProperty1BoxedVoid(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: Boolean, configuration: SchemaConfiguration?): ForbiddenProperty1BoxedBoolean { + return ForbiddenProperty1BoxedBoolean(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: Number, configuration: SchemaConfiguration?): ForbiddenProperty1BoxedNumber { + return ForbiddenProperty1BoxedNumber(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: String, configuration: SchemaConfiguration?): ForbiddenProperty1BoxedString { + return ForbiddenProperty1BoxedString(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: List<*>, configuration: SchemaConfiguration?): ForbiddenProperty1BoxedList { + return ForbiddenProperty1BoxedList(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: Map<*, *>, configuration: SchemaConfiguration?): ForbiddenProperty1BoxedMap { + return ForbiddenProperty1BoxedMap(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: Any?, configuration: SchemaConfiguration?): ForbiddenProperty1Boxed { + if (arg == null) { + return validateAndBox(null, configuration) + } else if (arg is Boolean) { + return validateAndBox(arg, configuration) + } else if (arg is String) { + return validateAndBox(arg, configuration) + } else if (arg is Number) { + return validateAndBox(arg, configuration) + } else if (arg is List<*>) { + return validateAndBox(arg, configuration) + } else if (arg is Map<*, *>) { + return validateAndBox(arg, configuration) + } + throw ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema") + } + } +} diff --git a/samples/client/3_1_0_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/schemas/HostnameFormat.kt b/samples/client/3_1_0_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/schemas/HostnameFormat.kt new file mode 100644 index 00000000000..63cefc4f9fb --- /dev/null +++ b/samples/client/3_1_0_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/schemas/HostnameFormat.kt @@ -0,0 +1,308 @@ +package org.openapijsonschematools.client.components.schemas +import java.time.LocalDate +import java.time.ZonedDateTime +import java.util.UUID +import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags +import org.openapijsonschematools.client.configurations.SchemaConfiguration +import org.openapijsonschematools.client.exceptions.InvalidAdditionalPropertyException +import org.openapijsonschematools.client.exceptions.UnsetPropertyException +import org.openapijsonschematools.client.exceptions.ValidationException +import org.openapijsonschematools.client.schemas.UnsetAddPropsSetter +import org.openapijsonschematools.client.schemas.validation.BooleanSchemaValidator +import org.openapijsonschematools.client.schemas.validation.FrozenList +import org.openapijsonschematools.client.schemas.validation.FrozenMap +import org.openapijsonschematools.client.schemas.validation.JsonSchema +import org.openapijsonschematools.client.schemas.validation.JsonSchemaInfo +import org.openapijsonschematools.client.schemas.validation.ListSchemaValidator +import org.openapijsonschematools.client.schemas.validation.MapSchemaValidator +import org.openapijsonschematools.client.schemas.validation.NullSchemaValidator +import org.openapijsonschematools.client.schemas.validation.NumberSchemaValidator +import org.openapijsonschematools.client.schemas.validation.PathToSchemasMap +import org.openapijsonschematools.client.schemas.validation.StringSchemaValidator +import org.openapijsonschematools.client.schemas.validation.ValidationMetadata + +class HostnameFormat { + // nest classes so all schemas and input/output classes can be public + + + sealed interface HostnameFormat1Boxed { + fun getData(): Any? + } + + data class HostnameFormat1BoxedVoid(val data: Nothing?) : HostnameFormat1Boxed { + override fun getData(): Any? { + return data + } + } + + data class HostnameFormat1BoxedBoolean(val data: Boolean): HostnameFormat1Boxed { + override fun getData(): Any? { + return data + } + } + + data class HostnameFormat1BoxedNumber(val data: Number) : HostnameFormat1Boxed { + override fun getData(): Any? { + return data + } + } + + data class HostnameFormat1BoxedString(val data: String) : HostnameFormat1Boxed { + override fun getData(): Any? { + return data + } + } + + data class HostnameFormat1BoxedList(val data: FrozenList) : HostnameFormat1Boxed { + override fun getData(): Any? { + return data + } + } + + data class HostnameFormat1BoxedMap(val data: FrozenMap) : HostnameFormat1Boxed { + override fun getData(): Any? { + return data + } + } + + + class HostnameFormat1 private constructor(): JsonSchema( + JsonSchemaInfo() + .format("hostname") + ), NullSchemaValidator, BooleanSchemaValidator, NumberSchemaValidator, StringSchemaValidator, ListSchemaValidator, HostnameFormat1BoxedList>, MapSchemaValidator, HostnameFormat1BoxedMap> { + /* + NOTE: This class is auto generated by OpenAPI JSON Schema Generator. + Ref: https://github.com/openapi-json-schema-tools/openapi-json-schema-generator + + Do not edit the class manually. + */ + + companion object { + @Volatile + private var instance: HostnameFormat1? = null + + fun getInstance() = + instance ?: synchronized(this) { + instance ?: HostnameFormat1().also { instance = it } + } + } + + @Throws(ValidationException::class) + override fun validate(arg: Nothing?, configuration: SchemaConfiguration?): Nothing? { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validatedPathToSchemas = PathToSchemasMap() + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, LinkedHashSet()) + getPathToSchemas(this, castArg, validationMetadata, pathSet) + return castArg + } + + @Throws(ValidationException::class) + override fun validate(arg: Boolean, configuration: SchemaConfiguration?): Boolean { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validatedPathToSchemas = PathToSchemasMap() + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, LinkedHashSet()) + getPathToSchemas(this, castArg, validationMetadata, pathSet) + return castArg + } + + @Throws(ValidationException::class) + override fun validate(arg: Number, configuration: SchemaConfiguration?): Number { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validatedPathToSchemas = PathToSchemasMap() + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, LinkedHashSet()) + getPathToSchemas(this, castArg, validationMetadata, pathSet) + return castArg + } + + @Throws(ValidationException::class) + fun validate(arg: Int, configuration: SchemaConfiguration?): Int { + return validate(arg as Number, configuration) as Int + } + + @Throws(ValidationException::class) + fun validate(arg: Long, configuration: SchemaConfiguration?): Long { + return validate(arg as Number, configuration) as Long + } + + @Throws(ValidationException::class) + fun validate(arg: Float, configuration: SchemaConfiguration?): Float { + return validate(arg as Number, configuration) as Float + } + + @Throws(ValidationException::class) + fun validate(arg: Double, configuration: SchemaConfiguration?): Double { + return validate(arg as Number, configuration) as Double + } + + @Throws(ValidationException::class) + override fun validate(arg: String, configuration: SchemaConfiguration?): String { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validatedPathToSchemas = PathToSchemasMap() + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, LinkedHashSet()) + getPathToSchemas(this, castArg, validationMetadata, pathSet) + return castArg + } + + @Throws(ValidationException::class) + fun validate(arg: LocalDate, configuration: SchemaConfiguration?): String { + return validate(arg.toString(), configuration) + } + + @Throws(ValidationException::class) + fun validate(arg: ZonedDateTime, configuration: SchemaConfiguration?): String { + return validate(arg.toString(), configuration) + } + + @Throws(ValidationException::class) + fun validate(arg: UUID, configuration: SchemaConfiguration?): String { + return validate(arg.toString(), configuration) + } + + override fun getNewInstance(arg: List<*>, pathToItem: List, pathToSchemas: PathToSchemasMap): FrozenList { + val items: MutableList = ArrayList() + var i: Int = 0 + for (item: Any? in arg) { + val itemPathToItem = pathToItem + i + val schemas: LinkedHashMap, Nothing?>? = pathToSchemas.get(itemPathToItem) + if (schemas == null) { + throw RuntimeException("Validation result is invalid, schemas must exist for a pathToItem") + } + val itemSchema: JsonSchema<*> = schemas.entries.iterator().next().key + val itemInstance: Any? = itemSchema.getNewInstance(item, itemPathToItem, pathToSchemas) + items.add(itemInstance) + i += 1 + } + val newInstanceItems: FrozenList = FrozenList(items) + return newInstanceItems + } + + @Throws(ValidationException::class) + override fun validate(arg: List<*>, configuration: SchemaConfiguration?): FrozenList { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, PathToSchemasMap(), LinkedHashSet()) + val pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet) + return getNewInstance(castArg, validationMetadata.pathToItem, pathToSchemasMap) + } + + override fun getNewInstance(arg: Map<*, *>, pathToItem: List, pathToSchemas: PathToSchemasMap): FrozenMap { + val properties: LinkedHashMap = LinkedHashMap() + for((propertyName, value) in arg) { + if (!(propertyName is String)) { + throw RuntimeException("Invalid non-string key value") + } + val propertyPathToItem: List = pathToItem + propertyName + val schemas: LinkedHashMap, Nothing?>? = pathToSchemas.get(propertyPathToItem) + if (schemas == null) { + throw RuntimeException("Validation result is invalid, schemas must exist for a pathToItem") + } + val propertySchema: JsonSchema<*> = schemas.entries.iterator().next().key + val propertyInstance: Any? = propertySchema.getNewInstance(value, propertyPathToItem, pathToSchemas) + properties[propertyName] = propertyInstance + } + val castProperties: FrozenMap = FrozenMap(properties) + return castProperties + } + + @Throws(ValidationException::class) + override fun validate(arg: Map<*, *>, configuration: SchemaConfiguration?): FrozenMap { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validatedPathToSchemas = PathToSchemasMap() + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, LinkedHashSet()) + val pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet) + return getNewInstance(castArg, validationMetadata.pathToItem, pathToSchemasMap) + } + + @Throws(ValidationException::class) + override fun validate(arg: Any?, configuration: SchemaConfiguration?): Any? { + if (arg == null) { + return validate(null, configuration) + } else if (arg is Boolean) { + return validate(arg, configuration) + } else if (arg is Number) { + return validate(arg, configuration) + } else if (arg is String) { + return validate(arg, configuration) + } else if (arg is List<*>) { + return validate(arg, configuration) + } else if (arg is Map<*, *>) { + return validate(arg, configuration) + } + throw ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema") + } + override fun getNewInstance(arg: Any?, pathToItem: List, pathToSchemas: PathToSchemasMap): Any? { + if (arg == null) { + return getNewInstance( null, pathToItem, pathToSchemas) + } else if (arg is Boolean) { + return getNewInstance(arg, pathToItem, pathToSchemas) + } else if (arg is Number) { + return getNewInstance(arg, pathToItem, pathToSchemas) + } else if (arg is String) { + return getNewInstance(arg, pathToItem, pathToSchemas) + } else if (arg is List<*>) { + return getNewInstance(arg, pathToItem, pathToSchemas) + } else if (arg is Map<*, *>) { + return getNewInstance(arg, pathToItem, pathToSchemas) + } + throw RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema") + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: Nothing?, configuration: SchemaConfiguration?): HostnameFormat1BoxedVoid { + return HostnameFormat1BoxedVoid(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: Boolean, configuration: SchemaConfiguration?): HostnameFormat1BoxedBoolean { + return HostnameFormat1BoxedBoolean(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: Number, configuration: SchemaConfiguration?): HostnameFormat1BoxedNumber { + return HostnameFormat1BoxedNumber(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: String, configuration: SchemaConfiguration?): HostnameFormat1BoxedString { + return HostnameFormat1BoxedString(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: List<*>, configuration: SchemaConfiguration?): HostnameFormat1BoxedList { + return HostnameFormat1BoxedList(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: Map<*, *>, configuration: SchemaConfiguration?): HostnameFormat1BoxedMap { + return HostnameFormat1BoxedMap(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: Any?, configuration: SchemaConfiguration?): HostnameFormat1Boxed { + if (arg == null) { + return validateAndBox(null, configuration) + } else if (arg is Boolean) { + return validateAndBox(arg, configuration) + } else if (arg is String) { + return validateAndBox(arg, configuration) + } else if (arg is Number) { + return validateAndBox(arg, configuration) + } else if (arg is List<*>) { + return validateAndBox(arg, configuration) + } else if (arg is Map<*, *>) { + return validateAndBox(arg, configuration) + } + throw ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema") + } + } +} diff --git a/samples/client/3_1_0_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/schemas/IdnEmailFormat.kt b/samples/client/3_1_0_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/schemas/IdnEmailFormat.kt new file mode 100644 index 00000000000..d03befb9905 --- /dev/null +++ b/samples/client/3_1_0_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/schemas/IdnEmailFormat.kt @@ -0,0 +1,308 @@ +package org.openapijsonschematools.client.components.schemas +import java.time.LocalDate +import java.time.ZonedDateTime +import java.util.UUID +import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags +import org.openapijsonschematools.client.configurations.SchemaConfiguration +import org.openapijsonschematools.client.exceptions.InvalidAdditionalPropertyException +import org.openapijsonschematools.client.exceptions.UnsetPropertyException +import org.openapijsonschematools.client.exceptions.ValidationException +import org.openapijsonschematools.client.schemas.UnsetAddPropsSetter +import org.openapijsonschematools.client.schemas.validation.BooleanSchemaValidator +import org.openapijsonschematools.client.schemas.validation.FrozenList +import org.openapijsonschematools.client.schemas.validation.FrozenMap +import org.openapijsonschematools.client.schemas.validation.JsonSchema +import org.openapijsonschematools.client.schemas.validation.JsonSchemaInfo +import org.openapijsonschematools.client.schemas.validation.ListSchemaValidator +import org.openapijsonschematools.client.schemas.validation.MapSchemaValidator +import org.openapijsonschematools.client.schemas.validation.NullSchemaValidator +import org.openapijsonschematools.client.schemas.validation.NumberSchemaValidator +import org.openapijsonschematools.client.schemas.validation.PathToSchemasMap +import org.openapijsonschematools.client.schemas.validation.StringSchemaValidator +import org.openapijsonschematools.client.schemas.validation.ValidationMetadata + +class IdnEmailFormat { + // nest classes so all schemas and input/output classes can be public + + + sealed interface IdnEmailFormat1Boxed { + fun getData(): Any? + } + + data class IdnEmailFormat1BoxedVoid(val data: Nothing?) : IdnEmailFormat1Boxed { + override fun getData(): Any? { + return data + } + } + + data class IdnEmailFormat1BoxedBoolean(val data: Boolean): IdnEmailFormat1Boxed { + override fun getData(): Any? { + return data + } + } + + data class IdnEmailFormat1BoxedNumber(val data: Number) : IdnEmailFormat1Boxed { + override fun getData(): Any? { + return data + } + } + + data class IdnEmailFormat1BoxedString(val data: String) : IdnEmailFormat1Boxed { + override fun getData(): Any? { + return data + } + } + + data class IdnEmailFormat1BoxedList(val data: FrozenList) : IdnEmailFormat1Boxed { + override fun getData(): Any? { + return data + } + } + + data class IdnEmailFormat1BoxedMap(val data: FrozenMap) : IdnEmailFormat1Boxed { + override fun getData(): Any? { + return data + } + } + + + class IdnEmailFormat1 private constructor(): JsonSchema( + JsonSchemaInfo() + .format("idn-email") + ), NullSchemaValidator, BooleanSchemaValidator, NumberSchemaValidator, StringSchemaValidator, ListSchemaValidator, IdnEmailFormat1BoxedList>, MapSchemaValidator, IdnEmailFormat1BoxedMap> { + /* + NOTE: This class is auto generated by OpenAPI JSON Schema Generator. + Ref: https://github.com/openapi-json-schema-tools/openapi-json-schema-generator + + Do not edit the class manually. + */ + + companion object { + @Volatile + private var instance: IdnEmailFormat1? = null + + fun getInstance() = + instance ?: synchronized(this) { + instance ?: IdnEmailFormat1().also { instance = it } + } + } + + @Throws(ValidationException::class) + override fun validate(arg: Nothing?, configuration: SchemaConfiguration?): Nothing? { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validatedPathToSchemas = PathToSchemasMap() + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, LinkedHashSet()) + getPathToSchemas(this, castArg, validationMetadata, pathSet) + return castArg + } + + @Throws(ValidationException::class) + override fun validate(arg: Boolean, configuration: SchemaConfiguration?): Boolean { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validatedPathToSchemas = PathToSchemasMap() + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, LinkedHashSet()) + getPathToSchemas(this, castArg, validationMetadata, pathSet) + return castArg + } + + @Throws(ValidationException::class) + override fun validate(arg: Number, configuration: SchemaConfiguration?): Number { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validatedPathToSchemas = PathToSchemasMap() + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, LinkedHashSet()) + getPathToSchemas(this, castArg, validationMetadata, pathSet) + return castArg + } + + @Throws(ValidationException::class) + fun validate(arg: Int, configuration: SchemaConfiguration?): Int { + return validate(arg as Number, configuration) as Int + } + + @Throws(ValidationException::class) + fun validate(arg: Long, configuration: SchemaConfiguration?): Long { + return validate(arg as Number, configuration) as Long + } + + @Throws(ValidationException::class) + fun validate(arg: Float, configuration: SchemaConfiguration?): Float { + return validate(arg as Number, configuration) as Float + } + + @Throws(ValidationException::class) + fun validate(arg: Double, configuration: SchemaConfiguration?): Double { + return validate(arg as Number, configuration) as Double + } + + @Throws(ValidationException::class) + override fun validate(arg: String, configuration: SchemaConfiguration?): String { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validatedPathToSchemas = PathToSchemasMap() + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, LinkedHashSet()) + getPathToSchemas(this, castArg, validationMetadata, pathSet) + return castArg + } + + @Throws(ValidationException::class) + fun validate(arg: LocalDate, configuration: SchemaConfiguration?): String { + return validate(arg.toString(), configuration) + } + + @Throws(ValidationException::class) + fun validate(arg: ZonedDateTime, configuration: SchemaConfiguration?): String { + return validate(arg.toString(), configuration) + } + + @Throws(ValidationException::class) + fun validate(arg: UUID, configuration: SchemaConfiguration?): String { + return validate(arg.toString(), configuration) + } + + override fun getNewInstance(arg: List<*>, pathToItem: List, pathToSchemas: PathToSchemasMap): FrozenList { + val items: MutableList = ArrayList() + var i: Int = 0 + for (item: Any? in arg) { + val itemPathToItem = pathToItem + i + val schemas: LinkedHashMap, Nothing?>? = pathToSchemas.get(itemPathToItem) + if (schemas == null) { + throw RuntimeException("Validation result is invalid, schemas must exist for a pathToItem") + } + val itemSchema: JsonSchema<*> = schemas.entries.iterator().next().key + val itemInstance: Any? = itemSchema.getNewInstance(item, itemPathToItem, pathToSchemas) + items.add(itemInstance) + i += 1 + } + val newInstanceItems: FrozenList = FrozenList(items) + return newInstanceItems + } + + @Throws(ValidationException::class) + override fun validate(arg: List<*>, configuration: SchemaConfiguration?): FrozenList { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, PathToSchemasMap(), LinkedHashSet()) + val pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet) + return getNewInstance(castArg, validationMetadata.pathToItem, pathToSchemasMap) + } + + override fun getNewInstance(arg: Map<*, *>, pathToItem: List, pathToSchemas: PathToSchemasMap): FrozenMap { + val properties: LinkedHashMap = LinkedHashMap() + for((propertyName, value) in arg) { + if (!(propertyName is String)) { + throw RuntimeException("Invalid non-string key value") + } + val propertyPathToItem: List = pathToItem + propertyName + val schemas: LinkedHashMap, Nothing?>? = pathToSchemas.get(propertyPathToItem) + if (schemas == null) { + throw RuntimeException("Validation result is invalid, schemas must exist for a pathToItem") + } + val propertySchema: JsonSchema<*> = schemas.entries.iterator().next().key + val propertyInstance: Any? = propertySchema.getNewInstance(value, propertyPathToItem, pathToSchemas) + properties[propertyName] = propertyInstance + } + val castProperties: FrozenMap = FrozenMap(properties) + return castProperties + } + + @Throws(ValidationException::class) + override fun validate(arg: Map<*, *>, configuration: SchemaConfiguration?): FrozenMap { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validatedPathToSchemas = PathToSchemasMap() + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, LinkedHashSet()) + val pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet) + return getNewInstance(castArg, validationMetadata.pathToItem, pathToSchemasMap) + } + + @Throws(ValidationException::class) + override fun validate(arg: Any?, configuration: SchemaConfiguration?): Any? { + if (arg == null) { + return validate(null, configuration) + } else if (arg is Boolean) { + return validate(arg, configuration) + } else if (arg is Number) { + return validate(arg, configuration) + } else if (arg is String) { + return validate(arg, configuration) + } else if (arg is List<*>) { + return validate(arg, configuration) + } else if (arg is Map<*, *>) { + return validate(arg, configuration) + } + throw ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema") + } + override fun getNewInstance(arg: Any?, pathToItem: List, pathToSchemas: PathToSchemasMap): Any? { + if (arg == null) { + return getNewInstance( null, pathToItem, pathToSchemas) + } else if (arg is Boolean) { + return getNewInstance(arg, pathToItem, pathToSchemas) + } else if (arg is Number) { + return getNewInstance(arg, pathToItem, pathToSchemas) + } else if (arg is String) { + return getNewInstance(arg, pathToItem, pathToSchemas) + } else if (arg is List<*>) { + return getNewInstance(arg, pathToItem, pathToSchemas) + } else if (arg is Map<*, *>) { + return getNewInstance(arg, pathToItem, pathToSchemas) + } + throw RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema") + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: Nothing?, configuration: SchemaConfiguration?): IdnEmailFormat1BoxedVoid { + return IdnEmailFormat1BoxedVoid(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: Boolean, configuration: SchemaConfiguration?): IdnEmailFormat1BoxedBoolean { + return IdnEmailFormat1BoxedBoolean(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: Number, configuration: SchemaConfiguration?): IdnEmailFormat1BoxedNumber { + return IdnEmailFormat1BoxedNumber(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: String, configuration: SchemaConfiguration?): IdnEmailFormat1BoxedString { + return IdnEmailFormat1BoxedString(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: List<*>, configuration: SchemaConfiguration?): IdnEmailFormat1BoxedList { + return IdnEmailFormat1BoxedList(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: Map<*, *>, configuration: SchemaConfiguration?): IdnEmailFormat1BoxedMap { + return IdnEmailFormat1BoxedMap(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: Any?, configuration: SchemaConfiguration?): IdnEmailFormat1Boxed { + if (arg == null) { + return validateAndBox(null, configuration) + } else if (arg is Boolean) { + return validateAndBox(arg, configuration) + } else if (arg is String) { + return validateAndBox(arg, configuration) + } else if (arg is Number) { + return validateAndBox(arg, configuration) + } else if (arg is List<*>) { + return validateAndBox(arg, configuration) + } else if (arg is Map<*, *>) { + return validateAndBox(arg, configuration) + } + throw ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema") + } + } +} diff --git a/samples/client/3_1_0_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/schemas/IdnHostnameFormat.kt b/samples/client/3_1_0_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/schemas/IdnHostnameFormat.kt new file mode 100644 index 00000000000..2de5abdb4e3 --- /dev/null +++ b/samples/client/3_1_0_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/schemas/IdnHostnameFormat.kt @@ -0,0 +1,308 @@ +package org.openapijsonschematools.client.components.schemas +import java.time.LocalDate +import java.time.ZonedDateTime +import java.util.UUID +import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags +import org.openapijsonschematools.client.configurations.SchemaConfiguration +import org.openapijsonschematools.client.exceptions.InvalidAdditionalPropertyException +import org.openapijsonschematools.client.exceptions.UnsetPropertyException +import org.openapijsonschematools.client.exceptions.ValidationException +import org.openapijsonschematools.client.schemas.UnsetAddPropsSetter +import org.openapijsonschematools.client.schemas.validation.BooleanSchemaValidator +import org.openapijsonschematools.client.schemas.validation.FrozenList +import org.openapijsonschematools.client.schemas.validation.FrozenMap +import org.openapijsonschematools.client.schemas.validation.JsonSchema +import org.openapijsonschematools.client.schemas.validation.JsonSchemaInfo +import org.openapijsonschematools.client.schemas.validation.ListSchemaValidator +import org.openapijsonschematools.client.schemas.validation.MapSchemaValidator +import org.openapijsonschematools.client.schemas.validation.NullSchemaValidator +import org.openapijsonschematools.client.schemas.validation.NumberSchemaValidator +import org.openapijsonschematools.client.schemas.validation.PathToSchemasMap +import org.openapijsonschematools.client.schemas.validation.StringSchemaValidator +import org.openapijsonschematools.client.schemas.validation.ValidationMetadata + +class IdnHostnameFormat { + // nest classes so all schemas and input/output classes can be public + + + sealed interface IdnHostnameFormat1Boxed { + fun getData(): Any? + } + + data class IdnHostnameFormat1BoxedVoid(val data: Nothing?) : IdnHostnameFormat1Boxed { + override fun getData(): Any? { + return data + } + } + + data class IdnHostnameFormat1BoxedBoolean(val data: Boolean): IdnHostnameFormat1Boxed { + override fun getData(): Any? { + return data + } + } + + data class IdnHostnameFormat1BoxedNumber(val data: Number) : IdnHostnameFormat1Boxed { + override fun getData(): Any? { + return data + } + } + + data class IdnHostnameFormat1BoxedString(val data: String) : IdnHostnameFormat1Boxed { + override fun getData(): Any? { + return data + } + } + + data class IdnHostnameFormat1BoxedList(val data: FrozenList) : IdnHostnameFormat1Boxed { + override fun getData(): Any? { + return data + } + } + + data class IdnHostnameFormat1BoxedMap(val data: FrozenMap) : IdnHostnameFormat1Boxed { + override fun getData(): Any? { + return data + } + } + + + class IdnHostnameFormat1 private constructor(): JsonSchema( + JsonSchemaInfo() + .format("idn-hostname") + ), NullSchemaValidator, BooleanSchemaValidator, NumberSchemaValidator, StringSchemaValidator, ListSchemaValidator, IdnHostnameFormat1BoxedList>, MapSchemaValidator, IdnHostnameFormat1BoxedMap> { + /* + NOTE: This class is auto generated by OpenAPI JSON Schema Generator. + Ref: https://github.com/openapi-json-schema-tools/openapi-json-schema-generator + + Do not edit the class manually. + */ + + companion object { + @Volatile + private var instance: IdnHostnameFormat1? = null + + fun getInstance() = + instance ?: synchronized(this) { + instance ?: IdnHostnameFormat1().also { instance = it } + } + } + + @Throws(ValidationException::class) + override fun validate(arg: Nothing?, configuration: SchemaConfiguration?): Nothing? { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validatedPathToSchemas = PathToSchemasMap() + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, LinkedHashSet()) + getPathToSchemas(this, castArg, validationMetadata, pathSet) + return castArg + } + + @Throws(ValidationException::class) + override fun validate(arg: Boolean, configuration: SchemaConfiguration?): Boolean { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validatedPathToSchemas = PathToSchemasMap() + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, LinkedHashSet()) + getPathToSchemas(this, castArg, validationMetadata, pathSet) + return castArg + } + + @Throws(ValidationException::class) + override fun validate(arg: Number, configuration: SchemaConfiguration?): Number { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validatedPathToSchemas = PathToSchemasMap() + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, LinkedHashSet()) + getPathToSchemas(this, castArg, validationMetadata, pathSet) + return castArg + } + + @Throws(ValidationException::class) + fun validate(arg: Int, configuration: SchemaConfiguration?): Int { + return validate(arg as Number, configuration) as Int + } + + @Throws(ValidationException::class) + fun validate(arg: Long, configuration: SchemaConfiguration?): Long { + return validate(arg as Number, configuration) as Long + } + + @Throws(ValidationException::class) + fun validate(arg: Float, configuration: SchemaConfiguration?): Float { + return validate(arg as Number, configuration) as Float + } + + @Throws(ValidationException::class) + fun validate(arg: Double, configuration: SchemaConfiguration?): Double { + return validate(arg as Number, configuration) as Double + } + + @Throws(ValidationException::class) + override fun validate(arg: String, configuration: SchemaConfiguration?): String { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validatedPathToSchemas = PathToSchemasMap() + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, LinkedHashSet()) + getPathToSchemas(this, castArg, validationMetadata, pathSet) + return castArg + } + + @Throws(ValidationException::class) + fun validate(arg: LocalDate, configuration: SchemaConfiguration?): String { + return validate(arg.toString(), configuration) + } + + @Throws(ValidationException::class) + fun validate(arg: ZonedDateTime, configuration: SchemaConfiguration?): String { + return validate(arg.toString(), configuration) + } + + @Throws(ValidationException::class) + fun validate(arg: UUID, configuration: SchemaConfiguration?): String { + return validate(arg.toString(), configuration) + } + + override fun getNewInstance(arg: List<*>, pathToItem: List, pathToSchemas: PathToSchemasMap): FrozenList { + val items: MutableList = ArrayList() + var i: Int = 0 + for (item: Any? in arg) { + val itemPathToItem = pathToItem + i + val schemas: LinkedHashMap, Nothing?>? = pathToSchemas.get(itemPathToItem) + if (schemas == null) { + throw RuntimeException("Validation result is invalid, schemas must exist for a pathToItem") + } + val itemSchema: JsonSchema<*> = schemas.entries.iterator().next().key + val itemInstance: Any? = itemSchema.getNewInstance(item, itemPathToItem, pathToSchemas) + items.add(itemInstance) + i += 1 + } + val newInstanceItems: FrozenList = FrozenList(items) + return newInstanceItems + } + + @Throws(ValidationException::class) + override fun validate(arg: List<*>, configuration: SchemaConfiguration?): FrozenList { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, PathToSchemasMap(), LinkedHashSet()) + val pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet) + return getNewInstance(castArg, validationMetadata.pathToItem, pathToSchemasMap) + } + + override fun getNewInstance(arg: Map<*, *>, pathToItem: List, pathToSchemas: PathToSchemasMap): FrozenMap { + val properties: LinkedHashMap = LinkedHashMap() + for((propertyName, value) in arg) { + if (!(propertyName is String)) { + throw RuntimeException("Invalid non-string key value") + } + val propertyPathToItem: List = pathToItem + propertyName + val schemas: LinkedHashMap, Nothing?>? = pathToSchemas.get(propertyPathToItem) + if (schemas == null) { + throw RuntimeException("Validation result is invalid, schemas must exist for a pathToItem") + } + val propertySchema: JsonSchema<*> = schemas.entries.iterator().next().key + val propertyInstance: Any? = propertySchema.getNewInstance(value, propertyPathToItem, pathToSchemas) + properties[propertyName] = propertyInstance + } + val castProperties: FrozenMap = FrozenMap(properties) + return castProperties + } + + @Throws(ValidationException::class) + override fun validate(arg: Map<*, *>, configuration: SchemaConfiguration?): FrozenMap { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validatedPathToSchemas = PathToSchemasMap() + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, LinkedHashSet()) + val pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet) + return getNewInstance(castArg, validationMetadata.pathToItem, pathToSchemasMap) + } + + @Throws(ValidationException::class) + override fun validate(arg: Any?, configuration: SchemaConfiguration?): Any? { + if (arg == null) { + return validate(null, configuration) + } else if (arg is Boolean) { + return validate(arg, configuration) + } else if (arg is Number) { + return validate(arg, configuration) + } else if (arg is String) { + return validate(arg, configuration) + } else if (arg is List<*>) { + return validate(arg, configuration) + } else if (arg is Map<*, *>) { + return validate(arg, configuration) + } + throw ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema") + } + override fun getNewInstance(arg: Any?, pathToItem: List, pathToSchemas: PathToSchemasMap): Any? { + if (arg == null) { + return getNewInstance( null, pathToItem, pathToSchemas) + } else if (arg is Boolean) { + return getNewInstance(arg, pathToItem, pathToSchemas) + } else if (arg is Number) { + return getNewInstance(arg, pathToItem, pathToSchemas) + } else if (arg is String) { + return getNewInstance(arg, pathToItem, pathToSchemas) + } else if (arg is List<*>) { + return getNewInstance(arg, pathToItem, pathToSchemas) + } else if (arg is Map<*, *>) { + return getNewInstance(arg, pathToItem, pathToSchemas) + } + throw RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema") + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: Nothing?, configuration: SchemaConfiguration?): IdnHostnameFormat1BoxedVoid { + return IdnHostnameFormat1BoxedVoid(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: Boolean, configuration: SchemaConfiguration?): IdnHostnameFormat1BoxedBoolean { + return IdnHostnameFormat1BoxedBoolean(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: Number, configuration: SchemaConfiguration?): IdnHostnameFormat1BoxedNumber { + return IdnHostnameFormat1BoxedNumber(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: String, configuration: SchemaConfiguration?): IdnHostnameFormat1BoxedString { + return IdnHostnameFormat1BoxedString(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: List<*>, configuration: SchemaConfiguration?): IdnHostnameFormat1BoxedList { + return IdnHostnameFormat1BoxedList(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: Map<*, *>, configuration: SchemaConfiguration?): IdnHostnameFormat1BoxedMap { + return IdnHostnameFormat1BoxedMap(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: Any?, configuration: SchemaConfiguration?): IdnHostnameFormat1Boxed { + if (arg == null) { + return validateAndBox(null, configuration) + } else if (arg is Boolean) { + return validateAndBox(arg, configuration) + } else if (arg is String) { + return validateAndBox(arg, configuration) + } else if (arg is Number) { + return validateAndBox(arg, configuration) + } else if (arg is List<*>) { + return validateAndBox(arg, configuration) + } else if (arg is Map<*, *>) { + return validateAndBox(arg, configuration) + } + throw ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema") + } + } +} diff --git a/samples/client/3_1_0_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/schemas/IfAndElseWithoutThen.kt b/samples/client/3_1_0_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/schemas/IfAndElseWithoutThen.kt new file mode 100644 index 00000000000..081637155f3 --- /dev/null +++ b/samples/client/3_1_0_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/schemas/IfAndElseWithoutThen.kt @@ -0,0 +1,860 @@ +package org.openapijsonschematools.client.components.schemas +import java.math.BigDecimal +import java.time.LocalDate +import java.time.ZonedDateTime +import java.util.UUID +import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags +import org.openapijsonschematools.client.configurations.SchemaConfiguration +import org.openapijsonschematools.client.exceptions.InvalidAdditionalPropertyException +import org.openapijsonschematools.client.exceptions.UnsetPropertyException +import org.openapijsonschematools.client.exceptions.ValidationException +import org.openapijsonschematools.client.schemas.UnsetAddPropsSetter +import org.openapijsonschematools.client.schemas.validation.BooleanSchemaValidator +import org.openapijsonschematools.client.schemas.validation.FrozenList +import org.openapijsonschematools.client.schemas.validation.FrozenMap +import org.openapijsonschematools.client.schemas.validation.JsonSchema +import org.openapijsonschematools.client.schemas.validation.JsonSchemaInfo +import org.openapijsonschematools.client.schemas.validation.ListSchemaValidator +import org.openapijsonschematools.client.schemas.validation.MapSchemaValidator +import org.openapijsonschematools.client.schemas.validation.NullSchemaValidator +import org.openapijsonschematools.client.schemas.validation.NumberSchemaValidator +import org.openapijsonschematools.client.schemas.validation.PathToSchemasMap +import org.openapijsonschematools.client.schemas.validation.StringSchemaValidator +import org.openapijsonschematools.client.schemas.validation.ValidationMetadata + +class IfAndElseWithoutThen { + // nest classes so all schemas and input/output classes can be public + + + sealed interface ElseSchemaBoxed { + fun getData(): Any? + } + + data class ElseSchemaBoxedVoid(val data: Nothing?) : ElseSchemaBoxed { + override fun getData(): Any? { + return data + } + } + + data class ElseSchemaBoxedBoolean(val data: Boolean): ElseSchemaBoxed { + override fun getData(): Any? { + return data + } + } + + data class ElseSchemaBoxedNumber(val data: Number) : ElseSchemaBoxed { + override fun getData(): Any? { + return data + } + } + + data class ElseSchemaBoxedString(val data: String) : ElseSchemaBoxed { + override fun getData(): Any? { + return data + } + } + + data class ElseSchemaBoxedList(val data: FrozenList) : ElseSchemaBoxed { + override fun getData(): Any? { + return data + } + } + + data class ElseSchemaBoxedMap(val data: FrozenMap) : ElseSchemaBoxed { + override fun getData(): Any? { + return data + } + } + + + class ElseSchema private constructor(): JsonSchema( + JsonSchemaInfo() + .multipleOf(BigDecimal("2")) + ), NullSchemaValidator, BooleanSchemaValidator, NumberSchemaValidator, StringSchemaValidator, ListSchemaValidator, ElseSchemaBoxedList>, MapSchemaValidator, ElseSchemaBoxedMap> { + + companion object { + @Volatile + private var instance: ElseSchema? = null + + fun getInstance() = + instance ?: synchronized(this) { + instance ?: ElseSchema().also { instance = it } + } + } + + @Throws(ValidationException::class) + override fun validate(arg: Nothing?, configuration: SchemaConfiguration?): Nothing? { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validatedPathToSchemas = PathToSchemasMap() + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, LinkedHashSet()) + getPathToSchemas(this, castArg, validationMetadata, pathSet) + return castArg + } + + @Throws(ValidationException::class) + override fun validate(arg: Boolean, configuration: SchemaConfiguration?): Boolean { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validatedPathToSchemas = PathToSchemasMap() + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, LinkedHashSet()) + getPathToSchemas(this, castArg, validationMetadata, pathSet) + return castArg + } + + @Throws(ValidationException::class) + override fun validate(arg: Number, configuration: SchemaConfiguration?): Number { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validatedPathToSchemas = PathToSchemasMap() + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, LinkedHashSet()) + getPathToSchemas(this, castArg, validationMetadata, pathSet) + return castArg + } + + @Throws(ValidationException::class) + fun validate(arg: Int, configuration: SchemaConfiguration?): Int { + return validate(arg as Number, configuration) as Int + } + + @Throws(ValidationException::class) + fun validate(arg: Long, configuration: SchemaConfiguration?): Long { + return validate(arg as Number, configuration) as Long + } + + @Throws(ValidationException::class) + fun validate(arg: Float, configuration: SchemaConfiguration?): Float { + return validate(arg as Number, configuration) as Float + } + + @Throws(ValidationException::class) + fun validate(arg: Double, configuration: SchemaConfiguration?): Double { + return validate(arg as Number, configuration) as Double + } + + @Throws(ValidationException::class) + override fun validate(arg: String, configuration: SchemaConfiguration?): String { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validatedPathToSchemas = PathToSchemasMap() + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, LinkedHashSet()) + getPathToSchemas(this, castArg, validationMetadata, pathSet) + return castArg + } + + @Throws(ValidationException::class) + fun validate(arg: LocalDate, configuration: SchemaConfiguration?): String { + return validate(arg.toString(), configuration) + } + + @Throws(ValidationException::class) + fun validate(arg: ZonedDateTime, configuration: SchemaConfiguration?): String { + return validate(arg.toString(), configuration) + } + + @Throws(ValidationException::class) + fun validate(arg: UUID, configuration: SchemaConfiguration?): String { + return validate(arg.toString(), configuration) + } + + override fun getNewInstance(arg: List<*>, pathToItem: List, pathToSchemas: PathToSchemasMap): FrozenList { + val items: MutableList = ArrayList() + var i: Int = 0 + for (item: Any? in arg) { + val itemPathToItem = pathToItem + i + val schemas: LinkedHashMap, Nothing?>? = pathToSchemas.get(itemPathToItem) + if (schemas == null) { + throw RuntimeException("Validation result is invalid, schemas must exist for a pathToItem") + } + val itemSchema: JsonSchema<*> = schemas.entries.iterator().next().key + val itemInstance: Any? = itemSchema.getNewInstance(item, itemPathToItem, pathToSchemas) + items.add(itemInstance) + i += 1 + } + val newInstanceItems: FrozenList = FrozenList(items) + return newInstanceItems + } + + @Throws(ValidationException::class) + override fun validate(arg: List<*>, configuration: SchemaConfiguration?): FrozenList { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, PathToSchemasMap(), LinkedHashSet()) + val pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet) + return getNewInstance(castArg, validationMetadata.pathToItem, pathToSchemasMap) + } + + override fun getNewInstance(arg: Map<*, *>, pathToItem: List, pathToSchemas: PathToSchemasMap): FrozenMap { + val properties: LinkedHashMap = LinkedHashMap() + for((propertyName, value) in arg) { + if (!(propertyName is String)) { + throw RuntimeException("Invalid non-string key value") + } + val propertyPathToItem: List = pathToItem + propertyName + val schemas: LinkedHashMap, Nothing?>? = pathToSchemas.get(propertyPathToItem) + if (schemas == null) { + throw RuntimeException("Validation result is invalid, schemas must exist for a pathToItem") + } + val propertySchema: JsonSchema<*> = schemas.entries.iterator().next().key + val propertyInstance: Any? = propertySchema.getNewInstance(value, propertyPathToItem, pathToSchemas) + properties[propertyName] = propertyInstance + } + val castProperties: FrozenMap = FrozenMap(properties) + return castProperties + } + + @Throws(ValidationException::class) + override fun validate(arg: Map<*, *>, configuration: SchemaConfiguration?): FrozenMap { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validatedPathToSchemas = PathToSchemasMap() + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, LinkedHashSet()) + val pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet) + return getNewInstance(castArg, validationMetadata.pathToItem, pathToSchemasMap) + } + + @Throws(ValidationException::class) + override fun validate(arg: Any?, configuration: SchemaConfiguration?): Any? { + if (arg == null) { + return validate(null, configuration) + } else if (arg is Boolean) { + return validate(arg, configuration) + } else if (arg is Number) { + return validate(arg, configuration) + } else if (arg is String) { + return validate(arg, configuration) + } else if (arg is List<*>) { + return validate(arg, configuration) + } else if (arg is Map<*, *>) { + return validate(arg, configuration) + } + throw ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema") + } + override fun getNewInstance(arg: Any?, pathToItem: List, pathToSchemas: PathToSchemasMap): Any? { + if (arg == null) { + return getNewInstance( null, pathToItem, pathToSchemas) + } else if (arg is Boolean) { + return getNewInstance(arg, pathToItem, pathToSchemas) + } else if (arg is Number) { + return getNewInstance(arg, pathToItem, pathToSchemas) + } else if (arg is String) { + return getNewInstance(arg, pathToItem, pathToSchemas) + } else if (arg is List<*>) { + return getNewInstance(arg, pathToItem, pathToSchemas) + } else if (arg is Map<*, *>) { + return getNewInstance(arg, pathToItem, pathToSchemas) + } + throw RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema") + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: Nothing?, configuration: SchemaConfiguration?): ElseSchemaBoxedVoid { + return ElseSchemaBoxedVoid(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: Boolean, configuration: SchemaConfiguration?): ElseSchemaBoxedBoolean { + return ElseSchemaBoxedBoolean(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: Number, configuration: SchemaConfiguration?): ElseSchemaBoxedNumber { + return ElseSchemaBoxedNumber(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: String, configuration: SchemaConfiguration?): ElseSchemaBoxedString { + return ElseSchemaBoxedString(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: List<*>, configuration: SchemaConfiguration?): ElseSchemaBoxedList { + return ElseSchemaBoxedList(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: Map<*, *>, configuration: SchemaConfiguration?): ElseSchemaBoxedMap { + return ElseSchemaBoxedMap(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: Any?, configuration: SchemaConfiguration?): ElseSchemaBoxed { + if (arg == null) { + return validateAndBox(null, configuration) + } else if (arg is Boolean) { + return validateAndBox(arg, configuration) + } else if (arg is String) { + return validateAndBox(arg, configuration) + } else if (arg is Number) { + return validateAndBox(arg, configuration) + } else if (arg is List<*>) { + return validateAndBox(arg, configuration) + } else if (arg is Map<*, *>) { + return validateAndBox(arg, configuration) + } + throw ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema") + } + } + + sealed interface IfSchemaBoxed { + fun getData(): Any? + } + + data class IfSchemaBoxedVoid(val data: Nothing?) : IfSchemaBoxed { + override fun getData(): Any? { + return data + } + } + + data class IfSchemaBoxedBoolean(val data: Boolean): IfSchemaBoxed { + override fun getData(): Any? { + return data + } + } + + data class IfSchemaBoxedNumber(val data: Number) : IfSchemaBoxed { + override fun getData(): Any? { + return data + } + } + + data class IfSchemaBoxedString(val data: String) : IfSchemaBoxed { + override fun getData(): Any? { + return data + } + } + + data class IfSchemaBoxedList(val data: FrozenList) : IfSchemaBoxed { + override fun getData(): Any? { + return data + } + } + + data class IfSchemaBoxedMap(val data: FrozenMap) : IfSchemaBoxed { + override fun getData(): Any? { + return data + } + } + + + class IfSchema private constructor(): JsonSchema( + JsonSchemaInfo() + .exclusiveMaximum(0) + ), NullSchemaValidator, BooleanSchemaValidator, NumberSchemaValidator, StringSchemaValidator, ListSchemaValidator, IfSchemaBoxedList>, MapSchemaValidator, IfSchemaBoxedMap> { + + companion object { + @Volatile + private var instance: IfSchema? = null + + fun getInstance() = + instance ?: synchronized(this) { + instance ?: IfSchema().also { instance = it } + } + } + + @Throws(ValidationException::class) + override fun validate(arg: Nothing?, configuration: SchemaConfiguration?): Nothing? { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validatedPathToSchemas = PathToSchemasMap() + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, LinkedHashSet()) + getPathToSchemas(this, castArg, validationMetadata, pathSet) + return castArg + } + + @Throws(ValidationException::class) + override fun validate(arg: Boolean, configuration: SchemaConfiguration?): Boolean { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validatedPathToSchemas = PathToSchemasMap() + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, LinkedHashSet()) + getPathToSchemas(this, castArg, validationMetadata, pathSet) + return castArg + } + + @Throws(ValidationException::class) + override fun validate(arg: Number, configuration: SchemaConfiguration?): Number { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validatedPathToSchemas = PathToSchemasMap() + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, LinkedHashSet()) + getPathToSchemas(this, castArg, validationMetadata, pathSet) + return castArg + } + + @Throws(ValidationException::class) + fun validate(arg: Int, configuration: SchemaConfiguration?): Int { + return validate(arg as Number, configuration) as Int + } + + @Throws(ValidationException::class) + fun validate(arg: Long, configuration: SchemaConfiguration?): Long { + return validate(arg as Number, configuration) as Long + } + + @Throws(ValidationException::class) + fun validate(arg: Float, configuration: SchemaConfiguration?): Float { + return validate(arg as Number, configuration) as Float + } + + @Throws(ValidationException::class) + fun validate(arg: Double, configuration: SchemaConfiguration?): Double { + return validate(arg as Number, configuration) as Double + } + + @Throws(ValidationException::class) + override fun validate(arg: String, configuration: SchemaConfiguration?): String { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validatedPathToSchemas = PathToSchemasMap() + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, LinkedHashSet()) + getPathToSchemas(this, castArg, validationMetadata, pathSet) + return castArg + } + + @Throws(ValidationException::class) + fun validate(arg: LocalDate, configuration: SchemaConfiguration?): String { + return validate(arg.toString(), configuration) + } + + @Throws(ValidationException::class) + fun validate(arg: ZonedDateTime, configuration: SchemaConfiguration?): String { + return validate(arg.toString(), configuration) + } + + @Throws(ValidationException::class) + fun validate(arg: UUID, configuration: SchemaConfiguration?): String { + return validate(arg.toString(), configuration) + } + + override fun getNewInstance(arg: List<*>, pathToItem: List, pathToSchemas: PathToSchemasMap): FrozenList { + val items: MutableList = ArrayList() + var i: Int = 0 + for (item: Any? in arg) { + val itemPathToItem = pathToItem + i + val schemas: LinkedHashMap, Nothing?>? = pathToSchemas.get(itemPathToItem) + if (schemas == null) { + throw RuntimeException("Validation result is invalid, schemas must exist for a pathToItem") + } + val itemSchema: JsonSchema<*> = schemas.entries.iterator().next().key + val itemInstance: Any? = itemSchema.getNewInstance(item, itemPathToItem, pathToSchemas) + items.add(itemInstance) + i += 1 + } + val newInstanceItems: FrozenList = FrozenList(items) + return newInstanceItems + } + + @Throws(ValidationException::class) + override fun validate(arg: List<*>, configuration: SchemaConfiguration?): FrozenList { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, PathToSchemasMap(), LinkedHashSet()) + val pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet) + return getNewInstance(castArg, validationMetadata.pathToItem, pathToSchemasMap) + } + + override fun getNewInstance(arg: Map<*, *>, pathToItem: List, pathToSchemas: PathToSchemasMap): FrozenMap { + val properties: LinkedHashMap = LinkedHashMap() + for((propertyName, value) in arg) { + if (!(propertyName is String)) { + throw RuntimeException("Invalid non-string key value") + } + val propertyPathToItem: List = pathToItem + propertyName + val schemas: LinkedHashMap, Nothing?>? = pathToSchemas.get(propertyPathToItem) + if (schemas == null) { + throw RuntimeException("Validation result is invalid, schemas must exist for a pathToItem") + } + val propertySchema: JsonSchema<*> = schemas.entries.iterator().next().key + val propertyInstance: Any? = propertySchema.getNewInstance(value, propertyPathToItem, pathToSchemas) + properties[propertyName] = propertyInstance + } + val castProperties: FrozenMap = FrozenMap(properties) + return castProperties + } + + @Throws(ValidationException::class) + override fun validate(arg: Map<*, *>, configuration: SchemaConfiguration?): FrozenMap { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validatedPathToSchemas = PathToSchemasMap() + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, LinkedHashSet()) + val pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet) + return getNewInstance(castArg, validationMetadata.pathToItem, pathToSchemasMap) + } + + @Throws(ValidationException::class) + override fun validate(arg: Any?, configuration: SchemaConfiguration?): Any? { + if (arg == null) { + return validate(null, configuration) + } else if (arg is Boolean) { + return validate(arg, configuration) + } else if (arg is Number) { + return validate(arg, configuration) + } else if (arg is String) { + return validate(arg, configuration) + } else if (arg is List<*>) { + return validate(arg, configuration) + } else if (arg is Map<*, *>) { + return validate(arg, configuration) + } + throw ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema") + } + override fun getNewInstance(arg: Any?, pathToItem: List, pathToSchemas: PathToSchemasMap): Any? { + if (arg == null) { + return getNewInstance( null, pathToItem, pathToSchemas) + } else if (arg is Boolean) { + return getNewInstance(arg, pathToItem, pathToSchemas) + } else if (arg is Number) { + return getNewInstance(arg, pathToItem, pathToSchemas) + } else if (arg is String) { + return getNewInstance(arg, pathToItem, pathToSchemas) + } else if (arg is List<*>) { + return getNewInstance(arg, pathToItem, pathToSchemas) + } else if (arg is Map<*, *>) { + return getNewInstance(arg, pathToItem, pathToSchemas) + } + throw RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema") + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: Nothing?, configuration: SchemaConfiguration?): IfSchemaBoxedVoid { + return IfSchemaBoxedVoid(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: Boolean, configuration: SchemaConfiguration?): IfSchemaBoxedBoolean { + return IfSchemaBoxedBoolean(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: Number, configuration: SchemaConfiguration?): IfSchemaBoxedNumber { + return IfSchemaBoxedNumber(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: String, configuration: SchemaConfiguration?): IfSchemaBoxedString { + return IfSchemaBoxedString(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: List<*>, configuration: SchemaConfiguration?): IfSchemaBoxedList { + return IfSchemaBoxedList(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: Map<*, *>, configuration: SchemaConfiguration?): IfSchemaBoxedMap { + return IfSchemaBoxedMap(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: Any?, configuration: SchemaConfiguration?): IfSchemaBoxed { + if (arg == null) { + return validateAndBox(null, configuration) + } else if (arg is Boolean) { + return validateAndBox(arg, configuration) + } else if (arg is String) { + return validateAndBox(arg, configuration) + } else if (arg is Number) { + return validateAndBox(arg, configuration) + } else if (arg is List<*>) { + return validateAndBox(arg, configuration) + } else if (arg is Map<*, *>) { + return validateAndBox(arg, configuration) + } + throw ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema") + } + } + + sealed interface IfAndElseWithoutThen1Boxed { + fun getData(): Any? + } + + data class IfAndElseWithoutThen1BoxedVoid(val data: Nothing?) : IfAndElseWithoutThen1Boxed { + override fun getData(): Any? { + return data + } + } + + data class IfAndElseWithoutThen1BoxedBoolean(val data: Boolean): IfAndElseWithoutThen1Boxed { + override fun getData(): Any? { + return data + } + } + + data class IfAndElseWithoutThen1BoxedNumber(val data: Number) : IfAndElseWithoutThen1Boxed { + override fun getData(): Any? { + return data + } + } + + data class IfAndElseWithoutThen1BoxedString(val data: String) : IfAndElseWithoutThen1Boxed { + override fun getData(): Any? { + return data + } + } + + data class IfAndElseWithoutThen1BoxedList(val data: FrozenList) : IfAndElseWithoutThen1Boxed { + override fun getData(): Any? { + return data + } + } + + data class IfAndElseWithoutThen1BoxedMap(val data: FrozenMap) : IfAndElseWithoutThen1Boxed { + override fun getData(): Any? { + return data + } + } + + + class IfAndElseWithoutThen1 private constructor(): JsonSchema( + JsonSchemaInfo() + .ifSchema(IfSchema::class.java) + .elseSchema(ElseSchema::class.java) + ), NullSchemaValidator, BooleanSchemaValidator, NumberSchemaValidator, StringSchemaValidator, ListSchemaValidator, IfAndElseWithoutThen1BoxedList>, MapSchemaValidator, IfAndElseWithoutThen1BoxedMap> { + /* + NOTE: This class is auto generated by OpenAPI JSON Schema Generator. + Ref: https://github.com/openapi-json-schema-tools/openapi-json-schema-generator + + Do not edit the class manually. + */ + + companion object { + @Volatile + private var instance: IfAndElseWithoutThen1? = null + + fun getInstance() = + instance ?: synchronized(this) { + instance ?: IfAndElseWithoutThen1().also { instance = it } + } + } + + @Throws(ValidationException::class) + override fun validate(arg: Nothing?, configuration: SchemaConfiguration?): Nothing? { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validatedPathToSchemas = PathToSchemasMap() + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, LinkedHashSet()) + getPathToSchemas(this, castArg, validationMetadata, pathSet) + return castArg + } + + @Throws(ValidationException::class) + override fun validate(arg: Boolean, configuration: SchemaConfiguration?): Boolean { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validatedPathToSchemas = PathToSchemasMap() + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, LinkedHashSet()) + getPathToSchemas(this, castArg, validationMetadata, pathSet) + return castArg + } + + @Throws(ValidationException::class) + override fun validate(arg: Number, configuration: SchemaConfiguration?): Number { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validatedPathToSchemas = PathToSchemasMap() + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, LinkedHashSet()) + getPathToSchemas(this, castArg, validationMetadata, pathSet) + return castArg + } + + @Throws(ValidationException::class) + fun validate(arg: Int, configuration: SchemaConfiguration?): Int { + return validate(arg as Number, configuration) as Int + } + + @Throws(ValidationException::class) + fun validate(arg: Long, configuration: SchemaConfiguration?): Long { + return validate(arg as Number, configuration) as Long + } + + @Throws(ValidationException::class) + fun validate(arg: Float, configuration: SchemaConfiguration?): Float { + return validate(arg as Number, configuration) as Float + } + + @Throws(ValidationException::class) + fun validate(arg: Double, configuration: SchemaConfiguration?): Double { + return validate(arg as Number, configuration) as Double + } + + @Throws(ValidationException::class) + override fun validate(arg: String, configuration: SchemaConfiguration?): String { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validatedPathToSchemas = PathToSchemasMap() + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, LinkedHashSet()) + getPathToSchemas(this, castArg, validationMetadata, pathSet) + return castArg + } + + @Throws(ValidationException::class) + fun validate(arg: LocalDate, configuration: SchemaConfiguration?): String { + return validate(arg.toString(), configuration) + } + + @Throws(ValidationException::class) + fun validate(arg: ZonedDateTime, configuration: SchemaConfiguration?): String { + return validate(arg.toString(), configuration) + } + + @Throws(ValidationException::class) + fun validate(arg: UUID, configuration: SchemaConfiguration?): String { + return validate(arg.toString(), configuration) + } + + override fun getNewInstance(arg: List<*>, pathToItem: List, pathToSchemas: PathToSchemasMap): FrozenList { + val items: MutableList = ArrayList() + var i: Int = 0 + for (item: Any? in arg) { + val itemPathToItem = pathToItem + i + val schemas: LinkedHashMap, Nothing?>? = pathToSchemas.get(itemPathToItem) + if (schemas == null) { + throw RuntimeException("Validation result is invalid, schemas must exist for a pathToItem") + } + val itemSchema: JsonSchema<*> = schemas.entries.iterator().next().key + val itemInstance: Any? = itemSchema.getNewInstance(item, itemPathToItem, pathToSchemas) + items.add(itemInstance) + i += 1 + } + val newInstanceItems: FrozenList = FrozenList(items) + return newInstanceItems + } + + @Throws(ValidationException::class) + override fun validate(arg: List<*>, configuration: SchemaConfiguration?): FrozenList { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, PathToSchemasMap(), LinkedHashSet()) + val pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet) + return getNewInstance(castArg, validationMetadata.pathToItem, pathToSchemasMap) + } + + override fun getNewInstance(arg: Map<*, *>, pathToItem: List, pathToSchemas: PathToSchemasMap): FrozenMap { + val properties: LinkedHashMap = LinkedHashMap() + for((propertyName, value) in arg) { + if (!(propertyName is String)) { + throw RuntimeException("Invalid non-string key value") + } + val propertyPathToItem: List = pathToItem + propertyName + val schemas: LinkedHashMap, Nothing?>? = pathToSchemas.get(propertyPathToItem) + if (schemas == null) { + throw RuntimeException("Validation result is invalid, schemas must exist for a pathToItem") + } + val propertySchema: JsonSchema<*> = schemas.entries.iterator().next().key + val propertyInstance: Any? = propertySchema.getNewInstance(value, propertyPathToItem, pathToSchemas) + properties[propertyName] = propertyInstance + } + val castProperties: FrozenMap = FrozenMap(properties) + return castProperties + } + + @Throws(ValidationException::class) + override fun validate(arg: Map<*, *>, configuration: SchemaConfiguration?): FrozenMap { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validatedPathToSchemas = PathToSchemasMap() + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, LinkedHashSet()) + val pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet) + return getNewInstance(castArg, validationMetadata.pathToItem, pathToSchemasMap) + } + + @Throws(ValidationException::class) + override fun validate(arg: Any?, configuration: SchemaConfiguration?): Any? { + if (arg == null) { + return validate(null, configuration) + } else if (arg is Boolean) { + return validate(arg, configuration) + } else if (arg is Number) { + return validate(arg, configuration) + } else if (arg is String) { + return validate(arg, configuration) + } else if (arg is List<*>) { + return validate(arg, configuration) + } else if (arg is Map<*, *>) { + return validate(arg, configuration) + } + throw ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema") + } + override fun getNewInstance(arg: Any?, pathToItem: List, pathToSchemas: PathToSchemasMap): Any? { + if (arg == null) { + return getNewInstance( null, pathToItem, pathToSchemas) + } else if (arg is Boolean) { + return getNewInstance(arg, pathToItem, pathToSchemas) + } else if (arg is Number) { + return getNewInstance(arg, pathToItem, pathToSchemas) + } else if (arg is String) { + return getNewInstance(arg, pathToItem, pathToSchemas) + } else if (arg is List<*>) { + return getNewInstance(arg, pathToItem, pathToSchemas) + } else if (arg is Map<*, *>) { + return getNewInstance(arg, pathToItem, pathToSchemas) + } + throw RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema") + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: Nothing?, configuration: SchemaConfiguration?): IfAndElseWithoutThen1BoxedVoid { + return IfAndElseWithoutThen1BoxedVoid(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: Boolean, configuration: SchemaConfiguration?): IfAndElseWithoutThen1BoxedBoolean { + return IfAndElseWithoutThen1BoxedBoolean(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: Number, configuration: SchemaConfiguration?): IfAndElseWithoutThen1BoxedNumber { + return IfAndElseWithoutThen1BoxedNumber(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: String, configuration: SchemaConfiguration?): IfAndElseWithoutThen1BoxedString { + return IfAndElseWithoutThen1BoxedString(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: List<*>, configuration: SchemaConfiguration?): IfAndElseWithoutThen1BoxedList { + return IfAndElseWithoutThen1BoxedList(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: Map<*, *>, configuration: SchemaConfiguration?): IfAndElseWithoutThen1BoxedMap { + return IfAndElseWithoutThen1BoxedMap(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: Any?, configuration: SchemaConfiguration?): IfAndElseWithoutThen1Boxed { + if (arg == null) { + return validateAndBox(null, configuration) + } else if (arg is Boolean) { + return validateAndBox(arg, configuration) + } else if (arg is String) { + return validateAndBox(arg, configuration) + } else if (arg is Number) { + return validateAndBox(arg, configuration) + } else if (arg is List<*>) { + return validateAndBox(arg, configuration) + } else if (arg is Map<*, *>) { + return validateAndBox(arg, configuration) + } + throw ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema") + } + } +} diff --git a/samples/client/3_1_0_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/schemas/IfAndThenWithoutElse.kt b/samples/client/3_1_0_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/schemas/IfAndThenWithoutElse.kt new file mode 100644 index 00000000000..89e68480e78 --- /dev/null +++ b/samples/client/3_1_0_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/schemas/IfAndThenWithoutElse.kt @@ -0,0 +1,859 @@ +package org.openapijsonschematools.client.components.schemas +import java.time.LocalDate +import java.time.ZonedDateTime +import java.util.UUID +import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags +import org.openapijsonschematools.client.configurations.SchemaConfiguration +import org.openapijsonschematools.client.exceptions.InvalidAdditionalPropertyException +import org.openapijsonschematools.client.exceptions.UnsetPropertyException +import org.openapijsonschematools.client.exceptions.ValidationException +import org.openapijsonschematools.client.schemas.UnsetAddPropsSetter +import org.openapijsonschematools.client.schemas.validation.BooleanSchemaValidator +import org.openapijsonschematools.client.schemas.validation.FrozenList +import org.openapijsonschematools.client.schemas.validation.FrozenMap +import org.openapijsonschematools.client.schemas.validation.JsonSchema +import org.openapijsonschematools.client.schemas.validation.JsonSchemaInfo +import org.openapijsonschematools.client.schemas.validation.ListSchemaValidator +import org.openapijsonschematools.client.schemas.validation.MapSchemaValidator +import org.openapijsonschematools.client.schemas.validation.NullSchemaValidator +import org.openapijsonschematools.client.schemas.validation.NumberSchemaValidator +import org.openapijsonschematools.client.schemas.validation.PathToSchemasMap +import org.openapijsonschematools.client.schemas.validation.StringSchemaValidator +import org.openapijsonschematools.client.schemas.validation.ValidationMetadata + +class IfAndThenWithoutElse { + // nest classes so all schemas and input/output classes can be public + + + sealed interface IfSchemaBoxed { + fun getData(): Any? + } + + data class IfSchemaBoxedVoid(val data: Nothing?) : IfSchemaBoxed { + override fun getData(): Any? { + return data + } + } + + data class IfSchemaBoxedBoolean(val data: Boolean): IfSchemaBoxed { + override fun getData(): Any? { + return data + } + } + + data class IfSchemaBoxedNumber(val data: Number) : IfSchemaBoxed { + override fun getData(): Any? { + return data + } + } + + data class IfSchemaBoxedString(val data: String) : IfSchemaBoxed { + override fun getData(): Any? { + return data + } + } + + data class IfSchemaBoxedList(val data: FrozenList) : IfSchemaBoxed { + override fun getData(): Any? { + return data + } + } + + data class IfSchemaBoxedMap(val data: FrozenMap) : IfSchemaBoxed { + override fun getData(): Any? { + return data + } + } + + + class IfSchema private constructor(): JsonSchema( + JsonSchemaInfo() + .exclusiveMaximum(0) + ), NullSchemaValidator, BooleanSchemaValidator, NumberSchemaValidator, StringSchemaValidator, ListSchemaValidator, IfSchemaBoxedList>, MapSchemaValidator, IfSchemaBoxedMap> { + + companion object { + @Volatile + private var instance: IfSchema? = null + + fun getInstance() = + instance ?: synchronized(this) { + instance ?: IfSchema().also { instance = it } + } + } + + @Throws(ValidationException::class) + override fun validate(arg: Nothing?, configuration: SchemaConfiguration?): Nothing? { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validatedPathToSchemas = PathToSchemasMap() + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, LinkedHashSet()) + getPathToSchemas(this, castArg, validationMetadata, pathSet) + return castArg + } + + @Throws(ValidationException::class) + override fun validate(arg: Boolean, configuration: SchemaConfiguration?): Boolean { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validatedPathToSchemas = PathToSchemasMap() + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, LinkedHashSet()) + getPathToSchemas(this, castArg, validationMetadata, pathSet) + return castArg + } + + @Throws(ValidationException::class) + override fun validate(arg: Number, configuration: SchemaConfiguration?): Number { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validatedPathToSchemas = PathToSchemasMap() + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, LinkedHashSet()) + getPathToSchemas(this, castArg, validationMetadata, pathSet) + return castArg + } + + @Throws(ValidationException::class) + fun validate(arg: Int, configuration: SchemaConfiguration?): Int { + return validate(arg as Number, configuration) as Int + } + + @Throws(ValidationException::class) + fun validate(arg: Long, configuration: SchemaConfiguration?): Long { + return validate(arg as Number, configuration) as Long + } + + @Throws(ValidationException::class) + fun validate(arg: Float, configuration: SchemaConfiguration?): Float { + return validate(arg as Number, configuration) as Float + } + + @Throws(ValidationException::class) + fun validate(arg: Double, configuration: SchemaConfiguration?): Double { + return validate(arg as Number, configuration) as Double + } + + @Throws(ValidationException::class) + override fun validate(arg: String, configuration: SchemaConfiguration?): String { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validatedPathToSchemas = PathToSchemasMap() + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, LinkedHashSet()) + getPathToSchemas(this, castArg, validationMetadata, pathSet) + return castArg + } + + @Throws(ValidationException::class) + fun validate(arg: LocalDate, configuration: SchemaConfiguration?): String { + return validate(arg.toString(), configuration) + } + + @Throws(ValidationException::class) + fun validate(arg: ZonedDateTime, configuration: SchemaConfiguration?): String { + return validate(arg.toString(), configuration) + } + + @Throws(ValidationException::class) + fun validate(arg: UUID, configuration: SchemaConfiguration?): String { + return validate(arg.toString(), configuration) + } + + override fun getNewInstance(arg: List<*>, pathToItem: List, pathToSchemas: PathToSchemasMap): FrozenList { + val items: MutableList = ArrayList() + var i: Int = 0 + for (item: Any? in arg) { + val itemPathToItem = pathToItem + i + val schemas: LinkedHashMap, Nothing?>? = pathToSchemas.get(itemPathToItem) + if (schemas == null) { + throw RuntimeException("Validation result is invalid, schemas must exist for a pathToItem") + } + val itemSchema: JsonSchema<*> = schemas.entries.iterator().next().key + val itemInstance: Any? = itemSchema.getNewInstance(item, itemPathToItem, pathToSchemas) + items.add(itemInstance) + i += 1 + } + val newInstanceItems: FrozenList = FrozenList(items) + return newInstanceItems + } + + @Throws(ValidationException::class) + override fun validate(arg: List<*>, configuration: SchemaConfiguration?): FrozenList { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, PathToSchemasMap(), LinkedHashSet()) + val pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet) + return getNewInstance(castArg, validationMetadata.pathToItem, pathToSchemasMap) + } + + override fun getNewInstance(arg: Map<*, *>, pathToItem: List, pathToSchemas: PathToSchemasMap): FrozenMap { + val properties: LinkedHashMap = LinkedHashMap() + for((propertyName, value) in arg) { + if (!(propertyName is String)) { + throw RuntimeException("Invalid non-string key value") + } + val propertyPathToItem: List = pathToItem + propertyName + val schemas: LinkedHashMap, Nothing?>? = pathToSchemas.get(propertyPathToItem) + if (schemas == null) { + throw RuntimeException("Validation result is invalid, schemas must exist for a pathToItem") + } + val propertySchema: JsonSchema<*> = schemas.entries.iterator().next().key + val propertyInstance: Any? = propertySchema.getNewInstance(value, propertyPathToItem, pathToSchemas) + properties[propertyName] = propertyInstance + } + val castProperties: FrozenMap = FrozenMap(properties) + return castProperties + } + + @Throws(ValidationException::class) + override fun validate(arg: Map<*, *>, configuration: SchemaConfiguration?): FrozenMap { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validatedPathToSchemas = PathToSchemasMap() + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, LinkedHashSet()) + val pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet) + return getNewInstance(castArg, validationMetadata.pathToItem, pathToSchemasMap) + } + + @Throws(ValidationException::class) + override fun validate(arg: Any?, configuration: SchemaConfiguration?): Any? { + if (arg == null) { + return validate(null, configuration) + } else if (arg is Boolean) { + return validate(arg, configuration) + } else if (arg is Number) { + return validate(arg, configuration) + } else if (arg is String) { + return validate(arg, configuration) + } else if (arg is List<*>) { + return validate(arg, configuration) + } else if (arg is Map<*, *>) { + return validate(arg, configuration) + } + throw ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema") + } + override fun getNewInstance(arg: Any?, pathToItem: List, pathToSchemas: PathToSchemasMap): Any? { + if (arg == null) { + return getNewInstance( null, pathToItem, pathToSchemas) + } else if (arg is Boolean) { + return getNewInstance(arg, pathToItem, pathToSchemas) + } else if (arg is Number) { + return getNewInstance(arg, pathToItem, pathToSchemas) + } else if (arg is String) { + return getNewInstance(arg, pathToItem, pathToSchemas) + } else if (arg is List<*>) { + return getNewInstance(arg, pathToItem, pathToSchemas) + } else if (arg is Map<*, *>) { + return getNewInstance(arg, pathToItem, pathToSchemas) + } + throw RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema") + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: Nothing?, configuration: SchemaConfiguration?): IfSchemaBoxedVoid { + return IfSchemaBoxedVoid(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: Boolean, configuration: SchemaConfiguration?): IfSchemaBoxedBoolean { + return IfSchemaBoxedBoolean(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: Number, configuration: SchemaConfiguration?): IfSchemaBoxedNumber { + return IfSchemaBoxedNumber(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: String, configuration: SchemaConfiguration?): IfSchemaBoxedString { + return IfSchemaBoxedString(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: List<*>, configuration: SchemaConfiguration?): IfSchemaBoxedList { + return IfSchemaBoxedList(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: Map<*, *>, configuration: SchemaConfiguration?): IfSchemaBoxedMap { + return IfSchemaBoxedMap(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: Any?, configuration: SchemaConfiguration?): IfSchemaBoxed { + if (arg == null) { + return validateAndBox(null, configuration) + } else if (arg is Boolean) { + return validateAndBox(arg, configuration) + } else if (arg is String) { + return validateAndBox(arg, configuration) + } else if (arg is Number) { + return validateAndBox(arg, configuration) + } else if (arg is List<*>) { + return validateAndBox(arg, configuration) + } else if (arg is Map<*, *>) { + return validateAndBox(arg, configuration) + } + throw ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema") + } + } + + sealed interface ThenBoxed { + fun getData(): Any? + } + + data class ThenBoxedVoid(val data: Nothing?) : ThenBoxed { + override fun getData(): Any? { + return data + } + } + + data class ThenBoxedBoolean(val data: Boolean): ThenBoxed { + override fun getData(): Any? { + return data + } + } + + data class ThenBoxedNumber(val data: Number) : ThenBoxed { + override fun getData(): Any? { + return data + } + } + + data class ThenBoxedString(val data: String) : ThenBoxed { + override fun getData(): Any? { + return data + } + } + + data class ThenBoxedList(val data: FrozenList) : ThenBoxed { + override fun getData(): Any? { + return data + } + } + + data class ThenBoxedMap(val data: FrozenMap) : ThenBoxed { + override fun getData(): Any? { + return data + } + } + + + class Then private constructor(): JsonSchema( + JsonSchemaInfo() + .minimum(-10) + ), NullSchemaValidator, BooleanSchemaValidator, NumberSchemaValidator, StringSchemaValidator, ListSchemaValidator, ThenBoxedList>, MapSchemaValidator, ThenBoxedMap> { + + companion object { + @Volatile + private var instance: Then? = null + + fun getInstance() = + instance ?: synchronized(this) { + instance ?: Then().also { instance = it } + } + } + + @Throws(ValidationException::class) + override fun validate(arg: Nothing?, configuration: SchemaConfiguration?): Nothing? { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validatedPathToSchemas = PathToSchemasMap() + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, LinkedHashSet()) + getPathToSchemas(this, castArg, validationMetadata, pathSet) + return castArg + } + + @Throws(ValidationException::class) + override fun validate(arg: Boolean, configuration: SchemaConfiguration?): Boolean { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validatedPathToSchemas = PathToSchemasMap() + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, LinkedHashSet()) + getPathToSchemas(this, castArg, validationMetadata, pathSet) + return castArg + } + + @Throws(ValidationException::class) + override fun validate(arg: Number, configuration: SchemaConfiguration?): Number { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validatedPathToSchemas = PathToSchemasMap() + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, LinkedHashSet()) + getPathToSchemas(this, castArg, validationMetadata, pathSet) + return castArg + } + + @Throws(ValidationException::class) + fun validate(arg: Int, configuration: SchemaConfiguration?): Int { + return validate(arg as Number, configuration) as Int + } + + @Throws(ValidationException::class) + fun validate(arg: Long, configuration: SchemaConfiguration?): Long { + return validate(arg as Number, configuration) as Long + } + + @Throws(ValidationException::class) + fun validate(arg: Float, configuration: SchemaConfiguration?): Float { + return validate(arg as Number, configuration) as Float + } + + @Throws(ValidationException::class) + fun validate(arg: Double, configuration: SchemaConfiguration?): Double { + return validate(arg as Number, configuration) as Double + } + + @Throws(ValidationException::class) + override fun validate(arg: String, configuration: SchemaConfiguration?): String { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validatedPathToSchemas = PathToSchemasMap() + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, LinkedHashSet()) + getPathToSchemas(this, castArg, validationMetadata, pathSet) + return castArg + } + + @Throws(ValidationException::class) + fun validate(arg: LocalDate, configuration: SchemaConfiguration?): String { + return validate(arg.toString(), configuration) + } + + @Throws(ValidationException::class) + fun validate(arg: ZonedDateTime, configuration: SchemaConfiguration?): String { + return validate(arg.toString(), configuration) + } + + @Throws(ValidationException::class) + fun validate(arg: UUID, configuration: SchemaConfiguration?): String { + return validate(arg.toString(), configuration) + } + + override fun getNewInstance(arg: List<*>, pathToItem: List, pathToSchemas: PathToSchemasMap): FrozenList { + val items: MutableList = ArrayList() + var i: Int = 0 + for (item: Any? in arg) { + val itemPathToItem = pathToItem + i + val schemas: LinkedHashMap, Nothing?>? = pathToSchemas.get(itemPathToItem) + if (schemas == null) { + throw RuntimeException("Validation result is invalid, schemas must exist for a pathToItem") + } + val itemSchema: JsonSchema<*> = schemas.entries.iterator().next().key + val itemInstance: Any? = itemSchema.getNewInstance(item, itemPathToItem, pathToSchemas) + items.add(itemInstance) + i += 1 + } + val newInstanceItems: FrozenList = FrozenList(items) + return newInstanceItems + } + + @Throws(ValidationException::class) + override fun validate(arg: List<*>, configuration: SchemaConfiguration?): FrozenList { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, PathToSchemasMap(), LinkedHashSet()) + val pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet) + return getNewInstance(castArg, validationMetadata.pathToItem, pathToSchemasMap) + } + + override fun getNewInstance(arg: Map<*, *>, pathToItem: List, pathToSchemas: PathToSchemasMap): FrozenMap { + val properties: LinkedHashMap = LinkedHashMap() + for((propertyName, value) in arg) { + if (!(propertyName is String)) { + throw RuntimeException("Invalid non-string key value") + } + val propertyPathToItem: List = pathToItem + propertyName + val schemas: LinkedHashMap, Nothing?>? = pathToSchemas.get(propertyPathToItem) + if (schemas == null) { + throw RuntimeException("Validation result is invalid, schemas must exist for a pathToItem") + } + val propertySchema: JsonSchema<*> = schemas.entries.iterator().next().key + val propertyInstance: Any? = propertySchema.getNewInstance(value, propertyPathToItem, pathToSchemas) + properties[propertyName] = propertyInstance + } + val castProperties: FrozenMap = FrozenMap(properties) + return castProperties + } + + @Throws(ValidationException::class) + override fun validate(arg: Map<*, *>, configuration: SchemaConfiguration?): FrozenMap { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validatedPathToSchemas = PathToSchemasMap() + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, LinkedHashSet()) + val pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet) + return getNewInstance(castArg, validationMetadata.pathToItem, pathToSchemasMap) + } + + @Throws(ValidationException::class) + override fun validate(arg: Any?, configuration: SchemaConfiguration?): Any? { + if (arg == null) { + return validate(null, configuration) + } else if (arg is Boolean) { + return validate(arg, configuration) + } else if (arg is Number) { + return validate(arg, configuration) + } else if (arg is String) { + return validate(arg, configuration) + } else if (arg is List<*>) { + return validate(arg, configuration) + } else if (arg is Map<*, *>) { + return validate(arg, configuration) + } + throw ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema") + } + override fun getNewInstance(arg: Any?, pathToItem: List, pathToSchemas: PathToSchemasMap): Any? { + if (arg == null) { + return getNewInstance( null, pathToItem, pathToSchemas) + } else if (arg is Boolean) { + return getNewInstance(arg, pathToItem, pathToSchemas) + } else if (arg is Number) { + return getNewInstance(arg, pathToItem, pathToSchemas) + } else if (arg is String) { + return getNewInstance(arg, pathToItem, pathToSchemas) + } else if (arg is List<*>) { + return getNewInstance(arg, pathToItem, pathToSchemas) + } else if (arg is Map<*, *>) { + return getNewInstance(arg, pathToItem, pathToSchemas) + } + throw RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema") + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: Nothing?, configuration: SchemaConfiguration?): ThenBoxedVoid { + return ThenBoxedVoid(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: Boolean, configuration: SchemaConfiguration?): ThenBoxedBoolean { + return ThenBoxedBoolean(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: Number, configuration: SchemaConfiguration?): ThenBoxedNumber { + return ThenBoxedNumber(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: String, configuration: SchemaConfiguration?): ThenBoxedString { + return ThenBoxedString(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: List<*>, configuration: SchemaConfiguration?): ThenBoxedList { + return ThenBoxedList(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: Map<*, *>, configuration: SchemaConfiguration?): ThenBoxedMap { + return ThenBoxedMap(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: Any?, configuration: SchemaConfiguration?): ThenBoxed { + if (arg == null) { + return validateAndBox(null, configuration) + } else if (arg is Boolean) { + return validateAndBox(arg, configuration) + } else if (arg is String) { + return validateAndBox(arg, configuration) + } else if (arg is Number) { + return validateAndBox(arg, configuration) + } else if (arg is List<*>) { + return validateAndBox(arg, configuration) + } else if (arg is Map<*, *>) { + return validateAndBox(arg, configuration) + } + throw ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema") + } + } + + sealed interface IfAndThenWithoutElse1Boxed { + fun getData(): Any? + } + + data class IfAndThenWithoutElse1BoxedVoid(val data: Nothing?) : IfAndThenWithoutElse1Boxed { + override fun getData(): Any? { + return data + } + } + + data class IfAndThenWithoutElse1BoxedBoolean(val data: Boolean): IfAndThenWithoutElse1Boxed { + override fun getData(): Any? { + return data + } + } + + data class IfAndThenWithoutElse1BoxedNumber(val data: Number) : IfAndThenWithoutElse1Boxed { + override fun getData(): Any? { + return data + } + } + + data class IfAndThenWithoutElse1BoxedString(val data: String) : IfAndThenWithoutElse1Boxed { + override fun getData(): Any? { + return data + } + } + + data class IfAndThenWithoutElse1BoxedList(val data: FrozenList) : IfAndThenWithoutElse1Boxed { + override fun getData(): Any? { + return data + } + } + + data class IfAndThenWithoutElse1BoxedMap(val data: FrozenMap) : IfAndThenWithoutElse1Boxed { + override fun getData(): Any? { + return data + } + } + + + class IfAndThenWithoutElse1 private constructor(): JsonSchema( + JsonSchemaInfo() + .ifSchema(IfSchema::class.java) + .then(Then::class.java) + ), NullSchemaValidator, BooleanSchemaValidator, NumberSchemaValidator, StringSchemaValidator, ListSchemaValidator, IfAndThenWithoutElse1BoxedList>, MapSchemaValidator, IfAndThenWithoutElse1BoxedMap> { + /* + NOTE: This class is auto generated by OpenAPI JSON Schema Generator. + Ref: https://github.com/openapi-json-schema-tools/openapi-json-schema-generator + + Do not edit the class manually. + */ + + companion object { + @Volatile + private var instance: IfAndThenWithoutElse1? = null + + fun getInstance() = + instance ?: synchronized(this) { + instance ?: IfAndThenWithoutElse1().also { instance = it } + } + } + + @Throws(ValidationException::class) + override fun validate(arg: Nothing?, configuration: SchemaConfiguration?): Nothing? { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validatedPathToSchemas = PathToSchemasMap() + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, LinkedHashSet()) + getPathToSchemas(this, castArg, validationMetadata, pathSet) + return castArg + } + + @Throws(ValidationException::class) + override fun validate(arg: Boolean, configuration: SchemaConfiguration?): Boolean { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validatedPathToSchemas = PathToSchemasMap() + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, LinkedHashSet()) + getPathToSchemas(this, castArg, validationMetadata, pathSet) + return castArg + } + + @Throws(ValidationException::class) + override fun validate(arg: Number, configuration: SchemaConfiguration?): Number { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validatedPathToSchemas = PathToSchemasMap() + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, LinkedHashSet()) + getPathToSchemas(this, castArg, validationMetadata, pathSet) + return castArg + } + + @Throws(ValidationException::class) + fun validate(arg: Int, configuration: SchemaConfiguration?): Int { + return validate(arg as Number, configuration) as Int + } + + @Throws(ValidationException::class) + fun validate(arg: Long, configuration: SchemaConfiguration?): Long { + return validate(arg as Number, configuration) as Long + } + + @Throws(ValidationException::class) + fun validate(arg: Float, configuration: SchemaConfiguration?): Float { + return validate(arg as Number, configuration) as Float + } + + @Throws(ValidationException::class) + fun validate(arg: Double, configuration: SchemaConfiguration?): Double { + return validate(arg as Number, configuration) as Double + } + + @Throws(ValidationException::class) + override fun validate(arg: String, configuration: SchemaConfiguration?): String { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validatedPathToSchemas = PathToSchemasMap() + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, LinkedHashSet()) + getPathToSchemas(this, castArg, validationMetadata, pathSet) + return castArg + } + + @Throws(ValidationException::class) + fun validate(arg: LocalDate, configuration: SchemaConfiguration?): String { + return validate(arg.toString(), configuration) + } + + @Throws(ValidationException::class) + fun validate(arg: ZonedDateTime, configuration: SchemaConfiguration?): String { + return validate(arg.toString(), configuration) + } + + @Throws(ValidationException::class) + fun validate(arg: UUID, configuration: SchemaConfiguration?): String { + return validate(arg.toString(), configuration) + } + + override fun getNewInstance(arg: List<*>, pathToItem: List, pathToSchemas: PathToSchemasMap): FrozenList { + val items: MutableList = ArrayList() + var i: Int = 0 + for (item: Any? in arg) { + val itemPathToItem = pathToItem + i + val schemas: LinkedHashMap, Nothing?>? = pathToSchemas.get(itemPathToItem) + if (schemas == null) { + throw RuntimeException("Validation result is invalid, schemas must exist for a pathToItem") + } + val itemSchema: JsonSchema<*> = schemas.entries.iterator().next().key + val itemInstance: Any? = itemSchema.getNewInstance(item, itemPathToItem, pathToSchemas) + items.add(itemInstance) + i += 1 + } + val newInstanceItems: FrozenList = FrozenList(items) + return newInstanceItems + } + + @Throws(ValidationException::class) + override fun validate(arg: List<*>, configuration: SchemaConfiguration?): FrozenList { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, PathToSchemasMap(), LinkedHashSet()) + val pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet) + return getNewInstance(castArg, validationMetadata.pathToItem, pathToSchemasMap) + } + + override fun getNewInstance(arg: Map<*, *>, pathToItem: List, pathToSchemas: PathToSchemasMap): FrozenMap { + val properties: LinkedHashMap = LinkedHashMap() + for((propertyName, value) in arg) { + if (!(propertyName is String)) { + throw RuntimeException("Invalid non-string key value") + } + val propertyPathToItem: List = pathToItem + propertyName + val schemas: LinkedHashMap, Nothing?>? = pathToSchemas.get(propertyPathToItem) + if (schemas == null) { + throw RuntimeException("Validation result is invalid, schemas must exist for a pathToItem") + } + val propertySchema: JsonSchema<*> = schemas.entries.iterator().next().key + val propertyInstance: Any? = propertySchema.getNewInstance(value, propertyPathToItem, pathToSchemas) + properties[propertyName] = propertyInstance + } + val castProperties: FrozenMap = FrozenMap(properties) + return castProperties + } + + @Throws(ValidationException::class) + override fun validate(arg: Map<*, *>, configuration: SchemaConfiguration?): FrozenMap { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validatedPathToSchemas = PathToSchemasMap() + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, LinkedHashSet()) + val pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet) + return getNewInstance(castArg, validationMetadata.pathToItem, pathToSchemasMap) + } + + @Throws(ValidationException::class) + override fun validate(arg: Any?, configuration: SchemaConfiguration?): Any? { + if (arg == null) { + return validate(null, configuration) + } else if (arg is Boolean) { + return validate(arg, configuration) + } else if (arg is Number) { + return validate(arg, configuration) + } else if (arg is String) { + return validate(arg, configuration) + } else if (arg is List<*>) { + return validate(arg, configuration) + } else if (arg is Map<*, *>) { + return validate(arg, configuration) + } + throw ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema") + } + override fun getNewInstance(arg: Any?, pathToItem: List, pathToSchemas: PathToSchemasMap): Any? { + if (arg == null) { + return getNewInstance( null, pathToItem, pathToSchemas) + } else if (arg is Boolean) { + return getNewInstance(arg, pathToItem, pathToSchemas) + } else if (arg is Number) { + return getNewInstance(arg, pathToItem, pathToSchemas) + } else if (arg is String) { + return getNewInstance(arg, pathToItem, pathToSchemas) + } else if (arg is List<*>) { + return getNewInstance(arg, pathToItem, pathToSchemas) + } else if (arg is Map<*, *>) { + return getNewInstance(arg, pathToItem, pathToSchemas) + } + throw RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema") + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: Nothing?, configuration: SchemaConfiguration?): IfAndThenWithoutElse1BoxedVoid { + return IfAndThenWithoutElse1BoxedVoid(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: Boolean, configuration: SchemaConfiguration?): IfAndThenWithoutElse1BoxedBoolean { + return IfAndThenWithoutElse1BoxedBoolean(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: Number, configuration: SchemaConfiguration?): IfAndThenWithoutElse1BoxedNumber { + return IfAndThenWithoutElse1BoxedNumber(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: String, configuration: SchemaConfiguration?): IfAndThenWithoutElse1BoxedString { + return IfAndThenWithoutElse1BoxedString(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: List<*>, configuration: SchemaConfiguration?): IfAndThenWithoutElse1BoxedList { + return IfAndThenWithoutElse1BoxedList(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: Map<*, *>, configuration: SchemaConfiguration?): IfAndThenWithoutElse1BoxedMap { + return IfAndThenWithoutElse1BoxedMap(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: Any?, configuration: SchemaConfiguration?): IfAndThenWithoutElse1Boxed { + if (arg == null) { + return validateAndBox(null, configuration) + } else if (arg is Boolean) { + return validateAndBox(arg, configuration) + } else if (arg is String) { + return validateAndBox(arg, configuration) + } else if (arg is Number) { + return validateAndBox(arg, configuration) + } else if (arg is List<*>) { + return validateAndBox(arg, configuration) + } else if (arg is Map<*, *>) { + return validateAndBox(arg, configuration) + } + throw ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema") + } + } +} diff --git a/samples/client/3_1_0_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/schemas/IfAppearsAtTheEndWhenSerializedKeywordProcessingSequence.kt b/samples/client/3_1_0_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/schemas/IfAppearsAtTheEndWhenSerializedKeywordProcessingSequence.kt new file mode 100644 index 00000000000..eb0d78fc9e7 --- /dev/null +++ b/samples/client/3_1_0_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/schemas/IfAppearsAtTheEndWhenSerializedKeywordProcessingSequence.kt @@ -0,0 +1,1153 @@ +package org.openapijsonschematools.client.components.schemas +import java.time.LocalDate +import java.time.ZonedDateTime +import java.util.UUID +import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags +import org.openapijsonschematools.client.configurations.SchemaConfiguration +import org.openapijsonschematools.client.exceptions.InvalidAdditionalPropertyException +import org.openapijsonschematools.client.exceptions.UnsetPropertyException +import org.openapijsonschematools.client.exceptions.ValidationException +import org.openapijsonschematools.client.schemas.UnsetAddPropsSetter +import org.openapijsonschematools.client.schemas.validation.BooleanSchemaValidator +import org.openapijsonschematools.client.schemas.validation.FrozenList +import org.openapijsonschematools.client.schemas.validation.FrozenMap +import org.openapijsonschematools.client.schemas.validation.JsonSchema +import org.openapijsonschematools.client.schemas.validation.JsonSchemaInfo +import org.openapijsonschematools.client.schemas.validation.ListSchemaValidator +import org.openapijsonschematools.client.schemas.validation.MapSchemaValidator +import org.openapijsonschematools.client.schemas.validation.NullSchemaValidator +import org.openapijsonschematools.client.schemas.validation.NumberSchemaValidator +import org.openapijsonschematools.client.schemas.validation.PathToSchemasMap +import org.openapijsonschematools.client.schemas.validation.StringEnumValidator +import org.openapijsonschematools.client.schemas.validation.StringSchemaValidator +import org.openapijsonschematools.client.schemas.validation.StringValueMethod +import org.openapijsonschematools.client.schemas.validation.ValidationMetadata + +class IfAppearsAtTheEndWhenSerializedKeywordProcessingSequence { + // nest classes so all schemas and input/output classes can be public + + enum class StringElseConst(private val value: String): StringValueMethod { + OTHER("other"); + + override fun value(): String { + return this.value + } + } + + + sealed interface ElseSchemaBoxed { + fun getData(): Any? + } + + data class ElseSchemaBoxedVoid(val data: Nothing?) : ElseSchemaBoxed { + override fun getData(): Any? { + return data + } + } + + data class ElseSchemaBoxedBoolean(val data: Boolean): ElseSchemaBoxed { + override fun getData(): Any? { + return data + } + } + + data class ElseSchemaBoxedNumber(val data: Number) : ElseSchemaBoxed { + override fun getData(): Any? { + return data + } + } + + data class ElseSchemaBoxedString(val data: String) : ElseSchemaBoxed { + override fun getData(): Any? { + return data + } + } + + data class ElseSchemaBoxedList(val data: FrozenList) : ElseSchemaBoxed { + override fun getData(): Any? { + return data + } + } + + data class ElseSchemaBoxedMap(val data: FrozenMap) : ElseSchemaBoxed { + override fun getData(): Any? { + return data + } + } + + + class ElseSchema private constructor(): JsonSchema( + JsonSchemaInfo() + .constValue("other") + ), NullSchemaValidator, BooleanSchemaValidator, NumberSchemaValidator, StringSchemaValidator, ListSchemaValidator, ElseSchemaBoxedList>, MapSchemaValidator, ElseSchemaBoxedMap> { + + companion object { + @Volatile + private var instance: ElseSchema? = null + + fun getInstance() = + instance ?: synchronized(this) { + instance ?: ElseSchema().also { instance = it } + } + } + + @Throws(ValidationException::class) + override fun validate(arg: Nothing?, configuration: SchemaConfiguration?): Nothing? { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validatedPathToSchemas = PathToSchemasMap() + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, LinkedHashSet()) + getPathToSchemas(this, castArg, validationMetadata, pathSet) + return castArg + } + + @Throws(ValidationException::class) + override fun validate(arg: Boolean, configuration: SchemaConfiguration?): Boolean { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validatedPathToSchemas = PathToSchemasMap() + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, LinkedHashSet()) + getPathToSchemas(this, castArg, validationMetadata, pathSet) + return castArg + } + + @Throws(ValidationException::class) + override fun validate(arg: Number, configuration: SchemaConfiguration?): Number { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validatedPathToSchemas = PathToSchemasMap() + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, LinkedHashSet()) + getPathToSchemas(this, castArg, validationMetadata, pathSet) + return castArg + } + + @Throws(ValidationException::class) + fun validate(arg: Int, configuration: SchemaConfiguration?): Int { + return validate(arg as Number, configuration) as Int + } + + @Throws(ValidationException::class) + fun validate(arg: Long, configuration: SchemaConfiguration?): Long { + return validate(arg as Number, configuration) as Long + } + + @Throws(ValidationException::class) + fun validate(arg: Float, configuration: SchemaConfiguration?): Float { + return validate(arg as Number, configuration) as Float + } + + @Throws(ValidationException::class) + fun validate(arg: Double, configuration: SchemaConfiguration?): Double { + return validate(arg as Number, configuration) as Double + } + + @Throws(ValidationException::class) + override fun validate(arg: String, configuration: SchemaConfiguration?): String { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validatedPathToSchemas = PathToSchemasMap() + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, LinkedHashSet()) + getPathToSchemas(this, castArg, validationMetadata, pathSet) + return castArg + } + + @Throws(ValidationException::class) + fun validate(arg: LocalDate, configuration: SchemaConfiguration?): String { + return validate(arg.toString(), configuration) + } + + @Throws(ValidationException::class) + fun validate(arg: ZonedDateTime, configuration: SchemaConfiguration?): String { + return validate(arg.toString(), configuration) + } + + @Throws(ValidationException::class) + fun validate(arg: UUID, configuration: SchemaConfiguration?): String { + return validate(arg.toString(), configuration) + } + + override fun getNewInstance(arg: List<*>, pathToItem: List, pathToSchemas: PathToSchemasMap): FrozenList { + val items: MutableList = ArrayList() + var i: Int = 0 + for (item: Any? in arg) { + val itemPathToItem = pathToItem + i + val schemas: LinkedHashMap, Nothing?>? = pathToSchemas.get(itemPathToItem) + if (schemas == null) { + throw RuntimeException("Validation result is invalid, schemas must exist for a pathToItem") + } + val itemSchema: JsonSchema<*> = schemas.entries.iterator().next().key + val itemInstance: Any? = itemSchema.getNewInstance(item, itemPathToItem, pathToSchemas) + items.add(itemInstance) + i += 1 + } + val newInstanceItems: FrozenList = FrozenList(items) + return newInstanceItems + } + + @Throws(ValidationException::class) + override fun validate(arg: List<*>, configuration: SchemaConfiguration?): FrozenList { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, PathToSchemasMap(), LinkedHashSet()) + val pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet) + return getNewInstance(castArg, validationMetadata.pathToItem, pathToSchemasMap) + } + + override fun getNewInstance(arg: Map<*, *>, pathToItem: List, pathToSchemas: PathToSchemasMap): FrozenMap { + val properties: LinkedHashMap = LinkedHashMap() + for((propertyName, value) in arg) { + if (!(propertyName is String)) { + throw RuntimeException("Invalid non-string key value") + } + val propertyPathToItem: List = pathToItem + propertyName + val schemas: LinkedHashMap, Nothing?>? = pathToSchemas.get(propertyPathToItem) + if (schemas == null) { + throw RuntimeException("Validation result is invalid, schemas must exist for a pathToItem") + } + val propertySchema: JsonSchema<*> = schemas.entries.iterator().next().key + val propertyInstance: Any? = propertySchema.getNewInstance(value, propertyPathToItem, pathToSchemas) + properties[propertyName] = propertyInstance + } + val castProperties: FrozenMap = FrozenMap(properties) + return castProperties + } + + @Throws(ValidationException::class) + override fun validate(arg: Map<*, *>, configuration: SchemaConfiguration?): FrozenMap { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validatedPathToSchemas = PathToSchemasMap() + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, LinkedHashSet()) + val pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet) + return getNewInstance(castArg, validationMetadata.pathToItem, pathToSchemasMap) + } + + @Throws(ValidationException::class) + override fun validate(arg: Any?, configuration: SchemaConfiguration?): Any? { + if (arg == null) { + return validate(null, configuration) + } else if (arg is Boolean) { + return validate(arg, configuration) + } else if (arg is Number) { + return validate(arg, configuration) + } else if (arg is String) { + return validate(arg, configuration) + } else if (arg is List<*>) { + return validate(arg, configuration) + } else if (arg is Map<*, *>) { + return validate(arg, configuration) + } + throw ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema") + } + override fun getNewInstance(arg: Any?, pathToItem: List, pathToSchemas: PathToSchemasMap): Any? { + if (arg == null) { + return getNewInstance( null, pathToItem, pathToSchemas) + } else if (arg is Boolean) { + return getNewInstance(arg, pathToItem, pathToSchemas) + } else if (arg is Number) { + return getNewInstance(arg, pathToItem, pathToSchemas) + } else if (arg is String) { + return getNewInstance(arg, pathToItem, pathToSchemas) + } else if (arg is List<*>) { + return getNewInstance(arg, pathToItem, pathToSchemas) + } else if (arg is Map<*, *>) { + return getNewInstance(arg, pathToItem, pathToSchemas) + } + throw RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema") + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: Nothing?, configuration: SchemaConfiguration?): ElseSchemaBoxedVoid { + return ElseSchemaBoxedVoid(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: Boolean, configuration: SchemaConfiguration?): ElseSchemaBoxedBoolean { + return ElseSchemaBoxedBoolean(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: Number, configuration: SchemaConfiguration?): ElseSchemaBoxedNumber { + return ElseSchemaBoxedNumber(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: String, configuration: SchemaConfiguration?): ElseSchemaBoxedString { + return ElseSchemaBoxedString(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: List<*>, configuration: SchemaConfiguration?): ElseSchemaBoxedList { + return ElseSchemaBoxedList(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: Map<*, *>, configuration: SchemaConfiguration?): ElseSchemaBoxedMap { + return ElseSchemaBoxedMap(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: Any?, configuration: SchemaConfiguration?): ElseSchemaBoxed { + if (arg == null) { + return validateAndBox(null, configuration) + } else if (arg is Boolean) { + return validateAndBox(arg, configuration) + } else if (arg is String) { + return validateAndBox(arg, configuration) + } else if (arg is Number) { + return validateAndBox(arg, configuration) + } else if (arg is List<*>) { + return validateAndBox(arg, configuration) + } else if (arg is Map<*, *>) { + return validateAndBox(arg, configuration) + } + throw ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema") + } + } + + sealed interface IfSchemaBoxed { + fun getData(): Any? + } + + data class IfSchemaBoxedVoid(val data: Nothing?) : IfSchemaBoxed { + override fun getData(): Any? { + return data + } + } + + data class IfSchemaBoxedBoolean(val data: Boolean): IfSchemaBoxed { + override fun getData(): Any? { + return data + } + } + + data class IfSchemaBoxedNumber(val data: Number) : IfSchemaBoxed { + override fun getData(): Any? { + return data + } + } + + data class IfSchemaBoxedString(val data: String) : IfSchemaBoxed { + override fun getData(): Any? { + return data + } + } + + data class IfSchemaBoxedList(val data: FrozenList) : IfSchemaBoxed { + override fun getData(): Any? { + return data + } + } + + data class IfSchemaBoxedMap(val data: FrozenMap) : IfSchemaBoxed { + override fun getData(): Any? { + return data + } + } + + + class IfSchema private constructor(): JsonSchema( + JsonSchemaInfo() + .maxLength(4) + ), NullSchemaValidator, BooleanSchemaValidator, NumberSchemaValidator, StringSchemaValidator, ListSchemaValidator, IfSchemaBoxedList>, MapSchemaValidator, IfSchemaBoxedMap> { + + companion object { + @Volatile + private var instance: IfSchema? = null + + fun getInstance() = + instance ?: synchronized(this) { + instance ?: IfSchema().also { instance = it } + } + } + + @Throws(ValidationException::class) + override fun validate(arg: Nothing?, configuration: SchemaConfiguration?): Nothing? { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validatedPathToSchemas = PathToSchemasMap() + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, LinkedHashSet()) + getPathToSchemas(this, castArg, validationMetadata, pathSet) + return castArg + } + + @Throws(ValidationException::class) + override fun validate(arg: Boolean, configuration: SchemaConfiguration?): Boolean { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validatedPathToSchemas = PathToSchemasMap() + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, LinkedHashSet()) + getPathToSchemas(this, castArg, validationMetadata, pathSet) + return castArg + } + + @Throws(ValidationException::class) + override fun validate(arg: Number, configuration: SchemaConfiguration?): Number { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validatedPathToSchemas = PathToSchemasMap() + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, LinkedHashSet()) + getPathToSchemas(this, castArg, validationMetadata, pathSet) + return castArg + } + + @Throws(ValidationException::class) + fun validate(arg: Int, configuration: SchemaConfiguration?): Int { + return validate(arg as Number, configuration) as Int + } + + @Throws(ValidationException::class) + fun validate(arg: Long, configuration: SchemaConfiguration?): Long { + return validate(arg as Number, configuration) as Long + } + + @Throws(ValidationException::class) + fun validate(arg: Float, configuration: SchemaConfiguration?): Float { + return validate(arg as Number, configuration) as Float + } + + @Throws(ValidationException::class) + fun validate(arg: Double, configuration: SchemaConfiguration?): Double { + return validate(arg as Number, configuration) as Double + } + + @Throws(ValidationException::class) + override fun validate(arg: String, configuration: SchemaConfiguration?): String { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validatedPathToSchemas = PathToSchemasMap() + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, LinkedHashSet()) + getPathToSchemas(this, castArg, validationMetadata, pathSet) + return castArg + } + + @Throws(ValidationException::class) + fun validate(arg: LocalDate, configuration: SchemaConfiguration?): String { + return validate(arg.toString(), configuration) + } + + @Throws(ValidationException::class) + fun validate(arg: ZonedDateTime, configuration: SchemaConfiguration?): String { + return validate(arg.toString(), configuration) + } + + @Throws(ValidationException::class) + fun validate(arg: UUID, configuration: SchemaConfiguration?): String { + return validate(arg.toString(), configuration) + } + + override fun getNewInstance(arg: List<*>, pathToItem: List, pathToSchemas: PathToSchemasMap): FrozenList { + val items: MutableList = ArrayList() + var i: Int = 0 + for (item: Any? in arg) { + val itemPathToItem = pathToItem + i + val schemas: LinkedHashMap, Nothing?>? = pathToSchemas.get(itemPathToItem) + if (schemas == null) { + throw RuntimeException("Validation result is invalid, schemas must exist for a pathToItem") + } + val itemSchema: JsonSchema<*> = schemas.entries.iterator().next().key + val itemInstance: Any? = itemSchema.getNewInstance(item, itemPathToItem, pathToSchemas) + items.add(itemInstance) + i += 1 + } + val newInstanceItems: FrozenList = FrozenList(items) + return newInstanceItems + } + + @Throws(ValidationException::class) + override fun validate(arg: List<*>, configuration: SchemaConfiguration?): FrozenList { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, PathToSchemasMap(), LinkedHashSet()) + val pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet) + return getNewInstance(castArg, validationMetadata.pathToItem, pathToSchemasMap) + } + + override fun getNewInstance(arg: Map<*, *>, pathToItem: List, pathToSchemas: PathToSchemasMap): FrozenMap { + val properties: LinkedHashMap = LinkedHashMap() + for((propertyName, value) in arg) { + if (!(propertyName is String)) { + throw RuntimeException("Invalid non-string key value") + } + val propertyPathToItem: List = pathToItem + propertyName + val schemas: LinkedHashMap, Nothing?>? = pathToSchemas.get(propertyPathToItem) + if (schemas == null) { + throw RuntimeException("Validation result is invalid, schemas must exist for a pathToItem") + } + val propertySchema: JsonSchema<*> = schemas.entries.iterator().next().key + val propertyInstance: Any? = propertySchema.getNewInstance(value, propertyPathToItem, pathToSchemas) + properties[propertyName] = propertyInstance + } + val castProperties: FrozenMap = FrozenMap(properties) + return castProperties + } + + @Throws(ValidationException::class) + override fun validate(arg: Map<*, *>, configuration: SchemaConfiguration?): FrozenMap { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validatedPathToSchemas = PathToSchemasMap() + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, LinkedHashSet()) + val pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet) + return getNewInstance(castArg, validationMetadata.pathToItem, pathToSchemasMap) + } + + @Throws(ValidationException::class) + override fun validate(arg: Any?, configuration: SchemaConfiguration?): Any? { + if (arg == null) { + return validate(null, configuration) + } else if (arg is Boolean) { + return validate(arg, configuration) + } else if (arg is Number) { + return validate(arg, configuration) + } else if (arg is String) { + return validate(arg, configuration) + } else if (arg is List<*>) { + return validate(arg, configuration) + } else if (arg is Map<*, *>) { + return validate(arg, configuration) + } + throw ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema") + } + override fun getNewInstance(arg: Any?, pathToItem: List, pathToSchemas: PathToSchemasMap): Any? { + if (arg == null) { + return getNewInstance( null, pathToItem, pathToSchemas) + } else if (arg is Boolean) { + return getNewInstance(arg, pathToItem, pathToSchemas) + } else if (arg is Number) { + return getNewInstance(arg, pathToItem, pathToSchemas) + } else if (arg is String) { + return getNewInstance(arg, pathToItem, pathToSchemas) + } else if (arg is List<*>) { + return getNewInstance(arg, pathToItem, pathToSchemas) + } else if (arg is Map<*, *>) { + return getNewInstance(arg, pathToItem, pathToSchemas) + } + throw RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema") + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: Nothing?, configuration: SchemaConfiguration?): IfSchemaBoxedVoid { + return IfSchemaBoxedVoid(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: Boolean, configuration: SchemaConfiguration?): IfSchemaBoxedBoolean { + return IfSchemaBoxedBoolean(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: Number, configuration: SchemaConfiguration?): IfSchemaBoxedNumber { + return IfSchemaBoxedNumber(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: String, configuration: SchemaConfiguration?): IfSchemaBoxedString { + return IfSchemaBoxedString(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: List<*>, configuration: SchemaConfiguration?): IfSchemaBoxedList { + return IfSchemaBoxedList(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: Map<*, *>, configuration: SchemaConfiguration?): IfSchemaBoxedMap { + return IfSchemaBoxedMap(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: Any?, configuration: SchemaConfiguration?): IfSchemaBoxed { + if (arg == null) { + return validateAndBox(null, configuration) + } else if (arg is Boolean) { + return validateAndBox(arg, configuration) + } else if (arg is String) { + return validateAndBox(arg, configuration) + } else if (arg is Number) { + return validateAndBox(arg, configuration) + } else if (arg is List<*>) { + return validateAndBox(arg, configuration) + } else if (arg is Map<*, *>) { + return validateAndBox(arg, configuration) + } + throw ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema") + } + } + enum class StringThenConst(private val value: String): StringValueMethod { + YES("yes"); + + override fun value(): String { + return this.value + } + } + + + sealed interface ThenBoxed { + fun getData(): Any? + } + + data class ThenBoxedVoid(val data: Nothing?) : ThenBoxed { + override fun getData(): Any? { + return data + } + } + + data class ThenBoxedBoolean(val data: Boolean): ThenBoxed { + override fun getData(): Any? { + return data + } + } + + data class ThenBoxedNumber(val data: Number) : ThenBoxed { + override fun getData(): Any? { + return data + } + } + + data class ThenBoxedString(val data: String) : ThenBoxed { + override fun getData(): Any? { + return data + } + } + + data class ThenBoxedList(val data: FrozenList) : ThenBoxed { + override fun getData(): Any? { + return data + } + } + + data class ThenBoxedMap(val data: FrozenMap) : ThenBoxed { + override fun getData(): Any? { + return data + } + } + + + class Then private constructor(): JsonSchema( + JsonSchemaInfo() + .constValue("yes") + ), NullSchemaValidator, BooleanSchemaValidator, NumberSchemaValidator, StringSchemaValidator, ListSchemaValidator, ThenBoxedList>, MapSchemaValidator, ThenBoxedMap> { + + companion object { + @Volatile + private var instance: Then? = null + + fun getInstance() = + instance ?: synchronized(this) { + instance ?: Then().also { instance = it } + } + } + + @Throws(ValidationException::class) + override fun validate(arg: Nothing?, configuration: SchemaConfiguration?): Nothing? { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validatedPathToSchemas = PathToSchemasMap() + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, LinkedHashSet()) + getPathToSchemas(this, castArg, validationMetadata, pathSet) + return castArg + } + + @Throws(ValidationException::class) + override fun validate(arg: Boolean, configuration: SchemaConfiguration?): Boolean { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validatedPathToSchemas = PathToSchemasMap() + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, LinkedHashSet()) + getPathToSchemas(this, castArg, validationMetadata, pathSet) + return castArg + } + + @Throws(ValidationException::class) + override fun validate(arg: Number, configuration: SchemaConfiguration?): Number { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validatedPathToSchemas = PathToSchemasMap() + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, LinkedHashSet()) + getPathToSchemas(this, castArg, validationMetadata, pathSet) + return castArg + } + + @Throws(ValidationException::class) + fun validate(arg: Int, configuration: SchemaConfiguration?): Int { + return validate(arg as Number, configuration) as Int + } + + @Throws(ValidationException::class) + fun validate(arg: Long, configuration: SchemaConfiguration?): Long { + return validate(arg as Number, configuration) as Long + } + + @Throws(ValidationException::class) + fun validate(arg: Float, configuration: SchemaConfiguration?): Float { + return validate(arg as Number, configuration) as Float + } + + @Throws(ValidationException::class) + fun validate(arg: Double, configuration: SchemaConfiguration?): Double { + return validate(arg as Number, configuration) as Double + } + + @Throws(ValidationException::class) + override fun validate(arg: String, configuration: SchemaConfiguration?): String { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validatedPathToSchemas = PathToSchemasMap() + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, LinkedHashSet()) + getPathToSchemas(this, castArg, validationMetadata, pathSet) + return castArg + } + + @Throws(ValidationException::class) + fun validate(arg: LocalDate, configuration: SchemaConfiguration?): String { + return validate(arg.toString(), configuration) + } + + @Throws(ValidationException::class) + fun validate(arg: ZonedDateTime, configuration: SchemaConfiguration?): String { + return validate(arg.toString(), configuration) + } + + @Throws(ValidationException::class) + fun validate(arg: UUID, configuration: SchemaConfiguration?): String { + return validate(arg.toString(), configuration) + } + + override fun getNewInstance(arg: List<*>, pathToItem: List, pathToSchemas: PathToSchemasMap): FrozenList { + val items: MutableList = ArrayList() + var i: Int = 0 + for (item: Any? in arg) { + val itemPathToItem = pathToItem + i + val schemas: LinkedHashMap, Nothing?>? = pathToSchemas.get(itemPathToItem) + if (schemas == null) { + throw RuntimeException("Validation result is invalid, schemas must exist for a pathToItem") + } + val itemSchema: JsonSchema<*> = schemas.entries.iterator().next().key + val itemInstance: Any? = itemSchema.getNewInstance(item, itemPathToItem, pathToSchemas) + items.add(itemInstance) + i += 1 + } + val newInstanceItems: FrozenList = FrozenList(items) + return newInstanceItems + } + + @Throws(ValidationException::class) + override fun validate(arg: List<*>, configuration: SchemaConfiguration?): FrozenList { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, PathToSchemasMap(), LinkedHashSet()) + val pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet) + return getNewInstance(castArg, validationMetadata.pathToItem, pathToSchemasMap) + } + + override fun getNewInstance(arg: Map<*, *>, pathToItem: List, pathToSchemas: PathToSchemasMap): FrozenMap { + val properties: LinkedHashMap = LinkedHashMap() + for((propertyName, value) in arg) { + if (!(propertyName is String)) { + throw RuntimeException("Invalid non-string key value") + } + val propertyPathToItem: List = pathToItem + propertyName + val schemas: LinkedHashMap, Nothing?>? = pathToSchemas.get(propertyPathToItem) + if (schemas == null) { + throw RuntimeException("Validation result is invalid, schemas must exist for a pathToItem") + } + val propertySchema: JsonSchema<*> = schemas.entries.iterator().next().key + val propertyInstance: Any? = propertySchema.getNewInstance(value, propertyPathToItem, pathToSchemas) + properties[propertyName] = propertyInstance + } + val castProperties: FrozenMap = FrozenMap(properties) + return castProperties + } + + @Throws(ValidationException::class) + override fun validate(arg: Map<*, *>, configuration: SchemaConfiguration?): FrozenMap { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validatedPathToSchemas = PathToSchemasMap() + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, LinkedHashSet()) + val pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet) + return getNewInstance(castArg, validationMetadata.pathToItem, pathToSchemasMap) + } + + @Throws(ValidationException::class) + override fun validate(arg: Any?, configuration: SchemaConfiguration?): Any? { + if (arg == null) { + return validate(null, configuration) + } else if (arg is Boolean) { + return validate(arg, configuration) + } else if (arg is Number) { + return validate(arg, configuration) + } else if (arg is String) { + return validate(arg, configuration) + } else if (arg is List<*>) { + return validate(arg, configuration) + } else if (arg is Map<*, *>) { + return validate(arg, configuration) + } + throw ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema") + } + override fun getNewInstance(arg: Any?, pathToItem: List, pathToSchemas: PathToSchemasMap): Any? { + if (arg == null) { + return getNewInstance( null, pathToItem, pathToSchemas) + } else if (arg is Boolean) { + return getNewInstance(arg, pathToItem, pathToSchemas) + } else if (arg is Number) { + return getNewInstance(arg, pathToItem, pathToSchemas) + } else if (arg is String) { + return getNewInstance(arg, pathToItem, pathToSchemas) + } else if (arg is List<*>) { + return getNewInstance(arg, pathToItem, pathToSchemas) + } else if (arg is Map<*, *>) { + return getNewInstance(arg, pathToItem, pathToSchemas) + } + throw RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema") + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: Nothing?, configuration: SchemaConfiguration?): ThenBoxedVoid { + return ThenBoxedVoid(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: Boolean, configuration: SchemaConfiguration?): ThenBoxedBoolean { + return ThenBoxedBoolean(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: Number, configuration: SchemaConfiguration?): ThenBoxedNumber { + return ThenBoxedNumber(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: String, configuration: SchemaConfiguration?): ThenBoxedString { + return ThenBoxedString(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: List<*>, configuration: SchemaConfiguration?): ThenBoxedList { + return ThenBoxedList(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: Map<*, *>, configuration: SchemaConfiguration?): ThenBoxedMap { + return ThenBoxedMap(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: Any?, configuration: SchemaConfiguration?): ThenBoxed { + if (arg == null) { + return validateAndBox(null, configuration) + } else if (arg is Boolean) { + return validateAndBox(arg, configuration) + } else if (arg is String) { + return validateAndBox(arg, configuration) + } else if (arg is Number) { + return validateAndBox(arg, configuration) + } else if (arg is List<*>) { + return validateAndBox(arg, configuration) + } else if (arg is Map<*, *>) { + return validateAndBox(arg, configuration) + } + throw ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema") + } + } + + sealed interface IfAppearsAtTheEndWhenSerializedKeywordProcessingSequence1Boxed { + fun getData(): Any? + } + + data class IfAppearsAtTheEndWhenSerializedKeywordProcessingSequence1BoxedVoid(val data: Nothing?) : IfAppearsAtTheEndWhenSerializedKeywordProcessingSequence1Boxed { + override fun getData(): Any? { + return data + } + } + + data class IfAppearsAtTheEndWhenSerializedKeywordProcessingSequence1BoxedBoolean(val data: Boolean): IfAppearsAtTheEndWhenSerializedKeywordProcessingSequence1Boxed { + override fun getData(): Any? { + return data + } + } + + data class IfAppearsAtTheEndWhenSerializedKeywordProcessingSequence1BoxedNumber(val data: Number) : IfAppearsAtTheEndWhenSerializedKeywordProcessingSequence1Boxed { + override fun getData(): Any? { + return data + } + } + + data class IfAppearsAtTheEndWhenSerializedKeywordProcessingSequence1BoxedString(val data: String) : IfAppearsAtTheEndWhenSerializedKeywordProcessingSequence1Boxed { + override fun getData(): Any? { + return data + } + } + + data class IfAppearsAtTheEndWhenSerializedKeywordProcessingSequence1BoxedList(val data: FrozenList) : IfAppearsAtTheEndWhenSerializedKeywordProcessingSequence1Boxed { + override fun getData(): Any? { + return data + } + } + + data class IfAppearsAtTheEndWhenSerializedKeywordProcessingSequence1BoxedMap(val data: FrozenMap) : IfAppearsAtTheEndWhenSerializedKeywordProcessingSequence1Boxed { + override fun getData(): Any? { + return data + } + } + + + class IfAppearsAtTheEndWhenSerializedKeywordProcessingSequence1 private constructor(): JsonSchema( + JsonSchemaInfo() + .ifSchema(IfSchema::class.java) + .then(Then::class.java) + .elseSchema(ElseSchema::class.java) + ), NullSchemaValidator, BooleanSchemaValidator, NumberSchemaValidator, StringSchemaValidator, ListSchemaValidator, IfAppearsAtTheEndWhenSerializedKeywordProcessingSequence1BoxedList>, MapSchemaValidator, IfAppearsAtTheEndWhenSerializedKeywordProcessingSequence1BoxedMap> { + /* + NOTE: This class is auto generated by OpenAPI JSON Schema Generator. + Ref: https://github.com/openapi-json-schema-tools/openapi-json-schema-generator + + Do not edit the class manually. + */ + + companion object { + @Volatile + private var instance: IfAppearsAtTheEndWhenSerializedKeywordProcessingSequence1? = null + + fun getInstance() = + instance ?: synchronized(this) { + instance ?: IfAppearsAtTheEndWhenSerializedKeywordProcessingSequence1().also { instance = it } + } + } + + @Throws(ValidationException::class) + override fun validate(arg: Nothing?, configuration: SchemaConfiguration?): Nothing? { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validatedPathToSchemas = PathToSchemasMap() + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, LinkedHashSet()) + getPathToSchemas(this, castArg, validationMetadata, pathSet) + return castArg + } + + @Throws(ValidationException::class) + override fun validate(arg: Boolean, configuration: SchemaConfiguration?): Boolean { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validatedPathToSchemas = PathToSchemasMap() + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, LinkedHashSet()) + getPathToSchemas(this, castArg, validationMetadata, pathSet) + return castArg + } + + @Throws(ValidationException::class) + override fun validate(arg: Number, configuration: SchemaConfiguration?): Number { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validatedPathToSchemas = PathToSchemasMap() + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, LinkedHashSet()) + getPathToSchemas(this, castArg, validationMetadata, pathSet) + return castArg + } + + @Throws(ValidationException::class) + fun validate(arg: Int, configuration: SchemaConfiguration?): Int { + return validate(arg as Number, configuration) as Int + } + + @Throws(ValidationException::class) + fun validate(arg: Long, configuration: SchemaConfiguration?): Long { + return validate(arg as Number, configuration) as Long + } + + @Throws(ValidationException::class) + fun validate(arg: Float, configuration: SchemaConfiguration?): Float { + return validate(arg as Number, configuration) as Float + } + + @Throws(ValidationException::class) + fun validate(arg: Double, configuration: SchemaConfiguration?): Double { + return validate(arg as Number, configuration) as Double + } + + @Throws(ValidationException::class) + override fun validate(arg: String, configuration: SchemaConfiguration?): String { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validatedPathToSchemas = PathToSchemasMap() + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, LinkedHashSet()) + getPathToSchemas(this, castArg, validationMetadata, pathSet) + return castArg + } + + @Throws(ValidationException::class) + fun validate(arg: LocalDate, configuration: SchemaConfiguration?): String { + return validate(arg.toString(), configuration) + } + + @Throws(ValidationException::class) + fun validate(arg: ZonedDateTime, configuration: SchemaConfiguration?): String { + return validate(arg.toString(), configuration) + } + + @Throws(ValidationException::class) + fun validate(arg: UUID, configuration: SchemaConfiguration?): String { + return validate(arg.toString(), configuration) + } + + override fun getNewInstance(arg: List<*>, pathToItem: List, pathToSchemas: PathToSchemasMap): FrozenList { + val items: MutableList = ArrayList() + var i: Int = 0 + for (item: Any? in arg) { + val itemPathToItem = pathToItem + i + val schemas: LinkedHashMap, Nothing?>? = pathToSchemas.get(itemPathToItem) + if (schemas == null) { + throw RuntimeException("Validation result is invalid, schemas must exist for a pathToItem") + } + val itemSchema: JsonSchema<*> = schemas.entries.iterator().next().key + val itemInstance: Any? = itemSchema.getNewInstance(item, itemPathToItem, pathToSchemas) + items.add(itemInstance) + i += 1 + } + val newInstanceItems: FrozenList = FrozenList(items) + return newInstanceItems + } + + @Throws(ValidationException::class) + override fun validate(arg: List<*>, configuration: SchemaConfiguration?): FrozenList { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, PathToSchemasMap(), LinkedHashSet()) + val pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet) + return getNewInstance(castArg, validationMetadata.pathToItem, pathToSchemasMap) + } + + override fun getNewInstance(arg: Map<*, *>, pathToItem: List, pathToSchemas: PathToSchemasMap): FrozenMap { + val properties: LinkedHashMap = LinkedHashMap() + for((propertyName, value) in arg) { + if (!(propertyName is String)) { + throw RuntimeException("Invalid non-string key value") + } + val propertyPathToItem: List = pathToItem + propertyName + val schemas: LinkedHashMap, Nothing?>? = pathToSchemas.get(propertyPathToItem) + if (schemas == null) { + throw RuntimeException("Validation result is invalid, schemas must exist for a pathToItem") + } + val propertySchema: JsonSchema<*> = schemas.entries.iterator().next().key + val propertyInstance: Any? = propertySchema.getNewInstance(value, propertyPathToItem, pathToSchemas) + properties[propertyName] = propertyInstance + } + val castProperties: FrozenMap = FrozenMap(properties) + return castProperties + } + + @Throws(ValidationException::class) + override fun validate(arg: Map<*, *>, configuration: SchemaConfiguration?): FrozenMap { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validatedPathToSchemas = PathToSchemasMap() + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, LinkedHashSet()) + val pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet) + return getNewInstance(castArg, validationMetadata.pathToItem, pathToSchemasMap) + } + + @Throws(ValidationException::class) + override fun validate(arg: Any?, configuration: SchemaConfiguration?): Any? { + if (arg == null) { + return validate(null, configuration) + } else if (arg is Boolean) { + return validate(arg, configuration) + } else if (arg is Number) { + return validate(arg, configuration) + } else if (arg is String) { + return validate(arg, configuration) + } else if (arg is List<*>) { + return validate(arg, configuration) + } else if (arg is Map<*, *>) { + return validate(arg, configuration) + } + throw ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema") + } + override fun getNewInstance(arg: Any?, pathToItem: List, pathToSchemas: PathToSchemasMap): Any? { + if (arg == null) { + return getNewInstance( null, pathToItem, pathToSchemas) + } else if (arg is Boolean) { + return getNewInstance(arg, pathToItem, pathToSchemas) + } else if (arg is Number) { + return getNewInstance(arg, pathToItem, pathToSchemas) + } else if (arg is String) { + return getNewInstance(arg, pathToItem, pathToSchemas) + } else if (arg is List<*>) { + return getNewInstance(arg, pathToItem, pathToSchemas) + } else if (arg is Map<*, *>) { + return getNewInstance(arg, pathToItem, pathToSchemas) + } + throw RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema") + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: Nothing?, configuration: SchemaConfiguration?): IfAppearsAtTheEndWhenSerializedKeywordProcessingSequence1BoxedVoid { + return IfAppearsAtTheEndWhenSerializedKeywordProcessingSequence1BoxedVoid(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: Boolean, configuration: SchemaConfiguration?): IfAppearsAtTheEndWhenSerializedKeywordProcessingSequence1BoxedBoolean { + return IfAppearsAtTheEndWhenSerializedKeywordProcessingSequence1BoxedBoolean(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: Number, configuration: SchemaConfiguration?): IfAppearsAtTheEndWhenSerializedKeywordProcessingSequence1BoxedNumber { + return IfAppearsAtTheEndWhenSerializedKeywordProcessingSequence1BoxedNumber(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: String, configuration: SchemaConfiguration?): IfAppearsAtTheEndWhenSerializedKeywordProcessingSequence1BoxedString { + return IfAppearsAtTheEndWhenSerializedKeywordProcessingSequence1BoxedString(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: List<*>, configuration: SchemaConfiguration?): IfAppearsAtTheEndWhenSerializedKeywordProcessingSequence1BoxedList { + return IfAppearsAtTheEndWhenSerializedKeywordProcessingSequence1BoxedList(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: Map<*, *>, configuration: SchemaConfiguration?): IfAppearsAtTheEndWhenSerializedKeywordProcessingSequence1BoxedMap { + return IfAppearsAtTheEndWhenSerializedKeywordProcessingSequence1BoxedMap(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: Any?, configuration: SchemaConfiguration?): IfAppearsAtTheEndWhenSerializedKeywordProcessingSequence1Boxed { + if (arg == null) { + return validateAndBox(null, configuration) + } else if (arg is Boolean) { + return validateAndBox(arg, configuration) + } else if (arg is String) { + return validateAndBox(arg, configuration) + } else if (arg is Number) { + return validateAndBox(arg, configuration) + } else if (arg is List<*>) { + return validateAndBox(arg, configuration) + } else if (arg is Map<*, *>) { + return validateAndBox(arg, configuration) + } + throw ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema") + } + } +} diff --git a/samples/client/3_1_0_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/schemas/IgnoreElseWithoutIf.kt b/samples/client/3_1_0_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/schemas/IgnoreElseWithoutIf.kt new file mode 100644 index 00000000000..7610aa55b60 --- /dev/null +++ b/samples/client/3_1_0_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/schemas/IgnoreElseWithoutIf.kt @@ -0,0 +1,593 @@ +package org.openapijsonschematools.client.components.schemas +import java.time.LocalDate +import java.time.ZonedDateTime +import java.util.UUID +import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags +import org.openapijsonschematools.client.configurations.SchemaConfiguration +import org.openapijsonschematools.client.exceptions.InvalidAdditionalPropertyException +import org.openapijsonschematools.client.exceptions.UnsetPropertyException +import org.openapijsonschematools.client.exceptions.ValidationException +import org.openapijsonschematools.client.schemas.UnsetAddPropsSetter +import org.openapijsonschematools.client.schemas.validation.BooleanSchemaValidator +import org.openapijsonschematools.client.schemas.validation.FrozenList +import org.openapijsonschematools.client.schemas.validation.FrozenMap +import org.openapijsonschematools.client.schemas.validation.JsonSchema +import org.openapijsonschematools.client.schemas.validation.JsonSchemaInfo +import org.openapijsonschematools.client.schemas.validation.ListSchemaValidator +import org.openapijsonschematools.client.schemas.validation.MapSchemaValidator +import org.openapijsonschematools.client.schemas.validation.NullSchemaValidator +import org.openapijsonschematools.client.schemas.validation.NumberSchemaValidator +import org.openapijsonschematools.client.schemas.validation.PathToSchemasMap +import org.openapijsonschematools.client.schemas.validation.StringEnumValidator +import org.openapijsonschematools.client.schemas.validation.StringSchemaValidator +import org.openapijsonschematools.client.schemas.validation.StringValueMethod +import org.openapijsonschematools.client.schemas.validation.ValidationMetadata + +class IgnoreElseWithoutIf { + // nest classes so all schemas and input/output classes can be public + + enum class StringElseConst(private val value: String): StringValueMethod { + POSITIVE_0("0"); + + override fun value(): String { + return this.value + } + } + + + sealed interface ElseSchemaBoxed { + fun getData(): Any? + } + + data class ElseSchemaBoxedVoid(val data: Nothing?) : ElseSchemaBoxed { + override fun getData(): Any? { + return data + } + } + + data class ElseSchemaBoxedBoolean(val data: Boolean): ElseSchemaBoxed { + override fun getData(): Any? { + return data + } + } + + data class ElseSchemaBoxedNumber(val data: Number) : ElseSchemaBoxed { + override fun getData(): Any? { + return data + } + } + + data class ElseSchemaBoxedString(val data: String) : ElseSchemaBoxed { + override fun getData(): Any? { + return data + } + } + + data class ElseSchemaBoxedList(val data: FrozenList) : ElseSchemaBoxed { + override fun getData(): Any? { + return data + } + } + + data class ElseSchemaBoxedMap(val data: FrozenMap) : ElseSchemaBoxed { + override fun getData(): Any? { + return data + } + } + + + class ElseSchema private constructor(): JsonSchema( + JsonSchemaInfo() + .constValue("0") + ), NullSchemaValidator, BooleanSchemaValidator, NumberSchemaValidator, StringSchemaValidator, ListSchemaValidator, ElseSchemaBoxedList>, MapSchemaValidator, ElseSchemaBoxedMap> { + + companion object { + @Volatile + private var instance: ElseSchema? = null + + fun getInstance() = + instance ?: synchronized(this) { + instance ?: ElseSchema().also { instance = it } + } + } + + @Throws(ValidationException::class) + override fun validate(arg: Nothing?, configuration: SchemaConfiguration?): Nothing? { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validatedPathToSchemas = PathToSchemasMap() + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, LinkedHashSet()) + getPathToSchemas(this, castArg, validationMetadata, pathSet) + return castArg + } + + @Throws(ValidationException::class) + override fun validate(arg: Boolean, configuration: SchemaConfiguration?): Boolean { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validatedPathToSchemas = PathToSchemasMap() + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, LinkedHashSet()) + getPathToSchemas(this, castArg, validationMetadata, pathSet) + return castArg + } + + @Throws(ValidationException::class) + override fun validate(arg: Number, configuration: SchemaConfiguration?): Number { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validatedPathToSchemas = PathToSchemasMap() + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, LinkedHashSet()) + getPathToSchemas(this, castArg, validationMetadata, pathSet) + return castArg + } + + @Throws(ValidationException::class) + fun validate(arg: Int, configuration: SchemaConfiguration?): Int { + return validate(arg as Number, configuration) as Int + } + + @Throws(ValidationException::class) + fun validate(arg: Long, configuration: SchemaConfiguration?): Long { + return validate(arg as Number, configuration) as Long + } + + @Throws(ValidationException::class) + fun validate(arg: Float, configuration: SchemaConfiguration?): Float { + return validate(arg as Number, configuration) as Float + } + + @Throws(ValidationException::class) + fun validate(arg: Double, configuration: SchemaConfiguration?): Double { + return validate(arg as Number, configuration) as Double + } + + @Throws(ValidationException::class) + override fun validate(arg: String, configuration: SchemaConfiguration?): String { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validatedPathToSchemas = PathToSchemasMap() + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, LinkedHashSet()) + getPathToSchemas(this, castArg, validationMetadata, pathSet) + return castArg + } + + @Throws(ValidationException::class) + fun validate(arg: LocalDate, configuration: SchemaConfiguration?): String { + return validate(arg.toString(), configuration) + } + + @Throws(ValidationException::class) + fun validate(arg: ZonedDateTime, configuration: SchemaConfiguration?): String { + return validate(arg.toString(), configuration) + } + + @Throws(ValidationException::class) + fun validate(arg: UUID, configuration: SchemaConfiguration?): String { + return validate(arg.toString(), configuration) + } + + override fun getNewInstance(arg: List<*>, pathToItem: List, pathToSchemas: PathToSchemasMap): FrozenList { + val items: MutableList = ArrayList() + var i: Int = 0 + for (item: Any? in arg) { + val itemPathToItem = pathToItem + i + val schemas: LinkedHashMap, Nothing?>? = pathToSchemas.get(itemPathToItem) + if (schemas == null) { + throw RuntimeException("Validation result is invalid, schemas must exist for a pathToItem") + } + val itemSchema: JsonSchema<*> = schemas.entries.iterator().next().key + val itemInstance: Any? = itemSchema.getNewInstance(item, itemPathToItem, pathToSchemas) + items.add(itemInstance) + i += 1 + } + val newInstanceItems: FrozenList = FrozenList(items) + return newInstanceItems + } + + @Throws(ValidationException::class) + override fun validate(arg: List<*>, configuration: SchemaConfiguration?): FrozenList { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, PathToSchemasMap(), LinkedHashSet()) + val pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet) + return getNewInstance(castArg, validationMetadata.pathToItem, pathToSchemasMap) + } + + override fun getNewInstance(arg: Map<*, *>, pathToItem: List, pathToSchemas: PathToSchemasMap): FrozenMap { + val properties: LinkedHashMap = LinkedHashMap() + for((propertyName, value) in arg) { + if (!(propertyName is String)) { + throw RuntimeException("Invalid non-string key value") + } + val propertyPathToItem: List = pathToItem + propertyName + val schemas: LinkedHashMap, Nothing?>? = pathToSchemas.get(propertyPathToItem) + if (schemas == null) { + throw RuntimeException("Validation result is invalid, schemas must exist for a pathToItem") + } + val propertySchema: JsonSchema<*> = schemas.entries.iterator().next().key + val propertyInstance: Any? = propertySchema.getNewInstance(value, propertyPathToItem, pathToSchemas) + properties[propertyName] = propertyInstance + } + val castProperties: FrozenMap = FrozenMap(properties) + return castProperties + } + + @Throws(ValidationException::class) + override fun validate(arg: Map<*, *>, configuration: SchemaConfiguration?): FrozenMap { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validatedPathToSchemas = PathToSchemasMap() + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, LinkedHashSet()) + val pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet) + return getNewInstance(castArg, validationMetadata.pathToItem, pathToSchemasMap) + } + + @Throws(ValidationException::class) + override fun validate(arg: Any?, configuration: SchemaConfiguration?): Any? { + if (arg == null) { + return validate(null, configuration) + } else if (arg is Boolean) { + return validate(arg, configuration) + } else if (arg is Number) { + return validate(arg, configuration) + } else if (arg is String) { + return validate(arg, configuration) + } else if (arg is List<*>) { + return validate(arg, configuration) + } else if (arg is Map<*, *>) { + return validate(arg, configuration) + } + throw ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema") + } + override fun getNewInstance(arg: Any?, pathToItem: List, pathToSchemas: PathToSchemasMap): Any? { + if (arg == null) { + return getNewInstance( null, pathToItem, pathToSchemas) + } else if (arg is Boolean) { + return getNewInstance(arg, pathToItem, pathToSchemas) + } else if (arg is Number) { + return getNewInstance(arg, pathToItem, pathToSchemas) + } else if (arg is String) { + return getNewInstance(arg, pathToItem, pathToSchemas) + } else if (arg is List<*>) { + return getNewInstance(arg, pathToItem, pathToSchemas) + } else if (arg is Map<*, *>) { + return getNewInstance(arg, pathToItem, pathToSchemas) + } + throw RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema") + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: Nothing?, configuration: SchemaConfiguration?): ElseSchemaBoxedVoid { + return ElseSchemaBoxedVoid(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: Boolean, configuration: SchemaConfiguration?): ElseSchemaBoxedBoolean { + return ElseSchemaBoxedBoolean(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: Number, configuration: SchemaConfiguration?): ElseSchemaBoxedNumber { + return ElseSchemaBoxedNumber(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: String, configuration: SchemaConfiguration?): ElseSchemaBoxedString { + return ElseSchemaBoxedString(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: List<*>, configuration: SchemaConfiguration?): ElseSchemaBoxedList { + return ElseSchemaBoxedList(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: Map<*, *>, configuration: SchemaConfiguration?): ElseSchemaBoxedMap { + return ElseSchemaBoxedMap(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: Any?, configuration: SchemaConfiguration?): ElseSchemaBoxed { + if (arg == null) { + return validateAndBox(null, configuration) + } else if (arg is Boolean) { + return validateAndBox(arg, configuration) + } else if (arg is String) { + return validateAndBox(arg, configuration) + } else if (arg is Number) { + return validateAndBox(arg, configuration) + } else if (arg is List<*>) { + return validateAndBox(arg, configuration) + } else if (arg is Map<*, *>) { + return validateAndBox(arg, configuration) + } + throw ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema") + } + } + + sealed interface IgnoreElseWithoutIf1Boxed { + fun getData(): Any? + } + + data class IgnoreElseWithoutIf1BoxedVoid(val data: Nothing?) : IgnoreElseWithoutIf1Boxed { + override fun getData(): Any? { + return data + } + } + + data class IgnoreElseWithoutIf1BoxedBoolean(val data: Boolean): IgnoreElseWithoutIf1Boxed { + override fun getData(): Any? { + return data + } + } + + data class IgnoreElseWithoutIf1BoxedNumber(val data: Number) : IgnoreElseWithoutIf1Boxed { + override fun getData(): Any? { + return data + } + } + + data class IgnoreElseWithoutIf1BoxedString(val data: String) : IgnoreElseWithoutIf1Boxed { + override fun getData(): Any? { + return data + } + } + + data class IgnoreElseWithoutIf1BoxedList(val data: FrozenList) : IgnoreElseWithoutIf1Boxed { + override fun getData(): Any? { + return data + } + } + + data class IgnoreElseWithoutIf1BoxedMap(val data: FrozenMap) : IgnoreElseWithoutIf1Boxed { + override fun getData(): Any? { + return data + } + } + + + class IgnoreElseWithoutIf1 private constructor(): JsonSchema( + JsonSchemaInfo() + .elseSchema(ElseSchema::class.java) + ), NullSchemaValidator, BooleanSchemaValidator, NumberSchemaValidator, StringSchemaValidator, ListSchemaValidator, IgnoreElseWithoutIf1BoxedList>, MapSchemaValidator, IgnoreElseWithoutIf1BoxedMap> { + /* + NOTE: This class is auto generated by OpenAPI JSON Schema Generator. + Ref: https://github.com/openapi-json-schema-tools/openapi-json-schema-generator + + Do not edit the class manually. + */ + + companion object { + @Volatile + private var instance: IgnoreElseWithoutIf1? = null + + fun getInstance() = + instance ?: synchronized(this) { + instance ?: IgnoreElseWithoutIf1().also { instance = it } + } + } + + @Throws(ValidationException::class) + override fun validate(arg: Nothing?, configuration: SchemaConfiguration?): Nothing? { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validatedPathToSchemas = PathToSchemasMap() + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, LinkedHashSet()) + getPathToSchemas(this, castArg, validationMetadata, pathSet) + return castArg + } + + @Throws(ValidationException::class) + override fun validate(arg: Boolean, configuration: SchemaConfiguration?): Boolean { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validatedPathToSchemas = PathToSchemasMap() + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, LinkedHashSet()) + getPathToSchemas(this, castArg, validationMetadata, pathSet) + return castArg + } + + @Throws(ValidationException::class) + override fun validate(arg: Number, configuration: SchemaConfiguration?): Number { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validatedPathToSchemas = PathToSchemasMap() + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, LinkedHashSet()) + getPathToSchemas(this, castArg, validationMetadata, pathSet) + return castArg + } + + @Throws(ValidationException::class) + fun validate(arg: Int, configuration: SchemaConfiguration?): Int { + return validate(arg as Number, configuration) as Int + } + + @Throws(ValidationException::class) + fun validate(arg: Long, configuration: SchemaConfiguration?): Long { + return validate(arg as Number, configuration) as Long + } + + @Throws(ValidationException::class) + fun validate(arg: Float, configuration: SchemaConfiguration?): Float { + return validate(arg as Number, configuration) as Float + } + + @Throws(ValidationException::class) + fun validate(arg: Double, configuration: SchemaConfiguration?): Double { + return validate(arg as Number, configuration) as Double + } + + @Throws(ValidationException::class) + override fun validate(arg: String, configuration: SchemaConfiguration?): String { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validatedPathToSchemas = PathToSchemasMap() + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, LinkedHashSet()) + getPathToSchemas(this, castArg, validationMetadata, pathSet) + return castArg + } + + @Throws(ValidationException::class) + fun validate(arg: LocalDate, configuration: SchemaConfiguration?): String { + return validate(arg.toString(), configuration) + } + + @Throws(ValidationException::class) + fun validate(arg: ZonedDateTime, configuration: SchemaConfiguration?): String { + return validate(arg.toString(), configuration) + } + + @Throws(ValidationException::class) + fun validate(arg: UUID, configuration: SchemaConfiguration?): String { + return validate(arg.toString(), configuration) + } + + override fun getNewInstance(arg: List<*>, pathToItem: List, pathToSchemas: PathToSchemasMap): FrozenList { + val items: MutableList = ArrayList() + var i: Int = 0 + for (item: Any? in arg) { + val itemPathToItem = pathToItem + i + val schemas: LinkedHashMap, Nothing?>? = pathToSchemas.get(itemPathToItem) + if (schemas == null) { + throw RuntimeException("Validation result is invalid, schemas must exist for a pathToItem") + } + val itemSchema: JsonSchema<*> = schemas.entries.iterator().next().key + val itemInstance: Any? = itemSchema.getNewInstance(item, itemPathToItem, pathToSchemas) + items.add(itemInstance) + i += 1 + } + val newInstanceItems: FrozenList = FrozenList(items) + return newInstanceItems + } + + @Throws(ValidationException::class) + override fun validate(arg: List<*>, configuration: SchemaConfiguration?): FrozenList { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, PathToSchemasMap(), LinkedHashSet()) + val pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet) + return getNewInstance(castArg, validationMetadata.pathToItem, pathToSchemasMap) + } + + override fun getNewInstance(arg: Map<*, *>, pathToItem: List, pathToSchemas: PathToSchemasMap): FrozenMap { + val properties: LinkedHashMap = LinkedHashMap() + for((propertyName, value) in arg) { + if (!(propertyName is String)) { + throw RuntimeException("Invalid non-string key value") + } + val propertyPathToItem: List = pathToItem + propertyName + val schemas: LinkedHashMap, Nothing?>? = pathToSchemas.get(propertyPathToItem) + if (schemas == null) { + throw RuntimeException("Validation result is invalid, schemas must exist for a pathToItem") + } + val propertySchema: JsonSchema<*> = schemas.entries.iterator().next().key + val propertyInstance: Any? = propertySchema.getNewInstance(value, propertyPathToItem, pathToSchemas) + properties[propertyName] = propertyInstance + } + val castProperties: FrozenMap = FrozenMap(properties) + return castProperties + } + + @Throws(ValidationException::class) + override fun validate(arg: Map<*, *>, configuration: SchemaConfiguration?): FrozenMap { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validatedPathToSchemas = PathToSchemasMap() + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, LinkedHashSet()) + val pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet) + return getNewInstance(castArg, validationMetadata.pathToItem, pathToSchemasMap) + } + + @Throws(ValidationException::class) + override fun validate(arg: Any?, configuration: SchemaConfiguration?): Any? { + if (arg == null) { + return validate(null, configuration) + } else if (arg is Boolean) { + return validate(arg, configuration) + } else if (arg is Number) { + return validate(arg, configuration) + } else if (arg is String) { + return validate(arg, configuration) + } else if (arg is List<*>) { + return validate(arg, configuration) + } else if (arg is Map<*, *>) { + return validate(arg, configuration) + } + throw ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema") + } + override fun getNewInstance(arg: Any?, pathToItem: List, pathToSchemas: PathToSchemasMap): Any? { + if (arg == null) { + return getNewInstance( null, pathToItem, pathToSchemas) + } else if (arg is Boolean) { + return getNewInstance(arg, pathToItem, pathToSchemas) + } else if (arg is Number) { + return getNewInstance(arg, pathToItem, pathToSchemas) + } else if (arg is String) { + return getNewInstance(arg, pathToItem, pathToSchemas) + } else if (arg is List<*>) { + return getNewInstance(arg, pathToItem, pathToSchemas) + } else if (arg is Map<*, *>) { + return getNewInstance(arg, pathToItem, pathToSchemas) + } + throw RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema") + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: Nothing?, configuration: SchemaConfiguration?): IgnoreElseWithoutIf1BoxedVoid { + return IgnoreElseWithoutIf1BoxedVoid(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: Boolean, configuration: SchemaConfiguration?): IgnoreElseWithoutIf1BoxedBoolean { + return IgnoreElseWithoutIf1BoxedBoolean(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: Number, configuration: SchemaConfiguration?): IgnoreElseWithoutIf1BoxedNumber { + return IgnoreElseWithoutIf1BoxedNumber(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: String, configuration: SchemaConfiguration?): IgnoreElseWithoutIf1BoxedString { + return IgnoreElseWithoutIf1BoxedString(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: List<*>, configuration: SchemaConfiguration?): IgnoreElseWithoutIf1BoxedList { + return IgnoreElseWithoutIf1BoxedList(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: Map<*, *>, configuration: SchemaConfiguration?): IgnoreElseWithoutIf1BoxedMap { + return IgnoreElseWithoutIf1BoxedMap(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: Any?, configuration: SchemaConfiguration?): IgnoreElseWithoutIf1Boxed { + if (arg == null) { + return validateAndBox(null, configuration) + } else if (arg is Boolean) { + return validateAndBox(arg, configuration) + } else if (arg is String) { + return validateAndBox(arg, configuration) + } else if (arg is Number) { + return validateAndBox(arg, configuration) + } else if (arg is List<*>) { + return validateAndBox(arg, configuration) + } else if (arg is Map<*, *>) { + return validateAndBox(arg, configuration) + } + throw ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema") + } + } +} diff --git a/samples/client/3_1_0_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/schemas/IgnoreIfWithoutThenOrElse.kt b/samples/client/3_1_0_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/schemas/IgnoreIfWithoutThenOrElse.kt new file mode 100644 index 00000000000..da5da5f2289 --- /dev/null +++ b/samples/client/3_1_0_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/schemas/IgnoreIfWithoutThenOrElse.kt @@ -0,0 +1,593 @@ +package org.openapijsonschematools.client.components.schemas +import java.time.LocalDate +import java.time.ZonedDateTime +import java.util.UUID +import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags +import org.openapijsonschematools.client.configurations.SchemaConfiguration +import org.openapijsonschematools.client.exceptions.InvalidAdditionalPropertyException +import org.openapijsonschematools.client.exceptions.UnsetPropertyException +import org.openapijsonschematools.client.exceptions.ValidationException +import org.openapijsonschematools.client.schemas.UnsetAddPropsSetter +import org.openapijsonschematools.client.schemas.validation.BooleanSchemaValidator +import org.openapijsonschematools.client.schemas.validation.FrozenList +import org.openapijsonschematools.client.schemas.validation.FrozenMap +import org.openapijsonschematools.client.schemas.validation.JsonSchema +import org.openapijsonschematools.client.schemas.validation.JsonSchemaInfo +import org.openapijsonschematools.client.schemas.validation.ListSchemaValidator +import org.openapijsonschematools.client.schemas.validation.MapSchemaValidator +import org.openapijsonschematools.client.schemas.validation.NullSchemaValidator +import org.openapijsonschematools.client.schemas.validation.NumberSchemaValidator +import org.openapijsonschematools.client.schemas.validation.PathToSchemasMap +import org.openapijsonschematools.client.schemas.validation.StringEnumValidator +import org.openapijsonschematools.client.schemas.validation.StringSchemaValidator +import org.openapijsonschematools.client.schemas.validation.StringValueMethod +import org.openapijsonschematools.client.schemas.validation.ValidationMetadata + +class IgnoreIfWithoutThenOrElse { + // nest classes so all schemas and input/output classes can be public + + enum class StringIfConst(private val value: String): StringValueMethod { + POSITIVE_0("0"); + + override fun value(): String { + return this.value + } + } + + + sealed interface IfSchemaBoxed { + fun getData(): Any? + } + + data class IfSchemaBoxedVoid(val data: Nothing?) : IfSchemaBoxed { + override fun getData(): Any? { + return data + } + } + + data class IfSchemaBoxedBoolean(val data: Boolean): IfSchemaBoxed { + override fun getData(): Any? { + return data + } + } + + data class IfSchemaBoxedNumber(val data: Number) : IfSchemaBoxed { + override fun getData(): Any? { + return data + } + } + + data class IfSchemaBoxedString(val data: String) : IfSchemaBoxed { + override fun getData(): Any? { + return data + } + } + + data class IfSchemaBoxedList(val data: FrozenList) : IfSchemaBoxed { + override fun getData(): Any? { + return data + } + } + + data class IfSchemaBoxedMap(val data: FrozenMap) : IfSchemaBoxed { + override fun getData(): Any? { + return data + } + } + + + class IfSchema private constructor(): JsonSchema( + JsonSchemaInfo() + .constValue("0") + ), NullSchemaValidator, BooleanSchemaValidator, NumberSchemaValidator, StringSchemaValidator, ListSchemaValidator, IfSchemaBoxedList>, MapSchemaValidator, IfSchemaBoxedMap> { + + companion object { + @Volatile + private var instance: IfSchema? = null + + fun getInstance() = + instance ?: synchronized(this) { + instance ?: IfSchema().also { instance = it } + } + } + + @Throws(ValidationException::class) + override fun validate(arg: Nothing?, configuration: SchemaConfiguration?): Nothing? { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validatedPathToSchemas = PathToSchemasMap() + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, LinkedHashSet()) + getPathToSchemas(this, castArg, validationMetadata, pathSet) + return castArg + } + + @Throws(ValidationException::class) + override fun validate(arg: Boolean, configuration: SchemaConfiguration?): Boolean { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validatedPathToSchemas = PathToSchemasMap() + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, LinkedHashSet()) + getPathToSchemas(this, castArg, validationMetadata, pathSet) + return castArg + } + + @Throws(ValidationException::class) + override fun validate(arg: Number, configuration: SchemaConfiguration?): Number { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validatedPathToSchemas = PathToSchemasMap() + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, LinkedHashSet()) + getPathToSchemas(this, castArg, validationMetadata, pathSet) + return castArg + } + + @Throws(ValidationException::class) + fun validate(arg: Int, configuration: SchemaConfiguration?): Int { + return validate(arg as Number, configuration) as Int + } + + @Throws(ValidationException::class) + fun validate(arg: Long, configuration: SchemaConfiguration?): Long { + return validate(arg as Number, configuration) as Long + } + + @Throws(ValidationException::class) + fun validate(arg: Float, configuration: SchemaConfiguration?): Float { + return validate(arg as Number, configuration) as Float + } + + @Throws(ValidationException::class) + fun validate(arg: Double, configuration: SchemaConfiguration?): Double { + return validate(arg as Number, configuration) as Double + } + + @Throws(ValidationException::class) + override fun validate(arg: String, configuration: SchemaConfiguration?): String { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validatedPathToSchemas = PathToSchemasMap() + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, LinkedHashSet()) + getPathToSchemas(this, castArg, validationMetadata, pathSet) + return castArg + } + + @Throws(ValidationException::class) + fun validate(arg: LocalDate, configuration: SchemaConfiguration?): String { + return validate(arg.toString(), configuration) + } + + @Throws(ValidationException::class) + fun validate(arg: ZonedDateTime, configuration: SchemaConfiguration?): String { + return validate(arg.toString(), configuration) + } + + @Throws(ValidationException::class) + fun validate(arg: UUID, configuration: SchemaConfiguration?): String { + return validate(arg.toString(), configuration) + } + + override fun getNewInstance(arg: List<*>, pathToItem: List, pathToSchemas: PathToSchemasMap): FrozenList { + val items: MutableList = ArrayList() + var i: Int = 0 + for (item: Any? in arg) { + val itemPathToItem = pathToItem + i + val schemas: LinkedHashMap, Nothing?>? = pathToSchemas.get(itemPathToItem) + if (schemas == null) { + throw RuntimeException("Validation result is invalid, schemas must exist for a pathToItem") + } + val itemSchema: JsonSchema<*> = schemas.entries.iterator().next().key + val itemInstance: Any? = itemSchema.getNewInstance(item, itemPathToItem, pathToSchemas) + items.add(itemInstance) + i += 1 + } + val newInstanceItems: FrozenList = FrozenList(items) + return newInstanceItems + } + + @Throws(ValidationException::class) + override fun validate(arg: List<*>, configuration: SchemaConfiguration?): FrozenList { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, PathToSchemasMap(), LinkedHashSet()) + val pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet) + return getNewInstance(castArg, validationMetadata.pathToItem, pathToSchemasMap) + } + + override fun getNewInstance(arg: Map<*, *>, pathToItem: List, pathToSchemas: PathToSchemasMap): FrozenMap { + val properties: LinkedHashMap = LinkedHashMap() + for((propertyName, value) in arg) { + if (!(propertyName is String)) { + throw RuntimeException("Invalid non-string key value") + } + val propertyPathToItem: List = pathToItem + propertyName + val schemas: LinkedHashMap, Nothing?>? = pathToSchemas.get(propertyPathToItem) + if (schemas == null) { + throw RuntimeException("Validation result is invalid, schemas must exist for a pathToItem") + } + val propertySchema: JsonSchema<*> = schemas.entries.iterator().next().key + val propertyInstance: Any? = propertySchema.getNewInstance(value, propertyPathToItem, pathToSchemas) + properties[propertyName] = propertyInstance + } + val castProperties: FrozenMap = FrozenMap(properties) + return castProperties + } + + @Throws(ValidationException::class) + override fun validate(arg: Map<*, *>, configuration: SchemaConfiguration?): FrozenMap { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validatedPathToSchemas = PathToSchemasMap() + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, LinkedHashSet()) + val pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet) + return getNewInstance(castArg, validationMetadata.pathToItem, pathToSchemasMap) + } + + @Throws(ValidationException::class) + override fun validate(arg: Any?, configuration: SchemaConfiguration?): Any? { + if (arg == null) { + return validate(null, configuration) + } else if (arg is Boolean) { + return validate(arg, configuration) + } else if (arg is Number) { + return validate(arg, configuration) + } else if (arg is String) { + return validate(arg, configuration) + } else if (arg is List<*>) { + return validate(arg, configuration) + } else if (arg is Map<*, *>) { + return validate(arg, configuration) + } + throw ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema") + } + override fun getNewInstance(arg: Any?, pathToItem: List, pathToSchemas: PathToSchemasMap): Any? { + if (arg == null) { + return getNewInstance( null, pathToItem, pathToSchemas) + } else if (arg is Boolean) { + return getNewInstance(arg, pathToItem, pathToSchemas) + } else if (arg is Number) { + return getNewInstance(arg, pathToItem, pathToSchemas) + } else if (arg is String) { + return getNewInstance(arg, pathToItem, pathToSchemas) + } else if (arg is List<*>) { + return getNewInstance(arg, pathToItem, pathToSchemas) + } else if (arg is Map<*, *>) { + return getNewInstance(arg, pathToItem, pathToSchemas) + } + throw RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema") + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: Nothing?, configuration: SchemaConfiguration?): IfSchemaBoxedVoid { + return IfSchemaBoxedVoid(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: Boolean, configuration: SchemaConfiguration?): IfSchemaBoxedBoolean { + return IfSchemaBoxedBoolean(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: Number, configuration: SchemaConfiguration?): IfSchemaBoxedNumber { + return IfSchemaBoxedNumber(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: String, configuration: SchemaConfiguration?): IfSchemaBoxedString { + return IfSchemaBoxedString(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: List<*>, configuration: SchemaConfiguration?): IfSchemaBoxedList { + return IfSchemaBoxedList(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: Map<*, *>, configuration: SchemaConfiguration?): IfSchemaBoxedMap { + return IfSchemaBoxedMap(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: Any?, configuration: SchemaConfiguration?): IfSchemaBoxed { + if (arg == null) { + return validateAndBox(null, configuration) + } else if (arg is Boolean) { + return validateAndBox(arg, configuration) + } else if (arg is String) { + return validateAndBox(arg, configuration) + } else if (arg is Number) { + return validateAndBox(arg, configuration) + } else if (arg is List<*>) { + return validateAndBox(arg, configuration) + } else if (arg is Map<*, *>) { + return validateAndBox(arg, configuration) + } + throw ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema") + } + } + + sealed interface IgnoreIfWithoutThenOrElse1Boxed { + fun getData(): Any? + } + + data class IgnoreIfWithoutThenOrElse1BoxedVoid(val data: Nothing?) : IgnoreIfWithoutThenOrElse1Boxed { + override fun getData(): Any? { + return data + } + } + + data class IgnoreIfWithoutThenOrElse1BoxedBoolean(val data: Boolean): IgnoreIfWithoutThenOrElse1Boxed { + override fun getData(): Any? { + return data + } + } + + data class IgnoreIfWithoutThenOrElse1BoxedNumber(val data: Number) : IgnoreIfWithoutThenOrElse1Boxed { + override fun getData(): Any? { + return data + } + } + + data class IgnoreIfWithoutThenOrElse1BoxedString(val data: String) : IgnoreIfWithoutThenOrElse1Boxed { + override fun getData(): Any? { + return data + } + } + + data class IgnoreIfWithoutThenOrElse1BoxedList(val data: FrozenList) : IgnoreIfWithoutThenOrElse1Boxed { + override fun getData(): Any? { + return data + } + } + + data class IgnoreIfWithoutThenOrElse1BoxedMap(val data: FrozenMap) : IgnoreIfWithoutThenOrElse1Boxed { + override fun getData(): Any? { + return data + } + } + + + class IgnoreIfWithoutThenOrElse1 private constructor(): JsonSchema( + JsonSchemaInfo() + .ifSchema(IfSchema::class.java) + ), NullSchemaValidator, BooleanSchemaValidator, NumberSchemaValidator, StringSchemaValidator, ListSchemaValidator, IgnoreIfWithoutThenOrElse1BoxedList>, MapSchemaValidator, IgnoreIfWithoutThenOrElse1BoxedMap> { + /* + NOTE: This class is auto generated by OpenAPI JSON Schema Generator. + Ref: https://github.com/openapi-json-schema-tools/openapi-json-schema-generator + + Do not edit the class manually. + */ + + companion object { + @Volatile + private var instance: IgnoreIfWithoutThenOrElse1? = null + + fun getInstance() = + instance ?: synchronized(this) { + instance ?: IgnoreIfWithoutThenOrElse1().also { instance = it } + } + } + + @Throws(ValidationException::class) + override fun validate(arg: Nothing?, configuration: SchemaConfiguration?): Nothing? { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validatedPathToSchemas = PathToSchemasMap() + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, LinkedHashSet()) + getPathToSchemas(this, castArg, validationMetadata, pathSet) + return castArg + } + + @Throws(ValidationException::class) + override fun validate(arg: Boolean, configuration: SchemaConfiguration?): Boolean { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validatedPathToSchemas = PathToSchemasMap() + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, LinkedHashSet()) + getPathToSchemas(this, castArg, validationMetadata, pathSet) + return castArg + } + + @Throws(ValidationException::class) + override fun validate(arg: Number, configuration: SchemaConfiguration?): Number { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validatedPathToSchemas = PathToSchemasMap() + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, LinkedHashSet()) + getPathToSchemas(this, castArg, validationMetadata, pathSet) + return castArg + } + + @Throws(ValidationException::class) + fun validate(arg: Int, configuration: SchemaConfiguration?): Int { + return validate(arg as Number, configuration) as Int + } + + @Throws(ValidationException::class) + fun validate(arg: Long, configuration: SchemaConfiguration?): Long { + return validate(arg as Number, configuration) as Long + } + + @Throws(ValidationException::class) + fun validate(arg: Float, configuration: SchemaConfiguration?): Float { + return validate(arg as Number, configuration) as Float + } + + @Throws(ValidationException::class) + fun validate(arg: Double, configuration: SchemaConfiguration?): Double { + return validate(arg as Number, configuration) as Double + } + + @Throws(ValidationException::class) + override fun validate(arg: String, configuration: SchemaConfiguration?): String { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validatedPathToSchemas = PathToSchemasMap() + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, LinkedHashSet()) + getPathToSchemas(this, castArg, validationMetadata, pathSet) + return castArg + } + + @Throws(ValidationException::class) + fun validate(arg: LocalDate, configuration: SchemaConfiguration?): String { + return validate(arg.toString(), configuration) + } + + @Throws(ValidationException::class) + fun validate(arg: ZonedDateTime, configuration: SchemaConfiguration?): String { + return validate(arg.toString(), configuration) + } + + @Throws(ValidationException::class) + fun validate(arg: UUID, configuration: SchemaConfiguration?): String { + return validate(arg.toString(), configuration) + } + + override fun getNewInstance(arg: List<*>, pathToItem: List, pathToSchemas: PathToSchemasMap): FrozenList { + val items: MutableList = ArrayList() + var i: Int = 0 + for (item: Any? in arg) { + val itemPathToItem = pathToItem + i + val schemas: LinkedHashMap, Nothing?>? = pathToSchemas.get(itemPathToItem) + if (schemas == null) { + throw RuntimeException("Validation result is invalid, schemas must exist for a pathToItem") + } + val itemSchema: JsonSchema<*> = schemas.entries.iterator().next().key + val itemInstance: Any? = itemSchema.getNewInstance(item, itemPathToItem, pathToSchemas) + items.add(itemInstance) + i += 1 + } + val newInstanceItems: FrozenList = FrozenList(items) + return newInstanceItems + } + + @Throws(ValidationException::class) + override fun validate(arg: List<*>, configuration: SchemaConfiguration?): FrozenList { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, PathToSchemasMap(), LinkedHashSet()) + val pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet) + return getNewInstance(castArg, validationMetadata.pathToItem, pathToSchemasMap) + } + + override fun getNewInstance(arg: Map<*, *>, pathToItem: List, pathToSchemas: PathToSchemasMap): FrozenMap { + val properties: LinkedHashMap = LinkedHashMap() + for((propertyName, value) in arg) { + if (!(propertyName is String)) { + throw RuntimeException("Invalid non-string key value") + } + val propertyPathToItem: List = pathToItem + propertyName + val schemas: LinkedHashMap, Nothing?>? = pathToSchemas.get(propertyPathToItem) + if (schemas == null) { + throw RuntimeException("Validation result is invalid, schemas must exist for a pathToItem") + } + val propertySchema: JsonSchema<*> = schemas.entries.iterator().next().key + val propertyInstance: Any? = propertySchema.getNewInstance(value, propertyPathToItem, pathToSchemas) + properties[propertyName] = propertyInstance + } + val castProperties: FrozenMap = FrozenMap(properties) + return castProperties + } + + @Throws(ValidationException::class) + override fun validate(arg: Map<*, *>, configuration: SchemaConfiguration?): FrozenMap { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validatedPathToSchemas = PathToSchemasMap() + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, LinkedHashSet()) + val pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet) + return getNewInstance(castArg, validationMetadata.pathToItem, pathToSchemasMap) + } + + @Throws(ValidationException::class) + override fun validate(arg: Any?, configuration: SchemaConfiguration?): Any? { + if (arg == null) { + return validate(null, configuration) + } else if (arg is Boolean) { + return validate(arg, configuration) + } else if (arg is Number) { + return validate(arg, configuration) + } else if (arg is String) { + return validate(arg, configuration) + } else if (arg is List<*>) { + return validate(arg, configuration) + } else if (arg is Map<*, *>) { + return validate(arg, configuration) + } + throw ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema") + } + override fun getNewInstance(arg: Any?, pathToItem: List, pathToSchemas: PathToSchemasMap): Any? { + if (arg == null) { + return getNewInstance( null, pathToItem, pathToSchemas) + } else if (arg is Boolean) { + return getNewInstance(arg, pathToItem, pathToSchemas) + } else if (arg is Number) { + return getNewInstance(arg, pathToItem, pathToSchemas) + } else if (arg is String) { + return getNewInstance(arg, pathToItem, pathToSchemas) + } else if (arg is List<*>) { + return getNewInstance(arg, pathToItem, pathToSchemas) + } else if (arg is Map<*, *>) { + return getNewInstance(arg, pathToItem, pathToSchemas) + } + throw RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema") + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: Nothing?, configuration: SchemaConfiguration?): IgnoreIfWithoutThenOrElse1BoxedVoid { + return IgnoreIfWithoutThenOrElse1BoxedVoid(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: Boolean, configuration: SchemaConfiguration?): IgnoreIfWithoutThenOrElse1BoxedBoolean { + return IgnoreIfWithoutThenOrElse1BoxedBoolean(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: Number, configuration: SchemaConfiguration?): IgnoreIfWithoutThenOrElse1BoxedNumber { + return IgnoreIfWithoutThenOrElse1BoxedNumber(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: String, configuration: SchemaConfiguration?): IgnoreIfWithoutThenOrElse1BoxedString { + return IgnoreIfWithoutThenOrElse1BoxedString(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: List<*>, configuration: SchemaConfiguration?): IgnoreIfWithoutThenOrElse1BoxedList { + return IgnoreIfWithoutThenOrElse1BoxedList(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: Map<*, *>, configuration: SchemaConfiguration?): IgnoreIfWithoutThenOrElse1BoxedMap { + return IgnoreIfWithoutThenOrElse1BoxedMap(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: Any?, configuration: SchemaConfiguration?): IgnoreIfWithoutThenOrElse1Boxed { + if (arg == null) { + return validateAndBox(null, configuration) + } else if (arg is Boolean) { + return validateAndBox(arg, configuration) + } else if (arg is String) { + return validateAndBox(arg, configuration) + } else if (arg is Number) { + return validateAndBox(arg, configuration) + } else if (arg is List<*>) { + return validateAndBox(arg, configuration) + } else if (arg is Map<*, *>) { + return validateAndBox(arg, configuration) + } + throw ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema") + } + } +} diff --git a/samples/client/3_1_0_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/schemas/IgnoreThenWithoutIf.kt b/samples/client/3_1_0_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/schemas/IgnoreThenWithoutIf.kt new file mode 100644 index 00000000000..42d529dfc20 --- /dev/null +++ b/samples/client/3_1_0_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/schemas/IgnoreThenWithoutIf.kt @@ -0,0 +1,593 @@ +package org.openapijsonschematools.client.components.schemas +import java.time.LocalDate +import java.time.ZonedDateTime +import java.util.UUID +import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags +import org.openapijsonschematools.client.configurations.SchemaConfiguration +import org.openapijsonschematools.client.exceptions.InvalidAdditionalPropertyException +import org.openapijsonschematools.client.exceptions.UnsetPropertyException +import org.openapijsonschematools.client.exceptions.ValidationException +import org.openapijsonschematools.client.schemas.UnsetAddPropsSetter +import org.openapijsonschematools.client.schemas.validation.BooleanSchemaValidator +import org.openapijsonschematools.client.schemas.validation.FrozenList +import org.openapijsonschematools.client.schemas.validation.FrozenMap +import org.openapijsonschematools.client.schemas.validation.JsonSchema +import org.openapijsonschematools.client.schemas.validation.JsonSchemaInfo +import org.openapijsonschematools.client.schemas.validation.ListSchemaValidator +import org.openapijsonschematools.client.schemas.validation.MapSchemaValidator +import org.openapijsonschematools.client.schemas.validation.NullSchemaValidator +import org.openapijsonschematools.client.schemas.validation.NumberSchemaValidator +import org.openapijsonschematools.client.schemas.validation.PathToSchemasMap +import org.openapijsonschematools.client.schemas.validation.StringEnumValidator +import org.openapijsonschematools.client.schemas.validation.StringSchemaValidator +import org.openapijsonschematools.client.schemas.validation.StringValueMethod +import org.openapijsonschematools.client.schemas.validation.ValidationMetadata + +class IgnoreThenWithoutIf { + // nest classes so all schemas and input/output classes can be public + + enum class StringThenConst(private val value: String): StringValueMethod { + POSITIVE_0("0"); + + override fun value(): String { + return this.value + } + } + + + sealed interface ThenBoxed { + fun getData(): Any? + } + + data class ThenBoxedVoid(val data: Nothing?) : ThenBoxed { + override fun getData(): Any? { + return data + } + } + + data class ThenBoxedBoolean(val data: Boolean): ThenBoxed { + override fun getData(): Any? { + return data + } + } + + data class ThenBoxedNumber(val data: Number) : ThenBoxed { + override fun getData(): Any? { + return data + } + } + + data class ThenBoxedString(val data: String) : ThenBoxed { + override fun getData(): Any? { + return data + } + } + + data class ThenBoxedList(val data: FrozenList) : ThenBoxed { + override fun getData(): Any? { + return data + } + } + + data class ThenBoxedMap(val data: FrozenMap) : ThenBoxed { + override fun getData(): Any? { + return data + } + } + + + class Then private constructor(): JsonSchema( + JsonSchemaInfo() + .constValue("0") + ), NullSchemaValidator, BooleanSchemaValidator, NumberSchemaValidator, StringSchemaValidator, ListSchemaValidator, ThenBoxedList>, MapSchemaValidator, ThenBoxedMap> { + + companion object { + @Volatile + private var instance: Then? = null + + fun getInstance() = + instance ?: synchronized(this) { + instance ?: Then().also { instance = it } + } + } + + @Throws(ValidationException::class) + override fun validate(arg: Nothing?, configuration: SchemaConfiguration?): Nothing? { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validatedPathToSchemas = PathToSchemasMap() + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, LinkedHashSet()) + getPathToSchemas(this, castArg, validationMetadata, pathSet) + return castArg + } + + @Throws(ValidationException::class) + override fun validate(arg: Boolean, configuration: SchemaConfiguration?): Boolean { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validatedPathToSchemas = PathToSchemasMap() + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, LinkedHashSet()) + getPathToSchemas(this, castArg, validationMetadata, pathSet) + return castArg + } + + @Throws(ValidationException::class) + override fun validate(arg: Number, configuration: SchemaConfiguration?): Number { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validatedPathToSchemas = PathToSchemasMap() + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, LinkedHashSet()) + getPathToSchemas(this, castArg, validationMetadata, pathSet) + return castArg + } + + @Throws(ValidationException::class) + fun validate(arg: Int, configuration: SchemaConfiguration?): Int { + return validate(arg as Number, configuration) as Int + } + + @Throws(ValidationException::class) + fun validate(arg: Long, configuration: SchemaConfiguration?): Long { + return validate(arg as Number, configuration) as Long + } + + @Throws(ValidationException::class) + fun validate(arg: Float, configuration: SchemaConfiguration?): Float { + return validate(arg as Number, configuration) as Float + } + + @Throws(ValidationException::class) + fun validate(arg: Double, configuration: SchemaConfiguration?): Double { + return validate(arg as Number, configuration) as Double + } + + @Throws(ValidationException::class) + override fun validate(arg: String, configuration: SchemaConfiguration?): String { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validatedPathToSchemas = PathToSchemasMap() + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, LinkedHashSet()) + getPathToSchemas(this, castArg, validationMetadata, pathSet) + return castArg + } + + @Throws(ValidationException::class) + fun validate(arg: LocalDate, configuration: SchemaConfiguration?): String { + return validate(arg.toString(), configuration) + } + + @Throws(ValidationException::class) + fun validate(arg: ZonedDateTime, configuration: SchemaConfiguration?): String { + return validate(arg.toString(), configuration) + } + + @Throws(ValidationException::class) + fun validate(arg: UUID, configuration: SchemaConfiguration?): String { + return validate(arg.toString(), configuration) + } + + override fun getNewInstance(arg: List<*>, pathToItem: List, pathToSchemas: PathToSchemasMap): FrozenList { + val items: MutableList = ArrayList() + var i: Int = 0 + for (item: Any? in arg) { + val itemPathToItem = pathToItem + i + val schemas: LinkedHashMap, Nothing?>? = pathToSchemas.get(itemPathToItem) + if (schemas == null) { + throw RuntimeException("Validation result is invalid, schemas must exist for a pathToItem") + } + val itemSchema: JsonSchema<*> = schemas.entries.iterator().next().key + val itemInstance: Any? = itemSchema.getNewInstance(item, itemPathToItem, pathToSchemas) + items.add(itemInstance) + i += 1 + } + val newInstanceItems: FrozenList = FrozenList(items) + return newInstanceItems + } + + @Throws(ValidationException::class) + override fun validate(arg: List<*>, configuration: SchemaConfiguration?): FrozenList { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, PathToSchemasMap(), LinkedHashSet()) + val pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet) + return getNewInstance(castArg, validationMetadata.pathToItem, pathToSchemasMap) + } + + override fun getNewInstance(arg: Map<*, *>, pathToItem: List, pathToSchemas: PathToSchemasMap): FrozenMap { + val properties: LinkedHashMap = LinkedHashMap() + for((propertyName, value) in arg) { + if (!(propertyName is String)) { + throw RuntimeException("Invalid non-string key value") + } + val propertyPathToItem: List = pathToItem + propertyName + val schemas: LinkedHashMap, Nothing?>? = pathToSchemas.get(propertyPathToItem) + if (schemas == null) { + throw RuntimeException("Validation result is invalid, schemas must exist for a pathToItem") + } + val propertySchema: JsonSchema<*> = schemas.entries.iterator().next().key + val propertyInstance: Any? = propertySchema.getNewInstance(value, propertyPathToItem, pathToSchemas) + properties[propertyName] = propertyInstance + } + val castProperties: FrozenMap = FrozenMap(properties) + return castProperties + } + + @Throws(ValidationException::class) + override fun validate(arg: Map<*, *>, configuration: SchemaConfiguration?): FrozenMap { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validatedPathToSchemas = PathToSchemasMap() + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, LinkedHashSet()) + val pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet) + return getNewInstance(castArg, validationMetadata.pathToItem, pathToSchemasMap) + } + + @Throws(ValidationException::class) + override fun validate(arg: Any?, configuration: SchemaConfiguration?): Any? { + if (arg == null) { + return validate(null, configuration) + } else if (arg is Boolean) { + return validate(arg, configuration) + } else if (arg is Number) { + return validate(arg, configuration) + } else if (arg is String) { + return validate(arg, configuration) + } else if (arg is List<*>) { + return validate(arg, configuration) + } else if (arg is Map<*, *>) { + return validate(arg, configuration) + } + throw ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema") + } + override fun getNewInstance(arg: Any?, pathToItem: List, pathToSchemas: PathToSchemasMap): Any? { + if (arg == null) { + return getNewInstance( null, pathToItem, pathToSchemas) + } else if (arg is Boolean) { + return getNewInstance(arg, pathToItem, pathToSchemas) + } else if (arg is Number) { + return getNewInstance(arg, pathToItem, pathToSchemas) + } else if (arg is String) { + return getNewInstance(arg, pathToItem, pathToSchemas) + } else if (arg is List<*>) { + return getNewInstance(arg, pathToItem, pathToSchemas) + } else if (arg is Map<*, *>) { + return getNewInstance(arg, pathToItem, pathToSchemas) + } + throw RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema") + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: Nothing?, configuration: SchemaConfiguration?): ThenBoxedVoid { + return ThenBoxedVoid(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: Boolean, configuration: SchemaConfiguration?): ThenBoxedBoolean { + return ThenBoxedBoolean(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: Number, configuration: SchemaConfiguration?): ThenBoxedNumber { + return ThenBoxedNumber(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: String, configuration: SchemaConfiguration?): ThenBoxedString { + return ThenBoxedString(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: List<*>, configuration: SchemaConfiguration?): ThenBoxedList { + return ThenBoxedList(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: Map<*, *>, configuration: SchemaConfiguration?): ThenBoxedMap { + return ThenBoxedMap(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: Any?, configuration: SchemaConfiguration?): ThenBoxed { + if (arg == null) { + return validateAndBox(null, configuration) + } else if (arg is Boolean) { + return validateAndBox(arg, configuration) + } else if (arg is String) { + return validateAndBox(arg, configuration) + } else if (arg is Number) { + return validateAndBox(arg, configuration) + } else if (arg is List<*>) { + return validateAndBox(arg, configuration) + } else if (arg is Map<*, *>) { + return validateAndBox(arg, configuration) + } + throw ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema") + } + } + + sealed interface IgnoreThenWithoutIf1Boxed { + fun getData(): Any? + } + + data class IgnoreThenWithoutIf1BoxedVoid(val data: Nothing?) : IgnoreThenWithoutIf1Boxed { + override fun getData(): Any? { + return data + } + } + + data class IgnoreThenWithoutIf1BoxedBoolean(val data: Boolean): IgnoreThenWithoutIf1Boxed { + override fun getData(): Any? { + return data + } + } + + data class IgnoreThenWithoutIf1BoxedNumber(val data: Number) : IgnoreThenWithoutIf1Boxed { + override fun getData(): Any? { + return data + } + } + + data class IgnoreThenWithoutIf1BoxedString(val data: String) : IgnoreThenWithoutIf1Boxed { + override fun getData(): Any? { + return data + } + } + + data class IgnoreThenWithoutIf1BoxedList(val data: FrozenList) : IgnoreThenWithoutIf1Boxed { + override fun getData(): Any? { + return data + } + } + + data class IgnoreThenWithoutIf1BoxedMap(val data: FrozenMap) : IgnoreThenWithoutIf1Boxed { + override fun getData(): Any? { + return data + } + } + + + class IgnoreThenWithoutIf1 private constructor(): JsonSchema( + JsonSchemaInfo() + .then(Then::class.java) + ), NullSchemaValidator, BooleanSchemaValidator, NumberSchemaValidator, StringSchemaValidator, ListSchemaValidator, IgnoreThenWithoutIf1BoxedList>, MapSchemaValidator, IgnoreThenWithoutIf1BoxedMap> { + /* + NOTE: This class is auto generated by OpenAPI JSON Schema Generator. + Ref: https://github.com/openapi-json-schema-tools/openapi-json-schema-generator + + Do not edit the class manually. + */ + + companion object { + @Volatile + private var instance: IgnoreThenWithoutIf1? = null + + fun getInstance() = + instance ?: synchronized(this) { + instance ?: IgnoreThenWithoutIf1().also { instance = it } + } + } + + @Throws(ValidationException::class) + override fun validate(arg: Nothing?, configuration: SchemaConfiguration?): Nothing? { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validatedPathToSchemas = PathToSchemasMap() + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, LinkedHashSet()) + getPathToSchemas(this, castArg, validationMetadata, pathSet) + return castArg + } + + @Throws(ValidationException::class) + override fun validate(arg: Boolean, configuration: SchemaConfiguration?): Boolean { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validatedPathToSchemas = PathToSchemasMap() + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, LinkedHashSet()) + getPathToSchemas(this, castArg, validationMetadata, pathSet) + return castArg + } + + @Throws(ValidationException::class) + override fun validate(arg: Number, configuration: SchemaConfiguration?): Number { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validatedPathToSchemas = PathToSchemasMap() + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, LinkedHashSet()) + getPathToSchemas(this, castArg, validationMetadata, pathSet) + return castArg + } + + @Throws(ValidationException::class) + fun validate(arg: Int, configuration: SchemaConfiguration?): Int { + return validate(arg as Number, configuration) as Int + } + + @Throws(ValidationException::class) + fun validate(arg: Long, configuration: SchemaConfiguration?): Long { + return validate(arg as Number, configuration) as Long + } + + @Throws(ValidationException::class) + fun validate(arg: Float, configuration: SchemaConfiguration?): Float { + return validate(arg as Number, configuration) as Float + } + + @Throws(ValidationException::class) + fun validate(arg: Double, configuration: SchemaConfiguration?): Double { + return validate(arg as Number, configuration) as Double + } + + @Throws(ValidationException::class) + override fun validate(arg: String, configuration: SchemaConfiguration?): String { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validatedPathToSchemas = PathToSchemasMap() + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, LinkedHashSet()) + getPathToSchemas(this, castArg, validationMetadata, pathSet) + return castArg + } + + @Throws(ValidationException::class) + fun validate(arg: LocalDate, configuration: SchemaConfiguration?): String { + return validate(arg.toString(), configuration) + } + + @Throws(ValidationException::class) + fun validate(arg: ZonedDateTime, configuration: SchemaConfiguration?): String { + return validate(arg.toString(), configuration) + } + + @Throws(ValidationException::class) + fun validate(arg: UUID, configuration: SchemaConfiguration?): String { + return validate(arg.toString(), configuration) + } + + override fun getNewInstance(arg: List<*>, pathToItem: List, pathToSchemas: PathToSchemasMap): FrozenList { + val items: MutableList = ArrayList() + var i: Int = 0 + for (item: Any? in arg) { + val itemPathToItem = pathToItem + i + val schemas: LinkedHashMap, Nothing?>? = pathToSchemas.get(itemPathToItem) + if (schemas == null) { + throw RuntimeException("Validation result is invalid, schemas must exist for a pathToItem") + } + val itemSchema: JsonSchema<*> = schemas.entries.iterator().next().key + val itemInstance: Any? = itemSchema.getNewInstance(item, itemPathToItem, pathToSchemas) + items.add(itemInstance) + i += 1 + } + val newInstanceItems: FrozenList = FrozenList(items) + return newInstanceItems + } + + @Throws(ValidationException::class) + override fun validate(arg: List<*>, configuration: SchemaConfiguration?): FrozenList { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, PathToSchemasMap(), LinkedHashSet()) + val pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet) + return getNewInstance(castArg, validationMetadata.pathToItem, pathToSchemasMap) + } + + override fun getNewInstance(arg: Map<*, *>, pathToItem: List, pathToSchemas: PathToSchemasMap): FrozenMap { + val properties: LinkedHashMap = LinkedHashMap() + for((propertyName, value) in arg) { + if (!(propertyName is String)) { + throw RuntimeException("Invalid non-string key value") + } + val propertyPathToItem: List = pathToItem + propertyName + val schemas: LinkedHashMap, Nothing?>? = pathToSchemas.get(propertyPathToItem) + if (schemas == null) { + throw RuntimeException("Validation result is invalid, schemas must exist for a pathToItem") + } + val propertySchema: JsonSchema<*> = schemas.entries.iterator().next().key + val propertyInstance: Any? = propertySchema.getNewInstance(value, propertyPathToItem, pathToSchemas) + properties[propertyName] = propertyInstance + } + val castProperties: FrozenMap = FrozenMap(properties) + return castProperties + } + + @Throws(ValidationException::class) + override fun validate(arg: Map<*, *>, configuration: SchemaConfiguration?): FrozenMap { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validatedPathToSchemas = PathToSchemasMap() + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, LinkedHashSet()) + val pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet) + return getNewInstance(castArg, validationMetadata.pathToItem, pathToSchemasMap) + } + + @Throws(ValidationException::class) + override fun validate(arg: Any?, configuration: SchemaConfiguration?): Any? { + if (arg == null) { + return validate(null, configuration) + } else if (arg is Boolean) { + return validate(arg, configuration) + } else if (arg is Number) { + return validate(arg, configuration) + } else if (arg is String) { + return validate(arg, configuration) + } else if (arg is List<*>) { + return validate(arg, configuration) + } else if (arg is Map<*, *>) { + return validate(arg, configuration) + } + throw ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema") + } + override fun getNewInstance(arg: Any?, pathToItem: List, pathToSchemas: PathToSchemasMap): Any? { + if (arg == null) { + return getNewInstance( null, pathToItem, pathToSchemas) + } else if (arg is Boolean) { + return getNewInstance(arg, pathToItem, pathToSchemas) + } else if (arg is Number) { + return getNewInstance(arg, pathToItem, pathToSchemas) + } else if (arg is String) { + return getNewInstance(arg, pathToItem, pathToSchemas) + } else if (arg is List<*>) { + return getNewInstance(arg, pathToItem, pathToSchemas) + } else if (arg is Map<*, *>) { + return getNewInstance(arg, pathToItem, pathToSchemas) + } + throw RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema") + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: Nothing?, configuration: SchemaConfiguration?): IgnoreThenWithoutIf1BoxedVoid { + return IgnoreThenWithoutIf1BoxedVoid(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: Boolean, configuration: SchemaConfiguration?): IgnoreThenWithoutIf1BoxedBoolean { + return IgnoreThenWithoutIf1BoxedBoolean(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: Number, configuration: SchemaConfiguration?): IgnoreThenWithoutIf1BoxedNumber { + return IgnoreThenWithoutIf1BoxedNumber(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: String, configuration: SchemaConfiguration?): IgnoreThenWithoutIf1BoxedString { + return IgnoreThenWithoutIf1BoxedString(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: List<*>, configuration: SchemaConfiguration?): IgnoreThenWithoutIf1BoxedList { + return IgnoreThenWithoutIf1BoxedList(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: Map<*, *>, configuration: SchemaConfiguration?): IgnoreThenWithoutIf1BoxedMap { + return IgnoreThenWithoutIf1BoxedMap(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: Any?, configuration: SchemaConfiguration?): IgnoreThenWithoutIf1Boxed { + if (arg == null) { + return validateAndBox(null, configuration) + } else if (arg is Boolean) { + return validateAndBox(arg, configuration) + } else if (arg is String) { + return validateAndBox(arg, configuration) + } else if (arg is Number) { + return validateAndBox(arg, configuration) + } else if (arg is List<*>) { + return validateAndBox(arg, configuration) + } else if (arg is Map<*, *>) { + return validateAndBox(arg, configuration) + } + throw ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema") + } + } +} diff --git a/samples/client/3_1_0_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/schemas/IntegerTypeMatchesIntegers.kt b/samples/client/3_1_0_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/schemas/IntegerTypeMatchesIntegers.kt new file mode 100644 index 00000000000..fef4eb00f39 --- /dev/null +++ b/samples/client/3_1_0_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/schemas/IntegerTypeMatchesIntegers.kt @@ -0,0 +1,20 @@ +package org.openapijsonschematools.client.components.schemas +import org.openapijsonschematools.client.schemas.IntJsonSchema + +class IntegerTypeMatchesIntegers: IntJsonSchema() { + // nest classes so all schemas and input/output classes can be public + + + class IntegerTypeMatchesIntegers1 : IntJsonSchema.IntJsonSchema1() { + companion object { + @Volatile + private var instance: IntegerTypeMatchesIntegers1? = null + + fun getInstance() = + instance ?: synchronized(this) { + instance ?: IntegerTypeMatchesIntegers1().also { instance = it } + } + } + } + +} diff --git a/samples/client/3_1_0_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/schemas/Ipv4Format.kt b/samples/client/3_1_0_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/schemas/Ipv4Format.kt new file mode 100644 index 00000000000..6daf2520bd4 --- /dev/null +++ b/samples/client/3_1_0_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/schemas/Ipv4Format.kt @@ -0,0 +1,308 @@ +package org.openapijsonschematools.client.components.schemas +import java.time.LocalDate +import java.time.ZonedDateTime +import java.util.UUID +import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags +import org.openapijsonschematools.client.configurations.SchemaConfiguration +import org.openapijsonschematools.client.exceptions.InvalidAdditionalPropertyException +import org.openapijsonschematools.client.exceptions.UnsetPropertyException +import org.openapijsonschematools.client.exceptions.ValidationException +import org.openapijsonschematools.client.schemas.UnsetAddPropsSetter +import org.openapijsonschematools.client.schemas.validation.BooleanSchemaValidator +import org.openapijsonschematools.client.schemas.validation.FrozenList +import org.openapijsonschematools.client.schemas.validation.FrozenMap +import org.openapijsonschematools.client.schemas.validation.JsonSchema +import org.openapijsonschematools.client.schemas.validation.JsonSchemaInfo +import org.openapijsonschematools.client.schemas.validation.ListSchemaValidator +import org.openapijsonschematools.client.schemas.validation.MapSchemaValidator +import org.openapijsonschematools.client.schemas.validation.NullSchemaValidator +import org.openapijsonschematools.client.schemas.validation.NumberSchemaValidator +import org.openapijsonschematools.client.schemas.validation.PathToSchemasMap +import org.openapijsonschematools.client.schemas.validation.StringSchemaValidator +import org.openapijsonschematools.client.schemas.validation.ValidationMetadata + +class Ipv4Format { + // nest classes so all schemas and input/output classes can be public + + + sealed interface Ipv4Format1Boxed { + fun getData(): Any? + } + + data class Ipv4Format1BoxedVoid(val data: Nothing?) : Ipv4Format1Boxed { + override fun getData(): Any? { + return data + } + } + + data class Ipv4Format1BoxedBoolean(val data: Boolean): Ipv4Format1Boxed { + override fun getData(): Any? { + return data + } + } + + data class Ipv4Format1BoxedNumber(val data: Number) : Ipv4Format1Boxed { + override fun getData(): Any? { + return data + } + } + + data class Ipv4Format1BoxedString(val data: String) : Ipv4Format1Boxed { + override fun getData(): Any? { + return data + } + } + + data class Ipv4Format1BoxedList(val data: FrozenList) : Ipv4Format1Boxed { + override fun getData(): Any? { + return data + } + } + + data class Ipv4Format1BoxedMap(val data: FrozenMap) : Ipv4Format1Boxed { + override fun getData(): Any? { + return data + } + } + + + class Ipv4Format1 private constructor(): JsonSchema( + JsonSchemaInfo() + .format("ipv4") + ), NullSchemaValidator, BooleanSchemaValidator, NumberSchemaValidator, StringSchemaValidator, ListSchemaValidator, Ipv4Format1BoxedList>, MapSchemaValidator, Ipv4Format1BoxedMap> { + /* + NOTE: This class is auto generated by OpenAPI JSON Schema Generator. + Ref: https://github.com/openapi-json-schema-tools/openapi-json-schema-generator + + Do not edit the class manually. + */ + + companion object { + @Volatile + private var instance: Ipv4Format1? = null + + fun getInstance() = + instance ?: synchronized(this) { + instance ?: Ipv4Format1().also { instance = it } + } + } + + @Throws(ValidationException::class) + override fun validate(arg: Nothing?, configuration: SchemaConfiguration?): Nothing? { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validatedPathToSchemas = PathToSchemasMap() + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, LinkedHashSet()) + getPathToSchemas(this, castArg, validationMetadata, pathSet) + return castArg + } + + @Throws(ValidationException::class) + override fun validate(arg: Boolean, configuration: SchemaConfiguration?): Boolean { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validatedPathToSchemas = PathToSchemasMap() + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, LinkedHashSet()) + getPathToSchemas(this, castArg, validationMetadata, pathSet) + return castArg + } + + @Throws(ValidationException::class) + override fun validate(arg: Number, configuration: SchemaConfiguration?): Number { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validatedPathToSchemas = PathToSchemasMap() + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, LinkedHashSet()) + getPathToSchemas(this, castArg, validationMetadata, pathSet) + return castArg + } + + @Throws(ValidationException::class) + fun validate(arg: Int, configuration: SchemaConfiguration?): Int { + return validate(arg as Number, configuration) as Int + } + + @Throws(ValidationException::class) + fun validate(arg: Long, configuration: SchemaConfiguration?): Long { + return validate(arg as Number, configuration) as Long + } + + @Throws(ValidationException::class) + fun validate(arg: Float, configuration: SchemaConfiguration?): Float { + return validate(arg as Number, configuration) as Float + } + + @Throws(ValidationException::class) + fun validate(arg: Double, configuration: SchemaConfiguration?): Double { + return validate(arg as Number, configuration) as Double + } + + @Throws(ValidationException::class) + override fun validate(arg: String, configuration: SchemaConfiguration?): String { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validatedPathToSchemas = PathToSchemasMap() + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, LinkedHashSet()) + getPathToSchemas(this, castArg, validationMetadata, pathSet) + return castArg + } + + @Throws(ValidationException::class) + fun validate(arg: LocalDate, configuration: SchemaConfiguration?): String { + return validate(arg.toString(), configuration) + } + + @Throws(ValidationException::class) + fun validate(arg: ZonedDateTime, configuration: SchemaConfiguration?): String { + return validate(arg.toString(), configuration) + } + + @Throws(ValidationException::class) + fun validate(arg: UUID, configuration: SchemaConfiguration?): String { + return validate(arg.toString(), configuration) + } + + override fun getNewInstance(arg: List<*>, pathToItem: List, pathToSchemas: PathToSchemasMap): FrozenList { + val items: MutableList = ArrayList() + var i: Int = 0 + for (item: Any? in arg) { + val itemPathToItem = pathToItem + i + val schemas: LinkedHashMap, Nothing?>? = pathToSchemas.get(itemPathToItem) + if (schemas == null) { + throw RuntimeException("Validation result is invalid, schemas must exist for a pathToItem") + } + val itemSchema: JsonSchema<*> = schemas.entries.iterator().next().key + val itemInstance: Any? = itemSchema.getNewInstance(item, itemPathToItem, pathToSchemas) + items.add(itemInstance) + i += 1 + } + val newInstanceItems: FrozenList = FrozenList(items) + return newInstanceItems + } + + @Throws(ValidationException::class) + override fun validate(arg: List<*>, configuration: SchemaConfiguration?): FrozenList { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, PathToSchemasMap(), LinkedHashSet()) + val pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet) + return getNewInstance(castArg, validationMetadata.pathToItem, pathToSchemasMap) + } + + override fun getNewInstance(arg: Map<*, *>, pathToItem: List, pathToSchemas: PathToSchemasMap): FrozenMap { + val properties: LinkedHashMap = LinkedHashMap() + for((propertyName, value) in arg) { + if (!(propertyName is String)) { + throw RuntimeException("Invalid non-string key value") + } + val propertyPathToItem: List = pathToItem + propertyName + val schemas: LinkedHashMap, Nothing?>? = pathToSchemas.get(propertyPathToItem) + if (schemas == null) { + throw RuntimeException("Validation result is invalid, schemas must exist for a pathToItem") + } + val propertySchema: JsonSchema<*> = schemas.entries.iterator().next().key + val propertyInstance: Any? = propertySchema.getNewInstance(value, propertyPathToItem, pathToSchemas) + properties[propertyName] = propertyInstance + } + val castProperties: FrozenMap = FrozenMap(properties) + return castProperties + } + + @Throws(ValidationException::class) + override fun validate(arg: Map<*, *>, configuration: SchemaConfiguration?): FrozenMap { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validatedPathToSchemas = PathToSchemasMap() + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, LinkedHashSet()) + val pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet) + return getNewInstance(castArg, validationMetadata.pathToItem, pathToSchemasMap) + } + + @Throws(ValidationException::class) + override fun validate(arg: Any?, configuration: SchemaConfiguration?): Any? { + if (arg == null) { + return validate(null, configuration) + } else if (arg is Boolean) { + return validate(arg, configuration) + } else if (arg is Number) { + return validate(arg, configuration) + } else if (arg is String) { + return validate(arg, configuration) + } else if (arg is List<*>) { + return validate(arg, configuration) + } else if (arg is Map<*, *>) { + return validate(arg, configuration) + } + throw ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema") + } + override fun getNewInstance(arg: Any?, pathToItem: List, pathToSchemas: PathToSchemasMap): Any? { + if (arg == null) { + return getNewInstance( null, pathToItem, pathToSchemas) + } else if (arg is Boolean) { + return getNewInstance(arg, pathToItem, pathToSchemas) + } else if (arg is Number) { + return getNewInstance(arg, pathToItem, pathToSchemas) + } else if (arg is String) { + return getNewInstance(arg, pathToItem, pathToSchemas) + } else if (arg is List<*>) { + return getNewInstance(arg, pathToItem, pathToSchemas) + } else if (arg is Map<*, *>) { + return getNewInstance(arg, pathToItem, pathToSchemas) + } + throw RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema") + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: Nothing?, configuration: SchemaConfiguration?): Ipv4Format1BoxedVoid { + return Ipv4Format1BoxedVoid(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: Boolean, configuration: SchemaConfiguration?): Ipv4Format1BoxedBoolean { + return Ipv4Format1BoxedBoolean(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: Number, configuration: SchemaConfiguration?): Ipv4Format1BoxedNumber { + return Ipv4Format1BoxedNumber(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: String, configuration: SchemaConfiguration?): Ipv4Format1BoxedString { + return Ipv4Format1BoxedString(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: List<*>, configuration: SchemaConfiguration?): Ipv4Format1BoxedList { + return Ipv4Format1BoxedList(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: Map<*, *>, configuration: SchemaConfiguration?): Ipv4Format1BoxedMap { + return Ipv4Format1BoxedMap(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: Any?, configuration: SchemaConfiguration?): Ipv4Format1Boxed { + if (arg == null) { + return validateAndBox(null, configuration) + } else if (arg is Boolean) { + return validateAndBox(arg, configuration) + } else if (arg is String) { + return validateAndBox(arg, configuration) + } else if (arg is Number) { + return validateAndBox(arg, configuration) + } else if (arg is List<*>) { + return validateAndBox(arg, configuration) + } else if (arg is Map<*, *>) { + return validateAndBox(arg, configuration) + } + throw ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema") + } + } +} diff --git a/samples/client/3_1_0_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/schemas/Ipv6Format.kt b/samples/client/3_1_0_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/schemas/Ipv6Format.kt new file mode 100644 index 00000000000..e08e410e9ea --- /dev/null +++ b/samples/client/3_1_0_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/schemas/Ipv6Format.kt @@ -0,0 +1,308 @@ +package org.openapijsonschematools.client.components.schemas +import java.time.LocalDate +import java.time.ZonedDateTime +import java.util.UUID +import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags +import org.openapijsonschematools.client.configurations.SchemaConfiguration +import org.openapijsonschematools.client.exceptions.InvalidAdditionalPropertyException +import org.openapijsonschematools.client.exceptions.UnsetPropertyException +import org.openapijsonschematools.client.exceptions.ValidationException +import org.openapijsonschematools.client.schemas.UnsetAddPropsSetter +import org.openapijsonschematools.client.schemas.validation.BooleanSchemaValidator +import org.openapijsonschematools.client.schemas.validation.FrozenList +import org.openapijsonschematools.client.schemas.validation.FrozenMap +import org.openapijsonschematools.client.schemas.validation.JsonSchema +import org.openapijsonschematools.client.schemas.validation.JsonSchemaInfo +import org.openapijsonschematools.client.schemas.validation.ListSchemaValidator +import org.openapijsonschematools.client.schemas.validation.MapSchemaValidator +import org.openapijsonschematools.client.schemas.validation.NullSchemaValidator +import org.openapijsonschematools.client.schemas.validation.NumberSchemaValidator +import org.openapijsonschematools.client.schemas.validation.PathToSchemasMap +import org.openapijsonschematools.client.schemas.validation.StringSchemaValidator +import org.openapijsonschematools.client.schemas.validation.ValidationMetadata + +class Ipv6Format { + // nest classes so all schemas and input/output classes can be public + + + sealed interface Ipv6Format1Boxed { + fun getData(): Any? + } + + data class Ipv6Format1BoxedVoid(val data: Nothing?) : Ipv6Format1Boxed { + override fun getData(): Any? { + return data + } + } + + data class Ipv6Format1BoxedBoolean(val data: Boolean): Ipv6Format1Boxed { + override fun getData(): Any? { + return data + } + } + + data class Ipv6Format1BoxedNumber(val data: Number) : Ipv6Format1Boxed { + override fun getData(): Any? { + return data + } + } + + data class Ipv6Format1BoxedString(val data: String) : Ipv6Format1Boxed { + override fun getData(): Any? { + return data + } + } + + data class Ipv6Format1BoxedList(val data: FrozenList) : Ipv6Format1Boxed { + override fun getData(): Any? { + return data + } + } + + data class Ipv6Format1BoxedMap(val data: FrozenMap) : Ipv6Format1Boxed { + override fun getData(): Any? { + return data + } + } + + + class Ipv6Format1 private constructor(): JsonSchema( + JsonSchemaInfo() + .format("ipv6") + ), NullSchemaValidator, BooleanSchemaValidator, NumberSchemaValidator, StringSchemaValidator, ListSchemaValidator, Ipv6Format1BoxedList>, MapSchemaValidator, Ipv6Format1BoxedMap> { + /* + NOTE: This class is auto generated by OpenAPI JSON Schema Generator. + Ref: https://github.com/openapi-json-schema-tools/openapi-json-schema-generator + + Do not edit the class manually. + */ + + companion object { + @Volatile + private var instance: Ipv6Format1? = null + + fun getInstance() = + instance ?: synchronized(this) { + instance ?: Ipv6Format1().also { instance = it } + } + } + + @Throws(ValidationException::class) + override fun validate(arg: Nothing?, configuration: SchemaConfiguration?): Nothing? { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validatedPathToSchemas = PathToSchemasMap() + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, LinkedHashSet()) + getPathToSchemas(this, castArg, validationMetadata, pathSet) + return castArg + } + + @Throws(ValidationException::class) + override fun validate(arg: Boolean, configuration: SchemaConfiguration?): Boolean { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validatedPathToSchemas = PathToSchemasMap() + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, LinkedHashSet()) + getPathToSchemas(this, castArg, validationMetadata, pathSet) + return castArg + } + + @Throws(ValidationException::class) + override fun validate(arg: Number, configuration: SchemaConfiguration?): Number { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validatedPathToSchemas = PathToSchemasMap() + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, LinkedHashSet()) + getPathToSchemas(this, castArg, validationMetadata, pathSet) + return castArg + } + + @Throws(ValidationException::class) + fun validate(arg: Int, configuration: SchemaConfiguration?): Int { + return validate(arg as Number, configuration) as Int + } + + @Throws(ValidationException::class) + fun validate(arg: Long, configuration: SchemaConfiguration?): Long { + return validate(arg as Number, configuration) as Long + } + + @Throws(ValidationException::class) + fun validate(arg: Float, configuration: SchemaConfiguration?): Float { + return validate(arg as Number, configuration) as Float + } + + @Throws(ValidationException::class) + fun validate(arg: Double, configuration: SchemaConfiguration?): Double { + return validate(arg as Number, configuration) as Double + } + + @Throws(ValidationException::class) + override fun validate(arg: String, configuration: SchemaConfiguration?): String { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validatedPathToSchemas = PathToSchemasMap() + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, LinkedHashSet()) + getPathToSchemas(this, castArg, validationMetadata, pathSet) + return castArg + } + + @Throws(ValidationException::class) + fun validate(arg: LocalDate, configuration: SchemaConfiguration?): String { + return validate(arg.toString(), configuration) + } + + @Throws(ValidationException::class) + fun validate(arg: ZonedDateTime, configuration: SchemaConfiguration?): String { + return validate(arg.toString(), configuration) + } + + @Throws(ValidationException::class) + fun validate(arg: UUID, configuration: SchemaConfiguration?): String { + return validate(arg.toString(), configuration) + } + + override fun getNewInstance(arg: List<*>, pathToItem: List, pathToSchemas: PathToSchemasMap): FrozenList { + val items: MutableList = ArrayList() + var i: Int = 0 + for (item: Any? in arg) { + val itemPathToItem = pathToItem + i + val schemas: LinkedHashMap, Nothing?>? = pathToSchemas.get(itemPathToItem) + if (schemas == null) { + throw RuntimeException("Validation result is invalid, schemas must exist for a pathToItem") + } + val itemSchema: JsonSchema<*> = schemas.entries.iterator().next().key + val itemInstance: Any? = itemSchema.getNewInstance(item, itemPathToItem, pathToSchemas) + items.add(itemInstance) + i += 1 + } + val newInstanceItems: FrozenList = FrozenList(items) + return newInstanceItems + } + + @Throws(ValidationException::class) + override fun validate(arg: List<*>, configuration: SchemaConfiguration?): FrozenList { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, PathToSchemasMap(), LinkedHashSet()) + val pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet) + return getNewInstance(castArg, validationMetadata.pathToItem, pathToSchemasMap) + } + + override fun getNewInstance(arg: Map<*, *>, pathToItem: List, pathToSchemas: PathToSchemasMap): FrozenMap { + val properties: LinkedHashMap = LinkedHashMap() + for((propertyName, value) in arg) { + if (!(propertyName is String)) { + throw RuntimeException("Invalid non-string key value") + } + val propertyPathToItem: List = pathToItem + propertyName + val schemas: LinkedHashMap, Nothing?>? = pathToSchemas.get(propertyPathToItem) + if (schemas == null) { + throw RuntimeException("Validation result is invalid, schemas must exist for a pathToItem") + } + val propertySchema: JsonSchema<*> = schemas.entries.iterator().next().key + val propertyInstance: Any? = propertySchema.getNewInstance(value, propertyPathToItem, pathToSchemas) + properties[propertyName] = propertyInstance + } + val castProperties: FrozenMap = FrozenMap(properties) + return castProperties + } + + @Throws(ValidationException::class) + override fun validate(arg: Map<*, *>, configuration: SchemaConfiguration?): FrozenMap { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validatedPathToSchemas = PathToSchemasMap() + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, LinkedHashSet()) + val pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet) + return getNewInstance(castArg, validationMetadata.pathToItem, pathToSchemasMap) + } + + @Throws(ValidationException::class) + override fun validate(arg: Any?, configuration: SchemaConfiguration?): Any? { + if (arg == null) { + return validate(null, configuration) + } else if (arg is Boolean) { + return validate(arg, configuration) + } else if (arg is Number) { + return validate(arg, configuration) + } else if (arg is String) { + return validate(arg, configuration) + } else if (arg is List<*>) { + return validate(arg, configuration) + } else if (arg is Map<*, *>) { + return validate(arg, configuration) + } + throw ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema") + } + override fun getNewInstance(arg: Any?, pathToItem: List, pathToSchemas: PathToSchemasMap): Any? { + if (arg == null) { + return getNewInstance( null, pathToItem, pathToSchemas) + } else if (arg is Boolean) { + return getNewInstance(arg, pathToItem, pathToSchemas) + } else if (arg is Number) { + return getNewInstance(arg, pathToItem, pathToSchemas) + } else if (arg is String) { + return getNewInstance(arg, pathToItem, pathToSchemas) + } else if (arg is List<*>) { + return getNewInstance(arg, pathToItem, pathToSchemas) + } else if (arg is Map<*, *>) { + return getNewInstance(arg, pathToItem, pathToSchemas) + } + throw RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema") + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: Nothing?, configuration: SchemaConfiguration?): Ipv6Format1BoxedVoid { + return Ipv6Format1BoxedVoid(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: Boolean, configuration: SchemaConfiguration?): Ipv6Format1BoxedBoolean { + return Ipv6Format1BoxedBoolean(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: Number, configuration: SchemaConfiguration?): Ipv6Format1BoxedNumber { + return Ipv6Format1BoxedNumber(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: String, configuration: SchemaConfiguration?): Ipv6Format1BoxedString { + return Ipv6Format1BoxedString(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: List<*>, configuration: SchemaConfiguration?): Ipv6Format1BoxedList { + return Ipv6Format1BoxedList(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: Map<*, *>, configuration: SchemaConfiguration?): Ipv6Format1BoxedMap { + return Ipv6Format1BoxedMap(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: Any?, configuration: SchemaConfiguration?): Ipv6Format1Boxed { + if (arg == null) { + return validateAndBox(null, configuration) + } else if (arg is Boolean) { + return validateAndBox(arg, configuration) + } else if (arg is String) { + return validateAndBox(arg, configuration) + } else if (arg is Number) { + return validateAndBox(arg, configuration) + } else if (arg is List<*>) { + return validateAndBox(arg, configuration) + } else if (arg is Map<*, *>) { + return validateAndBox(arg, configuration) + } + throw ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema") + } + } +} diff --git a/samples/client/3_1_0_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/schemas/IriFormat.kt b/samples/client/3_1_0_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/schemas/IriFormat.kt new file mode 100644 index 00000000000..bdb0007d2fa --- /dev/null +++ b/samples/client/3_1_0_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/schemas/IriFormat.kt @@ -0,0 +1,308 @@ +package org.openapijsonschematools.client.components.schemas +import java.time.LocalDate +import java.time.ZonedDateTime +import java.util.UUID +import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags +import org.openapijsonschematools.client.configurations.SchemaConfiguration +import org.openapijsonschematools.client.exceptions.InvalidAdditionalPropertyException +import org.openapijsonschematools.client.exceptions.UnsetPropertyException +import org.openapijsonschematools.client.exceptions.ValidationException +import org.openapijsonschematools.client.schemas.UnsetAddPropsSetter +import org.openapijsonschematools.client.schemas.validation.BooleanSchemaValidator +import org.openapijsonschematools.client.schemas.validation.FrozenList +import org.openapijsonschematools.client.schemas.validation.FrozenMap +import org.openapijsonschematools.client.schemas.validation.JsonSchema +import org.openapijsonschematools.client.schemas.validation.JsonSchemaInfo +import org.openapijsonschematools.client.schemas.validation.ListSchemaValidator +import org.openapijsonschematools.client.schemas.validation.MapSchemaValidator +import org.openapijsonschematools.client.schemas.validation.NullSchemaValidator +import org.openapijsonschematools.client.schemas.validation.NumberSchemaValidator +import org.openapijsonschematools.client.schemas.validation.PathToSchemasMap +import org.openapijsonschematools.client.schemas.validation.StringSchemaValidator +import org.openapijsonschematools.client.schemas.validation.ValidationMetadata + +class IriFormat { + // nest classes so all schemas and input/output classes can be public + + + sealed interface IriFormat1Boxed { + fun getData(): Any? + } + + data class IriFormat1BoxedVoid(val data: Nothing?) : IriFormat1Boxed { + override fun getData(): Any? { + return data + } + } + + data class IriFormat1BoxedBoolean(val data: Boolean): IriFormat1Boxed { + override fun getData(): Any? { + return data + } + } + + data class IriFormat1BoxedNumber(val data: Number) : IriFormat1Boxed { + override fun getData(): Any? { + return data + } + } + + data class IriFormat1BoxedString(val data: String) : IriFormat1Boxed { + override fun getData(): Any? { + return data + } + } + + data class IriFormat1BoxedList(val data: FrozenList) : IriFormat1Boxed { + override fun getData(): Any? { + return data + } + } + + data class IriFormat1BoxedMap(val data: FrozenMap) : IriFormat1Boxed { + override fun getData(): Any? { + return data + } + } + + + class IriFormat1 private constructor(): JsonSchema( + JsonSchemaInfo() + .format("iri") + ), NullSchemaValidator, BooleanSchemaValidator, NumberSchemaValidator, StringSchemaValidator, ListSchemaValidator, IriFormat1BoxedList>, MapSchemaValidator, IriFormat1BoxedMap> { + /* + NOTE: This class is auto generated by OpenAPI JSON Schema Generator. + Ref: https://github.com/openapi-json-schema-tools/openapi-json-schema-generator + + Do not edit the class manually. + */ + + companion object { + @Volatile + private var instance: IriFormat1? = null + + fun getInstance() = + instance ?: synchronized(this) { + instance ?: IriFormat1().also { instance = it } + } + } + + @Throws(ValidationException::class) + override fun validate(arg: Nothing?, configuration: SchemaConfiguration?): Nothing? { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validatedPathToSchemas = PathToSchemasMap() + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, LinkedHashSet()) + getPathToSchemas(this, castArg, validationMetadata, pathSet) + return castArg + } + + @Throws(ValidationException::class) + override fun validate(arg: Boolean, configuration: SchemaConfiguration?): Boolean { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validatedPathToSchemas = PathToSchemasMap() + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, LinkedHashSet()) + getPathToSchemas(this, castArg, validationMetadata, pathSet) + return castArg + } + + @Throws(ValidationException::class) + override fun validate(arg: Number, configuration: SchemaConfiguration?): Number { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validatedPathToSchemas = PathToSchemasMap() + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, LinkedHashSet()) + getPathToSchemas(this, castArg, validationMetadata, pathSet) + return castArg + } + + @Throws(ValidationException::class) + fun validate(arg: Int, configuration: SchemaConfiguration?): Int { + return validate(arg as Number, configuration) as Int + } + + @Throws(ValidationException::class) + fun validate(arg: Long, configuration: SchemaConfiguration?): Long { + return validate(arg as Number, configuration) as Long + } + + @Throws(ValidationException::class) + fun validate(arg: Float, configuration: SchemaConfiguration?): Float { + return validate(arg as Number, configuration) as Float + } + + @Throws(ValidationException::class) + fun validate(arg: Double, configuration: SchemaConfiguration?): Double { + return validate(arg as Number, configuration) as Double + } + + @Throws(ValidationException::class) + override fun validate(arg: String, configuration: SchemaConfiguration?): String { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validatedPathToSchemas = PathToSchemasMap() + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, LinkedHashSet()) + getPathToSchemas(this, castArg, validationMetadata, pathSet) + return castArg + } + + @Throws(ValidationException::class) + fun validate(arg: LocalDate, configuration: SchemaConfiguration?): String { + return validate(arg.toString(), configuration) + } + + @Throws(ValidationException::class) + fun validate(arg: ZonedDateTime, configuration: SchemaConfiguration?): String { + return validate(arg.toString(), configuration) + } + + @Throws(ValidationException::class) + fun validate(arg: UUID, configuration: SchemaConfiguration?): String { + return validate(arg.toString(), configuration) + } + + override fun getNewInstance(arg: List<*>, pathToItem: List, pathToSchemas: PathToSchemasMap): FrozenList { + val items: MutableList = ArrayList() + var i: Int = 0 + for (item: Any? in arg) { + val itemPathToItem = pathToItem + i + val schemas: LinkedHashMap, Nothing?>? = pathToSchemas.get(itemPathToItem) + if (schemas == null) { + throw RuntimeException("Validation result is invalid, schemas must exist for a pathToItem") + } + val itemSchema: JsonSchema<*> = schemas.entries.iterator().next().key + val itemInstance: Any? = itemSchema.getNewInstance(item, itemPathToItem, pathToSchemas) + items.add(itemInstance) + i += 1 + } + val newInstanceItems: FrozenList = FrozenList(items) + return newInstanceItems + } + + @Throws(ValidationException::class) + override fun validate(arg: List<*>, configuration: SchemaConfiguration?): FrozenList { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, PathToSchemasMap(), LinkedHashSet()) + val pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet) + return getNewInstance(castArg, validationMetadata.pathToItem, pathToSchemasMap) + } + + override fun getNewInstance(arg: Map<*, *>, pathToItem: List, pathToSchemas: PathToSchemasMap): FrozenMap { + val properties: LinkedHashMap = LinkedHashMap() + for((propertyName, value) in arg) { + if (!(propertyName is String)) { + throw RuntimeException("Invalid non-string key value") + } + val propertyPathToItem: List = pathToItem + propertyName + val schemas: LinkedHashMap, Nothing?>? = pathToSchemas.get(propertyPathToItem) + if (schemas == null) { + throw RuntimeException("Validation result is invalid, schemas must exist for a pathToItem") + } + val propertySchema: JsonSchema<*> = schemas.entries.iterator().next().key + val propertyInstance: Any? = propertySchema.getNewInstance(value, propertyPathToItem, pathToSchemas) + properties[propertyName] = propertyInstance + } + val castProperties: FrozenMap = FrozenMap(properties) + return castProperties + } + + @Throws(ValidationException::class) + override fun validate(arg: Map<*, *>, configuration: SchemaConfiguration?): FrozenMap { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validatedPathToSchemas = PathToSchemasMap() + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, LinkedHashSet()) + val pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet) + return getNewInstance(castArg, validationMetadata.pathToItem, pathToSchemasMap) + } + + @Throws(ValidationException::class) + override fun validate(arg: Any?, configuration: SchemaConfiguration?): Any? { + if (arg == null) { + return validate(null, configuration) + } else if (arg is Boolean) { + return validate(arg, configuration) + } else if (arg is Number) { + return validate(arg, configuration) + } else if (arg is String) { + return validate(arg, configuration) + } else if (arg is List<*>) { + return validate(arg, configuration) + } else if (arg is Map<*, *>) { + return validate(arg, configuration) + } + throw ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema") + } + override fun getNewInstance(arg: Any?, pathToItem: List, pathToSchemas: PathToSchemasMap): Any? { + if (arg == null) { + return getNewInstance( null, pathToItem, pathToSchemas) + } else if (arg is Boolean) { + return getNewInstance(arg, pathToItem, pathToSchemas) + } else if (arg is Number) { + return getNewInstance(arg, pathToItem, pathToSchemas) + } else if (arg is String) { + return getNewInstance(arg, pathToItem, pathToSchemas) + } else if (arg is List<*>) { + return getNewInstance(arg, pathToItem, pathToSchemas) + } else if (arg is Map<*, *>) { + return getNewInstance(arg, pathToItem, pathToSchemas) + } + throw RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema") + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: Nothing?, configuration: SchemaConfiguration?): IriFormat1BoxedVoid { + return IriFormat1BoxedVoid(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: Boolean, configuration: SchemaConfiguration?): IriFormat1BoxedBoolean { + return IriFormat1BoxedBoolean(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: Number, configuration: SchemaConfiguration?): IriFormat1BoxedNumber { + return IriFormat1BoxedNumber(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: String, configuration: SchemaConfiguration?): IriFormat1BoxedString { + return IriFormat1BoxedString(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: List<*>, configuration: SchemaConfiguration?): IriFormat1BoxedList { + return IriFormat1BoxedList(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: Map<*, *>, configuration: SchemaConfiguration?): IriFormat1BoxedMap { + return IriFormat1BoxedMap(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: Any?, configuration: SchemaConfiguration?): IriFormat1Boxed { + if (arg == null) { + return validateAndBox(null, configuration) + } else if (arg is Boolean) { + return validateAndBox(arg, configuration) + } else if (arg is String) { + return validateAndBox(arg, configuration) + } else if (arg is Number) { + return validateAndBox(arg, configuration) + } else if (arg is List<*>) { + return validateAndBox(arg, configuration) + } else if (arg is Map<*, *>) { + return validateAndBox(arg, configuration) + } + throw ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema") + } + } +} diff --git a/samples/client/3_1_0_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/schemas/IriReferenceFormat.kt b/samples/client/3_1_0_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/schemas/IriReferenceFormat.kt new file mode 100644 index 00000000000..3fe9a4c9bdf --- /dev/null +++ b/samples/client/3_1_0_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/schemas/IriReferenceFormat.kt @@ -0,0 +1,308 @@ +package org.openapijsonschematools.client.components.schemas +import java.time.LocalDate +import java.time.ZonedDateTime +import java.util.UUID +import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags +import org.openapijsonschematools.client.configurations.SchemaConfiguration +import org.openapijsonschematools.client.exceptions.InvalidAdditionalPropertyException +import org.openapijsonschematools.client.exceptions.UnsetPropertyException +import org.openapijsonschematools.client.exceptions.ValidationException +import org.openapijsonschematools.client.schemas.UnsetAddPropsSetter +import org.openapijsonschematools.client.schemas.validation.BooleanSchemaValidator +import org.openapijsonschematools.client.schemas.validation.FrozenList +import org.openapijsonschematools.client.schemas.validation.FrozenMap +import org.openapijsonschematools.client.schemas.validation.JsonSchema +import org.openapijsonschematools.client.schemas.validation.JsonSchemaInfo +import org.openapijsonschematools.client.schemas.validation.ListSchemaValidator +import org.openapijsonschematools.client.schemas.validation.MapSchemaValidator +import org.openapijsonschematools.client.schemas.validation.NullSchemaValidator +import org.openapijsonschematools.client.schemas.validation.NumberSchemaValidator +import org.openapijsonschematools.client.schemas.validation.PathToSchemasMap +import org.openapijsonschematools.client.schemas.validation.StringSchemaValidator +import org.openapijsonschematools.client.schemas.validation.ValidationMetadata + +class IriReferenceFormat { + // nest classes so all schemas and input/output classes can be public + + + sealed interface IriReferenceFormat1Boxed { + fun getData(): Any? + } + + data class IriReferenceFormat1BoxedVoid(val data: Nothing?) : IriReferenceFormat1Boxed { + override fun getData(): Any? { + return data + } + } + + data class IriReferenceFormat1BoxedBoolean(val data: Boolean): IriReferenceFormat1Boxed { + override fun getData(): Any? { + return data + } + } + + data class IriReferenceFormat1BoxedNumber(val data: Number) : IriReferenceFormat1Boxed { + override fun getData(): Any? { + return data + } + } + + data class IriReferenceFormat1BoxedString(val data: String) : IriReferenceFormat1Boxed { + override fun getData(): Any? { + return data + } + } + + data class IriReferenceFormat1BoxedList(val data: FrozenList) : IriReferenceFormat1Boxed { + override fun getData(): Any? { + return data + } + } + + data class IriReferenceFormat1BoxedMap(val data: FrozenMap) : IriReferenceFormat1Boxed { + override fun getData(): Any? { + return data + } + } + + + class IriReferenceFormat1 private constructor(): JsonSchema( + JsonSchemaInfo() + .format("iri-reference") + ), NullSchemaValidator, BooleanSchemaValidator, NumberSchemaValidator, StringSchemaValidator, ListSchemaValidator, IriReferenceFormat1BoxedList>, MapSchemaValidator, IriReferenceFormat1BoxedMap> { + /* + NOTE: This class is auto generated by OpenAPI JSON Schema Generator. + Ref: https://github.com/openapi-json-schema-tools/openapi-json-schema-generator + + Do not edit the class manually. + */ + + companion object { + @Volatile + private var instance: IriReferenceFormat1? = null + + fun getInstance() = + instance ?: synchronized(this) { + instance ?: IriReferenceFormat1().also { instance = it } + } + } + + @Throws(ValidationException::class) + override fun validate(arg: Nothing?, configuration: SchemaConfiguration?): Nothing? { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validatedPathToSchemas = PathToSchemasMap() + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, LinkedHashSet()) + getPathToSchemas(this, castArg, validationMetadata, pathSet) + return castArg + } + + @Throws(ValidationException::class) + override fun validate(arg: Boolean, configuration: SchemaConfiguration?): Boolean { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validatedPathToSchemas = PathToSchemasMap() + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, LinkedHashSet()) + getPathToSchemas(this, castArg, validationMetadata, pathSet) + return castArg + } + + @Throws(ValidationException::class) + override fun validate(arg: Number, configuration: SchemaConfiguration?): Number { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validatedPathToSchemas = PathToSchemasMap() + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, LinkedHashSet()) + getPathToSchemas(this, castArg, validationMetadata, pathSet) + return castArg + } + + @Throws(ValidationException::class) + fun validate(arg: Int, configuration: SchemaConfiguration?): Int { + return validate(arg as Number, configuration) as Int + } + + @Throws(ValidationException::class) + fun validate(arg: Long, configuration: SchemaConfiguration?): Long { + return validate(arg as Number, configuration) as Long + } + + @Throws(ValidationException::class) + fun validate(arg: Float, configuration: SchemaConfiguration?): Float { + return validate(arg as Number, configuration) as Float + } + + @Throws(ValidationException::class) + fun validate(arg: Double, configuration: SchemaConfiguration?): Double { + return validate(arg as Number, configuration) as Double + } + + @Throws(ValidationException::class) + override fun validate(arg: String, configuration: SchemaConfiguration?): String { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validatedPathToSchemas = PathToSchemasMap() + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, LinkedHashSet()) + getPathToSchemas(this, castArg, validationMetadata, pathSet) + return castArg + } + + @Throws(ValidationException::class) + fun validate(arg: LocalDate, configuration: SchemaConfiguration?): String { + return validate(arg.toString(), configuration) + } + + @Throws(ValidationException::class) + fun validate(arg: ZonedDateTime, configuration: SchemaConfiguration?): String { + return validate(arg.toString(), configuration) + } + + @Throws(ValidationException::class) + fun validate(arg: UUID, configuration: SchemaConfiguration?): String { + return validate(arg.toString(), configuration) + } + + override fun getNewInstance(arg: List<*>, pathToItem: List, pathToSchemas: PathToSchemasMap): FrozenList { + val items: MutableList = ArrayList() + var i: Int = 0 + for (item: Any? in arg) { + val itemPathToItem = pathToItem + i + val schemas: LinkedHashMap, Nothing?>? = pathToSchemas.get(itemPathToItem) + if (schemas == null) { + throw RuntimeException("Validation result is invalid, schemas must exist for a pathToItem") + } + val itemSchema: JsonSchema<*> = schemas.entries.iterator().next().key + val itemInstance: Any? = itemSchema.getNewInstance(item, itemPathToItem, pathToSchemas) + items.add(itemInstance) + i += 1 + } + val newInstanceItems: FrozenList = FrozenList(items) + return newInstanceItems + } + + @Throws(ValidationException::class) + override fun validate(arg: List<*>, configuration: SchemaConfiguration?): FrozenList { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, PathToSchemasMap(), LinkedHashSet()) + val pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet) + return getNewInstance(castArg, validationMetadata.pathToItem, pathToSchemasMap) + } + + override fun getNewInstance(arg: Map<*, *>, pathToItem: List, pathToSchemas: PathToSchemasMap): FrozenMap { + val properties: LinkedHashMap = LinkedHashMap() + for((propertyName, value) in arg) { + if (!(propertyName is String)) { + throw RuntimeException("Invalid non-string key value") + } + val propertyPathToItem: List = pathToItem + propertyName + val schemas: LinkedHashMap, Nothing?>? = pathToSchemas.get(propertyPathToItem) + if (schemas == null) { + throw RuntimeException("Validation result is invalid, schemas must exist for a pathToItem") + } + val propertySchema: JsonSchema<*> = schemas.entries.iterator().next().key + val propertyInstance: Any? = propertySchema.getNewInstance(value, propertyPathToItem, pathToSchemas) + properties[propertyName] = propertyInstance + } + val castProperties: FrozenMap = FrozenMap(properties) + return castProperties + } + + @Throws(ValidationException::class) + override fun validate(arg: Map<*, *>, configuration: SchemaConfiguration?): FrozenMap { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validatedPathToSchemas = PathToSchemasMap() + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, LinkedHashSet()) + val pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet) + return getNewInstance(castArg, validationMetadata.pathToItem, pathToSchemasMap) + } + + @Throws(ValidationException::class) + override fun validate(arg: Any?, configuration: SchemaConfiguration?): Any? { + if (arg == null) { + return validate(null, configuration) + } else if (arg is Boolean) { + return validate(arg, configuration) + } else if (arg is Number) { + return validate(arg, configuration) + } else if (arg is String) { + return validate(arg, configuration) + } else if (arg is List<*>) { + return validate(arg, configuration) + } else if (arg is Map<*, *>) { + return validate(arg, configuration) + } + throw ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema") + } + override fun getNewInstance(arg: Any?, pathToItem: List, pathToSchemas: PathToSchemasMap): Any? { + if (arg == null) { + return getNewInstance( null, pathToItem, pathToSchemas) + } else if (arg is Boolean) { + return getNewInstance(arg, pathToItem, pathToSchemas) + } else if (arg is Number) { + return getNewInstance(arg, pathToItem, pathToSchemas) + } else if (arg is String) { + return getNewInstance(arg, pathToItem, pathToSchemas) + } else if (arg is List<*>) { + return getNewInstance(arg, pathToItem, pathToSchemas) + } else if (arg is Map<*, *>) { + return getNewInstance(arg, pathToItem, pathToSchemas) + } + throw RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema") + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: Nothing?, configuration: SchemaConfiguration?): IriReferenceFormat1BoxedVoid { + return IriReferenceFormat1BoxedVoid(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: Boolean, configuration: SchemaConfiguration?): IriReferenceFormat1BoxedBoolean { + return IriReferenceFormat1BoxedBoolean(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: Number, configuration: SchemaConfiguration?): IriReferenceFormat1BoxedNumber { + return IriReferenceFormat1BoxedNumber(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: String, configuration: SchemaConfiguration?): IriReferenceFormat1BoxedString { + return IriReferenceFormat1BoxedString(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: List<*>, configuration: SchemaConfiguration?): IriReferenceFormat1BoxedList { + return IriReferenceFormat1BoxedList(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: Map<*, *>, configuration: SchemaConfiguration?): IriReferenceFormat1BoxedMap { + return IriReferenceFormat1BoxedMap(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: Any?, configuration: SchemaConfiguration?): IriReferenceFormat1Boxed { + if (arg == null) { + return validateAndBox(null, configuration) + } else if (arg is Boolean) { + return validateAndBox(arg, configuration) + } else if (arg is String) { + return validateAndBox(arg, configuration) + } else if (arg is Number) { + return validateAndBox(arg, configuration) + } else if (arg is List<*>) { + return validateAndBox(arg, configuration) + } else if (arg is Map<*, *>) { + return validateAndBox(arg, configuration) + } + throw ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema") + } + } +} diff --git a/samples/client/3_1_0_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/schemas/ItemsContains.kt b/samples/client/3_1_0_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/schemas/ItemsContains.kt new file mode 100644 index 00000000000..1a2688f77d7 --- /dev/null +++ b/samples/client/3_1_0_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/schemas/ItemsContains.kt @@ -0,0 +1,737 @@ +package org.openapijsonschematools.client.components.schemas +import java.math.BigDecimal +import java.time.LocalDate +import java.time.ZonedDateTime +import java.util.UUID +import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags +import org.openapijsonschematools.client.configurations.SchemaConfiguration +import org.openapijsonschematools.client.exceptions.InvalidAdditionalPropertyException +import org.openapijsonschematools.client.exceptions.UnsetPropertyException +import org.openapijsonschematools.client.exceptions.ValidationException +import org.openapijsonschematools.client.schemas.UnsetAddPropsSetter +import org.openapijsonschematools.client.schemas.validation.BooleanSchemaValidator +import org.openapijsonschematools.client.schemas.validation.FrozenList +import org.openapijsonschematools.client.schemas.validation.FrozenMap +import org.openapijsonschematools.client.schemas.validation.JsonSchema +import org.openapijsonschematools.client.schemas.validation.JsonSchemaInfo +import org.openapijsonschematools.client.schemas.validation.ListSchemaValidator +import org.openapijsonschematools.client.schemas.validation.MapSchemaValidator +import org.openapijsonschematools.client.schemas.validation.NullSchemaValidator +import org.openapijsonschematools.client.schemas.validation.NumberSchemaValidator +import org.openapijsonschematools.client.schemas.validation.PathToSchemasMap +import org.openapijsonschematools.client.schemas.validation.StringSchemaValidator +import org.openapijsonschematools.client.schemas.validation.ValidationMetadata + +class ItemsContains { + // nest classes so all schemas and input/output classes can be public + + + sealed interface ContainsBoxed { + fun getData(): Any? + } + + data class ContainsBoxedVoid(val data: Nothing?) : ContainsBoxed { + override fun getData(): Any? { + return data + } + } + + data class ContainsBoxedBoolean(val data: Boolean): ContainsBoxed { + override fun getData(): Any? { + return data + } + } + + data class ContainsBoxedNumber(val data: Number) : ContainsBoxed { + override fun getData(): Any? { + return data + } + } + + data class ContainsBoxedString(val data: String) : ContainsBoxed { + override fun getData(): Any? { + return data + } + } + + data class ContainsBoxedList(val data: FrozenList) : ContainsBoxed { + override fun getData(): Any? { + return data + } + } + + data class ContainsBoxedMap(val data: FrozenMap) : ContainsBoxed { + override fun getData(): Any? { + return data + } + } + + + class Contains private constructor(): JsonSchema( + JsonSchemaInfo() + .multipleOf(BigDecimal("3")) + ), NullSchemaValidator, BooleanSchemaValidator, NumberSchemaValidator, StringSchemaValidator, ListSchemaValidator, ContainsBoxedList>, MapSchemaValidator, ContainsBoxedMap> { + + companion object { + @Volatile + private var instance: Contains? = null + + fun getInstance() = + instance ?: synchronized(this) { + instance ?: Contains().also { instance = it } + } + } + + @Throws(ValidationException::class) + override fun validate(arg: Nothing?, configuration: SchemaConfiguration?): Nothing? { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validatedPathToSchemas = PathToSchemasMap() + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, LinkedHashSet()) + getPathToSchemas(this, castArg, validationMetadata, pathSet) + return castArg + } + + @Throws(ValidationException::class) + override fun validate(arg: Boolean, configuration: SchemaConfiguration?): Boolean { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validatedPathToSchemas = PathToSchemasMap() + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, LinkedHashSet()) + getPathToSchemas(this, castArg, validationMetadata, pathSet) + return castArg + } + + @Throws(ValidationException::class) + override fun validate(arg: Number, configuration: SchemaConfiguration?): Number { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validatedPathToSchemas = PathToSchemasMap() + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, LinkedHashSet()) + getPathToSchemas(this, castArg, validationMetadata, pathSet) + return castArg + } + + @Throws(ValidationException::class) + fun validate(arg: Int, configuration: SchemaConfiguration?): Int { + return validate(arg as Number, configuration) as Int + } + + @Throws(ValidationException::class) + fun validate(arg: Long, configuration: SchemaConfiguration?): Long { + return validate(arg as Number, configuration) as Long + } + + @Throws(ValidationException::class) + fun validate(arg: Float, configuration: SchemaConfiguration?): Float { + return validate(arg as Number, configuration) as Float + } + + @Throws(ValidationException::class) + fun validate(arg: Double, configuration: SchemaConfiguration?): Double { + return validate(arg as Number, configuration) as Double + } + + @Throws(ValidationException::class) + override fun validate(arg: String, configuration: SchemaConfiguration?): String { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validatedPathToSchemas = PathToSchemasMap() + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, LinkedHashSet()) + getPathToSchemas(this, castArg, validationMetadata, pathSet) + return castArg + } + + @Throws(ValidationException::class) + fun validate(arg: LocalDate, configuration: SchemaConfiguration?): String { + return validate(arg.toString(), configuration) + } + + @Throws(ValidationException::class) + fun validate(arg: ZonedDateTime, configuration: SchemaConfiguration?): String { + return validate(arg.toString(), configuration) + } + + @Throws(ValidationException::class) + fun validate(arg: UUID, configuration: SchemaConfiguration?): String { + return validate(arg.toString(), configuration) + } + + override fun getNewInstance(arg: List<*>, pathToItem: List, pathToSchemas: PathToSchemasMap): FrozenList { + val items: MutableList = ArrayList() + var i: Int = 0 + for (item: Any? in arg) { + val itemPathToItem = pathToItem + i + val schemas: LinkedHashMap, Nothing?>? = pathToSchemas.get(itemPathToItem) + if (schemas == null) { + throw RuntimeException("Validation result is invalid, schemas must exist for a pathToItem") + } + val itemSchema: JsonSchema<*> = schemas.entries.iterator().next().key + val itemInstance: Any? = itemSchema.getNewInstance(item, itemPathToItem, pathToSchemas) + items.add(itemInstance) + i += 1 + } + val newInstanceItems: FrozenList = FrozenList(items) + return newInstanceItems + } + + @Throws(ValidationException::class) + override fun validate(arg: List<*>, configuration: SchemaConfiguration?): FrozenList { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, PathToSchemasMap(), LinkedHashSet()) + val pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet) + return getNewInstance(castArg, validationMetadata.pathToItem, pathToSchemasMap) + } + + override fun getNewInstance(arg: Map<*, *>, pathToItem: List, pathToSchemas: PathToSchemasMap): FrozenMap { + val properties: LinkedHashMap = LinkedHashMap() + for((propertyName, value) in arg) { + if (!(propertyName is String)) { + throw RuntimeException("Invalid non-string key value") + } + val propertyPathToItem: List = pathToItem + propertyName + val schemas: LinkedHashMap, Nothing?>? = pathToSchemas.get(propertyPathToItem) + if (schemas == null) { + throw RuntimeException("Validation result is invalid, schemas must exist for a pathToItem") + } + val propertySchema: JsonSchema<*> = schemas.entries.iterator().next().key + val propertyInstance: Any? = propertySchema.getNewInstance(value, propertyPathToItem, pathToSchemas) + properties[propertyName] = propertyInstance + } + val castProperties: FrozenMap = FrozenMap(properties) + return castProperties + } + + @Throws(ValidationException::class) + override fun validate(arg: Map<*, *>, configuration: SchemaConfiguration?): FrozenMap { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validatedPathToSchemas = PathToSchemasMap() + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, LinkedHashSet()) + val pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet) + return getNewInstance(castArg, validationMetadata.pathToItem, pathToSchemasMap) + } + + @Throws(ValidationException::class) + override fun validate(arg: Any?, configuration: SchemaConfiguration?): Any? { + if (arg == null) { + return validate(null, configuration) + } else if (arg is Boolean) { + return validate(arg, configuration) + } else if (arg is Number) { + return validate(arg, configuration) + } else if (arg is String) { + return validate(arg, configuration) + } else if (arg is List<*>) { + return validate(arg, configuration) + } else if (arg is Map<*, *>) { + return validate(arg, configuration) + } + throw ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema") + } + override fun getNewInstance(arg: Any?, pathToItem: List, pathToSchemas: PathToSchemasMap): Any? { + if (arg == null) { + return getNewInstance( null, pathToItem, pathToSchemas) + } else if (arg is Boolean) { + return getNewInstance(arg, pathToItem, pathToSchemas) + } else if (arg is Number) { + return getNewInstance(arg, pathToItem, pathToSchemas) + } else if (arg is String) { + return getNewInstance(arg, pathToItem, pathToSchemas) + } else if (arg is List<*>) { + return getNewInstance(arg, pathToItem, pathToSchemas) + } else if (arg is Map<*, *>) { + return getNewInstance(arg, pathToItem, pathToSchemas) + } + throw RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema") + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: Nothing?, configuration: SchemaConfiguration?): ContainsBoxedVoid { + return ContainsBoxedVoid(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: Boolean, configuration: SchemaConfiguration?): ContainsBoxedBoolean { + return ContainsBoxedBoolean(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: Number, configuration: SchemaConfiguration?): ContainsBoxedNumber { + return ContainsBoxedNumber(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: String, configuration: SchemaConfiguration?): ContainsBoxedString { + return ContainsBoxedString(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: List<*>, configuration: SchemaConfiguration?): ContainsBoxedList { + return ContainsBoxedList(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: Map<*, *>, configuration: SchemaConfiguration?): ContainsBoxedMap { + return ContainsBoxedMap(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: Any?, configuration: SchemaConfiguration?): ContainsBoxed { + if (arg == null) { + return validateAndBox(null, configuration) + } else if (arg is Boolean) { + return validateAndBox(arg, configuration) + } else if (arg is String) { + return validateAndBox(arg, configuration) + } else if (arg is Number) { + return validateAndBox(arg, configuration) + } else if (arg is List<*>) { + return validateAndBox(arg, configuration) + } else if (arg is Map<*, *>) { + return validateAndBox(arg, configuration) + } + throw ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema") + } + } + + sealed interface ItemsBoxed { + fun getData(): Any? + } + + data class ItemsBoxedVoid(val data: Nothing?) : ItemsBoxed { + override fun getData(): Any? { + return data + } + } + + data class ItemsBoxedBoolean(val data: Boolean): ItemsBoxed { + override fun getData(): Any? { + return data + } + } + + data class ItemsBoxedNumber(val data: Number) : ItemsBoxed { + override fun getData(): Any? { + return data + } + } + + data class ItemsBoxedString(val data: String) : ItemsBoxed { + override fun getData(): Any? { + return data + } + } + + data class ItemsBoxedList(val data: FrozenList) : ItemsBoxed { + override fun getData(): Any? { + return data + } + } + + data class ItemsBoxedMap(val data: FrozenMap) : ItemsBoxed { + override fun getData(): Any? { + return data + } + } + + + class Items private constructor(): JsonSchema( + JsonSchemaInfo() + .multipleOf(BigDecimal("2")) + ), NullSchemaValidator, BooleanSchemaValidator, NumberSchemaValidator, StringSchemaValidator, ListSchemaValidator, ItemsBoxedList>, MapSchemaValidator, ItemsBoxedMap> { + + companion object { + @Volatile + private var instance: Items? = null + + fun getInstance() = + instance ?: synchronized(this) { + instance ?: Items().also { instance = it } + } + } + + @Throws(ValidationException::class) + override fun validate(arg: Nothing?, configuration: SchemaConfiguration?): Nothing? { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validatedPathToSchemas = PathToSchemasMap() + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, LinkedHashSet()) + getPathToSchemas(this, castArg, validationMetadata, pathSet) + return castArg + } + + @Throws(ValidationException::class) + override fun validate(arg: Boolean, configuration: SchemaConfiguration?): Boolean { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validatedPathToSchemas = PathToSchemasMap() + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, LinkedHashSet()) + getPathToSchemas(this, castArg, validationMetadata, pathSet) + return castArg + } + + @Throws(ValidationException::class) + override fun validate(arg: Number, configuration: SchemaConfiguration?): Number { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validatedPathToSchemas = PathToSchemasMap() + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, LinkedHashSet()) + getPathToSchemas(this, castArg, validationMetadata, pathSet) + return castArg + } + + @Throws(ValidationException::class) + fun validate(arg: Int, configuration: SchemaConfiguration?): Int { + return validate(arg as Number, configuration) as Int + } + + @Throws(ValidationException::class) + fun validate(arg: Long, configuration: SchemaConfiguration?): Long { + return validate(arg as Number, configuration) as Long + } + + @Throws(ValidationException::class) + fun validate(arg: Float, configuration: SchemaConfiguration?): Float { + return validate(arg as Number, configuration) as Float + } + + @Throws(ValidationException::class) + fun validate(arg: Double, configuration: SchemaConfiguration?): Double { + return validate(arg as Number, configuration) as Double + } + + @Throws(ValidationException::class) + override fun validate(arg: String, configuration: SchemaConfiguration?): String { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validatedPathToSchemas = PathToSchemasMap() + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, LinkedHashSet()) + getPathToSchemas(this, castArg, validationMetadata, pathSet) + return castArg + } + + @Throws(ValidationException::class) + fun validate(arg: LocalDate, configuration: SchemaConfiguration?): String { + return validate(arg.toString(), configuration) + } + + @Throws(ValidationException::class) + fun validate(arg: ZonedDateTime, configuration: SchemaConfiguration?): String { + return validate(arg.toString(), configuration) + } + + @Throws(ValidationException::class) + fun validate(arg: UUID, configuration: SchemaConfiguration?): String { + return validate(arg.toString(), configuration) + } + + override fun getNewInstance(arg: List<*>, pathToItem: List, pathToSchemas: PathToSchemasMap): FrozenList { + val items: MutableList = ArrayList() + var i: Int = 0 + for (item: Any? in arg) { + val itemPathToItem = pathToItem + i + val schemas: LinkedHashMap, Nothing?>? = pathToSchemas.get(itemPathToItem) + if (schemas == null) { + throw RuntimeException("Validation result is invalid, schemas must exist for a pathToItem") + } + val itemSchema: JsonSchema<*> = schemas.entries.iterator().next().key + val itemInstance: Any? = itemSchema.getNewInstance(item, itemPathToItem, pathToSchemas) + items.add(itemInstance) + i += 1 + } + val newInstanceItems: FrozenList = FrozenList(items) + return newInstanceItems + } + + @Throws(ValidationException::class) + override fun validate(arg: List<*>, configuration: SchemaConfiguration?): FrozenList { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, PathToSchemasMap(), LinkedHashSet()) + val pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet) + return getNewInstance(castArg, validationMetadata.pathToItem, pathToSchemasMap) + } + + override fun getNewInstance(arg: Map<*, *>, pathToItem: List, pathToSchemas: PathToSchemasMap): FrozenMap { + val properties: LinkedHashMap = LinkedHashMap() + for((propertyName, value) in arg) { + if (!(propertyName is String)) { + throw RuntimeException("Invalid non-string key value") + } + val propertyPathToItem: List = pathToItem + propertyName + val schemas: LinkedHashMap, Nothing?>? = pathToSchemas.get(propertyPathToItem) + if (schemas == null) { + throw RuntimeException("Validation result is invalid, schemas must exist for a pathToItem") + } + val propertySchema: JsonSchema<*> = schemas.entries.iterator().next().key + val propertyInstance: Any? = propertySchema.getNewInstance(value, propertyPathToItem, pathToSchemas) + properties[propertyName] = propertyInstance + } + val castProperties: FrozenMap = FrozenMap(properties) + return castProperties + } + + @Throws(ValidationException::class) + override fun validate(arg: Map<*, *>, configuration: SchemaConfiguration?): FrozenMap { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validatedPathToSchemas = PathToSchemasMap() + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, LinkedHashSet()) + val pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet) + return getNewInstance(castArg, validationMetadata.pathToItem, pathToSchemasMap) + } + + @Throws(ValidationException::class) + override fun validate(arg: Any?, configuration: SchemaConfiguration?): Any? { + if (arg == null) { + return validate(null, configuration) + } else if (arg is Boolean) { + return validate(arg, configuration) + } else if (arg is Number) { + return validate(arg, configuration) + } else if (arg is String) { + return validate(arg, configuration) + } else if (arg is List<*>) { + return validate(arg, configuration) + } else if (arg is Map<*, *>) { + return validate(arg, configuration) + } + throw ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema") + } + override fun getNewInstance(arg: Any?, pathToItem: List, pathToSchemas: PathToSchemasMap): Any? { + if (arg == null) { + return getNewInstance( null, pathToItem, pathToSchemas) + } else if (arg is Boolean) { + return getNewInstance(arg, pathToItem, pathToSchemas) + } else if (arg is Number) { + return getNewInstance(arg, pathToItem, pathToSchemas) + } else if (arg is String) { + return getNewInstance(arg, pathToItem, pathToSchemas) + } else if (arg is List<*>) { + return getNewInstance(arg, pathToItem, pathToSchemas) + } else if (arg is Map<*, *>) { + return getNewInstance(arg, pathToItem, pathToSchemas) + } + throw RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema") + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: Nothing?, configuration: SchemaConfiguration?): ItemsBoxedVoid { + return ItemsBoxedVoid(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: Boolean, configuration: SchemaConfiguration?): ItemsBoxedBoolean { + return ItemsBoxedBoolean(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: Number, configuration: SchemaConfiguration?): ItemsBoxedNumber { + return ItemsBoxedNumber(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: String, configuration: SchemaConfiguration?): ItemsBoxedString { + return ItemsBoxedString(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: List<*>, configuration: SchemaConfiguration?): ItemsBoxedList { + return ItemsBoxedList(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: Map<*, *>, configuration: SchemaConfiguration?): ItemsBoxedMap { + return ItemsBoxedMap(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: Any?, configuration: SchemaConfiguration?): ItemsBoxed { + if (arg == null) { + return validateAndBox(null, configuration) + } else if (arg is Boolean) { + return validateAndBox(arg, configuration) + } else if (arg is String) { + return validateAndBox(arg, configuration) + } else if (arg is Number) { + return validateAndBox(arg, configuration) + } else if (arg is List<*>) { + return validateAndBox(arg, configuration) + } else if (arg is Map<*, *>) { + return validateAndBox(arg, configuration) + } + throw ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema") + } + } + + class ItemsContainsList(m: FrozenList) : FrozenList(m) { + companion object { + @Throws(ValidationException::class) + fun of(arg: List, configuration: SchemaConfiguration?): ItemsContainsList { + return ItemsContains1.getInstance().validate(arg, configuration) + } + } + } + + class ItemsContainsListBuilder { + // class to build List + private val list: MutableList + + init { + this.list = ArrayList() + } + + + fun add(item: Nothing?): ItemsContainsListBuilder { + list.add(null) + return this + } + + fun add(item: Boolean): ItemsContainsListBuilder { + list.add(item) + return this + } + + fun add(item: String): ItemsContainsListBuilder { + list.add(item) + return this + } + + fun add(item: Int): ItemsContainsListBuilder { + list.add(item) + return this + } + + fun add(item: Float): ItemsContainsListBuilder { + list.add(item) + return this + } + + fun add(item: Long): ItemsContainsListBuilder { + list.add(item) + return this + } + + fun add(item: Double): ItemsContainsListBuilder { + list.add(item) + return this + } + + fun add(item: List<*>): ItemsContainsListBuilder { + list.add(item) + return this + } + + fun add(item: Map): ItemsContainsListBuilder { + list.add(item) + return this + } + + fun build(): List { + return list + } + } + + + sealed interface ItemsContains1Boxed { + fun getData(): Any? + } + + data class ItemsContains1BoxedList(val data: ItemsContainsList) : ItemsContains1Boxed { + override fun getData(): Any? { + return data + } + } + + + + class ItemsContains1 private constructor(): JsonSchema( + JsonSchemaInfo() + .type(setOf(List::class.java)) + .items(Items::class.java) + .contains(Contains::class.java) + ), ListSchemaValidator { + /* + NOTE: This class is auto generated by OpenAPI JSON Schema Generator. + Ref: https://github.com/openapi-json-schema-tools/openapi-json-schema-generator + + Do not edit the class manually. + */ + + companion object { + @Volatile + private var instance: ItemsContains1? = null + + fun getInstance() = + instance ?: synchronized(this) { + instance ?: ItemsContains1().also { instance = it } + } + } + + override fun getNewInstance(arg: List<*>, pathToItem: List, pathToSchemas: PathToSchemasMap): ItemsContainsList { + val items: MutableList = ArrayList() + var i: Int = 0 + for (item: Any? in arg) { + val itemPathToItem: List = pathToItem + i + val schemas: LinkedHashMap, Nothing?>? = pathToSchemas.get(itemPathToItem) + if (schemas == null) { + throw RuntimeException("Validation result is invalid, schemas must exist for a pathToItem") + } + val itemSchema: JsonSchema<*> = schemas.entries.iterator().next().key + val itemInstance: Any? = itemSchema.getNewInstance(item, itemPathToItem, pathToSchemas) + items.add(itemInstance) + i += 1 + } + val newInstanceItems: FrozenList = FrozenList(items) + return ItemsContainsList(newInstanceItems) + } + + @Throws(ValidationException::class) + override fun validate(arg: List<*>, configuration: SchemaConfiguration?): ItemsContainsList { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, PathToSchemasMap(), LinkedHashSet()) + val pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet) + return getNewInstance(castArg, validationMetadata.pathToItem, pathToSchemasMap) + } + + @Throws(ValidationException::class) + override fun validate(arg: Any?, configuration: SchemaConfiguration?): Any? { + if (arg is List<*>) { + return validate(arg, configuration) + } + throw ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema") + } + override fun getNewInstance(arg: Any?, pathToItem: List, pathToSchemas: PathToSchemasMap): Any? { + if (arg is List<*>) { + return getNewInstance(arg, pathToItem, pathToSchemas) + } + throw RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema") + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: List<*>, configuration: SchemaConfiguration?): ItemsContains1BoxedList { + return ItemsContains1BoxedList(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: Any?, configuration: SchemaConfiguration?): ItemsContains1Boxed { + if (arg is List<*>) { + return validateAndBox(arg, configuration) + } + throw ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema") + } + } +} diff --git a/samples/client/3_1_0_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/schemas/ItemsDoesNotLookInApplicatorsValidCase.kt b/samples/client/3_1_0_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/schemas/ItemsDoesNotLookInApplicatorsValidCase.kt new file mode 100644 index 00000000000..3a2af1e507c --- /dev/null +++ b/samples/client/3_1_0_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/schemas/ItemsDoesNotLookInApplicatorsValidCase.kt @@ -0,0 +1,460 @@ +package org.openapijsonschematools.client.components.schemas +import java.time.LocalDate +import java.time.ZonedDateTime +import java.util.UUID +import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags +import org.openapijsonschematools.client.configurations.SchemaConfiguration +import org.openapijsonschematools.client.exceptions.InvalidAdditionalPropertyException +import org.openapijsonschematools.client.exceptions.UnsetPropertyException +import org.openapijsonschematools.client.exceptions.ValidationException +import org.openapijsonschematools.client.schemas.UnsetAddPropsSetter +import org.openapijsonschematools.client.schemas.validation.BooleanSchemaValidator +import org.openapijsonschematools.client.schemas.validation.FrozenList +import org.openapijsonschematools.client.schemas.validation.FrozenMap +import org.openapijsonschematools.client.schemas.validation.JsonSchema +import org.openapijsonschematools.client.schemas.validation.JsonSchemaInfo +import org.openapijsonschematools.client.schemas.validation.ListSchemaValidator +import org.openapijsonschematools.client.schemas.validation.MapSchemaValidator +import org.openapijsonschematools.client.schemas.validation.NullSchemaValidator +import org.openapijsonschematools.client.schemas.validation.NumberSchemaValidator +import org.openapijsonschematools.client.schemas.validation.PathToSchemasMap +import org.openapijsonschematools.client.schemas.validation.StringSchemaValidator +import org.openapijsonschematools.client.schemas.validation.ValidationMetadata + +class ItemsDoesNotLookInApplicatorsValidCase { + // nest classes so all schemas and input/output classes can be public + + + sealed interface ItemsBoxed { + fun getData(): Any? + } + + data class ItemsBoxedVoid(val data: Nothing?) : ItemsBoxed { + override fun getData(): Any? { + return data + } + } + + data class ItemsBoxedBoolean(val data: Boolean): ItemsBoxed { + override fun getData(): Any? { + return data + } + } + + data class ItemsBoxedNumber(val data: Number) : ItemsBoxed { + override fun getData(): Any? { + return data + } + } + + data class ItemsBoxedString(val data: String) : ItemsBoxed { + override fun getData(): Any? { + return data + } + } + + data class ItemsBoxedList(val data: FrozenList) : ItemsBoxed { + override fun getData(): Any? { + return data + } + } + + data class ItemsBoxedMap(val data: FrozenMap) : ItemsBoxed { + override fun getData(): Any? { + return data + } + } + + + class Items private constructor(): JsonSchema( + JsonSchemaInfo() + .minimum(5) + ), NullSchemaValidator, BooleanSchemaValidator, NumberSchemaValidator, StringSchemaValidator, ListSchemaValidator, ItemsBoxedList>, MapSchemaValidator, ItemsBoxedMap> { + + companion object { + @Volatile + private var instance: Items? = null + + fun getInstance() = + instance ?: synchronized(this) { + instance ?: Items().also { instance = it } + } + } + + @Throws(ValidationException::class) + override fun validate(arg: Nothing?, configuration: SchemaConfiguration?): Nothing? { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validatedPathToSchemas = PathToSchemasMap() + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, LinkedHashSet()) + getPathToSchemas(this, castArg, validationMetadata, pathSet) + return castArg + } + + @Throws(ValidationException::class) + override fun validate(arg: Boolean, configuration: SchemaConfiguration?): Boolean { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validatedPathToSchemas = PathToSchemasMap() + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, LinkedHashSet()) + getPathToSchemas(this, castArg, validationMetadata, pathSet) + return castArg + } + + @Throws(ValidationException::class) + override fun validate(arg: Number, configuration: SchemaConfiguration?): Number { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validatedPathToSchemas = PathToSchemasMap() + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, LinkedHashSet()) + getPathToSchemas(this, castArg, validationMetadata, pathSet) + return castArg + } + + @Throws(ValidationException::class) + fun validate(arg: Int, configuration: SchemaConfiguration?): Int { + return validate(arg as Number, configuration) as Int + } + + @Throws(ValidationException::class) + fun validate(arg: Long, configuration: SchemaConfiguration?): Long { + return validate(arg as Number, configuration) as Long + } + + @Throws(ValidationException::class) + fun validate(arg: Float, configuration: SchemaConfiguration?): Float { + return validate(arg as Number, configuration) as Float + } + + @Throws(ValidationException::class) + fun validate(arg: Double, configuration: SchemaConfiguration?): Double { + return validate(arg as Number, configuration) as Double + } + + @Throws(ValidationException::class) + override fun validate(arg: String, configuration: SchemaConfiguration?): String { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validatedPathToSchemas = PathToSchemasMap() + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, LinkedHashSet()) + getPathToSchemas(this, castArg, validationMetadata, pathSet) + return castArg + } + + @Throws(ValidationException::class) + fun validate(arg: LocalDate, configuration: SchemaConfiguration?): String { + return validate(arg.toString(), configuration) + } + + @Throws(ValidationException::class) + fun validate(arg: ZonedDateTime, configuration: SchemaConfiguration?): String { + return validate(arg.toString(), configuration) + } + + @Throws(ValidationException::class) + fun validate(arg: UUID, configuration: SchemaConfiguration?): String { + return validate(arg.toString(), configuration) + } + + override fun getNewInstance(arg: List<*>, pathToItem: List, pathToSchemas: PathToSchemasMap): FrozenList { + val items: MutableList = ArrayList() + var i: Int = 0 + for (item: Any? in arg) { + val itemPathToItem = pathToItem + i + val schemas: LinkedHashMap, Nothing?>? = pathToSchemas.get(itemPathToItem) + if (schemas == null) { + throw RuntimeException("Validation result is invalid, schemas must exist for a pathToItem") + } + val itemSchema: JsonSchema<*> = schemas.entries.iterator().next().key + val itemInstance: Any? = itemSchema.getNewInstance(item, itemPathToItem, pathToSchemas) + items.add(itemInstance) + i += 1 + } + val newInstanceItems: FrozenList = FrozenList(items) + return newInstanceItems + } + + @Throws(ValidationException::class) + override fun validate(arg: List<*>, configuration: SchemaConfiguration?): FrozenList { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, PathToSchemasMap(), LinkedHashSet()) + val pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet) + return getNewInstance(castArg, validationMetadata.pathToItem, pathToSchemasMap) + } + + override fun getNewInstance(arg: Map<*, *>, pathToItem: List, pathToSchemas: PathToSchemasMap): FrozenMap { + val properties: LinkedHashMap = LinkedHashMap() + for((propertyName, value) in arg) { + if (!(propertyName is String)) { + throw RuntimeException("Invalid non-string key value") + } + val propertyPathToItem: List = pathToItem + propertyName + val schemas: LinkedHashMap, Nothing?>? = pathToSchemas.get(propertyPathToItem) + if (schemas == null) { + throw RuntimeException("Validation result is invalid, schemas must exist for a pathToItem") + } + val propertySchema: JsonSchema<*> = schemas.entries.iterator().next().key + val propertyInstance: Any? = propertySchema.getNewInstance(value, propertyPathToItem, pathToSchemas) + properties[propertyName] = propertyInstance + } + val castProperties: FrozenMap = FrozenMap(properties) + return castProperties + } + + @Throws(ValidationException::class) + override fun validate(arg: Map<*, *>, configuration: SchemaConfiguration?): FrozenMap { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validatedPathToSchemas = PathToSchemasMap() + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, LinkedHashSet()) + val pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet) + return getNewInstance(castArg, validationMetadata.pathToItem, pathToSchemasMap) + } + + @Throws(ValidationException::class) + override fun validate(arg: Any?, configuration: SchemaConfiguration?): Any? { + if (arg == null) { + return validate(null, configuration) + } else if (arg is Boolean) { + return validate(arg, configuration) + } else if (arg is Number) { + return validate(arg, configuration) + } else if (arg is String) { + return validate(arg, configuration) + } else if (arg is List<*>) { + return validate(arg, configuration) + } else if (arg is Map<*, *>) { + return validate(arg, configuration) + } + throw ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema") + } + override fun getNewInstance(arg: Any?, pathToItem: List, pathToSchemas: PathToSchemasMap): Any? { + if (arg == null) { + return getNewInstance( null, pathToItem, pathToSchemas) + } else if (arg is Boolean) { + return getNewInstance(arg, pathToItem, pathToSchemas) + } else if (arg is Number) { + return getNewInstance(arg, pathToItem, pathToSchemas) + } else if (arg is String) { + return getNewInstance(arg, pathToItem, pathToSchemas) + } else if (arg is List<*>) { + return getNewInstance(arg, pathToItem, pathToSchemas) + } else if (arg is Map<*, *>) { + return getNewInstance(arg, pathToItem, pathToSchemas) + } + throw RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema") + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: Nothing?, configuration: SchemaConfiguration?): ItemsBoxedVoid { + return ItemsBoxedVoid(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: Boolean, configuration: SchemaConfiguration?): ItemsBoxedBoolean { + return ItemsBoxedBoolean(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: Number, configuration: SchemaConfiguration?): ItemsBoxedNumber { + return ItemsBoxedNumber(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: String, configuration: SchemaConfiguration?): ItemsBoxedString { + return ItemsBoxedString(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: List<*>, configuration: SchemaConfiguration?): ItemsBoxedList { + return ItemsBoxedList(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: Map<*, *>, configuration: SchemaConfiguration?): ItemsBoxedMap { + return ItemsBoxedMap(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: Any?, configuration: SchemaConfiguration?): ItemsBoxed { + if (arg == null) { + return validateAndBox(null, configuration) + } else if (arg is Boolean) { + return validateAndBox(arg, configuration) + } else if (arg is String) { + return validateAndBox(arg, configuration) + } else if (arg is Number) { + return validateAndBox(arg, configuration) + } else if (arg is List<*>) { + return validateAndBox(arg, configuration) + } else if (arg is Map<*, *>) { + return validateAndBox(arg, configuration) + } + throw ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema") + } + } + + class ItemsDoesNotLookInApplicatorsValidCaseList(m: FrozenList) : FrozenList(m) { + companion object { + @Throws(ValidationException::class) + fun of(arg: List, configuration: SchemaConfiguration?): ItemsDoesNotLookInApplicatorsValidCaseList { + return ItemsDoesNotLookInApplicatorsValidCase1.getInstance().validate(arg, configuration) + } + } + } + + class ItemsDoesNotLookInApplicatorsValidCaseListBuilder { + // class to build List + private val list: MutableList + + init { + this.list = ArrayList() + } + + + fun add(item: Nothing?): ItemsDoesNotLookInApplicatorsValidCaseListBuilder { + list.add(null) + return this + } + + fun add(item: Boolean): ItemsDoesNotLookInApplicatorsValidCaseListBuilder { + list.add(item) + return this + } + + fun add(item: String): ItemsDoesNotLookInApplicatorsValidCaseListBuilder { + list.add(item) + return this + } + + fun add(item: Int): ItemsDoesNotLookInApplicatorsValidCaseListBuilder { + list.add(item) + return this + } + + fun add(item: Float): ItemsDoesNotLookInApplicatorsValidCaseListBuilder { + list.add(item) + return this + } + + fun add(item: Long): ItemsDoesNotLookInApplicatorsValidCaseListBuilder { + list.add(item) + return this + } + + fun add(item: Double): ItemsDoesNotLookInApplicatorsValidCaseListBuilder { + list.add(item) + return this + } + + fun add(item: List<*>): ItemsDoesNotLookInApplicatorsValidCaseListBuilder { + list.add(item) + return this + } + + fun add(item: Map): ItemsDoesNotLookInApplicatorsValidCaseListBuilder { + list.add(item) + return this + } + + fun build(): List { + return list + } + } + + + sealed interface ItemsDoesNotLookInApplicatorsValidCase1Boxed { + fun getData(): Any? + } + + data class ItemsDoesNotLookInApplicatorsValidCase1BoxedList(val data: ItemsDoesNotLookInApplicatorsValidCaseList) : ItemsDoesNotLookInApplicatorsValidCase1Boxed { + override fun getData(): Any? { + return data + } + } + + + + class ItemsDoesNotLookInApplicatorsValidCase1 private constructor(): JsonSchema( + JsonSchemaInfo() + .type(setOf(List::class.java)) + .items(Items::class.java) + ), ListSchemaValidator { + /* + NOTE: This class is auto generated by OpenAPI JSON Schema Generator. + Ref: https://github.com/openapi-json-schema-tools/openapi-json-schema-generator + + Do not edit the class manually. + */ + + companion object { + @Volatile + private var instance: ItemsDoesNotLookInApplicatorsValidCase1? = null + + fun getInstance() = + instance ?: synchronized(this) { + instance ?: ItemsDoesNotLookInApplicatorsValidCase1().also { instance = it } + } + } + + override fun getNewInstance(arg: List<*>, pathToItem: List, pathToSchemas: PathToSchemasMap): ItemsDoesNotLookInApplicatorsValidCaseList { + val items: MutableList = ArrayList() + var i: Int = 0 + for (item: Any? in arg) { + val itemPathToItem: List = pathToItem + i + val schemas: LinkedHashMap, Nothing?>? = pathToSchemas.get(itemPathToItem) + if (schemas == null) { + throw RuntimeException("Validation result is invalid, schemas must exist for a pathToItem") + } + val itemSchema: JsonSchema<*> = schemas.entries.iterator().next().key + val itemInstance: Any? = itemSchema.getNewInstance(item, itemPathToItem, pathToSchemas) + items.add(itemInstance) + i += 1 + } + val newInstanceItems: FrozenList = FrozenList(items) + return ItemsDoesNotLookInApplicatorsValidCaseList(newInstanceItems) + } + + @Throws(ValidationException::class) + override fun validate(arg: List<*>, configuration: SchemaConfiguration?): ItemsDoesNotLookInApplicatorsValidCaseList { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, PathToSchemasMap(), LinkedHashSet()) + val pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet) + return getNewInstance(castArg, validationMetadata.pathToItem, pathToSchemasMap) + } + + @Throws(ValidationException::class) + override fun validate(arg: Any?, configuration: SchemaConfiguration?): Any? { + if (arg is List<*>) { + return validate(arg, configuration) + } + throw ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema") + } + override fun getNewInstance(arg: Any?, pathToItem: List, pathToSchemas: PathToSchemasMap): Any? { + if (arg is List<*>) { + return getNewInstance(arg, pathToItem, pathToSchemas) + } + throw RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema") + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: List<*>, configuration: SchemaConfiguration?): ItemsDoesNotLookInApplicatorsValidCase1BoxedList { + return ItemsDoesNotLookInApplicatorsValidCase1BoxedList(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: Any?, configuration: SchemaConfiguration?): ItemsDoesNotLookInApplicatorsValidCase1Boxed { + if (arg is List<*>) { + return validateAndBox(arg, configuration) + } + throw ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema") + } + } +} diff --git a/samples/client/3_1_0_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/schemas/ItemsWithNullInstanceElements.kt b/samples/client/3_1_0_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/schemas/ItemsWithNullInstanceElements.kt new file mode 100644 index 00000000000..9b289cfe5c4 --- /dev/null +++ b/samples/client/3_1_0_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/schemas/ItemsWithNullInstanceElements.kt @@ -0,0 +1,150 @@ +package org.openapijsonschematools.client.components.schemas +import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags +import org.openapijsonschematools.client.configurations.SchemaConfiguration +import org.openapijsonschematools.client.exceptions.ValidationException +import org.openapijsonschematools.client.schemas.NullJsonSchema +import org.openapijsonschematools.client.schemas.validation.FrozenList +import org.openapijsonschematools.client.schemas.validation.JsonSchema +import org.openapijsonschematools.client.schemas.validation.JsonSchemaInfo +import org.openapijsonschematools.client.schemas.validation.ListSchemaValidator +import org.openapijsonschematools.client.schemas.validation.PathToSchemasMap +import org.openapijsonschematools.client.schemas.validation.ValidationMetadata + +class ItemsWithNullInstanceElements { + // nest classes so all schemas and input/output classes can be public + + + class Items : NullJsonSchema.NullJsonSchema1() { + companion object { + @Volatile + private var instance: Items? = null + + fun getInstance() = + instance ?: synchronized(this) { + instance ?: Items().also { instance = it } + } + } + } + + + class ItemsWithNullInstanceElementsList(m: FrozenList) : FrozenList(m) { + companion object { + @Throws(ValidationException::class) + fun of(arg: List, configuration: SchemaConfiguration?): ItemsWithNullInstanceElementsList { + return ItemsWithNullInstanceElements1.getInstance().validate(arg, configuration) + } + } + } + + class ItemsWithNullInstanceElementsListBuilder { + // class to build List + private val list: MutableList + + init { + this.list = ArrayList() + } + + + fun add(item: Nothing?): ItemsWithNullInstanceElementsListBuilder { + list.add(null) + return this + } + + fun build(): List { + return list + } + } + + + sealed interface ItemsWithNullInstanceElements1Boxed { + fun getData(): Any? + } + + data class ItemsWithNullInstanceElements1BoxedList(val data: ItemsWithNullInstanceElementsList) : ItemsWithNullInstanceElements1Boxed { + override fun getData(): Any? { + return data + } + } + + + + class ItemsWithNullInstanceElements1 private constructor(): JsonSchema( + JsonSchemaInfo() + .type(setOf(List::class.java)) + .items(Items::class.java) + ), ListSchemaValidator { + /* + NOTE: This class is auto generated by OpenAPI JSON Schema Generator. + Ref: https://github.com/openapi-json-schema-tools/openapi-json-schema-generator + + Do not edit the class manually. + */ + + companion object { + @Volatile + private var instance: ItemsWithNullInstanceElements1? = null + + fun getInstance() = + instance ?: synchronized(this) { + instance ?: ItemsWithNullInstanceElements1().also { instance = it } + } + } + + override fun getNewInstance(arg: List<*>, pathToItem: List, pathToSchemas: PathToSchemasMap): ItemsWithNullInstanceElementsList { + val items: MutableList = ArrayList() + var i: Int = 0 + for (item: Any? in arg) { + val itemPathToItem: List = pathToItem + i + val schemas: LinkedHashMap, Nothing?>? = pathToSchemas.get(itemPathToItem) + if (schemas == null) { + throw RuntimeException("Validation result is invalid, schemas must exist for a pathToItem") + } + val itemSchema: JsonSchema<*> = schemas.entries.iterator().next().key + val itemInstance: Any? = itemSchema.getNewInstance(item, itemPathToItem, pathToSchemas) + if (!(itemInstance == null || itemInstance is Nothing?)) { + throw RuntimeException("Invalid instantiated value") + } + items.add(itemInstance) + i += 1 + } + val newInstanceItems: FrozenList = FrozenList(items) + return ItemsWithNullInstanceElementsList(newInstanceItems) + } + + @Throws(ValidationException::class) + override fun validate(arg: List<*>, configuration: SchemaConfiguration?): ItemsWithNullInstanceElementsList { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, PathToSchemasMap(), LinkedHashSet()) + val pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet) + return getNewInstance(castArg, validationMetadata.pathToItem, pathToSchemasMap) + } + + @Throws(ValidationException::class) + override fun validate(arg: Any?, configuration: SchemaConfiguration?): Any? { + if (arg is List<*>) { + return validate(arg, configuration) + } + throw ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema") + } + override fun getNewInstance(arg: Any?, pathToItem: List, pathToSchemas: PathToSchemasMap): Any? { + if (arg is List<*>) { + return getNewInstance(arg, pathToItem, pathToSchemas) + } + throw RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema") + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: List<*>, configuration: SchemaConfiguration?): ItemsWithNullInstanceElements1BoxedList { + return ItemsWithNullInstanceElements1BoxedList(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: Any?, configuration: SchemaConfiguration?): ItemsWithNullInstanceElements1Boxed { + if (arg is List<*>) { + return validateAndBox(arg, configuration) + } + throw ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema") + } + } +} diff --git a/samples/client/3_1_0_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/schemas/JsonPointerFormat.kt b/samples/client/3_1_0_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/schemas/JsonPointerFormat.kt new file mode 100644 index 00000000000..b45b9ad16a2 --- /dev/null +++ b/samples/client/3_1_0_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/schemas/JsonPointerFormat.kt @@ -0,0 +1,308 @@ +package org.openapijsonschematools.client.components.schemas +import java.time.LocalDate +import java.time.ZonedDateTime +import java.util.UUID +import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags +import org.openapijsonschematools.client.configurations.SchemaConfiguration +import org.openapijsonschematools.client.exceptions.InvalidAdditionalPropertyException +import org.openapijsonschematools.client.exceptions.UnsetPropertyException +import org.openapijsonschematools.client.exceptions.ValidationException +import org.openapijsonschematools.client.schemas.UnsetAddPropsSetter +import org.openapijsonschematools.client.schemas.validation.BooleanSchemaValidator +import org.openapijsonschematools.client.schemas.validation.FrozenList +import org.openapijsonschematools.client.schemas.validation.FrozenMap +import org.openapijsonschematools.client.schemas.validation.JsonSchema +import org.openapijsonschematools.client.schemas.validation.JsonSchemaInfo +import org.openapijsonschematools.client.schemas.validation.ListSchemaValidator +import org.openapijsonschematools.client.schemas.validation.MapSchemaValidator +import org.openapijsonschematools.client.schemas.validation.NullSchemaValidator +import org.openapijsonschematools.client.schemas.validation.NumberSchemaValidator +import org.openapijsonschematools.client.schemas.validation.PathToSchemasMap +import org.openapijsonschematools.client.schemas.validation.StringSchemaValidator +import org.openapijsonschematools.client.schemas.validation.ValidationMetadata + +class JsonPointerFormat { + // nest classes so all schemas and input/output classes can be public + + + sealed interface JsonPointerFormat1Boxed { + fun getData(): Any? + } + + data class JsonPointerFormat1BoxedVoid(val data: Nothing?) : JsonPointerFormat1Boxed { + override fun getData(): Any? { + return data + } + } + + data class JsonPointerFormat1BoxedBoolean(val data: Boolean): JsonPointerFormat1Boxed { + override fun getData(): Any? { + return data + } + } + + data class JsonPointerFormat1BoxedNumber(val data: Number) : JsonPointerFormat1Boxed { + override fun getData(): Any? { + return data + } + } + + data class JsonPointerFormat1BoxedString(val data: String) : JsonPointerFormat1Boxed { + override fun getData(): Any? { + return data + } + } + + data class JsonPointerFormat1BoxedList(val data: FrozenList) : JsonPointerFormat1Boxed { + override fun getData(): Any? { + return data + } + } + + data class JsonPointerFormat1BoxedMap(val data: FrozenMap) : JsonPointerFormat1Boxed { + override fun getData(): Any? { + return data + } + } + + + class JsonPointerFormat1 private constructor(): JsonSchema( + JsonSchemaInfo() + .format("json-pointer") + ), NullSchemaValidator, BooleanSchemaValidator, NumberSchemaValidator, StringSchemaValidator, ListSchemaValidator, JsonPointerFormat1BoxedList>, MapSchemaValidator, JsonPointerFormat1BoxedMap> { + /* + NOTE: This class is auto generated by OpenAPI JSON Schema Generator. + Ref: https://github.com/openapi-json-schema-tools/openapi-json-schema-generator + + Do not edit the class manually. + */ + + companion object { + @Volatile + private var instance: JsonPointerFormat1? = null + + fun getInstance() = + instance ?: synchronized(this) { + instance ?: JsonPointerFormat1().also { instance = it } + } + } + + @Throws(ValidationException::class) + override fun validate(arg: Nothing?, configuration: SchemaConfiguration?): Nothing? { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validatedPathToSchemas = PathToSchemasMap() + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, LinkedHashSet()) + getPathToSchemas(this, castArg, validationMetadata, pathSet) + return castArg + } + + @Throws(ValidationException::class) + override fun validate(arg: Boolean, configuration: SchemaConfiguration?): Boolean { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validatedPathToSchemas = PathToSchemasMap() + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, LinkedHashSet()) + getPathToSchemas(this, castArg, validationMetadata, pathSet) + return castArg + } + + @Throws(ValidationException::class) + override fun validate(arg: Number, configuration: SchemaConfiguration?): Number { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validatedPathToSchemas = PathToSchemasMap() + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, LinkedHashSet()) + getPathToSchemas(this, castArg, validationMetadata, pathSet) + return castArg + } + + @Throws(ValidationException::class) + fun validate(arg: Int, configuration: SchemaConfiguration?): Int { + return validate(arg as Number, configuration) as Int + } + + @Throws(ValidationException::class) + fun validate(arg: Long, configuration: SchemaConfiguration?): Long { + return validate(arg as Number, configuration) as Long + } + + @Throws(ValidationException::class) + fun validate(arg: Float, configuration: SchemaConfiguration?): Float { + return validate(arg as Number, configuration) as Float + } + + @Throws(ValidationException::class) + fun validate(arg: Double, configuration: SchemaConfiguration?): Double { + return validate(arg as Number, configuration) as Double + } + + @Throws(ValidationException::class) + override fun validate(arg: String, configuration: SchemaConfiguration?): String { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validatedPathToSchemas = PathToSchemasMap() + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, LinkedHashSet()) + getPathToSchemas(this, castArg, validationMetadata, pathSet) + return castArg + } + + @Throws(ValidationException::class) + fun validate(arg: LocalDate, configuration: SchemaConfiguration?): String { + return validate(arg.toString(), configuration) + } + + @Throws(ValidationException::class) + fun validate(arg: ZonedDateTime, configuration: SchemaConfiguration?): String { + return validate(arg.toString(), configuration) + } + + @Throws(ValidationException::class) + fun validate(arg: UUID, configuration: SchemaConfiguration?): String { + return validate(arg.toString(), configuration) + } + + override fun getNewInstance(arg: List<*>, pathToItem: List, pathToSchemas: PathToSchemasMap): FrozenList { + val items: MutableList = ArrayList() + var i: Int = 0 + for (item: Any? in arg) { + val itemPathToItem = pathToItem + i + val schemas: LinkedHashMap, Nothing?>? = pathToSchemas.get(itemPathToItem) + if (schemas == null) { + throw RuntimeException("Validation result is invalid, schemas must exist for a pathToItem") + } + val itemSchema: JsonSchema<*> = schemas.entries.iterator().next().key + val itemInstance: Any? = itemSchema.getNewInstance(item, itemPathToItem, pathToSchemas) + items.add(itemInstance) + i += 1 + } + val newInstanceItems: FrozenList = FrozenList(items) + return newInstanceItems + } + + @Throws(ValidationException::class) + override fun validate(arg: List<*>, configuration: SchemaConfiguration?): FrozenList { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, PathToSchemasMap(), LinkedHashSet()) + val pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet) + return getNewInstance(castArg, validationMetadata.pathToItem, pathToSchemasMap) + } + + override fun getNewInstance(arg: Map<*, *>, pathToItem: List, pathToSchemas: PathToSchemasMap): FrozenMap { + val properties: LinkedHashMap = LinkedHashMap() + for((propertyName, value) in arg) { + if (!(propertyName is String)) { + throw RuntimeException("Invalid non-string key value") + } + val propertyPathToItem: List = pathToItem + propertyName + val schemas: LinkedHashMap, Nothing?>? = pathToSchemas.get(propertyPathToItem) + if (schemas == null) { + throw RuntimeException("Validation result is invalid, schemas must exist for a pathToItem") + } + val propertySchema: JsonSchema<*> = schemas.entries.iterator().next().key + val propertyInstance: Any? = propertySchema.getNewInstance(value, propertyPathToItem, pathToSchemas) + properties[propertyName] = propertyInstance + } + val castProperties: FrozenMap = FrozenMap(properties) + return castProperties + } + + @Throws(ValidationException::class) + override fun validate(arg: Map<*, *>, configuration: SchemaConfiguration?): FrozenMap { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validatedPathToSchemas = PathToSchemasMap() + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, LinkedHashSet()) + val pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet) + return getNewInstance(castArg, validationMetadata.pathToItem, pathToSchemasMap) + } + + @Throws(ValidationException::class) + override fun validate(arg: Any?, configuration: SchemaConfiguration?): Any? { + if (arg == null) { + return validate(null, configuration) + } else if (arg is Boolean) { + return validate(arg, configuration) + } else if (arg is Number) { + return validate(arg, configuration) + } else if (arg is String) { + return validate(arg, configuration) + } else if (arg is List<*>) { + return validate(arg, configuration) + } else if (arg is Map<*, *>) { + return validate(arg, configuration) + } + throw ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema") + } + override fun getNewInstance(arg: Any?, pathToItem: List, pathToSchemas: PathToSchemasMap): Any? { + if (arg == null) { + return getNewInstance( null, pathToItem, pathToSchemas) + } else if (arg is Boolean) { + return getNewInstance(arg, pathToItem, pathToSchemas) + } else if (arg is Number) { + return getNewInstance(arg, pathToItem, pathToSchemas) + } else if (arg is String) { + return getNewInstance(arg, pathToItem, pathToSchemas) + } else if (arg is List<*>) { + return getNewInstance(arg, pathToItem, pathToSchemas) + } else if (arg is Map<*, *>) { + return getNewInstance(arg, pathToItem, pathToSchemas) + } + throw RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema") + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: Nothing?, configuration: SchemaConfiguration?): JsonPointerFormat1BoxedVoid { + return JsonPointerFormat1BoxedVoid(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: Boolean, configuration: SchemaConfiguration?): JsonPointerFormat1BoxedBoolean { + return JsonPointerFormat1BoxedBoolean(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: Number, configuration: SchemaConfiguration?): JsonPointerFormat1BoxedNumber { + return JsonPointerFormat1BoxedNumber(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: String, configuration: SchemaConfiguration?): JsonPointerFormat1BoxedString { + return JsonPointerFormat1BoxedString(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: List<*>, configuration: SchemaConfiguration?): JsonPointerFormat1BoxedList { + return JsonPointerFormat1BoxedList(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: Map<*, *>, configuration: SchemaConfiguration?): JsonPointerFormat1BoxedMap { + return JsonPointerFormat1BoxedMap(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: Any?, configuration: SchemaConfiguration?): JsonPointerFormat1Boxed { + if (arg == null) { + return validateAndBox(null, configuration) + } else if (arg is Boolean) { + return validateAndBox(arg, configuration) + } else if (arg is String) { + return validateAndBox(arg, configuration) + } else if (arg is Number) { + return validateAndBox(arg, configuration) + } else if (arg is List<*>) { + return validateAndBox(arg, configuration) + } else if (arg is Map<*, *>) { + return validateAndBox(arg, configuration) + } + throw ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema") + } + } +} diff --git a/samples/client/3_1_0_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/schemas/MaxcontainsWithoutContainsIsIgnored.kt b/samples/client/3_1_0_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/schemas/MaxcontainsWithoutContainsIsIgnored.kt new file mode 100644 index 00000000000..8aabb923c5a --- /dev/null +++ b/samples/client/3_1_0_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/schemas/MaxcontainsWithoutContainsIsIgnored.kt @@ -0,0 +1,308 @@ +package org.openapijsonschematools.client.components.schemas +import java.time.LocalDate +import java.time.ZonedDateTime +import java.util.UUID +import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags +import org.openapijsonschematools.client.configurations.SchemaConfiguration +import org.openapijsonschematools.client.exceptions.InvalidAdditionalPropertyException +import org.openapijsonschematools.client.exceptions.UnsetPropertyException +import org.openapijsonschematools.client.exceptions.ValidationException +import org.openapijsonschematools.client.schemas.UnsetAddPropsSetter +import org.openapijsonschematools.client.schemas.validation.BooleanSchemaValidator +import org.openapijsonschematools.client.schemas.validation.FrozenList +import org.openapijsonschematools.client.schemas.validation.FrozenMap +import org.openapijsonschematools.client.schemas.validation.JsonSchema +import org.openapijsonschematools.client.schemas.validation.JsonSchemaInfo +import org.openapijsonschematools.client.schemas.validation.ListSchemaValidator +import org.openapijsonschematools.client.schemas.validation.MapSchemaValidator +import org.openapijsonschematools.client.schemas.validation.NullSchemaValidator +import org.openapijsonschematools.client.schemas.validation.NumberSchemaValidator +import org.openapijsonschematools.client.schemas.validation.PathToSchemasMap +import org.openapijsonschematools.client.schemas.validation.StringSchemaValidator +import org.openapijsonschematools.client.schemas.validation.ValidationMetadata + +class MaxcontainsWithoutContainsIsIgnored { + // nest classes so all schemas and input/output classes can be public + + + sealed interface MaxcontainsWithoutContainsIsIgnored1Boxed { + fun getData(): Any? + } + + data class MaxcontainsWithoutContainsIsIgnored1BoxedVoid(val data: Nothing?) : MaxcontainsWithoutContainsIsIgnored1Boxed { + override fun getData(): Any? { + return data + } + } + + data class MaxcontainsWithoutContainsIsIgnored1BoxedBoolean(val data: Boolean): MaxcontainsWithoutContainsIsIgnored1Boxed { + override fun getData(): Any? { + return data + } + } + + data class MaxcontainsWithoutContainsIsIgnored1BoxedNumber(val data: Number) : MaxcontainsWithoutContainsIsIgnored1Boxed { + override fun getData(): Any? { + return data + } + } + + data class MaxcontainsWithoutContainsIsIgnored1BoxedString(val data: String) : MaxcontainsWithoutContainsIsIgnored1Boxed { + override fun getData(): Any? { + return data + } + } + + data class MaxcontainsWithoutContainsIsIgnored1BoxedList(val data: FrozenList) : MaxcontainsWithoutContainsIsIgnored1Boxed { + override fun getData(): Any? { + return data + } + } + + data class MaxcontainsWithoutContainsIsIgnored1BoxedMap(val data: FrozenMap) : MaxcontainsWithoutContainsIsIgnored1Boxed { + override fun getData(): Any? { + return data + } + } + + + class MaxcontainsWithoutContainsIsIgnored1 private constructor(): JsonSchema( + JsonSchemaInfo() + .maxContains(1) + ), NullSchemaValidator, BooleanSchemaValidator, NumberSchemaValidator, StringSchemaValidator, ListSchemaValidator, MaxcontainsWithoutContainsIsIgnored1BoxedList>, MapSchemaValidator, MaxcontainsWithoutContainsIsIgnored1BoxedMap> { + /* + NOTE: This class is auto generated by OpenAPI JSON Schema Generator. + Ref: https://github.com/openapi-json-schema-tools/openapi-json-schema-generator + + Do not edit the class manually. + */ + + companion object { + @Volatile + private var instance: MaxcontainsWithoutContainsIsIgnored1? = null + + fun getInstance() = + instance ?: synchronized(this) { + instance ?: MaxcontainsWithoutContainsIsIgnored1().also { instance = it } + } + } + + @Throws(ValidationException::class) + override fun validate(arg: Nothing?, configuration: SchemaConfiguration?): Nothing? { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validatedPathToSchemas = PathToSchemasMap() + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, LinkedHashSet()) + getPathToSchemas(this, castArg, validationMetadata, pathSet) + return castArg + } + + @Throws(ValidationException::class) + override fun validate(arg: Boolean, configuration: SchemaConfiguration?): Boolean { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validatedPathToSchemas = PathToSchemasMap() + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, LinkedHashSet()) + getPathToSchemas(this, castArg, validationMetadata, pathSet) + return castArg + } + + @Throws(ValidationException::class) + override fun validate(arg: Number, configuration: SchemaConfiguration?): Number { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validatedPathToSchemas = PathToSchemasMap() + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, LinkedHashSet()) + getPathToSchemas(this, castArg, validationMetadata, pathSet) + return castArg + } + + @Throws(ValidationException::class) + fun validate(arg: Int, configuration: SchemaConfiguration?): Int { + return validate(arg as Number, configuration) as Int + } + + @Throws(ValidationException::class) + fun validate(arg: Long, configuration: SchemaConfiguration?): Long { + return validate(arg as Number, configuration) as Long + } + + @Throws(ValidationException::class) + fun validate(arg: Float, configuration: SchemaConfiguration?): Float { + return validate(arg as Number, configuration) as Float + } + + @Throws(ValidationException::class) + fun validate(arg: Double, configuration: SchemaConfiguration?): Double { + return validate(arg as Number, configuration) as Double + } + + @Throws(ValidationException::class) + override fun validate(arg: String, configuration: SchemaConfiguration?): String { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validatedPathToSchemas = PathToSchemasMap() + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, LinkedHashSet()) + getPathToSchemas(this, castArg, validationMetadata, pathSet) + return castArg + } + + @Throws(ValidationException::class) + fun validate(arg: LocalDate, configuration: SchemaConfiguration?): String { + return validate(arg.toString(), configuration) + } + + @Throws(ValidationException::class) + fun validate(arg: ZonedDateTime, configuration: SchemaConfiguration?): String { + return validate(arg.toString(), configuration) + } + + @Throws(ValidationException::class) + fun validate(arg: UUID, configuration: SchemaConfiguration?): String { + return validate(arg.toString(), configuration) + } + + override fun getNewInstance(arg: List<*>, pathToItem: List, pathToSchemas: PathToSchemasMap): FrozenList { + val items: MutableList = ArrayList() + var i: Int = 0 + for (item: Any? in arg) { + val itemPathToItem = pathToItem + i + val schemas: LinkedHashMap, Nothing?>? = pathToSchemas.get(itemPathToItem) + if (schemas == null) { + throw RuntimeException("Validation result is invalid, schemas must exist for a pathToItem") + } + val itemSchema: JsonSchema<*> = schemas.entries.iterator().next().key + val itemInstance: Any? = itemSchema.getNewInstance(item, itemPathToItem, pathToSchemas) + items.add(itemInstance) + i += 1 + } + val newInstanceItems: FrozenList = FrozenList(items) + return newInstanceItems + } + + @Throws(ValidationException::class) + override fun validate(arg: List<*>, configuration: SchemaConfiguration?): FrozenList { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, PathToSchemasMap(), LinkedHashSet()) + val pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet) + return getNewInstance(castArg, validationMetadata.pathToItem, pathToSchemasMap) + } + + override fun getNewInstance(arg: Map<*, *>, pathToItem: List, pathToSchemas: PathToSchemasMap): FrozenMap { + val properties: LinkedHashMap = LinkedHashMap() + for((propertyName, value) in arg) { + if (!(propertyName is String)) { + throw RuntimeException("Invalid non-string key value") + } + val propertyPathToItem: List = pathToItem + propertyName + val schemas: LinkedHashMap, Nothing?>? = pathToSchemas.get(propertyPathToItem) + if (schemas == null) { + throw RuntimeException("Validation result is invalid, schemas must exist for a pathToItem") + } + val propertySchema: JsonSchema<*> = schemas.entries.iterator().next().key + val propertyInstance: Any? = propertySchema.getNewInstance(value, propertyPathToItem, pathToSchemas) + properties[propertyName] = propertyInstance + } + val castProperties: FrozenMap = FrozenMap(properties) + return castProperties + } + + @Throws(ValidationException::class) + override fun validate(arg: Map<*, *>, configuration: SchemaConfiguration?): FrozenMap { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validatedPathToSchemas = PathToSchemasMap() + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, LinkedHashSet()) + val pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet) + return getNewInstance(castArg, validationMetadata.pathToItem, pathToSchemasMap) + } + + @Throws(ValidationException::class) + override fun validate(arg: Any?, configuration: SchemaConfiguration?): Any? { + if (arg == null) { + return validate(null, configuration) + } else if (arg is Boolean) { + return validate(arg, configuration) + } else if (arg is Number) { + return validate(arg, configuration) + } else if (arg is String) { + return validate(arg, configuration) + } else if (arg is List<*>) { + return validate(arg, configuration) + } else if (arg is Map<*, *>) { + return validate(arg, configuration) + } + throw ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema") + } + override fun getNewInstance(arg: Any?, pathToItem: List, pathToSchemas: PathToSchemasMap): Any? { + if (arg == null) { + return getNewInstance( null, pathToItem, pathToSchemas) + } else if (arg is Boolean) { + return getNewInstance(arg, pathToItem, pathToSchemas) + } else if (arg is Number) { + return getNewInstance(arg, pathToItem, pathToSchemas) + } else if (arg is String) { + return getNewInstance(arg, pathToItem, pathToSchemas) + } else if (arg is List<*>) { + return getNewInstance(arg, pathToItem, pathToSchemas) + } else if (arg is Map<*, *>) { + return getNewInstance(arg, pathToItem, pathToSchemas) + } + throw RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema") + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: Nothing?, configuration: SchemaConfiguration?): MaxcontainsWithoutContainsIsIgnored1BoxedVoid { + return MaxcontainsWithoutContainsIsIgnored1BoxedVoid(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: Boolean, configuration: SchemaConfiguration?): MaxcontainsWithoutContainsIsIgnored1BoxedBoolean { + return MaxcontainsWithoutContainsIsIgnored1BoxedBoolean(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: Number, configuration: SchemaConfiguration?): MaxcontainsWithoutContainsIsIgnored1BoxedNumber { + return MaxcontainsWithoutContainsIsIgnored1BoxedNumber(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: String, configuration: SchemaConfiguration?): MaxcontainsWithoutContainsIsIgnored1BoxedString { + return MaxcontainsWithoutContainsIsIgnored1BoxedString(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: List<*>, configuration: SchemaConfiguration?): MaxcontainsWithoutContainsIsIgnored1BoxedList { + return MaxcontainsWithoutContainsIsIgnored1BoxedList(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: Map<*, *>, configuration: SchemaConfiguration?): MaxcontainsWithoutContainsIsIgnored1BoxedMap { + return MaxcontainsWithoutContainsIsIgnored1BoxedMap(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: Any?, configuration: SchemaConfiguration?): MaxcontainsWithoutContainsIsIgnored1Boxed { + if (arg == null) { + return validateAndBox(null, configuration) + } else if (arg is Boolean) { + return validateAndBox(arg, configuration) + } else if (arg is String) { + return validateAndBox(arg, configuration) + } else if (arg is Number) { + return validateAndBox(arg, configuration) + } else if (arg is List<*>) { + return validateAndBox(arg, configuration) + } else if (arg is Map<*, *>) { + return validateAndBox(arg, configuration) + } + throw ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema") + } + } +} diff --git a/samples/client/3_1_0_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/schemas/MaximumValidation.kt b/samples/client/3_1_0_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/schemas/MaximumValidation.kt new file mode 100644 index 00000000000..46d8b221c64 --- /dev/null +++ b/samples/client/3_1_0_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/schemas/MaximumValidation.kt @@ -0,0 +1,308 @@ +package org.openapijsonschematools.client.components.schemas +import java.time.LocalDate +import java.time.ZonedDateTime +import java.util.UUID +import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags +import org.openapijsonschematools.client.configurations.SchemaConfiguration +import org.openapijsonschematools.client.exceptions.InvalidAdditionalPropertyException +import org.openapijsonschematools.client.exceptions.UnsetPropertyException +import org.openapijsonschematools.client.exceptions.ValidationException +import org.openapijsonschematools.client.schemas.UnsetAddPropsSetter +import org.openapijsonschematools.client.schemas.validation.BooleanSchemaValidator +import org.openapijsonschematools.client.schemas.validation.FrozenList +import org.openapijsonschematools.client.schemas.validation.FrozenMap +import org.openapijsonschematools.client.schemas.validation.JsonSchema +import org.openapijsonschematools.client.schemas.validation.JsonSchemaInfo +import org.openapijsonschematools.client.schemas.validation.ListSchemaValidator +import org.openapijsonschematools.client.schemas.validation.MapSchemaValidator +import org.openapijsonschematools.client.schemas.validation.NullSchemaValidator +import org.openapijsonschematools.client.schemas.validation.NumberSchemaValidator +import org.openapijsonschematools.client.schemas.validation.PathToSchemasMap +import org.openapijsonschematools.client.schemas.validation.StringSchemaValidator +import org.openapijsonschematools.client.schemas.validation.ValidationMetadata + +class MaximumValidation { + // nest classes so all schemas and input/output classes can be public + + + sealed interface MaximumValidation1Boxed { + fun getData(): Any? + } + + data class MaximumValidation1BoxedVoid(val data: Nothing?) : MaximumValidation1Boxed { + override fun getData(): Any? { + return data + } + } + + data class MaximumValidation1BoxedBoolean(val data: Boolean): MaximumValidation1Boxed { + override fun getData(): Any? { + return data + } + } + + data class MaximumValidation1BoxedNumber(val data: Number) : MaximumValidation1Boxed { + override fun getData(): Any? { + return data + } + } + + data class MaximumValidation1BoxedString(val data: String) : MaximumValidation1Boxed { + override fun getData(): Any? { + return data + } + } + + data class MaximumValidation1BoxedList(val data: FrozenList) : MaximumValidation1Boxed { + override fun getData(): Any? { + return data + } + } + + data class MaximumValidation1BoxedMap(val data: FrozenMap) : MaximumValidation1Boxed { + override fun getData(): Any? { + return data + } + } + + + class MaximumValidation1 private constructor(): JsonSchema( + JsonSchemaInfo() + .maximum(3.0) + ), NullSchemaValidator, BooleanSchemaValidator, NumberSchemaValidator, StringSchemaValidator, ListSchemaValidator, MaximumValidation1BoxedList>, MapSchemaValidator, MaximumValidation1BoxedMap> { + /* + NOTE: This class is auto generated by OpenAPI JSON Schema Generator. + Ref: https://github.com/openapi-json-schema-tools/openapi-json-schema-generator + + Do not edit the class manually. + */ + + companion object { + @Volatile + private var instance: MaximumValidation1? = null + + fun getInstance() = + instance ?: synchronized(this) { + instance ?: MaximumValidation1().also { instance = it } + } + } + + @Throws(ValidationException::class) + override fun validate(arg: Nothing?, configuration: SchemaConfiguration?): Nothing? { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validatedPathToSchemas = PathToSchemasMap() + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, LinkedHashSet()) + getPathToSchemas(this, castArg, validationMetadata, pathSet) + return castArg + } + + @Throws(ValidationException::class) + override fun validate(arg: Boolean, configuration: SchemaConfiguration?): Boolean { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validatedPathToSchemas = PathToSchemasMap() + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, LinkedHashSet()) + getPathToSchemas(this, castArg, validationMetadata, pathSet) + return castArg + } + + @Throws(ValidationException::class) + override fun validate(arg: Number, configuration: SchemaConfiguration?): Number { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validatedPathToSchemas = PathToSchemasMap() + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, LinkedHashSet()) + getPathToSchemas(this, castArg, validationMetadata, pathSet) + return castArg + } + + @Throws(ValidationException::class) + fun validate(arg: Int, configuration: SchemaConfiguration?): Int { + return validate(arg as Number, configuration) as Int + } + + @Throws(ValidationException::class) + fun validate(arg: Long, configuration: SchemaConfiguration?): Long { + return validate(arg as Number, configuration) as Long + } + + @Throws(ValidationException::class) + fun validate(arg: Float, configuration: SchemaConfiguration?): Float { + return validate(arg as Number, configuration) as Float + } + + @Throws(ValidationException::class) + fun validate(arg: Double, configuration: SchemaConfiguration?): Double { + return validate(arg as Number, configuration) as Double + } + + @Throws(ValidationException::class) + override fun validate(arg: String, configuration: SchemaConfiguration?): String { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validatedPathToSchemas = PathToSchemasMap() + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, LinkedHashSet()) + getPathToSchemas(this, castArg, validationMetadata, pathSet) + return castArg + } + + @Throws(ValidationException::class) + fun validate(arg: LocalDate, configuration: SchemaConfiguration?): String { + return validate(arg.toString(), configuration) + } + + @Throws(ValidationException::class) + fun validate(arg: ZonedDateTime, configuration: SchemaConfiguration?): String { + return validate(arg.toString(), configuration) + } + + @Throws(ValidationException::class) + fun validate(arg: UUID, configuration: SchemaConfiguration?): String { + return validate(arg.toString(), configuration) + } + + override fun getNewInstance(arg: List<*>, pathToItem: List, pathToSchemas: PathToSchemasMap): FrozenList { + val items: MutableList = ArrayList() + var i: Int = 0 + for (item: Any? in arg) { + val itemPathToItem = pathToItem + i + val schemas: LinkedHashMap, Nothing?>? = pathToSchemas.get(itemPathToItem) + if (schemas == null) { + throw RuntimeException("Validation result is invalid, schemas must exist for a pathToItem") + } + val itemSchema: JsonSchema<*> = schemas.entries.iterator().next().key + val itemInstance: Any? = itemSchema.getNewInstance(item, itemPathToItem, pathToSchemas) + items.add(itemInstance) + i += 1 + } + val newInstanceItems: FrozenList = FrozenList(items) + return newInstanceItems + } + + @Throws(ValidationException::class) + override fun validate(arg: List<*>, configuration: SchemaConfiguration?): FrozenList { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, PathToSchemasMap(), LinkedHashSet()) + val pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet) + return getNewInstance(castArg, validationMetadata.pathToItem, pathToSchemasMap) + } + + override fun getNewInstance(arg: Map<*, *>, pathToItem: List, pathToSchemas: PathToSchemasMap): FrozenMap { + val properties: LinkedHashMap = LinkedHashMap() + for((propertyName, value) in arg) { + if (!(propertyName is String)) { + throw RuntimeException("Invalid non-string key value") + } + val propertyPathToItem: List = pathToItem + propertyName + val schemas: LinkedHashMap, Nothing?>? = pathToSchemas.get(propertyPathToItem) + if (schemas == null) { + throw RuntimeException("Validation result is invalid, schemas must exist for a pathToItem") + } + val propertySchema: JsonSchema<*> = schemas.entries.iterator().next().key + val propertyInstance: Any? = propertySchema.getNewInstance(value, propertyPathToItem, pathToSchemas) + properties[propertyName] = propertyInstance + } + val castProperties: FrozenMap = FrozenMap(properties) + return castProperties + } + + @Throws(ValidationException::class) + override fun validate(arg: Map<*, *>, configuration: SchemaConfiguration?): FrozenMap { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validatedPathToSchemas = PathToSchemasMap() + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, LinkedHashSet()) + val pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet) + return getNewInstance(castArg, validationMetadata.pathToItem, pathToSchemasMap) + } + + @Throws(ValidationException::class) + override fun validate(arg: Any?, configuration: SchemaConfiguration?): Any? { + if (arg == null) { + return validate(null, configuration) + } else if (arg is Boolean) { + return validate(arg, configuration) + } else if (arg is Number) { + return validate(arg, configuration) + } else if (arg is String) { + return validate(arg, configuration) + } else if (arg is List<*>) { + return validate(arg, configuration) + } else if (arg is Map<*, *>) { + return validate(arg, configuration) + } + throw ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema") + } + override fun getNewInstance(arg: Any?, pathToItem: List, pathToSchemas: PathToSchemasMap): Any? { + if (arg == null) { + return getNewInstance( null, pathToItem, pathToSchemas) + } else if (arg is Boolean) { + return getNewInstance(arg, pathToItem, pathToSchemas) + } else if (arg is Number) { + return getNewInstance(arg, pathToItem, pathToSchemas) + } else if (arg is String) { + return getNewInstance(arg, pathToItem, pathToSchemas) + } else if (arg is List<*>) { + return getNewInstance(arg, pathToItem, pathToSchemas) + } else if (arg is Map<*, *>) { + return getNewInstance(arg, pathToItem, pathToSchemas) + } + throw RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema") + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: Nothing?, configuration: SchemaConfiguration?): MaximumValidation1BoxedVoid { + return MaximumValidation1BoxedVoid(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: Boolean, configuration: SchemaConfiguration?): MaximumValidation1BoxedBoolean { + return MaximumValidation1BoxedBoolean(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: Number, configuration: SchemaConfiguration?): MaximumValidation1BoxedNumber { + return MaximumValidation1BoxedNumber(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: String, configuration: SchemaConfiguration?): MaximumValidation1BoxedString { + return MaximumValidation1BoxedString(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: List<*>, configuration: SchemaConfiguration?): MaximumValidation1BoxedList { + return MaximumValidation1BoxedList(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: Map<*, *>, configuration: SchemaConfiguration?): MaximumValidation1BoxedMap { + return MaximumValidation1BoxedMap(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: Any?, configuration: SchemaConfiguration?): MaximumValidation1Boxed { + if (arg == null) { + return validateAndBox(null, configuration) + } else if (arg is Boolean) { + return validateAndBox(arg, configuration) + } else if (arg is String) { + return validateAndBox(arg, configuration) + } else if (arg is Number) { + return validateAndBox(arg, configuration) + } else if (arg is List<*>) { + return validateAndBox(arg, configuration) + } else if (arg is Map<*, *>) { + return validateAndBox(arg, configuration) + } + throw ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema") + } + } +} diff --git a/samples/client/3_1_0_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/schemas/MaximumValidationWithUnsignedInteger.kt b/samples/client/3_1_0_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/schemas/MaximumValidationWithUnsignedInteger.kt new file mode 100644 index 00000000000..49da0ee99a0 --- /dev/null +++ b/samples/client/3_1_0_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/schemas/MaximumValidationWithUnsignedInteger.kt @@ -0,0 +1,308 @@ +package org.openapijsonschematools.client.components.schemas +import java.time.LocalDate +import java.time.ZonedDateTime +import java.util.UUID +import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags +import org.openapijsonschematools.client.configurations.SchemaConfiguration +import org.openapijsonschematools.client.exceptions.InvalidAdditionalPropertyException +import org.openapijsonschematools.client.exceptions.UnsetPropertyException +import org.openapijsonschematools.client.exceptions.ValidationException +import org.openapijsonschematools.client.schemas.UnsetAddPropsSetter +import org.openapijsonschematools.client.schemas.validation.BooleanSchemaValidator +import org.openapijsonschematools.client.schemas.validation.FrozenList +import org.openapijsonschematools.client.schemas.validation.FrozenMap +import org.openapijsonschematools.client.schemas.validation.JsonSchema +import org.openapijsonschematools.client.schemas.validation.JsonSchemaInfo +import org.openapijsonschematools.client.schemas.validation.ListSchemaValidator +import org.openapijsonschematools.client.schemas.validation.MapSchemaValidator +import org.openapijsonschematools.client.schemas.validation.NullSchemaValidator +import org.openapijsonschematools.client.schemas.validation.NumberSchemaValidator +import org.openapijsonschematools.client.schemas.validation.PathToSchemasMap +import org.openapijsonschematools.client.schemas.validation.StringSchemaValidator +import org.openapijsonschematools.client.schemas.validation.ValidationMetadata + +class MaximumValidationWithUnsignedInteger { + // nest classes so all schemas and input/output classes can be public + + + sealed interface MaximumValidationWithUnsignedInteger1Boxed { + fun getData(): Any? + } + + data class MaximumValidationWithUnsignedInteger1BoxedVoid(val data: Nothing?) : MaximumValidationWithUnsignedInteger1Boxed { + override fun getData(): Any? { + return data + } + } + + data class MaximumValidationWithUnsignedInteger1BoxedBoolean(val data: Boolean): MaximumValidationWithUnsignedInteger1Boxed { + override fun getData(): Any? { + return data + } + } + + data class MaximumValidationWithUnsignedInteger1BoxedNumber(val data: Number) : MaximumValidationWithUnsignedInteger1Boxed { + override fun getData(): Any? { + return data + } + } + + data class MaximumValidationWithUnsignedInteger1BoxedString(val data: String) : MaximumValidationWithUnsignedInteger1Boxed { + override fun getData(): Any? { + return data + } + } + + data class MaximumValidationWithUnsignedInteger1BoxedList(val data: FrozenList) : MaximumValidationWithUnsignedInteger1Boxed { + override fun getData(): Any? { + return data + } + } + + data class MaximumValidationWithUnsignedInteger1BoxedMap(val data: FrozenMap) : MaximumValidationWithUnsignedInteger1Boxed { + override fun getData(): Any? { + return data + } + } + + + class MaximumValidationWithUnsignedInteger1 private constructor(): JsonSchema( + JsonSchemaInfo() + .maximum(300) + ), NullSchemaValidator, BooleanSchemaValidator, NumberSchemaValidator, StringSchemaValidator, ListSchemaValidator, MaximumValidationWithUnsignedInteger1BoxedList>, MapSchemaValidator, MaximumValidationWithUnsignedInteger1BoxedMap> { + /* + NOTE: This class is auto generated by OpenAPI JSON Schema Generator. + Ref: https://github.com/openapi-json-schema-tools/openapi-json-schema-generator + + Do not edit the class manually. + */ + + companion object { + @Volatile + private var instance: MaximumValidationWithUnsignedInteger1? = null + + fun getInstance() = + instance ?: synchronized(this) { + instance ?: MaximumValidationWithUnsignedInteger1().also { instance = it } + } + } + + @Throws(ValidationException::class) + override fun validate(arg: Nothing?, configuration: SchemaConfiguration?): Nothing? { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validatedPathToSchemas = PathToSchemasMap() + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, LinkedHashSet()) + getPathToSchemas(this, castArg, validationMetadata, pathSet) + return castArg + } + + @Throws(ValidationException::class) + override fun validate(arg: Boolean, configuration: SchemaConfiguration?): Boolean { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validatedPathToSchemas = PathToSchemasMap() + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, LinkedHashSet()) + getPathToSchemas(this, castArg, validationMetadata, pathSet) + return castArg + } + + @Throws(ValidationException::class) + override fun validate(arg: Number, configuration: SchemaConfiguration?): Number { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validatedPathToSchemas = PathToSchemasMap() + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, LinkedHashSet()) + getPathToSchemas(this, castArg, validationMetadata, pathSet) + return castArg + } + + @Throws(ValidationException::class) + fun validate(arg: Int, configuration: SchemaConfiguration?): Int { + return validate(arg as Number, configuration) as Int + } + + @Throws(ValidationException::class) + fun validate(arg: Long, configuration: SchemaConfiguration?): Long { + return validate(arg as Number, configuration) as Long + } + + @Throws(ValidationException::class) + fun validate(arg: Float, configuration: SchemaConfiguration?): Float { + return validate(arg as Number, configuration) as Float + } + + @Throws(ValidationException::class) + fun validate(arg: Double, configuration: SchemaConfiguration?): Double { + return validate(arg as Number, configuration) as Double + } + + @Throws(ValidationException::class) + override fun validate(arg: String, configuration: SchemaConfiguration?): String { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validatedPathToSchemas = PathToSchemasMap() + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, LinkedHashSet()) + getPathToSchemas(this, castArg, validationMetadata, pathSet) + return castArg + } + + @Throws(ValidationException::class) + fun validate(arg: LocalDate, configuration: SchemaConfiguration?): String { + return validate(arg.toString(), configuration) + } + + @Throws(ValidationException::class) + fun validate(arg: ZonedDateTime, configuration: SchemaConfiguration?): String { + return validate(arg.toString(), configuration) + } + + @Throws(ValidationException::class) + fun validate(arg: UUID, configuration: SchemaConfiguration?): String { + return validate(arg.toString(), configuration) + } + + override fun getNewInstance(arg: List<*>, pathToItem: List, pathToSchemas: PathToSchemasMap): FrozenList { + val items: MutableList = ArrayList() + var i: Int = 0 + for (item: Any? in arg) { + val itemPathToItem = pathToItem + i + val schemas: LinkedHashMap, Nothing?>? = pathToSchemas.get(itemPathToItem) + if (schemas == null) { + throw RuntimeException("Validation result is invalid, schemas must exist for a pathToItem") + } + val itemSchema: JsonSchema<*> = schemas.entries.iterator().next().key + val itemInstance: Any? = itemSchema.getNewInstance(item, itemPathToItem, pathToSchemas) + items.add(itemInstance) + i += 1 + } + val newInstanceItems: FrozenList = FrozenList(items) + return newInstanceItems + } + + @Throws(ValidationException::class) + override fun validate(arg: List<*>, configuration: SchemaConfiguration?): FrozenList { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, PathToSchemasMap(), LinkedHashSet()) + val pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet) + return getNewInstance(castArg, validationMetadata.pathToItem, pathToSchemasMap) + } + + override fun getNewInstance(arg: Map<*, *>, pathToItem: List, pathToSchemas: PathToSchemasMap): FrozenMap { + val properties: LinkedHashMap = LinkedHashMap() + for((propertyName, value) in arg) { + if (!(propertyName is String)) { + throw RuntimeException("Invalid non-string key value") + } + val propertyPathToItem: List = pathToItem + propertyName + val schemas: LinkedHashMap, Nothing?>? = pathToSchemas.get(propertyPathToItem) + if (schemas == null) { + throw RuntimeException("Validation result is invalid, schemas must exist for a pathToItem") + } + val propertySchema: JsonSchema<*> = schemas.entries.iterator().next().key + val propertyInstance: Any? = propertySchema.getNewInstance(value, propertyPathToItem, pathToSchemas) + properties[propertyName] = propertyInstance + } + val castProperties: FrozenMap = FrozenMap(properties) + return castProperties + } + + @Throws(ValidationException::class) + override fun validate(arg: Map<*, *>, configuration: SchemaConfiguration?): FrozenMap { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validatedPathToSchemas = PathToSchemasMap() + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, LinkedHashSet()) + val pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet) + return getNewInstance(castArg, validationMetadata.pathToItem, pathToSchemasMap) + } + + @Throws(ValidationException::class) + override fun validate(arg: Any?, configuration: SchemaConfiguration?): Any? { + if (arg == null) { + return validate(null, configuration) + } else if (arg is Boolean) { + return validate(arg, configuration) + } else if (arg is Number) { + return validate(arg, configuration) + } else if (arg is String) { + return validate(arg, configuration) + } else if (arg is List<*>) { + return validate(arg, configuration) + } else if (arg is Map<*, *>) { + return validate(arg, configuration) + } + throw ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema") + } + override fun getNewInstance(arg: Any?, pathToItem: List, pathToSchemas: PathToSchemasMap): Any? { + if (arg == null) { + return getNewInstance( null, pathToItem, pathToSchemas) + } else if (arg is Boolean) { + return getNewInstance(arg, pathToItem, pathToSchemas) + } else if (arg is Number) { + return getNewInstance(arg, pathToItem, pathToSchemas) + } else if (arg is String) { + return getNewInstance(arg, pathToItem, pathToSchemas) + } else if (arg is List<*>) { + return getNewInstance(arg, pathToItem, pathToSchemas) + } else if (arg is Map<*, *>) { + return getNewInstance(arg, pathToItem, pathToSchemas) + } + throw RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema") + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: Nothing?, configuration: SchemaConfiguration?): MaximumValidationWithUnsignedInteger1BoxedVoid { + return MaximumValidationWithUnsignedInteger1BoxedVoid(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: Boolean, configuration: SchemaConfiguration?): MaximumValidationWithUnsignedInteger1BoxedBoolean { + return MaximumValidationWithUnsignedInteger1BoxedBoolean(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: Number, configuration: SchemaConfiguration?): MaximumValidationWithUnsignedInteger1BoxedNumber { + return MaximumValidationWithUnsignedInteger1BoxedNumber(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: String, configuration: SchemaConfiguration?): MaximumValidationWithUnsignedInteger1BoxedString { + return MaximumValidationWithUnsignedInteger1BoxedString(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: List<*>, configuration: SchemaConfiguration?): MaximumValidationWithUnsignedInteger1BoxedList { + return MaximumValidationWithUnsignedInteger1BoxedList(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: Map<*, *>, configuration: SchemaConfiguration?): MaximumValidationWithUnsignedInteger1BoxedMap { + return MaximumValidationWithUnsignedInteger1BoxedMap(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: Any?, configuration: SchemaConfiguration?): MaximumValidationWithUnsignedInteger1Boxed { + if (arg == null) { + return validateAndBox(null, configuration) + } else if (arg is Boolean) { + return validateAndBox(arg, configuration) + } else if (arg is String) { + return validateAndBox(arg, configuration) + } else if (arg is Number) { + return validateAndBox(arg, configuration) + } else if (arg is List<*>) { + return validateAndBox(arg, configuration) + } else if (arg is Map<*, *>) { + return validateAndBox(arg, configuration) + } + throw ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema") + } + } +} diff --git a/samples/client/3_1_0_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/schemas/MaxitemsValidation.kt b/samples/client/3_1_0_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/schemas/MaxitemsValidation.kt new file mode 100644 index 00000000000..1f763f7719f --- /dev/null +++ b/samples/client/3_1_0_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/schemas/MaxitemsValidation.kt @@ -0,0 +1,308 @@ +package org.openapijsonschematools.client.components.schemas +import java.time.LocalDate +import java.time.ZonedDateTime +import java.util.UUID +import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags +import org.openapijsonschematools.client.configurations.SchemaConfiguration +import org.openapijsonschematools.client.exceptions.InvalidAdditionalPropertyException +import org.openapijsonschematools.client.exceptions.UnsetPropertyException +import org.openapijsonschematools.client.exceptions.ValidationException +import org.openapijsonschematools.client.schemas.UnsetAddPropsSetter +import org.openapijsonschematools.client.schemas.validation.BooleanSchemaValidator +import org.openapijsonschematools.client.schemas.validation.FrozenList +import org.openapijsonschematools.client.schemas.validation.FrozenMap +import org.openapijsonschematools.client.schemas.validation.JsonSchema +import org.openapijsonschematools.client.schemas.validation.JsonSchemaInfo +import org.openapijsonschematools.client.schemas.validation.ListSchemaValidator +import org.openapijsonschematools.client.schemas.validation.MapSchemaValidator +import org.openapijsonschematools.client.schemas.validation.NullSchemaValidator +import org.openapijsonschematools.client.schemas.validation.NumberSchemaValidator +import org.openapijsonschematools.client.schemas.validation.PathToSchemasMap +import org.openapijsonschematools.client.schemas.validation.StringSchemaValidator +import org.openapijsonschematools.client.schemas.validation.ValidationMetadata + +class MaxitemsValidation { + // nest classes so all schemas and input/output classes can be public + + + sealed interface MaxitemsValidation1Boxed { + fun getData(): Any? + } + + data class MaxitemsValidation1BoxedVoid(val data: Nothing?) : MaxitemsValidation1Boxed { + override fun getData(): Any? { + return data + } + } + + data class MaxitemsValidation1BoxedBoolean(val data: Boolean): MaxitemsValidation1Boxed { + override fun getData(): Any? { + return data + } + } + + data class MaxitemsValidation1BoxedNumber(val data: Number) : MaxitemsValidation1Boxed { + override fun getData(): Any? { + return data + } + } + + data class MaxitemsValidation1BoxedString(val data: String) : MaxitemsValidation1Boxed { + override fun getData(): Any? { + return data + } + } + + data class MaxitemsValidation1BoxedList(val data: FrozenList) : MaxitemsValidation1Boxed { + override fun getData(): Any? { + return data + } + } + + data class MaxitemsValidation1BoxedMap(val data: FrozenMap) : MaxitemsValidation1Boxed { + override fun getData(): Any? { + return data + } + } + + + class MaxitemsValidation1 private constructor(): JsonSchema( + JsonSchemaInfo() + .maxItems(2) + ), NullSchemaValidator, BooleanSchemaValidator, NumberSchemaValidator, StringSchemaValidator, ListSchemaValidator, MaxitemsValidation1BoxedList>, MapSchemaValidator, MaxitemsValidation1BoxedMap> { + /* + NOTE: This class is auto generated by OpenAPI JSON Schema Generator. + Ref: https://github.com/openapi-json-schema-tools/openapi-json-schema-generator + + Do not edit the class manually. + */ + + companion object { + @Volatile + private var instance: MaxitemsValidation1? = null + + fun getInstance() = + instance ?: synchronized(this) { + instance ?: MaxitemsValidation1().also { instance = it } + } + } + + @Throws(ValidationException::class) + override fun validate(arg: Nothing?, configuration: SchemaConfiguration?): Nothing? { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validatedPathToSchemas = PathToSchemasMap() + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, LinkedHashSet()) + getPathToSchemas(this, castArg, validationMetadata, pathSet) + return castArg + } + + @Throws(ValidationException::class) + override fun validate(arg: Boolean, configuration: SchemaConfiguration?): Boolean { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validatedPathToSchemas = PathToSchemasMap() + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, LinkedHashSet()) + getPathToSchemas(this, castArg, validationMetadata, pathSet) + return castArg + } + + @Throws(ValidationException::class) + override fun validate(arg: Number, configuration: SchemaConfiguration?): Number { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validatedPathToSchemas = PathToSchemasMap() + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, LinkedHashSet()) + getPathToSchemas(this, castArg, validationMetadata, pathSet) + return castArg + } + + @Throws(ValidationException::class) + fun validate(arg: Int, configuration: SchemaConfiguration?): Int { + return validate(arg as Number, configuration) as Int + } + + @Throws(ValidationException::class) + fun validate(arg: Long, configuration: SchemaConfiguration?): Long { + return validate(arg as Number, configuration) as Long + } + + @Throws(ValidationException::class) + fun validate(arg: Float, configuration: SchemaConfiguration?): Float { + return validate(arg as Number, configuration) as Float + } + + @Throws(ValidationException::class) + fun validate(arg: Double, configuration: SchemaConfiguration?): Double { + return validate(arg as Number, configuration) as Double + } + + @Throws(ValidationException::class) + override fun validate(arg: String, configuration: SchemaConfiguration?): String { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validatedPathToSchemas = PathToSchemasMap() + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, LinkedHashSet()) + getPathToSchemas(this, castArg, validationMetadata, pathSet) + return castArg + } + + @Throws(ValidationException::class) + fun validate(arg: LocalDate, configuration: SchemaConfiguration?): String { + return validate(arg.toString(), configuration) + } + + @Throws(ValidationException::class) + fun validate(arg: ZonedDateTime, configuration: SchemaConfiguration?): String { + return validate(arg.toString(), configuration) + } + + @Throws(ValidationException::class) + fun validate(arg: UUID, configuration: SchemaConfiguration?): String { + return validate(arg.toString(), configuration) + } + + override fun getNewInstance(arg: List<*>, pathToItem: List, pathToSchemas: PathToSchemasMap): FrozenList { + val items: MutableList = ArrayList() + var i: Int = 0 + for (item: Any? in arg) { + val itemPathToItem = pathToItem + i + val schemas: LinkedHashMap, Nothing?>? = pathToSchemas.get(itemPathToItem) + if (schemas == null) { + throw RuntimeException("Validation result is invalid, schemas must exist for a pathToItem") + } + val itemSchema: JsonSchema<*> = schemas.entries.iterator().next().key + val itemInstance: Any? = itemSchema.getNewInstance(item, itemPathToItem, pathToSchemas) + items.add(itemInstance) + i += 1 + } + val newInstanceItems: FrozenList = FrozenList(items) + return newInstanceItems + } + + @Throws(ValidationException::class) + override fun validate(arg: List<*>, configuration: SchemaConfiguration?): FrozenList { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, PathToSchemasMap(), LinkedHashSet()) + val pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet) + return getNewInstance(castArg, validationMetadata.pathToItem, pathToSchemasMap) + } + + override fun getNewInstance(arg: Map<*, *>, pathToItem: List, pathToSchemas: PathToSchemasMap): FrozenMap { + val properties: LinkedHashMap = LinkedHashMap() + for((propertyName, value) in arg) { + if (!(propertyName is String)) { + throw RuntimeException("Invalid non-string key value") + } + val propertyPathToItem: List = pathToItem + propertyName + val schemas: LinkedHashMap, Nothing?>? = pathToSchemas.get(propertyPathToItem) + if (schemas == null) { + throw RuntimeException("Validation result is invalid, schemas must exist for a pathToItem") + } + val propertySchema: JsonSchema<*> = schemas.entries.iterator().next().key + val propertyInstance: Any? = propertySchema.getNewInstance(value, propertyPathToItem, pathToSchemas) + properties[propertyName] = propertyInstance + } + val castProperties: FrozenMap = FrozenMap(properties) + return castProperties + } + + @Throws(ValidationException::class) + override fun validate(arg: Map<*, *>, configuration: SchemaConfiguration?): FrozenMap { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validatedPathToSchemas = PathToSchemasMap() + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, LinkedHashSet()) + val pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet) + return getNewInstance(castArg, validationMetadata.pathToItem, pathToSchemasMap) + } + + @Throws(ValidationException::class) + override fun validate(arg: Any?, configuration: SchemaConfiguration?): Any? { + if (arg == null) { + return validate(null, configuration) + } else if (arg is Boolean) { + return validate(arg, configuration) + } else if (arg is Number) { + return validate(arg, configuration) + } else if (arg is String) { + return validate(arg, configuration) + } else if (arg is List<*>) { + return validate(arg, configuration) + } else if (arg is Map<*, *>) { + return validate(arg, configuration) + } + throw ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema") + } + override fun getNewInstance(arg: Any?, pathToItem: List, pathToSchemas: PathToSchemasMap): Any? { + if (arg == null) { + return getNewInstance( null, pathToItem, pathToSchemas) + } else if (arg is Boolean) { + return getNewInstance(arg, pathToItem, pathToSchemas) + } else if (arg is Number) { + return getNewInstance(arg, pathToItem, pathToSchemas) + } else if (arg is String) { + return getNewInstance(arg, pathToItem, pathToSchemas) + } else if (arg is List<*>) { + return getNewInstance(arg, pathToItem, pathToSchemas) + } else if (arg is Map<*, *>) { + return getNewInstance(arg, pathToItem, pathToSchemas) + } + throw RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema") + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: Nothing?, configuration: SchemaConfiguration?): MaxitemsValidation1BoxedVoid { + return MaxitemsValidation1BoxedVoid(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: Boolean, configuration: SchemaConfiguration?): MaxitemsValidation1BoxedBoolean { + return MaxitemsValidation1BoxedBoolean(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: Number, configuration: SchemaConfiguration?): MaxitemsValidation1BoxedNumber { + return MaxitemsValidation1BoxedNumber(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: String, configuration: SchemaConfiguration?): MaxitemsValidation1BoxedString { + return MaxitemsValidation1BoxedString(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: List<*>, configuration: SchemaConfiguration?): MaxitemsValidation1BoxedList { + return MaxitemsValidation1BoxedList(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: Map<*, *>, configuration: SchemaConfiguration?): MaxitemsValidation1BoxedMap { + return MaxitemsValidation1BoxedMap(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: Any?, configuration: SchemaConfiguration?): MaxitemsValidation1Boxed { + if (arg == null) { + return validateAndBox(null, configuration) + } else if (arg is Boolean) { + return validateAndBox(arg, configuration) + } else if (arg is String) { + return validateAndBox(arg, configuration) + } else if (arg is Number) { + return validateAndBox(arg, configuration) + } else if (arg is List<*>) { + return validateAndBox(arg, configuration) + } else if (arg is Map<*, *>) { + return validateAndBox(arg, configuration) + } + throw ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema") + } + } +} diff --git a/samples/client/3_1_0_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/schemas/MaxlengthValidation.kt b/samples/client/3_1_0_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/schemas/MaxlengthValidation.kt new file mode 100644 index 00000000000..ba1e070bc6f --- /dev/null +++ b/samples/client/3_1_0_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/schemas/MaxlengthValidation.kt @@ -0,0 +1,308 @@ +package org.openapijsonschematools.client.components.schemas +import java.time.LocalDate +import java.time.ZonedDateTime +import java.util.UUID +import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags +import org.openapijsonschematools.client.configurations.SchemaConfiguration +import org.openapijsonschematools.client.exceptions.InvalidAdditionalPropertyException +import org.openapijsonschematools.client.exceptions.UnsetPropertyException +import org.openapijsonschematools.client.exceptions.ValidationException +import org.openapijsonschematools.client.schemas.UnsetAddPropsSetter +import org.openapijsonschematools.client.schemas.validation.BooleanSchemaValidator +import org.openapijsonschematools.client.schemas.validation.FrozenList +import org.openapijsonschematools.client.schemas.validation.FrozenMap +import org.openapijsonschematools.client.schemas.validation.JsonSchema +import org.openapijsonschematools.client.schemas.validation.JsonSchemaInfo +import org.openapijsonschematools.client.schemas.validation.ListSchemaValidator +import org.openapijsonschematools.client.schemas.validation.MapSchemaValidator +import org.openapijsonschematools.client.schemas.validation.NullSchemaValidator +import org.openapijsonschematools.client.schemas.validation.NumberSchemaValidator +import org.openapijsonschematools.client.schemas.validation.PathToSchemasMap +import org.openapijsonschematools.client.schemas.validation.StringSchemaValidator +import org.openapijsonschematools.client.schemas.validation.ValidationMetadata + +class MaxlengthValidation { + // nest classes so all schemas and input/output classes can be public + + + sealed interface MaxlengthValidation1Boxed { + fun getData(): Any? + } + + data class MaxlengthValidation1BoxedVoid(val data: Nothing?) : MaxlengthValidation1Boxed { + override fun getData(): Any? { + return data + } + } + + data class MaxlengthValidation1BoxedBoolean(val data: Boolean): MaxlengthValidation1Boxed { + override fun getData(): Any? { + return data + } + } + + data class MaxlengthValidation1BoxedNumber(val data: Number) : MaxlengthValidation1Boxed { + override fun getData(): Any? { + return data + } + } + + data class MaxlengthValidation1BoxedString(val data: String) : MaxlengthValidation1Boxed { + override fun getData(): Any? { + return data + } + } + + data class MaxlengthValidation1BoxedList(val data: FrozenList) : MaxlengthValidation1Boxed { + override fun getData(): Any? { + return data + } + } + + data class MaxlengthValidation1BoxedMap(val data: FrozenMap) : MaxlengthValidation1Boxed { + override fun getData(): Any? { + return data + } + } + + + class MaxlengthValidation1 private constructor(): JsonSchema( + JsonSchemaInfo() + .maxLength(2) + ), NullSchemaValidator, BooleanSchemaValidator, NumberSchemaValidator, StringSchemaValidator, ListSchemaValidator, MaxlengthValidation1BoxedList>, MapSchemaValidator, MaxlengthValidation1BoxedMap> { + /* + NOTE: This class is auto generated by OpenAPI JSON Schema Generator. + Ref: https://github.com/openapi-json-schema-tools/openapi-json-schema-generator + + Do not edit the class manually. + */ + + companion object { + @Volatile + private var instance: MaxlengthValidation1? = null + + fun getInstance() = + instance ?: synchronized(this) { + instance ?: MaxlengthValidation1().also { instance = it } + } + } + + @Throws(ValidationException::class) + override fun validate(arg: Nothing?, configuration: SchemaConfiguration?): Nothing? { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validatedPathToSchemas = PathToSchemasMap() + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, LinkedHashSet()) + getPathToSchemas(this, castArg, validationMetadata, pathSet) + return castArg + } + + @Throws(ValidationException::class) + override fun validate(arg: Boolean, configuration: SchemaConfiguration?): Boolean { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validatedPathToSchemas = PathToSchemasMap() + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, LinkedHashSet()) + getPathToSchemas(this, castArg, validationMetadata, pathSet) + return castArg + } + + @Throws(ValidationException::class) + override fun validate(arg: Number, configuration: SchemaConfiguration?): Number { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validatedPathToSchemas = PathToSchemasMap() + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, LinkedHashSet()) + getPathToSchemas(this, castArg, validationMetadata, pathSet) + return castArg + } + + @Throws(ValidationException::class) + fun validate(arg: Int, configuration: SchemaConfiguration?): Int { + return validate(arg as Number, configuration) as Int + } + + @Throws(ValidationException::class) + fun validate(arg: Long, configuration: SchemaConfiguration?): Long { + return validate(arg as Number, configuration) as Long + } + + @Throws(ValidationException::class) + fun validate(arg: Float, configuration: SchemaConfiguration?): Float { + return validate(arg as Number, configuration) as Float + } + + @Throws(ValidationException::class) + fun validate(arg: Double, configuration: SchemaConfiguration?): Double { + return validate(arg as Number, configuration) as Double + } + + @Throws(ValidationException::class) + override fun validate(arg: String, configuration: SchemaConfiguration?): String { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validatedPathToSchemas = PathToSchemasMap() + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, LinkedHashSet()) + getPathToSchemas(this, castArg, validationMetadata, pathSet) + return castArg + } + + @Throws(ValidationException::class) + fun validate(arg: LocalDate, configuration: SchemaConfiguration?): String { + return validate(arg.toString(), configuration) + } + + @Throws(ValidationException::class) + fun validate(arg: ZonedDateTime, configuration: SchemaConfiguration?): String { + return validate(arg.toString(), configuration) + } + + @Throws(ValidationException::class) + fun validate(arg: UUID, configuration: SchemaConfiguration?): String { + return validate(arg.toString(), configuration) + } + + override fun getNewInstance(arg: List<*>, pathToItem: List, pathToSchemas: PathToSchemasMap): FrozenList { + val items: MutableList = ArrayList() + var i: Int = 0 + for (item: Any? in arg) { + val itemPathToItem = pathToItem + i + val schemas: LinkedHashMap, Nothing?>? = pathToSchemas.get(itemPathToItem) + if (schemas == null) { + throw RuntimeException("Validation result is invalid, schemas must exist for a pathToItem") + } + val itemSchema: JsonSchema<*> = schemas.entries.iterator().next().key + val itemInstance: Any? = itemSchema.getNewInstance(item, itemPathToItem, pathToSchemas) + items.add(itemInstance) + i += 1 + } + val newInstanceItems: FrozenList = FrozenList(items) + return newInstanceItems + } + + @Throws(ValidationException::class) + override fun validate(arg: List<*>, configuration: SchemaConfiguration?): FrozenList { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, PathToSchemasMap(), LinkedHashSet()) + val pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet) + return getNewInstance(castArg, validationMetadata.pathToItem, pathToSchemasMap) + } + + override fun getNewInstance(arg: Map<*, *>, pathToItem: List, pathToSchemas: PathToSchemasMap): FrozenMap { + val properties: LinkedHashMap = LinkedHashMap() + for((propertyName, value) in arg) { + if (!(propertyName is String)) { + throw RuntimeException("Invalid non-string key value") + } + val propertyPathToItem: List = pathToItem + propertyName + val schemas: LinkedHashMap, Nothing?>? = pathToSchemas.get(propertyPathToItem) + if (schemas == null) { + throw RuntimeException("Validation result is invalid, schemas must exist for a pathToItem") + } + val propertySchema: JsonSchema<*> = schemas.entries.iterator().next().key + val propertyInstance: Any? = propertySchema.getNewInstance(value, propertyPathToItem, pathToSchemas) + properties[propertyName] = propertyInstance + } + val castProperties: FrozenMap = FrozenMap(properties) + return castProperties + } + + @Throws(ValidationException::class) + override fun validate(arg: Map<*, *>, configuration: SchemaConfiguration?): FrozenMap { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validatedPathToSchemas = PathToSchemasMap() + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, LinkedHashSet()) + val pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet) + return getNewInstance(castArg, validationMetadata.pathToItem, pathToSchemasMap) + } + + @Throws(ValidationException::class) + override fun validate(arg: Any?, configuration: SchemaConfiguration?): Any? { + if (arg == null) { + return validate(null, configuration) + } else if (arg is Boolean) { + return validate(arg, configuration) + } else if (arg is Number) { + return validate(arg, configuration) + } else if (arg is String) { + return validate(arg, configuration) + } else if (arg is List<*>) { + return validate(arg, configuration) + } else if (arg is Map<*, *>) { + return validate(arg, configuration) + } + throw ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema") + } + override fun getNewInstance(arg: Any?, pathToItem: List, pathToSchemas: PathToSchemasMap): Any? { + if (arg == null) { + return getNewInstance( null, pathToItem, pathToSchemas) + } else if (arg is Boolean) { + return getNewInstance(arg, pathToItem, pathToSchemas) + } else if (arg is Number) { + return getNewInstance(arg, pathToItem, pathToSchemas) + } else if (arg is String) { + return getNewInstance(arg, pathToItem, pathToSchemas) + } else if (arg is List<*>) { + return getNewInstance(arg, pathToItem, pathToSchemas) + } else if (arg is Map<*, *>) { + return getNewInstance(arg, pathToItem, pathToSchemas) + } + throw RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema") + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: Nothing?, configuration: SchemaConfiguration?): MaxlengthValidation1BoxedVoid { + return MaxlengthValidation1BoxedVoid(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: Boolean, configuration: SchemaConfiguration?): MaxlengthValidation1BoxedBoolean { + return MaxlengthValidation1BoxedBoolean(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: Number, configuration: SchemaConfiguration?): MaxlengthValidation1BoxedNumber { + return MaxlengthValidation1BoxedNumber(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: String, configuration: SchemaConfiguration?): MaxlengthValidation1BoxedString { + return MaxlengthValidation1BoxedString(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: List<*>, configuration: SchemaConfiguration?): MaxlengthValidation1BoxedList { + return MaxlengthValidation1BoxedList(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: Map<*, *>, configuration: SchemaConfiguration?): MaxlengthValidation1BoxedMap { + return MaxlengthValidation1BoxedMap(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: Any?, configuration: SchemaConfiguration?): MaxlengthValidation1Boxed { + if (arg == null) { + return validateAndBox(null, configuration) + } else if (arg is Boolean) { + return validateAndBox(arg, configuration) + } else if (arg is String) { + return validateAndBox(arg, configuration) + } else if (arg is Number) { + return validateAndBox(arg, configuration) + } else if (arg is List<*>) { + return validateAndBox(arg, configuration) + } else if (arg is Map<*, *>) { + return validateAndBox(arg, configuration) + } + throw ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema") + } + } +} diff --git a/samples/client/3_1_0_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/schemas/Maxproperties0MeansTheObjectIsEmpty.kt b/samples/client/3_1_0_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/schemas/Maxproperties0MeansTheObjectIsEmpty.kt new file mode 100644 index 00000000000..62b6deb1e2e --- /dev/null +++ b/samples/client/3_1_0_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/schemas/Maxproperties0MeansTheObjectIsEmpty.kt @@ -0,0 +1,308 @@ +package org.openapijsonschematools.client.components.schemas +import java.time.LocalDate +import java.time.ZonedDateTime +import java.util.UUID +import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags +import org.openapijsonschematools.client.configurations.SchemaConfiguration +import org.openapijsonschematools.client.exceptions.InvalidAdditionalPropertyException +import org.openapijsonschematools.client.exceptions.UnsetPropertyException +import org.openapijsonschematools.client.exceptions.ValidationException +import org.openapijsonschematools.client.schemas.UnsetAddPropsSetter +import org.openapijsonschematools.client.schemas.validation.BooleanSchemaValidator +import org.openapijsonschematools.client.schemas.validation.FrozenList +import org.openapijsonschematools.client.schemas.validation.FrozenMap +import org.openapijsonschematools.client.schemas.validation.JsonSchema +import org.openapijsonschematools.client.schemas.validation.JsonSchemaInfo +import org.openapijsonschematools.client.schemas.validation.ListSchemaValidator +import org.openapijsonschematools.client.schemas.validation.MapSchemaValidator +import org.openapijsonschematools.client.schemas.validation.NullSchemaValidator +import org.openapijsonschematools.client.schemas.validation.NumberSchemaValidator +import org.openapijsonschematools.client.schemas.validation.PathToSchemasMap +import org.openapijsonschematools.client.schemas.validation.StringSchemaValidator +import org.openapijsonschematools.client.schemas.validation.ValidationMetadata + +class Maxproperties0MeansTheObjectIsEmpty { + // nest classes so all schemas and input/output classes can be public + + + sealed interface Maxproperties0MeansTheObjectIsEmpty1Boxed { + fun getData(): Any? + } + + data class Maxproperties0MeansTheObjectIsEmpty1BoxedVoid(val data: Nothing?) : Maxproperties0MeansTheObjectIsEmpty1Boxed { + override fun getData(): Any? { + return data + } + } + + data class Maxproperties0MeansTheObjectIsEmpty1BoxedBoolean(val data: Boolean): Maxproperties0MeansTheObjectIsEmpty1Boxed { + override fun getData(): Any? { + return data + } + } + + data class Maxproperties0MeansTheObjectIsEmpty1BoxedNumber(val data: Number) : Maxproperties0MeansTheObjectIsEmpty1Boxed { + override fun getData(): Any? { + return data + } + } + + data class Maxproperties0MeansTheObjectIsEmpty1BoxedString(val data: String) : Maxproperties0MeansTheObjectIsEmpty1Boxed { + override fun getData(): Any? { + return data + } + } + + data class Maxproperties0MeansTheObjectIsEmpty1BoxedList(val data: FrozenList) : Maxproperties0MeansTheObjectIsEmpty1Boxed { + override fun getData(): Any? { + return data + } + } + + data class Maxproperties0MeansTheObjectIsEmpty1BoxedMap(val data: FrozenMap) : Maxproperties0MeansTheObjectIsEmpty1Boxed { + override fun getData(): Any? { + return data + } + } + + + class Maxproperties0MeansTheObjectIsEmpty1 private constructor(): JsonSchema( + JsonSchemaInfo() + .maxProperties(0) + ), NullSchemaValidator, BooleanSchemaValidator, NumberSchemaValidator, StringSchemaValidator, ListSchemaValidator, Maxproperties0MeansTheObjectIsEmpty1BoxedList>, MapSchemaValidator, Maxproperties0MeansTheObjectIsEmpty1BoxedMap> { + /* + NOTE: This class is auto generated by OpenAPI JSON Schema Generator. + Ref: https://github.com/openapi-json-schema-tools/openapi-json-schema-generator + + Do not edit the class manually. + */ + + companion object { + @Volatile + private var instance: Maxproperties0MeansTheObjectIsEmpty1? = null + + fun getInstance() = + instance ?: synchronized(this) { + instance ?: Maxproperties0MeansTheObjectIsEmpty1().also { instance = it } + } + } + + @Throws(ValidationException::class) + override fun validate(arg: Nothing?, configuration: SchemaConfiguration?): Nothing? { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validatedPathToSchemas = PathToSchemasMap() + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, LinkedHashSet()) + getPathToSchemas(this, castArg, validationMetadata, pathSet) + return castArg + } + + @Throws(ValidationException::class) + override fun validate(arg: Boolean, configuration: SchemaConfiguration?): Boolean { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validatedPathToSchemas = PathToSchemasMap() + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, LinkedHashSet()) + getPathToSchemas(this, castArg, validationMetadata, pathSet) + return castArg + } + + @Throws(ValidationException::class) + override fun validate(arg: Number, configuration: SchemaConfiguration?): Number { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validatedPathToSchemas = PathToSchemasMap() + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, LinkedHashSet()) + getPathToSchemas(this, castArg, validationMetadata, pathSet) + return castArg + } + + @Throws(ValidationException::class) + fun validate(arg: Int, configuration: SchemaConfiguration?): Int { + return validate(arg as Number, configuration) as Int + } + + @Throws(ValidationException::class) + fun validate(arg: Long, configuration: SchemaConfiguration?): Long { + return validate(arg as Number, configuration) as Long + } + + @Throws(ValidationException::class) + fun validate(arg: Float, configuration: SchemaConfiguration?): Float { + return validate(arg as Number, configuration) as Float + } + + @Throws(ValidationException::class) + fun validate(arg: Double, configuration: SchemaConfiguration?): Double { + return validate(arg as Number, configuration) as Double + } + + @Throws(ValidationException::class) + override fun validate(arg: String, configuration: SchemaConfiguration?): String { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validatedPathToSchemas = PathToSchemasMap() + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, LinkedHashSet()) + getPathToSchemas(this, castArg, validationMetadata, pathSet) + return castArg + } + + @Throws(ValidationException::class) + fun validate(arg: LocalDate, configuration: SchemaConfiguration?): String { + return validate(arg.toString(), configuration) + } + + @Throws(ValidationException::class) + fun validate(arg: ZonedDateTime, configuration: SchemaConfiguration?): String { + return validate(arg.toString(), configuration) + } + + @Throws(ValidationException::class) + fun validate(arg: UUID, configuration: SchemaConfiguration?): String { + return validate(arg.toString(), configuration) + } + + override fun getNewInstance(arg: List<*>, pathToItem: List, pathToSchemas: PathToSchemasMap): FrozenList { + val items: MutableList = ArrayList() + var i: Int = 0 + for (item: Any? in arg) { + val itemPathToItem = pathToItem + i + val schemas: LinkedHashMap, Nothing?>? = pathToSchemas.get(itemPathToItem) + if (schemas == null) { + throw RuntimeException("Validation result is invalid, schemas must exist for a pathToItem") + } + val itemSchema: JsonSchema<*> = schemas.entries.iterator().next().key + val itemInstance: Any? = itemSchema.getNewInstance(item, itemPathToItem, pathToSchemas) + items.add(itemInstance) + i += 1 + } + val newInstanceItems: FrozenList = FrozenList(items) + return newInstanceItems + } + + @Throws(ValidationException::class) + override fun validate(arg: List<*>, configuration: SchemaConfiguration?): FrozenList { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, PathToSchemasMap(), LinkedHashSet()) + val pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet) + return getNewInstance(castArg, validationMetadata.pathToItem, pathToSchemasMap) + } + + override fun getNewInstance(arg: Map<*, *>, pathToItem: List, pathToSchemas: PathToSchemasMap): FrozenMap { + val properties: LinkedHashMap = LinkedHashMap() + for((propertyName, value) in arg) { + if (!(propertyName is String)) { + throw RuntimeException("Invalid non-string key value") + } + val propertyPathToItem: List = pathToItem + propertyName + val schemas: LinkedHashMap, Nothing?>? = pathToSchemas.get(propertyPathToItem) + if (schemas == null) { + throw RuntimeException("Validation result is invalid, schemas must exist for a pathToItem") + } + val propertySchema: JsonSchema<*> = schemas.entries.iterator().next().key + val propertyInstance: Any? = propertySchema.getNewInstance(value, propertyPathToItem, pathToSchemas) + properties[propertyName] = propertyInstance + } + val castProperties: FrozenMap = FrozenMap(properties) + return castProperties + } + + @Throws(ValidationException::class) + override fun validate(arg: Map<*, *>, configuration: SchemaConfiguration?): FrozenMap { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validatedPathToSchemas = PathToSchemasMap() + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, LinkedHashSet()) + val pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet) + return getNewInstance(castArg, validationMetadata.pathToItem, pathToSchemasMap) + } + + @Throws(ValidationException::class) + override fun validate(arg: Any?, configuration: SchemaConfiguration?): Any? { + if (arg == null) { + return validate(null, configuration) + } else if (arg is Boolean) { + return validate(arg, configuration) + } else if (arg is Number) { + return validate(arg, configuration) + } else if (arg is String) { + return validate(arg, configuration) + } else if (arg is List<*>) { + return validate(arg, configuration) + } else if (arg is Map<*, *>) { + return validate(arg, configuration) + } + throw ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema") + } + override fun getNewInstance(arg: Any?, pathToItem: List, pathToSchemas: PathToSchemasMap): Any? { + if (arg == null) { + return getNewInstance( null, pathToItem, pathToSchemas) + } else if (arg is Boolean) { + return getNewInstance(arg, pathToItem, pathToSchemas) + } else if (arg is Number) { + return getNewInstance(arg, pathToItem, pathToSchemas) + } else if (arg is String) { + return getNewInstance(arg, pathToItem, pathToSchemas) + } else if (arg is List<*>) { + return getNewInstance(arg, pathToItem, pathToSchemas) + } else if (arg is Map<*, *>) { + return getNewInstance(arg, pathToItem, pathToSchemas) + } + throw RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema") + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: Nothing?, configuration: SchemaConfiguration?): Maxproperties0MeansTheObjectIsEmpty1BoxedVoid { + return Maxproperties0MeansTheObjectIsEmpty1BoxedVoid(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: Boolean, configuration: SchemaConfiguration?): Maxproperties0MeansTheObjectIsEmpty1BoxedBoolean { + return Maxproperties0MeansTheObjectIsEmpty1BoxedBoolean(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: Number, configuration: SchemaConfiguration?): Maxproperties0MeansTheObjectIsEmpty1BoxedNumber { + return Maxproperties0MeansTheObjectIsEmpty1BoxedNumber(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: String, configuration: SchemaConfiguration?): Maxproperties0MeansTheObjectIsEmpty1BoxedString { + return Maxproperties0MeansTheObjectIsEmpty1BoxedString(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: List<*>, configuration: SchemaConfiguration?): Maxproperties0MeansTheObjectIsEmpty1BoxedList { + return Maxproperties0MeansTheObjectIsEmpty1BoxedList(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: Map<*, *>, configuration: SchemaConfiguration?): Maxproperties0MeansTheObjectIsEmpty1BoxedMap { + return Maxproperties0MeansTheObjectIsEmpty1BoxedMap(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: Any?, configuration: SchemaConfiguration?): Maxproperties0MeansTheObjectIsEmpty1Boxed { + if (arg == null) { + return validateAndBox(null, configuration) + } else if (arg is Boolean) { + return validateAndBox(arg, configuration) + } else if (arg is String) { + return validateAndBox(arg, configuration) + } else if (arg is Number) { + return validateAndBox(arg, configuration) + } else if (arg is List<*>) { + return validateAndBox(arg, configuration) + } else if (arg is Map<*, *>) { + return validateAndBox(arg, configuration) + } + throw ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema") + } + } +} diff --git a/samples/client/3_1_0_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/schemas/MaxpropertiesValidation.kt b/samples/client/3_1_0_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/schemas/MaxpropertiesValidation.kt new file mode 100644 index 00000000000..4605f17fd0e --- /dev/null +++ b/samples/client/3_1_0_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/schemas/MaxpropertiesValidation.kt @@ -0,0 +1,308 @@ +package org.openapijsonschematools.client.components.schemas +import java.time.LocalDate +import java.time.ZonedDateTime +import java.util.UUID +import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags +import org.openapijsonschematools.client.configurations.SchemaConfiguration +import org.openapijsonschematools.client.exceptions.InvalidAdditionalPropertyException +import org.openapijsonschematools.client.exceptions.UnsetPropertyException +import org.openapijsonschematools.client.exceptions.ValidationException +import org.openapijsonschematools.client.schemas.UnsetAddPropsSetter +import org.openapijsonschematools.client.schemas.validation.BooleanSchemaValidator +import org.openapijsonschematools.client.schemas.validation.FrozenList +import org.openapijsonschematools.client.schemas.validation.FrozenMap +import org.openapijsonschematools.client.schemas.validation.JsonSchema +import org.openapijsonschematools.client.schemas.validation.JsonSchemaInfo +import org.openapijsonschematools.client.schemas.validation.ListSchemaValidator +import org.openapijsonschematools.client.schemas.validation.MapSchemaValidator +import org.openapijsonschematools.client.schemas.validation.NullSchemaValidator +import org.openapijsonschematools.client.schemas.validation.NumberSchemaValidator +import org.openapijsonschematools.client.schemas.validation.PathToSchemasMap +import org.openapijsonschematools.client.schemas.validation.StringSchemaValidator +import org.openapijsonschematools.client.schemas.validation.ValidationMetadata + +class MaxpropertiesValidation { + // nest classes so all schemas and input/output classes can be public + + + sealed interface MaxpropertiesValidation1Boxed { + fun getData(): Any? + } + + data class MaxpropertiesValidation1BoxedVoid(val data: Nothing?) : MaxpropertiesValidation1Boxed { + override fun getData(): Any? { + return data + } + } + + data class MaxpropertiesValidation1BoxedBoolean(val data: Boolean): MaxpropertiesValidation1Boxed { + override fun getData(): Any? { + return data + } + } + + data class MaxpropertiesValidation1BoxedNumber(val data: Number) : MaxpropertiesValidation1Boxed { + override fun getData(): Any? { + return data + } + } + + data class MaxpropertiesValidation1BoxedString(val data: String) : MaxpropertiesValidation1Boxed { + override fun getData(): Any? { + return data + } + } + + data class MaxpropertiesValidation1BoxedList(val data: FrozenList) : MaxpropertiesValidation1Boxed { + override fun getData(): Any? { + return data + } + } + + data class MaxpropertiesValidation1BoxedMap(val data: FrozenMap) : MaxpropertiesValidation1Boxed { + override fun getData(): Any? { + return data + } + } + + + class MaxpropertiesValidation1 private constructor(): JsonSchema( + JsonSchemaInfo() + .maxProperties(2) + ), NullSchemaValidator, BooleanSchemaValidator, NumberSchemaValidator, StringSchemaValidator, ListSchemaValidator, MaxpropertiesValidation1BoxedList>, MapSchemaValidator, MaxpropertiesValidation1BoxedMap> { + /* + NOTE: This class is auto generated by OpenAPI JSON Schema Generator. + Ref: https://github.com/openapi-json-schema-tools/openapi-json-schema-generator + + Do not edit the class manually. + */ + + companion object { + @Volatile + private var instance: MaxpropertiesValidation1? = null + + fun getInstance() = + instance ?: synchronized(this) { + instance ?: MaxpropertiesValidation1().also { instance = it } + } + } + + @Throws(ValidationException::class) + override fun validate(arg: Nothing?, configuration: SchemaConfiguration?): Nothing? { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validatedPathToSchemas = PathToSchemasMap() + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, LinkedHashSet()) + getPathToSchemas(this, castArg, validationMetadata, pathSet) + return castArg + } + + @Throws(ValidationException::class) + override fun validate(arg: Boolean, configuration: SchemaConfiguration?): Boolean { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validatedPathToSchemas = PathToSchemasMap() + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, LinkedHashSet()) + getPathToSchemas(this, castArg, validationMetadata, pathSet) + return castArg + } + + @Throws(ValidationException::class) + override fun validate(arg: Number, configuration: SchemaConfiguration?): Number { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validatedPathToSchemas = PathToSchemasMap() + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, LinkedHashSet()) + getPathToSchemas(this, castArg, validationMetadata, pathSet) + return castArg + } + + @Throws(ValidationException::class) + fun validate(arg: Int, configuration: SchemaConfiguration?): Int { + return validate(arg as Number, configuration) as Int + } + + @Throws(ValidationException::class) + fun validate(arg: Long, configuration: SchemaConfiguration?): Long { + return validate(arg as Number, configuration) as Long + } + + @Throws(ValidationException::class) + fun validate(arg: Float, configuration: SchemaConfiguration?): Float { + return validate(arg as Number, configuration) as Float + } + + @Throws(ValidationException::class) + fun validate(arg: Double, configuration: SchemaConfiguration?): Double { + return validate(arg as Number, configuration) as Double + } + + @Throws(ValidationException::class) + override fun validate(arg: String, configuration: SchemaConfiguration?): String { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validatedPathToSchemas = PathToSchemasMap() + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, LinkedHashSet()) + getPathToSchemas(this, castArg, validationMetadata, pathSet) + return castArg + } + + @Throws(ValidationException::class) + fun validate(arg: LocalDate, configuration: SchemaConfiguration?): String { + return validate(arg.toString(), configuration) + } + + @Throws(ValidationException::class) + fun validate(arg: ZonedDateTime, configuration: SchemaConfiguration?): String { + return validate(arg.toString(), configuration) + } + + @Throws(ValidationException::class) + fun validate(arg: UUID, configuration: SchemaConfiguration?): String { + return validate(arg.toString(), configuration) + } + + override fun getNewInstance(arg: List<*>, pathToItem: List, pathToSchemas: PathToSchemasMap): FrozenList { + val items: MutableList = ArrayList() + var i: Int = 0 + for (item: Any? in arg) { + val itemPathToItem = pathToItem + i + val schemas: LinkedHashMap, Nothing?>? = pathToSchemas.get(itemPathToItem) + if (schemas == null) { + throw RuntimeException("Validation result is invalid, schemas must exist for a pathToItem") + } + val itemSchema: JsonSchema<*> = schemas.entries.iterator().next().key + val itemInstance: Any? = itemSchema.getNewInstance(item, itemPathToItem, pathToSchemas) + items.add(itemInstance) + i += 1 + } + val newInstanceItems: FrozenList = FrozenList(items) + return newInstanceItems + } + + @Throws(ValidationException::class) + override fun validate(arg: List<*>, configuration: SchemaConfiguration?): FrozenList { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, PathToSchemasMap(), LinkedHashSet()) + val pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet) + return getNewInstance(castArg, validationMetadata.pathToItem, pathToSchemasMap) + } + + override fun getNewInstance(arg: Map<*, *>, pathToItem: List, pathToSchemas: PathToSchemasMap): FrozenMap { + val properties: LinkedHashMap = LinkedHashMap() + for((propertyName, value) in arg) { + if (!(propertyName is String)) { + throw RuntimeException("Invalid non-string key value") + } + val propertyPathToItem: List = pathToItem + propertyName + val schemas: LinkedHashMap, Nothing?>? = pathToSchemas.get(propertyPathToItem) + if (schemas == null) { + throw RuntimeException("Validation result is invalid, schemas must exist for a pathToItem") + } + val propertySchema: JsonSchema<*> = schemas.entries.iterator().next().key + val propertyInstance: Any? = propertySchema.getNewInstance(value, propertyPathToItem, pathToSchemas) + properties[propertyName] = propertyInstance + } + val castProperties: FrozenMap = FrozenMap(properties) + return castProperties + } + + @Throws(ValidationException::class) + override fun validate(arg: Map<*, *>, configuration: SchemaConfiguration?): FrozenMap { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validatedPathToSchemas = PathToSchemasMap() + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, LinkedHashSet()) + val pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet) + return getNewInstance(castArg, validationMetadata.pathToItem, pathToSchemasMap) + } + + @Throws(ValidationException::class) + override fun validate(arg: Any?, configuration: SchemaConfiguration?): Any? { + if (arg == null) { + return validate(null, configuration) + } else if (arg is Boolean) { + return validate(arg, configuration) + } else if (arg is Number) { + return validate(arg, configuration) + } else if (arg is String) { + return validate(arg, configuration) + } else if (arg is List<*>) { + return validate(arg, configuration) + } else if (arg is Map<*, *>) { + return validate(arg, configuration) + } + throw ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema") + } + override fun getNewInstance(arg: Any?, pathToItem: List, pathToSchemas: PathToSchemasMap): Any? { + if (arg == null) { + return getNewInstance( null, pathToItem, pathToSchemas) + } else if (arg is Boolean) { + return getNewInstance(arg, pathToItem, pathToSchemas) + } else if (arg is Number) { + return getNewInstance(arg, pathToItem, pathToSchemas) + } else if (arg is String) { + return getNewInstance(arg, pathToItem, pathToSchemas) + } else if (arg is List<*>) { + return getNewInstance(arg, pathToItem, pathToSchemas) + } else if (arg is Map<*, *>) { + return getNewInstance(arg, pathToItem, pathToSchemas) + } + throw RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema") + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: Nothing?, configuration: SchemaConfiguration?): MaxpropertiesValidation1BoxedVoid { + return MaxpropertiesValidation1BoxedVoid(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: Boolean, configuration: SchemaConfiguration?): MaxpropertiesValidation1BoxedBoolean { + return MaxpropertiesValidation1BoxedBoolean(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: Number, configuration: SchemaConfiguration?): MaxpropertiesValidation1BoxedNumber { + return MaxpropertiesValidation1BoxedNumber(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: String, configuration: SchemaConfiguration?): MaxpropertiesValidation1BoxedString { + return MaxpropertiesValidation1BoxedString(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: List<*>, configuration: SchemaConfiguration?): MaxpropertiesValidation1BoxedList { + return MaxpropertiesValidation1BoxedList(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: Map<*, *>, configuration: SchemaConfiguration?): MaxpropertiesValidation1BoxedMap { + return MaxpropertiesValidation1BoxedMap(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: Any?, configuration: SchemaConfiguration?): MaxpropertiesValidation1Boxed { + if (arg == null) { + return validateAndBox(null, configuration) + } else if (arg is Boolean) { + return validateAndBox(arg, configuration) + } else if (arg is String) { + return validateAndBox(arg, configuration) + } else if (arg is Number) { + return validateAndBox(arg, configuration) + } else if (arg is List<*>) { + return validateAndBox(arg, configuration) + } else if (arg is Map<*, *>) { + return validateAndBox(arg, configuration) + } + throw ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema") + } + } +} diff --git a/samples/client/3_1_0_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/schemas/MincontainsWithoutContainsIsIgnored.kt b/samples/client/3_1_0_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/schemas/MincontainsWithoutContainsIsIgnored.kt new file mode 100644 index 00000000000..20899b8d90b --- /dev/null +++ b/samples/client/3_1_0_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/schemas/MincontainsWithoutContainsIsIgnored.kt @@ -0,0 +1,308 @@ +package org.openapijsonschematools.client.components.schemas +import java.time.LocalDate +import java.time.ZonedDateTime +import java.util.UUID +import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags +import org.openapijsonschematools.client.configurations.SchemaConfiguration +import org.openapijsonschematools.client.exceptions.InvalidAdditionalPropertyException +import org.openapijsonschematools.client.exceptions.UnsetPropertyException +import org.openapijsonschematools.client.exceptions.ValidationException +import org.openapijsonschematools.client.schemas.UnsetAddPropsSetter +import org.openapijsonschematools.client.schemas.validation.BooleanSchemaValidator +import org.openapijsonschematools.client.schemas.validation.FrozenList +import org.openapijsonschematools.client.schemas.validation.FrozenMap +import org.openapijsonschematools.client.schemas.validation.JsonSchema +import org.openapijsonschematools.client.schemas.validation.JsonSchemaInfo +import org.openapijsonschematools.client.schemas.validation.ListSchemaValidator +import org.openapijsonschematools.client.schemas.validation.MapSchemaValidator +import org.openapijsonschematools.client.schemas.validation.NullSchemaValidator +import org.openapijsonschematools.client.schemas.validation.NumberSchemaValidator +import org.openapijsonschematools.client.schemas.validation.PathToSchemasMap +import org.openapijsonschematools.client.schemas.validation.StringSchemaValidator +import org.openapijsonschematools.client.schemas.validation.ValidationMetadata + +class MincontainsWithoutContainsIsIgnored { + // nest classes so all schemas and input/output classes can be public + + + sealed interface MincontainsWithoutContainsIsIgnored1Boxed { + fun getData(): Any? + } + + data class MincontainsWithoutContainsIsIgnored1BoxedVoid(val data: Nothing?) : MincontainsWithoutContainsIsIgnored1Boxed { + override fun getData(): Any? { + return data + } + } + + data class MincontainsWithoutContainsIsIgnored1BoxedBoolean(val data: Boolean): MincontainsWithoutContainsIsIgnored1Boxed { + override fun getData(): Any? { + return data + } + } + + data class MincontainsWithoutContainsIsIgnored1BoxedNumber(val data: Number) : MincontainsWithoutContainsIsIgnored1Boxed { + override fun getData(): Any? { + return data + } + } + + data class MincontainsWithoutContainsIsIgnored1BoxedString(val data: String) : MincontainsWithoutContainsIsIgnored1Boxed { + override fun getData(): Any? { + return data + } + } + + data class MincontainsWithoutContainsIsIgnored1BoxedList(val data: FrozenList) : MincontainsWithoutContainsIsIgnored1Boxed { + override fun getData(): Any? { + return data + } + } + + data class MincontainsWithoutContainsIsIgnored1BoxedMap(val data: FrozenMap) : MincontainsWithoutContainsIsIgnored1Boxed { + override fun getData(): Any? { + return data + } + } + + + class MincontainsWithoutContainsIsIgnored1 private constructor(): JsonSchema( + JsonSchemaInfo() + .minContains(1) + ), NullSchemaValidator, BooleanSchemaValidator, NumberSchemaValidator, StringSchemaValidator, ListSchemaValidator, MincontainsWithoutContainsIsIgnored1BoxedList>, MapSchemaValidator, MincontainsWithoutContainsIsIgnored1BoxedMap> { + /* + NOTE: This class is auto generated by OpenAPI JSON Schema Generator. + Ref: https://github.com/openapi-json-schema-tools/openapi-json-schema-generator + + Do not edit the class manually. + */ + + companion object { + @Volatile + private var instance: MincontainsWithoutContainsIsIgnored1? = null + + fun getInstance() = + instance ?: synchronized(this) { + instance ?: MincontainsWithoutContainsIsIgnored1().also { instance = it } + } + } + + @Throws(ValidationException::class) + override fun validate(arg: Nothing?, configuration: SchemaConfiguration?): Nothing? { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validatedPathToSchemas = PathToSchemasMap() + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, LinkedHashSet()) + getPathToSchemas(this, castArg, validationMetadata, pathSet) + return castArg + } + + @Throws(ValidationException::class) + override fun validate(arg: Boolean, configuration: SchemaConfiguration?): Boolean { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validatedPathToSchemas = PathToSchemasMap() + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, LinkedHashSet()) + getPathToSchemas(this, castArg, validationMetadata, pathSet) + return castArg + } + + @Throws(ValidationException::class) + override fun validate(arg: Number, configuration: SchemaConfiguration?): Number { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validatedPathToSchemas = PathToSchemasMap() + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, LinkedHashSet()) + getPathToSchemas(this, castArg, validationMetadata, pathSet) + return castArg + } + + @Throws(ValidationException::class) + fun validate(arg: Int, configuration: SchemaConfiguration?): Int { + return validate(arg as Number, configuration) as Int + } + + @Throws(ValidationException::class) + fun validate(arg: Long, configuration: SchemaConfiguration?): Long { + return validate(arg as Number, configuration) as Long + } + + @Throws(ValidationException::class) + fun validate(arg: Float, configuration: SchemaConfiguration?): Float { + return validate(arg as Number, configuration) as Float + } + + @Throws(ValidationException::class) + fun validate(arg: Double, configuration: SchemaConfiguration?): Double { + return validate(arg as Number, configuration) as Double + } + + @Throws(ValidationException::class) + override fun validate(arg: String, configuration: SchemaConfiguration?): String { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validatedPathToSchemas = PathToSchemasMap() + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, LinkedHashSet()) + getPathToSchemas(this, castArg, validationMetadata, pathSet) + return castArg + } + + @Throws(ValidationException::class) + fun validate(arg: LocalDate, configuration: SchemaConfiguration?): String { + return validate(arg.toString(), configuration) + } + + @Throws(ValidationException::class) + fun validate(arg: ZonedDateTime, configuration: SchemaConfiguration?): String { + return validate(arg.toString(), configuration) + } + + @Throws(ValidationException::class) + fun validate(arg: UUID, configuration: SchemaConfiguration?): String { + return validate(arg.toString(), configuration) + } + + override fun getNewInstance(arg: List<*>, pathToItem: List, pathToSchemas: PathToSchemasMap): FrozenList { + val items: MutableList = ArrayList() + var i: Int = 0 + for (item: Any? in arg) { + val itemPathToItem = pathToItem + i + val schemas: LinkedHashMap, Nothing?>? = pathToSchemas.get(itemPathToItem) + if (schemas == null) { + throw RuntimeException("Validation result is invalid, schemas must exist for a pathToItem") + } + val itemSchema: JsonSchema<*> = schemas.entries.iterator().next().key + val itemInstance: Any? = itemSchema.getNewInstance(item, itemPathToItem, pathToSchemas) + items.add(itemInstance) + i += 1 + } + val newInstanceItems: FrozenList = FrozenList(items) + return newInstanceItems + } + + @Throws(ValidationException::class) + override fun validate(arg: List<*>, configuration: SchemaConfiguration?): FrozenList { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, PathToSchemasMap(), LinkedHashSet()) + val pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet) + return getNewInstance(castArg, validationMetadata.pathToItem, pathToSchemasMap) + } + + override fun getNewInstance(arg: Map<*, *>, pathToItem: List, pathToSchemas: PathToSchemasMap): FrozenMap { + val properties: LinkedHashMap = LinkedHashMap() + for((propertyName, value) in arg) { + if (!(propertyName is String)) { + throw RuntimeException("Invalid non-string key value") + } + val propertyPathToItem: List = pathToItem + propertyName + val schemas: LinkedHashMap, Nothing?>? = pathToSchemas.get(propertyPathToItem) + if (schemas == null) { + throw RuntimeException("Validation result is invalid, schemas must exist for a pathToItem") + } + val propertySchema: JsonSchema<*> = schemas.entries.iterator().next().key + val propertyInstance: Any? = propertySchema.getNewInstance(value, propertyPathToItem, pathToSchemas) + properties[propertyName] = propertyInstance + } + val castProperties: FrozenMap = FrozenMap(properties) + return castProperties + } + + @Throws(ValidationException::class) + override fun validate(arg: Map<*, *>, configuration: SchemaConfiguration?): FrozenMap { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validatedPathToSchemas = PathToSchemasMap() + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, LinkedHashSet()) + val pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet) + return getNewInstance(castArg, validationMetadata.pathToItem, pathToSchemasMap) + } + + @Throws(ValidationException::class) + override fun validate(arg: Any?, configuration: SchemaConfiguration?): Any? { + if (arg == null) { + return validate(null, configuration) + } else if (arg is Boolean) { + return validate(arg, configuration) + } else if (arg is Number) { + return validate(arg, configuration) + } else if (arg is String) { + return validate(arg, configuration) + } else if (arg is List<*>) { + return validate(arg, configuration) + } else if (arg is Map<*, *>) { + return validate(arg, configuration) + } + throw ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema") + } + override fun getNewInstance(arg: Any?, pathToItem: List, pathToSchemas: PathToSchemasMap): Any? { + if (arg == null) { + return getNewInstance( null, pathToItem, pathToSchemas) + } else if (arg is Boolean) { + return getNewInstance(arg, pathToItem, pathToSchemas) + } else if (arg is Number) { + return getNewInstance(arg, pathToItem, pathToSchemas) + } else if (arg is String) { + return getNewInstance(arg, pathToItem, pathToSchemas) + } else if (arg is List<*>) { + return getNewInstance(arg, pathToItem, pathToSchemas) + } else if (arg is Map<*, *>) { + return getNewInstance(arg, pathToItem, pathToSchemas) + } + throw RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema") + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: Nothing?, configuration: SchemaConfiguration?): MincontainsWithoutContainsIsIgnored1BoxedVoid { + return MincontainsWithoutContainsIsIgnored1BoxedVoid(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: Boolean, configuration: SchemaConfiguration?): MincontainsWithoutContainsIsIgnored1BoxedBoolean { + return MincontainsWithoutContainsIsIgnored1BoxedBoolean(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: Number, configuration: SchemaConfiguration?): MincontainsWithoutContainsIsIgnored1BoxedNumber { + return MincontainsWithoutContainsIsIgnored1BoxedNumber(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: String, configuration: SchemaConfiguration?): MincontainsWithoutContainsIsIgnored1BoxedString { + return MincontainsWithoutContainsIsIgnored1BoxedString(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: List<*>, configuration: SchemaConfiguration?): MincontainsWithoutContainsIsIgnored1BoxedList { + return MincontainsWithoutContainsIsIgnored1BoxedList(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: Map<*, *>, configuration: SchemaConfiguration?): MincontainsWithoutContainsIsIgnored1BoxedMap { + return MincontainsWithoutContainsIsIgnored1BoxedMap(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: Any?, configuration: SchemaConfiguration?): MincontainsWithoutContainsIsIgnored1Boxed { + if (arg == null) { + return validateAndBox(null, configuration) + } else if (arg is Boolean) { + return validateAndBox(arg, configuration) + } else if (arg is String) { + return validateAndBox(arg, configuration) + } else if (arg is Number) { + return validateAndBox(arg, configuration) + } else if (arg is List<*>) { + return validateAndBox(arg, configuration) + } else if (arg is Map<*, *>) { + return validateAndBox(arg, configuration) + } + throw ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema") + } + } +} diff --git a/samples/client/3_1_0_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/schemas/MinimumValidation.kt b/samples/client/3_1_0_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/schemas/MinimumValidation.kt new file mode 100644 index 00000000000..93c46043a0f --- /dev/null +++ b/samples/client/3_1_0_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/schemas/MinimumValidation.kt @@ -0,0 +1,308 @@ +package org.openapijsonschematools.client.components.schemas +import java.time.LocalDate +import java.time.ZonedDateTime +import java.util.UUID +import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags +import org.openapijsonschematools.client.configurations.SchemaConfiguration +import org.openapijsonschematools.client.exceptions.InvalidAdditionalPropertyException +import org.openapijsonschematools.client.exceptions.UnsetPropertyException +import org.openapijsonschematools.client.exceptions.ValidationException +import org.openapijsonschematools.client.schemas.UnsetAddPropsSetter +import org.openapijsonschematools.client.schemas.validation.BooleanSchemaValidator +import org.openapijsonschematools.client.schemas.validation.FrozenList +import org.openapijsonschematools.client.schemas.validation.FrozenMap +import org.openapijsonschematools.client.schemas.validation.JsonSchema +import org.openapijsonschematools.client.schemas.validation.JsonSchemaInfo +import org.openapijsonschematools.client.schemas.validation.ListSchemaValidator +import org.openapijsonschematools.client.schemas.validation.MapSchemaValidator +import org.openapijsonschematools.client.schemas.validation.NullSchemaValidator +import org.openapijsonschematools.client.schemas.validation.NumberSchemaValidator +import org.openapijsonschematools.client.schemas.validation.PathToSchemasMap +import org.openapijsonschematools.client.schemas.validation.StringSchemaValidator +import org.openapijsonschematools.client.schemas.validation.ValidationMetadata + +class MinimumValidation { + // nest classes so all schemas and input/output classes can be public + + + sealed interface MinimumValidation1Boxed { + fun getData(): Any? + } + + data class MinimumValidation1BoxedVoid(val data: Nothing?) : MinimumValidation1Boxed { + override fun getData(): Any? { + return data + } + } + + data class MinimumValidation1BoxedBoolean(val data: Boolean): MinimumValidation1Boxed { + override fun getData(): Any? { + return data + } + } + + data class MinimumValidation1BoxedNumber(val data: Number) : MinimumValidation1Boxed { + override fun getData(): Any? { + return data + } + } + + data class MinimumValidation1BoxedString(val data: String) : MinimumValidation1Boxed { + override fun getData(): Any? { + return data + } + } + + data class MinimumValidation1BoxedList(val data: FrozenList) : MinimumValidation1Boxed { + override fun getData(): Any? { + return data + } + } + + data class MinimumValidation1BoxedMap(val data: FrozenMap) : MinimumValidation1Boxed { + override fun getData(): Any? { + return data + } + } + + + class MinimumValidation1 private constructor(): JsonSchema( + JsonSchemaInfo() + .minimum(1.1) + ), NullSchemaValidator, BooleanSchemaValidator, NumberSchemaValidator, StringSchemaValidator, ListSchemaValidator, MinimumValidation1BoxedList>, MapSchemaValidator, MinimumValidation1BoxedMap> { + /* + NOTE: This class is auto generated by OpenAPI JSON Schema Generator. + Ref: https://github.com/openapi-json-schema-tools/openapi-json-schema-generator + + Do not edit the class manually. + */ + + companion object { + @Volatile + private var instance: MinimumValidation1? = null + + fun getInstance() = + instance ?: synchronized(this) { + instance ?: MinimumValidation1().also { instance = it } + } + } + + @Throws(ValidationException::class) + override fun validate(arg: Nothing?, configuration: SchemaConfiguration?): Nothing? { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validatedPathToSchemas = PathToSchemasMap() + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, LinkedHashSet()) + getPathToSchemas(this, castArg, validationMetadata, pathSet) + return castArg + } + + @Throws(ValidationException::class) + override fun validate(arg: Boolean, configuration: SchemaConfiguration?): Boolean { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validatedPathToSchemas = PathToSchemasMap() + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, LinkedHashSet()) + getPathToSchemas(this, castArg, validationMetadata, pathSet) + return castArg + } + + @Throws(ValidationException::class) + override fun validate(arg: Number, configuration: SchemaConfiguration?): Number { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validatedPathToSchemas = PathToSchemasMap() + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, LinkedHashSet()) + getPathToSchemas(this, castArg, validationMetadata, pathSet) + return castArg + } + + @Throws(ValidationException::class) + fun validate(arg: Int, configuration: SchemaConfiguration?): Int { + return validate(arg as Number, configuration) as Int + } + + @Throws(ValidationException::class) + fun validate(arg: Long, configuration: SchemaConfiguration?): Long { + return validate(arg as Number, configuration) as Long + } + + @Throws(ValidationException::class) + fun validate(arg: Float, configuration: SchemaConfiguration?): Float { + return validate(arg as Number, configuration) as Float + } + + @Throws(ValidationException::class) + fun validate(arg: Double, configuration: SchemaConfiguration?): Double { + return validate(arg as Number, configuration) as Double + } + + @Throws(ValidationException::class) + override fun validate(arg: String, configuration: SchemaConfiguration?): String { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validatedPathToSchemas = PathToSchemasMap() + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, LinkedHashSet()) + getPathToSchemas(this, castArg, validationMetadata, pathSet) + return castArg + } + + @Throws(ValidationException::class) + fun validate(arg: LocalDate, configuration: SchemaConfiguration?): String { + return validate(arg.toString(), configuration) + } + + @Throws(ValidationException::class) + fun validate(arg: ZonedDateTime, configuration: SchemaConfiguration?): String { + return validate(arg.toString(), configuration) + } + + @Throws(ValidationException::class) + fun validate(arg: UUID, configuration: SchemaConfiguration?): String { + return validate(arg.toString(), configuration) + } + + override fun getNewInstance(arg: List<*>, pathToItem: List, pathToSchemas: PathToSchemasMap): FrozenList { + val items: MutableList = ArrayList() + var i: Int = 0 + for (item: Any? in arg) { + val itemPathToItem = pathToItem + i + val schemas: LinkedHashMap, Nothing?>? = pathToSchemas.get(itemPathToItem) + if (schemas == null) { + throw RuntimeException("Validation result is invalid, schemas must exist for a pathToItem") + } + val itemSchema: JsonSchema<*> = schemas.entries.iterator().next().key + val itemInstance: Any? = itemSchema.getNewInstance(item, itemPathToItem, pathToSchemas) + items.add(itemInstance) + i += 1 + } + val newInstanceItems: FrozenList = FrozenList(items) + return newInstanceItems + } + + @Throws(ValidationException::class) + override fun validate(arg: List<*>, configuration: SchemaConfiguration?): FrozenList { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, PathToSchemasMap(), LinkedHashSet()) + val pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet) + return getNewInstance(castArg, validationMetadata.pathToItem, pathToSchemasMap) + } + + override fun getNewInstance(arg: Map<*, *>, pathToItem: List, pathToSchemas: PathToSchemasMap): FrozenMap { + val properties: LinkedHashMap = LinkedHashMap() + for((propertyName, value) in arg) { + if (!(propertyName is String)) { + throw RuntimeException("Invalid non-string key value") + } + val propertyPathToItem: List = pathToItem + propertyName + val schemas: LinkedHashMap, Nothing?>? = pathToSchemas.get(propertyPathToItem) + if (schemas == null) { + throw RuntimeException("Validation result is invalid, schemas must exist for a pathToItem") + } + val propertySchema: JsonSchema<*> = schemas.entries.iterator().next().key + val propertyInstance: Any? = propertySchema.getNewInstance(value, propertyPathToItem, pathToSchemas) + properties[propertyName] = propertyInstance + } + val castProperties: FrozenMap = FrozenMap(properties) + return castProperties + } + + @Throws(ValidationException::class) + override fun validate(arg: Map<*, *>, configuration: SchemaConfiguration?): FrozenMap { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validatedPathToSchemas = PathToSchemasMap() + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, LinkedHashSet()) + val pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet) + return getNewInstance(castArg, validationMetadata.pathToItem, pathToSchemasMap) + } + + @Throws(ValidationException::class) + override fun validate(arg: Any?, configuration: SchemaConfiguration?): Any? { + if (arg == null) { + return validate(null, configuration) + } else if (arg is Boolean) { + return validate(arg, configuration) + } else if (arg is Number) { + return validate(arg, configuration) + } else if (arg is String) { + return validate(arg, configuration) + } else if (arg is List<*>) { + return validate(arg, configuration) + } else if (arg is Map<*, *>) { + return validate(arg, configuration) + } + throw ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema") + } + override fun getNewInstance(arg: Any?, pathToItem: List, pathToSchemas: PathToSchemasMap): Any? { + if (arg == null) { + return getNewInstance( null, pathToItem, pathToSchemas) + } else if (arg is Boolean) { + return getNewInstance(arg, pathToItem, pathToSchemas) + } else if (arg is Number) { + return getNewInstance(arg, pathToItem, pathToSchemas) + } else if (arg is String) { + return getNewInstance(arg, pathToItem, pathToSchemas) + } else if (arg is List<*>) { + return getNewInstance(arg, pathToItem, pathToSchemas) + } else if (arg is Map<*, *>) { + return getNewInstance(arg, pathToItem, pathToSchemas) + } + throw RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema") + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: Nothing?, configuration: SchemaConfiguration?): MinimumValidation1BoxedVoid { + return MinimumValidation1BoxedVoid(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: Boolean, configuration: SchemaConfiguration?): MinimumValidation1BoxedBoolean { + return MinimumValidation1BoxedBoolean(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: Number, configuration: SchemaConfiguration?): MinimumValidation1BoxedNumber { + return MinimumValidation1BoxedNumber(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: String, configuration: SchemaConfiguration?): MinimumValidation1BoxedString { + return MinimumValidation1BoxedString(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: List<*>, configuration: SchemaConfiguration?): MinimumValidation1BoxedList { + return MinimumValidation1BoxedList(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: Map<*, *>, configuration: SchemaConfiguration?): MinimumValidation1BoxedMap { + return MinimumValidation1BoxedMap(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: Any?, configuration: SchemaConfiguration?): MinimumValidation1Boxed { + if (arg == null) { + return validateAndBox(null, configuration) + } else if (arg is Boolean) { + return validateAndBox(arg, configuration) + } else if (arg is String) { + return validateAndBox(arg, configuration) + } else if (arg is Number) { + return validateAndBox(arg, configuration) + } else if (arg is List<*>) { + return validateAndBox(arg, configuration) + } else if (arg is Map<*, *>) { + return validateAndBox(arg, configuration) + } + throw ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema") + } + } +} diff --git a/samples/client/3_1_0_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/schemas/MinimumValidationWithSignedInteger.kt b/samples/client/3_1_0_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/schemas/MinimumValidationWithSignedInteger.kt new file mode 100644 index 00000000000..d6d1593b716 --- /dev/null +++ b/samples/client/3_1_0_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/schemas/MinimumValidationWithSignedInteger.kt @@ -0,0 +1,308 @@ +package org.openapijsonschematools.client.components.schemas +import java.time.LocalDate +import java.time.ZonedDateTime +import java.util.UUID +import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags +import org.openapijsonschematools.client.configurations.SchemaConfiguration +import org.openapijsonschematools.client.exceptions.InvalidAdditionalPropertyException +import org.openapijsonschematools.client.exceptions.UnsetPropertyException +import org.openapijsonschematools.client.exceptions.ValidationException +import org.openapijsonschematools.client.schemas.UnsetAddPropsSetter +import org.openapijsonschematools.client.schemas.validation.BooleanSchemaValidator +import org.openapijsonschematools.client.schemas.validation.FrozenList +import org.openapijsonschematools.client.schemas.validation.FrozenMap +import org.openapijsonschematools.client.schemas.validation.JsonSchema +import org.openapijsonschematools.client.schemas.validation.JsonSchemaInfo +import org.openapijsonschematools.client.schemas.validation.ListSchemaValidator +import org.openapijsonschematools.client.schemas.validation.MapSchemaValidator +import org.openapijsonschematools.client.schemas.validation.NullSchemaValidator +import org.openapijsonschematools.client.schemas.validation.NumberSchemaValidator +import org.openapijsonschematools.client.schemas.validation.PathToSchemasMap +import org.openapijsonschematools.client.schemas.validation.StringSchemaValidator +import org.openapijsonschematools.client.schemas.validation.ValidationMetadata + +class MinimumValidationWithSignedInteger { + // nest classes so all schemas and input/output classes can be public + + + sealed interface MinimumValidationWithSignedInteger1Boxed { + fun getData(): Any? + } + + data class MinimumValidationWithSignedInteger1BoxedVoid(val data: Nothing?) : MinimumValidationWithSignedInteger1Boxed { + override fun getData(): Any? { + return data + } + } + + data class MinimumValidationWithSignedInteger1BoxedBoolean(val data: Boolean): MinimumValidationWithSignedInteger1Boxed { + override fun getData(): Any? { + return data + } + } + + data class MinimumValidationWithSignedInteger1BoxedNumber(val data: Number) : MinimumValidationWithSignedInteger1Boxed { + override fun getData(): Any? { + return data + } + } + + data class MinimumValidationWithSignedInteger1BoxedString(val data: String) : MinimumValidationWithSignedInteger1Boxed { + override fun getData(): Any? { + return data + } + } + + data class MinimumValidationWithSignedInteger1BoxedList(val data: FrozenList) : MinimumValidationWithSignedInteger1Boxed { + override fun getData(): Any? { + return data + } + } + + data class MinimumValidationWithSignedInteger1BoxedMap(val data: FrozenMap) : MinimumValidationWithSignedInteger1Boxed { + override fun getData(): Any? { + return data + } + } + + + class MinimumValidationWithSignedInteger1 private constructor(): JsonSchema( + JsonSchemaInfo() + .minimum(-2) + ), NullSchemaValidator, BooleanSchemaValidator, NumberSchemaValidator, StringSchemaValidator, ListSchemaValidator, MinimumValidationWithSignedInteger1BoxedList>, MapSchemaValidator, MinimumValidationWithSignedInteger1BoxedMap> { + /* + NOTE: This class is auto generated by OpenAPI JSON Schema Generator. + Ref: https://github.com/openapi-json-schema-tools/openapi-json-schema-generator + + Do not edit the class manually. + */ + + companion object { + @Volatile + private var instance: MinimumValidationWithSignedInteger1? = null + + fun getInstance() = + instance ?: synchronized(this) { + instance ?: MinimumValidationWithSignedInteger1().also { instance = it } + } + } + + @Throws(ValidationException::class) + override fun validate(arg: Nothing?, configuration: SchemaConfiguration?): Nothing? { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validatedPathToSchemas = PathToSchemasMap() + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, LinkedHashSet()) + getPathToSchemas(this, castArg, validationMetadata, pathSet) + return castArg + } + + @Throws(ValidationException::class) + override fun validate(arg: Boolean, configuration: SchemaConfiguration?): Boolean { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validatedPathToSchemas = PathToSchemasMap() + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, LinkedHashSet()) + getPathToSchemas(this, castArg, validationMetadata, pathSet) + return castArg + } + + @Throws(ValidationException::class) + override fun validate(arg: Number, configuration: SchemaConfiguration?): Number { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validatedPathToSchemas = PathToSchemasMap() + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, LinkedHashSet()) + getPathToSchemas(this, castArg, validationMetadata, pathSet) + return castArg + } + + @Throws(ValidationException::class) + fun validate(arg: Int, configuration: SchemaConfiguration?): Int { + return validate(arg as Number, configuration) as Int + } + + @Throws(ValidationException::class) + fun validate(arg: Long, configuration: SchemaConfiguration?): Long { + return validate(arg as Number, configuration) as Long + } + + @Throws(ValidationException::class) + fun validate(arg: Float, configuration: SchemaConfiguration?): Float { + return validate(arg as Number, configuration) as Float + } + + @Throws(ValidationException::class) + fun validate(arg: Double, configuration: SchemaConfiguration?): Double { + return validate(arg as Number, configuration) as Double + } + + @Throws(ValidationException::class) + override fun validate(arg: String, configuration: SchemaConfiguration?): String { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validatedPathToSchemas = PathToSchemasMap() + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, LinkedHashSet()) + getPathToSchemas(this, castArg, validationMetadata, pathSet) + return castArg + } + + @Throws(ValidationException::class) + fun validate(arg: LocalDate, configuration: SchemaConfiguration?): String { + return validate(arg.toString(), configuration) + } + + @Throws(ValidationException::class) + fun validate(arg: ZonedDateTime, configuration: SchemaConfiguration?): String { + return validate(arg.toString(), configuration) + } + + @Throws(ValidationException::class) + fun validate(arg: UUID, configuration: SchemaConfiguration?): String { + return validate(arg.toString(), configuration) + } + + override fun getNewInstance(arg: List<*>, pathToItem: List, pathToSchemas: PathToSchemasMap): FrozenList { + val items: MutableList = ArrayList() + var i: Int = 0 + for (item: Any? in arg) { + val itemPathToItem = pathToItem + i + val schemas: LinkedHashMap, Nothing?>? = pathToSchemas.get(itemPathToItem) + if (schemas == null) { + throw RuntimeException("Validation result is invalid, schemas must exist for a pathToItem") + } + val itemSchema: JsonSchema<*> = schemas.entries.iterator().next().key + val itemInstance: Any? = itemSchema.getNewInstance(item, itemPathToItem, pathToSchemas) + items.add(itemInstance) + i += 1 + } + val newInstanceItems: FrozenList = FrozenList(items) + return newInstanceItems + } + + @Throws(ValidationException::class) + override fun validate(arg: List<*>, configuration: SchemaConfiguration?): FrozenList { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, PathToSchemasMap(), LinkedHashSet()) + val pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet) + return getNewInstance(castArg, validationMetadata.pathToItem, pathToSchemasMap) + } + + override fun getNewInstance(arg: Map<*, *>, pathToItem: List, pathToSchemas: PathToSchemasMap): FrozenMap { + val properties: LinkedHashMap = LinkedHashMap() + for((propertyName, value) in arg) { + if (!(propertyName is String)) { + throw RuntimeException("Invalid non-string key value") + } + val propertyPathToItem: List = pathToItem + propertyName + val schemas: LinkedHashMap, Nothing?>? = pathToSchemas.get(propertyPathToItem) + if (schemas == null) { + throw RuntimeException("Validation result is invalid, schemas must exist for a pathToItem") + } + val propertySchema: JsonSchema<*> = schemas.entries.iterator().next().key + val propertyInstance: Any? = propertySchema.getNewInstance(value, propertyPathToItem, pathToSchemas) + properties[propertyName] = propertyInstance + } + val castProperties: FrozenMap = FrozenMap(properties) + return castProperties + } + + @Throws(ValidationException::class) + override fun validate(arg: Map<*, *>, configuration: SchemaConfiguration?): FrozenMap { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validatedPathToSchemas = PathToSchemasMap() + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, LinkedHashSet()) + val pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet) + return getNewInstance(castArg, validationMetadata.pathToItem, pathToSchemasMap) + } + + @Throws(ValidationException::class) + override fun validate(arg: Any?, configuration: SchemaConfiguration?): Any? { + if (arg == null) { + return validate(null, configuration) + } else if (arg is Boolean) { + return validate(arg, configuration) + } else if (arg is Number) { + return validate(arg, configuration) + } else if (arg is String) { + return validate(arg, configuration) + } else if (arg is List<*>) { + return validate(arg, configuration) + } else if (arg is Map<*, *>) { + return validate(arg, configuration) + } + throw ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema") + } + override fun getNewInstance(arg: Any?, pathToItem: List, pathToSchemas: PathToSchemasMap): Any? { + if (arg == null) { + return getNewInstance( null, pathToItem, pathToSchemas) + } else if (arg is Boolean) { + return getNewInstance(arg, pathToItem, pathToSchemas) + } else if (arg is Number) { + return getNewInstance(arg, pathToItem, pathToSchemas) + } else if (arg is String) { + return getNewInstance(arg, pathToItem, pathToSchemas) + } else if (arg is List<*>) { + return getNewInstance(arg, pathToItem, pathToSchemas) + } else if (arg is Map<*, *>) { + return getNewInstance(arg, pathToItem, pathToSchemas) + } + throw RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema") + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: Nothing?, configuration: SchemaConfiguration?): MinimumValidationWithSignedInteger1BoxedVoid { + return MinimumValidationWithSignedInteger1BoxedVoid(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: Boolean, configuration: SchemaConfiguration?): MinimumValidationWithSignedInteger1BoxedBoolean { + return MinimumValidationWithSignedInteger1BoxedBoolean(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: Number, configuration: SchemaConfiguration?): MinimumValidationWithSignedInteger1BoxedNumber { + return MinimumValidationWithSignedInteger1BoxedNumber(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: String, configuration: SchemaConfiguration?): MinimumValidationWithSignedInteger1BoxedString { + return MinimumValidationWithSignedInteger1BoxedString(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: List<*>, configuration: SchemaConfiguration?): MinimumValidationWithSignedInteger1BoxedList { + return MinimumValidationWithSignedInteger1BoxedList(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: Map<*, *>, configuration: SchemaConfiguration?): MinimumValidationWithSignedInteger1BoxedMap { + return MinimumValidationWithSignedInteger1BoxedMap(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: Any?, configuration: SchemaConfiguration?): MinimumValidationWithSignedInteger1Boxed { + if (arg == null) { + return validateAndBox(null, configuration) + } else if (arg is Boolean) { + return validateAndBox(arg, configuration) + } else if (arg is String) { + return validateAndBox(arg, configuration) + } else if (arg is Number) { + return validateAndBox(arg, configuration) + } else if (arg is List<*>) { + return validateAndBox(arg, configuration) + } else if (arg is Map<*, *>) { + return validateAndBox(arg, configuration) + } + throw ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema") + } + } +} diff --git a/samples/client/3_1_0_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/schemas/MinitemsValidation.kt b/samples/client/3_1_0_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/schemas/MinitemsValidation.kt new file mode 100644 index 00000000000..bc2ce6d4c65 --- /dev/null +++ b/samples/client/3_1_0_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/schemas/MinitemsValidation.kt @@ -0,0 +1,308 @@ +package org.openapijsonschematools.client.components.schemas +import java.time.LocalDate +import java.time.ZonedDateTime +import java.util.UUID +import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags +import org.openapijsonschematools.client.configurations.SchemaConfiguration +import org.openapijsonschematools.client.exceptions.InvalidAdditionalPropertyException +import org.openapijsonschematools.client.exceptions.UnsetPropertyException +import org.openapijsonschematools.client.exceptions.ValidationException +import org.openapijsonschematools.client.schemas.UnsetAddPropsSetter +import org.openapijsonschematools.client.schemas.validation.BooleanSchemaValidator +import org.openapijsonschematools.client.schemas.validation.FrozenList +import org.openapijsonschematools.client.schemas.validation.FrozenMap +import org.openapijsonschematools.client.schemas.validation.JsonSchema +import org.openapijsonschematools.client.schemas.validation.JsonSchemaInfo +import org.openapijsonschematools.client.schemas.validation.ListSchemaValidator +import org.openapijsonschematools.client.schemas.validation.MapSchemaValidator +import org.openapijsonschematools.client.schemas.validation.NullSchemaValidator +import org.openapijsonschematools.client.schemas.validation.NumberSchemaValidator +import org.openapijsonschematools.client.schemas.validation.PathToSchemasMap +import org.openapijsonschematools.client.schemas.validation.StringSchemaValidator +import org.openapijsonschematools.client.schemas.validation.ValidationMetadata + +class MinitemsValidation { + // nest classes so all schemas and input/output classes can be public + + + sealed interface MinitemsValidation1Boxed { + fun getData(): Any? + } + + data class MinitemsValidation1BoxedVoid(val data: Nothing?) : MinitemsValidation1Boxed { + override fun getData(): Any? { + return data + } + } + + data class MinitemsValidation1BoxedBoolean(val data: Boolean): MinitemsValidation1Boxed { + override fun getData(): Any? { + return data + } + } + + data class MinitemsValidation1BoxedNumber(val data: Number) : MinitemsValidation1Boxed { + override fun getData(): Any? { + return data + } + } + + data class MinitemsValidation1BoxedString(val data: String) : MinitemsValidation1Boxed { + override fun getData(): Any? { + return data + } + } + + data class MinitemsValidation1BoxedList(val data: FrozenList) : MinitemsValidation1Boxed { + override fun getData(): Any? { + return data + } + } + + data class MinitemsValidation1BoxedMap(val data: FrozenMap) : MinitemsValidation1Boxed { + override fun getData(): Any? { + return data + } + } + + + class MinitemsValidation1 private constructor(): JsonSchema( + JsonSchemaInfo() + .minItems(1) + ), NullSchemaValidator, BooleanSchemaValidator, NumberSchemaValidator, StringSchemaValidator, ListSchemaValidator, MinitemsValidation1BoxedList>, MapSchemaValidator, MinitemsValidation1BoxedMap> { + /* + NOTE: This class is auto generated by OpenAPI JSON Schema Generator. + Ref: https://github.com/openapi-json-schema-tools/openapi-json-schema-generator + + Do not edit the class manually. + */ + + companion object { + @Volatile + private var instance: MinitemsValidation1? = null + + fun getInstance() = + instance ?: synchronized(this) { + instance ?: MinitemsValidation1().also { instance = it } + } + } + + @Throws(ValidationException::class) + override fun validate(arg: Nothing?, configuration: SchemaConfiguration?): Nothing? { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validatedPathToSchemas = PathToSchemasMap() + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, LinkedHashSet()) + getPathToSchemas(this, castArg, validationMetadata, pathSet) + return castArg + } + + @Throws(ValidationException::class) + override fun validate(arg: Boolean, configuration: SchemaConfiguration?): Boolean { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validatedPathToSchemas = PathToSchemasMap() + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, LinkedHashSet()) + getPathToSchemas(this, castArg, validationMetadata, pathSet) + return castArg + } + + @Throws(ValidationException::class) + override fun validate(arg: Number, configuration: SchemaConfiguration?): Number { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validatedPathToSchemas = PathToSchemasMap() + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, LinkedHashSet()) + getPathToSchemas(this, castArg, validationMetadata, pathSet) + return castArg + } + + @Throws(ValidationException::class) + fun validate(arg: Int, configuration: SchemaConfiguration?): Int { + return validate(arg as Number, configuration) as Int + } + + @Throws(ValidationException::class) + fun validate(arg: Long, configuration: SchemaConfiguration?): Long { + return validate(arg as Number, configuration) as Long + } + + @Throws(ValidationException::class) + fun validate(arg: Float, configuration: SchemaConfiguration?): Float { + return validate(arg as Number, configuration) as Float + } + + @Throws(ValidationException::class) + fun validate(arg: Double, configuration: SchemaConfiguration?): Double { + return validate(arg as Number, configuration) as Double + } + + @Throws(ValidationException::class) + override fun validate(arg: String, configuration: SchemaConfiguration?): String { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validatedPathToSchemas = PathToSchemasMap() + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, LinkedHashSet()) + getPathToSchemas(this, castArg, validationMetadata, pathSet) + return castArg + } + + @Throws(ValidationException::class) + fun validate(arg: LocalDate, configuration: SchemaConfiguration?): String { + return validate(arg.toString(), configuration) + } + + @Throws(ValidationException::class) + fun validate(arg: ZonedDateTime, configuration: SchemaConfiguration?): String { + return validate(arg.toString(), configuration) + } + + @Throws(ValidationException::class) + fun validate(arg: UUID, configuration: SchemaConfiguration?): String { + return validate(arg.toString(), configuration) + } + + override fun getNewInstance(arg: List<*>, pathToItem: List, pathToSchemas: PathToSchemasMap): FrozenList { + val items: MutableList = ArrayList() + var i: Int = 0 + for (item: Any? in arg) { + val itemPathToItem = pathToItem + i + val schemas: LinkedHashMap, Nothing?>? = pathToSchemas.get(itemPathToItem) + if (schemas == null) { + throw RuntimeException("Validation result is invalid, schemas must exist for a pathToItem") + } + val itemSchema: JsonSchema<*> = schemas.entries.iterator().next().key + val itemInstance: Any? = itemSchema.getNewInstance(item, itemPathToItem, pathToSchemas) + items.add(itemInstance) + i += 1 + } + val newInstanceItems: FrozenList = FrozenList(items) + return newInstanceItems + } + + @Throws(ValidationException::class) + override fun validate(arg: List<*>, configuration: SchemaConfiguration?): FrozenList { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, PathToSchemasMap(), LinkedHashSet()) + val pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet) + return getNewInstance(castArg, validationMetadata.pathToItem, pathToSchemasMap) + } + + override fun getNewInstance(arg: Map<*, *>, pathToItem: List, pathToSchemas: PathToSchemasMap): FrozenMap { + val properties: LinkedHashMap = LinkedHashMap() + for((propertyName, value) in arg) { + if (!(propertyName is String)) { + throw RuntimeException("Invalid non-string key value") + } + val propertyPathToItem: List = pathToItem + propertyName + val schemas: LinkedHashMap, Nothing?>? = pathToSchemas.get(propertyPathToItem) + if (schemas == null) { + throw RuntimeException("Validation result is invalid, schemas must exist for a pathToItem") + } + val propertySchema: JsonSchema<*> = schemas.entries.iterator().next().key + val propertyInstance: Any? = propertySchema.getNewInstance(value, propertyPathToItem, pathToSchemas) + properties[propertyName] = propertyInstance + } + val castProperties: FrozenMap = FrozenMap(properties) + return castProperties + } + + @Throws(ValidationException::class) + override fun validate(arg: Map<*, *>, configuration: SchemaConfiguration?): FrozenMap { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validatedPathToSchemas = PathToSchemasMap() + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, LinkedHashSet()) + val pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet) + return getNewInstance(castArg, validationMetadata.pathToItem, pathToSchemasMap) + } + + @Throws(ValidationException::class) + override fun validate(arg: Any?, configuration: SchemaConfiguration?): Any? { + if (arg == null) { + return validate(null, configuration) + } else if (arg is Boolean) { + return validate(arg, configuration) + } else if (arg is Number) { + return validate(arg, configuration) + } else if (arg is String) { + return validate(arg, configuration) + } else if (arg is List<*>) { + return validate(arg, configuration) + } else if (arg is Map<*, *>) { + return validate(arg, configuration) + } + throw ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema") + } + override fun getNewInstance(arg: Any?, pathToItem: List, pathToSchemas: PathToSchemasMap): Any? { + if (arg == null) { + return getNewInstance( null, pathToItem, pathToSchemas) + } else if (arg is Boolean) { + return getNewInstance(arg, pathToItem, pathToSchemas) + } else if (arg is Number) { + return getNewInstance(arg, pathToItem, pathToSchemas) + } else if (arg is String) { + return getNewInstance(arg, pathToItem, pathToSchemas) + } else if (arg is List<*>) { + return getNewInstance(arg, pathToItem, pathToSchemas) + } else if (arg is Map<*, *>) { + return getNewInstance(arg, pathToItem, pathToSchemas) + } + throw RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema") + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: Nothing?, configuration: SchemaConfiguration?): MinitemsValidation1BoxedVoid { + return MinitemsValidation1BoxedVoid(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: Boolean, configuration: SchemaConfiguration?): MinitemsValidation1BoxedBoolean { + return MinitemsValidation1BoxedBoolean(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: Number, configuration: SchemaConfiguration?): MinitemsValidation1BoxedNumber { + return MinitemsValidation1BoxedNumber(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: String, configuration: SchemaConfiguration?): MinitemsValidation1BoxedString { + return MinitemsValidation1BoxedString(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: List<*>, configuration: SchemaConfiguration?): MinitemsValidation1BoxedList { + return MinitemsValidation1BoxedList(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: Map<*, *>, configuration: SchemaConfiguration?): MinitemsValidation1BoxedMap { + return MinitemsValidation1BoxedMap(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: Any?, configuration: SchemaConfiguration?): MinitemsValidation1Boxed { + if (arg == null) { + return validateAndBox(null, configuration) + } else if (arg is Boolean) { + return validateAndBox(arg, configuration) + } else if (arg is String) { + return validateAndBox(arg, configuration) + } else if (arg is Number) { + return validateAndBox(arg, configuration) + } else if (arg is List<*>) { + return validateAndBox(arg, configuration) + } else if (arg is Map<*, *>) { + return validateAndBox(arg, configuration) + } + throw ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema") + } + } +} diff --git a/samples/client/3_1_0_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/schemas/MinlengthValidation.kt b/samples/client/3_1_0_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/schemas/MinlengthValidation.kt new file mode 100644 index 00000000000..2e7b4c422ee --- /dev/null +++ b/samples/client/3_1_0_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/schemas/MinlengthValidation.kt @@ -0,0 +1,308 @@ +package org.openapijsonschematools.client.components.schemas +import java.time.LocalDate +import java.time.ZonedDateTime +import java.util.UUID +import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags +import org.openapijsonschematools.client.configurations.SchemaConfiguration +import org.openapijsonschematools.client.exceptions.InvalidAdditionalPropertyException +import org.openapijsonschematools.client.exceptions.UnsetPropertyException +import org.openapijsonschematools.client.exceptions.ValidationException +import org.openapijsonschematools.client.schemas.UnsetAddPropsSetter +import org.openapijsonschematools.client.schemas.validation.BooleanSchemaValidator +import org.openapijsonschematools.client.schemas.validation.FrozenList +import org.openapijsonschematools.client.schemas.validation.FrozenMap +import org.openapijsonschematools.client.schemas.validation.JsonSchema +import org.openapijsonschematools.client.schemas.validation.JsonSchemaInfo +import org.openapijsonschematools.client.schemas.validation.ListSchemaValidator +import org.openapijsonschematools.client.schemas.validation.MapSchemaValidator +import org.openapijsonschematools.client.schemas.validation.NullSchemaValidator +import org.openapijsonschematools.client.schemas.validation.NumberSchemaValidator +import org.openapijsonschematools.client.schemas.validation.PathToSchemasMap +import org.openapijsonschematools.client.schemas.validation.StringSchemaValidator +import org.openapijsonschematools.client.schemas.validation.ValidationMetadata + +class MinlengthValidation { + // nest classes so all schemas and input/output classes can be public + + + sealed interface MinlengthValidation1Boxed { + fun getData(): Any? + } + + data class MinlengthValidation1BoxedVoid(val data: Nothing?) : MinlengthValidation1Boxed { + override fun getData(): Any? { + return data + } + } + + data class MinlengthValidation1BoxedBoolean(val data: Boolean): MinlengthValidation1Boxed { + override fun getData(): Any? { + return data + } + } + + data class MinlengthValidation1BoxedNumber(val data: Number) : MinlengthValidation1Boxed { + override fun getData(): Any? { + return data + } + } + + data class MinlengthValidation1BoxedString(val data: String) : MinlengthValidation1Boxed { + override fun getData(): Any? { + return data + } + } + + data class MinlengthValidation1BoxedList(val data: FrozenList) : MinlengthValidation1Boxed { + override fun getData(): Any? { + return data + } + } + + data class MinlengthValidation1BoxedMap(val data: FrozenMap) : MinlengthValidation1Boxed { + override fun getData(): Any? { + return data + } + } + + + class MinlengthValidation1 private constructor(): JsonSchema( + JsonSchemaInfo() + .minLength(2) + ), NullSchemaValidator, BooleanSchemaValidator, NumberSchemaValidator, StringSchemaValidator, ListSchemaValidator, MinlengthValidation1BoxedList>, MapSchemaValidator, MinlengthValidation1BoxedMap> { + /* + NOTE: This class is auto generated by OpenAPI JSON Schema Generator. + Ref: https://github.com/openapi-json-schema-tools/openapi-json-schema-generator + + Do not edit the class manually. + */ + + companion object { + @Volatile + private var instance: MinlengthValidation1? = null + + fun getInstance() = + instance ?: synchronized(this) { + instance ?: MinlengthValidation1().also { instance = it } + } + } + + @Throws(ValidationException::class) + override fun validate(arg: Nothing?, configuration: SchemaConfiguration?): Nothing? { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validatedPathToSchemas = PathToSchemasMap() + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, LinkedHashSet()) + getPathToSchemas(this, castArg, validationMetadata, pathSet) + return castArg + } + + @Throws(ValidationException::class) + override fun validate(arg: Boolean, configuration: SchemaConfiguration?): Boolean { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validatedPathToSchemas = PathToSchemasMap() + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, LinkedHashSet()) + getPathToSchemas(this, castArg, validationMetadata, pathSet) + return castArg + } + + @Throws(ValidationException::class) + override fun validate(arg: Number, configuration: SchemaConfiguration?): Number { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validatedPathToSchemas = PathToSchemasMap() + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, LinkedHashSet()) + getPathToSchemas(this, castArg, validationMetadata, pathSet) + return castArg + } + + @Throws(ValidationException::class) + fun validate(arg: Int, configuration: SchemaConfiguration?): Int { + return validate(arg as Number, configuration) as Int + } + + @Throws(ValidationException::class) + fun validate(arg: Long, configuration: SchemaConfiguration?): Long { + return validate(arg as Number, configuration) as Long + } + + @Throws(ValidationException::class) + fun validate(arg: Float, configuration: SchemaConfiguration?): Float { + return validate(arg as Number, configuration) as Float + } + + @Throws(ValidationException::class) + fun validate(arg: Double, configuration: SchemaConfiguration?): Double { + return validate(arg as Number, configuration) as Double + } + + @Throws(ValidationException::class) + override fun validate(arg: String, configuration: SchemaConfiguration?): String { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validatedPathToSchemas = PathToSchemasMap() + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, LinkedHashSet()) + getPathToSchemas(this, castArg, validationMetadata, pathSet) + return castArg + } + + @Throws(ValidationException::class) + fun validate(arg: LocalDate, configuration: SchemaConfiguration?): String { + return validate(arg.toString(), configuration) + } + + @Throws(ValidationException::class) + fun validate(arg: ZonedDateTime, configuration: SchemaConfiguration?): String { + return validate(arg.toString(), configuration) + } + + @Throws(ValidationException::class) + fun validate(arg: UUID, configuration: SchemaConfiguration?): String { + return validate(arg.toString(), configuration) + } + + override fun getNewInstance(arg: List<*>, pathToItem: List, pathToSchemas: PathToSchemasMap): FrozenList { + val items: MutableList = ArrayList() + var i: Int = 0 + for (item: Any? in arg) { + val itemPathToItem = pathToItem + i + val schemas: LinkedHashMap, Nothing?>? = pathToSchemas.get(itemPathToItem) + if (schemas == null) { + throw RuntimeException("Validation result is invalid, schemas must exist for a pathToItem") + } + val itemSchema: JsonSchema<*> = schemas.entries.iterator().next().key + val itemInstance: Any? = itemSchema.getNewInstance(item, itemPathToItem, pathToSchemas) + items.add(itemInstance) + i += 1 + } + val newInstanceItems: FrozenList = FrozenList(items) + return newInstanceItems + } + + @Throws(ValidationException::class) + override fun validate(arg: List<*>, configuration: SchemaConfiguration?): FrozenList { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, PathToSchemasMap(), LinkedHashSet()) + val pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet) + return getNewInstance(castArg, validationMetadata.pathToItem, pathToSchemasMap) + } + + override fun getNewInstance(arg: Map<*, *>, pathToItem: List, pathToSchemas: PathToSchemasMap): FrozenMap { + val properties: LinkedHashMap = LinkedHashMap() + for((propertyName, value) in arg) { + if (!(propertyName is String)) { + throw RuntimeException("Invalid non-string key value") + } + val propertyPathToItem: List = pathToItem + propertyName + val schemas: LinkedHashMap, Nothing?>? = pathToSchemas.get(propertyPathToItem) + if (schemas == null) { + throw RuntimeException("Validation result is invalid, schemas must exist for a pathToItem") + } + val propertySchema: JsonSchema<*> = schemas.entries.iterator().next().key + val propertyInstance: Any? = propertySchema.getNewInstance(value, propertyPathToItem, pathToSchemas) + properties[propertyName] = propertyInstance + } + val castProperties: FrozenMap = FrozenMap(properties) + return castProperties + } + + @Throws(ValidationException::class) + override fun validate(arg: Map<*, *>, configuration: SchemaConfiguration?): FrozenMap { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validatedPathToSchemas = PathToSchemasMap() + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, LinkedHashSet()) + val pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet) + return getNewInstance(castArg, validationMetadata.pathToItem, pathToSchemasMap) + } + + @Throws(ValidationException::class) + override fun validate(arg: Any?, configuration: SchemaConfiguration?): Any? { + if (arg == null) { + return validate(null, configuration) + } else if (arg is Boolean) { + return validate(arg, configuration) + } else if (arg is Number) { + return validate(arg, configuration) + } else if (arg is String) { + return validate(arg, configuration) + } else if (arg is List<*>) { + return validate(arg, configuration) + } else if (arg is Map<*, *>) { + return validate(arg, configuration) + } + throw ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema") + } + override fun getNewInstance(arg: Any?, pathToItem: List, pathToSchemas: PathToSchemasMap): Any? { + if (arg == null) { + return getNewInstance( null, pathToItem, pathToSchemas) + } else if (arg is Boolean) { + return getNewInstance(arg, pathToItem, pathToSchemas) + } else if (arg is Number) { + return getNewInstance(arg, pathToItem, pathToSchemas) + } else if (arg is String) { + return getNewInstance(arg, pathToItem, pathToSchemas) + } else if (arg is List<*>) { + return getNewInstance(arg, pathToItem, pathToSchemas) + } else if (arg is Map<*, *>) { + return getNewInstance(arg, pathToItem, pathToSchemas) + } + throw RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema") + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: Nothing?, configuration: SchemaConfiguration?): MinlengthValidation1BoxedVoid { + return MinlengthValidation1BoxedVoid(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: Boolean, configuration: SchemaConfiguration?): MinlengthValidation1BoxedBoolean { + return MinlengthValidation1BoxedBoolean(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: Number, configuration: SchemaConfiguration?): MinlengthValidation1BoxedNumber { + return MinlengthValidation1BoxedNumber(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: String, configuration: SchemaConfiguration?): MinlengthValidation1BoxedString { + return MinlengthValidation1BoxedString(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: List<*>, configuration: SchemaConfiguration?): MinlengthValidation1BoxedList { + return MinlengthValidation1BoxedList(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: Map<*, *>, configuration: SchemaConfiguration?): MinlengthValidation1BoxedMap { + return MinlengthValidation1BoxedMap(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: Any?, configuration: SchemaConfiguration?): MinlengthValidation1Boxed { + if (arg == null) { + return validateAndBox(null, configuration) + } else if (arg is Boolean) { + return validateAndBox(arg, configuration) + } else if (arg is String) { + return validateAndBox(arg, configuration) + } else if (arg is Number) { + return validateAndBox(arg, configuration) + } else if (arg is List<*>) { + return validateAndBox(arg, configuration) + } else if (arg is Map<*, *>) { + return validateAndBox(arg, configuration) + } + throw ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema") + } + } +} diff --git a/samples/client/3_1_0_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/schemas/MinpropertiesValidation.kt b/samples/client/3_1_0_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/schemas/MinpropertiesValidation.kt new file mode 100644 index 00000000000..bb29435be31 --- /dev/null +++ b/samples/client/3_1_0_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/schemas/MinpropertiesValidation.kt @@ -0,0 +1,308 @@ +package org.openapijsonschematools.client.components.schemas +import java.time.LocalDate +import java.time.ZonedDateTime +import java.util.UUID +import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags +import org.openapijsonschematools.client.configurations.SchemaConfiguration +import org.openapijsonschematools.client.exceptions.InvalidAdditionalPropertyException +import org.openapijsonschematools.client.exceptions.UnsetPropertyException +import org.openapijsonschematools.client.exceptions.ValidationException +import org.openapijsonschematools.client.schemas.UnsetAddPropsSetter +import org.openapijsonschematools.client.schemas.validation.BooleanSchemaValidator +import org.openapijsonschematools.client.schemas.validation.FrozenList +import org.openapijsonschematools.client.schemas.validation.FrozenMap +import org.openapijsonschematools.client.schemas.validation.JsonSchema +import org.openapijsonschematools.client.schemas.validation.JsonSchemaInfo +import org.openapijsonschematools.client.schemas.validation.ListSchemaValidator +import org.openapijsonschematools.client.schemas.validation.MapSchemaValidator +import org.openapijsonschematools.client.schemas.validation.NullSchemaValidator +import org.openapijsonschematools.client.schemas.validation.NumberSchemaValidator +import org.openapijsonschematools.client.schemas.validation.PathToSchemasMap +import org.openapijsonschematools.client.schemas.validation.StringSchemaValidator +import org.openapijsonschematools.client.schemas.validation.ValidationMetadata + +class MinpropertiesValidation { + // nest classes so all schemas and input/output classes can be public + + + sealed interface MinpropertiesValidation1Boxed { + fun getData(): Any? + } + + data class MinpropertiesValidation1BoxedVoid(val data: Nothing?) : MinpropertiesValidation1Boxed { + override fun getData(): Any? { + return data + } + } + + data class MinpropertiesValidation1BoxedBoolean(val data: Boolean): MinpropertiesValidation1Boxed { + override fun getData(): Any? { + return data + } + } + + data class MinpropertiesValidation1BoxedNumber(val data: Number) : MinpropertiesValidation1Boxed { + override fun getData(): Any? { + return data + } + } + + data class MinpropertiesValidation1BoxedString(val data: String) : MinpropertiesValidation1Boxed { + override fun getData(): Any? { + return data + } + } + + data class MinpropertiesValidation1BoxedList(val data: FrozenList) : MinpropertiesValidation1Boxed { + override fun getData(): Any? { + return data + } + } + + data class MinpropertiesValidation1BoxedMap(val data: FrozenMap) : MinpropertiesValidation1Boxed { + override fun getData(): Any? { + return data + } + } + + + class MinpropertiesValidation1 private constructor(): JsonSchema( + JsonSchemaInfo() + .minProperties(1) + ), NullSchemaValidator, BooleanSchemaValidator, NumberSchemaValidator, StringSchemaValidator, ListSchemaValidator, MinpropertiesValidation1BoxedList>, MapSchemaValidator, MinpropertiesValidation1BoxedMap> { + /* + NOTE: This class is auto generated by OpenAPI JSON Schema Generator. + Ref: https://github.com/openapi-json-schema-tools/openapi-json-schema-generator + + Do not edit the class manually. + */ + + companion object { + @Volatile + private var instance: MinpropertiesValidation1? = null + + fun getInstance() = + instance ?: synchronized(this) { + instance ?: MinpropertiesValidation1().also { instance = it } + } + } + + @Throws(ValidationException::class) + override fun validate(arg: Nothing?, configuration: SchemaConfiguration?): Nothing? { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validatedPathToSchemas = PathToSchemasMap() + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, LinkedHashSet()) + getPathToSchemas(this, castArg, validationMetadata, pathSet) + return castArg + } + + @Throws(ValidationException::class) + override fun validate(arg: Boolean, configuration: SchemaConfiguration?): Boolean { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validatedPathToSchemas = PathToSchemasMap() + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, LinkedHashSet()) + getPathToSchemas(this, castArg, validationMetadata, pathSet) + return castArg + } + + @Throws(ValidationException::class) + override fun validate(arg: Number, configuration: SchemaConfiguration?): Number { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validatedPathToSchemas = PathToSchemasMap() + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, LinkedHashSet()) + getPathToSchemas(this, castArg, validationMetadata, pathSet) + return castArg + } + + @Throws(ValidationException::class) + fun validate(arg: Int, configuration: SchemaConfiguration?): Int { + return validate(arg as Number, configuration) as Int + } + + @Throws(ValidationException::class) + fun validate(arg: Long, configuration: SchemaConfiguration?): Long { + return validate(arg as Number, configuration) as Long + } + + @Throws(ValidationException::class) + fun validate(arg: Float, configuration: SchemaConfiguration?): Float { + return validate(arg as Number, configuration) as Float + } + + @Throws(ValidationException::class) + fun validate(arg: Double, configuration: SchemaConfiguration?): Double { + return validate(arg as Number, configuration) as Double + } + + @Throws(ValidationException::class) + override fun validate(arg: String, configuration: SchemaConfiguration?): String { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validatedPathToSchemas = PathToSchemasMap() + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, LinkedHashSet()) + getPathToSchemas(this, castArg, validationMetadata, pathSet) + return castArg + } + + @Throws(ValidationException::class) + fun validate(arg: LocalDate, configuration: SchemaConfiguration?): String { + return validate(arg.toString(), configuration) + } + + @Throws(ValidationException::class) + fun validate(arg: ZonedDateTime, configuration: SchemaConfiguration?): String { + return validate(arg.toString(), configuration) + } + + @Throws(ValidationException::class) + fun validate(arg: UUID, configuration: SchemaConfiguration?): String { + return validate(arg.toString(), configuration) + } + + override fun getNewInstance(arg: List<*>, pathToItem: List, pathToSchemas: PathToSchemasMap): FrozenList { + val items: MutableList = ArrayList() + var i: Int = 0 + for (item: Any? in arg) { + val itemPathToItem = pathToItem + i + val schemas: LinkedHashMap, Nothing?>? = pathToSchemas.get(itemPathToItem) + if (schemas == null) { + throw RuntimeException("Validation result is invalid, schemas must exist for a pathToItem") + } + val itemSchema: JsonSchema<*> = schemas.entries.iterator().next().key + val itemInstance: Any? = itemSchema.getNewInstance(item, itemPathToItem, pathToSchemas) + items.add(itemInstance) + i += 1 + } + val newInstanceItems: FrozenList = FrozenList(items) + return newInstanceItems + } + + @Throws(ValidationException::class) + override fun validate(arg: List<*>, configuration: SchemaConfiguration?): FrozenList { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, PathToSchemasMap(), LinkedHashSet()) + val pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet) + return getNewInstance(castArg, validationMetadata.pathToItem, pathToSchemasMap) + } + + override fun getNewInstance(arg: Map<*, *>, pathToItem: List, pathToSchemas: PathToSchemasMap): FrozenMap { + val properties: LinkedHashMap = LinkedHashMap() + for((propertyName, value) in arg) { + if (!(propertyName is String)) { + throw RuntimeException("Invalid non-string key value") + } + val propertyPathToItem: List = pathToItem + propertyName + val schemas: LinkedHashMap, Nothing?>? = pathToSchemas.get(propertyPathToItem) + if (schemas == null) { + throw RuntimeException("Validation result is invalid, schemas must exist for a pathToItem") + } + val propertySchema: JsonSchema<*> = schemas.entries.iterator().next().key + val propertyInstance: Any? = propertySchema.getNewInstance(value, propertyPathToItem, pathToSchemas) + properties[propertyName] = propertyInstance + } + val castProperties: FrozenMap = FrozenMap(properties) + return castProperties + } + + @Throws(ValidationException::class) + override fun validate(arg: Map<*, *>, configuration: SchemaConfiguration?): FrozenMap { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validatedPathToSchemas = PathToSchemasMap() + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, LinkedHashSet()) + val pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet) + return getNewInstance(castArg, validationMetadata.pathToItem, pathToSchemasMap) + } + + @Throws(ValidationException::class) + override fun validate(arg: Any?, configuration: SchemaConfiguration?): Any? { + if (arg == null) { + return validate(null, configuration) + } else if (arg is Boolean) { + return validate(arg, configuration) + } else if (arg is Number) { + return validate(arg, configuration) + } else if (arg is String) { + return validate(arg, configuration) + } else if (arg is List<*>) { + return validate(arg, configuration) + } else if (arg is Map<*, *>) { + return validate(arg, configuration) + } + throw ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema") + } + override fun getNewInstance(arg: Any?, pathToItem: List, pathToSchemas: PathToSchemasMap): Any? { + if (arg == null) { + return getNewInstance( null, pathToItem, pathToSchemas) + } else if (arg is Boolean) { + return getNewInstance(arg, pathToItem, pathToSchemas) + } else if (arg is Number) { + return getNewInstance(arg, pathToItem, pathToSchemas) + } else if (arg is String) { + return getNewInstance(arg, pathToItem, pathToSchemas) + } else if (arg is List<*>) { + return getNewInstance(arg, pathToItem, pathToSchemas) + } else if (arg is Map<*, *>) { + return getNewInstance(arg, pathToItem, pathToSchemas) + } + throw RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema") + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: Nothing?, configuration: SchemaConfiguration?): MinpropertiesValidation1BoxedVoid { + return MinpropertiesValidation1BoxedVoid(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: Boolean, configuration: SchemaConfiguration?): MinpropertiesValidation1BoxedBoolean { + return MinpropertiesValidation1BoxedBoolean(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: Number, configuration: SchemaConfiguration?): MinpropertiesValidation1BoxedNumber { + return MinpropertiesValidation1BoxedNumber(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: String, configuration: SchemaConfiguration?): MinpropertiesValidation1BoxedString { + return MinpropertiesValidation1BoxedString(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: List<*>, configuration: SchemaConfiguration?): MinpropertiesValidation1BoxedList { + return MinpropertiesValidation1BoxedList(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: Map<*, *>, configuration: SchemaConfiguration?): MinpropertiesValidation1BoxedMap { + return MinpropertiesValidation1BoxedMap(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: Any?, configuration: SchemaConfiguration?): MinpropertiesValidation1Boxed { + if (arg == null) { + return validateAndBox(null, configuration) + } else if (arg is Boolean) { + return validateAndBox(arg, configuration) + } else if (arg is String) { + return validateAndBox(arg, configuration) + } else if (arg is Number) { + return validateAndBox(arg, configuration) + } else if (arg is List<*>) { + return validateAndBox(arg, configuration) + } else if (arg is Map<*, *>) { + return validateAndBox(arg, configuration) + } + throw ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema") + } + } +} diff --git a/samples/client/3_1_0_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/schemas/MultipleDependentsRequired.kt b/samples/client/3_1_0_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/schemas/MultipleDependentsRequired.kt new file mode 100644 index 00000000000..19ff14b3e8d --- /dev/null +++ b/samples/client/3_1_0_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/schemas/MultipleDependentsRequired.kt @@ -0,0 +1,318 @@ +package org.openapijsonschematools.client.components.schemas +import java.time.LocalDate +import java.time.ZonedDateTime +import java.util.AbstractMap +import java.util.UUID +import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags +import org.openapijsonschematools.client.configurations.SchemaConfiguration +import org.openapijsonschematools.client.exceptions.InvalidAdditionalPropertyException +import org.openapijsonschematools.client.exceptions.UnsetPropertyException +import org.openapijsonschematools.client.exceptions.ValidationException +import org.openapijsonschematools.client.schemas.UnsetAddPropsSetter +import org.openapijsonschematools.client.schemas.validation.BooleanSchemaValidator +import org.openapijsonschematools.client.schemas.validation.FrozenList +import org.openapijsonschematools.client.schemas.validation.FrozenMap +import org.openapijsonschematools.client.schemas.validation.JsonSchema +import org.openapijsonschematools.client.schemas.validation.JsonSchemaInfo +import org.openapijsonschematools.client.schemas.validation.ListSchemaValidator +import org.openapijsonschematools.client.schemas.validation.MapSchemaValidator +import org.openapijsonschematools.client.schemas.validation.MapUtils +import org.openapijsonschematools.client.schemas.validation.NullSchemaValidator +import org.openapijsonschematools.client.schemas.validation.NumberSchemaValidator +import org.openapijsonschematools.client.schemas.validation.PathToSchemasMap +import org.openapijsonschematools.client.schemas.validation.StringSchemaValidator +import org.openapijsonschematools.client.schemas.validation.ValidationMetadata + +class MultipleDependentsRequired { + // nest classes so all schemas and input/output classes can be public + + + sealed interface MultipleDependentsRequired1Boxed { + fun getData(): Any? + } + + data class MultipleDependentsRequired1BoxedVoid(val data: Nothing?) : MultipleDependentsRequired1Boxed { + override fun getData(): Any? { + return data + } + } + + data class MultipleDependentsRequired1BoxedBoolean(val data: Boolean): MultipleDependentsRequired1Boxed { + override fun getData(): Any? { + return data + } + } + + data class MultipleDependentsRequired1BoxedNumber(val data: Number) : MultipleDependentsRequired1Boxed { + override fun getData(): Any? { + return data + } + } + + data class MultipleDependentsRequired1BoxedString(val data: String) : MultipleDependentsRequired1Boxed { + override fun getData(): Any? { + return data + } + } + + data class MultipleDependentsRequired1BoxedList(val data: FrozenList) : MultipleDependentsRequired1Boxed { + override fun getData(): Any? { + return data + } + } + + data class MultipleDependentsRequired1BoxedMap(val data: FrozenMap) : MultipleDependentsRequired1Boxed { + override fun getData(): Any? { + return data + } + } + + + class MultipleDependentsRequired1 private constructor(): JsonSchema( + JsonSchemaInfo() + .dependentRequired(MapUtils.makeMap( + new AbstractMap.SimpleEntry<>( + "quux", + setOf( + "foo", + "bar" + ) + ) + )) + ), NullSchemaValidator, BooleanSchemaValidator, NumberSchemaValidator, StringSchemaValidator, ListSchemaValidator, MultipleDependentsRequired1BoxedList>, MapSchemaValidator, MultipleDependentsRequired1BoxedMap> { + /* + NOTE: This class is auto generated by OpenAPI JSON Schema Generator. + Ref: https://github.com/openapi-json-schema-tools/openapi-json-schema-generator + + Do not edit the class manually. + */ + + companion object { + @Volatile + private var instance: MultipleDependentsRequired1? = null + + fun getInstance() = + instance ?: synchronized(this) { + instance ?: MultipleDependentsRequired1().also { instance = it } + } + } + + @Throws(ValidationException::class) + override fun validate(arg: Nothing?, configuration: SchemaConfiguration?): Nothing? { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validatedPathToSchemas = PathToSchemasMap() + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, LinkedHashSet()) + getPathToSchemas(this, castArg, validationMetadata, pathSet) + return castArg + } + + @Throws(ValidationException::class) + override fun validate(arg: Boolean, configuration: SchemaConfiguration?): Boolean { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validatedPathToSchemas = PathToSchemasMap() + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, LinkedHashSet()) + getPathToSchemas(this, castArg, validationMetadata, pathSet) + return castArg + } + + @Throws(ValidationException::class) + override fun validate(arg: Number, configuration: SchemaConfiguration?): Number { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validatedPathToSchemas = PathToSchemasMap() + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, LinkedHashSet()) + getPathToSchemas(this, castArg, validationMetadata, pathSet) + return castArg + } + + @Throws(ValidationException::class) + fun validate(arg: Int, configuration: SchemaConfiguration?): Int { + return validate(arg as Number, configuration) as Int + } + + @Throws(ValidationException::class) + fun validate(arg: Long, configuration: SchemaConfiguration?): Long { + return validate(arg as Number, configuration) as Long + } + + @Throws(ValidationException::class) + fun validate(arg: Float, configuration: SchemaConfiguration?): Float { + return validate(arg as Number, configuration) as Float + } + + @Throws(ValidationException::class) + fun validate(arg: Double, configuration: SchemaConfiguration?): Double { + return validate(arg as Number, configuration) as Double + } + + @Throws(ValidationException::class) + override fun validate(arg: String, configuration: SchemaConfiguration?): String { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validatedPathToSchemas = PathToSchemasMap() + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, LinkedHashSet()) + getPathToSchemas(this, castArg, validationMetadata, pathSet) + return castArg + } + + @Throws(ValidationException::class) + fun validate(arg: LocalDate, configuration: SchemaConfiguration?): String { + return validate(arg.toString(), configuration) + } + + @Throws(ValidationException::class) + fun validate(arg: ZonedDateTime, configuration: SchemaConfiguration?): String { + return validate(arg.toString(), configuration) + } + + @Throws(ValidationException::class) + fun validate(arg: UUID, configuration: SchemaConfiguration?): String { + return validate(arg.toString(), configuration) + } + + override fun getNewInstance(arg: List<*>, pathToItem: List, pathToSchemas: PathToSchemasMap): FrozenList { + val items: MutableList = ArrayList() + var i: Int = 0 + for (item: Any? in arg) { + val itemPathToItem = pathToItem + i + val schemas: LinkedHashMap, Nothing?>? = pathToSchemas.get(itemPathToItem) + if (schemas == null) { + throw RuntimeException("Validation result is invalid, schemas must exist for a pathToItem") + } + val itemSchema: JsonSchema<*> = schemas.entries.iterator().next().key + val itemInstance: Any? = itemSchema.getNewInstance(item, itemPathToItem, pathToSchemas) + items.add(itemInstance) + i += 1 + } + val newInstanceItems: FrozenList = FrozenList(items) + return newInstanceItems + } + + @Throws(ValidationException::class) + override fun validate(arg: List<*>, configuration: SchemaConfiguration?): FrozenList { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, PathToSchemasMap(), LinkedHashSet()) + val pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet) + return getNewInstance(castArg, validationMetadata.pathToItem, pathToSchemasMap) + } + + override fun getNewInstance(arg: Map<*, *>, pathToItem: List, pathToSchemas: PathToSchemasMap): FrozenMap { + val properties: LinkedHashMap = LinkedHashMap() + for((propertyName, value) in arg) { + if (!(propertyName is String)) { + throw RuntimeException("Invalid non-string key value") + } + val propertyPathToItem: List = pathToItem + propertyName + val schemas: LinkedHashMap, Nothing?>? = pathToSchemas.get(propertyPathToItem) + if (schemas == null) { + throw RuntimeException("Validation result is invalid, schemas must exist for a pathToItem") + } + val propertySchema: JsonSchema<*> = schemas.entries.iterator().next().key + val propertyInstance: Any? = propertySchema.getNewInstance(value, propertyPathToItem, pathToSchemas) + properties[propertyName] = propertyInstance + } + val castProperties: FrozenMap = FrozenMap(properties) + return castProperties + } + + @Throws(ValidationException::class) + override fun validate(arg: Map<*, *>, configuration: SchemaConfiguration?): FrozenMap { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validatedPathToSchemas = PathToSchemasMap() + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, LinkedHashSet()) + val pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet) + return getNewInstance(castArg, validationMetadata.pathToItem, pathToSchemasMap) + } + + @Throws(ValidationException::class) + override fun validate(arg: Any?, configuration: SchemaConfiguration?): Any? { + if (arg == null) { + return validate(null, configuration) + } else if (arg is Boolean) { + return validate(arg, configuration) + } else if (arg is Number) { + return validate(arg, configuration) + } else if (arg is String) { + return validate(arg, configuration) + } else if (arg is List<*>) { + return validate(arg, configuration) + } else if (arg is Map<*, *>) { + return validate(arg, configuration) + } + throw ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema") + } + override fun getNewInstance(arg: Any?, pathToItem: List, pathToSchemas: PathToSchemasMap): Any? { + if (arg == null) { + return getNewInstance( null, pathToItem, pathToSchemas) + } else if (arg is Boolean) { + return getNewInstance(arg, pathToItem, pathToSchemas) + } else if (arg is Number) { + return getNewInstance(arg, pathToItem, pathToSchemas) + } else if (arg is String) { + return getNewInstance(arg, pathToItem, pathToSchemas) + } else if (arg is List<*>) { + return getNewInstance(arg, pathToItem, pathToSchemas) + } else if (arg is Map<*, *>) { + return getNewInstance(arg, pathToItem, pathToSchemas) + } + throw RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema") + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: Nothing?, configuration: SchemaConfiguration?): MultipleDependentsRequired1BoxedVoid { + return MultipleDependentsRequired1BoxedVoid(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: Boolean, configuration: SchemaConfiguration?): MultipleDependentsRequired1BoxedBoolean { + return MultipleDependentsRequired1BoxedBoolean(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: Number, configuration: SchemaConfiguration?): MultipleDependentsRequired1BoxedNumber { + return MultipleDependentsRequired1BoxedNumber(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: String, configuration: SchemaConfiguration?): MultipleDependentsRequired1BoxedString { + return MultipleDependentsRequired1BoxedString(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: List<*>, configuration: SchemaConfiguration?): MultipleDependentsRequired1BoxedList { + return MultipleDependentsRequired1BoxedList(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: Map<*, *>, configuration: SchemaConfiguration?): MultipleDependentsRequired1BoxedMap { + return MultipleDependentsRequired1BoxedMap(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: Any?, configuration: SchemaConfiguration?): MultipleDependentsRequired1Boxed { + if (arg == null) { + return validateAndBox(null, configuration) + } else if (arg is Boolean) { + return validateAndBox(arg, configuration) + } else if (arg is String) { + return validateAndBox(arg, configuration) + } else if (arg is Number) { + return validateAndBox(arg, configuration) + } else if (arg is List<*>) { + return validateAndBox(arg, configuration) + } else if (arg is Map<*, *>) { + return validateAndBox(arg, configuration) + } + throw ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema") + } + } +} diff --git a/samples/client/3_1_0_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/schemas/MultipleSimultaneousPatternpropertiesAreValidated.kt b/samples/client/3_1_0_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/schemas/MultipleSimultaneousPatternpropertiesAreValidated.kt new file mode 100644 index 00000000000..fc15a60e8f9 --- /dev/null +++ b/samples/client/3_1_0_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/schemas/MultipleSimultaneousPatternpropertiesAreValidated.kt @@ -0,0 +1,602 @@ +package org.openapijsonschematools.client.components.schemas +import java.time.LocalDate +import java.time.ZonedDateTime +import java.util.AbstractMap +import java.util.UUID +import java.util.regex.Pattern +import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags +import org.openapijsonschematools.client.configurations.SchemaConfiguration +import org.openapijsonschematools.client.exceptions.InvalidAdditionalPropertyException +import org.openapijsonschematools.client.exceptions.UnsetPropertyException +import org.openapijsonschematools.client.exceptions.ValidationException +import org.openapijsonschematools.client.schemas.IntJsonSchema +import org.openapijsonschematools.client.schemas.UnsetAddPropsSetter +import org.openapijsonschematools.client.schemas.validation.BooleanSchemaValidator +import org.openapijsonschematools.client.schemas.validation.FrozenList +import org.openapijsonschematools.client.schemas.validation.FrozenMap +import org.openapijsonschematools.client.schemas.validation.JsonSchema +import org.openapijsonschematools.client.schemas.validation.JsonSchemaInfo +import org.openapijsonschematools.client.schemas.validation.ListSchemaValidator +import org.openapijsonschematools.client.schemas.validation.MapSchemaValidator +import org.openapijsonschematools.client.schemas.validation.NullSchemaValidator +import org.openapijsonschematools.client.schemas.validation.NumberSchemaValidator +import org.openapijsonschematools.client.schemas.validation.PathToSchemasMap +import org.openapijsonschematools.client.schemas.validation.StringSchemaValidator +import org.openapijsonschematools.client.schemas.validation.ValidationMetadata + +class MultipleSimultaneousPatternpropertiesAreValidated { + // nest classes so all schemas and input/output classes can be public + + + class A : IntJsonSchema.IntJsonSchema1() { + companion object { + @Volatile + private var instance: A? = null + + fun getInstance() = + instance ?: synchronized(this) { + instance ?: A().also { instance = it } + } + } + } + + + sealed interface AaaBoxed { + fun getData(): Any? + } + + data class AaaBoxedVoid(val data: Nothing?) : AaaBoxed { + override fun getData(): Any? { + return data + } + } + + data class AaaBoxedBoolean(val data: Boolean): AaaBoxed { + override fun getData(): Any? { + return data + } + } + + data class AaaBoxedNumber(val data: Number) : AaaBoxed { + override fun getData(): Any? { + return data + } + } + + data class AaaBoxedString(val data: String) : AaaBoxed { + override fun getData(): Any? { + return data + } + } + + data class AaaBoxedList(val data: FrozenList) : AaaBoxed { + override fun getData(): Any? { + return data + } + } + + data class AaaBoxedMap(val data: FrozenMap) : AaaBoxed { + override fun getData(): Any? { + return data + } + } + + + class Aaa private constructor(): JsonSchema( + JsonSchemaInfo() + .maximum(20) + ), NullSchemaValidator, BooleanSchemaValidator, NumberSchemaValidator, StringSchemaValidator, ListSchemaValidator, AaaBoxedList>, MapSchemaValidator, AaaBoxedMap> { + + companion object { + @Volatile + private var instance: Aaa? = null + + fun getInstance() = + instance ?: synchronized(this) { + instance ?: Aaa().also { instance = it } + } + } + + @Throws(ValidationException::class) + override fun validate(arg: Nothing?, configuration: SchemaConfiguration?): Nothing? { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validatedPathToSchemas = PathToSchemasMap() + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, LinkedHashSet()) + getPathToSchemas(this, castArg, validationMetadata, pathSet) + return castArg + } + + @Throws(ValidationException::class) + override fun validate(arg: Boolean, configuration: SchemaConfiguration?): Boolean { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validatedPathToSchemas = PathToSchemasMap() + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, LinkedHashSet()) + getPathToSchemas(this, castArg, validationMetadata, pathSet) + return castArg + } + + @Throws(ValidationException::class) + override fun validate(arg: Number, configuration: SchemaConfiguration?): Number { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validatedPathToSchemas = PathToSchemasMap() + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, LinkedHashSet()) + getPathToSchemas(this, castArg, validationMetadata, pathSet) + return castArg + } + + @Throws(ValidationException::class) + fun validate(arg: Int, configuration: SchemaConfiguration?): Int { + return validate(arg as Number, configuration) as Int + } + + @Throws(ValidationException::class) + fun validate(arg: Long, configuration: SchemaConfiguration?): Long { + return validate(arg as Number, configuration) as Long + } + + @Throws(ValidationException::class) + fun validate(arg: Float, configuration: SchemaConfiguration?): Float { + return validate(arg as Number, configuration) as Float + } + + @Throws(ValidationException::class) + fun validate(arg: Double, configuration: SchemaConfiguration?): Double { + return validate(arg as Number, configuration) as Double + } + + @Throws(ValidationException::class) + override fun validate(arg: String, configuration: SchemaConfiguration?): String { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validatedPathToSchemas = PathToSchemasMap() + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, LinkedHashSet()) + getPathToSchemas(this, castArg, validationMetadata, pathSet) + return castArg + } + + @Throws(ValidationException::class) + fun validate(arg: LocalDate, configuration: SchemaConfiguration?): String { + return validate(arg.toString(), configuration) + } + + @Throws(ValidationException::class) + fun validate(arg: ZonedDateTime, configuration: SchemaConfiguration?): String { + return validate(arg.toString(), configuration) + } + + @Throws(ValidationException::class) + fun validate(arg: UUID, configuration: SchemaConfiguration?): String { + return validate(arg.toString(), configuration) + } + + override fun getNewInstance(arg: List<*>, pathToItem: List, pathToSchemas: PathToSchemasMap): FrozenList { + val items: MutableList = ArrayList() + var i: Int = 0 + for (item: Any? in arg) { + val itemPathToItem = pathToItem + i + val schemas: LinkedHashMap, Nothing?>? = pathToSchemas.get(itemPathToItem) + if (schemas == null) { + throw RuntimeException("Validation result is invalid, schemas must exist for a pathToItem") + } + val itemSchema: JsonSchema<*> = schemas.entries.iterator().next().key + val itemInstance: Any? = itemSchema.getNewInstance(item, itemPathToItem, pathToSchemas) + items.add(itemInstance) + i += 1 + } + val newInstanceItems: FrozenList = FrozenList(items) + return newInstanceItems + } + + @Throws(ValidationException::class) + override fun validate(arg: List<*>, configuration: SchemaConfiguration?): FrozenList { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, PathToSchemasMap(), LinkedHashSet()) + val pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet) + return getNewInstance(castArg, validationMetadata.pathToItem, pathToSchemasMap) + } + + override fun getNewInstance(arg: Map<*, *>, pathToItem: List, pathToSchemas: PathToSchemasMap): FrozenMap { + val properties: LinkedHashMap = LinkedHashMap() + for((propertyName, value) in arg) { + if (!(propertyName is String)) { + throw RuntimeException("Invalid non-string key value") + } + val propertyPathToItem: List = pathToItem + propertyName + val schemas: LinkedHashMap, Nothing?>? = pathToSchemas.get(propertyPathToItem) + if (schemas == null) { + throw RuntimeException("Validation result is invalid, schemas must exist for a pathToItem") + } + val propertySchema: JsonSchema<*> = schemas.entries.iterator().next().key + val propertyInstance: Any? = propertySchema.getNewInstance(value, propertyPathToItem, pathToSchemas) + properties[propertyName] = propertyInstance + } + val castProperties: FrozenMap = FrozenMap(properties) + return castProperties + } + + @Throws(ValidationException::class) + override fun validate(arg: Map<*, *>, configuration: SchemaConfiguration?): FrozenMap { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validatedPathToSchemas = PathToSchemasMap() + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, LinkedHashSet()) + val pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet) + return getNewInstance(castArg, validationMetadata.pathToItem, pathToSchemasMap) + } + + @Throws(ValidationException::class) + override fun validate(arg: Any?, configuration: SchemaConfiguration?): Any? { + if (arg == null) { + return validate(null, configuration) + } else if (arg is Boolean) { + return validate(arg, configuration) + } else if (arg is Number) { + return validate(arg, configuration) + } else if (arg is String) { + return validate(arg, configuration) + } else if (arg is List<*>) { + return validate(arg, configuration) + } else if (arg is Map<*, *>) { + return validate(arg, configuration) + } + throw ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema") + } + override fun getNewInstance(arg: Any?, pathToItem: List, pathToSchemas: PathToSchemasMap): Any? { + if (arg == null) { + return getNewInstance( null, pathToItem, pathToSchemas) + } else if (arg is Boolean) { + return getNewInstance(arg, pathToItem, pathToSchemas) + } else if (arg is Number) { + return getNewInstance(arg, pathToItem, pathToSchemas) + } else if (arg is String) { + return getNewInstance(arg, pathToItem, pathToSchemas) + } else if (arg is List<*>) { + return getNewInstance(arg, pathToItem, pathToSchemas) + } else if (arg is Map<*, *>) { + return getNewInstance(arg, pathToItem, pathToSchemas) + } + throw RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema") + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: Nothing?, configuration: SchemaConfiguration?): AaaBoxedVoid { + return AaaBoxedVoid(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: Boolean, configuration: SchemaConfiguration?): AaaBoxedBoolean { + return AaaBoxedBoolean(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: Number, configuration: SchemaConfiguration?): AaaBoxedNumber { + return AaaBoxedNumber(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: String, configuration: SchemaConfiguration?): AaaBoxedString { + return AaaBoxedString(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: List<*>, configuration: SchemaConfiguration?): AaaBoxedList { + return AaaBoxedList(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: Map<*, *>, configuration: SchemaConfiguration?): AaaBoxedMap { + return AaaBoxedMap(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: Any?, configuration: SchemaConfiguration?): AaaBoxed { + if (arg == null) { + return validateAndBox(null, configuration) + } else if (arg is Boolean) { + return validateAndBox(arg, configuration) + } else if (arg is String) { + return validateAndBox(arg, configuration) + } else if (arg is Number) { + return validateAndBox(arg, configuration) + } else if (arg is List<*>) { + return validateAndBox(arg, configuration) + } else if (arg is Map<*, *>) { + return validateAndBox(arg, configuration) + } + throw ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema") + } + } + + sealed interface MultipleSimultaneousPatternpropertiesAreValidated1Boxed { + fun getData(): Any? + } + + data class MultipleSimultaneousPatternpropertiesAreValidated1BoxedVoid(val data: Nothing?) : MultipleSimultaneousPatternpropertiesAreValidated1Boxed { + override fun getData(): Any? { + return data + } + } + + data class MultipleSimultaneousPatternpropertiesAreValidated1BoxedBoolean(val data: Boolean): MultipleSimultaneousPatternpropertiesAreValidated1Boxed { + override fun getData(): Any? { + return data + } + } + + data class MultipleSimultaneousPatternpropertiesAreValidated1BoxedNumber(val data: Number) : MultipleSimultaneousPatternpropertiesAreValidated1Boxed { + override fun getData(): Any? { + return data + } + } + + data class MultipleSimultaneousPatternpropertiesAreValidated1BoxedString(val data: String) : MultipleSimultaneousPatternpropertiesAreValidated1Boxed { + override fun getData(): Any? { + return data + } + } + + data class MultipleSimultaneousPatternpropertiesAreValidated1BoxedList(val data: FrozenList) : MultipleSimultaneousPatternpropertiesAreValidated1Boxed { + override fun getData(): Any? { + return data + } + } + + data class MultipleSimultaneousPatternpropertiesAreValidated1BoxedMap(val data: FrozenMap) : MultipleSimultaneousPatternpropertiesAreValidated1Boxed { + override fun getData(): Any? { + return data + } + } + + + class MultipleSimultaneousPatternpropertiesAreValidated1 private constructor(): JsonSchema( + JsonSchemaInfo() + .patternProperties(mapOf( + new AbstractMap.SimpleEntry<>(Pattern.compile("a*"), A::class.java), + new AbstractMap.SimpleEntry<>(Pattern.compile("aaa*"), Aaa::class.java) + )) + ), NullSchemaValidator, BooleanSchemaValidator, NumberSchemaValidator, StringSchemaValidator, ListSchemaValidator, MultipleSimultaneousPatternpropertiesAreValidated1BoxedList>, MapSchemaValidator, MultipleSimultaneousPatternpropertiesAreValidated1BoxedMap> { + /* + NOTE: This class is auto generated by OpenAPI JSON Schema Generator. + Ref: https://github.com/openapi-json-schema-tools/openapi-json-schema-generator + + Do not edit the class manually. + */ + + companion object { + @Volatile + private var instance: MultipleSimultaneousPatternpropertiesAreValidated1? = null + + fun getInstance() = + instance ?: synchronized(this) { + instance ?: MultipleSimultaneousPatternpropertiesAreValidated1().also { instance = it } + } + } + + @Throws(ValidationException::class) + override fun validate(arg: Nothing?, configuration: SchemaConfiguration?): Nothing? { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validatedPathToSchemas = PathToSchemasMap() + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, LinkedHashSet()) + getPathToSchemas(this, castArg, validationMetadata, pathSet) + return castArg + } + + @Throws(ValidationException::class) + override fun validate(arg: Boolean, configuration: SchemaConfiguration?): Boolean { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validatedPathToSchemas = PathToSchemasMap() + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, LinkedHashSet()) + getPathToSchemas(this, castArg, validationMetadata, pathSet) + return castArg + } + + @Throws(ValidationException::class) + override fun validate(arg: Number, configuration: SchemaConfiguration?): Number { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validatedPathToSchemas = PathToSchemasMap() + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, LinkedHashSet()) + getPathToSchemas(this, castArg, validationMetadata, pathSet) + return castArg + } + + @Throws(ValidationException::class) + fun validate(arg: Int, configuration: SchemaConfiguration?): Int { + return validate(arg as Number, configuration) as Int + } + + @Throws(ValidationException::class) + fun validate(arg: Long, configuration: SchemaConfiguration?): Long { + return validate(arg as Number, configuration) as Long + } + + @Throws(ValidationException::class) + fun validate(arg: Float, configuration: SchemaConfiguration?): Float { + return validate(arg as Number, configuration) as Float + } + + @Throws(ValidationException::class) + fun validate(arg: Double, configuration: SchemaConfiguration?): Double { + return validate(arg as Number, configuration) as Double + } + + @Throws(ValidationException::class) + override fun validate(arg: String, configuration: SchemaConfiguration?): String { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validatedPathToSchemas = PathToSchemasMap() + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, LinkedHashSet()) + getPathToSchemas(this, castArg, validationMetadata, pathSet) + return castArg + } + + @Throws(ValidationException::class) + fun validate(arg: LocalDate, configuration: SchemaConfiguration?): String { + return validate(arg.toString(), configuration) + } + + @Throws(ValidationException::class) + fun validate(arg: ZonedDateTime, configuration: SchemaConfiguration?): String { + return validate(arg.toString(), configuration) + } + + @Throws(ValidationException::class) + fun validate(arg: UUID, configuration: SchemaConfiguration?): String { + return validate(arg.toString(), configuration) + } + + override fun getNewInstance(arg: List<*>, pathToItem: List, pathToSchemas: PathToSchemasMap): FrozenList { + val items: MutableList = ArrayList() + var i: Int = 0 + for (item: Any? in arg) { + val itemPathToItem = pathToItem + i + val schemas: LinkedHashMap, Nothing?>? = pathToSchemas.get(itemPathToItem) + if (schemas == null) { + throw RuntimeException("Validation result is invalid, schemas must exist for a pathToItem") + } + val itemSchema: JsonSchema<*> = schemas.entries.iterator().next().key + val itemInstance: Any? = itemSchema.getNewInstance(item, itemPathToItem, pathToSchemas) + items.add(itemInstance) + i += 1 + } + val newInstanceItems: FrozenList = FrozenList(items) + return newInstanceItems + } + + @Throws(ValidationException::class) + override fun validate(arg: List<*>, configuration: SchemaConfiguration?): FrozenList { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, PathToSchemasMap(), LinkedHashSet()) + val pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet) + return getNewInstance(castArg, validationMetadata.pathToItem, pathToSchemasMap) + } + + override fun getNewInstance(arg: Map<*, *>, pathToItem: List, pathToSchemas: PathToSchemasMap): FrozenMap { + val properties: LinkedHashMap = LinkedHashMap() + for((propertyName, value) in arg) { + if (!(propertyName is String)) { + throw RuntimeException("Invalid non-string key value") + } + val propertyPathToItem: List = pathToItem + propertyName + val schemas: LinkedHashMap, Nothing?>? = pathToSchemas.get(propertyPathToItem) + if (schemas == null) { + throw RuntimeException("Validation result is invalid, schemas must exist for a pathToItem") + } + val propertySchema: JsonSchema<*> = schemas.entries.iterator().next().key + val propertyInstance: Any? = propertySchema.getNewInstance(value, propertyPathToItem, pathToSchemas) + properties[propertyName] = propertyInstance + } + val castProperties: FrozenMap = FrozenMap(properties) + return castProperties + } + + @Throws(ValidationException::class) + override fun validate(arg: Map<*, *>, configuration: SchemaConfiguration?): FrozenMap { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validatedPathToSchemas = PathToSchemasMap() + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, LinkedHashSet()) + val pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet) + return getNewInstance(castArg, validationMetadata.pathToItem, pathToSchemasMap) + } + + @Throws(ValidationException::class) + override fun validate(arg: Any?, configuration: SchemaConfiguration?): Any? { + if (arg == null) { + return validate(null, configuration) + } else if (arg is Boolean) { + return validate(arg, configuration) + } else if (arg is Number) { + return validate(arg, configuration) + } else if (arg is String) { + return validate(arg, configuration) + } else if (arg is List<*>) { + return validate(arg, configuration) + } else if (arg is Map<*, *>) { + return validate(arg, configuration) + } + throw ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema") + } + override fun getNewInstance(arg: Any?, pathToItem: List, pathToSchemas: PathToSchemasMap): Any? { + if (arg == null) { + return getNewInstance( null, pathToItem, pathToSchemas) + } else if (arg is Boolean) { + return getNewInstance(arg, pathToItem, pathToSchemas) + } else if (arg is Number) { + return getNewInstance(arg, pathToItem, pathToSchemas) + } else if (arg is String) { + return getNewInstance(arg, pathToItem, pathToSchemas) + } else if (arg is List<*>) { + return getNewInstance(arg, pathToItem, pathToSchemas) + } else if (arg is Map<*, *>) { + return getNewInstance(arg, pathToItem, pathToSchemas) + } + throw RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema") + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: Nothing?, configuration: SchemaConfiguration?): MultipleSimultaneousPatternpropertiesAreValidated1BoxedVoid { + return MultipleSimultaneousPatternpropertiesAreValidated1BoxedVoid(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: Boolean, configuration: SchemaConfiguration?): MultipleSimultaneousPatternpropertiesAreValidated1BoxedBoolean { + return MultipleSimultaneousPatternpropertiesAreValidated1BoxedBoolean(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: Number, configuration: SchemaConfiguration?): MultipleSimultaneousPatternpropertiesAreValidated1BoxedNumber { + return MultipleSimultaneousPatternpropertiesAreValidated1BoxedNumber(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: String, configuration: SchemaConfiguration?): MultipleSimultaneousPatternpropertiesAreValidated1BoxedString { + return MultipleSimultaneousPatternpropertiesAreValidated1BoxedString(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: List<*>, configuration: SchemaConfiguration?): MultipleSimultaneousPatternpropertiesAreValidated1BoxedList { + return MultipleSimultaneousPatternpropertiesAreValidated1BoxedList(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: Map<*, *>, configuration: SchemaConfiguration?): MultipleSimultaneousPatternpropertiesAreValidated1BoxedMap { + return MultipleSimultaneousPatternpropertiesAreValidated1BoxedMap(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: Any?, configuration: SchemaConfiguration?): MultipleSimultaneousPatternpropertiesAreValidated1Boxed { + if (arg == null) { + return validateAndBox(null, configuration) + } else if (arg is Boolean) { + return validateAndBox(arg, configuration) + } else if (arg is String) { + return validateAndBox(arg, configuration) + } else if (arg is Number) { + return validateAndBox(arg, configuration) + } else if (arg is List<*>) { + return validateAndBox(arg, configuration) + } else if (arg is Map<*, *>) { + return validateAndBox(arg, configuration) + } + throw ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema") + } + } +} diff --git a/samples/client/3_1_0_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/schemas/MultipleTypesCanBeSpecifiedInAnArray.kt b/samples/client/3_1_0_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/schemas/MultipleTypesCanBeSpecifiedInAnArray.kt new file mode 100644 index 00000000000..9c1dfe90e77 --- /dev/null +++ b/samples/client/3_1_0_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/schemas/MultipleTypesCanBeSpecifiedInAnArray.kt @@ -0,0 +1,139 @@ +package org.openapijsonschematools.client.components.schemas +import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags +import org.openapijsonschematools.client.configurations.SchemaConfiguration +import org.openapijsonschematools.client.exceptions.ValidationException +import org.openapijsonschematools.client.schemas.validation.JsonSchema +import org.openapijsonschematools.client.schemas.validation.JsonSchemaInfo +import org.openapijsonschematools.client.schemas.validation.NumberSchemaValidator +import org.openapijsonschematools.client.schemas.validation.PathToSchemasMap +import org.openapijsonschematools.client.schemas.validation.StringSchemaValidator +import org.openapijsonschematools.client.schemas.validation.ValidationMetadata + +class MultipleTypesCanBeSpecifiedInAnArray { + // nest classes so all schemas and input/output classes can be public + + + sealed interface MultipleTypesCanBeSpecifiedInAnArray1Boxed { + fun getData(): Any? + } + + data class MultipleTypesCanBeSpecifiedInAnArray1BoxedNumber(val data: Number) : MultipleTypesCanBeSpecifiedInAnArray1Boxed { + override fun getData(): Any? { + return data + } + } + + data class MultipleTypesCanBeSpecifiedInAnArray1BoxedString(val data: String) : MultipleTypesCanBeSpecifiedInAnArray1Boxed { + override fun getData(): Any? { + return data + } + } + + + + class MultipleTypesCanBeSpecifiedInAnArray1 private constructor(): JsonSchema( + JsonSchemaInfo() + .type(setOf( + Int::class.java, + Long::class.java, + Float::class.java, + Double::class.java, + String::class.java + )) + .format("int") + ), NumberSchemaValidator, StringSchemaValidator { + /* + NOTE: This class is auto generated by OpenAPI JSON Schema Generator. + Ref: https://github.com/openapi-json-schema-tools/openapi-json-schema-generator + + Do not edit the class manually. + */ + + companion object { + @Volatile + private var instance: MultipleTypesCanBeSpecifiedInAnArray1? = null + + fun getInstance() = + instance ?: synchronized(this) { + instance ?: MultipleTypesCanBeSpecifiedInAnArray1().also { instance = it } + } + } + + @Throws(ValidationException::class) + override fun validate(arg: Number, configuration: SchemaConfiguration?): Number { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, PathToSchemasMap(), LinkedHashSet()) + getPathToSchemas(this, castArg, validationMetadata, pathSet) + return castArg + } + + @Throws(ValidationException::class) + fun validate(arg: Int, configuration: SchemaConfiguration?): Int { + return validate(arg as Number, configuration) as Int + } + + @Throws(ValidationException::class) + fun validate(arg: Float, configuration: SchemaConfiguration?): Float { + return validate(arg as Number, configuration) as Float + } + + @Throws(ValidationException::class) + fun validate(arg: Long, configuration: SchemaConfiguration?): Long { + return validate(arg as Number, configuration) as Long + } + + @Throws(ValidationException::class) + fun validate(arg: Double, configuration: SchemaConfiguration?): Double { + return validate(arg as Number, configuration) as Double + } + + @Throws(ValidationException::class) + override fun validate(arg: String, configuration: SchemaConfiguration?): String { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, PathToSchemasMap(), LinkedHashSet()) + getPathToSchemas(this, castArg, validationMetadata, pathSet) + return castArg + } + + @Throws(ValidationException::class) + override fun validate(arg: Any?, configuration: SchemaConfiguration?): Any? { + if (arg is Number) { + return validate(arg, configuration) + } else if (arg is String) { + return validate(arg, configuration) + } + throw ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema") + } + override fun getNewInstance(arg: Any?, pathToItem: List, pathToSchemas: PathToSchemasMap): Any? { + if (arg is Number) { + return getNewInstance(arg, pathToItem, pathToSchemas) + } else if (arg is String) { + return getNewInstance(arg, pathToItem, pathToSchemas) + } + throw RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema") + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: Number, configuration: SchemaConfiguration?): MultipleTypesCanBeSpecifiedInAnArray1BoxedNumber { + return MultipleTypesCanBeSpecifiedInAnArray1BoxedNumber(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: String, configuration: SchemaConfiguration?): MultipleTypesCanBeSpecifiedInAnArray1BoxedString { + return MultipleTypesCanBeSpecifiedInAnArray1BoxedString(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: Any?, configuration: SchemaConfiguration?): MultipleTypesCanBeSpecifiedInAnArray1Boxed { + if (arg is Number) { + return validateAndBox(arg, configuration) + } else if (arg is String) { + return validateAndBox(arg, configuration) + } + throw ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema") + } + } +} diff --git a/samples/client/3_1_0_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/schemas/NestedAllofToCheckValidationSemantics.kt b/samples/client/3_1_0_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/schemas/NestedAllofToCheckValidationSemantics.kt new file mode 100644 index 00000000000..d2e2c14ae94 --- /dev/null +++ b/samples/client/3_1_0_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/schemas/NestedAllofToCheckValidationSemantics.kt @@ -0,0 +1,601 @@ +package org.openapijsonschematools.client.components.schemas +import java.time.LocalDate +import java.time.ZonedDateTime +import java.util.UUID +import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags +import org.openapijsonschematools.client.configurations.SchemaConfiguration +import org.openapijsonschematools.client.exceptions.InvalidAdditionalPropertyException +import org.openapijsonschematools.client.exceptions.UnsetPropertyException +import org.openapijsonschematools.client.exceptions.ValidationException +import org.openapijsonschematools.client.schemas.NullJsonSchema +import org.openapijsonschematools.client.schemas.UnsetAddPropsSetter +import org.openapijsonschematools.client.schemas.validation.BooleanSchemaValidator +import org.openapijsonschematools.client.schemas.validation.FrozenList +import org.openapijsonschematools.client.schemas.validation.FrozenMap +import org.openapijsonschematools.client.schemas.validation.JsonSchema +import org.openapijsonschematools.client.schemas.validation.JsonSchemaInfo +import org.openapijsonschematools.client.schemas.validation.ListSchemaValidator +import org.openapijsonschematools.client.schemas.validation.MapSchemaValidator +import org.openapijsonschematools.client.schemas.validation.NullSchemaValidator +import org.openapijsonschematools.client.schemas.validation.NumberSchemaValidator +import org.openapijsonschematools.client.schemas.validation.PathToSchemasMap +import org.openapijsonschematools.client.schemas.validation.StringSchemaValidator +import org.openapijsonschematools.client.schemas.validation.ValidationMetadata + +class NestedAllofToCheckValidationSemantics { + // nest classes so all schemas and input/output classes can be public + + + class Schema01 : NullJsonSchema.NullJsonSchema1() { + companion object { + @Volatile + private var instance: Schema01? = null + + fun getInstance() = + instance ?: synchronized(this) { + instance ?: Schema01().also { instance = it } + } + } + } + + + sealed interface Schema0Boxed { + fun getData(): Any? + } + + data class Schema0BoxedVoid(val data: Nothing?) : Schema0Boxed { + override fun getData(): Any? { + return data + } + } + + data class Schema0BoxedBoolean(val data: Boolean): Schema0Boxed { + override fun getData(): Any? { + return data + } + } + + data class Schema0BoxedNumber(val data: Number) : Schema0Boxed { + override fun getData(): Any? { + return data + } + } + + data class Schema0BoxedString(val data: String) : Schema0Boxed { + override fun getData(): Any? { + return data + } + } + + data class Schema0BoxedList(val data: FrozenList) : Schema0Boxed { + override fun getData(): Any? { + return data + } + } + + data class Schema0BoxedMap(val data: FrozenMap) : Schema0Boxed { + override fun getData(): Any? { + return data + } + } + + + class Schema0 private constructor(): JsonSchema( + JsonSchemaInfo() + .allOf(listOf( + Schema01::class.java + )) + ), NullSchemaValidator, BooleanSchemaValidator, NumberSchemaValidator, StringSchemaValidator, ListSchemaValidator, Schema0BoxedList>, MapSchemaValidator, Schema0BoxedMap> { + + companion object { + @Volatile + private var instance: Schema0? = null + + fun getInstance() = + instance ?: synchronized(this) { + instance ?: Schema0().also { instance = it } + } + } + + @Throws(ValidationException::class) + override fun validate(arg: Nothing?, configuration: SchemaConfiguration?): Nothing? { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validatedPathToSchemas = PathToSchemasMap() + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, LinkedHashSet()) + getPathToSchemas(this, castArg, validationMetadata, pathSet) + return castArg + } + + @Throws(ValidationException::class) + override fun validate(arg: Boolean, configuration: SchemaConfiguration?): Boolean { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validatedPathToSchemas = PathToSchemasMap() + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, LinkedHashSet()) + getPathToSchemas(this, castArg, validationMetadata, pathSet) + return castArg + } + + @Throws(ValidationException::class) + override fun validate(arg: Number, configuration: SchemaConfiguration?): Number { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validatedPathToSchemas = PathToSchemasMap() + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, LinkedHashSet()) + getPathToSchemas(this, castArg, validationMetadata, pathSet) + return castArg + } + + @Throws(ValidationException::class) + fun validate(arg: Int, configuration: SchemaConfiguration?): Int { + return validate(arg as Number, configuration) as Int + } + + @Throws(ValidationException::class) + fun validate(arg: Long, configuration: SchemaConfiguration?): Long { + return validate(arg as Number, configuration) as Long + } + + @Throws(ValidationException::class) + fun validate(arg: Float, configuration: SchemaConfiguration?): Float { + return validate(arg as Number, configuration) as Float + } + + @Throws(ValidationException::class) + fun validate(arg: Double, configuration: SchemaConfiguration?): Double { + return validate(arg as Number, configuration) as Double + } + + @Throws(ValidationException::class) + override fun validate(arg: String, configuration: SchemaConfiguration?): String { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validatedPathToSchemas = PathToSchemasMap() + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, LinkedHashSet()) + getPathToSchemas(this, castArg, validationMetadata, pathSet) + return castArg + } + + @Throws(ValidationException::class) + fun validate(arg: LocalDate, configuration: SchemaConfiguration?): String { + return validate(arg.toString(), configuration) + } + + @Throws(ValidationException::class) + fun validate(arg: ZonedDateTime, configuration: SchemaConfiguration?): String { + return validate(arg.toString(), configuration) + } + + @Throws(ValidationException::class) + fun validate(arg: UUID, configuration: SchemaConfiguration?): String { + return validate(arg.toString(), configuration) + } + + override fun getNewInstance(arg: List<*>, pathToItem: List, pathToSchemas: PathToSchemasMap): FrozenList { + val items: MutableList = ArrayList() + var i: Int = 0 + for (item: Any? in arg) { + val itemPathToItem = pathToItem + i + val schemas: LinkedHashMap, Nothing?>? = pathToSchemas.get(itemPathToItem) + if (schemas == null) { + throw RuntimeException("Validation result is invalid, schemas must exist for a pathToItem") + } + val itemSchema: JsonSchema<*> = schemas.entries.iterator().next().key + val itemInstance: Any? = itemSchema.getNewInstance(item, itemPathToItem, pathToSchemas) + items.add(itemInstance) + i += 1 + } + val newInstanceItems: FrozenList = FrozenList(items) + return newInstanceItems + } + + @Throws(ValidationException::class) + override fun validate(arg: List<*>, configuration: SchemaConfiguration?): FrozenList { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, PathToSchemasMap(), LinkedHashSet()) + val pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet) + return getNewInstance(castArg, validationMetadata.pathToItem, pathToSchemasMap) + } + + override fun getNewInstance(arg: Map<*, *>, pathToItem: List, pathToSchemas: PathToSchemasMap): FrozenMap { + val properties: LinkedHashMap = LinkedHashMap() + for((propertyName, value) in arg) { + if (!(propertyName is String)) { + throw RuntimeException("Invalid non-string key value") + } + val propertyPathToItem: List = pathToItem + propertyName + val schemas: LinkedHashMap, Nothing?>? = pathToSchemas.get(propertyPathToItem) + if (schemas == null) { + throw RuntimeException("Validation result is invalid, schemas must exist for a pathToItem") + } + val propertySchema: JsonSchema<*> = schemas.entries.iterator().next().key + val propertyInstance: Any? = propertySchema.getNewInstance(value, propertyPathToItem, pathToSchemas) + properties[propertyName] = propertyInstance + } + val castProperties: FrozenMap = FrozenMap(properties) + return castProperties + } + + @Throws(ValidationException::class) + override fun validate(arg: Map<*, *>, configuration: SchemaConfiguration?): FrozenMap { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validatedPathToSchemas = PathToSchemasMap() + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, LinkedHashSet()) + val pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet) + return getNewInstance(castArg, validationMetadata.pathToItem, pathToSchemasMap) + } + + @Throws(ValidationException::class) + override fun validate(arg: Any?, configuration: SchemaConfiguration?): Any? { + if (arg == null) { + return validate(null, configuration) + } else if (arg is Boolean) { + return validate(arg, configuration) + } else if (arg is Number) { + return validate(arg, configuration) + } else if (arg is String) { + return validate(arg, configuration) + } else if (arg is List<*>) { + return validate(arg, configuration) + } else if (arg is Map<*, *>) { + return validate(arg, configuration) + } + throw ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema") + } + override fun getNewInstance(arg: Any?, pathToItem: List, pathToSchemas: PathToSchemasMap): Any? { + if (arg == null) { + return getNewInstance( null, pathToItem, pathToSchemas) + } else if (arg is Boolean) { + return getNewInstance(arg, pathToItem, pathToSchemas) + } else if (arg is Number) { + return getNewInstance(arg, pathToItem, pathToSchemas) + } else if (arg is String) { + return getNewInstance(arg, pathToItem, pathToSchemas) + } else if (arg is List<*>) { + return getNewInstance(arg, pathToItem, pathToSchemas) + } else if (arg is Map<*, *>) { + return getNewInstance(arg, pathToItem, pathToSchemas) + } + throw RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema") + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: Nothing?, configuration: SchemaConfiguration?): Schema0BoxedVoid { + return Schema0BoxedVoid(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: Boolean, configuration: SchemaConfiguration?): Schema0BoxedBoolean { + return Schema0BoxedBoolean(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: Number, configuration: SchemaConfiguration?): Schema0BoxedNumber { + return Schema0BoxedNumber(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: String, configuration: SchemaConfiguration?): Schema0BoxedString { + return Schema0BoxedString(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: List<*>, configuration: SchemaConfiguration?): Schema0BoxedList { + return Schema0BoxedList(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: Map<*, *>, configuration: SchemaConfiguration?): Schema0BoxedMap { + return Schema0BoxedMap(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: Any?, configuration: SchemaConfiguration?): Schema0Boxed { + if (arg == null) { + return validateAndBox(null, configuration) + } else if (arg is Boolean) { + return validateAndBox(arg, configuration) + } else if (arg is String) { + return validateAndBox(arg, configuration) + } else if (arg is Number) { + return validateAndBox(arg, configuration) + } else if (arg is List<*>) { + return validateAndBox(arg, configuration) + } else if (arg is Map<*, *>) { + return validateAndBox(arg, configuration) + } + throw ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema") + } + } + + sealed interface NestedAllofToCheckValidationSemantics1Boxed { + fun getData(): Any? + } + + data class NestedAllofToCheckValidationSemantics1BoxedVoid(val data: Nothing?) : NestedAllofToCheckValidationSemantics1Boxed { + override fun getData(): Any? { + return data + } + } + + data class NestedAllofToCheckValidationSemantics1BoxedBoolean(val data: Boolean): NestedAllofToCheckValidationSemantics1Boxed { + override fun getData(): Any? { + return data + } + } + + data class NestedAllofToCheckValidationSemantics1BoxedNumber(val data: Number) : NestedAllofToCheckValidationSemantics1Boxed { + override fun getData(): Any? { + return data + } + } + + data class NestedAllofToCheckValidationSemantics1BoxedString(val data: String) : NestedAllofToCheckValidationSemantics1Boxed { + override fun getData(): Any? { + return data + } + } + + data class NestedAllofToCheckValidationSemantics1BoxedList(val data: FrozenList) : NestedAllofToCheckValidationSemantics1Boxed { + override fun getData(): Any? { + return data + } + } + + data class NestedAllofToCheckValidationSemantics1BoxedMap(val data: FrozenMap) : NestedAllofToCheckValidationSemantics1Boxed { + override fun getData(): Any? { + return data + } + } + + + class NestedAllofToCheckValidationSemantics1 private constructor(): JsonSchema( + JsonSchemaInfo() + .allOf(listOf( + Schema0::class.java + )) + ), NullSchemaValidator, BooleanSchemaValidator, NumberSchemaValidator, StringSchemaValidator, ListSchemaValidator, NestedAllofToCheckValidationSemantics1BoxedList>, MapSchemaValidator, NestedAllofToCheckValidationSemantics1BoxedMap> { + /* + NOTE: This class is auto generated by OpenAPI JSON Schema Generator. + Ref: https://github.com/openapi-json-schema-tools/openapi-json-schema-generator + + Do not edit the class manually. + */ + + companion object { + @Volatile + private var instance: NestedAllofToCheckValidationSemantics1? = null + + fun getInstance() = + instance ?: synchronized(this) { + instance ?: NestedAllofToCheckValidationSemantics1().also { instance = it } + } + } + + @Throws(ValidationException::class) + override fun validate(arg: Nothing?, configuration: SchemaConfiguration?): Nothing? { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validatedPathToSchemas = PathToSchemasMap() + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, LinkedHashSet()) + getPathToSchemas(this, castArg, validationMetadata, pathSet) + return castArg + } + + @Throws(ValidationException::class) + override fun validate(arg: Boolean, configuration: SchemaConfiguration?): Boolean { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validatedPathToSchemas = PathToSchemasMap() + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, LinkedHashSet()) + getPathToSchemas(this, castArg, validationMetadata, pathSet) + return castArg + } + + @Throws(ValidationException::class) + override fun validate(arg: Number, configuration: SchemaConfiguration?): Number { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validatedPathToSchemas = PathToSchemasMap() + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, LinkedHashSet()) + getPathToSchemas(this, castArg, validationMetadata, pathSet) + return castArg + } + + @Throws(ValidationException::class) + fun validate(arg: Int, configuration: SchemaConfiguration?): Int { + return validate(arg as Number, configuration) as Int + } + + @Throws(ValidationException::class) + fun validate(arg: Long, configuration: SchemaConfiguration?): Long { + return validate(arg as Number, configuration) as Long + } + + @Throws(ValidationException::class) + fun validate(arg: Float, configuration: SchemaConfiguration?): Float { + return validate(arg as Number, configuration) as Float + } + + @Throws(ValidationException::class) + fun validate(arg: Double, configuration: SchemaConfiguration?): Double { + return validate(arg as Number, configuration) as Double + } + + @Throws(ValidationException::class) + override fun validate(arg: String, configuration: SchemaConfiguration?): String { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validatedPathToSchemas = PathToSchemasMap() + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, LinkedHashSet()) + getPathToSchemas(this, castArg, validationMetadata, pathSet) + return castArg + } + + @Throws(ValidationException::class) + fun validate(arg: LocalDate, configuration: SchemaConfiguration?): String { + return validate(arg.toString(), configuration) + } + + @Throws(ValidationException::class) + fun validate(arg: ZonedDateTime, configuration: SchemaConfiguration?): String { + return validate(arg.toString(), configuration) + } + + @Throws(ValidationException::class) + fun validate(arg: UUID, configuration: SchemaConfiguration?): String { + return validate(arg.toString(), configuration) + } + + override fun getNewInstance(arg: List<*>, pathToItem: List, pathToSchemas: PathToSchemasMap): FrozenList { + val items: MutableList = ArrayList() + var i: Int = 0 + for (item: Any? in arg) { + val itemPathToItem = pathToItem + i + val schemas: LinkedHashMap, Nothing?>? = pathToSchemas.get(itemPathToItem) + if (schemas == null) { + throw RuntimeException("Validation result is invalid, schemas must exist for a pathToItem") + } + val itemSchema: JsonSchema<*> = schemas.entries.iterator().next().key + val itemInstance: Any? = itemSchema.getNewInstance(item, itemPathToItem, pathToSchemas) + items.add(itemInstance) + i += 1 + } + val newInstanceItems: FrozenList = FrozenList(items) + return newInstanceItems + } + + @Throws(ValidationException::class) + override fun validate(arg: List<*>, configuration: SchemaConfiguration?): FrozenList { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, PathToSchemasMap(), LinkedHashSet()) + val pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet) + return getNewInstance(castArg, validationMetadata.pathToItem, pathToSchemasMap) + } + + override fun getNewInstance(arg: Map<*, *>, pathToItem: List, pathToSchemas: PathToSchemasMap): FrozenMap { + val properties: LinkedHashMap = LinkedHashMap() + for((propertyName, value) in arg) { + if (!(propertyName is String)) { + throw RuntimeException("Invalid non-string key value") + } + val propertyPathToItem: List = pathToItem + propertyName + val schemas: LinkedHashMap, Nothing?>? = pathToSchemas.get(propertyPathToItem) + if (schemas == null) { + throw RuntimeException("Validation result is invalid, schemas must exist for a pathToItem") + } + val propertySchema: JsonSchema<*> = schemas.entries.iterator().next().key + val propertyInstance: Any? = propertySchema.getNewInstance(value, propertyPathToItem, pathToSchemas) + properties[propertyName] = propertyInstance + } + val castProperties: FrozenMap = FrozenMap(properties) + return castProperties + } + + @Throws(ValidationException::class) + override fun validate(arg: Map<*, *>, configuration: SchemaConfiguration?): FrozenMap { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validatedPathToSchemas = PathToSchemasMap() + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, LinkedHashSet()) + val pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet) + return getNewInstance(castArg, validationMetadata.pathToItem, pathToSchemasMap) + } + + @Throws(ValidationException::class) + override fun validate(arg: Any?, configuration: SchemaConfiguration?): Any? { + if (arg == null) { + return validate(null, configuration) + } else if (arg is Boolean) { + return validate(arg, configuration) + } else if (arg is Number) { + return validate(arg, configuration) + } else if (arg is String) { + return validate(arg, configuration) + } else if (arg is List<*>) { + return validate(arg, configuration) + } else if (arg is Map<*, *>) { + return validate(arg, configuration) + } + throw ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema") + } + override fun getNewInstance(arg: Any?, pathToItem: List, pathToSchemas: PathToSchemasMap): Any? { + if (arg == null) { + return getNewInstance( null, pathToItem, pathToSchemas) + } else if (arg is Boolean) { + return getNewInstance(arg, pathToItem, pathToSchemas) + } else if (arg is Number) { + return getNewInstance(arg, pathToItem, pathToSchemas) + } else if (arg is String) { + return getNewInstance(arg, pathToItem, pathToSchemas) + } else if (arg is List<*>) { + return getNewInstance(arg, pathToItem, pathToSchemas) + } else if (arg is Map<*, *>) { + return getNewInstance(arg, pathToItem, pathToSchemas) + } + throw RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema") + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: Nothing?, configuration: SchemaConfiguration?): NestedAllofToCheckValidationSemantics1BoxedVoid { + return NestedAllofToCheckValidationSemantics1BoxedVoid(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: Boolean, configuration: SchemaConfiguration?): NestedAllofToCheckValidationSemantics1BoxedBoolean { + return NestedAllofToCheckValidationSemantics1BoxedBoolean(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: Number, configuration: SchemaConfiguration?): NestedAllofToCheckValidationSemantics1BoxedNumber { + return NestedAllofToCheckValidationSemantics1BoxedNumber(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: String, configuration: SchemaConfiguration?): NestedAllofToCheckValidationSemantics1BoxedString { + return NestedAllofToCheckValidationSemantics1BoxedString(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: List<*>, configuration: SchemaConfiguration?): NestedAllofToCheckValidationSemantics1BoxedList { + return NestedAllofToCheckValidationSemantics1BoxedList(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: Map<*, *>, configuration: SchemaConfiguration?): NestedAllofToCheckValidationSemantics1BoxedMap { + return NestedAllofToCheckValidationSemantics1BoxedMap(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: Any?, configuration: SchemaConfiguration?): NestedAllofToCheckValidationSemantics1Boxed { + if (arg == null) { + return validateAndBox(null, configuration) + } else if (arg is Boolean) { + return validateAndBox(arg, configuration) + } else if (arg is String) { + return validateAndBox(arg, configuration) + } else if (arg is Number) { + return validateAndBox(arg, configuration) + } else if (arg is List<*>) { + return validateAndBox(arg, configuration) + } else if (arg is Map<*, *>) { + return validateAndBox(arg, configuration) + } + throw ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema") + } + } +} diff --git a/samples/client/3_1_0_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/schemas/NestedAnyofToCheckValidationSemantics.kt b/samples/client/3_1_0_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/schemas/NestedAnyofToCheckValidationSemantics.kt new file mode 100644 index 00000000000..df6ba63b7b6 --- /dev/null +++ b/samples/client/3_1_0_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/schemas/NestedAnyofToCheckValidationSemantics.kt @@ -0,0 +1,601 @@ +package org.openapijsonschematools.client.components.schemas +import java.time.LocalDate +import java.time.ZonedDateTime +import java.util.UUID +import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags +import org.openapijsonschematools.client.configurations.SchemaConfiguration +import org.openapijsonschematools.client.exceptions.InvalidAdditionalPropertyException +import org.openapijsonschematools.client.exceptions.UnsetPropertyException +import org.openapijsonschematools.client.exceptions.ValidationException +import org.openapijsonschematools.client.schemas.NullJsonSchema +import org.openapijsonschematools.client.schemas.UnsetAddPropsSetter +import org.openapijsonschematools.client.schemas.validation.BooleanSchemaValidator +import org.openapijsonschematools.client.schemas.validation.FrozenList +import org.openapijsonschematools.client.schemas.validation.FrozenMap +import org.openapijsonschematools.client.schemas.validation.JsonSchema +import org.openapijsonschematools.client.schemas.validation.JsonSchemaInfo +import org.openapijsonschematools.client.schemas.validation.ListSchemaValidator +import org.openapijsonschematools.client.schemas.validation.MapSchemaValidator +import org.openapijsonschematools.client.schemas.validation.NullSchemaValidator +import org.openapijsonschematools.client.schemas.validation.NumberSchemaValidator +import org.openapijsonschematools.client.schemas.validation.PathToSchemasMap +import org.openapijsonschematools.client.schemas.validation.StringSchemaValidator +import org.openapijsonschematools.client.schemas.validation.ValidationMetadata + +class NestedAnyofToCheckValidationSemantics { + // nest classes so all schemas and input/output classes can be public + + + class Schema01 : NullJsonSchema.NullJsonSchema1() { + companion object { + @Volatile + private var instance: Schema01? = null + + fun getInstance() = + instance ?: synchronized(this) { + instance ?: Schema01().also { instance = it } + } + } + } + + + sealed interface Schema0Boxed { + fun getData(): Any? + } + + data class Schema0BoxedVoid(val data: Nothing?) : Schema0Boxed { + override fun getData(): Any? { + return data + } + } + + data class Schema0BoxedBoolean(val data: Boolean): Schema0Boxed { + override fun getData(): Any? { + return data + } + } + + data class Schema0BoxedNumber(val data: Number) : Schema0Boxed { + override fun getData(): Any? { + return data + } + } + + data class Schema0BoxedString(val data: String) : Schema0Boxed { + override fun getData(): Any? { + return data + } + } + + data class Schema0BoxedList(val data: FrozenList) : Schema0Boxed { + override fun getData(): Any? { + return data + } + } + + data class Schema0BoxedMap(val data: FrozenMap) : Schema0Boxed { + override fun getData(): Any? { + return data + } + } + + + class Schema0 private constructor(): JsonSchema( + JsonSchemaInfo() + .anyOf(listOf( + Schema01::class.java + )) + ), NullSchemaValidator, BooleanSchemaValidator, NumberSchemaValidator, StringSchemaValidator, ListSchemaValidator, Schema0BoxedList>, MapSchemaValidator, Schema0BoxedMap> { + + companion object { + @Volatile + private var instance: Schema0? = null + + fun getInstance() = + instance ?: synchronized(this) { + instance ?: Schema0().also { instance = it } + } + } + + @Throws(ValidationException::class) + override fun validate(arg: Nothing?, configuration: SchemaConfiguration?): Nothing? { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validatedPathToSchemas = PathToSchemasMap() + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, LinkedHashSet()) + getPathToSchemas(this, castArg, validationMetadata, pathSet) + return castArg + } + + @Throws(ValidationException::class) + override fun validate(arg: Boolean, configuration: SchemaConfiguration?): Boolean { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validatedPathToSchemas = PathToSchemasMap() + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, LinkedHashSet()) + getPathToSchemas(this, castArg, validationMetadata, pathSet) + return castArg + } + + @Throws(ValidationException::class) + override fun validate(arg: Number, configuration: SchemaConfiguration?): Number { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validatedPathToSchemas = PathToSchemasMap() + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, LinkedHashSet()) + getPathToSchemas(this, castArg, validationMetadata, pathSet) + return castArg + } + + @Throws(ValidationException::class) + fun validate(arg: Int, configuration: SchemaConfiguration?): Int { + return validate(arg as Number, configuration) as Int + } + + @Throws(ValidationException::class) + fun validate(arg: Long, configuration: SchemaConfiguration?): Long { + return validate(arg as Number, configuration) as Long + } + + @Throws(ValidationException::class) + fun validate(arg: Float, configuration: SchemaConfiguration?): Float { + return validate(arg as Number, configuration) as Float + } + + @Throws(ValidationException::class) + fun validate(arg: Double, configuration: SchemaConfiguration?): Double { + return validate(arg as Number, configuration) as Double + } + + @Throws(ValidationException::class) + override fun validate(arg: String, configuration: SchemaConfiguration?): String { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validatedPathToSchemas = PathToSchemasMap() + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, LinkedHashSet()) + getPathToSchemas(this, castArg, validationMetadata, pathSet) + return castArg + } + + @Throws(ValidationException::class) + fun validate(arg: LocalDate, configuration: SchemaConfiguration?): String { + return validate(arg.toString(), configuration) + } + + @Throws(ValidationException::class) + fun validate(arg: ZonedDateTime, configuration: SchemaConfiguration?): String { + return validate(arg.toString(), configuration) + } + + @Throws(ValidationException::class) + fun validate(arg: UUID, configuration: SchemaConfiguration?): String { + return validate(arg.toString(), configuration) + } + + override fun getNewInstance(arg: List<*>, pathToItem: List, pathToSchemas: PathToSchemasMap): FrozenList { + val items: MutableList = ArrayList() + var i: Int = 0 + for (item: Any? in arg) { + val itemPathToItem = pathToItem + i + val schemas: LinkedHashMap, Nothing?>? = pathToSchemas.get(itemPathToItem) + if (schemas == null) { + throw RuntimeException("Validation result is invalid, schemas must exist for a pathToItem") + } + val itemSchema: JsonSchema<*> = schemas.entries.iterator().next().key + val itemInstance: Any? = itemSchema.getNewInstance(item, itemPathToItem, pathToSchemas) + items.add(itemInstance) + i += 1 + } + val newInstanceItems: FrozenList = FrozenList(items) + return newInstanceItems + } + + @Throws(ValidationException::class) + override fun validate(arg: List<*>, configuration: SchemaConfiguration?): FrozenList { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, PathToSchemasMap(), LinkedHashSet()) + val pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet) + return getNewInstance(castArg, validationMetadata.pathToItem, pathToSchemasMap) + } + + override fun getNewInstance(arg: Map<*, *>, pathToItem: List, pathToSchemas: PathToSchemasMap): FrozenMap { + val properties: LinkedHashMap = LinkedHashMap() + for((propertyName, value) in arg) { + if (!(propertyName is String)) { + throw RuntimeException("Invalid non-string key value") + } + val propertyPathToItem: List = pathToItem + propertyName + val schemas: LinkedHashMap, Nothing?>? = pathToSchemas.get(propertyPathToItem) + if (schemas == null) { + throw RuntimeException("Validation result is invalid, schemas must exist for a pathToItem") + } + val propertySchema: JsonSchema<*> = schemas.entries.iterator().next().key + val propertyInstance: Any? = propertySchema.getNewInstance(value, propertyPathToItem, pathToSchemas) + properties[propertyName] = propertyInstance + } + val castProperties: FrozenMap = FrozenMap(properties) + return castProperties + } + + @Throws(ValidationException::class) + override fun validate(arg: Map<*, *>, configuration: SchemaConfiguration?): FrozenMap { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validatedPathToSchemas = PathToSchemasMap() + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, LinkedHashSet()) + val pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet) + return getNewInstance(castArg, validationMetadata.pathToItem, pathToSchemasMap) + } + + @Throws(ValidationException::class) + override fun validate(arg: Any?, configuration: SchemaConfiguration?): Any? { + if (arg == null) { + return validate(null, configuration) + } else if (arg is Boolean) { + return validate(arg, configuration) + } else if (arg is Number) { + return validate(arg, configuration) + } else if (arg is String) { + return validate(arg, configuration) + } else if (arg is List<*>) { + return validate(arg, configuration) + } else if (arg is Map<*, *>) { + return validate(arg, configuration) + } + throw ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema") + } + override fun getNewInstance(arg: Any?, pathToItem: List, pathToSchemas: PathToSchemasMap): Any? { + if (arg == null) { + return getNewInstance( null, pathToItem, pathToSchemas) + } else if (arg is Boolean) { + return getNewInstance(arg, pathToItem, pathToSchemas) + } else if (arg is Number) { + return getNewInstance(arg, pathToItem, pathToSchemas) + } else if (arg is String) { + return getNewInstance(arg, pathToItem, pathToSchemas) + } else if (arg is List<*>) { + return getNewInstance(arg, pathToItem, pathToSchemas) + } else if (arg is Map<*, *>) { + return getNewInstance(arg, pathToItem, pathToSchemas) + } + throw RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema") + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: Nothing?, configuration: SchemaConfiguration?): Schema0BoxedVoid { + return Schema0BoxedVoid(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: Boolean, configuration: SchemaConfiguration?): Schema0BoxedBoolean { + return Schema0BoxedBoolean(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: Number, configuration: SchemaConfiguration?): Schema0BoxedNumber { + return Schema0BoxedNumber(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: String, configuration: SchemaConfiguration?): Schema0BoxedString { + return Schema0BoxedString(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: List<*>, configuration: SchemaConfiguration?): Schema0BoxedList { + return Schema0BoxedList(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: Map<*, *>, configuration: SchemaConfiguration?): Schema0BoxedMap { + return Schema0BoxedMap(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: Any?, configuration: SchemaConfiguration?): Schema0Boxed { + if (arg == null) { + return validateAndBox(null, configuration) + } else if (arg is Boolean) { + return validateAndBox(arg, configuration) + } else if (arg is String) { + return validateAndBox(arg, configuration) + } else if (arg is Number) { + return validateAndBox(arg, configuration) + } else if (arg is List<*>) { + return validateAndBox(arg, configuration) + } else if (arg is Map<*, *>) { + return validateAndBox(arg, configuration) + } + throw ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema") + } + } + + sealed interface NestedAnyofToCheckValidationSemantics1Boxed { + fun getData(): Any? + } + + data class NestedAnyofToCheckValidationSemantics1BoxedVoid(val data: Nothing?) : NestedAnyofToCheckValidationSemantics1Boxed { + override fun getData(): Any? { + return data + } + } + + data class NestedAnyofToCheckValidationSemantics1BoxedBoolean(val data: Boolean): NestedAnyofToCheckValidationSemantics1Boxed { + override fun getData(): Any? { + return data + } + } + + data class NestedAnyofToCheckValidationSemantics1BoxedNumber(val data: Number) : NestedAnyofToCheckValidationSemantics1Boxed { + override fun getData(): Any? { + return data + } + } + + data class NestedAnyofToCheckValidationSemantics1BoxedString(val data: String) : NestedAnyofToCheckValidationSemantics1Boxed { + override fun getData(): Any? { + return data + } + } + + data class NestedAnyofToCheckValidationSemantics1BoxedList(val data: FrozenList) : NestedAnyofToCheckValidationSemantics1Boxed { + override fun getData(): Any? { + return data + } + } + + data class NestedAnyofToCheckValidationSemantics1BoxedMap(val data: FrozenMap) : NestedAnyofToCheckValidationSemantics1Boxed { + override fun getData(): Any? { + return data + } + } + + + class NestedAnyofToCheckValidationSemantics1 private constructor(): JsonSchema( + JsonSchemaInfo() + .anyOf(listOf( + Schema0::class.java + )) + ), NullSchemaValidator, BooleanSchemaValidator, NumberSchemaValidator, StringSchemaValidator, ListSchemaValidator, NestedAnyofToCheckValidationSemantics1BoxedList>, MapSchemaValidator, NestedAnyofToCheckValidationSemantics1BoxedMap> { + /* + NOTE: This class is auto generated by OpenAPI JSON Schema Generator. + Ref: https://github.com/openapi-json-schema-tools/openapi-json-schema-generator + + Do not edit the class manually. + */ + + companion object { + @Volatile + private var instance: NestedAnyofToCheckValidationSemantics1? = null + + fun getInstance() = + instance ?: synchronized(this) { + instance ?: NestedAnyofToCheckValidationSemantics1().also { instance = it } + } + } + + @Throws(ValidationException::class) + override fun validate(arg: Nothing?, configuration: SchemaConfiguration?): Nothing? { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validatedPathToSchemas = PathToSchemasMap() + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, LinkedHashSet()) + getPathToSchemas(this, castArg, validationMetadata, pathSet) + return castArg + } + + @Throws(ValidationException::class) + override fun validate(arg: Boolean, configuration: SchemaConfiguration?): Boolean { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validatedPathToSchemas = PathToSchemasMap() + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, LinkedHashSet()) + getPathToSchemas(this, castArg, validationMetadata, pathSet) + return castArg + } + + @Throws(ValidationException::class) + override fun validate(arg: Number, configuration: SchemaConfiguration?): Number { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validatedPathToSchemas = PathToSchemasMap() + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, LinkedHashSet()) + getPathToSchemas(this, castArg, validationMetadata, pathSet) + return castArg + } + + @Throws(ValidationException::class) + fun validate(arg: Int, configuration: SchemaConfiguration?): Int { + return validate(arg as Number, configuration) as Int + } + + @Throws(ValidationException::class) + fun validate(arg: Long, configuration: SchemaConfiguration?): Long { + return validate(arg as Number, configuration) as Long + } + + @Throws(ValidationException::class) + fun validate(arg: Float, configuration: SchemaConfiguration?): Float { + return validate(arg as Number, configuration) as Float + } + + @Throws(ValidationException::class) + fun validate(arg: Double, configuration: SchemaConfiguration?): Double { + return validate(arg as Number, configuration) as Double + } + + @Throws(ValidationException::class) + override fun validate(arg: String, configuration: SchemaConfiguration?): String { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validatedPathToSchemas = PathToSchemasMap() + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, LinkedHashSet()) + getPathToSchemas(this, castArg, validationMetadata, pathSet) + return castArg + } + + @Throws(ValidationException::class) + fun validate(arg: LocalDate, configuration: SchemaConfiguration?): String { + return validate(arg.toString(), configuration) + } + + @Throws(ValidationException::class) + fun validate(arg: ZonedDateTime, configuration: SchemaConfiguration?): String { + return validate(arg.toString(), configuration) + } + + @Throws(ValidationException::class) + fun validate(arg: UUID, configuration: SchemaConfiguration?): String { + return validate(arg.toString(), configuration) + } + + override fun getNewInstance(arg: List<*>, pathToItem: List, pathToSchemas: PathToSchemasMap): FrozenList { + val items: MutableList = ArrayList() + var i: Int = 0 + for (item: Any? in arg) { + val itemPathToItem = pathToItem + i + val schemas: LinkedHashMap, Nothing?>? = pathToSchemas.get(itemPathToItem) + if (schemas == null) { + throw RuntimeException("Validation result is invalid, schemas must exist for a pathToItem") + } + val itemSchema: JsonSchema<*> = schemas.entries.iterator().next().key + val itemInstance: Any? = itemSchema.getNewInstance(item, itemPathToItem, pathToSchemas) + items.add(itemInstance) + i += 1 + } + val newInstanceItems: FrozenList = FrozenList(items) + return newInstanceItems + } + + @Throws(ValidationException::class) + override fun validate(arg: List<*>, configuration: SchemaConfiguration?): FrozenList { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, PathToSchemasMap(), LinkedHashSet()) + val pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet) + return getNewInstance(castArg, validationMetadata.pathToItem, pathToSchemasMap) + } + + override fun getNewInstance(arg: Map<*, *>, pathToItem: List, pathToSchemas: PathToSchemasMap): FrozenMap { + val properties: LinkedHashMap = LinkedHashMap() + for((propertyName, value) in arg) { + if (!(propertyName is String)) { + throw RuntimeException("Invalid non-string key value") + } + val propertyPathToItem: List = pathToItem + propertyName + val schemas: LinkedHashMap, Nothing?>? = pathToSchemas.get(propertyPathToItem) + if (schemas == null) { + throw RuntimeException("Validation result is invalid, schemas must exist for a pathToItem") + } + val propertySchema: JsonSchema<*> = schemas.entries.iterator().next().key + val propertyInstance: Any? = propertySchema.getNewInstance(value, propertyPathToItem, pathToSchemas) + properties[propertyName] = propertyInstance + } + val castProperties: FrozenMap = FrozenMap(properties) + return castProperties + } + + @Throws(ValidationException::class) + override fun validate(arg: Map<*, *>, configuration: SchemaConfiguration?): FrozenMap { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validatedPathToSchemas = PathToSchemasMap() + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, LinkedHashSet()) + val pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet) + return getNewInstance(castArg, validationMetadata.pathToItem, pathToSchemasMap) + } + + @Throws(ValidationException::class) + override fun validate(arg: Any?, configuration: SchemaConfiguration?): Any? { + if (arg == null) { + return validate(null, configuration) + } else if (arg is Boolean) { + return validate(arg, configuration) + } else if (arg is Number) { + return validate(arg, configuration) + } else if (arg is String) { + return validate(arg, configuration) + } else if (arg is List<*>) { + return validate(arg, configuration) + } else if (arg is Map<*, *>) { + return validate(arg, configuration) + } + throw ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema") + } + override fun getNewInstance(arg: Any?, pathToItem: List, pathToSchemas: PathToSchemasMap): Any? { + if (arg == null) { + return getNewInstance( null, pathToItem, pathToSchemas) + } else if (arg is Boolean) { + return getNewInstance(arg, pathToItem, pathToSchemas) + } else if (arg is Number) { + return getNewInstance(arg, pathToItem, pathToSchemas) + } else if (arg is String) { + return getNewInstance(arg, pathToItem, pathToSchemas) + } else if (arg is List<*>) { + return getNewInstance(arg, pathToItem, pathToSchemas) + } else if (arg is Map<*, *>) { + return getNewInstance(arg, pathToItem, pathToSchemas) + } + throw RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema") + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: Nothing?, configuration: SchemaConfiguration?): NestedAnyofToCheckValidationSemantics1BoxedVoid { + return NestedAnyofToCheckValidationSemantics1BoxedVoid(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: Boolean, configuration: SchemaConfiguration?): NestedAnyofToCheckValidationSemantics1BoxedBoolean { + return NestedAnyofToCheckValidationSemantics1BoxedBoolean(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: Number, configuration: SchemaConfiguration?): NestedAnyofToCheckValidationSemantics1BoxedNumber { + return NestedAnyofToCheckValidationSemantics1BoxedNumber(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: String, configuration: SchemaConfiguration?): NestedAnyofToCheckValidationSemantics1BoxedString { + return NestedAnyofToCheckValidationSemantics1BoxedString(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: List<*>, configuration: SchemaConfiguration?): NestedAnyofToCheckValidationSemantics1BoxedList { + return NestedAnyofToCheckValidationSemantics1BoxedList(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: Map<*, *>, configuration: SchemaConfiguration?): NestedAnyofToCheckValidationSemantics1BoxedMap { + return NestedAnyofToCheckValidationSemantics1BoxedMap(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: Any?, configuration: SchemaConfiguration?): NestedAnyofToCheckValidationSemantics1Boxed { + if (arg == null) { + return validateAndBox(null, configuration) + } else if (arg is Boolean) { + return validateAndBox(arg, configuration) + } else if (arg is String) { + return validateAndBox(arg, configuration) + } else if (arg is Number) { + return validateAndBox(arg, configuration) + } else if (arg is List<*>) { + return validateAndBox(arg, configuration) + } else if (arg is Map<*, *>) { + return validateAndBox(arg, configuration) + } + throw ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema") + } + } +} diff --git a/samples/client/3_1_0_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/schemas/NestedItems.kt b/samples/client/3_1_0_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/schemas/NestedItems.kt new file mode 100644 index 00000000000..27acba2e66d --- /dev/null +++ b/samples/client/3_1_0_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/schemas/NestedItems.kt @@ -0,0 +1,510 @@ +package org.openapijsonschematools.client.components.schemas +import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags +import org.openapijsonschematools.client.configurations.SchemaConfiguration +import org.openapijsonschematools.client.exceptions.ValidationException +import org.openapijsonschematools.client.schemas.NumberJsonSchema +import org.openapijsonschematools.client.schemas.validation.FrozenList +import org.openapijsonschematools.client.schemas.validation.JsonSchema +import org.openapijsonschematools.client.schemas.validation.JsonSchemaInfo +import org.openapijsonschematools.client.schemas.validation.ListSchemaValidator +import org.openapijsonschematools.client.schemas.validation.PathToSchemasMap +import org.openapijsonschematools.client.schemas.validation.ValidationMetadata + +class NestedItems { + // nest classes so all schemas and input/output classes can be public + + + class Items3 : NumberJsonSchema.NumberJsonSchema1() { + companion object { + @Volatile + private var instance: Items3? = null + + fun getInstance() = + instance ?: synchronized(this) { + instance ?: Items3().also { instance = it } + } + } + } + + + class ItemsList(m: FrozenList) : FrozenList(m) { + companion object { + @Throws(ValidationException::class) + fun of(arg: List, configuration: SchemaConfiguration?): ItemsList { + return Items2.getInstance().validate(arg, configuration) + } + } + } + + class ItemsListBuilder { + // class to build List + private val list: MutableList + + init { + this.list = ArrayList() + } + + + fun add(item: Int): ItemsListBuilder { + list.add(item) + return this + } + + fun add(item: Float): ItemsListBuilder { + list.add(item) + return this + } + + fun add(item: Long): ItemsListBuilder { + list.add(item) + return this + } + + fun add(item: Double): ItemsListBuilder { + list.add(item) + return this + } + + fun build(): List { + return list + } + } + + + sealed interface Items2Boxed { + fun getData(): Any? + } + + data class Items2BoxedList(val data: ItemsList) : Items2Boxed { + override fun getData(): Any? { + return data + } + } + + + + class Items2 private constructor(): JsonSchema( + JsonSchemaInfo() + .type(setOf(List::class.java)) + .items(Items3::class.java) + ), ListSchemaValidator { + + companion object { + @Volatile + private var instance: Items2? = null + + fun getInstance() = + instance ?: synchronized(this) { + instance ?: Items2().also { instance = it } + } + } + + override fun getNewInstance(arg: List<*>, pathToItem: List, pathToSchemas: PathToSchemasMap): ItemsList { + val items: MutableList = ArrayList() + var i: Int = 0 + for (item: Any? in arg) { + val itemPathToItem: List = pathToItem + i + val schemas: LinkedHashMap, Nothing?>? = pathToSchemas.get(itemPathToItem) + if (schemas == null) { + throw RuntimeException("Validation result is invalid, schemas must exist for a pathToItem") + } + val itemSchema: JsonSchema<*> = schemas.entries.iterator().next().key + val itemInstance: Any? = itemSchema.getNewInstance(item, itemPathToItem, pathToSchemas) + if (!(itemInstance is Number)) { + throw RuntimeException("Invalid instantiated value") + } + items.add(itemInstance) + i += 1 + } + val newInstanceItems: FrozenList = FrozenList(items) + return ItemsList(newInstanceItems) + } + + @Throws(ValidationException::class) + override fun validate(arg: List<*>, configuration: SchemaConfiguration?): ItemsList { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, PathToSchemasMap(), LinkedHashSet()) + val pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet) + return getNewInstance(castArg, validationMetadata.pathToItem, pathToSchemasMap) + } + + @Throws(ValidationException::class) + override fun validate(arg: Any?, configuration: SchemaConfiguration?): Any? { + if (arg is List<*>) { + return validate(arg, configuration) + } + throw ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema") + } + override fun getNewInstance(arg: Any?, pathToItem: List, pathToSchemas: PathToSchemasMap): Any? { + if (arg is List<*>) { + return getNewInstance(arg, pathToItem, pathToSchemas) + } + throw RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema") + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: List<*>, configuration: SchemaConfiguration?): Items2BoxedList { + return Items2BoxedList(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: Any?, configuration: SchemaConfiguration?): Items2Boxed { + if (arg is List<*>) { + return validateAndBox(arg, configuration) + } + throw ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema") + } + } + + class ItemsList1(m: FrozenList) : FrozenList(m) { + companion object { + @Throws(ValidationException::class) + fun of(arg: List>, configuration: SchemaConfiguration?): ItemsList1 { + return Items1.getInstance().validate(arg, configuration) + } + } + } + + class ItemsListBuilder1 { + // class to build List> + private val list: MutableList> + + init { + this.list = ArrayList() + } + + + fun add(item: List): ItemsListBuilder1 { + list.add(item) + return this + } + + fun build(): List> { + return list + } + } + + + sealed interface Items1Boxed { + fun getData(): Any? + } + + data class Items1BoxedList(val data: ItemsList1) : Items1Boxed { + override fun getData(): Any? { + return data + } + } + + + + class Items1 private constructor(): JsonSchema( + JsonSchemaInfo() + .type(setOf(List::class.java)) + .items(Items2::class.java) + ), ListSchemaValidator { + + companion object { + @Volatile + private var instance: Items1? = null + + fun getInstance() = + instance ?: synchronized(this) { + instance ?: Items1().also { instance = it } + } + } + + override fun getNewInstance(arg: List<*>, pathToItem: List, pathToSchemas: PathToSchemasMap): ItemsList1 { + val items: MutableList = ArrayList() + var i: Int = 0 + for (item: Any? in arg) { + val itemPathToItem: List = pathToItem + i + val schemas: LinkedHashMap, Nothing?>? = pathToSchemas.get(itemPathToItem) + if (schemas == null) { + throw RuntimeException("Validation result is invalid, schemas must exist for a pathToItem") + } + val itemSchema: JsonSchema<*> = schemas.entries.iterator().next().key + val itemInstance: Any? = itemSchema.getNewInstance(item, itemPathToItem, pathToSchemas) + if (!(itemInstance is ItemsList)) { + throw RuntimeException("Invalid instantiated value") + } + items.add(itemInstance) + i += 1 + } + val newInstanceItems: FrozenList = FrozenList(items) + return ItemsList1(newInstanceItems) + } + + @Throws(ValidationException::class) + override fun validate(arg: List<*>, configuration: SchemaConfiguration?): ItemsList1 { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, PathToSchemasMap(), LinkedHashSet()) + val pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet) + return getNewInstance(castArg, validationMetadata.pathToItem, pathToSchemasMap) + } + + @Throws(ValidationException::class) + override fun validate(arg: Any?, configuration: SchemaConfiguration?): Any? { + if (arg is List<*>) { + return validate(arg, configuration) + } + throw ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema") + } + override fun getNewInstance(arg: Any?, pathToItem: List, pathToSchemas: PathToSchemasMap): Any? { + if (arg is List<*>) { + return getNewInstance(arg, pathToItem, pathToSchemas) + } + throw RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema") + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: List<*>, configuration: SchemaConfiguration?): Items1BoxedList { + return Items1BoxedList(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: Any?, configuration: SchemaConfiguration?): Items1Boxed { + if (arg is List<*>) { + return validateAndBox(arg, configuration) + } + throw ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema") + } + } + + class ItemsList2(m: FrozenList) : FrozenList(m) { + companion object { + @Throws(ValidationException::class) + fun of(arg: List>>, configuration: SchemaConfiguration?): ItemsList2 { + return Items.getInstance().validate(arg, configuration) + } + } + } + + class ItemsListBuilder2 { + // class to build List>> + private val list: MutableList>> + + init { + this.list = ArrayList() + } + + + fun add(item: List>): ItemsListBuilder2 { + list.add(item) + return this + } + + fun build(): List>> { + return list + } + } + + + sealed interface ItemsBoxed { + fun getData(): Any? + } + + data class ItemsBoxedList(val data: ItemsList2) : ItemsBoxed { + override fun getData(): Any? { + return data + } + } + + + + class Items private constructor(): JsonSchema( + JsonSchemaInfo() + .type(setOf(List::class.java)) + .items(Items1::class.java) + ), ListSchemaValidator { + + companion object { + @Volatile + private var instance: Items? = null + + fun getInstance() = + instance ?: synchronized(this) { + instance ?: Items().also { instance = it } + } + } + + override fun getNewInstance(arg: List<*>, pathToItem: List, pathToSchemas: PathToSchemasMap): ItemsList2 { + val items: MutableList = ArrayList() + var i: Int = 0 + for (item: Any? in arg) { + val itemPathToItem: List = pathToItem + i + val schemas: LinkedHashMap, Nothing?>? = pathToSchemas.get(itemPathToItem) + if (schemas == null) { + throw RuntimeException("Validation result is invalid, schemas must exist for a pathToItem") + } + val itemSchema: JsonSchema<*> = schemas.entries.iterator().next().key + val itemInstance: Any? = itemSchema.getNewInstance(item, itemPathToItem, pathToSchemas) + if (!(itemInstance is ItemsList1)) { + throw RuntimeException("Invalid instantiated value") + } + items.add(itemInstance) + i += 1 + } + val newInstanceItems: FrozenList = FrozenList(items) + return ItemsList2(newInstanceItems) + } + + @Throws(ValidationException::class) + override fun validate(arg: List<*>, configuration: SchemaConfiguration?): ItemsList2 { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, PathToSchemasMap(), LinkedHashSet()) + val pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet) + return getNewInstance(castArg, validationMetadata.pathToItem, pathToSchemasMap) + } + + @Throws(ValidationException::class) + override fun validate(arg: Any?, configuration: SchemaConfiguration?): Any? { + if (arg is List<*>) { + return validate(arg, configuration) + } + throw ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema") + } + override fun getNewInstance(arg: Any?, pathToItem: List, pathToSchemas: PathToSchemasMap): Any? { + if (arg is List<*>) { + return getNewInstance(arg, pathToItem, pathToSchemas) + } + throw RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema") + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: List<*>, configuration: SchemaConfiguration?): ItemsBoxedList { + return ItemsBoxedList(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: Any?, configuration: SchemaConfiguration?): ItemsBoxed { + if (arg is List<*>) { + return validateAndBox(arg, configuration) + } + throw ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema") + } + } + + class NestedItemsList(m: FrozenList) : FrozenList(m) { + companion object { + @Throws(ValidationException::class) + fun of(arg: List>>>, configuration: SchemaConfiguration?): NestedItemsList { + return NestedItems1.getInstance().validate(arg, configuration) + } + } + } + + class NestedItemsListBuilder { + // class to build List>>> + private val list: MutableList>>> + + init { + this.list = ArrayList() + } + + + fun add(item: List>>): NestedItemsListBuilder { + list.add(item) + return this + } + + fun build(): List>>> { + return list + } + } + + + sealed interface NestedItems1Boxed { + fun getData(): Any? + } + + data class NestedItems1BoxedList(val data: NestedItemsList) : NestedItems1Boxed { + override fun getData(): Any? { + return data + } + } + + + + class NestedItems1 private constructor(): JsonSchema( + JsonSchemaInfo() + .type(setOf(List::class.java)) + .items(Items::class.java) + ), ListSchemaValidator { + /* + NOTE: This class is auto generated by OpenAPI JSON Schema Generator. + Ref: https://github.com/openapi-json-schema-tools/openapi-json-schema-generator + + Do not edit the class manually. + */ + + companion object { + @Volatile + private var instance: NestedItems1? = null + + fun getInstance() = + instance ?: synchronized(this) { + instance ?: NestedItems1().also { instance = it } + } + } + + override fun getNewInstance(arg: List<*>, pathToItem: List, pathToSchemas: PathToSchemasMap): NestedItemsList { + val items: MutableList = ArrayList() + var i: Int = 0 + for (item: Any? in arg) { + val itemPathToItem: List = pathToItem + i + val schemas: LinkedHashMap, Nothing?>? = pathToSchemas.get(itemPathToItem) + if (schemas == null) { + throw RuntimeException("Validation result is invalid, schemas must exist for a pathToItem") + } + val itemSchema: JsonSchema<*> = schemas.entries.iterator().next().key + val itemInstance: Any? = itemSchema.getNewInstance(item, itemPathToItem, pathToSchemas) + if (!(itemInstance is ItemsList2)) { + throw RuntimeException("Invalid instantiated value") + } + items.add(itemInstance) + i += 1 + } + val newInstanceItems: FrozenList = FrozenList(items) + return NestedItemsList(newInstanceItems) + } + + @Throws(ValidationException::class) + override fun validate(arg: List<*>, configuration: SchemaConfiguration?): NestedItemsList { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, PathToSchemasMap(), LinkedHashSet()) + val pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet) + return getNewInstance(castArg, validationMetadata.pathToItem, pathToSchemasMap) + } + + @Throws(ValidationException::class) + override fun validate(arg: Any?, configuration: SchemaConfiguration?): Any? { + if (arg is List<*>) { + return validate(arg, configuration) + } + throw ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema") + } + override fun getNewInstance(arg: Any?, pathToItem: List, pathToSchemas: PathToSchemasMap): Any? { + if (arg is List<*>) { + return getNewInstance(arg, pathToItem, pathToSchemas) + } + throw RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema") + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: List<*>, configuration: SchemaConfiguration?): NestedItems1BoxedList { + return NestedItems1BoxedList(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: Any?, configuration: SchemaConfiguration?): NestedItems1Boxed { + if (arg is List<*>) { + return validateAndBox(arg, configuration) + } + throw ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema") + } + } +} diff --git a/samples/client/3_1_0_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/schemas/NestedOneofToCheckValidationSemantics.kt b/samples/client/3_1_0_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/schemas/NestedOneofToCheckValidationSemantics.kt new file mode 100644 index 00000000000..eaaadf832d1 --- /dev/null +++ b/samples/client/3_1_0_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/schemas/NestedOneofToCheckValidationSemantics.kt @@ -0,0 +1,601 @@ +package org.openapijsonschematools.client.components.schemas +import java.time.LocalDate +import java.time.ZonedDateTime +import java.util.UUID +import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags +import org.openapijsonschematools.client.configurations.SchemaConfiguration +import org.openapijsonschematools.client.exceptions.InvalidAdditionalPropertyException +import org.openapijsonschematools.client.exceptions.UnsetPropertyException +import org.openapijsonschematools.client.exceptions.ValidationException +import org.openapijsonschematools.client.schemas.NullJsonSchema +import org.openapijsonschematools.client.schemas.UnsetAddPropsSetter +import org.openapijsonschematools.client.schemas.validation.BooleanSchemaValidator +import org.openapijsonschematools.client.schemas.validation.FrozenList +import org.openapijsonschematools.client.schemas.validation.FrozenMap +import org.openapijsonschematools.client.schemas.validation.JsonSchema +import org.openapijsonschematools.client.schemas.validation.JsonSchemaInfo +import org.openapijsonschematools.client.schemas.validation.ListSchemaValidator +import org.openapijsonschematools.client.schemas.validation.MapSchemaValidator +import org.openapijsonschematools.client.schemas.validation.NullSchemaValidator +import org.openapijsonschematools.client.schemas.validation.NumberSchemaValidator +import org.openapijsonschematools.client.schemas.validation.PathToSchemasMap +import org.openapijsonschematools.client.schemas.validation.StringSchemaValidator +import org.openapijsonschematools.client.schemas.validation.ValidationMetadata + +class NestedOneofToCheckValidationSemantics { + // nest classes so all schemas and input/output classes can be public + + + class Schema01 : NullJsonSchema.NullJsonSchema1() { + companion object { + @Volatile + private var instance: Schema01? = null + + fun getInstance() = + instance ?: synchronized(this) { + instance ?: Schema01().also { instance = it } + } + } + } + + + sealed interface Schema0Boxed { + fun getData(): Any? + } + + data class Schema0BoxedVoid(val data: Nothing?) : Schema0Boxed { + override fun getData(): Any? { + return data + } + } + + data class Schema0BoxedBoolean(val data: Boolean): Schema0Boxed { + override fun getData(): Any? { + return data + } + } + + data class Schema0BoxedNumber(val data: Number) : Schema0Boxed { + override fun getData(): Any? { + return data + } + } + + data class Schema0BoxedString(val data: String) : Schema0Boxed { + override fun getData(): Any? { + return data + } + } + + data class Schema0BoxedList(val data: FrozenList) : Schema0Boxed { + override fun getData(): Any? { + return data + } + } + + data class Schema0BoxedMap(val data: FrozenMap) : Schema0Boxed { + override fun getData(): Any? { + return data + } + } + + + class Schema0 private constructor(): JsonSchema( + JsonSchemaInfo() + .oneOf(listOf( + Schema01::class.java + )) + ), NullSchemaValidator, BooleanSchemaValidator, NumberSchemaValidator, StringSchemaValidator, ListSchemaValidator, Schema0BoxedList>, MapSchemaValidator, Schema0BoxedMap> { + + companion object { + @Volatile + private var instance: Schema0? = null + + fun getInstance() = + instance ?: synchronized(this) { + instance ?: Schema0().also { instance = it } + } + } + + @Throws(ValidationException::class) + override fun validate(arg: Nothing?, configuration: SchemaConfiguration?): Nothing? { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validatedPathToSchemas = PathToSchemasMap() + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, LinkedHashSet()) + getPathToSchemas(this, castArg, validationMetadata, pathSet) + return castArg + } + + @Throws(ValidationException::class) + override fun validate(arg: Boolean, configuration: SchemaConfiguration?): Boolean { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validatedPathToSchemas = PathToSchemasMap() + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, LinkedHashSet()) + getPathToSchemas(this, castArg, validationMetadata, pathSet) + return castArg + } + + @Throws(ValidationException::class) + override fun validate(arg: Number, configuration: SchemaConfiguration?): Number { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validatedPathToSchemas = PathToSchemasMap() + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, LinkedHashSet()) + getPathToSchemas(this, castArg, validationMetadata, pathSet) + return castArg + } + + @Throws(ValidationException::class) + fun validate(arg: Int, configuration: SchemaConfiguration?): Int { + return validate(arg as Number, configuration) as Int + } + + @Throws(ValidationException::class) + fun validate(arg: Long, configuration: SchemaConfiguration?): Long { + return validate(arg as Number, configuration) as Long + } + + @Throws(ValidationException::class) + fun validate(arg: Float, configuration: SchemaConfiguration?): Float { + return validate(arg as Number, configuration) as Float + } + + @Throws(ValidationException::class) + fun validate(arg: Double, configuration: SchemaConfiguration?): Double { + return validate(arg as Number, configuration) as Double + } + + @Throws(ValidationException::class) + override fun validate(arg: String, configuration: SchemaConfiguration?): String { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validatedPathToSchemas = PathToSchemasMap() + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, LinkedHashSet()) + getPathToSchemas(this, castArg, validationMetadata, pathSet) + return castArg + } + + @Throws(ValidationException::class) + fun validate(arg: LocalDate, configuration: SchemaConfiguration?): String { + return validate(arg.toString(), configuration) + } + + @Throws(ValidationException::class) + fun validate(arg: ZonedDateTime, configuration: SchemaConfiguration?): String { + return validate(arg.toString(), configuration) + } + + @Throws(ValidationException::class) + fun validate(arg: UUID, configuration: SchemaConfiguration?): String { + return validate(arg.toString(), configuration) + } + + override fun getNewInstance(arg: List<*>, pathToItem: List, pathToSchemas: PathToSchemasMap): FrozenList { + val items: MutableList = ArrayList() + var i: Int = 0 + for (item: Any? in arg) { + val itemPathToItem = pathToItem + i + val schemas: LinkedHashMap, Nothing?>? = pathToSchemas.get(itemPathToItem) + if (schemas == null) { + throw RuntimeException("Validation result is invalid, schemas must exist for a pathToItem") + } + val itemSchema: JsonSchema<*> = schemas.entries.iterator().next().key + val itemInstance: Any? = itemSchema.getNewInstance(item, itemPathToItem, pathToSchemas) + items.add(itemInstance) + i += 1 + } + val newInstanceItems: FrozenList = FrozenList(items) + return newInstanceItems + } + + @Throws(ValidationException::class) + override fun validate(arg: List<*>, configuration: SchemaConfiguration?): FrozenList { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, PathToSchemasMap(), LinkedHashSet()) + val pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet) + return getNewInstance(castArg, validationMetadata.pathToItem, pathToSchemasMap) + } + + override fun getNewInstance(arg: Map<*, *>, pathToItem: List, pathToSchemas: PathToSchemasMap): FrozenMap { + val properties: LinkedHashMap = LinkedHashMap() + for((propertyName, value) in arg) { + if (!(propertyName is String)) { + throw RuntimeException("Invalid non-string key value") + } + val propertyPathToItem: List = pathToItem + propertyName + val schemas: LinkedHashMap, Nothing?>? = pathToSchemas.get(propertyPathToItem) + if (schemas == null) { + throw RuntimeException("Validation result is invalid, schemas must exist for a pathToItem") + } + val propertySchema: JsonSchema<*> = schemas.entries.iterator().next().key + val propertyInstance: Any? = propertySchema.getNewInstance(value, propertyPathToItem, pathToSchemas) + properties[propertyName] = propertyInstance + } + val castProperties: FrozenMap = FrozenMap(properties) + return castProperties + } + + @Throws(ValidationException::class) + override fun validate(arg: Map<*, *>, configuration: SchemaConfiguration?): FrozenMap { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validatedPathToSchemas = PathToSchemasMap() + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, LinkedHashSet()) + val pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet) + return getNewInstance(castArg, validationMetadata.pathToItem, pathToSchemasMap) + } + + @Throws(ValidationException::class) + override fun validate(arg: Any?, configuration: SchemaConfiguration?): Any? { + if (arg == null) { + return validate(null, configuration) + } else if (arg is Boolean) { + return validate(arg, configuration) + } else if (arg is Number) { + return validate(arg, configuration) + } else if (arg is String) { + return validate(arg, configuration) + } else if (arg is List<*>) { + return validate(arg, configuration) + } else if (arg is Map<*, *>) { + return validate(arg, configuration) + } + throw ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema") + } + override fun getNewInstance(arg: Any?, pathToItem: List, pathToSchemas: PathToSchemasMap): Any? { + if (arg == null) { + return getNewInstance( null, pathToItem, pathToSchemas) + } else if (arg is Boolean) { + return getNewInstance(arg, pathToItem, pathToSchemas) + } else if (arg is Number) { + return getNewInstance(arg, pathToItem, pathToSchemas) + } else if (arg is String) { + return getNewInstance(arg, pathToItem, pathToSchemas) + } else if (arg is List<*>) { + return getNewInstance(arg, pathToItem, pathToSchemas) + } else if (arg is Map<*, *>) { + return getNewInstance(arg, pathToItem, pathToSchemas) + } + throw RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema") + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: Nothing?, configuration: SchemaConfiguration?): Schema0BoxedVoid { + return Schema0BoxedVoid(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: Boolean, configuration: SchemaConfiguration?): Schema0BoxedBoolean { + return Schema0BoxedBoolean(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: Number, configuration: SchemaConfiguration?): Schema0BoxedNumber { + return Schema0BoxedNumber(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: String, configuration: SchemaConfiguration?): Schema0BoxedString { + return Schema0BoxedString(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: List<*>, configuration: SchemaConfiguration?): Schema0BoxedList { + return Schema0BoxedList(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: Map<*, *>, configuration: SchemaConfiguration?): Schema0BoxedMap { + return Schema0BoxedMap(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: Any?, configuration: SchemaConfiguration?): Schema0Boxed { + if (arg == null) { + return validateAndBox(null, configuration) + } else if (arg is Boolean) { + return validateAndBox(arg, configuration) + } else if (arg is String) { + return validateAndBox(arg, configuration) + } else if (arg is Number) { + return validateAndBox(arg, configuration) + } else if (arg is List<*>) { + return validateAndBox(arg, configuration) + } else if (arg is Map<*, *>) { + return validateAndBox(arg, configuration) + } + throw ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema") + } + } + + sealed interface NestedOneofToCheckValidationSemantics1Boxed { + fun getData(): Any? + } + + data class NestedOneofToCheckValidationSemantics1BoxedVoid(val data: Nothing?) : NestedOneofToCheckValidationSemantics1Boxed { + override fun getData(): Any? { + return data + } + } + + data class NestedOneofToCheckValidationSemantics1BoxedBoolean(val data: Boolean): NestedOneofToCheckValidationSemantics1Boxed { + override fun getData(): Any? { + return data + } + } + + data class NestedOneofToCheckValidationSemantics1BoxedNumber(val data: Number) : NestedOneofToCheckValidationSemantics1Boxed { + override fun getData(): Any? { + return data + } + } + + data class NestedOneofToCheckValidationSemantics1BoxedString(val data: String) : NestedOneofToCheckValidationSemantics1Boxed { + override fun getData(): Any? { + return data + } + } + + data class NestedOneofToCheckValidationSemantics1BoxedList(val data: FrozenList) : NestedOneofToCheckValidationSemantics1Boxed { + override fun getData(): Any? { + return data + } + } + + data class NestedOneofToCheckValidationSemantics1BoxedMap(val data: FrozenMap) : NestedOneofToCheckValidationSemantics1Boxed { + override fun getData(): Any? { + return data + } + } + + + class NestedOneofToCheckValidationSemantics1 private constructor(): JsonSchema( + JsonSchemaInfo() + .oneOf(listOf( + Schema0::class.java + )) + ), NullSchemaValidator, BooleanSchemaValidator, NumberSchemaValidator, StringSchemaValidator, ListSchemaValidator, NestedOneofToCheckValidationSemantics1BoxedList>, MapSchemaValidator, NestedOneofToCheckValidationSemantics1BoxedMap> { + /* + NOTE: This class is auto generated by OpenAPI JSON Schema Generator. + Ref: https://github.com/openapi-json-schema-tools/openapi-json-schema-generator + + Do not edit the class manually. + */ + + companion object { + @Volatile + private var instance: NestedOneofToCheckValidationSemantics1? = null + + fun getInstance() = + instance ?: synchronized(this) { + instance ?: NestedOneofToCheckValidationSemantics1().also { instance = it } + } + } + + @Throws(ValidationException::class) + override fun validate(arg: Nothing?, configuration: SchemaConfiguration?): Nothing? { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validatedPathToSchemas = PathToSchemasMap() + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, LinkedHashSet()) + getPathToSchemas(this, castArg, validationMetadata, pathSet) + return castArg + } + + @Throws(ValidationException::class) + override fun validate(arg: Boolean, configuration: SchemaConfiguration?): Boolean { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validatedPathToSchemas = PathToSchemasMap() + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, LinkedHashSet()) + getPathToSchemas(this, castArg, validationMetadata, pathSet) + return castArg + } + + @Throws(ValidationException::class) + override fun validate(arg: Number, configuration: SchemaConfiguration?): Number { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validatedPathToSchemas = PathToSchemasMap() + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, LinkedHashSet()) + getPathToSchemas(this, castArg, validationMetadata, pathSet) + return castArg + } + + @Throws(ValidationException::class) + fun validate(arg: Int, configuration: SchemaConfiguration?): Int { + return validate(arg as Number, configuration) as Int + } + + @Throws(ValidationException::class) + fun validate(arg: Long, configuration: SchemaConfiguration?): Long { + return validate(arg as Number, configuration) as Long + } + + @Throws(ValidationException::class) + fun validate(arg: Float, configuration: SchemaConfiguration?): Float { + return validate(arg as Number, configuration) as Float + } + + @Throws(ValidationException::class) + fun validate(arg: Double, configuration: SchemaConfiguration?): Double { + return validate(arg as Number, configuration) as Double + } + + @Throws(ValidationException::class) + override fun validate(arg: String, configuration: SchemaConfiguration?): String { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validatedPathToSchemas = PathToSchemasMap() + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, LinkedHashSet()) + getPathToSchemas(this, castArg, validationMetadata, pathSet) + return castArg + } + + @Throws(ValidationException::class) + fun validate(arg: LocalDate, configuration: SchemaConfiguration?): String { + return validate(arg.toString(), configuration) + } + + @Throws(ValidationException::class) + fun validate(arg: ZonedDateTime, configuration: SchemaConfiguration?): String { + return validate(arg.toString(), configuration) + } + + @Throws(ValidationException::class) + fun validate(arg: UUID, configuration: SchemaConfiguration?): String { + return validate(arg.toString(), configuration) + } + + override fun getNewInstance(arg: List<*>, pathToItem: List, pathToSchemas: PathToSchemasMap): FrozenList { + val items: MutableList = ArrayList() + var i: Int = 0 + for (item: Any? in arg) { + val itemPathToItem = pathToItem + i + val schemas: LinkedHashMap, Nothing?>? = pathToSchemas.get(itemPathToItem) + if (schemas == null) { + throw RuntimeException("Validation result is invalid, schemas must exist for a pathToItem") + } + val itemSchema: JsonSchema<*> = schemas.entries.iterator().next().key + val itemInstance: Any? = itemSchema.getNewInstance(item, itemPathToItem, pathToSchemas) + items.add(itemInstance) + i += 1 + } + val newInstanceItems: FrozenList = FrozenList(items) + return newInstanceItems + } + + @Throws(ValidationException::class) + override fun validate(arg: List<*>, configuration: SchemaConfiguration?): FrozenList { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, PathToSchemasMap(), LinkedHashSet()) + val pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet) + return getNewInstance(castArg, validationMetadata.pathToItem, pathToSchemasMap) + } + + override fun getNewInstance(arg: Map<*, *>, pathToItem: List, pathToSchemas: PathToSchemasMap): FrozenMap { + val properties: LinkedHashMap = LinkedHashMap() + for((propertyName, value) in arg) { + if (!(propertyName is String)) { + throw RuntimeException("Invalid non-string key value") + } + val propertyPathToItem: List = pathToItem + propertyName + val schemas: LinkedHashMap, Nothing?>? = pathToSchemas.get(propertyPathToItem) + if (schemas == null) { + throw RuntimeException("Validation result is invalid, schemas must exist for a pathToItem") + } + val propertySchema: JsonSchema<*> = schemas.entries.iterator().next().key + val propertyInstance: Any? = propertySchema.getNewInstance(value, propertyPathToItem, pathToSchemas) + properties[propertyName] = propertyInstance + } + val castProperties: FrozenMap = FrozenMap(properties) + return castProperties + } + + @Throws(ValidationException::class) + override fun validate(arg: Map<*, *>, configuration: SchemaConfiguration?): FrozenMap { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validatedPathToSchemas = PathToSchemasMap() + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, LinkedHashSet()) + val pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet) + return getNewInstance(castArg, validationMetadata.pathToItem, pathToSchemasMap) + } + + @Throws(ValidationException::class) + override fun validate(arg: Any?, configuration: SchemaConfiguration?): Any? { + if (arg == null) { + return validate(null, configuration) + } else if (arg is Boolean) { + return validate(arg, configuration) + } else if (arg is Number) { + return validate(arg, configuration) + } else if (arg is String) { + return validate(arg, configuration) + } else if (arg is List<*>) { + return validate(arg, configuration) + } else if (arg is Map<*, *>) { + return validate(arg, configuration) + } + throw ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema") + } + override fun getNewInstance(arg: Any?, pathToItem: List, pathToSchemas: PathToSchemasMap): Any? { + if (arg == null) { + return getNewInstance( null, pathToItem, pathToSchemas) + } else if (arg is Boolean) { + return getNewInstance(arg, pathToItem, pathToSchemas) + } else if (arg is Number) { + return getNewInstance(arg, pathToItem, pathToSchemas) + } else if (arg is String) { + return getNewInstance(arg, pathToItem, pathToSchemas) + } else if (arg is List<*>) { + return getNewInstance(arg, pathToItem, pathToSchemas) + } else if (arg is Map<*, *>) { + return getNewInstance(arg, pathToItem, pathToSchemas) + } + throw RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema") + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: Nothing?, configuration: SchemaConfiguration?): NestedOneofToCheckValidationSemantics1BoxedVoid { + return NestedOneofToCheckValidationSemantics1BoxedVoid(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: Boolean, configuration: SchemaConfiguration?): NestedOneofToCheckValidationSemantics1BoxedBoolean { + return NestedOneofToCheckValidationSemantics1BoxedBoolean(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: Number, configuration: SchemaConfiguration?): NestedOneofToCheckValidationSemantics1BoxedNumber { + return NestedOneofToCheckValidationSemantics1BoxedNumber(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: String, configuration: SchemaConfiguration?): NestedOneofToCheckValidationSemantics1BoxedString { + return NestedOneofToCheckValidationSemantics1BoxedString(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: List<*>, configuration: SchemaConfiguration?): NestedOneofToCheckValidationSemantics1BoxedList { + return NestedOneofToCheckValidationSemantics1BoxedList(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: Map<*, *>, configuration: SchemaConfiguration?): NestedOneofToCheckValidationSemantics1BoxedMap { + return NestedOneofToCheckValidationSemantics1BoxedMap(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: Any?, configuration: SchemaConfiguration?): NestedOneofToCheckValidationSemantics1Boxed { + if (arg == null) { + return validateAndBox(null, configuration) + } else if (arg is Boolean) { + return validateAndBox(arg, configuration) + } else if (arg is String) { + return validateAndBox(arg, configuration) + } else if (arg is Number) { + return validateAndBox(arg, configuration) + } else if (arg is List<*>) { + return validateAndBox(arg, configuration) + } else if (arg is Map<*, *>) { + return validateAndBox(arg, configuration) + } + throw ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema") + } + } +} diff --git a/samples/client/3_1_0_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/schemas/NonAsciiPatternWithAdditionalproperties.kt b/samples/client/3_1_0_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/schemas/NonAsciiPatternWithAdditionalproperties.kt new file mode 100644 index 00000000000..c48d25c17a9 --- /dev/null +++ b/samples/client/3_1_0_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/schemas/NonAsciiPatternWithAdditionalproperties.kt @@ -0,0 +1,169 @@ +package org.openapijsonschematools.client.components.schemas +import java.util.AbstractMap +import java.util.regex.Pattern +import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags +import org.openapijsonschematools.client.configurations.SchemaConfiguration +import org.openapijsonschematools.client.exceptions.ValidationException +import org.openapijsonschematools.client.schemas.AnyTypeJsonSchema +import org.openapijsonschematools.client.schemas.GenericBuilder +import org.openapijsonschematools.client.schemas.NotAnyTypeJsonSchema +import org.openapijsonschematools.client.schemas.validation.FrozenMap +import org.openapijsonschematools.client.schemas.validation.JsonSchema +import org.openapijsonschematools.client.schemas.validation.JsonSchemaInfo +import org.openapijsonschematools.client.schemas.validation.MapSchemaValidator +import org.openapijsonschematools.client.schemas.validation.MapUtils +import org.openapijsonschematools.client.schemas.validation.PathToSchemasMap +import org.openapijsonschematools.client.schemas.validation.ValidationMetadata + +class NonAsciiPatternWithAdditionalproperties { + // nest classes so all schemas and input/output classes can be public + + + class AdditionalProperties : NotAnyTypeJsonSchema.NotAnyTypeJsonSchema1() { + // NotAnyTypeSchema + companion object { + @Volatile + private var instance: AdditionalProperties? = null + + fun getInstance() = + instance ?: synchronized(this) { + instance ?: AdditionalProperties().also { instance = it } + } + } + } + + + class CircumflexAccentLatinSmallLetterAWithAcute : AnyTypeJsonSchema.AnyTypeJsonSchema1() { + companion object { + @Volatile + private var instance: CircumflexAccentLatinSmallLetterAWithAcute? = null + + fun getInstance() = + instance ?: synchronized(this) { + instance ?: CircumflexAccentLatinSmallLetterAWithAcute().also { instance = it } + } + } + } + + + class NonAsciiPatternWithAdditionalpropertiesMap(m: FrozenMap): FrozenMap(m) { + companion object { + val requiredKeys: Set = setOf() + val optionalKeys: Set = setOf() + // map with no key value pairs + @Throws(ValidationException::class) + fun of(arg: Map, configuration: SchemaConfiguration): NonAsciiPatternWithAdditionalpropertiesMap { + return NonAsciiPatternWithAdditionalproperties1.getInstance().validate(arg, configuration) + } + } + } + + class NonAsciiPatternWithAdditionalpropertiesMapBuilder: GenericBuilder> { + private val knownKeys: Set = setOf() + override fun getKnownKeys(): Set { + return knownKeys + } + private val instance: MutableMap + init { + this.instance = LinkedHashMap() + } + override fun build(): Map { + return instance + } + } + + + sealed interface NonAsciiPatternWithAdditionalproperties1Boxed { + fun getData(): Any? + } + + data class NonAsciiPatternWithAdditionalproperties1BoxedMap(val data: NonAsciiPatternWithAdditionalpropertiesMap) : NonAsciiPatternWithAdditionalproperties1Boxed { + override fun getData(): Any? { + return data + } + } + + + class NonAsciiPatternWithAdditionalproperties1 private constructor(): JsonSchema( + JsonSchemaInfo() + .type(setOf(Map::class.java)) + .additionalProperties(AdditionalProperties::class.java) + .patternProperties(mapOf( + new AbstractMap.SimpleEntry<>(Pattern.compile("^á"), CircumflexAccentLatinSmallLetterAWithAcute::class.java) + )) + ), MapSchemaValidator { + /* + NOTE: This class is auto generated by OpenAPI JSON Schema Generator. + Ref: https://github.com/openapi-json-schema-tools/openapi-json-schema-generator + + Do not edit the class manually. + */ + + companion object { + @Volatile + private var instance: NonAsciiPatternWithAdditionalproperties1? = null + + fun getInstance() = + instance ?: synchronized(this) { + instance ?: NonAsciiPatternWithAdditionalproperties1().also { instance = it } + } + } + + override fun getNewInstance(arg: Map<*, *>, pathToItem: List, pathToSchemas: PathToSchemasMap): NonAsciiPatternWithAdditionalpropertiesMap { + val properties: LinkedHashMap = LinkedHashMap() + for((entryKey, value) in arg) { + if (!(entryKey is String)) { + throw RuntimeException("Invalid non-string key value") + } + val propertyPathToItem: List = pathToItem + entryKey + val schemas: LinkedHashMap, Nothing?>? = pathToSchemas.get(propertyPathToItem) + if (schemas == null) { + throw RuntimeException("Validation result is invalid, schemas must exist for a pathToItem") + } + val propertySchema: JsonSchema<*> = schemas.entries.iterator().next().key + val propertyInstance: Any? = propertySchema.getNewInstance(value, propertyPathToItem, pathToSchemas) + properties[entryKey] = propertyInstance + } + val castProperties: FrozenMap = FrozenMap(properties) + return NonAsciiPatternWithAdditionalpropertiesMap(castProperties) + } + + @Throws(ValidationException::class) + override fun validate(arg: Map<*, *>, configuration: SchemaConfiguration?): NonAsciiPatternWithAdditionalpropertiesMap { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, PathToSchemasMap(), LinkedHashSet()) + val pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet) + return getNewInstance(castArg, validationMetadata.pathToItem, pathToSchemasMap) + } + + + @Throws(ValidationException::class) + override fun validate(arg: Any?, configuration: SchemaConfiguration?): Any? { + if (arg is Map<*, *>) { + return validate(arg, configuration) + } + throw ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema") + } + override fun getNewInstance(arg: Any?, pathToItem: List, pathToSchemas: PathToSchemasMap): Any? { + if (arg is Map<*, *>) { + return getNewInstance(arg, pathToItem, pathToSchemas) + } + throw RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema") + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: Map<*, *>, configuration: SchemaConfiguration?): NonAsciiPatternWithAdditionalproperties1BoxedMap { + return NonAsciiPatternWithAdditionalproperties1BoxedMap(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: Any?, configuration: SchemaConfiguration?): NonAsciiPatternWithAdditionalproperties1Boxed { + if (arg is Map<*, *>) { + return validateAndBox(arg, configuration) + } + throw ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema") + } + } + +} diff --git a/samples/client/3_1_0_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/schemas/NonInterferenceAcrossCombinedSchemas.kt b/samples/client/3_1_0_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/schemas/NonInterferenceAcrossCombinedSchemas.kt new file mode 100644 index 00000000000..15b1a75e9c7 --- /dev/null +++ b/samples/client/3_1_0_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/schemas/NonInterferenceAcrossCombinedSchemas.kt @@ -0,0 +1,1963 @@ +package org.openapijsonschematools.client.components.schemas +import java.math.BigDecimal +import java.time.LocalDate +import java.time.ZonedDateTime +import java.util.UUID +import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags +import org.openapijsonschematools.client.configurations.SchemaConfiguration +import org.openapijsonschematools.client.exceptions.InvalidAdditionalPropertyException +import org.openapijsonschematools.client.exceptions.UnsetPropertyException +import org.openapijsonschematools.client.exceptions.ValidationException +import org.openapijsonschematools.client.schemas.UnsetAddPropsSetter +import org.openapijsonschematools.client.schemas.validation.BooleanSchemaValidator +import org.openapijsonschematools.client.schemas.validation.FrozenList +import org.openapijsonschematools.client.schemas.validation.FrozenMap +import org.openapijsonschematools.client.schemas.validation.JsonSchema +import org.openapijsonschematools.client.schemas.validation.JsonSchemaInfo +import org.openapijsonschematools.client.schemas.validation.ListSchemaValidator +import org.openapijsonschematools.client.schemas.validation.MapSchemaValidator +import org.openapijsonschematools.client.schemas.validation.NullSchemaValidator +import org.openapijsonschematools.client.schemas.validation.NumberSchemaValidator +import org.openapijsonschematools.client.schemas.validation.PathToSchemasMap +import org.openapijsonschematools.client.schemas.validation.StringSchemaValidator +import org.openapijsonschematools.client.schemas.validation.ValidationMetadata + +class NonInterferenceAcrossCombinedSchemas { + // nest classes so all schemas and input/output classes can be public + + + sealed interface IfSchemaBoxed { + fun getData(): Any? + } + + data class IfSchemaBoxedVoid(val data: Nothing?) : IfSchemaBoxed { + override fun getData(): Any? { + return data + } + } + + data class IfSchemaBoxedBoolean(val data: Boolean): IfSchemaBoxed { + override fun getData(): Any? { + return data + } + } + + data class IfSchemaBoxedNumber(val data: Number) : IfSchemaBoxed { + override fun getData(): Any? { + return data + } + } + + data class IfSchemaBoxedString(val data: String) : IfSchemaBoxed { + override fun getData(): Any? { + return data + } + } + + data class IfSchemaBoxedList(val data: FrozenList) : IfSchemaBoxed { + override fun getData(): Any? { + return data + } + } + + data class IfSchemaBoxedMap(val data: FrozenMap) : IfSchemaBoxed { + override fun getData(): Any? { + return data + } + } + + + class IfSchema private constructor(): JsonSchema( + JsonSchemaInfo() + .exclusiveMaximum(0) + ), NullSchemaValidator, BooleanSchemaValidator, NumberSchemaValidator, StringSchemaValidator, ListSchemaValidator, IfSchemaBoxedList>, MapSchemaValidator, IfSchemaBoxedMap> { + + companion object { + @Volatile + private var instance: IfSchema? = null + + fun getInstance() = + instance ?: synchronized(this) { + instance ?: IfSchema().also { instance = it } + } + } + + @Throws(ValidationException::class) + override fun validate(arg: Nothing?, configuration: SchemaConfiguration?): Nothing? { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validatedPathToSchemas = PathToSchemasMap() + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, LinkedHashSet()) + getPathToSchemas(this, castArg, validationMetadata, pathSet) + return castArg + } + + @Throws(ValidationException::class) + override fun validate(arg: Boolean, configuration: SchemaConfiguration?): Boolean { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validatedPathToSchemas = PathToSchemasMap() + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, LinkedHashSet()) + getPathToSchemas(this, castArg, validationMetadata, pathSet) + return castArg + } + + @Throws(ValidationException::class) + override fun validate(arg: Number, configuration: SchemaConfiguration?): Number { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validatedPathToSchemas = PathToSchemasMap() + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, LinkedHashSet()) + getPathToSchemas(this, castArg, validationMetadata, pathSet) + return castArg + } + + @Throws(ValidationException::class) + fun validate(arg: Int, configuration: SchemaConfiguration?): Int { + return validate(arg as Number, configuration) as Int + } + + @Throws(ValidationException::class) + fun validate(arg: Long, configuration: SchemaConfiguration?): Long { + return validate(arg as Number, configuration) as Long + } + + @Throws(ValidationException::class) + fun validate(arg: Float, configuration: SchemaConfiguration?): Float { + return validate(arg as Number, configuration) as Float + } + + @Throws(ValidationException::class) + fun validate(arg: Double, configuration: SchemaConfiguration?): Double { + return validate(arg as Number, configuration) as Double + } + + @Throws(ValidationException::class) + override fun validate(arg: String, configuration: SchemaConfiguration?): String { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validatedPathToSchemas = PathToSchemasMap() + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, LinkedHashSet()) + getPathToSchemas(this, castArg, validationMetadata, pathSet) + return castArg + } + + @Throws(ValidationException::class) + fun validate(arg: LocalDate, configuration: SchemaConfiguration?): String { + return validate(arg.toString(), configuration) + } + + @Throws(ValidationException::class) + fun validate(arg: ZonedDateTime, configuration: SchemaConfiguration?): String { + return validate(arg.toString(), configuration) + } + + @Throws(ValidationException::class) + fun validate(arg: UUID, configuration: SchemaConfiguration?): String { + return validate(arg.toString(), configuration) + } + + override fun getNewInstance(arg: List<*>, pathToItem: List, pathToSchemas: PathToSchemasMap): FrozenList { + val items: MutableList = ArrayList() + var i: Int = 0 + for (item: Any? in arg) { + val itemPathToItem = pathToItem + i + val schemas: LinkedHashMap, Nothing?>? = pathToSchemas.get(itemPathToItem) + if (schemas == null) { + throw RuntimeException("Validation result is invalid, schemas must exist for a pathToItem") + } + val itemSchema: JsonSchema<*> = schemas.entries.iterator().next().key + val itemInstance: Any? = itemSchema.getNewInstance(item, itemPathToItem, pathToSchemas) + items.add(itemInstance) + i += 1 + } + val newInstanceItems: FrozenList = FrozenList(items) + return newInstanceItems + } + + @Throws(ValidationException::class) + override fun validate(arg: List<*>, configuration: SchemaConfiguration?): FrozenList { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, PathToSchemasMap(), LinkedHashSet()) + val pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet) + return getNewInstance(castArg, validationMetadata.pathToItem, pathToSchemasMap) + } + + override fun getNewInstance(arg: Map<*, *>, pathToItem: List, pathToSchemas: PathToSchemasMap): FrozenMap { + val properties: LinkedHashMap = LinkedHashMap() + for((propertyName, value) in arg) { + if (!(propertyName is String)) { + throw RuntimeException("Invalid non-string key value") + } + val propertyPathToItem: List = pathToItem + propertyName + val schemas: LinkedHashMap, Nothing?>? = pathToSchemas.get(propertyPathToItem) + if (schemas == null) { + throw RuntimeException("Validation result is invalid, schemas must exist for a pathToItem") + } + val propertySchema: JsonSchema<*> = schemas.entries.iterator().next().key + val propertyInstance: Any? = propertySchema.getNewInstance(value, propertyPathToItem, pathToSchemas) + properties[propertyName] = propertyInstance + } + val castProperties: FrozenMap = FrozenMap(properties) + return castProperties + } + + @Throws(ValidationException::class) + override fun validate(arg: Map<*, *>, configuration: SchemaConfiguration?): FrozenMap { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validatedPathToSchemas = PathToSchemasMap() + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, LinkedHashSet()) + val pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet) + return getNewInstance(castArg, validationMetadata.pathToItem, pathToSchemasMap) + } + + @Throws(ValidationException::class) + override fun validate(arg: Any?, configuration: SchemaConfiguration?): Any? { + if (arg == null) { + return validate(null, configuration) + } else if (arg is Boolean) { + return validate(arg, configuration) + } else if (arg is Number) { + return validate(arg, configuration) + } else if (arg is String) { + return validate(arg, configuration) + } else if (arg is List<*>) { + return validate(arg, configuration) + } else if (arg is Map<*, *>) { + return validate(arg, configuration) + } + throw ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema") + } + override fun getNewInstance(arg: Any?, pathToItem: List, pathToSchemas: PathToSchemasMap): Any? { + if (arg == null) { + return getNewInstance( null, pathToItem, pathToSchemas) + } else if (arg is Boolean) { + return getNewInstance(arg, pathToItem, pathToSchemas) + } else if (arg is Number) { + return getNewInstance(arg, pathToItem, pathToSchemas) + } else if (arg is String) { + return getNewInstance(arg, pathToItem, pathToSchemas) + } else if (arg is List<*>) { + return getNewInstance(arg, pathToItem, pathToSchemas) + } else if (arg is Map<*, *>) { + return getNewInstance(arg, pathToItem, pathToSchemas) + } + throw RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema") + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: Nothing?, configuration: SchemaConfiguration?): IfSchemaBoxedVoid { + return IfSchemaBoxedVoid(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: Boolean, configuration: SchemaConfiguration?): IfSchemaBoxedBoolean { + return IfSchemaBoxedBoolean(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: Number, configuration: SchemaConfiguration?): IfSchemaBoxedNumber { + return IfSchemaBoxedNumber(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: String, configuration: SchemaConfiguration?): IfSchemaBoxedString { + return IfSchemaBoxedString(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: List<*>, configuration: SchemaConfiguration?): IfSchemaBoxedList { + return IfSchemaBoxedList(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: Map<*, *>, configuration: SchemaConfiguration?): IfSchemaBoxedMap { + return IfSchemaBoxedMap(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: Any?, configuration: SchemaConfiguration?): IfSchemaBoxed { + if (arg == null) { + return validateAndBox(null, configuration) + } else if (arg is Boolean) { + return validateAndBox(arg, configuration) + } else if (arg is String) { + return validateAndBox(arg, configuration) + } else if (arg is Number) { + return validateAndBox(arg, configuration) + } else if (arg is List<*>) { + return validateAndBox(arg, configuration) + } else if (arg is Map<*, *>) { + return validateAndBox(arg, configuration) + } + throw ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema") + } + } + + sealed interface Schema0Boxed { + fun getData(): Any? + } + + data class Schema0BoxedVoid(val data: Nothing?) : Schema0Boxed { + override fun getData(): Any? { + return data + } + } + + data class Schema0BoxedBoolean(val data: Boolean): Schema0Boxed { + override fun getData(): Any? { + return data + } + } + + data class Schema0BoxedNumber(val data: Number) : Schema0Boxed { + override fun getData(): Any? { + return data + } + } + + data class Schema0BoxedString(val data: String) : Schema0Boxed { + override fun getData(): Any? { + return data + } + } + + data class Schema0BoxedList(val data: FrozenList) : Schema0Boxed { + override fun getData(): Any? { + return data + } + } + + data class Schema0BoxedMap(val data: FrozenMap) : Schema0Boxed { + override fun getData(): Any? { + return data + } + } + + + class Schema0 private constructor(): JsonSchema( + JsonSchemaInfo() + .ifSchema(IfSchema::class.java) + ), NullSchemaValidator, BooleanSchemaValidator, NumberSchemaValidator, StringSchemaValidator, ListSchemaValidator, Schema0BoxedList>, MapSchemaValidator, Schema0BoxedMap> { + + companion object { + @Volatile + private var instance: Schema0? = null + + fun getInstance() = + instance ?: synchronized(this) { + instance ?: Schema0().also { instance = it } + } + } + + @Throws(ValidationException::class) + override fun validate(arg: Nothing?, configuration: SchemaConfiguration?): Nothing? { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validatedPathToSchemas = PathToSchemasMap() + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, LinkedHashSet()) + getPathToSchemas(this, castArg, validationMetadata, pathSet) + return castArg + } + + @Throws(ValidationException::class) + override fun validate(arg: Boolean, configuration: SchemaConfiguration?): Boolean { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validatedPathToSchemas = PathToSchemasMap() + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, LinkedHashSet()) + getPathToSchemas(this, castArg, validationMetadata, pathSet) + return castArg + } + + @Throws(ValidationException::class) + override fun validate(arg: Number, configuration: SchemaConfiguration?): Number { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validatedPathToSchemas = PathToSchemasMap() + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, LinkedHashSet()) + getPathToSchemas(this, castArg, validationMetadata, pathSet) + return castArg + } + + @Throws(ValidationException::class) + fun validate(arg: Int, configuration: SchemaConfiguration?): Int { + return validate(arg as Number, configuration) as Int + } + + @Throws(ValidationException::class) + fun validate(arg: Long, configuration: SchemaConfiguration?): Long { + return validate(arg as Number, configuration) as Long + } + + @Throws(ValidationException::class) + fun validate(arg: Float, configuration: SchemaConfiguration?): Float { + return validate(arg as Number, configuration) as Float + } + + @Throws(ValidationException::class) + fun validate(arg: Double, configuration: SchemaConfiguration?): Double { + return validate(arg as Number, configuration) as Double + } + + @Throws(ValidationException::class) + override fun validate(arg: String, configuration: SchemaConfiguration?): String { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validatedPathToSchemas = PathToSchemasMap() + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, LinkedHashSet()) + getPathToSchemas(this, castArg, validationMetadata, pathSet) + return castArg + } + + @Throws(ValidationException::class) + fun validate(arg: LocalDate, configuration: SchemaConfiguration?): String { + return validate(arg.toString(), configuration) + } + + @Throws(ValidationException::class) + fun validate(arg: ZonedDateTime, configuration: SchemaConfiguration?): String { + return validate(arg.toString(), configuration) + } + + @Throws(ValidationException::class) + fun validate(arg: UUID, configuration: SchemaConfiguration?): String { + return validate(arg.toString(), configuration) + } + + override fun getNewInstance(arg: List<*>, pathToItem: List, pathToSchemas: PathToSchemasMap): FrozenList { + val items: MutableList = ArrayList() + var i: Int = 0 + for (item: Any? in arg) { + val itemPathToItem = pathToItem + i + val schemas: LinkedHashMap, Nothing?>? = pathToSchemas.get(itemPathToItem) + if (schemas == null) { + throw RuntimeException("Validation result is invalid, schemas must exist for a pathToItem") + } + val itemSchema: JsonSchema<*> = schemas.entries.iterator().next().key + val itemInstance: Any? = itemSchema.getNewInstance(item, itemPathToItem, pathToSchemas) + items.add(itemInstance) + i += 1 + } + val newInstanceItems: FrozenList = FrozenList(items) + return newInstanceItems + } + + @Throws(ValidationException::class) + override fun validate(arg: List<*>, configuration: SchemaConfiguration?): FrozenList { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, PathToSchemasMap(), LinkedHashSet()) + val pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet) + return getNewInstance(castArg, validationMetadata.pathToItem, pathToSchemasMap) + } + + override fun getNewInstance(arg: Map<*, *>, pathToItem: List, pathToSchemas: PathToSchemasMap): FrozenMap { + val properties: LinkedHashMap = LinkedHashMap() + for((propertyName, value) in arg) { + if (!(propertyName is String)) { + throw RuntimeException("Invalid non-string key value") + } + val propertyPathToItem: List = pathToItem + propertyName + val schemas: LinkedHashMap, Nothing?>? = pathToSchemas.get(propertyPathToItem) + if (schemas == null) { + throw RuntimeException("Validation result is invalid, schemas must exist for a pathToItem") + } + val propertySchema: JsonSchema<*> = schemas.entries.iterator().next().key + val propertyInstance: Any? = propertySchema.getNewInstance(value, propertyPathToItem, pathToSchemas) + properties[propertyName] = propertyInstance + } + val castProperties: FrozenMap = FrozenMap(properties) + return castProperties + } + + @Throws(ValidationException::class) + override fun validate(arg: Map<*, *>, configuration: SchemaConfiguration?): FrozenMap { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validatedPathToSchemas = PathToSchemasMap() + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, LinkedHashSet()) + val pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet) + return getNewInstance(castArg, validationMetadata.pathToItem, pathToSchemasMap) + } + + @Throws(ValidationException::class) + override fun validate(arg: Any?, configuration: SchemaConfiguration?): Any? { + if (arg == null) { + return validate(null, configuration) + } else if (arg is Boolean) { + return validate(arg, configuration) + } else if (arg is Number) { + return validate(arg, configuration) + } else if (arg is String) { + return validate(arg, configuration) + } else if (arg is List<*>) { + return validate(arg, configuration) + } else if (arg is Map<*, *>) { + return validate(arg, configuration) + } + throw ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema") + } + override fun getNewInstance(arg: Any?, pathToItem: List, pathToSchemas: PathToSchemasMap): Any? { + if (arg == null) { + return getNewInstance( null, pathToItem, pathToSchemas) + } else if (arg is Boolean) { + return getNewInstance(arg, pathToItem, pathToSchemas) + } else if (arg is Number) { + return getNewInstance(arg, pathToItem, pathToSchemas) + } else if (arg is String) { + return getNewInstance(arg, pathToItem, pathToSchemas) + } else if (arg is List<*>) { + return getNewInstance(arg, pathToItem, pathToSchemas) + } else if (arg is Map<*, *>) { + return getNewInstance(arg, pathToItem, pathToSchemas) + } + throw RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema") + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: Nothing?, configuration: SchemaConfiguration?): Schema0BoxedVoid { + return Schema0BoxedVoid(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: Boolean, configuration: SchemaConfiguration?): Schema0BoxedBoolean { + return Schema0BoxedBoolean(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: Number, configuration: SchemaConfiguration?): Schema0BoxedNumber { + return Schema0BoxedNumber(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: String, configuration: SchemaConfiguration?): Schema0BoxedString { + return Schema0BoxedString(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: List<*>, configuration: SchemaConfiguration?): Schema0BoxedList { + return Schema0BoxedList(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: Map<*, *>, configuration: SchemaConfiguration?): Schema0BoxedMap { + return Schema0BoxedMap(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: Any?, configuration: SchemaConfiguration?): Schema0Boxed { + if (arg == null) { + return validateAndBox(null, configuration) + } else if (arg is Boolean) { + return validateAndBox(arg, configuration) + } else if (arg is String) { + return validateAndBox(arg, configuration) + } else if (arg is Number) { + return validateAndBox(arg, configuration) + } else if (arg is List<*>) { + return validateAndBox(arg, configuration) + } else if (arg is Map<*, *>) { + return validateAndBox(arg, configuration) + } + throw ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema") + } + } + + sealed interface ThenBoxed { + fun getData(): Any? + } + + data class ThenBoxedVoid(val data: Nothing?) : ThenBoxed { + override fun getData(): Any? { + return data + } + } + + data class ThenBoxedBoolean(val data: Boolean): ThenBoxed { + override fun getData(): Any? { + return data + } + } + + data class ThenBoxedNumber(val data: Number) : ThenBoxed { + override fun getData(): Any? { + return data + } + } + + data class ThenBoxedString(val data: String) : ThenBoxed { + override fun getData(): Any? { + return data + } + } + + data class ThenBoxedList(val data: FrozenList) : ThenBoxed { + override fun getData(): Any? { + return data + } + } + + data class ThenBoxedMap(val data: FrozenMap) : ThenBoxed { + override fun getData(): Any? { + return data + } + } + + + class Then private constructor(): JsonSchema( + JsonSchemaInfo() + .minimum(-10) + ), NullSchemaValidator, BooleanSchemaValidator, NumberSchemaValidator, StringSchemaValidator, ListSchemaValidator, ThenBoxedList>, MapSchemaValidator, ThenBoxedMap> { + + companion object { + @Volatile + private var instance: Then? = null + + fun getInstance() = + instance ?: synchronized(this) { + instance ?: Then().also { instance = it } + } + } + + @Throws(ValidationException::class) + override fun validate(arg: Nothing?, configuration: SchemaConfiguration?): Nothing? { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validatedPathToSchemas = PathToSchemasMap() + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, LinkedHashSet()) + getPathToSchemas(this, castArg, validationMetadata, pathSet) + return castArg + } + + @Throws(ValidationException::class) + override fun validate(arg: Boolean, configuration: SchemaConfiguration?): Boolean { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validatedPathToSchemas = PathToSchemasMap() + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, LinkedHashSet()) + getPathToSchemas(this, castArg, validationMetadata, pathSet) + return castArg + } + + @Throws(ValidationException::class) + override fun validate(arg: Number, configuration: SchemaConfiguration?): Number { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validatedPathToSchemas = PathToSchemasMap() + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, LinkedHashSet()) + getPathToSchemas(this, castArg, validationMetadata, pathSet) + return castArg + } + + @Throws(ValidationException::class) + fun validate(arg: Int, configuration: SchemaConfiguration?): Int { + return validate(arg as Number, configuration) as Int + } + + @Throws(ValidationException::class) + fun validate(arg: Long, configuration: SchemaConfiguration?): Long { + return validate(arg as Number, configuration) as Long + } + + @Throws(ValidationException::class) + fun validate(arg: Float, configuration: SchemaConfiguration?): Float { + return validate(arg as Number, configuration) as Float + } + + @Throws(ValidationException::class) + fun validate(arg: Double, configuration: SchemaConfiguration?): Double { + return validate(arg as Number, configuration) as Double + } + + @Throws(ValidationException::class) + override fun validate(arg: String, configuration: SchemaConfiguration?): String { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validatedPathToSchemas = PathToSchemasMap() + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, LinkedHashSet()) + getPathToSchemas(this, castArg, validationMetadata, pathSet) + return castArg + } + + @Throws(ValidationException::class) + fun validate(arg: LocalDate, configuration: SchemaConfiguration?): String { + return validate(arg.toString(), configuration) + } + + @Throws(ValidationException::class) + fun validate(arg: ZonedDateTime, configuration: SchemaConfiguration?): String { + return validate(arg.toString(), configuration) + } + + @Throws(ValidationException::class) + fun validate(arg: UUID, configuration: SchemaConfiguration?): String { + return validate(arg.toString(), configuration) + } + + override fun getNewInstance(arg: List<*>, pathToItem: List, pathToSchemas: PathToSchemasMap): FrozenList { + val items: MutableList = ArrayList() + var i: Int = 0 + for (item: Any? in arg) { + val itemPathToItem = pathToItem + i + val schemas: LinkedHashMap, Nothing?>? = pathToSchemas.get(itemPathToItem) + if (schemas == null) { + throw RuntimeException("Validation result is invalid, schemas must exist for a pathToItem") + } + val itemSchema: JsonSchema<*> = schemas.entries.iterator().next().key + val itemInstance: Any? = itemSchema.getNewInstance(item, itemPathToItem, pathToSchemas) + items.add(itemInstance) + i += 1 + } + val newInstanceItems: FrozenList = FrozenList(items) + return newInstanceItems + } + + @Throws(ValidationException::class) + override fun validate(arg: List<*>, configuration: SchemaConfiguration?): FrozenList { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, PathToSchemasMap(), LinkedHashSet()) + val pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet) + return getNewInstance(castArg, validationMetadata.pathToItem, pathToSchemasMap) + } + + override fun getNewInstance(arg: Map<*, *>, pathToItem: List, pathToSchemas: PathToSchemasMap): FrozenMap { + val properties: LinkedHashMap = LinkedHashMap() + for((propertyName, value) in arg) { + if (!(propertyName is String)) { + throw RuntimeException("Invalid non-string key value") + } + val propertyPathToItem: List = pathToItem + propertyName + val schemas: LinkedHashMap, Nothing?>? = pathToSchemas.get(propertyPathToItem) + if (schemas == null) { + throw RuntimeException("Validation result is invalid, schemas must exist for a pathToItem") + } + val propertySchema: JsonSchema<*> = schemas.entries.iterator().next().key + val propertyInstance: Any? = propertySchema.getNewInstance(value, propertyPathToItem, pathToSchemas) + properties[propertyName] = propertyInstance + } + val castProperties: FrozenMap = FrozenMap(properties) + return castProperties + } + + @Throws(ValidationException::class) + override fun validate(arg: Map<*, *>, configuration: SchemaConfiguration?): FrozenMap { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validatedPathToSchemas = PathToSchemasMap() + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, LinkedHashSet()) + val pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet) + return getNewInstance(castArg, validationMetadata.pathToItem, pathToSchemasMap) + } + + @Throws(ValidationException::class) + override fun validate(arg: Any?, configuration: SchemaConfiguration?): Any? { + if (arg == null) { + return validate(null, configuration) + } else if (arg is Boolean) { + return validate(arg, configuration) + } else if (arg is Number) { + return validate(arg, configuration) + } else if (arg is String) { + return validate(arg, configuration) + } else if (arg is List<*>) { + return validate(arg, configuration) + } else if (arg is Map<*, *>) { + return validate(arg, configuration) + } + throw ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema") + } + override fun getNewInstance(arg: Any?, pathToItem: List, pathToSchemas: PathToSchemasMap): Any? { + if (arg == null) { + return getNewInstance( null, pathToItem, pathToSchemas) + } else if (arg is Boolean) { + return getNewInstance(arg, pathToItem, pathToSchemas) + } else if (arg is Number) { + return getNewInstance(arg, pathToItem, pathToSchemas) + } else if (arg is String) { + return getNewInstance(arg, pathToItem, pathToSchemas) + } else if (arg is List<*>) { + return getNewInstance(arg, pathToItem, pathToSchemas) + } else if (arg is Map<*, *>) { + return getNewInstance(arg, pathToItem, pathToSchemas) + } + throw RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema") + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: Nothing?, configuration: SchemaConfiguration?): ThenBoxedVoid { + return ThenBoxedVoid(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: Boolean, configuration: SchemaConfiguration?): ThenBoxedBoolean { + return ThenBoxedBoolean(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: Number, configuration: SchemaConfiguration?): ThenBoxedNumber { + return ThenBoxedNumber(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: String, configuration: SchemaConfiguration?): ThenBoxedString { + return ThenBoxedString(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: List<*>, configuration: SchemaConfiguration?): ThenBoxedList { + return ThenBoxedList(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: Map<*, *>, configuration: SchemaConfiguration?): ThenBoxedMap { + return ThenBoxedMap(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: Any?, configuration: SchemaConfiguration?): ThenBoxed { + if (arg == null) { + return validateAndBox(null, configuration) + } else if (arg is Boolean) { + return validateAndBox(arg, configuration) + } else if (arg is String) { + return validateAndBox(arg, configuration) + } else if (arg is Number) { + return validateAndBox(arg, configuration) + } else if (arg is List<*>) { + return validateAndBox(arg, configuration) + } else if (arg is Map<*, *>) { + return validateAndBox(arg, configuration) + } + throw ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema") + } + } + + sealed interface Schema1Boxed { + fun getData(): Any? + } + + data class Schema1BoxedVoid(val data: Nothing?) : Schema1Boxed { + override fun getData(): Any? { + return data + } + } + + data class Schema1BoxedBoolean(val data: Boolean): Schema1Boxed { + override fun getData(): Any? { + return data + } + } + + data class Schema1BoxedNumber(val data: Number) : Schema1Boxed { + override fun getData(): Any? { + return data + } + } + + data class Schema1BoxedString(val data: String) : Schema1Boxed { + override fun getData(): Any? { + return data + } + } + + data class Schema1BoxedList(val data: FrozenList) : Schema1Boxed { + override fun getData(): Any? { + return data + } + } + + data class Schema1BoxedMap(val data: FrozenMap) : Schema1Boxed { + override fun getData(): Any? { + return data + } + } + + + class Schema1 private constructor(): JsonSchema( + JsonSchemaInfo() + .then(Then::class.java) + ), NullSchemaValidator, BooleanSchemaValidator, NumberSchemaValidator, StringSchemaValidator, ListSchemaValidator, Schema1BoxedList>, MapSchemaValidator, Schema1BoxedMap> { + + companion object { + @Volatile + private var instance: Schema1? = null + + fun getInstance() = + instance ?: synchronized(this) { + instance ?: Schema1().also { instance = it } + } + } + + @Throws(ValidationException::class) + override fun validate(arg: Nothing?, configuration: SchemaConfiguration?): Nothing? { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validatedPathToSchemas = PathToSchemasMap() + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, LinkedHashSet()) + getPathToSchemas(this, castArg, validationMetadata, pathSet) + return castArg + } + + @Throws(ValidationException::class) + override fun validate(arg: Boolean, configuration: SchemaConfiguration?): Boolean { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validatedPathToSchemas = PathToSchemasMap() + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, LinkedHashSet()) + getPathToSchemas(this, castArg, validationMetadata, pathSet) + return castArg + } + + @Throws(ValidationException::class) + override fun validate(arg: Number, configuration: SchemaConfiguration?): Number { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validatedPathToSchemas = PathToSchemasMap() + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, LinkedHashSet()) + getPathToSchemas(this, castArg, validationMetadata, pathSet) + return castArg + } + + @Throws(ValidationException::class) + fun validate(arg: Int, configuration: SchemaConfiguration?): Int { + return validate(arg as Number, configuration) as Int + } + + @Throws(ValidationException::class) + fun validate(arg: Long, configuration: SchemaConfiguration?): Long { + return validate(arg as Number, configuration) as Long + } + + @Throws(ValidationException::class) + fun validate(arg: Float, configuration: SchemaConfiguration?): Float { + return validate(arg as Number, configuration) as Float + } + + @Throws(ValidationException::class) + fun validate(arg: Double, configuration: SchemaConfiguration?): Double { + return validate(arg as Number, configuration) as Double + } + + @Throws(ValidationException::class) + override fun validate(arg: String, configuration: SchemaConfiguration?): String { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validatedPathToSchemas = PathToSchemasMap() + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, LinkedHashSet()) + getPathToSchemas(this, castArg, validationMetadata, pathSet) + return castArg + } + + @Throws(ValidationException::class) + fun validate(arg: LocalDate, configuration: SchemaConfiguration?): String { + return validate(arg.toString(), configuration) + } + + @Throws(ValidationException::class) + fun validate(arg: ZonedDateTime, configuration: SchemaConfiguration?): String { + return validate(arg.toString(), configuration) + } + + @Throws(ValidationException::class) + fun validate(arg: UUID, configuration: SchemaConfiguration?): String { + return validate(arg.toString(), configuration) + } + + override fun getNewInstance(arg: List<*>, pathToItem: List, pathToSchemas: PathToSchemasMap): FrozenList { + val items: MutableList = ArrayList() + var i: Int = 0 + for (item: Any? in arg) { + val itemPathToItem = pathToItem + i + val schemas: LinkedHashMap, Nothing?>? = pathToSchemas.get(itemPathToItem) + if (schemas == null) { + throw RuntimeException("Validation result is invalid, schemas must exist for a pathToItem") + } + val itemSchema: JsonSchema<*> = schemas.entries.iterator().next().key + val itemInstance: Any? = itemSchema.getNewInstance(item, itemPathToItem, pathToSchemas) + items.add(itemInstance) + i += 1 + } + val newInstanceItems: FrozenList = FrozenList(items) + return newInstanceItems + } + + @Throws(ValidationException::class) + override fun validate(arg: List<*>, configuration: SchemaConfiguration?): FrozenList { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, PathToSchemasMap(), LinkedHashSet()) + val pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet) + return getNewInstance(castArg, validationMetadata.pathToItem, pathToSchemasMap) + } + + override fun getNewInstance(arg: Map<*, *>, pathToItem: List, pathToSchemas: PathToSchemasMap): FrozenMap { + val properties: LinkedHashMap = LinkedHashMap() + for((propertyName, value) in arg) { + if (!(propertyName is String)) { + throw RuntimeException("Invalid non-string key value") + } + val propertyPathToItem: List = pathToItem + propertyName + val schemas: LinkedHashMap, Nothing?>? = pathToSchemas.get(propertyPathToItem) + if (schemas == null) { + throw RuntimeException("Validation result is invalid, schemas must exist for a pathToItem") + } + val propertySchema: JsonSchema<*> = schemas.entries.iterator().next().key + val propertyInstance: Any? = propertySchema.getNewInstance(value, propertyPathToItem, pathToSchemas) + properties[propertyName] = propertyInstance + } + val castProperties: FrozenMap = FrozenMap(properties) + return castProperties + } + + @Throws(ValidationException::class) + override fun validate(arg: Map<*, *>, configuration: SchemaConfiguration?): FrozenMap { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validatedPathToSchemas = PathToSchemasMap() + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, LinkedHashSet()) + val pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet) + return getNewInstance(castArg, validationMetadata.pathToItem, pathToSchemasMap) + } + + @Throws(ValidationException::class) + override fun validate(arg: Any?, configuration: SchemaConfiguration?): Any? { + if (arg == null) { + return validate(null, configuration) + } else if (arg is Boolean) { + return validate(arg, configuration) + } else if (arg is Number) { + return validate(arg, configuration) + } else if (arg is String) { + return validate(arg, configuration) + } else if (arg is List<*>) { + return validate(arg, configuration) + } else if (arg is Map<*, *>) { + return validate(arg, configuration) + } + throw ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema") + } + override fun getNewInstance(arg: Any?, pathToItem: List, pathToSchemas: PathToSchemasMap): Any? { + if (arg == null) { + return getNewInstance( null, pathToItem, pathToSchemas) + } else if (arg is Boolean) { + return getNewInstance(arg, pathToItem, pathToSchemas) + } else if (arg is Number) { + return getNewInstance(arg, pathToItem, pathToSchemas) + } else if (arg is String) { + return getNewInstance(arg, pathToItem, pathToSchemas) + } else if (arg is List<*>) { + return getNewInstance(arg, pathToItem, pathToSchemas) + } else if (arg is Map<*, *>) { + return getNewInstance(arg, pathToItem, pathToSchemas) + } + throw RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema") + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: Nothing?, configuration: SchemaConfiguration?): Schema1BoxedVoid { + return Schema1BoxedVoid(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: Boolean, configuration: SchemaConfiguration?): Schema1BoxedBoolean { + return Schema1BoxedBoolean(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: Number, configuration: SchemaConfiguration?): Schema1BoxedNumber { + return Schema1BoxedNumber(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: String, configuration: SchemaConfiguration?): Schema1BoxedString { + return Schema1BoxedString(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: List<*>, configuration: SchemaConfiguration?): Schema1BoxedList { + return Schema1BoxedList(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: Map<*, *>, configuration: SchemaConfiguration?): Schema1BoxedMap { + return Schema1BoxedMap(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: Any?, configuration: SchemaConfiguration?): Schema1Boxed { + if (arg == null) { + return validateAndBox(null, configuration) + } else if (arg is Boolean) { + return validateAndBox(arg, configuration) + } else if (arg is String) { + return validateAndBox(arg, configuration) + } else if (arg is Number) { + return validateAndBox(arg, configuration) + } else if (arg is List<*>) { + return validateAndBox(arg, configuration) + } else if (arg is Map<*, *>) { + return validateAndBox(arg, configuration) + } + throw ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema") + } + } + + sealed interface ElseSchemaBoxed { + fun getData(): Any? + } + + data class ElseSchemaBoxedVoid(val data: Nothing?) : ElseSchemaBoxed { + override fun getData(): Any? { + return data + } + } + + data class ElseSchemaBoxedBoolean(val data: Boolean): ElseSchemaBoxed { + override fun getData(): Any? { + return data + } + } + + data class ElseSchemaBoxedNumber(val data: Number) : ElseSchemaBoxed { + override fun getData(): Any? { + return data + } + } + + data class ElseSchemaBoxedString(val data: String) : ElseSchemaBoxed { + override fun getData(): Any? { + return data + } + } + + data class ElseSchemaBoxedList(val data: FrozenList) : ElseSchemaBoxed { + override fun getData(): Any? { + return data + } + } + + data class ElseSchemaBoxedMap(val data: FrozenMap) : ElseSchemaBoxed { + override fun getData(): Any? { + return data + } + } + + + class ElseSchema private constructor(): JsonSchema( + JsonSchemaInfo() + .multipleOf(BigDecimal("2")) + ), NullSchemaValidator, BooleanSchemaValidator, NumberSchemaValidator, StringSchemaValidator, ListSchemaValidator, ElseSchemaBoxedList>, MapSchemaValidator, ElseSchemaBoxedMap> { + + companion object { + @Volatile + private var instance: ElseSchema? = null + + fun getInstance() = + instance ?: synchronized(this) { + instance ?: ElseSchema().also { instance = it } + } + } + + @Throws(ValidationException::class) + override fun validate(arg: Nothing?, configuration: SchemaConfiguration?): Nothing? { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validatedPathToSchemas = PathToSchemasMap() + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, LinkedHashSet()) + getPathToSchemas(this, castArg, validationMetadata, pathSet) + return castArg + } + + @Throws(ValidationException::class) + override fun validate(arg: Boolean, configuration: SchemaConfiguration?): Boolean { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validatedPathToSchemas = PathToSchemasMap() + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, LinkedHashSet()) + getPathToSchemas(this, castArg, validationMetadata, pathSet) + return castArg + } + + @Throws(ValidationException::class) + override fun validate(arg: Number, configuration: SchemaConfiguration?): Number { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validatedPathToSchemas = PathToSchemasMap() + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, LinkedHashSet()) + getPathToSchemas(this, castArg, validationMetadata, pathSet) + return castArg + } + + @Throws(ValidationException::class) + fun validate(arg: Int, configuration: SchemaConfiguration?): Int { + return validate(arg as Number, configuration) as Int + } + + @Throws(ValidationException::class) + fun validate(arg: Long, configuration: SchemaConfiguration?): Long { + return validate(arg as Number, configuration) as Long + } + + @Throws(ValidationException::class) + fun validate(arg: Float, configuration: SchemaConfiguration?): Float { + return validate(arg as Number, configuration) as Float + } + + @Throws(ValidationException::class) + fun validate(arg: Double, configuration: SchemaConfiguration?): Double { + return validate(arg as Number, configuration) as Double + } + + @Throws(ValidationException::class) + override fun validate(arg: String, configuration: SchemaConfiguration?): String { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validatedPathToSchemas = PathToSchemasMap() + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, LinkedHashSet()) + getPathToSchemas(this, castArg, validationMetadata, pathSet) + return castArg + } + + @Throws(ValidationException::class) + fun validate(arg: LocalDate, configuration: SchemaConfiguration?): String { + return validate(arg.toString(), configuration) + } + + @Throws(ValidationException::class) + fun validate(arg: ZonedDateTime, configuration: SchemaConfiguration?): String { + return validate(arg.toString(), configuration) + } + + @Throws(ValidationException::class) + fun validate(arg: UUID, configuration: SchemaConfiguration?): String { + return validate(arg.toString(), configuration) + } + + override fun getNewInstance(arg: List<*>, pathToItem: List, pathToSchemas: PathToSchemasMap): FrozenList { + val items: MutableList = ArrayList() + var i: Int = 0 + for (item: Any? in arg) { + val itemPathToItem = pathToItem + i + val schemas: LinkedHashMap, Nothing?>? = pathToSchemas.get(itemPathToItem) + if (schemas == null) { + throw RuntimeException("Validation result is invalid, schemas must exist for a pathToItem") + } + val itemSchema: JsonSchema<*> = schemas.entries.iterator().next().key + val itemInstance: Any? = itemSchema.getNewInstance(item, itemPathToItem, pathToSchemas) + items.add(itemInstance) + i += 1 + } + val newInstanceItems: FrozenList = FrozenList(items) + return newInstanceItems + } + + @Throws(ValidationException::class) + override fun validate(arg: List<*>, configuration: SchemaConfiguration?): FrozenList { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, PathToSchemasMap(), LinkedHashSet()) + val pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet) + return getNewInstance(castArg, validationMetadata.pathToItem, pathToSchemasMap) + } + + override fun getNewInstance(arg: Map<*, *>, pathToItem: List, pathToSchemas: PathToSchemasMap): FrozenMap { + val properties: LinkedHashMap = LinkedHashMap() + for((propertyName, value) in arg) { + if (!(propertyName is String)) { + throw RuntimeException("Invalid non-string key value") + } + val propertyPathToItem: List = pathToItem + propertyName + val schemas: LinkedHashMap, Nothing?>? = pathToSchemas.get(propertyPathToItem) + if (schemas == null) { + throw RuntimeException("Validation result is invalid, schemas must exist for a pathToItem") + } + val propertySchema: JsonSchema<*> = schemas.entries.iterator().next().key + val propertyInstance: Any? = propertySchema.getNewInstance(value, propertyPathToItem, pathToSchemas) + properties[propertyName] = propertyInstance + } + val castProperties: FrozenMap = FrozenMap(properties) + return castProperties + } + + @Throws(ValidationException::class) + override fun validate(arg: Map<*, *>, configuration: SchemaConfiguration?): FrozenMap { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validatedPathToSchemas = PathToSchemasMap() + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, LinkedHashSet()) + val pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet) + return getNewInstance(castArg, validationMetadata.pathToItem, pathToSchemasMap) + } + + @Throws(ValidationException::class) + override fun validate(arg: Any?, configuration: SchemaConfiguration?): Any? { + if (arg == null) { + return validate(null, configuration) + } else if (arg is Boolean) { + return validate(arg, configuration) + } else if (arg is Number) { + return validate(arg, configuration) + } else if (arg is String) { + return validate(arg, configuration) + } else if (arg is List<*>) { + return validate(arg, configuration) + } else if (arg is Map<*, *>) { + return validate(arg, configuration) + } + throw ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema") + } + override fun getNewInstance(arg: Any?, pathToItem: List, pathToSchemas: PathToSchemasMap): Any? { + if (arg == null) { + return getNewInstance( null, pathToItem, pathToSchemas) + } else if (arg is Boolean) { + return getNewInstance(arg, pathToItem, pathToSchemas) + } else if (arg is Number) { + return getNewInstance(arg, pathToItem, pathToSchemas) + } else if (arg is String) { + return getNewInstance(arg, pathToItem, pathToSchemas) + } else if (arg is List<*>) { + return getNewInstance(arg, pathToItem, pathToSchemas) + } else if (arg is Map<*, *>) { + return getNewInstance(arg, pathToItem, pathToSchemas) + } + throw RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema") + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: Nothing?, configuration: SchemaConfiguration?): ElseSchemaBoxedVoid { + return ElseSchemaBoxedVoid(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: Boolean, configuration: SchemaConfiguration?): ElseSchemaBoxedBoolean { + return ElseSchemaBoxedBoolean(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: Number, configuration: SchemaConfiguration?): ElseSchemaBoxedNumber { + return ElseSchemaBoxedNumber(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: String, configuration: SchemaConfiguration?): ElseSchemaBoxedString { + return ElseSchemaBoxedString(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: List<*>, configuration: SchemaConfiguration?): ElseSchemaBoxedList { + return ElseSchemaBoxedList(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: Map<*, *>, configuration: SchemaConfiguration?): ElseSchemaBoxedMap { + return ElseSchemaBoxedMap(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: Any?, configuration: SchemaConfiguration?): ElseSchemaBoxed { + if (arg == null) { + return validateAndBox(null, configuration) + } else if (arg is Boolean) { + return validateAndBox(arg, configuration) + } else if (arg is String) { + return validateAndBox(arg, configuration) + } else if (arg is Number) { + return validateAndBox(arg, configuration) + } else if (arg is List<*>) { + return validateAndBox(arg, configuration) + } else if (arg is Map<*, *>) { + return validateAndBox(arg, configuration) + } + throw ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema") + } + } + + sealed interface Schema2Boxed { + fun getData(): Any? + } + + data class Schema2BoxedVoid(val data: Nothing?) : Schema2Boxed { + override fun getData(): Any? { + return data + } + } + + data class Schema2BoxedBoolean(val data: Boolean): Schema2Boxed { + override fun getData(): Any? { + return data + } + } + + data class Schema2BoxedNumber(val data: Number) : Schema2Boxed { + override fun getData(): Any? { + return data + } + } + + data class Schema2BoxedString(val data: String) : Schema2Boxed { + override fun getData(): Any? { + return data + } + } + + data class Schema2BoxedList(val data: FrozenList) : Schema2Boxed { + override fun getData(): Any? { + return data + } + } + + data class Schema2BoxedMap(val data: FrozenMap) : Schema2Boxed { + override fun getData(): Any? { + return data + } + } + + + class Schema2 private constructor(): JsonSchema( + JsonSchemaInfo() + .elseSchema(ElseSchema::class.java) + ), NullSchemaValidator, BooleanSchemaValidator, NumberSchemaValidator, StringSchemaValidator, ListSchemaValidator, Schema2BoxedList>, MapSchemaValidator, Schema2BoxedMap> { + + companion object { + @Volatile + private var instance: Schema2? = null + + fun getInstance() = + instance ?: synchronized(this) { + instance ?: Schema2().also { instance = it } + } + } + + @Throws(ValidationException::class) + override fun validate(arg: Nothing?, configuration: SchemaConfiguration?): Nothing? { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validatedPathToSchemas = PathToSchemasMap() + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, LinkedHashSet()) + getPathToSchemas(this, castArg, validationMetadata, pathSet) + return castArg + } + + @Throws(ValidationException::class) + override fun validate(arg: Boolean, configuration: SchemaConfiguration?): Boolean { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validatedPathToSchemas = PathToSchemasMap() + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, LinkedHashSet()) + getPathToSchemas(this, castArg, validationMetadata, pathSet) + return castArg + } + + @Throws(ValidationException::class) + override fun validate(arg: Number, configuration: SchemaConfiguration?): Number { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validatedPathToSchemas = PathToSchemasMap() + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, LinkedHashSet()) + getPathToSchemas(this, castArg, validationMetadata, pathSet) + return castArg + } + + @Throws(ValidationException::class) + fun validate(arg: Int, configuration: SchemaConfiguration?): Int { + return validate(arg as Number, configuration) as Int + } + + @Throws(ValidationException::class) + fun validate(arg: Long, configuration: SchemaConfiguration?): Long { + return validate(arg as Number, configuration) as Long + } + + @Throws(ValidationException::class) + fun validate(arg: Float, configuration: SchemaConfiguration?): Float { + return validate(arg as Number, configuration) as Float + } + + @Throws(ValidationException::class) + fun validate(arg: Double, configuration: SchemaConfiguration?): Double { + return validate(arg as Number, configuration) as Double + } + + @Throws(ValidationException::class) + override fun validate(arg: String, configuration: SchemaConfiguration?): String { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validatedPathToSchemas = PathToSchemasMap() + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, LinkedHashSet()) + getPathToSchemas(this, castArg, validationMetadata, pathSet) + return castArg + } + + @Throws(ValidationException::class) + fun validate(arg: LocalDate, configuration: SchemaConfiguration?): String { + return validate(arg.toString(), configuration) + } + + @Throws(ValidationException::class) + fun validate(arg: ZonedDateTime, configuration: SchemaConfiguration?): String { + return validate(arg.toString(), configuration) + } + + @Throws(ValidationException::class) + fun validate(arg: UUID, configuration: SchemaConfiguration?): String { + return validate(arg.toString(), configuration) + } + + override fun getNewInstance(arg: List<*>, pathToItem: List, pathToSchemas: PathToSchemasMap): FrozenList { + val items: MutableList = ArrayList() + var i: Int = 0 + for (item: Any? in arg) { + val itemPathToItem = pathToItem + i + val schemas: LinkedHashMap, Nothing?>? = pathToSchemas.get(itemPathToItem) + if (schemas == null) { + throw RuntimeException("Validation result is invalid, schemas must exist for a pathToItem") + } + val itemSchema: JsonSchema<*> = schemas.entries.iterator().next().key + val itemInstance: Any? = itemSchema.getNewInstance(item, itemPathToItem, pathToSchemas) + items.add(itemInstance) + i += 1 + } + val newInstanceItems: FrozenList = FrozenList(items) + return newInstanceItems + } + + @Throws(ValidationException::class) + override fun validate(arg: List<*>, configuration: SchemaConfiguration?): FrozenList { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, PathToSchemasMap(), LinkedHashSet()) + val pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet) + return getNewInstance(castArg, validationMetadata.pathToItem, pathToSchemasMap) + } + + override fun getNewInstance(arg: Map<*, *>, pathToItem: List, pathToSchemas: PathToSchemasMap): FrozenMap { + val properties: LinkedHashMap = LinkedHashMap() + for((propertyName, value) in arg) { + if (!(propertyName is String)) { + throw RuntimeException("Invalid non-string key value") + } + val propertyPathToItem: List = pathToItem + propertyName + val schemas: LinkedHashMap, Nothing?>? = pathToSchemas.get(propertyPathToItem) + if (schemas == null) { + throw RuntimeException("Validation result is invalid, schemas must exist for a pathToItem") + } + val propertySchema: JsonSchema<*> = schemas.entries.iterator().next().key + val propertyInstance: Any? = propertySchema.getNewInstance(value, propertyPathToItem, pathToSchemas) + properties[propertyName] = propertyInstance + } + val castProperties: FrozenMap = FrozenMap(properties) + return castProperties + } + + @Throws(ValidationException::class) + override fun validate(arg: Map<*, *>, configuration: SchemaConfiguration?): FrozenMap { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validatedPathToSchemas = PathToSchemasMap() + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, LinkedHashSet()) + val pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet) + return getNewInstance(castArg, validationMetadata.pathToItem, pathToSchemasMap) + } + + @Throws(ValidationException::class) + override fun validate(arg: Any?, configuration: SchemaConfiguration?): Any? { + if (arg == null) { + return validate(null, configuration) + } else if (arg is Boolean) { + return validate(arg, configuration) + } else if (arg is Number) { + return validate(arg, configuration) + } else if (arg is String) { + return validate(arg, configuration) + } else if (arg is List<*>) { + return validate(arg, configuration) + } else if (arg is Map<*, *>) { + return validate(arg, configuration) + } + throw ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema") + } + override fun getNewInstance(arg: Any?, pathToItem: List, pathToSchemas: PathToSchemasMap): Any? { + if (arg == null) { + return getNewInstance( null, pathToItem, pathToSchemas) + } else if (arg is Boolean) { + return getNewInstance(arg, pathToItem, pathToSchemas) + } else if (arg is Number) { + return getNewInstance(arg, pathToItem, pathToSchemas) + } else if (arg is String) { + return getNewInstance(arg, pathToItem, pathToSchemas) + } else if (arg is List<*>) { + return getNewInstance(arg, pathToItem, pathToSchemas) + } else if (arg is Map<*, *>) { + return getNewInstance(arg, pathToItem, pathToSchemas) + } + throw RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema") + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: Nothing?, configuration: SchemaConfiguration?): Schema2BoxedVoid { + return Schema2BoxedVoid(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: Boolean, configuration: SchemaConfiguration?): Schema2BoxedBoolean { + return Schema2BoxedBoolean(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: Number, configuration: SchemaConfiguration?): Schema2BoxedNumber { + return Schema2BoxedNumber(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: String, configuration: SchemaConfiguration?): Schema2BoxedString { + return Schema2BoxedString(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: List<*>, configuration: SchemaConfiguration?): Schema2BoxedList { + return Schema2BoxedList(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: Map<*, *>, configuration: SchemaConfiguration?): Schema2BoxedMap { + return Schema2BoxedMap(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: Any?, configuration: SchemaConfiguration?): Schema2Boxed { + if (arg == null) { + return validateAndBox(null, configuration) + } else if (arg is Boolean) { + return validateAndBox(arg, configuration) + } else if (arg is String) { + return validateAndBox(arg, configuration) + } else if (arg is Number) { + return validateAndBox(arg, configuration) + } else if (arg is List<*>) { + return validateAndBox(arg, configuration) + } else if (arg is Map<*, *>) { + return validateAndBox(arg, configuration) + } + throw ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema") + } + } + + sealed interface NonInterferenceAcrossCombinedSchemas1Boxed { + fun getData(): Any? + } + + data class NonInterferenceAcrossCombinedSchemas1BoxedVoid(val data: Nothing?) : NonInterferenceAcrossCombinedSchemas1Boxed { + override fun getData(): Any? { + return data + } + } + + data class NonInterferenceAcrossCombinedSchemas1BoxedBoolean(val data: Boolean): NonInterferenceAcrossCombinedSchemas1Boxed { + override fun getData(): Any? { + return data + } + } + + data class NonInterferenceAcrossCombinedSchemas1BoxedNumber(val data: Number) : NonInterferenceAcrossCombinedSchemas1Boxed { + override fun getData(): Any? { + return data + } + } + + data class NonInterferenceAcrossCombinedSchemas1BoxedString(val data: String) : NonInterferenceAcrossCombinedSchemas1Boxed { + override fun getData(): Any? { + return data + } + } + + data class NonInterferenceAcrossCombinedSchemas1BoxedList(val data: FrozenList) : NonInterferenceAcrossCombinedSchemas1Boxed { + override fun getData(): Any? { + return data + } + } + + data class NonInterferenceAcrossCombinedSchemas1BoxedMap(val data: FrozenMap) : NonInterferenceAcrossCombinedSchemas1Boxed { + override fun getData(): Any? { + return data + } + } + + + class NonInterferenceAcrossCombinedSchemas1 private constructor(): JsonSchema( + JsonSchemaInfo() + .allOf(listOf( + Schema0::class.java, + Schema1::class.java, + Schema2::class.java + )) + ), NullSchemaValidator, BooleanSchemaValidator, NumberSchemaValidator, StringSchemaValidator, ListSchemaValidator, NonInterferenceAcrossCombinedSchemas1BoxedList>, MapSchemaValidator, NonInterferenceAcrossCombinedSchemas1BoxedMap> { + /* + NOTE: This class is auto generated by OpenAPI JSON Schema Generator. + Ref: https://github.com/openapi-json-schema-tools/openapi-json-schema-generator + + Do not edit the class manually. + */ + + companion object { + @Volatile + private var instance: NonInterferenceAcrossCombinedSchemas1? = null + + fun getInstance() = + instance ?: synchronized(this) { + instance ?: NonInterferenceAcrossCombinedSchemas1().also { instance = it } + } + } + + @Throws(ValidationException::class) + override fun validate(arg: Nothing?, configuration: SchemaConfiguration?): Nothing? { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validatedPathToSchemas = PathToSchemasMap() + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, LinkedHashSet()) + getPathToSchemas(this, castArg, validationMetadata, pathSet) + return castArg + } + + @Throws(ValidationException::class) + override fun validate(arg: Boolean, configuration: SchemaConfiguration?): Boolean { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validatedPathToSchemas = PathToSchemasMap() + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, LinkedHashSet()) + getPathToSchemas(this, castArg, validationMetadata, pathSet) + return castArg + } + + @Throws(ValidationException::class) + override fun validate(arg: Number, configuration: SchemaConfiguration?): Number { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validatedPathToSchemas = PathToSchemasMap() + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, LinkedHashSet()) + getPathToSchemas(this, castArg, validationMetadata, pathSet) + return castArg + } + + @Throws(ValidationException::class) + fun validate(arg: Int, configuration: SchemaConfiguration?): Int { + return validate(arg as Number, configuration) as Int + } + + @Throws(ValidationException::class) + fun validate(arg: Long, configuration: SchemaConfiguration?): Long { + return validate(arg as Number, configuration) as Long + } + + @Throws(ValidationException::class) + fun validate(arg: Float, configuration: SchemaConfiguration?): Float { + return validate(arg as Number, configuration) as Float + } + + @Throws(ValidationException::class) + fun validate(arg: Double, configuration: SchemaConfiguration?): Double { + return validate(arg as Number, configuration) as Double + } + + @Throws(ValidationException::class) + override fun validate(arg: String, configuration: SchemaConfiguration?): String { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validatedPathToSchemas = PathToSchemasMap() + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, LinkedHashSet()) + getPathToSchemas(this, castArg, validationMetadata, pathSet) + return castArg + } + + @Throws(ValidationException::class) + fun validate(arg: LocalDate, configuration: SchemaConfiguration?): String { + return validate(arg.toString(), configuration) + } + + @Throws(ValidationException::class) + fun validate(arg: ZonedDateTime, configuration: SchemaConfiguration?): String { + return validate(arg.toString(), configuration) + } + + @Throws(ValidationException::class) + fun validate(arg: UUID, configuration: SchemaConfiguration?): String { + return validate(arg.toString(), configuration) + } + + override fun getNewInstance(arg: List<*>, pathToItem: List, pathToSchemas: PathToSchemasMap): FrozenList { + val items: MutableList = ArrayList() + var i: Int = 0 + for (item: Any? in arg) { + val itemPathToItem = pathToItem + i + val schemas: LinkedHashMap, Nothing?>? = pathToSchemas.get(itemPathToItem) + if (schemas == null) { + throw RuntimeException("Validation result is invalid, schemas must exist for a pathToItem") + } + val itemSchema: JsonSchema<*> = schemas.entries.iterator().next().key + val itemInstance: Any? = itemSchema.getNewInstance(item, itemPathToItem, pathToSchemas) + items.add(itemInstance) + i += 1 + } + val newInstanceItems: FrozenList = FrozenList(items) + return newInstanceItems + } + + @Throws(ValidationException::class) + override fun validate(arg: List<*>, configuration: SchemaConfiguration?): FrozenList { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, PathToSchemasMap(), LinkedHashSet()) + val pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet) + return getNewInstance(castArg, validationMetadata.pathToItem, pathToSchemasMap) + } + + override fun getNewInstance(arg: Map<*, *>, pathToItem: List, pathToSchemas: PathToSchemasMap): FrozenMap { + val properties: LinkedHashMap = LinkedHashMap() + for((propertyName, value) in arg) { + if (!(propertyName is String)) { + throw RuntimeException("Invalid non-string key value") + } + val propertyPathToItem: List = pathToItem + propertyName + val schemas: LinkedHashMap, Nothing?>? = pathToSchemas.get(propertyPathToItem) + if (schemas == null) { + throw RuntimeException("Validation result is invalid, schemas must exist for a pathToItem") + } + val propertySchema: JsonSchema<*> = schemas.entries.iterator().next().key + val propertyInstance: Any? = propertySchema.getNewInstance(value, propertyPathToItem, pathToSchemas) + properties[propertyName] = propertyInstance + } + val castProperties: FrozenMap = FrozenMap(properties) + return castProperties + } + + @Throws(ValidationException::class) + override fun validate(arg: Map<*, *>, configuration: SchemaConfiguration?): FrozenMap { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validatedPathToSchemas = PathToSchemasMap() + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, LinkedHashSet()) + val pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet) + return getNewInstance(castArg, validationMetadata.pathToItem, pathToSchemasMap) + } + + @Throws(ValidationException::class) + override fun validate(arg: Any?, configuration: SchemaConfiguration?): Any? { + if (arg == null) { + return validate(null, configuration) + } else if (arg is Boolean) { + return validate(arg, configuration) + } else if (arg is Number) { + return validate(arg, configuration) + } else if (arg is String) { + return validate(arg, configuration) + } else if (arg is List<*>) { + return validate(arg, configuration) + } else if (arg is Map<*, *>) { + return validate(arg, configuration) + } + throw ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema") + } + override fun getNewInstance(arg: Any?, pathToItem: List, pathToSchemas: PathToSchemasMap): Any? { + if (arg == null) { + return getNewInstance( null, pathToItem, pathToSchemas) + } else if (arg is Boolean) { + return getNewInstance(arg, pathToItem, pathToSchemas) + } else if (arg is Number) { + return getNewInstance(arg, pathToItem, pathToSchemas) + } else if (arg is String) { + return getNewInstance(arg, pathToItem, pathToSchemas) + } else if (arg is List<*>) { + return getNewInstance(arg, pathToItem, pathToSchemas) + } else if (arg is Map<*, *>) { + return getNewInstance(arg, pathToItem, pathToSchemas) + } + throw RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema") + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: Nothing?, configuration: SchemaConfiguration?): NonInterferenceAcrossCombinedSchemas1BoxedVoid { + return NonInterferenceAcrossCombinedSchemas1BoxedVoid(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: Boolean, configuration: SchemaConfiguration?): NonInterferenceAcrossCombinedSchemas1BoxedBoolean { + return NonInterferenceAcrossCombinedSchemas1BoxedBoolean(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: Number, configuration: SchemaConfiguration?): NonInterferenceAcrossCombinedSchemas1BoxedNumber { + return NonInterferenceAcrossCombinedSchemas1BoxedNumber(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: String, configuration: SchemaConfiguration?): NonInterferenceAcrossCombinedSchemas1BoxedString { + return NonInterferenceAcrossCombinedSchemas1BoxedString(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: List<*>, configuration: SchemaConfiguration?): NonInterferenceAcrossCombinedSchemas1BoxedList { + return NonInterferenceAcrossCombinedSchemas1BoxedList(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: Map<*, *>, configuration: SchemaConfiguration?): NonInterferenceAcrossCombinedSchemas1BoxedMap { + return NonInterferenceAcrossCombinedSchemas1BoxedMap(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: Any?, configuration: SchemaConfiguration?): NonInterferenceAcrossCombinedSchemas1Boxed { + if (arg == null) { + return validateAndBox(null, configuration) + } else if (arg is Boolean) { + return validateAndBox(arg, configuration) + } else if (arg is String) { + return validateAndBox(arg, configuration) + } else if (arg is Number) { + return validateAndBox(arg, configuration) + } else if (arg is List<*>) { + return validateAndBox(arg, configuration) + } else if (arg is Map<*, *>) { + return validateAndBox(arg, configuration) + } + throw ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema") + } + } +} diff --git a/samples/client/3_1_0_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/schemas/Not.kt b/samples/client/3_1_0_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/schemas/Not.kt new file mode 100644 index 00000000000..96a1a64a1be --- /dev/null +++ b/samples/client/3_1_0_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/schemas/Not.kt @@ -0,0 +1,322 @@ +package org.openapijsonschematools.client.components.schemas +import java.time.LocalDate +import java.time.ZonedDateTime +import java.util.UUID +import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags +import org.openapijsonschematools.client.configurations.SchemaConfiguration +import org.openapijsonschematools.client.exceptions.InvalidAdditionalPropertyException +import org.openapijsonschematools.client.exceptions.UnsetPropertyException +import org.openapijsonschematools.client.exceptions.ValidationException +import org.openapijsonschematools.client.schemas.IntJsonSchema +import org.openapijsonschematools.client.schemas.UnsetAddPropsSetter +import org.openapijsonschematools.client.schemas.validation.BooleanSchemaValidator +import org.openapijsonschematools.client.schemas.validation.FrozenList +import org.openapijsonschematools.client.schemas.validation.FrozenMap +import org.openapijsonschematools.client.schemas.validation.JsonSchema +import org.openapijsonschematools.client.schemas.validation.JsonSchemaInfo +import org.openapijsonschematools.client.schemas.validation.ListSchemaValidator +import org.openapijsonschematools.client.schemas.validation.MapSchemaValidator +import org.openapijsonschematools.client.schemas.validation.NullSchemaValidator +import org.openapijsonschematools.client.schemas.validation.NumberSchemaValidator +import org.openapijsonschematools.client.schemas.validation.PathToSchemasMap +import org.openapijsonschematools.client.schemas.validation.StringSchemaValidator +import org.openapijsonschematools.client.schemas.validation.ValidationMetadata + +class Not { + // nest classes so all schemas and input/output classes can be public + + + class Not2 : IntJsonSchema.IntJsonSchema1() { + companion object { + @Volatile + private var instance: Not2? = null + + fun getInstance() = + instance ?: synchronized(this) { + instance ?: Not2().also { instance = it } + } + } + } + + + sealed interface Not1Boxed { + fun getData(): Any? + } + + data class Not1BoxedVoid(val data: Nothing?) : Not1Boxed { + override fun getData(): Any? { + return data + } + } + + data class Not1BoxedBoolean(val data: Boolean): Not1Boxed { + override fun getData(): Any? { + return data + } + } + + data class Not1BoxedNumber(val data: Number) : Not1Boxed { + override fun getData(): Any? { + return data + } + } + + data class Not1BoxedString(val data: String) : Not1Boxed { + override fun getData(): Any? { + return data + } + } + + data class Not1BoxedList(val data: FrozenList) : Not1Boxed { + override fun getData(): Any? { + return data + } + } + + data class Not1BoxedMap(val data: FrozenMap) : Not1Boxed { + override fun getData(): Any? { + return data + } + } + + + class Not1 private constructor(): JsonSchema( + JsonSchemaInfo() + .not(Not2::class.java) + ), NullSchemaValidator, BooleanSchemaValidator, NumberSchemaValidator, StringSchemaValidator, ListSchemaValidator, Not1BoxedList>, MapSchemaValidator, Not1BoxedMap> { + /* + NOTE: This class is auto generated by OpenAPI JSON Schema Generator. + Ref: https://github.com/openapi-json-schema-tools/openapi-json-schema-generator + + Do not edit the class manually. + */ + + companion object { + @Volatile + private var instance: Not1? = null + + fun getInstance() = + instance ?: synchronized(this) { + instance ?: Not1().also { instance = it } + } + } + + @Throws(ValidationException::class) + override fun validate(arg: Nothing?, configuration: SchemaConfiguration?): Nothing? { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validatedPathToSchemas = PathToSchemasMap() + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, LinkedHashSet()) + getPathToSchemas(this, castArg, validationMetadata, pathSet) + return castArg + } + + @Throws(ValidationException::class) + override fun validate(arg: Boolean, configuration: SchemaConfiguration?): Boolean { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validatedPathToSchemas = PathToSchemasMap() + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, LinkedHashSet()) + getPathToSchemas(this, castArg, validationMetadata, pathSet) + return castArg + } + + @Throws(ValidationException::class) + override fun validate(arg: Number, configuration: SchemaConfiguration?): Number { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validatedPathToSchemas = PathToSchemasMap() + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, LinkedHashSet()) + getPathToSchemas(this, castArg, validationMetadata, pathSet) + return castArg + } + + @Throws(ValidationException::class) + fun validate(arg: Int, configuration: SchemaConfiguration?): Int { + return validate(arg as Number, configuration) as Int + } + + @Throws(ValidationException::class) + fun validate(arg: Long, configuration: SchemaConfiguration?): Long { + return validate(arg as Number, configuration) as Long + } + + @Throws(ValidationException::class) + fun validate(arg: Float, configuration: SchemaConfiguration?): Float { + return validate(arg as Number, configuration) as Float + } + + @Throws(ValidationException::class) + fun validate(arg: Double, configuration: SchemaConfiguration?): Double { + return validate(arg as Number, configuration) as Double + } + + @Throws(ValidationException::class) + override fun validate(arg: String, configuration: SchemaConfiguration?): String { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validatedPathToSchemas = PathToSchemasMap() + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, LinkedHashSet()) + getPathToSchemas(this, castArg, validationMetadata, pathSet) + return castArg + } + + @Throws(ValidationException::class) + fun validate(arg: LocalDate, configuration: SchemaConfiguration?): String { + return validate(arg.toString(), configuration) + } + + @Throws(ValidationException::class) + fun validate(arg: ZonedDateTime, configuration: SchemaConfiguration?): String { + return validate(arg.toString(), configuration) + } + + @Throws(ValidationException::class) + fun validate(arg: UUID, configuration: SchemaConfiguration?): String { + return validate(arg.toString(), configuration) + } + + override fun getNewInstance(arg: List<*>, pathToItem: List, pathToSchemas: PathToSchemasMap): FrozenList { + val items: MutableList = ArrayList() + var i: Int = 0 + for (item: Any? in arg) { + val itemPathToItem = pathToItem + i + val schemas: LinkedHashMap, Nothing?>? = pathToSchemas.get(itemPathToItem) + if (schemas == null) { + throw RuntimeException("Validation result is invalid, schemas must exist for a pathToItem") + } + val itemSchema: JsonSchema<*> = schemas.entries.iterator().next().key + val itemInstance: Any? = itemSchema.getNewInstance(item, itemPathToItem, pathToSchemas) + items.add(itemInstance) + i += 1 + } + val newInstanceItems: FrozenList = FrozenList(items) + return newInstanceItems + } + + @Throws(ValidationException::class) + override fun validate(arg: List<*>, configuration: SchemaConfiguration?): FrozenList { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, PathToSchemasMap(), LinkedHashSet()) + val pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet) + return getNewInstance(castArg, validationMetadata.pathToItem, pathToSchemasMap) + } + + override fun getNewInstance(arg: Map<*, *>, pathToItem: List, pathToSchemas: PathToSchemasMap): FrozenMap { + val properties: LinkedHashMap = LinkedHashMap() + for((propertyName, value) in arg) { + if (!(propertyName is String)) { + throw RuntimeException("Invalid non-string key value") + } + val propertyPathToItem: List = pathToItem + propertyName + val schemas: LinkedHashMap, Nothing?>? = pathToSchemas.get(propertyPathToItem) + if (schemas == null) { + throw RuntimeException("Validation result is invalid, schemas must exist for a pathToItem") + } + val propertySchema: JsonSchema<*> = schemas.entries.iterator().next().key + val propertyInstance: Any? = propertySchema.getNewInstance(value, propertyPathToItem, pathToSchemas) + properties[propertyName] = propertyInstance + } + val castProperties: FrozenMap = FrozenMap(properties) + return castProperties + } + + @Throws(ValidationException::class) + override fun validate(arg: Map<*, *>, configuration: SchemaConfiguration?): FrozenMap { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validatedPathToSchemas = PathToSchemasMap() + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, LinkedHashSet()) + val pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet) + return getNewInstance(castArg, validationMetadata.pathToItem, pathToSchemasMap) + } + + @Throws(ValidationException::class) + override fun validate(arg: Any?, configuration: SchemaConfiguration?): Any? { + if (arg == null) { + return validate(null, configuration) + } else if (arg is Boolean) { + return validate(arg, configuration) + } else if (arg is Number) { + return validate(arg, configuration) + } else if (arg is String) { + return validate(arg, configuration) + } else if (arg is List<*>) { + return validate(arg, configuration) + } else if (arg is Map<*, *>) { + return validate(arg, configuration) + } + throw ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema") + } + override fun getNewInstance(arg: Any?, pathToItem: List, pathToSchemas: PathToSchemasMap): Any? { + if (arg == null) { + return getNewInstance( null, pathToItem, pathToSchemas) + } else if (arg is Boolean) { + return getNewInstance(arg, pathToItem, pathToSchemas) + } else if (arg is Number) { + return getNewInstance(arg, pathToItem, pathToSchemas) + } else if (arg is String) { + return getNewInstance(arg, pathToItem, pathToSchemas) + } else if (arg is List<*>) { + return getNewInstance(arg, pathToItem, pathToSchemas) + } else if (arg is Map<*, *>) { + return getNewInstance(arg, pathToItem, pathToSchemas) + } + throw RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema") + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: Nothing?, configuration: SchemaConfiguration?): Not1BoxedVoid { + return Not1BoxedVoid(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: Boolean, configuration: SchemaConfiguration?): Not1BoxedBoolean { + return Not1BoxedBoolean(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: Number, configuration: SchemaConfiguration?): Not1BoxedNumber { + return Not1BoxedNumber(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: String, configuration: SchemaConfiguration?): Not1BoxedString { + return Not1BoxedString(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: List<*>, configuration: SchemaConfiguration?): Not1BoxedList { + return Not1BoxedList(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: Map<*, *>, configuration: SchemaConfiguration?): Not1BoxedMap { + return Not1BoxedMap(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: Any?, configuration: SchemaConfiguration?): Not1Boxed { + if (arg == null) { + return validateAndBox(null, configuration) + } else if (arg is Boolean) { + return validateAndBox(arg, configuration) + } else if (arg is String) { + return validateAndBox(arg, configuration) + } else if (arg is Number) { + return validateAndBox(arg, configuration) + } else if (arg is List<*>) { + return validateAndBox(arg, configuration) + } else if (arg is Map<*, *>) { + return validateAndBox(arg, configuration) + } + throw ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema") + } + } +} diff --git a/samples/client/3_1_0_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/schemas/NotMoreComplexSchema.kt b/samples/client/3_1_0_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/schemas/NotMoreComplexSchema.kt new file mode 100644 index 00000000000..70fae92a396 --- /dev/null +++ b/samples/client/3_1_0_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/schemas/NotMoreComplexSchema.kt @@ -0,0 +1,478 @@ +package org.openapijsonschematools.client.components.schemas +import java.time.LocalDate +import java.time.ZonedDateTime +import java.util.UUID +import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags +import org.openapijsonschematools.client.configurations.SchemaConfiguration +import org.openapijsonschematools.client.exceptions.InvalidAdditionalPropertyException +import org.openapijsonschematools.client.exceptions.UnsetPropertyException +import org.openapijsonschematools.client.exceptions.ValidationException +import org.openapijsonschematools.client.schemas.GenericBuilder +import org.openapijsonschematools.client.schemas.StringJsonSchema +import org.openapijsonschematools.client.schemas.UnsetAddPropsSetter +import org.openapijsonschematools.client.schemas.validation.BooleanSchemaValidator +import org.openapijsonschematools.client.schemas.validation.FrozenList +import org.openapijsonschematools.client.schemas.validation.FrozenMap +import org.openapijsonschematools.client.schemas.validation.JsonSchema +import org.openapijsonschematools.client.schemas.validation.JsonSchemaInfo +import org.openapijsonschematools.client.schemas.validation.ListSchemaValidator +import org.openapijsonschematools.client.schemas.validation.MapSchemaValidator +import org.openapijsonschematools.client.schemas.validation.NullSchemaValidator +import org.openapijsonschematools.client.schemas.validation.NumberSchemaValidator +import org.openapijsonschematools.client.schemas.validation.PathToSchemasMap +import org.openapijsonschematools.client.schemas.validation.StringSchemaValidator +import org.openapijsonschematools.client.schemas.validation.ValidationMetadata + +class NotMoreComplexSchema { + // nest classes so all schemas and input/output classes can be public + + + class Foo : StringJsonSchema.StringJsonSchema1() { + companion object { + @Volatile + private var instance: Foo? = null + + fun getInstance() = + instance ?: synchronized(this) { + instance ?: Foo().also { instance = it } + } + } + } + + + class NotMap(m: FrozenMap) : FrozenMap(m) { + companion object { + val requiredKeys: Set = setOf() + val optionalKeys: Set = setOf( + "foo" + ) + @Throws(ValidationException::class) + fun of(arg: Map, configuration: SchemaConfiguration): NotMap { + return Not.getInstance().validate(arg, configuration) + } + } + + @Throws(UnsetPropertyException::class) + fun foo(): String { + val key = "foo" + throwIfKeyNotPresent(key) + val value: Any? = get(key) + if (!(value is String)) { + throw RuntimeException("Invalid value stored for foo") + } + return value + } + + @Throws(UnsetPropertyException::class, InvalidAdditionalPropertyException::class) + fun getAdditionalProperty(name: String): Any? { + throwIfKeyKnown(name, requiredKeys, optionalKeys) + throwIfKeyNotPresent(name) + return get(name) + } + } + + interface SetterForFoo { + fun getInstance(): MutableMap + fun getBuilderAfterFoo(instance: MutableMap): T + + fun foo(value: String): T { + val instance = getInstance() + instance["foo"] = value + return getBuilderAfterFoo(instance) + } + } + + class NotMapBuilder: UnsetAddPropsSetter, GenericBuilder>, SetterForFoo { + private val knownKeys: Set = setOf( + "foo" + ) + override fun getKnownKeys(): Set { + return knownKeys + } + private val instance: MutableMap + init { + this.instance = LinkedHashMap() + } + override fun build(): Map { + return instance + } + override fun getInstance(): MutableMap { + return instance + } + override fun getBuilderAfterFoo(instance: MutableMap): NotMapBuilder { + return this + } + override fun getBuilderAfterAdditionalProperty(instance: MutableMap): NotMapBuilder { + return this + } + } + + + sealed interface NotBoxed { + fun getData(): Any? + } + + data class NotBoxedMap(val data: NotMap) : NotBoxed { + override fun getData(): Any? { + return data + } + } + + + class Not private constructor(): JsonSchema( + JsonSchemaInfo() + .type(setOf(Map::class.java)) + .properties(mapOf( + "foo" to Foo::class.java + )) + ), MapSchemaValidator { + + companion object { + @Volatile + private var instance: Not? = null + + fun getInstance() = + instance ?: synchronized(this) { + instance ?: Not().also { instance = it } + } + } + + override fun getNewInstance(arg: Map<*, *>, pathToItem: List, pathToSchemas: PathToSchemasMap): NotMap { + val properties: LinkedHashMap = LinkedHashMap() + for((entryKey, value) in arg) { + if (!(entryKey is String)) { + throw RuntimeException("Invalid non-string key value") + } + val propertyPathToItem: List = pathToItem + entryKey + val schemas: LinkedHashMap, Nothing?>? = pathToSchemas.get(propertyPathToItem) + if (schemas == null) { + throw RuntimeException("Validation result is invalid, schemas must exist for a pathToItem") + } + val propertySchema: JsonSchema<*> = schemas.entries.iterator().next().key + val propertyInstance: Any? = propertySchema.getNewInstance(value, propertyPathToItem, pathToSchemas) + properties[entryKey] = propertyInstance + } + val castProperties: FrozenMap = FrozenMap(properties) + return NotMap(castProperties) + } + + @Throws(ValidationException::class) + override fun validate(arg: Map<*, *>, configuration: SchemaConfiguration?): NotMap { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, PathToSchemasMap(), LinkedHashSet()) + val pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet) + return getNewInstance(castArg, validationMetadata.pathToItem, pathToSchemasMap) + } + + + @Throws(ValidationException::class) + override fun validate(arg: Any?, configuration: SchemaConfiguration?): Any? { + if (arg is Map<*, *>) { + return validate(arg, configuration) + } + throw ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema") + } + override fun getNewInstance(arg: Any?, pathToItem: List, pathToSchemas: PathToSchemasMap): Any? { + if (arg is Map<*, *>) { + return getNewInstance(arg, pathToItem, pathToSchemas) + } + throw RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema") + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: Map<*, *>, configuration: SchemaConfiguration?): NotBoxedMap { + return NotBoxedMap(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: Any?, configuration: SchemaConfiguration?): NotBoxed { + if (arg is Map<*, *>) { + return validateAndBox(arg, configuration) + } + throw ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema") + } + } + + + sealed interface NotMoreComplexSchema1Boxed { + fun getData(): Any? + } + + data class NotMoreComplexSchema1BoxedVoid(val data: Nothing?) : NotMoreComplexSchema1Boxed { + override fun getData(): Any? { + return data + } + } + + data class NotMoreComplexSchema1BoxedBoolean(val data: Boolean): NotMoreComplexSchema1Boxed { + override fun getData(): Any? { + return data + } + } + + data class NotMoreComplexSchema1BoxedNumber(val data: Number) : NotMoreComplexSchema1Boxed { + override fun getData(): Any? { + return data + } + } + + data class NotMoreComplexSchema1BoxedString(val data: String) : NotMoreComplexSchema1Boxed { + override fun getData(): Any? { + return data + } + } + + data class NotMoreComplexSchema1BoxedList(val data: FrozenList) : NotMoreComplexSchema1Boxed { + override fun getData(): Any? { + return data + } + } + + data class NotMoreComplexSchema1BoxedMap(val data: FrozenMap) : NotMoreComplexSchema1Boxed { + override fun getData(): Any? { + return data + } + } + + + class NotMoreComplexSchema1 private constructor(): JsonSchema( + JsonSchemaInfo() + .not(Not::class.java) + ), NullSchemaValidator, BooleanSchemaValidator, NumberSchemaValidator, StringSchemaValidator, ListSchemaValidator, NotMoreComplexSchema1BoxedList>, MapSchemaValidator, NotMoreComplexSchema1BoxedMap> { + /* + NOTE: This class is auto generated by OpenAPI JSON Schema Generator. + Ref: https://github.com/openapi-json-schema-tools/openapi-json-schema-generator + + Do not edit the class manually. + */ + + companion object { + @Volatile + private var instance: NotMoreComplexSchema1? = null + + fun getInstance() = + instance ?: synchronized(this) { + instance ?: NotMoreComplexSchema1().also { instance = it } + } + } + + @Throws(ValidationException::class) + override fun validate(arg: Nothing?, configuration: SchemaConfiguration?): Nothing? { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validatedPathToSchemas = PathToSchemasMap() + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, LinkedHashSet()) + getPathToSchemas(this, castArg, validationMetadata, pathSet) + return castArg + } + + @Throws(ValidationException::class) + override fun validate(arg: Boolean, configuration: SchemaConfiguration?): Boolean { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validatedPathToSchemas = PathToSchemasMap() + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, LinkedHashSet()) + getPathToSchemas(this, castArg, validationMetadata, pathSet) + return castArg + } + + @Throws(ValidationException::class) + override fun validate(arg: Number, configuration: SchemaConfiguration?): Number { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validatedPathToSchemas = PathToSchemasMap() + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, LinkedHashSet()) + getPathToSchemas(this, castArg, validationMetadata, pathSet) + return castArg + } + + @Throws(ValidationException::class) + fun validate(arg: Int, configuration: SchemaConfiguration?): Int { + return validate(arg as Number, configuration) as Int + } + + @Throws(ValidationException::class) + fun validate(arg: Long, configuration: SchemaConfiguration?): Long { + return validate(arg as Number, configuration) as Long + } + + @Throws(ValidationException::class) + fun validate(arg: Float, configuration: SchemaConfiguration?): Float { + return validate(arg as Number, configuration) as Float + } + + @Throws(ValidationException::class) + fun validate(arg: Double, configuration: SchemaConfiguration?): Double { + return validate(arg as Number, configuration) as Double + } + + @Throws(ValidationException::class) + override fun validate(arg: String, configuration: SchemaConfiguration?): String { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validatedPathToSchemas = PathToSchemasMap() + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, LinkedHashSet()) + getPathToSchemas(this, castArg, validationMetadata, pathSet) + return castArg + } + + @Throws(ValidationException::class) + fun validate(arg: LocalDate, configuration: SchemaConfiguration?): String { + return validate(arg.toString(), configuration) + } + + @Throws(ValidationException::class) + fun validate(arg: ZonedDateTime, configuration: SchemaConfiguration?): String { + return validate(arg.toString(), configuration) + } + + @Throws(ValidationException::class) + fun validate(arg: UUID, configuration: SchemaConfiguration?): String { + return validate(arg.toString(), configuration) + } + + override fun getNewInstance(arg: List<*>, pathToItem: List, pathToSchemas: PathToSchemasMap): FrozenList { + val items: MutableList = ArrayList() + var i: Int = 0 + for (item: Any? in arg) { + val itemPathToItem = pathToItem + i + val schemas: LinkedHashMap, Nothing?>? = pathToSchemas.get(itemPathToItem) + if (schemas == null) { + throw RuntimeException("Validation result is invalid, schemas must exist for a pathToItem") + } + val itemSchema: JsonSchema<*> = schemas.entries.iterator().next().key + val itemInstance: Any? = itemSchema.getNewInstance(item, itemPathToItem, pathToSchemas) + items.add(itemInstance) + i += 1 + } + val newInstanceItems: FrozenList = FrozenList(items) + return newInstanceItems + } + + @Throws(ValidationException::class) + override fun validate(arg: List<*>, configuration: SchemaConfiguration?): FrozenList { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, PathToSchemasMap(), LinkedHashSet()) + val pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet) + return getNewInstance(castArg, validationMetadata.pathToItem, pathToSchemasMap) + } + + override fun getNewInstance(arg: Map<*, *>, pathToItem: List, pathToSchemas: PathToSchemasMap): FrozenMap { + val properties: LinkedHashMap = LinkedHashMap() + for((propertyName, value) in arg) { + if (!(propertyName is String)) { + throw RuntimeException("Invalid non-string key value") + } + val propertyPathToItem: List = pathToItem + propertyName + val schemas: LinkedHashMap, Nothing?>? = pathToSchemas.get(propertyPathToItem) + if (schemas == null) { + throw RuntimeException("Validation result is invalid, schemas must exist for a pathToItem") + } + val propertySchema: JsonSchema<*> = schemas.entries.iterator().next().key + val propertyInstance: Any? = propertySchema.getNewInstance(value, propertyPathToItem, pathToSchemas) + properties[propertyName] = propertyInstance + } + val castProperties: FrozenMap = FrozenMap(properties) + return castProperties + } + + @Throws(ValidationException::class) + override fun validate(arg: Map<*, *>, configuration: SchemaConfiguration?): FrozenMap { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validatedPathToSchemas = PathToSchemasMap() + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, LinkedHashSet()) + val pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet) + return getNewInstance(castArg, validationMetadata.pathToItem, pathToSchemasMap) + } + + @Throws(ValidationException::class) + override fun validate(arg: Any?, configuration: SchemaConfiguration?): Any? { + if (arg == null) { + return validate(null, configuration) + } else if (arg is Boolean) { + return validate(arg, configuration) + } else if (arg is Number) { + return validate(arg, configuration) + } else if (arg is String) { + return validate(arg, configuration) + } else if (arg is List<*>) { + return validate(arg, configuration) + } else if (arg is Map<*, *>) { + return validate(arg, configuration) + } + throw ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema") + } + override fun getNewInstance(arg: Any?, pathToItem: List, pathToSchemas: PathToSchemasMap): Any? { + if (arg == null) { + return getNewInstance( null, pathToItem, pathToSchemas) + } else if (arg is Boolean) { + return getNewInstance(arg, pathToItem, pathToSchemas) + } else if (arg is Number) { + return getNewInstance(arg, pathToItem, pathToSchemas) + } else if (arg is String) { + return getNewInstance(arg, pathToItem, pathToSchemas) + } else if (arg is List<*>) { + return getNewInstance(arg, pathToItem, pathToSchemas) + } else if (arg is Map<*, *>) { + return getNewInstance(arg, pathToItem, pathToSchemas) + } + throw RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema") + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: Nothing?, configuration: SchemaConfiguration?): NotMoreComplexSchema1BoxedVoid { + return NotMoreComplexSchema1BoxedVoid(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: Boolean, configuration: SchemaConfiguration?): NotMoreComplexSchema1BoxedBoolean { + return NotMoreComplexSchema1BoxedBoolean(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: Number, configuration: SchemaConfiguration?): NotMoreComplexSchema1BoxedNumber { + return NotMoreComplexSchema1BoxedNumber(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: String, configuration: SchemaConfiguration?): NotMoreComplexSchema1BoxedString { + return NotMoreComplexSchema1BoxedString(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: List<*>, configuration: SchemaConfiguration?): NotMoreComplexSchema1BoxedList { + return NotMoreComplexSchema1BoxedList(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: Map<*, *>, configuration: SchemaConfiguration?): NotMoreComplexSchema1BoxedMap { + return NotMoreComplexSchema1BoxedMap(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: Any?, configuration: SchemaConfiguration?): NotMoreComplexSchema1Boxed { + if (arg == null) { + return validateAndBox(null, configuration) + } else if (arg is Boolean) { + return validateAndBox(arg, configuration) + } else if (arg is String) { + return validateAndBox(arg, configuration) + } else if (arg is Number) { + return validateAndBox(arg, configuration) + } else if (arg is List<*>) { + return validateAndBox(arg, configuration) + } else if (arg is Map<*, *>) { + return validateAndBox(arg, configuration) + } + throw ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema") + } + } +} diff --git a/samples/client/3_1_0_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/schemas/NotMultipleTypes.kt b/samples/client/3_1_0_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/schemas/NotMultipleTypes.kt new file mode 100644 index 00000000000..479042d284e --- /dev/null +++ b/samples/client/3_1_0_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/schemas/NotMultipleTypes.kt @@ -0,0 +1,426 @@ +package org.openapijsonschematools.client.components.schemas +import java.time.LocalDate +import java.time.ZonedDateTime +import java.util.UUID +import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags +import org.openapijsonschematools.client.configurations.SchemaConfiguration +import org.openapijsonschematools.client.exceptions.InvalidAdditionalPropertyException +import org.openapijsonschematools.client.exceptions.UnsetPropertyException +import org.openapijsonschematools.client.exceptions.ValidationException +import org.openapijsonschematools.client.schemas.UnsetAddPropsSetter +import org.openapijsonschematools.client.schemas.validation.BooleanSchemaValidator +import org.openapijsonschematools.client.schemas.validation.FrozenList +import org.openapijsonschematools.client.schemas.validation.FrozenMap +import org.openapijsonschematools.client.schemas.validation.JsonSchema +import org.openapijsonschematools.client.schemas.validation.JsonSchemaInfo +import org.openapijsonschematools.client.schemas.validation.ListSchemaValidator +import org.openapijsonschematools.client.schemas.validation.MapSchemaValidator +import org.openapijsonschematools.client.schemas.validation.NullSchemaValidator +import org.openapijsonschematools.client.schemas.validation.NumberSchemaValidator +import org.openapijsonschematools.client.schemas.validation.PathToSchemasMap +import org.openapijsonschematools.client.schemas.validation.StringSchemaValidator +import org.openapijsonschematools.client.schemas.validation.ValidationMetadata + +class NotMultipleTypes { + // nest classes so all schemas and input/output classes can be public + + + sealed interface NotBoxed { + fun getData(): Any? + } + + data class NotBoxedNumber(val data: Number) : NotBoxed { + override fun getData(): Any? { + return data + } + } + + data class NotBoxedBoolean(val data: Boolean): NotBoxed { + override fun getData(): Any? { + return data + } + } + + + + class Not private constructor(): JsonSchema( + JsonSchemaInfo() + .type(setOf( + Int::class.java, + Long::class.java, + Float::class.java, + Double::class.java, + Boolean::class.java + )) + .format("int") + ), NumberSchemaValidator, BooleanSchemaValidator { + + companion object { + @Volatile + private var instance: Not? = null + + fun getInstance() = + instance ?: synchronized(this) { + instance ?: Not().also { instance = it } + } + } + + @Throws(ValidationException::class) + override fun validate(arg: Number, configuration: SchemaConfiguration?): Number { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, PathToSchemasMap(), LinkedHashSet()) + getPathToSchemas(this, castArg, validationMetadata, pathSet) + return castArg + } + + @Throws(ValidationException::class) + fun validate(arg: Int, configuration: SchemaConfiguration?): Int { + return validate(arg as Number, configuration) as Int + } + + @Throws(ValidationException::class) + fun validate(arg: Float, configuration: SchemaConfiguration?): Float { + return validate(arg as Number, configuration) as Float + } + + @Throws(ValidationException::class) + fun validate(arg: Long, configuration: SchemaConfiguration?): Long { + return validate(arg as Number, configuration) as Long + } + + @Throws(ValidationException::class) + fun validate(arg: Double, configuration: SchemaConfiguration?): Double { + return validate(arg as Number, configuration) as Double + } + + @Throws(ValidationException::class) + override fun validate(arg: Boolean, configuration: SchemaConfiguration?): Boolean { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, PathToSchemasMap(), LinkedHashSet()) + getPathToSchemas(this, castArg, validationMetadata, pathSet) + return castArg + } + + @Throws(ValidationException::class) + override fun validate(arg: Any?, configuration: SchemaConfiguration?): Any? { + if (arg is Number) { + return validate(arg, configuration) + } else if (arg is Boolean) { + return validate(arg, configuration) + } + throw ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema") + } + override fun getNewInstance(arg: Any?, pathToItem: List, pathToSchemas: PathToSchemasMap): Any? { + if (arg is Number) { + return getNewInstance(arg, pathToItem, pathToSchemas) + } else if (arg is Boolean) { + return getNewInstance(arg, pathToItem, pathToSchemas) + } + throw RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema") + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: Number, configuration: SchemaConfiguration?): NotBoxedNumber { + return NotBoxedNumber(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: Boolean, configuration: SchemaConfiguration?): NotBoxedBoolean { + return NotBoxedBoolean(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: Any?, configuration: SchemaConfiguration?): NotBoxed { + if (arg is Number) { + return validateAndBox(arg, configuration) + } else if (arg is Boolean) { + return validateAndBox(arg, configuration) + } + throw ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema") + } + } + + sealed interface NotMultipleTypes1Boxed { + fun getData(): Any? + } + + data class NotMultipleTypes1BoxedVoid(val data: Nothing?) : NotMultipleTypes1Boxed { + override fun getData(): Any? { + return data + } + } + + data class NotMultipleTypes1BoxedBoolean(val data: Boolean): NotMultipleTypes1Boxed { + override fun getData(): Any? { + return data + } + } + + data class NotMultipleTypes1BoxedNumber(val data: Number) : NotMultipleTypes1Boxed { + override fun getData(): Any? { + return data + } + } + + data class NotMultipleTypes1BoxedString(val data: String) : NotMultipleTypes1Boxed { + override fun getData(): Any? { + return data + } + } + + data class NotMultipleTypes1BoxedList(val data: FrozenList) : NotMultipleTypes1Boxed { + override fun getData(): Any? { + return data + } + } + + data class NotMultipleTypes1BoxedMap(val data: FrozenMap) : NotMultipleTypes1Boxed { + override fun getData(): Any? { + return data + } + } + + + class NotMultipleTypes1 private constructor(): JsonSchema( + JsonSchemaInfo() + .not(Not::class.java) + ), NullSchemaValidator, BooleanSchemaValidator, NumberSchemaValidator, StringSchemaValidator, ListSchemaValidator, NotMultipleTypes1BoxedList>, MapSchemaValidator, NotMultipleTypes1BoxedMap> { + /* + NOTE: This class is auto generated by OpenAPI JSON Schema Generator. + Ref: https://github.com/openapi-json-schema-tools/openapi-json-schema-generator + + Do not edit the class manually. + */ + + companion object { + @Volatile + private var instance: NotMultipleTypes1? = null + + fun getInstance() = + instance ?: synchronized(this) { + instance ?: NotMultipleTypes1().also { instance = it } + } + } + + @Throws(ValidationException::class) + override fun validate(arg: Nothing?, configuration: SchemaConfiguration?): Nothing? { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validatedPathToSchemas = PathToSchemasMap() + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, LinkedHashSet()) + getPathToSchemas(this, castArg, validationMetadata, pathSet) + return castArg + } + + @Throws(ValidationException::class) + override fun validate(arg: Boolean, configuration: SchemaConfiguration?): Boolean { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validatedPathToSchemas = PathToSchemasMap() + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, LinkedHashSet()) + getPathToSchemas(this, castArg, validationMetadata, pathSet) + return castArg + } + + @Throws(ValidationException::class) + override fun validate(arg: Number, configuration: SchemaConfiguration?): Number { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validatedPathToSchemas = PathToSchemasMap() + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, LinkedHashSet()) + getPathToSchemas(this, castArg, validationMetadata, pathSet) + return castArg + } + + @Throws(ValidationException::class) + fun validate(arg: Int, configuration: SchemaConfiguration?): Int { + return validate(arg as Number, configuration) as Int + } + + @Throws(ValidationException::class) + fun validate(arg: Long, configuration: SchemaConfiguration?): Long { + return validate(arg as Number, configuration) as Long + } + + @Throws(ValidationException::class) + fun validate(arg: Float, configuration: SchemaConfiguration?): Float { + return validate(arg as Number, configuration) as Float + } + + @Throws(ValidationException::class) + fun validate(arg: Double, configuration: SchemaConfiguration?): Double { + return validate(arg as Number, configuration) as Double + } + + @Throws(ValidationException::class) + override fun validate(arg: String, configuration: SchemaConfiguration?): String { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validatedPathToSchemas = PathToSchemasMap() + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, LinkedHashSet()) + getPathToSchemas(this, castArg, validationMetadata, pathSet) + return castArg + } + + @Throws(ValidationException::class) + fun validate(arg: LocalDate, configuration: SchemaConfiguration?): String { + return validate(arg.toString(), configuration) + } + + @Throws(ValidationException::class) + fun validate(arg: ZonedDateTime, configuration: SchemaConfiguration?): String { + return validate(arg.toString(), configuration) + } + + @Throws(ValidationException::class) + fun validate(arg: UUID, configuration: SchemaConfiguration?): String { + return validate(arg.toString(), configuration) + } + + override fun getNewInstance(arg: List<*>, pathToItem: List, pathToSchemas: PathToSchemasMap): FrozenList { + val items: MutableList = ArrayList() + var i: Int = 0 + for (item: Any? in arg) { + val itemPathToItem = pathToItem + i + val schemas: LinkedHashMap, Nothing?>? = pathToSchemas.get(itemPathToItem) + if (schemas == null) { + throw RuntimeException("Validation result is invalid, schemas must exist for a pathToItem") + } + val itemSchema: JsonSchema<*> = schemas.entries.iterator().next().key + val itemInstance: Any? = itemSchema.getNewInstance(item, itemPathToItem, pathToSchemas) + items.add(itemInstance) + i += 1 + } + val newInstanceItems: FrozenList = FrozenList(items) + return newInstanceItems + } + + @Throws(ValidationException::class) + override fun validate(arg: List<*>, configuration: SchemaConfiguration?): FrozenList { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, PathToSchemasMap(), LinkedHashSet()) + val pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet) + return getNewInstance(castArg, validationMetadata.pathToItem, pathToSchemasMap) + } + + override fun getNewInstance(arg: Map<*, *>, pathToItem: List, pathToSchemas: PathToSchemasMap): FrozenMap { + val properties: LinkedHashMap = LinkedHashMap() + for((propertyName, value) in arg) { + if (!(propertyName is String)) { + throw RuntimeException("Invalid non-string key value") + } + val propertyPathToItem: List = pathToItem + propertyName + val schemas: LinkedHashMap, Nothing?>? = pathToSchemas.get(propertyPathToItem) + if (schemas == null) { + throw RuntimeException("Validation result is invalid, schemas must exist for a pathToItem") + } + val propertySchema: JsonSchema<*> = schemas.entries.iterator().next().key + val propertyInstance: Any? = propertySchema.getNewInstance(value, propertyPathToItem, pathToSchemas) + properties[propertyName] = propertyInstance + } + val castProperties: FrozenMap = FrozenMap(properties) + return castProperties + } + + @Throws(ValidationException::class) + override fun validate(arg: Map<*, *>, configuration: SchemaConfiguration?): FrozenMap { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validatedPathToSchemas = PathToSchemasMap() + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, LinkedHashSet()) + val pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet) + return getNewInstance(castArg, validationMetadata.pathToItem, pathToSchemasMap) + } + + @Throws(ValidationException::class) + override fun validate(arg: Any?, configuration: SchemaConfiguration?): Any? { + if (arg == null) { + return validate(null, configuration) + } else if (arg is Boolean) { + return validate(arg, configuration) + } else if (arg is Number) { + return validate(arg, configuration) + } else if (arg is String) { + return validate(arg, configuration) + } else if (arg is List<*>) { + return validate(arg, configuration) + } else if (arg is Map<*, *>) { + return validate(arg, configuration) + } + throw ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema") + } + override fun getNewInstance(arg: Any?, pathToItem: List, pathToSchemas: PathToSchemasMap): Any? { + if (arg == null) { + return getNewInstance( null, pathToItem, pathToSchemas) + } else if (arg is Boolean) { + return getNewInstance(arg, pathToItem, pathToSchemas) + } else if (arg is Number) { + return getNewInstance(arg, pathToItem, pathToSchemas) + } else if (arg is String) { + return getNewInstance(arg, pathToItem, pathToSchemas) + } else if (arg is List<*>) { + return getNewInstance(arg, pathToItem, pathToSchemas) + } else if (arg is Map<*, *>) { + return getNewInstance(arg, pathToItem, pathToSchemas) + } + throw RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema") + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: Nothing?, configuration: SchemaConfiguration?): NotMultipleTypes1BoxedVoid { + return NotMultipleTypes1BoxedVoid(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: Boolean, configuration: SchemaConfiguration?): NotMultipleTypes1BoxedBoolean { + return NotMultipleTypes1BoxedBoolean(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: Number, configuration: SchemaConfiguration?): NotMultipleTypes1BoxedNumber { + return NotMultipleTypes1BoxedNumber(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: String, configuration: SchemaConfiguration?): NotMultipleTypes1BoxedString { + return NotMultipleTypes1BoxedString(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: List<*>, configuration: SchemaConfiguration?): NotMultipleTypes1BoxedList { + return NotMultipleTypes1BoxedList(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: Map<*, *>, configuration: SchemaConfiguration?): NotMultipleTypes1BoxedMap { + return NotMultipleTypes1BoxedMap(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: Any?, configuration: SchemaConfiguration?): NotMultipleTypes1Boxed { + if (arg == null) { + return validateAndBox(null, configuration) + } else if (arg is Boolean) { + return validateAndBox(arg, configuration) + } else if (arg is String) { + return validateAndBox(arg, configuration) + } else if (arg is Number) { + return validateAndBox(arg, configuration) + } else if (arg is List<*>) { + return validateAndBox(arg, configuration) + } else if (arg is Map<*, *>) { + return validateAndBox(arg, configuration) + } + throw ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema") + } + } +} diff --git a/samples/client/3_1_0_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/schemas/NulCharactersInStrings.kt b/samples/client/3_1_0_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/schemas/NulCharactersInStrings.kt new file mode 100644 index 00000000000..4117850d7fd --- /dev/null +++ b/samples/client/3_1_0_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/schemas/NulCharactersInStrings.kt @@ -0,0 +1,104 @@ +package org.openapijsonschematools.client.components.schemas +import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags +import org.openapijsonschematools.client.configurations.SchemaConfiguration +import org.openapijsonschematools.client.exceptions.ValidationException +import org.openapijsonschematools.client.schemas.validation.JsonSchema +import org.openapijsonschematools.client.schemas.validation.JsonSchemaInfo +import org.openapijsonschematools.client.schemas.validation.PathToSchemasMap +import org.openapijsonschematools.client.schemas.validation.StringEnumValidator +import org.openapijsonschematools.client.schemas.validation.StringSchemaValidator +import org.openapijsonschematools.client.schemas.validation.StringValueMethod +import org.openapijsonschematools.client.schemas.validation.ValidationMetadata + +class NulCharactersInStrings { + // nest classes so all schemas and input/output classes can be public + + enum class StringNulCharactersInStringsEnums(private val value: String): StringValueMethod { + HELLO_NULL_THERE("hello\u0000there"); + + override fun value(): String { + return this.value + } + } + + + sealed interface NulCharactersInStrings1Boxed { + fun getData(): Any? + } + + data class NulCharactersInStrings1BoxedString(val data: String) : NulCharactersInStrings1Boxed { + override fun getData(): Any? { + return data + } + } + + + + class NulCharactersInStrings1 private constructor(): JsonSchema( + JsonSchemaInfo() + .type(setOf( + String::class.java + )) + .enumValues(setOf( + "hello\u0000there" + )) + ), StringSchemaValidator, StringEnumValidator { + /* + NOTE: This class is auto generated by OpenAPI JSON Schema Generator. + Ref: https://github.com/openapi-json-schema-tools/openapi-json-schema-generator + + Do not edit the class manually. + */ + + companion object { + @Volatile + private var instance: NulCharactersInStrings1? = null + + fun getInstance() = + instance ?: synchronized(this) { + instance ?: NulCharactersInStrings1().also { instance = it } + } + } + + @Throws(ValidationException::class) + override fun validate(arg: String, configuration: SchemaConfiguration?): String { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, PathToSchemasMap(), LinkedHashSet()) + getPathToSchemas(this, castArg, validationMetadata, pathSet) + return castArg + } + + @Throws(ValidationException::class) + override fun validate(arg: StringNulCharactersInStringsEnums, configuration: SchemaConfiguration?): String { + return validate(arg.value(), configuration) + } + + @Throws(ValidationException::class) + override fun validate(arg: Any?, configuration: SchemaConfiguration?): Any? { + if (arg is String) { + return validate(arg, configuration) + } + throw ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema") + } + override fun getNewInstance(arg: Any?, pathToItem: List, pathToSchemas: PathToSchemasMap): Any? { + if (arg is String) { + return getNewInstance(arg, pathToItem, pathToSchemas) + } + throw RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema") + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: String, configuration: SchemaConfiguration?): NulCharactersInStrings1BoxedString { + return NulCharactersInStrings1BoxedString(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: Any?, configuration: SchemaConfiguration?): NulCharactersInStrings1Boxed { + if (arg is String) { + return validateAndBox(arg, configuration) + } + throw ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema") + } + } +} diff --git a/samples/client/3_1_0_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/schemas/NullTypeMatchesOnlyTheNullObject.kt b/samples/client/3_1_0_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/schemas/NullTypeMatchesOnlyTheNullObject.kt new file mode 100644 index 00000000000..d4dfe771cb3 --- /dev/null +++ b/samples/client/3_1_0_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/schemas/NullTypeMatchesOnlyTheNullObject.kt @@ -0,0 +1,20 @@ +package org.openapijsonschematools.client.components.schemas +import org.openapijsonschematools.client.schemas.NullJsonSchema + +class NullTypeMatchesOnlyTheNullObject: NullJsonSchema() { + // nest classes so all schemas and input/output classes can be public + + + class NullTypeMatchesOnlyTheNullObject1 : NullJsonSchema.NullJsonSchema1() { + companion object { + @Volatile + private var instance: NullTypeMatchesOnlyTheNullObject1? = null + + fun getInstance() = + instance ?: synchronized(this) { + instance ?: NullTypeMatchesOnlyTheNullObject1().also { instance = it } + } + } + } + +} diff --git a/samples/client/3_1_0_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/schemas/NumberTypeMatchesNumbers.kt b/samples/client/3_1_0_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/schemas/NumberTypeMatchesNumbers.kt new file mode 100644 index 00000000000..6cd4a213c71 --- /dev/null +++ b/samples/client/3_1_0_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/schemas/NumberTypeMatchesNumbers.kt @@ -0,0 +1,20 @@ +package org.openapijsonschematools.client.components.schemas +import org.openapijsonschematools.client.schemas.NumberJsonSchema + +class NumberTypeMatchesNumbers: NumberJsonSchema() { + // nest classes so all schemas and input/output classes can be public + + + class NumberTypeMatchesNumbers1 : NumberJsonSchema.NumberJsonSchema1() { + companion object { + @Volatile + private var instance: NumberTypeMatchesNumbers1? = null + + fun getInstance() = + instance ?: synchronized(this) { + instance ?: NumberTypeMatchesNumbers1().also { instance = it } + } + } + } + +} diff --git a/samples/client/3_1_0_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/schemas/ObjectPropertiesValidation.kt b/samples/client/3_1_0_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/schemas/ObjectPropertiesValidation.kt new file mode 100644 index 00000000000..9eaf12687f3 --- /dev/null +++ b/samples/client/3_1_0_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/schemas/ObjectPropertiesValidation.kt @@ -0,0 +1,453 @@ +package org.openapijsonschematools.client.components.schemas +import java.time.LocalDate +import java.time.ZonedDateTime +import java.util.UUID +import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags +import org.openapijsonschematools.client.configurations.SchemaConfiguration +import org.openapijsonschematools.client.exceptions.InvalidAdditionalPropertyException +import org.openapijsonschematools.client.exceptions.UnsetPropertyException +import org.openapijsonschematools.client.exceptions.ValidationException +import org.openapijsonschematools.client.schemas.GenericBuilder +import org.openapijsonschematools.client.schemas.IntJsonSchema +import org.openapijsonschematools.client.schemas.StringJsonSchema +import org.openapijsonschematools.client.schemas.UnsetAddPropsSetter +import org.openapijsonschematools.client.schemas.validation.BooleanSchemaValidator +import org.openapijsonschematools.client.schemas.validation.FrozenList +import org.openapijsonschematools.client.schemas.validation.FrozenMap +import org.openapijsonschematools.client.schemas.validation.JsonSchema +import org.openapijsonschematools.client.schemas.validation.JsonSchemaInfo +import org.openapijsonschematools.client.schemas.validation.ListSchemaValidator +import org.openapijsonschematools.client.schemas.validation.MapSchemaValidator +import org.openapijsonschematools.client.schemas.validation.NullSchemaValidator +import org.openapijsonschematools.client.schemas.validation.NumberSchemaValidator +import org.openapijsonschematools.client.schemas.validation.PathToSchemasMap +import org.openapijsonschematools.client.schemas.validation.StringSchemaValidator +import org.openapijsonschematools.client.schemas.validation.ValidationMetadata + +class ObjectPropertiesValidation { + // nest classes so all schemas and input/output classes can be public + + + class Foo : IntJsonSchema.IntJsonSchema1() { + companion object { + @Volatile + private var instance: Foo? = null + + fun getInstance() = + instance ?: synchronized(this) { + instance ?: Foo().also { instance = it } + } + } + } + + + class Bar : StringJsonSchema.StringJsonSchema1() { + companion object { + @Volatile + private var instance: Bar? = null + + fun getInstance() = + instance ?: synchronized(this) { + instance ?: Bar().also { instance = it } + } + } + } + + + class ObjectPropertiesValidationMap(m: FrozenMap) : FrozenMap(m) { + companion object { + val requiredKeys: Set = setOf() + val optionalKeys: Set = setOf( + "foo", + "bar" + ) + @Throws(ValidationException::class) + fun of(arg: Map, configuration: SchemaConfiguration): ObjectPropertiesValidationMap { + return ObjectPropertiesValidation1.getInstance().validate(arg, configuration) + } + } + + @Throws(UnsetPropertyException::class) + fun foo(): Number { + val key = "foo" + throwIfKeyNotPresent(key) + val value: Any? = get(key) + if (!(value is Number)) { + throw RuntimeException("Invalid value stored for foo") + } + return value + } + + @Throws(UnsetPropertyException::class) + fun bar(): String { + val key = "bar" + throwIfKeyNotPresent(key) + val value: Any? = get(key) + if (!(value is String)) { + throw RuntimeException("Invalid value stored for bar") + } + return value + } + + @Throws(UnsetPropertyException::class, InvalidAdditionalPropertyException::class) + fun getAdditionalProperty(name: String): Any? { + throwIfKeyKnown(name, requiredKeys, optionalKeys) + throwIfKeyNotPresent(name) + return get(name) + } + } + + interface SetterForFoo { + fun getInstance(): MutableMap + fun getBuilderAfterFoo(instance: MutableMap): T + + fun foo(value: Int): T { + val instance = getInstance() + instance["foo"] = value + return getBuilderAfterFoo(instance) + } + + fun foo(value: Float): T { + val instance = getInstance() + instance["foo"] = value + return getBuilderAfterFoo(instance) + } + + fun foo(value: Long): T { + val instance = getInstance() + instance["foo"] = value + return getBuilderAfterFoo(instance) + } + + fun foo(value: Double): T { + val instance = getInstance() + instance["foo"] = value + return getBuilderAfterFoo(instance) + } + } + + interface SetterForBar { + fun getInstance(): MutableMap + fun getBuilderAfterBar(instance: MutableMap): T + + fun bar(value: String): T { + val instance = getInstance() + instance["bar"] = value + return getBuilderAfterBar(instance) + } + } + + class ObjectPropertiesValidationMapBuilder: UnsetAddPropsSetter, GenericBuilder>, SetterForFoo, SetterForBar { + private val knownKeys: Set = setOf( + "foo", + "bar" + ) + override fun getKnownKeys(): Set { + return knownKeys + } + private val instance: MutableMap + init { + this.instance = LinkedHashMap() + } + override fun build(): Map { + return instance + } + override fun getInstance(): MutableMap { + return instance + } + override fun getBuilderAfterFoo(instance: MutableMap): ObjectPropertiesValidationMapBuilder { + return this + } + override fun getBuilderAfterBar(instance: MutableMap): ObjectPropertiesValidationMapBuilder { + return this + } + override fun getBuilderAfterAdditionalProperty(instance: MutableMap): ObjectPropertiesValidationMapBuilder { + return this + } + } + + + sealed interface ObjectPropertiesValidation1Boxed { + fun getData(): Any? + } + + data class ObjectPropertiesValidation1BoxedVoid(val data: Nothing?) : ObjectPropertiesValidation1Boxed { + override fun getData(): Any? { + return data + } + } + + data class ObjectPropertiesValidation1BoxedBoolean(val data: Boolean): ObjectPropertiesValidation1Boxed { + override fun getData(): Any? { + return data + } + } + + data class ObjectPropertiesValidation1BoxedNumber(val data: Number) : ObjectPropertiesValidation1Boxed { + override fun getData(): Any? { + return data + } + } + + data class ObjectPropertiesValidation1BoxedString(val data: String) : ObjectPropertiesValidation1Boxed { + override fun getData(): Any? { + return data + } + } + + data class ObjectPropertiesValidation1BoxedList(val data: FrozenList) : ObjectPropertiesValidation1Boxed { + override fun getData(): Any? { + return data + } + } + + data class ObjectPropertiesValidation1BoxedMap(val data: ObjectPropertiesValidationMap) : ObjectPropertiesValidation1Boxed { + override fun getData(): Any? { + return data + } + } + + + class ObjectPropertiesValidation1 private constructor(): JsonSchema( + JsonSchemaInfo() + .properties(mapOf( + "foo" to Foo::class.java, + "bar" to Bar::class.java + )) + ), NullSchemaValidator, BooleanSchemaValidator, NumberSchemaValidator, StringSchemaValidator, ListSchemaValidator, ObjectPropertiesValidation1BoxedList>, MapSchemaValidator { + /* + NOTE: This class is auto generated by OpenAPI JSON Schema Generator. + Ref: https://github.com/openapi-json-schema-tools/openapi-json-schema-generator + + Do not edit the class manually. + */ + + companion object { + @Volatile + private var instance: ObjectPropertiesValidation1? = null + + fun getInstance() = + instance ?: synchronized(this) { + instance ?: ObjectPropertiesValidation1().also { instance = it } + } + } + + @Throws(ValidationException::class) + override fun validate(arg: Nothing?, configuration: SchemaConfiguration?): Nothing? { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validatedPathToSchemas = PathToSchemasMap() + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, LinkedHashSet()) + getPathToSchemas(this, castArg, validationMetadata, pathSet) + return castArg + } + + @Throws(ValidationException::class) + override fun validate(arg: Boolean, configuration: SchemaConfiguration?): Boolean { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validatedPathToSchemas = PathToSchemasMap() + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, LinkedHashSet()) + getPathToSchemas(this, castArg, validationMetadata, pathSet) + return castArg + } + + @Throws(ValidationException::class) + override fun validate(arg: Number, configuration: SchemaConfiguration?): Number { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validatedPathToSchemas = PathToSchemasMap() + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, LinkedHashSet()) + getPathToSchemas(this, castArg, validationMetadata, pathSet) + return castArg + } + + @Throws(ValidationException::class) + fun validate(arg: Int, configuration: SchemaConfiguration?): Int { + return validate(arg as Number, configuration) as Int + } + + @Throws(ValidationException::class) + fun validate(arg: Long, configuration: SchemaConfiguration?): Long { + return validate(arg as Number, configuration) as Long + } + + @Throws(ValidationException::class) + fun validate(arg: Float, configuration: SchemaConfiguration?): Float { + return validate(arg as Number, configuration) as Float + } + + @Throws(ValidationException::class) + fun validate(arg: Double, configuration: SchemaConfiguration?): Double { + return validate(arg as Number, configuration) as Double + } + + @Throws(ValidationException::class) + override fun validate(arg: String, configuration: SchemaConfiguration?): String { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validatedPathToSchemas = PathToSchemasMap() + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, LinkedHashSet()) + getPathToSchemas(this, castArg, validationMetadata, pathSet) + return castArg + } + + @Throws(ValidationException::class) + fun validate(arg: LocalDate, configuration: SchemaConfiguration?): String { + return validate(arg.toString(), configuration) + } + + @Throws(ValidationException::class) + fun validate(arg: ZonedDateTime, configuration: SchemaConfiguration?): String { + return validate(arg.toString(), configuration) + } + + @Throws(ValidationException::class) + fun validate(arg: UUID, configuration: SchemaConfiguration?): String { + return validate(arg.toString(), configuration) + } + + override fun getNewInstance(arg: List<*>, pathToItem: List, pathToSchemas: PathToSchemasMap): FrozenList { + val items: MutableList = ArrayList() + var i: Int = 0 + for (item: Any? in arg) { + val itemPathToItem = pathToItem + i + val schemas: LinkedHashMap, Nothing?>? = pathToSchemas.get(itemPathToItem) + if (schemas == null) { + throw RuntimeException("Validation result is invalid, schemas must exist for a pathToItem") + } + val itemSchema: JsonSchema<*> = schemas.entries.iterator().next().key + val itemInstance: Any? = itemSchema.getNewInstance(item, itemPathToItem, pathToSchemas) + items.add(itemInstance) + i += 1 + } + val newInstanceItems: FrozenList = FrozenList(items) + return newInstanceItems + } + + @Throws(ValidationException::class) + override fun validate(arg: List<*>, configuration: SchemaConfiguration?): FrozenList { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, PathToSchemasMap(), LinkedHashSet()) + val pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet) + return getNewInstance(castArg, validationMetadata.pathToItem, pathToSchemasMap) + } + + override fun getNewInstance(arg: Map<*, *>, pathToItem: List, pathToSchemas: PathToSchemasMap): ObjectPropertiesValidationMap { + val properties: LinkedHashMap = LinkedHashMap() + for((propertyName, value) in arg) { + if (!(propertyName is String)) { + throw RuntimeException("Invalid non-string key value") + } + val propertyPathToItem: List = pathToItem + propertyName + val schemas: LinkedHashMap, Nothing?>? = pathToSchemas.get(propertyPathToItem) + if (schemas == null) { + throw RuntimeException("Validation result is invalid, schemas must exist for a pathToItem") + } + val propertySchema: JsonSchema<*> = schemas.entries.iterator().next().key + val propertyInstance: Any? = propertySchema.getNewInstance(value, propertyPathToItem, pathToSchemas) + properties[propertyName] = propertyInstance + } + val castProperties: FrozenMap = FrozenMap(properties) + return ObjectPropertiesValidationMap(castProperties) + } + + @Throws(ValidationException::class) + override fun validate(arg: Map<*, *>, configuration: SchemaConfiguration?): ObjectPropertiesValidationMap { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validatedPathToSchemas = PathToSchemasMap() + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, LinkedHashSet()) + val pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet) + return getNewInstance(castArg, validationMetadata.pathToItem, pathToSchemasMap) + } + + @Throws(ValidationException::class) + override fun validate(arg: Any?, configuration: SchemaConfiguration?): Any? { + if (arg == null) { + return validate(null, configuration) + } else if (arg is Boolean) { + return validate(arg, configuration) + } else if (arg is Number) { + return validate(arg, configuration) + } else if (arg is String) { + return validate(arg, configuration) + } else if (arg is List<*>) { + return validate(arg, configuration) + } else if (arg is Map<*, *>) { + return validate(arg, configuration) + } + throw ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema") + } + override fun getNewInstance(arg: Any?, pathToItem: List, pathToSchemas: PathToSchemasMap): Any? { + if (arg == null) { + return getNewInstance( null, pathToItem, pathToSchemas) + } else if (arg is Boolean) { + return getNewInstance(arg, pathToItem, pathToSchemas) + } else if (arg is Number) { + return getNewInstance(arg, pathToItem, pathToSchemas) + } else if (arg is String) { + return getNewInstance(arg, pathToItem, pathToSchemas) + } else if (arg is List<*>) { + return getNewInstance(arg, pathToItem, pathToSchemas) + } else if (arg is Map<*, *>) { + return getNewInstance(arg, pathToItem, pathToSchemas) + } + throw RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema") + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: Nothing?, configuration: SchemaConfiguration?): ObjectPropertiesValidation1BoxedVoid { + return ObjectPropertiesValidation1BoxedVoid(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: Boolean, configuration: SchemaConfiguration?): ObjectPropertiesValidation1BoxedBoolean { + return ObjectPropertiesValidation1BoxedBoolean(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: Number, configuration: SchemaConfiguration?): ObjectPropertiesValidation1BoxedNumber { + return ObjectPropertiesValidation1BoxedNumber(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: String, configuration: SchemaConfiguration?): ObjectPropertiesValidation1BoxedString { + return ObjectPropertiesValidation1BoxedString(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: List<*>, configuration: SchemaConfiguration?): ObjectPropertiesValidation1BoxedList { + return ObjectPropertiesValidation1BoxedList(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: Map<*, *>, configuration: SchemaConfiguration?): ObjectPropertiesValidation1BoxedMap { + return ObjectPropertiesValidation1BoxedMap(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: Any?, configuration: SchemaConfiguration?): ObjectPropertiesValidation1Boxed { + if (arg == null) { + return validateAndBox(null, configuration) + } else if (arg is Boolean) { + return validateAndBox(arg, configuration) + } else if (arg is String) { + return validateAndBox(arg, configuration) + } else if (arg is Number) { + return validateAndBox(arg, configuration) + } else if (arg is List<*>) { + return validateAndBox(arg, configuration) + } else if (arg is Map<*, *>) { + return validateAndBox(arg, configuration) + } + throw ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema") + } + } +} diff --git a/samples/client/3_1_0_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/schemas/ObjectTypeMatchesObjects.kt b/samples/client/3_1_0_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/schemas/ObjectTypeMatchesObjects.kt new file mode 100644 index 00000000000..0cb08cb0b8f --- /dev/null +++ b/samples/client/3_1_0_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/schemas/ObjectTypeMatchesObjects.kt @@ -0,0 +1,21 @@ +package org.openapijsonschematools.client.components.schemas +import org.openapijsonschematools.client.schemas.MapJsonSchema +import org.openapijsonschematools.client.schemas.validation.FrozenMap + +class ObjectTypeMatchesObjects: MapJsonSchema() { + // nest classes so all schemas and input/output classes can be public + + + class ObjectTypeMatchesObjects1 : MapJsonSchema.MapJsonSchema1() { + companion object { + @Volatile + private var instance: ObjectTypeMatchesObjects1? = null + + fun getInstance() = + instance ?: synchronized(this) { + instance ?: ObjectTypeMatchesObjects1().also { instance = it } + } + } + } + +} diff --git a/samples/client/3_1_0_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/schemas/Oneof.kt b/samples/client/3_1_0_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/schemas/Oneof.kt new file mode 100644 index 00000000000..a3ca5e860ba --- /dev/null +++ b/samples/client/3_1_0_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/schemas/Oneof.kt @@ -0,0 +1,600 @@ +package org.openapijsonschematools.client.components.schemas +import java.time.LocalDate +import java.time.ZonedDateTime +import java.util.UUID +import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags +import org.openapijsonschematools.client.configurations.SchemaConfiguration +import org.openapijsonschematools.client.exceptions.InvalidAdditionalPropertyException +import org.openapijsonschematools.client.exceptions.UnsetPropertyException +import org.openapijsonschematools.client.exceptions.ValidationException +import org.openapijsonschematools.client.schemas.IntJsonSchema +import org.openapijsonschematools.client.schemas.UnsetAddPropsSetter +import org.openapijsonschematools.client.schemas.validation.BooleanSchemaValidator +import org.openapijsonschematools.client.schemas.validation.FrozenList +import org.openapijsonschematools.client.schemas.validation.FrozenMap +import org.openapijsonschematools.client.schemas.validation.JsonSchema +import org.openapijsonschematools.client.schemas.validation.JsonSchemaInfo +import org.openapijsonschematools.client.schemas.validation.ListSchemaValidator +import org.openapijsonschematools.client.schemas.validation.MapSchemaValidator +import org.openapijsonschematools.client.schemas.validation.NullSchemaValidator +import org.openapijsonschematools.client.schemas.validation.NumberSchemaValidator +import org.openapijsonschematools.client.schemas.validation.PathToSchemasMap +import org.openapijsonschematools.client.schemas.validation.StringSchemaValidator +import org.openapijsonschematools.client.schemas.validation.ValidationMetadata + +class Oneof { + // nest classes so all schemas and input/output classes can be public + + + class Schema0 : IntJsonSchema.IntJsonSchema1() { + companion object { + @Volatile + private var instance: Schema0? = null + + fun getInstance() = + instance ?: synchronized(this) { + instance ?: Schema0().also { instance = it } + } + } + } + + + sealed interface Schema1Boxed { + fun getData(): Any? + } + + data class Schema1BoxedVoid(val data: Nothing?) : Schema1Boxed { + override fun getData(): Any? { + return data + } + } + + data class Schema1BoxedBoolean(val data: Boolean): Schema1Boxed { + override fun getData(): Any? { + return data + } + } + + data class Schema1BoxedNumber(val data: Number) : Schema1Boxed { + override fun getData(): Any? { + return data + } + } + + data class Schema1BoxedString(val data: String) : Schema1Boxed { + override fun getData(): Any? { + return data + } + } + + data class Schema1BoxedList(val data: FrozenList) : Schema1Boxed { + override fun getData(): Any? { + return data + } + } + + data class Schema1BoxedMap(val data: FrozenMap) : Schema1Boxed { + override fun getData(): Any? { + return data + } + } + + + class Schema1 private constructor(): JsonSchema( + JsonSchemaInfo() + .minimum(2) + ), NullSchemaValidator, BooleanSchemaValidator, NumberSchemaValidator, StringSchemaValidator, ListSchemaValidator, Schema1BoxedList>, MapSchemaValidator, Schema1BoxedMap> { + + companion object { + @Volatile + private var instance: Schema1? = null + + fun getInstance() = + instance ?: synchronized(this) { + instance ?: Schema1().also { instance = it } + } + } + + @Throws(ValidationException::class) + override fun validate(arg: Nothing?, configuration: SchemaConfiguration?): Nothing? { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validatedPathToSchemas = PathToSchemasMap() + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, LinkedHashSet()) + getPathToSchemas(this, castArg, validationMetadata, pathSet) + return castArg + } + + @Throws(ValidationException::class) + override fun validate(arg: Boolean, configuration: SchemaConfiguration?): Boolean { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validatedPathToSchemas = PathToSchemasMap() + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, LinkedHashSet()) + getPathToSchemas(this, castArg, validationMetadata, pathSet) + return castArg + } + + @Throws(ValidationException::class) + override fun validate(arg: Number, configuration: SchemaConfiguration?): Number { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validatedPathToSchemas = PathToSchemasMap() + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, LinkedHashSet()) + getPathToSchemas(this, castArg, validationMetadata, pathSet) + return castArg + } + + @Throws(ValidationException::class) + fun validate(arg: Int, configuration: SchemaConfiguration?): Int { + return validate(arg as Number, configuration) as Int + } + + @Throws(ValidationException::class) + fun validate(arg: Long, configuration: SchemaConfiguration?): Long { + return validate(arg as Number, configuration) as Long + } + + @Throws(ValidationException::class) + fun validate(arg: Float, configuration: SchemaConfiguration?): Float { + return validate(arg as Number, configuration) as Float + } + + @Throws(ValidationException::class) + fun validate(arg: Double, configuration: SchemaConfiguration?): Double { + return validate(arg as Number, configuration) as Double + } + + @Throws(ValidationException::class) + override fun validate(arg: String, configuration: SchemaConfiguration?): String { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validatedPathToSchemas = PathToSchemasMap() + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, LinkedHashSet()) + getPathToSchemas(this, castArg, validationMetadata, pathSet) + return castArg + } + + @Throws(ValidationException::class) + fun validate(arg: LocalDate, configuration: SchemaConfiguration?): String { + return validate(arg.toString(), configuration) + } + + @Throws(ValidationException::class) + fun validate(arg: ZonedDateTime, configuration: SchemaConfiguration?): String { + return validate(arg.toString(), configuration) + } + + @Throws(ValidationException::class) + fun validate(arg: UUID, configuration: SchemaConfiguration?): String { + return validate(arg.toString(), configuration) + } + + override fun getNewInstance(arg: List<*>, pathToItem: List, pathToSchemas: PathToSchemasMap): FrozenList { + val items: MutableList = ArrayList() + var i: Int = 0 + for (item: Any? in arg) { + val itemPathToItem = pathToItem + i + val schemas: LinkedHashMap, Nothing?>? = pathToSchemas.get(itemPathToItem) + if (schemas == null) { + throw RuntimeException("Validation result is invalid, schemas must exist for a pathToItem") + } + val itemSchema: JsonSchema<*> = schemas.entries.iterator().next().key + val itemInstance: Any? = itemSchema.getNewInstance(item, itemPathToItem, pathToSchemas) + items.add(itemInstance) + i += 1 + } + val newInstanceItems: FrozenList = FrozenList(items) + return newInstanceItems + } + + @Throws(ValidationException::class) + override fun validate(arg: List<*>, configuration: SchemaConfiguration?): FrozenList { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, PathToSchemasMap(), LinkedHashSet()) + val pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet) + return getNewInstance(castArg, validationMetadata.pathToItem, pathToSchemasMap) + } + + override fun getNewInstance(arg: Map<*, *>, pathToItem: List, pathToSchemas: PathToSchemasMap): FrozenMap { + val properties: LinkedHashMap = LinkedHashMap() + for((propertyName, value) in arg) { + if (!(propertyName is String)) { + throw RuntimeException("Invalid non-string key value") + } + val propertyPathToItem: List = pathToItem + propertyName + val schemas: LinkedHashMap, Nothing?>? = pathToSchemas.get(propertyPathToItem) + if (schemas == null) { + throw RuntimeException("Validation result is invalid, schemas must exist for a pathToItem") + } + val propertySchema: JsonSchema<*> = schemas.entries.iterator().next().key + val propertyInstance: Any? = propertySchema.getNewInstance(value, propertyPathToItem, pathToSchemas) + properties[propertyName] = propertyInstance + } + val castProperties: FrozenMap = FrozenMap(properties) + return castProperties + } + + @Throws(ValidationException::class) + override fun validate(arg: Map<*, *>, configuration: SchemaConfiguration?): FrozenMap { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validatedPathToSchemas = PathToSchemasMap() + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, LinkedHashSet()) + val pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet) + return getNewInstance(castArg, validationMetadata.pathToItem, pathToSchemasMap) + } + + @Throws(ValidationException::class) + override fun validate(arg: Any?, configuration: SchemaConfiguration?): Any? { + if (arg == null) { + return validate(null, configuration) + } else if (arg is Boolean) { + return validate(arg, configuration) + } else if (arg is Number) { + return validate(arg, configuration) + } else if (arg is String) { + return validate(arg, configuration) + } else if (arg is List<*>) { + return validate(arg, configuration) + } else if (arg is Map<*, *>) { + return validate(arg, configuration) + } + throw ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema") + } + override fun getNewInstance(arg: Any?, pathToItem: List, pathToSchemas: PathToSchemasMap): Any? { + if (arg == null) { + return getNewInstance( null, pathToItem, pathToSchemas) + } else if (arg is Boolean) { + return getNewInstance(arg, pathToItem, pathToSchemas) + } else if (arg is Number) { + return getNewInstance(arg, pathToItem, pathToSchemas) + } else if (arg is String) { + return getNewInstance(arg, pathToItem, pathToSchemas) + } else if (arg is List<*>) { + return getNewInstance(arg, pathToItem, pathToSchemas) + } else if (arg is Map<*, *>) { + return getNewInstance(arg, pathToItem, pathToSchemas) + } + throw RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema") + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: Nothing?, configuration: SchemaConfiguration?): Schema1BoxedVoid { + return Schema1BoxedVoid(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: Boolean, configuration: SchemaConfiguration?): Schema1BoxedBoolean { + return Schema1BoxedBoolean(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: Number, configuration: SchemaConfiguration?): Schema1BoxedNumber { + return Schema1BoxedNumber(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: String, configuration: SchemaConfiguration?): Schema1BoxedString { + return Schema1BoxedString(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: List<*>, configuration: SchemaConfiguration?): Schema1BoxedList { + return Schema1BoxedList(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: Map<*, *>, configuration: SchemaConfiguration?): Schema1BoxedMap { + return Schema1BoxedMap(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: Any?, configuration: SchemaConfiguration?): Schema1Boxed { + if (arg == null) { + return validateAndBox(null, configuration) + } else if (arg is Boolean) { + return validateAndBox(arg, configuration) + } else if (arg is String) { + return validateAndBox(arg, configuration) + } else if (arg is Number) { + return validateAndBox(arg, configuration) + } else if (arg is List<*>) { + return validateAndBox(arg, configuration) + } else if (arg is Map<*, *>) { + return validateAndBox(arg, configuration) + } + throw ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema") + } + } + + sealed interface Oneof1Boxed { + fun getData(): Any? + } + + data class Oneof1BoxedVoid(val data: Nothing?) : Oneof1Boxed { + override fun getData(): Any? { + return data + } + } + + data class Oneof1BoxedBoolean(val data: Boolean): Oneof1Boxed { + override fun getData(): Any? { + return data + } + } + + data class Oneof1BoxedNumber(val data: Number) : Oneof1Boxed { + override fun getData(): Any? { + return data + } + } + + data class Oneof1BoxedString(val data: String) : Oneof1Boxed { + override fun getData(): Any? { + return data + } + } + + data class Oneof1BoxedList(val data: FrozenList) : Oneof1Boxed { + override fun getData(): Any? { + return data + } + } + + data class Oneof1BoxedMap(val data: FrozenMap) : Oneof1Boxed { + override fun getData(): Any? { + return data + } + } + + + class Oneof1 private constructor(): JsonSchema( + JsonSchemaInfo() + .oneOf(listOf( + Schema0::class.java, + Schema1::class.java + )) + ), NullSchemaValidator, BooleanSchemaValidator, NumberSchemaValidator, StringSchemaValidator, ListSchemaValidator, Oneof1BoxedList>, MapSchemaValidator, Oneof1BoxedMap> { + /* + NOTE: This class is auto generated by OpenAPI JSON Schema Generator. + Ref: https://github.com/openapi-json-schema-tools/openapi-json-schema-generator + + Do not edit the class manually. + */ + + companion object { + @Volatile + private var instance: Oneof1? = null + + fun getInstance() = + instance ?: synchronized(this) { + instance ?: Oneof1().also { instance = it } + } + } + + @Throws(ValidationException::class) + override fun validate(arg: Nothing?, configuration: SchemaConfiguration?): Nothing? { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validatedPathToSchemas = PathToSchemasMap() + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, LinkedHashSet()) + getPathToSchemas(this, castArg, validationMetadata, pathSet) + return castArg + } + + @Throws(ValidationException::class) + override fun validate(arg: Boolean, configuration: SchemaConfiguration?): Boolean { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validatedPathToSchemas = PathToSchemasMap() + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, LinkedHashSet()) + getPathToSchemas(this, castArg, validationMetadata, pathSet) + return castArg + } + + @Throws(ValidationException::class) + override fun validate(arg: Number, configuration: SchemaConfiguration?): Number { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validatedPathToSchemas = PathToSchemasMap() + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, LinkedHashSet()) + getPathToSchemas(this, castArg, validationMetadata, pathSet) + return castArg + } + + @Throws(ValidationException::class) + fun validate(arg: Int, configuration: SchemaConfiguration?): Int { + return validate(arg as Number, configuration) as Int + } + + @Throws(ValidationException::class) + fun validate(arg: Long, configuration: SchemaConfiguration?): Long { + return validate(arg as Number, configuration) as Long + } + + @Throws(ValidationException::class) + fun validate(arg: Float, configuration: SchemaConfiguration?): Float { + return validate(arg as Number, configuration) as Float + } + + @Throws(ValidationException::class) + fun validate(arg: Double, configuration: SchemaConfiguration?): Double { + return validate(arg as Number, configuration) as Double + } + + @Throws(ValidationException::class) + override fun validate(arg: String, configuration: SchemaConfiguration?): String { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validatedPathToSchemas = PathToSchemasMap() + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, LinkedHashSet()) + getPathToSchemas(this, castArg, validationMetadata, pathSet) + return castArg + } + + @Throws(ValidationException::class) + fun validate(arg: LocalDate, configuration: SchemaConfiguration?): String { + return validate(arg.toString(), configuration) + } + + @Throws(ValidationException::class) + fun validate(arg: ZonedDateTime, configuration: SchemaConfiguration?): String { + return validate(arg.toString(), configuration) + } + + @Throws(ValidationException::class) + fun validate(arg: UUID, configuration: SchemaConfiguration?): String { + return validate(arg.toString(), configuration) + } + + override fun getNewInstance(arg: List<*>, pathToItem: List, pathToSchemas: PathToSchemasMap): FrozenList { + val items: MutableList = ArrayList() + var i: Int = 0 + for (item: Any? in arg) { + val itemPathToItem = pathToItem + i + val schemas: LinkedHashMap, Nothing?>? = pathToSchemas.get(itemPathToItem) + if (schemas == null) { + throw RuntimeException("Validation result is invalid, schemas must exist for a pathToItem") + } + val itemSchema: JsonSchema<*> = schemas.entries.iterator().next().key + val itemInstance: Any? = itemSchema.getNewInstance(item, itemPathToItem, pathToSchemas) + items.add(itemInstance) + i += 1 + } + val newInstanceItems: FrozenList = FrozenList(items) + return newInstanceItems + } + + @Throws(ValidationException::class) + override fun validate(arg: List<*>, configuration: SchemaConfiguration?): FrozenList { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, PathToSchemasMap(), LinkedHashSet()) + val pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet) + return getNewInstance(castArg, validationMetadata.pathToItem, pathToSchemasMap) + } + + override fun getNewInstance(arg: Map<*, *>, pathToItem: List, pathToSchemas: PathToSchemasMap): FrozenMap { + val properties: LinkedHashMap = LinkedHashMap() + for((propertyName, value) in arg) { + if (!(propertyName is String)) { + throw RuntimeException("Invalid non-string key value") + } + val propertyPathToItem: List = pathToItem + propertyName + val schemas: LinkedHashMap, Nothing?>? = pathToSchemas.get(propertyPathToItem) + if (schemas == null) { + throw RuntimeException("Validation result is invalid, schemas must exist for a pathToItem") + } + val propertySchema: JsonSchema<*> = schemas.entries.iterator().next().key + val propertyInstance: Any? = propertySchema.getNewInstance(value, propertyPathToItem, pathToSchemas) + properties[propertyName] = propertyInstance + } + val castProperties: FrozenMap = FrozenMap(properties) + return castProperties + } + + @Throws(ValidationException::class) + override fun validate(arg: Map<*, *>, configuration: SchemaConfiguration?): FrozenMap { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validatedPathToSchemas = PathToSchemasMap() + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, LinkedHashSet()) + val pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet) + return getNewInstance(castArg, validationMetadata.pathToItem, pathToSchemasMap) + } + + @Throws(ValidationException::class) + override fun validate(arg: Any?, configuration: SchemaConfiguration?): Any? { + if (arg == null) { + return validate(null, configuration) + } else if (arg is Boolean) { + return validate(arg, configuration) + } else if (arg is Number) { + return validate(arg, configuration) + } else if (arg is String) { + return validate(arg, configuration) + } else if (arg is List<*>) { + return validate(arg, configuration) + } else if (arg is Map<*, *>) { + return validate(arg, configuration) + } + throw ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema") + } + override fun getNewInstance(arg: Any?, pathToItem: List, pathToSchemas: PathToSchemasMap): Any? { + if (arg == null) { + return getNewInstance( null, pathToItem, pathToSchemas) + } else if (arg is Boolean) { + return getNewInstance(arg, pathToItem, pathToSchemas) + } else if (arg is Number) { + return getNewInstance(arg, pathToItem, pathToSchemas) + } else if (arg is String) { + return getNewInstance(arg, pathToItem, pathToSchemas) + } else if (arg is List<*>) { + return getNewInstance(arg, pathToItem, pathToSchemas) + } else if (arg is Map<*, *>) { + return getNewInstance(arg, pathToItem, pathToSchemas) + } + throw RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema") + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: Nothing?, configuration: SchemaConfiguration?): Oneof1BoxedVoid { + return Oneof1BoxedVoid(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: Boolean, configuration: SchemaConfiguration?): Oneof1BoxedBoolean { + return Oneof1BoxedBoolean(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: Number, configuration: SchemaConfiguration?): Oneof1BoxedNumber { + return Oneof1BoxedNumber(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: String, configuration: SchemaConfiguration?): Oneof1BoxedString { + return Oneof1BoxedString(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: List<*>, configuration: SchemaConfiguration?): Oneof1BoxedList { + return Oneof1BoxedList(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: Map<*, *>, configuration: SchemaConfiguration?): Oneof1BoxedMap { + return Oneof1BoxedMap(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: Any?, configuration: SchemaConfiguration?): Oneof1Boxed { + if (arg == null) { + return validateAndBox(null, configuration) + } else if (arg is Boolean) { + return validateAndBox(arg, configuration) + } else if (arg is String) { + return validateAndBox(arg, configuration) + } else if (arg is Number) { + return validateAndBox(arg, configuration) + } else if (arg is List<*>) { + return validateAndBox(arg, configuration) + } else if (arg is Map<*, *>) { + return validateAndBox(arg, configuration) + } + throw ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema") + } + } +} diff --git a/samples/client/3_1_0_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/schemas/OneofComplexTypes.kt b/samples/client/3_1_0_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/schemas/OneofComplexTypes.kt new file mode 100644 index 00000000000..0810d902fbb --- /dev/null +++ b/samples/client/3_1_0_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/schemas/OneofComplexTypes.kt @@ -0,0 +1,1060 @@ +package org.openapijsonschematools.client.components.schemas +import java.time.LocalDate +import java.time.ZonedDateTime +import java.util.UUID +import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags +import org.openapijsonschematools.client.configurations.SchemaConfiguration +import org.openapijsonschematools.client.exceptions.InvalidAdditionalPropertyException +import org.openapijsonschematools.client.exceptions.UnsetPropertyException +import org.openapijsonschematools.client.exceptions.ValidationException +import org.openapijsonschematools.client.schemas.GenericBuilder +import org.openapijsonschematools.client.schemas.IntJsonSchema +import org.openapijsonschematools.client.schemas.StringJsonSchema +import org.openapijsonschematools.client.schemas.UnsetAddPropsSetter +import org.openapijsonschematools.client.schemas.validation.BooleanSchemaValidator +import org.openapijsonschematools.client.schemas.validation.FrozenList +import org.openapijsonschematools.client.schemas.validation.FrozenMap +import org.openapijsonschematools.client.schemas.validation.JsonSchema +import org.openapijsonschematools.client.schemas.validation.JsonSchemaInfo +import org.openapijsonschematools.client.schemas.validation.ListSchemaValidator +import org.openapijsonschematools.client.schemas.validation.MapSchemaValidator +import org.openapijsonschematools.client.schemas.validation.NullSchemaValidator +import org.openapijsonschematools.client.schemas.validation.NumberSchemaValidator +import org.openapijsonschematools.client.schemas.validation.PathToSchemasMap +import org.openapijsonschematools.client.schemas.validation.StringSchemaValidator +import org.openapijsonschematools.client.schemas.validation.ValidationMetadata + +class OneofComplexTypes { + // nest classes so all schemas and input/output classes can be public + + + class Bar : IntJsonSchema.IntJsonSchema1() { + companion object { + @Volatile + private var instance: Bar? = null + + fun getInstance() = + instance ?: synchronized(this) { + instance ?: Bar().also { instance = it } + } + } + } + + + class Schema0Map(m: FrozenMap) : FrozenMap(m) { + companion object { + val requiredKeys: Set = setOf( + "bar" + ) + val optionalKeys: Set = setOf() + @Throws(ValidationException::class) + fun of(arg: Map, configuration: SchemaConfiguration): Schema0Map { + return Schema0.getInstance().validate(arg, configuration) + } + } + + fun bar(): Number { + val value: Any? = get("bar") + if (!(value is Number)) { + throw RuntimeException("Invalid value stored for bar") + } + return value + } + + @Throws(UnsetPropertyException::class, InvalidAdditionalPropertyException::class) + fun getAdditionalProperty(name: String): Any? { + throwIfKeyKnown(name, requiredKeys, optionalKeys) + throwIfKeyNotPresent(name) + return get(name) + } + } + + interface SetterForBar { + fun getInstance(): MutableMap + fun getBuilderAfterBar(instance: MutableMap): T + + fun bar(value: Int): T { + val instance = getInstance() + instance["bar"] = value + return getBuilderAfterBar(instance) + } + + fun bar(value: Float): T { + val instance = getInstance() + instance["bar"] = value + return getBuilderAfterBar(instance) + } + + fun bar(value: Long): T { + val instance = getInstance() + instance["bar"] = value + return getBuilderAfterBar(instance) + } + + fun bar(value: Double): T { + val instance = getInstance() + instance["bar"] = value + return getBuilderAfterBar(instance) + } + } + + class Schema0Map0Builder(private val instance: MutableMap): UnsetAddPropsSetter, GenericBuilder> { + private val knownKeys: Set = setOf( + "bar" + ) + override fun getKnownKeys(): Set { + return knownKeys + } + override fun build(): Map { + return instance + } + override fun getInstance(): MutableMap { + return instance + } + override fun getBuilderAfterAdditionalProperty(instance: MutableMap): Schema0Map0Builder { + return this + } + } + + class Schema0MapBuilder: SetterForBar { + private val instance: MutableMap + init { + this.instance = LinkedHashMap() + } + override fun getInstance(): MutableMap { + return instance + } + override fun getBuilderAfterBar(instance: MutableMap): Schema0Map0Builder { + return Schema0Map0Builder(instance) + } + } + + + sealed interface Schema0Boxed { + fun getData(): Any? + } + + data class Schema0BoxedVoid(val data: Nothing?) : Schema0Boxed { + override fun getData(): Any? { + return data + } + } + + data class Schema0BoxedBoolean(val data: Boolean): Schema0Boxed { + override fun getData(): Any? { + return data + } + } + + data class Schema0BoxedNumber(val data: Number) : Schema0Boxed { + override fun getData(): Any? { + return data + } + } + + data class Schema0BoxedString(val data: String) : Schema0Boxed { + override fun getData(): Any? { + return data + } + } + + data class Schema0BoxedList(val data: FrozenList) : Schema0Boxed { + override fun getData(): Any? { + return data + } + } + + data class Schema0BoxedMap(val data: Schema0Map) : Schema0Boxed { + override fun getData(): Any? { + return data + } + } + + + class Schema0 private constructor(): JsonSchema( + JsonSchemaInfo() + .properties(mapOf( + "bar" to Bar::class.java + )) + .required(setOf( + "bar" + )) + ), NullSchemaValidator, BooleanSchemaValidator, NumberSchemaValidator, StringSchemaValidator, ListSchemaValidator, Schema0BoxedList>, MapSchemaValidator { + + companion object { + @Volatile + private var instance: Schema0? = null + + fun getInstance() = + instance ?: synchronized(this) { + instance ?: Schema0().also { instance = it } + } + } + + @Throws(ValidationException::class) + override fun validate(arg: Nothing?, configuration: SchemaConfiguration?): Nothing? { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validatedPathToSchemas = PathToSchemasMap() + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, LinkedHashSet()) + getPathToSchemas(this, castArg, validationMetadata, pathSet) + return castArg + } + + @Throws(ValidationException::class) + override fun validate(arg: Boolean, configuration: SchemaConfiguration?): Boolean { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validatedPathToSchemas = PathToSchemasMap() + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, LinkedHashSet()) + getPathToSchemas(this, castArg, validationMetadata, pathSet) + return castArg + } + + @Throws(ValidationException::class) + override fun validate(arg: Number, configuration: SchemaConfiguration?): Number { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validatedPathToSchemas = PathToSchemasMap() + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, LinkedHashSet()) + getPathToSchemas(this, castArg, validationMetadata, pathSet) + return castArg + } + + @Throws(ValidationException::class) + fun validate(arg: Int, configuration: SchemaConfiguration?): Int { + return validate(arg as Number, configuration) as Int + } + + @Throws(ValidationException::class) + fun validate(arg: Long, configuration: SchemaConfiguration?): Long { + return validate(arg as Number, configuration) as Long + } + + @Throws(ValidationException::class) + fun validate(arg: Float, configuration: SchemaConfiguration?): Float { + return validate(arg as Number, configuration) as Float + } + + @Throws(ValidationException::class) + fun validate(arg: Double, configuration: SchemaConfiguration?): Double { + return validate(arg as Number, configuration) as Double + } + + @Throws(ValidationException::class) + override fun validate(arg: String, configuration: SchemaConfiguration?): String { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validatedPathToSchemas = PathToSchemasMap() + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, LinkedHashSet()) + getPathToSchemas(this, castArg, validationMetadata, pathSet) + return castArg + } + + @Throws(ValidationException::class) + fun validate(arg: LocalDate, configuration: SchemaConfiguration?): String { + return validate(arg.toString(), configuration) + } + + @Throws(ValidationException::class) + fun validate(arg: ZonedDateTime, configuration: SchemaConfiguration?): String { + return validate(arg.toString(), configuration) + } + + @Throws(ValidationException::class) + fun validate(arg: UUID, configuration: SchemaConfiguration?): String { + return validate(arg.toString(), configuration) + } + + override fun getNewInstance(arg: List<*>, pathToItem: List, pathToSchemas: PathToSchemasMap): FrozenList { + val items: MutableList = ArrayList() + var i: Int = 0 + for (item: Any? in arg) { + val itemPathToItem = pathToItem + i + val schemas: LinkedHashMap, Nothing?>? = pathToSchemas.get(itemPathToItem) + if (schemas == null) { + throw RuntimeException("Validation result is invalid, schemas must exist for a pathToItem") + } + val itemSchema: JsonSchema<*> = schemas.entries.iterator().next().key + val itemInstance: Any? = itemSchema.getNewInstance(item, itemPathToItem, pathToSchemas) + items.add(itemInstance) + i += 1 + } + val newInstanceItems: FrozenList = FrozenList(items) + return newInstanceItems + } + + @Throws(ValidationException::class) + override fun validate(arg: List<*>, configuration: SchemaConfiguration?): FrozenList { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, PathToSchemasMap(), LinkedHashSet()) + val pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet) + return getNewInstance(castArg, validationMetadata.pathToItem, pathToSchemasMap) + } + + override fun getNewInstance(arg: Map<*, *>, pathToItem: List, pathToSchemas: PathToSchemasMap): Schema0Map { + val properties: LinkedHashMap = LinkedHashMap() + for((propertyName, value) in arg) { + if (!(propertyName is String)) { + throw RuntimeException("Invalid non-string key value") + } + val propertyPathToItem: List = pathToItem + propertyName + val schemas: LinkedHashMap, Nothing?>? = pathToSchemas.get(propertyPathToItem) + if (schemas == null) { + throw RuntimeException("Validation result is invalid, schemas must exist for a pathToItem") + } + val propertySchema: JsonSchema<*> = schemas.entries.iterator().next().key + val propertyInstance: Any? = propertySchema.getNewInstance(value, propertyPathToItem, pathToSchemas) + properties[propertyName] = propertyInstance + } + val castProperties: FrozenMap = FrozenMap(properties) + return Schema0Map(castProperties) + } + + @Throws(ValidationException::class) + override fun validate(arg: Map<*, *>, configuration: SchemaConfiguration?): Schema0Map { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validatedPathToSchemas = PathToSchemasMap() + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, LinkedHashSet()) + val pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet) + return getNewInstance(castArg, validationMetadata.pathToItem, pathToSchemasMap) + } + + @Throws(ValidationException::class) + override fun validate(arg: Any?, configuration: SchemaConfiguration?): Any? { + if (arg == null) { + return validate(null, configuration) + } else if (arg is Boolean) { + return validate(arg, configuration) + } else if (arg is Number) { + return validate(arg, configuration) + } else if (arg is String) { + return validate(arg, configuration) + } else if (arg is List<*>) { + return validate(arg, configuration) + } else if (arg is Map<*, *>) { + return validate(arg, configuration) + } + throw ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema") + } + override fun getNewInstance(arg: Any?, pathToItem: List, pathToSchemas: PathToSchemasMap): Any? { + if (arg == null) { + return getNewInstance( null, pathToItem, pathToSchemas) + } else if (arg is Boolean) { + return getNewInstance(arg, pathToItem, pathToSchemas) + } else if (arg is Number) { + return getNewInstance(arg, pathToItem, pathToSchemas) + } else if (arg is String) { + return getNewInstance(arg, pathToItem, pathToSchemas) + } else if (arg is List<*>) { + return getNewInstance(arg, pathToItem, pathToSchemas) + } else if (arg is Map<*, *>) { + return getNewInstance(arg, pathToItem, pathToSchemas) + } + throw RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema") + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: Nothing?, configuration: SchemaConfiguration?): Schema0BoxedVoid { + return Schema0BoxedVoid(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: Boolean, configuration: SchemaConfiguration?): Schema0BoxedBoolean { + return Schema0BoxedBoolean(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: Number, configuration: SchemaConfiguration?): Schema0BoxedNumber { + return Schema0BoxedNumber(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: String, configuration: SchemaConfiguration?): Schema0BoxedString { + return Schema0BoxedString(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: List<*>, configuration: SchemaConfiguration?): Schema0BoxedList { + return Schema0BoxedList(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: Map<*, *>, configuration: SchemaConfiguration?): Schema0BoxedMap { + return Schema0BoxedMap(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: Any?, configuration: SchemaConfiguration?): Schema0Boxed { + if (arg == null) { + return validateAndBox(null, configuration) + } else if (arg is Boolean) { + return validateAndBox(arg, configuration) + } else if (arg is String) { + return validateAndBox(arg, configuration) + } else if (arg is Number) { + return validateAndBox(arg, configuration) + } else if (arg is List<*>) { + return validateAndBox(arg, configuration) + } else if (arg is Map<*, *>) { + return validateAndBox(arg, configuration) + } + throw ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema") + } + } + + class Foo : StringJsonSchema.StringJsonSchema1() { + companion object { + @Volatile + private var instance: Foo? = null + + fun getInstance() = + instance ?: synchronized(this) { + instance ?: Foo().also { instance = it } + } + } + } + + + class Schema1Map(m: FrozenMap) : FrozenMap(m) { + companion object { + val requiredKeys: Set = setOf( + "foo" + ) + val optionalKeys: Set = setOf() + @Throws(ValidationException::class) + fun of(arg: Map, configuration: SchemaConfiguration): Schema1Map { + return Schema1.getInstance().validate(arg, configuration) + } + } + + fun foo(): String { + val value: Any? = get("foo") + if (!(value is String)) { + throw RuntimeException("Invalid value stored for foo") + } + return value + } + + @Throws(UnsetPropertyException::class, InvalidAdditionalPropertyException::class) + fun getAdditionalProperty(name: String): Any? { + throwIfKeyKnown(name, requiredKeys, optionalKeys) + throwIfKeyNotPresent(name) + return get(name) + } + } + + interface SetterForFoo { + fun getInstance(): MutableMap + fun getBuilderAfterFoo(instance: MutableMap): T + + fun foo(value: String): T { + val instance = getInstance() + instance["foo"] = value + return getBuilderAfterFoo(instance) + } + } + + class Schema1Map0Builder(private val instance: MutableMap): UnsetAddPropsSetter, GenericBuilder> { + private val knownKeys: Set = setOf( + "foo" + ) + override fun getKnownKeys(): Set { + return knownKeys + } + override fun build(): Map { + return instance + } + override fun getInstance(): MutableMap { + return instance + } + override fun getBuilderAfterAdditionalProperty(instance: MutableMap): Schema1Map0Builder { + return this + } + } + + class Schema1MapBuilder: SetterForFoo { + private val instance: MutableMap + init { + this.instance = LinkedHashMap() + } + override fun getInstance(): MutableMap { + return instance + } + override fun getBuilderAfterFoo(instance: MutableMap): Schema1Map0Builder { + return Schema1Map0Builder(instance) + } + } + + + sealed interface Schema1Boxed { + fun getData(): Any? + } + + data class Schema1BoxedVoid(val data: Nothing?) : Schema1Boxed { + override fun getData(): Any? { + return data + } + } + + data class Schema1BoxedBoolean(val data: Boolean): Schema1Boxed { + override fun getData(): Any? { + return data + } + } + + data class Schema1BoxedNumber(val data: Number) : Schema1Boxed { + override fun getData(): Any? { + return data + } + } + + data class Schema1BoxedString(val data: String) : Schema1Boxed { + override fun getData(): Any? { + return data + } + } + + data class Schema1BoxedList(val data: FrozenList) : Schema1Boxed { + override fun getData(): Any? { + return data + } + } + + data class Schema1BoxedMap(val data: Schema1Map) : Schema1Boxed { + override fun getData(): Any? { + return data + } + } + + + class Schema1 private constructor(): JsonSchema( + JsonSchemaInfo() + .properties(mapOf( + "foo" to Foo::class.java + )) + .required(setOf( + "foo" + )) + ), NullSchemaValidator, BooleanSchemaValidator, NumberSchemaValidator, StringSchemaValidator, ListSchemaValidator, Schema1BoxedList>, MapSchemaValidator { + + companion object { + @Volatile + private var instance: Schema1? = null + + fun getInstance() = + instance ?: synchronized(this) { + instance ?: Schema1().also { instance = it } + } + } + + @Throws(ValidationException::class) + override fun validate(arg: Nothing?, configuration: SchemaConfiguration?): Nothing? { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validatedPathToSchemas = PathToSchemasMap() + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, LinkedHashSet()) + getPathToSchemas(this, castArg, validationMetadata, pathSet) + return castArg + } + + @Throws(ValidationException::class) + override fun validate(arg: Boolean, configuration: SchemaConfiguration?): Boolean { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validatedPathToSchemas = PathToSchemasMap() + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, LinkedHashSet()) + getPathToSchemas(this, castArg, validationMetadata, pathSet) + return castArg + } + + @Throws(ValidationException::class) + override fun validate(arg: Number, configuration: SchemaConfiguration?): Number { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validatedPathToSchemas = PathToSchemasMap() + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, LinkedHashSet()) + getPathToSchemas(this, castArg, validationMetadata, pathSet) + return castArg + } + + @Throws(ValidationException::class) + fun validate(arg: Int, configuration: SchemaConfiguration?): Int { + return validate(arg as Number, configuration) as Int + } + + @Throws(ValidationException::class) + fun validate(arg: Long, configuration: SchemaConfiguration?): Long { + return validate(arg as Number, configuration) as Long + } + + @Throws(ValidationException::class) + fun validate(arg: Float, configuration: SchemaConfiguration?): Float { + return validate(arg as Number, configuration) as Float + } + + @Throws(ValidationException::class) + fun validate(arg: Double, configuration: SchemaConfiguration?): Double { + return validate(arg as Number, configuration) as Double + } + + @Throws(ValidationException::class) + override fun validate(arg: String, configuration: SchemaConfiguration?): String { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validatedPathToSchemas = PathToSchemasMap() + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, LinkedHashSet()) + getPathToSchemas(this, castArg, validationMetadata, pathSet) + return castArg + } + + @Throws(ValidationException::class) + fun validate(arg: LocalDate, configuration: SchemaConfiguration?): String { + return validate(arg.toString(), configuration) + } + + @Throws(ValidationException::class) + fun validate(arg: ZonedDateTime, configuration: SchemaConfiguration?): String { + return validate(arg.toString(), configuration) + } + + @Throws(ValidationException::class) + fun validate(arg: UUID, configuration: SchemaConfiguration?): String { + return validate(arg.toString(), configuration) + } + + override fun getNewInstance(arg: List<*>, pathToItem: List, pathToSchemas: PathToSchemasMap): FrozenList { + val items: MutableList = ArrayList() + var i: Int = 0 + for (item: Any? in arg) { + val itemPathToItem = pathToItem + i + val schemas: LinkedHashMap, Nothing?>? = pathToSchemas.get(itemPathToItem) + if (schemas == null) { + throw RuntimeException("Validation result is invalid, schemas must exist for a pathToItem") + } + val itemSchema: JsonSchema<*> = schemas.entries.iterator().next().key + val itemInstance: Any? = itemSchema.getNewInstance(item, itemPathToItem, pathToSchemas) + items.add(itemInstance) + i += 1 + } + val newInstanceItems: FrozenList = FrozenList(items) + return newInstanceItems + } + + @Throws(ValidationException::class) + override fun validate(arg: List<*>, configuration: SchemaConfiguration?): FrozenList { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, PathToSchemasMap(), LinkedHashSet()) + val pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet) + return getNewInstance(castArg, validationMetadata.pathToItem, pathToSchemasMap) + } + + override fun getNewInstance(arg: Map<*, *>, pathToItem: List, pathToSchemas: PathToSchemasMap): Schema1Map { + val properties: LinkedHashMap = LinkedHashMap() + for((propertyName, value) in arg) { + if (!(propertyName is String)) { + throw RuntimeException("Invalid non-string key value") + } + val propertyPathToItem: List = pathToItem + propertyName + val schemas: LinkedHashMap, Nothing?>? = pathToSchemas.get(propertyPathToItem) + if (schemas == null) { + throw RuntimeException("Validation result is invalid, schemas must exist for a pathToItem") + } + val propertySchema: JsonSchema<*> = schemas.entries.iterator().next().key + val propertyInstance: Any? = propertySchema.getNewInstance(value, propertyPathToItem, pathToSchemas) + properties[propertyName] = propertyInstance + } + val castProperties: FrozenMap = FrozenMap(properties) + return Schema1Map(castProperties) + } + + @Throws(ValidationException::class) + override fun validate(arg: Map<*, *>, configuration: SchemaConfiguration?): Schema1Map { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validatedPathToSchemas = PathToSchemasMap() + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, LinkedHashSet()) + val pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet) + return getNewInstance(castArg, validationMetadata.pathToItem, pathToSchemasMap) + } + + @Throws(ValidationException::class) + override fun validate(arg: Any?, configuration: SchemaConfiguration?): Any? { + if (arg == null) { + return validate(null, configuration) + } else if (arg is Boolean) { + return validate(arg, configuration) + } else if (arg is Number) { + return validate(arg, configuration) + } else if (arg is String) { + return validate(arg, configuration) + } else if (arg is List<*>) { + return validate(arg, configuration) + } else if (arg is Map<*, *>) { + return validate(arg, configuration) + } + throw ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema") + } + override fun getNewInstance(arg: Any?, pathToItem: List, pathToSchemas: PathToSchemasMap): Any? { + if (arg == null) { + return getNewInstance( null, pathToItem, pathToSchemas) + } else if (arg is Boolean) { + return getNewInstance(arg, pathToItem, pathToSchemas) + } else if (arg is Number) { + return getNewInstance(arg, pathToItem, pathToSchemas) + } else if (arg is String) { + return getNewInstance(arg, pathToItem, pathToSchemas) + } else if (arg is List<*>) { + return getNewInstance(arg, pathToItem, pathToSchemas) + } else if (arg is Map<*, *>) { + return getNewInstance(arg, pathToItem, pathToSchemas) + } + throw RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema") + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: Nothing?, configuration: SchemaConfiguration?): Schema1BoxedVoid { + return Schema1BoxedVoid(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: Boolean, configuration: SchemaConfiguration?): Schema1BoxedBoolean { + return Schema1BoxedBoolean(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: Number, configuration: SchemaConfiguration?): Schema1BoxedNumber { + return Schema1BoxedNumber(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: String, configuration: SchemaConfiguration?): Schema1BoxedString { + return Schema1BoxedString(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: List<*>, configuration: SchemaConfiguration?): Schema1BoxedList { + return Schema1BoxedList(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: Map<*, *>, configuration: SchemaConfiguration?): Schema1BoxedMap { + return Schema1BoxedMap(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: Any?, configuration: SchemaConfiguration?): Schema1Boxed { + if (arg == null) { + return validateAndBox(null, configuration) + } else if (arg is Boolean) { + return validateAndBox(arg, configuration) + } else if (arg is String) { + return validateAndBox(arg, configuration) + } else if (arg is Number) { + return validateAndBox(arg, configuration) + } else if (arg is List<*>) { + return validateAndBox(arg, configuration) + } else if (arg is Map<*, *>) { + return validateAndBox(arg, configuration) + } + throw ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema") + } + } + + sealed interface OneofComplexTypes1Boxed { + fun getData(): Any? + } + + data class OneofComplexTypes1BoxedVoid(val data: Nothing?) : OneofComplexTypes1Boxed { + override fun getData(): Any? { + return data + } + } + + data class OneofComplexTypes1BoxedBoolean(val data: Boolean): OneofComplexTypes1Boxed { + override fun getData(): Any? { + return data + } + } + + data class OneofComplexTypes1BoxedNumber(val data: Number) : OneofComplexTypes1Boxed { + override fun getData(): Any? { + return data + } + } + + data class OneofComplexTypes1BoxedString(val data: String) : OneofComplexTypes1Boxed { + override fun getData(): Any? { + return data + } + } + + data class OneofComplexTypes1BoxedList(val data: FrozenList) : OneofComplexTypes1Boxed { + override fun getData(): Any? { + return data + } + } + + data class OneofComplexTypes1BoxedMap(val data: FrozenMap) : OneofComplexTypes1Boxed { + override fun getData(): Any? { + return data + } + } + + + class OneofComplexTypes1 private constructor(): JsonSchema( + JsonSchemaInfo() + .oneOf(listOf( + Schema0::class.java, + Schema1::class.java + )) + ), NullSchemaValidator, BooleanSchemaValidator, NumberSchemaValidator, StringSchemaValidator, ListSchemaValidator, OneofComplexTypes1BoxedList>, MapSchemaValidator, OneofComplexTypes1BoxedMap> { + /* + NOTE: This class is auto generated by OpenAPI JSON Schema Generator. + Ref: https://github.com/openapi-json-schema-tools/openapi-json-schema-generator + + Do not edit the class manually. + */ + + companion object { + @Volatile + private var instance: OneofComplexTypes1? = null + + fun getInstance() = + instance ?: synchronized(this) { + instance ?: OneofComplexTypes1().also { instance = it } + } + } + + @Throws(ValidationException::class) + override fun validate(arg: Nothing?, configuration: SchemaConfiguration?): Nothing? { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validatedPathToSchemas = PathToSchemasMap() + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, LinkedHashSet()) + getPathToSchemas(this, castArg, validationMetadata, pathSet) + return castArg + } + + @Throws(ValidationException::class) + override fun validate(arg: Boolean, configuration: SchemaConfiguration?): Boolean { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validatedPathToSchemas = PathToSchemasMap() + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, LinkedHashSet()) + getPathToSchemas(this, castArg, validationMetadata, pathSet) + return castArg + } + + @Throws(ValidationException::class) + override fun validate(arg: Number, configuration: SchemaConfiguration?): Number { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validatedPathToSchemas = PathToSchemasMap() + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, LinkedHashSet()) + getPathToSchemas(this, castArg, validationMetadata, pathSet) + return castArg + } + + @Throws(ValidationException::class) + fun validate(arg: Int, configuration: SchemaConfiguration?): Int { + return validate(arg as Number, configuration) as Int + } + + @Throws(ValidationException::class) + fun validate(arg: Long, configuration: SchemaConfiguration?): Long { + return validate(arg as Number, configuration) as Long + } + + @Throws(ValidationException::class) + fun validate(arg: Float, configuration: SchemaConfiguration?): Float { + return validate(arg as Number, configuration) as Float + } + + @Throws(ValidationException::class) + fun validate(arg: Double, configuration: SchemaConfiguration?): Double { + return validate(arg as Number, configuration) as Double + } + + @Throws(ValidationException::class) + override fun validate(arg: String, configuration: SchemaConfiguration?): String { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validatedPathToSchemas = PathToSchemasMap() + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, LinkedHashSet()) + getPathToSchemas(this, castArg, validationMetadata, pathSet) + return castArg + } + + @Throws(ValidationException::class) + fun validate(arg: LocalDate, configuration: SchemaConfiguration?): String { + return validate(arg.toString(), configuration) + } + + @Throws(ValidationException::class) + fun validate(arg: ZonedDateTime, configuration: SchemaConfiguration?): String { + return validate(arg.toString(), configuration) + } + + @Throws(ValidationException::class) + fun validate(arg: UUID, configuration: SchemaConfiguration?): String { + return validate(arg.toString(), configuration) + } + + override fun getNewInstance(arg: List<*>, pathToItem: List, pathToSchemas: PathToSchemasMap): FrozenList { + val items: MutableList = ArrayList() + var i: Int = 0 + for (item: Any? in arg) { + val itemPathToItem = pathToItem + i + val schemas: LinkedHashMap, Nothing?>? = pathToSchemas.get(itemPathToItem) + if (schemas == null) { + throw RuntimeException("Validation result is invalid, schemas must exist for a pathToItem") + } + val itemSchema: JsonSchema<*> = schemas.entries.iterator().next().key + val itemInstance: Any? = itemSchema.getNewInstance(item, itemPathToItem, pathToSchemas) + items.add(itemInstance) + i += 1 + } + val newInstanceItems: FrozenList = FrozenList(items) + return newInstanceItems + } + + @Throws(ValidationException::class) + override fun validate(arg: List<*>, configuration: SchemaConfiguration?): FrozenList { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, PathToSchemasMap(), LinkedHashSet()) + val pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet) + return getNewInstance(castArg, validationMetadata.pathToItem, pathToSchemasMap) + } + + override fun getNewInstance(arg: Map<*, *>, pathToItem: List, pathToSchemas: PathToSchemasMap): FrozenMap { + val properties: LinkedHashMap = LinkedHashMap() + for((propertyName, value) in arg) { + if (!(propertyName is String)) { + throw RuntimeException("Invalid non-string key value") + } + val propertyPathToItem: List = pathToItem + propertyName + val schemas: LinkedHashMap, Nothing?>? = pathToSchemas.get(propertyPathToItem) + if (schemas == null) { + throw RuntimeException("Validation result is invalid, schemas must exist for a pathToItem") + } + val propertySchema: JsonSchema<*> = schemas.entries.iterator().next().key + val propertyInstance: Any? = propertySchema.getNewInstance(value, propertyPathToItem, pathToSchemas) + properties[propertyName] = propertyInstance + } + val castProperties: FrozenMap = FrozenMap(properties) + return castProperties + } + + @Throws(ValidationException::class) + override fun validate(arg: Map<*, *>, configuration: SchemaConfiguration?): FrozenMap { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validatedPathToSchemas = PathToSchemasMap() + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, LinkedHashSet()) + val pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet) + return getNewInstance(castArg, validationMetadata.pathToItem, pathToSchemasMap) + } + + @Throws(ValidationException::class) + override fun validate(arg: Any?, configuration: SchemaConfiguration?): Any? { + if (arg == null) { + return validate(null, configuration) + } else if (arg is Boolean) { + return validate(arg, configuration) + } else if (arg is Number) { + return validate(arg, configuration) + } else if (arg is String) { + return validate(arg, configuration) + } else if (arg is List<*>) { + return validate(arg, configuration) + } else if (arg is Map<*, *>) { + return validate(arg, configuration) + } + throw ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema") + } + override fun getNewInstance(arg: Any?, pathToItem: List, pathToSchemas: PathToSchemasMap): Any? { + if (arg == null) { + return getNewInstance( null, pathToItem, pathToSchemas) + } else if (arg is Boolean) { + return getNewInstance(arg, pathToItem, pathToSchemas) + } else if (arg is Number) { + return getNewInstance(arg, pathToItem, pathToSchemas) + } else if (arg is String) { + return getNewInstance(arg, pathToItem, pathToSchemas) + } else if (arg is List<*>) { + return getNewInstance(arg, pathToItem, pathToSchemas) + } else if (arg is Map<*, *>) { + return getNewInstance(arg, pathToItem, pathToSchemas) + } + throw RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema") + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: Nothing?, configuration: SchemaConfiguration?): OneofComplexTypes1BoxedVoid { + return OneofComplexTypes1BoxedVoid(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: Boolean, configuration: SchemaConfiguration?): OneofComplexTypes1BoxedBoolean { + return OneofComplexTypes1BoxedBoolean(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: Number, configuration: SchemaConfiguration?): OneofComplexTypes1BoxedNumber { + return OneofComplexTypes1BoxedNumber(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: String, configuration: SchemaConfiguration?): OneofComplexTypes1BoxedString { + return OneofComplexTypes1BoxedString(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: List<*>, configuration: SchemaConfiguration?): OneofComplexTypes1BoxedList { + return OneofComplexTypes1BoxedList(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: Map<*, *>, configuration: SchemaConfiguration?): OneofComplexTypes1BoxedMap { + return OneofComplexTypes1BoxedMap(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: Any?, configuration: SchemaConfiguration?): OneofComplexTypes1Boxed { + if (arg == null) { + return validateAndBox(null, configuration) + } else if (arg is Boolean) { + return validateAndBox(arg, configuration) + } else if (arg is String) { + return validateAndBox(arg, configuration) + } else if (arg is Number) { + return validateAndBox(arg, configuration) + } else if (arg is List<*>) { + return validateAndBox(arg, configuration) + } else if (arg is Map<*, *>) { + return validateAndBox(arg, configuration) + } + throw ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema") + } + } +} diff --git a/samples/client/3_1_0_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/schemas/OneofWithBaseSchema.kt b/samples/client/3_1_0_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/schemas/OneofWithBaseSchema.kt new file mode 100644 index 00000000000..d82112c6547 --- /dev/null +++ b/samples/client/3_1_0_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/schemas/OneofWithBaseSchema.kt @@ -0,0 +1,653 @@ +package org.openapijsonschematools.client.components.schemas +import java.time.LocalDate +import java.time.ZonedDateTime +import java.util.UUID +import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags +import org.openapijsonschematools.client.configurations.SchemaConfiguration +import org.openapijsonschematools.client.exceptions.InvalidAdditionalPropertyException +import org.openapijsonschematools.client.exceptions.UnsetPropertyException +import org.openapijsonschematools.client.exceptions.ValidationException +import org.openapijsonschematools.client.schemas.UnsetAddPropsSetter +import org.openapijsonschematools.client.schemas.validation.BooleanSchemaValidator +import org.openapijsonschematools.client.schemas.validation.FrozenList +import org.openapijsonschematools.client.schemas.validation.FrozenMap +import org.openapijsonschematools.client.schemas.validation.JsonSchema +import org.openapijsonschematools.client.schemas.validation.JsonSchemaInfo +import org.openapijsonschematools.client.schemas.validation.ListSchemaValidator +import org.openapijsonschematools.client.schemas.validation.MapSchemaValidator +import org.openapijsonschematools.client.schemas.validation.NullSchemaValidator +import org.openapijsonschematools.client.schemas.validation.NumberSchemaValidator +import org.openapijsonschematools.client.schemas.validation.PathToSchemasMap +import org.openapijsonschematools.client.schemas.validation.StringSchemaValidator +import org.openapijsonschematools.client.schemas.validation.ValidationMetadata + +class OneofWithBaseSchema { + // nest classes so all schemas and input/output classes can be public + + + sealed interface Schema0Boxed { + fun getData(): Any? + } + + data class Schema0BoxedVoid(val data: Nothing?) : Schema0Boxed { + override fun getData(): Any? { + return data + } + } + + data class Schema0BoxedBoolean(val data: Boolean): Schema0Boxed { + override fun getData(): Any? { + return data + } + } + + data class Schema0BoxedNumber(val data: Number) : Schema0Boxed { + override fun getData(): Any? { + return data + } + } + + data class Schema0BoxedString(val data: String) : Schema0Boxed { + override fun getData(): Any? { + return data + } + } + + data class Schema0BoxedList(val data: FrozenList) : Schema0Boxed { + override fun getData(): Any? { + return data + } + } + + data class Schema0BoxedMap(val data: FrozenMap) : Schema0Boxed { + override fun getData(): Any? { + return data + } + } + + + class Schema0 private constructor(): JsonSchema( + JsonSchemaInfo() + .minLength(2) + ), NullSchemaValidator, BooleanSchemaValidator, NumberSchemaValidator, StringSchemaValidator, ListSchemaValidator, Schema0BoxedList>, MapSchemaValidator, Schema0BoxedMap> { + + companion object { + @Volatile + private var instance: Schema0? = null + + fun getInstance() = + instance ?: synchronized(this) { + instance ?: Schema0().also { instance = it } + } + } + + @Throws(ValidationException::class) + override fun validate(arg: Nothing?, configuration: SchemaConfiguration?): Nothing? { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validatedPathToSchemas = PathToSchemasMap() + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, LinkedHashSet()) + getPathToSchemas(this, castArg, validationMetadata, pathSet) + return castArg + } + + @Throws(ValidationException::class) + override fun validate(arg: Boolean, configuration: SchemaConfiguration?): Boolean { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validatedPathToSchemas = PathToSchemasMap() + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, LinkedHashSet()) + getPathToSchemas(this, castArg, validationMetadata, pathSet) + return castArg + } + + @Throws(ValidationException::class) + override fun validate(arg: Number, configuration: SchemaConfiguration?): Number { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validatedPathToSchemas = PathToSchemasMap() + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, LinkedHashSet()) + getPathToSchemas(this, castArg, validationMetadata, pathSet) + return castArg + } + + @Throws(ValidationException::class) + fun validate(arg: Int, configuration: SchemaConfiguration?): Int { + return validate(arg as Number, configuration) as Int + } + + @Throws(ValidationException::class) + fun validate(arg: Long, configuration: SchemaConfiguration?): Long { + return validate(arg as Number, configuration) as Long + } + + @Throws(ValidationException::class) + fun validate(arg: Float, configuration: SchemaConfiguration?): Float { + return validate(arg as Number, configuration) as Float + } + + @Throws(ValidationException::class) + fun validate(arg: Double, configuration: SchemaConfiguration?): Double { + return validate(arg as Number, configuration) as Double + } + + @Throws(ValidationException::class) + override fun validate(arg: String, configuration: SchemaConfiguration?): String { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validatedPathToSchemas = PathToSchemasMap() + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, LinkedHashSet()) + getPathToSchemas(this, castArg, validationMetadata, pathSet) + return castArg + } + + @Throws(ValidationException::class) + fun validate(arg: LocalDate, configuration: SchemaConfiguration?): String { + return validate(arg.toString(), configuration) + } + + @Throws(ValidationException::class) + fun validate(arg: ZonedDateTime, configuration: SchemaConfiguration?): String { + return validate(arg.toString(), configuration) + } + + @Throws(ValidationException::class) + fun validate(arg: UUID, configuration: SchemaConfiguration?): String { + return validate(arg.toString(), configuration) + } + + override fun getNewInstance(arg: List<*>, pathToItem: List, pathToSchemas: PathToSchemasMap): FrozenList { + val items: MutableList = ArrayList() + var i: Int = 0 + for (item: Any? in arg) { + val itemPathToItem = pathToItem + i + val schemas: LinkedHashMap, Nothing?>? = pathToSchemas.get(itemPathToItem) + if (schemas == null) { + throw RuntimeException("Validation result is invalid, schemas must exist for a pathToItem") + } + val itemSchema: JsonSchema<*> = schemas.entries.iterator().next().key + val itemInstance: Any? = itemSchema.getNewInstance(item, itemPathToItem, pathToSchemas) + items.add(itemInstance) + i += 1 + } + val newInstanceItems: FrozenList = FrozenList(items) + return newInstanceItems + } + + @Throws(ValidationException::class) + override fun validate(arg: List<*>, configuration: SchemaConfiguration?): FrozenList { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, PathToSchemasMap(), LinkedHashSet()) + val pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet) + return getNewInstance(castArg, validationMetadata.pathToItem, pathToSchemasMap) + } + + override fun getNewInstance(arg: Map<*, *>, pathToItem: List, pathToSchemas: PathToSchemasMap): FrozenMap { + val properties: LinkedHashMap = LinkedHashMap() + for((propertyName, value) in arg) { + if (!(propertyName is String)) { + throw RuntimeException("Invalid non-string key value") + } + val propertyPathToItem: List = pathToItem + propertyName + val schemas: LinkedHashMap, Nothing?>? = pathToSchemas.get(propertyPathToItem) + if (schemas == null) { + throw RuntimeException("Validation result is invalid, schemas must exist for a pathToItem") + } + val propertySchema: JsonSchema<*> = schemas.entries.iterator().next().key + val propertyInstance: Any? = propertySchema.getNewInstance(value, propertyPathToItem, pathToSchemas) + properties[propertyName] = propertyInstance + } + val castProperties: FrozenMap = FrozenMap(properties) + return castProperties + } + + @Throws(ValidationException::class) + override fun validate(arg: Map<*, *>, configuration: SchemaConfiguration?): FrozenMap { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validatedPathToSchemas = PathToSchemasMap() + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, LinkedHashSet()) + val pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet) + return getNewInstance(castArg, validationMetadata.pathToItem, pathToSchemasMap) + } + + @Throws(ValidationException::class) + override fun validate(arg: Any?, configuration: SchemaConfiguration?): Any? { + if (arg == null) { + return validate(null, configuration) + } else if (arg is Boolean) { + return validate(arg, configuration) + } else if (arg is Number) { + return validate(arg, configuration) + } else if (arg is String) { + return validate(arg, configuration) + } else if (arg is List<*>) { + return validate(arg, configuration) + } else if (arg is Map<*, *>) { + return validate(arg, configuration) + } + throw ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema") + } + override fun getNewInstance(arg: Any?, pathToItem: List, pathToSchemas: PathToSchemasMap): Any? { + if (arg == null) { + return getNewInstance( null, pathToItem, pathToSchemas) + } else if (arg is Boolean) { + return getNewInstance(arg, pathToItem, pathToSchemas) + } else if (arg is Number) { + return getNewInstance(arg, pathToItem, pathToSchemas) + } else if (arg is String) { + return getNewInstance(arg, pathToItem, pathToSchemas) + } else if (arg is List<*>) { + return getNewInstance(arg, pathToItem, pathToSchemas) + } else if (arg is Map<*, *>) { + return getNewInstance(arg, pathToItem, pathToSchemas) + } + throw RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema") + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: Nothing?, configuration: SchemaConfiguration?): Schema0BoxedVoid { + return Schema0BoxedVoid(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: Boolean, configuration: SchemaConfiguration?): Schema0BoxedBoolean { + return Schema0BoxedBoolean(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: Number, configuration: SchemaConfiguration?): Schema0BoxedNumber { + return Schema0BoxedNumber(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: String, configuration: SchemaConfiguration?): Schema0BoxedString { + return Schema0BoxedString(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: List<*>, configuration: SchemaConfiguration?): Schema0BoxedList { + return Schema0BoxedList(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: Map<*, *>, configuration: SchemaConfiguration?): Schema0BoxedMap { + return Schema0BoxedMap(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: Any?, configuration: SchemaConfiguration?): Schema0Boxed { + if (arg == null) { + return validateAndBox(null, configuration) + } else if (arg is Boolean) { + return validateAndBox(arg, configuration) + } else if (arg is String) { + return validateAndBox(arg, configuration) + } else if (arg is Number) { + return validateAndBox(arg, configuration) + } else if (arg is List<*>) { + return validateAndBox(arg, configuration) + } else if (arg is Map<*, *>) { + return validateAndBox(arg, configuration) + } + throw ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema") + } + } + + sealed interface Schema1Boxed { + fun getData(): Any? + } + + data class Schema1BoxedVoid(val data: Nothing?) : Schema1Boxed { + override fun getData(): Any? { + return data + } + } + + data class Schema1BoxedBoolean(val data: Boolean): Schema1Boxed { + override fun getData(): Any? { + return data + } + } + + data class Schema1BoxedNumber(val data: Number) : Schema1Boxed { + override fun getData(): Any? { + return data + } + } + + data class Schema1BoxedString(val data: String) : Schema1Boxed { + override fun getData(): Any? { + return data + } + } + + data class Schema1BoxedList(val data: FrozenList) : Schema1Boxed { + override fun getData(): Any? { + return data + } + } + + data class Schema1BoxedMap(val data: FrozenMap) : Schema1Boxed { + override fun getData(): Any? { + return data + } + } + + + class Schema1 private constructor(): JsonSchema( + JsonSchemaInfo() + .maxLength(4) + ), NullSchemaValidator, BooleanSchemaValidator, NumberSchemaValidator, StringSchemaValidator, ListSchemaValidator, Schema1BoxedList>, MapSchemaValidator, Schema1BoxedMap> { + + companion object { + @Volatile + private var instance: Schema1? = null + + fun getInstance() = + instance ?: synchronized(this) { + instance ?: Schema1().also { instance = it } + } + } + + @Throws(ValidationException::class) + override fun validate(arg: Nothing?, configuration: SchemaConfiguration?): Nothing? { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validatedPathToSchemas = PathToSchemasMap() + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, LinkedHashSet()) + getPathToSchemas(this, castArg, validationMetadata, pathSet) + return castArg + } + + @Throws(ValidationException::class) + override fun validate(arg: Boolean, configuration: SchemaConfiguration?): Boolean { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validatedPathToSchemas = PathToSchemasMap() + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, LinkedHashSet()) + getPathToSchemas(this, castArg, validationMetadata, pathSet) + return castArg + } + + @Throws(ValidationException::class) + override fun validate(arg: Number, configuration: SchemaConfiguration?): Number { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validatedPathToSchemas = PathToSchemasMap() + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, LinkedHashSet()) + getPathToSchemas(this, castArg, validationMetadata, pathSet) + return castArg + } + + @Throws(ValidationException::class) + fun validate(arg: Int, configuration: SchemaConfiguration?): Int { + return validate(arg as Number, configuration) as Int + } + + @Throws(ValidationException::class) + fun validate(arg: Long, configuration: SchemaConfiguration?): Long { + return validate(arg as Number, configuration) as Long + } + + @Throws(ValidationException::class) + fun validate(arg: Float, configuration: SchemaConfiguration?): Float { + return validate(arg as Number, configuration) as Float + } + + @Throws(ValidationException::class) + fun validate(arg: Double, configuration: SchemaConfiguration?): Double { + return validate(arg as Number, configuration) as Double + } + + @Throws(ValidationException::class) + override fun validate(arg: String, configuration: SchemaConfiguration?): String { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validatedPathToSchemas = PathToSchemasMap() + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, LinkedHashSet()) + getPathToSchemas(this, castArg, validationMetadata, pathSet) + return castArg + } + + @Throws(ValidationException::class) + fun validate(arg: LocalDate, configuration: SchemaConfiguration?): String { + return validate(arg.toString(), configuration) + } + + @Throws(ValidationException::class) + fun validate(arg: ZonedDateTime, configuration: SchemaConfiguration?): String { + return validate(arg.toString(), configuration) + } + + @Throws(ValidationException::class) + fun validate(arg: UUID, configuration: SchemaConfiguration?): String { + return validate(arg.toString(), configuration) + } + + override fun getNewInstance(arg: List<*>, pathToItem: List, pathToSchemas: PathToSchemasMap): FrozenList { + val items: MutableList = ArrayList() + var i: Int = 0 + for (item: Any? in arg) { + val itemPathToItem = pathToItem + i + val schemas: LinkedHashMap, Nothing?>? = pathToSchemas.get(itemPathToItem) + if (schemas == null) { + throw RuntimeException("Validation result is invalid, schemas must exist for a pathToItem") + } + val itemSchema: JsonSchema<*> = schemas.entries.iterator().next().key + val itemInstance: Any? = itemSchema.getNewInstance(item, itemPathToItem, pathToSchemas) + items.add(itemInstance) + i += 1 + } + val newInstanceItems: FrozenList = FrozenList(items) + return newInstanceItems + } + + @Throws(ValidationException::class) + override fun validate(arg: List<*>, configuration: SchemaConfiguration?): FrozenList { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, PathToSchemasMap(), LinkedHashSet()) + val pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet) + return getNewInstance(castArg, validationMetadata.pathToItem, pathToSchemasMap) + } + + override fun getNewInstance(arg: Map<*, *>, pathToItem: List, pathToSchemas: PathToSchemasMap): FrozenMap { + val properties: LinkedHashMap = LinkedHashMap() + for((propertyName, value) in arg) { + if (!(propertyName is String)) { + throw RuntimeException("Invalid non-string key value") + } + val propertyPathToItem: List = pathToItem + propertyName + val schemas: LinkedHashMap, Nothing?>? = pathToSchemas.get(propertyPathToItem) + if (schemas == null) { + throw RuntimeException("Validation result is invalid, schemas must exist for a pathToItem") + } + val propertySchema: JsonSchema<*> = schemas.entries.iterator().next().key + val propertyInstance: Any? = propertySchema.getNewInstance(value, propertyPathToItem, pathToSchemas) + properties[propertyName] = propertyInstance + } + val castProperties: FrozenMap = FrozenMap(properties) + return castProperties + } + + @Throws(ValidationException::class) + override fun validate(arg: Map<*, *>, configuration: SchemaConfiguration?): FrozenMap { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validatedPathToSchemas = PathToSchemasMap() + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, LinkedHashSet()) + val pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet) + return getNewInstance(castArg, validationMetadata.pathToItem, pathToSchemasMap) + } + + @Throws(ValidationException::class) + override fun validate(arg: Any?, configuration: SchemaConfiguration?): Any? { + if (arg == null) { + return validate(null, configuration) + } else if (arg is Boolean) { + return validate(arg, configuration) + } else if (arg is Number) { + return validate(arg, configuration) + } else if (arg is String) { + return validate(arg, configuration) + } else if (arg is List<*>) { + return validate(arg, configuration) + } else if (arg is Map<*, *>) { + return validate(arg, configuration) + } + throw ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema") + } + override fun getNewInstance(arg: Any?, pathToItem: List, pathToSchemas: PathToSchemasMap): Any? { + if (arg == null) { + return getNewInstance( null, pathToItem, pathToSchemas) + } else if (arg is Boolean) { + return getNewInstance(arg, pathToItem, pathToSchemas) + } else if (arg is Number) { + return getNewInstance(arg, pathToItem, pathToSchemas) + } else if (arg is String) { + return getNewInstance(arg, pathToItem, pathToSchemas) + } else if (arg is List<*>) { + return getNewInstance(arg, pathToItem, pathToSchemas) + } else if (arg is Map<*, *>) { + return getNewInstance(arg, pathToItem, pathToSchemas) + } + throw RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema") + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: Nothing?, configuration: SchemaConfiguration?): Schema1BoxedVoid { + return Schema1BoxedVoid(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: Boolean, configuration: SchemaConfiguration?): Schema1BoxedBoolean { + return Schema1BoxedBoolean(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: Number, configuration: SchemaConfiguration?): Schema1BoxedNumber { + return Schema1BoxedNumber(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: String, configuration: SchemaConfiguration?): Schema1BoxedString { + return Schema1BoxedString(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: List<*>, configuration: SchemaConfiguration?): Schema1BoxedList { + return Schema1BoxedList(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: Map<*, *>, configuration: SchemaConfiguration?): Schema1BoxedMap { + return Schema1BoxedMap(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: Any?, configuration: SchemaConfiguration?): Schema1Boxed { + if (arg == null) { + return validateAndBox(null, configuration) + } else if (arg is Boolean) { + return validateAndBox(arg, configuration) + } else if (arg is String) { + return validateAndBox(arg, configuration) + } else if (arg is Number) { + return validateAndBox(arg, configuration) + } else if (arg is List<*>) { + return validateAndBox(arg, configuration) + } else if (arg is Map<*, *>) { + return validateAndBox(arg, configuration) + } + throw ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema") + } + } + + sealed interface OneofWithBaseSchema1Boxed { + fun getData(): Any? + } + + data class OneofWithBaseSchema1BoxedString(val data: String) : OneofWithBaseSchema1Boxed { + override fun getData(): Any? { + return data + } + } + + + + class OneofWithBaseSchema1 private constructor(): JsonSchema( + JsonSchemaInfo() + .type(setOf( + String::class.java + )) + .oneOf(listOf( + Schema0::class.java, + Schema1::class.java + )) + ), StringSchemaValidator { + /* + NOTE: This class is auto generated by OpenAPI JSON Schema Generator. + Ref: https://github.com/openapi-json-schema-tools/openapi-json-schema-generator + + Do not edit the class manually. + */ + + companion object { + @Volatile + private var instance: OneofWithBaseSchema1? = null + + fun getInstance() = + instance ?: synchronized(this) { + instance ?: OneofWithBaseSchema1().also { instance = it } + } + } + + @Throws(ValidationException::class) + override fun validate(arg: String, configuration: SchemaConfiguration?): String { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, PathToSchemasMap(), LinkedHashSet()) + getPathToSchemas(this, castArg, validationMetadata, pathSet) + return castArg + } + + @Throws(ValidationException::class) + override fun validate(arg: Any?, configuration: SchemaConfiguration?): Any? { + if (arg is String) { + return validate(arg, configuration) + } + throw ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema") + } + override fun getNewInstance(arg: Any?, pathToItem: List, pathToSchemas: PathToSchemasMap): Any? { + if (arg is String) { + return getNewInstance(arg, pathToItem, pathToSchemas) + } + throw RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema") + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: String, configuration: SchemaConfiguration?): OneofWithBaseSchema1BoxedString { + return OneofWithBaseSchema1BoxedString(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: Any?, configuration: SchemaConfiguration?): OneofWithBaseSchema1Boxed { + if (arg is String) { + return validateAndBox(arg, configuration) + } + throw ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema") + } + } +} diff --git a/samples/client/3_1_0_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/schemas/OneofWithEmptySchema.kt b/samples/client/3_1_0_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/schemas/OneofWithEmptySchema.kt new file mode 100644 index 00000000000..06241abdcdd --- /dev/null +++ b/samples/client/3_1_0_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/schemas/OneofWithEmptySchema.kt @@ -0,0 +1,339 @@ +package org.openapijsonschematools.client.components.schemas +import java.time.LocalDate +import java.time.ZonedDateTime +import java.util.UUID +import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags +import org.openapijsonschematools.client.configurations.SchemaConfiguration +import org.openapijsonschematools.client.exceptions.InvalidAdditionalPropertyException +import org.openapijsonschematools.client.exceptions.UnsetPropertyException +import org.openapijsonschematools.client.exceptions.ValidationException +import org.openapijsonschematools.client.schemas.AnyTypeJsonSchema +import org.openapijsonschematools.client.schemas.NumberJsonSchema +import org.openapijsonschematools.client.schemas.UnsetAddPropsSetter +import org.openapijsonschematools.client.schemas.validation.BooleanSchemaValidator +import org.openapijsonschematools.client.schemas.validation.FrozenList +import org.openapijsonschematools.client.schemas.validation.FrozenMap +import org.openapijsonschematools.client.schemas.validation.JsonSchema +import org.openapijsonschematools.client.schemas.validation.JsonSchemaInfo +import org.openapijsonschematools.client.schemas.validation.ListSchemaValidator +import org.openapijsonschematools.client.schemas.validation.MapSchemaValidator +import org.openapijsonschematools.client.schemas.validation.NullSchemaValidator +import org.openapijsonschematools.client.schemas.validation.NumberSchemaValidator +import org.openapijsonschematools.client.schemas.validation.PathToSchemasMap +import org.openapijsonschematools.client.schemas.validation.StringSchemaValidator +import org.openapijsonschematools.client.schemas.validation.ValidationMetadata + +class OneofWithEmptySchema { + // nest classes so all schemas and input/output classes can be public + + + class Schema0 : NumberJsonSchema.NumberJsonSchema1() { + companion object { + @Volatile + private var instance: Schema0? = null + + fun getInstance() = + instance ?: synchronized(this) { + instance ?: Schema0().also { instance = it } + } + } + } + + + class Schema1 : AnyTypeJsonSchema.AnyTypeJsonSchema1() { + companion object { + @Volatile + private var instance: Schema1? = null + + fun getInstance() = + instance ?: synchronized(this) { + instance ?: Schema1().also { instance = it } + } + } + } + + + sealed interface OneofWithEmptySchema1Boxed { + fun getData(): Any? + } + + data class OneofWithEmptySchema1BoxedVoid(val data: Nothing?) : OneofWithEmptySchema1Boxed { + override fun getData(): Any? { + return data + } + } + + data class OneofWithEmptySchema1BoxedBoolean(val data: Boolean): OneofWithEmptySchema1Boxed { + override fun getData(): Any? { + return data + } + } + + data class OneofWithEmptySchema1BoxedNumber(val data: Number) : OneofWithEmptySchema1Boxed { + override fun getData(): Any? { + return data + } + } + + data class OneofWithEmptySchema1BoxedString(val data: String) : OneofWithEmptySchema1Boxed { + override fun getData(): Any? { + return data + } + } + + data class OneofWithEmptySchema1BoxedList(val data: FrozenList) : OneofWithEmptySchema1Boxed { + override fun getData(): Any? { + return data + } + } + + data class OneofWithEmptySchema1BoxedMap(val data: FrozenMap) : OneofWithEmptySchema1Boxed { + override fun getData(): Any? { + return data + } + } + + + class OneofWithEmptySchema1 private constructor(): JsonSchema( + JsonSchemaInfo() + .oneOf(listOf( + Schema0::class.java, + Schema1::class.java + )) + ), NullSchemaValidator, BooleanSchemaValidator, NumberSchemaValidator, StringSchemaValidator, ListSchemaValidator, OneofWithEmptySchema1BoxedList>, MapSchemaValidator, OneofWithEmptySchema1BoxedMap> { + /* + NOTE: This class is auto generated by OpenAPI JSON Schema Generator. + Ref: https://github.com/openapi-json-schema-tools/openapi-json-schema-generator + + Do not edit the class manually. + */ + + companion object { + @Volatile + private var instance: OneofWithEmptySchema1? = null + + fun getInstance() = + instance ?: synchronized(this) { + instance ?: OneofWithEmptySchema1().also { instance = it } + } + } + + @Throws(ValidationException::class) + override fun validate(arg: Nothing?, configuration: SchemaConfiguration?): Nothing? { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validatedPathToSchemas = PathToSchemasMap() + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, LinkedHashSet()) + getPathToSchemas(this, castArg, validationMetadata, pathSet) + return castArg + } + + @Throws(ValidationException::class) + override fun validate(arg: Boolean, configuration: SchemaConfiguration?): Boolean { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validatedPathToSchemas = PathToSchemasMap() + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, LinkedHashSet()) + getPathToSchemas(this, castArg, validationMetadata, pathSet) + return castArg + } + + @Throws(ValidationException::class) + override fun validate(arg: Number, configuration: SchemaConfiguration?): Number { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validatedPathToSchemas = PathToSchemasMap() + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, LinkedHashSet()) + getPathToSchemas(this, castArg, validationMetadata, pathSet) + return castArg + } + + @Throws(ValidationException::class) + fun validate(arg: Int, configuration: SchemaConfiguration?): Int { + return validate(arg as Number, configuration) as Int + } + + @Throws(ValidationException::class) + fun validate(arg: Long, configuration: SchemaConfiguration?): Long { + return validate(arg as Number, configuration) as Long + } + + @Throws(ValidationException::class) + fun validate(arg: Float, configuration: SchemaConfiguration?): Float { + return validate(arg as Number, configuration) as Float + } + + @Throws(ValidationException::class) + fun validate(arg: Double, configuration: SchemaConfiguration?): Double { + return validate(arg as Number, configuration) as Double + } + + @Throws(ValidationException::class) + override fun validate(arg: String, configuration: SchemaConfiguration?): String { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validatedPathToSchemas = PathToSchemasMap() + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, LinkedHashSet()) + getPathToSchemas(this, castArg, validationMetadata, pathSet) + return castArg + } + + @Throws(ValidationException::class) + fun validate(arg: LocalDate, configuration: SchemaConfiguration?): String { + return validate(arg.toString(), configuration) + } + + @Throws(ValidationException::class) + fun validate(arg: ZonedDateTime, configuration: SchemaConfiguration?): String { + return validate(arg.toString(), configuration) + } + + @Throws(ValidationException::class) + fun validate(arg: UUID, configuration: SchemaConfiguration?): String { + return validate(arg.toString(), configuration) + } + + override fun getNewInstance(arg: List<*>, pathToItem: List, pathToSchemas: PathToSchemasMap): FrozenList { + val items: MutableList = ArrayList() + var i: Int = 0 + for (item: Any? in arg) { + val itemPathToItem = pathToItem + i + val schemas: LinkedHashMap, Nothing?>? = pathToSchemas.get(itemPathToItem) + if (schemas == null) { + throw RuntimeException("Validation result is invalid, schemas must exist for a pathToItem") + } + val itemSchema: JsonSchema<*> = schemas.entries.iterator().next().key + val itemInstance: Any? = itemSchema.getNewInstance(item, itemPathToItem, pathToSchemas) + items.add(itemInstance) + i += 1 + } + val newInstanceItems: FrozenList = FrozenList(items) + return newInstanceItems + } + + @Throws(ValidationException::class) + override fun validate(arg: List<*>, configuration: SchemaConfiguration?): FrozenList { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, PathToSchemasMap(), LinkedHashSet()) + val pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet) + return getNewInstance(castArg, validationMetadata.pathToItem, pathToSchemasMap) + } + + override fun getNewInstance(arg: Map<*, *>, pathToItem: List, pathToSchemas: PathToSchemasMap): FrozenMap { + val properties: LinkedHashMap = LinkedHashMap() + for((propertyName, value) in arg) { + if (!(propertyName is String)) { + throw RuntimeException("Invalid non-string key value") + } + val propertyPathToItem: List = pathToItem + propertyName + val schemas: LinkedHashMap, Nothing?>? = pathToSchemas.get(propertyPathToItem) + if (schemas == null) { + throw RuntimeException("Validation result is invalid, schemas must exist for a pathToItem") + } + val propertySchema: JsonSchema<*> = schemas.entries.iterator().next().key + val propertyInstance: Any? = propertySchema.getNewInstance(value, propertyPathToItem, pathToSchemas) + properties[propertyName] = propertyInstance + } + val castProperties: FrozenMap = FrozenMap(properties) + return castProperties + } + + @Throws(ValidationException::class) + override fun validate(arg: Map<*, *>, configuration: SchemaConfiguration?): FrozenMap { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validatedPathToSchemas = PathToSchemasMap() + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, LinkedHashSet()) + val pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet) + return getNewInstance(castArg, validationMetadata.pathToItem, pathToSchemasMap) + } + + @Throws(ValidationException::class) + override fun validate(arg: Any?, configuration: SchemaConfiguration?): Any? { + if (arg == null) { + return validate(null, configuration) + } else if (arg is Boolean) { + return validate(arg, configuration) + } else if (arg is Number) { + return validate(arg, configuration) + } else if (arg is String) { + return validate(arg, configuration) + } else if (arg is List<*>) { + return validate(arg, configuration) + } else if (arg is Map<*, *>) { + return validate(arg, configuration) + } + throw ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema") + } + override fun getNewInstance(arg: Any?, pathToItem: List, pathToSchemas: PathToSchemasMap): Any? { + if (arg == null) { + return getNewInstance( null, pathToItem, pathToSchemas) + } else if (arg is Boolean) { + return getNewInstance(arg, pathToItem, pathToSchemas) + } else if (arg is Number) { + return getNewInstance(arg, pathToItem, pathToSchemas) + } else if (arg is String) { + return getNewInstance(arg, pathToItem, pathToSchemas) + } else if (arg is List<*>) { + return getNewInstance(arg, pathToItem, pathToSchemas) + } else if (arg is Map<*, *>) { + return getNewInstance(arg, pathToItem, pathToSchemas) + } + throw RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema") + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: Nothing?, configuration: SchemaConfiguration?): OneofWithEmptySchema1BoxedVoid { + return OneofWithEmptySchema1BoxedVoid(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: Boolean, configuration: SchemaConfiguration?): OneofWithEmptySchema1BoxedBoolean { + return OneofWithEmptySchema1BoxedBoolean(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: Number, configuration: SchemaConfiguration?): OneofWithEmptySchema1BoxedNumber { + return OneofWithEmptySchema1BoxedNumber(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: String, configuration: SchemaConfiguration?): OneofWithEmptySchema1BoxedString { + return OneofWithEmptySchema1BoxedString(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: List<*>, configuration: SchemaConfiguration?): OneofWithEmptySchema1BoxedList { + return OneofWithEmptySchema1BoxedList(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: Map<*, *>, configuration: SchemaConfiguration?): OneofWithEmptySchema1BoxedMap { + return OneofWithEmptySchema1BoxedMap(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: Any?, configuration: SchemaConfiguration?): OneofWithEmptySchema1Boxed { + if (arg == null) { + return validateAndBox(null, configuration) + } else if (arg is Boolean) { + return validateAndBox(arg, configuration) + } else if (arg is String) { + return validateAndBox(arg, configuration) + } else if (arg is Number) { + return validateAndBox(arg, configuration) + } else if (arg is List<*>) { + return validateAndBox(arg, configuration) + } else if (arg is Map<*, *>) { + return validateAndBox(arg, configuration) + } + throw ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema") + } + } +} diff --git a/samples/client/3_1_0_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/schemas/OneofWithRequired.kt b/samples/client/3_1_0_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/schemas/OneofWithRequired.kt new file mode 100644 index 00000000000..163cebccec9 --- /dev/null +++ b/samples/client/3_1_0_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/schemas/OneofWithRequired.kt @@ -0,0 +1,1096 @@ +package org.openapijsonschematools.client.components.schemas +import java.time.LocalDate +import java.time.ZonedDateTime +import java.util.UUID +import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags +import org.openapijsonschematools.client.configurations.SchemaConfiguration +import org.openapijsonschematools.client.exceptions.InvalidAdditionalPropertyException +import org.openapijsonschematools.client.exceptions.UnsetPropertyException +import org.openapijsonschematools.client.exceptions.ValidationException +import org.openapijsonschematools.client.schemas.GenericBuilder +import org.openapijsonschematools.client.schemas.UnsetAddPropsSetter +import org.openapijsonschematools.client.schemas.validation.BooleanSchemaValidator +import org.openapijsonschematools.client.schemas.validation.FrozenList +import org.openapijsonschematools.client.schemas.validation.FrozenMap +import org.openapijsonschematools.client.schemas.validation.JsonSchema +import org.openapijsonschematools.client.schemas.validation.JsonSchemaInfo +import org.openapijsonschematools.client.schemas.validation.ListSchemaValidator +import org.openapijsonschematools.client.schemas.validation.MapSchemaValidator +import org.openapijsonschematools.client.schemas.validation.NullSchemaValidator +import org.openapijsonschematools.client.schemas.validation.NumberSchemaValidator +import org.openapijsonschematools.client.schemas.validation.PathToSchemasMap +import org.openapijsonschematools.client.schemas.validation.StringSchemaValidator +import org.openapijsonschematools.client.schemas.validation.ValidationMetadata + +class OneofWithRequired { + // nest classes so all schemas and input/output classes can be public + + + class Schema0Map(m: FrozenMap) : FrozenMap(m) { + companion object { + val requiredKeys: Set = setOf( + "bar", + "foo" + ) + val optionalKeys: Set = setOf() + @Throws(ValidationException::class) + fun of(arg: Map, configuration: SchemaConfiguration): Schema0Map { + return Schema0.getInstance().validate(arg, configuration) + } + } + + fun bar(): Any? { + try { + return getOrThrow("version") + } catch (e: UnsetPropertyException) { + throw RuntimeException(e) + } + } + + fun foo(): Any? { + try { + return getOrThrow("version") + } catch (e: UnsetPropertyException) { + throw RuntimeException(e) + } + } + + @Throws(UnsetPropertyException::class, InvalidAdditionalPropertyException::class) + fun getAdditionalProperty(name: String): Any? { + throwIfKeyKnown(name, requiredKeys, optionalKeys) + throwIfKeyNotPresent(name) + return get(name) + } + } + + interface SetterForBar { + fun getInstance(): MutableMap + fun getBuilderAfterBar(instance: MutableMap): T + + fun bar(value: Nothing?): T { + val instance = getInstance() + instance["bar"] = null + return getBuilderAfterBar(instance) + } + + fun bar(value: Boolean): T { + val instance = getInstance() + instance["bar"] = value + return getBuilderAfterBar(instance) + } + + fun bar(value: String): T { + val instance = getInstance() + instance["bar"] = value + return getBuilderAfterBar(instance) + } + + fun bar(value: Int): T { + val instance = getInstance() + instance["bar"] = value + return getBuilderAfterBar(instance) + } + + fun bar(value: Float): T { + val instance = getInstance() + instance["bar"] = value + return getBuilderAfterBar(instance) + } + + fun bar(value: Long): T { + val instance = getInstance() + instance["bar"] = value + return getBuilderAfterBar(instance) + } + + fun bar(value: Double): T { + val instance = getInstance() + instance["bar"] = value + return getBuilderAfterBar(instance) + } + + fun bar(value: List): T { + val instance = getInstance() + instance["bar"] = value + return getBuilderAfterBar(instance) + } + + fun bar(value: Map): T { + val instance = getInstance() + instance["bar"] = value + return getBuilderAfterBar(instance) + } + } + + interface SetterForFoo { + fun getInstance(): MutableMap + fun getBuilderAfterFoo(instance: MutableMap): T + + fun foo(value: Nothing?): T { + val instance = getInstance() + instance["foo"] = null + return getBuilderAfterFoo(instance) + } + + fun foo(value: Boolean): T { + val instance = getInstance() + instance["foo"] = value + return getBuilderAfterFoo(instance) + } + + fun foo(value: String): T { + val instance = getInstance() + instance["foo"] = value + return getBuilderAfterFoo(instance) + } + + fun foo(value: Int): T { + val instance = getInstance() + instance["foo"] = value + return getBuilderAfterFoo(instance) + } + + fun foo(value: Float): T { + val instance = getInstance() + instance["foo"] = value + return getBuilderAfterFoo(instance) + } + + fun foo(value: Long): T { + val instance = getInstance() + instance["foo"] = value + return getBuilderAfterFoo(instance) + } + + fun foo(value: Double): T { + val instance = getInstance() + instance["foo"] = value + return getBuilderAfterFoo(instance) + } + + fun foo(value: List): T { + val instance = getInstance() + instance["foo"] = value + return getBuilderAfterFoo(instance) + } + + fun foo(value: Map): T { + val instance = getInstance() + instance["foo"] = value + return getBuilderAfterFoo(instance) + } + } + + class Schema0Map00Builder(private val instance: MutableMap): UnsetAddPropsSetter, GenericBuilder> { + private val knownKeys: Set = setOf( + "bar", + "foo" + ) + override fun getKnownKeys(): Set { + return knownKeys + } + override fun build(): Map { + return instance + } + override fun getInstance(): MutableMap { + return instance + } + override fun getBuilderAfterAdditionalProperty(instance: MutableMap): Schema0Map00Builder { + return this + } + } + + class Schema0Map01Builder(private val instance: MutableMap): SetterForFoo { + override fun getInstance(): MutableMap { + return instance + } + override fun getBuilderAfterFoo(instance: MutableMap): Schema0Map00Builder { + return Schema0Map00Builder(instance) + } + } + + class Schema0Map10Builder(private val instance: MutableMap): SetterForBar { + override fun getInstance(): MutableMap { + return instance + } + override fun getBuilderAfterBar(instance: MutableMap): Schema0Map00Builder { + return Schema0Map00Builder(instance) + } + } + + class Schema0MapBuilder: SetterForBar, SetterForFoo { + private val instance: MutableMap + init { + this.instance = LinkedHashMap() + } + override fun getInstance(): MutableMap { + return instance + } + override fun getBuilderAfterBar(instance: MutableMap): Schema0Map01Builder { + return Schema0Map01Builder(instance) + } + override fun getBuilderAfterFoo(instance: MutableMap): Schema0Map10Builder { + return Schema0Map10Builder(instance) + } + } + + + sealed interface Schema0Boxed { + fun getData(): Any? + } + + data class Schema0BoxedVoid(val data: Nothing?) : Schema0Boxed { + override fun getData(): Any? { + return data + } + } + + data class Schema0BoxedBoolean(val data: Boolean): Schema0Boxed { + override fun getData(): Any? { + return data + } + } + + data class Schema0BoxedNumber(val data: Number) : Schema0Boxed { + override fun getData(): Any? { + return data + } + } + + data class Schema0BoxedString(val data: String) : Schema0Boxed { + override fun getData(): Any? { + return data + } + } + + data class Schema0BoxedList(val data: FrozenList) : Schema0Boxed { + override fun getData(): Any? { + return data + } + } + + data class Schema0BoxedMap(val data: Schema0Map) : Schema0Boxed { + override fun getData(): Any? { + return data + } + } + + + class Schema0 private constructor(): JsonSchema( + JsonSchemaInfo() + .required(setOf( + "bar", + "foo" + )) + ), NullSchemaValidator, BooleanSchemaValidator, NumberSchemaValidator, StringSchemaValidator, ListSchemaValidator, Schema0BoxedList>, MapSchemaValidator { + + companion object { + @Volatile + private var instance: Schema0? = null + + fun getInstance() = + instance ?: synchronized(this) { + instance ?: Schema0().also { instance = it } + } + } + + @Throws(ValidationException::class) + override fun validate(arg: Nothing?, configuration: SchemaConfiguration?): Nothing? { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validatedPathToSchemas = PathToSchemasMap() + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, LinkedHashSet()) + getPathToSchemas(this, castArg, validationMetadata, pathSet) + return castArg + } + + @Throws(ValidationException::class) + override fun validate(arg: Boolean, configuration: SchemaConfiguration?): Boolean { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validatedPathToSchemas = PathToSchemasMap() + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, LinkedHashSet()) + getPathToSchemas(this, castArg, validationMetadata, pathSet) + return castArg + } + + @Throws(ValidationException::class) + override fun validate(arg: Number, configuration: SchemaConfiguration?): Number { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validatedPathToSchemas = PathToSchemasMap() + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, LinkedHashSet()) + getPathToSchemas(this, castArg, validationMetadata, pathSet) + return castArg + } + + @Throws(ValidationException::class) + fun validate(arg: Int, configuration: SchemaConfiguration?): Int { + return validate(arg as Number, configuration) as Int + } + + @Throws(ValidationException::class) + fun validate(arg: Long, configuration: SchemaConfiguration?): Long { + return validate(arg as Number, configuration) as Long + } + + @Throws(ValidationException::class) + fun validate(arg: Float, configuration: SchemaConfiguration?): Float { + return validate(arg as Number, configuration) as Float + } + + @Throws(ValidationException::class) + fun validate(arg: Double, configuration: SchemaConfiguration?): Double { + return validate(arg as Number, configuration) as Double + } + + @Throws(ValidationException::class) + override fun validate(arg: String, configuration: SchemaConfiguration?): String { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validatedPathToSchemas = PathToSchemasMap() + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, LinkedHashSet()) + getPathToSchemas(this, castArg, validationMetadata, pathSet) + return castArg + } + + @Throws(ValidationException::class) + fun validate(arg: LocalDate, configuration: SchemaConfiguration?): String { + return validate(arg.toString(), configuration) + } + + @Throws(ValidationException::class) + fun validate(arg: ZonedDateTime, configuration: SchemaConfiguration?): String { + return validate(arg.toString(), configuration) + } + + @Throws(ValidationException::class) + fun validate(arg: UUID, configuration: SchemaConfiguration?): String { + return validate(arg.toString(), configuration) + } + + override fun getNewInstance(arg: List<*>, pathToItem: List, pathToSchemas: PathToSchemasMap): FrozenList { + val items: MutableList = ArrayList() + var i: Int = 0 + for (item: Any? in arg) { + val itemPathToItem = pathToItem + i + val schemas: LinkedHashMap, Nothing?>? = pathToSchemas.get(itemPathToItem) + if (schemas == null) { + throw RuntimeException("Validation result is invalid, schemas must exist for a pathToItem") + } + val itemSchema: JsonSchema<*> = schemas.entries.iterator().next().key + val itemInstance: Any? = itemSchema.getNewInstance(item, itemPathToItem, pathToSchemas) + items.add(itemInstance) + i += 1 + } + val newInstanceItems: FrozenList = FrozenList(items) + return newInstanceItems + } + + @Throws(ValidationException::class) + override fun validate(arg: List<*>, configuration: SchemaConfiguration?): FrozenList { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, PathToSchemasMap(), LinkedHashSet()) + val pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet) + return getNewInstance(castArg, validationMetadata.pathToItem, pathToSchemasMap) + } + + override fun getNewInstance(arg: Map<*, *>, pathToItem: List, pathToSchemas: PathToSchemasMap): Schema0Map { + val properties: LinkedHashMap = LinkedHashMap() + for((propertyName, value) in arg) { + if (!(propertyName is String)) { + throw RuntimeException("Invalid non-string key value") + } + val propertyPathToItem: List = pathToItem + propertyName + val schemas: LinkedHashMap, Nothing?>? = pathToSchemas.get(propertyPathToItem) + if (schemas == null) { + throw RuntimeException("Validation result is invalid, schemas must exist for a pathToItem") + } + val propertySchema: JsonSchema<*> = schemas.entries.iterator().next().key + val propertyInstance: Any? = propertySchema.getNewInstance(value, propertyPathToItem, pathToSchemas) + properties[propertyName] = propertyInstance + } + val castProperties: FrozenMap = FrozenMap(properties) + return Schema0Map(castProperties) + } + + @Throws(ValidationException::class) + override fun validate(arg: Map<*, *>, configuration: SchemaConfiguration?): Schema0Map { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validatedPathToSchemas = PathToSchemasMap() + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, LinkedHashSet()) + val pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet) + return getNewInstance(castArg, validationMetadata.pathToItem, pathToSchemasMap) + } + + @Throws(ValidationException::class) + override fun validate(arg: Any?, configuration: SchemaConfiguration?): Any? { + if (arg == null) { + return validate(null, configuration) + } else if (arg is Boolean) { + return validate(arg, configuration) + } else if (arg is Number) { + return validate(arg, configuration) + } else if (arg is String) { + return validate(arg, configuration) + } else if (arg is List<*>) { + return validate(arg, configuration) + } else if (arg is Map<*, *>) { + return validate(arg, configuration) + } + throw ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema") + } + override fun getNewInstance(arg: Any?, pathToItem: List, pathToSchemas: PathToSchemasMap): Any? { + if (arg == null) { + return getNewInstance( null, pathToItem, pathToSchemas) + } else if (arg is Boolean) { + return getNewInstance(arg, pathToItem, pathToSchemas) + } else if (arg is Number) { + return getNewInstance(arg, pathToItem, pathToSchemas) + } else if (arg is String) { + return getNewInstance(arg, pathToItem, pathToSchemas) + } else if (arg is List<*>) { + return getNewInstance(arg, pathToItem, pathToSchemas) + } else if (arg is Map<*, *>) { + return getNewInstance(arg, pathToItem, pathToSchemas) + } + throw RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema") + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: Nothing?, configuration: SchemaConfiguration?): Schema0BoxedVoid { + return Schema0BoxedVoid(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: Boolean, configuration: SchemaConfiguration?): Schema0BoxedBoolean { + return Schema0BoxedBoolean(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: Number, configuration: SchemaConfiguration?): Schema0BoxedNumber { + return Schema0BoxedNumber(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: String, configuration: SchemaConfiguration?): Schema0BoxedString { + return Schema0BoxedString(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: List<*>, configuration: SchemaConfiguration?): Schema0BoxedList { + return Schema0BoxedList(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: Map<*, *>, configuration: SchemaConfiguration?): Schema0BoxedMap { + return Schema0BoxedMap(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: Any?, configuration: SchemaConfiguration?): Schema0Boxed { + if (arg == null) { + return validateAndBox(null, configuration) + } else if (arg is Boolean) { + return validateAndBox(arg, configuration) + } else if (arg is String) { + return validateAndBox(arg, configuration) + } else if (arg is Number) { + return validateAndBox(arg, configuration) + } else if (arg is List<*>) { + return validateAndBox(arg, configuration) + } else if (arg is Map<*, *>) { + return validateAndBox(arg, configuration) + } + throw ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema") + } + } + + class Schema1Map(m: FrozenMap) : FrozenMap(m) { + companion object { + val requiredKeys: Set = setOf( + "baz", + "foo" + ) + val optionalKeys: Set = setOf() + @Throws(ValidationException::class) + fun of(arg: Map, configuration: SchemaConfiguration): Schema1Map { + return Schema1.getInstance().validate(arg, configuration) + } + } + + fun baz(): Any? { + try { + return getOrThrow("version") + } catch (e: UnsetPropertyException) { + throw RuntimeException(e) + } + } + + fun foo(): Any? { + try { + return getOrThrow("version") + } catch (e: UnsetPropertyException) { + throw RuntimeException(e) + } + } + + @Throws(UnsetPropertyException::class, InvalidAdditionalPropertyException::class) + fun getAdditionalProperty(name: String): Any? { + throwIfKeyKnown(name, requiredKeys, optionalKeys) + throwIfKeyNotPresent(name) + return get(name) + } + } + + interface SetterForBaz { + fun getInstance(): MutableMap + fun getBuilderAfterBaz(instance: MutableMap): T + + fun baz(value: Nothing?): T { + val instance = getInstance() + instance["baz"] = null + return getBuilderAfterBaz(instance) + } + + fun baz(value: Boolean): T { + val instance = getInstance() + instance["baz"] = value + return getBuilderAfterBaz(instance) + } + + fun baz(value: String): T { + val instance = getInstance() + instance["baz"] = value + return getBuilderAfterBaz(instance) + } + + fun baz(value: Int): T { + val instance = getInstance() + instance["baz"] = value + return getBuilderAfterBaz(instance) + } + + fun baz(value: Float): T { + val instance = getInstance() + instance["baz"] = value + return getBuilderAfterBaz(instance) + } + + fun baz(value: Long): T { + val instance = getInstance() + instance["baz"] = value + return getBuilderAfterBaz(instance) + } + + fun baz(value: Double): T { + val instance = getInstance() + instance["baz"] = value + return getBuilderAfterBaz(instance) + } + + fun baz(value: List): T { + val instance = getInstance() + instance["baz"] = value + return getBuilderAfterBaz(instance) + } + + fun baz(value: Map): T { + val instance = getInstance() + instance["baz"] = value + return getBuilderAfterBaz(instance) + } + } + + interface SetterForFoo1 { + fun getInstance(): MutableMap + fun getBuilderAfterFoo1(instance: MutableMap): T + + fun foo(value: Nothing?): T { + val instance = getInstance() + instance["foo"] = null + return getBuilderAfterFoo1(instance) + } + + fun foo(value: Boolean): T { + val instance = getInstance() + instance["foo"] = value + return getBuilderAfterFoo1(instance) + } + + fun foo(value: String): T { + val instance = getInstance() + instance["foo"] = value + return getBuilderAfterFoo1(instance) + } + + fun foo(value: Int): T { + val instance = getInstance() + instance["foo"] = value + return getBuilderAfterFoo1(instance) + } + + fun foo(value: Float): T { + val instance = getInstance() + instance["foo"] = value + return getBuilderAfterFoo1(instance) + } + + fun foo(value: Long): T { + val instance = getInstance() + instance["foo"] = value + return getBuilderAfterFoo1(instance) + } + + fun foo(value: Double): T { + val instance = getInstance() + instance["foo"] = value + return getBuilderAfterFoo1(instance) + } + + fun foo(value: List): T { + val instance = getInstance() + instance["foo"] = value + return getBuilderAfterFoo1(instance) + } + + fun foo(value: Map): T { + val instance = getInstance() + instance["foo"] = value + return getBuilderAfterFoo1(instance) + } + } + + class Schema1Map00Builder(private val instance: MutableMap): UnsetAddPropsSetter, GenericBuilder> { + private val knownKeys: Set = setOf( + "baz", + "foo" + ) + override fun getKnownKeys(): Set { + return knownKeys + } + override fun build(): Map { + return instance + } + override fun getInstance(): MutableMap { + return instance + } + override fun getBuilderAfterAdditionalProperty(instance: MutableMap): Schema1Map00Builder { + return this + } + } + + class Schema1Map01Builder(private val instance: MutableMap): SetterForFoo1 { + override fun getInstance(): MutableMap { + return instance + } + override fun getBuilderAfterFoo1(instance: MutableMap): Schema1Map00Builder { + return Schema1Map00Builder(instance) + } + } + + class Schema1Map10Builder(private val instance: MutableMap): SetterForBaz { + override fun getInstance(): MutableMap { + return instance + } + override fun getBuilderAfterBaz(instance: MutableMap): Schema1Map00Builder { + return Schema1Map00Builder(instance) + } + } + + class Schema1MapBuilder: SetterForBaz, SetterForFoo1 { + private val instance: MutableMap + init { + this.instance = LinkedHashMap() + } + override fun getInstance(): MutableMap { + return instance + } + override fun getBuilderAfterBaz(instance: MutableMap): Schema1Map01Builder { + return Schema1Map01Builder(instance) + } + override fun getBuilderAfterFoo1(instance: MutableMap): Schema1Map10Builder { + return Schema1Map10Builder(instance) + } + } + + + sealed interface Schema1Boxed { + fun getData(): Any? + } + + data class Schema1BoxedVoid(val data: Nothing?) : Schema1Boxed { + override fun getData(): Any? { + return data + } + } + + data class Schema1BoxedBoolean(val data: Boolean): Schema1Boxed { + override fun getData(): Any? { + return data + } + } + + data class Schema1BoxedNumber(val data: Number) : Schema1Boxed { + override fun getData(): Any? { + return data + } + } + + data class Schema1BoxedString(val data: String) : Schema1Boxed { + override fun getData(): Any? { + return data + } + } + + data class Schema1BoxedList(val data: FrozenList) : Schema1Boxed { + override fun getData(): Any? { + return data + } + } + + data class Schema1BoxedMap(val data: Schema1Map) : Schema1Boxed { + override fun getData(): Any? { + return data + } + } + + + class Schema1 private constructor(): JsonSchema( + JsonSchemaInfo() + .required(setOf( + "baz", + "foo" + )) + ), NullSchemaValidator, BooleanSchemaValidator, NumberSchemaValidator, StringSchemaValidator, ListSchemaValidator, Schema1BoxedList>, MapSchemaValidator { + + companion object { + @Volatile + private var instance: Schema1? = null + + fun getInstance() = + instance ?: synchronized(this) { + instance ?: Schema1().also { instance = it } + } + } + + @Throws(ValidationException::class) + override fun validate(arg: Nothing?, configuration: SchemaConfiguration?): Nothing? { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validatedPathToSchemas = PathToSchemasMap() + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, LinkedHashSet()) + getPathToSchemas(this, castArg, validationMetadata, pathSet) + return castArg + } + + @Throws(ValidationException::class) + override fun validate(arg: Boolean, configuration: SchemaConfiguration?): Boolean { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validatedPathToSchemas = PathToSchemasMap() + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, LinkedHashSet()) + getPathToSchemas(this, castArg, validationMetadata, pathSet) + return castArg + } + + @Throws(ValidationException::class) + override fun validate(arg: Number, configuration: SchemaConfiguration?): Number { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validatedPathToSchemas = PathToSchemasMap() + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, LinkedHashSet()) + getPathToSchemas(this, castArg, validationMetadata, pathSet) + return castArg + } + + @Throws(ValidationException::class) + fun validate(arg: Int, configuration: SchemaConfiguration?): Int { + return validate(arg as Number, configuration) as Int + } + + @Throws(ValidationException::class) + fun validate(arg: Long, configuration: SchemaConfiguration?): Long { + return validate(arg as Number, configuration) as Long + } + + @Throws(ValidationException::class) + fun validate(arg: Float, configuration: SchemaConfiguration?): Float { + return validate(arg as Number, configuration) as Float + } + + @Throws(ValidationException::class) + fun validate(arg: Double, configuration: SchemaConfiguration?): Double { + return validate(arg as Number, configuration) as Double + } + + @Throws(ValidationException::class) + override fun validate(arg: String, configuration: SchemaConfiguration?): String { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validatedPathToSchemas = PathToSchemasMap() + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, LinkedHashSet()) + getPathToSchemas(this, castArg, validationMetadata, pathSet) + return castArg + } + + @Throws(ValidationException::class) + fun validate(arg: LocalDate, configuration: SchemaConfiguration?): String { + return validate(arg.toString(), configuration) + } + + @Throws(ValidationException::class) + fun validate(arg: ZonedDateTime, configuration: SchemaConfiguration?): String { + return validate(arg.toString(), configuration) + } + + @Throws(ValidationException::class) + fun validate(arg: UUID, configuration: SchemaConfiguration?): String { + return validate(arg.toString(), configuration) + } + + override fun getNewInstance(arg: List<*>, pathToItem: List, pathToSchemas: PathToSchemasMap): FrozenList { + val items: MutableList = ArrayList() + var i: Int = 0 + for (item: Any? in arg) { + val itemPathToItem = pathToItem + i + val schemas: LinkedHashMap, Nothing?>? = pathToSchemas.get(itemPathToItem) + if (schemas == null) { + throw RuntimeException("Validation result is invalid, schemas must exist for a pathToItem") + } + val itemSchema: JsonSchema<*> = schemas.entries.iterator().next().key + val itemInstance: Any? = itemSchema.getNewInstance(item, itemPathToItem, pathToSchemas) + items.add(itemInstance) + i += 1 + } + val newInstanceItems: FrozenList = FrozenList(items) + return newInstanceItems + } + + @Throws(ValidationException::class) + override fun validate(arg: List<*>, configuration: SchemaConfiguration?): FrozenList { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, PathToSchemasMap(), LinkedHashSet()) + val pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet) + return getNewInstance(castArg, validationMetadata.pathToItem, pathToSchemasMap) + } + + override fun getNewInstance(arg: Map<*, *>, pathToItem: List, pathToSchemas: PathToSchemasMap): Schema1Map { + val properties: LinkedHashMap = LinkedHashMap() + for((propertyName, value) in arg) { + if (!(propertyName is String)) { + throw RuntimeException("Invalid non-string key value") + } + val propertyPathToItem: List = pathToItem + propertyName + val schemas: LinkedHashMap, Nothing?>? = pathToSchemas.get(propertyPathToItem) + if (schemas == null) { + throw RuntimeException("Validation result is invalid, schemas must exist for a pathToItem") + } + val propertySchema: JsonSchema<*> = schemas.entries.iterator().next().key + val propertyInstance: Any? = propertySchema.getNewInstance(value, propertyPathToItem, pathToSchemas) + properties[propertyName] = propertyInstance + } + val castProperties: FrozenMap = FrozenMap(properties) + return Schema1Map(castProperties) + } + + @Throws(ValidationException::class) + override fun validate(arg: Map<*, *>, configuration: SchemaConfiguration?): Schema1Map { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validatedPathToSchemas = PathToSchemasMap() + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, LinkedHashSet()) + val pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet) + return getNewInstance(castArg, validationMetadata.pathToItem, pathToSchemasMap) + } + + @Throws(ValidationException::class) + override fun validate(arg: Any?, configuration: SchemaConfiguration?): Any? { + if (arg == null) { + return validate(null, configuration) + } else if (arg is Boolean) { + return validate(arg, configuration) + } else if (arg is Number) { + return validate(arg, configuration) + } else if (arg is String) { + return validate(arg, configuration) + } else if (arg is List<*>) { + return validate(arg, configuration) + } else if (arg is Map<*, *>) { + return validate(arg, configuration) + } + throw ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema") + } + override fun getNewInstance(arg: Any?, pathToItem: List, pathToSchemas: PathToSchemasMap): Any? { + if (arg == null) { + return getNewInstance( null, pathToItem, pathToSchemas) + } else if (arg is Boolean) { + return getNewInstance(arg, pathToItem, pathToSchemas) + } else if (arg is Number) { + return getNewInstance(arg, pathToItem, pathToSchemas) + } else if (arg is String) { + return getNewInstance(arg, pathToItem, pathToSchemas) + } else if (arg is List<*>) { + return getNewInstance(arg, pathToItem, pathToSchemas) + } else if (arg is Map<*, *>) { + return getNewInstance(arg, pathToItem, pathToSchemas) + } + throw RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema") + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: Nothing?, configuration: SchemaConfiguration?): Schema1BoxedVoid { + return Schema1BoxedVoid(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: Boolean, configuration: SchemaConfiguration?): Schema1BoxedBoolean { + return Schema1BoxedBoolean(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: Number, configuration: SchemaConfiguration?): Schema1BoxedNumber { + return Schema1BoxedNumber(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: String, configuration: SchemaConfiguration?): Schema1BoxedString { + return Schema1BoxedString(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: List<*>, configuration: SchemaConfiguration?): Schema1BoxedList { + return Schema1BoxedList(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: Map<*, *>, configuration: SchemaConfiguration?): Schema1BoxedMap { + return Schema1BoxedMap(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: Any?, configuration: SchemaConfiguration?): Schema1Boxed { + if (arg == null) { + return validateAndBox(null, configuration) + } else if (arg is Boolean) { + return validateAndBox(arg, configuration) + } else if (arg is String) { + return validateAndBox(arg, configuration) + } else if (arg is Number) { + return validateAndBox(arg, configuration) + } else if (arg is List<*>) { + return validateAndBox(arg, configuration) + } else if (arg is Map<*, *>) { + return validateAndBox(arg, configuration) + } + throw ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema") + } + } + + sealed interface OneofWithRequired1Boxed { + fun getData(): Any? + } + + data class OneofWithRequired1BoxedMap(val data: FrozenMap) : OneofWithRequired1Boxed { + override fun getData(): Any? { + return data + } + } + + + class OneofWithRequired1 private constructor(): JsonSchema( + JsonSchemaInfo() + .type(setOf(Map::class.java)) + .oneOf(listOf( + Schema0::class.java, + Schema1::class.java + )) + ), MapSchemaValidator, OneofWithRequired1BoxedMap> { + /* + NOTE: This class is auto generated by OpenAPI JSON Schema Generator. + Ref: https://github.com/openapi-json-schema-tools/openapi-json-schema-generator + + Do not edit the class manually. + */ + + companion object { + @Volatile + private var instance: OneofWithRequired1? = null + + fun getInstance() = + instance ?: synchronized(this) { + instance ?: OneofWithRequired1().also { instance = it } + } + } + + override fun getNewInstance(arg: Map<*, *>, pathToItem: List, pathToSchemas: PathToSchemasMap): FrozenMap { + val properties: LinkedHashMap = LinkedHashMap() + for((entryKey, value) in arg) { + if (!(entryKey is String)) { + throw RuntimeException("Invalid non-string key value") + } + val propertyPathToItem: List = pathToItem + entryKey + val schemas: LinkedHashMap, Nothing?>? = pathToSchemas.get(propertyPathToItem) + if (schemas == null) { + throw RuntimeException("Validation result is invalid, schemas must exist for a pathToItem") + } + val propertySchema: JsonSchema<*> = schemas.entries.iterator().next().key + val propertyInstance: Any? = propertySchema.getNewInstance(value, propertyPathToItem, pathToSchemas) + properties[entryKey] = propertyInstance + } + val castProperties: FrozenMap = FrozenMap(properties) + return castProperties + } + + @Throws(ValidationException::class) + override fun validate(arg: Map<*, *>, configuration: SchemaConfiguration?): FrozenMap { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, PathToSchemasMap(), LinkedHashSet()) + val pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet) + return getNewInstance(castArg, validationMetadata.pathToItem, pathToSchemasMap) + } + + + @Throws(ValidationException::class) + override fun validate(arg: Any?, configuration: SchemaConfiguration?): Any? { + if (arg is Map<*, *>) { + return validate(arg, configuration) + } + throw ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema") + } + override fun getNewInstance(arg: Any?, pathToItem: List, pathToSchemas: PathToSchemasMap): Any? { + if (arg is Map<*, *>) { + return getNewInstance(arg, pathToItem, pathToSchemas) + } + throw RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema") + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: Map<*, *>, configuration: SchemaConfiguration?): OneofWithRequired1BoxedMap { + return OneofWithRequired1BoxedMap(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: Any?, configuration: SchemaConfiguration?): OneofWithRequired1Boxed { + if (arg is Map<*, *>) { + return validateAndBox(arg, configuration) + } + throw ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema") + } + } + +} diff --git a/samples/client/3_1_0_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/schemas/PatternIsNotAnchored.kt b/samples/client/3_1_0_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/schemas/PatternIsNotAnchored.kt new file mode 100644 index 00000000000..187e8f7823f --- /dev/null +++ b/samples/client/3_1_0_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/schemas/PatternIsNotAnchored.kt @@ -0,0 +1,311 @@ +package org.openapijsonschematools.client.components.schemas +import java.time.LocalDate +import java.time.ZonedDateTime +import java.util.UUID +import java.util.regex.Pattern +import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags +import org.openapijsonschematools.client.configurations.SchemaConfiguration +import org.openapijsonschematools.client.exceptions.InvalidAdditionalPropertyException +import org.openapijsonschematools.client.exceptions.UnsetPropertyException +import org.openapijsonschematools.client.exceptions.ValidationException +import org.openapijsonschematools.client.schemas.UnsetAddPropsSetter +import org.openapijsonschematools.client.schemas.validation.BooleanSchemaValidator +import org.openapijsonschematools.client.schemas.validation.FrozenList +import org.openapijsonschematools.client.schemas.validation.FrozenMap +import org.openapijsonschematools.client.schemas.validation.JsonSchema +import org.openapijsonschematools.client.schemas.validation.JsonSchemaInfo +import org.openapijsonschematools.client.schemas.validation.ListSchemaValidator +import org.openapijsonschematools.client.schemas.validation.MapSchemaValidator +import org.openapijsonschematools.client.schemas.validation.NullSchemaValidator +import org.openapijsonschematools.client.schemas.validation.NumberSchemaValidator +import org.openapijsonschematools.client.schemas.validation.PathToSchemasMap +import org.openapijsonschematools.client.schemas.validation.StringSchemaValidator +import org.openapijsonschematools.client.schemas.validation.ValidationMetadata + +class PatternIsNotAnchored { + // nest classes so all schemas and input/output classes can be public + + + sealed interface PatternIsNotAnchored1Boxed { + fun getData(): Any? + } + + data class PatternIsNotAnchored1BoxedVoid(val data: Nothing?) : PatternIsNotAnchored1Boxed { + override fun getData(): Any? { + return data + } + } + + data class PatternIsNotAnchored1BoxedBoolean(val data: Boolean): PatternIsNotAnchored1Boxed { + override fun getData(): Any? { + return data + } + } + + data class PatternIsNotAnchored1BoxedNumber(val data: Number) : PatternIsNotAnchored1Boxed { + override fun getData(): Any? { + return data + } + } + + data class PatternIsNotAnchored1BoxedString(val data: String) : PatternIsNotAnchored1Boxed { + override fun getData(): Any? { + return data + } + } + + data class PatternIsNotAnchored1BoxedList(val data: FrozenList) : PatternIsNotAnchored1Boxed { + override fun getData(): Any? { + return data + } + } + + data class PatternIsNotAnchored1BoxedMap(val data: FrozenMap) : PatternIsNotAnchored1Boxed { + override fun getData(): Any? { + return data + } + } + + + class PatternIsNotAnchored1 private constructor(): JsonSchema( + JsonSchemaInfo() + .pattern(Pattern.compile( + "a+" + )) + ), NullSchemaValidator, BooleanSchemaValidator, NumberSchemaValidator, StringSchemaValidator, ListSchemaValidator, PatternIsNotAnchored1BoxedList>, MapSchemaValidator, PatternIsNotAnchored1BoxedMap> { + /* + NOTE: This class is auto generated by OpenAPI JSON Schema Generator. + Ref: https://github.com/openapi-json-schema-tools/openapi-json-schema-generator + + Do not edit the class manually. + */ + + companion object { + @Volatile + private var instance: PatternIsNotAnchored1? = null + + fun getInstance() = + instance ?: synchronized(this) { + instance ?: PatternIsNotAnchored1().also { instance = it } + } + } + + @Throws(ValidationException::class) + override fun validate(arg: Nothing?, configuration: SchemaConfiguration?): Nothing? { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validatedPathToSchemas = PathToSchemasMap() + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, LinkedHashSet()) + getPathToSchemas(this, castArg, validationMetadata, pathSet) + return castArg + } + + @Throws(ValidationException::class) + override fun validate(arg: Boolean, configuration: SchemaConfiguration?): Boolean { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validatedPathToSchemas = PathToSchemasMap() + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, LinkedHashSet()) + getPathToSchemas(this, castArg, validationMetadata, pathSet) + return castArg + } + + @Throws(ValidationException::class) + override fun validate(arg: Number, configuration: SchemaConfiguration?): Number { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validatedPathToSchemas = PathToSchemasMap() + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, LinkedHashSet()) + getPathToSchemas(this, castArg, validationMetadata, pathSet) + return castArg + } + + @Throws(ValidationException::class) + fun validate(arg: Int, configuration: SchemaConfiguration?): Int { + return validate(arg as Number, configuration) as Int + } + + @Throws(ValidationException::class) + fun validate(arg: Long, configuration: SchemaConfiguration?): Long { + return validate(arg as Number, configuration) as Long + } + + @Throws(ValidationException::class) + fun validate(arg: Float, configuration: SchemaConfiguration?): Float { + return validate(arg as Number, configuration) as Float + } + + @Throws(ValidationException::class) + fun validate(arg: Double, configuration: SchemaConfiguration?): Double { + return validate(arg as Number, configuration) as Double + } + + @Throws(ValidationException::class) + override fun validate(arg: String, configuration: SchemaConfiguration?): String { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validatedPathToSchemas = PathToSchemasMap() + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, LinkedHashSet()) + getPathToSchemas(this, castArg, validationMetadata, pathSet) + return castArg + } + + @Throws(ValidationException::class) + fun validate(arg: LocalDate, configuration: SchemaConfiguration?): String { + return validate(arg.toString(), configuration) + } + + @Throws(ValidationException::class) + fun validate(arg: ZonedDateTime, configuration: SchemaConfiguration?): String { + return validate(arg.toString(), configuration) + } + + @Throws(ValidationException::class) + fun validate(arg: UUID, configuration: SchemaConfiguration?): String { + return validate(arg.toString(), configuration) + } + + override fun getNewInstance(arg: List<*>, pathToItem: List, pathToSchemas: PathToSchemasMap): FrozenList { + val items: MutableList = ArrayList() + var i: Int = 0 + for (item: Any? in arg) { + val itemPathToItem = pathToItem + i + val schemas: LinkedHashMap, Nothing?>? = pathToSchemas.get(itemPathToItem) + if (schemas == null) { + throw RuntimeException("Validation result is invalid, schemas must exist for a pathToItem") + } + val itemSchema: JsonSchema<*> = schemas.entries.iterator().next().key + val itemInstance: Any? = itemSchema.getNewInstance(item, itemPathToItem, pathToSchemas) + items.add(itemInstance) + i += 1 + } + val newInstanceItems: FrozenList = FrozenList(items) + return newInstanceItems + } + + @Throws(ValidationException::class) + override fun validate(arg: List<*>, configuration: SchemaConfiguration?): FrozenList { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, PathToSchemasMap(), LinkedHashSet()) + val pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet) + return getNewInstance(castArg, validationMetadata.pathToItem, pathToSchemasMap) + } + + override fun getNewInstance(arg: Map<*, *>, pathToItem: List, pathToSchemas: PathToSchemasMap): FrozenMap { + val properties: LinkedHashMap = LinkedHashMap() + for((propertyName, value) in arg) { + if (!(propertyName is String)) { + throw RuntimeException("Invalid non-string key value") + } + val propertyPathToItem: List = pathToItem + propertyName + val schemas: LinkedHashMap, Nothing?>? = pathToSchemas.get(propertyPathToItem) + if (schemas == null) { + throw RuntimeException("Validation result is invalid, schemas must exist for a pathToItem") + } + val propertySchema: JsonSchema<*> = schemas.entries.iterator().next().key + val propertyInstance: Any? = propertySchema.getNewInstance(value, propertyPathToItem, pathToSchemas) + properties[propertyName] = propertyInstance + } + val castProperties: FrozenMap = FrozenMap(properties) + return castProperties + } + + @Throws(ValidationException::class) + override fun validate(arg: Map<*, *>, configuration: SchemaConfiguration?): FrozenMap { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validatedPathToSchemas = PathToSchemasMap() + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, LinkedHashSet()) + val pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet) + return getNewInstance(castArg, validationMetadata.pathToItem, pathToSchemasMap) + } + + @Throws(ValidationException::class) + override fun validate(arg: Any?, configuration: SchemaConfiguration?): Any? { + if (arg == null) { + return validate(null, configuration) + } else if (arg is Boolean) { + return validate(arg, configuration) + } else if (arg is Number) { + return validate(arg, configuration) + } else if (arg is String) { + return validate(arg, configuration) + } else if (arg is List<*>) { + return validate(arg, configuration) + } else if (arg is Map<*, *>) { + return validate(arg, configuration) + } + throw ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema") + } + override fun getNewInstance(arg: Any?, pathToItem: List, pathToSchemas: PathToSchemasMap): Any? { + if (arg == null) { + return getNewInstance( null, pathToItem, pathToSchemas) + } else if (arg is Boolean) { + return getNewInstance(arg, pathToItem, pathToSchemas) + } else if (arg is Number) { + return getNewInstance(arg, pathToItem, pathToSchemas) + } else if (arg is String) { + return getNewInstance(arg, pathToItem, pathToSchemas) + } else if (arg is List<*>) { + return getNewInstance(arg, pathToItem, pathToSchemas) + } else if (arg is Map<*, *>) { + return getNewInstance(arg, pathToItem, pathToSchemas) + } + throw RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema") + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: Nothing?, configuration: SchemaConfiguration?): PatternIsNotAnchored1BoxedVoid { + return PatternIsNotAnchored1BoxedVoid(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: Boolean, configuration: SchemaConfiguration?): PatternIsNotAnchored1BoxedBoolean { + return PatternIsNotAnchored1BoxedBoolean(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: Number, configuration: SchemaConfiguration?): PatternIsNotAnchored1BoxedNumber { + return PatternIsNotAnchored1BoxedNumber(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: String, configuration: SchemaConfiguration?): PatternIsNotAnchored1BoxedString { + return PatternIsNotAnchored1BoxedString(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: List<*>, configuration: SchemaConfiguration?): PatternIsNotAnchored1BoxedList { + return PatternIsNotAnchored1BoxedList(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: Map<*, *>, configuration: SchemaConfiguration?): PatternIsNotAnchored1BoxedMap { + return PatternIsNotAnchored1BoxedMap(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: Any?, configuration: SchemaConfiguration?): PatternIsNotAnchored1Boxed { + if (arg == null) { + return validateAndBox(null, configuration) + } else if (arg is Boolean) { + return validateAndBox(arg, configuration) + } else if (arg is String) { + return validateAndBox(arg, configuration) + } else if (arg is Number) { + return validateAndBox(arg, configuration) + } else if (arg is List<*>) { + return validateAndBox(arg, configuration) + } else if (arg is Map<*, *>) { + return validateAndBox(arg, configuration) + } + throw ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema") + } + } +} diff --git a/samples/client/3_1_0_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/schemas/PatternValidation.kt b/samples/client/3_1_0_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/schemas/PatternValidation.kt new file mode 100644 index 00000000000..3d58fd45c4a --- /dev/null +++ b/samples/client/3_1_0_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/schemas/PatternValidation.kt @@ -0,0 +1,311 @@ +package org.openapijsonschematools.client.components.schemas +import java.time.LocalDate +import java.time.ZonedDateTime +import java.util.UUID +import java.util.regex.Pattern +import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags +import org.openapijsonschematools.client.configurations.SchemaConfiguration +import org.openapijsonschematools.client.exceptions.InvalidAdditionalPropertyException +import org.openapijsonschematools.client.exceptions.UnsetPropertyException +import org.openapijsonschematools.client.exceptions.ValidationException +import org.openapijsonschematools.client.schemas.UnsetAddPropsSetter +import org.openapijsonschematools.client.schemas.validation.BooleanSchemaValidator +import org.openapijsonschematools.client.schemas.validation.FrozenList +import org.openapijsonschematools.client.schemas.validation.FrozenMap +import org.openapijsonschematools.client.schemas.validation.JsonSchema +import org.openapijsonschematools.client.schemas.validation.JsonSchemaInfo +import org.openapijsonschematools.client.schemas.validation.ListSchemaValidator +import org.openapijsonschematools.client.schemas.validation.MapSchemaValidator +import org.openapijsonschematools.client.schemas.validation.NullSchemaValidator +import org.openapijsonschematools.client.schemas.validation.NumberSchemaValidator +import org.openapijsonschematools.client.schemas.validation.PathToSchemasMap +import org.openapijsonschematools.client.schemas.validation.StringSchemaValidator +import org.openapijsonschematools.client.schemas.validation.ValidationMetadata + +class PatternValidation { + // nest classes so all schemas and input/output classes can be public + + + sealed interface PatternValidation1Boxed { + fun getData(): Any? + } + + data class PatternValidation1BoxedVoid(val data: Nothing?) : PatternValidation1Boxed { + override fun getData(): Any? { + return data + } + } + + data class PatternValidation1BoxedBoolean(val data: Boolean): PatternValidation1Boxed { + override fun getData(): Any? { + return data + } + } + + data class PatternValidation1BoxedNumber(val data: Number) : PatternValidation1Boxed { + override fun getData(): Any? { + return data + } + } + + data class PatternValidation1BoxedString(val data: String) : PatternValidation1Boxed { + override fun getData(): Any? { + return data + } + } + + data class PatternValidation1BoxedList(val data: FrozenList) : PatternValidation1Boxed { + override fun getData(): Any? { + return data + } + } + + data class PatternValidation1BoxedMap(val data: FrozenMap) : PatternValidation1Boxed { + override fun getData(): Any? { + return data + } + } + + + class PatternValidation1 private constructor(): JsonSchema( + JsonSchemaInfo() + .pattern(Pattern.compile( + "^a*\$" + )) + ), NullSchemaValidator, BooleanSchemaValidator, NumberSchemaValidator, StringSchemaValidator, ListSchemaValidator, PatternValidation1BoxedList>, MapSchemaValidator, PatternValidation1BoxedMap> { + /* + NOTE: This class is auto generated by OpenAPI JSON Schema Generator. + Ref: https://github.com/openapi-json-schema-tools/openapi-json-schema-generator + + Do not edit the class manually. + */ + + companion object { + @Volatile + private var instance: PatternValidation1? = null + + fun getInstance() = + instance ?: synchronized(this) { + instance ?: PatternValidation1().also { instance = it } + } + } + + @Throws(ValidationException::class) + override fun validate(arg: Nothing?, configuration: SchemaConfiguration?): Nothing? { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validatedPathToSchemas = PathToSchemasMap() + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, LinkedHashSet()) + getPathToSchemas(this, castArg, validationMetadata, pathSet) + return castArg + } + + @Throws(ValidationException::class) + override fun validate(arg: Boolean, configuration: SchemaConfiguration?): Boolean { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validatedPathToSchemas = PathToSchemasMap() + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, LinkedHashSet()) + getPathToSchemas(this, castArg, validationMetadata, pathSet) + return castArg + } + + @Throws(ValidationException::class) + override fun validate(arg: Number, configuration: SchemaConfiguration?): Number { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validatedPathToSchemas = PathToSchemasMap() + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, LinkedHashSet()) + getPathToSchemas(this, castArg, validationMetadata, pathSet) + return castArg + } + + @Throws(ValidationException::class) + fun validate(arg: Int, configuration: SchemaConfiguration?): Int { + return validate(arg as Number, configuration) as Int + } + + @Throws(ValidationException::class) + fun validate(arg: Long, configuration: SchemaConfiguration?): Long { + return validate(arg as Number, configuration) as Long + } + + @Throws(ValidationException::class) + fun validate(arg: Float, configuration: SchemaConfiguration?): Float { + return validate(arg as Number, configuration) as Float + } + + @Throws(ValidationException::class) + fun validate(arg: Double, configuration: SchemaConfiguration?): Double { + return validate(arg as Number, configuration) as Double + } + + @Throws(ValidationException::class) + override fun validate(arg: String, configuration: SchemaConfiguration?): String { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validatedPathToSchemas = PathToSchemasMap() + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, LinkedHashSet()) + getPathToSchemas(this, castArg, validationMetadata, pathSet) + return castArg + } + + @Throws(ValidationException::class) + fun validate(arg: LocalDate, configuration: SchemaConfiguration?): String { + return validate(arg.toString(), configuration) + } + + @Throws(ValidationException::class) + fun validate(arg: ZonedDateTime, configuration: SchemaConfiguration?): String { + return validate(arg.toString(), configuration) + } + + @Throws(ValidationException::class) + fun validate(arg: UUID, configuration: SchemaConfiguration?): String { + return validate(arg.toString(), configuration) + } + + override fun getNewInstance(arg: List<*>, pathToItem: List, pathToSchemas: PathToSchemasMap): FrozenList { + val items: MutableList = ArrayList() + var i: Int = 0 + for (item: Any? in arg) { + val itemPathToItem = pathToItem + i + val schemas: LinkedHashMap, Nothing?>? = pathToSchemas.get(itemPathToItem) + if (schemas == null) { + throw RuntimeException("Validation result is invalid, schemas must exist for a pathToItem") + } + val itemSchema: JsonSchema<*> = schemas.entries.iterator().next().key + val itemInstance: Any? = itemSchema.getNewInstance(item, itemPathToItem, pathToSchemas) + items.add(itemInstance) + i += 1 + } + val newInstanceItems: FrozenList = FrozenList(items) + return newInstanceItems + } + + @Throws(ValidationException::class) + override fun validate(arg: List<*>, configuration: SchemaConfiguration?): FrozenList { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, PathToSchemasMap(), LinkedHashSet()) + val pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet) + return getNewInstance(castArg, validationMetadata.pathToItem, pathToSchemasMap) + } + + override fun getNewInstance(arg: Map<*, *>, pathToItem: List, pathToSchemas: PathToSchemasMap): FrozenMap { + val properties: LinkedHashMap = LinkedHashMap() + for((propertyName, value) in arg) { + if (!(propertyName is String)) { + throw RuntimeException("Invalid non-string key value") + } + val propertyPathToItem: List = pathToItem + propertyName + val schemas: LinkedHashMap, Nothing?>? = pathToSchemas.get(propertyPathToItem) + if (schemas == null) { + throw RuntimeException("Validation result is invalid, schemas must exist for a pathToItem") + } + val propertySchema: JsonSchema<*> = schemas.entries.iterator().next().key + val propertyInstance: Any? = propertySchema.getNewInstance(value, propertyPathToItem, pathToSchemas) + properties[propertyName] = propertyInstance + } + val castProperties: FrozenMap = FrozenMap(properties) + return castProperties + } + + @Throws(ValidationException::class) + override fun validate(arg: Map<*, *>, configuration: SchemaConfiguration?): FrozenMap { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validatedPathToSchemas = PathToSchemasMap() + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, LinkedHashSet()) + val pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet) + return getNewInstance(castArg, validationMetadata.pathToItem, pathToSchemasMap) + } + + @Throws(ValidationException::class) + override fun validate(arg: Any?, configuration: SchemaConfiguration?): Any? { + if (arg == null) { + return validate(null, configuration) + } else if (arg is Boolean) { + return validate(arg, configuration) + } else if (arg is Number) { + return validate(arg, configuration) + } else if (arg is String) { + return validate(arg, configuration) + } else if (arg is List<*>) { + return validate(arg, configuration) + } else if (arg is Map<*, *>) { + return validate(arg, configuration) + } + throw ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema") + } + override fun getNewInstance(arg: Any?, pathToItem: List, pathToSchemas: PathToSchemasMap): Any? { + if (arg == null) { + return getNewInstance( null, pathToItem, pathToSchemas) + } else if (arg is Boolean) { + return getNewInstance(arg, pathToItem, pathToSchemas) + } else if (arg is Number) { + return getNewInstance(arg, pathToItem, pathToSchemas) + } else if (arg is String) { + return getNewInstance(arg, pathToItem, pathToSchemas) + } else if (arg is List<*>) { + return getNewInstance(arg, pathToItem, pathToSchemas) + } else if (arg is Map<*, *>) { + return getNewInstance(arg, pathToItem, pathToSchemas) + } + throw RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema") + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: Nothing?, configuration: SchemaConfiguration?): PatternValidation1BoxedVoid { + return PatternValidation1BoxedVoid(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: Boolean, configuration: SchemaConfiguration?): PatternValidation1BoxedBoolean { + return PatternValidation1BoxedBoolean(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: Number, configuration: SchemaConfiguration?): PatternValidation1BoxedNumber { + return PatternValidation1BoxedNumber(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: String, configuration: SchemaConfiguration?): PatternValidation1BoxedString { + return PatternValidation1BoxedString(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: List<*>, configuration: SchemaConfiguration?): PatternValidation1BoxedList { + return PatternValidation1BoxedList(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: Map<*, *>, configuration: SchemaConfiguration?): PatternValidation1BoxedMap { + return PatternValidation1BoxedMap(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: Any?, configuration: SchemaConfiguration?): PatternValidation1Boxed { + if (arg == null) { + return validateAndBox(null, configuration) + } else if (arg is Boolean) { + return validateAndBox(arg, configuration) + } else if (arg is String) { + return validateAndBox(arg, configuration) + } else if (arg is Number) { + return validateAndBox(arg, configuration) + } else if (arg is List<*>) { + return validateAndBox(arg, configuration) + } else if (arg is Map<*, *>) { + return validateAndBox(arg, configuration) + } + throw ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema") + } + } +} diff --git a/samples/client/3_1_0_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/schemas/PatternpropertiesValidatesPropertiesMatchingARegex.kt b/samples/client/3_1_0_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/schemas/PatternpropertiesValidatesPropertiesMatchingARegex.kt new file mode 100644 index 00000000000..9bbb7d45821 --- /dev/null +++ b/samples/client/3_1_0_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/schemas/PatternpropertiesValidatesPropertiesMatchingARegex.kt @@ -0,0 +1,326 @@ +package org.openapijsonschematools.client.components.schemas +import java.time.LocalDate +import java.time.ZonedDateTime +import java.util.AbstractMap +import java.util.UUID +import java.util.regex.Pattern +import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags +import org.openapijsonschematools.client.configurations.SchemaConfiguration +import org.openapijsonschematools.client.exceptions.InvalidAdditionalPropertyException +import org.openapijsonschematools.client.exceptions.UnsetPropertyException +import org.openapijsonschematools.client.exceptions.ValidationException +import org.openapijsonschematools.client.schemas.IntJsonSchema +import org.openapijsonschematools.client.schemas.UnsetAddPropsSetter +import org.openapijsonschematools.client.schemas.validation.BooleanSchemaValidator +import org.openapijsonschematools.client.schemas.validation.FrozenList +import org.openapijsonschematools.client.schemas.validation.FrozenMap +import org.openapijsonschematools.client.schemas.validation.JsonSchema +import org.openapijsonschematools.client.schemas.validation.JsonSchemaInfo +import org.openapijsonschematools.client.schemas.validation.ListSchemaValidator +import org.openapijsonschematools.client.schemas.validation.MapSchemaValidator +import org.openapijsonschematools.client.schemas.validation.NullSchemaValidator +import org.openapijsonschematools.client.schemas.validation.NumberSchemaValidator +import org.openapijsonschematools.client.schemas.validation.PathToSchemasMap +import org.openapijsonschematools.client.schemas.validation.StringSchemaValidator +import org.openapijsonschematools.client.schemas.validation.ValidationMetadata + +class PatternpropertiesValidatesPropertiesMatchingARegex { + // nest classes so all schemas and input/output classes can be public + + + class Fo : IntJsonSchema.IntJsonSchema1() { + companion object { + @Volatile + private var instance: Fo? = null + + fun getInstance() = + instance ?: synchronized(this) { + instance ?: Fo().also { instance = it } + } + } + } + + + sealed interface PatternpropertiesValidatesPropertiesMatchingARegex1Boxed { + fun getData(): Any? + } + + data class PatternpropertiesValidatesPropertiesMatchingARegex1BoxedVoid(val data: Nothing?) : PatternpropertiesValidatesPropertiesMatchingARegex1Boxed { + override fun getData(): Any? { + return data + } + } + + data class PatternpropertiesValidatesPropertiesMatchingARegex1BoxedBoolean(val data: Boolean): PatternpropertiesValidatesPropertiesMatchingARegex1Boxed { + override fun getData(): Any? { + return data + } + } + + data class PatternpropertiesValidatesPropertiesMatchingARegex1BoxedNumber(val data: Number) : PatternpropertiesValidatesPropertiesMatchingARegex1Boxed { + override fun getData(): Any? { + return data + } + } + + data class PatternpropertiesValidatesPropertiesMatchingARegex1BoxedString(val data: String) : PatternpropertiesValidatesPropertiesMatchingARegex1Boxed { + override fun getData(): Any? { + return data + } + } + + data class PatternpropertiesValidatesPropertiesMatchingARegex1BoxedList(val data: FrozenList) : PatternpropertiesValidatesPropertiesMatchingARegex1Boxed { + override fun getData(): Any? { + return data + } + } + + data class PatternpropertiesValidatesPropertiesMatchingARegex1BoxedMap(val data: FrozenMap) : PatternpropertiesValidatesPropertiesMatchingARegex1Boxed { + override fun getData(): Any? { + return data + } + } + + + class PatternpropertiesValidatesPropertiesMatchingARegex1 private constructor(): JsonSchema( + JsonSchemaInfo() + .patternProperties(mapOf( + new AbstractMap.SimpleEntry<>(Pattern.compile("f.*o"), Fo::class.java) + )) + ), NullSchemaValidator, BooleanSchemaValidator, NumberSchemaValidator, StringSchemaValidator, ListSchemaValidator, PatternpropertiesValidatesPropertiesMatchingARegex1BoxedList>, MapSchemaValidator, PatternpropertiesValidatesPropertiesMatchingARegex1BoxedMap> { + /* + NOTE: This class is auto generated by OpenAPI JSON Schema Generator. + Ref: https://github.com/openapi-json-schema-tools/openapi-json-schema-generator + + Do not edit the class manually. + */ + + companion object { + @Volatile + private var instance: PatternpropertiesValidatesPropertiesMatchingARegex1? = null + + fun getInstance() = + instance ?: synchronized(this) { + instance ?: PatternpropertiesValidatesPropertiesMatchingARegex1().also { instance = it } + } + } + + @Throws(ValidationException::class) + override fun validate(arg: Nothing?, configuration: SchemaConfiguration?): Nothing? { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validatedPathToSchemas = PathToSchemasMap() + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, LinkedHashSet()) + getPathToSchemas(this, castArg, validationMetadata, pathSet) + return castArg + } + + @Throws(ValidationException::class) + override fun validate(arg: Boolean, configuration: SchemaConfiguration?): Boolean { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validatedPathToSchemas = PathToSchemasMap() + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, LinkedHashSet()) + getPathToSchemas(this, castArg, validationMetadata, pathSet) + return castArg + } + + @Throws(ValidationException::class) + override fun validate(arg: Number, configuration: SchemaConfiguration?): Number { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validatedPathToSchemas = PathToSchemasMap() + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, LinkedHashSet()) + getPathToSchemas(this, castArg, validationMetadata, pathSet) + return castArg + } + + @Throws(ValidationException::class) + fun validate(arg: Int, configuration: SchemaConfiguration?): Int { + return validate(arg as Number, configuration) as Int + } + + @Throws(ValidationException::class) + fun validate(arg: Long, configuration: SchemaConfiguration?): Long { + return validate(arg as Number, configuration) as Long + } + + @Throws(ValidationException::class) + fun validate(arg: Float, configuration: SchemaConfiguration?): Float { + return validate(arg as Number, configuration) as Float + } + + @Throws(ValidationException::class) + fun validate(arg: Double, configuration: SchemaConfiguration?): Double { + return validate(arg as Number, configuration) as Double + } + + @Throws(ValidationException::class) + override fun validate(arg: String, configuration: SchemaConfiguration?): String { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validatedPathToSchemas = PathToSchemasMap() + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, LinkedHashSet()) + getPathToSchemas(this, castArg, validationMetadata, pathSet) + return castArg + } + + @Throws(ValidationException::class) + fun validate(arg: LocalDate, configuration: SchemaConfiguration?): String { + return validate(arg.toString(), configuration) + } + + @Throws(ValidationException::class) + fun validate(arg: ZonedDateTime, configuration: SchemaConfiguration?): String { + return validate(arg.toString(), configuration) + } + + @Throws(ValidationException::class) + fun validate(arg: UUID, configuration: SchemaConfiguration?): String { + return validate(arg.toString(), configuration) + } + + override fun getNewInstance(arg: List<*>, pathToItem: List, pathToSchemas: PathToSchemasMap): FrozenList { + val items: MutableList = ArrayList() + var i: Int = 0 + for (item: Any? in arg) { + val itemPathToItem = pathToItem + i + val schemas: LinkedHashMap, Nothing?>? = pathToSchemas.get(itemPathToItem) + if (schemas == null) { + throw RuntimeException("Validation result is invalid, schemas must exist for a pathToItem") + } + val itemSchema: JsonSchema<*> = schemas.entries.iterator().next().key + val itemInstance: Any? = itemSchema.getNewInstance(item, itemPathToItem, pathToSchemas) + items.add(itemInstance) + i += 1 + } + val newInstanceItems: FrozenList = FrozenList(items) + return newInstanceItems + } + + @Throws(ValidationException::class) + override fun validate(arg: List<*>, configuration: SchemaConfiguration?): FrozenList { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, PathToSchemasMap(), LinkedHashSet()) + val pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet) + return getNewInstance(castArg, validationMetadata.pathToItem, pathToSchemasMap) + } + + override fun getNewInstance(arg: Map<*, *>, pathToItem: List, pathToSchemas: PathToSchemasMap): FrozenMap { + val properties: LinkedHashMap = LinkedHashMap() + for((propertyName, value) in arg) { + if (!(propertyName is String)) { + throw RuntimeException("Invalid non-string key value") + } + val propertyPathToItem: List = pathToItem + propertyName + val schemas: LinkedHashMap, Nothing?>? = pathToSchemas.get(propertyPathToItem) + if (schemas == null) { + throw RuntimeException("Validation result is invalid, schemas must exist for a pathToItem") + } + val propertySchema: JsonSchema<*> = schemas.entries.iterator().next().key + val propertyInstance: Any? = propertySchema.getNewInstance(value, propertyPathToItem, pathToSchemas) + properties[propertyName] = propertyInstance + } + val castProperties: FrozenMap = FrozenMap(properties) + return castProperties + } + + @Throws(ValidationException::class) + override fun validate(arg: Map<*, *>, configuration: SchemaConfiguration?): FrozenMap { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validatedPathToSchemas = PathToSchemasMap() + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, LinkedHashSet()) + val pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet) + return getNewInstance(castArg, validationMetadata.pathToItem, pathToSchemasMap) + } + + @Throws(ValidationException::class) + override fun validate(arg: Any?, configuration: SchemaConfiguration?): Any? { + if (arg == null) { + return validate(null, configuration) + } else if (arg is Boolean) { + return validate(arg, configuration) + } else if (arg is Number) { + return validate(arg, configuration) + } else if (arg is String) { + return validate(arg, configuration) + } else if (arg is List<*>) { + return validate(arg, configuration) + } else if (arg is Map<*, *>) { + return validate(arg, configuration) + } + throw ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema") + } + override fun getNewInstance(arg: Any?, pathToItem: List, pathToSchemas: PathToSchemasMap): Any? { + if (arg == null) { + return getNewInstance( null, pathToItem, pathToSchemas) + } else if (arg is Boolean) { + return getNewInstance(arg, pathToItem, pathToSchemas) + } else if (arg is Number) { + return getNewInstance(arg, pathToItem, pathToSchemas) + } else if (arg is String) { + return getNewInstance(arg, pathToItem, pathToSchemas) + } else if (arg is List<*>) { + return getNewInstance(arg, pathToItem, pathToSchemas) + } else if (arg is Map<*, *>) { + return getNewInstance(arg, pathToItem, pathToSchemas) + } + throw RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema") + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: Nothing?, configuration: SchemaConfiguration?): PatternpropertiesValidatesPropertiesMatchingARegex1BoxedVoid { + return PatternpropertiesValidatesPropertiesMatchingARegex1BoxedVoid(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: Boolean, configuration: SchemaConfiguration?): PatternpropertiesValidatesPropertiesMatchingARegex1BoxedBoolean { + return PatternpropertiesValidatesPropertiesMatchingARegex1BoxedBoolean(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: Number, configuration: SchemaConfiguration?): PatternpropertiesValidatesPropertiesMatchingARegex1BoxedNumber { + return PatternpropertiesValidatesPropertiesMatchingARegex1BoxedNumber(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: String, configuration: SchemaConfiguration?): PatternpropertiesValidatesPropertiesMatchingARegex1BoxedString { + return PatternpropertiesValidatesPropertiesMatchingARegex1BoxedString(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: List<*>, configuration: SchemaConfiguration?): PatternpropertiesValidatesPropertiesMatchingARegex1BoxedList { + return PatternpropertiesValidatesPropertiesMatchingARegex1BoxedList(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: Map<*, *>, configuration: SchemaConfiguration?): PatternpropertiesValidatesPropertiesMatchingARegex1BoxedMap { + return PatternpropertiesValidatesPropertiesMatchingARegex1BoxedMap(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: Any?, configuration: SchemaConfiguration?): PatternpropertiesValidatesPropertiesMatchingARegex1Boxed { + if (arg == null) { + return validateAndBox(null, configuration) + } else if (arg is Boolean) { + return validateAndBox(arg, configuration) + } else if (arg is String) { + return validateAndBox(arg, configuration) + } else if (arg is Number) { + return validateAndBox(arg, configuration) + } else if (arg is List<*>) { + return validateAndBox(arg, configuration) + } else if (arg is Map<*, *>) { + return validateAndBox(arg, configuration) + } + throw ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema") + } + } +} diff --git a/samples/client/3_1_0_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/schemas/PatternpropertiesWithNullValuedInstanceProperties.kt b/samples/client/3_1_0_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/schemas/PatternpropertiesWithNullValuedInstanceProperties.kt new file mode 100644 index 00000000000..df837363aec --- /dev/null +++ b/samples/client/3_1_0_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/schemas/PatternpropertiesWithNullValuedInstanceProperties.kt @@ -0,0 +1,326 @@ +package org.openapijsonschematools.client.components.schemas +import java.time.LocalDate +import java.time.ZonedDateTime +import java.util.AbstractMap +import java.util.UUID +import java.util.regex.Pattern +import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags +import org.openapijsonschematools.client.configurations.SchemaConfiguration +import org.openapijsonschematools.client.exceptions.InvalidAdditionalPropertyException +import org.openapijsonschematools.client.exceptions.UnsetPropertyException +import org.openapijsonschematools.client.exceptions.ValidationException +import org.openapijsonschematools.client.schemas.NullJsonSchema +import org.openapijsonschematools.client.schemas.UnsetAddPropsSetter +import org.openapijsonschematools.client.schemas.validation.BooleanSchemaValidator +import org.openapijsonschematools.client.schemas.validation.FrozenList +import org.openapijsonschematools.client.schemas.validation.FrozenMap +import org.openapijsonschematools.client.schemas.validation.JsonSchema +import org.openapijsonschematools.client.schemas.validation.JsonSchemaInfo +import org.openapijsonschematools.client.schemas.validation.ListSchemaValidator +import org.openapijsonschematools.client.schemas.validation.MapSchemaValidator +import org.openapijsonschematools.client.schemas.validation.NullSchemaValidator +import org.openapijsonschematools.client.schemas.validation.NumberSchemaValidator +import org.openapijsonschematools.client.schemas.validation.PathToSchemasMap +import org.openapijsonschematools.client.schemas.validation.StringSchemaValidator +import org.openapijsonschematools.client.schemas.validation.ValidationMetadata + +class PatternpropertiesWithNullValuedInstanceProperties { + // nest classes so all schemas and input/output classes can be public + + + class Bar : NullJsonSchema.NullJsonSchema1() { + companion object { + @Volatile + private var instance: Bar? = null + + fun getInstance() = + instance ?: synchronized(this) { + instance ?: Bar().also { instance = it } + } + } + } + + + sealed interface PatternpropertiesWithNullValuedInstanceProperties1Boxed { + fun getData(): Any? + } + + data class PatternpropertiesWithNullValuedInstanceProperties1BoxedVoid(val data: Nothing?) : PatternpropertiesWithNullValuedInstanceProperties1Boxed { + override fun getData(): Any? { + return data + } + } + + data class PatternpropertiesWithNullValuedInstanceProperties1BoxedBoolean(val data: Boolean): PatternpropertiesWithNullValuedInstanceProperties1Boxed { + override fun getData(): Any? { + return data + } + } + + data class PatternpropertiesWithNullValuedInstanceProperties1BoxedNumber(val data: Number) : PatternpropertiesWithNullValuedInstanceProperties1Boxed { + override fun getData(): Any? { + return data + } + } + + data class PatternpropertiesWithNullValuedInstanceProperties1BoxedString(val data: String) : PatternpropertiesWithNullValuedInstanceProperties1Boxed { + override fun getData(): Any? { + return data + } + } + + data class PatternpropertiesWithNullValuedInstanceProperties1BoxedList(val data: FrozenList) : PatternpropertiesWithNullValuedInstanceProperties1Boxed { + override fun getData(): Any? { + return data + } + } + + data class PatternpropertiesWithNullValuedInstanceProperties1BoxedMap(val data: FrozenMap) : PatternpropertiesWithNullValuedInstanceProperties1Boxed { + override fun getData(): Any? { + return data + } + } + + + class PatternpropertiesWithNullValuedInstanceProperties1 private constructor(): JsonSchema( + JsonSchemaInfo() + .patternProperties(mapOf( + new AbstractMap.SimpleEntry<>(Pattern.compile("^.*bar\$"), Bar::class.java) + )) + ), NullSchemaValidator, BooleanSchemaValidator, NumberSchemaValidator, StringSchemaValidator, ListSchemaValidator, PatternpropertiesWithNullValuedInstanceProperties1BoxedList>, MapSchemaValidator, PatternpropertiesWithNullValuedInstanceProperties1BoxedMap> { + /* + NOTE: This class is auto generated by OpenAPI JSON Schema Generator. + Ref: https://github.com/openapi-json-schema-tools/openapi-json-schema-generator + + Do not edit the class manually. + */ + + companion object { + @Volatile + private var instance: PatternpropertiesWithNullValuedInstanceProperties1? = null + + fun getInstance() = + instance ?: synchronized(this) { + instance ?: PatternpropertiesWithNullValuedInstanceProperties1().also { instance = it } + } + } + + @Throws(ValidationException::class) + override fun validate(arg: Nothing?, configuration: SchemaConfiguration?): Nothing? { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validatedPathToSchemas = PathToSchemasMap() + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, LinkedHashSet()) + getPathToSchemas(this, castArg, validationMetadata, pathSet) + return castArg + } + + @Throws(ValidationException::class) + override fun validate(arg: Boolean, configuration: SchemaConfiguration?): Boolean { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validatedPathToSchemas = PathToSchemasMap() + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, LinkedHashSet()) + getPathToSchemas(this, castArg, validationMetadata, pathSet) + return castArg + } + + @Throws(ValidationException::class) + override fun validate(arg: Number, configuration: SchemaConfiguration?): Number { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validatedPathToSchemas = PathToSchemasMap() + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, LinkedHashSet()) + getPathToSchemas(this, castArg, validationMetadata, pathSet) + return castArg + } + + @Throws(ValidationException::class) + fun validate(arg: Int, configuration: SchemaConfiguration?): Int { + return validate(arg as Number, configuration) as Int + } + + @Throws(ValidationException::class) + fun validate(arg: Long, configuration: SchemaConfiguration?): Long { + return validate(arg as Number, configuration) as Long + } + + @Throws(ValidationException::class) + fun validate(arg: Float, configuration: SchemaConfiguration?): Float { + return validate(arg as Number, configuration) as Float + } + + @Throws(ValidationException::class) + fun validate(arg: Double, configuration: SchemaConfiguration?): Double { + return validate(arg as Number, configuration) as Double + } + + @Throws(ValidationException::class) + override fun validate(arg: String, configuration: SchemaConfiguration?): String { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validatedPathToSchemas = PathToSchemasMap() + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, LinkedHashSet()) + getPathToSchemas(this, castArg, validationMetadata, pathSet) + return castArg + } + + @Throws(ValidationException::class) + fun validate(arg: LocalDate, configuration: SchemaConfiguration?): String { + return validate(arg.toString(), configuration) + } + + @Throws(ValidationException::class) + fun validate(arg: ZonedDateTime, configuration: SchemaConfiguration?): String { + return validate(arg.toString(), configuration) + } + + @Throws(ValidationException::class) + fun validate(arg: UUID, configuration: SchemaConfiguration?): String { + return validate(arg.toString(), configuration) + } + + override fun getNewInstance(arg: List<*>, pathToItem: List, pathToSchemas: PathToSchemasMap): FrozenList { + val items: MutableList = ArrayList() + var i: Int = 0 + for (item: Any? in arg) { + val itemPathToItem = pathToItem + i + val schemas: LinkedHashMap, Nothing?>? = pathToSchemas.get(itemPathToItem) + if (schemas == null) { + throw RuntimeException("Validation result is invalid, schemas must exist for a pathToItem") + } + val itemSchema: JsonSchema<*> = schemas.entries.iterator().next().key + val itemInstance: Any? = itemSchema.getNewInstance(item, itemPathToItem, pathToSchemas) + items.add(itemInstance) + i += 1 + } + val newInstanceItems: FrozenList = FrozenList(items) + return newInstanceItems + } + + @Throws(ValidationException::class) + override fun validate(arg: List<*>, configuration: SchemaConfiguration?): FrozenList { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, PathToSchemasMap(), LinkedHashSet()) + val pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet) + return getNewInstance(castArg, validationMetadata.pathToItem, pathToSchemasMap) + } + + override fun getNewInstance(arg: Map<*, *>, pathToItem: List, pathToSchemas: PathToSchemasMap): FrozenMap { + val properties: LinkedHashMap = LinkedHashMap() + for((propertyName, value) in arg) { + if (!(propertyName is String)) { + throw RuntimeException("Invalid non-string key value") + } + val propertyPathToItem: List = pathToItem + propertyName + val schemas: LinkedHashMap, Nothing?>? = pathToSchemas.get(propertyPathToItem) + if (schemas == null) { + throw RuntimeException("Validation result is invalid, schemas must exist for a pathToItem") + } + val propertySchema: JsonSchema<*> = schemas.entries.iterator().next().key + val propertyInstance: Any? = propertySchema.getNewInstance(value, propertyPathToItem, pathToSchemas) + properties[propertyName] = propertyInstance + } + val castProperties: FrozenMap = FrozenMap(properties) + return castProperties + } + + @Throws(ValidationException::class) + override fun validate(arg: Map<*, *>, configuration: SchemaConfiguration?): FrozenMap { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validatedPathToSchemas = PathToSchemasMap() + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, LinkedHashSet()) + val pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet) + return getNewInstance(castArg, validationMetadata.pathToItem, pathToSchemasMap) + } + + @Throws(ValidationException::class) + override fun validate(arg: Any?, configuration: SchemaConfiguration?): Any? { + if (arg == null) { + return validate(null, configuration) + } else if (arg is Boolean) { + return validate(arg, configuration) + } else if (arg is Number) { + return validate(arg, configuration) + } else if (arg is String) { + return validate(arg, configuration) + } else if (arg is List<*>) { + return validate(arg, configuration) + } else if (arg is Map<*, *>) { + return validate(arg, configuration) + } + throw ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema") + } + override fun getNewInstance(arg: Any?, pathToItem: List, pathToSchemas: PathToSchemasMap): Any? { + if (arg == null) { + return getNewInstance( null, pathToItem, pathToSchemas) + } else if (arg is Boolean) { + return getNewInstance(arg, pathToItem, pathToSchemas) + } else if (arg is Number) { + return getNewInstance(arg, pathToItem, pathToSchemas) + } else if (arg is String) { + return getNewInstance(arg, pathToItem, pathToSchemas) + } else if (arg is List<*>) { + return getNewInstance(arg, pathToItem, pathToSchemas) + } else if (arg is Map<*, *>) { + return getNewInstance(arg, pathToItem, pathToSchemas) + } + throw RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema") + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: Nothing?, configuration: SchemaConfiguration?): PatternpropertiesWithNullValuedInstanceProperties1BoxedVoid { + return PatternpropertiesWithNullValuedInstanceProperties1BoxedVoid(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: Boolean, configuration: SchemaConfiguration?): PatternpropertiesWithNullValuedInstanceProperties1BoxedBoolean { + return PatternpropertiesWithNullValuedInstanceProperties1BoxedBoolean(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: Number, configuration: SchemaConfiguration?): PatternpropertiesWithNullValuedInstanceProperties1BoxedNumber { + return PatternpropertiesWithNullValuedInstanceProperties1BoxedNumber(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: String, configuration: SchemaConfiguration?): PatternpropertiesWithNullValuedInstanceProperties1BoxedString { + return PatternpropertiesWithNullValuedInstanceProperties1BoxedString(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: List<*>, configuration: SchemaConfiguration?): PatternpropertiesWithNullValuedInstanceProperties1BoxedList { + return PatternpropertiesWithNullValuedInstanceProperties1BoxedList(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: Map<*, *>, configuration: SchemaConfiguration?): PatternpropertiesWithNullValuedInstanceProperties1BoxedMap { + return PatternpropertiesWithNullValuedInstanceProperties1BoxedMap(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: Any?, configuration: SchemaConfiguration?): PatternpropertiesWithNullValuedInstanceProperties1Boxed { + if (arg == null) { + return validateAndBox(null, configuration) + } else if (arg is Boolean) { + return validateAndBox(arg, configuration) + } else if (arg is String) { + return validateAndBox(arg, configuration) + } else if (arg is Number) { + return validateAndBox(arg, configuration) + } else if (arg is List<*>) { + return validateAndBox(arg, configuration) + } else if (arg is Map<*, *>) { + return validateAndBox(arg, configuration) + } + throw ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema") + } + } +} diff --git a/samples/client/3_1_0_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/schemas/PrefixitemsValidationAdjustsTheStartingIndexForItems.kt b/samples/client/3_1_0_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/schemas/PrefixitemsValidationAdjustsTheStartingIndexForItems.kt new file mode 100644 index 00000000000..1b5398222d4 --- /dev/null +++ b/samples/client/3_1_0_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/schemas/PrefixitemsValidationAdjustsTheStartingIndexForItems.kt @@ -0,0 +1,187 @@ +package org.openapijsonschematools.client.components.schemas +import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags +import org.openapijsonschematools.client.configurations.SchemaConfiguration +import org.openapijsonschematools.client.exceptions.ValidationException +import org.openapijsonschematools.client.schemas.IntJsonSchema +import org.openapijsonschematools.client.schemas.StringJsonSchema +import org.openapijsonschematools.client.schemas.validation.FrozenList +import org.openapijsonschematools.client.schemas.validation.JsonSchema +import org.openapijsonschematools.client.schemas.validation.JsonSchemaInfo +import org.openapijsonschematools.client.schemas.validation.ListSchemaValidator +import org.openapijsonschematools.client.schemas.validation.PathToSchemasMap +import org.openapijsonschematools.client.schemas.validation.ValidationMetadata + +class PrefixitemsValidationAdjustsTheStartingIndexForItems { + // nest classes so all schemas and input/output classes can be public + + + class Items : IntJsonSchema.IntJsonSchema1() { + companion object { + @Volatile + private var instance: Items? = null + + fun getInstance() = + instance ?: synchronized(this) { + instance ?: Items().also { instance = it } + } + } + } + + + class PrefixitemsValidationAdjustsTheStartingIndexForItemsList(m: FrozenList) : FrozenList(m) { + companion object { + @Throws(ValidationException::class) + fun of(arg: List, configuration: SchemaConfiguration?): PrefixitemsValidationAdjustsTheStartingIndexForItemsList { + return PrefixitemsValidationAdjustsTheStartingIndexForItems1.getInstance().validate(arg, configuration) + } + } + } + + class PrefixitemsValidationAdjustsTheStartingIndexForItemsListBuilder { + // class to build List + private val list: MutableList + + init { + this.list = ArrayList() + } + + + fun add(item: Int): PrefixitemsValidationAdjustsTheStartingIndexForItemsListBuilder { + list.add(item) + return this + } + + fun add(item: Float): PrefixitemsValidationAdjustsTheStartingIndexForItemsListBuilder { + list.add(item) + return this + } + + fun add(item: Long): PrefixitemsValidationAdjustsTheStartingIndexForItemsListBuilder { + list.add(item) + return this + } + + fun add(item: Double): PrefixitemsValidationAdjustsTheStartingIndexForItemsListBuilder { + list.add(item) + return this + } + + fun add(item: String): PrefixitemsValidationAdjustsTheStartingIndexForItemsListBuilder { + list.add(item) + return this + } + + fun build(): List { + return list + } + } + + + class Schema0 : StringJsonSchema.StringJsonSchema1() { + companion object { + @Volatile + private var instance: Schema0? = null + + fun getInstance() = + instance ?: synchronized(this) { + instance ?: Schema0().also { instance = it } + } + } + } + + + sealed interface PrefixitemsValidationAdjustsTheStartingIndexForItems1Boxed { + fun getData(): Any? + } + + data class PrefixitemsValidationAdjustsTheStartingIndexForItems1BoxedList(val data: PrefixitemsValidationAdjustsTheStartingIndexForItemsList) : PrefixitemsValidationAdjustsTheStartingIndexForItems1Boxed { + override fun getData(): Any? { + return data + } + } + + + + class PrefixitemsValidationAdjustsTheStartingIndexForItems1 private constructor(): JsonSchema( + JsonSchemaInfo() + .type(setOf(List::class.java)) + .items(Items::class.java) + .prefixItems(listOf( + Schema0::class.java + )) + ), ListSchemaValidator { + /* + NOTE: This class is auto generated by OpenAPI JSON Schema Generator. + Ref: https://github.com/openapi-json-schema-tools/openapi-json-schema-generator + + Do not edit the class manually. + */ + + companion object { + @Volatile + private var instance: PrefixitemsValidationAdjustsTheStartingIndexForItems1? = null + + fun getInstance() = + instance ?: synchronized(this) { + instance ?: PrefixitemsValidationAdjustsTheStartingIndexForItems1().also { instance = it } + } + } + + override fun getNewInstance(arg: List<*>, pathToItem: List, pathToSchemas: PathToSchemasMap): PrefixitemsValidationAdjustsTheStartingIndexForItemsList { + val items: MutableList = ArrayList() + var i: Int = 0 + for (item: Any? in arg) { + val itemPathToItem: List = pathToItem + i + val schemas: LinkedHashMap, Nothing?>? = pathToSchemas.get(itemPathToItem) + if (schemas == null) { + throw RuntimeException("Validation result is invalid, schemas must exist for a pathToItem") + } + val itemSchema: JsonSchema<*> = schemas.entries.iterator().next().key + val itemInstance: Any? = itemSchema.getNewInstance(item, itemPathToItem, pathToSchemas) + if (!(itemInstance is Any)) { + throw RuntimeException("Invalid instantiated value") + } + items.add(itemInstance) + i += 1 + } + val newInstanceItems: FrozenList = FrozenList(items) + return PrefixitemsValidationAdjustsTheStartingIndexForItemsList(newInstanceItems) + } + + @Throws(ValidationException::class) + override fun validate(arg: List<*>, configuration: SchemaConfiguration?): PrefixitemsValidationAdjustsTheStartingIndexForItemsList { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, PathToSchemasMap(), LinkedHashSet()) + val pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet) + return getNewInstance(castArg, validationMetadata.pathToItem, pathToSchemasMap) + } + + @Throws(ValidationException::class) + override fun validate(arg: Any?, configuration: SchemaConfiguration?): Any? { + if (arg is List<*>) { + return validate(arg, configuration) + } + throw ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema") + } + override fun getNewInstance(arg: Any?, pathToItem: List, pathToSchemas: PathToSchemasMap): Any? { + if (arg is List<*>) { + return getNewInstance(arg, pathToItem, pathToSchemas) + } + throw RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema") + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: List<*>, configuration: SchemaConfiguration?): PrefixitemsValidationAdjustsTheStartingIndexForItems1BoxedList { + return PrefixitemsValidationAdjustsTheStartingIndexForItems1BoxedList(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: Any?, configuration: SchemaConfiguration?): PrefixitemsValidationAdjustsTheStartingIndexForItems1Boxed { + if (arg is List<*>) { + return validateAndBox(arg, configuration) + } + throw ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema") + } + } +} diff --git a/samples/client/3_1_0_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/schemas/PrefixitemsWithNullInstanceElements.kt b/samples/client/3_1_0_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/schemas/PrefixitemsWithNullInstanceElements.kt new file mode 100644 index 00000000000..d2d5dc39042 --- /dev/null +++ b/samples/client/3_1_0_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/schemas/PrefixitemsWithNullInstanceElements.kt @@ -0,0 +1,393 @@ +package org.openapijsonschematools.client.components.schemas +import java.time.LocalDate +import java.time.ZonedDateTime +import java.util.UUID +import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags +import org.openapijsonschematools.client.configurations.SchemaConfiguration +import org.openapijsonschematools.client.exceptions.InvalidAdditionalPropertyException +import org.openapijsonschematools.client.exceptions.UnsetPropertyException +import org.openapijsonschematools.client.exceptions.ValidationException +import org.openapijsonschematools.client.schemas.NullJsonSchema +import org.openapijsonschematools.client.schemas.UnsetAddPropsSetter +import org.openapijsonschematools.client.schemas.validation.BooleanSchemaValidator +import org.openapijsonschematools.client.schemas.validation.FrozenList +import org.openapijsonschematools.client.schemas.validation.FrozenMap +import org.openapijsonschematools.client.schemas.validation.JsonSchema +import org.openapijsonschematools.client.schemas.validation.JsonSchemaInfo +import org.openapijsonschematools.client.schemas.validation.ListSchemaValidator +import org.openapijsonschematools.client.schemas.validation.MapSchemaValidator +import org.openapijsonschematools.client.schemas.validation.NullSchemaValidator +import org.openapijsonschematools.client.schemas.validation.NumberSchemaValidator +import org.openapijsonschematools.client.schemas.validation.PathToSchemasMap +import org.openapijsonschematools.client.schemas.validation.StringSchemaValidator +import org.openapijsonschematools.client.schemas.validation.ValidationMetadata + +class PrefixitemsWithNullInstanceElements { + // nest classes so all schemas and input/output classes can be public + + + class PrefixitemsWithNullInstanceElementsList(m: FrozenList) : FrozenList(m) { + companion object { + @Throws(ValidationException::class) + fun of(arg: List, configuration: SchemaConfiguration?): PrefixitemsWithNullInstanceElementsList { + return PrefixitemsWithNullInstanceElements1.getInstance().validate(arg, configuration) + } + } + } + + class PrefixitemsWithNullInstanceElementsListBuilder { + // class to build List + private val list: MutableList + + init { + this.list = ArrayList() + } + + + fun add(item: Nothing?): PrefixitemsWithNullInstanceElementsListBuilder { + list.add(null) + return this + } + + fun add(item: Boolean): PrefixitemsWithNullInstanceElementsListBuilder { + list.add(item) + return this + } + + fun add(item: String): PrefixitemsWithNullInstanceElementsListBuilder { + list.add(item) + return this + } + + fun add(item: Int): PrefixitemsWithNullInstanceElementsListBuilder { + list.add(item) + return this + } + + fun add(item: Float): PrefixitemsWithNullInstanceElementsListBuilder { + list.add(item) + return this + } + + fun add(item: Long): PrefixitemsWithNullInstanceElementsListBuilder { + list.add(item) + return this + } + + fun add(item: Double): PrefixitemsWithNullInstanceElementsListBuilder { + list.add(item) + return this + } + + fun add(item: List<*>): PrefixitemsWithNullInstanceElementsListBuilder { + list.add(item) + return this + } + + fun add(item: Map): PrefixitemsWithNullInstanceElementsListBuilder { + list.add(item) + return this + } + + fun build(): List { + return list + } + } + + + class Schema0 : NullJsonSchema.NullJsonSchema1() { + companion object { + @Volatile + private var instance: Schema0? = null + + fun getInstance() = + instance ?: synchronized(this) { + instance ?: Schema0().also { instance = it } + } + } + } + + + sealed interface PrefixitemsWithNullInstanceElements1Boxed { + fun getData(): Any? + } + + data class PrefixitemsWithNullInstanceElements1BoxedVoid(val data: Nothing?) : PrefixitemsWithNullInstanceElements1Boxed { + override fun getData(): Any? { + return data + } + } + + data class PrefixitemsWithNullInstanceElements1BoxedBoolean(val data: Boolean): PrefixitemsWithNullInstanceElements1Boxed { + override fun getData(): Any? { + return data + } + } + + data class PrefixitemsWithNullInstanceElements1BoxedNumber(val data: Number) : PrefixitemsWithNullInstanceElements1Boxed { + override fun getData(): Any? { + return data + } + } + + data class PrefixitemsWithNullInstanceElements1BoxedString(val data: String) : PrefixitemsWithNullInstanceElements1Boxed { + override fun getData(): Any? { + return data + } + } + + data class PrefixitemsWithNullInstanceElements1BoxedList(val data: PrefixitemsWithNullInstanceElementsList) : PrefixitemsWithNullInstanceElements1Boxed { + override fun getData(): Any? { + return data + } + } + + data class PrefixitemsWithNullInstanceElements1BoxedMap(val data: FrozenMap) : PrefixitemsWithNullInstanceElements1Boxed { + override fun getData(): Any? { + return data + } + } + + + class PrefixitemsWithNullInstanceElements1 private constructor(): JsonSchema( + JsonSchemaInfo() + .prefixItems(listOf( + Schema0::class.java + )) + ), NullSchemaValidator, BooleanSchemaValidator, NumberSchemaValidator, StringSchemaValidator, ListSchemaValidator, MapSchemaValidator, PrefixitemsWithNullInstanceElements1BoxedMap> { + /* + NOTE: This class is auto generated by OpenAPI JSON Schema Generator. + Ref: https://github.com/openapi-json-schema-tools/openapi-json-schema-generator + + Do not edit the class manually. + */ + + companion object { + @Volatile + private var instance: PrefixitemsWithNullInstanceElements1? = null + + fun getInstance() = + instance ?: synchronized(this) { + instance ?: PrefixitemsWithNullInstanceElements1().also { instance = it } + } + } + + @Throws(ValidationException::class) + override fun validate(arg: Nothing?, configuration: SchemaConfiguration?): Nothing? { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validatedPathToSchemas = PathToSchemasMap() + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, LinkedHashSet()) + getPathToSchemas(this, castArg, validationMetadata, pathSet) + return castArg + } + + @Throws(ValidationException::class) + override fun validate(arg: Boolean, configuration: SchemaConfiguration?): Boolean { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validatedPathToSchemas = PathToSchemasMap() + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, LinkedHashSet()) + getPathToSchemas(this, castArg, validationMetadata, pathSet) + return castArg + } + + @Throws(ValidationException::class) + override fun validate(arg: Number, configuration: SchemaConfiguration?): Number { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validatedPathToSchemas = PathToSchemasMap() + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, LinkedHashSet()) + getPathToSchemas(this, castArg, validationMetadata, pathSet) + return castArg + } + + @Throws(ValidationException::class) + fun validate(arg: Int, configuration: SchemaConfiguration?): Int { + return validate(arg as Number, configuration) as Int + } + + @Throws(ValidationException::class) + fun validate(arg: Long, configuration: SchemaConfiguration?): Long { + return validate(arg as Number, configuration) as Long + } + + @Throws(ValidationException::class) + fun validate(arg: Float, configuration: SchemaConfiguration?): Float { + return validate(arg as Number, configuration) as Float + } + + @Throws(ValidationException::class) + fun validate(arg: Double, configuration: SchemaConfiguration?): Double { + return validate(arg as Number, configuration) as Double + } + + @Throws(ValidationException::class) + override fun validate(arg: String, configuration: SchemaConfiguration?): String { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validatedPathToSchemas = PathToSchemasMap() + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, LinkedHashSet()) + getPathToSchemas(this, castArg, validationMetadata, pathSet) + return castArg + } + + @Throws(ValidationException::class) + fun validate(arg: LocalDate, configuration: SchemaConfiguration?): String { + return validate(arg.toString(), configuration) + } + + @Throws(ValidationException::class) + fun validate(arg: ZonedDateTime, configuration: SchemaConfiguration?): String { + return validate(arg.toString(), configuration) + } + + @Throws(ValidationException::class) + fun validate(arg: UUID, configuration: SchemaConfiguration?): String { + return validate(arg.toString(), configuration) + } + + override fun getNewInstance(arg: List<*>, pathToItem: List, pathToSchemas: PathToSchemasMap): PrefixitemsWithNullInstanceElementsList { + val items: MutableList = ArrayList() + var i: Int = 0 + for (item: Any? in arg) { + val itemPathToItem = pathToItem + i + val schemas: LinkedHashMap, Nothing?>? = pathToSchemas.get(itemPathToItem) + if (schemas == null) { + throw RuntimeException("Validation result is invalid, schemas must exist for a pathToItem") + } + val itemSchema: JsonSchema<*> = schemas.entries.iterator().next().key + val itemInstance: Any? = itemSchema.getNewInstance(item, itemPathToItem, pathToSchemas) + items.add(itemInstance) + i += 1 + } + val newInstanceItems: FrozenList = FrozenList(items) + return PrefixitemsWithNullInstanceElementsList(newInstanceItems) + } + + @Throws(ValidationException::class) + override fun validate(arg: List<*>, configuration: SchemaConfiguration?): PrefixitemsWithNullInstanceElementsList { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, PathToSchemasMap(), LinkedHashSet()) + val pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet) + return getNewInstance(castArg, validationMetadata.pathToItem, pathToSchemasMap) + } + + override fun getNewInstance(arg: Map<*, *>, pathToItem: List, pathToSchemas: PathToSchemasMap): FrozenMap { + val properties: LinkedHashMap = LinkedHashMap() + for((propertyName, value) in arg) { + if (!(propertyName is String)) { + throw RuntimeException("Invalid non-string key value") + } + val propertyPathToItem: List = pathToItem + propertyName + val schemas: LinkedHashMap, Nothing?>? = pathToSchemas.get(propertyPathToItem) + if (schemas == null) { + throw RuntimeException("Validation result is invalid, schemas must exist for a pathToItem") + } + val propertySchema: JsonSchema<*> = schemas.entries.iterator().next().key + val propertyInstance: Any? = propertySchema.getNewInstance(value, propertyPathToItem, pathToSchemas) + properties[propertyName] = propertyInstance + } + val castProperties: FrozenMap = FrozenMap(properties) + return castProperties + } + + @Throws(ValidationException::class) + override fun validate(arg: Map<*, *>, configuration: SchemaConfiguration?): FrozenMap { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validatedPathToSchemas = PathToSchemasMap() + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, LinkedHashSet()) + val pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet) + return getNewInstance(castArg, validationMetadata.pathToItem, pathToSchemasMap) + } + + @Throws(ValidationException::class) + override fun validate(arg: Any?, configuration: SchemaConfiguration?): Any? { + if (arg == null) { + return validate(null, configuration) + } else if (arg is Boolean) { + return validate(arg, configuration) + } else if (arg is Number) { + return validate(arg, configuration) + } else if (arg is String) { + return validate(arg, configuration) + } else if (arg is List<*>) { + return validate(arg, configuration) + } else if (arg is Map<*, *>) { + return validate(arg, configuration) + } + throw ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema") + } + override fun getNewInstance(arg: Any?, pathToItem: List, pathToSchemas: PathToSchemasMap): Any? { + if (arg == null) { + return getNewInstance( null, pathToItem, pathToSchemas) + } else if (arg is Boolean) { + return getNewInstance(arg, pathToItem, pathToSchemas) + } else if (arg is Number) { + return getNewInstance(arg, pathToItem, pathToSchemas) + } else if (arg is String) { + return getNewInstance(arg, pathToItem, pathToSchemas) + } else if (arg is List<*>) { + return getNewInstance(arg, pathToItem, pathToSchemas) + } else if (arg is Map<*, *>) { + return getNewInstance(arg, pathToItem, pathToSchemas) + } + throw RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema") + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: Nothing?, configuration: SchemaConfiguration?): PrefixitemsWithNullInstanceElements1BoxedVoid { + return PrefixitemsWithNullInstanceElements1BoxedVoid(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: Boolean, configuration: SchemaConfiguration?): PrefixitemsWithNullInstanceElements1BoxedBoolean { + return PrefixitemsWithNullInstanceElements1BoxedBoolean(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: Number, configuration: SchemaConfiguration?): PrefixitemsWithNullInstanceElements1BoxedNumber { + return PrefixitemsWithNullInstanceElements1BoxedNumber(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: String, configuration: SchemaConfiguration?): PrefixitemsWithNullInstanceElements1BoxedString { + return PrefixitemsWithNullInstanceElements1BoxedString(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: List<*>, configuration: SchemaConfiguration?): PrefixitemsWithNullInstanceElements1BoxedList { + return PrefixitemsWithNullInstanceElements1BoxedList(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: Map<*, *>, configuration: SchemaConfiguration?): PrefixitemsWithNullInstanceElements1BoxedMap { + return PrefixitemsWithNullInstanceElements1BoxedMap(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: Any?, configuration: SchemaConfiguration?): PrefixitemsWithNullInstanceElements1Boxed { + if (arg == null) { + return validateAndBox(null, configuration) + } else if (arg is Boolean) { + return validateAndBox(arg, configuration) + } else if (arg is String) { + return validateAndBox(arg, configuration) + } else if (arg is Number) { + return validateAndBox(arg, configuration) + } else if (arg is List<*>) { + return validateAndBox(arg, configuration) + } else if (arg is Map<*, *>) { + return validateAndBox(arg, configuration) + } + throw ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema") + } + } +} diff --git a/samples/client/3_1_0_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/schemas/PropertiesPatternpropertiesAdditionalpropertiesInteraction.kt b/samples/client/3_1_0_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/schemas/PropertiesPatternpropertiesAdditionalpropertiesInteraction.kt new file mode 100644 index 00000000000..f134ed1414c --- /dev/null +++ b/samples/client/3_1_0_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/schemas/PropertiesPatternpropertiesAdditionalpropertiesInteraction.kt @@ -0,0 +1,654 @@ +package org.openapijsonschematools.client.components.schemas +import java.time.LocalDate +import java.time.ZonedDateTime +import java.util.AbstractMap +import java.util.UUID +import java.util.regex.Pattern +import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags +import org.openapijsonschematools.client.configurations.SchemaConfiguration +import org.openapijsonschematools.client.exceptions.InvalidAdditionalPropertyException +import org.openapijsonschematools.client.exceptions.UnsetPropertyException +import org.openapijsonschematools.client.exceptions.ValidationException +import org.openapijsonschematools.client.schemas.GenericBuilder +import org.openapijsonschematools.client.schemas.IntJsonSchema +import org.openapijsonschematools.client.schemas.ListJsonSchema +import org.openapijsonschematools.client.schemas.UnsetAddPropsSetter +import org.openapijsonschematools.client.schemas.validation.BooleanSchemaValidator +import org.openapijsonschematools.client.schemas.validation.FrozenList +import org.openapijsonschematools.client.schemas.validation.FrozenMap +import org.openapijsonschematools.client.schemas.validation.JsonSchema +import org.openapijsonschematools.client.schemas.validation.JsonSchemaInfo +import org.openapijsonschematools.client.schemas.validation.ListSchemaValidator +import org.openapijsonschematools.client.schemas.validation.MapSchemaValidator +import org.openapijsonschematools.client.schemas.validation.MapUtils +import org.openapijsonschematools.client.schemas.validation.NullSchemaValidator +import org.openapijsonschematools.client.schemas.validation.NumberSchemaValidator +import org.openapijsonschematools.client.schemas.validation.PathToSchemasMap +import org.openapijsonschematools.client.schemas.validation.StringSchemaValidator +import org.openapijsonschematools.client.schemas.validation.ValidationMetadata + +class PropertiesPatternpropertiesAdditionalpropertiesInteraction { + // nest classes so all schemas and input/output classes can be public + + + class AdditionalProperties : IntJsonSchema.IntJsonSchema1() { + companion object { + @Volatile + private var instance: AdditionalProperties? = null + + fun getInstance() = + instance ?: synchronized(this) { + instance ?: AdditionalProperties().also { instance = it } + } + } + } + + + sealed interface FoBoxed { + fun getData(): Any? + } + + data class FoBoxedVoid(val data: Nothing?) : FoBoxed { + override fun getData(): Any? { + return data + } + } + + data class FoBoxedBoolean(val data: Boolean): FoBoxed { + override fun getData(): Any? { + return data + } + } + + data class FoBoxedNumber(val data: Number) : FoBoxed { + override fun getData(): Any? { + return data + } + } + + data class FoBoxedString(val data: String) : FoBoxed { + override fun getData(): Any? { + return data + } + } + + data class FoBoxedList(val data: FrozenList) : FoBoxed { + override fun getData(): Any? { + return data + } + } + + data class FoBoxedMap(val data: FrozenMap) : FoBoxed { + override fun getData(): Any? { + return data + } + } + + + class Fo private constructor(): JsonSchema( + JsonSchemaInfo() + .minItems(2) + ), NullSchemaValidator, BooleanSchemaValidator, NumberSchemaValidator, StringSchemaValidator, ListSchemaValidator, FoBoxedList>, MapSchemaValidator, FoBoxedMap> { + + companion object { + @Volatile + private var instance: Fo? = null + + fun getInstance() = + instance ?: synchronized(this) { + instance ?: Fo().also { instance = it } + } + } + + @Throws(ValidationException::class) + override fun validate(arg: Nothing?, configuration: SchemaConfiguration?): Nothing? { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validatedPathToSchemas = PathToSchemasMap() + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, LinkedHashSet()) + getPathToSchemas(this, castArg, validationMetadata, pathSet) + return castArg + } + + @Throws(ValidationException::class) + override fun validate(arg: Boolean, configuration: SchemaConfiguration?): Boolean { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validatedPathToSchemas = PathToSchemasMap() + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, LinkedHashSet()) + getPathToSchemas(this, castArg, validationMetadata, pathSet) + return castArg + } + + @Throws(ValidationException::class) + override fun validate(arg: Number, configuration: SchemaConfiguration?): Number { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validatedPathToSchemas = PathToSchemasMap() + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, LinkedHashSet()) + getPathToSchemas(this, castArg, validationMetadata, pathSet) + return castArg + } + + @Throws(ValidationException::class) + fun validate(arg: Int, configuration: SchemaConfiguration?): Int { + return validate(arg as Number, configuration) as Int + } + + @Throws(ValidationException::class) + fun validate(arg: Long, configuration: SchemaConfiguration?): Long { + return validate(arg as Number, configuration) as Long + } + + @Throws(ValidationException::class) + fun validate(arg: Float, configuration: SchemaConfiguration?): Float { + return validate(arg as Number, configuration) as Float + } + + @Throws(ValidationException::class) + fun validate(arg: Double, configuration: SchemaConfiguration?): Double { + return validate(arg as Number, configuration) as Double + } + + @Throws(ValidationException::class) + override fun validate(arg: String, configuration: SchemaConfiguration?): String { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validatedPathToSchemas = PathToSchemasMap() + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, LinkedHashSet()) + getPathToSchemas(this, castArg, validationMetadata, pathSet) + return castArg + } + + @Throws(ValidationException::class) + fun validate(arg: LocalDate, configuration: SchemaConfiguration?): String { + return validate(arg.toString(), configuration) + } + + @Throws(ValidationException::class) + fun validate(arg: ZonedDateTime, configuration: SchemaConfiguration?): String { + return validate(arg.toString(), configuration) + } + + @Throws(ValidationException::class) + fun validate(arg: UUID, configuration: SchemaConfiguration?): String { + return validate(arg.toString(), configuration) + } + + override fun getNewInstance(arg: List<*>, pathToItem: List, pathToSchemas: PathToSchemasMap): FrozenList { + val items: MutableList = ArrayList() + var i: Int = 0 + for (item: Any? in arg) { + val itemPathToItem = pathToItem + i + val schemas: LinkedHashMap, Nothing?>? = pathToSchemas.get(itemPathToItem) + if (schemas == null) { + throw RuntimeException("Validation result is invalid, schemas must exist for a pathToItem") + } + val itemSchema: JsonSchema<*> = schemas.entries.iterator().next().key + val itemInstance: Any? = itemSchema.getNewInstance(item, itemPathToItem, pathToSchemas) + items.add(itemInstance) + i += 1 + } + val newInstanceItems: FrozenList = FrozenList(items) + return newInstanceItems + } + + @Throws(ValidationException::class) + override fun validate(arg: List<*>, configuration: SchemaConfiguration?): FrozenList { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, PathToSchemasMap(), LinkedHashSet()) + val pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet) + return getNewInstance(castArg, validationMetadata.pathToItem, pathToSchemasMap) + } + + override fun getNewInstance(arg: Map<*, *>, pathToItem: List, pathToSchemas: PathToSchemasMap): FrozenMap { + val properties: LinkedHashMap = LinkedHashMap() + for((propertyName, value) in arg) { + if (!(propertyName is String)) { + throw RuntimeException("Invalid non-string key value") + } + val propertyPathToItem: List = pathToItem + propertyName + val schemas: LinkedHashMap, Nothing?>? = pathToSchemas.get(propertyPathToItem) + if (schemas == null) { + throw RuntimeException("Validation result is invalid, schemas must exist for a pathToItem") + } + val propertySchema: JsonSchema<*> = schemas.entries.iterator().next().key + val propertyInstance: Any? = propertySchema.getNewInstance(value, propertyPathToItem, pathToSchemas) + properties[propertyName] = propertyInstance + } + val castProperties: FrozenMap = FrozenMap(properties) + return castProperties + } + + @Throws(ValidationException::class) + override fun validate(arg: Map<*, *>, configuration: SchemaConfiguration?): FrozenMap { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validatedPathToSchemas = PathToSchemasMap() + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, LinkedHashSet()) + val pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet) + return getNewInstance(castArg, validationMetadata.pathToItem, pathToSchemasMap) + } + + @Throws(ValidationException::class) + override fun validate(arg: Any?, configuration: SchemaConfiguration?): Any? { + if (arg == null) { + return validate(null, configuration) + } else if (arg is Boolean) { + return validate(arg, configuration) + } else if (arg is Number) { + return validate(arg, configuration) + } else if (arg is String) { + return validate(arg, configuration) + } else if (arg is List<*>) { + return validate(arg, configuration) + } else if (arg is Map<*, *>) { + return validate(arg, configuration) + } + throw ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema") + } + override fun getNewInstance(arg: Any?, pathToItem: List, pathToSchemas: PathToSchemasMap): Any? { + if (arg == null) { + return getNewInstance( null, pathToItem, pathToSchemas) + } else if (arg is Boolean) { + return getNewInstance(arg, pathToItem, pathToSchemas) + } else if (arg is Number) { + return getNewInstance(arg, pathToItem, pathToSchemas) + } else if (arg is String) { + return getNewInstance(arg, pathToItem, pathToSchemas) + } else if (arg is List<*>) { + return getNewInstance(arg, pathToItem, pathToSchemas) + } else if (arg is Map<*, *>) { + return getNewInstance(arg, pathToItem, pathToSchemas) + } + throw RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema") + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: Nothing?, configuration: SchemaConfiguration?): FoBoxedVoid { + return FoBoxedVoid(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: Boolean, configuration: SchemaConfiguration?): FoBoxedBoolean { + return FoBoxedBoolean(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: Number, configuration: SchemaConfiguration?): FoBoxedNumber { + return FoBoxedNumber(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: String, configuration: SchemaConfiguration?): FoBoxedString { + return FoBoxedString(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: List<*>, configuration: SchemaConfiguration?): FoBoxedList { + return FoBoxedList(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: Map<*, *>, configuration: SchemaConfiguration?): FoBoxedMap { + return FoBoxedMap(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: Any?, configuration: SchemaConfiguration?): FoBoxed { + if (arg == null) { + return validateAndBox(null, configuration) + } else if (arg is Boolean) { + return validateAndBox(arg, configuration) + } else if (arg is String) { + return validateAndBox(arg, configuration) + } else if (arg is Number) { + return validateAndBox(arg, configuration) + } else if (arg is List<*>) { + return validateAndBox(arg, configuration) + } else if (arg is Map<*, *>) { + return validateAndBox(arg, configuration) + } + throw ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema") + } + } + + sealed interface FooBoxed { + fun getData(): Any? + } + + data class FooBoxedList(val data: FrozenList) : FooBoxed { + override fun getData(): Any? { + return data + } + } + + + + class Foo private constructor(): JsonSchema( + JsonSchemaInfo() + .type(setOf(List::class.java)) + .maxItems(3) + ), ListSchemaValidator, FooBoxedList> { + + companion object { + @Volatile + private var instance: Foo? = null + + fun getInstance() = + instance ?: synchronized(this) { + instance ?: Foo().also { instance = it } + } + } + + override fun getNewInstance(arg: List<*>, pathToItem: List, pathToSchemas: PathToSchemasMap): FrozenList { + val items: MutableList = ArrayList() + var i: Int = 0 + for (item: Any? in arg) { + val itemPathToItem: List = pathToItem + i + val schemas: LinkedHashMap, Nothing?>? = pathToSchemas.get(itemPathToItem) + if (schemas == null) { + throw RuntimeException("Validation result is invalid, schemas must exist for a pathToItem") + } + val itemSchema: JsonSchema<*> = schemas.entries.iterator().next().key + val itemInstance: Any? = itemSchema.getNewInstance(item, itemPathToItem, pathToSchemas) + items.add(itemInstance) + i += 1 + } + val newInstanceItems: FrozenList = FrozenList(items) + return newInstanceItems + } + + @Throws(ValidationException::class) + override fun validate(arg: List<*>, configuration: SchemaConfiguration?): FrozenList { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, PathToSchemasMap(), LinkedHashSet()) + val pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet) + return getNewInstance(castArg, validationMetadata.pathToItem, pathToSchemasMap) + } + + @Throws(ValidationException::class) + override fun validate(arg: Any?, configuration: SchemaConfiguration?): Any? { + if (arg is List<*>) { + return validate(arg, configuration) + } + throw ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema") + } + override fun getNewInstance(arg: Any?, pathToItem: List, pathToSchemas: PathToSchemasMap): Any? { + if (arg is List<*>) { + return getNewInstance(arg, pathToItem, pathToSchemas) + } + throw RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema") + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: List<*>, configuration: SchemaConfiguration?): FooBoxedList { + return FooBoxedList(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: Any?, configuration: SchemaConfiguration?): FooBoxed { + if (arg is List<*>) { + return validateAndBox(arg, configuration) + } + throw ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema") + } + } + + class Bar : ListJsonSchema.ListJsonSchema1() { + companion object { + @Volatile + private var instance: Bar? = null + + fun getInstance() = + instance ?: synchronized(this) { + instance ?: Bar().also { instance = it } + } + } + } + + + class PropertiesPatternpropertiesAdditionalpropertiesInteractionMap(m: FrozenMap) : FrozenMap(m) { + companion object { + val requiredKeys: Set = setOf() + val optionalKeys: Set = setOf( + "foo", + "bar" + ) + @Throws(ValidationException::class) + fun of(arg: Map, configuration: SchemaConfiguration): PropertiesPatternpropertiesAdditionalpropertiesInteractionMap { + return PropertiesPatternpropertiesAdditionalpropertiesInteraction1.getInstance().validate(arg, configuration) + } + } + + @Throws(UnsetPropertyException::class) + fun foo(): FrozenList { + val key = "foo" + throwIfKeyNotPresent(key) + val value: Any = get(key) + if (!(value is FrozenList)) { + throw RuntimeException("Invalid value stored for foo") + } + return value + } + + @Throws(UnsetPropertyException::class) + fun bar(): FrozenList { + val key = "bar" + throwIfKeyNotPresent(key) + val value: Any = get(key) + if (!(value is FrozenList)) { + throw RuntimeException("Invalid value stored for bar") + } + return value + } + + @Throws(UnsetPropertyException::class, InvalidAdditionalPropertyException::class) + fun getAdditionalProperty(name: String): Number { + throwIfKeyKnown(name, requiredKeys, optionalKeys) + val value = getOrThrow(name) + if (!(value is Number)) { + throw RuntimeException("Invalid value stored for " + name) + } + return value + } + } + + interface SetterForFoo { + fun getInstance(): MutableMap + fun getBuilderAfterFoo(instance: MutableMap): T + + fun foo(value: List): T { + val instance = getInstance() + instance["foo"] = value + return getBuilderAfterFoo(instance) + } + } + + interface SetterForBar { + fun getInstance(): MutableMap + fun getBuilderAfterBar(instance: MutableMap): T + + fun bar(value: List): T { + val instance = getInstance() + instance["bar"] = value + return getBuilderAfterBar(instance) + } + } + + interface SetterForAdditionalProperties { + fun getKnownKeys(): Set + fun getInstance(): MutableMap + fun getBuilderAfterAdditionalProperty(instance: MutableMap): T + + @Throws(InvalidAdditionalPropertyException::class) + fun additionalProperty(key: String, value: Int): T { + MapUtils.throwIfKeyKnown(key, getKnownKeys(), true) + val instance = getInstance() + instance[key] = value + return getBuilderAfterAdditionalProperty(instance) + } + + @Throws(InvalidAdditionalPropertyException::class) + fun additionalProperty(key: String, value: Float): T { + MapUtils.throwIfKeyKnown(key, getKnownKeys(), true) + val instance = getInstance() + instance[key] = value + return getBuilderAfterAdditionalProperty(instance) + } + + @Throws(InvalidAdditionalPropertyException::class) + fun additionalProperty(key: String, value: Long): T { + MapUtils.throwIfKeyKnown(key, getKnownKeys(), true) + val instance = getInstance() + instance[key] = value + return getBuilderAfterAdditionalProperty(instance) + } + + @Throws(InvalidAdditionalPropertyException::class) + fun additionalProperty(key: String, value: Double): T { + MapUtils.throwIfKeyKnown(key, getKnownKeys(), true) + val instance = getInstance() + instance[key] = value + return getBuilderAfterAdditionalProperty(instance) + } + } + + class PropertiesPatternpropertiesAdditionalpropertiesInteractionMapBuilder: GenericBuilder>, SetterForFoo, SetterForBar, SetterForAdditionalProperties { + private val knownKeys: Set = setOf( + "foo", + "bar" + ) + override fun getKnownKeys(): Set { + return knownKeys + } + private val instance: MutableMap + init { + this.instance = LinkedHashMap() + } + override fun build(): Map { + return instance + } + override fun getInstance(): MutableMap { + return instance + } + override fun getBuilderAfterFoo(instance: MutableMap): PropertiesPatternpropertiesAdditionalpropertiesInteractionMapBuilder { + return this + } + override fun getBuilderAfterBar(instance: MutableMap): PropertiesPatternpropertiesAdditionalpropertiesInteractionMapBuilder { + return this + } + override fun getBuilderAfterAdditionalProperty(instance: MutableMap): PropertiesPatternpropertiesAdditionalpropertiesInteractionMapBuilder { + return this + } + } + + + sealed interface PropertiesPatternpropertiesAdditionalpropertiesInteraction1Boxed { + fun getData(): Any? + } + + data class PropertiesPatternpropertiesAdditionalpropertiesInteraction1BoxedMap(val data: PropertiesPatternpropertiesAdditionalpropertiesInteractionMap) : PropertiesPatternpropertiesAdditionalpropertiesInteraction1Boxed { + override fun getData(): Any? { + return data + } + } + + + class PropertiesPatternpropertiesAdditionalpropertiesInteraction1 private constructor(): JsonSchema( + JsonSchemaInfo() + .type(setOf(Map::class.java)) + .properties(mapOf( + "foo" to Foo::class.java, + "bar" to Bar::class.java + )) + .additionalProperties(AdditionalProperties::class.java) + .patternProperties(mapOf( + new AbstractMap.SimpleEntry<>(Pattern.compile("f.o"), Fo::class.java) + )) + ), MapSchemaValidator { + /* + NOTE: This class is auto generated by OpenAPI JSON Schema Generator. + Ref: https://github.com/openapi-json-schema-tools/openapi-json-schema-generator + + Do not edit the class manually. + */ + + companion object { + @Volatile + private var instance: PropertiesPatternpropertiesAdditionalpropertiesInteraction1? = null + + fun getInstance() = + instance ?: synchronized(this) { + instance ?: PropertiesPatternpropertiesAdditionalpropertiesInteraction1().also { instance = it } + } + } + + override fun getNewInstance(arg: Map<*, *>, pathToItem: List, pathToSchemas: PathToSchemasMap): PropertiesPatternpropertiesAdditionalpropertiesInteractionMap { + val properties: LinkedHashMap = LinkedHashMap() + for((entryKey, value) in arg) { + if (!(entryKey is String)) { + throw RuntimeException("Invalid non-string key value") + } + val propertyPathToItem: List = pathToItem + entryKey + val schemas: LinkedHashMap, Nothing?>? = pathToSchemas.get(propertyPathToItem) + if (schemas == null) { + throw RuntimeException("Validation result is invalid, schemas must exist for a pathToItem") + } + val propertySchema: JsonSchema<*> = schemas.entries.iterator().next().key + val propertyInstance: Any? = propertySchema.getNewInstance(value, propertyPathToItem, pathToSchemas) + if (!(propertyInstance is Any)) { + throw RuntimeException("Invalid instantiated value") + } + properties[entryKey] = propertyInstance + } + val castProperties: FrozenMap = FrozenMap(properties) + return PropertiesPatternpropertiesAdditionalpropertiesInteractionMap(castProperties) + } + + @Throws(ValidationException::class) + override fun validate(arg: Map<*, *>, configuration: SchemaConfiguration?): PropertiesPatternpropertiesAdditionalpropertiesInteractionMap { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, PathToSchemasMap(), LinkedHashSet()) + val pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet) + return getNewInstance(castArg, validationMetadata.pathToItem, pathToSchemasMap) + } + + + @Throws(ValidationException::class) + override fun validate(arg: Any?, configuration: SchemaConfiguration?): Any? { + if (arg is Map<*, *>) { + return validate(arg, configuration) + } + throw ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema") + } + override fun getNewInstance(arg: Any?, pathToItem: List, pathToSchemas: PathToSchemasMap): Any? { + if (arg is Map<*, *>) { + return getNewInstance(arg, pathToItem, pathToSchemas) + } + throw RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema") + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: Map<*, *>, configuration: SchemaConfiguration?): PropertiesPatternpropertiesAdditionalpropertiesInteraction1BoxedMap { + return PropertiesPatternpropertiesAdditionalpropertiesInteraction1BoxedMap(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: Any?, configuration: SchemaConfiguration?): PropertiesPatternpropertiesAdditionalpropertiesInteraction1Boxed { + if (arg is Map<*, *>) { + return validateAndBox(arg, configuration) + } + throw ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema") + } + } + +} diff --git a/samples/client/3_1_0_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/schemas/PropertiesWhoseNamesAreJavascriptObjectPropertyNames.kt b/samples/client/3_1_0_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/schemas/PropertiesWhoseNamesAreJavascriptObjectPropertyNames.kt new file mode 100644 index 00000000000..e421b3615e8 --- /dev/null +++ b/samples/client/3_1_0_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/schemas/PropertiesWhoseNamesAreJavascriptObjectPropertyNames.kt @@ -0,0 +1,883 @@ +package org.openapijsonschematools.client.components.schemas +import java.time.LocalDate +import java.time.ZonedDateTime +import java.util.UUID +import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags +import org.openapijsonschematools.client.configurations.SchemaConfiguration +import org.openapijsonschematools.client.exceptions.InvalidAdditionalPropertyException +import org.openapijsonschematools.client.exceptions.UnsetPropertyException +import org.openapijsonschematools.client.exceptions.ValidationException +import org.openapijsonschematools.client.schemas.GenericBuilder +import org.openapijsonschematools.client.schemas.NumberJsonSchema +import org.openapijsonschematools.client.schemas.StringJsonSchema +import org.openapijsonschematools.client.schemas.UnsetAddPropsSetter +import org.openapijsonschematools.client.schemas.validation.BooleanSchemaValidator +import org.openapijsonschematools.client.schemas.validation.FrozenList +import org.openapijsonschematools.client.schemas.validation.FrozenMap +import org.openapijsonschematools.client.schemas.validation.JsonSchema +import org.openapijsonschematools.client.schemas.validation.JsonSchemaInfo +import org.openapijsonschematools.client.schemas.validation.ListSchemaValidator +import org.openapijsonschematools.client.schemas.validation.MapSchemaValidator +import org.openapijsonschematools.client.schemas.validation.NullSchemaValidator +import org.openapijsonschematools.client.schemas.validation.NumberSchemaValidator +import org.openapijsonschematools.client.schemas.validation.PathToSchemasMap +import org.openapijsonschematools.client.schemas.validation.StringSchemaValidator +import org.openapijsonschematools.client.schemas.validation.ValidationMetadata + +class PropertiesWhoseNamesAreJavascriptObjectPropertyNames { + // nest classes so all schemas and input/output classes can be public + + + class Proto : NumberJsonSchema.NumberJsonSchema1() { + companion object { + @Volatile + private var instance: Proto? = null + + fun getInstance() = + instance ?: synchronized(this) { + instance ?: Proto().also { instance = it } + } + } + } + + + class Length : StringJsonSchema.StringJsonSchema1() { + companion object { + @Volatile + private var instance: Length? = null + + fun getInstance() = + instance ?: synchronized(this) { + instance ?: Length().also { instance = it } + } + } + } + + + class ToStringMap(m: FrozenMap) : FrozenMap(m) { + companion object { + val requiredKeys: Set = setOf() + val optionalKeys: Set = setOf( + "length" + ) + @Throws(ValidationException::class) + fun of(arg: Map, configuration: SchemaConfiguration): ToStringMap { + return ToString.getInstance().validate(arg, configuration) + } + } + + @Throws(UnsetPropertyException::class) + fun length(): String { + val key = "length" + throwIfKeyNotPresent(key) + val value: Any? = get(key) + if (!(value is String)) { + throw RuntimeException("Invalid value stored for length") + } + return value + } + + @Throws(UnsetPropertyException::class, InvalidAdditionalPropertyException::class) + fun getAdditionalProperty(name: String): Any? { + throwIfKeyKnown(name, requiredKeys, optionalKeys) + throwIfKeyNotPresent(name) + return get(name) + } + } + + interface SetterForLength { + fun getInstance(): MutableMap + fun getBuilderAfterLength(instance: MutableMap): T + + fun length(value: String): T { + val instance = getInstance() + instance["length"] = value + return getBuilderAfterLength(instance) + } + } + + class ToStringMapBuilder: UnsetAddPropsSetter, GenericBuilder>, SetterForLength { + private val knownKeys: Set = setOf( + "length" + ) + override fun getKnownKeys(): Set { + return knownKeys + } + private val instance: MutableMap + init { + this.instance = LinkedHashMap() + } + override fun build(): Map { + return instance + } + override fun getInstance(): MutableMap { + return instance + } + override fun getBuilderAfterLength(instance: MutableMap): ToStringMapBuilder { + return this + } + override fun getBuilderAfterAdditionalProperty(instance: MutableMap): ToStringMapBuilder { + return this + } + } + + + sealed interface ToStringBoxed { + fun getData(): Any? + } + + data class ToStringBoxedVoid(val data: Nothing?) : ToStringBoxed { + override fun getData(): Any? { + return data + } + } + + data class ToStringBoxedBoolean(val data: Boolean): ToStringBoxed { + override fun getData(): Any? { + return data + } + } + + data class ToStringBoxedNumber(val data: Number) : ToStringBoxed { + override fun getData(): Any? { + return data + } + } + + data class ToStringBoxedString(val data: String) : ToStringBoxed { + override fun getData(): Any? { + return data + } + } + + data class ToStringBoxedList(val data: FrozenList) : ToStringBoxed { + override fun getData(): Any? { + return data + } + } + + data class ToStringBoxedMap(val data: ToStringMap) : ToStringBoxed { + override fun getData(): Any? { + return data + } + } + + + class ToString private constructor(): JsonSchema( + JsonSchemaInfo() + .properties(mapOf( + "length" to Length::class.java + )) + ), NullSchemaValidator, BooleanSchemaValidator, NumberSchemaValidator, StringSchemaValidator, ListSchemaValidator, ToStringBoxedList>, MapSchemaValidator { + + companion object { + @Volatile + private var instance: ToString? = null + + fun getInstance() = + instance ?: synchronized(this) { + instance ?: ToString().also { instance = it } + } + } + + @Throws(ValidationException::class) + override fun validate(arg: Nothing?, configuration: SchemaConfiguration?): Nothing? { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validatedPathToSchemas = PathToSchemasMap() + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, LinkedHashSet()) + getPathToSchemas(this, castArg, validationMetadata, pathSet) + return castArg + } + + @Throws(ValidationException::class) + override fun validate(arg: Boolean, configuration: SchemaConfiguration?): Boolean { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validatedPathToSchemas = PathToSchemasMap() + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, LinkedHashSet()) + getPathToSchemas(this, castArg, validationMetadata, pathSet) + return castArg + } + + @Throws(ValidationException::class) + override fun validate(arg: Number, configuration: SchemaConfiguration?): Number { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validatedPathToSchemas = PathToSchemasMap() + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, LinkedHashSet()) + getPathToSchemas(this, castArg, validationMetadata, pathSet) + return castArg + } + + @Throws(ValidationException::class) + fun validate(arg: Int, configuration: SchemaConfiguration?): Int { + return validate(arg as Number, configuration) as Int + } + + @Throws(ValidationException::class) + fun validate(arg: Long, configuration: SchemaConfiguration?): Long { + return validate(arg as Number, configuration) as Long + } + + @Throws(ValidationException::class) + fun validate(arg: Float, configuration: SchemaConfiguration?): Float { + return validate(arg as Number, configuration) as Float + } + + @Throws(ValidationException::class) + fun validate(arg: Double, configuration: SchemaConfiguration?): Double { + return validate(arg as Number, configuration) as Double + } + + @Throws(ValidationException::class) + override fun validate(arg: String, configuration: SchemaConfiguration?): String { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validatedPathToSchemas = PathToSchemasMap() + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, LinkedHashSet()) + getPathToSchemas(this, castArg, validationMetadata, pathSet) + return castArg + } + + @Throws(ValidationException::class) + fun validate(arg: LocalDate, configuration: SchemaConfiguration?): String { + return validate(arg.toString(), configuration) + } + + @Throws(ValidationException::class) + fun validate(arg: ZonedDateTime, configuration: SchemaConfiguration?): String { + return validate(arg.toString(), configuration) + } + + @Throws(ValidationException::class) + fun validate(arg: UUID, configuration: SchemaConfiguration?): String { + return validate(arg.toString(), configuration) + } + + override fun getNewInstance(arg: List<*>, pathToItem: List, pathToSchemas: PathToSchemasMap): FrozenList { + val items: MutableList = ArrayList() + var i: Int = 0 + for (item: Any? in arg) { + val itemPathToItem = pathToItem + i + val schemas: LinkedHashMap, Nothing?>? = pathToSchemas.get(itemPathToItem) + if (schemas == null) { + throw RuntimeException("Validation result is invalid, schemas must exist for a pathToItem") + } + val itemSchema: JsonSchema<*> = schemas.entries.iterator().next().key + val itemInstance: Any? = itemSchema.getNewInstance(item, itemPathToItem, pathToSchemas) + items.add(itemInstance) + i += 1 + } + val newInstanceItems: FrozenList = FrozenList(items) + return newInstanceItems + } + + @Throws(ValidationException::class) + override fun validate(arg: List<*>, configuration: SchemaConfiguration?): FrozenList { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, PathToSchemasMap(), LinkedHashSet()) + val pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet) + return getNewInstance(castArg, validationMetadata.pathToItem, pathToSchemasMap) + } + + override fun getNewInstance(arg: Map<*, *>, pathToItem: List, pathToSchemas: PathToSchemasMap): ToStringMap { + val properties: LinkedHashMap = LinkedHashMap() + for((propertyName, value) in arg) { + if (!(propertyName is String)) { + throw RuntimeException("Invalid non-string key value") + } + val propertyPathToItem: List = pathToItem + propertyName + val schemas: LinkedHashMap, Nothing?>? = pathToSchemas.get(propertyPathToItem) + if (schemas == null) { + throw RuntimeException("Validation result is invalid, schemas must exist for a pathToItem") + } + val propertySchema: JsonSchema<*> = schemas.entries.iterator().next().key + val propertyInstance: Any? = propertySchema.getNewInstance(value, propertyPathToItem, pathToSchemas) + properties[propertyName] = propertyInstance + } + val castProperties: FrozenMap = FrozenMap(properties) + return ToStringMap(castProperties) + } + + @Throws(ValidationException::class) + override fun validate(arg: Map<*, *>, configuration: SchemaConfiguration?): ToStringMap { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validatedPathToSchemas = PathToSchemasMap() + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, LinkedHashSet()) + val pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet) + return getNewInstance(castArg, validationMetadata.pathToItem, pathToSchemasMap) + } + + @Throws(ValidationException::class) + override fun validate(arg: Any?, configuration: SchemaConfiguration?): Any? { + if (arg == null) { + return validate(null, configuration) + } else if (arg is Boolean) { + return validate(arg, configuration) + } else if (arg is Number) { + return validate(arg, configuration) + } else if (arg is String) { + return validate(arg, configuration) + } else if (arg is List<*>) { + return validate(arg, configuration) + } else if (arg is Map<*, *>) { + return validate(arg, configuration) + } + throw ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema") + } + override fun getNewInstance(arg: Any?, pathToItem: List, pathToSchemas: PathToSchemasMap): Any? { + if (arg == null) { + return getNewInstance( null, pathToItem, pathToSchemas) + } else if (arg is Boolean) { + return getNewInstance(arg, pathToItem, pathToSchemas) + } else if (arg is Number) { + return getNewInstance(arg, pathToItem, pathToSchemas) + } else if (arg is String) { + return getNewInstance(arg, pathToItem, pathToSchemas) + } else if (arg is List<*>) { + return getNewInstance(arg, pathToItem, pathToSchemas) + } else if (arg is Map<*, *>) { + return getNewInstance(arg, pathToItem, pathToSchemas) + } + throw RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema") + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: Nothing?, configuration: SchemaConfiguration?): ToStringBoxedVoid { + return ToStringBoxedVoid(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: Boolean, configuration: SchemaConfiguration?): ToStringBoxedBoolean { + return ToStringBoxedBoolean(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: Number, configuration: SchemaConfiguration?): ToStringBoxedNumber { + return ToStringBoxedNumber(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: String, configuration: SchemaConfiguration?): ToStringBoxedString { + return ToStringBoxedString(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: List<*>, configuration: SchemaConfiguration?): ToStringBoxedList { + return ToStringBoxedList(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: Map<*, *>, configuration: SchemaConfiguration?): ToStringBoxedMap { + return ToStringBoxedMap(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: Any?, configuration: SchemaConfiguration?): ToStringBoxed { + if (arg == null) { + return validateAndBox(null, configuration) + } else if (arg is Boolean) { + return validateAndBox(arg, configuration) + } else if (arg is String) { + return validateAndBox(arg, configuration) + } else if (arg is Number) { + return validateAndBox(arg, configuration) + } else if (arg is List<*>) { + return validateAndBox(arg, configuration) + } else if (arg is Map<*, *>) { + return validateAndBox(arg, configuration) + } + throw ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema") + } + } + + class ConstructorSchema : NumberJsonSchema.NumberJsonSchema1() { + companion object { + @Volatile + private var instance: ConstructorSchema? = null + + fun getInstance() = + instance ?: synchronized(this) { + instance ?: ConstructorSchema().also { instance = it } + } + } + } + + + class PropertiesWhoseNamesAreJavascriptObjectPropertyNamesMap(m: FrozenMap) : FrozenMap(m) { + companion object { + val requiredKeys: Set = setOf() + val optionalKeys: Set = setOf( + "__proto__", + "toString", + "constructor" + ) + @Throws(ValidationException::class) + fun of(arg: Map, configuration: SchemaConfiguration): PropertiesWhoseNamesAreJavascriptObjectPropertyNamesMap { + return PropertiesWhoseNamesAreJavascriptObjectPropertyNames1.getInstance().validate(arg, configuration) + } + } + + @Throws(UnsetPropertyException::class) + fun toString(): Any? { + val key = "toString" + throwIfKeyNotPresent(key) + val value: Any? = get(key) + if (!(value is Any)) { + throw RuntimeException("Invalid value stored for toString") + } + return value + } + + @Throws(UnsetPropertyException::class, InvalidAdditionalPropertyException::class) + fun getAdditionalProperty(name: String): Any? { + throwIfKeyKnown(name, requiredKeys, optionalKeys) + throwIfKeyNotPresent(name) + return get(name) + } + } + + interface SetterForProto { + fun getInstance(): MutableMap + fun getBuilderAfterProto(instance: MutableMap): T + + fun lowLineProto(value: Int): T { + val instance = getInstance() + instance["__proto__"] = value + return getBuilderAfterProto(instance) + } + + fun lowLineProto(value: Float): T { + val instance = getInstance() + instance["__proto__"] = value + return getBuilderAfterProto(instance) + } + + fun lowLineProto(value: Long): T { + val instance = getInstance() + instance["__proto__"] = value + return getBuilderAfterProto(instance) + } + + fun lowLineProto(value: Double): T { + val instance = getInstance() + instance["__proto__"] = value + return getBuilderAfterProto(instance) + } + } + + interface SetterForToString { + fun getInstance(): MutableMap + fun getBuilderAfterToString(instance: MutableMap): T + + fun toString(value: Nothing?): T { + val instance = getInstance() + instance["toString"] = null + return getBuilderAfterToString(instance) + } + + fun toString(value: Boolean): T { + val instance = getInstance() + instance["toString"] = value + return getBuilderAfterToString(instance) + } + + fun toString(value: String): T { + val instance = getInstance() + instance["toString"] = value + return getBuilderAfterToString(instance) + } + + fun toString(value: Int): T { + val instance = getInstance() + instance["toString"] = value + return getBuilderAfterToString(instance) + } + + fun toString(value: Float): T { + val instance = getInstance() + instance["toString"] = value + return getBuilderAfterToString(instance) + } + + fun toString(value: Long): T { + val instance = getInstance() + instance["toString"] = value + return getBuilderAfterToString(instance) + } + + fun toString(value: Double): T { + val instance = getInstance() + instance["toString"] = value + return getBuilderAfterToString(instance) + } + + fun toString(value: List): T { + val instance = getInstance() + instance["toString"] = value + return getBuilderAfterToString(instance) + } + + fun toString(value: Map): T { + val instance = getInstance() + instance["toString"] = value + return getBuilderAfterToString(instance) + } + } + + interface SetterForConstructorSchema { + fun getInstance(): MutableMap + fun getBuilderAfterConstructorSchema(instance: MutableMap): T + + fun setConstructor(value: Int): T { + val instance = getInstance() + instance["constructor"] = value + return getBuilderAfterConstructorSchema(instance) + } + + fun setConstructor(value: Float): T { + val instance = getInstance() + instance["constructor"] = value + return getBuilderAfterConstructorSchema(instance) + } + + fun setConstructor(value: Long): T { + val instance = getInstance() + instance["constructor"] = value + return getBuilderAfterConstructorSchema(instance) + } + + fun setConstructor(value: Double): T { + val instance = getInstance() + instance["constructor"] = value + return getBuilderAfterConstructorSchema(instance) + } + } + + class PropertiesWhoseNamesAreJavascriptObjectPropertyNamesMapBuilder: UnsetAddPropsSetter, GenericBuilder>, SetterForProto, SetterForToString, SetterForConstructorSchema { + private val knownKeys: Set = setOf( + "__proto__", + "toString", + "constructor" + ) + override fun getKnownKeys(): Set { + return knownKeys + } + private val instance: MutableMap + init { + this.instance = LinkedHashMap() + } + override fun build(): Map { + return instance + } + override fun getInstance(): MutableMap { + return instance + } + override fun getBuilderAfterProto(instance: MutableMap): PropertiesWhoseNamesAreJavascriptObjectPropertyNamesMapBuilder { + return this + } + override fun getBuilderAfterToString(instance: MutableMap): PropertiesWhoseNamesAreJavascriptObjectPropertyNamesMapBuilder { + return this + } + override fun getBuilderAfterConstructorSchema(instance: MutableMap): PropertiesWhoseNamesAreJavascriptObjectPropertyNamesMapBuilder { + return this + } + override fun getBuilderAfterAdditionalProperty(instance: MutableMap): PropertiesWhoseNamesAreJavascriptObjectPropertyNamesMapBuilder { + return this + } + } + + + sealed interface PropertiesWhoseNamesAreJavascriptObjectPropertyNames1Boxed { + fun getData(): Any? + } + + data class PropertiesWhoseNamesAreJavascriptObjectPropertyNames1BoxedVoid(val data: Nothing?) : PropertiesWhoseNamesAreJavascriptObjectPropertyNames1Boxed { + override fun getData(): Any? { + return data + } + } + + data class PropertiesWhoseNamesAreJavascriptObjectPropertyNames1BoxedBoolean(val data: Boolean): PropertiesWhoseNamesAreJavascriptObjectPropertyNames1Boxed { + override fun getData(): Any? { + return data + } + } + + data class PropertiesWhoseNamesAreJavascriptObjectPropertyNames1BoxedNumber(val data: Number) : PropertiesWhoseNamesAreJavascriptObjectPropertyNames1Boxed { + override fun getData(): Any? { + return data + } + } + + data class PropertiesWhoseNamesAreJavascriptObjectPropertyNames1BoxedString(val data: String) : PropertiesWhoseNamesAreJavascriptObjectPropertyNames1Boxed { + override fun getData(): Any? { + return data + } + } + + data class PropertiesWhoseNamesAreJavascriptObjectPropertyNames1BoxedList(val data: FrozenList) : PropertiesWhoseNamesAreJavascriptObjectPropertyNames1Boxed { + override fun getData(): Any? { + return data + } + } + + data class PropertiesWhoseNamesAreJavascriptObjectPropertyNames1BoxedMap(val data: PropertiesWhoseNamesAreJavascriptObjectPropertyNamesMap) : PropertiesWhoseNamesAreJavascriptObjectPropertyNames1Boxed { + override fun getData(): Any? { + return data + } + } + + + class PropertiesWhoseNamesAreJavascriptObjectPropertyNames1 private constructor(): JsonSchema( + JsonSchemaInfo() + .properties(mapOf( + "__proto__" to Proto::class.java, + "toString" to ToString::class.java, + "constructor" to ConstructorSchema::class.java + )) + ), NullSchemaValidator, BooleanSchemaValidator, NumberSchemaValidator, StringSchemaValidator, ListSchemaValidator, PropertiesWhoseNamesAreJavascriptObjectPropertyNames1BoxedList>, MapSchemaValidator { + /* + NOTE: This class is auto generated by OpenAPI JSON Schema Generator. + Ref: https://github.com/openapi-json-schema-tools/openapi-json-schema-generator + + Do not edit the class manually. + */ + + companion object { + @Volatile + private var instance: PropertiesWhoseNamesAreJavascriptObjectPropertyNames1? = null + + fun getInstance() = + instance ?: synchronized(this) { + instance ?: PropertiesWhoseNamesAreJavascriptObjectPropertyNames1().also { instance = it } + } + } + + @Throws(ValidationException::class) + override fun validate(arg: Nothing?, configuration: SchemaConfiguration?): Nothing? { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validatedPathToSchemas = PathToSchemasMap() + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, LinkedHashSet()) + getPathToSchemas(this, castArg, validationMetadata, pathSet) + return castArg + } + + @Throws(ValidationException::class) + override fun validate(arg: Boolean, configuration: SchemaConfiguration?): Boolean { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validatedPathToSchemas = PathToSchemasMap() + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, LinkedHashSet()) + getPathToSchemas(this, castArg, validationMetadata, pathSet) + return castArg + } + + @Throws(ValidationException::class) + override fun validate(arg: Number, configuration: SchemaConfiguration?): Number { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validatedPathToSchemas = PathToSchemasMap() + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, LinkedHashSet()) + getPathToSchemas(this, castArg, validationMetadata, pathSet) + return castArg + } + + @Throws(ValidationException::class) + fun validate(arg: Int, configuration: SchemaConfiguration?): Int { + return validate(arg as Number, configuration) as Int + } + + @Throws(ValidationException::class) + fun validate(arg: Long, configuration: SchemaConfiguration?): Long { + return validate(arg as Number, configuration) as Long + } + + @Throws(ValidationException::class) + fun validate(arg: Float, configuration: SchemaConfiguration?): Float { + return validate(arg as Number, configuration) as Float + } + + @Throws(ValidationException::class) + fun validate(arg: Double, configuration: SchemaConfiguration?): Double { + return validate(arg as Number, configuration) as Double + } + + @Throws(ValidationException::class) + override fun validate(arg: String, configuration: SchemaConfiguration?): String { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validatedPathToSchemas = PathToSchemasMap() + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, LinkedHashSet()) + getPathToSchemas(this, castArg, validationMetadata, pathSet) + return castArg + } + + @Throws(ValidationException::class) + fun validate(arg: LocalDate, configuration: SchemaConfiguration?): String { + return validate(arg.toString(), configuration) + } + + @Throws(ValidationException::class) + fun validate(arg: ZonedDateTime, configuration: SchemaConfiguration?): String { + return validate(arg.toString(), configuration) + } + + @Throws(ValidationException::class) + fun validate(arg: UUID, configuration: SchemaConfiguration?): String { + return validate(arg.toString(), configuration) + } + + override fun getNewInstance(arg: List<*>, pathToItem: List, pathToSchemas: PathToSchemasMap): FrozenList { + val items: MutableList = ArrayList() + var i: Int = 0 + for (item: Any? in arg) { + val itemPathToItem = pathToItem + i + val schemas: LinkedHashMap, Nothing?>? = pathToSchemas.get(itemPathToItem) + if (schemas == null) { + throw RuntimeException("Validation result is invalid, schemas must exist for a pathToItem") + } + val itemSchema: JsonSchema<*> = schemas.entries.iterator().next().key + val itemInstance: Any? = itemSchema.getNewInstance(item, itemPathToItem, pathToSchemas) + items.add(itemInstance) + i += 1 + } + val newInstanceItems: FrozenList = FrozenList(items) + return newInstanceItems + } + + @Throws(ValidationException::class) + override fun validate(arg: List<*>, configuration: SchemaConfiguration?): FrozenList { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, PathToSchemasMap(), LinkedHashSet()) + val pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet) + return getNewInstance(castArg, validationMetadata.pathToItem, pathToSchemasMap) + } + + override fun getNewInstance(arg: Map<*, *>, pathToItem: List, pathToSchemas: PathToSchemasMap): PropertiesWhoseNamesAreJavascriptObjectPropertyNamesMap { + val properties: LinkedHashMap = LinkedHashMap() + for((propertyName, value) in arg) { + if (!(propertyName is String)) { + throw RuntimeException("Invalid non-string key value") + } + val propertyPathToItem: List = pathToItem + propertyName + val schemas: LinkedHashMap, Nothing?>? = pathToSchemas.get(propertyPathToItem) + if (schemas == null) { + throw RuntimeException("Validation result is invalid, schemas must exist for a pathToItem") + } + val propertySchema: JsonSchema<*> = schemas.entries.iterator().next().key + val propertyInstance: Any? = propertySchema.getNewInstance(value, propertyPathToItem, pathToSchemas) + properties[propertyName] = propertyInstance + } + val castProperties: FrozenMap = FrozenMap(properties) + return PropertiesWhoseNamesAreJavascriptObjectPropertyNamesMap(castProperties) + } + + @Throws(ValidationException::class) + override fun validate(arg: Map<*, *>, configuration: SchemaConfiguration?): PropertiesWhoseNamesAreJavascriptObjectPropertyNamesMap { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validatedPathToSchemas = PathToSchemasMap() + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, LinkedHashSet()) + val pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet) + return getNewInstance(castArg, validationMetadata.pathToItem, pathToSchemasMap) + } + + @Throws(ValidationException::class) + override fun validate(arg: Any?, configuration: SchemaConfiguration?): Any? { + if (arg == null) { + return validate(null, configuration) + } else if (arg is Boolean) { + return validate(arg, configuration) + } else if (arg is Number) { + return validate(arg, configuration) + } else if (arg is String) { + return validate(arg, configuration) + } else if (arg is List<*>) { + return validate(arg, configuration) + } else if (arg is Map<*, *>) { + return validate(arg, configuration) + } + throw ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema") + } + override fun getNewInstance(arg: Any?, pathToItem: List, pathToSchemas: PathToSchemasMap): Any? { + if (arg == null) { + return getNewInstance( null, pathToItem, pathToSchemas) + } else if (arg is Boolean) { + return getNewInstance(arg, pathToItem, pathToSchemas) + } else if (arg is Number) { + return getNewInstance(arg, pathToItem, pathToSchemas) + } else if (arg is String) { + return getNewInstance(arg, pathToItem, pathToSchemas) + } else if (arg is List<*>) { + return getNewInstance(arg, pathToItem, pathToSchemas) + } else if (arg is Map<*, *>) { + return getNewInstance(arg, pathToItem, pathToSchemas) + } + throw RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema") + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: Nothing?, configuration: SchemaConfiguration?): PropertiesWhoseNamesAreJavascriptObjectPropertyNames1BoxedVoid { + return PropertiesWhoseNamesAreJavascriptObjectPropertyNames1BoxedVoid(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: Boolean, configuration: SchemaConfiguration?): PropertiesWhoseNamesAreJavascriptObjectPropertyNames1BoxedBoolean { + return PropertiesWhoseNamesAreJavascriptObjectPropertyNames1BoxedBoolean(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: Number, configuration: SchemaConfiguration?): PropertiesWhoseNamesAreJavascriptObjectPropertyNames1BoxedNumber { + return PropertiesWhoseNamesAreJavascriptObjectPropertyNames1BoxedNumber(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: String, configuration: SchemaConfiguration?): PropertiesWhoseNamesAreJavascriptObjectPropertyNames1BoxedString { + return PropertiesWhoseNamesAreJavascriptObjectPropertyNames1BoxedString(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: List<*>, configuration: SchemaConfiguration?): PropertiesWhoseNamesAreJavascriptObjectPropertyNames1BoxedList { + return PropertiesWhoseNamesAreJavascriptObjectPropertyNames1BoxedList(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: Map<*, *>, configuration: SchemaConfiguration?): PropertiesWhoseNamesAreJavascriptObjectPropertyNames1BoxedMap { + return PropertiesWhoseNamesAreJavascriptObjectPropertyNames1BoxedMap(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: Any?, configuration: SchemaConfiguration?): PropertiesWhoseNamesAreJavascriptObjectPropertyNames1Boxed { + if (arg == null) { + return validateAndBox(null, configuration) + } else if (arg is Boolean) { + return validateAndBox(arg, configuration) + } else if (arg is String) { + return validateAndBox(arg, configuration) + } else if (arg is Number) { + return validateAndBox(arg, configuration) + } else if (arg is List<*>) { + return validateAndBox(arg, configuration) + } else if (arg is Map<*, *>) { + return validateAndBox(arg, configuration) + } + throw ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema") + } + } +} diff --git a/samples/client/3_1_0_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/schemas/PropertiesWithEscapedCharacters.kt b/samples/client/3_1_0_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/schemas/PropertiesWithEscapedCharacters.kt new file mode 100644 index 00000000000..14863b15c8a --- /dev/null +++ b/samples/client/3_1_0_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/schemas/PropertiesWithEscapedCharacters.kt @@ -0,0 +1,640 @@ +package org.openapijsonschematools.client.components.schemas +import java.time.LocalDate +import java.time.ZonedDateTime +import java.util.UUID +import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags +import org.openapijsonschematools.client.configurations.SchemaConfiguration +import org.openapijsonschematools.client.exceptions.InvalidAdditionalPropertyException +import org.openapijsonschematools.client.exceptions.UnsetPropertyException +import org.openapijsonschematools.client.exceptions.ValidationException +import org.openapijsonschematools.client.schemas.GenericBuilder +import org.openapijsonschematools.client.schemas.NumberJsonSchema +import org.openapijsonschematools.client.schemas.UnsetAddPropsSetter +import org.openapijsonschematools.client.schemas.validation.BooleanSchemaValidator +import org.openapijsonschematools.client.schemas.validation.FrozenList +import org.openapijsonschematools.client.schemas.validation.FrozenMap +import org.openapijsonschematools.client.schemas.validation.JsonSchema +import org.openapijsonschematools.client.schemas.validation.JsonSchemaInfo +import org.openapijsonschematools.client.schemas.validation.ListSchemaValidator +import org.openapijsonschematools.client.schemas.validation.MapSchemaValidator +import org.openapijsonschematools.client.schemas.validation.NullSchemaValidator +import org.openapijsonschematools.client.schemas.validation.NumberSchemaValidator +import org.openapijsonschematools.client.schemas.validation.PathToSchemasMap +import org.openapijsonschematools.client.schemas.validation.StringSchemaValidator +import org.openapijsonschematools.client.schemas.validation.ValidationMetadata + +class PropertiesWithEscapedCharacters { + // nest classes so all schemas and input/output classes can be public + + + class Foonbar : NumberJsonSchema.NumberJsonSchema1() { + companion object { + @Volatile + private var instance: Foonbar? = null + + fun getInstance() = + instance ?: synchronized(this) { + instance ?: Foonbar().also { instance = it } + } + } + } + + + class Foobar : NumberJsonSchema.NumberJsonSchema1() { + companion object { + @Volatile + private var instance: Foobar? = null + + fun getInstance() = + instance ?: synchronized(this) { + instance ?: Foobar().also { instance = it } + } + } + } + + + class Foobar1 : NumberJsonSchema.NumberJsonSchema1() { + companion object { + @Volatile + private var instance: Foobar1? = null + + fun getInstance() = + instance ?: synchronized(this) { + instance ?: Foobar1().also { instance = it } + } + } + } + + + class Foorbar : NumberJsonSchema.NumberJsonSchema1() { + companion object { + @Volatile + private var instance: Foorbar? = null + + fun getInstance() = + instance ?: synchronized(this) { + instance ?: Foorbar().also { instance = it } + } + } + } + + + class Footbar : NumberJsonSchema.NumberJsonSchema1() { + companion object { + @Volatile + private var instance: Footbar? = null + + fun getInstance() = + instance ?: synchronized(this) { + instance ?: Footbar().also { instance = it } + } + } + } + + + class Foou000Cbar : NumberJsonSchema.NumberJsonSchema1() { + companion object { + @Volatile + private var instance: Foou000Cbar? = null + + fun getInstance() = + instance ?: synchronized(this) { + instance ?: Foou000Cbar().also { instance = it } + } + } + } + + + class PropertiesWithEscapedCharactersMap(m: FrozenMap) : FrozenMap(m) { + companion object { + val requiredKeys: Set = setOf() + val optionalKeys: Set = setOf( + "foo\nbar", + "foo\"bar", + "foo\\bar", + "foo\rbar", + "foo\tbar", + "foo\u000Cbar" + ) + @Throws(ValidationException::class) + fun of(arg: Map, configuration: SchemaConfiguration): PropertiesWithEscapedCharactersMap { + return PropertiesWithEscapedCharacters1.getInstance().validate(arg, configuration) + } + } + + @Throws(UnsetPropertyException::class, InvalidAdditionalPropertyException::class) + fun getAdditionalProperty(name: String): Any? { + throwIfKeyKnown(name, requiredKeys, optionalKeys) + throwIfKeyNotPresent(name) + return get(name) + } + } + + interface SetterForFoonbar { + fun getInstance(): MutableMap + fun getBuilderAfterFoonbar(instance: MutableMap): T + + fun fooReverseSolidusNbar(value: Int): T { + val instance = getInstance() + instance["foo\nbar"] = value + return getBuilderAfterFoonbar(instance) + } + + fun fooReverseSolidusNbar(value: Float): T { + val instance = getInstance() + instance["foo\nbar"] = value + return getBuilderAfterFoonbar(instance) + } + + fun fooReverseSolidusNbar(value: Long): T { + val instance = getInstance() + instance["foo\nbar"] = value + return getBuilderAfterFoonbar(instance) + } + + fun fooReverseSolidusNbar(value: Double): T { + val instance = getInstance() + instance["foo\nbar"] = value + return getBuilderAfterFoonbar(instance) + } + } + + interface SetterForFoobar { + fun getInstance(): MutableMap + fun getBuilderAfterFoobar(instance: MutableMap): T + + fun fooReverseSolidusQuotationMarkBar(value: Int): T { + val instance = getInstance() + instance["foo\"bar"] = value + return getBuilderAfterFoobar(instance) + } + + fun fooReverseSolidusQuotationMarkBar(value: Float): T { + val instance = getInstance() + instance["foo\"bar"] = value + return getBuilderAfterFoobar(instance) + } + + fun fooReverseSolidusQuotationMarkBar(value: Long): T { + val instance = getInstance() + instance["foo\"bar"] = value + return getBuilderAfterFoobar(instance) + } + + fun fooReverseSolidusQuotationMarkBar(value: Double): T { + val instance = getInstance() + instance["foo\"bar"] = value + return getBuilderAfterFoobar(instance) + } + } + + interface SetterForFoobar1 { + fun getInstance(): MutableMap + fun getBuilderAfterFoobar1(instance: MutableMap): T + + fun fooReverseSolidusReverseSolidusBar(value: Int): T { + val instance = getInstance() + instance["foo\\bar"] = value + return getBuilderAfterFoobar1(instance) + } + + fun fooReverseSolidusReverseSolidusBar(value: Float): T { + val instance = getInstance() + instance["foo\\bar"] = value + return getBuilderAfterFoobar1(instance) + } + + fun fooReverseSolidusReverseSolidusBar(value: Long): T { + val instance = getInstance() + instance["foo\\bar"] = value + return getBuilderAfterFoobar1(instance) + } + + fun fooReverseSolidusReverseSolidusBar(value: Double): T { + val instance = getInstance() + instance["foo\\bar"] = value + return getBuilderAfterFoobar1(instance) + } + } + + interface SetterForFoorbar { + fun getInstance(): MutableMap + fun getBuilderAfterFoorbar(instance: MutableMap): T + + fun fooReverseSolidusRbar(value: Int): T { + val instance = getInstance() + instance["foo\rbar"] = value + return getBuilderAfterFoorbar(instance) + } + + fun fooReverseSolidusRbar(value: Float): T { + val instance = getInstance() + instance["foo\rbar"] = value + return getBuilderAfterFoorbar(instance) + } + + fun fooReverseSolidusRbar(value: Long): T { + val instance = getInstance() + instance["foo\rbar"] = value + return getBuilderAfterFoorbar(instance) + } + + fun fooReverseSolidusRbar(value: Double): T { + val instance = getInstance() + instance["foo\rbar"] = value + return getBuilderAfterFoorbar(instance) + } + } + + interface SetterForFootbar { + fun getInstance(): MutableMap + fun getBuilderAfterFootbar(instance: MutableMap): T + + fun fooReverseSolidusTbar(value: Int): T { + val instance = getInstance() + instance["foo\tbar"] = value + return getBuilderAfterFootbar(instance) + } + + fun fooReverseSolidusTbar(value: Float): T { + val instance = getInstance() + instance["foo\tbar"] = value + return getBuilderAfterFootbar(instance) + } + + fun fooReverseSolidusTbar(value: Long): T { + val instance = getInstance() + instance["foo\tbar"] = value + return getBuilderAfterFootbar(instance) + } + + fun fooReverseSolidusTbar(value: Double): T { + val instance = getInstance() + instance["foo\tbar"] = value + return getBuilderAfterFootbar(instance) + } + } + + interface SetterForFoou000Cbar { + fun getInstance(): MutableMap + fun getBuilderAfterFoou000Cbar(instance: MutableMap): T + + fun fooReverseSolidusU000cbar(value: Int): T { + val instance = getInstance() + instance["foo\u000Cbar"] = value + return getBuilderAfterFoou000Cbar(instance) + } + + fun fooReverseSolidusU000cbar(value: Float): T { + val instance = getInstance() + instance["foo\u000Cbar"] = value + return getBuilderAfterFoou000Cbar(instance) + } + + fun fooReverseSolidusU000cbar(value: Long): T { + val instance = getInstance() + instance["foo\u000Cbar"] = value + return getBuilderAfterFoou000Cbar(instance) + } + + fun fooReverseSolidusU000cbar(value: Double): T { + val instance = getInstance() + instance["foo\u000Cbar"] = value + return getBuilderAfterFoou000Cbar(instance) + } + } + + class PropertiesWithEscapedCharactersMapBuilder: UnsetAddPropsSetter, GenericBuilder>, SetterForFoonbar, SetterForFoobar, SetterForFoobar1, SetterForFoorbar, SetterForFootbar, SetterForFoou000Cbar { + private val knownKeys: Set = setOf( + "foo\nbar", + "foo\"bar", + "foo\\bar", + "foo\rbar", + "foo\tbar", + "foo\u000Cbar" + ) + override fun getKnownKeys(): Set { + return knownKeys + } + private val instance: MutableMap + init { + this.instance = LinkedHashMap() + } + override fun build(): Map { + return instance + } + override fun getInstance(): MutableMap { + return instance + } + override fun getBuilderAfterFoonbar(instance: MutableMap): PropertiesWithEscapedCharactersMapBuilder { + return this + } + override fun getBuilderAfterFoobar(instance: MutableMap): PropertiesWithEscapedCharactersMapBuilder { + return this + } + override fun getBuilderAfterFoobar1(instance: MutableMap): PropertiesWithEscapedCharactersMapBuilder { + return this + } + override fun getBuilderAfterFoorbar(instance: MutableMap): PropertiesWithEscapedCharactersMapBuilder { + return this + } + override fun getBuilderAfterFootbar(instance: MutableMap): PropertiesWithEscapedCharactersMapBuilder { + return this + } + override fun getBuilderAfterFoou000Cbar(instance: MutableMap): PropertiesWithEscapedCharactersMapBuilder { + return this + } + override fun getBuilderAfterAdditionalProperty(instance: MutableMap): PropertiesWithEscapedCharactersMapBuilder { + return this + } + } + + + sealed interface PropertiesWithEscapedCharacters1Boxed { + fun getData(): Any? + } + + data class PropertiesWithEscapedCharacters1BoxedVoid(val data: Nothing?) : PropertiesWithEscapedCharacters1Boxed { + override fun getData(): Any? { + return data + } + } + + data class PropertiesWithEscapedCharacters1BoxedBoolean(val data: Boolean): PropertiesWithEscapedCharacters1Boxed { + override fun getData(): Any? { + return data + } + } + + data class PropertiesWithEscapedCharacters1BoxedNumber(val data: Number) : PropertiesWithEscapedCharacters1Boxed { + override fun getData(): Any? { + return data + } + } + + data class PropertiesWithEscapedCharacters1BoxedString(val data: String) : PropertiesWithEscapedCharacters1Boxed { + override fun getData(): Any? { + return data + } + } + + data class PropertiesWithEscapedCharacters1BoxedList(val data: FrozenList) : PropertiesWithEscapedCharacters1Boxed { + override fun getData(): Any? { + return data + } + } + + data class PropertiesWithEscapedCharacters1BoxedMap(val data: PropertiesWithEscapedCharactersMap) : PropertiesWithEscapedCharacters1Boxed { + override fun getData(): Any? { + return data + } + } + + + class PropertiesWithEscapedCharacters1 private constructor(): JsonSchema( + JsonSchemaInfo() + .properties(mapOf( + "foo\nbar" to Foonbar::class.java, + "foo\"bar" to Foobar::class.java, + "foo\\bar" to Foobar1::class.java, + "foo\rbar" to Foorbar::class.java, + "foo\tbar" to Footbar::class.java, + "foo\u000Cbar" to Foou000Cbar::class.java + )) + ), NullSchemaValidator, BooleanSchemaValidator, NumberSchemaValidator, StringSchemaValidator, ListSchemaValidator, PropertiesWithEscapedCharacters1BoxedList>, MapSchemaValidator { + /* + NOTE: This class is auto generated by OpenAPI JSON Schema Generator. + Ref: https://github.com/openapi-json-schema-tools/openapi-json-schema-generator + + Do not edit the class manually. + */ + + companion object { + @Volatile + private var instance: PropertiesWithEscapedCharacters1? = null + + fun getInstance() = + instance ?: synchronized(this) { + instance ?: PropertiesWithEscapedCharacters1().also { instance = it } + } + } + + @Throws(ValidationException::class) + override fun validate(arg: Nothing?, configuration: SchemaConfiguration?): Nothing? { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validatedPathToSchemas = PathToSchemasMap() + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, LinkedHashSet()) + getPathToSchemas(this, castArg, validationMetadata, pathSet) + return castArg + } + + @Throws(ValidationException::class) + override fun validate(arg: Boolean, configuration: SchemaConfiguration?): Boolean { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validatedPathToSchemas = PathToSchemasMap() + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, LinkedHashSet()) + getPathToSchemas(this, castArg, validationMetadata, pathSet) + return castArg + } + + @Throws(ValidationException::class) + override fun validate(arg: Number, configuration: SchemaConfiguration?): Number { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validatedPathToSchemas = PathToSchemasMap() + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, LinkedHashSet()) + getPathToSchemas(this, castArg, validationMetadata, pathSet) + return castArg + } + + @Throws(ValidationException::class) + fun validate(arg: Int, configuration: SchemaConfiguration?): Int { + return validate(arg as Number, configuration) as Int + } + + @Throws(ValidationException::class) + fun validate(arg: Long, configuration: SchemaConfiguration?): Long { + return validate(arg as Number, configuration) as Long + } + + @Throws(ValidationException::class) + fun validate(arg: Float, configuration: SchemaConfiguration?): Float { + return validate(arg as Number, configuration) as Float + } + + @Throws(ValidationException::class) + fun validate(arg: Double, configuration: SchemaConfiguration?): Double { + return validate(arg as Number, configuration) as Double + } + + @Throws(ValidationException::class) + override fun validate(arg: String, configuration: SchemaConfiguration?): String { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validatedPathToSchemas = PathToSchemasMap() + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, LinkedHashSet()) + getPathToSchemas(this, castArg, validationMetadata, pathSet) + return castArg + } + + @Throws(ValidationException::class) + fun validate(arg: LocalDate, configuration: SchemaConfiguration?): String { + return validate(arg.toString(), configuration) + } + + @Throws(ValidationException::class) + fun validate(arg: ZonedDateTime, configuration: SchemaConfiguration?): String { + return validate(arg.toString(), configuration) + } + + @Throws(ValidationException::class) + fun validate(arg: UUID, configuration: SchemaConfiguration?): String { + return validate(arg.toString(), configuration) + } + + override fun getNewInstance(arg: List<*>, pathToItem: List, pathToSchemas: PathToSchemasMap): FrozenList { + val items: MutableList = ArrayList() + var i: Int = 0 + for (item: Any? in arg) { + val itemPathToItem = pathToItem + i + val schemas: LinkedHashMap, Nothing?>? = pathToSchemas.get(itemPathToItem) + if (schemas == null) { + throw RuntimeException("Validation result is invalid, schemas must exist for a pathToItem") + } + val itemSchema: JsonSchema<*> = schemas.entries.iterator().next().key + val itemInstance: Any? = itemSchema.getNewInstance(item, itemPathToItem, pathToSchemas) + items.add(itemInstance) + i += 1 + } + val newInstanceItems: FrozenList = FrozenList(items) + return newInstanceItems + } + + @Throws(ValidationException::class) + override fun validate(arg: List<*>, configuration: SchemaConfiguration?): FrozenList { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, PathToSchemasMap(), LinkedHashSet()) + val pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet) + return getNewInstance(castArg, validationMetadata.pathToItem, pathToSchemasMap) + } + + override fun getNewInstance(arg: Map<*, *>, pathToItem: List, pathToSchemas: PathToSchemasMap): PropertiesWithEscapedCharactersMap { + val properties: LinkedHashMap = LinkedHashMap() + for((propertyName, value) in arg) { + if (!(propertyName is String)) { + throw RuntimeException("Invalid non-string key value") + } + val propertyPathToItem: List = pathToItem + propertyName + val schemas: LinkedHashMap, Nothing?>? = pathToSchemas.get(propertyPathToItem) + if (schemas == null) { + throw RuntimeException("Validation result is invalid, schemas must exist for a pathToItem") + } + val propertySchema: JsonSchema<*> = schemas.entries.iterator().next().key + val propertyInstance: Any? = propertySchema.getNewInstance(value, propertyPathToItem, pathToSchemas) + properties[propertyName] = propertyInstance + } + val castProperties: FrozenMap = FrozenMap(properties) + return PropertiesWithEscapedCharactersMap(castProperties) + } + + @Throws(ValidationException::class) + override fun validate(arg: Map<*, *>, configuration: SchemaConfiguration?): PropertiesWithEscapedCharactersMap { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validatedPathToSchemas = PathToSchemasMap() + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, LinkedHashSet()) + val pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet) + return getNewInstance(castArg, validationMetadata.pathToItem, pathToSchemasMap) + } + + @Throws(ValidationException::class) + override fun validate(arg: Any?, configuration: SchemaConfiguration?): Any? { + if (arg == null) { + return validate(null, configuration) + } else if (arg is Boolean) { + return validate(arg, configuration) + } else if (arg is Number) { + return validate(arg, configuration) + } else if (arg is String) { + return validate(arg, configuration) + } else if (arg is List<*>) { + return validate(arg, configuration) + } else if (arg is Map<*, *>) { + return validate(arg, configuration) + } + throw ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema") + } + override fun getNewInstance(arg: Any?, pathToItem: List, pathToSchemas: PathToSchemasMap): Any? { + if (arg == null) { + return getNewInstance( null, pathToItem, pathToSchemas) + } else if (arg is Boolean) { + return getNewInstance(arg, pathToItem, pathToSchemas) + } else if (arg is Number) { + return getNewInstance(arg, pathToItem, pathToSchemas) + } else if (arg is String) { + return getNewInstance(arg, pathToItem, pathToSchemas) + } else if (arg is List<*>) { + return getNewInstance(arg, pathToItem, pathToSchemas) + } else if (arg is Map<*, *>) { + return getNewInstance(arg, pathToItem, pathToSchemas) + } + throw RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema") + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: Nothing?, configuration: SchemaConfiguration?): PropertiesWithEscapedCharacters1BoxedVoid { + return PropertiesWithEscapedCharacters1BoxedVoid(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: Boolean, configuration: SchemaConfiguration?): PropertiesWithEscapedCharacters1BoxedBoolean { + return PropertiesWithEscapedCharacters1BoxedBoolean(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: Number, configuration: SchemaConfiguration?): PropertiesWithEscapedCharacters1BoxedNumber { + return PropertiesWithEscapedCharacters1BoxedNumber(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: String, configuration: SchemaConfiguration?): PropertiesWithEscapedCharacters1BoxedString { + return PropertiesWithEscapedCharacters1BoxedString(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: List<*>, configuration: SchemaConfiguration?): PropertiesWithEscapedCharacters1BoxedList { + return PropertiesWithEscapedCharacters1BoxedList(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: Map<*, *>, configuration: SchemaConfiguration?): PropertiesWithEscapedCharacters1BoxedMap { + return PropertiesWithEscapedCharacters1BoxedMap(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: Any?, configuration: SchemaConfiguration?): PropertiesWithEscapedCharacters1Boxed { + if (arg == null) { + return validateAndBox(null, configuration) + } else if (arg is Boolean) { + return validateAndBox(arg, configuration) + } else if (arg is String) { + return validateAndBox(arg, configuration) + } else if (arg is Number) { + return validateAndBox(arg, configuration) + } else if (arg is List<*>) { + return validateAndBox(arg, configuration) + } else if (arg is Map<*, *>) { + return validateAndBox(arg, configuration) + } + throw ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema") + } + } +} diff --git a/samples/client/3_1_0_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/schemas/PropertiesWithNullValuedInstanceProperties.kt b/samples/client/3_1_0_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/schemas/PropertiesWithNullValuedInstanceProperties.kt new file mode 100644 index 00000000000..7b48f5b0378 --- /dev/null +++ b/samples/client/3_1_0_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/schemas/PropertiesWithNullValuedInstanceProperties.kt @@ -0,0 +1,393 @@ +package org.openapijsonschematools.client.components.schemas +import java.time.LocalDate +import java.time.ZonedDateTime +import java.util.UUID +import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags +import org.openapijsonschematools.client.configurations.SchemaConfiguration +import org.openapijsonschematools.client.exceptions.InvalidAdditionalPropertyException +import org.openapijsonschematools.client.exceptions.UnsetPropertyException +import org.openapijsonschematools.client.exceptions.ValidationException +import org.openapijsonschematools.client.schemas.GenericBuilder +import org.openapijsonschematools.client.schemas.NullJsonSchema +import org.openapijsonschematools.client.schemas.UnsetAddPropsSetter +import org.openapijsonschematools.client.schemas.validation.BooleanSchemaValidator +import org.openapijsonschematools.client.schemas.validation.FrozenList +import org.openapijsonschematools.client.schemas.validation.FrozenMap +import org.openapijsonschematools.client.schemas.validation.JsonSchema +import org.openapijsonschematools.client.schemas.validation.JsonSchemaInfo +import org.openapijsonschematools.client.schemas.validation.ListSchemaValidator +import org.openapijsonschematools.client.schemas.validation.MapSchemaValidator +import org.openapijsonschematools.client.schemas.validation.NullSchemaValidator +import org.openapijsonschematools.client.schemas.validation.NumberSchemaValidator +import org.openapijsonschematools.client.schemas.validation.PathToSchemasMap +import org.openapijsonschematools.client.schemas.validation.StringSchemaValidator +import org.openapijsonschematools.client.schemas.validation.ValidationMetadata + +class PropertiesWithNullValuedInstanceProperties { + // nest classes so all schemas and input/output classes can be public + + + class Foo : NullJsonSchema.NullJsonSchema1() { + companion object { + @Volatile + private var instance: Foo? = null + + fun getInstance() = + instance ?: synchronized(this) { + instance ?: Foo().also { instance = it } + } + } + } + + + class PropertiesWithNullValuedInstancePropertiesMap(m: FrozenMap) : FrozenMap(m) { + companion object { + val requiredKeys: Set = setOf() + val optionalKeys: Set = setOf( + "foo" + ) + @Throws(ValidationException::class) + fun of(arg: Map, configuration: SchemaConfiguration): PropertiesWithNullValuedInstancePropertiesMap { + return PropertiesWithNullValuedInstanceProperties1.getInstance().validate(arg, configuration) + } + } + + @Throws(UnsetPropertyException::class) + fun foo(): Nothing? { + val key = "foo" + throwIfKeyNotPresent(key) + val value: Any? = get(key) + if (!(value == null || value is Nothing?)) { + throw RuntimeException("Invalid value stored for foo") + } + return value + } + + @Throws(UnsetPropertyException::class, InvalidAdditionalPropertyException::class) + fun getAdditionalProperty(name: String): Any? { + throwIfKeyKnown(name, requiredKeys, optionalKeys) + throwIfKeyNotPresent(name) + return get(name) + } + } + + interface SetterForFoo { + fun getInstance(): MutableMap + fun getBuilderAfterFoo(instance: MutableMap): T + + fun foo(value: Nothing?): T { + val instance = getInstance() + instance["foo"] = null + return getBuilderAfterFoo(instance) + } + } + + class PropertiesWithNullValuedInstancePropertiesMapBuilder: UnsetAddPropsSetter, GenericBuilder>, SetterForFoo { + private val knownKeys: Set = setOf( + "foo" + ) + override fun getKnownKeys(): Set { + return knownKeys + } + private val instance: MutableMap + init { + this.instance = LinkedHashMap() + } + override fun build(): Map { + return instance + } + override fun getInstance(): MutableMap { + return instance + } + override fun getBuilderAfterFoo(instance: MutableMap): PropertiesWithNullValuedInstancePropertiesMapBuilder { + return this + } + override fun getBuilderAfterAdditionalProperty(instance: MutableMap): PropertiesWithNullValuedInstancePropertiesMapBuilder { + return this + } + } + + + sealed interface PropertiesWithNullValuedInstanceProperties1Boxed { + fun getData(): Any? + } + + data class PropertiesWithNullValuedInstanceProperties1BoxedVoid(val data: Nothing?) : PropertiesWithNullValuedInstanceProperties1Boxed { + override fun getData(): Any? { + return data + } + } + + data class PropertiesWithNullValuedInstanceProperties1BoxedBoolean(val data: Boolean): PropertiesWithNullValuedInstanceProperties1Boxed { + override fun getData(): Any? { + return data + } + } + + data class PropertiesWithNullValuedInstanceProperties1BoxedNumber(val data: Number) : PropertiesWithNullValuedInstanceProperties1Boxed { + override fun getData(): Any? { + return data + } + } + + data class PropertiesWithNullValuedInstanceProperties1BoxedString(val data: String) : PropertiesWithNullValuedInstanceProperties1Boxed { + override fun getData(): Any? { + return data + } + } + + data class PropertiesWithNullValuedInstanceProperties1BoxedList(val data: FrozenList) : PropertiesWithNullValuedInstanceProperties1Boxed { + override fun getData(): Any? { + return data + } + } + + data class PropertiesWithNullValuedInstanceProperties1BoxedMap(val data: PropertiesWithNullValuedInstancePropertiesMap) : PropertiesWithNullValuedInstanceProperties1Boxed { + override fun getData(): Any? { + return data + } + } + + + class PropertiesWithNullValuedInstanceProperties1 private constructor(): JsonSchema( + JsonSchemaInfo() + .properties(mapOf( + "foo" to Foo::class.java + )) + ), NullSchemaValidator, BooleanSchemaValidator, NumberSchemaValidator, StringSchemaValidator, ListSchemaValidator, PropertiesWithNullValuedInstanceProperties1BoxedList>, MapSchemaValidator { + /* + NOTE: This class is auto generated by OpenAPI JSON Schema Generator. + Ref: https://github.com/openapi-json-schema-tools/openapi-json-schema-generator + + Do not edit the class manually. + */ + + companion object { + @Volatile + private var instance: PropertiesWithNullValuedInstanceProperties1? = null + + fun getInstance() = + instance ?: synchronized(this) { + instance ?: PropertiesWithNullValuedInstanceProperties1().also { instance = it } + } + } + + @Throws(ValidationException::class) + override fun validate(arg: Nothing?, configuration: SchemaConfiguration?): Nothing? { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validatedPathToSchemas = PathToSchemasMap() + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, LinkedHashSet()) + getPathToSchemas(this, castArg, validationMetadata, pathSet) + return castArg + } + + @Throws(ValidationException::class) + override fun validate(arg: Boolean, configuration: SchemaConfiguration?): Boolean { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validatedPathToSchemas = PathToSchemasMap() + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, LinkedHashSet()) + getPathToSchemas(this, castArg, validationMetadata, pathSet) + return castArg + } + + @Throws(ValidationException::class) + override fun validate(arg: Number, configuration: SchemaConfiguration?): Number { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validatedPathToSchemas = PathToSchemasMap() + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, LinkedHashSet()) + getPathToSchemas(this, castArg, validationMetadata, pathSet) + return castArg + } + + @Throws(ValidationException::class) + fun validate(arg: Int, configuration: SchemaConfiguration?): Int { + return validate(arg as Number, configuration) as Int + } + + @Throws(ValidationException::class) + fun validate(arg: Long, configuration: SchemaConfiguration?): Long { + return validate(arg as Number, configuration) as Long + } + + @Throws(ValidationException::class) + fun validate(arg: Float, configuration: SchemaConfiguration?): Float { + return validate(arg as Number, configuration) as Float + } + + @Throws(ValidationException::class) + fun validate(arg: Double, configuration: SchemaConfiguration?): Double { + return validate(arg as Number, configuration) as Double + } + + @Throws(ValidationException::class) + override fun validate(arg: String, configuration: SchemaConfiguration?): String { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validatedPathToSchemas = PathToSchemasMap() + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, LinkedHashSet()) + getPathToSchemas(this, castArg, validationMetadata, pathSet) + return castArg + } + + @Throws(ValidationException::class) + fun validate(arg: LocalDate, configuration: SchemaConfiguration?): String { + return validate(arg.toString(), configuration) + } + + @Throws(ValidationException::class) + fun validate(arg: ZonedDateTime, configuration: SchemaConfiguration?): String { + return validate(arg.toString(), configuration) + } + + @Throws(ValidationException::class) + fun validate(arg: UUID, configuration: SchemaConfiguration?): String { + return validate(arg.toString(), configuration) + } + + override fun getNewInstance(arg: List<*>, pathToItem: List, pathToSchemas: PathToSchemasMap): FrozenList { + val items: MutableList = ArrayList() + var i: Int = 0 + for (item: Any? in arg) { + val itemPathToItem = pathToItem + i + val schemas: LinkedHashMap, Nothing?>? = pathToSchemas.get(itemPathToItem) + if (schemas == null) { + throw RuntimeException("Validation result is invalid, schemas must exist for a pathToItem") + } + val itemSchema: JsonSchema<*> = schemas.entries.iterator().next().key + val itemInstance: Any? = itemSchema.getNewInstance(item, itemPathToItem, pathToSchemas) + items.add(itemInstance) + i += 1 + } + val newInstanceItems: FrozenList = FrozenList(items) + return newInstanceItems + } + + @Throws(ValidationException::class) + override fun validate(arg: List<*>, configuration: SchemaConfiguration?): FrozenList { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, PathToSchemasMap(), LinkedHashSet()) + val pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet) + return getNewInstance(castArg, validationMetadata.pathToItem, pathToSchemasMap) + } + + override fun getNewInstance(arg: Map<*, *>, pathToItem: List, pathToSchemas: PathToSchemasMap): PropertiesWithNullValuedInstancePropertiesMap { + val properties: LinkedHashMap = LinkedHashMap() + for((propertyName, value) in arg) { + if (!(propertyName is String)) { + throw RuntimeException("Invalid non-string key value") + } + val propertyPathToItem: List = pathToItem + propertyName + val schemas: LinkedHashMap, Nothing?>? = pathToSchemas.get(propertyPathToItem) + if (schemas == null) { + throw RuntimeException("Validation result is invalid, schemas must exist for a pathToItem") + } + val propertySchema: JsonSchema<*> = schemas.entries.iterator().next().key + val propertyInstance: Any? = propertySchema.getNewInstance(value, propertyPathToItem, pathToSchemas) + properties[propertyName] = propertyInstance + } + val castProperties: FrozenMap = FrozenMap(properties) + return PropertiesWithNullValuedInstancePropertiesMap(castProperties) + } + + @Throws(ValidationException::class) + override fun validate(arg: Map<*, *>, configuration: SchemaConfiguration?): PropertiesWithNullValuedInstancePropertiesMap { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validatedPathToSchemas = PathToSchemasMap() + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, LinkedHashSet()) + val pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet) + return getNewInstance(castArg, validationMetadata.pathToItem, pathToSchemasMap) + } + + @Throws(ValidationException::class) + override fun validate(arg: Any?, configuration: SchemaConfiguration?): Any? { + if (arg == null) { + return validate(null, configuration) + } else if (arg is Boolean) { + return validate(arg, configuration) + } else if (arg is Number) { + return validate(arg, configuration) + } else if (arg is String) { + return validate(arg, configuration) + } else if (arg is List<*>) { + return validate(arg, configuration) + } else if (arg is Map<*, *>) { + return validate(arg, configuration) + } + throw ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema") + } + override fun getNewInstance(arg: Any?, pathToItem: List, pathToSchemas: PathToSchemasMap): Any? { + if (arg == null) { + return getNewInstance( null, pathToItem, pathToSchemas) + } else if (arg is Boolean) { + return getNewInstance(arg, pathToItem, pathToSchemas) + } else if (arg is Number) { + return getNewInstance(arg, pathToItem, pathToSchemas) + } else if (arg is String) { + return getNewInstance(arg, pathToItem, pathToSchemas) + } else if (arg is List<*>) { + return getNewInstance(arg, pathToItem, pathToSchemas) + } else if (arg is Map<*, *>) { + return getNewInstance(arg, pathToItem, pathToSchemas) + } + throw RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema") + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: Nothing?, configuration: SchemaConfiguration?): PropertiesWithNullValuedInstanceProperties1BoxedVoid { + return PropertiesWithNullValuedInstanceProperties1BoxedVoid(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: Boolean, configuration: SchemaConfiguration?): PropertiesWithNullValuedInstanceProperties1BoxedBoolean { + return PropertiesWithNullValuedInstanceProperties1BoxedBoolean(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: Number, configuration: SchemaConfiguration?): PropertiesWithNullValuedInstanceProperties1BoxedNumber { + return PropertiesWithNullValuedInstanceProperties1BoxedNumber(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: String, configuration: SchemaConfiguration?): PropertiesWithNullValuedInstanceProperties1BoxedString { + return PropertiesWithNullValuedInstanceProperties1BoxedString(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: List<*>, configuration: SchemaConfiguration?): PropertiesWithNullValuedInstanceProperties1BoxedList { + return PropertiesWithNullValuedInstanceProperties1BoxedList(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: Map<*, *>, configuration: SchemaConfiguration?): PropertiesWithNullValuedInstanceProperties1BoxedMap { + return PropertiesWithNullValuedInstanceProperties1BoxedMap(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: Any?, configuration: SchemaConfiguration?): PropertiesWithNullValuedInstanceProperties1Boxed { + if (arg == null) { + return validateAndBox(null, configuration) + } else if (arg is Boolean) { + return validateAndBox(arg, configuration) + } else if (arg is String) { + return validateAndBox(arg, configuration) + } else if (arg is Number) { + return validateAndBox(arg, configuration) + } else if (arg is List<*>) { + return validateAndBox(arg, configuration) + } else if (arg is Map<*, *>) { + return validateAndBox(arg, configuration) + } + throw ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema") + } + } +} diff --git a/samples/client/3_1_0_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/schemas/PropertyNamedRefThatIsNotAReference.kt b/samples/client/3_1_0_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/schemas/PropertyNamedRefThatIsNotAReference.kt new file mode 100644 index 00000000000..7517a23585e --- /dev/null +++ b/samples/client/3_1_0_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/schemas/PropertyNamedRefThatIsNotAReference.kt @@ -0,0 +1,382 @@ +package org.openapijsonschematools.client.components.schemas +import java.time.LocalDate +import java.time.ZonedDateTime +import java.util.UUID +import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags +import org.openapijsonschematools.client.configurations.SchemaConfiguration +import org.openapijsonschematools.client.exceptions.InvalidAdditionalPropertyException +import org.openapijsonschematools.client.exceptions.UnsetPropertyException +import org.openapijsonschematools.client.exceptions.ValidationException +import org.openapijsonschematools.client.schemas.GenericBuilder +import org.openapijsonschematools.client.schemas.StringJsonSchema +import org.openapijsonschematools.client.schemas.UnsetAddPropsSetter +import org.openapijsonschematools.client.schemas.validation.BooleanSchemaValidator +import org.openapijsonschematools.client.schemas.validation.FrozenList +import org.openapijsonschematools.client.schemas.validation.FrozenMap +import org.openapijsonschematools.client.schemas.validation.JsonSchema +import org.openapijsonschematools.client.schemas.validation.JsonSchemaInfo +import org.openapijsonschematools.client.schemas.validation.ListSchemaValidator +import org.openapijsonschematools.client.schemas.validation.MapSchemaValidator +import org.openapijsonschematools.client.schemas.validation.NullSchemaValidator +import org.openapijsonschematools.client.schemas.validation.NumberSchemaValidator +import org.openapijsonschematools.client.schemas.validation.PathToSchemasMap +import org.openapijsonschematools.client.schemas.validation.StringSchemaValidator +import org.openapijsonschematools.client.schemas.validation.ValidationMetadata + +class PropertyNamedRefThatIsNotAReference { + // nest classes so all schemas and input/output classes can be public + + + class Ref : StringJsonSchema.StringJsonSchema1() { + companion object { + @Volatile + private var instance: Ref? = null + + fun getInstance() = + instance ?: synchronized(this) { + instance ?: Ref().also { instance = it } + } + } + } + + + class PropertyNamedRefThatIsNotAReferenceMap(m: FrozenMap) : FrozenMap(m) { + companion object { + val requiredKeys: Set = setOf() + val optionalKeys: Set = setOf( + "\$ref" + ) + @Throws(ValidationException::class) + fun of(arg: Map, configuration: SchemaConfiguration): PropertyNamedRefThatIsNotAReferenceMap { + return PropertyNamedRefThatIsNotAReference1.getInstance().validate(arg, configuration) + } + } + + @Throws(UnsetPropertyException::class, InvalidAdditionalPropertyException::class) + fun getAdditionalProperty(name: String): Any? { + throwIfKeyKnown(name, requiredKeys, optionalKeys) + throwIfKeyNotPresent(name) + return get(name) + } + } + + interface SetterForRef { + fun getInstance(): MutableMap + fun getBuilderAfterRef(instance: MutableMap): T + + fun reverseSolidusDollarSignRef(value: String): T { + val instance = getInstance() + instance["\$ref"] = value + return getBuilderAfterRef(instance) + } + } + + class PropertyNamedRefThatIsNotAReferenceMapBuilder: UnsetAddPropsSetter, GenericBuilder>, SetterForRef { + private val knownKeys: Set = setOf( + "\$ref" + ) + override fun getKnownKeys(): Set { + return knownKeys + } + private val instance: MutableMap + init { + this.instance = LinkedHashMap() + } + override fun build(): Map { + return instance + } + override fun getInstance(): MutableMap { + return instance + } + override fun getBuilderAfterRef(instance: MutableMap): PropertyNamedRefThatIsNotAReferenceMapBuilder { + return this + } + override fun getBuilderAfterAdditionalProperty(instance: MutableMap): PropertyNamedRefThatIsNotAReferenceMapBuilder { + return this + } + } + + + sealed interface PropertyNamedRefThatIsNotAReference1Boxed { + fun getData(): Any? + } + + data class PropertyNamedRefThatIsNotAReference1BoxedVoid(val data: Nothing?) : PropertyNamedRefThatIsNotAReference1Boxed { + override fun getData(): Any? { + return data + } + } + + data class PropertyNamedRefThatIsNotAReference1BoxedBoolean(val data: Boolean): PropertyNamedRefThatIsNotAReference1Boxed { + override fun getData(): Any? { + return data + } + } + + data class PropertyNamedRefThatIsNotAReference1BoxedNumber(val data: Number) : PropertyNamedRefThatIsNotAReference1Boxed { + override fun getData(): Any? { + return data + } + } + + data class PropertyNamedRefThatIsNotAReference1BoxedString(val data: String) : PropertyNamedRefThatIsNotAReference1Boxed { + override fun getData(): Any? { + return data + } + } + + data class PropertyNamedRefThatIsNotAReference1BoxedList(val data: FrozenList) : PropertyNamedRefThatIsNotAReference1Boxed { + override fun getData(): Any? { + return data + } + } + + data class PropertyNamedRefThatIsNotAReference1BoxedMap(val data: PropertyNamedRefThatIsNotAReferenceMap) : PropertyNamedRefThatIsNotAReference1Boxed { + override fun getData(): Any? { + return data + } + } + + + class PropertyNamedRefThatIsNotAReference1 private constructor(): JsonSchema( + JsonSchemaInfo() + .properties(mapOf( + "\$ref" to Ref::class.java + )) + ), NullSchemaValidator, BooleanSchemaValidator, NumberSchemaValidator, StringSchemaValidator, ListSchemaValidator, PropertyNamedRefThatIsNotAReference1BoxedList>, MapSchemaValidator { + /* + NOTE: This class is auto generated by OpenAPI JSON Schema Generator. + Ref: https://github.com/openapi-json-schema-tools/openapi-json-schema-generator + + Do not edit the class manually. + */ + + companion object { + @Volatile + private var instance: PropertyNamedRefThatIsNotAReference1? = null + + fun getInstance() = + instance ?: synchronized(this) { + instance ?: PropertyNamedRefThatIsNotAReference1().also { instance = it } + } + } + + @Throws(ValidationException::class) + override fun validate(arg: Nothing?, configuration: SchemaConfiguration?): Nothing? { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validatedPathToSchemas = PathToSchemasMap() + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, LinkedHashSet()) + getPathToSchemas(this, castArg, validationMetadata, pathSet) + return castArg + } + + @Throws(ValidationException::class) + override fun validate(arg: Boolean, configuration: SchemaConfiguration?): Boolean { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validatedPathToSchemas = PathToSchemasMap() + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, LinkedHashSet()) + getPathToSchemas(this, castArg, validationMetadata, pathSet) + return castArg + } + + @Throws(ValidationException::class) + override fun validate(arg: Number, configuration: SchemaConfiguration?): Number { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validatedPathToSchemas = PathToSchemasMap() + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, LinkedHashSet()) + getPathToSchemas(this, castArg, validationMetadata, pathSet) + return castArg + } + + @Throws(ValidationException::class) + fun validate(arg: Int, configuration: SchemaConfiguration?): Int { + return validate(arg as Number, configuration) as Int + } + + @Throws(ValidationException::class) + fun validate(arg: Long, configuration: SchemaConfiguration?): Long { + return validate(arg as Number, configuration) as Long + } + + @Throws(ValidationException::class) + fun validate(arg: Float, configuration: SchemaConfiguration?): Float { + return validate(arg as Number, configuration) as Float + } + + @Throws(ValidationException::class) + fun validate(arg: Double, configuration: SchemaConfiguration?): Double { + return validate(arg as Number, configuration) as Double + } + + @Throws(ValidationException::class) + override fun validate(arg: String, configuration: SchemaConfiguration?): String { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validatedPathToSchemas = PathToSchemasMap() + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, LinkedHashSet()) + getPathToSchemas(this, castArg, validationMetadata, pathSet) + return castArg + } + + @Throws(ValidationException::class) + fun validate(arg: LocalDate, configuration: SchemaConfiguration?): String { + return validate(arg.toString(), configuration) + } + + @Throws(ValidationException::class) + fun validate(arg: ZonedDateTime, configuration: SchemaConfiguration?): String { + return validate(arg.toString(), configuration) + } + + @Throws(ValidationException::class) + fun validate(arg: UUID, configuration: SchemaConfiguration?): String { + return validate(arg.toString(), configuration) + } + + override fun getNewInstance(arg: List<*>, pathToItem: List, pathToSchemas: PathToSchemasMap): FrozenList { + val items: MutableList = ArrayList() + var i: Int = 0 + for (item: Any? in arg) { + val itemPathToItem = pathToItem + i + val schemas: LinkedHashMap, Nothing?>? = pathToSchemas.get(itemPathToItem) + if (schemas == null) { + throw RuntimeException("Validation result is invalid, schemas must exist for a pathToItem") + } + val itemSchema: JsonSchema<*> = schemas.entries.iterator().next().key + val itemInstance: Any? = itemSchema.getNewInstance(item, itemPathToItem, pathToSchemas) + items.add(itemInstance) + i += 1 + } + val newInstanceItems: FrozenList = FrozenList(items) + return newInstanceItems + } + + @Throws(ValidationException::class) + override fun validate(arg: List<*>, configuration: SchemaConfiguration?): FrozenList { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, PathToSchemasMap(), LinkedHashSet()) + val pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet) + return getNewInstance(castArg, validationMetadata.pathToItem, pathToSchemasMap) + } + + override fun getNewInstance(arg: Map<*, *>, pathToItem: List, pathToSchemas: PathToSchemasMap): PropertyNamedRefThatIsNotAReferenceMap { + val properties: LinkedHashMap = LinkedHashMap() + for((propertyName, value) in arg) { + if (!(propertyName is String)) { + throw RuntimeException("Invalid non-string key value") + } + val propertyPathToItem: List = pathToItem + propertyName + val schemas: LinkedHashMap, Nothing?>? = pathToSchemas.get(propertyPathToItem) + if (schemas == null) { + throw RuntimeException("Validation result is invalid, schemas must exist for a pathToItem") + } + val propertySchema: JsonSchema<*> = schemas.entries.iterator().next().key + val propertyInstance: Any? = propertySchema.getNewInstance(value, propertyPathToItem, pathToSchemas) + properties[propertyName] = propertyInstance + } + val castProperties: FrozenMap = FrozenMap(properties) + return PropertyNamedRefThatIsNotAReferenceMap(castProperties) + } + + @Throws(ValidationException::class) + override fun validate(arg: Map<*, *>, configuration: SchemaConfiguration?): PropertyNamedRefThatIsNotAReferenceMap { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validatedPathToSchemas = PathToSchemasMap() + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, LinkedHashSet()) + val pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet) + return getNewInstance(castArg, validationMetadata.pathToItem, pathToSchemasMap) + } + + @Throws(ValidationException::class) + override fun validate(arg: Any?, configuration: SchemaConfiguration?): Any? { + if (arg == null) { + return validate(null, configuration) + } else if (arg is Boolean) { + return validate(arg, configuration) + } else if (arg is Number) { + return validate(arg, configuration) + } else if (arg is String) { + return validate(arg, configuration) + } else if (arg is List<*>) { + return validate(arg, configuration) + } else if (arg is Map<*, *>) { + return validate(arg, configuration) + } + throw ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema") + } + override fun getNewInstance(arg: Any?, pathToItem: List, pathToSchemas: PathToSchemasMap): Any? { + if (arg == null) { + return getNewInstance( null, pathToItem, pathToSchemas) + } else if (arg is Boolean) { + return getNewInstance(arg, pathToItem, pathToSchemas) + } else if (arg is Number) { + return getNewInstance(arg, pathToItem, pathToSchemas) + } else if (arg is String) { + return getNewInstance(arg, pathToItem, pathToSchemas) + } else if (arg is List<*>) { + return getNewInstance(arg, pathToItem, pathToSchemas) + } else if (arg is Map<*, *>) { + return getNewInstance(arg, pathToItem, pathToSchemas) + } + throw RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema") + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: Nothing?, configuration: SchemaConfiguration?): PropertyNamedRefThatIsNotAReference1BoxedVoid { + return PropertyNamedRefThatIsNotAReference1BoxedVoid(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: Boolean, configuration: SchemaConfiguration?): PropertyNamedRefThatIsNotAReference1BoxedBoolean { + return PropertyNamedRefThatIsNotAReference1BoxedBoolean(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: Number, configuration: SchemaConfiguration?): PropertyNamedRefThatIsNotAReference1BoxedNumber { + return PropertyNamedRefThatIsNotAReference1BoxedNumber(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: String, configuration: SchemaConfiguration?): PropertyNamedRefThatIsNotAReference1BoxedString { + return PropertyNamedRefThatIsNotAReference1BoxedString(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: List<*>, configuration: SchemaConfiguration?): PropertyNamedRefThatIsNotAReference1BoxedList { + return PropertyNamedRefThatIsNotAReference1BoxedList(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: Map<*, *>, configuration: SchemaConfiguration?): PropertyNamedRefThatIsNotAReference1BoxedMap { + return PropertyNamedRefThatIsNotAReference1BoxedMap(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: Any?, configuration: SchemaConfiguration?): PropertyNamedRefThatIsNotAReference1Boxed { + if (arg == null) { + return validateAndBox(null, configuration) + } else if (arg is Boolean) { + return validateAndBox(arg, configuration) + } else if (arg is String) { + return validateAndBox(arg, configuration) + } else if (arg is Number) { + return validateAndBox(arg, configuration) + } else if (arg is List<*>) { + return validateAndBox(arg, configuration) + } else if (arg is Map<*, *>) { + return validateAndBox(arg, configuration) + } + throw ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema") + } + } +} diff --git a/samples/client/3_1_0_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/schemas/PropertynamesValidation.kt b/samples/client/3_1_0_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/schemas/PropertynamesValidation.kt new file mode 100644 index 00000000000..acdf4bc0e3a --- /dev/null +++ b/samples/client/3_1_0_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/schemas/PropertynamesValidation.kt @@ -0,0 +1,375 @@ +package org.openapijsonschematools.client.components.schemas +import java.time.LocalDate +import java.time.ZonedDateTime +import java.util.UUID +import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags +import org.openapijsonschematools.client.configurations.SchemaConfiguration +import org.openapijsonschematools.client.exceptions.InvalidAdditionalPropertyException +import org.openapijsonschematools.client.exceptions.UnsetPropertyException +import org.openapijsonschematools.client.exceptions.ValidationException +import org.openapijsonschematools.client.schemas.UnsetAddPropsSetter +import org.openapijsonschematools.client.schemas.validation.BooleanSchemaValidator +import org.openapijsonschematools.client.schemas.validation.FrozenList +import org.openapijsonschematools.client.schemas.validation.FrozenMap +import org.openapijsonschematools.client.schemas.validation.JsonSchema +import org.openapijsonschematools.client.schemas.validation.JsonSchemaInfo +import org.openapijsonschematools.client.schemas.validation.ListSchemaValidator +import org.openapijsonschematools.client.schemas.validation.MapSchemaValidator +import org.openapijsonschematools.client.schemas.validation.NullSchemaValidator +import org.openapijsonschematools.client.schemas.validation.NumberSchemaValidator +import org.openapijsonschematools.client.schemas.validation.PathToSchemasMap +import org.openapijsonschematools.client.schemas.validation.StringSchemaValidator +import org.openapijsonschematools.client.schemas.validation.ValidationMetadata + +class PropertynamesValidation { + // nest classes so all schemas and input/output classes can be public + + + sealed interface PropertyNamesBoxed { + fun getData(): Any? + } + + data class PropertyNamesBoxedString(val data: String) : PropertyNamesBoxed { + override fun getData(): Any? { + return data + } + } + + + + class PropertyNames private constructor(): JsonSchema( + JsonSchemaInfo() + .type(setOf( + String::class.java + )) + .maxLength(3) + ), StringSchemaValidator { + + companion object { + @Volatile + private var instance: PropertyNames? = null + + fun getInstance() = + instance ?: synchronized(this) { + instance ?: PropertyNames().also { instance = it } + } + } + + @Throws(ValidationException::class) + override fun validate(arg: String, configuration: SchemaConfiguration?): String { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, PathToSchemasMap(), LinkedHashSet()) + getPathToSchemas(this, castArg, validationMetadata, pathSet) + return castArg + } + + @Throws(ValidationException::class) + override fun validate(arg: Any?, configuration: SchemaConfiguration?): Any? { + if (arg is String) { + return validate(arg, configuration) + } + throw ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema") + } + override fun getNewInstance(arg: Any?, pathToItem: List, pathToSchemas: PathToSchemasMap): Any? { + if (arg is String) { + return getNewInstance(arg, pathToItem, pathToSchemas) + } + throw RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema") + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: String, configuration: SchemaConfiguration?): PropertyNamesBoxedString { + return PropertyNamesBoxedString(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: Any?, configuration: SchemaConfiguration?): PropertyNamesBoxed { + if (arg is String) { + return validateAndBox(arg, configuration) + } + throw ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema") + } + } + + sealed interface PropertynamesValidation1Boxed { + fun getData(): Any? + } + + data class PropertynamesValidation1BoxedVoid(val data: Nothing?) : PropertynamesValidation1Boxed { + override fun getData(): Any? { + return data + } + } + + data class PropertynamesValidation1BoxedBoolean(val data: Boolean): PropertynamesValidation1Boxed { + override fun getData(): Any? { + return data + } + } + + data class PropertynamesValidation1BoxedNumber(val data: Number) : PropertynamesValidation1Boxed { + override fun getData(): Any? { + return data + } + } + + data class PropertynamesValidation1BoxedString(val data: String) : PropertynamesValidation1Boxed { + override fun getData(): Any? { + return data + } + } + + data class PropertynamesValidation1BoxedList(val data: FrozenList) : PropertynamesValidation1Boxed { + override fun getData(): Any? { + return data + } + } + + data class PropertynamesValidation1BoxedMap(val data: FrozenMap) : PropertynamesValidation1Boxed { + override fun getData(): Any? { + return data + } + } + + + class PropertynamesValidation1 private constructor(): JsonSchema( + JsonSchemaInfo() + .propertyNames(PropertyNames::class.java) + ), NullSchemaValidator, BooleanSchemaValidator, NumberSchemaValidator, StringSchemaValidator, ListSchemaValidator, PropertynamesValidation1BoxedList>, MapSchemaValidator, PropertynamesValidation1BoxedMap> { + /* + NOTE: This class is auto generated by OpenAPI JSON Schema Generator. + Ref: https://github.com/openapi-json-schema-tools/openapi-json-schema-generator + + Do not edit the class manually. + */ + + companion object { + @Volatile + private var instance: PropertynamesValidation1? = null + + fun getInstance() = + instance ?: synchronized(this) { + instance ?: PropertynamesValidation1().also { instance = it } + } + } + + @Throws(ValidationException::class) + override fun validate(arg: Nothing?, configuration: SchemaConfiguration?): Nothing? { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validatedPathToSchemas = PathToSchemasMap() + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, LinkedHashSet()) + getPathToSchemas(this, castArg, validationMetadata, pathSet) + return castArg + } + + @Throws(ValidationException::class) + override fun validate(arg: Boolean, configuration: SchemaConfiguration?): Boolean { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validatedPathToSchemas = PathToSchemasMap() + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, LinkedHashSet()) + getPathToSchemas(this, castArg, validationMetadata, pathSet) + return castArg + } + + @Throws(ValidationException::class) + override fun validate(arg: Number, configuration: SchemaConfiguration?): Number { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validatedPathToSchemas = PathToSchemasMap() + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, LinkedHashSet()) + getPathToSchemas(this, castArg, validationMetadata, pathSet) + return castArg + } + + @Throws(ValidationException::class) + fun validate(arg: Int, configuration: SchemaConfiguration?): Int { + return validate(arg as Number, configuration) as Int + } + + @Throws(ValidationException::class) + fun validate(arg: Long, configuration: SchemaConfiguration?): Long { + return validate(arg as Number, configuration) as Long + } + + @Throws(ValidationException::class) + fun validate(arg: Float, configuration: SchemaConfiguration?): Float { + return validate(arg as Number, configuration) as Float + } + + @Throws(ValidationException::class) + fun validate(arg: Double, configuration: SchemaConfiguration?): Double { + return validate(arg as Number, configuration) as Double + } + + @Throws(ValidationException::class) + override fun validate(arg: String, configuration: SchemaConfiguration?): String { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validatedPathToSchemas = PathToSchemasMap() + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, LinkedHashSet()) + getPathToSchemas(this, castArg, validationMetadata, pathSet) + return castArg + } + + @Throws(ValidationException::class) + fun validate(arg: LocalDate, configuration: SchemaConfiguration?): String { + return validate(arg.toString(), configuration) + } + + @Throws(ValidationException::class) + fun validate(arg: ZonedDateTime, configuration: SchemaConfiguration?): String { + return validate(arg.toString(), configuration) + } + + @Throws(ValidationException::class) + fun validate(arg: UUID, configuration: SchemaConfiguration?): String { + return validate(arg.toString(), configuration) + } + + override fun getNewInstance(arg: List<*>, pathToItem: List, pathToSchemas: PathToSchemasMap): FrozenList { + val items: MutableList = ArrayList() + var i: Int = 0 + for (item: Any? in arg) { + val itemPathToItem = pathToItem + i + val schemas: LinkedHashMap, Nothing?>? = pathToSchemas.get(itemPathToItem) + if (schemas == null) { + throw RuntimeException("Validation result is invalid, schemas must exist for a pathToItem") + } + val itemSchema: JsonSchema<*> = schemas.entries.iterator().next().key + val itemInstance: Any? = itemSchema.getNewInstance(item, itemPathToItem, pathToSchemas) + items.add(itemInstance) + i += 1 + } + val newInstanceItems: FrozenList = FrozenList(items) + return newInstanceItems + } + + @Throws(ValidationException::class) + override fun validate(arg: List<*>, configuration: SchemaConfiguration?): FrozenList { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, PathToSchemasMap(), LinkedHashSet()) + val pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet) + return getNewInstance(castArg, validationMetadata.pathToItem, pathToSchemasMap) + } + + override fun getNewInstance(arg: Map<*, *>, pathToItem: List, pathToSchemas: PathToSchemasMap): FrozenMap { + val properties: LinkedHashMap = LinkedHashMap() + for((propertyName, value) in arg) { + if (!(propertyName is String)) { + throw RuntimeException("Invalid non-string key value") + } + val propertyPathToItem: List = pathToItem + propertyName + val schemas: LinkedHashMap, Nothing?>? = pathToSchemas.get(propertyPathToItem) + if (schemas == null) { + throw RuntimeException("Validation result is invalid, schemas must exist for a pathToItem") + } + val propertySchema: JsonSchema<*> = schemas.entries.iterator().next().key + val propertyInstance: Any? = propertySchema.getNewInstance(value, propertyPathToItem, pathToSchemas) + properties[propertyName] = propertyInstance + } + val castProperties: FrozenMap = FrozenMap(properties) + return castProperties + } + + @Throws(ValidationException::class) + override fun validate(arg: Map<*, *>, configuration: SchemaConfiguration?): FrozenMap { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validatedPathToSchemas = PathToSchemasMap() + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, LinkedHashSet()) + val pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet) + return getNewInstance(castArg, validationMetadata.pathToItem, pathToSchemasMap) + } + + @Throws(ValidationException::class) + override fun validate(arg: Any?, configuration: SchemaConfiguration?): Any? { + if (arg == null) { + return validate(null, configuration) + } else if (arg is Boolean) { + return validate(arg, configuration) + } else if (arg is Number) { + return validate(arg, configuration) + } else if (arg is String) { + return validate(arg, configuration) + } else if (arg is List<*>) { + return validate(arg, configuration) + } else if (arg is Map<*, *>) { + return validate(arg, configuration) + } + throw ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema") + } + override fun getNewInstance(arg: Any?, pathToItem: List, pathToSchemas: PathToSchemasMap): Any? { + if (arg == null) { + return getNewInstance( null, pathToItem, pathToSchemas) + } else if (arg is Boolean) { + return getNewInstance(arg, pathToItem, pathToSchemas) + } else if (arg is Number) { + return getNewInstance(arg, pathToItem, pathToSchemas) + } else if (arg is String) { + return getNewInstance(arg, pathToItem, pathToSchemas) + } else if (arg is List<*>) { + return getNewInstance(arg, pathToItem, pathToSchemas) + } else if (arg is Map<*, *>) { + return getNewInstance(arg, pathToItem, pathToSchemas) + } + throw RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema") + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: Nothing?, configuration: SchemaConfiguration?): PropertynamesValidation1BoxedVoid { + return PropertynamesValidation1BoxedVoid(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: Boolean, configuration: SchemaConfiguration?): PropertynamesValidation1BoxedBoolean { + return PropertynamesValidation1BoxedBoolean(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: Number, configuration: SchemaConfiguration?): PropertynamesValidation1BoxedNumber { + return PropertynamesValidation1BoxedNumber(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: String, configuration: SchemaConfiguration?): PropertynamesValidation1BoxedString { + return PropertynamesValidation1BoxedString(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: List<*>, configuration: SchemaConfiguration?): PropertynamesValidation1BoxedList { + return PropertynamesValidation1BoxedList(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: Map<*, *>, configuration: SchemaConfiguration?): PropertynamesValidation1BoxedMap { + return PropertynamesValidation1BoxedMap(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: Any?, configuration: SchemaConfiguration?): PropertynamesValidation1Boxed { + if (arg == null) { + return validateAndBox(null, configuration) + } else if (arg is Boolean) { + return validateAndBox(arg, configuration) + } else if (arg is String) { + return validateAndBox(arg, configuration) + } else if (arg is Number) { + return validateAndBox(arg, configuration) + } else if (arg is List<*>) { + return validateAndBox(arg, configuration) + } else if (arg is Map<*, *>) { + return validateAndBox(arg, configuration) + } + throw ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema") + } + } +} diff --git a/samples/client/3_1_0_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/schemas/RegexFormat.kt b/samples/client/3_1_0_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/schemas/RegexFormat.kt new file mode 100644 index 00000000000..d0690c620f3 --- /dev/null +++ b/samples/client/3_1_0_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/schemas/RegexFormat.kt @@ -0,0 +1,308 @@ +package org.openapijsonschematools.client.components.schemas +import java.time.LocalDate +import java.time.ZonedDateTime +import java.util.UUID +import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags +import org.openapijsonschematools.client.configurations.SchemaConfiguration +import org.openapijsonschematools.client.exceptions.InvalidAdditionalPropertyException +import org.openapijsonschematools.client.exceptions.UnsetPropertyException +import org.openapijsonschematools.client.exceptions.ValidationException +import org.openapijsonschematools.client.schemas.UnsetAddPropsSetter +import org.openapijsonschematools.client.schemas.validation.BooleanSchemaValidator +import org.openapijsonschematools.client.schemas.validation.FrozenList +import org.openapijsonschematools.client.schemas.validation.FrozenMap +import org.openapijsonschematools.client.schemas.validation.JsonSchema +import org.openapijsonschematools.client.schemas.validation.JsonSchemaInfo +import org.openapijsonschematools.client.schemas.validation.ListSchemaValidator +import org.openapijsonschematools.client.schemas.validation.MapSchemaValidator +import org.openapijsonschematools.client.schemas.validation.NullSchemaValidator +import org.openapijsonschematools.client.schemas.validation.NumberSchemaValidator +import org.openapijsonschematools.client.schemas.validation.PathToSchemasMap +import org.openapijsonschematools.client.schemas.validation.StringSchemaValidator +import org.openapijsonschematools.client.schemas.validation.ValidationMetadata + +class RegexFormat { + // nest classes so all schemas and input/output classes can be public + + + sealed interface RegexFormat1Boxed { + fun getData(): Any? + } + + data class RegexFormat1BoxedVoid(val data: Nothing?) : RegexFormat1Boxed { + override fun getData(): Any? { + return data + } + } + + data class RegexFormat1BoxedBoolean(val data: Boolean): RegexFormat1Boxed { + override fun getData(): Any? { + return data + } + } + + data class RegexFormat1BoxedNumber(val data: Number) : RegexFormat1Boxed { + override fun getData(): Any? { + return data + } + } + + data class RegexFormat1BoxedString(val data: String) : RegexFormat1Boxed { + override fun getData(): Any? { + return data + } + } + + data class RegexFormat1BoxedList(val data: FrozenList) : RegexFormat1Boxed { + override fun getData(): Any? { + return data + } + } + + data class RegexFormat1BoxedMap(val data: FrozenMap) : RegexFormat1Boxed { + override fun getData(): Any? { + return data + } + } + + + class RegexFormat1 private constructor(): JsonSchema( + JsonSchemaInfo() + .format("regex") + ), NullSchemaValidator, BooleanSchemaValidator, NumberSchemaValidator, StringSchemaValidator, ListSchemaValidator, RegexFormat1BoxedList>, MapSchemaValidator, RegexFormat1BoxedMap> { + /* + NOTE: This class is auto generated by OpenAPI JSON Schema Generator. + Ref: https://github.com/openapi-json-schema-tools/openapi-json-schema-generator + + Do not edit the class manually. + */ + + companion object { + @Volatile + private var instance: RegexFormat1? = null + + fun getInstance() = + instance ?: synchronized(this) { + instance ?: RegexFormat1().also { instance = it } + } + } + + @Throws(ValidationException::class) + override fun validate(arg: Nothing?, configuration: SchemaConfiguration?): Nothing? { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validatedPathToSchemas = PathToSchemasMap() + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, LinkedHashSet()) + getPathToSchemas(this, castArg, validationMetadata, pathSet) + return castArg + } + + @Throws(ValidationException::class) + override fun validate(arg: Boolean, configuration: SchemaConfiguration?): Boolean { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validatedPathToSchemas = PathToSchemasMap() + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, LinkedHashSet()) + getPathToSchemas(this, castArg, validationMetadata, pathSet) + return castArg + } + + @Throws(ValidationException::class) + override fun validate(arg: Number, configuration: SchemaConfiguration?): Number { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validatedPathToSchemas = PathToSchemasMap() + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, LinkedHashSet()) + getPathToSchemas(this, castArg, validationMetadata, pathSet) + return castArg + } + + @Throws(ValidationException::class) + fun validate(arg: Int, configuration: SchemaConfiguration?): Int { + return validate(arg as Number, configuration) as Int + } + + @Throws(ValidationException::class) + fun validate(arg: Long, configuration: SchemaConfiguration?): Long { + return validate(arg as Number, configuration) as Long + } + + @Throws(ValidationException::class) + fun validate(arg: Float, configuration: SchemaConfiguration?): Float { + return validate(arg as Number, configuration) as Float + } + + @Throws(ValidationException::class) + fun validate(arg: Double, configuration: SchemaConfiguration?): Double { + return validate(arg as Number, configuration) as Double + } + + @Throws(ValidationException::class) + override fun validate(arg: String, configuration: SchemaConfiguration?): String { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validatedPathToSchemas = PathToSchemasMap() + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, LinkedHashSet()) + getPathToSchemas(this, castArg, validationMetadata, pathSet) + return castArg + } + + @Throws(ValidationException::class) + fun validate(arg: LocalDate, configuration: SchemaConfiguration?): String { + return validate(arg.toString(), configuration) + } + + @Throws(ValidationException::class) + fun validate(arg: ZonedDateTime, configuration: SchemaConfiguration?): String { + return validate(arg.toString(), configuration) + } + + @Throws(ValidationException::class) + fun validate(arg: UUID, configuration: SchemaConfiguration?): String { + return validate(arg.toString(), configuration) + } + + override fun getNewInstance(arg: List<*>, pathToItem: List, pathToSchemas: PathToSchemasMap): FrozenList { + val items: MutableList = ArrayList() + var i: Int = 0 + for (item: Any? in arg) { + val itemPathToItem = pathToItem + i + val schemas: LinkedHashMap, Nothing?>? = pathToSchemas.get(itemPathToItem) + if (schemas == null) { + throw RuntimeException("Validation result is invalid, schemas must exist for a pathToItem") + } + val itemSchema: JsonSchema<*> = schemas.entries.iterator().next().key + val itemInstance: Any? = itemSchema.getNewInstance(item, itemPathToItem, pathToSchemas) + items.add(itemInstance) + i += 1 + } + val newInstanceItems: FrozenList = FrozenList(items) + return newInstanceItems + } + + @Throws(ValidationException::class) + override fun validate(arg: List<*>, configuration: SchemaConfiguration?): FrozenList { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, PathToSchemasMap(), LinkedHashSet()) + val pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet) + return getNewInstance(castArg, validationMetadata.pathToItem, pathToSchemasMap) + } + + override fun getNewInstance(arg: Map<*, *>, pathToItem: List, pathToSchemas: PathToSchemasMap): FrozenMap { + val properties: LinkedHashMap = LinkedHashMap() + for((propertyName, value) in arg) { + if (!(propertyName is String)) { + throw RuntimeException("Invalid non-string key value") + } + val propertyPathToItem: List = pathToItem + propertyName + val schemas: LinkedHashMap, Nothing?>? = pathToSchemas.get(propertyPathToItem) + if (schemas == null) { + throw RuntimeException("Validation result is invalid, schemas must exist for a pathToItem") + } + val propertySchema: JsonSchema<*> = schemas.entries.iterator().next().key + val propertyInstance: Any? = propertySchema.getNewInstance(value, propertyPathToItem, pathToSchemas) + properties[propertyName] = propertyInstance + } + val castProperties: FrozenMap = FrozenMap(properties) + return castProperties + } + + @Throws(ValidationException::class) + override fun validate(arg: Map<*, *>, configuration: SchemaConfiguration?): FrozenMap { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validatedPathToSchemas = PathToSchemasMap() + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, LinkedHashSet()) + val pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet) + return getNewInstance(castArg, validationMetadata.pathToItem, pathToSchemasMap) + } + + @Throws(ValidationException::class) + override fun validate(arg: Any?, configuration: SchemaConfiguration?): Any? { + if (arg == null) { + return validate(null, configuration) + } else if (arg is Boolean) { + return validate(arg, configuration) + } else if (arg is Number) { + return validate(arg, configuration) + } else if (arg is String) { + return validate(arg, configuration) + } else if (arg is List<*>) { + return validate(arg, configuration) + } else if (arg is Map<*, *>) { + return validate(arg, configuration) + } + throw ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema") + } + override fun getNewInstance(arg: Any?, pathToItem: List, pathToSchemas: PathToSchemasMap): Any? { + if (arg == null) { + return getNewInstance( null, pathToItem, pathToSchemas) + } else if (arg is Boolean) { + return getNewInstance(arg, pathToItem, pathToSchemas) + } else if (arg is Number) { + return getNewInstance(arg, pathToItem, pathToSchemas) + } else if (arg is String) { + return getNewInstance(arg, pathToItem, pathToSchemas) + } else if (arg is List<*>) { + return getNewInstance(arg, pathToItem, pathToSchemas) + } else if (arg is Map<*, *>) { + return getNewInstance(arg, pathToItem, pathToSchemas) + } + throw RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema") + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: Nothing?, configuration: SchemaConfiguration?): RegexFormat1BoxedVoid { + return RegexFormat1BoxedVoid(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: Boolean, configuration: SchemaConfiguration?): RegexFormat1BoxedBoolean { + return RegexFormat1BoxedBoolean(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: Number, configuration: SchemaConfiguration?): RegexFormat1BoxedNumber { + return RegexFormat1BoxedNumber(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: String, configuration: SchemaConfiguration?): RegexFormat1BoxedString { + return RegexFormat1BoxedString(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: List<*>, configuration: SchemaConfiguration?): RegexFormat1BoxedList { + return RegexFormat1BoxedList(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: Map<*, *>, configuration: SchemaConfiguration?): RegexFormat1BoxedMap { + return RegexFormat1BoxedMap(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: Any?, configuration: SchemaConfiguration?): RegexFormat1Boxed { + if (arg == null) { + return validateAndBox(null, configuration) + } else if (arg is Boolean) { + return validateAndBox(arg, configuration) + } else if (arg is String) { + return validateAndBox(arg, configuration) + } else if (arg is Number) { + return validateAndBox(arg, configuration) + } else if (arg is List<*>) { + return validateAndBox(arg, configuration) + } else if (arg is Map<*, *>) { + return validateAndBox(arg, configuration) + } + throw ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema") + } + } +} diff --git a/samples/client/3_1_0_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/schemas/RegexesAreNotAnchoredByDefaultAndAreCaseSensitive.kt b/samples/client/3_1_0_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/schemas/RegexesAreNotAnchoredByDefaultAndAreCaseSensitive.kt new file mode 100644 index 00000000000..83a2174d06a --- /dev/null +++ b/samples/client/3_1_0_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/schemas/RegexesAreNotAnchoredByDefaultAndAreCaseSensitive.kt @@ -0,0 +1,341 @@ +package org.openapijsonschematools.client.components.schemas +import java.time.LocalDate +import java.time.ZonedDateTime +import java.util.AbstractMap +import java.util.UUID +import java.util.regex.Pattern +import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags +import org.openapijsonschematools.client.configurations.SchemaConfiguration +import org.openapijsonschematools.client.exceptions.InvalidAdditionalPropertyException +import org.openapijsonschematools.client.exceptions.UnsetPropertyException +import org.openapijsonschematools.client.exceptions.ValidationException +import org.openapijsonschematools.client.schemas.BooleanJsonSchema +import org.openapijsonschematools.client.schemas.StringJsonSchema +import org.openapijsonschematools.client.schemas.UnsetAddPropsSetter +import org.openapijsonschematools.client.schemas.validation.BooleanSchemaValidator +import org.openapijsonschematools.client.schemas.validation.FrozenList +import org.openapijsonschematools.client.schemas.validation.FrozenMap +import org.openapijsonschematools.client.schemas.validation.JsonSchema +import org.openapijsonschematools.client.schemas.validation.JsonSchemaInfo +import org.openapijsonschematools.client.schemas.validation.ListSchemaValidator +import org.openapijsonschematools.client.schemas.validation.MapSchemaValidator +import org.openapijsonschematools.client.schemas.validation.NullSchemaValidator +import org.openapijsonschematools.client.schemas.validation.NumberSchemaValidator +import org.openapijsonschematools.client.schemas.validation.PathToSchemasMap +import org.openapijsonschematools.client.schemas.validation.StringSchemaValidator +import org.openapijsonschematools.client.schemas.validation.ValidationMetadata + +class RegexesAreNotAnchoredByDefaultAndAreCaseSensitive { + // nest classes so all schemas and input/output classes can be public + + + class Schema092 : BooleanJsonSchema.BooleanJsonSchema1() { + companion object { + @Volatile + private var instance: Schema092? = null + + fun getInstance() = + instance ?: synchronized(this) { + instance ?: Schema092().also { instance = it } + } + } + } + + + class X : StringJsonSchema.StringJsonSchema1() { + companion object { + @Volatile + private var instance: X? = null + + fun getInstance() = + instance ?: synchronized(this) { + instance ?: X().also { instance = it } + } + } + } + + + sealed interface RegexesAreNotAnchoredByDefaultAndAreCaseSensitive1Boxed { + fun getData(): Any? + } + + data class RegexesAreNotAnchoredByDefaultAndAreCaseSensitive1BoxedVoid(val data: Nothing?) : RegexesAreNotAnchoredByDefaultAndAreCaseSensitive1Boxed { + override fun getData(): Any? { + return data + } + } + + data class RegexesAreNotAnchoredByDefaultAndAreCaseSensitive1BoxedBoolean(val data: Boolean): RegexesAreNotAnchoredByDefaultAndAreCaseSensitive1Boxed { + override fun getData(): Any? { + return data + } + } + + data class RegexesAreNotAnchoredByDefaultAndAreCaseSensitive1BoxedNumber(val data: Number) : RegexesAreNotAnchoredByDefaultAndAreCaseSensitive1Boxed { + override fun getData(): Any? { + return data + } + } + + data class RegexesAreNotAnchoredByDefaultAndAreCaseSensitive1BoxedString(val data: String) : RegexesAreNotAnchoredByDefaultAndAreCaseSensitive1Boxed { + override fun getData(): Any? { + return data + } + } + + data class RegexesAreNotAnchoredByDefaultAndAreCaseSensitive1BoxedList(val data: FrozenList) : RegexesAreNotAnchoredByDefaultAndAreCaseSensitive1Boxed { + override fun getData(): Any? { + return data + } + } + + data class RegexesAreNotAnchoredByDefaultAndAreCaseSensitive1BoxedMap(val data: FrozenMap) : RegexesAreNotAnchoredByDefaultAndAreCaseSensitive1Boxed { + override fun getData(): Any? { + return data + } + } + + + class RegexesAreNotAnchoredByDefaultAndAreCaseSensitive1 private constructor(): JsonSchema( + JsonSchemaInfo() + .patternProperties(mapOf( + new AbstractMap.SimpleEntry<>(Pattern.compile("[0-9]{2,}"), Schema092::class.java), + new AbstractMap.SimpleEntry<>(Pattern.compile("X_"), X::class.java) + )) + ), NullSchemaValidator, BooleanSchemaValidator, NumberSchemaValidator, StringSchemaValidator, ListSchemaValidator, RegexesAreNotAnchoredByDefaultAndAreCaseSensitive1BoxedList>, MapSchemaValidator, RegexesAreNotAnchoredByDefaultAndAreCaseSensitive1BoxedMap> { + /* + NOTE: This class is auto generated by OpenAPI JSON Schema Generator. + Ref: https://github.com/openapi-json-schema-tools/openapi-json-schema-generator + + Do not edit the class manually. + */ + + companion object { + @Volatile + private var instance: RegexesAreNotAnchoredByDefaultAndAreCaseSensitive1? = null + + fun getInstance() = + instance ?: synchronized(this) { + instance ?: RegexesAreNotAnchoredByDefaultAndAreCaseSensitive1().also { instance = it } + } + } + + @Throws(ValidationException::class) + override fun validate(arg: Nothing?, configuration: SchemaConfiguration?): Nothing? { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validatedPathToSchemas = PathToSchemasMap() + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, LinkedHashSet()) + getPathToSchemas(this, castArg, validationMetadata, pathSet) + return castArg + } + + @Throws(ValidationException::class) + override fun validate(arg: Boolean, configuration: SchemaConfiguration?): Boolean { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validatedPathToSchemas = PathToSchemasMap() + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, LinkedHashSet()) + getPathToSchemas(this, castArg, validationMetadata, pathSet) + return castArg + } + + @Throws(ValidationException::class) + override fun validate(arg: Number, configuration: SchemaConfiguration?): Number { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validatedPathToSchemas = PathToSchemasMap() + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, LinkedHashSet()) + getPathToSchemas(this, castArg, validationMetadata, pathSet) + return castArg + } + + @Throws(ValidationException::class) + fun validate(arg: Int, configuration: SchemaConfiguration?): Int { + return validate(arg as Number, configuration) as Int + } + + @Throws(ValidationException::class) + fun validate(arg: Long, configuration: SchemaConfiguration?): Long { + return validate(arg as Number, configuration) as Long + } + + @Throws(ValidationException::class) + fun validate(arg: Float, configuration: SchemaConfiguration?): Float { + return validate(arg as Number, configuration) as Float + } + + @Throws(ValidationException::class) + fun validate(arg: Double, configuration: SchemaConfiguration?): Double { + return validate(arg as Number, configuration) as Double + } + + @Throws(ValidationException::class) + override fun validate(arg: String, configuration: SchemaConfiguration?): String { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validatedPathToSchemas = PathToSchemasMap() + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, LinkedHashSet()) + getPathToSchemas(this, castArg, validationMetadata, pathSet) + return castArg + } + + @Throws(ValidationException::class) + fun validate(arg: LocalDate, configuration: SchemaConfiguration?): String { + return validate(arg.toString(), configuration) + } + + @Throws(ValidationException::class) + fun validate(arg: ZonedDateTime, configuration: SchemaConfiguration?): String { + return validate(arg.toString(), configuration) + } + + @Throws(ValidationException::class) + fun validate(arg: UUID, configuration: SchemaConfiguration?): String { + return validate(arg.toString(), configuration) + } + + override fun getNewInstance(arg: List<*>, pathToItem: List, pathToSchemas: PathToSchemasMap): FrozenList { + val items: MutableList = ArrayList() + var i: Int = 0 + for (item: Any? in arg) { + val itemPathToItem = pathToItem + i + val schemas: LinkedHashMap, Nothing?>? = pathToSchemas.get(itemPathToItem) + if (schemas == null) { + throw RuntimeException("Validation result is invalid, schemas must exist for a pathToItem") + } + val itemSchema: JsonSchema<*> = schemas.entries.iterator().next().key + val itemInstance: Any? = itemSchema.getNewInstance(item, itemPathToItem, pathToSchemas) + items.add(itemInstance) + i += 1 + } + val newInstanceItems: FrozenList = FrozenList(items) + return newInstanceItems + } + + @Throws(ValidationException::class) + override fun validate(arg: List<*>, configuration: SchemaConfiguration?): FrozenList { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, PathToSchemasMap(), LinkedHashSet()) + val pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet) + return getNewInstance(castArg, validationMetadata.pathToItem, pathToSchemasMap) + } + + override fun getNewInstance(arg: Map<*, *>, pathToItem: List, pathToSchemas: PathToSchemasMap): FrozenMap { + val properties: LinkedHashMap = LinkedHashMap() + for((propertyName, value) in arg) { + if (!(propertyName is String)) { + throw RuntimeException("Invalid non-string key value") + } + val propertyPathToItem: List = pathToItem + propertyName + val schemas: LinkedHashMap, Nothing?>? = pathToSchemas.get(propertyPathToItem) + if (schemas == null) { + throw RuntimeException("Validation result is invalid, schemas must exist for a pathToItem") + } + val propertySchema: JsonSchema<*> = schemas.entries.iterator().next().key + val propertyInstance: Any? = propertySchema.getNewInstance(value, propertyPathToItem, pathToSchemas) + properties[propertyName] = propertyInstance + } + val castProperties: FrozenMap = FrozenMap(properties) + return castProperties + } + + @Throws(ValidationException::class) + override fun validate(arg: Map<*, *>, configuration: SchemaConfiguration?): FrozenMap { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validatedPathToSchemas = PathToSchemasMap() + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, LinkedHashSet()) + val pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet) + return getNewInstance(castArg, validationMetadata.pathToItem, pathToSchemasMap) + } + + @Throws(ValidationException::class) + override fun validate(arg: Any?, configuration: SchemaConfiguration?): Any? { + if (arg == null) { + return validate(null, configuration) + } else if (arg is Boolean) { + return validate(arg, configuration) + } else if (arg is Number) { + return validate(arg, configuration) + } else if (arg is String) { + return validate(arg, configuration) + } else if (arg is List<*>) { + return validate(arg, configuration) + } else if (arg is Map<*, *>) { + return validate(arg, configuration) + } + throw ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema") + } + override fun getNewInstance(arg: Any?, pathToItem: List, pathToSchemas: PathToSchemasMap): Any? { + if (arg == null) { + return getNewInstance( null, pathToItem, pathToSchemas) + } else if (arg is Boolean) { + return getNewInstance(arg, pathToItem, pathToSchemas) + } else if (arg is Number) { + return getNewInstance(arg, pathToItem, pathToSchemas) + } else if (arg is String) { + return getNewInstance(arg, pathToItem, pathToSchemas) + } else if (arg is List<*>) { + return getNewInstance(arg, pathToItem, pathToSchemas) + } else if (arg is Map<*, *>) { + return getNewInstance(arg, pathToItem, pathToSchemas) + } + throw RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema") + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: Nothing?, configuration: SchemaConfiguration?): RegexesAreNotAnchoredByDefaultAndAreCaseSensitive1BoxedVoid { + return RegexesAreNotAnchoredByDefaultAndAreCaseSensitive1BoxedVoid(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: Boolean, configuration: SchemaConfiguration?): RegexesAreNotAnchoredByDefaultAndAreCaseSensitive1BoxedBoolean { + return RegexesAreNotAnchoredByDefaultAndAreCaseSensitive1BoxedBoolean(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: Number, configuration: SchemaConfiguration?): RegexesAreNotAnchoredByDefaultAndAreCaseSensitive1BoxedNumber { + return RegexesAreNotAnchoredByDefaultAndAreCaseSensitive1BoxedNumber(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: String, configuration: SchemaConfiguration?): RegexesAreNotAnchoredByDefaultAndAreCaseSensitive1BoxedString { + return RegexesAreNotAnchoredByDefaultAndAreCaseSensitive1BoxedString(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: List<*>, configuration: SchemaConfiguration?): RegexesAreNotAnchoredByDefaultAndAreCaseSensitive1BoxedList { + return RegexesAreNotAnchoredByDefaultAndAreCaseSensitive1BoxedList(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: Map<*, *>, configuration: SchemaConfiguration?): RegexesAreNotAnchoredByDefaultAndAreCaseSensitive1BoxedMap { + return RegexesAreNotAnchoredByDefaultAndAreCaseSensitive1BoxedMap(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: Any?, configuration: SchemaConfiguration?): RegexesAreNotAnchoredByDefaultAndAreCaseSensitive1Boxed { + if (arg == null) { + return validateAndBox(null, configuration) + } else if (arg is Boolean) { + return validateAndBox(arg, configuration) + } else if (arg is String) { + return validateAndBox(arg, configuration) + } else if (arg is Number) { + return validateAndBox(arg, configuration) + } else if (arg is List<*>) { + return validateAndBox(arg, configuration) + } else if (arg is Map<*, *>) { + return validateAndBox(arg, configuration) + } + throw ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema") + } + } +} diff --git a/samples/client/3_1_0_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/schemas/RelativeJsonPointerFormat.kt b/samples/client/3_1_0_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/schemas/RelativeJsonPointerFormat.kt new file mode 100644 index 00000000000..6d7e164409f --- /dev/null +++ b/samples/client/3_1_0_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/schemas/RelativeJsonPointerFormat.kt @@ -0,0 +1,308 @@ +package org.openapijsonschematools.client.components.schemas +import java.time.LocalDate +import java.time.ZonedDateTime +import java.util.UUID +import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags +import org.openapijsonschematools.client.configurations.SchemaConfiguration +import org.openapijsonschematools.client.exceptions.InvalidAdditionalPropertyException +import org.openapijsonschematools.client.exceptions.UnsetPropertyException +import org.openapijsonschematools.client.exceptions.ValidationException +import org.openapijsonschematools.client.schemas.UnsetAddPropsSetter +import org.openapijsonschematools.client.schemas.validation.BooleanSchemaValidator +import org.openapijsonschematools.client.schemas.validation.FrozenList +import org.openapijsonschematools.client.schemas.validation.FrozenMap +import org.openapijsonschematools.client.schemas.validation.JsonSchema +import org.openapijsonschematools.client.schemas.validation.JsonSchemaInfo +import org.openapijsonschematools.client.schemas.validation.ListSchemaValidator +import org.openapijsonschematools.client.schemas.validation.MapSchemaValidator +import org.openapijsonschematools.client.schemas.validation.NullSchemaValidator +import org.openapijsonschematools.client.schemas.validation.NumberSchemaValidator +import org.openapijsonschematools.client.schemas.validation.PathToSchemasMap +import org.openapijsonschematools.client.schemas.validation.StringSchemaValidator +import org.openapijsonschematools.client.schemas.validation.ValidationMetadata + +class RelativeJsonPointerFormat { + // nest classes so all schemas and input/output classes can be public + + + sealed interface RelativeJsonPointerFormat1Boxed { + fun getData(): Any? + } + + data class RelativeJsonPointerFormat1BoxedVoid(val data: Nothing?) : RelativeJsonPointerFormat1Boxed { + override fun getData(): Any? { + return data + } + } + + data class RelativeJsonPointerFormat1BoxedBoolean(val data: Boolean): RelativeJsonPointerFormat1Boxed { + override fun getData(): Any? { + return data + } + } + + data class RelativeJsonPointerFormat1BoxedNumber(val data: Number) : RelativeJsonPointerFormat1Boxed { + override fun getData(): Any? { + return data + } + } + + data class RelativeJsonPointerFormat1BoxedString(val data: String) : RelativeJsonPointerFormat1Boxed { + override fun getData(): Any? { + return data + } + } + + data class RelativeJsonPointerFormat1BoxedList(val data: FrozenList) : RelativeJsonPointerFormat1Boxed { + override fun getData(): Any? { + return data + } + } + + data class RelativeJsonPointerFormat1BoxedMap(val data: FrozenMap) : RelativeJsonPointerFormat1Boxed { + override fun getData(): Any? { + return data + } + } + + + class RelativeJsonPointerFormat1 private constructor(): JsonSchema( + JsonSchemaInfo() + .format("relative-json-pointer") + ), NullSchemaValidator, BooleanSchemaValidator, NumberSchemaValidator, StringSchemaValidator, ListSchemaValidator, RelativeJsonPointerFormat1BoxedList>, MapSchemaValidator, RelativeJsonPointerFormat1BoxedMap> { + /* + NOTE: This class is auto generated by OpenAPI JSON Schema Generator. + Ref: https://github.com/openapi-json-schema-tools/openapi-json-schema-generator + + Do not edit the class manually. + */ + + companion object { + @Volatile + private var instance: RelativeJsonPointerFormat1? = null + + fun getInstance() = + instance ?: synchronized(this) { + instance ?: RelativeJsonPointerFormat1().also { instance = it } + } + } + + @Throws(ValidationException::class) + override fun validate(arg: Nothing?, configuration: SchemaConfiguration?): Nothing? { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validatedPathToSchemas = PathToSchemasMap() + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, LinkedHashSet()) + getPathToSchemas(this, castArg, validationMetadata, pathSet) + return castArg + } + + @Throws(ValidationException::class) + override fun validate(arg: Boolean, configuration: SchemaConfiguration?): Boolean { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validatedPathToSchemas = PathToSchemasMap() + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, LinkedHashSet()) + getPathToSchemas(this, castArg, validationMetadata, pathSet) + return castArg + } + + @Throws(ValidationException::class) + override fun validate(arg: Number, configuration: SchemaConfiguration?): Number { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validatedPathToSchemas = PathToSchemasMap() + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, LinkedHashSet()) + getPathToSchemas(this, castArg, validationMetadata, pathSet) + return castArg + } + + @Throws(ValidationException::class) + fun validate(arg: Int, configuration: SchemaConfiguration?): Int { + return validate(arg as Number, configuration) as Int + } + + @Throws(ValidationException::class) + fun validate(arg: Long, configuration: SchemaConfiguration?): Long { + return validate(arg as Number, configuration) as Long + } + + @Throws(ValidationException::class) + fun validate(arg: Float, configuration: SchemaConfiguration?): Float { + return validate(arg as Number, configuration) as Float + } + + @Throws(ValidationException::class) + fun validate(arg: Double, configuration: SchemaConfiguration?): Double { + return validate(arg as Number, configuration) as Double + } + + @Throws(ValidationException::class) + override fun validate(arg: String, configuration: SchemaConfiguration?): String { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validatedPathToSchemas = PathToSchemasMap() + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, LinkedHashSet()) + getPathToSchemas(this, castArg, validationMetadata, pathSet) + return castArg + } + + @Throws(ValidationException::class) + fun validate(arg: LocalDate, configuration: SchemaConfiguration?): String { + return validate(arg.toString(), configuration) + } + + @Throws(ValidationException::class) + fun validate(arg: ZonedDateTime, configuration: SchemaConfiguration?): String { + return validate(arg.toString(), configuration) + } + + @Throws(ValidationException::class) + fun validate(arg: UUID, configuration: SchemaConfiguration?): String { + return validate(arg.toString(), configuration) + } + + override fun getNewInstance(arg: List<*>, pathToItem: List, pathToSchemas: PathToSchemasMap): FrozenList { + val items: MutableList = ArrayList() + var i: Int = 0 + for (item: Any? in arg) { + val itemPathToItem = pathToItem + i + val schemas: LinkedHashMap, Nothing?>? = pathToSchemas.get(itemPathToItem) + if (schemas == null) { + throw RuntimeException("Validation result is invalid, schemas must exist for a pathToItem") + } + val itemSchema: JsonSchema<*> = schemas.entries.iterator().next().key + val itemInstance: Any? = itemSchema.getNewInstance(item, itemPathToItem, pathToSchemas) + items.add(itemInstance) + i += 1 + } + val newInstanceItems: FrozenList = FrozenList(items) + return newInstanceItems + } + + @Throws(ValidationException::class) + override fun validate(arg: List<*>, configuration: SchemaConfiguration?): FrozenList { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, PathToSchemasMap(), LinkedHashSet()) + val pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet) + return getNewInstance(castArg, validationMetadata.pathToItem, pathToSchemasMap) + } + + override fun getNewInstance(arg: Map<*, *>, pathToItem: List, pathToSchemas: PathToSchemasMap): FrozenMap { + val properties: LinkedHashMap = LinkedHashMap() + for((propertyName, value) in arg) { + if (!(propertyName is String)) { + throw RuntimeException("Invalid non-string key value") + } + val propertyPathToItem: List = pathToItem + propertyName + val schemas: LinkedHashMap, Nothing?>? = pathToSchemas.get(propertyPathToItem) + if (schemas == null) { + throw RuntimeException("Validation result is invalid, schemas must exist for a pathToItem") + } + val propertySchema: JsonSchema<*> = schemas.entries.iterator().next().key + val propertyInstance: Any? = propertySchema.getNewInstance(value, propertyPathToItem, pathToSchemas) + properties[propertyName] = propertyInstance + } + val castProperties: FrozenMap = FrozenMap(properties) + return castProperties + } + + @Throws(ValidationException::class) + override fun validate(arg: Map<*, *>, configuration: SchemaConfiguration?): FrozenMap { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validatedPathToSchemas = PathToSchemasMap() + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, LinkedHashSet()) + val pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet) + return getNewInstance(castArg, validationMetadata.pathToItem, pathToSchemasMap) + } + + @Throws(ValidationException::class) + override fun validate(arg: Any?, configuration: SchemaConfiguration?): Any? { + if (arg == null) { + return validate(null, configuration) + } else if (arg is Boolean) { + return validate(arg, configuration) + } else if (arg is Number) { + return validate(arg, configuration) + } else if (arg is String) { + return validate(arg, configuration) + } else if (arg is List<*>) { + return validate(arg, configuration) + } else if (arg is Map<*, *>) { + return validate(arg, configuration) + } + throw ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema") + } + override fun getNewInstance(arg: Any?, pathToItem: List, pathToSchemas: PathToSchemasMap): Any? { + if (arg == null) { + return getNewInstance( null, pathToItem, pathToSchemas) + } else if (arg is Boolean) { + return getNewInstance(arg, pathToItem, pathToSchemas) + } else if (arg is Number) { + return getNewInstance(arg, pathToItem, pathToSchemas) + } else if (arg is String) { + return getNewInstance(arg, pathToItem, pathToSchemas) + } else if (arg is List<*>) { + return getNewInstance(arg, pathToItem, pathToSchemas) + } else if (arg is Map<*, *>) { + return getNewInstance(arg, pathToItem, pathToSchemas) + } + throw RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema") + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: Nothing?, configuration: SchemaConfiguration?): RelativeJsonPointerFormat1BoxedVoid { + return RelativeJsonPointerFormat1BoxedVoid(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: Boolean, configuration: SchemaConfiguration?): RelativeJsonPointerFormat1BoxedBoolean { + return RelativeJsonPointerFormat1BoxedBoolean(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: Number, configuration: SchemaConfiguration?): RelativeJsonPointerFormat1BoxedNumber { + return RelativeJsonPointerFormat1BoxedNumber(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: String, configuration: SchemaConfiguration?): RelativeJsonPointerFormat1BoxedString { + return RelativeJsonPointerFormat1BoxedString(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: List<*>, configuration: SchemaConfiguration?): RelativeJsonPointerFormat1BoxedList { + return RelativeJsonPointerFormat1BoxedList(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: Map<*, *>, configuration: SchemaConfiguration?): RelativeJsonPointerFormat1BoxedMap { + return RelativeJsonPointerFormat1BoxedMap(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: Any?, configuration: SchemaConfiguration?): RelativeJsonPointerFormat1Boxed { + if (arg == null) { + return validateAndBox(null, configuration) + } else if (arg is Boolean) { + return validateAndBox(arg, configuration) + } else if (arg is String) { + return validateAndBox(arg, configuration) + } else if (arg is Number) { + return validateAndBox(arg, configuration) + } else if (arg is List<*>) { + return validateAndBox(arg, configuration) + } else if (arg is Map<*, *>) { + return validateAndBox(arg, configuration) + } + throw ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema") + } + } +} diff --git a/samples/client/3_1_0_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/schemas/RequiredDefaultValidation.kt b/samples/client/3_1_0_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/schemas/RequiredDefaultValidation.kt new file mode 100644 index 00000000000..5774da81ccc --- /dev/null +++ b/samples/client/3_1_0_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/schemas/RequiredDefaultValidation.kt @@ -0,0 +1,435 @@ +package org.openapijsonschematools.client.components.schemas +import java.time.LocalDate +import java.time.ZonedDateTime +import java.util.UUID +import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags +import org.openapijsonschematools.client.configurations.SchemaConfiguration +import org.openapijsonschematools.client.exceptions.InvalidAdditionalPropertyException +import org.openapijsonschematools.client.exceptions.UnsetPropertyException +import org.openapijsonschematools.client.exceptions.ValidationException +import org.openapijsonschematools.client.schemas.AnyTypeJsonSchema +import org.openapijsonschematools.client.schemas.GenericBuilder +import org.openapijsonschematools.client.schemas.UnsetAddPropsSetter +import org.openapijsonschematools.client.schemas.validation.BooleanSchemaValidator +import org.openapijsonschematools.client.schemas.validation.FrozenList +import org.openapijsonschematools.client.schemas.validation.FrozenMap +import org.openapijsonschematools.client.schemas.validation.JsonSchema +import org.openapijsonschematools.client.schemas.validation.JsonSchemaInfo +import org.openapijsonschematools.client.schemas.validation.ListSchemaValidator +import org.openapijsonschematools.client.schemas.validation.MapSchemaValidator +import org.openapijsonschematools.client.schemas.validation.NullSchemaValidator +import org.openapijsonschematools.client.schemas.validation.NumberSchemaValidator +import org.openapijsonschematools.client.schemas.validation.PathToSchemasMap +import org.openapijsonschematools.client.schemas.validation.StringSchemaValidator +import org.openapijsonschematools.client.schemas.validation.ValidationMetadata + +class RequiredDefaultValidation { + // nest classes so all schemas and input/output classes can be public + + + class Foo : AnyTypeJsonSchema.AnyTypeJsonSchema1() { + companion object { + @Volatile + private var instance: Foo? = null + + fun getInstance() = + instance ?: synchronized(this) { + instance ?: Foo().also { instance = it } + } + } + } + + + class RequiredDefaultValidationMap(m: FrozenMap) : FrozenMap(m) { + companion object { + val requiredKeys: Set = setOf() + val optionalKeys: Set = setOf( + "foo" + ) + @Throws(ValidationException::class) + fun of(arg: Map, configuration: SchemaConfiguration): RequiredDefaultValidationMap { + return RequiredDefaultValidation1.getInstance().validate(arg, configuration) + } + } + + @Throws(UnsetPropertyException::class) + fun foo(): Any? { + return getOrThrow("foo") + } + + @Throws(UnsetPropertyException::class, InvalidAdditionalPropertyException::class) + fun getAdditionalProperty(name: String): Any? { + throwIfKeyKnown(name, requiredKeys, optionalKeys) + throwIfKeyNotPresent(name) + return get(name) + } + } + + interface SetterForFoo { + fun getInstance(): MutableMap + fun getBuilderAfterFoo(instance: MutableMap): T + + fun foo(value: Nothing?): T { + val instance = getInstance() + instance["foo"] = null + return getBuilderAfterFoo(instance) + } + + fun foo(value: Boolean): T { + val instance = getInstance() + instance["foo"] = value + return getBuilderAfterFoo(instance) + } + + fun foo(value: String): T { + val instance = getInstance() + instance["foo"] = value + return getBuilderAfterFoo(instance) + } + + fun foo(value: Int): T { + val instance = getInstance() + instance["foo"] = value + return getBuilderAfterFoo(instance) + } + + fun foo(value: Float): T { + val instance = getInstance() + instance["foo"] = value + return getBuilderAfterFoo(instance) + } + + fun foo(value: Long): T { + val instance = getInstance() + instance["foo"] = value + return getBuilderAfterFoo(instance) + } + + fun foo(value: Double): T { + val instance = getInstance() + instance["foo"] = value + return getBuilderAfterFoo(instance) + } + + fun foo(value: List): T { + val instance = getInstance() + instance["foo"] = value + return getBuilderAfterFoo(instance) + } + + fun foo(value: Map): T { + val instance = getInstance() + instance["foo"] = value + return getBuilderAfterFoo(instance) + } + } + + class RequiredDefaultValidationMapBuilder: UnsetAddPropsSetter, GenericBuilder>, SetterForFoo { + private val knownKeys: Set = setOf( + "foo" + ) + override fun getKnownKeys(): Set { + return knownKeys + } + private val instance: MutableMap + init { + this.instance = LinkedHashMap() + } + override fun build(): Map { + return instance + } + override fun getInstance(): MutableMap { + return instance + } + override fun getBuilderAfterFoo(instance: MutableMap): RequiredDefaultValidationMapBuilder { + return this + } + override fun getBuilderAfterAdditionalProperty(instance: MutableMap): RequiredDefaultValidationMapBuilder { + return this + } + } + + + sealed interface RequiredDefaultValidation1Boxed { + fun getData(): Any? + } + + data class RequiredDefaultValidation1BoxedVoid(val data: Nothing?) : RequiredDefaultValidation1Boxed { + override fun getData(): Any? { + return data + } + } + + data class RequiredDefaultValidation1BoxedBoolean(val data: Boolean): RequiredDefaultValidation1Boxed { + override fun getData(): Any? { + return data + } + } + + data class RequiredDefaultValidation1BoxedNumber(val data: Number) : RequiredDefaultValidation1Boxed { + override fun getData(): Any? { + return data + } + } + + data class RequiredDefaultValidation1BoxedString(val data: String) : RequiredDefaultValidation1Boxed { + override fun getData(): Any? { + return data + } + } + + data class RequiredDefaultValidation1BoxedList(val data: FrozenList) : RequiredDefaultValidation1Boxed { + override fun getData(): Any? { + return data + } + } + + data class RequiredDefaultValidation1BoxedMap(val data: RequiredDefaultValidationMap) : RequiredDefaultValidation1Boxed { + override fun getData(): Any? { + return data + } + } + + + class RequiredDefaultValidation1 private constructor(): JsonSchema( + JsonSchemaInfo() + .properties(mapOf( + "foo" to Foo::class.java + )) + ), NullSchemaValidator, BooleanSchemaValidator, NumberSchemaValidator, StringSchemaValidator, ListSchemaValidator, RequiredDefaultValidation1BoxedList>, MapSchemaValidator { + /* + NOTE: This class is auto generated by OpenAPI JSON Schema Generator. + Ref: https://github.com/openapi-json-schema-tools/openapi-json-schema-generator + + Do not edit the class manually. + */ + + companion object { + @Volatile + private var instance: RequiredDefaultValidation1? = null + + fun getInstance() = + instance ?: synchronized(this) { + instance ?: RequiredDefaultValidation1().also { instance = it } + } + } + + @Throws(ValidationException::class) + override fun validate(arg: Nothing?, configuration: SchemaConfiguration?): Nothing? { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validatedPathToSchemas = PathToSchemasMap() + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, LinkedHashSet()) + getPathToSchemas(this, castArg, validationMetadata, pathSet) + return castArg + } + + @Throws(ValidationException::class) + override fun validate(arg: Boolean, configuration: SchemaConfiguration?): Boolean { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validatedPathToSchemas = PathToSchemasMap() + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, LinkedHashSet()) + getPathToSchemas(this, castArg, validationMetadata, pathSet) + return castArg + } + + @Throws(ValidationException::class) + override fun validate(arg: Number, configuration: SchemaConfiguration?): Number { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validatedPathToSchemas = PathToSchemasMap() + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, LinkedHashSet()) + getPathToSchemas(this, castArg, validationMetadata, pathSet) + return castArg + } + + @Throws(ValidationException::class) + fun validate(arg: Int, configuration: SchemaConfiguration?): Int { + return validate(arg as Number, configuration) as Int + } + + @Throws(ValidationException::class) + fun validate(arg: Long, configuration: SchemaConfiguration?): Long { + return validate(arg as Number, configuration) as Long + } + + @Throws(ValidationException::class) + fun validate(arg: Float, configuration: SchemaConfiguration?): Float { + return validate(arg as Number, configuration) as Float + } + + @Throws(ValidationException::class) + fun validate(arg: Double, configuration: SchemaConfiguration?): Double { + return validate(arg as Number, configuration) as Double + } + + @Throws(ValidationException::class) + override fun validate(arg: String, configuration: SchemaConfiguration?): String { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validatedPathToSchemas = PathToSchemasMap() + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, LinkedHashSet()) + getPathToSchemas(this, castArg, validationMetadata, pathSet) + return castArg + } + + @Throws(ValidationException::class) + fun validate(arg: LocalDate, configuration: SchemaConfiguration?): String { + return validate(arg.toString(), configuration) + } + + @Throws(ValidationException::class) + fun validate(arg: ZonedDateTime, configuration: SchemaConfiguration?): String { + return validate(arg.toString(), configuration) + } + + @Throws(ValidationException::class) + fun validate(arg: UUID, configuration: SchemaConfiguration?): String { + return validate(arg.toString(), configuration) + } + + override fun getNewInstance(arg: List<*>, pathToItem: List, pathToSchemas: PathToSchemasMap): FrozenList { + val items: MutableList = ArrayList() + var i: Int = 0 + for (item: Any? in arg) { + val itemPathToItem = pathToItem + i + val schemas: LinkedHashMap, Nothing?>? = pathToSchemas.get(itemPathToItem) + if (schemas == null) { + throw RuntimeException("Validation result is invalid, schemas must exist for a pathToItem") + } + val itemSchema: JsonSchema<*> = schemas.entries.iterator().next().key + val itemInstance: Any? = itemSchema.getNewInstance(item, itemPathToItem, pathToSchemas) + items.add(itemInstance) + i += 1 + } + val newInstanceItems: FrozenList = FrozenList(items) + return newInstanceItems + } + + @Throws(ValidationException::class) + override fun validate(arg: List<*>, configuration: SchemaConfiguration?): FrozenList { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, PathToSchemasMap(), LinkedHashSet()) + val pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet) + return getNewInstance(castArg, validationMetadata.pathToItem, pathToSchemasMap) + } + + override fun getNewInstance(arg: Map<*, *>, pathToItem: List, pathToSchemas: PathToSchemasMap): RequiredDefaultValidationMap { + val properties: LinkedHashMap = LinkedHashMap() + for((propertyName, value) in arg) { + if (!(propertyName is String)) { + throw RuntimeException("Invalid non-string key value") + } + val propertyPathToItem: List = pathToItem + propertyName + val schemas: LinkedHashMap, Nothing?>? = pathToSchemas.get(propertyPathToItem) + if (schemas == null) { + throw RuntimeException("Validation result is invalid, schemas must exist for a pathToItem") + } + val propertySchema: JsonSchema<*> = schemas.entries.iterator().next().key + val propertyInstance: Any? = propertySchema.getNewInstance(value, propertyPathToItem, pathToSchemas) + properties[propertyName] = propertyInstance + } + val castProperties: FrozenMap = FrozenMap(properties) + return RequiredDefaultValidationMap(castProperties) + } + + @Throws(ValidationException::class) + override fun validate(arg: Map<*, *>, configuration: SchemaConfiguration?): RequiredDefaultValidationMap { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validatedPathToSchemas = PathToSchemasMap() + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, LinkedHashSet()) + val pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet) + return getNewInstance(castArg, validationMetadata.pathToItem, pathToSchemasMap) + } + + @Throws(ValidationException::class) + override fun validate(arg: Any?, configuration: SchemaConfiguration?): Any? { + if (arg == null) { + return validate(null, configuration) + } else if (arg is Boolean) { + return validate(arg, configuration) + } else if (arg is Number) { + return validate(arg, configuration) + } else if (arg is String) { + return validate(arg, configuration) + } else if (arg is List<*>) { + return validate(arg, configuration) + } else if (arg is Map<*, *>) { + return validate(arg, configuration) + } + throw ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema") + } + override fun getNewInstance(arg: Any?, pathToItem: List, pathToSchemas: PathToSchemasMap): Any? { + if (arg == null) { + return getNewInstance( null, pathToItem, pathToSchemas) + } else if (arg is Boolean) { + return getNewInstance(arg, pathToItem, pathToSchemas) + } else if (arg is Number) { + return getNewInstance(arg, pathToItem, pathToSchemas) + } else if (arg is String) { + return getNewInstance(arg, pathToItem, pathToSchemas) + } else if (arg is List<*>) { + return getNewInstance(arg, pathToItem, pathToSchemas) + } else if (arg is Map<*, *>) { + return getNewInstance(arg, pathToItem, pathToSchemas) + } + throw RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema") + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: Nothing?, configuration: SchemaConfiguration?): RequiredDefaultValidation1BoxedVoid { + return RequiredDefaultValidation1BoxedVoid(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: Boolean, configuration: SchemaConfiguration?): RequiredDefaultValidation1BoxedBoolean { + return RequiredDefaultValidation1BoxedBoolean(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: Number, configuration: SchemaConfiguration?): RequiredDefaultValidation1BoxedNumber { + return RequiredDefaultValidation1BoxedNumber(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: String, configuration: SchemaConfiguration?): RequiredDefaultValidation1BoxedString { + return RequiredDefaultValidation1BoxedString(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: List<*>, configuration: SchemaConfiguration?): RequiredDefaultValidation1BoxedList { + return RequiredDefaultValidation1BoxedList(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: Map<*, *>, configuration: SchemaConfiguration?): RequiredDefaultValidation1BoxedMap { + return RequiredDefaultValidation1BoxedMap(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: Any?, configuration: SchemaConfiguration?): RequiredDefaultValidation1Boxed { + if (arg == null) { + return validateAndBox(null, configuration) + } else if (arg is Boolean) { + return validateAndBox(arg, configuration) + } else if (arg is String) { + return validateAndBox(arg, configuration) + } else if (arg is Number) { + return validateAndBox(arg, configuration) + } else if (arg is List<*>) { + return validateAndBox(arg, configuration) + } else if (arg is Map<*, *>) { + return validateAndBox(arg, configuration) + } + throw ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema") + } + } +} diff --git a/samples/client/3_1_0_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/schemas/RequiredPropertiesWhoseNamesAreJavascriptObjectPropertyNames.kt b/samples/client/3_1_0_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/schemas/RequiredPropertiesWhoseNamesAreJavascriptObjectPropertyNames.kt new file mode 100644 index 00000000000..cc017d5118b --- /dev/null +++ b/samples/client/3_1_0_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/schemas/RequiredPropertiesWhoseNamesAreJavascriptObjectPropertyNames.kt @@ -0,0 +1,623 @@ +package org.openapijsonschematools.client.components.schemas +import java.time.LocalDate +import java.time.ZonedDateTime +import java.util.UUID +import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags +import org.openapijsonschematools.client.configurations.SchemaConfiguration +import org.openapijsonschematools.client.exceptions.InvalidAdditionalPropertyException +import org.openapijsonschematools.client.exceptions.UnsetPropertyException +import org.openapijsonschematools.client.exceptions.ValidationException +import org.openapijsonschematools.client.schemas.GenericBuilder +import org.openapijsonschematools.client.schemas.UnsetAddPropsSetter +import org.openapijsonschematools.client.schemas.validation.BooleanSchemaValidator +import org.openapijsonschematools.client.schemas.validation.FrozenList +import org.openapijsonschematools.client.schemas.validation.FrozenMap +import org.openapijsonschematools.client.schemas.validation.JsonSchema +import org.openapijsonschematools.client.schemas.validation.JsonSchemaInfo +import org.openapijsonschematools.client.schemas.validation.ListSchemaValidator +import org.openapijsonschematools.client.schemas.validation.MapSchemaValidator +import org.openapijsonschematools.client.schemas.validation.NullSchemaValidator +import org.openapijsonschematools.client.schemas.validation.NumberSchemaValidator +import org.openapijsonschematools.client.schemas.validation.PathToSchemasMap +import org.openapijsonschematools.client.schemas.validation.StringSchemaValidator +import org.openapijsonschematools.client.schemas.validation.ValidationMetadata + +class RequiredPropertiesWhoseNamesAreJavascriptObjectPropertyNames { + // nest classes so all schemas and input/output classes can be public + + + class RequiredPropertiesWhoseNamesAreJavascriptObjectPropertyNamesMap(m: FrozenMap) : FrozenMap(m) { + companion object { + val requiredKeys: Set = setOf( + "__proto__", + "constructor", + "toString" + ) + val optionalKeys: Set = setOf() + @Throws(ValidationException::class) + fun of(arg: Map, configuration: SchemaConfiguration): RequiredPropertiesWhoseNamesAreJavascriptObjectPropertyNamesMap { + return RequiredPropertiesWhoseNamesAreJavascriptObjectPropertyNames1.getInstance().validate(arg, configuration) + } + } + + fun toString(): Any? { + try { + return getOrThrow("version") + } catch (e: UnsetPropertyException) { + throw RuntimeException(e) + } + } + + @Throws(UnsetPropertyException::class, InvalidAdditionalPropertyException::class) + fun getAdditionalProperty(name: String): Any? { + throwIfKeyKnown(name, requiredKeys, optionalKeys) + throwIfKeyNotPresent(name) + return get(name) + } + } + + interface SetterForProto { + fun getInstance(): MutableMap + fun getBuilderAfterProto(instance: MutableMap): T + + fun lowLineProto(value: Nothing?): T { + val instance = getInstance() + instance["__proto__"] = null + return getBuilderAfterProto(instance) + } + + fun lowLineProto(value: Boolean): T { + val instance = getInstance() + instance["__proto__"] = value + return getBuilderAfterProto(instance) + } + + fun lowLineProto(value: String): T { + val instance = getInstance() + instance["__proto__"] = value + return getBuilderAfterProto(instance) + } + + fun lowLineProto(value: Int): T { + val instance = getInstance() + instance["__proto__"] = value + return getBuilderAfterProto(instance) + } + + fun lowLineProto(value: Float): T { + val instance = getInstance() + instance["__proto__"] = value + return getBuilderAfterProto(instance) + } + + fun lowLineProto(value: Long): T { + val instance = getInstance() + instance["__proto__"] = value + return getBuilderAfterProto(instance) + } + + fun lowLineProto(value: Double): T { + val instance = getInstance() + instance["__proto__"] = value + return getBuilderAfterProto(instance) + } + + fun lowLineProto(value: List): T { + val instance = getInstance() + instance["__proto__"] = value + return getBuilderAfterProto(instance) + } + + fun lowLineProto(value: Map): T { + val instance = getInstance() + instance["__proto__"] = value + return getBuilderAfterProto(instance) + } + } + + interface SetterForConstructorSchema { + fun getInstance(): MutableMap + fun getBuilderAfterConstructorSchema(instance: MutableMap): T + + fun setConstructor(value: Nothing?): T { + val instance = getInstance() + instance["constructor"] = null + return getBuilderAfterConstructorSchema(instance) + } + + fun setConstructor(value: Boolean): T { + val instance = getInstance() + instance["constructor"] = value + return getBuilderAfterConstructorSchema(instance) + } + + fun setConstructor(value: String): T { + val instance = getInstance() + instance["constructor"] = value + return getBuilderAfterConstructorSchema(instance) + } + + fun setConstructor(value: Int): T { + val instance = getInstance() + instance["constructor"] = value + return getBuilderAfterConstructorSchema(instance) + } + + fun setConstructor(value: Float): T { + val instance = getInstance() + instance["constructor"] = value + return getBuilderAfterConstructorSchema(instance) + } + + fun setConstructor(value: Long): T { + val instance = getInstance() + instance["constructor"] = value + return getBuilderAfterConstructorSchema(instance) + } + + fun setConstructor(value: Double): T { + val instance = getInstance() + instance["constructor"] = value + return getBuilderAfterConstructorSchema(instance) + } + + fun setConstructor(value: List): T { + val instance = getInstance() + instance["constructor"] = value + return getBuilderAfterConstructorSchema(instance) + } + + fun setConstructor(value: Map): T { + val instance = getInstance() + instance["constructor"] = value + return getBuilderAfterConstructorSchema(instance) + } + } + + interface SetterForToString { + fun getInstance(): MutableMap + fun getBuilderAfterToString(instance: MutableMap): T + + fun toString(value: Nothing?): T { + val instance = getInstance() + instance["toString"] = null + return getBuilderAfterToString(instance) + } + + fun toString(value: Boolean): T { + val instance = getInstance() + instance["toString"] = value + return getBuilderAfterToString(instance) + } + + fun toString(value: String): T { + val instance = getInstance() + instance["toString"] = value + return getBuilderAfterToString(instance) + } + + fun toString(value: Int): T { + val instance = getInstance() + instance["toString"] = value + return getBuilderAfterToString(instance) + } + + fun toString(value: Float): T { + val instance = getInstance() + instance["toString"] = value + return getBuilderAfterToString(instance) + } + + fun toString(value: Long): T { + val instance = getInstance() + instance["toString"] = value + return getBuilderAfterToString(instance) + } + + fun toString(value: Double): T { + val instance = getInstance() + instance["toString"] = value + return getBuilderAfterToString(instance) + } + + fun toString(value: List): T { + val instance = getInstance() + instance["toString"] = value + return getBuilderAfterToString(instance) + } + + fun toString(value: Map): T { + val instance = getInstance() + instance["toString"] = value + return getBuilderAfterToString(instance) + } + } + + class RequiredPropertiesWhoseNamesAreJavascriptObjectPropertyNamesMap000Builder(private val instance: MutableMap): UnsetAddPropsSetter, GenericBuilder> { + private val knownKeys: Set = setOf( + "__proto__", + "constructor", + "toString" + ) + override fun getKnownKeys(): Set { + return knownKeys + } + override fun build(): Map { + return instance + } + override fun getInstance(): MutableMap { + return instance + } + override fun getBuilderAfterAdditionalProperty(instance: MutableMap): RequiredPropertiesWhoseNamesAreJavascriptObjectPropertyNamesMap000Builder { + return this + } + } + + class RequiredPropertiesWhoseNamesAreJavascriptObjectPropertyNamesMap001Builder(private val instance: MutableMap): SetterForToString { + override fun getInstance(): MutableMap { + return instance + } + override fun getBuilderAfterToString(instance: MutableMap): RequiredPropertiesWhoseNamesAreJavascriptObjectPropertyNamesMap000Builder { + return RequiredPropertiesWhoseNamesAreJavascriptObjectPropertyNamesMap000Builder(instance) + } + } + + class RequiredPropertiesWhoseNamesAreJavascriptObjectPropertyNamesMap010Builder(private val instance: MutableMap): SetterForConstructorSchema { + override fun getInstance(): MutableMap { + return instance + } + override fun getBuilderAfterConstructorSchema(instance: MutableMap): RequiredPropertiesWhoseNamesAreJavascriptObjectPropertyNamesMap000Builder { + return RequiredPropertiesWhoseNamesAreJavascriptObjectPropertyNamesMap000Builder(instance) + } + } + + class RequiredPropertiesWhoseNamesAreJavascriptObjectPropertyNamesMap011Builder(private val instance: MutableMap): SetterForConstructorSchema, SetterForToString { + override fun getInstance(): MutableMap { + return instance + } + override fun getBuilderAfterConstructorSchema(instance: MutableMap): RequiredPropertiesWhoseNamesAreJavascriptObjectPropertyNamesMap001Builder { + return RequiredPropertiesWhoseNamesAreJavascriptObjectPropertyNamesMap001Builder(instance) + } + override fun getBuilderAfterToString(instance: MutableMap): RequiredPropertiesWhoseNamesAreJavascriptObjectPropertyNamesMap010Builder { + return RequiredPropertiesWhoseNamesAreJavascriptObjectPropertyNamesMap010Builder(instance) + } + } + + class RequiredPropertiesWhoseNamesAreJavascriptObjectPropertyNamesMap100Builder(private val instance: MutableMap): SetterForProto { + override fun getInstance(): MutableMap { + return instance + } + override fun getBuilderAfterProto(instance: MutableMap): RequiredPropertiesWhoseNamesAreJavascriptObjectPropertyNamesMap000Builder { + return RequiredPropertiesWhoseNamesAreJavascriptObjectPropertyNamesMap000Builder(instance) + } + } + + class RequiredPropertiesWhoseNamesAreJavascriptObjectPropertyNamesMap101Builder(private val instance: MutableMap): SetterForProto, SetterForToString { + override fun getInstance(): MutableMap { + return instance + } + override fun getBuilderAfterProto(instance: MutableMap): RequiredPropertiesWhoseNamesAreJavascriptObjectPropertyNamesMap001Builder { + return RequiredPropertiesWhoseNamesAreJavascriptObjectPropertyNamesMap001Builder(instance) + } + override fun getBuilderAfterToString(instance: MutableMap): RequiredPropertiesWhoseNamesAreJavascriptObjectPropertyNamesMap100Builder { + return RequiredPropertiesWhoseNamesAreJavascriptObjectPropertyNamesMap100Builder(instance) + } + } + + class RequiredPropertiesWhoseNamesAreJavascriptObjectPropertyNamesMap110Builder(private val instance: MutableMap): SetterForProto, SetterForConstructorSchema { + override fun getInstance(): MutableMap { + return instance + } + override fun getBuilderAfterProto(instance: MutableMap): RequiredPropertiesWhoseNamesAreJavascriptObjectPropertyNamesMap010Builder { + return RequiredPropertiesWhoseNamesAreJavascriptObjectPropertyNamesMap010Builder(instance) + } + override fun getBuilderAfterConstructorSchema(instance: MutableMap): RequiredPropertiesWhoseNamesAreJavascriptObjectPropertyNamesMap100Builder { + return RequiredPropertiesWhoseNamesAreJavascriptObjectPropertyNamesMap100Builder(instance) + } + } + + class RequiredPropertiesWhoseNamesAreJavascriptObjectPropertyNamesMapBuilder: SetterForProto, SetterForConstructorSchema, SetterForToString { + private val instance: MutableMap + init { + this.instance = LinkedHashMap() + } + override fun getInstance(): MutableMap { + return instance + } + override fun getBuilderAfterProto(instance: MutableMap): RequiredPropertiesWhoseNamesAreJavascriptObjectPropertyNamesMap011Builder { + return RequiredPropertiesWhoseNamesAreJavascriptObjectPropertyNamesMap011Builder(instance) + } + override fun getBuilderAfterConstructorSchema(instance: MutableMap): RequiredPropertiesWhoseNamesAreJavascriptObjectPropertyNamesMap101Builder { + return RequiredPropertiesWhoseNamesAreJavascriptObjectPropertyNamesMap101Builder(instance) + } + override fun getBuilderAfterToString(instance: MutableMap): RequiredPropertiesWhoseNamesAreJavascriptObjectPropertyNamesMap110Builder { + return RequiredPropertiesWhoseNamesAreJavascriptObjectPropertyNamesMap110Builder(instance) + } + } + + + sealed interface RequiredPropertiesWhoseNamesAreJavascriptObjectPropertyNames1Boxed { + fun getData(): Any? + } + + data class RequiredPropertiesWhoseNamesAreJavascriptObjectPropertyNames1BoxedVoid(val data: Nothing?) : RequiredPropertiesWhoseNamesAreJavascriptObjectPropertyNames1Boxed { + override fun getData(): Any? { + return data + } + } + + data class RequiredPropertiesWhoseNamesAreJavascriptObjectPropertyNames1BoxedBoolean(val data: Boolean): RequiredPropertiesWhoseNamesAreJavascriptObjectPropertyNames1Boxed { + override fun getData(): Any? { + return data + } + } + + data class RequiredPropertiesWhoseNamesAreJavascriptObjectPropertyNames1BoxedNumber(val data: Number) : RequiredPropertiesWhoseNamesAreJavascriptObjectPropertyNames1Boxed { + override fun getData(): Any? { + return data + } + } + + data class RequiredPropertiesWhoseNamesAreJavascriptObjectPropertyNames1BoxedString(val data: String) : RequiredPropertiesWhoseNamesAreJavascriptObjectPropertyNames1Boxed { + override fun getData(): Any? { + return data + } + } + + data class RequiredPropertiesWhoseNamesAreJavascriptObjectPropertyNames1BoxedList(val data: FrozenList) : RequiredPropertiesWhoseNamesAreJavascriptObjectPropertyNames1Boxed { + override fun getData(): Any? { + return data + } + } + + data class RequiredPropertiesWhoseNamesAreJavascriptObjectPropertyNames1BoxedMap(val data: RequiredPropertiesWhoseNamesAreJavascriptObjectPropertyNamesMap) : RequiredPropertiesWhoseNamesAreJavascriptObjectPropertyNames1Boxed { + override fun getData(): Any? { + return data + } + } + + + class RequiredPropertiesWhoseNamesAreJavascriptObjectPropertyNames1 private constructor(): JsonSchema( + JsonSchemaInfo() + .required(setOf( + "__proto__", + "constructor", + "toString" + )) + ), NullSchemaValidator, BooleanSchemaValidator, NumberSchemaValidator, StringSchemaValidator, ListSchemaValidator, RequiredPropertiesWhoseNamesAreJavascriptObjectPropertyNames1BoxedList>, MapSchemaValidator { + /* + NOTE: This class is auto generated by OpenAPI JSON Schema Generator. + Ref: https://github.com/openapi-json-schema-tools/openapi-json-schema-generator + + Do not edit the class manually. + */ + + companion object { + @Volatile + private var instance: RequiredPropertiesWhoseNamesAreJavascriptObjectPropertyNames1? = null + + fun getInstance() = + instance ?: synchronized(this) { + instance ?: RequiredPropertiesWhoseNamesAreJavascriptObjectPropertyNames1().also { instance = it } + } + } + + @Throws(ValidationException::class) + override fun validate(arg: Nothing?, configuration: SchemaConfiguration?): Nothing? { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validatedPathToSchemas = PathToSchemasMap() + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, LinkedHashSet()) + getPathToSchemas(this, castArg, validationMetadata, pathSet) + return castArg + } + + @Throws(ValidationException::class) + override fun validate(arg: Boolean, configuration: SchemaConfiguration?): Boolean { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validatedPathToSchemas = PathToSchemasMap() + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, LinkedHashSet()) + getPathToSchemas(this, castArg, validationMetadata, pathSet) + return castArg + } + + @Throws(ValidationException::class) + override fun validate(arg: Number, configuration: SchemaConfiguration?): Number { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validatedPathToSchemas = PathToSchemasMap() + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, LinkedHashSet()) + getPathToSchemas(this, castArg, validationMetadata, pathSet) + return castArg + } + + @Throws(ValidationException::class) + fun validate(arg: Int, configuration: SchemaConfiguration?): Int { + return validate(arg as Number, configuration) as Int + } + + @Throws(ValidationException::class) + fun validate(arg: Long, configuration: SchemaConfiguration?): Long { + return validate(arg as Number, configuration) as Long + } + + @Throws(ValidationException::class) + fun validate(arg: Float, configuration: SchemaConfiguration?): Float { + return validate(arg as Number, configuration) as Float + } + + @Throws(ValidationException::class) + fun validate(arg: Double, configuration: SchemaConfiguration?): Double { + return validate(arg as Number, configuration) as Double + } + + @Throws(ValidationException::class) + override fun validate(arg: String, configuration: SchemaConfiguration?): String { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validatedPathToSchemas = PathToSchemasMap() + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, LinkedHashSet()) + getPathToSchemas(this, castArg, validationMetadata, pathSet) + return castArg + } + + @Throws(ValidationException::class) + fun validate(arg: LocalDate, configuration: SchemaConfiguration?): String { + return validate(arg.toString(), configuration) + } + + @Throws(ValidationException::class) + fun validate(arg: ZonedDateTime, configuration: SchemaConfiguration?): String { + return validate(arg.toString(), configuration) + } + + @Throws(ValidationException::class) + fun validate(arg: UUID, configuration: SchemaConfiguration?): String { + return validate(arg.toString(), configuration) + } + + override fun getNewInstance(arg: List<*>, pathToItem: List, pathToSchemas: PathToSchemasMap): FrozenList { + val items: MutableList = ArrayList() + var i: Int = 0 + for (item: Any? in arg) { + val itemPathToItem = pathToItem + i + val schemas: LinkedHashMap, Nothing?>? = pathToSchemas.get(itemPathToItem) + if (schemas == null) { + throw RuntimeException("Validation result is invalid, schemas must exist for a pathToItem") + } + val itemSchema: JsonSchema<*> = schemas.entries.iterator().next().key + val itemInstance: Any? = itemSchema.getNewInstance(item, itemPathToItem, pathToSchemas) + items.add(itemInstance) + i += 1 + } + val newInstanceItems: FrozenList = FrozenList(items) + return newInstanceItems + } + + @Throws(ValidationException::class) + override fun validate(arg: List<*>, configuration: SchemaConfiguration?): FrozenList { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, PathToSchemasMap(), LinkedHashSet()) + val pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet) + return getNewInstance(castArg, validationMetadata.pathToItem, pathToSchemasMap) + } + + override fun getNewInstance(arg: Map<*, *>, pathToItem: List, pathToSchemas: PathToSchemasMap): RequiredPropertiesWhoseNamesAreJavascriptObjectPropertyNamesMap { + val properties: LinkedHashMap = LinkedHashMap() + for((propertyName, value) in arg) { + if (!(propertyName is String)) { + throw RuntimeException("Invalid non-string key value") + } + val propertyPathToItem: List = pathToItem + propertyName + val schemas: LinkedHashMap, Nothing?>? = pathToSchemas.get(propertyPathToItem) + if (schemas == null) { + throw RuntimeException("Validation result is invalid, schemas must exist for a pathToItem") + } + val propertySchema: JsonSchema<*> = schemas.entries.iterator().next().key + val propertyInstance: Any? = propertySchema.getNewInstance(value, propertyPathToItem, pathToSchemas) + properties[propertyName] = propertyInstance + } + val castProperties: FrozenMap = FrozenMap(properties) + return RequiredPropertiesWhoseNamesAreJavascriptObjectPropertyNamesMap(castProperties) + } + + @Throws(ValidationException::class) + override fun validate(arg: Map<*, *>, configuration: SchemaConfiguration?): RequiredPropertiesWhoseNamesAreJavascriptObjectPropertyNamesMap { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validatedPathToSchemas = PathToSchemasMap() + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, LinkedHashSet()) + val pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet) + return getNewInstance(castArg, validationMetadata.pathToItem, pathToSchemasMap) + } + + @Throws(ValidationException::class) + override fun validate(arg: Any?, configuration: SchemaConfiguration?): Any? { + if (arg == null) { + return validate(null, configuration) + } else if (arg is Boolean) { + return validate(arg, configuration) + } else if (arg is Number) { + return validate(arg, configuration) + } else if (arg is String) { + return validate(arg, configuration) + } else if (arg is List<*>) { + return validate(arg, configuration) + } else if (arg is Map<*, *>) { + return validate(arg, configuration) + } + throw ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema") + } + override fun getNewInstance(arg: Any?, pathToItem: List, pathToSchemas: PathToSchemasMap): Any? { + if (arg == null) { + return getNewInstance( null, pathToItem, pathToSchemas) + } else if (arg is Boolean) { + return getNewInstance(arg, pathToItem, pathToSchemas) + } else if (arg is Number) { + return getNewInstance(arg, pathToItem, pathToSchemas) + } else if (arg is String) { + return getNewInstance(arg, pathToItem, pathToSchemas) + } else if (arg is List<*>) { + return getNewInstance(arg, pathToItem, pathToSchemas) + } else if (arg is Map<*, *>) { + return getNewInstance(arg, pathToItem, pathToSchemas) + } + throw RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema") + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: Nothing?, configuration: SchemaConfiguration?): RequiredPropertiesWhoseNamesAreJavascriptObjectPropertyNames1BoxedVoid { + return RequiredPropertiesWhoseNamesAreJavascriptObjectPropertyNames1BoxedVoid(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: Boolean, configuration: SchemaConfiguration?): RequiredPropertiesWhoseNamesAreJavascriptObjectPropertyNames1BoxedBoolean { + return RequiredPropertiesWhoseNamesAreJavascriptObjectPropertyNames1BoxedBoolean(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: Number, configuration: SchemaConfiguration?): RequiredPropertiesWhoseNamesAreJavascriptObjectPropertyNames1BoxedNumber { + return RequiredPropertiesWhoseNamesAreJavascriptObjectPropertyNames1BoxedNumber(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: String, configuration: SchemaConfiguration?): RequiredPropertiesWhoseNamesAreJavascriptObjectPropertyNames1BoxedString { + return RequiredPropertiesWhoseNamesAreJavascriptObjectPropertyNames1BoxedString(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: List<*>, configuration: SchemaConfiguration?): RequiredPropertiesWhoseNamesAreJavascriptObjectPropertyNames1BoxedList { + return RequiredPropertiesWhoseNamesAreJavascriptObjectPropertyNames1BoxedList(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: Map<*, *>, configuration: SchemaConfiguration?): RequiredPropertiesWhoseNamesAreJavascriptObjectPropertyNames1BoxedMap { + return RequiredPropertiesWhoseNamesAreJavascriptObjectPropertyNames1BoxedMap(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: Any?, configuration: SchemaConfiguration?): RequiredPropertiesWhoseNamesAreJavascriptObjectPropertyNames1Boxed { + if (arg == null) { + return validateAndBox(null, configuration) + } else if (arg is Boolean) { + return validateAndBox(arg, configuration) + } else if (arg is String) { + return validateAndBox(arg, configuration) + } else if (arg is Number) { + return validateAndBox(arg, configuration) + } else if (arg is List<*>) { + return validateAndBox(arg, configuration) + } else if (arg is Map<*, *>) { + return validateAndBox(arg, configuration) + } + throw ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema") + } + } +} diff --git a/samples/client/3_1_0_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/schemas/RequiredValidation.kt b/samples/client/3_1_0_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/schemas/RequiredValidation.kt new file mode 100644 index 00000000000..1ff4bb0d707 --- /dev/null +++ b/samples/client/3_1_0_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/schemas/RequiredValidation.kt @@ -0,0 +1,531 @@ +package org.openapijsonschematools.client.components.schemas +import java.time.LocalDate +import java.time.ZonedDateTime +import java.util.UUID +import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags +import org.openapijsonschematools.client.configurations.SchemaConfiguration +import org.openapijsonschematools.client.exceptions.InvalidAdditionalPropertyException +import org.openapijsonschematools.client.exceptions.UnsetPropertyException +import org.openapijsonschematools.client.exceptions.ValidationException +import org.openapijsonschematools.client.schemas.AnyTypeJsonSchema +import org.openapijsonschematools.client.schemas.GenericBuilder +import org.openapijsonschematools.client.schemas.UnsetAddPropsSetter +import org.openapijsonschematools.client.schemas.validation.BooleanSchemaValidator +import org.openapijsonschematools.client.schemas.validation.FrozenList +import org.openapijsonschematools.client.schemas.validation.FrozenMap +import org.openapijsonschematools.client.schemas.validation.JsonSchema +import org.openapijsonschematools.client.schemas.validation.JsonSchemaInfo +import org.openapijsonschematools.client.schemas.validation.ListSchemaValidator +import org.openapijsonschematools.client.schemas.validation.MapSchemaValidator +import org.openapijsonschematools.client.schemas.validation.NullSchemaValidator +import org.openapijsonschematools.client.schemas.validation.NumberSchemaValidator +import org.openapijsonschematools.client.schemas.validation.PathToSchemasMap +import org.openapijsonschematools.client.schemas.validation.StringSchemaValidator +import org.openapijsonschematools.client.schemas.validation.ValidationMetadata + +class RequiredValidation { + // nest classes so all schemas and input/output classes can be public + + + class Foo : AnyTypeJsonSchema.AnyTypeJsonSchema1() { + companion object { + @Volatile + private var instance: Foo? = null + + fun getInstance() = + instance ?: synchronized(this) { + instance ?: Foo().also { instance = it } + } + } + } + + + class Bar : AnyTypeJsonSchema.AnyTypeJsonSchema1() { + companion object { + @Volatile + private var instance: Bar? = null + + fun getInstance() = + instance ?: synchronized(this) { + instance ?: Bar().also { instance = it } + } + } + } + + + class RequiredValidationMap(m: FrozenMap) : FrozenMap(m) { + companion object { + val requiredKeys: Set = setOf( + "foo" + ) + val optionalKeys: Set = setOf( + "bar" + ) + @Throws(ValidationException::class) + fun of(arg: Map, configuration: SchemaConfiguration): RequiredValidationMap { + return RequiredValidation1.getInstance().validate(arg, configuration) + } + } + + fun foo(): Any? { + try { + return getOrThrow("version") + } catch (e: UnsetPropertyException) { + throw RuntimeException(e) + } + } + + @Throws(UnsetPropertyException::class) + fun bar(): Any? { + return getOrThrow("bar") + } + + @Throws(UnsetPropertyException::class, InvalidAdditionalPropertyException::class) + fun getAdditionalProperty(name: String): Any? { + throwIfKeyKnown(name, requiredKeys, optionalKeys) + throwIfKeyNotPresent(name) + return get(name) + } + } + + interface SetterForFoo { + fun getInstance(): MutableMap + fun getBuilderAfterFoo(instance: MutableMap): T + + fun foo(value: Nothing?): T { + val instance = getInstance() + instance["foo"] = null + return getBuilderAfterFoo(instance) + } + + fun foo(value: Boolean): T { + val instance = getInstance() + instance["foo"] = value + return getBuilderAfterFoo(instance) + } + + fun foo(value: String): T { + val instance = getInstance() + instance["foo"] = value + return getBuilderAfterFoo(instance) + } + + fun foo(value: Int): T { + val instance = getInstance() + instance["foo"] = value + return getBuilderAfterFoo(instance) + } + + fun foo(value: Float): T { + val instance = getInstance() + instance["foo"] = value + return getBuilderAfterFoo(instance) + } + + fun foo(value: Long): T { + val instance = getInstance() + instance["foo"] = value + return getBuilderAfterFoo(instance) + } + + fun foo(value: Double): T { + val instance = getInstance() + instance["foo"] = value + return getBuilderAfterFoo(instance) + } + + fun foo(value: List): T { + val instance = getInstance() + instance["foo"] = value + return getBuilderAfterFoo(instance) + } + + fun foo(value: Map): T { + val instance = getInstance() + instance["foo"] = value + return getBuilderAfterFoo(instance) + } + } + + interface SetterForBar { + fun getInstance(): MutableMap + fun getBuilderAfterBar(instance: MutableMap): T + + fun bar(value: Nothing?): T { + val instance = getInstance() + instance["bar"] = null + return getBuilderAfterBar(instance) + } + + fun bar(value: Boolean): T { + val instance = getInstance() + instance["bar"] = value + return getBuilderAfterBar(instance) + } + + fun bar(value: String): T { + val instance = getInstance() + instance["bar"] = value + return getBuilderAfterBar(instance) + } + + fun bar(value: Int): T { + val instance = getInstance() + instance["bar"] = value + return getBuilderAfterBar(instance) + } + + fun bar(value: Float): T { + val instance = getInstance() + instance["bar"] = value + return getBuilderAfterBar(instance) + } + + fun bar(value: Long): T { + val instance = getInstance() + instance["bar"] = value + return getBuilderAfterBar(instance) + } + + fun bar(value: Double): T { + val instance = getInstance() + instance["bar"] = value + return getBuilderAfterBar(instance) + } + + fun bar(value: List): T { + val instance = getInstance() + instance["bar"] = value + return getBuilderAfterBar(instance) + } + + fun bar(value: Map): T { + val instance = getInstance() + instance["bar"] = value + return getBuilderAfterBar(instance) + } + } + + class RequiredValidationMap0Builder(private val instance: MutableMap): UnsetAddPropsSetter, GenericBuilder>, SetterForBar { + private val knownKeys: Set = setOf( + "foo", + "bar" + ) + override fun getKnownKeys(): Set { + return knownKeys + } + override fun build(): Map { + return instance + } + override fun getInstance(): MutableMap { + return instance + } + override fun getBuilderAfterBar(instance: MutableMap): RequiredValidationMap0Builder { + return this + } + override fun getBuilderAfterAdditionalProperty(instance: MutableMap): RequiredValidationMap0Builder { + return this + } + } + + class RequiredValidationMapBuilder: SetterForFoo { + private val instance: MutableMap + init { + this.instance = LinkedHashMap() + } + override fun getInstance(): MutableMap { + return instance + } + override fun getBuilderAfterFoo(instance: MutableMap): RequiredValidationMap0Builder { + return RequiredValidationMap0Builder(instance) + } + } + + + sealed interface RequiredValidation1Boxed { + fun getData(): Any? + } + + data class RequiredValidation1BoxedVoid(val data: Nothing?) : RequiredValidation1Boxed { + override fun getData(): Any? { + return data + } + } + + data class RequiredValidation1BoxedBoolean(val data: Boolean): RequiredValidation1Boxed { + override fun getData(): Any? { + return data + } + } + + data class RequiredValidation1BoxedNumber(val data: Number) : RequiredValidation1Boxed { + override fun getData(): Any? { + return data + } + } + + data class RequiredValidation1BoxedString(val data: String) : RequiredValidation1Boxed { + override fun getData(): Any? { + return data + } + } + + data class RequiredValidation1BoxedList(val data: FrozenList) : RequiredValidation1Boxed { + override fun getData(): Any? { + return data + } + } + + data class RequiredValidation1BoxedMap(val data: RequiredValidationMap) : RequiredValidation1Boxed { + override fun getData(): Any? { + return data + } + } + + + class RequiredValidation1 private constructor(): JsonSchema( + JsonSchemaInfo() + .properties(mapOf( + "foo" to Foo::class.java, + "bar" to Bar::class.java + )) + .required(setOf( + "foo" + )) + ), NullSchemaValidator, BooleanSchemaValidator, NumberSchemaValidator, StringSchemaValidator, ListSchemaValidator, RequiredValidation1BoxedList>, MapSchemaValidator { + /* + NOTE: This class is auto generated by OpenAPI JSON Schema Generator. + Ref: https://github.com/openapi-json-schema-tools/openapi-json-schema-generator + + Do not edit the class manually. + */ + + companion object { + @Volatile + private var instance: RequiredValidation1? = null + + fun getInstance() = + instance ?: synchronized(this) { + instance ?: RequiredValidation1().also { instance = it } + } + } + + @Throws(ValidationException::class) + override fun validate(arg: Nothing?, configuration: SchemaConfiguration?): Nothing? { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validatedPathToSchemas = PathToSchemasMap() + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, LinkedHashSet()) + getPathToSchemas(this, castArg, validationMetadata, pathSet) + return castArg + } + + @Throws(ValidationException::class) + override fun validate(arg: Boolean, configuration: SchemaConfiguration?): Boolean { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validatedPathToSchemas = PathToSchemasMap() + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, LinkedHashSet()) + getPathToSchemas(this, castArg, validationMetadata, pathSet) + return castArg + } + + @Throws(ValidationException::class) + override fun validate(arg: Number, configuration: SchemaConfiguration?): Number { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validatedPathToSchemas = PathToSchemasMap() + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, LinkedHashSet()) + getPathToSchemas(this, castArg, validationMetadata, pathSet) + return castArg + } + + @Throws(ValidationException::class) + fun validate(arg: Int, configuration: SchemaConfiguration?): Int { + return validate(arg as Number, configuration) as Int + } + + @Throws(ValidationException::class) + fun validate(arg: Long, configuration: SchemaConfiguration?): Long { + return validate(arg as Number, configuration) as Long + } + + @Throws(ValidationException::class) + fun validate(arg: Float, configuration: SchemaConfiguration?): Float { + return validate(arg as Number, configuration) as Float + } + + @Throws(ValidationException::class) + fun validate(arg: Double, configuration: SchemaConfiguration?): Double { + return validate(arg as Number, configuration) as Double + } + + @Throws(ValidationException::class) + override fun validate(arg: String, configuration: SchemaConfiguration?): String { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validatedPathToSchemas = PathToSchemasMap() + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, LinkedHashSet()) + getPathToSchemas(this, castArg, validationMetadata, pathSet) + return castArg + } + + @Throws(ValidationException::class) + fun validate(arg: LocalDate, configuration: SchemaConfiguration?): String { + return validate(arg.toString(), configuration) + } + + @Throws(ValidationException::class) + fun validate(arg: ZonedDateTime, configuration: SchemaConfiguration?): String { + return validate(arg.toString(), configuration) + } + + @Throws(ValidationException::class) + fun validate(arg: UUID, configuration: SchemaConfiguration?): String { + return validate(arg.toString(), configuration) + } + + override fun getNewInstance(arg: List<*>, pathToItem: List, pathToSchemas: PathToSchemasMap): FrozenList { + val items: MutableList = ArrayList() + var i: Int = 0 + for (item: Any? in arg) { + val itemPathToItem = pathToItem + i + val schemas: LinkedHashMap, Nothing?>? = pathToSchemas.get(itemPathToItem) + if (schemas == null) { + throw RuntimeException("Validation result is invalid, schemas must exist for a pathToItem") + } + val itemSchema: JsonSchema<*> = schemas.entries.iterator().next().key + val itemInstance: Any? = itemSchema.getNewInstance(item, itemPathToItem, pathToSchemas) + items.add(itemInstance) + i += 1 + } + val newInstanceItems: FrozenList = FrozenList(items) + return newInstanceItems + } + + @Throws(ValidationException::class) + override fun validate(arg: List<*>, configuration: SchemaConfiguration?): FrozenList { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, PathToSchemasMap(), LinkedHashSet()) + val pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet) + return getNewInstance(castArg, validationMetadata.pathToItem, pathToSchemasMap) + } + + override fun getNewInstance(arg: Map<*, *>, pathToItem: List, pathToSchemas: PathToSchemasMap): RequiredValidationMap { + val properties: LinkedHashMap = LinkedHashMap() + for((propertyName, value) in arg) { + if (!(propertyName is String)) { + throw RuntimeException("Invalid non-string key value") + } + val propertyPathToItem: List = pathToItem + propertyName + val schemas: LinkedHashMap, Nothing?>? = pathToSchemas.get(propertyPathToItem) + if (schemas == null) { + throw RuntimeException("Validation result is invalid, schemas must exist for a pathToItem") + } + val propertySchema: JsonSchema<*> = schemas.entries.iterator().next().key + val propertyInstance: Any? = propertySchema.getNewInstance(value, propertyPathToItem, pathToSchemas) + properties[propertyName] = propertyInstance + } + val castProperties: FrozenMap = FrozenMap(properties) + return RequiredValidationMap(castProperties) + } + + @Throws(ValidationException::class) + override fun validate(arg: Map<*, *>, configuration: SchemaConfiguration?): RequiredValidationMap { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validatedPathToSchemas = PathToSchemasMap() + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, LinkedHashSet()) + val pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet) + return getNewInstance(castArg, validationMetadata.pathToItem, pathToSchemasMap) + } + + @Throws(ValidationException::class) + override fun validate(arg: Any?, configuration: SchemaConfiguration?): Any? { + if (arg == null) { + return validate(null, configuration) + } else if (arg is Boolean) { + return validate(arg, configuration) + } else if (arg is Number) { + return validate(arg, configuration) + } else if (arg is String) { + return validate(arg, configuration) + } else if (arg is List<*>) { + return validate(arg, configuration) + } else if (arg is Map<*, *>) { + return validate(arg, configuration) + } + throw ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema") + } + override fun getNewInstance(arg: Any?, pathToItem: List, pathToSchemas: PathToSchemasMap): Any? { + if (arg == null) { + return getNewInstance( null, pathToItem, pathToSchemas) + } else if (arg is Boolean) { + return getNewInstance(arg, pathToItem, pathToSchemas) + } else if (arg is Number) { + return getNewInstance(arg, pathToItem, pathToSchemas) + } else if (arg is String) { + return getNewInstance(arg, pathToItem, pathToSchemas) + } else if (arg is List<*>) { + return getNewInstance(arg, pathToItem, pathToSchemas) + } else if (arg is Map<*, *>) { + return getNewInstance(arg, pathToItem, pathToSchemas) + } + throw RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema") + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: Nothing?, configuration: SchemaConfiguration?): RequiredValidation1BoxedVoid { + return RequiredValidation1BoxedVoid(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: Boolean, configuration: SchemaConfiguration?): RequiredValidation1BoxedBoolean { + return RequiredValidation1BoxedBoolean(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: Number, configuration: SchemaConfiguration?): RequiredValidation1BoxedNumber { + return RequiredValidation1BoxedNumber(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: String, configuration: SchemaConfiguration?): RequiredValidation1BoxedString { + return RequiredValidation1BoxedString(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: List<*>, configuration: SchemaConfiguration?): RequiredValidation1BoxedList { + return RequiredValidation1BoxedList(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: Map<*, *>, configuration: SchemaConfiguration?): RequiredValidation1BoxedMap { + return RequiredValidation1BoxedMap(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: Any?, configuration: SchemaConfiguration?): RequiredValidation1Boxed { + if (arg == null) { + return validateAndBox(null, configuration) + } else if (arg is Boolean) { + return validateAndBox(arg, configuration) + } else if (arg is String) { + return validateAndBox(arg, configuration) + } else if (arg is Number) { + return validateAndBox(arg, configuration) + } else if (arg is List<*>) { + return validateAndBox(arg, configuration) + } else if (arg is Map<*, *>) { + return validateAndBox(arg, configuration) + } + throw ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema") + } + } +} diff --git a/samples/client/3_1_0_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/schemas/RequiredWithEmptyArray.kt b/samples/client/3_1_0_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/schemas/RequiredWithEmptyArray.kt new file mode 100644 index 00000000000..d8eaca1b1e1 --- /dev/null +++ b/samples/client/3_1_0_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/schemas/RequiredWithEmptyArray.kt @@ -0,0 +1,435 @@ +package org.openapijsonschematools.client.components.schemas +import java.time.LocalDate +import java.time.ZonedDateTime +import java.util.UUID +import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags +import org.openapijsonschematools.client.configurations.SchemaConfiguration +import org.openapijsonschematools.client.exceptions.InvalidAdditionalPropertyException +import org.openapijsonschematools.client.exceptions.UnsetPropertyException +import org.openapijsonschematools.client.exceptions.ValidationException +import org.openapijsonschematools.client.schemas.AnyTypeJsonSchema +import org.openapijsonschematools.client.schemas.GenericBuilder +import org.openapijsonschematools.client.schemas.UnsetAddPropsSetter +import org.openapijsonschematools.client.schemas.validation.BooleanSchemaValidator +import org.openapijsonschematools.client.schemas.validation.FrozenList +import org.openapijsonschematools.client.schemas.validation.FrozenMap +import org.openapijsonschematools.client.schemas.validation.JsonSchema +import org.openapijsonschematools.client.schemas.validation.JsonSchemaInfo +import org.openapijsonschematools.client.schemas.validation.ListSchemaValidator +import org.openapijsonschematools.client.schemas.validation.MapSchemaValidator +import org.openapijsonschematools.client.schemas.validation.NullSchemaValidator +import org.openapijsonschematools.client.schemas.validation.NumberSchemaValidator +import org.openapijsonschematools.client.schemas.validation.PathToSchemasMap +import org.openapijsonschematools.client.schemas.validation.StringSchemaValidator +import org.openapijsonschematools.client.schemas.validation.ValidationMetadata + +class RequiredWithEmptyArray { + // nest classes so all schemas and input/output classes can be public + + + class Foo : AnyTypeJsonSchema.AnyTypeJsonSchema1() { + companion object { + @Volatile + private var instance: Foo? = null + + fun getInstance() = + instance ?: synchronized(this) { + instance ?: Foo().also { instance = it } + } + } + } + + + class RequiredWithEmptyArrayMap(m: FrozenMap) : FrozenMap(m) { + companion object { + val requiredKeys: Set = setOf() + val optionalKeys: Set = setOf( + "foo" + ) + @Throws(ValidationException::class) + fun of(arg: Map, configuration: SchemaConfiguration): RequiredWithEmptyArrayMap { + return RequiredWithEmptyArray1.getInstance().validate(arg, configuration) + } + } + + @Throws(UnsetPropertyException::class) + fun foo(): Any? { + return getOrThrow("foo") + } + + @Throws(UnsetPropertyException::class, InvalidAdditionalPropertyException::class) + fun getAdditionalProperty(name: String): Any? { + throwIfKeyKnown(name, requiredKeys, optionalKeys) + throwIfKeyNotPresent(name) + return get(name) + } + } + + interface SetterForFoo { + fun getInstance(): MutableMap + fun getBuilderAfterFoo(instance: MutableMap): T + + fun foo(value: Nothing?): T { + val instance = getInstance() + instance["foo"] = null + return getBuilderAfterFoo(instance) + } + + fun foo(value: Boolean): T { + val instance = getInstance() + instance["foo"] = value + return getBuilderAfterFoo(instance) + } + + fun foo(value: String): T { + val instance = getInstance() + instance["foo"] = value + return getBuilderAfterFoo(instance) + } + + fun foo(value: Int): T { + val instance = getInstance() + instance["foo"] = value + return getBuilderAfterFoo(instance) + } + + fun foo(value: Float): T { + val instance = getInstance() + instance["foo"] = value + return getBuilderAfterFoo(instance) + } + + fun foo(value: Long): T { + val instance = getInstance() + instance["foo"] = value + return getBuilderAfterFoo(instance) + } + + fun foo(value: Double): T { + val instance = getInstance() + instance["foo"] = value + return getBuilderAfterFoo(instance) + } + + fun foo(value: List): T { + val instance = getInstance() + instance["foo"] = value + return getBuilderAfterFoo(instance) + } + + fun foo(value: Map): T { + val instance = getInstance() + instance["foo"] = value + return getBuilderAfterFoo(instance) + } + } + + class RequiredWithEmptyArrayMapBuilder: UnsetAddPropsSetter, GenericBuilder>, SetterForFoo { + private val knownKeys: Set = setOf( + "foo" + ) + override fun getKnownKeys(): Set { + return knownKeys + } + private val instance: MutableMap + init { + this.instance = LinkedHashMap() + } + override fun build(): Map { + return instance + } + override fun getInstance(): MutableMap { + return instance + } + override fun getBuilderAfterFoo(instance: MutableMap): RequiredWithEmptyArrayMapBuilder { + return this + } + override fun getBuilderAfterAdditionalProperty(instance: MutableMap): RequiredWithEmptyArrayMapBuilder { + return this + } + } + + + sealed interface RequiredWithEmptyArray1Boxed { + fun getData(): Any? + } + + data class RequiredWithEmptyArray1BoxedVoid(val data: Nothing?) : RequiredWithEmptyArray1Boxed { + override fun getData(): Any? { + return data + } + } + + data class RequiredWithEmptyArray1BoxedBoolean(val data: Boolean): RequiredWithEmptyArray1Boxed { + override fun getData(): Any? { + return data + } + } + + data class RequiredWithEmptyArray1BoxedNumber(val data: Number) : RequiredWithEmptyArray1Boxed { + override fun getData(): Any? { + return data + } + } + + data class RequiredWithEmptyArray1BoxedString(val data: String) : RequiredWithEmptyArray1Boxed { + override fun getData(): Any? { + return data + } + } + + data class RequiredWithEmptyArray1BoxedList(val data: FrozenList) : RequiredWithEmptyArray1Boxed { + override fun getData(): Any? { + return data + } + } + + data class RequiredWithEmptyArray1BoxedMap(val data: RequiredWithEmptyArrayMap) : RequiredWithEmptyArray1Boxed { + override fun getData(): Any? { + return data + } + } + + + class RequiredWithEmptyArray1 private constructor(): JsonSchema( + JsonSchemaInfo() + .properties(mapOf( + "foo" to Foo::class.java + )) + ), NullSchemaValidator, BooleanSchemaValidator, NumberSchemaValidator, StringSchemaValidator, ListSchemaValidator, RequiredWithEmptyArray1BoxedList>, MapSchemaValidator { + /* + NOTE: This class is auto generated by OpenAPI JSON Schema Generator. + Ref: https://github.com/openapi-json-schema-tools/openapi-json-schema-generator + + Do not edit the class manually. + */ + + companion object { + @Volatile + private var instance: RequiredWithEmptyArray1? = null + + fun getInstance() = + instance ?: synchronized(this) { + instance ?: RequiredWithEmptyArray1().also { instance = it } + } + } + + @Throws(ValidationException::class) + override fun validate(arg: Nothing?, configuration: SchemaConfiguration?): Nothing? { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validatedPathToSchemas = PathToSchemasMap() + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, LinkedHashSet()) + getPathToSchemas(this, castArg, validationMetadata, pathSet) + return castArg + } + + @Throws(ValidationException::class) + override fun validate(arg: Boolean, configuration: SchemaConfiguration?): Boolean { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validatedPathToSchemas = PathToSchemasMap() + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, LinkedHashSet()) + getPathToSchemas(this, castArg, validationMetadata, pathSet) + return castArg + } + + @Throws(ValidationException::class) + override fun validate(arg: Number, configuration: SchemaConfiguration?): Number { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validatedPathToSchemas = PathToSchemasMap() + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, LinkedHashSet()) + getPathToSchemas(this, castArg, validationMetadata, pathSet) + return castArg + } + + @Throws(ValidationException::class) + fun validate(arg: Int, configuration: SchemaConfiguration?): Int { + return validate(arg as Number, configuration) as Int + } + + @Throws(ValidationException::class) + fun validate(arg: Long, configuration: SchemaConfiguration?): Long { + return validate(arg as Number, configuration) as Long + } + + @Throws(ValidationException::class) + fun validate(arg: Float, configuration: SchemaConfiguration?): Float { + return validate(arg as Number, configuration) as Float + } + + @Throws(ValidationException::class) + fun validate(arg: Double, configuration: SchemaConfiguration?): Double { + return validate(arg as Number, configuration) as Double + } + + @Throws(ValidationException::class) + override fun validate(arg: String, configuration: SchemaConfiguration?): String { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validatedPathToSchemas = PathToSchemasMap() + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, LinkedHashSet()) + getPathToSchemas(this, castArg, validationMetadata, pathSet) + return castArg + } + + @Throws(ValidationException::class) + fun validate(arg: LocalDate, configuration: SchemaConfiguration?): String { + return validate(arg.toString(), configuration) + } + + @Throws(ValidationException::class) + fun validate(arg: ZonedDateTime, configuration: SchemaConfiguration?): String { + return validate(arg.toString(), configuration) + } + + @Throws(ValidationException::class) + fun validate(arg: UUID, configuration: SchemaConfiguration?): String { + return validate(arg.toString(), configuration) + } + + override fun getNewInstance(arg: List<*>, pathToItem: List, pathToSchemas: PathToSchemasMap): FrozenList { + val items: MutableList = ArrayList() + var i: Int = 0 + for (item: Any? in arg) { + val itemPathToItem = pathToItem + i + val schemas: LinkedHashMap, Nothing?>? = pathToSchemas.get(itemPathToItem) + if (schemas == null) { + throw RuntimeException("Validation result is invalid, schemas must exist for a pathToItem") + } + val itemSchema: JsonSchema<*> = schemas.entries.iterator().next().key + val itemInstance: Any? = itemSchema.getNewInstance(item, itemPathToItem, pathToSchemas) + items.add(itemInstance) + i += 1 + } + val newInstanceItems: FrozenList = FrozenList(items) + return newInstanceItems + } + + @Throws(ValidationException::class) + override fun validate(arg: List<*>, configuration: SchemaConfiguration?): FrozenList { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, PathToSchemasMap(), LinkedHashSet()) + val pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet) + return getNewInstance(castArg, validationMetadata.pathToItem, pathToSchemasMap) + } + + override fun getNewInstance(arg: Map<*, *>, pathToItem: List, pathToSchemas: PathToSchemasMap): RequiredWithEmptyArrayMap { + val properties: LinkedHashMap = LinkedHashMap() + for((propertyName, value) in arg) { + if (!(propertyName is String)) { + throw RuntimeException("Invalid non-string key value") + } + val propertyPathToItem: List = pathToItem + propertyName + val schemas: LinkedHashMap, Nothing?>? = pathToSchemas.get(propertyPathToItem) + if (schemas == null) { + throw RuntimeException("Validation result is invalid, schemas must exist for a pathToItem") + } + val propertySchema: JsonSchema<*> = schemas.entries.iterator().next().key + val propertyInstance: Any? = propertySchema.getNewInstance(value, propertyPathToItem, pathToSchemas) + properties[propertyName] = propertyInstance + } + val castProperties: FrozenMap = FrozenMap(properties) + return RequiredWithEmptyArrayMap(castProperties) + } + + @Throws(ValidationException::class) + override fun validate(arg: Map<*, *>, configuration: SchemaConfiguration?): RequiredWithEmptyArrayMap { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validatedPathToSchemas = PathToSchemasMap() + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, LinkedHashSet()) + val pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet) + return getNewInstance(castArg, validationMetadata.pathToItem, pathToSchemasMap) + } + + @Throws(ValidationException::class) + override fun validate(arg: Any?, configuration: SchemaConfiguration?): Any? { + if (arg == null) { + return validate(null, configuration) + } else if (arg is Boolean) { + return validate(arg, configuration) + } else if (arg is Number) { + return validate(arg, configuration) + } else if (arg is String) { + return validate(arg, configuration) + } else if (arg is List<*>) { + return validate(arg, configuration) + } else if (arg is Map<*, *>) { + return validate(arg, configuration) + } + throw ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema") + } + override fun getNewInstance(arg: Any?, pathToItem: List, pathToSchemas: PathToSchemasMap): Any? { + if (arg == null) { + return getNewInstance( null, pathToItem, pathToSchemas) + } else if (arg is Boolean) { + return getNewInstance(arg, pathToItem, pathToSchemas) + } else if (arg is Number) { + return getNewInstance(arg, pathToItem, pathToSchemas) + } else if (arg is String) { + return getNewInstance(arg, pathToItem, pathToSchemas) + } else if (arg is List<*>) { + return getNewInstance(arg, pathToItem, pathToSchemas) + } else if (arg is Map<*, *>) { + return getNewInstance(arg, pathToItem, pathToSchemas) + } + throw RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema") + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: Nothing?, configuration: SchemaConfiguration?): RequiredWithEmptyArray1BoxedVoid { + return RequiredWithEmptyArray1BoxedVoid(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: Boolean, configuration: SchemaConfiguration?): RequiredWithEmptyArray1BoxedBoolean { + return RequiredWithEmptyArray1BoxedBoolean(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: Number, configuration: SchemaConfiguration?): RequiredWithEmptyArray1BoxedNumber { + return RequiredWithEmptyArray1BoxedNumber(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: String, configuration: SchemaConfiguration?): RequiredWithEmptyArray1BoxedString { + return RequiredWithEmptyArray1BoxedString(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: List<*>, configuration: SchemaConfiguration?): RequiredWithEmptyArray1BoxedList { + return RequiredWithEmptyArray1BoxedList(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: Map<*, *>, configuration: SchemaConfiguration?): RequiredWithEmptyArray1BoxedMap { + return RequiredWithEmptyArray1BoxedMap(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: Any?, configuration: SchemaConfiguration?): RequiredWithEmptyArray1Boxed { + if (arg == null) { + return validateAndBox(null, configuration) + } else if (arg is Boolean) { + return validateAndBox(arg, configuration) + } else if (arg is String) { + return validateAndBox(arg, configuration) + } else if (arg is Number) { + return validateAndBox(arg, configuration) + } else if (arg is List<*>) { + return validateAndBox(arg, configuration) + } else if (arg is Map<*, *>) { + return validateAndBox(arg, configuration) + } + throw ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema") + } + } +} diff --git a/samples/client/3_1_0_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/schemas/RequiredWithEscapedCharacters.kt b/samples/client/3_1_0_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/schemas/RequiredWithEscapedCharacters.kt new file mode 100644 index 00000000000..872c5f93243 --- /dev/null +++ b/samples/client/3_1_0_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/schemas/RequiredWithEscapedCharacters.kt @@ -0,0 +1,1677 @@ +package org.openapijsonschematools.client.components.schemas +import java.time.LocalDate +import java.time.ZonedDateTime +import java.util.UUID +import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags +import org.openapijsonschematools.client.configurations.SchemaConfiguration +import org.openapijsonschematools.client.exceptions.InvalidAdditionalPropertyException +import org.openapijsonschematools.client.exceptions.UnsetPropertyException +import org.openapijsonschematools.client.exceptions.ValidationException +import org.openapijsonschematools.client.schemas.GenericBuilder +import org.openapijsonschematools.client.schemas.UnsetAddPropsSetter +import org.openapijsonschematools.client.schemas.validation.BooleanSchemaValidator +import org.openapijsonschematools.client.schemas.validation.FrozenList +import org.openapijsonschematools.client.schemas.validation.FrozenMap +import org.openapijsonschematools.client.schemas.validation.JsonSchema +import org.openapijsonschematools.client.schemas.validation.JsonSchemaInfo +import org.openapijsonschematools.client.schemas.validation.ListSchemaValidator +import org.openapijsonschematools.client.schemas.validation.MapSchemaValidator +import org.openapijsonschematools.client.schemas.validation.NullSchemaValidator +import org.openapijsonschematools.client.schemas.validation.NumberSchemaValidator +import org.openapijsonschematools.client.schemas.validation.PathToSchemasMap +import org.openapijsonschematools.client.schemas.validation.StringSchemaValidator +import org.openapijsonschematools.client.schemas.validation.ValidationMetadata + +class RequiredWithEscapedCharacters { + // nest classes so all schemas and input/output classes can be public + + + class RequiredWithEscapedCharactersMap(m: FrozenMap) : FrozenMap(m) { + companion object { + val requiredKeys: Set = setOf( + "foo\tbar", + "foo\nbar", + "foo\u000Cbar", + "foo\rbar", + "foo\"bar", + "foo\\bar" + ) + val optionalKeys: Set = setOf() + @Throws(ValidationException::class) + fun of(arg: Map, configuration: SchemaConfiguration): RequiredWithEscapedCharactersMap { + return RequiredWithEscapedCharacters1.getInstance().validate(arg, configuration) + } + } + + @Throws(UnsetPropertyException::class, InvalidAdditionalPropertyException::class) + fun getAdditionalProperty(name: String): Any? { + throwIfKeyKnown(name, requiredKeys, optionalKeys) + throwIfKeyNotPresent(name) + return get(name) + } + } + + interface SetterForFootbar { + fun getInstance(): MutableMap + fun getBuilderAfterFootbar(instance: MutableMap): T + + fun fooReverseSolidusTbar(value: Nothing?): T { + val instance = getInstance() + instance["foo\tbar"] = null + return getBuilderAfterFootbar(instance) + } + + fun fooReverseSolidusTbar(value: Boolean): T { + val instance = getInstance() + instance["foo\tbar"] = value + return getBuilderAfterFootbar(instance) + } + + fun fooReverseSolidusTbar(value: String): T { + val instance = getInstance() + instance["foo\tbar"] = value + return getBuilderAfterFootbar(instance) + } + + fun fooReverseSolidusTbar(value: Int): T { + val instance = getInstance() + instance["foo\tbar"] = value + return getBuilderAfterFootbar(instance) + } + + fun fooReverseSolidusTbar(value: Float): T { + val instance = getInstance() + instance["foo\tbar"] = value + return getBuilderAfterFootbar(instance) + } + + fun fooReverseSolidusTbar(value: Long): T { + val instance = getInstance() + instance["foo\tbar"] = value + return getBuilderAfterFootbar(instance) + } + + fun fooReverseSolidusTbar(value: Double): T { + val instance = getInstance() + instance["foo\tbar"] = value + return getBuilderAfterFootbar(instance) + } + + fun fooReverseSolidusTbar(value: List): T { + val instance = getInstance() + instance["foo\tbar"] = value + return getBuilderAfterFootbar(instance) + } + + fun fooReverseSolidusTbar(value: Map): T { + val instance = getInstance() + instance["foo\tbar"] = value + return getBuilderAfterFootbar(instance) + } + } + + interface SetterForFoonbar { + fun getInstance(): MutableMap + fun getBuilderAfterFoonbar(instance: MutableMap): T + + fun fooReverseSolidusNbar(value: Nothing?): T { + val instance = getInstance() + instance["foo\nbar"] = null + return getBuilderAfterFoonbar(instance) + } + + fun fooReverseSolidusNbar(value: Boolean): T { + val instance = getInstance() + instance["foo\nbar"] = value + return getBuilderAfterFoonbar(instance) + } + + fun fooReverseSolidusNbar(value: String): T { + val instance = getInstance() + instance["foo\nbar"] = value + return getBuilderAfterFoonbar(instance) + } + + fun fooReverseSolidusNbar(value: Int): T { + val instance = getInstance() + instance["foo\nbar"] = value + return getBuilderAfterFoonbar(instance) + } + + fun fooReverseSolidusNbar(value: Float): T { + val instance = getInstance() + instance["foo\nbar"] = value + return getBuilderAfterFoonbar(instance) + } + + fun fooReverseSolidusNbar(value: Long): T { + val instance = getInstance() + instance["foo\nbar"] = value + return getBuilderAfterFoonbar(instance) + } + + fun fooReverseSolidusNbar(value: Double): T { + val instance = getInstance() + instance["foo\nbar"] = value + return getBuilderAfterFoonbar(instance) + } + + fun fooReverseSolidusNbar(value: List): T { + val instance = getInstance() + instance["foo\nbar"] = value + return getBuilderAfterFoonbar(instance) + } + + fun fooReverseSolidusNbar(value: Map): T { + val instance = getInstance() + instance["foo\nbar"] = value + return getBuilderAfterFoonbar(instance) + } + } + + interface SetterForFoou000Cbar { + fun getInstance(): MutableMap + fun getBuilderAfterFoou000Cbar(instance: MutableMap): T + + fun fooReverseSolidusU000cbar(value: Nothing?): T { + val instance = getInstance() + instance["foo\u000Cbar"] = null + return getBuilderAfterFoou000Cbar(instance) + } + + fun fooReverseSolidusU000cbar(value: Boolean): T { + val instance = getInstance() + instance["foo\u000Cbar"] = value + return getBuilderAfterFoou000Cbar(instance) + } + + fun fooReverseSolidusU000cbar(value: String): T { + val instance = getInstance() + instance["foo\u000Cbar"] = value + return getBuilderAfterFoou000Cbar(instance) + } + + fun fooReverseSolidusU000cbar(value: Int): T { + val instance = getInstance() + instance["foo\u000Cbar"] = value + return getBuilderAfterFoou000Cbar(instance) + } + + fun fooReverseSolidusU000cbar(value: Float): T { + val instance = getInstance() + instance["foo\u000Cbar"] = value + return getBuilderAfterFoou000Cbar(instance) + } + + fun fooReverseSolidusU000cbar(value: Long): T { + val instance = getInstance() + instance["foo\u000Cbar"] = value + return getBuilderAfterFoou000Cbar(instance) + } + + fun fooReverseSolidusU000cbar(value: Double): T { + val instance = getInstance() + instance["foo\u000Cbar"] = value + return getBuilderAfterFoou000Cbar(instance) + } + + fun fooReverseSolidusU000cbar(value: List): T { + val instance = getInstance() + instance["foo\u000Cbar"] = value + return getBuilderAfterFoou000Cbar(instance) + } + + fun fooReverseSolidusU000cbar(value: Map): T { + val instance = getInstance() + instance["foo\u000Cbar"] = value + return getBuilderAfterFoou000Cbar(instance) + } + } + + interface SetterForFoorbar { + fun getInstance(): MutableMap + fun getBuilderAfterFoorbar(instance: MutableMap): T + + fun fooReverseSolidusRbar(value: Nothing?): T { + val instance = getInstance() + instance["foo\rbar"] = null + return getBuilderAfterFoorbar(instance) + } + + fun fooReverseSolidusRbar(value: Boolean): T { + val instance = getInstance() + instance["foo\rbar"] = value + return getBuilderAfterFoorbar(instance) + } + + fun fooReverseSolidusRbar(value: String): T { + val instance = getInstance() + instance["foo\rbar"] = value + return getBuilderAfterFoorbar(instance) + } + + fun fooReverseSolidusRbar(value: Int): T { + val instance = getInstance() + instance["foo\rbar"] = value + return getBuilderAfterFoorbar(instance) + } + + fun fooReverseSolidusRbar(value: Float): T { + val instance = getInstance() + instance["foo\rbar"] = value + return getBuilderAfterFoorbar(instance) + } + + fun fooReverseSolidusRbar(value: Long): T { + val instance = getInstance() + instance["foo\rbar"] = value + return getBuilderAfterFoorbar(instance) + } + + fun fooReverseSolidusRbar(value: Double): T { + val instance = getInstance() + instance["foo\rbar"] = value + return getBuilderAfterFoorbar(instance) + } + + fun fooReverseSolidusRbar(value: List): T { + val instance = getInstance() + instance["foo\rbar"] = value + return getBuilderAfterFoorbar(instance) + } + + fun fooReverseSolidusRbar(value: Map): T { + val instance = getInstance() + instance["foo\rbar"] = value + return getBuilderAfterFoorbar(instance) + } + } + + interface SetterForFoobar { + fun getInstance(): MutableMap + fun getBuilderAfterFoobar(instance: MutableMap): T + + fun fooReverseSolidusQuotationMarkBar(value: Nothing?): T { + val instance = getInstance() + instance["foo\"bar"] = null + return getBuilderAfterFoobar(instance) + } + + fun fooReverseSolidusQuotationMarkBar(value: Boolean): T { + val instance = getInstance() + instance["foo\"bar"] = value + return getBuilderAfterFoobar(instance) + } + + fun fooReverseSolidusQuotationMarkBar(value: String): T { + val instance = getInstance() + instance["foo\"bar"] = value + return getBuilderAfterFoobar(instance) + } + + fun fooReverseSolidusQuotationMarkBar(value: Int): T { + val instance = getInstance() + instance["foo\"bar"] = value + return getBuilderAfterFoobar(instance) + } + + fun fooReverseSolidusQuotationMarkBar(value: Float): T { + val instance = getInstance() + instance["foo\"bar"] = value + return getBuilderAfterFoobar(instance) + } + + fun fooReverseSolidusQuotationMarkBar(value: Long): T { + val instance = getInstance() + instance["foo\"bar"] = value + return getBuilderAfterFoobar(instance) + } + + fun fooReverseSolidusQuotationMarkBar(value: Double): T { + val instance = getInstance() + instance["foo\"bar"] = value + return getBuilderAfterFoobar(instance) + } + + fun fooReverseSolidusQuotationMarkBar(value: List): T { + val instance = getInstance() + instance["foo\"bar"] = value + return getBuilderAfterFoobar(instance) + } + + fun fooReverseSolidusQuotationMarkBar(value: Map): T { + val instance = getInstance() + instance["foo\"bar"] = value + return getBuilderAfterFoobar(instance) + } + } + + interface SetterForFoobar1 { + fun getInstance(): MutableMap + fun getBuilderAfterFoobar1(instance: MutableMap): T + + fun fooReverseSolidusReverseSolidusBar(value: Nothing?): T { + val instance = getInstance() + instance["foo\\bar"] = null + return getBuilderAfterFoobar1(instance) + } + + fun fooReverseSolidusReverseSolidusBar(value: Boolean): T { + val instance = getInstance() + instance["foo\\bar"] = value + return getBuilderAfterFoobar1(instance) + } + + fun fooReverseSolidusReverseSolidusBar(value: String): T { + val instance = getInstance() + instance["foo\\bar"] = value + return getBuilderAfterFoobar1(instance) + } + + fun fooReverseSolidusReverseSolidusBar(value: Int): T { + val instance = getInstance() + instance["foo\\bar"] = value + return getBuilderAfterFoobar1(instance) + } + + fun fooReverseSolidusReverseSolidusBar(value: Float): T { + val instance = getInstance() + instance["foo\\bar"] = value + return getBuilderAfterFoobar1(instance) + } + + fun fooReverseSolidusReverseSolidusBar(value: Long): T { + val instance = getInstance() + instance["foo\\bar"] = value + return getBuilderAfterFoobar1(instance) + } + + fun fooReverseSolidusReverseSolidusBar(value: Double): T { + val instance = getInstance() + instance["foo\\bar"] = value + return getBuilderAfterFoobar1(instance) + } + + fun fooReverseSolidusReverseSolidusBar(value: List): T { + val instance = getInstance() + instance["foo\\bar"] = value + return getBuilderAfterFoobar1(instance) + } + + fun fooReverseSolidusReverseSolidusBar(value: Map): T { + val instance = getInstance() + instance["foo\\bar"] = value + return getBuilderAfterFoobar1(instance) + } + } + + class RequiredWithEscapedCharactersMap000000Builder(private val instance: MutableMap): UnsetAddPropsSetter, GenericBuilder> { + private val knownKeys: Set = setOf( + "foo\tbar", + "foo\nbar", + "foo\u000Cbar", + "foo\rbar", + "foo\"bar", + "foo\\bar" + ) + override fun getKnownKeys(): Set { + return knownKeys + } + override fun build(): Map { + return instance + } + override fun getInstance(): MutableMap { + return instance + } + override fun getBuilderAfterAdditionalProperty(instance: MutableMap): RequiredWithEscapedCharactersMap000000Builder { + return this + } + } + + class RequiredWithEscapedCharactersMap000001Builder(private val instance: MutableMap): SetterForFoobar1 { + override fun getInstance(): MutableMap { + return instance + } + override fun getBuilderAfterFoobar1(instance: MutableMap): RequiredWithEscapedCharactersMap000000Builder { + return RequiredWithEscapedCharactersMap000000Builder(instance) + } + } + + class RequiredWithEscapedCharactersMap000010Builder(private val instance: MutableMap): SetterForFoobar { + override fun getInstance(): MutableMap { + return instance + } + override fun getBuilderAfterFoobar(instance: MutableMap): RequiredWithEscapedCharactersMap000000Builder { + return RequiredWithEscapedCharactersMap000000Builder(instance) + } + } + + class RequiredWithEscapedCharactersMap000011Builder(private val instance: MutableMap): SetterForFoobar, SetterForFoobar1 { + override fun getInstance(): MutableMap { + return instance + } + override fun getBuilderAfterFoobar(instance: MutableMap): RequiredWithEscapedCharactersMap000001Builder { + return RequiredWithEscapedCharactersMap000001Builder(instance) + } + override fun getBuilderAfterFoobar1(instance: MutableMap): RequiredWithEscapedCharactersMap000010Builder { + return RequiredWithEscapedCharactersMap000010Builder(instance) + } + } + + class RequiredWithEscapedCharactersMap000100Builder(private val instance: MutableMap): SetterForFoorbar { + override fun getInstance(): MutableMap { + return instance + } + override fun getBuilderAfterFoorbar(instance: MutableMap): RequiredWithEscapedCharactersMap000000Builder { + return RequiredWithEscapedCharactersMap000000Builder(instance) + } + } + + class RequiredWithEscapedCharactersMap000101Builder(private val instance: MutableMap): SetterForFoorbar, SetterForFoobar1 { + override fun getInstance(): MutableMap { + return instance + } + override fun getBuilderAfterFoorbar(instance: MutableMap): RequiredWithEscapedCharactersMap000001Builder { + return RequiredWithEscapedCharactersMap000001Builder(instance) + } + override fun getBuilderAfterFoobar1(instance: MutableMap): RequiredWithEscapedCharactersMap000100Builder { + return RequiredWithEscapedCharactersMap000100Builder(instance) + } + } + + class RequiredWithEscapedCharactersMap000110Builder(private val instance: MutableMap): SetterForFoorbar, SetterForFoobar { + override fun getInstance(): MutableMap { + return instance + } + override fun getBuilderAfterFoorbar(instance: MutableMap): RequiredWithEscapedCharactersMap000010Builder { + return RequiredWithEscapedCharactersMap000010Builder(instance) + } + override fun getBuilderAfterFoobar(instance: MutableMap): RequiredWithEscapedCharactersMap000100Builder { + return RequiredWithEscapedCharactersMap000100Builder(instance) + } + } + + class RequiredWithEscapedCharactersMap000111Builder(private val instance: MutableMap): SetterForFoorbar, SetterForFoobar, SetterForFoobar1 { + override fun getInstance(): MutableMap { + return instance + } + override fun getBuilderAfterFoorbar(instance: MutableMap): RequiredWithEscapedCharactersMap000011Builder { + return RequiredWithEscapedCharactersMap000011Builder(instance) + } + override fun getBuilderAfterFoobar(instance: MutableMap): RequiredWithEscapedCharactersMap000101Builder { + return RequiredWithEscapedCharactersMap000101Builder(instance) + } + override fun getBuilderAfterFoobar1(instance: MutableMap): RequiredWithEscapedCharactersMap000110Builder { + return RequiredWithEscapedCharactersMap000110Builder(instance) + } + } + + class RequiredWithEscapedCharactersMap001000Builder(private val instance: MutableMap): SetterForFoou000Cbar { + override fun getInstance(): MutableMap { + return instance + } + override fun getBuilderAfterFoou000Cbar(instance: MutableMap): RequiredWithEscapedCharactersMap000000Builder { + return RequiredWithEscapedCharactersMap000000Builder(instance) + } + } + + class RequiredWithEscapedCharactersMap001001Builder(private val instance: MutableMap): SetterForFoou000Cbar, SetterForFoobar1 { + override fun getInstance(): MutableMap { + return instance + } + override fun getBuilderAfterFoou000Cbar(instance: MutableMap): RequiredWithEscapedCharactersMap000001Builder { + return RequiredWithEscapedCharactersMap000001Builder(instance) + } + override fun getBuilderAfterFoobar1(instance: MutableMap): RequiredWithEscapedCharactersMap001000Builder { + return RequiredWithEscapedCharactersMap001000Builder(instance) + } + } + + class RequiredWithEscapedCharactersMap001010Builder(private val instance: MutableMap): SetterForFoou000Cbar, SetterForFoobar { + override fun getInstance(): MutableMap { + return instance + } + override fun getBuilderAfterFoou000Cbar(instance: MutableMap): RequiredWithEscapedCharactersMap000010Builder { + return RequiredWithEscapedCharactersMap000010Builder(instance) + } + override fun getBuilderAfterFoobar(instance: MutableMap): RequiredWithEscapedCharactersMap001000Builder { + return RequiredWithEscapedCharactersMap001000Builder(instance) + } + } + + class RequiredWithEscapedCharactersMap001011Builder(private val instance: MutableMap): SetterForFoou000Cbar, SetterForFoobar, SetterForFoobar1 { + override fun getInstance(): MutableMap { + return instance + } + override fun getBuilderAfterFoou000Cbar(instance: MutableMap): RequiredWithEscapedCharactersMap000011Builder { + return RequiredWithEscapedCharactersMap000011Builder(instance) + } + override fun getBuilderAfterFoobar(instance: MutableMap): RequiredWithEscapedCharactersMap001001Builder { + return RequiredWithEscapedCharactersMap001001Builder(instance) + } + override fun getBuilderAfterFoobar1(instance: MutableMap): RequiredWithEscapedCharactersMap001010Builder { + return RequiredWithEscapedCharactersMap001010Builder(instance) + } + } + + class RequiredWithEscapedCharactersMap001100Builder(private val instance: MutableMap): SetterForFoou000Cbar, SetterForFoorbar { + override fun getInstance(): MutableMap { + return instance + } + override fun getBuilderAfterFoou000Cbar(instance: MutableMap): RequiredWithEscapedCharactersMap000100Builder { + return RequiredWithEscapedCharactersMap000100Builder(instance) + } + override fun getBuilderAfterFoorbar(instance: MutableMap): RequiredWithEscapedCharactersMap001000Builder { + return RequiredWithEscapedCharactersMap001000Builder(instance) + } + } + + class RequiredWithEscapedCharactersMap001101Builder(private val instance: MutableMap): SetterForFoou000Cbar, SetterForFoorbar, SetterForFoobar1 { + override fun getInstance(): MutableMap { + return instance + } + override fun getBuilderAfterFoou000Cbar(instance: MutableMap): RequiredWithEscapedCharactersMap000101Builder { + return RequiredWithEscapedCharactersMap000101Builder(instance) + } + override fun getBuilderAfterFoorbar(instance: MutableMap): RequiredWithEscapedCharactersMap001001Builder { + return RequiredWithEscapedCharactersMap001001Builder(instance) + } + override fun getBuilderAfterFoobar1(instance: MutableMap): RequiredWithEscapedCharactersMap001100Builder { + return RequiredWithEscapedCharactersMap001100Builder(instance) + } + } + + class RequiredWithEscapedCharactersMap001110Builder(private val instance: MutableMap): SetterForFoou000Cbar, SetterForFoorbar, SetterForFoobar { + override fun getInstance(): MutableMap { + return instance + } + override fun getBuilderAfterFoou000Cbar(instance: MutableMap): RequiredWithEscapedCharactersMap000110Builder { + return RequiredWithEscapedCharactersMap000110Builder(instance) + } + override fun getBuilderAfterFoorbar(instance: MutableMap): RequiredWithEscapedCharactersMap001010Builder { + return RequiredWithEscapedCharactersMap001010Builder(instance) + } + override fun getBuilderAfterFoobar(instance: MutableMap): RequiredWithEscapedCharactersMap001100Builder { + return RequiredWithEscapedCharactersMap001100Builder(instance) + } + } + + class RequiredWithEscapedCharactersMap001111Builder(private val instance: MutableMap): SetterForFoou000Cbar, SetterForFoorbar, SetterForFoobar, SetterForFoobar1 { + override fun getInstance(): MutableMap { + return instance + } + override fun getBuilderAfterFoou000Cbar(instance: MutableMap): RequiredWithEscapedCharactersMap000111Builder { + return RequiredWithEscapedCharactersMap000111Builder(instance) + } + override fun getBuilderAfterFoorbar(instance: MutableMap): RequiredWithEscapedCharactersMap001011Builder { + return RequiredWithEscapedCharactersMap001011Builder(instance) + } + override fun getBuilderAfterFoobar(instance: MutableMap): RequiredWithEscapedCharactersMap001101Builder { + return RequiredWithEscapedCharactersMap001101Builder(instance) + } + override fun getBuilderAfterFoobar1(instance: MutableMap): RequiredWithEscapedCharactersMap001110Builder { + return RequiredWithEscapedCharactersMap001110Builder(instance) + } + } + + class RequiredWithEscapedCharactersMap010000Builder(private val instance: MutableMap): SetterForFoonbar { + override fun getInstance(): MutableMap { + return instance + } + override fun getBuilderAfterFoonbar(instance: MutableMap): RequiredWithEscapedCharactersMap000000Builder { + return RequiredWithEscapedCharactersMap000000Builder(instance) + } + } + + class RequiredWithEscapedCharactersMap010001Builder(private val instance: MutableMap): SetterForFoonbar, SetterForFoobar1 { + override fun getInstance(): MutableMap { + return instance + } + override fun getBuilderAfterFoonbar(instance: MutableMap): RequiredWithEscapedCharactersMap000001Builder { + return RequiredWithEscapedCharactersMap000001Builder(instance) + } + override fun getBuilderAfterFoobar1(instance: MutableMap): RequiredWithEscapedCharactersMap010000Builder { + return RequiredWithEscapedCharactersMap010000Builder(instance) + } + } + + class RequiredWithEscapedCharactersMap010010Builder(private val instance: MutableMap): SetterForFoonbar, SetterForFoobar { + override fun getInstance(): MutableMap { + return instance + } + override fun getBuilderAfterFoonbar(instance: MutableMap): RequiredWithEscapedCharactersMap000010Builder { + return RequiredWithEscapedCharactersMap000010Builder(instance) + } + override fun getBuilderAfterFoobar(instance: MutableMap): RequiredWithEscapedCharactersMap010000Builder { + return RequiredWithEscapedCharactersMap010000Builder(instance) + } + } + + class RequiredWithEscapedCharactersMap010011Builder(private val instance: MutableMap): SetterForFoonbar, SetterForFoobar, SetterForFoobar1 { + override fun getInstance(): MutableMap { + return instance + } + override fun getBuilderAfterFoonbar(instance: MutableMap): RequiredWithEscapedCharactersMap000011Builder { + return RequiredWithEscapedCharactersMap000011Builder(instance) + } + override fun getBuilderAfterFoobar(instance: MutableMap): RequiredWithEscapedCharactersMap010001Builder { + return RequiredWithEscapedCharactersMap010001Builder(instance) + } + override fun getBuilderAfterFoobar1(instance: MutableMap): RequiredWithEscapedCharactersMap010010Builder { + return RequiredWithEscapedCharactersMap010010Builder(instance) + } + } + + class RequiredWithEscapedCharactersMap010100Builder(private val instance: MutableMap): SetterForFoonbar, SetterForFoorbar { + override fun getInstance(): MutableMap { + return instance + } + override fun getBuilderAfterFoonbar(instance: MutableMap): RequiredWithEscapedCharactersMap000100Builder { + return RequiredWithEscapedCharactersMap000100Builder(instance) + } + override fun getBuilderAfterFoorbar(instance: MutableMap): RequiredWithEscapedCharactersMap010000Builder { + return RequiredWithEscapedCharactersMap010000Builder(instance) + } + } + + class RequiredWithEscapedCharactersMap010101Builder(private val instance: MutableMap): SetterForFoonbar, SetterForFoorbar, SetterForFoobar1 { + override fun getInstance(): MutableMap { + return instance + } + override fun getBuilderAfterFoonbar(instance: MutableMap): RequiredWithEscapedCharactersMap000101Builder { + return RequiredWithEscapedCharactersMap000101Builder(instance) + } + override fun getBuilderAfterFoorbar(instance: MutableMap): RequiredWithEscapedCharactersMap010001Builder { + return RequiredWithEscapedCharactersMap010001Builder(instance) + } + override fun getBuilderAfterFoobar1(instance: MutableMap): RequiredWithEscapedCharactersMap010100Builder { + return RequiredWithEscapedCharactersMap010100Builder(instance) + } + } + + class RequiredWithEscapedCharactersMap010110Builder(private val instance: MutableMap): SetterForFoonbar, SetterForFoorbar, SetterForFoobar { + override fun getInstance(): MutableMap { + return instance + } + override fun getBuilderAfterFoonbar(instance: MutableMap): RequiredWithEscapedCharactersMap000110Builder { + return RequiredWithEscapedCharactersMap000110Builder(instance) + } + override fun getBuilderAfterFoorbar(instance: MutableMap): RequiredWithEscapedCharactersMap010010Builder { + return RequiredWithEscapedCharactersMap010010Builder(instance) + } + override fun getBuilderAfterFoobar(instance: MutableMap): RequiredWithEscapedCharactersMap010100Builder { + return RequiredWithEscapedCharactersMap010100Builder(instance) + } + } + + class RequiredWithEscapedCharactersMap010111Builder(private val instance: MutableMap): SetterForFoonbar, SetterForFoorbar, SetterForFoobar, SetterForFoobar1 { + override fun getInstance(): MutableMap { + return instance + } + override fun getBuilderAfterFoonbar(instance: MutableMap): RequiredWithEscapedCharactersMap000111Builder { + return RequiredWithEscapedCharactersMap000111Builder(instance) + } + override fun getBuilderAfterFoorbar(instance: MutableMap): RequiredWithEscapedCharactersMap010011Builder { + return RequiredWithEscapedCharactersMap010011Builder(instance) + } + override fun getBuilderAfterFoobar(instance: MutableMap): RequiredWithEscapedCharactersMap010101Builder { + return RequiredWithEscapedCharactersMap010101Builder(instance) + } + override fun getBuilderAfterFoobar1(instance: MutableMap): RequiredWithEscapedCharactersMap010110Builder { + return RequiredWithEscapedCharactersMap010110Builder(instance) + } + } + + class RequiredWithEscapedCharactersMap011000Builder(private val instance: MutableMap): SetterForFoonbar, SetterForFoou000Cbar { + override fun getInstance(): MutableMap { + return instance + } + override fun getBuilderAfterFoonbar(instance: MutableMap): RequiredWithEscapedCharactersMap001000Builder { + return RequiredWithEscapedCharactersMap001000Builder(instance) + } + override fun getBuilderAfterFoou000Cbar(instance: MutableMap): RequiredWithEscapedCharactersMap010000Builder { + return RequiredWithEscapedCharactersMap010000Builder(instance) + } + } + + class RequiredWithEscapedCharactersMap011001Builder(private val instance: MutableMap): SetterForFoonbar, SetterForFoou000Cbar, SetterForFoobar1 { + override fun getInstance(): MutableMap { + return instance + } + override fun getBuilderAfterFoonbar(instance: MutableMap): RequiredWithEscapedCharactersMap001001Builder { + return RequiredWithEscapedCharactersMap001001Builder(instance) + } + override fun getBuilderAfterFoou000Cbar(instance: MutableMap): RequiredWithEscapedCharactersMap010001Builder { + return RequiredWithEscapedCharactersMap010001Builder(instance) + } + override fun getBuilderAfterFoobar1(instance: MutableMap): RequiredWithEscapedCharactersMap011000Builder { + return RequiredWithEscapedCharactersMap011000Builder(instance) + } + } + + class RequiredWithEscapedCharactersMap011010Builder(private val instance: MutableMap): SetterForFoonbar, SetterForFoou000Cbar, SetterForFoobar { + override fun getInstance(): MutableMap { + return instance + } + override fun getBuilderAfterFoonbar(instance: MutableMap): RequiredWithEscapedCharactersMap001010Builder { + return RequiredWithEscapedCharactersMap001010Builder(instance) + } + override fun getBuilderAfterFoou000Cbar(instance: MutableMap): RequiredWithEscapedCharactersMap010010Builder { + return RequiredWithEscapedCharactersMap010010Builder(instance) + } + override fun getBuilderAfterFoobar(instance: MutableMap): RequiredWithEscapedCharactersMap011000Builder { + return RequiredWithEscapedCharactersMap011000Builder(instance) + } + } + + class RequiredWithEscapedCharactersMap011011Builder(private val instance: MutableMap): SetterForFoonbar, SetterForFoou000Cbar, SetterForFoobar, SetterForFoobar1 { + override fun getInstance(): MutableMap { + return instance + } + override fun getBuilderAfterFoonbar(instance: MutableMap): RequiredWithEscapedCharactersMap001011Builder { + return RequiredWithEscapedCharactersMap001011Builder(instance) + } + override fun getBuilderAfterFoou000Cbar(instance: MutableMap): RequiredWithEscapedCharactersMap010011Builder { + return RequiredWithEscapedCharactersMap010011Builder(instance) + } + override fun getBuilderAfterFoobar(instance: MutableMap): RequiredWithEscapedCharactersMap011001Builder { + return RequiredWithEscapedCharactersMap011001Builder(instance) + } + override fun getBuilderAfterFoobar1(instance: MutableMap): RequiredWithEscapedCharactersMap011010Builder { + return RequiredWithEscapedCharactersMap011010Builder(instance) + } + } + + class RequiredWithEscapedCharactersMap011100Builder(private val instance: MutableMap): SetterForFoonbar, SetterForFoou000Cbar, SetterForFoorbar { + override fun getInstance(): MutableMap { + return instance + } + override fun getBuilderAfterFoonbar(instance: MutableMap): RequiredWithEscapedCharactersMap001100Builder { + return RequiredWithEscapedCharactersMap001100Builder(instance) + } + override fun getBuilderAfterFoou000Cbar(instance: MutableMap): RequiredWithEscapedCharactersMap010100Builder { + return RequiredWithEscapedCharactersMap010100Builder(instance) + } + override fun getBuilderAfterFoorbar(instance: MutableMap): RequiredWithEscapedCharactersMap011000Builder { + return RequiredWithEscapedCharactersMap011000Builder(instance) + } + } + + class RequiredWithEscapedCharactersMap011101Builder(private val instance: MutableMap): SetterForFoonbar, SetterForFoou000Cbar, SetterForFoorbar, SetterForFoobar1 { + override fun getInstance(): MutableMap { + return instance + } + override fun getBuilderAfterFoonbar(instance: MutableMap): RequiredWithEscapedCharactersMap001101Builder { + return RequiredWithEscapedCharactersMap001101Builder(instance) + } + override fun getBuilderAfterFoou000Cbar(instance: MutableMap): RequiredWithEscapedCharactersMap010101Builder { + return RequiredWithEscapedCharactersMap010101Builder(instance) + } + override fun getBuilderAfterFoorbar(instance: MutableMap): RequiredWithEscapedCharactersMap011001Builder { + return RequiredWithEscapedCharactersMap011001Builder(instance) + } + override fun getBuilderAfterFoobar1(instance: MutableMap): RequiredWithEscapedCharactersMap011100Builder { + return RequiredWithEscapedCharactersMap011100Builder(instance) + } + } + + class RequiredWithEscapedCharactersMap011110Builder(private val instance: MutableMap): SetterForFoonbar, SetterForFoou000Cbar, SetterForFoorbar, SetterForFoobar { + override fun getInstance(): MutableMap { + return instance + } + override fun getBuilderAfterFoonbar(instance: MutableMap): RequiredWithEscapedCharactersMap001110Builder { + return RequiredWithEscapedCharactersMap001110Builder(instance) + } + override fun getBuilderAfterFoou000Cbar(instance: MutableMap): RequiredWithEscapedCharactersMap010110Builder { + return RequiredWithEscapedCharactersMap010110Builder(instance) + } + override fun getBuilderAfterFoorbar(instance: MutableMap): RequiredWithEscapedCharactersMap011010Builder { + return RequiredWithEscapedCharactersMap011010Builder(instance) + } + override fun getBuilderAfterFoobar(instance: MutableMap): RequiredWithEscapedCharactersMap011100Builder { + return RequiredWithEscapedCharactersMap011100Builder(instance) + } + } + + class RequiredWithEscapedCharactersMap011111Builder(private val instance: MutableMap): SetterForFoonbar, SetterForFoou000Cbar, SetterForFoorbar, SetterForFoobar, SetterForFoobar1 { + override fun getInstance(): MutableMap { + return instance + } + override fun getBuilderAfterFoonbar(instance: MutableMap): RequiredWithEscapedCharactersMap001111Builder { + return RequiredWithEscapedCharactersMap001111Builder(instance) + } + override fun getBuilderAfterFoou000Cbar(instance: MutableMap): RequiredWithEscapedCharactersMap010111Builder { + return RequiredWithEscapedCharactersMap010111Builder(instance) + } + override fun getBuilderAfterFoorbar(instance: MutableMap): RequiredWithEscapedCharactersMap011011Builder { + return RequiredWithEscapedCharactersMap011011Builder(instance) + } + override fun getBuilderAfterFoobar(instance: MutableMap): RequiredWithEscapedCharactersMap011101Builder { + return RequiredWithEscapedCharactersMap011101Builder(instance) + } + override fun getBuilderAfterFoobar1(instance: MutableMap): RequiredWithEscapedCharactersMap011110Builder { + return RequiredWithEscapedCharactersMap011110Builder(instance) + } + } + + class RequiredWithEscapedCharactersMap100000Builder(private val instance: MutableMap): SetterForFootbar { + override fun getInstance(): MutableMap { + return instance + } + override fun getBuilderAfterFootbar(instance: MutableMap): RequiredWithEscapedCharactersMap000000Builder { + return RequiredWithEscapedCharactersMap000000Builder(instance) + } + } + + class RequiredWithEscapedCharactersMap100001Builder(private val instance: MutableMap): SetterForFootbar, SetterForFoobar1 { + override fun getInstance(): MutableMap { + return instance + } + override fun getBuilderAfterFootbar(instance: MutableMap): RequiredWithEscapedCharactersMap000001Builder { + return RequiredWithEscapedCharactersMap000001Builder(instance) + } + override fun getBuilderAfterFoobar1(instance: MutableMap): RequiredWithEscapedCharactersMap100000Builder { + return RequiredWithEscapedCharactersMap100000Builder(instance) + } + } + + class RequiredWithEscapedCharactersMap100010Builder(private val instance: MutableMap): SetterForFootbar, SetterForFoobar { + override fun getInstance(): MutableMap { + return instance + } + override fun getBuilderAfterFootbar(instance: MutableMap): RequiredWithEscapedCharactersMap000010Builder { + return RequiredWithEscapedCharactersMap000010Builder(instance) + } + override fun getBuilderAfterFoobar(instance: MutableMap): RequiredWithEscapedCharactersMap100000Builder { + return RequiredWithEscapedCharactersMap100000Builder(instance) + } + } + + class RequiredWithEscapedCharactersMap100011Builder(private val instance: MutableMap): SetterForFootbar, SetterForFoobar, SetterForFoobar1 { + override fun getInstance(): MutableMap { + return instance + } + override fun getBuilderAfterFootbar(instance: MutableMap): RequiredWithEscapedCharactersMap000011Builder { + return RequiredWithEscapedCharactersMap000011Builder(instance) + } + override fun getBuilderAfterFoobar(instance: MutableMap): RequiredWithEscapedCharactersMap100001Builder { + return RequiredWithEscapedCharactersMap100001Builder(instance) + } + override fun getBuilderAfterFoobar1(instance: MutableMap): RequiredWithEscapedCharactersMap100010Builder { + return RequiredWithEscapedCharactersMap100010Builder(instance) + } + } + + class RequiredWithEscapedCharactersMap100100Builder(private val instance: MutableMap): SetterForFootbar, SetterForFoorbar { + override fun getInstance(): MutableMap { + return instance + } + override fun getBuilderAfterFootbar(instance: MutableMap): RequiredWithEscapedCharactersMap000100Builder { + return RequiredWithEscapedCharactersMap000100Builder(instance) + } + override fun getBuilderAfterFoorbar(instance: MutableMap): RequiredWithEscapedCharactersMap100000Builder { + return RequiredWithEscapedCharactersMap100000Builder(instance) + } + } + + class RequiredWithEscapedCharactersMap100101Builder(private val instance: MutableMap): SetterForFootbar, SetterForFoorbar, SetterForFoobar1 { + override fun getInstance(): MutableMap { + return instance + } + override fun getBuilderAfterFootbar(instance: MutableMap): RequiredWithEscapedCharactersMap000101Builder { + return RequiredWithEscapedCharactersMap000101Builder(instance) + } + override fun getBuilderAfterFoorbar(instance: MutableMap): RequiredWithEscapedCharactersMap100001Builder { + return RequiredWithEscapedCharactersMap100001Builder(instance) + } + override fun getBuilderAfterFoobar1(instance: MutableMap): RequiredWithEscapedCharactersMap100100Builder { + return RequiredWithEscapedCharactersMap100100Builder(instance) + } + } + + class RequiredWithEscapedCharactersMap100110Builder(private val instance: MutableMap): SetterForFootbar, SetterForFoorbar, SetterForFoobar { + override fun getInstance(): MutableMap { + return instance + } + override fun getBuilderAfterFootbar(instance: MutableMap): RequiredWithEscapedCharactersMap000110Builder { + return RequiredWithEscapedCharactersMap000110Builder(instance) + } + override fun getBuilderAfterFoorbar(instance: MutableMap): RequiredWithEscapedCharactersMap100010Builder { + return RequiredWithEscapedCharactersMap100010Builder(instance) + } + override fun getBuilderAfterFoobar(instance: MutableMap): RequiredWithEscapedCharactersMap100100Builder { + return RequiredWithEscapedCharactersMap100100Builder(instance) + } + } + + class RequiredWithEscapedCharactersMap100111Builder(private val instance: MutableMap): SetterForFootbar, SetterForFoorbar, SetterForFoobar, SetterForFoobar1 { + override fun getInstance(): MutableMap { + return instance + } + override fun getBuilderAfterFootbar(instance: MutableMap): RequiredWithEscapedCharactersMap000111Builder { + return RequiredWithEscapedCharactersMap000111Builder(instance) + } + override fun getBuilderAfterFoorbar(instance: MutableMap): RequiredWithEscapedCharactersMap100011Builder { + return RequiredWithEscapedCharactersMap100011Builder(instance) + } + override fun getBuilderAfterFoobar(instance: MutableMap): RequiredWithEscapedCharactersMap100101Builder { + return RequiredWithEscapedCharactersMap100101Builder(instance) + } + override fun getBuilderAfterFoobar1(instance: MutableMap): RequiredWithEscapedCharactersMap100110Builder { + return RequiredWithEscapedCharactersMap100110Builder(instance) + } + } + + class RequiredWithEscapedCharactersMap101000Builder(private val instance: MutableMap): SetterForFootbar, SetterForFoou000Cbar { + override fun getInstance(): MutableMap { + return instance + } + override fun getBuilderAfterFootbar(instance: MutableMap): RequiredWithEscapedCharactersMap001000Builder { + return RequiredWithEscapedCharactersMap001000Builder(instance) + } + override fun getBuilderAfterFoou000Cbar(instance: MutableMap): RequiredWithEscapedCharactersMap100000Builder { + return RequiredWithEscapedCharactersMap100000Builder(instance) + } + } + + class RequiredWithEscapedCharactersMap101001Builder(private val instance: MutableMap): SetterForFootbar, SetterForFoou000Cbar, SetterForFoobar1 { + override fun getInstance(): MutableMap { + return instance + } + override fun getBuilderAfterFootbar(instance: MutableMap): RequiredWithEscapedCharactersMap001001Builder { + return RequiredWithEscapedCharactersMap001001Builder(instance) + } + override fun getBuilderAfterFoou000Cbar(instance: MutableMap): RequiredWithEscapedCharactersMap100001Builder { + return RequiredWithEscapedCharactersMap100001Builder(instance) + } + override fun getBuilderAfterFoobar1(instance: MutableMap): RequiredWithEscapedCharactersMap101000Builder { + return RequiredWithEscapedCharactersMap101000Builder(instance) + } + } + + class RequiredWithEscapedCharactersMap101010Builder(private val instance: MutableMap): SetterForFootbar, SetterForFoou000Cbar, SetterForFoobar { + override fun getInstance(): MutableMap { + return instance + } + override fun getBuilderAfterFootbar(instance: MutableMap): RequiredWithEscapedCharactersMap001010Builder { + return RequiredWithEscapedCharactersMap001010Builder(instance) + } + override fun getBuilderAfterFoou000Cbar(instance: MutableMap): RequiredWithEscapedCharactersMap100010Builder { + return RequiredWithEscapedCharactersMap100010Builder(instance) + } + override fun getBuilderAfterFoobar(instance: MutableMap): RequiredWithEscapedCharactersMap101000Builder { + return RequiredWithEscapedCharactersMap101000Builder(instance) + } + } + + class RequiredWithEscapedCharactersMap101011Builder(private val instance: MutableMap): SetterForFootbar, SetterForFoou000Cbar, SetterForFoobar, SetterForFoobar1 { + override fun getInstance(): MutableMap { + return instance + } + override fun getBuilderAfterFootbar(instance: MutableMap): RequiredWithEscapedCharactersMap001011Builder { + return RequiredWithEscapedCharactersMap001011Builder(instance) + } + override fun getBuilderAfterFoou000Cbar(instance: MutableMap): RequiredWithEscapedCharactersMap100011Builder { + return RequiredWithEscapedCharactersMap100011Builder(instance) + } + override fun getBuilderAfterFoobar(instance: MutableMap): RequiredWithEscapedCharactersMap101001Builder { + return RequiredWithEscapedCharactersMap101001Builder(instance) + } + override fun getBuilderAfterFoobar1(instance: MutableMap): RequiredWithEscapedCharactersMap101010Builder { + return RequiredWithEscapedCharactersMap101010Builder(instance) + } + } + + class RequiredWithEscapedCharactersMap101100Builder(private val instance: MutableMap): SetterForFootbar, SetterForFoou000Cbar, SetterForFoorbar { + override fun getInstance(): MutableMap { + return instance + } + override fun getBuilderAfterFootbar(instance: MutableMap): RequiredWithEscapedCharactersMap001100Builder { + return RequiredWithEscapedCharactersMap001100Builder(instance) + } + override fun getBuilderAfterFoou000Cbar(instance: MutableMap): RequiredWithEscapedCharactersMap100100Builder { + return RequiredWithEscapedCharactersMap100100Builder(instance) + } + override fun getBuilderAfterFoorbar(instance: MutableMap): RequiredWithEscapedCharactersMap101000Builder { + return RequiredWithEscapedCharactersMap101000Builder(instance) + } + } + + class RequiredWithEscapedCharactersMap101101Builder(private val instance: MutableMap): SetterForFootbar, SetterForFoou000Cbar, SetterForFoorbar, SetterForFoobar1 { + override fun getInstance(): MutableMap { + return instance + } + override fun getBuilderAfterFootbar(instance: MutableMap): RequiredWithEscapedCharactersMap001101Builder { + return RequiredWithEscapedCharactersMap001101Builder(instance) + } + override fun getBuilderAfterFoou000Cbar(instance: MutableMap): RequiredWithEscapedCharactersMap100101Builder { + return RequiredWithEscapedCharactersMap100101Builder(instance) + } + override fun getBuilderAfterFoorbar(instance: MutableMap): RequiredWithEscapedCharactersMap101001Builder { + return RequiredWithEscapedCharactersMap101001Builder(instance) + } + override fun getBuilderAfterFoobar1(instance: MutableMap): RequiredWithEscapedCharactersMap101100Builder { + return RequiredWithEscapedCharactersMap101100Builder(instance) + } + } + + class RequiredWithEscapedCharactersMap101110Builder(private val instance: MutableMap): SetterForFootbar, SetterForFoou000Cbar, SetterForFoorbar, SetterForFoobar { + override fun getInstance(): MutableMap { + return instance + } + override fun getBuilderAfterFootbar(instance: MutableMap): RequiredWithEscapedCharactersMap001110Builder { + return RequiredWithEscapedCharactersMap001110Builder(instance) + } + override fun getBuilderAfterFoou000Cbar(instance: MutableMap): RequiredWithEscapedCharactersMap100110Builder { + return RequiredWithEscapedCharactersMap100110Builder(instance) + } + override fun getBuilderAfterFoorbar(instance: MutableMap): RequiredWithEscapedCharactersMap101010Builder { + return RequiredWithEscapedCharactersMap101010Builder(instance) + } + override fun getBuilderAfterFoobar(instance: MutableMap): RequiredWithEscapedCharactersMap101100Builder { + return RequiredWithEscapedCharactersMap101100Builder(instance) + } + } + + class RequiredWithEscapedCharactersMap101111Builder(private val instance: MutableMap): SetterForFootbar, SetterForFoou000Cbar, SetterForFoorbar, SetterForFoobar, SetterForFoobar1 { + override fun getInstance(): MutableMap { + return instance + } + override fun getBuilderAfterFootbar(instance: MutableMap): RequiredWithEscapedCharactersMap001111Builder { + return RequiredWithEscapedCharactersMap001111Builder(instance) + } + override fun getBuilderAfterFoou000Cbar(instance: MutableMap): RequiredWithEscapedCharactersMap100111Builder { + return RequiredWithEscapedCharactersMap100111Builder(instance) + } + override fun getBuilderAfterFoorbar(instance: MutableMap): RequiredWithEscapedCharactersMap101011Builder { + return RequiredWithEscapedCharactersMap101011Builder(instance) + } + override fun getBuilderAfterFoobar(instance: MutableMap): RequiredWithEscapedCharactersMap101101Builder { + return RequiredWithEscapedCharactersMap101101Builder(instance) + } + override fun getBuilderAfterFoobar1(instance: MutableMap): RequiredWithEscapedCharactersMap101110Builder { + return RequiredWithEscapedCharactersMap101110Builder(instance) + } + } + + class RequiredWithEscapedCharactersMap110000Builder(private val instance: MutableMap): SetterForFootbar, SetterForFoonbar { + override fun getInstance(): MutableMap { + return instance + } + override fun getBuilderAfterFootbar(instance: MutableMap): RequiredWithEscapedCharactersMap010000Builder { + return RequiredWithEscapedCharactersMap010000Builder(instance) + } + override fun getBuilderAfterFoonbar(instance: MutableMap): RequiredWithEscapedCharactersMap100000Builder { + return RequiredWithEscapedCharactersMap100000Builder(instance) + } + } + + class RequiredWithEscapedCharactersMap110001Builder(private val instance: MutableMap): SetterForFootbar, SetterForFoonbar, SetterForFoobar1 { + override fun getInstance(): MutableMap { + return instance + } + override fun getBuilderAfterFootbar(instance: MutableMap): RequiredWithEscapedCharactersMap010001Builder { + return RequiredWithEscapedCharactersMap010001Builder(instance) + } + override fun getBuilderAfterFoonbar(instance: MutableMap): RequiredWithEscapedCharactersMap100001Builder { + return RequiredWithEscapedCharactersMap100001Builder(instance) + } + override fun getBuilderAfterFoobar1(instance: MutableMap): RequiredWithEscapedCharactersMap110000Builder { + return RequiredWithEscapedCharactersMap110000Builder(instance) + } + } + + class RequiredWithEscapedCharactersMap110010Builder(private val instance: MutableMap): SetterForFootbar, SetterForFoonbar, SetterForFoobar { + override fun getInstance(): MutableMap { + return instance + } + override fun getBuilderAfterFootbar(instance: MutableMap): RequiredWithEscapedCharactersMap010010Builder { + return RequiredWithEscapedCharactersMap010010Builder(instance) + } + override fun getBuilderAfterFoonbar(instance: MutableMap): RequiredWithEscapedCharactersMap100010Builder { + return RequiredWithEscapedCharactersMap100010Builder(instance) + } + override fun getBuilderAfterFoobar(instance: MutableMap): RequiredWithEscapedCharactersMap110000Builder { + return RequiredWithEscapedCharactersMap110000Builder(instance) + } + } + + class RequiredWithEscapedCharactersMap110011Builder(private val instance: MutableMap): SetterForFootbar, SetterForFoonbar, SetterForFoobar, SetterForFoobar1 { + override fun getInstance(): MutableMap { + return instance + } + override fun getBuilderAfterFootbar(instance: MutableMap): RequiredWithEscapedCharactersMap010011Builder { + return RequiredWithEscapedCharactersMap010011Builder(instance) + } + override fun getBuilderAfterFoonbar(instance: MutableMap): RequiredWithEscapedCharactersMap100011Builder { + return RequiredWithEscapedCharactersMap100011Builder(instance) + } + override fun getBuilderAfterFoobar(instance: MutableMap): RequiredWithEscapedCharactersMap110001Builder { + return RequiredWithEscapedCharactersMap110001Builder(instance) + } + override fun getBuilderAfterFoobar1(instance: MutableMap): RequiredWithEscapedCharactersMap110010Builder { + return RequiredWithEscapedCharactersMap110010Builder(instance) + } + } + + class RequiredWithEscapedCharactersMap110100Builder(private val instance: MutableMap): SetterForFootbar, SetterForFoonbar, SetterForFoorbar { + override fun getInstance(): MutableMap { + return instance + } + override fun getBuilderAfterFootbar(instance: MutableMap): RequiredWithEscapedCharactersMap010100Builder { + return RequiredWithEscapedCharactersMap010100Builder(instance) + } + override fun getBuilderAfterFoonbar(instance: MutableMap): RequiredWithEscapedCharactersMap100100Builder { + return RequiredWithEscapedCharactersMap100100Builder(instance) + } + override fun getBuilderAfterFoorbar(instance: MutableMap): RequiredWithEscapedCharactersMap110000Builder { + return RequiredWithEscapedCharactersMap110000Builder(instance) + } + } + + class RequiredWithEscapedCharactersMap110101Builder(private val instance: MutableMap): SetterForFootbar, SetterForFoonbar, SetterForFoorbar, SetterForFoobar1 { + override fun getInstance(): MutableMap { + return instance + } + override fun getBuilderAfterFootbar(instance: MutableMap): RequiredWithEscapedCharactersMap010101Builder { + return RequiredWithEscapedCharactersMap010101Builder(instance) + } + override fun getBuilderAfterFoonbar(instance: MutableMap): RequiredWithEscapedCharactersMap100101Builder { + return RequiredWithEscapedCharactersMap100101Builder(instance) + } + override fun getBuilderAfterFoorbar(instance: MutableMap): RequiredWithEscapedCharactersMap110001Builder { + return RequiredWithEscapedCharactersMap110001Builder(instance) + } + override fun getBuilderAfterFoobar1(instance: MutableMap): RequiredWithEscapedCharactersMap110100Builder { + return RequiredWithEscapedCharactersMap110100Builder(instance) + } + } + + class RequiredWithEscapedCharactersMap110110Builder(private val instance: MutableMap): SetterForFootbar, SetterForFoonbar, SetterForFoorbar, SetterForFoobar { + override fun getInstance(): MutableMap { + return instance + } + override fun getBuilderAfterFootbar(instance: MutableMap): RequiredWithEscapedCharactersMap010110Builder { + return RequiredWithEscapedCharactersMap010110Builder(instance) + } + override fun getBuilderAfterFoonbar(instance: MutableMap): RequiredWithEscapedCharactersMap100110Builder { + return RequiredWithEscapedCharactersMap100110Builder(instance) + } + override fun getBuilderAfterFoorbar(instance: MutableMap): RequiredWithEscapedCharactersMap110010Builder { + return RequiredWithEscapedCharactersMap110010Builder(instance) + } + override fun getBuilderAfterFoobar(instance: MutableMap): RequiredWithEscapedCharactersMap110100Builder { + return RequiredWithEscapedCharactersMap110100Builder(instance) + } + } + + class RequiredWithEscapedCharactersMap110111Builder(private val instance: MutableMap): SetterForFootbar, SetterForFoonbar, SetterForFoorbar, SetterForFoobar, SetterForFoobar1 { + override fun getInstance(): MutableMap { + return instance + } + override fun getBuilderAfterFootbar(instance: MutableMap): RequiredWithEscapedCharactersMap010111Builder { + return RequiredWithEscapedCharactersMap010111Builder(instance) + } + override fun getBuilderAfterFoonbar(instance: MutableMap): RequiredWithEscapedCharactersMap100111Builder { + return RequiredWithEscapedCharactersMap100111Builder(instance) + } + override fun getBuilderAfterFoorbar(instance: MutableMap): RequiredWithEscapedCharactersMap110011Builder { + return RequiredWithEscapedCharactersMap110011Builder(instance) + } + override fun getBuilderAfterFoobar(instance: MutableMap): RequiredWithEscapedCharactersMap110101Builder { + return RequiredWithEscapedCharactersMap110101Builder(instance) + } + override fun getBuilderAfterFoobar1(instance: MutableMap): RequiredWithEscapedCharactersMap110110Builder { + return RequiredWithEscapedCharactersMap110110Builder(instance) + } + } + + class RequiredWithEscapedCharactersMap111000Builder(private val instance: MutableMap): SetterForFootbar, SetterForFoonbar, SetterForFoou000Cbar { + override fun getInstance(): MutableMap { + return instance + } + override fun getBuilderAfterFootbar(instance: MutableMap): RequiredWithEscapedCharactersMap011000Builder { + return RequiredWithEscapedCharactersMap011000Builder(instance) + } + override fun getBuilderAfterFoonbar(instance: MutableMap): RequiredWithEscapedCharactersMap101000Builder { + return RequiredWithEscapedCharactersMap101000Builder(instance) + } + override fun getBuilderAfterFoou000Cbar(instance: MutableMap): RequiredWithEscapedCharactersMap110000Builder { + return RequiredWithEscapedCharactersMap110000Builder(instance) + } + } + + class RequiredWithEscapedCharactersMap111001Builder(private val instance: MutableMap): SetterForFootbar, SetterForFoonbar, SetterForFoou000Cbar, SetterForFoobar1 { + override fun getInstance(): MutableMap { + return instance + } + override fun getBuilderAfterFootbar(instance: MutableMap): RequiredWithEscapedCharactersMap011001Builder { + return RequiredWithEscapedCharactersMap011001Builder(instance) + } + override fun getBuilderAfterFoonbar(instance: MutableMap): RequiredWithEscapedCharactersMap101001Builder { + return RequiredWithEscapedCharactersMap101001Builder(instance) + } + override fun getBuilderAfterFoou000Cbar(instance: MutableMap): RequiredWithEscapedCharactersMap110001Builder { + return RequiredWithEscapedCharactersMap110001Builder(instance) + } + override fun getBuilderAfterFoobar1(instance: MutableMap): RequiredWithEscapedCharactersMap111000Builder { + return RequiredWithEscapedCharactersMap111000Builder(instance) + } + } + + class RequiredWithEscapedCharactersMap111010Builder(private val instance: MutableMap): SetterForFootbar, SetterForFoonbar, SetterForFoou000Cbar, SetterForFoobar { + override fun getInstance(): MutableMap { + return instance + } + override fun getBuilderAfterFootbar(instance: MutableMap): RequiredWithEscapedCharactersMap011010Builder { + return RequiredWithEscapedCharactersMap011010Builder(instance) + } + override fun getBuilderAfterFoonbar(instance: MutableMap): RequiredWithEscapedCharactersMap101010Builder { + return RequiredWithEscapedCharactersMap101010Builder(instance) + } + override fun getBuilderAfterFoou000Cbar(instance: MutableMap): RequiredWithEscapedCharactersMap110010Builder { + return RequiredWithEscapedCharactersMap110010Builder(instance) + } + override fun getBuilderAfterFoobar(instance: MutableMap): RequiredWithEscapedCharactersMap111000Builder { + return RequiredWithEscapedCharactersMap111000Builder(instance) + } + } + + class RequiredWithEscapedCharactersMap111011Builder(private val instance: MutableMap): SetterForFootbar, SetterForFoonbar, SetterForFoou000Cbar, SetterForFoobar, SetterForFoobar1 { + override fun getInstance(): MutableMap { + return instance + } + override fun getBuilderAfterFootbar(instance: MutableMap): RequiredWithEscapedCharactersMap011011Builder { + return RequiredWithEscapedCharactersMap011011Builder(instance) + } + override fun getBuilderAfterFoonbar(instance: MutableMap): RequiredWithEscapedCharactersMap101011Builder { + return RequiredWithEscapedCharactersMap101011Builder(instance) + } + override fun getBuilderAfterFoou000Cbar(instance: MutableMap): RequiredWithEscapedCharactersMap110011Builder { + return RequiredWithEscapedCharactersMap110011Builder(instance) + } + override fun getBuilderAfterFoobar(instance: MutableMap): RequiredWithEscapedCharactersMap111001Builder { + return RequiredWithEscapedCharactersMap111001Builder(instance) + } + override fun getBuilderAfterFoobar1(instance: MutableMap): RequiredWithEscapedCharactersMap111010Builder { + return RequiredWithEscapedCharactersMap111010Builder(instance) + } + } + + class RequiredWithEscapedCharactersMap111100Builder(private val instance: MutableMap): SetterForFootbar, SetterForFoonbar, SetterForFoou000Cbar, SetterForFoorbar { + override fun getInstance(): MutableMap { + return instance + } + override fun getBuilderAfterFootbar(instance: MutableMap): RequiredWithEscapedCharactersMap011100Builder { + return RequiredWithEscapedCharactersMap011100Builder(instance) + } + override fun getBuilderAfterFoonbar(instance: MutableMap): RequiredWithEscapedCharactersMap101100Builder { + return RequiredWithEscapedCharactersMap101100Builder(instance) + } + override fun getBuilderAfterFoou000Cbar(instance: MutableMap): RequiredWithEscapedCharactersMap110100Builder { + return RequiredWithEscapedCharactersMap110100Builder(instance) + } + override fun getBuilderAfterFoorbar(instance: MutableMap): RequiredWithEscapedCharactersMap111000Builder { + return RequiredWithEscapedCharactersMap111000Builder(instance) + } + } + + class RequiredWithEscapedCharactersMap111101Builder(private val instance: MutableMap): SetterForFootbar, SetterForFoonbar, SetterForFoou000Cbar, SetterForFoorbar, SetterForFoobar1 { + override fun getInstance(): MutableMap { + return instance + } + override fun getBuilderAfterFootbar(instance: MutableMap): RequiredWithEscapedCharactersMap011101Builder { + return RequiredWithEscapedCharactersMap011101Builder(instance) + } + override fun getBuilderAfterFoonbar(instance: MutableMap): RequiredWithEscapedCharactersMap101101Builder { + return RequiredWithEscapedCharactersMap101101Builder(instance) + } + override fun getBuilderAfterFoou000Cbar(instance: MutableMap): RequiredWithEscapedCharactersMap110101Builder { + return RequiredWithEscapedCharactersMap110101Builder(instance) + } + override fun getBuilderAfterFoorbar(instance: MutableMap): RequiredWithEscapedCharactersMap111001Builder { + return RequiredWithEscapedCharactersMap111001Builder(instance) + } + override fun getBuilderAfterFoobar1(instance: MutableMap): RequiredWithEscapedCharactersMap111100Builder { + return RequiredWithEscapedCharactersMap111100Builder(instance) + } + } + + class RequiredWithEscapedCharactersMap111110Builder(private val instance: MutableMap): SetterForFootbar, SetterForFoonbar, SetterForFoou000Cbar, SetterForFoorbar, SetterForFoobar { + override fun getInstance(): MutableMap { + return instance + } + override fun getBuilderAfterFootbar(instance: MutableMap): RequiredWithEscapedCharactersMap011110Builder { + return RequiredWithEscapedCharactersMap011110Builder(instance) + } + override fun getBuilderAfterFoonbar(instance: MutableMap): RequiredWithEscapedCharactersMap101110Builder { + return RequiredWithEscapedCharactersMap101110Builder(instance) + } + override fun getBuilderAfterFoou000Cbar(instance: MutableMap): RequiredWithEscapedCharactersMap110110Builder { + return RequiredWithEscapedCharactersMap110110Builder(instance) + } + override fun getBuilderAfterFoorbar(instance: MutableMap): RequiredWithEscapedCharactersMap111010Builder { + return RequiredWithEscapedCharactersMap111010Builder(instance) + } + override fun getBuilderAfterFoobar(instance: MutableMap): RequiredWithEscapedCharactersMap111100Builder { + return RequiredWithEscapedCharactersMap111100Builder(instance) + } + } + + class RequiredWithEscapedCharactersMapBuilder: SetterForFootbar, SetterForFoonbar, SetterForFoou000Cbar, SetterForFoorbar, SetterForFoobar, SetterForFoobar1 { + private val instance: MutableMap + init { + this.instance = LinkedHashMap() + } + override fun getInstance(): MutableMap { + return instance + } + override fun getBuilderAfterFootbar(instance: MutableMap): RequiredWithEscapedCharactersMap011111Builder { + return RequiredWithEscapedCharactersMap011111Builder(instance) + } + override fun getBuilderAfterFoonbar(instance: MutableMap): RequiredWithEscapedCharactersMap101111Builder { + return RequiredWithEscapedCharactersMap101111Builder(instance) + } + override fun getBuilderAfterFoou000Cbar(instance: MutableMap): RequiredWithEscapedCharactersMap110111Builder { + return RequiredWithEscapedCharactersMap110111Builder(instance) + } + override fun getBuilderAfterFoorbar(instance: MutableMap): RequiredWithEscapedCharactersMap111011Builder { + return RequiredWithEscapedCharactersMap111011Builder(instance) + } + override fun getBuilderAfterFoobar(instance: MutableMap): RequiredWithEscapedCharactersMap111101Builder { + return RequiredWithEscapedCharactersMap111101Builder(instance) + } + override fun getBuilderAfterFoobar1(instance: MutableMap): RequiredWithEscapedCharactersMap111110Builder { + return RequiredWithEscapedCharactersMap111110Builder(instance) + } + } + + + sealed interface RequiredWithEscapedCharacters1Boxed { + fun getData(): Any? + } + + data class RequiredWithEscapedCharacters1BoxedVoid(val data: Nothing?) : RequiredWithEscapedCharacters1Boxed { + override fun getData(): Any? { + return data + } + } + + data class RequiredWithEscapedCharacters1BoxedBoolean(val data: Boolean): RequiredWithEscapedCharacters1Boxed { + override fun getData(): Any? { + return data + } + } + + data class RequiredWithEscapedCharacters1BoxedNumber(val data: Number) : RequiredWithEscapedCharacters1Boxed { + override fun getData(): Any? { + return data + } + } + + data class RequiredWithEscapedCharacters1BoxedString(val data: String) : RequiredWithEscapedCharacters1Boxed { + override fun getData(): Any? { + return data + } + } + + data class RequiredWithEscapedCharacters1BoxedList(val data: FrozenList) : RequiredWithEscapedCharacters1Boxed { + override fun getData(): Any? { + return data + } + } + + data class RequiredWithEscapedCharacters1BoxedMap(val data: RequiredWithEscapedCharactersMap) : RequiredWithEscapedCharacters1Boxed { + override fun getData(): Any? { + return data + } + } + + + class RequiredWithEscapedCharacters1 private constructor(): JsonSchema( + JsonSchemaInfo() + .required(setOf( + "foo\tbar", + "foo\nbar", + "foo\u000Cbar", + "foo\rbar", + "foo\"bar", + "foo\\bar" + )) + ), NullSchemaValidator, BooleanSchemaValidator, NumberSchemaValidator, StringSchemaValidator, ListSchemaValidator, RequiredWithEscapedCharacters1BoxedList>, MapSchemaValidator { + /* + NOTE: This class is auto generated by OpenAPI JSON Schema Generator. + Ref: https://github.com/openapi-json-schema-tools/openapi-json-schema-generator + + Do not edit the class manually. + */ + + companion object { + @Volatile + private var instance: RequiredWithEscapedCharacters1? = null + + fun getInstance() = + instance ?: synchronized(this) { + instance ?: RequiredWithEscapedCharacters1().also { instance = it } + } + } + + @Throws(ValidationException::class) + override fun validate(arg: Nothing?, configuration: SchemaConfiguration?): Nothing? { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validatedPathToSchemas = PathToSchemasMap() + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, LinkedHashSet()) + getPathToSchemas(this, castArg, validationMetadata, pathSet) + return castArg + } + + @Throws(ValidationException::class) + override fun validate(arg: Boolean, configuration: SchemaConfiguration?): Boolean { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validatedPathToSchemas = PathToSchemasMap() + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, LinkedHashSet()) + getPathToSchemas(this, castArg, validationMetadata, pathSet) + return castArg + } + + @Throws(ValidationException::class) + override fun validate(arg: Number, configuration: SchemaConfiguration?): Number { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validatedPathToSchemas = PathToSchemasMap() + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, LinkedHashSet()) + getPathToSchemas(this, castArg, validationMetadata, pathSet) + return castArg + } + + @Throws(ValidationException::class) + fun validate(arg: Int, configuration: SchemaConfiguration?): Int { + return validate(arg as Number, configuration) as Int + } + + @Throws(ValidationException::class) + fun validate(arg: Long, configuration: SchemaConfiguration?): Long { + return validate(arg as Number, configuration) as Long + } + + @Throws(ValidationException::class) + fun validate(arg: Float, configuration: SchemaConfiguration?): Float { + return validate(arg as Number, configuration) as Float + } + + @Throws(ValidationException::class) + fun validate(arg: Double, configuration: SchemaConfiguration?): Double { + return validate(arg as Number, configuration) as Double + } + + @Throws(ValidationException::class) + override fun validate(arg: String, configuration: SchemaConfiguration?): String { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validatedPathToSchemas = PathToSchemasMap() + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, LinkedHashSet()) + getPathToSchemas(this, castArg, validationMetadata, pathSet) + return castArg + } + + @Throws(ValidationException::class) + fun validate(arg: LocalDate, configuration: SchemaConfiguration?): String { + return validate(arg.toString(), configuration) + } + + @Throws(ValidationException::class) + fun validate(arg: ZonedDateTime, configuration: SchemaConfiguration?): String { + return validate(arg.toString(), configuration) + } + + @Throws(ValidationException::class) + fun validate(arg: UUID, configuration: SchemaConfiguration?): String { + return validate(arg.toString(), configuration) + } + + override fun getNewInstance(arg: List<*>, pathToItem: List, pathToSchemas: PathToSchemasMap): FrozenList { + val items: MutableList = ArrayList() + var i: Int = 0 + for (item: Any? in arg) { + val itemPathToItem = pathToItem + i + val schemas: LinkedHashMap, Nothing?>? = pathToSchemas.get(itemPathToItem) + if (schemas == null) { + throw RuntimeException("Validation result is invalid, schemas must exist for a pathToItem") + } + val itemSchema: JsonSchema<*> = schemas.entries.iterator().next().key + val itemInstance: Any? = itemSchema.getNewInstance(item, itemPathToItem, pathToSchemas) + items.add(itemInstance) + i += 1 + } + val newInstanceItems: FrozenList = FrozenList(items) + return newInstanceItems + } + + @Throws(ValidationException::class) + override fun validate(arg: List<*>, configuration: SchemaConfiguration?): FrozenList { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, PathToSchemasMap(), LinkedHashSet()) + val pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet) + return getNewInstance(castArg, validationMetadata.pathToItem, pathToSchemasMap) + } + + override fun getNewInstance(arg: Map<*, *>, pathToItem: List, pathToSchemas: PathToSchemasMap): RequiredWithEscapedCharactersMap { + val properties: LinkedHashMap = LinkedHashMap() + for((propertyName, value) in arg) { + if (!(propertyName is String)) { + throw RuntimeException("Invalid non-string key value") + } + val propertyPathToItem: List = pathToItem + propertyName + val schemas: LinkedHashMap, Nothing?>? = pathToSchemas.get(propertyPathToItem) + if (schemas == null) { + throw RuntimeException("Validation result is invalid, schemas must exist for a pathToItem") + } + val propertySchema: JsonSchema<*> = schemas.entries.iterator().next().key + val propertyInstance: Any? = propertySchema.getNewInstance(value, propertyPathToItem, pathToSchemas) + properties[propertyName] = propertyInstance + } + val castProperties: FrozenMap = FrozenMap(properties) + return RequiredWithEscapedCharactersMap(castProperties) + } + + @Throws(ValidationException::class) + override fun validate(arg: Map<*, *>, configuration: SchemaConfiguration?): RequiredWithEscapedCharactersMap { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validatedPathToSchemas = PathToSchemasMap() + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, LinkedHashSet()) + val pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet) + return getNewInstance(castArg, validationMetadata.pathToItem, pathToSchemasMap) + } + + @Throws(ValidationException::class) + override fun validate(arg: Any?, configuration: SchemaConfiguration?): Any? { + if (arg == null) { + return validate(null, configuration) + } else if (arg is Boolean) { + return validate(arg, configuration) + } else if (arg is Number) { + return validate(arg, configuration) + } else if (arg is String) { + return validate(arg, configuration) + } else if (arg is List<*>) { + return validate(arg, configuration) + } else if (arg is Map<*, *>) { + return validate(arg, configuration) + } + throw ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema") + } + override fun getNewInstance(arg: Any?, pathToItem: List, pathToSchemas: PathToSchemasMap): Any? { + if (arg == null) { + return getNewInstance( null, pathToItem, pathToSchemas) + } else if (arg is Boolean) { + return getNewInstance(arg, pathToItem, pathToSchemas) + } else if (arg is Number) { + return getNewInstance(arg, pathToItem, pathToSchemas) + } else if (arg is String) { + return getNewInstance(arg, pathToItem, pathToSchemas) + } else if (arg is List<*>) { + return getNewInstance(arg, pathToItem, pathToSchemas) + } else if (arg is Map<*, *>) { + return getNewInstance(arg, pathToItem, pathToSchemas) + } + throw RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema") + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: Nothing?, configuration: SchemaConfiguration?): RequiredWithEscapedCharacters1BoxedVoid { + return RequiredWithEscapedCharacters1BoxedVoid(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: Boolean, configuration: SchemaConfiguration?): RequiredWithEscapedCharacters1BoxedBoolean { + return RequiredWithEscapedCharacters1BoxedBoolean(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: Number, configuration: SchemaConfiguration?): RequiredWithEscapedCharacters1BoxedNumber { + return RequiredWithEscapedCharacters1BoxedNumber(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: String, configuration: SchemaConfiguration?): RequiredWithEscapedCharacters1BoxedString { + return RequiredWithEscapedCharacters1BoxedString(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: List<*>, configuration: SchemaConfiguration?): RequiredWithEscapedCharacters1BoxedList { + return RequiredWithEscapedCharacters1BoxedList(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: Map<*, *>, configuration: SchemaConfiguration?): RequiredWithEscapedCharacters1BoxedMap { + return RequiredWithEscapedCharacters1BoxedMap(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: Any?, configuration: SchemaConfiguration?): RequiredWithEscapedCharacters1Boxed { + if (arg == null) { + return validateAndBox(null, configuration) + } else if (arg is Boolean) { + return validateAndBox(arg, configuration) + } else if (arg is String) { + return validateAndBox(arg, configuration) + } else if (arg is Number) { + return validateAndBox(arg, configuration) + } else if (arg is List<*>) { + return validateAndBox(arg, configuration) + } else if (arg is Map<*, *>) { + return validateAndBox(arg, configuration) + } + throw ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema") + } + } +} diff --git a/samples/client/3_1_0_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/schemas/SimpleEnumValidation.kt b/samples/client/3_1_0_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/schemas/SimpleEnumValidation.kt new file mode 100644 index 00000000000..6a6008202bc --- /dev/null +++ b/samples/client/3_1_0_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/schemas/SimpleEnumValidation.kt @@ -0,0 +1,183 @@ +package org.openapijsonschematools.client.components.schemas +import java.math.BigDecimal +import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags +import org.openapijsonschematools.client.configurations.SchemaConfiguration +import org.openapijsonschematools.client.exceptions.ValidationException +import org.openapijsonschematools.client.schemas.validation.DoubleEnumValidator +import org.openapijsonschematools.client.schemas.validation.DoubleValueMethod +import org.openapijsonschematools.client.schemas.validation.FloatEnumValidator +import org.openapijsonschematools.client.schemas.validation.FloatValueMethod +import org.openapijsonschematools.client.schemas.validation.IntegerEnumValidator +import org.openapijsonschematools.client.schemas.validation.IntegerValueMethod +import org.openapijsonschematools.client.schemas.validation.JsonSchema +import org.openapijsonschematools.client.schemas.validation.JsonSchemaInfo +import org.openapijsonschematools.client.schemas.validation.LongEnumValidator +import org.openapijsonschematools.client.schemas.validation.LongValueMethod +import org.openapijsonschematools.client.schemas.validation.NumberSchemaValidator +import org.openapijsonschematools.client.schemas.validation.PathToSchemasMap +import org.openapijsonschematools.client.schemas.validation.ValidationMetadata + +class SimpleEnumValidation { + // nest classes so all schemas and input/output classes can be public + + enum class IntegerSimpleEnumValidationEnums(private val value: Int): IntegerValueMethod { + POSITIVE_1(1), + POSITIVE_2(2), + POSITIVE_3(3); + + override fun value(): Int { + return this.value + } + } + + enum class LongSimpleEnumValidationEnums(private val value: Long): LongValueMethod { + POSITIVE_1(1L), + POSITIVE_2(2L), + POSITIVE_3(3L); + + override fun value(): Long { + return this.value + } + } + + enum class FloatSimpleEnumValidationEnums(private val value: Float): FloatValueMethod { + POSITIVE_1(1.0f), + POSITIVE_2(2.0f), + POSITIVE_3(3.0f); + + override fun value(): Float { + return this.value + } + } + + enum class DoubleSimpleEnumValidationEnums(private val value: Double): DoubleValueMethod { + POSITIVE_1(1.0), + POSITIVE_2(2.0), + POSITIVE_3(3.0); + + override fun value(): Double { + return this.value + } + } + + + sealed interface SimpleEnumValidation1Boxed { + fun getData(): Any? + } + + data class SimpleEnumValidation1BoxedNumber(val data: Number) : SimpleEnumValidation1Boxed { + override fun getData(): Any? { + return data + } + } + + + + class SimpleEnumValidation1 private constructor(): JsonSchema( + JsonSchemaInfo() + .type(setOf( + Int::class.java, + Long::class.java, + Float::class.java, + Double::class.java + )) + .enumValues(setOf( + BigDecimal("1"), + BigDecimal("2"), + BigDecimal("3") + )) + ), IntegerEnumValidator, LongEnumValidator, FloatEnumValidator, DoubleEnumValidator, NumberSchemaValidator { + /* + NOTE: This class is auto generated by OpenAPI JSON Schema Generator. + Ref: https://github.com/openapi-json-schema-tools/openapi-json-schema-generator + + Do not edit the class manually. + */ + + companion object { + @Volatile + private var instance: SimpleEnumValidation1? = null + + fun getInstance() = + instance ?: synchronized(this) { + instance ?: SimpleEnumValidation1().also { instance = it } + } + } + + @Throws(ValidationException::class) + override fun validate(arg: Number, configuration: SchemaConfiguration?): Number { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, PathToSchemasMap(), LinkedHashSet()) + val pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet) + return castArg + } + + @Throws(ValidationException::class) + fun validate(arg: Int, configuration: SchemaConfiguration?): Int { + return validate(arg as Number, configuration) as Int + } + + @Throws(ValidationException::class) + fun validate(arg: Long, configuration: SchemaConfiguration?): Long { + return validate(arg as Number, configuration) as Long + } + + @Throws(ValidationException::class) + fun validate(arg: Float, configuration: SchemaConfiguration?): Float { + return validate(arg as Number, configuration) as Float + } + + @Throws(ValidationException::class) + fun validate(arg: Double, configuration: SchemaConfiguration?): Double { + return validate(arg as Number, configuration) as Double + } + + @Throws(ValidationException::class) + override fun validate(arg: IntegerSimpleEnumValidationEnums, configuration: SchemaConfiguration?): Int { + return validate(arg.value() as Number, configuration) as Int + } + + @Throws(ValidationException::class) + override fun validate(arg: LongSimpleEnumValidationEnums, configuration: SchemaConfiguration?): Long { + return validate(arg.value() as Number, configuration) as Long + } + + @Throws(ValidationException::class) + override fun validate(arg: FloatSimpleEnumValidationEnums, configuration: SchemaConfiguration?): Float { + return validate(arg.value() as Number, configuration) as Float + } + + @Throws(ValidationException::class) + override fun validate(arg: DoubleSimpleEnumValidationEnums, configuration: SchemaConfiguration?): Double { + return validate(arg.value() as Number, configuration) as Double + } + + @Throws(ValidationException::class) + override fun validate(arg: Any?, configuration: SchemaConfiguration?): Any? { + if (arg is Number) { + return validate(arg, configuration) + } + throw ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema") + } + override fun getNewInstance(arg: Any?, pathToItem: List, pathToSchemas: PathToSchemasMap): Any? { + if (arg is Number) { + return getNewInstance(arg, pathToItem, pathToSchemas) + } + throw RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema") + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: Number, configuration: SchemaConfiguration?): SimpleEnumValidation1BoxedNumber { + return SimpleEnumValidation1BoxedNumber(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: Any?, configuration: SchemaConfiguration?): SimpleEnumValidation1Boxed { + if (arg is Number) { + return validateAndBox(arg, configuration) + } + throw ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema") + } + } +} diff --git a/samples/client/3_1_0_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/schemas/SingleDependency.kt b/samples/client/3_1_0_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/schemas/SingleDependency.kt new file mode 100644 index 00000000000..77a3137bfc1 --- /dev/null +++ b/samples/client/3_1_0_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/schemas/SingleDependency.kt @@ -0,0 +1,317 @@ +package org.openapijsonschematools.client.components.schemas +import java.time.LocalDate +import java.time.ZonedDateTime +import java.util.AbstractMap +import java.util.UUID +import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags +import org.openapijsonschematools.client.configurations.SchemaConfiguration +import org.openapijsonschematools.client.exceptions.InvalidAdditionalPropertyException +import org.openapijsonschematools.client.exceptions.UnsetPropertyException +import org.openapijsonschematools.client.exceptions.ValidationException +import org.openapijsonschematools.client.schemas.UnsetAddPropsSetter +import org.openapijsonschematools.client.schemas.validation.BooleanSchemaValidator +import org.openapijsonschematools.client.schemas.validation.FrozenList +import org.openapijsonschematools.client.schemas.validation.FrozenMap +import org.openapijsonschematools.client.schemas.validation.JsonSchema +import org.openapijsonschematools.client.schemas.validation.JsonSchemaInfo +import org.openapijsonschematools.client.schemas.validation.ListSchemaValidator +import org.openapijsonschematools.client.schemas.validation.MapSchemaValidator +import org.openapijsonschematools.client.schemas.validation.MapUtils +import org.openapijsonschematools.client.schemas.validation.NullSchemaValidator +import org.openapijsonschematools.client.schemas.validation.NumberSchemaValidator +import org.openapijsonschematools.client.schemas.validation.PathToSchemasMap +import org.openapijsonschematools.client.schemas.validation.StringSchemaValidator +import org.openapijsonschematools.client.schemas.validation.ValidationMetadata + +class SingleDependency { + // nest classes so all schemas and input/output classes can be public + + + sealed interface SingleDependency1Boxed { + fun getData(): Any? + } + + data class SingleDependency1BoxedVoid(val data: Nothing?) : SingleDependency1Boxed { + override fun getData(): Any? { + return data + } + } + + data class SingleDependency1BoxedBoolean(val data: Boolean): SingleDependency1Boxed { + override fun getData(): Any? { + return data + } + } + + data class SingleDependency1BoxedNumber(val data: Number) : SingleDependency1Boxed { + override fun getData(): Any? { + return data + } + } + + data class SingleDependency1BoxedString(val data: String) : SingleDependency1Boxed { + override fun getData(): Any? { + return data + } + } + + data class SingleDependency1BoxedList(val data: FrozenList) : SingleDependency1Boxed { + override fun getData(): Any? { + return data + } + } + + data class SingleDependency1BoxedMap(val data: FrozenMap) : SingleDependency1Boxed { + override fun getData(): Any? { + return data + } + } + + + class SingleDependency1 private constructor(): JsonSchema( + JsonSchemaInfo() + .dependentRequired(MapUtils.makeMap( + new AbstractMap.SimpleEntry<>( + "bar", + setOf( + "foo" + ) + ) + )) + ), NullSchemaValidator, BooleanSchemaValidator, NumberSchemaValidator, StringSchemaValidator, ListSchemaValidator, SingleDependency1BoxedList>, MapSchemaValidator, SingleDependency1BoxedMap> { + /* + NOTE: This class is auto generated by OpenAPI JSON Schema Generator. + Ref: https://github.com/openapi-json-schema-tools/openapi-json-schema-generator + + Do not edit the class manually. + */ + + companion object { + @Volatile + private var instance: SingleDependency1? = null + + fun getInstance() = + instance ?: synchronized(this) { + instance ?: SingleDependency1().also { instance = it } + } + } + + @Throws(ValidationException::class) + override fun validate(arg: Nothing?, configuration: SchemaConfiguration?): Nothing? { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validatedPathToSchemas = PathToSchemasMap() + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, LinkedHashSet()) + getPathToSchemas(this, castArg, validationMetadata, pathSet) + return castArg + } + + @Throws(ValidationException::class) + override fun validate(arg: Boolean, configuration: SchemaConfiguration?): Boolean { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validatedPathToSchemas = PathToSchemasMap() + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, LinkedHashSet()) + getPathToSchemas(this, castArg, validationMetadata, pathSet) + return castArg + } + + @Throws(ValidationException::class) + override fun validate(arg: Number, configuration: SchemaConfiguration?): Number { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validatedPathToSchemas = PathToSchemasMap() + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, LinkedHashSet()) + getPathToSchemas(this, castArg, validationMetadata, pathSet) + return castArg + } + + @Throws(ValidationException::class) + fun validate(arg: Int, configuration: SchemaConfiguration?): Int { + return validate(arg as Number, configuration) as Int + } + + @Throws(ValidationException::class) + fun validate(arg: Long, configuration: SchemaConfiguration?): Long { + return validate(arg as Number, configuration) as Long + } + + @Throws(ValidationException::class) + fun validate(arg: Float, configuration: SchemaConfiguration?): Float { + return validate(arg as Number, configuration) as Float + } + + @Throws(ValidationException::class) + fun validate(arg: Double, configuration: SchemaConfiguration?): Double { + return validate(arg as Number, configuration) as Double + } + + @Throws(ValidationException::class) + override fun validate(arg: String, configuration: SchemaConfiguration?): String { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validatedPathToSchemas = PathToSchemasMap() + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, LinkedHashSet()) + getPathToSchemas(this, castArg, validationMetadata, pathSet) + return castArg + } + + @Throws(ValidationException::class) + fun validate(arg: LocalDate, configuration: SchemaConfiguration?): String { + return validate(arg.toString(), configuration) + } + + @Throws(ValidationException::class) + fun validate(arg: ZonedDateTime, configuration: SchemaConfiguration?): String { + return validate(arg.toString(), configuration) + } + + @Throws(ValidationException::class) + fun validate(arg: UUID, configuration: SchemaConfiguration?): String { + return validate(arg.toString(), configuration) + } + + override fun getNewInstance(arg: List<*>, pathToItem: List, pathToSchemas: PathToSchemasMap): FrozenList { + val items: MutableList = ArrayList() + var i: Int = 0 + for (item: Any? in arg) { + val itemPathToItem = pathToItem + i + val schemas: LinkedHashMap, Nothing?>? = pathToSchemas.get(itemPathToItem) + if (schemas == null) { + throw RuntimeException("Validation result is invalid, schemas must exist for a pathToItem") + } + val itemSchema: JsonSchema<*> = schemas.entries.iterator().next().key + val itemInstance: Any? = itemSchema.getNewInstance(item, itemPathToItem, pathToSchemas) + items.add(itemInstance) + i += 1 + } + val newInstanceItems: FrozenList = FrozenList(items) + return newInstanceItems + } + + @Throws(ValidationException::class) + override fun validate(arg: List<*>, configuration: SchemaConfiguration?): FrozenList { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, PathToSchemasMap(), LinkedHashSet()) + val pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet) + return getNewInstance(castArg, validationMetadata.pathToItem, pathToSchemasMap) + } + + override fun getNewInstance(arg: Map<*, *>, pathToItem: List, pathToSchemas: PathToSchemasMap): FrozenMap { + val properties: LinkedHashMap = LinkedHashMap() + for((propertyName, value) in arg) { + if (!(propertyName is String)) { + throw RuntimeException("Invalid non-string key value") + } + val propertyPathToItem: List = pathToItem + propertyName + val schemas: LinkedHashMap, Nothing?>? = pathToSchemas.get(propertyPathToItem) + if (schemas == null) { + throw RuntimeException("Validation result is invalid, schemas must exist for a pathToItem") + } + val propertySchema: JsonSchema<*> = schemas.entries.iterator().next().key + val propertyInstance: Any? = propertySchema.getNewInstance(value, propertyPathToItem, pathToSchemas) + properties[propertyName] = propertyInstance + } + val castProperties: FrozenMap = FrozenMap(properties) + return castProperties + } + + @Throws(ValidationException::class) + override fun validate(arg: Map<*, *>, configuration: SchemaConfiguration?): FrozenMap { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validatedPathToSchemas = PathToSchemasMap() + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, LinkedHashSet()) + val pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet) + return getNewInstance(castArg, validationMetadata.pathToItem, pathToSchemasMap) + } + + @Throws(ValidationException::class) + override fun validate(arg: Any?, configuration: SchemaConfiguration?): Any? { + if (arg == null) { + return validate(null, configuration) + } else if (arg is Boolean) { + return validate(arg, configuration) + } else if (arg is Number) { + return validate(arg, configuration) + } else if (arg is String) { + return validate(arg, configuration) + } else if (arg is List<*>) { + return validate(arg, configuration) + } else if (arg is Map<*, *>) { + return validate(arg, configuration) + } + throw ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema") + } + override fun getNewInstance(arg: Any?, pathToItem: List, pathToSchemas: PathToSchemasMap): Any? { + if (arg == null) { + return getNewInstance( null, pathToItem, pathToSchemas) + } else if (arg is Boolean) { + return getNewInstance(arg, pathToItem, pathToSchemas) + } else if (arg is Number) { + return getNewInstance(arg, pathToItem, pathToSchemas) + } else if (arg is String) { + return getNewInstance(arg, pathToItem, pathToSchemas) + } else if (arg is List<*>) { + return getNewInstance(arg, pathToItem, pathToSchemas) + } else if (arg is Map<*, *>) { + return getNewInstance(arg, pathToItem, pathToSchemas) + } + throw RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema") + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: Nothing?, configuration: SchemaConfiguration?): SingleDependency1BoxedVoid { + return SingleDependency1BoxedVoid(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: Boolean, configuration: SchemaConfiguration?): SingleDependency1BoxedBoolean { + return SingleDependency1BoxedBoolean(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: Number, configuration: SchemaConfiguration?): SingleDependency1BoxedNumber { + return SingleDependency1BoxedNumber(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: String, configuration: SchemaConfiguration?): SingleDependency1BoxedString { + return SingleDependency1BoxedString(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: List<*>, configuration: SchemaConfiguration?): SingleDependency1BoxedList { + return SingleDependency1BoxedList(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: Map<*, *>, configuration: SchemaConfiguration?): SingleDependency1BoxedMap { + return SingleDependency1BoxedMap(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: Any?, configuration: SchemaConfiguration?): SingleDependency1Boxed { + if (arg == null) { + return validateAndBox(null, configuration) + } else if (arg is Boolean) { + return validateAndBox(arg, configuration) + } else if (arg is String) { + return validateAndBox(arg, configuration) + } else if (arg is Number) { + return validateAndBox(arg, configuration) + } else if (arg is List<*>) { + return validateAndBox(arg, configuration) + } else if (arg is Map<*, *>) { + return validateAndBox(arg, configuration) + } + throw ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema") + } + } +} diff --git a/samples/client/3_1_0_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/schemas/SmallMultipleOfLargeInteger.kt b/samples/client/3_1_0_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/schemas/SmallMultipleOfLargeInteger.kt new file mode 100644 index 00000000000..73569f56e70 --- /dev/null +++ b/samples/client/3_1_0_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/schemas/SmallMultipleOfLargeInteger.kt @@ -0,0 +1,112 @@ +package org.openapijsonschematools.client.components.schemas +import java.math.BigDecimal +import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags +import org.openapijsonschematools.client.configurations.SchemaConfiguration +import org.openapijsonschematools.client.exceptions.ValidationException +import org.openapijsonschematools.client.schemas.validation.JsonSchema +import org.openapijsonschematools.client.schemas.validation.JsonSchemaInfo +import org.openapijsonschematools.client.schemas.validation.NumberSchemaValidator +import org.openapijsonschematools.client.schemas.validation.PathToSchemasMap +import org.openapijsonschematools.client.schemas.validation.ValidationMetadata + +class SmallMultipleOfLargeInteger { + // nest classes so all schemas and input/output classes can be public + + + sealed interface SmallMultipleOfLargeInteger1Boxed { + fun getData(): Any? + } + + data class SmallMultipleOfLargeInteger1BoxedNumber(val data: Number) : SmallMultipleOfLargeInteger1Boxed { + override fun getData(): Any? { + return data + } + } + + + + class SmallMultipleOfLargeInteger1 private constructor(): JsonSchema( + JsonSchemaInfo() + .type(setOf( + Int::class.java, + Long::class.java, + Float::class.java, + Double::class.java + )) + .format("int") + .multipleOf(BigDecimal("1.0E-8")) + ), NumberSchemaValidator { + /* + NOTE: This class is auto generated by OpenAPI JSON Schema Generator. + Ref: https://github.com/openapi-json-schema-tools/openapi-json-schema-generator + + Do not edit the class manually. + */ + + companion object { + @Volatile + private var instance: SmallMultipleOfLargeInteger1? = null + + fun getInstance() = + instance ?: synchronized(this) { + instance ?: SmallMultipleOfLargeInteger1().also { instance = it } + } + } + + @Throws(ValidationException::class) + override fun validate(arg: Number, configuration: SchemaConfiguration?): Number { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, PathToSchemasMap(), LinkedHashSet()) + getPathToSchemas(this, castArg, validationMetadata, pathSet) + return castArg + } + + @Throws(ValidationException::class) + fun validate(arg: Int, configuration: SchemaConfiguration?): Int { + return validate(arg as Number, configuration) as Int + } + + @Throws(ValidationException::class) + fun validate(arg: Float, configuration: SchemaConfiguration?): Float { + return validate(arg as Number, configuration) as Float + } + + @Throws(ValidationException::class) + fun validate(arg: Long, configuration: SchemaConfiguration?): Long { + return validate(arg as Number, configuration) as Long + } + + @Throws(ValidationException::class) + fun validate(arg: Double, configuration: SchemaConfiguration?): Double { + return validate(arg as Number, configuration) as Double + } + + @Throws(ValidationException::class) + override fun validate(arg: Any?, configuration: SchemaConfiguration?): Any? { + if (arg is Number) { + return validate(arg, configuration) + } + throw ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema") + } + override fun getNewInstance(arg: Any?, pathToItem: List, pathToSchemas: PathToSchemasMap): Any? { + if (arg is Number) { + return getNewInstance(arg, pathToItem, pathToSchemas) + } + throw RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema") + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: Number, configuration: SchemaConfiguration?): SmallMultipleOfLargeInteger1BoxedNumber { + return SmallMultipleOfLargeInteger1BoxedNumber(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: Any?, configuration: SchemaConfiguration?): SmallMultipleOfLargeInteger1Boxed { + if (arg is Number) { + return validateAndBox(arg, configuration) + } + throw ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema") + } + } +} diff --git a/samples/client/3_1_0_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/schemas/StringTypeMatchesStrings.kt b/samples/client/3_1_0_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/schemas/StringTypeMatchesStrings.kt new file mode 100644 index 00000000000..029fbdd5f39 --- /dev/null +++ b/samples/client/3_1_0_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/schemas/StringTypeMatchesStrings.kt @@ -0,0 +1,20 @@ +package org.openapijsonschematools.client.components.schemas +import org.openapijsonschematools.client.schemas.StringJsonSchema + +class StringTypeMatchesStrings: StringJsonSchema() { + // nest classes so all schemas and input/output classes can be public + + + class StringTypeMatchesStrings1 : StringJsonSchema.StringJsonSchema1() { + companion object { + @Volatile + private var instance: StringTypeMatchesStrings1? = null + + fun getInstance() = + instance ?: synchronized(this) { + instance ?: StringTypeMatchesStrings1().also { instance = it } + } + } + } + +} diff --git a/samples/client/3_1_0_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/schemas/TimeFormat.kt b/samples/client/3_1_0_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/schemas/TimeFormat.kt new file mode 100644 index 00000000000..bd73df6d66c --- /dev/null +++ b/samples/client/3_1_0_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/schemas/TimeFormat.kt @@ -0,0 +1,308 @@ +package org.openapijsonschematools.client.components.schemas +import java.time.LocalDate +import java.time.ZonedDateTime +import java.util.UUID +import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags +import org.openapijsonschematools.client.configurations.SchemaConfiguration +import org.openapijsonschematools.client.exceptions.InvalidAdditionalPropertyException +import org.openapijsonschematools.client.exceptions.UnsetPropertyException +import org.openapijsonschematools.client.exceptions.ValidationException +import org.openapijsonschematools.client.schemas.UnsetAddPropsSetter +import org.openapijsonschematools.client.schemas.validation.BooleanSchemaValidator +import org.openapijsonschematools.client.schemas.validation.FrozenList +import org.openapijsonschematools.client.schemas.validation.FrozenMap +import org.openapijsonschematools.client.schemas.validation.JsonSchema +import org.openapijsonschematools.client.schemas.validation.JsonSchemaInfo +import org.openapijsonschematools.client.schemas.validation.ListSchemaValidator +import org.openapijsonschematools.client.schemas.validation.MapSchemaValidator +import org.openapijsonschematools.client.schemas.validation.NullSchemaValidator +import org.openapijsonschematools.client.schemas.validation.NumberSchemaValidator +import org.openapijsonschematools.client.schemas.validation.PathToSchemasMap +import org.openapijsonschematools.client.schemas.validation.StringSchemaValidator +import org.openapijsonschematools.client.schemas.validation.ValidationMetadata + +class TimeFormat { + // nest classes so all schemas and input/output classes can be public + + + sealed interface TimeFormat1Boxed { + fun getData(): Any? + } + + data class TimeFormat1BoxedVoid(val data: Nothing?) : TimeFormat1Boxed { + override fun getData(): Any? { + return data + } + } + + data class TimeFormat1BoxedBoolean(val data: Boolean): TimeFormat1Boxed { + override fun getData(): Any? { + return data + } + } + + data class TimeFormat1BoxedNumber(val data: Number) : TimeFormat1Boxed { + override fun getData(): Any? { + return data + } + } + + data class TimeFormat1BoxedString(val data: String) : TimeFormat1Boxed { + override fun getData(): Any? { + return data + } + } + + data class TimeFormat1BoxedList(val data: FrozenList) : TimeFormat1Boxed { + override fun getData(): Any? { + return data + } + } + + data class TimeFormat1BoxedMap(val data: FrozenMap) : TimeFormat1Boxed { + override fun getData(): Any? { + return data + } + } + + + class TimeFormat1 private constructor(): JsonSchema( + JsonSchemaInfo() + .format("time") + ), NullSchemaValidator, BooleanSchemaValidator, NumberSchemaValidator, StringSchemaValidator, ListSchemaValidator, TimeFormat1BoxedList>, MapSchemaValidator, TimeFormat1BoxedMap> { + /* + NOTE: This class is auto generated by OpenAPI JSON Schema Generator. + Ref: https://github.com/openapi-json-schema-tools/openapi-json-schema-generator + + Do not edit the class manually. + */ + + companion object { + @Volatile + private var instance: TimeFormat1? = null + + fun getInstance() = + instance ?: synchronized(this) { + instance ?: TimeFormat1().also { instance = it } + } + } + + @Throws(ValidationException::class) + override fun validate(arg: Nothing?, configuration: SchemaConfiguration?): Nothing? { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validatedPathToSchemas = PathToSchemasMap() + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, LinkedHashSet()) + getPathToSchemas(this, castArg, validationMetadata, pathSet) + return castArg + } + + @Throws(ValidationException::class) + override fun validate(arg: Boolean, configuration: SchemaConfiguration?): Boolean { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validatedPathToSchemas = PathToSchemasMap() + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, LinkedHashSet()) + getPathToSchemas(this, castArg, validationMetadata, pathSet) + return castArg + } + + @Throws(ValidationException::class) + override fun validate(arg: Number, configuration: SchemaConfiguration?): Number { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validatedPathToSchemas = PathToSchemasMap() + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, LinkedHashSet()) + getPathToSchemas(this, castArg, validationMetadata, pathSet) + return castArg + } + + @Throws(ValidationException::class) + fun validate(arg: Int, configuration: SchemaConfiguration?): Int { + return validate(arg as Number, configuration) as Int + } + + @Throws(ValidationException::class) + fun validate(arg: Long, configuration: SchemaConfiguration?): Long { + return validate(arg as Number, configuration) as Long + } + + @Throws(ValidationException::class) + fun validate(arg: Float, configuration: SchemaConfiguration?): Float { + return validate(arg as Number, configuration) as Float + } + + @Throws(ValidationException::class) + fun validate(arg: Double, configuration: SchemaConfiguration?): Double { + return validate(arg as Number, configuration) as Double + } + + @Throws(ValidationException::class) + override fun validate(arg: String, configuration: SchemaConfiguration?): String { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validatedPathToSchemas = PathToSchemasMap() + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, LinkedHashSet()) + getPathToSchemas(this, castArg, validationMetadata, pathSet) + return castArg + } + + @Throws(ValidationException::class) + fun validate(arg: LocalDate, configuration: SchemaConfiguration?): String { + return validate(arg.toString(), configuration) + } + + @Throws(ValidationException::class) + fun validate(arg: ZonedDateTime, configuration: SchemaConfiguration?): String { + return validate(arg.toString(), configuration) + } + + @Throws(ValidationException::class) + fun validate(arg: UUID, configuration: SchemaConfiguration?): String { + return validate(arg.toString(), configuration) + } + + override fun getNewInstance(arg: List<*>, pathToItem: List, pathToSchemas: PathToSchemasMap): FrozenList { + val items: MutableList = ArrayList() + var i: Int = 0 + for (item: Any? in arg) { + val itemPathToItem = pathToItem + i + val schemas: LinkedHashMap, Nothing?>? = pathToSchemas.get(itemPathToItem) + if (schemas == null) { + throw RuntimeException("Validation result is invalid, schemas must exist for a pathToItem") + } + val itemSchema: JsonSchema<*> = schemas.entries.iterator().next().key + val itemInstance: Any? = itemSchema.getNewInstance(item, itemPathToItem, pathToSchemas) + items.add(itemInstance) + i += 1 + } + val newInstanceItems: FrozenList = FrozenList(items) + return newInstanceItems + } + + @Throws(ValidationException::class) + override fun validate(arg: List<*>, configuration: SchemaConfiguration?): FrozenList { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, PathToSchemasMap(), LinkedHashSet()) + val pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet) + return getNewInstance(castArg, validationMetadata.pathToItem, pathToSchemasMap) + } + + override fun getNewInstance(arg: Map<*, *>, pathToItem: List, pathToSchemas: PathToSchemasMap): FrozenMap { + val properties: LinkedHashMap = LinkedHashMap() + for((propertyName, value) in arg) { + if (!(propertyName is String)) { + throw RuntimeException("Invalid non-string key value") + } + val propertyPathToItem: List = pathToItem + propertyName + val schemas: LinkedHashMap, Nothing?>? = pathToSchemas.get(propertyPathToItem) + if (schemas == null) { + throw RuntimeException("Validation result is invalid, schemas must exist for a pathToItem") + } + val propertySchema: JsonSchema<*> = schemas.entries.iterator().next().key + val propertyInstance: Any? = propertySchema.getNewInstance(value, propertyPathToItem, pathToSchemas) + properties[propertyName] = propertyInstance + } + val castProperties: FrozenMap = FrozenMap(properties) + return castProperties + } + + @Throws(ValidationException::class) + override fun validate(arg: Map<*, *>, configuration: SchemaConfiguration?): FrozenMap { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validatedPathToSchemas = PathToSchemasMap() + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, LinkedHashSet()) + val pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet) + return getNewInstance(castArg, validationMetadata.pathToItem, pathToSchemasMap) + } + + @Throws(ValidationException::class) + override fun validate(arg: Any?, configuration: SchemaConfiguration?): Any? { + if (arg == null) { + return validate(null, configuration) + } else if (arg is Boolean) { + return validate(arg, configuration) + } else if (arg is Number) { + return validate(arg, configuration) + } else if (arg is String) { + return validate(arg, configuration) + } else if (arg is List<*>) { + return validate(arg, configuration) + } else if (arg is Map<*, *>) { + return validate(arg, configuration) + } + throw ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema") + } + override fun getNewInstance(arg: Any?, pathToItem: List, pathToSchemas: PathToSchemasMap): Any? { + if (arg == null) { + return getNewInstance( null, pathToItem, pathToSchemas) + } else if (arg is Boolean) { + return getNewInstance(arg, pathToItem, pathToSchemas) + } else if (arg is Number) { + return getNewInstance(arg, pathToItem, pathToSchemas) + } else if (arg is String) { + return getNewInstance(arg, pathToItem, pathToSchemas) + } else if (arg is List<*>) { + return getNewInstance(arg, pathToItem, pathToSchemas) + } else if (arg is Map<*, *>) { + return getNewInstance(arg, pathToItem, pathToSchemas) + } + throw RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema") + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: Nothing?, configuration: SchemaConfiguration?): TimeFormat1BoxedVoid { + return TimeFormat1BoxedVoid(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: Boolean, configuration: SchemaConfiguration?): TimeFormat1BoxedBoolean { + return TimeFormat1BoxedBoolean(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: Number, configuration: SchemaConfiguration?): TimeFormat1BoxedNumber { + return TimeFormat1BoxedNumber(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: String, configuration: SchemaConfiguration?): TimeFormat1BoxedString { + return TimeFormat1BoxedString(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: List<*>, configuration: SchemaConfiguration?): TimeFormat1BoxedList { + return TimeFormat1BoxedList(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: Map<*, *>, configuration: SchemaConfiguration?): TimeFormat1BoxedMap { + return TimeFormat1BoxedMap(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: Any?, configuration: SchemaConfiguration?): TimeFormat1Boxed { + if (arg == null) { + return validateAndBox(null, configuration) + } else if (arg is Boolean) { + return validateAndBox(arg, configuration) + } else if (arg is String) { + return validateAndBox(arg, configuration) + } else if (arg is Number) { + return validateAndBox(arg, configuration) + } else if (arg is List<*>) { + return validateAndBox(arg, configuration) + } else if (arg is Map<*, *>) { + return validateAndBox(arg, configuration) + } + throw ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema") + } + } +} diff --git a/samples/client/3_1_0_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/schemas/TypeArrayObjectOrNull.kt b/samples/client/3_1_0_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/schemas/TypeArrayObjectOrNull.kt new file mode 100644 index 00000000000..3c71f597a38 --- /dev/null +++ b/samples/client/3_1_0_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/schemas/TypeArrayObjectOrNull.kt @@ -0,0 +1,186 @@ +package org.openapijsonschematools.client.components.schemas +import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags +import org.openapijsonschematools.client.configurations.SchemaConfiguration +import org.openapijsonschematools.client.exceptions.InvalidAdditionalPropertyException +import org.openapijsonschematools.client.exceptions.UnsetPropertyException +import org.openapijsonschematools.client.exceptions.ValidationException +import org.openapijsonschematools.client.schemas.UnsetAddPropsSetter +import org.openapijsonschematools.client.schemas.validation.FrozenList +import org.openapijsonschematools.client.schemas.validation.FrozenMap +import org.openapijsonschematools.client.schemas.validation.JsonSchema +import org.openapijsonschematools.client.schemas.validation.JsonSchemaInfo +import org.openapijsonschematools.client.schemas.validation.ListSchemaValidator +import org.openapijsonschematools.client.schemas.validation.MapSchemaValidator +import org.openapijsonschematools.client.schemas.validation.NullSchemaValidator +import org.openapijsonschematools.client.schemas.validation.PathToSchemasMap +import org.openapijsonschematools.client.schemas.validation.ValidationMetadata + +class TypeArrayObjectOrNull { + // nest classes so all schemas and input/output classes can be public + + + sealed interface TypeArrayObjectOrNull1Boxed { + fun getData(): Any? + } + + data class TypeArrayObjectOrNull1BoxedList(val data: FrozenList) : TypeArrayObjectOrNull1Boxed { + override fun getData(): Any? { + return data + } + } + + data class TypeArrayObjectOrNull1BoxedMap(val data: FrozenMap) : TypeArrayObjectOrNull1Boxed { + override fun getData(): Any? { + return data + } + } + data class TypeArrayObjectOrNull1BoxedVoid(val data: Nothing?) : TypeArrayObjectOrNull1Boxed { + override fun getData(): Any? { + return data + } + } + + + + class TypeArrayObjectOrNull1 private constructor(): JsonSchema( + JsonSchemaInfo() + .type(setOf( + List::class.java, + Map::class.java, + Void::class.java + )) + ), ListSchemaValidator, TypeArrayObjectOrNull1BoxedList>, MapSchemaValidator, TypeArrayObjectOrNull1BoxedMap>, NullSchemaValidator { + /* + NOTE: This class is auto generated by OpenAPI JSON Schema Generator. + Ref: https://github.com/openapi-json-schema-tools/openapi-json-schema-generator + + Do not edit the class manually. + */ + + companion object { + @Volatile + private var instance: TypeArrayObjectOrNull1? = null + + fun getInstance() = + instance ?: synchronized(this) { + instance ?: TypeArrayObjectOrNull1().also { instance = it } + } + } + + override fun getNewInstance(arg: List<*>, pathToItem: List, pathToSchemas: PathToSchemasMap): FrozenList { + val items: MutableList = ArrayList() + var i: Int = 0 + for (item: Any? in arg) { + val itemPathToItem: List = pathToItem + i + val schemas: LinkedHashMap, Nothing?>? = pathToSchemas.get(itemPathToItem) + if (schemas == null) { + throw RuntimeException("Validation result is invalid, schemas must exist for a pathToItem") + } + val itemSchema: JsonSchema<*> = schemas.entries.iterator().next().key + val itemInstance: Any? = itemSchema.getNewInstance(item, itemPathToItem, pathToSchemas) + items.add(itemInstance) + i += 1 + } + val newInstanceItems: FrozenList = FrozenList(items) + return newInstanceItems + } + + @Throws(ValidationException::class) + override fun validate(arg: List<*>, configuration: SchemaConfiguration?): FrozenList { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, PathToSchemasMap(), LinkedHashSet()) + val pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet) + return getNewInstance(castArg, validationMetadata.pathToItem, pathToSchemasMap) + } + + override fun getNewInstance(arg: Map<*, *>, pathToItem: List, pathToSchemas: PathToSchemasMap): FrozenMap { + val properties: LinkedHashMap = LinkedHashMap() + for((entryKey, value) in arg) { + if (!(entryKey is String)) { + throw RuntimeException("Invalid non-string key value") + } + val propertyPathToItem: List = pathToItem + entryKey + val schemas: LinkedHashMap, Nothing?>? = pathToSchemas.get(propertyPathToItem) + if (schemas == null) { + throw RuntimeException("Validation result is invalid, schemas must exist for a pathToItem") + } + val propertySchema: JsonSchema<*> = schemas.entries.iterator().next().key + val propertyInstance: Any? = propertySchema.getNewInstance(value, propertyPathToItem, pathToSchemas) + properties[entryKey] = propertyInstance + } + val castProperties: FrozenMap = FrozenMap(properties) + return castProperties + } + + @Throws(ValidationException::class) + override fun validate(arg: Map<*, *>, configuration: SchemaConfiguration?): FrozenMap { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, PathToSchemasMap(), LinkedHashSet()) + val pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet) + return getNewInstance(castArg, validationMetadata.pathToItem, pathToSchemasMap) + } + + + @Throws(ValidationException::class) + override fun validate(arg: Nothing?, configuration: SchemaConfiguration?): Nothing? { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, PathToSchemasMap(), LinkedHashSet()) + getPathToSchemas(this, castArg, validationMetadata, pathSet) + return castArg + } + + @Throws(ValidationException::class) + override fun validate(arg: Any?, configuration: SchemaConfiguration?): Any? { + if (arg is List<*>) { + return validate(arg, configuration) + } else if (arg is Map<*, *>) { + return validate(arg, configuration) + } else if (arg == null) { + return validate(null, configuration) + } + throw ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema") + } + override fun getNewInstance(arg: Any?, pathToItem: List, pathToSchemas: PathToSchemasMap): Any? { + if (arg is List<*>) { + return getNewInstance(arg, pathToItem, pathToSchemas) + } else if (arg is Map<*, *>) { + return getNewInstance(arg, pathToItem, pathToSchemas) + } else if (arg == null) { + return getNewInstance(null, pathToItem, pathToSchemas) + } + throw RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema") + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: List<*>, configuration: SchemaConfiguration?): TypeArrayObjectOrNull1BoxedList { + return TypeArrayObjectOrNull1BoxedList(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: Map<*, *>, configuration: SchemaConfiguration?): TypeArrayObjectOrNull1BoxedMap { + return TypeArrayObjectOrNull1BoxedMap(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: Nothing?, configuration: SchemaConfiguration?): TypeArrayObjectOrNull1BoxedVoid { + return TypeArrayObjectOrNull1BoxedVoid(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: Any?, configuration: SchemaConfiguration?): TypeArrayObjectOrNull1Boxed { + if (arg is List<*>) { + return validateAndBox(arg, configuration) + } else if (arg is Map<*, *>) { + return validateAndBox(arg, configuration) + } else if (arg == null) { + return validateAndBox(arg, configuration) + } + throw ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema") + } + } +} diff --git a/samples/client/3_1_0_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/schemas/TypeArrayOrObject.kt b/samples/client/3_1_0_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/schemas/TypeArrayOrObject.kt new file mode 100644 index 00000000000..2b051917725 --- /dev/null +++ b/samples/client/3_1_0_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/schemas/TypeArrayOrObject.kt @@ -0,0 +1,157 @@ +package org.openapijsonschematools.client.components.schemas +import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags +import org.openapijsonschematools.client.configurations.SchemaConfiguration +import org.openapijsonschematools.client.exceptions.InvalidAdditionalPropertyException +import org.openapijsonschematools.client.exceptions.UnsetPropertyException +import org.openapijsonschematools.client.exceptions.ValidationException +import org.openapijsonschematools.client.schemas.UnsetAddPropsSetter +import org.openapijsonschematools.client.schemas.validation.FrozenList +import org.openapijsonschematools.client.schemas.validation.FrozenMap +import org.openapijsonschematools.client.schemas.validation.JsonSchema +import org.openapijsonschematools.client.schemas.validation.JsonSchemaInfo +import org.openapijsonschematools.client.schemas.validation.ListSchemaValidator +import org.openapijsonschematools.client.schemas.validation.MapSchemaValidator +import org.openapijsonschematools.client.schemas.validation.PathToSchemasMap +import org.openapijsonschematools.client.schemas.validation.ValidationMetadata + +class TypeArrayOrObject { + // nest classes so all schemas and input/output classes can be public + + + sealed interface TypeArrayOrObject1Boxed { + fun getData(): Any? + } + + data class TypeArrayOrObject1BoxedList(val data: FrozenList) : TypeArrayOrObject1Boxed { + override fun getData(): Any? { + return data + } + } + + data class TypeArrayOrObject1BoxedMap(val data: FrozenMap) : TypeArrayOrObject1Boxed { + override fun getData(): Any? { + return data + } + } + + + class TypeArrayOrObject1 private constructor(): JsonSchema( + JsonSchemaInfo() + .type(setOf( + List::class.java, + Map::class.java + )) + ), ListSchemaValidator, TypeArrayOrObject1BoxedList>, MapSchemaValidator, TypeArrayOrObject1BoxedMap> { + /* + NOTE: This class is auto generated by OpenAPI JSON Schema Generator. + Ref: https://github.com/openapi-json-schema-tools/openapi-json-schema-generator + + Do not edit the class manually. + */ + + companion object { + @Volatile + private var instance: TypeArrayOrObject1? = null + + fun getInstance() = + instance ?: synchronized(this) { + instance ?: TypeArrayOrObject1().also { instance = it } + } + } + + override fun getNewInstance(arg: List<*>, pathToItem: List, pathToSchemas: PathToSchemasMap): FrozenList { + val items: MutableList = ArrayList() + var i: Int = 0 + for (item: Any? in arg) { + val itemPathToItem: List = pathToItem + i + val schemas: LinkedHashMap, Nothing?>? = pathToSchemas.get(itemPathToItem) + if (schemas == null) { + throw RuntimeException("Validation result is invalid, schemas must exist for a pathToItem") + } + val itemSchema: JsonSchema<*> = schemas.entries.iterator().next().key + val itemInstance: Any? = itemSchema.getNewInstance(item, itemPathToItem, pathToSchemas) + items.add(itemInstance) + i += 1 + } + val newInstanceItems: FrozenList = FrozenList(items) + return newInstanceItems + } + + @Throws(ValidationException::class) + override fun validate(arg: List<*>, configuration: SchemaConfiguration?): FrozenList { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, PathToSchemasMap(), LinkedHashSet()) + val pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet) + return getNewInstance(castArg, validationMetadata.pathToItem, pathToSchemasMap) + } + + override fun getNewInstance(arg: Map<*, *>, pathToItem: List, pathToSchemas: PathToSchemasMap): FrozenMap { + val properties: LinkedHashMap = LinkedHashMap() + for((entryKey, value) in arg) { + if (!(entryKey is String)) { + throw RuntimeException("Invalid non-string key value") + } + val propertyPathToItem: List = pathToItem + entryKey + val schemas: LinkedHashMap, Nothing?>? = pathToSchemas.get(propertyPathToItem) + if (schemas == null) { + throw RuntimeException("Validation result is invalid, schemas must exist for a pathToItem") + } + val propertySchema: JsonSchema<*> = schemas.entries.iterator().next().key + val propertyInstance: Any? = propertySchema.getNewInstance(value, propertyPathToItem, pathToSchemas) + properties[entryKey] = propertyInstance + } + val castProperties: FrozenMap = FrozenMap(properties) + return castProperties + } + + @Throws(ValidationException::class) + override fun validate(arg: Map<*, *>, configuration: SchemaConfiguration?): FrozenMap { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, PathToSchemasMap(), LinkedHashSet()) + val pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet) + return getNewInstance(castArg, validationMetadata.pathToItem, pathToSchemasMap) + } + + + @Throws(ValidationException::class) + override fun validate(arg: Any?, configuration: SchemaConfiguration?): Any? { + if (arg is List<*>) { + return validate(arg, configuration) + } else if (arg is Map<*, *>) { + return validate(arg, configuration) + } + throw ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema") + } + override fun getNewInstance(arg: Any?, pathToItem: List, pathToSchemas: PathToSchemasMap): Any? { + if (arg is List<*>) { + return getNewInstance(arg, pathToItem, pathToSchemas) + } else if (arg is Map<*, *>) { + return getNewInstance(arg, pathToItem, pathToSchemas) + } + throw RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema") + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: List<*>, configuration: SchemaConfiguration?): TypeArrayOrObject1BoxedList { + return TypeArrayOrObject1BoxedList(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: Map<*, *>, configuration: SchemaConfiguration?): TypeArrayOrObject1BoxedMap { + return TypeArrayOrObject1BoxedMap(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: Any?, configuration: SchemaConfiguration?): TypeArrayOrObject1Boxed { + if (arg is List<*>) { + return validateAndBox(arg, configuration) + } else if (arg is Map<*, *>) { + return validateAndBox(arg, configuration) + } + throw ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema") + } + } +} diff --git a/samples/client/3_1_0_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/schemas/TypeAsArrayWithOneItem.kt b/samples/client/3_1_0_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/schemas/TypeAsArrayWithOneItem.kt new file mode 100644 index 00000000000..ff1319c4723 --- /dev/null +++ b/samples/client/3_1_0_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/schemas/TypeAsArrayWithOneItem.kt @@ -0,0 +1,20 @@ +package org.openapijsonschematools.client.components.schemas +import org.openapijsonschematools.client.schemas.StringJsonSchema + +class TypeAsArrayWithOneItem: StringJsonSchema() { + // nest classes so all schemas and input/output classes can be public + + + class TypeAsArrayWithOneItem1 : StringJsonSchema.StringJsonSchema1() { + companion object { + @Volatile + private var instance: TypeAsArrayWithOneItem1? = null + + fun getInstance() = + instance ?: synchronized(this) { + instance ?: TypeAsArrayWithOneItem1().also { instance = it } + } + } + } + +} diff --git a/samples/client/3_1_0_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/schemas/UnevaluateditemsAsSchema.kt b/samples/client/3_1_0_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/schemas/UnevaluateditemsAsSchema.kt new file mode 100644 index 00000000000..fc183187285 --- /dev/null +++ b/samples/client/3_1_0_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/schemas/UnevaluateditemsAsSchema.kt @@ -0,0 +1,322 @@ +package org.openapijsonschematools.client.components.schemas +import java.time.LocalDate +import java.time.ZonedDateTime +import java.util.UUID +import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags +import org.openapijsonschematools.client.configurations.SchemaConfiguration +import org.openapijsonschematools.client.exceptions.InvalidAdditionalPropertyException +import org.openapijsonschematools.client.exceptions.UnsetPropertyException +import org.openapijsonschematools.client.exceptions.ValidationException +import org.openapijsonschematools.client.schemas.StringJsonSchema +import org.openapijsonschematools.client.schemas.UnsetAddPropsSetter +import org.openapijsonschematools.client.schemas.validation.BooleanSchemaValidator +import org.openapijsonschematools.client.schemas.validation.FrozenList +import org.openapijsonschematools.client.schemas.validation.FrozenMap +import org.openapijsonschematools.client.schemas.validation.JsonSchema +import org.openapijsonschematools.client.schemas.validation.JsonSchemaInfo +import org.openapijsonschematools.client.schemas.validation.ListSchemaValidator +import org.openapijsonschematools.client.schemas.validation.MapSchemaValidator +import org.openapijsonschematools.client.schemas.validation.NullSchemaValidator +import org.openapijsonschematools.client.schemas.validation.NumberSchemaValidator +import org.openapijsonschematools.client.schemas.validation.PathToSchemasMap +import org.openapijsonschematools.client.schemas.validation.StringSchemaValidator +import org.openapijsonschematools.client.schemas.validation.ValidationMetadata + +class UnevaluateditemsAsSchema { + // nest classes so all schemas and input/output classes can be public + + + class UnevaluatedItems : StringJsonSchema.StringJsonSchema1() { + companion object { + @Volatile + private var instance: UnevaluatedItems? = null + + fun getInstance() = + instance ?: synchronized(this) { + instance ?: UnevaluatedItems().also { instance = it } + } + } + } + + + sealed interface UnevaluateditemsAsSchema1Boxed { + fun getData(): Any? + } + + data class UnevaluateditemsAsSchema1BoxedVoid(val data: Nothing?) : UnevaluateditemsAsSchema1Boxed { + override fun getData(): Any? { + return data + } + } + + data class UnevaluateditemsAsSchema1BoxedBoolean(val data: Boolean): UnevaluateditemsAsSchema1Boxed { + override fun getData(): Any? { + return data + } + } + + data class UnevaluateditemsAsSchema1BoxedNumber(val data: Number) : UnevaluateditemsAsSchema1Boxed { + override fun getData(): Any? { + return data + } + } + + data class UnevaluateditemsAsSchema1BoxedString(val data: String) : UnevaluateditemsAsSchema1Boxed { + override fun getData(): Any? { + return data + } + } + + data class UnevaluateditemsAsSchema1BoxedList(val data: FrozenList) : UnevaluateditemsAsSchema1Boxed { + override fun getData(): Any? { + return data + } + } + + data class UnevaluateditemsAsSchema1BoxedMap(val data: FrozenMap) : UnevaluateditemsAsSchema1Boxed { + override fun getData(): Any? { + return data + } + } + + + class UnevaluateditemsAsSchema1 private constructor(): JsonSchema( + JsonSchemaInfo() + .unevaluatedItems(UnevaluatedItems::class.java) + ), NullSchemaValidator, BooleanSchemaValidator, NumberSchemaValidator, StringSchemaValidator, ListSchemaValidator, UnevaluateditemsAsSchema1BoxedList>, MapSchemaValidator, UnevaluateditemsAsSchema1BoxedMap> { + /* + NOTE: This class is auto generated by OpenAPI JSON Schema Generator. + Ref: https://github.com/openapi-json-schema-tools/openapi-json-schema-generator + + Do not edit the class manually. + */ + + companion object { + @Volatile + private var instance: UnevaluateditemsAsSchema1? = null + + fun getInstance() = + instance ?: synchronized(this) { + instance ?: UnevaluateditemsAsSchema1().also { instance = it } + } + } + + @Throws(ValidationException::class) + override fun validate(arg: Nothing?, configuration: SchemaConfiguration?): Nothing? { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validatedPathToSchemas = PathToSchemasMap() + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, LinkedHashSet()) + getPathToSchemas(this, castArg, validationMetadata, pathSet) + return castArg + } + + @Throws(ValidationException::class) + override fun validate(arg: Boolean, configuration: SchemaConfiguration?): Boolean { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validatedPathToSchemas = PathToSchemasMap() + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, LinkedHashSet()) + getPathToSchemas(this, castArg, validationMetadata, pathSet) + return castArg + } + + @Throws(ValidationException::class) + override fun validate(arg: Number, configuration: SchemaConfiguration?): Number { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validatedPathToSchemas = PathToSchemasMap() + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, LinkedHashSet()) + getPathToSchemas(this, castArg, validationMetadata, pathSet) + return castArg + } + + @Throws(ValidationException::class) + fun validate(arg: Int, configuration: SchemaConfiguration?): Int { + return validate(arg as Number, configuration) as Int + } + + @Throws(ValidationException::class) + fun validate(arg: Long, configuration: SchemaConfiguration?): Long { + return validate(arg as Number, configuration) as Long + } + + @Throws(ValidationException::class) + fun validate(arg: Float, configuration: SchemaConfiguration?): Float { + return validate(arg as Number, configuration) as Float + } + + @Throws(ValidationException::class) + fun validate(arg: Double, configuration: SchemaConfiguration?): Double { + return validate(arg as Number, configuration) as Double + } + + @Throws(ValidationException::class) + override fun validate(arg: String, configuration: SchemaConfiguration?): String { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validatedPathToSchemas = PathToSchemasMap() + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, LinkedHashSet()) + getPathToSchemas(this, castArg, validationMetadata, pathSet) + return castArg + } + + @Throws(ValidationException::class) + fun validate(arg: LocalDate, configuration: SchemaConfiguration?): String { + return validate(arg.toString(), configuration) + } + + @Throws(ValidationException::class) + fun validate(arg: ZonedDateTime, configuration: SchemaConfiguration?): String { + return validate(arg.toString(), configuration) + } + + @Throws(ValidationException::class) + fun validate(arg: UUID, configuration: SchemaConfiguration?): String { + return validate(arg.toString(), configuration) + } + + override fun getNewInstance(arg: List<*>, pathToItem: List, pathToSchemas: PathToSchemasMap): FrozenList { + val items: MutableList = ArrayList() + var i: Int = 0 + for (item: Any? in arg) { + val itemPathToItem = pathToItem + i + val schemas: LinkedHashMap, Nothing?>? = pathToSchemas.get(itemPathToItem) + if (schemas == null) { + throw RuntimeException("Validation result is invalid, schemas must exist for a pathToItem") + } + val itemSchema: JsonSchema<*> = schemas.entries.iterator().next().key + val itemInstance: Any? = itemSchema.getNewInstance(item, itemPathToItem, pathToSchemas) + items.add(itemInstance) + i += 1 + } + val newInstanceItems: FrozenList = FrozenList(items) + return newInstanceItems + } + + @Throws(ValidationException::class) + override fun validate(arg: List<*>, configuration: SchemaConfiguration?): FrozenList { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, PathToSchemasMap(), LinkedHashSet()) + val pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet) + return getNewInstance(castArg, validationMetadata.pathToItem, pathToSchemasMap) + } + + override fun getNewInstance(arg: Map<*, *>, pathToItem: List, pathToSchemas: PathToSchemasMap): FrozenMap { + val properties: LinkedHashMap = LinkedHashMap() + for((propertyName, value) in arg) { + if (!(propertyName is String)) { + throw RuntimeException("Invalid non-string key value") + } + val propertyPathToItem: List = pathToItem + propertyName + val schemas: LinkedHashMap, Nothing?>? = pathToSchemas.get(propertyPathToItem) + if (schemas == null) { + throw RuntimeException("Validation result is invalid, schemas must exist for a pathToItem") + } + val propertySchema: JsonSchema<*> = schemas.entries.iterator().next().key + val propertyInstance: Any? = propertySchema.getNewInstance(value, propertyPathToItem, pathToSchemas) + properties[propertyName] = propertyInstance + } + val castProperties: FrozenMap = FrozenMap(properties) + return castProperties + } + + @Throws(ValidationException::class) + override fun validate(arg: Map<*, *>, configuration: SchemaConfiguration?): FrozenMap { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validatedPathToSchemas = PathToSchemasMap() + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, LinkedHashSet()) + val pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet) + return getNewInstance(castArg, validationMetadata.pathToItem, pathToSchemasMap) + } + + @Throws(ValidationException::class) + override fun validate(arg: Any?, configuration: SchemaConfiguration?): Any? { + if (arg == null) { + return validate(null, configuration) + } else if (arg is Boolean) { + return validate(arg, configuration) + } else if (arg is Number) { + return validate(arg, configuration) + } else if (arg is String) { + return validate(arg, configuration) + } else if (arg is List<*>) { + return validate(arg, configuration) + } else if (arg is Map<*, *>) { + return validate(arg, configuration) + } + throw ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema") + } + override fun getNewInstance(arg: Any?, pathToItem: List, pathToSchemas: PathToSchemasMap): Any? { + if (arg == null) { + return getNewInstance( null, pathToItem, pathToSchemas) + } else if (arg is Boolean) { + return getNewInstance(arg, pathToItem, pathToSchemas) + } else if (arg is Number) { + return getNewInstance(arg, pathToItem, pathToSchemas) + } else if (arg is String) { + return getNewInstance(arg, pathToItem, pathToSchemas) + } else if (arg is List<*>) { + return getNewInstance(arg, pathToItem, pathToSchemas) + } else if (arg is Map<*, *>) { + return getNewInstance(arg, pathToItem, pathToSchemas) + } + throw RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema") + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: Nothing?, configuration: SchemaConfiguration?): UnevaluateditemsAsSchema1BoxedVoid { + return UnevaluateditemsAsSchema1BoxedVoid(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: Boolean, configuration: SchemaConfiguration?): UnevaluateditemsAsSchema1BoxedBoolean { + return UnevaluateditemsAsSchema1BoxedBoolean(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: Number, configuration: SchemaConfiguration?): UnevaluateditemsAsSchema1BoxedNumber { + return UnevaluateditemsAsSchema1BoxedNumber(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: String, configuration: SchemaConfiguration?): UnevaluateditemsAsSchema1BoxedString { + return UnevaluateditemsAsSchema1BoxedString(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: List<*>, configuration: SchemaConfiguration?): UnevaluateditemsAsSchema1BoxedList { + return UnevaluateditemsAsSchema1BoxedList(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: Map<*, *>, configuration: SchemaConfiguration?): UnevaluateditemsAsSchema1BoxedMap { + return UnevaluateditemsAsSchema1BoxedMap(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: Any?, configuration: SchemaConfiguration?): UnevaluateditemsAsSchema1Boxed { + if (arg == null) { + return validateAndBox(null, configuration) + } else if (arg is Boolean) { + return validateAndBox(arg, configuration) + } else if (arg is String) { + return validateAndBox(arg, configuration) + } else if (arg is Number) { + return validateAndBox(arg, configuration) + } else if (arg is List<*>) { + return validateAndBox(arg, configuration) + } else if (arg is Map<*, *>) { + return validateAndBox(arg, configuration) + } + throw ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema") + } + } +} diff --git a/samples/client/3_1_0_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/schemas/UnevaluateditemsDependsOnMultipleNestedContains.kt b/samples/client/3_1_0_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/schemas/UnevaluateditemsDependsOnMultipleNestedContains.kt new file mode 100644 index 00000000000..2d3adc3a8cc --- /dev/null +++ b/samples/client/3_1_0_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/schemas/UnevaluateditemsDependsOnMultipleNestedContains.kt @@ -0,0 +1,1688 @@ +package org.openapijsonschematools.client.components.schemas +import java.math.BigDecimal +import java.time.LocalDate +import java.time.ZonedDateTime +import java.util.UUID +import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags +import org.openapijsonschematools.client.configurations.SchemaConfiguration +import org.openapijsonschematools.client.exceptions.InvalidAdditionalPropertyException +import org.openapijsonschematools.client.exceptions.UnsetPropertyException +import org.openapijsonschematools.client.exceptions.ValidationException +import org.openapijsonschematools.client.schemas.UnsetAddPropsSetter +import org.openapijsonschematools.client.schemas.validation.BooleanSchemaValidator +import org.openapijsonschematools.client.schemas.validation.FrozenList +import org.openapijsonschematools.client.schemas.validation.FrozenMap +import org.openapijsonschematools.client.schemas.validation.JsonSchema +import org.openapijsonschematools.client.schemas.validation.JsonSchemaInfo +import org.openapijsonschematools.client.schemas.validation.ListSchemaValidator +import org.openapijsonschematools.client.schemas.validation.MapSchemaValidator +import org.openapijsonschematools.client.schemas.validation.NullSchemaValidator +import org.openapijsonschematools.client.schemas.validation.NumberSchemaValidator +import org.openapijsonschematools.client.schemas.validation.PathToSchemasMap +import org.openapijsonschematools.client.schemas.validation.StringSchemaValidator +import org.openapijsonschematools.client.schemas.validation.ValidationMetadata + +class UnevaluateditemsDependsOnMultipleNestedContains { + // nest classes so all schemas and input/output classes can be public + + + sealed interface ContainsBoxed { + fun getData(): Any? + } + + data class ContainsBoxedVoid(val data: Nothing?) : ContainsBoxed { + override fun getData(): Any? { + return data + } + } + + data class ContainsBoxedBoolean(val data: Boolean): ContainsBoxed { + override fun getData(): Any? { + return data + } + } + + data class ContainsBoxedNumber(val data: Number) : ContainsBoxed { + override fun getData(): Any? { + return data + } + } + + data class ContainsBoxedString(val data: String) : ContainsBoxed { + override fun getData(): Any? { + return data + } + } + + data class ContainsBoxedList(val data: FrozenList) : ContainsBoxed { + override fun getData(): Any? { + return data + } + } + + data class ContainsBoxedMap(val data: FrozenMap) : ContainsBoxed { + override fun getData(): Any? { + return data + } + } + + + class Contains private constructor(): JsonSchema( + JsonSchemaInfo() + .multipleOf(BigDecimal("2")) + ), NullSchemaValidator, BooleanSchemaValidator, NumberSchemaValidator, StringSchemaValidator, ListSchemaValidator, ContainsBoxedList>, MapSchemaValidator, ContainsBoxedMap> { + + companion object { + @Volatile + private var instance: Contains? = null + + fun getInstance() = + instance ?: synchronized(this) { + instance ?: Contains().also { instance = it } + } + } + + @Throws(ValidationException::class) + override fun validate(arg: Nothing?, configuration: SchemaConfiguration?): Nothing? { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validatedPathToSchemas = PathToSchemasMap() + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, LinkedHashSet()) + getPathToSchemas(this, castArg, validationMetadata, pathSet) + return castArg + } + + @Throws(ValidationException::class) + override fun validate(arg: Boolean, configuration: SchemaConfiguration?): Boolean { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validatedPathToSchemas = PathToSchemasMap() + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, LinkedHashSet()) + getPathToSchemas(this, castArg, validationMetadata, pathSet) + return castArg + } + + @Throws(ValidationException::class) + override fun validate(arg: Number, configuration: SchemaConfiguration?): Number { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validatedPathToSchemas = PathToSchemasMap() + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, LinkedHashSet()) + getPathToSchemas(this, castArg, validationMetadata, pathSet) + return castArg + } + + @Throws(ValidationException::class) + fun validate(arg: Int, configuration: SchemaConfiguration?): Int { + return validate(arg as Number, configuration) as Int + } + + @Throws(ValidationException::class) + fun validate(arg: Long, configuration: SchemaConfiguration?): Long { + return validate(arg as Number, configuration) as Long + } + + @Throws(ValidationException::class) + fun validate(arg: Float, configuration: SchemaConfiguration?): Float { + return validate(arg as Number, configuration) as Float + } + + @Throws(ValidationException::class) + fun validate(arg: Double, configuration: SchemaConfiguration?): Double { + return validate(arg as Number, configuration) as Double + } + + @Throws(ValidationException::class) + override fun validate(arg: String, configuration: SchemaConfiguration?): String { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validatedPathToSchemas = PathToSchemasMap() + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, LinkedHashSet()) + getPathToSchemas(this, castArg, validationMetadata, pathSet) + return castArg + } + + @Throws(ValidationException::class) + fun validate(arg: LocalDate, configuration: SchemaConfiguration?): String { + return validate(arg.toString(), configuration) + } + + @Throws(ValidationException::class) + fun validate(arg: ZonedDateTime, configuration: SchemaConfiguration?): String { + return validate(arg.toString(), configuration) + } + + @Throws(ValidationException::class) + fun validate(arg: UUID, configuration: SchemaConfiguration?): String { + return validate(arg.toString(), configuration) + } + + override fun getNewInstance(arg: List<*>, pathToItem: List, pathToSchemas: PathToSchemasMap): FrozenList { + val items: MutableList = ArrayList() + var i: Int = 0 + for (item: Any? in arg) { + val itemPathToItem = pathToItem + i + val schemas: LinkedHashMap, Nothing?>? = pathToSchemas.get(itemPathToItem) + if (schemas == null) { + throw RuntimeException("Validation result is invalid, schemas must exist for a pathToItem") + } + val itemSchema: JsonSchema<*> = schemas.entries.iterator().next().key + val itemInstance: Any? = itemSchema.getNewInstance(item, itemPathToItem, pathToSchemas) + items.add(itemInstance) + i += 1 + } + val newInstanceItems: FrozenList = FrozenList(items) + return newInstanceItems + } + + @Throws(ValidationException::class) + override fun validate(arg: List<*>, configuration: SchemaConfiguration?): FrozenList { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, PathToSchemasMap(), LinkedHashSet()) + val pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet) + return getNewInstance(castArg, validationMetadata.pathToItem, pathToSchemasMap) + } + + override fun getNewInstance(arg: Map<*, *>, pathToItem: List, pathToSchemas: PathToSchemasMap): FrozenMap { + val properties: LinkedHashMap = LinkedHashMap() + for((propertyName, value) in arg) { + if (!(propertyName is String)) { + throw RuntimeException("Invalid non-string key value") + } + val propertyPathToItem: List = pathToItem + propertyName + val schemas: LinkedHashMap, Nothing?>? = pathToSchemas.get(propertyPathToItem) + if (schemas == null) { + throw RuntimeException("Validation result is invalid, schemas must exist for a pathToItem") + } + val propertySchema: JsonSchema<*> = schemas.entries.iterator().next().key + val propertyInstance: Any? = propertySchema.getNewInstance(value, propertyPathToItem, pathToSchemas) + properties[propertyName] = propertyInstance + } + val castProperties: FrozenMap = FrozenMap(properties) + return castProperties + } + + @Throws(ValidationException::class) + override fun validate(arg: Map<*, *>, configuration: SchemaConfiguration?): FrozenMap { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validatedPathToSchemas = PathToSchemasMap() + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, LinkedHashSet()) + val pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet) + return getNewInstance(castArg, validationMetadata.pathToItem, pathToSchemasMap) + } + + @Throws(ValidationException::class) + override fun validate(arg: Any?, configuration: SchemaConfiguration?): Any? { + if (arg == null) { + return validate(null, configuration) + } else if (arg is Boolean) { + return validate(arg, configuration) + } else if (arg is Number) { + return validate(arg, configuration) + } else if (arg is String) { + return validate(arg, configuration) + } else if (arg is List<*>) { + return validate(arg, configuration) + } else if (arg is Map<*, *>) { + return validate(arg, configuration) + } + throw ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema") + } + override fun getNewInstance(arg: Any?, pathToItem: List, pathToSchemas: PathToSchemasMap): Any? { + if (arg == null) { + return getNewInstance( null, pathToItem, pathToSchemas) + } else if (arg is Boolean) { + return getNewInstance(arg, pathToItem, pathToSchemas) + } else if (arg is Number) { + return getNewInstance(arg, pathToItem, pathToSchemas) + } else if (arg is String) { + return getNewInstance(arg, pathToItem, pathToSchemas) + } else if (arg is List<*>) { + return getNewInstance(arg, pathToItem, pathToSchemas) + } else if (arg is Map<*, *>) { + return getNewInstance(arg, pathToItem, pathToSchemas) + } + throw RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema") + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: Nothing?, configuration: SchemaConfiguration?): ContainsBoxedVoid { + return ContainsBoxedVoid(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: Boolean, configuration: SchemaConfiguration?): ContainsBoxedBoolean { + return ContainsBoxedBoolean(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: Number, configuration: SchemaConfiguration?): ContainsBoxedNumber { + return ContainsBoxedNumber(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: String, configuration: SchemaConfiguration?): ContainsBoxedString { + return ContainsBoxedString(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: List<*>, configuration: SchemaConfiguration?): ContainsBoxedList { + return ContainsBoxedList(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: Map<*, *>, configuration: SchemaConfiguration?): ContainsBoxedMap { + return ContainsBoxedMap(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: Any?, configuration: SchemaConfiguration?): ContainsBoxed { + if (arg == null) { + return validateAndBox(null, configuration) + } else if (arg is Boolean) { + return validateAndBox(arg, configuration) + } else if (arg is String) { + return validateAndBox(arg, configuration) + } else if (arg is Number) { + return validateAndBox(arg, configuration) + } else if (arg is List<*>) { + return validateAndBox(arg, configuration) + } else if (arg is Map<*, *>) { + return validateAndBox(arg, configuration) + } + throw ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema") + } + } + + sealed interface Schema0Boxed { + fun getData(): Any? + } + + data class Schema0BoxedVoid(val data: Nothing?) : Schema0Boxed { + override fun getData(): Any? { + return data + } + } + + data class Schema0BoxedBoolean(val data: Boolean): Schema0Boxed { + override fun getData(): Any? { + return data + } + } + + data class Schema0BoxedNumber(val data: Number) : Schema0Boxed { + override fun getData(): Any? { + return data + } + } + + data class Schema0BoxedString(val data: String) : Schema0Boxed { + override fun getData(): Any? { + return data + } + } + + data class Schema0BoxedList(val data: FrozenList) : Schema0Boxed { + override fun getData(): Any? { + return data + } + } + + data class Schema0BoxedMap(val data: FrozenMap) : Schema0Boxed { + override fun getData(): Any? { + return data + } + } + + + class Schema0 private constructor(): JsonSchema( + JsonSchemaInfo() + .contains(Contains::class.java) + ), NullSchemaValidator, BooleanSchemaValidator, NumberSchemaValidator, StringSchemaValidator, ListSchemaValidator, Schema0BoxedList>, MapSchemaValidator, Schema0BoxedMap> { + + companion object { + @Volatile + private var instance: Schema0? = null + + fun getInstance() = + instance ?: synchronized(this) { + instance ?: Schema0().also { instance = it } + } + } + + @Throws(ValidationException::class) + override fun validate(arg: Nothing?, configuration: SchemaConfiguration?): Nothing? { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validatedPathToSchemas = PathToSchemasMap() + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, LinkedHashSet()) + getPathToSchemas(this, castArg, validationMetadata, pathSet) + return castArg + } + + @Throws(ValidationException::class) + override fun validate(arg: Boolean, configuration: SchemaConfiguration?): Boolean { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validatedPathToSchemas = PathToSchemasMap() + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, LinkedHashSet()) + getPathToSchemas(this, castArg, validationMetadata, pathSet) + return castArg + } + + @Throws(ValidationException::class) + override fun validate(arg: Number, configuration: SchemaConfiguration?): Number { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validatedPathToSchemas = PathToSchemasMap() + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, LinkedHashSet()) + getPathToSchemas(this, castArg, validationMetadata, pathSet) + return castArg + } + + @Throws(ValidationException::class) + fun validate(arg: Int, configuration: SchemaConfiguration?): Int { + return validate(arg as Number, configuration) as Int + } + + @Throws(ValidationException::class) + fun validate(arg: Long, configuration: SchemaConfiguration?): Long { + return validate(arg as Number, configuration) as Long + } + + @Throws(ValidationException::class) + fun validate(arg: Float, configuration: SchemaConfiguration?): Float { + return validate(arg as Number, configuration) as Float + } + + @Throws(ValidationException::class) + fun validate(arg: Double, configuration: SchemaConfiguration?): Double { + return validate(arg as Number, configuration) as Double + } + + @Throws(ValidationException::class) + override fun validate(arg: String, configuration: SchemaConfiguration?): String { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validatedPathToSchemas = PathToSchemasMap() + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, LinkedHashSet()) + getPathToSchemas(this, castArg, validationMetadata, pathSet) + return castArg + } + + @Throws(ValidationException::class) + fun validate(arg: LocalDate, configuration: SchemaConfiguration?): String { + return validate(arg.toString(), configuration) + } + + @Throws(ValidationException::class) + fun validate(arg: ZonedDateTime, configuration: SchemaConfiguration?): String { + return validate(arg.toString(), configuration) + } + + @Throws(ValidationException::class) + fun validate(arg: UUID, configuration: SchemaConfiguration?): String { + return validate(arg.toString(), configuration) + } + + override fun getNewInstance(arg: List<*>, pathToItem: List, pathToSchemas: PathToSchemasMap): FrozenList { + val items: MutableList = ArrayList() + var i: Int = 0 + for (item: Any? in arg) { + val itemPathToItem = pathToItem + i + val schemas: LinkedHashMap, Nothing?>? = pathToSchemas.get(itemPathToItem) + if (schemas == null) { + throw RuntimeException("Validation result is invalid, schemas must exist for a pathToItem") + } + val itemSchema: JsonSchema<*> = schemas.entries.iterator().next().key + val itemInstance: Any? = itemSchema.getNewInstance(item, itemPathToItem, pathToSchemas) + items.add(itemInstance) + i += 1 + } + val newInstanceItems: FrozenList = FrozenList(items) + return newInstanceItems + } + + @Throws(ValidationException::class) + override fun validate(arg: List<*>, configuration: SchemaConfiguration?): FrozenList { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, PathToSchemasMap(), LinkedHashSet()) + val pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet) + return getNewInstance(castArg, validationMetadata.pathToItem, pathToSchemasMap) + } + + override fun getNewInstance(arg: Map<*, *>, pathToItem: List, pathToSchemas: PathToSchemasMap): FrozenMap { + val properties: LinkedHashMap = LinkedHashMap() + for((propertyName, value) in arg) { + if (!(propertyName is String)) { + throw RuntimeException("Invalid non-string key value") + } + val propertyPathToItem: List = pathToItem + propertyName + val schemas: LinkedHashMap, Nothing?>? = pathToSchemas.get(propertyPathToItem) + if (schemas == null) { + throw RuntimeException("Validation result is invalid, schemas must exist for a pathToItem") + } + val propertySchema: JsonSchema<*> = schemas.entries.iterator().next().key + val propertyInstance: Any? = propertySchema.getNewInstance(value, propertyPathToItem, pathToSchemas) + properties[propertyName] = propertyInstance + } + val castProperties: FrozenMap = FrozenMap(properties) + return castProperties + } + + @Throws(ValidationException::class) + override fun validate(arg: Map<*, *>, configuration: SchemaConfiguration?): FrozenMap { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validatedPathToSchemas = PathToSchemasMap() + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, LinkedHashSet()) + val pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet) + return getNewInstance(castArg, validationMetadata.pathToItem, pathToSchemasMap) + } + + @Throws(ValidationException::class) + override fun validate(arg: Any?, configuration: SchemaConfiguration?): Any? { + if (arg == null) { + return validate(null, configuration) + } else if (arg is Boolean) { + return validate(arg, configuration) + } else if (arg is Number) { + return validate(arg, configuration) + } else if (arg is String) { + return validate(arg, configuration) + } else if (arg is List<*>) { + return validate(arg, configuration) + } else if (arg is Map<*, *>) { + return validate(arg, configuration) + } + throw ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema") + } + override fun getNewInstance(arg: Any?, pathToItem: List, pathToSchemas: PathToSchemasMap): Any? { + if (arg == null) { + return getNewInstance( null, pathToItem, pathToSchemas) + } else if (arg is Boolean) { + return getNewInstance(arg, pathToItem, pathToSchemas) + } else if (arg is Number) { + return getNewInstance(arg, pathToItem, pathToSchemas) + } else if (arg is String) { + return getNewInstance(arg, pathToItem, pathToSchemas) + } else if (arg is List<*>) { + return getNewInstance(arg, pathToItem, pathToSchemas) + } else if (arg is Map<*, *>) { + return getNewInstance(arg, pathToItem, pathToSchemas) + } + throw RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema") + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: Nothing?, configuration: SchemaConfiguration?): Schema0BoxedVoid { + return Schema0BoxedVoid(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: Boolean, configuration: SchemaConfiguration?): Schema0BoxedBoolean { + return Schema0BoxedBoolean(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: Number, configuration: SchemaConfiguration?): Schema0BoxedNumber { + return Schema0BoxedNumber(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: String, configuration: SchemaConfiguration?): Schema0BoxedString { + return Schema0BoxedString(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: List<*>, configuration: SchemaConfiguration?): Schema0BoxedList { + return Schema0BoxedList(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: Map<*, *>, configuration: SchemaConfiguration?): Schema0BoxedMap { + return Schema0BoxedMap(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: Any?, configuration: SchemaConfiguration?): Schema0Boxed { + if (arg == null) { + return validateAndBox(null, configuration) + } else if (arg is Boolean) { + return validateAndBox(arg, configuration) + } else if (arg is String) { + return validateAndBox(arg, configuration) + } else if (arg is Number) { + return validateAndBox(arg, configuration) + } else if (arg is List<*>) { + return validateAndBox(arg, configuration) + } else if (arg is Map<*, *>) { + return validateAndBox(arg, configuration) + } + throw ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema") + } + } + + sealed interface Contains1Boxed { + fun getData(): Any? + } + + data class Contains1BoxedVoid(val data: Nothing?) : Contains1Boxed { + override fun getData(): Any? { + return data + } + } + + data class Contains1BoxedBoolean(val data: Boolean): Contains1Boxed { + override fun getData(): Any? { + return data + } + } + + data class Contains1BoxedNumber(val data: Number) : Contains1Boxed { + override fun getData(): Any? { + return data + } + } + + data class Contains1BoxedString(val data: String) : Contains1Boxed { + override fun getData(): Any? { + return data + } + } + + data class Contains1BoxedList(val data: FrozenList) : Contains1Boxed { + override fun getData(): Any? { + return data + } + } + + data class Contains1BoxedMap(val data: FrozenMap) : Contains1Boxed { + override fun getData(): Any? { + return data + } + } + + + class Contains1 private constructor(): JsonSchema( + JsonSchemaInfo() + .multipleOf(BigDecimal("3")) + ), NullSchemaValidator, BooleanSchemaValidator, NumberSchemaValidator, StringSchemaValidator, ListSchemaValidator, Contains1BoxedList>, MapSchemaValidator, Contains1BoxedMap> { + + companion object { + @Volatile + private var instance: Contains1? = null + + fun getInstance() = + instance ?: synchronized(this) { + instance ?: Contains1().also { instance = it } + } + } + + @Throws(ValidationException::class) + override fun validate(arg: Nothing?, configuration: SchemaConfiguration?): Nothing? { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validatedPathToSchemas = PathToSchemasMap() + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, LinkedHashSet()) + getPathToSchemas(this, castArg, validationMetadata, pathSet) + return castArg + } + + @Throws(ValidationException::class) + override fun validate(arg: Boolean, configuration: SchemaConfiguration?): Boolean { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validatedPathToSchemas = PathToSchemasMap() + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, LinkedHashSet()) + getPathToSchemas(this, castArg, validationMetadata, pathSet) + return castArg + } + + @Throws(ValidationException::class) + override fun validate(arg: Number, configuration: SchemaConfiguration?): Number { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validatedPathToSchemas = PathToSchemasMap() + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, LinkedHashSet()) + getPathToSchemas(this, castArg, validationMetadata, pathSet) + return castArg + } + + @Throws(ValidationException::class) + fun validate(arg: Int, configuration: SchemaConfiguration?): Int { + return validate(arg as Number, configuration) as Int + } + + @Throws(ValidationException::class) + fun validate(arg: Long, configuration: SchemaConfiguration?): Long { + return validate(arg as Number, configuration) as Long + } + + @Throws(ValidationException::class) + fun validate(arg: Float, configuration: SchemaConfiguration?): Float { + return validate(arg as Number, configuration) as Float + } + + @Throws(ValidationException::class) + fun validate(arg: Double, configuration: SchemaConfiguration?): Double { + return validate(arg as Number, configuration) as Double + } + + @Throws(ValidationException::class) + override fun validate(arg: String, configuration: SchemaConfiguration?): String { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validatedPathToSchemas = PathToSchemasMap() + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, LinkedHashSet()) + getPathToSchemas(this, castArg, validationMetadata, pathSet) + return castArg + } + + @Throws(ValidationException::class) + fun validate(arg: LocalDate, configuration: SchemaConfiguration?): String { + return validate(arg.toString(), configuration) + } + + @Throws(ValidationException::class) + fun validate(arg: ZonedDateTime, configuration: SchemaConfiguration?): String { + return validate(arg.toString(), configuration) + } + + @Throws(ValidationException::class) + fun validate(arg: UUID, configuration: SchemaConfiguration?): String { + return validate(arg.toString(), configuration) + } + + override fun getNewInstance(arg: List<*>, pathToItem: List, pathToSchemas: PathToSchemasMap): FrozenList { + val items: MutableList = ArrayList() + var i: Int = 0 + for (item: Any? in arg) { + val itemPathToItem = pathToItem + i + val schemas: LinkedHashMap, Nothing?>? = pathToSchemas.get(itemPathToItem) + if (schemas == null) { + throw RuntimeException("Validation result is invalid, schemas must exist for a pathToItem") + } + val itemSchema: JsonSchema<*> = schemas.entries.iterator().next().key + val itemInstance: Any? = itemSchema.getNewInstance(item, itemPathToItem, pathToSchemas) + items.add(itemInstance) + i += 1 + } + val newInstanceItems: FrozenList = FrozenList(items) + return newInstanceItems + } + + @Throws(ValidationException::class) + override fun validate(arg: List<*>, configuration: SchemaConfiguration?): FrozenList { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, PathToSchemasMap(), LinkedHashSet()) + val pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet) + return getNewInstance(castArg, validationMetadata.pathToItem, pathToSchemasMap) + } + + override fun getNewInstance(arg: Map<*, *>, pathToItem: List, pathToSchemas: PathToSchemasMap): FrozenMap { + val properties: LinkedHashMap = LinkedHashMap() + for((propertyName, value) in arg) { + if (!(propertyName is String)) { + throw RuntimeException("Invalid non-string key value") + } + val propertyPathToItem: List = pathToItem + propertyName + val schemas: LinkedHashMap, Nothing?>? = pathToSchemas.get(propertyPathToItem) + if (schemas == null) { + throw RuntimeException("Validation result is invalid, schemas must exist for a pathToItem") + } + val propertySchema: JsonSchema<*> = schemas.entries.iterator().next().key + val propertyInstance: Any? = propertySchema.getNewInstance(value, propertyPathToItem, pathToSchemas) + properties[propertyName] = propertyInstance + } + val castProperties: FrozenMap = FrozenMap(properties) + return castProperties + } + + @Throws(ValidationException::class) + override fun validate(arg: Map<*, *>, configuration: SchemaConfiguration?): FrozenMap { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validatedPathToSchemas = PathToSchemasMap() + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, LinkedHashSet()) + val pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet) + return getNewInstance(castArg, validationMetadata.pathToItem, pathToSchemasMap) + } + + @Throws(ValidationException::class) + override fun validate(arg: Any?, configuration: SchemaConfiguration?): Any? { + if (arg == null) { + return validate(null, configuration) + } else if (arg is Boolean) { + return validate(arg, configuration) + } else if (arg is Number) { + return validate(arg, configuration) + } else if (arg is String) { + return validate(arg, configuration) + } else if (arg is List<*>) { + return validate(arg, configuration) + } else if (arg is Map<*, *>) { + return validate(arg, configuration) + } + throw ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema") + } + override fun getNewInstance(arg: Any?, pathToItem: List, pathToSchemas: PathToSchemasMap): Any? { + if (arg == null) { + return getNewInstance( null, pathToItem, pathToSchemas) + } else if (arg is Boolean) { + return getNewInstance(arg, pathToItem, pathToSchemas) + } else if (arg is Number) { + return getNewInstance(arg, pathToItem, pathToSchemas) + } else if (arg is String) { + return getNewInstance(arg, pathToItem, pathToSchemas) + } else if (arg is List<*>) { + return getNewInstance(arg, pathToItem, pathToSchemas) + } else if (arg is Map<*, *>) { + return getNewInstance(arg, pathToItem, pathToSchemas) + } + throw RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema") + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: Nothing?, configuration: SchemaConfiguration?): Contains1BoxedVoid { + return Contains1BoxedVoid(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: Boolean, configuration: SchemaConfiguration?): Contains1BoxedBoolean { + return Contains1BoxedBoolean(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: Number, configuration: SchemaConfiguration?): Contains1BoxedNumber { + return Contains1BoxedNumber(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: String, configuration: SchemaConfiguration?): Contains1BoxedString { + return Contains1BoxedString(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: List<*>, configuration: SchemaConfiguration?): Contains1BoxedList { + return Contains1BoxedList(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: Map<*, *>, configuration: SchemaConfiguration?): Contains1BoxedMap { + return Contains1BoxedMap(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: Any?, configuration: SchemaConfiguration?): Contains1Boxed { + if (arg == null) { + return validateAndBox(null, configuration) + } else if (arg is Boolean) { + return validateAndBox(arg, configuration) + } else if (arg is String) { + return validateAndBox(arg, configuration) + } else if (arg is Number) { + return validateAndBox(arg, configuration) + } else if (arg is List<*>) { + return validateAndBox(arg, configuration) + } else if (arg is Map<*, *>) { + return validateAndBox(arg, configuration) + } + throw ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema") + } + } + + sealed interface Schema1Boxed { + fun getData(): Any? + } + + data class Schema1BoxedVoid(val data: Nothing?) : Schema1Boxed { + override fun getData(): Any? { + return data + } + } + + data class Schema1BoxedBoolean(val data: Boolean): Schema1Boxed { + override fun getData(): Any? { + return data + } + } + + data class Schema1BoxedNumber(val data: Number) : Schema1Boxed { + override fun getData(): Any? { + return data + } + } + + data class Schema1BoxedString(val data: String) : Schema1Boxed { + override fun getData(): Any? { + return data + } + } + + data class Schema1BoxedList(val data: FrozenList) : Schema1Boxed { + override fun getData(): Any? { + return data + } + } + + data class Schema1BoxedMap(val data: FrozenMap) : Schema1Boxed { + override fun getData(): Any? { + return data + } + } + + + class Schema1 private constructor(): JsonSchema( + JsonSchemaInfo() + .contains(Contains1::class.java) + ), NullSchemaValidator, BooleanSchemaValidator, NumberSchemaValidator, StringSchemaValidator, ListSchemaValidator, Schema1BoxedList>, MapSchemaValidator, Schema1BoxedMap> { + + companion object { + @Volatile + private var instance: Schema1? = null + + fun getInstance() = + instance ?: synchronized(this) { + instance ?: Schema1().also { instance = it } + } + } + + @Throws(ValidationException::class) + override fun validate(arg: Nothing?, configuration: SchemaConfiguration?): Nothing? { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validatedPathToSchemas = PathToSchemasMap() + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, LinkedHashSet()) + getPathToSchemas(this, castArg, validationMetadata, pathSet) + return castArg + } + + @Throws(ValidationException::class) + override fun validate(arg: Boolean, configuration: SchemaConfiguration?): Boolean { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validatedPathToSchemas = PathToSchemasMap() + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, LinkedHashSet()) + getPathToSchemas(this, castArg, validationMetadata, pathSet) + return castArg + } + + @Throws(ValidationException::class) + override fun validate(arg: Number, configuration: SchemaConfiguration?): Number { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validatedPathToSchemas = PathToSchemasMap() + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, LinkedHashSet()) + getPathToSchemas(this, castArg, validationMetadata, pathSet) + return castArg + } + + @Throws(ValidationException::class) + fun validate(arg: Int, configuration: SchemaConfiguration?): Int { + return validate(arg as Number, configuration) as Int + } + + @Throws(ValidationException::class) + fun validate(arg: Long, configuration: SchemaConfiguration?): Long { + return validate(arg as Number, configuration) as Long + } + + @Throws(ValidationException::class) + fun validate(arg: Float, configuration: SchemaConfiguration?): Float { + return validate(arg as Number, configuration) as Float + } + + @Throws(ValidationException::class) + fun validate(arg: Double, configuration: SchemaConfiguration?): Double { + return validate(arg as Number, configuration) as Double + } + + @Throws(ValidationException::class) + override fun validate(arg: String, configuration: SchemaConfiguration?): String { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validatedPathToSchemas = PathToSchemasMap() + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, LinkedHashSet()) + getPathToSchemas(this, castArg, validationMetadata, pathSet) + return castArg + } + + @Throws(ValidationException::class) + fun validate(arg: LocalDate, configuration: SchemaConfiguration?): String { + return validate(arg.toString(), configuration) + } + + @Throws(ValidationException::class) + fun validate(arg: ZonedDateTime, configuration: SchemaConfiguration?): String { + return validate(arg.toString(), configuration) + } + + @Throws(ValidationException::class) + fun validate(arg: UUID, configuration: SchemaConfiguration?): String { + return validate(arg.toString(), configuration) + } + + override fun getNewInstance(arg: List<*>, pathToItem: List, pathToSchemas: PathToSchemasMap): FrozenList { + val items: MutableList = ArrayList() + var i: Int = 0 + for (item: Any? in arg) { + val itemPathToItem = pathToItem + i + val schemas: LinkedHashMap, Nothing?>? = pathToSchemas.get(itemPathToItem) + if (schemas == null) { + throw RuntimeException("Validation result is invalid, schemas must exist for a pathToItem") + } + val itemSchema: JsonSchema<*> = schemas.entries.iterator().next().key + val itemInstance: Any? = itemSchema.getNewInstance(item, itemPathToItem, pathToSchemas) + items.add(itemInstance) + i += 1 + } + val newInstanceItems: FrozenList = FrozenList(items) + return newInstanceItems + } + + @Throws(ValidationException::class) + override fun validate(arg: List<*>, configuration: SchemaConfiguration?): FrozenList { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, PathToSchemasMap(), LinkedHashSet()) + val pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet) + return getNewInstance(castArg, validationMetadata.pathToItem, pathToSchemasMap) + } + + override fun getNewInstance(arg: Map<*, *>, pathToItem: List, pathToSchemas: PathToSchemasMap): FrozenMap { + val properties: LinkedHashMap = LinkedHashMap() + for((propertyName, value) in arg) { + if (!(propertyName is String)) { + throw RuntimeException("Invalid non-string key value") + } + val propertyPathToItem: List = pathToItem + propertyName + val schemas: LinkedHashMap, Nothing?>? = pathToSchemas.get(propertyPathToItem) + if (schemas == null) { + throw RuntimeException("Validation result is invalid, schemas must exist for a pathToItem") + } + val propertySchema: JsonSchema<*> = schemas.entries.iterator().next().key + val propertyInstance: Any? = propertySchema.getNewInstance(value, propertyPathToItem, pathToSchemas) + properties[propertyName] = propertyInstance + } + val castProperties: FrozenMap = FrozenMap(properties) + return castProperties + } + + @Throws(ValidationException::class) + override fun validate(arg: Map<*, *>, configuration: SchemaConfiguration?): FrozenMap { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validatedPathToSchemas = PathToSchemasMap() + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, LinkedHashSet()) + val pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet) + return getNewInstance(castArg, validationMetadata.pathToItem, pathToSchemasMap) + } + + @Throws(ValidationException::class) + override fun validate(arg: Any?, configuration: SchemaConfiguration?): Any? { + if (arg == null) { + return validate(null, configuration) + } else if (arg is Boolean) { + return validate(arg, configuration) + } else if (arg is Number) { + return validate(arg, configuration) + } else if (arg is String) { + return validate(arg, configuration) + } else if (arg is List<*>) { + return validate(arg, configuration) + } else if (arg is Map<*, *>) { + return validate(arg, configuration) + } + throw ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema") + } + override fun getNewInstance(arg: Any?, pathToItem: List, pathToSchemas: PathToSchemasMap): Any? { + if (arg == null) { + return getNewInstance( null, pathToItem, pathToSchemas) + } else if (arg is Boolean) { + return getNewInstance(arg, pathToItem, pathToSchemas) + } else if (arg is Number) { + return getNewInstance(arg, pathToItem, pathToSchemas) + } else if (arg is String) { + return getNewInstance(arg, pathToItem, pathToSchemas) + } else if (arg is List<*>) { + return getNewInstance(arg, pathToItem, pathToSchemas) + } else if (arg is Map<*, *>) { + return getNewInstance(arg, pathToItem, pathToSchemas) + } + throw RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema") + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: Nothing?, configuration: SchemaConfiguration?): Schema1BoxedVoid { + return Schema1BoxedVoid(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: Boolean, configuration: SchemaConfiguration?): Schema1BoxedBoolean { + return Schema1BoxedBoolean(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: Number, configuration: SchemaConfiguration?): Schema1BoxedNumber { + return Schema1BoxedNumber(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: String, configuration: SchemaConfiguration?): Schema1BoxedString { + return Schema1BoxedString(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: List<*>, configuration: SchemaConfiguration?): Schema1BoxedList { + return Schema1BoxedList(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: Map<*, *>, configuration: SchemaConfiguration?): Schema1BoxedMap { + return Schema1BoxedMap(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: Any?, configuration: SchemaConfiguration?): Schema1Boxed { + if (arg == null) { + return validateAndBox(null, configuration) + } else if (arg is Boolean) { + return validateAndBox(arg, configuration) + } else if (arg is String) { + return validateAndBox(arg, configuration) + } else if (arg is Number) { + return validateAndBox(arg, configuration) + } else if (arg is List<*>) { + return validateAndBox(arg, configuration) + } else if (arg is Map<*, *>) { + return validateAndBox(arg, configuration) + } + throw ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema") + } + } + + sealed interface UnevaluatedItemsBoxed { + fun getData(): Any? + } + + data class UnevaluatedItemsBoxedVoid(val data: Nothing?) : UnevaluatedItemsBoxed { + override fun getData(): Any? { + return data + } + } + + data class UnevaluatedItemsBoxedBoolean(val data: Boolean): UnevaluatedItemsBoxed { + override fun getData(): Any? { + return data + } + } + + data class UnevaluatedItemsBoxedNumber(val data: Number) : UnevaluatedItemsBoxed { + override fun getData(): Any? { + return data + } + } + + data class UnevaluatedItemsBoxedString(val data: String) : UnevaluatedItemsBoxed { + override fun getData(): Any? { + return data + } + } + + data class UnevaluatedItemsBoxedList(val data: FrozenList) : UnevaluatedItemsBoxed { + override fun getData(): Any? { + return data + } + } + + data class UnevaluatedItemsBoxedMap(val data: FrozenMap) : UnevaluatedItemsBoxed { + override fun getData(): Any? { + return data + } + } + + + class UnevaluatedItems private constructor(): JsonSchema( + JsonSchemaInfo() + .multipleOf(BigDecimal("5")) + ), NullSchemaValidator, BooleanSchemaValidator, NumberSchemaValidator, StringSchemaValidator, ListSchemaValidator, UnevaluatedItemsBoxedList>, MapSchemaValidator, UnevaluatedItemsBoxedMap> { + + companion object { + @Volatile + private var instance: UnevaluatedItems? = null + + fun getInstance() = + instance ?: synchronized(this) { + instance ?: UnevaluatedItems().also { instance = it } + } + } + + @Throws(ValidationException::class) + override fun validate(arg: Nothing?, configuration: SchemaConfiguration?): Nothing? { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validatedPathToSchemas = PathToSchemasMap() + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, LinkedHashSet()) + getPathToSchemas(this, castArg, validationMetadata, pathSet) + return castArg + } + + @Throws(ValidationException::class) + override fun validate(arg: Boolean, configuration: SchemaConfiguration?): Boolean { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validatedPathToSchemas = PathToSchemasMap() + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, LinkedHashSet()) + getPathToSchemas(this, castArg, validationMetadata, pathSet) + return castArg + } + + @Throws(ValidationException::class) + override fun validate(arg: Number, configuration: SchemaConfiguration?): Number { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validatedPathToSchemas = PathToSchemasMap() + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, LinkedHashSet()) + getPathToSchemas(this, castArg, validationMetadata, pathSet) + return castArg + } + + @Throws(ValidationException::class) + fun validate(arg: Int, configuration: SchemaConfiguration?): Int { + return validate(arg as Number, configuration) as Int + } + + @Throws(ValidationException::class) + fun validate(arg: Long, configuration: SchemaConfiguration?): Long { + return validate(arg as Number, configuration) as Long + } + + @Throws(ValidationException::class) + fun validate(arg: Float, configuration: SchemaConfiguration?): Float { + return validate(arg as Number, configuration) as Float + } + + @Throws(ValidationException::class) + fun validate(arg: Double, configuration: SchemaConfiguration?): Double { + return validate(arg as Number, configuration) as Double + } + + @Throws(ValidationException::class) + override fun validate(arg: String, configuration: SchemaConfiguration?): String { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validatedPathToSchemas = PathToSchemasMap() + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, LinkedHashSet()) + getPathToSchemas(this, castArg, validationMetadata, pathSet) + return castArg + } + + @Throws(ValidationException::class) + fun validate(arg: LocalDate, configuration: SchemaConfiguration?): String { + return validate(arg.toString(), configuration) + } + + @Throws(ValidationException::class) + fun validate(arg: ZonedDateTime, configuration: SchemaConfiguration?): String { + return validate(arg.toString(), configuration) + } + + @Throws(ValidationException::class) + fun validate(arg: UUID, configuration: SchemaConfiguration?): String { + return validate(arg.toString(), configuration) + } + + override fun getNewInstance(arg: List<*>, pathToItem: List, pathToSchemas: PathToSchemasMap): FrozenList { + val items: MutableList = ArrayList() + var i: Int = 0 + for (item: Any? in arg) { + val itemPathToItem = pathToItem + i + val schemas: LinkedHashMap, Nothing?>? = pathToSchemas.get(itemPathToItem) + if (schemas == null) { + throw RuntimeException("Validation result is invalid, schemas must exist for a pathToItem") + } + val itemSchema: JsonSchema<*> = schemas.entries.iterator().next().key + val itemInstance: Any? = itemSchema.getNewInstance(item, itemPathToItem, pathToSchemas) + items.add(itemInstance) + i += 1 + } + val newInstanceItems: FrozenList = FrozenList(items) + return newInstanceItems + } + + @Throws(ValidationException::class) + override fun validate(arg: List<*>, configuration: SchemaConfiguration?): FrozenList { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, PathToSchemasMap(), LinkedHashSet()) + val pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet) + return getNewInstance(castArg, validationMetadata.pathToItem, pathToSchemasMap) + } + + override fun getNewInstance(arg: Map<*, *>, pathToItem: List, pathToSchemas: PathToSchemasMap): FrozenMap { + val properties: LinkedHashMap = LinkedHashMap() + for((propertyName, value) in arg) { + if (!(propertyName is String)) { + throw RuntimeException("Invalid non-string key value") + } + val propertyPathToItem: List = pathToItem + propertyName + val schemas: LinkedHashMap, Nothing?>? = pathToSchemas.get(propertyPathToItem) + if (schemas == null) { + throw RuntimeException("Validation result is invalid, schemas must exist for a pathToItem") + } + val propertySchema: JsonSchema<*> = schemas.entries.iterator().next().key + val propertyInstance: Any? = propertySchema.getNewInstance(value, propertyPathToItem, pathToSchemas) + properties[propertyName] = propertyInstance + } + val castProperties: FrozenMap = FrozenMap(properties) + return castProperties + } + + @Throws(ValidationException::class) + override fun validate(arg: Map<*, *>, configuration: SchemaConfiguration?): FrozenMap { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validatedPathToSchemas = PathToSchemasMap() + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, LinkedHashSet()) + val pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet) + return getNewInstance(castArg, validationMetadata.pathToItem, pathToSchemasMap) + } + + @Throws(ValidationException::class) + override fun validate(arg: Any?, configuration: SchemaConfiguration?): Any? { + if (arg == null) { + return validate(null, configuration) + } else if (arg is Boolean) { + return validate(arg, configuration) + } else if (arg is Number) { + return validate(arg, configuration) + } else if (arg is String) { + return validate(arg, configuration) + } else if (arg is List<*>) { + return validate(arg, configuration) + } else if (arg is Map<*, *>) { + return validate(arg, configuration) + } + throw ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema") + } + override fun getNewInstance(arg: Any?, pathToItem: List, pathToSchemas: PathToSchemasMap): Any? { + if (arg == null) { + return getNewInstance( null, pathToItem, pathToSchemas) + } else if (arg is Boolean) { + return getNewInstance(arg, pathToItem, pathToSchemas) + } else if (arg is Number) { + return getNewInstance(arg, pathToItem, pathToSchemas) + } else if (arg is String) { + return getNewInstance(arg, pathToItem, pathToSchemas) + } else if (arg is List<*>) { + return getNewInstance(arg, pathToItem, pathToSchemas) + } else if (arg is Map<*, *>) { + return getNewInstance(arg, pathToItem, pathToSchemas) + } + throw RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema") + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: Nothing?, configuration: SchemaConfiguration?): UnevaluatedItemsBoxedVoid { + return UnevaluatedItemsBoxedVoid(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: Boolean, configuration: SchemaConfiguration?): UnevaluatedItemsBoxedBoolean { + return UnevaluatedItemsBoxedBoolean(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: Number, configuration: SchemaConfiguration?): UnevaluatedItemsBoxedNumber { + return UnevaluatedItemsBoxedNumber(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: String, configuration: SchemaConfiguration?): UnevaluatedItemsBoxedString { + return UnevaluatedItemsBoxedString(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: List<*>, configuration: SchemaConfiguration?): UnevaluatedItemsBoxedList { + return UnevaluatedItemsBoxedList(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: Map<*, *>, configuration: SchemaConfiguration?): UnevaluatedItemsBoxedMap { + return UnevaluatedItemsBoxedMap(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: Any?, configuration: SchemaConfiguration?): UnevaluatedItemsBoxed { + if (arg == null) { + return validateAndBox(null, configuration) + } else if (arg is Boolean) { + return validateAndBox(arg, configuration) + } else if (arg is String) { + return validateAndBox(arg, configuration) + } else if (arg is Number) { + return validateAndBox(arg, configuration) + } else if (arg is List<*>) { + return validateAndBox(arg, configuration) + } else if (arg is Map<*, *>) { + return validateAndBox(arg, configuration) + } + throw ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema") + } + } + + sealed interface UnevaluateditemsDependsOnMultipleNestedContains1Boxed { + fun getData(): Any? + } + + data class UnevaluateditemsDependsOnMultipleNestedContains1BoxedVoid(val data: Nothing?) : UnevaluateditemsDependsOnMultipleNestedContains1Boxed { + override fun getData(): Any? { + return data + } + } + + data class UnevaluateditemsDependsOnMultipleNestedContains1BoxedBoolean(val data: Boolean): UnevaluateditemsDependsOnMultipleNestedContains1Boxed { + override fun getData(): Any? { + return data + } + } + + data class UnevaluateditemsDependsOnMultipleNestedContains1BoxedNumber(val data: Number) : UnevaluateditemsDependsOnMultipleNestedContains1Boxed { + override fun getData(): Any? { + return data + } + } + + data class UnevaluateditemsDependsOnMultipleNestedContains1BoxedString(val data: String) : UnevaluateditemsDependsOnMultipleNestedContains1Boxed { + override fun getData(): Any? { + return data + } + } + + data class UnevaluateditemsDependsOnMultipleNestedContains1BoxedList(val data: FrozenList) : UnevaluateditemsDependsOnMultipleNestedContains1Boxed { + override fun getData(): Any? { + return data + } + } + + data class UnevaluateditemsDependsOnMultipleNestedContains1BoxedMap(val data: FrozenMap) : UnevaluateditemsDependsOnMultipleNestedContains1Boxed { + override fun getData(): Any? { + return data + } + } + + + class UnevaluateditemsDependsOnMultipleNestedContains1 private constructor(): JsonSchema( + JsonSchemaInfo() + .allOf(listOf( + Schema0::class.java, + Schema1::class.java + )) + .unevaluatedItems(UnevaluatedItems::class.java) + ), NullSchemaValidator, BooleanSchemaValidator, NumberSchemaValidator, StringSchemaValidator, ListSchemaValidator, UnevaluateditemsDependsOnMultipleNestedContains1BoxedList>, MapSchemaValidator, UnevaluateditemsDependsOnMultipleNestedContains1BoxedMap> { + /* + NOTE: This class is auto generated by OpenAPI JSON Schema Generator. + Ref: https://github.com/openapi-json-schema-tools/openapi-json-schema-generator + + Do not edit the class manually. + */ + + companion object { + @Volatile + private var instance: UnevaluateditemsDependsOnMultipleNestedContains1? = null + + fun getInstance() = + instance ?: synchronized(this) { + instance ?: UnevaluateditemsDependsOnMultipleNestedContains1().also { instance = it } + } + } + + @Throws(ValidationException::class) + override fun validate(arg: Nothing?, configuration: SchemaConfiguration?): Nothing? { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validatedPathToSchemas = PathToSchemasMap() + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, LinkedHashSet()) + getPathToSchemas(this, castArg, validationMetadata, pathSet) + return castArg + } + + @Throws(ValidationException::class) + override fun validate(arg: Boolean, configuration: SchemaConfiguration?): Boolean { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validatedPathToSchemas = PathToSchemasMap() + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, LinkedHashSet()) + getPathToSchemas(this, castArg, validationMetadata, pathSet) + return castArg + } + + @Throws(ValidationException::class) + override fun validate(arg: Number, configuration: SchemaConfiguration?): Number { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validatedPathToSchemas = PathToSchemasMap() + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, LinkedHashSet()) + getPathToSchemas(this, castArg, validationMetadata, pathSet) + return castArg + } + + @Throws(ValidationException::class) + fun validate(arg: Int, configuration: SchemaConfiguration?): Int { + return validate(arg as Number, configuration) as Int + } + + @Throws(ValidationException::class) + fun validate(arg: Long, configuration: SchemaConfiguration?): Long { + return validate(arg as Number, configuration) as Long + } + + @Throws(ValidationException::class) + fun validate(arg: Float, configuration: SchemaConfiguration?): Float { + return validate(arg as Number, configuration) as Float + } + + @Throws(ValidationException::class) + fun validate(arg: Double, configuration: SchemaConfiguration?): Double { + return validate(arg as Number, configuration) as Double + } + + @Throws(ValidationException::class) + override fun validate(arg: String, configuration: SchemaConfiguration?): String { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validatedPathToSchemas = PathToSchemasMap() + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, LinkedHashSet()) + getPathToSchemas(this, castArg, validationMetadata, pathSet) + return castArg + } + + @Throws(ValidationException::class) + fun validate(arg: LocalDate, configuration: SchemaConfiguration?): String { + return validate(arg.toString(), configuration) + } + + @Throws(ValidationException::class) + fun validate(arg: ZonedDateTime, configuration: SchemaConfiguration?): String { + return validate(arg.toString(), configuration) + } + + @Throws(ValidationException::class) + fun validate(arg: UUID, configuration: SchemaConfiguration?): String { + return validate(arg.toString(), configuration) + } + + override fun getNewInstance(arg: List<*>, pathToItem: List, pathToSchemas: PathToSchemasMap): FrozenList { + val items: MutableList = ArrayList() + var i: Int = 0 + for (item: Any? in arg) { + val itemPathToItem = pathToItem + i + val schemas: LinkedHashMap, Nothing?>? = pathToSchemas.get(itemPathToItem) + if (schemas == null) { + throw RuntimeException("Validation result is invalid, schemas must exist for a pathToItem") + } + val itemSchema: JsonSchema<*> = schemas.entries.iterator().next().key + val itemInstance: Any? = itemSchema.getNewInstance(item, itemPathToItem, pathToSchemas) + items.add(itemInstance) + i += 1 + } + val newInstanceItems: FrozenList = FrozenList(items) + return newInstanceItems + } + + @Throws(ValidationException::class) + override fun validate(arg: List<*>, configuration: SchemaConfiguration?): FrozenList { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, PathToSchemasMap(), LinkedHashSet()) + val pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet) + return getNewInstance(castArg, validationMetadata.pathToItem, pathToSchemasMap) + } + + override fun getNewInstance(arg: Map<*, *>, pathToItem: List, pathToSchemas: PathToSchemasMap): FrozenMap { + val properties: LinkedHashMap = LinkedHashMap() + for((propertyName, value) in arg) { + if (!(propertyName is String)) { + throw RuntimeException("Invalid non-string key value") + } + val propertyPathToItem: List = pathToItem + propertyName + val schemas: LinkedHashMap, Nothing?>? = pathToSchemas.get(propertyPathToItem) + if (schemas == null) { + throw RuntimeException("Validation result is invalid, schemas must exist for a pathToItem") + } + val propertySchema: JsonSchema<*> = schemas.entries.iterator().next().key + val propertyInstance: Any? = propertySchema.getNewInstance(value, propertyPathToItem, pathToSchemas) + properties[propertyName] = propertyInstance + } + val castProperties: FrozenMap = FrozenMap(properties) + return castProperties + } + + @Throws(ValidationException::class) + override fun validate(arg: Map<*, *>, configuration: SchemaConfiguration?): FrozenMap { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validatedPathToSchemas = PathToSchemasMap() + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, LinkedHashSet()) + val pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet) + return getNewInstance(castArg, validationMetadata.pathToItem, pathToSchemasMap) + } + + @Throws(ValidationException::class) + override fun validate(arg: Any?, configuration: SchemaConfiguration?): Any? { + if (arg == null) { + return validate(null, configuration) + } else if (arg is Boolean) { + return validate(arg, configuration) + } else if (arg is Number) { + return validate(arg, configuration) + } else if (arg is String) { + return validate(arg, configuration) + } else if (arg is List<*>) { + return validate(arg, configuration) + } else if (arg is Map<*, *>) { + return validate(arg, configuration) + } + throw ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema") + } + override fun getNewInstance(arg: Any?, pathToItem: List, pathToSchemas: PathToSchemasMap): Any? { + if (arg == null) { + return getNewInstance( null, pathToItem, pathToSchemas) + } else if (arg is Boolean) { + return getNewInstance(arg, pathToItem, pathToSchemas) + } else if (arg is Number) { + return getNewInstance(arg, pathToItem, pathToSchemas) + } else if (arg is String) { + return getNewInstance(arg, pathToItem, pathToSchemas) + } else if (arg is List<*>) { + return getNewInstance(arg, pathToItem, pathToSchemas) + } else if (arg is Map<*, *>) { + return getNewInstance(arg, pathToItem, pathToSchemas) + } + throw RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema") + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: Nothing?, configuration: SchemaConfiguration?): UnevaluateditemsDependsOnMultipleNestedContains1BoxedVoid { + return UnevaluateditemsDependsOnMultipleNestedContains1BoxedVoid(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: Boolean, configuration: SchemaConfiguration?): UnevaluateditemsDependsOnMultipleNestedContains1BoxedBoolean { + return UnevaluateditemsDependsOnMultipleNestedContains1BoxedBoolean(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: Number, configuration: SchemaConfiguration?): UnevaluateditemsDependsOnMultipleNestedContains1BoxedNumber { + return UnevaluateditemsDependsOnMultipleNestedContains1BoxedNumber(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: String, configuration: SchemaConfiguration?): UnevaluateditemsDependsOnMultipleNestedContains1BoxedString { + return UnevaluateditemsDependsOnMultipleNestedContains1BoxedString(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: List<*>, configuration: SchemaConfiguration?): UnevaluateditemsDependsOnMultipleNestedContains1BoxedList { + return UnevaluateditemsDependsOnMultipleNestedContains1BoxedList(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: Map<*, *>, configuration: SchemaConfiguration?): UnevaluateditemsDependsOnMultipleNestedContains1BoxedMap { + return UnevaluateditemsDependsOnMultipleNestedContains1BoxedMap(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: Any?, configuration: SchemaConfiguration?): UnevaluateditemsDependsOnMultipleNestedContains1Boxed { + if (arg == null) { + return validateAndBox(null, configuration) + } else if (arg is Boolean) { + return validateAndBox(arg, configuration) + } else if (arg is String) { + return validateAndBox(arg, configuration) + } else if (arg is Number) { + return validateAndBox(arg, configuration) + } else if (arg is List<*>) { + return validateAndBox(arg, configuration) + } else if (arg is Map<*, *>) { + return validateAndBox(arg, configuration) + } + throw ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema") + } + } +} diff --git a/samples/client/3_1_0_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/schemas/UnevaluateditemsWithItems.kt b/samples/client/3_1_0_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/schemas/UnevaluateditemsWithItems.kt new file mode 100644 index 00000000000..b420e31efe9 --- /dev/null +++ b/samples/client/3_1_0_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/schemas/UnevaluateditemsWithItems.kt @@ -0,0 +1,180 @@ +package org.openapijsonschematools.client.components.schemas +import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags +import org.openapijsonschematools.client.configurations.SchemaConfiguration +import org.openapijsonschematools.client.exceptions.ValidationException +import org.openapijsonschematools.client.schemas.NumberJsonSchema +import org.openapijsonschematools.client.schemas.StringJsonSchema +import org.openapijsonschematools.client.schemas.validation.FrozenList +import org.openapijsonschematools.client.schemas.validation.JsonSchema +import org.openapijsonschematools.client.schemas.validation.JsonSchemaInfo +import org.openapijsonschematools.client.schemas.validation.ListSchemaValidator +import org.openapijsonschematools.client.schemas.validation.PathToSchemasMap +import org.openapijsonschematools.client.schemas.validation.ValidationMetadata + +class UnevaluateditemsWithItems { + // nest classes so all schemas and input/output classes can be public + + + class Items : NumberJsonSchema.NumberJsonSchema1() { + companion object { + @Volatile + private var instance: Items? = null + + fun getInstance() = + instance ?: synchronized(this) { + instance ?: Items().also { instance = it } + } + } + } + + + class UnevaluateditemsWithItemsList(m: FrozenList) : FrozenList(m) { + companion object { + @Throws(ValidationException::class) + fun of(arg: List, configuration: SchemaConfiguration?): UnevaluateditemsWithItemsList { + return UnevaluateditemsWithItems1.getInstance().validate(arg, configuration) + } + } + } + + class UnevaluateditemsWithItemsListBuilder { + // class to build List + private val list: MutableList + + init { + this.list = ArrayList() + } + + + fun add(item: Int): UnevaluateditemsWithItemsListBuilder { + list.add(item) + return this + } + + fun add(item: Float): UnevaluateditemsWithItemsListBuilder { + list.add(item) + return this + } + + fun add(item: Long): UnevaluateditemsWithItemsListBuilder { + list.add(item) + return this + } + + fun add(item: Double): UnevaluateditemsWithItemsListBuilder { + list.add(item) + return this + } + + fun build(): List { + return list + } + } + + + class UnevaluatedItems : StringJsonSchema.StringJsonSchema1() { + companion object { + @Volatile + private var instance: UnevaluatedItems? = null + + fun getInstance() = + instance ?: synchronized(this) { + instance ?: UnevaluatedItems().also { instance = it } + } + } + } + + + sealed interface UnevaluateditemsWithItems1Boxed { + fun getData(): Any? + } + + data class UnevaluateditemsWithItems1BoxedList(val data: UnevaluateditemsWithItemsList) : UnevaluateditemsWithItems1Boxed { + override fun getData(): Any? { + return data + } + } + + + + class UnevaluateditemsWithItems1 private constructor(): JsonSchema( + JsonSchemaInfo() + .type(setOf(List::class.java)) + .items(Items::class.java) + .unevaluatedItems(UnevaluatedItems::class.java) + ), ListSchemaValidator { + /* + NOTE: This class is auto generated by OpenAPI JSON Schema Generator. + Ref: https://github.com/openapi-json-schema-tools/openapi-json-schema-generator + + Do not edit the class manually. + */ + + companion object { + @Volatile + private var instance: UnevaluateditemsWithItems1? = null + + fun getInstance() = + instance ?: synchronized(this) { + instance ?: UnevaluateditemsWithItems1().also { instance = it } + } + } + + override fun getNewInstance(arg: List<*>, pathToItem: List, pathToSchemas: PathToSchemasMap): UnevaluateditemsWithItemsList { + val items: MutableList = ArrayList() + var i: Int = 0 + for (item: Any? in arg) { + val itemPathToItem: List = pathToItem + i + val schemas: LinkedHashMap, Nothing?>? = pathToSchemas.get(itemPathToItem) + if (schemas == null) { + throw RuntimeException("Validation result is invalid, schemas must exist for a pathToItem") + } + val itemSchema: JsonSchema<*> = schemas.entries.iterator().next().key + val itemInstance: Any? = itemSchema.getNewInstance(item, itemPathToItem, pathToSchemas) + if (!(itemInstance is Number)) { + throw RuntimeException("Invalid instantiated value") + } + items.add(itemInstance) + i += 1 + } + val newInstanceItems: FrozenList = FrozenList(items) + return UnevaluateditemsWithItemsList(newInstanceItems) + } + + @Throws(ValidationException::class) + override fun validate(arg: List<*>, configuration: SchemaConfiguration?): UnevaluateditemsWithItemsList { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, PathToSchemasMap(), LinkedHashSet()) + val pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet) + return getNewInstance(castArg, validationMetadata.pathToItem, pathToSchemasMap) + } + + @Throws(ValidationException::class) + override fun validate(arg: Any?, configuration: SchemaConfiguration?): Any? { + if (arg is List<*>) { + return validate(arg, configuration) + } + throw ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema") + } + override fun getNewInstance(arg: Any?, pathToItem: List, pathToSchemas: PathToSchemasMap): Any? { + if (arg is List<*>) { + return getNewInstance(arg, pathToItem, pathToSchemas) + } + throw RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema") + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: List<*>, configuration: SchemaConfiguration?): UnevaluateditemsWithItems1BoxedList { + return UnevaluateditemsWithItems1BoxedList(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: Any?, configuration: SchemaConfiguration?): UnevaluateditemsWithItems1Boxed { + if (arg is List<*>) { + return validateAndBox(arg, configuration) + } + throw ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema") + } + } +} diff --git a/samples/client/3_1_0_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/schemas/UnevaluateditemsWithNullInstanceElements.kt b/samples/client/3_1_0_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/schemas/UnevaluateditemsWithNullInstanceElements.kt new file mode 100644 index 00000000000..d35f25274f3 --- /dev/null +++ b/samples/client/3_1_0_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/schemas/UnevaluateditemsWithNullInstanceElements.kt @@ -0,0 +1,322 @@ +package org.openapijsonschematools.client.components.schemas +import java.time.LocalDate +import java.time.ZonedDateTime +import java.util.UUID +import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags +import org.openapijsonschematools.client.configurations.SchemaConfiguration +import org.openapijsonschematools.client.exceptions.InvalidAdditionalPropertyException +import org.openapijsonschematools.client.exceptions.UnsetPropertyException +import org.openapijsonschematools.client.exceptions.ValidationException +import org.openapijsonschematools.client.schemas.NullJsonSchema +import org.openapijsonschematools.client.schemas.UnsetAddPropsSetter +import org.openapijsonschematools.client.schemas.validation.BooleanSchemaValidator +import org.openapijsonschematools.client.schemas.validation.FrozenList +import org.openapijsonschematools.client.schemas.validation.FrozenMap +import org.openapijsonschematools.client.schemas.validation.JsonSchema +import org.openapijsonschematools.client.schemas.validation.JsonSchemaInfo +import org.openapijsonschematools.client.schemas.validation.ListSchemaValidator +import org.openapijsonschematools.client.schemas.validation.MapSchemaValidator +import org.openapijsonschematools.client.schemas.validation.NullSchemaValidator +import org.openapijsonschematools.client.schemas.validation.NumberSchemaValidator +import org.openapijsonschematools.client.schemas.validation.PathToSchemasMap +import org.openapijsonschematools.client.schemas.validation.StringSchemaValidator +import org.openapijsonschematools.client.schemas.validation.ValidationMetadata + +class UnevaluateditemsWithNullInstanceElements { + // nest classes so all schemas and input/output classes can be public + + + class UnevaluatedItems : NullJsonSchema.NullJsonSchema1() { + companion object { + @Volatile + private var instance: UnevaluatedItems? = null + + fun getInstance() = + instance ?: synchronized(this) { + instance ?: UnevaluatedItems().also { instance = it } + } + } + } + + + sealed interface UnevaluateditemsWithNullInstanceElements1Boxed { + fun getData(): Any? + } + + data class UnevaluateditemsWithNullInstanceElements1BoxedVoid(val data: Nothing?) : UnevaluateditemsWithNullInstanceElements1Boxed { + override fun getData(): Any? { + return data + } + } + + data class UnevaluateditemsWithNullInstanceElements1BoxedBoolean(val data: Boolean): UnevaluateditemsWithNullInstanceElements1Boxed { + override fun getData(): Any? { + return data + } + } + + data class UnevaluateditemsWithNullInstanceElements1BoxedNumber(val data: Number) : UnevaluateditemsWithNullInstanceElements1Boxed { + override fun getData(): Any? { + return data + } + } + + data class UnevaluateditemsWithNullInstanceElements1BoxedString(val data: String) : UnevaluateditemsWithNullInstanceElements1Boxed { + override fun getData(): Any? { + return data + } + } + + data class UnevaluateditemsWithNullInstanceElements1BoxedList(val data: FrozenList) : UnevaluateditemsWithNullInstanceElements1Boxed { + override fun getData(): Any? { + return data + } + } + + data class UnevaluateditemsWithNullInstanceElements1BoxedMap(val data: FrozenMap) : UnevaluateditemsWithNullInstanceElements1Boxed { + override fun getData(): Any? { + return data + } + } + + + class UnevaluateditemsWithNullInstanceElements1 private constructor(): JsonSchema( + JsonSchemaInfo() + .unevaluatedItems(UnevaluatedItems::class.java) + ), NullSchemaValidator, BooleanSchemaValidator, NumberSchemaValidator, StringSchemaValidator, ListSchemaValidator, UnevaluateditemsWithNullInstanceElements1BoxedList>, MapSchemaValidator, UnevaluateditemsWithNullInstanceElements1BoxedMap> { + /* + NOTE: This class is auto generated by OpenAPI JSON Schema Generator. + Ref: https://github.com/openapi-json-schema-tools/openapi-json-schema-generator + + Do not edit the class manually. + */ + + companion object { + @Volatile + private var instance: UnevaluateditemsWithNullInstanceElements1? = null + + fun getInstance() = + instance ?: synchronized(this) { + instance ?: UnevaluateditemsWithNullInstanceElements1().also { instance = it } + } + } + + @Throws(ValidationException::class) + override fun validate(arg: Nothing?, configuration: SchemaConfiguration?): Nothing? { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validatedPathToSchemas = PathToSchemasMap() + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, LinkedHashSet()) + getPathToSchemas(this, castArg, validationMetadata, pathSet) + return castArg + } + + @Throws(ValidationException::class) + override fun validate(arg: Boolean, configuration: SchemaConfiguration?): Boolean { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validatedPathToSchemas = PathToSchemasMap() + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, LinkedHashSet()) + getPathToSchemas(this, castArg, validationMetadata, pathSet) + return castArg + } + + @Throws(ValidationException::class) + override fun validate(arg: Number, configuration: SchemaConfiguration?): Number { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validatedPathToSchemas = PathToSchemasMap() + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, LinkedHashSet()) + getPathToSchemas(this, castArg, validationMetadata, pathSet) + return castArg + } + + @Throws(ValidationException::class) + fun validate(arg: Int, configuration: SchemaConfiguration?): Int { + return validate(arg as Number, configuration) as Int + } + + @Throws(ValidationException::class) + fun validate(arg: Long, configuration: SchemaConfiguration?): Long { + return validate(arg as Number, configuration) as Long + } + + @Throws(ValidationException::class) + fun validate(arg: Float, configuration: SchemaConfiguration?): Float { + return validate(arg as Number, configuration) as Float + } + + @Throws(ValidationException::class) + fun validate(arg: Double, configuration: SchemaConfiguration?): Double { + return validate(arg as Number, configuration) as Double + } + + @Throws(ValidationException::class) + override fun validate(arg: String, configuration: SchemaConfiguration?): String { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validatedPathToSchemas = PathToSchemasMap() + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, LinkedHashSet()) + getPathToSchemas(this, castArg, validationMetadata, pathSet) + return castArg + } + + @Throws(ValidationException::class) + fun validate(arg: LocalDate, configuration: SchemaConfiguration?): String { + return validate(arg.toString(), configuration) + } + + @Throws(ValidationException::class) + fun validate(arg: ZonedDateTime, configuration: SchemaConfiguration?): String { + return validate(arg.toString(), configuration) + } + + @Throws(ValidationException::class) + fun validate(arg: UUID, configuration: SchemaConfiguration?): String { + return validate(arg.toString(), configuration) + } + + override fun getNewInstance(arg: List<*>, pathToItem: List, pathToSchemas: PathToSchemasMap): FrozenList { + val items: MutableList = ArrayList() + var i: Int = 0 + for (item: Any? in arg) { + val itemPathToItem = pathToItem + i + val schemas: LinkedHashMap, Nothing?>? = pathToSchemas.get(itemPathToItem) + if (schemas == null) { + throw RuntimeException("Validation result is invalid, schemas must exist for a pathToItem") + } + val itemSchema: JsonSchema<*> = schemas.entries.iterator().next().key + val itemInstance: Any? = itemSchema.getNewInstance(item, itemPathToItem, pathToSchemas) + items.add(itemInstance) + i += 1 + } + val newInstanceItems: FrozenList = FrozenList(items) + return newInstanceItems + } + + @Throws(ValidationException::class) + override fun validate(arg: List<*>, configuration: SchemaConfiguration?): FrozenList { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, PathToSchemasMap(), LinkedHashSet()) + val pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet) + return getNewInstance(castArg, validationMetadata.pathToItem, pathToSchemasMap) + } + + override fun getNewInstance(arg: Map<*, *>, pathToItem: List, pathToSchemas: PathToSchemasMap): FrozenMap { + val properties: LinkedHashMap = LinkedHashMap() + for((propertyName, value) in arg) { + if (!(propertyName is String)) { + throw RuntimeException("Invalid non-string key value") + } + val propertyPathToItem: List = pathToItem + propertyName + val schemas: LinkedHashMap, Nothing?>? = pathToSchemas.get(propertyPathToItem) + if (schemas == null) { + throw RuntimeException("Validation result is invalid, schemas must exist for a pathToItem") + } + val propertySchema: JsonSchema<*> = schemas.entries.iterator().next().key + val propertyInstance: Any? = propertySchema.getNewInstance(value, propertyPathToItem, pathToSchemas) + properties[propertyName] = propertyInstance + } + val castProperties: FrozenMap = FrozenMap(properties) + return castProperties + } + + @Throws(ValidationException::class) + override fun validate(arg: Map<*, *>, configuration: SchemaConfiguration?): FrozenMap { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validatedPathToSchemas = PathToSchemasMap() + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, LinkedHashSet()) + val pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet) + return getNewInstance(castArg, validationMetadata.pathToItem, pathToSchemasMap) + } + + @Throws(ValidationException::class) + override fun validate(arg: Any?, configuration: SchemaConfiguration?): Any? { + if (arg == null) { + return validate(null, configuration) + } else if (arg is Boolean) { + return validate(arg, configuration) + } else if (arg is Number) { + return validate(arg, configuration) + } else if (arg is String) { + return validate(arg, configuration) + } else if (arg is List<*>) { + return validate(arg, configuration) + } else if (arg is Map<*, *>) { + return validate(arg, configuration) + } + throw ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema") + } + override fun getNewInstance(arg: Any?, pathToItem: List, pathToSchemas: PathToSchemasMap): Any? { + if (arg == null) { + return getNewInstance( null, pathToItem, pathToSchemas) + } else if (arg is Boolean) { + return getNewInstance(arg, pathToItem, pathToSchemas) + } else if (arg is Number) { + return getNewInstance(arg, pathToItem, pathToSchemas) + } else if (arg is String) { + return getNewInstance(arg, pathToItem, pathToSchemas) + } else if (arg is List<*>) { + return getNewInstance(arg, pathToItem, pathToSchemas) + } else if (arg is Map<*, *>) { + return getNewInstance(arg, pathToItem, pathToSchemas) + } + throw RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema") + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: Nothing?, configuration: SchemaConfiguration?): UnevaluateditemsWithNullInstanceElements1BoxedVoid { + return UnevaluateditemsWithNullInstanceElements1BoxedVoid(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: Boolean, configuration: SchemaConfiguration?): UnevaluateditemsWithNullInstanceElements1BoxedBoolean { + return UnevaluateditemsWithNullInstanceElements1BoxedBoolean(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: Number, configuration: SchemaConfiguration?): UnevaluateditemsWithNullInstanceElements1BoxedNumber { + return UnevaluateditemsWithNullInstanceElements1BoxedNumber(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: String, configuration: SchemaConfiguration?): UnevaluateditemsWithNullInstanceElements1BoxedString { + return UnevaluateditemsWithNullInstanceElements1BoxedString(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: List<*>, configuration: SchemaConfiguration?): UnevaluateditemsWithNullInstanceElements1BoxedList { + return UnevaluateditemsWithNullInstanceElements1BoxedList(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: Map<*, *>, configuration: SchemaConfiguration?): UnevaluateditemsWithNullInstanceElements1BoxedMap { + return UnevaluateditemsWithNullInstanceElements1BoxedMap(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: Any?, configuration: SchemaConfiguration?): UnevaluateditemsWithNullInstanceElements1Boxed { + if (arg == null) { + return validateAndBox(null, configuration) + } else if (arg is Boolean) { + return validateAndBox(arg, configuration) + } else if (arg is String) { + return validateAndBox(arg, configuration) + } else if (arg is Number) { + return validateAndBox(arg, configuration) + } else if (arg is List<*>) { + return validateAndBox(arg, configuration) + } else if (arg is Map<*, *>) { + return validateAndBox(arg, configuration) + } + throw ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema") + } + } +} diff --git a/samples/client/3_1_0_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/schemas/UnevaluatedpropertiesNotAffectedByPropertynames.kt b/samples/client/3_1_0_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/schemas/UnevaluatedpropertiesNotAffectedByPropertynames.kt new file mode 100644 index 00000000000..ee836bf8c34 --- /dev/null +++ b/samples/client/3_1_0_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/schemas/UnevaluatedpropertiesNotAffectedByPropertynames.kt @@ -0,0 +1,390 @@ +package org.openapijsonschematools.client.components.schemas +import java.time.LocalDate +import java.time.ZonedDateTime +import java.util.UUID +import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags +import org.openapijsonschematools.client.configurations.SchemaConfiguration +import org.openapijsonschematools.client.exceptions.InvalidAdditionalPropertyException +import org.openapijsonschematools.client.exceptions.UnsetPropertyException +import org.openapijsonschematools.client.exceptions.ValidationException +import org.openapijsonschematools.client.schemas.NumberJsonSchema +import org.openapijsonschematools.client.schemas.UnsetAddPropsSetter +import org.openapijsonschematools.client.schemas.validation.BooleanSchemaValidator +import org.openapijsonschematools.client.schemas.validation.FrozenList +import org.openapijsonschematools.client.schemas.validation.FrozenMap +import org.openapijsonschematools.client.schemas.validation.JsonSchema +import org.openapijsonschematools.client.schemas.validation.JsonSchemaInfo +import org.openapijsonschematools.client.schemas.validation.ListSchemaValidator +import org.openapijsonschematools.client.schemas.validation.MapSchemaValidator +import org.openapijsonschematools.client.schemas.validation.NullSchemaValidator +import org.openapijsonschematools.client.schemas.validation.NumberSchemaValidator +import org.openapijsonschematools.client.schemas.validation.PathToSchemasMap +import org.openapijsonschematools.client.schemas.validation.StringSchemaValidator +import org.openapijsonschematools.client.schemas.validation.ValidationMetadata + +class UnevaluatedpropertiesNotAffectedByPropertynames { + // nest classes so all schemas and input/output classes can be public + + + sealed interface PropertyNamesBoxed { + fun getData(): Any? + } + + data class PropertyNamesBoxedString(val data: String) : PropertyNamesBoxed { + override fun getData(): Any? { + return data + } + } + + + + class PropertyNames private constructor(): JsonSchema( + JsonSchemaInfo() + .type(setOf( + String::class.java + )) + .maxLength(1) + ), StringSchemaValidator { + + companion object { + @Volatile + private var instance: PropertyNames? = null + + fun getInstance() = + instance ?: synchronized(this) { + instance ?: PropertyNames().also { instance = it } + } + } + + @Throws(ValidationException::class) + override fun validate(arg: String, configuration: SchemaConfiguration?): String { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, PathToSchemasMap(), LinkedHashSet()) + getPathToSchemas(this, castArg, validationMetadata, pathSet) + return castArg + } + + @Throws(ValidationException::class) + override fun validate(arg: Any?, configuration: SchemaConfiguration?): Any? { + if (arg is String) { + return validate(arg, configuration) + } + throw ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema") + } + override fun getNewInstance(arg: Any?, pathToItem: List, pathToSchemas: PathToSchemasMap): Any? { + if (arg is String) { + return getNewInstance(arg, pathToItem, pathToSchemas) + } + throw RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema") + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: String, configuration: SchemaConfiguration?): PropertyNamesBoxedString { + return PropertyNamesBoxedString(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: Any?, configuration: SchemaConfiguration?): PropertyNamesBoxed { + if (arg is String) { + return validateAndBox(arg, configuration) + } + throw ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema") + } + } + + class UnevaluatedProperties : NumberJsonSchema.NumberJsonSchema1() { + companion object { + @Volatile + private var instance: UnevaluatedProperties? = null + + fun getInstance() = + instance ?: synchronized(this) { + instance ?: UnevaluatedProperties().also { instance = it } + } + } + } + + + sealed interface UnevaluatedpropertiesNotAffectedByPropertynames1Boxed { + fun getData(): Any? + } + + data class UnevaluatedpropertiesNotAffectedByPropertynames1BoxedVoid(val data: Nothing?) : UnevaluatedpropertiesNotAffectedByPropertynames1Boxed { + override fun getData(): Any? { + return data + } + } + + data class UnevaluatedpropertiesNotAffectedByPropertynames1BoxedBoolean(val data: Boolean): UnevaluatedpropertiesNotAffectedByPropertynames1Boxed { + override fun getData(): Any? { + return data + } + } + + data class UnevaluatedpropertiesNotAffectedByPropertynames1BoxedNumber(val data: Number) : UnevaluatedpropertiesNotAffectedByPropertynames1Boxed { + override fun getData(): Any? { + return data + } + } + + data class UnevaluatedpropertiesNotAffectedByPropertynames1BoxedString(val data: String) : UnevaluatedpropertiesNotAffectedByPropertynames1Boxed { + override fun getData(): Any? { + return data + } + } + + data class UnevaluatedpropertiesNotAffectedByPropertynames1BoxedList(val data: FrozenList) : UnevaluatedpropertiesNotAffectedByPropertynames1Boxed { + override fun getData(): Any? { + return data + } + } + + data class UnevaluatedpropertiesNotAffectedByPropertynames1BoxedMap(val data: FrozenMap) : UnevaluatedpropertiesNotAffectedByPropertynames1Boxed { + override fun getData(): Any? { + return data + } + } + + + class UnevaluatedpropertiesNotAffectedByPropertynames1 private constructor(): JsonSchema( + JsonSchemaInfo() + .propertyNames(PropertyNames::class.java) + .unevaluatedProperties(UnevaluatedProperties::class.java) + ), NullSchemaValidator, BooleanSchemaValidator, NumberSchemaValidator, StringSchemaValidator, ListSchemaValidator, UnevaluatedpropertiesNotAffectedByPropertynames1BoxedList>, MapSchemaValidator, UnevaluatedpropertiesNotAffectedByPropertynames1BoxedMap> { + /* + NOTE: This class is auto generated by OpenAPI JSON Schema Generator. + Ref: https://github.com/openapi-json-schema-tools/openapi-json-schema-generator + + Do not edit the class manually. + */ + + companion object { + @Volatile + private var instance: UnevaluatedpropertiesNotAffectedByPropertynames1? = null + + fun getInstance() = + instance ?: synchronized(this) { + instance ?: UnevaluatedpropertiesNotAffectedByPropertynames1().also { instance = it } + } + } + + @Throws(ValidationException::class) + override fun validate(arg: Nothing?, configuration: SchemaConfiguration?): Nothing? { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validatedPathToSchemas = PathToSchemasMap() + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, LinkedHashSet()) + getPathToSchemas(this, castArg, validationMetadata, pathSet) + return castArg + } + + @Throws(ValidationException::class) + override fun validate(arg: Boolean, configuration: SchemaConfiguration?): Boolean { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validatedPathToSchemas = PathToSchemasMap() + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, LinkedHashSet()) + getPathToSchemas(this, castArg, validationMetadata, pathSet) + return castArg + } + + @Throws(ValidationException::class) + override fun validate(arg: Number, configuration: SchemaConfiguration?): Number { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validatedPathToSchemas = PathToSchemasMap() + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, LinkedHashSet()) + getPathToSchemas(this, castArg, validationMetadata, pathSet) + return castArg + } + + @Throws(ValidationException::class) + fun validate(arg: Int, configuration: SchemaConfiguration?): Int { + return validate(arg as Number, configuration) as Int + } + + @Throws(ValidationException::class) + fun validate(arg: Long, configuration: SchemaConfiguration?): Long { + return validate(arg as Number, configuration) as Long + } + + @Throws(ValidationException::class) + fun validate(arg: Float, configuration: SchemaConfiguration?): Float { + return validate(arg as Number, configuration) as Float + } + + @Throws(ValidationException::class) + fun validate(arg: Double, configuration: SchemaConfiguration?): Double { + return validate(arg as Number, configuration) as Double + } + + @Throws(ValidationException::class) + override fun validate(arg: String, configuration: SchemaConfiguration?): String { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validatedPathToSchemas = PathToSchemasMap() + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, LinkedHashSet()) + getPathToSchemas(this, castArg, validationMetadata, pathSet) + return castArg + } + + @Throws(ValidationException::class) + fun validate(arg: LocalDate, configuration: SchemaConfiguration?): String { + return validate(arg.toString(), configuration) + } + + @Throws(ValidationException::class) + fun validate(arg: ZonedDateTime, configuration: SchemaConfiguration?): String { + return validate(arg.toString(), configuration) + } + + @Throws(ValidationException::class) + fun validate(arg: UUID, configuration: SchemaConfiguration?): String { + return validate(arg.toString(), configuration) + } + + override fun getNewInstance(arg: List<*>, pathToItem: List, pathToSchemas: PathToSchemasMap): FrozenList { + val items: MutableList = ArrayList() + var i: Int = 0 + for (item: Any? in arg) { + val itemPathToItem = pathToItem + i + val schemas: LinkedHashMap, Nothing?>? = pathToSchemas.get(itemPathToItem) + if (schemas == null) { + throw RuntimeException("Validation result is invalid, schemas must exist for a pathToItem") + } + val itemSchema: JsonSchema<*> = schemas.entries.iterator().next().key + val itemInstance: Any? = itemSchema.getNewInstance(item, itemPathToItem, pathToSchemas) + items.add(itemInstance) + i += 1 + } + val newInstanceItems: FrozenList = FrozenList(items) + return newInstanceItems + } + + @Throws(ValidationException::class) + override fun validate(arg: List<*>, configuration: SchemaConfiguration?): FrozenList { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, PathToSchemasMap(), LinkedHashSet()) + val pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet) + return getNewInstance(castArg, validationMetadata.pathToItem, pathToSchemasMap) + } + + override fun getNewInstance(arg: Map<*, *>, pathToItem: List, pathToSchemas: PathToSchemasMap): FrozenMap { + val properties: LinkedHashMap = LinkedHashMap() + for((propertyName, value) in arg) { + if (!(propertyName is String)) { + throw RuntimeException("Invalid non-string key value") + } + val propertyPathToItem: List = pathToItem + propertyName + val schemas: LinkedHashMap, Nothing?>? = pathToSchemas.get(propertyPathToItem) + if (schemas == null) { + throw RuntimeException("Validation result is invalid, schemas must exist for a pathToItem") + } + val propertySchema: JsonSchema<*> = schemas.entries.iterator().next().key + val propertyInstance: Any? = propertySchema.getNewInstance(value, propertyPathToItem, pathToSchemas) + properties[propertyName] = propertyInstance + } + val castProperties: FrozenMap = FrozenMap(properties) + return castProperties + } + + @Throws(ValidationException::class) + override fun validate(arg: Map<*, *>, configuration: SchemaConfiguration?): FrozenMap { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validatedPathToSchemas = PathToSchemasMap() + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, LinkedHashSet()) + val pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet) + return getNewInstance(castArg, validationMetadata.pathToItem, pathToSchemasMap) + } + + @Throws(ValidationException::class) + override fun validate(arg: Any?, configuration: SchemaConfiguration?): Any? { + if (arg == null) { + return validate(null, configuration) + } else if (arg is Boolean) { + return validate(arg, configuration) + } else if (arg is Number) { + return validate(arg, configuration) + } else if (arg is String) { + return validate(arg, configuration) + } else if (arg is List<*>) { + return validate(arg, configuration) + } else if (arg is Map<*, *>) { + return validate(arg, configuration) + } + throw ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema") + } + override fun getNewInstance(arg: Any?, pathToItem: List, pathToSchemas: PathToSchemasMap): Any? { + if (arg == null) { + return getNewInstance( null, pathToItem, pathToSchemas) + } else if (arg is Boolean) { + return getNewInstance(arg, pathToItem, pathToSchemas) + } else if (arg is Number) { + return getNewInstance(arg, pathToItem, pathToSchemas) + } else if (arg is String) { + return getNewInstance(arg, pathToItem, pathToSchemas) + } else if (arg is List<*>) { + return getNewInstance(arg, pathToItem, pathToSchemas) + } else if (arg is Map<*, *>) { + return getNewInstance(arg, pathToItem, pathToSchemas) + } + throw RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema") + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: Nothing?, configuration: SchemaConfiguration?): UnevaluatedpropertiesNotAffectedByPropertynames1BoxedVoid { + return UnevaluatedpropertiesNotAffectedByPropertynames1BoxedVoid(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: Boolean, configuration: SchemaConfiguration?): UnevaluatedpropertiesNotAffectedByPropertynames1BoxedBoolean { + return UnevaluatedpropertiesNotAffectedByPropertynames1BoxedBoolean(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: Number, configuration: SchemaConfiguration?): UnevaluatedpropertiesNotAffectedByPropertynames1BoxedNumber { + return UnevaluatedpropertiesNotAffectedByPropertynames1BoxedNumber(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: String, configuration: SchemaConfiguration?): UnevaluatedpropertiesNotAffectedByPropertynames1BoxedString { + return UnevaluatedpropertiesNotAffectedByPropertynames1BoxedString(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: List<*>, configuration: SchemaConfiguration?): UnevaluatedpropertiesNotAffectedByPropertynames1BoxedList { + return UnevaluatedpropertiesNotAffectedByPropertynames1BoxedList(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: Map<*, *>, configuration: SchemaConfiguration?): UnevaluatedpropertiesNotAffectedByPropertynames1BoxedMap { + return UnevaluatedpropertiesNotAffectedByPropertynames1BoxedMap(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: Any?, configuration: SchemaConfiguration?): UnevaluatedpropertiesNotAffectedByPropertynames1Boxed { + if (arg == null) { + return validateAndBox(null, configuration) + } else if (arg is Boolean) { + return validateAndBox(arg, configuration) + } else if (arg is String) { + return validateAndBox(arg, configuration) + } else if (arg is Number) { + return validateAndBox(arg, configuration) + } else if (arg is List<*>) { + return validateAndBox(arg, configuration) + } else if (arg is Map<*, *>) { + return validateAndBox(arg, configuration) + } + throw ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema") + } + } +} diff --git a/samples/client/3_1_0_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/schemas/UnevaluatedpropertiesSchema.kt b/samples/client/3_1_0_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/schemas/UnevaluatedpropertiesSchema.kt new file mode 100644 index 00000000000..86fd9e41172 --- /dev/null +++ b/samples/client/3_1_0_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/schemas/UnevaluatedpropertiesSchema.kt @@ -0,0 +1,177 @@ +package org.openapijsonschematools.client.components.schemas +import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags +import org.openapijsonschematools.client.configurations.SchemaConfiguration +import org.openapijsonschematools.client.exceptions.InvalidAdditionalPropertyException +import org.openapijsonschematools.client.exceptions.UnsetPropertyException +import org.openapijsonschematools.client.exceptions.ValidationException +import org.openapijsonschematools.client.schemas.UnsetAddPropsSetter +import org.openapijsonschematools.client.schemas.validation.FrozenMap +import org.openapijsonschematools.client.schemas.validation.JsonSchema +import org.openapijsonschematools.client.schemas.validation.JsonSchemaInfo +import org.openapijsonschematools.client.schemas.validation.MapSchemaValidator +import org.openapijsonschematools.client.schemas.validation.PathToSchemasMap +import org.openapijsonschematools.client.schemas.validation.StringSchemaValidator +import org.openapijsonschematools.client.schemas.validation.ValidationMetadata + +class UnevaluatedpropertiesSchema { + // nest classes so all schemas and input/output classes can be public + + + sealed interface UnevaluatedPropertiesBoxed { + fun getData(): Any? + } + + data class UnevaluatedPropertiesBoxedString(val data: String) : UnevaluatedPropertiesBoxed { + override fun getData(): Any? { + return data + } + } + + + + class UnevaluatedProperties private constructor(): JsonSchema( + JsonSchemaInfo() + .type(setOf( + String::class.java + )) + .minLength(3) + ), StringSchemaValidator { + + companion object { + @Volatile + private var instance: UnevaluatedProperties? = null + + fun getInstance() = + instance ?: synchronized(this) { + instance ?: UnevaluatedProperties().also { instance = it } + } + } + + @Throws(ValidationException::class) + override fun validate(arg: String, configuration: SchemaConfiguration?): String { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, PathToSchemasMap(), LinkedHashSet()) + getPathToSchemas(this, castArg, validationMetadata, pathSet) + return castArg + } + + @Throws(ValidationException::class) + override fun validate(arg: Any?, configuration: SchemaConfiguration?): Any? { + if (arg is String) { + return validate(arg, configuration) + } + throw ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema") + } + override fun getNewInstance(arg: Any?, pathToItem: List, pathToSchemas: PathToSchemasMap): Any? { + if (arg is String) { + return getNewInstance(arg, pathToItem, pathToSchemas) + } + throw RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema") + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: String, configuration: SchemaConfiguration?): UnevaluatedPropertiesBoxedString { + return UnevaluatedPropertiesBoxedString(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: Any?, configuration: SchemaConfiguration?): UnevaluatedPropertiesBoxed { + if (arg is String) { + return validateAndBox(arg, configuration) + } + throw ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema") + } + } + + sealed interface UnevaluatedpropertiesSchema1Boxed { + fun getData(): Any? + } + + data class UnevaluatedpropertiesSchema1BoxedMap(val data: FrozenMap) : UnevaluatedpropertiesSchema1Boxed { + override fun getData(): Any? { + return data + } + } + + + class UnevaluatedpropertiesSchema1 private constructor(): JsonSchema( + JsonSchemaInfo() + .type(setOf(Map::class.java)) + .unevaluatedProperties(UnevaluatedProperties::class.java) + ), MapSchemaValidator, UnevaluatedpropertiesSchema1BoxedMap> { + /* + NOTE: This class is auto generated by OpenAPI JSON Schema Generator. + Ref: https://github.com/openapi-json-schema-tools/openapi-json-schema-generator + + Do not edit the class manually. + */ + + companion object { + @Volatile + private var instance: UnevaluatedpropertiesSchema1? = null + + fun getInstance() = + instance ?: synchronized(this) { + instance ?: UnevaluatedpropertiesSchema1().also { instance = it } + } + } + + override fun getNewInstance(arg: Map<*, *>, pathToItem: List, pathToSchemas: PathToSchemasMap): FrozenMap { + val properties: LinkedHashMap = LinkedHashMap() + for((entryKey, value) in arg) { + if (!(entryKey is String)) { + throw RuntimeException("Invalid non-string key value") + } + val propertyPathToItem: List = pathToItem + entryKey + val schemas: LinkedHashMap, Nothing?>? = pathToSchemas.get(propertyPathToItem) + if (schemas == null) { + throw RuntimeException("Validation result is invalid, schemas must exist for a pathToItem") + } + val propertySchema: JsonSchema<*> = schemas.entries.iterator().next().key + val propertyInstance: Any? = propertySchema.getNewInstance(value, propertyPathToItem, pathToSchemas) + properties[entryKey] = propertyInstance + } + val castProperties: FrozenMap = FrozenMap(properties) + return castProperties + } + + @Throws(ValidationException::class) + override fun validate(arg: Map<*, *>, configuration: SchemaConfiguration?): FrozenMap { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, PathToSchemasMap(), LinkedHashSet()) + val pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet) + return getNewInstance(castArg, validationMetadata.pathToItem, pathToSchemasMap) + } + + + @Throws(ValidationException::class) + override fun validate(arg: Any?, configuration: SchemaConfiguration?): Any? { + if (arg is Map<*, *>) { + return validate(arg, configuration) + } + throw ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema") + } + override fun getNewInstance(arg: Any?, pathToItem: List, pathToSchemas: PathToSchemasMap): Any? { + if (arg is Map<*, *>) { + return getNewInstance(arg, pathToItem, pathToSchemas) + } + throw RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema") + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: Map<*, *>, configuration: SchemaConfiguration?): UnevaluatedpropertiesSchema1BoxedMap { + return UnevaluatedpropertiesSchema1BoxedMap(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: Any?, configuration: SchemaConfiguration?): UnevaluatedpropertiesSchema1Boxed { + if (arg is Map<*, *>) { + return validateAndBox(arg, configuration) + } + throw ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema") + } + } + +} diff --git a/samples/client/3_1_0_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/schemas/UnevaluatedpropertiesWithAdjacentAdditionalproperties.kt b/samples/client/3_1_0_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/schemas/UnevaluatedpropertiesWithAdjacentAdditionalproperties.kt new file mode 100644 index 00000000000..e3e330a2380 --- /dev/null +++ b/samples/client/3_1_0_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/schemas/UnevaluatedpropertiesWithAdjacentAdditionalproperties.kt @@ -0,0 +1,302 @@ +package org.openapijsonschematools.client.components.schemas +import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags +import org.openapijsonschematools.client.configurations.SchemaConfiguration +import org.openapijsonschematools.client.exceptions.InvalidAdditionalPropertyException +import org.openapijsonschematools.client.exceptions.UnsetPropertyException +import org.openapijsonschematools.client.exceptions.ValidationException +import org.openapijsonschematools.client.schemas.AnyTypeJsonSchema +import org.openapijsonschematools.client.schemas.GenericBuilder +import org.openapijsonschematools.client.schemas.NotAnyTypeJsonSchema +import org.openapijsonschematools.client.schemas.StringJsonSchema +import org.openapijsonschematools.client.schemas.validation.FrozenMap +import org.openapijsonschematools.client.schemas.validation.JsonSchema +import org.openapijsonschematools.client.schemas.validation.JsonSchemaInfo +import org.openapijsonschematools.client.schemas.validation.MapSchemaValidator +import org.openapijsonschematools.client.schemas.validation.MapUtils +import org.openapijsonschematools.client.schemas.validation.PathToSchemasMap +import org.openapijsonschematools.client.schemas.validation.ValidationMetadata + +class UnevaluatedpropertiesWithAdjacentAdditionalproperties { + // nest classes so all schemas and input/output classes can be public + + + class AdditionalProperties : AnyTypeJsonSchema.AnyTypeJsonSchema1() { + companion object { + @Volatile + private var instance: AdditionalProperties? = null + + fun getInstance() = + instance ?: synchronized(this) { + instance ?: AdditionalProperties().also { instance = it } + } + } + } + + + class Foo : StringJsonSchema.StringJsonSchema1() { + companion object { + @Volatile + private var instance: Foo? = null + + fun getInstance() = + instance ?: synchronized(this) { + instance ?: Foo().also { instance = it } + } + } + } + + + class UnevaluatedpropertiesWithAdjacentAdditionalpropertiesMap(m: FrozenMap) : FrozenMap(m) { + companion object { + val requiredKeys: Set = setOf() + val optionalKeys: Set = setOf( + "foo" + ) + @Throws(ValidationException::class) + fun of(arg: Map, configuration: SchemaConfiguration): UnevaluatedpropertiesWithAdjacentAdditionalpropertiesMap { + return UnevaluatedpropertiesWithAdjacentAdditionalproperties1.getInstance().validate(arg, configuration) + } + } + + @Throws(UnsetPropertyException::class) + fun foo(): String { + val key = "foo" + throwIfKeyNotPresent(key) + val value: Any? = get(key) + if (!(value is String)) { + throw RuntimeException("Invalid value stored for foo") + } + return value + } + + @Throws(UnsetPropertyException::class, InvalidAdditionalPropertyException::class) + fun getAdditionalProperty(name: String): Any? { + throwIfKeyKnown(name, requiredKeys, optionalKeys) + return getOrThrow(name) + } + } + + interface SetterForFoo { + fun getInstance(): MutableMap + fun getBuilderAfterFoo(instance: MutableMap): T + + fun foo(value: String): T { + val instance = getInstance() + instance["foo"] = value + return getBuilderAfterFoo(instance) + } + } + + interface SetterForAdditionalProperties { + fun getKnownKeys(): Set + fun getInstance(): MutableMap + fun getBuilderAfterAdditionalProperty(instance: MutableMap): T + + @Throws(InvalidAdditionalPropertyException::class) + fun additionalProperty(key: String, value: Nothing?): T { + MapUtils.throwIfKeyKnown(key, getKnownKeys(), true) + val instance = getInstance() + instance[key] = null + return getBuilderAfterAdditionalProperty(instance) + } + + @Throws(InvalidAdditionalPropertyException::class) + fun additionalProperty(key: String, value: Boolean): T { + MapUtils.throwIfKeyKnown(key, getKnownKeys(), true) + val instance = getInstance() + instance[key] = value + return getBuilderAfterAdditionalProperty(instance) + } + + @Throws(InvalidAdditionalPropertyException::class) + fun additionalProperty(key: String, value: String): T { + MapUtils.throwIfKeyKnown(key, getKnownKeys(), true) + val instance = getInstance() + instance[key] = value + return getBuilderAfterAdditionalProperty(instance) + } + + @Throws(InvalidAdditionalPropertyException::class) + fun additionalProperty(key: String, value: Int): T { + MapUtils.throwIfKeyKnown(key, getKnownKeys(), true) + val instance = getInstance() + instance[key] = value + return getBuilderAfterAdditionalProperty(instance) + } + + @Throws(InvalidAdditionalPropertyException::class) + fun additionalProperty(key: String, value: Float): T { + MapUtils.throwIfKeyKnown(key, getKnownKeys(), true) + val instance = getInstance() + instance[key] = value + return getBuilderAfterAdditionalProperty(instance) + } + + @Throws(InvalidAdditionalPropertyException::class) + fun additionalProperty(key: String, value: Long): T { + MapUtils.throwIfKeyKnown(key, getKnownKeys(), true) + val instance = getInstance() + instance[key] = value + return getBuilderAfterAdditionalProperty(instance) + } + + @Throws(InvalidAdditionalPropertyException::class) + fun additionalProperty(key: String, value: Double): T { + MapUtils.throwIfKeyKnown(key, getKnownKeys(), true) + val instance = getInstance() + instance[key] = value + return getBuilderAfterAdditionalProperty(instance) + } + + @Throws(InvalidAdditionalPropertyException::class) + fun additionalProperty(key: String, value: List): T { + MapUtils.throwIfKeyKnown(key, getKnownKeys(), true) + val instance = getInstance() + instance[key] = value + return getBuilderAfterAdditionalProperty(instance) + } + + @Throws(InvalidAdditionalPropertyException::class) + fun additionalProperty(key: String, value: Map): T { + MapUtils.throwIfKeyKnown(key, getKnownKeys(), true) + val instance = getInstance() + instance[key] = value + return getBuilderAfterAdditionalProperty(instance) + } + } + + class UnevaluatedpropertiesWithAdjacentAdditionalpropertiesMapBuilder: GenericBuilder>, SetterForFoo, SetterForAdditionalProperties { + private val knownKeys: Set = setOf( + "foo" + ) + override fun getKnownKeys(): Set { + return knownKeys + } + private val instance: MutableMap + init { + this.instance = LinkedHashMap() + } + override fun build(): Map { + return instance + } + override fun getInstance(): MutableMap { + return instance + } + override fun getBuilderAfterFoo(instance: MutableMap): UnevaluatedpropertiesWithAdjacentAdditionalpropertiesMapBuilder { + return this + } + override fun getBuilderAfterAdditionalProperty(instance: MutableMap): UnevaluatedpropertiesWithAdjacentAdditionalpropertiesMapBuilder { + return this + } + } + + + class UnevaluatedProperties : NotAnyTypeJsonSchema.NotAnyTypeJsonSchema1() { + // NotAnyTypeSchema + companion object { + @Volatile + private var instance: UnevaluatedProperties? = null + + fun getInstance() = + instance ?: synchronized(this) { + instance ?: UnevaluatedProperties().also { instance = it } + } + } + } + + + sealed interface UnevaluatedpropertiesWithAdjacentAdditionalproperties1Boxed { + fun getData(): Any? + } + + data class UnevaluatedpropertiesWithAdjacentAdditionalproperties1BoxedMap(val data: UnevaluatedpropertiesWithAdjacentAdditionalpropertiesMap) : UnevaluatedpropertiesWithAdjacentAdditionalproperties1Boxed { + override fun getData(): Any? { + return data + } + } + + + class UnevaluatedpropertiesWithAdjacentAdditionalproperties1 private constructor(): JsonSchema( + JsonSchemaInfo() + .type(setOf(Map::class.java)) + .properties(mapOf( + "foo" to Foo::class.java + )) + .additionalProperties(AdditionalProperties::class.java) + .unevaluatedProperties(UnevaluatedProperties::class.java) + ), MapSchemaValidator { + /* + NOTE: This class is auto generated by OpenAPI JSON Schema Generator. + Ref: https://github.com/openapi-json-schema-tools/openapi-json-schema-generator + + Do not edit the class manually. + */ + + companion object { + @Volatile + private var instance: UnevaluatedpropertiesWithAdjacentAdditionalproperties1? = null + + fun getInstance() = + instance ?: synchronized(this) { + instance ?: UnevaluatedpropertiesWithAdjacentAdditionalproperties1().also { instance = it } + } + } + + override fun getNewInstance(arg: Map<*, *>, pathToItem: List, pathToSchemas: PathToSchemasMap): UnevaluatedpropertiesWithAdjacentAdditionalpropertiesMap { + val properties: LinkedHashMap = LinkedHashMap() + for((entryKey, value) in arg) { + if (!(entryKey is String)) { + throw RuntimeException("Invalid non-string key value") + } + val propertyPathToItem: List = pathToItem + entryKey + val schemas: LinkedHashMap, Nothing?>? = pathToSchemas.get(propertyPathToItem) + if (schemas == null) { + throw RuntimeException("Validation result is invalid, schemas must exist for a pathToItem") + } + val propertySchema: JsonSchema<*> = schemas.entries.iterator().next().key + val propertyInstance: Any? = propertySchema.getNewInstance(value, propertyPathToItem, pathToSchemas) + properties[entryKey] = propertyInstance + } + val castProperties: FrozenMap = FrozenMap(properties) + return UnevaluatedpropertiesWithAdjacentAdditionalpropertiesMap(castProperties) + } + + @Throws(ValidationException::class) + override fun validate(arg: Map<*, *>, configuration: SchemaConfiguration?): UnevaluatedpropertiesWithAdjacentAdditionalpropertiesMap { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, PathToSchemasMap(), LinkedHashSet()) + val pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet) + return getNewInstance(castArg, validationMetadata.pathToItem, pathToSchemasMap) + } + + + @Throws(ValidationException::class) + override fun validate(arg: Any?, configuration: SchemaConfiguration?): Any? { + if (arg is Map<*, *>) { + return validate(arg, configuration) + } + throw ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema") + } + override fun getNewInstance(arg: Any?, pathToItem: List, pathToSchemas: PathToSchemasMap): Any? { + if (arg is Map<*, *>) { + return getNewInstance(arg, pathToItem, pathToSchemas) + } + throw RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema") + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: Map<*, *>, configuration: SchemaConfiguration?): UnevaluatedpropertiesWithAdjacentAdditionalproperties1BoxedMap { + return UnevaluatedpropertiesWithAdjacentAdditionalproperties1BoxedMap(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: Any?, configuration: SchemaConfiguration?): UnevaluatedpropertiesWithAdjacentAdditionalproperties1Boxed { + if (arg is Map<*, *>) { + return validateAndBox(arg, configuration) + } + throw ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema") + } + } + +} diff --git a/samples/client/3_1_0_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/schemas/UnevaluatedpropertiesWithNullValuedInstanceProperties.kt b/samples/client/3_1_0_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/schemas/UnevaluatedpropertiesWithNullValuedInstanceProperties.kt new file mode 100644 index 00000000000..0d7fe4b2706 --- /dev/null +++ b/samples/client/3_1_0_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/schemas/UnevaluatedpropertiesWithNullValuedInstanceProperties.kt @@ -0,0 +1,322 @@ +package org.openapijsonschematools.client.components.schemas +import java.time.LocalDate +import java.time.ZonedDateTime +import java.util.UUID +import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags +import org.openapijsonschematools.client.configurations.SchemaConfiguration +import org.openapijsonschematools.client.exceptions.InvalidAdditionalPropertyException +import org.openapijsonschematools.client.exceptions.UnsetPropertyException +import org.openapijsonschematools.client.exceptions.ValidationException +import org.openapijsonschematools.client.schemas.NullJsonSchema +import org.openapijsonschematools.client.schemas.UnsetAddPropsSetter +import org.openapijsonschematools.client.schemas.validation.BooleanSchemaValidator +import org.openapijsonschematools.client.schemas.validation.FrozenList +import org.openapijsonschematools.client.schemas.validation.FrozenMap +import org.openapijsonschematools.client.schemas.validation.JsonSchema +import org.openapijsonschematools.client.schemas.validation.JsonSchemaInfo +import org.openapijsonschematools.client.schemas.validation.ListSchemaValidator +import org.openapijsonschematools.client.schemas.validation.MapSchemaValidator +import org.openapijsonschematools.client.schemas.validation.NullSchemaValidator +import org.openapijsonschematools.client.schemas.validation.NumberSchemaValidator +import org.openapijsonschematools.client.schemas.validation.PathToSchemasMap +import org.openapijsonschematools.client.schemas.validation.StringSchemaValidator +import org.openapijsonschematools.client.schemas.validation.ValidationMetadata + +class UnevaluatedpropertiesWithNullValuedInstanceProperties { + // nest classes so all schemas and input/output classes can be public + + + class UnevaluatedProperties : NullJsonSchema.NullJsonSchema1() { + companion object { + @Volatile + private var instance: UnevaluatedProperties? = null + + fun getInstance() = + instance ?: synchronized(this) { + instance ?: UnevaluatedProperties().also { instance = it } + } + } + } + + + sealed interface UnevaluatedpropertiesWithNullValuedInstanceProperties1Boxed { + fun getData(): Any? + } + + data class UnevaluatedpropertiesWithNullValuedInstanceProperties1BoxedVoid(val data: Nothing?) : UnevaluatedpropertiesWithNullValuedInstanceProperties1Boxed { + override fun getData(): Any? { + return data + } + } + + data class UnevaluatedpropertiesWithNullValuedInstanceProperties1BoxedBoolean(val data: Boolean): UnevaluatedpropertiesWithNullValuedInstanceProperties1Boxed { + override fun getData(): Any? { + return data + } + } + + data class UnevaluatedpropertiesWithNullValuedInstanceProperties1BoxedNumber(val data: Number) : UnevaluatedpropertiesWithNullValuedInstanceProperties1Boxed { + override fun getData(): Any? { + return data + } + } + + data class UnevaluatedpropertiesWithNullValuedInstanceProperties1BoxedString(val data: String) : UnevaluatedpropertiesWithNullValuedInstanceProperties1Boxed { + override fun getData(): Any? { + return data + } + } + + data class UnevaluatedpropertiesWithNullValuedInstanceProperties1BoxedList(val data: FrozenList) : UnevaluatedpropertiesWithNullValuedInstanceProperties1Boxed { + override fun getData(): Any? { + return data + } + } + + data class UnevaluatedpropertiesWithNullValuedInstanceProperties1BoxedMap(val data: FrozenMap) : UnevaluatedpropertiesWithNullValuedInstanceProperties1Boxed { + override fun getData(): Any? { + return data + } + } + + + class UnevaluatedpropertiesWithNullValuedInstanceProperties1 private constructor(): JsonSchema( + JsonSchemaInfo() + .unevaluatedProperties(UnevaluatedProperties::class.java) + ), NullSchemaValidator, BooleanSchemaValidator, NumberSchemaValidator, StringSchemaValidator, ListSchemaValidator, UnevaluatedpropertiesWithNullValuedInstanceProperties1BoxedList>, MapSchemaValidator, UnevaluatedpropertiesWithNullValuedInstanceProperties1BoxedMap> { + /* + NOTE: This class is auto generated by OpenAPI JSON Schema Generator. + Ref: https://github.com/openapi-json-schema-tools/openapi-json-schema-generator + + Do not edit the class manually. + */ + + companion object { + @Volatile + private var instance: UnevaluatedpropertiesWithNullValuedInstanceProperties1? = null + + fun getInstance() = + instance ?: synchronized(this) { + instance ?: UnevaluatedpropertiesWithNullValuedInstanceProperties1().also { instance = it } + } + } + + @Throws(ValidationException::class) + override fun validate(arg: Nothing?, configuration: SchemaConfiguration?): Nothing? { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validatedPathToSchemas = PathToSchemasMap() + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, LinkedHashSet()) + getPathToSchemas(this, castArg, validationMetadata, pathSet) + return castArg + } + + @Throws(ValidationException::class) + override fun validate(arg: Boolean, configuration: SchemaConfiguration?): Boolean { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validatedPathToSchemas = PathToSchemasMap() + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, LinkedHashSet()) + getPathToSchemas(this, castArg, validationMetadata, pathSet) + return castArg + } + + @Throws(ValidationException::class) + override fun validate(arg: Number, configuration: SchemaConfiguration?): Number { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validatedPathToSchemas = PathToSchemasMap() + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, LinkedHashSet()) + getPathToSchemas(this, castArg, validationMetadata, pathSet) + return castArg + } + + @Throws(ValidationException::class) + fun validate(arg: Int, configuration: SchemaConfiguration?): Int { + return validate(arg as Number, configuration) as Int + } + + @Throws(ValidationException::class) + fun validate(arg: Long, configuration: SchemaConfiguration?): Long { + return validate(arg as Number, configuration) as Long + } + + @Throws(ValidationException::class) + fun validate(arg: Float, configuration: SchemaConfiguration?): Float { + return validate(arg as Number, configuration) as Float + } + + @Throws(ValidationException::class) + fun validate(arg: Double, configuration: SchemaConfiguration?): Double { + return validate(arg as Number, configuration) as Double + } + + @Throws(ValidationException::class) + override fun validate(arg: String, configuration: SchemaConfiguration?): String { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validatedPathToSchemas = PathToSchemasMap() + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, LinkedHashSet()) + getPathToSchemas(this, castArg, validationMetadata, pathSet) + return castArg + } + + @Throws(ValidationException::class) + fun validate(arg: LocalDate, configuration: SchemaConfiguration?): String { + return validate(arg.toString(), configuration) + } + + @Throws(ValidationException::class) + fun validate(arg: ZonedDateTime, configuration: SchemaConfiguration?): String { + return validate(arg.toString(), configuration) + } + + @Throws(ValidationException::class) + fun validate(arg: UUID, configuration: SchemaConfiguration?): String { + return validate(arg.toString(), configuration) + } + + override fun getNewInstance(arg: List<*>, pathToItem: List, pathToSchemas: PathToSchemasMap): FrozenList { + val items: MutableList = ArrayList() + var i: Int = 0 + for (item: Any? in arg) { + val itemPathToItem = pathToItem + i + val schemas: LinkedHashMap, Nothing?>? = pathToSchemas.get(itemPathToItem) + if (schemas == null) { + throw RuntimeException("Validation result is invalid, schemas must exist for a pathToItem") + } + val itemSchema: JsonSchema<*> = schemas.entries.iterator().next().key + val itemInstance: Any? = itemSchema.getNewInstance(item, itemPathToItem, pathToSchemas) + items.add(itemInstance) + i += 1 + } + val newInstanceItems: FrozenList = FrozenList(items) + return newInstanceItems + } + + @Throws(ValidationException::class) + override fun validate(arg: List<*>, configuration: SchemaConfiguration?): FrozenList { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, PathToSchemasMap(), LinkedHashSet()) + val pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet) + return getNewInstance(castArg, validationMetadata.pathToItem, pathToSchemasMap) + } + + override fun getNewInstance(arg: Map<*, *>, pathToItem: List, pathToSchemas: PathToSchemasMap): FrozenMap { + val properties: LinkedHashMap = LinkedHashMap() + for((propertyName, value) in arg) { + if (!(propertyName is String)) { + throw RuntimeException("Invalid non-string key value") + } + val propertyPathToItem: List = pathToItem + propertyName + val schemas: LinkedHashMap, Nothing?>? = pathToSchemas.get(propertyPathToItem) + if (schemas == null) { + throw RuntimeException("Validation result is invalid, schemas must exist for a pathToItem") + } + val propertySchema: JsonSchema<*> = schemas.entries.iterator().next().key + val propertyInstance: Any? = propertySchema.getNewInstance(value, propertyPathToItem, pathToSchemas) + properties[propertyName] = propertyInstance + } + val castProperties: FrozenMap = FrozenMap(properties) + return castProperties + } + + @Throws(ValidationException::class) + override fun validate(arg: Map<*, *>, configuration: SchemaConfiguration?): FrozenMap { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validatedPathToSchemas = PathToSchemasMap() + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, LinkedHashSet()) + val pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet) + return getNewInstance(castArg, validationMetadata.pathToItem, pathToSchemasMap) + } + + @Throws(ValidationException::class) + override fun validate(arg: Any?, configuration: SchemaConfiguration?): Any? { + if (arg == null) { + return validate(null, configuration) + } else if (arg is Boolean) { + return validate(arg, configuration) + } else if (arg is Number) { + return validate(arg, configuration) + } else if (arg is String) { + return validate(arg, configuration) + } else if (arg is List<*>) { + return validate(arg, configuration) + } else if (arg is Map<*, *>) { + return validate(arg, configuration) + } + throw ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema") + } + override fun getNewInstance(arg: Any?, pathToItem: List, pathToSchemas: PathToSchemasMap): Any? { + if (arg == null) { + return getNewInstance( null, pathToItem, pathToSchemas) + } else if (arg is Boolean) { + return getNewInstance(arg, pathToItem, pathToSchemas) + } else if (arg is Number) { + return getNewInstance(arg, pathToItem, pathToSchemas) + } else if (arg is String) { + return getNewInstance(arg, pathToItem, pathToSchemas) + } else if (arg is List<*>) { + return getNewInstance(arg, pathToItem, pathToSchemas) + } else if (arg is Map<*, *>) { + return getNewInstance(arg, pathToItem, pathToSchemas) + } + throw RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema") + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: Nothing?, configuration: SchemaConfiguration?): UnevaluatedpropertiesWithNullValuedInstanceProperties1BoxedVoid { + return UnevaluatedpropertiesWithNullValuedInstanceProperties1BoxedVoid(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: Boolean, configuration: SchemaConfiguration?): UnevaluatedpropertiesWithNullValuedInstanceProperties1BoxedBoolean { + return UnevaluatedpropertiesWithNullValuedInstanceProperties1BoxedBoolean(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: Number, configuration: SchemaConfiguration?): UnevaluatedpropertiesWithNullValuedInstanceProperties1BoxedNumber { + return UnevaluatedpropertiesWithNullValuedInstanceProperties1BoxedNumber(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: String, configuration: SchemaConfiguration?): UnevaluatedpropertiesWithNullValuedInstanceProperties1BoxedString { + return UnevaluatedpropertiesWithNullValuedInstanceProperties1BoxedString(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: List<*>, configuration: SchemaConfiguration?): UnevaluatedpropertiesWithNullValuedInstanceProperties1BoxedList { + return UnevaluatedpropertiesWithNullValuedInstanceProperties1BoxedList(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: Map<*, *>, configuration: SchemaConfiguration?): UnevaluatedpropertiesWithNullValuedInstanceProperties1BoxedMap { + return UnevaluatedpropertiesWithNullValuedInstanceProperties1BoxedMap(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: Any?, configuration: SchemaConfiguration?): UnevaluatedpropertiesWithNullValuedInstanceProperties1Boxed { + if (arg == null) { + return validateAndBox(null, configuration) + } else if (arg is Boolean) { + return validateAndBox(arg, configuration) + } else if (arg is String) { + return validateAndBox(arg, configuration) + } else if (arg is Number) { + return validateAndBox(arg, configuration) + } else if (arg is List<*>) { + return validateAndBox(arg, configuration) + } else if (arg is Map<*, *>) { + return validateAndBox(arg, configuration) + } + throw ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema") + } + } +} diff --git a/samples/client/3_1_0_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/schemas/UniqueitemsFalseValidation.kt b/samples/client/3_1_0_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/schemas/UniqueitemsFalseValidation.kt new file mode 100644 index 00000000000..525bbb087f7 --- /dev/null +++ b/samples/client/3_1_0_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/schemas/UniqueitemsFalseValidation.kt @@ -0,0 +1,308 @@ +package org.openapijsonschematools.client.components.schemas +import java.time.LocalDate +import java.time.ZonedDateTime +import java.util.UUID +import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags +import org.openapijsonschematools.client.configurations.SchemaConfiguration +import org.openapijsonschematools.client.exceptions.InvalidAdditionalPropertyException +import org.openapijsonschematools.client.exceptions.UnsetPropertyException +import org.openapijsonschematools.client.exceptions.ValidationException +import org.openapijsonschematools.client.schemas.UnsetAddPropsSetter +import org.openapijsonschematools.client.schemas.validation.BooleanSchemaValidator +import org.openapijsonschematools.client.schemas.validation.FrozenList +import org.openapijsonschematools.client.schemas.validation.FrozenMap +import org.openapijsonschematools.client.schemas.validation.JsonSchema +import org.openapijsonschematools.client.schemas.validation.JsonSchemaInfo +import org.openapijsonschematools.client.schemas.validation.ListSchemaValidator +import org.openapijsonschematools.client.schemas.validation.MapSchemaValidator +import org.openapijsonschematools.client.schemas.validation.NullSchemaValidator +import org.openapijsonschematools.client.schemas.validation.NumberSchemaValidator +import org.openapijsonschematools.client.schemas.validation.PathToSchemasMap +import org.openapijsonschematools.client.schemas.validation.StringSchemaValidator +import org.openapijsonschematools.client.schemas.validation.ValidationMetadata + +class UniqueitemsFalseValidation { + // nest classes so all schemas and input/output classes can be public + + + sealed interface UniqueitemsFalseValidation1Boxed { + fun getData(): Any? + } + + data class UniqueitemsFalseValidation1BoxedVoid(val data: Nothing?) : UniqueitemsFalseValidation1Boxed { + override fun getData(): Any? { + return data + } + } + + data class UniqueitemsFalseValidation1BoxedBoolean(val data: Boolean): UniqueitemsFalseValidation1Boxed { + override fun getData(): Any? { + return data + } + } + + data class UniqueitemsFalseValidation1BoxedNumber(val data: Number) : UniqueitemsFalseValidation1Boxed { + override fun getData(): Any? { + return data + } + } + + data class UniqueitemsFalseValidation1BoxedString(val data: String) : UniqueitemsFalseValidation1Boxed { + override fun getData(): Any? { + return data + } + } + + data class UniqueitemsFalseValidation1BoxedList(val data: FrozenList) : UniqueitemsFalseValidation1Boxed { + override fun getData(): Any? { + return data + } + } + + data class UniqueitemsFalseValidation1BoxedMap(val data: FrozenMap) : UniqueitemsFalseValidation1Boxed { + override fun getData(): Any? { + return data + } + } + + + class UniqueitemsFalseValidation1 private constructor(): JsonSchema( + JsonSchemaInfo() + .uniqueItems(false) + ), NullSchemaValidator, BooleanSchemaValidator, NumberSchemaValidator, StringSchemaValidator, ListSchemaValidator, UniqueitemsFalseValidation1BoxedList>, MapSchemaValidator, UniqueitemsFalseValidation1BoxedMap> { + /* + NOTE: This class is auto generated by OpenAPI JSON Schema Generator. + Ref: https://github.com/openapi-json-schema-tools/openapi-json-schema-generator + + Do not edit the class manually. + */ + + companion object { + @Volatile + private var instance: UniqueitemsFalseValidation1? = null + + fun getInstance() = + instance ?: synchronized(this) { + instance ?: UniqueitemsFalseValidation1().also { instance = it } + } + } + + @Throws(ValidationException::class) + override fun validate(arg: Nothing?, configuration: SchemaConfiguration?): Nothing? { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validatedPathToSchemas = PathToSchemasMap() + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, LinkedHashSet()) + getPathToSchemas(this, castArg, validationMetadata, pathSet) + return castArg + } + + @Throws(ValidationException::class) + override fun validate(arg: Boolean, configuration: SchemaConfiguration?): Boolean { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validatedPathToSchemas = PathToSchemasMap() + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, LinkedHashSet()) + getPathToSchemas(this, castArg, validationMetadata, pathSet) + return castArg + } + + @Throws(ValidationException::class) + override fun validate(arg: Number, configuration: SchemaConfiguration?): Number { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validatedPathToSchemas = PathToSchemasMap() + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, LinkedHashSet()) + getPathToSchemas(this, castArg, validationMetadata, pathSet) + return castArg + } + + @Throws(ValidationException::class) + fun validate(arg: Int, configuration: SchemaConfiguration?): Int { + return validate(arg as Number, configuration) as Int + } + + @Throws(ValidationException::class) + fun validate(arg: Long, configuration: SchemaConfiguration?): Long { + return validate(arg as Number, configuration) as Long + } + + @Throws(ValidationException::class) + fun validate(arg: Float, configuration: SchemaConfiguration?): Float { + return validate(arg as Number, configuration) as Float + } + + @Throws(ValidationException::class) + fun validate(arg: Double, configuration: SchemaConfiguration?): Double { + return validate(arg as Number, configuration) as Double + } + + @Throws(ValidationException::class) + override fun validate(arg: String, configuration: SchemaConfiguration?): String { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validatedPathToSchemas = PathToSchemasMap() + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, LinkedHashSet()) + getPathToSchemas(this, castArg, validationMetadata, pathSet) + return castArg + } + + @Throws(ValidationException::class) + fun validate(arg: LocalDate, configuration: SchemaConfiguration?): String { + return validate(arg.toString(), configuration) + } + + @Throws(ValidationException::class) + fun validate(arg: ZonedDateTime, configuration: SchemaConfiguration?): String { + return validate(arg.toString(), configuration) + } + + @Throws(ValidationException::class) + fun validate(arg: UUID, configuration: SchemaConfiguration?): String { + return validate(arg.toString(), configuration) + } + + override fun getNewInstance(arg: List<*>, pathToItem: List, pathToSchemas: PathToSchemasMap): FrozenList { + val items: MutableList = ArrayList() + var i: Int = 0 + for (item: Any? in arg) { + val itemPathToItem = pathToItem + i + val schemas: LinkedHashMap, Nothing?>? = pathToSchemas.get(itemPathToItem) + if (schemas == null) { + throw RuntimeException("Validation result is invalid, schemas must exist for a pathToItem") + } + val itemSchema: JsonSchema<*> = schemas.entries.iterator().next().key + val itemInstance: Any? = itemSchema.getNewInstance(item, itemPathToItem, pathToSchemas) + items.add(itemInstance) + i += 1 + } + val newInstanceItems: FrozenList = FrozenList(items) + return newInstanceItems + } + + @Throws(ValidationException::class) + override fun validate(arg: List<*>, configuration: SchemaConfiguration?): FrozenList { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, PathToSchemasMap(), LinkedHashSet()) + val pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet) + return getNewInstance(castArg, validationMetadata.pathToItem, pathToSchemasMap) + } + + override fun getNewInstance(arg: Map<*, *>, pathToItem: List, pathToSchemas: PathToSchemasMap): FrozenMap { + val properties: LinkedHashMap = LinkedHashMap() + for((propertyName, value) in arg) { + if (!(propertyName is String)) { + throw RuntimeException("Invalid non-string key value") + } + val propertyPathToItem: List = pathToItem + propertyName + val schemas: LinkedHashMap, Nothing?>? = pathToSchemas.get(propertyPathToItem) + if (schemas == null) { + throw RuntimeException("Validation result is invalid, schemas must exist for a pathToItem") + } + val propertySchema: JsonSchema<*> = schemas.entries.iterator().next().key + val propertyInstance: Any? = propertySchema.getNewInstance(value, propertyPathToItem, pathToSchemas) + properties[propertyName] = propertyInstance + } + val castProperties: FrozenMap = FrozenMap(properties) + return castProperties + } + + @Throws(ValidationException::class) + override fun validate(arg: Map<*, *>, configuration: SchemaConfiguration?): FrozenMap { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validatedPathToSchemas = PathToSchemasMap() + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, LinkedHashSet()) + val pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet) + return getNewInstance(castArg, validationMetadata.pathToItem, pathToSchemasMap) + } + + @Throws(ValidationException::class) + override fun validate(arg: Any?, configuration: SchemaConfiguration?): Any? { + if (arg == null) { + return validate(null, configuration) + } else if (arg is Boolean) { + return validate(arg, configuration) + } else if (arg is Number) { + return validate(arg, configuration) + } else if (arg is String) { + return validate(arg, configuration) + } else if (arg is List<*>) { + return validate(arg, configuration) + } else if (arg is Map<*, *>) { + return validate(arg, configuration) + } + throw ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema") + } + override fun getNewInstance(arg: Any?, pathToItem: List, pathToSchemas: PathToSchemasMap): Any? { + if (arg == null) { + return getNewInstance( null, pathToItem, pathToSchemas) + } else if (arg is Boolean) { + return getNewInstance(arg, pathToItem, pathToSchemas) + } else if (arg is Number) { + return getNewInstance(arg, pathToItem, pathToSchemas) + } else if (arg is String) { + return getNewInstance(arg, pathToItem, pathToSchemas) + } else if (arg is List<*>) { + return getNewInstance(arg, pathToItem, pathToSchemas) + } else if (arg is Map<*, *>) { + return getNewInstance(arg, pathToItem, pathToSchemas) + } + throw RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema") + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: Nothing?, configuration: SchemaConfiguration?): UniqueitemsFalseValidation1BoxedVoid { + return UniqueitemsFalseValidation1BoxedVoid(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: Boolean, configuration: SchemaConfiguration?): UniqueitemsFalseValidation1BoxedBoolean { + return UniqueitemsFalseValidation1BoxedBoolean(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: Number, configuration: SchemaConfiguration?): UniqueitemsFalseValidation1BoxedNumber { + return UniqueitemsFalseValidation1BoxedNumber(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: String, configuration: SchemaConfiguration?): UniqueitemsFalseValidation1BoxedString { + return UniqueitemsFalseValidation1BoxedString(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: List<*>, configuration: SchemaConfiguration?): UniqueitemsFalseValidation1BoxedList { + return UniqueitemsFalseValidation1BoxedList(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: Map<*, *>, configuration: SchemaConfiguration?): UniqueitemsFalseValidation1BoxedMap { + return UniqueitemsFalseValidation1BoxedMap(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: Any?, configuration: SchemaConfiguration?): UniqueitemsFalseValidation1Boxed { + if (arg == null) { + return validateAndBox(null, configuration) + } else if (arg is Boolean) { + return validateAndBox(arg, configuration) + } else if (arg is String) { + return validateAndBox(arg, configuration) + } else if (arg is Number) { + return validateAndBox(arg, configuration) + } else if (arg is List<*>) { + return validateAndBox(arg, configuration) + } else if (arg is Map<*, *>) { + return validateAndBox(arg, configuration) + } + throw ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema") + } + } +} diff --git a/samples/client/3_1_0_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/schemas/UniqueitemsFalseWithAnArrayOfItems.kt b/samples/client/3_1_0_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/schemas/UniqueitemsFalseWithAnArrayOfItems.kt new file mode 100644 index 00000000000..f123e252e5a --- /dev/null +++ b/samples/client/3_1_0_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/schemas/UniqueitemsFalseWithAnArrayOfItems.kt @@ -0,0 +1,408 @@ +package org.openapijsonschematools.client.components.schemas +import java.time.LocalDate +import java.time.ZonedDateTime +import java.util.UUID +import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags +import org.openapijsonschematools.client.configurations.SchemaConfiguration +import org.openapijsonschematools.client.exceptions.InvalidAdditionalPropertyException +import org.openapijsonschematools.client.exceptions.UnsetPropertyException +import org.openapijsonschematools.client.exceptions.ValidationException +import org.openapijsonschematools.client.schemas.BooleanJsonSchema +import org.openapijsonschematools.client.schemas.UnsetAddPropsSetter +import org.openapijsonschematools.client.schemas.validation.BooleanSchemaValidator +import org.openapijsonschematools.client.schemas.validation.FrozenList +import org.openapijsonschematools.client.schemas.validation.FrozenMap +import org.openapijsonschematools.client.schemas.validation.JsonSchema +import org.openapijsonschematools.client.schemas.validation.JsonSchemaInfo +import org.openapijsonschematools.client.schemas.validation.ListSchemaValidator +import org.openapijsonschematools.client.schemas.validation.MapSchemaValidator +import org.openapijsonschematools.client.schemas.validation.NullSchemaValidator +import org.openapijsonschematools.client.schemas.validation.NumberSchemaValidator +import org.openapijsonschematools.client.schemas.validation.PathToSchemasMap +import org.openapijsonschematools.client.schemas.validation.StringSchemaValidator +import org.openapijsonschematools.client.schemas.validation.ValidationMetadata + +class UniqueitemsFalseWithAnArrayOfItems { + // nest classes so all schemas and input/output classes can be public + + + class UniqueitemsFalseWithAnArrayOfItemsList(m: FrozenList) : FrozenList(m) { + companion object { + @Throws(ValidationException::class) + fun of(arg: List, configuration: SchemaConfiguration?): UniqueitemsFalseWithAnArrayOfItemsList { + return UniqueitemsFalseWithAnArrayOfItems1.getInstance().validate(arg, configuration) + } + } + } + + class UniqueitemsFalseWithAnArrayOfItemsListBuilder { + // class to build List + private val list: MutableList + + init { + this.list = ArrayList() + } + + + fun add(item: Nothing?): UniqueitemsFalseWithAnArrayOfItemsListBuilder { + list.add(null) + return this + } + + fun add(item: Boolean): UniqueitemsFalseWithAnArrayOfItemsListBuilder { + list.add(item) + return this + } + + fun add(item: String): UniqueitemsFalseWithAnArrayOfItemsListBuilder { + list.add(item) + return this + } + + fun add(item: Int): UniqueitemsFalseWithAnArrayOfItemsListBuilder { + list.add(item) + return this + } + + fun add(item: Float): UniqueitemsFalseWithAnArrayOfItemsListBuilder { + list.add(item) + return this + } + + fun add(item: Long): UniqueitemsFalseWithAnArrayOfItemsListBuilder { + list.add(item) + return this + } + + fun add(item: Double): UniqueitemsFalseWithAnArrayOfItemsListBuilder { + list.add(item) + return this + } + + fun add(item: List<*>): UniqueitemsFalseWithAnArrayOfItemsListBuilder { + list.add(item) + return this + } + + fun add(item: Map): UniqueitemsFalseWithAnArrayOfItemsListBuilder { + list.add(item) + return this + } + + fun build(): List { + return list + } + } + + + class Schema0 : BooleanJsonSchema.BooleanJsonSchema1() { + companion object { + @Volatile + private var instance: Schema0? = null + + fun getInstance() = + instance ?: synchronized(this) { + instance ?: Schema0().also { instance = it } + } + } + } + + + class Schema1 : BooleanJsonSchema.BooleanJsonSchema1() { + companion object { + @Volatile + private var instance: Schema1? = null + + fun getInstance() = + instance ?: synchronized(this) { + instance ?: Schema1().also { instance = it } + } + } + } + + + sealed interface UniqueitemsFalseWithAnArrayOfItems1Boxed { + fun getData(): Any? + } + + data class UniqueitemsFalseWithAnArrayOfItems1BoxedVoid(val data: Nothing?) : UniqueitemsFalseWithAnArrayOfItems1Boxed { + override fun getData(): Any? { + return data + } + } + + data class UniqueitemsFalseWithAnArrayOfItems1BoxedBoolean(val data: Boolean): UniqueitemsFalseWithAnArrayOfItems1Boxed { + override fun getData(): Any? { + return data + } + } + + data class UniqueitemsFalseWithAnArrayOfItems1BoxedNumber(val data: Number) : UniqueitemsFalseWithAnArrayOfItems1Boxed { + override fun getData(): Any? { + return data + } + } + + data class UniqueitemsFalseWithAnArrayOfItems1BoxedString(val data: String) : UniqueitemsFalseWithAnArrayOfItems1Boxed { + override fun getData(): Any? { + return data + } + } + + data class UniqueitemsFalseWithAnArrayOfItems1BoxedList(val data: UniqueitemsFalseWithAnArrayOfItemsList) : UniqueitemsFalseWithAnArrayOfItems1Boxed { + override fun getData(): Any? { + return data + } + } + + data class UniqueitemsFalseWithAnArrayOfItems1BoxedMap(val data: FrozenMap) : UniqueitemsFalseWithAnArrayOfItems1Boxed { + override fun getData(): Any? { + return data + } + } + + + class UniqueitemsFalseWithAnArrayOfItems1 private constructor(): JsonSchema( + JsonSchemaInfo() + .uniqueItems(false) + .prefixItems(listOf( + Schema0::class.java, + Schema1::class.java + )) + ), NullSchemaValidator, BooleanSchemaValidator, NumberSchemaValidator, StringSchemaValidator, ListSchemaValidator, MapSchemaValidator, UniqueitemsFalseWithAnArrayOfItems1BoxedMap> { + /* + NOTE: This class is auto generated by OpenAPI JSON Schema Generator. + Ref: https://github.com/openapi-json-schema-tools/openapi-json-schema-generator + + Do not edit the class manually. + */ + + companion object { + @Volatile + private var instance: UniqueitemsFalseWithAnArrayOfItems1? = null + + fun getInstance() = + instance ?: synchronized(this) { + instance ?: UniqueitemsFalseWithAnArrayOfItems1().also { instance = it } + } + } + + @Throws(ValidationException::class) + override fun validate(arg: Nothing?, configuration: SchemaConfiguration?): Nothing? { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validatedPathToSchemas = PathToSchemasMap() + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, LinkedHashSet()) + getPathToSchemas(this, castArg, validationMetadata, pathSet) + return castArg + } + + @Throws(ValidationException::class) + override fun validate(arg: Boolean, configuration: SchemaConfiguration?): Boolean { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validatedPathToSchemas = PathToSchemasMap() + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, LinkedHashSet()) + getPathToSchemas(this, castArg, validationMetadata, pathSet) + return castArg + } + + @Throws(ValidationException::class) + override fun validate(arg: Number, configuration: SchemaConfiguration?): Number { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validatedPathToSchemas = PathToSchemasMap() + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, LinkedHashSet()) + getPathToSchemas(this, castArg, validationMetadata, pathSet) + return castArg + } + + @Throws(ValidationException::class) + fun validate(arg: Int, configuration: SchemaConfiguration?): Int { + return validate(arg as Number, configuration) as Int + } + + @Throws(ValidationException::class) + fun validate(arg: Long, configuration: SchemaConfiguration?): Long { + return validate(arg as Number, configuration) as Long + } + + @Throws(ValidationException::class) + fun validate(arg: Float, configuration: SchemaConfiguration?): Float { + return validate(arg as Number, configuration) as Float + } + + @Throws(ValidationException::class) + fun validate(arg: Double, configuration: SchemaConfiguration?): Double { + return validate(arg as Number, configuration) as Double + } + + @Throws(ValidationException::class) + override fun validate(arg: String, configuration: SchemaConfiguration?): String { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validatedPathToSchemas = PathToSchemasMap() + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, LinkedHashSet()) + getPathToSchemas(this, castArg, validationMetadata, pathSet) + return castArg + } + + @Throws(ValidationException::class) + fun validate(arg: LocalDate, configuration: SchemaConfiguration?): String { + return validate(arg.toString(), configuration) + } + + @Throws(ValidationException::class) + fun validate(arg: ZonedDateTime, configuration: SchemaConfiguration?): String { + return validate(arg.toString(), configuration) + } + + @Throws(ValidationException::class) + fun validate(arg: UUID, configuration: SchemaConfiguration?): String { + return validate(arg.toString(), configuration) + } + + override fun getNewInstance(arg: List<*>, pathToItem: List, pathToSchemas: PathToSchemasMap): UniqueitemsFalseWithAnArrayOfItemsList { + val items: MutableList = ArrayList() + var i: Int = 0 + for (item: Any? in arg) { + val itemPathToItem = pathToItem + i + val schemas: LinkedHashMap, Nothing?>? = pathToSchemas.get(itemPathToItem) + if (schemas == null) { + throw RuntimeException("Validation result is invalid, schemas must exist for a pathToItem") + } + val itemSchema: JsonSchema<*> = schemas.entries.iterator().next().key + val itemInstance: Any? = itemSchema.getNewInstance(item, itemPathToItem, pathToSchemas) + items.add(itemInstance) + i += 1 + } + val newInstanceItems: FrozenList = FrozenList(items) + return UniqueitemsFalseWithAnArrayOfItemsList(newInstanceItems) + } + + @Throws(ValidationException::class) + override fun validate(arg: List<*>, configuration: SchemaConfiguration?): UniqueitemsFalseWithAnArrayOfItemsList { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, PathToSchemasMap(), LinkedHashSet()) + val pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet) + return getNewInstance(castArg, validationMetadata.pathToItem, pathToSchemasMap) + } + + override fun getNewInstance(arg: Map<*, *>, pathToItem: List, pathToSchemas: PathToSchemasMap): FrozenMap { + val properties: LinkedHashMap = LinkedHashMap() + for((propertyName, value) in arg) { + if (!(propertyName is String)) { + throw RuntimeException("Invalid non-string key value") + } + val propertyPathToItem: List = pathToItem + propertyName + val schemas: LinkedHashMap, Nothing?>? = pathToSchemas.get(propertyPathToItem) + if (schemas == null) { + throw RuntimeException("Validation result is invalid, schemas must exist for a pathToItem") + } + val propertySchema: JsonSchema<*> = schemas.entries.iterator().next().key + val propertyInstance: Any? = propertySchema.getNewInstance(value, propertyPathToItem, pathToSchemas) + properties[propertyName] = propertyInstance + } + val castProperties: FrozenMap = FrozenMap(properties) + return castProperties + } + + @Throws(ValidationException::class) + override fun validate(arg: Map<*, *>, configuration: SchemaConfiguration?): FrozenMap { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validatedPathToSchemas = PathToSchemasMap() + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, LinkedHashSet()) + val pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet) + return getNewInstance(castArg, validationMetadata.pathToItem, pathToSchemasMap) + } + + @Throws(ValidationException::class) + override fun validate(arg: Any?, configuration: SchemaConfiguration?): Any? { + if (arg == null) { + return validate(null, configuration) + } else if (arg is Boolean) { + return validate(arg, configuration) + } else if (arg is Number) { + return validate(arg, configuration) + } else if (arg is String) { + return validate(arg, configuration) + } else if (arg is List<*>) { + return validate(arg, configuration) + } else if (arg is Map<*, *>) { + return validate(arg, configuration) + } + throw ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema") + } + override fun getNewInstance(arg: Any?, pathToItem: List, pathToSchemas: PathToSchemasMap): Any? { + if (arg == null) { + return getNewInstance( null, pathToItem, pathToSchemas) + } else if (arg is Boolean) { + return getNewInstance(arg, pathToItem, pathToSchemas) + } else if (arg is Number) { + return getNewInstance(arg, pathToItem, pathToSchemas) + } else if (arg is String) { + return getNewInstance(arg, pathToItem, pathToSchemas) + } else if (arg is List<*>) { + return getNewInstance(arg, pathToItem, pathToSchemas) + } else if (arg is Map<*, *>) { + return getNewInstance(arg, pathToItem, pathToSchemas) + } + throw RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema") + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: Nothing?, configuration: SchemaConfiguration?): UniqueitemsFalseWithAnArrayOfItems1BoxedVoid { + return UniqueitemsFalseWithAnArrayOfItems1BoxedVoid(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: Boolean, configuration: SchemaConfiguration?): UniqueitemsFalseWithAnArrayOfItems1BoxedBoolean { + return UniqueitemsFalseWithAnArrayOfItems1BoxedBoolean(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: Number, configuration: SchemaConfiguration?): UniqueitemsFalseWithAnArrayOfItems1BoxedNumber { + return UniqueitemsFalseWithAnArrayOfItems1BoxedNumber(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: String, configuration: SchemaConfiguration?): UniqueitemsFalseWithAnArrayOfItems1BoxedString { + return UniqueitemsFalseWithAnArrayOfItems1BoxedString(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: List<*>, configuration: SchemaConfiguration?): UniqueitemsFalseWithAnArrayOfItems1BoxedList { + return UniqueitemsFalseWithAnArrayOfItems1BoxedList(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: Map<*, *>, configuration: SchemaConfiguration?): UniqueitemsFalseWithAnArrayOfItems1BoxedMap { + return UniqueitemsFalseWithAnArrayOfItems1BoxedMap(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: Any?, configuration: SchemaConfiguration?): UniqueitemsFalseWithAnArrayOfItems1Boxed { + if (arg == null) { + return validateAndBox(null, configuration) + } else if (arg is Boolean) { + return validateAndBox(arg, configuration) + } else if (arg is String) { + return validateAndBox(arg, configuration) + } else if (arg is Number) { + return validateAndBox(arg, configuration) + } else if (arg is List<*>) { + return validateAndBox(arg, configuration) + } else if (arg is Map<*, *>) { + return validateAndBox(arg, configuration) + } + throw ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema") + } + } +} diff --git a/samples/client/3_1_0_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/schemas/UniqueitemsValidation.kt b/samples/client/3_1_0_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/schemas/UniqueitemsValidation.kt new file mode 100644 index 00000000000..181ba3a42b5 --- /dev/null +++ b/samples/client/3_1_0_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/schemas/UniqueitemsValidation.kt @@ -0,0 +1,308 @@ +package org.openapijsonschematools.client.components.schemas +import java.time.LocalDate +import java.time.ZonedDateTime +import java.util.UUID +import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags +import org.openapijsonschematools.client.configurations.SchemaConfiguration +import org.openapijsonschematools.client.exceptions.InvalidAdditionalPropertyException +import org.openapijsonschematools.client.exceptions.UnsetPropertyException +import org.openapijsonschematools.client.exceptions.ValidationException +import org.openapijsonschematools.client.schemas.UnsetAddPropsSetter +import org.openapijsonschematools.client.schemas.validation.BooleanSchemaValidator +import org.openapijsonschematools.client.schemas.validation.FrozenList +import org.openapijsonschematools.client.schemas.validation.FrozenMap +import org.openapijsonschematools.client.schemas.validation.JsonSchema +import org.openapijsonschematools.client.schemas.validation.JsonSchemaInfo +import org.openapijsonschematools.client.schemas.validation.ListSchemaValidator +import org.openapijsonschematools.client.schemas.validation.MapSchemaValidator +import org.openapijsonschematools.client.schemas.validation.NullSchemaValidator +import org.openapijsonschematools.client.schemas.validation.NumberSchemaValidator +import org.openapijsonschematools.client.schemas.validation.PathToSchemasMap +import org.openapijsonschematools.client.schemas.validation.StringSchemaValidator +import org.openapijsonschematools.client.schemas.validation.ValidationMetadata + +class UniqueitemsValidation { + // nest classes so all schemas and input/output classes can be public + + + sealed interface UniqueitemsValidation1Boxed { + fun getData(): Any? + } + + data class UniqueitemsValidation1BoxedVoid(val data: Nothing?) : UniqueitemsValidation1Boxed { + override fun getData(): Any? { + return data + } + } + + data class UniqueitemsValidation1BoxedBoolean(val data: Boolean): UniqueitemsValidation1Boxed { + override fun getData(): Any? { + return data + } + } + + data class UniqueitemsValidation1BoxedNumber(val data: Number) : UniqueitemsValidation1Boxed { + override fun getData(): Any? { + return data + } + } + + data class UniqueitemsValidation1BoxedString(val data: String) : UniqueitemsValidation1Boxed { + override fun getData(): Any? { + return data + } + } + + data class UniqueitemsValidation1BoxedList(val data: FrozenList) : UniqueitemsValidation1Boxed { + override fun getData(): Any? { + return data + } + } + + data class UniqueitemsValidation1BoxedMap(val data: FrozenMap) : UniqueitemsValidation1Boxed { + override fun getData(): Any? { + return data + } + } + + + class UniqueitemsValidation1 private constructor(): JsonSchema( + JsonSchemaInfo() + .uniqueItems(true) + ), NullSchemaValidator, BooleanSchemaValidator, NumberSchemaValidator, StringSchemaValidator, ListSchemaValidator, UniqueitemsValidation1BoxedList>, MapSchemaValidator, UniqueitemsValidation1BoxedMap> { + /* + NOTE: This class is auto generated by OpenAPI JSON Schema Generator. + Ref: https://github.com/openapi-json-schema-tools/openapi-json-schema-generator + + Do not edit the class manually. + */ + + companion object { + @Volatile + private var instance: UniqueitemsValidation1? = null + + fun getInstance() = + instance ?: synchronized(this) { + instance ?: UniqueitemsValidation1().also { instance = it } + } + } + + @Throws(ValidationException::class) + override fun validate(arg: Nothing?, configuration: SchemaConfiguration?): Nothing? { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validatedPathToSchemas = PathToSchemasMap() + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, LinkedHashSet()) + getPathToSchemas(this, castArg, validationMetadata, pathSet) + return castArg + } + + @Throws(ValidationException::class) + override fun validate(arg: Boolean, configuration: SchemaConfiguration?): Boolean { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validatedPathToSchemas = PathToSchemasMap() + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, LinkedHashSet()) + getPathToSchemas(this, castArg, validationMetadata, pathSet) + return castArg + } + + @Throws(ValidationException::class) + override fun validate(arg: Number, configuration: SchemaConfiguration?): Number { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validatedPathToSchemas = PathToSchemasMap() + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, LinkedHashSet()) + getPathToSchemas(this, castArg, validationMetadata, pathSet) + return castArg + } + + @Throws(ValidationException::class) + fun validate(arg: Int, configuration: SchemaConfiguration?): Int { + return validate(arg as Number, configuration) as Int + } + + @Throws(ValidationException::class) + fun validate(arg: Long, configuration: SchemaConfiguration?): Long { + return validate(arg as Number, configuration) as Long + } + + @Throws(ValidationException::class) + fun validate(arg: Float, configuration: SchemaConfiguration?): Float { + return validate(arg as Number, configuration) as Float + } + + @Throws(ValidationException::class) + fun validate(arg: Double, configuration: SchemaConfiguration?): Double { + return validate(arg as Number, configuration) as Double + } + + @Throws(ValidationException::class) + override fun validate(arg: String, configuration: SchemaConfiguration?): String { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validatedPathToSchemas = PathToSchemasMap() + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, LinkedHashSet()) + getPathToSchemas(this, castArg, validationMetadata, pathSet) + return castArg + } + + @Throws(ValidationException::class) + fun validate(arg: LocalDate, configuration: SchemaConfiguration?): String { + return validate(arg.toString(), configuration) + } + + @Throws(ValidationException::class) + fun validate(arg: ZonedDateTime, configuration: SchemaConfiguration?): String { + return validate(arg.toString(), configuration) + } + + @Throws(ValidationException::class) + fun validate(arg: UUID, configuration: SchemaConfiguration?): String { + return validate(arg.toString(), configuration) + } + + override fun getNewInstance(arg: List<*>, pathToItem: List, pathToSchemas: PathToSchemasMap): FrozenList { + val items: MutableList = ArrayList() + var i: Int = 0 + for (item: Any? in arg) { + val itemPathToItem = pathToItem + i + val schemas: LinkedHashMap, Nothing?>? = pathToSchemas.get(itemPathToItem) + if (schemas == null) { + throw RuntimeException("Validation result is invalid, schemas must exist for a pathToItem") + } + val itemSchema: JsonSchema<*> = schemas.entries.iterator().next().key + val itemInstance: Any? = itemSchema.getNewInstance(item, itemPathToItem, pathToSchemas) + items.add(itemInstance) + i += 1 + } + val newInstanceItems: FrozenList = FrozenList(items) + return newInstanceItems + } + + @Throws(ValidationException::class) + override fun validate(arg: List<*>, configuration: SchemaConfiguration?): FrozenList { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, PathToSchemasMap(), LinkedHashSet()) + val pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet) + return getNewInstance(castArg, validationMetadata.pathToItem, pathToSchemasMap) + } + + override fun getNewInstance(arg: Map<*, *>, pathToItem: List, pathToSchemas: PathToSchemasMap): FrozenMap { + val properties: LinkedHashMap = LinkedHashMap() + for((propertyName, value) in arg) { + if (!(propertyName is String)) { + throw RuntimeException("Invalid non-string key value") + } + val propertyPathToItem: List = pathToItem + propertyName + val schemas: LinkedHashMap, Nothing?>? = pathToSchemas.get(propertyPathToItem) + if (schemas == null) { + throw RuntimeException("Validation result is invalid, schemas must exist for a pathToItem") + } + val propertySchema: JsonSchema<*> = schemas.entries.iterator().next().key + val propertyInstance: Any? = propertySchema.getNewInstance(value, propertyPathToItem, pathToSchemas) + properties[propertyName] = propertyInstance + } + val castProperties: FrozenMap = FrozenMap(properties) + return castProperties + } + + @Throws(ValidationException::class) + override fun validate(arg: Map<*, *>, configuration: SchemaConfiguration?): FrozenMap { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validatedPathToSchemas = PathToSchemasMap() + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, LinkedHashSet()) + val pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet) + return getNewInstance(castArg, validationMetadata.pathToItem, pathToSchemasMap) + } + + @Throws(ValidationException::class) + override fun validate(arg: Any?, configuration: SchemaConfiguration?): Any? { + if (arg == null) { + return validate(null, configuration) + } else if (arg is Boolean) { + return validate(arg, configuration) + } else if (arg is Number) { + return validate(arg, configuration) + } else if (arg is String) { + return validate(arg, configuration) + } else if (arg is List<*>) { + return validate(arg, configuration) + } else if (arg is Map<*, *>) { + return validate(arg, configuration) + } + throw ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema") + } + override fun getNewInstance(arg: Any?, pathToItem: List, pathToSchemas: PathToSchemasMap): Any? { + if (arg == null) { + return getNewInstance( null, pathToItem, pathToSchemas) + } else if (arg is Boolean) { + return getNewInstance(arg, pathToItem, pathToSchemas) + } else if (arg is Number) { + return getNewInstance(arg, pathToItem, pathToSchemas) + } else if (arg is String) { + return getNewInstance(arg, pathToItem, pathToSchemas) + } else if (arg is List<*>) { + return getNewInstance(arg, pathToItem, pathToSchemas) + } else if (arg is Map<*, *>) { + return getNewInstance(arg, pathToItem, pathToSchemas) + } + throw RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema") + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: Nothing?, configuration: SchemaConfiguration?): UniqueitemsValidation1BoxedVoid { + return UniqueitemsValidation1BoxedVoid(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: Boolean, configuration: SchemaConfiguration?): UniqueitemsValidation1BoxedBoolean { + return UniqueitemsValidation1BoxedBoolean(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: Number, configuration: SchemaConfiguration?): UniqueitemsValidation1BoxedNumber { + return UniqueitemsValidation1BoxedNumber(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: String, configuration: SchemaConfiguration?): UniqueitemsValidation1BoxedString { + return UniqueitemsValidation1BoxedString(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: List<*>, configuration: SchemaConfiguration?): UniqueitemsValidation1BoxedList { + return UniqueitemsValidation1BoxedList(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: Map<*, *>, configuration: SchemaConfiguration?): UniqueitemsValidation1BoxedMap { + return UniqueitemsValidation1BoxedMap(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: Any?, configuration: SchemaConfiguration?): UniqueitemsValidation1Boxed { + if (arg == null) { + return validateAndBox(null, configuration) + } else if (arg is Boolean) { + return validateAndBox(arg, configuration) + } else if (arg is String) { + return validateAndBox(arg, configuration) + } else if (arg is Number) { + return validateAndBox(arg, configuration) + } else if (arg is List<*>) { + return validateAndBox(arg, configuration) + } else if (arg is Map<*, *>) { + return validateAndBox(arg, configuration) + } + throw ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema") + } + } +} diff --git a/samples/client/3_1_0_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/schemas/UniqueitemsWithAnArrayOfItems.kt b/samples/client/3_1_0_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/schemas/UniqueitemsWithAnArrayOfItems.kt new file mode 100644 index 00000000000..aa941473131 --- /dev/null +++ b/samples/client/3_1_0_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/schemas/UniqueitemsWithAnArrayOfItems.kt @@ -0,0 +1,408 @@ +package org.openapijsonschematools.client.components.schemas +import java.time.LocalDate +import java.time.ZonedDateTime +import java.util.UUID +import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags +import org.openapijsonschematools.client.configurations.SchemaConfiguration +import org.openapijsonschematools.client.exceptions.InvalidAdditionalPropertyException +import org.openapijsonschematools.client.exceptions.UnsetPropertyException +import org.openapijsonschematools.client.exceptions.ValidationException +import org.openapijsonschematools.client.schemas.BooleanJsonSchema +import org.openapijsonschematools.client.schemas.UnsetAddPropsSetter +import org.openapijsonschematools.client.schemas.validation.BooleanSchemaValidator +import org.openapijsonschematools.client.schemas.validation.FrozenList +import org.openapijsonschematools.client.schemas.validation.FrozenMap +import org.openapijsonschematools.client.schemas.validation.JsonSchema +import org.openapijsonschematools.client.schemas.validation.JsonSchemaInfo +import org.openapijsonschematools.client.schemas.validation.ListSchemaValidator +import org.openapijsonschematools.client.schemas.validation.MapSchemaValidator +import org.openapijsonschematools.client.schemas.validation.NullSchemaValidator +import org.openapijsonschematools.client.schemas.validation.NumberSchemaValidator +import org.openapijsonschematools.client.schemas.validation.PathToSchemasMap +import org.openapijsonschematools.client.schemas.validation.StringSchemaValidator +import org.openapijsonschematools.client.schemas.validation.ValidationMetadata + +class UniqueitemsWithAnArrayOfItems { + // nest classes so all schemas and input/output classes can be public + + + class UniqueitemsWithAnArrayOfItemsList(m: FrozenList) : FrozenList(m) { + companion object { + @Throws(ValidationException::class) + fun of(arg: List, configuration: SchemaConfiguration?): UniqueitemsWithAnArrayOfItemsList { + return UniqueitemsWithAnArrayOfItems1.getInstance().validate(arg, configuration) + } + } + } + + class UniqueitemsWithAnArrayOfItemsListBuilder { + // class to build List + private val list: MutableList + + init { + this.list = ArrayList() + } + + + fun add(item: Nothing?): UniqueitemsWithAnArrayOfItemsListBuilder { + list.add(null) + return this + } + + fun add(item: Boolean): UniqueitemsWithAnArrayOfItemsListBuilder { + list.add(item) + return this + } + + fun add(item: String): UniqueitemsWithAnArrayOfItemsListBuilder { + list.add(item) + return this + } + + fun add(item: Int): UniqueitemsWithAnArrayOfItemsListBuilder { + list.add(item) + return this + } + + fun add(item: Float): UniqueitemsWithAnArrayOfItemsListBuilder { + list.add(item) + return this + } + + fun add(item: Long): UniqueitemsWithAnArrayOfItemsListBuilder { + list.add(item) + return this + } + + fun add(item: Double): UniqueitemsWithAnArrayOfItemsListBuilder { + list.add(item) + return this + } + + fun add(item: List<*>): UniqueitemsWithAnArrayOfItemsListBuilder { + list.add(item) + return this + } + + fun add(item: Map): UniqueitemsWithAnArrayOfItemsListBuilder { + list.add(item) + return this + } + + fun build(): List { + return list + } + } + + + class Schema0 : BooleanJsonSchema.BooleanJsonSchema1() { + companion object { + @Volatile + private var instance: Schema0? = null + + fun getInstance() = + instance ?: synchronized(this) { + instance ?: Schema0().also { instance = it } + } + } + } + + + class Schema1 : BooleanJsonSchema.BooleanJsonSchema1() { + companion object { + @Volatile + private var instance: Schema1? = null + + fun getInstance() = + instance ?: synchronized(this) { + instance ?: Schema1().also { instance = it } + } + } + } + + + sealed interface UniqueitemsWithAnArrayOfItems1Boxed { + fun getData(): Any? + } + + data class UniqueitemsWithAnArrayOfItems1BoxedVoid(val data: Nothing?) : UniqueitemsWithAnArrayOfItems1Boxed { + override fun getData(): Any? { + return data + } + } + + data class UniqueitemsWithAnArrayOfItems1BoxedBoolean(val data: Boolean): UniqueitemsWithAnArrayOfItems1Boxed { + override fun getData(): Any? { + return data + } + } + + data class UniqueitemsWithAnArrayOfItems1BoxedNumber(val data: Number) : UniqueitemsWithAnArrayOfItems1Boxed { + override fun getData(): Any? { + return data + } + } + + data class UniqueitemsWithAnArrayOfItems1BoxedString(val data: String) : UniqueitemsWithAnArrayOfItems1Boxed { + override fun getData(): Any? { + return data + } + } + + data class UniqueitemsWithAnArrayOfItems1BoxedList(val data: UniqueitemsWithAnArrayOfItemsList) : UniqueitemsWithAnArrayOfItems1Boxed { + override fun getData(): Any? { + return data + } + } + + data class UniqueitemsWithAnArrayOfItems1BoxedMap(val data: FrozenMap) : UniqueitemsWithAnArrayOfItems1Boxed { + override fun getData(): Any? { + return data + } + } + + + class UniqueitemsWithAnArrayOfItems1 private constructor(): JsonSchema( + JsonSchemaInfo() + .uniqueItems(true) + .prefixItems(listOf( + Schema0::class.java, + Schema1::class.java + )) + ), NullSchemaValidator, BooleanSchemaValidator, NumberSchemaValidator, StringSchemaValidator, ListSchemaValidator, MapSchemaValidator, UniqueitemsWithAnArrayOfItems1BoxedMap> { + /* + NOTE: This class is auto generated by OpenAPI JSON Schema Generator. + Ref: https://github.com/openapi-json-schema-tools/openapi-json-schema-generator + + Do not edit the class manually. + */ + + companion object { + @Volatile + private var instance: UniqueitemsWithAnArrayOfItems1? = null + + fun getInstance() = + instance ?: synchronized(this) { + instance ?: UniqueitemsWithAnArrayOfItems1().also { instance = it } + } + } + + @Throws(ValidationException::class) + override fun validate(arg: Nothing?, configuration: SchemaConfiguration?): Nothing? { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validatedPathToSchemas = PathToSchemasMap() + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, LinkedHashSet()) + getPathToSchemas(this, castArg, validationMetadata, pathSet) + return castArg + } + + @Throws(ValidationException::class) + override fun validate(arg: Boolean, configuration: SchemaConfiguration?): Boolean { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validatedPathToSchemas = PathToSchemasMap() + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, LinkedHashSet()) + getPathToSchemas(this, castArg, validationMetadata, pathSet) + return castArg + } + + @Throws(ValidationException::class) + override fun validate(arg: Number, configuration: SchemaConfiguration?): Number { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validatedPathToSchemas = PathToSchemasMap() + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, LinkedHashSet()) + getPathToSchemas(this, castArg, validationMetadata, pathSet) + return castArg + } + + @Throws(ValidationException::class) + fun validate(arg: Int, configuration: SchemaConfiguration?): Int { + return validate(arg as Number, configuration) as Int + } + + @Throws(ValidationException::class) + fun validate(arg: Long, configuration: SchemaConfiguration?): Long { + return validate(arg as Number, configuration) as Long + } + + @Throws(ValidationException::class) + fun validate(arg: Float, configuration: SchemaConfiguration?): Float { + return validate(arg as Number, configuration) as Float + } + + @Throws(ValidationException::class) + fun validate(arg: Double, configuration: SchemaConfiguration?): Double { + return validate(arg as Number, configuration) as Double + } + + @Throws(ValidationException::class) + override fun validate(arg: String, configuration: SchemaConfiguration?): String { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validatedPathToSchemas = PathToSchemasMap() + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, LinkedHashSet()) + getPathToSchemas(this, castArg, validationMetadata, pathSet) + return castArg + } + + @Throws(ValidationException::class) + fun validate(arg: LocalDate, configuration: SchemaConfiguration?): String { + return validate(arg.toString(), configuration) + } + + @Throws(ValidationException::class) + fun validate(arg: ZonedDateTime, configuration: SchemaConfiguration?): String { + return validate(arg.toString(), configuration) + } + + @Throws(ValidationException::class) + fun validate(arg: UUID, configuration: SchemaConfiguration?): String { + return validate(arg.toString(), configuration) + } + + override fun getNewInstance(arg: List<*>, pathToItem: List, pathToSchemas: PathToSchemasMap): UniqueitemsWithAnArrayOfItemsList { + val items: MutableList = ArrayList() + var i: Int = 0 + for (item: Any? in arg) { + val itemPathToItem = pathToItem + i + val schemas: LinkedHashMap, Nothing?>? = pathToSchemas.get(itemPathToItem) + if (schemas == null) { + throw RuntimeException("Validation result is invalid, schemas must exist for a pathToItem") + } + val itemSchema: JsonSchema<*> = schemas.entries.iterator().next().key + val itemInstance: Any? = itemSchema.getNewInstance(item, itemPathToItem, pathToSchemas) + items.add(itemInstance) + i += 1 + } + val newInstanceItems: FrozenList = FrozenList(items) + return UniqueitemsWithAnArrayOfItemsList(newInstanceItems) + } + + @Throws(ValidationException::class) + override fun validate(arg: List<*>, configuration: SchemaConfiguration?): UniqueitemsWithAnArrayOfItemsList { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, PathToSchemasMap(), LinkedHashSet()) + val pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet) + return getNewInstance(castArg, validationMetadata.pathToItem, pathToSchemasMap) + } + + override fun getNewInstance(arg: Map<*, *>, pathToItem: List, pathToSchemas: PathToSchemasMap): FrozenMap { + val properties: LinkedHashMap = LinkedHashMap() + for((propertyName, value) in arg) { + if (!(propertyName is String)) { + throw RuntimeException("Invalid non-string key value") + } + val propertyPathToItem: List = pathToItem + propertyName + val schemas: LinkedHashMap, Nothing?>? = pathToSchemas.get(propertyPathToItem) + if (schemas == null) { + throw RuntimeException("Validation result is invalid, schemas must exist for a pathToItem") + } + val propertySchema: JsonSchema<*> = schemas.entries.iterator().next().key + val propertyInstance: Any? = propertySchema.getNewInstance(value, propertyPathToItem, pathToSchemas) + properties[propertyName] = propertyInstance + } + val castProperties: FrozenMap = FrozenMap(properties) + return castProperties + } + + @Throws(ValidationException::class) + override fun validate(arg: Map<*, *>, configuration: SchemaConfiguration?): FrozenMap { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validatedPathToSchemas = PathToSchemasMap() + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, LinkedHashSet()) + val pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet) + return getNewInstance(castArg, validationMetadata.pathToItem, pathToSchemasMap) + } + + @Throws(ValidationException::class) + override fun validate(arg: Any?, configuration: SchemaConfiguration?): Any? { + if (arg == null) { + return validate(null, configuration) + } else if (arg is Boolean) { + return validate(arg, configuration) + } else if (arg is Number) { + return validate(arg, configuration) + } else if (arg is String) { + return validate(arg, configuration) + } else if (arg is List<*>) { + return validate(arg, configuration) + } else if (arg is Map<*, *>) { + return validate(arg, configuration) + } + throw ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema") + } + override fun getNewInstance(arg: Any?, pathToItem: List, pathToSchemas: PathToSchemasMap): Any? { + if (arg == null) { + return getNewInstance( null, pathToItem, pathToSchemas) + } else if (arg is Boolean) { + return getNewInstance(arg, pathToItem, pathToSchemas) + } else if (arg is Number) { + return getNewInstance(arg, pathToItem, pathToSchemas) + } else if (arg is String) { + return getNewInstance(arg, pathToItem, pathToSchemas) + } else if (arg is List<*>) { + return getNewInstance(arg, pathToItem, pathToSchemas) + } else if (arg is Map<*, *>) { + return getNewInstance(arg, pathToItem, pathToSchemas) + } + throw RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema") + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: Nothing?, configuration: SchemaConfiguration?): UniqueitemsWithAnArrayOfItems1BoxedVoid { + return UniqueitemsWithAnArrayOfItems1BoxedVoid(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: Boolean, configuration: SchemaConfiguration?): UniqueitemsWithAnArrayOfItems1BoxedBoolean { + return UniqueitemsWithAnArrayOfItems1BoxedBoolean(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: Number, configuration: SchemaConfiguration?): UniqueitemsWithAnArrayOfItems1BoxedNumber { + return UniqueitemsWithAnArrayOfItems1BoxedNumber(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: String, configuration: SchemaConfiguration?): UniqueitemsWithAnArrayOfItems1BoxedString { + return UniqueitemsWithAnArrayOfItems1BoxedString(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: List<*>, configuration: SchemaConfiguration?): UniqueitemsWithAnArrayOfItems1BoxedList { + return UniqueitemsWithAnArrayOfItems1BoxedList(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: Map<*, *>, configuration: SchemaConfiguration?): UniqueitemsWithAnArrayOfItems1BoxedMap { + return UniqueitemsWithAnArrayOfItems1BoxedMap(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: Any?, configuration: SchemaConfiguration?): UniqueitemsWithAnArrayOfItems1Boxed { + if (arg == null) { + return validateAndBox(null, configuration) + } else if (arg is Boolean) { + return validateAndBox(arg, configuration) + } else if (arg is String) { + return validateAndBox(arg, configuration) + } else if (arg is Number) { + return validateAndBox(arg, configuration) + } else if (arg is List<*>) { + return validateAndBox(arg, configuration) + } else if (arg is Map<*, *>) { + return validateAndBox(arg, configuration) + } + throw ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema") + } + } +} diff --git a/samples/client/3_1_0_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/schemas/UriFormat.kt b/samples/client/3_1_0_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/schemas/UriFormat.kt new file mode 100644 index 00000000000..46a606e7c80 --- /dev/null +++ b/samples/client/3_1_0_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/schemas/UriFormat.kt @@ -0,0 +1,308 @@ +package org.openapijsonschematools.client.components.schemas +import java.time.LocalDate +import java.time.ZonedDateTime +import java.util.UUID +import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags +import org.openapijsonschematools.client.configurations.SchemaConfiguration +import org.openapijsonschematools.client.exceptions.InvalidAdditionalPropertyException +import org.openapijsonschematools.client.exceptions.UnsetPropertyException +import org.openapijsonschematools.client.exceptions.ValidationException +import org.openapijsonschematools.client.schemas.UnsetAddPropsSetter +import org.openapijsonschematools.client.schemas.validation.BooleanSchemaValidator +import org.openapijsonschematools.client.schemas.validation.FrozenList +import org.openapijsonschematools.client.schemas.validation.FrozenMap +import org.openapijsonschematools.client.schemas.validation.JsonSchema +import org.openapijsonschematools.client.schemas.validation.JsonSchemaInfo +import org.openapijsonschematools.client.schemas.validation.ListSchemaValidator +import org.openapijsonschematools.client.schemas.validation.MapSchemaValidator +import org.openapijsonschematools.client.schemas.validation.NullSchemaValidator +import org.openapijsonschematools.client.schemas.validation.NumberSchemaValidator +import org.openapijsonschematools.client.schemas.validation.PathToSchemasMap +import org.openapijsonschematools.client.schemas.validation.StringSchemaValidator +import org.openapijsonschematools.client.schemas.validation.ValidationMetadata + +class UriFormat { + // nest classes so all schemas and input/output classes can be public + + + sealed interface UriFormat1Boxed { + fun getData(): Any? + } + + data class UriFormat1BoxedVoid(val data: Nothing?) : UriFormat1Boxed { + override fun getData(): Any? { + return data + } + } + + data class UriFormat1BoxedBoolean(val data: Boolean): UriFormat1Boxed { + override fun getData(): Any? { + return data + } + } + + data class UriFormat1BoxedNumber(val data: Number) : UriFormat1Boxed { + override fun getData(): Any? { + return data + } + } + + data class UriFormat1BoxedString(val data: String) : UriFormat1Boxed { + override fun getData(): Any? { + return data + } + } + + data class UriFormat1BoxedList(val data: FrozenList) : UriFormat1Boxed { + override fun getData(): Any? { + return data + } + } + + data class UriFormat1BoxedMap(val data: FrozenMap) : UriFormat1Boxed { + override fun getData(): Any? { + return data + } + } + + + class UriFormat1 private constructor(): JsonSchema( + JsonSchemaInfo() + .format("uri") + ), NullSchemaValidator, BooleanSchemaValidator, NumberSchemaValidator, StringSchemaValidator, ListSchemaValidator, UriFormat1BoxedList>, MapSchemaValidator, UriFormat1BoxedMap> { + /* + NOTE: This class is auto generated by OpenAPI JSON Schema Generator. + Ref: https://github.com/openapi-json-schema-tools/openapi-json-schema-generator + + Do not edit the class manually. + */ + + companion object { + @Volatile + private var instance: UriFormat1? = null + + fun getInstance() = + instance ?: synchronized(this) { + instance ?: UriFormat1().also { instance = it } + } + } + + @Throws(ValidationException::class) + override fun validate(arg: Nothing?, configuration: SchemaConfiguration?): Nothing? { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validatedPathToSchemas = PathToSchemasMap() + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, LinkedHashSet()) + getPathToSchemas(this, castArg, validationMetadata, pathSet) + return castArg + } + + @Throws(ValidationException::class) + override fun validate(arg: Boolean, configuration: SchemaConfiguration?): Boolean { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validatedPathToSchemas = PathToSchemasMap() + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, LinkedHashSet()) + getPathToSchemas(this, castArg, validationMetadata, pathSet) + return castArg + } + + @Throws(ValidationException::class) + override fun validate(arg: Number, configuration: SchemaConfiguration?): Number { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validatedPathToSchemas = PathToSchemasMap() + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, LinkedHashSet()) + getPathToSchemas(this, castArg, validationMetadata, pathSet) + return castArg + } + + @Throws(ValidationException::class) + fun validate(arg: Int, configuration: SchemaConfiguration?): Int { + return validate(arg as Number, configuration) as Int + } + + @Throws(ValidationException::class) + fun validate(arg: Long, configuration: SchemaConfiguration?): Long { + return validate(arg as Number, configuration) as Long + } + + @Throws(ValidationException::class) + fun validate(arg: Float, configuration: SchemaConfiguration?): Float { + return validate(arg as Number, configuration) as Float + } + + @Throws(ValidationException::class) + fun validate(arg: Double, configuration: SchemaConfiguration?): Double { + return validate(arg as Number, configuration) as Double + } + + @Throws(ValidationException::class) + override fun validate(arg: String, configuration: SchemaConfiguration?): String { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validatedPathToSchemas = PathToSchemasMap() + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, LinkedHashSet()) + getPathToSchemas(this, castArg, validationMetadata, pathSet) + return castArg + } + + @Throws(ValidationException::class) + fun validate(arg: LocalDate, configuration: SchemaConfiguration?): String { + return validate(arg.toString(), configuration) + } + + @Throws(ValidationException::class) + fun validate(arg: ZonedDateTime, configuration: SchemaConfiguration?): String { + return validate(arg.toString(), configuration) + } + + @Throws(ValidationException::class) + fun validate(arg: UUID, configuration: SchemaConfiguration?): String { + return validate(arg.toString(), configuration) + } + + override fun getNewInstance(arg: List<*>, pathToItem: List, pathToSchemas: PathToSchemasMap): FrozenList { + val items: MutableList = ArrayList() + var i: Int = 0 + for (item: Any? in arg) { + val itemPathToItem = pathToItem + i + val schemas: LinkedHashMap, Nothing?>? = pathToSchemas.get(itemPathToItem) + if (schemas == null) { + throw RuntimeException("Validation result is invalid, schemas must exist for a pathToItem") + } + val itemSchema: JsonSchema<*> = schemas.entries.iterator().next().key + val itemInstance: Any? = itemSchema.getNewInstance(item, itemPathToItem, pathToSchemas) + items.add(itemInstance) + i += 1 + } + val newInstanceItems: FrozenList = FrozenList(items) + return newInstanceItems + } + + @Throws(ValidationException::class) + override fun validate(arg: List<*>, configuration: SchemaConfiguration?): FrozenList { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, PathToSchemasMap(), LinkedHashSet()) + val pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet) + return getNewInstance(castArg, validationMetadata.pathToItem, pathToSchemasMap) + } + + override fun getNewInstance(arg: Map<*, *>, pathToItem: List, pathToSchemas: PathToSchemasMap): FrozenMap { + val properties: LinkedHashMap = LinkedHashMap() + for((propertyName, value) in arg) { + if (!(propertyName is String)) { + throw RuntimeException("Invalid non-string key value") + } + val propertyPathToItem: List = pathToItem + propertyName + val schemas: LinkedHashMap, Nothing?>? = pathToSchemas.get(propertyPathToItem) + if (schemas == null) { + throw RuntimeException("Validation result is invalid, schemas must exist for a pathToItem") + } + val propertySchema: JsonSchema<*> = schemas.entries.iterator().next().key + val propertyInstance: Any? = propertySchema.getNewInstance(value, propertyPathToItem, pathToSchemas) + properties[propertyName] = propertyInstance + } + val castProperties: FrozenMap = FrozenMap(properties) + return castProperties + } + + @Throws(ValidationException::class) + override fun validate(arg: Map<*, *>, configuration: SchemaConfiguration?): FrozenMap { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validatedPathToSchemas = PathToSchemasMap() + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, LinkedHashSet()) + val pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet) + return getNewInstance(castArg, validationMetadata.pathToItem, pathToSchemasMap) + } + + @Throws(ValidationException::class) + override fun validate(arg: Any?, configuration: SchemaConfiguration?): Any? { + if (arg == null) { + return validate(null, configuration) + } else if (arg is Boolean) { + return validate(arg, configuration) + } else if (arg is Number) { + return validate(arg, configuration) + } else if (arg is String) { + return validate(arg, configuration) + } else if (arg is List<*>) { + return validate(arg, configuration) + } else if (arg is Map<*, *>) { + return validate(arg, configuration) + } + throw ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema") + } + override fun getNewInstance(arg: Any?, pathToItem: List, pathToSchemas: PathToSchemasMap): Any? { + if (arg == null) { + return getNewInstance( null, pathToItem, pathToSchemas) + } else if (arg is Boolean) { + return getNewInstance(arg, pathToItem, pathToSchemas) + } else if (arg is Number) { + return getNewInstance(arg, pathToItem, pathToSchemas) + } else if (arg is String) { + return getNewInstance(arg, pathToItem, pathToSchemas) + } else if (arg is List<*>) { + return getNewInstance(arg, pathToItem, pathToSchemas) + } else if (arg is Map<*, *>) { + return getNewInstance(arg, pathToItem, pathToSchemas) + } + throw RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema") + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: Nothing?, configuration: SchemaConfiguration?): UriFormat1BoxedVoid { + return UriFormat1BoxedVoid(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: Boolean, configuration: SchemaConfiguration?): UriFormat1BoxedBoolean { + return UriFormat1BoxedBoolean(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: Number, configuration: SchemaConfiguration?): UriFormat1BoxedNumber { + return UriFormat1BoxedNumber(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: String, configuration: SchemaConfiguration?): UriFormat1BoxedString { + return UriFormat1BoxedString(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: List<*>, configuration: SchemaConfiguration?): UriFormat1BoxedList { + return UriFormat1BoxedList(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: Map<*, *>, configuration: SchemaConfiguration?): UriFormat1BoxedMap { + return UriFormat1BoxedMap(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: Any?, configuration: SchemaConfiguration?): UriFormat1Boxed { + if (arg == null) { + return validateAndBox(null, configuration) + } else if (arg is Boolean) { + return validateAndBox(arg, configuration) + } else if (arg is String) { + return validateAndBox(arg, configuration) + } else if (arg is Number) { + return validateAndBox(arg, configuration) + } else if (arg is List<*>) { + return validateAndBox(arg, configuration) + } else if (arg is Map<*, *>) { + return validateAndBox(arg, configuration) + } + throw ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema") + } + } +} diff --git a/samples/client/3_1_0_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/schemas/UriReferenceFormat.kt b/samples/client/3_1_0_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/schemas/UriReferenceFormat.kt new file mode 100644 index 00000000000..7bdbafd17e5 --- /dev/null +++ b/samples/client/3_1_0_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/schemas/UriReferenceFormat.kt @@ -0,0 +1,308 @@ +package org.openapijsonschematools.client.components.schemas +import java.time.LocalDate +import java.time.ZonedDateTime +import java.util.UUID +import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags +import org.openapijsonschematools.client.configurations.SchemaConfiguration +import org.openapijsonschematools.client.exceptions.InvalidAdditionalPropertyException +import org.openapijsonschematools.client.exceptions.UnsetPropertyException +import org.openapijsonschematools.client.exceptions.ValidationException +import org.openapijsonschematools.client.schemas.UnsetAddPropsSetter +import org.openapijsonschematools.client.schemas.validation.BooleanSchemaValidator +import org.openapijsonschematools.client.schemas.validation.FrozenList +import org.openapijsonschematools.client.schemas.validation.FrozenMap +import org.openapijsonschematools.client.schemas.validation.JsonSchema +import org.openapijsonschematools.client.schemas.validation.JsonSchemaInfo +import org.openapijsonschematools.client.schemas.validation.ListSchemaValidator +import org.openapijsonschematools.client.schemas.validation.MapSchemaValidator +import org.openapijsonschematools.client.schemas.validation.NullSchemaValidator +import org.openapijsonschematools.client.schemas.validation.NumberSchemaValidator +import org.openapijsonschematools.client.schemas.validation.PathToSchemasMap +import org.openapijsonschematools.client.schemas.validation.StringSchemaValidator +import org.openapijsonschematools.client.schemas.validation.ValidationMetadata + +class UriReferenceFormat { + // nest classes so all schemas and input/output classes can be public + + + sealed interface UriReferenceFormat1Boxed { + fun getData(): Any? + } + + data class UriReferenceFormat1BoxedVoid(val data: Nothing?) : UriReferenceFormat1Boxed { + override fun getData(): Any? { + return data + } + } + + data class UriReferenceFormat1BoxedBoolean(val data: Boolean): UriReferenceFormat1Boxed { + override fun getData(): Any? { + return data + } + } + + data class UriReferenceFormat1BoxedNumber(val data: Number) : UriReferenceFormat1Boxed { + override fun getData(): Any? { + return data + } + } + + data class UriReferenceFormat1BoxedString(val data: String) : UriReferenceFormat1Boxed { + override fun getData(): Any? { + return data + } + } + + data class UriReferenceFormat1BoxedList(val data: FrozenList) : UriReferenceFormat1Boxed { + override fun getData(): Any? { + return data + } + } + + data class UriReferenceFormat1BoxedMap(val data: FrozenMap) : UriReferenceFormat1Boxed { + override fun getData(): Any? { + return data + } + } + + + class UriReferenceFormat1 private constructor(): JsonSchema( + JsonSchemaInfo() + .format("uri-reference") + ), NullSchemaValidator, BooleanSchemaValidator, NumberSchemaValidator, StringSchemaValidator, ListSchemaValidator, UriReferenceFormat1BoxedList>, MapSchemaValidator, UriReferenceFormat1BoxedMap> { + /* + NOTE: This class is auto generated by OpenAPI JSON Schema Generator. + Ref: https://github.com/openapi-json-schema-tools/openapi-json-schema-generator + + Do not edit the class manually. + */ + + companion object { + @Volatile + private var instance: UriReferenceFormat1? = null + + fun getInstance() = + instance ?: synchronized(this) { + instance ?: UriReferenceFormat1().also { instance = it } + } + } + + @Throws(ValidationException::class) + override fun validate(arg: Nothing?, configuration: SchemaConfiguration?): Nothing? { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validatedPathToSchemas = PathToSchemasMap() + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, LinkedHashSet()) + getPathToSchemas(this, castArg, validationMetadata, pathSet) + return castArg + } + + @Throws(ValidationException::class) + override fun validate(arg: Boolean, configuration: SchemaConfiguration?): Boolean { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validatedPathToSchemas = PathToSchemasMap() + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, LinkedHashSet()) + getPathToSchemas(this, castArg, validationMetadata, pathSet) + return castArg + } + + @Throws(ValidationException::class) + override fun validate(arg: Number, configuration: SchemaConfiguration?): Number { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validatedPathToSchemas = PathToSchemasMap() + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, LinkedHashSet()) + getPathToSchemas(this, castArg, validationMetadata, pathSet) + return castArg + } + + @Throws(ValidationException::class) + fun validate(arg: Int, configuration: SchemaConfiguration?): Int { + return validate(arg as Number, configuration) as Int + } + + @Throws(ValidationException::class) + fun validate(arg: Long, configuration: SchemaConfiguration?): Long { + return validate(arg as Number, configuration) as Long + } + + @Throws(ValidationException::class) + fun validate(arg: Float, configuration: SchemaConfiguration?): Float { + return validate(arg as Number, configuration) as Float + } + + @Throws(ValidationException::class) + fun validate(arg: Double, configuration: SchemaConfiguration?): Double { + return validate(arg as Number, configuration) as Double + } + + @Throws(ValidationException::class) + override fun validate(arg: String, configuration: SchemaConfiguration?): String { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validatedPathToSchemas = PathToSchemasMap() + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, LinkedHashSet()) + getPathToSchemas(this, castArg, validationMetadata, pathSet) + return castArg + } + + @Throws(ValidationException::class) + fun validate(arg: LocalDate, configuration: SchemaConfiguration?): String { + return validate(arg.toString(), configuration) + } + + @Throws(ValidationException::class) + fun validate(arg: ZonedDateTime, configuration: SchemaConfiguration?): String { + return validate(arg.toString(), configuration) + } + + @Throws(ValidationException::class) + fun validate(arg: UUID, configuration: SchemaConfiguration?): String { + return validate(arg.toString(), configuration) + } + + override fun getNewInstance(arg: List<*>, pathToItem: List, pathToSchemas: PathToSchemasMap): FrozenList { + val items: MutableList = ArrayList() + var i: Int = 0 + for (item: Any? in arg) { + val itemPathToItem = pathToItem + i + val schemas: LinkedHashMap, Nothing?>? = pathToSchemas.get(itemPathToItem) + if (schemas == null) { + throw RuntimeException("Validation result is invalid, schemas must exist for a pathToItem") + } + val itemSchema: JsonSchema<*> = schemas.entries.iterator().next().key + val itemInstance: Any? = itemSchema.getNewInstance(item, itemPathToItem, pathToSchemas) + items.add(itemInstance) + i += 1 + } + val newInstanceItems: FrozenList = FrozenList(items) + return newInstanceItems + } + + @Throws(ValidationException::class) + override fun validate(arg: List<*>, configuration: SchemaConfiguration?): FrozenList { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, PathToSchemasMap(), LinkedHashSet()) + val pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet) + return getNewInstance(castArg, validationMetadata.pathToItem, pathToSchemasMap) + } + + override fun getNewInstance(arg: Map<*, *>, pathToItem: List, pathToSchemas: PathToSchemasMap): FrozenMap { + val properties: LinkedHashMap = LinkedHashMap() + for((propertyName, value) in arg) { + if (!(propertyName is String)) { + throw RuntimeException("Invalid non-string key value") + } + val propertyPathToItem: List = pathToItem + propertyName + val schemas: LinkedHashMap, Nothing?>? = pathToSchemas.get(propertyPathToItem) + if (schemas == null) { + throw RuntimeException("Validation result is invalid, schemas must exist for a pathToItem") + } + val propertySchema: JsonSchema<*> = schemas.entries.iterator().next().key + val propertyInstance: Any? = propertySchema.getNewInstance(value, propertyPathToItem, pathToSchemas) + properties[propertyName] = propertyInstance + } + val castProperties: FrozenMap = FrozenMap(properties) + return castProperties + } + + @Throws(ValidationException::class) + override fun validate(arg: Map<*, *>, configuration: SchemaConfiguration?): FrozenMap { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validatedPathToSchemas = PathToSchemasMap() + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, LinkedHashSet()) + val pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet) + return getNewInstance(castArg, validationMetadata.pathToItem, pathToSchemasMap) + } + + @Throws(ValidationException::class) + override fun validate(arg: Any?, configuration: SchemaConfiguration?): Any? { + if (arg == null) { + return validate(null, configuration) + } else if (arg is Boolean) { + return validate(arg, configuration) + } else if (arg is Number) { + return validate(arg, configuration) + } else if (arg is String) { + return validate(arg, configuration) + } else if (arg is List<*>) { + return validate(arg, configuration) + } else if (arg is Map<*, *>) { + return validate(arg, configuration) + } + throw ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema") + } + override fun getNewInstance(arg: Any?, pathToItem: List, pathToSchemas: PathToSchemasMap): Any? { + if (arg == null) { + return getNewInstance( null, pathToItem, pathToSchemas) + } else if (arg is Boolean) { + return getNewInstance(arg, pathToItem, pathToSchemas) + } else if (arg is Number) { + return getNewInstance(arg, pathToItem, pathToSchemas) + } else if (arg is String) { + return getNewInstance(arg, pathToItem, pathToSchemas) + } else if (arg is List<*>) { + return getNewInstance(arg, pathToItem, pathToSchemas) + } else if (arg is Map<*, *>) { + return getNewInstance(arg, pathToItem, pathToSchemas) + } + throw RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema") + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: Nothing?, configuration: SchemaConfiguration?): UriReferenceFormat1BoxedVoid { + return UriReferenceFormat1BoxedVoid(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: Boolean, configuration: SchemaConfiguration?): UriReferenceFormat1BoxedBoolean { + return UriReferenceFormat1BoxedBoolean(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: Number, configuration: SchemaConfiguration?): UriReferenceFormat1BoxedNumber { + return UriReferenceFormat1BoxedNumber(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: String, configuration: SchemaConfiguration?): UriReferenceFormat1BoxedString { + return UriReferenceFormat1BoxedString(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: List<*>, configuration: SchemaConfiguration?): UriReferenceFormat1BoxedList { + return UriReferenceFormat1BoxedList(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: Map<*, *>, configuration: SchemaConfiguration?): UriReferenceFormat1BoxedMap { + return UriReferenceFormat1BoxedMap(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: Any?, configuration: SchemaConfiguration?): UriReferenceFormat1Boxed { + if (arg == null) { + return validateAndBox(null, configuration) + } else if (arg is Boolean) { + return validateAndBox(arg, configuration) + } else if (arg is String) { + return validateAndBox(arg, configuration) + } else if (arg is Number) { + return validateAndBox(arg, configuration) + } else if (arg is List<*>) { + return validateAndBox(arg, configuration) + } else if (arg is Map<*, *>) { + return validateAndBox(arg, configuration) + } + throw ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema") + } + } +} diff --git a/samples/client/3_1_0_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/schemas/UriTemplateFormat.kt b/samples/client/3_1_0_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/schemas/UriTemplateFormat.kt new file mode 100644 index 00000000000..6bfbac6b213 --- /dev/null +++ b/samples/client/3_1_0_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/schemas/UriTemplateFormat.kt @@ -0,0 +1,308 @@ +package org.openapijsonschematools.client.components.schemas +import java.time.LocalDate +import java.time.ZonedDateTime +import java.util.UUID +import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags +import org.openapijsonschematools.client.configurations.SchemaConfiguration +import org.openapijsonschematools.client.exceptions.InvalidAdditionalPropertyException +import org.openapijsonschematools.client.exceptions.UnsetPropertyException +import org.openapijsonschematools.client.exceptions.ValidationException +import org.openapijsonschematools.client.schemas.UnsetAddPropsSetter +import org.openapijsonschematools.client.schemas.validation.BooleanSchemaValidator +import org.openapijsonschematools.client.schemas.validation.FrozenList +import org.openapijsonschematools.client.schemas.validation.FrozenMap +import org.openapijsonschematools.client.schemas.validation.JsonSchema +import org.openapijsonschematools.client.schemas.validation.JsonSchemaInfo +import org.openapijsonschematools.client.schemas.validation.ListSchemaValidator +import org.openapijsonschematools.client.schemas.validation.MapSchemaValidator +import org.openapijsonschematools.client.schemas.validation.NullSchemaValidator +import org.openapijsonschematools.client.schemas.validation.NumberSchemaValidator +import org.openapijsonschematools.client.schemas.validation.PathToSchemasMap +import org.openapijsonschematools.client.schemas.validation.StringSchemaValidator +import org.openapijsonschematools.client.schemas.validation.ValidationMetadata + +class UriTemplateFormat { + // nest classes so all schemas and input/output classes can be public + + + sealed interface UriTemplateFormat1Boxed { + fun getData(): Any? + } + + data class UriTemplateFormat1BoxedVoid(val data: Nothing?) : UriTemplateFormat1Boxed { + override fun getData(): Any? { + return data + } + } + + data class UriTemplateFormat1BoxedBoolean(val data: Boolean): UriTemplateFormat1Boxed { + override fun getData(): Any? { + return data + } + } + + data class UriTemplateFormat1BoxedNumber(val data: Number) : UriTemplateFormat1Boxed { + override fun getData(): Any? { + return data + } + } + + data class UriTemplateFormat1BoxedString(val data: String) : UriTemplateFormat1Boxed { + override fun getData(): Any? { + return data + } + } + + data class UriTemplateFormat1BoxedList(val data: FrozenList) : UriTemplateFormat1Boxed { + override fun getData(): Any? { + return data + } + } + + data class UriTemplateFormat1BoxedMap(val data: FrozenMap) : UriTemplateFormat1Boxed { + override fun getData(): Any? { + return data + } + } + + + class UriTemplateFormat1 private constructor(): JsonSchema( + JsonSchemaInfo() + .format("uri-template") + ), NullSchemaValidator, BooleanSchemaValidator, NumberSchemaValidator, StringSchemaValidator, ListSchemaValidator, UriTemplateFormat1BoxedList>, MapSchemaValidator, UriTemplateFormat1BoxedMap> { + /* + NOTE: This class is auto generated by OpenAPI JSON Schema Generator. + Ref: https://github.com/openapi-json-schema-tools/openapi-json-schema-generator + + Do not edit the class manually. + */ + + companion object { + @Volatile + private var instance: UriTemplateFormat1? = null + + fun getInstance() = + instance ?: synchronized(this) { + instance ?: UriTemplateFormat1().also { instance = it } + } + } + + @Throws(ValidationException::class) + override fun validate(arg: Nothing?, configuration: SchemaConfiguration?): Nothing? { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validatedPathToSchemas = PathToSchemasMap() + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, LinkedHashSet()) + getPathToSchemas(this, castArg, validationMetadata, pathSet) + return castArg + } + + @Throws(ValidationException::class) + override fun validate(arg: Boolean, configuration: SchemaConfiguration?): Boolean { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validatedPathToSchemas = PathToSchemasMap() + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, LinkedHashSet()) + getPathToSchemas(this, castArg, validationMetadata, pathSet) + return castArg + } + + @Throws(ValidationException::class) + override fun validate(arg: Number, configuration: SchemaConfiguration?): Number { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validatedPathToSchemas = PathToSchemasMap() + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, LinkedHashSet()) + getPathToSchemas(this, castArg, validationMetadata, pathSet) + return castArg + } + + @Throws(ValidationException::class) + fun validate(arg: Int, configuration: SchemaConfiguration?): Int { + return validate(arg as Number, configuration) as Int + } + + @Throws(ValidationException::class) + fun validate(arg: Long, configuration: SchemaConfiguration?): Long { + return validate(arg as Number, configuration) as Long + } + + @Throws(ValidationException::class) + fun validate(arg: Float, configuration: SchemaConfiguration?): Float { + return validate(arg as Number, configuration) as Float + } + + @Throws(ValidationException::class) + fun validate(arg: Double, configuration: SchemaConfiguration?): Double { + return validate(arg as Number, configuration) as Double + } + + @Throws(ValidationException::class) + override fun validate(arg: String, configuration: SchemaConfiguration?): String { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validatedPathToSchemas = PathToSchemasMap() + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, LinkedHashSet()) + getPathToSchemas(this, castArg, validationMetadata, pathSet) + return castArg + } + + @Throws(ValidationException::class) + fun validate(arg: LocalDate, configuration: SchemaConfiguration?): String { + return validate(arg.toString(), configuration) + } + + @Throws(ValidationException::class) + fun validate(arg: ZonedDateTime, configuration: SchemaConfiguration?): String { + return validate(arg.toString(), configuration) + } + + @Throws(ValidationException::class) + fun validate(arg: UUID, configuration: SchemaConfiguration?): String { + return validate(arg.toString(), configuration) + } + + override fun getNewInstance(arg: List<*>, pathToItem: List, pathToSchemas: PathToSchemasMap): FrozenList { + val items: MutableList = ArrayList() + var i: Int = 0 + for (item: Any? in arg) { + val itemPathToItem = pathToItem + i + val schemas: LinkedHashMap, Nothing?>? = pathToSchemas.get(itemPathToItem) + if (schemas == null) { + throw RuntimeException("Validation result is invalid, schemas must exist for a pathToItem") + } + val itemSchema: JsonSchema<*> = schemas.entries.iterator().next().key + val itemInstance: Any? = itemSchema.getNewInstance(item, itemPathToItem, pathToSchemas) + items.add(itemInstance) + i += 1 + } + val newInstanceItems: FrozenList = FrozenList(items) + return newInstanceItems + } + + @Throws(ValidationException::class) + override fun validate(arg: List<*>, configuration: SchemaConfiguration?): FrozenList { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, PathToSchemasMap(), LinkedHashSet()) + val pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet) + return getNewInstance(castArg, validationMetadata.pathToItem, pathToSchemasMap) + } + + override fun getNewInstance(arg: Map<*, *>, pathToItem: List, pathToSchemas: PathToSchemasMap): FrozenMap { + val properties: LinkedHashMap = LinkedHashMap() + for((propertyName, value) in arg) { + if (!(propertyName is String)) { + throw RuntimeException("Invalid non-string key value") + } + val propertyPathToItem: List = pathToItem + propertyName + val schemas: LinkedHashMap, Nothing?>? = pathToSchemas.get(propertyPathToItem) + if (schemas == null) { + throw RuntimeException("Validation result is invalid, schemas must exist for a pathToItem") + } + val propertySchema: JsonSchema<*> = schemas.entries.iterator().next().key + val propertyInstance: Any? = propertySchema.getNewInstance(value, propertyPathToItem, pathToSchemas) + properties[propertyName] = propertyInstance + } + val castProperties: FrozenMap = FrozenMap(properties) + return castProperties + } + + @Throws(ValidationException::class) + override fun validate(arg: Map<*, *>, configuration: SchemaConfiguration?): FrozenMap { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validatedPathToSchemas = PathToSchemasMap() + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, LinkedHashSet()) + val pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet) + return getNewInstance(castArg, validationMetadata.pathToItem, pathToSchemasMap) + } + + @Throws(ValidationException::class) + override fun validate(arg: Any?, configuration: SchemaConfiguration?): Any? { + if (arg == null) { + return validate(null, configuration) + } else if (arg is Boolean) { + return validate(arg, configuration) + } else if (arg is Number) { + return validate(arg, configuration) + } else if (arg is String) { + return validate(arg, configuration) + } else if (arg is List<*>) { + return validate(arg, configuration) + } else if (arg is Map<*, *>) { + return validate(arg, configuration) + } + throw ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema") + } + override fun getNewInstance(arg: Any?, pathToItem: List, pathToSchemas: PathToSchemasMap): Any? { + if (arg == null) { + return getNewInstance( null, pathToItem, pathToSchemas) + } else if (arg is Boolean) { + return getNewInstance(arg, pathToItem, pathToSchemas) + } else if (arg is Number) { + return getNewInstance(arg, pathToItem, pathToSchemas) + } else if (arg is String) { + return getNewInstance(arg, pathToItem, pathToSchemas) + } else if (arg is List<*>) { + return getNewInstance(arg, pathToItem, pathToSchemas) + } else if (arg is Map<*, *>) { + return getNewInstance(arg, pathToItem, pathToSchemas) + } + throw RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema") + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: Nothing?, configuration: SchemaConfiguration?): UriTemplateFormat1BoxedVoid { + return UriTemplateFormat1BoxedVoid(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: Boolean, configuration: SchemaConfiguration?): UriTemplateFormat1BoxedBoolean { + return UriTemplateFormat1BoxedBoolean(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: Number, configuration: SchemaConfiguration?): UriTemplateFormat1BoxedNumber { + return UriTemplateFormat1BoxedNumber(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: String, configuration: SchemaConfiguration?): UriTemplateFormat1BoxedString { + return UriTemplateFormat1BoxedString(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: List<*>, configuration: SchemaConfiguration?): UriTemplateFormat1BoxedList { + return UriTemplateFormat1BoxedList(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: Map<*, *>, configuration: SchemaConfiguration?): UriTemplateFormat1BoxedMap { + return UriTemplateFormat1BoxedMap(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: Any?, configuration: SchemaConfiguration?): UriTemplateFormat1Boxed { + if (arg == null) { + return validateAndBox(null, configuration) + } else if (arg is Boolean) { + return validateAndBox(arg, configuration) + } else if (arg is String) { + return validateAndBox(arg, configuration) + } else if (arg is Number) { + return validateAndBox(arg, configuration) + } else if (arg is List<*>) { + return validateAndBox(arg, configuration) + } else if (arg is Map<*, *>) { + return validateAndBox(arg, configuration) + } + throw ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema") + } + } +} diff --git a/samples/client/3_1_0_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/schemas/UuidFormat.kt b/samples/client/3_1_0_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/schemas/UuidFormat.kt new file mode 100644 index 00000000000..d4d16481ada --- /dev/null +++ b/samples/client/3_1_0_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/schemas/UuidFormat.kt @@ -0,0 +1,308 @@ +package org.openapijsonschematools.client.components.schemas +import java.time.LocalDate +import java.time.ZonedDateTime +import java.util.UUID +import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags +import org.openapijsonschematools.client.configurations.SchemaConfiguration +import org.openapijsonschematools.client.exceptions.InvalidAdditionalPropertyException +import org.openapijsonschematools.client.exceptions.UnsetPropertyException +import org.openapijsonschematools.client.exceptions.ValidationException +import org.openapijsonschematools.client.schemas.UnsetAddPropsSetter +import org.openapijsonschematools.client.schemas.validation.BooleanSchemaValidator +import org.openapijsonschematools.client.schemas.validation.FrozenList +import org.openapijsonschematools.client.schemas.validation.FrozenMap +import org.openapijsonschematools.client.schemas.validation.JsonSchema +import org.openapijsonschematools.client.schemas.validation.JsonSchemaInfo +import org.openapijsonschematools.client.schemas.validation.ListSchemaValidator +import org.openapijsonschematools.client.schemas.validation.MapSchemaValidator +import org.openapijsonschematools.client.schemas.validation.NullSchemaValidator +import org.openapijsonschematools.client.schemas.validation.NumberSchemaValidator +import org.openapijsonschematools.client.schemas.validation.PathToSchemasMap +import org.openapijsonschematools.client.schemas.validation.StringSchemaValidator +import org.openapijsonschematools.client.schemas.validation.ValidationMetadata + +class UuidFormat { + // nest classes so all schemas and input/output classes can be public + + + sealed interface UuidFormat1Boxed { + fun getData(): Any? + } + + data class UuidFormat1BoxedVoid(val data: Nothing?) : UuidFormat1Boxed { + override fun getData(): Any? { + return data + } + } + + data class UuidFormat1BoxedBoolean(val data: Boolean): UuidFormat1Boxed { + override fun getData(): Any? { + return data + } + } + + data class UuidFormat1BoxedNumber(val data: Number) : UuidFormat1Boxed { + override fun getData(): Any? { + return data + } + } + + data class UuidFormat1BoxedString(val data: String) : UuidFormat1Boxed { + override fun getData(): Any? { + return data + } + } + + data class UuidFormat1BoxedList(val data: FrozenList) : UuidFormat1Boxed { + override fun getData(): Any? { + return data + } + } + + data class UuidFormat1BoxedMap(val data: FrozenMap) : UuidFormat1Boxed { + override fun getData(): Any? { + return data + } + } + + + class UuidFormat1 private constructor(): JsonSchema( + JsonSchemaInfo() + .format("uuid") + ), NullSchemaValidator, BooleanSchemaValidator, NumberSchemaValidator, StringSchemaValidator, ListSchemaValidator, UuidFormat1BoxedList>, MapSchemaValidator, UuidFormat1BoxedMap> { + /* + NOTE: This class is auto generated by OpenAPI JSON Schema Generator. + Ref: https://github.com/openapi-json-schema-tools/openapi-json-schema-generator + + Do not edit the class manually. + */ + + companion object { + @Volatile + private var instance: UuidFormat1? = null + + fun getInstance() = + instance ?: synchronized(this) { + instance ?: UuidFormat1().also { instance = it } + } + } + + @Throws(ValidationException::class) + override fun validate(arg: Nothing?, configuration: SchemaConfiguration?): Nothing? { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validatedPathToSchemas = PathToSchemasMap() + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, LinkedHashSet()) + getPathToSchemas(this, castArg, validationMetadata, pathSet) + return castArg + } + + @Throws(ValidationException::class) + override fun validate(arg: Boolean, configuration: SchemaConfiguration?): Boolean { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validatedPathToSchemas = PathToSchemasMap() + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, LinkedHashSet()) + getPathToSchemas(this, castArg, validationMetadata, pathSet) + return castArg + } + + @Throws(ValidationException::class) + override fun validate(arg: Number, configuration: SchemaConfiguration?): Number { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validatedPathToSchemas = PathToSchemasMap() + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, LinkedHashSet()) + getPathToSchemas(this, castArg, validationMetadata, pathSet) + return castArg + } + + @Throws(ValidationException::class) + fun validate(arg: Int, configuration: SchemaConfiguration?): Int { + return validate(arg as Number, configuration) as Int + } + + @Throws(ValidationException::class) + fun validate(arg: Long, configuration: SchemaConfiguration?): Long { + return validate(arg as Number, configuration) as Long + } + + @Throws(ValidationException::class) + fun validate(arg: Float, configuration: SchemaConfiguration?): Float { + return validate(arg as Number, configuration) as Float + } + + @Throws(ValidationException::class) + fun validate(arg: Double, configuration: SchemaConfiguration?): Double { + return validate(arg as Number, configuration) as Double + } + + @Throws(ValidationException::class) + override fun validate(arg: String, configuration: SchemaConfiguration?): String { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validatedPathToSchemas = PathToSchemasMap() + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, LinkedHashSet()) + getPathToSchemas(this, castArg, validationMetadata, pathSet) + return castArg + } + + @Throws(ValidationException::class) + fun validate(arg: LocalDate, configuration: SchemaConfiguration?): String { + return validate(arg.toString(), configuration) + } + + @Throws(ValidationException::class) + fun validate(arg: ZonedDateTime, configuration: SchemaConfiguration?): String { + return validate(arg.toString(), configuration) + } + + @Throws(ValidationException::class) + fun validate(arg: UUID, configuration: SchemaConfiguration?): String { + return validate(arg.toString(), configuration) + } + + override fun getNewInstance(arg: List<*>, pathToItem: List, pathToSchemas: PathToSchemasMap): FrozenList { + val items: MutableList = ArrayList() + var i: Int = 0 + for (item: Any? in arg) { + val itemPathToItem = pathToItem + i + val schemas: LinkedHashMap, Nothing?>? = pathToSchemas.get(itemPathToItem) + if (schemas == null) { + throw RuntimeException("Validation result is invalid, schemas must exist for a pathToItem") + } + val itemSchema: JsonSchema<*> = schemas.entries.iterator().next().key + val itemInstance: Any? = itemSchema.getNewInstance(item, itemPathToItem, pathToSchemas) + items.add(itemInstance) + i += 1 + } + val newInstanceItems: FrozenList = FrozenList(items) + return newInstanceItems + } + + @Throws(ValidationException::class) + override fun validate(arg: List<*>, configuration: SchemaConfiguration?): FrozenList { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, PathToSchemasMap(), LinkedHashSet()) + val pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet) + return getNewInstance(castArg, validationMetadata.pathToItem, pathToSchemasMap) + } + + override fun getNewInstance(arg: Map<*, *>, pathToItem: List, pathToSchemas: PathToSchemasMap): FrozenMap { + val properties: LinkedHashMap = LinkedHashMap() + for((propertyName, value) in arg) { + if (!(propertyName is String)) { + throw RuntimeException("Invalid non-string key value") + } + val propertyPathToItem: List = pathToItem + propertyName + val schemas: LinkedHashMap, Nothing?>? = pathToSchemas.get(propertyPathToItem) + if (schemas == null) { + throw RuntimeException("Validation result is invalid, schemas must exist for a pathToItem") + } + val propertySchema: JsonSchema<*> = schemas.entries.iterator().next().key + val propertyInstance: Any? = propertySchema.getNewInstance(value, propertyPathToItem, pathToSchemas) + properties[propertyName] = propertyInstance + } + val castProperties: FrozenMap = FrozenMap(properties) + return castProperties + } + + @Throws(ValidationException::class) + override fun validate(arg: Map<*, *>, configuration: SchemaConfiguration?): FrozenMap { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validatedPathToSchemas = PathToSchemasMap() + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, LinkedHashSet()) + val pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet) + return getNewInstance(castArg, validationMetadata.pathToItem, pathToSchemasMap) + } + + @Throws(ValidationException::class) + override fun validate(arg: Any?, configuration: SchemaConfiguration?): Any? { + if (arg == null) { + return validate(null, configuration) + } else if (arg is Boolean) { + return validate(arg, configuration) + } else if (arg is Number) { + return validate(arg, configuration) + } else if (arg is String) { + return validate(arg, configuration) + } else if (arg is List<*>) { + return validate(arg, configuration) + } else if (arg is Map<*, *>) { + return validate(arg, configuration) + } + throw ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema") + } + override fun getNewInstance(arg: Any?, pathToItem: List, pathToSchemas: PathToSchemasMap): Any? { + if (arg == null) { + return getNewInstance( null, pathToItem, pathToSchemas) + } else if (arg is Boolean) { + return getNewInstance(arg, pathToItem, pathToSchemas) + } else if (arg is Number) { + return getNewInstance(arg, pathToItem, pathToSchemas) + } else if (arg is String) { + return getNewInstance(arg, pathToItem, pathToSchemas) + } else if (arg is List<*>) { + return getNewInstance(arg, pathToItem, pathToSchemas) + } else if (arg is Map<*, *>) { + return getNewInstance(arg, pathToItem, pathToSchemas) + } + throw RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema") + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: Nothing?, configuration: SchemaConfiguration?): UuidFormat1BoxedVoid { + return UuidFormat1BoxedVoid(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: Boolean, configuration: SchemaConfiguration?): UuidFormat1BoxedBoolean { + return UuidFormat1BoxedBoolean(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: Number, configuration: SchemaConfiguration?): UuidFormat1BoxedNumber { + return UuidFormat1BoxedNumber(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: String, configuration: SchemaConfiguration?): UuidFormat1BoxedString { + return UuidFormat1BoxedString(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: List<*>, configuration: SchemaConfiguration?): UuidFormat1BoxedList { + return UuidFormat1BoxedList(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: Map<*, *>, configuration: SchemaConfiguration?): UuidFormat1BoxedMap { + return UuidFormat1BoxedMap(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: Any?, configuration: SchemaConfiguration?): UuidFormat1Boxed { + if (arg == null) { + return validateAndBox(null, configuration) + } else if (arg is Boolean) { + return validateAndBox(arg, configuration) + } else if (arg is String) { + return validateAndBox(arg, configuration) + } else if (arg is Number) { + return validateAndBox(arg, configuration) + } else if (arg is List<*>) { + return validateAndBox(arg, configuration) + } else if (arg is Map<*, *>) { + return validateAndBox(arg, configuration) + } + throw ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema") + } + } +} diff --git a/samples/client/3_1_0_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/schemas/ValidateAgainstCorrectBranchThenVsElse.kt b/samples/client/3_1_0_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/schemas/ValidateAgainstCorrectBranchThenVsElse.kt new file mode 100644 index 00000000000..088e740f01a --- /dev/null +++ b/samples/client/3_1_0_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/schemas/ValidateAgainstCorrectBranchThenVsElse.kt @@ -0,0 +1,1136 @@ +package org.openapijsonschematools.client.components.schemas +import java.math.BigDecimal +import java.time.LocalDate +import java.time.ZonedDateTime +import java.util.UUID +import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags +import org.openapijsonschematools.client.configurations.SchemaConfiguration +import org.openapijsonschematools.client.exceptions.InvalidAdditionalPropertyException +import org.openapijsonschematools.client.exceptions.UnsetPropertyException +import org.openapijsonschematools.client.exceptions.ValidationException +import org.openapijsonschematools.client.schemas.UnsetAddPropsSetter +import org.openapijsonschematools.client.schemas.validation.BooleanSchemaValidator +import org.openapijsonschematools.client.schemas.validation.FrozenList +import org.openapijsonschematools.client.schemas.validation.FrozenMap +import org.openapijsonschematools.client.schemas.validation.JsonSchema +import org.openapijsonschematools.client.schemas.validation.JsonSchemaInfo +import org.openapijsonschematools.client.schemas.validation.ListSchemaValidator +import org.openapijsonschematools.client.schemas.validation.MapSchemaValidator +import org.openapijsonschematools.client.schemas.validation.NullSchemaValidator +import org.openapijsonschematools.client.schemas.validation.NumberSchemaValidator +import org.openapijsonschematools.client.schemas.validation.PathToSchemasMap +import org.openapijsonschematools.client.schemas.validation.StringSchemaValidator +import org.openapijsonschematools.client.schemas.validation.ValidationMetadata + +class ValidateAgainstCorrectBranchThenVsElse { + // nest classes so all schemas and input/output classes can be public + + + sealed interface ElseSchemaBoxed { + fun getData(): Any? + } + + data class ElseSchemaBoxedVoid(val data: Nothing?) : ElseSchemaBoxed { + override fun getData(): Any? { + return data + } + } + + data class ElseSchemaBoxedBoolean(val data: Boolean): ElseSchemaBoxed { + override fun getData(): Any? { + return data + } + } + + data class ElseSchemaBoxedNumber(val data: Number) : ElseSchemaBoxed { + override fun getData(): Any? { + return data + } + } + + data class ElseSchemaBoxedString(val data: String) : ElseSchemaBoxed { + override fun getData(): Any? { + return data + } + } + + data class ElseSchemaBoxedList(val data: FrozenList) : ElseSchemaBoxed { + override fun getData(): Any? { + return data + } + } + + data class ElseSchemaBoxedMap(val data: FrozenMap) : ElseSchemaBoxed { + override fun getData(): Any? { + return data + } + } + + + class ElseSchema private constructor(): JsonSchema( + JsonSchemaInfo() + .multipleOf(BigDecimal("2")) + ), NullSchemaValidator, BooleanSchemaValidator, NumberSchemaValidator, StringSchemaValidator, ListSchemaValidator, ElseSchemaBoxedList>, MapSchemaValidator, ElseSchemaBoxedMap> { + + companion object { + @Volatile + private var instance: ElseSchema? = null + + fun getInstance() = + instance ?: synchronized(this) { + instance ?: ElseSchema().also { instance = it } + } + } + + @Throws(ValidationException::class) + override fun validate(arg: Nothing?, configuration: SchemaConfiguration?): Nothing? { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validatedPathToSchemas = PathToSchemasMap() + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, LinkedHashSet()) + getPathToSchemas(this, castArg, validationMetadata, pathSet) + return castArg + } + + @Throws(ValidationException::class) + override fun validate(arg: Boolean, configuration: SchemaConfiguration?): Boolean { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validatedPathToSchemas = PathToSchemasMap() + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, LinkedHashSet()) + getPathToSchemas(this, castArg, validationMetadata, pathSet) + return castArg + } + + @Throws(ValidationException::class) + override fun validate(arg: Number, configuration: SchemaConfiguration?): Number { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validatedPathToSchemas = PathToSchemasMap() + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, LinkedHashSet()) + getPathToSchemas(this, castArg, validationMetadata, pathSet) + return castArg + } + + @Throws(ValidationException::class) + fun validate(arg: Int, configuration: SchemaConfiguration?): Int { + return validate(arg as Number, configuration) as Int + } + + @Throws(ValidationException::class) + fun validate(arg: Long, configuration: SchemaConfiguration?): Long { + return validate(arg as Number, configuration) as Long + } + + @Throws(ValidationException::class) + fun validate(arg: Float, configuration: SchemaConfiguration?): Float { + return validate(arg as Number, configuration) as Float + } + + @Throws(ValidationException::class) + fun validate(arg: Double, configuration: SchemaConfiguration?): Double { + return validate(arg as Number, configuration) as Double + } + + @Throws(ValidationException::class) + override fun validate(arg: String, configuration: SchemaConfiguration?): String { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validatedPathToSchemas = PathToSchemasMap() + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, LinkedHashSet()) + getPathToSchemas(this, castArg, validationMetadata, pathSet) + return castArg + } + + @Throws(ValidationException::class) + fun validate(arg: LocalDate, configuration: SchemaConfiguration?): String { + return validate(arg.toString(), configuration) + } + + @Throws(ValidationException::class) + fun validate(arg: ZonedDateTime, configuration: SchemaConfiguration?): String { + return validate(arg.toString(), configuration) + } + + @Throws(ValidationException::class) + fun validate(arg: UUID, configuration: SchemaConfiguration?): String { + return validate(arg.toString(), configuration) + } + + override fun getNewInstance(arg: List<*>, pathToItem: List, pathToSchemas: PathToSchemasMap): FrozenList { + val items: MutableList = ArrayList() + var i: Int = 0 + for (item: Any? in arg) { + val itemPathToItem = pathToItem + i + val schemas: LinkedHashMap, Nothing?>? = pathToSchemas.get(itemPathToItem) + if (schemas == null) { + throw RuntimeException("Validation result is invalid, schemas must exist for a pathToItem") + } + val itemSchema: JsonSchema<*> = schemas.entries.iterator().next().key + val itemInstance: Any? = itemSchema.getNewInstance(item, itemPathToItem, pathToSchemas) + items.add(itemInstance) + i += 1 + } + val newInstanceItems: FrozenList = FrozenList(items) + return newInstanceItems + } + + @Throws(ValidationException::class) + override fun validate(arg: List<*>, configuration: SchemaConfiguration?): FrozenList { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, PathToSchemasMap(), LinkedHashSet()) + val pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet) + return getNewInstance(castArg, validationMetadata.pathToItem, pathToSchemasMap) + } + + override fun getNewInstance(arg: Map<*, *>, pathToItem: List, pathToSchemas: PathToSchemasMap): FrozenMap { + val properties: LinkedHashMap = LinkedHashMap() + for((propertyName, value) in arg) { + if (!(propertyName is String)) { + throw RuntimeException("Invalid non-string key value") + } + val propertyPathToItem: List = pathToItem + propertyName + val schemas: LinkedHashMap, Nothing?>? = pathToSchemas.get(propertyPathToItem) + if (schemas == null) { + throw RuntimeException("Validation result is invalid, schemas must exist for a pathToItem") + } + val propertySchema: JsonSchema<*> = schemas.entries.iterator().next().key + val propertyInstance: Any? = propertySchema.getNewInstance(value, propertyPathToItem, pathToSchemas) + properties[propertyName] = propertyInstance + } + val castProperties: FrozenMap = FrozenMap(properties) + return castProperties + } + + @Throws(ValidationException::class) + override fun validate(arg: Map<*, *>, configuration: SchemaConfiguration?): FrozenMap { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validatedPathToSchemas = PathToSchemasMap() + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, LinkedHashSet()) + val pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet) + return getNewInstance(castArg, validationMetadata.pathToItem, pathToSchemasMap) + } + + @Throws(ValidationException::class) + override fun validate(arg: Any?, configuration: SchemaConfiguration?): Any? { + if (arg == null) { + return validate(null, configuration) + } else if (arg is Boolean) { + return validate(arg, configuration) + } else if (arg is Number) { + return validate(arg, configuration) + } else if (arg is String) { + return validate(arg, configuration) + } else if (arg is List<*>) { + return validate(arg, configuration) + } else if (arg is Map<*, *>) { + return validate(arg, configuration) + } + throw ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema") + } + override fun getNewInstance(arg: Any?, pathToItem: List, pathToSchemas: PathToSchemasMap): Any? { + if (arg == null) { + return getNewInstance( null, pathToItem, pathToSchemas) + } else if (arg is Boolean) { + return getNewInstance(arg, pathToItem, pathToSchemas) + } else if (arg is Number) { + return getNewInstance(arg, pathToItem, pathToSchemas) + } else if (arg is String) { + return getNewInstance(arg, pathToItem, pathToSchemas) + } else if (arg is List<*>) { + return getNewInstance(arg, pathToItem, pathToSchemas) + } else if (arg is Map<*, *>) { + return getNewInstance(arg, pathToItem, pathToSchemas) + } + throw RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema") + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: Nothing?, configuration: SchemaConfiguration?): ElseSchemaBoxedVoid { + return ElseSchemaBoxedVoid(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: Boolean, configuration: SchemaConfiguration?): ElseSchemaBoxedBoolean { + return ElseSchemaBoxedBoolean(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: Number, configuration: SchemaConfiguration?): ElseSchemaBoxedNumber { + return ElseSchemaBoxedNumber(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: String, configuration: SchemaConfiguration?): ElseSchemaBoxedString { + return ElseSchemaBoxedString(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: List<*>, configuration: SchemaConfiguration?): ElseSchemaBoxedList { + return ElseSchemaBoxedList(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: Map<*, *>, configuration: SchemaConfiguration?): ElseSchemaBoxedMap { + return ElseSchemaBoxedMap(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: Any?, configuration: SchemaConfiguration?): ElseSchemaBoxed { + if (arg == null) { + return validateAndBox(null, configuration) + } else if (arg is Boolean) { + return validateAndBox(arg, configuration) + } else if (arg is String) { + return validateAndBox(arg, configuration) + } else if (arg is Number) { + return validateAndBox(arg, configuration) + } else if (arg is List<*>) { + return validateAndBox(arg, configuration) + } else if (arg is Map<*, *>) { + return validateAndBox(arg, configuration) + } + throw ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema") + } + } + + sealed interface IfSchemaBoxed { + fun getData(): Any? + } + + data class IfSchemaBoxedVoid(val data: Nothing?) : IfSchemaBoxed { + override fun getData(): Any? { + return data + } + } + + data class IfSchemaBoxedBoolean(val data: Boolean): IfSchemaBoxed { + override fun getData(): Any? { + return data + } + } + + data class IfSchemaBoxedNumber(val data: Number) : IfSchemaBoxed { + override fun getData(): Any? { + return data + } + } + + data class IfSchemaBoxedString(val data: String) : IfSchemaBoxed { + override fun getData(): Any? { + return data + } + } + + data class IfSchemaBoxedList(val data: FrozenList) : IfSchemaBoxed { + override fun getData(): Any? { + return data + } + } + + data class IfSchemaBoxedMap(val data: FrozenMap) : IfSchemaBoxed { + override fun getData(): Any? { + return data + } + } + + + class IfSchema private constructor(): JsonSchema( + JsonSchemaInfo() + .exclusiveMaximum(0) + ), NullSchemaValidator, BooleanSchemaValidator, NumberSchemaValidator, StringSchemaValidator, ListSchemaValidator, IfSchemaBoxedList>, MapSchemaValidator, IfSchemaBoxedMap> { + + companion object { + @Volatile + private var instance: IfSchema? = null + + fun getInstance() = + instance ?: synchronized(this) { + instance ?: IfSchema().also { instance = it } + } + } + + @Throws(ValidationException::class) + override fun validate(arg: Nothing?, configuration: SchemaConfiguration?): Nothing? { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validatedPathToSchemas = PathToSchemasMap() + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, LinkedHashSet()) + getPathToSchemas(this, castArg, validationMetadata, pathSet) + return castArg + } + + @Throws(ValidationException::class) + override fun validate(arg: Boolean, configuration: SchemaConfiguration?): Boolean { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validatedPathToSchemas = PathToSchemasMap() + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, LinkedHashSet()) + getPathToSchemas(this, castArg, validationMetadata, pathSet) + return castArg + } + + @Throws(ValidationException::class) + override fun validate(arg: Number, configuration: SchemaConfiguration?): Number { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validatedPathToSchemas = PathToSchemasMap() + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, LinkedHashSet()) + getPathToSchemas(this, castArg, validationMetadata, pathSet) + return castArg + } + + @Throws(ValidationException::class) + fun validate(arg: Int, configuration: SchemaConfiguration?): Int { + return validate(arg as Number, configuration) as Int + } + + @Throws(ValidationException::class) + fun validate(arg: Long, configuration: SchemaConfiguration?): Long { + return validate(arg as Number, configuration) as Long + } + + @Throws(ValidationException::class) + fun validate(arg: Float, configuration: SchemaConfiguration?): Float { + return validate(arg as Number, configuration) as Float + } + + @Throws(ValidationException::class) + fun validate(arg: Double, configuration: SchemaConfiguration?): Double { + return validate(arg as Number, configuration) as Double + } + + @Throws(ValidationException::class) + override fun validate(arg: String, configuration: SchemaConfiguration?): String { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validatedPathToSchemas = PathToSchemasMap() + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, LinkedHashSet()) + getPathToSchemas(this, castArg, validationMetadata, pathSet) + return castArg + } + + @Throws(ValidationException::class) + fun validate(arg: LocalDate, configuration: SchemaConfiguration?): String { + return validate(arg.toString(), configuration) + } + + @Throws(ValidationException::class) + fun validate(arg: ZonedDateTime, configuration: SchemaConfiguration?): String { + return validate(arg.toString(), configuration) + } + + @Throws(ValidationException::class) + fun validate(arg: UUID, configuration: SchemaConfiguration?): String { + return validate(arg.toString(), configuration) + } + + override fun getNewInstance(arg: List<*>, pathToItem: List, pathToSchemas: PathToSchemasMap): FrozenList { + val items: MutableList = ArrayList() + var i: Int = 0 + for (item: Any? in arg) { + val itemPathToItem = pathToItem + i + val schemas: LinkedHashMap, Nothing?>? = pathToSchemas.get(itemPathToItem) + if (schemas == null) { + throw RuntimeException("Validation result is invalid, schemas must exist for a pathToItem") + } + val itemSchema: JsonSchema<*> = schemas.entries.iterator().next().key + val itemInstance: Any? = itemSchema.getNewInstance(item, itemPathToItem, pathToSchemas) + items.add(itemInstance) + i += 1 + } + val newInstanceItems: FrozenList = FrozenList(items) + return newInstanceItems + } + + @Throws(ValidationException::class) + override fun validate(arg: List<*>, configuration: SchemaConfiguration?): FrozenList { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, PathToSchemasMap(), LinkedHashSet()) + val pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet) + return getNewInstance(castArg, validationMetadata.pathToItem, pathToSchemasMap) + } + + override fun getNewInstance(arg: Map<*, *>, pathToItem: List, pathToSchemas: PathToSchemasMap): FrozenMap { + val properties: LinkedHashMap = LinkedHashMap() + for((propertyName, value) in arg) { + if (!(propertyName is String)) { + throw RuntimeException("Invalid non-string key value") + } + val propertyPathToItem: List = pathToItem + propertyName + val schemas: LinkedHashMap, Nothing?>? = pathToSchemas.get(propertyPathToItem) + if (schemas == null) { + throw RuntimeException("Validation result is invalid, schemas must exist for a pathToItem") + } + val propertySchema: JsonSchema<*> = schemas.entries.iterator().next().key + val propertyInstance: Any? = propertySchema.getNewInstance(value, propertyPathToItem, pathToSchemas) + properties[propertyName] = propertyInstance + } + val castProperties: FrozenMap = FrozenMap(properties) + return castProperties + } + + @Throws(ValidationException::class) + override fun validate(arg: Map<*, *>, configuration: SchemaConfiguration?): FrozenMap { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validatedPathToSchemas = PathToSchemasMap() + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, LinkedHashSet()) + val pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet) + return getNewInstance(castArg, validationMetadata.pathToItem, pathToSchemasMap) + } + + @Throws(ValidationException::class) + override fun validate(arg: Any?, configuration: SchemaConfiguration?): Any? { + if (arg == null) { + return validate(null, configuration) + } else if (arg is Boolean) { + return validate(arg, configuration) + } else if (arg is Number) { + return validate(arg, configuration) + } else if (arg is String) { + return validate(arg, configuration) + } else if (arg is List<*>) { + return validate(arg, configuration) + } else if (arg is Map<*, *>) { + return validate(arg, configuration) + } + throw ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema") + } + override fun getNewInstance(arg: Any?, pathToItem: List, pathToSchemas: PathToSchemasMap): Any? { + if (arg == null) { + return getNewInstance( null, pathToItem, pathToSchemas) + } else if (arg is Boolean) { + return getNewInstance(arg, pathToItem, pathToSchemas) + } else if (arg is Number) { + return getNewInstance(arg, pathToItem, pathToSchemas) + } else if (arg is String) { + return getNewInstance(arg, pathToItem, pathToSchemas) + } else if (arg is List<*>) { + return getNewInstance(arg, pathToItem, pathToSchemas) + } else if (arg is Map<*, *>) { + return getNewInstance(arg, pathToItem, pathToSchemas) + } + throw RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema") + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: Nothing?, configuration: SchemaConfiguration?): IfSchemaBoxedVoid { + return IfSchemaBoxedVoid(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: Boolean, configuration: SchemaConfiguration?): IfSchemaBoxedBoolean { + return IfSchemaBoxedBoolean(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: Number, configuration: SchemaConfiguration?): IfSchemaBoxedNumber { + return IfSchemaBoxedNumber(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: String, configuration: SchemaConfiguration?): IfSchemaBoxedString { + return IfSchemaBoxedString(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: List<*>, configuration: SchemaConfiguration?): IfSchemaBoxedList { + return IfSchemaBoxedList(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: Map<*, *>, configuration: SchemaConfiguration?): IfSchemaBoxedMap { + return IfSchemaBoxedMap(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: Any?, configuration: SchemaConfiguration?): IfSchemaBoxed { + if (arg == null) { + return validateAndBox(null, configuration) + } else if (arg is Boolean) { + return validateAndBox(arg, configuration) + } else if (arg is String) { + return validateAndBox(arg, configuration) + } else if (arg is Number) { + return validateAndBox(arg, configuration) + } else if (arg is List<*>) { + return validateAndBox(arg, configuration) + } else if (arg is Map<*, *>) { + return validateAndBox(arg, configuration) + } + throw ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema") + } + } + + sealed interface ThenBoxed { + fun getData(): Any? + } + + data class ThenBoxedVoid(val data: Nothing?) : ThenBoxed { + override fun getData(): Any? { + return data + } + } + + data class ThenBoxedBoolean(val data: Boolean): ThenBoxed { + override fun getData(): Any? { + return data + } + } + + data class ThenBoxedNumber(val data: Number) : ThenBoxed { + override fun getData(): Any? { + return data + } + } + + data class ThenBoxedString(val data: String) : ThenBoxed { + override fun getData(): Any? { + return data + } + } + + data class ThenBoxedList(val data: FrozenList) : ThenBoxed { + override fun getData(): Any? { + return data + } + } + + data class ThenBoxedMap(val data: FrozenMap) : ThenBoxed { + override fun getData(): Any? { + return data + } + } + + + class Then private constructor(): JsonSchema( + JsonSchemaInfo() + .minimum(-10) + ), NullSchemaValidator, BooleanSchemaValidator, NumberSchemaValidator, StringSchemaValidator, ListSchemaValidator, ThenBoxedList>, MapSchemaValidator, ThenBoxedMap> { + + companion object { + @Volatile + private var instance: Then? = null + + fun getInstance() = + instance ?: synchronized(this) { + instance ?: Then().also { instance = it } + } + } + + @Throws(ValidationException::class) + override fun validate(arg: Nothing?, configuration: SchemaConfiguration?): Nothing? { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validatedPathToSchemas = PathToSchemasMap() + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, LinkedHashSet()) + getPathToSchemas(this, castArg, validationMetadata, pathSet) + return castArg + } + + @Throws(ValidationException::class) + override fun validate(arg: Boolean, configuration: SchemaConfiguration?): Boolean { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validatedPathToSchemas = PathToSchemasMap() + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, LinkedHashSet()) + getPathToSchemas(this, castArg, validationMetadata, pathSet) + return castArg + } + + @Throws(ValidationException::class) + override fun validate(arg: Number, configuration: SchemaConfiguration?): Number { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validatedPathToSchemas = PathToSchemasMap() + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, LinkedHashSet()) + getPathToSchemas(this, castArg, validationMetadata, pathSet) + return castArg + } + + @Throws(ValidationException::class) + fun validate(arg: Int, configuration: SchemaConfiguration?): Int { + return validate(arg as Number, configuration) as Int + } + + @Throws(ValidationException::class) + fun validate(arg: Long, configuration: SchemaConfiguration?): Long { + return validate(arg as Number, configuration) as Long + } + + @Throws(ValidationException::class) + fun validate(arg: Float, configuration: SchemaConfiguration?): Float { + return validate(arg as Number, configuration) as Float + } + + @Throws(ValidationException::class) + fun validate(arg: Double, configuration: SchemaConfiguration?): Double { + return validate(arg as Number, configuration) as Double + } + + @Throws(ValidationException::class) + override fun validate(arg: String, configuration: SchemaConfiguration?): String { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validatedPathToSchemas = PathToSchemasMap() + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, LinkedHashSet()) + getPathToSchemas(this, castArg, validationMetadata, pathSet) + return castArg + } + + @Throws(ValidationException::class) + fun validate(arg: LocalDate, configuration: SchemaConfiguration?): String { + return validate(arg.toString(), configuration) + } + + @Throws(ValidationException::class) + fun validate(arg: ZonedDateTime, configuration: SchemaConfiguration?): String { + return validate(arg.toString(), configuration) + } + + @Throws(ValidationException::class) + fun validate(arg: UUID, configuration: SchemaConfiguration?): String { + return validate(arg.toString(), configuration) + } + + override fun getNewInstance(arg: List<*>, pathToItem: List, pathToSchemas: PathToSchemasMap): FrozenList { + val items: MutableList = ArrayList() + var i: Int = 0 + for (item: Any? in arg) { + val itemPathToItem = pathToItem + i + val schemas: LinkedHashMap, Nothing?>? = pathToSchemas.get(itemPathToItem) + if (schemas == null) { + throw RuntimeException("Validation result is invalid, schemas must exist for a pathToItem") + } + val itemSchema: JsonSchema<*> = schemas.entries.iterator().next().key + val itemInstance: Any? = itemSchema.getNewInstance(item, itemPathToItem, pathToSchemas) + items.add(itemInstance) + i += 1 + } + val newInstanceItems: FrozenList = FrozenList(items) + return newInstanceItems + } + + @Throws(ValidationException::class) + override fun validate(arg: List<*>, configuration: SchemaConfiguration?): FrozenList { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, PathToSchemasMap(), LinkedHashSet()) + val pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet) + return getNewInstance(castArg, validationMetadata.pathToItem, pathToSchemasMap) + } + + override fun getNewInstance(arg: Map<*, *>, pathToItem: List, pathToSchemas: PathToSchemasMap): FrozenMap { + val properties: LinkedHashMap = LinkedHashMap() + for((propertyName, value) in arg) { + if (!(propertyName is String)) { + throw RuntimeException("Invalid non-string key value") + } + val propertyPathToItem: List = pathToItem + propertyName + val schemas: LinkedHashMap, Nothing?>? = pathToSchemas.get(propertyPathToItem) + if (schemas == null) { + throw RuntimeException("Validation result is invalid, schemas must exist for a pathToItem") + } + val propertySchema: JsonSchema<*> = schemas.entries.iterator().next().key + val propertyInstance: Any? = propertySchema.getNewInstance(value, propertyPathToItem, pathToSchemas) + properties[propertyName] = propertyInstance + } + val castProperties: FrozenMap = FrozenMap(properties) + return castProperties + } + + @Throws(ValidationException::class) + override fun validate(arg: Map<*, *>, configuration: SchemaConfiguration?): FrozenMap { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validatedPathToSchemas = PathToSchemasMap() + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, LinkedHashSet()) + val pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet) + return getNewInstance(castArg, validationMetadata.pathToItem, pathToSchemasMap) + } + + @Throws(ValidationException::class) + override fun validate(arg: Any?, configuration: SchemaConfiguration?): Any? { + if (arg == null) { + return validate(null, configuration) + } else if (arg is Boolean) { + return validate(arg, configuration) + } else if (arg is Number) { + return validate(arg, configuration) + } else if (arg is String) { + return validate(arg, configuration) + } else if (arg is List<*>) { + return validate(arg, configuration) + } else if (arg is Map<*, *>) { + return validate(arg, configuration) + } + throw ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema") + } + override fun getNewInstance(arg: Any?, pathToItem: List, pathToSchemas: PathToSchemasMap): Any? { + if (arg == null) { + return getNewInstance( null, pathToItem, pathToSchemas) + } else if (arg is Boolean) { + return getNewInstance(arg, pathToItem, pathToSchemas) + } else if (arg is Number) { + return getNewInstance(arg, pathToItem, pathToSchemas) + } else if (arg is String) { + return getNewInstance(arg, pathToItem, pathToSchemas) + } else if (arg is List<*>) { + return getNewInstance(arg, pathToItem, pathToSchemas) + } else if (arg is Map<*, *>) { + return getNewInstance(arg, pathToItem, pathToSchemas) + } + throw RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema") + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: Nothing?, configuration: SchemaConfiguration?): ThenBoxedVoid { + return ThenBoxedVoid(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: Boolean, configuration: SchemaConfiguration?): ThenBoxedBoolean { + return ThenBoxedBoolean(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: Number, configuration: SchemaConfiguration?): ThenBoxedNumber { + return ThenBoxedNumber(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: String, configuration: SchemaConfiguration?): ThenBoxedString { + return ThenBoxedString(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: List<*>, configuration: SchemaConfiguration?): ThenBoxedList { + return ThenBoxedList(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: Map<*, *>, configuration: SchemaConfiguration?): ThenBoxedMap { + return ThenBoxedMap(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: Any?, configuration: SchemaConfiguration?): ThenBoxed { + if (arg == null) { + return validateAndBox(null, configuration) + } else if (arg is Boolean) { + return validateAndBox(arg, configuration) + } else if (arg is String) { + return validateAndBox(arg, configuration) + } else if (arg is Number) { + return validateAndBox(arg, configuration) + } else if (arg is List<*>) { + return validateAndBox(arg, configuration) + } else if (arg is Map<*, *>) { + return validateAndBox(arg, configuration) + } + throw ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema") + } + } + + sealed interface ValidateAgainstCorrectBranchThenVsElse1Boxed { + fun getData(): Any? + } + + data class ValidateAgainstCorrectBranchThenVsElse1BoxedVoid(val data: Nothing?) : ValidateAgainstCorrectBranchThenVsElse1Boxed { + override fun getData(): Any? { + return data + } + } + + data class ValidateAgainstCorrectBranchThenVsElse1BoxedBoolean(val data: Boolean): ValidateAgainstCorrectBranchThenVsElse1Boxed { + override fun getData(): Any? { + return data + } + } + + data class ValidateAgainstCorrectBranchThenVsElse1BoxedNumber(val data: Number) : ValidateAgainstCorrectBranchThenVsElse1Boxed { + override fun getData(): Any? { + return data + } + } + + data class ValidateAgainstCorrectBranchThenVsElse1BoxedString(val data: String) : ValidateAgainstCorrectBranchThenVsElse1Boxed { + override fun getData(): Any? { + return data + } + } + + data class ValidateAgainstCorrectBranchThenVsElse1BoxedList(val data: FrozenList) : ValidateAgainstCorrectBranchThenVsElse1Boxed { + override fun getData(): Any? { + return data + } + } + + data class ValidateAgainstCorrectBranchThenVsElse1BoxedMap(val data: FrozenMap) : ValidateAgainstCorrectBranchThenVsElse1Boxed { + override fun getData(): Any? { + return data + } + } + + + class ValidateAgainstCorrectBranchThenVsElse1 private constructor(): JsonSchema( + JsonSchemaInfo() + .ifSchema(IfSchema::class.java) + .then(Then::class.java) + .elseSchema(ElseSchema::class.java) + ), NullSchemaValidator, BooleanSchemaValidator, NumberSchemaValidator, StringSchemaValidator, ListSchemaValidator, ValidateAgainstCorrectBranchThenVsElse1BoxedList>, MapSchemaValidator, ValidateAgainstCorrectBranchThenVsElse1BoxedMap> { + /* + NOTE: This class is auto generated by OpenAPI JSON Schema Generator. + Ref: https://github.com/openapi-json-schema-tools/openapi-json-schema-generator + + Do not edit the class manually. + */ + + companion object { + @Volatile + private var instance: ValidateAgainstCorrectBranchThenVsElse1? = null + + fun getInstance() = + instance ?: synchronized(this) { + instance ?: ValidateAgainstCorrectBranchThenVsElse1().also { instance = it } + } + } + + @Throws(ValidationException::class) + override fun validate(arg: Nothing?, configuration: SchemaConfiguration?): Nothing? { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validatedPathToSchemas = PathToSchemasMap() + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, LinkedHashSet()) + getPathToSchemas(this, castArg, validationMetadata, pathSet) + return castArg + } + + @Throws(ValidationException::class) + override fun validate(arg: Boolean, configuration: SchemaConfiguration?): Boolean { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validatedPathToSchemas = PathToSchemasMap() + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, LinkedHashSet()) + getPathToSchemas(this, castArg, validationMetadata, pathSet) + return castArg + } + + @Throws(ValidationException::class) + override fun validate(arg: Number, configuration: SchemaConfiguration?): Number { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validatedPathToSchemas = PathToSchemasMap() + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, LinkedHashSet()) + getPathToSchemas(this, castArg, validationMetadata, pathSet) + return castArg + } + + @Throws(ValidationException::class) + fun validate(arg: Int, configuration: SchemaConfiguration?): Int { + return validate(arg as Number, configuration) as Int + } + + @Throws(ValidationException::class) + fun validate(arg: Long, configuration: SchemaConfiguration?): Long { + return validate(arg as Number, configuration) as Long + } + + @Throws(ValidationException::class) + fun validate(arg: Float, configuration: SchemaConfiguration?): Float { + return validate(arg as Number, configuration) as Float + } + + @Throws(ValidationException::class) + fun validate(arg: Double, configuration: SchemaConfiguration?): Double { + return validate(arg as Number, configuration) as Double + } + + @Throws(ValidationException::class) + override fun validate(arg: String, configuration: SchemaConfiguration?): String { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validatedPathToSchemas = PathToSchemasMap() + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, LinkedHashSet()) + getPathToSchemas(this, castArg, validationMetadata, pathSet) + return castArg + } + + @Throws(ValidationException::class) + fun validate(arg: LocalDate, configuration: SchemaConfiguration?): String { + return validate(arg.toString(), configuration) + } + + @Throws(ValidationException::class) + fun validate(arg: ZonedDateTime, configuration: SchemaConfiguration?): String { + return validate(arg.toString(), configuration) + } + + @Throws(ValidationException::class) + fun validate(arg: UUID, configuration: SchemaConfiguration?): String { + return validate(arg.toString(), configuration) + } + + override fun getNewInstance(arg: List<*>, pathToItem: List, pathToSchemas: PathToSchemasMap): FrozenList { + val items: MutableList = ArrayList() + var i: Int = 0 + for (item: Any? in arg) { + val itemPathToItem = pathToItem + i + val schemas: LinkedHashMap, Nothing?>? = pathToSchemas.get(itemPathToItem) + if (schemas == null) { + throw RuntimeException("Validation result is invalid, schemas must exist for a pathToItem") + } + val itemSchema: JsonSchema<*> = schemas.entries.iterator().next().key + val itemInstance: Any? = itemSchema.getNewInstance(item, itemPathToItem, pathToSchemas) + items.add(itemInstance) + i += 1 + } + val newInstanceItems: FrozenList = FrozenList(items) + return newInstanceItems + } + + @Throws(ValidationException::class) + override fun validate(arg: List<*>, configuration: SchemaConfiguration?): FrozenList { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, PathToSchemasMap(), LinkedHashSet()) + val pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet) + return getNewInstance(castArg, validationMetadata.pathToItem, pathToSchemasMap) + } + + override fun getNewInstance(arg: Map<*, *>, pathToItem: List, pathToSchemas: PathToSchemasMap): FrozenMap { + val properties: LinkedHashMap = LinkedHashMap() + for((propertyName, value) in arg) { + if (!(propertyName is String)) { + throw RuntimeException("Invalid non-string key value") + } + val propertyPathToItem: List = pathToItem + propertyName + val schemas: LinkedHashMap, Nothing?>? = pathToSchemas.get(propertyPathToItem) + if (schemas == null) { + throw RuntimeException("Validation result is invalid, schemas must exist for a pathToItem") + } + val propertySchema: JsonSchema<*> = schemas.entries.iterator().next().key + val propertyInstance: Any? = propertySchema.getNewInstance(value, propertyPathToItem, pathToSchemas) + properties[propertyName] = propertyInstance + } + val castProperties: FrozenMap = FrozenMap(properties) + return castProperties + } + + @Throws(ValidationException::class) + override fun validate(arg: Map<*, *>, configuration: SchemaConfiguration?): FrozenMap { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validatedPathToSchemas = PathToSchemasMap() + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, LinkedHashSet()) + val pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet) + return getNewInstance(castArg, validationMetadata.pathToItem, pathToSchemasMap) + } + + @Throws(ValidationException::class) + override fun validate(arg: Any?, configuration: SchemaConfiguration?): Any? { + if (arg == null) { + return validate(null, configuration) + } else if (arg is Boolean) { + return validate(arg, configuration) + } else if (arg is Number) { + return validate(arg, configuration) + } else if (arg is String) { + return validate(arg, configuration) + } else if (arg is List<*>) { + return validate(arg, configuration) + } else if (arg is Map<*, *>) { + return validate(arg, configuration) + } + throw ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema") + } + override fun getNewInstance(arg: Any?, pathToItem: List, pathToSchemas: PathToSchemasMap): Any? { + if (arg == null) { + return getNewInstance( null, pathToItem, pathToSchemas) + } else if (arg is Boolean) { + return getNewInstance(arg, pathToItem, pathToSchemas) + } else if (arg is Number) { + return getNewInstance(arg, pathToItem, pathToSchemas) + } else if (arg is String) { + return getNewInstance(arg, pathToItem, pathToSchemas) + } else if (arg is List<*>) { + return getNewInstance(arg, pathToItem, pathToSchemas) + } else if (arg is Map<*, *>) { + return getNewInstance(arg, pathToItem, pathToSchemas) + } + throw RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema") + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: Nothing?, configuration: SchemaConfiguration?): ValidateAgainstCorrectBranchThenVsElse1BoxedVoid { + return ValidateAgainstCorrectBranchThenVsElse1BoxedVoid(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: Boolean, configuration: SchemaConfiguration?): ValidateAgainstCorrectBranchThenVsElse1BoxedBoolean { + return ValidateAgainstCorrectBranchThenVsElse1BoxedBoolean(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: Number, configuration: SchemaConfiguration?): ValidateAgainstCorrectBranchThenVsElse1BoxedNumber { + return ValidateAgainstCorrectBranchThenVsElse1BoxedNumber(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: String, configuration: SchemaConfiguration?): ValidateAgainstCorrectBranchThenVsElse1BoxedString { + return ValidateAgainstCorrectBranchThenVsElse1BoxedString(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: List<*>, configuration: SchemaConfiguration?): ValidateAgainstCorrectBranchThenVsElse1BoxedList { + return ValidateAgainstCorrectBranchThenVsElse1BoxedList(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: Map<*, *>, configuration: SchemaConfiguration?): ValidateAgainstCorrectBranchThenVsElse1BoxedMap { + return ValidateAgainstCorrectBranchThenVsElse1BoxedMap(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: Any?, configuration: SchemaConfiguration?): ValidateAgainstCorrectBranchThenVsElse1Boxed { + if (arg == null) { + return validateAndBox(null, configuration) + } else if (arg is Boolean) { + return validateAndBox(arg, configuration) + } else if (arg is String) { + return validateAndBox(arg, configuration) + } else if (arg is Number) { + return validateAndBox(arg, configuration) + } else if (arg is List<*>) { + return validateAndBox(arg, configuration) + } else if (arg is Map<*, *>) { + return validateAndBox(arg, configuration) + } + throw ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema") + } + } +} diff --git a/samples/client/3_1_0_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/configurations/JsonSchemaKeywordFlags.kt b/samples/client/3_1_0_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/configurations/JsonSchemaKeywordFlags.kt new file mode 100644 index 00000000000..93aa9a04917 --- /dev/null +++ b/samples/client/3_1_0_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/configurations/JsonSchemaKeywordFlags.kt @@ -0,0 +1,446 @@ +package org.openapijsonschematools.client.configurations; + +data class JsonSchemaKeywordFlags( + val additionalProperties: Boolean, + val allOf: Boolean, + val anyOf: Boolean, + val const_: Boolean, + val contains: Boolean, + val dependentRequired: Boolean, + val dependentSchemas: Boolean, + val discriminator: Boolean, + val else_: Boolean, + val enum_: Boolean, + val exclusiveMaximum: Boolean, + val exclusiveMinimum: Boolean, + val format: Boolean, + val if_: Boolean, + val maximum: Boolean, + val minimum: Boolean, + val items: Boolean, + val maxContains: Boolean, + val maxItems: Boolean, + val maxLength: Boolean, + val maxProperties: Boolean, + val minContains: Boolean, + val minItems: Boolean, + val minLength: Boolean, + val minProperties: Boolean, + val multipleOf: Boolean, + val not: Boolean, + val oneOf: Boolean, + val pattern: Boolean, + val patternProperties: Boolean, + val prefixItems: Boolean, + val properties: Boolean, + val propertyNames: Boolean, + val required: Boolean, + val then: Boolean, + val type: Boolean, + val uniqueItems: Boolean, + val unevaluatedItems: Boolean, + val unevaluatedProperties: Boolean +) { + val keywords: LinkedHashSet + get() { + val enabledKeywords = LinkedHashSet() + if (additionalProperties) { + enabledKeywords.add("additionalProperties") + } + if (allOf) { + enabledKeywords.add("allOf") + } + if (anyOf) { + enabledKeywords.add("anyOf") + } + if (const_) { + enabledKeywords.add("const") + } + if (contains) { + enabledKeywords.add("contains") + } + if (dependentRequired) { + enabledKeywords.add("dependentRequired") + } + if (dependentSchemas) { + enabledKeywords.add("dependentSchemas") + } + if (discriminator) { + enabledKeywords.add("discriminator") + } + if (else_) { + enabledKeywords.add("else_") + } + if (enum_) { + enabledKeywords.add("enum_") + } + if (exclusiveMaximum) { + enabledKeywords.add("exclusiveMaximum") + } + if (exclusiveMinimum) { + enabledKeywords.add("exclusiveMinimum") + } + if (format) { + enabledKeywords.add("format") + } + if (if_) { + enabledKeywords.add("if_") + } + if (maximum) { + enabledKeywords.add("maximum") + } + if (minimum) { + enabledKeywords.add("minimum") + } + if (items) { + enabledKeywords.add("items") + } + if (maxContains) { + enabledKeywords.add("maxContains") + } + if (maxItems) { + enabledKeywords.add("maxItems") + } + if (maxLength) { + enabledKeywords.add("maxLength") + } + if (maxProperties) { + enabledKeywords.add("maxProperties") + } + if (minContains) { + enabledKeywords.add("minContains") + } + if (minItems) { + enabledKeywords.add("minItems") + } + if (minLength) { + enabledKeywords.add("minLength") + } + if (minProperties) { + enabledKeywords.add("minProperties") + } + if (multipleOf) { + enabledKeywords.add("multipleOf") + } + if (not) { + enabledKeywords.add("not") + } + if (oneOf) { + enabledKeywords.add("oneOf") + } + if (pattern) { + enabledKeywords.add("pattern") + } + if (patternProperties) { + enabledKeywords.add("patternProperties") + } + if (prefixItems) { + enabledKeywords.add("prefixItems") + } + if (properties) { + enabledKeywords.add("properties") + } + if (propertyNames) { + enabledKeywords.add("propertyNames") + } + if (required) { + enabledKeywords.add("required") + } + if (then) { + enabledKeywords.add("then") + } + if (type) { + enabledKeywords.add("type") + } + if (uniqueItems) { + enabledKeywords.add("uniqueItems") + } + if (unevaluatedItems) { + enabledKeywords.add("unevaluatedItems") + } + if (unevaluatedProperties) { + enabledKeywords.add("unevaluatedProperties") + } + return enabledKeywords + } + + class Builder { + private var additionalProperties = false + private var allOf = false + private var anyOf = false + private var const_ = false + private var contains = false + private var dependentRequired = false + private var dependentSchemas = false + private var discriminator = false + private var else_ = false + private var enum_ = false + private var exclusiveMaximum = false + private var exclusiveMinimum = false + private var format = false + private var if_ = false + private var maximum = false + private var minimum = false + private var items = false + private var maxContains = false + private var maxItems = false + private var maxLength = false + private var maxProperties = false + private var minContains = false + private var minItems = false + private var minLength = false + private var minProperties = false + private var multipleOf = false + private var not = false + private var oneOf = false + private var pattern = false + private var patternProperties = false + private var prefixItems = false + private var properties = false + private var propertyNames = false + private var required = false + private var then = false + private var type = false + private var uniqueItems = false + private var unevaluatedItems = false + private var unevaluatedProperties = false + fun additionalProperties(): Builder { + additionalProperties = true + return this + } + + fun allOf(): Builder { + allOf = true + return this + } + + fun anyOf(): Builder { + anyOf = true + return this + } + + fun const_(): Builder { + const_ = true + return this + } + + fun contains(): Builder { + contains = true + return this + } + + fun dependentRequired(): Builder { + dependentRequired = true + return this + } + + fun dependentSchemas(): Builder { + dependentSchemas = true + return this + } + + fun discriminator(): Builder { + discriminator = true + return this + } + + fun else_(): Builder { + else_ = true + return this + } + + fun enum_(): Builder { + enum_ = true + return this + } + + fun exclusiveMaximum(): Builder { + exclusiveMaximum = true + return this + } + + fun exclusiveMinimum(): Builder { + exclusiveMinimum = true + return this + } + + fun format(): Builder { + format = true + return this + } + + fun if_(): Builder { + if_ = true + return this + } + + fun maximum(): Builder { + maximum = true + return this + } + + fun minimum(): Builder { + minimum = true + return this + } + + fun items(): Builder { + items = true + return this + } + + fun maxContains(): Builder { + maxContains = true + return this + } + + fun maxItems(): Builder { + maxItems = true + return this + } + + fun maxLength(): Builder { + maxLength = true + return this + } + + fun maxProperties(): Builder { + maxProperties = true + return this + } + + fun minContains(): Builder { + minContains = true + return this + } + + fun minItems(): Builder { + minItems = true + return this + } + + fun minLength(): Builder { + minLength = true + return this + } + + fun minProperties(): Builder { + minProperties = true + return this + } + + fun multipleOf(): Builder { + multipleOf = true + return this + } + + operator fun not(): Builder { + not = true + return this + } + + fun oneOf(): Builder { + oneOf = true + return this + } + + fun pattern(): Builder { + pattern = true + return this + } + + fun patternProperties(): Builder { + patternProperties = true + return this + } + + fun prefixItems(): Builder { + prefixItems = true + return this + } + + fun properties(): Builder { + properties = true + return this + } + + fun propertyNames(): Builder { + propertyNames = true + return this + } + + fun required(): Builder { + required = true + return this + } + + fun then(): Builder { + then = true + return this + } + + fun type(): Builder { + type = true + return this + } + + fun uniqueItems(): Builder { + uniqueItems = true + return this + } + + fun unevaluatedItems(): Builder { + unevaluatedItems = true + return this + } + + fun unevaluatedProperties(): Builder { + unevaluatedProperties = true + return this + } + + fun build(): JsonSchemaKeywordFlags { + return JsonSchemaKeywordFlags( + additionalProperties, + allOf, + anyOf, + const_, + contains, + dependentRequired, + dependentSchemas, + discriminator, + else_, + enum_, + exclusiveMaximum, + exclusiveMinimum, + format, + if_, + maximum, + minimum, + items, + maxContains, + maxItems, + maxLength, + maxProperties, + minContains, + minItems, + minLength, + minProperties, + multipleOf, + not, + oneOf, + pattern, + patternProperties, + prefixItems, + properties, + propertyNames, + required, + then, + type, + uniqueItems, + unevaluatedItems, + unevaluatedProperties + ) + } + } +} \ No newline at end of file diff --git a/samples/client/3_1_0_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/configurations/SchemaConfiguration.kt b/samples/client/3_1_0_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/configurations/SchemaConfiguration.kt new file mode 100644 index 00000000000..39a58bba52f --- /dev/null +++ b/samples/client/3_1_0_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/configurations/SchemaConfiguration.kt @@ -0,0 +1,3 @@ +package org.openapijsonschematools.client.configurations; + +data class SchemaConfiguration(val disabledKeywordFlags: JsonSchemaKeywordFlags) \ No newline at end of file diff --git a/samples/client/3_1_0_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/exceptions/BaseException.kt b/samples/client/3_1_0_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/exceptions/BaseException.kt new file mode 100644 index 00000000000..90fd1cd37f1 --- /dev/null +++ b/samples/client/3_1_0_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/exceptions/BaseException.kt @@ -0,0 +1,3 @@ +package org.openapijsonschematools.client.exceptions; + +open class BaseException(s: String?) : Exception(s) \ No newline at end of file diff --git a/samples/client/3_1_0_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/exceptions/InvalidAdditionalPropertyException.kt b/samples/client/3_1_0_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/exceptions/InvalidAdditionalPropertyException.kt new file mode 100644 index 00000000000..ad5b703ba4e --- /dev/null +++ b/samples/client/3_1_0_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/exceptions/InvalidAdditionalPropertyException.kt @@ -0,0 +1,3 @@ +package org.openapijsonschematools.client.exceptions; + +class InvalidAdditionalPropertyException(s: String?) : BaseException(s) diff --git a/samples/client/3_1_0_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/exceptions/UnsetPropertyException.kt b/samples/client/3_1_0_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/exceptions/UnsetPropertyException.kt new file mode 100644 index 00000000000..6bff93968fb --- /dev/null +++ b/samples/client/3_1_0_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/exceptions/UnsetPropertyException.kt @@ -0,0 +1,3 @@ +package org.openapijsonschematools.client.exceptions; + +class UnsetPropertyException(s: String?) : BaseException(s) \ No newline at end of file diff --git a/samples/client/3_1_0_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/exceptions/ValidationException.kt b/samples/client/3_1_0_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/exceptions/ValidationException.kt new file mode 100644 index 00000000000..f9ea00d0821 --- /dev/null +++ b/samples/client/3_1_0_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/exceptions/ValidationException.kt @@ -0,0 +1,3 @@ +package org.openapijsonschematools.client.exceptions; + +class ValidationException(s: String?) : BaseException(s) \ No newline at end of file diff --git a/samples/client/3_1_0_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/schemas/AnyTypeJsonSchema.kt b/samples/client/3_1_0_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/schemas/AnyTypeJsonSchema.kt new file mode 100644 index 00000000000..816976afa8f --- /dev/null +++ b/samples/client/3_1_0_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/schemas/AnyTypeJsonSchema.kt @@ -0,0 +1,358 @@ +package org.openapijsonschematools.client.schemas + +import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags +import org.openapijsonschematools.client.configurations.SchemaConfiguration +import org.openapijsonschematools.client.exceptions.ValidationException +import org.openapijsonschematools.client.schemas.validation.FrozenList +import org.openapijsonschematools.client.schemas.validation.FrozenMap +import org.openapijsonschematools.client.schemas.validation.JsonSchema +import org.openapijsonschematools.client.schemas.validation.JsonSchemaInfo +import org.openapijsonschematools.client.schemas.validation.PathToSchemasMap +import org.openapijsonschematools.client.schemas.validation.NullSchemaValidator +import org.openapijsonschematools.client.schemas.validation.BooleanSchemaValidator +import org.openapijsonschematools.client.schemas.validation.NumberSchemaValidator +import org.openapijsonschematools.client.schemas.validation.StringSchemaValidator +import org.openapijsonschematools.client.schemas.validation.ListSchemaValidator +import org.openapijsonschematools.client.schemas.validation.MapSchemaValidator +import org.openapijsonschematools.client.schemas.validation.ValidationMetadata + +import java.time.LocalDate +import java.time.ZonedDateTime +import java.util.UUID + +open class AnyTypeJsonSchema { + sealed interface AnyTypeJsonSchema1Boxed { + fun getData(): Any? + } + + + data class AnyTypeJsonSchema1BoxedVoid(val data: Nothing?) : AnyTypeJsonSchema1Boxed { + override fun getData(): Any? { + return data + } + } + + + data class AnyTypeJsonSchema1BoxedBoolean(val data: Boolean) : AnyTypeJsonSchema1Boxed { + override fun getData(): Any? { + return data + } + } + + + data class AnyTypeJsonSchema1BoxedNumber(val data: Number) : AnyTypeJsonSchema1Boxed { + override fun getData(): Any? { + return data + } + } + + + data class AnyTypeJsonSchema1BoxedString(val data: String) : AnyTypeJsonSchema1Boxed { + override fun getData(): Any? { + return data + } + + } + + + data class AnyTypeJsonSchema1BoxedList(val data: FrozenList) : AnyTypeJsonSchema1Boxed { + override fun getData(): Any? { + return data + } + } + + + data class AnyTypeJsonSchema1BoxedMap(val data: FrozenMap) : AnyTypeJsonSchema1Boxed { + override fun getData(): Any? { + return data + } + } + + open class AnyTypeJsonSchema1 protected constructor() : JsonSchema(JsonSchemaInfo()), + NullSchemaValidator, BooleanSchemaValidator, + NumberSchemaValidator, StringSchemaValidator, + ListSchemaValidator, AnyTypeJsonSchema1BoxedList>, + MapSchemaValidator, AnyTypeJsonSchema1BoxedMap> { + @Throws(ValidationException::class) + override fun validate(arg: Nothing?, configuration: SchemaConfiguration?): Nothing? { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0]") + val castArg: Nothing? = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validatedPathToSchemas = PathToSchemasMap() + val validationMetadata = + ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, LinkedHashSet()) + val pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet) + return getNewInstance(castArg, validationMetadata.pathToItem, pathToSchemasMap) + } + + @Throws(ValidationException::class) + override fun validate(arg: Boolean, configuration: SchemaConfiguration?): Boolean { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0]") + val castArg: Boolean = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validatedPathToSchemas = PathToSchemasMap() + val validationMetadata = + ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, LinkedHashSet()) + val pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet) + return getNewInstance(castArg, validationMetadata.pathToItem, pathToSchemasMap) + } + + @Throws(ValidationException::class) + override fun validate(arg: Number, configuration: SchemaConfiguration?): Number { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0]") + val castArg: Number = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validatedPathToSchemas = PathToSchemasMap() + val validationMetadata = + ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, LinkedHashSet()) + val pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet) + return getNewInstance(castArg, validationMetadata.pathToItem, pathToSchemasMap) + } + + @Throws(ValidationException::class) + fun validate(arg: Int, configuration: SchemaConfiguration?): Int { + return validate(arg as Number, configuration) as Int + } + + @Throws(ValidationException::class) + fun validate(arg: Long, configuration: SchemaConfiguration?): Long { + return validate(arg as Number, configuration) as Long + } + + @Throws(ValidationException::class) + fun validate(arg: Float, configuration: SchemaConfiguration?): Float { + return validate(arg as Number, configuration) as Float + } + + @Throws(ValidationException::class) + fun validate(arg: Double, configuration: SchemaConfiguration?): Double { + return validate(arg as Number, configuration) as Double + } + + @Throws(ValidationException::class) + override fun validate(arg: String, configuration: SchemaConfiguration?): String { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0]") + val castArg: String = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validatedPathToSchemas = PathToSchemasMap() + val validationMetadata = + ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, LinkedHashSet()) + val pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet) + return getNewInstance(castArg, validationMetadata.pathToItem, pathToSchemasMap) + } + + @Throws(ValidationException::class) + fun validate(arg: LocalDate, configuration: SchemaConfiguration?): String { + return validate(arg.toString(), configuration) + } + + @Throws(ValidationException::class) + fun validate(arg: ZonedDateTime, configuration: SchemaConfiguration?): String { + return validate(arg.toString(), configuration) + } + + @Throws(ValidationException::class) + fun validate(arg: UUID, configuration: SchemaConfiguration?): String { + return validate(arg.toString(), configuration) + } + + override fun getNewInstance( + arg: List<*>, + pathToItem: List, + pathToSchemas: PathToSchemasMap + ): FrozenList { + val items: MutableList = ArrayList() + var i = 0 + for (item in arg) { + val itemPathToItem: List = pathToItem + i + val schemas = pathToSchemas[itemPathToItem] + ?: throw RuntimeException("Validation result is invalid, schemas must exist for a pathToItem") + val itemSchema = schemas.entries.iterator().next().key + val castItem = itemSchema.getNewInstance(item, itemPathToItem, pathToSchemas) + items.add(castItem) + i += 1 + } + return FrozenList(items) + } + + @Throws(ValidationException::class) + override fun validate(arg: List<*>, configuration: SchemaConfiguration?): FrozenList { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0]") + val castArg: List<*> = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validatedPathToSchemas = PathToSchemasMap() + val validationMetadata = + ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, LinkedHashSet()) + val pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet) + return getNewInstance(castArg, validationMetadata.pathToItem, pathToSchemasMap) + } + + override fun getNewInstance( + arg: Map<*, *>, + pathToItem: List, + pathToSchemas: PathToSchemasMap + ): FrozenMap { + val properties = LinkedHashMap() + for ((entryKey, value1) in arg) { + if (entryKey !is String) { + throw RuntimeException("Invalid non-string key value") + } + val propertyPathToItem: List = pathToItem + entryKey + val schemas = pathToSchemas[propertyPathToItem] + ?: throw RuntimeException("Validation result is invalid, schemas must exist for a pathToItem") + val propertySchema = schemas.entries.iterator().next().key + val castValue = propertySchema.getNewInstance(value1, propertyPathToItem, pathToSchemas) + properties[entryKey] = castValue + } + return FrozenMap(properties) + } + + @Throws(ValidationException::class) + override fun validate(arg: Map<*, *>, configuration: SchemaConfiguration?): FrozenMap { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0]") + val castArg: Map<*, *> = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validatedPathToSchemas = PathToSchemasMap() + val validationMetadata = + ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, LinkedHashSet()) + val pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet) + return getNewInstance(castArg, validationMetadata.pathToItem, pathToSchemasMap) + } + + override fun getNewInstance(arg: Any?, pathToItem: List, pathToSchemas: PathToSchemasMap): Any? { + when (arg) { + null -> { + return getNewInstance(null, pathToItem, pathToSchemas) + } + is Boolean -> { + return getNewInstance(arg, pathToItem, pathToSchemas) + } + + is Number -> { + return getNewInstance(arg, pathToItem, pathToSchemas) + } + + is String -> { + return getNewInstance(arg, pathToItem, pathToSchemas) + } + + is List<*> -> { + return getNewInstance(arg, pathToItem, pathToSchemas) + } + + is Map<*, *> -> { + return getNewInstance(arg, pathToItem, pathToSchemas) + } + + else -> throw RuntimeException("Invalid input type=$javaClass. It can't be instantiated by this schema") + } + } + + @Throws(ValidationException::class) + override fun validate(arg: Any?, configuration: SchemaConfiguration?): Any? { + when (arg) { + null -> { + return validate(null, configuration) + } + is Boolean -> { + return validate(arg, configuration) + } + + is Number -> { + return validate(arg, configuration) + } + + is String -> { + return validate(arg, configuration) + } + + is List<*> -> { + return validate(arg, configuration) + } + + is Map<*, *> -> { + return validate(arg, configuration) + } + + else -> throw ValidationException("Invalid input type=$javaClass. It can't be validated by this schema") + } + } + + @Throws(ValidationException::class) + override fun validateAndBox(arg: Nothing?, configuration: SchemaConfiguration?): AnyTypeJsonSchema1BoxedVoid { + return AnyTypeJsonSchema1BoxedVoid(validate(arg, configuration)) + } + + @Throws(ValidationException::class) + override fun validateAndBox(arg: Boolean, configuration: SchemaConfiguration?): AnyTypeJsonSchema1BoxedBoolean { + return AnyTypeJsonSchema1BoxedBoolean(validate(arg, configuration)) + } + + @Throws(ValidationException::class) + override fun validateAndBox(arg: Number, configuration: SchemaConfiguration?): AnyTypeJsonSchema1BoxedNumber { + return AnyTypeJsonSchema1BoxedNumber(validate(arg, configuration)) + } + + @Throws(ValidationException::class) + override fun validateAndBox(arg: String, configuration: SchemaConfiguration?): AnyTypeJsonSchema1BoxedString { + return AnyTypeJsonSchema1BoxedString(validate(arg, configuration)) + } + + @Throws(ValidationException::class) + override fun validateAndBox(arg: List<*>, configuration: SchemaConfiguration?): AnyTypeJsonSchema1BoxedList { + return AnyTypeJsonSchema1BoxedList(validate(arg, configuration)) + } + + @Throws(ValidationException::class) + override fun validateAndBox(arg: Map<*, *>, configuration: SchemaConfiguration?): AnyTypeJsonSchema1BoxedMap { + return AnyTypeJsonSchema1BoxedMap(validate(arg, configuration)) + } + + @Throws(ValidationException::class) + override fun validateAndBox(arg: Any?, configuration: SchemaConfiguration?): AnyTypeJsonSchema1Boxed { + when (arg) { + null -> { + return validateAndBox(null, configuration) + } + is Boolean -> { + val castArg: Boolean = arg + return validateAndBox(castArg, configuration) + } + + is String -> { + return validateAndBox(arg, configuration) + } + + is Number -> { + return validateAndBox(arg, configuration) + } + + is List<*> -> { + return validateAndBox(arg, configuration) + } + + is Map<*, *> -> { + return validateAndBox(arg, configuration) + } + + else -> throw ValidationException("Invalid input type=$javaClass. It can't be validated by this schema") + } + } + + companion object { + @Volatile + private var instance: AnyTypeJsonSchema1? = null + + fun getInstance() = + instance ?: synchronized(this) { + instance ?: AnyTypeJsonSchema1().also { instance = it } + } + } + } +} \ No newline at end of file diff --git a/samples/client/3_1_0_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/schemas/BooleanJsonSchema.kt b/samples/client/3_1_0_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/schemas/BooleanJsonSchema.kt new file mode 100644 index 00000000000..ec466c5b84e --- /dev/null +++ b/samples/client/3_1_0_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/schemas/BooleanJsonSchema.kt @@ -0,0 +1,78 @@ +package org.openapijsonschematools.client.schemas + +import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags +import org.openapijsonschematools.client.configurations.SchemaConfiguration +import org.openapijsonschematools.client.exceptions.ValidationException +import org.openapijsonschematools.client.schemas.validation.JsonSchema +import org.openapijsonschematools.client.schemas.validation.JsonSchemaInfo +import org.openapijsonschematools.client.schemas.validation.PathToSchemasMap +import org.openapijsonschematools.client.schemas.validation.BooleanSchemaValidator +import org.openapijsonschematools.client.schemas.validation.ValidationMetadata + +open class BooleanJsonSchema { + sealed interface BooleanJsonSchema1Boxed { + fun getData(): Any? + } + + data class BooleanJsonSchema1BoxedBoolean(val data: Boolean) : BooleanJsonSchema1Boxed { + override fun getData(): Any? { + return data + } + } + + open class BooleanJsonSchema1 protected constructor() : JsonSchema( + JsonSchemaInfo() + .type(setOf(Boolean::class.java)) + ), BooleanSchemaValidator { + @Throws(ValidationException::class) + override fun validate(arg: Boolean, configuration: SchemaConfiguration?): Boolean { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg: Boolean = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validationMetadata = + ValidationMetadata(pathToItem, usedConfiguration, PathToSchemasMap(), LinkedHashSet()) + val pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet) + return getNewInstance(castArg, validationMetadata.pathToItem, pathToSchemasMap) + } + + override fun getNewInstance(arg: Any?, pathToItem: List, pathToSchemas: PathToSchemasMap): Boolean { + if (arg is Boolean) { + return getNewInstance(arg, pathToItem, pathToSchemas) + } + throw RuntimeException("Invalid input type=$javaClass. It can't be instantiated by this schema") + } + + @Throws(ValidationException::class) + override fun validate(arg: Any?, configuration: SchemaConfiguration?): Boolean { + if (arg is Boolean) { + return validate(arg, configuration) + } + throw ValidationException("Invalid input type=$javaClass. It can't be validated by this schema") + } + + @Throws(ValidationException::class) + override fun validateAndBox(arg: Boolean, configuration: SchemaConfiguration?): BooleanJsonSchema1BoxedBoolean { + return BooleanJsonSchema1BoxedBoolean(validate(arg, configuration)) + } + + @Throws(ValidationException::class) + override fun validateAndBox(arg: Any?, configuration: SchemaConfiguration?): BooleanJsonSchema1Boxed { + if (arg is Boolean) { + val castArg: Boolean = arg + return validateAndBox(castArg, configuration) + } + throw ValidationException("Invalid input type=$javaClass. It can't be validated by this schema") + } + + companion object { + @Volatile + private var instance: BooleanJsonSchema1? = null + + fun getInstance() = + instance ?: synchronized(this) { + instance ?: BooleanJsonSchema1().also { instance = it } + } + } + } +} \ No newline at end of file diff --git a/samples/client/3_1_0_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/schemas/DateJsonSchema.kt b/samples/client/3_1_0_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/schemas/DateJsonSchema.kt new file mode 100644 index 00000000000..ff7a15d365a --- /dev/null +++ b/samples/client/3_1_0_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/schemas/DateJsonSchema.kt @@ -0,0 +1,87 @@ +package org.openapijsonschematools.client.schemas + +import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags +import org.openapijsonschematools.client.configurations.SchemaConfiguration +import org.openapijsonschematools.client.exceptions.ValidationException +import org.openapijsonschematools.client.schemas.validation.JsonSchema +import org.openapijsonschematools.client.schemas.validation.JsonSchemaInfo +import org.openapijsonschematools.client.schemas.validation.PathToSchemasMap +import org.openapijsonschematools.client.schemas.validation.StringSchemaValidator +import org.openapijsonschematools.client.schemas.validation.ValidationMetadata + +import java.time.LocalDate + +open class DateJsonSchema { + sealed interface DateJsonSchema1Boxed { + fun getData(): Any? + } + + data class DateJsonSchema1BoxedString(val data: String) : DateJsonSchema1Boxed { + override fun getData(): Any? { + return data + } + } + + open class DateJsonSchema1 protected constructor() : JsonSchema( + JsonSchemaInfo() + .type(setOf(String::class.java)) + .format("date") + ), StringSchemaValidator { + @Throws(ValidationException::class) + override fun validate(arg: String, configuration: SchemaConfiguration?): String { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg: String = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validationMetadata = + ValidationMetadata(pathToItem, usedConfiguration, PathToSchemasMap(), LinkedHashSet()) + val pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet) + return getNewInstance(castArg, validationMetadata.pathToItem, pathToSchemasMap) + } + + @Throws(ValidationException::class) + fun validate(arg: LocalDate, configuration: SchemaConfiguration?): String { + return validate(arg.toString(), configuration) + } + + override fun getNewInstance(arg: Any?, pathToItem: List, pathToSchemas: PathToSchemasMap): Any? { + if (arg is String) { + return getNewInstance(arg, pathToItem, pathToSchemas) + } + throw RuntimeException("Invalid input type=$javaClass. It can't be instantiated by this schema") + } + + @Throws(ValidationException::class) + override fun validate(arg: Any?, configuration: SchemaConfiguration?): String { + if (arg is String) { + return validate(arg, configuration) + } else if (arg is LocalDate) { + return validate(arg, configuration) + } + throw ValidationException("Invalid input type=$javaClass. It can't be validated by this schema") + } + + @Throws(ValidationException::class) + override fun validateAndBox(arg: String, configuration: SchemaConfiguration?): DateJsonSchema1BoxedString { + return DateJsonSchema1BoxedString(validate(arg, configuration)) + } + + @Throws(ValidationException::class) + override fun validateAndBox(arg: Any?, configuration: SchemaConfiguration?): DateJsonSchema1Boxed { + if (arg is String) { + return validateAndBox(arg, configuration) + } + throw ValidationException("Invalid input type=$javaClass. It can't be validated by this schema") + } + + companion object { + @Volatile + private var instance: DateJsonSchema1? = null + + fun getInstance() = + instance ?: synchronized(this) { + instance ?: DateJsonSchema1().also { instance = it } + } + } + } +} \ No newline at end of file diff --git a/samples/client/3_1_0_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/schemas/DateTimeJsonSchema.kt b/samples/client/3_1_0_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/schemas/DateTimeJsonSchema.kt new file mode 100644 index 00000000000..4da3ee275fe --- /dev/null +++ b/samples/client/3_1_0_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/schemas/DateTimeJsonSchema.kt @@ -0,0 +1,87 @@ +package org.openapijsonschematools.client.schemas + +import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags +import org.openapijsonschematools.client.configurations.SchemaConfiguration +import org.openapijsonschematools.client.exceptions.ValidationException +import org.openapijsonschematools.client.schemas.validation.JsonSchema +import org.openapijsonschematools.client.schemas.validation.JsonSchemaInfo +import org.openapijsonschematools.client.schemas.validation.PathToSchemasMap +import org.openapijsonschematools.client.schemas.validation.StringSchemaValidator +import org.openapijsonschematools.client.schemas.validation.ValidationMetadata + +import java.time.ZonedDateTime + +open class DateTimeJsonSchema { + sealed interface DateTimeJsonSchema1Boxed { + fun getData(): Any? + } + + data class DateTimeJsonSchema1BoxedString(val data: String) : DateTimeJsonSchema1Boxed { + override fun getData(): Any? { + return data + } + } + + open class DateTimeJsonSchema1 protected constructor() : JsonSchema( + JsonSchemaInfo() + .type(setOf(String::class.java)) + .format("date-time") + ), StringSchemaValidator { + @Throws(ValidationException::class) + override fun validate(arg: String, configuration: SchemaConfiguration?): String { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg: String = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validationMetadata = + ValidationMetadata(pathToItem, usedConfiguration, PathToSchemasMap(), LinkedHashSet()) + val pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet) + return getNewInstance(castArg, validationMetadata.pathToItem, pathToSchemasMap) + } + + @Throws(ValidationException::class) + fun validate(arg: ZonedDateTime, configuration: SchemaConfiguration?): String { + return validate(arg.toString(), configuration) + } + + override fun getNewInstance(arg: Any?, pathToItem: List, pathToSchemas: PathToSchemasMap): Any? { + if (arg is String) { + return getNewInstance(arg, pathToItem, pathToSchemas) + } + throw RuntimeException("Invalid input type=$javaClass. It can't be instantiated by this schema") + } + + @Throws(ValidationException::class) + override fun validate(arg: Any?, configuration: SchemaConfiguration?): String { + if (arg is String) { + return validate(arg, configuration) + } else if (arg is ZonedDateTime) { + return validate(arg, configuration) + } + throw ValidationException("Invalid input type=$javaClass. It can't be validated by this schema") + } + + @Throws(ValidationException::class) + override fun validateAndBox(arg: String, configuration: SchemaConfiguration?): DateTimeJsonSchema1BoxedString { + return DateTimeJsonSchema1BoxedString(validate(arg, configuration)) + } + + @Throws(ValidationException::class) + override fun validateAndBox(arg: Any?, configuration: SchemaConfiguration?): DateTimeJsonSchema1Boxed { + if (arg is String) { + return validateAndBox(arg, configuration) + } + throw ValidationException("Invalid input type=$javaClass. It can't be validated by this schema") + } + + companion object { + @Volatile + private var instance: DateTimeJsonSchema1? = null + + fun getInstance() = + instance ?: synchronized(this) { + instance ?: DateTimeJsonSchema1().also { instance = it } + } + } + } +} \ No newline at end of file diff --git a/samples/client/3_1_0_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/schemas/DecimalJsonSchema.kt b/samples/client/3_1_0_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/schemas/DecimalJsonSchema.kt new file mode 100644 index 00000000000..f327b015a82 --- /dev/null +++ b/samples/client/3_1_0_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/schemas/DecimalJsonSchema.kt @@ -0,0 +1,78 @@ +package org.openapijsonschematools.client.schemas + +import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags +import org.openapijsonschematools.client.configurations.SchemaConfiguration +import org.openapijsonschematools.client.exceptions.ValidationException +import org.openapijsonschematools.client.schemas.validation.JsonSchema +import org.openapijsonschematools.client.schemas.validation.JsonSchemaInfo +import org.openapijsonschematools.client.schemas.validation.PathToSchemasMap +import org.openapijsonschematools.client.schemas.validation.StringSchemaValidator +import org.openapijsonschematools.client.schemas.validation.ValidationMetadata + +open class DecimalJsonSchema { + sealed interface DecimalJsonSchema1Boxed { + fun getData(): Any? + } + + data class DecimalJsonSchema1BoxedString(val data: String) : DecimalJsonSchema1Boxed { + override fun getData(): Any? { + return data + } + } + + open class DecimalJsonSchema1 protected constructor() : JsonSchema( + JsonSchemaInfo() + .type(setOf(String::class.java)) + .format("number") + ), StringSchemaValidator { + @Throws(ValidationException::class) + override fun validate(arg: String, configuration: SchemaConfiguration?): String { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg: String = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validationMetadata = + ValidationMetadata(pathToItem, usedConfiguration, PathToSchemasMap(), LinkedHashSet()) + val pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet) + return getNewInstance(castArg, validationMetadata.pathToItem, pathToSchemasMap) + } + + override fun getNewInstance(arg: Any?, pathToItem: List, pathToSchemas: PathToSchemasMap): Any? { + if (arg is String) { + return getNewInstance(arg, pathToItem, pathToSchemas) + } + throw RuntimeException("Invalid input type=$javaClass. It can't be instantiated by this schema") + } + + @Throws(ValidationException::class) + override fun validate(arg: Any?, configuration: SchemaConfiguration?): String { + if (arg is String) { + return validate(arg, configuration) + } + throw ValidationException("Invalid input type=$javaClass. It can't be validated by this schema") + } + + @Throws(ValidationException::class) + override fun validateAndBox(arg: String, configuration: SchemaConfiguration?): DecimalJsonSchema1BoxedString { + return DecimalJsonSchema1BoxedString(validate(arg, configuration)) + } + + @Throws(ValidationException::class) + override fun validateAndBox(arg: Any?, configuration: SchemaConfiguration?): DecimalJsonSchema1Boxed { + if (arg is String) { + return validateAndBox(arg, configuration) + } + throw ValidationException("Invalid input type=$javaClass. It can't be validated by this schema") + } + + companion object { + @Volatile + private var instance: DecimalJsonSchema1? = null + + fun getInstance() = + instance ?: synchronized(this) { + instance ?: DecimalJsonSchema1().also { instance = it } + } + } + } +} \ No newline at end of file diff --git a/samples/client/3_1_0_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/schemas/DoubleJsonSchema.kt b/samples/client/3_1_0_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/schemas/DoubleJsonSchema.kt new file mode 100644 index 00000000000..ac9981b8d46 --- /dev/null +++ b/samples/client/3_1_0_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/schemas/DoubleJsonSchema.kt @@ -0,0 +1,88 @@ +package org.openapijsonschematools.client.schemas + +import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags +import org.openapijsonschematools.client.configurations.SchemaConfiguration +import org.openapijsonschematools.client.exceptions.ValidationException +import org.openapijsonschematools.client.schemas.validation.JsonSchema +import org.openapijsonschematools.client.schemas.validation.JsonSchemaInfo +import org.openapijsonschematools.client.schemas.validation.PathToSchemasMap +import org.openapijsonschematools.client.schemas.validation.NumberSchemaValidator +import org.openapijsonschematools.client.schemas.validation.ValidationMetadata + +open class DoubleJsonSchema { + sealed interface DoubleJsonSchema1Boxed { + fun getData(): Any? + } + + data class DoubleJsonSchema1BoxedNumber(val data: Number) : DoubleJsonSchema1Boxed { + override fun getData(): Any? { + return data + } + } + + open class DoubleJsonSchema1 protected constructor() : JsonSchema( + JsonSchemaInfo() + .type(setOf( + Int::class.java, + Long::class.java, + Float::class.java, + Double::class.java + )) + .format("double") + ), NumberSchemaValidator { + @Throws(ValidationException::class) + override fun validate(arg: Number, configuration: SchemaConfiguration?): Number { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg: Number = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validationMetadata = + ValidationMetadata(pathToItem, usedConfiguration, PathToSchemasMap(), LinkedHashSet()) + val pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet) + return getNewInstance(castArg, validationMetadata.pathToItem, pathToSchemasMap) + } + + @Throws(ValidationException::class) + fun validate(arg: Double, configuration: SchemaConfiguration?): Double { + return validate(arg as Number, configuration) as Double + } + + override fun getNewInstance(arg: Any?, pathToItem: List, pathToSchemas: PathToSchemasMap): Any? { + if (arg is Number) { + return getNewInstance(arg, pathToItem, pathToSchemas) + } + throw RuntimeException("Invalid input type=$javaClass. It can't be instantiated by this schema") + } + + @Throws(ValidationException::class) + override fun validate(arg: Any?, configuration: SchemaConfiguration?): Number { + if (arg is Number) { + return validate(arg, configuration) + } + throw ValidationException("Invalid input type=$javaClass. It can't be validated by this schema") + } + + @Throws(ValidationException::class) + override fun validateAndBox(arg: Number, configuration: SchemaConfiguration?): DoubleJsonSchema1BoxedNumber { + return DoubleJsonSchema1BoxedNumber(validate(arg, configuration)) + } + + @Throws(ValidationException::class) + override fun validateAndBox(arg: Any?, configuration: SchemaConfiguration?): DoubleJsonSchema1Boxed { + if (arg is Number) { + return validateAndBox(arg, configuration) + } + throw ValidationException("Invalid input type=$javaClass. It can't be validated by this schema") + } + + companion object { + @Volatile + private var instance: DoubleJsonSchema1? = null + + fun getInstance() = + instance ?: synchronized(this) { + instance ?: DoubleJsonSchema1().also { instance = it } + } + } + } +} \ No newline at end of file diff --git a/samples/client/3_1_0_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/schemas/FloatJsonSchema.kt b/samples/client/3_1_0_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/schemas/FloatJsonSchema.kt new file mode 100644 index 00000000000..016d1ef2e43 --- /dev/null +++ b/samples/client/3_1_0_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/schemas/FloatJsonSchema.kt @@ -0,0 +1,86 @@ +package org.openapijsonschematools.client.schemas + +import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags +import org.openapijsonschematools.client.configurations.SchemaConfiguration +import org.openapijsonschematools.client.exceptions.ValidationException +import org.openapijsonschematools.client.schemas.validation.JsonSchema +import org.openapijsonschematools.client.schemas.validation.JsonSchemaInfo +import org.openapijsonschematools.client.schemas.validation.PathToSchemasMap +import org.openapijsonschematools.client.schemas.validation.NumberSchemaValidator +import org.openapijsonschematools.client.schemas.validation.ValidationMetadata + +open class FloatJsonSchema { + sealed interface FloatJsonSchema1Boxed { + fun getData(): Any? + } + + data class FloatJsonSchema1BoxedNumber(val data: Number) : FloatJsonSchema1Boxed { + override fun getData(): Any? { + return data + } + } + + open class FloatJsonSchema1 protected constructor() : JsonSchema( + JsonSchemaInfo() + .type(setOf( + Int::class.java, + Float::class.java + )) + .format("float") + ), NumberSchemaValidator { + @Throws(ValidationException::class) + override fun validate(arg: Number, configuration: SchemaConfiguration?): Number { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg: Number = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validationMetadata = + ValidationMetadata(pathToItem, usedConfiguration, PathToSchemasMap(), LinkedHashSet()) + val pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet) + return getNewInstance(castArg, validationMetadata.pathToItem, pathToSchemasMap) + } + + @Throws(ValidationException::class) + fun validate(arg: Float, configuration: SchemaConfiguration?): Float { + return validate(arg as Number, configuration) as Float + } + + override fun getNewInstance(arg: Any?, pathToItem: List, pathToSchemas: PathToSchemasMap): Any? { + if (arg is Number) { + return getNewInstance(arg, pathToItem, pathToSchemas) + } + throw RuntimeException("Invalid input type=$javaClass. It can't be instantiated by this schema") + } + + @Throws(ValidationException::class) + override fun validate(arg: Any?, configuration: SchemaConfiguration?): Number { + if (arg is Number) { + return validate(arg, configuration) + } + throw ValidationException("Invalid input type=$javaClass. It can't be validated by this schema") + } + + @Throws(ValidationException::class) + override fun validateAndBox(arg: Number, configuration: SchemaConfiguration?): FloatJsonSchema1BoxedNumber { + return FloatJsonSchema1BoxedNumber(validate(arg, configuration)) + } + + @Throws(ValidationException::class) + override fun validateAndBox(arg: Any?, configuration: SchemaConfiguration?): FloatJsonSchema1Boxed { + if (arg is Number) { + return validateAndBox(arg, configuration) + } + throw ValidationException("Invalid input type=$javaClass. It can't be validated by this schema") + } + + companion object { + @Volatile + private var instance: FloatJsonSchema1? = null + + fun getInstance() = + instance ?: synchronized(this) { + instance ?: FloatJsonSchema1().also { instance = it } + } + } + } +} \ No newline at end of file diff --git a/samples/client/3_1_0_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/schemas/GenericBuilder.kt b/samples/client/3_1_0_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/schemas/GenericBuilder.kt new file mode 100644 index 00000000000..f96e858458c --- /dev/null +++ b/samples/client/3_1_0_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/schemas/GenericBuilder.kt @@ -0,0 +1,9 @@ +package org.openapijsonschematools.client.schemas + +/** + * Builders must implement this class + * @param the type that the builder returns + */ +interface GenericBuilder { + fun build(): T +} \ No newline at end of file diff --git a/samples/client/3_1_0_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/schemas/Int32JsonSchema.kt b/samples/client/3_1_0_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/schemas/Int32JsonSchema.kt new file mode 100644 index 00000000000..fba8ab8762a --- /dev/null +++ b/samples/client/3_1_0_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/schemas/Int32JsonSchema.kt @@ -0,0 +1,93 @@ +package org.openapijsonschematools.client.schemas + +import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags +import org.openapijsonschematools.client.exceptions.ValidationException +import org.openapijsonschematools.client.schemas.validation.JsonSchema +import org.openapijsonschematools.client.schemas.validation.JsonSchemaInfo +import org.openapijsonschematools.client.configurations.SchemaConfiguration +import org.openapijsonschematools.client.schemas.validation.PathToSchemasMap +import org.openapijsonschematools.client.schemas.validation.NumberSchemaValidator +import org.openapijsonschematools.client.schemas.validation.ValidationMetadata + +open class Int32JsonSchema { + sealed interface Int32JsonSchema1Boxed { + fun getData(): Any? + } + + data class Int32JsonSchema1BoxedNumber(val data: Number) : Int32JsonSchema1Boxed { + override fun getData(): Any? { + return data + } + } + + open class Int32JsonSchema1 protected constructor() : JsonSchema( + JsonSchemaInfo() + .type( + setOf( + Int::class.java, + Float::class.java + ) + ) + .format("int32") + ), NumberSchemaValidator { + @Throws(ValidationException::class) + override fun validate(arg: Number, configuration: SchemaConfiguration?): Number { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg: Number = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validationMetadata = + ValidationMetadata(pathToItem, usedConfiguration, PathToSchemasMap(), LinkedHashSet()) + val pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet) + return getNewInstance(castArg, validationMetadata.pathToItem, pathToSchemasMap) + } + + @Throws(ValidationException::class) + fun validate(arg: Int, configuration: SchemaConfiguration?): Int { + return validate(arg as Number, configuration) as Int + } + + @Throws(ValidationException::class) + fun validate(arg: Float, configuration: SchemaConfiguration?): Float { + return validate(arg as Number, configuration) as Float + } + + override fun getNewInstance(arg: Any?, pathToItem: List, pathToSchemas: PathToSchemasMap): Any? { + if (arg is Number) { + return getNewInstance(arg, pathToItem, pathToSchemas) + } + throw RuntimeException("Invalid input type=$javaClass. It can't be instantiated by this schema") + } + + @Throws(ValidationException::class) + override fun validate(arg: Any?, configuration: SchemaConfiguration?): Number { + if (arg is Number) { + return validate(arg, configuration) + } + throw ValidationException("Invalid input type=$javaClass. It can't be validated by this schema") + } + + @Throws(ValidationException::class) + override fun validateAndBox(arg: Number, configuration: SchemaConfiguration?): Int32JsonSchema1BoxedNumber { + return Int32JsonSchema1BoxedNumber(validate(arg, configuration)) + } + + @Throws(ValidationException::class) + override fun validateAndBox(arg: Any?, configuration: SchemaConfiguration?): Int32JsonSchema1Boxed { + if (arg is Number) { + return validateAndBox(arg, configuration) + } + throw ValidationException("Invalid input type=$javaClass. It can't be validated by this schema") + } + + companion object { + @Volatile + private var instance: Int32JsonSchema1? = null + + fun getInstance() = + instance ?: synchronized(this) { + instance ?: Int32JsonSchema1().also { instance = it } + } + } + } +} \ No newline at end of file diff --git a/samples/client/3_1_0_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/schemas/Int64JsonSchema.kt b/samples/client/3_1_0_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/schemas/Int64JsonSchema.kt new file mode 100644 index 00000000000..8feda5d3694 --- /dev/null +++ b/samples/client/3_1_0_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/schemas/Int64JsonSchema.kt @@ -0,0 +1,105 @@ +package org.openapijsonschematools.client.schemas + +import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags +import org.openapijsonschematools.client.exceptions.ValidationException +import org.openapijsonschematools.client.schemas.validation.JsonSchema +import org.openapijsonschematools.client.schemas.validation.JsonSchemaInfo +import org.openapijsonschematools.client.configurations.SchemaConfiguration +import org.openapijsonschematools.client.schemas.validation.PathToSchemasMap +import org.openapijsonschematools.client.schemas.validation.NumberSchemaValidator +import org.openapijsonschematools.client.schemas.validation.ValidationMetadata + +open class Int64JsonSchema { + sealed interface Int64JsonSchema1Boxed { + fun getData(): Any? + } + + data class Int64JsonSchema1BoxedNumber(val data: Number) : Int64JsonSchema1Boxed { + override fun getData(): Any? { + return data + } + } + + open class Int64JsonSchema1 protected constructor() : JsonSchema( + JsonSchemaInfo() + .type( + setOf( + Int::class.java, + Long::class.java, + Float::class.java, + Double::class.java + ) + ) + .format("int64") + ), NumberSchemaValidator { + @Throws(ValidationException::class) + override fun validate(arg: Number, configuration: SchemaConfiguration?): Number { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg: Number = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validationMetadata = + ValidationMetadata(pathToItem, usedConfiguration, PathToSchemasMap(), LinkedHashSet()) + val pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet) + return getNewInstance(castArg, validationMetadata.pathToItem, pathToSchemasMap) + } + + @Throws(ValidationException::class) + fun validate(arg: Int, configuration: SchemaConfiguration?): Int { + return validate(arg as Number, configuration) as Int + } + + @Throws(ValidationException::class) + fun validate(arg: Long, configuration: SchemaConfiguration?): Long { + return validate(arg as Number, configuration) as Long + } + + @Throws(ValidationException::class) + fun validate(arg: Float, configuration: SchemaConfiguration?): Float { + return validate(arg as Number, configuration) as Float + } + + @Throws(ValidationException::class) + fun validate(arg: Double, configuration: SchemaConfiguration?): Double { + return validate(arg as Number, configuration) as Double + } + + override fun getNewInstance(arg: Any?, pathToItem: List, pathToSchemas: PathToSchemasMap): Any? { + if (arg is Number) { + return getNewInstance(arg, pathToItem, pathToSchemas) + } + throw RuntimeException("Invalid input type=$javaClass. It can't be instantiated by this schema") + } + + @Throws(ValidationException::class) + override fun validate(arg: Any?, configuration: SchemaConfiguration?): Number { + if (arg is Number) { + return validate(arg, configuration) + } + throw ValidationException("Invalid input type=$javaClass. It can't be validated by this schema") + } + + @Throws(ValidationException::class) + override fun validateAndBox(arg: Number, configuration: SchemaConfiguration?): Int64JsonSchema1BoxedNumber { + return Int64JsonSchema1BoxedNumber(validate(arg, configuration)) + } + + @Throws(ValidationException::class) + override fun validateAndBox(arg: Any?, configuration: SchemaConfiguration?): Int64JsonSchema1Boxed { + if (arg is Number) { + return validateAndBox(arg, configuration) + } + throw ValidationException("Invalid input type=$javaClass. It can't be validated by this schema") + } + + companion object { + @Volatile + private var instance: Int64JsonSchema1? = null + + fun getInstance() = + instance ?: synchronized(this) { + instance ?: Int64JsonSchema1().also { instance = it } + } + } + } +} \ No newline at end of file diff --git a/samples/client/3_1_0_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/schemas/IntJsonSchema.kt b/samples/client/3_1_0_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/schemas/IntJsonSchema.kt new file mode 100644 index 00000000000..0a0043e7335 --- /dev/null +++ b/samples/client/3_1_0_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/schemas/IntJsonSchema.kt @@ -0,0 +1,105 @@ +package org.openapijsonschematools.client.schemas + +import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags +import org.openapijsonschematools.client.exceptions.ValidationException +import org.openapijsonschematools.client.schemas.validation.JsonSchema +import org.openapijsonschematools.client.schemas.validation.JsonSchemaInfo +import org.openapijsonschematools.client.configurations.SchemaConfiguration +import org.openapijsonschematools.client.schemas.validation.PathToSchemasMap +import org.openapijsonschematools.client.schemas.validation.NumberSchemaValidator +import org.openapijsonschematools.client.schemas.validation.ValidationMetadata + +open class IntJsonSchema { + sealed interface IntJsonSchema1Boxed { + fun getData(): Any? + } + + data class IntJsonSchema1BoxedNumber(val data: Number) : IntJsonSchema1Boxed { + override fun getData(): Any? { + return data + } + } + + open class IntJsonSchema1 protected constructor() : JsonSchema( + JsonSchemaInfo() + .type( + setOf( + Int::class.java, + Long::class.java, + Float::class.java, + Double::class.java + ) + ) + .format("int") + ), NumberSchemaValidator { + @Throws(ValidationException::class) + override fun validate(arg: Number, configuration: SchemaConfiguration?): Number { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg: Number = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validationMetadata = + ValidationMetadata(pathToItem, usedConfiguration, PathToSchemasMap(), LinkedHashSet()) + val pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet) + return getNewInstance(castArg, validationMetadata.pathToItem, pathToSchemasMap) + } + + @Throws(ValidationException::class) + fun validate(arg: Int, configuration: SchemaConfiguration?): Int { + return validate(arg as Number, configuration) as Int + } + + @Throws(ValidationException::class) + fun validate(arg: Long, configuration: SchemaConfiguration?): Long { + return validate(arg as Number, configuration) as Long + } + + @Throws(ValidationException::class) + fun validate(arg: Float, configuration: SchemaConfiguration?): Float { + return validate(arg as Number, configuration) as Float + } + + @Throws(ValidationException::class) + fun validate(arg: Double, configuration: SchemaConfiguration?): Double { + return validate(arg as Number, configuration) as Double + } + + override fun getNewInstance(arg: Any?, pathToItem: List, pathToSchemas: PathToSchemasMap): Any? { + if (arg is Number) { + return getNewInstance(arg, pathToItem, pathToSchemas) + } + throw RuntimeException("Invalid input type=$javaClass. It can't be instantiated by this schema") + } + + @Throws(ValidationException::class) + override fun validate(arg: Any?, configuration: SchemaConfiguration?): Number { + if (arg is Number) { + return validate(arg, configuration) + } + throw ValidationException("Invalid input type=$javaClass. It can't be validated by this schema") + } + + @Throws(ValidationException::class) + override fun validateAndBox(arg: Number, configuration: SchemaConfiguration?): IntJsonSchema1BoxedNumber { + return IntJsonSchema1BoxedNumber(validate(arg, configuration)) + } + + @Throws(ValidationException::class) + override fun validateAndBox(arg: Any?, configuration: SchemaConfiguration?): IntJsonSchema1Boxed { + if (arg is Number) { + return validateAndBox(arg, configuration) + } + throw ValidationException("Invalid input type=$javaClass. It can't be validated by this schema") + } + + companion object { + @Volatile + private var instance: IntJsonSchema1? = null + + fun getInstance() = + instance ?: synchronized(this) { + instance ?: IntJsonSchema1().also { instance = it } + } + } + } +} \ No newline at end of file diff --git a/samples/client/3_1_0_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/schemas/ListJsonSchema.kt b/samples/client/3_1_0_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/schemas/ListJsonSchema.kt new file mode 100644 index 00000000000..eff37e367ff --- /dev/null +++ b/samples/client/3_1_0_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/schemas/ListJsonSchema.kt @@ -0,0 +1,98 @@ +package org.openapijsonschematools.client.schemas + +import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags +import org.openapijsonschematools.client.exceptions.ValidationException +import org.openapijsonschematools.client.schemas.validation.FrozenList +import org.openapijsonschematools.client.schemas.validation.JsonSchema +import org.openapijsonschematools.client.schemas.validation.JsonSchemaInfo +import org.openapijsonschematools.client.configurations.SchemaConfiguration +import org.openapijsonschematools.client.schemas.validation.PathToSchemasMap +import org.openapijsonschematools.client.schemas.validation.ListSchemaValidator +import org.openapijsonschematools.client.schemas.validation.ValidationMetadata + +open class ListJsonSchema { + sealed interface ListJsonSchema1Boxed { + fun getData(): Any? + } + + data class ListJsonSchema1BoxedList(val data: FrozenList) : ListJsonSchema1Boxed { + override fun getData(): Any? { + return data + } + } + + open class ListJsonSchema1 protected constructor() : JsonSchema( + JsonSchemaInfo() + .type(setOf(List::class.java)) + ), ListSchemaValidator, ListJsonSchema1BoxedList> { + override fun getNewInstance( + arg: List<*>, + pathToItem: List, + pathToSchemas: PathToSchemasMap + ): FrozenList { + val items: MutableList = ArrayList() + var i = 0 + for (item in arg) { + val itemPathToItem: List = pathToItem + i + val schemas: LinkedHashMap, Nothing?> = pathToSchemas[itemPathToItem] + ?: throw RuntimeException("Validation result is invalid, schemas must exist for a pathToItem") + val itemSchema: JsonSchema<*> = schemas.entries.iterator().next().key + val castItem = itemSchema.getNewInstance(item, itemPathToItem, pathToSchemas) + items.add(castItem) + i += 1 + } + return FrozenList(items) + } + + @Throws(ValidationException::class) + override fun validate(arg: List<*>, configuration: SchemaConfiguration?): FrozenList { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0]") + val castArg: List<*> = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validatedPathToSchemas = PathToSchemasMap() + val validationMetadata = + ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, LinkedHashSet()) + val pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet) + return getNewInstance(castArg, validationMetadata.pathToItem, pathToSchemasMap) + } + + override fun getNewInstance(arg: Any?, pathToItem: List, pathToSchemas: PathToSchemasMap): FrozenList { + if (arg is List<*>) { + return getNewInstance(arg, pathToItem, pathToSchemas) + } + throw RuntimeException("Invalid input type=$javaClass. It can't be instantiated by this schema") + } + + @Throws(ValidationException::class) + override fun validate(arg: Any?, configuration: SchemaConfiguration?): Any? { + if (arg is List<*>) { + return validate(arg, configuration) + } + throw ValidationException("Invalid input type=$javaClass. It can't be instantiated by this schema") + } + + @Throws(ValidationException::class) + override fun validateAndBox(arg: List<*>, configuration: SchemaConfiguration?): ListJsonSchema1BoxedList { + return ListJsonSchema1BoxedList(validate(arg, configuration)) + } + + @Throws(ValidationException::class) + override fun validateAndBox(arg: Any?, configuration: SchemaConfiguration?): ListJsonSchema1Boxed { + if (arg is List<*>) { + return validateAndBox(arg, configuration) + } + throw ValidationException("Invalid input type=$javaClass. It can't be validated by this schema") + } + + companion object { + @Volatile + private var instance: ListJsonSchema1? = null + + fun getInstance() = + instance ?: synchronized(this) { + instance ?: ListJsonSchema1().also { instance = it } + } + } + } +} \ No newline at end of file diff --git a/samples/client/3_1_0_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/schemas/MapJsonSchema.kt b/samples/client/3_1_0_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/schemas/MapJsonSchema.kt new file mode 100644 index 00000000000..a1e0ecc6842 --- /dev/null +++ b/samples/client/3_1_0_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/schemas/MapJsonSchema.kt @@ -0,0 +1,98 @@ +package org.openapijsonschematools.client.schemas + +import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags +import org.openapijsonschematools.client.exceptions.ValidationException +import org.openapijsonschematools.client.schemas.validation.FrozenMap +import org.openapijsonschematools.client.schemas.validation.JsonSchema +import org.openapijsonschematools.client.schemas.validation.JsonSchemaInfo +import org.openapijsonschematools.client.configurations.SchemaConfiguration +import org.openapijsonschematools.client.schemas.validation.PathToSchemasMap +import org.openapijsonschematools.client.schemas.validation.MapSchemaValidator +import org.openapijsonschematools.client.schemas.validation.ValidationMetadata + +open class MapJsonSchema { + sealed interface MapJsonSchema1Boxed { + fun getData(): Any? + } + + data class MapJsonSchema1BoxedMap(val data: FrozenMap) : MapJsonSchema1Boxed { + override fun getData(): Any? { + return data + } + } + + open class MapJsonSchema1 protected constructor() : JsonSchema( + JsonSchemaInfo() + .type(setOf(Map::class.java)) + ), MapSchemaValidator, MapJsonSchema1BoxedMap> { + override fun getNewInstance( + arg: Map<*, *>, + pathToItem: List, + pathToSchemas: PathToSchemasMap + ): FrozenMap { + val properties = LinkedHashMap() + for ((entryKey, value1) in arg) { + if (entryKey !is String) { + throw RuntimeException("Invalid non-string key value") + } + val propertyPathToItem: List = pathToItem + entryKey + val schemas: LinkedHashMap, Nothing?> = pathToSchemas[propertyPathToItem] + ?: throw RuntimeException("Validation result is invalid, schemas must exist for a pathToItem") + val propertySchema: JsonSchema<*> = schemas.entries.iterator().next().key + val castValue = propertySchema.getNewInstance(value1, propertyPathToItem, pathToSchemas) + properties[entryKey] = castValue + } + return FrozenMap(properties) + } + + @Throws(ValidationException::class) + override fun validate(arg: Map<*, *>, configuration: SchemaConfiguration?): FrozenMap { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg: Map<*, *> = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validationMetadata = + ValidationMetadata(pathToItem, usedConfiguration, PathToSchemasMap(), LinkedHashSet()) + val pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet) + return getNewInstance(castArg, validationMetadata.pathToItem, pathToSchemasMap) + } + + override fun getNewInstance(arg: Any?, pathToItem: List, pathToSchemas: PathToSchemasMap): FrozenMap { + if (arg is Map<*, *>) { + return getNewInstance(arg, pathToItem, pathToSchemas) + } + throw RuntimeException("Invalid input type=$javaClass. It can't be instantiated by this schema") + } + + @Throws(ValidationException::class) + override fun validate(arg: Any?, configuration: SchemaConfiguration?): Any? { + if (arg is Map<*, *>) { + return validate(arg, configuration) + } + throw ValidationException("Invalid input type=$javaClass. It can't be validated by this schema") + } + + @Throws(ValidationException::class) + override fun validateAndBox(arg: Map<*, *>, configuration: SchemaConfiguration?): MapJsonSchema1BoxedMap { + return MapJsonSchema1BoxedMap(validate(arg, configuration)) + } + + @Throws(ValidationException::class) + override fun validateAndBox(arg: Any?, configuration: SchemaConfiguration?): MapJsonSchema1Boxed { + if (arg is Map<*, *>) { + return validateAndBox(arg, configuration) + } + throw ValidationException("Invalid input type=$javaClass. It can't be validated by this schema") + } + + companion object { + @Volatile + private var instance: MapJsonSchema1? = null + + fun getInstance() = + instance ?: synchronized(this) { + instance ?: MapJsonSchema1().also { instance = it } + } + } + } +} \ No newline at end of file diff --git a/samples/client/3_1_0_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/schemas/NotAnyTypeJsonSchema.kt b/samples/client/3_1_0_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/schemas/NotAnyTypeJsonSchema.kt new file mode 100644 index 00000000000..f0992da3100 --- /dev/null +++ b/samples/client/3_1_0_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/schemas/NotAnyTypeJsonSchema.kt @@ -0,0 +1,379 @@ +package org.openapijsonschematools.client.schemas + +import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags +import org.openapijsonschematools.client.configurations.SchemaConfiguration +import org.openapijsonschematools.client.exceptions.ValidationException +import org.openapijsonschematools.client.schemas.validation.FrozenList +import org.openapijsonschematools.client.schemas.validation.FrozenMap +import org.openapijsonschematools.client.schemas.validation.JsonSchema +import org.openapijsonschematools.client.schemas.validation.JsonSchemaInfo +import org.openapijsonschematools.client.schemas.validation.PathToSchemasMap +import org.openapijsonschematools.client.schemas.validation.NullSchemaValidator +import org.openapijsonschematools.client.schemas.validation.BooleanSchemaValidator +import org.openapijsonschematools.client.schemas.validation.NumberSchemaValidator +import org.openapijsonschematools.client.schemas.validation.StringSchemaValidator +import org.openapijsonschematools.client.schemas.validation.ListSchemaValidator +import org.openapijsonschematools.client.schemas.validation.MapSchemaValidator +import org.openapijsonschematools.client.schemas.validation.ValidationMetadata + +import java.time.LocalDate +import java.time.ZonedDateTime +import java.util.UUID + +open class NotAnyTypeJsonSchema { + sealed interface NotAnyTypeJsonSchema1Boxed { + fun getData(): Any? + } + + + data class NotAnyTypeJsonSchema1BoxedVoid(val data: Void?) : NotAnyTypeJsonSchema1Boxed { + override fun getData(): Any? { + return data + } + } + + + data class NotAnyTypeJsonSchema1BoxedBoolean(val data: Boolean) : NotAnyTypeJsonSchema1Boxed { + override fun getData(): Any? { + return data + } + + } + + + data class NotAnyTypeJsonSchema1BoxedNumber(val data: Number) : NotAnyTypeJsonSchema1Boxed { + override fun getData(): Any? { + return data + } + } + + + data class NotAnyTypeJsonSchema1BoxedString(val data: String) : NotAnyTypeJsonSchema1Boxed { + override fun getData(): Any? { + return data + } + } + + + data class NotAnyTypeJsonSchema1BoxedList(val data: FrozenList) : NotAnyTypeJsonSchema1Boxed { + override fun getData(): Any? { + return data + } + } + + + data class NotAnyTypeJsonSchema1BoxedMap(val data: FrozenMap) : NotAnyTypeJsonSchema1Boxed { + override fun getData(): Any? { + return data + } + } + + open class NotAnyTypeJsonSchema1 protected constructor() : JsonSchema( + JsonSchemaInfo() + .not(AnyTypeJsonSchema.AnyTypeJsonSchema1::class.java) + ), NullSchemaValidator, BooleanSchemaValidator, + NumberSchemaValidator, + StringSchemaValidator, + ListSchemaValidator, NotAnyTypeJsonSchema1BoxedList>, + MapSchemaValidator, NotAnyTypeJsonSchema1BoxedMap> { + @Throws(ValidationException::class) + override fun validate(arg: Nothing?, configuration: SchemaConfiguration?): Nothing? { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0]") + val castArg: Nothing? = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validatedPathToSchemas = PathToSchemasMap() + val validationMetadata = + ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, LinkedHashSet()) + val pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet) + return getNewInstance(castArg, validationMetadata.pathToItem, pathToSchemasMap) + } + + @Throws(ValidationException::class) + override fun validate(arg: Boolean, configuration: SchemaConfiguration?): Boolean { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0]") + val castArg: Boolean = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validatedPathToSchemas = PathToSchemasMap() + val validationMetadata = + ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, LinkedHashSet()) + val pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet) + return getNewInstance(castArg, validationMetadata.pathToItem, pathToSchemasMap) + } + + @Throws(ValidationException::class) + override fun validate(arg: Number, configuration: SchemaConfiguration?): Number { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0]") + val castArg: Number = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validatedPathToSchemas = PathToSchemasMap() + val validationMetadata = + ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, LinkedHashSet()) + val pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet) + return getNewInstance(castArg, validationMetadata.pathToItem, pathToSchemasMap) + } + + @Throws(ValidationException::class) + fun validate(arg: Int, configuration: SchemaConfiguration?): Int { + return validate(arg as Number, configuration) as Int + } + + @Throws(ValidationException::class) + fun validate(arg: Long, configuration: SchemaConfiguration?): Long { + return validate(arg as Number, configuration) as Long + } + + @Throws(ValidationException::class) + fun validate(arg: Float, configuration: SchemaConfiguration?): Float { + return validate(arg as Number, configuration) as Float + } + + @Throws(ValidationException::class) + fun validate(arg: Double, configuration: SchemaConfiguration?): Double { + return validate(arg as Number, configuration) as Double + } + + @Throws(ValidationException::class) + override fun validate(arg: String, configuration: SchemaConfiguration?): String { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0]") + val castArg: String = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validatedPathToSchemas = PathToSchemasMap() + val validationMetadata = + ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, LinkedHashSet()) + val pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet) + return getNewInstance(castArg, validationMetadata.pathToItem, pathToSchemasMap) + } + + @Throws(ValidationException::class) + fun validate(arg: LocalDate, configuration: SchemaConfiguration?): String { + return validate(arg.toString(), configuration) + } + + @Throws(ValidationException::class) + fun validate(arg: ZonedDateTime, configuration: SchemaConfiguration?): String { + return validate(arg.toString(), configuration) + } + + @Throws(ValidationException::class) + fun validate(arg: UUID, configuration: SchemaConfiguration?): String { + return validate(arg.toString(), configuration) + } + + override fun getNewInstance( + arg: List<*>, + pathToItem: List, + pathToSchemas: PathToSchemasMap + ): FrozenList { + val items: MutableList = ArrayList() + var i = 0 + for (item in arg) { + val itemPathToItem: MutableList = ArrayList(pathToItem) + itemPathToItem.add(i) + val schemas = pathToSchemas[itemPathToItem] + ?: throw RuntimeException("Validation result is invalid, schemas must exist for a pathToItem") + val itemSchema = schemas.entries.iterator().next().key + val castItem = itemSchema.getNewInstance(item, itemPathToItem, pathToSchemas) + items.add(castItem) + i += 1 + } + return FrozenList(items) + } + + @Throws(ValidationException::class) + override fun validate(arg: List<*>, configuration: SchemaConfiguration?): FrozenList { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0]") + val castArg: List<*> = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validatedPathToSchemas = PathToSchemasMap() + val validationMetadata = + ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, LinkedHashSet()) + val pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet) + return getNewInstance(castArg, validationMetadata.pathToItem, pathToSchemasMap) + } + + override fun getNewInstance( + arg: Map<*, *>, + pathToItem: List, + pathToSchemas: PathToSchemasMap + ): FrozenMap { + val properties = LinkedHashMap() + for ((entryKey, value1) in arg) { + if (entryKey !is String) { + throw RuntimeException("Invalid non-string key value") + } + val propertyPathToItem: MutableList = ArrayList(pathToItem) + propertyPathToItem.add(entryKey) + val schemas = pathToSchemas[propertyPathToItem] + ?: throw RuntimeException("Validation result is invalid, schemas must exist for a pathToItem") + val propertySchema = schemas.entries.iterator().next().key + val castValue = propertySchema.getNewInstance(value1, propertyPathToItem, pathToSchemas) + properties[entryKey] = castValue + } + return FrozenMap(properties) + } + + @Throws(ValidationException::class) + override fun validate(arg: Map<*, *>, configuration: SchemaConfiguration?): FrozenMap { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0]") + val castArg: Map<*, *> = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validatedPathToSchemas = PathToSchemasMap() + val validationMetadata = + ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, LinkedHashSet()) + val pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet) + return getNewInstance(castArg, validationMetadata.pathToItem, pathToSchemasMap) + } + + override fun getNewInstance(arg: Any?, pathToItem: List, pathToSchemas: PathToSchemasMap): Any? { + when (arg) { + null -> { + return getNewInstance(null as Void?, pathToItem, pathToSchemas) + } + is Boolean -> { + return getNewInstance(arg, pathToItem, pathToSchemas) + } + + is Number -> { + return getNewInstance(arg, pathToItem, pathToSchemas) + } + + is String -> { + return getNewInstance(arg, pathToItem, pathToSchemas) + } + + is List<*> -> { + return getNewInstance(arg, pathToItem, pathToSchemas) + } + + is Map<*, *> -> { + return getNewInstance(arg, pathToItem, pathToSchemas) + } + + else -> throw RuntimeException("Invalid input type=$javaClass. It can't be instantiated by this schema") + } + } + + @Throws(ValidationException::class) + override fun validate(arg: Any?, configuration: SchemaConfiguration?): Any? { + when (arg) { + null -> { + return validate(null as Void?, configuration) + } + is Boolean -> { + return validate(arg, configuration) + } + + is Number -> { + return validate(arg, configuration) + } + + is String -> { + return validate(arg, configuration) + } + + is List<*> -> { + return validate(arg, configuration) + } + + is Map<*, *> -> { + return validate(arg, configuration) + } + + else -> throw ValidationException("Invalid input type=$javaClass. It can't be validated by this schema") + } + } + + @Throws(ValidationException::class) + override fun validateAndBox(arg: Nothing?, configuration: SchemaConfiguration?): NotAnyTypeJsonSchema1BoxedVoid { + return NotAnyTypeJsonSchema1BoxedVoid(validate(arg, configuration)) + } + + @Throws(ValidationException::class) + override fun validateAndBox( + arg: Boolean, + configuration: SchemaConfiguration? + ): NotAnyTypeJsonSchema1BoxedBoolean { + return NotAnyTypeJsonSchema1BoxedBoolean(validate(arg, configuration)) + } + + @Throws(ValidationException::class) + override fun validateAndBox( + arg: Number, + configuration: SchemaConfiguration? + ): NotAnyTypeJsonSchema1BoxedNumber { + return NotAnyTypeJsonSchema1BoxedNumber(validate(arg, configuration)) + } + + @Throws(ValidationException::class) + override fun validateAndBox( + arg: String, + configuration: SchemaConfiguration? + ): NotAnyTypeJsonSchema1BoxedString { + return NotAnyTypeJsonSchema1BoxedString(validate(arg, configuration)) + } + + @Throws(ValidationException::class) + override fun validateAndBox( + arg: List<*>, + configuration: SchemaConfiguration? + ): NotAnyTypeJsonSchema1BoxedList { + return NotAnyTypeJsonSchema1BoxedList(validate(arg, configuration)) + } + + @Throws(ValidationException::class) + override fun validateAndBox( + arg: Map<*, *>, + configuration: SchemaConfiguration? + ): NotAnyTypeJsonSchema1BoxedMap { + return NotAnyTypeJsonSchema1BoxedMap(validate(arg, configuration)) + } + + @Throws(ValidationException::class) + override fun validateAndBox(arg: Any?, configuration: SchemaConfiguration?): NotAnyTypeJsonSchema1Boxed { + when (arg) { + null -> { + return validateAndBox(null, configuration) + } + is Boolean -> { + val castArg: Boolean = arg + return validateAndBox(castArg, configuration) + } + + is String -> { + return validateAndBox(arg, configuration) + } + + is Number -> { + return validateAndBox(arg, configuration) + } + + is List<*> -> { + return validateAndBox(arg, configuration) + } + + is Map<*, *> -> { + return validateAndBox(arg, configuration) + } + + else -> throw ValidationException("Invalid input type=$javaClass. It can't be validated by this schema") + } + } + + companion object { + var instance: NotAnyTypeJsonSchema1? = null + get() { + if (field == null) { + field = NotAnyTypeJsonSchema1() + } + return field + } + private set + } + } +} \ No newline at end of file diff --git a/samples/client/3_1_0_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/schemas/NullJsonSchema.kt b/samples/client/3_1_0_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/schemas/NullJsonSchema.kt new file mode 100644 index 00000000000..b926c2cdb7c --- /dev/null +++ b/samples/client/3_1_0_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/schemas/NullJsonSchema.kt @@ -0,0 +1,77 @@ +package org.openapijsonschematools.client.schemas + +import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags +import org.openapijsonschematools.client.configurations.SchemaConfiguration +import org.openapijsonschematools.client.exceptions.ValidationException +import org.openapijsonschematools.client.schemas.validation.JsonSchema +import org.openapijsonschematools.client.schemas.validation.JsonSchemaInfo +import org.openapijsonschematools.client.schemas.validation.PathToSchemasMap +import org.openapijsonschematools.client.schemas.validation.NullSchemaValidator +import org.openapijsonschematools.client.schemas.validation.ValidationMetadata + +open class NullJsonSchema { + sealed interface NullJsonSchema1Boxed { + fun getData(): Any? + } + + data class NullJsonSchema1BoxedVoid(val data: Nothing?) : NullJsonSchema1Boxed { + override fun getData(): Any? { + return data + } + } + + open class NullJsonSchema1 protected constructor() : JsonSchema( + JsonSchemaInfo() + .type(setOf(Void::class.java)) + ), NullSchemaValidator { + @Throws(ValidationException::class) + override fun validate(arg: Nothing?, configuration: SchemaConfiguration?): Nothing? { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg: Nothing? = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validationMetadata = + ValidationMetadata(pathToItem, usedConfiguration, PathToSchemasMap(), LinkedHashSet()) + val pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet) + return getNewInstance(castArg, validationMetadata.pathToItem, pathToSchemasMap) + } + + override fun getNewInstance(arg: Any?, pathToItem: List, pathToSchemas: PathToSchemasMap): Any? { + if (arg == null) { + return getNewInstance(null, pathToItem, pathToSchemas) + } + throw RuntimeException("Invalid input type=$javaClass. It can't be instantiated by this schema") + } + + @Throws(ValidationException::class) + override fun validate(arg: Any?, configuration: SchemaConfiguration?): Any? { + if (arg == null) { + return validate(null, configuration) + } + throw ValidationException("Invalid input type=$javaClass. It can't be validated by this schema") + } + + @Throws(ValidationException::class) + override fun validateAndBox(arg: Nothing?, configuration: SchemaConfiguration?): NullJsonSchema1BoxedVoid { + return NullJsonSchema1BoxedVoid(validate(arg, configuration)) + } + + @Throws(ValidationException::class) + override fun validateAndBox(arg: Any?, configuration: SchemaConfiguration?): NullJsonSchema1Boxed { + if (arg == null) { + return validateAndBox(null, configuration) + } + throw ValidationException("Invalid input type=$javaClass. It can't be validated by this schema") + } + + companion object { + @Volatile + private var instance: NullJsonSchema1? = null + + fun getInstance() = + instance ?: synchronized(this) { + instance ?: NullJsonSchema1().also { instance = it } + } + } + } +} diff --git a/samples/client/3_1_0_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/schemas/NumberJsonSchema.kt b/samples/client/3_1_0_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/schemas/NumberJsonSchema.kt new file mode 100644 index 00000000000..7f29d2a96a9 --- /dev/null +++ b/samples/client/3_1_0_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/schemas/NumberJsonSchema.kt @@ -0,0 +1,104 @@ +package org.openapijsonschematools.client.schemas + +import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags +import org.openapijsonschematools.client.exceptions.ValidationException +import org.openapijsonschematools.client.schemas.validation.JsonSchema +import org.openapijsonschematools.client.schemas.validation.JsonSchemaInfo +import org.openapijsonschematools.client.configurations.SchemaConfiguration +import org.openapijsonschematools.client.schemas.validation.PathToSchemasMap +import org.openapijsonschematools.client.schemas.validation.NumberSchemaValidator +import org.openapijsonschematools.client.schemas.validation.ValidationMetadata + +open class NumberJsonSchema { + sealed interface NumberJsonSchema1Boxed { + fun getData(): Any? + } + + data class NumberJsonSchema1BoxedNumber(val data: Number) : NumberJsonSchema1Boxed { + override fun getData(): Any? { + return data + } + } + + open class NumberJsonSchema1 protected constructor() : JsonSchema( + JsonSchemaInfo() + .type( + setOf( + Int::class.java, + Long::class.java, + Float::class.java, + Double::class.java + ) + ) + ), NumberSchemaValidator { + @Throws(ValidationException::class) + override fun validate(arg: Number, configuration: SchemaConfiguration?): Number { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg: Number = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validationMetadata = + ValidationMetadata(pathToItem, usedConfiguration, PathToSchemasMap(), LinkedHashSet()) + val pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet) + return getNewInstance(castArg, validationMetadata.pathToItem, pathToSchemasMap) + } + + @Throws(ValidationException::class) + fun validate(arg: Int, configuration: SchemaConfiguration?): Int { + return validate(arg as Number, configuration) as Int + } + + @Throws(ValidationException::class) + fun validate(arg: Long, configuration: SchemaConfiguration?): Long { + return validate(arg as Number, configuration) as Long + } + + @Throws(ValidationException::class) + fun validate(arg: Float, configuration: SchemaConfiguration?): Float { + return validate(arg as Number, configuration) as Float + } + + @Throws(ValidationException::class) + fun validate(arg: Double, configuration: SchemaConfiguration?): Double { + return validate(arg as Number, configuration) as Double + } + + override fun getNewInstance(arg: Any?, pathToItem: List, pathToSchemas: PathToSchemasMap): Any? { + if (arg is Number) { + return getNewInstance(arg, pathToItem, pathToSchemas) + } + throw RuntimeException("Invalid input type=$javaClass. It can't be instantiated by this schema") + } + + @Throws(ValidationException::class) + override fun validate(arg: Any?, configuration: SchemaConfiguration?): Number { + if (arg is Number) { + return validate(arg, configuration) + } + throw ValidationException("Invalid input type=$javaClass. It can't be validated by this schema") + } + + @Throws(ValidationException::class) + override fun validateAndBox(arg: Number, configuration: SchemaConfiguration?): NumberJsonSchema1BoxedNumber { + return NumberJsonSchema1BoxedNumber(validate(arg, configuration)) + } + + @Throws(ValidationException::class) + override fun validateAndBox(arg: Any?, configuration: SchemaConfiguration?): NumberJsonSchema1Boxed { + if (arg is Number) { + return validateAndBox(arg, configuration) + } + throw ValidationException("Invalid input type=$javaClass. It can't be validated by this schema") + } + + companion object { + @Volatile + private var instance: NumberJsonSchema1? = null + + fun getInstance() = + instance ?: synchronized(this) { + instance ?: NumberJsonSchema1().also { instance = it } + } + } + } +} \ No newline at end of file diff --git a/samples/client/3_1_0_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/schemas/StringJsonSchema.kt b/samples/client/3_1_0_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/schemas/StringJsonSchema.kt new file mode 100644 index 00000000000..29f8b0f77f3 --- /dev/null +++ b/samples/client/3_1_0_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/schemas/StringJsonSchema.kt @@ -0,0 +1,111 @@ +package org.openapijsonschematools.client.schemas + +import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags +import org.openapijsonschematools.client.configurations.SchemaConfiguration +import org.openapijsonschematools.client.exceptions.ValidationException +import org.openapijsonschematools.client.schemas.validation.JsonSchema +import org.openapijsonschematools.client.schemas.validation.JsonSchemaInfo +import org.openapijsonschematools.client.schemas.validation.PathToSchemasMap +import org.openapijsonschematools.client.schemas.validation.StringSchemaValidator +import org.openapijsonschematools.client.schemas.validation.ValidationMetadata + +import java.time.LocalDate +import java.time.ZonedDateTime +import java.util.UUID + +open class StringJsonSchema { + interface StringJsonSchema1Boxed { + fun getData(): Any? + } + + data class StringJsonSchema1BoxedString(val data: String) : StringJsonSchema1Boxed { + override fun getData(): Any? { + return data + } + } + + open class StringJsonSchema1 protected constructor() : JsonSchema( + JsonSchemaInfo() + .type(setOf(String::class.java)) + ), StringSchemaValidator { + @Throws(ValidationException::class) + override fun validate(arg: String, configuration: SchemaConfiguration?): String { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg: String = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validationMetadata = + ValidationMetadata(pathToItem, usedConfiguration, PathToSchemasMap(), LinkedHashSet()) + val pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet) + return getNewInstance(castArg, validationMetadata.pathToItem, pathToSchemasMap) + } + + @Throws(ValidationException::class) + fun validate(arg: LocalDate, configuration: SchemaConfiguration?): String { + return validate(arg.toString(), configuration) + } + + @Throws(ValidationException::class) + fun validate(arg: ZonedDateTime, configuration: SchemaConfiguration?): String { + return validate(arg.toString(), configuration) + } + + @Throws(ValidationException::class) + fun validate(arg: UUID, configuration: SchemaConfiguration?): String { + return validate(arg.toString(), configuration) + } + + override fun getNewInstance(arg: Any?, pathToItem: List, pathToSchemas: PathToSchemasMap): Any? { + if (arg is String) { + return getNewInstance(arg, pathToItem, pathToSchemas) + } + throw RuntimeException("Invalid input type=$javaClass. It can't be instantiated by this schema") + } + + @Throws(ValidationException::class) + override fun validate(arg: Any?, configuration: SchemaConfiguration?): String { + when (arg) { + is UUID -> { + return validate(arg, configuration) + } + + is LocalDate -> { + return validate(arg, configuration) + } + + is ZonedDateTime -> { + return validate(arg, configuration) + } + + is String -> { + return validate(arg, configuration) + } + + else -> throw ValidationException("Invalid input type=$javaClass. It can't be validated by this schema") + } + } + + @Throws(ValidationException::class) + override fun validateAndBox(arg: String, configuration: SchemaConfiguration?): StringJsonSchema1BoxedString { + return StringJsonSchema1BoxedString(validate(arg, configuration)) + } + + @Throws(ValidationException::class) + override fun validateAndBox(arg: Any?, configuration: SchemaConfiguration?): StringJsonSchema1Boxed { + if (arg is String) { + return validateAndBox(arg, configuration) + } + throw ValidationException("Invalid input type=$javaClass. It can't be validated by this schema") + } + + companion object { + @Volatile + private var instance: StringJsonSchema1? = null + + fun getInstance() = + instance ?: synchronized(this) { + instance ?: StringJsonSchema1().also { instance = it } + } + } + } +} \ No newline at end of file diff --git a/samples/client/3_1_0_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/schemas/UnsetAddPropsSetter.kt b/samples/client/3_1_0_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/schemas/UnsetAddPropsSetter.kt new file mode 100644 index 00000000000..320112a061d --- /dev/null +++ b/samples/client/3_1_0_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/schemas/UnsetAddPropsSetter.kt @@ -0,0 +1,81 @@ +package org.openapijsonschematools.client.schemas + +import org.openapijsonschematools.client.exceptions.InvalidAdditionalPropertyException +import org.openapijsonschematools.client.schemas.validation.MapUtils + +interface UnsetAddPropsSetter { + fun getInstance(): MutableMap + fun getKnownKeys(): Set + fun getBuilderAfterAdditionalProperty(instance: MutableMap): T + @Throws(InvalidAdditionalPropertyException::class) + fun additionalProperty(key: String, value: Void): T { + MapUtils.throwIfKeyKnown(key, getKnownKeys(), true) + val instance = getInstance() + instance[key] = value + return getBuilderAfterAdditionalProperty(instance) + } + + @Throws(InvalidAdditionalPropertyException::class) + fun additionalProperty(key: String, value: Boolean): T { + MapUtils.throwIfKeyKnown(key, getKnownKeys(), true) + val instance = getInstance() + instance[key] = value + return getBuilderAfterAdditionalProperty(instance) + } + + @Throws(InvalidAdditionalPropertyException::class) + fun additionalProperty(key: String, value: String): T { + MapUtils.throwIfKeyKnown(key, getKnownKeys(), true) + val instance = getInstance() + instance[key] = value + return getBuilderAfterAdditionalProperty(instance) + } + + @Throws(InvalidAdditionalPropertyException::class) + fun additionalProperty(key: String, value: Int): T { + MapUtils.throwIfKeyKnown(key, getKnownKeys(), true) + val instance = getInstance() + instance[key] = value + return getBuilderAfterAdditionalProperty(instance) + } + + @Throws(InvalidAdditionalPropertyException::class) + fun additionalProperty(key: String, value: Float): T { + MapUtils.throwIfKeyKnown(key, getKnownKeys(), true) + val instance = getInstance() + instance[key] = value + return getBuilderAfterAdditionalProperty(instance) + } + + @Throws(InvalidAdditionalPropertyException::class) + fun additionalProperty(key: String, value: Long): T { + MapUtils.throwIfKeyKnown(key, getKnownKeys(), true) + val instance = getInstance() + instance[key] = value + return getBuilderAfterAdditionalProperty(instance) + } + + @Throws(InvalidAdditionalPropertyException::class) + fun additionalProperty(key: String, value: Double): T { + MapUtils.throwIfKeyKnown(key, getKnownKeys(), true) + val instance = getInstance() + instance[key] = value + return getBuilderAfterAdditionalProperty(instance) + } + + @Throws(InvalidAdditionalPropertyException::class) + fun additionalProperty(key: String, value: List<*>): T { + MapUtils.throwIfKeyKnown(key, getKnownKeys(), true) + val instance = getInstance() + instance[key] = value + return getBuilderAfterAdditionalProperty(instance) + } + + @Throws(InvalidAdditionalPropertyException::class) + fun additionalProperty(key: String, value: Map): T { + MapUtils.throwIfKeyKnown(key, getKnownKeys(), true) + val instance = getInstance() + instance[key] = value + return getBuilderAfterAdditionalProperty(instance) + } +} \ No newline at end of file diff --git a/samples/client/3_1_0_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/schemas/UuidJsonSchema.kt b/samples/client/3_1_0_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/schemas/UuidJsonSchema.kt new file mode 100644 index 00000000000..5586af2b501 --- /dev/null +++ b/samples/client/3_1_0_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/schemas/UuidJsonSchema.kt @@ -0,0 +1,87 @@ +package org.openapijsonschematools.client.schemas + +import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags +import org.openapijsonschematools.client.exceptions.ValidationException +import org.openapijsonschematools.client.schemas.validation.JsonSchema +import org.openapijsonschematools.client.schemas.validation.JsonSchemaInfo +import org.openapijsonschematools.client.configurations.SchemaConfiguration +import org.openapijsonschematools.client.schemas.validation.PathToSchemasMap +import org.openapijsonschematools.client.schemas.validation.StringSchemaValidator +import org.openapijsonschematools.client.schemas.validation.ValidationMetadata + +import java.util.UUID + +open class UuidJsonSchema { + sealed interface UuidJsonSchema1Boxed { + fun getData(): Any? + } + + data class UuidJsonSchema1BoxedString(val data: String) : UuidJsonSchema1Boxed { + override fun getData(): Any? { + return data + } + } + + open class UuidJsonSchema1 protected constructor() : JsonSchema( + JsonSchemaInfo() + .type(setOf(String::class.java)) + .format("uuid") + ), StringSchemaValidator { + @Throws(ValidationException::class) + override fun validate(arg: String, configuration: SchemaConfiguration?): String { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg: String = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validationMetadata = + ValidationMetadata(pathToItem, usedConfiguration, PathToSchemasMap(), LinkedHashSet()) + val pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet) + return getNewInstance(castArg, validationMetadata.pathToItem, pathToSchemasMap) + } + + @Throws(ValidationException::class) + fun validate(arg: UUID, configuration: SchemaConfiguration?): String { + return validate(arg.toString(), configuration) + } + + override fun getNewInstance(arg: Any?, pathToItem: List, pathToSchemas: PathToSchemasMap): String { + if (arg is String) { + return getNewInstance(arg, pathToItem, pathToSchemas) + } + throw RuntimeException("Invalid input type=$javaClass. It can't be instantiated by this schema") + } + + @Throws(ValidationException::class) + override fun validate(arg: Any?, configuration: SchemaConfiguration?): String { + if (arg is UUID) { + return validate(arg, configuration) + } else if (arg is String) { + return validate(arg, configuration) + } + throw ValidationException("Invalid input type=$javaClass. It can't be validated by this schema") + } + + @Throws(ValidationException::class) + override fun validateAndBox(arg: String, configuration: SchemaConfiguration?): UuidJsonSchema1BoxedString { + return UuidJsonSchema1BoxedString(validate(arg, configuration)) + } + + @Throws(ValidationException::class) + override fun validateAndBox(arg: Any?, configuration: SchemaConfiguration?): UuidJsonSchema1Boxed { + if (arg is String) { + return validateAndBox(arg, configuration) + } + throw ValidationException("Invalid input type=$javaClass. It can't be validated by this schema") + } + + companion object { + @Volatile + private var instance: UuidJsonSchema1? = null + + fun getInstance() = + instance ?: synchronized(this) { + instance ?: UuidJsonSchema1().also { instance = it } + } + } + } +} \ No newline at end of file diff --git a/samples/client/3_1_0_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/schemas/validation/AdditionalPropertiesValidator.kt b/samples/client/3_1_0_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/schemas/validation/AdditionalPropertiesValidator.kt new file mode 100644 index 00000000000..c7123fd5823 --- /dev/null +++ b/samples/client/3_1_0_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/schemas/validation/AdditionalPropertiesValidator.kt @@ -0,0 +1,49 @@ +package org.openapijsonschematools.client.schemas.validation + +import org.openapijsonschematools.client.exceptions.ValidationException + +class AdditionalPropertiesValidator : KeywordValidator { + @Throws(ValidationException::class) + override fun validate( + data: ValidationData + ): PathToSchemasMap? { + if (data.arg !is Map<*, *>) { + return null + } + val additionalProperties: Class> = data.schema.additionalProperties ?: return null + val presentAdditionalProperties: MutableSet = LinkedHashSet() + for (key in data.arg.keys) { + if (key is String) { + presentAdditionalProperties.add(key) + } + } + val properties: Map>>? = data.schema.properties + if (properties != null) { + presentAdditionalProperties.removeAll(properties.keys) + } + val pathToSchemas = PathToSchemasMap() + for (addPropName in presentAdditionalProperties) { + val propValue: Any? = data.arg.get(addPropName) + val propPathToItem: List = data.validationMetadata.pathToItem + addPropName + if (data.patternPropertiesPathToSchemas != null && data.patternPropertiesPathToSchemas + .containsKey(propPathToItem) + ) { + continue + } + val propValidationMetadata = ValidationMetadata( + propPathToItem, + data.validationMetadata.configuration, + data.validationMetadata.validatedPathToSchemas, + data.validationMetadata.seenClasses + ) + val addPropsSchema = JsonSchemaFactory.getInstance(additionalProperties) + if (propValidationMetadata.validationRanEarlier(addPropsSchema)) { + // todo add_deeper_validated_schemas + continue + } + val otherPathToSchemas = JsonSchema.validate(addPropsSchema, propValue, propValidationMetadata) + pathToSchemas.update(otherPathToSchemas) + } + return pathToSchemas + } +} diff --git a/samples/client/3_1_0_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/schemas/validation/AllOfValidator.kt b/samples/client/3_1_0_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/schemas/validation/AllOfValidator.kt new file mode 100644 index 00000000000..e81a1aebfa6 --- /dev/null +++ b/samples/client/3_1_0_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/schemas/validation/AllOfValidator.kt @@ -0,0 +1,19 @@ +package org.openapijsonschematools.client.schemas.validation + +import org.openapijsonschematools.client.exceptions.ValidationException + +class AllOfValidator : KeywordValidator { + @Throws(ValidationException::class) + override fun validate( + data: ValidationData + ): PathToSchemasMap? { + val allOf: List>> = data.schema.allOf ?: return null + val pathToSchemas = PathToSchemasMap() + for (allOfClass in allOf) { + val allOfSchema = JsonSchemaFactory.getInstance(allOfClass) + val otherPathToSchemas = JsonSchema.validate(allOfSchema, data.arg, data.validationMetadata) + pathToSchemas.update(otherPathToSchemas) + } + return pathToSchemas + } +} \ No newline at end of file diff --git a/samples/client/3_1_0_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/schemas/validation/AnyOfValidator.kt b/samples/client/3_1_0_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/schemas/validation/AnyOfValidator.kt new file mode 100644 index 00000000000..b264835903b --- /dev/null +++ b/samples/client/3_1_0_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/schemas/validation/AnyOfValidator.kt @@ -0,0 +1,39 @@ +package org.openapijsonschematools.client.schemas.validation + +import org.openapijsonschematools.client.exceptions.ValidationException + +class AnyOfValidator : KeywordValidator { + @Throws(ValidationException::class) + override fun validate( + data: ValidationData + ): PathToSchemasMap? { + val anyOf: List>> = data.schema.anyOf ?: return null + val pathToSchemas = PathToSchemasMap() + val validatedAnyOfClasses: MutableList>> = ArrayList() + for (anyOfClass in anyOf) { + if (anyOfClass == data.schema.javaClass) { + /* + optimistically assume that schema will pass validation + do not invoke _validate on it because that is recursive + */ + validatedAnyOfClasses.add(anyOfClass) + continue + } + try { + val anyOfSchema = JsonSchemaFactory.getInstance(anyOfClass) + val otherPathToSchemas = JsonSchema.validate(anyOfSchema, data.arg, data.validationMetadata) + validatedAnyOfClasses.add(anyOfClass) + pathToSchemas.update(otherPathToSchemas) + } catch (e: ValidationException) { + // silence exceptions because the code needs to accumulate anyof_classes + } + } + if (validatedAnyOfClasses.isEmpty()) { + throw ValidationException( + "Invalid inputs given to generate an instance of " + data.schema.javaClass.simpleName + ". None " + + "of the anyOf schemas matched the input data." + ) + } + return pathToSchemas + } +} \ No newline at end of file diff --git a/samples/client/3_1_0_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/schemas/validation/BigDecimalValidator.kt b/samples/client/3_1_0_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/schemas/validation/BigDecimalValidator.kt new file mode 100644 index 00000000000..7d9535004a2 --- /dev/null +++ b/samples/client/3_1_0_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/schemas/validation/BigDecimalValidator.kt @@ -0,0 +1,32 @@ +package org.openapijsonschematools.client.schemas.validation + +import org.openapijsonschematools.client.exceptions.ValidationException + +import java.math.BigDecimal + +abstract class BigDecimalValidator { + @Throws(ValidationException::class) + protected fun getBigDecimal(arg: Number): BigDecimal { + return when (arg) { + is Int -> { + BigDecimal(arg) + } + + is Long -> { + BigDecimal(arg) + } + + is Float -> { + BigDecimal(arg.toString()) + } + + is Double -> { + BigDecimal(arg.toString()) + } + + else -> { + throw ValidationException("Invalid type input for arg") + } + } + } +} diff --git a/samples/client/3_1_0_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/schemas/validation/BooleanEnumValidator.kt b/samples/client/3_1_0_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/schemas/validation/BooleanEnumValidator.kt new file mode 100644 index 00000000000..a6a943fd3b3 --- /dev/null +++ b/samples/client/3_1_0_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/schemas/validation/BooleanEnumValidator.kt @@ -0,0 +1,9 @@ +package org.openapijsonschematools.client.schemas.validation + +import org.openapijsonschematools.client.configurations.SchemaConfiguration +import org.openapijsonschematools.client.exceptions.ValidationException + +interface BooleanEnumValidator { + @Throws(ValidationException::class) + fun validate(arg: EnumType, configuration: SchemaConfiguration?): Boolean +} \ No newline at end of file diff --git a/samples/client/3_1_0_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/schemas/validation/BooleanSchemaValidator.kt b/samples/client/3_1_0_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/schemas/validation/BooleanSchemaValidator.kt new file mode 100644 index 00000000000..acdd61917b7 --- /dev/null +++ b/samples/client/3_1_0_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/schemas/validation/BooleanSchemaValidator.kt @@ -0,0 +1,12 @@ +package org.openapijsonschematools.client.schemas.validation + +import org.openapijsonschematools.client.configurations.SchemaConfiguration +import org.openapijsonschematools.client.exceptions.ValidationException + +interface BooleanSchemaValidator { + @Throws(ValidationException::class) + fun validate(arg: Boolean, configuration: SchemaConfiguration?): Boolean + + @Throws(ValidationException::class) + fun validateAndBox(arg: Boolean, configuration: SchemaConfiguration?): T +} \ No newline at end of file diff --git a/samples/client/3_1_0_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/schemas/validation/BooleanValueMethod.kt b/samples/client/3_1_0_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/schemas/validation/BooleanValueMethod.kt new file mode 100644 index 00000000000..1843f88eae3 --- /dev/null +++ b/samples/client/3_1_0_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/schemas/validation/BooleanValueMethod.kt @@ -0,0 +1,5 @@ +package org.openapijsonschematools.client.schemas.validation + +interface BooleanValueMethod { + fun value(): Boolean +} \ No newline at end of file diff --git a/samples/client/3_1_0_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/schemas/validation/ConstValidator.kt b/samples/client/3_1_0_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/schemas/validation/ConstValidator.kt new file mode 100644 index 00000000000..9ecd5a5534f --- /dev/null +++ b/samples/client/3_1_0_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/schemas/validation/ConstValidator.kt @@ -0,0 +1,31 @@ +package org.openapijsonschematools.client.schemas.validation + +import org.openapijsonschematools.client.exceptions.ValidationException + +import java.math.BigDecimal + +class ConstValidator : BigDecimalValidator(), KeywordValidator { + @Throws(ValidationException::class) + override fun validate( + data: ValidationData + ): PathToSchemasMap? { + if (!data.schema.constValueSet) { + return null + } + val constValue: Any? = data.schema.constValue + if (data.arg is Number) { + val castArg = getBigDecimal(data.arg) + if (castArg == constValue) { + return null + } + if (constValue is BigDecimal && constValue.compareTo(castArg) == 0) { + return null + } + } else { + if (data.arg == constValue) { + return null + } + } + throw ValidationException("Invalid value " + data.arg + " was not equal to const " + constValue) + } +} \ No newline at end of file diff --git a/samples/client/3_1_0_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/schemas/validation/ContainsValidator.kt b/samples/client/3_1_0_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/schemas/validation/ContainsValidator.kt new file mode 100644 index 00000000000..133e45944c0 --- /dev/null +++ b/samples/client/3_1_0_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/schemas/validation/ContainsValidator.kt @@ -0,0 +1,27 @@ +package org.openapijsonschematools.client.schemas.validation + +import org.openapijsonschematools.client.exceptions.ValidationException + +class ContainsValidator : KeywordValidator { + @Throws(ValidationException::class) + override fun validate( + data: ValidationData + ): PathToSchemasMap? { + if (data.arg !is List<*>) { + return null + } + val containsPathToSchemas: List? = data.containsPathToSchemas + if (containsPathToSchemas.isNullOrEmpty()) { + throw ValidationException( + "Validation failed for contains keyword in class=${data.schema.javaClass}" + + " at pathToItem=${data.validationMetadata.pathToItem}. No " + + "items validated to the contains schema." + ) + } + val pathToSchemas = PathToSchemasMap() + for (otherPathToSchema in containsPathToSchemas) { + pathToSchemas.update(otherPathToSchema) + } + return pathToSchemas + } +} \ No newline at end of file diff --git a/samples/client/3_1_0_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/schemas/validation/CustomIsoparser.kt b/samples/client/3_1_0_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/schemas/validation/CustomIsoparser.kt new file mode 100644 index 00000000000..65afa14827f --- /dev/null +++ b/samples/client/3_1_0_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/schemas/validation/CustomIsoparser.kt @@ -0,0 +1,16 @@ +package org.openapijsonschematools.client.schemas.validation + +import java.time.ZonedDateTime +import java.time.LocalDate + +class CustomIsoparser { + companion object { + fun parseIsodatetime(dateTime: String): ZonedDateTime { + return ZonedDateTime.parse(dateTime) + } + + fun parseIsodate(date: String): LocalDate { + return LocalDate.parse(date) + } + } +} \ No newline at end of file diff --git a/samples/client/3_1_0_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/schemas/validation/DefaultValueMethod.kt b/samples/client/3_1_0_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/schemas/validation/DefaultValueMethod.kt new file mode 100644 index 00000000000..7f8a8cbfddd --- /dev/null +++ b/samples/client/3_1_0_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/schemas/validation/DefaultValueMethod.kt @@ -0,0 +1,8 @@ +package org.openapijsonschematools.client.schemas.validation + +import org.openapijsonschematools.client.exceptions.ValidationException + +interface DefaultValueMethod { + @Throws(ValidationException::class) + fun defaultValue(): T +} \ No newline at end of file diff --git a/samples/client/3_1_0_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/schemas/validation/DependentRequiredValidator.kt b/samples/client/3_1_0_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/schemas/validation/DependentRequiredValidator.kt new file mode 100644 index 00000000000..d968b55d980 --- /dev/null +++ b/samples/client/3_1_0_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/schemas/validation/DependentRequiredValidator.kt @@ -0,0 +1,36 @@ +package org.openapijsonschematools.client.schemas.validation + +import org.openapijsonschematools.client.exceptions.ValidationException + +class DependentRequiredValidator : KeywordValidator { + @Throws(ValidationException::class) + override fun validate( + data: ValidationData + ): PathToSchemasMap? { + if (data.arg !is Map<*, *>) { + return null + } + val dependentRequired: Map> = data.schema.dependentRequired ?: return null + for ((key, value) in dependentRequired.entries) { + if (!data.arg.containsKey(key)) { + continue + } + val missingKeys: MutableSet = HashSet(value) + for (objKey in data.arg.keys) { + if (objKey is String) { + missingKeys.remove(objKey) + } + } + if (missingKeys.isEmpty()) { + continue + } + throw ValidationException(""" + |Validation failed for dependentRequired because these_keys=$missingKeys are + | missing at pathToItem=${data.validationMetadata.pathToItem} in class + | ${data.schema.javaClass} + """.trimMargin() + ) + } + return null + } +} \ No newline at end of file diff --git a/samples/client/3_1_0_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/schemas/validation/DependentSchemasValidator.kt b/samples/client/3_1_0_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/schemas/validation/DependentSchemasValidator.kt new file mode 100644 index 00000000000..889ede258bc --- /dev/null +++ b/samples/client/3_1_0_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/schemas/validation/DependentSchemasValidator.kt @@ -0,0 +1,31 @@ +package org.openapijsonschematools.client.schemas.validation + +import org.openapijsonschematools.client.exceptions.ValidationException + +class DependentSchemasValidator : KeywordValidator { + @Throws(ValidationException::class) + override fun validate( + data: ValidationData + ): PathToSchemasMap? { + if (data.arg !is Map<*, *>) { + return null + } + val dependentSchemas: Map>> = data.schema.dependentSchemas ?: return null + val pathToSchemas = PathToSchemasMap() + val presentProperties: MutableSet = LinkedHashSet() + for (key in data.arg.keys) { + if (key is String) { + presentProperties.add(key) + } + } + for ((propName, dependentSchemaClass) in dependentSchemas.entries) { + if (!presentProperties.contains(propName)) { + continue + } + val dependentSchema = JsonSchemaFactory.getInstance(dependentSchemaClass) + val otherPathToSchemas = JsonSchema.validate(dependentSchema, data.arg, data.validationMetadata) + pathToSchemas.update(otherPathToSchemas) + } + return pathToSchemas + } +} diff --git a/samples/client/3_1_0_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/schemas/validation/DoubleEnumValidator.kt b/samples/client/3_1_0_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/schemas/validation/DoubleEnumValidator.kt new file mode 100644 index 00000000000..d2f2abe26bb --- /dev/null +++ b/samples/client/3_1_0_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/schemas/validation/DoubleEnumValidator.kt @@ -0,0 +1,9 @@ +package org.openapijsonschematools.client.schemas.validation + +import org.openapijsonschematools.client.configurations.SchemaConfiguration +import org.openapijsonschematools.client.exceptions.ValidationException + +interface DoubleEnumValidator { + @Throws(ValidationException::class) + fun validate(arg: EnumType, configuration: SchemaConfiguration?): Double +} \ No newline at end of file diff --git a/samples/client/3_1_0_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/schemas/validation/DoubleValueMethod.kt b/samples/client/3_1_0_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/schemas/validation/DoubleValueMethod.kt new file mode 100644 index 00000000000..72223e0152a --- /dev/null +++ b/samples/client/3_1_0_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/schemas/validation/DoubleValueMethod.kt @@ -0,0 +1,5 @@ +package org.openapijsonschematools.client.schemas.validation + +interface DoubleValueMethod { + fun value(): Double +} \ No newline at end of file diff --git a/samples/client/3_1_0_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/schemas/validation/ElseValidator.kt b/samples/client/3_1_0_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/schemas/validation/ElseValidator.kt new file mode 100644 index 00000000000..9cf161f6255 --- /dev/null +++ b/samples/client/3_1_0_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/schemas/validation/ElseValidator.kt @@ -0,0 +1,25 @@ +package org.openapijsonschematools.client.schemas.validation + +import org.openapijsonschematools.client.exceptions.ValidationException + +class ElseValidator : KeywordValidator { + @Throws(ValidationException::class) + override fun validate( + data: ValidationData + ): PathToSchemasMap? { + val elseSchema: Class> = data.schema.elseSchema ?: return null + val ifPathToSchemas: PathToSchemasMap = data.ifPathToSchemas + ?: // if unset + return null + if (!ifPathToSchemas.isEmpty()) { + // if validation is true + return null + } + val elseSchemaInstance = JsonSchemaFactory.getInstance(elseSchema) + val pathToSchemas = PathToSchemasMap() + val elsePathToSchemas = JsonSchema.validate(elseSchemaInstance, data.arg, data.validationMetadata) + // todo capture validation error and describe it as an else error? + pathToSchemas.update(elsePathToSchemas) + return pathToSchemas + } +} \ No newline at end of file diff --git a/samples/client/3_1_0_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/schemas/validation/EnumValidator.kt b/samples/client/3_1_0_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/schemas/validation/EnumValidator.kt new file mode 100644 index 00000000000..f07075606ac --- /dev/null +++ b/samples/client/3_1_0_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/schemas/validation/EnumValidator.kt @@ -0,0 +1,39 @@ +package org.openapijsonschematools.client.schemas.validation + +import org.openapijsonschematools.client.exceptions.ValidationException + +import java.math.BigDecimal + +class EnumValidator : BigDecimalValidator(), KeywordValidator { + @Throws(ValidationException::class) + override fun validate( + data: ValidationData + ): PathToSchemasMap? { + val enumValues: Set = data.schema.enumValues ?: return null + if (enumValues.isEmpty()) { + throw ValidationException("No value can match enum because enum is empty") + } + if (data.arg is Number) { + val castArg = getBigDecimal(data.arg) + if (enumContainsArg(enumValues, castArg)) { + return null + } + for (enumValue in enumValues) { + if (enumValue is BigDecimal && enumValue.compareTo(castArg) == 0) { + return null + } + } + } else { + if (enumContainsArg(enumValues, data.arg)) { + return null + } + } + throw ValidationException("Invalid value " + data.arg + " was not one of the allowed enum " + enumValues) + } + + companion object { + private fun enumContainsArg(enumValues: Set, arg: Any?): Boolean { + return enumValues.contains(arg) + } + } +} \ No newline at end of file diff --git a/samples/client/3_1_0_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/schemas/validation/ExclusiveMaximumValidator.kt b/samples/client/3_1_0_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/schemas/validation/ExclusiveMaximumValidator.kt new file mode 100644 index 00000000000..5b55d46a38d --- /dev/null +++ b/samples/client/3_1_0_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/schemas/validation/ExclusiveMaximumValidator.kt @@ -0,0 +1,43 @@ +package org.openapijsonschematools.client.schemas.validation + +import org.openapijsonschematools.client.exceptions.ValidationException + +class ExclusiveMaximumValidator : KeywordValidator { + @Throws(ValidationException::class) + override fun validate( + data: ValidationData + ): PathToSchemasMap? { + val exclusiveMaximum: Number = data.schema.exclusiveMaximum ?: return null + if (data.arg !is Number) { + return null + } + val msg = + "Value " + data.arg + " is invalid because it is >= the exclusiveMaximum of " + exclusiveMaximum + when (data.arg) { + is Int -> { + if (data.arg.compareTo(exclusiveMaximum.toInt()) > -1) { + throw ValidationException(msg) + } + } + + is Long -> { + if (data.arg.compareTo(exclusiveMaximum.toLong()) > -1) { + throw ValidationException(msg) + } + } + + is Float -> { + if (data.arg.compareTo(exclusiveMaximum.toFloat()) > -1) { + throw ValidationException(msg) + } + } + + is Double -> { + if (data.arg.compareTo(exclusiveMaximum.toDouble()) > -1) { + throw ValidationException(msg) + } + } + } + return null + } +} diff --git a/samples/client/3_1_0_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/schemas/validation/ExclusiveMinimumValidator.kt b/samples/client/3_1_0_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/schemas/validation/ExclusiveMinimumValidator.kt new file mode 100644 index 00000000000..e19f44defe9 --- /dev/null +++ b/samples/client/3_1_0_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/schemas/validation/ExclusiveMinimumValidator.kt @@ -0,0 +1,43 @@ +package org.openapijsonschematools.client.schemas.validation + +import org.openapijsonschematools.client.exceptions.ValidationException + +class ExclusiveMinimumValidator : KeywordValidator { + @Throws(ValidationException::class) + override fun validate( + data: ValidationData + ): PathToSchemasMap? { + val exclusiveMinimum: Number = data.schema.exclusiveMinimum ?: return null + if (data.arg !is Number) { + return null + } + val msg = + "Value " + data.arg + " is invalid because it is <= the exclusiveMinimum of " + exclusiveMinimum + when (data.arg) { + is Int -> { + if (data.arg.compareTo(exclusiveMinimum.toInt()) < 1) { + throw ValidationException(msg) + } + } + + is Long -> { + if (data.arg.compareTo(exclusiveMinimum.toLong()) < 1) { + throw ValidationException(msg) + } + } + + is Float -> { + if (data.arg.compareTo(exclusiveMinimum.toFloat()) < 1) { + throw ValidationException(msg) + } + } + + is Double -> { + if (data.arg.compareTo(exclusiveMinimum.toDouble()) < 1) { + throw ValidationException(msg) + } + } + } + return null + } +} diff --git a/samples/client/3_1_0_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/schemas/validation/FloatEnumValidator.kt b/samples/client/3_1_0_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/schemas/validation/FloatEnumValidator.kt new file mode 100644 index 00000000000..9603f2a6468 --- /dev/null +++ b/samples/client/3_1_0_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/schemas/validation/FloatEnumValidator.kt @@ -0,0 +1,9 @@ +package org.openapijsonschematools.client.schemas.validation + +import org.openapijsonschematools.client.configurations.SchemaConfiguration +import org.openapijsonschematools.client.exceptions.ValidationException + +interface FloatEnumValidator { + @Throws(ValidationException::class) + fun validate(arg: EnumType, configuration: SchemaConfiguration?): Float +} \ No newline at end of file diff --git a/samples/client/3_1_0_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/schemas/validation/FloatValueMethod.kt b/samples/client/3_1_0_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/schemas/validation/FloatValueMethod.kt new file mode 100644 index 00000000000..23a2817fc0e --- /dev/null +++ b/samples/client/3_1_0_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/schemas/validation/FloatValueMethod.kt @@ -0,0 +1,5 @@ +package org.openapijsonschematools.client.schemas.validation + +interface FloatValueMethod { + fun value(): Float +} \ No newline at end of file diff --git a/samples/client/3_1_0_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/schemas/validation/FormatValidator.kt b/samples/client/3_1_0_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/schemas/validation/FormatValidator.kt new file mode 100644 index 00000000000..47673b8c868 --- /dev/null +++ b/samples/client/3_1_0_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/schemas/validation/FormatValidator.kt @@ -0,0 +1,168 @@ +package org.openapijsonschematools.client.schemas.validation + +import org.openapijsonschematools.client.exceptions.ValidationException +import java.math.BigDecimal +import java.math.BigInteger +import java.time.format.DateTimeParseException +import java.util.UUID +import kotlin.math.floor + +class FormatValidator : KeywordValidator { + @Throws(ValidationException::class) + override fun validate( + data: ValidationData + ): PathToSchemasMap? { + val format: String = data.schema.format ?: return null + if (data.arg is Number) { + validateNumericFormat( + data.arg, + data.validationMetadata, + format + ) + return null + } else if (data.arg is String) { + validateStringFormat( + data.arg, + data.validationMetadata, + format + ) + return null + } + return null + } + + companion object { + private val int32InclusiveMinimum = BigInteger.valueOf(-2147483648L) + private val int32InclusiveMaximum = BigInteger.valueOf(2147483647L) + private val int64InclusiveMinimum = BigInteger.valueOf(Long.MIN_VALUE) + private val int64InclusiveMaximum = BigInteger.valueOf(Long.MAX_VALUE) + private val floatInclusiveMinimum = BigDecimal.valueOf(-3.4028234663852886e+38) + private val floatInclusiveMaximum = BigDecimal.valueOf(3.4028234663852886e+38) + private val doubleInclusiveMinimum = BigDecimal.valueOf(-1.7976931348623157E+308) + private val doubleInclusiveMaximum = BigDecimal.valueOf(1.7976931348623157E+308) + @Throws(ValidationException::class) + private fun validateNumericFormat(arg: Number, validationMetadata: ValidationMetadata, format: String) { + if (format.startsWith("int")) { + // there is a json schema test where 1.0 validates as an integer + val intArg: BigInteger + when (arg) { + is Float, is Double -> { + val doubleArg: Double = (arg as? Float)?.toDouble() ?: arg as Double + if (floor(doubleArg) != doubleArg) { + throw ValidationException( + "Invalid non-integer value " + arg + " for format " + format + " at " + validationMetadata.pathToItem + ) + } + intArg = if (arg is Float) { + val smallInt = Math.round(arg) + BigInteger.valueOf(smallInt.toLong()) + } else { + BigInteger.valueOf(Math.round((arg as Double))) + } + } + + is Int -> { + intArg = BigInteger.valueOf(arg.toLong()) + } + + is Long -> { + intArg = BigInteger.valueOf(arg) + } + + else -> { + intArg = arg as BigInteger + } + } + if (format == "int32") { + if (intArg.compareTo(int32InclusiveMinimum) < 0 || intArg.compareTo(int32InclusiveMaximum) > 0) { + throw ValidationException( + "Invalid value " + arg + " for format int32 at " + validationMetadata.pathToItem + ) + } + } else if (format == "int64") { + if (intArg.compareTo(int64InclusiveMinimum) < 0 || intArg.compareTo(int64InclusiveMaximum) > 0) { + throw ValidationException( + "Invalid value " + arg + " for format int64 at " + validationMetadata.pathToItem + ) + } + } + } else if (format == "float" || format == "double") { + val decimalArg: BigDecimal = when (arg) { + is Float -> { + BigDecimal.valueOf(arg.toDouble()) + } + + is Double -> { + BigDecimal.valueOf(arg) + } + + else -> { + arg as BigDecimal + } + } + if (format == "float") { + if (decimalArg.compareTo(floatInclusiveMinimum) < 0 || decimalArg.compareTo(floatInclusiveMaximum) > 0) { + throw ValidationException( + "Invalid value " + arg + " for format float at " + validationMetadata.pathToItem + ) + } + } else { + if (decimalArg.compareTo(doubleInclusiveMinimum) < 0 || decimalArg.compareTo(doubleInclusiveMaximum) > 0) { + throw ValidationException( + "Invalid value " + arg + " for format double at " + validationMetadata.pathToItem + ) + } + } + } + } + + @Throws(ValidationException::class) + private fun validateStringFormat(arg: String, validationMetadata: ValidationMetadata, format: String) { + when (format) { + "uuid" -> { + try { + UUID.fromString(arg) + } catch (e: IllegalArgumentException) { + throw ValidationException( + "Value cannot be converted to a UUID. Invalid value " + + arg + " for format uuid at " + validationMetadata.pathToItem + ) + } + } + + "number" -> { + try { + BigDecimal(arg) + } catch (e: NumberFormatException) { + throw ValidationException( + "Value cannot be converted to a decimal. Invalid value " + + arg + " for format number at " + validationMetadata.pathToItem + ) + } + } + + "date" -> { + try { + CustomIsoparser.parseIsodate(arg) + } catch (e: DateTimeParseException) { + throw ValidationException( + "Value does not conform to the required ISO-8601 date format. " + + "Invalid value " + arg + " for format date at " + validationMetadata.pathToItem + ) + } + } + + "date-time" -> { + try { + CustomIsoparser.parseIsodatetime(arg) + } catch (e: DateTimeParseException) { + throw ValidationException( + "Value does not conform to the required ISO-8601 datetime format. " + + "Invalid value " + arg + " for format datetime at " + validationMetadata.pathToItem + ) + } + } + } + } + } +} \ No newline at end of file diff --git a/samples/client/3_1_0_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/schemas/validation/FrozenList.kt b/samples/client/3_1_0_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/schemas/validation/FrozenList.kt new file mode 100644 index 00000000000..94451c44c38 --- /dev/null +++ b/samples/client/3_1_0_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/schemas/validation/FrozenList.kt @@ -0,0 +1,22 @@ +package org.openapijsonschematools.client.schemas.validation + +open class FrozenList(m: Collection) : AbstractList() { + /* + A frozen List + Once schema validation has been run, indexed access returns values of the correct type + If values were mutable, the types in those methods would not agree with returned values + */ + private val list: List + + init { + list = ArrayList(m) + } + + override val size: Int + get() = list.size + + override fun get(index: Int): E { + return list[index] + } +} + diff --git a/samples/client/3_1_0_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/schemas/validation/FrozenMap.kt b/samples/client/3_1_0_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/schemas/validation/FrozenMap.kt new file mode 100644 index 00000000000..cce76fb8bad --- /dev/null +++ b/samples/client/3_1_0_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/schemas/validation/FrozenMap.kt @@ -0,0 +1,44 @@ +package org.openapijsonschematools.client.schemas.validation + +import org.openapijsonschematools.client.exceptions.UnsetPropertyException +import org.openapijsonschematools.client.exceptions.InvalidAdditionalPropertyException + +open class FrozenMap(m: Map) : AbstractMap() { + /* + A frozen Map + Once schema validation has been run, written accessor methods return values of the correct type + If values were mutable, the types in those methods would not agree with returned values + */ + private val map: Map + + init { + map = HashMap(m) + } + + @Throws(UnsetPropertyException::class) + protected fun getOrThrow(key: String): V? { + if (containsKey(key)) { + return get(key) + } + throw UnsetPropertyException("$key is unset") + } + + @Throws(UnsetPropertyException::class) + protected fun throwIfKeyNotPresent(key: String) { + if (!containsKey(key)) { + throw UnsetPropertyException("$key is unset") + } + } + + @Throws(InvalidAdditionalPropertyException::class) + protected fun throwIfKeyKnown(key: String, requiredKeys: Set, optionalKeys: Set) { + val knownKeys: MutableSet = HashSet() + knownKeys.addAll(requiredKeys) + knownKeys.addAll(optionalKeys) + MapUtils.throwIfKeyKnown(key, knownKeys, false) + } + + override val entries: Set> + get() = map.entries +} + diff --git a/samples/client/3_1_0_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/schemas/validation/IfValidator.kt b/samples/client/3_1_0_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/schemas/validation/IfValidator.kt new file mode 100644 index 00000000000..2a55d6b3528 --- /dev/null +++ b/samples/client/3_1_0_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/schemas/validation/IfValidator.kt @@ -0,0 +1,26 @@ +package org.openapijsonschematools.client.schemas.validation + +import org.openapijsonschematools.client.exceptions.ValidationException + +class IfValidator : KeywordValidator { + @Throws(ValidationException::class) + override fun validate( + data: ValidationData + ): PathToSchemasMap? { + if (data.schema.ifSchema == null) { + return null + } + if (data.ifPathToSchemas == null) { + throw ValidationException("Invalid type for ifPathToSchemas") + } + /* + if is false use case + ifPathToSchemas == {} + no need to add any data to pathToSchemas + + if true, then true -> true for whole schema + so validate_then will add ifPathToSchemas data to pathToSchemas + */ + return null + } +} \ No newline at end of file diff --git a/samples/client/3_1_0_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/schemas/validation/IntegerEnumValidator.kt b/samples/client/3_1_0_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/schemas/validation/IntegerEnumValidator.kt new file mode 100644 index 00000000000..210f0e4dea7 --- /dev/null +++ b/samples/client/3_1_0_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/schemas/validation/IntegerEnumValidator.kt @@ -0,0 +1,9 @@ +package org.openapijsonschematools.client.schemas.validation + +import org.openapijsonschematools.client.configurations.SchemaConfiguration +import org.openapijsonschematools.client.exceptions.ValidationException + +interface IntegerEnumValidator { + @Throws(ValidationException::class) + fun validate(arg: EnumType, configuration: SchemaConfiguration?): Int +} \ No newline at end of file diff --git a/samples/client/3_1_0_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/schemas/validation/IntegerValueMethod.kt b/samples/client/3_1_0_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/schemas/validation/IntegerValueMethod.kt new file mode 100644 index 00000000000..84961e6aa44 --- /dev/null +++ b/samples/client/3_1_0_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/schemas/validation/IntegerValueMethod.kt @@ -0,0 +1,5 @@ +package org.openapijsonschematools.client.schemas.validation + +interface IntegerValueMethod { + fun value(): Int +} \ No newline at end of file diff --git a/samples/client/3_1_0_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/schemas/validation/ItemsValidator.kt b/samples/client/3_1_0_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/schemas/validation/ItemsValidator.kt new file mode 100644 index 00000000000..b4f7e9b9a77 --- /dev/null +++ b/samples/client/3_1_0_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/schemas/validation/ItemsValidator.kt @@ -0,0 +1,38 @@ +package org.openapijsonschematools.client.schemas.validation + +import org.openapijsonschematools.client.exceptions.ValidationException + +class ItemsValidator : KeywordValidator { + @Throws(ValidationException::class) + override fun validate( + data: ValidationData + ): PathToSchemasMap? { + val items: Class> = data.schema.items ?: return null + if (data.arg !is List<*>) { + return null + } + if (data.arg.isEmpty()) { + return null + } + val pathToSchemas = PathToSchemasMap() + val minIndex = if (data.schema.prefixItems != null) data.schema.prefixItems.size else 0 + val itemsSchema = JsonSchemaFactory.getInstance(items) + for (i in minIndex until data.arg.size) { + val itemPathToItem: MutableList = ArrayList(data.validationMetadata.pathToItem) + itemPathToItem.add(i) + val itemValidationMetadata = ValidationMetadata( + itemPathToItem, + data.validationMetadata.configuration, + data.validationMetadata.validatedPathToSchemas, + data.validationMetadata.seenClasses + ) + if (itemValidationMetadata.validationRanEarlier(itemsSchema)) { + // todo add_deeper_validated_schemas + continue + } + val otherPathToSchemas = JsonSchema.validate(itemsSchema, data.arg[i], itemValidationMetadata) + pathToSchemas.update(otherPathToSchemas) + } + return pathToSchemas + } +} diff --git a/samples/client/3_1_0_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/schemas/validation/JsonSchema.kt b/samples/client/3_1_0_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/schemas/validation/JsonSchema.kt new file mode 100644 index 00000000000..a4e79ca4c1a --- /dev/null +++ b/samples/client/3_1_0_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/schemas/validation/JsonSchema.kt @@ -0,0 +1,512 @@ +package org.openapijsonschematools.client.schemas.validation + +import org.openapijsonschematools.client.configurations.SchemaConfiguration +import org.openapijsonschematools.client.exceptions.ValidationException + +import java.math.BigDecimal +import java.time.LocalDate +import java.time.ZonedDateTime +import java.util.regex.Pattern +import java.util.UUID + +abstract class JsonSchema protected constructor(jsonSchemaInfo: JsonSchemaInfo) { + val type: Set>? + val format: String? + val items: Class>? + val properties: Map>>? + val required: Set? + val exclusiveMaximum: Number? + val exclusiveMinimum: Number? + val maxItems: Int? + val minItems: Int? + val maxLength: Int? + val minLength: Int? + val maxProperties: Int? + val minProperties: Int? + val maximum: Number? + val minimum: Number? + val multipleOf: BigDecimal? + val additionalProperties: Class>? + val allOf: List>>? + val anyOf: List>>? + val oneOf: List>>? + val not: Class>? + val uniqueItems: Boolean? + val enumValues: Set? + val pattern: Pattern? + val defaultValue: Any? + val defaultValueSet: Boolean + val constValue: Any? + val constValueSet: Boolean + val contains: Class>? + val maxContains: Int? + val minContains: Int? + val propertyNames: Class>? + val dependentRequired: Map>? + val dependentSchemas: Map>>? + val patternProperties: Map>>? + val prefixItems: List>>? + val ifSchema: Class>? + val then: Class>? + val elseSchema: Class>? + val unevaluatedItems: Class>? + val unevaluatedProperties: Class>? + private val keywordToValidator: LinkedHashMap + + init { + val keywordToValidator = LinkedHashMap() + type = jsonSchemaInfo.type + if (type != null) { + keywordToValidator["type"] = TypeValidator() + } + format = jsonSchemaInfo.format + if (format != null) { + keywordToValidator["format"] = FormatValidator() + } + items = jsonSchemaInfo.items + if (items != null) { + keywordToValidator["items"] = ItemsValidator() + } + properties = jsonSchemaInfo.properties + if (properties != null) { + keywordToValidator["properties"] = PropertiesValidator() + } + required = jsonSchemaInfo.required + if (required != null) { + keywordToValidator["required"] = RequiredValidator() + } + exclusiveMaximum = jsonSchemaInfo.exclusiveMaximum + if (exclusiveMaximum != null) { + keywordToValidator["exclusiveMaximum"] = ExclusiveMaximumValidator() + } + exclusiveMinimum = jsonSchemaInfo.exclusiveMinimum + if (exclusiveMinimum != null) { + keywordToValidator["exclusiveMinimum"] = ExclusiveMinimumValidator() + } + maxItems = jsonSchemaInfo.maxItems + if (maxItems != null) { + keywordToValidator["maxItems"] = MaxItemsValidator() + } + minItems = jsonSchemaInfo.minItems + if (minItems != null) { + keywordToValidator["minItems"] = MinItemsValidator() + } + maxLength = jsonSchemaInfo.maxLength + if (maxLength != null) { + keywordToValidator["maxLength"] = MaxLengthValidator() + } + minLength = jsonSchemaInfo.minLength + if (minLength != null) { + keywordToValidator["minLength"] = MinLengthValidator() + } + maxProperties = jsonSchemaInfo.maxProperties + if (maxProperties != null) { + keywordToValidator["maxProperties"] = MaxPropertiesValidator() + } + minProperties = jsonSchemaInfo.minProperties + if (minProperties != null) { + keywordToValidator["minProperties"] = MinPropertiesValidator() + } + maximum = jsonSchemaInfo.maximum + if (maximum != null) { + keywordToValidator["maximum"] = MaximumValidator() + } + minimum = jsonSchemaInfo.minimum + if (minimum != null) { + keywordToValidator["minimum"] = MinimumValidator() + } + multipleOf = jsonSchemaInfo.multipleOf + if (multipleOf != null) { + keywordToValidator["multipleOf"] = MultipleOfValidator() + } + additionalProperties = jsonSchemaInfo.additionalProperties + if (additionalProperties != null) { + keywordToValidator["additionalProperties"] = AdditionalPropertiesValidator() + } + allOf = jsonSchemaInfo.allOf + if (allOf != null) { + keywordToValidator["allOf"] = AllOfValidator() + } + anyOf = jsonSchemaInfo.anyOf + if (anyOf != null) { + keywordToValidator["anyOf"] = AnyOfValidator() + } + oneOf = jsonSchemaInfo.oneOf + if (oneOf != null) { + keywordToValidator["oneOf"] = OneOfValidator() + } + not = jsonSchemaInfo.not + if (not != null) { + keywordToValidator["not"] = NotValidator() + } + uniqueItems = jsonSchemaInfo.uniqueItems + if (uniqueItems != null) { + keywordToValidator["uniqueItems"] = UniqueItemsValidator() + } + enumValues = jsonSchemaInfo.enumValues + if (enumValues != null) { + keywordToValidator["enum"] = EnumValidator() + } + pattern = jsonSchemaInfo.pattern + if (pattern != null) { + keywordToValidator["pattern"] = PatternValidator() + } + defaultValue = jsonSchemaInfo.defaultValue + defaultValueSet = jsonSchemaInfo.defaultValueSet + constValue = jsonSchemaInfo.constValue + constValueSet = jsonSchemaInfo.constValueSet + if (constValueSet) { + keywordToValidator["const"] = ConstValidator() + } + contains = jsonSchemaInfo.contains + if (contains != null) { + keywordToValidator["contains"] = ContainsValidator() + } + maxContains = jsonSchemaInfo.maxContains + if (maxContains != null) { + keywordToValidator["maxContains"] = MaxContainsValidator() + } + minContains = jsonSchemaInfo.minContains + if (minContains != null) { + keywordToValidator["minContains"] = MinContainsValidator() + } + propertyNames = jsonSchemaInfo.propertyNames + if (propertyNames != null) { + keywordToValidator["propertyNames"] = PropertyNamesValidator() + } + dependentRequired = jsonSchemaInfo.dependentRequired + if (dependentRequired != null) { + keywordToValidator["dependentRequired"] = DependentRequiredValidator() + } + dependentSchemas = jsonSchemaInfo.dependentSchemas + if (dependentSchemas != null) { + keywordToValidator["dependentSchemas"] = DependentSchemasValidator() + } + patternProperties = jsonSchemaInfo.patternProperties + if (patternProperties != null) { + keywordToValidator["patternProperties"] = PatternPropertiesValidator() + } + prefixItems = jsonSchemaInfo.prefixItems + if (prefixItems != null) { + keywordToValidator["prefixItems"] = PrefixItemsValidator() + } + ifSchema = jsonSchemaInfo.ifSchema + if (ifSchema != null) { + keywordToValidator["if"] = IfValidator() + } + then = jsonSchemaInfo.then + if (then != null) { + keywordToValidator["then"] = ThenValidator() + } + elseSchema = jsonSchemaInfo.elseSchema + if (elseSchema != null) { + keywordToValidator["else"] = ElseValidator() + } + unevaluatedItems = jsonSchemaInfo.unevaluatedItems + if (unevaluatedItems != null) { + keywordToValidator["unevaluatedItems"] = UnevaluatedItemsValidator() + } + unevaluatedProperties = jsonSchemaInfo.unevaluatedProperties + if (unevaluatedProperties != null) { + keywordToValidator["unevaluatedProperties"] = UnevaluatedPropertiesValidator() + } + this.keywordToValidator = keywordToValidator + } + + abstract fun getNewInstance(arg: Any?, pathToItem: List, pathToSchemas: PathToSchemasMap): Any? + @Throws(ValidationException::class) + abstract fun validate(arg: Any?, configuration: SchemaConfiguration?): Any? + @Throws(ValidationException::class) + abstract fun validateAndBox(arg: Any?, configuration: SchemaConfiguration?): T + private fun getContainsPathToSchemas( + arg: Any?, + validationMetadata: ValidationMetadata + ): List { + if (arg !is List<*> || contains == null) { + return ArrayList() + } + val containsSchema: JsonSchema<*> = JsonSchemaFactory.getInstance(contains) + val containsPathToSchemas: MutableList = ArrayList() + for (i in arg.indices) { + val thesePathToSchemas = PathToSchemasMap() + val itemPathToItem: List = validationMetadata.pathToItem + i + val itemValidationMetadata = ValidationMetadata( + itemPathToItem, + validationMetadata.configuration, + validationMetadata.validatedPathToSchemas, + validationMetadata.seenClasses + ) + if (itemValidationMetadata.validationRanEarlier(containsSchema)) { + // todo add_deeper_validated_schemas + containsPathToSchemas.add(thesePathToSchemas) + continue + } + try { + val otherPathToSchemas = validate( + containsSchema, arg[i], itemValidationMetadata + ) + containsPathToSchemas.add(otherPathToSchemas) + } catch (ignored: ValidationException) { + } + } + return containsPathToSchemas + } + + @Throws(ValidationException::class) + private fun getPatternPropertiesPathToSchemas( + arg: Any?, + validationMetadata: ValidationMetadata + ): PathToSchemasMap { + if (arg !is Map<*, *> || patternProperties == null) { + return PathToSchemasMap() + } + val pathToSchemas = PathToSchemasMap() + for ((key, value) in arg) { + val entryKey = key!! as? String + ?: throw ValidationException("Invalid non-string type for map key") + val propPathToItem: List = validationMetadata.pathToItem + entryKey + val propValidationMetadata = ValidationMetadata( + propPathToItem, + validationMetadata.configuration, + validationMetadata.validatedPathToSchemas, + validationMetadata.seenClasses + ) + for ((key1, patternPropClass) in patternProperties) { + if (!key1.matcher(entryKey).find()) { + continue + } + val patternPropSchema: JsonSchema<*> = JsonSchemaFactory.getInstance(patternPropClass) + val otherPathToSchemas = validate(patternPropSchema, value, propValidationMetadata) + pathToSchemas.update(otherPathToSchemas) + } + } + return pathToSchemas + } + + private fun getIfPathToSchemas( + arg: Any?, + validationMetadata: ValidationMetadata + ): PathToSchemasMap { + if (ifSchema == null) { + return PathToSchemasMap() + } + val ifSchemaInstance: JsonSchema<*> = JsonSchemaFactory.getInstance(ifSchema) + val pathToSchemas = PathToSchemasMap() + try { + val otherPathToSchemas = validate(ifSchemaInstance, arg, validationMetadata) + pathToSchemas.update(otherPathToSchemas) + } catch (ignored: ValidationException) { + } + return pathToSchemas + } + + protected fun castToAllowedTypes(arg: String, pathToItem: List, pathSet: MutableSet>): String { + pathSet.add(pathToItem) + return arg + } + + protected fun castToAllowedTypes(arg: Boolean, pathToItem: List, pathSet: MutableSet>): Boolean { + pathSet.add(pathToItem) + return arg + } + + protected fun castToAllowedTypes(arg: Number, pathToItem: List, pathSet: MutableSet>): Number { + pathSet.add(pathToItem) + return arg + } + + protected fun castToAllowedTypes(arg: Nothing?, pathToItem: List, pathSet: MutableSet>): Nothing? { + pathSet.add(pathToItem) + return arg + } + + @Throws(ValidationException::class) + protected fun castToAllowedTypes(arg: List<*>, pathToItem: List, pathSet: MutableSet>): List<*> { + pathSet.add(pathToItem) + val argFixed: MutableList = ArrayList() + var i = 0 + for (item in arg) { + val newPathToItem: List = pathToItem + i + val fixedVal = castToAllowedObjectTypes(item, newPathToItem, pathSet) + argFixed.add(fixedVal) + i += 1 + } + return argFixed + } + + @Throws(ValidationException::class) + protected fun castToAllowedTypes( + arg: Map<*, *>, + pathToItem: List, + pathSet: MutableSet> + ): Map<*, *> { + pathSet.add(pathToItem) + val argFixed = LinkedHashMap() + for ((entryKey, value) in arg) { + if (entryKey !is String) { + throw ValidationException("Invalid non-string key value") + } + val newPathToItem: List = pathToItem + entryKey + val fixedVal = castToAllowedObjectTypes(value, newPathToItem, pathSet) + argFixed[entryKey] = fixedVal + } + return argFixed + } + + @Throws(ValidationException::class) + private fun castToAllowedObjectTypes(arg: Any?, pathToItem: List, pathSet: MutableSet>): Any? { + return when (arg) { + null -> { + castToAllowedTypes(null, pathToItem, pathSet) + } + is String -> { + castToAllowedTypes(arg, pathToItem, pathSet) + } + + is Map<*, *> -> { + pathSet.add(pathToItem) + castToAllowedTypes(arg, pathToItem, pathSet) + } + + is Boolean -> { + castToAllowedTypes(arg, pathToItem, pathSet) + } + + is Number -> { + castToAllowedTypes(arg, pathToItem, pathSet) + } + + is List<*> -> { + castToAllowedTypes(arg, pathToItem, pathSet) + } + + is ZonedDateTime -> { + castToAllowedTypes(arg.toString(), pathToItem, pathSet) + } + + is LocalDate -> { + castToAllowedTypes(arg.toString(), pathToItem, pathSet) + } + + is UUID -> { + castToAllowedTypes(arg.toString(), pathToItem, pathSet) + } + + else -> { + val argClass = arg.javaClass + throw ValidationException("Invalid type passed in for input=$arg type=$argClass") + } + } + } + + protected fun getNewInstance(arg: Nothing?, pathToItem: List, pathToSchemas: PathToSchemasMap): Nothing? { + return arg + } + + protected fun getNewInstance(arg: Boolean, pathToItem: List, pathToSchemas: PathToSchemasMap): Boolean { + return arg + } + + protected fun getNewInstance(arg: Number, pathToItem: List, pathToSchemas: PathToSchemasMap): Number { + return arg + } + + protected fun getNewInstance(arg: String, pathToItem: List, pathToSchemas: PathToSchemasMap): String { + return arg + } + + companion object { + @Throws(ValidationException::class) + fun validate( + jsonSchema: JsonSchema<*>, + arg: Any?, + validationMetadata: ValidationMetadata + ): PathToSchemasMap { + val disabledKeywords: LinkedHashSet = + validationMetadata.configuration.disabledKeywordFlags.keywords + val pathToSchemas = PathToSchemasMap() + val thisKeywordToValidator = jsonSchema.keywordToValidator + var containsPathToSchemas: List? = null + if (thisKeywordToValidator.containsKey("contains")) { + containsPathToSchemas = jsonSchema.getContainsPathToSchemas(arg, validationMetadata) + } + var patternPropertiesPathToSchemas: PathToSchemasMap? = null + if (thisKeywordToValidator.containsKey("patternProperties")) { + patternPropertiesPathToSchemas = jsonSchema.getPatternPropertiesPathToSchemas(arg, validationMetadata) + } + var ifPathToSchemas: PathToSchemasMap? = null + if (thisKeywordToValidator.containsKey("if")) { + ifPathToSchemas = jsonSchema.getIfPathToSchemas(arg, validationMetadata) + } + var knownPathToSchemas: PathToSchemasMap? = null + for ((jsonKeyword, validator) in thisKeywordToValidator) { + if (disabledKeywords.contains(jsonKeyword)) { + val typeIntegerUseCase = jsonKeyword == "format" && "int" == jsonSchema.format + if (!typeIntegerUseCase) { + continue + } + } + if ("unevaluatedItems" == jsonKeyword || "unevaluatedProperties" == jsonKeyword) { + knownPathToSchemas = pathToSchemas + } + val data = ValidationData( + jsonSchema, + arg, + validationMetadata, + containsPathToSchemas, + patternPropertiesPathToSchemas, + ifPathToSchemas, + knownPathToSchemas + ) + val otherPathToSchemas = validator.validate(data) ?: continue + pathToSchemas.update(otherPathToSchemas) + } + val pathToItem: List = validationMetadata.pathToItem + if (!pathToSchemas.containsKey(pathToItem)) { + pathToSchemas[validationMetadata.pathToItem] = LinkedHashMap() + } + val schemas: LinkedHashMap, Nothing?>? = pathToSchemas[pathToItem] + if (schemas != null) { + schemas[jsonSchema] = null + } + return pathToSchemas + } + + @JvmStatic + @Throws(ValidationException::class) + protected fun getPathToSchemas( + jsonSchema: JsonSchema<*>, + arg: Any?, + validationMetadata: ValidationMetadata, + pathSet: Set> + ): PathToSchemasMap { + val pathToSchemasMap = PathToSchemasMap() + // todo add check of validationMetadata.validationRanEarlier(this) + val otherPathToSchemas = validate(jsonSchema, arg, validationMetadata) + pathToSchemasMap.update(otherPathToSchemas) + for (schemas in pathToSchemasMap.values) { + val firstSchema: JsonSchema<*> = schemas.entries.iterator().next().key + schemas.clear() + schemas[firstSchema] = null + } + val mutPathSet: MutableSet> = pathSet.toMutableSet() + mutPathSet.removeAll(pathToSchemasMap.keys) + if (mutPathSet.isNotEmpty()) { + val unsetAnyTypeSchema = LinkedHashMap, Nothing?>() + unsetAnyTypeSchema[UnsetAnyTypeJsonSchema.UnsetAnyTypeJsonSchema1.getInstance()] = null + for (pathToItem in mutPathSet) { + pathToSchemasMap[pathToItem] = unsetAnyTypeSchema + } + } + return pathToSchemasMap + } + + fun getClass(arg: Any?): String { + return if (arg == null) { + Void::class.java.getSimpleName() + } else { + arg.javaClass.getSimpleName() + } + } // todo add bytes and FileIO + } +} \ No newline at end of file diff --git a/samples/client/3_1_0_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/schemas/validation/JsonSchemaFactory.kt b/samples/client/3_1_0_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/schemas/validation/JsonSchemaFactory.kt new file mode 100644 index 00000000000..3de64242080 --- /dev/null +++ b/samples/client/3_1_0_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/schemas/validation/JsonSchemaFactory.kt @@ -0,0 +1,30 @@ +package org.openapijsonschematools.client.schemas.validation + +import java.lang.reflect.InvocationTargetException + +object JsonSchemaFactory { + private var classToInstance: MutableMap>, JsonSchema<*>> = HashMap() + + fun > getInstance(schemaCls: Class): V { + val cacheInst: JsonSchema<*>? = classToInstance[schemaCls] + cacheInst?.let { + assert(schemaCls.isInstance(it)) + return schemaCls.cast(it) + } + try { + val companion = schemaCls.declaredClasses[0] + val method = companion.getMethod("getInstance") + val obj = method.invoke(companion.kotlin.objectInstance) + assert(schemaCls.isInstance(obj)) + val inst = schemaCls.cast(obj) + classToInstance[schemaCls] = inst + return inst + } catch (e: NoSuchMethodException) { + throw RuntimeException(e) + } catch (e: IllegalAccessException) { + throw RuntimeException(e) + } catch (e: InvocationTargetException) { + throw RuntimeException(e) + } + } +} \ No newline at end of file diff --git a/samples/client/3_1_0_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/schemas/validation/JsonSchemaInfo.kt b/samples/client/3_1_0_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/schemas/validation/JsonSchemaInfo.kt new file mode 100644 index 00000000000..b36f28c46a4 --- /dev/null +++ b/samples/client/3_1_0_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/schemas/validation/JsonSchemaInfo.kt @@ -0,0 +1,244 @@ +package org.openapijsonschematools.client.schemas.validation + +import java.math.BigDecimal +import java.util.regex.Pattern + +class JsonSchemaInfo { + var type: Set>? = null + fun type(type: Set>): JsonSchemaInfo { + this.type = type + return this + } + + var format: String? = null + fun format(format: String): JsonSchemaInfo { + this.format = format + return this + } + + var items: Class>? = null + fun items(items: Class>): JsonSchemaInfo { + this.items = items + return this + } + + var properties: Map>>? = null + fun properties(properties: Map>>): JsonSchemaInfo { + this.properties = properties + return this + } + + var required: Set? = null + fun required(required: Set): JsonSchemaInfo { + this.required = required + return this + } + + var exclusiveMaximum: Number? = null + fun exclusiveMaximum(exclusiveMaximum: Number): JsonSchemaInfo { + this.exclusiveMaximum = exclusiveMaximum + return this + } + + var exclusiveMinimum: Number? = null + fun exclusiveMinimum(exclusiveMinimum: Number): JsonSchemaInfo { + this.exclusiveMinimum = exclusiveMinimum + return this + } + + var maxItems: Int? = null + fun maxItems(maxItems: Int): JsonSchemaInfo { + this.maxItems = maxItems + return this + } + + var minItems: Int? = null + fun minItems(minItems: Int): JsonSchemaInfo { + this.minItems = minItems + return this + } + + var maxLength: Int? = null + fun maxLength(maxLength: Int): JsonSchemaInfo { + this.maxLength = maxLength + return this + } + + var minLength: Int? = null + fun minLength(minLength: Int): JsonSchemaInfo { + this.minLength = minLength + return this + } + + var maxProperties: Int? = null + fun maxProperties(maxProperties: Int): JsonSchemaInfo { + this.maxProperties = maxProperties + return this + } + + var minProperties: Int? = null + fun minProperties(minProperties: Int): JsonSchemaInfo { + this.minProperties = minProperties + return this + } + + var maximum: Number? = null + fun maximum(maximum: Number): JsonSchemaInfo { + this.maximum = maximum + return this + } + + var minimum: Number? = null + fun minimum(minimum: Number): JsonSchemaInfo { + this.minimum = minimum + return this + } + + var multipleOf: BigDecimal? = null + fun multipleOf(multipleOf: BigDecimal): JsonSchemaInfo { + this.multipleOf = multipleOf + return this + } + + var additionalProperties: Class>? = null + fun additionalProperties(additionalProperties: Class>): JsonSchemaInfo { + this.additionalProperties = additionalProperties + return this + } + + var allOf: List>>? = null + fun allOf(allOf: List>>): JsonSchemaInfo { + this.allOf = allOf + return this + } + + var anyOf: List>>? = null + fun anyOf(anyOf: List>>): JsonSchemaInfo { + this.anyOf = anyOf + return this + } + + var oneOf: List>>? = null + fun oneOf(oneOf: List>>): JsonSchemaInfo { + this.oneOf = oneOf + return this + } + + var not: Class>? = null + fun not(not: Class>): JsonSchemaInfo { + this.not = not + return this + } + + var uniqueItems: Boolean? = null + fun uniqueItems(uniqueItems: Boolean): JsonSchemaInfo { + this.uniqueItems = uniqueItems + return this + } + + var enumValues: Set? = null + fun enumValues(enumValues: Set): JsonSchemaInfo { + this.enumValues = enumValues + return this + } + + var pattern: Pattern? = null + fun pattern(pattern: Pattern): JsonSchemaInfo { + this.pattern = pattern + return this + } + + var defaultValue: Any? = null + var defaultValueSet = false + fun defaultValue(defaultValue: Any?): JsonSchemaInfo { + this.defaultValue = defaultValue + defaultValueSet = true + return this + } + + var constValue: Any? = null + var constValueSet = false + fun constValue(constValue: Any?): JsonSchemaInfo { + this.constValue = constValue + constValueSet = true + return this + } + + var contains: Class>? = null + fun contains(contains: Class>): JsonSchemaInfo { + this.contains = contains + return this + } + + var maxContains: Int? = null + fun maxContains(maxContains: Int): JsonSchemaInfo { + this.maxContains = maxContains + return this + } + + var minContains: Int? = null + fun minContains(minContains: Int): JsonSchemaInfo { + this.minContains = minContains + return this + } + + var propertyNames: Class>? = null + fun propertyNames(propertyNames: Class>): JsonSchemaInfo { + this.propertyNames = propertyNames + return this + } + + var dependentRequired: Map>? = null + fun dependentRequired(dependentRequired: Map>): JsonSchemaInfo { + this.dependentRequired = dependentRequired + return this + } + + var dependentSchemas: Map>>? = null + fun dependentSchemas(dependentSchemas: Map>>): JsonSchemaInfo { + this.dependentSchemas = dependentSchemas + return this + } + + var patternProperties: Map>>? = null + fun patternProperties(patternProperties: Map>>): JsonSchemaInfo { + this.patternProperties = patternProperties + return this + } + + var prefixItems: List>>? = null + fun prefixItems(prefixItems: List>>): JsonSchemaInfo { + this.prefixItems = prefixItems + return this + } + + var ifSchema: Class>? = null + fun ifSchema(ifSchema: Class>): JsonSchemaInfo { + this.ifSchema = ifSchema + return this + } + + var then: Class>? = null + fun then(then: Class>): JsonSchemaInfo { + this.then = then + return this + } + + var elseSchema: Class>? = null + fun elseSchema(elseSchema: Class>): JsonSchemaInfo { + this.elseSchema = elseSchema + return this + } + + var unevaluatedItems: Class>? = null + fun unevaluatedItems(unevaluatedItems: Class>): JsonSchemaInfo { + this.unevaluatedItems = unevaluatedItems + return this + } + + var unevaluatedProperties: Class>? = null + fun unevaluatedProperties(unevaluatedProperties: Class>): JsonSchemaInfo { + this.unevaluatedProperties = unevaluatedProperties + return this + } +} \ No newline at end of file diff --git a/samples/client/3_1_0_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/schemas/validation/KeywordEntry.kt b/samples/client/3_1_0_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/schemas/validation/KeywordEntry.kt new file mode 100644 index 00000000000..59e9d5bec4f --- /dev/null +++ b/samples/client/3_1_0_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/schemas/validation/KeywordEntry.kt @@ -0,0 +1,6 @@ +package org.openapijsonschematools.client.schemas.validation + +import java.util.AbstractMap + +class KeywordEntry(key: String, value: KeywordValidator) : + AbstractMap.SimpleEntry(key, value) diff --git a/samples/client/3_1_0_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/schemas/validation/KeywordValidator.kt b/samples/client/3_1_0_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/schemas/validation/KeywordValidator.kt new file mode 100644 index 00000000000..c707681f8bf --- /dev/null +++ b/samples/client/3_1_0_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/schemas/validation/KeywordValidator.kt @@ -0,0 +1,10 @@ +package org.openapijsonschematools.client.schemas.validation + +import org.openapijsonschematools.client.exceptions.ValidationException + +fun interface KeywordValidator { + @Throws(ValidationException::class) + fun validate( + data: ValidationData + ): PathToSchemasMap? +} \ No newline at end of file diff --git a/samples/client/3_1_0_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/schemas/validation/LengthValidator.kt b/samples/client/3_1_0_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/schemas/validation/LengthValidator.kt new file mode 100644 index 00000000000..50a273b85eb --- /dev/null +++ b/samples/client/3_1_0_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/schemas/validation/LengthValidator.kt @@ -0,0 +1,16 @@ +package org.openapijsonschematools.client.schemas.validation + +import java.text.BreakIterator + +abstract class LengthValidator { + protected fun getLength(text: String?): Int { + var graphemeCount = 0 + val graphemeCounter = BreakIterator + .getCharacterInstance() + graphemeCounter.setText(text) + while (graphemeCounter.next() != BreakIterator.DONE) { + graphemeCount++ + } + return graphemeCount + } +} diff --git a/samples/client/3_1_0_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/schemas/validation/ListSchemaValidator.kt b/samples/client/3_1_0_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/schemas/validation/ListSchemaValidator.kt new file mode 100644 index 00000000000..59c8c533bb2 --- /dev/null +++ b/samples/client/3_1_0_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/schemas/validation/ListSchemaValidator.kt @@ -0,0 +1,15 @@ +package org.openapijsonschematools.client.schemas.validation + +import org.openapijsonschematools.client.configurations.SchemaConfiguration +import org.openapijsonschematools.client.exceptions.ValidationException + +interface ListSchemaValidator { + @Throws(ValidationException::class) + fun getNewInstance(arg: List<*>, pathToItem: List, pathToSchemas: PathToSchemasMap): OutType + + @Throws(ValidationException::class) + fun validate(arg: List<*>, configuration: SchemaConfiguration?): OutType + + @Throws(ValidationException::class) + fun validateAndBox(arg: List<*>, configuration: SchemaConfiguration?): BoxedType +} \ No newline at end of file diff --git a/samples/client/3_1_0_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/schemas/validation/LongEnumValidator.kt b/samples/client/3_1_0_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/schemas/validation/LongEnumValidator.kt new file mode 100644 index 00000000000..c8fc6db061f --- /dev/null +++ b/samples/client/3_1_0_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/schemas/validation/LongEnumValidator.kt @@ -0,0 +1,9 @@ +package org.openapijsonschematools.client.schemas.validation + +import org.openapijsonschematools.client.configurations.SchemaConfiguration +import org.openapijsonschematools.client.exceptions.ValidationException + +interface LongEnumValidator { + @Throws(ValidationException::class) + fun validate(arg: EnumType, configuration: SchemaConfiguration?): Long +} \ No newline at end of file diff --git a/samples/client/3_1_0_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/schemas/validation/LongValueMethod.kt b/samples/client/3_1_0_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/schemas/validation/LongValueMethod.kt new file mode 100644 index 00000000000..8d1f0ddc419 --- /dev/null +++ b/samples/client/3_1_0_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/schemas/validation/LongValueMethod.kt @@ -0,0 +1,5 @@ +package org.openapijsonschematools.client.schemas.validation + +interface LongValueMethod { + fun value(): Long +} \ No newline at end of file diff --git a/samples/client/3_1_0_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/schemas/validation/MapSchemaValidator.kt b/samples/client/3_1_0_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/schemas/validation/MapSchemaValidator.kt new file mode 100644 index 00000000000..bf11248a121 --- /dev/null +++ b/samples/client/3_1_0_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/schemas/validation/MapSchemaValidator.kt @@ -0,0 +1,15 @@ +package org.openapijsonschematools.client.schemas.validation + +import org.openapijsonschematools.client.configurations.SchemaConfiguration +import org.openapijsonschematools.client.exceptions.ValidationException + +interface MapSchemaValidator { + @Throws(ValidationException::class) + fun getNewInstance(arg: Map<*, *>, pathToItem: List, pathToSchemas: PathToSchemasMap): OutType + + @Throws(ValidationException::class) + fun validate(arg: Map<*, *>, configuration: SchemaConfiguration?): OutType + + @Throws(ValidationException::class) + fun validateAndBox(arg: Map<*, *>, configuration: SchemaConfiguration?): BoxedType +} \ No newline at end of file diff --git a/samples/client/3_1_0_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/schemas/validation/MapUtils.kt b/samples/client/3_1_0_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/schemas/validation/MapUtils.kt new file mode 100644 index 00000000000..5e6a8383648 --- /dev/null +++ b/samples/client/3_1_0_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/schemas/validation/MapUtils.kt @@ -0,0 +1,35 @@ +package org.openapijsonschematools.client.schemas.validation + +import org.openapijsonschematools.client.exceptions.InvalidAdditionalPropertyException + +class MapUtils { + companion object { + /** + * A builder for maps that allows in null values + * Schema tests + doc code samples need it + * @param entries items to add + * @return the output map + * @param key type + * @param value type + */ + @SafeVarargs + fun makeMap(vararg entries: Map.Entry): Map { + val map: MutableMap = HashMap() + for ((key, value) in entries) { + map[key] = value + } + return map + } + + @Throws(InvalidAdditionalPropertyException::class) + fun throwIfKeyKnown(key: String, knownKeys: Set, setting: Boolean) { + if (knownKeys.contains(key)) { + var verb = "getting" + if (setting) { + verb = "setting" + } + throw InvalidAdditionalPropertyException("The known key $key may not be passed in when $verb an additional property") + } + } + } +} \ No newline at end of file diff --git a/samples/client/3_1_0_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/schemas/validation/MaxContainsValidator.kt b/samples/client/3_1_0_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/schemas/validation/MaxContainsValidator.kt new file mode 100644 index 00000000000..3783b2da69e --- /dev/null +++ b/samples/client/3_1_0_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/schemas/validation/MaxContainsValidator.kt @@ -0,0 +1,25 @@ +package org.openapijsonschematools.client.schemas.validation + +import org.openapijsonschematools.client.exceptions.ValidationException + +class MaxContainsValidator : KeywordValidator { + @Throws(ValidationException::class) + override fun validate( + data: ValidationData + ): PathToSchemasMap? { + val maxContains: Int = data.schema.maxContains ?: return null + if (data.arg !is List<*>) { + return null + } + val containsPathToSchemas: List = data.containsPathToSchemas ?: return null + if (containsPathToSchemas.size > maxContains) { + throw ValidationException(""" + |Validation failed for maxContains keyword in class=${data.schema.javaClass} + | at pathToItem=${data.validationMetadata.pathToItem}. Too many items" + | validated to the contains schema. + """.trimMargin() + ) + } + return null + } +} \ No newline at end of file diff --git a/samples/client/3_1_0_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/schemas/validation/MaxItemsValidator.kt b/samples/client/3_1_0_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/schemas/validation/MaxItemsValidator.kt new file mode 100644 index 00000000000..d18c07d9b79 --- /dev/null +++ b/samples/client/3_1_0_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/schemas/validation/MaxItemsValidator.kt @@ -0,0 +1,19 @@ +package org.openapijsonschematools.client.schemas.validation + +import org.openapijsonschematools.client.exceptions.ValidationException + +class MaxItemsValidator : KeywordValidator { + @Throws(ValidationException::class) + override fun validate( + data: ValidationData + ): PathToSchemasMap? { + val maxItems: Int = data.schema.maxItems ?: return null + if (data.arg !is List<*>) { + return null + } + if (data.arg.size > maxItems) { + throw ValidationException("Value ${data.arg} is invalid because has > the maxItems of $maxItems") + } + return null + } +} diff --git a/samples/client/3_1_0_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/schemas/validation/MaxLengthValidator.kt b/samples/client/3_1_0_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/schemas/validation/MaxLengthValidator.kt new file mode 100644 index 00000000000..ca9c267dbd9 --- /dev/null +++ b/samples/client/3_1_0_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/schemas/validation/MaxLengthValidator.kt @@ -0,0 +1,20 @@ +package org.openapijsonschematools.client.schemas.validation + +import org.openapijsonschematools.client.exceptions.ValidationException + +class MaxLengthValidator : LengthValidator(), KeywordValidator { + @Throws(ValidationException::class) + override fun validate( + data: ValidationData + ): PathToSchemasMap? { + val maxLength: Int = data.schema.maxLength ?: return null + if (data.arg !is String) { + return null + } + val length: Int = getLength(data.arg) + if (length > maxLength) { + throw ValidationException("Value ${data.arg} is invalid because has > the maxLength of $maxLength") + } + return null + } +} diff --git a/samples/client/3_1_0_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/schemas/validation/MaxPropertiesValidator.kt b/samples/client/3_1_0_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/schemas/validation/MaxPropertiesValidator.kt new file mode 100644 index 00000000000..1287a6b789f --- /dev/null +++ b/samples/client/3_1_0_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/schemas/validation/MaxPropertiesValidator.kt @@ -0,0 +1,19 @@ +package org.openapijsonschematools.client.schemas.validation + +import org.openapijsonschematools.client.exceptions.ValidationException + +class MaxPropertiesValidator : KeywordValidator { + @Throws(ValidationException::class) + override fun validate( + data: ValidationData + ): PathToSchemasMap? { + val maxProperties: Int = data.schema.maxProperties ?: return null + if (data.arg !is Map<*, *>) { + return null + } + if (data.arg.size > maxProperties) { + throw ValidationException("Value ${data.arg} is invalid because has > the maxProperties of $maxProperties") + } + return null + } +} \ No newline at end of file diff --git a/samples/client/3_1_0_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/schemas/validation/MaximumValidator.kt b/samples/client/3_1_0_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/schemas/validation/MaximumValidator.kt new file mode 100644 index 00000000000..b8070b6c4d1 --- /dev/null +++ b/samples/client/3_1_0_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/schemas/validation/MaximumValidator.kt @@ -0,0 +1,42 @@ +package org.openapijsonschematools.client.schemas.validation + +import org.openapijsonschematools.client.exceptions.ValidationException + +class MaximumValidator : KeywordValidator { + @Throws(ValidationException::class) + override fun validate( + data: ValidationData + ): PathToSchemasMap? { + val maximum: Number = data.schema.maximum ?: return null + if (data.arg !is Number) { + return null + } + val msg = "Value " + data.arg + " is invalid because it is > the maximum of " + maximum + when (data.arg) { + is Int -> { + if (data.arg.compareTo(maximum.toInt()) > 0) { + throw ValidationException(msg) + } + } + + is Long -> { + if (data.arg.compareTo(maximum.toLong()) > 0) { + throw ValidationException(msg) + } + } + + is Float -> { + if (data.arg.compareTo(maximum.toFloat()) > 0) { + throw ValidationException(msg) + } + } + + is Double -> { + if (data.arg.compareTo(maximum.toDouble()) > 0) { + throw ValidationException(msg) + } + } + } + return null + } +} \ No newline at end of file diff --git a/samples/client/3_1_0_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/schemas/validation/MinContainsValidator.kt b/samples/client/3_1_0_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/schemas/validation/MinContainsValidator.kt new file mode 100644 index 00000000000..73b74a6b3aa --- /dev/null +++ b/samples/client/3_1_0_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/schemas/validation/MinContainsValidator.kt @@ -0,0 +1,27 @@ +package org.openapijsonschematools.client.schemas.validation + +import org.openapijsonschematools.client.exceptions.ValidationException + +class MinContainsValidator : KeywordValidator { + @Throws(ValidationException::class) + override fun validate( + data: ValidationData + ): PathToSchemasMap? { + val minContains: Int = data.schema.minContains ?: return null + if (data.arg !is List<*>) { + return null + } + if (data.containsPathToSchemas == null) { + return null + } + if (data.containsPathToSchemas.size < minContains) { + throw ValidationException(""" + |Validation failed for minContains keyword in class=${data.schema.javaClass} at + | pathToItem=${data.validationMetadata.pathToItem}. + | Too few items validated to the contains schema. + """.trimMargin() + ) + } + return null + } +} \ No newline at end of file diff --git a/samples/client/3_1_0_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/schemas/validation/MinItemsValidator.kt b/samples/client/3_1_0_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/schemas/validation/MinItemsValidator.kt new file mode 100644 index 00000000000..0f92b86cdc8 --- /dev/null +++ b/samples/client/3_1_0_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/schemas/validation/MinItemsValidator.kt @@ -0,0 +1,19 @@ +package org.openapijsonschematools.client.schemas.validation + +import org.openapijsonschematools.client.exceptions.ValidationException + +class MinItemsValidator : KeywordValidator { + @Throws(ValidationException::class) + override fun validate( + data: ValidationData + ): PathToSchemasMap? { + val minItems: Int = data.schema.minItems ?: return null + if (data.arg !is List<*>) { + return null + } + if (data.arg.size < minItems) { + throw ValidationException("Value ${data.arg} is invalid because has < the minItems of $minItems") + } + return null + } +} \ No newline at end of file diff --git a/samples/client/3_1_0_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/schemas/validation/MinLengthValidator.kt b/samples/client/3_1_0_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/schemas/validation/MinLengthValidator.kt new file mode 100644 index 00000000000..95228a8e132 --- /dev/null +++ b/samples/client/3_1_0_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/schemas/validation/MinLengthValidator.kt @@ -0,0 +1,20 @@ +package org.openapijsonschematools.client.schemas.validation + +import org.openapijsonschematools.client.exceptions.ValidationException + +class MinLengthValidator : LengthValidator(), KeywordValidator { + @Throws(ValidationException::class) + override fun validate( + data: ValidationData + ): PathToSchemasMap? { + val minLength: Int = data.schema.minLength ?: return null + if (data.arg !is String) { + return null + } + val length = getLength(data.arg) + if (length < minLength) { + throw ValidationException("Value ${data.arg} is invalid because has < the minLength of $minLength") + } + return null + } +} \ No newline at end of file diff --git a/samples/client/3_1_0_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/schemas/validation/MinPropertiesValidator.kt b/samples/client/3_1_0_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/schemas/validation/MinPropertiesValidator.kt new file mode 100644 index 00000000000..01a2828c523 --- /dev/null +++ b/samples/client/3_1_0_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/schemas/validation/MinPropertiesValidator.kt @@ -0,0 +1,19 @@ +package org.openapijsonschematools.client.schemas.validation + +import org.openapijsonschematools.client.exceptions.ValidationException + +class MinPropertiesValidator : KeywordValidator { + @Throws(ValidationException::class) + override fun validate( + data: ValidationData + ): PathToSchemasMap? { + val minProperties: Int = data.schema.minProperties ?: return null + if (data.arg !is Map<*, *>) { + return null + } + if (data.arg.size < minProperties) { + throw ValidationException("Value ${data.arg} is invalid because has < the minProperties of $minProperties") + } + return null + } +} \ No newline at end of file diff --git a/samples/client/3_1_0_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/schemas/validation/MinimumValidator.kt b/samples/client/3_1_0_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/schemas/validation/MinimumValidator.kt new file mode 100644 index 00000000000..89cfc38f73a --- /dev/null +++ b/samples/client/3_1_0_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/schemas/validation/MinimumValidator.kt @@ -0,0 +1,42 @@ +package org.openapijsonschematools.client.schemas.validation + +import org.openapijsonschematools.client.exceptions.ValidationException + +class MinimumValidator : KeywordValidator { + @Throws(ValidationException::class) + override fun validate( + data: ValidationData + ): PathToSchemasMap? { + val minimum: Number = data.schema.minimum ?: return null + if (data.arg !is Number) { + return null + } + val msg = "Value " + data.arg + " is invalid because it is < the minimum of " + minimum + when (data.arg) { + is Int -> { + if (data.arg.compareTo(minimum.toInt()) < 0) { + throw ValidationException(msg) + } + } + + is Long -> { + if (data.arg.compareTo(minimum.toLong()) < 0) { + throw ValidationException(msg) + } + } + + is Float -> { + if (data.arg.compareTo(minimum.toFloat()) < 0) { + throw ValidationException(msg) + } + } + + is Double -> { + if (data.arg.compareTo(minimum.toDouble()) < 0) { + throw ValidationException(msg) + } + } + } + return null + } +} \ No newline at end of file diff --git a/samples/client/3_1_0_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/schemas/validation/MultipleOfValidator.kt b/samples/client/3_1_0_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/schemas/validation/MultipleOfValidator.kt new file mode 100644 index 00000000000..a1bf8794ae3 --- /dev/null +++ b/samples/client/3_1_0_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/schemas/validation/MultipleOfValidator.kt @@ -0,0 +1,23 @@ +package org.openapijsonschematools.client.schemas.validation + +import org.openapijsonschematools.client.exceptions.ValidationException + +import java.math.BigDecimal + +class MultipleOfValidator : BigDecimalValidator(), KeywordValidator { + @Throws(ValidationException::class) + override fun validate( + data: ValidationData + ): PathToSchemasMap? { + val multipleOf: BigDecimal = data.schema.multipleOf ?: return null + if (data.arg !is Number) { + return null + } + val castArg: BigDecimal = getBigDecimal(data.arg) + val msg = "Value ${data.arg} is invalid because it is not a multiple of $multipleOf" + if (castArg.remainder(multipleOf).compareTo(BigDecimal.ZERO) != 0) { + throw ValidationException(msg) + } + return null + } +} \ No newline at end of file diff --git a/samples/client/3_1_0_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/schemas/validation/NotValidator.kt b/samples/client/3_1_0_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/schemas/validation/NotValidator.kt new file mode 100644 index 00000000000..fe2eeaa2dfa --- /dev/null +++ b/samples/client/3_1_0_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/schemas/validation/NotValidator.kt @@ -0,0 +1,25 @@ +package org.openapijsonschematools.client.schemas.validation + +import org.openapijsonschematools.client.exceptions.ValidationException + +class NotValidator : KeywordValidator { + @Throws(ValidationException::class) + override fun validate( + data: ValidationData + ): PathToSchemasMap? { + val not: Class> = data.schema.not ?: return null + val pathToSchemas: PathToSchemasMap = try { + val notSchema = JsonSchemaFactory.getInstance(not) + JsonSchema.validate(notSchema, data.arg, data.validationMetadata) + } catch (e: ValidationException) { + return null + } + if (!pathToSchemas.isEmpty()) { + throw ValidationException( + "Invalid value " + data.arg + " was passed in to " + data.schema.javaClass + + ". Value is invalid because it is disallowed by not " + not + ) + } + return null + } +} diff --git a/samples/client/3_1_0_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/schemas/validation/NullEnumValidator.kt b/samples/client/3_1_0_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/schemas/validation/NullEnumValidator.kt new file mode 100644 index 00000000000..7f3f09ebd70 --- /dev/null +++ b/samples/client/3_1_0_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/schemas/validation/NullEnumValidator.kt @@ -0,0 +1,9 @@ +package org.openapijsonschematools.client.schemas.validation + +import org.openapijsonschematools.client.configurations.SchemaConfiguration +import org.openapijsonschematools.client.exceptions.ValidationException + +interface NullEnumValidator { + @Throws(ValidationException::class) + fun validate(arg: EnumType, configuration: SchemaConfiguration?): Nothing? +} \ No newline at end of file diff --git a/samples/client/3_1_0_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/schemas/validation/NullSchemaValidator.kt b/samples/client/3_1_0_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/schemas/validation/NullSchemaValidator.kt new file mode 100644 index 00000000000..b0e8462d4cf --- /dev/null +++ b/samples/client/3_1_0_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/schemas/validation/NullSchemaValidator.kt @@ -0,0 +1,12 @@ +package org.openapijsonschematools.client.schemas.validation + +import org.openapijsonschematools.client.configurations.SchemaConfiguration +import org.openapijsonschematools.client.exceptions.ValidationException + +interface NullSchemaValidator { + @Throws(ValidationException::class) + fun validate(arg: Nothing?, configuration: SchemaConfiguration?): Nothing? + + @Throws(ValidationException::class) + fun validateAndBox(arg: Nothing?, configuration: SchemaConfiguration?): T +} \ No newline at end of file diff --git a/samples/client/3_1_0_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/schemas/validation/NullValueMethod.kt b/samples/client/3_1_0_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/schemas/validation/NullValueMethod.kt new file mode 100644 index 00000000000..291eac2a663 --- /dev/null +++ b/samples/client/3_1_0_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/schemas/validation/NullValueMethod.kt @@ -0,0 +1,5 @@ +package org.openapijsonschematools.client.schemas.validation + +interface NullValueMethod { + fun value(): Nothing? +} \ No newline at end of file diff --git a/samples/client/3_1_0_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/schemas/validation/NumberSchemaValidator.kt b/samples/client/3_1_0_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/schemas/validation/NumberSchemaValidator.kt new file mode 100644 index 00000000000..cf4b7e2365b --- /dev/null +++ b/samples/client/3_1_0_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/schemas/validation/NumberSchemaValidator.kt @@ -0,0 +1,12 @@ +package org.openapijsonschematools.client.schemas.validation + +import org.openapijsonschematools.client.configurations.SchemaConfiguration +import org.openapijsonschematools.client.exceptions.ValidationException + +interface NumberSchemaValidator { + @Throws(ValidationException::class) + fun validate(arg: Number, configuration: SchemaConfiguration?): Number + + @Throws(ValidationException::class) + fun validateAndBox(arg: Number, configuration: SchemaConfiguration?): T +} \ No newline at end of file diff --git a/samples/client/3_1_0_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/schemas/validation/OneOfValidator.kt b/samples/client/3_1_0_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/schemas/validation/OneOfValidator.kt new file mode 100644 index 00000000000..b11ae07f2c5 --- /dev/null +++ b/samples/client/3_1_0_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/schemas/validation/OneOfValidator.kt @@ -0,0 +1,45 @@ +package org.openapijsonschematools.client.schemas.validation + +import org.openapijsonschematools.client.exceptions.ValidationException + +class OneOfValidator : KeywordValidator { + @Throws(ValidationException::class) + override fun validate( + data: ValidationData + ): PathToSchemasMap? { + val oneOf: List>> = data.schema.oneOf ?: return null + val pathToSchemas = PathToSchemasMap() + val validatedOneOfClasses: MutableList>> = ArrayList() + for (oneOfClass in oneOf) { + if (oneOfClass == data.schema.javaClass) { + /* + optimistically assume that schema will pass validation + do not invoke validate on it because that is recursive + */ + validatedOneOfClasses.add(oneOfClass) + continue + } + try { + val oneOfSchema = JsonSchemaFactory.getInstance(oneOfClass) + val otherPathToSchemas = JsonSchema.validate(oneOfSchema, data.arg, data.validationMetadata) + validatedOneOfClasses.add(oneOfClass) + pathToSchemas.update(otherPathToSchemas) + } catch (e: ValidationException) { + // silence exceptions because the code needs to accumulate validatedOneOfClasses + } + } + if (validatedOneOfClasses.isEmpty()) { + throw ValidationException( + "Invalid inputs given to generate an instance of " + data.schema.javaClass + ". None " + + "of the oneOf schemas matched the input data." + ) + } + if (validatedOneOfClasses.size > 1) { + throw ValidationException( + "Invalid inputs given to generate an instance of " + data.schema.javaClass + + ". Multiple oneOf schemas validated the data, but a max of one is allowed." + ) + } + return pathToSchemas + } +} \ No newline at end of file diff --git a/samples/client/3_1_0_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/schemas/validation/PathToSchemasMap.kt b/samples/client/3_1_0_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/schemas/validation/PathToSchemasMap.kt new file mode 100644 index 00000000000..61d124a2a43 --- /dev/null +++ b/samples/client/3_1_0_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/schemas/validation/PathToSchemasMap.kt @@ -0,0 +1,13 @@ +package org.openapijsonschematools.client.schemas.validation + +class PathToSchemasMap : LinkedHashMap, LinkedHashMap, Nothing?>>() { + fun update(other: PathToSchemasMap) { + for ((pathToItem, otherSchemas) in other) { + if (containsKey(pathToItem)) { + get(pathToItem)!!.putAll(otherSchemas) + } else { + put(pathToItem, otherSchemas) + } + } + } +} \ No newline at end of file diff --git a/samples/client/3_1_0_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/schemas/validation/PatternPropertiesValidator.kt b/samples/client/3_1_0_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/schemas/validation/PatternPropertiesValidator.kt new file mode 100644 index 00000000000..1ba9fd8396b --- /dev/null +++ b/samples/client/3_1_0_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/schemas/validation/PatternPropertiesValidator.kt @@ -0,0 +1,15 @@ +package org.openapijsonschematools.client.schemas.validation + +class PatternPropertiesValidator : KeywordValidator { + override fun validate( + data: ValidationData + ): PathToSchemasMap? + { + if (data.schema.patternProperties == null) { + return null + } + return if (data.arg !is Map<*, *>) { + null + } else data.patternPropertiesPathToSchemas + } +} diff --git a/samples/client/3_1_0_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/schemas/validation/PatternValidator.kt b/samples/client/3_1_0_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/schemas/validation/PatternValidator.kt new file mode 100644 index 00000000000..085c21a2943 --- /dev/null +++ b/samples/client/3_1_0_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/schemas/validation/PatternValidator.kt @@ -0,0 +1,21 @@ +package org.openapijsonschematools.client.schemas.validation + +import org.openapijsonschematools.client.exceptions.ValidationException + +import java.util.regex.Pattern + +class PatternValidator : KeywordValidator { + @Throws(ValidationException::class) + override fun validate( + data: ValidationData + ): PathToSchemasMap? { + val pattern: Pattern = data.schema.pattern ?: return null + if (data.arg !is String) { + return null + } + if (!pattern.matcher(data.arg).find()) { + throw ValidationException("Invalid value ${data.arg} did not find a match for pattern $pattern") + } + return null + } +} \ No newline at end of file diff --git a/samples/client/3_1_0_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/schemas/validation/PrefixItemsValidator.kt b/samples/client/3_1_0_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/schemas/validation/PrefixItemsValidator.kt new file mode 100644 index 00000000000..6435a86bfe1 --- /dev/null +++ b/samples/client/3_1_0_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/schemas/validation/PrefixItemsValidator.kt @@ -0,0 +1,35 @@ +package org.openapijsonschematools.client.schemas.validation + +import org.openapijsonschematools.client.exceptions.ValidationException + +import kotlin.math.min + +class PrefixItemsValidator : KeywordValidator { + @Throws(ValidationException::class) + override fun validate( + data: ValidationData + ): PathToSchemasMap? { + val prefixItems: List>> = data.schema.prefixItems ?: return null + if (data.arg !is List<*>) { + return null + } + if (data.arg.isEmpty()) { + return null + } + val pathToSchemas = PathToSchemasMap() + val maxIndex: Int = min(data.arg.size, prefixItems.size) + for (i in 0 until maxIndex) { + val itemPathToItem: List = data.validationMetadata.pathToItem + i + val itemValidationMetadata = ValidationMetadata( + itemPathToItem, + data.validationMetadata.configuration, + data.validationMetadata.validatedPathToSchemas, + data.validationMetadata.seenClasses + ) + val itemsSchema: JsonSchema<*> = JsonSchemaFactory.getInstance(prefixItems[i]) + val otherPathToSchemas = JsonSchema.validate(itemsSchema, data.arg[i], itemValidationMetadata) + pathToSchemas.update(otherPathToSchemas) + } + return pathToSchemas + } +} \ No newline at end of file diff --git a/samples/client/3_1_0_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/schemas/validation/PropertiesValidator.kt b/samples/client/3_1_0_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/schemas/validation/PropertiesValidator.kt new file mode 100644 index 00000000000..93cb2bcb320 --- /dev/null +++ b/samples/client/3_1_0_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/schemas/validation/PropertiesValidator.kt @@ -0,0 +1,44 @@ +package org.openapijsonschematools.client.schemas.validation + +import org.openapijsonschematools.client.exceptions.ValidationException + +class PropertiesValidator : KeywordValidator { + @Throws(ValidationException::class) + override fun validate( + data: ValidationData + ): PathToSchemasMap? { + val properties: Map>> = data.schema.properties ?: return null + if (data.arg !is Map<*, *>) { + return null + } + val pathToSchemas = PathToSchemasMap() + val presentProperties: MutableSet = LinkedHashSet() + for (key in data.arg.keys) { + if (key is String) { + presentProperties.add(key) + } + } + for ((propName, propClass) in properties.entries) { + if (!presentProperties.contains(propName)) { + continue + } + val propValue: Any? = data.arg[propName] + val propPathToItem: MutableList = ArrayList(data.validationMetadata.pathToItem) + propPathToItem.add(propName) + val propValidationMetadata = ValidationMetadata( + propPathToItem, + data.validationMetadata.configuration, + data.validationMetadata.validatedPathToSchemas, + data.validationMetadata.seenClasses + ) + val propSchema = JsonSchemaFactory.getInstance(propClass) + if (propValidationMetadata.validationRanEarlier(propSchema)) { + // todo add_deeper_validated_schemas + continue + } + val otherPathToSchemas = JsonSchema.validate(propSchema, propValue, propValidationMetadata) + pathToSchemas.update(otherPathToSchemas) + } + return pathToSchemas + } +} diff --git a/samples/client/3_1_0_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/schemas/validation/PropertyNamesValidator.kt b/samples/client/3_1_0_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/schemas/validation/PropertyNamesValidator.kt new file mode 100644 index 00000000000..3e41a82ebb8 --- /dev/null +++ b/samples/client/3_1_0_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/schemas/validation/PropertyNamesValidator.kt @@ -0,0 +1,29 @@ +package org.openapijsonschematools.client.schemas.validation + +import org.openapijsonschematools.client.exceptions.ValidationException + +class PropertyNamesValidator : KeywordValidator { + @Throws(ValidationException::class) + override fun validate( + data: ValidationData + ): PathToSchemasMap? { + val propertyNames: Class> = data.schema.propertyNames ?: return null + if (data.arg !is Map<*, *>) { + return null + } + val propertyNamesSchema = JsonSchemaFactory.getInstance(propertyNames) + for (objKey in data.arg.keys) { + if (objKey is String) { + val propPathToItem: List = data.validationMetadata.pathToItem + objKey + val keyValidationMetadata = ValidationMetadata( + propPathToItem, + data.validationMetadata.configuration, + data.validationMetadata.validatedPathToSchemas, + data.validationMetadata.seenClasses + ) + JsonSchema.validate(propertyNamesSchema, objKey, keyValidationMetadata) + } + } + return null + } +} diff --git a/samples/client/3_1_0_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/schemas/validation/RequiredValidator.kt b/samples/client/3_1_0_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/schemas/validation/RequiredValidator.kt new file mode 100644 index 00000000000..d2ac79c82d7 --- /dev/null +++ b/samples/client/3_1_0_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/schemas/validation/RequiredValidator.kt @@ -0,0 +1,32 @@ +package org.openapijsonschematools.client.schemas.validation + +import org.openapijsonschematools.client.exceptions.ValidationException + +class RequiredValidator : KeywordValidator { + @Throws(ValidationException::class) + override fun validate( + data: ValidationData + ): PathToSchemasMap? { + val required: Set = data.schema.required ?: return null + if (data.arg !is Map<*, *>) { + return null + } + val missingRequiredProperties: MutableSet = HashSet(required) + for (key in data.arg.keys) { + if (key is String) { + missingRequiredProperties.remove(key) + } + } + if (missingRequiredProperties.isNotEmpty()) { + val missingReqProps: List = missingRequiredProperties.toList().sorted() + var pluralChar = "" + if (missingRequiredProperties.size > 1) { + pluralChar = "s" + } + throw ValidationException( + data.schema.javaClass.simpleName + " is missing " + missingRequiredProperties.size + " required argument" + pluralChar + ": " + missingReqProps + ) + } + return null + } +} diff --git a/samples/client/3_1_0_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/schemas/validation/StringEnumValidator.kt b/samples/client/3_1_0_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/schemas/validation/StringEnumValidator.kt new file mode 100644 index 00000000000..c23532466f2 --- /dev/null +++ b/samples/client/3_1_0_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/schemas/validation/StringEnumValidator.kt @@ -0,0 +1,9 @@ +package org.openapijsonschematools.client.schemas.validation + +import org.openapijsonschematools.client.configurations.SchemaConfiguration +import org.openapijsonschematools.client.exceptions.ValidationException + +interface StringEnumValidator { + @Throws(ValidationException::class) + fun validate(arg: EnumType, configuration: SchemaConfiguration?): String +} \ No newline at end of file diff --git a/samples/client/3_1_0_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/schemas/validation/StringSchemaValidator.kt b/samples/client/3_1_0_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/schemas/validation/StringSchemaValidator.kt new file mode 100644 index 00000000000..b9622585d38 --- /dev/null +++ b/samples/client/3_1_0_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/schemas/validation/StringSchemaValidator.kt @@ -0,0 +1,12 @@ +package org.openapijsonschematools.client.schemas.validation + +import org.openapijsonschematools.client.configurations.SchemaConfiguration +import org.openapijsonschematools.client.exceptions.ValidationException + +interface StringSchemaValidator { + @Throws(ValidationException::class) + fun validate(arg: String, configuration: SchemaConfiguration?): String + + @Throws(ValidationException::class) + fun validateAndBox(arg: String, configuration: SchemaConfiguration?): T +} \ No newline at end of file diff --git a/samples/client/3_1_0_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/schemas/validation/StringValueMethod.kt b/samples/client/3_1_0_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/schemas/validation/StringValueMethod.kt new file mode 100644 index 00000000000..4e2ddeaf4e0 --- /dev/null +++ b/samples/client/3_1_0_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/schemas/validation/StringValueMethod.kt @@ -0,0 +1,5 @@ +package org.openapijsonschematools.client.schemas.validation + +interface StringValueMethod { + fun value(): String +} \ No newline at end of file diff --git a/samples/client/3_1_0_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/schemas/validation/ThenValidator.kt b/samples/client/3_1_0_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/schemas/validation/ThenValidator.kt new file mode 100644 index 00000000000..d63a1a36d18 --- /dev/null +++ b/samples/client/3_1_0_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/schemas/validation/ThenValidator.kt @@ -0,0 +1,26 @@ +package org.openapijsonschematools.client.schemas.validation + +import org.openapijsonschematools.client.exceptions.ValidationException + +class ThenValidator : KeywordValidator { + @Throws(ValidationException::class) + override fun validate( + data: ValidationData + ): PathToSchemasMap? { + val then: Class> = data.schema.then ?: return null + val ifPathToSchemas: PathToSchemasMap = data.ifPathToSchemas + ?: // if unset + return null + if (ifPathToSchemas.isEmpty()) { + // if validation is false + return null + } + val thenSchema = JsonSchemaFactory.getInstance(then) + val pathToSchemas = PathToSchemasMap() + val thenPathToSchemas = JsonSchema.validate(thenSchema, data.arg, data.validationMetadata) + // todo capture validation error and describe it as an then error? + pathToSchemas.update(ifPathToSchemas) + pathToSchemas.update(thenPathToSchemas) + return pathToSchemas + } +} \ No newline at end of file diff --git a/samples/client/3_1_0_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/schemas/validation/TypeValidator.kt b/samples/client/3_1_0_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/schemas/validation/TypeValidator.kt new file mode 100644 index 00000000000..635d85eb28c --- /dev/null +++ b/samples/client/3_1_0_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/schemas/validation/TypeValidator.kt @@ -0,0 +1,51 @@ +package org.openapijsonschematools.client.schemas.validation + +import org.openapijsonschematools.client.exceptions.ValidationException + +class TypeValidator : KeywordValidator { + @Throws(ValidationException::class) + override fun validate( + data: ValidationData + ): PathToSchemasMap? { + if (data.schema.type == null) { + return null + } + val argClass = when (data.arg) { + null -> { + Void::class.java + } + is List<*> -> { + List::class.java + } + + is Map<*, *> -> { + Map::class.java + } + + is Boolean -> { + Boolean::class.java + } + + is Int -> { + Int::class.java + } + is Long -> { + Long::class.java + } + is Double -> { + Double::class.java + } + is Float -> { + Float::class.java + } + + else -> { + data.arg.javaClass + } + } + if (!data.schema.type.contains(argClass)) { + throw ValidationException("invalid type") + } + return null + } +} \ No newline at end of file diff --git a/samples/client/3_1_0_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/schemas/validation/UnevaluatedItemsValidator.kt b/samples/client/3_1_0_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/schemas/validation/UnevaluatedItemsValidator.kt new file mode 100644 index 00000000000..4ac1a823821 --- /dev/null +++ b/samples/client/3_1_0_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/schemas/validation/UnevaluatedItemsValidator.kt @@ -0,0 +1,41 @@ +package org.openapijsonschematools.client.schemas.validation + +import org.openapijsonschematools.client.exceptions.ValidationException + +class UnevaluatedItemsValidator : KeywordValidator { + @Throws(ValidationException::class) + override fun validate( + data: ValidationData + ): PathToSchemasMap? { + val unevaluatedItems: Class> = data.schema.unevaluatedItems ?: return null + val knownPathToSchemas: PathToSchemasMap = data.knownPathToSchemas ?: return null + if (data.arg !is List<*>) { + return null + } + if (data.arg.isEmpty()) { + return null + } + val pathToSchemas = PathToSchemasMap() + val minIndex = if (data.schema.prefixItems != null) data.schema.prefixItems.size else 0 + val unevaluatedItemsSchema = JsonSchemaFactory.getInstance(unevaluatedItems) + for (i in minIndex until data.arg.size) { + val itemPathToItem: List = data.validationMetadata.pathToItem + i + if (knownPathToSchemas.containsKey(itemPathToItem)) { + continue + } + val itemValidationMetadata = ValidationMetadata( + itemPathToItem, + data.validationMetadata.configuration, + data.validationMetadata.validatedPathToSchemas, + data.validationMetadata.seenClasses + ) + if (itemValidationMetadata.validationRanEarlier(unevaluatedItemsSchema)) { + // todo add_deeper_validated_schemas + continue + } + val otherPathToSchemas = JsonSchema.validate(unevaluatedItemsSchema, data.arg[i], itemValidationMetadata) + pathToSchemas.update(otherPathToSchemas) + } + return pathToSchemas + } +} \ No newline at end of file diff --git a/samples/client/3_1_0_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/schemas/validation/UnevaluatedPropertiesValidator.kt b/samples/client/3_1_0_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/schemas/validation/UnevaluatedPropertiesValidator.kt new file mode 100644 index 00000000000..f78940fc822 --- /dev/null +++ b/samples/client/3_1_0_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/schemas/validation/UnevaluatedPropertiesValidator.kt @@ -0,0 +1,36 @@ +package org.openapijsonschematools.client.schemas.validation + +import org.openapijsonschematools.client.exceptions.ValidationException + +class UnevaluatedPropertiesValidator : KeywordValidator { + @Throws(ValidationException::class) + override fun validate( + data: ValidationData + ): PathToSchemasMap? { + val unevaluatedProperties: Class> = data.schema.unevaluatedProperties ?: return null + val knownPathToSchemas: PathToSchemasMap = data.knownPathToSchemas ?: return null + if (data.arg !is Map<*, *>) { + return null + } + val pathToSchemas = PathToSchemasMap() + val unevaluatedPropertiesSchema = JsonSchemaFactory.getInstance(unevaluatedProperties) + for ((key, value) in data.arg.entries) { + if (key !is String) { + throw ValidationException("Map keys must be strings") + } + val propPathToItem: List = data.validationMetadata.pathToItem + key + if (knownPathToSchemas.containsKey(propPathToItem)) { + continue + } + val propValidationMetadata = ValidationMetadata( + propPathToItem, + data.validationMetadata.configuration, + data.validationMetadata.validatedPathToSchemas, + data.validationMetadata.seenClasses + ) + val otherPathToSchemas = JsonSchema.validate(unevaluatedPropertiesSchema, value, propValidationMetadata) + pathToSchemas.update(otherPathToSchemas) + } + return pathToSchemas + } +} \ No newline at end of file diff --git a/samples/client/3_1_0_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/schemas/validation/UniqueItemsValidator.kt b/samples/client/3_1_0_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/schemas/validation/UniqueItemsValidator.kt new file mode 100644 index 00000000000..2c2f41591b0 --- /dev/null +++ b/samples/client/3_1_0_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/schemas/validation/UniqueItemsValidator.kt @@ -0,0 +1,27 @@ +package org.openapijsonschematools.client.schemas.validation + +import org.openapijsonschematools.client.exceptions.ValidationException + +class UniqueItemsValidator : KeywordValidator { + @Throws(ValidationException::class) + override fun validate( + data: ValidationData + ): PathToSchemasMap? { + val uniqueItems: Boolean = data.schema.uniqueItems ?: return null + if (data.arg !is List<*>) { + return null + } + if (!uniqueItems) { + return null + } + val seenItems: MutableSet = HashSet() + for (item in data.arg) { + val startingSeenItemsSize = seenItems.size + seenItems.add(item) + if (seenItems.size == startingSeenItemsSize) { + throw ValidationException("Invalid list value, list contains duplicate items when uniqueItems is true") + } + } + return null + } +} diff --git a/samples/client/3_1_0_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/schemas/validation/UnsetAnyTypeJsonSchema.kt b/samples/client/3_1_0_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/schemas/validation/UnsetAnyTypeJsonSchema.kt new file mode 100644 index 00000000000..3797fa632b2 --- /dev/null +++ b/samples/client/3_1_0_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/schemas/validation/UnsetAnyTypeJsonSchema.kt @@ -0,0 +1,336 @@ +package org.openapijsonschematools.client.schemas.validation + +import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags +import org.openapijsonschematools.client.configurations.SchemaConfiguration +import org.openapijsonschematools.client.exceptions.ValidationException + +import java.time.LocalDate +import java.time.ZonedDateTime +import java.util.UUID + +class UnsetAnyTypeJsonSchema { + sealed interface UnsetAnyTypeJsonSchema1Boxed { + fun getData(): Any? + } + + data class UnsetAnyTypeJsonSchema1BoxedVoid(val data: Nothing?) : UnsetAnyTypeJsonSchema1Boxed { + override fun getData(): Any? { + return data + } + } + + data class UnsetAnyTypeJsonSchema1BoxedBoolean(val data: Boolean) : UnsetAnyTypeJsonSchema1Boxed { + override fun getData(): Any? { + return data + } + } + + data class UnsetAnyTypeJsonSchema1BoxedNumber(val data: Number) : UnsetAnyTypeJsonSchema1Boxed { + override fun getData(): Any? { + return data + } + } + + data class UnsetAnyTypeJsonSchema1BoxedString(val data: String) : UnsetAnyTypeJsonSchema1Boxed { + override fun getData(): Any? { + return data + } + } + + data class UnsetAnyTypeJsonSchema1BoxedList(val data: FrozenList) : UnsetAnyTypeJsonSchema1Boxed { + override fun getData(): Any? { + return data + } + } + + data class UnsetAnyTypeJsonSchema1BoxedMap(val data: FrozenMap) : UnsetAnyTypeJsonSchema1Boxed { + override fun getData(): Any? { + return data + } + } + + class UnsetAnyTypeJsonSchema1 private constructor() : JsonSchema(JsonSchemaInfo()), + NullSchemaValidator, + BooleanSchemaValidator, + NumberSchemaValidator, + StringSchemaValidator, + ListSchemaValidator, UnsetAnyTypeJsonSchema1BoxedList>, + MapSchemaValidator, UnsetAnyTypeJsonSchema1BoxedMap> { + @Throws(ValidationException::class) + override fun validate(arg: Nothing?, configuration: SchemaConfiguration?): Nothing? { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0]") + val castArg: Nothing? = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validatedPathToSchemas = PathToSchemasMap() + val validationMetadata = + ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, LinkedHashSet()) + val pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet) + return getNewInstance(castArg, validationMetadata.pathToItem, pathToSchemasMap) + } + + @Throws(ValidationException::class) + override fun validate(arg: Boolean, configuration: SchemaConfiguration?): Boolean { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0]") + val castArg: Boolean = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validatedPathToSchemas = PathToSchemasMap() + val validationMetadata = + ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, LinkedHashSet()) + val pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet) + return getNewInstance(castArg, validationMetadata.pathToItem, pathToSchemasMap) + } + + @Throws(ValidationException::class) + override fun validate(arg: Number, configuration: SchemaConfiguration?): Number { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0]") + val castArg: Number = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validatedPathToSchemas = PathToSchemasMap() + val validationMetadata = + ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, LinkedHashSet()) + val pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet) + return getNewInstance(castArg, validationMetadata.pathToItem, pathToSchemasMap) + } + + @Throws(ValidationException::class) + fun validate(arg: Int, configuration: SchemaConfiguration?): Int { + return validate(arg as Number, configuration) as Int + } + + @Throws(ValidationException::class) + fun validate(arg: Long, configuration: SchemaConfiguration?): Long { + return validate(arg as Number, configuration) as Long + } + + @Throws(ValidationException::class) + fun validate(arg: Float, configuration: SchemaConfiguration?): Float { + return validate(arg as Number, configuration) as Float + } + + @Throws(ValidationException::class) + fun validate(arg: Double, configuration: SchemaConfiguration?): Double { + return validate(arg as Number, configuration) as Double + } + + @Throws(ValidationException::class) + override fun validate(arg: String, configuration: SchemaConfiguration?): String { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0]") + val castArg: String = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validatedPathToSchemas = PathToSchemasMap() + val validationMetadata = + ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, LinkedHashSet()) + val pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet) + return getNewInstance(castArg, validationMetadata.pathToItem, pathToSchemasMap) + } + + @Throws(ValidationException::class) + fun validate(arg: LocalDate, configuration: SchemaConfiguration?): String { + return validate(arg.toString(), configuration) + } + + @Throws(ValidationException::class) + fun validate(arg: ZonedDateTime, configuration: SchemaConfiguration?): String { + return validate(arg.toString(), configuration) + } + + @Throws(ValidationException::class) + fun validate(arg: UUID, configuration: SchemaConfiguration?): String { + return validate(arg.toString(), configuration) + } + + override fun getNewInstance(arg: List<*>, pathToItem: List, pathToSchemas: PathToSchemasMap): FrozenList { + val items: MutableList = ArrayList() + var i = 0 + for (item in arg) { + val itemPathToItem: MutableList = ArrayList(pathToItem) + itemPathToItem.add(i) + val schemas = pathToSchemas[itemPathToItem] + ?: throw RuntimeException("Validation result is invalid, schemas must exist for a pathToItem") + val itemSchema = schemas.entries.iterator().next().key + val castItem = itemSchema.getNewInstance(item, itemPathToItem, pathToSchemas) + items.add(castItem) + i += 1 + } + return FrozenList(items) + } + + @Throws(ValidationException::class) + override fun validate(arg: List<*>, configuration: SchemaConfiguration?): FrozenList { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0]") + val castArg: List<*> = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validatedPathToSchemas = PathToSchemasMap() + val validationMetadata = + ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, LinkedHashSet()) + val pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet) + return getNewInstance(castArg, validationMetadata.pathToItem, pathToSchemasMap) + } + + override fun getNewInstance(arg: Map<*, *>, pathToItem: List, pathToSchemas: PathToSchemasMap): FrozenMap { + val properties = LinkedHashMap() + for ((entryKey, value1) in arg) { + if (entryKey !is String) { + throw RuntimeException("Invalid non-string key value") + } + val propertyPathToItem: MutableList = ArrayList(pathToItem) + propertyPathToItem.add(entryKey) + val value = value1!! + val schemas = pathToSchemas[propertyPathToItem] + ?: throw RuntimeException("Validation result is invalid, schemas must exist for a pathToItem") + val propertySchema = schemas.entries.iterator().next().key + val castValue = propertySchema.getNewInstance(value, propertyPathToItem, pathToSchemas) + properties[entryKey] = castValue + } + return FrozenMap(properties) + } + + @Throws(ValidationException::class) + override fun validate(arg: Map<*, *>, configuration: SchemaConfiguration?): FrozenMap { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0]") + val castArg: Map<*, *> = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validatedPathToSchemas = PathToSchemasMap() + val validationMetadata = + ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, LinkedHashSet()) + val pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet) + return getNewInstance(castArg, validationMetadata.pathToItem, pathToSchemasMap) + } + + override fun getNewInstance(arg: Any?, pathToItem: List, pathToSchemas: PathToSchemasMap): Any? { + when (arg) { + null -> { + return getNewInstance(null, pathToItem, pathToSchemas) + } + is Boolean -> { + return getNewInstance(arg, pathToItem, pathToSchemas) + } + + is Number -> { + return getNewInstance(arg, pathToItem, pathToSchemas) + } + + is String -> { + return getNewInstance(arg, pathToItem, pathToSchemas) + } + + is List<*> -> { + return getNewInstance(arg, pathToItem, pathToSchemas) + } + + is Map<*, *> -> { + return getNewInstance(arg, pathToItem, pathToSchemas) + } + + else -> throw RuntimeException("Invalid input type=$javaClass. It can't be instantiated by this schema") + } + } + + @Throws(ValidationException::class) + override fun validate(arg: Any?, configuration: SchemaConfiguration?): Any? { + when (arg) { + null -> { + return validate(null, configuration) + } + is Boolean -> { + return validate(arg, configuration) + } + + is Number -> { + return validate(arg, configuration) + } + + is String -> { + return validate(arg, configuration) + } + + is List<*> -> { + return validate(arg, configuration) + } + + is Map<*, *> -> { + return validate(arg, configuration) + } + + else -> throw ValidationException("Invalid input type=$javaClass. It can't be validated by this schema") + } + } + + @Throws(ValidationException::class) + override fun validateAndBox(arg: Nothing?, configuration: SchemaConfiguration?): UnsetAnyTypeJsonSchema1BoxedVoid { + return UnsetAnyTypeJsonSchema1BoxedVoid(validate(arg, configuration)) + } + + @Throws(ValidationException::class) + override fun validateAndBox(arg: Boolean, configuration: SchemaConfiguration?): UnsetAnyTypeJsonSchema1BoxedBoolean { + return UnsetAnyTypeJsonSchema1BoxedBoolean(validate(arg, configuration)) + } + + @Throws(ValidationException::class) + override fun validateAndBox(arg: Number, configuration: SchemaConfiguration?): UnsetAnyTypeJsonSchema1BoxedNumber { + return UnsetAnyTypeJsonSchema1BoxedNumber(validate(arg, configuration)) + } + + @Throws(ValidationException::class) + override fun validateAndBox(arg: String, configuration: SchemaConfiguration?): UnsetAnyTypeJsonSchema1BoxedString { + return UnsetAnyTypeJsonSchema1BoxedString(validate(arg, configuration)) + } + + @Throws(ValidationException::class) + override fun validateAndBox(arg: List<*>, configuration: SchemaConfiguration?): UnsetAnyTypeJsonSchema1BoxedList { + return UnsetAnyTypeJsonSchema1BoxedList(validate(arg, configuration)) + } + + @Throws(ValidationException::class) + override fun validateAndBox(arg: Map<*, *>, configuration: SchemaConfiguration?): UnsetAnyTypeJsonSchema1BoxedMap { + return UnsetAnyTypeJsonSchema1BoxedMap(validate(arg, configuration)) + } + + @Throws(ValidationException::class) + override fun validateAndBox(arg: Any?, configuration: SchemaConfiguration?): UnsetAnyTypeJsonSchema1Boxed { + when (arg) { + null -> { + return validateAndBox(null, configuration) + } + is Boolean -> { + val castArg: Boolean = arg + return validateAndBox(castArg, configuration) + } + + is String -> { + return validateAndBox(arg, configuration) + } + + is Number -> { + return validateAndBox(arg, configuration) + } + + is List<*> -> { + return validateAndBox(arg, configuration) + } + + is Map<*, *> -> { + return validateAndBox(arg, configuration) + } + + else -> throw ValidationException("Invalid input type=$javaClass. It can't be validated by this schema") + } + } + + companion object { + @Volatile + private var instance: UnsetAnyTypeJsonSchema1? = null + + fun getInstance() = + instance ?: synchronized(this) { + instance ?: UnsetAnyTypeJsonSchema1().also { instance = it } + } + } + } +} \ No newline at end of file diff --git a/samples/client/3_1_0_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/schemas/validation/ValidationData.kt b/samples/client/3_1_0_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/schemas/validation/ValidationData.kt new file mode 100644 index 00000000000..4629847ee87 --- /dev/null +++ b/samples/client/3_1_0_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/schemas/validation/ValidationData.kt @@ -0,0 +1,11 @@ +package org.openapijsonschematools.client.schemas.validation + +data class ValidationData( + val schema: JsonSchema<*>, + val arg: Any?, + val validationMetadata: ValidationMetadata, + val containsPathToSchemas: List? = null, + val patternPropertiesPathToSchemas: PathToSchemasMap? = null, + val ifPathToSchemas: PathToSchemasMap? = null, + val knownPathToSchemas: PathToSchemasMap? = null +) \ No newline at end of file diff --git a/samples/client/3_1_0_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/schemas/validation/ValidationMetadata.kt b/samples/client/3_1_0_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/schemas/validation/ValidationMetadata.kt new file mode 100644 index 00000000000..39ccadbdde6 --- /dev/null +++ b/samples/client/3_1_0_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/schemas/validation/ValidationMetadata.kt @@ -0,0 +1,18 @@ +package org.openapijsonschematools.client.schemas.validation + +import org.openapijsonschematools.client.configurations.SchemaConfiguration + +data class ValidationMetadata( + val pathToItem: List, + val configuration: SchemaConfiguration, + val validatedPathToSchemas: PathToSchemasMap, + val seenClasses: Set> +) { + fun validationRanEarlier(schema: JsonSchema<*>): Boolean { + val validatedSchemas: Map, Nothing?>? = validatedPathToSchemas[pathToItem] + if (validatedSchemas != null && validatedSchemas.containsKey(schema)) { + return true + } + return seenClasses.contains(schema.javaClass) + } +} \ No newline at end of file diff --git a/samples/client/3_1_0_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/servers/RootServer0.kt b/samples/client/3_1_0_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/servers/RootServer0.kt new file mode 100644 index 00000000000..6b3d3c867c2 --- /dev/null +++ b/samples/client/3_1_0_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/servers/RootServer0.kt @@ -0,0 +1,6 @@ +package org.openapijsonschematools.client.servers; + +import org.openapijsonschematools.client.servers.ServerWithoutVariables; + +class RootServer0 : ServerWithoutVariables("https://someserver.com/v1") { +} diff --git a/samples/client/3_1_0_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/servers/Server.kt b/samples/client/3_1_0_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/servers/Server.kt new file mode 100644 index 00000000000..916d6a489bf --- /dev/null +++ b/samples/client/3_1_0_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/servers/Server.kt @@ -0,0 +1,5 @@ +package org.openapijsonschematools.client.servers; + +interface Server { + fun url(): String +} diff --git a/samples/client/3_1_0_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/servers/ServerProvider.kt b/samples/client/3_1_0_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/servers/ServerProvider.kt new file mode 100644 index 00000000000..65dcd7942f5 --- /dev/null +++ b/samples/client/3_1_0_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/servers/ServerProvider.kt @@ -0,0 +1,6 @@ +package org.openapijsonschematools.client.servers; + +interface ServerProvider { + fun getServer(serverIndex: T): Server +} + diff --git a/samples/client/3_1_0_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/servers/ServerWithVariables.kt b/samples/client/3_1_0_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/servers/ServerWithVariables.kt new file mode 100644 index 00000000000..7cf85cd8ccf --- /dev/null +++ b/samples/client/3_1_0_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/servers/ServerWithVariables.kt @@ -0,0 +1,20 @@ +package org.openapijsonschematools.client.servers + +abstract class ServerWithVariables> protected constructor(url: String, variables: T) : + Server { + val url: String + val variables: T + + init { + var url = url + this.variables = variables + for ((key, value) in variables) { + url = url.replace("{$key}", value) + } + this.url = url + } + + override fun url(): String { + return url + } +} diff --git a/samples/client/3_1_0_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/servers/ServerWithoutVariables.kt b/samples/client/3_1_0_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/servers/ServerWithoutVariables.kt new file mode 100644 index 00000000000..6267cc468f5 --- /dev/null +++ b/samples/client/3_1_0_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/servers/ServerWithoutVariables.kt @@ -0,0 +1,8 @@ +package org.openapijsonschematools.client.servers; + +abstract class ServerWithoutVariables protected constructor(val url: String) : Server { + override fun url(): String { + return url + } +} + diff --git a/samples/client/3_1_0_unit_test/kotlin/src/test/kotlin/org/openapijsonschematools/client/components/schemas/ASchemaGivenForPrefixitemsTest.kt b/samples/client/3_1_0_unit_test/kotlin/src/test/kotlin/org/openapijsonschematools/client/components/schemas/ASchemaGivenForPrefixitemsTest.kt new file mode 100644 index 00000000000..6f088da48e8 --- /dev/null +++ b/samples/client/3_1_0_unit_test/kotlin/src/test/kotlin/org/openapijsonschematools/client/components/schemas/ASchemaGivenForPrefixitemsTest.kt @@ -0,0 +1,110 @@ +package org.openapijsonschematools.client.components.schemas + +import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags +import org.openapijsonschematools.client.configurations.SchemaConfiguration +import org.openapijsonschematools.client.exceptions.ValidationException + +import kotlin.test.Test +import kotlin.test.assertFailsWith + +class ASchemaGivenForPrefixitemsTest { + companion object { + val configuration = SchemaConfiguration(JsonSchemaKeywordFlags.Builder().format().build()) + } + + @Test + fun testCorrectTypesPasses() { + // correct types + val schema = ASchemaGivenForPrefixitems.ASchemaGivenForPrefixitems1.getInstance() + schema.validate( + ASchemaGivenForPrefixitems.ASchemaGivenForPrefixitemsListBuilder() + .add(1) + + .add("foo") + + .build(), + configuration + ) + } + + @Test + fun testArrayWithAdditionalItemsPasses() { + // array with additional items + val schema = ASchemaGivenForPrefixitems.ASchemaGivenForPrefixitems1.getInstance() + schema.validate( + ASchemaGivenForPrefixitems.ASchemaGivenForPrefixitemsListBuilder() + .add(1) + + .add("foo") + + .add(true) + + .build(), + configuration + ) + } + + @Test + fun testJavascriptPseudoArrayIsValidPasses() { + // JavaScript pseudo-array is valid + val schema = ASchemaGivenForPrefixitems.ASchemaGivenForPrefixitems1.getInstance() + schema.validate( + mapOf( + Pair( + "0", + "invalid" + ), + Pair( + "1", + "valid" + ), + Pair( + "length", + 2 + ) + ), + configuration + ) + } + + @Test + fun testEmptyArrayPasses() { + // empty array + val schema = ASchemaGivenForPrefixitems.ASchemaGivenForPrefixitems1.getInstance() + schema.validate( + ASchemaGivenForPrefixitems.ASchemaGivenForPrefixitemsListBuilder() + .build(), + configuration + ) + } + + @Test + fun testWrongTypesFails() { + // wrong types + val schema = ASchemaGivenForPrefixitems.ASchemaGivenForPrefixitems1.getInstance() + assertFailsWith( + block = { + schema.validate( + listOf( + "foo", + 1 + ), + configuration + ) + } + ) + } + + @Test + fun testIncompleteArrayOfItemsPasses() { + // incomplete array of items + val schema = ASchemaGivenForPrefixitems.ASchemaGivenForPrefixitems1.getInstance() + schema.validate( + ASchemaGivenForPrefixitems.ASchemaGivenForPrefixitemsListBuilder() + .add(1) + + .build(), + configuration + ) + } +} diff --git a/samples/client/3_1_0_unit_test/kotlin/src/test/kotlin/org/openapijsonschematools/client/components/schemas/AdditionalItemsAreAllowedByDefaultTest.kt b/samples/client/3_1_0_unit_test/kotlin/src/test/kotlin/org/openapijsonschematools/client/components/schemas/AdditionalItemsAreAllowedByDefaultTest.kt new file mode 100644 index 00000000000..b631f7ea5c4 --- /dev/null +++ b/samples/client/3_1_0_unit_test/kotlin/src/test/kotlin/org/openapijsonschematools/client/components/schemas/AdditionalItemsAreAllowedByDefaultTest.kt @@ -0,0 +1,31 @@ +package org.openapijsonschematools.client.components.schemas + +import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags +import org.openapijsonschematools.client.configurations.SchemaConfiguration +import org.openapijsonschematools.client.exceptions.ValidationException + +import kotlin.test.Test +import kotlin.test.assertFailsWith + +class AdditionalItemsAreAllowedByDefaultTest { + companion object { + val configuration = SchemaConfiguration(JsonSchemaKeywordFlags.Builder().format().build()) + } + + @Test + fun testOnlyTheFirstItemIsValidatedPasses() { + // only the first item is validated + val schema = AdditionalItemsAreAllowedByDefault.AdditionalItemsAreAllowedByDefault1.getInstance() + schema.validate( + AdditionalItemsAreAllowedByDefault.AdditionalItemsAreAllowedByDefaultListBuilder() + .add(1) + + .add("foo") + + .add(false) + + .build(), + configuration + ) + } +} diff --git a/samples/client/3_1_0_unit_test/kotlin/src/test/kotlin/org/openapijsonschematools/client/components/schemas/AdditionalpropertiesAreAllowedByDefaultTest.kt b/samples/client/3_1_0_unit_test/kotlin/src/test/kotlin/org/openapijsonschematools/client/components/schemas/AdditionalpropertiesAreAllowedByDefaultTest.kt new file mode 100644 index 00000000000..0a6f7f758b3 --- /dev/null +++ b/samples/client/3_1_0_unit_test/kotlin/src/test/kotlin/org/openapijsonschematools/client/components/schemas/AdditionalpropertiesAreAllowedByDefaultTest.kt @@ -0,0 +1,37 @@ +package org.openapijsonschematools.client.components.schemas + +import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags +import org.openapijsonschematools.client.configurations.SchemaConfiguration +import org.openapijsonschematools.client.exceptions.ValidationException + +import kotlin.test.Test +import kotlin.test.assertFailsWith + +class AdditionalpropertiesAreAllowedByDefaultTest { + companion object { + val configuration = SchemaConfiguration(JsonSchemaKeywordFlags.Builder().format().build()) + } + + @Test + fun testAdditionalPropertiesAreAllowedPasses() { + // additional properties are allowed + val schema = AdditionalpropertiesAreAllowedByDefault.AdditionalpropertiesAreAllowedByDefault1.getInstance() + schema.validate( + mapOf( + Pair( + "foo", + 1 + ), + Pair( + "bar", + 2 + ), + Pair( + "quux", + true + ) + ), + configuration + ) + } +} diff --git a/samples/client/3_1_0_unit_test/kotlin/src/test/kotlin/org/openapijsonschematools/client/components/schemas/AdditionalpropertiesCanExistByItselfTest.kt b/samples/client/3_1_0_unit_test/kotlin/src/test/kotlin/org/openapijsonschematools/client/components/schemas/AdditionalpropertiesCanExistByItselfTest.kt new file mode 100644 index 00000000000..e4b32602f7e --- /dev/null +++ b/samples/client/3_1_0_unit_test/kotlin/src/test/kotlin/org/openapijsonschematools/client/components/schemas/AdditionalpropertiesCanExistByItselfTest.kt @@ -0,0 +1,48 @@ +package org.openapijsonschematools.client.components.schemas + +import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags +import org.openapijsonschematools.client.configurations.SchemaConfiguration +import org.openapijsonschematools.client.exceptions.ValidationException + +import kotlin.test.Test +import kotlin.test.assertFailsWith + +class AdditionalpropertiesCanExistByItselfTest { + companion object { + val configuration = SchemaConfiguration(JsonSchemaKeywordFlags.Builder().format().build()) + } + + @Test + fun testAnAdditionalValidPropertyIsValidPasses() { + // an additional valid property is valid + val schema = AdditionalpropertiesCanExistByItself.AdditionalpropertiesCanExistByItself1.getInstance() + schema.validate( + mapOf( + Pair( + "foo", + true + ) + ), + configuration + ) + } + + @Test + fun testAnAdditionalInvalidPropertyIsInvalidFails() { + // an additional invalid property is invalid + val schema = AdditionalpropertiesCanExistByItself.AdditionalpropertiesCanExistByItself1.getInstance() + assertFailsWith( + block = { + schema.validate( + mapOf( + Pair( + "foo", + 1 + ) + ), + configuration + ) + } + ) + } +} diff --git a/samples/client/3_1_0_unit_test/kotlin/src/test/kotlin/org/openapijsonschematools/client/components/schemas/AdditionalpropertiesDoesNotLookInApplicatorsTest.kt b/samples/client/3_1_0_unit_test/kotlin/src/test/kotlin/org/openapijsonschematools/client/components/schemas/AdditionalpropertiesDoesNotLookInApplicatorsTest.kt new file mode 100644 index 00000000000..a0cbb3098bb --- /dev/null +++ b/samples/client/3_1_0_unit_test/kotlin/src/test/kotlin/org/openapijsonschematools/client/components/schemas/AdditionalpropertiesDoesNotLookInApplicatorsTest.kt @@ -0,0 +1,37 @@ +package org.openapijsonschematools.client.components.schemas + +import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags +import org.openapijsonschematools.client.configurations.SchemaConfiguration +import org.openapijsonschematools.client.exceptions.ValidationException + +import kotlin.test.Test +import kotlin.test.assertFailsWith + +class AdditionalpropertiesDoesNotLookInApplicatorsTest { + companion object { + val configuration = SchemaConfiguration(JsonSchemaKeywordFlags.Builder().format().build()) + } + + @Test + fun testPropertiesDefinedInAllofAreNotExaminedFails() { + // properties defined in allOf are not examined + val schema = AdditionalpropertiesDoesNotLookInApplicators.AdditionalpropertiesDoesNotLookInApplicators1.getInstance() + assertFailsWith( + block = { + schema.validate( + mapOf( + Pair( + "foo", + 1 + ), + Pair( + "bar", + true + ) + ), + configuration + ) + } + ) + } +} diff --git a/samples/client/3_1_0_unit_test/kotlin/src/test/kotlin/org/openapijsonschematools/client/components/schemas/AdditionalpropertiesWithNullValuedInstancePropertiesTest.kt b/samples/client/3_1_0_unit_test/kotlin/src/test/kotlin/org/openapijsonschematools/client/components/schemas/AdditionalpropertiesWithNullValuedInstancePropertiesTest.kt new file mode 100644 index 00000000000..1889c430890 --- /dev/null +++ b/samples/client/3_1_0_unit_test/kotlin/src/test/kotlin/org/openapijsonschematools/client/components/schemas/AdditionalpropertiesWithNullValuedInstancePropertiesTest.kt @@ -0,0 +1,29 @@ +package org.openapijsonschematools.client.components.schemas + +import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags +import org.openapijsonschematools.client.configurations.SchemaConfiguration +import org.openapijsonschematools.client.exceptions.ValidationException + +import kotlin.test.Test +import kotlin.test.assertFailsWith + +class AdditionalpropertiesWithNullValuedInstancePropertiesTest { + companion object { + val configuration = SchemaConfiguration(JsonSchemaKeywordFlags.Builder().format().build()) + } + + @Test + fun testAllowsNullValuesPasses() { + // allows null values + val schema = AdditionalpropertiesWithNullValuedInstanceProperties.AdditionalpropertiesWithNullValuedInstanceProperties1.getInstance() + schema.validate( + mapOf( + Pair( + "foo", + null + ) + ), + configuration + ) + } +} diff --git a/samples/client/3_1_0_unit_test/kotlin/src/test/kotlin/org/openapijsonschematools/client/components/schemas/AdditionalpropertiesWithSchemaTest.kt b/samples/client/3_1_0_unit_test/kotlin/src/test/kotlin/org/openapijsonschematools/client/components/schemas/AdditionalpropertiesWithSchemaTest.kt new file mode 100644 index 00000000000..946a077cb7a --- /dev/null +++ b/samples/client/3_1_0_unit_test/kotlin/src/test/kotlin/org/openapijsonschematools/client/components/schemas/AdditionalpropertiesWithSchemaTest.kt @@ -0,0 +1,79 @@ +package org.openapijsonschematools.client.components.schemas + +import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags +import org.openapijsonschematools.client.configurations.SchemaConfiguration +import org.openapijsonschematools.client.exceptions.ValidationException + +import kotlin.test.Test +import kotlin.test.assertFailsWith + +class AdditionalpropertiesWithSchemaTest { + companion object { + val configuration = SchemaConfiguration(JsonSchemaKeywordFlags.Builder().format().build()) + } + + @Test + fun testNoAdditionalPropertiesIsValidPasses() { + // no additional properties is valid + val schema = AdditionalpropertiesWithSchema.AdditionalpropertiesWithSchema1.getInstance() + schema.validate( + mapOf( + Pair( + "foo", + 1 + ) + ), + configuration + ) + } + + @Test + fun testAnAdditionalValidPropertyIsValidPasses() { + // an additional valid property is valid + val schema = AdditionalpropertiesWithSchema.AdditionalpropertiesWithSchema1.getInstance() + schema.validate( + mapOf( + Pair( + "foo", + 1 + ), + Pair( + "bar", + 2 + ), + Pair( + "quux", + true + ) + ), + configuration + ) + } + + @Test + fun testAnAdditionalInvalidPropertyIsInvalidFails() { + // an additional invalid property is invalid + val schema = AdditionalpropertiesWithSchema.AdditionalpropertiesWithSchema1.getInstance() + assertFailsWith( + block = { + schema.validate( + mapOf( + Pair( + "foo", + 1 + ), + Pair( + "bar", + 2 + ), + Pair( + "quux", + 12 + ) + ), + configuration + ) + } + ) + } +} diff --git a/samples/client/3_1_0_unit_test/kotlin/src/test/kotlin/org/openapijsonschematools/client/components/schemas/AllofCombinedWithAnyofOneofTest.kt b/samples/client/3_1_0_unit_test/kotlin/src/test/kotlin/org/openapijsonschematools/client/components/schemas/AllofCombinedWithAnyofOneofTest.kt new file mode 100644 index 00000000000..5703d263e49 --- /dev/null +++ b/samples/client/3_1_0_unit_test/kotlin/src/test/kotlin/org/openapijsonschematools/client/components/schemas/AllofCombinedWithAnyofOneofTest.kt @@ -0,0 +1,122 @@ +package org.openapijsonschematools.client.components.schemas + +import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags +import org.openapijsonschematools.client.configurations.SchemaConfiguration +import org.openapijsonschematools.client.exceptions.ValidationException + +import kotlin.test.Test +import kotlin.test.assertFailsWith + +class AllofCombinedWithAnyofOneofTest { + companion object { + val configuration = SchemaConfiguration(JsonSchemaKeywordFlags.Builder().format().build()) + } + + @Test + fun testAllofFalseAnyofFalseOneofTrueFails() { + // allOf: false, anyOf: false, oneOf: true + val schema = AllofCombinedWithAnyofOneof.AllofCombinedWithAnyofOneof1.getInstance() + assertFailsWith( + block = { + schema.validate( + 5, + configuration + ) + } + ) + } + + @Test + fun testAllofFalseAnyofTrueOneofFalseFails() { + // allOf: false, anyOf: true, oneOf: false + val schema = AllofCombinedWithAnyofOneof.AllofCombinedWithAnyofOneof1.getInstance() + assertFailsWith( + block = { + schema.validate( + 3, + configuration + ) + } + ) + } + + @Test + fun testAllofFalseAnyofTrueOneofTrueFails() { + // allOf: false, anyOf: true, oneOf: true + val schema = AllofCombinedWithAnyofOneof.AllofCombinedWithAnyofOneof1.getInstance() + assertFailsWith( + block = { + schema.validate( + 15, + configuration + ) + } + ) + } + + @Test + fun testAllofTrueAnyofFalseOneofFalseFails() { + // allOf: true, anyOf: false, oneOf: false + val schema = AllofCombinedWithAnyofOneof.AllofCombinedWithAnyofOneof1.getInstance() + assertFailsWith( + block = { + schema.validate( + 2, + configuration + ) + } + ) + } + + @Test + fun testAllofTrueAnyofTrueOneofTruePasses() { + // allOf: true, anyOf: true, oneOf: true + val schema = AllofCombinedWithAnyofOneof.AllofCombinedWithAnyofOneof1.getInstance() + schema.validate( + 30, + configuration + ) + } + + @Test + fun testAllofFalseAnyofFalseOneofFalseFails() { + // allOf: false, anyOf: false, oneOf: false + val schema = AllofCombinedWithAnyofOneof.AllofCombinedWithAnyofOneof1.getInstance() + assertFailsWith( + block = { + schema.validate( + 1, + configuration + ) + } + ) + } + + @Test + fun testAllofTrueAnyofFalseOneofTrueFails() { + // allOf: true, anyOf: false, oneOf: true + val schema = AllofCombinedWithAnyofOneof.AllofCombinedWithAnyofOneof1.getInstance() + assertFailsWith( + block = { + schema.validate( + 10, + configuration + ) + } + ) + } + + @Test + fun testAllofTrueAnyofTrueOneofFalseFails() { + // allOf: true, anyOf: true, oneOf: false + val schema = AllofCombinedWithAnyofOneof.AllofCombinedWithAnyofOneof1.getInstance() + assertFailsWith( + block = { + schema.validate( + 6, + configuration + ) + } + ) + } +} diff --git a/samples/client/3_1_0_unit_test/kotlin/src/test/kotlin/org/openapijsonschematools/client/components/schemas/AllofSimpleTypesTest.kt b/samples/client/3_1_0_unit_test/kotlin/src/test/kotlin/org/openapijsonschematools/client/components/schemas/AllofSimpleTypesTest.kt new file mode 100644 index 00000000000..ff6e7d933dd --- /dev/null +++ b/samples/client/3_1_0_unit_test/kotlin/src/test/kotlin/org/openapijsonschematools/client/components/schemas/AllofSimpleTypesTest.kt @@ -0,0 +1,38 @@ +package org.openapijsonschematools.client.components.schemas + +import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags +import org.openapijsonschematools.client.configurations.SchemaConfiguration +import org.openapijsonschematools.client.exceptions.ValidationException + +import kotlin.test.Test +import kotlin.test.assertFailsWith + +class AllofSimpleTypesTest { + companion object { + val configuration = SchemaConfiguration(JsonSchemaKeywordFlags.Builder().format().build()) + } + + @Test + fun testMismatchOneFails() { + // mismatch one + val schema = AllofSimpleTypes.AllofSimpleTypes1.getInstance() + assertFailsWith( + block = { + schema.validate( + 35, + configuration + ) + } + ) + } + + @Test + fun testValidPasses() { + // valid + val schema = AllofSimpleTypes.AllofSimpleTypes1.getInstance() + schema.validate( + 25, + configuration + ) + } +} diff --git a/samples/client/3_1_0_unit_test/kotlin/src/test/kotlin/org/openapijsonschematools/client/components/schemas/AllofTest.kt b/samples/client/3_1_0_unit_test/kotlin/src/test/kotlin/org/openapijsonschematools/client/components/schemas/AllofTest.kt new file mode 100644 index 00000000000..c2af359082b --- /dev/null +++ b/samples/client/3_1_0_unit_test/kotlin/src/test/kotlin/org/openapijsonschematools/client/components/schemas/AllofTest.kt @@ -0,0 +1,94 @@ +package org.openapijsonschematools.client.components.schemas + +import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags +import org.openapijsonschematools.client.configurations.SchemaConfiguration +import org.openapijsonschematools.client.exceptions.ValidationException + +import kotlin.test.Test +import kotlin.test.assertFailsWith + +class AllofTest { + companion object { + val configuration = SchemaConfiguration(JsonSchemaKeywordFlags.Builder().format().build()) + } + + @Test + fun testMismatchSecondFails() { + // mismatch second + val schema = Allof.Allof1.getInstance() + assertFailsWith( + block = { + schema.validate( + mapOf( + Pair( + "foo", + "baz" + ) + ), + configuration + ) + } + ) + } + + @Test + fun testWrongTypeFails() { + // wrong type + val schema = Allof.Allof1.getInstance() + assertFailsWith( + block = { + schema.validate( + mapOf( + Pair( + "foo", + "baz" + ), + Pair( + "bar", + "quux" + ) + ), + configuration + ) + } + ) + } + + @Test + fun testMismatchFirstFails() { + // mismatch first + val schema = Allof.Allof1.getInstance() + assertFailsWith( + block = { + schema.validate( + mapOf( + Pair( + "bar", + 2 + ) + ), + configuration + ) + } + ) + } + + @Test + fun testAllofPasses() { + // allOf + val schema = Allof.Allof1.getInstance() + schema.validate( + mapOf( + Pair( + "foo", + "baz" + ), + Pair( + "bar", + 2 + ) + ), + configuration + ) + } +} diff --git a/samples/client/3_1_0_unit_test/kotlin/src/test/kotlin/org/openapijsonschematools/client/components/schemas/AllofWithBaseSchemaTest.kt b/samples/client/3_1_0_unit_test/kotlin/src/test/kotlin/org/openapijsonschematools/client/components/schemas/AllofWithBaseSchemaTest.kt new file mode 100644 index 00000000000..f4b4b2af3fb --- /dev/null +++ b/samples/client/3_1_0_unit_test/kotlin/src/test/kotlin/org/openapijsonschematools/client/components/schemas/AllofWithBaseSchemaTest.kt @@ -0,0 +1,125 @@ +package org.openapijsonschematools.client.components.schemas + +import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags +import org.openapijsonschematools.client.configurations.SchemaConfiguration +import org.openapijsonschematools.client.exceptions.ValidationException + +import kotlin.test.Test +import kotlin.test.assertFailsWith + +class AllofWithBaseSchemaTest { + companion object { + val configuration = SchemaConfiguration(JsonSchemaKeywordFlags.Builder().format().build()) + } + + @Test + fun testMismatchBaseSchemaFails() { + // mismatch base schema + val schema = AllofWithBaseSchema.AllofWithBaseSchema1.getInstance() + assertFailsWith( + block = { + schema.validate( + mapOf( + Pair( + "foo", + "quux" + ), + Pair( + "baz", + null + ) + ), + configuration + ) + } + ) + } + + @Test + fun testMismatchFirstAllofFails() { + // mismatch first allOf + val schema = AllofWithBaseSchema.AllofWithBaseSchema1.getInstance() + assertFailsWith( + block = { + schema.validate( + mapOf( + Pair( + "bar", + 2 + ), + Pair( + "baz", + null + ) + ), + configuration + ) + } + ) + } + + @Test + fun testValidPasses() { + // valid + val schema = AllofWithBaseSchema.AllofWithBaseSchema1.getInstance() + schema.validate( + mapOf( + Pair( + "foo", + "quux" + ), + Pair( + "bar", + 2 + ), + Pair( + "baz", + null + ) + ), + configuration + ) + } + + @Test + fun testMismatchBothFails() { + // mismatch both + val schema = AllofWithBaseSchema.AllofWithBaseSchema1.getInstance() + assertFailsWith( + block = { + schema.validate( + mapOf( + Pair( + "bar", + 2 + ) + ), + configuration + ) + } + ) + } + + @Test + fun testMismatchSecondAllofFails() { + // mismatch second allOf + val schema = AllofWithBaseSchema.AllofWithBaseSchema1.getInstance() + assertFailsWith( + block = { + schema.validate( + mapOf( + Pair( + "foo", + "quux" + ), + Pair( + "bar", + 2 + ) + ), + configuration + ) + } + ) + } +} diff --git a/samples/client/3_1_0_unit_test/kotlin/src/test/kotlin/org/openapijsonschematools/client/components/schemas/AllofWithOneEmptySchemaTest.kt b/samples/client/3_1_0_unit_test/kotlin/src/test/kotlin/org/openapijsonschematools/client/components/schemas/AllofWithOneEmptySchemaTest.kt new file mode 100644 index 00000000000..081371231ec --- /dev/null +++ b/samples/client/3_1_0_unit_test/kotlin/src/test/kotlin/org/openapijsonschematools/client/components/schemas/AllofWithOneEmptySchemaTest.kt @@ -0,0 +1,24 @@ +package org.openapijsonschematools.client.components.schemas + +import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags +import org.openapijsonschematools.client.configurations.SchemaConfiguration +import org.openapijsonschematools.client.exceptions.ValidationException + +import kotlin.test.Test +import kotlin.test.assertFailsWith + +class AllofWithOneEmptySchemaTest { + companion object { + val configuration = SchemaConfiguration(JsonSchemaKeywordFlags.Builder().format().build()) + } + + @Test + fun testAnyDataIsValidPasses() { + // any data is valid + val schema = AllofWithOneEmptySchema.AllofWithOneEmptySchema1.getInstance() + schema.validate( + 1, + configuration + ) + } +} diff --git a/samples/client/3_1_0_unit_test/kotlin/src/test/kotlin/org/openapijsonschematools/client/components/schemas/AllofWithTheFirstEmptySchemaTest.kt b/samples/client/3_1_0_unit_test/kotlin/src/test/kotlin/org/openapijsonschematools/client/components/schemas/AllofWithTheFirstEmptySchemaTest.kt new file mode 100644 index 00000000000..5f40ab6e1ce --- /dev/null +++ b/samples/client/3_1_0_unit_test/kotlin/src/test/kotlin/org/openapijsonschematools/client/components/schemas/AllofWithTheFirstEmptySchemaTest.kt @@ -0,0 +1,38 @@ +package org.openapijsonschematools.client.components.schemas + +import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags +import org.openapijsonschematools.client.configurations.SchemaConfiguration +import org.openapijsonschematools.client.exceptions.ValidationException + +import kotlin.test.Test +import kotlin.test.assertFailsWith + +class AllofWithTheFirstEmptySchemaTest { + companion object { + val configuration = SchemaConfiguration(JsonSchemaKeywordFlags.Builder().format().build()) + } + + @Test + fun testStringIsInvalidFails() { + // string is invalid + val schema = AllofWithTheFirstEmptySchema.AllofWithTheFirstEmptySchema1.getInstance() + assertFailsWith( + block = { + schema.validate( + "foo", + configuration + ) + } + ) + } + + @Test + fun testNumberIsValidPasses() { + // number is valid + val schema = AllofWithTheFirstEmptySchema.AllofWithTheFirstEmptySchema1.getInstance() + schema.validate( + 1, + configuration + ) + } +} diff --git a/samples/client/3_1_0_unit_test/kotlin/src/test/kotlin/org/openapijsonschematools/client/components/schemas/AllofWithTheLastEmptySchemaTest.kt b/samples/client/3_1_0_unit_test/kotlin/src/test/kotlin/org/openapijsonschematools/client/components/schemas/AllofWithTheLastEmptySchemaTest.kt new file mode 100644 index 00000000000..1669c0495aa --- /dev/null +++ b/samples/client/3_1_0_unit_test/kotlin/src/test/kotlin/org/openapijsonschematools/client/components/schemas/AllofWithTheLastEmptySchemaTest.kt @@ -0,0 +1,38 @@ +package org.openapijsonschematools.client.components.schemas + +import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags +import org.openapijsonschematools.client.configurations.SchemaConfiguration +import org.openapijsonschematools.client.exceptions.ValidationException + +import kotlin.test.Test +import kotlin.test.assertFailsWith + +class AllofWithTheLastEmptySchemaTest { + companion object { + val configuration = SchemaConfiguration(JsonSchemaKeywordFlags.Builder().format().build()) + } + + @Test + fun testStringIsInvalidFails() { + // string is invalid + val schema = AllofWithTheLastEmptySchema.AllofWithTheLastEmptySchema1.getInstance() + assertFailsWith( + block = { + schema.validate( + "foo", + configuration + ) + } + ) + } + + @Test + fun testNumberIsValidPasses() { + // number is valid + val schema = AllofWithTheLastEmptySchema.AllofWithTheLastEmptySchema1.getInstance() + schema.validate( + 1, + configuration + ) + } +} diff --git a/samples/client/3_1_0_unit_test/kotlin/src/test/kotlin/org/openapijsonschematools/client/components/schemas/AllofWithTwoEmptySchemasTest.kt b/samples/client/3_1_0_unit_test/kotlin/src/test/kotlin/org/openapijsonschematools/client/components/schemas/AllofWithTwoEmptySchemasTest.kt new file mode 100644 index 00000000000..e9e9a86e68e --- /dev/null +++ b/samples/client/3_1_0_unit_test/kotlin/src/test/kotlin/org/openapijsonschematools/client/components/schemas/AllofWithTwoEmptySchemasTest.kt @@ -0,0 +1,24 @@ +package org.openapijsonschematools.client.components.schemas + +import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags +import org.openapijsonschematools.client.configurations.SchemaConfiguration +import org.openapijsonschematools.client.exceptions.ValidationException + +import kotlin.test.Test +import kotlin.test.assertFailsWith + +class AllofWithTwoEmptySchemasTest { + companion object { + val configuration = SchemaConfiguration(JsonSchemaKeywordFlags.Builder().format().build()) + } + + @Test + fun testAnyDataIsValidPasses() { + // any data is valid + val schema = AllofWithTwoEmptySchemas.AllofWithTwoEmptySchemas1.getInstance() + schema.validate( + 1, + configuration + ) + } +} diff --git a/samples/client/3_1_0_unit_test/kotlin/src/test/kotlin/org/openapijsonschematools/client/components/schemas/AnyofComplexTypesTest.kt b/samples/client/3_1_0_unit_test/kotlin/src/test/kotlin/org/openapijsonschematools/client/components/schemas/AnyofComplexTypesTest.kt new file mode 100644 index 00000000000..997c742aa1f --- /dev/null +++ b/samples/client/3_1_0_unit_test/kotlin/src/test/kotlin/org/openapijsonschematools/client/components/schemas/AnyofComplexTypesTest.kt @@ -0,0 +1,86 @@ +package org.openapijsonschematools.client.components.schemas + +import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags +import org.openapijsonschematools.client.configurations.SchemaConfiguration +import org.openapijsonschematools.client.exceptions.ValidationException + +import kotlin.test.Test +import kotlin.test.assertFailsWith + +class AnyofComplexTypesTest { + companion object { + val configuration = SchemaConfiguration(JsonSchemaKeywordFlags.Builder().format().build()) + } + + @Test + fun testSecondAnyofValidComplexPasses() { + // second anyOf valid (complex) + val schema = AnyofComplexTypes.AnyofComplexTypes1.getInstance() + schema.validate( + mapOf( + Pair( + "foo", + "baz" + ) + ), + configuration + ) + } + + @Test + fun testBothAnyofValidComplexPasses() { + // both anyOf valid (complex) + val schema = AnyofComplexTypes.AnyofComplexTypes1.getInstance() + schema.validate( + mapOf( + Pair( + "foo", + "baz" + ), + Pair( + "bar", + 2 + ) + ), + configuration + ) + } + + @Test + fun testFirstAnyofValidComplexPasses() { + // first anyOf valid (complex) + val schema = AnyofComplexTypes.AnyofComplexTypes1.getInstance() + schema.validate( + mapOf( + Pair( + "bar", + 2 + ) + ), + configuration + ) + } + + @Test + fun testNeitherAnyofValidComplexFails() { + // neither anyOf valid (complex) + val schema = AnyofComplexTypes.AnyofComplexTypes1.getInstance() + assertFailsWith( + block = { + schema.validate( + mapOf( + Pair( + "foo", + 2 + ), + Pair( + "bar", + "quux" + ) + ), + configuration + ) + } + ) + } +} diff --git a/samples/client/3_1_0_unit_test/kotlin/src/test/kotlin/org/openapijsonschematools/client/components/schemas/AnyofTest.kt b/samples/client/3_1_0_unit_test/kotlin/src/test/kotlin/org/openapijsonschematools/client/components/schemas/AnyofTest.kt new file mode 100644 index 00000000000..a525d7d0312 --- /dev/null +++ b/samples/client/3_1_0_unit_test/kotlin/src/test/kotlin/org/openapijsonschematools/client/components/schemas/AnyofTest.kt @@ -0,0 +1,58 @@ +package org.openapijsonschematools.client.components.schemas + +import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags +import org.openapijsonschematools.client.configurations.SchemaConfiguration +import org.openapijsonschematools.client.exceptions.ValidationException + +import kotlin.test.Test +import kotlin.test.assertFailsWith + +class AnyofTest { + companion object { + val configuration = SchemaConfiguration(JsonSchemaKeywordFlags.Builder().format().build()) + } + + @Test + fun testBothAnyofValidPasses() { + // both anyOf valid + val schema = Anyof.Anyof1.getInstance() + schema.validate( + 3, + configuration + ) + } + + @Test + fun testNeitherAnyofValidFails() { + // neither anyOf valid + val schema = Anyof.Anyof1.getInstance() + assertFailsWith( + block = { + schema.validate( + 1.5, + configuration + ) + } + ) + } + + @Test + fun testFirstAnyofValidPasses() { + // first anyOf valid + val schema = Anyof.Anyof1.getInstance() + schema.validate( + 1, + configuration + ) + } + + @Test + fun testSecondAnyofValidPasses() { + // second anyOf valid + val schema = Anyof.Anyof1.getInstance() + schema.validate( + 2.5, + configuration + ) + } +} diff --git a/samples/client/3_1_0_unit_test/kotlin/src/test/kotlin/org/openapijsonschematools/client/components/schemas/AnyofWithBaseSchemaTest.kt b/samples/client/3_1_0_unit_test/kotlin/src/test/kotlin/org/openapijsonschematools/client/components/schemas/AnyofWithBaseSchemaTest.kt new file mode 100644 index 00000000000..76ed26e5272 --- /dev/null +++ b/samples/client/3_1_0_unit_test/kotlin/src/test/kotlin/org/openapijsonschematools/client/components/schemas/AnyofWithBaseSchemaTest.kt @@ -0,0 +1,52 @@ +package org.openapijsonschematools.client.components.schemas + +import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags +import org.openapijsonschematools.client.configurations.SchemaConfiguration +import org.openapijsonschematools.client.exceptions.ValidationException + +import kotlin.test.Test +import kotlin.test.assertFailsWith + +class AnyofWithBaseSchemaTest { + companion object { + val configuration = SchemaConfiguration(JsonSchemaKeywordFlags.Builder().format().build()) + } + + @Test + fun testMismatchBaseSchemaFails() { + // mismatch base schema + val schema = AnyofWithBaseSchema.AnyofWithBaseSchema1.getInstance() + assertFailsWith( + block = { + schema.validate( + 3, + configuration + ) + } + ) + } + + @Test + fun testOneAnyofValidPasses() { + // one anyOf valid + val schema = AnyofWithBaseSchema.AnyofWithBaseSchema1.getInstance() + schema.validate( + "foobar", + configuration + ) + } + + @Test + fun testBothAnyofInvalidFails() { + // both anyOf invalid + val schema = AnyofWithBaseSchema.AnyofWithBaseSchema1.getInstance() + assertFailsWith( + block = { + schema.validate( + "foo", + configuration + ) + } + ) + } +} diff --git a/samples/client/3_1_0_unit_test/kotlin/src/test/kotlin/org/openapijsonschematools/client/components/schemas/AnyofWithOneEmptySchemaTest.kt b/samples/client/3_1_0_unit_test/kotlin/src/test/kotlin/org/openapijsonschematools/client/components/schemas/AnyofWithOneEmptySchemaTest.kt new file mode 100644 index 00000000000..9a0ca10b5cd --- /dev/null +++ b/samples/client/3_1_0_unit_test/kotlin/src/test/kotlin/org/openapijsonschematools/client/components/schemas/AnyofWithOneEmptySchemaTest.kt @@ -0,0 +1,34 @@ +package org.openapijsonschematools.client.components.schemas + +import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags +import org.openapijsonschematools.client.configurations.SchemaConfiguration +import org.openapijsonschematools.client.exceptions.ValidationException + +import kotlin.test.Test +import kotlin.test.assertFailsWith + +class AnyofWithOneEmptySchemaTest { + companion object { + val configuration = SchemaConfiguration(JsonSchemaKeywordFlags.Builder().format().build()) + } + + @Test + fun testNumberIsValidPasses() { + // number is valid + val schema = AnyofWithOneEmptySchema.AnyofWithOneEmptySchema1.getInstance() + schema.validate( + 123, + configuration + ) + } + + @Test + fun testStringIsValidPasses() { + // string is valid + val schema = AnyofWithOneEmptySchema.AnyofWithOneEmptySchema1.getInstance() + schema.validate( + "foo", + configuration + ) + } +} diff --git a/samples/client/3_1_0_unit_test/kotlin/src/test/kotlin/org/openapijsonschematools/client/components/schemas/ArrayTypeMatchesArraysTest.kt b/samples/client/3_1_0_unit_test/kotlin/src/test/kotlin/org/openapijsonschematools/client/components/schemas/ArrayTypeMatchesArraysTest.kt new file mode 100644 index 00000000000..7e4c8375edc --- /dev/null +++ b/samples/client/3_1_0_unit_test/kotlin/src/test/kotlin/org/openapijsonschematools/client/components/schemas/ArrayTypeMatchesArraysTest.kt @@ -0,0 +1,110 @@ +package org.openapijsonschematools.client.components.schemas + +import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags +import org.openapijsonschematools.client.configurations.SchemaConfiguration +import org.openapijsonschematools.client.exceptions.ValidationException + +import kotlin.test.Test +import kotlin.test.assertFailsWith + +class ArrayTypeMatchesArraysTest { + companion object { + val configuration = SchemaConfiguration(JsonSchemaKeywordFlags.Builder().format().build()) + } + + @Test + fun testABooleanIsNotAnArrayFails() { + // a boolean is not an array + val schema = ArrayTypeMatchesArrays.ArrayTypeMatchesArrays1.getInstance() + assertFailsWith( + block = { + schema.validate( + true, + configuration + ) + } + ) + } + + @Test + fun testAFloatIsNotAnArrayFails() { + // a float is not an array + val schema = ArrayTypeMatchesArrays.ArrayTypeMatchesArrays1.getInstance() + assertFailsWith( + block = { + schema.validate( + 1.1, + configuration + ) + } + ) + } + + @Test + fun testAnArrayIsAnArrayPasses() { + // an array is an array + val schema = ArrayTypeMatchesArrays.ArrayTypeMatchesArrays1.getInstance() + schema.validate( + listOf( + ), + configuration + ) + } + + @Test + fun testNullIsNotAnArrayFails() { + // null is not an array + val schema = ArrayTypeMatchesArrays.ArrayTypeMatchesArrays1.getInstance() + assertFailsWith( + block = { + schema.validate( + null, + configuration + ) + } + ) + } + + @Test + fun testAStringIsNotAnArrayFails() { + // a string is not an array + val schema = ArrayTypeMatchesArrays.ArrayTypeMatchesArrays1.getInstance() + assertFailsWith( + block = { + schema.validate( + "foo", + configuration + ) + } + ) + } + + @Test + fun testAnIntegerIsNotAnArrayFails() { + // an integer is not an array + val schema = ArrayTypeMatchesArrays.ArrayTypeMatchesArrays1.getInstance() + assertFailsWith( + block = { + schema.validate( + 1, + configuration + ) + } + ) + } + + @Test + fun testAnObjectIsNotAnArrayFails() { + // an object is not an array + val schema = ArrayTypeMatchesArrays.ArrayTypeMatchesArrays1.getInstance() + assertFailsWith( + block = { + schema.validate( + mapOf( + ), + configuration + ) + } + ) + } +} diff --git a/samples/client/3_1_0_unit_test/kotlin/src/test/kotlin/org/openapijsonschematools/client/components/schemas/BooleanTypeMatchesBooleansTest.kt b/samples/client/3_1_0_unit_test/kotlin/src/test/kotlin/org/openapijsonschematools/client/components/schemas/BooleanTypeMatchesBooleansTest.kt new file mode 100644 index 00000000000..c9fb755da34 --- /dev/null +++ b/samples/client/3_1_0_unit_test/kotlin/src/test/kotlin/org/openapijsonschematools/client/components/schemas/BooleanTypeMatchesBooleansTest.kt @@ -0,0 +1,148 @@ +package org.openapijsonschematools.client.components.schemas + +import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags +import org.openapijsonschematools.client.configurations.SchemaConfiguration +import org.openapijsonschematools.client.exceptions.ValidationException + +import kotlin.test.Test +import kotlin.test.assertFailsWith + +class BooleanTypeMatchesBooleansTest { + companion object { + val configuration = SchemaConfiguration(JsonSchemaKeywordFlags.Builder().format().build()) + } + + @Test + fun testAFloatIsNotABooleanFails() { + // a float is not a boolean + val schema = BooleanTypeMatchesBooleans.BooleanTypeMatchesBooleans1.getInstance() + assertFailsWith( + block = { + schema.validate( + 1.1, + configuration + ) + } + ) + } + + @Test + fun testAStringIsNotABooleanFails() { + // a string is not a boolean + val schema = BooleanTypeMatchesBooleans.BooleanTypeMatchesBooleans1.getInstance() + assertFailsWith( + block = { + schema.validate( + "foo", + configuration + ) + } + ) + } + + @Test + fun testFalseIsABooleanPasses() { + // false is a boolean + val schema = BooleanTypeMatchesBooleans.BooleanTypeMatchesBooleans1.getInstance() + schema.validate( + false, + configuration + ) + } + + @Test + fun testTrueIsABooleanPasses() { + // true is a boolean + val schema = BooleanTypeMatchesBooleans.BooleanTypeMatchesBooleans1.getInstance() + schema.validate( + true, + configuration + ) + } + + @Test + fun testAnObjectIsNotABooleanFails() { + // an object is not a boolean + val schema = BooleanTypeMatchesBooleans.BooleanTypeMatchesBooleans1.getInstance() + assertFailsWith( + block = { + schema.validate( + mapOf( + ), + configuration + ) + } + ) + } + + @Test + fun testAnArrayIsNotABooleanFails() { + // an array is not a boolean + val schema = BooleanTypeMatchesBooleans.BooleanTypeMatchesBooleans1.getInstance() + assertFailsWith( + block = { + schema.validate( + listOf( + ), + configuration + ) + } + ) + } + + @Test + fun testNullIsNotABooleanFails() { + // null is not a boolean + val schema = BooleanTypeMatchesBooleans.BooleanTypeMatchesBooleans1.getInstance() + assertFailsWith( + block = { + schema.validate( + null, + configuration + ) + } + ) + } + + @Test + fun testAnIntegerIsNotABooleanFails() { + // an integer is not a boolean + val schema = BooleanTypeMatchesBooleans.BooleanTypeMatchesBooleans1.getInstance() + assertFailsWith( + block = { + schema.validate( + 1, + configuration + ) + } + ) + } + + @Test + fun testZeroIsNotABooleanFails() { + // zero is not a boolean + val schema = BooleanTypeMatchesBooleans.BooleanTypeMatchesBooleans1.getInstance() + assertFailsWith( + block = { + schema.validate( + 0, + configuration + ) + } + ) + } + + @Test + fun testAnEmptyStringIsNotABooleanFails() { + // an empty string is not a boolean + val schema = BooleanTypeMatchesBooleans.BooleanTypeMatchesBooleans1.getInstance() + assertFailsWith( + block = { + schema.validate( + "", + configuration + ) + } + ) + } +} diff --git a/samples/client/3_1_0_unit_test/kotlin/src/test/kotlin/org/openapijsonschematools/client/components/schemas/ByIntTest.kt b/samples/client/3_1_0_unit_test/kotlin/src/test/kotlin/org/openapijsonschematools/client/components/schemas/ByIntTest.kt new file mode 100644 index 00000000000..89bd4860dd8 --- /dev/null +++ b/samples/client/3_1_0_unit_test/kotlin/src/test/kotlin/org/openapijsonschematools/client/components/schemas/ByIntTest.kt @@ -0,0 +1,48 @@ +package org.openapijsonschematools.client.components.schemas + +import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags +import org.openapijsonschematools.client.configurations.SchemaConfiguration +import org.openapijsonschematools.client.exceptions.ValidationException + +import kotlin.test.Test +import kotlin.test.assertFailsWith + +class ByIntTest { + companion object { + val configuration = SchemaConfiguration(JsonSchemaKeywordFlags.Builder().format().build()) + } + + @Test + fun testIntByIntFailFails() { + // int by int fail + val schema = ByInt.ByInt1.getInstance() + assertFailsWith( + block = { + schema.validate( + 7, + configuration + ) + } + ) + } + + @Test + fun testIntByIntPasses() { + // int by int + val schema = ByInt.ByInt1.getInstance() + schema.validate( + 10, + configuration + ) + } + + @Test + fun testIgnoresNonNumbersPasses() { + // ignores non-numbers + val schema = ByInt.ByInt1.getInstance() + schema.validate( + "foo", + configuration + ) + } +} diff --git a/samples/client/3_1_0_unit_test/kotlin/src/test/kotlin/org/openapijsonschematools/client/components/schemas/ByNumberTest.kt b/samples/client/3_1_0_unit_test/kotlin/src/test/kotlin/org/openapijsonschematools/client/components/schemas/ByNumberTest.kt new file mode 100644 index 00000000000..a6fd5fe3f47 --- /dev/null +++ b/samples/client/3_1_0_unit_test/kotlin/src/test/kotlin/org/openapijsonschematools/client/components/schemas/ByNumberTest.kt @@ -0,0 +1,48 @@ +package org.openapijsonschematools.client.components.schemas + +import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags +import org.openapijsonschematools.client.configurations.SchemaConfiguration +import org.openapijsonschematools.client.exceptions.ValidationException + +import kotlin.test.Test +import kotlin.test.assertFailsWith + +class ByNumberTest { + companion object { + val configuration = SchemaConfiguration(JsonSchemaKeywordFlags.Builder().format().build()) + } + + @Test + fun test35IsNotMultipleOf15Fails() { + // 35 is not multiple of 1.5 + val schema = ByNumber.ByNumber1.getInstance() + assertFailsWith( + block = { + schema.validate( + 35, + configuration + ) + } + ) + } + + @Test + fun test45IsMultipleOf15Passes() { + // 4.5 is multiple of 1.5 + val schema = ByNumber.ByNumber1.getInstance() + schema.validate( + 4.5, + configuration + ) + } + + @Test + fun testZeroIsMultipleOfAnythingPasses() { + // zero is multiple of anything + val schema = ByNumber.ByNumber1.getInstance() + schema.validate( + 0, + configuration + ) + } +} diff --git a/samples/client/3_1_0_unit_test/kotlin/src/test/kotlin/org/openapijsonschematools/client/components/schemas/BySmallNumberTest.kt b/samples/client/3_1_0_unit_test/kotlin/src/test/kotlin/org/openapijsonschematools/client/components/schemas/BySmallNumberTest.kt new file mode 100644 index 00000000000..f6fc84b9514 --- /dev/null +++ b/samples/client/3_1_0_unit_test/kotlin/src/test/kotlin/org/openapijsonschematools/client/components/schemas/BySmallNumberTest.kt @@ -0,0 +1,38 @@ +package org.openapijsonschematools.client.components.schemas + +import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags +import org.openapijsonschematools.client.configurations.SchemaConfiguration +import org.openapijsonschematools.client.exceptions.ValidationException + +import kotlin.test.Test +import kotlin.test.assertFailsWith + +class BySmallNumberTest { + companion object { + val configuration = SchemaConfiguration(JsonSchemaKeywordFlags.Builder().format().build()) + } + + @Test + fun test000751IsNotMultipleOf00001Fails() { + // 0.00751 is not multiple of 0.0001 + val schema = BySmallNumber.BySmallNumber1.getInstance() + assertFailsWith( + block = { + schema.validate( + 0.00751, + configuration + ) + } + ) + } + + @Test + fun test00075IsMultipleOf00001Passes() { + // 0.0075 is multiple of 0.0001 + val schema = BySmallNumber.BySmallNumber1.getInstance() + schema.validate( + 0.0075, + configuration + ) + } +} diff --git a/samples/client/3_1_0_unit_test/kotlin/src/test/kotlin/org/openapijsonschematools/client/components/schemas/ConstNulCharactersInStringsTest.kt b/samples/client/3_1_0_unit_test/kotlin/src/test/kotlin/org/openapijsonschematools/client/components/schemas/ConstNulCharactersInStringsTest.kt new file mode 100644 index 00000000000..6b2830093e7 --- /dev/null +++ b/samples/client/3_1_0_unit_test/kotlin/src/test/kotlin/org/openapijsonschematools/client/components/schemas/ConstNulCharactersInStringsTest.kt @@ -0,0 +1,38 @@ +package org.openapijsonschematools.client.components.schemas + +import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags +import org.openapijsonschematools.client.configurations.SchemaConfiguration +import org.openapijsonschematools.client.exceptions.ValidationException + +import kotlin.test.Test +import kotlin.test.assertFailsWith + +class ConstNulCharactersInStringsTest { + companion object { + val configuration = SchemaConfiguration(JsonSchemaKeywordFlags.Builder().format().build()) + } + + @Test + fun testMatchStringWithNulPasses() { + // match string with nul + val schema = ConstNulCharactersInStrings.ConstNulCharactersInStrings1.getInstance() + schema.validate( + "hello\u0000there", + configuration + ) + } + + @Test + fun testDoNotMatchStringLackingNulFails() { + // do not match string lacking nul + val schema = ConstNulCharactersInStrings.ConstNulCharactersInStrings1.getInstance() + assertFailsWith( + block = { + schema.validate( + "hellothere", + configuration + ) + } + ) + } +} diff --git a/samples/client/3_1_0_unit_test/kotlin/src/test/kotlin/org/openapijsonschematools/client/components/schemas/ContainsKeywordValidationTest.kt b/samples/client/3_1_0_unit_test/kotlin/src/test/kotlin/org/openapijsonschematools/client/components/schemas/ContainsKeywordValidationTest.kt new file mode 100644 index 00000000000..bddb82e3b65 --- /dev/null +++ b/samples/client/3_1_0_unit_test/kotlin/src/test/kotlin/org/openapijsonschematools/client/components/schemas/ContainsKeywordValidationTest.kt @@ -0,0 +1,101 @@ +package org.openapijsonschematools.client.components.schemas + +import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags +import org.openapijsonschematools.client.configurations.SchemaConfiguration +import org.openapijsonschematools.client.exceptions.ValidationException + +import kotlin.test.Test +import kotlin.test.assertFailsWith + +class ContainsKeywordValidationTest { + companion object { + val configuration = SchemaConfiguration(JsonSchemaKeywordFlags.Builder().format().build()) + } + + @Test + fun testArrayWithTwoItemsMatchingSchema56IsValidPasses() { + // array with two items matching schema (5, 6) is valid + val schema = ContainsKeywordValidation.ContainsKeywordValidation1.getInstance() + schema.validate( + listOf( + 3, + 4, + 5, + 6 + ), + configuration + ) + } + + @Test + fun testNotArrayIsValidPasses() { + // not array is valid + val schema = ContainsKeywordValidation.ContainsKeywordValidation1.getInstance() + schema.validate( + mapOf( + ), + configuration + ) + } + + @Test + fun testArrayWithItemMatchingSchema5IsValidPasses() { + // array with item matching schema (5) is valid + val schema = ContainsKeywordValidation.ContainsKeywordValidation1.getInstance() + schema.validate( + listOf( + 3, + 4, + 5 + ), + configuration + ) + } + + @Test + fun testArrayWithItemMatchingSchema6IsValidPasses() { + // array with item matching schema (6) is valid + val schema = ContainsKeywordValidation.ContainsKeywordValidation1.getInstance() + schema.validate( + listOf( + 3, + 4, + 6 + ), + configuration + ) + } + + @Test + fun testArrayWithoutItemsMatchingSchemaIsInvalidFails() { + // array without items matching schema is invalid + val schema = ContainsKeywordValidation.ContainsKeywordValidation1.getInstance() + assertFailsWith( + block = { + schema.validate( + listOf( + 2, + 3, + 4 + ), + configuration + ) + } + ) + } + + @Test + fun testEmptyArrayIsInvalidFails() { + // empty array is invalid + val schema = ContainsKeywordValidation.ContainsKeywordValidation1.getInstance() + assertFailsWith( + block = { + schema.validate( + listOf( + ), + configuration + ) + } + ) + } +} diff --git a/samples/client/3_1_0_unit_test/kotlin/src/test/kotlin/org/openapijsonschematools/client/components/schemas/ContainsWithNullInstanceElementsTest.kt b/samples/client/3_1_0_unit_test/kotlin/src/test/kotlin/org/openapijsonschematools/client/components/schemas/ContainsWithNullInstanceElementsTest.kt new file mode 100644 index 00000000000..6a0b9ba9e20 --- /dev/null +++ b/samples/client/3_1_0_unit_test/kotlin/src/test/kotlin/org/openapijsonschematools/client/components/schemas/ContainsWithNullInstanceElementsTest.kt @@ -0,0 +1,26 @@ +package org.openapijsonschematools.client.components.schemas + +import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags +import org.openapijsonschematools.client.configurations.SchemaConfiguration +import org.openapijsonschematools.client.exceptions.ValidationException + +import kotlin.test.Test +import kotlin.test.assertFailsWith + +class ContainsWithNullInstanceElementsTest { + companion object { + val configuration = SchemaConfiguration(JsonSchemaKeywordFlags.Builder().format().build()) + } + + @Test + fun testAllowsNullItemsPasses() { + // allows null items + val schema = ContainsWithNullInstanceElements.ContainsWithNullInstanceElements1.getInstance() + schema.validate( + listOf( + null + ), + configuration + ) + } +} diff --git a/samples/client/3_1_0_unit_test/kotlin/src/test/kotlin/org/openapijsonschematools/client/components/schemas/DateFormatTest.kt b/samples/client/3_1_0_unit_test/kotlin/src/test/kotlin/org/openapijsonschematools/client/components/schemas/DateFormatTest.kt new file mode 100644 index 00000000000..562bbad107a --- /dev/null +++ b/samples/client/3_1_0_unit_test/kotlin/src/test/kotlin/org/openapijsonschematools/client/components/schemas/DateFormatTest.kt @@ -0,0 +1,86 @@ +package org.openapijsonschematools.client.components.schemas + +import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags +import org.openapijsonschematools.client.configurations.SchemaConfiguration +import org.openapijsonschematools.client.exceptions.ValidationException + +import kotlin.test.Test +import kotlin.test.assertFailsWith + +class DateFormatTest { + companion object { + val configuration = SchemaConfiguration(JsonSchemaKeywordFlags.Builder().format().build()) + } + + @Test + fun testAllStringFormatsIgnoreIntegersPasses() { + // all string formats ignore integers + val schema = DateFormat.DateFormat1.getInstance() + schema.validate( + 12, + configuration + ) + } + + @Test + fun testAllStringFormatsIgnoreNullsPasses() { + // all string formats ignore nulls + val schema = DateFormat.DateFormat1.getInstance() + schema.validate( + null, + configuration + ) + } + + @Test + fun testAllStringFormatsIgnoreObjectsPasses() { + // all string formats ignore objects + val schema = DateFormat.DateFormat1.getInstance() + schema.validate( + mapOf( + ), + configuration + ) + } + + @Test + fun testInvalidDateStringIsOnlyAnAnnotationByDefaultPasses() { + // invalid date string is only an annotation by default + val schema = DateFormat.DateFormat1.getInstance() + schema.validate( + "06/19/1963", + configuration + ) + } + + @Test + fun testAllStringFormatsIgnoreFloatsPasses() { + // all string formats ignore floats + val schema = DateFormat.DateFormat1.getInstance() + schema.validate( + 13.7, + configuration + ) + } + + @Test + fun testAllStringFormatsIgnoreArraysPasses() { + // all string formats ignore arrays + val schema = DateFormat.DateFormat1.getInstance() + schema.validate( + listOf( + ), + configuration + ) + } + + @Test + fun testAllStringFormatsIgnoreBooleansPasses() { + // all string formats ignore booleans + val schema = DateFormat.DateFormat1.getInstance() + schema.validate( + false, + configuration + ) + } +} diff --git a/samples/client/3_1_0_unit_test/kotlin/src/test/kotlin/org/openapijsonschematools/client/components/schemas/DateTimeFormatTest.kt b/samples/client/3_1_0_unit_test/kotlin/src/test/kotlin/org/openapijsonschematools/client/components/schemas/DateTimeFormatTest.kt new file mode 100644 index 00000000000..cd94c25bf62 --- /dev/null +++ b/samples/client/3_1_0_unit_test/kotlin/src/test/kotlin/org/openapijsonschematools/client/components/schemas/DateTimeFormatTest.kt @@ -0,0 +1,86 @@ +package org.openapijsonschematools.client.components.schemas + +import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags +import org.openapijsonschematools.client.configurations.SchemaConfiguration +import org.openapijsonschematools.client.exceptions.ValidationException + +import kotlin.test.Test +import kotlin.test.assertFailsWith + +class DateTimeFormatTest { + companion object { + val configuration = SchemaConfiguration(JsonSchemaKeywordFlags.Builder().format().build()) + } + + @Test + fun testAllStringFormatsIgnoreIntegersPasses() { + // all string formats ignore integers + val schema = DateTimeFormat.DateTimeFormat1.getInstance() + schema.validate( + 12, + configuration + ) + } + + @Test + fun testInvalidDateTimeStringIsOnlyAnAnnotationByDefaultPasses() { + // invalid date-time string is only an annotation by default + val schema = DateTimeFormat.DateTimeFormat1.getInstance() + schema.validate( + "1990-02-31T15:59:60.123-08:00", + configuration + ) + } + + @Test + fun testAllStringFormatsIgnoreNullsPasses() { + // all string formats ignore nulls + val schema = DateTimeFormat.DateTimeFormat1.getInstance() + schema.validate( + null, + configuration + ) + } + + @Test + fun testAllStringFormatsIgnoreObjectsPasses() { + // all string formats ignore objects + val schema = DateTimeFormat.DateTimeFormat1.getInstance() + schema.validate( + mapOf( + ), + configuration + ) + } + + @Test + fun testAllStringFormatsIgnoreFloatsPasses() { + // all string formats ignore floats + val schema = DateTimeFormat.DateTimeFormat1.getInstance() + schema.validate( + 13.7, + configuration + ) + } + + @Test + fun testAllStringFormatsIgnoreArraysPasses() { + // all string formats ignore arrays + val schema = DateTimeFormat.DateTimeFormat1.getInstance() + schema.validate( + listOf( + ), + configuration + ) + } + + @Test + fun testAllStringFormatsIgnoreBooleansPasses() { + // all string formats ignore booleans + val schema = DateTimeFormat.DateTimeFormat1.getInstance() + schema.validate( + false, + configuration + ) + } +} diff --git a/samples/client/3_1_0_unit_test/kotlin/src/test/kotlin/org/openapijsonschematools/client/components/schemas/DependentSchemasDependenciesWithEscapedCharactersTest.kt b/samples/client/3_1_0_unit_test/kotlin/src/test/kotlin/org/openapijsonschematools/client/components/schemas/DependentSchemasDependenciesWithEscapedCharactersTest.kt new file mode 100644 index 00000000000..89555d37407 --- /dev/null +++ b/samples/client/3_1_0_unit_test/kotlin/src/test/kotlin/org/openapijsonschematools/client/components/schemas/DependentSchemasDependenciesWithEscapedCharactersTest.kt @@ -0,0 +1,107 @@ +package org.openapijsonschematools.client.components.schemas + +import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags +import org.openapijsonschematools.client.configurations.SchemaConfiguration +import org.openapijsonschematools.client.exceptions.ValidationException + +import kotlin.test.Test +import kotlin.test.assertFailsWith + +class DependentSchemasDependenciesWithEscapedCharactersTest { + companion object { + val configuration = SchemaConfiguration(JsonSchemaKeywordFlags.Builder().format().build()) + } + + @Test + fun testQuotedQuoteInvalidUnderDependentSchemaFails() { + // quoted quote invalid under dependent schema + val schema = DependentSchemasDependenciesWithEscapedCharacters.DependentSchemasDependenciesWithEscapedCharacters1.getInstance() + assertFailsWith( + block = { + schema.validate( + mapOf( + Pair( + "foo'bar", + 1 + ) + ), + configuration + ) + } + ) + } + + @Test + fun testQuotedTabInvalidUnderDependentSchemaFails() { + // quoted tab invalid under dependent schema + val schema = DependentSchemasDependenciesWithEscapedCharacters.DependentSchemasDependenciesWithEscapedCharacters1.getInstance() + assertFailsWith( + block = { + schema.validate( + mapOf( + Pair( + "foo\tbar", + 1 + ), + Pair( + "a", + 2 + ) + ), + configuration + ) + } + ) + } + + @Test + fun testQuotedTabPasses() { + // quoted tab + val schema = DependentSchemasDependenciesWithEscapedCharacters.DependentSchemasDependenciesWithEscapedCharacters1.getInstance() + schema.validate( + mapOf( + Pair( + "foo\tbar", + 1 + ), + Pair( + "a", + 2 + ), + Pair( + "b", + 3 + ), + Pair( + "c", + 4 + ) + ), + configuration + ) + } + + @Test + fun testQuotedQuoteFails() { + // quoted quote + val schema = DependentSchemasDependenciesWithEscapedCharacters.DependentSchemasDependenciesWithEscapedCharacters1.getInstance() + assertFailsWith( + block = { + schema.validate( + mapOf( + Pair( + "foo'bar", + mapOf( + Pair( + "foo\"bar", + 1 + ) + ) + ) + ), + configuration + ) + } + ) + } +} diff --git a/samples/client/3_1_0_unit_test/kotlin/src/test/kotlin/org/openapijsonschematools/client/components/schemas/DependentSchemasDependentSubschemaIncompatibleWithRootTest.kt b/samples/client/3_1_0_unit_test/kotlin/src/test/kotlin/org/openapijsonschematools/client/components/schemas/DependentSchemasDependentSubschemaIncompatibleWithRootTest.kt new file mode 100644 index 00000000000..025f525c434 --- /dev/null +++ b/samples/client/3_1_0_unit_test/kotlin/src/test/kotlin/org/openapijsonschematools/client/components/schemas/DependentSchemasDependentSubschemaIncompatibleWithRootTest.kt @@ -0,0 +1,86 @@ +package org.openapijsonschematools.client.components.schemas + +import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags +import org.openapijsonschematools.client.configurations.SchemaConfiguration +import org.openapijsonschematools.client.exceptions.ValidationException + +import kotlin.test.Test +import kotlin.test.assertFailsWith + +class DependentSchemasDependentSubschemaIncompatibleWithRootTest { + companion object { + val configuration = SchemaConfiguration(JsonSchemaKeywordFlags.Builder().format().build()) + } + + @Test + fun testMatchesRootFails() { + // matches root + val schema = DependentSchemasDependentSubschemaIncompatibleWithRoot.DependentSchemasDependentSubschemaIncompatibleWithRoot1.getInstance() + assertFailsWith( + block = { + schema.validate( + mapOf( + Pair( + "foo", + 1 + ) + ), + configuration + ) + } + ) + } + + @Test + fun testMatchesDependencyPasses() { + // matches dependency + val schema = DependentSchemasDependentSubschemaIncompatibleWithRoot.DependentSchemasDependentSubschemaIncompatibleWithRoot1.getInstance() + schema.validate( + mapOf( + Pair( + "bar", + 1 + ) + ), + configuration + ) + } + + @Test + fun testNoDependencyPasses() { + // no dependency + val schema = DependentSchemasDependentSubschemaIncompatibleWithRoot.DependentSchemasDependentSubschemaIncompatibleWithRoot1.getInstance() + schema.validate( + mapOf( + Pair( + "baz", + 1 + ) + ), + configuration + ) + } + + @Test + fun testMatchesBothFails() { + // matches both + val schema = DependentSchemasDependentSubschemaIncompatibleWithRoot.DependentSchemasDependentSubschemaIncompatibleWithRoot1.getInstance() + assertFailsWith( + block = { + schema.validate( + mapOf( + Pair( + "foo", + 1 + ), + Pair( + "bar", + 2 + ) + ), + configuration + ) + } + ) + } +} diff --git a/samples/client/3_1_0_unit_test/kotlin/src/test/kotlin/org/openapijsonschematools/client/components/schemas/DependentSchemasSingleDependencyTest.kt b/samples/client/3_1_0_unit_test/kotlin/src/test/kotlin/org/openapijsonschematools/client/components/schemas/DependentSchemasSingleDependencyTest.kt new file mode 100644 index 00000000000..d36a5ae6a8f --- /dev/null +++ b/samples/client/3_1_0_unit_test/kotlin/src/test/kotlin/org/openapijsonschematools/client/components/schemas/DependentSchemasSingleDependencyTest.kt @@ -0,0 +1,149 @@ +package org.openapijsonschematools.client.components.schemas + +import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags +import org.openapijsonschematools.client.configurations.SchemaConfiguration +import org.openapijsonschematools.client.exceptions.ValidationException + +import kotlin.test.Test +import kotlin.test.assertFailsWith + +class DependentSchemasSingleDependencyTest { + companion object { + val configuration = SchemaConfiguration(JsonSchemaKeywordFlags.Builder().format().build()) + } + + @Test + fun testWrongTypeFails() { + // wrong type + val schema = DependentSchemasSingleDependency.DependentSchemasSingleDependency1.getInstance() + assertFailsWith( + block = { + schema.validate( + mapOf( + Pair( + "foo", + "quux" + ), + Pair( + "bar", + 2 + ) + ), + configuration + ) + } + ) + } + + @Test + fun testValidPasses() { + // valid + val schema = DependentSchemasSingleDependency.DependentSchemasSingleDependency1.getInstance() + schema.validate( + mapOf( + Pair( + "foo", + 1 + ), + Pair( + "bar", + 2 + ) + ), + configuration + ) + } + + @Test + fun testNoDependencyPasses() { + // no dependency + val schema = DependentSchemasSingleDependency.DependentSchemasSingleDependency1.getInstance() + schema.validate( + mapOf( + Pair( + "foo", + "quux" + ) + ), + configuration + ) + } + + @Test + fun testIgnoresOtherNonObjectsPasses() { + // ignores other non-objects + val schema = DependentSchemasSingleDependency.DependentSchemasSingleDependency1.getInstance() + schema.validate( + 12, + configuration + ) + } + + @Test + fun testIgnoresArraysPasses() { + // ignores arrays + val schema = DependentSchemasSingleDependency.DependentSchemasSingleDependency1.getInstance() + schema.validate( + listOf( + "bar" + ), + configuration + ) + } + + @Test + fun testWrongTypeBothFails() { + // wrong type both + val schema = DependentSchemasSingleDependency.DependentSchemasSingleDependency1.getInstance() + assertFailsWith( + block = { + schema.validate( + mapOf( + Pair( + "foo", + "quux" + ), + Pair( + "bar", + "quux" + ) + ), + configuration + ) + } + ) + } + + @Test + fun testIgnoresStringsPasses() { + // ignores strings + val schema = DependentSchemasSingleDependency.DependentSchemasSingleDependency1.getInstance() + schema.validate( + "foobar", + configuration + ) + } + + @Test + fun testWrongTypeOtherFails() { + // wrong type other + val schema = DependentSchemasSingleDependency.DependentSchemasSingleDependency1.getInstance() + assertFailsWith( + block = { + schema.validate( + mapOf( + Pair( + "foo", + 2 + ), + Pair( + "bar", + "quux" + ) + ), + configuration + ) + } + ) + } +} diff --git a/samples/client/3_1_0_unit_test/kotlin/src/test/kotlin/org/openapijsonschematools/client/components/schemas/DurationFormatTest.kt b/samples/client/3_1_0_unit_test/kotlin/src/test/kotlin/org/openapijsonschematools/client/components/schemas/DurationFormatTest.kt new file mode 100644 index 00000000000..828493e7967 --- /dev/null +++ b/samples/client/3_1_0_unit_test/kotlin/src/test/kotlin/org/openapijsonschematools/client/components/schemas/DurationFormatTest.kt @@ -0,0 +1,86 @@ +package org.openapijsonschematools.client.components.schemas + +import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags +import org.openapijsonschematools.client.configurations.SchemaConfiguration +import org.openapijsonschematools.client.exceptions.ValidationException + +import kotlin.test.Test +import kotlin.test.assertFailsWith + +class DurationFormatTest { + companion object { + val configuration = SchemaConfiguration(JsonSchemaKeywordFlags.Builder().format().build()) + } + + @Test + fun testAllStringFormatsIgnoreIntegersPasses() { + // all string formats ignore integers + val schema = DurationFormat.DurationFormat1.getInstance() + schema.validate( + 12, + configuration + ) + } + + @Test + fun testAllStringFormatsIgnoreNullsPasses() { + // all string formats ignore nulls + val schema = DurationFormat.DurationFormat1.getInstance() + schema.validate( + null, + configuration + ) + } + + @Test + fun testAllStringFormatsIgnoreObjectsPasses() { + // all string formats ignore objects + val schema = DurationFormat.DurationFormat1.getInstance() + schema.validate( + mapOf( + ), + configuration + ) + } + + @Test + fun testInvalidDurationStringIsOnlyAnAnnotationByDefaultPasses() { + // invalid duration string is only an annotation by default + val schema = DurationFormat.DurationFormat1.getInstance() + schema.validate( + "PT1D", + configuration + ) + } + + @Test + fun testAllStringFormatsIgnoreFloatsPasses() { + // all string formats ignore floats + val schema = DurationFormat.DurationFormat1.getInstance() + schema.validate( + 13.7, + configuration + ) + } + + @Test + fun testAllStringFormatsIgnoreArraysPasses() { + // all string formats ignore arrays + val schema = DurationFormat.DurationFormat1.getInstance() + schema.validate( + listOf( + ), + configuration + ) + } + + @Test + fun testAllStringFormatsIgnoreBooleansPasses() { + // all string formats ignore booleans + val schema = DurationFormat.DurationFormat1.getInstance() + schema.validate( + false, + configuration + ) + } +} diff --git a/samples/client/3_1_0_unit_test/kotlin/src/test/kotlin/org/openapijsonschematools/client/components/schemas/EmailFormatTest.kt b/samples/client/3_1_0_unit_test/kotlin/src/test/kotlin/org/openapijsonschematools/client/components/schemas/EmailFormatTest.kt new file mode 100644 index 00000000000..3da34bea4dd --- /dev/null +++ b/samples/client/3_1_0_unit_test/kotlin/src/test/kotlin/org/openapijsonschematools/client/components/schemas/EmailFormatTest.kt @@ -0,0 +1,86 @@ +package org.openapijsonschematools.client.components.schemas + +import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags +import org.openapijsonschematools.client.configurations.SchemaConfiguration +import org.openapijsonschematools.client.exceptions.ValidationException + +import kotlin.test.Test +import kotlin.test.assertFailsWith + +class EmailFormatTest { + companion object { + val configuration = SchemaConfiguration(JsonSchemaKeywordFlags.Builder().format().build()) + } + + @Test + fun testAllStringFormatsIgnoreIntegersPasses() { + // all string formats ignore integers + val schema = EmailFormat.EmailFormat1.getInstance() + schema.validate( + 12, + configuration + ) + } + + @Test + fun testAllStringFormatsIgnoreNullsPasses() { + // all string formats ignore nulls + val schema = EmailFormat.EmailFormat1.getInstance() + schema.validate( + null, + configuration + ) + } + + @Test + fun testAllStringFormatsIgnoreObjectsPasses() { + // all string formats ignore objects + val schema = EmailFormat.EmailFormat1.getInstance() + schema.validate( + mapOf( + ), + configuration + ) + } + + @Test + fun testInvalidEmailStringIsOnlyAnAnnotationByDefaultPasses() { + // invalid email string is only an annotation by default + val schema = EmailFormat.EmailFormat1.getInstance() + schema.validate( + "2962", + configuration + ) + } + + @Test + fun testAllStringFormatsIgnoreFloatsPasses() { + // all string formats ignore floats + val schema = EmailFormat.EmailFormat1.getInstance() + schema.validate( + 13.7, + configuration + ) + } + + @Test + fun testAllStringFormatsIgnoreArraysPasses() { + // all string formats ignore arrays + val schema = EmailFormat.EmailFormat1.getInstance() + schema.validate( + listOf( + ), + configuration + ) + } + + @Test + fun testAllStringFormatsIgnoreBooleansPasses() { + // all string formats ignore booleans + val schema = EmailFormat.EmailFormat1.getInstance() + schema.validate( + false, + configuration + ) + } +} diff --git a/samples/client/3_1_0_unit_test/kotlin/src/test/kotlin/org/openapijsonschematools/client/components/schemas/EmptyDependentsTest.kt b/samples/client/3_1_0_unit_test/kotlin/src/test/kotlin/org/openapijsonschematools/client/components/schemas/EmptyDependentsTest.kt new file mode 100644 index 00000000000..7099cc2f52b --- /dev/null +++ b/samples/client/3_1_0_unit_test/kotlin/src/test/kotlin/org/openapijsonschematools/client/components/schemas/EmptyDependentsTest.kt @@ -0,0 +1,50 @@ +package org.openapijsonschematools.client.components.schemas + +import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags +import org.openapijsonschematools.client.configurations.SchemaConfiguration +import org.openapijsonschematools.client.exceptions.ValidationException + +import kotlin.test.Test +import kotlin.test.assertFailsWith + +class EmptyDependentsTest { + companion object { + val configuration = SchemaConfiguration(JsonSchemaKeywordFlags.Builder().format().build()) + } + + @Test + fun testEmptyObjectPasses() { + // empty object + val schema = EmptyDependents.EmptyDependents1.getInstance() + schema.validate( + mapOf( + ), + configuration + ) + } + + @Test + fun testNonObjectIsValidPasses() { + // non-object is valid + val schema = EmptyDependents.EmptyDependents1.getInstance() + schema.validate( + 1, + configuration + ) + } + + @Test + fun testObjectWithOnePropertyPasses() { + // object with one property + val schema = EmptyDependents.EmptyDependents1.getInstance() + schema.validate( + mapOf( + Pair( + "bar", + 2 + ) + ), + configuration + ) + } +} diff --git a/samples/client/3_1_0_unit_test/kotlin/src/test/kotlin/org/openapijsonschematools/client/components/schemas/EnumWith0DoesNotMatchFalseTest.kt b/samples/client/3_1_0_unit_test/kotlin/src/test/kotlin/org/openapijsonschematools/client/components/schemas/EnumWith0DoesNotMatchFalseTest.kt new file mode 100644 index 00000000000..c398f777e9a --- /dev/null +++ b/samples/client/3_1_0_unit_test/kotlin/src/test/kotlin/org/openapijsonschematools/client/components/schemas/EnumWith0DoesNotMatchFalseTest.kt @@ -0,0 +1,48 @@ +package org.openapijsonschematools.client.components.schemas + +import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags +import org.openapijsonschematools.client.configurations.SchemaConfiguration +import org.openapijsonschematools.client.exceptions.ValidationException + +import kotlin.test.Test +import kotlin.test.assertFailsWith + +class EnumWith0DoesNotMatchFalseTest { + companion object { + val configuration = SchemaConfiguration(JsonSchemaKeywordFlags.Builder().format().build()) + } + + @Test + fun testFloatZeroIsValidPasses() { + // float zero is valid + val schema = EnumWith0DoesNotMatchFalse.EnumWith0DoesNotMatchFalse1.getInstance() + schema.validate( + 0.0, + configuration + ) + } + + @Test + fun testFalseIsInvalidFails() { + // false is invalid + val schema = EnumWith0DoesNotMatchFalse.EnumWith0DoesNotMatchFalse1.getInstance() + assertFailsWith( + block = { + schema.validate( + false, + configuration + ) + } + ) + } + + @Test + fun testIntegerZeroIsValidPasses() { + // integer zero is valid + val schema = EnumWith0DoesNotMatchFalse.EnumWith0DoesNotMatchFalse1.getInstance() + schema.validate( + 0, + configuration + ) + } +} diff --git a/samples/client/3_1_0_unit_test/kotlin/src/test/kotlin/org/openapijsonschematools/client/components/schemas/EnumWith1DoesNotMatchTrueTest.kt b/samples/client/3_1_0_unit_test/kotlin/src/test/kotlin/org/openapijsonschematools/client/components/schemas/EnumWith1DoesNotMatchTrueTest.kt new file mode 100644 index 00000000000..8ff4f796ea8 --- /dev/null +++ b/samples/client/3_1_0_unit_test/kotlin/src/test/kotlin/org/openapijsonschematools/client/components/schemas/EnumWith1DoesNotMatchTrueTest.kt @@ -0,0 +1,48 @@ +package org.openapijsonschematools.client.components.schemas + +import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags +import org.openapijsonschematools.client.configurations.SchemaConfiguration +import org.openapijsonschematools.client.exceptions.ValidationException + +import kotlin.test.Test +import kotlin.test.assertFailsWith + +class EnumWith1DoesNotMatchTrueTest { + companion object { + val configuration = SchemaConfiguration(JsonSchemaKeywordFlags.Builder().format().build()) + } + + @Test + fun testTrueIsInvalidFails() { + // true is invalid + val schema = EnumWith1DoesNotMatchTrue.EnumWith1DoesNotMatchTrue1.getInstance() + assertFailsWith( + block = { + schema.validate( + true, + configuration + ) + } + ) + } + + @Test + fun testFloatOneIsValidPasses() { + // float one is valid + val schema = EnumWith1DoesNotMatchTrue.EnumWith1DoesNotMatchTrue1.getInstance() + schema.validate( + 1.0, + configuration + ) + } + + @Test + fun testIntegerOneIsValidPasses() { + // integer one is valid + val schema = EnumWith1DoesNotMatchTrue.EnumWith1DoesNotMatchTrue1.getInstance() + schema.validate( + 1, + configuration + ) + } +} diff --git a/samples/client/3_1_0_unit_test/kotlin/src/test/kotlin/org/openapijsonschematools/client/components/schemas/EnumWithEscapedCharactersTest.kt b/samples/client/3_1_0_unit_test/kotlin/src/test/kotlin/org/openapijsonschematools/client/components/schemas/EnumWithEscapedCharactersTest.kt new file mode 100644 index 00000000000..66bd002ada2 --- /dev/null +++ b/samples/client/3_1_0_unit_test/kotlin/src/test/kotlin/org/openapijsonschematools/client/components/schemas/EnumWithEscapedCharactersTest.kt @@ -0,0 +1,48 @@ +package org.openapijsonschematools.client.components.schemas + +import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags +import org.openapijsonschematools.client.configurations.SchemaConfiguration +import org.openapijsonschematools.client.exceptions.ValidationException + +import kotlin.test.Test +import kotlin.test.assertFailsWith + +class EnumWithEscapedCharactersTest { + companion object { + val configuration = SchemaConfiguration(JsonSchemaKeywordFlags.Builder().format().build()) + } + + @Test + fun testAnotherStringIsInvalidFails() { + // another string is invalid + val schema = EnumWithEscapedCharacters.EnumWithEscapedCharacters1.getInstance() + assertFailsWith( + block = { + schema.validate( + "abc", + configuration + ) + } + ) + } + + @Test + fun testMember2IsValidPasses() { + // member 2 is valid + val schema = EnumWithEscapedCharacters.EnumWithEscapedCharacters1.getInstance() + schema.validate( + "foo\rbar", + configuration + ) + } + + @Test + fun testMember1IsValidPasses() { + // member 1 is valid + val schema = EnumWithEscapedCharacters.EnumWithEscapedCharacters1.getInstance() + schema.validate( + "foo\nbar", + configuration + ) + } +} diff --git a/samples/client/3_1_0_unit_test/kotlin/src/test/kotlin/org/openapijsonschematools/client/components/schemas/EnumWithFalseDoesNotMatch0Test.kt b/samples/client/3_1_0_unit_test/kotlin/src/test/kotlin/org/openapijsonschematools/client/components/schemas/EnumWithFalseDoesNotMatch0Test.kt new file mode 100644 index 00000000000..540c60f5577 --- /dev/null +++ b/samples/client/3_1_0_unit_test/kotlin/src/test/kotlin/org/openapijsonschematools/client/components/schemas/EnumWithFalseDoesNotMatch0Test.kt @@ -0,0 +1,52 @@ +package org.openapijsonschematools.client.components.schemas + +import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags +import org.openapijsonschematools.client.configurations.SchemaConfiguration +import org.openapijsonschematools.client.exceptions.ValidationException + +import kotlin.test.Test +import kotlin.test.assertFailsWith + +class EnumWithFalseDoesNotMatch0Test { + companion object { + val configuration = SchemaConfiguration(JsonSchemaKeywordFlags.Builder().format().build()) + } + + @Test + fun testFloatZeroIsInvalidFails() { + // float zero is invalid + val schema = EnumWithFalseDoesNotMatch0.EnumWithFalseDoesNotMatch01.getInstance() + assertFailsWith( + block = { + schema.validate( + 0.0, + configuration + ) + } + ) + } + + @Test + fun testFalseIsValidPasses() { + // false is valid + val schema = EnumWithFalseDoesNotMatch0.EnumWithFalseDoesNotMatch01.getInstance() + schema.validate( + false, + configuration + ) + } + + @Test + fun testIntegerZeroIsInvalidFails() { + // integer zero is invalid + val schema = EnumWithFalseDoesNotMatch0.EnumWithFalseDoesNotMatch01.getInstance() + assertFailsWith( + block = { + schema.validate( + 0, + configuration + ) + } + ) + } +} diff --git a/samples/client/3_1_0_unit_test/kotlin/src/test/kotlin/org/openapijsonschematools/client/components/schemas/EnumWithTrueDoesNotMatch1Test.kt b/samples/client/3_1_0_unit_test/kotlin/src/test/kotlin/org/openapijsonschematools/client/components/schemas/EnumWithTrueDoesNotMatch1Test.kt new file mode 100644 index 00000000000..4f5ca3b42fb --- /dev/null +++ b/samples/client/3_1_0_unit_test/kotlin/src/test/kotlin/org/openapijsonschematools/client/components/schemas/EnumWithTrueDoesNotMatch1Test.kt @@ -0,0 +1,52 @@ +package org.openapijsonschematools.client.components.schemas + +import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags +import org.openapijsonschematools.client.configurations.SchemaConfiguration +import org.openapijsonschematools.client.exceptions.ValidationException + +import kotlin.test.Test +import kotlin.test.assertFailsWith + +class EnumWithTrueDoesNotMatch1Test { + companion object { + val configuration = SchemaConfiguration(JsonSchemaKeywordFlags.Builder().format().build()) + } + + @Test + fun testFloatOneIsInvalidFails() { + // float one is invalid + val schema = EnumWithTrueDoesNotMatch1.EnumWithTrueDoesNotMatch11.getInstance() + assertFailsWith( + block = { + schema.validate( + 1.0, + configuration + ) + } + ) + } + + @Test + fun testIntegerOneIsInvalidFails() { + // integer one is invalid + val schema = EnumWithTrueDoesNotMatch1.EnumWithTrueDoesNotMatch11.getInstance() + assertFailsWith( + block = { + schema.validate( + 1, + configuration + ) + } + ) + } + + @Test + fun testTrueIsValidPasses() { + // true is valid + val schema = EnumWithTrueDoesNotMatch1.EnumWithTrueDoesNotMatch11.getInstance() + schema.validate( + true, + configuration + ) + } +} diff --git a/samples/client/3_1_0_unit_test/kotlin/src/test/kotlin/org/openapijsonschematools/client/components/schemas/EnumsInPropertiesTest.kt b/samples/client/3_1_0_unit_test/kotlin/src/test/kotlin/org/openapijsonschematools/client/components/schemas/EnumsInPropertiesTest.kt new file mode 100644 index 00000000000..d98a079ce00 --- /dev/null +++ b/samples/client/3_1_0_unit_test/kotlin/src/test/kotlin/org/openapijsonschematools/client/components/schemas/EnumsInPropertiesTest.kt @@ -0,0 +1,128 @@ +package org.openapijsonschematools.client.components.schemas + +import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags +import org.openapijsonschematools.client.configurations.SchemaConfiguration +import org.openapijsonschematools.client.exceptions.ValidationException + +import kotlin.test.Test +import kotlin.test.assertFailsWith + +class EnumsInPropertiesTest { + companion object { + val configuration = SchemaConfiguration(JsonSchemaKeywordFlags.Builder().format().build()) + } + + @Test + fun testWrongBarValueFails() { + // wrong bar value + val schema = EnumsInProperties.EnumsInProperties1.getInstance() + assertFailsWith( + block = { + schema.validate( + mapOf( + Pair( + "foo", + "foo" + ), + Pair( + "bar", + "bart" + ) + ), + configuration + ) + } + ) + } + + @Test + fun testWrongFooValueFails() { + // wrong foo value + val schema = EnumsInProperties.EnumsInProperties1.getInstance() + assertFailsWith( + block = { + schema.validate( + mapOf( + Pair( + "foo", + "foot" + ), + Pair( + "bar", + "bar" + ) + ), + configuration + ) + } + ) + } + + @Test + fun testMissingAllPropertiesIsInvalidFails() { + // missing all properties is invalid + val schema = EnumsInProperties.EnumsInProperties1.getInstance() + assertFailsWith( + block = { + schema.validate( + mapOf( + ), + configuration + ) + } + ) + } + + @Test + fun testBothPropertiesAreValidPasses() { + // both properties are valid + val schema = EnumsInProperties.EnumsInProperties1.getInstance() + schema.validate( + mapOf( + Pair( + "foo", + "foo" + ), + Pair( + "bar", + "bar" + ) + ), + configuration + ) + } + + @Test + fun testMissingOptionalPropertyIsValidPasses() { + // missing optional property is valid + val schema = EnumsInProperties.EnumsInProperties1.getInstance() + schema.validate( + mapOf( + Pair( + "bar", + "bar" + ) + ), + configuration + ) + } + + @Test + fun testMissingRequiredPropertyIsInvalidFails() { + // missing required property is invalid + val schema = EnumsInProperties.EnumsInProperties1.getInstance() + assertFailsWith( + block = { + schema.validate( + mapOf( + Pair( + "foo", + "foo" + ) + ), + configuration + ) + } + ) + } +} diff --git a/samples/client/3_1_0_unit_test/kotlin/src/test/kotlin/org/openapijsonschematools/client/components/schemas/ExclusivemaximumValidationTest.kt b/samples/client/3_1_0_unit_test/kotlin/src/test/kotlin/org/openapijsonschematools/client/components/schemas/ExclusivemaximumValidationTest.kt new file mode 100644 index 00000000000..e4c7fcaa212 --- /dev/null +++ b/samples/client/3_1_0_unit_test/kotlin/src/test/kotlin/org/openapijsonschematools/client/components/schemas/ExclusivemaximumValidationTest.kt @@ -0,0 +1,62 @@ +package org.openapijsonschematools.client.components.schemas + +import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags +import org.openapijsonschematools.client.configurations.SchemaConfiguration +import org.openapijsonschematools.client.exceptions.ValidationException + +import kotlin.test.Test +import kotlin.test.assertFailsWith + +class ExclusivemaximumValidationTest { + companion object { + val configuration = SchemaConfiguration(JsonSchemaKeywordFlags.Builder().format().build()) + } + + @Test + fun testBelowTheExclusivemaximumIsValidPasses() { + // below the exclusiveMaximum is valid + val schema = ExclusivemaximumValidation.ExclusivemaximumValidation1.getInstance() + schema.validate( + 2.2, + configuration + ) + } + + @Test + fun testIgnoresNonNumbersPasses() { + // ignores non-numbers + val schema = ExclusivemaximumValidation.ExclusivemaximumValidation1.getInstance() + schema.validate( + "x", + configuration + ) + } + + @Test + fun testAboveTheExclusivemaximumIsInvalidFails() { + // above the exclusiveMaximum is invalid + val schema = ExclusivemaximumValidation.ExclusivemaximumValidation1.getInstance() + assertFailsWith( + block = { + schema.validate( + 3.5, + configuration + ) + } + ) + } + + @Test + fun testBoundaryPointIsInvalidFails() { + // boundary point is invalid + val schema = ExclusivemaximumValidation.ExclusivemaximumValidation1.getInstance() + assertFailsWith( + block = { + schema.validate( + 3.0, + configuration + ) + } + ) + } +} diff --git a/samples/client/3_1_0_unit_test/kotlin/src/test/kotlin/org/openapijsonschematools/client/components/schemas/ExclusiveminimumValidationTest.kt b/samples/client/3_1_0_unit_test/kotlin/src/test/kotlin/org/openapijsonschematools/client/components/schemas/ExclusiveminimumValidationTest.kt new file mode 100644 index 00000000000..4d7b296f0d4 --- /dev/null +++ b/samples/client/3_1_0_unit_test/kotlin/src/test/kotlin/org/openapijsonschematools/client/components/schemas/ExclusiveminimumValidationTest.kt @@ -0,0 +1,62 @@ +package org.openapijsonschematools.client.components.schemas + +import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags +import org.openapijsonschematools.client.configurations.SchemaConfiguration +import org.openapijsonschematools.client.exceptions.ValidationException + +import kotlin.test.Test +import kotlin.test.assertFailsWith + +class ExclusiveminimumValidationTest { + companion object { + val configuration = SchemaConfiguration(JsonSchemaKeywordFlags.Builder().format().build()) + } + + @Test + fun testBelowTheExclusiveminimumIsInvalidFails() { + // below the exclusiveMinimum is invalid + val schema = ExclusiveminimumValidation.ExclusiveminimumValidation1.getInstance() + assertFailsWith( + block = { + schema.validate( + 0.6, + configuration + ) + } + ) + } + + @Test + fun testAboveTheExclusiveminimumIsValidPasses() { + // above the exclusiveMinimum is valid + val schema = ExclusiveminimumValidation.ExclusiveminimumValidation1.getInstance() + schema.validate( + 1.2, + configuration + ) + } + + @Test + fun testIgnoresNonNumbersPasses() { + // ignores non-numbers + val schema = ExclusiveminimumValidation.ExclusiveminimumValidation1.getInstance() + schema.validate( + "x", + configuration + ) + } + + @Test + fun testBoundaryPointIsInvalidFails() { + // boundary point is invalid + val schema = ExclusiveminimumValidation.ExclusiveminimumValidation1.getInstance() + assertFailsWith( + block = { + schema.validate( + 1.1, + configuration + ) + } + ) + } +} diff --git a/samples/client/3_1_0_unit_test/kotlin/src/test/kotlin/org/openapijsonschematools/client/components/schemas/FloatDivisionInfTest.kt b/samples/client/3_1_0_unit_test/kotlin/src/test/kotlin/org/openapijsonschematools/client/components/schemas/FloatDivisionInfTest.kt new file mode 100644 index 00000000000..427cf255abb --- /dev/null +++ b/samples/client/3_1_0_unit_test/kotlin/src/test/kotlin/org/openapijsonschematools/client/components/schemas/FloatDivisionInfTest.kt @@ -0,0 +1,28 @@ +package org.openapijsonschematools.client.components.schemas + +import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags +import org.openapijsonschematools.client.configurations.SchemaConfiguration +import org.openapijsonschematools.client.exceptions.ValidationException + +import kotlin.test.Test +import kotlin.test.assertFailsWith + +class FloatDivisionInfTest { + companion object { + val configuration = SchemaConfiguration(JsonSchemaKeywordFlags.Builder().format().build()) + } + + @Test + fun testAlwaysInvalidButNaiveImplementationsMayRaiseAnOverflowErrorFails() { + // always invalid, but naive implementations may raise an overflow error + val schema = FloatDivisionInf.FloatDivisionInf1.getInstance() + assertFailsWith( + block = { + schema.validate( + 1.0E308, + configuration + ) + } + ) + } +} diff --git a/samples/client/3_1_0_unit_test/kotlin/src/test/kotlin/org/openapijsonschematools/client/components/schemas/ForbiddenPropertyTest.kt b/samples/client/3_1_0_unit_test/kotlin/src/test/kotlin/org/openapijsonschematools/client/components/schemas/ForbiddenPropertyTest.kt new file mode 100644 index 00000000000..79c52a38bb6 --- /dev/null +++ b/samples/client/3_1_0_unit_test/kotlin/src/test/kotlin/org/openapijsonschematools/client/components/schemas/ForbiddenPropertyTest.kt @@ -0,0 +1,56 @@ +package org.openapijsonschematools.client.components.schemas + +import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags +import org.openapijsonschematools.client.configurations.SchemaConfiguration +import org.openapijsonschematools.client.exceptions.ValidationException + +import kotlin.test.Test +import kotlin.test.assertFailsWith + +class ForbiddenPropertyTest { + companion object { + val configuration = SchemaConfiguration(JsonSchemaKeywordFlags.Builder().format().build()) + } + + @Test + fun testPropertyPresentFails() { + // property present + val schema = ForbiddenProperty.ForbiddenProperty1.getInstance() + assertFailsWith( + block = { + schema.validate( + mapOf( + Pair( + "foo", + 1 + ), + Pair( + "bar", + 2 + ) + ), + configuration + ) + } + ) + } + + @Test + fun testPropertyAbsentPasses() { + // property absent + val schema = ForbiddenProperty.ForbiddenProperty1.getInstance() + schema.validate( + mapOf( + Pair( + "bar", + 1 + ), + Pair( + "baz", + 2 + ) + ), + configuration + ) + } +} diff --git a/samples/client/3_1_0_unit_test/kotlin/src/test/kotlin/org/openapijsonschematools/client/components/schemas/HostnameFormatTest.kt b/samples/client/3_1_0_unit_test/kotlin/src/test/kotlin/org/openapijsonschematools/client/components/schemas/HostnameFormatTest.kt new file mode 100644 index 00000000000..5129b597c93 --- /dev/null +++ b/samples/client/3_1_0_unit_test/kotlin/src/test/kotlin/org/openapijsonschematools/client/components/schemas/HostnameFormatTest.kt @@ -0,0 +1,86 @@ +package org.openapijsonschematools.client.components.schemas + +import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags +import org.openapijsonschematools.client.configurations.SchemaConfiguration +import org.openapijsonschematools.client.exceptions.ValidationException + +import kotlin.test.Test +import kotlin.test.assertFailsWith + +class HostnameFormatTest { + companion object { + val configuration = SchemaConfiguration(JsonSchemaKeywordFlags.Builder().format().build()) + } + + @Test + fun testAllStringFormatsIgnoreIntegersPasses() { + // all string formats ignore integers + val schema = HostnameFormat.HostnameFormat1.getInstance() + schema.validate( + 12, + configuration + ) + } + + @Test + fun testAllStringFormatsIgnoreNullsPasses() { + // all string formats ignore nulls + val schema = HostnameFormat.HostnameFormat1.getInstance() + schema.validate( + null, + configuration + ) + } + + @Test + fun testAllStringFormatsIgnoreObjectsPasses() { + // all string formats ignore objects + val schema = HostnameFormat.HostnameFormat1.getInstance() + schema.validate( + mapOf( + ), + configuration + ) + } + + @Test + fun testAllStringFormatsIgnoreFloatsPasses() { + // all string formats ignore floats + val schema = HostnameFormat.HostnameFormat1.getInstance() + schema.validate( + 13.7, + configuration + ) + } + + @Test + fun testInvalidHostnameStringIsOnlyAnAnnotationByDefaultPasses() { + // invalid hostname string is only an annotation by default + val schema = HostnameFormat.HostnameFormat1.getInstance() + schema.validate( + "-a-host-name-that-starts-with--", + configuration + ) + } + + @Test + fun testAllStringFormatsIgnoreArraysPasses() { + // all string formats ignore arrays + val schema = HostnameFormat.HostnameFormat1.getInstance() + schema.validate( + listOf( + ), + configuration + ) + } + + @Test + fun testAllStringFormatsIgnoreBooleansPasses() { + // all string formats ignore booleans + val schema = HostnameFormat.HostnameFormat1.getInstance() + schema.validate( + false, + configuration + ) + } +} diff --git a/samples/client/3_1_0_unit_test/kotlin/src/test/kotlin/org/openapijsonschematools/client/components/schemas/IdnEmailFormatTest.kt b/samples/client/3_1_0_unit_test/kotlin/src/test/kotlin/org/openapijsonschematools/client/components/schemas/IdnEmailFormatTest.kt new file mode 100644 index 00000000000..d50093b6ec5 --- /dev/null +++ b/samples/client/3_1_0_unit_test/kotlin/src/test/kotlin/org/openapijsonschematools/client/components/schemas/IdnEmailFormatTest.kt @@ -0,0 +1,86 @@ +package org.openapijsonschematools.client.components.schemas + +import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags +import org.openapijsonschematools.client.configurations.SchemaConfiguration +import org.openapijsonschematools.client.exceptions.ValidationException + +import kotlin.test.Test +import kotlin.test.assertFailsWith + +class IdnEmailFormatTest { + companion object { + val configuration = SchemaConfiguration(JsonSchemaKeywordFlags.Builder().format().build()) + } + + @Test + fun testAllStringFormatsIgnoreIntegersPasses() { + // all string formats ignore integers + val schema = IdnEmailFormat.IdnEmailFormat1.getInstance() + schema.validate( + 12, + configuration + ) + } + + @Test + fun testAllStringFormatsIgnoreNullsPasses() { + // all string formats ignore nulls + val schema = IdnEmailFormat.IdnEmailFormat1.getInstance() + schema.validate( + null, + configuration + ) + } + + @Test + fun testAllStringFormatsIgnoreObjectsPasses() { + // all string formats ignore objects + val schema = IdnEmailFormat.IdnEmailFormat1.getInstance() + schema.validate( + mapOf( + ), + configuration + ) + } + + @Test + fun testAllStringFormatsIgnoreFloatsPasses() { + // all string formats ignore floats + val schema = IdnEmailFormat.IdnEmailFormat1.getInstance() + schema.validate( + 13.7, + configuration + ) + } + + @Test + fun testInvalidIdnEmailStringIsOnlyAnAnnotationByDefaultPasses() { + // invalid idn-email string is only an annotation by default + val schema = IdnEmailFormat.IdnEmailFormat1.getInstance() + schema.validate( + "2962", + configuration + ) + } + + @Test + fun testAllStringFormatsIgnoreArraysPasses() { + // all string formats ignore arrays + val schema = IdnEmailFormat.IdnEmailFormat1.getInstance() + schema.validate( + listOf( + ), + configuration + ) + } + + @Test + fun testAllStringFormatsIgnoreBooleansPasses() { + // all string formats ignore booleans + val schema = IdnEmailFormat.IdnEmailFormat1.getInstance() + schema.validate( + false, + configuration + ) + } +} diff --git a/samples/client/3_1_0_unit_test/kotlin/src/test/kotlin/org/openapijsonschematools/client/components/schemas/IdnHostnameFormatTest.kt b/samples/client/3_1_0_unit_test/kotlin/src/test/kotlin/org/openapijsonschematools/client/components/schemas/IdnHostnameFormatTest.kt new file mode 100644 index 00000000000..9e54690f2c7 --- /dev/null +++ b/samples/client/3_1_0_unit_test/kotlin/src/test/kotlin/org/openapijsonschematools/client/components/schemas/IdnHostnameFormatTest.kt @@ -0,0 +1,86 @@ +package org.openapijsonschematools.client.components.schemas + +import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags +import org.openapijsonschematools.client.configurations.SchemaConfiguration +import org.openapijsonschematools.client.exceptions.ValidationException + +import kotlin.test.Test +import kotlin.test.assertFailsWith + +class IdnHostnameFormatTest { + companion object { + val configuration = SchemaConfiguration(JsonSchemaKeywordFlags.Builder().format().build()) + } + + @Test + fun testAllStringFormatsIgnoreIntegersPasses() { + // all string formats ignore integers + val schema = IdnHostnameFormat.IdnHostnameFormat1.getInstance() + schema.validate( + 12, + configuration + ) + } + + @Test + fun testAllStringFormatsIgnoreNullsPasses() { + // all string formats ignore nulls + val schema = IdnHostnameFormat.IdnHostnameFormat1.getInstance() + schema.validate( + null, + configuration + ) + } + + @Test + fun testAllStringFormatsIgnoreObjectsPasses() { + // all string formats ignore objects + val schema = IdnHostnameFormat.IdnHostnameFormat1.getInstance() + schema.validate( + mapOf( + ), + configuration + ) + } + + @Test + fun testAllStringFormatsIgnoreFloatsPasses() { + // all string formats ignore floats + val schema = IdnHostnameFormat.IdnHostnameFormat1.getInstance() + schema.validate( + 13.7, + configuration + ) + } + + @Test + fun testInvalidIdnHostnameStringIsOnlyAnAnnotationByDefaultPasses() { + // invalid idn-hostname string is only an annotation by default + val schema = IdnHostnameFormat.IdnHostnameFormat1.getInstance() + schema.validate( + "〮실례.테스트", + configuration + ) + } + + @Test + fun testAllStringFormatsIgnoreArraysPasses() { + // all string formats ignore arrays + val schema = IdnHostnameFormat.IdnHostnameFormat1.getInstance() + schema.validate( + listOf( + ), + configuration + ) + } + + @Test + fun testAllStringFormatsIgnoreBooleansPasses() { + // all string formats ignore booleans + val schema = IdnHostnameFormat.IdnHostnameFormat1.getInstance() + schema.validate( + false, + configuration + ) + } +} diff --git a/samples/client/3_1_0_unit_test/kotlin/src/test/kotlin/org/openapijsonschematools/client/components/schemas/IfAndElseWithoutThenTest.kt b/samples/client/3_1_0_unit_test/kotlin/src/test/kotlin/org/openapijsonschematools/client/components/schemas/IfAndElseWithoutThenTest.kt new file mode 100644 index 00000000000..5c6556adfe5 --- /dev/null +++ b/samples/client/3_1_0_unit_test/kotlin/src/test/kotlin/org/openapijsonschematools/client/components/schemas/IfAndElseWithoutThenTest.kt @@ -0,0 +1,48 @@ +package org.openapijsonschematools.client.components.schemas + +import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags +import org.openapijsonschematools.client.configurations.SchemaConfiguration +import org.openapijsonschematools.client.exceptions.ValidationException + +import kotlin.test.Test +import kotlin.test.assertFailsWith + +class IfAndElseWithoutThenTest { + companion object { + val configuration = SchemaConfiguration(JsonSchemaKeywordFlags.Builder().format().build()) + } + + @Test + fun testValidWhenIfTestPassesPasses() { + // valid when if test passes + val schema = IfAndElseWithoutThen.IfAndElseWithoutThen1.getInstance() + schema.validate( + -1, + configuration + ) + } + + @Test + fun testValidThroughElsePasses() { + // valid through else + val schema = IfAndElseWithoutThen.IfAndElseWithoutThen1.getInstance() + schema.validate( + 4, + configuration + ) + } + + @Test + fun testInvalidThroughElseFails() { + // invalid through else + val schema = IfAndElseWithoutThen.IfAndElseWithoutThen1.getInstance() + assertFailsWith( + block = { + schema.validate( + 3, + configuration + ) + } + ) + } +} diff --git a/samples/client/3_1_0_unit_test/kotlin/src/test/kotlin/org/openapijsonschematools/client/components/schemas/IfAndThenWithoutElseTest.kt b/samples/client/3_1_0_unit_test/kotlin/src/test/kotlin/org/openapijsonschematools/client/components/schemas/IfAndThenWithoutElseTest.kt new file mode 100644 index 00000000000..75d801c5fa1 --- /dev/null +++ b/samples/client/3_1_0_unit_test/kotlin/src/test/kotlin/org/openapijsonschematools/client/components/schemas/IfAndThenWithoutElseTest.kt @@ -0,0 +1,48 @@ +package org.openapijsonschematools.client.components.schemas + +import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags +import org.openapijsonschematools.client.configurations.SchemaConfiguration +import org.openapijsonschematools.client.exceptions.ValidationException + +import kotlin.test.Test +import kotlin.test.assertFailsWith + +class IfAndThenWithoutElseTest { + companion object { + val configuration = SchemaConfiguration(JsonSchemaKeywordFlags.Builder().format().build()) + } + + @Test + fun testValidThroughThenPasses() { + // valid through then + val schema = IfAndThenWithoutElse.IfAndThenWithoutElse1.getInstance() + schema.validate( + -1, + configuration + ) + } + + @Test + fun testInvalidThroughThenFails() { + // invalid through then + val schema = IfAndThenWithoutElse.IfAndThenWithoutElse1.getInstance() + assertFailsWith( + block = { + schema.validate( + -100, + configuration + ) + } + ) + } + + @Test + fun testValidWhenIfTestFailsPasses() { + // valid when if test fails + val schema = IfAndThenWithoutElse.IfAndThenWithoutElse1.getInstance() + schema.validate( + 3, + configuration + ) + } +} diff --git a/samples/client/3_1_0_unit_test/kotlin/src/test/kotlin/org/openapijsonschematools/client/components/schemas/IfAppearsAtTheEndWhenSerializedKeywordProcessingSequenceTest.kt b/samples/client/3_1_0_unit_test/kotlin/src/test/kotlin/org/openapijsonschematools/client/components/schemas/IfAppearsAtTheEndWhenSerializedKeywordProcessingSequenceTest.kt new file mode 100644 index 00000000000..9b5ecd87c6d --- /dev/null +++ b/samples/client/3_1_0_unit_test/kotlin/src/test/kotlin/org/openapijsonschematools/client/components/schemas/IfAppearsAtTheEndWhenSerializedKeywordProcessingSequenceTest.kt @@ -0,0 +1,62 @@ +package org.openapijsonschematools.client.components.schemas + +import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags +import org.openapijsonschematools.client.configurations.SchemaConfiguration +import org.openapijsonschematools.client.exceptions.ValidationException + +import kotlin.test.Test +import kotlin.test.assertFailsWith + +class IfAppearsAtTheEndWhenSerializedKeywordProcessingSequenceTest { + companion object { + val configuration = SchemaConfiguration(JsonSchemaKeywordFlags.Builder().format().build()) + } + + @Test + fun testInvalidRedirectsToElseAndFailsFails() { + // invalid redirects to else and fails + val schema = IfAppearsAtTheEndWhenSerializedKeywordProcessingSequence.IfAppearsAtTheEndWhenSerializedKeywordProcessingSequence1.getInstance() + assertFailsWith( + block = { + schema.validate( + "invalid", + configuration + ) + } + ) + } + + @Test + fun testYesRedirectsToThenAndPassesPasses() { + // yes redirects to then and passes + val schema = IfAppearsAtTheEndWhenSerializedKeywordProcessingSequence.IfAppearsAtTheEndWhenSerializedKeywordProcessingSequence1.getInstance() + schema.validate( + "yes", + configuration + ) + } + + @Test + fun testOtherRedirectsToElseAndPassesPasses() { + // other redirects to else and passes + val schema = IfAppearsAtTheEndWhenSerializedKeywordProcessingSequence.IfAppearsAtTheEndWhenSerializedKeywordProcessingSequence1.getInstance() + schema.validate( + "other", + configuration + ) + } + + @Test + fun testNoRedirectsToThenAndFailsFails() { + // no redirects to then and fails + val schema = IfAppearsAtTheEndWhenSerializedKeywordProcessingSequence.IfAppearsAtTheEndWhenSerializedKeywordProcessingSequence1.getInstance() + assertFailsWith( + block = { + schema.validate( + "no", + configuration + ) + } + ) + } +} diff --git a/samples/client/3_1_0_unit_test/kotlin/src/test/kotlin/org/openapijsonschematools/client/components/schemas/IgnoreElseWithoutIfTest.kt b/samples/client/3_1_0_unit_test/kotlin/src/test/kotlin/org/openapijsonschematools/client/components/schemas/IgnoreElseWithoutIfTest.kt new file mode 100644 index 00000000000..67c61cf0569 --- /dev/null +++ b/samples/client/3_1_0_unit_test/kotlin/src/test/kotlin/org/openapijsonschematools/client/components/schemas/IgnoreElseWithoutIfTest.kt @@ -0,0 +1,34 @@ +package org.openapijsonschematools.client.components.schemas + +import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags +import org.openapijsonschematools.client.configurations.SchemaConfiguration +import org.openapijsonschematools.client.exceptions.ValidationException + +import kotlin.test.Test +import kotlin.test.assertFailsWith + +class IgnoreElseWithoutIfTest { + companion object { + val configuration = SchemaConfiguration(JsonSchemaKeywordFlags.Builder().format().build()) + } + + @Test + fun testValidWhenInvalidAgainstLoneElsePasses() { + // valid when invalid against lone else + val schema = IgnoreElseWithoutIf.IgnoreElseWithoutIf1.getInstance() + schema.validate( + "hello", + configuration + ) + } + + @Test + fun testValidWhenValidAgainstLoneElsePasses() { + // valid when valid against lone else + val schema = IgnoreElseWithoutIf.IgnoreElseWithoutIf1.getInstance() + schema.validate( + 0, + configuration + ) + } +} diff --git a/samples/client/3_1_0_unit_test/kotlin/src/test/kotlin/org/openapijsonschematools/client/components/schemas/IgnoreIfWithoutThenOrElseTest.kt b/samples/client/3_1_0_unit_test/kotlin/src/test/kotlin/org/openapijsonschematools/client/components/schemas/IgnoreIfWithoutThenOrElseTest.kt new file mode 100644 index 00000000000..c7b4402eb56 --- /dev/null +++ b/samples/client/3_1_0_unit_test/kotlin/src/test/kotlin/org/openapijsonschematools/client/components/schemas/IgnoreIfWithoutThenOrElseTest.kt @@ -0,0 +1,34 @@ +package org.openapijsonschematools.client.components.schemas + +import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags +import org.openapijsonschematools.client.configurations.SchemaConfiguration +import org.openapijsonschematools.client.exceptions.ValidationException + +import kotlin.test.Test +import kotlin.test.assertFailsWith + +class IgnoreIfWithoutThenOrElseTest { + companion object { + val configuration = SchemaConfiguration(JsonSchemaKeywordFlags.Builder().format().build()) + } + + @Test + fun testValidWhenInvalidAgainstLoneIfPasses() { + // valid when invalid against lone if + val schema = IgnoreIfWithoutThenOrElse.IgnoreIfWithoutThenOrElse1.getInstance() + schema.validate( + "hello", + configuration + ) + } + + @Test + fun testValidWhenValidAgainstLoneIfPasses() { + // valid when valid against lone if + val schema = IgnoreIfWithoutThenOrElse.IgnoreIfWithoutThenOrElse1.getInstance() + schema.validate( + 0, + configuration + ) + } +} diff --git a/samples/client/3_1_0_unit_test/kotlin/src/test/kotlin/org/openapijsonschematools/client/components/schemas/IgnoreThenWithoutIfTest.kt b/samples/client/3_1_0_unit_test/kotlin/src/test/kotlin/org/openapijsonschematools/client/components/schemas/IgnoreThenWithoutIfTest.kt new file mode 100644 index 00000000000..d6d6639d068 --- /dev/null +++ b/samples/client/3_1_0_unit_test/kotlin/src/test/kotlin/org/openapijsonschematools/client/components/schemas/IgnoreThenWithoutIfTest.kt @@ -0,0 +1,34 @@ +package org.openapijsonschematools.client.components.schemas + +import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags +import org.openapijsonschematools.client.configurations.SchemaConfiguration +import org.openapijsonschematools.client.exceptions.ValidationException + +import kotlin.test.Test +import kotlin.test.assertFailsWith + +class IgnoreThenWithoutIfTest { + companion object { + val configuration = SchemaConfiguration(JsonSchemaKeywordFlags.Builder().format().build()) + } + + @Test + fun testValidWhenValidAgainstLoneThenPasses() { + // valid when valid against lone then + val schema = IgnoreThenWithoutIf.IgnoreThenWithoutIf1.getInstance() + schema.validate( + 0, + configuration + ) + } + + @Test + fun testValidWhenInvalidAgainstLoneThenPasses() { + // valid when invalid against lone then + val schema = IgnoreThenWithoutIf.IgnoreThenWithoutIf1.getInstance() + schema.validate( + "hello", + configuration + ) + } +} diff --git a/samples/client/3_1_0_unit_test/kotlin/src/test/kotlin/org/openapijsonschematools/client/components/schemas/IntegerTypeMatchesIntegersTest.kt b/samples/client/3_1_0_unit_test/kotlin/src/test/kotlin/org/openapijsonschematools/client/components/schemas/IntegerTypeMatchesIntegersTest.kt new file mode 100644 index 00000000000..5acb5daa6ce --- /dev/null +++ b/samples/client/3_1_0_unit_test/kotlin/src/test/kotlin/org/openapijsonschematools/client/components/schemas/IntegerTypeMatchesIntegersTest.kt @@ -0,0 +1,134 @@ +package org.openapijsonschematools.client.components.schemas + +import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags +import org.openapijsonschematools.client.configurations.SchemaConfiguration +import org.openapijsonschematools.client.exceptions.ValidationException + +import kotlin.test.Test +import kotlin.test.assertFailsWith + +class IntegerTypeMatchesIntegersTest { + companion object { + val configuration = SchemaConfiguration(JsonSchemaKeywordFlags.Builder().format().build()) + } + + @Test + fun testAnObjectIsNotAnIntegerFails() { + // an object is not an integer + val schema = IntegerTypeMatchesIntegers.IntegerTypeMatchesIntegers1.getInstance() + assertFailsWith( + block = { + schema.validate( + mapOf( + ), + configuration + ) + } + ) + } + + @Test + fun testAnArrayIsNotAnIntegerFails() { + // an array is not an integer + val schema = IntegerTypeMatchesIntegers.IntegerTypeMatchesIntegers1.getInstance() + assertFailsWith( + block = { + schema.validate( + listOf( + ), + configuration + ) + } + ) + } + + @Test + fun testNullIsNotAnIntegerFails() { + // null is not an integer + val schema = IntegerTypeMatchesIntegers.IntegerTypeMatchesIntegers1.getInstance() + assertFailsWith( + block = { + schema.validate( + null, + configuration + ) + } + ) + } + + @Test + fun testAFloatWithZeroFractionalPartIsAnIntegerPasses() { + // a float with zero fractional part is an integer + val schema = IntegerTypeMatchesIntegers.IntegerTypeMatchesIntegers1.getInstance() + schema.validate( + 1.0, + configuration + ) + } + + @Test + fun testABooleanIsNotAnIntegerFails() { + // a boolean is not an integer + val schema = IntegerTypeMatchesIntegers.IntegerTypeMatchesIntegers1.getInstance() + assertFailsWith( + block = { + schema.validate( + true, + configuration + ) + } + ) + } + + @Test + fun testAStringIsStillNotAnIntegerEvenIfItLooksLikeOneFails() { + // a string is still not an integer, even if it looks like one + val schema = IntegerTypeMatchesIntegers.IntegerTypeMatchesIntegers1.getInstance() + assertFailsWith( + block = { + schema.validate( + "1", + configuration + ) + } + ) + } + + @Test + fun testAStringIsNotAnIntegerFails() { + // a string is not an integer + val schema = IntegerTypeMatchesIntegers.IntegerTypeMatchesIntegers1.getInstance() + assertFailsWith( + block = { + schema.validate( + "foo", + configuration + ) + } + ) + } + + @Test + fun testAnIntegerIsAnIntegerPasses() { + // an integer is an integer + val schema = IntegerTypeMatchesIntegers.IntegerTypeMatchesIntegers1.getInstance() + schema.validate( + 1, + configuration + ) + } + + @Test + fun testAFloatIsNotAnIntegerFails() { + // a float is not an integer + val schema = IntegerTypeMatchesIntegers.IntegerTypeMatchesIntegers1.getInstance() + assertFailsWith( + block = { + schema.validate( + 1.1, + configuration + ) + } + ) + } +} diff --git a/samples/client/3_1_0_unit_test/kotlin/src/test/kotlin/org/openapijsonschematools/client/components/schemas/Ipv4FormatTest.kt b/samples/client/3_1_0_unit_test/kotlin/src/test/kotlin/org/openapijsonschematools/client/components/schemas/Ipv4FormatTest.kt new file mode 100644 index 00000000000..6b5989717f5 --- /dev/null +++ b/samples/client/3_1_0_unit_test/kotlin/src/test/kotlin/org/openapijsonschematools/client/components/schemas/Ipv4FormatTest.kt @@ -0,0 +1,86 @@ +package org.openapijsonschematools.client.components.schemas + +import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags +import org.openapijsonschematools.client.configurations.SchemaConfiguration +import org.openapijsonschematools.client.exceptions.ValidationException + +import kotlin.test.Test +import kotlin.test.assertFailsWith + +class Ipv4FormatTest { + companion object { + val configuration = SchemaConfiguration(JsonSchemaKeywordFlags.Builder().format().build()) + } + + @Test + fun testAllStringFormatsIgnoreIntegersPasses() { + // all string formats ignore integers + val schema = Ipv4Format.Ipv4Format1.getInstance() + schema.validate( + 12, + configuration + ) + } + + @Test + fun testAllStringFormatsIgnoreNullsPasses() { + // all string formats ignore nulls + val schema = Ipv4Format.Ipv4Format1.getInstance() + schema.validate( + null, + configuration + ) + } + + @Test + fun testAllStringFormatsIgnoreObjectsPasses() { + // all string formats ignore objects + val schema = Ipv4Format.Ipv4Format1.getInstance() + schema.validate( + mapOf( + ), + configuration + ) + } + + @Test + fun testInvalidIpv4StringIsOnlyAnAnnotationByDefaultPasses() { + // invalid ipv4 string is only an annotation by default + val schema = Ipv4Format.Ipv4Format1.getInstance() + schema.validate( + "127.0.0.0.1", + configuration + ) + } + + @Test + fun testAllStringFormatsIgnoreFloatsPasses() { + // all string formats ignore floats + val schema = Ipv4Format.Ipv4Format1.getInstance() + schema.validate( + 13.7, + configuration + ) + } + + @Test + fun testAllStringFormatsIgnoreArraysPasses() { + // all string formats ignore arrays + val schema = Ipv4Format.Ipv4Format1.getInstance() + schema.validate( + listOf( + ), + configuration + ) + } + + @Test + fun testAllStringFormatsIgnoreBooleansPasses() { + // all string formats ignore booleans + val schema = Ipv4Format.Ipv4Format1.getInstance() + schema.validate( + false, + configuration + ) + } +} diff --git a/samples/client/3_1_0_unit_test/kotlin/src/test/kotlin/org/openapijsonschematools/client/components/schemas/Ipv6FormatTest.kt b/samples/client/3_1_0_unit_test/kotlin/src/test/kotlin/org/openapijsonschematools/client/components/schemas/Ipv6FormatTest.kt new file mode 100644 index 00000000000..fc03ee62466 --- /dev/null +++ b/samples/client/3_1_0_unit_test/kotlin/src/test/kotlin/org/openapijsonschematools/client/components/schemas/Ipv6FormatTest.kt @@ -0,0 +1,86 @@ +package org.openapijsonschematools.client.components.schemas + +import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags +import org.openapijsonschematools.client.configurations.SchemaConfiguration +import org.openapijsonschematools.client.exceptions.ValidationException + +import kotlin.test.Test +import kotlin.test.assertFailsWith + +class Ipv6FormatTest { + companion object { + val configuration = SchemaConfiguration(JsonSchemaKeywordFlags.Builder().format().build()) + } + + @Test + fun testAllStringFormatsIgnoreIntegersPasses() { + // all string formats ignore integers + val schema = Ipv6Format.Ipv6Format1.getInstance() + schema.validate( + 12, + configuration + ) + } + + @Test + fun testAllStringFormatsIgnoreNullsPasses() { + // all string formats ignore nulls + val schema = Ipv6Format.Ipv6Format1.getInstance() + schema.validate( + null, + configuration + ) + } + + @Test + fun testAllStringFormatsIgnoreObjectsPasses() { + // all string formats ignore objects + val schema = Ipv6Format.Ipv6Format1.getInstance() + schema.validate( + mapOf( + ), + configuration + ) + } + + @Test + fun testInvalidIpv6StringIsOnlyAnAnnotationByDefaultPasses() { + // invalid ipv6 string is only an annotation by default + val schema = Ipv6Format.Ipv6Format1.getInstance() + schema.validate( + "12345::", + configuration + ) + } + + @Test + fun testAllStringFormatsIgnoreFloatsPasses() { + // all string formats ignore floats + val schema = Ipv6Format.Ipv6Format1.getInstance() + schema.validate( + 13.7, + configuration + ) + } + + @Test + fun testAllStringFormatsIgnoreArraysPasses() { + // all string formats ignore arrays + val schema = Ipv6Format.Ipv6Format1.getInstance() + schema.validate( + listOf( + ), + configuration + ) + } + + @Test + fun testAllStringFormatsIgnoreBooleansPasses() { + // all string formats ignore booleans + val schema = Ipv6Format.Ipv6Format1.getInstance() + schema.validate( + false, + configuration + ) + } +} diff --git a/samples/client/3_1_0_unit_test/kotlin/src/test/kotlin/org/openapijsonschematools/client/components/schemas/IriFormatTest.kt b/samples/client/3_1_0_unit_test/kotlin/src/test/kotlin/org/openapijsonschematools/client/components/schemas/IriFormatTest.kt new file mode 100644 index 00000000000..23a886305dc --- /dev/null +++ b/samples/client/3_1_0_unit_test/kotlin/src/test/kotlin/org/openapijsonschematools/client/components/schemas/IriFormatTest.kt @@ -0,0 +1,86 @@ +package org.openapijsonschematools.client.components.schemas + +import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags +import org.openapijsonschematools.client.configurations.SchemaConfiguration +import org.openapijsonschematools.client.exceptions.ValidationException + +import kotlin.test.Test +import kotlin.test.assertFailsWith + +class IriFormatTest { + companion object { + val configuration = SchemaConfiguration(JsonSchemaKeywordFlags.Builder().format().build()) + } + + @Test + fun testAllStringFormatsIgnoreIntegersPasses() { + // all string formats ignore integers + val schema = IriFormat.IriFormat1.getInstance() + schema.validate( + 12, + configuration + ) + } + + @Test + fun testAllStringFormatsIgnoreNullsPasses() { + // all string formats ignore nulls + val schema = IriFormat.IriFormat1.getInstance() + schema.validate( + null, + configuration + ) + } + + @Test + fun testAllStringFormatsIgnoreObjectsPasses() { + // all string formats ignore objects + val schema = IriFormat.IriFormat1.getInstance() + schema.validate( + mapOf( + ), + configuration + ) + } + + @Test + fun testAllStringFormatsIgnoreFloatsPasses() { + // all string formats ignore floats + val schema = IriFormat.IriFormat1.getInstance() + schema.validate( + 13.7, + configuration + ) + } + + @Test + fun testInvalidIriStringIsOnlyAnAnnotationByDefaultPasses() { + // invalid iri string is only an annotation by default + val schema = IriFormat.IriFormat1.getInstance() + schema.validate( + "http://2001:0db8:85a3:0000:0000:8a2e:0370:7334", + configuration + ) + } + + @Test + fun testAllStringFormatsIgnoreArraysPasses() { + // all string formats ignore arrays + val schema = IriFormat.IriFormat1.getInstance() + schema.validate( + listOf( + ), + configuration + ) + } + + @Test + fun testAllStringFormatsIgnoreBooleansPasses() { + // all string formats ignore booleans + val schema = IriFormat.IriFormat1.getInstance() + schema.validate( + false, + configuration + ) + } +} diff --git a/samples/client/3_1_0_unit_test/kotlin/src/test/kotlin/org/openapijsonschematools/client/components/schemas/IriReferenceFormatTest.kt b/samples/client/3_1_0_unit_test/kotlin/src/test/kotlin/org/openapijsonschematools/client/components/schemas/IriReferenceFormatTest.kt new file mode 100644 index 00000000000..dd42e1bee35 --- /dev/null +++ b/samples/client/3_1_0_unit_test/kotlin/src/test/kotlin/org/openapijsonschematools/client/components/schemas/IriReferenceFormatTest.kt @@ -0,0 +1,86 @@ +package org.openapijsonschematools.client.components.schemas + +import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags +import org.openapijsonschematools.client.configurations.SchemaConfiguration +import org.openapijsonschematools.client.exceptions.ValidationException + +import kotlin.test.Test +import kotlin.test.assertFailsWith + +class IriReferenceFormatTest { + companion object { + val configuration = SchemaConfiguration(JsonSchemaKeywordFlags.Builder().format().build()) + } + + @Test + fun testAllStringFormatsIgnoreIntegersPasses() { + // all string formats ignore integers + val schema = IriReferenceFormat.IriReferenceFormat1.getInstance() + schema.validate( + 12, + configuration + ) + } + + @Test + fun testAllStringFormatsIgnoreNullsPasses() { + // all string formats ignore nulls + val schema = IriReferenceFormat.IriReferenceFormat1.getInstance() + schema.validate( + null, + configuration + ) + } + + @Test + fun testAllStringFormatsIgnoreObjectsPasses() { + // all string formats ignore objects + val schema = IriReferenceFormat.IriReferenceFormat1.getInstance() + schema.validate( + mapOf( + ), + configuration + ) + } + + @Test + fun testInvalidIriReferenceStringIsOnlyAnAnnotationByDefaultPasses() { + // invalid iri-reference string is only an annotation by default + val schema = IriReferenceFormat.IriReferenceFormat1.getInstance() + schema.validate( + "\\\\WINDOWS\\filëßåré", + configuration + ) + } + + @Test + fun testAllStringFormatsIgnoreFloatsPasses() { + // all string formats ignore floats + val schema = IriReferenceFormat.IriReferenceFormat1.getInstance() + schema.validate( + 13.7, + configuration + ) + } + + @Test + fun testAllStringFormatsIgnoreArraysPasses() { + // all string formats ignore arrays + val schema = IriReferenceFormat.IriReferenceFormat1.getInstance() + schema.validate( + listOf( + ), + configuration + ) + } + + @Test + fun testAllStringFormatsIgnoreBooleansPasses() { + // all string formats ignore booleans + val schema = IriReferenceFormat.IriReferenceFormat1.getInstance() + schema.validate( + false, + configuration + ) + } +} diff --git a/samples/client/3_1_0_unit_test/kotlin/src/test/kotlin/org/openapijsonschematools/client/components/schemas/ItemsContainsTest.kt b/samples/client/3_1_0_unit_test/kotlin/src/test/kotlin/org/openapijsonschematools/client/components/schemas/ItemsContainsTest.kt new file mode 100644 index 00000000000..cdfd1262deb --- /dev/null +++ b/samples/client/3_1_0_unit_test/kotlin/src/test/kotlin/org/openapijsonschematools/client/components/schemas/ItemsContainsTest.kt @@ -0,0 +1,82 @@ +package org.openapijsonschematools.client.components.schemas + +import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags +import org.openapijsonschematools.client.configurations.SchemaConfiguration +import org.openapijsonschematools.client.exceptions.ValidationException + +import kotlin.test.Test +import kotlin.test.assertFailsWith + +class ItemsContainsTest { + companion object { + val configuration = SchemaConfiguration(JsonSchemaKeywordFlags.Builder().format().build()) + } + + @Test + fun testMatchesItemsDoesNotMatchContainsFails() { + // matches items, does not match contains + val schema = ItemsContains.ItemsContains1.getInstance() + assertFailsWith( + block = { + schema.validate( + listOf( + 2, + 4, + 8 + ), + configuration + ) + } + ) + } + + @Test + fun testMatchesNeitherItemsNorContainsFails() { + // matches neither items nor contains + val schema = ItemsContains.ItemsContains1.getInstance() + assertFailsWith( + block = { + schema.validate( + listOf( + 1, + 5 + ), + configuration + ) + } + ) + } + + @Test + fun testDoesNotMatchItemsMatchesContainsFails() { + // does not match items, matches contains + val schema = ItemsContains.ItemsContains1.getInstance() + assertFailsWith( + block = { + schema.validate( + listOf( + 3, + 6, + 9 + ), + configuration + ) + } + ) + } + + @Test + fun testMatchesBothItemsAndContainsPasses() { + // matches both items and contains + val schema = ItemsContains.ItemsContains1.getInstance() + schema.validate( + ItemsContains.ItemsContainsListBuilder() + .add(6) + + .add(12) + + .build(), + configuration + ) + } +} diff --git a/samples/client/3_1_0_unit_test/kotlin/src/test/kotlin/org/openapijsonschematools/client/components/schemas/ItemsDoesNotLookInApplicatorsValidCaseTest.kt b/samples/client/3_1_0_unit_test/kotlin/src/test/kotlin/org/openapijsonschematools/client/components/schemas/ItemsDoesNotLookInApplicatorsValidCaseTest.kt new file mode 100644 index 00000000000..f4afc8468bd --- /dev/null +++ b/samples/client/3_1_0_unit_test/kotlin/src/test/kotlin/org/openapijsonschematools/client/components/schemas/ItemsDoesNotLookInApplicatorsValidCaseTest.kt @@ -0,0 +1,46 @@ +package org.openapijsonschematools.client.components.schemas + +import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags +import org.openapijsonschematools.client.configurations.SchemaConfiguration +import org.openapijsonschematools.client.exceptions.ValidationException + +import kotlin.test.Test +import kotlin.test.assertFailsWith + +class ItemsDoesNotLookInApplicatorsValidCaseTest { + companion object { + val configuration = SchemaConfiguration(JsonSchemaKeywordFlags.Builder().format().build()) + } + + @Test + fun testPrefixitemsInAllofDoesNotConstrainItemsValidCasePasses() { + // prefixItems in allOf does not constrain items, valid case + val schema = ItemsDoesNotLookInApplicatorsValidCase.ItemsDoesNotLookInApplicatorsValidCase1.getInstance() + schema.validate( + ItemsDoesNotLookInApplicatorsValidCase.ItemsDoesNotLookInApplicatorsValidCaseListBuilder() + .add(5) + + .add(5) + + .build(), + configuration + ) + } + + @Test + fun testPrefixitemsInAllofDoesNotConstrainItemsInvalidCaseFails() { + // prefixItems in allOf does not constrain items, invalid case + val schema = ItemsDoesNotLookInApplicatorsValidCase.ItemsDoesNotLookInApplicatorsValidCase1.getInstance() + assertFailsWith( + block = { + schema.validate( + listOf( + 3, + 5 + ), + configuration + ) + } + ) + } +} diff --git a/samples/client/3_1_0_unit_test/kotlin/src/test/kotlin/org/openapijsonschematools/client/components/schemas/ItemsWithNullInstanceElementsTest.kt b/samples/client/3_1_0_unit_test/kotlin/src/test/kotlin/org/openapijsonschematools/client/components/schemas/ItemsWithNullInstanceElementsTest.kt new file mode 100644 index 00000000000..ef4335fbc2e --- /dev/null +++ b/samples/client/3_1_0_unit_test/kotlin/src/test/kotlin/org/openapijsonschematools/client/components/schemas/ItemsWithNullInstanceElementsTest.kt @@ -0,0 +1,27 @@ +package org.openapijsonschematools.client.components.schemas + +import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags +import org.openapijsonschematools.client.configurations.SchemaConfiguration +import org.openapijsonschematools.client.exceptions.ValidationException + +import kotlin.test.Test +import kotlin.test.assertFailsWith + +class ItemsWithNullInstanceElementsTest { + companion object { + val configuration = SchemaConfiguration(JsonSchemaKeywordFlags.Builder().format().build()) + } + + @Test + fun testAllowsNullElementsPasses() { + // allows null elements + val schema = ItemsWithNullInstanceElements.ItemsWithNullInstanceElements1.getInstance() + schema.validate( + ItemsWithNullInstanceElements.ItemsWithNullInstanceElementsListBuilder() + .add(null) + + .build(), + configuration + ) + } +} diff --git a/samples/client/3_1_0_unit_test/kotlin/src/test/kotlin/org/openapijsonschematools/client/components/schemas/JsonPointerFormatTest.kt b/samples/client/3_1_0_unit_test/kotlin/src/test/kotlin/org/openapijsonschematools/client/components/schemas/JsonPointerFormatTest.kt new file mode 100644 index 00000000000..8e1c66417ac --- /dev/null +++ b/samples/client/3_1_0_unit_test/kotlin/src/test/kotlin/org/openapijsonschematools/client/components/schemas/JsonPointerFormatTest.kt @@ -0,0 +1,86 @@ +package org.openapijsonschematools.client.components.schemas + +import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags +import org.openapijsonschematools.client.configurations.SchemaConfiguration +import org.openapijsonschematools.client.exceptions.ValidationException + +import kotlin.test.Test +import kotlin.test.assertFailsWith + +class JsonPointerFormatTest { + companion object { + val configuration = SchemaConfiguration(JsonSchemaKeywordFlags.Builder().format().build()) + } + + @Test + fun testAllStringFormatsIgnoreIntegersPasses() { + // all string formats ignore integers + val schema = JsonPointerFormat.JsonPointerFormat1.getInstance() + schema.validate( + 12, + configuration + ) + } + + @Test + fun testInvalidJsonPointerStringIsOnlyAnAnnotationByDefaultPasses() { + // invalid json-pointer string is only an annotation by default + val schema = JsonPointerFormat.JsonPointerFormat1.getInstance() + schema.validate( + "/foo/bar~", + configuration + ) + } + + @Test + fun testAllStringFormatsIgnoreNullsPasses() { + // all string formats ignore nulls + val schema = JsonPointerFormat.JsonPointerFormat1.getInstance() + schema.validate( + null, + configuration + ) + } + + @Test + fun testAllStringFormatsIgnoreObjectsPasses() { + // all string formats ignore objects + val schema = JsonPointerFormat.JsonPointerFormat1.getInstance() + schema.validate( + mapOf( + ), + configuration + ) + } + + @Test + fun testAllStringFormatsIgnoreFloatsPasses() { + // all string formats ignore floats + val schema = JsonPointerFormat.JsonPointerFormat1.getInstance() + schema.validate( + 13.7, + configuration + ) + } + + @Test + fun testAllStringFormatsIgnoreArraysPasses() { + // all string formats ignore arrays + val schema = JsonPointerFormat.JsonPointerFormat1.getInstance() + schema.validate( + listOf( + ), + configuration + ) + } + + @Test + fun testAllStringFormatsIgnoreBooleansPasses() { + // all string formats ignore booleans + val schema = JsonPointerFormat.JsonPointerFormat1.getInstance() + schema.validate( + false, + configuration + ) + } +} diff --git a/samples/client/3_1_0_unit_test/kotlin/src/test/kotlin/org/openapijsonschematools/client/components/schemas/MaxcontainsWithoutContainsIsIgnoredTest.kt b/samples/client/3_1_0_unit_test/kotlin/src/test/kotlin/org/openapijsonschematools/client/components/schemas/MaxcontainsWithoutContainsIsIgnoredTest.kt new file mode 100644 index 00000000000..3c089662754 --- /dev/null +++ b/samples/client/3_1_0_unit_test/kotlin/src/test/kotlin/org/openapijsonschematools/client/components/schemas/MaxcontainsWithoutContainsIsIgnoredTest.kt @@ -0,0 +1,39 @@ +package org.openapijsonschematools.client.components.schemas + +import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags +import org.openapijsonschematools.client.configurations.SchemaConfiguration +import org.openapijsonschematools.client.exceptions.ValidationException + +import kotlin.test.Test +import kotlin.test.assertFailsWith + +class MaxcontainsWithoutContainsIsIgnoredTest { + companion object { + val configuration = SchemaConfiguration(JsonSchemaKeywordFlags.Builder().format().build()) + } + + @Test + fun testTwoItemsStillValidAgainstLoneMaxcontainsPasses() { + // two items still valid against lone maxContains + val schema = MaxcontainsWithoutContainsIsIgnored.MaxcontainsWithoutContainsIsIgnored1.getInstance() + schema.validate( + listOf( + 1, + 2 + ), + configuration + ) + } + + @Test + fun testOneItemValidAgainstLoneMaxcontainsPasses() { + // one item valid against lone maxContains + val schema = MaxcontainsWithoutContainsIsIgnored.MaxcontainsWithoutContainsIsIgnored1.getInstance() + schema.validate( + listOf( + 1 + ), + configuration + ) + } +} diff --git a/samples/client/3_1_0_unit_test/kotlin/src/test/kotlin/org/openapijsonschematools/client/components/schemas/MaximumValidationTest.kt b/samples/client/3_1_0_unit_test/kotlin/src/test/kotlin/org/openapijsonschematools/client/components/schemas/MaximumValidationTest.kt new file mode 100644 index 00000000000..d6e53bea2b0 --- /dev/null +++ b/samples/client/3_1_0_unit_test/kotlin/src/test/kotlin/org/openapijsonschematools/client/components/schemas/MaximumValidationTest.kt @@ -0,0 +1,58 @@ +package org.openapijsonschematools.client.components.schemas + +import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags +import org.openapijsonschematools.client.configurations.SchemaConfiguration +import org.openapijsonschematools.client.exceptions.ValidationException + +import kotlin.test.Test +import kotlin.test.assertFailsWith + +class MaximumValidationTest { + companion object { + val configuration = SchemaConfiguration(JsonSchemaKeywordFlags.Builder().format().build()) + } + + @Test + fun testAboveTheMaximumIsInvalidFails() { + // above the maximum is invalid + val schema = MaximumValidation.MaximumValidation1.getInstance() + assertFailsWith( + block = { + schema.validate( + 3.5, + configuration + ) + } + ) + } + + @Test + fun testBoundaryPointIsValidPasses() { + // boundary point is valid + val schema = MaximumValidation.MaximumValidation1.getInstance() + schema.validate( + 3.0, + configuration + ) + } + + @Test + fun testBelowTheMaximumIsValidPasses() { + // below the maximum is valid + val schema = MaximumValidation.MaximumValidation1.getInstance() + schema.validate( + 2.6, + configuration + ) + } + + @Test + fun testIgnoresNonNumbersPasses() { + // ignores non-numbers + val schema = MaximumValidation.MaximumValidation1.getInstance() + schema.validate( + "x", + configuration + ) + } +} diff --git a/samples/client/3_1_0_unit_test/kotlin/src/test/kotlin/org/openapijsonschematools/client/components/schemas/MaximumValidationWithUnsignedIntegerTest.kt b/samples/client/3_1_0_unit_test/kotlin/src/test/kotlin/org/openapijsonschematools/client/components/schemas/MaximumValidationWithUnsignedIntegerTest.kt new file mode 100644 index 00000000000..f486b09d617 --- /dev/null +++ b/samples/client/3_1_0_unit_test/kotlin/src/test/kotlin/org/openapijsonschematools/client/components/schemas/MaximumValidationWithUnsignedIntegerTest.kt @@ -0,0 +1,58 @@ +package org.openapijsonschematools.client.components.schemas + +import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags +import org.openapijsonschematools.client.configurations.SchemaConfiguration +import org.openapijsonschematools.client.exceptions.ValidationException + +import kotlin.test.Test +import kotlin.test.assertFailsWith + +class MaximumValidationWithUnsignedIntegerTest { + companion object { + val configuration = SchemaConfiguration(JsonSchemaKeywordFlags.Builder().format().build()) + } + + @Test + fun testAboveTheMaximumIsInvalidFails() { + // above the maximum is invalid + val schema = MaximumValidationWithUnsignedInteger.MaximumValidationWithUnsignedInteger1.getInstance() + assertFailsWith( + block = { + schema.validate( + 300.5, + configuration + ) + } + ) + } + + @Test + fun testBelowTheMaximumIsInvalidPasses() { + // below the maximum is invalid + val schema = MaximumValidationWithUnsignedInteger.MaximumValidationWithUnsignedInteger1.getInstance() + schema.validate( + 299.97, + configuration + ) + } + + @Test + fun testBoundaryPointIntegerIsValidPasses() { + // boundary point integer is valid + val schema = MaximumValidationWithUnsignedInteger.MaximumValidationWithUnsignedInteger1.getInstance() + schema.validate( + 300, + configuration + ) + } + + @Test + fun testBoundaryPointFloatIsValidPasses() { + // boundary point float is valid + val schema = MaximumValidationWithUnsignedInteger.MaximumValidationWithUnsignedInteger1.getInstance() + schema.validate( + 300.0, + configuration + ) + } +} diff --git a/samples/client/3_1_0_unit_test/kotlin/src/test/kotlin/org/openapijsonschematools/client/components/schemas/MaxitemsValidationTest.kt b/samples/client/3_1_0_unit_test/kotlin/src/test/kotlin/org/openapijsonschematools/client/components/schemas/MaxitemsValidationTest.kt new file mode 100644 index 00000000000..01c61a00377 --- /dev/null +++ b/samples/client/3_1_0_unit_test/kotlin/src/test/kotlin/org/openapijsonschematools/client/components/schemas/MaxitemsValidationTest.kt @@ -0,0 +1,67 @@ +package org.openapijsonschematools.client.components.schemas + +import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags +import org.openapijsonschematools.client.configurations.SchemaConfiguration +import org.openapijsonschematools.client.exceptions.ValidationException + +import kotlin.test.Test +import kotlin.test.assertFailsWith + +class MaxitemsValidationTest { + companion object { + val configuration = SchemaConfiguration(JsonSchemaKeywordFlags.Builder().format().build()) + } + + @Test + fun testShorterIsValidPasses() { + // shorter is valid + val schema = MaxitemsValidation.MaxitemsValidation1.getInstance() + schema.validate( + listOf( + 1 + ), + configuration + ) + } + + @Test + fun testExactLengthIsValidPasses() { + // exact length is valid + val schema = MaxitemsValidation.MaxitemsValidation1.getInstance() + schema.validate( + listOf( + 1, + 2 + ), + configuration + ) + } + + @Test + fun testTooLongIsInvalidFails() { + // too long is invalid + val schema = MaxitemsValidation.MaxitemsValidation1.getInstance() + assertFailsWith( + block = { + schema.validate( + listOf( + 1, + 2, + 3 + ), + configuration + ) + } + ) + } + + @Test + fun testIgnoresNonArraysPasses() { + // ignores non-arrays + val schema = MaxitemsValidation.MaxitemsValidation1.getInstance() + schema.validate( + "foobar", + configuration + ) + } +} diff --git a/samples/client/3_1_0_unit_test/kotlin/src/test/kotlin/org/openapijsonschematools/client/components/schemas/MaxlengthValidationTest.kt b/samples/client/3_1_0_unit_test/kotlin/src/test/kotlin/org/openapijsonschematools/client/components/schemas/MaxlengthValidationTest.kt new file mode 100644 index 00000000000..dba10dc74cc --- /dev/null +++ b/samples/client/3_1_0_unit_test/kotlin/src/test/kotlin/org/openapijsonschematools/client/components/schemas/MaxlengthValidationTest.kt @@ -0,0 +1,68 @@ +package org.openapijsonschematools.client.components.schemas + +import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags +import org.openapijsonschematools.client.configurations.SchemaConfiguration +import org.openapijsonschematools.client.exceptions.ValidationException + +import kotlin.test.Test +import kotlin.test.assertFailsWith + +class MaxlengthValidationTest { + companion object { + val configuration = SchemaConfiguration(JsonSchemaKeywordFlags.Builder().format().build()) + } + + @Test + fun testShorterIsValidPasses() { + // shorter is valid + val schema = MaxlengthValidation.MaxlengthValidation1.getInstance() + schema.validate( + "f", + configuration + ) + } + + @Test + fun testExactLengthIsValidPasses() { + // exact length is valid + val schema = MaxlengthValidation.MaxlengthValidation1.getInstance() + schema.validate( + "fo", + configuration + ) + } + + @Test + fun testTooLongIsInvalidFails() { + // too long is invalid + val schema = MaxlengthValidation.MaxlengthValidation1.getInstance() + assertFailsWith( + block = { + schema.validate( + "foo", + configuration + ) + } + ) + } + + @Test + fun testIgnoresNonStringsPasses() { + // ignores non-strings + val schema = MaxlengthValidation.MaxlengthValidation1.getInstance() + schema.validate( + 100, + configuration + ) + } + + @Test + fun testTwoSupplementaryUnicodeCodePointsIsLongEnoughPasses() { + // two supplementary Unicode code points is long enough + val schema = MaxlengthValidation.MaxlengthValidation1.getInstance() + schema.validate( + "💩💩", + configuration + ) + } +} diff --git a/samples/client/3_1_0_unit_test/kotlin/src/test/kotlin/org/openapijsonschematools/client/components/schemas/Maxproperties0MeansTheObjectIsEmptyTest.kt b/samples/client/3_1_0_unit_test/kotlin/src/test/kotlin/org/openapijsonschematools/client/components/schemas/Maxproperties0MeansTheObjectIsEmptyTest.kt new file mode 100644 index 00000000000..8c397df7deb --- /dev/null +++ b/samples/client/3_1_0_unit_test/kotlin/src/test/kotlin/org/openapijsonschematools/client/components/schemas/Maxproperties0MeansTheObjectIsEmptyTest.kt @@ -0,0 +1,44 @@ +package org.openapijsonschematools.client.components.schemas + +import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags +import org.openapijsonschematools.client.configurations.SchemaConfiguration +import org.openapijsonschematools.client.exceptions.ValidationException + +import kotlin.test.Test +import kotlin.test.assertFailsWith + +class Maxproperties0MeansTheObjectIsEmptyTest { + companion object { + val configuration = SchemaConfiguration(JsonSchemaKeywordFlags.Builder().format().build()) + } + + @Test + fun testOnePropertyIsInvalidFails() { + // one property is invalid + val schema = Maxproperties0MeansTheObjectIsEmpty.Maxproperties0MeansTheObjectIsEmpty1.getInstance() + assertFailsWith( + block = { + schema.validate( + mapOf( + Pair( + "foo", + 1 + ) + ), + configuration + ) + } + ) + } + + @Test + fun testNoPropertiesIsValidPasses() { + // no properties is valid + val schema = Maxproperties0MeansTheObjectIsEmpty.Maxproperties0MeansTheObjectIsEmpty1.getInstance() + schema.validate( + mapOf( + ), + configuration + ) + } +} diff --git a/samples/client/3_1_0_unit_test/kotlin/src/test/kotlin/org/openapijsonschematools/client/components/schemas/MaxpropertiesValidationTest.kt b/samples/client/3_1_0_unit_test/kotlin/src/test/kotlin/org/openapijsonschematools/client/components/schemas/MaxpropertiesValidationTest.kt new file mode 100644 index 00000000000..25fe6859ed0 --- /dev/null +++ b/samples/client/3_1_0_unit_test/kotlin/src/test/kotlin/org/openapijsonschematools/client/components/schemas/MaxpropertiesValidationTest.kt @@ -0,0 +1,109 @@ +package org.openapijsonschematools.client.components.schemas + +import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags +import org.openapijsonschematools.client.configurations.SchemaConfiguration +import org.openapijsonschematools.client.exceptions.ValidationException + +import kotlin.test.Test +import kotlin.test.assertFailsWith + +class MaxpropertiesValidationTest { + companion object { + val configuration = SchemaConfiguration(JsonSchemaKeywordFlags.Builder().format().build()) + } + + @Test + fun testShorterIsValidPasses() { + // shorter is valid + val schema = MaxpropertiesValidation.MaxpropertiesValidation1.getInstance() + schema.validate( + mapOf( + Pair( + "foo", + 1 + ) + ), + configuration + ) + } + + @Test + fun testExactLengthIsValidPasses() { + // exact length is valid + val schema = MaxpropertiesValidation.MaxpropertiesValidation1.getInstance() + schema.validate( + mapOf( + Pair( + "foo", + 1 + ), + Pair( + "bar", + 2 + ) + ), + configuration + ) + } + + @Test + fun testTooLongIsInvalidFails() { + // too long is invalid + val schema = MaxpropertiesValidation.MaxpropertiesValidation1.getInstance() + assertFailsWith( + block = { + schema.validate( + mapOf( + Pair( + "foo", + 1 + ), + Pair( + "bar", + 2 + ), + Pair( + "baz", + 3 + ) + ), + configuration + ) + } + ) + } + + @Test + fun testIgnoresOtherNonObjectsPasses() { + // ignores other non-objects + val schema = MaxpropertiesValidation.MaxpropertiesValidation1.getInstance() + schema.validate( + 12, + configuration + ) + } + + @Test + fun testIgnoresArraysPasses() { + // ignores arrays + val schema = MaxpropertiesValidation.MaxpropertiesValidation1.getInstance() + schema.validate( + listOf( + 1, + 2, + 3 + ), + configuration + ) + } + + @Test + fun testIgnoresStringsPasses() { + // ignores strings + val schema = MaxpropertiesValidation.MaxpropertiesValidation1.getInstance() + schema.validate( + "foobar", + configuration + ) + } +} diff --git a/samples/client/3_1_0_unit_test/kotlin/src/test/kotlin/org/openapijsonschematools/client/components/schemas/MincontainsWithoutContainsIsIgnoredTest.kt b/samples/client/3_1_0_unit_test/kotlin/src/test/kotlin/org/openapijsonschematools/client/components/schemas/MincontainsWithoutContainsIsIgnoredTest.kt new file mode 100644 index 00000000000..a9586fae97f --- /dev/null +++ b/samples/client/3_1_0_unit_test/kotlin/src/test/kotlin/org/openapijsonschematools/client/components/schemas/MincontainsWithoutContainsIsIgnoredTest.kt @@ -0,0 +1,37 @@ +package org.openapijsonschematools.client.components.schemas + +import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags +import org.openapijsonschematools.client.configurations.SchemaConfiguration +import org.openapijsonschematools.client.exceptions.ValidationException + +import kotlin.test.Test +import kotlin.test.assertFailsWith + +class MincontainsWithoutContainsIsIgnoredTest { + companion object { + val configuration = SchemaConfiguration(JsonSchemaKeywordFlags.Builder().format().build()) + } + + @Test + fun testOneItemValidAgainstLoneMincontainsPasses() { + // one item valid against lone minContains + val schema = MincontainsWithoutContainsIsIgnored.MincontainsWithoutContainsIsIgnored1.getInstance() + schema.validate( + listOf( + 1 + ), + configuration + ) + } + + @Test + fun testZeroItemsStillValidAgainstLoneMincontainsPasses() { + // zero items still valid against lone minContains + val schema = MincontainsWithoutContainsIsIgnored.MincontainsWithoutContainsIsIgnored1.getInstance() + schema.validate( + listOf( + ), + configuration + ) + } +} diff --git a/samples/client/3_1_0_unit_test/kotlin/src/test/kotlin/org/openapijsonschematools/client/components/schemas/MinimumValidationTest.kt b/samples/client/3_1_0_unit_test/kotlin/src/test/kotlin/org/openapijsonschematools/client/components/schemas/MinimumValidationTest.kt new file mode 100644 index 00000000000..3424b61c67d --- /dev/null +++ b/samples/client/3_1_0_unit_test/kotlin/src/test/kotlin/org/openapijsonschematools/client/components/schemas/MinimumValidationTest.kt @@ -0,0 +1,58 @@ +package org.openapijsonschematools.client.components.schemas + +import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags +import org.openapijsonschematools.client.configurations.SchemaConfiguration +import org.openapijsonschematools.client.exceptions.ValidationException + +import kotlin.test.Test +import kotlin.test.assertFailsWith + +class MinimumValidationTest { + companion object { + val configuration = SchemaConfiguration(JsonSchemaKeywordFlags.Builder().format().build()) + } + + @Test + fun testBoundaryPointIsValidPasses() { + // boundary point is valid + val schema = MinimumValidation.MinimumValidation1.getInstance() + schema.validate( + 1.1, + configuration + ) + } + + @Test + fun testBelowTheMinimumIsInvalidFails() { + // below the minimum is invalid + val schema = MinimumValidation.MinimumValidation1.getInstance() + assertFailsWith( + block = { + schema.validate( + 0.6, + configuration + ) + } + ) + } + + @Test + fun testIgnoresNonNumbersPasses() { + // ignores non-numbers + val schema = MinimumValidation.MinimumValidation1.getInstance() + schema.validate( + "x", + configuration + ) + } + + @Test + fun testAboveTheMinimumIsValidPasses() { + // above the minimum is valid + val schema = MinimumValidation.MinimumValidation1.getInstance() + schema.validate( + 2.6, + configuration + ) + } +} diff --git a/samples/client/3_1_0_unit_test/kotlin/src/test/kotlin/org/openapijsonschematools/client/components/schemas/MinimumValidationWithSignedIntegerTest.kt b/samples/client/3_1_0_unit_test/kotlin/src/test/kotlin/org/openapijsonschematools/client/components/schemas/MinimumValidationWithSignedIntegerTest.kt new file mode 100644 index 00000000000..a137255840d --- /dev/null +++ b/samples/client/3_1_0_unit_test/kotlin/src/test/kotlin/org/openapijsonschematools/client/components/schemas/MinimumValidationWithSignedIntegerTest.kt @@ -0,0 +1,92 @@ +package org.openapijsonschematools.client.components.schemas + +import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags +import org.openapijsonschematools.client.configurations.SchemaConfiguration +import org.openapijsonschematools.client.exceptions.ValidationException + +import kotlin.test.Test +import kotlin.test.assertFailsWith + +class MinimumValidationWithSignedIntegerTest { + companion object { + val configuration = SchemaConfiguration(JsonSchemaKeywordFlags.Builder().format().build()) + } + + @Test + fun testBoundaryPointWithFloatIsValidPasses() { + // boundary point with float is valid + val schema = MinimumValidationWithSignedInteger.MinimumValidationWithSignedInteger1.getInstance() + schema.validate( + -2.0, + configuration + ) + } + + @Test + fun testBoundaryPointIsValidPasses() { + // boundary point is valid + val schema = MinimumValidationWithSignedInteger.MinimumValidationWithSignedInteger1.getInstance() + schema.validate( + -2, + configuration + ) + } + + @Test + fun testIntBelowTheMinimumIsInvalidFails() { + // int below the minimum is invalid + val schema = MinimumValidationWithSignedInteger.MinimumValidationWithSignedInteger1.getInstance() + assertFailsWith( + block = { + schema.validate( + -3, + configuration + ) + } + ) + } + + @Test + fun testPositiveAboveTheMinimumIsValidPasses() { + // positive above the minimum is valid + val schema = MinimumValidationWithSignedInteger.MinimumValidationWithSignedInteger1.getInstance() + schema.validate( + 0, + configuration + ) + } + + @Test + fun testNegativeAboveTheMinimumIsValidPasses() { + // negative above the minimum is valid + val schema = MinimumValidationWithSignedInteger.MinimumValidationWithSignedInteger1.getInstance() + schema.validate( + -1, + configuration + ) + } + + @Test + fun testIgnoresNonNumbersPasses() { + // ignores non-numbers + val schema = MinimumValidationWithSignedInteger.MinimumValidationWithSignedInteger1.getInstance() + schema.validate( + "x", + configuration + ) + } + + @Test + fun testFloatBelowTheMinimumIsInvalidFails() { + // float below the minimum is invalid + val schema = MinimumValidationWithSignedInteger.MinimumValidationWithSignedInteger1.getInstance() + assertFailsWith( + block = { + schema.validate( + -2.0001, + configuration + ) + } + ) + } +} diff --git a/samples/client/3_1_0_unit_test/kotlin/src/test/kotlin/org/openapijsonschematools/client/components/schemas/MinitemsValidationTest.kt b/samples/client/3_1_0_unit_test/kotlin/src/test/kotlin/org/openapijsonschematools/client/components/schemas/MinitemsValidationTest.kt new file mode 100644 index 00000000000..f6dc4758197 --- /dev/null +++ b/samples/client/3_1_0_unit_test/kotlin/src/test/kotlin/org/openapijsonschematools/client/components/schemas/MinitemsValidationTest.kt @@ -0,0 +1,64 @@ +package org.openapijsonschematools.client.components.schemas + +import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags +import org.openapijsonschematools.client.configurations.SchemaConfiguration +import org.openapijsonschematools.client.exceptions.ValidationException + +import kotlin.test.Test +import kotlin.test.assertFailsWith + +class MinitemsValidationTest { + companion object { + val configuration = SchemaConfiguration(JsonSchemaKeywordFlags.Builder().format().build()) + } + + @Test + fun testExactLengthIsValidPasses() { + // exact length is valid + val schema = MinitemsValidation.MinitemsValidation1.getInstance() + schema.validate( + listOf( + 1 + ), + configuration + ) + } + + @Test + fun testIgnoresNonArraysPasses() { + // ignores non-arrays + val schema = MinitemsValidation.MinitemsValidation1.getInstance() + schema.validate( + "", + configuration + ) + } + + @Test + fun testLongerIsValidPasses() { + // longer is valid + val schema = MinitemsValidation.MinitemsValidation1.getInstance() + schema.validate( + listOf( + 1, + 2 + ), + configuration + ) + } + + @Test + fun testTooShortIsInvalidFails() { + // too short is invalid + val schema = MinitemsValidation.MinitemsValidation1.getInstance() + assertFailsWith( + block = { + schema.validate( + listOf( + ), + configuration + ) + } + ) + } +} diff --git a/samples/client/3_1_0_unit_test/kotlin/src/test/kotlin/org/openapijsonschematools/client/components/schemas/MinlengthValidationTest.kt b/samples/client/3_1_0_unit_test/kotlin/src/test/kotlin/org/openapijsonschematools/client/components/schemas/MinlengthValidationTest.kt new file mode 100644 index 00000000000..f8976f274c1 --- /dev/null +++ b/samples/client/3_1_0_unit_test/kotlin/src/test/kotlin/org/openapijsonschematools/client/components/schemas/MinlengthValidationTest.kt @@ -0,0 +1,72 @@ +package org.openapijsonschematools.client.components.schemas + +import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags +import org.openapijsonschematools.client.configurations.SchemaConfiguration +import org.openapijsonschematools.client.exceptions.ValidationException + +import kotlin.test.Test +import kotlin.test.assertFailsWith + +class MinlengthValidationTest { + companion object { + val configuration = SchemaConfiguration(JsonSchemaKeywordFlags.Builder().format().build()) + } + + @Test + fun testExactLengthIsValidPasses() { + // exact length is valid + val schema = MinlengthValidation.MinlengthValidation1.getInstance() + schema.validate( + "fo", + configuration + ) + } + + @Test + fun testLongerIsValidPasses() { + // longer is valid + val schema = MinlengthValidation.MinlengthValidation1.getInstance() + schema.validate( + "foo", + configuration + ) + } + + @Test + fun testIgnoresNonStringsPasses() { + // ignores non-strings + val schema = MinlengthValidation.MinlengthValidation1.getInstance() + schema.validate( + 1, + configuration + ) + } + + @Test + fun testTooShortIsInvalidFails() { + // too short is invalid + val schema = MinlengthValidation.MinlengthValidation1.getInstance() + assertFailsWith( + block = { + schema.validate( + "f", + configuration + ) + } + ) + } + + @Test + fun testOneSupplementaryUnicodeCodePointIsNotLongEnoughFails() { + // one supplementary Unicode code point is not long enough + val schema = MinlengthValidation.MinlengthValidation1.getInstance() + assertFailsWith( + block = { + schema.validate( + "💩", + configuration + ) + } + ) + } +} diff --git a/samples/client/3_1_0_unit_test/kotlin/src/test/kotlin/org/openapijsonschematools/client/components/schemas/MinpropertiesValidationTest.kt b/samples/client/3_1_0_unit_test/kotlin/src/test/kotlin/org/openapijsonschematools/client/components/schemas/MinpropertiesValidationTest.kt new file mode 100644 index 00000000000..3c6cd9d15ab --- /dev/null +++ b/samples/client/3_1_0_unit_test/kotlin/src/test/kotlin/org/openapijsonschematools/client/components/schemas/MinpropertiesValidationTest.kt @@ -0,0 +1,94 @@ +package org.openapijsonschematools.client.components.schemas + +import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags +import org.openapijsonschematools.client.configurations.SchemaConfiguration +import org.openapijsonschematools.client.exceptions.ValidationException + +import kotlin.test.Test +import kotlin.test.assertFailsWith + +class MinpropertiesValidationTest { + companion object { + val configuration = SchemaConfiguration(JsonSchemaKeywordFlags.Builder().format().build()) + } + + @Test + fun testExactLengthIsValidPasses() { + // exact length is valid + val schema = MinpropertiesValidation.MinpropertiesValidation1.getInstance() + schema.validate( + mapOf( + Pair( + "foo", + 1 + ) + ), + configuration + ) + } + + @Test + fun testIgnoresOtherNonObjectsPasses() { + // ignores other non-objects + val schema = MinpropertiesValidation.MinpropertiesValidation1.getInstance() + schema.validate( + 12, + configuration + ) + } + + @Test + fun testLongerIsValidPasses() { + // longer is valid + val schema = MinpropertiesValidation.MinpropertiesValidation1.getInstance() + schema.validate( + mapOf( + Pair( + "foo", + 1 + ), + Pair( + "bar", + 2 + ) + ), + configuration + ) + } + + @Test + fun testIgnoresArraysPasses() { + // ignores arrays + val schema = MinpropertiesValidation.MinpropertiesValidation1.getInstance() + schema.validate( + listOf( + ), + configuration + ) + } + + @Test + fun testTooShortIsInvalidFails() { + // too short is invalid + val schema = MinpropertiesValidation.MinpropertiesValidation1.getInstance() + assertFailsWith( + block = { + schema.validate( + mapOf( + ), + configuration + ) + } + ) + } + + @Test + fun testIgnoresStringsPasses() { + // ignores strings + val schema = MinpropertiesValidation.MinpropertiesValidation1.getInstance() + schema.validate( + "", + configuration + ) + } +} diff --git a/samples/client/3_1_0_unit_test/kotlin/src/test/kotlin/org/openapijsonschematools/client/components/schemas/MultipleDependentsRequiredTest.kt b/samples/client/3_1_0_unit_test/kotlin/src/test/kotlin/org/openapijsonschematools/client/components/schemas/MultipleDependentsRequiredTest.kt new file mode 100644 index 00000000000..81d0f0d188c --- /dev/null +++ b/samples/client/3_1_0_unit_test/kotlin/src/test/kotlin/org/openapijsonschematools/client/components/schemas/MultipleDependentsRequiredTest.kt @@ -0,0 +1,132 @@ +package org.openapijsonschematools.client.components.schemas + +import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags +import org.openapijsonschematools.client.configurations.SchemaConfiguration +import org.openapijsonschematools.client.exceptions.ValidationException + +import kotlin.test.Test +import kotlin.test.assertFailsWith + +class MultipleDependentsRequiredTest { + companion object { + val configuration = SchemaConfiguration(JsonSchemaKeywordFlags.Builder().format().build()) + } + + @Test + fun testNondependantsPasses() { + // nondependants + val schema = MultipleDependentsRequired.MultipleDependentsRequired1.getInstance() + schema.validate( + mapOf( + Pair( + "foo", + 1 + ), + Pair( + "bar", + 2 + ) + ), + configuration + ) + } + + @Test + fun testMissingOtherDependencyFails() { + // missing other dependency + val schema = MultipleDependentsRequired.MultipleDependentsRequired1.getInstance() + assertFailsWith( + block = { + schema.validate( + mapOf( + Pair( + "bar", + 1 + ), + Pair( + "quux", + 2 + ) + ), + configuration + ) + } + ) + } + + @Test + fun testWithDependenciesPasses() { + // with dependencies + val schema = MultipleDependentsRequired.MultipleDependentsRequired1.getInstance() + schema.validate( + mapOf( + Pair( + "foo", + 1 + ), + Pair( + "bar", + 2 + ), + Pair( + "quux", + 3 + ) + ), + configuration + ) + } + + @Test + fun testMissingBothDependenciesFails() { + // missing both dependencies + val schema = MultipleDependentsRequired.MultipleDependentsRequired1.getInstance() + assertFailsWith( + block = { + schema.validate( + mapOf( + Pair( + "quux", + 1 + ) + ), + configuration + ) + } + ) + } + + @Test + fun testMissingDependencyFails() { + // missing dependency + val schema = MultipleDependentsRequired.MultipleDependentsRequired1.getInstance() + assertFailsWith( + block = { + schema.validate( + mapOf( + Pair( + "foo", + 1 + ), + Pair( + "quux", + 2 + ) + ), + configuration + ) + } + ) + } + + @Test + fun testNeitherPasses() { + // neither + val schema = MultipleDependentsRequired.MultipleDependentsRequired1.getInstance() + schema.validate( + mapOf( + ), + configuration + ) + } +} diff --git a/samples/client/3_1_0_unit_test/kotlin/src/test/kotlin/org/openapijsonschematools/client/components/schemas/MultipleSimultaneousPatternpropertiesAreValidatedTest.kt b/samples/client/3_1_0_unit_test/kotlin/src/test/kotlin/org/openapijsonschematools/client/components/schemas/MultipleSimultaneousPatternpropertiesAreValidatedTest.kt new file mode 100644 index 00000000000..07ea957361d --- /dev/null +++ b/samples/client/3_1_0_unit_test/kotlin/src/test/kotlin/org/openapijsonschematools/client/components/schemas/MultipleSimultaneousPatternpropertiesAreValidatedTest.kt @@ -0,0 +1,124 @@ +package org.openapijsonschematools.client.components.schemas + +import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags +import org.openapijsonschematools.client.configurations.SchemaConfiguration +import org.openapijsonschematools.client.exceptions.ValidationException + +import kotlin.test.Test +import kotlin.test.assertFailsWith + +class MultipleSimultaneousPatternpropertiesAreValidatedTest { + companion object { + val configuration = SchemaConfiguration(JsonSchemaKeywordFlags.Builder().format().build()) + } + + @Test + fun testASimultaneousMatchIsValidPasses() { + // a simultaneous match is valid + val schema = MultipleSimultaneousPatternpropertiesAreValidated.MultipleSimultaneousPatternpropertiesAreValidated1.getInstance() + schema.validate( + mapOf( + Pair( + "aaaa", + 18 + ) + ), + configuration + ) + } + + @Test + fun testASingleValidMatchIsValidPasses() { + // a single valid match is valid + val schema = MultipleSimultaneousPatternpropertiesAreValidated.MultipleSimultaneousPatternpropertiesAreValidated1.getInstance() + schema.validate( + mapOf( + Pair( + "a", + 21 + ) + ), + configuration + ) + } + + @Test + fun testAnInvalidDueToTheOtherIsInvalidFails() { + // an invalid due to the other is invalid + val schema = MultipleSimultaneousPatternpropertiesAreValidated.MultipleSimultaneousPatternpropertiesAreValidated1.getInstance() + assertFailsWith( + block = { + schema.validate( + mapOf( + Pair( + "aaaa", + 31 + ) + ), + configuration + ) + } + ) + } + + @Test + fun testMultipleMatchesIsValidPasses() { + // multiple matches is valid + val schema = MultipleSimultaneousPatternpropertiesAreValidated.MultipleSimultaneousPatternpropertiesAreValidated1.getInstance() + schema.validate( + mapOf( + Pair( + "a", + 21 + ), + Pair( + "aaaa", + 18 + ) + ), + configuration + ) + } + + @Test + fun testAnInvalidDueToOneIsInvalidFails() { + // an invalid due to one is invalid + val schema = MultipleSimultaneousPatternpropertiesAreValidated.MultipleSimultaneousPatternpropertiesAreValidated1.getInstance() + assertFailsWith( + block = { + schema.validate( + mapOf( + Pair( + "a", + "bar" + ) + ), + configuration + ) + } + ) + } + + @Test + fun testAnInvalidDueToBothIsInvalidFails() { + // an invalid due to both is invalid + val schema = MultipleSimultaneousPatternpropertiesAreValidated.MultipleSimultaneousPatternpropertiesAreValidated1.getInstance() + assertFailsWith( + block = { + schema.validate( + mapOf( + Pair( + "aaa", + "foo" + ), + Pair( + "aaaa", + 31 + ) + ), + configuration + ) + } + ) + } +} diff --git a/samples/client/3_1_0_unit_test/kotlin/src/test/kotlin/org/openapijsonschematools/client/components/schemas/MultipleTypesCanBeSpecifiedInAnArrayTest.kt b/samples/client/3_1_0_unit_test/kotlin/src/test/kotlin/org/openapijsonschematools/client/components/schemas/MultipleTypesCanBeSpecifiedInAnArrayTest.kt new file mode 100644 index 00000000000..3feb395a8f7 --- /dev/null +++ b/samples/client/3_1_0_unit_test/kotlin/src/test/kotlin/org/openapijsonschematools/client/components/schemas/MultipleTypesCanBeSpecifiedInAnArrayTest.kt @@ -0,0 +1,106 @@ +package org.openapijsonschematools.client.components.schemas + +import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags +import org.openapijsonschematools.client.configurations.SchemaConfiguration +import org.openapijsonschematools.client.exceptions.ValidationException + +import kotlin.test.Test +import kotlin.test.assertFailsWith + +class MultipleTypesCanBeSpecifiedInAnArrayTest { + companion object { + val configuration = SchemaConfiguration(JsonSchemaKeywordFlags.Builder().format().build()) + } + + @Test + fun testNullIsInvalidFails() { + // null is invalid + val schema = MultipleTypesCanBeSpecifiedInAnArray.MultipleTypesCanBeSpecifiedInAnArray1.getInstance() + assertFailsWith( + block = { + schema.validate( + null, + configuration + ) + } + ) + } + + @Test + fun testAnIntegerIsValidPasses() { + // an integer is valid + val schema = MultipleTypesCanBeSpecifiedInAnArray.MultipleTypesCanBeSpecifiedInAnArray1.getInstance() + schema.validate( + 1, + configuration + ) + } + + @Test + fun testAnArrayIsInvalidFails() { + // an array is invalid + val schema = MultipleTypesCanBeSpecifiedInAnArray.MultipleTypesCanBeSpecifiedInAnArray1.getInstance() + assertFailsWith( + block = { + schema.validate( + listOf( + ), + configuration + ) + } + ) + } + + @Test + fun testABooleanIsInvalidFails() { + // a boolean is invalid + val schema = MultipleTypesCanBeSpecifiedInAnArray.MultipleTypesCanBeSpecifiedInAnArray1.getInstance() + assertFailsWith( + block = { + schema.validate( + true, + configuration + ) + } + ) + } + + @Test + fun testAFloatIsInvalidFails() { + // a float is invalid + val schema = MultipleTypesCanBeSpecifiedInAnArray.MultipleTypesCanBeSpecifiedInAnArray1.getInstance() + assertFailsWith( + block = { + schema.validate( + 1.1, + configuration + ) + } + ) + } + + @Test + fun testAStringIsValidPasses() { + // a string is valid + val schema = MultipleTypesCanBeSpecifiedInAnArray.MultipleTypesCanBeSpecifiedInAnArray1.getInstance() + schema.validate( + "foo", + configuration + ) + } + + @Test + fun testAnObjectIsInvalidFails() { + // an object is invalid + val schema = MultipleTypesCanBeSpecifiedInAnArray.MultipleTypesCanBeSpecifiedInAnArray1.getInstance() + assertFailsWith( + block = { + schema.validate( + mapOf( + ), + configuration + ) + } + ) + } +} diff --git a/samples/client/3_1_0_unit_test/kotlin/src/test/kotlin/org/openapijsonschematools/client/components/schemas/NestedAllofToCheckValidationSemanticsTest.kt b/samples/client/3_1_0_unit_test/kotlin/src/test/kotlin/org/openapijsonschematools/client/components/schemas/NestedAllofToCheckValidationSemanticsTest.kt new file mode 100644 index 00000000000..8639f84f58d --- /dev/null +++ b/samples/client/3_1_0_unit_test/kotlin/src/test/kotlin/org/openapijsonschematools/client/components/schemas/NestedAllofToCheckValidationSemanticsTest.kt @@ -0,0 +1,38 @@ +package org.openapijsonschematools.client.components.schemas + +import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags +import org.openapijsonschematools.client.configurations.SchemaConfiguration +import org.openapijsonschematools.client.exceptions.ValidationException + +import kotlin.test.Test +import kotlin.test.assertFailsWith + +class NestedAllofToCheckValidationSemanticsTest { + companion object { + val configuration = SchemaConfiguration(JsonSchemaKeywordFlags.Builder().format().build()) + } + + @Test + fun testNullIsValidPasses() { + // null is valid + val schema = NestedAllofToCheckValidationSemantics.NestedAllofToCheckValidationSemantics1.getInstance() + schema.validate( + null, + configuration + ) + } + + @Test + fun testAnythingNonNullIsInvalidFails() { + // anything non-null is invalid + val schema = NestedAllofToCheckValidationSemantics.NestedAllofToCheckValidationSemantics1.getInstance() + assertFailsWith( + block = { + schema.validate( + 123, + configuration + ) + } + ) + } +} diff --git a/samples/client/3_1_0_unit_test/kotlin/src/test/kotlin/org/openapijsonschematools/client/components/schemas/NestedAnyofToCheckValidationSemanticsTest.kt b/samples/client/3_1_0_unit_test/kotlin/src/test/kotlin/org/openapijsonschematools/client/components/schemas/NestedAnyofToCheckValidationSemanticsTest.kt new file mode 100644 index 00000000000..76f934637ab --- /dev/null +++ b/samples/client/3_1_0_unit_test/kotlin/src/test/kotlin/org/openapijsonschematools/client/components/schemas/NestedAnyofToCheckValidationSemanticsTest.kt @@ -0,0 +1,38 @@ +package org.openapijsonschematools.client.components.schemas + +import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags +import org.openapijsonschematools.client.configurations.SchemaConfiguration +import org.openapijsonschematools.client.exceptions.ValidationException + +import kotlin.test.Test +import kotlin.test.assertFailsWith + +class NestedAnyofToCheckValidationSemanticsTest { + companion object { + val configuration = SchemaConfiguration(JsonSchemaKeywordFlags.Builder().format().build()) + } + + @Test + fun testNullIsValidPasses() { + // null is valid + val schema = NestedAnyofToCheckValidationSemantics.NestedAnyofToCheckValidationSemantics1.getInstance() + schema.validate( + null, + configuration + ) + } + + @Test + fun testAnythingNonNullIsInvalidFails() { + // anything non-null is invalid + val schema = NestedAnyofToCheckValidationSemantics.NestedAnyofToCheckValidationSemantics1.getInstance() + assertFailsWith( + block = { + schema.validate( + 123, + configuration + ) + } + ) + } +} diff --git a/samples/client/3_1_0_unit_test/kotlin/src/test/kotlin/org/openapijsonschematools/client/components/schemas/NestedItemsTest.kt b/samples/client/3_1_0_unit_test/kotlin/src/test/kotlin/org/openapijsonschematools/client/components/schemas/NestedItemsTest.kt new file mode 100644 index 00000000000..7d7ab246886 --- /dev/null +++ b/samples/client/3_1_0_unit_test/kotlin/src/test/kotlin/org/openapijsonschematools/client/components/schemas/NestedItemsTest.kt @@ -0,0 +1,137 @@ +package org.openapijsonschematools.client.components.schemas + +import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags +import org.openapijsonschematools.client.configurations.SchemaConfiguration +import org.openapijsonschematools.client.exceptions.ValidationException + +import kotlin.test.Test +import kotlin.test.assertFailsWith + +class NestedItemsTest { + companion object { + val configuration = SchemaConfiguration(JsonSchemaKeywordFlags.Builder().format().build()) + } + + @Test + fun testNestedArrayWithInvalidTypeFails() { + // nested array with invalid type + val schema = NestedItems.NestedItems1.getInstance() + assertFailsWith( + block = { + schema.validate( + listOf( + listOf( + listOf( + listOf( + "1" + ) + ), + listOf( + listOf( + 2 + ), + listOf( + 3 + ) + ) + ), + listOf( + listOf( + listOf( + 4 + ), + listOf( + 5 + ), + listOf( + 6 + ) + ) + ) + ), + configuration + ) + } + ) + } + + @Test + fun testNotDeepEnoughFails() { + // not deep enough + val schema = NestedItems.NestedItems1.getInstance() + assertFailsWith( + block = { + schema.validate( + listOf( + listOf( + listOf( + 1 + ), + listOf( + 2 + ), + listOf( + 3 + ) + ), + listOf( + listOf( + 4 + ), + listOf( + 5 + ), + listOf( + 6 + ) + ) + ), + configuration + ) + } + ) + } + + @Test + fun testValidNestedArrayPasses() { + // valid nested array + val schema = NestedItems.NestedItems1.getInstance() + schema.validate( + NestedItems.NestedItemsListBuilder() + .add( + listOf( + listOf( + listOf( + 1 + ) + ), + listOf( + listOf( + 2 + ), + listOf( + 3 + ) + ) + ) + ) + .add( + listOf( + listOf( + listOf( + 4 + ), + listOf( + 5 + ), + listOf( + 6 + ) + ) + ) + ) + .build(), + configuration + ) + } +} diff --git a/samples/client/3_1_0_unit_test/kotlin/src/test/kotlin/org/openapijsonschematools/client/components/schemas/NestedOneofToCheckValidationSemanticsTest.kt b/samples/client/3_1_0_unit_test/kotlin/src/test/kotlin/org/openapijsonschematools/client/components/schemas/NestedOneofToCheckValidationSemanticsTest.kt new file mode 100644 index 00000000000..32e8f394a41 --- /dev/null +++ b/samples/client/3_1_0_unit_test/kotlin/src/test/kotlin/org/openapijsonschematools/client/components/schemas/NestedOneofToCheckValidationSemanticsTest.kt @@ -0,0 +1,38 @@ +package org.openapijsonschematools.client.components.schemas + +import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags +import org.openapijsonschematools.client.configurations.SchemaConfiguration +import org.openapijsonschematools.client.exceptions.ValidationException + +import kotlin.test.Test +import kotlin.test.assertFailsWith + +class NestedOneofToCheckValidationSemanticsTest { + companion object { + val configuration = SchemaConfiguration(JsonSchemaKeywordFlags.Builder().format().build()) + } + + @Test + fun testNullIsValidPasses() { + // null is valid + val schema = NestedOneofToCheckValidationSemantics.NestedOneofToCheckValidationSemantics1.getInstance() + schema.validate( + null, + configuration + ) + } + + @Test + fun testAnythingNonNullIsInvalidFails() { + // anything non-null is invalid + val schema = NestedOneofToCheckValidationSemantics.NestedOneofToCheckValidationSemantics1.getInstance() + assertFailsWith( + block = { + schema.validate( + 123, + configuration + ) + } + ) + } +} diff --git a/samples/client/3_1_0_unit_test/kotlin/src/test/kotlin/org/openapijsonschematools/client/components/schemas/NonAsciiPatternWithAdditionalpropertiesTest.kt b/samples/client/3_1_0_unit_test/kotlin/src/test/kotlin/org/openapijsonschematools/client/components/schemas/NonAsciiPatternWithAdditionalpropertiesTest.kt new file mode 100644 index 00000000000..3c02d6f5bb1 --- /dev/null +++ b/samples/client/3_1_0_unit_test/kotlin/src/test/kotlin/org/openapijsonschematools/client/components/schemas/NonAsciiPatternWithAdditionalpropertiesTest.kt @@ -0,0 +1,48 @@ +package org.openapijsonschematools.client.components.schemas + +import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags +import org.openapijsonschematools.client.configurations.SchemaConfiguration +import org.openapijsonschematools.client.exceptions.ValidationException + +import kotlin.test.Test +import kotlin.test.assertFailsWith + +class NonAsciiPatternWithAdditionalpropertiesTest { + companion object { + val configuration = SchemaConfiguration(JsonSchemaKeywordFlags.Builder().format().build()) + } + + @Test + fun testNotMatchingThePatternIsInvalidFails() { + // not matching the pattern is invalid + val schema = NonAsciiPatternWithAdditionalproperties.NonAsciiPatternWithAdditionalproperties1.getInstance() + assertFailsWith( + block = { + schema.validate( + mapOf( + Pair( + "élmény", + 2 + ) + ), + configuration + ) + } + ) + } + + @Test + fun testMatchingThePatternIsValidPasses() { + // matching the pattern is valid + val schema = NonAsciiPatternWithAdditionalproperties.NonAsciiPatternWithAdditionalproperties1.getInstance() + schema.validate( + mapOf( + Pair( + "ármányos", + 2 + ) + ), + configuration + ) + } +} diff --git a/samples/client/3_1_0_unit_test/kotlin/src/test/kotlin/org/openapijsonschematools/client/components/schemas/NonInterferenceAcrossCombinedSchemasTest.kt b/samples/client/3_1_0_unit_test/kotlin/src/test/kotlin/org/openapijsonschematools/client/components/schemas/NonInterferenceAcrossCombinedSchemasTest.kt new file mode 100644 index 00000000000..a349a759359 --- /dev/null +++ b/samples/client/3_1_0_unit_test/kotlin/src/test/kotlin/org/openapijsonschematools/client/components/schemas/NonInterferenceAcrossCombinedSchemasTest.kt @@ -0,0 +1,34 @@ +package org.openapijsonschematools.client.components.schemas + +import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags +import org.openapijsonschematools.client.configurations.SchemaConfiguration +import org.openapijsonschematools.client.exceptions.ValidationException + +import kotlin.test.Test +import kotlin.test.assertFailsWith + +class NonInterferenceAcrossCombinedSchemasTest { + companion object { + val configuration = SchemaConfiguration(JsonSchemaKeywordFlags.Builder().format().build()) + } + + @Test + fun testValidButWouldHaveBeenInvalidThroughElsePasses() { + // valid, but would have been invalid through else + val schema = NonInterferenceAcrossCombinedSchemas.NonInterferenceAcrossCombinedSchemas1.getInstance() + schema.validate( + 3, + configuration + ) + } + + @Test + fun testValidButWouldHaveBeenInvalidThroughThenPasses() { + // valid, but would have been invalid through then + val schema = NonInterferenceAcrossCombinedSchemas.NonInterferenceAcrossCombinedSchemas1.getInstance() + schema.validate( + -100, + configuration + ) + } +} diff --git a/samples/client/3_1_0_unit_test/kotlin/src/test/kotlin/org/openapijsonschematools/client/components/schemas/NotMoreComplexSchemaTest.kt b/samples/client/3_1_0_unit_test/kotlin/src/test/kotlin/org/openapijsonschematools/client/components/schemas/NotMoreComplexSchemaTest.kt new file mode 100644 index 00000000000..071a71852c6 --- /dev/null +++ b/samples/client/3_1_0_unit_test/kotlin/src/test/kotlin/org/openapijsonschematools/client/components/schemas/NotMoreComplexSchemaTest.kt @@ -0,0 +1,58 @@ +package org.openapijsonschematools.client.components.schemas + +import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags +import org.openapijsonschematools.client.configurations.SchemaConfiguration +import org.openapijsonschematools.client.exceptions.ValidationException + +import kotlin.test.Test +import kotlin.test.assertFailsWith + +class NotMoreComplexSchemaTest { + companion object { + val configuration = SchemaConfiguration(JsonSchemaKeywordFlags.Builder().format().build()) + } + + @Test + fun testOtherMatchPasses() { + // other match + val schema = NotMoreComplexSchema.NotMoreComplexSchema1.getInstance() + schema.validate( + mapOf( + Pair( + "foo", + 1 + ) + ), + configuration + ) + } + + @Test + fun testMismatchFails() { + // mismatch + val schema = NotMoreComplexSchema.NotMoreComplexSchema1.getInstance() + assertFailsWith( + block = { + schema.validate( + mapOf( + Pair( + "foo", + "bar" + ) + ), + configuration + ) + } + ) + } + + @Test + fun testMatchPasses() { + // match + val schema = NotMoreComplexSchema.NotMoreComplexSchema1.getInstance() + schema.validate( + 1, + configuration + ) + } +} diff --git a/samples/client/3_1_0_unit_test/kotlin/src/test/kotlin/org/openapijsonschematools/client/components/schemas/NotMultipleTypesTest.kt b/samples/client/3_1_0_unit_test/kotlin/src/test/kotlin/org/openapijsonschematools/client/components/schemas/NotMultipleTypesTest.kt new file mode 100644 index 00000000000..cba1337cb5e --- /dev/null +++ b/samples/client/3_1_0_unit_test/kotlin/src/test/kotlin/org/openapijsonschematools/client/components/schemas/NotMultipleTypesTest.kt @@ -0,0 +1,52 @@ +package org.openapijsonschematools.client.components.schemas + +import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags +import org.openapijsonschematools.client.configurations.SchemaConfiguration +import org.openapijsonschematools.client.exceptions.ValidationException + +import kotlin.test.Test +import kotlin.test.assertFailsWith + +class NotMultipleTypesTest { + companion object { + val configuration = SchemaConfiguration(JsonSchemaKeywordFlags.Builder().format().build()) + } + + @Test + fun testOtherMismatchFails() { + // other mismatch + val schema = NotMultipleTypes.NotMultipleTypes1.getInstance() + assertFailsWith( + block = { + schema.validate( + true, + configuration + ) + } + ) + } + + @Test + fun testValidPasses() { + // valid + val schema = NotMultipleTypes.NotMultipleTypes1.getInstance() + schema.validate( + "foo", + configuration + ) + } + + @Test + fun testMismatchFails() { + // mismatch + val schema = NotMultipleTypes.NotMultipleTypes1.getInstance() + assertFailsWith( + block = { + schema.validate( + 1, + configuration + ) + } + ) + } +} diff --git a/samples/client/3_1_0_unit_test/kotlin/src/test/kotlin/org/openapijsonschematools/client/components/schemas/NotTest.kt b/samples/client/3_1_0_unit_test/kotlin/src/test/kotlin/org/openapijsonschematools/client/components/schemas/NotTest.kt new file mode 100644 index 00000000000..5b208bae6d7 --- /dev/null +++ b/samples/client/3_1_0_unit_test/kotlin/src/test/kotlin/org/openapijsonschematools/client/components/schemas/NotTest.kt @@ -0,0 +1,38 @@ +package org.openapijsonschematools.client.components.schemas + +import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags +import org.openapijsonschematools.client.configurations.SchemaConfiguration +import org.openapijsonschematools.client.exceptions.ValidationException + +import kotlin.test.Test +import kotlin.test.assertFailsWith + +class NotTest { + companion object { + val configuration = SchemaConfiguration(JsonSchemaKeywordFlags.Builder().format().build()) + } + + @Test + fun testDisallowedFails() { + // disallowed + val schema = Not.Not1.getInstance() + assertFailsWith( + block = { + schema.validate( + 1, + configuration + ) + } + ) + } + + @Test + fun testAllowedPasses() { + // allowed + val schema = Not.Not1.getInstance() + schema.validate( + "foo", + configuration + ) + } +} diff --git a/samples/client/3_1_0_unit_test/kotlin/src/test/kotlin/org/openapijsonschematools/client/components/schemas/NulCharactersInStringsTest.kt b/samples/client/3_1_0_unit_test/kotlin/src/test/kotlin/org/openapijsonschematools/client/components/schemas/NulCharactersInStringsTest.kt new file mode 100644 index 00000000000..4aab8da29af --- /dev/null +++ b/samples/client/3_1_0_unit_test/kotlin/src/test/kotlin/org/openapijsonschematools/client/components/schemas/NulCharactersInStringsTest.kt @@ -0,0 +1,38 @@ +package org.openapijsonschematools.client.components.schemas + +import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags +import org.openapijsonschematools.client.configurations.SchemaConfiguration +import org.openapijsonschematools.client.exceptions.ValidationException + +import kotlin.test.Test +import kotlin.test.assertFailsWith + +class NulCharactersInStringsTest { + companion object { + val configuration = SchemaConfiguration(JsonSchemaKeywordFlags.Builder().format().build()) + } + + @Test + fun testMatchStringWithNulPasses() { + // match string with nul + val schema = NulCharactersInStrings.NulCharactersInStrings1.getInstance() + schema.validate( + "hello\u0000there", + configuration + ) + } + + @Test + fun testDoNotMatchStringLackingNulFails() { + // do not match string lacking nul + val schema = NulCharactersInStrings.NulCharactersInStrings1.getInstance() + assertFailsWith( + block = { + schema.validate( + "hellothere", + configuration + ) + } + ) + } +} diff --git a/samples/client/3_1_0_unit_test/kotlin/src/test/kotlin/org/openapijsonschematools/client/components/schemas/NullTypeMatchesOnlyTheNullObjectTest.kt b/samples/client/3_1_0_unit_test/kotlin/src/test/kotlin/org/openapijsonschematools/client/components/schemas/NullTypeMatchesOnlyTheNullObjectTest.kt new file mode 100644 index 00000000000..12779200f9c --- /dev/null +++ b/samples/client/3_1_0_unit_test/kotlin/src/test/kotlin/org/openapijsonschematools/client/components/schemas/NullTypeMatchesOnlyTheNullObjectTest.kt @@ -0,0 +1,152 @@ +package org.openapijsonschematools.client.components.schemas + +import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags +import org.openapijsonschematools.client.configurations.SchemaConfiguration +import org.openapijsonschematools.client.exceptions.ValidationException + +import kotlin.test.Test +import kotlin.test.assertFailsWith + +class NullTypeMatchesOnlyTheNullObjectTest { + companion object { + val configuration = SchemaConfiguration(JsonSchemaKeywordFlags.Builder().format().build()) + } + + @Test + fun testZeroIsNotNullFails() { + // zero is not null + val schema = NullTypeMatchesOnlyTheNullObject.NullTypeMatchesOnlyTheNullObject1.getInstance() + assertFailsWith( + block = { + schema.validate( + 0, + configuration + ) + } + ) + } + + @Test + fun testAnArrayIsNotNullFails() { + // an array is not null + val schema = NullTypeMatchesOnlyTheNullObject.NullTypeMatchesOnlyTheNullObject1.getInstance() + assertFailsWith( + block = { + schema.validate( + listOf( + ), + configuration + ) + } + ) + } + + @Test + fun testAnObjectIsNotNullFails() { + // an object is not null + val schema = NullTypeMatchesOnlyTheNullObject.NullTypeMatchesOnlyTheNullObject1.getInstance() + assertFailsWith( + block = { + schema.validate( + mapOf( + ), + configuration + ) + } + ) + } + + @Test + fun testTrueIsNotNullFails() { + // true is not null + val schema = NullTypeMatchesOnlyTheNullObject.NullTypeMatchesOnlyTheNullObject1.getInstance() + assertFailsWith( + block = { + schema.validate( + true, + configuration + ) + } + ) + } + + @Test + fun testFalseIsNotNullFails() { + // false is not null + val schema = NullTypeMatchesOnlyTheNullObject.NullTypeMatchesOnlyTheNullObject1.getInstance() + assertFailsWith( + block = { + schema.validate( + false, + configuration + ) + } + ) + } + + @Test + fun testNullIsNullPasses() { + // null is null + val schema = NullTypeMatchesOnlyTheNullObject.NullTypeMatchesOnlyTheNullObject1.getInstance() + schema.validate( + null, + configuration + ) + } + + @Test + fun testAStringIsNotNullFails() { + // a string is not null + val schema = NullTypeMatchesOnlyTheNullObject.NullTypeMatchesOnlyTheNullObject1.getInstance() + assertFailsWith( + block = { + schema.validate( + "foo", + configuration + ) + } + ) + } + + @Test + fun testAnIntegerIsNotNullFails() { + // an integer is not null + val schema = NullTypeMatchesOnlyTheNullObject.NullTypeMatchesOnlyTheNullObject1.getInstance() + assertFailsWith( + block = { + schema.validate( + 1, + configuration + ) + } + ) + } + + @Test + fun testAnEmptyStringIsNotNullFails() { + // an empty string is not null + val schema = NullTypeMatchesOnlyTheNullObject.NullTypeMatchesOnlyTheNullObject1.getInstance() + assertFailsWith( + block = { + schema.validate( + "", + configuration + ) + } + ) + } + + @Test + fun testAFloatIsNotNullFails() { + // a float is not null + val schema = NullTypeMatchesOnlyTheNullObject.NullTypeMatchesOnlyTheNullObject1.getInstance() + assertFailsWith( + block = { + schema.validate( + 1.1, + configuration + ) + } + ) + } +} diff --git a/samples/client/3_1_0_unit_test/kotlin/src/test/kotlin/org/openapijsonschematools/client/components/schemas/NumberTypeMatchesNumbersTest.kt b/samples/client/3_1_0_unit_test/kotlin/src/test/kotlin/org/openapijsonschematools/client/components/schemas/NumberTypeMatchesNumbersTest.kt new file mode 100644 index 00000000000..1ba574586e4 --- /dev/null +++ b/samples/client/3_1_0_unit_test/kotlin/src/test/kotlin/org/openapijsonschematools/client/components/schemas/NumberTypeMatchesNumbersTest.kt @@ -0,0 +1,130 @@ +package org.openapijsonschematools.client.components.schemas + +import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags +import org.openapijsonschematools.client.configurations.SchemaConfiguration +import org.openapijsonschematools.client.exceptions.ValidationException + +import kotlin.test.Test +import kotlin.test.assertFailsWith + +class NumberTypeMatchesNumbersTest { + companion object { + val configuration = SchemaConfiguration(JsonSchemaKeywordFlags.Builder().format().build()) + } + + @Test + fun testAFloatIsANumberPasses() { + // a float is a number + val schema = NumberTypeMatchesNumbers.NumberTypeMatchesNumbers1.getInstance() + schema.validate( + 1.1, + configuration + ) + } + + @Test + fun testAnIntegerIsANumberPasses() { + // an integer is a number + val schema = NumberTypeMatchesNumbers.NumberTypeMatchesNumbers1.getInstance() + schema.validate( + 1, + configuration + ) + } + + @Test + fun testAStringIsStillNotANumberEvenIfItLooksLikeOneFails() { + // a string is still not a number, even if it looks like one + val schema = NumberTypeMatchesNumbers.NumberTypeMatchesNumbers1.getInstance() + assertFailsWith( + block = { + schema.validate( + "1", + configuration + ) + } + ) + } + + @Test + fun testABooleanIsNotANumberFails() { + // a boolean is not a number + val schema = NumberTypeMatchesNumbers.NumberTypeMatchesNumbers1.getInstance() + assertFailsWith( + block = { + schema.validate( + true, + configuration + ) + } + ) + } + + @Test + fun testAFloatWithZeroFractionalPartIsANumberAndAnIntegerPasses() { + // a float with zero fractional part is a number (and an integer) + val schema = NumberTypeMatchesNumbers.NumberTypeMatchesNumbers1.getInstance() + schema.validate( + 1.0, + configuration + ) + } + + @Test + fun testNullIsNotANumberFails() { + // null is not a number + val schema = NumberTypeMatchesNumbers.NumberTypeMatchesNumbers1.getInstance() + assertFailsWith( + block = { + schema.validate( + null, + configuration + ) + } + ) + } + + @Test + fun testAStringIsNotANumberFails() { + // a string is not a number + val schema = NumberTypeMatchesNumbers.NumberTypeMatchesNumbers1.getInstance() + assertFailsWith( + block = { + schema.validate( + "foo", + configuration + ) + } + ) + } + + @Test + fun testAnArrayIsNotANumberFails() { + // an array is not a number + val schema = NumberTypeMatchesNumbers.NumberTypeMatchesNumbers1.getInstance() + assertFailsWith( + block = { + schema.validate( + listOf( + ), + configuration + ) + } + ) + } + + @Test + fun testAnObjectIsNotANumberFails() { + // an object is not a number + val schema = NumberTypeMatchesNumbers.NumberTypeMatchesNumbers1.getInstance() + assertFailsWith( + block = { + schema.validate( + mapOf( + ), + configuration + ) + } + ) + } +} diff --git a/samples/client/3_1_0_unit_test/kotlin/src/test/kotlin/org/openapijsonschematools/client/components/schemas/ObjectPropertiesValidationTest.kt b/samples/client/3_1_0_unit_test/kotlin/src/test/kotlin/org/openapijsonschematools/client/components/schemas/ObjectPropertiesValidationTest.kt new file mode 100644 index 00000000000..aab7819536b --- /dev/null +++ b/samples/client/3_1_0_unit_test/kotlin/src/test/kotlin/org/openapijsonschematools/client/components/schemas/ObjectPropertiesValidationTest.kt @@ -0,0 +1,119 @@ +package org.openapijsonschematools.client.components.schemas + +import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags +import org.openapijsonschematools.client.configurations.SchemaConfiguration +import org.openapijsonschematools.client.exceptions.ValidationException + +import kotlin.test.Test +import kotlin.test.assertFailsWith + +class ObjectPropertiesValidationTest { + companion object { + val configuration = SchemaConfiguration(JsonSchemaKeywordFlags.Builder().format().build()) + } + + @Test + fun testBothPropertiesPresentAndValidIsValidPasses() { + // both properties present and valid is valid + val schema = ObjectPropertiesValidation.ObjectPropertiesValidation1.getInstance() + schema.validate( + mapOf( + Pair( + "foo", + 1 + ), + Pair( + "bar", + "baz" + ) + ), + configuration + ) + } + + @Test + fun testDoesnTInvalidateOtherPropertiesPasses() { + // doesn't invalidate other properties + val schema = ObjectPropertiesValidation.ObjectPropertiesValidation1.getInstance() + schema.validate( + mapOf( + Pair( + "quux", + listOf( + ) + ) + ), + configuration + ) + } + + @Test + fun testIgnoresOtherNonObjectsPasses() { + // ignores other non-objects + val schema = ObjectPropertiesValidation.ObjectPropertiesValidation1.getInstance() + schema.validate( + 12, + configuration + ) + } + + @Test + fun testBothPropertiesInvalidIsInvalidFails() { + // both properties invalid is invalid + val schema = ObjectPropertiesValidation.ObjectPropertiesValidation1.getInstance() + assertFailsWith( + block = { + schema.validate( + mapOf( + Pair( + "foo", + listOf( + ) + ), + Pair( + "bar", + mapOf( + ) + ) + ), + configuration + ) + } + ) + } + + @Test + fun testIgnoresArraysPasses() { + // ignores arrays + val schema = ObjectPropertiesValidation.ObjectPropertiesValidation1.getInstance() + schema.validate( + listOf( + ), + configuration + ) + } + + @Test + fun testOnePropertyInvalidIsInvalidFails() { + // one property invalid is invalid + val schema = ObjectPropertiesValidation.ObjectPropertiesValidation1.getInstance() + assertFailsWith( + block = { + schema.validate( + mapOf( + Pair( + "foo", + 1 + ), + Pair( + "bar", + mapOf( + ) + ) + ), + configuration + ) + } + ) + } +} diff --git a/samples/client/3_1_0_unit_test/kotlin/src/test/kotlin/org/openapijsonschematools/client/components/schemas/ObjectTypeMatchesObjectsTest.kt b/samples/client/3_1_0_unit_test/kotlin/src/test/kotlin/org/openapijsonschematools/client/components/schemas/ObjectTypeMatchesObjectsTest.kt new file mode 100644 index 00000000000..16082afdb8d --- /dev/null +++ b/samples/client/3_1_0_unit_test/kotlin/src/test/kotlin/org/openapijsonschematools/client/components/schemas/ObjectTypeMatchesObjectsTest.kt @@ -0,0 +1,110 @@ +package org.openapijsonschematools.client.components.schemas + +import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags +import org.openapijsonschematools.client.configurations.SchemaConfiguration +import org.openapijsonschematools.client.exceptions.ValidationException + +import kotlin.test.Test +import kotlin.test.assertFailsWith + +class ObjectTypeMatchesObjectsTest { + companion object { + val configuration = SchemaConfiguration(JsonSchemaKeywordFlags.Builder().format().build()) + } + + @Test + fun testAnObjectIsAnObjectPasses() { + // an object is an object + val schema = ObjectTypeMatchesObjects.ObjectTypeMatchesObjects1.getInstance() + schema.validate( + mapOf( + ), + configuration + ) + } + + @Test + fun testAnArrayIsNotAnObjectFails() { + // an array is not an object + val schema = ObjectTypeMatchesObjects.ObjectTypeMatchesObjects1.getInstance() + assertFailsWith( + block = { + schema.validate( + listOf( + ), + configuration + ) + } + ) + } + + @Test + fun testAnIntegerIsNotAnObjectFails() { + // an integer is not an object + val schema = ObjectTypeMatchesObjects.ObjectTypeMatchesObjects1.getInstance() + assertFailsWith( + block = { + schema.validate( + 1, + configuration + ) + } + ) + } + + @Test + fun testABooleanIsNotAnObjectFails() { + // a boolean is not an object + val schema = ObjectTypeMatchesObjects.ObjectTypeMatchesObjects1.getInstance() + assertFailsWith( + block = { + schema.validate( + true, + configuration + ) + } + ) + } + + @Test + fun testAStringIsNotAnObjectFails() { + // a string is not an object + val schema = ObjectTypeMatchesObjects.ObjectTypeMatchesObjects1.getInstance() + assertFailsWith( + block = { + schema.validate( + "foo", + configuration + ) + } + ) + } + + @Test + fun testAFloatIsNotAnObjectFails() { + // a float is not an object + val schema = ObjectTypeMatchesObjects.ObjectTypeMatchesObjects1.getInstance() + assertFailsWith( + block = { + schema.validate( + 1.1, + configuration + ) + } + ) + } + + @Test + fun testNullIsNotAnObjectFails() { + // null is not an object + val schema = ObjectTypeMatchesObjects.ObjectTypeMatchesObjects1.getInstance() + assertFailsWith( + block = { + schema.validate( + null, + configuration + ) + } + ) + } +} diff --git a/samples/client/3_1_0_unit_test/kotlin/src/test/kotlin/org/openapijsonschematools/client/components/schemas/OneofComplexTypesTest.kt b/samples/client/3_1_0_unit_test/kotlin/src/test/kotlin/org/openapijsonschematools/client/components/schemas/OneofComplexTypesTest.kt new file mode 100644 index 00000000000..8f9fb57ea7b --- /dev/null +++ b/samples/client/3_1_0_unit_test/kotlin/src/test/kotlin/org/openapijsonschematools/client/components/schemas/OneofComplexTypesTest.kt @@ -0,0 +1,90 @@ +package org.openapijsonschematools.client.components.schemas + +import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags +import org.openapijsonschematools.client.configurations.SchemaConfiguration +import org.openapijsonschematools.client.exceptions.ValidationException + +import kotlin.test.Test +import kotlin.test.assertFailsWith + +class OneofComplexTypesTest { + companion object { + val configuration = SchemaConfiguration(JsonSchemaKeywordFlags.Builder().format().build()) + } + + @Test + fun testSecondOneofValidComplexPasses() { + // second oneOf valid (complex) + val schema = OneofComplexTypes.OneofComplexTypes1.getInstance() + schema.validate( + mapOf( + Pair( + "foo", + "baz" + ) + ), + configuration + ) + } + + @Test + fun testBothOneofValidComplexFails() { + // both oneOf valid (complex) + val schema = OneofComplexTypes.OneofComplexTypes1.getInstance() + assertFailsWith( + block = { + schema.validate( + mapOf( + Pair( + "foo", + "baz" + ), + Pair( + "bar", + 2 + ) + ), + configuration + ) + } + ) + } + + @Test + fun testFirstOneofValidComplexPasses() { + // first oneOf valid (complex) + val schema = OneofComplexTypes.OneofComplexTypes1.getInstance() + schema.validate( + mapOf( + Pair( + "bar", + 2 + ) + ), + configuration + ) + } + + @Test + fun testNeitherOneofValidComplexFails() { + // neither oneOf valid (complex) + val schema = OneofComplexTypes.OneofComplexTypes1.getInstance() + assertFailsWith( + block = { + schema.validate( + mapOf( + Pair( + "foo", + 2 + ), + Pair( + "bar", + "quux" + ) + ), + configuration + ) + } + ) + } +} diff --git a/samples/client/3_1_0_unit_test/kotlin/src/test/kotlin/org/openapijsonschematools/client/components/schemas/OneofTest.kt b/samples/client/3_1_0_unit_test/kotlin/src/test/kotlin/org/openapijsonschematools/client/components/schemas/OneofTest.kt new file mode 100644 index 00000000000..012d577b9ec --- /dev/null +++ b/samples/client/3_1_0_unit_test/kotlin/src/test/kotlin/org/openapijsonschematools/client/components/schemas/OneofTest.kt @@ -0,0 +1,62 @@ +package org.openapijsonschematools.client.components.schemas + +import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags +import org.openapijsonschematools.client.configurations.SchemaConfiguration +import org.openapijsonschematools.client.exceptions.ValidationException + +import kotlin.test.Test +import kotlin.test.assertFailsWith + +class OneofTest { + companion object { + val configuration = SchemaConfiguration(JsonSchemaKeywordFlags.Builder().format().build()) + } + + @Test + fun testBothOneofValidFails() { + // both oneOf valid + val schema = Oneof.Oneof1.getInstance() + assertFailsWith( + block = { + schema.validate( + 3, + configuration + ) + } + ) + } + + @Test + fun testNeitherOneofValidFails() { + // neither oneOf valid + val schema = Oneof.Oneof1.getInstance() + assertFailsWith( + block = { + schema.validate( + 1.5, + configuration + ) + } + ) + } + + @Test + fun testSecondOneofValidPasses() { + // second oneOf valid + val schema = Oneof.Oneof1.getInstance() + schema.validate( + 2.5, + configuration + ) + } + + @Test + fun testFirstOneofValidPasses() { + // first oneOf valid + val schema = Oneof.Oneof1.getInstance() + schema.validate( + 1, + configuration + ) + } +} diff --git a/samples/client/3_1_0_unit_test/kotlin/src/test/kotlin/org/openapijsonschematools/client/components/schemas/OneofWithBaseSchemaTest.kt b/samples/client/3_1_0_unit_test/kotlin/src/test/kotlin/org/openapijsonschematools/client/components/schemas/OneofWithBaseSchemaTest.kt new file mode 100644 index 00000000000..e5ec716ea82 --- /dev/null +++ b/samples/client/3_1_0_unit_test/kotlin/src/test/kotlin/org/openapijsonschematools/client/components/schemas/OneofWithBaseSchemaTest.kt @@ -0,0 +1,52 @@ +package org.openapijsonschematools.client.components.schemas + +import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags +import org.openapijsonschematools.client.configurations.SchemaConfiguration +import org.openapijsonschematools.client.exceptions.ValidationException + +import kotlin.test.Test +import kotlin.test.assertFailsWith + +class OneofWithBaseSchemaTest { + companion object { + val configuration = SchemaConfiguration(JsonSchemaKeywordFlags.Builder().format().build()) + } + + @Test + fun testMismatchBaseSchemaFails() { + // mismatch base schema + val schema = OneofWithBaseSchema.OneofWithBaseSchema1.getInstance() + assertFailsWith( + block = { + schema.validate( + 3, + configuration + ) + } + ) + } + + @Test + fun testOneOneofValidPasses() { + // one oneOf valid + val schema = OneofWithBaseSchema.OneofWithBaseSchema1.getInstance() + schema.validate( + "foobar", + configuration + ) + } + + @Test + fun testBothOneofValidFails() { + // both oneOf valid + val schema = OneofWithBaseSchema.OneofWithBaseSchema1.getInstance() + assertFailsWith( + block = { + schema.validate( + "foo", + configuration + ) + } + ) + } +} diff --git a/samples/client/3_1_0_unit_test/kotlin/src/test/kotlin/org/openapijsonschematools/client/components/schemas/OneofWithEmptySchemaTest.kt b/samples/client/3_1_0_unit_test/kotlin/src/test/kotlin/org/openapijsonschematools/client/components/schemas/OneofWithEmptySchemaTest.kt new file mode 100644 index 00000000000..844584e08c3 --- /dev/null +++ b/samples/client/3_1_0_unit_test/kotlin/src/test/kotlin/org/openapijsonschematools/client/components/schemas/OneofWithEmptySchemaTest.kt @@ -0,0 +1,38 @@ +package org.openapijsonschematools.client.components.schemas + +import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags +import org.openapijsonschematools.client.configurations.SchemaConfiguration +import org.openapijsonschematools.client.exceptions.ValidationException + +import kotlin.test.Test +import kotlin.test.assertFailsWith + +class OneofWithEmptySchemaTest { + companion object { + val configuration = SchemaConfiguration(JsonSchemaKeywordFlags.Builder().format().build()) + } + + @Test + fun testOneValidValidPasses() { + // one valid - valid + val schema = OneofWithEmptySchema.OneofWithEmptySchema1.getInstance() + schema.validate( + "foo", + configuration + ) + } + + @Test + fun testBothValidInvalidFails() { + // both valid - invalid + val schema = OneofWithEmptySchema.OneofWithEmptySchema1.getInstance() + assertFailsWith( + block = { + schema.validate( + 123, + configuration + ) + } + ) + } +} diff --git a/samples/client/3_1_0_unit_test/kotlin/src/test/kotlin/org/openapijsonschematools/client/components/schemas/OneofWithRequiredTest.kt b/samples/client/3_1_0_unit_test/kotlin/src/test/kotlin/org/openapijsonschematools/client/components/schemas/OneofWithRequiredTest.kt new file mode 100644 index 00000000000..da6b03e6370 --- /dev/null +++ b/samples/client/3_1_0_unit_test/kotlin/src/test/kotlin/org/openapijsonschematools/client/components/schemas/OneofWithRequiredTest.kt @@ -0,0 +1,98 @@ +package org.openapijsonschematools.client.components.schemas + +import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags +import org.openapijsonschematools.client.configurations.SchemaConfiguration +import org.openapijsonschematools.client.exceptions.ValidationException + +import kotlin.test.Test +import kotlin.test.assertFailsWith + +class OneofWithRequiredTest { + companion object { + val configuration = SchemaConfiguration(JsonSchemaKeywordFlags.Builder().format().build()) + } + + @Test + fun testFirstValidValidPasses() { + // first valid - valid + val schema = OneofWithRequired.OneofWithRequired1.getInstance() + schema.validate( + mapOf( + Pair( + "foo", + 1 + ), + Pair( + "bar", + 2 + ) + ), + configuration + ) + } + + @Test + fun testBothValidInvalidFails() { + // both valid - invalid + val schema = OneofWithRequired.OneofWithRequired1.getInstance() + assertFailsWith( + block = { + schema.validate( + mapOf( + Pair( + "foo", + 1 + ), + Pair( + "bar", + 2 + ), + Pair( + "baz", + 3 + ) + ), + configuration + ) + } + ) + } + + @Test + fun testSecondValidValidPasses() { + // second valid - valid + val schema = OneofWithRequired.OneofWithRequired1.getInstance() + schema.validate( + mapOf( + Pair( + "foo", + 1 + ), + Pair( + "baz", + 3 + ) + ), + configuration + ) + } + + @Test + fun testBothInvalidInvalidFails() { + // both invalid - invalid + val schema = OneofWithRequired.OneofWithRequired1.getInstance() + assertFailsWith( + block = { + schema.validate( + mapOf( + Pair( + "bar", + 2 + ) + ), + configuration + ) + } + ) + } +} diff --git a/samples/client/3_1_0_unit_test/kotlin/src/test/kotlin/org/openapijsonschematools/client/components/schemas/PatternIsNotAnchoredTest.kt b/samples/client/3_1_0_unit_test/kotlin/src/test/kotlin/org/openapijsonschematools/client/components/schemas/PatternIsNotAnchoredTest.kt new file mode 100644 index 00000000000..3e54785ff69 --- /dev/null +++ b/samples/client/3_1_0_unit_test/kotlin/src/test/kotlin/org/openapijsonschematools/client/components/schemas/PatternIsNotAnchoredTest.kt @@ -0,0 +1,24 @@ +package org.openapijsonschematools.client.components.schemas + +import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags +import org.openapijsonschematools.client.configurations.SchemaConfiguration +import org.openapijsonschematools.client.exceptions.ValidationException + +import kotlin.test.Test +import kotlin.test.assertFailsWith + +class PatternIsNotAnchoredTest { + companion object { + val configuration = SchemaConfiguration(JsonSchemaKeywordFlags.Builder().format().build()) + } + + @Test + fun testMatchesASubstringPasses() { + // matches a substring + val schema = PatternIsNotAnchored.PatternIsNotAnchored1.getInstance() + schema.validate( + "xxaayy", + configuration + ) + } +} diff --git a/samples/client/3_1_0_unit_test/kotlin/src/test/kotlin/org/openapijsonschematools/client/components/schemas/PatternValidationTest.kt b/samples/client/3_1_0_unit_test/kotlin/src/test/kotlin/org/openapijsonschematools/client/components/schemas/PatternValidationTest.kt new file mode 100644 index 00000000000..0a4d35fd533 --- /dev/null +++ b/samples/client/3_1_0_unit_test/kotlin/src/test/kotlin/org/openapijsonschematools/client/components/schemas/PatternValidationTest.kt @@ -0,0 +1,100 @@ +package org.openapijsonschematools.client.components.schemas + +import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags +import org.openapijsonschematools.client.configurations.SchemaConfiguration +import org.openapijsonschematools.client.exceptions.ValidationException + +import kotlin.test.Test +import kotlin.test.assertFailsWith + +class PatternValidationTest { + companion object { + val configuration = SchemaConfiguration(JsonSchemaKeywordFlags.Builder().format().build()) + } + + @Test + fun testIgnoresBooleansPasses() { + // ignores booleans + val schema = PatternValidation.PatternValidation1.getInstance() + schema.validate( + true, + configuration + ) + } + + @Test + fun testIgnoresFloatsPasses() { + // ignores floats + val schema = PatternValidation.PatternValidation1.getInstance() + schema.validate( + 1.0, + configuration + ) + } + + @Test + fun testANonMatchingPatternIsInvalidFails() { + // a non-matching pattern is invalid + val schema = PatternValidation.PatternValidation1.getInstance() + assertFailsWith( + block = { + schema.validate( + "abc", + configuration + ) + } + ) + } + + @Test + fun testIgnoresIntegersPasses() { + // ignores integers + val schema = PatternValidation.PatternValidation1.getInstance() + schema.validate( + 123, + configuration + ) + } + + @Test + fun testAMatchingPatternIsValidPasses() { + // a matching pattern is valid + val schema = PatternValidation.PatternValidation1.getInstance() + schema.validate( + "aaa", + configuration + ) + } + + @Test + fun testIgnoresArraysPasses() { + // ignores arrays + val schema = PatternValidation.PatternValidation1.getInstance() + schema.validate( + listOf( + ), + configuration + ) + } + + @Test + fun testIgnoresObjectsPasses() { + // ignores objects + val schema = PatternValidation.PatternValidation1.getInstance() + schema.validate( + mapOf( + ), + configuration + ) + } + + @Test + fun testIgnoresNullPasses() { + // ignores null + val schema = PatternValidation.PatternValidation1.getInstance() + schema.validate( + null, + configuration + ) + } +} diff --git a/samples/client/3_1_0_unit_test/kotlin/src/test/kotlin/org/openapijsonschematools/client/components/schemas/PatternpropertiesValidatesPropertiesMatchingARegexTest.kt b/samples/client/3_1_0_unit_test/kotlin/src/test/kotlin/org/openapijsonschematools/client/components/schemas/PatternpropertiesValidatesPropertiesMatchingARegexTest.kt new file mode 100644 index 00000000000..9a90d873082 --- /dev/null +++ b/samples/client/3_1_0_unit_test/kotlin/src/test/kotlin/org/openapijsonschematools/client/components/schemas/PatternpropertiesValidatesPropertiesMatchingARegexTest.kt @@ -0,0 +1,126 @@ +package org.openapijsonschematools.client.components.schemas + +import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags +import org.openapijsonschematools.client.configurations.SchemaConfiguration +import org.openapijsonschematools.client.exceptions.ValidationException + +import kotlin.test.Test +import kotlin.test.assertFailsWith + +class PatternpropertiesValidatesPropertiesMatchingARegexTest { + companion object { + val configuration = SchemaConfiguration(JsonSchemaKeywordFlags.Builder().format().build()) + } + + @Test + fun testMultipleInvalidMatchesIsInvalidFails() { + // multiple invalid matches is invalid + val schema = PatternpropertiesValidatesPropertiesMatchingARegex.PatternpropertiesValidatesPropertiesMatchingARegex1.getInstance() + assertFailsWith( + block = { + schema.validate( + mapOf( + Pair( + "foo", + "bar" + ), + Pair( + "foooooo", + "baz" + ) + ), + configuration + ) + } + ) + } + + @Test + fun testASingleValidMatchIsValidPasses() { + // a single valid match is valid + val schema = PatternpropertiesValidatesPropertiesMatchingARegex.PatternpropertiesValidatesPropertiesMatchingARegex1.getInstance() + schema.validate( + mapOf( + Pair( + "foo", + 1 + ) + ), + configuration + ) + } + + @Test + fun testIgnoresOtherNonObjectsPasses() { + // ignores other non-objects + val schema = PatternpropertiesValidatesPropertiesMatchingARegex.PatternpropertiesValidatesPropertiesMatchingARegex1.getInstance() + schema.validate( + 12, + configuration + ) + } + + @Test + fun testASingleInvalidMatchIsInvalidFails() { + // a single invalid match is invalid + val schema = PatternpropertiesValidatesPropertiesMatchingARegex.PatternpropertiesValidatesPropertiesMatchingARegex1.getInstance() + assertFailsWith( + block = { + schema.validate( + mapOf( + Pair( + "foo", + "bar" + ), + Pair( + "fooooo", + 2 + ) + ), + configuration + ) + } + ) + } + + @Test + fun testMultipleValidMatchesIsValidPasses() { + // multiple valid matches is valid + val schema = PatternpropertiesValidatesPropertiesMatchingARegex.PatternpropertiesValidatesPropertiesMatchingARegex1.getInstance() + schema.validate( + mapOf( + Pair( + "foo", + 1 + ), + Pair( + "foooooo", + 2 + ) + ), + configuration + ) + } + + @Test + fun testIgnoresArraysPasses() { + // ignores arrays + val schema = PatternpropertiesValidatesPropertiesMatchingARegex.PatternpropertiesValidatesPropertiesMatchingARegex1.getInstance() + schema.validate( + listOf( + "foo" + ), + configuration + ) + } + + @Test + fun testIgnoresStringsPasses() { + // ignores strings + val schema = PatternpropertiesValidatesPropertiesMatchingARegex.PatternpropertiesValidatesPropertiesMatchingARegex1.getInstance() + schema.validate( + "foo", + configuration + ) + } +} diff --git a/samples/client/3_1_0_unit_test/kotlin/src/test/kotlin/org/openapijsonschematools/client/components/schemas/PatternpropertiesWithNullValuedInstancePropertiesTest.kt b/samples/client/3_1_0_unit_test/kotlin/src/test/kotlin/org/openapijsonschematools/client/components/schemas/PatternpropertiesWithNullValuedInstancePropertiesTest.kt new file mode 100644 index 00000000000..aeda482d921 --- /dev/null +++ b/samples/client/3_1_0_unit_test/kotlin/src/test/kotlin/org/openapijsonschematools/client/components/schemas/PatternpropertiesWithNullValuedInstancePropertiesTest.kt @@ -0,0 +1,29 @@ +package org.openapijsonschematools.client.components.schemas + +import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags +import org.openapijsonschematools.client.configurations.SchemaConfiguration +import org.openapijsonschematools.client.exceptions.ValidationException + +import kotlin.test.Test +import kotlin.test.assertFailsWith + +class PatternpropertiesWithNullValuedInstancePropertiesTest { + companion object { + val configuration = SchemaConfiguration(JsonSchemaKeywordFlags.Builder().format().build()) + } + + @Test + fun testAllowsNullValuesPasses() { + // allows null values + val schema = PatternpropertiesWithNullValuedInstanceProperties.PatternpropertiesWithNullValuedInstanceProperties1.getInstance() + schema.validate( + mapOf( + Pair( + "foobar", + null + ) + ), + configuration + ) + } +} diff --git a/samples/client/3_1_0_unit_test/kotlin/src/test/kotlin/org/openapijsonschematools/client/components/schemas/PrefixitemsValidationAdjustsTheStartingIndexForItemsTest.kt b/samples/client/3_1_0_unit_test/kotlin/src/test/kotlin/org/openapijsonschematools/client/components/schemas/PrefixitemsValidationAdjustsTheStartingIndexForItemsTest.kt new file mode 100644 index 00000000000..804b01b6a7f --- /dev/null +++ b/samples/client/3_1_0_unit_test/kotlin/src/test/kotlin/org/openapijsonschematools/client/components/schemas/PrefixitemsValidationAdjustsTheStartingIndexForItemsTest.kt @@ -0,0 +1,48 @@ +package org.openapijsonschematools.client.components.schemas + +import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags +import org.openapijsonschematools.client.configurations.SchemaConfiguration +import org.openapijsonschematools.client.exceptions.ValidationException + +import kotlin.test.Test +import kotlin.test.assertFailsWith + +class PrefixitemsValidationAdjustsTheStartingIndexForItemsTest { + companion object { + val configuration = SchemaConfiguration(JsonSchemaKeywordFlags.Builder().format().build()) + } + + @Test + fun testValidItemsPasses() { + // valid items + val schema = PrefixitemsValidationAdjustsTheStartingIndexForItems.PrefixitemsValidationAdjustsTheStartingIndexForItems1.getInstance() + schema.validate( + PrefixitemsValidationAdjustsTheStartingIndexForItems.PrefixitemsValidationAdjustsTheStartingIndexForItemsListBuilder() + .add("x") + + .add(2) + + .add(3) + + .build(), + configuration + ) + } + + @Test + fun testWrongTypeOfSecondItemFails() { + // wrong type of second item + val schema = PrefixitemsValidationAdjustsTheStartingIndexForItems.PrefixitemsValidationAdjustsTheStartingIndexForItems1.getInstance() + assertFailsWith( + block = { + schema.validate( + listOf( + "x", + "y" + ), + configuration + ) + } + ) + } +} diff --git a/samples/client/3_1_0_unit_test/kotlin/src/test/kotlin/org/openapijsonschematools/client/components/schemas/PrefixitemsWithNullInstanceElementsTest.kt b/samples/client/3_1_0_unit_test/kotlin/src/test/kotlin/org/openapijsonschematools/client/components/schemas/PrefixitemsWithNullInstanceElementsTest.kt new file mode 100644 index 00000000000..7a8883544df --- /dev/null +++ b/samples/client/3_1_0_unit_test/kotlin/src/test/kotlin/org/openapijsonschematools/client/components/schemas/PrefixitemsWithNullInstanceElementsTest.kt @@ -0,0 +1,27 @@ +package org.openapijsonschematools.client.components.schemas + +import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags +import org.openapijsonschematools.client.configurations.SchemaConfiguration +import org.openapijsonschematools.client.exceptions.ValidationException + +import kotlin.test.Test +import kotlin.test.assertFailsWith + +class PrefixitemsWithNullInstanceElementsTest { + companion object { + val configuration = SchemaConfiguration(JsonSchemaKeywordFlags.Builder().format().build()) + } + + @Test + fun testAllowsNullElementsPasses() { + // allows null elements + val schema = PrefixitemsWithNullInstanceElements.PrefixitemsWithNullInstanceElements1.getInstance() + schema.validate( + PrefixitemsWithNullInstanceElements.PrefixitemsWithNullInstanceElementsListBuilder() + .add(null) + + .build(), + configuration + ) + } +} diff --git a/samples/client/3_1_0_unit_test/kotlin/src/test/kotlin/org/openapijsonschematools/client/components/schemas/PropertiesPatternpropertiesAdditionalpropertiesInteractionTest.kt b/samples/client/3_1_0_unit_test/kotlin/src/test/kotlin/org/openapijsonschematools/client/components/schemas/PropertiesPatternpropertiesAdditionalpropertiesInteractionTest.kt new file mode 100644 index 00000000000..f35421aeef5 --- /dev/null +++ b/samples/client/3_1_0_unit_test/kotlin/src/test/kotlin/org/openapijsonschematools/client/components/schemas/PropertiesPatternpropertiesAdditionalpropertiesInteractionTest.kt @@ -0,0 +1,164 @@ +package org.openapijsonschematools.client.components.schemas + +import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags +import org.openapijsonschematools.client.configurations.SchemaConfiguration +import org.openapijsonschematools.client.exceptions.ValidationException + +import kotlin.test.Test +import kotlin.test.assertFailsWith + +class PropertiesPatternpropertiesAdditionalpropertiesInteractionTest { + companion object { + val configuration = SchemaConfiguration(JsonSchemaKeywordFlags.Builder().format().build()) + } + + @Test + fun testPropertyValidatesPropertyPasses() { + // property validates property + val schema = PropertiesPatternpropertiesAdditionalpropertiesInteraction.PropertiesPatternpropertiesAdditionalpropertiesInteraction1.getInstance() + schema.validate( + mapOf( + Pair( + "foo", + listOf( + 1, + 2 + ) + ) + ), + configuration + ) + } + + @Test + fun testAdditionalpropertyIgnoresPropertyPasses() { + // additionalProperty ignores property + val schema = PropertiesPatternpropertiesAdditionalpropertiesInteraction.PropertiesPatternpropertiesAdditionalpropertiesInteraction1.getInstance() + schema.validate( + mapOf( + Pair( + "bar", + listOf( + ) + ) + ), + configuration + ) + } + + @Test + fun testPatternpropertyInvalidatesPropertyFails() { + // patternProperty invalidates property + val schema = PropertiesPatternpropertiesAdditionalpropertiesInteraction.PropertiesPatternpropertiesAdditionalpropertiesInteraction1.getInstance() + assertFailsWith( + block = { + schema.validate( + mapOf( + Pair( + "foo", + listOf( + ) + ) + ), + configuration + ) + } + ) + } + + @Test + fun testPatternpropertyValidatesNonpropertyPasses() { + // patternProperty validates nonproperty + val schema = PropertiesPatternpropertiesAdditionalpropertiesInteraction.PropertiesPatternpropertiesAdditionalpropertiesInteraction1.getInstance() + schema.validate( + mapOf( + Pair( + "fxo", + listOf( + 1, + 2 + ) + ) + ), + configuration + ) + } + + @Test + fun testPatternpropertyInvalidatesNonpropertyFails() { + // patternProperty invalidates nonproperty + val schema = PropertiesPatternpropertiesAdditionalpropertiesInteraction.PropertiesPatternpropertiesAdditionalpropertiesInteraction1.getInstance() + assertFailsWith( + block = { + schema.validate( + mapOf( + Pair( + "fxo", + listOf( + ) + ) + ), + configuration + ) + } + ) + } + + @Test + fun testPropertyInvalidatesPropertyFails() { + // property invalidates property + val schema = PropertiesPatternpropertiesAdditionalpropertiesInteraction.PropertiesPatternpropertiesAdditionalpropertiesInteraction1.getInstance() + assertFailsWith( + block = { + schema.validate( + mapOf( + Pair( + "foo", + listOf( + 1, + 2, + 3, + 4 + ) + ) + ), + configuration + ) + } + ) + } + + @Test + fun testAdditionalpropertyInvalidatesOthersFails() { + // additionalProperty invalidates others + val schema = PropertiesPatternpropertiesAdditionalpropertiesInteraction.PropertiesPatternpropertiesAdditionalpropertiesInteraction1.getInstance() + assertFailsWith( + block = { + schema.validate( + mapOf( + Pair( + "quux", + "foo" + ) + ), + configuration + ) + } + ) + } + + @Test + fun testAdditionalpropertyValidatesOthersPasses() { + // additionalProperty validates others + val schema = PropertiesPatternpropertiesAdditionalpropertiesInteraction.PropertiesPatternpropertiesAdditionalpropertiesInteraction1.getInstance() + schema.validate( + mapOf( + Pair( + "quux", + 3 + ) + ), + configuration + ) + } +} diff --git a/samples/client/3_1_0_unit_test/kotlin/src/test/kotlin/org/openapijsonschematools/client/components/schemas/PropertiesWhoseNamesAreJavascriptObjectPropertyNamesTest.kt b/samples/client/3_1_0_unit_test/kotlin/src/test/kotlin/org/openapijsonschematools/client/components/schemas/PropertiesWhoseNamesAreJavascriptObjectPropertyNamesTest.kt new file mode 100644 index 00000000000..9b6f913d5fc --- /dev/null +++ b/samples/client/3_1_0_unit_test/kotlin/src/test/kotlin/org/openapijsonschematools/client/components/schemas/PropertiesWhoseNamesAreJavascriptObjectPropertyNamesTest.kt @@ -0,0 +1,141 @@ +package org.openapijsonschematools.client.components.schemas + +import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags +import org.openapijsonschematools.client.configurations.SchemaConfiguration +import org.openapijsonschematools.client.exceptions.ValidationException + +import kotlin.test.Test +import kotlin.test.assertFailsWith + +class PropertiesWhoseNamesAreJavascriptObjectPropertyNamesTest { + companion object { + val configuration = SchemaConfiguration(JsonSchemaKeywordFlags.Builder().format().build()) + } + + @Test + fun testProtoNotValidFails() { + // __proto__ not valid + val schema = PropertiesWhoseNamesAreJavascriptObjectPropertyNames.PropertiesWhoseNamesAreJavascriptObjectPropertyNames1.getInstance() + assertFailsWith( + block = { + schema.validate( + mapOf( + Pair( + "__proto__", + "foo" + ) + ), + configuration + ) + } + ) + } + + @Test + fun testNoneOfThePropertiesMentionedPasses() { + // none of the properties mentioned + val schema = PropertiesWhoseNamesAreJavascriptObjectPropertyNames.PropertiesWhoseNamesAreJavascriptObjectPropertyNames1.getInstance() + schema.validate( + mapOf( + ), + configuration + ) + } + + @Test + fun testIgnoresOtherNonObjectsPasses() { + // ignores other non-objects + val schema = PropertiesWhoseNamesAreJavascriptObjectPropertyNames.PropertiesWhoseNamesAreJavascriptObjectPropertyNames1.getInstance() + schema.validate( + 12, + configuration + ) + } + + @Test + fun testAllPresentAndValidPasses() { + // all present and valid + val schema = PropertiesWhoseNamesAreJavascriptObjectPropertyNames.PropertiesWhoseNamesAreJavascriptObjectPropertyNames1.getInstance() + schema.validate( + mapOf( + Pair( + "__proto__", + 12 + ), + Pair( + "toString", + mapOf( + Pair( + "length", + "foo" + ) + ) + ), + Pair( + "constructor", + 37 + ) + ), + configuration + ) + } + + @Test + fun testConstructorNotValidFails() { + // constructor not valid + val schema = PropertiesWhoseNamesAreJavascriptObjectPropertyNames.PropertiesWhoseNamesAreJavascriptObjectPropertyNames1.getInstance() + assertFailsWith( + block = { + schema.validate( + mapOf( + Pair( + "constructor", + mapOf( + Pair( + "length", + 37 + ) + ) + ) + ), + configuration + ) + } + ) + } + + @Test + fun testIgnoresArraysPasses() { + // ignores arrays + val schema = PropertiesWhoseNamesAreJavascriptObjectPropertyNames.PropertiesWhoseNamesAreJavascriptObjectPropertyNames1.getInstance() + schema.validate( + listOf( + ), + configuration + ) + } + + @Test + fun testTostringNotValidFails() { + // toString not valid + val schema = PropertiesWhoseNamesAreJavascriptObjectPropertyNames.PropertiesWhoseNamesAreJavascriptObjectPropertyNames1.getInstance() + assertFailsWith( + block = { + schema.validate( + mapOf( + Pair( + "toString", + mapOf( + Pair( + "length", + 37 + ) + ) + ) + ), + configuration + ) + } + ) + } +} diff --git a/samples/client/3_1_0_unit_test/kotlin/src/test/kotlin/org/openapijsonschematools/client/components/schemas/PropertiesWithEscapedCharactersTest.kt b/samples/client/3_1_0_unit_test/kotlin/src/test/kotlin/org/openapijsonschematools/client/components/schemas/PropertiesWithEscapedCharactersTest.kt new file mode 100644 index 00000000000..b65f4a4fbd2 --- /dev/null +++ b/samples/client/3_1_0_unit_test/kotlin/src/test/kotlin/org/openapijsonschematools/client/components/schemas/PropertiesWithEscapedCharactersTest.kt @@ -0,0 +1,88 @@ +package org.openapijsonschematools.client.components.schemas + +import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags +import org.openapijsonschematools.client.configurations.SchemaConfiguration +import org.openapijsonschematools.client.exceptions.ValidationException + +import kotlin.test.Test +import kotlin.test.assertFailsWith + +class PropertiesWithEscapedCharactersTest { + companion object { + val configuration = SchemaConfiguration(JsonSchemaKeywordFlags.Builder().format().build()) + } + + @Test + fun testObjectWithAllNumbersIsValidPasses() { + // object with all numbers is valid + val schema = PropertiesWithEscapedCharacters.PropertiesWithEscapedCharacters1.getInstance() + schema.validate( + mapOf( + Pair( + "foo\nbar", + 1 + ), + Pair( + "foo\"bar", + 1 + ), + Pair( + "foo\\bar", + 1 + ), + Pair( + "foo\rbar", + 1 + ), + Pair( + "foo\tbar", + 1 + ), + Pair( + "foo\u000Cbar", + 1 + ) + ), + configuration + ) + } + + @Test + fun testObjectWithStringsIsInvalidFails() { + // object with strings is invalid + val schema = PropertiesWithEscapedCharacters.PropertiesWithEscapedCharacters1.getInstance() + assertFailsWith( + block = { + schema.validate( + mapOf( + Pair( + "foo\nbar", + "1" + ), + Pair( + "foo\"bar", + "1" + ), + Pair( + "foo\\bar", + "1" + ), + Pair( + "foo\rbar", + "1" + ), + Pair( + "foo\tbar", + "1" + ), + Pair( + "foo\u000Cbar", + "1" + ) + ), + configuration + ) + } + ) + } +} diff --git a/samples/client/3_1_0_unit_test/kotlin/src/test/kotlin/org/openapijsonschematools/client/components/schemas/PropertiesWithNullValuedInstancePropertiesTest.kt b/samples/client/3_1_0_unit_test/kotlin/src/test/kotlin/org/openapijsonschematools/client/components/schemas/PropertiesWithNullValuedInstancePropertiesTest.kt new file mode 100644 index 00000000000..680dbf7f86f --- /dev/null +++ b/samples/client/3_1_0_unit_test/kotlin/src/test/kotlin/org/openapijsonschematools/client/components/schemas/PropertiesWithNullValuedInstancePropertiesTest.kt @@ -0,0 +1,29 @@ +package org.openapijsonschematools.client.components.schemas + +import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags +import org.openapijsonschematools.client.configurations.SchemaConfiguration +import org.openapijsonschematools.client.exceptions.ValidationException + +import kotlin.test.Test +import kotlin.test.assertFailsWith + +class PropertiesWithNullValuedInstancePropertiesTest { + companion object { + val configuration = SchemaConfiguration(JsonSchemaKeywordFlags.Builder().format().build()) + } + + @Test + fun testAllowsNullValuesPasses() { + // allows null values + val schema = PropertiesWithNullValuedInstanceProperties.PropertiesWithNullValuedInstanceProperties1.getInstance() + schema.validate( + mapOf( + Pair( + "foo", + null + ) + ), + configuration + ) + } +} diff --git a/samples/client/3_1_0_unit_test/kotlin/src/test/kotlin/org/openapijsonschematools/client/components/schemas/PropertyNamedRefThatIsNotAReferenceTest.kt b/samples/client/3_1_0_unit_test/kotlin/src/test/kotlin/org/openapijsonschematools/client/components/schemas/PropertyNamedRefThatIsNotAReferenceTest.kt new file mode 100644 index 00000000000..297e5ed5792 --- /dev/null +++ b/samples/client/3_1_0_unit_test/kotlin/src/test/kotlin/org/openapijsonschematools/client/components/schemas/PropertyNamedRefThatIsNotAReferenceTest.kt @@ -0,0 +1,48 @@ +package org.openapijsonschematools.client.components.schemas + +import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags +import org.openapijsonschematools.client.configurations.SchemaConfiguration +import org.openapijsonschematools.client.exceptions.ValidationException + +import kotlin.test.Test +import kotlin.test.assertFailsWith + +class PropertyNamedRefThatIsNotAReferenceTest { + companion object { + val configuration = SchemaConfiguration(JsonSchemaKeywordFlags.Builder().format().build()) + } + + @Test + fun testPropertyNamedRefValidPasses() { + // property named \$ref valid + val schema = PropertyNamedRefThatIsNotAReference.PropertyNamedRefThatIsNotAReference1.getInstance() + schema.validate( + mapOf( + Pair( + "\$ref", + "a" + ) + ), + configuration + ) + } + + @Test + fun testPropertyNamedRefInvalidFails() { + // property named \$ref invalid + val schema = PropertyNamedRefThatIsNotAReference.PropertyNamedRefThatIsNotAReference1.getInstance() + assertFailsWith( + block = { + schema.validate( + mapOf( + Pair( + "\$ref", + 2 + ) + ), + configuration + ) + } + ) + } +} diff --git a/samples/client/3_1_0_unit_test/kotlin/src/test/kotlin/org/openapijsonschematools/client/components/schemas/PropertynamesValidationTest.kt b/samples/client/3_1_0_unit_test/kotlin/src/test/kotlin/org/openapijsonschematools/client/components/schemas/PropertynamesValidationTest.kt new file mode 100644 index 00000000000..3aa3473a19e --- /dev/null +++ b/samples/client/3_1_0_unit_test/kotlin/src/test/kotlin/org/openapijsonschematools/client/components/schemas/PropertynamesValidationTest.kt @@ -0,0 +1,106 @@ +package org.openapijsonschematools.client.components.schemas + +import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags +import org.openapijsonschematools.client.configurations.SchemaConfiguration +import org.openapijsonschematools.client.exceptions.ValidationException + +import kotlin.test.Test +import kotlin.test.assertFailsWith + +class PropertynamesValidationTest { + companion object { + val configuration = SchemaConfiguration(JsonSchemaKeywordFlags.Builder().format().build()) + } + + @Test + fun testSomePropertyNamesInvalidFails() { + // some property names invalid + val schema = PropertynamesValidation.PropertynamesValidation1.getInstance() + assertFailsWith( + block = { + schema.validate( + mapOf( + Pair( + "foo", + mapOf( + ) + ), + Pair( + "foobar", + mapOf( + ) + ) + ), + configuration + ) + } + ) + } + + @Test + fun testIgnoresOtherNonObjectsPasses() { + // ignores other non-objects + val schema = PropertynamesValidation.PropertynamesValidation1.getInstance() + schema.validate( + 12, + configuration + ) + } + + @Test + fun testAllPropertyNamesValidPasses() { + // all property names valid + val schema = PropertynamesValidation.PropertynamesValidation1.getInstance() + schema.validate( + mapOf( + Pair( + "f", + mapOf( + ) + ), + Pair( + "foo", + mapOf( + ) + ) + ), + configuration + ) + } + + @Test + fun testObjectWithoutPropertiesIsValidPasses() { + // object without properties is valid + val schema = PropertynamesValidation.PropertynamesValidation1.getInstance() + schema.validate( + mapOf( + ), + configuration + ) + } + + @Test + fun testIgnoresArraysPasses() { + // ignores arrays + val schema = PropertynamesValidation.PropertynamesValidation1.getInstance() + schema.validate( + listOf( + 1, + 2, + 3, + 4 + ), + configuration + ) + } + + @Test + fun testIgnoresStringsPasses() { + // ignores strings + val schema = PropertynamesValidation.PropertynamesValidation1.getInstance() + schema.validate( + "foobar", + configuration + ) + } +} diff --git a/samples/client/3_1_0_unit_test/kotlin/src/test/kotlin/org/openapijsonschematools/client/components/schemas/RegexFormatTest.kt b/samples/client/3_1_0_unit_test/kotlin/src/test/kotlin/org/openapijsonschematools/client/components/schemas/RegexFormatTest.kt new file mode 100644 index 00000000000..4a9ef49d11f --- /dev/null +++ b/samples/client/3_1_0_unit_test/kotlin/src/test/kotlin/org/openapijsonschematools/client/components/schemas/RegexFormatTest.kt @@ -0,0 +1,86 @@ +package org.openapijsonschematools.client.components.schemas + +import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags +import org.openapijsonschematools.client.configurations.SchemaConfiguration +import org.openapijsonschematools.client.exceptions.ValidationException + +import kotlin.test.Test +import kotlin.test.assertFailsWith + +class RegexFormatTest { + companion object { + val configuration = SchemaConfiguration(JsonSchemaKeywordFlags.Builder().format().build()) + } + + @Test + fun testAllStringFormatsIgnoreIntegersPasses() { + // all string formats ignore integers + val schema = RegexFormat.RegexFormat1.getInstance() + schema.validate( + 12, + configuration + ) + } + + @Test + fun testAllStringFormatsIgnoreNullsPasses() { + // all string formats ignore nulls + val schema = RegexFormat.RegexFormat1.getInstance() + schema.validate( + null, + configuration + ) + } + + @Test + fun testAllStringFormatsIgnoreObjectsPasses() { + // all string formats ignore objects + val schema = RegexFormat.RegexFormat1.getInstance() + schema.validate( + mapOf( + ), + configuration + ) + } + + @Test + fun testInvalidRegexStringIsOnlyAnAnnotationByDefaultPasses() { + // invalid regex string is only an annotation by default + val schema = RegexFormat.RegexFormat1.getInstance() + schema.validate( + "^(abc]", + configuration + ) + } + + @Test + fun testAllStringFormatsIgnoreFloatsPasses() { + // all string formats ignore floats + val schema = RegexFormat.RegexFormat1.getInstance() + schema.validate( + 13.7, + configuration + ) + } + + @Test + fun testAllStringFormatsIgnoreArraysPasses() { + // all string formats ignore arrays + val schema = RegexFormat.RegexFormat1.getInstance() + schema.validate( + listOf( + ), + configuration + ) + } + + @Test + fun testAllStringFormatsIgnoreBooleansPasses() { + // all string formats ignore booleans + val schema = RegexFormat.RegexFormat1.getInstance() + schema.validate( + false, + configuration + ) + } +} diff --git a/samples/client/3_1_0_unit_test/kotlin/src/test/kotlin/org/openapijsonschematools/client/components/schemas/RegexesAreNotAnchoredByDefaultAndAreCaseSensitiveTest.kt b/samples/client/3_1_0_unit_test/kotlin/src/test/kotlin/org/openapijsonschematools/client/components/schemas/RegexesAreNotAnchoredByDefaultAndAreCaseSensitiveTest.kt new file mode 100644 index 00000000000..daaaab30bb7 --- /dev/null +++ b/samples/client/3_1_0_unit_test/kotlin/src/test/kotlin/org/openapijsonschematools/client/components/schemas/RegexesAreNotAnchoredByDefaultAndAreCaseSensitiveTest.kt @@ -0,0 +1,82 @@ +package org.openapijsonschematools.client.components.schemas + +import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags +import org.openapijsonschematools.client.configurations.SchemaConfiguration +import org.openapijsonschematools.client.exceptions.ValidationException + +import kotlin.test.Test +import kotlin.test.assertFailsWith + +class RegexesAreNotAnchoredByDefaultAndAreCaseSensitiveTest { + companion object { + val configuration = SchemaConfiguration(JsonSchemaKeywordFlags.Builder().format().build()) + } + + @Test + fun testRegexesAreCaseSensitivePasses() { + // regexes are case sensitive + val schema = RegexesAreNotAnchoredByDefaultAndAreCaseSensitive.RegexesAreNotAnchoredByDefaultAndAreCaseSensitive1.getInstance() + schema.validate( + mapOf( + Pair( + "a_x_3", + 3 + ) + ), + configuration + ) + } + + @Test + fun testNonRecognizedMembersAreIgnoredPasses() { + // non recognized members are ignored + val schema = RegexesAreNotAnchoredByDefaultAndAreCaseSensitive.RegexesAreNotAnchoredByDefaultAndAreCaseSensitive1.getInstance() + schema.validate( + mapOf( + Pair( + "answer 1", + "42" + ) + ), + configuration + ) + } + + @Test + fun testRecognizedMembersAreAccountedForFails() { + // recognized members are accounted for + val schema = RegexesAreNotAnchoredByDefaultAndAreCaseSensitive.RegexesAreNotAnchoredByDefaultAndAreCaseSensitive1.getInstance() + assertFailsWith( + block = { + schema.validate( + mapOf( + Pair( + "a31b", + null + ) + ), + configuration + ) + } + ) + } + + @Test + fun testRegexesAreCaseSensitive2Fails() { + // regexes are case sensitive, 2 + val schema = RegexesAreNotAnchoredByDefaultAndAreCaseSensitive.RegexesAreNotAnchoredByDefaultAndAreCaseSensitive1.getInstance() + assertFailsWith( + block = { + schema.validate( + mapOf( + Pair( + "a_X_3", + 3 + ) + ), + configuration + ) + } + ) + } +} diff --git a/samples/client/3_1_0_unit_test/kotlin/src/test/kotlin/org/openapijsonschematools/client/components/schemas/RelativeJsonPointerFormatTest.kt b/samples/client/3_1_0_unit_test/kotlin/src/test/kotlin/org/openapijsonschematools/client/components/schemas/RelativeJsonPointerFormatTest.kt new file mode 100644 index 00000000000..a0ce6245290 --- /dev/null +++ b/samples/client/3_1_0_unit_test/kotlin/src/test/kotlin/org/openapijsonschematools/client/components/schemas/RelativeJsonPointerFormatTest.kt @@ -0,0 +1,86 @@ +package org.openapijsonschematools.client.components.schemas + +import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags +import org.openapijsonschematools.client.configurations.SchemaConfiguration +import org.openapijsonschematools.client.exceptions.ValidationException + +import kotlin.test.Test +import kotlin.test.assertFailsWith + +class RelativeJsonPointerFormatTest { + companion object { + val configuration = SchemaConfiguration(JsonSchemaKeywordFlags.Builder().format().build()) + } + + @Test + fun testAllStringFormatsIgnoreIntegersPasses() { + // all string formats ignore integers + val schema = RelativeJsonPointerFormat.RelativeJsonPointerFormat1.getInstance() + schema.validate( + 12, + configuration + ) + } + + @Test + fun testInvalidRelativeJsonPointerStringIsOnlyAnAnnotationByDefaultPasses() { + // invalid relative-json-pointer string is only an annotation by default + val schema = RelativeJsonPointerFormat.RelativeJsonPointerFormat1.getInstance() + schema.validate( + "/foo/bar", + configuration + ) + } + + @Test + fun testAllStringFormatsIgnoreNullsPasses() { + // all string formats ignore nulls + val schema = RelativeJsonPointerFormat.RelativeJsonPointerFormat1.getInstance() + schema.validate( + null, + configuration + ) + } + + @Test + fun testAllStringFormatsIgnoreObjectsPasses() { + // all string formats ignore objects + val schema = RelativeJsonPointerFormat.RelativeJsonPointerFormat1.getInstance() + schema.validate( + mapOf( + ), + configuration + ) + } + + @Test + fun testAllStringFormatsIgnoreFloatsPasses() { + // all string formats ignore floats + val schema = RelativeJsonPointerFormat.RelativeJsonPointerFormat1.getInstance() + schema.validate( + 13.7, + configuration + ) + } + + @Test + fun testAllStringFormatsIgnoreArraysPasses() { + // all string formats ignore arrays + val schema = RelativeJsonPointerFormat.RelativeJsonPointerFormat1.getInstance() + schema.validate( + listOf( + ), + configuration + ) + } + + @Test + fun testAllStringFormatsIgnoreBooleansPasses() { + // all string formats ignore booleans + val schema = RelativeJsonPointerFormat.RelativeJsonPointerFormat1.getInstance() + schema.validate( + false, + configuration + ) + } +} diff --git a/samples/client/3_1_0_unit_test/kotlin/src/test/kotlin/org/openapijsonschematools/client/components/schemas/RequiredDefaultValidationTest.kt b/samples/client/3_1_0_unit_test/kotlin/src/test/kotlin/org/openapijsonschematools/client/components/schemas/RequiredDefaultValidationTest.kt new file mode 100644 index 00000000000..8512a0f489f --- /dev/null +++ b/samples/client/3_1_0_unit_test/kotlin/src/test/kotlin/org/openapijsonschematools/client/components/schemas/RequiredDefaultValidationTest.kt @@ -0,0 +1,25 @@ +package org.openapijsonschematools.client.components.schemas + +import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags +import org.openapijsonschematools.client.configurations.SchemaConfiguration +import org.openapijsonschematools.client.exceptions.ValidationException + +import kotlin.test.Test +import kotlin.test.assertFailsWith + +class RequiredDefaultValidationTest { + companion object { + val configuration = SchemaConfiguration(JsonSchemaKeywordFlags.Builder().format().build()) + } + + @Test + fun testNotRequiredByDefaultPasses() { + // not required by default + val schema = RequiredDefaultValidation.RequiredDefaultValidation1.getInstance() + schema.validate( + mapOf( + ), + configuration + ) + } +} diff --git a/samples/client/3_1_0_unit_test/kotlin/src/test/kotlin/org/openapijsonschematools/client/components/schemas/RequiredPropertiesWhoseNamesAreJavascriptObjectPropertyNamesTest.kt b/samples/client/3_1_0_unit_test/kotlin/src/test/kotlin/org/openapijsonschematools/client/components/schemas/RequiredPropertiesWhoseNamesAreJavascriptObjectPropertyNamesTest.kt new file mode 100644 index 00000000000..ab005b39610 --- /dev/null +++ b/samples/client/3_1_0_unit_test/kotlin/src/test/kotlin/org/openapijsonschematools/client/components/schemas/RequiredPropertiesWhoseNamesAreJavascriptObjectPropertyNamesTest.kt @@ -0,0 +1,145 @@ +package org.openapijsonschematools.client.components.schemas + +import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags +import org.openapijsonschematools.client.configurations.SchemaConfiguration +import org.openapijsonschematools.client.exceptions.ValidationException + +import kotlin.test.Test +import kotlin.test.assertFailsWith + +class RequiredPropertiesWhoseNamesAreJavascriptObjectPropertyNamesTest { + companion object { + val configuration = SchemaConfiguration(JsonSchemaKeywordFlags.Builder().format().build()) + } + + @Test + fun testTostringPresentFails() { + // toString present + val schema = RequiredPropertiesWhoseNamesAreJavascriptObjectPropertyNames.RequiredPropertiesWhoseNamesAreJavascriptObjectPropertyNames1.getInstance() + assertFailsWith( + block = { + schema.validate( + mapOf( + Pair( + "toString", + mapOf( + Pair( + "length", + 37 + ) + ) + ) + ), + configuration + ) + } + ) + } + + @Test + fun testNoneOfThePropertiesMentionedFails() { + // none of the properties mentioned + val schema = RequiredPropertiesWhoseNamesAreJavascriptObjectPropertyNames.RequiredPropertiesWhoseNamesAreJavascriptObjectPropertyNames1.getInstance() + assertFailsWith( + block = { + schema.validate( + mapOf( + ), + configuration + ) + } + ) + } + + @Test + fun testIgnoresOtherNonObjectsPasses() { + // ignores other non-objects + val schema = RequiredPropertiesWhoseNamesAreJavascriptObjectPropertyNames.RequiredPropertiesWhoseNamesAreJavascriptObjectPropertyNames1.getInstance() + schema.validate( + 12, + configuration + ) + } + + @Test + fun testConstructorPresentFails() { + // constructor present + val schema = RequiredPropertiesWhoseNamesAreJavascriptObjectPropertyNames.RequiredPropertiesWhoseNamesAreJavascriptObjectPropertyNames1.getInstance() + assertFailsWith( + block = { + schema.validate( + mapOf( + Pair( + "constructor", + mapOf( + Pair( + "length", + 37 + ) + ) + ) + ), + configuration + ) + } + ) + } + + @Test + fun testAllPresentPasses() { + // all present + val schema = RequiredPropertiesWhoseNamesAreJavascriptObjectPropertyNames.RequiredPropertiesWhoseNamesAreJavascriptObjectPropertyNames1.getInstance() + schema.validate( + mapOf( + Pair( + "__proto__", + 12 + ), + Pair( + "toString", + mapOf( + Pair( + "length", + "foo" + ) + ) + ), + Pair( + "constructor", + 37 + ) + ), + configuration + ) + } + + @Test + fun testProtoPresentFails() { + // __proto__ present + val schema = RequiredPropertiesWhoseNamesAreJavascriptObjectPropertyNames.RequiredPropertiesWhoseNamesAreJavascriptObjectPropertyNames1.getInstance() + assertFailsWith( + block = { + schema.validate( + mapOf( + Pair( + "__proto__", + "foo" + ) + ), + configuration + ) + } + ) + } + + @Test + fun testIgnoresArraysPasses() { + // ignores arrays + val schema = RequiredPropertiesWhoseNamesAreJavascriptObjectPropertyNames.RequiredPropertiesWhoseNamesAreJavascriptObjectPropertyNames1.getInstance() + schema.validate( + listOf( + ), + configuration + ) + } +} diff --git a/samples/client/3_1_0_unit_test/kotlin/src/test/kotlin/org/openapijsonschematools/client/components/schemas/RequiredValidationTest.kt b/samples/client/3_1_0_unit_test/kotlin/src/test/kotlin/org/openapijsonschematools/client/components/schemas/RequiredValidationTest.kt new file mode 100644 index 00000000000..c5815409b38 --- /dev/null +++ b/samples/client/3_1_0_unit_test/kotlin/src/test/kotlin/org/openapijsonschematools/client/components/schemas/RequiredValidationTest.kt @@ -0,0 +1,79 @@ +package org.openapijsonschematools.client.components.schemas + +import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags +import org.openapijsonschematools.client.configurations.SchemaConfiguration +import org.openapijsonschematools.client.exceptions.ValidationException + +import kotlin.test.Test +import kotlin.test.assertFailsWith + +class RequiredValidationTest { + companion object { + val configuration = SchemaConfiguration(JsonSchemaKeywordFlags.Builder().format().build()) + } + + @Test + fun testPresentRequiredPropertyIsValidPasses() { + // present required property is valid + val schema = RequiredValidation.RequiredValidation1.getInstance() + schema.validate( + mapOf( + Pair( + "foo", + 1 + ) + ), + configuration + ) + } + + @Test + fun testIgnoresOtherNonObjectsPasses() { + // ignores other non-objects + val schema = RequiredValidation.RequiredValidation1.getInstance() + schema.validate( + 12, + configuration + ) + } + + @Test + fun testIgnoresArraysPasses() { + // ignores arrays + val schema = RequiredValidation.RequiredValidation1.getInstance() + schema.validate( + listOf( + ), + configuration + ) + } + + @Test + fun testIgnoresStringsPasses() { + // ignores strings + val schema = RequiredValidation.RequiredValidation1.getInstance() + schema.validate( + "", + configuration + ) + } + + @Test + fun testNonPresentRequiredPropertyIsInvalidFails() { + // non-present required property is invalid + val schema = RequiredValidation.RequiredValidation1.getInstance() + assertFailsWith( + block = { + schema.validate( + mapOf( + Pair( + "bar", + 1 + ) + ), + configuration + ) + } + ) + } +} diff --git a/samples/client/3_1_0_unit_test/kotlin/src/test/kotlin/org/openapijsonschematools/client/components/schemas/RequiredWithEmptyArrayTest.kt b/samples/client/3_1_0_unit_test/kotlin/src/test/kotlin/org/openapijsonschematools/client/components/schemas/RequiredWithEmptyArrayTest.kt new file mode 100644 index 00000000000..4f5162d7519 --- /dev/null +++ b/samples/client/3_1_0_unit_test/kotlin/src/test/kotlin/org/openapijsonschematools/client/components/schemas/RequiredWithEmptyArrayTest.kt @@ -0,0 +1,25 @@ +package org.openapijsonschematools.client.components.schemas + +import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags +import org.openapijsonschematools.client.configurations.SchemaConfiguration +import org.openapijsonschematools.client.exceptions.ValidationException + +import kotlin.test.Test +import kotlin.test.assertFailsWith + +class RequiredWithEmptyArrayTest { + companion object { + val configuration = SchemaConfiguration(JsonSchemaKeywordFlags.Builder().format().build()) + } + + @Test + fun testPropertyNotRequiredPasses() { + // property not required + val schema = RequiredWithEmptyArray.RequiredWithEmptyArray1.getInstance() + schema.validate( + mapOf( + ), + configuration + ) + } +} diff --git a/samples/client/3_1_0_unit_test/kotlin/src/test/kotlin/org/openapijsonschematools/client/components/schemas/RequiredWithEscapedCharactersTest.kt b/samples/client/3_1_0_unit_test/kotlin/src/test/kotlin/org/openapijsonschematools/client/components/schemas/RequiredWithEscapedCharactersTest.kt new file mode 100644 index 00000000000..b3b2e3a223f --- /dev/null +++ b/samples/client/3_1_0_unit_test/kotlin/src/test/kotlin/org/openapijsonschematools/client/components/schemas/RequiredWithEscapedCharactersTest.kt @@ -0,0 +1,72 @@ +package org.openapijsonschematools.client.components.schemas + +import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags +import org.openapijsonschematools.client.configurations.SchemaConfiguration +import org.openapijsonschematools.client.exceptions.ValidationException + +import kotlin.test.Test +import kotlin.test.assertFailsWith + +class RequiredWithEscapedCharactersTest { + companion object { + val configuration = SchemaConfiguration(JsonSchemaKeywordFlags.Builder().format().build()) + } + + @Test + fun testObjectWithSomePropertiesMissingIsInvalidFails() { + // object with some properties missing is invalid + val schema = RequiredWithEscapedCharacters.RequiredWithEscapedCharacters1.getInstance() + assertFailsWith( + block = { + schema.validate( + mapOf( + Pair( + "foo\nbar", + "1" + ), + Pair( + "foo\"bar", + "1" + ) + ), + configuration + ) + } + ) + } + + @Test + fun testObjectWithAllPropertiesPresentIsValidPasses() { + // object with all properties present is valid + val schema = RequiredWithEscapedCharacters.RequiredWithEscapedCharacters1.getInstance() + schema.validate( + mapOf( + Pair( + "foo\nbar", + 1 + ), + Pair( + "foo\"bar", + 1 + ), + Pair( + "foo\\bar", + 1 + ), + Pair( + "foo\rbar", + 1 + ), + Pair( + "foo\tbar", + 1 + ), + Pair( + "foo\u000Cbar", + 1 + ) + ), + configuration + ) + } +} diff --git a/samples/client/3_1_0_unit_test/kotlin/src/test/kotlin/org/openapijsonschematools/client/components/schemas/SimpleEnumValidationTest.kt b/samples/client/3_1_0_unit_test/kotlin/src/test/kotlin/org/openapijsonschematools/client/components/schemas/SimpleEnumValidationTest.kt new file mode 100644 index 00000000000..88f0fb9321f --- /dev/null +++ b/samples/client/3_1_0_unit_test/kotlin/src/test/kotlin/org/openapijsonschematools/client/components/schemas/SimpleEnumValidationTest.kt @@ -0,0 +1,38 @@ +package org.openapijsonschematools.client.components.schemas + +import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags +import org.openapijsonschematools.client.configurations.SchemaConfiguration +import org.openapijsonschematools.client.exceptions.ValidationException + +import kotlin.test.Test +import kotlin.test.assertFailsWith + +class SimpleEnumValidationTest { + companion object { + val configuration = SchemaConfiguration(JsonSchemaKeywordFlags.Builder().format().build()) + } + + @Test + fun testSomethingElseIsInvalidFails() { + // something else is invalid + val schema = SimpleEnumValidation.SimpleEnumValidation1.getInstance() + assertFailsWith( + block = { + schema.validate( + 4, + configuration + ) + } + ) + } + + @Test + fun testOneOfTheEnumIsValidPasses() { + // one of the enum is valid + val schema = SimpleEnumValidation.SimpleEnumValidation1.getInstance() + schema.validate( + 1, + configuration + ) + } +} diff --git a/samples/client/3_1_0_unit_test/kotlin/src/test/kotlin/org/openapijsonschematools/client/components/schemas/SingleDependencyTest.kt b/samples/client/3_1_0_unit_test/kotlin/src/test/kotlin/org/openapijsonschematools/client/components/schemas/SingleDependencyTest.kt new file mode 100644 index 00000000000..0d54f1a75ac --- /dev/null +++ b/samples/client/3_1_0_unit_test/kotlin/src/test/kotlin/org/openapijsonschematools/client/components/schemas/SingleDependencyTest.kt @@ -0,0 +1,110 @@ +package org.openapijsonschematools.client.components.schemas + +import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags +import org.openapijsonschematools.client.configurations.SchemaConfiguration +import org.openapijsonschematools.client.exceptions.ValidationException + +import kotlin.test.Test +import kotlin.test.assertFailsWith + +class SingleDependencyTest { + companion object { + val configuration = SchemaConfiguration(JsonSchemaKeywordFlags.Builder().format().build()) + } + + @Test + fun testNondependantPasses() { + // nondependant + val schema = SingleDependency.SingleDependency1.getInstance() + schema.validate( + mapOf( + Pair( + "foo", + 1 + ) + ), + configuration + ) + } + + @Test + fun testWithDependencyPasses() { + // with dependency + val schema = SingleDependency.SingleDependency1.getInstance() + schema.validate( + mapOf( + Pair( + "foo", + 1 + ), + Pair( + "bar", + 2 + ) + ), + configuration + ) + } + + @Test + fun testMissingDependencyFails() { + // missing dependency + val schema = SingleDependency.SingleDependency1.getInstance() + assertFailsWith( + block = { + schema.validate( + mapOf( + Pair( + "bar", + 2 + ) + ), + configuration + ) + } + ) + } + + @Test + fun testIgnoresOtherNonObjectsPasses() { + // ignores other non-objects + val schema = SingleDependency.SingleDependency1.getInstance() + schema.validate( + 12, + configuration + ) + } + + @Test + fun testIgnoresArraysPasses() { + // ignores arrays + val schema = SingleDependency.SingleDependency1.getInstance() + schema.validate( + listOf( + "bar" + ), + configuration + ) + } + + @Test + fun testNeitherPasses() { + // neither + val schema = SingleDependency.SingleDependency1.getInstance() + schema.validate( + mapOf( + ), + configuration + ) + } + + @Test + fun testIgnoresStringsPasses() { + // ignores strings + val schema = SingleDependency.SingleDependency1.getInstance() + schema.validate( + "foobar", + configuration + ) + } +} diff --git a/samples/client/3_1_0_unit_test/kotlin/src/test/kotlin/org/openapijsonschematools/client/components/schemas/SmallMultipleOfLargeIntegerTest.kt b/samples/client/3_1_0_unit_test/kotlin/src/test/kotlin/org/openapijsonschematools/client/components/schemas/SmallMultipleOfLargeIntegerTest.kt new file mode 100644 index 00000000000..296a6dd7e02 --- /dev/null +++ b/samples/client/3_1_0_unit_test/kotlin/src/test/kotlin/org/openapijsonschematools/client/components/schemas/SmallMultipleOfLargeIntegerTest.kt @@ -0,0 +1,24 @@ +package org.openapijsonschematools.client.components.schemas + +import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags +import org.openapijsonschematools.client.configurations.SchemaConfiguration +import org.openapijsonschematools.client.exceptions.ValidationException + +import kotlin.test.Test +import kotlin.test.assertFailsWith + +class SmallMultipleOfLargeIntegerTest { + companion object { + val configuration = SchemaConfiguration(JsonSchemaKeywordFlags.Builder().format().build()) + } + + @Test + fun testAnyIntegerIsAMultipleOf1E8Passes() { + // any integer is a multiple of 1e-8 + val schema = SmallMultipleOfLargeInteger.SmallMultipleOfLargeInteger1.getInstance() + schema.validate( + 12391239123L, + configuration + ) + } +} diff --git a/samples/client/3_1_0_unit_test/kotlin/src/test/kotlin/org/openapijsonschematools/client/components/schemas/StringTypeMatchesStringsTest.kt b/samples/client/3_1_0_unit_test/kotlin/src/test/kotlin/org/openapijsonschematools/client/components/schemas/StringTypeMatchesStringsTest.kt new file mode 100644 index 00000000000..4c9aafdb869 --- /dev/null +++ b/samples/client/3_1_0_unit_test/kotlin/src/test/kotlin/org/openapijsonschematools/client/components/schemas/StringTypeMatchesStringsTest.kt @@ -0,0 +1,130 @@ +package org.openapijsonschematools.client.components.schemas + +import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags +import org.openapijsonschematools.client.configurations.SchemaConfiguration +import org.openapijsonschematools.client.exceptions.ValidationException + +import kotlin.test.Test +import kotlin.test.assertFailsWith + +class StringTypeMatchesStringsTest { + companion object { + val configuration = SchemaConfiguration(JsonSchemaKeywordFlags.Builder().format().build()) + } + + @Test + fun testAStringIsStillAStringEvenIfItLooksLikeANumberPasses() { + // a string is still a string, even if it looks like a number + val schema = StringTypeMatchesStrings.StringTypeMatchesStrings1.getInstance() + schema.validate( + "1", + configuration + ) + } + + @Test + fun test1IsNotAStringFails() { + // 1 is not a string + val schema = StringTypeMatchesStrings.StringTypeMatchesStrings1.getInstance() + assertFailsWith( + block = { + schema.validate( + 1, + configuration + ) + } + ) + } + + @Test + fun testABooleanIsNotAStringFails() { + // a boolean is not a string + val schema = StringTypeMatchesStrings.StringTypeMatchesStrings1.getInstance() + assertFailsWith( + block = { + schema.validate( + true, + configuration + ) + } + ) + } + + @Test + fun testAnEmptyStringIsStillAStringPasses() { + // an empty string is still a string + val schema = StringTypeMatchesStrings.StringTypeMatchesStrings1.getInstance() + schema.validate( + "", + configuration + ) + } + + @Test + fun testAnArrayIsNotAStringFails() { + // an array is not a string + val schema = StringTypeMatchesStrings.StringTypeMatchesStrings1.getInstance() + assertFailsWith( + block = { + schema.validate( + listOf( + ), + configuration + ) + } + ) + } + + @Test + fun testAnObjectIsNotAStringFails() { + // an object is not a string + val schema = StringTypeMatchesStrings.StringTypeMatchesStrings1.getInstance() + assertFailsWith( + block = { + schema.validate( + mapOf( + ), + configuration + ) + } + ) + } + + @Test + fun testNullIsNotAStringFails() { + // null is not a string + val schema = StringTypeMatchesStrings.StringTypeMatchesStrings1.getInstance() + assertFailsWith( + block = { + schema.validate( + null, + configuration + ) + } + ) + } + + @Test + fun testAStringIsAStringPasses() { + // a string is a string + val schema = StringTypeMatchesStrings.StringTypeMatchesStrings1.getInstance() + schema.validate( + "foo", + configuration + ) + } + + @Test + fun testAFloatIsNotAStringFails() { + // a float is not a string + val schema = StringTypeMatchesStrings.StringTypeMatchesStrings1.getInstance() + assertFailsWith( + block = { + schema.validate( + 1.1, + configuration + ) + } + ) + } +} diff --git a/samples/client/3_1_0_unit_test/kotlin/src/test/kotlin/org/openapijsonschematools/client/components/schemas/TimeFormatTest.kt b/samples/client/3_1_0_unit_test/kotlin/src/test/kotlin/org/openapijsonschematools/client/components/schemas/TimeFormatTest.kt new file mode 100644 index 00000000000..4cb811700a1 --- /dev/null +++ b/samples/client/3_1_0_unit_test/kotlin/src/test/kotlin/org/openapijsonschematools/client/components/schemas/TimeFormatTest.kt @@ -0,0 +1,86 @@ +package org.openapijsonschematools.client.components.schemas + +import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags +import org.openapijsonschematools.client.configurations.SchemaConfiguration +import org.openapijsonschematools.client.exceptions.ValidationException + +import kotlin.test.Test +import kotlin.test.assertFailsWith + +class TimeFormatTest { + companion object { + val configuration = SchemaConfiguration(JsonSchemaKeywordFlags.Builder().format().build()) + } + + @Test + fun testAllStringFormatsIgnoreIntegersPasses() { + // all string formats ignore integers + val schema = TimeFormat.TimeFormat1.getInstance() + schema.validate( + 12, + configuration + ) + } + + @Test + fun testAllStringFormatsIgnoreNullsPasses() { + // all string formats ignore nulls + val schema = TimeFormat.TimeFormat1.getInstance() + schema.validate( + null, + configuration + ) + } + + @Test + fun testAllStringFormatsIgnoreObjectsPasses() { + // all string formats ignore objects + val schema = TimeFormat.TimeFormat1.getInstance() + schema.validate( + mapOf( + ), + configuration + ) + } + + @Test + fun testAllStringFormatsIgnoreFloatsPasses() { + // all string formats ignore floats + val schema = TimeFormat.TimeFormat1.getInstance() + schema.validate( + 13.7, + configuration + ) + } + + @Test + fun testInvalidTimeStringIsOnlyAnAnnotationByDefaultPasses() { + // invalid time string is only an annotation by default + val schema = TimeFormat.TimeFormat1.getInstance() + schema.validate( + "08:30:06 PST", + configuration + ) + } + + @Test + fun testAllStringFormatsIgnoreArraysPasses() { + // all string formats ignore arrays + val schema = TimeFormat.TimeFormat1.getInstance() + schema.validate( + listOf( + ), + configuration + ) + } + + @Test + fun testAllStringFormatsIgnoreBooleansPasses() { + // all string formats ignore booleans + val schema = TimeFormat.TimeFormat1.getInstance() + schema.validate( + false, + configuration + ) + } +} diff --git a/samples/client/3_1_0_unit_test/kotlin/src/test/kotlin/org/openapijsonschematools/client/components/schemas/TypeArrayObjectOrNullTest.kt b/samples/client/3_1_0_unit_test/kotlin/src/test/kotlin/org/openapijsonschematools/client/components/schemas/TypeArrayObjectOrNullTest.kt new file mode 100644 index 00000000000..700f58e1ed2 --- /dev/null +++ b/samples/client/3_1_0_unit_test/kotlin/src/test/kotlin/org/openapijsonschematools/client/components/schemas/TypeArrayObjectOrNullTest.kt @@ -0,0 +1,81 @@ +package org.openapijsonschematools.client.components.schemas + +import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags +import org.openapijsonschematools.client.configurations.SchemaConfiguration +import org.openapijsonschematools.client.exceptions.ValidationException + +import kotlin.test.Test +import kotlin.test.assertFailsWith + +class TypeArrayObjectOrNullTest { + companion object { + val configuration = SchemaConfiguration(JsonSchemaKeywordFlags.Builder().format().build()) + } + + @Test + fun testNumberIsInvalidFails() { + // number is invalid + val schema = TypeArrayObjectOrNull.TypeArrayObjectOrNull1.getInstance() + assertFailsWith( + block = { + schema.validate( + 123, + configuration + ) + } + ) + } + + @Test + fun testNullIsValidPasses() { + // null is valid + val schema = TypeArrayObjectOrNull.TypeArrayObjectOrNull1.getInstance() + schema.validate( + null, + configuration + ) + } + + @Test + fun testStringIsInvalidFails() { + // string is invalid + val schema = TypeArrayObjectOrNull.TypeArrayObjectOrNull1.getInstance() + assertFailsWith( + block = { + schema.validate( + "foo", + configuration + ) + } + ) + } + + @Test + fun testArrayIsValidPasses() { + // array is valid + val schema = TypeArrayObjectOrNull.TypeArrayObjectOrNull1.getInstance() + schema.validate( + listOf( + 1, + 2, + 3 + ), + configuration + ) + } + + @Test + fun testObjectIsValidPasses() { + // object is valid + val schema = TypeArrayObjectOrNull.TypeArrayObjectOrNull1.getInstance() + schema.validate( + mapOf( + Pair( + "foo", + 123 + ) + ), + configuration + ) + } +} diff --git a/samples/client/3_1_0_unit_test/kotlin/src/test/kotlin/org/openapijsonschematools/client/components/schemas/TypeArrayOrObjectTest.kt b/samples/client/3_1_0_unit_test/kotlin/src/test/kotlin/org/openapijsonschematools/client/components/schemas/TypeArrayOrObjectTest.kt new file mode 100644 index 00000000000..2e7a42c916f --- /dev/null +++ b/samples/client/3_1_0_unit_test/kotlin/src/test/kotlin/org/openapijsonschematools/client/components/schemas/TypeArrayOrObjectTest.kt @@ -0,0 +1,85 @@ +package org.openapijsonschematools.client.components.schemas + +import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags +import org.openapijsonschematools.client.configurations.SchemaConfiguration +import org.openapijsonschematools.client.exceptions.ValidationException + +import kotlin.test.Test +import kotlin.test.assertFailsWith + +class TypeArrayOrObjectTest { + companion object { + val configuration = SchemaConfiguration(JsonSchemaKeywordFlags.Builder().format().build()) + } + + @Test + fun testNumberIsInvalidFails() { + // number is invalid + val schema = TypeArrayOrObject.TypeArrayOrObject1.getInstance() + assertFailsWith( + block = { + schema.validate( + 123, + configuration + ) + } + ) + } + + @Test + fun testStringIsInvalidFails() { + // string is invalid + val schema = TypeArrayOrObject.TypeArrayOrObject1.getInstance() + assertFailsWith( + block = { + schema.validate( + "foo", + configuration + ) + } + ) + } + + @Test + fun testNullIsInvalidFails() { + // null is invalid + val schema = TypeArrayOrObject.TypeArrayOrObject1.getInstance() + assertFailsWith( + block = { + schema.validate( + null, + configuration + ) + } + ) + } + + @Test + fun testArrayIsValidPasses() { + // array is valid + val schema = TypeArrayOrObject.TypeArrayOrObject1.getInstance() + schema.validate( + listOf( + 1, + 2, + 3 + ), + configuration + ) + } + + @Test + fun testObjectIsValidPasses() { + // object is valid + val schema = TypeArrayOrObject.TypeArrayOrObject1.getInstance() + schema.validate( + mapOf( + Pair( + "foo", + 123 + ) + ), + configuration + ) + } +} diff --git a/samples/client/3_1_0_unit_test/kotlin/src/test/kotlin/org/openapijsonschematools/client/components/schemas/TypeAsArrayWithOneItemTest.kt b/samples/client/3_1_0_unit_test/kotlin/src/test/kotlin/org/openapijsonschematools/client/components/schemas/TypeAsArrayWithOneItemTest.kt new file mode 100644 index 00000000000..2e78c880ba4 --- /dev/null +++ b/samples/client/3_1_0_unit_test/kotlin/src/test/kotlin/org/openapijsonschematools/client/components/schemas/TypeAsArrayWithOneItemTest.kt @@ -0,0 +1,38 @@ +package org.openapijsonschematools.client.components.schemas + +import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags +import org.openapijsonschematools.client.configurations.SchemaConfiguration +import org.openapijsonschematools.client.exceptions.ValidationException + +import kotlin.test.Test +import kotlin.test.assertFailsWith + +class TypeAsArrayWithOneItemTest { + companion object { + val configuration = SchemaConfiguration(JsonSchemaKeywordFlags.Builder().format().build()) + } + + @Test + fun testNumberIsInvalidFails() { + // number is invalid + val schema = TypeAsArrayWithOneItem.TypeAsArrayWithOneItem1.getInstance() + assertFailsWith( + block = { + schema.validate( + 123, + configuration + ) + } + ) + } + + @Test + fun testStringIsValidPasses() { + // string is valid + val schema = TypeAsArrayWithOneItem.TypeAsArrayWithOneItem1.getInstance() + schema.validate( + "foo", + configuration + ) + } +} diff --git a/samples/client/3_1_0_unit_test/kotlin/src/test/kotlin/org/openapijsonschematools/client/components/schemas/UnevaluateditemsAsSchemaTest.kt b/samples/client/3_1_0_unit_test/kotlin/src/test/kotlin/org/openapijsonschematools/client/components/schemas/UnevaluateditemsAsSchemaTest.kt new file mode 100644 index 00000000000..4e6b0e1ea97 --- /dev/null +++ b/samples/client/3_1_0_unit_test/kotlin/src/test/kotlin/org/openapijsonschematools/client/components/schemas/UnevaluateditemsAsSchemaTest.kt @@ -0,0 +1,53 @@ +package org.openapijsonschematools.client.components.schemas + +import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags +import org.openapijsonschematools.client.configurations.SchemaConfiguration +import org.openapijsonschematools.client.exceptions.ValidationException + +import kotlin.test.Test +import kotlin.test.assertFailsWith + +class UnevaluateditemsAsSchemaTest { + companion object { + val configuration = SchemaConfiguration(JsonSchemaKeywordFlags.Builder().format().build()) + } + + @Test + fun testWithValidUnevaluatedItemsPasses() { + // with valid unevaluated items + val schema = UnevaluateditemsAsSchema.UnevaluateditemsAsSchema1.getInstance() + schema.validate( + listOf( + "foo" + ), + configuration + ) + } + + @Test + fun testWithInvalidUnevaluatedItemsFails() { + // with invalid unevaluated items + val schema = UnevaluateditemsAsSchema.UnevaluateditemsAsSchema1.getInstance() + assertFailsWith( + block = { + schema.validate( + listOf( + 42 + ), + configuration + ) + } + ) + } + + @Test + fun testWithNoUnevaluatedItemsPasses() { + // with no unevaluated items + val schema = UnevaluateditemsAsSchema.UnevaluateditemsAsSchema1.getInstance() + schema.validate( + listOf( + ), + configuration + ) + } +} diff --git a/samples/client/3_1_0_unit_test/kotlin/src/test/kotlin/org/openapijsonschematools/client/components/schemas/UnevaluateditemsDependsOnMultipleNestedContainsTest.kt b/samples/client/3_1_0_unit_test/kotlin/src/test/kotlin/org/openapijsonschematools/client/components/schemas/UnevaluateditemsDependsOnMultipleNestedContainsTest.kt new file mode 100644 index 00000000000..db6b9f6a625 --- /dev/null +++ b/samples/client/3_1_0_unit_test/kotlin/src/test/kotlin/org/openapijsonschematools/client/components/schemas/UnevaluateditemsDependsOnMultipleNestedContainsTest.kt @@ -0,0 +1,50 @@ +package org.openapijsonschematools.client.components.schemas + +import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags +import org.openapijsonschematools.client.configurations.SchemaConfiguration +import org.openapijsonschematools.client.exceptions.ValidationException + +import kotlin.test.Test +import kotlin.test.assertFailsWith + +class UnevaluateditemsDependsOnMultipleNestedContainsTest { + companion object { + val configuration = SchemaConfiguration(JsonSchemaKeywordFlags.Builder().format().build()) + } + + @Test + fun test7NotEvaluatedFailsUnevaluateditemsFails() { + // 7 not evaluated, fails unevaluatedItems + val schema = UnevaluateditemsDependsOnMultipleNestedContains.UnevaluateditemsDependsOnMultipleNestedContains1.getInstance() + assertFailsWith( + block = { + schema.validate( + listOf( + 2, + 3, + 4, + 7, + 8 + ), + configuration + ) + } + ) + } + + @Test + fun test5NotEvaluatedPassesUnevaluateditemsPasses() { + // 5 not evaluated, passes unevaluatedItems + val schema = UnevaluateditemsDependsOnMultipleNestedContains.UnevaluateditemsDependsOnMultipleNestedContains1.getInstance() + schema.validate( + listOf( + 2, + 3, + 4, + 5, + 6 + ), + configuration + ) + } +} diff --git a/samples/client/3_1_0_unit_test/kotlin/src/test/kotlin/org/openapijsonschematools/client/components/schemas/UnevaluateditemsWithItemsTest.kt b/samples/client/3_1_0_unit_test/kotlin/src/test/kotlin/org/openapijsonschematools/client/components/schemas/UnevaluateditemsWithItemsTest.kt new file mode 100644 index 00000000000..c622a8fc46c --- /dev/null +++ b/samples/client/3_1_0_unit_test/kotlin/src/test/kotlin/org/openapijsonschematools/client/components/schemas/UnevaluateditemsWithItemsTest.kt @@ -0,0 +1,51 @@ +package org.openapijsonschematools.client.components.schemas + +import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags +import org.openapijsonschematools.client.configurations.SchemaConfiguration +import org.openapijsonschematools.client.exceptions.ValidationException + +import kotlin.test.Test +import kotlin.test.assertFailsWith + +class UnevaluateditemsWithItemsTest { + companion object { + val configuration = SchemaConfiguration(JsonSchemaKeywordFlags.Builder().format().build()) + } + + @Test + fun testInvalidUnderItemsFails() { + // invalid under items + val schema = UnevaluateditemsWithItems.UnevaluateditemsWithItems1.getInstance() + assertFailsWith( + block = { + schema.validate( + listOf( + "foo", + "bar", + "baz" + ), + configuration + ) + } + ) + } + + @Test + fun testValidUnderItemsPasses() { + // valid under items + val schema = UnevaluateditemsWithItems.UnevaluateditemsWithItems1.getInstance() + schema.validate( + UnevaluateditemsWithItems.UnevaluateditemsWithItemsListBuilder() + .add(5) + + .add(6) + + .add(7) + + .add(8) + + .build(), + configuration + ) + } +} diff --git a/samples/client/3_1_0_unit_test/kotlin/src/test/kotlin/org/openapijsonschematools/client/components/schemas/UnevaluateditemsWithNullInstanceElementsTest.kt b/samples/client/3_1_0_unit_test/kotlin/src/test/kotlin/org/openapijsonschematools/client/components/schemas/UnevaluateditemsWithNullInstanceElementsTest.kt new file mode 100644 index 00000000000..4f5bffa7c26 --- /dev/null +++ b/samples/client/3_1_0_unit_test/kotlin/src/test/kotlin/org/openapijsonschematools/client/components/schemas/UnevaluateditemsWithNullInstanceElementsTest.kt @@ -0,0 +1,26 @@ +package org.openapijsonschematools.client.components.schemas + +import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags +import org.openapijsonschematools.client.configurations.SchemaConfiguration +import org.openapijsonschematools.client.exceptions.ValidationException + +import kotlin.test.Test +import kotlin.test.assertFailsWith + +class UnevaluateditemsWithNullInstanceElementsTest { + companion object { + val configuration = SchemaConfiguration(JsonSchemaKeywordFlags.Builder().format().build()) + } + + @Test + fun testAllowsNullElementsPasses() { + // allows null elements + val schema = UnevaluateditemsWithNullInstanceElements.UnevaluateditemsWithNullInstanceElements1.getInstance() + schema.validate( + listOf( + null + ), + configuration + ) + } +} diff --git a/samples/client/3_1_0_unit_test/kotlin/src/test/kotlin/org/openapijsonschematools/client/components/schemas/UnevaluatedpropertiesNotAffectedByPropertynamesTest.kt b/samples/client/3_1_0_unit_test/kotlin/src/test/kotlin/org/openapijsonschematools/client/components/schemas/UnevaluatedpropertiesNotAffectedByPropertynamesTest.kt new file mode 100644 index 00000000000..d77152f1830 --- /dev/null +++ b/samples/client/3_1_0_unit_test/kotlin/src/test/kotlin/org/openapijsonschematools/client/components/schemas/UnevaluatedpropertiesNotAffectedByPropertynamesTest.kt @@ -0,0 +1,48 @@ +package org.openapijsonschematools.client.components.schemas + +import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags +import org.openapijsonschematools.client.configurations.SchemaConfiguration +import org.openapijsonschematools.client.exceptions.ValidationException + +import kotlin.test.Test +import kotlin.test.assertFailsWith + +class UnevaluatedpropertiesNotAffectedByPropertynamesTest { + companion object { + val configuration = SchemaConfiguration(JsonSchemaKeywordFlags.Builder().format().build()) + } + + @Test + fun testAllowsOnlyNumberPropertiesPasses() { + // allows only number properties + val schema = UnevaluatedpropertiesNotAffectedByPropertynames.UnevaluatedpropertiesNotAffectedByPropertynames1.getInstance() + schema.validate( + mapOf( + Pair( + "a", + 1 + ) + ), + configuration + ) + } + + @Test + fun testStringPropertyIsInvalidFails() { + // string property is invalid + val schema = UnevaluatedpropertiesNotAffectedByPropertynames.UnevaluatedpropertiesNotAffectedByPropertynames1.getInstance() + assertFailsWith( + block = { + schema.validate( + mapOf( + Pair( + "a", + "b" + ) + ), + configuration + ) + } + ) + } +} diff --git a/samples/client/3_1_0_unit_test/kotlin/src/test/kotlin/org/openapijsonschematools/client/components/schemas/UnevaluatedpropertiesSchemaTest.kt b/samples/client/3_1_0_unit_test/kotlin/src/test/kotlin/org/openapijsonschematools/client/components/schemas/UnevaluatedpropertiesSchemaTest.kt new file mode 100644 index 00000000000..6e931c25f7c --- /dev/null +++ b/samples/client/3_1_0_unit_test/kotlin/src/test/kotlin/org/openapijsonschematools/client/components/schemas/UnevaluatedpropertiesSchemaTest.kt @@ -0,0 +1,59 @@ +package org.openapijsonschematools.client.components.schemas + +import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags +import org.openapijsonschematools.client.configurations.SchemaConfiguration +import org.openapijsonschematools.client.exceptions.ValidationException + +import kotlin.test.Test +import kotlin.test.assertFailsWith + +class UnevaluatedpropertiesSchemaTest { + companion object { + val configuration = SchemaConfiguration(JsonSchemaKeywordFlags.Builder().format().build()) + } + + @Test + fun testWithInvalidUnevaluatedPropertiesFails() { + // with invalid unevaluated properties + val schema = UnevaluatedpropertiesSchema.UnevaluatedpropertiesSchema1.getInstance() + assertFailsWith( + block = { + schema.validate( + mapOf( + Pair( + "foo", + "fo" + ) + ), + configuration + ) + } + ) + } + + @Test + fun testWithNoUnevaluatedPropertiesPasses() { + // with no unevaluated properties + val schema = UnevaluatedpropertiesSchema.UnevaluatedpropertiesSchema1.getInstance() + schema.validate( + mapOf( + ), + configuration + ) + } + + @Test + fun testWithValidUnevaluatedPropertiesPasses() { + // with valid unevaluated properties + val schema = UnevaluatedpropertiesSchema.UnevaluatedpropertiesSchema1.getInstance() + schema.validate( + mapOf( + Pair( + "foo", + "foo" + ) + ), + configuration + ) + } +} diff --git a/samples/client/3_1_0_unit_test/kotlin/src/test/kotlin/org/openapijsonschematools/client/components/schemas/UnevaluatedpropertiesWithAdjacentAdditionalpropertiesTest.kt b/samples/client/3_1_0_unit_test/kotlin/src/test/kotlin/org/openapijsonschematools/client/components/schemas/UnevaluatedpropertiesWithAdjacentAdditionalpropertiesTest.kt new file mode 100644 index 00000000000..41de9832e10 --- /dev/null +++ b/samples/client/3_1_0_unit_test/kotlin/src/test/kotlin/org/openapijsonschematools/client/components/schemas/UnevaluatedpropertiesWithAdjacentAdditionalpropertiesTest.kt @@ -0,0 +1,48 @@ +package org.openapijsonschematools.client.components.schemas + +import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags +import org.openapijsonschematools.client.configurations.SchemaConfiguration +import org.openapijsonschematools.client.exceptions.ValidationException + +import kotlin.test.Test +import kotlin.test.assertFailsWith + +class UnevaluatedpropertiesWithAdjacentAdditionalpropertiesTest { + companion object { + val configuration = SchemaConfiguration(JsonSchemaKeywordFlags.Builder().format().build()) + } + + @Test + fun testWithAdditionalPropertiesPasses() { + // with additional properties + val schema = UnevaluatedpropertiesWithAdjacentAdditionalproperties.UnevaluatedpropertiesWithAdjacentAdditionalproperties1.getInstance() + schema.validate( + mapOf( + Pair( + "foo", + "foo" + ), + Pair( + "bar", + "bar" + ) + ), + configuration + ) + } + + @Test + fun testWithNoAdditionalPropertiesPasses() { + // with no additional properties + val schema = UnevaluatedpropertiesWithAdjacentAdditionalproperties.UnevaluatedpropertiesWithAdjacentAdditionalproperties1.getInstance() + schema.validate( + mapOf( + Pair( + "foo", + "foo" + ) + ), + configuration + ) + } +} diff --git a/samples/client/3_1_0_unit_test/kotlin/src/test/kotlin/org/openapijsonschematools/client/components/schemas/UnevaluatedpropertiesWithNullValuedInstancePropertiesTest.kt b/samples/client/3_1_0_unit_test/kotlin/src/test/kotlin/org/openapijsonschematools/client/components/schemas/UnevaluatedpropertiesWithNullValuedInstancePropertiesTest.kt new file mode 100644 index 00000000000..03747042a81 --- /dev/null +++ b/samples/client/3_1_0_unit_test/kotlin/src/test/kotlin/org/openapijsonschematools/client/components/schemas/UnevaluatedpropertiesWithNullValuedInstancePropertiesTest.kt @@ -0,0 +1,29 @@ +package org.openapijsonschematools.client.components.schemas + +import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags +import org.openapijsonschematools.client.configurations.SchemaConfiguration +import org.openapijsonschematools.client.exceptions.ValidationException + +import kotlin.test.Test +import kotlin.test.assertFailsWith + +class UnevaluatedpropertiesWithNullValuedInstancePropertiesTest { + companion object { + val configuration = SchemaConfiguration(JsonSchemaKeywordFlags.Builder().format().build()) + } + + @Test + fun testAllowsNullValuedPropertiesPasses() { + // allows null valued properties + val schema = UnevaluatedpropertiesWithNullValuedInstanceProperties.UnevaluatedpropertiesWithNullValuedInstanceProperties1.getInstance() + schema.validate( + mapOf( + Pair( + "foo", + null + ) + ), + configuration + ) + } +} diff --git a/samples/client/3_1_0_unit_test/kotlin/src/test/kotlin/org/openapijsonschematools/client/components/schemas/UniqueitemsFalseValidationTest.kt b/samples/client/3_1_0_unit_test/kotlin/src/test/kotlin/org/openapijsonschematools/client/components/schemas/UniqueitemsFalseValidationTest.kt new file mode 100644 index 00000000000..4c5cff32904 --- /dev/null +++ b/samples/client/3_1_0_unit_test/kotlin/src/test/kotlin/org/openapijsonschematools/client/components/schemas/UniqueitemsFalseValidationTest.kt @@ -0,0 +1,312 @@ +package org.openapijsonschematools.client.components.schemas + +import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags +import org.openapijsonschematools.client.configurations.SchemaConfiguration +import org.openapijsonschematools.client.exceptions.ValidationException + +import kotlin.test.Test +import kotlin.test.assertFailsWith + +class UniqueitemsFalseValidationTest { + companion object { + val configuration = SchemaConfiguration(JsonSchemaKeywordFlags.Builder().format().build()) + } + + @Test + fun testNumbersAreUniqueIfMathematicallyUnequalPasses() { + // numbers are unique if mathematically unequal + val schema = UniqueitemsFalseValidation.UniqueitemsFalseValidation1.getInstance() + schema.validate( + listOf( + 1.0, + 1.0, + 1 + ), + configuration + ) + } + + @Test + fun testNonUniqueArrayOfIntegersIsValidPasses() { + // non-unique array of integers is valid + val schema = UniqueitemsFalseValidation.UniqueitemsFalseValidation1.getInstance() + schema.validate( + listOf( + 1, + 1 + ), + configuration + ) + } + + @Test + fun testNonUniqueArrayOfObjectsIsValidPasses() { + // non-unique array of objects is valid + val schema = UniqueitemsFalseValidation.UniqueitemsFalseValidation1.getInstance() + schema.validate( + listOf( + mapOf( + Pair( + "foo", + "bar" + ) + ), + mapOf( + Pair( + "foo", + "bar" + ) + ) + ), + configuration + ) + } + + @Test + fun testNonUniqueArrayOfArraysIsValidPasses() { + // non-unique array of arrays is valid + val schema = UniqueitemsFalseValidation.UniqueitemsFalseValidation1.getInstance() + schema.validate( + listOf( + listOf( + "foo" + ), + listOf( + "foo" + ) + ), + configuration + ) + } + + @Test + fun test1AndTrueAreUniquePasses() { + // 1 and true are unique + val schema = UniqueitemsFalseValidation.UniqueitemsFalseValidation1.getInstance() + schema.validate( + listOf( + 1, + true + ), + configuration + ) + } + + @Test + fun testUniqueArrayOfNestedObjectsIsValidPasses() { + // unique array of nested objects is valid + val schema = UniqueitemsFalseValidation.UniqueitemsFalseValidation1.getInstance() + schema.validate( + listOf( + mapOf( + Pair( + "foo", + mapOf( + Pair( + "bar", + mapOf( + Pair( + "baz", + true + ) + ) + ) + ) + ) + ), + mapOf( + Pair( + "foo", + mapOf( + Pair( + "bar", + mapOf( + Pair( + "baz", + false + ) + ) + ) + ) + ) + ) + ), + configuration + ) + } + + @Test + fun testUniqueArrayOfArraysIsValidPasses() { + // unique array of arrays is valid + val schema = UniqueitemsFalseValidation.UniqueitemsFalseValidation1.getInstance() + schema.validate( + listOf( + listOf( + "foo" + ), + listOf( + "bar" + ) + ), + configuration + ) + } + + @Test + fun testTrueIsNotEqualToOnePasses() { + // true is not equal to one + val schema = UniqueitemsFalseValidation.UniqueitemsFalseValidation1.getInstance() + schema.validate( + listOf( + 1, + true + ), + configuration + ) + } + + @Test + fun testNonUniqueHeterogeneousTypesAreValidPasses() { + // non-unique heterogeneous types are valid + val schema = UniqueitemsFalseValidation.UniqueitemsFalseValidation1.getInstance() + schema.validate( + listOf( + mapOf( + ), + listOf( + 1 + ), + true, + null, + mapOf( + ), + 1 + ), + configuration + ) + } + + @Test + fun testFalseIsNotEqualToZeroPasses() { + // false is not equal to zero + val schema = UniqueitemsFalseValidation.UniqueitemsFalseValidation1.getInstance() + schema.validate( + listOf( + 0, + false + ), + configuration + ) + } + + @Test + fun testUniqueArrayOfIntegersIsValidPasses() { + // unique array of integers is valid + val schema = UniqueitemsFalseValidation.UniqueitemsFalseValidation1.getInstance() + schema.validate( + listOf( + 1, + 2 + ), + configuration + ) + } + + @Test + fun test0AndFalseAreUniquePasses() { + // 0 and false are unique + val schema = UniqueitemsFalseValidation.UniqueitemsFalseValidation1.getInstance() + schema.validate( + listOf( + 0, + false + ), + configuration + ) + } + + @Test + fun testUniqueHeterogeneousTypesAreValidPasses() { + // unique heterogeneous types are valid + val schema = UniqueitemsFalseValidation.UniqueitemsFalseValidation1.getInstance() + schema.validate( + listOf( + mapOf( + ), + listOf( + 1 + ), + true, + null, + 1 + ), + configuration + ) + } + + @Test + fun testUniqueArrayOfObjectsIsValidPasses() { + // unique array of objects is valid + val schema = UniqueitemsFalseValidation.UniqueitemsFalseValidation1.getInstance() + schema.validate( + listOf( + mapOf( + Pair( + "foo", + "bar" + ) + ), + mapOf( + Pair( + "foo", + "baz" + ) + ) + ), + configuration + ) + } + + @Test + fun testNonUniqueArrayOfNestedObjectsIsValidPasses() { + // non-unique array of nested objects is valid + val schema = UniqueitemsFalseValidation.UniqueitemsFalseValidation1.getInstance() + schema.validate( + listOf( + mapOf( + Pair( + "foo", + mapOf( + Pair( + "bar", + mapOf( + Pair( + "baz", + true + ) + ) + ) + ) + ) + ), + mapOf( + Pair( + "foo", + mapOf( + Pair( + "bar", + mapOf( + Pair( + "baz", + true + ) + ) + ) + ) + ) + ) + ), + configuration + ) + } +} diff --git a/samples/client/3_1_0_unit_test/kotlin/src/test/kotlin/org/openapijsonschematools/client/components/schemas/UniqueitemsFalseWithAnArrayOfItemsTest.kt b/samples/client/3_1_0_unit_test/kotlin/src/test/kotlin/org/openapijsonschematools/client/components/schemas/UniqueitemsFalseWithAnArrayOfItemsTest.kt new file mode 100644 index 00000000000..8028a0182f1 --- /dev/null +++ b/samples/client/3_1_0_unit_test/kotlin/src/test/kotlin/org/openapijsonschematools/client/components/schemas/UniqueitemsFalseWithAnArrayOfItemsTest.kt @@ -0,0 +1,150 @@ +package org.openapijsonschematools.client.components.schemas + +import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags +import org.openapijsonschematools.client.configurations.SchemaConfiguration +import org.openapijsonschematools.client.exceptions.ValidationException + +import kotlin.test.Test +import kotlin.test.assertFailsWith + +class UniqueitemsFalseWithAnArrayOfItemsTest { + companion object { + val configuration = SchemaConfiguration(JsonSchemaKeywordFlags.Builder().format().build()) + } + + @Test + fun testFalseFalseFromItemsArrayIsValidPasses() { + // [false, false] from items array is valid + val schema = UniqueitemsFalseWithAnArrayOfItems.UniqueitemsFalseWithAnArrayOfItems1.getInstance() + schema.validate( + UniqueitemsFalseWithAnArrayOfItems.UniqueitemsFalseWithAnArrayOfItemsListBuilder() + .add(false) + + .add(false) + + .build(), + configuration + ) + } + + @Test + fun testNonUniqueArrayExtendedFromFalseTrueIsValidPasses() { + // non-unique array extended from [false, true] is valid + val schema = UniqueitemsFalseWithAnArrayOfItems.UniqueitemsFalseWithAnArrayOfItems1.getInstance() + schema.validate( + UniqueitemsFalseWithAnArrayOfItems.UniqueitemsFalseWithAnArrayOfItemsListBuilder() + .add(false) + + .add(true) + + .add("foo") + + .add("foo") + + .build(), + configuration + ) + } + + @Test + fun testTrueTrueFromItemsArrayIsValidPasses() { + // [true, true] from items array is valid + val schema = UniqueitemsFalseWithAnArrayOfItems.UniqueitemsFalseWithAnArrayOfItems1.getInstance() + schema.validate( + UniqueitemsFalseWithAnArrayOfItems.UniqueitemsFalseWithAnArrayOfItemsListBuilder() + .add(true) + + .add(true) + + .build(), + configuration + ) + } + + @Test + fun testUniqueArrayExtendedFromFalseTrueIsValidPasses() { + // unique array extended from [false, true] is valid + val schema = UniqueitemsFalseWithAnArrayOfItems.UniqueitemsFalseWithAnArrayOfItems1.getInstance() + schema.validate( + UniqueitemsFalseWithAnArrayOfItems.UniqueitemsFalseWithAnArrayOfItemsListBuilder() + .add(false) + + .add(true) + + .add("foo") + + .add("bar") + + .build(), + configuration + ) + } + + @Test + fun testUniqueArrayExtendedFromTrueFalseIsValidPasses() { + // unique array extended from [true, false] is valid + val schema = UniqueitemsFalseWithAnArrayOfItems.UniqueitemsFalseWithAnArrayOfItems1.getInstance() + schema.validate( + UniqueitemsFalseWithAnArrayOfItems.UniqueitemsFalseWithAnArrayOfItemsListBuilder() + .add(true) + + .add(false) + + .add("foo") + + .add("bar") + + .build(), + configuration + ) + } + + @Test + fun testFalseTrueFromItemsArrayIsValidPasses() { + // [false, true] from items array is valid + val schema = UniqueitemsFalseWithAnArrayOfItems.UniqueitemsFalseWithAnArrayOfItems1.getInstance() + schema.validate( + UniqueitemsFalseWithAnArrayOfItems.UniqueitemsFalseWithAnArrayOfItemsListBuilder() + .add(false) + + .add(true) + + .build(), + configuration + ) + } + + @Test + fun testTrueFalseFromItemsArrayIsValidPasses() { + // [true, false] from items array is valid + val schema = UniqueitemsFalseWithAnArrayOfItems.UniqueitemsFalseWithAnArrayOfItems1.getInstance() + schema.validate( + UniqueitemsFalseWithAnArrayOfItems.UniqueitemsFalseWithAnArrayOfItemsListBuilder() + .add(true) + + .add(false) + + .build(), + configuration + ) + } + + @Test + fun testNonUniqueArrayExtendedFromTrueFalseIsValidPasses() { + // non-unique array extended from [true, false] is valid + val schema = UniqueitemsFalseWithAnArrayOfItems.UniqueitemsFalseWithAnArrayOfItems1.getInstance() + schema.validate( + UniqueitemsFalseWithAnArrayOfItems.UniqueitemsFalseWithAnArrayOfItemsListBuilder() + .add(true) + + .add(false) + + .add("foo") + + .add("foo") + + .build(), + configuration + ) + } +} diff --git a/samples/client/3_1_0_unit_test/kotlin/src/test/kotlin/org/openapijsonschematools/client/components/schemas/UniqueitemsValidationTest.kt b/samples/client/3_1_0_unit_test/kotlin/src/test/kotlin/org/openapijsonschematools/client/components/schemas/UniqueitemsValidationTest.kt new file mode 100644 index 00000000000..9a77d6a58a3 --- /dev/null +++ b/samples/client/3_1_0_unit_test/kotlin/src/test/kotlin/org/openapijsonschematools/client/components/schemas/UniqueitemsValidationTest.kt @@ -0,0 +1,612 @@ +package org.openapijsonschematools.client.components.schemas + +import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags +import org.openapijsonschematools.client.configurations.SchemaConfiguration +import org.openapijsonschematools.client.exceptions.ValidationException + +import kotlin.test.Test +import kotlin.test.assertFailsWith + +class UniqueitemsValidationTest { + companion object { + val configuration = SchemaConfiguration(JsonSchemaKeywordFlags.Builder().format().build()) + } + + @Test + fun testNonUniqueArrayOfMoreThanTwoIntegersIsInvalidFails() { + // non-unique array of more than two integers is invalid + val schema = UniqueitemsValidation.UniqueitemsValidation1.getInstance() + assertFailsWith( + block = { + schema.validate( + listOf( + 1, + 2, + 1 + ), + configuration + ) + } + ) + } + + @Test + fun testNonUniqueArrayOfObjectsIsInvalidFails() { + // non-unique array of objects is invalid + val schema = UniqueitemsValidation.UniqueitemsValidation1.getInstance() + assertFailsWith( + block = { + schema.validate( + listOf( + mapOf( + Pair( + "foo", + "bar" + ) + ), + mapOf( + Pair( + "foo", + "bar" + ) + ) + ), + configuration + ) + } + ) + } + + @Test + fun testPropertyOrderOfArrayOfObjectsIsIgnoredFails() { + // property order of array of objects is ignored + val schema = UniqueitemsValidation.UniqueitemsValidation1.getInstance() + assertFailsWith( + block = { + schema.validate( + listOf( + mapOf( + Pair( + "foo", + "bar" + ), + Pair( + "bar", + "foo" + ) + ), + mapOf( + Pair( + "bar", + "foo" + ), + Pair( + "foo", + "bar" + ) + ) + ), + configuration + ) + } + ) + } + + @Test + fun testATrueAndA1AreUniquePasses() { + // {\\\"a\\\": true} and {\\\"a\\\": 1} are unique + val schema = UniqueitemsValidation.UniqueitemsValidation1.getInstance() + schema.validate( + listOf( + mapOf( + Pair( + "a", + true + ) + ), + mapOf( + Pair( + "a", + 1 + ) + ) + ), + configuration + ) + } + + @Test + fun test1AndTrueAreUniquePasses() { + // [1] and [true] are unique + val schema = UniqueitemsValidation.UniqueitemsValidation1.getInstance() + schema.validate( + listOf( + listOf( + 1 + ), + listOf( + true + ) + ), + configuration + ) + } + + @Test + fun testNonUniqueArrayOfIntegersIsInvalidFails() { + // non-unique array of integers is invalid + val schema = UniqueitemsValidation.UniqueitemsValidation1.getInstance() + assertFailsWith( + block = { + schema.validate( + listOf( + 1, + 1 + ), + configuration + ) + } + ) + } + + @Test + fun testNested0AndFalseAreUniquePasses() { + // nested [0] and [false] are unique + val schema = UniqueitemsValidation.UniqueitemsValidation1.getInstance() + schema.validate( + listOf( + listOf( + listOf( + 0 + ), + "foo" + ), + listOf( + listOf( + false + ), + "foo" + ) + ), + configuration + ) + } + + @Test + fun testObjectsAreNonUniqueDespiteKeyOrderFails() { + // objects are non-unique despite key order + val schema = UniqueitemsValidation.UniqueitemsValidation1.getInstance() + assertFailsWith( + block = { + schema.validate( + listOf( + mapOf( + Pair( + "a", + 1 + ), + Pair( + "b", + 2 + ) + ), + mapOf( + Pair( + "b", + 2 + ), + Pair( + "a", + 1 + ) + ) + ), + configuration + ) + } + ) + } + + @Test + fun testNonUniqueArrayOfArraysIsInvalidFails() { + // non-unique array of arrays is invalid + val schema = UniqueitemsValidation.UniqueitemsValidation1.getInstance() + assertFailsWith( + block = { + schema.validate( + listOf( + listOf( + "foo" + ), + listOf( + "foo" + ) + ), + configuration + ) + } + ) + } + + @Test + fun testAFalseAndA0AreUniquePasses() { + // {\\\"a\\\": false} and {\\\"a\\\": 0} are unique + val schema = UniqueitemsValidation.UniqueitemsValidation1.getInstance() + schema.validate( + listOf( + mapOf( + Pair( + "a", + false + ) + ), + mapOf( + Pair( + "a", + 0 + ) + ) + ), + configuration + ) + } + + @Test + fun testNonUniqueArrayOfMoreThanTwoArraysIsInvalidFails() { + // non-unique array of more than two arrays is invalid + val schema = UniqueitemsValidation.UniqueitemsValidation1.getInstance() + assertFailsWith( + block = { + schema.validate( + listOf( + listOf( + "foo" + ), + listOf( + "bar" + ), + listOf( + "foo" + ) + ), + configuration + ) + } + ) + } + + @Test + fun test0AndFalseAreUniquePasses() { + // [0] and [false] are unique + val schema = UniqueitemsValidation.UniqueitemsValidation1.getInstance() + schema.validate( + listOf( + listOf( + 0 + ), + listOf( + false + ) + ), + configuration + ) + } + + @Test + fun testNonUniqueArrayOfNestedObjectsIsInvalidFails() { + // non-unique array of nested objects is invalid + val schema = UniqueitemsValidation.UniqueitemsValidation1.getInstance() + assertFailsWith( + block = { + schema.validate( + listOf( + mapOf( + Pair( + "foo", + mapOf( + Pair( + "bar", + mapOf( + Pair( + "baz", + true + ) + ) + ) + ) + ) + ), + mapOf( + Pair( + "foo", + mapOf( + Pair( + "bar", + mapOf( + Pair( + "baz", + true + ) + ) + ) + ) + ) + ) + ), + configuration + ) + } + ) + } + + @Test + fun testNumbersAreUniqueIfMathematicallyUnequalFails() { + // numbers are unique if mathematically unequal + val schema = UniqueitemsValidation.UniqueitemsValidation1.getInstance() + assertFailsWith( + block = { + schema.validate( + listOf( + 1.0, + 1.0, + 1 + ), + configuration + ) + } + ) + } + + @Test + fun testNonUniqueArrayOfStringsIsInvalidFails() { + // non-unique array of strings is invalid + val schema = UniqueitemsValidation.UniqueitemsValidation1.getInstance() + assertFailsWith( + block = { + schema.validate( + listOf( + "foo", + "bar", + "foo" + ), + configuration + ) + } + ) + } + + @Test + fun testUniqueArrayOfNestedObjectsIsValidPasses() { + // unique array of nested objects is valid + val schema = UniqueitemsValidation.UniqueitemsValidation1.getInstance() + schema.validate( + listOf( + mapOf( + Pair( + "foo", + mapOf( + Pair( + "bar", + mapOf( + Pair( + "baz", + true + ) + ) + ) + ) + ) + ), + mapOf( + Pair( + "foo", + mapOf( + Pair( + "bar", + mapOf( + Pair( + "baz", + false + ) + ) + ) + ) + ) + ) + ), + configuration + ) + } + + @Test + fun testUniqueArrayOfArraysIsValidPasses() { + // unique array of arrays is valid + val schema = UniqueitemsValidation.UniqueitemsValidation1.getInstance() + schema.validate( + listOf( + listOf( + "foo" + ), + listOf( + "bar" + ) + ), + configuration + ) + } + + @Test + fun testTrueIsNotEqualToOnePasses() { + // true is not equal to one + val schema = UniqueitemsValidation.UniqueitemsValidation1.getInstance() + schema.validate( + listOf( + 1, + true + ), + configuration + ) + } + + @Test + fun testNested1AndTrueAreUniquePasses() { + // nested [1] and [true] are unique + val schema = UniqueitemsValidation.UniqueitemsValidation1.getInstance() + schema.validate( + listOf( + listOf( + listOf( + 1 + ), + "foo" + ), + listOf( + listOf( + true + ), + "foo" + ) + ), + configuration + ) + } + + @Test + fun testUniqueArrayOfStringsIsValidPasses() { + // unique array of strings is valid + val schema = UniqueitemsValidation.UniqueitemsValidation1.getInstance() + schema.validate( + listOf( + "foo", + "bar", + "baz" + ), + configuration + ) + } + + @Test + fun testFalseIsNotEqualToZeroPasses() { + // false is not equal to zero + val schema = UniqueitemsValidation.UniqueitemsValidation1.getInstance() + schema.validate( + listOf( + 0, + false + ), + configuration + ) + } + + @Test + fun testUniqueArrayOfIntegersIsValidPasses() { + // unique array of integers is valid + val schema = UniqueitemsValidation.UniqueitemsValidation1.getInstance() + schema.validate( + listOf( + 1, + 2 + ), + configuration + ) + } + + @Test + fun testDifferentObjectsAreUniquePasses() { + // different objects are unique + val schema = UniqueitemsValidation.UniqueitemsValidation1.getInstance() + schema.validate( + listOf( + mapOf( + Pair( + "a", + 1 + ), + Pair( + "b", + 2 + ) + ), + mapOf( + Pair( + "a", + 2 + ), + Pair( + "b", + 1 + ) + ) + ), + configuration + ) + } + + @Test + fun testUniqueHeterogeneousTypesAreValidPasses() { + // unique heterogeneous types are valid + val schema = UniqueitemsValidation.UniqueitemsValidation1.getInstance() + schema.validate( + listOf( + mapOf( + ), + listOf( + 1 + ), + true, + null, + 1, + "{}" + ), + configuration + ) + } + + @Test + fun testUniqueArrayOfObjectsIsValidPasses() { + // unique array of objects is valid + val schema = UniqueitemsValidation.UniqueitemsValidation1.getInstance() + schema.validate( + listOf( + mapOf( + Pair( + "foo", + "bar" + ) + ), + mapOf( + Pair( + "foo", + "baz" + ) + ) + ), + configuration + ) + } + + @Test + fun testNonUniqueHeterogeneousTypesAreInvalidFails() { + // non-unique heterogeneous types are invalid + val schema = UniqueitemsValidation.UniqueitemsValidation1.getInstance() + assertFailsWith( + block = { + schema.validate( + listOf( + mapOf( + ), + listOf( + 1 + ), + true, + null, + mapOf( + ), + 1 + ), + configuration + ) + } + ) + } +} diff --git a/samples/client/3_1_0_unit_test/kotlin/src/test/kotlin/org/openapijsonschematools/client/components/schemas/UniqueitemsWithAnArrayOfItemsTest.kt b/samples/client/3_1_0_unit_test/kotlin/src/test/kotlin/org/openapijsonschematools/client/components/schemas/UniqueitemsWithAnArrayOfItemsTest.kt new file mode 100644 index 00000000000..0dbd1f5a1af --- /dev/null +++ b/samples/client/3_1_0_unit_test/kotlin/src/test/kotlin/org/openapijsonschematools/client/components/schemas/UniqueitemsWithAnArrayOfItemsTest.kt @@ -0,0 +1,154 @@ +package org.openapijsonschematools.client.components.schemas + +import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags +import org.openapijsonschematools.client.configurations.SchemaConfiguration +import org.openapijsonschematools.client.exceptions.ValidationException + +import kotlin.test.Test +import kotlin.test.assertFailsWith + +class UniqueitemsWithAnArrayOfItemsTest { + companion object { + val configuration = SchemaConfiguration(JsonSchemaKeywordFlags.Builder().format().build()) + } + + @Test + fun testTrueTrueFromItemsArrayIsNotValidFails() { + // [true, true] from items array is not valid + val schema = UniqueitemsWithAnArrayOfItems.UniqueitemsWithAnArrayOfItems1.getInstance() + assertFailsWith( + block = { + schema.validate( + listOf( + true, + true + ), + configuration + ) + } + ) + } + + @Test + fun testUniqueArrayExtendedFromFalseTrueIsValidPasses() { + // unique array extended from [false, true] is valid + val schema = UniqueitemsWithAnArrayOfItems.UniqueitemsWithAnArrayOfItems1.getInstance() + schema.validate( + UniqueitemsWithAnArrayOfItems.UniqueitemsWithAnArrayOfItemsListBuilder() + .add(false) + + .add(true) + + .add("foo") + + .add("bar") + + .build(), + configuration + ) + } + + @Test + fun testFalseFalseFromItemsArrayIsNotValidFails() { + // [false, false] from items array is not valid + val schema = UniqueitemsWithAnArrayOfItems.UniqueitemsWithAnArrayOfItems1.getInstance() + assertFailsWith( + block = { + schema.validate( + listOf( + false, + false + ), + configuration + ) + } + ) + } + + @Test + fun testUniqueArrayExtendedFromTrueFalseIsValidPasses() { + // unique array extended from [true, false] is valid + val schema = UniqueitemsWithAnArrayOfItems.UniqueitemsWithAnArrayOfItems1.getInstance() + schema.validate( + UniqueitemsWithAnArrayOfItems.UniqueitemsWithAnArrayOfItemsListBuilder() + .add(true) + + .add(false) + + .add("foo") + + .add("bar") + + .build(), + configuration + ) + } + + @Test + fun testNonUniqueArrayExtendedFromFalseTrueIsNotValidFails() { + // non-unique array extended from [false, true] is not valid + val schema = UniqueitemsWithAnArrayOfItems.UniqueitemsWithAnArrayOfItems1.getInstance() + assertFailsWith( + block = { + schema.validate( + listOf( + false, + true, + "foo", + "foo" + ), + configuration + ) + } + ) + } + + @Test + fun testNonUniqueArrayExtendedFromTrueFalseIsNotValidFails() { + // non-unique array extended from [true, false] is not valid + val schema = UniqueitemsWithAnArrayOfItems.UniqueitemsWithAnArrayOfItems1.getInstance() + assertFailsWith( + block = { + schema.validate( + listOf( + true, + false, + "foo", + "foo" + ), + configuration + ) + } + ) + } + + @Test + fun testFalseTrueFromItemsArrayIsValidPasses() { + // [false, true] from items array is valid + val schema = UniqueitemsWithAnArrayOfItems.UniqueitemsWithAnArrayOfItems1.getInstance() + schema.validate( + UniqueitemsWithAnArrayOfItems.UniqueitemsWithAnArrayOfItemsListBuilder() + .add(false) + + .add(true) + + .build(), + configuration + ) + } + + @Test + fun testTrueFalseFromItemsArrayIsValidPasses() { + // [true, false] from items array is valid + val schema = UniqueitemsWithAnArrayOfItems.UniqueitemsWithAnArrayOfItems1.getInstance() + schema.validate( + UniqueitemsWithAnArrayOfItems.UniqueitemsWithAnArrayOfItemsListBuilder() + .add(true) + + .add(false) + + .build(), + configuration + ) + } +} diff --git a/samples/client/3_1_0_unit_test/kotlin/src/test/kotlin/org/openapijsonschematools/client/components/schemas/UriFormatTest.kt b/samples/client/3_1_0_unit_test/kotlin/src/test/kotlin/org/openapijsonschematools/client/components/schemas/UriFormatTest.kt new file mode 100644 index 00000000000..f4b0ed4f75a --- /dev/null +++ b/samples/client/3_1_0_unit_test/kotlin/src/test/kotlin/org/openapijsonschematools/client/components/schemas/UriFormatTest.kt @@ -0,0 +1,86 @@ +package org.openapijsonschematools.client.components.schemas + +import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags +import org.openapijsonschematools.client.configurations.SchemaConfiguration +import org.openapijsonschematools.client.exceptions.ValidationException + +import kotlin.test.Test +import kotlin.test.assertFailsWith + +class UriFormatTest { + companion object { + val configuration = SchemaConfiguration(JsonSchemaKeywordFlags.Builder().format().build()) + } + + @Test + fun testAllStringFormatsIgnoreIntegersPasses() { + // all string formats ignore integers + val schema = UriFormat.UriFormat1.getInstance() + schema.validate( + 12, + configuration + ) + } + + @Test + fun testAllStringFormatsIgnoreNullsPasses() { + // all string formats ignore nulls + val schema = UriFormat.UriFormat1.getInstance() + schema.validate( + null, + configuration + ) + } + + @Test + fun testAllStringFormatsIgnoreObjectsPasses() { + // all string formats ignore objects + val schema = UriFormat.UriFormat1.getInstance() + schema.validate( + mapOf( + ), + configuration + ) + } + + @Test + fun testAllStringFormatsIgnoreFloatsPasses() { + // all string formats ignore floats + val schema = UriFormat.UriFormat1.getInstance() + schema.validate( + 13.7, + configuration + ) + } + + @Test + fun testInvalidUriStringIsOnlyAnAnnotationByDefaultPasses() { + // invalid uri string is only an annotation by default + val schema = UriFormat.UriFormat1.getInstance() + schema.validate( + "//foo.bar/?baz=qux#quux", + configuration + ) + } + + @Test + fun testAllStringFormatsIgnoreArraysPasses() { + // all string formats ignore arrays + val schema = UriFormat.UriFormat1.getInstance() + schema.validate( + listOf( + ), + configuration + ) + } + + @Test + fun testAllStringFormatsIgnoreBooleansPasses() { + // all string formats ignore booleans + val schema = UriFormat.UriFormat1.getInstance() + schema.validate( + false, + configuration + ) + } +} diff --git a/samples/client/3_1_0_unit_test/kotlin/src/test/kotlin/org/openapijsonschematools/client/components/schemas/UriReferenceFormatTest.kt b/samples/client/3_1_0_unit_test/kotlin/src/test/kotlin/org/openapijsonschematools/client/components/schemas/UriReferenceFormatTest.kt new file mode 100644 index 00000000000..43d397d4188 --- /dev/null +++ b/samples/client/3_1_0_unit_test/kotlin/src/test/kotlin/org/openapijsonschematools/client/components/schemas/UriReferenceFormatTest.kt @@ -0,0 +1,86 @@ +package org.openapijsonschematools.client.components.schemas + +import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags +import org.openapijsonschematools.client.configurations.SchemaConfiguration +import org.openapijsonschematools.client.exceptions.ValidationException + +import kotlin.test.Test +import kotlin.test.assertFailsWith + +class UriReferenceFormatTest { + companion object { + val configuration = SchemaConfiguration(JsonSchemaKeywordFlags.Builder().format().build()) + } + + @Test + fun testAllStringFormatsIgnoreIntegersPasses() { + // all string formats ignore integers + val schema = UriReferenceFormat.UriReferenceFormat1.getInstance() + schema.validate( + 12, + configuration + ) + } + + @Test + fun testAllStringFormatsIgnoreNullsPasses() { + // all string formats ignore nulls + val schema = UriReferenceFormat.UriReferenceFormat1.getInstance() + schema.validate( + null, + configuration + ) + } + + @Test + fun testAllStringFormatsIgnoreObjectsPasses() { + // all string formats ignore objects + val schema = UriReferenceFormat.UriReferenceFormat1.getInstance() + schema.validate( + mapOf( + ), + configuration + ) + } + + @Test + fun testAllStringFormatsIgnoreFloatsPasses() { + // all string formats ignore floats + val schema = UriReferenceFormat.UriReferenceFormat1.getInstance() + schema.validate( + 13.7, + configuration + ) + } + + @Test + fun testInvalidUriReferenceStringIsOnlyAnAnnotationByDefaultPasses() { + // invalid uri-reference string is only an annotation by default + val schema = UriReferenceFormat.UriReferenceFormat1.getInstance() + schema.validate( + "\\\\WINDOWS\\fileshare", + configuration + ) + } + + @Test + fun testAllStringFormatsIgnoreArraysPasses() { + // all string formats ignore arrays + val schema = UriReferenceFormat.UriReferenceFormat1.getInstance() + schema.validate( + listOf( + ), + configuration + ) + } + + @Test + fun testAllStringFormatsIgnoreBooleansPasses() { + // all string formats ignore booleans + val schema = UriReferenceFormat.UriReferenceFormat1.getInstance() + schema.validate( + false, + configuration + ) + } +} diff --git a/samples/client/3_1_0_unit_test/kotlin/src/test/kotlin/org/openapijsonschematools/client/components/schemas/UriTemplateFormatTest.kt b/samples/client/3_1_0_unit_test/kotlin/src/test/kotlin/org/openapijsonschematools/client/components/schemas/UriTemplateFormatTest.kt new file mode 100644 index 00000000000..84b4cadc428 --- /dev/null +++ b/samples/client/3_1_0_unit_test/kotlin/src/test/kotlin/org/openapijsonschematools/client/components/schemas/UriTemplateFormatTest.kt @@ -0,0 +1,86 @@ +package org.openapijsonschematools.client.components.schemas + +import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags +import org.openapijsonschematools.client.configurations.SchemaConfiguration +import org.openapijsonschematools.client.exceptions.ValidationException + +import kotlin.test.Test +import kotlin.test.assertFailsWith + +class UriTemplateFormatTest { + companion object { + val configuration = SchemaConfiguration(JsonSchemaKeywordFlags.Builder().format().build()) + } + + @Test + fun testAllStringFormatsIgnoreIntegersPasses() { + // all string formats ignore integers + val schema = UriTemplateFormat.UriTemplateFormat1.getInstance() + schema.validate( + 12, + configuration + ) + } + + @Test + fun testAllStringFormatsIgnoreNullsPasses() { + // all string formats ignore nulls + val schema = UriTemplateFormat.UriTemplateFormat1.getInstance() + schema.validate( + null, + configuration + ) + } + + @Test + fun testAllStringFormatsIgnoreObjectsPasses() { + // all string formats ignore objects + val schema = UriTemplateFormat.UriTemplateFormat1.getInstance() + schema.validate( + mapOf( + ), + configuration + ) + } + + @Test + fun testAllStringFormatsIgnoreFloatsPasses() { + // all string formats ignore floats + val schema = UriTemplateFormat.UriTemplateFormat1.getInstance() + schema.validate( + 13.7, + configuration + ) + } + + @Test + fun testAllStringFormatsIgnoreArraysPasses() { + // all string formats ignore arrays + val schema = UriTemplateFormat.UriTemplateFormat1.getInstance() + schema.validate( + listOf( + ), + configuration + ) + } + + @Test + fun testAllStringFormatsIgnoreBooleansPasses() { + // all string formats ignore booleans + val schema = UriTemplateFormat.UriTemplateFormat1.getInstance() + schema.validate( + false, + configuration + ) + } + + @Test + fun testInvalidUriTemplateStringIsOnlyAnAnnotationByDefaultPasses() { + // invalid uri-template string is only an annotation by default + val schema = UriTemplateFormat.UriTemplateFormat1.getInstance() + schema.validate( + "http://example.com/dictionary/{term:1}/{term", + configuration + ) + } +} diff --git a/samples/client/3_1_0_unit_test/kotlin/src/test/kotlin/org/openapijsonschematools/client/components/schemas/UuidFormatTest.kt b/samples/client/3_1_0_unit_test/kotlin/src/test/kotlin/org/openapijsonschematools/client/components/schemas/UuidFormatTest.kt new file mode 100644 index 00000000000..1d75aad55d4 --- /dev/null +++ b/samples/client/3_1_0_unit_test/kotlin/src/test/kotlin/org/openapijsonschematools/client/components/schemas/UuidFormatTest.kt @@ -0,0 +1,86 @@ +package org.openapijsonschematools.client.components.schemas + +import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags +import org.openapijsonschematools.client.configurations.SchemaConfiguration +import org.openapijsonschematools.client.exceptions.ValidationException + +import kotlin.test.Test +import kotlin.test.assertFailsWith + +class UuidFormatTest { + companion object { + val configuration = SchemaConfiguration(JsonSchemaKeywordFlags.Builder().format().build()) + } + + @Test + fun testAllStringFormatsIgnoreIntegersPasses() { + // all string formats ignore integers + val schema = UuidFormat.UuidFormat1.getInstance() + schema.validate( + 12, + configuration + ) + } + + @Test + fun testAllStringFormatsIgnoreNullsPasses() { + // all string formats ignore nulls + val schema = UuidFormat.UuidFormat1.getInstance() + schema.validate( + null, + configuration + ) + } + + @Test + fun testAllStringFormatsIgnoreObjectsPasses() { + // all string formats ignore objects + val schema = UuidFormat.UuidFormat1.getInstance() + schema.validate( + mapOf( + ), + configuration + ) + } + + @Test + fun testAllStringFormatsIgnoreFloatsPasses() { + // all string formats ignore floats + val schema = UuidFormat.UuidFormat1.getInstance() + schema.validate( + 13.7, + configuration + ) + } + + @Test + fun testAllStringFormatsIgnoreArraysPasses() { + // all string formats ignore arrays + val schema = UuidFormat.UuidFormat1.getInstance() + schema.validate( + listOf( + ), + configuration + ) + } + + @Test + fun testInvalidUuidStringIsOnlyAnAnnotationByDefaultPasses() { + // invalid uuid string is only an annotation by default + val schema = UuidFormat.UuidFormat1.getInstance() + schema.validate( + "2eb8aa08-aa98-11ea-b4aa-73b441d1638", + configuration + ) + } + + @Test + fun testAllStringFormatsIgnoreBooleansPasses() { + // all string formats ignore booleans + val schema = UuidFormat.UuidFormat1.getInstance() + schema.validate( + false, + configuration + ) + } +} diff --git a/samples/client/3_1_0_unit_test/kotlin/src/test/kotlin/org/openapijsonschematools/client/components/schemas/ValidateAgainstCorrectBranchThenVsElseTest.kt b/samples/client/3_1_0_unit_test/kotlin/src/test/kotlin/org/openapijsonschematools/client/components/schemas/ValidateAgainstCorrectBranchThenVsElseTest.kt new file mode 100644 index 00000000000..19105537ccd --- /dev/null +++ b/samples/client/3_1_0_unit_test/kotlin/src/test/kotlin/org/openapijsonschematools/client/components/schemas/ValidateAgainstCorrectBranchThenVsElseTest.kt @@ -0,0 +1,62 @@ +package org.openapijsonschematools.client.components.schemas + +import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags +import org.openapijsonschematools.client.configurations.SchemaConfiguration +import org.openapijsonschematools.client.exceptions.ValidationException + +import kotlin.test.Test +import kotlin.test.assertFailsWith + +class ValidateAgainstCorrectBranchThenVsElseTest { + companion object { + val configuration = SchemaConfiguration(JsonSchemaKeywordFlags.Builder().format().build()) + } + + @Test + fun testValidThroughThenPasses() { + // valid through then + val schema = ValidateAgainstCorrectBranchThenVsElse.ValidateAgainstCorrectBranchThenVsElse1.getInstance() + schema.validate( + -1, + configuration + ) + } + + @Test + fun testInvalidThroughThenFails() { + // invalid through then + val schema = ValidateAgainstCorrectBranchThenVsElse.ValidateAgainstCorrectBranchThenVsElse1.getInstance() + assertFailsWith( + block = { + schema.validate( + -100, + configuration + ) + } + ) + } + + @Test + fun testValidThroughElsePasses() { + // valid through else + val schema = ValidateAgainstCorrectBranchThenVsElse.ValidateAgainstCorrectBranchThenVsElse1.getInstance() + schema.validate( + 4, + configuration + ) + } + + @Test + fun testInvalidThroughElseFails() { + // invalid through else + val schema = ValidateAgainstCorrectBranchThenVsElse.ValidateAgainstCorrectBranchThenVsElse1.getInstance() + assertFailsWith( + block = { + schema.validate( + 3, + configuration + ) + } + ) + } +} diff --git a/samples/client/3_1_0_unit_test/kotlin/src/test/kotlin/org/openapijsonschematools/client/configurations/JsonSchemaKeywordFlagsTest.kt b/samples/client/3_1_0_unit_test/kotlin/src/test/kotlin/org/openapijsonschematools/client/configurations/JsonSchemaKeywordFlagsTest.kt new file mode 100644 index 00000000000..cab27673567 --- /dev/null +++ b/samples/client/3_1_0_unit_test/kotlin/src/test/kotlin/org/openapijsonschematools/client/configurations/JsonSchemaKeywordFlagsTest.kt @@ -0,0 +1,141 @@ +package org.openapijsonschematools.client.configurations; + +import kotlin.test.Test +import kotlin.test.assertEquals + +class JsonSchemaKeywordFlagsTest { + @Test + fun testGetEnabledKeywords() { + val jsonSchemaKeywordFlags = JsonSchemaKeywordFlags( + true, + true, + true, + true, + true, + true, + true, + true, + true, + true, + true, + true, + true, + true, + true, + true, + true, + true, + true, + true, + true, + true, + true, + true, + true, + true, + true, + true, + true, + true, + true, + true, + true, + true, + true, + true, + true, + true, + true + ) + val enabledKeywords = jsonSchemaKeywordFlags.keywords + val expectedEnabledKeywords = LinkedHashSet() + expectedEnabledKeywords.add("additionalProperties") + expectedEnabledKeywords.add("allOf") + expectedEnabledKeywords.add("anyOf") + expectedEnabledKeywords.add("const") + expectedEnabledKeywords.add("contains") + expectedEnabledKeywords.add("dependentRequired") + expectedEnabledKeywords.add("dependentSchemas") + expectedEnabledKeywords.add("discriminator") + expectedEnabledKeywords.add("else_") + expectedEnabledKeywords.add("enum_") + expectedEnabledKeywords.add("exclusiveMaximum") + expectedEnabledKeywords.add("exclusiveMinimum") + expectedEnabledKeywords.add("format") + expectedEnabledKeywords.add("if_") + expectedEnabledKeywords.add("maximum") + expectedEnabledKeywords.add("minimum") + expectedEnabledKeywords.add("items") + expectedEnabledKeywords.add("maxContains") + expectedEnabledKeywords.add("maxItems") + expectedEnabledKeywords.add("maxLength") + expectedEnabledKeywords.add("maxProperties") + expectedEnabledKeywords.add("minContains") + expectedEnabledKeywords.add("minItems") + expectedEnabledKeywords.add("minLength") + expectedEnabledKeywords.add("minProperties") + expectedEnabledKeywords.add("multipleOf") + expectedEnabledKeywords.add("not") + expectedEnabledKeywords.add("oneOf") + expectedEnabledKeywords.add("pattern") + expectedEnabledKeywords.add("patternProperties") + expectedEnabledKeywords.add("prefixItems") + expectedEnabledKeywords.add("properties") + expectedEnabledKeywords.add("propertyNames") + expectedEnabledKeywords.add("required") + expectedEnabledKeywords.add("then") + expectedEnabledKeywords.add("type") + expectedEnabledKeywords.add("uniqueItems") + expectedEnabledKeywords.add("unevaluatedItems") + expectedEnabledKeywords.add("unevaluatedProperties") + assertEquals(enabledKeywords, expectedEnabledKeywords) + } + + @Test + fun testGetNoEnabledKeywords() { + val jsonSchemaKeywordFlags = JsonSchemaKeywordFlags( + false, + false, + false, + false, + false, + false, + false, + false, + false, + false, + false, + false, + false, + false, + false, + false, + false, + false, + false, + false, + false, + false, + false, + false, + false, + false, + false, + false, + false, + false, + false, + false, + false, + false, + false, + false, + false, + false, + false + ) + val enabledKeywords = jsonSchemaKeywordFlags.keywords + val expectedEnabledKeywords = LinkedHashSet() + assertEquals(enabledKeywords, expectedEnabledKeywords) + } +} \ No newline at end of file diff --git a/samples/client/3_1_0_unit_test/kotlin/src/test/kotlin/org/openapijsonschematools/client/schemas/AnyTypeSchemaTest.kt b/samples/client/3_1_0_unit_test/kotlin/src/test/kotlin/org/openapijsonschematools/client/schemas/AnyTypeSchemaTest.kt new file mode 100644 index 00000000000..74571be8bc2 --- /dev/null +++ b/samples/client/3_1_0_unit_test/kotlin/src/test/kotlin/org/openapijsonschematools/client/schemas/AnyTypeSchemaTest.kt @@ -0,0 +1,113 @@ +package org.openapijsonschematools.client.schemas + +import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags +import org.openapijsonschematools.client.configurations.SchemaConfiguration +import org.openapijsonschematools.client.exceptions.ValidationException +import org.openapijsonschematools.client.schemas.validation.FrozenList +import org.openapijsonschematools.client.schemas.validation.FrozenMap + +import java.time.LocalDate +import java.time.ZoneId +import java.time.ZonedDateTime +import kotlin.test.Test +import kotlin.test.assertEquals +import kotlin.test.assertFalse +import kotlin.test.assertNull +import kotlin.test.assertTrue + +class AnyTypeSchemaTest { + @Test + @Throws(ValidationException::class) + fun testValidateNull() { + val validatedValue: Nothing? = schema.validate(null, configuration) + assertNull(validatedValue) + } + + @Test + @Throws(ValidationException::class) + fun testValidateBoolean() { + val trueValue = schema.validate(true, configuration) + assertTrue(trueValue) + val falseValue = schema.validate(false, configuration) + assertFalse(falseValue) + } + + @Test + @Throws(ValidationException::class) + fun testValidateInteger() { + val validatedValue = schema.validate(1, configuration) + assertEquals(validatedValue.toLong(), 1) + } + + @Test + @Throws(ValidationException::class) + fun testValidateLong() { + val validatedValue = schema.validate(1L, configuration) + assertEquals(validatedValue, 1L) + } + + @Test + @Throws(ValidationException::class) + fun testValidateFloat() { + val validatedValue = schema.validate(3.14f, configuration) + assertEquals(validatedValue.compareTo(3.14f).toLong(), 0) + } + + @Test + @Throws(ValidationException::class) + fun testValidateDouble() { + val validatedValue = schema.validate(70.6458763, configuration) + assertEquals(validatedValue.compareTo(70.6458763).toLong(), 0) + } + + @Test + @Throws(ValidationException::class) + fun testValidateString() { + val validatedValue = schema.validate("a", configuration) + assertEquals(validatedValue, "a") + } + + @Test + @Throws(ValidationException::class) + fun testValidateZonedDateTime() { + val validatedValue = + schema.validate(ZonedDateTime.of(2017, 7, 21, 17, 32, 28, 0, ZoneId.of("Z")), configuration) + assertEquals(validatedValue, "2017-07-21T17:32:28Z") + } + + @Test + @Throws(ValidationException::class) + fun testValidateLocalDate() { + val validatedValue = schema.validate(LocalDate.of(2017, 7, 21), configuration) + assertEquals(validatedValue, "2017-07-21") + } + + @Test + @Throws(ValidationException::class) + fun testValidateMap() { + val inMap = mapOf( + "today" to LocalDate.of(2017, 7, 21) + ) + val validatedValue: FrozenMap<*> = schema.validate(inMap, configuration) + val outMap: Map = mapOf( + "today" to "2017-07-21" + ) + assertEquals(validatedValue, outMap) + } + + @Test + @Throws(ValidationException::class) + fun testValidateList() { + val inList = listOf( + LocalDate.of(2017, 7, 21) + ) + val validatedValue: FrozenList<*> = schema.validate(inList, configuration) + val outList: List = listOf("2017-07-21") + assertEquals(validatedValue, outList) + } + + companion object { + val schema = AnyTypeJsonSchema.AnyTypeJsonSchema1.getInstance() + val configuration = SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + } +} \ No newline at end of file diff --git a/samples/client/3_1_0_unit_test/kotlin/src/test/kotlin/org/openapijsonschematools/client/schemas/ArrayTypeSchemaTest.kt b/samples/client/3_1_0_unit_test/kotlin/src/test/kotlin/org/openapijsonschematools/client/schemas/ArrayTypeSchemaTest.kt new file mode 100644 index 00000000000..79c24c6cb44 --- /dev/null +++ b/samples/client/3_1_0_unit_test/kotlin/src/test/kotlin/org/openapijsonschematools/client/schemas/ArrayTypeSchemaTest.kt @@ -0,0 +1,251 @@ +package org.openapijsonschematools.client.schemas + +import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags +import org.openapijsonschematools.client.configurations.SchemaConfiguration +import org.openapijsonschematools.client.exceptions.ValidationException +import org.openapijsonschematools.client.schemas.validation.JsonSchema +import org.openapijsonschematools.client.schemas.validation.JsonSchemaInfo +import org.openapijsonschematools.client.schemas.validation.FrozenList +import org.openapijsonschematools.client.schemas.validation.PathToSchemasMap +import org.openapijsonschematools.client.schemas.validation.ListSchemaValidator +import org.openapijsonschematools.client.schemas.validation.ValidationMetadata + +import kotlin.test.Test +import kotlin.test.assertEquals +import kotlin.test.assertFailsWith + +class ArrayTypeSchemaTest { + sealed interface ArrayWithItemsSchemaBoxed + + data class ArrayWithItemsSchemaBoxedList(val data: FrozenList) : ArrayWithItemsSchemaBoxed + class ArrayWithItemsSchema : JsonSchema( + JsonSchemaInfo() + .type(setOf(List::class.java)) + .items(StringJsonSchema.StringJsonSchema1::class.java) + ), ListSchemaValidator, ArrayWithItemsSchemaBoxedList> { + override fun getNewInstance( + arg: List<*>, + pathToItem: List, + pathToSchemas: PathToSchemasMap + ): FrozenList { + val items: MutableList = ArrayList() + var i = 0 + for (item in arg) { + val itemPathToItem: MutableList = ArrayList(pathToItem) + itemPathToItem.add(i) + val schemas = pathToSchemas[itemPathToItem] + ?: throw RuntimeException("Validation result is invalid, schemas must exist for a pathToItem") + val itemSchema = schemas.entries.iterator().next().key + val castItem = itemSchema.getNewInstance(item, itemPathToItem, pathToSchemas) as? String + ?: throw RuntimeException("Instantiated type of item is invalid") + items.add(castItem) + i += 1 + } + return FrozenList(items) + } + + @Throws(ValidationException::class) + override fun validate(arg: List<*>, configuration: SchemaConfiguration?): FrozenList { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg: List<*> = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validationMetadata = + ValidationMetadata(pathToItem, usedConfiguration, PathToSchemasMap(), LinkedHashSet()) + val pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet) + return getNewInstance(castArg, validationMetadata.pathToItem, pathToSchemasMap) + } + + @Throws(ValidationException::class) + override fun validateAndBox(arg: List<*>, configuration: SchemaConfiguration?): ArrayWithItemsSchemaBoxedList { + return ArrayWithItemsSchemaBoxedList(validate(arg, configuration)) + } + + override fun getNewInstance(arg: Any?, pathToItem: List, pathToSchemas: PathToSchemasMap): Any? { + if (arg is List<*>) { + return getNewInstance(arg, pathToItem, pathToSchemas) + } + throw RuntimeException("Invalid input type=$javaClass. It can't be instantiated by this schema") + } + + @Throws(ValidationException::class) + override fun validate(arg: Any?, configuration: SchemaConfiguration?): Any? { + if (arg is List<*>) { + return validate(arg as List<*>?, configuration) + } + throw ValidationException("Invalid input type=$javaClass. It can't be validated by this schema") + } + + @Throws(ValidationException::class) + override fun validateAndBox(arg: Any?, configuration: SchemaConfiguration?): ArrayWithItemsSchemaBoxed { + if (arg is List<*>) { + return ArrayWithItemsSchemaBoxedList(validate(arg, configuration)) + } + throw ValidationException("Invalid input type=$javaClass. It can't be validated by this schema") + } + } + + class ArrayWithOutputClsSchemaList(m: FrozenList) : FrozenList(m) { + companion object { + @Throws(ValidationException::class) + fun of(arg: List, configuration: SchemaConfiguration?): ArrayWithOutputClsSchemaList { + return ArrayWithOutputClsSchema().validate(arg, configuration) + } + } + } + + interface ArrayWithOutputClsSchemaBoxed + + data class ArrayWithOutputClsSchemaBoxedList(val data: ArrayWithOutputClsSchemaList) : + ArrayWithOutputClsSchemaBoxed + + class ArrayWithOutputClsSchema : JsonSchema( + JsonSchemaInfo() + .type(setOf(List::class.java)) + .items(StringJsonSchema.StringJsonSchema1::class.java) + ), ListSchemaValidator { + override fun getNewInstance( + arg: List<*>, + pathToItem: List, + pathToSchemas: PathToSchemasMap + ): ArrayWithOutputClsSchemaList { + val items: MutableList = ArrayList() + var i = 0 + for (item in arg) { + val itemPathToItem: MutableList = ArrayList(pathToItem) + itemPathToItem.add(i) + val schemas = pathToSchemas[itemPathToItem] + ?: throw RuntimeException("Validation result is invalid, schemas must exist for a pathToItem") + val itemSchema = schemas.entries.iterator().next().key + val castItem = itemSchema.getNewInstance(item, itemPathToItem, pathToSchemas) as? String + ?: throw RuntimeException("Instantiated type of item is invalid") + items.add(castItem) + i += 1 + } + val newInstanceItems = FrozenList(items) + return ArrayWithOutputClsSchemaList(newInstanceItems) + } + + @Throws(ValidationException::class) + override fun validate(arg: List<*>, configuration: SchemaConfiguration?): ArrayWithOutputClsSchemaList { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg: List<*> = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validationMetadata = + ValidationMetadata(pathToItem, usedConfiguration, PathToSchemasMap(), LinkedHashSet()) + val pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet) + return getNewInstance(castArg, validationMetadata.pathToItem, pathToSchemasMap) + } + + @Throws(ValidationException::class) + override fun validateAndBox( + arg: List<*>, + configuration: SchemaConfiguration? + ): ArrayWithOutputClsSchemaBoxedList { + return ArrayWithOutputClsSchemaBoxedList(validate(arg, configuration)) + } + + override fun getNewInstance(arg: Any?, pathToItem: List, pathToSchemas: PathToSchemasMap): Any? { + if (arg is List<*>) { + return getNewInstance(arg, pathToItem, pathToSchemas) + } + throw RuntimeException("Invalid input type=$javaClass. It can't be instantiated by this schema") + } + + @Throws(ValidationException::class) + override fun validate(arg: Any?, configuration: SchemaConfiguration?): Any? { + if (arg is List<*>) { + return validate(arg as List<*>?, configuration) + } + throw ValidationException("Invalid input type=$javaClass. It can't be validated by this schema") + } + + @Throws(ValidationException::class) + override fun validateAndBox(arg: Any?, configuration: SchemaConfiguration?): ArrayWithOutputClsSchemaBoxed { + if (arg is List<*>) { + return ArrayWithOutputClsSchemaBoxedList(validate(arg, configuration)) + } + throw ValidationException("Invalid input type=$javaClass. It can't be validated by this schema") + } + } + + @Test + fun testExceptionThrownForInvalidType() { + assertFailsWith( + block = { + JsonSchema.validate( + ArrayWithItemsSchema(), + null, + validationMetadata + ) + } + ) + } + + @Test + @Throws(ValidationException::class) + fun testValidateArrayWithItemsSchema() { + // list with only item works + var inList: List = listOf("abc") + var validatedValue: FrozenList = ArrayWithItemsSchema().validate(inList, configuration) + var outList: List = listOf("abc") + assertEquals(validatedValue, outList) + + // list with no items works + inList = listOf() + validatedValue = ArrayWithItemsSchema().validate(inList, configuration) + outList = listOf() + assertEquals(validatedValue, outList) + + // invalid item type fails + val intList = listOf(1) + assertFailsWith( + block = { + JsonSchema.validate( + ArrayWithItemsSchema(), + intList, + validationMetadata + ) + } + ) + } + + @Test + @Throws(ValidationException::class) + fun testValidateArrayWithOutputClsSchema() { + // list with only item works + var inList: List = listOf("abc") + var validatedValue = ArrayWithOutputClsSchema().validate(inList, configuration) + var outList: List = listOf("abc") + assertEquals(validatedValue, outList) + + // list with no items works + inList = listOf() + validatedValue = ArrayWithOutputClsSchema().validate(inList, configuration) + outList = listOf() + assertEquals(validatedValue, outList) + + // invalid item type fails + val intList = listOf(1) + assertFailsWith( + block = { + JsonSchema.validate( + ArrayWithOutputClsSchema(), + intList, + validationMetadata + ) + } + ) + } + + companion object { + val configuration = SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validationMetadata = ValidationMetadata( + listOf("args[0"), + configuration, + PathToSchemasMap(), + LinkedHashSet() + ) + } +} \ No newline at end of file diff --git a/samples/client/3_1_0_unit_test/kotlin/src/test/kotlin/org/openapijsonschematools/client/schemas/BooleanSchemaTest.kt b/samples/client/3_1_0_unit_test/kotlin/src/test/kotlin/org/openapijsonschematools/client/schemas/BooleanSchemaTest.kt new file mode 100644 index 00000000000..4afe62df020 --- /dev/null +++ b/samples/client/3_1_0_unit_test/kotlin/src/test/kotlin/org/openapijsonschematools/client/schemas/BooleanSchemaTest.kt @@ -0,0 +1,53 @@ +package org.openapijsonschematools.client.schemas + +import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags +import org.openapijsonschematools.client.configurations.SchemaConfiguration +import org.openapijsonschematools.client.exceptions.ValidationException +import org.openapijsonschematools.client.schemas.validation.JsonSchema +import org.openapijsonschematools.client.schemas.validation.PathToSchemasMap +import org.openapijsonschematools.client.schemas.validation.ValidationMetadata + +import kotlin.test.Test +import kotlin.test.assertFailsWith +import kotlin.test.assertFalse +import kotlin.test.assertTrue + +class BooleanSchemaTest { + @Test + @Throws(ValidationException::class) + fun testValidateTrue() { + val validatedValue = booleanJsonSchema.validate(true, configuration) + assertTrue(validatedValue) + } + + @Test + @Throws(ValidationException::class) + fun testValidateFalse() { + val validatedValue = booleanJsonSchema.validate(false, configuration) + assertFalse(validatedValue) + } + + @Test + fun testExceptionThrownForInvalidType() { + assertFailsWith( + block = { + JsonSchema.validate( + booleanJsonSchema, + null, + validationMetadata + ) + } + ) + } + + companion object { + val configuration = SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val booleanJsonSchema = BooleanJsonSchema.BooleanJsonSchema1.getInstance() + val validationMetadata = ValidationMetadata( + listOf("args[0"), + configuration, + PathToSchemasMap(), + LinkedHashSet() + ) + } +} \ No newline at end of file diff --git a/samples/client/3_1_0_unit_test/kotlin/src/test/kotlin/org/openapijsonschematools/client/schemas/ListBuilderTest.kt b/samples/client/3_1_0_unit_test/kotlin/src/test/kotlin/org/openapijsonschematools/client/schemas/ListBuilderTest.kt new file mode 100644 index 00000000000..6aa74e7b8dc --- /dev/null +++ b/samples/client/3_1_0_unit_test/kotlin/src/test/kotlin/org/openapijsonschematools/client/schemas/ListBuilderTest.kt @@ -0,0 +1,55 @@ +package org.openapijsonschematools.client.schemas + +import kotlin.test.Test +import kotlin.test.assertEquals + +class ListBuilderTest { + class NullableListWithNullableItemsListBuilder { + // class to build List<@Nullable List> + private val list: MutableList?> + + constructor() { + list = ArrayList() + } + + constructor(list: MutableList?>) { + this.list = list + } + + fun add(item: Nothing?): NullableListWithNullableItemsListBuilder { + list.add(item) + return this + } + + fun add(item: List): NullableListWithNullableItemsListBuilder { + list.add(item) + return this + } + + fun build(): List?> { + return list + } + } + + @Test + fun testSucceedsWithNullInput() { + val inList: MutableList?> = ArrayList() + inList.add(null) + var builder = NullableListWithNullableItemsListBuilder(inList) + assertEquals(inList, builder.build()) + builder = NullableListWithNullableItemsListBuilder() + builder.add(null) + assertEquals(inList, builder.build()) + } + + @Test + fun testSucceedsWithNonNullInput() { + val inList: MutableList?> = ArrayList() + inList.add(listOf(1)) + var builder = NullableListWithNullableItemsListBuilder(inList) + assertEquals(inList, builder.build()) + builder = NullableListWithNullableItemsListBuilder() + builder.add(listOf(1)) + assertEquals(inList, builder.build()) + } +} \ No newline at end of file diff --git a/samples/client/3_1_0_unit_test/kotlin/src/test/kotlin/org/openapijsonschematools/client/schemas/ListSchemaTest.kt b/samples/client/3_1_0_unit_test/kotlin/src/test/kotlin/org/openapijsonschematools/client/schemas/ListSchemaTest.kt new file mode 100644 index 00000000000..494fd110f59 --- /dev/null +++ b/samples/client/3_1_0_unit_test/kotlin/src/test/kotlin/org/openapijsonschematools/client/schemas/ListSchemaTest.kt @@ -0,0 +1,49 @@ +package org.openapijsonschematools.client.schemas + +import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags +import org.openapijsonschematools.client.configurations.SchemaConfiguration +import org.openapijsonschematools.client.exceptions.ValidationException +import org.openapijsonschematools.client.schemas.validation.JsonSchema +import org.openapijsonschematools.client.schemas.validation.FrozenList +import org.openapijsonschematools.client.schemas.validation.PathToSchemasMap +import org.openapijsonschematools.client.schemas.validation.ValidationMetadata + +import kotlin.test.Test +import kotlin.test.assertEquals +import kotlin.test.assertFailsWith + +class ListSchemaTest { + @Test + fun testExceptionThrownForInvalidType() { + assertFailsWith( + block = { + JsonSchema.validate( + listJsonSchema, + null, + validationMetadata + ) + } + ) + } + + @Test + @Throws(ValidationException::class) + fun testValidateList() { + val inList: MutableList = ArrayList() + inList.add("today") + val validatedValue = listJsonSchema.validate(inList, configuration) + val outList: List = listOf("today") + assertEquals(validatedValue, outList) + } + + companion object { + val configuration = SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val listJsonSchema = ListJsonSchema.ListJsonSchema1.getInstance() + val validationMetadata = ValidationMetadata( + listOf("args[0"), + configuration, + PathToSchemasMap(), + LinkedHashSet() + ) + } +} \ No newline at end of file diff --git a/samples/client/3_1_0_unit_test/kotlin/src/test/kotlin/org/openapijsonschematools/client/schemas/MapSchemaTest.kt b/samples/client/3_1_0_unit_test/kotlin/src/test/kotlin/org/openapijsonschematools/client/schemas/MapSchemaTest.kt new file mode 100644 index 00000000000..bfcd692cb86 --- /dev/null +++ b/samples/client/3_1_0_unit_test/kotlin/src/test/kotlin/org/openapijsonschematools/client/schemas/MapSchemaTest.kt @@ -0,0 +1,50 @@ +package org.openapijsonschematools.client.schemas + +import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags +import org.openapijsonschematools.client.configurations.SchemaConfiguration +import org.openapijsonschematools.client.exceptions.ValidationException +import org.openapijsonschematools.client.schemas.validation.JsonSchema +import org.openapijsonschematools.client.schemas.validation.FrozenMap +import org.openapijsonschematools.client.schemas.validation.PathToSchemasMap +import org.openapijsonschematools.client.schemas.validation.ValidationMetadata + +import java.time.LocalDate +import kotlin.test.Test +import kotlin.test.assertEquals +import kotlin.test.assertFailsWith + +class MapSchemaTest { + @Test + fun testExceptionThrownForInvalidType() { + assertFailsWith( + block = { + JsonSchema.validate( + mapJsonSchema, + null, + validationMetadata + ) + } + ) + } + + @Test + @Throws(ValidationException::class) + fun testValidateMap() { + val inMap: MutableMap = LinkedHashMap() + inMap["today"] = LocalDate.of(2017, 7, 21) + val validatedValue = mapJsonSchema.validate(inMap, configuration) + val outMap: Map = mapOf("today" to "2017-07-21") + assertEquals(validatedValue, outMap) + } + + companion object { + val configuration = SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val mapJsonSchema = MapJsonSchema.MapJsonSchema1.getInstance() + val validationMetadata = ValidationMetadata( + listOf("args[0"), + configuration, + PathToSchemasMap(), + LinkedHashSet() + ) + } +} \ No newline at end of file diff --git a/samples/client/3_1_0_unit_test/kotlin/src/test/kotlin/org/openapijsonschematools/client/schemas/NullSchemaTest.kt b/samples/client/3_1_0_unit_test/kotlin/src/test/kotlin/org/openapijsonschematools/client/schemas/NullSchemaTest.kt new file mode 100644 index 00000000000..a096b91adf2 --- /dev/null +++ b/samples/client/3_1_0_unit_test/kotlin/src/test/kotlin/org/openapijsonschematools/client/schemas/NullSchemaTest.kt @@ -0,0 +1,46 @@ +package org.openapijsonschematools.client.schemas + +import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags +import org.openapijsonschematools.client.configurations.SchemaConfiguration +import org.openapijsonschematools.client.exceptions.ValidationException +import org.openapijsonschematools.client.schemas.validation.JsonSchema +import org.openapijsonschematools.client.schemas.validation.PathToSchemasMap +import org.openapijsonschematools.client.schemas.validation.ValidationMetadata + +import kotlin.Throws +import kotlin.test.Test +import kotlin.test.assertFailsWith +import kotlin.test.assertNull + +class NullSchemaTest { + @Test + @Throws(ValidationException::class) + fun testValidateNull() { + val validatedValue: Nothing? = nullJsonSchema.validate(null, configuration) + assertNull(validatedValue) + } + + @Test + fun testExceptionThrownForInvalidType() { + assertFailsWith( + block = { + JsonSchema.validate( + nullJsonSchema, + true, + validationMetadata + ) + } + ) + } + + companion object { + val configuration = SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val nullJsonSchema = NullJsonSchema.NullJsonSchema1.getInstance() + val validationMetadata = ValidationMetadata( + listOf("args[0"), + configuration, + PathToSchemasMap(), + LinkedHashSet() + ) + } +} \ No newline at end of file diff --git a/samples/client/3_1_0_unit_test/kotlin/src/test/kotlin/org/openapijsonschematools/client/schemas/NumberSchemaTest.kt b/samples/client/3_1_0_unit_test/kotlin/src/test/kotlin/org/openapijsonschematools/client/schemas/NumberSchemaTest.kt new file mode 100644 index 00000000000..db8bd160ce2 --- /dev/null +++ b/samples/client/3_1_0_unit_test/kotlin/src/test/kotlin/org/openapijsonschematools/client/schemas/NumberSchemaTest.kt @@ -0,0 +1,66 @@ +package org.openapijsonschematools.client.schemas + +import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags +import org.openapijsonschematools.client.configurations.SchemaConfiguration +import org.openapijsonschematools.client.exceptions.ValidationException +import org.openapijsonschematools.client.schemas.validation.JsonSchema +import org.openapijsonschematools.client.schemas.validation.PathToSchemasMap +import org.openapijsonschematools.client.schemas.validation.ValidationMetadata + +import kotlin.test.Test +import kotlin.test.assertEquals +import kotlin.test.assertFailsWith + +class NumberSchemaTest { + @Test + @Throws(ValidationException::class) + fun testValidateInteger() { + val validatedValue = numberJsonSchema.validate(1, configuration) + assertEquals(validatedValue.toLong(), 1) + } + + @Test + @Throws(ValidationException::class) + fun testValidateLong() { + val validatedValue = numberJsonSchema.validate(1L, configuration) + assertEquals(validatedValue, 1L) + } + + @Test + @Throws(ValidationException::class) + fun testValidateFloat() { + val validatedValue = numberJsonSchema.validate(3.14f, configuration) + assertEquals(validatedValue.compareTo(3.14f).toLong(), 0) + } + + @Test + @Throws(ValidationException::class) + fun testValidateDouble() { + val validatedValue = numberJsonSchema.validate(3.14, configuration) + assertEquals(validatedValue.compareTo(3.14).toLong(), 0) + } + + @Test + fun testExceptionThrownForInvalidType() { + assertFailsWith( + block = { + JsonSchema.validate( + numberJsonSchema, + null, + validationMetadata + ) + } + ) + } + + companion object { + val configuration = SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val numberJsonSchema = NumberJsonSchema.NumberJsonSchema1.getInstance() + val validationMetadata = ValidationMetadata( + listOf("args[0"), + configuration, + PathToSchemasMap(), + LinkedHashSet() + ) + } +} \ No newline at end of file diff --git a/samples/client/3_1_0_unit_test/kotlin/src/test/kotlin/org/openapijsonschematools/client/schemas/ObjectTypeSchemaTest.kt b/samples/client/3_1_0_unit_test/kotlin/src/test/kotlin/org/openapijsonschematools/client/schemas/ObjectTypeSchemaTest.kt new file mode 100644 index 00000000000..a87586e8b15 --- /dev/null +++ b/samples/client/3_1_0_unit_test/kotlin/src/test/kotlin/org/openapijsonschematools/client/schemas/ObjectTypeSchemaTest.kt @@ -0,0 +1,569 @@ +package org.openapijsonschematools.client.schemas + +import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags +import org.openapijsonschematools.client.configurations.SchemaConfiguration +import org.openapijsonschematools.client.exceptions.ValidationException +import org.openapijsonschematools.client.schemas.validation.JsonSchema +import org.openapijsonschematools.client.schemas.validation.JsonSchemaInfo +import org.openapijsonschematools.client.schemas.validation.FrozenMap +import org.openapijsonschematools.client.schemas.validation.PathToSchemasMap +import org.openapijsonschematools.client.schemas.validation.MapSchemaValidator +import org.openapijsonschematools.client.schemas.validation.ValidationMetadata + +import kotlin.test.Test +import kotlin.test.assertEquals +import kotlin.test.assertFailsWith + +class ObjectTypeSchemaTest { + interface ObjectWithPropsSchemaBoxed + + data class ObjectWithPropsSchemaBoxedMap(val data: FrozenMap) : ObjectWithPropsSchemaBoxed + class ObjectWithPropsSchema private constructor() : JsonSchema( + JsonSchemaInfo() + .type(setOf(Map::class.java)) + .properties( + mapOf( + "someString" to StringJsonSchema.StringJsonSchema1::class.java + ) + ) + ), MapSchemaValidator, ObjectWithPropsSchemaBoxedMap> { + override fun getNewInstance( + arg: Map<*, *>, + pathToItem: List, + pathToSchemas: PathToSchemasMap + ): FrozenMap { + val properties = LinkedHashMap() + for ((entryKey, value1) in arg) { + if (entryKey !is String) { + throw RuntimeException("Invalid non-string key value") + } + val propertyPathToItem: MutableList = ArrayList(pathToItem) + propertyPathToItem.add(entryKey) + val value = value1!! + val schemas = pathToSchemas[propertyPathToItem] + ?: throw RuntimeException("Validation result is invalid, schemas must exist for a pathToItem") + val propertySchema = schemas.entries.iterator().next().key + val castValue = propertySchema.getNewInstance(value, propertyPathToItem, pathToSchemas) + properties[entryKey] = castValue + } + return FrozenMap(properties) + } + + @Throws(ValidationException::class) + override fun validate(arg: Map<*, *>, configuration: SchemaConfiguration?): FrozenMap { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg: Map<*, *> = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validationMetadata = + ValidationMetadata(pathToItem, usedConfiguration, PathToSchemasMap(), LinkedHashSet()) + val pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet) + return getNewInstance(castArg, validationMetadata.pathToItem, pathToSchemasMap) + } + + @Throws(ValidationException::class) + override fun validateAndBox( + arg: Map<*, *>, + configuration: SchemaConfiguration? + ): ObjectWithPropsSchemaBoxedMap { + return ObjectWithPropsSchemaBoxedMap(validate(arg, configuration)) + } + + override fun getNewInstance(arg: Any?, pathToItem: List, pathToSchemas: PathToSchemasMap): Any? { + if (arg is Map<*, *>) { + return getNewInstance(arg, pathToItem, pathToSchemas) + } + throw RuntimeException("Invalid input type=$javaClass. It can't be instantiated by this schema") + } + + @Throws(ValidationException::class) + override fun validate(arg: Any?, configuration: SchemaConfiguration?): Any? { + if (arg is Map<*, *>) { + return validate(arg, configuration) + } + throw ValidationException("Invalid input type=$javaClass. It can't be validated by this schema") + } + + @Throws(ValidationException::class) + override fun validateAndBox(arg: Any?, configuration: SchemaConfiguration?): ObjectWithPropsSchemaBoxed { + if (arg is Map<*, *>) { + return ObjectWithPropsSchemaBoxedMap( + validate(arg, configuration) + ) + } + throw ValidationException("Invalid input type=$javaClass. It can't be validated by this schema") + } + + companion object { + @Volatile + private var instance: ObjectWithPropsSchema? = null + + fun getInstance() = + instance ?: synchronized(this) { + instance ?: ObjectWithPropsSchema().also { instance = it } + } + } + } + + interface ObjectWithAddpropsSchemaBoxed + + data class ObjectWithAddpropsSchemaBoxedMap(val data: FrozenMap) : ObjectWithAddpropsSchemaBoxed {} + + class ObjectWithAddpropsSchema private constructor() : JsonSchema( + JsonSchemaInfo() + .type(setOf(Map::class.java)) + .additionalProperties(StringJsonSchema.StringJsonSchema1::class.java) + ), MapSchemaValidator, ObjectWithAddpropsSchemaBoxedMap> { + override fun getNewInstance( + arg: Map<*, *>, + pathToItem: List, + pathToSchemas: PathToSchemasMap + ): FrozenMap { + val properties = LinkedHashMap() + for ((entryKey, value1) in arg) { + if (entryKey !is String) { + throw RuntimeException("Invalid non-string key value") + } + val propertyPathToItem: MutableList = ArrayList(pathToItem) + propertyPathToItem.add(entryKey) + val value = value1!! + val schemas = pathToSchemas[propertyPathToItem] + ?: throw RuntimeException("Validation result is invalid, schemas must exist for a pathToItem") + val propertySchema = schemas.entries.iterator().next().key + val castValue = propertySchema.getNewInstance(value, propertyPathToItem, pathToSchemas) as? String + ?: throw RuntimeException("Invalid type for property value") + properties[entryKey] = castValue + } + return FrozenMap(properties) + } + + @Throws(ValidationException::class) + override fun validate(arg: Map<*, *>, configuration: SchemaConfiguration?): FrozenMap { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg: Map<*, *> = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validationMetadata = + ValidationMetadata(pathToItem, usedConfiguration, PathToSchemasMap(), LinkedHashSet()) + val pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet) + return getNewInstance(castArg, validationMetadata.pathToItem, pathToSchemasMap) + } + + @Throws(ValidationException::class) + override fun validateAndBox( + arg: Map<*, *>, + configuration: SchemaConfiguration? + ): ObjectWithAddpropsSchemaBoxedMap { + return ObjectWithAddpropsSchemaBoxedMap(validate(arg, configuration)) + } + + @Throws(ValidationException::class) + override fun validate(arg: Any?, configuration: SchemaConfiguration?): Any? { + if (arg is Map<*, *>) { + return validate(arg, configuration) + } + throw ValidationException("Invalid input type=$javaClass. It can't be validated by this schema") + } + + @Throws(ValidationException::class) + override fun validateAndBox(arg: Any?, configuration: SchemaConfiguration?): ObjectWithAddpropsSchemaBoxed { + if (arg is Map<*, *>) { + return ObjectWithAddpropsSchemaBoxedMap(validate(arg, configuration)) + } + throw ValidationException("Invalid input type=$javaClass. It can't be validated by this schema") + } + + override fun getNewInstance(arg: Any?, pathToItem: List, pathToSchemas: PathToSchemasMap): Any? { + if (arg is Map<*, *>) { + return getNewInstance(arg, pathToItem, pathToSchemas) + } + throw RuntimeException("Invalid input type=$javaClass. It can't be instantiated by this schema") + } + + companion object { + @Volatile + private var instance: ObjectWithAddpropsSchema? = null + + fun getInstance() = + instance ?: synchronized(this) { + instance ?: ObjectWithAddpropsSchema().also { instance = it } + } + } + } + + interface ObjectWithPropsAndAddpropsSchemaBoxed + + data class ObjectWithPropsAndAddpropsSchemaBoxedMap(val data: FrozenMap) : + ObjectWithPropsAndAddpropsSchemaBoxed { + } + + class ObjectWithPropsAndAddpropsSchema private constructor() : JsonSchema( + JsonSchemaInfo() + .type(setOf(Map::class.java)) + .properties( + mapOf( + "someString" to StringJsonSchema.StringJsonSchema1::class.java + ) + ) + .additionalProperties(BooleanJsonSchema.BooleanJsonSchema1::class.java) + ), MapSchemaValidator, ObjectWithPropsAndAddpropsSchemaBoxedMap> { + override fun getNewInstance( + arg: Map<*, *>, + pathToItem: List, + pathToSchemas: PathToSchemasMap + ): FrozenMap { + val properties = LinkedHashMap() + for ((entryKey, value1) in arg) { + if (entryKey !is String) { + throw RuntimeException("Invalid non-string key value") + } + val propertyPathToItem: MutableList = ArrayList(pathToItem) + propertyPathToItem.add(entryKey) + val value = value1!! + val schemas = pathToSchemas[propertyPathToItem] + ?: throw RuntimeException("Validation result is invalid, schemas must exist for a pathToItem") + val propertySchema = schemas.entries.iterator().next().key + val castValue = propertySchema.getNewInstance(value, propertyPathToItem, pathToSchemas) + properties[entryKey] = castValue + } + return FrozenMap(properties) + } + + @Throws(ValidationException::class) + override fun validate(arg: Map<*, *>, configuration: SchemaConfiguration?): FrozenMap { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg: Map<*, *> = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validationMetadata = + ValidationMetadata(pathToItem, usedConfiguration, PathToSchemasMap(), LinkedHashSet()) + val pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet) + return getNewInstance(castArg, validationMetadata.pathToItem, pathToSchemasMap) + } + + @Throws(ValidationException::class) + override fun validateAndBox( + arg: Map<*, *>, + configuration: SchemaConfiguration? + ): ObjectWithPropsAndAddpropsSchemaBoxedMap { + return ObjectWithPropsAndAddpropsSchemaBoxedMap(validate(arg, configuration)) + } + + @Throws(ValidationException::class) + override fun validate(arg: Any?, configuration: SchemaConfiguration?): Any? { + if (arg is Map<*, *>) { + return validate(arg, configuration) + } + throw ValidationException("Invalid input type=$javaClass. It can't be validated by this schema") + } + + @Throws(ValidationException::class) + override fun validateAndBox( + arg: Any?, + configuration: SchemaConfiguration? + ): ObjectWithPropsAndAddpropsSchemaBoxed { + if (arg is Map<*, *>) { + return ObjectWithPropsAndAddpropsSchemaBoxedMap(validate(arg, configuration)) + } + throw ValidationException("Invalid input type=$javaClass. It can't be validated by this schema") + } + + override fun getNewInstance(arg: Any?, pathToItem: List, pathToSchemas: PathToSchemasMap): Any? { + if (arg is Map<*, *>) { + return getNewInstance(arg, pathToItem, pathToSchemas) + } + throw RuntimeException("Invalid input type=$javaClass. It can't be instantiated by this schema") + } + + companion object { + @Volatile + private var instance: ObjectWithPropsAndAddpropsSchema? = null + + fun getInstance() = + instance ?: synchronized(this) { + instance ?: ObjectWithPropsAndAddpropsSchema().also { instance = it } + } + } + } + + class ObjectWithOutputTypeSchemaMap(m: FrozenMap) : FrozenMap(m) { + companion object { + @Throws(ValidationException::class) + fun of(arg: Map, configuration: SchemaConfiguration?): ObjectWithOutputTypeSchemaMap { + return ObjectWithOutputTypeSchema.getInstance().validate(arg, configuration) + } + } + } + + interface ObjectWithOutputTypeSchemaBoxed + + data class ObjectWithOutputTypeSchemaBoxedMap(val data: ObjectWithOutputTypeSchemaMap) : + ObjectWithOutputTypeSchemaBoxed { + } + + class ObjectWithOutputTypeSchema : JsonSchema( + JsonSchemaInfo() + .type(setOf(Map::class.java)) + .properties( + mapOf( + "someString" to StringJsonSchema.StringJsonSchema1::class.java + ) + ) + ), MapSchemaValidator { + override fun getNewInstance( + arg: Map<*, *>, + pathToItem: List, + pathToSchemas: PathToSchemasMap + ): ObjectWithOutputTypeSchemaMap { + val properties = LinkedHashMap() + for ((entryKey, value1) in arg) { + if (entryKey !is String) { + throw RuntimeException("Invalid non-string key value") + } + val propertyPathToItem: MutableList = ArrayList(pathToItem) + propertyPathToItem.add(entryKey) + val value = value1!! + val schemas = pathToSchemas[propertyPathToItem] + ?: throw RuntimeException("Validation result is invalid, schemas must exist for a pathToItem") + val propertySchema = schemas.entries.iterator().next().key + val castValue = propertySchema.getNewInstance(value, propertyPathToItem, pathToSchemas) + properties[entryKey] = castValue + } + return ObjectWithOutputTypeSchemaMap(FrozenMap(properties)) + } + + @Throws(ValidationException::class) + override fun validate(arg: Map<*, *>, configuration: SchemaConfiguration?): ObjectWithOutputTypeSchemaMap { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg: Map<*, *> = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validationMetadata = + ValidationMetadata(pathToItem, usedConfiguration, PathToSchemasMap(), LinkedHashSet()) + val pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet) + return getNewInstance(castArg, validationMetadata.pathToItem, pathToSchemasMap) + } + + @Throws(ValidationException::class) + override fun validateAndBox( + arg: Map<*, *>, + configuration: SchemaConfiguration? + ): ObjectWithOutputTypeSchemaBoxedMap { + return ObjectWithOutputTypeSchemaBoxedMap(validate(arg, configuration)) + } + + @Throws(ValidationException::class) + override fun validate(arg: Any?, configuration: SchemaConfiguration?): Any? { + if (arg is Map<*, *>) { + return validate(arg, configuration) + } + throw ValidationException("Invalid input type=$javaClass. It can't be validated by this schema") + } + + @Throws(ValidationException::class) + override fun validateAndBox(arg: Any?, configuration: SchemaConfiguration?): ObjectWithOutputTypeSchemaBoxed { + if (arg is Map<*, *>) { + return ObjectWithOutputTypeSchemaBoxedMap(validate(arg, configuration)) + } + throw ValidationException("Invalid input type=$javaClass. It can't be validated by this schema") + } + + override fun getNewInstance(arg: Any?, pathToItem: List, pathToSchemas: PathToSchemasMap): Any? { + if (arg is FrozenMap<*>) { + return getNewInstance(arg, pathToItem, pathToSchemas) + } + throw RuntimeException("Invalid input type=$javaClass. It can't be instantiated by this schema") + } + + companion object { + @Volatile + private var instance: ObjectWithOutputTypeSchema? = null + + fun getInstance() = + instance ?: synchronized(this) { + instance ?: ObjectWithOutputTypeSchema().also { instance = it } + } + } + } + + @Test + fun testExceptionThrownForInvalidType() { + val schema = ObjectWithPropsSchema.getInstance() + assertFailsWith( + block = { + JsonSchema.validate( + schema, + null, + validationMetadata + ) + } + ) + } + + @Test + @Throws(ValidationException::class) + fun testValidateObjectWithPropsSchema() { + val schema = ObjectWithPropsSchema.getInstance() + + // map with only property works + var inMap: Map = mapOf("someString" to "abc") + var validatedValue = schema.validate(inMap, configuration) + var outMap: Map = mapOf("someString" to "abc") + assertEquals(validatedValue, outMap) + + // map with additional unvalidated property works + inMap = mapOf( + "someString" to "abc", + "someOtherString" to "def" + ) + validatedValue = schema.validate(inMap, configuration) + val outMap1: Map = mapOf( + "someString" to "abc", + "someOtherString" to "def" + ) + assertEquals(validatedValue, outMap1) + + // invalid prop type fails + val invalidMap = mapOf("someString" to 1) + assertFailsWith( + block = { + schema.validate( + invalidMap, configuration + ) + } + ) + } + + @Test + @Throws(ValidationException::class) + fun testValidateObjectWithAddpropsSchema() { + val schema = ObjectWithAddpropsSchema.getInstance() + + // map with only property works + var inMap: MutableMap = LinkedHashMap() + inMap["someString"] = "abc" + var validatedValue = schema.validate(inMap, configuration) + var outMap: Map = mapOf("someString" to "abc") + assertEquals(validatedValue, outMap) + + // map with additional properties works + inMap = LinkedHashMap() + inMap["someString"] = "abc" + inMap["someOtherString"] = "def" + validatedValue = schema.validate(inMap, configuration) + outMap = mapOf( + "someString" to "abc", + "someOtherString" to "def" + ) + assertEquals(validatedValue, outMap) + + // invalid addProp type fails + val invalidInput = java.util.Map.of("someString", 1) + assertFailsWith( + block = { + JsonSchema.validate( + schema, + invalidInput, + validationMetadata + ) + } + ) + } + + @Test + @Throws(ValidationException::class) + fun testValidateObjectWithPropsAndAddpropsSchema() { + val schema = ObjectWithPropsAndAddpropsSchema.getInstance() + + // map with only property works + var inMap: Map = mapOf("someString" to "abc") + var validatedValue: Map = schema.validate(inMap, configuration) + var outMap: Map = mapOf("someString" to "abc") + assertEquals(validatedValue, outMap) + + // map with additional properties works + inMap = mapOf( + "someString" to "abc", + "someAddProp" to true + ) + validatedValue = schema.validate(inMap, configuration) + val outMap1: Map = mapOf( + "someString" to "abc", + "someAddProp" to true + ) + assertEquals(validatedValue, outMap1) + + // invalid prop type fails + inMap = mapOf("someString" to 1) + val invalidPropMap: Map = inMap + assertFailsWith( + block = { + schema.validate( + invalidPropMap, configuration + ) + } + ) + + // invalid addProp type fails + inMap = LinkedHashMap() + inMap["someAddProp"] = 1 + val invalidAddpropMap: Map = inMap + assertFailsWith( + block = { + schema.validate( + invalidAddpropMap, configuration + ) + } + ) + } + + @Test + @Throws(ValidationException::class) + fun testValidateObjectWithOutputTypeSchema() { + val schema = ObjectWithOutputTypeSchema.getInstance() + + // map with only property works + var inMap: Map = mapOf("someString" to "abc") + var validatedValue = schema.validate(inMap, configuration) + var outMap: Map = mapOf("someString" to "abc") + assertEquals(validatedValue, outMap) + + // map with additional unvalidated property works + inMap = mapOf( + "someString" to "abc", + "someOtherString" to "def", + ) + validatedValue = schema.validate(inMap, configuration) + val outMap1: Map = mapOf( + "someString" to "abc", + "someOtherString" to "def", + ) + assertEquals(validatedValue, outMap1) + + // invalid prop type fails + val invalidInMap = mapOf("someString" to 1) + assertFailsWith( + block = { + schema.validate( + invalidInMap, configuration + ) + } + ) + + // using output class directly works + inMap = mapOf("someString" to "abc") + validatedValue = ObjectWithOutputTypeSchemaMap.of(inMap, configuration) + val outMap2: Map = mapOf("someString" to "abc") + assertEquals(validatedValue, outMap2) + } + + companion object { + val configuration = SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validationMetadata = ValidationMetadata( + listOf("args[0"), + configuration, + PathToSchemasMap(), + LinkedHashSet() + ) + } +} \ No newline at end of file diff --git a/samples/client/3_1_0_unit_test/kotlin/src/test/kotlin/org/openapijsonschematools/client/schemas/RefBooleanSchemaTest.kt b/samples/client/3_1_0_unit_test/kotlin/src/test/kotlin/org/openapijsonschematools/client/schemas/RefBooleanSchemaTest.kt new file mode 100644 index 00000000000..651d570e7fb --- /dev/null +++ b/samples/client/3_1_0_unit_test/kotlin/src/test/kotlin/org/openapijsonschematools/client/schemas/RefBooleanSchemaTest.kt @@ -0,0 +1,67 @@ +package org.openapijsonschematools.client.schemas + +import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags +import org.openapijsonschematools.client.configurations.SchemaConfiguration +import org.openapijsonschematools.client.exceptions.ValidationException +import org.openapijsonschematools.client.schemas.validation.JsonSchema +import org.openapijsonschematools.client.schemas.validation.PathToSchemasMap +import org.openapijsonschematools.client.schemas.validation.ValidationMetadata +import org.openapijsonschematools.client.schemas.validation.JsonSchemaFactory + +import kotlin.test.Test +import kotlin.test.assertEquals +import kotlin.test.assertFailsWith + +class RefBooleanSchemaTest { + class RefBooleanSchema { + class RefBooleanSchema1 : BooleanJsonSchema.BooleanJsonSchema1() { + companion object { + @Volatile + private var instance: RefBooleanSchema1? = null + + fun getInstance() = + instance ?: synchronized(this) { + instance ?: RefBooleanSchema1().also { instance = it } + } + } + } + } + + @Test + @Throws(ValidationException::class) + fun testValidateTrue() { + val validatedValue = refBooleanJsonSchema.validate(true, configuration) + assertEquals(validatedValue, true) + } + + @Test + @Throws(ValidationException::class) + fun testValidateFalse() { + val validatedValue = refBooleanJsonSchema.validate(false, configuration) + assertEquals(validatedValue, false) + } + + @Test + fun testExceptionThrownForInvalidType() { + assertFailsWith( + block = { + JsonSchema.validate( + refBooleanJsonSchema, + null, + validationMetadata + ) + } + ) + } + + companion object { + val configuration = SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val refBooleanJsonSchema = JsonSchemaFactory.getInstance(RefBooleanSchema.RefBooleanSchema1::class.java) + val validationMetadata = ValidationMetadata( + listOf("args[0"), + configuration, + PathToSchemasMap(), + LinkedHashSet() + ) + } +} \ No newline at end of file diff --git a/samples/client/3_1_0_unit_test/kotlin/src/test/kotlin/org/openapijsonschematools/client/schemas/validation/AdditionalPropertiesValidatorTest.kt b/samples/client/3_1_0_unit_test/kotlin/src/test/kotlin/org/openapijsonschematools/client/schemas/validation/AdditionalPropertiesValidatorTest.kt new file mode 100644 index 00000000000..c0add8f2b58 --- /dev/null +++ b/samples/client/3_1_0_unit_test/kotlin/src/test/kotlin/org/openapijsonschematools/client/schemas/validation/AdditionalPropertiesValidatorTest.kt @@ -0,0 +1,140 @@ +package org.openapijsonschematools.client.schemas.validation + +import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags +import org.openapijsonschematools.client.configurations.SchemaConfiguration +import org.openapijsonschematools.client.schemas.MapJsonSchema +import org.openapijsonschematools.client.schemas.StringJsonSchema +import org.openapijsonschematools.client.exceptions.ValidationException + +import kotlin.test.Test +import kotlin.test.assertEquals +import kotlin.test.assertNull +import kotlin.test.assertFailsWith + + +class AdditionalPropertiesValidatorTest { + sealed interface ObjectWithPropsSchemaBoxed + class ObjectWithPropsSchemaBoxedMap : ObjectWithPropsSchemaBoxed + class ObjectWithPropsSchema private constructor() : JsonSchema( + JsonSchemaInfo() + .type(setOf(Map::class.java)) + .properties( + mapOf( + "someString" to StringJsonSchema.StringJsonSchema1::class.java + ) + ) + .additionalProperties(StringJsonSchema.StringJsonSchema1::class.java) + ) { + override fun getNewInstance(arg: Any?, pathToItem: List, pathToSchemas: PathToSchemasMap): Map<*, *> { + if (arg is Map<*, *>) { + return arg + } + throw RuntimeException("Invalid input type=$javaClass. It can't be instantiated by this schema") + } + + @Throws(ValidationException::class) + override fun validate(arg: Any?, configuration: SchemaConfiguration?): Map<*, *> { + if (arg is Map<*, *>) { + return arg + } + throw ValidationException("Invalid input type=$javaClass. It can't be validated by this schema") + } + + @Throws(ValidationException::class) + override fun validateAndBox(arg: Any?, configuration: SchemaConfiguration?): ObjectWithPropsSchemaBoxed { + return ObjectWithPropsSchemaBoxedMap() + } + + companion object { + @Volatile + private var instance: ObjectWithPropsSchema? = null + + fun getInstance() = + instance ?: synchronized(this) { + instance ?: ObjectWithPropsSchema().also { instance = it } + } + } + } + + @Test + @Throws(ValidationException::class) + fun testCorrectPropertySucceeds() { + val pathToItem = listOf("args[0]") + val validationMetadata = ValidationMetadata( + pathToItem, + SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()), + PathToSchemasMap(), + LinkedHashSet() + ) + val mutableMap = java.util.LinkedHashMap() + mutableMap["someString"] = "abc" + mutableMap["someAddProp"] = "def" + val arg = FrozenMap(mutableMap) + val validator = AdditionalPropertiesValidator() + val pathToSchemas = validator.validate( + ValidationData( + ObjectWithPropsSchema.getInstance(), + arg, + validationMetadata + ) + ) ?: throw RuntimeException("Invalid null value for pathToSchemas for this test case") + val expectedPathToItem: MutableList = ArrayList() + expectedPathToItem.add("args[0]") + expectedPathToItem.add("someAddProp") + + val expectedClasses: LinkedHashMap, Nothing?> = LinkedHashMap() + val schema = JsonSchemaFactory.getInstance(StringJsonSchema.StringJsonSchema1::class.java) + expectedClasses[schema] = null + val expectedPathToSchemas = PathToSchemasMap() + expectedPathToSchemas[expectedPathToItem] = expectedClasses + assertEquals(pathToSchemas, expectedPathToSchemas) + } + + @Test + @Throws(ValidationException::class) + fun testNotApplicableTypeReturnsNull() { + val pathToItem = listOf("args[0]") + val validationMetadata = ValidationMetadata( + pathToItem, + SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()), + PathToSchemasMap(), + LinkedHashSet() + ) + val validator = AdditionalPropertiesValidator() + val pathToSchemas = validator.validate( + ValidationData( + MapJsonSchema.MapJsonSchema1.getInstance(), + 1, + validationMetadata + ) + ) + assertNull(pathToSchemas) + } + + @Test + fun testIncorrectPropertyValueFails() { + val pathToItem = listOf("args[0]") + val validationMetadata = ValidationMetadata( + pathToItem, + SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()), + PathToSchemasMap(), + LinkedHashSet() + ) + val mutableMap = java.util.LinkedHashMap() + mutableMap["someString"] = "abc" + mutableMap["someAddProp"] = 1 + val arg = FrozenMap(mutableMap) + val validator = AdditionalPropertiesValidator() + assertFailsWith( + block = { + validator.validate( + ValidationData( + ObjectWithPropsSchema.getInstance(), + arg, + validationMetadata + ) + ) + } + ) + } +} \ No newline at end of file diff --git a/samples/client/3_1_0_unit_test/kotlin/src/test/kotlin/org/openapijsonschematools/client/schemas/validation/CustomIsoparserTest.kt b/samples/client/3_1_0_unit_test/kotlin/src/test/kotlin/org/openapijsonschematools/client/schemas/validation/CustomIsoparserTest.kt new file mode 100644 index 00000000000..89993c589f4 --- /dev/null +++ b/samples/client/3_1_0_unit_test/kotlin/src/test/kotlin/org/openapijsonschematools/client/schemas/validation/CustomIsoparserTest.kt @@ -0,0 +1,25 @@ +package org.openapijsonschematools.client.schemas.validation + +import java.time.LocalDate +import java.time.ZoneId +import java.time.ZonedDateTime + +import kotlin.test.Test +import kotlin.test.assertEquals + +class CustomIsoparserTest { + @Test + fun testParseIsodatetime() { + val dateTime: ZonedDateTime = CustomIsoparser.parseIsodatetime("2017-07-21T17:32:28Z") + val zone = ZoneId.of("Z") + val expectedDateTime = ZonedDateTime.of(2017, 7, 21, 17, 32, 28, 0, zone) + assertEquals(dateTime, expectedDateTime) + } + + @Test + fun testParseIsodate() { + val date: LocalDate = CustomIsoparser.parseIsodate("2017-07-21") + val expectedDate = LocalDate.of(2017, 7, 21) + assertEquals(date, expectedDate) + } +} \ No newline at end of file diff --git a/samples/client/3_1_0_unit_test/kotlin/src/test/kotlin/org/openapijsonschematools/client/schemas/validation/FormatValidatorTest.kt b/samples/client/3_1_0_unit_test/kotlin/src/test/kotlin/org/openapijsonschematools/client/schemas/validation/FormatValidatorTest.kt new file mode 100644 index 00000000000..be917b8337c --- /dev/null +++ b/samples/client/3_1_0_unit_test/kotlin/src/test/kotlin/org/openapijsonschematools/client/schemas/validation/FormatValidatorTest.kt @@ -0,0 +1,418 @@ +package org.openapijsonschematools.client.schemas.validation + +import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags +import org.openapijsonschematools.client.configurations.SchemaConfiguration +import org.openapijsonschematools.client.exceptions.ValidationException +import org.openapijsonschematools.client.schemas.IntJsonSchema +import org.openapijsonschematools.client.schemas.Int32JsonSchema +import org.openapijsonschematools.client.schemas.Int64JsonSchema +import org.openapijsonschematools.client.schemas.FloatJsonSchema +import org.openapijsonschematools.client.schemas.DoubleJsonSchema +import org.openapijsonschematools.client.schemas.DecimalJsonSchema +import org.openapijsonschematools.client.schemas.DateJsonSchema +import org.openapijsonschematools.client.schemas.DateTimeJsonSchema + +import java.math.BigDecimal +import java.math.BigInteger +import kotlin.test.Test +import kotlin.test.assertFailsWith +import kotlin.test.assertNull + +class FormatValidatorTest { + @Test + @Throws(ValidationException::class) + fun testIntFormatSucceedsWithFloat() { + val validator = FormatValidator() + val pathToSchemasMap = validator.validate( + ValidationData( + IntJsonSchema.IntJsonSchema1.getInstance(), + 1.0f, + validationMetadata + ) + ) + assertNull(pathToSchemasMap) + } + + @Test + fun testIntFormatFailsWithFloat() { + val validator = FormatValidator() + assertFailsWith( + block = { + validator.validate( + ValidationData( + IntJsonSchema.IntJsonSchema1.getInstance(), + 3.14f, + validationMetadata + ) + ) + } + ) + } + + @Test + @Throws(ValidationException::class) + fun testIntFormatSucceedsWithInt() { + val validator = FormatValidator() + val pathToSchemasMap = validator.validate( + ValidationData( + IntJsonSchema.IntJsonSchema1.getInstance(), + 1, + validationMetadata + ) + ) + assertNull(pathToSchemasMap) + } + + @Test + fun testInt32UnderMinFails() { + val validator = FormatValidator() + assertFailsWith( + block = { + validator.validate( + ValidationData( + Int32JsonSchema.Int32JsonSchema1.getInstance(), + -2147483649L, + validationMetadata + ) + ) + } + ) + } + + @Test + @Throws(ValidationException::class) + fun testInt32InclusiveMinSucceeds() { + val validator = FormatValidator() + val pathToSchemasMap = validator.validate( + ValidationData( + Int32JsonSchema.Int32JsonSchema1.getInstance(), + -2147483648, + validationMetadata + ) + ) + assertNull(pathToSchemasMap) + } + + @Test + @Throws(ValidationException::class) + fun testInt32InclusiveMaxSucceeds() { + val validator = FormatValidator() + val pathToSchemasMap = validator.validate( + ValidationData( + Int32JsonSchema.Int32JsonSchema1.getInstance(), + 2147483647, + validationMetadata + ) + ) + assertNull(pathToSchemasMap) + } + + @Test + fun testInt32OverMaxFails() { + val validator = FormatValidator() + assertFailsWith( + block = { + validator.validate( + ValidationData( + Int32JsonSchema.Int32JsonSchema1.getInstance(), + 2147483648L, + validationMetadata + ) + ) + } + ) + } + + @Test + fun testInt64UnderMinFails() { + val validator = FormatValidator() + assertFailsWith( + block = { + validator.validate( + ValidationData( + Int64JsonSchema.Int64JsonSchema1.getInstance(), + BigInteger("-9223372036854775809"), + validationMetadata + ) + ) + } + ) + } + + @Test + @Throws(ValidationException::class) + fun testInt64InclusiveMinSucceeds() { + val validator = FormatValidator() + val pathToSchemasMap = validator.validate( + ValidationData( + Int64JsonSchema.Int64JsonSchema1.getInstance(), + Long.MIN_VALUE, + validationMetadata + ) + ) + assertNull(pathToSchemasMap) + } + + @Test + @Throws(ValidationException::class) + fun testInt64InclusiveMaxSucceeds() { + val validator = FormatValidator() + val pathToSchemasMap = validator.validate( + ValidationData( + Int64JsonSchema.Int64JsonSchema1.getInstance(), + 9223372036854775807L, + validationMetadata + ) + ) + assertNull(pathToSchemasMap) + } + + @Test + fun testInt64OverMaxFails() { + val validator = FormatValidator() + assertFailsWith( + block = { + validator.validate( + ValidationData( + Int64JsonSchema.Int64JsonSchema1.getInstance(), + BigInteger("9223372036854775808"), + validationMetadata + ) + ) + } + ) + } + + @Test + fun testFloatUnderMinFails() { + val validator = FormatValidator() + assertFailsWith( + block = { + validator.validate( + ValidationData( + FloatJsonSchema.FloatJsonSchema1.getInstance(), + -3.402823466385289e+38, + validationMetadata + ) + ) + } + ) + } + + @Test + @Throws(ValidationException::class) + fun testFloatInclusiveMinSucceeds() { + val validator = FormatValidator() + val pathToSchemasMap = validator.validate( + ValidationData( + FloatJsonSchema.FloatJsonSchema1.getInstance(), + Float.MIN_VALUE, + validationMetadata + ) + ) + assertNull(pathToSchemasMap) + } + + @Test + @Throws(ValidationException::class) + fun testFloatInclusiveMaxSucceeds() { + val validator = FormatValidator() + val pathToSchemasMap = validator.validate( + ValidationData( + FloatJsonSchema.FloatJsonSchema1.getInstance(), + Float.MAX_VALUE, + validationMetadata + ) + ) + assertNull(pathToSchemasMap) + } + + @Test + fun testFloatOverMaxFails() { + val validator = FormatValidator() + assertFailsWith( + block = { + validator.validate( + ValidationData( + FloatJsonSchema.FloatJsonSchema1.getInstance(), + 3.402823466385289e+38, + validationMetadata + ) + ) + } + ) + } + + @Test + fun testDoubleUnderMinFails() { + val validator = FormatValidator() + assertFailsWith( + block = { + validator.validate( + ValidationData( + DoubleJsonSchema.DoubleJsonSchema1.getInstance(), + BigDecimal("-1.7976931348623157082e+308"), + validationMetadata + ) + ) + } + ) + } + + @Test + @Throws(ValidationException::class) + fun testDoubleInclusiveMinSucceeds() { + val validator = FormatValidator() + val pathToSchemasMap = validator.validate( + ValidationData( + DoubleJsonSchema.DoubleJsonSchema1.getInstance(), + -1.7976931348623157E+308, + validationMetadata + ) + ) + assertNull(pathToSchemasMap) + } + + @Test + @Throws(ValidationException::class) + fun testDoubleInclusiveMaxSucceeds() { + val validator = FormatValidator() + val pathToSchemasMap = validator.validate( + ValidationData( + DoubleJsonSchema.DoubleJsonSchema1.getInstance(), + 1.7976931348623157E+308, + validationMetadata + ) + ) + assertNull(pathToSchemasMap) + } + + @Test + fun testDoubleOverMaxFails() { + val validator = FormatValidator() + assertFailsWith( + block = { + validator.validate( + ValidationData( + DoubleJsonSchema.DoubleJsonSchema1.getInstance(), + BigDecimal("1.7976931348623157082e+308"), + validationMetadata + ) + ) + } + ) + } + + @Test + fun testInvalidNumberStringFails() { + val validator = FormatValidator() + assertFailsWith( + block = { + validator.validate( + ValidationData( + DecimalJsonSchema.DecimalJsonSchema1.getInstance(), + "abc", + validationMetadata + ) + ) + } + ) + } + + @Test + @Throws(ValidationException::class) + fun testValidFloatNumberStringSucceeds() { + val validator = FormatValidator() + val pathToSchemasMap = validator.validate( + ValidationData( + DecimalJsonSchema.DecimalJsonSchema1.getInstance(), + "3.14", + validationMetadata + ) + ) + assertNull(pathToSchemasMap) + } + + @Test + @Throws(ValidationException::class) + fun testValidIntNumberStringSucceeds() { + val validator = FormatValidator() + val pathToSchemasMap = validator.validate( + ValidationData( + DecimalJsonSchema.DecimalJsonSchema1.getInstance(), + "1", + validationMetadata + ) + ) + assertNull(pathToSchemasMap) + } + + @Test + fun testInvalidDateStringFails() { + val validator = FormatValidator() + assertFailsWith( + block = { + validator.validate( + ValidationData( + DateJsonSchema.DateJsonSchema1.getInstance(), + "abc", + validationMetadata + ) + ) + } + ) + } + + @Test + @Throws(ValidationException::class) + fun testValidDateStringSucceeds() { + val validator = FormatValidator() + val pathToSchemasMap = validator.validate( + ValidationData( + DateJsonSchema.DateJsonSchema1.getInstance(), + "2017-01-20", + validationMetadata + ) + ) + assertNull(pathToSchemasMap) + } + + @Test + fun testInvalidDateTimeStringFails() { + val validator = FormatValidator() + assertFailsWith( + block = { + validator.validate( + ValidationData( + DateTimeJsonSchema.DateTimeJsonSchema1.getInstance(), + "abc", + validationMetadata + ) + ) + } + ) + } + + @Test + @Throws(ValidationException::class) + fun testValidDateTimeStringSucceeds() { + val validator = FormatValidator() + val pathToSchemasMap = validator.validate( + ValidationData( + DateTimeJsonSchema.DateTimeJsonSchema1.getInstance(), + "2017-07-21T17:32:28Z", + validationMetadata + ) + ) + assertNull(pathToSchemasMap) + } + + companion object { + val validationMetadata = ValidationMetadata( + ArrayList(), + SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()), + PathToSchemasMap(), + LinkedHashSet() + ) + } +} \ No newline at end of file diff --git a/samples/client/3_1_0_unit_test/kotlin/src/test/kotlin/org/openapijsonschematools/client/schemas/validation/ItemsValidatorTest.kt b/samples/client/3_1_0_unit_test/kotlin/src/test/kotlin/org/openapijsonschematools/client/schemas/validation/ItemsValidatorTest.kt new file mode 100644 index 00000000000..a6fd41ebbd8 --- /dev/null +++ b/samples/client/3_1_0_unit_test/kotlin/src/test/kotlin/org/openapijsonschematools/client/schemas/validation/ItemsValidatorTest.kt @@ -0,0 +1,120 @@ +package org.openapijsonschematools.client.schemas.validation + +import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags +import org.openapijsonschematools.client.configurations.SchemaConfiguration +import org.openapijsonschematools.client.schemas.StringJsonSchema +import org.openapijsonschematools.client.exceptions.ValidationException + +import kotlin.test.Test +import kotlin.test.assertEquals +import kotlin.test.assertFailsWith +import kotlin.test.assertNull + +class ItemsValidatorTest { + interface ArrayWithItemsSchemaBoxed + class ArrayWithItemsSchemaBoxedList : ArrayWithItemsSchemaBoxed + class ArrayWithItemsSchema : JsonSchema( + JsonSchemaInfo() + .type(setOf(List::class.java)) + .items(StringJsonSchema.StringJsonSchema1::class.java) + ) { + override fun getNewInstance(arg: Any?, pathToItem: List, pathToSchemas: PathToSchemasMap): Any? { + if (arg is List<*>) { + return getNewInstance(arg, pathToItem, pathToSchemas) + } + throw RuntimeException("Invalid input type=$javaClass. It can't be instantiated by this schema") + } + + @Throws(ValidationException::class) + override fun validate(arg: Any?, configuration: SchemaConfiguration?): Any? { + if (arg is List<*>) { + return validate(arg, configuration) + } + throw ValidationException("Invalid input type=$javaClass. It can't be validated by this schema") + } + + @Throws(ValidationException::class) + override fun validateAndBox(arg: Any?, configuration: SchemaConfiguration?): ArrayWithItemsSchemaBoxed { + return ArrayWithItemsSchemaBoxedList() + } + } + + @Test + @Throws(ValidationException::class) + fun testCorrectItemsSucceeds() { + val pathToItem = listOf("args[0]") + val validationMetadata = ValidationMetadata( + pathToItem, + SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()), + PathToSchemasMap(), + LinkedHashSet() + ) + val mutableList: MutableList = ArrayList() + mutableList.add("a") + val arg = FrozenList(mutableList) + val validator = ItemsValidator() + val pathToSchemas = validator.validate( + ValidationData( + ArrayWithItemsSchema(), + arg, + validationMetadata + ) + ) ?: throw RuntimeException("Invalid null value in pathToSchemas for this test case") + val expectedPathToItem: MutableList = ArrayList() + expectedPathToItem.add("args[0]") + expectedPathToItem.add(0) + val expectedClasses = LinkedHashMap, Nothing?>() + val schema = JsonSchemaFactory.getInstance(StringJsonSchema.StringJsonSchema1::class.java) + expectedClasses[schema] = null + val expectedPathToSchemas = PathToSchemasMap() + expectedPathToSchemas[expectedPathToItem] = expectedClasses + assertEquals(pathToSchemas, expectedPathToSchemas) + } + + @Test + @Throws(ValidationException::class) + fun testNotApplicableTypeReturnsNull() { + val pathToItem = listOf("args[0]") + val validationMetadata = ValidationMetadata( + pathToItem, + SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()), + PathToSchemasMap(), + LinkedHashSet() + ) + val validator = ItemsValidator() + val pathToSchemas = validator.validate( + ValidationData( + ArrayWithItemsSchema(), + 1, + validationMetadata + ) + ) + assertNull(pathToSchemas) + } + + @Test + fun testIncorrectItemFails() { + val pathToItem = listOf("args[0]") + val validationMetadata = ValidationMetadata( + pathToItem, + SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()), + PathToSchemasMap(), + LinkedHashSet() + ) + val mutableList: MutableList = ArrayList() + mutableList.add(1) + val arg = FrozenList(mutableList) + val validator = ItemsValidator() + assertFailsWith( + block = { + validator.validate( + ValidationData( + ArrayWithItemsSchema(), + arg, + validationMetadata + ) + ) + } + ) + } +} \ No newline at end of file diff --git a/samples/client/3_1_0_unit_test/kotlin/src/test/kotlin/org/openapijsonschematools/client/schemas/validation/JsonSchemaTest.kt b/samples/client/3_1_0_unit_test/kotlin/src/test/kotlin/org/openapijsonschematools/client/schemas/validation/JsonSchemaTest.kt new file mode 100644 index 00000000000..bad1daff26c --- /dev/null +++ b/samples/client/3_1_0_unit_test/kotlin/src/test/kotlin/org/openapijsonschematools/client/schemas/validation/JsonSchemaTest.kt @@ -0,0 +1,71 @@ +package org.openapijsonschematools.client.schemas.validation + +import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags +import org.openapijsonschematools.client.configurations.SchemaConfiguration +import org.openapijsonschematools.client.exceptions.ValidationException + +import kotlin.test.Test +import kotlin.test.assertEquals + +class JsonSchemaTest { + internal sealed interface SomeSchemaBoxed + internal class SomeSchemaBoxedString : SomeSchemaBoxed + internal class SomeSchema private constructor() : JsonSchema( + JsonSchemaInfo() + .type(setOf(String::class.java)) + ) { + override fun getNewInstance(arg: Any?, pathToItem: List, pathToSchemas: PathToSchemasMap): Any? { + if (arg is String) { + return arg + } + throw RuntimeException("Invalid input type=$javaClass. It can't be instantiated by this schema") + } + + @Throws(ValidationException::class) + override fun validate(arg: Any?, configuration: SchemaConfiguration?): Any? { + if (arg is String) { + return arg + } + throw ValidationException("Invalid input type=$javaClass. It can't be validated by this schema") + } + + @Throws(ValidationException::class) + override fun validateAndBox(arg: Any?, configuration: SchemaConfiguration?): SomeSchemaBoxed { + return SomeSchemaBoxedString() + } + + companion object { + var instance: SomeSchema? = null + get() { + if (field == null) { + field = SomeSchema() + } + return field + } + private set + } + } + + @Test + @Throws(ValidationException::class) + fun testValidateSucceeds() { + val pathToItem = listOf("args[0]") + val validationMetadata = ValidationMetadata( + pathToItem, + SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()), + PathToSchemasMap(), + LinkedHashSet() + ) + val schema = JsonSchemaFactory.getInstance(SomeSchema::class.java) + val pathToSchemas = JsonSchema.validate( + schema, + "hi", + validationMetadata + ) + val expectedPathToSchemas = PathToSchemasMap() + val validatedClasses = LinkedHashMap, Nothing?>() + validatedClasses[schema] = null + expectedPathToSchemas[pathToItem] = validatedClasses + assertEquals(pathToSchemas, expectedPathToSchemas) + } +} \ No newline at end of file diff --git a/samples/client/3_1_0_unit_test/kotlin/src/test/kotlin/org/openapijsonschematools/client/schemas/validation/PropertiesValidatorTest.kt b/samples/client/3_1_0_unit_test/kotlin/src/test/kotlin/org/openapijsonschematools/client/schemas/validation/PropertiesValidatorTest.kt new file mode 100644 index 00000000000..086c96448e6 --- /dev/null +++ b/samples/client/3_1_0_unit_test/kotlin/src/test/kotlin/org/openapijsonschematools/client/schemas/validation/PropertiesValidatorTest.kt @@ -0,0 +1,123 @@ +package org.openapijsonschematools.client.schemas.validation + +import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags +import org.openapijsonschematools.client.configurations.SchemaConfiguration +import org.openapijsonschematools.client.exceptions.ValidationException +import org.openapijsonschematools.client.schemas.StringJsonSchema + +import kotlin.test.Test +import kotlin.test.assertEquals +import kotlin.test.assertNull +import kotlin.test.assertFailsWith + +class PropertiesValidatorTest { + interface ObjectWithPropsSchemaBoxed + class ObjectWithPropsSchemaBoxedMap : ObjectWithPropsSchemaBoxed + class ObjectWithPropsSchema : JsonSchema( + JsonSchemaInfo() + .type(setOf(MutableMap::class.java)) + .properties( + mapOf( + "someString" to StringJsonSchema.StringJsonSchema1::class.java + ) + ) + ) { + override fun getNewInstance(arg: Any?, pathToItem: List, pathToSchemas: PathToSchemasMap): Any? { + if (arg is Map<*, *>) { + return getNewInstance(arg, pathToItem, pathToSchemas) + } + throw RuntimeException("Invalid input type=$javaClass. It can't be instantiated by this schema") + } + + @Throws(ValidationException::class) + override fun validate(arg: Any?, configuration: SchemaConfiguration?): Any? { + if (arg is Map<*, *>) { + return validate(arg, configuration) + } + throw ValidationException("Invalid input type=$javaClass. It can't be validated by this schema") + } + + @Throws(ValidationException::class) + override fun validateAndBox(arg: Any?, configuration: SchemaConfiguration?): ObjectWithPropsSchemaBoxed { + return ObjectWithPropsSchemaBoxedMap() + } + } + + @Test + @Throws(ValidationException::class) + fun testCorrectPropertySucceeds() { + val validator = PropertiesValidator() + val pathToItem = listOf("args[0]") + val validationMetadata = ValidationMetadata( + pathToItem, + SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()), + PathToSchemasMap(), + LinkedHashSet() + ) + val mutableMap = LinkedHashMap() + mutableMap["someString"] = "abc" + val arg = FrozenMap(mutableMap) + val pathToSchemas = validator.validate( + ValidationData( + ObjectWithPropsSchema(), + arg, + validationMetadata + ) + ) ?: throw RuntimeException("Invalid null value for pathToSchemas for this test case") + val expectedPathToItem: MutableList = ArrayList() + expectedPathToItem.add("args[0]") + expectedPathToItem.add("someString") + val expectedClasses = LinkedHashMap, Nothing?>() + expectedClasses[JsonSchemaFactory.getInstance(StringJsonSchema.StringJsonSchema1::class.java)] = null + val expectedPathToSchemas = PathToSchemasMap() + expectedPathToSchemas[expectedPathToItem] = expectedClasses + assertEquals(pathToSchemas, expectedPathToSchemas) + } + + @Test + @Throws(ValidationException::class) + fun testNotApplicableTypeReturnsNull() { + val validator = PropertiesValidator() + val pathToItem = listOf("args[0]") + val validationMetadata = ValidationMetadata( + pathToItem, + SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()), + PathToSchemasMap(), + LinkedHashSet() + ) + val pathToSchemas = validator.validate( + ValidationData( + ObjectWithPropsSchema(), + 1, + validationMetadata + ) + ) + assertNull(pathToSchemas) + } + + @Test + fun testIncorrectPropertyValueFails() { + val validator = PropertiesValidator() + val pathToItem = listOf("args[0]") + val validationMetadata = ValidationMetadata( + pathToItem, + SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()), + PathToSchemasMap(), + LinkedHashSet() + ) + val mutableMap = LinkedHashMap() + mutableMap["someString"] = 1 + val arg = FrozenMap(mutableMap) + assertFailsWith( + block = { + validator.validate( + ValidationData( + ObjectWithPropsSchema(), + arg, + validationMetadata + ) + ) + } + ) + } +} \ No newline at end of file diff --git a/samples/client/3_1_0_unit_test/kotlin/src/test/kotlin/org/openapijsonschematools/client/schemas/validation/RequiredValidatorTest.kt b/samples/client/3_1_0_unit_test/kotlin/src/test/kotlin/org/openapijsonschematools/client/schemas/validation/RequiredValidatorTest.kt new file mode 100644 index 00000000000..ba7af366540 --- /dev/null +++ b/samples/client/3_1_0_unit_test/kotlin/src/test/kotlin/org/openapijsonschematools/client/schemas/validation/RequiredValidatorTest.kt @@ -0,0 +1,110 @@ +package org.openapijsonschematools.client.schemas.validation + +import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags +import org.openapijsonschematools.client.configurations.SchemaConfiguration +import org.openapijsonschematools.client.exceptions.ValidationException + +import kotlin.test.Test +import kotlin.test.assertFailsWith +import kotlin.test.assertNull + +class RequiredValidatorTest { + interface ObjectWithRequiredSchemaBoxed + class ObjectWithRequiredSchemaBoxedMap : ObjectWithRequiredSchemaBoxed + class ObjectWithRequiredSchema : JsonSchema( + JsonSchemaInfo() + .type(setOf(Map::class.java)) + .required(setOf("someString")) + ) { + override fun getNewInstance(arg: Any?, pathToItem: List, pathToSchemas: PathToSchemasMap): Any? { + if (arg is Map<*, *>) { + return getNewInstance(arg, pathToItem, pathToSchemas) + } + throw RuntimeException("Invalid input type=$javaClass. It can't be instantiated by this schema") + } + + @Throws(ValidationException::class) + override fun validate(arg: Any?, configuration: SchemaConfiguration?): Any? { + if (arg is Map<*, *>) { + return validate(arg, configuration) + } + throw ValidationException("Invalid input type=$javaClass. It can't be validated by this schema") + } + + @Throws(ValidationException::class) + override fun validateAndBox(arg: Any?, configuration: SchemaConfiguration?): ObjectWithRequiredSchemaBoxed { + return ObjectWithRequiredSchemaBoxedMap() + } + } + + @Test + @Throws(ValidationException::class) + fun testCorrectPropertySucceeds() { + val pathToItem = listOf("args[0]") + val validationMetadata = ValidationMetadata( + pathToItem, + SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()), + PathToSchemasMap(), + LinkedHashSet() + ) + val mutableMap = LinkedHashMap() + mutableMap["someString"] = "abc" + val arg = FrozenMap(mutableMap) + val validator = RequiredValidator() + val pathToSchemas = validator.validate( + ValidationData( + ObjectWithRequiredSchema(), + arg, + validationMetadata + ) + ) + assertNull(pathToSchemas) + } + + @Test + @Throws(ValidationException::class) + fun testNotApplicableTypeReturnsNull() { + val pathToItem = listOf("args[0]") + val validationMetadata = ValidationMetadata( + pathToItem, + SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()), + PathToSchemasMap(), + LinkedHashSet() + ) + val validator = RequiredValidator() + val pathToSchemas = validator.validate( + ValidationData( + ObjectWithRequiredSchema(), + 1, + validationMetadata + ) + ) + assertNull(pathToSchemas) + } + + @Test + fun testIncorrectPropertyFails() { + val pathToItem = listOf("args[0]") + val validationMetadata = ValidationMetadata( + pathToItem, + SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()), + PathToSchemasMap(), + LinkedHashSet() + ) + val mutableMap = LinkedHashMap() + mutableMap["aDifferentProp"] = 1 + val arg = FrozenMap(mutableMap) + val validator = RequiredValidator() + assertFailsWith( + block = { + validator.validate( + ValidationData( + ObjectWithRequiredSchema(), + arg, + validationMetadata + ) + ) + } + ) + } +} \ No newline at end of file diff --git a/samples/client/3_1_0_unit_test/kotlin/src/test/kotlin/org/openapijsonschematools/client/schemas/validation/TypeValidatorTest.kt b/samples/client/3_1_0_unit_test/kotlin/src/test/kotlin/org/openapijsonschematools/client/schemas/validation/TypeValidatorTest.kt new file mode 100644 index 00000000000..c8049c76683 --- /dev/null +++ b/samples/client/3_1_0_unit_test/kotlin/src/test/kotlin/org/openapijsonschematools/client/schemas/validation/TypeValidatorTest.kt @@ -0,0 +1,54 @@ +package org.openapijsonschematools.client.schemas.validation + +import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags +import org.openapijsonschematools.client.configurations.SchemaConfiguration +import org.openapijsonschematools.client.exceptions.ValidationException +import org.openapijsonschematools.client.schemas.StringJsonSchema + +import kotlin.test.Test +import kotlin.test.assertFailsWith +import kotlin.test.assertNull + +class TypeValidatorTest { + @Test + @Throws(ValidationException::class) + fun testValidateSucceeds() { + val validator = TypeValidator() + val validationMetadata = ValidationMetadata( + ArrayList(), + SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()), + PathToSchemasMap(), + LinkedHashSet() + ) + val pathToSchemasMap = validator.validate( + ValidationData( + StringJsonSchema.StringJsonSchema1.getInstance(), + "hi", + validationMetadata + ) + ) + assertNull(pathToSchemasMap) + } + + @Test + fun testValidateFailsIntIsNotString() { + val validator = TypeValidator() + val validationMetadata = ValidationMetadata( + ArrayList(), + SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()), + PathToSchemasMap(), + LinkedHashSet() + ) + assertFailsWith( + block = { + validator.validate( + ValidationData( + StringJsonSchema.StringJsonSchema1.getInstance(), + 1, + validationMetadata + ) + ) + } + ) + } +} \ No newline at end of file From d25216e0feb56212079675a507455990ae32a483 Mon Sep 17 00:00:00 2001 From: Justin Black Date: Fri, 17 May 2024 15:52:56 -0700 Subject: [PATCH 61/78] Updates dependentSchemas --- .../kotlin/.openapi-generator/FILES | 144 ------------------ ...chemasDependenciesWithEscapedCharacters.md | 2 +- ...sDependentSubschemaIncompatibleWithRoot.md | 2 +- .../DependentSchemasSingleDependency.md | 2 +- ...chemasDependenciesWithEscapedCharacters.kt | 4 +- ...sDependentSubschemaIncompatibleWithRoot.kt | 2 +- .../DependentSchemasSingleDependency.kt | 2 +- .../schemas/SchemaClass/_dependentSchemas.hbs | 12 +- 8 files changed, 13 insertions(+), 157 deletions(-) diff --git a/samples/client/3_1_0_unit_test/kotlin/.openapi-generator/FILES b/samples/client/3_1_0_unit_test/kotlin/.openapi-generator/FILES index 912c4bdd6f4..3404045da66 100644 --- a/samples/client/3_1_0_unit_test/kotlin/.openapi-generator/FILES +++ b/samples/client/3_1_0_unit_test/kotlin/.openapi-generator/FILES @@ -1,5 +1,4 @@ .gitignore -.openapi-generator-ignore README.md build.gradle.kts docs/RootServerInfo.md @@ -396,149 +395,6 @@ src/main/kotlin/org/openapijsonschematools/client/servers/Server.kt src/main/kotlin/org/openapijsonschematools/client/servers/ServerProvider.kt src/main/kotlin/org/openapijsonschematools/client/servers/ServerWithVariables.kt src/main/kotlin/org/openapijsonschematools/client/servers/ServerWithoutVariables.kt -src/test/kotlin/org/openapijsonschematools/client/components/schemas/ASchemaGivenForPrefixitemsTest.kt -src/test/kotlin/org/openapijsonschematools/client/components/schemas/AdditionalItemsAreAllowedByDefaultTest.kt -src/test/kotlin/org/openapijsonschematools/client/components/schemas/AdditionalpropertiesAreAllowedByDefaultTest.kt -src/test/kotlin/org/openapijsonschematools/client/components/schemas/AdditionalpropertiesCanExistByItselfTest.kt -src/test/kotlin/org/openapijsonschematools/client/components/schemas/AdditionalpropertiesDoesNotLookInApplicatorsTest.kt -src/test/kotlin/org/openapijsonschematools/client/components/schemas/AdditionalpropertiesWithNullValuedInstancePropertiesTest.kt -src/test/kotlin/org/openapijsonschematools/client/components/schemas/AdditionalpropertiesWithSchemaTest.kt -src/test/kotlin/org/openapijsonschematools/client/components/schemas/AllofCombinedWithAnyofOneofTest.kt -src/test/kotlin/org/openapijsonschematools/client/components/schemas/AllofSimpleTypesTest.kt -src/test/kotlin/org/openapijsonschematools/client/components/schemas/AllofTest.kt -src/test/kotlin/org/openapijsonschematools/client/components/schemas/AllofWithBaseSchemaTest.kt -src/test/kotlin/org/openapijsonschematools/client/components/schemas/AllofWithOneEmptySchemaTest.kt -src/test/kotlin/org/openapijsonschematools/client/components/schemas/AllofWithTheFirstEmptySchemaTest.kt -src/test/kotlin/org/openapijsonschematools/client/components/schemas/AllofWithTheLastEmptySchemaTest.kt -src/test/kotlin/org/openapijsonschematools/client/components/schemas/AllofWithTwoEmptySchemasTest.kt -src/test/kotlin/org/openapijsonschematools/client/components/schemas/AnyofComplexTypesTest.kt -src/test/kotlin/org/openapijsonschematools/client/components/schemas/AnyofTest.kt -src/test/kotlin/org/openapijsonschematools/client/components/schemas/AnyofWithBaseSchemaTest.kt -src/test/kotlin/org/openapijsonschematools/client/components/schemas/AnyofWithOneEmptySchemaTest.kt -src/test/kotlin/org/openapijsonschematools/client/components/schemas/ArrayTypeMatchesArraysTest.kt -src/test/kotlin/org/openapijsonschematools/client/components/schemas/BooleanTypeMatchesBooleansTest.kt -src/test/kotlin/org/openapijsonschematools/client/components/schemas/ByIntTest.kt -src/test/kotlin/org/openapijsonschematools/client/components/schemas/ByNumberTest.kt -src/test/kotlin/org/openapijsonschematools/client/components/schemas/BySmallNumberTest.kt -src/test/kotlin/org/openapijsonschematools/client/components/schemas/ConstNulCharactersInStringsTest.kt -src/test/kotlin/org/openapijsonschematools/client/components/schemas/ContainsKeywordValidationTest.kt -src/test/kotlin/org/openapijsonschematools/client/components/schemas/ContainsWithNullInstanceElementsTest.kt -src/test/kotlin/org/openapijsonschematools/client/components/schemas/DateFormatTest.kt -src/test/kotlin/org/openapijsonschematools/client/components/schemas/DateTimeFormatTest.kt -src/test/kotlin/org/openapijsonschematools/client/components/schemas/DependentSchemasDependenciesWithEscapedCharactersTest.kt -src/test/kotlin/org/openapijsonschematools/client/components/schemas/DependentSchemasDependentSubschemaIncompatibleWithRootTest.kt -src/test/kotlin/org/openapijsonschematools/client/components/schemas/DependentSchemasSingleDependencyTest.kt -src/test/kotlin/org/openapijsonschematools/client/components/schemas/DurationFormatTest.kt -src/test/kotlin/org/openapijsonschematools/client/components/schemas/EmailFormatTest.kt -src/test/kotlin/org/openapijsonschematools/client/components/schemas/EmptyDependentsTest.kt -src/test/kotlin/org/openapijsonschematools/client/components/schemas/EnumWith0DoesNotMatchFalseTest.kt -src/test/kotlin/org/openapijsonschematools/client/components/schemas/EnumWith1DoesNotMatchTrueTest.kt -src/test/kotlin/org/openapijsonschematools/client/components/schemas/EnumWithEscapedCharactersTest.kt -src/test/kotlin/org/openapijsonschematools/client/components/schemas/EnumWithFalseDoesNotMatch0Test.kt -src/test/kotlin/org/openapijsonschematools/client/components/schemas/EnumWithTrueDoesNotMatch1Test.kt -src/test/kotlin/org/openapijsonschematools/client/components/schemas/EnumsInPropertiesTest.kt -src/test/kotlin/org/openapijsonschematools/client/components/schemas/ExclusivemaximumValidationTest.kt -src/test/kotlin/org/openapijsonschematools/client/components/schemas/ExclusiveminimumValidationTest.kt -src/test/kotlin/org/openapijsonschematools/client/components/schemas/FloatDivisionInfTest.kt -src/test/kotlin/org/openapijsonschematools/client/components/schemas/ForbiddenPropertyTest.kt -src/test/kotlin/org/openapijsonschematools/client/components/schemas/HostnameFormatTest.kt -src/test/kotlin/org/openapijsonschematools/client/components/schemas/IdnEmailFormatTest.kt -src/test/kotlin/org/openapijsonschematools/client/components/schemas/IdnHostnameFormatTest.kt -src/test/kotlin/org/openapijsonschematools/client/components/schemas/IfAndElseWithoutThenTest.kt -src/test/kotlin/org/openapijsonschematools/client/components/schemas/IfAndThenWithoutElseTest.kt -src/test/kotlin/org/openapijsonschematools/client/components/schemas/IfAppearsAtTheEndWhenSerializedKeywordProcessingSequenceTest.kt -src/test/kotlin/org/openapijsonschematools/client/components/schemas/IgnoreElseWithoutIfTest.kt -src/test/kotlin/org/openapijsonschematools/client/components/schemas/IgnoreIfWithoutThenOrElseTest.kt -src/test/kotlin/org/openapijsonschematools/client/components/schemas/IgnoreThenWithoutIfTest.kt -src/test/kotlin/org/openapijsonschematools/client/components/schemas/IntegerTypeMatchesIntegersTest.kt -src/test/kotlin/org/openapijsonschematools/client/components/schemas/Ipv4FormatTest.kt -src/test/kotlin/org/openapijsonschematools/client/components/schemas/Ipv6FormatTest.kt -src/test/kotlin/org/openapijsonschematools/client/components/schemas/IriFormatTest.kt -src/test/kotlin/org/openapijsonschematools/client/components/schemas/IriReferenceFormatTest.kt -src/test/kotlin/org/openapijsonschematools/client/components/schemas/ItemsContainsTest.kt -src/test/kotlin/org/openapijsonschematools/client/components/schemas/ItemsDoesNotLookInApplicatorsValidCaseTest.kt -src/test/kotlin/org/openapijsonschematools/client/components/schemas/ItemsWithNullInstanceElementsTest.kt -src/test/kotlin/org/openapijsonschematools/client/components/schemas/JsonPointerFormatTest.kt -src/test/kotlin/org/openapijsonschematools/client/components/schemas/MaxcontainsWithoutContainsIsIgnoredTest.kt -src/test/kotlin/org/openapijsonschematools/client/components/schemas/MaximumValidationTest.kt -src/test/kotlin/org/openapijsonschematools/client/components/schemas/MaximumValidationWithUnsignedIntegerTest.kt -src/test/kotlin/org/openapijsonschematools/client/components/schemas/MaxitemsValidationTest.kt -src/test/kotlin/org/openapijsonschematools/client/components/schemas/MaxlengthValidationTest.kt -src/test/kotlin/org/openapijsonschematools/client/components/schemas/Maxproperties0MeansTheObjectIsEmptyTest.kt -src/test/kotlin/org/openapijsonschematools/client/components/schemas/MaxpropertiesValidationTest.kt -src/test/kotlin/org/openapijsonschematools/client/components/schemas/MincontainsWithoutContainsIsIgnoredTest.kt -src/test/kotlin/org/openapijsonschematools/client/components/schemas/MinimumValidationTest.kt -src/test/kotlin/org/openapijsonschematools/client/components/schemas/MinimumValidationWithSignedIntegerTest.kt -src/test/kotlin/org/openapijsonschematools/client/components/schemas/MinitemsValidationTest.kt -src/test/kotlin/org/openapijsonschematools/client/components/schemas/MinlengthValidationTest.kt -src/test/kotlin/org/openapijsonschematools/client/components/schemas/MinpropertiesValidationTest.kt -src/test/kotlin/org/openapijsonschematools/client/components/schemas/MultipleDependentsRequiredTest.kt -src/test/kotlin/org/openapijsonschematools/client/components/schemas/MultipleSimultaneousPatternpropertiesAreValidatedTest.kt -src/test/kotlin/org/openapijsonschematools/client/components/schemas/MultipleTypesCanBeSpecifiedInAnArrayTest.kt -src/test/kotlin/org/openapijsonschematools/client/components/schemas/NestedAllofToCheckValidationSemanticsTest.kt -src/test/kotlin/org/openapijsonschematools/client/components/schemas/NestedAnyofToCheckValidationSemanticsTest.kt -src/test/kotlin/org/openapijsonschematools/client/components/schemas/NestedItemsTest.kt -src/test/kotlin/org/openapijsonschematools/client/components/schemas/NestedOneofToCheckValidationSemanticsTest.kt -src/test/kotlin/org/openapijsonschematools/client/components/schemas/NonAsciiPatternWithAdditionalpropertiesTest.kt -src/test/kotlin/org/openapijsonschematools/client/components/schemas/NonInterferenceAcrossCombinedSchemasTest.kt -src/test/kotlin/org/openapijsonschematools/client/components/schemas/NotMoreComplexSchemaTest.kt -src/test/kotlin/org/openapijsonschematools/client/components/schemas/NotMultipleTypesTest.kt -src/test/kotlin/org/openapijsonschematools/client/components/schemas/NotTest.kt -src/test/kotlin/org/openapijsonschematools/client/components/schemas/NulCharactersInStringsTest.kt -src/test/kotlin/org/openapijsonschematools/client/components/schemas/NullTypeMatchesOnlyTheNullObjectTest.kt -src/test/kotlin/org/openapijsonschematools/client/components/schemas/NumberTypeMatchesNumbersTest.kt -src/test/kotlin/org/openapijsonschematools/client/components/schemas/ObjectPropertiesValidationTest.kt -src/test/kotlin/org/openapijsonschematools/client/components/schemas/ObjectTypeMatchesObjectsTest.kt -src/test/kotlin/org/openapijsonschematools/client/components/schemas/OneofComplexTypesTest.kt -src/test/kotlin/org/openapijsonschematools/client/components/schemas/OneofTest.kt -src/test/kotlin/org/openapijsonschematools/client/components/schemas/OneofWithBaseSchemaTest.kt -src/test/kotlin/org/openapijsonschematools/client/components/schemas/OneofWithEmptySchemaTest.kt -src/test/kotlin/org/openapijsonschematools/client/components/schemas/OneofWithRequiredTest.kt -src/test/kotlin/org/openapijsonschematools/client/components/schemas/PatternIsNotAnchoredTest.kt -src/test/kotlin/org/openapijsonschematools/client/components/schemas/PatternValidationTest.kt -src/test/kotlin/org/openapijsonschematools/client/components/schemas/PatternpropertiesValidatesPropertiesMatchingARegexTest.kt -src/test/kotlin/org/openapijsonschematools/client/components/schemas/PatternpropertiesWithNullValuedInstancePropertiesTest.kt -src/test/kotlin/org/openapijsonschematools/client/components/schemas/PrefixitemsValidationAdjustsTheStartingIndexForItemsTest.kt -src/test/kotlin/org/openapijsonschematools/client/components/schemas/PrefixitemsWithNullInstanceElementsTest.kt -src/test/kotlin/org/openapijsonschematools/client/components/schemas/PropertiesPatternpropertiesAdditionalpropertiesInteractionTest.kt -src/test/kotlin/org/openapijsonschematools/client/components/schemas/PropertiesWhoseNamesAreJavascriptObjectPropertyNamesTest.kt -src/test/kotlin/org/openapijsonschematools/client/components/schemas/PropertiesWithEscapedCharactersTest.kt -src/test/kotlin/org/openapijsonschematools/client/components/schemas/PropertiesWithNullValuedInstancePropertiesTest.kt -src/test/kotlin/org/openapijsonschematools/client/components/schemas/PropertyNamedRefThatIsNotAReferenceTest.kt -src/test/kotlin/org/openapijsonschematools/client/components/schemas/PropertynamesValidationTest.kt -src/test/kotlin/org/openapijsonschematools/client/components/schemas/RegexFormatTest.kt -src/test/kotlin/org/openapijsonschematools/client/components/schemas/RegexesAreNotAnchoredByDefaultAndAreCaseSensitiveTest.kt -src/test/kotlin/org/openapijsonschematools/client/components/schemas/RelativeJsonPointerFormatTest.kt -src/test/kotlin/org/openapijsonschematools/client/components/schemas/RequiredDefaultValidationTest.kt -src/test/kotlin/org/openapijsonschematools/client/components/schemas/RequiredPropertiesWhoseNamesAreJavascriptObjectPropertyNamesTest.kt -src/test/kotlin/org/openapijsonschematools/client/components/schemas/RequiredValidationTest.kt -src/test/kotlin/org/openapijsonschematools/client/components/schemas/RequiredWithEmptyArrayTest.kt -src/test/kotlin/org/openapijsonschematools/client/components/schemas/RequiredWithEscapedCharactersTest.kt -src/test/kotlin/org/openapijsonschematools/client/components/schemas/SimpleEnumValidationTest.kt -src/test/kotlin/org/openapijsonschematools/client/components/schemas/SingleDependencyTest.kt -src/test/kotlin/org/openapijsonschematools/client/components/schemas/SmallMultipleOfLargeIntegerTest.kt -src/test/kotlin/org/openapijsonschematools/client/components/schemas/StringTypeMatchesStringsTest.kt -src/test/kotlin/org/openapijsonschematools/client/components/schemas/TimeFormatTest.kt -src/test/kotlin/org/openapijsonschematools/client/components/schemas/TypeArrayObjectOrNullTest.kt -src/test/kotlin/org/openapijsonschematools/client/components/schemas/TypeArrayOrObjectTest.kt -src/test/kotlin/org/openapijsonschematools/client/components/schemas/TypeAsArrayWithOneItemTest.kt -src/test/kotlin/org/openapijsonschematools/client/components/schemas/UnevaluateditemsAsSchemaTest.kt -src/test/kotlin/org/openapijsonschematools/client/components/schemas/UnevaluateditemsDependsOnMultipleNestedContainsTest.kt -src/test/kotlin/org/openapijsonschematools/client/components/schemas/UnevaluateditemsWithItemsTest.kt -src/test/kotlin/org/openapijsonschematools/client/components/schemas/UnevaluateditemsWithNullInstanceElementsTest.kt -src/test/kotlin/org/openapijsonschematools/client/components/schemas/UnevaluatedpropertiesNotAffectedByPropertynamesTest.kt -src/test/kotlin/org/openapijsonschematools/client/components/schemas/UnevaluatedpropertiesSchemaTest.kt -src/test/kotlin/org/openapijsonschematools/client/components/schemas/UnevaluatedpropertiesWithAdjacentAdditionalpropertiesTest.kt -src/test/kotlin/org/openapijsonschematools/client/components/schemas/UnevaluatedpropertiesWithNullValuedInstancePropertiesTest.kt -src/test/kotlin/org/openapijsonschematools/client/components/schemas/UniqueitemsFalseValidationTest.kt -src/test/kotlin/org/openapijsonschematools/client/components/schemas/UniqueitemsFalseWithAnArrayOfItemsTest.kt -src/test/kotlin/org/openapijsonschematools/client/components/schemas/UniqueitemsValidationTest.kt -src/test/kotlin/org/openapijsonschematools/client/components/schemas/UniqueitemsWithAnArrayOfItemsTest.kt -src/test/kotlin/org/openapijsonschematools/client/components/schemas/UriFormatTest.kt -src/test/kotlin/org/openapijsonschematools/client/components/schemas/UriReferenceFormatTest.kt -src/test/kotlin/org/openapijsonschematools/client/components/schemas/UriTemplateFormatTest.kt -src/test/kotlin/org/openapijsonschematools/client/components/schemas/UuidFormatTest.kt -src/test/kotlin/org/openapijsonschematools/client/components/schemas/ValidateAgainstCorrectBranchThenVsElseTest.kt src/test/kotlin/org/openapijsonschematools/client/configurations/JsonSchemaKeywordFlagsTest.kt src/test/kotlin/org/openapijsonschematools/client/schemas/AnyTypeSchemaTest.kt src/test/kotlin/org/openapijsonschematools/client/schemas/ArrayTypeSchemaTest.kt diff --git a/samples/client/3_1_0_unit_test/kotlin/docs/components/schemas/DependentSchemasDependenciesWithEscapedCharacters.md b/samples/client/3_1_0_unit_test/kotlin/docs/components/schemas/DependentSchemasDependenciesWithEscapedCharacters.md index db1d3bbf5a6..1a95be1b214 100644 --- a/samples/client/3_1_0_unit_test/kotlin/docs/components/schemas/DependentSchemasDependenciesWithEscapedCharacters.md +++ b/samples/client/3_1_0_unit_test/kotlin/docs/components/schemas/DependentSchemasDependenciesWithEscapedCharacters.md @@ -162,7 +162,7 @@ A schema class that validates payloads ### Field Summary | Modifier and Type | Field and Description | | ----------------- | ---------------------- | -| Map> | dependentSchemas = mapOf(
        new PropertyEntry("foo\tbar", [Footbar::class.java](#footbar))),
        new PropertyEntry("foo'bar", [Foobar::class.java](#foobar)))
    )
    | +| Map> | dependentSchemas = mapOf(
        "foo\tbar" to [Footbar::class.java](#footbar)),
        "foo'bar" to [Foobar::class.java](#foobar))
    )
    | ### Method Summary | Modifier and Type | Method and Description | diff --git a/samples/client/3_1_0_unit_test/kotlin/docs/components/schemas/DependentSchemasDependentSubschemaIncompatibleWithRoot.md b/samples/client/3_1_0_unit_test/kotlin/docs/components/schemas/DependentSchemasDependentSubschemaIncompatibleWithRoot.md index 29ad51535c7..55306653ed8 100644 --- a/samples/client/3_1_0_unit_test/kotlin/docs/components/schemas/DependentSchemasDependentSubschemaIncompatibleWithRoot.md +++ b/samples/client/3_1_0_unit_test/kotlin/docs/components/schemas/DependentSchemasDependentSubschemaIncompatibleWithRoot.md @@ -176,7 +176,7 @@ A schema class that validates payloads | Modifier and Type | Field and Description | | ----------------- | ---------------------- | | Map> | properties = mapOf(
        "foo" to [Foo::class.java](#foo))
    )
    | -| Map> | dependentSchemas = mapOf(
        new PropertyEntry("foo", [Foo1::class.java](#foo1)))
    )
    | +| Map> | dependentSchemas = mapOf(
        "foo" to [Foo1::class.java](#foo1))
    )
    | ### Method Summary | Modifier and Type | Method and Description | diff --git a/samples/client/3_1_0_unit_test/kotlin/docs/components/schemas/DependentSchemasSingleDependency.md b/samples/client/3_1_0_unit_test/kotlin/docs/components/schemas/DependentSchemasSingleDependency.md index e1ed3a44dab..f62f019fbb4 100644 --- a/samples/client/3_1_0_unit_test/kotlin/docs/components/schemas/DependentSchemasSingleDependency.md +++ b/samples/client/3_1_0_unit_test/kotlin/docs/components/schemas/DependentSchemasSingleDependency.md @@ -160,7 +160,7 @@ A schema class that validates payloads ### Field Summary | Modifier and Type | Field and Description | | ----------------- | ---------------------- | -| Map> | dependentSchemas = mapOf(
        new PropertyEntry("bar", [Bar::class.java](#bar)))
    )
    | +| Map> | dependentSchemas = mapOf(
        "bar" to [Bar::class.java](#bar))
    )
    | ### Method Summary | Modifier and Type | Method and Description | diff --git a/samples/client/3_1_0_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/schemas/DependentSchemasDependenciesWithEscapedCharacters.kt b/samples/client/3_1_0_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/schemas/DependentSchemasDependenciesWithEscapedCharacters.kt index cd210cde149..34e86b1b5d4 100644 --- a/samples/client/3_1_0_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/schemas/DependentSchemasDependenciesWithEscapedCharacters.kt +++ b/samples/client/3_1_0_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/schemas/DependentSchemasDependenciesWithEscapedCharacters.kt @@ -733,8 +733,8 @@ class DependentSchemasDependenciesWithEscapedCharacters { class DependentSchemasDependenciesWithEscapedCharacters1 private constructor(): JsonSchema( JsonSchemaInfo() .dependentSchemas(mapOf( - new PropertyEntry("foo\tbar", Footbar::class.java), - new PropertyEntry("foo'bar", Foobar::class.java) + "foo\tbar" to Footbar::class.java, + "foo'bar" to Foobar::class.java )) ), NullSchemaValidator, BooleanSchemaValidator, NumberSchemaValidator, StringSchemaValidator, ListSchemaValidator, DependentSchemasDependenciesWithEscapedCharacters1BoxedList>, MapSchemaValidator, DependentSchemasDependenciesWithEscapedCharacters1BoxedMap> { /* diff --git a/samples/client/3_1_0_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/schemas/DependentSchemasDependentSubschemaIncompatibleWithRoot.kt b/samples/client/3_1_0_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/schemas/DependentSchemasDependentSubschemaIncompatibleWithRoot.kt index 6ffb6b956c2..2cf4eae5685 100644 --- a/samples/client/3_1_0_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/schemas/DependentSchemasDependentSubschemaIncompatibleWithRoot.kt +++ b/samples/client/3_1_0_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/schemas/DependentSchemasDependentSubschemaIncompatibleWithRoot.kt @@ -414,7 +414,7 @@ class DependentSchemasDependentSubschemaIncompatibleWithRoot { "foo" to Foo::class.java )) .dependentSchemas(mapOf( - new PropertyEntry("foo", Foo1::class.java) + "foo" to Foo1::class.java )) ), NullSchemaValidator, BooleanSchemaValidator, NumberSchemaValidator, StringSchemaValidator, ListSchemaValidator, DependentSchemasDependentSubschemaIncompatibleWithRoot1BoxedList>, MapSchemaValidator { /* diff --git a/samples/client/3_1_0_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/schemas/DependentSchemasSingleDependency.kt b/samples/client/3_1_0_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/schemas/DependentSchemasSingleDependency.kt index 3c8361fe061..182091869f6 100644 --- a/samples/client/3_1_0_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/schemas/DependentSchemasSingleDependency.kt +++ b/samples/client/3_1_0_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/schemas/DependentSchemasSingleDependency.kt @@ -506,7 +506,7 @@ class DependentSchemasSingleDependency { class DependentSchemasSingleDependency1 private constructor(): JsonSchema( JsonSchemaInfo() .dependentSchemas(mapOf( - new PropertyEntry("bar", Bar::class.java) + "bar" to Bar::class.java )) ), NullSchemaValidator, BooleanSchemaValidator, NumberSchemaValidator, StringSchemaValidator, ListSchemaValidator, DependentSchemasSingleDependency1BoxedList>, MapSchemaValidator, DependentSchemasSingleDependency1BoxedMap> { /* diff --git a/src/main/resources/kotlin/src/main/kotlin/packagename/components/schemas/SchemaClass/_dependentSchemas.hbs b/src/main/resources/kotlin/src/main/kotlin/packagename/components/schemas/SchemaClass/_dependentSchemas.hbs index 5a4696c388e..e86ee0ca64b 100644 --- a/src/main/resources/kotlin/src/main/kotlin/packagename/components/schemas/SchemaClass/_dependentSchemas.hbs +++ b/src/main/resources/kotlin/src/main/kotlin/packagename/components/schemas/SchemaClass/_dependentSchemas.hbs @@ -3,12 +3,12 @@ dependentSchemas = mapOf(
    {{~#each dependentSchemas}} {{#if refInfo.refClass}} {{#if refInfo.refModule}} -    new PropertyEntry("{{{@key.original}}}", [{{refInfo.refModule}}.{{refInfo.refClass}}::class.java]({{docRoot}}{{refInfo.ref.pathFromDocRoot}}.md#{{refInfo.ref.jsonPathPiece.kebabCase}})){{#unless @last}},{{/unless}}
    +    "{{{@key.original}}}" to [{{refInfo.refModule}}.{{refInfo.refClass}}::class.java]({{docRoot}}{{refInfo.ref.pathFromDocRoot}}.md#{{refInfo.ref.jsonPathPiece.kebabCase}}){{#unless @last}},{{/unless}}
    {{~else}} -    new PropertyEntry("{{{@key.original}}}", [{{refInfo.refClass}}::class.java](#{{refInfo.ref.jsonPathPiece.kebabCase}}))){{#unless @last}},{{/unless}}
    +    "{{{@key.original}}}" to [{{refInfo.refClass}}::class.java](#{{refInfo.ref.jsonPathPiece.kebabCase}})){{#unless @last}},{{/unless}}
    {{~/if}} {{else}} -    new PropertyEntry("{{{@key.original}}}", [{{jsonPathPiece.pascalCase}}::class.java](#{{jsonPathPiece.kebabCase}}))){{#unless @last}},{{/unless}}
    +    "{{{@key.original}}}" to [{{jsonPathPiece.pascalCase}}::class.java](#{{jsonPathPiece.kebabCase}})){{#unless @last}},{{/unless}}
    {{~/if}} {{/each}} )
    @@ -17,12 +17,12 @@ dependentSchemas = mapOf(
    {{#each dependentSchemas}} {{#if refInfo.refClass}} {{#if refInfo.refModule}} - new PropertyEntry("{{{@key.original}}}", {{refInfo.refModule}}.{{refInfo.refClass}}::class.java){{#unless @last}},{{/unless}} + "{{{@key.original}}}" to {{refInfo.refModule}}.{{refInfo.refClass}}::class.java{{#unless @last}},{{/unless}} {{else}} - new PropertyEntry("{{{@key.original}}}", {{refInfo.refClass}}::class.java){{#unless @last}},{{/unless}} + "{{{@key.original}}}" to {{refInfo.refClass}}::class.java{{#unless @last}},{{/unless}} {{/if}} {{else}} - new PropertyEntry("{{{@key.original}}}", {{jsonPathPiece.pascalCase}}::class.java){{#unless @last}},{{/unless}} + "{{{@key.original}}}" to {{jsonPathPiece.pascalCase}}::class.java{{#unless @last}},{{/unless}} {{/if}} {{/each}} )) From 22cd355e8bc5a1792d59da953b638d7ad264afee Mon Sep 17 00:00:00 2001 From: Justin Black Date: Fri, 17 May 2024 15:56:57 -0700 Subject: [PATCH 62/78] Updates dependentRequired --- .../kotlin/docs/components/schemas/EmptyDependents.md | 4 ++-- .../docs/components/schemas/MultipleDependentsRequired.md | 4 ++-- .../kotlin/docs/components/schemas/SingleDependency.md | 4 ++-- .../client/components/schemas/EmptyDependents.kt | 4 ++-- .../components/schemas/MultipleDependentsRequired.kt | 4 ++-- .../client/components/schemas/SingleDependency.kt | 4 ++-- .../components/schemas/SchemaClass/_dependentRequired.hbs | 8 ++++---- 7 files changed, 16 insertions(+), 16 deletions(-) diff --git a/samples/client/3_1_0_unit_test/kotlin/docs/components/schemas/EmptyDependents.md b/samples/client/3_1_0_unit_test/kotlin/docs/components/schemas/EmptyDependents.md index a0e5b46a430..816e3548dfd 100644 --- a/samples/client/3_1_0_unit_test/kotlin/docs/components/schemas/EmptyDependents.md +++ b/samples/client/3_1_0_unit_test/kotlin/docs/components/schemas/EmptyDependents.md @@ -142,8 +142,8 @@ A schema class that validates payloads ### Field Summary | Modifier and Type | Field and Description | | ----------------- | ---------------------- | -| Map> | dependentRequired = MapUtils.makeMap(
    -    new AbstractMap.SimpleEntry<>(
    +| Map> | dependentRequired = mapOf(
    +    Pair(
            "bar",
            setOf(         ) diff --git a/samples/client/3_1_0_unit_test/kotlin/docs/components/schemas/MultipleDependentsRequired.md b/samples/client/3_1_0_unit_test/kotlin/docs/components/schemas/MultipleDependentsRequired.md index 96112100122..f55a9db95b1 100644 --- a/samples/client/3_1_0_unit_test/kotlin/docs/components/schemas/MultipleDependentsRequired.md +++ b/samples/client/3_1_0_unit_test/kotlin/docs/components/schemas/MultipleDependentsRequired.md @@ -142,8 +142,8 @@ A schema class that validates payloads ### Field Summary | Modifier and Type | Field and Description | | ----------------- | ---------------------- | -| Map> | dependentRequired = MapUtils.makeMap(
    -    new AbstractMap.SimpleEntry<>(
    +| Map> | dependentRequired = mapOf(
    +    Pair(
            "quux",
            setOf(             "foo",
    diff --git a/samples/client/3_1_0_unit_test/kotlin/docs/components/schemas/SingleDependency.md b/samples/client/3_1_0_unit_test/kotlin/docs/components/schemas/SingleDependency.md index cc3db86e738..689e87a6389 100644 --- a/samples/client/3_1_0_unit_test/kotlin/docs/components/schemas/SingleDependency.md +++ b/samples/client/3_1_0_unit_test/kotlin/docs/components/schemas/SingleDependency.md @@ -142,8 +142,8 @@ A schema class that validates payloads ### Field Summary | Modifier and Type | Field and Description | | ----------------- | ---------------------- | -| Map> | dependentRequired = MapUtils.makeMap(
    -    new AbstractMap.SimpleEntry<>(
    +| Map> | dependentRequired = mapOf(
    +    Pair(
            "bar",
            setOf(             "foo"
    diff --git a/samples/client/3_1_0_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/schemas/EmptyDependents.kt b/samples/client/3_1_0_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/schemas/EmptyDependents.kt index d0952e4931f..07953ad9809 100644 --- a/samples/client/3_1_0_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/schemas/EmptyDependents.kt +++ b/samples/client/3_1_0_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/schemas/EmptyDependents.kt @@ -70,8 +70,8 @@ class EmptyDependents { class EmptyDependents1 private constructor(): JsonSchema( JsonSchemaInfo() - .dependentRequired(MapUtils.makeMap( - new AbstractMap.SimpleEntry<>( + .dependentRequired(mapOf( + Pair( "bar", setOf( ) diff --git a/samples/client/3_1_0_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/schemas/MultipleDependentsRequired.kt b/samples/client/3_1_0_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/schemas/MultipleDependentsRequired.kt index 19ff14b3e8d..e9c802a29f2 100644 --- a/samples/client/3_1_0_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/schemas/MultipleDependentsRequired.kt +++ b/samples/client/3_1_0_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/schemas/MultipleDependentsRequired.kt @@ -70,8 +70,8 @@ class MultipleDependentsRequired { class MultipleDependentsRequired1 private constructor(): JsonSchema( JsonSchemaInfo() - .dependentRequired(MapUtils.makeMap( - new AbstractMap.SimpleEntry<>( + .dependentRequired(mapOf( + Pair( "quux", setOf( "foo", diff --git a/samples/client/3_1_0_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/schemas/SingleDependency.kt b/samples/client/3_1_0_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/schemas/SingleDependency.kt index 77a3137bfc1..bac24cd6f99 100644 --- a/samples/client/3_1_0_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/schemas/SingleDependency.kt +++ b/samples/client/3_1_0_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/schemas/SingleDependency.kt @@ -70,8 +70,8 @@ class SingleDependency { class SingleDependency1 private constructor(): JsonSchema( JsonSchemaInfo() - .dependentRequired(MapUtils.makeMap( - new AbstractMap.SimpleEntry<>( + .dependentRequired(mapOf( + Pair( "bar", setOf( "foo" diff --git a/src/main/resources/kotlin/src/main/kotlin/packagename/components/schemas/SchemaClass/_dependentRequired.hbs b/src/main/resources/kotlin/src/main/kotlin/packagename/components/schemas/SchemaClass/_dependentRequired.hbs index 3b507378010..a2b6d92b4f1 100644 --- a/src/main/resources/kotlin/src/main/kotlin/packagename/components/schemas/SchemaClass/_dependentRequired.hbs +++ b/src/main/resources/kotlin/src/main/kotlin/packagename/components/schemas/SchemaClass/_dependentRequired.hbs @@ -1,7 +1,7 @@ {{#if forDocs}} -dependentRequired = MapUtils.makeMap(
    +dependentRequired = mapOf(
    {{#each dependentRequired}} -    new AbstractMap.SimpleEntry<>(
    +    Pair(
            "{{{@key}}}",
            setOf( {{#each this}} @@ -12,9 +12,9 @@ dependentRequired = MapUtils.makeMap(
    {{/each}} ) {{else}} -.dependentRequired(MapUtils.makeMap( +.dependentRequired(mapOf( {{#each dependentRequired}} - new AbstractMap.SimpleEntry<>( + Pair( "{{{@key}}}", setOf( {{#each this}} From 1e248564f225d08d1827088e28a777c0e0cbf6f9 Mon Sep 17 00:00:00 2001 From: Justin Black Date: Fri, 17 May 2024 16:04:56 -0700 Subject: [PATCH 63/78] Updates patternProperties --- ...tipleSimultaneousPatternpropertiesAreValidated.md | 2 +- .../NonAsciiPatternWithAdditionalproperties.md | 2 +- ...ernpropertiesValidatesPropertiesMatchingARegex.md | 2 +- ...ternpropertiesWithNullValuedInstanceProperties.md | 2 +- ...tternpropertiesAdditionalpropertiesInteraction.md | 2 +- ...exesAreNotAnchoredByDefaultAndAreCaseSensitive.md | 2 +- ...tipleSimultaneousPatternpropertiesAreValidated.kt | 4 ++-- .../NonAsciiPatternWithAdditionalproperties.kt | 2 +- ...ernpropertiesValidatesPropertiesMatchingARegex.kt | 2 +- ...ternpropertiesWithNullValuedInstanceProperties.kt | 2 +- ...tternpropertiesAdditionalpropertiesInteraction.kt | 2 +- ...exesAreNotAnchoredByDefaultAndAreCaseSensitive.kt | 4 ++-- .../schemas/SchemaClass/_patternProperties.hbs | 12 ++++++------ 13 files changed, 20 insertions(+), 20 deletions(-) diff --git a/samples/client/3_1_0_unit_test/kotlin/docs/components/schemas/MultipleSimultaneousPatternpropertiesAreValidated.md b/samples/client/3_1_0_unit_test/kotlin/docs/components/schemas/MultipleSimultaneousPatternpropertiesAreValidated.md index 486e40312e4..9e89e2d1b98 100644 --- a/samples/client/3_1_0_unit_test/kotlin/docs/components/schemas/MultipleSimultaneousPatternpropertiesAreValidated.md +++ b/samples/client/3_1_0_unit_test/kotlin/docs/components/schemas/MultipleSimultaneousPatternpropertiesAreValidated.md @@ -153,7 +153,7 @@ A schema class that validates payloads ### Field Summary | Modifier and Type | Field and Description | | ----------------- | ---------------------- | -| Map> | patternProperties = mapOf(
        new AbstractMap.SimpleEntry<>(Pattern.compile("a*"), [A::class.java](#a))),
        new AbstractMap.SimpleEntry<>(Pattern.compile("aaa*"), [Aaa::class.java](#aaa)))
    )
    | +| Map> | patternProperties = mapOf(
        Pattern.compile("a*") to [A::class.java](#a)),
        Pattern.compile("aaa*") to [Aaa::class.java](#aaa))
    )
    | ### Method Summary | Modifier and Type | Method and Description | diff --git a/samples/client/3_1_0_unit_test/kotlin/docs/components/schemas/NonAsciiPatternWithAdditionalproperties.md b/samples/client/3_1_0_unit_test/kotlin/docs/components/schemas/NonAsciiPatternWithAdditionalproperties.md index 9d5a0916834..2ec68877b3f 100644 --- a/samples/client/3_1_0_unit_test/kotlin/docs/components/schemas/NonAsciiPatternWithAdditionalproperties.md +++ b/samples/client/3_1_0_unit_test/kotlin/docs/components/schemas/NonAsciiPatternWithAdditionalproperties.md @@ -94,7 +94,7 @@ NonAsciiPatternWithAdditionalproperties.NonAsciiPatternWithAdditionalpropertiesM | ----------------- | ---------------------- | | Set> | type = setOf(Map::class.java) | | Class | additionalProperties = [AdditionalProperties::class.java](#additionalproperties) | -| Map> | patternProperties = mapOf(
        new AbstractMap.SimpleEntry<>(Pattern.compile("^á"), [CircumflexAccentLatinSmallLetterAWithAcute::class.java](#circumflexaccentlatinsmallletterawithacute)))
    )
    | +| Map> | patternProperties = mapOf(
        Pattern.compile("^á") to [CircumflexAccentLatinSmallLetterAWithAcute::class.java](#circumflexaccentlatinsmallletterawithacute))
    )
    | ### Method Summary | Modifier and Type | Method and Description | diff --git a/samples/client/3_1_0_unit_test/kotlin/docs/components/schemas/PatternpropertiesValidatesPropertiesMatchingARegex.md b/samples/client/3_1_0_unit_test/kotlin/docs/components/schemas/PatternpropertiesValidatesPropertiesMatchingARegex.md index 53cd3dcce63..4699b05b70e 100644 --- a/samples/client/3_1_0_unit_test/kotlin/docs/components/schemas/PatternpropertiesValidatesPropertiesMatchingARegex.md +++ b/samples/client/3_1_0_unit_test/kotlin/docs/components/schemas/PatternpropertiesValidatesPropertiesMatchingARegex.md @@ -145,7 +145,7 @@ A schema class that validates payloads ### Field Summary | Modifier and Type | Field and Description | | ----------------- | ---------------------- | -| Map> | patternProperties = mapOf(
        new AbstractMap.SimpleEntry<>(Pattern.compile("f.*o"), [Fo::class.java](#fo)))
    )
    | +| Map> | patternProperties = mapOf(
        Pattern.compile("f.*o") to [Fo::class.java](#fo))
    )
    | ### Method Summary | Modifier and Type | Method and Description | diff --git a/samples/client/3_1_0_unit_test/kotlin/docs/components/schemas/PatternpropertiesWithNullValuedInstanceProperties.md b/samples/client/3_1_0_unit_test/kotlin/docs/components/schemas/PatternpropertiesWithNullValuedInstanceProperties.md index 54184e70d2a..08959f1f8a6 100644 --- a/samples/client/3_1_0_unit_test/kotlin/docs/components/schemas/PatternpropertiesWithNullValuedInstanceProperties.md +++ b/samples/client/3_1_0_unit_test/kotlin/docs/components/schemas/PatternpropertiesWithNullValuedInstanceProperties.md @@ -145,7 +145,7 @@ A schema class that validates payloads ### Field Summary | Modifier and Type | Field and Description | | ----------------- | ---------------------- | -| Map> | patternProperties = mapOf(
        new AbstractMap.SimpleEntry<>(Pattern.compile("^.*bar\$"), [Bar::class.java](#bar)))
    )
    | +| Map> | patternProperties = mapOf(
        Pattern.compile("^.*bar\$") to [Bar::class.java](#bar))
    )
    | ### Method Summary | Modifier and Type | Method and Description | diff --git a/samples/client/3_1_0_unit_test/kotlin/docs/components/schemas/PropertiesPatternpropertiesAdditionalpropertiesInteraction.md b/samples/client/3_1_0_unit_test/kotlin/docs/components/schemas/PropertiesPatternpropertiesAdditionalpropertiesInteraction.md index 419a5ba2f4f..4b1fd987d42 100644 --- a/samples/client/3_1_0_unit_test/kotlin/docs/components/schemas/PropertiesPatternpropertiesAdditionalpropertiesInteraction.md +++ b/samples/client/3_1_0_unit_test/kotlin/docs/components/schemas/PropertiesPatternpropertiesAdditionalpropertiesInteraction.md @@ -98,7 +98,7 @@ PropertiesPatternpropertiesAdditionalpropertiesInteraction.PropertiesPatternprop | Set> | type = setOf(Map::class.java) | | Map> | properties = mapOf(
        "foo" to [Foo::class.java](#foo)),
        "bar" to [Bar::class.java](#bar))
    )
    | | Class | additionalProperties = [AdditionalProperties::class.java](#additionalproperties) | -| Map> | patternProperties = mapOf(
        new AbstractMap.SimpleEntry<>(Pattern.compile("f.o"), [Fo::class.java](#fo)))
    )
    | +| Map> | patternProperties = mapOf(
        Pattern.compile("f.o") to [Fo::class.java](#fo))
    )
    | ### Method Summary | Modifier and Type | Method and Description | diff --git a/samples/client/3_1_0_unit_test/kotlin/docs/components/schemas/RegexesAreNotAnchoredByDefaultAndAreCaseSensitive.md b/samples/client/3_1_0_unit_test/kotlin/docs/components/schemas/RegexesAreNotAnchoredByDefaultAndAreCaseSensitive.md index 12ccda1b765..3fd0b57972a 100644 --- a/samples/client/3_1_0_unit_test/kotlin/docs/components/schemas/RegexesAreNotAnchoredByDefaultAndAreCaseSensitive.md +++ b/samples/client/3_1_0_unit_test/kotlin/docs/components/schemas/RegexesAreNotAnchoredByDefaultAndAreCaseSensitive.md @@ -148,7 +148,7 @@ A schema class that validates payloads ### Field Summary | Modifier and Type | Field and Description | | ----------------- | ---------------------- | -| Map> | patternProperties = mapOf(
        new AbstractMap.SimpleEntry<>(Pattern.compile("[0-9]{2,}"), [Schema092::class.java](#schema092))),
        new AbstractMap.SimpleEntry<>(Pattern.compile("X_"), [X::class.java](#x)))
    )
    | +| Map> | patternProperties = mapOf(
        Pattern.compile("[0-9]{2,}") to [Schema092::class.java](#schema092)),
        Pattern.compile("X_") to [X::class.java](#x))
    )
    | ### Method Summary | Modifier and Type | Method and Description | diff --git a/samples/client/3_1_0_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/schemas/MultipleSimultaneousPatternpropertiesAreValidated.kt b/samples/client/3_1_0_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/schemas/MultipleSimultaneousPatternpropertiesAreValidated.kt index fc15a60e8f9..1b940fd9ad8 100644 --- a/samples/client/3_1_0_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/schemas/MultipleSimultaneousPatternpropertiesAreValidated.kt +++ b/samples/client/3_1_0_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/schemas/MultipleSimultaneousPatternpropertiesAreValidated.kt @@ -360,8 +360,8 @@ class MultipleSimultaneousPatternpropertiesAreValidated { class MultipleSimultaneousPatternpropertiesAreValidated1 private constructor(): JsonSchema( JsonSchemaInfo() .patternProperties(mapOf( - new AbstractMap.SimpleEntry<>(Pattern.compile("a*"), A::class.java), - new AbstractMap.SimpleEntry<>(Pattern.compile("aaa*"), Aaa::class.java) + Pattern.compile("a*") to A::class.java, + Pattern.compile("aaa*") to Aaa::class.java )) ), NullSchemaValidator, BooleanSchemaValidator, NumberSchemaValidator, StringSchemaValidator, ListSchemaValidator, MultipleSimultaneousPatternpropertiesAreValidated1BoxedList>, MapSchemaValidator, MultipleSimultaneousPatternpropertiesAreValidated1BoxedMap> { /* diff --git a/samples/client/3_1_0_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/schemas/NonAsciiPatternWithAdditionalproperties.kt b/samples/client/3_1_0_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/schemas/NonAsciiPatternWithAdditionalproperties.kt index c48d25c17a9..ccbe9f90b0a 100644 --- a/samples/client/3_1_0_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/schemas/NonAsciiPatternWithAdditionalproperties.kt +++ b/samples/client/3_1_0_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/schemas/NonAsciiPatternWithAdditionalproperties.kt @@ -89,7 +89,7 @@ class NonAsciiPatternWithAdditionalproperties { .type(setOf(Map::class.java)) .additionalProperties(AdditionalProperties::class.java) .patternProperties(mapOf( - new AbstractMap.SimpleEntry<>(Pattern.compile("^á"), CircumflexAccentLatinSmallLetterAWithAcute::class.java) + Pattern.compile("^á") to CircumflexAccentLatinSmallLetterAWithAcute::class.java )) ), MapSchemaValidator { /* diff --git a/samples/client/3_1_0_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/schemas/PatternpropertiesValidatesPropertiesMatchingARegex.kt b/samples/client/3_1_0_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/schemas/PatternpropertiesValidatesPropertiesMatchingARegex.kt index 9bbb7d45821..b845f06085f 100644 --- a/samples/client/3_1_0_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/schemas/PatternpropertiesValidatesPropertiesMatchingARegex.kt +++ b/samples/client/3_1_0_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/schemas/PatternpropertiesValidatesPropertiesMatchingARegex.kt @@ -85,7 +85,7 @@ class PatternpropertiesValidatesPropertiesMatchingARegex { class PatternpropertiesValidatesPropertiesMatchingARegex1 private constructor(): JsonSchema( JsonSchemaInfo() .patternProperties(mapOf( - new AbstractMap.SimpleEntry<>(Pattern.compile("f.*o"), Fo::class.java) + Pattern.compile("f.*o") to Fo::class.java )) ), NullSchemaValidator, BooleanSchemaValidator, NumberSchemaValidator, StringSchemaValidator, ListSchemaValidator, PatternpropertiesValidatesPropertiesMatchingARegex1BoxedList>, MapSchemaValidator, PatternpropertiesValidatesPropertiesMatchingARegex1BoxedMap> { /* diff --git a/samples/client/3_1_0_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/schemas/PatternpropertiesWithNullValuedInstanceProperties.kt b/samples/client/3_1_0_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/schemas/PatternpropertiesWithNullValuedInstanceProperties.kt index df837363aec..630c4c1adec 100644 --- a/samples/client/3_1_0_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/schemas/PatternpropertiesWithNullValuedInstanceProperties.kt +++ b/samples/client/3_1_0_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/schemas/PatternpropertiesWithNullValuedInstanceProperties.kt @@ -85,7 +85,7 @@ class PatternpropertiesWithNullValuedInstanceProperties { class PatternpropertiesWithNullValuedInstanceProperties1 private constructor(): JsonSchema( JsonSchemaInfo() .patternProperties(mapOf( - new AbstractMap.SimpleEntry<>(Pattern.compile("^.*bar\$"), Bar::class.java) + Pattern.compile("^.*bar\$") to Bar::class.java )) ), NullSchemaValidator, BooleanSchemaValidator, NumberSchemaValidator, StringSchemaValidator, ListSchemaValidator, PatternpropertiesWithNullValuedInstanceProperties1BoxedList>, MapSchemaValidator, PatternpropertiesWithNullValuedInstanceProperties1BoxedMap> { /* diff --git a/samples/client/3_1_0_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/schemas/PropertiesPatternpropertiesAdditionalpropertiesInteraction.kt b/samples/client/3_1_0_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/schemas/PropertiesPatternpropertiesAdditionalpropertiesInteraction.kt index f134ed1414c..30792c880b8 100644 --- a/samples/client/3_1_0_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/schemas/PropertiesPatternpropertiesAdditionalpropertiesInteraction.kt +++ b/samples/client/3_1_0_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/schemas/PropertiesPatternpropertiesAdditionalpropertiesInteraction.kt @@ -571,7 +571,7 @@ class PropertiesPatternpropertiesAdditionalpropertiesInteraction { )) .additionalProperties(AdditionalProperties::class.java) .patternProperties(mapOf( - new AbstractMap.SimpleEntry<>(Pattern.compile("f.o"), Fo::class.java) + Pattern.compile("f.o") to Fo::class.java )) ), MapSchemaValidator { /* diff --git a/samples/client/3_1_0_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/schemas/RegexesAreNotAnchoredByDefaultAndAreCaseSensitive.kt b/samples/client/3_1_0_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/schemas/RegexesAreNotAnchoredByDefaultAndAreCaseSensitive.kt index 83a2174d06a..2bd7e34db0c 100644 --- a/samples/client/3_1_0_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/schemas/RegexesAreNotAnchoredByDefaultAndAreCaseSensitive.kt +++ b/samples/client/3_1_0_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/schemas/RegexesAreNotAnchoredByDefaultAndAreCaseSensitive.kt @@ -99,8 +99,8 @@ class RegexesAreNotAnchoredByDefaultAndAreCaseSensitive { class RegexesAreNotAnchoredByDefaultAndAreCaseSensitive1 private constructor(): JsonSchema( JsonSchemaInfo() .patternProperties(mapOf( - new AbstractMap.SimpleEntry<>(Pattern.compile("[0-9]{2,}"), Schema092::class.java), - new AbstractMap.SimpleEntry<>(Pattern.compile("X_"), X::class.java) + Pattern.compile("[0-9]{2,}") to Schema092::class.java, + Pattern.compile("X_") to X::class.java )) ), NullSchemaValidator, BooleanSchemaValidator, NumberSchemaValidator, StringSchemaValidator, ListSchemaValidator, RegexesAreNotAnchoredByDefaultAndAreCaseSensitive1BoxedList>, MapSchemaValidator, RegexesAreNotAnchoredByDefaultAndAreCaseSensitive1BoxedMap> { /* diff --git a/src/main/resources/kotlin/src/main/kotlin/packagename/components/schemas/SchemaClass/_patternProperties.hbs b/src/main/resources/kotlin/src/main/kotlin/packagename/components/schemas/SchemaClass/_patternProperties.hbs index f281e22ac48..d497ca10bea 100644 --- a/src/main/resources/kotlin/src/main/kotlin/packagename/components/schemas/SchemaClass/_patternProperties.hbs +++ b/src/main/resources/kotlin/src/main/kotlin/packagename/components/schemas/SchemaClass/_patternProperties.hbs @@ -3,12 +3,12 @@ patternProperties = mapOf(
    {{~#each patternProperties}} {{#if refInfo.refClass}} {{#if refInfo.refModule}} -    new AbstractMap.SimpleEntry<>(Pattern.compile("{{{@key.pattern.codeEscaped}}}"), [{{refInfo.refModule}}.{{refInfo.refClass}}::class.java]({{docRoot}}{{refInfo.ref.pathFromDocRoot}}.md#{{refInfo.ref.jsonPathPiece.kebabCase}})){{#unless @last}},{{/unless}}
    +    Pattern.compile("{{{@key.pattern.codeEscaped}}}") to [{{refInfo.refModule}}.{{refInfo.refClass}}::class.java]({{docRoot}}{{refInfo.ref.pathFromDocRoot}}.md#{{refInfo.ref.jsonPathPiece.kebabCase}}){{#unless @last}},{{/unless}}
    {{~else}} -    new AbstractMap.SimpleEntry<>(Pattern.compile("{{{@key.pattern.codeEscaped}}}"), [{{refInfo.refClass}}::class.java](#{{refInfo.ref.jsonPathPiece.kebabCase}}))){{#unless @last}},{{/unless}}
    +    Pattern.compile("{{{@key.pattern.codeEscaped}}}") to [{{refInfo.refClass}}::class.java](#{{refInfo.ref.jsonPathPiece.kebabCase}})){{#unless @last}},{{/unless}}
    {{~/if}} {{else}} -    new AbstractMap.SimpleEntry<>(Pattern.compile("{{{@key.pattern.codeEscaped}}}"), [{{jsonPathPiece.pascalCase}}::class.java](#{{jsonPathPiece.kebabCase}}))){{#unless @last}},{{/unless}}
    +    Pattern.compile("{{{@key.pattern.codeEscaped}}}") to [{{jsonPathPiece.pascalCase}}::class.java](#{{jsonPathPiece.kebabCase}})){{#unless @last}},{{/unless}}
    {{~/if}} {{/each}} )
    @@ -17,12 +17,12 @@ patternProperties = mapOf(
    {{#each patternProperties}} {{#if refInfo.refClass}} {{#if refInfo.refModule}} - new AbstractMap.SimpleEntry<>(Pattern.compile("{{{@key.pattern.codeEscaped}}}"), {{refInfo.refModule}}.{{refInfo.refClass}}::class.java){{#unless @last}},{{/unless}} + Pattern.compile("{{{@key.pattern.codeEscaped}}}") to {{refInfo.refModule}}.{{refInfo.refClass}}::class.java{{#unless @last}},{{/unless}} {{else}} - new AbstractMap.SimpleEntry<>(Pattern.compile("{{{@key.pattern.codeEscaped}}}"), {{refInfo.refClass}}::class.java){{#unless @last}},{{/unless}} + Pattern.compile("{{{@key.pattern.codeEscaped}}}") to {{refInfo.refClass}}::class.java{{#unless @last}},{{/unless}} {{/if}} {{else}} - new AbstractMap.SimpleEntry<>(Pattern.compile("{{{@key.pattern.codeEscaped}}}"), {{jsonPathPiece.pascalCase}}::class.java){{#unless @last}},{{/unless}} + Pattern.compile("{{{@key.pattern.codeEscaped}}}") to {{jsonPathPiece.pascalCase}}::class.java{{#unless @last}},{{/unless}} {{/if}} {{/each}} )) From 369a9afbd2d96b194ed781c777adc94b50552353 Mon Sep 17 00:00:00 2001 From: Justin Black Date: Fri, 17 May 2024 16:42:12 -0700 Subject: [PATCH 64/78] Includes patternProperties in calculation of mapValueSchema --- ...NonAsciiPatternWithAdditionalproperties.md | 4 +- ...opertiesAdditionalpropertiesInteraction.md | 8 ++-- ...NonAsciiPatternWithAdditionalproperties.kt | 2 +- ...opertiesAdditionalpropertiesInteraction.kt | 41 +++++++++---------- .../codegen/generators/DefaultGenerator.java | 5 +++ .../components/schemas/_objectInputType.hbs | 2 +- 6 files changed, 32 insertions(+), 30 deletions(-) diff --git a/samples/client/3_1_0_unit_test/kotlin/docs/components/schemas/NonAsciiPatternWithAdditionalproperties.md b/samples/client/3_1_0_unit_test/kotlin/docs/components/schemas/NonAsciiPatternWithAdditionalproperties.md index 2ec68877b3f..86530abe5e7 100644 --- a/samples/client/3_1_0_unit_test/kotlin/docs/components/schemas/NonAsciiPatternWithAdditionalproperties.md +++ b/samples/client/3_1_0_unit_test/kotlin/docs/components/schemas/NonAsciiPatternWithAdditionalproperties.md @@ -122,14 +122,14 @@ A class that builds the Map input type ## NonAsciiPatternWithAdditionalpropertiesMap class NonAsciiPatternWithAdditionalpropertiesMap
    -extends FrozenMap +extends FrozenMap A class to store validated Map payloads ### Method Summary | Modifier and Type | Method and Description | | ----------------- | ---------------------- | -| static [NonAsciiPatternWithAdditionalpropertiesMap](#nonasciipatternwithadditionalpropertiesmap) | of([Map](#nonasciipatternwithadditionalpropertiesmapbuilder) arg, SchemaConfiguration configuration) | +| static [NonAsciiPatternWithAdditionalpropertiesMap](#nonasciipatternwithadditionalpropertiesmap) | of([Map](#nonasciipatternwithadditionalpropertiesmapbuilder) arg, SchemaConfiguration configuration) | ## CircumflexAccentLatinSmallLetterAWithAcuteBoxed sealed interface CircumflexAccentLatinSmallLetterAWithAcuteBoxed
    diff --git a/samples/client/3_1_0_unit_test/kotlin/docs/components/schemas/PropertiesPatternpropertiesAdditionalpropertiesInteraction.md b/samples/client/3_1_0_unit_test/kotlin/docs/components/schemas/PropertiesPatternpropertiesAdditionalpropertiesInteraction.md index 4b1fd987d42..70a77d46f18 100644 --- a/samples/client/3_1_0_unit_test/kotlin/docs/components/schemas/PropertiesPatternpropertiesAdditionalpropertiesInteraction.md +++ b/samples/client/3_1_0_unit_test/kotlin/docs/components/schemas/PropertiesPatternpropertiesAdditionalpropertiesInteraction.md @@ -110,7 +110,7 @@ PropertiesPatternpropertiesAdditionalpropertiesInteraction.PropertiesPatternprop ## PropertiesPatternpropertiesAdditionalpropertiesInteractionMapBuilder class PropertiesPatternpropertiesAdditionalpropertiesInteractionMapBuilder
    -builder for `Map` +builder for `Map` A class that builds the Map input type @@ -122,7 +122,7 @@ A class that builds the Map input type ### Method Summary | Modifier and Type | Method and Description | | ----------------- | ---------------------- | -| Map | build()
    Returns map input that should be used with Schema.validate | +| Map | build()
    Returns map input that should be used with Schema.validate | | [PropertiesPatternpropertiesAdditionalpropertiesInteractionMapBuilder](#propertiespatternpropertiesadditionalpropertiesinteractionmapbuilder) | foo(value: List) | | [PropertiesPatternpropertiesAdditionalpropertiesInteractionMapBuilder](#propertiespatternpropertiesadditionalpropertiesinteractionmapbuilder) | bar(value: List) | | [PropertiesPatternpropertiesAdditionalpropertiesInteractionMapBuilder](#propertiespatternpropertiesadditionalpropertiesinteractionmapbuilder) | additionalProperty(key: String, value: Int) | @@ -132,14 +132,14 @@ A class that builds the Map input type ## PropertiesPatternpropertiesAdditionalpropertiesInteractionMap class PropertiesPatternpropertiesAdditionalpropertiesInteractionMap
    -extends FrozenMap +extends FrozenMap A class to store validated Map payloads ### Method Summary | Modifier and Type | Method and Description | | ----------------- | ---------------------- | -| static [PropertiesPatternpropertiesAdditionalpropertiesInteractionMap](#propertiespatternpropertiesadditionalpropertiesinteractionmap) | of([Map](#propertiespatternpropertiesadditionalpropertiesinteractionmapbuilder) arg, SchemaConfiguration configuration) | +| static [PropertiesPatternpropertiesAdditionalpropertiesInteractionMap](#propertiespatternpropertiesadditionalpropertiesinteractionmap) | of([Map](#propertiespatternpropertiesadditionalpropertiesinteractionmapbuilder) arg, SchemaConfiguration configuration) | | FrozenList | foo()
    [optional] | | FrozenList | bar()
    [optional] | | Number | getAdditionalProperty(String name)
    provides type safety for additional properties | diff --git a/samples/client/3_1_0_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/schemas/NonAsciiPatternWithAdditionalproperties.kt b/samples/client/3_1_0_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/schemas/NonAsciiPatternWithAdditionalproperties.kt index ccbe9f90b0a..6299c177f70 100644 --- a/samples/client/3_1_0_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/schemas/NonAsciiPatternWithAdditionalproperties.kt +++ b/samples/client/3_1_0_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/schemas/NonAsciiPatternWithAdditionalproperties.kt @@ -46,7 +46,7 @@ class NonAsciiPatternWithAdditionalproperties { } - class NonAsciiPatternWithAdditionalpropertiesMap(m: FrozenMap): FrozenMap(m) { + class NonAsciiPatternWithAdditionalpropertiesMap(m: FrozenMap) : FrozenMap(m) { companion object { val requiredKeys: Set = setOf() val optionalKeys: Set = setOf() diff --git a/samples/client/3_1_0_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/schemas/PropertiesPatternpropertiesAdditionalpropertiesInteraction.kt b/samples/client/3_1_0_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/schemas/PropertiesPatternpropertiesAdditionalpropertiesInteraction.kt index 30792c880b8..8172959072f 100644 --- a/samples/client/3_1_0_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/schemas/PropertiesPatternpropertiesAdditionalpropertiesInteraction.kt +++ b/samples/client/3_1_0_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/schemas/PropertiesPatternpropertiesAdditionalpropertiesInteraction.kt @@ -415,7 +415,7 @@ class PropertiesPatternpropertiesAdditionalpropertiesInteraction { } - class PropertiesPatternpropertiesAdditionalpropertiesInteractionMap(m: FrozenMap) : FrozenMap(m) { + class PropertiesPatternpropertiesAdditionalpropertiesInteractionMap(m: FrozenMap) : FrozenMap(m) { companion object { val requiredKeys: Set = setOf() val optionalKeys: Set = setOf( @@ -423,7 +423,7 @@ class PropertiesPatternpropertiesAdditionalpropertiesInteraction { "bar" ) @Throws(ValidationException::class) - fun of(arg: Map, configuration: SchemaConfiguration): PropertiesPatternpropertiesAdditionalpropertiesInteractionMap { + fun of(arg: Map, configuration: SchemaConfiguration): PropertiesPatternpropertiesAdditionalpropertiesInteractionMap { return PropertiesPatternpropertiesAdditionalpropertiesInteraction1.getInstance().validate(arg, configuration) } } @@ -432,7 +432,7 @@ class PropertiesPatternpropertiesAdditionalpropertiesInteraction { fun foo(): FrozenList { val key = "foo" throwIfKeyNotPresent(key) - val value: Any = get(key) + val value: Any? = get(key) if (!(value is FrozenList)) { throw RuntimeException("Invalid value stored for foo") } @@ -443,7 +443,7 @@ class PropertiesPatternpropertiesAdditionalpropertiesInteraction { fun bar(): FrozenList { val key = "bar" throwIfKeyNotPresent(key) - val value: Any = get(key) + val value: Any? = get(key) if (!(value is FrozenList)) { throw RuntimeException("Invalid value stored for bar") } @@ -462,8 +462,8 @@ class PropertiesPatternpropertiesAdditionalpropertiesInteraction { } interface SetterForFoo { - fun getInstance(): MutableMap - fun getBuilderAfterFoo(instance: MutableMap): T + fun getInstance(): MutableMap + fun getBuilderAfterFoo(instance: MutableMap): T fun foo(value: List): T { val instance = getInstance() @@ -473,8 +473,8 @@ class PropertiesPatternpropertiesAdditionalpropertiesInteraction { } interface SetterForBar { - fun getInstance(): MutableMap - fun getBuilderAfterBar(instance: MutableMap): T + fun getInstance(): MutableMap + fun getBuilderAfterBar(instance: MutableMap): T fun bar(value: List): T { val instance = getInstance() @@ -485,8 +485,8 @@ class PropertiesPatternpropertiesAdditionalpropertiesInteraction { interface SetterForAdditionalProperties { fun getKnownKeys(): Set - fun getInstance(): MutableMap - fun getBuilderAfterAdditionalProperty(instance: MutableMap): T + fun getInstance(): MutableMap + fun getBuilderAfterAdditionalProperty(instance: MutableMap): T @Throws(InvalidAdditionalPropertyException::class) fun additionalProperty(key: String, value: Int): T { @@ -521,7 +521,7 @@ class PropertiesPatternpropertiesAdditionalpropertiesInteraction { } } - class PropertiesPatternpropertiesAdditionalpropertiesInteractionMapBuilder: GenericBuilder>, SetterForFoo, SetterForBar, SetterForAdditionalProperties { + class PropertiesPatternpropertiesAdditionalpropertiesInteractionMapBuilder: GenericBuilder>, SetterForFoo, SetterForBar, SetterForAdditionalProperties { private val knownKeys: Set = setOf( "foo", "bar" @@ -529,23 +529,23 @@ class PropertiesPatternpropertiesAdditionalpropertiesInteraction { override fun getKnownKeys(): Set { return knownKeys } - private val instance: MutableMap + private val instance: MutableMap init { this.instance = LinkedHashMap() } - override fun build(): Map { + override fun build(): Map { return instance } - override fun getInstance(): MutableMap { + override fun getInstance(): MutableMap { return instance } - override fun getBuilderAfterFoo(instance: MutableMap): PropertiesPatternpropertiesAdditionalpropertiesInteractionMapBuilder { + override fun getBuilderAfterFoo(instance: MutableMap): PropertiesPatternpropertiesAdditionalpropertiesInteractionMapBuilder { return this } - override fun getBuilderAfterBar(instance: MutableMap): PropertiesPatternpropertiesAdditionalpropertiesInteractionMapBuilder { + override fun getBuilderAfterBar(instance: MutableMap): PropertiesPatternpropertiesAdditionalpropertiesInteractionMapBuilder { return this } - override fun getBuilderAfterAdditionalProperty(instance: MutableMap): PropertiesPatternpropertiesAdditionalpropertiesInteractionMapBuilder { + override fun getBuilderAfterAdditionalProperty(instance: MutableMap): PropertiesPatternpropertiesAdditionalpropertiesInteractionMapBuilder { return this } } @@ -592,7 +592,7 @@ class PropertiesPatternpropertiesAdditionalpropertiesInteraction { } override fun getNewInstance(arg: Map<*, *>, pathToItem: List, pathToSchemas: PathToSchemasMap): PropertiesPatternpropertiesAdditionalpropertiesInteractionMap { - val properties: LinkedHashMap = LinkedHashMap() + val properties: LinkedHashMap = LinkedHashMap() for((entryKey, value) in arg) { if (!(entryKey is String)) { throw RuntimeException("Invalid non-string key value") @@ -604,12 +604,9 @@ class PropertiesPatternpropertiesAdditionalpropertiesInteraction { } val propertySchema: JsonSchema<*> = schemas.entries.iterator().next().key val propertyInstance: Any? = propertySchema.getNewInstance(value, propertyPathToItem, pathToSchemas) - if (!(propertyInstance is Any)) { - throw RuntimeException("Invalid instantiated value") - } properties[entryKey] = propertyInstance } - val castProperties: FrozenMap = FrozenMap(properties) + val castProperties: FrozenMap = FrozenMap(properties) return PropertiesPatternpropertiesAdditionalpropertiesInteractionMap(castProperties) } diff --git a/src/main/java/org/openapijsonschematools/codegen/generators/DefaultGenerator.java b/src/main/java/org/openapijsonschematools/codegen/generators/DefaultGenerator.java index bf1750f0ea2..a0886e46538 100644 --- a/src/main/java/org/openapijsonschematools/codegen/generators/DefaultGenerator.java +++ b/src/main/java/org/openapijsonschematools/codegen/generators/DefaultGenerator.java @@ -2271,6 +2271,11 @@ public CodegenSchema fromSchema(Schema p, String sourceJsonPath, String currentJ } property.mapValueSchema = mapValueSchema; } + if (property.patternProperties != null && !property.patternProperties.isEmpty()) { + for (CodegenSchema prop: property.patternProperties.values()) { + property.mapValueSchema = prop.add(property.mapValueSchema); + } + } if (currentJsonPath != null) { String[] pathPieces = currentJsonPath.split("/"); diff --git a/src/main/resources/kotlin/src/main/kotlin/packagename/components/schemas/_objectInputType.hbs b/src/main/resources/kotlin/src/main/kotlin/packagename/components/schemas/_objectInputType.hbs index 84272674bf9..3177bbc4047 100644 --- a/src/main/resources/kotlin/src/main/kotlin/packagename/components/schemas/_objectInputType.hbs +++ b/src/main/resources/kotlin/src/main/kotlin/packagename/components/schemas/_objectInputType.hbs @@ -65,7 +65,7 @@ class {{className.pascalCase}}{{#unless @last }}(private val instance: MutableMa {{/eq}} {{/eq}} {{/and}} - override fun getKnownKeys(): Set { + {{#unless ../additionalProperties.isBooleanSchemaFalse}}override {{/unless}}fun getKnownKeys(): Set { return knownKeys } {{/if}} From 79bf23732f4efe47716c5ca7ab5783e76e8257a9 Mon Sep 17 00:00:00 2001 From: Justin Black Date: Fri, 17 May 2024 16:48:14 -0700 Subject: [PATCH 65/78] Omits getKnownKeys method when additionalProperties is turned off --- .../DependentSchemasDependentSubschemaIncompatibleWithRoot.kt | 3 --- .../schemas/NonAsciiPatternWithAdditionalproperties.kt | 3 --- .../packagename/components/schemas/_objectInputType.hbs | 4 +++- 3 files changed, 3 insertions(+), 7 deletions(-) diff --git a/samples/client/3_1_0_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/schemas/DependentSchemasDependentSubschemaIncompatibleWithRoot.kt b/samples/client/3_1_0_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/schemas/DependentSchemasDependentSubschemaIncompatibleWithRoot.kt index 2cf4eae5685..f06e3be553b 100644 --- a/samples/client/3_1_0_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/schemas/DependentSchemasDependentSubschemaIncompatibleWithRoot.kt +++ b/samples/client/3_1_0_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/schemas/DependentSchemasDependentSubschemaIncompatibleWithRoot.kt @@ -137,9 +137,6 @@ class DependentSchemasDependentSubschemaIncompatibleWithRoot { private val knownKeys: Set = setOf( "bar" ) - override fun getKnownKeys(): Set { - return knownKeys - } private val instance: MutableMap init { this.instance = LinkedHashMap() diff --git a/samples/client/3_1_0_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/schemas/NonAsciiPatternWithAdditionalproperties.kt b/samples/client/3_1_0_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/schemas/NonAsciiPatternWithAdditionalproperties.kt index 6299c177f70..70c07dad448 100644 --- a/samples/client/3_1_0_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/schemas/NonAsciiPatternWithAdditionalproperties.kt +++ b/samples/client/3_1_0_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/schemas/NonAsciiPatternWithAdditionalproperties.kt @@ -60,9 +60,6 @@ class NonAsciiPatternWithAdditionalproperties { class NonAsciiPatternWithAdditionalpropertiesMapBuilder: GenericBuilder> { private val knownKeys: Set = setOf() - override fun getKnownKeys(): Set { - return knownKeys - } private val instance: MutableMap init { this.instance = LinkedHashMap() diff --git a/src/main/resources/kotlin/src/main/kotlin/packagename/components/schemas/_objectInputType.hbs b/src/main/resources/kotlin/src/main/kotlin/packagename/components/schemas/_objectInputType.hbs index 3177bbc4047..dd3521f8551 100644 --- a/src/main/resources/kotlin/src/main/kotlin/packagename/components/schemas/_objectInputType.hbs +++ b/src/main/resources/kotlin/src/main/kotlin/packagename/components/schemas/_objectInputType.hbs @@ -65,9 +65,11 @@ class {{className.pascalCase}}{{#unless @last }}(private val instance: MutableMa {{/eq}} {{/eq}} {{/and}} - {{#unless ../additionalProperties.isBooleanSchemaFalse}}override {{/unless}}fun getKnownKeys(): Set { + {{#unless ../additionalProperties.isBooleanSchemaFalse}} + override fun getKnownKeys(): Set { return knownKeys } + {{/unless}} {{/if}} {{#if @last }} private val instance: MutableMap src/main/kotlin/packagename/components/schemas/types/schema_input_type sourceJsonPath=../../jsonPath forceNull=true noExtends=true }}{{else}}Any?{{/with}}> From 2ee8809c257598a8d219d143a4cdbf2cbc88d31c Mon Sep 17 00:00:00 2001 From: Justin Black Date: Fri, 17 May 2024 17:01:08 -0700 Subject: [PATCH 66/78] Fixes value checking of lists of any type in map output getters --- ...pertiesPatternpropertiesAdditionalpropertiesInteraction.kt | 4 ++-- .../components/schemas/types/_schema_output_type_base.hbs | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/samples/client/3_1_0_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/schemas/PropertiesPatternpropertiesAdditionalpropertiesInteraction.kt b/samples/client/3_1_0_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/schemas/PropertiesPatternpropertiesAdditionalpropertiesInteraction.kt index 8172959072f..8d80ffa2f34 100644 --- a/samples/client/3_1_0_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/schemas/PropertiesPatternpropertiesAdditionalpropertiesInteraction.kt +++ b/samples/client/3_1_0_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/schemas/PropertiesPatternpropertiesAdditionalpropertiesInteraction.kt @@ -433,7 +433,7 @@ class PropertiesPatternpropertiesAdditionalpropertiesInteraction { val key = "foo" throwIfKeyNotPresent(key) val value: Any? = get(key) - if (!(value is FrozenList)) { + if (!(value is FrozenList<*>)) { throw RuntimeException("Invalid value stored for foo") } return value @@ -444,7 +444,7 @@ class PropertiesPatternpropertiesAdditionalpropertiesInteraction { val key = "bar" throwIfKeyNotPresent(key) val value: Any? = get(key) - if (!(value is FrozenList)) { + if (!(value is FrozenList<*>)) { throw RuntimeException("Invalid value stored for bar") } return value diff --git a/src/main/resources/kotlin/src/main/kotlin/packagename/components/schemas/types/_schema_output_type_base.hbs b/src/main/resources/kotlin/src/main/kotlin/packagename/components/schemas/types/_schema_output_type_base.hbs index 56abc7edf7f..58f0246e237 100644 --- a/src/main/resources/kotlin/src/main/kotlin/packagename/components/schemas/types/_schema_output_type_base.hbs +++ b/src/main/resources/kotlin/src/main/kotlin/packagename/components/schemas/types/_schema_output_type_base.hbs @@ -37,7 +37,7 @@ Number {{~/if}} {{/if}} {{else}} -FrozenList +FrozenList<{{#if noAnnotations}}*{{else}}Any?{{/if}}> {{~/if}} {{else}} {{#eq this "object"}} From fbc196b520da237e48e5b0faee6645f6a9893f0f Mon Sep 17 00:00:00 2001 From: Justin Black Date: Fri, 17 May 2024 17:24:53 -0700 Subject: [PATCH 67/78] Fixes output type issues for property getters --- ...opertiesAdditionalpropertiesInteraction.kt | 4 +-- ...seNamesAreJavascriptObjectPropertyNames.kt | 2 +- .../schemas/_objectOutputProperties.hbs | 2 +- .../types/_schema_output_type_base.hbs | 28 +++++++++---------- 4 files changed, 18 insertions(+), 18 deletions(-) diff --git a/samples/client/3_1_0_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/schemas/PropertiesPatternpropertiesAdditionalpropertiesInteraction.kt b/samples/client/3_1_0_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/schemas/PropertiesPatternpropertiesAdditionalpropertiesInteraction.kt index 8d80ffa2f34..2f42413500b 100644 --- a/samples/client/3_1_0_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/schemas/PropertiesPatternpropertiesAdditionalpropertiesInteraction.kt +++ b/samples/client/3_1_0_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/schemas/PropertiesPatternpropertiesAdditionalpropertiesInteraction.kt @@ -429,7 +429,7 @@ class PropertiesPatternpropertiesAdditionalpropertiesInteraction { } @Throws(UnsetPropertyException::class) - fun foo(): FrozenList { + fun foo(): FrozenList<*> { val key = "foo" throwIfKeyNotPresent(key) val value: Any? = get(key) @@ -440,7 +440,7 @@ class PropertiesPatternpropertiesAdditionalpropertiesInteraction { } @Throws(UnsetPropertyException::class) - fun bar(): FrozenList { + fun bar(): FrozenList<*> { val key = "bar" throwIfKeyNotPresent(key) val value: Any? = get(key) diff --git a/samples/client/3_1_0_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/schemas/PropertiesWhoseNamesAreJavascriptObjectPropertyNames.kt b/samples/client/3_1_0_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/schemas/PropertiesWhoseNamesAreJavascriptObjectPropertyNames.kt index e421b3615e8..42db2286647 100644 --- a/samples/client/3_1_0_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/schemas/PropertiesWhoseNamesAreJavascriptObjectPropertyNames.kt +++ b/samples/client/3_1_0_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/schemas/PropertiesWhoseNamesAreJavascriptObjectPropertyNames.kt @@ -431,7 +431,7 @@ class PropertiesWhoseNamesAreJavascriptObjectPropertyNames { val key = "toString" throwIfKeyNotPresent(key) val value: Any? = get(key) - if (!(value is Any)) { + if (!(value is Any?)) { throw RuntimeException("Invalid value stored for toString") } return value diff --git a/src/main/resources/kotlin/src/main/kotlin/packagename/components/schemas/_objectOutputProperties.hbs b/src/main/resources/kotlin/src/main/kotlin/packagename/components/schemas/_objectOutputProperties.hbs index d61685fcd72..4c0080decc4 100644 --- a/src/main/resources/kotlin/src/main/kotlin/packagename/components/schemas/_objectOutputProperties.hbs +++ b/src/main/resources/kotlin/src/main/kotlin/packagename/components/schemas/_objectOutputProperties.hbs @@ -31,7 +31,7 @@ fun {{@key.original}}(): Any? { {{#with this}} @Throws(UnsetPropertyException::class) -fun {{{@key.original}}}(): {{> src/main/kotlin/packagename/components/schemas/types/schema_output_type }} { +fun {{{@key.original}}}(): {{> src/main/kotlin/packagename/components/schemas/types/schema_output_type noAnnotations=true }} { {{> src/main/kotlin/packagename/components/schemas/_objectOutputGetProperty required=false }} } {{/with}} diff --git a/src/main/resources/kotlin/src/main/kotlin/packagename/components/schemas/types/_schema_output_type_base.hbs b/src/main/resources/kotlin/src/main/kotlin/packagename/components/schemas/types/_schema_output_type_base.hbs index 58f0246e237..abad648e88d 100644 --- a/src/main/resources/kotlin/src/main/kotlin/packagename/components/schemas/types/_schema_output_type_base.hbs +++ b/src/main/resources/kotlin/src/main/kotlin/packagename/components/schemas/types/_schema_output_type_base.hbs @@ -56,7 +56,7 @@ FrozenList<{{#if noAnnotations}}*{{else}}Any?{{/if}}> {{~/if}} {{/if}} {{~else}} -FrozenMap +FrozenMap<{{#if noAnnotations}}*{{else}}Any?{{/if}}> {{~/if}} {{/eq}} {{/eq}} @@ -72,21 +72,21 @@ FrozenMap {{! nullable types }} {{#each types}} {{#eq this "boolean"}} -Boolean{{#unless noAnnotations}}?{{/unless}} +Boolean? {{~else}} {{#eq this "string"}} {{#eq format "binary"}} {{! todo binary types}} -String{{#unless noAnnotations}}?{{/unless}} +String? {{~else}} -String{{#unless noAnnotations}}?{{/unless}} +String? {{~/eq}} {{else}} {{#eq this "number"}} -Number{{#unless noAnnotations}}?{{/unless}} +Number? {{~else}} {{#eq this "integer"}} -Number{{#unless noAnnotations}}?{{/unless}} +Number? {{~else}} {{#eq this "array"}} {{#if arrayOutputJsonPathPiece}} @@ -98,13 +98,13 @@ Number{{#unless noAnnotations}}?{{/unless}} {{~/if}} {{else}} {{#if fullRefModule}} -{{fullRefModule}}.{{arrayOutputJsonPathPiece.pascalCase}}{{#unless noAnnotations}}?{{/unless}} +{{fullRefModule}}.{{arrayOutputJsonPathPiece.pascalCase}}? {{~else}} -{{arrayOutputJsonPathPiece.pascalCase}}{{#unless noAnnotations}}?{{/unless}} +{{arrayOutputJsonPathPiece.pascalCase}}? {{~/if}} {{/if}} {{else}} -FrozenList{{#unless noAnnotations}}?{{/unless}} +FrozenList<{{#if noAnnotations}}*{{else}}Any?{{/if}}>? {{~/if}} {{else}} {{#eq this "object"}} @@ -117,13 +117,13 @@ FrozenList{{#unless noAnnotations}}?{{/unless}} {{~/if}} {{else}} {{#if fullRefModule}} -{{fullRefModule}}.{{mapOutputJsonPathPiece.pascalCase}}{{#unless noAnnotations}}?{{/unless}} +{{fullRefModule}}.{{mapOutputJsonPathPiece.pascalCase}}? {{~else}} -{{mapOutputJsonPathPiece.pascalCase}}{{#unless noAnnotations}}?{{/unless}} +{{mapOutputJsonPathPiece.pascalCase}}? {{~/if}} {{/if}} {{~else}} -FrozenMap{{#unless noAnnotations}}?{{/unless}} +FrozenMap<{{#if noAnnotations}}*{{else}}Any?{{/if}}>? {{~/if}} {{/eq}} {{/eq}} @@ -143,12 +143,12 @@ Any {{else}} {{! 3 or more types }} {{#contains types "null"}} -Any{{#unless noAnnotations}}?{{/unless}} +Any? {{~else}} Any {{~/contains}} {{/eq}} {{/eq}} {{else}} -Any{{#unless noAnnotations}}?{{/unless}} +Any? {{~/if}} From 10e154bcfdd2b85ac4aa028b05765e41742b1dc2 Mon Sep 17 00:00:00 2001 From: Justin Black Date: Sat, 18 May 2024 18:07:58 -0700 Subject: [PATCH 68/78] Adds 310 kotlin test to ci --- .circleci/testKotlinClientSamples.sh | 3 +- ...seNamesAreJavascriptObjectPropertyNames.md | 103 +++++++++--------- ...seNamesAreJavascriptObjectPropertyNames.md | 3 +- ...seNamesAreJavascriptObjectPropertyNames.kt | 89 +++++++-------- ...seNamesAreJavascriptObjectPropertyNames.kt | 46 ++++---- .../generators/KotlinClientGenerator.java | 3 +- 6 files changed, 114 insertions(+), 133 deletions(-) diff --git a/.circleci/testKotlinClientSamples.sh b/.circleci/testKotlinClientSamples.sh index e846f7f3bde..6026e0ad461 100644 --- a/.circleci/testKotlinClientSamples.sh +++ b/.circleci/testKotlinClientSamples.sh @@ -1 +1,2 @@ - (cd samples/client/3_0_3_unit_test/kotlin && gradle wrapper && ./gradlew cleanTest test) \ No newline at end of file + (cd samples/client/3_0_3_unit_test/kotlin && gradle wrapper && ./gradlew cleanTest test) + (cd samples/client/3_1_0_unit_test/kotlin && gradle wrapper && ./gradlew cleanTest test) \ No newline at end of file diff --git a/samples/client/3_1_0_unit_test/kotlin/docs/components/schemas/PropertiesWhoseNamesAreJavascriptObjectPropertyNames.md b/samples/client/3_1_0_unit_test/kotlin/docs/components/schemas/PropertiesWhoseNamesAreJavascriptObjectPropertyNames.md index a153b4a36eb..0cb472ad7c2 100644 --- a/samples/client/3_1_0_unit_test/kotlin/docs/components/schemas/PropertiesWhoseNamesAreJavascriptObjectPropertyNames.md +++ b/samples/client/3_1_0_unit_test/kotlin/docs/components/schemas/PropertiesWhoseNamesAreJavascriptObjectPropertyNames.md @@ -25,14 +25,14 @@ A class that contains necessary nested | sealed interface | [PropertiesWhoseNamesAreJavascriptObjectPropertyNames.ConstructorSchemaBoxed](#constructorschemaboxed)
    sealed interface for validated payloads | | record | [PropertiesWhoseNamesAreJavascriptObjectPropertyNames.ConstructorSchemaBoxedNumber](#constructorschemaboxednumber)
    boxed class to store validated Number payloads | | static class | [PropertiesWhoseNamesAreJavascriptObjectPropertyNames.ConstructorSchema](#constructorschema)
    schema class | -| sealed interface | [PropertiesWhoseNamesAreJavascriptObjectPropertyNames.ToStringBoxed](#tostringboxed)
    sealed interface for validated payloads | -| record | [PropertiesWhoseNamesAreJavascriptObjectPropertyNames.ToStringBoxedVoid](#tostringboxedvoid)
    boxed class to store validated null payloads | -| record | [PropertiesWhoseNamesAreJavascriptObjectPropertyNames.ToStringBoxedBoolean](#tostringboxedboolean)
    boxed class to store validated boolean payloads | -| record | [PropertiesWhoseNamesAreJavascriptObjectPropertyNames.ToStringBoxedNumber](#tostringboxednumber)
    boxed class to store validated Number payloads | -| record | [PropertiesWhoseNamesAreJavascriptObjectPropertyNames.ToStringBoxedString](#tostringboxedstring)
    boxed class to store validated String payloads | -| record | [PropertiesWhoseNamesAreJavascriptObjectPropertyNames.ToStringBoxedList](#tostringboxedlist)
    boxed class to store validated List payloads | -| record | [PropertiesWhoseNamesAreJavascriptObjectPropertyNames.ToStringBoxedMap](#tostringboxedmap)
    boxed class to store validated Map payloads | -| static class | [PropertiesWhoseNamesAreJavascriptObjectPropertyNames.ToString](#tostring)
    schema class | +| sealed interface | [PropertiesWhoseNamesAreJavascriptObjectPropertyNames.ToStringSchemaBoxed](#tostringschemaboxed)
    sealed interface for validated payloads | +| record | [PropertiesWhoseNamesAreJavascriptObjectPropertyNames.ToStringSchemaBoxedVoid](#tostringschemaboxedvoid)
    boxed class to store validated null payloads | +| record | [PropertiesWhoseNamesAreJavascriptObjectPropertyNames.ToStringSchemaBoxedBoolean](#tostringschemaboxedboolean)
    boxed class to store validated boolean payloads | +| record | [PropertiesWhoseNamesAreJavascriptObjectPropertyNames.ToStringSchemaBoxedNumber](#tostringschemaboxednumber)
    boxed class to store validated Number payloads | +| record | [PropertiesWhoseNamesAreJavascriptObjectPropertyNames.ToStringSchemaBoxedString](#tostringschemaboxedstring)
    boxed class to store validated String payloads | +| record | [PropertiesWhoseNamesAreJavascriptObjectPropertyNames.ToStringSchemaBoxedList](#tostringschemaboxedlist)
    boxed class to store validated List payloads | +| record | [PropertiesWhoseNamesAreJavascriptObjectPropertyNames.ToStringSchemaBoxedMap](#tostringschemaboxedmap)
    boxed class to store validated Map payloads | +| static class | [PropertiesWhoseNamesAreJavascriptObjectPropertyNames.ToStringSchema](#tostringschema)
    schema class | | static class | [PropertiesWhoseNamesAreJavascriptObjectPropertyNames.ToStringMapBuilder](#tostringmapbuilder)
    builder for Map payloads | | static class | [PropertiesWhoseNamesAreJavascriptObjectPropertyNames.ToStringMap](#tostringmap)
    output class for Map payloads | | sealed interface | [PropertiesWhoseNamesAreJavascriptObjectPropertyNames.LengthBoxed](#lengthboxed)
    sealed interface for validated payloads | @@ -165,7 +165,7 @@ A schema class that validates payloads ### Field Summary | Modifier and Type | Field and Description | | ----------------- | ---------------------- | -| Map> | properties = mapOf(
        "__proto__" to [Proto::class.java](#proto)),
        "toString" to [ToString::class.java](#tostring)),
        "constructor" to [ConstructorSchema::class.java](#constructorschema))
    )
    | +| Map> | properties = mapOf(
        "__proto__" to [Proto::class.java](#proto)),
        "toString" to [ToStringSchema::class.java](#tostringschema)),
        "constructor" to [ConstructorSchema::class.java](#constructorschema))
    )
    | ### Method Summary | Modifier and Type | Method and Description | @@ -241,8 +241,7 @@ A class to store validated Map payloads | Modifier and Type | Method and Description | | ----------------- | ---------------------- | | static [PropertiesWhoseNamesAreJavascriptObjectPropertyNamesMap](#propertieswhosenamesarejavascriptobjectpropertynamesmap) | of([Map](#propertieswhosenamesarejavascriptobjectpropertynamesmapbuilder) arg, SchemaConfiguration configuration) | -| Any? | toString()
    [optional] | -| Any? | get(String key)
    This schema has invalid Kotlin names so this method must be used when you access instance["__proto__"], instance["constructor"], | +| Any? | get(String key)
    This schema has invalid Kotlin names so this method must be used when you access instance["__proto__"], instance["toString"], instance["constructor"], | | Any? | getAdditionalProperty(String name)
    provides type safety for additional properties | ## ConstructorSchemaBoxed @@ -280,28 +279,28 @@ A schema class that validates payloads | validate | | validateAndBox | -## ToStringBoxed -sealed interface ToStringBoxed
    +## ToStringSchemaBoxed +sealed interface ToStringSchemaBoxed
    permits
    -[ToStringBoxedVoid](#tostringboxedvoid), -[ToStringBoxedBoolean](#tostringboxedboolean), -[ToStringBoxedNumber](#tostringboxednumber), -[ToStringBoxedString](#tostringboxedstring), -[ToStringBoxedList](#tostringboxedlist), -[ToStringBoxedMap](#tostringboxedmap) +[ToStringSchemaBoxedVoid](#tostringschemaboxedvoid), +[ToStringSchemaBoxedBoolean](#tostringschemaboxedboolean), +[ToStringSchemaBoxedNumber](#tostringschemaboxednumber), +[ToStringSchemaBoxedString](#tostringschemaboxedstring), +[ToStringSchemaBoxedList](#tostringschemaboxedlist), +[ToStringSchemaBoxedMap](#tostringschemaboxedmap) sealed interface that stores validated payloads using boxed classes -## ToStringBoxedVoid -data class ToStringBoxedVoid
    -implements [ToStringBoxed](#tostringboxed) +## ToStringSchemaBoxedVoid +data class ToStringSchemaBoxedVoid
    +implements [ToStringSchemaBoxed](#tostringschemaboxed) data class that stores validated null payloads, sealed permits implementation ### Constructor Summary | Constructor and Description | | --------------------------- | -| ToStringBoxedVoid(Nothing? data)
    Creates an instance, private visibility | +| ToStringSchemaBoxedVoid(Nothing? data)
    Creates an instance, private visibility | ### Method Summary | Modifier and Type | Method and Description | @@ -309,16 +308,16 @@ data class that stores validated null payloads, sealed permits implementation | Nothing? | data()
    validated payload | | Any? | getData()
    validated payload | -## ToStringBoxedBoolean -data class ToStringBoxedBoolean
    -implements [ToStringBoxed](#tostringboxed) +## ToStringSchemaBoxedBoolean +data class ToStringSchemaBoxedBoolean
    +implements [ToStringSchemaBoxed](#tostringschemaboxed) record that stores validated boolean payloads, sealed permits implementation ### Constructor Summary | Constructor and Description | | --------------------------- | -| ToStringBoxedBoolean(boolean data)
    Creates an instance, private visibility | +| ToStringSchemaBoxedBoolean(boolean data)
    Creates an instance, private visibility | ### Method Summary | Modifier and Type | Method and Description | @@ -326,16 +325,16 @@ record that stores validated boolean payloads, sealed permits implementation | boolean | data()
    validated payload | | Any? | getData()
    validated payload | -## ToStringBoxedNumber -data class ToStringBoxedNumber
    -implements [ToStringBoxed](#tostringboxed) +## ToStringSchemaBoxedNumber +data class ToStringSchemaBoxedNumber
    +implements [ToStringSchemaBoxed](#tostringschemaboxed) data class that stores validated Number payloads, sealed permits implementation ### Constructor Summary | Constructor and Description | | --------------------------- | -| ToStringBoxedNumber(Number data)
    Creates an instance, private visibility | +| ToStringSchemaBoxedNumber(Number data)
    Creates an instance, private visibility | ### Method Summary | Modifier and Type | Method and Description | @@ -343,16 +342,16 @@ data class that stores validated Number payloads, sealed permits implementation | Number | data()
    validated payload | | Any? | getData()
    validated payload | -## ToStringBoxedString -data class ToStringBoxedString
    -implements [ToStringBoxed](#tostringboxed) +## ToStringSchemaBoxedString +data class ToStringSchemaBoxedString
    +implements [ToStringSchemaBoxed](#tostringschemaboxed) data class that stores validated String payloads, sealed permits implementation ### Constructor Summary | Constructor and Description | | --------------------------- | -| ToStringBoxedString(String data)
    Creates an instance, private visibility | +| ToStringSchemaBoxedString(String data)
    Creates an instance, private visibility | ### Method Summary | Modifier and Type | Method and Description | @@ -360,16 +359,16 @@ data class that stores validated String payloads, sealed permits implementation | String | data()
    validated payload | | Any? | getData()
    validated payload | -## ToStringBoxedList -data class ToStringBoxedList
    -implements [ToStringBoxed](#tostringboxed) +## ToStringSchemaBoxedList +data class ToStringSchemaBoxedList
    +implements [ToStringSchemaBoxed](#tostringschemaboxed) data class that stores validated List payloads, sealed permits implementation ### Constructor Summary | Constructor and Description | | --------------------------- | -| ToStringBoxedList(FrozenList data)
    Creates an instance, private visibility | +| ToStringSchemaBoxedList(FrozenList data)
    Creates an instance, private visibility | ### Method Summary | Modifier and Type | Method and Description | @@ -377,16 +376,16 @@ data class that stores validated List payloads, sealed permits implementation | FrozenList | data()
    validated payload | | Any? | getData()
    validated payload | -## ToStringBoxedMap -data class ToStringBoxedMap
    -implements [ToStringBoxed](#tostringboxed) +## ToStringSchemaBoxedMap +data class ToStringSchemaBoxedMap
    +implements [ToStringSchemaBoxed](#tostringschemaboxed) data class that stores validated Map payloads, sealed permits implementation ### Constructor Summary | Constructor and Description | | --------------------------- | -| ToStringBoxedMap([ToStringMap](#tostringmap) data)
    Creates an instance, private visibility | +| ToStringSchemaBoxedMap([ToStringMap](#tostringmap) data)
    Creates an instance, private visibility | ### Method Summary | Modifier and Type | Method and Description | @@ -394,8 +393,8 @@ data class that stores validated Map payloads, sealed permits implementation | [ToStringMap](#tostringmap) | data()
    validated payload | | Any? | getData()
    validated payload | -## ToString -class ToString
    +## ToStringSchema +class ToStringSchema
    extends JsonSchema A schema class that validates payloads @@ -418,13 +417,13 @@ A schema class that validates payloads | boolean | validate(arg: boolean, configuration: SchemaConfiguration) | | [ToStringMap](#tostringmap) | validate(arg: [Map<?, ?>](#tostringmapbuilder), configuration: SchemaConfiguration) | | FrozenList | validate(arg: List<*>, configuration: SchemaConfiguration) | -| [ToStringBoxedString](#tostringboxedstring) | validateAndBox(String, configuration: SchemaConfiguration) | -| [ToStringBoxedVoid](#tostringboxedvoid) | validateAndBox(Nothing?, configuration: SchemaConfiguration) | -| [ToStringBoxedNumber](#tostringboxednumber) | validateAndBox(Number, configuration: SchemaConfiguration) | -| [ToStringBoxedBoolean](#tostringboxedboolean) | validateAndBox(boolean, configuration: SchemaConfiguration) | -| [ToStringBoxedMap](#tostringboxedmap) | validateAndBox([Map<?, ?>](#tostringmapbuilder), configuration: SchemaConfiguration) | -| [ToStringBoxedList](#tostringboxedlist) | validateAndBox(List<*>, configuration: SchemaConfiguration) | -| [ToStringBoxed](#tostringboxed) | validateAndBox(Any?, configuration: SchemaConfiguration) | +| [ToStringSchemaBoxedString](#tostringschemaboxedstring) | validateAndBox(String, configuration: SchemaConfiguration) | +| [ToStringSchemaBoxedVoid](#tostringschemaboxedvoid) | validateAndBox(Nothing?, configuration: SchemaConfiguration) | +| [ToStringSchemaBoxedNumber](#tostringschemaboxednumber) | validateAndBox(Number, configuration: SchemaConfiguration) | +| [ToStringSchemaBoxedBoolean](#tostringschemaboxedboolean) | validateAndBox(boolean, configuration: SchemaConfiguration) | +| [ToStringSchemaBoxedMap](#tostringschemaboxedmap) | validateAndBox([Map<?, ?>](#tostringmapbuilder), configuration: SchemaConfiguration) | +| [ToStringSchemaBoxedList](#tostringschemaboxedlist) | validateAndBox(List<*>, configuration: SchemaConfiguration) | +| [ToStringSchemaBoxed](#tostringschemaboxed) | validateAndBox(Any?, configuration: SchemaConfiguration) | | Any? | validate(arg: Any?, configuration: SchemaConfiguration) | ## ToStringMapBuilder diff --git a/samples/client/3_1_0_unit_test/kotlin/docs/components/schemas/RequiredPropertiesWhoseNamesAreJavascriptObjectPropertyNames.md b/samples/client/3_1_0_unit_test/kotlin/docs/components/schemas/RequiredPropertiesWhoseNamesAreJavascriptObjectPropertyNames.md index 1f70ba9284c..da432b91f7e 100644 --- a/samples/client/3_1_0_unit_test/kotlin/docs/components/schemas/RequiredPropertiesWhoseNamesAreJavascriptObjectPropertyNames.md +++ b/samples/client/3_1_0_unit_test/kotlin/docs/components/schemas/RequiredPropertiesWhoseNamesAreJavascriptObjectPropertyNames.md @@ -418,8 +418,7 @@ A class to store validated Map payloads | Modifier and Type | Method and Description | | ----------------- | ---------------------- | | static [RequiredPropertiesWhoseNamesAreJavascriptObjectPropertyNamesMap](#requiredpropertieswhosenamesarejavascriptobjectpropertynamesmap) | of([Map](#requiredpropertieswhosenamesarejavascriptobjectpropertynamesmapbuilder) arg, SchemaConfiguration configuration) | -| Any? | toString()
    | -| Any? | get(String key)
    This schema has invalid Kotlin names so this method must be used when you access instance["__proto__"], instance["constructor"], | +| Any? | get(String key)
    This schema has invalid Kotlin names so this method must be used when you access instance["__proto__"], instance["constructor"], instance["toString"], | | Any? | getAdditionalProperty(String name)
    provides type safety for additional properties | [[Back to top]](#top) [[Back to Component Schemas]](../../../README.md#Component-Schemas) [[Back to README]](../../../README.md) diff --git a/samples/client/3_1_0_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/schemas/PropertiesWhoseNamesAreJavascriptObjectPropertyNames.kt b/samples/client/3_1_0_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/schemas/PropertiesWhoseNamesAreJavascriptObjectPropertyNames.kt index 42db2286647..8151f89805d 100644 --- a/samples/client/3_1_0_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/schemas/PropertiesWhoseNamesAreJavascriptObjectPropertyNames.kt +++ b/samples/client/3_1_0_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/schemas/PropertiesWhoseNamesAreJavascriptObjectPropertyNames.kt @@ -62,7 +62,7 @@ class PropertiesWhoseNamesAreJavascriptObjectPropertyNames { ) @Throws(ValidationException::class) fun of(arg: Map, configuration: SchemaConfiguration): ToStringMap { - return ToString.getInstance().validate(arg, configuration) + return ToStringSchema.getInstance().validate(arg, configuration) } } @@ -122,61 +122,61 @@ class PropertiesWhoseNamesAreJavascriptObjectPropertyNames { } - sealed interface ToStringBoxed { + sealed interface ToStringSchemaBoxed { fun getData(): Any? } - data class ToStringBoxedVoid(val data: Nothing?) : ToStringBoxed { + data class ToStringSchemaBoxedVoid(val data: Nothing?) : ToStringSchemaBoxed { override fun getData(): Any? { return data } } - data class ToStringBoxedBoolean(val data: Boolean): ToStringBoxed { + data class ToStringSchemaBoxedBoolean(val data: Boolean): ToStringSchemaBoxed { override fun getData(): Any? { return data } } - data class ToStringBoxedNumber(val data: Number) : ToStringBoxed { + data class ToStringSchemaBoxedNumber(val data: Number) : ToStringSchemaBoxed { override fun getData(): Any? { return data } } - data class ToStringBoxedString(val data: String) : ToStringBoxed { + data class ToStringSchemaBoxedString(val data: String) : ToStringSchemaBoxed { override fun getData(): Any? { return data } } - data class ToStringBoxedList(val data: FrozenList) : ToStringBoxed { + data class ToStringSchemaBoxedList(val data: FrozenList) : ToStringSchemaBoxed { override fun getData(): Any? { return data } } - data class ToStringBoxedMap(val data: ToStringMap) : ToStringBoxed { + data class ToStringSchemaBoxedMap(val data: ToStringMap) : ToStringSchemaBoxed { override fun getData(): Any? { return data } } - class ToString private constructor(): JsonSchema( + class ToStringSchema private constructor(): JsonSchema( JsonSchemaInfo() .properties(mapOf( "length" to Length::class.java )) - ), NullSchemaValidator, BooleanSchemaValidator, NumberSchemaValidator, StringSchemaValidator, ListSchemaValidator, ToStringBoxedList>, MapSchemaValidator { + ), NullSchemaValidator, BooleanSchemaValidator, NumberSchemaValidator, StringSchemaValidator, ListSchemaValidator, ToStringSchemaBoxedList>, MapSchemaValidator { companion object { @Volatile - private var instance: ToString? = null + private var instance: ToStringSchema? = null fun getInstance() = instance ?: synchronized(this) { - instance ?: ToString().also { instance = it } + instance ?: ToStringSchema().also { instance = it } } } @@ -357,31 +357,31 @@ class PropertiesWhoseNamesAreJavascriptObjectPropertyNames { throw RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema") } @Throws(ValidationException::class) - override fun validateAndBox(arg: Nothing?, configuration: SchemaConfiguration?): ToStringBoxedVoid { - return ToStringBoxedVoid(validate(arg, configuration)) + override fun validateAndBox(arg: Nothing?, configuration: SchemaConfiguration?): ToStringSchemaBoxedVoid { + return ToStringSchemaBoxedVoid(validate(arg, configuration)) } @Throws(ValidationException::class) - override fun validateAndBox(arg: Boolean, configuration: SchemaConfiguration?): ToStringBoxedBoolean { - return ToStringBoxedBoolean(validate(arg, configuration)) + override fun validateAndBox(arg: Boolean, configuration: SchemaConfiguration?): ToStringSchemaBoxedBoolean { + return ToStringSchemaBoxedBoolean(validate(arg, configuration)) } @Throws(ValidationException::class) - override fun validateAndBox(arg: Number, configuration: SchemaConfiguration?): ToStringBoxedNumber { - return ToStringBoxedNumber(validate(arg, configuration)) + override fun validateAndBox(arg: Number, configuration: SchemaConfiguration?): ToStringSchemaBoxedNumber { + return ToStringSchemaBoxedNumber(validate(arg, configuration)) } @Throws(ValidationException::class) - override fun validateAndBox(arg: String, configuration: SchemaConfiguration?): ToStringBoxedString { - return ToStringBoxedString(validate(arg, configuration)) + override fun validateAndBox(arg: String, configuration: SchemaConfiguration?): ToStringSchemaBoxedString { + return ToStringSchemaBoxedString(validate(arg, configuration)) } @Throws(ValidationException::class) - override fun validateAndBox(arg: List<*>, configuration: SchemaConfiguration?): ToStringBoxedList { - return ToStringBoxedList(validate(arg, configuration)) + override fun validateAndBox(arg: List<*>, configuration: SchemaConfiguration?): ToStringSchemaBoxedList { + return ToStringSchemaBoxedList(validate(arg, configuration)) } @Throws(ValidationException::class) - override fun validateAndBox(arg: Map<*, *>, configuration: SchemaConfiguration?): ToStringBoxedMap { - return ToStringBoxedMap(validate(arg, configuration)) + override fun validateAndBox(arg: Map<*, *>, configuration: SchemaConfiguration?): ToStringSchemaBoxedMap { + return ToStringSchemaBoxedMap(validate(arg, configuration)) } @Throws(ValidationException::class) - override fun validateAndBox(arg: Any?, configuration: SchemaConfiguration?): ToStringBoxed { + override fun validateAndBox(arg: Any?, configuration: SchemaConfiguration?): ToStringSchemaBoxed { if (arg == null) { return validateAndBox(null, configuration) } else if (arg is Boolean) { @@ -426,17 +426,6 @@ class PropertiesWhoseNamesAreJavascriptObjectPropertyNames { } } - @Throws(UnsetPropertyException::class) - fun toString(): Any? { - val key = "toString" - throwIfKeyNotPresent(key) - val value: Any? = get(key) - if (!(value is Any?)) { - throw RuntimeException("Invalid value stored for toString") - } - return value - } - @Throws(UnsetPropertyException::class, InvalidAdditionalPropertyException::class) fun getAdditionalProperty(name: String): Any? { throwIfKeyKnown(name, requiredKeys, optionalKeys) @@ -474,62 +463,62 @@ class PropertiesWhoseNamesAreJavascriptObjectPropertyNames { } } - interface SetterForToString { + interface SetterForToStringSchema { fun getInstance(): MutableMap - fun getBuilderAfterToString(instance: MutableMap): T + fun getBuilderAfterToStringSchema(instance: MutableMap): T fun toString(value: Nothing?): T { val instance = getInstance() instance["toString"] = null - return getBuilderAfterToString(instance) + return getBuilderAfterToStringSchema(instance) } fun toString(value: Boolean): T { val instance = getInstance() instance["toString"] = value - return getBuilderAfterToString(instance) + return getBuilderAfterToStringSchema(instance) } fun toString(value: String): T { val instance = getInstance() instance["toString"] = value - return getBuilderAfterToString(instance) + return getBuilderAfterToStringSchema(instance) } fun toString(value: Int): T { val instance = getInstance() instance["toString"] = value - return getBuilderAfterToString(instance) + return getBuilderAfterToStringSchema(instance) } fun toString(value: Float): T { val instance = getInstance() instance["toString"] = value - return getBuilderAfterToString(instance) + return getBuilderAfterToStringSchema(instance) } fun toString(value: Long): T { val instance = getInstance() instance["toString"] = value - return getBuilderAfterToString(instance) + return getBuilderAfterToStringSchema(instance) } fun toString(value: Double): T { val instance = getInstance() instance["toString"] = value - return getBuilderAfterToString(instance) + return getBuilderAfterToStringSchema(instance) } fun toString(value: List): T { val instance = getInstance() instance["toString"] = value - return getBuilderAfterToString(instance) + return getBuilderAfterToStringSchema(instance) } fun toString(value: Map): T { val instance = getInstance() instance["toString"] = value - return getBuilderAfterToString(instance) + return getBuilderAfterToStringSchema(instance) } } @@ -562,7 +551,7 @@ class PropertiesWhoseNamesAreJavascriptObjectPropertyNames { } } - class PropertiesWhoseNamesAreJavascriptObjectPropertyNamesMapBuilder: UnsetAddPropsSetter, GenericBuilder>, SetterForProto, SetterForToString, SetterForConstructorSchema { + class PropertiesWhoseNamesAreJavascriptObjectPropertyNamesMapBuilder: UnsetAddPropsSetter, GenericBuilder>, SetterForProto, SetterForToStringSchema, SetterForConstructorSchema { private val knownKeys: Set = setOf( "__proto__", "toString", @@ -584,7 +573,7 @@ class PropertiesWhoseNamesAreJavascriptObjectPropertyNames { override fun getBuilderAfterProto(instance: MutableMap): PropertiesWhoseNamesAreJavascriptObjectPropertyNamesMapBuilder { return this } - override fun getBuilderAfterToString(instance: MutableMap): PropertiesWhoseNamesAreJavascriptObjectPropertyNamesMapBuilder { + override fun getBuilderAfterToStringSchema(instance: MutableMap): PropertiesWhoseNamesAreJavascriptObjectPropertyNamesMapBuilder { return this } override fun getBuilderAfterConstructorSchema(instance: MutableMap): PropertiesWhoseNamesAreJavascriptObjectPropertyNamesMapBuilder { @@ -641,7 +630,7 @@ class PropertiesWhoseNamesAreJavascriptObjectPropertyNames { JsonSchemaInfo() .properties(mapOf( "__proto__" to Proto::class.java, - "toString" to ToString::class.java, + "toString" to ToStringSchema::class.java, "constructor" to ConstructorSchema::class.java )) ), NullSchemaValidator, BooleanSchemaValidator, NumberSchemaValidator, StringSchemaValidator, ListSchemaValidator, PropertiesWhoseNamesAreJavascriptObjectPropertyNames1BoxedList>, MapSchemaValidator { diff --git a/samples/client/3_1_0_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/schemas/RequiredPropertiesWhoseNamesAreJavascriptObjectPropertyNames.kt b/samples/client/3_1_0_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/schemas/RequiredPropertiesWhoseNamesAreJavascriptObjectPropertyNames.kt index cc017d5118b..e5207da569b 100644 --- a/samples/client/3_1_0_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/schemas/RequiredPropertiesWhoseNamesAreJavascriptObjectPropertyNames.kt +++ b/samples/client/3_1_0_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/schemas/RequiredPropertiesWhoseNamesAreJavascriptObjectPropertyNames.kt @@ -40,14 +40,6 @@ class RequiredPropertiesWhoseNamesAreJavascriptObjectPropertyNames { } } - fun toString(): Any? { - try { - return getOrThrow("version") - } catch (e: UnsetPropertyException) { - throw RuntimeException(e) - } - } - @Throws(UnsetPropertyException::class, InvalidAdditionalPropertyException::class) fun getAdditionalProperty(name: String): Any? { throwIfKeyKnown(name, requiredKeys, optionalKeys) @@ -174,62 +166,62 @@ class RequiredPropertiesWhoseNamesAreJavascriptObjectPropertyNames { } } - interface SetterForToString { + interface SetterForToStringSchema { fun getInstance(): MutableMap - fun getBuilderAfterToString(instance: MutableMap): T + fun getBuilderAfterToStringSchema(instance: MutableMap): T fun toString(value: Nothing?): T { val instance = getInstance() instance["toString"] = null - return getBuilderAfterToString(instance) + return getBuilderAfterToStringSchema(instance) } fun toString(value: Boolean): T { val instance = getInstance() instance["toString"] = value - return getBuilderAfterToString(instance) + return getBuilderAfterToStringSchema(instance) } fun toString(value: String): T { val instance = getInstance() instance["toString"] = value - return getBuilderAfterToString(instance) + return getBuilderAfterToStringSchema(instance) } fun toString(value: Int): T { val instance = getInstance() instance["toString"] = value - return getBuilderAfterToString(instance) + return getBuilderAfterToStringSchema(instance) } fun toString(value: Float): T { val instance = getInstance() instance["toString"] = value - return getBuilderAfterToString(instance) + return getBuilderAfterToStringSchema(instance) } fun toString(value: Long): T { val instance = getInstance() instance["toString"] = value - return getBuilderAfterToString(instance) + return getBuilderAfterToStringSchema(instance) } fun toString(value: Double): T { val instance = getInstance() instance["toString"] = value - return getBuilderAfterToString(instance) + return getBuilderAfterToStringSchema(instance) } fun toString(value: List): T { val instance = getInstance() instance["toString"] = value - return getBuilderAfterToString(instance) + return getBuilderAfterToStringSchema(instance) } fun toString(value: Map): T { val instance = getInstance() instance["toString"] = value - return getBuilderAfterToString(instance) + return getBuilderAfterToStringSchema(instance) } } @@ -253,11 +245,11 @@ class RequiredPropertiesWhoseNamesAreJavascriptObjectPropertyNames { } } - class RequiredPropertiesWhoseNamesAreJavascriptObjectPropertyNamesMap001Builder(private val instance: MutableMap): SetterForToString { + class RequiredPropertiesWhoseNamesAreJavascriptObjectPropertyNamesMap001Builder(private val instance: MutableMap): SetterForToStringSchema { override fun getInstance(): MutableMap { return instance } - override fun getBuilderAfterToString(instance: MutableMap): RequiredPropertiesWhoseNamesAreJavascriptObjectPropertyNamesMap000Builder { + override fun getBuilderAfterToStringSchema(instance: MutableMap): RequiredPropertiesWhoseNamesAreJavascriptObjectPropertyNamesMap000Builder { return RequiredPropertiesWhoseNamesAreJavascriptObjectPropertyNamesMap000Builder(instance) } } @@ -271,14 +263,14 @@ class RequiredPropertiesWhoseNamesAreJavascriptObjectPropertyNames { } } - class RequiredPropertiesWhoseNamesAreJavascriptObjectPropertyNamesMap011Builder(private val instance: MutableMap): SetterForConstructorSchema, SetterForToString { + class RequiredPropertiesWhoseNamesAreJavascriptObjectPropertyNamesMap011Builder(private val instance: MutableMap): SetterForConstructorSchema, SetterForToStringSchema { override fun getInstance(): MutableMap { return instance } override fun getBuilderAfterConstructorSchema(instance: MutableMap): RequiredPropertiesWhoseNamesAreJavascriptObjectPropertyNamesMap001Builder { return RequiredPropertiesWhoseNamesAreJavascriptObjectPropertyNamesMap001Builder(instance) } - override fun getBuilderAfterToString(instance: MutableMap): RequiredPropertiesWhoseNamesAreJavascriptObjectPropertyNamesMap010Builder { + override fun getBuilderAfterToStringSchema(instance: MutableMap): RequiredPropertiesWhoseNamesAreJavascriptObjectPropertyNamesMap010Builder { return RequiredPropertiesWhoseNamesAreJavascriptObjectPropertyNamesMap010Builder(instance) } } @@ -292,14 +284,14 @@ class RequiredPropertiesWhoseNamesAreJavascriptObjectPropertyNames { } } - class RequiredPropertiesWhoseNamesAreJavascriptObjectPropertyNamesMap101Builder(private val instance: MutableMap): SetterForProto, SetterForToString { + class RequiredPropertiesWhoseNamesAreJavascriptObjectPropertyNamesMap101Builder(private val instance: MutableMap): SetterForProto, SetterForToStringSchema { override fun getInstance(): MutableMap { return instance } override fun getBuilderAfterProto(instance: MutableMap): RequiredPropertiesWhoseNamesAreJavascriptObjectPropertyNamesMap001Builder { return RequiredPropertiesWhoseNamesAreJavascriptObjectPropertyNamesMap001Builder(instance) } - override fun getBuilderAfterToString(instance: MutableMap): RequiredPropertiesWhoseNamesAreJavascriptObjectPropertyNamesMap100Builder { + override fun getBuilderAfterToStringSchema(instance: MutableMap): RequiredPropertiesWhoseNamesAreJavascriptObjectPropertyNamesMap100Builder { return RequiredPropertiesWhoseNamesAreJavascriptObjectPropertyNamesMap100Builder(instance) } } @@ -316,7 +308,7 @@ class RequiredPropertiesWhoseNamesAreJavascriptObjectPropertyNames { } } - class RequiredPropertiesWhoseNamesAreJavascriptObjectPropertyNamesMapBuilder: SetterForProto, SetterForConstructorSchema, SetterForToString { + class RequiredPropertiesWhoseNamesAreJavascriptObjectPropertyNamesMapBuilder: SetterForProto, SetterForConstructorSchema, SetterForToStringSchema { private val instance: MutableMap init { this.instance = LinkedHashMap() @@ -330,7 +322,7 @@ class RequiredPropertiesWhoseNamesAreJavascriptObjectPropertyNames { override fun getBuilderAfterConstructorSchema(instance: MutableMap): RequiredPropertiesWhoseNamesAreJavascriptObjectPropertyNamesMap101Builder { return RequiredPropertiesWhoseNamesAreJavascriptObjectPropertyNamesMap101Builder(instance) } - override fun getBuilderAfterToString(instance: MutableMap): RequiredPropertiesWhoseNamesAreJavascriptObjectPropertyNamesMap110Builder { + override fun getBuilderAfterToStringSchema(instance: MutableMap): RequiredPropertiesWhoseNamesAreJavascriptObjectPropertyNamesMap110Builder { return RequiredPropertiesWhoseNamesAreJavascriptObjectPropertyNamesMap110Builder(instance) } } diff --git a/src/main/java/org/openapijsonschematools/codegen/generators/KotlinClientGenerator.java b/src/main/java/org/openapijsonschematools/codegen/generators/KotlinClientGenerator.java index 2124dcf65c3..5b066048094 100644 --- a/src/main/java/org/openapijsonschematools/codegen/generators/KotlinClientGenerator.java +++ b/src/main/java/org/openapijsonschematools/codegen/generators/KotlinClientGenerator.java @@ -431,7 +431,8 @@ public KotlinClientGenerator(GeneratorSettings generatorSettings, WorkflowSettin "vararg", "when", "where", - "while" + "while", + "toString" // Map method ) ) ) From 651d229a6bfd19e591eb614802c4906c0aa9d4be Mon Sep 17 00:00:00 2001 From: Justin Black Date: Sat, 18 May 2024 18:26:15 -0700 Subject: [PATCH 69/78] Samples regen --- .circleci/testJava17ClientSamples.sh | 2 +- .circleci/testKotlinClientSamples.sh | 4 +- docs/generators/kotlin.md | 1 + .../client/3_0_3_unit_test/kotlin/README.md | 8 ++-- .../3_0_3_unit_test/kotlin/build.gradle.kts | 2 +- .../schemas/RefInAdditionalproperties.kt | 2 +- .../client/components/schemas/RefInItems.kt | 2 +- .../components/schemas/RefInProperty.kt | 2 +- ...NonAsciiPatternWithAdditionalproperties.md | 4 +- ...opertiesAdditionalpropertiesInteraction.md | 8 ++-- ...nAsciiPatternWithAdditionalproperties.java | 2 +- ...ertiesAdditionalpropertiesInteraction.java | 45 +++++++++---------- .../client/3_1_0_unit_test/kotlin/README.md | 8 ++-- .../3_1_0_unit_test/kotlin/build.gradle.kts | 2 +- ...ascii_pattern_with_additionalproperties.md | 1 + ...erties_additionalproperties_interaction.md | 5 +-- ...ascii_pattern_with_additionalproperties.py | 1 + ...erties_additionalproperties_interaction.py | 5 +-- src/main/resources/kotlin/README.hbs | 8 ++-- src/main/resources/kotlin/build.gradle.hbs | 2 +- 20 files changed, 54 insertions(+), 60 deletions(-) diff --git a/.circleci/testJava17ClientSamples.sh b/.circleci/testJava17ClientSamples.sh index bb5187fb8b3..10214f87aed 100644 --- a/.circleci/testJava17ClientSamples.sh +++ b/.circleci/testJava17ClientSamples.sh @@ -1,3 +1,3 @@ - (cd samples/client/petstore/java && gradle wrapper && gradle test) + (cd samples/client/petstore/java && gradle wrapper && gradlew test --no-daemon) (cd samples/client/3_0_3_unit_test/java && mvn test) (cd samples/client/3_1_0_unit_test/java && mvn test) \ No newline at end of file diff --git a/.circleci/testKotlinClientSamples.sh b/.circleci/testKotlinClientSamples.sh index 6026e0ad461..bd90fec52df 100644 --- a/.circleci/testKotlinClientSamples.sh +++ b/.circleci/testKotlinClientSamples.sh @@ -1,2 +1,2 @@ - (cd samples/client/3_0_3_unit_test/kotlin && gradle wrapper && ./gradlew cleanTest test) - (cd samples/client/3_1_0_unit_test/kotlin && gradle wrapper && ./gradlew cleanTest test) \ No newline at end of file + (cd samples/client/3_0_3_unit_test/kotlin && gradle wrapper && ./gradlew cleanTest test --no-daemon) + (cd samples/client/3_1_0_unit_test/kotlin && gradle wrapper && ./gradlew cleanTest test --no-daemon) \ No newline at end of file diff --git a/docs/generators/kotlin.md b/docs/generators/kotlin.md index 763d5c79063..cfdad519700 100644 --- a/docs/generators/kotlin.md +++ b/docs/generators/kotlin.md @@ -142,6 +142,7 @@ These options may be applied as additional-properties (cli) or configOptions (pl
  • tailrec
  • this
  • throw
  • +
  • tostring
  • true
  • try
  • typealias
  • diff --git a/samples/client/3_0_3_unit_test/kotlin/README.md b/samples/client/3_0_3_unit_test/kotlin/README.md index 90844f8e353..7420e97162c 100644 --- a/samples/client/3_0_3_unit_test/kotlin/README.md +++ b/samples/client/3_0_3_unit_test/kotlin/README.md @@ -49,11 +49,11 @@ Here is the mapping from json schema types to Kotlin types: | object | FrozenMap (Map) | | array | FrozenList (List) | | string | String | -| number | Number (int, long, float, double) | -| integer | int, long, float, double (with values equal to integers) | -| boolean | boolean | +| number | Number (Int, Long, Float, Double) | +| integer | Int, Long, Float, Double (with values equal to integers) | +| boolean | Boolean | | null | Nothing? (null) | -| AnyType (unset) | Object? | +| AnyType (unset) | Any? | ### Storage of Json Schema Definition in Kotlin JsonSchema Classes In openapi v3.0.3 there are ~ 28 json schema keywords. Almost all of them can apply if diff --git a/samples/client/3_0_3_unit_test/kotlin/build.gradle.kts b/samples/client/3_0_3_unit_test/kotlin/build.gradle.kts index bb4941552b0..1cd327c8027 100644 --- a/samples/client/3_0_3_unit_test/kotlin/build.gradle.kts +++ b/samples/client/3_0_3_unit_test/kotlin/build.gradle.kts @@ -34,6 +34,6 @@ tasks.wrapper { tasks.test { useJUnitPlatform() testLogging { - events( "started", "passed", "skipped", "failed") + events("passed", "skipped", "failed") } } diff --git a/samples/client/3_0_3_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/schemas/RefInAdditionalproperties.kt b/samples/client/3_0_3_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/schemas/RefInAdditionalproperties.kt index 7783daeab08..82108cf82fc 100644 --- a/samples/client/3_0_3_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/schemas/RefInAdditionalproperties.kt +++ b/samples/client/3_0_3_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/schemas/RefInAdditionalproperties.kt @@ -178,7 +178,7 @@ class RefInAdditionalproperties { } val propertySchema: JsonSchema<*> = schemas.entries.iterator().next().key val propertyInstance: Any? = propertySchema.getNewInstance(value, propertyPathToItem, pathToSchemas) - if (!(propertyInstance is Any)) { + if (!(propertyInstance is Any?)) { throw RuntimeException("Invalid instantiated value") } properties[entryKey] = propertyInstance diff --git a/samples/client/3_0_3_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/schemas/RefInItems.kt b/samples/client/3_0_3_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/schemas/RefInItems.kt index bfcdf273f6a..f56ab91e736 100644 --- a/samples/client/3_0_3_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/schemas/RefInItems.kt +++ b/samples/client/3_0_3_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/schemas/RefInItems.kt @@ -127,7 +127,7 @@ class RefInItems { } val itemSchema: JsonSchema<*> = schemas.entries.iterator().next().key val itemInstance: Any? = itemSchema.getNewInstance(item, itemPathToItem, pathToSchemas) - if (!(itemInstance is Any)) { + if (!(itemInstance is Any?)) { throw RuntimeException("Invalid instantiated value") } items.add(itemInstance) diff --git a/samples/client/3_0_3_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/schemas/RefInProperty.kt b/samples/client/3_0_3_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/schemas/RefInProperty.kt index e0988c5f58f..d914b13af1d 100644 --- a/samples/client/3_0_3_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/schemas/RefInProperty.kt +++ b/samples/client/3_0_3_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/schemas/RefInProperty.kt @@ -43,7 +43,7 @@ class RefInProperty { val key = "a" throwIfKeyNotPresent(key) val value: Any? = get(key) - if (!(value is Any)) { + if (!(value is Any?)) { throw RuntimeException("Invalid value stored for a") } return value diff --git a/samples/client/3_1_0_unit_test/java/docs/components/schemas/NonAsciiPatternWithAdditionalproperties.md b/samples/client/3_1_0_unit_test/java/docs/components/schemas/NonAsciiPatternWithAdditionalproperties.md index 6a63f2af1d2..46058bafc99 100644 --- a/samples/client/3_1_0_unit_test/java/docs/components/schemas/NonAsciiPatternWithAdditionalproperties.md +++ b/samples/client/3_1_0_unit_test/java/docs/components/schemas/NonAsciiPatternWithAdditionalproperties.md @@ -122,14 +122,14 @@ A class that builds the Map input type ## NonAsciiPatternWithAdditionalpropertiesMap public static class NonAsciiPatternWithAdditionalpropertiesMap
    -extends FrozenMap +extends FrozenMap A class to store validated Map payloads ### Method Summary | Modifier and Type | Method and Description | | ----------------- | ---------------------- | -| static [NonAsciiPatternWithAdditionalpropertiesMap](#nonasciipatternwithadditionalpropertiesmap) | of([Map](#nonasciipatternwithadditionalpropertiesmapbuilder) arg, SchemaConfiguration configuration) | +| static [NonAsciiPatternWithAdditionalpropertiesMap](#nonasciipatternwithadditionalpropertiesmap) | of([Map](#nonasciipatternwithadditionalpropertiesmapbuilder) arg, SchemaConfiguration configuration) | ## CircumflexAccentLatinSmallLetterAWithAcuteBoxed public sealed interface CircumflexAccentLatinSmallLetterAWithAcuteBoxed
    diff --git a/samples/client/3_1_0_unit_test/java/docs/components/schemas/PropertiesPatternpropertiesAdditionalpropertiesInteraction.md b/samples/client/3_1_0_unit_test/java/docs/components/schemas/PropertiesPatternpropertiesAdditionalpropertiesInteraction.md index bf391634266..7b0d299f2d5 100644 --- a/samples/client/3_1_0_unit_test/java/docs/components/schemas/PropertiesPatternpropertiesAdditionalpropertiesInteraction.md +++ b/samples/client/3_1_0_unit_test/java/docs/components/schemas/PropertiesPatternpropertiesAdditionalpropertiesInteraction.md @@ -110,7 +110,7 @@ PropertiesPatternpropertiesAdditionalpropertiesInteraction.PropertiesPatternprop ## PropertiesPatternpropertiesAdditionalpropertiesInteractionMapBuilder public class PropertiesPatternpropertiesAdditionalpropertiesInteractionMapBuilder
    -builder for `Map` +builder for `Map` A class that builds the Map input type @@ -122,7 +122,7 @@ A class that builds the Map input type ### Method Summary | Modifier and Type | Method and Description | | ----------------- | ---------------------- | -| Map | build()
    Returns map input that should be used with Schema.validate | +| Map | build()
    Returns map input that should be used with Schema.validate | | [PropertiesPatternpropertiesAdditionalpropertiesInteractionMapBuilder](#propertiespatternpropertiesadditionalpropertiesinteractionmapbuilder) | foo(List<@Nullable Object> value) | | [PropertiesPatternpropertiesAdditionalpropertiesInteractionMapBuilder](#propertiespatternpropertiesadditionalpropertiesinteractionmapbuilder) | bar(List<@Nullable Object> value) | | [PropertiesPatternpropertiesAdditionalpropertiesInteractionMapBuilder](#propertiespatternpropertiesadditionalpropertiesinteractionmapbuilder) | additionalProperty(String key, int value) | @@ -132,14 +132,14 @@ A class that builds the Map input type ## PropertiesPatternpropertiesAdditionalpropertiesInteractionMap public static class PropertiesPatternpropertiesAdditionalpropertiesInteractionMap
    -extends FrozenMap +extends FrozenMap A class to store validated Map payloads ### Method Summary | Modifier and Type | Method and Description | | ----------------- | ---------------------- | -| static [PropertiesPatternpropertiesAdditionalpropertiesInteractionMap](#propertiespatternpropertiesadditionalpropertiesinteractionmap) | of([Map](#propertiespatternpropertiesadditionalpropertiesinteractionmapbuilder) arg, SchemaConfiguration configuration) | +| static [PropertiesPatternpropertiesAdditionalpropertiesInteractionMap](#propertiespatternpropertiesadditionalpropertiesinteractionmap) | of([Map](#propertiespatternpropertiesadditionalpropertiesinteractionmapbuilder) arg, SchemaConfiguration configuration) | | FrozenList | foo()
    [optional] | | FrozenList | bar()
    [optional] | | Number | getAdditionalProperty(String name)
    provides type safety for additional properties | diff --git a/samples/client/3_1_0_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/NonAsciiPatternWithAdditionalproperties.java b/samples/client/3_1_0_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/NonAsciiPatternWithAdditionalproperties.java index 3a1d5df8000..a9209bbc857 100644 --- a/samples/client/3_1_0_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/NonAsciiPatternWithAdditionalproperties.java +++ b/samples/client/3_1_0_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/NonAsciiPatternWithAdditionalproperties.java @@ -58,7 +58,7 @@ protected NonAsciiPatternWithAdditionalpropertiesMap(FrozenMap<@Nullable Object> public static final Set requiredKeys = Set.of(); public static final Set optionalKeys = Set.of(); // map with no key value pairs - public static NonAsciiPatternWithAdditionalpropertiesMap of(Map arg, SchemaConfiguration configuration) throws ValidationException { + public static NonAsciiPatternWithAdditionalpropertiesMap of(Map arg, SchemaConfiguration configuration) throws ValidationException { return NonAsciiPatternWithAdditionalproperties1.getInstance().validate(arg, configuration); } } diff --git a/samples/client/3_1_0_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/PropertiesPatternpropertiesAdditionalpropertiesInteraction.java b/samples/client/3_1_0_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/PropertiesPatternpropertiesAdditionalpropertiesInteraction.java index 539e323c402..48fab7f7767 100644 --- a/samples/client/3_1_0_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/PropertiesPatternpropertiesAdditionalpropertiesInteraction.java +++ b/samples/client/3_1_0_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/PropertiesPatternpropertiesAdditionalpropertiesInteraction.java @@ -435,8 +435,8 @@ public static Bar getInstance() { } - public static class PropertiesPatternpropertiesAdditionalpropertiesInteractionMap extends FrozenMap { - protected PropertiesPatternpropertiesAdditionalpropertiesInteractionMap(FrozenMap m) { + public static class PropertiesPatternpropertiesAdditionalpropertiesInteractionMap extends FrozenMap<@Nullable Object> { + protected PropertiesPatternpropertiesAdditionalpropertiesInteractionMap(FrozenMap<@Nullable Object> m) { super(m); } public static final Set requiredKeys = Set.of(); @@ -444,14 +444,14 @@ protected PropertiesPatternpropertiesAdditionalpropertiesInteractionMap(FrozenMa "foo", "bar" ); - public static PropertiesPatternpropertiesAdditionalpropertiesInteractionMap of(Map arg, SchemaConfiguration configuration) throws ValidationException { + public static PropertiesPatternpropertiesAdditionalpropertiesInteractionMap of(Map arg, SchemaConfiguration configuration) throws ValidationException { return PropertiesPatternpropertiesAdditionalpropertiesInteraction1.getInstance().validate(arg, configuration); } public FrozenList foo() throws UnsetPropertyException { String key = "foo"; throwIfKeyNotPresent(key); - Object value = get(key); + @Nullable Object value = get(key); if (!(value instanceof FrozenList)) { throw new RuntimeException("Invalid value stored for foo"); } @@ -461,7 +461,7 @@ public FrozenList foo() throws UnsetPropertyException { public FrozenList bar() throws UnsetPropertyException { String key = "bar"; throwIfKeyNotPresent(key); - Object value = get(key); + @Nullable Object value = get(key); if (!(value instanceof FrozenList)) { throw new RuntimeException("Invalid value stored for bar"); } @@ -479,8 +479,8 @@ public Number getAdditionalProperty(String name) throws UnsetPropertyException, } public interface SetterForFoo { - Map getInstance(); - T getBuilderAfterFoo(Map instance); + Map getInstance(); + T getBuilderAfterFoo(Map instance); default T foo(List<@Nullable Object> value) { var instance = getInstance(); @@ -490,8 +490,8 @@ default T foo(List<@Nullable Object> value) { } public interface SetterForBar { - Map getInstance(); - T getBuilderAfterBar(Map instance); + Map getInstance(); + T getBuilderAfterBar(Map instance); default T bar(List<@Nullable Object> value) { var instance = getInstance(); @@ -502,8 +502,8 @@ default T bar(List<@Nullable Object> value) { public interface SetterForAdditionalProperties { Set getKnownKeys(); - Map getInstance(); - T getBuilderAfterAdditionalProperty(Map instance); + Map getInstance(); + T getBuilderAfterAdditionalProperty(Map instance); default T additionalProperty(String key, int value) throws InvalidAdditionalPropertyException { MapUtils.throwIfKeyKnown(key, getKnownKeys(), true); @@ -534,8 +534,8 @@ default T additionalProperty(String key, double value) throws InvalidAdditionalP } } - public static class PropertiesPatternpropertiesAdditionalpropertiesInteractionMapBuilder implements GenericBuilder>, SetterForFoo, SetterForBar, SetterForAdditionalProperties { - private final Map instance; + public static class PropertiesPatternpropertiesAdditionalpropertiesInteractionMapBuilder implements GenericBuilder>, SetterForFoo, SetterForBar, SetterForAdditionalProperties { + private final Map instance; private static final Set knownKeys = Set.of( "foo", "bar" @@ -546,19 +546,19 @@ public Set getKnownKeys() { public PropertiesPatternpropertiesAdditionalpropertiesInteractionMapBuilder() { this.instance = new LinkedHashMap<>(); } - public Map build() { + public Map build() { return instance; } - public Map getInstance() { + public Map getInstance() { return instance; } - public PropertiesPatternpropertiesAdditionalpropertiesInteractionMapBuilder getBuilderAfterFoo(Map instance) { + public PropertiesPatternpropertiesAdditionalpropertiesInteractionMapBuilder getBuilderAfterFoo(Map instance) { return this; } - public PropertiesPatternpropertiesAdditionalpropertiesInteractionMapBuilder getBuilderAfterBar(Map instance) { + public PropertiesPatternpropertiesAdditionalpropertiesInteractionMapBuilder getBuilderAfterBar(Map instance) { return this; } - public PropertiesPatternpropertiesAdditionalpropertiesInteractionMapBuilder getBuilderAfterAdditionalProperty(Map instance) { + public PropertiesPatternpropertiesAdditionalpropertiesInteractionMapBuilder getBuilderAfterAdditionalProperty(Map instance) { return this; } } @@ -607,7 +607,7 @@ public static PropertiesPatternpropertiesAdditionalpropertiesInteraction1 getIns } public PropertiesPatternpropertiesAdditionalpropertiesInteractionMap getNewInstance(Map arg, List pathToItem, PathToSchemasMap pathToSchemas) { - LinkedHashMap properties = new LinkedHashMap<>(); + LinkedHashMap properties = new LinkedHashMap<>(); for(Map.Entry entry: arg.entrySet()) { @Nullable Object entryKey = entry.getKey(); if (!(entryKey instanceof String)) { @@ -623,12 +623,9 @@ public PropertiesPatternpropertiesAdditionalpropertiesInteractionMap getNewInsta } JsonSchema propertySchema = schemas.entrySet().iterator().next().getKey(); @Nullable Object propertyInstance = propertySchema.getNewInstance(value, propertyPathToItem, pathToSchemas); - if (!(propertyInstance instanceof Object)) { - throw new RuntimeException("Invalid instantiated value"); - } - properties.put(propertyName, (Object) propertyInstance); + properties.put(propertyName, propertyInstance); } - FrozenMap castProperties = new FrozenMap<>(properties); + FrozenMap<@Nullable Object> castProperties = new FrozenMap<>(properties); return new PropertiesPatternpropertiesAdditionalpropertiesInteractionMap(castProperties); } diff --git a/samples/client/3_1_0_unit_test/kotlin/README.md b/samples/client/3_1_0_unit_test/kotlin/README.md index 34899ae0c73..f4fecdfbac4 100644 --- a/samples/client/3_1_0_unit_test/kotlin/README.md +++ b/samples/client/3_1_0_unit_test/kotlin/README.md @@ -49,11 +49,11 @@ Here is the mapping from json schema types to Kotlin types: | object | FrozenMap (Map) | | array | FrozenList (List) | | string | String | -| number | Number (int, long, float, double) | -| integer | int, long, float, double (with values equal to integers) | -| boolean | boolean | +| number | Number (Int, Long, Float, Double) | +| integer | Int, Long, Float, Double (with values equal to integers) | +| boolean | Boolean | | null | Nothing? (null) | -| AnyType (unset) | Object? | +| AnyType (unset) | Any? | ### Storage of Json Schema Definition in Kotlin JsonSchema Classes In openapi v3.0.3 there are ~ 28 json schema keywords. Almost all of them can apply if diff --git a/samples/client/3_1_0_unit_test/kotlin/build.gradle.kts b/samples/client/3_1_0_unit_test/kotlin/build.gradle.kts index bb4941552b0..1cd327c8027 100644 --- a/samples/client/3_1_0_unit_test/kotlin/build.gradle.kts +++ b/samples/client/3_1_0_unit_test/kotlin/build.gradle.kts @@ -34,6 +34,6 @@ tasks.wrapper { tasks.test { useJUnitPlatform() testLogging { - events( "started", "passed", "skipped", "failed") + events("passed", "skipped", "failed") } } diff --git a/samples/client/3_1_0_unit_test/python/docs/components/schema/non_ascii_pattern_with_additionalproperties.md b/samples/client/3_1_0_unit_test/python/docs/components/schema/non_ascii_pattern_with_additionalproperties.md index f0f000fa7b2..e0084fbe07c 100644 --- a/samples/client/3_1_0_unit_test/python/docs/components/schema/non_ascii_pattern_with_additionalproperties.md +++ b/samples/client/3_1_0_unit_test/python/docs/components/schema/non_ascii_pattern_with_additionalproperties.md @@ -19,6 +19,7 @@ Key | Type | Description | Notes ## NonAsciiPatternWithAdditionalpropertiesDict ``` base class: schemas.immutabledict[str, schemas.OUTPUT_BASE_TYPES] + ``` ### __new__ method Keyword Argument | Type | Description | Notes diff --git a/samples/client/3_1_0_unit_test/python/docs/components/schema/properties_patternproperties_additionalproperties_interaction.md b/samples/client/3_1_0_unit_test/python/docs/components/schema/properties_patternproperties_additionalproperties_interaction.md index 3b9c58ea6cb..1026ad928fd 100644 --- a/samples/client/3_1_0_unit_test/python/docs/components/schema/properties_patternproperties_additionalproperties_interaction.md +++ b/samples/client/3_1_0_unit_test/python/docs/components/schema/properties_patternproperties_additionalproperties_interaction.md @@ -34,10 +34,7 @@ Key | Type | Description | Notes ## PropertiesPatternpropertiesAdditionalpropertiesInteractionDict ``` -base class: schemas.immutabledict[str, typing.Union[ - typing.Tuple[schemas.OUTPUT_BASE_TYPES], - int, -]] +base class: schemas.immutabledict[str, schemas.OUTPUT_BASE_TYPES] ``` ### __new__ method diff --git a/samples/client/3_1_0_unit_test/python/src/unit_test_api/components/schema/non_ascii_pattern_with_additionalproperties.py b/samples/client/3_1_0_unit_test/python/src/unit_test_api/components/schema/non_ascii_pattern_with_additionalproperties.py index 17a3bdf903a..c1a29f44cf9 100644 --- a/samples/client/3_1_0_unit_test/python/src/unit_test_api/components/schema/non_ascii_pattern_with_additionalproperties.py +++ b/samples/client/3_1_0_unit_test/python/src/unit_test_api/components/schema/non_ascii_pattern_with_additionalproperties.py @@ -15,6 +15,7 @@ class NonAsciiPatternWithAdditionalpropertiesDict(schemas.immutabledict[str, schemas.OUTPUT_BASE_TYPES]): + __required_keys__: typing.FrozenSet[str] = frozenset({ }) __optional_keys__: typing.FrozenSet[str] = frozenset({ diff --git a/samples/client/3_1_0_unit_test/python/src/unit_test_api/components/schema/properties_patternproperties_additionalproperties_interaction.py b/samples/client/3_1_0_unit_test/python/src/unit_test_api/components/schema/properties_patternproperties_additionalproperties_interaction.py index 72a898c548a..0e876a03b95 100644 --- a/samples/client/3_1_0_unit_test/python/src/unit_test_api/components/schema/properties_patternproperties_additionalproperties_interaction.py +++ b/samples/client/3_1_0_unit_test/python/src/unit_test_api/components/schema/properties_patternproperties_additionalproperties_interaction.py @@ -52,10 +52,7 @@ def validate( ) -class PropertiesPatternpropertiesAdditionalpropertiesInteractionDict(schemas.immutabledict[str, typing.Union[ - typing.Tuple[schemas.OUTPUT_BASE_TYPES], - int, -]]): +class PropertiesPatternpropertiesAdditionalpropertiesInteractionDict(schemas.immutabledict[str, schemas.OUTPUT_BASE_TYPES]): __required_keys__: typing.FrozenSet[str] = frozenset({ }) diff --git a/src/main/resources/kotlin/README.hbs b/src/main/resources/kotlin/README.hbs index 5298ea78298..cc95baee1e0 100644 --- a/src/main/resources/kotlin/README.hbs +++ b/src/main/resources/kotlin/README.hbs @@ -55,11 +55,11 @@ Here is the mapping from json schema types to Kotlin types: | object | FrozenMap (Map) | | array | FrozenList (List) | | string | String | -| number | Number (int, long, float, double) | -| integer | int, long, float, double (with values equal to integers) | -| boolean | boolean | +| number | Number (Int, Long, Float, Double) | +| integer | Int, Long, Float, Double (with values equal to integers) | +| boolean | Boolean | | null | Nothing? (null) | -| AnyType (unset) | Object? | +| AnyType (unset) | Any? | ### Storage of Json Schema Definition in Kotlin JsonSchema Classes In openapi v3.0.3 there are ~ 28 json schema keywords. Almost all of them can apply if diff --git a/src/main/resources/kotlin/build.gradle.hbs b/src/main/resources/kotlin/build.gradle.hbs index 5e65fb87a42..bf2dd311abb 100644 --- a/src/main/resources/kotlin/build.gradle.hbs +++ b/src/main/resources/kotlin/build.gradle.hbs @@ -34,6 +34,6 @@ tasks.wrapper { tasks.test { useJUnitPlatform() testLogging { - events( "started", "passed", "skipped", "failed") + events("passed", "skipped", "failed") } } From 731a2385af62391f72aeae1e02aaa5a50965d62d Mon Sep 17 00:00:00 2001 From: Justin Black Date: Sat, 18 May 2024 18:32:51 -0700 Subject: [PATCH 70/78] Adjusts gradlew command --- .circleci/testJava17ClientSamples.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.circleci/testJava17ClientSamples.sh b/.circleci/testJava17ClientSamples.sh index 10214f87aed..41a29903f25 100644 --- a/.circleci/testJava17ClientSamples.sh +++ b/.circleci/testJava17ClientSamples.sh @@ -1,3 +1,3 @@ - (cd samples/client/petstore/java && gradle wrapper && gradlew test --no-daemon) + (cd samples/client/petstore/java && gradle wrapper && ./gradlew test --no-daemon) (cd samples/client/3_0_3_unit_test/java && mvn test) (cd samples/client/3_1_0_unit_test/java && mvn test) \ No newline at end of file From 2fa9be6a9ea308604ee05bb2b81c3bb0a491e737 Mon Sep 17 00:00:00 2001 From: Justin Black Date: Sun, 19 May 2024 17:15:10 -0700 Subject: [PATCH 71/78] Update build file to increase the max jvm memory limit when compiling --- samples/client/3_0_3_unit_test/kotlin/build.gradle.kts | 4 ++++ samples/client/3_1_0_unit_test/kotlin/build.gradle.kts | 4 ++++ src/main/resources/kotlin/build.gradle.hbs | 4 ++++ 3 files changed, 12 insertions(+) diff --git a/samples/client/3_0_3_unit_test/kotlin/build.gradle.kts b/samples/client/3_0_3_unit_test/kotlin/build.gradle.kts index 1cd327c8027..89ec940cc0d 100644 --- a/samples/client/3_0_3_unit_test/kotlin/build.gradle.kts +++ b/samples/client/3_0_3_unit_test/kotlin/build.gradle.kts @@ -31,6 +31,10 @@ tasks.wrapper { gradleVersion = "8.1.1" } +tasks.compileKotlin { + kotlinDaemonJvmArguments.add("-Xmx256m") +} + tasks.test { useJUnitPlatform() testLogging { diff --git a/samples/client/3_1_0_unit_test/kotlin/build.gradle.kts b/samples/client/3_1_0_unit_test/kotlin/build.gradle.kts index 1cd327c8027..89ec940cc0d 100644 --- a/samples/client/3_1_0_unit_test/kotlin/build.gradle.kts +++ b/samples/client/3_1_0_unit_test/kotlin/build.gradle.kts @@ -31,6 +31,10 @@ tasks.wrapper { gradleVersion = "8.1.1" } +tasks.compileKotlin { + kotlinDaemonJvmArguments.add("-Xmx256m") +} + tasks.test { useJUnitPlatform() testLogging { diff --git a/src/main/resources/kotlin/build.gradle.hbs b/src/main/resources/kotlin/build.gradle.hbs index bf2dd311abb..17119eadfe8 100644 --- a/src/main/resources/kotlin/build.gradle.hbs +++ b/src/main/resources/kotlin/build.gradle.hbs @@ -31,6 +31,10 @@ tasks.wrapper { gradleVersion = "8.1.1" } +tasks.compileKotlin { + kotlinDaemonJvmArguments.add("-Xmx256m") +} + tasks.test { useJUnitPlatform() testLogging { From ec334a61990d359633e5f7f4239d0f1602531a49 Mon Sep 17 00:00:00 2001 From: Justin Black Date: Sun, 19 May 2024 17:20:06 -0700 Subject: [PATCH 72/78] Removes nodaemon arg on gradle test invocation --- .circleci/testKotlinClientSamples.sh | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.circleci/testKotlinClientSamples.sh b/.circleci/testKotlinClientSamples.sh index bd90fec52df..6026e0ad461 100644 --- a/.circleci/testKotlinClientSamples.sh +++ b/.circleci/testKotlinClientSamples.sh @@ -1,2 +1,2 @@ - (cd samples/client/3_0_3_unit_test/kotlin && gradle wrapper && ./gradlew cleanTest test --no-daemon) - (cd samples/client/3_1_0_unit_test/kotlin && gradle wrapper && ./gradlew cleanTest test --no-daemon) \ No newline at end of file + (cd samples/client/3_0_3_unit_test/kotlin && gradle wrapper && ./gradlew cleanTest test) + (cd samples/client/3_1_0_unit_test/kotlin && gradle wrapper && ./gradlew cleanTest test) \ No newline at end of file From d56bb223702916f3ed4757ecd7a60d46a2fe8ba1 Mon Sep 17 00:00:00 2001 From: Justin Black Date: Sun, 19 May 2024 17:24:34 -0700 Subject: [PATCH 73/78] Adds info logging to 310 gradle test --- .circleci/testKotlinClientSamples.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.circleci/testKotlinClientSamples.sh b/.circleci/testKotlinClientSamples.sh index 6026e0ad461..3e37af28f15 100644 --- a/.circleci/testKotlinClientSamples.sh +++ b/.circleci/testKotlinClientSamples.sh @@ -1,2 +1,2 @@ (cd samples/client/3_0_3_unit_test/kotlin && gradle wrapper && ./gradlew cleanTest test) - (cd samples/client/3_1_0_unit_test/kotlin && gradle wrapper && ./gradlew cleanTest test) \ No newline at end of file + (cd samples/client/3_1_0_unit_test/kotlin && gradle wrapper && ./gradlew cleanTest test -info) \ No newline at end of file From f5ff4d87758d90abed6a34a29bdd0342d22a5165 Mon Sep 17 00:00:00 2001 From: Justin Black Date: Mon, 20 May 2024 09:32:31 -0700 Subject: [PATCH 74/78] Adds info logging --- .circleci/testKotlinClientSamples.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.circleci/testKotlinClientSamples.sh b/.circleci/testKotlinClientSamples.sh index 3e37af28f15..d1a438304da 100644 --- a/.circleci/testKotlinClientSamples.sh +++ b/.circleci/testKotlinClientSamples.sh @@ -1,2 +1,2 @@ - (cd samples/client/3_0_3_unit_test/kotlin && gradle wrapper && ./gradlew cleanTest test) + (cd samples/client/3_0_3_unit_test/kotlin && gradle wrapper && ./gradlew cleanTest test -info) (cd samples/client/3_1_0_unit_test/kotlin && gradle wrapper && ./gradlew cleanTest test -info) \ No newline at end of file From b832b9532e6d5caf607e966be99197a40109b7ec Mon Sep 17 00:00:00 2001 From: Justin Black Date: Mon, 20 May 2024 10:24:49 -0700 Subject: [PATCH 75/78] Increases memory to 512 mB --- samples/client/3_0_3_unit_test/kotlin/build.gradle.kts | 2 +- samples/client/3_1_0_unit_test/kotlin/build.gradle.kts | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/samples/client/3_0_3_unit_test/kotlin/build.gradle.kts b/samples/client/3_0_3_unit_test/kotlin/build.gradle.kts index 89ec940cc0d..5f488f402fa 100644 --- a/samples/client/3_0_3_unit_test/kotlin/build.gradle.kts +++ b/samples/client/3_0_3_unit_test/kotlin/build.gradle.kts @@ -32,7 +32,7 @@ tasks.wrapper { } tasks.compileKotlin { - kotlinDaemonJvmArguments.add("-Xmx256m") + kotlinDaemonJvmArguments.add("-Xmx512m") } tasks.test { diff --git a/samples/client/3_1_0_unit_test/kotlin/build.gradle.kts b/samples/client/3_1_0_unit_test/kotlin/build.gradle.kts index 89ec940cc0d..5f488f402fa 100644 --- a/samples/client/3_1_0_unit_test/kotlin/build.gradle.kts +++ b/samples/client/3_1_0_unit_test/kotlin/build.gradle.kts @@ -32,7 +32,7 @@ tasks.wrapper { } tasks.compileKotlin { - kotlinDaemonJvmArguments.add("-Xmx256m") + kotlinDaemonJvmArguments.add("-Xmx512m") } tasks.test { From dfc5f4717b19a7089d98609b8d3153372fd02b19 Mon Sep 17 00:00:00 2001 From: Justin Black Date: Mon, 20 May 2024 10:32:30 -0700 Subject: [PATCH 76/78] Increases memory to 1 g --- samples/client/3_0_3_unit_test/kotlin/build.gradle.kts | 2 +- samples/client/3_1_0_unit_test/kotlin/build.gradle.kts | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/samples/client/3_0_3_unit_test/kotlin/build.gradle.kts b/samples/client/3_0_3_unit_test/kotlin/build.gradle.kts index 5f488f402fa..882b3b35624 100644 --- a/samples/client/3_0_3_unit_test/kotlin/build.gradle.kts +++ b/samples/client/3_0_3_unit_test/kotlin/build.gradle.kts @@ -32,7 +32,7 @@ tasks.wrapper { } tasks.compileKotlin { - kotlinDaemonJvmArguments.add("-Xmx512m") + kotlinDaemonJvmArguments.add("-Xmx1g") } tasks.test { diff --git a/samples/client/3_1_0_unit_test/kotlin/build.gradle.kts b/samples/client/3_1_0_unit_test/kotlin/build.gradle.kts index 5f488f402fa..882b3b35624 100644 --- a/samples/client/3_1_0_unit_test/kotlin/build.gradle.kts +++ b/samples/client/3_1_0_unit_test/kotlin/build.gradle.kts @@ -32,7 +32,7 @@ tasks.wrapper { } tasks.compileKotlin { - kotlinDaemonJvmArguments.add("-Xmx512m") + kotlinDaemonJvmArguments.add("-Xmx1g") } tasks.test { From e4a788de5fc653c9ba1112cb7a08690ea1862b74 Mon Sep 17 00:00:00 2001 From: Justin Black Date: Mon, 20 May 2024 10:44:44 -0700 Subject: [PATCH 77/78] Updates template default to 1g --- src/main/resources/kotlin/build.gradle.hbs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/main/resources/kotlin/build.gradle.hbs b/src/main/resources/kotlin/build.gradle.hbs index 17119eadfe8..c9036f371c4 100644 --- a/src/main/resources/kotlin/build.gradle.hbs +++ b/src/main/resources/kotlin/build.gradle.hbs @@ -32,7 +32,7 @@ tasks.wrapper { } tasks.compileKotlin { - kotlinDaemonJvmArguments.add("-Xmx256m") + kotlinDaemonJvmArguments.add("-Xmx1g") } tasks.test { From 9ab973efea792eb08d11787e02a988225c4575cc Mon Sep 17 00:00:00 2001 From: Justin Black Date: Mon, 20 May 2024 11:15:08 -0700 Subject: [PATCH 78/78] Readme updated --- README.md | 103 ++++++++++++++---------------------------------------- 1 file changed, 27 insertions(+), 76 deletions(-) diff --git a/README.md b/README.md index dbe64fc7c44..31520b5cf87 100644 --- a/README.md +++ b/README.md @@ -15,89 +15,40 @@ so developers can use all of those features. Currently, the following languages/frameworks are supported: -- python (Stability: Stable) -- java (Stability: Stable) - -## Join Our Community -We use a Discord server as a place to ask questions and help each other. It offers functionality very similar to Slack. -You can join us here: https://discord.gg/mHB8WEQuYQ - -## Reasons To Use the Python Generator - -- v3.0.0 - [v3.1.0*](#openapi-v310-support) OpenAPI Specification support -- Type hints on - - schema payload inputs in SomeSchema.validate ![validate screen capture](docs/schema_validate.gif) - - Note: to make input dictionaries TypedDicts like the Money.validate example, set additionalProperties to false in the schema in your openapi document - - schema keyword argument inputs in `SomeSchemaDict.__new__` ![validate screen capture](docs/schemadict_new.gif) - - accessing properties in object instances so some_val in some_val = some_inst.someKey will have the correct type hint ![instance properties screen capture](docs/instance_properties.gif) - - accessing array items in array instances so some_val in some_val = array_inst[0] will have the correct type hint - - endpoint inputs + responses -- Run time type checking and validation checking when: - - instantiating models - - sending to endpoints - - receiving from endpoints - - Note: if needed, validation of json schema keywords can be deactivated via a SchemaConfiguration class -- [mypy](samples/client/petstore/python/test_python.sh) runs on sample petstore client and passes - - passing mypy tests means that this generator could be ported into compiled languages like java/kotlin/golang -- [Autogenerated thorough testing of json schema keyword features in models and endpoints](https://github.com/openapi-json-schema-tools/openapi-json-schema-generator/tree/master/samples/client/3_0_3_unit_test/python/test) which come from the [json schema test suite](https://github.com/json-schema-org/JSON-Schema-Test-Suite) -- [Tests are passing in CI](https://app.circleci.com/pipelines/github/openapi-json-schema-tools/openapi-json-schema-generator?branch=master) -- [Test endpoints are tagged by the relevant keyword like type/format/allOf 39 keywords and counting](https://github.com/openapi-json-schema-tools/openapi-json-schema-generator/tree/master/samples/client/3_1_0_unit_test/python/docs/apis/tags) -- Code re-use built in from the ground up - - components/schemas/headers etc are generated as separate classes and imported when used via $ref -- Openapi spec inline schemas supported at any depth in any location +| Feature | [Python](docs/generators/python.md) | [Java](docs/generators/java.md) | [Kotlin](docs/generators/kotlin.md) | +|----------------------------------------------------------------------------------------------------|-------------------------------------|---------------------------------|-------------------------------------| +| Generator status | stable | stable | experimental | +| Openapi v3.0.0-3.1.0 ingestion | X | X | X | +| Json Schema 2020-12 Support (components/schemas) | X | X | X | +| Component schemas documentation produced | X | X | X | +| Documentation produced for other component types:
    headers, parameters,requestBodies, ressponses | X | X | | +| Endpoints that send/receive json + docs generated for them | X | X | | + +## Reasons To Use the Generators +- Openapi spec support for v3.0.0-3.1.0 + - thorough tests run in CI using json schema test suite, see 3_0_0 and 3_1_0 sample clients +- Static analysis: + - mypy run in CI against python petstore sample + - checker framework run w/ NullnessChecker, ensures no null pointer exceptions - Format support for: int32, int64, float, double, binary, date, datetime, uuid -- Invalid (in python) property names supported like `from`, `1var`, `hi-there` etc in +- Invalid (in language) property names supported like `from`, `1var`, `hi-there` etc in - schema property names - endpoint parameter names +- Openapi document inline schemas supported at any depth in any location +- Generated Code: Class + method inputs are typed +- Generated Code: Static type checking done in static languages suing builder inputs and class property access +- Generated Code: run-time type checking done in all generators (a payload can be validated against n schemas) +- Generated Code re-use built in from the ground up + - components/schemas/headers etc are generated as separate classes and imported when used via $ref - Payload values are not coerced when validated, so a date/date-time value can pass other validations that describe the payload only as type string -- types are generated for enums of type string/integer/boolean using typing.Literal - String transmission of numbers supported with type: string, format: number, value can be accessed as a Decimal with schemas.as_decimal(inst) - Multiple content types supported for request and response bodies -- Endpoint response always also includes the urllib3.HTTPResponse -- Endpoint response deserialization can be skipped with the skip_deserialization argument +- Endpoint response always also includes the raw response +- Interfaces kept consistent across generated languages -And many more! -- [Docs for the python generator](docs/generators/python.md) -- [generated client sample code](samples/client/petstore/python) - - [Openapi v3.0.3 general petstore spec, general features](src/test/resources/3_0/python/petstore_customized.yaml) -- [generated v3.1.0 unit test client sample code](samples/client/3_1_0_unit_test/python) - - [Openapi json schema v3.1.0 unit test spec](src/test/resources/3_1/unit_test_spec/3_1_0_unit_test_spec.yaml) -- [generated v3.0.3 unit test client sample code](samples/client/3_0_3_unit_test/python) - - [Openapi json schema v3.0.3 unit test spec](src/test/resources/3_0/unit_test_spec/3_0_3_unit_test_spec.yaml) - -## Reasons To Use the Java Generator - -- v3.0.0 - [v3.1.0](docs/generators/java.md#schema-feature) OpenAPI Specification support -- Documentation generated in the style of javadocs. Examples: [Money schema](samples/client/petstore/java/docs/components/schemas/Money.md#money1) [Pet.addPet endpoint](samples/client/petstore/java/docs/apis/tags/Pet.md#addpet) -- Sealed classes used to define endpoint responses/response bodies/validated schema payloads/request bodies -- Input types constrained for a Schema in SomeSchema.validate - - validate method can accept arbitrary List/Map/null/int/long/double/float/String json data -- Immutable List output classes generated and returned by validate for List<?> input -- Immutable Map output classes generated and returned by validate for Map<?, ?> input -- Strictly typed list input can be instantiated in client code using generated ListBuilders -- Strictly typed map input can be instantiated in client code using generated MapBuilders - - Sequential map builders are generated ensuring that required properties are set before build is invoked. Looks like: - - `new MapBuilder().requiredA("a").requiredB("b").build()` - - `new MapBuilder().requiredA("a").requiredB("b").optionalProp("c").additionalProperty("someAddProp", "d").build()` -- Run time type checking and validation when - - validating schema payloads - - instantiating List output class (validation run) - - instantiating Map output class (validation run) - - Note: if needed, validation of json schema keywords can be deactivated via a SchemaConfiguration class -- Enums classes are generated and may be input into Schema.validate or the List/MapBuilder add/setter methods -- The [Checker-Framework's](https://github.com/typetools/checker-framework) NullnessChecker and @Nullable annotations are used in the java client - - ensuring that null pointer exceptions will not happen -- Invalid (in java) property names supported like `class`, `1var`, `hi-there` etc in - - component schema names - - schema property names (a fallback setter is written in the MapBuilder) -- Generated interfaces are largely consistent with the python code -- Openapi spec inline schemas supported at any depth in any location -- Format support for: int32, int64, float, double, date, datetime, uuid -- Payload values are not coerced when validated, so a date/date-time value can pass other validations that describe the payload only as type string -- enum types are generated for enums of type string/integer/number/boolean/null -- String transmission of numbers supported with type: string, format: number -- [Autogenerated thorough testing of json schema keyword features in models and endpoints](samples/client/3_0_3_unit_test/java/src/test/java/org/openapijsonschematools/client/components/schemas) which come from the [json schema test suite](https://github.com/json-schema-org/JSON-Schema-Test-Suite) -- [Tests are passing in CI](https://app.circleci.com/pipelines/github/openapi-json-schema-tools/openapi-json-schema-generator?branch=master) +## Join Our Community +We use a Discord server as a place to ask questions and help each other. It offers functionality very similar to Slack. +You can join us here: https://discord.gg/mHB8WEQuYQ And many more! - [Docs for the java generator](docs/generators/java.md)